summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorMichael Widenius <monty@mariadb.org>2018-03-09 14:05:35 +0200
committerMonty <monty@mariadb.org>2018-03-29 13:59:44 +0300
commita7abddeffa6a760ce948c2dfb007cdf3f1a369d5 (patch)
tree70eb743fa965a17380bbc0ac88ae79ca1075b896 /mysql-test/t
parentab1941266c59a19703a74b5593cf3f508a5752d7 (diff)
downloadmariadb-git-a7abddeffa6a760ce948c2dfb007cdf3f1a369d5.tar.gz
Create 'main' test directory and move 't' and 'r' there
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/1st.test5
-rw-r--r--mysql-test/t/aborted_clients.test28
-rw-r--r--mysql-test/t/adddate_454.test9
-rw-r--r--mysql-test/t/alias.test228
-rw-r--r--mysql-test/t/almost_full.test45
-rw-r--r--mysql-test/t/alter_table-big.test173
-rw-r--r--mysql-test/t/alter_table.test1915
-rw-r--r--mysql-test/t/alter_table_autoinc-5574.test12
-rw-r--r--mysql-test/t/alter_table_mdev539_maria.test7
-rw-r--r--mysql-test/t/alter_table_mdev539_myisam.test7
-rw-r--r--mysql-test/t/alter_table_online.test335
-rw-r--r--mysql-test/t/alter_table_trans.test47
-rw-r--r--mysql-test/t/alter_user.test79
-rw-r--r--mysql-test/t/analyze.test87
-rw-r--r--mysql-test/t/analyze_debug.test13
-rw-r--r--mysql-test/t/analyze_format_json.test226
-rw-r--r--mysql-test/t/analyze_stmt.test275
-rw-r--r--mysql-test/t/analyze_stmt_orderby.test177
-rw-r--r--mysql-test/t/analyze_stmt_privileges.test49
-rw-r--r--mysql-test/t/analyze_stmt_privileges2.test5402
-rw-r--r--mysql-test/t/analyze_stmt_slow_query_log-master.opt1
-rw-r--r--mysql-test/t/analyze_stmt_slow_query_log.test38
-rw-r--r--mysql-test/t/ansi.test41
-rw-r--r--mysql-test/t/assign_key_cache-5405.test27
-rw-r--r--mysql-test/t/auth_named_pipe-master.opt1
-rw-r--r--mysql-test/t/auth_named_pipe.test23
-rw-r--r--mysql-test/t/auth_rpl-slave.opt1
-rw-r--r--mysql-test/t/auth_rpl.test63
-rw-r--r--mysql-test/t/auto_increment.test399
-rw-r--r--mysql-test/t/auto_increment_ranges.inc240
-rw-r--r--mysql-test/t/auto_increment_ranges_innodb.test7
-rw-r--r--mysql-test/t/auto_increment_ranges_myisam.test7
-rw-r--r--mysql-test/t/bad_frm_crash_5029.test20
-rw-r--r--mysql-test/t/bench_count_distinct.test24
-rw-r--r--mysql-test/t/bigint.test418
-rw-r--r--mysql-test/t/binary.test141
-rw-r--r--mysql-test/t/binary_to_hex.test96
-rw-r--r--mysql-test/t/blackhole.test40
-rw-r--r--mysql-test/t/blackhole_plugin.test33
-rw-r--r--mysql-test/t/bool.test62
-rw-r--r--mysql-test/t/bootstrap-master.opt1
-rw-r--r--mysql-test/t/bootstrap.test108
-rw-r--r--mysql-test/t/bug12427262.test51
-rw-r--r--mysql-test/t/bug13633383.test83
-rw-r--r--mysql-test/t/bug39022.test58
-rw-r--r--mysql-test/t/bug46760-master.opt2
-rw-r--r--mysql-test/t/bug46760.test38
-rw-r--r--mysql-test/t/bug47671-master.opt1
-rw-r--r--mysql-test/t/bug47671.test9
-rw-r--r--mysql-test/t/bug58669-master.opt1
-rw-r--r--mysql-test/t/bug58669.test22
-rw-r--r--mysql-test/t/bulk_replace.test15
-rw-r--r--mysql-test/t/cache_innodb.test31
-rw-r--r--mysql-test/t/cache_temporal_4265.test22
-rw-r--r--mysql-test/t/case.test395
-rw-r--r--mysql-test/t/cast.test726
-rw-r--r--mysql-test/t/change_user.test151
-rw-r--r--mysql-test/t/change_user_notembedded.test26
-rw-r--r--mysql-test/t/check.test81
-rw-r--r--mysql-test/t/check_constraint.test113
-rw-r--r--mysql-test/t/check_constraint_show.test8
-rw-r--r--mysql-test/t/client_xml.test44
-rw-r--r--mysql-test/t/column_compression.inc125
-rw-r--r--mysql-test/t/column_compression.test81
-rw-r--r--mysql-test/t/column_compression_parts.test182
-rw-r--r--mysql-test/t/column_compression_rpl.test16
-rw-r--r--mysql-test/t/comment_column.test133
-rw-r--r--mysql-test/t/comment_column2.test172
-rw-r--r--mysql-test/t/comment_index.test102
-rw-r--r--mysql-test/t/comment_table.test55
-rw-r--r--mysql-test/t/comments.test101
-rw-r--r--mysql-test/t/commit.test675
-rw-r--r--mysql-test/t/commit_1innodb.test8
-rw-r--r--mysql-test/t/compare.test96
-rw-r--r--mysql-test/t/compound.test160
-rw-r--r--mysql-test/t/compress.test31
-rw-r--r--mysql-test/t/concurrent_innodb_safelog-master.opt1
-rw-r--r--mysql-test/t/concurrent_innodb_safelog.test23
-rw-r--r--mysql-test/t/concurrent_innodb_unsafelog-master.opt2
-rw-r--r--mysql-test/t/concurrent_innodb_unsafelog.test23
-rw-r--r--mysql-test/t/connect.cnf8
-rw-r--r--mysql-test/t/connect.test459
-rw-r--r--mysql-test/t/connect2.cnf9
-rw-r--r--mysql-test/t/connect2.test83
-rw-r--r--mysql-test/t/consistent_snapshot.test69
-rw-r--r--mysql-test/t/constraints.test79
-rw-r--r--mysql-test/t/contributors.test1
-rw-r--r--mysql-test/t/count_distinct.test154
-rw-r--r--mysql-test/t/count_distinct2-master.opt1
-rw-r--r--mysql-test/t/count_distinct2.test86
-rw-r--r--mysql-test/t/count_distinct3.test52
-rw-r--r--mysql-test/t/crash_commit_before-master.opt3
-rw-r--r--mysql-test/t/crash_commit_before.test37
-rw-r--r--mysql-test/t/create-big.test552
-rw-r--r--mysql-test/t/create-uca.test26
-rw-r--r--mysql-test/t/create.test1943
-rw-r--r--mysql-test/t/create_delayed.test34
-rw-r--r--mysql-test/t/create_drop_binlog.test198
-rw-r--r--mysql-test/t/create_drop_db.test32
-rw-r--r--mysql-test/t/create_drop_event.test47
-rw-r--r--mysql-test/t/create_drop_function.test41
-rw-r--r--mysql-test/t/create_drop_index.test16
-rw-r--r--mysql-test/t/create_drop_procedure.test41
-rw-r--r--mysql-test/t/create_drop_role.test56
-rw-r--r--mysql-test/t/create_drop_server.test34
-rw-r--r--mysql-test/t/create_drop_trigger.test30
-rw-r--r--mysql-test/t/create_drop_udf.test37
-rw-r--r--mysql-test/t/create_drop_user.test46
-rw-r--r--mysql-test/t/create_drop_view.test27
-rw-r--r--mysql-test/t/create_not_windows.test43
-rw-r--r--mysql-test/t/create_or_replace-master.opt1
-rw-r--r--mysql-test/t/create_or_replace.test422
-rw-r--r--mysql-test/t/create_or_replace2.test35
-rw-r--r--mysql-test/t/create_or_replace_permission.test71
-rw-r--r--mysql-test/t/create_select_tmp.test39
-rw-r--r--mysql-test/t/create_user.test58
-rw-r--r--mysql-test/t/create_w_max_indexes_128.test571
-rw-r--r--mysql-test/t/create_w_max_indexes_64.test334
-rw-r--r--mysql-test/t/cte_grant.test130
-rw-r--r--mysql-test/t/cte_nonrecursive.test1014
-rw-r--r--mysql-test/t/cte_recursive.test2310
-rw-r--r--mysql-test/t/ctype_ascii.test13
-rw-r--r--mysql-test/t/ctype_big5.test271
-rw-r--r--mysql-test/t/ctype_binary.test76
-rw-r--r--mysql-test/t/ctype_collate.test341
-rw-r--r--mysql-test/t/ctype_cp1250_ch.test116
-rw-r--r--mysql-test/t/ctype_cp1251.test145
-rw-r--r--mysql-test/t/ctype_cp850.test16
-rw-r--r--mysql-test/t/ctype_cp932.test49
-rw-r--r--mysql-test/t/ctype_cp932_binlog_row.test5
-rw-r--r--mysql-test/t/ctype_cp932_binlog_stm.test198
-rw-r--r--mysql-test/t/ctype_create.test143
-rw-r--r--mysql-test/t/ctype_errors.test60
-rw-r--r--mysql-test/t/ctype_eucjpms.test596
-rw-r--r--mysql-test/t/ctype_euckr.test219
-rw-r--r--mysql-test/t/ctype_filename.test29
-rw-r--r--mysql-test/t/ctype_filesystem-master.opt2
-rw-r--r--mysql-test/t/ctype_filesystem.test8
-rw-r--r--mysql-test/t/ctype_gb2312.test182
-rw-r--r--mysql-test/t/ctype_gbk.test483
-rw-r--r--mysql-test/t/ctype_gbk_binlog.test37
-rw-r--r--mysql-test/t/ctype_gbk_export_import.test161
-rw-r--r--mysql-test/t/ctype_hebrew.test16
-rw-r--r--mysql-test/t/ctype_latin1.test428
-rw-r--r--mysql-test/t/ctype_latin1_de-master.opt1
-rw-r--r--mysql-test/t/ctype_latin1_de.test182
-rw-r--r--mysql-test/t/ctype_latin2.test76
-rw-r--r--mysql-test/t/ctype_latin2_ch.test245
-rw-r--r--mysql-test/t/ctype_ldml-master.opt2
-rw-r--r--mysql-test/t/ctype_ldml.test604
-rw-r--r--mysql-test/t/ctype_like_range.test199
-rw-r--r--mysql-test/t/ctype_many.test353
-rw-r--r--mysql-test/t/ctype_mb.test28
-rw-r--r--mysql-test/t/ctype_nopad_8bit.test239
-rw-r--r--mysql-test/t/ctype_partitions.test29
-rw-r--r--mysql-test/t/ctype_recoding.test256
-rw-r--r--mysql-test/t/ctype_sjis.test262
-rw-r--r--mysql-test/t/ctype_swe7.test40
-rw-r--r--mysql-test/t/ctype_tis620.test214
-rw-r--r--mysql-test/t/ctype_uca.test679
-rw-r--r--mysql-test/t/ctype_uca_innodb.test25
-rw-r--r--mysql-test/t/ctype_uca_partitions.test38
-rw-r--r--mysql-test/t/ctype_ucs.test1069
-rw-r--r--mysql-test/t/ctype_ucs2_def-master.opt1
-rw-r--r--mysql-test/t/ctype_ucs2_def.test57
-rw-r--r--mysql-test/t/ctype_ucs2_query_cache-master.opt1
-rw-r--r--mysql-test/t/ctype_ucs2_query_cache.test22
-rw-r--r--mysql-test/t/ctype_ucs2_uca.test25
-rw-r--r--mysql-test/t/ctype_ujis.test1427
-rw-r--r--mysql-test/t/ctype_ujis_ucs2.test1306
-rw-r--r--mysql-test/t/ctype_upgrade.test199
-rw-r--r--mysql-test/t/ctype_utf16.test930
-rw-r--r--mysql-test/t/ctype_utf16_def-master.opt1
-rw-r--r--mysql-test/t/ctype_utf16_def.test9
-rw-r--r--mysql-test/t/ctype_utf16_uca.test248
-rw-r--r--mysql-test/t/ctype_utf16le.test802
-rw-r--r--mysql-test/t/ctype_utf32.test1032
-rw-r--r--mysql-test/t/ctype_utf32_uca.test270
-rw-r--r--mysql-test/t/ctype_utf8-master.opt1
-rw-r--r--mysql-test/t/ctype_utf8.test2178
-rw-r--r--mysql-test/t/ctype_utf8_uca.test23
-rw-r--r--mysql-test/t/ctype_utf8mb4-master.opt1
-rw-r--r--mysql-test/t/ctype_utf8mb4.test2015
-rw-r--r--mysql-test/t/ctype_utf8mb4_heap.test6
-rw-r--r--mysql-test/t/ctype_utf8mb4_innodb-master.opt1
-rw-r--r--mysql-test/t/ctype_utf8mb4_innodb.test6
-rw-r--r--mysql-test/t/ctype_utf8mb4_myisam.test5
-rw-r--r--mysql-test/t/ctype_utf8mb4_uca.test110
-rw-r--r--mysql-test/t/custom_aggregate_functions.test785
-rw-r--r--mysql-test/t/date_formats-master.opt1
-rw-r--r--mysql-test/t/date_formats.test377
-rw-r--r--mysql-test/t/datetime_456.test8
-rw-r--r--mysql-test/t/ddl_i18n_koi8r.test1121
-rw-r--r--mysql-test/t/ddl_i18n_utf8.test1124
-rw-r--r--mysql-test/t/deadlock_innodb.test16
-rw-r--r--mysql-test/t/debug_sync.test427
-rw-r--r--mysql-test/t/default.test2106
-rw-r--r--mysql-test/t/default_debug.test22
-rw-r--r--mysql-test/t/default_session.test82
-rw-r--r--mysql-test/t/default_storage_engine.test16
-rw-r--r--mysql-test/t/delayed.test644
-rw-r--r--mysql-test/t/delete.test584
-rw-r--r--mysql-test/t/delete_returning.test172
-rw-r--r--mysql-test/t/delete_returning_grant.test82
-rw-r--r--mysql-test/t/delete_use_source.test133
-rw-r--r--mysql-test/t/delimiter_case_mdev_10728.sql3
-rw-r--r--mysql-test/t/delimiter_command_case_sensitivity.test4
-rw-r--r--mysql-test/t/deprecated_features.test25
-rw-r--r--mysql-test/t/derived.test1013
-rw-r--r--mysql-test/t/derived_cond_pushdown.test2615
-rw-r--r--mysql-test/t/derived_opt.test367
-rw-r--r--mysql-test/t/derived_view.test1954
-rw-r--r--mysql-test/t/dirty_close.test60
-rw-r--r--mysql-test/t/distinct.test793
-rw-r--r--mysql-test/t/drop-no_root.test85
-rw-r--r--mysql-test/t/drop.test324
-rw-r--r--mysql-test/t/drop_bad_db_type.test31
-rw-r--r--mysql-test/t/dyncol.test984
-rw-r--r--mysql-test/t/empty_server_name-8224.test13
-rw-r--r--mysql-test/t/empty_string_literal.test8
-rw-r--r--mysql-test/t/empty_table.test24
-rw-r--r--mysql-test/t/empty_user_table.test20
-rw-r--r--mysql-test/t/endspace.test103
-rw-r--r--mysql-test/t/enforce_storage_engine.test111
-rw-r--r--mysql-test/t/enforce_storage_engine_opt.opt1
-rw-r--r--mysql-test/t/enforce_storage_engine_opt.test7
-rw-r--r--mysql-test/t/engine_error_in_alter-8453.test11
-rw-r--r--mysql-test/t/error_simulation-master.opt1
-rw-r--r--mysql-test/t/error_simulation.test164
-rw-r--r--mysql-test/t/errors.test226
-rw-r--r--mysql-test/t/events_1.test493
-rw-r--r--mysql-test/t/events_2.test524
-rw-r--r--mysql-test/t/events_bugs-master.opt1
-rw-r--r--mysql-test/t/events_bugs.test1301
-rw-r--r--mysql-test/t/events_embedded.test5
-rw-r--r--mysql-test/t/events_grant.test113
-rw-r--r--mysql-test/t/events_logs_tests-master.opt1
-rw-r--r--mysql-test/t/events_logs_tests.test90
-rw-r--r--mysql-test/t/events_microsec.test21
-rw-r--r--mysql-test/t/events_restart-master.opt1
-rw-r--r--mysql-test/t/events_restart.test141
-rw-r--r--mysql-test/t/events_scheduling.test148
-rw-r--r--mysql-test/t/events_slowlog.test28
-rw-r--r--mysql-test/t/events_stress.test142
-rw-r--r--mysql-test/t/events_time_zone.test336
-rw-r--r--mysql-test/t/events_trans.test151
-rw-r--r--mysql-test/t/events_trans_notembedded.test68
-rw-r--r--mysql-test/t/except.test97
-rw-r--r--mysql-test/t/execution_constants.test84
-rw-r--r--mysql-test/t/explain.test335
-rw-r--r--mysql-test/t/explain_json.test419
-rw-r--r--mysql-test/t/explain_json_format_partitions.test17
-rw-r--r--mysql-test/t/explain_json_innodb.test28
-rw-r--r--mysql-test/t/explain_non_select.test252
-rw-r--r--mysql-test/t/explain_slowquerylog-master.opt1
-rw-r--r--mysql-test/t/explain_slowquerylog.test63
-rw-r--r--mysql-test/t/ext_key_noPK_6794.test15
-rw-r--r--mysql-test/t/failed_auth_3909.test37
-rw-r--r--mysql-test/t/failed_auth_unixsocket.test36
-rw-r--r--mysql-test/t/fast_prefix_index_fetch_innodb.test668
-rw-r--r--mysql-test/t/features.test141
-rw-r--r--mysql-test/t/file_contents.test70
-rw-r--r--mysql-test/t/filesort_bad_i_s-7585.test14
-rw-r--r--mysql-test/t/filesort_debug.test101
-rw-r--r--mysql-test/t/fix_priv_tables.test81
-rw-r--r--mysql-test/t/flush-innodb-notembedded.test61
-rw-r--r--mysql-test/t/flush-innodb.test434
-rw-r--r--mysql-test/t/flush.test675
-rw-r--r--mysql-test/t/flush2-master.opt1
-rw-r--r--mysql-test/t/flush2.test16
-rw-r--r--mysql-test/t/flush_block_commit.test98
-rw-r--r--mysql-test/t/flush_block_commit_notembedded.test64
-rw-r--r--mysql-test/t/flush_read_lock.test2024
-rw-r--r--mysql-test/t/flush_read_lock_kill.test80
-rw-r--r--mysql-test/t/flush_table.test129
-rw-r--r--mysql-test/t/foreign_key.test120
-rw-r--r--mysql-test/t/frm_bad_row_type-7333.test14
-rw-r--r--mysql-test/t/fulltext.test718
-rw-r--r--mysql-test/t/fulltext2.test240
-rw-r--r--mysql-test/t/fulltext3.test49
-rw-r--r--mysql-test/t/fulltext_cache.test46
-rw-r--r--mysql-test/t/fulltext_charsets.test10
-rw-r--r--mysql-test/t/fulltext_derived_4257.test6
-rw-r--r--mysql-test/t/fulltext_derived_4316.test14
-rw-r--r--mysql-test/t/fulltext_distinct.test46
-rw-r--r--mysql-test/t/fulltext_left_join.test113
-rw-r--r--mysql-test/t/fulltext_multi.test25
-rw-r--r--mysql-test/t/fulltext_order_by.test154
-rw-r--r--mysql-test/t/fulltext_update.test29
-rw-r--r--mysql-test/t/fulltext_var.test36
-rw-r--r--mysql-test/t/func_analyse.test183
-rw-r--r--mysql-test/t/func_compress.test190
-rw-r--r--mysql-test/t/func_concat.test244
-rw-r--r--mysql-test/t/func_crypt.test122
-rw-r--r--mysql-test/t/func_date_add.test171
-rw-r--r--mysql-test/t/func_debug.test477
-rw-r--r--mysql-test/t/func_default.test43
-rw-r--r--mysql-test/t/func_des_encrypt.test39
-rw-r--r--mysql-test/t/func_digest.test540
-rw-r--r--mysql-test/t/func_encrypt-master.opt1
-rw-r--r--mysql-test/t/func_encrypt.test145
-rw-r--r--mysql-test/t/func_encrypt_nossl.test38
-rw-r--r--mysql-test/t/func_encrypt_ucs2.test12
-rw-r--r--mysql-test/t/func_equal.test46
-rw-r--r--mysql-test/t/func_gconcat.test990
-rw-r--r--mysql-test/t/func_group.test1731
-rw-r--r--mysql-test/t/func_group_innodb.test195
-rw-r--r--mysql-test/t/func_hybrid_type.test617
-rw-r--r--mysql-test/t/func_if.test226
-rw-r--r--mysql-test/t/func_in.test692
-rw-r--r--mysql-test/t/func_int.test188
-rw-r--r--mysql-test/t/func_isnull.test88
-rw-r--r--mysql-test/t/func_json.test426
-rw-r--r--mysql-test/t/func_like.test209
-rw-r--r--mysql-test/t/func_math.test661
-rw-r--r--mysql-test/t/func_misc.test1194
-rw-r--r--mysql-test/t/func_op.test37
-rw-r--r--mysql-test/t/func_regexp.test112
-rw-r--r--mysql-test/t/func_regexp_pcre.test465
-rw-r--r--mysql-test/t/func_regexp_pcre_debug.test6
-rw-r--r--mysql-test/t/func_rollback.test488
-rw-r--r--mysql-test/t/func_sapdb.test194
-rw-r--r--mysql-test/t/func_set.test149
-rw-r--r--mysql-test/t/func_str.test1918
-rw-r--r--mysql-test/t/func_system.test57
-rw-r--r--mysql-test/t/func_test.test245
-rw-r--r--mysql-test/t/func_time.test2059
-rw-r--r--mysql-test/t/func_time_hires.test108
-rw-r--r--mysql-test/t/func_timestamp.test23
-rw-r--r--mysql-test/t/func_weight_string.test173
-rw-r--r--mysql-test/t/function_defaults.test21
-rw-r--r--mysql-test/t/function_defaults_innodb.test24
-rw-r--r--mysql-test/t/function_defaults_notembedded.test18
-rw-r--r--mysql-test/t/gcc296.test22
-rw-r--r--mysql-test/t/get_diagnostics.test852
-rw-r--r--mysql-test/t/gis-alter_table_online.test82
-rw-r--r--mysql-test/t/gis-debug.test113
-rw-r--r--mysql-test/t/gis-json.test49
-rw-r--r--mysql-test/t/gis-loaddata.test21
-rw-r--r--mysql-test/t/gis-precise.test386
-rw-r--r--mysql-test/t/gis-rt-precise.test86
-rw-r--r--mysql-test/t/gis-rtree.test1012
-rw-r--r--mysql-test/t/gis.test2992
-rw-r--r--mysql-test/t/gis2.test45
-rw-r--r--mysql-test/t/grant.test2240
-rw-r--r--mysql-test/t/grant2.test1019
-rw-r--r--mysql-test/t/grant3-master.opt1
-rw-r--r--mysql-test/t/grant3.test213
-rw-r--r--mysql-test/t/grant4.test237
-rw-r--r--mysql-test/t/grant5.test25
-rw-r--r--mysql-test/t/grant_4332.test45
-rw-r--r--mysql-test/t/grant_cache_no_prot.test25
-rw-r--r--mysql-test/t/grant_cache_ps_prot.test24
-rw-r--r--mysql-test/t/grant_explain_non_select.test263
-rw-r--r--mysql-test/t/grant_lowercase.opt1
-rw-r--r--mysql-test/t/grant_lowercase.test30
-rw-r--r--mysql-test/t/grant_lowercase_fs.test32
-rw-r--r--mysql-test/t/greedy_optimizer.test391
-rw-r--r--mysql-test/t/group_by.test1950
-rw-r--r--mysql-test/t/group_by_innodb.test168
-rw-r--r--mysql-test/t/group_by_null.test7
-rw-r--r--mysql-test/t/group_min_max.test1613
-rw-r--r--mysql-test/t/group_min_max_innodb.test245
-rw-r--r--mysql-test/t/handler_read_last.test25
-rw-r--r--mysql-test/t/handlersocket.test10
-rw-r--r--mysql-test/t/having.test875
-rw-r--r--mysql-test/t/help.test146
-rw-r--r--mysql-test/t/host_cache_size_functionality.test185
-rw-r--r--mysql-test/t/huge_frm-6224.test20
-rw-r--r--mysql-test/t/implicit_char_to_num_conversion.test174
-rw-r--r--mysql-test/t/implicit_commit-master.opt1
-rw-r--r--mysql-test/t/implicit_commit.test1169
-rw-r--r--mysql-test/t/in_datetime_241.test9
-rw-r--r--mysql-test/t/index_intersect.test461
-rw-r--r--mysql-test/t/index_intersect_innodb.test7
-rw-r--r--mysql-test/t/index_merge_innodb.test207
-rw-r--r--mysql-test/t/index_merge_myisam.test245
-rw-r--r--mysql-test/t/information_schema-big.test45
-rw-r--r--mysql-test/t/information_schema.test1905
-rw-r--r--mysql-test/t/information_schema2.test19
-rw-r--r--mysql-test/t/information_schema_all_engines-master.opt18
-rw-r--r--mysql-test/t/information_schema_all_engines.test87
-rw-r--r--mysql-test/t/information_schema_chmod.test24
-rw-r--r--mysql-test/t/information_schema_db.test257
-rw-r--r--mysql-test/t/information_schema_inno.test121
-rw-r--r--mysql-test/t/information_schema_linux.test10
-rw-r--r--mysql-test/t/information_schema_parameters.test276
-rw-r--r--mysql-test/t/information_schema_part.test140
-rw-r--r--mysql-test/t/information_schema_routines.test249
-rw-r--r--mysql-test/t/information_schema_stats.test46
-rw-r--r--mysql-test/t/init_connect-master.opt1
-rw-r--r--mysql-test/t/init_connect.test262
-rw-r--r--mysql-test/t/init_connection_query_cache-master.opt1
-rw-r--r--mysql-test/t/init_connection_query_cache.test26
-rw-r--r--mysql-test/t/init_file.opt1
-rw-r--r--mysql-test/t/init_file.test37
-rw-r--r--mysql-test/t/init_file_longline_3816.opt1
-rw-r--r--mysql-test/t/init_file_longline_3816.test5
-rw-r--r--mysql-test/t/init_file_set_password-7656.test26
-rw-r--r--mysql-test/t/innodb_bug878769.test56
-rw-r--r--mysql-test/t/innodb_ext_key.test823
-rw-r--r--mysql-test/t/innodb_group.test22
-rw-r--r--mysql-test/t/innodb_icp.test78
-rw-r--r--mysql-test/t/innodb_ignore_builtin-master.opt1
-rw-r--r--mysql-test/t/innodb_ignore_builtin.test6
-rw-r--r--mysql-test/t/innodb_load_xa.opt1
-rw-r--r--mysql-test/t/innodb_load_xa.test25
-rw-r--r--mysql-test/t/innodb_mrr_cpk.test229
-rw-r--r--mysql-test/t/innodb_mysql_lock.test256
-rw-r--r--mysql-test/t/innodb_mysql_lock2.test868
-rw-r--r--mysql-test/t/innodb_mysql_sync.test750
-rw-r--r--mysql-test/t/innodb_utf8.test24
-rw-r--r--mysql-test/t/insert.test614
-rw-r--r--mysql-test/t/insert_innodb.test64
-rw-r--r--mysql-test/t/insert_notembedded.test160
-rw-r--r--mysql-test/t/insert_select.test427
-rw-r--r--mysql-test/t/insert_update.test313
-rw-r--r--mysql-test/t/insert_update_autoinc-7150.test8
-rw-r--r--mysql-test/t/intersect.test285
-rw-r--r--mysql-test/t/invisible_binlog.test32
-rw-r--r--mysql-test/t/invisible_field.test240
-rw-r--r--mysql-test/t/invisible_field_debug.test272
-rw-r--r--mysql-test/t/ipv4_and_ipv6.opt1
-rw-r--r--mysql-test/t/ipv4_and_ipv6.test13
-rw-r--r--mysql-test/t/ipv4_as_ipv6-master.opt1
-rw-r--r--mysql-test/t/ipv4_as_ipv6.test60
-rw-r--r--mysql-test/t/ipv6-master.opt1
-rw-r--r--mysql-test/t/ipv6.test32
-rw-r--r--mysql-test/t/join.test1202
-rw-r--r--mysql-test/t/join_cache.test3962
-rw-r--r--mysql-test/t/join_crash.test121
-rw-r--r--mysql-test/t/join_nested.test1382
-rw-r--r--mysql-test/t/join_nested_jcl6.test111
-rw-r--r--mysql-test/t/join_optimizer.test45
-rw-r--r--mysql-test/t/join_outer.test1997
-rw-r--r--mysql-test/t/join_outer_innodb.test375
-rw-r--r--mysql-test/t/join_outer_jcl6.test24
-rw-r--r--mysql-test/t/key.test583
-rw-r--r--mysql-test/t/key_cache-master.opt1
-rw-r--r--mysql-test/t/key_cache.test540
-rw-r--r--mysql-test/t/key_diff.test24
-rw-r--r--mysql-test/t/key_primary.test20
-rw-r--r--mysql-test/t/keyread.test10
-rw-r--r--mysql-test/t/keywords.test261
-rw-r--r--mysql-test/t/kill-2-master.opt1
-rw-r--r--mysql-test/t/kill-2.test29
-rw-r--r--mysql-test/t/kill.test644
-rw-r--r--mysql-test/t/kill_processlist-6619.test33
-rw-r--r--mysql-test/t/kill_query-6728.test13
-rw-r--r--mysql-test/t/last_value.test46
-rw-r--r--mysql-test/t/limit.test117
-rw-r--r--mysql-test/t/limit_rows_examined.test578
-rw-r--r--mysql-test/t/loaddata.test718
-rw-r--r--mysql-test/t/loaddata_autocom_innodb.test4
-rw-r--r--mysql-test/t/loadxml.test164
-rw-r--r--mysql-test/t/locale.test183
-rw-r--r--mysql-test/t/lock.test600
-rw-r--r--mysql-test/t/lock_multi.test1059
-rw-r--r--mysql-test/t/lock_multi_bug38499.test228
-rw-r--r--mysql-test/t/lock_multi_bug38691.test146
-rw-r--r--mysql-test/t/lock_sync-master.opt2
-rw-r--r--mysql-test/t/lock_sync.test1099
-rw-r--r--mysql-test/t/lock_tables_lost_commit-master.opt1
-rw-r--r--mysql-test/t/lock_tables_lost_commit.test33
-rw-r--r--mysql-test/t/locked_temporary-5955.test10
-rw-r--r--mysql-test/t/log_errchk.test65
-rw-r--r--mysql-test/t/log_slow.test60
-rw-r--r--mysql-test/t/log_state-master.opt1
-rw-r--r--mysql-test/t/log_state.test342
-rw-r--r--mysql-test/t/log_state_bug33693-master.opt1
-rw-r--r--mysql-test/t/log_state_bug33693.test18
-rw-r--r--mysql-test/t/log_tables-big-master.opt1
-rw-r--r--mysql-test/t/log_tables-big.test40
-rw-r--r--mysql-test/t/log_tables-master.opt1
-rw-r--r--mysql-test/t/log_tables.test1064
-rw-r--r--mysql-test/t/log_tables_debug.test95
-rw-r--r--mysql-test/t/log_tables_upgrade.test28
-rw-r--r--mysql-test/t/long_tmpdir-master.opt1
-rw-r--r--mysql-test/t/long_tmpdir-master.sh3
-rw-r--r--mysql-test/t/long_tmpdir.test9
-rw-r--r--mysql-test/t/lowercase_fs_off.test116
-rw-r--r--mysql-test/t/lowercase_fs_on.test38
-rw-r--r--mysql-test/t/lowercase_mixed_tmpdir-master.opt2
-rw-r--r--mysql-test/t/lowercase_mixed_tmpdir-master.sh6
-rw-r--r--mysql-test/t/lowercase_mixed_tmpdir.test12
-rw-r--r--mysql-test/t/lowercase_mixed_tmpdir_innodb-master.opt2
-rw-r--r--mysql-test/t/lowercase_mixed_tmpdir_innodb-master.sh6
-rw-r--r--mysql-test/t/lowercase_mixed_tmpdir_innodb.test12
-rw-r--r--mysql-test/t/lowercase_table-master.opt1
-rw-r--r--mysql-test/t/lowercase_table.test120
-rw-r--r--mysql-test/t/lowercase_table2.test290
-rw-r--r--mysql-test/t/lowercase_table4-master.opt1
-rw-r--r--mysql-test/t/lowercase_table4.test111
-rw-r--r--mysql-test/t/lowercase_table5.test20
-rw-r--r--mysql-test/t/lowercase_table_grant-master.opt1
-rw-r--r--mysql-test/t/lowercase_table_grant.test31
-rw-r--r--mysql-test/t/lowercase_table_qcache-master.opt1
-rw-r--r--mysql-test/t/lowercase_table_qcache.test34
-rw-r--r--mysql-test/t/lowercase_utf8-master.opt4
-rw-r--r--mysql-test/t/lowercase_utf8.test9
-rw-r--r--mysql-test/t/lowercase_view-master.opt1
-rw-r--r--mysql-test/t/lowercase_view.test110
-rw-r--r--mysql-test/t/max_statement_time.test228
-rw-r--r--mysql-test/t/mdev-504.test80
-rw-r--r--mysql-test/t/mdev13607.test60
-rw-r--r--mysql-test/t/mdev316.test14
-rw-r--r--mysql-test/t/mdev375.test23
-rw-r--r--mysql-test/t/mdev6830.test63
-rw-r--r--mysql-test/t/mdev_14586.test27
-rw-r--r--mysql-test/t/mdl.test19
-rw-r--r--mysql-test/t/mdl_sync-master.opt1
-rw-r--r--mysql-test/t/mdl_sync.test4104
-rw-r--r--mysql-test/t/merge-big.test78
-rw-r--r--mysql-test/t/merge.test2916
-rw-r--r--mysql-test/t/merge_debug.test46
-rw-r--r--mysql-test/t/merge_innodb.test72
-rw-r--r--mysql-test/t/merge_mmap-master.opt1
-rw-r--r--mysql-test/t/merge_mmap.test151
-rw-r--r--mysql-test/t/metadata.test485
-rw-r--r--mysql-test/t/mix2_myisam.test29
-rw-r--r--mysql-test/t/mix2_myisam_ucs2.test27
-rw-r--r--mysql-test/t/mrr_derived_crash_4610.test16
-rw-r--r--mysql-test/t/mrr_icp_extra.test242
-rw-r--r--mysql-test/t/multi_statement-master.opt3
-rw-r--r--mysql-test/t/multi_statement.test37
-rw-r--r--mysql-test/t/multi_update-master.opt1
-rw-r--r--mysql-test/t/multi_update.test916
-rw-r--r--mysql-test/t/multi_update2-master.opt1
-rw-r--r--mysql-test/t/multi_update2.test78
-rw-r--r--mysql-test/t/multi_update_binlog.test82
-rw-r--r--mysql-test/t/multi_update_innodb.test175
-rw-r--r--mysql-test/t/multi_update_tiny_hash-master.opt1
-rw-r--r--mysql-test/t/multi_update_tiny_hash.test61
-rw-r--r--mysql-test/t/myisam-big.test64
-rw-r--r--mysql-test/t/myisam-blob-master.opt1
-rw-r--r--mysql-test/t/myisam-blob.test44
-rw-r--r--mysql-test/t/myisam-master.opt1
-rw-r--r--mysql-test/t/myisam-optimize.test58
-rw-r--r--mysql-test/t/myisam-system.test29
-rw-r--r--mysql-test/t/myisam.test1801
-rw-r--r--mysql-test/t/myisam_crash_before_flush_keys-master.opt1
-rw-r--r--mysql-test/t/myisam_crash_before_flush_keys.test47
-rw-r--r--mysql-test/t/myisam_debug.test72
-rw-r--r--mysql-test/t/myisam_enable_keys-10506.test120
-rw-r--r--mysql-test/t/myisam_explain_non_select_all.test21
-rw-r--r--mysql-test/t/myisam_icp.test286
-rw-r--r--mysql-test/t/myisam_icp_notembedded.test139
-rw-r--r--mysql-test/t/myisam_mrr.test326
-rw-r--r--mysql-test/t/myisam_optimize.test65
-rw-r--r--mysql-test/t/myisam_recover-master.opt1
-rw-r--r--mysql-test/t/myisam_recover.test173
-rw-r--r--mysql-test/t/myisampack.test328
-rw-r--r--mysql-test/t/mysql-bug41486.test51
-rw-r--r--mysql-test/t/mysql-bug45236.test45
-rw-r--r--mysql-test/t/mysql.test677
-rw-r--r--mysql-test/t/mysql5613mysql.test120
-rw-r--r--mysql-test/t/mysql57_virtual.test29
-rw-r--r--mysql-test/t/mysql_binary_mode.test169
-rw-r--r--mysql-test/t/mysql_client_test-master.opt5
-rw-r--r--mysql-test/t/mysql_client_test.test33
-rw-r--r--mysql-test/t/mysql_client_test_comp-master.opt3
-rw-r--r--mysql-test/t/mysql_client_test_comp.test20
-rw-r--r--mysql-test/t/mysql_client_test_nonblock-master.opt3
-rw-r--r--mysql-test/t/mysql_client_test_nonblock.test25
-rw-r--r--mysql-test/t/mysql_comments.sql218
-rw-r--r--mysql-test/t/mysql_comments.test43
-rw-r--r--mysql-test/t/mysql_cp932.test22
-rw-r--r--mysql-test/t/mysql_delimiter.sql68
-rw-r--r--mysql-test/t/mysql_delimiter_19799.sql1
-rw-r--r--mysql-test/t/mysql_delimiter_source.sql8
-rw-r--r--mysql-test/t/mysql_embedded.test12
-rw-r--r--mysql-test/t/mysql_locale_posix.test205
-rw-r--r--mysql-test/t/mysql_not_windows.test24
-rw-r--r--mysql-test/t/mysql_protocols.test15
-rw-r--r--mysql-test/t/mysql_tzinfo_to_sql_symlink.test50
-rw-r--r--mysql-test/t/mysql_upgrade-6984.opt1
-rw-r--r--mysql-test/t/mysql_upgrade-6984.test23
-rw-r--r--mysql-test/t/mysql_upgrade.test243
-rw-r--r--mysql-test/t/mysql_upgrade_no_innodb.test6
-rw-r--r--mysql-test/t/mysql_upgrade_noengine.test62
-rw-r--r--mysql-test/t/mysql_upgrade_ssl.test12
-rw-r--r--mysql-test/t/mysql_upgrade_view.test188
-rw-r--r--mysql-test/t/mysqladmin.test53
-rw-r--r--mysql-test/t/mysqlbinlog-innodb.test30
-rw-r--r--mysql-test/t/mysqlbinlog-master.opt1
-rw-r--r--mysql-test/t/mysqlbinlog.test597
-rw-r--r--mysql-test/t/mysqlbinlog_raw_mode.test387
-rw-r--r--mysql-test/t/mysqlbinlog_row_big.test148
-rw-r--r--mysql-test/t/mysqlbinlog_row_compressed.test68
-rw-r--r--mysql-test/t/mysqlbinlog_row_minimal.opt1
-rw-r--r--mysql-test/t/mysqlbinlog_row_minimal.test33
-rw-r--r--mysql-test/t/mysqlbinlog_stmt_compressed.test59
-rw-r--r--mysql-test/t/mysqlcheck.test409
-rw-r--r--mysql-test/t/mysqld--defaults-file.test31
-rw-r--r--mysql-test/t/mysqld--help.test69
-rw-r--r--mysql-test/t/mysqld_help_crash-9183.test9
-rw-r--r--mysql-test/t/mysqld_option_err.test59
-rw-r--r--mysql-test/t/mysqldump-compat.opt1
-rw-r--r--mysql-test/t/mysqldump-compat.test17
-rw-r--r--mysql-test/t/mysqldump-max-master.opt1
-rw-r--r--mysql-test/t/mysqldump-max.test1203
-rw-r--r--mysql-test/t/mysqldump-nl.test58
-rw-r--r--mysql-test/t/mysqldump-no-binlog-master.opt1
-rw-r--r--mysql-test/t/mysqldump-no-binlog.test7
-rw-r--r--mysql-test/t/mysqldump.test2691
-rw-r--r--mysql-test/t/mysqldump_restore.test111
-rw-r--r--mysql-test/t/mysqlhotcopy_myisam.test7
-rw-r--r--mysql-test/t/mysqlshow.test42
-rw-r--r--mysql-test/t/mysqlslap.opt1
-rw-r--r--mysql-test/t/mysqlslap.test82
-rw-r--r--mysql-test/t/mysqltest.test2964
-rw-r--r--mysql-test/t/mysqltest_256.test17
-rw-r--r--mysql-test/t/mysqltest_cont_on_error.test16
-rw-r--r--mysql-test/t/mysqltest_ps.test34
-rw-r--r--mysql-test/t/named_pipe-master.opt1
-rw-r--r--mysql-test/t/named_pipe.test32
-rw-r--r--mysql-test/t/negation_elimination.test103
-rw-r--r--mysql-test/t/no-threads-master.opt1
-rw-r--r--mysql-test/t/no-threads.test17
-rw-r--r--mysql-test/t/no_binlog.test6
-rw-r--r--mysql-test/t/no_password_column-mdev-11170.test95
-rw-r--r--mysql-test/t/non_blocking_api.test22
-rw-r--r--mysql-test/t/not_embedded_server.test208
-rw-r--r--mysql-test/t/not_partition.test100
-rw-r--r--mysql-test/t/null.test1181
-rw-r--r--mysql-test/t/null_key.test278
-rw-r--r--mysql-test/t/odbc.test38
-rw-r--r--mysql-test/t/olap.test449
-rw-r--r--mysql-test/t/old-mode-master.opt1
-rw-r--r--mysql-test/t/old-mode.test121
-rw-r--r--mysql-test/t/openssl_1.test268
-rw-r--r--mysql-test/t/openssl_6975.combinations6
-rw-r--r--mysql-test/t/openssl_6975.test43
-rw-r--r--mysql-test/t/opt_tvc.test362
-rw-r--r--mysql-test/t/order_by-mdev-10122.test39
-rw-r--r--mysql-test/t/order_by.test2189
-rw-r--r--mysql-test/t/order_by_innodb.test110
-rw-r--r--mysql-test/t/order_by_optimizer.test34
-rw-r--r--mysql-test/t/order_by_optimizer_innodb.test98
-rw-r--r--mysql-test/t/order_by_sortkey.test64
-rw-r--r--mysql-test/t/order_by_zerolength-4285.test15
-rw-r--r--mysql-test/t/order_fill_sortbuf.test30
-rw-r--r--mysql-test/t/outfile.test141
-rw-r--r--mysql-test/t/outfile_loaddata.test294
-rw-r--r--mysql-test/t/overflow.test14
-rw-r--r--mysql-test/t/packet.test56
-rw-r--r--mysql-test/t/parser.test1381
-rw-r--r--mysql-test/t/parser_bug21114_innodb.test422
-rw-r--r--mysql-test/t/parser_not_embedded.test101
-rw-r--r--mysql-test/t/parser_precedence.test335
-rw-r--r--mysql-test/t/parser_stack.test395
-rw-r--r--mysql-test/t/partition-master.opt1
-rw-r--r--mysql-test/t/partition.test2916
-rw-r--r--mysql-test/t/partition_alter.test127
-rw-r--r--mysql-test/t/partition_binlog.test43
-rw-r--r--mysql-test/t/partition_binlog_stmt.test27
-rw-r--r--mysql-test/t/partition_blackhole.test24
-rw-r--r--mysql-test/t/partition_bug18198.test219
-rw-r--r--mysql-test/t/partition_cache.test21
-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/partition_charset.test29
-rw-r--r--mysql-test/t/partition_column.test510
-rw-r--r--mysql-test/t/partition_column_prune.test71
-rw-r--r--mysql-test/t/partition_csv.test93
-rw-r--r--mysql-test/t/partition_datatype.test549
-rw-r--r--mysql-test/t/partition_debug_sync.test84
-rw-r--r--mysql-test/t/partition_default.test542
-rw-r--r--mysql-test/t/partition_disabled-master.opt1
-rw-r--r--mysql-test/t/partition_disabled.test104
-rw-r--r--mysql-test/t/partition_error.test2076
-rw-r--r--mysql-test/t/partition_example.test23
-rw-r--r--mysql-test/t/partition_exchange-master.opt1
-rw-r--r--mysql-test/t/partition_exchange.test525
-rw-r--r--mysql-test/t/partition_explicit_prune.test860
-rw-r--r--mysql-test/t/partition_grant.test82
-rw-r--r--mysql-test/t/partition_hash.test175
-rw-r--r--mysql-test/t/partition_innodb.test1021
-rw-r--r--mysql-test/t/partition_innodb_plugin.test153
-rw-r--r--mysql-test/t/partition_innodb_semi_consistent-master.opt1
-rw-r--r--mysql-test/t/partition_innodb_semi_consistent.test201
-rw-r--r--mysql-test/t/partition_innodb_stmt.test56
-rw-r--r--mysql-test/t/partition_key_cache.test279
-rw-r--r--mysql-test/t/partition_list.test211
-rw-r--r--mysql-test/t/partition_mgm.test91
-rw-r--r--mysql-test/t/partition_mgm_err.test225
-rw-r--r--mysql-test/t/partition_mgm_err2.test26
-rw-r--r--mysql-test/t/partition_myisam.test255
-rw-r--r--mysql-test/t/partition_not_blackhole-master.opt1
-rw-r--r--mysql-test/t/partition_not_blackhole.test29
-rw-r--r--mysql-test/t/partition_not_windows-master.opt1
-rw-r--r--mysql-test/t/partition_not_windows.test214
-rw-r--r--mysql-test/t/partition_open_files_limit-master.opt1
-rw-r--r--mysql-test/t/partition_open_files_limit.test26
-rw-r--r--mysql-test/t/partition_order.test844
-rw-r--r--mysql-test/t/partition_pruning.test1538
-rw-r--r--mysql-test/t/partition_range.test974
-rw-r--r--mysql-test/t/partition_rename_longfilename.test51
-rw-r--r--mysql-test/t/partition_symlink.test222
-rw-r--r--mysql-test/t/partition_sync.test83
-rw-r--r--mysql-test/t/partition_truncate.test33
-rw-r--r--mysql-test/t/partition_utf8.test42
-rw-r--r--mysql-test/t/partition_windows.test40
-rw-r--r--mysql-test/t/perror-win.test14
-rw-r--r--mysql-test/t/perror.test34
-rw-r--r--mysql-test/t/plugin.test267
-rw-r--r--mysql-test/t/plugin_auth.test589
-rw-r--r--mysql-test/t/plugin_auth_qa.test339
-rw-r--r--mysql-test/t/plugin_auth_qa_1.test285
-rw-r--r--mysql-test/t/plugin_auth_qa_2-master.opt1
-rw-r--r--mysql-test/t/plugin_auth_qa_2.test153
-rw-r--r--mysql-test/t/plugin_auth_qa_3-master.opt1
-rw-r--r--mysql-test/t/plugin_auth_qa_3.test25
-rw-r--r--mysql-test/t/plugin_innodb.test27
-rw-r--r--mysql-test/t/plugin_load.opt6
-rw-r--r--mysql-test/t/plugin_load.test18
-rw-r--r--mysql-test/t/plugin_load_option.opt2
-rw-r--r--mysql-test/t/plugin_load_option.test8
-rw-r--r--mysql-test/t/plugin_loaderr.opt1
-rw-r--r--mysql-test/t/plugin_loaderr.test26
-rw-r--r--mysql-test/t/plugin_maturity-master.opt1
-rw-r--r--mysql-test/t/plugin_maturity.test12
-rw-r--r--mysql-test/t/plugin_not_embedded.test32
-rw-r--r--mysql-test/t/plugin_vars.test56
-rw-r--r--mysql-test/t/pool_of_threads.cnf11
-rw-r--r--mysql-test/t/pool_of_threads.test93
-rw-r--r--mysql-test/t/preload.test105
-rw-r--r--mysql-test/t/processlist.test72
-rw-r--r--mysql-test/t/profiling.test263
-rw-r--r--mysql-test/t/progress_976225.test8
-rw-r--r--mysql-test/t/ps-master.opt1
-rw-r--r--mysql-test/t/ps.test4674
-rw-r--r--mysql-test/t/ps_10nestset.test73
-rw-r--r--mysql-test/t/ps_11bugs.test217
-rw-r--r--mysql-test/t/ps_1general.test944
-rw-r--r--mysql-test/t/ps_2myisam.test44
-rw-r--r--mysql-test/t/ps_3innodb-master.opt1
-rw-r--r--mysql-test/t/ps_3innodb.test30
-rw-r--r--mysql-test/t/ps_4heap.test52
-rw-r--r--mysql-test/t/ps_5merge.test86
-rw-r--r--mysql-test/t/ps_change_master.test45
-rw-r--r--mysql-test/t/ps_ddl.test2285
-rw-r--r--mysql-test/t/ps_ddl1.test398
-rw-r--r--mysql-test/t/ps_grant.test127
-rw-r--r--mysql-test/t/ps_max_subselect-5113.test20
-rw-r--r--mysql-test/t/ps_not_windows.test29
-rw-r--r--mysql-test/t/query_cache.test1788
-rw-r--r--mysql-test/t/query_cache_28249.test113
-rw-r--r--mysql-test/t/query_cache_debug.test353
-rw-r--r--mysql-test/t/query_cache_innodb.test85
-rw-r--r--mysql-test/t/query_cache_merge.test112
-rw-r--r--mysql-test/t/query_cache_notembedded-master.opt1
-rw-r--r--mysql-test/t/query_cache_notembedded.test336
-rw-r--r--mysql-test/t/query_cache_ps_no_prot.test22
-rw-r--r--mysql-test/t/query_cache_ps_ps_prot.test26
-rw-r--r--mysql-test/t/query_cache_with_views.test149
-rw-r--r--mysql-test/t/quick_select_4161.test54
-rw-r--r--mysql-test/t/range.test2046
-rw-r--r--mysql-test/t/range_innodb.test47
-rw-r--r--mysql-test/t/range_interrupted-13751.test25
-rw-r--r--mysql-test/t/range_mrr_icp.test7
-rw-r--r--mysql-test/t/range_vs_index_merge.test1299
-rw-r--r--mysql-test/t/range_vs_index_merge_innodb.test7
-rw-r--r--mysql-test/t/read_many_rows_innodb.test17
-rw-r--r--mysql-test/t/read_only.test346
-rw-r--r--mysql-test/t/read_only_innodb.test251
-rw-r--r--mysql-test/t/rename.test97
-rw-r--r--mysql-test/t/renamedb.test53
-rw-r--r--mysql-test/t/reopen_temp_table.test184
-rw-r--r--mysql-test/t/repair.test240
-rw-r--r--mysql-test/t/repair_symlink-5543.test27
-rw-r--r--mysql-test/t/replace.test47
-rw-r--r--mysql-test/t/rollback.test25
-rw-r--r--mysql-test/t/round.test145
-rw-r--r--mysql-test/t/row-checksum-master.opt1
-rw-r--r--mysql-test/t/row-checksum-old-master.opt2
-rw-r--r--mysql-test/t/row-checksum-old.test4
-rw-r--r--mysql-test/t/row-checksum.opt1
-rw-r--r--mysql-test/t/row-checksum.test62
-rw-r--r--mysql-test/t/row.test316
-rw-r--r--mysql-test/t/rowid_order_innodb.test14
-rw-r--r--mysql-test/t/rpl_mysqldump_slave.test88
-rw-r--r--mysql-test/t/schema.test179
-rw-r--r--mysql-test/t/second_frac-9175.test9
-rw-r--r--mysql-test/t/secure_file_priv_win-master.opt1
-rw-r--r--mysql-test/t/secure_file_priv_win.test79
-rw-r--r--mysql-test/t/select.test4673
-rw-r--r--mysql-test/t/select_debug.test19
-rw-r--r--mysql-test/t/select_found.test289
-rw-r--r--mysql-test/t/select_jcl6.test24
-rw-r--r--mysql-test/t/select_pkeycache-master.opt1
-rw-r--r--mysql-test/t/select_pkeycache.test8
-rw-r--r--mysql-test/t/select_safe.test92
-rw-r--r--mysql-test/t/selectivity.test1050
-rw-r--r--mysql-test/t/selectivity_innodb.test176
-rw-r--r--mysql-test/t/selectivity_no_engine.test238
-rw-r--r--mysql-test/t/servers.test24
-rw-r--r--mysql-test/t/set_password_plugin-9835.test131
-rw-r--r--mysql-test/t/set_statement.test1132
-rw-r--r--mysql-test/t/set_statement_debug.test26
-rw-r--r--mysql-test/t/set_statement_notembedded.test13
-rw-r--r--mysql-test/t/set_statement_notembedded_binlog.test88
-rw-r--r--mysql-test/t/set_statement_profiling.test9
-rw-r--r--mysql-test/t/shm-master.opt1
-rw-r--r--mysql-test/t/shm.test47
-rw-r--r--mysql-test/t/show.test15
-rw-r--r--mysql-test/t/show_bad_definer-5553.test12
-rw-r--r--mysql-test/t/show_check-master.opt1
-rw-r--r--mysql-test/t/show_check.test1392
-rw-r--r--mysql-test/t/show_create_user.test34
-rw-r--r--mysql-test/t/show_explain.test1204
-rw-r--r--mysql-test/t/show_explain_non_select.test78
-rw-r--r--mysql-test/t/show_explain_ps.test60
-rw-r--r--mysql-test/t/show_function_with_pad_char_to_full_length.test23
-rw-r--r--mysql-test/t/show_grants_with_plugin-7985.test160
-rw-r--r--mysql-test/t/show_profile.test18
-rw-r--r--mysql-test/t/show_row_order-9226.test73
-rw-r--r--mysql-test/t/shutdown.test38
-rw-r--r--mysql-test/t/sighup-6580.test10
-rw-r--r--mysql-test/t/signal.test2687
-rw-r--r--mysql-test/t/signal_code.test42
-rw-r--r--mysql-test/t/signal_demo1.test330
-rw-r--r--mysql-test/t/signal_demo2.test192
-rw-r--r--mysql-test/t/signal_demo3.test144
-rw-r--r--mysql-test/t/signal_sqlmode.test108
-rw-r--r--mysql-test/t/simultaneous_assignment.test204
-rw-r--r--mysql-test/t/single_delete_update.test454
-rw-r--r--mysql-test/t/single_delete_update_innodb.test30
-rw-r--r--mysql-test/t/skip_grants-master.opt1
-rw-r--r--mysql-test/t/skip_grants.test139
-rw-r--r--mysql-test/t/skip_log_bin-master.opt1
-rw-r--r--mysql-test/t/skip_log_bin.test25
-rw-r--r--mysql-test/t/skip_name_resolve-master.opt1
-rw-r--r--mysql-test/t/skip_name_resolve.test53
-rw-r--r--mysql-test/t/slowlog_enospace-10508.test24
-rw-r--r--mysql-test/t/sp-anchor-row-type-cursor.test1118
-rw-r--r--mysql-test/t/sp-anchor-row-type-table.test883
-rw-r--r--mysql-test/t/sp-anchor-type.test762
-rw-r--r--mysql-test/t/sp-big.test117
-rw-r--r--mysql-test/t/sp-bugs.test323
-rw-r--r--mysql-test/t/sp-bugs2.test29
-rw-r--r--mysql-test/t/sp-code.test929
-rw-r--r--mysql-test/t/sp-cursor.test609
-rw-r--r--mysql-test/t/sp-destruct.test322
-rw-r--r--mysql-test/t/sp-dynamic.test362
-rw-r--r--mysql-test/t/sp-error.test3851
-rw-r--r--mysql-test/t/sp-fib.test54
-rw-r--r--mysql-test/t/sp-for-loop.test212
-rw-r--r--mysql-test/t/sp-group.test187
-rw-r--r--mysql-test/t/sp-innodb.test162
-rw-r--r--mysql-test/t/sp-lock.test1007
-rw-r--r--mysql-test/t/sp-no-code.test12
-rw-r--r--mysql-test/t/sp-prelocking.test446
-rw-r--r--mysql-test/t/sp-row-vs-var.inc6
-rw-r--r--mysql-test/t/sp-row.test1506
-rw-r--r--mysql-test/t/sp-security-anchor-type.test328
-rw-r--r--mysql-test/t/sp-security.test1052
-rw-r--r--mysql-test/t/sp-threads.test201
-rw-r--r--mysql-test/t/sp-ucs2.test177
-rw-r--r--mysql-test/t/sp-vars.test1538
-rw-r--r--mysql-test/t/sp.test10122
-rw-r--r--mysql-test/t/sp_gis.test39
-rw-r--r--mysql-test/t/sp_missing_4665.test9
-rw-r--r--mysql-test/t/sp_notembedded.test489
-rw-r--r--mysql-test/t/sp_stress_case.test89
-rw-r--r--mysql-test/t/sp_sync.test170
-rw-r--r--mysql-test/t/sp_trans.test707
-rw-r--r--mysql-test/t/sp_trans_log.test49
-rw-r--r--mysql-test/t/sql_mode.test556
-rw-r--r--mysql-test/t/ssl-big.test66
-rw-r--r--mysql-test/t/ssl.test41
-rw-r--r--mysql-test/t/ssl_7937.combinations10
-rw-r--r--mysql-test/t/ssl_7937.test35
-rw-r--r--mysql-test/t/ssl_8k_key-master.opt2
-rw-r--r--mysql-test/t/ssl_8k_key.test11
-rw-r--r--mysql-test/t/ssl_and_innodb.test11
-rw-r--r--mysql-test/t/ssl_ca.test16
-rw-r--r--mysql-test/t/ssl_cert_verify.test43
-rw-r--r--mysql-test/t/ssl_cipher-master.opt1
-rw-r--r--mysql-test/t/ssl_cipher.test23
-rw-r--r--mysql-test/t/ssl_compress.test35
-rw-r--r--mysql-test/t/ssl_connect.test18
-rw-r--r--mysql-test/t/ssl_crl-master.opt4
-rw-r--r--mysql-test/t/ssl_crl.test16
-rw-r--r--mysql-test/t/ssl_crl_clients-master.opt4
-rw-r--r--mysql-test/t/ssl_crl_clients.test41
-rw-r--r--mysql-test/t/ssl_crl_clients_valid-master.opt4
-rw-r--r--mysql-test/t/ssl_crl_clients_valid.test23
-rw-r--r--mysql-test/t/ssl_crl_clrpath-master.opt4
-rw-r--r--mysql-test/t/ssl_crl_clrpath.test16
-rw-r--r--mysql-test/t/ssl_timeout-9836.opt1
-rw-r--r--mysql-test/t/ssl_timeout-9836.test11
-rw-r--r--mysql-test/t/ssl_timeout.test20
-rw-r--r--mysql-test/t/stack-crash.test96
-rw-r--r--mysql-test/t/stat_tables-enospc.test23
-rw-r--r--mysql-test/t/stat_tables.test308
-rw-r--r--mysql-test/t/stat_tables_disabled.test78
-rw-r--r--mysql-test/t/stat_tables_innodb.test12
-rw-r--r--mysql-test/t/stat_tables_innodb_debug.test36
-rw-r--r--mysql-test/t/stat_tables_myisam_debug.test33
-rw-r--r--mysql-test/t/stat_tables_par.test278
-rw-r--r--mysql-test/t/stat_tables_par_innodb.test12
-rw-r--r--mysql-test/t/stat_tables_partition.test17
-rw-r--r--mysql-test/t/stat_tables_rbr.test30
-rw-r--r--mysql-test/t/stat_tables_repl.test58
-rw-r--r--mysql-test/t/statistics.test855
-rw-r--r--mysql-test/t/statistics_index_crash-7362.test30
-rw-r--r--mysql-test/t/status-master.opt1
-rw-r--r--mysql-test/t/status.test440
-rw-r--r--mysql-test/t/status2.test68
-rw-r--r--mysql-test/t/status_bug17954.test54
-rw-r--r--mysql-test/t/str_to_datetime_457.test26
-rw-r--r--mysql-test/t/strict-master.opt1
-rw-r--r--mysql-test/t/strict.test1373
-rw-r--r--mysql-test/t/strict_autoinc_1myisam.test8
-rw-r--r--mysql-test/t/strict_autoinc_2innodb.test10
-rw-r--r--mysql-test/t/strict_autoinc_3heap.test8
-rw-r--r--mysql-test/t/subselect.test6153
-rw-r--r--mysql-test/t/subselect2.test413
-rw-r--r--mysql-test/t/subselect3.test1318
-rw-r--r--mysql-test/t/subselect3_jcl6.test22
-rw-r--r--mysql-test/t/subselect4.test2054
-rw-r--r--mysql-test/t/subselect_cache.test1718
-rw-r--r--mysql-test/t/subselect_debug.test27
-rw-r--r--mysql-test/t/subselect_exists2in.test832
-rw-r--r--mysql-test/t/subselect_exists2in_costmat.test83
-rw-r--r--mysql-test/t/subselect_extra.test395
-rw-r--r--mysql-test/t/subselect_extra_no_semijoin.test9
-rw-r--r--mysql-test/t/subselect_gis.test17
-rw-r--r--mysql-test/t/subselect_innodb.test613
-rw-r--r--mysql-test/t/subselect_mat.test285
-rw-r--r--mysql-test/t/subselect_mat_cost-master.opt1
-rw-r--r--mysql-test/t/subselect_mat_cost.test429
-rw-r--r--mysql-test/t/subselect_mat_cost_bugs.test544
-rw-r--r--mysql-test/t/subselect_no_exists_to_in.test11
-rw-r--r--mysql-test/t/subselect_no_mat.test17
-rw-r--r--mysql-test/t/subselect_no_opts.test14
-rw-r--r--mysql-test/t/subselect_no_scache.test15
-rw-r--r--mysql-test/t/subselect_no_semijoin.test12
-rw-r--r--mysql-test/t/subselect_notembedded.test62
-rw-r--r--mysql-test/t/subselect_nulls.test105
-rw-r--r--mysql-test/t/subselect_partial_match.test803
-rw-r--r--mysql-test/t/subselect_sj.test2850
-rw-r--r--mysql-test/t/subselect_sj2.test1468
-rw-r--r--mysql-test/t/subselect_sj2_jcl6.test113
-rw-r--r--mysql-test/t/subselect_sj2_mat.test305
-rw-r--r--mysql-test/t/subselect_sj_aria.test76
-rw-r--r--mysql-test/t/subselect_sj_jcl6.test216
-rw-r--r--mysql-test/t/subselect_sj_mat.test2239
-rw-r--r--mysql-test/t/subselect_sj_nonmerged.test121
-rw-r--r--mysql-test/t/sum_distinct-big.test153
-rw-r--r--mysql-test/t/sum_distinct.test107
-rw-r--r--mysql-test/t/symlink-aria-11902.test6
-rw-r--r--mysql-test/t/symlink-myisam-11902.test60
-rw-r--r--mysql-test/t/symlink.test343
-rw-r--r--mysql-test/t/synchronization.test50
-rw-r--r--mysql-test/t/sysdate_is_now-master.opt1
-rw-r--r--mysql-test/t/sysdate_is_now.test11
-rw-r--r--mysql-test/t/system_mysql_db.test19
-rw-r--r--mysql-test/t/system_mysql_db_fix40123.test82
-rw-r--r--mysql-test/t/system_mysql_db_fix50030.test89
-rw-r--r--mysql-test/t/system_mysql_db_fix50117.test106
-rw-r--r--mysql-test/t/system_mysql_db_refs.test103
-rw-r--r--mysql-test/t/table_elim.test643
-rw-r--r--mysql-test/t/table_elim_debug.test28
-rw-r--r--mysql-test/t/table_keyinfo-6838.test18
-rw-r--r--mysql-test/t/table_options-5867.test30
-rw-r--r--mysql-test/t/table_options.test68
-rw-r--r--mysql-test/t/table_value_constr.test1046
-rw-r--r--mysql-test/t/tablelock.test64
-rw-r--r--mysql-test/t/tablespace.test122
-rw-r--r--mysql-test/t/tc_heuristic_recover.test98
-rw-r--r--mysql-test/t/temp_table-master.opt1
-rw-r--r--mysql-test/t/temp_table.test597
-rw-r--r--mysql-test/t/temp_table_frm.test16
-rw-r--r--mysql-test/t/temporal_literal.test346
-rw-r--r--mysql-test/t/temporal_scale_4283.test13
-rw-r--r--mysql-test/t/thread_id_overflow.test35
-rw-r--r--mysql-test/t/timeout.test60
-rw-r--r--mysql-test/t/timezone-master.opt1
-rw-r--r--mysql-test/t/timezone.test65
-rw-r--r--mysql-test/t/timezone2.test310
-rw-r--r--mysql-test/t/timezone3-master.opt1
-rw-r--r--mysql-test/t/timezone3.test73
-rw-r--r--mysql-test/t/timezone4-master.opt1
-rw-r--r--mysql-test/t/timezone4.test13
-rw-r--r--mysql-test/t/timezone_grant.test126
-rw-r--r--mysql-test/t/tmp_table_count-7586.test56
-rw-r--r--mysql-test/t/trans_read_only-master.opt1
-rw-r--r--mysql-test/t/trans_read_only.test49
-rw-r--r--mysql-test/t/transaction_timeout.test54
-rw-r--r--mysql-test/t/trigger-compat.test290
-rw-r--r--mysql-test/t/trigger-trans.test235
-rw-r--r--mysql-test/t/trigger.test2750
-rw-r--r--mysql-test/t/trigger_no_defaults-11698.test42
-rw-r--r--mysql-test/t/trigger_notembedded.test994
-rw-r--r--mysql-test/t/trigger_null-8605.test389
-rw-r--r--mysql-test/t/trigger_wl3253.test428
-rw-r--r--mysql-test/t/truncate-stale-6500.test32
-rw-r--r--mysql-test/t/truncate.test165
-rw-r--r--mysql-test/t/truncate_badse.test15
-rw-r--r--mysql-test/t/truncate_coverage.test108
-rw-r--r--mysql-test/t/type_binary.test128
-rw-r--r--mysql-test/t/type_bit.test460
-rw-r--r--mysql-test/t/type_bit_innodb.test159
-rw-r--r--mysql-test/t/type_blob.test682
-rw-r--r--mysql-test/t/type_date.test616
-rw-r--r--mysql-test/t/type_datetime.test851
-rw-r--r--mysql-test/t/type_datetime_hires.test81
-rw-r--r--mysql-test/t/type_decimal.test675
-rw-r--r--mysql-test/t/type_enum.test520
-rw-r--r--mysql-test/t/type_float.test553
-rw-r--r--mysql-test/t/type_int.test78
-rw-r--r--mysql-test/t/type_json.test31
-rw-r--r--mysql-test/t/type_nchar.test36
-rw-r--r--mysql-test/t/type_newdecimal-big.test50
-rw-r--r--mysql-test/t/type_newdecimal.test1786
-rw-r--r--mysql-test/t/type_num.test721
-rw-r--r--mysql-test/t/type_num_innodb.test41
-rw-r--r--mysql-test/t/type_ranges.test176
-rw-r--r--mysql-test/t/type_set.test250
-rw-r--r--mysql-test/t/type_temporal_innodb.test68
-rw-r--r--mysql-test/t/type_temporal_mysql56.test23
-rw-r--r--mysql-test/t/type_time.test1292
-rw-r--r--mysql-test/t/type_time_6065.test200
-rw-r--r--mysql-test/t/type_time_hires.test12
-rw-r--r--mysql-test/t/type_timestamp.test608
-rw-r--r--mysql-test/t/type_timestamp_hires.test42
-rw-r--r--mysql-test/t/type_uint.test50
-rw-r--r--mysql-test/t/type_varchar.test330
-rw-r--r--mysql-test/t/type_year.test256
-rw-r--r--mysql-test/t/udf.test530
-rw-r--r--mysql-test/t/udf_debug_sync.test40
-rw-r--r--mysql-test/t/udf_notembedded.test14
-rw-r--r--mysql-test/t/udf_query_cache.test36
-rw-r--r--mysql-test/t/udf_skip_grants-master.opt1
-rw-r--r--mysql-test/t/udf_skip_grants.test28
-rw-r--r--mysql-test/t/union-master.opt1
-rw-r--r--mysql-test/t/union.test1751
-rw-r--r--mysql-test/t/union_crash-714.test9
-rw-r--r--mysql-test/t/uniques_crash-7912.test26
-rw-r--r--mysql-test/t/unsafe_binlog_innodb-master.opt1
-rw-r--r--mysql-test/t/unsafe_binlog_innodb.test16
-rw-r--r--mysql-test/t/update.test656
-rw-r--r--mysql-test/t/update_ignore_216.test13
-rw-r--r--mysql-test/t/update_innodb.test77
-rw-r--r--mysql-test/t/update_use_source.test245
-rw-r--r--mysql-test/t/upgrade.test182
-rw-r--r--mysql-test/t/user_limits-master.opt1
-rw-r--r--mysql-test/t/user_limits.test218
-rw-r--r--mysql-test/t/user_var-binlog.test24
-rw-r--r--mysql-test/t/user_var.test523
-rw-r--r--mysql-test/t/userstat-badlogin-4824.test33
-rw-r--r--mysql-test/t/userstat.test116
-rw-r--r--mysql-test/t/varbinary.test158
-rw-r--r--mysql-test/t/variables-master.opt1
-rw-r--r--mysql-test/t/variables-notembedded-master.opt1
-rw-r--r--mysql-test/t/variables-notembedded.test177
-rw-r--r--mysql-test/t/variables.test1549
-rw-r--r--mysql-test/t/variables_community.test11
-rw-r--r--mysql-test/t/view.test6223
-rw-r--r--mysql-test/t/view_alias.test101
-rw-r--r--mysql-test/t/view_debug.test36
-rw-r--r--mysql-test/t/view_grant.test2207
-rw-r--r--mysql-test/t/wait_timeout.test143
-rw-r--r--mysql-test/t/warnings-master.opt1
-rw-r--r--mysql-test/t/warnings.test300
-rw-r--r--mysql-test/t/warnings_debug.test19
-rw-r--r--mysql-test/t/warnings_engine_disabled.test25
-rw-r--r--mysql-test/t/win.test2072
-rw-r--r--mysql-test/t/win_as_arg_to_aggregate_func.test139
-rw-r--r--mysql-test/t/win_avg.test47
-rw-r--r--mysql-test/t/win_big-mdev-10092.test103
-rw-r--r--mysql-test/t/win_big-mdev-11697.test50
-rw-r--r--mysql-test/t/win_big.test123
-rw-r--r--mysql-test/t/win_bit.test89
-rw-r--r--mysql-test/t/win_empty_over.test66
-rw-r--r--mysql-test/t/win_first_last_value.test87
-rw-r--r--mysql-test/t/win_i_s.test18
-rw-r--r--mysql-test/t/win_insert_select.test79
-rw-r--r--mysql-test/t/win_lead_lag.test110
-rw-r--r--mysql-test/t/win_min_max.test370
-rw-r--r--mysql-test/t/win_nth_value.test67
-rw-r--r--mysql-test/t/win_ntile.test171
-rw-r--r--mysql-test/t/win_orderby.test32
-rw-r--r--mysql-test/t/win_percent_cume.test36
-rw-r--r--mysql-test/t/win_percentile.test104
-rw-r--r--mysql-test/t/win_rank.test58
-rw-r--r--mysql-test/t/win_std.test136
-rw-r--r--mysql-test/t/win_sum.test47
-rw-r--r--mysql-test/t/windows.test116
-rw-r--r--mysql-test/t/wl4435_generated.inc588
-rw-r--r--mysql-test/t/xa.test482
-rw-r--r--mysql-test/t/xa_binlog.test32
-rw-r--r--mysql-test/t/xa_sync.test45
-rw-r--r--mysql-test/t/xml.test784
-rw-r--r--mysql-test/t/xtradb_mrr.test462
1097 files changed, 0 insertions, 317311 deletions
diff --git a/mysql-test/t/1st.test b/mysql-test/t/1st.test
deleted file mode 100644
index 6b93efee944..00000000000
--- a/mysql-test/t/1st.test
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-# Check that we haven't any strange new tables or databases
-#
-show databases;
-show tables in mysql;
diff --git a/mysql-test/t/aborted_clients.test b/mysql-test/t/aborted_clients.test
deleted file mode 100644
index 20ddc9991e6..00000000000
--- a/mysql-test/t/aborted_clients.test
+++ /dev/null
@@ -1,28 +0,0 @@
-# Test case for MDEV-246, lp:992983
-# Check that ordinary connect/disconnect does not increase aborted_clients
-# status variable, but KILL connection does
-
--- source include/not_embedded.inc
--- source include/count_sessions.inc
-
-FLUSH STATUS;
-# Connect/Disconnect look that aborted_clients stays 0
-connect (con1,localhost,root,,);
-disconnect con1;
-connection default;
--- source include/wait_until_count_sessions.inc
-# Check that there is 0 aborted clients so far
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='aborted_clients';
-
-# Kill a connection, check that aborted_clients is incremented
-connect(con2,localhost,root,,);
---disable_reconnect
---error ER_CONNECTION_KILLED
-KILL CONNECTION_ID();
-disconnect con2;
-connection default;
--- source include/wait_until_count_sessions.inc
-
-# aborted clients must be 1 now
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='aborted_clients';
-FLUSH STATUS;
diff --git a/mysql-test/t/adddate_454.test b/mysql-test/t/adddate_454.test
deleted file mode 100644
index bbdd89b583d..00000000000
--- a/mysql-test/t/adddate_454.test
+++ /dev/null
@@ -1,9 +0,0 @@
-#
-# MDEV-454 Addition of a time interval reduces the resulting value
-#
-create table t1 (d date);
-insert into t1 values ('2012-00-00');
-select * from t1;
-update ignore t1 set d = adddate(d, interval 1 day);
-select * from t1;
-drop table t1;
diff --git a/mysql-test/t/alias.test b/mysql-test/t/alias.test
deleted file mode 100644
index c02ebe2f5ff..00000000000
--- a/mysql-test/t/alias.test
+++ /dev/null
@@ -1,228 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (
- cont_nr int(11) NOT NULL auto_increment,
- ver_nr int(11) NOT NULL default '0',
- aufnr int(11) NOT NULL default '0',
- username varchar(50) NOT NULL default '',
- hdl_nr int(11) NOT NULL default '0',
- eintrag date NOT NULL default '0000-00-00',
- st_klasse varchar(40) NOT NULL default '',
- st_wert varchar(40) NOT NULL default '',
- st_zusatz varchar(40) NOT NULL default '',
- st_bemerkung varchar(255) NOT NULL default '',
- kunden_art varchar(40) NOT NULL default '',
- mcbs_knr int(11) default NULL,
- mcbs_aufnr int(11) NOT NULL default '0',
- schufa_status char(1) default '?',
- bemerkung text,
- wirknetz text,
- wf_igz int(11) NOT NULL default '0',
- tarifcode varchar(80) default NULL,
- recycle char(1) default NULL,
- sim varchar(30) default NULL,
- mcbs_tpl varchar(30) default NULL,
- emp_nr int(11) NOT NULL default '0',
- laufzeit int(11) default NULL,
- hdl_name varchar(30) default NULL,
- prov_hdl_nr int(11) NOT NULL default '0',
- auto_wirknetz varchar(50) default NULL,
- auto_billing varchar(50) default NULL,
- touch timestamp NOT NULL,
- kategorie varchar(50) default NULL,
- kundentyp varchar(20) NOT NULL default '',
- sammel_rech_msisdn varchar(30) NOT NULL default '',
- p_nr varchar(9) NOT NULL default '',
- suffix char(3) NOT NULL default '',
- PRIMARY KEY (cont_nr),
- KEY idx_aufnr(aufnr),
- KEY idx_hdl_nr(hdl_nr),
- KEY idx_st_klasse(st_klasse),
- KEY ver_nr(ver_nr),
- KEY eintrag_idx(eintrag),
- KEY emp_nr_idx(emp_nr),
- KEY wf_igz(wf_igz),
- KEY touch(touch),
- KEY hdl_tag(eintrag,hdl_nr),
- KEY prov_hdl_nr(prov_hdl_nr),
- KEY mcbs_aufnr(mcbs_aufnr),
- KEY kundentyp(kundentyp),
- KEY p_nr(p_nr,suffix)
-) ENGINE=MyISAM;
-
-INSERT INTO t1 VALUES (3359356,405,3359356,'Mustermann Musterfrau',52500,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprft','','privat',1485525,2122316,'+','','N',1909160,'MobilComSuper92000D2',NULL,NULL,'MS9ND2',3,24,'MobilCom Shop Koeln',52500,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
-INSERT INTO t1 VALUES (3359357,468,3359357,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprft','','privat',1503580,2139699,'+','','P',1909171,'MobilComSuper9D1T10SFreisprech(Akquise)',NULL,NULL,'MS9NS1',327,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
-INSERT INTO t1 VALUES (3359358,407,3359358,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprft','','privat',1501358,2137473,'N','','N',1909159,'MobilComSuper92000D2',NULL,NULL,'MS9ND2',325,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
-INSERT INTO t1 VALUES (3359359,468,3359359,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprft','','privat',1507831,2143894,'+','','P',1909162,'MobilComSuper9D1T10SFreisprech(Akquise)',NULL,NULL,'MS9NS1',327,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
-INSERT INTO t1 VALUES (3359360,0,0,'Mustermann Musterfrau',29674907,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprft','','privat',1900169997,2414578,'+',NULL,'N',1909148,'',NULL,NULL,'RV99066_2',20,NULL,'POS',29674907,NULL,NULL,20010202105916,'Mobilfunk','','','97317481','007');
-INSERT INTO t1 VALUES (3359361,406,3359361,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag storniert','','(7001-84):Storno, Kd. mchte nicht mehr','privat',NULL,0,'+','','P',1909150,'MobilComSuper92000D1(Akquise)',NULL,NULL,'MS9ND1',325,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
-INSERT INTO t1 VALUES (3359362,406,3359362,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprft','','privat',1509984,2145874,'+','','P',1909154,'MobilComSuper92000D1(Akquise)',NULL,NULL,'MS9ND1',327,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','','');
-
-# This died because we used the field Kundentyp twice
-SELECT ELT(FIELD(kundentyp,'PP','PPA','PG','PGA','FK','FKA','FP','FPA','K','KA','V','VA',''), 'Privat (Private Nutzung)','Privat (Private Nutzung) Sitz im Ausland','Privat (geschaeftliche Nutzung)','Privat (geschaeftliche Nutzung) Sitz im Ausland','Firma (Kapitalgesellschaft)','Firma (Kapitalgesellschaft) Sitz im Ausland','Firma (Personengesellschaft)','Firma (Personengesellschaft) Sitz im Ausland','oeff. rechtl. Koerperschaft','oeff. rechtl. Koerperschaft Sitz im Ausland','Eingetragener Verein','Eingetragener Verein Sitz im Ausland','Typ unbekannt') AS Kundentyp ,kategorie FROM t1 WHERE hdl_nr < 2000000 AND kategorie IN ('Prepaid','Mobilfunk') AND st_klasse = 'Workflow' GROUP BY kundentyp ORDER BY kategorie;
-
-drop table t1;
-
-#
-# test case for #570
-#
-
-CREATE TABLE t1 (
- AUFNR varchar(12) NOT NULL default '',
- PLNFL varchar(6) NOT NULL default '',
- VORNR varchar(4) NOT NULL default '',
- xstatus_vor smallint(5) unsigned NOT NULL default '0'
-);
-
-INSERT INTO t1 VALUES ('40004712','000001','0010',9);
-INSERT INTO t1 VALUES ('40004712','000001','0020',0);
-
-UPDATE t1 SET t1.xstatus_vor = Greatest(t1.xstatus_vor,1) WHERE t1.aufnr =
-"40004712" AND t1.plnfl = "000001" AND t1.vornr > "0010" ORDER BY t1.vornr
-ASC LIMIT 1;
-
-drop table t1;
-
-# End of 4.1 tests
-
-#
-# Bug#27249 table_wild with alias: select t1.* as something
-#
-
---disable_warnings
-drop table if exists t1,t2,t3;
---enable_warnings
-
-create table t1 (a int, b int, c int);
-create table t2 (d int);
-create table t3 (a1 int, b1 int, c1 int);
-insert into t1 values(1,2,3);
-insert into t1 values(11,22,33);
-insert into t2 values(99);
-
-# Invalid queries with alias on wild
---error ER_PARSE_ERROR
-select t1.* as 'with_alias' from t1;
---error ER_PARSE_ERROR
-select t2.* as 'with_alias' from t2;
---error ER_PARSE_ERROR
-select t1.*, t1.* as 'with_alias' from t1;
---error ER_PARSE_ERROR
-select t1.* as 'with_alias', t1.* from t1;
---error ER_PARSE_ERROR
-select t1.* as 'with_alias', t1.* as 'alias2' from t1;
---error ER_PARSE_ERROR
-select t1.* as 'with_alias', a, t1.* as 'alias2' from t1;
-
-# other fields without alias
---error ER_PARSE_ERROR
-select a, t1.* as 'with_alias' from t1;
---error ER_PARSE_ERROR
-select t1.* as 'with_alias', a from t1;
---error ER_PARSE_ERROR
-select a, t1.* as 'with_alias', b from t1;
---error ER_PARSE_ERROR
-select (select d from t2 where d > a), t1.* as 'with_alias' from t1;
---error ER_PARSE_ERROR
-select t1.* as 'with_alias', (select a from t2 where d > a) from t1;
-
-# other fields with alias
---error ER_PARSE_ERROR
-select a as 'x', t1.* as 'with_alias' from t1;
---error ER_PARSE_ERROR
-select t1.* as 'with_alias', a as 'x' from t1;
---error ER_PARSE_ERROR
-select a as 'x', t1.* as 'with_alias', b as 'x' from t1;
---error ER_PARSE_ERROR
-select (select d from t2 where d > a) as 'x', t1.* as 'with_alias' from t1;
---error ER_PARSE_ERROR
-select t1.* as 'with_alias', (select a from t2 where d > a) as 'x' from t1;
-
-# some more subquery
---error ER_PARSE_ERROR
-select (select t2.* as 'x' from t2) from t1;
---error ER_PARSE_ERROR
-select a, (select t2.* as 'x' from t2) from t1;
---error ER_PARSE_ERROR
-select t1.*, (select t2.* as 'x' from t2) from t1;
-
-# insert
---error ER_PARSE_ERROR
-insert into t3 select t1.* as 'with_alias' from t1;
---error ER_PARSE_ERROR
-insert into t3 select t2.* as 'with_alias', 1, 2 from t2;
---error ER_PARSE_ERROR
-insert into t3 select t2.* as 'with_alias', d as 'x', d as 'z' from t2;
---error ER_PARSE_ERROR
-insert into t3 select t2.*, t2.* as 'with_alias', 3 from t2;
-
-# create
---error ER_PARSE_ERROR
-create table t3 select t1.* as 'with_alias' from t1;
---error ER_PARSE_ERROR
-create table t3 select t2.* as 'with_alias', 1, 2 from t2;
---error ER_PARSE_ERROR
-create table t3 select t2.* as 'with_alias', d as 'x', d as 'z' from t2;
---error ER_PARSE_ERROR
-create table t3 select t2.*, t2.* as 'with_alias', 3 from t2;
-
-#
-# Valid queries without alias on wild
-# (proof the above fail due to invalid aliasing)
-#
-
-select t1.* from t1;
-select t2.* from t2;
-select t1.*, t1.* from t1;
-select t1.*, a, t1.* from t1;
-
-# other fields without alias
-select a, t1.* from t1;
-select t1.*, a from t1;
-select a, t1.*, b from t1;
-select (select d from t2 where d > a), t1.* from t1;
-select t1.*, (select a from t2 where d > a) from t1;
-
-# other fields with alias
-select a as 'x', t1.* from t1;
-select t1.*, a as 'x' from t1;
-select a as 'x', t1.*, b as 'x' from t1;
-select (select d from t2 where d > a) as 'x', t1.* from t1;
-select t1.*, (select a from t2 where d > a) as 'x' from t1;
-
-# some more subquery
-select (select t2.* from t2) from t1;
-select a, (select t2.* from t2) from t1;
-select t1.*, (select t2.* from t2) from t1;
-
-# insert
-insert into t3 select t1.* from t1;
-insert into t3 select t2.*, 1, 2 from t2;
-insert into t3 select t2.*, d as 'x', d as 'z' from t2;
-insert into t3 select t2.*, t2.*, 3 from t2;
-
-# create
-create table t4 select t1.* from t1;
-drop table t4;
-create table t4 select t2.*, 1, 2 from t2;
-drop table t4;
-create table t4 select t2.*, d as 'x', d as 'z' from t2;
-drop table t4;
-
-# end
-drop table t1,t2,t3;
-
-# End of 5.2 tests
-
-#
-# MDEV-3908 crash in multi-table delete and mdl
-#
-connect (c1,localhost,root,,);
-connection c1;
-# this used to crash on disconnect
---error ER_PARSE_ERROR
-DELETE ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZROM t1 WHERE 1=1;
-connection default;
-disconnect c1;
diff --git a/mysql-test/t/almost_full.test b/mysql-test/t/almost_full.test
deleted file mode 100644
index 2517008fdf8..00000000000
--- a/mysql-test/t/almost_full.test
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# Some special cases with empty tables
-#
-
-call mtr.add_suppression("The table 't1' is full");
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-set global myisam_data_pointer_size=2;
-CREATE TABLE t1 (a int auto_increment primary key not null, b longtext) ENGINE=MyISAM;
-
---disable_query_log
-let $1= 303;
-begin;
-while ($1)
-{
- INSERT INTO t1 SET b=repeat('a',200);
- dec $1;
-}
-commit;
---enable_query_log
-
-DELETE FROM t1 WHERE a=1 or a=5;
-
---error 1114
-INSERT INTO t1 SET b=repeat('a',600);
-CHECK TABLE t1 EXTENDED;
-
---error 1114
-UPDATE t1 SET b=repeat('a', 800) where a=10;
-CHECK TABLE t1 EXTENDED;
-
-INSERT INTO t1 SET b=repeat('a',400);
-CHECK TABLE t1 EXTENDED;
-
-DELETE FROM t1 WHERE a=2 or a=6;
-UPDATE t1 SET b=repeat('a', 600) where a=11;
-CHECK TABLE t1 EXTENDED;
-drop table t1;
-
-set global myisam_data_pointer_size=default;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/alter_table-big.test b/mysql-test/t/alter_table-big.test
deleted file mode 100644
index b010815955f..00000000000
--- a/mysql-test/t/alter_table-big.test
+++ /dev/null
@@ -1,173 +0,0 @@
-#
-# Tests for various concurrency-related aspects of ALTER TABLE implemetation
-#
-# This test takes rather long time so let us run it only in --big-test mode
---source include/big_test.inc
-# We are using some debug-only features in this test
---source include/have_debug.inc
-# Also we are using SBR to check that statements are executed
-# in proper order.
---source include/have_binlog_format_mixed_or_statement.inc
-
-#
-# Test for Bug#25044 ALTER TABLE ... ENABLE KEYS acquires global
-# 'opening tables' lock
-#
-# ALTER TABLE ... ENABLE KEYS should not acquire LOCK_open mutex for
-# the whole its duration as it prevents other queries from execution.
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-set debug_sync='RESET';
-
-connect (addconroot, localhost, root,,);
-connect (addconroot2, localhost, root,,);
-connection default;
-create table t1 (n1 int, n2 int, n3 int,
- key (n1, n2, n3),
- key (n2, n3, n1),
- key (n3, n1, n2));
-create table t2 (i int);
-
-alter table t1 disable keys;
-insert into t1 values (1, 2, 3);
-
-# Later we use binlog to check the order in which statements are
-# executed so let us reset it first.
-reset master;
-set debug_sync='alter_table_enable_indexes SIGNAL parked WAIT_FOR go';
---send alter table t1 enable keys;
-connection addconroot;
-# Wait until ALTER TABLE acquires metadata lock.
-set debug_sync='now WAIT_FOR parked';
-# This statement should not be blocked by in-flight ALTER and therefore
-# should be executed and written to binlog before ALTER TABLE ... ENABLE KEYS
-# finishes.
-insert into t2 values (1);
-# And this should wait until the end of ALTER TABLE ... ENABLE KEYS.
---send insert into t1 values (1, 1, 1);
-connection addconroot2;
-# Wait until the above INSERT INTO t1 is blocked due to ALTER
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "insert into t1 values (1, 1, 1)";
---source include/wait_condition.inc
-# Resume ALTER execution.
-set debug_sync='now SIGNAL go';
-connection default;
---reap
-connection addconroot;
---reap
-connection default;
-# Check that statements were executed/binlogged in correct order.
-source include/show_binlog_events.inc;
-
-# Clean up
-drop tables t1, t2;
-disconnect addconroot;
-disconnect addconroot2;
-set debug_sync='RESET';
-
---echo End of 5.0 tests
-
-#
-# Additional coverage for the main ALTER TABLE case
-#
-# We should be sure that table being altered is properly
-# locked during statement execution and in particular that
-# no DDL or DML statement can sneak in and get access to
-# the table when real operation has already taken place
-# but this fact has not been noted in binary log yet.
---disable_warnings
-drop table if exists t1, t2, t3;
---enable_warnings
-connect (addconroot, localhost, root,,);
-connect (addconroot2, localhost, root,,);
-connection default;
-create table t1 (i int);
-# We are going to check that statements are logged in correct order
-reset master;
-set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go';
---send alter table t1 change i c char(10) default 'Test1';
-connection addconroot;
-# Wait until ALTER TABLE acquires metadata lock.
-set debug_sync='now WAIT_FOR parked';
---send insert into t1 values ();
-connection addconroot2;
-# Wait until the above INSERT INTO t1 is blocked due to ALTER
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "insert into t1 values ()";
---source include/wait_condition.inc
-# Resume ALTER execution.
-set debug_sync='now SIGNAL go';
-connection default;
---reap
-connection addconroot;
---reap
-connection default;
-select * from t1;
-set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go';
---send alter table t1 change c vc varchar(100) default 'Test2';
-connection addconroot;
-# Wait until ALTER TABLE acquires metadata lock.
-set debug_sync='now WAIT_FOR parked';
---send rename table t1 to t2;
-connection addconroot2;
-# Wait until the above RENAME TABLE is blocked due to ALTER
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "rename table t1 to t2";
---source include/wait_condition.inc
-# Resume ALTER execution.
-set debug_sync='now SIGNAL go';
-connection default;
---reap
-connection addconroot;
---reap
-connection default;
-drop table t2;
-# And now tests for ALTER TABLE with RENAME clause. In this
-# case target table name should be properly locked as well.
-create table t1 (i int);
-set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go';
---send alter table t1 change i c char(10) default 'Test3', rename to t2;
-connection addconroot;
-# Wait until ALTER TABLE acquires metadata lock.
-set debug_sync='now WAIT_FOR parked';
---send insert into t2 values();
-connection addconroot2;
-# Wait until the above INSERT INTO t2 is blocked due to ALTER
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "insert into t2 values()";
---source include/wait_condition.inc
-# Resume ALTER execution.
-set debug_sync='now SIGNAL go';
-connection default;
---reap
-connection addconroot;
---reap
-connection default;
-select * from t2;
---send alter table t2 change c vc varchar(100) default 'Test2', rename to t1;
-connection addconroot;
-connection default;
---reap
-rename table t1 to t3;
-
-disconnect addconroot;
-disconnect addconroot2;
-drop table t3;
-set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go';
-set debug_sync='RESET';
-
-# Check that all statements were logged in correct order
-source include/show_binlog_events.inc;
-
-
---echo End of 5.1 tests
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
deleted file mode 100644
index 7f692f36f4e..00000000000
--- a/mysql-test/t/alter_table.test
+++ /dev/null
@@ -1,1915 +0,0 @@
-if (`select plugin_auth_version < "5.6.26" from information_schema.plugins where plugin_name='innodb'`)
-{
- --skip Not fixed in XtraDB below 5.6.26
-}
---source include/have_innodb.inc
-#
-# Test of alter table
-#
---disable_warnings
-drop table if exists t1,t2;
-drop database if exists mysqltest;
---enable_warnings
-
-create table t1 (
-col1 int not null auto_increment primary key,
-col2 varchar(30) not null,
-col3 varchar (20) not null,
-col4 varchar(4) not null,
-col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null,
-col6 int not null, to_be_deleted int);
-insert into t1 values (2,4,3,5,"PENDING",1,7);
-alter table t1
-add column col4_5 varchar(20) not null after col4,
-add column col7 varchar(30) not null after col5,
-add column col8 datetime not null, drop column to_be_deleted,
-change column col2 fourth varchar(30) not null after col3,
-modify column col6 int not null first;
-select * from t1;
-drop table t1;
-
-create table t1 (bandID MEDIUMINT UNSIGNED NOT NULL PRIMARY KEY, payoutID SMALLINT UNSIGNED NOT NULL);
-insert into t1 (bandID,payoutID) VALUES (1,6),(2,6),(3,4),(4,9),(5,10),(6,1),(7,12),(8,12);
-alter table t1 add column new_col int, order by payoutid,bandid;
-select * from t1;
-alter table t1 order by bandid,payoutid;
-select * from t1;
-drop table t1;
-
-# Check that pack_keys and dynamic length rows are not forced.
-
-CREATE TABLE t1 (
-GROUP_ID int(10) unsigned DEFAULT '0' NOT NULL,
-LANG_ID smallint(5) unsigned DEFAULT '0' NOT NULL,
-NAME varchar(80) DEFAULT '' NOT NULL,
-PRIMARY KEY (GROUP_ID,LANG_ID),
-KEY NAME (NAME));
-#show table status like "t1";
-ALTER TABLE t1 CHANGE NAME NAME CHAR(80) not null;
---replace_column 8 #
-SHOW FULL COLUMNS FROM t1;
-DROP TABLE t1;
-
-#
-# Test of ALTER TABLE ... ORDER BY
-#
-
-create table t1 (n int);
-insert into t1 values(9),(3),(12),(10);
-alter table t1 order by n;
-select * from t1;
-drop table t1;
-
-CREATE TABLE t1 (
- id int(11) unsigned NOT NULL default '0',
- category_id tinyint(4) unsigned NOT NULL default '0',
- type_id tinyint(4) unsigned NOT NULL default '0',
- body text NOT NULL,
- user_id int(11) unsigned NOT NULL default '0',
- status enum('new','old') NOT NULL default 'new',
- PRIMARY KEY (id)
-) ENGINE=MyISAM;
-
-ALTER TABLE t1 ORDER BY t1.id, t1.status, t1.type_id, t1.user_id, t1.body;
-DROP TABLE t1;
-
-#
-# The following combination found a hang-bug in MyISAM
-#
-
-CREATE TABLE t1 (AnamneseId int(10) unsigned NOT NULL auto_increment,B BLOB,PRIMARY KEY (AnamneseId)) engine=myisam;
-insert into t1 values (null,"hello");
-LOCK TABLES t1 WRITE;
-ALTER TABLE t1 ADD Column new_col int not null;
-UNLOCK TABLES;
-OPTIMIZE TABLE t1;
-DROP TABLE t1;
-
-#
-# Drop and add an auto_increment column
-#
-
-create table t1 (i int unsigned not null auto_increment primary key);
-insert into t1 values (null),(null),(null),(null);
-alter table t1 drop i,add i int unsigned not null auto_increment, drop primary key, add primary key (i);
-select * from t1;
-drop table t1;
-
-#
-# Bug #2628: 'alter table t1 rename mysqltest.t1' silently drops mysqltest.t1
-# if it exists
-#
-create table t1 (name char(15));
-insert into t1 (name) values ("current");
-create database mysqltest;
-create table mysqltest.t1 (name char(15));
-insert into mysqltest.t1 (name) values ("mysqltest");
-select * from t1;
-select * from mysqltest.t1;
---error ER_TABLE_EXISTS_ERROR
-alter table t1 rename mysqltest.t1;
-select * from t1;
-select * from mysqltest.t1;
-drop table t1;
-drop database mysqltest;
-
-#
-# ALTER TABLE ... ENABLE/DISABLE KEYS
-
-create table t1 (n1 int not null, n2 int, n3 int, n4 float,
- unique(n1),
- key (n1, n2, n3, n4),
- key (n2, n3, n4, n1),
- key (n3, n4, n1, n2),
- key (n4, n1, n2, n3) );
-alter table t1 disable keys;
-show keys from t1;
-#let $1=10000;
-let $1=10;
---disable_query_log
-begin;
-while ($1)
-{
- eval insert into t1 values($1,RAND()*1000,RAND()*1000,RAND());
- dec $1;
-}
-commit;
---enable_query_log
-alter table t1 enable keys;
-show keys from t1;
-drop table t1;
-
-#
-# Alter table and rename
-#
-
-create table t1 (i int unsigned not null auto_increment primary key);
-alter table t1 rename t2;
-alter table t2 rename t1, add c char(10) comment "no comment";
-show columns from t1;
-drop table t1;
-
-# implicit analyze
-
-create table t1 (a int, b int);
-let $1=100;
---disable_query_log
-begin;
-while ($1)
-{
- eval insert into t1 values(1,$1), (2,$1), (3, $1);
- dec $1;
-}
-commit;
---enable_query_log
-alter table t1 add unique (a,b), add key (b);
-show keys from t1;
-analyze table t1;
-show keys from t1;
-drop table t1;
-
-#
-# Test of ALTER TABLE DELAYED
-#
-
-CREATE TABLE t1 (i int(10), index(i) ) ENGINE=MyISAM;
-ALTER TABLE t1 DISABLE KEYS;
-INSERT DELAYED INTO t1 VALUES(1),(2),(3);
-ALTER TABLE t1 ENABLE KEYS;
-drop table t1;
-
-#
-# Test ALTER TABLE ENABLE/DISABLE keys when things are locked
-#
-
-CREATE TABLE t1 (
- Host varchar(16) binary NOT NULL default '',
- User varchar(16) binary NOT NULL default '',
- PRIMARY KEY (Host,User)
-) ENGINE=MyISAM;
-
-ALTER TABLE t1 DISABLE KEYS;
-LOCK TABLES t1 WRITE;
-INSERT INTO t1 VALUES ('localhost','root'),('localhost',''),('games','monty');
-SHOW INDEX FROM t1;
-ALTER TABLE t1 ENABLE KEYS;
-UNLOCK TABLES;
-CHECK TABLES t1;
-DROP TABLE t1;
-
-#
-# Test with two keys
-#
-
-CREATE TABLE t1 (
- Host varchar(16) binary NOT NULL default '',
- User varchar(16) binary NOT NULL default '',
- PRIMARY KEY (Host,User),
- KEY (Host)
-) ENGINE=MyISAM;
-
-ALTER TABLE t1 DISABLE KEYS;
-SHOW INDEX FROM t1;
-LOCK TABLES t1 WRITE;
-INSERT INTO t1 VALUES ('localhost','root'),('localhost','');
-SHOW INDEX FROM t1;
-ALTER TABLE t1 ENABLE KEYS;
-SHOW INDEX FROM t1;
-UNLOCK TABLES;
-CHECK TABLES t1;
-
-# Test RENAME with LOCK TABLES
-LOCK TABLES t1 WRITE;
-ALTER TABLE t1 RENAME t2;
-UNLOCK TABLES;
-select * from t2;
-DROP TABLE t2;
-
-#
-# Test disable keys with locking
-#
-CREATE TABLE t1 (
- Host varchar(16) binary NOT NULL default '',
- User varchar(16) binary NOT NULL default '',
- PRIMARY KEY (Host,User),
- KEY (Host)
-) ENGINE=MyISAM;
-
-LOCK TABLES t1 WRITE;
-ALTER TABLE t1 DISABLE KEYS;
-SHOW INDEX FROM t1;
-DROP TABLE t1;
-
-#
-# BUG#4717 - check for valid table names
-#
-create table t1 (a int);
---error ER_WRONG_TABLE_NAME
-alter table t1 rename to ``;
---error ER_WRONG_TABLE_NAME
-rename table t1 to ``;
-drop table t1;
-
-#
-# BUG#6236 - ALTER TABLE MODIFY should set implicit NOT NULL on PK columns
-#
-drop table if exists t1, t2;
-create table t1 ( a varchar(10) not null primary key ) engine=myisam;
-create table t2 ( a varchar(10) not null primary key ) engine=merge union=(t1);
-flush tables;
-alter table t1 modify a varchar(10);
-show create table t2;
-flush tables;
-alter table t1 modify a varchar(10) not null;
-show create table t2;
-drop table if exists t1, t2;
-
-# The following is also part of bug #6236 (CREATE TABLE didn't properly count
-# not null columns for primary keys)
-
-create table t1 (a int, b int, c int, d int, e int, f int, g int, h int,i int, primary key (a,b,c,d,e,f,g,i,h)) engine=MyISAM;
-insert ignore into t1 (a) values(1);
---replace_column 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X 19 X
-show table status like 't1';
-alter table t1 modify a int;
---replace_column 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X 19 X
-show table status like 't1';
-drop table t1;
-create table t1 (a int not null, b int not null, c int not null, d int not null, e int not null, f int not null, g int not null, h int not null,i int not null, primary key (a,b,c,d,e,f,g,i,h)) engine=MyISAM;
-insert ignore into t1 (a) values(1);
---replace_column 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X 19 X
-show table status like 't1';
-drop table t1;
-
-#
-# Test that data get converted when character set is changed
-# Test that data doesn't get converted when src or dst is BINARY/BLOB
-#
-set names koi8r;
-create table t1 (a char(10) character set koi8r);
-insert into t1 values ('');
-select a,hex(a) from t1;
-alter table t1 change a a char(10) character set cp1251;
-select a,hex(a) from t1;
-alter table t1 change a a binary(4);
-select a,hex(a) from t1;
-alter table t1 change a a char(10) character set cp1251;
-select a,hex(a) from t1;
-alter table t1 change a a char(10) character set koi8r;
-select a,hex(a) from t1;
-alter table t1 change a a varchar(10) character set cp1251;
-select a,hex(a) from t1;
-alter table t1 change a a char(10) character set koi8r;
-select a,hex(a) from t1;
-alter table t1 change a a text character set cp1251;
-select a,hex(a) from t1;
-alter table t1 change a a char(10) character set koi8r;
-select a,hex(a) from t1;
-delete from t1;
-
-#
-# Test ALTER TABLE .. CHARACTER SET ..
-#
-show create table t1;
-alter table t1 DEFAULT CHARACTER SET latin1;
-show create table t1;
-alter table t1 CONVERT TO CHARACTER SET latin1;
-show create table t1;
-alter table t1 DEFAULT CHARACTER SET cp1251;
-show create table t1;
-
-drop table t1;
-
-#
-# Bug#2821
-# Test that table CHARACTER SET does not affect blobs
-#
-create table t1 (myblob longblob,mytext longtext)
-default charset latin1 collate latin1_general_cs;
-show create table t1;
-alter table t1 character set latin2;
-show create table t1;
-drop table t1;
-
-#
-# Bug 2361 (Don't drop UNIQUE with DROP PRIMARY KEY)
-#
-
-CREATE TABLE t1 (a int PRIMARY KEY, b INT UNIQUE);
-ALTER TABLE t1 DROP PRIMARY KEY;
-SHOW CREATE TABLE t1;
---error ER_CANT_DROP_FIELD_OR_KEY
-ALTER TABLE t1 DROP PRIMARY KEY;
-DROP TABLE t1;
-
-# BUG#3899
-create table t1 (a int, b int, key(a));
-insert into t1 values (1,1), (2,2);
---error ER_CANT_DROP_FIELD_OR_KEY
-alter table t1 drop key no_such_key;
-alter table t1 drop key a;
-drop table t1;
-
-#
-# BUG 12207 alter table ... discard table space on MyISAM table causes ERROR 2013 (HY000)
-#
-# Some platforms (Mac OS X, Windows) will send the error message using small letters.
-CREATE TABLE T12207(a int) ENGINE=MYISAM;
---replace_result t12207 T12207
---error ER_ILLEGAL_HA
-ALTER TABLE T12207 DISCARD TABLESPACE;
-DROP TABLE T12207;
-
-#
-# Bug #6479 ALTER TABLE ... changing charset fails for TEXT columns
-#
-# The column's character set was changed but the actual data was not
-# modified. In other words, the values were reinterpreted
-# as UTF8 instead of being converted.
-create table t1 (a text) character set koi8r;
-insert into t1 values (_koi8r'');
-select hex(a) from t1;
-alter table t1 convert to character set cp1251;
-select hex(a) from t1;
-drop table t1;
-
-#
-# Test for bug #7884 "Able to add invalid unique index on TIMESTAMP prefix"
-# MySQL should not think that packed field with non-zero decimals is
-# geometry field and allow to create prefix index which is
-# shorter than packed field length.
-#
-create table t1 ( a timestamp );
---error ER_WRONG_SUB_KEY
-alter table t1 add unique ( a(1) );
-drop table t1;
-
-#
-# Bug #24395: ALTER TABLE DISABLE KEYS doesn't work when modifying the table
-#
-# This problem happens if the data change is compatible.
-# Changing to the same type is compatible for example.
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a int, key(a));
-show indexes from t1;
---echo "this used not to disable the index"
-alter table t1 modify a int, disable keys;
-show indexes from t1;
-
-alter table t1 enable keys;
-show indexes from t1;
-
-alter table t1 modify a bigint, disable keys;
-show indexes from t1;
-
-alter table t1 enable keys;
-show indexes from t1;
-
-alter table t1 add b char(10), disable keys;
-show indexes from t1;
-
-alter table t1 add c decimal(10,2), enable keys;
-show indexes from t1;
-
---echo "this however did"
-alter table t1 disable keys;
-show indexes from t1;
-
-desc t1;
-
-alter table t1 add d decimal(15,5);
---echo "The key should still be disabled"
-show indexes from t1;
-
-drop table t1;
-
---echo "Now will test with one unique index"
-create table t1(a int, b char(10), unique(a));
-show indexes from t1;
-alter table t1 disable keys;
-show indexes from t1;
-alter table t1 enable keys;
-
---echo "If no copy on noop change, this won't touch the data file"
---echo "Unique index, no change"
-alter table t1 modify a int, disable keys;
-show indexes from t1;
-
---echo "Change the type implying data copy"
---echo "Unique index, no change"
-alter table t1 modify a bigint, disable keys;
-show indexes from t1;
-
-alter table t1 modify a bigint;
-show indexes from t1;
-
-alter table t1 modify a int;
-show indexes from t1;
-
-drop table t1;
-
---echo "Now will test with one unique and one non-unique index"
-create table t1(a int, b char(10), unique(a), key(b));
-show indexes from t1;
-alter table t1 disable keys;
-show indexes from t1;
-alter table t1 enable keys;
-
-
---echo "If no copy on noop change, this won't touch the data file"
---echo "The non-unique index will be disabled"
-alter table t1 modify a int, disable keys;
-show indexes from t1;
-alter table t1 enable keys;
-show indexes from t1;
-
---echo "Change the type implying data copy"
---echo "The non-unique index will be disabled"
-alter table t1 modify a bigint, disable keys;
-show indexes from t1;
-
---echo "Change again the type, but leave the indexes as_is"
-alter table t1 modify a int;
-show indexes from t1;
---echo "Try the same. When data is no copied on similar tables, this is noop"
-alter table t1 modify a int;
-show indexes from t1;
-
-drop table t1;
-
-
-#
-# Bug#11493 - Alter table rename to default database does not work without
-# db name qualifying
-#
-create database mysqltest;
-create table t1 (c1 int);
-# Move table to other database.
-alter table t1 rename mysqltest.t1;
-# Assure that it has moved.
---error ER_BAD_TABLE_ERROR
-drop table t1;
-# Move table back.
-alter table mysqltest.t1 rename t1;
-# Assure that it is back.
-drop table t1;
-# Now test for correct message if no database is selected.
-# Create t1 in 'test'.
-create table t1 (c1 int);
-# Change to other db.
-use mysqltest;
-# Drop the current db. This de-selects any db.
-drop database mysqltest;
-# Now test for correct message.
---error ER_NO_DB_ERROR
-alter table test.t1 rename t1;
-# Check that explicit qualifying works even with no selected db.
-alter table test.t1 rename test.t1;
-# Go back to standard 'test' db.
-use test;
-drop table t1;
-
-#
-# BUG#23404 - ROW_FORMAT=FIXED option is lost is an index is added to the
-# table
-#
-CREATE TABLE t1(a INT) ROW_FORMAT=FIXED;
-CREATE INDEX i1 ON t1(a);
-SHOW CREATE TABLE t1;
-DROP INDEX i1 ON t1;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-#
-# Bug#24219 - ALTER TABLE ... RENAME TO ... , DISABLE KEYS leads to crash
-#
---disable_warnings
-DROP TABLE IF EXISTS bug24219;
-DROP TABLE IF EXISTS bug24219_2;
---enable_warnings
-
-CREATE TABLE bug24219 (a INT, INDEX(a));
-
-SHOW INDEX FROM bug24219;
-
-ALTER TABLE bug24219 RENAME TO bug24219_2, DISABLE KEYS;
-
-SHOW INDEX FROM bug24219_2;
-
-DROP TABLE bug24219_2;
-
-#
-# Bug#24562 (ALTER TABLE ... ORDER BY ... with complex expression asserts)
-#
-
---disable_warnings
-drop table if exists table_24562;
---enable_warnings
-
-create table table_24562(
- section int,
- subsection int,
- title varchar(50));
-
-insert into table_24562 values
-(1, 0, "Introduction"),
-(1, 1, "Authors"),
-(1, 2, "Acknowledgements"),
-(2, 0, "Basics"),
-(2, 1, "Syntax"),
-(2, 2, "Client"),
-(2, 3, "Server"),
-(3, 0, "Intermediate"),
-(3, 1, "Complex queries"),
-(3, 2, "Stored Procedures"),
-(3, 3, "Stored Functions"),
-(4, 0, "Advanced"),
-(4, 1, "Replication"),
-(4, 2, "Load balancing"),
-(4, 3, "High availability"),
-(5, 0, "Conclusion");
-
-select * from table_24562;
-
-alter table table_24562 add column reviewer varchar(20),
-order by title;
-
-select * from table_24562;
-
-update table_24562 set reviewer="Me" where section=2;
-update table_24562 set reviewer="You" where section=3;
-
-alter table table_24562
-order by section ASC, subsection DESC;
-
-select * from table_24562;
-
-alter table table_24562
-order by table_24562.subsection ASC, table_24562.section DESC;
-
-select * from table_24562;
-
---error ER_PARSE_ERROR
-alter table table_24562 order by 12;
---error ER_PARSE_ERROR
-alter table table_24562 order by (section + 12);
---error ER_PARSE_ERROR
-alter table table_24562 order by length(title);
---error ER_PARSE_ERROR
-alter table table_24562 order by (select 12 from dual);
-
---error ER_BAD_FIELD_ERROR
-alter table table_24562 order by no_such_col;
-
-drop table table_24562;
-
-# End of 4.1 tests
-
-#
-# Bug #14693 (ALTER SET DEFAULT doesn't work)
-#
-
-create table t1 (mycol int(10) not null);
-alter table t1 alter column mycol set default 0;
-desc t1;
-drop table t1;
-
-#
-# Bug#25262 Auto Increment lost when changing Engine type
-#
-
-create table t1(id int(8) primary key auto_increment) engine=heap;
-
-insert into t1 values (null);
-insert into t1 values (null);
-
-select * from t1;
-
-# Set auto increment to 50
-alter table t1 auto_increment = 50;
-
-# Alter to myisam
-alter table t1 engine = myisam;
-
-# This insert should get id 50
-insert into t1 values (null);
-select * from t1;
-
-# Alter to heap again
-alter table t1 engine = heap;
-insert into t1 values (null);
-select * from t1;
-
-drop table t1;
-
-#
-# Bug#27507: Wrong DATETIME value was allowed by ALTER TABLE in the
-# NO_ZERO_DATE mode.
-#
-set @orig_sql_mode = @@sql_mode;
-set sql_mode="no_zero_date";
-create table t1(f1 int);
-alter table t1 add column f2 datetime not null, add column f21 date not null;
-insert into t1 values(1,'2000-01-01','2000-01-01');
---error 1292
-alter table t1 add column f3 datetime not null;
---error 1292
-alter table t1 add column f3 date not null;
---error 1292
-alter table t1 add column f4 datetime not null default '2002-02-02',
- add column f41 date not null;
-alter table t1 add column f4 datetime not null default '2002-02-02',
- add column f41 date not null default '2002-02-02';
-select * from t1;
-drop table t1;
-set sql_mode= @orig_sql_mode;
-
-#
-# Some additional tests for new, faster alter table. Note that most of the
-# whole alter table code is being tested all around the test suite already.
-#
-
-create table t1 (v varchar(32));
-insert into t1 values ('def'),('abc'),('hij'),('3r4f');
-select * from t1;
-# Fast alter, no copy performed
-alter table t1 change v v2 varchar(32);
-select * from t1;
-# Fast alter, no copy performed
-alter table t1 change v2 v varchar(64);
-select * from t1;
-update t1 set v = 'lmn' where v = 'hij';
-select * from t1;
-# Regular alter table
-alter table t1 add i int auto_increment not null primary key first;
-select * from t1;
-update t1 set i=5 where i=3;
-select * from t1;
-alter table t1 change i i bigint;
-select * from t1;
-alter table t1 add unique key (i, v);
-select * from t1 where i between 2 and 4 and v in ('def','3r4f','lmn');
-drop table t1;
-
-#
-# Bug#6073 "ALTER table minor glich": ALTER TABLE complains that an index
-# without # prefix is not allowed for TEXT columns, while index
-# is defined with prefix.
-#
-create table t1 (t varchar(255) default null, key t (t(80)))
-engine=myisam default charset=latin1;
-alter table t1 change t t text;
-drop table t1;
-
-#
-# Bug #26794: Adding an index with a prefix on a SPATIAL type breaks ALTER
-# TABLE
-#
-CREATE TABLE t1 (a varchar(500));
-
-ALTER TABLE t1 ADD b GEOMETRY NOT NULL, ADD SPATIAL INDEX(b);
-SHOW CREATE TABLE t1;
-ALTER TABLE t1 ADD KEY(b(50));
-SHOW CREATE TABLE t1;
-
-ALTER TABLE t1 ADD c POINT;
-SHOW CREATE TABLE t1;
-
---error ER_WRONG_SUB_KEY
-CREATE TABLE t2 (a INT, KEY (a(20)));
-
-ALTER TABLE t1 ADD d INT;
---error ER_WRONG_SUB_KEY
-ALTER TABLE t1 ADD KEY (d(20));
-
-# the 5.1 part of the test
---error ER_WRONG_SUB_KEY
-ALTER TABLE t1 ADD e GEOMETRY NOT NULL, ADD SPATIAL KEY (e(30));
-
-DROP TABLE t1;
-
-#
-# Bug#18038 MySQL server corrupts binary columns data
-#
-
-CREATE TABLE t1 (s CHAR(8) BINARY);
-INSERT INTO t1 VALUES ('test');
-SELECT LENGTH(s) FROM t1;
-ALTER TABLE t1 MODIFY s CHAR(10) BINARY;
-SELECT LENGTH(s) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (s BINARY(8));
-INSERT INTO t1 VALUES ('test');
-SELECT LENGTH(s) FROM t1;
-SELECT HEX(s) FROM t1;
-ALTER TABLE t1 MODIFY s BINARY(10);
-SELECT HEX(s) FROM t1;
-SELECT LENGTH(s) FROM t1;
-DROP TABLE t1;
-
-#
-# Bug#19386: Multiple alter causes crashed table
-# The trailing column would get corrupted data, or server could not even read
-# it.
-#
-
-CREATE TABLE t1 (v VARCHAR(3), b INT);
-INSERT INTO t1 VALUES ('abc', 5);
-SELECT * FROM t1;
-ALTER TABLE t1 MODIFY COLUMN v VARCHAR(4);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
-#
-# Bug#31291 ALTER TABLE CONVERT TO CHARACTER SET does not change some data types
-#
-create table t1 (a tinytext character set latin1);
-alter table t1 convert to character set utf8;
-show create table t1;
-drop table t1;
-create table t1 (a mediumtext character set latin1);
-alter table t1 convert to character set utf8;
-show create table t1;
-drop table t1;
-
---echo End of 5.0 tests
-
-#
-# Extended test coverage for ALTER TABLE behaviour under LOCK TABLES
-# It should be consistent across all platforms and for all engines
-# (Before 5.1 this was not true as behavior was different between
-# Unix/Windows and transactional/non-transactional tables).
-# See also innodb_mysql.test
-#
---disable_warnings
-drop table if exists t1, t2, t3;
---enable_warnings
-create table t1 (i int);
-create table t3 (j int);
-insert into t1 values ();
-insert into t3 values ();
-# Table which is altered under LOCK TABLES it should stay in list of locked
-# tables and be available after alter takes place unless ALTER contains RENAME
-# clause. We should see the new definition of table, of course.
-lock table t1 write, t3 read;
-# Example of so-called 'fast' ALTER TABLE
-alter table t1 modify i int default 1;
-insert into t1 values ();
-select * from t1;
-# And now full-blown ALTER TABLE
-alter table t1 change i c char(10) default "Two";
-insert into t1 values ();
-select * from t1;
-# If table is renamed then it should be removed from the list
-# of locked tables. 'Fast' ALTER TABLE with RENAME clause:
-alter table t1 modify c char(10) default "Three", rename to t2;
---error ER_TABLE_NOT_LOCKED
-select * from t1;
---error ER_TABLE_NOT_LOCKED
-select * from t2;
-select * from t3;
-unlock tables;
-insert into t2 values ();
-select * from t2;
-lock table t2 write, t3 read;
-# Full ALTER TABLE with RENAME
-alter table t2 change c vc varchar(100) default "Four", rename to t1;
---error ER_TABLE_NOT_LOCKED
-select * from t1;
---error ER_TABLE_NOT_LOCKED
-select * from t2;
-select * from t3;
-unlock tables;
-insert into t1 values ();
-select * from t1;
-drop tables t1, t3;
-
-
-#
-# Bug#18775 - Temporary table from alter table visible to other threads
-#
-# Check if special characters work and duplicates are detected.
---disable_warnings
-DROP TABLE IF EXISTS `t+1`, `t+2`;
---enable_warnings
-CREATE TABLE `t+1` (c1 INT);
-ALTER TABLE `t+1` RENAME `t+2`;
-CREATE TABLE `t+1` (c1 INT);
---error ER_TABLE_EXISTS_ERROR
-ALTER TABLE `t+1` RENAME `t+2`;
-DROP TABLE `t+1`, `t+2`;
-#
-# Same for temporary tables though these names do not become file names.
-CREATE TEMPORARY TABLE `tt+1` (c1 INT);
-ALTER TABLE `tt+1` RENAME `tt+2`;
-CREATE TEMPORARY TABLE `tt+1` (c1 INT);
---error ER_TABLE_EXISTS_ERROR
-ALTER TABLE `tt+1` RENAME `tt+2`;
-SHOW CREATE TABLE `tt+1`;
-SHOW CREATE TABLE `tt+2`;
-DROP TABLE `tt+1`, `tt+2`;
-#
-# Check if special characters as in tmp_file_prefix work.
-CREATE TABLE `#sql1` (c1 INT);
-CREATE TABLE `@0023sql2` (c1 INT);
-SHOW TABLES;
-RENAME TABLE `#sql1` TO `@0023sql1`;
-RENAME TABLE `@0023sql2` TO `#sql2`;
-SHOW TABLES;
-ALTER TABLE `@0023sql1` RENAME `#sql-1`;
-ALTER TABLE `#sql2` RENAME `@0023sql-2`;
-SHOW TABLES;
-INSERT INTO `#sql-1` VALUES (1);
-INSERT INTO `@0023sql-2` VALUES (2);
-DROP TABLE `#sql-1`, `@0023sql-2`;
-#
-# Same for temporary tables though these names do not become file names.
-CREATE TEMPORARY TABLE `#sql1` (c1 INT);
-CREATE TEMPORARY TABLE `@0023sql2` (c1 INT);
-SHOW TABLES;
-ALTER TABLE `#sql1` RENAME `@0023sql1`;
-ALTER TABLE `@0023sql2` RENAME `#sql2`;
-SHOW TABLES;
-INSERT INTO `#sql2` VALUES (1);
-INSERT INTO `@0023sql1` VALUES (2);
-SHOW CREATE TABLE `#sql2`;
-SHOW CREATE TABLE `@0023sql1`;
-DROP TABLE `#sql2`, `@0023sql1`;
-
-#
-# Bug #22369: Alter table rename combined with other alterations causes lost tables
-#
-# This problem happens if the data change is compatible.
-# Changing to the same type is compatible for example.
-#
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS t2;
---enable_warnings
-CREATE TABLE t1 (
- int_field INTEGER UNSIGNED NOT NULL,
- char_field CHAR(10),
- INDEX(`int_field`)
-);
-
-DESCRIBE t1;
-
-SHOW INDEXES FROM t1;
-
-INSERT INTO t1 VALUES (1, "edno"), (1, "edno"), (2, "dve"), (3, "tri"), (5, "pet");
---echo "Non-copy data change - new frm, but old data and index files"
-ALTER TABLE t1
- CHANGE int_field unsigned_int_field INTEGER UNSIGNED NOT NULL,
- RENAME t2;
-
---error ER_NO_SUCH_TABLE
-SELECT * FROM t1 ORDER BY int_field;
-SELECT * FROM t2 ORDER BY unsigned_int_field;
-DESCRIBE t2;
-DESCRIBE t2;
-ALTER TABLE t2 MODIFY unsigned_int_field BIGINT UNSIGNED NOT NULL;
-DESCRIBE t2;
-
-DROP TABLE t2;
-
-#
-# Bug#28427: Columns were renamed instead of moving by ALTER TABLE.
-#
-CREATE TABLE t1 (f1 INT, f2 INT, f3 INT);
-INSERT INTO t1 VALUES (1, 2, NULL);
-SELECT * FROM t1;
-ALTER TABLE t1 MODIFY COLUMN f3 INT AFTER f1;
-SELECT * FROM t1;
-ALTER TABLE t1 MODIFY COLUMN f3 INT AFTER f2;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-#
-# BUG#29957 - alter_table.test fails
-#
-create table t1 (c char(10) default "Two");
-lock table t1 write;
-insert into t1 values ();
-alter table t1 modify c char(10) default "Three";
-unlock tables;
-select * from t1;
-check table t1;
-drop table t1;
-
-#
-# Bug#33873: Fast ALTER TABLE doesn't work with multibyte character sets
-#
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-CREATE TABLE t1 (id int, c int) character set latin1;
-INSERT INTO t1 VALUES (1,1);
---enable_info
-ALTER TABLE t1 CHANGE c d int;
-ALTER TABLE t1 CHANGE d c int;
-ALTER TABLE t1 MODIFY c VARCHAR(10);
-ALTER TABLE t1 CHANGE c d varchar(10);
-ALTER TABLE t1 CHANGE d c varchar(10);
---disable_info
-DROP TABLE t1;
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-CREATE TABLE t1 (id int, c int) character set utf8;
-INSERT INTO t1 VALUES (1,1);
---enable_info
-ALTER TABLE t1 CHANGE c d int;
-ALTER TABLE t1 CHANGE d c int;
-ALTER TABLE t1 MODIFY c VARCHAR(10);
-ALTER TABLE t1 CHANGE c d varchar(10);
-ALTER TABLE t1 CHANGE d c varchar(10);
---disable_info
-DROP TABLE t1;
-
-#
-# Bug#39372 "Smart" ALTER TABLE not so smart after all.
-#
-create table t1(f1 int not null, f2 int not null, key (f1), key (f2));
-let $count= 50;
---disable_query_log
-begin;
-while ($count)
-{
- EVAL insert into t1 values (1,1),(1,1),(1,1),(1,1),(1,1);
- EVAL insert into t1 values (2,2),(2,2),(2,2),(2,2),(2,2);
- dec $count ;
-}
-commit;
---enable_query_log
-
-select index_length into @unpaked_keys_size from
-information_schema.tables where table_name='t1';
-alter table t1 pack_keys=1;
-select index_length into @paked_keys_size from
-information_schema.tables where table_name='t1';
-select (@unpaked_keys_size > @paked_keys_size);
-
-select max_data_length into @orig_max_data_length from
-information_schema.tables where table_name='t1';
-alter table t1 max_rows=100;
-select max_data_length into @changed_max_data_length from
-information_schema.tables where table_name='t1';
-select (@orig_max_data_length > @changed_max_data_length);
-
-drop table t1;
-
-#
-# Bug #23113: Different behavior on altering ENUM fields between 5.0 and 5.1
-#
-CREATE TABLE t1(a INT AUTO_INCREMENT PRIMARY KEY,
- b ENUM('a', 'b', 'c') NOT NULL);
-INSERT INTO t1 (b) VALUES ('a'), ('c'), ('b'), ('b'), ('a');
-ALTER TABLE t1 MODIFY b ENUM('a', 'z', 'b', 'c') NOT NULL;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-#
-# Test for ALTER column DROP DEFAULT
-#
-
-SET @save_sql_mode=@@sql_mode;
-SET sql_mode=strict_all_tables;
-
-CREATE TABLE t1 (a int NOT NULL default 42);
-INSERT INTO t1 values ();
-SELECT * FROM t1;
-ALTER TABLE t1 ALTER COLUMN a DROP DEFAULT;
---error 1364
-INSERT INTO t1 values ();
-INSERT INTO t1 (a) VALUES (11);
-SELECT * FROM t1 ORDER BY a;
-DROP TABLE t1;
-SET @@sql_mode=@save_sql_mode;
---echo #
---echo # Bug#45567: Fast ALTER TABLE broken for enum and set
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (a ENUM('a1','a2'));
-INSERT INTO t1 VALUES ('a1'),('a2');
---enable_info
---echo # No copy: No modification
-ALTER TABLE t1 MODIFY COLUMN a ENUM('a1','a2');
---echo # No copy: Add new enumeration to the end
-ALTER TABLE t1 MODIFY COLUMN a ENUM('a1','a2','a3');
---echo # Copy: Modify and add new to the end
-ALTER TABLE t1 MODIFY COLUMN a ENUM('a1','a2','xx','a5');
---echo # Copy: Remove from the end
-ALTER TABLE t1 MODIFY COLUMN a ENUM('a1','a2','xx');
---echo # Copy: Add new enumeration
-ALTER TABLE t1 MODIFY COLUMN a ENUM('a1','a2','a0','xx');
---echo # No copy: Add new enumerations to the end
-ALTER TABLE t1 MODIFY COLUMN a ENUM('a1','a2','a0','xx','a5','a6');
---disable_info
-DROP TABLE t1;
-
-CREATE TABLE t1 (a SET('a1','a2'));
-INSERT INTO t1 VALUES ('a1'),('a2');
---enable_info
---echo # No copy: No modification
-ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2');
---echo # No copy: Add new to the end
-ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','a3');
---echo # Copy: Modify and add new to the end
-ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','xx','a5');
---echo # Copy: Remove from the end
-ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','xx');
---echo # Copy: Add new member
-ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','a0','xx');
---echo # No copy: Add new to the end
-ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','a0','xx','a5','a6');
---echo # Copy: Numerical incrase (pack lenght)
-ALTER TABLE t1 MODIFY COLUMN a SET('a1','a2','a0','xx','a5','a6','a7','a8','a9','a10');
---disable_info
-DROP TABLE t1;
-
-#
-# Bug#43508: Renaming timestamp or date column triggers table copy
-#
-
-CREATE TABLE t1 (f1 TIMESTAMP NULL DEFAULT NULL,
- f2 INT(11) DEFAULT NULL) ENGINE=MYISAM DEFAULT CHARSET=utf8;
-
-INSERT INTO t1 VALUES (NULL, NULL), ("2009-10-09 11:46:19", 2);
-
---echo this should affect no rows as there is no real change
---enable_info
-ALTER TABLE t1 CHANGE COLUMN f1 f1_no_real_change TIMESTAMP NULL DEFAULT NULL;
---disable_info
-DROP TABLE t1;
-
-
---echo #
---echo # Bug #31145: ALTER TABLE DROP COLUMN, ADD COLUMN crashes (linux)
---echo # or freezes (win) the server
---echo #
-
-CREATE TABLE t1 (a TEXT, id INT, b INT);
-ALTER TABLE t1 DROP COLUMN a, ADD COLUMN c TEXT FIRST;
-
-DROP TABLE t1;
-
-
---echo #
---echo # Test for bug #12652385 - "61493: REORDERING COLUMNS TO POSITION
---echo # FIRST CAN CAUSE DATA TO BE CORRUPTED".
---echo #
---disable_warnings
-drop table if exists t1;
---enable_warnings
---echo # Use MyISAM engine as the fact that InnoDB doesn't support
---echo # in-place ALTER TABLE in cases when columns are being renamed
---echo # hides some bugs.
-create table t1 (i int, j int) engine=myisam;
-insert into t1 value (1, 2);
---echo # First, test for original problem described in the bug report.
-select * from t1;
---echo # Change of column order by the below ALTER TABLE statement should
---echo # affect both column names and column contents.
-alter table t1 modify column j int first;
-select * from t1;
---echo # Now test for similar problem with the same root.
---echo # The below ALTER TABLE should change not only the name but
---echo # also the value for the last column of the table.
-alter table t1 drop column i, add column k int default 0;
-select * from t1;
---echo # Clean-up.
-drop table t1;
-
-
---echo End of 5.1 tests
-
-#
-# Bug #31031 ALTER TABLE regression in 5.0
-#
-# The ALTER TABLE operation failed with
-# ERROR 1089 (HY000): Incorrect sub part key; ...
-#
-CREATE TABLE t1(c CHAR(10),
- i INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY);
-INSERT INTO t1 VALUES('a',2),('b',4),('c',6);
-ALTER TABLE t1
- DROP i,
- ADD i INT UNSIGNED NOT NULL AUTO_INCREMENT,
- AUTO_INCREMENT = 1;
-DROP TABLE t1;
-
-
-#
-# Bug#50542 5.5.x doesn't check length of key prefixes:
-# corruption and crash results
-#
-# This case is related to Bug#31031 (above)
-# A statement where the index key is larger/wider than
-# the column type, should cause an error
-#
---error ER_WRONG_SUB_KEY
-CREATE TABLE t1 (a CHAR(1), PRIMARY KEY (a(255)));
-
-# Test other variants of creating indices
-CREATE TABLE t1 (a CHAR(1));
-# ALTER TABLE
---error ER_WRONG_SUB_KEY
-ALTER TABLE t1 ADD PRIMARY KEY (a(20));
---error ER_WRONG_SUB_KEY
-ALTER TABLE t1 ADD KEY (a(20));
-# CREATE INDEX
---error ER_WRONG_SUB_KEY
-CREATE UNIQUE INDEX i1 ON t1 (a(20));
---error ER_WRONG_SUB_KEY
-CREATE INDEX i2 ON t1 (a(20));
-# cleanup
-DROP TABLE t1;
-
-
-#
-# Bug #45052 ALTER TABLE ADD COLUMN crashes server with multiple foreign key columns
-# The alter table fails if 2 or more new fields added and
-# also added a key with these fields
-#
-CREATE TABLE t1 (id int);
-INSERT INTO t1 VALUES (1), (2);
-ALTER TABLE t1 ADD COLUMN (f1 INT), ADD COLUMN (f2 INT), ADD KEY f2k(f2);
-DROP TABLE t1;
-
-
---echo #
---echo # Test for bug #53820 "ALTER a MEDIUMINT column table causes full
---echo # table copy".
---echo #
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-CREATE TABLE t1 (a INT, b MEDIUMINT);
-INSERT INTO t1 VALUES (1, 1), (2, 2);
---echo # The below ALTER should not copy table and so no rows should
---echo # be shown as affected.
---enable_info
-ALTER TABLE t1 CHANGE a id INT;
---disable_info
-DROP TABLE t1;
-
-
---echo #
---echo # Bug#11754461 CANNOT ALTER TABLE WHEN KEY PREFIX TOO LONG
---echo #
-
---disable_warnings
-DROP DATABASE IF EXISTS db1;
---enable_warnings
-
-CREATE DATABASE db1 CHARACTER SET utf8;
-CREATE TABLE db1.t1 (bar TINYTEXT, KEY (bar(100)));
-ALTER TABLE db1.t1 ADD baz INT;
-
-DROP DATABASE db1;
-
-
---echo # Additional coverage for refactoring which is made as part
---echo # of fix for bug #27480 "Extend CREATE TEMPORARY TABLES privilege
---echo # to allow temp table operations".
---echo #
---echo # At some point the below test case failed on assertion.
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TEMPORARY TABLE t1 (i int) ENGINE=MyISAM;
-
---error ER_ILLEGAL_HA
-ALTER TABLE t1 DISCARD TABLESPACE;
-
-DROP TABLE t1;
-
-
---echo #
---echo # Bug#11938039 RE-EXECUTION OF FRM-ONLY ALTER TABLE WITH RENAME
---echo # CLAUSE FAILS OR ABORTS SERVER.
---echo #
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a int);
-prepare stmt1 from 'alter table t1 alter column a set default 1, rename to t2';
-execute stmt1;
-rename table t2 to t1;
---echo # The below statement should succeed and not emit error or abort server.
-execute stmt1;
-deallocate prepare stmt1;
-drop table t2;
-
---echo #
---echo # MDEV-8960 Can't refer the same column twice in one ALTER TABLE
---echo #
-
-CREATE TABLE t1 (
- `a` int(11) DEFAULT NULL
-) DEFAULT CHARSET=utf8;
-
-ALTER TABLE t1 ADD COLUMN `consultant_id` integer NOT NULL,
-ALTER COLUMN `consultant_id` DROP DEFAULT;
-
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (
- `a` int(11) DEFAULT NULL
-) DEFAULT CHARSET=utf8;
-
-ALTER TABLE t1 ADD COLUMN `consultant_id` integer NOT NULL,
-ALTER COLUMN `consultant_id` SET DEFAULT 2;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (
- `a` int(11) DEFAULT NULL
-) DEFAULT CHARSET=utf8;
-
-ALTER TABLE t1 ADD COLUMN `consultant_id` integer NOT NULL DEFAULT 2,
-ALTER COLUMN `consultant_id` DROP DEFAULT;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (
- `a` int(11) DEFAULT NULL
-) DEFAULT CHARSET=utf8;
-
-ALTER TABLE t1 ADD COLUMN `consultant_id` integer NOT NULL DEFAULT 2,
-ALTER COLUMN `consultant_id` DROP DEFAULT,
-MODIFY COLUMN `consultant_id` BIGINT;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-#
-# Test of ALTER TABLE IF [NOT] EXISTS
-#
-
-CREATE TABLE t1 (
- id INT(11) NOT NULL,
- x_param INT(11) DEFAULT NULL,
- PRIMARY KEY (id)
-) ENGINE=MYISAM;
-
-ALTER TABLE t1 ADD COLUMN IF NOT EXISTS id INT,
- ADD COLUMN IF NOT EXISTS lol INT AFTER id;
-ALTER TABLE t1 ADD COLUMN IF NOT EXISTS lol INT AFTER id;
-ALTER TABLE t1 DROP COLUMN IF EXISTS lol;
-ALTER TABLE t1 DROP COLUMN IF EXISTS lol;
-
-ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param);
-ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param);
-ALTER TABLE t1 MODIFY IF EXISTS lol INT;
-
-DROP INDEX IF EXISTS x_param ON t1;
-DROP INDEX IF EXISTS x_param ON t1;
-CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param);
-CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param);
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (
- id INT(11) NOT NULL,
- x_param INT(11) DEFAULT NULL,
- PRIMARY KEY (id)
-) ENGINE=INNODB;
-
-CREATE TABLE t2 (
- id INT(11) NOT NULL) ENGINE=INNODB;
-
-ALTER TABLE t1 ADD COLUMN IF NOT EXISTS id INT,
- ADD COLUMN IF NOT EXISTS lol INT AFTER id;
-ALTER TABLE t1 ADD COLUMN IF NOT EXISTS lol INT AFTER id;
-ALTER TABLE t1 DROP COLUMN IF EXISTS lol;
-ALTER TABLE t1 DROP COLUMN IF EXISTS lol;
-
-ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param);
-ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param);
-ALTER TABLE t1 MODIFY IF EXISTS lol INT;
-
-DROP INDEX IF EXISTS x_param ON t1;
-DROP INDEX IF EXISTS x_param ON t1;
-CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param);
-CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param);
-SHOW CREATE TABLE t1;
-
-ALTER TABLE t2 ADD FOREIGN KEY IF NOT EXISTS fk(id) REFERENCES t1(id);
-ALTER TABLE t2 ADD FOREIGN KEY IF NOT EXISTS fk(id) REFERENCES t1(id);
-ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS fk;
-ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS fk;
-SHOW CREATE TABLE t2;
-ALTER TABLE t2 ADD FOREIGN KEY (id) REFERENCES t1(id);
-ALTER TABLE t2 ADD FOREIGN KEY IF NOT EXISTS t2_ibfk_1(id) REFERENCES t1(id);
-ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS t2_ibfk_1;
-ALTER TABLE t2 DROP FOREIGN KEY IF EXISTS t2_ibfk_1;
-SHOW CREATE TABLE t2;
-
-DROP TABLE t2;
-CREATE TABLE t2 (
- id INT(11) NOT NULL);
-ALTER TABLE t2 ADD COLUMN a INT, ADD COLUMN IF NOT EXISTS a INT;
-ALTER TABLE t2 ADD KEY k_id(id), ADD KEY IF NOT EXISTS k_id(id);
-SHOW CREATE TABLE t2;
-ALTER TABLE t2 DROP KEY k_id, DROP KEY IF EXISTS k_id;
-ALTER TABLE t2 DROP COLUMN a, DROP COLUMN IF EXISTS a;
-SHOW CREATE TABLE t2;
-
-DROP TABLE t2;
-DROP TABLE t1;
-
-CREATE TABLE t1 (
- `transaction_id` int(11) NOT NULL DEFAULT '0',
- KEY `transaction_id` (`transaction_id`));
-ALTER TABLE t1 DROP KEY IF EXISTS transaction_id, ADD PRIMARY KEY IF NOT EXISTS (transaction_id);
-SHOW CREATE TABLE t1;
-
-DROP TABLE t1;
-
---echo # Bug#11748057 (formerly known as 34972): ALTER TABLE statement doesn't
---echo # identify correct column name.
---echo #
-
-CREATE TABLE t1 (c1 int unsigned , c2 char(100) not null default '');
-ALTER TABLE t1 ADD c3 char(16) NOT NULL DEFAULT '' AFTER c2,
- MODIFY c2 char(100) NOT NULL DEFAULT '' AFTER c1;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
---echo #
---echo # WL#5534 Online ALTER, Phase 1
---echo #
-
---echo # Single thread tests.
---echo # See innodb_mysql_sync.test for multi thread tests.
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1(a INT PRIMARY KEY, b INT) engine=InnoDB;
-CREATE TABLE m1(a INT PRIMARY KEY, b INT) engine=MyISAM;
-INSERT INTO t1 VALUES (1,1), (2,2);
-INSERT INTO m1 VALUES (1,1), (2,2);
-
---echo #
---echo # 1: Test ALGORITHM keyword
---echo #
-
---echo # --enable_info allows us to see how many rows were updated
---echo # by ALTER TABLE. in-place will show 0 rows, while copy > 0.
-
---enable_info
-ALTER TABLE t1 ADD INDEX i1(b);
-ALTER TABLE t1 ADD INDEX i2(b), ALGORITHM= DEFAULT;
-ALTER TABLE t1 ADD INDEX i3(b), ALGORITHM= COPY;
-ALTER TABLE t1 ADD INDEX i4(b), ALGORITHM= INPLACE;
---error ER_UNKNOWN_ALTER_ALGORITHM
-ALTER TABLE t1 ADD INDEX i5(b), ALGORITHM= INVALID;
-
-ALTER TABLE m1 ENABLE KEYS;
-ALTER TABLE m1 ENABLE KEYS, ALGORITHM= DEFAULT;
-ALTER TABLE m1 ENABLE KEYS, ALGORITHM= COPY;
-ALTER TABLE m1 ENABLE KEYS, ALGORITHM= INPLACE;
---disable_info
-
-ALTER TABLE t1 DROP INDEX i1, DROP INDEX i2, DROP INDEX i3, DROP INDEX i4;
-
---echo #
---echo # 2: Test ALGORITHM + old_alter_table
---echo #
-
---enable_info
-SET SESSION old_alter_table= 1;
-ALTER TABLE t1 ADD INDEX i1(b);
-ALTER TABLE t1 ADD INDEX i2(b), ALGORITHM= DEFAULT;
-ALTER TABLE t1 ADD INDEX i3(b), ALGORITHM= COPY;
-ALTER TABLE t1 ADD INDEX i4(b), ALGORITHM= INPLACE;
-SET SESSION old_alter_table= 0;
---disable_info
-
-ALTER TABLE t1 DROP INDEX i1, DROP INDEX i2, DROP INDEX i3, DROP INDEX i4;
-
---echo #
---echo # 3: Test unsupported in-place operation
---echo #
-
-ALTER TABLE t1 ADD COLUMN (c1 INT);
-ALTER TABLE t1 ADD COLUMN (c2 INT), ALGORITHM= DEFAULT;
-ALTER TABLE t1 ADD COLUMN (c3 INT), ALGORITHM= COPY;
-ALTER TABLE t1 ADD COLUMN (c4 INT), ALGORITHM= INPLACE;
-
-ALTER TABLE t1 DROP COLUMN c1, DROP COLUMN c2, DROP COLUMN c3, DROP COLUMN c4;
-
---echo #
---echo # 4: Test LOCK keyword
---echo #
-
---enable_info
-ALTER TABLE t1 ADD INDEX i1(b), LOCK= DEFAULT;
-ALTER TABLE t1 ADD INDEX i2(b), LOCK= NONE;
-ALTER TABLE t1 ADD INDEX i3(b), LOCK= SHARED;
-ALTER TABLE t1 ADD INDEX i4(b), LOCK= EXCLUSIVE;
---error ER_UNKNOWN_ALTER_LOCK
-ALTER TABLE t1 ADD INDEX i5(b), LOCK= INVALID;
---disable_info
-
-ALTER TABLE m1 ENABLE KEYS, LOCK= DEFAULT;
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE m1 ENABLE KEYS, LOCK= NONE;
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE m1 ENABLE KEYS, LOCK= SHARED;
-ALTER TABLE m1 ENABLE KEYS, LOCK= EXCLUSIVE;
-
-ALTER TABLE t1 DROP INDEX i1, DROP INDEX i2, DROP INDEX i3, DROP INDEX i4;
-
---echo #
---echo # 5: Test ALGORITHM + LOCK
---echo #
-
---enable_info
-ALTER TABLE t1 ADD INDEX i1(b), ALGORITHM= INPLACE, LOCK= NONE;
-ALTER TABLE t1 ADD INDEX i2(b), ALGORITHM= INPLACE, LOCK= SHARED;
-ALTER TABLE t1 ADD INDEX i3(b), ALGORITHM= INPLACE, LOCK= EXCLUSIVE;
---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
-ALTER TABLE t1 ADD INDEX i4(b), ALGORITHM= COPY, LOCK= NONE;
-ALTER TABLE t1 ADD INDEX i5(b), ALGORITHM= COPY, LOCK= SHARED;
-ALTER TABLE t1 ADD INDEX i6(b), ALGORITHM= COPY, LOCK= EXCLUSIVE;
-
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE m1 ENABLE KEYS, ALGORITHM= INPLACE, LOCK= NONE;
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE m1 ENABLE KEYS, ALGORITHM= INPLACE, LOCK= SHARED;
-ALTER TABLE m1 ENABLE KEYS, ALGORITHM= INPLACE, LOCK= EXCLUSIVE;
---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
-ALTER TABLE m1 ENABLE KEYS, ALGORITHM= COPY, LOCK= NONE;
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER ONLINE TABLE m1 ADD COLUMN c int;
-# This works because the lock will be SNW for the copy phase.
-# It will still require exclusive lock for actually enabling keys.
-ALTER TABLE m1 ENABLE KEYS, ALGORITHM= COPY, LOCK= SHARED;
-ALTER TABLE m1 ENABLE KEYS, ALGORITHM= COPY, LOCK= EXCLUSIVE;
---disable_info
-
-DROP TABLE t1, m1;
-
---echo #
---echo # 6: Possible deadlock involving thr_lock.c
---echo #
-
-CREATE TABLE t1(a INT PRIMARY KEY, b INT);
-INSERT INTO t1 VALUES (1,1), (2,2);
-
-START TRANSACTION;
-INSERT INTO t1 VALUES (3,3);
-
-connect (con1, localhost, root);
---echo # Sending:
---send ALTER TABLE t1 DISABLE KEYS
-
-connection default;
---echo # Waiting until ALTER TABLE is blocked.
-let $wait_condition=
- SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for table metadata lock" AND
- info = "ALTER TABLE t1 DISABLE KEYS";
---source include/wait_condition.inc
-UPDATE t1 SET b = 4;
-COMMIT;
-
-connection con1;
---echo # Reaping: ALTER TABLE t1 DISABLE KEYS
---reap
-disconnect con1;
---source include/wait_until_disconnected.inc
-
-connection default;
-DROP TABLE t1;
-
---echo #
---echo # 7: Which operations require copy and which can be done in-place?
---echo #
---echo # Test which ALTER TABLE operations are done in-place and
---echo # which operations are done using temporary table copy.
---echo #
---echo # --enable_info allows us to see how many rows were updated
---echo # by ALTER TABLE. in-place will show 0 rows, while copy > 0.
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS ti1, ti2, ti3, tm1, tm2, tm3;
---enable_warnings
-
---echo # Single operation tests
-
-CREATE TABLE ti1(a INT NOT NULL, b INT, c INT) engine=InnoDB;
-CREATE TABLE tm1(a INT NOT NULL, b INT, c INT) engine=MyISAM;
-CREATE TABLE ti2(a INT PRIMARY KEY AUTO_INCREMENT, b INT, c INT) engine=InnoDB;
-CREATE TABLE tm2(a INT PRIMARY KEY AUTO_INCREMENT, b INT, c INT) engine=MyISAM;
-INSERT INTO ti1 VALUES (1,1,1), (2,2,2);
-INSERT INTO ti2 VALUES (1,1,1), (2,2,2);
-INSERT INTO tm1 VALUES (1,1,1), (2,2,2);
-INSERT INTO tm2 VALUES (1,1,1), (2,2,2);
-
---enable_info
-ALTER TABLE ti1;
-ALTER TABLE tm1;
-
-ALTER TABLE ti1 ADD COLUMN d VARCHAR(200);
-ALTER TABLE tm1 ADD COLUMN d VARCHAR(200);
-ALTER TABLE ti1 ADD COLUMN d2 VARCHAR(200);
-ALTER TABLE tm1 ADD COLUMN d2 VARCHAR(200);
-ALTER TABLE ti1 ADD COLUMN e ENUM('a', 'b') FIRST;
-ALTER TABLE tm1 ADD COLUMN e ENUM('a', 'b') FIRST;
-ALTER TABLE ti1 ADD COLUMN f INT AFTER a;
-ALTER TABLE tm1 ADD COLUMN f INT AFTER a;
-
-ALTER TABLE ti1 ADD INDEX ii1(b);
-ALTER TABLE tm1 ADD INDEX im1(b);
-ALTER TABLE ti1 ADD UNIQUE INDEX ii2 (c);
-ALTER TABLE tm1 ADD UNIQUE INDEX im2 (c);
-ALTER TABLE ti1 ADD FULLTEXT INDEX ii3 (d);
-ALTER TABLE tm1 ADD FULLTEXT INDEX im3 (d);
-ALTER TABLE ti1 ADD FULLTEXT INDEX ii4 (d2);
-ALTER TABLE tm1 ADD FULLTEXT INDEX im4 (d2);
-
-# Bug#14140038 INCONSISTENT HANDLING OF FULLTEXT INDEXES IN ALTER TABLE
---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
-ALTER TABLE ti1 ADD PRIMARY KEY(a), ALGORITHM=INPLACE;
-ALTER TABLE ti1 ADD PRIMARY KEY(a);
-ALTER TABLE tm1 ADD PRIMARY KEY(a);
-
-ALTER TABLE ti1 DROP INDEX ii3;
-ALTER TABLE tm1 DROP INDEX im3;
-
-ALTER TABLE ti1 DROP COLUMN d2;
-ALTER TABLE tm1 DROP COLUMN d2;
-
-ALTER TABLE ti1 ADD CONSTRAINT fi1 FOREIGN KEY (b) REFERENCES ti2(a);
-ALTER TABLE tm1 ADD CONSTRAINT fm1 FOREIGN KEY (b) REFERENCES tm2(a);
-
-ALTER TABLE ti1 ALTER COLUMN b SET DEFAULT 1;
-ALTER TABLE tm1 ALTER COLUMN b SET DEFAULT 1;
-ALTER TABLE ti1 ALTER COLUMN b DROP DEFAULT;
-ALTER TABLE tm1 ALTER COLUMN b DROP DEFAULT;
-
-# This will set both ALTER_COLUMN_NAME and COLUMN_DEFAULT_VALUE
-ALTER TABLE ti1 CHANGE COLUMN f g INT;
-ALTER TABLE tm1 CHANGE COLUMN f g INT;
-ALTER TABLE ti1 CHANGE COLUMN g h VARCHAR(20);
-ALTER TABLE tm1 CHANGE COLUMN g h VARCHAR(20);
-ALTER TABLE ti1 MODIFY COLUMN e ENUM('a', 'b', 'c');
-ALTER TABLE tm1 MODIFY COLUMN e ENUM('a', 'b', 'c');
-ALTER TABLE ti1 MODIFY COLUMN e INT;
-ALTER TABLE tm1 MODIFY COLUMN e INT;
-# This will set both ALTER_COLUMN_ORDER and COLUMN_DEFAULT_VALUE
-ALTER TABLE ti1 MODIFY COLUMN e INT AFTER h;
-ALTER TABLE tm1 MODIFY COLUMN e INT AFTER h;
-ALTER TABLE ti1 MODIFY COLUMN e INT FIRST;
-ALTER TABLE tm1 MODIFY COLUMN e INT FIRST;
-# This will set both ALTER_COLUMN_NOT_NULLABLE and COLUMN_DEFAULT_VALUE
---disable_info
-# NULL -> NOT NULL only allowed INPLACE if strict sql_mode is on.
-SET @orig_sql_mode = @@sql_mode;
-SET @@sql_mode = 'STRICT_TRANS_TABLES';
---enable_info
-ALTER TABLE ti1 MODIFY COLUMN c INT NOT NULL;
---disable_info
-SET @@sql_mode = @orig_sql_mode;
---enable_info
-ALTER TABLE tm1 MODIFY COLUMN c INT NOT NULL;
-# This will set both ALTER_COLUMN_NULLABLE and COLUMN_DEFAULT_VALUE
-ALTER TABLE ti1 MODIFY COLUMN c INT NULL;
-ALTER TABLE tm1 MODIFY COLUMN c INT NULL;
-# This will set both ALTER_COLUMN_EQUAL_PACK_LENGTH and COLUMN_DEFAULT_VALUE
-ALTER TABLE ti1 MODIFY COLUMN h VARCHAR(30);
-ALTER TABLE tm1 MODIFY COLUMN h VARCHAR(30);
-ALTER TABLE ti1 MODIFY COLUMN h VARCHAR(30) AFTER d;
-ALTER TABLE tm1 MODIFY COLUMN h VARCHAR(30) AFTER d;
-
-ALTER TABLE ti1 DROP COLUMN h;
-ALTER TABLE tm1 DROP COLUMN h;
-
-ALTER TABLE ti1 DROP INDEX ii2;
-ALTER TABLE tm1 DROP INDEX im2;
-ALTER TABLE ti1 DROP PRIMARY KEY;
-ALTER TABLE tm1 DROP PRIMARY KEY;
-
-ALTER TABLE ti1 DROP FOREIGN KEY fi1;
-ALTER TABLE tm1 DROP FOREIGN KEY fm1;
-
-ALTER TABLE ti1 RENAME TO ti3;
-ALTER TABLE tm1 RENAME TO tm3;
-ALTER TABLE ti3 RENAME TO ti1;
-ALTER TABLE tm3 RENAME TO tm1;
-
-ALTER TABLE ti1 ORDER BY b;
-ALTER TABLE tm1 ORDER BY b;
-
-ALTER TABLE ti1 CONVERT TO CHARACTER SET utf16;
-ALTER TABLE tm1 CONVERT TO CHARACTER SET utf16;
-ALTER TABLE ti1 DEFAULT CHARACTER SET utf8;
-ALTER TABLE tm1 DEFAULT CHARACTER SET utf8;
-
-ALTER TABLE ti1 FORCE;
-ALTER TABLE tm1 FORCE;
-
-ALTER TABLE ti1 AUTO_INCREMENT 3;
-ALTER TABLE tm1 AUTO_INCREMENT 3;
-ALTER TABLE ti1 AVG_ROW_LENGTH 10;
-ALTER TABLE tm1 AVG_ROW_LENGTH 10;
-ALTER TABLE ti1 CHECKSUM 1;
-ALTER TABLE tm1 CHECKSUM 1;
-ALTER TABLE ti1 COMMENT 'test';
-ALTER TABLE tm1 COMMENT 'test';
-ALTER TABLE ti1 MAX_ROWS 100;
-ALTER TABLE tm1 MAX_ROWS 100;
-ALTER TABLE ti1 MIN_ROWS 1;
-ALTER TABLE tm1 MIN_ROWS 1;
-ALTER TABLE ti1 PACK_KEYS 1;
-ALTER TABLE tm1 PACK_KEYS 1;
-
---disable_info
-DROP TABLE ti1, ti2, tm1, tm2;
-
---echo # Tests of >1 operation (InnoDB)
-
-CREATE TABLE ti1(a INT PRIMARY KEY AUTO_INCREMENT, b INT) engine=InnoDB;
-INSERT INTO ti1(b) VALUES (1), (2);
-
---enable_info
-ALTER TABLE ti1 RENAME TO ti3, ADD INDEX ii1(b);
-
-ALTER TABLE ti3 DROP INDEX ii1, AUTO_INCREMENT 5;
---disable_info
-INSERT INTO ti3(b) VALUES (5);
---enable_info
-ALTER TABLE ti3 ADD INDEX ii1(b), AUTO_INCREMENT 7;
---disable_info
-INSERT INTO ti3(b) VALUES (7);
-SELECT * FROM ti3;
-
-DROP TABLE ti3;
-
---echo #
---echo # 8: Scenario in which ALTER TABLE was returning an unwarranted
---echo # ER_ILLEGAL_HA error at some point during work on this WL.
---echo #
-
-CREATE TABLE tm1(i INT DEFAULT 1) engine=MyISAM;
-ALTER TABLE tm1 ADD INDEX ii1(i), ALTER COLUMN i DROP DEFAULT;
-DROP TABLE tm1;
-
-#
-# MDEV-4435 Server crashes in my_strcasecmp_utf8 on ADD KEY IF NOT EXISTS with implicit name when the key exists.
-#
-create table if not exists t1 (i int);
-alter table t1 add key (i);
-alter table t1 add key if not exists (i);
-DROP TABLE t1;
-
-#
-# MDEV-4436 CHANGE COLUMN IF EXISTS does not work and throws wrong warning.
-#
-create table t1 (a int);
-alter table t1 change column if exists a b bigint;
-show create table t1;
-DROP TABLE t1;
-
-#
-# MDEV-4437 ALTER TABLE .. ADD UNIQUE INDEX IF NOT EXISTS causes syntax error.
-#
-
-create table t1 (i int);
-alter table t1 add unique index if not exists idx(i);
-alter table t1 add unique index if not exists idx(i);
-show create table t1;
-DROP TABLE t1;
-
-#
-# MDEV-8358 ADD PRIMARY KEY IF NOT EXISTS -> ERROR 1068 (42000): Multiple primary key
-#
-
-CREATE TABLE t1 (
- `event_id` bigint(20) unsigned NOT NULL DEFAULT '0',
- `market_id` bigint(20) unsigned NOT NULL DEFAULT '0',
- PRIMARY KEY (`event_id`,`market_id`)
- );
-ALTER TABLE t1 ADD PRIMARY KEY IF NOT EXISTS event_id (event_id,market_id);
-DROP TABLE t1;
-
---echo #
---echo # MDEV-11126 Crash while altering persistent virtual column
---echo #
-
-CREATE TABLE `tab1` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `field2` set('option1','option2','option3','option4') NOT NULL,
- `field3` set('option1','option2','option3','option4','option5') NOT NULL,
- `field4` set('option1','option2','option3','option4') NOT NULL,
- `field5` varchar(32) NOT NULL,
- `field6` varchar(32) NOT NULL,
- `field7` varchar(32) NOT NULL,
- `field8` varchar(32) NOT NULL,
- `field9` int(11) NOT NULL DEFAULT '1',
- `field10` varchar(16) NOT NULL,
- `field11` enum('option1','option2','option3') NOT NULL DEFAULT 'option1',
- `v_col` varchar(128) AS (IF(field11='option1',CONCAT_WS(":","field1",field2,field3,field4,field5,field6,field7,field8,field9,field10), CONCAT_WS(":","field1",field11,field2,field3,field4,field5,field6,field7,field8,field9,field10))) PERSISTENT,
- PRIMARY KEY (`id`)
-) DEFAULT CHARSET=latin1;
-
-ALTER TABLE `tab1` CHANGE COLUMN v_col `v_col` varchar(128);
-SHOW CREATE TABLE `tab1`;
-ALTER TABLE `tab1` CHANGE COLUMN v_col `v_col` varchar(128) AS (IF(field11='option1',CONCAT_WS(":","field1",field2,field3,field4,field5,field6,field7,field8,field9,field10), CONCAT_WS(":","field1",field11,field2,field3,field4,field5,field6,field7,field8,field9,field10))) PERSISTENT;
-SHOW CREATE TABLE `tab1`;
-DROP TABLE `tab1`;
-
---echo #
---echo # MDEV-11548 Reproducible server crash after the 2nd ALTER TABLE ADD FOREIGN KEY IF NOT EXISTS
---echo #
-
-CREATE TABLE t1 (id INT UNSIGNED NOT NULL PRIMARY KEY);
-CREATE TABLE t2 (id1 INT UNSIGNED NOT NULL);
-
-ALTER TABLE t2
-ADD FOREIGN KEY IF NOT EXISTS (id1)
- REFERENCES t1 (id);
-
-ALTER TABLE t2
-ADD FOREIGN KEY IF NOT EXISTS (id1)
-REFERENCES t1 (id);
-
-DROP TABLE t2;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-6390 CONVERT TO CHARACTER SET utf8 doesn't change DEFAULT CHARSET.
---echo #
-
-CREATE TABLE t1 (id int(11) NOT NULL, a int(11) NOT NULL, b int(11))
- ENGINE=InnoDB DEFAULT CHARSET=latin1;
-SHOW CREATE TABLE t1;
-ALTER TABLE t1 CONVERT TO CHARACTER SET utf8;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
---echo #
---echo # End of 10.0 tests
---echo #
-
---echo #
---echo # MDEV-7374 : Losing connection to MySQL while running ALTER TABLE
---echo #
-CREATE TABLE t1(i INT) ENGINE=INNODB;
-INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
-INSERT INTO t1 SELECT a.* FROM t1 a, t1 b, t1 c, t1 d, t1 e;
-ALTER TABLE t1 MODIFY i FLOAT;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-7816 ALTER with DROP INDEX and ADD INDEX .. COMMENT='comment2' ignores the new comment
---echo #
-CREATE TABLE t1(a INT);
-CREATE INDEX i1 ON t1(a) COMMENT 'comment1';
-ALTER TABLE t1 DROP INDEX i1, ADD INDEX i1(a) COMMENT 'comment2';
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
---echo #
---echo # End of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-10421 duplicate CHECK CONSTRAINTs
---echo #
-CREATE TABLE t1 (a INT, b INT) engine=myisam;
-ALTER TABLE t1 ADD CONSTRAINT IF NOT EXISTS `min` CHECK (a+b > 100);
---error ER_DUP_CONSTRAINT_NAME
-ALTER TABLE t1 ADD CONSTRAINT `min` CHECK (a+b > 100);
-ALTER TABLE t1 ADD CONSTRAINT IF NOT EXISTS `min` CHECK (a+b > 100);
-ALTER TABLE t1 ADD CONSTRAINT `mini` CHECK (a+b > 100);
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
---error ER_DUP_CONSTRAINT_NAME
-CREATE TABLE t1(a INT, b INT, CONSTRAINT min check (a>5),
- CONSTRAINT min check (b>5));
-
-#
-# MDEV-11114 Cannot drop column referenced by CHECK constraint
-#
-create table t1 (a int, b int, check(a>b));
---error ER_BAD_FIELD_ERROR
-alter table t1 drop column a;
---error ER_BAD_FIELD_ERROR
-alter table t1 drop column b, add column b bigint first;
-alter table t1 drop column a, drop constraint constraint_1;
-show create table t1;
-drop table t1;
-
-create table t1 (a int, b int, check(a>0));
-alter table t1 drop column a;
-show create table t1;
-drop table t1;
-
-create table t1 (a int, b int, check(a>0));
-alter table t1 drop column a, add column a bigint first;
-show create table t1;
-drop table t1;
-
-create table t1 (a int, b int, c int, unique(a));
-alter table t1 drop column a;
-show create table t1;
-drop table t1;
-
-create table t1 (a int, b int, c int, unique(a,b));
---error ER_KEY_COLUMN_DOES_NOT_EXITS
-alter table t1 drop column a;
-alter table t1 drop column a, drop index a;
-show create table t1;
-drop table t1;
-
-#
-# MDEV-14694 ALTER COLUMN IF EXISTS .. causes syntax error
-#
-
-create table t1 (i int);
-alter table t1 alter column if exists a set default 1;
-alter table t1 alter column if exists a drop default;
-show create table t1;
-drop table t1;
-
---echo #
---echo # MDEV-13508 Check that rename of columns changes defaults, virtual
---echo # columns and constraints
---echo #
-
-create table t1 (a int, b int, check(a>b));
-alter table t1 change column a b int, change column b a int;
-show create table t1;
-drop table t1;
-
-create table t1 (a int primary key, b int, c int default (a+b) check (a+b>0),
- d int as (a+b),
- key (b),
- constraint test check (a+b > 1));
-alter table t1 change b new_b int not null, add column b char(1), add constraint new check (length(b) > 0);
-show create table t1;
-drop table t1;
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/alter_table_autoinc-5574.test b/mysql-test/t/alter_table_autoinc-5574.test
deleted file mode 100644
index 95c2b8d81bb..00000000000
--- a/mysql-test/t/alter_table_autoinc-5574.test
+++ /dev/null
@@ -1,12 +0,0 @@
-#
-# MDEV-5574 Set AUTO_INCREMENT below max value of column
-#
---source include/have_innodb.inc
-create table t1(a int(10)unsigned not null auto_increment primary key,
-b varchar(255) not null) engine=innodb default charset=utf8;
-insert into t1 values(1,'aaa'),(2,'bbb');
-alter table t1 auto_increment=1;
-insert into t1 values(NULL, 'ccc');
-select * from t1;
-drop table t1;
-
diff --git a/mysql-test/t/alter_table_mdev539_maria.test b/mysql-test/t/alter_table_mdev539_maria.test
deleted file mode 100644
index 7e01bc3be84..00000000000
--- a/mysql-test/t/alter_table_mdev539_maria.test
+++ /dev/null
@@ -1,7 +0,0 @@
-
---echo #
-set @@storage_engine= Aria;
-
---source include/alter_table_mdev539.inc
-
-set @@storage_engine= default;
diff --git a/mysql-test/t/alter_table_mdev539_myisam.test b/mysql-test/t/alter_table_mdev539_myisam.test
deleted file mode 100644
index 0a5669088bf..00000000000
--- a/mysql-test/t/alter_table_mdev539_myisam.test
+++ /dev/null
@@ -1,7 +0,0 @@
-
---echo #
-set @@storage_engine= MyISAM;
-
---source include/alter_table_mdev539.inc
-
-set @@storage_engine= default;
diff --git a/mysql-test/t/alter_table_online.test b/mysql-test/t/alter_table_online.test
deleted file mode 100644
index 6ef9661c43b..00000000000
--- a/mysql-test/t/alter_table_online.test
+++ /dev/null
@@ -1,335 +0,0 @@
-#
-# Test of ALTER ONLINE TABLE syntax
-#
-
---source include/have_innodb.inc
---source include/have_partition.inc
-#
-# Test of things that can be done online
-#
-
-create table t1 (a int not null primary key, b int, c varchar(80), e enum('a','b')) engine=myisam;
-insert into t1 (a) values (1),(2),(3);
-
-alter online table t1 modify b int default 5, alter c set default 'X';
-alter online table t1 change b new_name int;
-alter online table t1 modify e enum('a','b','c');
-alter online table t1 comment "new comment";
-alter table t1 add constraint q check (a > 0);
-alter online table t1 drop constraint q;
-
-# No OPs
-
-alter online table t1 algorithm=INPLACE, lock=NONE;
-alter online table t1;
-alter table t1 algorithm=INPLACE;
-alter table t1 lock=NONE;
-show create table t1;
-drop table t1;
-
-#
-# everything with temporary tables is "online", i.e. without locks
-#
-create temporary table t1 (a int not null primary key, b int, c varchar(80), e enum('a','b'));
-insert into t1 (a) values (1),(2),(3);
-
-alter online table t1 modify b int default 5, alter c set default 'X';
-alter online table t1 change b new_name int;
-alter online table t1 modify e enum('a','b','c');
-alter online table t1 comment "new comment";
-alter online table t1 rename to t2;
-show create table t2;
-drop table t2;
-
-#
-# Test also with Aria
-#
-
-create table t1 (a int not null primary key, b int, c varchar(80), e enum('a','b')) engine=aria;
-insert into t1 (a) values (1),(2),(3);
-alter online table t1 modify b int default 5;
-alter online table t1 change b new_name int;
-alter online table t1 modify e enum('a','b','c');
-alter online table t1 comment "new comment";
-show create table t1;
-alter online table t1 page_checksum=1;
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-alter online table t1 page_checksum=0;
-drop table t1;
-
-#
-# Test of things that is not possible to do online
-#
-
-create table t1 (a int not null primary key, b int, c varchar(80), e enum('a','b'));
-insert into t1 (a) values (1),(2),(3);
-
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-alter online table t1 drop column b, add b int;
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-alter online table t1 modify b bigint;
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-alter online table t1 modify e enum('c','a','b');
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-alter online table t1 modify c varchar(50);
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-alter online table t1 modify c varchar(100);
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-alter online table t1 add f int;
---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
-alter online table t1 engine=memory;
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-alter online table t1 rename to t2;
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-alter online table t1 checksum=1;
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-alter online table t1 add constraint check (b > 0);
-
-alter table t1 engine=innodb;
-alter table t1 add index (b);
-alter online table t1 add index c (c);
-alter online table t1 drop index b;
-alter online table t1 comment "new comment";
-show create table t1;
-drop table t1;
-
-create temporary table t1 (a int not null primary key, b int, c varchar(80), e enum('a','b'));
-insert into t1 (a) values (1),(2),(3);
-
-#
-# everything with temporary tables is "online", i.e. without locks
-#
-alter online table t1 drop column b, add b int;
-alter online table t1 modify b bigint;
-alter online table t1 modify e enum('c','a','b');
-alter online table t1 modify c varchar(50);
-alter online table t1 modify c varchar(100);
-alter online table t1 add f int;
-alter online table t1 engine=memory;
-
-alter table t1 engine=innodb;
-alter table t1 add index (b);
-alter online table t1 add index c (c);
-alter online table t1 drop index b;
-drop table t1;
-
-#
-# Test merge tables
-#
-create table t1 (a int not null primary key, b int, c varchar(80));
-create table t2 (a int not null primary key, b int, c varchar(80));
-create table t3 (a int not null primary key, b int, c varchar(80)) engine=merge UNION=(t1);
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-alter online table t3 union=(t1,t2);
-drop table t1,t2,t3;
-
-#
-# MDEV-9868 Altering a partitioned table comment does a full copy
-#
-create table t1 (i int) partition by hash(i) partitions 2;
-alter online table t1 comment 'test';
-drop table t1;
-
-#
-# MDEV-9168 altering a column comment does a full copy
-#
-create table t1 (a int);
-alter online table t1 modify a int comment 'test';
-drop table t1;
-
-create table t1 (a int) engine=innodb;
-alter online table t1 modify a int comment 'test';
-drop table t1;
-
-create table t1 (a int) partition by hash(a) partitions 2;
-alter online table t1 modify a int comment 'test';
-drop table t1;
-
---echo #
---echo # MDEV-8948 ALTER ... INPLACE does work for BINARY, BLOB
---echo #
-#
-# ALTER to the same [VAR]BINARY type
-#
-CREATE TABLE t1 (a BINARY(10));
-ALTER TABLE t1 MODIFY a BINARY(10), ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARBINARY(10));
-ALTER TABLE t1 MODIFY a VARBINARY(10), ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-#
-# ALTER to the same BLOB variant
-#
-CREATE TABLE t1 (a TINYBLOB);
-ALTER TABLE t1 MODIFY a TINYBLOB, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a MEDIUMBLOB);
-ALTER TABLE t1 MODIFY a MEDIUMBLOB, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a BLOB);
-ALTER TABLE t1 MODIFY a BLOB, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a LONGBLOB);
-ALTER TABLE t1 MODIFY a LONGBLOB, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-#
-# ALTER to the same [VAR]CHAR type
-#
-CREATE TABLE t1 (a CHAR(10));
-ALTER TABLE t1 MODIFY a CHAR(10), ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10));
-ALTER TABLE t1 MODIFY a VARCHAR(10), ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-
-#
-# ALTER to the same TEXT variant
-#
-CREATE TABLE t1 (a TINYTEXT);
-ALTER TABLE t1 MODIFY a TINYTEXT, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a MEDIUMTEXT);
-ALTER TABLE t1 MODIFY a MEDIUMTEXT, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a TEXT);
-ALTER TABLE t1 MODIFY a TEXT, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a LONGTEXT);
-ALTER TABLE t1 MODIFY a LONGTEXT, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-#
-# ALTER from a non-binary to a binary collation
-#
-CREATE TABLE t1 (a CHAR(10));
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE t1 MODIFY a CHAR(10) COLLATE latin1_bin, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10));
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE latin1_bin, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a TINYTEXT);
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE t1 MODIFY a TINYTEXT COLLATE latin1_bin, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a MEDIUMTEXT);
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE t1 MODIFY a MEDIUMTEXT COLLATE latin1_bin, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a TEXT);
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE t1 MODIFY a TEXT COLLATE latin1_bin, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a LONGTEXT);
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE t1 MODIFY a LONGTEXT COLLATE latin1_bin, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-#
-# ALTER from a binary to a non-binary collation
-#
-CREATE TABLE t1 (a CHAR(10) COLLATE latin1_bin);
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE t1 MODIFY a CHAR(10) COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10) COLLATE latin1_bin);
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a TINYTEXT COLLATE latin1_bin);
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE t1 MODIFY a TINYTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a MEDIUMTEXT COLLATE latin1_bin);
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE t1 MODIFY a MEDIUMTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a TEXT COLLATE latin1_bin);
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE t1 MODIFY a TEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a LONGTEXT COLLATE latin1_bin);
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE t1 MODIFY a LONGTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-#
-# ALTER from a non-binary collation to another non-binary collation
-#
-CREATE TABLE t1 (a CHAR(10) COLLATE latin1_general_ci);
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE t1 MODIFY a CHAR(10) COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10) COLLATE latin1_general_ci);
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE t1 MODIFY a VARCHAR(10) COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a TINYTEXT COLLATE latin1_general_ci);
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE t1 MODIFY a TINYTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a MEDIUMTEXT COLLATE latin1_general_ci);
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE t1 MODIFY a MEDIUMTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a TEXT COLLATE latin1_general_ci);
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE t1 MODIFY a TEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a LONGTEXT COLLATE latin1_general_ci);
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE t1 MODIFY a LONGTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-# End of 10.0 tests
-
-#
-# MDEV-11335 Changing delay_key_write option for MyISAM table should not copy rows
-#
-select @@global.delay_key_write;
-create table t1 (a int, b int, key(b));
-flush tables;
-flush status;
-show status like 'Feature_delay_key_write';
-insert t1 values (1,2),(2,3),(3,4);
-show status like 'Feature_delay_key_write';
-alter online table t1 delay_key_write=1;
-show status like 'Feature_delay_key_write';
-flush tables;
-insert t1 values (1,2),(2,3),(3,4);
-show status like 'Feature_delay_key_write';
-alter online table t1 delay_key_write=0;
-show status like 'Feature_delay_key_write';
-flush tables;
-insert t1 values (1,2),(2,3),(3,4);
-show status like 'Feature_delay_key_write';
-drop table t1;
-
-# End of 10.1 tests
diff --git a/mysql-test/t/alter_table_trans.test b/mysql-test/t/alter_table_trans.test
deleted file mode 100644
index 19b40d84b22..00000000000
--- a/mysql-test/t/alter_table_trans.test
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# Test of alter table with transactional tables
-#
-
---source include/have_innodb.inc
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-#
-# This test caused a crash in wait_if_global_read_lock()
-#
-CREATE TABLE t1 (a INT, INDEX(a)) engine=innodb;
-ALTER TABLE t1 RENAME TO t2, DISABLE KEYS;
-DROP TABLE t2;
-
-#
-# MDEV-5406 add index to an innodb table with a uniqueness violation crashes mysqld
-#
-
-CREATE TABLE t1 (
- col4 text NOT NULL,
- col2 int(11) NOT NULL DEFAULT '0',
- col3 int(11) DEFAULT NULL,
- extra int(11) DEFAULT NULL,
- KEY idx (col4(10))
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-insert t1 values (repeat('1', 8193),3,1,1);
-insert t1 values (repeat('3', 8193),3,1,1);
---error ER_DUP_ENTRY
-ALTER TABLE t1 ADD PRIMARY KEY (col4(10)) , ADD UNIQUE KEY uidx (col3);
-DROP TABLE t1;
-
-#
-# MDEV-5743 Server crashes in mysql_alter_table on an attempt to add a primary key to InnoDB table
-#
-
-CREATE TABLE t1 (a INT) ENGINE = InnoDB;
-INSERT INTO t1 VALUES (2);
-ALTER TABLE t1 ADD PRIMARY KEY (a);
-ALTER TABLE t1 DROP PRIMARY KEY;
-INSERT INTO t1 VALUES (2);
---error ER_DUP_ENTRY
-ALTER TABLE t1 ADD PRIMARY KEY (a);
-DROP TABLE t1;
-
diff --git a/mysql-test/t/alter_user.test b/mysql-test/t/alter_user.test
deleted file mode 100644
index ca444f70a70..00000000000
--- a/mysql-test/t/alter_user.test
+++ /dev/null
@@ -1,79 +0,0 @@
---source include/not_embedded.inc
-
-select * from mysql.user where user = 'root' and host = 'localhost';
---echo # Test syntax
---echo #
---echo # These 2 selects should have no changes from the first one.
-alter user CURRENT_USER;
-select * from mysql.user where user = 'root' and host = 'localhost';
-alter user CURRENT_USER();
-select * from mysql.user where user = 'root' and host = 'localhost';
-
-create user foo;
-select * from mysql.user where user = 'foo';
-alter user foo;
-select * from mysql.user where user = 'foo';
-
---echo # Test super privilege works correctly with a read only database.
-SET @start_read_only = @@global.read_only;
-SET GLOBAL read_only=1;
-grant create user on *.* to foo;
-
---echo # Currently no super privileges.
-connect (a, localhost, foo);
-select @@global.read_only;
-
---error ER_OPTION_PREVENTS_STATEMENT
-alter user foo;
-
---echo # Grant super privilege to the user.
-connection default;
-grant super on *.* to foo;
-
---echo # We now have super privilege. We should be able to run alter user.
-connect (b, localhost, foo);
-alter user foo;
-
-connection default;
-SET GLOBAL read_only = @start_read_only;
-
---echo # Test inexistant user.
---error ER_CANNOT_USER
-alter user boo;
---echo #--warning ER_CANNOT_USER
-alter if exists user boo;
-
---echo # Test password related altering.
-alter user foo identified by 'something';
-select * from mysql.user where user = 'foo';
-
-alter user foo identified by 'something2';
-select * from mysql.user where user = 'foo';
-
-alter user foo identified by password '*88C89BE093D4ECF72D039F62EBB7477EA1FD4D63';
-select * from mysql.user where user = 'foo';
-
-alter user foo identified with 'somecoolplugin';
-select * from mysql.user where user = 'foo';
-
-alter user foo identified with 'somecoolplugin' using 'somecoolpassphrase';
-select * from mysql.user where user = 'foo';
-
---echo # Test ssl related altering.
-alter user foo identified by 'something' require SSL;
-select * from mysql.user where user = 'foo';
-
-alter user foo identified by 'something' require X509;
-select * from mysql.user where user = 'foo';
-
-alter user foo identified by 'something'
-require cipher 'text' issuer 'foo_issuer' subject 'foo_subject';
-select * from mysql.user where user = 'foo';
-
---echo # Test resource limits altering.
-alter user foo with MAX_QUERIES_PER_HOUR 10
- MAX_UPDATES_PER_HOUR 20
- MAX_CONNECTIONS_PER_HOUR 30
- MAX_USER_CONNECTIONS 40;
-select * from mysql.user where user = 'foo';
-drop user foo;
diff --git a/mysql-test/t/analyze.test b/mysql-test/t/analyze.test
deleted file mode 100644
index 0903db1eca4..00000000000
--- a/mysql-test/t/analyze.test
+++ /dev/null
@@ -1,87 +0,0 @@
-#
-# Bug #10901 Analyze Table on new table destroys table
-# This is minimal test case to get error
-# The problem was that analyze table wrote the shared state to the
-# file and this didn't include the inserts while locked. A check was
-# needed to ensure that state information was not updated when
-# executing analyze table for a locked table. The analyze table had
-# to be within locks and check table had to be after unlocking since
-# then it brings the wrong state from disk rather than from the
-# currently correct internal state. The insert is needed since it
-# changes the file state, number of records. The fix is to
-# synchronise the state of the shared state and the current state
-# before calling mi_state_info_write
-#
-
-create table t1 (a bigint);
-lock tables t1 write;
-insert into t1 values(0);
-analyze table t1;
-unlock tables;
-check table t1;
-
-drop table t1;
-
-create table t1 (a bigint);
-insert into t1 values(0);
-lock tables t1 write;
-delete from t1;
-analyze table t1;
-unlock tables;
-check table t1;
-
-drop table t1;
-
-create table t1 (a bigint);
-insert into t1 values(0);
-analyze table t1;
-check table t1;
-
-drop table t1;
-
-# Bug #14902 ANALYZE TABLE fails to recognize up-to-date tables
-# minimal test case to get an error.
-# The problem is happening when analysing table with FT index that
-# contains stopwords only. The first execution of analyze table should
-# mark index statistics as up to date so that next execution of this
-# statement will end up with Table is up to date status.
-create table t1 (a mediumtext, fulltext key key1(a)) charset utf8 collate utf8_general_ci engine myisam;
-insert into t1 values ('hello');
-
-analyze table t1;
-analyze table t1;
-
-drop table t1;
-
-#
-# procedure in PS BUG#13673
-#
-CREATE TABLE t1 (a int);
-prepare stmt1 from "SELECT * FROM t1 PROCEDURE ANALYSE()";
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-drop table t1;
-
-#
-# bug#15225 (ANALYZE temporary has no effect)
-#
-create temporary table t1(a int, index(a));
-insert into t1 values('1'),('2'),('3'),('4'),('5');
-analyze table t1;
-show index from t1;
-drop table t1;
-
---echo End of 4.1 tests
-
-#
-# Bug #30495: optimize table t1,t2,t3 extended errors
-#
-create table t1(a int);
---error 1064
-analyze table t1 extended;
---error 1064
-optimize table t1 extended;
-drop table t1;
-
---echo End of 5.0 tests
diff --git a/mysql-test/t/analyze_debug.test b/mysql-test/t/analyze_debug.test
deleted file mode 100644
index 684011c5aea..00000000000
--- a/mysql-test/t/analyze_debug.test
+++ /dev/null
@@ -1,13 +0,0 @@
-
---source include/have_debug.inc
-
-SET @save_use_stat_tables= @@use_stat_tables;
-SET use_stat_tables= PREFERABLY;
-CREATE TABLE t1 (a int);
-insert into t1 values (1),(2),(3);
-
-SET STATEMENT debug_dbug="d,fail_2call_open_only_one_table" for
-ANALYZE TABLE t1;
-
-drop table t1;
-SET use_stat_tables= @save_use_stat_tables;
diff --git a/mysql-test/t/analyze_format_json.test b/mysql-test/t/analyze_format_json.test
deleted file mode 100644
index 915e0c2bf3c..00000000000
--- a/mysql-test/t/analyze_format_json.test
+++ /dev/null
@@ -1,226 +0,0 @@
-#
-# Tests for "ANALYZE FORMAT=JSON $statement" syntax
-#
---disable_warnings
-drop table if exists t0,t1,t2,t3;
---enable_warnings
-
-create table t0 (a int);
-INSERT INTO t0 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
---echo # r_filtered=30%, because 3 rows match: 0,1,2
---source include/analyze-format.inc
-analyze format=json select * from t0 where a<3;
-
-create table t1 (a int, b int, c int, key(a));
-insert into t1 select A.a*10 + B.a, A.a*10 + B.a, A.a*10 + B.a from t0 A, t0 B;
-
---source include/analyze-format.inc
-analyze
-select * from t0, t1 where t1.a=t0.a and t0.a > 9;
---source include/analyze-format.inc
-analyze format=json
-select * from t0, t1 where t1.a=t0.a and t0.a > 9;
-
-analyze
-select * from t0, t1 where t1.a=t0.a and t1.b<4;
-
---source include/analyze-format.inc
-analyze format=json
-select * from t0, t1 where t1.a=t0.a and t1.b<4;
-
-analyze
-select * from t1 tbl1, t1 tbl2 where tbl1.b<2 and tbl2.b>5;
-
---source include/analyze-format.inc
-analyze format=json
-select * from t1 tbl1, t1 tbl2 where tbl1.b<20 and tbl2.b<60;
-
---source include/analyze-format.inc
-analyze format=json
-select * from t1 tbl1, t1 tbl2 where tbl1.b<20 and tbl2.b<60 and tbl1.c > tbl2.c;
-
-drop table t1;
-drop table t0;
-
---echo #
---echo # MDEV-7674: ANALYZE shows r_rows=0
---echo #
-
-create table t1(a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t2 (a int, key(a));
-insert into t2 values (0),(1);
-
---source include/analyze-format.inc
-analyze format=json select * from t1 straight_join t2 force index(a) where t2.a=t1.a;
-
-drop table t1,t2;
-
-create table t1(a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
---echo #
---echo # MDEV-7679: ANALYZE crashes when printing WHERE when no default db
---echo #
-
-select database();
-connect (con1,localhost,root,,*NO-ONE*);
-connection con1;
-select database();
---source include/analyze-format.inc
-analyze format=json select * from test.t1 where t1.a<5;
-disconnect con1;
-connection default;
-drop table t1;
-
-
---echo #
---echo # MDEV-7812: ANALYZE FORMAT=JSON UPDATE/DELETE doesnt print
---echo # the r_total_time_ms
---echo #
-
-create table t2(a int);
-insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t3(a int);
-insert into t3 select A.a + B.a* 10 + C.a * 100 from t2 A, t2 B, t2 C;
-
-create table t1 (pk int primary key);
-insert into t1 select a from t3;
-alter table t1 add b int;
-
---source include/analyze-format.inc
-analyze format=json
-update t1 set b=pk;
-
---source include/analyze-format.inc
-analyze format=json
-select * from t1 where pk < 10 and b > 4;
-
---source include/analyze-format.inc
-analyze format=json
-delete from t1 where pk < 10 and b > 4;
-
-drop table t1, t3, t2;
-
---echo #
---echo # MDEV-7833:ANALYZE FORMAT=JSON and Range checked for each record
---echo #
-create table t3(a int);
-insert into t3 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t4(a int);
-insert into t4 select A.a + B.a* 10 + C.a * 100 from t3 A, t3 B, t3 C;
-
-create table t1 (lb1 int, rb1 int, lb2 int, rb2 int, c1 int, c2 int);
-
-insert into t1 values (1,2,10,20,15,15);
-insert into t1 values (3,5,10,20,15,15);
-insert into t1 values (10,20,10,20,15,15);
-insert into t1 values (10,20,1,2,15,15);
-insert into t1 values (10,20,10,20,1,3);
-
-create table t2 (key1 int, key2 int, key3 int, key4 int, col1 int,
- key(key1), key(key2), key(key3), key(key4));
-insert into t2 select a,a,a,a,a from t3;
-insert into t2 select 15,15,15,15,15 from t4;
-
---source include/analyze-format.inc
-analyze format=json
-select * from t1, t2 where (t2.key1 between t1.lb1 and t1.rb1) and
- (t2.key2 between t1.lb2 and t1.rb2) and
- (t2.key3=t1.c1 OR t2.key4=t1.c2);
-
-drop table t1,t2,t3,t4;
-
---echo #
---echo # MDEV-7904: ANALYZE FORMAT=JSON SELECT .. UNION SELECT doesn't print r_rows for union output
---echo #
-create table t0 (a int);
-INSERT INTO t0 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1 (a int);
-INSERT INTO t1 select * from t0;
-
---source include/analyze-format.inc
-analyze format=json (select * from t1 tbl1 where a<5) union (select * from t1 tbl2 where a in (2,3));
-
-drop table t0, t1;
-
-
---echo #
---echo # MDEV-7970: EXPLAIN FORMAT=JSON does not print HAVING
---echo #
-create table t0(a int);
-insert into t0 values (0),(1),(2),(3);
-create table t1(a int);
-insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
-create table t2 (
- a int,
- b int,
- key (a)
-);
-insert into t2 select A.a*1000 + B.a, A.a*1000 + B.a from t0 A, t1 B;
---echo # normal HAVING
---source include/analyze-format.inc
-analyze format=json select a, max(b) as TOP from t2 group by a having TOP > a;
---echo # HAVING is always TRUE (not printed)
---source include/analyze-format.inc
-analyze format=json select a, max(b) as TOP from t2 group by a having 1<>2;
---echo # HAVING is always FALSE (intercepted by message)
---source include/analyze-format.inc
-analyze format=json select a, max(b) as TOP from t2 group by a having 1=2;
---echo # HAVING is absent
---source include/analyze-format.inc
-analyze format=json select a, max(b) as TOP from t2 group by a;
-drop table t0, t1, t2;
-
---echo #
---echo # MDEV-7267: Server crashes in Item_field::print on ANALYZE FORMAT=JSON
---echo #
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE TABLE t2 (b INT);
-INSERT INTO t2 VALUES (3),(4);
-
---source include/analyze-format.inc
-ANALYZE FORMAT=JSON SELECT STRAIGHT_JOIN * FROM t1, t2 WHERE b IN ( SELECT a FROM t1 );
-
-drop table t1,t2;
-
---echo #
---echo # MDEV-8864: Server crash #2 in Item_field::print on ANALYZE FORMAT=JSON
---echo #
-CREATE TABLE t1 (f1 INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE TABLE t2 (f2 INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (2),(3);
-
-CREATE TABLE t3 (f3 INT) ENGINE=MyISAM;
-INSERT INTO t3 VALUES (3),(4);
-
---source include/analyze-format.inc
-ANALYZE FORMAT=JSON
-SELECT GROUP_CONCAT(f3) AS gc, ( SELECT MAX(f1) FROM t1, t2 WHERE f2 = f3 ) sq
-FROM t2, t3
-WHERE f3 IN ( 1, 2 )
-GROUP BY sq ORDER BY gc;
-
-drop table t1,t2,t3;
-
-
---echo #
---echo # MDEV-13286: Floating point exception in Filesort_tracker::print_json_members(Json_writer*)
---echo #
-create table t0(a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t1 (a int, b int, c int);
-insert into t1 select a,a,a from t0;
-create table t2 as select * from t1;
---source include/analyze-format.inc
-analyze format=json select a, (select t2.b from t2 where t2.a<t1.a order by t2.c limit 1) from t1 where t1.a<0;
-drop table t0,t1,t2;
diff --git a/mysql-test/t/analyze_stmt.test b/mysql-test/t/analyze_stmt.test
deleted file mode 100644
index d02139fe0c8..00000000000
--- a/mysql-test/t/analyze_stmt.test
+++ /dev/null
@@ -1,275 +0,0 @@
-#
-# Tests for "ANALYZE $statement" feature
-#
---disable_warnings
-drop table if exists t0,t1,t2,t3;
---enable_warnings
-
-create table t0 (a int) engine=myisam;
-INSERT INTO t0 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1 (a int) engine=myisam;
-INSERT INTO t1 select * from t0;
-
---echo # Try a few basic selects to see that r_rows and r_filtered columns work
-analyze select * from t1;
-analyze select * from t1 where a<5;
-analyze select * from t1 where a>100;
-
---echo # ANALYZE DELETE will delete rows:
-analyze delete from t1 where a in (2,3,4);
-select * from t1;
-drop table t1;
-
---echo # ANALYZE UPDATE will make updates:
-create table t1(a int, b int);
-insert into t1 select a,a from t0;
-analyze update t1 set b=100+b where a in (6,7,8);
-select * from t1;
-drop table t1;
-
---echo # Check that UNION works
-create table t1(a int, b int);
-insert into t1 select a,a from t0;
-analyze (select * from t1 A where a<5) union (select * from t1 B where a in (5,6));
-analyze (select * from t1 A where a<5) union (select * from t1 B where a in (1,2));
-drop table t1;
-drop table t0;
-
---echo #
---echo # Try a subquery.
---echo #
-create table t0 (a int, b int);
-insert into t0 values
- (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
-
-create table t1 (a int, b int);
-insert into t1 values (1,1),(2,2),(3,3);
-
-#
-# t1 t0
-# a=1 (0,1) 2 rows
-# a=2 (0,1,2) 3 rows
-# a=3 (0,1,2,3) 4 rows
-#
-# TOTAL TOTAL= 9 rows. 3 executions, avg=3 rows.
-# WHERE is satisfied for 1 row per query, which gives filtered=33.3
-
---echo # See .test file for the right values of r_rows and r_filtered.
-analyze select a, a in (select t0.b from t0 where t0.b+1=t1.b+1) from t1;
-
---echo # Try a subquery that is never executed
-analyze select a, a in (select t0.b from t0 where t0.b+1=t1.b+1) from t1 where t1.a > 5;
-
-drop table t0, t1;
-
---echo #
---echo # Tests for join buffering
---echo #
-create table t0 (a int, b int);
-insert into t0 values
- (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
-create table t1 like t0;
-insert into t1 select * from t0;
-
-explain select * from t0, t1 where t0.a<5 and t1.a<5;
---echo # These should have filtered=50
-analyze select * from t0, t1 where t0.a<5 and t1.a<5;
-
-explain select * from t0, t1 where t0.a<5 and t1.b=t0.b;
---echo # Now, t1 should have filtered=10
-analyze select * from t0, t1 where t0.a<5 and t1.b=t0.b;
-
-explain select * from t0, t1 where t0.a<5 and t1.a<5 and t1.b=t0.b;
---echo # Now, t1 should have filtered=10
-analyze select * from t0, t1 where t0.a<5 and t1.a<5 and t1.b=t0.b;
-
---echo # TODO: Check what is counted for "range checked for each record".
-
---echo #
---echo # Test for joins
---echo #
-create table t2 (key1 int, key2x int, col1 int, key(key1), key(key2x));
-insert into t2 select A.a + 10 *B.a +100 * C.a,
- (A.a + 10 *B.a +100 * C.a)*2,
- A.a + 10 *B.a +100 * C.a
- from t0 A, t0 B, t0 C;
-
---echo # This always has matches, filtered=100%.
-analyze select * from t1,t2 where t2.key1=t1.a;
-
---echo # This shows r_rows=0. It is actually 0.5 (should r_rows be changed to double?)
-analyze select * from t1,t2 where t2.key2x=t1.a;
- select * from t1,t2 where t2.key2x=t1.a;
-
---echo # This has t2.filtered=40% (there are 5 values: {0,1,2,3,4}. two of them have mod=0)
-analyze select * from t1,t2 where t2.key2x=t1.a and mod(t2.col1,4)=0;
-
-drop table t0,t1,t2;
-
---echo #
---echo # Check non-merged derived tables
---echo #
-create table t0 (a int, b int);
-insert into t0 values
- (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
-
-update t0 set b=b/3;
-analyze select * from (select count(*),max(a),b from t0 group by b) T;
-drop table t0;
-
---echo #
---echo # Check ORDER/GROUP BY
---echo #
-create table t0 (a int, b int);
-insert into t0 values
- (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
-
-analyze select count(*),max(a),b from t0 where a<7 group by b;
-drop table t0;
-
---echo #
---echo # Check multi-table UPDATE/DELETE.
---echo #
-create table t0 (a int, b int);
-create table t1 (a int, b int);
-insert into t0 values (0,0),(2,2),(4,4), (8,8);
-insert into t1 values (0,0),(2,2), (6,6);
-
-analyze select * from t0,t1 where t0.a=t1.a;
-
-analyze update t0,t1 set t1.b=5555 where t0.a=t1.a;
-select * from t1;
-
-analyze delete t1 from t1, t0 where t0.a=t1.a;
-select * from t1;
-
-drop table t0, t1;
-
---echo #
---echo # MDEV-6393: ANALYZE SELECT crashes in Explain_query::print_explain with a non-existing column
---echo #
-create table t1 (i int);
-insert into t1 values (1),(2);
---error ER_BAD_FIELD_ERROR
-analyze select a from t1;
-
---error ER_BAD_FIELD_ERROR
-analyze delete from t1 where a=2;
-
---error ER_BAD_FIELD_ERROR
-analyze update t1 set a=2;
-
-create table t2 like t1;
-insert into t2 select * from t1;
-
---error ER_BAD_FIELD_ERROR
-analyze update t2,t1 set t2.i=5 where t2.a=t1.a;
-
---error ER_BAD_FIELD_ERROR
-analyze delete t1 from t2,t1 where t2.a=t1.a;
-
-drop table t1, t2;
---echo #
---echo # MDEV-6395: ANALYZE UPDATE/DELETE with impossible where does not produce any output
---echo #
-create table t1 (a int, b int, key(a));
-insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5);
-
-analyze delete from t1 where 1 > 2;
-analyze delete from t1 where a > 30 and a < 10;
-
-analyze update t1 set b=12345 where 1 > 2;
-analyze update t1 set b=12345 where a > 30 and a < 10;
-
-drop table t1;
---echo #
---echo # MDEV-6398: ANALYZE UPDATE does not populate r_rows
---echo #
-create table t1 (i int);
-insert into t1 values (1),(2),(3),(4);
-analyze update t1 set i=8;
-drop table t1;
-
---echo #
---echo # Check ANALYZE SELECT INTO
---echo #
-create table t1 (i int);
-insert into t1 values (1);
-analyze select * from t1 into @var;
-drop table t1;
-
---echo #
---echo # MDEV-6394: ANALYZE DELETE .. RETURNING fails with ERROR 2027 Malformed packet
---echo #
-create table t1 (i int);
-analyze delete from t1 returning *;
-drop table t1;
-
---echo #
---echo # MDEV-6396: ANALYZE INSERT/REPLACE is accepted, but does not produce a plan
---echo #
-create table t1 (a int primary key, b int);
-analyze insert into t1 values (1,1);
-select * from t1;
-
-analyze replace t1 values (1,2);
-select * from t1;
-drop table t1;
-
---echo #
---echo # MDEV-6400 "ANALYZE SELECT ... INTO @var" doesn't set @var
---echo #
-create table t1(a int);
-insert into t1 values (1),(2);
-
-analyze select a from t1 where a <2 into @var;
---error ER_TOO_MANY_ROWS
-analyze select a from t1 into @var;
-
-analyze insert into t1 select * from t1;
-
-analyze select * into outfile '../../tmp/data1.tmp' from t1;
---remove_file $MYSQLTEST_VARDIR/tmp/data1.tmp
-
-drop table t1;
-
-
---echo #
---echo # MDEV-7024: Assertion `! is_set()' failed in
---echo # Diagnostics_area::set_eof_status on executing ANALYZE SELECT via PS
---echo #
-
-create table t1(a int);
-prepare stmt from "analyze select * from t1";
-execute stmt;
-drop table t1;
-
---echo #
---echo # MDEV-7674: ANALYZE shows r_rows=0
---echo #
-
-create table t1(a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t2 (a int, key(a));
-insert into t2 values (0),(1);
-
-analyze select * from t1 straight_join t2 force index(a) where t2.a=t1.a;
-
-drop table t1,t2;
-
---echo #
---echo # MDEV-8063: Unconditional ANALYZE DELETE does not delete rows
---echo #
-
-create table t1 (i int);
-insert into t1 values (1),(2);
-analyze delete from t1;
-select * from t1;
-
-insert into t1 values (1),(2);
-explain delete from t1;
-select * from t1;
-
-drop table t1;
diff --git a/mysql-test/t/analyze_stmt_orderby.test b/mysql-test/t/analyze_stmt_orderby.test
deleted file mode 100644
index a1cfb58f31a..00000000000
--- a/mysql-test/t/analyze_stmt_orderby.test
+++ /dev/null
@@ -1,177 +0,0 @@
-
---source include/have_innodb.inc
-
-create table t0(a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1(a int);
-insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
-
-create table t2 (
- a int,
- b int,
- key (a)
-);
-
-insert into t2 select A.a*1000 + B.a, A.a*1000 + B.a from t0 A, t1 B;
-
---echo #
---echo # Try an UPDATE that uses filesort:
---echo #
-explain
-update t2 set b=b+1 order by b limit 5;
-explain format=json
-update t2 set b=b+1 order by b limit 5;
---source include/analyze-format.inc
-analyze format=json
-update t2 set b=b+1 order by b limit 5;
-
---echo #
---echo # Try an UPDATE that uses buffering:
---echo #
-explain
-update t2 set a=a+1 where a<10;
-explain format=json
-update t2 set a=a+1 where a<10;
---source include/analyze-format.inc
-analyze format=json
-update t2 set a=a+1 where a<10;
-
---echo #
---echo # Try a DELETE that uses filesort:
---echo #
-explain
-delete from t2 order by b limit 5;
-explain format=json
-delete from t2 order by b limit 5;
---source include/analyze-format.inc
-analyze format=json
-delete from t2 order by b limit 5;
-
---echo #
---echo # Try a SELECT with QEP in form: filesort { tmp_table { join } }
---echo #
-explain
-select * from t0,t2 where t2.a=t0.a order by t2.b limit 4;
-explain format=json
-select * from t0,t2 where t2.a=t0.a order by t2.b limit 4;
---source include/analyze-format.inc
-analyze format=json
-select * from t0,t2 where t2.a=t0.a order by t2.b limit 4;
-
-
---echo #
---echo # Try a SELECT with QEP in form: join { filesort { table0 }, table2 }
---echo #
-explain
-select * from t0,t2 where t2.a=t0.a order by t0.a limit 4;
-explain format=json
-select * from t0,t2 where t2.a=t0.a order by t0.a limit 4;
---source include/analyze-format.inc
-analyze format=json
-select * from t0,t2 where t2.a=t0.a order by t0.a limit 4;
-
-drop table t2;
-
-
-create table t2 (
- a int,
- b int,
- c int
-);
-insert into t2
-select
- a.a+10*b.a+100*c.a,
- b.a+10*c.a,
- c.a
-from t0 a, t0 b, t0 c;
-
---source include/analyze-format.inc
-analyze format=json
-select MAX(b) from t2 where mod(a,2)=0 group by c;
-
-drop table t2;
-
---echo #
---echo # MDEV-8282: crash in filesort() with simple ordered delete
---echo #
-create table t3(a int) engine=innodb;
-delete from t3 order by a;
-
---echo # EXPLAIN thinks it will use delete_all_rows():
-explain
-delete from t3 order by a;
-
---echo # ANALYZE shows that delete_all_rows() didn't work and we deleted rows
---echo # one-by-one:
-analyze
-delete from t3 order by a;
-
-drop table t3;
-
---echo #
---echo # A test for duplicate_removal()
---echo #
-create table t3 (a int, b int);
-insert into t3 select a, 123 from t0;
-
---source include/analyze-format.inc
-analyze format=json
-select distinct max(t3.b) Q from t0, t3 where t0.a=t3.a group by t0.a order by null;
-
-
---echo #
---echo # A query with two filesort calls:
---echo # - first is needed to do group-by-group grouping to calculate COUNT(DISTINCT)
---echo # - the second is need to produce ORDER BY.
---echo # (see MDEV-7836 for description of the query plan)
-
-
-create table t5 (a int , b int) ;
-create table t6 like t5 ;
-create table t7 like t5 ;
-insert into t5 values (0, 100), (1, 2), (1, 3), (2, 2), (2, 7),
- (2, -1), (3, 10);
-insert into t6 values (0, 0), (1, 1), (2, 1), (3, 1), (4, 1);
-insert into t7 values (3, 3), (2, 2), (1, 1);
-
---echo # TODO: This ANALYZE output doesn't make it clear what is used for what.
---source include/analyze-format.inc
-analyze format=json
-select count(distinct t5.b) as sum from t5, t6
- where t5.a=t6.a and t6.b > 0 and t5.a <= 5
- group by t5.a order by sum limit 1;
-
-explain format=json
-select count(distinct t5.b) as sum from t5, t6
- where t5.a=t6.a and t6.b > 0 and t5.a <= 5
- group by t5.a order by sum limit 1;
-drop table t5,t6,t7;
-drop table t3;
-
---echo #
---echo # Tabular ANALYZE must get its data from execution tracker (and not from
---echo # the query plan)
---echo #
-
-CREATE TABLE t2(
- col1 int,
- col2 int,
- UNIQUE INDEX idx (col1, col2)) engine=myisam;
-
-INSERT INTO t2(col1, col2) VALUES
- (1,20),(2,19),(3,18),(4,17),(5,16),(6,15),(7,14),(8,13),(9,12),(10,11),
- (11,10),(12,9),(13,8),(14,7),(15,6),(16,5),(17,4),(18,3),(19,2),(20,1);
-
-flush status;
-explain
-select col1 f1, col2 f2, col1 f3 from t2 group by f1;
-analyze
-select col1 f1, col2 f2, col1 f3 from t2 group by f1;
---source include/analyze-format.inc
-analyze format=json
-select col1 f1, col2 f2, col1 f3 from t2 group by f1;
-drop table t2;
-
-
-drop table t0,t1;
diff --git a/mysql-test/t/analyze_stmt_privileges.test b/mysql-test/t/analyze_stmt_privileges.test
deleted file mode 100644
index 32ff4ddfb7e..00000000000
--- a/mysql-test/t/analyze_stmt_privileges.test
+++ /dev/null
@@ -1,49 +0,0 @@
-# Analyze <statement> privilege checks testcase.
---source include/not_embedded.inc
-
---echo #
---echo # MDEV-7025 and MDEV-7027 ANALYZE SELECT/INSERT/UPDATE/DELETE from a
---echo # view does not check access permissions on the underlying table
---echo #
-create database db;
-use db;
-create table t1 (i int, c varchar(8));
-insert into t1 values (1,'foo'),(2,'bar'),(3,'baz'),(4,'qux');
-create view v1 as select * from t1 where i > 1;
-CREATE USER u1@localhost;
-grant ALL on db.v1 to u1@localhost;
-
---connect (con1,localhost,u1,,)
-
---error ER_TABLEACCESS_DENIED_ERROR
-select * from db.t1;
---error ER_TABLEACCESS_DENIED_ERROR
-explain select * from db.t1;
---error ER_TABLEACCESS_DENIED_ERROR
-analyze select * from db.t1;
-
---sorted_result
-select * from db.v1;
---error ER_VIEW_NO_EXPLAIN
-explain select * from db.v1;
---error ER_VIEW_NO_EXPLAIN
-analyze select * from db.v1;
-
-UPDATE db.v1 SET i = 5;
---error ER_VIEW_NO_EXPLAIN
-explain UPDATE db.v1 SET i = 5;
---error ER_VIEW_NO_EXPLAIN
-analyze UPDATE db.v1 SET i = 5;
-
-DELETE FROM db.v1 WHERE i = 5;
---error ER_VIEW_NO_EXPLAIN
-explain DELETE FROM db.v1 WHERE i = 5;
---error ER_VIEW_NO_EXPLAIN
-analyze DELETE FROM db.v1 WHERE i = 5;
-
-
---disconnect con1
---connection default
-
-drop user u1@localhost;
-drop database db;
diff --git a/mysql-test/t/analyze_stmt_privileges2.test b/mysql-test/t/analyze_stmt_privileges2.test
deleted file mode 100644
index e3274882ba6..00000000000
--- a/mysql-test/t/analyze_stmt_privileges2.test
+++ /dev/null
@@ -1,5402 +0,0 @@
-################################################################################
-# The test ensures that permission checks are applied correctly to
-# ANALYZE INSERT/REPLACE/UPDATE/DELETE/SELECT (I/R/U/D/S further in the test)
-# when it's executed on a table or on a view.
-# ANALYZE <query> should require both permissions needed to execute the <query>,
-# and permissions needed to acquire query plan (to execute EXPLAIN <query>).
-# Thus, additionally execution of the query and EXPLAIN is checked.
-# See MDEV-406, MDEV-6382
-#
-# Disclaimer: the goal of this test is to check permissions for ANALYZE against
-# permissions for the query and EXPLAIN.
-# The expected result for queries and EXPLAINs is mostly empirical.
-# In many cases the current behavior is obscure and questionable,
-# but unless it is obviously wrong, the expected result is adjusted
-# to match it.
-# In cases when the behavior is really wrong, the adjustments
-# come with comments which point at the issues in the bug tracker.
-# Search for 'MDEV' to find all of them.
-################################################################################
-
--- source include/not_embedded.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-set GLOBAL sql_mode="";
-set LOCAL sql_mode="";
-
-CREATE DATABASE privtest_db;
-
-# t1 is the main base table on which we'll perform DML
-# v1 is an "inner" view which selects from the base table
-# v2 is an "outer" view which selects from the inner view
-# t2 is an additional table for queries like INSERT .. SELECT
-# and multi-table UPDATEs/DELETEs
-
-CREATE TABLE privtest_db.t1 (a INT, b VARCHAR(3)) ENGINE=MyISAM;
-CREATE TABLE privtest_db.t2 (a INT, b VARCHAR(3)) ENGINE=MyISAM;
-CREATE VIEW privtest_db.v1 AS SELECT a, b FROM privtest_db.t1 WHERE b IS NOT NULL;
-CREATE VIEW privtest_db.v2 AS SELECT * FROM privtest_db.v1 WHERE a > 0;
-
-INSERT INTO privtest_db.t2 VALUES (1,'foo'), (2,'bar'), (3,'qux');
-
-GRANT SELECT ON privtest_db.t2 TO 'privtest'@'localhost';
-
-connect(con1,localhost,privtest,,privtest_db);
-
---echo
---echo #########################################################################
---echo # Underlying table permission tests
---echo # (we modify permissions on the base table, keeping ALL on views)
---echo #########################################################################
---echo
-
-connection default;
-GRANT ALL ON privtest_db.v1 TO 'privtest'@'localhost';
-GRANT ALL ON privtest_db.v2 TO 'privtest'@'localhost';
-connection con1;
-
---echo
---echo #========================================================================
---echo # Test: No permissions on the table
---echo #========================================================================
---echo
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the table
---echo # Expectation: Cannot run query, EXPLAIN, ANALYZE on the table
---echo # because the query itself cannot be executed
---echo #------------------------------------------------------------------------
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO t1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO t1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO t1 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO t1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO t1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO t1 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO t1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO t1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO t1 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO t1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO t1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO t1 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE t1 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE t1 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE t1 SET a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE t1 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE t1 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE t1 SET a = a + 1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM t1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM t1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM t1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM t1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM t1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM t1 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM t1 USING t1, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM t1 USING t1, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM t1 USING t1, t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM t1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM t1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM t1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM t1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM t1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM t1 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 );
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the inner view
---echo # Expectation: Can run the queries, but not EXPLAIN or ANALYZE
---echo # because the query plan cannot be shown
---echo # (it would have revealed the structure of the table)
---echo #------------------------------------------------------------------------
-
-INSERT INTO v1 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v1 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v1 (a) VALUES (10);
-
-INSERT INTO v1 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v1 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v1 SELECT * FROM t2;
-
-REPLACE INTO v1 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v1 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v1 (a) VALUES (10);
-
-REPLACE INTO v1 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v1 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v1 SELECT * FROM t2;
-
-UPDATE v1 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v1 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v1 SET a = 10;
-
-UPDATE v1 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v1 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v1 SET a = a + 1;
-
-UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
-
-DELETE FROM v1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v1;
-
-DELETE FROM v1 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v1 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v1 WHERE a = 10;
-
-DELETE FROM v1 USING v1, t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v1 USING v1, t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v1 USING v1, t2;
-
-DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
-
-SELECT * FROM v1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v1;
-
-SELECT * FROM v1 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v1 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v1 WHERE a = 10;
-
-SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the outer view
---echo # Expectation: Can run the queries, but not EXPLAIN or ANALYZE
---echo # because the query plan cannot be shown
---echo # (it would have revealed the structure of the table)
---echo #------------------------------------------------------------------------
-
-
-INSERT INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v2 (a) VALUES (10);
-
-INSERT INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v2 SELECT * FROM t2;
-
-REPLACE INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v2 (a) VALUES (10);
-
-REPLACE INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v2 SELECT * FROM t2;
-
-UPDATE v2 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2 SET a = 10;
-
-UPDATE v2 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2 SET a = a + 1;
-
-UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-
-DELETE FROM v2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2;
-
-DELETE FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 WHERE a = 10;
-
-DELETE FROM v2 USING v2, t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 USING v2, t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 USING v2, t2;
-
-DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-
-SELECT * FROM v2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2;
-
-SELECT * FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2 WHERE a = 10;
-
-SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-
---echo
---echo #========================================================================
---echo # Test: Grant SELECT on the table
---echo #========================================================================
---echo
-
-connection default;
-GRANT SELECT ON privtest_db.t1 TO 'privtest'@'localhost';
-connection con1;
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the table
---echo # Expectation: Can only run SELECT, EXPLAIN SELECT, ANALYZE SELECT
---echo #------------------------------------------------------------------------
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO t1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO t1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO t1 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO t1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO t1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO t1 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO t1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO t1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO t1 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO t1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO t1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO t1 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE t1 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE t1 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE t1 SET a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE t1 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE t1 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE t1 SET a = a + 1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM t1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM t1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM t1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM t1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM t1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM t1 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM t1 USING t1, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM t1 USING t1, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM t1 USING t1, t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
-
-SELECT * FROM t1;
-EXPLAIN SELECT * FROM t1;
-ANALYZE SELECT * FROM t1;
-
-SELECT * FROM t1 WHERE a = 10;
-EXPLAIN SELECT * FROM t1 WHERE a = 10;
-ANALYZE SELECT * FROM t1 WHERE a = 10;
-
-SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 );
-EXPLAIN SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 );
-ANALYZE SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the inner view
---echo # Expectation: Can run everything
---echo #------------------------------------------------------------------------
-
-INSERT INTO v1 (a) VALUES (10);
-EXPLAIN INSERT INTO v1 (a) VALUES (10);
-ANALYZE INSERT INTO v1 (a) VALUES (10);
-
-INSERT INTO v1 SELECT * FROM t2;
-EXPLAIN INSERT INTO v1 SELECT * FROM t2;
-ANALYZE INSERT INTO v1 SELECT * FROM t2;
-
-REPLACE INTO v1 (a) VALUES (10);
-EXPLAIN REPLACE INTO v1 (a) VALUES (10);
-ANALYZE REPLACE INTO v1 (a) VALUES (10);
-
-REPLACE INTO v1 SELECT * FROM t2;
-EXPLAIN REPLACE INTO v1 SELECT * FROM t2;
-ANALYZE REPLACE INTO v1 SELECT * FROM t2;
-
-UPDATE v1 SET a = 10;
-EXPLAIN UPDATE v1 SET a = 10;
-ANALYZE UPDATE v1 SET a = 10;
-
-UPDATE v1 SET a = a + 1;
-EXPLAIN UPDATE v1 SET a = a + 1;
-ANALYZE UPDATE v1 SET a = a + 1;
-
-UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
-EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
-ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
-
-DELETE FROM v1;
-EXPLAIN DELETE FROM v1;
-ANALYZE DELETE FROM v1;
-
-DELETE FROM v1 WHERE a = 10;
-EXPLAIN DELETE FROM v1 WHERE a = 10;
-ANALYZE DELETE FROM v1 WHERE a = 10;
-
-DELETE FROM v1 USING v1, t2;
-EXPLAIN DELETE FROM v1 USING v1, t2;
-ANALYZE DELETE FROM v1 USING v1, t2;
-
-DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
-EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
-ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
-
-SELECT * FROM v1;
-EXPLAIN SELECT * FROM v1;
-ANALYZE SELECT * FROM v1;
-
-SELECT * FROM v1 WHERE a = 10;
-EXPLAIN SELECT * FROM v1 WHERE a = 10;
-ANALYZE SELECT * FROM v1 WHERE a = 10;
-
-SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
-EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
-ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the outer view
---echo # Expectation: Can run everything
---echo #------------------------------------------------------------------------
-
-INSERT INTO v2 (a) VALUES (10);
-EXPLAIN INSERT INTO v2 (a) VALUES (10);
-ANALYZE INSERT INTO v2 (a) VALUES (10);
-
-INSERT INTO v2 SELECT * FROM t2;
-EXPLAIN INSERT INTO v2 SELECT * FROM t2;
-ANALYZE INSERT INTO v2 SELECT * FROM t2;
-
-REPLACE INTO v2 (a) VALUES (10);
-EXPLAIN REPLACE INTO v2 (a) VALUES (10);
-ANALYZE REPLACE INTO v2 (a) VALUES (10);
-
-REPLACE INTO v2 SELECT * FROM t2;
-EXPLAIN REPLACE INTO v2 SELECT * FROM t2;
-ANALYZE REPLACE INTO v2 SELECT * FROM t2;
-
-UPDATE v2 SET a = 10;
-EXPLAIN UPDATE v2 SET a = 10;
-ANALYZE UPDATE v2 SET a = 10;
-
-UPDATE v2 SET a = a + 1;
-EXPLAIN UPDATE v2 SET a = a + 1;
-ANALYZE UPDATE v2 SET a = a + 1;
-
-UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-
-DELETE FROM v2;
-EXPLAIN DELETE FROM v2;
-ANALYZE DELETE FROM v2;
-
-DELETE FROM v2 WHERE a = 10;
-EXPLAIN DELETE FROM v2 WHERE a = 10;
-ANALYZE DELETE FROM v2 WHERE a = 10;
-
-DELETE FROM v2 USING v2, t2;
-# Commented due to MDEV-7034 (assertion failure)
-# EXPLAIN DELETE FROM v2 USING v2, t2;
-ANALYZE DELETE FROM v2 USING v2, t2;
-
-DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-# Commented due to MDEV-7034 (assertion failure)
-# EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-
-SELECT * FROM v2;
-EXPLAIN SELECT * FROM v2;
-ANALYZE SELECT * FROM v2;
-
-SELECT * FROM v2 WHERE a = 10;
-EXPLAIN SELECT * FROM v2 WHERE a = 10;
-ANALYZE SELECT * FROM v2 WHERE a = 10;
-
-SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-
---echo
---echo #========================================================================
---echo # Test: Grant INSERT on the table
---echo #========================================================================
---echo
-
-connection default;
-REVOKE ALL PRIVILEGES ON privtest_db.t1 FROM 'privtest'@'localhost';
-GRANT INSERT ON privtest_db.t1 TO 'privtest'@'localhost';
-connection con1;
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the table
---echo # Expectation: Can only run INSERT, EXPLAIN INSERT, ANALYZE INSERT
---echo #------------------------------------------------------------------------
-
-INSERT INTO t1 (a) VALUES (10);
-EXPLAIN INSERT INTO t1 (a) VALUES (10);
-ANALYZE INSERT INTO t1 (a) VALUES (10);
-
-INSERT INTO t1 SELECT * FROM t2;
-EXPLAIN INSERT INTO t1 SELECT * FROM t2;
-ANALYZE INSERT INTO t1 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO t1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO t1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO t1 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO t1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO t1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO t1 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE t1 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE t1 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE t1 SET a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE t1 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE t1 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE t1 SET a = a + 1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM t1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM t1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM t1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM t1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM t1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM t1 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM t1 USING t1, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM t1 USING t1, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM t1 USING t1, t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM t1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM t1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM t1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM t1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM t1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM t1 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 );
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the inner view
---echo # Expectation: Can run the queries, but not EXPLAIN or ANALYZE
---echo # because the query plan cannot be shown
---echo # (it would have revealed the structure of the table)
---echo #------------------------------------------------------------------------
-
-INSERT INTO v1 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v1 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v1 (a) VALUES (10);
-
-INSERT INTO v1 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v1 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v1 SELECT * FROM t2;
-
-REPLACE INTO v1 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v1 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v1 (a) VALUES (10);
-
-REPLACE INTO v1 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v1 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v1 SELECT * FROM t2;
-
-UPDATE v1 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v1 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v1 SET a = 10;
-
-UPDATE v1 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v1 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v1 SET a = a + 1;
-
-UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
-
-DELETE FROM v1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v1;
-
-DELETE FROM v1 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v1 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v1 WHERE a = 10;
-
-DELETE FROM v1 USING v1, t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v1 USING v1, t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v1 USING v1, t2;
-
-DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
-
-SELECT * FROM v1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v1;
-
-SELECT * FROM v1 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v1 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v1 WHERE a = 10;
-
-SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the outer view
---echo # Expectation: Can run the queries, but not EXPLAIN or ANALYZE
---echo # because the query plan cannot be shown
---echo # (it would have revealed the structure of the table)
---echo #------------------------------------------------------------------------
-
-
-INSERT INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v2 (a) VALUES (10);
-
-INSERT INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v2 SELECT * FROM t2;
-
-REPLACE INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v2 (a) VALUES (10);
-
-REPLACE INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v2 SELECT * FROM t2;
-
-UPDATE v2 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2 SET a = 10;
-
-UPDATE v2 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2 SET a = a + 1;
-
-UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-
-DELETE FROM v2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2;
-
-DELETE FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 WHERE a = 10;
-
-DELETE FROM v2 USING v2, t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 USING v2, t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 USING v2, t2;
-
-DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-
-SELECT * FROM v2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2;
-
-SELECT * FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2 WHERE a = 10;
-
-SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo
---echo #========================================================================
---echo # Test: Grant UPDATE on the table
---echo #========================================================================
---echo
-
-connection default;
-REVOKE ALL PRIVILEGES ON privtest_db.t1 FROM 'privtest'@'localhost';
-GRANT UPDATE ON privtest_db.t1 TO 'privtest'@'localhost';
-connection con1;
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the table
---echo # Expectation: Can only run UPDATE, EXPLAIN UPDATE, ANALYZE UPDATE
---echo # when the UPDATE does not read any columns. UPDATEs which
---echo # read columns fail with ER_COLUMNACCESS_DENIED_ERROR
---echo #------------------------------------------------------------------------
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO t1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO t1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO t1 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO t1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO t1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO t1 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO t1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO t1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO t1 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO t1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO t1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO t1 SELECT * FROM t2;
-
-UPDATE t1 SET a = 10;
-EXPLAIN UPDATE t1 SET a = 10;
-ANALYZE UPDATE t1 SET a = 10;
-
---error ER_COLUMNACCESS_DENIED_ERROR
-UPDATE t1 SET a = a + 1;
---error ER_COLUMNACCESS_DENIED_ERROR
-EXPLAIN UPDATE t1 SET a = a + 1;
---error ER_COLUMNACCESS_DENIED_ERROR
-ANALYZE UPDATE t1 SET a = a + 1;
-
---error ER_COLUMNACCESS_DENIED_ERROR
-UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
---error ER_COLUMNACCESS_DENIED_ERROR
-EXPLAIN UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
---error ER_COLUMNACCESS_DENIED_ERROR
-ANALYZE UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM t1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM t1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM t1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM t1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM t1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM t1 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM t1 USING t1, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM t1 USING t1, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM t1 USING t1, t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM t1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM t1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM t1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM t1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM t1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM t1 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 );
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the inner view
---echo # Expectation: Can run the queries, but not EXPLAIN or ANALYZE
---echo # because the query plan cannot be shown
---echo # (it would have revealed the structure of the table)
---echo #------------------------------------------------------------------------
-
-INSERT INTO v1 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v1 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v1 (a) VALUES (10);
-
-INSERT INTO v1 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v1 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v1 SELECT * FROM t2;
-
-REPLACE INTO v1 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v1 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v1 (a) VALUES (10);
-
-REPLACE INTO v1 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v1 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v1 SELECT * FROM t2;
-
-UPDATE v1 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v1 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v1 SET a = 10;
-
-UPDATE v1 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v1 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v1 SET a = a + 1;
-
-UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
-
-DELETE FROM v1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v1;
-
-DELETE FROM v1 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v1 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v1 WHERE a = 10;
-
-DELETE FROM v1 USING v1, t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v1 USING v1, t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v1 USING v1, t2;
-
-DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
-
-SELECT * FROM v1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v1;
-
-SELECT * FROM v1 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v1 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v1 WHERE a = 10;
-
-SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the outer view
---echo # Expectation: Can run the queries, but not EXPLAIN or ANALYZE
---echo # because the query plan cannot be shown
---echo # (it would have revealed the structure of the table)
---echo #------------------------------------------------------------------------
-
-
-INSERT INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v2 (a) VALUES (10);
-
-INSERT INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v2 SELECT * FROM t2;
-
-REPLACE INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v2 (a) VALUES (10);
-
-REPLACE INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v2 SELECT * FROM t2;
-
-UPDATE v2 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2 SET a = 10;
-
-UPDATE v2 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2 SET a = a + 1;
-
-UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-
-DELETE FROM v2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2;
-
-DELETE FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 WHERE a = 10;
-
-DELETE FROM v2 USING v2, t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 USING v2, t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 USING v2, t2;
-
-DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-
-SELECT * FROM v2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2;
-
-SELECT * FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2 WHERE a = 10;
-
-SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo
---echo #========================================================================
---echo # Test: Grant DELETE on the table
---echo #========================================================================
---echo
-
-connection default;
-REVOKE ALL PRIVILEGES ON privtest_db.t1 FROM 'privtest'@'localhost';
-GRANT DELETE ON privtest_db.t1 TO 'privtest'@'localhost';
-connection con1;
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the table
---echo # Expectation: Can only run DELETE, EXPLAIN DELETE, ANALYZE DELETE
---echo # when the DELETE does not read any columns. DELETEs which
---echo # read columns fail with ER_COLUMNACCESS_DENIED_ERROR
---echo #------------------------------------------------------------------------
---echo # Note: ANALYZE DELETE FROM t1 USING t1, t2 ... fails due to MDEV-7043
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO t1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO t1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO t1 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO t1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO t1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO t1 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO t1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO t1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO t1 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO t1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO t1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO t1 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE t1 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE t1 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE t1 SET a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE t1 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE t1 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE t1 SET a = a + 1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
-
-DELETE FROM t1;
-EXPLAIN DELETE FROM t1;
-ANALYZE DELETE FROM t1;
-
---error ER_COLUMNACCESS_DENIED_ERROR
-DELETE FROM t1 WHERE a = 10;
---error ER_COLUMNACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM t1 WHERE a = 10;
---error ER_COLUMNACCESS_DENIED_ERROR
-ANALYZE DELETE FROM t1 WHERE a = 10;
-
-# Unexpected errors due to MDEV-7043 (expected all three to succeed)
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM t1 USING t1, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM t1 USING t1, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM t1 USING t1, t2;
-
-# Unexpected error code due to MDEV-7043
-#--error ER_COLUMNACCESS_DENIED_ERROR
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM t1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM t1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM t1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM t1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM t1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM t1 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 );
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the inner view
---echo # Expectation: Can run the queries, but not EXPLAIN or ANALYZE
---echo # because the query plan cannot be shown
---echo # (it would have revealed the structure of the table)
---echo #------------------------------------------------------------------------
-
-
-INSERT INTO v1 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v1 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v1 (a) VALUES (10);
-
-INSERT INTO v1 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v1 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v1 SELECT * FROM t2;
-
-REPLACE INTO v1 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v1 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v1 (a) VALUES (10);
-
-REPLACE INTO v1 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v1 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v1 SELECT * FROM t2;
-
-UPDATE v1 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v1 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v1 SET a = 10;
-
-UPDATE v1 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v1 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v1 SET a = a + 1;
-
-UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
-
-DELETE FROM v1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v1;
-
-DELETE FROM v1 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v1 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v1 WHERE a = 10;
-
-DELETE FROM v1 USING v1, t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v1 USING v1, t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v1 USING v1, t2;
-
-DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
-
-SELECT * FROM v1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v1;
-
-SELECT * FROM v1 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v1 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v1 WHERE a = 10;
-
-SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the outer view
---echo # Expectation: Can run the queries, but not EXPLAIN or ANALYZE
---echo # because the query plan cannot be shown
---echo # (it would have revealed the structure of the table)
---echo #------------------------------------------------------------------------
-
-
-INSERT INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v2 (a) VALUES (10);
-
-INSERT INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v2 SELECT * FROM t2;
-
-REPLACE INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v2 (a) VALUES (10);
-
-REPLACE INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v2 SELECT * FROM t2;
-
-UPDATE v2 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2 SET a = 10;
-
-UPDATE v2 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2 SET a = a + 1;
-
-UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-
-DELETE FROM v2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2;
-
-DELETE FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 WHERE a = 10;
-
-DELETE FROM v2 USING v2, t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 USING v2, t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 USING v2, t2;
-
-DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-
-SELECT * FROM v2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2;
-
-SELECT * FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2 WHERE a = 10;
-
-SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo
---echo #========================================================================
---echo # Test: Grant DELETE, SELECT(a) on the table
---echo #========================================================================
---echo
-
-connection default;
-REVOKE ALL PRIVILEGES ON privtest_db.t1 FROM 'privtest'@'localhost';
-GRANT SELECT(a), DELETE ON privtest_db.t1 TO 'privtest'@'localhost';
-connection con1;
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the table
---echo # Expectation: Can run DELETE, EXPLAIN DELETE, ANALYZE DELETE
---echo #------------------------------------------------------------------------
-
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO t1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO t1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO t1 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO t1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO t1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO t1 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO t1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO t1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO t1 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO t1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO t1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO t1 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE t1 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE t1 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE t1 SET a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE t1 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE t1 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE t1 SET a = a + 1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
-
-DELETE FROM t1;
-EXPLAIN DELETE FROM t1;
-ANALYZE DELETE FROM t1;
-
-DELETE FROM t1 WHERE a = 10;
-EXPLAIN DELETE FROM t1 WHERE a = 10;
-ANALYZE DELETE FROM t1 WHERE a = 10;
-
-DELETE FROM t1 USING t1, t2;
-EXPLAIN DELETE FROM t1 USING t1, t2;
-ANALYZE DELETE FROM t1 USING t1, t2;
-
-DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
-EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
-ANALYZE DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM t1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM t1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM t1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM t1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM t1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM t1 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 );
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the inner view
---echo # Expectation: Can run everything: SELECT access to the column `a`
---echo # in the underlying table is enough to show EXPLAIN
---echo # (that's how it works now)
---echo #------------------------------------------------------------------------
-
-
-INSERT INTO v1 (a) VALUES (10);
-EXPLAIN INSERT INTO v1 (a) VALUES (10);
-ANALYZE INSERT INTO v1 (a) VALUES (10);
-
-INSERT INTO v1 SELECT * FROM t2;
-EXPLAIN INSERT INTO v1 SELECT * FROM t2;
-ANALYZE INSERT INTO v1 SELECT * FROM t2;
-
-REPLACE INTO v1 (a) VALUES (10);
-EXPLAIN REPLACE INTO v1 (a) VALUES (10);
-ANALYZE REPLACE INTO v1 (a) VALUES (10);
-
-REPLACE INTO v1 SELECT * FROM t2;
-EXPLAIN REPLACE INTO v1 SELECT * FROM t2;
-ANALYZE REPLACE INTO v1 SELECT * FROM t2;
-
-UPDATE v1 SET a = 10;
-EXPLAIN UPDATE v1 SET a = 10;
-ANALYZE UPDATE v1 SET a = 10;
-
-UPDATE v1 SET a = a + 1;
-EXPLAIN UPDATE v1 SET a = a + 1;
-ANALYZE UPDATE v1 SET a = a + 1;
-
-UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
-EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
-ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
-
-DELETE FROM v1;
-EXPLAIN DELETE FROM v1;
-ANALYZE DELETE FROM v1;
-
-DELETE FROM v1 WHERE a = 10;
-EXPLAIN DELETE FROM v1 WHERE a = 10;
-ANALYZE DELETE FROM v1 WHERE a = 10;
-
-DELETE FROM v1 USING v1, t2;
-EXPLAIN DELETE FROM v1 USING v1, t2;
-ANALYZE DELETE FROM v1 USING v1, t2;
-
-DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
-EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
-ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
-
-SELECT * FROM v1;
-EXPLAIN SELECT * FROM v1;
-ANALYZE SELECT * FROM v1;
-
-SELECT * FROM v1 WHERE a = 10;
-EXPLAIN SELECT * FROM v1 WHERE a = 10;
-ANALYZE SELECT * FROM v1 WHERE a = 10;
-
-SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
-EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
-ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the outer view
---echo # Expectation: Can run everything: SELECT access to the column `a`
---echo # in the underlying table is enough to show EXPLAIN
---echo # (that's how it works now)
---echo #------------------------------------------------------------------------
-
-
-INSERT INTO v2 (a) VALUES (10);
-EXPLAIN INSERT INTO v2 (a) VALUES (10);
-ANALYZE INSERT INTO v2 (a) VALUES (10);
-
-INSERT INTO v2 SELECT * FROM t2;
-EXPLAIN INSERT INTO v2 SELECT * FROM t2;
-ANALYZE INSERT INTO v2 SELECT * FROM t2;
-
-REPLACE INTO v2 (a) VALUES (10);
-EXPLAIN REPLACE INTO v2 (a) VALUES (10);
-ANALYZE REPLACE INTO v2 (a) VALUES (10);
-
-REPLACE INTO v2 SELECT * FROM t2;
-EXPLAIN REPLACE INTO v2 SELECT * FROM t2;
-ANALYZE REPLACE INTO v2 SELECT * FROM t2;
-
-UPDATE v2 SET a = 10;
-EXPLAIN UPDATE v2 SET a = 10;
-ANALYZE UPDATE v2 SET a = 10;
-
-UPDATE v2 SET a = a + 1;
-EXPLAIN UPDATE v2 SET a = a + 1;
-ANALYZE UPDATE v2 SET a = a + 1;
-
-UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-
-DELETE FROM v2;
-EXPLAIN DELETE FROM v2;
-ANALYZE DELETE FROM v2;
-
-DELETE FROM v2 WHERE a = 10;
-EXPLAIN DELETE FROM v2 WHERE a = 10;
-ANALYZE DELETE FROM v2 WHERE a = 10;
-
-DELETE FROM v2 USING v2, t2;
-EXPLAIN DELETE FROM v2 USING v2, t2;
-ANALYZE DELETE FROM v2 USING v2, t2;
-
-DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-
-SELECT * FROM v2;
-EXPLAIN SELECT * FROM v2;
-ANALYZE SELECT * FROM v2;
-
-SELECT * FROM v2 WHERE a = 10;
-EXPLAIN SELECT * FROM v2 WHERE a = 10;
-ANALYZE SELECT * FROM v2 WHERE a = 10;
-
-SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-
---echo
---echo #========================================================================
---echo # Test: Grant SELECT, INSERT, UPDATE, DELETE on the table
---echo #========================================================================
---echo
-
-
-connection default;
-REVOKE ALL PRIVILEGES ON privtest_db.t1 FROM 'privtest'@'localhost';
-GRANT SELECT, INSERT, UPDATE, DELETE ON privtest_db.t1 TO 'privtest'@'localhost';
-connection con1;
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the table
---echo # Expectation: Can run everything
---echo #------------------------------------------------------------------------
-
-INSERT INTO t1 (a) VALUES (10);
-EXPLAIN INSERT INTO t1 (a) VALUES (10);
-ANALYZE INSERT INTO t1 (a) VALUES (10);
-
-INSERT INTO t1 SELECT * FROM t2;
-EXPLAIN INSERT INTO t1 SELECT * FROM t2;
-ANALYZE INSERT INTO t1 SELECT * FROM t2;
-
-REPLACE INTO t1 (a) VALUES (10);
-EXPLAIN REPLACE INTO t1 (a) VALUES (10);
-ANALYZE REPLACE INTO t1 (a) VALUES (10);
-
-REPLACE INTO t1 SELECT * FROM t2;
-EXPLAIN REPLACE INTO t1 SELECT * FROM t2;
-ANALYZE REPLACE INTO t1 SELECT * FROM t2;
-
-UPDATE t1 SET a = 10;
-EXPLAIN UPDATE t1 SET a = 10;
-ANALYZE UPDATE t1 SET a = 10;
-
-UPDATE t1 SET a = a + 1;
-EXPLAIN UPDATE t1 SET a = a + 1;
-ANALYZE UPDATE t1 SET a = a + 1;
-
-UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
-EXPLAIN UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
-ANALYZE UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
-
-DELETE FROM t1;
-EXPLAIN DELETE FROM t1;
-ANALYZE DELETE FROM t1;
-
-DELETE FROM t1 WHERE a = 10;
-EXPLAIN DELETE FROM t1 WHERE a = 10;
-ANALYZE DELETE FROM t1 WHERE a = 10;
-
-DELETE FROM t1 USING t1, t2;
-EXPLAIN DELETE FROM t1 USING t1, t2;
-ANALYZE DELETE FROM t1 USING t1, t2;
-
-DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
-EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
-ANALYZE DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
-
-SELECT * FROM t1;
-EXPLAIN SELECT * FROM t1;
-ANALYZE SELECT * FROM t1;
-
-SELECT * FROM t1 WHERE a = 10;
-EXPLAIN SELECT * FROM t1 WHERE a = 10;
-ANALYZE SELECT * FROM t1 WHERE a = 10;
-
-SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 );
-EXPLAIN SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 );
-ANALYZE SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the inner view
---echo # Expectation: Can run everything
---echo #------------------------------------------------------------------------
-
-INSERT INTO v1 (a) VALUES (10);
-EXPLAIN INSERT INTO v1 (a) VALUES (10);
-ANALYZE INSERT INTO v1 (a) VALUES (10);
-
-INSERT INTO v1 SELECT * FROM t2;
-EXPLAIN INSERT INTO v1 SELECT * FROM t2;
-ANALYZE INSERT INTO v1 SELECT * FROM t2;
-
-REPLACE INTO v1 (a) VALUES (10);
-EXPLAIN REPLACE INTO v1 (a) VALUES (10);
-ANALYZE REPLACE INTO v1 (a) VALUES (10);
-
-REPLACE INTO v1 SELECT * FROM t2;
-EXPLAIN REPLACE INTO v1 SELECT * FROM t2;
-ANALYZE REPLACE INTO v1 SELECT * FROM t2;
-
-UPDATE v1 SET a = 10;
-EXPLAIN UPDATE v1 SET a = 10;
-ANALYZE UPDATE v1 SET a = 10;
-
-UPDATE v1 SET a = a + 1;
-EXPLAIN UPDATE v1 SET a = a + 1;
-ANALYZE UPDATE v1 SET a = a + 1;
-
-UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
-EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
-ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
-
-DELETE FROM v1;
-EXPLAIN DELETE FROM v1;
-ANALYZE DELETE FROM v1;
-
-DELETE FROM v1 WHERE a = 10;
-EXPLAIN DELETE FROM v1 WHERE a = 10;
-ANALYZE DELETE FROM v1 WHERE a = 10;
-
-DELETE FROM v1 USING v1, t2;
-EXPLAIN DELETE FROM v1 USING v1, t2;
-ANALYZE DELETE FROM v1 USING v1, t2;
-
-DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
-EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
-ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
-
-SELECT * FROM v1;
-EXPLAIN SELECT * FROM v1;
-ANALYZE SELECT * FROM v1;
-
-SELECT * FROM v1 WHERE a = 10;
-EXPLAIN SELECT * FROM v1 WHERE a = 10;
-ANALYZE SELECT * FROM v1 WHERE a = 10;
-
-SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
-EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
-ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the outer view
---echo # Expectation: Can run everything
---echo #------------------------------------------------------------------------
---echo # Note: some queries are commented due to MDEV-7034
-
-INSERT INTO v2 (a) VALUES (10);
-EXPLAIN INSERT INTO v2 (a) VALUES (10);
-ANALYZE INSERT INTO v2 (a) VALUES (10);
-
-INSERT INTO v2 SELECT * FROM t2;
-EXPLAIN INSERT INTO v2 SELECT * FROM t2;
-ANALYZE INSERT INTO v2 SELECT * FROM t2;
-
-REPLACE INTO v2 (a) VALUES (10);
-EXPLAIN REPLACE INTO v2 (a) VALUES (10);
-ANALYZE REPLACE INTO v2 (a) VALUES (10);
-
-REPLACE INTO v2 SELECT * FROM t2;
-EXPLAIN REPLACE INTO v2 SELECT * FROM t2;
-ANALYZE REPLACE INTO v2 SELECT * FROM t2;
-
-UPDATE v2 SET a = 10;
-EXPLAIN UPDATE v2 SET a = 10;
-ANALYZE UPDATE v2 SET a = 10;
-
-UPDATE v2 SET a = a + 1;
-EXPLAIN UPDATE v2 SET a = a + 1;
-ANALYZE UPDATE v2 SET a = a + 1;
-
-UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-
-DELETE FROM v2;
-EXPLAIN DELETE FROM v2;
-ANALYZE DELETE FROM v2;
-
-DELETE FROM v2 WHERE a = 10;
-EXPLAIN DELETE FROM v2 WHERE a = 10;
-ANALYZE DELETE FROM v2 WHERE a = 10;
-
-DELETE FROM v2 USING v2, t2;
-# Commented due to MDEV-7034
-# EXPLAIN DELETE FROM v2 USING v2, t2;
-ANALYZE DELETE FROM v2 USING v2, t2;
-
-DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-# Commented due to MDEV-7034
-# EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-
-SELECT * FROM v2;
-EXPLAIN SELECT * FROM v2;
-ANALYZE SELECT * FROM v2;
-
-SELECT * FROM v2 WHERE a = 10;
-EXPLAIN SELECT * FROM v2 WHERE a = 10;
-ANALYZE SELECT * FROM v2 WHERE a = 10;
-
-SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo
---echo #########################################################################
---echo # Inner view permission tests
---echo # (we modify permissions on the inner view, keeping ALL the rest)
---echo #########################################################################
---echo
-
-
---echo
---echo #========================================================================
---echo # Test: No permissions on the inner view
---echo #========================================================================
---echo
-
-connection default;
-GRANT ALL ON privtest_db.t1 TO 'privtest'@'localhost';
-GRANT ALL ON privtest_db.v2 TO 'privtest'@'localhost';
-REVOKE ALL PRIVILEGES ON privtest_db.v1 FROM 'privtest'@'localhost';
-connection con1;
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the inner view
---echo # Expectation: Cannot run anything
---echo #------------------------------------------------------------------------
-
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v1 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v1 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v1 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v1 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v1 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v1 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v1 SET a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v1 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v1 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v1 SET a = a + 1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1 USING v1, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1 USING v1, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1 USING v1, t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v1 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the outer view
---echo # Expectation: Can run the queries, but not EXPLAIN or ANALYZE
---echo # because the query plan cannot be shown
---echo # (it could have revealed the structure of the inner view)
---echo #------------------------------------------------------------------------
-
-
-INSERT INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v2 (a) VALUES (10);
-
-INSERT INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v2 SELECT * FROM t2;
-
-REPLACE INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v2 (a) VALUES (10);
-
-REPLACE INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v2 SELECT * FROM t2;
-
-UPDATE v2 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2 SET a = 10;
-
-UPDATE v2 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2 SET a = a + 1;
-
-UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-
-DELETE FROM v2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2;
-
-DELETE FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 WHERE a = 10;
-
-DELETE FROM v2 USING v2, t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 USING v2, t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 USING v2, t2;
-
-DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-
-SELECT * FROM v2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2;
-
-SELECT * FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2 WHERE a = 10;
-
-SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo
---echo #========================================================================
---echo # Test: Grant SHOW VIEW on the inner view
---echo #========================================================================
---echo
-
-connection default;
-GRANT SHOW VIEW ON privtest_db.v1 TO 'privtest'@'localhost';
-connection con1;
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the inner view
---echo # Expectation: Cannot run anything
---echo #------------------------------------------------------------------------
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v1 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v1 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v1 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v1 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v1 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v1 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v1 SET a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v1 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v1 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v1 SET a = a + 1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1 USING v1, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1 USING v1, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1 USING v1, t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v1 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the outer view
---echo # Expectation: Can run the queries, but not EXPLAIN or ANALYZE
---echo # because the query plan cannot be shown
---echo # (that's how it works now)
---echo #------------------------------------------------------------------------
-
-
-INSERT INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v2 (a) VALUES (10);
-
-INSERT INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v2 SELECT * FROM t2;
-
-REPLACE INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v2 (a) VALUES (10);
-
-REPLACE INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v2 SELECT * FROM t2;
-
-UPDATE v2 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2 SET a = 10;
-
-UPDATE v2 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2 SET a = a + 1;
-
-UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-
-DELETE FROM v2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2;
-
-DELETE FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 WHERE a = 10;
-
-DELETE FROM v2 USING v2, t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 USING v2, t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 USING v2, t2;
-
-DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-
-SELECT * FROM v2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2;
-
-SELECT * FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2 WHERE a = 10;
-
-SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo
---echo #========================================================================
---echo # Test: Grant SELECT on the inner view
---echo #========================================================================
---echo
-
-connection default;
-REVOKE ALL PRIVILEGES ON privtest_db.v1 FROM 'privtest'@'localhost';
-GRANT SELECT ON privtest_db.v1 TO 'privtest'@'localhost';
-connection con1;
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the inner view
---echo # Expectation: Can run SELECT, but not EXPLAIN SELECT or ANALYZE SELECT
---echo # because the query plan cannot be shown
---echo # (it could have revealed the structure of the view)
---echo #------------------------------------------------------------------------
-
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v1 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v1 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v1 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v1 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v1 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v1 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v1 SET a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v1 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v1 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v1 SET a = a + 1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
-# Strange error code due to MDEV-7033
-# --error ER_TABLEACCESS_DENIED_ERROR
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1 USING v1, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1 USING v1, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1 USING v1, t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
-
-SELECT * FROM v1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v1;
-
-SELECT * FROM v1 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v1 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v1 WHERE a = 10;
-
-SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the outer view
---echo # Expectation: Can run the queries, but not EXPLAIN or ANALYZE
---echo # because the query plan cannot be shown
---echo # (it could have revealed the structure of the inner view)
---echo #------------------------------------------------------------------------
-
-
-INSERT INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v2 (a) VALUES (10);
-
-INSERT INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v2 SELECT * FROM t2;
-
-REPLACE INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v2 (a) VALUES (10);
-
-REPLACE INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v2 SELECT * FROM t2;
-
-UPDATE v2 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2 SET a = 10;
-
-UPDATE v2 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2 SET a = a + 1;
-
-UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-
-DELETE FROM v2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2;
-
-DELETE FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 WHERE a = 10;
-
-DELETE FROM v2 USING v2, t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 USING v2, t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 USING v2, t2;
-
-DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-
-SELECT * FROM v2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2;
-
-SELECT * FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2 WHERE a = 10;
-
-SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-
---echo
---echo #========================================================================
---echo # Test: Grant SELECT, SHOW VIEW on the inner view
---echo #========================================================================
---echo
-
---echo
---echo #------------------------------------------------------------------------
---echo # Test: SELECT + SHOW VIEW privileges allow ANALYZE SELECT for the inner
---echo # view, and ANALYZE <anything> for the outer view
---echo #------------------------------------------------------------------------
---echo
-
-connection default;
-REVOKE ALL PRIVILEGES ON privtest_db.v1 FROM 'privtest'@'localhost';
-GRANT SELECT, SHOW VIEW ON privtest_db.v1 TO 'privtest'@'localhost';
-connection con1;
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the inner view
---echo # Expectation: Can run SELECT, EXPLAIN SELECT, ANALYZE SELECT
---echo #------------------------------------------------------------------------
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v1 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v1 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v1 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v1 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v1 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v1 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v1 SET a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v1 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v1 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v1 SET a = a + 1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1 USING v1, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1 USING v1, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1 USING v1, t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
-
-SELECT * FROM v1;
-EXPLAIN SELECT * FROM v1;
-ANALYZE SELECT * FROM v1;
-
-SELECT * FROM v1 WHERE a = 10;
-EXPLAIN SELECT * FROM v1 WHERE a = 10;
-ANALYZE SELECT * FROM v1 WHERE a = 10;
-
-SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
-EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
-ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the outer view
---echo # Expectation: Can run everything
---echo #------------------------------------------------------------------------
-
-INSERT INTO v2 (a) VALUES (10);
-EXPLAIN INSERT INTO v2 (a) VALUES (10);
-ANALYZE INSERT INTO v2 (a) VALUES (10);
-
-INSERT INTO v2 SELECT * FROM t2;
-EXPLAIN INSERT INTO v2 SELECT * FROM t2;
-ANALYZE INSERT INTO v2 SELECT * FROM t2;
-
-REPLACE INTO v2 (a) VALUES (10);
-EXPLAIN REPLACE INTO v2 (a) VALUES (10);
-ANALYZE REPLACE INTO v2 (a) VALUES (10);
-
-REPLACE INTO v2 SELECT * FROM t2;
-EXPLAIN REPLACE INTO v2 SELECT * FROM t2;
-ANALYZE REPLACE INTO v2 SELECT * FROM t2;
-
-UPDATE v2 SET a = 10;
-EXPLAIN UPDATE v2 SET a = 10;
-ANALYZE UPDATE v2 SET a = 10;
-
-UPDATE v2 SET a = a + 1;
-EXPLAIN UPDATE v2 SET a = a + 1;
-ANALYZE UPDATE v2 SET a = a + 1;
-
-UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-
-DELETE FROM v2;
-EXPLAIN DELETE FROM v2;
-ANALYZE DELETE FROM v2;
-
-DELETE FROM v2 WHERE a = 10;
-EXPLAIN DELETE FROM v2 WHERE a = 10;
-ANALYZE DELETE FROM v2 WHERE a = 10;
-
-DELETE FROM v2 USING v2, t2;
-# Commented due to MDEV-7034
-# EXPLAIN DELETE FROM v2 USING v2, t2;
-ANALYZE DELETE FROM v2 USING v2, t2;
-
-DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-# Commented due to MDEV-7034
-# EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-
-SELECT * FROM v2;
-EXPLAIN SELECT * FROM v2;
-ANALYZE SELECT * FROM v2;
-
-SELECT * FROM v2 WHERE a = 10;
-EXPLAIN SELECT * FROM v2 WHERE a = 10;
-ANALYZE SELECT * FROM v2 WHERE a = 10;
-
-SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo
---echo #========================================================================
---echo # Test: Grant INSERT on the inner view
---echo #========================================================================
---echo
-
-connection default;
-REVOKE ALL PRIVILEGES ON privtest_db.v1 FROM 'privtest'@'localhost';
-GRANT INSERT ON privtest_db.v1 TO 'privtest'@'localhost';
-connection con1;
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the inner view
---echo # Expectation: Can run INSERT, but not EXPLAIN INSERT or ANALYZE INSERT
---echo # because the query plan cannot be shown
---echo # (it could have revealed the structure of the view)
---echo #------------------------------------------------------------------------
-
-
-INSERT INTO v1 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v1 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v1 (a) VALUES (10);
-
-INSERT INTO v1 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v1 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v1 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v1 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v1 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v1 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v1 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v1 SET a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v1 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v1 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v1 SET a = a + 1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1 USING v1, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1 USING v1, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1 USING v1, t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v1 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the outer view
---echo # Expectation: Can run the queries, but not EXPLAIN or ANALYZE
---echo # because the query plan cannot be shown
---echo # (it could have revealed the structure of the inner view)
---echo #------------------------------------------------------------------------
-
-
-INSERT INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v2 (a) VALUES (10);
-
-INSERT INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v2 SELECT * FROM t2;
-
-REPLACE INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v2 (a) VALUES (10);
-
-REPLACE INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v2 SELECT * FROM t2;
-
-UPDATE v2 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2 SET a = 10;
-
-UPDATE v2 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2 SET a = a + 1;
-
-UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-
-DELETE FROM v2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2;
-
-DELETE FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 WHERE a = 10;
-
-DELETE FROM v2 USING v2, t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 USING v2, t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 USING v2, t2;
-
-DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-
-SELECT * FROM v2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2;
-
-SELECT * FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2 WHERE a = 10;
-
-SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo
---echo #========================================================================
---echo # Test: Grant UPDATE on the inner view
---echo #========================================================================
---echo
-
-connection default;
-REVOKE ALL PRIVILEGES ON privtest_db.v1 FROM 'privtest'@'localhost';
-GRANT UPDATE ON privtest_db.v1 TO 'privtest'@'localhost';
-connection con1;
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the inner view
---echo # Expectation: Can run UPDATE which does not read any columns, but not
---echo # but not EXPLAIN UPDATE or ANALYZE UPDATE
---echo # because the query plan cannot be shown
---echo # (it could have revealed the structure of the view).
---echo #------------------------------------------------------------------------
-
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v1 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v1 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v1 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v1 SELECT * FROM t2;
-
-UPDATE v1 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v1 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v1 SET a = 10;
-
-# Wrong result due to MDEV-7042
-#--error ER_COLUMNACCESS_DENIED_ERROR
-UPDATE v1 SET a = a + 1;
-# Strange error code due to MDEV-7042
-#--error ER_COLUMNACCESS_DENIED_ERROR
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v1 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v1 SET a = a + 1;
-
---error ER_COLUMNACCESS_DENIED_ERROR
-UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
-# Strange error code due to MDEV-7033, MDEV-7042
-#--error ER_COLUMNACCESS_DENIED_ERROR
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1 USING v1, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1 USING v1, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1 USING v1, t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v1 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the outer view
---echo # Expectation: Can run the queries, but not EXPLAIN or ANALYZE
---echo # because the query plan cannot be shown
---echo # (it could have revealed the structure of the inner view)
---echo #------------------------------------------------------------------------
-
-
-INSERT INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v2 (a) VALUES (10);
-
-INSERT INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v2 SELECT * FROM t2;
-
-REPLACE INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v2 (a) VALUES (10);
-
-REPLACE INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v2 SELECT * FROM t2;
-
-UPDATE v2 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2 SET a = 10;
-
-UPDATE v2 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2 SET a = a + 1;
-
-UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-
-DELETE FROM v2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2;
-
-DELETE FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 WHERE a = 10;
-
-DELETE FROM v2 USING v2, t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 USING v2, t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 USING v2, t2;
-
-DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-
-SELECT * FROM v2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2;
-
-SELECT * FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2 WHERE a = 10;
-
-SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo
---echo #========================================================================
---echo # Test: Grant UPDATE, SELECT(a) on the inner view
---echo #========================================================================
---echo
-
-connection default;
-REVOKE ALL PRIVILEGES ON privtest_db.v1 FROM 'privtest'@'localhost';
-GRANT SELECT(a), UPDATE ON privtest_db.v1 TO 'privtest'@'localhost';
-connection con1;
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the inner view
---echo # Expectation: Can run UPDATE, but not EXPLAIN or ANALYZE for it
---echo # because the query plan cannot be shown
---echo # (it could have revealed the structure of the view)
---echo #------------------------------------------------------------------------
-
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v1 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v1 SELECT * FROM t2;
-
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v1 (a) VALUES (10);
-
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v1 SELECT * FROM t2;
-
-UPDATE v1 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v1 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v1 SET a = 10;
-
-UPDATE v1 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v1 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v1 SET a = a + 1;
-
-UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1 USING v1, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1 USING v1, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1 USING v1, t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v1 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v1 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v1 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the outer view
---echo # Expectation: Can run the queries, but not EXPLAIN or ANALYZE
---echo # because the query plan cannot be shown
---echo # (it could have revealed the structure of the inner view)
---echo #------------------------------------------------------------------------
-
-
-INSERT INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v2 (a) VALUES (10);
-
-INSERT INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v2 SELECT * FROM t2;
-
-REPLACE INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v2 (a) VALUES (10);
-
-REPLACE INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v2 SELECT * FROM t2;
-
-UPDATE v2 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2 SET a = 10;
-
-UPDATE v2 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2 SET a = a + 1;
-
-UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-
-DELETE FROM v2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2;
-
-DELETE FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 WHERE a = 10;
-
-DELETE FROM v2 USING v2, t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 USING v2, t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 USING v2, t2;
-
-DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-
-SELECT * FROM v2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2;
-
-SELECT * FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2 WHERE a = 10;
-
-SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-
---echo
---echo #========================================================================
---echo # Test: Grant SELECT, UPDATE on the inner view
---echo #========================================================================
---echo
-
-connection default;
-REVOKE ALL PRIVILEGES ON privtest_db.v1 FROM 'privtest'@'localhost';
-GRANT SELECT, UPDATE ON privtest_db.v1 TO 'privtest'@'localhost';
-connection con1;
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the inner view
---echo # Expectation: Can run the UPDATE and SELECT queries, but not EXPLAIN
---echo # or ANALYZE because the query plan cannot be shown
---echo # (it could have revealed the structure of the view)
---echo #------------------------------------------------------------------------
-
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v1 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v1 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v1 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v1 SELECT * FROM t2;
-
-UPDATE v1 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v1 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v1 SET a = 10;
-
-UPDATE v1 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v1 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v1 SET a = a + 1;
-
-UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1 USING v1, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1 USING v1, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1 USING v1, t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
-
-SELECT * FROM v1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v1;
-
-SELECT * FROM v1 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v1 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v1 WHERE a = 10;
-
-SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the outer view
---echo # Expectation: Can run the queries, but not EXPLAIN or ANALYZE
---echo # because the query plan cannot be shown
---echo # (it could have revealed the structure of the inner view)
---echo #------------------------------------------------------------------------
-
-
-INSERT INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v2 (a) VALUES (10);
-
-INSERT INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v2 SELECT * FROM t2;
-
-REPLACE INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v2 (a) VALUES (10);
-
-REPLACE INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v2 SELECT * FROM t2;
-
-UPDATE v2 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2 SET a = 10;
-
-UPDATE v2 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2 SET a = a + 1;
-
-UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-
-DELETE FROM v2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2;
-
-DELETE FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 WHERE a = 10;
-
-DELETE FROM v2 USING v2, t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 USING v2, t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 USING v2, t2;
-
-DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-
-SELECT * FROM v2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2;
-
-SELECT * FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2 WHERE a = 10;
-
-SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo
---echo #========================================================================
---echo # Test: Grant DELETE on the inner view
---echo #========================================================================
---echo
-
-connection default;
-REVOKE ALL PRIVILEGES ON privtest_db.v1 FROM 'privtest'@'localhost';
-GRANT DELETE ON privtest_db.v1 TO 'privtest'@'localhost';
-connection con1;
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the inner view
---echo # Expectation: Can run DELETE which does not read any columns,
---echo # but not EXPLAIN DELETE or ANALYZE DELETE
---echo # because the query plan cannot be shown
---echo # (it could have revealed the structure of the view)
---echo #------------------------------------------------------------------------
-
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v1 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v1 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v1 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v1 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v1 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v1 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v1 SET a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v1 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v1 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v1 SET a = a + 1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
-
-DELETE FROM v1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v1;
-
---error ER_COLUMNACCESS_DENIED_ERROR
-DELETE FROM v1 WHERE a = 10;
-# Strange error code due to MDEV-7033
-#--error ER_COLUMNACCESS_DENIED_ERROR
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v1 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v1 WHERE a = 10;
-
-# Unexpected error due to MDEV-7043
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1 USING v1, t2;
-# Unexpected error code due to MDEV-7043
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1 USING v1, t2;
-# Unexpected error code due to MDEV-7043
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1 USING v1, t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v1 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the outer view
---echo # Expectation: Can run the queries, but not EXPLAIN or ANALYZE
---echo # because the query plan cannot be shown
---echo # (it could have revealed the structure of the inner view)
---echo #------------------------------------------------------------------------
-
-
-INSERT INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v2 (a) VALUES (10);
-
-INSERT INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v2 SELECT * FROM t2;
-
-REPLACE INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v2 (a) VALUES (10);
-
-REPLACE INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v2 SELECT * FROM t2;
-
-UPDATE v2 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2 SET a = 10;
-
-UPDATE v2 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2 SET a = a + 1;
-
-UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-
-DELETE FROM v2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2;
-
-DELETE FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 WHERE a = 10;
-
-DELETE FROM v2 USING v2, t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 USING v2, t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 USING v2, t2;
-
-DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-
-SELECT * FROM v2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2;
-
-SELECT * FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2 WHERE a = 10;
-
-SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo
---echo #========================================================================
---echo # Test: Grant DELETE, SHOW VIEW on the inner view
---echo #========================================================================
---echo
-
-connection default;
-REVOKE ALL PRIVILEGES ON privtest_db.v1 FROM 'privtest'@'localhost';
-GRANT SHOW VIEW, DELETE ON privtest_db.v1 TO 'privtest'@'localhost';
-connection con1;
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the inner view
---echo # Expectation: Can run DELETE, EXPLAIN DELETE, UPDATE DELETE
---echo # which don't read any columns
---echo #------------------------------------------------------------------------
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v1 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v1 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v1 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v1 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v1 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v1 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v1 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v1 SET a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v1 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v1 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v1 SET a = a + 1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
-
-DELETE FROM v1;
-EXPLAIN DELETE FROM v1;
-ANALYZE DELETE FROM v1;
-
---error ER_COLUMNACCESS_DENIED_ERROR
-DELETE FROM v1 WHERE a = 10;
---error ER_COLUMNACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1 WHERE a = 10;
---error ER_COLUMNACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1 WHERE a = 10;
-
-# Unexpected error due to MDEV-7043
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v1 USING v1, t2;
-# Unexpected error due to MDEV-7043
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1 USING v1, t2;
-# Unexpected error due to MDEV-7043
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1 USING v1, t2;
-
-# Unexpected error code due to MDEV-7043
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
-# Unexpected error code due to MDEV-7043
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
-# Unexpected error code due to MDEV-7043
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v1 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the outer view
---echo # Expectation: Can run the queries, but not EXPLAIN or ANALYZE
---echo # because the query plan cannot be shown
---echo # (that's how it works now)
---echo #------------------------------------------------------------------------
-
-
-INSERT INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v2 (a) VALUES (10);
-
-INSERT INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v2 SELECT * FROM t2;
-
-REPLACE INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v2 (a) VALUES (10);
-
-REPLACE INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE REPLACE INTO v2 SELECT * FROM t2;
-
-UPDATE v2 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2 SET a = 10;
-
-UPDATE v2 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2 SET a = a + 1;
-
-UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-
-DELETE FROM v2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2;
-
-DELETE FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 WHERE a = 10;
-
-DELETE FROM v2 USING v2, t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 USING v2, t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 USING v2, t2;
-
-DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-
-SELECT * FROM v2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2;
-
-SELECT * FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2 WHERE a = 10;
-
-SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-
---echo
---echo #========================================================================
---echo # Test: Grant SELECT, INSERT, UPDATE, DELETE, SHOW VIEW
---echo #========================================================================
---echo
-
-connection default;
-REVOKE ALL PRIVILEGES ON privtest_db.v1 FROM 'privtest'@'localhost';
-GRANT SELECT, INSERT, UPDATE, DELETE, SHOW VIEW ON privtest_db.v1 TO 'privtest'@'localhost';
-connection con1;
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the inner view
---echo # Expectation: Can run everything
---echo #------------------------------------------------------------------------
-
-INSERT INTO v1 (a) VALUES (10);
-EXPLAIN INSERT INTO v1 (a) VALUES (10);
-ANALYZE INSERT INTO v1 (a) VALUES (10);
-
-INSERT INTO v1 SELECT * FROM t2;
-EXPLAIN INSERT INTO v1 SELECT * FROM t2;
-ANALYZE INSERT INTO v1 SELECT * FROM t2;
-
-REPLACE INTO v1 (a) VALUES (10);
-EXPLAIN REPLACE INTO v1 (a) VALUES (10);
-ANALYZE REPLACE INTO v1 (a) VALUES (10);
-
-REPLACE INTO v1 SELECT * FROM t2;
-EXPLAIN REPLACE INTO v1 SELECT * FROM t2;
-ANALYZE REPLACE INTO v1 SELECT * FROM t2;
-
-UPDATE v1 SET a = 10;
-EXPLAIN UPDATE v1 SET a = 10;
-ANALYZE UPDATE v1 SET a = 10;
-
-UPDATE v1 SET a = a + 1;
-EXPLAIN UPDATE v1 SET a = a + 1;
-ANALYZE UPDATE v1 SET a = a + 1;
-
-UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
-EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
-ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
-
-DELETE FROM v1;
-EXPLAIN DELETE FROM v1;
-ANALYZE DELETE FROM v1;
-
-DELETE FROM v1 WHERE a = 10;
-EXPLAIN DELETE FROM v1 WHERE a = 10;
-ANALYZE DELETE FROM v1 WHERE a = 10;
-
-DELETE FROM v1 USING v1, t2;
-EXPLAIN DELETE FROM v1 USING v1, t2;
-ANALYZE DELETE FROM v1 USING v1, t2;
-
-DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
-EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
-ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
-
-SELECT * FROM v1;
-EXPLAIN SELECT * FROM v1;
-ANALYZE SELECT * FROM v1;
-
-SELECT * FROM v1 WHERE a = 10;
-EXPLAIN SELECT * FROM v1 WHERE a = 10;
-ANALYZE SELECT * FROM v1 WHERE a = 10;
-
-SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
-EXPLAIN SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
-ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the outer view
---echo # Expectation: Can run everything
---echo #------------------------------------------------------------------------
-
-INSERT INTO v2 (a) VALUES (10);
-EXPLAIN INSERT INTO v2 (a) VALUES (10);
-ANALYZE INSERT INTO v2 (a) VALUES (10);
-
-INSERT INTO v2 SELECT * FROM t2;
-EXPLAIN INSERT INTO v2 SELECT * FROM t2;
-ANALYZE INSERT INTO v2 SELECT * FROM t2;
-
-REPLACE INTO v2 (a) VALUES (10);
-EXPLAIN REPLACE INTO v2 (a) VALUES (10);
-ANALYZE REPLACE INTO v2 (a) VALUES (10);
-
-REPLACE INTO v2 SELECT * FROM t2;
-EXPLAIN REPLACE INTO v2 SELECT * FROM t2;
-ANALYZE REPLACE INTO v2 SELECT * FROM t2;
-
-UPDATE v2 SET a = 10;
-EXPLAIN UPDATE v2 SET a = 10;
-ANALYZE UPDATE v2 SET a = 10;
-
-UPDATE v2 SET a = a + 1;
-EXPLAIN UPDATE v2 SET a = a + 1;
-ANALYZE UPDATE v2 SET a = a + 1;
-
-UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-
-DELETE FROM v2;
-EXPLAIN DELETE FROM v2;
-ANALYZE DELETE FROM v2;
-
-DELETE FROM v2 WHERE a = 10;
-EXPLAIN DELETE FROM v2 WHERE a = 10;
-ANALYZE DELETE FROM v2 WHERE a = 10;
-
-DELETE FROM v2 USING v2, t2;
-# Commented due to MDEV-7034
-# EXPLAIN DELETE FROM v2 USING v2, t2;
-ANALYZE DELETE FROM v2 USING v2, t2;
-
-DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-# Commented due to MDEV-7034
-# EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-
-SELECT * FROM v2;
-EXPLAIN SELECT * FROM v2;
-ANALYZE SELECT * FROM v2;
-
-SELECT * FROM v2 WHERE a = 10;
-EXPLAIN SELECT * FROM v2 WHERE a = 10;
-ANALYZE SELECT * FROM v2 WHERE a = 10;
-
-SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-
-
-
---echo
---echo #########################################################################
---echo # Outer view permission tests
---echo # (we modify permissions on the outer view, keeping ALL the rest)
---echo #########################################################################
---echo
-
---echo
---echo #========================================================================
---echo # Test: No permissions on the outer view
---echo #========================================================================
---echo
-
-connection default;
-GRANT ALL ON privtest_db.t1 TO 'privtest'@'localhost';
-GRANT ALL ON privtest_db.v1 TO 'privtest'@'localhost';
-REVOKE ALL PRIVILEGES ON privtest_db.v2 FROM 'privtest'@'localhost';
-connection con1;
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the outer view
---echo # Expectation: Cannot run anything
---echo #------------------------------------------------------------------------
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v2 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v2 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v2 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v2 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v2 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v2 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v2 SET a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v2 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v2 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v2 SET a = a + 1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2 USING v2, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2 USING v2, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2 USING v2, t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v2 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v2 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v2 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo
---echo #========================================================================
---echo # Test: Grant SHOW VIEW on the outer view
---echo #========================================================================
---echo
-
-connection default;
-GRANT SHOW VIEW ON privtest_db.v2 TO 'privtest'@'localhost';
-connection con1;
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the outer view
---echo # Expectation: Cannot run anything
---echo #------------------------------------------------------------------------
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v2 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v2 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v2 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v2 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v2 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v2 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v2 SET a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v2 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v2 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v2 SET a = a + 1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2 USING v2, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2 USING v2, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2 USING v2, t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v2 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v2 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v2 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-
---echo
---echo #========================================================================
---echo # Test: Grant SHOW VIEW, SELECT(a) on the outer view
---echo #========================================================================
---echo
-
-connection default;
-REVOKE ALL PRIVILEGES ON privtest_db.v2 FROM 'privtest'@'localhost';
-GRANT SELECT(a), SHOW VIEW ON privtest_db.v2 TO 'privtest'@'localhost';
-connection con1;
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the outer view
---echo # Expectation: Can run SELECT, EXPLAIN SELECT and ANALYZE SELECT
---echo # when only `a` column is involved
---echo #------------------------------------------------------------------------
-
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v2 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v2 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v2 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v2 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v2 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v2 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v2 SET a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v2 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v2 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v2 SET a = a + 1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2 USING v2, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2 USING v2, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2 USING v2, t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-
-SELECT a FROM v2;
-EXPLAIN SELECT a FROM v2;
-ANALYZE SELECT a FROM v2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v2 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v2 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v2 WHERE a = 10;
-
-SELECT a FROM v2 WHERE a = 10;
-EXPLAIN SELECT a FROM v2 WHERE a = 10;
-ANALYZE SELECT a FROM v2 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-
---echo
---echo #========================================================================
---echo # Test: Grant SELECT on the outer view
---echo #========================================================================
---echo
-
-connection default;
-REVOKE ALL PRIVILEGES ON privtest_db.v2 FROM 'privtest'@'localhost';
-GRANT SELECT ON privtest_db.v2 TO 'privtest'@'localhost';
-connection con1;
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the inner view
---echo # Expectation: Can run SELECT, but not EXPLAIN SELECT or ANALYZE SELECT
---echo # because the query plan cannot be shown
---echo # (it could have revealed the structure of the view)
---echo #------------------------------------------------------------------------
-
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v2 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v2 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v2 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v2 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v2 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v2 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v2 SET a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v2 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v2 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v2 SET a = a + 1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-# Strange error code due to MDEV-7033, MDEV-7042
-# --error ER_TABLEACCESS_DENIED_ERROR
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2 USING v2, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2 USING v2, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2 USING v2, t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-
-SELECT * FROM v2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2;
-
-SELECT * FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2 WHERE a = 10;
-
-SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo
---echo #========================================================================
---echo # Test: Grant SHOW VIEW, SELECT on the outer view
---echo #========================================================================
---echo
-
-connection default;
-REVOKE ALL PRIVILEGES ON privtest_db.v2 FROM 'privtest'@'localhost';
-GRANT SELECT, SHOW VIEW ON privtest_db.v2 TO 'privtest'@'localhost';
-connection con1;
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the inner view
---echo # Expectation: Can run SELECT, EXPLAIN SELECT, ANALYZE SELECT
---echo #------------------------------------------------------------------------
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v2 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v2 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v2 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v2 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v2 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v2 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v2 SET a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v2 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v2 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v2 SET a = a + 1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2 USING v2, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2 USING v2, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2 USING v2, t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-
-SELECT * FROM v2;
-EXPLAIN SELECT * FROM v2;
-ANALYZE SELECT * FROM v2;
-
-SELECT * FROM v2 WHERE a = 10;
-EXPLAIN SELECT * FROM v2 WHERE a = 10;
-ANALYZE SELECT * FROM v2 WHERE a = 10;
-
-SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-
---echo
---echo #========================================================================
---echo # Test: Grant INSERT on the outer view
---echo #========================================================================
---echo
---echo
-
-connection default;
-REVOKE ALL PRIVILEGES ON privtest_db.v2 FROM 'privtest'@'localhost';
-GRANT INSERT ON privtest_db.v2 TO 'privtest'@'localhost';
-connection con1;
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the outer view
---echo # Expectation: Can run INSERT, but not EXPLAIN INSERT or ANALYZE INSERT
---echo # because the query plan cannot be shown
---echo # (it could have revealed the structure of the view)
---echo #------------------------------------------------------------------------
-
-
-INSERT INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v2 (a) VALUES (10);
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v2 (a) VALUES (10);
-
-INSERT INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v2 SELECT * FROM t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE INSERT INTO v2 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v2 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v2 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v2 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v2 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v2 SET a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v2 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v2 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v2 SET a = a + 1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2 USING v2, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2 USING v2, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2 USING v2, t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v2 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v2 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v2 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-
-
---echo
---echo #========================================================================
---echo # Test: Grant UPDATE on the outer view
---echo #========================================================================
---echo
---echo
-
-connection default;
-REVOKE ALL PRIVILEGES ON privtest_db.v2 FROM 'privtest'@'localhost';
-GRANT UPDATE ON privtest_db.v2 TO 'privtest'@'localhost';
-connection con1;
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the outer view
---echo # Expectation: Can run UPDATE which does not read any columns,
---echo # but not EXPLAIN UPDATE or ANALYZE UPDATE
---echo # because the query plan cannot be shown
---echo # (it could have revealed the structure of the view)
---echo #------------------------------------------------------------------------
-
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v2 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v2 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v2 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v2 SELECT * FROM t2;
-
-UPDATE v2 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2 SET a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2 SET a = 10;
-
-# Wrong result due to MDEV-7042
-# --error ER_COLUMNACCESS_DENIED_ERROR
-UPDATE v2 SET a = a + 1;
-# Strange error code due to MDEV-7042
-#--error ER_COLUMNACCESS_DENIED_ERROR
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2 SET a = a + 1;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2 SET a = a + 1;
-
---error ER_COLUMNACCESS_DENIED_ERROR
-UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-# Strange error code due to MDEV-7042
-# --error ER_COLUMNACCESS_DENIED_ERROR
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2 USING v2, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2 USING v2, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2 USING v2, t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v2 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v2 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v2 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-
---echo
---echo #========================================================================
---echo # Test: Grant UPDATE, SHOW VIEW on the outer view
---echo #========================================================================
---echo
-
-connection default;
-REVOKE ALL PRIVILEGES ON privtest_db.v2 FROM 'privtest'@'localhost';
-GRANT SHOW VIEW, UPDATE ON privtest_db.v2 TO 'privtest'@'localhost';
-connection con1;
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the inner view
---echo # Expectation: Can run UPDATE, EXPLAIN UPDATE, ANALYZE UPDATE
---echo # which do not read any columns
---echo #------------------------------------------------------------------------
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v2 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v2 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v2 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v2 SELECT * FROM t2;
-
-UPDATE v2 SET a = 10;
-EXPLAIN UPDATE v2 SET a = 10;
-ANALYZE UPDATE v2 SET a = 10;
-
-# Wrong result due to MDEV-7042
-# --error ER_COLUMNACCESS_DENIED_ERROR
-UPDATE v2 SET a = a + 1;
-# Wrong result due to MDEV-7042
-# --error ER_COLUMNACCESS_DENIED_ERROR
-EXPLAIN UPDATE v2 SET a = a + 1;
-# Wrong result due to MDEV-7042
-# --error ER_COLUMNACCESS_DENIED_ERROR
-ANALYZE UPDATE v2 SET a = a + 1;
-
---error ER_COLUMNACCESS_DENIED_ERROR
-UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_COLUMNACCESS_DENIED_ERROR
-EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_COLUMNACCESS_DENIED_ERROR
-ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2 USING v2, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2 USING v2, t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2 USING v2, t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v2 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v2 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v2 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-
---echo
---echo #========================================================================
---echo # Test: Grant DELETE on the outer view
---echo #========================================================================
---echo
-
-connection default;
-REVOKE ALL PRIVILEGES ON privtest_db.v2 FROM 'privtest'@'localhost';
-GRANT DELETE ON privtest_db.v2 TO 'privtest'@'localhost';
-connection con1;
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the outer view
---echo # Expectation: Can run DELETE which does not read any columns,
---echo # but not EXPLAIN DELETE or ANALYZE DELETE
---echo # because the query plan cannot be shown
---echo # (it could have revealed the structure of the view)
---echo #------------------------------------------------------------------------
-
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v2 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v2 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v2 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v2 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v2 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v2 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v2 SET a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v2 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v2 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v2 SET a = a + 1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-
-DELETE FROM v2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2;
-
---error ER_COLUMNACCESS_DENIED_ERROR
-DELETE FROM v2 WHERE a = 10;
-# Strange error code due to MDEV-7042, MDEV-7033
-# --error ER_COLUMNACCESS_DENIED_ERROR
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 WHERE a = 10;
-
-# Unexpected error due to MDEV-7043
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2 USING v2, t2;
-# Unexpected error code due to MDEV-7043
-# --error ER_VIEW_NO_EXPLAIN
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2 USING v2, t2;
-# Unexpected error code due to MDEV-7043
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2 USING v2, t2;
-
-# Unexpected error due to MDEV-7043
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-# Unexpected error code due to MDEV-7043
-# --error ER_VIEW_NO_EXPLAIN
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-# Unexpected error code due to MDEV-7043
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v2 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v2 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v2 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-
---echo
---echo #========================================================================
---echo # Test: Grant DELETE, SELECT on the outer view
---echo #========================================================================
---echo
-
-connection default;
-REVOKE ALL PRIVILEGES ON privtest_db.v2 FROM 'privtest'@'localhost';
-GRANT SELECT, DELETE ON privtest_db.v2 TO 'privtest'@'localhost';
-connection con1;
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the outer view
---echo # Expectation: Can run DELETE and SELECT, but not EXPLAIN or ANALYZE
---echo # for them because the query plan cannot be shown
---echo # (it could have revealed the structure of the view)
---echo #------------------------------------------------------------------------
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v2 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE INSERT INTO v2 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v2 (a) VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v2 (a) VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-REPLACE INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO v2 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE REPLACE INTO v2 SELECT * FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v2 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v2 SET a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v2 SET a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v2 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE v2 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
-ANALYZE UPDATE v2 SET a = a + 1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-# Strange error code due to MDEV-7033
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-
-DELETE FROM v2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2;
-
-DELETE FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 WHERE a = 10;
-
-DELETE FROM v2 USING v2, t2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 USING v2, t2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 USING v2, t2;
-
-DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-
-SELECT * FROM v2;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2;
-
-SELECT * FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2 WHERE a = 10;
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2 WHERE a = 10;
-
-SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
---error ER_VIEW_NO_EXPLAIN
-ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-
---echo
---echo #========================================================================
---echo # Test: Grant SELECT, INSERT, UPDATE, DELETE, SHOW VIEW on the outer view
---echo #========================================================================
---echo
-
-connection default;
-REVOKE ALL PRIVILEGES ON privtest_db.v2 FROM 'privtest'@'localhost';
-GRANT SELECT, INSERT, UPDATE, DELETE, SHOW VIEW ON privtest_db.v2 TO 'privtest'@'localhost';
-connection con1;
-
-
---echo #------------------------------------------------------------------------
---echo # I/R/U/D/S on the outer view
---echo # Expectation: Can run everything
---echo #------------------------------------------------------------------------
-
-INSERT INTO v2 (a) VALUES (10);
-EXPLAIN INSERT INTO v2 (a) VALUES (10);
-ANALYZE INSERT INTO v2 (a) VALUES (10);
-
-INSERT INTO v2 SELECT * FROM t2;
-# Commented due to MDEV-7034
-EXPLAIN INSERT INTO v2 SELECT * FROM t2;
-ANALYZE INSERT INTO v2 SELECT * FROM t2;
-
-REPLACE INTO v2 (a) VALUES (10);
-EXPLAIN REPLACE INTO v2 (a) VALUES (10);
-ANALYZE REPLACE INTO v2 (a) VALUES (10);
-
-REPLACE INTO v2 SELECT * FROM t2;
-EXPLAIN REPLACE INTO v2 SELECT * FROM t2;
-ANALYZE REPLACE INTO v2 SELECT * FROM t2;
-
-UPDATE v2 SET a = 10;
-EXPLAIN UPDATE v2 SET a = 10;
-ANALYZE UPDATE v2 SET a = 10;
-
-UPDATE v2 SET a = a + 1;
-EXPLAIN UPDATE v2 SET a = a + 1;
-ANALYZE UPDATE v2 SET a = a + 1;
-
-UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-EXPLAIN UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a;
-
-DELETE FROM v2;
-EXPLAIN DELETE FROM v2;
-ANALYZE DELETE FROM v2;
-
-DELETE FROM v2 WHERE a = 10;
-EXPLAIN DELETE FROM v2 WHERE a = 10;
-ANALYZE DELETE FROM v2 WHERE a = 10;
-
-DELETE FROM v2 USING v2, t2;
-# Commented due to MDEV-7034
-# EXPLAIN DELETE FROM v2 USING v2, t2;
-ANALYZE DELETE FROM v2 USING v2, t2;
-
-DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-# Commented due to MDEV-7034
-# EXPLAIN DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a;
-
-SELECT * FROM v2;
-EXPLAIN SELECT * FROM v2;
-ANALYZE SELECT * FROM v2;
-
-SELECT * FROM v2 WHERE a = 10;
-EXPLAIN SELECT * FROM v2 WHERE a = 10;
-ANALYZE SELECT * FROM v2 WHERE a = 10;
-
-SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-EXPLAIN SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 );
-
-
-################################################################################################
-disconnect con1;
-connection default;
-
-DROP USER 'privtest'@localhost;
-USE test;
-DROP DATABASE privtest_db;
-
-set GLOBAL sql_mode=default;
---source include/wait_until_count_sessions.inc
-
-
diff --git a/mysql-test/t/analyze_stmt_slow_query_log-master.opt b/mysql-test/t/analyze_stmt_slow_query_log-master.opt
deleted file mode 100644
index 1c80c45b0c1..00000000000
--- a/mysql-test/t/analyze_stmt_slow_query_log-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---slow-query-log --long-query-time=0.00001 --log-slow-verbosity=query_plan,explain
diff --git a/mysql-test/t/analyze_stmt_slow_query_log.test b/mysql-test/t/analyze_stmt_slow_query_log.test
deleted file mode 100644
index 44865b652cb..00000000000
--- a/mysql-test/t/analyze_stmt_slow_query_log.test
+++ /dev/null
@@ -1,38 +0,0 @@
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-#
-# Remove old log file
-#
-let SLOW_LOG_FILE= `select @@slow_query_log_file`;
-
-SET @@global.slow_query_log = OFF;
-
-perl;
- my $slow_log_file= $ENV{'SLOW_LOG_FILE'} or die "SLOW_LOG_FILE not set";
- unlink($slow_log_file);
-EOF
-
-FLUSH SLOW LOGS;
-SET @@global.slow_query_log = ON;
-
-create table t1 (a int);
-INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-select * from t1 where a<3;
-drop table t1;
-let SLOW_LOG_FILE= `select @@slow_query_log_file`;
-
-# select @@slow_query_log_file;
-
-perl;
-
- my $slow_log_file= $ENV{'SLOW_LOG_FILE'} or die "SLOW_LOG_FILE not set";
- open(FILE, $slow_log_file) or die "Failed to open $slow_log_file";
- while(<FILE>) {
- next if 1../create table t1/; # skip entries generated by mtr prelude
- print if /explain:/;
- }
- close(FILE);
-
-EOF
diff --git a/mysql-test/t/ansi.test b/mysql-test/t/ansi.test
deleted file mode 100644
index fa7f999954e..00000000000
--- a/mysql-test/t/ansi.test
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-# Test of ansi mode
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-set sql_mode="MySQL40";
-select @@sql_mode;
-set @@sql_mode="ANSI";
-select @@sql_mode;
-
-# Test some functions that works different in ansi mode
-
-SELECT 'A' || 'B';
-
-# Test GROUP BY behaviour
-
-CREATE TABLE t1 (id INT, id2 int);
-SELECT id,NULL,1,1.1,'a' FROM t1 GROUP BY id;
-#No --error 1055 error due to temporary fix for BUG#8510:
-#ONLY_FULL_GROUP_BY is overly restrictive, so remove it from ANSI mode.
-SELECT id FROM t1 GROUP BY id2;
-drop table t1;
-
-SET @@SQL_MODE="";
-
-# Bug#14515
-
-CREATE TABLE t1 (i int auto_increment NOT NULL, PRIMARY KEY (i));
-SHOW CREATE TABLE t1;
-SET @@SQL_MODE="MYSQL323";
-SHOW CREATE TABLE t1;
-SET @@SQL_MODE="MYSQL40";
-SHOW CREATE TABLE t1;
-SET @@SQL_MODE="NO_FIELD_OPTIONS";
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/assign_key_cache-5405.test b/mysql-test/t/assign_key_cache-5405.test
deleted file mode 100644
index 2839e040bd3..00000000000
--- a/mysql-test/t/assign_key_cache-5405.test
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# MDEV-5405 RQG induced crash in mi_assign_to_key_cache in safe mutex unlock
-#
---source include/have_debug_sync.inc
-create table t1 (f int, key(f)) engine=myisam;
-set global kc1.key_buffer_size = 65536;
-
-connect (con1, localhost, root);
-
-set debug_sync='assign_key_cache_op_unlock wait_for op_locked';
-send cache index t1 in kc1;
-
-connection default;
-sleep 1;
-set debug_sync='assign_key_cache_op_lock signal op_locked wait_for assigned';
-send cache index t1 in kc1;
-
-connection con1;
-reap;
-set debug_sync='now signal assigned';
-disconnect con1;
-connection default;
-reap;
-
-drop table t1;
-set global kc1.key_buffer_size = 0;
-set debug_sync='reset';
diff --git a/mysql-test/t/auth_named_pipe-master.opt b/mysql-test/t/auth_named_pipe-master.opt
deleted file mode 100644
index e534ae1eae5..00000000000
--- a/mysql-test/t/auth_named_pipe-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-enable-named-pipe
diff --git a/mysql-test/t/auth_named_pipe.test b/mysql-test/t/auth_named_pipe.test
deleted file mode 100644
index 00577fbef05..00000000000
--- a/mysql-test/t/auth_named_pipe.test
+++ /dev/null
@@ -1,23 +0,0 @@
---source include/windows.inc
-
-INSTALL SONAME 'auth_named_pipe';
-
---replace_result $USERNAME USERNAME
-eval CREATE USER '$USERNAME' IDENTIFIED WITH named_pipe;
-# Connect using named pipe, correct username
-connect(pipe_con,localhost,$USERNAME,,,,,PIPE);
---replace_result $USERNAME USERNAME
-SELECT USER(),CURRENT_USER();
-disconnect pipe_con;
-connection default;
---replace_result $USERNAME USERNAME
-eval DROP USER '$USERNAME';
-
-# test invalid user name
-CREATE USER nosuchuser IDENTIFIED WITH named_pipe;
---disable_query_log
---error ER_ACCESS_DENIED_NO_PASSWORD_ERROR
-connect(pipe_con,localhost,nosuchuser,,,,,PIPE);
---enable_query_log
-DROP USER nosuchuser;
-UNINSTALL SONAME 'auth_named_pipe'; \ No newline at end of file
diff --git a/mysql-test/t/auth_rpl-slave.opt b/mysql-test/t/auth_rpl-slave.opt
deleted file mode 100644
index 1e471f65645..00000000000
--- a/mysql-test/t/auth_rpl-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---master-retry-count=1
diff --git a/mysql-test/t/auth_rpl.test b/mysql-test/t/auth_rpl.test
deleted file mode 100644
index 9b2c4357cf0..00000000000
--- a/mysql-test/t/auth_rpl.test
+++ /dev/null
@@ -1,63 +0,0 @@
---source include/have_plugin_auth.inc
---source include/not_embedded.inc
---source include/master-slave.inc
-
-#
-# Check that replication slave can connect to master using an account
-# which authenticates with an external authentication plugin (bug#12897501).
-
-#
-# First stop the slave to guarantee that nothing is replicated.
-#
---connection slave
---source include/stop_slave.inc
-#
-# Create an replication account on the master.
-#
---connection master
-CREATE USER 'plug_user' IDENTIFIED WITH 'test_plugin_server' AS 'plug_user';
-GRANT REPLICATION SLAVE ON *.* TO plug_user;
-FLUSH PRIVILEGES;
-
-#
-# Now go to slave and change the replication user.
-#
---connection slave
---let $master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1)
-CHANGE MASTER TO
- MASTER_USER= 'plug_user',
- MASTER_PASSWORD= 'plug_user';
-
-#
-# Start slave with new replication account - this should trigger connection
-# to the master server.
-#
---source include/start_slave.inc
-
-# Replicate all statements executed on master, in this case,
-# (creation of the plug_user account).
-#
---connection master
---sync_slave_with_master
---echo # Slave in-sync with master now.
-
-SELECT user, plugin, authentication_string FROM mysql.user WHERE user LIKE 'plug_user';
-
-#
-# Now we can stop the slave and clean up.
-#
-# Note: it is important that slave is stopped at this
-# moment - otherwise master's cleanup statements
-# would be replicated on slave!
-#
---echo # Cleanup (on slave).
---source include/stop_slave.inc
-eval CHANGE MASTER TO MASTER_USER='$master_user';
-DROP USER 'plug_user';
-
---echo # Cleanup (on master).
---connection master
-DROP USER 'plug_user';
-
---let $rpl_only_running_threads= 1
---source include/rpl_end.inc
diff --git a/mysql-test/t/auto_increment.test b/mysql-test/t/auto_increment.test
deleted file mode 100644
index 7f0ab5dc169..00000000000
--- a/mysql-test/t/auto_increment.test
+++ /dev/null
@@ -1,399 +0,0 @@
-#
-# Test of auto_increment; The test for BDB tables is in bdb.test
-#
---disable_warnings
-drop table if exists t1;
-drop table if exists t2;
---enable_warnings
-SET SQL_WARNINGS=1;
-
-create table t1 (a int not null auto_increment,b int, primary key (a)) engine=myisam auto_increment=3;
-insert into t1 values (1,1),(NULL,3),(NULL,4);
-delete from t1 where a=4;
-insert into t1 values (NULL,5),(NULL,6);
-select * from t1;
-delete from t1 where a=6;
-#show table status like "t1";
-replace t1 values (3,1);
-ALTER TABLE t1 add c int;
-replace t1 values (3,3,3);
-insert into t1 values (NULL,7,7);
-update t1 set a=8,b=b+1,c=c+1 where a=7;
-insert into t1 values (NULL,9,9);
-select * from t1;
-drop table t1;
-
-create table t1 (
- skey tinyint unsigned NOT NULL auto_increment PRIMARY KEY,
- sval char(20)
-);
-insert into t1 values (NULL, "hello");
-insert into t1 values (NULL, "hey");
-select * from t1;
-select _rowid,t1._rowid,skey,sval from t1;
-drop table t1;
-
-#
-# Test auto_increment on sub key
-#
-create table t1 (a char(10) not null, b int not null auto_increment, primary key(a,b));
-insert into t1 values ("a",1),("b",2),("a",2),("c",1);
-insert into t1 values ("a",NULL),("b",NULL),("c",NULL),("e",NULL);
-insert into t1 (a) values ("a"),("b"),("c"),("d");
-insert into t1 (a) values ('k'),('d');
-insert into t1 (a) values ("a");
-insert into t1 values ("d",last_insert_id());
-select * from t1;
-drop table t1;
-
-create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ordid), index(ord,ordid));
-insert into t1 (ordid,ord) values (NULL,'sdj'),(NULL,'sdj');
-select * from t1;
-drop table t1;
-
-create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid));
-insert into t1 values (NULL,'sdj'),(NULL,'sdj'),(NULL,"abc"),(NULL,'abc'),(NULL,'zzz'),(NULL,'sdj'),(NULL,'abc');
-select * from t1;
-drop table t1;
-
-create table t1 (sid char(5), id int(2) NOT NULL auto_increment, key(sid, id));
-create table t2 (sid char(20), id int(2));
-insert into t2 values ('skr',NULL),('skr',NULL),('test',NULL);
-insert into t1 select * from t2;
-select * from t1;
-drop table t1,t2;
-
-#
-# Test of auto_increment columns when they are set to 0
-#
-
-create table t1 (a int not null primary key auto_increment);
-insert into t1 values (0);
-update t1 set a=0;
-select * from t1;
-check table t1;
-drop table t1;
-
-#
-# Test negative values (Bug #1366)
-#
-
-create table t1 (a int not null auto_increment primary key);
-insert into t1 values (NULL);
-insert into t1 values (-1);
-select last_insert_id();
-insert into t1 values (NULL);
-select * from t1;
-drop table t1;
-
-create table t1 (a int not null auto_increment primary key) /*!40102 engine=heap */;
-insert into t1 values (NULL);
-insert into t1 values (-1);
-select last_insert_id();
-insert into t1 values (NULL);
-select * from t1;
-drop table t1;
-#
-# last_insert_id() madness
-#
-create table t1 (i tinyint unsigned not null auto_increment primary key);
-insert into t1 set i = 254;
-insert into t1 set i = null;
-select last_insert_id();
-explain extended select last_insert_id();
---error ER_DUP_ENTRY
-insert into t1 set i = 254;
-select last_insert_id();
---error HA_ERR_AUTOINC_ERANGE
-insert into t1 set i = null;
-select last_insert_id();
-drop table t1;
-
-create table t1 (i tinyint unsigned not null auto_increment, key (i));
-insert into t1 set i = 254;
-insert into t1 set i = null;
-select last_insert_id();
---error HA_ERR_AUTOINC_ERANGE
-insert into t1 set i = null;
-select last_insert_id();
-drop table t1;
-
-create table t1 (i tinyint unsigned not null auto_increment primary key, b int, unique (b));
-insert into t1 values (NULL, 10);
-select last_insert_id();
-insert into t1 values (NULL, 15);
-select last_insert_id();
---error ER_DUP_ENTRY
-insert into t1 values (NULL, 10);
-select last_insert_id();
-
-drop table t1;
-
-create table t1(a int auto_increment,b int null,primary key(a));
-SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
-insert into t1(a,b)values(NULL,1);
-insert into t1(a,b)values(200,2);
-insert into t1(a,b)values(0,3);
-insert into t1(b)values(4);
-insert into t1(b)values(5);
-insert into t1(b)values(6);
-insert into t1(b)values(7);
-select * from t1 order by b;
-alter table t1 modify b mediumint;
-select * from t1 order by b;
-create table t2 (a int);
-insert t2 values (1),(2);
-alter table t2 add b int auto_increment primary key;
-select * from t2;
-drop table t2;
-delete from t1 where a=0;
-update t1 set a=0 where b=5;
-select * from t1 order by b;
-delete from t1 where a=0;
-update t1 set a=NULL where b=6;
-update t1 set a=300 where b=7;
-SET SQL_MODE='';
-insert into t1(a,b)values(NULL,8);
-insert into t1(a,b)values(400,9);
-insert into t1(a,b)values(0,10);
-insert into t1(b)values(11);
-insert into t1(b)values(12);
-insert into t1(b)values(13);
-insert into t1(b)values(14);
-select * from t1 order by b;
-delete from t1 where a=0;
-update t1 set a=0 where b=12;
-select * from t1 order by b;
-delete from t1 where a=0;
-update t1 set a=NULL where b=13;
-update t1 set a=500 where b=14;
-select * from t1 order by b;
-drop table t1;
-
-#
-# Test of behavior of ALTER TABLE when coulmn containing NULL or zeroes is
-# converted to AUTO_INCREMENT column
-#
-create table t1 (a bigint);
-insert into t1 values (1), (2), (3), (NULL), (NULL);
-alter table t1 modify a bigint not null auto_increment primary key;
-select * from t1;
-drop table t1;
-
-create table t1 (a bigint);
-insert into t1 values (1), (2), (3), (0), (0);
-alter table t1 modify a bigint not null auto_increment primary key;
-select * from t1;
-drop table t1;
-
-# We still should be able to preserve zero in NO_AUTO_VALUE_ON_ZERO mode
-create table t1 (a bigint);
-insert into t1 values (0), (1), (2), (3);
-set sql_mode=NO_AUTO_VALUE_ON_ZERO;
-alter table t1 modify a bigint not null auto_increment primary key;
-set sql_mode= '';
-select * from t1;
-drop table t1;
-
-# It also sensible to preserve zeroes if we are converting auto_increment
-# column to auto_increment column (or not touching it at all, which is more
-# common case probably)
-create table t1 (a int auto_increment primary key , b int null);
-set sql_mode=NO_AUTO_VALUE_ON_ZERO;
-insert into t1 values (0,1),(1,2),(2,3);
-select * from t1;
-set sql_mode= '';
-alter table t1 modify b varchar(255);
-insert into t1 values (0,4);
-select * from t1;
-drop table t1;
-
-#
-# BUG #10045: Problem with composite AUTO_INCREMENT + BLOB key
-
-CREATE TABLE t1 ( a INT AUTO_INCREMENT, b BLOB, PRIMARY KEY (a,b(10)));
-INSERT INTO t1 (b) VALUES ('aaaa');
-CHECK TABLE t1;
-INSERT INTO t1 (b) VALUES ('');
-CHECK TABLE t1;
-INSERT INTO t1 (b) VALUES ('bbbb');
-CHECK TABLE t1;
-DROP TABLE IF EXISTS t1;
-
-# BUG #19025:
-
-CREATE TABLE `t1` (
- t1_name VARCHAR(255) DEFAULT NULL,
- t1_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
- KEY (t1_name),
- PRIMARY KEY (t1_id)
-) AUTO_INCREMENT = 1000;
-
-INSERT INTO t1 (t1_name) VALUES('MySQL');
-INSERT INTO t1 (t1_name) VALUES('MySQL');
-INSERT INTO t1 (t1_name) VALUES('MySQL');
-
-SELECT * from t1;
-
-SHOW CREATE TABLE `t1`;
-
-DROP TABLE `t1`;
-
-#
-# Bug #6880: LAST_INSERT_ID() within a statement
-#
-
-create table t1(a int not null auto_increment primary key);
-create table t2(a int not null auto_increment primary key, t1a int);
-insert into t1 values(NULL);
-insert into t2 values (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID());
-insert into t1 values (NULL);
-insert into t2 values (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID()),
-(NULL, LAST_INSERT_ID());
-insert into t1 values (NULL);
-insert into t2 values (NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID()),
-(NULL, LAST_INSERT_ID()), (NULL, LAST_INSERT_ID());
-select * from t2;
-drop table t1, t2;
-
---echo End of 4.1 tests
-
-#
-# Bug #11080 & #11005 Multi-row REPLACE fails on a duplicate key error
-#
-
-CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`));
-insert into t1 (b) values (1);
-replace into t1 (b) values (2), (1), (3);
-select * from t1;
-truncate table t1;
-insert into t1 (b) values (1);
-replace into t1 (b) values (2);
-replace into t1 (b) values (1);
-replace into t1 (b) values (3);
-select * from t1;
-drop table t1;
-
-create table t1 (rowid int not null auto_increment, val int not null,primary
-key (rowid), unique(val));
-replace into t1 (val) values ('1'),('2');
-replace into t1 (val) values ('1'),('2');
---error ER_DUP_ENTRY
-insert into t1 (val) values ('1'),('2');
-select * from t1;
-drop table t1;
-
-#
-# Test that update changes internal auto-increment value
-#
-
-create table t1 (a int not null auto_increment primary key, val int);
-insert into t1 (val) values (1);
-update t1 set a=2 where a=1;
-insert into t1 (val) values (1);
-select * from t1;
-drop table t1;
-
-#
-# Test key duplications with auto-increment in ALTER TABLE
-# bug #14573
-#
-CREATE TABLE t1 (t1 INT(10) PRIMARY KEY, t2 INT(10));
-INSERT INTO t1 VALUES(0, 0);
-INSERT INTO t1 VALUES(1, 1);
---error ER_DUP_ENTRY
-ALTER TABLE t1 CHANGE t1 t1 INT(10) auto_increment;
-DROP TABLE t1;
-
-# Test of REPLACE when it does INSERT+DELETE and not UPDATE:
-# see if it sets LAST_INSERT_ID() ok
-create table t1 (a int primary key auto_increment, b int, c int, d timestamp default current_timestamp, unique(b),unique(c));
-insert into t1 values(null,1,1,now());
-insert into t1 values(null,0,0,null);
-# this will delete two rows
-replace into t1 values(null,1,0,null);
-select last_insert_id();
-drop table t1;
-
-# Test of REPLACE when it does a INSERT+DELETE for all the conflicting rows
-# (i.e.) when there are three rows conflicting in unique key columns with
-# a row that is being inserted, all the three rows will be deleted and then
-# the new rows will be inserted.
-create table t1 (a int primary key auto_increment, b int, c int, e int, d timestamp default current_timestamp, unique(b),unique(c),unique(e));
-insert into t1 values(null,1,1,1,now());
-insert into t1 values(null,0,0,0,null);
-replace into t1 values(null,1,0,2,null);
-select last_insert_id();
-drop table t1;
-
---echo #
---echo # Bug#46616: Assertion `!table->auto_increment_field_not_null' on view
---echo # manipulations
---echo #
-CREATE TABLE t1 ( a INT );
-INSERT INTO t1 VALUES (1), (1);
-
-CREATE TABLE t2 ( a INT AUTO_INCREMENT KEY );
---error ER_DUP_ENTRY
-INSERT INTO t2 SELECT a FROM t1;
-
-UPDATE t2 SET a = 2;
-
-SELECT a FROM t2;
-
-DROP TABLE t1, t2;
-
---echo #
---echo # Bug#39828 autoinc wraps around when offset and increment > 1
---echo #
-
-CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) engine=MyISAM;
-INSERT INTO t1 VALUES(1);
-INSERT INTO t1 VALUES (18446744073709551601);
-
-SET @@SESSION.AUTO_INCREMENT_INCREMENT=10;
-
-SELECT @@SESSION.AUTO_INCREMENT_OFFSET;
---error HA_ERR_AUTOINC_ERANGE
-INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
-SELECT * FROM t1;
-
-SET @@SESSION.AUTO_INCREMENT_INCREMENT=default;
-SET @@SESSION.AUTO_INCREMENT_OFFSET=default;
-
-DROP TABLE t1;
-
---echo End of 5.1 tests
-
---echo #
---echo # Bug#50619 assert in handler::update_auto_increment
---echo #
-
-CREATE TABLE t1 (pk INT AUTO_INCREMENT, PRIMARY KEY (pk));
-# This triggered the assert
-INSERT INTO t1 VALUES (NULL), (-1), (NULL);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-# Check that that true overflow still gives error
-CREATE TABLE t1 (pk BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY (pk));
---error ER_AUTOINC_READ_FAILED
-INSERT INTO t1 VALUES (NULL), (18446744073709551615-1), (NULL);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-# MDEV-331 last_insert_id() returns a signed number
-# Check that last_insert_id() generates a signed value
-CREATE TABLE t1 (pk BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY (pk));
-insert into t1 values((1<<63)+1);
-insert into t1 values(null);
-select last_insert_id();
-select * from t1;
-drop table t1;
-
-CREATE TABLE t1 (pk BIGINT AUTO_INCREMENT, PRIMARY KEY (pk));
-insert into t1 values(-5);
-insert into t1 values(null);
-select last_insert_id();
-select * from t1;
-drop table t1;
diff --git a/mysql-test/t/auto_increment_ranges.inc b/mysql-test/t/auto_increment_ranges.inc
deleted file mode 100644
index dc60f07a700..00000000000
--- a/mysql-test/t/auto_increment_ranges.inc
+++ /dev/null
@@ -1,240 +0,0 @@
-#
-# Test of auto_increment at end of range
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
---echo #
---echo # Testing ranges with smallint
---echo #
-let $type=smallint;
-let $range_max=32767;
-
-eval create table t1 (a $type primary key auto_increment);
-eval insert into t1 values($range_max);
---error HA_ERR_AUTOINC_ERANGE
-insert into t1 values(NULL);
-truncate table t1;
-eval insert into t1 values($range_max-1);
-insert into t1 values(NULL);
---error HA_ERR_AUTOINC_ERANGE
-insert into t1 values(NULL);
-select * from t1;
-truncate table t1;
---error HA_ERR_AUTOINC_ERANGE
-eval insert into t1 values($range_max),(NULL);
-select * from t1;
-truncate table t1;
---error HA_ERR_AUTOINC_ERANGE
-eval insert into t1 values($range_max-1),(NULL),(NULL);
-truncate table t1;
-eval insert ignore into t1 values($range_max+1);
-select * from t1;
---error HA_ERR_AUTOINC_ERANGE
-eval insert into t1 values(NULL);
-drop table t1;
-
---echo #
---echo # Testing ranges with unsigned smallint
---echo #
-
-let $type=smallint unsigned;
-let $range_max=65535;
-
-eval create table t1 (a $type primary key auto_increment);
-eval insert into t1 values($range_max);
---error HA_ERR_AUTOINC_ERANGE
-insert into t1 values(NULL);
-truncate table t1;
-eval insert into t1 values($range_max-1);
-insert into t1 values(NULL);
---error HA_ERR_AUTOINC_ERANGE
-insert into t1 values(NULL);
-select * from t1;
-truncate table t1;
---error HA_ERR_AUTOINC_ERANGE
-eval insert into t1 values($range_max),(NULL);
-select * from t1;
-truncate table t1;
---error HA_ERR_AUTOINC_ERANGE
-eval insert into t1 values($range_max-1),(NULL),(NULL);
-truncate table t1;
-eval insert ignore into t1 values($range_max+1);
-select * from t1;
---error HA_ERR_AUTOINC_ERANGE
-eval insert into t1 values(NULL);
-drop table t1;
-
---echo #
---echo # Testing ranges with integer
---echo #
-
-let $type=int;
-let $range_max=2147483647;
-
-eval create table t1 (a $type primary key auto_increment);
-eval insert into t1 values($range_max);
---error HA_ERR_AUTOINC_ERANGE
-insert into t1 values(NULL);
-truncate table t1;
-eval insert into t1 values($range_max-1);
-insert into t1 values(NULL);
---error HA_ERR_AUTOINC_ERANGE
-insert into t1 values(NULL);
-select * from t1;
-truncate table t1;
---error HA_ERR_AUTOINC_ERANGE
-eval insert into t1 values($range_max),(NULL);
-select * from t1;
-truncate table t1;
---error HA_ERR_AUTOINC_ERANGE
-eval insert into t1 values($range_max-1),(NULL),(NULL);
-truncate table t1;
-eval insert ignore into t1 values($range_max+1);
-select * from t1;
---error HA_ERR_AUTOINC_ERANGE
-eval insert into t1 values(NULL);
-drop table t1;
-
---echo #
---echo # Testing ranges with unsigned integer
---echo #
-
-let $type=int unsigned;
-let $range_max=4294967295;
-
-eval create table t1 (a $type primary key auto_increment);
-eval insert into t1 values($range_max);
---error HA_ERR_AUTOINC_ERANGE
-insert into t1 values(NULL);
-truncate table t1;
-eval insert into t1 values($range_max-1);
-insert into t1 values(NULL);
---error HA_ERR_AUTOINC_ERANGE
-insert into t1 values(NULL);
-select * from t1;
-truncate table t1;
---error HA_ERR_AUTOINC_ERANGE
-eval insert into t1 values($range_max),(NULL);
-select * from t1;
-truncate table t1;
---error HA_ERR_AUTOINC_ERANGE
-eval insert into t1 values($range_max-1),(NULL),(NULL);
-truncate table t1;
-eval insert ignore into t1 values($range_max+1);
-select * from t1;
---error HA_ERR_AUTOINC_ERANGE
-eval insert into t1 values(NULL);
-drop table t1;
-
---echo #
---echo # Testing ranges with bigint
---echo #
-
-let $type=bigint;
-let $range_max=cast(9223372036854775807 as unsigned);
-
-eval create table t1 (a $type primary key auto_increment);
-eval insert into t1 values($range_max);
---error HA_ERR_AUTOINC_ERANGE
-insert into t1 values(NULL);
-truncate table t1;
-eval insert into t1 values($range_max-1);
-insert into t1 values(NULL);
---error HA_ERR_AUTOINC_ERANGE
-insert into t1 values(NULL);
-select * from t1;
-truncate table t1;
---error HA_ERR_AUTOINC_ERANGE
-eval insert into t1 values($range_max),(NULL);
-select * from t1;
-truncate table t1;
---error HA_ERR_AUTOINC_ERANGE
-eval insert into t1 values($range_max-1),(NULL),(NULL);
-truncate table t1;
-eval insert ignore into t1 values($range_max+1);
-select * from t1;
---error HA_ERR_AUTOINC_ERANGE
-eval insert into t1 values(NULL);
-drop table t1;
-
---echo #
---echo # Testing ranges with unsigned bigint
---echo #
-
-let $type=bigint unsigned;
-let $range_max=18446744073709551615;
-
-eval create table t1 (a $type primary key auto_increment);
-eval insert into t1 values($range_max-1);
---error ER_AUTOINC_READ_FAILED
-insert into t1 values(NULL);
---error ER_AUTOINC_READ_FAILED
-insert into t1 values(NULL);
-truncate table t1;
-eval insert into t1 values($range_max-1);
---error ER_AUTOINC_READ_FAILED
-insert into t1 values(NULL);
---error ER_AUTOINC_READ_FAILED
-insert into t1 values(NULL);
-select * from t1;
-truncate table t1;
---error ER_AUTOINC_READ_FAILED
-eval insert into t1 values($range_max),(NULL);
-select * from t1;
-truncate table t1;
---error ER_AUTOINC_READ_FAILED
-eval insert into t1 values($range_max-1),(NULL),(NULL);
-drop table t1;
-
---echo #
---echo # Test IGNORE and strict mode
---echo #
-create table t1 (a smallint primary key auto_increment);
-insert ignore into t1 values(32766),(NULL),(NULL),(1);
-select * from t1;
-truncate table t1;
-
-set @org_mode=@@sql_mode;
-set @@sql_mode='ansi,traditional';
-insert ignore into t1 values(32766),(NULL),(NULL);
-truncate table t1;
---error HA_ERR_AUTOINC_ERANGE
-insert into t1 values(32766),(NULL),(NULL);
-set @@sql_mode=@org_mode;
-drop table t1;
-
---echo #
---echo # Test auto increment with negative numbers
---echo #
-CREATE TABLE t1 (a INTEGER AUTO_INCREMENT, PRIMARY KEY (a));
-INSERT INTO t1 VALUES (NULL), (2), (-5), (NULL);
-INSERT INTO t1 VALUES (NULL);
-SELECT * FROM t1;
-TRUNCATE TABLE t1;
-INSERT INTO t1 VALUES (-5), (NULL);
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Test inserting a value out-of-range into an auto increment column
---echo #
-CREATE TABLE t1 (a smallint AUTO_INCREMENT, PRIMARY KEY (a));
-INSERT INTO t1 VALUES (2);
-INSERT IGNORE INTO t1 VALUES (32768);
---error HA_ERR_AUTOINC_ERANGE
-INSERT INTO t1 VALUES (NULL);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # Test old behaviour
---echo #
-create table t1 (a smallint primary key auto_increment);
-insert into t1 values(32766),(NULL);
-delete from t1 where a=32767;
---error HA_ERR_AUTOINC_ERANGE
-insert into t1 values(NULL);
-drop table t1;
diff --git a/mysql-test/t/auto_increment_ranges_innodb.test b/mysql-test/t/auto_increment_ranges_innodb.test
deleted file mode 100644
index c2afee7ac66..00000000000
--- a/mysql-test/t/auto_increment_ranges_innodb.test
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-# Test of auto_increment at end of range
-#
-
---source include/have_innodb.inc
-set default_storage_engine=innodb;
---source auto_increment_ranges.inc
diff --git a/mysql-test/t/auto_increment_ranges_myisam.test b/mysql-test/t/auto_increment_ranges_myisam.test
deleted file mode 100644
index 90e84377540..00000000000
--- a/mysql-test/t/auto_increment_ranges_myisam.test
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-# Test of auto_increment at end of range
-#
-
-set default_storage_engine=MYISAM;
---source auto_increment_ranges.inc
-
diff --git a/mysql-test/t/bad_frm_crash_5029.test b/mysql-test/t/bad_frm_crash_5029.test
deleted file mode 100644
index 858922886ab..00000000000
--- a/mysql-test/t/bad_frm_crash_5029.test
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# MDEV-5029 Crash in MariaDB 5.5.33 with .frm from older MariaDB release
-#
-# a.k.a. fail to open an frm with indexes:
-
-let $datadir=`select @@datadir`;
-
-# normal innodb table (but innodb is disabled here)
-copy_file std_data/mdev5029_1.frm $datadir/test/t1.frm;
---error ER_UNKNOWN_STORAGE_ENGINE
-show create table t1;
-remove_file $datadir/test/t1.frm;
-
-# Aria table, incorrect typecode
-call mtr.add_suppression("t1.frm is inconsistent: engine typecode 43, engine name Aria");
-copy_file std_data/mdev5029_2.frm $datadir/test/t1.frm;
-copy_file std_data/mdev5029_2.MAI $datadir/test/t1.MAI;
-copy_file std_data/mdev5029_2.MAD $datadir/test/t1.MAD;
-show create table t1;
-drop table t1;
diff --git a/mysql-test/t/bench_count_distinct.test b/mysql-test/t/bench_count_distinct.test
deleted file mode 100644
index 87e3d75e996..00000000000
--- a/mysql-test/t/bench_count_distinct.test
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Test of count(distinct ..)
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1(n int not null, key(n)) delay_key_write = 1;
-let $1=100;
---disable_query_log
-begin;
-while ($1)
-{
- eval insert into t1 values($1);
- eval insert into t1 values($1);
- dec $1;
-}
-commit;
---enable_query_log
-select count(distinct n) from t1;
-explain extended select count(distinct n) from t1;
-drop table t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test
deleted file mode 100644
index ae325c7d7de..00000000000
--- a/mysql-test/t/bigint.test
+++ /dev/null
@@ -1,418 +0,0 @@
-#
-# Initialize
-
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-
-#
-# Test of reading of bigint values
-#
-select 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296;
-select 9223372036854775807,-009223372036854775808;
-select +9999999999999999999,-9999999999999999999;
-select cast(9223372036854775808 as unsigned)+1;
-select 9223372036854775808+1;
-select -(0-3),round(-(0-3)), round(9999999999999999999);
-select 1,11,101,1001,10001,100001,1000001,10000001,100000001,1000000001,10000000001,100000000001,1000000000001,10000000000001,100000000000001,1000000000000001,10000000000000001,100000000000000001,1000000000000000001,10000000000000000001;
-select -1,-11,-101,-1001,-10001,-100001,-1000001,-10000001,-100000001,-1000000001,-10000000001,-100000000001,-1000000000001,-10000000000001,-100000000000001,-1000000000000001,-10000000000000001,-100000000000000001,-1000000000000000001,-10000000000000000001;
-select conv(1,10,16),conv((1<<2)-1,10,16),conv((1<<10)-2,10,16),conv((1<<16)-3,10,16),conv((1<<25)-4,10,16),conv((1<<31)-5,10,16),conv((1<<36)-6,10,16),conv((1<<47)-7,10,16),conv((1<<48)-8,10,16),conv((1<<55)-9,10,16),conv((1<<56)-10,10,16),conv((1<<63)-11,10,16);
-
-#
-# In 3.23 we have to disable the test of column to bigint as
-# this fails on AIX powerpc (the resolution for double is not good enough)
-# This will work on 4.0 as we then have internal handling of bigint variables.
-#
-
-create table t1 (a bigint unsigned not null, primary key(a));
-insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612);
-select * from t1;
-select * from t1 where a=18446744073709551615;
-# select * from t1 where a='18446744073709551615';
-delete from t1 where a=18446744073709551615;
-select * from t1;
-drop table t1;
-
-create table t1 ( a int not null default 1, big bigint );
-insert into t1 (big) values (-1),(12345678901234567),(9223372036854775807),(18446744073709551615);
-select * from t1;
-select min(big),max(big),max(big)-1 from t1;
-select min(big),max(big),max(big)-1 from t1 group by a;
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-alter table t1 modify big bigint unsigned not null;
-select min(big),max(big),max(big)-1 from t1;
-select min(big),max(big),max(big)-1 from t1 group by a;
-insert into t1 (big) values (18446744073709551615);
-select * from t1;
-select min(big),max(big),max(big)-1 from t1;
-select min(big),max(big),max(big)-1 from t1 group by a;
-alter table t1 add key (big);
-select min(big),max(big),max(big)-1 from t1;
-select min(big),max(big),max(big)-1 from t1 group by a;
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-alter table t1 modify big bigint not null;
-select * from t1;
-select min(big),max(big),max(big)-1 from t1;
-select min(big),max(big),max(big)-1 from t1 group by a;
-drop table t1;
-
-#
-# Test problem with big values for auto_increment
-#
-
-create table t1 (id bigint auto_increment primary key, a int) auto_increment=9999999999;
-insert into t1 values (null,1);
-select * from t1;
-select * from t1 limit 9999999999;
-drop table t1;
-
-#
-# Item_uint::save_to_field()
-# BUG#1845
-# This can't be fixed in MySQL 4.0 without loosing precisions for bigints
-#
-
-CREATE TABLE t1 ( quantity decimal(60,0));
-insert into t1 values (10000000000000000000);
-insert into t1 values (10000000000000000000.0);
-insert into t1 values ('10000000000000000000');
-select * from t1;
-drop table t1;
-
-# atof() behaviour is different of different systems. to be fixed in 4.1
-SELECT '0x8000000000000001'+0;
-
-# Test for BUG#8562: joins over BIGINT UNSIGNED value + constant propagation
-create table t1 (
- value64 bigint unsigned not null,
- value32 integer not null,
- primary key(value64, value32)
-);
-
-create table t2 (
- value64 bigint unsigned not null,
- value32 integer not null,
- primary key(value64, value32)
-);
-
-insert into t1 values(17156792991891826145, 1);
-insert into t1 values( 9223372036854775807, 2);
-insert into t2 values(17156792991891826145, 3);
-insert into t2 values( 9223372036854775807, 4);
-
-select * from t1;
-select * from t2;
-
-select * from t1, t2 where t1.value64=17156792991891826145 and
-t2.value64=17156792991891826145;
-select * from t1, t2 where t1.value64=17156792991891826145 and
-t2.value64=t1.value64;
-
-select * from t1, t2 where t1.value64= 9223372036854775807 and
-t2.value64=9223372036854775807;
-select * from t1, t2 where t1.value64= 9223372036854775807 and
-t2.value64=t1.value64;
-
-drop table t1, t2;
-
-# Test for BUG#30069, can't handle bigint -9223372036854775808 on
-# x86_64, with some GCC versions and optimizations.
-
-create table t1 (sint64 bigint not null);
-insert into t1 values (-9223372036854775808);
-select * from t1;
-
-drop table t1;
-
-# End of 4.1 tests
-
-#
-# Test of CREATE ... SELECT and unsigned integers
-#
-
-create table t1 select 1 as 'a';
-show create table t1;
-drop table t1;
-create table t1 select 9223372036854775809 as 'a';
-show create table t1;
-select * from t1;
-drop table t1;
-DROP DATABASE IF EXISTS `scott`;
-
-
-#
-# Check various conversions from/to unsigned bigint.
-#
-
-create table t1 (a char(100), b varchar(100), c text, d blob);
-insert into t1 values(
- 18446744073709551615,18446744073709551615,
- 18446744073709551615, 18446744073709551615
-);
-
-insert into t1 values (-1 | 0,-1 | 0,-1 | 0 ,-1 | 0);
-select * from t1;
-drop table t1;
-
-create table t1 ( quantity decimal(2) unsigned);
-insert ignore into t1 values (500), (-500), (~0), (-1);
-select * from t1;
-drop table t1;
-
-#
-# Test of storing decimal values in BIGINT range
-# (Bug #12750: Incorrect storage of 9999999999999999999 in DECIMAL(19, 0))
-#
-
-CREATE TABLE t1 (
- `col1` INT(1) NULL,
- `col2` INT(2) NULL,
- `col3` INT(3) NULL,
- `col4` INT(4) NULL,
- `col5` INT(5) NULL,
- `col6` INT(6) NULL,
- `col7` INT(7) NULL,
- `col8` INT(8) NULL,
- `col9` INT(9) NULL,
- `col10` BIGINT(10) NULL,
- `col11` BIGINT(11) NULL,
- `col12` BIGINT(12) NULL,
- `col13` BIGINT(13) NULL,
- `col14` BIGINT(14) NULL,
- `col15` BIGINT(15) NULL,
- `col16` BIGINT(16) NULL,
- `col17` BIGINT(17) NULL,
- `col18` BIGINT(18) NULL,
- `col19` DECIMAL(19, 0) NULL,
- `col20` DECIMAL(20, 0) NULL,
- `col21` DECIMAL(21, 0) NULL,
- `col22` DECIMAL(22, 0) NULL,
- `col23` DECIMAL(23, 0) NULL,
- `col24` DECIMAL(24, 0) NULL,
- `col25` DECIMAL(25, 0) NULL,
- `col26` DECIMAL(26, 0) NULL,
- `col27` DECIMAL(27, 0) NULL,
- `col28` DECIMAL(28, 0) NULL,
- `col29` DECIMAL(29, 0) NULL,
- `col30` DECIMAL(30, 0) NULL,
- `col31` DECIMAL(31, 0) NULL,
- `col32` DECIMAL(32, 0) NULL,
- `col33` DECIMAL(33, 0) NULL,
- `col34` DECIMAL(34, 0) NULL,
- `col35` DECIMAL(35, 0) NULL,
- `col36` DECIMAL(36, 0) NULL,
- `col37` DECIMAL(37, 0) NULL,
- `col38` DECIMAL(38, 0) NULL,
- `fix1` DECIMAL(38, 1) NULL,
- `fix2` DECIMAL(38, 2) NULL,
- `fix3` DECIMAL(38, 3) NULL,
- `fix4` DECIMAL(38, 4) NULL,
- `fix5` DECIMAL(38, 5) NULL,
- `fix6` DECIMAL(38, 6) NULL,
- `fix7` DECIMAL(38, 7) NULL,
- `fix8` DECIMAL(38, 8) NULL,
- `fix9` DECIMAL(38, 9) NULL,
- `fix10` DECIMAL(38, 10) NULL,
- `fix11` DECIMAL(38, 11) NULL,
- `fix12` DECIMAL(38, 12) NULL,
- `fix13` DECIMAL(38, 13) NULL,
- `fix14` DECIMAL(38, 14) NULL,
- `fix15` DECIMAL(38, 15) NULL,
- `fix16` DECIMAL(38, 16) NULL,
- `fix17` DECIMAL(38, 17) NULL,
- `fix18` DECIMAL(38, 18) NULL,
- `fix19` DECIMAL(38, 19) NULL,
- `fix20` DECIMAL(38, 20) NULL,
- `fix21` DECIMAL(38, 21) NULL,
- `fix22` DECIMAL(38, 22) NULL,
- `fix23` DECIMAL(38, 23) NULL,
- `fix24` DECIMAL(38, 24) NULL,
- `fix25` DECIMAL(38, 25) NULL,
- `fix26` DECIMAL(38, 26) NULL,
- `fix27` DECIMAL(38, 27) NULL,
- `fix28` DECIMAL(38, 28) NULL,
- `fix29` DECIMAL(38, 29) NULL,
- `fix30` DECIMAL(38, 30) NULL
-);
-
-INSERT INTO t1(`col1`, `col2`, `col3`, `col4`, `col5`, `col6`, `col7`, `col8`, `col9`, `col10`, `col11`, `col12`, `col13`, `col14`, `col15`, `col16`, `col17`, `col18`, `col19`, `col20`, `col21`, `col22`, `col23`, `col24`, `col25`, `col26`, `col27`, `col28`, `col29`, `col30`, `col31`, `col32`, `col33`, `col34`, `col35`, `col36`, `col37`, `col38`, `fix1`, `fix2`, `fix3`, `fix4`, `fix5`, `fix6`, `fix7`, `fix8`, `fix9`, `fix10`, `fix11`, `fix12`, `fix13`, `fix14`, `fix15`, `fix16`, `fix17`, `fix18`, `fix19`, `fix20`, `fix21`, `fix22`, `fix23`, `fix24`, `fix25`, `fix26`, `fix27`, `fix28`, `fix29`, `fix30`)
-VALUES (9, 99, 999, 9999, 99999, 999999, 9999999, 99999999, 999999999,
-9999999999, 99999999999, 999999999999, 9999999999999, 99999999999999,
-999999999999999, 9999999999999999, 99999999999999999, 999999999999999999,
-9999999999999999999, 99999999999999999999, 999999999999999999999,
-9999999999999999999999, 99999999999999999999999, 999999999999999999999999,
-9999999999999999999999999, 99999999999999999999999999,
-999999999999999999999999999, 9999999999999999999999999999,
-99999999999999999999999999999, 999999999999999999999999999999,
-9999999999999999999999999999999, 99999999999999999999999999999999,
-999999999999999999999999999999999, 9999999999999999999999999999999999,
-99999999999999999999999999999999999, 999999999999999999999999999999999999,
-9999999999999999999999999999999999999, 99999999999999999999999999999999999999,
-9999999999999999999999999999999999999.9,
-999999999999999999999999999999999999.99,
-99999999999999999999999999999999999.999,
-9999999999999999999999999999999999.9999,
-999999999999999999999999999999999.99999,
-99999999999999999999999999999999.999999,
-9999999999999999999999999999999.9999999,
-999999999999999999999999999999.99999999,
-99999999999999999999999999999.999999999,
-9999999999999999999999999999.9999999999,
-999999999999999999999999999.99999999999,
-99999999999999999999999999.999999999999,
-9999999999999999999999999.9999999999999,
-999999999999999999999999.99999999999999,
-99999999999999999999999.999999999999999,
-9999999999999999999999.9999999999999999,
-999999999999999999999.99999999999999999,
-99999999999999999999.999999999999999999,
-9999999999999999999.9999999999999999999,
-999999999999999999.99999999999999999999,
-99999999999999999.999999999999999999999,
-9999999999999999.9999999999999999999999,
-999999999999999.99999999999999999999999,
-99999999999999.999999999999999999999999,
-9999999999999.9999999999999999999999999,
-999999999999.99999999999999999999999999,
-99999999999.999999999999999999999999999,
-9999999999.9999999999999999999999999999,
-999999999.99999999999999999999999999999,
-99999999.999999999999999999999999999999);
-
-SELECT * FROM t1;
-DROP TABLE t1;
-
-#bug #9088 BIGINT WHERE CLAUSE
-create table t1 (bigint_col bigint unsigned);
-insert into t1 values (17666000000000000000);
-select * from t1 where bigint_col=17666000000000000000;
-select * from t1 where bigint_col='17666000000000000000';
-drop table t1;
-
---echo
---echo bug 19955 -- mod is signed with bigint
-
-select cast(10000002383263201056 as unsigned) mod 50 as result;
-
-create table t1 (c1 bigint unsigned);
-insert into t1 values (10000002383263201056);
-select c1 mod 50 as result from t1;
-drop table t1;
-
-#
-# Bug #8663 cant use bgint unsigned as input to cast
-#
-
-select cast(19999999999999999999 as signed);
-select cast(-19999999999999999999 as signed);
-
-#
-# Bug #28625: -9223372036854775808 doesn't fit in BIGINT.
-#
-
-# PS protocol gives different metadata for `Max length' column
---disable_ps_protocol
---enable_metadata
-select -9223372036854775808;
-select -(9223372036854775808);
-select -((9223372036854775808));
-select -(-(9223372036854775808));
---disable_metadata
---enable_ps_protocol
-select --9223372036854775808, ---9223372036854775808, ----9223372036854775808;
-select -(-9223372036854775808), -(-(-9223372036854775808));
-
-# Bug #28005 Partitions: can't use -9223372036854775808
-create table t1 select -9223372036854775808 bi;
-describe t1;
-drop table t1;
-create table t1 select -9223372036854775809 bi;
-describe t1;
-drop table t1;
-
---echo #
---echo # Bug #45360: wrong results
---echo #
-
-CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY,
- a BIGINT(20) UNSIGNED,
- b VARCHAR(20));
-
-INSERT INTO t1 (a) VALUES
- (0),
- (CAST(0x7FFFFFFFFFFFFFFF AS UNSIGNED)),
- (CAST(0x8000000000000000 AS UNSIGNED)),
- (CAST(0xFFFFFFFFFFFFFFFF AS UNSIGNED));
-
-UPDATE t1 SET b = a;
-
-let $n = `SELECT MAX(id) FROM t1`;
-while($n) {
- let $x = `SELECT a FROM t1 WHERE id = $n`;
- dec $n;
- let $hex = `SELECT HEX($x)`;
- echo # $hex;
-
- --disable_result_log
- eval EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE a = $x AND TRIM(a) = b;
- --enable_result_log
- SHOW WARNINGS;
-}
-
-DROP TABLE t1;
-
---echo # End of 5.1 tests
-
---echo #
---echo # Bug#13463415 63502: INCORRECT RESULTS OF BIGINT AND DECIMAL COMPARISON
---echo #
-
-CREATE TABLE t_bigint(id BIGINT);
-INSERT INTO t_bigint VALUES (1), (2);
-
-SELECT id, id >= 1.1 FROM t_bigint;
-SELECT id, 1.1 <= id FROM t_bigint;
-
-SELECT id, id = 1.1 FROM t_bigint;
-SELECT id, 1.1 = id FROM t_bigint;
-
-SELECT * from t_bigint WHERE id = 1.1;
-SELECT * from t_bigint WHERE id = 1.1e0;
-SELECT * from t_bigint WHERE id = '1.1';
-SELECT * from t_bigint WHERE id = '1.1e0';
-
-SELECT * from t_bigint WHERE id IN (1.1, 2.2);
-SELECT * from t_bigint WHERE id IN (1.1e0, 2.2e0);
-SELECT * from t_bigint WHERE id IN ('1.1', '2.2');
-SELECT * from t_bigint WHERE id IN ('1.1e0', '2.2e0');
-
-SELECT * from t_bigint WHERE id BETWEEN 1.1 AND 1.9;
-SELECT * from t_bigint WHERE id BETWEEN 1.1e0 AND 1.9e0;
-SELECT * from t_bigint WHERE id BETWEEN '1.1' AND '1.9';
-SELECT * from t_bigint WHERE id BETWEEN '1.1e0' AND '1.9e0';
-
-DROP TABLE t_bigint;
-
---echo #
---echo # Bug#11758543 50756: BIGINT '100' MATCHES 1.001E2
---echo #
-
-CREATE TABLE t1 (a BIGINT);
-INSERT INTO t1 VALUES (1);
-
-# a. These queries correctly return 0 rows:
-SELECT * FROM t1 WHERE coalesce(a) BETWEEN 0 and 0.9;
-SELECT * FROM t1 WHERE coalesce(a)=0.9;
-SELECT * FROM t1 WHERE coalesce(a) in (0.8,0.9);
-
-# b. These queries mistakenely returned 1 row:
-SELECT * FROM t1 WHERE a BETWEEN 0 AND 0.9;
-SELECT * FROM t1 WHERE a=0.9;
-SELECT * FROM t1 WHERE a IN (0.8,0.9);
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-9372 select 100 between 1 and 9223372036854775808 returns false
---echo #
-SELECT 100 BETWEEN 1 AND 9223372036854775808;
diff --git a/mysql-test/t/binary.test b/mysql-test/t/binary.test
deleted file mode 100644
index 1cc6ae07675..00000000000
--- a/mysql-test/t/binary.test
+++ /dev/null
@@ -1,141 +0,0 @@
-#
-# test sort,min and max on binary fields
-#
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-create table t1 (name char(20) not null, primary key (name));
-create table t2 (name char(20) binary not null, primary key (name));
-insert into t1 values ("");
-insert into t1 values ("");
-insert into t1 values ("");
-insert into t2 select * from t1;
-
-select * from t1 order by name;
-select concat("*",name,"*") from t1 order by 1;
-select min(name),min(concat("*",name,"*")),max(name),max(concat("*",name,"*")) from t1;
-select * from t2 order by name;
-select concat("*",name,"*") from t2 order by 1;
-select min(name),min(concat("*",name,"*")),max(name),max(concat("*",name,"*")) from t2;
-select name from t1 where name between '' and '';
-select name from t2 where name between '' and '';
-select name from t2 where name between '' and '';
-
-drop table t1,t2;
-
-#
-# Test of binary and normal strings
-#
-
-create table t1 (a char(10) not null, b char(10) binary not null,key (a), key(b));
-insert into t1 values ("hello ","hello "),("hello2 ","hello2 ");
-select concat("-",a,"-",b,"-") from t1 where a="hello";
-select concat("-",a,"-",b,"-") from t1 where a="hello ";
-select concat("-",a,"-",b,"-") from t1 ignore index (a) where a="hello ";
-select concat("-",a,"-",b,"-") from t1 where b="hello";
-select concat("-",a,"-",b,"-") from t1 where b="hello ";
-select concat("-",a,"-",b,"-") from t1 ignore index (b) where b="hello ";
-# blob test
-alter table t1 modify b tinytext not null, drop key b, add key (b(100));
-select concat("-",a,"-",b,"-") from t1;
-select concat("-",a,"-",b,"-") from t1 where b="hello ";
-select concat("-",a,"-",b,"-") from t1 ignore index (b) where b="hello ";
-drop table t1;
-
-#
-# Test of binary and NULL
-#
-create table t1 (b char(8));
-insert into t1 values(NULL);
-select b from t1 where binary b like '';
-select b from t1 group by binary b like '';
-select b from t1 having binary b like '';
-drop table t1;
-
-#
-# Test of binary and upper/lower
-#
-create table t1 (a char(3) binary, b binary(3));
-insert into t1 values ('aaa','bbb'),('AAA','BBB');
-select upper(a),upper(b) from t1;
-select lower(a),lower(b) from t1;
-select * from t1 where upper(a)='AAA';
-select * from t1 where lower(a)='aaa';
-select * from t1 where upper(b)='BBB';
-select * from t1 where lower(b)='bbb';
-select charset(a), charset(b), charset(binary 'ccc') from t1 limit 1;
-select collation(a), collation(b), collation(binary 'ccc') from t1 limit 1;
-drop table t1;
-
-#
-# Bug5134: WHERE x = 'bar' AND x LIKE BINARY 'bar' returns wrong results
-#
-
-create table t1( firstname char(20), lastname char(20));
-insert into t1 values ("john","doe"),("John","Doe");
-select * from t1 where firstname='john' and firstname like binary 'john';
-select * from t1 where firstname='john' and binary 'john' = firstname;
-select * from t1 where firstname='john' and firstname = binary 'john';
-select * from t1 where firstname='John' and firstname like binary 'john';
-select * from t1 where firstname='john' and firstname like binary 'John';
-drop table t1;
-
-#
-# Bug #6552 CHAR column w/o length is legal, BINARY w/o length is not
-#
-create table t1 (a binary);
-show create table t1;
-drop table t1;
-
-# End of 4.1 tests
-
-#
-# Bug#16857
-#
-create table t1 (col1 binary(4));
-insert into t1 values ('a'),('a ');
-select hex(col1) from t1;
-alter table t1 modify col1 binary(10);
-select hex(col1) from t1;
-insert into t1 values ('b'),('b ');
-select hex(col1) from t1;
-drop table t1;
-
-#
-# Bug #29087: assertion abort for a search in a BINARY non-nullable index
-# by a key with trailing spaces
-#
-
-CREATE TABLE t1 (
- a binary(20) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
- index idx(a)
-);
-INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029087575');
-INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020');
-INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029080707');
-
-SELECT hex(a) FROM t1 order by a;
-EXPLAIN SELECT hex(a) FROM t1 order by a;
-
-SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020');
-EXPLAIN
-SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020');
-
-SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF02908');
-
-DROP TABLE t1;
-
-CREATE TABLE t1 (
- id numeric(20) NOT NULL,
- lang varchar(8) NOT NULL,
- msg varchar(32) NOT NULL,
- PRIMARY KEY (id,lang)
-);
-INSERT INTO t1 VALUES (33, 'en', 'zzzzzzz');
-INSERT INTO t1 VALUES (31, 'en', 'xxxxxxx');
-INSERT INTO t1 VALUES (32, 'en', 'yyyyyyy');
-SELECT * FROM t1 WHERE id=32;
-
-DROP TABLE t1;
-
diff --git a/mysql-test/t/binary_to_hex.test b/mysql-test/t/binary_to_hex.test
deleted file mode 100644
index be4fb301e40..00000000000
--- a/mysql-test/t/binary_to_hex.test
+++ /dev/null
@@ -1,96 +0,0 @@
-# === Purpose ===
-# The purpose of this test case is to make
-# sure that the binary data in tables is printed
-# as hex when the option binary-as-hex is enabled.
-#
-# === Related bugs and/or worklogs ===
-# Bug #25340722 - PRINT BINARY DATA AS HEX IN THE MYSQL
-# CLIENT (CONTRIBUTION)
-#
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
---source include/not_embedded.inc
-
-USE test;
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-CREATE TABLE t1 (c1 TINYBLOB,
- c2 BLOB,
- c3 MEDIUMBLOB,
- c4 LONGBLOB,
- c5 TEXT,
- c6 BIT(1),
- c7 CHAR,
- c8 VARCHAR(10),
- c9 GEOMETRY) CHARACTER SET = binary;
-
-SHOW CREATE TABLE t1;
-
-INSERT INTO t1 VALUES ('tinyblob-text readable', 'blob-text readable',
- 'mediumblob-text readable', 'longblob-text readable',
- 'text readable', b'1', 'c', 'variable',
- POINT(1, 1));
-
-CREATE TABLE t2(id int, `col1` binary(10),`col2` blob);
-
-SHOW CREATE TABLE t2;
-
-INSERT INTO t2 VALUES (1, X'AB1234', X'123ABC'), (2, X'DE1234', X'123DEF');
-
---echo #Print the table contents when binary-as-hex option is off.
---replace_column 6 # 9 #
-SELECT * FROM t1;
-
---replace_column 2 # 3 #
-SELECT * FROM t2;
-
---echo #Print the table contents after turning on the binary-as-hex option
---echo
---echo #Print the table contents in tab format
---echo
---exec $MYSQL test --binary-as-hex -e "SELECT * FROM t1; SELECT * FROM t2;"
---echo
---echo #Print the table contents in table format
---echo
---exec $MYSQL test --binary-as-hex --table -e "SELECT * FROM t1; SELECT * FROM t2 WHERE col2=0x123ABC;"
---echo
---echo #Print the table contents vertically
---echo
---exec $MYSQL test --binary-as-hex --vertical -e "SELECT * FROM t1;"
---echo
---echo #Print the table contents in xml format
---echo
---exec $MYSQL test --binary-as-hex --xml -e "SELECT * FROM t1; SELECT * FROM t2;"
---echo
---echo #Print the table contents in html format
---echo
---exec $MYSQL test --binary-as-hex --html -e "SELECT * FROM t1; SELECT * FROM t2;"
-
-#Cleanup
-DROP TABLE t1, t2;
-
-# MDEV-14593 human-readable XA RECOVER
-
-create table t1 (a int);
-
---write_file $MYSQLTEST_VARDIR/tmp/mdev-14593.sql
-DELIMITER /
-XA START 'tr1', 'bq'/
-INSERT INTO t1 VALUES (0)/
-XA END 'tr1', 'bq'/
-XA PREPARE 'tr1', 'bq'/
-XA RECOVER/
-XA ROLLBACK 'tr1', 'bq'/
-EOF
---exec $MYSQL test --binary-as-hex < $MYSQLTEST_VARDIR/tmp/mdev-14593.sql 2>&1
-remove_file $MYSQLTEST_VARDIR/tmp/mdev-14593.sql;
-
-
-#Cleanup
-DROP TABLE t1;
-
-# Wait till all disconnects are completed
- --source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/blackhole.test b/mysql-test/t/blackhole.test
deleted file mode 100644
index 7f394e0f846..00000000000
--- a/mysql-test/t/blackhole.test
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# Tests for the BLACKHOLE storage engine
-#
-
---source include/have_blackhole.inc
-
---echo #
---echo # Bug #11880012: INDEX_SUBQUERY, BLACKHOLE,
---echo # HANG IN PREPARING WITH 100% CPU USAGE
---echo #
-
-CREATE TABLE t1(a INT NOT NULL);
-INSERT INTO t1 VALUES (1), (2), (3);
-CREATE TABLE t2 (a INT UNSIGNED, b INT, UNIQUE KEY (a, b)) ENGINE=BLACKHOLE;
-
-SELECT 1 FROM t1 WHERE a = ANY (SELECT a FROM t2);
-
-DROP TABLE t1, t2;
-
-#
-# Bug#19786309 - CRASH IN UNLOCK TABLES AFTER LOCKING AND TRUNCATING TEMPORARY TABLE.
-#
-create temporary table t1 (a int) engine=blackhole;
-lock table t1 write;
-truncate table t1;
-select * from t1;
-unlock tables;
-drop temporary table t1;
-
---echo End of 5.5 tests
-
---echo #
---echo # Bug#13948247 DIVISION BY 0 IN GET_BEST_DISJUNCT_QUICK WITH FORCE INDEX GROUP BY
---echo #
-
-CREATE TABLE t1(a INT, b INT, c INT, KEY(c), UNIQUE(a)) ENGINE = BLACKHOLE;
-SELECT 0 FROM t1 FORCE INDEX FOR GROUP BY(a) WHERE a = 0 OR b = 0 AND c = 0;
-DROP TABLE t1;
-
---echo End of 5.6 tests
diff --git a/mysql-test/t/blackhole_plugin.test b/mysql-test/t/blackhole_plugin.test
deleted file mode 100644
index 487fc5656f2..00000000000
--- a/mysql-test/t/blackhole_plugin.test
+++ /dev/null
@@ -1,33 +0,0 @@
-if (!$HA_BLACKHOLE_SO) {
- --skip Need blackhole plugin
-}
-set sql_mode="";
-CREATE TABLE t1(a int) ENGINE=BLACKHOLE;
-set sql_mode=default;
-DROP TABLE t1;
---replace_regex /\.dll/.so/
-eval INSTALL PLUGIN blackhole SONAME '$HA_BLACKHOLE_SO';
---replace_regex /\.dll/.so/
---error ER_PLUGIN_INSTALLED
-eval INSTALL PLUGIN BLACKHOLE SONAME '$HA_BLACKHOLE_SO';
-
-UNINSTALL PLUGIN blackhole;
---replace_regex /\.dll/.so/
-eval INSTALL PLUGIN blackhole SONAME '$HA_BLACKHOLE_SO';
-
-CREATE TABLE t1(a int) ENGINE=BLACKHOLE;
-
-DROP TABLE t1;
-
-# This dummy statement is required for --ps-protocol mode.
-# The thing is that last prepared statement is "cached" in mysqltest.cc
-# (unless "reconnect" is enabled, and that's not the case here).
-# This statement forces mysqltest.cc to close prepared "DROP TABLE t1".
-# Otherwise, the plugin can not be uninstalled because there is an active
-# prepared statement using it.
-SELECT 1;
-
-UNINSTALL PLUGIN blackhole;
---error ER_SP_DOES_NOT_EXIST
-UNINSTALL PLUGIN blackhole;
-
diff --git a/mysql-test/t/bool.test b/mysql-test/t/bool.test
deleted file mode 100644
index 34c51c648d3..00000000000
--- a/mysql-test/t/bool.test
+++ /dev/null
@@ -1,62 +0,0 @@
-#
-# Test of boolean operations with NULL
-#
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-SELECT IF(NULL AND 1, 1, 2), IF(1 AND NULL, 1, 2);
-SELECT NULL AND 1, 1 AND NULL, 0 AND NULL, NULL and 0;
-
-create table t1 (a int);
-insert into t1 values (0),(1),(NULL);
-SELECT * FROM t1 WHERE IF(a AND 1, 0, 1);
-SELECT * FROM t1 WHERE IF(1 AND a, 0, 1);
-SELECT * FROM t1 where NOT(a AND 1);
-SELECT * FROM t1 where NOT(1 AND a);
-SELECT * FROM t1 where (a AND 1)=0;
-SELECT * FROM t1 where (1 AND a)=0;
-SELECT * FROM t1 where (1 AND a)=1;
-SELECT * FROM t1 where (1 AND a) IS NULL;
-
-# WL#638 - Behaviour of NOT does not follow SQL specification
-set sql_mode='high_not_precedence';
-select * from t1 where not a between 2 and 3;
-set sql_mode=default;
-select * from t1 where not a between 2 and 3;
-
-# SQL boolean tests
-select a, a is false, a is true, a is unknown from t1;
-select a, a is not false, a is not true, a is not unknown from t1;
-
-# Verify that NULL optimisation works in AND clause:
-SET @a=0, @b=0;
-SELECT * FROM t1 WHERE NULL AND (@a:=@a+1);
-SELECT * FROM t1 WHERE NOT(a>=0 AND NULL AND (@b:=@b+1));
-SELECT * FROM t1 WHERE a=2 OR (NULL AND (@a:=@a+1));
-SELECT * FROM t1 WHERE NOT(a=2 OR (NULL AND (@b:=@b+1)));
-DROP TABLE t1;
-
-
-# Test boolean operators in select part
-# NULLs are represented as N for readability
-# Read nA as !A, AB as A && B, AoB as A || B
-# Result table makes ANSI happy
-
-create table t1 (a int, b int);
-insert into t1 values(null, null), (0, null), (1, null), (null, 0), (null, 1), (0, 0), (0, 1), (1, 0), (1, 1);
-
-# Below test is valid untill we have True/False implemented as 1/0
-# To comply to all rules it must show that: n(AB) = nAonB, n(AoB) = nAnB
-
-select ifnull(A, 'N') as A, ifnull(B, 'N') as B, ifnull(not A, 'N') as nA, ifnull(not B, 'N') as nB, ifnull(A and B, 'N') as AB, ifnull(not (A and B), 'N') as `n(AB)`, ifnull((not A or not B), 'N') as nAonB, ifnull(A or B, 'N') as AoB, ifnull(not(A or B), 'N') as `n(AoB)`, ifnull(not A and not B, 'N') as nAnB from t1;
-
-# This should work with any internal representation of True/False
-# Result must be same as above
-
-select ifnull(A=1, 'N') as A, ifnull(B=1, 'N') as B, ifnull(not (A=1), 'N') as nA, ifnull(not (B=1), 'N') as nB, ifnull((A=1) and (B=1), 'N') as AB, ifnull(not ((A=1) and (B=1)), 'N') as `n(AB)`, ifnull((not (A=1) or not (B=1)), 'N') as nAonB, ifnull((A=1) or (B=1), 'N') as AoB, ifnull(not((A=1) or (B=1)), 'N') as `n(AoB)`, ifnull(not (A=1) and not (B=1), 'N') as nAnB from t1;
-
-drop table t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/bootstrap-master.opt b/mysql-test/t/bootstrap-master.opt
deleted file mode 100644
index 96f0ce3f36c..00000000000
--- a/mysql-test/t/bootstrap-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---default-storage-engine=MyISAM
diff --git a/mysql-test/t/bootstrap.test b/mysql-test/t/bootstrap.test
deleted file mode 100644
index 1ae9b13e050..00000000000
--- a/mysql-test/t/bootstrap.test
+++ /dev/null
@@ -1,108 +0,0 @@
-#
-# test mysqld in bootstrap mode
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-# Add the datadir to the bootstrap command
-let $MYSQLD_DATADIR= `select @@datadir`;
-let $MYSQLD_BOOTSTRAP_CMD= $MYSQLD_BOOTSTRAP_CMD --datadir=$MYSQLD_DATADIR --default-storage-engine=MyISAM --loose-skip-innodb --plugin-maturity=unknown;
-#
-# Check that --bootstrap reads from stdin
-#
---write_file $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql
-use test;
-CREATE TABLE t1(a int);
-EOF
---exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
-drop table t1;
-remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_test.sql;
-#
-# Check that --bootstrap of file with SQL error returns error
-#
---write_file $MYSQLTEST_VARDIR/tmp/bootstrap_error.sql
-use test;
-CREATE TABLE t1;
-EOF
---error 1
---exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/bootstrap_error.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
-# Table t1 should not exists
---error 1051
-drop table t1;
-remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_error.sql;
-
-#
-# Bootstrap with a query larger than 2*thd->net.max_packet
-#
-set @my_max_allowed_packet= @@max_allowed_packet;
-set global max_allowed_packet=64*@@max_allowed_packet;
---disable_query_log
-create table t1 select 2 as a, concat(repeat('MySQL', @@max_allowed_packet/10), ';') as b;
-eval select * into outfile '$MYSQLTEST_VARDIR/tmp/long_query.sql' from t1;
---enable_query_log
---error 1
---exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/long_query.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
-remove_file $MYSQLTEST_VARDIR/tmp/long_query.sql;
-
-set global max_allowed_packet=@my_max_allowed_packet;
-drop table t1;
-
---echo End of 5.1 tests
-
---echo #
---echo # Bug #11766306: 59393: HAVE_INNODB=YES WHEN MYSQLD
---echo # STARTED WITH --SKIP-INNODB
---echo #
-
-# need the --skip-innodb option present for the test to succeed
-SELECT 'bug' as '' FROM INFORMATION_SCHEMA.ENGINES WHERE engine='innodb'
- and SUPPORT='YES';
-
-#
-# MDEV-13063 Server crashes in intern_plugin_lock or assertion `plugin_ptr->ref_count == 1' fails in plugin_init
-#
---error 1
---exec $MYSQLD_BOOTSTRAP_CMD --myisam_recover_options=NONE
-
---echo End of 5.5 tests
-
---source include/not_windows_embedded.inc
---source include/have_example_plugin.inc
-#
-# Check that --bootstrap can install and uninstall plugins
-#
-let $PLUGIN_DIR=`select @@plugin_dir`;
---write_file $MYSQLTEST_VARDIR/tmp/install_plugin.sql
-install soname 'ha_example';
-uninstall plugin unusable;
-EOF
---exec $MYSQLD_BOOTSTRAP_CMD --plugin-dir=$PLUGIN_DIR < $MYSQLTEST_VARDIR/tmp/install_plugin.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
---remove_file $MYSQLTEST_VARDIR/tmp/install_plugin.sql
-
-#
-# Check that installed plugins are *not* automatically loaded in --bootstrap
-#
---write_file $MYSQLTEST_VARDIR/tmp/bootstrap_plugins.sql
-SET SQL_MODE="";
-use test;
-create table t1(a int) engine=example charset=latin1;
-EOF
---exec $MYSQLD_BOOTSTRAP_CMD --plugin-dir=$PLUGIN_DIR < $MYSQLTEST_VARDIR/tmp/bootstrap_plugins.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
---remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_plugins.sql
-flush tables;
-show create table t1;
-drop table t1;
---replace_result .dll .so
-select * from mysql.plugin;
-truncate table mysql.plugin;
-
-
-#
-# MDEV-9969 mysql_install_db error processing ignore_db_dirs.
-#
---write_file $MYSQLTEST_VARDIR/tmp/bootstrap_9969.sql
-use test;
-EOF
---exec $MYSQLD_BOOTSTRAP_CMD --ignore-db-dirs='some_dir' --ignore-db-dirs='some_dir' < $MYSQLTEST_VARDIR/tmp/bootstrap_9969.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
---remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_9969.sql
diff --git a/mysql-test/t/bug12427262.test b/mysql-test/t/bug12427262.test
deleted file mode 100644
index aca37a651c4..00000000000
--- a/mysql-test/t/bug12427262.test
+++ /dev/null
@@ -1,51 +0,0 @@
---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/bug13633383.test b/mysql-test/t/bug13633383.test
deleted file mode 100644
index 29106d379fe..00000000000
--- a/mysql-test/t/bug13633383.test
+++ /dev/null
@@ -1,83 +0,0 @@
---echo #
---echo # Bug#13633383 63183: SMALL SORT_BUFFER_SIZE CRASH IN MERGE_BUFFERS
---echo #
-
-CREATE TABLE t1 (
- `a` int(11) DEFAULT NULL,
- `col432` bit(8) DEFAULT NULL,
- `col433` geometry DEFAULT NULL,
- `col434` geometry DEFAULT NULL,
- `col435` decimal(50,17) unsigned DEFAULT NULL,
- `col436` geometry NOT NULL,
- `col437` tinyblob NOT NULL,
- `col438` geometry DEFAULT NULL,
- `col439` mediumblob NOT NULL,
- `col440` tinyblob NOT NULL,
- `col441` double unsigned DEFAULT NULL
-);
-
-CREATE TABLE t2 (
- `a` geometry DEFAULT NULL,
- `col460` date DEFAULT NULL,
- `col461` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- `col462` date NOT NULL,
- `col463` varbinary(89) NOT NULL,
- `col464` year(4) DEFAULT NULL,
- `col465` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
- `col466` varchar(236) CHARACTER SET utf8 NOT NULL,
- `col467` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
-);
-
-CREATE TABLE t3 (
- `FTS_DOC_ID` bigint(20) unsigned NOT NULL,
- `col577` datetime DEFAULT NULL,
- `col579` bit(38) NOT NULL,
- `col580` varchar(93) NOT NULL,
- `col581` datetime DEFAULT NULL,
- `col583` geometry DEFAULT NULL,
- `col584` bit(47) NOT NULL
-);
-
---disable_query_log
-
-INSERT INTO t1 VALUES (0,0xFF,'\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 J',NULL,0.00000000000000000,'\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0C\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0C\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',0xB623A952C5,'\0\0\0\0\0\0\0\0\0\0\0i\0\0\0\0j',0x22,0xD81F72A9,56403);
-INSERT INTO t1 VALUES (-32768,0x00,'\0\0\0\0\0\0\0\0\0\0\0r@\0\0\0\0j','\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0j',NULL,'\0\0\0\0\0\0\0\0\0\0\06@\0\0\0\0\0j',0xC80876AF04,'\0\0\0\0\0\0\0\0\0\0\0[\0\0\0\0i',0x016C576E34,0x1B,0);
-INSERT INTO t1 VALUES (-2147483648,0x17,'\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0]',NULL,0.00000000000000000,'\0\0\0\0\0\0\0\0\0\0\0iFQC',0x68D352,'\0\0\0\0\0\0\0\n\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0C\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0C \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0','','',0);
-INSERT INTO t1 VALUES (1,0xFF,'\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0','\0\0\0\0\0\0\0\0\0\0\0`6@\0\0\0\0@',32767.00000000000000000,'\0\0\0\0\0\0\0\0\0\0\0i@{',0x1406B0C524,'\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0 \0\0\0\0\0C \0\0\0\0\0C',0xC04B75CCFD,0xC4CD,1);
-INSERT INTO t1 VALUES (0,0xFF,NULL,'\0\0\0\0\0\0\0\0\0\0\0\0j@\0\0\0\0\0(',0.06140000000000000,'\0\0\0\0\0\0\0\0\0\0\0i@$7H#1',0x3F,'\0\0\0\0\0\0\0\0\0\0\0jCHK$',0x1E87C5DA,0xCC870E,NULL);
-
-
-INSERT INTO t2 VALUES ('\0\0\0\0\0\0\0\0\0\0\0\0k\0\0\0\0\0j@','2011-02-19','2011-08-10 14:21:44','2012-09-25',0xCCC3,0000,'2012-07-28 16:25:23','idpapxbfjrigkfqnhnfmhvtewlvxfmjhfqizhhsowbetimmkhukpzeixbfyzmsalaafssdovflpvxldldmuamfoulanivuxigbjwkzbapcxmmprpyasaozdqwqjuixajzmiepkcvnvtewdvyodupziffgzbcmsfhikbuehyhzfnxlsdzulbsrqmtszzzupcmxlvcpxahuiotgadwhpcuqmyzgrbkxzxwriqkymdaqnzz','2012-01-20 09:01:25');
-INSERT INTO t2 VALUES (NULL,'2011-05-14','2012-10-17 04:33:30','2012-01-20','',0000,'2012-05-08 11:06:53','otbywkbfwwtgpfgurtqwgfcwmmntsdxkounuzueoclrpnadghfzmbrh','2012-03-24 21:01:09');
-INSERT INTO t2 VALUES ('\0\0\0\0\0\0\06PVh,;bº$','2012-07-21','2011-11-21 04:23:27','2011-06-18',0x21,0000,'2011-09-10 14:01:05','goybgohrexhfqwerpknkbyiqowvcdpyxvbklkbeeuvfbjtkmontmkmgcjutkjphewnvvobzilamtjqjbtvqgczozqcmvbbzvoxkycsvplfykmzpwljdcromsilspjuoyhxwduymxkymvmijehtutftqmpfpbesonppacogyogjqhyonizbsgzwubzgeoehryqswzkftgzhzssnlstuszpwauxmdhgjcawabnjcynzrrh','2012-11-19 18:30:51');
-INSERT INTO t2 VALUES ('\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0','2012-09-01','2012-01-20 09:01:34','2011-02-12',0x1FDF59DC65,0000,'2011-07-07 19:48:34','xohwzrslzxbpxdvqfsumavjwwmsdcgczlmxrtxavsqtnpggxesvekbcelnnrxkvvlwqwbydlhwzltwaurkfltafeijstmzueiqddjdxzddymhsungndmojndbspkezvdfhqxijxxrwiolqgnsedenszkiljgropmcbxsjntjmnonnltyiysuejsznuurmonebslawybppziavystrylwunselezpbslmkzggpziffrud','2012-01-19 22:00:00');
-INSERT INTO t2 VALUES ('\0\0\0\0\0\0\0\0\0\0\0\0j@\0\0\0\0\0\0\0\0','0000-00-00','2012-05-21 09:59:10','2011-04-17',0x02307EDF,0000,'2012-01-20 09:01:34','vjcwlxxeydntegsdqhxgriarmbvzwzwdexcalvacxhilaejpmxdpkuvblukchagzoellbdndelfednqktzobyhjqweqaugqnfikdalmaytyunjqvxcsirhaqnvqsstgrgfscnsemseebdemfditoswccsxthnddzslgjkyujxoqsvzrssymoovqmibcmbboruyxlvopengdqqgqwekrflhvjcpondxivnshvhrnqvfls','2012-09-23 23:54:02');
-
-
-INSERT INTO t3 VALUES (11787,'2012-07-24 15:22:50',0x00000000FF,'qbdydwxepydtonqnghurnuntughjwfygzttqwtmfzfbtifjcearpatksofbrfgnaccvapahywhsstdplphrxbcubhktov','2011-08-27 19:28:03',NULL,0x00000000001C);
-
-INSERT INTO t3 VALUES (11788,'2012-05-17 08:38:13',0x3FFFFFFFFF,'jkvkjxaikruljqalyvnbfjptxgbpsgnxlzthhcrswwdcfrhilwwgqmxynxjnehwmyfzdyywjzfyasuvjbrevkxtnyodiu','2012-05-09 11:09:52',NULL,0x0000000000B8);
-
-INSERT INTO t3 VALUES (1,'2011-02-17 19:55:19',0x000098FAF3,'rnzhemtrqjdrappwbmxnzkfatcgtvqklrpfpdqiwjnjbeaxpcbhqqunbzmtmitdszxyrdvkeedqwpbiefqnwvhiznwfyq','2012-11-10 18:00:25','\0\0\0\0\0\0\0\0\0\0\0\0j\0\0\0\01@',0x7FFFFFFFFFFF);
-
-INSERT INTO t3 VALUES (11789,'2011-12-26 01:30:56',0x0000000001,'dhryqjghgixymqywclxpovwnlgnltuzdvggmlaxtzrsbpxkahkiahpkrddpoeftqqwejbjxrdzfgvkzvhcalopgumspgg','2011-03-21 06:25:44',NULL,0x00000000293A);
-
-INSERT INTO t3 VALUES (4294967296,'2011-04-12 21:05:37',0x0000CE3238,'xwcplgaxcpgfsmcjftxffxgmjwabpmrcycbxmwjvqtlvtlwuipuwgbuygnxomjplqohyuqyzsoiggroigcnchzpiilyhe','2012-03-20 05:35:39',NULL,0x00000000006E);
-
---enable_query_log
-
-set session sort_buffer_size= 32768;
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-select col435
-from t3
-natural right outer join t1
-natural right outer join t2 a
-left outer join t2 b on 1
-group by
- repeat('a',10000) desc,
- repeat('a',10000)
-with rollup
-;
-set session sort_buffer_size= default;
-
-DROP TABLE t1, t2, t3;
diff --git a/mysql-test/t/bug39022.test b/mysql-test/t/bug39022.test
deleted file mode 100644
index d293788e58e..00000000000
--- a/mysql-test/t/bug39022.test
+++ /dev/null
@@ -1,58 +0,0 @@
--- source include/have_log_bin.inc
--- source include/have_innodb.inc
--- source include/not_binlog_format_row.inc
-
---echo #
---echo # Bug #39022: Mysql randomly crashing in lock_sec_rec_cons_read_sees
---echo #
-
-call mtr.add_suppression("Deadlock found when trying to get lock; try restarting transaction");
-
-CREATE TABLE t1(a TINYINT NOT NULL,b TINYINT,PRIMARY KEY(b)) ENGINE=innodb;
-CREATE TABLE t2(d TINYINT NOT NULL,UNIQUE KEY(d)) ENGINE=innodb;
-INSERT INTO t1 VALUES (13,0),(8,1),(9,2),(6,3),
-(11,5),(11,6),(7,7),(7,8),(4,9),(6,10),(3,11),(11,12),
-(12,13),(7,14);
-INSERT INTO t2 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),
-(11),(12),(13),(14);
-
-connect (thread1, localhost, root,,);
-connect (thread2, localhost, root,,);
-
-connection thread1;
-START TRANSACTION;
-
-connection thread2;
-REPLACE INTO t2 VALUES (-17);
-SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SHARE MODE;
-
-connection thread1;
-REPLACE INTO t1(a,b) VALUES (67,20);
-
-connection thread2;
-COMMIT;
-START TRANSACTION;
-REPLACE INTO t1(a,b) VALUES (65,-50);
-REPLACE INTO t2 VALUES (-91);
-send;
-SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SHARE MODE; #waits
-
-connection thread1;
-
---echo # should not crash
---error ER_LOCK_DEADLOCK
-SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SHARE MODE; #crashes
-
-connection thread2;
-REAP;
-
-disconnect thread2;
---source include/wait_until_disconnected.inc
-
-connection thread1;
-disconnect thread1;
---source include/wait_until_disconnected.inc
-
-connection default;
-
-DROP TABLE t1,t2;
diff --git a/mysql-test/t/bug46760-master.opt b/mysql-test/t/bug46760-master.opt
deleted file mode 100644
index 2d7be7fb9b1..00000000000
--- a/mysql-test/t/bug46760-master.opt
+++ /dev/null
@@ -1,2 +0,0 @@
---loose-innodb-lock-wait-timeout=2
---loose-innodb-file-per-table
diff --git a/mysql-test/t/bug46760.test b/mysql-test/t/bug46760.test
deleted file mode 100644
index e7f57549250..00000000000
--- a/mysql-test/t/bug46760.test
+++ /dev/null
@@ -1,38 +0,0 @@
--- source include/have_innodb.inc
-
---echo #
---echo # Bug#46760: Fast ALTER TABLE no longer works for InnoDB
---echo #
-
-CREATE TABLE t1 (a INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1);
-
---echo # By using --enable_info and verifying that number of affected
---echo # rows is 0 we check that this ALTER TABLE is really carried
---echo # out as "fast/online" operation, i.e. without full-blown data
---echo # copying.
---echo #
---echo # I.e. info for the below statement should normally look like:
---echo #
---echo # affected rows: 0
---echo # info: Records: 0 Duplicates: 0 Warnings: 0
-
---enable_info
-ALTER TABLE t1 ALTER COLUMN a SET DEFAULT 10;
---disable_info
-SHOW CREATE TABLE t1;
-
-DROP TABLE t1;
-
---echo #
---echo # MySQL Bug#39200: optimize table does not recognize
---echo # ROW_FORMAT=COMPRESSED
---echo #
-
-CREATE TABLE t1 (a INT) ROW_FORMAT=compressed, ENGINE=MyISAM;
-SHOW CREATE TABLE t1;
-OPTIMIZE TABLE t1;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
---echo End of 5.1 tests
diff --git a/mysql-test/t/bug47671-master.opt b/mysql-test/t/bug47671-master.opt
deleted file mode 100644
index ad54fbc3467..00000000000
--- a/mysql-test/t/bug47671-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---character-set-server=utf8 --skip-character-set-client-handshake
diff --git a/mysql-test/t/bug47671.test b/mysql-test/t/bug47671.test
deleted file mode 100644
index c3f66a9f502..00000000000
--- a/mysql-test/t/bug47671.test
+++ /dev/null
@@ -1,9 +0,0 @@
-# Embedded server doesn't support external clients
---source include/not_embedded.inc
-
---echo #
---echo # Bug#47671 - wrong character-set after upgrade from 5.1.34 to 5.1.39
---echo #
---echo # Extract only charset information from 'status' command output using regex
---replace_regex /.*mysql.*// /Connection.*// /Current.*// /SSL.*// /Using.*// /Server version.*// /Protocol.*// /UNIX.*// /Uptime.*// /Threads.*// /TCP.*//
---exec $MYSQL -e "status";
diff --git a/mysql-test/t/bug58669-master.opt b/mysql-test/t/bug58669-master.opt
deleted file mode 100644
index 6d909680527..00000000000
--- a/mysql-test/t/bug58669-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---read-only
diff --git a/mysql-test/t/bug58669.test b/mysql-test/t/bug58669.test
deleted file mode 100644
index 77827cde5ba..00000000000
--- a/mysql-test/t/bug58669.test
+++ /dev/null
@@ -1,22 +0,0 @@
---source include/not_embedded.inc
-
---echo #
---echo # Bug#58669: read_only not enforced on 5.5.x
---echo #
-
-CREATE USER user1@localhost;
-CREATE DATABASE db1;
-GRANT ALL PRIVILEGES ON db1.* TO user1@localhost;
-CREATE TABLE db1.t1(a INT);
-
-connect (con1,localhost,user1,,);
-connection con1;
-SELECT CURRENT_USER();
-SHOW VARIABLES LIKE "read_only%";
---error ER_OPTION_PREVENTS_STATEMENT
-INSERT INTO db1.t1 VALUES (1);
-
-connection default;
-disconnect con1;
-DROP DATABASE db1;
-DROP USER user1@localhost;
diff --git a/mysql-test/t/bulk_replace.test b/mysql-test/t/bulk_replace.test
deleted file mode 100644
index 3c623909c56..00000000000
--- a/mysql-test/t/bulk_replace.test
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-# this is a test of bulk-insert code
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-CREATE TABLE t1 (a int, unique (a), b int not null, unique(b), c int not null, index(c));
-replace into t1 values (1,1,1),(2,2,2),(3,1,3);
---sorted_result
-select * from t1;
-check table t1;
-drop table t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/cache_innodb.test b/mysql-test/t/cache_innodb.test
deleted file mode 100644
index f7102627506..00000000000
--- a/mysql-test/t/cache_innodb.test
+++ /dev/null
@@ -1,31 +0,0 @@
-# t/cache_innodb.test
-#
-# Last update:
-# 2006-07-26 ML test refactored (MySQL 5.1)
-# main code t/innodb_cache.test --> include/query_cache.inc
-# new wrapper t/cache_innodb.test
-#
-
---source include/have_query_cache.inc
-
---source include/have_innodb.inc
-let $engine_type= InnoDB;
-# InnoDB supports FOREIGN KEYs
-let $test_foreign_keys= 1;
-
---source include/query_cache.inc
-
-#
-# Bug#56452 Assertion failed: thd->transaction.stmt.is_empty() ||
-# thd->in_sub_stmt
-#
-CREATE TABLE t1 (a INT) ENGINE=InnoDB;
-BEGIN;
- INSERT INTO t1 VALUES(1);
-ROLLBACK WORK AND CHAIN NO RELEASE;
-SELECT a FROM t1;
-ROLLBACK WORK AND CHAIN NO RELEASE;
-SELECT a FROM t1;
-ROLLBACK;
-DROP TABLE t1;
-
diff --git a/mysql-test/t/cache_temporal_4265.test b/mysql-test/t/cache_temporal_4265.test
deleted file mode 100644
index c62f3c3c506..00000000000
--- a/mysql-test/t/cache_temporal_4265.test
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# MDEV-4265 5.5 is slower than 5.3 because of many str_to_datetime calls
-#
---source include/have_debug.inc
-
-create table t1 (a date);
-insert t1 values ('2000-01-02'), ('2001-02-03'), ('2002-03-04');
-set debug_dbug='d,str_to_datetime_warn';
-select * from t1 where a > date_add('2000-01-01', interval 5 day);
-set debug_dbug='';
-drop table t1;
-
-#
-# MDEV-9707 MAX(timestamp(6) column) in correlated sub-query returns non-existent row data in original table
-#
-create table t1 (id int not null, ut timestamp(6) not null);
-insert into t1 values(1, '2001-01-01 00:00:00.2');
-insert into t1 values(1, '2001-01-01 00:00:00.1');
-select * from t1;
-select (select max(m2.ut) from t1 m2 where m1.id <> 0) from t1 m1;
-drop table t1;
-
diff --git a/mysql-test/t/case.test b/mysql-test/t/case.test
deleted file mode 100644
index d7dac112b3b..00000000000
--- a/mysql-test/t/case.test
+++ /dev/null
@@ -1,395 +0,0 @@
-
-# Testing of CASE
-#
-
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-
-select CASE "b" when "a" then 1 when "b" then 2 END;
-select CASE "c" when "a" then 1 when "b" then 2 END;
-select CASE "c" when "a" then 1 when "b" then 2 ELSE 3 END;
-select CASE BINARY "b" when "a" then 1 when "B" then 2 WHEN "b" then "ok" END;
-select CASE "b" when "a" then 1 when binary "B" then 2 WHEN "b" then "ok" END;
-select CASE concat("a","b") when concat("ab","") then "a" when "b" then "b" end;
-select CASE when 1=0 then "true" else "false" END;
-select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END;
-explain extended select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END;
-select CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END;
-select (CASE "two" when "one" then "1" WHEN "two" then "2" END) | 0;
-select (CASE "two" when "one" then 1.00 WHEN "two" then 2.00 END) +0.0;
-select case 1/0 when "a" then "true" else "false" END;
-select case 1/0 when "a" then "true" END;
-select (case 1/0 when "a" then "true" END) | 0;
-select (case 1/0 when "a" then "true" END) + 0.0;
-select case when 1>0 then "TRUE" else "FALSE" END;
-select case when 1<0 then "TRUE" else "FALSE" END;
-
-#
-# Test bug when using GROUP BY on CASE
-#
-create table t1 (a int);
-insert into t1 values(1),(2),(3),(4);
-select case a when 1 then 2 when 2 then 3 else 0 end as fcase, count(*) from t1 group by fcase;
-explain extended select case a when 1 then 2 when 2 then 3 else 0 end as fcase, count(*) from t1 group by fcase;
-select case a when 1 then "one" when 2 then "two" else "nothing" end as fcase, count(*) from t1 group by fcase;
-drop table t1;
-
-#
-# Test MAX(CASE ... ) that can return null
-#
-
-create table t1 (row int not null, col int not null, val varchar(255) not null);
-insert into t1 values (1,1,'orange'),(1,2,'large'),(2,1,'yellow'),(2,2,'medium'),(3,1,'green'),(3,2,'small');
-select max(case col when 1 then val else null end) as color from t1 group by row;
-drop table t1;
-
-SET NAMES latin1;
-
-#
-# CASE and argument types/collations aggregation into result
-#
-CREATE TABLE t1 SELECT
- CASE WHEN 1 THEN _latin1'a' COLLATE latin1_danish_ci ELSE _latin1'a' END AS c1,
- CASE WHEN 1 THEN _latin1'a' ELSE _latin1'a' COLLATE latin1_danish_ci END AS c2,
- CASE WHEN 1 THEN 'a' ELSE 1 END AS c3,
- CASE WHEN 1 THEN 1 ELSE 'a' END AS c4,
- CASE WHEN 1 THEN 'a' ELSE 1.0 END AS c5,
- CASE WHEN 1 THEN 1.0 ELSE 'a' END AS c6,
- CASE WHEN 1 THEN 1 ELSE 1.0 END AS c7,
- CASE WHEN 1 THEN 1.0 ELSE 1 END AS c8,
- CASE WHEN 1 THEN 1.0 END AS c9,
- CASE WHEN 1 THEN 0.1e1 else 0.1 END AS c10,
- CASE WHEN 1 THEN 0.1e1 else 1 END AS c11,
- CASE WHEN 1 THEN 0.1e1 else '1' END AS c12
-;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
---error 1267
-SELECT CASE
- WHEN 1
- THEN _latin1'a' COLLATE latin1_danish_ci
- ELSE _latin1'a' COLLATE latin1_swedish_ci
- END;
-
---error 1270
-SELECT CASE _latin1'a' COLLATE latin1_general_ci
- WHEN _latin1'a' COLLATE latin1_danish_ci THEN 1
- WHEN _latin1'a' COLLATE latin1_swedish_ci THEN 2
- END;
-
-SELECT
-CASE _latin1'a' COLLATE latin1_general_ci WHEN _latin1'A' THEN '1' ELSE 2 END,
-CASE _latin1'a' COLLATE latin1_bin WHEN _latin1'A' THEN '1' ELSE 2 END,
-CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_swedish_ci THEN '1' ELSE 2 END,
-CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_bin THEN '1' ELSE 2 END
-;
-
-#
-# COALESCE is a CASE abbrevation:
-#
-# COALESCE(v1,v2) == CASE WHEN v1 IS NOT NULL THEN v1 ELSE v2 END
-#
-# COALESCE(V1, V2, . . . ,Vn ) =
-# CASE WHEN V1 IS NOT NULL THEN V1 ELSE COALESCE (V2, . . . ,Vn) END
-#
-# Check COALESCE argument types aggregation
-
---error 1267
-CREATE TABLE t1 SELECT COALESCE(_latin1'a',_latin2'a');
---error 1267
-CREATE TABLE t1 SELECT COALESCE('a' COLLATE latin1_swedish_ci,'b' COLLATE latin1_bin);
-CREATE TABLE t1 SELECT
- COALESCE(1), COALESCE(1.0),COALESCE('a'),
- COALESCE(1,1.0), COALESCE(1,'1'),COALESCE(1.1,'1'),
- COALESCE('a' COLLATE latin1_bin,'b');
-explain extended SELECT
- COALESCE(1), COALESCE(1.0),COALESCE('a'),
- COALESCE(1,1.0), COALESCE(1,'1'),COALESCE(1.1,'1'),
- COALESCE('a' COLLATE latin1_bin,'b');
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
---error 1267
-CREATE TABLE t1 SELECT IFNULL('a' COLLATE latin1_swedish_ci, 'b' COLLATE latin1_bin);
-
-# Test for BUG#10151
-SELECT 'case+union+test'
-UNION
-SELECT CASE LOWER('1') WHEN LOWER('2') THEN 'BUG' ELSE 'nobug' END;
-
-SELECT CASE LOWER('1') WHEN LOWER('2') THEN 'BUG' ELSE 'nobug' END;
-
-SELECT 'case+union+test'
-UNION
-SELECT CASE '1' WHEN '2' THEN 'BUG' ELSE 'nobug' END;
-
-#
-# Bug #17896: problem with MIN(CASE...)
-#
-
-create table t1(a float, b int default 3);
-insert into t1 (a) values (2), (11), (8);
-select min(a), min(case when 1=1 then a else NULL end),
- min(case when 1!=1 then NULL else a end)
-from t1 where b=3 group by b;
-drop table t1;
-
-
-#
-# Tests for bug #9939: conversion of the arguments for COALESCE and IFNULL
-#
-
-CREATE TABLE t1 (EMPNUM INT);
-INSERT INTO t1 VALUES (0), (2);
-CREATE TABLE t2 (EMPNUM DECIMAL (4, 2));
-INSERT INTO t2 VALUES (0.0), (9.0);
-
-SELECT COALESCE(t2.EMPNUM,t1.EMPNUM) AS CEMPNUM,
- t1.EMPNUM AS EMPMUM1, t2.EMPNUM AS EMPNUM2
- FROM t1 LEFT JOIN t2 ON t1.EMPNUM=t2.EMPNUM;
-
-SELECT IFNULL(t2.EMPNUM,t1.EMPNUM) AS CEMPNUM,
- t1.EMPNUM AS EMPMUM1, t2.EMPNUM AS EMPNUM2
- FROM t1 LEFT JOIN t2 ON t1.EMPNUM=t2.EMPNUM;
-
-DROP TABLE t1,t2;
-
---echo End of 4.1 tests
-
-#
-# #30782: Truncated UNSIGNED BIGINT columns
-#
-create table t1 (a int, b bigint unsigned);
-create table t2 (c int);
-insert into t1 (a, b) values (1,4572794622775114594), (2,18196094287899841997),
- (3,11120436154190595086);
-insert into t2 (c) values (1), (2), (3);
-select t1.a, (case t1.a when 0 then 0 else t1.b end) d from t1
- join t2 on t1.a=t2.c order by d;
-select t1.a, (case t1.a when 0 then 0 else t1.b end) d from t1
- join t2 on t1.a=t2.c where b=11120436154190595086 order by d;
-drop table t1, t2;
-
---echo End of 5.0 tests
-
---echo #
---echo # Bug#19875294 ASSERTION `SRC' FAILED IN MY_STRNXFRM_UNICODE
---echo # (SIG 6 -STRINGS/CTYPE-UTF8.C:5151)
---echo #
-
-set @@sql_mode='';
-CREATE TABLE t1(c1 SET('','')CHARACTER SET ucs2);
-INSERT INTO t1 VALUES(990101.102);
-SELECT COALESCE(c1)FROM t1 ORDER BY 1;
-DROP TABLE t1;
-set @@sql_mode=default;
-
-#
-# lp:1001510
-# Bug #11764313 57135: CRASH IN ITEM_FUNC_CASE::FIND_ITEM WITH CASE WHEN
-# ELSE CLAUSE
-#
-
-CREATE TABLE t1(a YEAR);
-SELECT 1 FROM t1 WHERE a=1 AND CASE 1 WHEN a THEN 1 ELSE 1 END;
-DROP TABLE t1;
-
-#
-# lp:839387 Assertion `(Item_result)i != TIME_RESULT' failed with CASE + datetime
-#
-
-create table t1 (f1 time);
-insert t1 values ('00:00:00'),('00:01:00');
-select case t1.f1 when '00:00:00' then 1 end from t1;
-drop table t1;
-
---echo #
---echo # MDEV-9745 Crash with CASE WHEN TRUE THEN COALESCE(CAST(NULL AS UNSIGNED)) ELSE 4 END
---echo #
-CREATE TABLE t1 SELECT CASE WHEN TRUE THEN COALESCE(CAST(NULL AS UNSIGNED)) ELSE 4 END AS a;
-DESCRIBE t1;
-DROP TABLE t1;
-CREATE TABLE t1 SELECT CASE WHEN TRUE THEN COALESCE(CAST(NULL AS UNSIGNED)) ELSE 40 END AS a;
-DESCRIBE t1;
-DROP TABLE t1;
-
---echo #
---echo # Start of 10.1 test
---echo #
-
---echo #
---echo # MDEV-8752 Wrong result for SELECT..WHERE CASE enum_field WHEN 1 THEN 1 ELSE 0 END AND a='5'
---echo #
-CREATE TABLE t1 (a ENUM('5','6') CHARACTER SET BINARY);
-INSERT INTO t1 VALUES ('5'),('6');
-SELECT * FROM t1 WHERE a='5';
-SELECT * FROM t1 WHERE a=1;
-SELECT * FROM t1 WHERE CASE a WHEN 1 THEN 1 ELSE 0 END;
-SELECT * FROM t1 WHERE CASE a WHEN 1 THEN 1 ELSE 0 END AND a='5';
---echo # Multiple comparison types in CASE, not Ok to propagate
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE CASE a WHEN 1 THEN 1 ELSE 0 END AND a='5';
-DROP TABLE t1;
-
-CREATE TABLE t1 (a ENUM('a','b','100'));
-INSERT INTO t1 VALUES ('a'),('b'),('100');
-SELECT * FROM t1 WHERE a='a';
-SELECT * FROM t1 WHERE CASE a WHEN 'a' THEN 1 ELSE 0 END;
-SELECT * FROM t1 WHERE CASE a WHEN 'a' THEN 1 ELSE 0 END AND a='a';
---echo # String comparison in CASE and in the equality, ok to propagate
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE CASE a WHEN 'a' THEN 1 ELSE 0 END AND a='a';
-
-SELECT * FROM t1 WHERE a=3;
-SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 ELSE 0 END;
-SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 ELSE 0 END AND a=3;
---echo # Integer comparison in CASE and in the equality, not ok to propagate
---echo # ENUM does not support this type of propagation yet.
---echo # This can change in the future. See MDEV-8748.
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 ELSE 0 END AND a=3;
-
-SELECT * FROM t1 WHERE a=3;
-SELECT * FROM t1 WHERE CASE a WHEN '100' THEN 1 ELSE 0 END;
-SELECT * FROM t1 WHERE CASE a WHEN '100' THEN 1 ELSE 0 END AND a=3;
---echo # String comparison in CASE, integer comparison in the equality, not Ok to propagate
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE CASE a WHEN '100' THEN 1 ELSE 0 END AND a=3;
-
-SELECT * FROM t1 WHERE a='100';
-SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 ELSE 0 END;
-SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 ELSE 0 END AND a='100';
---echo # Integer comparison in CASE, string comparison in the equality, not Ok to propagate
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 ELSE 0 END AND a='100';
-
-SELECT * FROM t1 WHERE a='100';
-SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 WHEN '100' THEN 1 ELSE 0 END;
-SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 WHEN '100' THEN 1 ELSE 0 END AND a='100';
---echo # Multiple type comparison in CASE, string comparison in the equality, not Ok to propagate
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 WHEN '100' THEN 1 ELSE 0 END AND a='100';
-
-SELECT * FROM t1 WHERE a=3;
-SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 WHEN '100' THEN 1 ELSE 0 END;
-SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 WHEN '100' THEN 1 ELSE 0 END AND a=3;
---echo # Multiple type comparison in CASE, integer comparison in the equality, not Ok to propagate
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE CASE a WHEN 3 THEN 1 WHEN '100' THEN 1 ELSE 0 END AND a=3;
-
-DROP TABLE t1;
---echo #
---echo # End of MDEV-8752
---echo #
-
---echo #
---echo # End of 10.1 test
---echo #
-
-#
-# caching of first argument in CASE/IN for temporal types
-#
-#
-
-# should not convert all values to time
-select case 'foo' when time'10:00:00' then 'never' when '0' then 'bug' else 'ok' end;
-select 'foo' in (time'10:00:00','0');
-
-create table t1 (a time);
-insert t1 values (100000), (102030), (203040);
-# only one warning, TIME('foo') should be cached
-select case 'foo' when a then 'never' when '0' then 'bug' else 'ok' end from t1;
-select 'foo' in (a,'0') from t1;
-drop table t1;
-
-# first comparison should be as date, second as time
-select case '20:10:05' when date'2020-10-10' then 'never' when time'20:10:5' then 'ok' else 'bug' end;
-
---echo #
---echo # End of 10.2 test
---echo #
-
---echo #
---echo # MDEV-11554 Wrong result for CASE on a mixture of signed and unsigned expressions
---echo #
-
-CREATE TABLE t1 (a BIGINT, b BIGINT UNSIGNED);
-INSERT INTO t1 VALUES (-9223372036854775808,18446744073709551615);
-SELECT
- CASE -1
- WHEN -9223372036854775808 THEN 'one'
- WHEN 18446744073709551615 THEN 'two'
- END AS c;
-
-PREPARE stmt FROM "SELECT
- CASE -1
- WHEN -9223372036854775808 THEN 'one'
- WHEN 18446744073709551615 THEN 'two'
- END AS c";
-EXECUTE stmt;
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-11555 CASE with a mixture of TIME and DATETIME returns a wrong result
---echo #
-SELECT
- CASE TIME'10:20:30'
- WHEN 102030 THEN 'one'
- WHEN TIME'10:20:31' THEN 'two'
- END AS good,
- CASE TIME'10:20:30'
- WHEN 102030 THEN 'one'
- WHEN TIME'10:20:31' THEN 'two'
- WHEN TIMESTAMP'2001-01-01 10:20:32' THEN 'three'
- END AS was_bad_now_good;
-
-PREPARE stmt FROM "SELECT
- CASE TIME'10:20:30'
- WHEN 102030 THEN 'one'
- WHEN TIME'10:20:31' THEN 'two'
- END AS good,
- CASE TIME'10:20:30'
- WHEN 102030 THEN 'one'
- WHEN TIME'10:20:31' THEN 'two'
- WHEN TIMESTAMP'2001-01-01 10:20:32' THEN 'three'
- END AS was_bad_now_good";
-EXECUTE stmt;
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-
---echo #
---echo # MDEV-13864 Change Item_func_case to store the predicant in args[0]
---echo #
-
-SET NAMES latin1;
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
-INSERT INTO t1 VALUES ('a'),('b'),('c');
-
-# should propagate the predicant and the WHEN arguments (they are in comparison and use ANY_SUBST)
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE a WHEN 'a' THEN 'a' ELSE 'a' END='a';
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE 'a' WHEN a THEN 'a' ELSE 'a' END='a';
-
-# should not propagate the THEN and the ELSE arguments (they are not in comparison and use IDENTITY_SUBST)
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE 'a' WHEN 'a' THEN a ELSE 'a' END='a';
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE 'a' WHEN 'a' THEN 'a' ELSE a END='a';
-
-ALTER TABLE t1 MODIFY a VARBINARY(10);
-
-# with VARBINARY it should propagate all arguments
-# as IDENTITY_SUBST for VARBINARY allows substitution
-# of even those arguments that are not in comparison
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE a WHEN 'a' THEN 'a' ELSE 'a' END='a';
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE 'a' WHEN a THEN 'a' ELSE 'a' END='a';
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE 'a' WHEN 'a' THEN a ELSE 'a' END='a';
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE 'a' WHEN 'a' THEN 'a' ELSE a END='a';
-
-DROP TABLE t1;
-
---echo #
---echo # End of 10.3 test
---echo #
diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test
deleted file mode 100644
index b514dbb5b2d..00000000000
--- a/mysql-test/t/cast.test
+++ /dev/null
@@ -1,726 +0,0 @@
-#
-# Test of cast function
-#
-
-# For TIME->DATETIME conversion
-SET timestamp=unix_timestamp('2001-02-03 10:20:30');
-
-select CAST(1-2 AS UNSIGNED);
-select CAST(CAST(1-2 AS UNSIGNED) AS SIGNED INTEGER);
-select CAST('10 ' as unsigned integer);
-select cast(-5 as unsigned) | 1, cast(-5 as unsigned) & -1;
-select cast(-5 as unsigned) -1, cast(-5 as unsigned) + 1;
-select ~5, cast(~5 as signed);
-explain extended select ~5, cast(~5 as signed);
-select cast(18446744073709551615 as signed);
-select cast(5 as unsigned) -6.0;
-select cast(NULL as signed), cast(1/0 as signed);
-select cast(1 as double(5,2));
-select cast("5.2222" as double(5,2));
-select cast(12.444 as double(5,2));
-select cast(cast(12.444 as decimal(10,3)) as double(5,2));
-select cast(null as double(5,2));
-select cast(12.444 as double);
-select cast(cast("20:01:01" as time) as datetime);
-select cast(cast("8:46:06.23434" AS time) as decimal(32,10));
-select cast(cast("2011-04-05 8:46:06.23434" AS datetime) as decimal(32,6));
-
---echo #
---echo # Check handling of cast with microseconds
---echo #
-select cast(cast(20010203101112.121314 as double) as datetime);
-select cast(cast(010203101112.12 as double) as datetime);
-select cast(cast(20010203101112.121314 as decimal(32,6)) as datetime);
-select cast(20010203101112.121314 as datetime);
-select cast(110203101112.121314 as datetime);
-select cast(cast(010203101112.12 as double) as datetime);
-
-select cast("2011-02-03 10:11:12.123456" as datetime);
-select cast("2011-02-03 10:11:12.123456" as datetime(0));
-select cast("2011-02-03 10:11:12.123456" as datetime(5));
-select cast("2011-02-03 10:11:12.123456" as datetime(6));
-select cast("2011-02-03 10:11:12" as datetime(6));
-select cast(cast(20010203101112.5 as double) as datetime(1));
-select cast(cast(010203101112.12 as double) as datetime(2));
-select cast(cast(20010203101112.121314 as decimal(32,6)) as datetime(6));
-select cast(20010203101112.121314 as datetime(6));
-select cast(110203101112.121314 as datetime(6));
-select cast(cast(010203101112.12 as double) as datetime(6));
-
-select cast("2011-02-03 10:11:12.123456" as time);
-select cast("2011-02-03 10:11:12.123456" as time(6));
-select cast("10:11:12.123456" as time);
-select cast("10:11:12.123456" as time(0));
-select cast("10:11:12.123456" as time(5));
-select cast("10:11:12.123456" as time(6));
-select cast("10:11:12" as time(6));
-select cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time);
-select cast(cast("2011-04-05 8:46:06.123456" AS datetime) as time(6));
-select cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time);
-select cast(cast("2011-04-05 8:46:06.123456" AS datetime(6)) as time(6));
-
-#
-# Bug #28250: Run-Time Check Failure #3 - The variable 'value' is being used
-# without being def
-#
-# The following line causes Run-Time Check Failure on
-# binaries built with Visual C++ 2005
-#
-select cast(NULL as unsigned), cast(1/0 as unsigned);
-select cast("A" as binary) = "a", cast(BINARY "a" as CHAR) = "A";
-select cast("2001-1-1" as DATE), cast("2001-1-1" as DATETIME);
-select cast("1:2:3" as TIME);
-select CONVERT("2004-01-22 21:45:33",DATE);
-select 10+'10';
-select 10.0+'10';
-select 10E+0+'10';
-
-# The following cast creates warnings
-
-select CONVERT(TIMESTAMP "2004-01-22 21:45:33" USING latin1);
-select CONVERT(TIMESTAMP "2004-01-22 21:45:33",CHAR);
-select CONVERT(TIMESTAMP "2004-01-22 21:45:33",CHAR(4));
-select CONVERT(TIMESTAMP "2004-01-22 21:45:33",BINARY(4));
-select CAST(TIMESTAMP "2004-01-22 21:45:33" AS BINARY(4));
-select CAST(0xb3 as signed);
-select CAST(0x8fffffffffffffff as signed);
-select CAST(0xffffffffffffffff as unsigned);
-select CAST(0xfffffffffffffffe as signed);
-select cast('-10a' as signed integer);
-select cast('a10' as unsigned integer);
-select 10+'a';
-select 10.0+cast('a' as decimal);
-select 10E+0+'a';
-select cast("a" as double(5,2));
-select cast(1000 as decimal(5,2));
-select cast(-1000 as decimal(5,2));
-select cast(1000 as double(5,2));
-select cast(-1000 as double(5,2));
-select cast(010203101112.121314 as datetime);
-select cast(120010203101112.121314 as datetime);
-select cast(cast(1.1 as decimal) as datetime);
-select cast(cast(-1.1 as decimal) as datetime);
-select cast('0' as date);
-select cast('' as date);
-select cast('0' as datetime);
-select cast('' as datetime);
-select cast('0' as time);
-select cast('' as time);
-select cast(NULL as DATE);
-select cast(NULL as DATETIME);
-select cast(NULL as TIME);
-select cast(NULL as BINARY);
-
-#
-# We have to disable warnings for these as the printed double value is
-# not portable
-#
---disable_warnings
-select cast(cast(120010203101112.121314 as double) as datetime);
-select cast(cast(1.1 as double) as datetime);
-select cast(cast(-1.1 as double) as datetime);
---enable_warnings
-
-
-#
-# Some EXPLAIN EXTENDED to ensure the print functions are correct
-#
-
-explain extended select cast(10 as double(5,2));
-explain extended select cast(10 as double);
-explain extended select cast(10 as decimal(5,2));
-
-# out-of-range cases
-select cast('18446744073709551616' as unsigned);
-select cast('18446744073709551616' as signed);
-select cast('9223372036854775809' as signed);
-select cast('-1' as unsigned);
-select cast('abc' as signed);
-select cast('1a' as signed);
-select cast('' as signed);
-
---error ER_M_BIGGER_THAN_D
-select cast(1 as double(5,6));
---error ER_M_BIGGER_THAN_D
-select cast(1 as decimal(5,6));
---error ER_TOO_BIG_PRECISION
-select cast(1 as double(66,6));
---error ER_TOO_BIG_PRECISION
-select cast(1 as decimal(66,6));
---error ER_TOO_BIG_SCALE
-select cast(1 as decimal(64,63));
---error ER_TOO_BIG_SCALE
-select cast(1 as double(64,63));
-
-
-#
-# Character set conversion
-#
-set names binary;
-select cast(_latin1'test' as char character set latin2);
-select cast(_koi8r'' as char character set cp1251);
-create table t1 select cast(_koi8r'' as char character set cp1251) as t;
-show create table t1;
-drop table t1;
-
-#
-# CAST to CHAR with/without length
-#
-select
- cast(_latin1'ab' AS char) as c1,
- cast(_latin1'a ' AS char) as c2,
- cast(_latin1'abc' AS char(2)) as c3,
- cast(_latin1'a ' AS char(2)) as c4,
- hex(cast(_latin1'a' AS char(2))) as c5;
-select cast(1000 as CHAR(3));
-
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-create table t1 select
- cast(_latin1'ab' AS char) as c1,
- cast(_latin1'a ' AS char) as c2,
- cast(_latin1'abc' AS char(2)) as c3,
- cast(_latin1'a ' AS char(2)) as c4,
- cast(_latin1'a' AS char(2)) as c5;
-select c1,c2,c3,c4,hex(c5) from t1;
-show create table t1;
-drop table t1;
-
-#
-# CAST to NCHAR with/without length
-#
-select
- cast(_koi8r'' AS nchar) as c1,
- cast(_koi8r' ' AS nchar) as c2,
- cast(_koi8r'' AS nchar(2)) as c3,
- cast(_koi8r' ' AS nchar(2)) as c4,
- cast(_koi8r'' AS nchar(2)) as c5;
-
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-create table t1 select
- cast(_koi8r'' AS nchar) as c1,
- cast(_koi8r' ' AS nchar) as c2,
- cast(_koi8r'' AS nchar(2)) as c3,
- cast(_koi8r' ' AS nchar(2)) as c4,
- cast(_koi8r'' AS nchar(2)) as c5;
-select * from t1;
-show create table t1;
-drop table t1;
-
-#
-# Bug 2202
-# CAST from BINARY to non-BINARY and from non-BINARY to BINARY
-#
-create table t1 (a binary(4), b char(4) character set koi8r);
-insert into t1 values (_binary'',_binary'');
-select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
-set names koi8r;
-select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
-set names cp1251;
-select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
-drop table t1;
-set names binary;
-
-#
-# The following should be fixed in 4.1
-#
-
-select cast("2001-1-1" as date) = "2001-01-01";
-select cast("2001-1-1" as datetime) = "2001-01-01 00:00:00";
-select cast("1:2:3" as TIME) = "1:02:03";
-
-#
-# Bug #5228 ORDER BY CAST(enumcol) sorts incorrectly under certain conditions
-#
-CREATE TABLE t1 (a enum ('aac','aab','aaa') not null);
-INSERT INTO t1 VALUES ('aaa'),('aab'),('aac');
-# these two should be in enum order
-SELECT a, CAST(a AS CHAR) FROM t1 ORDER BY CAST(a AS UNSIGNED) ;
-SELECT a, CAST(a AS CHAR(3)) FROM t1 ORDER BY CAST(a AS CHAR(2)), a;
-# these two should be in alphabetic order
-SELECT a, CAST(a AS UNSIGNED) FROM t1 ORDER BY CAST(a AS CHAR) ;
-SELECT a, CAST(a AS CHAR(2)) FROM t1 ORDER BY CAST(a AS CHAR(3)), a;
-DROP TABLE t1;
-
-#
-# Test for bug #6914 "Problems using time()/date() output in expressions".
-# When we are casting datetime value to DATE/TIME we should throw away
-# time/date parts (correspondingly).
-#
-select date_add(cast('2004-12-30 12:00:00' as date), interval 0 hour);
-select timediff(cast('2004-12-30 12:00:00' as time), '12:00:00');
-# Still we should not throw away "days" part of time value
-select timediff(cast('1 12:00:00' as time), '12:00:00');
-
-#
-# Bug #7036: Casting from string to unsigned would cap value of result at
-# maximum signed value instead of maximum unsigned value
-#
-select cast(18446744073709551615 as unsigned);
-select cast(18446744073709551615 as signed);
-select cast('18446744073709551615' as unsigned);
-select cast('18446744073709551615' as signed);
-select cast('9223372036854775807' as signed);
-
-select cast(concat('184467440','73709551615') as unsigned);
-select cast(concat('184467440','73709551615') as signed);
-
-select cast(repeat('1',20) as unsigned);
-select cast(repeat('1',20) as signed);
-
-#
-# Bug #13344: cast of large decimal to signed int not handled correctly
-#
-select cast(1.0e+300 as signed int);
-
-#
-# Test that we create the correct types with create ... select cast()
-#
-
-create table t1 select cast(1 as unsigned), cast(1 as signed), cast(1 as double(5,2)), cast(1 as decimal(5,3)), cast("A" as binary), cast("A" as char(100)), cast("2001-1-1" as DATE), cast("2001-1-1" as DATETIME), cast("1:2:3" as TIME);
-show create table t1;
-drop table t1;
-
-#
-# Bugs: #15098: CAST(column double TO signed int), wrong result
-#
-CREATE TABLE t1 (f1 double);
-INSERT INTO t1 SET f1 = -1.0e+30 ;
-INSERT INTO t1 SET f1 = +1.0e+30 ;
-SELECT f1 AS double_val, CAST(f1 AS SIGNED INT) AS cast_val FROM t1;
-DROP TABLE t1;
-
-#
-# Bug #23938: cast(NULL as DATE)
-#
-
-select isnull(date(NULL)), isnull(cast(NULL as DATE));
-
-#
-# Bug#23656: Wrong result of CAST from DATE to int
-#
-SELECT CAST(cast('01-01-01' as date) AS UNSIGNED);
-SELECT CAST(cast('01-01-01' as date) AS SIGNED);
-
---echo End of 4.1 tests
-
-
-#decimal-related additions
-select cast('1.2' as decimal(3,2));
-select 1e18 * cast('1.2' as decimal(3,2));
-select cast(cast('1.2' as decimal(3,2)) as signed);
-set @v1=1e18;
-select cast(@v1 as decimal(22, 2));
-select cast(-1e18 as decimal(22,2));
-
-create table t1(s1 time);
-insert into t1 values ('11:11:11');
-select cast(s1 as decimal(7,2)) from t1;
-drop table t1;
-
-#
-# Test for bug #11283: field conversion from varchar, and text types to decimal
-#
-
-CREATE TABLE t1 (v varchar(10), tt tinytext, t text,
- mt mediumtext, lt longtext);
-INSERT INTO t1 VALUES ('1.01', '2.02', '3.03', '4.04', '5.05');
-
-SELECT CAST(v AS DECIMAL), CAST(tt AS DECIMAL), CAST(t AS DECIMAL),
- CAST(mt AS DECIMAL), CAST(lt AS DECIMAL) from t1;
-
-DROP TABLE t1;
-
-#
-# Bug #10237 (CAST(NULL DECIMAL) crashes server)
-#
-select cast(NULL as decimal(6)) as t1;
-
-
-#
-# Bug #17903: cast to char results in binary
-#
-set names latin1;
-select hex(cast('a' as char(2) binary));
-select hex(cast('a' as binary(2)));
-select hex(cast('a' as char(2) binary));
-
-#
-# Bug#29898: Item_date_typecast::val_int doesn't reset the null_value flag.
-#
-CREATE TABLE t1 (d1 datetime);
-INSERT INTO t1(d1) VALUES ('2007-07-19 08:30:00'), (NULL),
- ('2007-07-19 08:34:00'), (NULL), ('2007-07-19 08:36:00');
-SELECT cast(date(d1) as signed) FROM t1;
-drop table t1;
-
-#
-# Bug #31990: MINUTE() and SECOND() return bogus results when used on a DATE
-#
-
-# Show that HH:MM:SS of a DATE are 0, and that it's the same for columns
-# and typecasts (NULL in, NULL out).
-CREATE TABLE t1 (f1 DATE);
-INSERT INTO t1 VALUES ('2007-07-19'), (NULL);
-SELECT HOUR(f1),
- MINUTE(f1),
- SECOND(f1) FROM t1;
-SELECT HOUR(CAST('2007-07-19' AS DATE)),
- MINUTE(CAST('2007-07-19' AS DATE)),
- SECOND(CAST('2007-07-19' AS DATE));
-SELECT HOUR(CAST(NULL AS DATE)),
- MINUTE(CAST(NULL AS DATE)),
- SECOND(CAST(NULL AS DATE));
-SELECT HOUR(NULL),
- MINUTE(NULL),
- SECOND(NULL);
-DROP TABLE t1;
-
---echo End of 5.0 tests
-
---echo #
---echo # Bug #44766: valgrind error when using convert() in a subquery
---echo #
-
-CREATE TABLE t1(a tinyint);
-INSERT INTO t1 VALUES (127);
-SELECT 1 FROM
-(
- SELECT CONVERT(t2.a USING UTF8) FROM t1, t1 t2 LIMIT 1
-) AS s LIMIT 1;
-DROP TABLE t1;
-
---echo #
---echo # Bug #11765023: 57934: DOS POSSIBLE SINCE BINARY CASTING
---echo # DOESN'T ADHERE TO MAX_ALLOWED_PACKET
-
-SET @@GLOBAL.max_allowed_packet=2048;
-# reconnect to make the new max packet size take effect
---connect (newconn, localhost, root,,)
-
-SELECT CONVERT('a', BINARY(2049));
-SELECT CONVERT('a', CHAR(2049));
-SELECT length(CONVERT(repeat('a',2048), CHAR(2049)));
-
-connection default;
-disconnect newconn;
-SET @@GLOBAL.max_allowed_packet=default;
-
---echo #
---echo # Bug#13519724 63793: CRASH IN DTCOLLATION::SET(DTCOLLATION &SET)
---echo #
-
-CREATE TABLE t1 (a VARCHAR(50));
-
-SELECT a FROM t1
-WHERE CAST(a as BINARY)=x'62736D697468'
- AND CAST(a AS BINARY)=x'65736D697468';
-
-DROP TABLE t1;
-
---echo #
---echo # Bug#13581962 HIGH MEMORY USAGE ATTEMPT, THEN CRASH WITH
---echo # LONGTEXT, UNION, USER VARIABLE
---echo # Bug#14096619 UNABLE TO RESTORE DATABASE DUMP
---echo #
-
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-CREATE TABLE t1 AS SELECT CONCAT(CAST(REPEAT('9', 1000) AS SIGNED)),
- CONCAT(CAST(REPEAT('9', 1000) AS UNSIGNED));
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
---echo # End of test for Bug#13581962, Bug#14096619
-
---echo End of 5.1 tests
-
-select cast("2101-00-01 02:03:04" as datetime);
-select cast(cast("2101-00-01 02:03:04" as datetime) as time);
-SELECT CAST(CAST('20:05:05' AS TIME) as date);
-set sql_mode= TRADITIONAL;
-select cast("2101-00-01 02:03:04" as datetime);
-select cast(cast("2101-00-01 02:03:04" as datetime) as time);
-SELECT CAST(CAST('20:05:05' AS TIME) as date);
-set sql_mode=DEFAULT;
-
-#
-# lp:737458 Casting dates and times into integers works differently
-# in 5.1-micro
-#
-create table t1 (f1 time, f2 date, f3 datetime);
-insert into t1 values ('11:22:33','2011-12-13','2011-12-13 11:22:33');
-select cast(f1 as unsigned), cast(f2 as unsigned), cast(f3 as unsigned) from t1;
-drop table t1;
-
-#
-# CAST(... AS DATE) and invalid dates
-#
-SELECT CAST(TIME('10:20:30') AS DATE) + INTERVAL 1 DAY;
-
-SET SQL_MODE=ALLOW_INVALID_DATES;
-SELECT DATE("foo");
-
-#
-# CAST and field definition using same fields in LEX
-#
-create table t1 (a int, b char(5) as (cast("a" as char(10) binary) + a) );
-show create table t1;
-drop table t1;
-
-#
-# CAST (... BINARY)
-#
-select collation(cast("a" as char(10) binary));
-select collation(cast("a" as char(10) charset utf8 binary));
-select collation(cast("a" as char(10) ascii binary));
-select collation(cast("a" as char(10) binary charset utf8));
-select collation(cast("a" as char(10) binary ascii));
-
---echo #
---echo # MDEV-11030 Assertion `precision > 0' failed in decimal_bin_size
---echo #
-
-SELECT * FROM (SELECT IFNULL(CONVERT(NULL, UNSIGNED), NULL)) sq;
-
-CREATE TABLE t1 AS SELECT IFNULL(CONVERT(NULL, UNSIGNED), NULL);
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 AS SELECT COALESCE(CONVERT(NULL, UNSIGNED), NULL);
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 AS SELECT CASE WHEN TRUE THEN CONVERT(NULL, UNSIGNED) ELSE NULL END;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 AS SELECT IFNULL(CONVERT(NULL,SIGNED),CONVERT(NULL,UNSIGNED)) AS a;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 AS SELECT
- -1,
- CONVERT(NULL,SIGNED),
- CONCAT(CONVERT(NULL,SIGNED)),
- 1,
- CONVERT(NULL,UNSIGNED),
- CONCAT(CONVERT(NULL,UNSIGNED));
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 AS SELECT
- CONVERT('',SIGNED),
- CONCAT(CONVERT('',SIGNED)),
- CONVERT('',UNSIGNED),
- CONCAT(CONVERT('',UNSIGNED));
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-12849 Out-of-range errors when casting hex-hybrid to SIGNED and UNSIGNED
---echo #
-
-SET sql_mode=STRICT_ALL_TABLES;
-DELIMITER $$;
-CREATE PROCEDURE p1(hh TEXT)
-BEGIN
- EXECUTE IMMEDIATE
- CONCAT('CREATE OR REPLACE TABLE t1 AS SELECT CAST(0x', hh, ' AS UNSIGNED) AS c');
- DESCRIBE t1;
- SELECT c, LENGTH(c) FROM t1;
- DROP TABLE t1;
- EXECUTE IMMEDIATE
- CONCAT('CREATE OR REPLACE TABLE t1 AS SELECT CAST(0x', hh, ' AS SIGNED) AS c');
- DESCRIBE t1;
- SELECT c, LENGTH(c) FROM t1;
- DROP TABLE t1;
- SELECT '' AS `------`;
-END
-$$
-DELIMITER ;$$
-CALL p1('FF');
-CALL p1('FFFF');
-CALL p1('FFFFFF');
-CALL p1('FFFFFFFF');
-CALL p1('FFFFFFFFFF');
-CALL p1('FFFFFFFFFFFF');
-CALL p1('FFFFFFFFFFFFFF');
-CALL p1('FFFFFFFFFFFFFFFF');
-CALL p1('FFFFFFFFFFFFFFFFFF');
-CALL p1('FFFFFFFFFFFFFFFFFFFF');
-
-CALL p1('8000000000000000');
-CALL p1('80000000000000FF');
-CALL p1('800000000000FFFF');
-CALL p1('8000000000FFFFFF');
-CALL p1('80000000FFFFFFFF');
-CALL p1('800000FFFFFFFFFF');
-CALL p1('8000FFFFFFFFFFFF');
-CALL p1('80FFFFFFFFFFFFFF');
-CALL p1('8FFFFFFFFFFFFFFF');
-
-DROP PROCEDURE p1;
-SET sql_mode=DEFAULT;
-
-
---echo #
---echo # MDEV-12852 Out-of-range errors when CAST(1-2 AS UNSIGNED
---echo #
-
-SET sql_mode=STRICT_ALL_TABLES;
-CREATE TABLE t1 AS SELECT
- CAST(-1 AS UNSIGNED),
- CAST(1-2 AS UNSIGNED);
-SHOW CREATE TABLE t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-SET sql_mode=DEFAULT;
-
-
---echo #
---echo # MDEV-12853 Out-of-range errors when CAST('-1' AS UNSIGNED
---echo #
-
-SET sql_mode=STRICT_ALL_TABLES;
-CREATE TABLE t1 AS SELECT CAST('-1' AS UNSIGNED);
-SHOW CREATE TABLE t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-SET sql_mode=DEFAULT;
-
-
---echo #
---echo # MDEV-14376 Explicit CAST(CHAR(N)) erroneously escalates warnings to errors in STRICT_ALL_TABLES
---echo #
-
-SET sql_mode=STRICT_ALL_TABLES;
-SELECT CAST('xxx' AS CHAR(1));
-
-CREATE OR REPLACE TABLE t1 (a VARCHAR(1));
-INSERT INTO t1 VALUES (CAST('xxx' AS CHAR(1)));
-DROP TABLE t1;
-
-CREATE OR REPLACE TABLE t1 (a VARCHAR(3));
-INSERT INTO t1 VALUES ('xxx');
-UPDATE t1 SET a=CAST(a AS CHAR(1));
-DROP TABLE t1;
-
-DELIMITER $$;
-BEGIN NOT ATOMIC
- DECLARE a VARCHAR(30) CHARACTER SET latin1;
- SET a=CAST('xxx' AS CHAR(1));
-END;
-$$
-DELIMITER ;$$
-
-DELIMITER $$;
-BEGIN NOT ATOMIC
- DECLARE a VARCHAR(30) CHARACTER SET latin1;
- SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET latin1);
-END;
-$$
-DELIMITER ;$$
-
-DELIMITER $$;
-BEGIN NOT ATOMIC
- DECLARE a VARCHAR(30) CHARACTER SET latin1;
- SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET utf8);
-END;
-$$
-DELIMITER ;$$
-
-DELIMITER $$;
-BEGIN NOT ATOMIC
- DECLARE a VARCHAR(30) CHARACTER SET utf8;
- SET a=CAST('xxx' AS CHAR(1));
-END;
-$$
-DELIMITER ;$$
-
-DELIMITER $$;
-BEGIN NOT ATOMIC
- DECLARE a VARCHAR(30) CHARACTER SET utf8;
- SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET latin1);
-END;
-$$
-DELIMITER ;$$
-
-DELIMITER $$;
-BEGIN NOT ATOMIC
- DECLARE a VARCHAR(30) CHARACTER SET utf8;
- SET a=CAST(_latin1'xxx' AS CHAR(1) CHARACTER SET utf8);
-END;
-$$
-DELIMITER ;$$
-
-
---echo # Conversion problems still escalate warnings to errors (without right truncation)
-
-DELIMITER $$;
---error ER_CANNOT_CONVERT_CHARACTER
-BEGIN NOT ATOMIC
- DECLARE a VARCHAR(30) CHARACTER SET utf8;
- SET a=CAST(_utf8 0xD18F AS CHAR(1) CHARACTER SET latin1);
-END;
-$$
-DELIMITER ;$$
-
-
---echo # Conversion problems still escalate warnings to errors (with right truncation)
-
-DELIMITER $$;
---error ER_CANNOT_CONVERT_CHARACTER
-BEGIN NOT ATOMIC
- DECLARE a VARCHAR(30) CHARACTER SET utf8;
- SET a=CAST(_utf8 0xD18FD18F AS CHAR(1) CHARACTER SET latin1);
-END;
-$$
-DELIMITER ;$$
-
-
---echo # CAST(number AS CHAR) escalates warnings to errors on truncation
-
-CREATE OR REPLACE TABLE t1 (a VARCHAR(10));
---error ER_TRUNCATED_WRONG_VALUE
-INSERT INTO t1 VALUES (CAST(123 AS CHAR(1)));
-DROP TABLE t1;
-
-CREATE OR REPLACE TABLE t1 (a VARCHAR(10));
-INSERT INTO t1 VALUES ('1');
---error ER_TRUNCATED_WRONG_VALUE
-UPDATE t1 SET a=CAST(123 AS CHAR(1));
-DROP TABLE t1;
-
-DELIMITER $$;
---error ER_TRUNCATED_WRONG_VALUE
-BEGIN NOT ATOMIC
- DECLARE a VARCHAR(10);
- SET a=CAST(123 AS CHAR(1));
-END;
-$$
-DELIMITER ;$$
-
-
---echo # CAST(temporal AS CHAR) escalates warnings to errors on truncation
-
-CREATE OR REPLACE TABLE t1 (a VARCHAR(10));
---error ER_TRUNCATED_WRONG_VALUE
-INSERT INTO t1 VALUES (CAST(TIME'10:20:30' AS CHAR(1)));
-DROP TABLE t1;
-
-CREATE OR REPLACE TABLE t1 (a VARCHAR(10));
-INSERT INTO t1 VALUES ('1');
---error ER_TRUNCATED_WRONG_VALUE
-UPDATE t1 SET a=CAST(TIME'10:20:30' AS CHAR(1));
-DROP TABLE t1;
-
-DELIMITER $$;
---error ER_TRUNCATED_WRONG_VALUE
-BEGIN NOT ATOMIC
- DECLARE a VARCHAR(10);
- SET a=CAST(TIME'10:20:30' AS CHAR(1));
-END;
-$$
-DELIMITER ;$$
-
-SET sql_mode=DEFAULT;
diff --git a/mysql-test/t/change_user.test b/mysql-test/t/change_user.test
deleted file mode 100644
index d191b1c3ca0..00000000000
--- a/mysql-test/t/change_user.test
+++ /dev/null
@@ -1,151 +0,0 @@
-# This test is checking that old password authentication works
-set global secure_auth=0;
-#
-# functional change user tests
-#
-create user test_nopw;
-grant select on test.* to test_nopw;
-create user test_oldpw identified by password "09301740536db389";
-grant select on test.* to test_oldpw;
-create user test_newpw identified by "newpw";
-grant select on test.* to test_newpw;
-
-select concat('<', user(), '>'), concat('<', current_user(), '>'), database();
-
-#
-# massaging the data for tests to pass in the embedded server,
-# that has authentication completely disabled or, if enabled, can
-# only do new auth (20-byte scramble).
-#
-
-change_user test_nopw;
---replace_result <@> <test_nopw@%> @> @localhost>
-select concat('<', user(), '>'), concat('<', current_user(), '>'), database();
-
-#
-# embedded with enabled privilege control cannot do plugin negotiation.
-# that is, it cannot try to authenticate with a new scramble, receive a request
-# to switch to an old scramble, and retry with an old scramble.
-# As a result, it cannot change to a user that has old scramble and
-# and it stays logged as a previous user - test_nopw in this test file.
-# For the embedded with auth we replace nopw with oldpw in the results.
-#
-let $repl = `select if(version() like '%embedded%' and user() like '%nopw%', 'nopw', 'oldpw')`;
-
-change_user test_oldpw, oldpw;
---replace_result <@> <test_oldpw@%> @> @localhost> $repl oldpw
-select concat('<', user(), '>'), concat('<', current_user(), '>'), database();
-change_user test_newpw, newpw;
---replace_result <@> <test_newpw@%> @> @localhost>
-select concat('<', user(), '>'), concat('<', current_user(), '>'), database();
-change_user root;
---replace_result <@> <root@localhost> @> @localhost>
-select concat('<', user(), '>'), concat('<', current_user(), '>'), database();
-
-change_user test_nopw,,test;
---replace_result <@> <test_nopw@%> @> @localhost>
-select concat('<', user(), '>'), concat('<', current_user(), '>'), database();
-change_user test_oldpw,oldpw,test;
---replace_result <@> <test_oldpw@%> @> @localhost> $repl oldpw
-select concat('<', user(), '>'), concat('<', current_user(), '>'), database();
-change_user test_newpw,newpw,test;
---replace_result <@> <test_newpw@%> @> @localhost>
-select concat('<', user(), '>'), concat('<', current_user(), '>'), database();
-change_user root,,test;
---replace_result <@> <root@localhost> @> @localhost>
-select concat('<', user(), '>'), concat('<', current_user(), '>'), database();
-
-drop user test_nopw;
-drop user test_oldpw;
-drop user test_newpw;
-
-#
-# Bug#20023 mysql_change_user() resets the value of SQL_BIG_SELECTS
-# The replace's are here to fix things for 32 bit systems
-#
-
---echo Bug#20023
-SELECT @@session.sql_big_selects;
-# The exact value depends on the server build flags
---replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
-SELECT @@global.max_join_size;
---echo change_user
---change_user
-SELECT @@session.sql_big_selects;
-# The exact value depends on the server build flags
---replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
-SELECT @@global.max_join_size;
-SET @@global.max_join_size = 10000;
-SET @@session.max_join_size = default;
---echo change_user
---change_user
-SELECT @@session.sql_big_selects;
-# On some machines the following will result into a warning
---disable_warnings
-SET @@global.max_join_size = 18446744073709551615;
---enable_warnings
-SET @@session.max_join_size = default;
---echo change_user
---change_user
-SELECT @@session.sql_big_selects;
---replace_result 4294967295 18446744073709551615
-SELECT @@global.max_join_size;
---replace_result 4294967295 18446744073709551615
-SELECT @@session.max_join_size;
-
-#
-# Bug#31418 User locks misfunctioning after mysql_change_user()
-#
-
---echo Bug#31418
-SELECT IS_FREE_LOCK('bug31418');
-SELECT IS_USED_LOCK('bug31418');
-SELECT GET_LOCK('bug31418', 1);
-SELECT IS_USED_LOCK('bug31418') = CONNECTION_ID();
---echo change_user
---change_user
-SELECT IS_FREE_LOCK('bug31418');
-SELECT IS_USED_LOCK('bug31418');
-
-#
-# Bug#31222: com_% global status counters behave randomly with
-# mysql_change_user.
-#
-
-FLUSH STATUS;
-
---disable_result_log
---disable_query_log
-
-let $i = 100;
-begin;
-while ($i)
-{
- dec $i;
- SELECT 1;
-}
-commit;
-
---enable_query_log
---enable_result_log
-
-let $before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_select',Value,1);
-
---change_user
-
-let $after= query_get_value(SHOW GLOBAL STATUS LIKE 'com_select',Value,1);
-
-if ($after != $before){
- SHOW GLOBAL STATUS LIKE 'com_select';
- die The value of com_select changed during change_user;
-}
-echo Value of com_select did not change;
-
-set global secure_auth=default;
-
-set timestamp=unix_timestamp('2010-10-10 10:10:10');
-select now();
-select year(now()) > 2011;
---echo change_user
---change_user
-select year(now()) > 2011;
diff --git a/mysql-test/t/change_user_notembedded.test b/mysql-test/t/change_user_notembedded.test
deleted file mode 100644
index 19421c6dd33..00000000000
--- a/mysql-test/t/change_user_notembedded.test
+++ /dev/null
@@ -1,26 +0,0 @@
-source include/not_embedded.inc;
-
-#
-# MDEV-3915 COM_CHANGE_USER allows fast password brute-forcing
-#
-# only three failed change_user per connection.
-# successful change_user do NOT reset the counter
-#
-connect (test,localhost,root,,);
-connection test;
---error 1045
-change_user foo,bar;
---error 1045
-change_user foo;
-change_user;
---error 1045
-change_user foo,bar;
---error 1047
-change_user foo,bar;
---error 1047
-change_user;
-disconnect test;
-connection default;
-
---echo that's all
-
diff --git a/mysql-test/t/check.test b/mysql-test/t/check.test
deleted file mode 100644
index 6a7b7253a59..00000000000
--- a/mysql-test/t/check.test
+++ /dev/null
@@ -1,81 +0,0 @@
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-connection con1;
---disable_warnings
-drop table if exists t1,t2;
-drop view if exists v1;
---enable_warnings
-
-# Add a lot of keys to slow down check
-create table t1(n int not null, key(n), key(n), key(n), key(n));
-let $1=10000;
---disable_query_log
-begin;
-while ($1)
-{
- eval insert into t1 values ($1);
- dec $1;
-}
-commit;
---enable_query_log
-send check table t1 extended;
-connection con2;
-insert into t1 values (200000);
-connection con1;
-reap;
-connection default;
-disconnect con1;
-disconnect con2;
-drop table t1;
-
-
-# End of 4.1 tests
-
-#
-# Bug#9897 Views: 'Check Table' crashes MySQL, with a view and a table
-# in the statement
-#
-Create table t1(f1 int);
-Create table t2(f1 int);
-Create view v1 as Select * from t1;
-Check Table v1,t2;
-drop view v1;
-drop table t1, t2;
-
-
-#
-# Bug#26325 TEMPORARY TABLE "corrupt" after first read, according to CHECK TABLE
-#
-CREATE TEMPORARY TABLE t1(a INT);
-CHECK TABLE t1;
-REPAIR TABLE t1;
-DROP TABLE t1;
-
-
---echo #
---echo # Bug#56422 CHECK TABLE run when the table is locked reports corruption
---echo # along with timeout
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1(a INT);
-LOCK TABLE t1 WRITE;
-
-connect(con1, localhost, root);
-SET lock_wait_timeout= 1;
-CHECK TABLE t1;
-
-connection default;
-UNLOCK TABLES;
-DROP TABLE t1;
-disconnect con1;
-
-
-# Wait till we reached the initial number of concurrent sessions
---source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/check_constraint.test b/mysql-test/t/check_constraint.test
deleted file mode 100644
index 9a77736acd7..00000000000
--- a/mysql-test/t/check_constraint.test
+++ /dev/null
@@ -1,113 +0,0 @@
-#
-# Check of check constraints
-
-set @save_check_constraint=@@check_constraint_checks;
-
-create table t1 (a int check(a>10), b int check (b > 20), constraint `min` check (a+b > 100), constraint `max` check (a+b <500)) engine=myisam;
-show create table t1;
-insert into t1 values (100,100);
---error ER_CONSTRAINT_FAILED
-insert into t1 values (1,1);
---error ER_CONSTRAINT_FAILED
-insert into t1 values (20,1);
---error ER_CONSTRAINT_FAILED
-insert into t1 values (20,30);
---error ER_CONSTRAINT_FAILED
-insert into t1 values (500,500);
-
---error ER_CONSTRAINT_FAILED
-insert into t1 values (101,101),(102,102),(600,600),(103,103);
-select * from t1;
-truncate table t1;
-insert ignore into t1 values (101,101),(102,102),(600,600),(103,103);
-select * from t1;
-set check_constraint_checks=0;
-truncate table t1;
-insert into t1 values (101,101),(102,102),(600,600),(103,103);
-select * from t1;
-set check_constraint_checks=@save_check_constraint;
-
---replace_regex /failed for.*/failed for table/
---error ER_CONSTRAINT_FAILED
-alter table t1 add c int default 0 check (c < 10);
-
-set check_constraint_checks=0;
-alter table t1 add c int default 0 check (c < 10);
-alter table t1 add check (a+b+c < 500);
-set check_constraint_checks=@save_check_constraint;
-
-show create table t1;
---error ER_CONSTRAINT_FAILED
-insert into t1 values(105,105,105);
---error ER_CONSTRAINT_FAILED
-insert into t1 values(249,249,9);
-insert into t1 values(105,105,9);
-select * from t1;
-
-create table t2 like t1;
-show create table t2;
---error ER_CANT_DROP_FIELD_OR_KEY
-alter table t2 drop constraint c;
-alter table t2 drop constraint if exists c;
-alter table t2 drop constraint min;
-show create table t2;
-
-drop table t1,t2;
-
-#
-# check constraint name auto-generation:
-#
-create or replace table t1 (a int, b int, constraint check (a>b));
-show create table t1;
-create or replace table t1 (a int, b int,
- constraint CONSTRAINT_1 check (a>1),
- constraint check (b>1));
-show create table t1;
-create or replace table t1 (a int, b int,
- constraint CONSTRAINT_1 check (a>1),
- constraint check (b>1),
- constraint CONSTRAINT_2 check (a>b));
-show create table t1;
-drop table t1;
-
-#
-# MDEV-10370 Check constraints on virtual columns fails on INSERT when column not specified
-#
-create table t1(c1 int, c2 int as (c1 + 1), check (c2 > 2));
---error ER_CONSTRAINT_FAILED
-insert into t1(c1) values(1);
-insert into t1(c1) values(2);
-drop table t1;
-
-#
-# MDEV-11117 CHECK constraint fails on intermediate step of ALTER
-#
--- error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-create or replace table t1( c1 int auto_increment primary key, check( c1 > 0 or c1 is null ) );
-
-#
-# MDEV-12421 Check constraint with query crashes server and renders DB unusable
-#
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-create table t1 (a int check (@b in (select user from mysql.user)));
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-create table t1 (a int check (a > @b));
-
-#
-# MDEV-13596 CHECK constraints disallow NULL to pass through, violating SQL
-#
-create table t1 (a int check (a = 1));
-insert t1 values (1);
---error ER_CONSTRAINT_FAILED
-insert t1 values (2);
-insert t1 values (NULL);
-select * from t1;
-drop table t1;
-
-#
-# MDEV-15141 Check constraint validation on a datetime field crashes the process
-#
-create table t1 (id int auto_increment primary key, datecol datetime, check (datecol>'0001-01-01 00:00:00'));
-insert into t1 (datecol) values (now());
-insert into t1 (datecol) values (now());
-drop table t1;
diff --git a/mysql-test/t/check_constraint_show.test b/mysql-test/t/check_constraint_show.test
deleted file mode 100644
index 4d57f247b5b..00000000000
--- a/mysql-test/t/check_constraint_show.test
+++ /dev/null
@@ -1,8 +0,0 @@
-# Table with 2 column-level check constraints and 1 table-level check constraint
-create or replace table t1( c1 int check( c1 > 0 ), c2 int check( c2 > 0 ), c3 int, constraint `range` check( ( c3 >= c1 ) and ( c3 <= c2 ) ), primary key( c1 ) );
-show create table t1;
-
-# Show all constraints, including check constraints
-select * from information_schema.table_constraints where table_name = 't1';
-
-drop table t1;
diff --git a/mysql-test/t/client_xml.test b/mysql-test/t/client_xml.test
deleted file mode 100644
index 5230922e4b8..00000000000
--- a/mysql-test/t/client_xml.test
+++ /dev/null
@@ -1,44 +0,0 @@
-# Can't run with embedded server
--- source include/not_embedded.inc
-
-# Disable concurrent inserts to avoid test failures when reading
-# data from concurrent connections (insert might return before
-# the data is actually in the table).
-set @old_concurrent_insert= @@global.concurrent_insert;
-set @@global.concurrent_insert= 0;
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-# Test of the xml output of the 'mysql' and 'mysqldump' clients -- makes
-# sure that basic encoding issues are handled properly
-create table t1 (
- `a&b` int,
- `a<b` int NOT NULL,
- `a>b` text
-);
-insert into t1 values (1, 2, 'a&b a<b a>b');
-
-# Determine the number of open sessions
---source include/count_sessions.inc
-
---exec $MYSQL --xml test -e "select * from t1"
---exec $MYSQL_DUMP --xml --skip-create-options test
-
---exec $MYSQL --xml test -e "select count(*) from t1"
---exec $MYSQL --xml test -e "select 1 < 2 from dual"
---exec $MYSQL --xml test -e "select 1 > 2 from dual"
---exec $MYSQL --xml test -e "select 1 & 3 from dual"
---exec $MYSQL --xml test -e "select null from dual"
---exec $MYSQL --xml test -e "select 1 limit 0"
---exec $MYSQL --xml test -vv -e "select 1 limit 0"
-
-drop table t1;
-
-# Restore global concurrent_insert value
-set @@global.concurrent_insert= @old_concurrent_insert;
-
-# Wait till the number of open sessions is <= the number before the runs with
-# $MYSQL and $MYSQL_DUMP
-# = The session caused by mysql and mysqldump have finished their disconnect
---source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/column_compression.inc b/mysql-test/t/column_compression.inc
deleted file mode 100644
index 89a96ef67ad..00000000000
--- a/mysql-test/t/column_compression.inc
+++ /dev/null
@@ -1,125 +0,0 @@
-FLUSH STATUS;
-
---error ER_COMPRESSED_COLUMN_USED_AS_KEY
-eval CREATE TABLE t1(a $typec, KEY(a(10)));
-
-eval CREATE TABLE t1(a $typec);
---error ER_COMPRESSED_COLUMN_USED_AS_KEY
-ALTER TABLE t1 ADD KEY(a(10));
-SHOW CREATE TABLE t1;
-
---echo # Make sure column was actually compressed
-INSERT INTO t1 VALUES(REPEAT('a', 1000));
-SELECT LEFT(a, 10), LENGTH(a) FROM t1;
-SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME IN('Column_compressions', 'Column_decompressions');
-SELECT DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
-
---echo # Make sure ALTER TABLE rebuilds table
-eval ALTER TABLE t1 MODIFY COLUMN a $typeu;
-SHOW CREATE TABLE t1;
-SELECT LEFT(a, 10), LENGTH(a) FROM t1;
-SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME IN('Column_compressions', 'Column_decompressions');
-SELECT DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
-
---echo # Rebuild back
-eval ALTER TABLE t1 MODIFY COLUMN a $typec;
-SHOW CREATE TABLE t1;
-SELECT LEFT(a, 10), LENGTH(a) FROM t1;
-SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME IN('Column_compressions', 'Column_decompressions');
-SELECT DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
-
---echo # Make sure CREATE TABLE ... LIKE inherits compression
-CREATE TABLE t2 LIKE t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
---echo # Make sure implicit CREATE TABLE ... SELECT inherits compression
-CREATE TABLE t2 SELECT * FROM t1;
-SHOW CREATE TABLE t2;
-SELECT LEFT(a, 10), LENGTH(a) FROM t2;
-SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME IN('Column_compressions', 'Column_decompressions');
-SELECT DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t2';
-DROP TABLE t2;
-
---echo # Make sure explicit CREATE TABLE ... SELECT doesn't inherit compression
-eval CREATE TABLE t2(a $typeu) SELECT * FROM t1;
-SHOW CREATE TABLE t2;
-SELECT LEFT(a, 10), LENGTH(a) FROM t2;
-SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME IN('Column_compressions', 'Column_decompressions');
-SELECT DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t2';
-DROP TABLE t2;
-
---echo # Make sure engine change works
-ALTER TABLE t1 ENGINE=InnoDB;
-SHOW CREATE TABLE t1;
-SELECT LEFT(a, 10), LENGTH(a) FROM t1;
-SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME IN('Column_compressions', 'Column_decompressions');
-
---echo # Make sure online add column works (requires InnoDB)
-eval ALTER TABLE t1 ADD COLUMN b $typec DEFAULT "must be visible";
-SELECT LEFT(a, 10), LENGTH(a), b FROM t1;
-SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME IN('Column_compressions', 'Column_decompressions');
-ALTER TABLE t1 DROP COLUMN b;
-
-ALTER TABLE t1 ENGINE=MyISAM;
-TRUNCATE TABLE t1;
-
---echo # Make sure column_compression_zlib_level works
-SET column_compression_zlib_level= 1;
-INSERT INTO t1 VALUES(REPEAT('ab', 1000));
-SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME IN('Column_compressions', 'Column_decompressions');
-SELECT DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
-TRUNCATE TABLE t1;
-
-SET column_compression_zlib_level= 9;
-INSERT INTO t1 VALUES(REPEAT('ab', 1000));
-SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME IN('Column_compressions', 'Column_decompressions');
-SELECT DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
-
-SET column_compression_zlib_level= DEFAULT;
-TRUNCATE TABLE t1;
-
---echo # No compression, original data shorter than compressed
-INSERT INTO t1 VALUES('a');
-SELECT a, LENGTH(a) FROM t1;
-SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME IN('Column_compressions', 'Column_decompressions');
-SELECT DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
-
---echo # Coverage for store(double) and store(longlong)
-INSERT INTO t1 VALUES(3.14),(CAST(9.8 AS DOUBLE)),(1),(''),(NULL);
---echo # and for sort_string()
-SELECT * FROM t1 ORDER BY a;
-
---echo # Coverage for val_real() and val_int()
-SELECT a+1 FROM t1 ORDER BY 1;
-SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME IN('Column_compressions', 'Column_decompressions');
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-13540 - Server crashes in copy or Assertion `0' failed in virtual
---echo # Field* Field_varstring_compressed::new_key_field
---echo #
-eval CREATE TABLE t1 (c1 $typec) ENGINE=MyISAM;
-INSERT IGNORE INTO t1 VALUES ('foo'),('bar');
-
-eval CREATE TABLE t2 (c2 $typec) ENGINE=MyISAM; # Compression is optional
-INSERT IGNORE INTO t2 VALUES ('qux'),('abc'); # Optional
-
-SELECT * FROM t1 WHERE c1 NOT IN ( SELECT c2 FROM t2 WHERE c2 = c1 );
-
-# Cleanup
-DROP TABLE t1, t2;
-
-
---echo #
---echo # MDEV-13541 - Server crashes in next_breadth_first_tab or Assertion `0'
---echo # failed in Field_varstring_compressed::new_key_field
---echo #
-eval CREATE TABLE t1 (c $typec) ENGINE=InnoDB;
-INSERT INTO t1 VALUES ('foo'),('bar');
-
-SELECT DISTINCT c FROM t1;
-
-# Cleanup
-DROP TABLE t1;
diff --git a/mysql-test/t/column_compression.test b/mysql-test/t/column_compression.test
deleted file mode 100644
index d3f848144b6..00000000000
--- a/mysql-test/t/column_compression.test
+++ /dev/null
@@ -1,81 +0,0 @@
---source include/have_innodb.inc
---source include/have_csv.inc
-
-let $MYSQLD_DATADIR= `select @@datadir`;
-
-SET column_compression_zlib_wrap=true;
-let $typec= BLOB COMPRESSED;
-let $typeu= BLOB;
---source column_compression.inc
-
-let $typec= TEXT COMPRESSED;
-let $typeu= TEXT;
---source column_compression.inc
-
-let $typec= VARBINARY(10000) COMPRESSED;
-let $typeu= VARBINARY(10000);
---source column_compression.inc
-
-let $typec= VARCHAR(10000) COMPRESSED;
-let $typeu= VARCHAR(10000);
---source column_compression.inc
-
-let $typec= TEXT CHARSET ucs2 COMPRESSED;
-let $typeu= TEXT;
---source column_compression.inc
-
-SET column_compression_zlib_wrap=DEFAULT;
-let $typec= BLOB COMPRESSED;
-let $typeu= BLOB;
---source column_compression.inc
-
---error ER_WRONG_FIELD_SPEC
-CREATE TABLE t1(a CHAR(100) COMPRESSED);
---error ER_WRONG_FIELD_SPEC
-CREATE TABLE t1(a INT COMPRESSED);
---error ER_UNKNOWN_COMPRESSION_METHOD
-CREATE TABLE t1(a BLOB COMPRESSED=unknown);
-CREATE TABLE t1(a BLOB COMPRESSED COMPRESSED);
-DROP TABLE t1;
-CREATE TABLE t1(a INT);
---error ER_WRONG_FIELD_SPEC
-ALTER TABLE t1 MODIFY a INT COMPRESSED;
-DROP TABLE t1;
-
---echo # Test CSV
-CREATE TABLE t1(a BLOB NOT NULL COMPRESSED) ENGINE=CSV;
-INSERT INTO t1 VALUES(REPEAT('a', 110));
-SELECT LENGTH(a) FROM t1;
-ALTER TABLE t1 ENGINE=MyISAM;
-SELECT LENGTH(a) FROM t1;
-ALTER TABLE t1 ENGINE=CSV;
-SELECT LENGTH(a) FROM t1;
-SHOW CREATE TABLE t1;
---cat_file $MYSQLD_DATADIR/test/t1.CSV
-DROP TABLE t1;
-
---echo # Test fields that don't fit data
-CREATE TABLE t1(a VARCHAR(9) COMPRESSED);
---error ER_DATA_TOO_LONG
-INSERT INTO t1 VALUES(REPEAT('a', 10));
-INSERT INTO t1 VALUES(REPEAT(' ', 10));
-SELECT a, LENGTH(a) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1(a TINYTEXT COMPRESSED);
-SET column_compression_threshold=300;
---error ER_DATA_TOO_LONG
-INSERT INTO t1 VALUES(REPEAT('a', 255));
-INSERT INTO t1 VALUES(REPEAT(' ', 255));
-SET column_compression_threshold=DEFAULT;
-SELECT a, LENGTH(a) FROM t1;
-DROP TABLE t1;
-
---echo # Corner case: VARCHAR(255) COMPRESSED must have 2 bytes pack length
-CREATE TABLE t1(a VARCHAR(255) COMPRESSED);
-SHOW CREATE TABLE t1;
-SET column_compression_threshold=300;
-INSERT INTO t1 VALUES(REPEAT('a', 255));
-SET column_compression_threshold=DEFAULT;
-SELECT a, LENGTH(a) FROM t1;
-DROP TABLE t1;
diff --git a/mysql-test/t/column_compression_parts.test b/mysql-test/t/column_compression_parts.test
deleted file mode 100644
index 9a6f63d0cde..00000000000
--- a/mysql-test/t/column_compression_parts.test
+++ /dev/null
@@ -1,182 +0,0 @@
---source include/have_partition.inc
-
---disable_warnings
-DROP TABLE IF EXISTS t1,t2,t3,t4;
---enable_warnings
-FLUSH STATUS;
-
-echo ---------------------------------------by range------------------------------------------;
-
-CREATE TABLE t1 (i int, a VARCHAR(1000) COMPRESSED DEFAULT "AAA")
- PARTITION BY RANGE COLUMNS (a)(
- PARTITION p0 VALUES LESS THAN ('g') COMMENT "p0",
- PARTITION p1 VALUES LESS THAN ('m'),
- PARTITION p2 VALUES LESS THAN ('t'),
- PARTITION p3 VALUES LESS THAN ('w'));
-
-ALTER TABLE t1 ADD PARTITION (PARTITION p4 VALUES LESS THAN (MAXVALUE));
-
-INSERT INTO t1 VALUES (1,REPEAT('a',100)),(2,REPEAT('v',200)),(3,REPEAT('r',300)),(4,NULL);
-INSERT INTO t1 VALUES (5,REPEAT('k',500)),(6,'April'),(7,7),(8,""),(9,"M"),(10,DEFAULT);
-
-ALTER TABLE t1 ANALYZE PARTITION p1;
-ALTER TABLE t1 CHECK PARTITION p2;
-
-SELECT i,SUBSTRING(a,1,10) FROM t1 PARTITION (p2) ORDER BY i;
-SELECT i,SUBSTRING(a,1,10) FROM t1 where length(a)>=300 ORDER BY i;
-SELECT i,SUBSTRING(a,1,10) FROM t1 where a like "%k" ORDER BY i;
-
-DELETE FROM t1 where a="";
-DELETE FROM t1 where a=(REPEAT('a',100));
-DELETE FROM t1 where a like "%v";
-
-SELECT i,SUBSTRING(a,1,10) FROM t1 ORDER BY i;
-SELECT i,SUBSTRING(a,1,10) FROM t1 where a not like "%k" ORDER BY i;
-SELECT i,SUBSTRING(a,1,10) FROM t1 where (a>'m') ORDER BY i;
-SELECT i,SUBSTRING(a,1,10) FROM t1 where (a between 'h' and 'z') and (i=9) ORDER BY i;
-
-EXPLAIN PARTITIONS SELECT i,SUBSTRING(a,1,10) FROM t1 where (a>'m');
-EXPLAIN PARTITIONS SELECT i,SUBSTRING(a,1,10) FROM t1 where (a<'w');
-
-ALTER TABLE t1 TRUNCATE PARTITION p2;
-ALTER TABLE t1 DROP PARTITION p0;
-SHOW CREATE TABLE t1;
-
-ALTER TABLE t1 MODIFY COLUMN a VARCHAR(1000);
-SHOW CREATE TABLE t1;
-
-DROP TABLE t1;
-
-echo ---------------------------------------------------------------------------------------------;
-
-CREATE TABLE t1 (a VARCHAR(1000) COMPRESSED NOT NULL, id INT)
- PARTITION BY RANGE COLUMNS(id,a)(
- PARTITION p0 VALUES LESS THAN (100,'sss'),
- PARTITION p1 VALUES LESS THAN (MAXVALUE,MAXVALUE));
-
-INSERT INTO t1 VALUES (REPEAT('a',100), 23),(REPEAT('v',100),123),(REPEAT('z',100),24),(REPEAT('k',100),124);
-SELECT id,SUBSTRING(a,1,10) FROM t1 order by id;
-SELECT * from t1 partition (p0);
-SELECT * from t1 partition (p1);
-INSERT INTO t1 VALUES (REPEAT('a',100),101);
-SELECT * from t1 partition (p0);
-SELECT * from t1 partition (p1);
-ALTER TABLE t1 DROP PARTITION p1;
-SELECT id,SUBSTRING(a,1,10) FROM t1 WHERE id<50 order by id;
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-INSERT INTO t1 VALUES (REPEAT('a',100),101);
-
-ALTER TABLE t1 ALTER COLUMN a SET DEFAULT 'qwerty';
-ALTER TABLE t1 ALTER COLUMN a DROP DEFAULT;
-
-ALTER TABLE t1 MODIFY COLUMN a VARCHAR(1000);
-ALTER TABLE t1 ALTER COLUMN a DROP DEFAULT;
-INSERT INTO t1 VALUES (REPEAT('b',100),11);
---error ER_NO_DEFAULT_FOR_FIELD
-INSERT INTO t1 VALUES (default,10);
-
-ALTER TABLE t1 MODIFY COLUMN a VARCHAR(1000) COMPRESSED;
-SHOW CREATE TABLE t1;
-SELECT * from t1 ORDER BY id;
-
-DROP TABLE t1;
-
-echo ----------------------------1 partition--------------------------------------------------;
-
-CREATE TABLE t1 (a VARCHAR(1000) COMPRESSED DEFAULT "10-12-2010")
- PARTITION BY RANGE COLUMNS (a) (partition p0 VALUES LESS THAN (MAXVALUE));
-INSERT INTO t1 VALUES (REPEAT('a',100)), (REPEAT('v',200)), (REPEAT('Z',300)),(NULL),(DEFAULT);
-INSERT INTO t1 VALUES (DEFAULT),(REPEAT('b',200)),(REPEAT('q',300)),(DEFAULT),("MAY");
-
---sorted_result
-SELECT SUBSTRING(a,1,10) FROM t1;
-
-echo -----------------------------------------by key------------------------------------------;
-
-ALTER TABLE t1 PARTITION BY KEY(a) PARTITIONS 6;
-SHOW CREATE TABLE t1;
-UPDATE t1 SET a="NEW" where length(a)<20;
---sorted_result
-SELECT SUBSTRING(a,1,10) FROM t1;
-
-CREATE TABLE t2 (a VARBINARY(1000) COMPRESSED)
- PARTITION BY KEY(a) PARTITIONS 3;
-ALTER TABLE t2 PARTITION BY LINEAR KEY ALGORITHM=2 (a) PARTITIONS 32;
-
-INSERT INTO t2 VALUES (REPEAT('a',100)),(REPEAT('v',6)),(REPEAT('z',13)),(REPEAT('k',900));
---sorted_result
-SELECT SUBSTRING(a,1,10) FROM t2;
-
-CREATE TABLE t3 ( a VARCHAR(1000) COMPRESSED DEFAULT NULL)
- PARTITION BY LINEAR KEY(a) PARTITIONS 3;
-INSERT INTO t3 VALUES (REPEAT('a',100)),(REPEAT('v',100)),(NULL),(REPEAT('k',100)),(DEFAULT);
---sorted_result
-SELECT SUBSTRING(a,1,10) FROM t3 where a<>NULL;
-
-CREATE TABLE t4 (a VARBINARY(1000) COMPRESSED NOT NULL DEFAULT 0 COMMENT "QQ")
- PARTITION BY LINEAR KEY(a)
- PARTITIONS 3;
-INSERT INTO t4 VALUES (REPEAT('a',100)),('0'),(DEFAULT),(DEFAULT),(REPEAT('v',100)),(REPEAT('k',100));
---sorted_result
-SELECT SUBSTRING(a,1,10) FROM t4 where length(a)>3;
-
-DROP TABLE t1,t2,t3,t4;
-
-echo -----------------------------------subpartitions------------------------------------------;
-
-CREATE TABLE t1 (a VARCHAR(1000) COMPRESSED, id INT NOT NULL)
- PARTITION BY RANGE(id)
- SUBPARTITION BY KEY(a) SUBPARTITIONS 4
- (PARTITION p0 VALUES LESS THAN (5),
- PARTITION p1 VALUES LESS THAN (MAXVALUE));
-INSERT INTO t1 VALUES (REPEAT('a',100),23),(REPEAT('v',100),123),(REPEAT('z',100),24),(REPEAT('k',100),124);
-SELECT id,SUBSTRING(a,1,10) FROM t1 where a=(REPEAT('k',100)) order by id;
-DROP TABLE t1;
-
-echo -------------------------------------------------------------------------------------------;
-
---error ER_BLOB_FIELD_IN_PART_FUNC_ERROR
-CREATE TABLE t1 (a BLOB COMPRESSED)
- PARTITION BY KEY(a) partitions 30;
-
-CREATE TABLE t1 (a VARCHAR(200) COMPRESSED) PARTITION BY KEY(a) partitions 30;
-ALTER TABLE t1 COALESCE PARTITION 20;
-#ALTER TABLE t1 ADD PARTITION (PARTITION pm TABLESPACE = `innodb_file_per_table`); --mdev MDEV-13584
-ALTER TABLE t1 ADD PARTITION (PARTITION pm);
-CREATE TABLE t2 like t1;
-ALTER TABLE t2 REMOVE PARTITIONING;
-SHOW CREATE TABLE t1;
-SHOW CREATE TABLE t2;
-
-ALTER TABLE t1 EXCHANGE PARTITION pm WITH TABLE t2;
-DROP TABLE t1,t2;
-echo -------------------------------------------------------------------------------------------;
-
-CREATE TABLE t1 (a BLOB COMPRESSED default 5,i int);
-INSERT INTO t1 VALUES (REPEAT('a',100),1),(REPEAT('v',100),2),(REPEAT('z',100),3),(REPEAT('k',100),2),(2,2);
-
---error ER_BLOB_FIELD_IN_PART_FUNC_ERROR
-ALTER TABLE t1 PARTITION BY KEY(a) partitions 3;
-
-ALTER TABLE t1 PARTITION BY HASH(i) PARTITIONS 8;
---error ER_PARTITION_WRONG_VALUES_ERROR
-ALTER TABLE t1 REORGANIZE PARTITION p0 INTO (
- PARTITION s0 VALUES LESS THAN (1960),
- PARTITION s1 VALUES LESS THAN (1970)
-);
-SHOW CREATE TABLE t1;
-ALTER TABLE t1 REMOVE PARTITIONING;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(500) COMPRESSED default 5,i int)
- PARTITION BY RANGE COLUMNS(i)(
- PARTITION p0 VALUES LESS THAN (10),
- PARTITION p1 VALUES LESS THAN (100),
- PARTITION p2 VALUES LESS THAN (1000));
-INSERT INTO t1 VALUES (REPEAT('a',100),1),("one",21),(REPEAT('3',100),34),(REPEAT('k',100),267),(2,278);
-
-ALTER TABLE t1 REORGANIZE PARTITION p2 INTO (PARTITION p22 VALUES LESS THAN (MAXVALUE));
-SHOW CREATE TABLE t1;
-ALTER TABLE t1 REBUILD PARTITION p22;
-
-DROP TABLE t1; \ No newline at end of file
diff --git a/mysql-test/t/column_compression_rpl.test b/mysql-test/t/column_compression_rpl.test
deleted file mode 100644
index 86c73a77dbd..00000000000
--- a/mysql-test/t/column_compression_rpl.test
+++ /dev/null
@@ -1,16 +0,0 @@
---source include/have_innodb.inc
---source include/master-slave.inc
-
---let $engine_type= myisam
---let $engine_type2= innodb
---source include/column_compression_rpl.inc
-
---let $engine_type= innodb
---let $engine_type2= innodb
---source include/column_compression_rpl.inc
-
---let $engine_type= myisam
---let $engine_type2= myisam
---source include/column_compression_rpl.inc
-
---source include/rpl_end.inc
diff --git a/mysql-test/t/comment_column.test b/mysql-test/t/comment_column.test
deleted file mode 100644
index a4f3893dd4a..00000000000
--- a/mysql-test/t/comment_column.test
+++ /dev/null
@@ -1,133 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-create table t1 (c1 VARCHAR(10) NOT NULL COMMENT 'Abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', c2 INTEGER COMMENT 'aBcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd',c3 INTEGER COMMENT '012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789', c4 INTEGER, c5 INTEGER, c6 INTEGER, c7 INTEGER, INDEX i1 (c1) COMMENT 'i1 comment',INDEX i2(c2)
-) COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd';
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-SELECT comment,index_comment,char_length(index_comment) FROM information_schema.statistics WHERE table_name='t1';
-let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
---replace_result $ENGINE ENGINE
-SHOW CREATE TABLE t1;
-
-ALTER TABLE t1 ADD COLUMN c8 INTEGER COMMENT 'ABCdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd';
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-SELECT comment,index_comment,char_length(index_comment) FROM information_schema.statistics WHERE table_name='t1';
-let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
---replace_result $ENGINE ENGINE
-SHOW CREATE TABLE t1;
-
-
-ALTER TABLE t1 ADD COLUMN c9 INTEGER COMMENT 'ABCDefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd';
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-SELECT comment,index_comment,char_length(index_comment) FROM information_schema.statistics WHERE table_name='t1';
-let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
---replace_result $ENGINE ENGINE
-SHOW CREATE TABLE t1;
-
-
-ALTER TABLE t1 ADD COLUMN c10 INTEGER COMMENT 'ABCDEfghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd';
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-SELECT comment,index_comment,char_length(index_comment) FROM information_schema.statistics WHERE table_name='t1';
-let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
---replace_result $ENGINE ENGINE
-SHOW CREATE TABLE t1;
-
-
-ALTER TABLE t1 MODIFY COLUMN c8 CHAR(10);
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-SELECT comment,index_comment,char_length(index_comment) FROM information_schema.statistics WHERE table_name='t1';
-let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
---replace_result $ENGINE ENGINE
-SHOW CREATE TABLE t1;
-ALTER TABLE t1 CHANGE COLUMN c9 c9_1 INTEGER COMMENT '1234567890';
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-SELECT comment,index_comment,char_length(index_comment) FROM information_schema.statistics WHERE table_name='t1';
-let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
---replace_result $ENGINE ENGINE
-SHOW CREATE TABLE t1;
-
-ALTER TABLE t1 DROP COLUMN c1;
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-SELECT comment,index_comment,char_length(index_comment) FROM information_schema.statistics WHERE table_name='t1';
-let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
---replace_result $ENGINE ENGINE
-SHOW CREATE TABLE t1;
-
-
-# comment overflow(warning)
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-ALTER TABLE t1 ADD COLUMN c11 INTEGER COMMENT 'ABCDEfghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdABCDEfghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdABCDEfghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd';
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-SELECT comment,index_comment,char_length(index_comment) FROM information_schema.statistics WHERE table_name='t1';
-let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
---replace_result $ENGINE ENGINE
-SHOW CREATE TABLE t1;
-
-# comment overflow(error)
-set sql_mode='TRADITIONAL';
---error ER_TOO_LONG_FIELD_COMMENT
-ALTER TABLE t1 ADD COLUMN c12 INTEGER COMMENT 'ABCDEfghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdABCDEfghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdABCDEfghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd';
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-SELECT comment,index_comment,char_length(index_comment) FROM information_schema.statistics WHERE table_name='t1';
-let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
---replace_result $ENGINE ENGINE
-SHOW CREATE TABLE t1;
-
-set sql_mode='';
-ALTER TABLE t1 ADD COLUMN c12 CHAR(100) COMMENT 'ABCDefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd';
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-SELECT comment,index_comment,char_length(index_comment) FROM information_schema.statistics WHERE table_name='t1';
-let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
---replace_result $ENGINE ENGINE
-SHOW CREATE TABLE t1;
-
-
-# comment overflow(warning)
-drop table t1;
-create table t1 (c1 VARCHAR(10) NOT NULL COMMENT 'Abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', c2 INTEGER COMMENT 'aBcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdaBcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd',c3 INTEGER COMMENT '012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789', c4 INTEGER, c5 INTEGER, c6 INTEGER, c7 INTEGER, INDEX i1 (c1) COMMENT 'i1 comment',INDEX i2(c2)
-) COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd';
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-SELECT comment,index_comment,char_length(index_comment) FROM information_schema.statistics WHERE table_name='t1';
-let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
---replace_result $ENGINE ENGINE
-SHOW CREATE TABLE t1;
-
-# comment overflow(error)
-DROP TABLE t1;
-set sql_mode='TRADITIONAL';
---error ER_TOO_LONG_FIELD_COMMENT
-create table t1 (c1 VARCHAR(10) NOT NULL COMMENT 'Abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', c2 INTEGER COMMENT 'aBcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdaBcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd',c3 INTEGER COMMENT '012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789', c4 INTEGER, c5 INTEGER, c6 INTEGER, c7 INTEGER, INDEX i1 (c1) COMMENT 'i1 comment',INDEX i2(c2)
-) COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd';
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-SELECT comment,index_comment,char_length(index_comment) FROM information_schema.statistics WHERE table_name='t1';
-
-# bug#48077
-SET sql_mode='';
-CREATE TABLE t1_toupg (c1 INT, c2 VARCHAR(10) COMMENT
-'01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234')
-COMMENT='abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcde';
-# Alter the existing table, change comment
-ALTER TABLE t1_toupg COMMENT='012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012301234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234';
-# Alter existing table, add new column with comment
-ALTER TABLE t1_toupg ADD c3 TIMESTAMP COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcde';
-# Alter existing table, add index with comment
-ALTER TABLE t1_toupg ADD INDEX i1(c1) COMMENT '01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234';
-# Add index with comment using CREATE INDEX
-CREATE INDEX i2 ON t1_toupg(c2) COMMENT '01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234';
-# Alter the existing table, replace all columns, change comment
-ALTER TABLE t1_toupg drop column c1, drop column c2, drop column c3, add column c4 int, COMMENT='012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012301234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234';
-drop table t1_toupg;
-
-
diff --git a/mysql-test/t/comment_column2.test b/mysql-test/t/comment_column2.test
deleted file mode 100644
index ea66ab3b066..00000000000
--- a/mysql-test/t/comment_column2.test
+++ /dev/null
@@ -1,172 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-create table t1 (
-c1 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c2 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c3 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c4 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c5 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c6 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c7 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c8 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c9 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c10 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c11 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c12 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c13 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c14 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c15 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c16 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c17 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c18 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c19 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c20 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c21 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c22 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c23 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c24 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c25 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c26 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c27 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c28 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c29 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c30 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c31 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c32 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c33 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c34 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c35 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c36 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c37 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c38 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c39 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c40 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c41 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c42 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c43 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c44 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c45 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c46 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c47 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c48 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c49 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c50 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij');
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-SELECT comment,index_comment,char_length(index_comment) FROM information_schema.statistics WHERE table_name='t1';
-
-ALTER TABLE t1 ADD COLUMN c51 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',ADD COLUMN c52 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij';
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-SELECT comment,index_comment,char_length(index_comment) FROM information_schema.statistics WHERE table_name='t1';
-
-ALTER TABLE t1 ADD COLUMN c53 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij';
-
-ALTER TABLE t1 ADD COLUMN c54 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij';
-
-ALTER TABLE t1 ADD COLUMN c55 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij';
-
-ALTER TABLE t1 ADD COLUMN c56 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij';
-
-ALTER TABLE t1 ADD COLUMN c57 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij';
-
-ALTER TABLE t1 ADD COLUMN c58 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij';
-
-ALTER TABLE t1 ADD COLUMN c59 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij';
-
-ALTER TABLE t1 ADD COLUMN c60 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij';
-
-ALTER TABLE t1 ADD COLUMN c61 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij';
-
-ALTER TABLE t1 ADD COLUMN c62 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij';
-
-ALTER TABLE t1 ADD COLUMN c63 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij';
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-SELECT comment,index_comment,char_length(index_comment) FROM information_schema.statistics WHERE table_name='t1';
-
---error 1117
-ALTER TABLE t1 ADD COLUMN c64 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij';
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-SELECT comment,index_comment,char_length(index_comment) FROM information_schema.statistics WHERE table_name='t1';
-
-
-
-
-drop table t1;
---error 1117
-create table t1 (
-c1 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c2 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c3 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c4 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c5 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c6 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c7 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c8 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c9 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c10 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c11 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c12 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c13 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c14 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c15 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c16 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c17 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c18 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c19 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c20 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c21 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c22 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c23 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c24 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c25 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c26 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c27 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c28 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c29 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c30 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c31 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c32 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c33 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c34 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c35 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c36 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c37 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c38 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c39 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c40 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c41 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c42 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c43 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c44 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c45 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c46 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c47 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c48 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c49 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c50 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c51 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c52 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c53 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c54 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c55 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c56 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c57 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c58 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c59 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c60 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c61 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c62 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c63 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c64 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij',
-c65 INTEGER COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij')
-;
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-SELECT comment,index_comment,char_length(index_comment) FROM information_schema.statistics WHERE table_name='t1';
-
-
diff --git a/mysql-test/t/comment_index.test b/mysql-test/t/comment_index.test
deleted file mode 100644
index 4ba1f336ddb..00000000000
--- a/mysql-test/t/comment_index.test
+++ /dev/null
@@ -1,102 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-create table t1 (c1 VARCHAR(10) NOT NULL COMMENT 'Abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', c2 INTEGER COMMENT 'aBcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd',c3 INTEGER COMMENT '012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789', c4 INTEGER, c5 INTEGER, c6 INTEGER, c7 INTEGER, c8 VARCHAR(100), c9 CHAR(50), c10 DATETIME, c11 DATETIME, c12 DATETIME,c13 DATETIME, INDEX i1 (c1) COMMENT 'i1 comment',INDEX i2(c2)
-) COMMENT='ABCDEFGHIJabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd';
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-SELECT comment,index_comment,char_length(index_comment) FROM information_schema.statistics WHERE table_name='t1';
-let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
---replace_result $ENGINE ENGINE
-SHOW CREATE TABLE t1;
-
-
-CREATE INDEX i4 ON t1(c4) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd';
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-SELECT comment,index_comment,char_length(index_comment) FROM information_schema.statistics WHERE table_name='t1';
-let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
---replace_result $ENGINE ENGINE
-SHOW CREATE TABLE t1;
-
-
-ALTER TABLE t1 ADD INDEX (c6) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd';
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-SELECT comment,index_comment,char_length(index_comment) FROM information_schema.statistics WHERE table_name='t1';
-let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
---replace_result $ENGINE ENGINE
-SHOW CREATE TABLE t1;
-
-DROP INDEX i1 ON t1;
-ALTER TABLE t1 DROP INDEX i2, DROP INDEX i4;
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-SELECT comment,index_comment,char_length(index_comment) FROM information_schema.statistics WHERE table_name='t1';
-let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
---replace_result $ENGINE ENGINE
-SHOW CREATE TABLE t1;
-
-ALTER TABLE t1 ADD INDEX i8(c8) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd', ADD INDEX i10(c10) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd';
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-SELECT comment,index_comment,char_length(index_comment) FROM information_schema.statistics WHERE table_name='t1';
-let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
---replace_result $ENGINE ENGINE
-SHOW CREATE TABLE t1;
-
-
-# multicolumn index
-CREATE INDEX i1_3 ON t1(c1,c2,c3) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd';
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-SELECT comment,index_comment,char_length(index_comment) FROM information_schema.statistics WHERE table_name='t1';
-let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
---replace_result $ENGINE ENGINE
-SHOW CREATE TABLE t1;
-
-
-# comment overflow(warning)
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-CREATE INDEX i11 ON t1(c11) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd';
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-SELECT comment,index_comment,char_length(index_comment) FROM information_schema.statistics WHERE table_name='t1';
-let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
---replace_result $ENGINE ENGINE
-SHOW CREATE TABLE t1;
-
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-ALTER TABLE t1 ADD INDEX (c13) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd';
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-SELECT comment,index_comment,char_length(index_comment) FROM information_schema.statistics WHERE table_name='t1';
-let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
---replace_result $ENGINE ENGINE
-SHOW CREATE TABLE t1;
-
-
-
-# comment overflow(error)
-set sql_mode='TRADITIONAL';
---error ER_TOO_LONG_INDEX_COMMENT
-ALTER TABLE t1 ADD INDEX i12 (c12) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd';
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-SELECT comment,index_comment,char_length(index_comment) FROM information_schema.statistics WHERE table_name='t1';
-let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
---replace_result $ENGINE ENGINE
-SHOW CREATE TABLE t1;
-
-
-set sql_mode='TRADITIONAL';
---error ER_TOO_LONG_INDEX_COMMENT
-CREATE INDEX i12 ON t1(c12) COMMENT 'abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd';
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-SELECT comment,index_comment,char_length(index_comment) FROM information_schema.statistics WHERE table_name='t1';
-let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
---replace_result $ENGINE ENGINE
-SHOW CREATE TABLE t1;
-
-drop table t1;
diff --git a/mysql-test/t/comment_table.test b/mysql-test/t/comment_table.test
deleted file mode 100644
index 2a85fbac571..00000000000
--- a/mysql-test/t/comment_table.test
+++ /dev/null
@@ -1,55 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-#1024 bytes
-create table t1 (c1 VARCHAR(10) NOT NULL COMMENT 'c1 comment', c2 INTEGER,c3 INTEGER COMMENT '012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789', c4 INTEGER, c5 INTEGER, c6 INTEGER, c7 INTEGER, INDEX i1 (c1) COMMENT 'i1 comment',INDEX i2(c2)
-) COMMENT='abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd';
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
---replace_result $ENGINE ENGINE
-SHOW CREATE TABLE t1;
-drop table t1;
-
-#1025 bytes
-create table t1 (c1 VARCHAR(10) NOT NULL COMMENT 'c1 comment', c2 INTEGER,c3 INTEGER COMMENT '012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789', c4 INTEGER, c5 INTEGER, c6 INTEGER, c7 INTEGER, INDEX i1 (c1) COMMENT 'i1 comment',INDEX i2(c2)
-) COMMENT='abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcde';
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
---replace_result $ENGINE ENGINE
-SHOW CREATE TABLE t1;
-drop table t1;
-set sql_mode='TRADITIONAL';
-create table t1 (c1 VARCHAR(10) NOT NULL COMMENT 'c1 comment', c2 INTEGER,c3 INTEGER COMMENT '012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789', c4 INTEGER, c5 INTEGER, c6 INTEGER, c7 INTEGER, INDEX i1 (c1) COMMENT 'i1 comment',INDEX i2(c2)
-) COMMENT='abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcde';
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-drop table t1;
-
-
-#2048 bytes
-create table t1 (c1 VARCHAR(10) NOT NULL COMMENT 'c1 comment', c2 INTEGER,c3 INTEGER COMMENT '012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789', c4 INTEGER, c5 INTEGER, c6 INTEGER, c7 INTEGER, INDEX i1 (c1) COMMENT 'i1 comment',INDEX i2(c2)
-) COMMENT='abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcd';
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-let $ENGINE=`select variable_value from information_schema.global_variables where variable_name='STORAGE_ENGINE'`;
---replace_result $ENGINE ENGINE
-SHOW CREATE TABLE t1;
-drop table t1;
-
-
-#2049 bytes(warning)
-SET SQL_MODE='';
-create table t1 (c1 VARCHAR(10) NOT NULL COMMENT 'c1 comment', c2 INTEGER,c3 INTEGER COMMENT '012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789', c4 INTEGER, c5 INTEGER, c6 INTEGER, c7 INTEGER, INDEX i1 (c1) COMMENT 'i1 comment',INDEX i2(c2)
-) COMMENT='abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcde';
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
-drop table t1;
-SET SQL_MODE='TRADITIONAL';
-
---error ER_TOO_LONG_TABLE_COMMENT
-create table t1 (c1 VARCHAR(10) NOT NULL COMMENT 'c1 comment', c2 INTEGER,c3 INTEGER COMMENT '012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789', c4 INTEGER, c5 INTEGER, c6 INTEGER, c7 INTEGER, INDEX i1 (c1) COMMENT 'i1 comment',INDEX i2(c2)
-) COMMENT='abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcde';
-SELECT table_comment,char_length(table_comment) FROM information_schema.tables WHERE table_name='t1';
-SELECT column_comment,char_length(column_comment) FROM information_schema.columns WHERE table_name='t1';
diff --git a/mysql-test/t/comments.test b/mysql-test/t/comments.test
deleted file mode 100644
index 6cf69635d1e..00000000000
--- a/mysql-test/t/comments.test
+++ /dev/null
@@ -1,101 +0,0 @@
-#
-# Testing of comments
-#
-
-select 1+2/*hello*/+3;
-select 1 /* long
-multi line comment */;
---error 1065
- ;
-select 1 /*!32301 +1 */;
-select 1 /*!952301 +1 */;
-select 1--1;
-# Note that the following returns 4 while it should return 2
-# This is because the mysqld server doesn't parse -- comments
-select 1 --2
-+1;
-select 1 # The rest of the row will be ignored
-;
-/* line with only comment */;
-
-# End of 4.1 tests
-
-#
-# Testing of MariaDB executable comments
-#
-
-select 1 /*M! +1 */;
-select 1 /*M!50000 +1 */;
-select 1 /*M!50300 +1 */;
-select 2 /*M!99999 +1 */;
-select 2 /*M!100000 +1 */;
-select 2 /*M!999999 +1 */;
---error ER_PARSE_ERROR
-select 2 /*M!0000 +1 */;
-
---echo #
---echo # Testing that MySQL versions >= 5.7.x and < 10.0.0 are ignored (MDEV-5009)
---echo #
-SELECT 1 /*!50699 +1*/;
-SELECT 1 /*!50700 +1*/;
-SELECT 1 /*!50999 +1*/;
-SELECT 1 /*!99999 +1*/;
-SELECT 1 /*!100000 +1*/;
-SELECT 1 /*!110000 +1*/;
-
---echo #
---echo # Tesing that versions >= 5.7.x and < 10.0.0 are not ignored
---echo # when used with the MariaDB executable comment syntax.
---echo #
-SELECT 1 /*M!50699 +1*/;
-SELECT 1 /*M!50700 +1*/;
-SELECT 1 /*M!50999 +1*/;
-SELECT 1 /*M!99999 +1*/;
-SELECT 1 /*M!100000 +1*/;
-SELECT 1 /*M!110000 +1*/;
-
-#
-# Bug#25411 (trigger code truncated)
-#
-
---error ER_PARSE_ERROR
-select 1/*!2*/;
-
---error ER_PARSE_ERROR
-select 1/*!0000002*/;
-
-select 1/*!999992*/;
-
-select 1 + /*!00000 2 */ + 3 /*!999999 noise*/ + 4;
-
-#
-# Bug#28779 (mysql_query() allows execution of statements with unbalanced
-# comments)
-#
-
---disable_warnings
-drop table if exists table_28779;
---enable_warnings
-
-create table table_28779 (a int);
-
---error 1064
-prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*' AND b = 'bar';";
-
---error 1064
-prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*' AND b = 'bar';*";
-
---error 1064
-prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*! AND 2=2;";
-
---error 1064
-prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*! AND 2=2;*";
-
---error 1064
-prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*!998765' AND b = 'bar';";
-
---error 1064
-prepare bar from "DELETE FROM table_28779 WHERE a = 7 OR 1=1/*!998765' AND b = 'bar';*";
-
-drop table table_28779;
-
diff --git a/mysql-test/t/commit.test b/mysql-test/t/commit.test
deleted file mode 100644
index 762397dfa23..00000000000
--- a/mysql-test/t/commit.test
+++ /dev/null
@@ -1,675 +0,0 @@
---source include/have_innodb.inc
-
-connect (con1,localhost,root,,);
-
---echo #
---echo # Bug#20837 Apparent change of isolation level
---echo # during transaction
---echo #
---echo # Bug#53343 completion_type=1, COMMIT/ROLLBACK
---echo # AND CHAIN don't preserve the isolation
---echo # level
-#
-# A set of test cases that verifies operation of
-# transaction isolation level and chaining is
-# provided
-
-# init
-connection default;
-
-SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
-CREATE TABLE t1 (s1 INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1),(2);
-COMMIT;
-
-#
-# Verify that SET TRANS ISO LEVEL is not allowed
-# inside a transaction
-#
-START TRANSACTION;
---error ER_CANT_CHANGE_TX_CHARACTERISTICS
-SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
-COMMIT;
-
-#
-# Verify consistent output from
-# SELECT @@tx_isolation (Bug#20837)
-#
-# The transaction will be in READ UNCOMMITTED mode,
-# but SELECT @@tx_isolation should report the session
-# value, which is REPEATABLE READ
-#
-SET @@autocommit=0;
-COMMIT;
-SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
-START TRANSACTION;
-SELECT @@tx_isolation;
---echo Should be REPEATABLE READ
-SELECT * FROM t1;
-SELECT @@tx_isolation;
---echo Should be REPEATABLE READ
-INSERT INTO t1 VALUES (-1);
-SELECT @@tx_isolation;
---echo Should be REPEATABLE READ
-COMMIT;
-
-#
-# Verify that a change in the session variable
-# does not affect the currently started
-# transaction
-#
-START TRANSACTION;
-SELECT * FROM t1;
-SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
-
-connection con1;
-START TRANSACTION;
-INSERT INTO t1 VALUES (1000);
-COMMIT;
-
-connection default;
---echo We should not be able to read the '1000'
-SELECT * FROM t1;
-COMMIT;
-
---echo Now, the '1000' should appear.
-START TRANSACTION;
-SELECT * FROM t1;
-COMMIT;
-
-# restore the session value
-SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
-
-#
-# A set of test cases for verification that
-# isolation level during chaining works. MySQL
-# has three variants of chaining, i.e
-# COMMIT AND CHAIN, ROLLBACK AND CHAIN, and
-# the use of @completion_type
-#
-
-#
-# Verify isolation level with COMMIT AND CHAIN
-#
-# COMMIT AND CHAIN causes a new transaction to
-# begin as soon as the current ends, and the new
-# transaction will have the same tran. iso. level
-# as the first.
-#
-connection default;
-SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
-START TRANSACTION;
-
-connection con1;
-START TRANSACTION;
-INSERT INTO t1 VALUES (1001);
-COMMIT;
-
-connection default;
-SELECT COUNT(*) FROM t1 WHERE s1 = 1001;
---echo Should be 1
-COMMIT AND CHAIN;
-
-connection con1;
-INSERT INTO t1 VALUES (1002);
-COMMIT;
-
-connection default;
-SELECT COUNT(*) FROM t1 WHERE s1 = 1002;
---echo Should be 1
-COMMIT;
-SELECT * FROM t1;
-DELETE FROM t1 WHERE s1 >= 1000;
-COMMIT;
-
-#
-# Verify isolation level with ROLLBACK AND CHAIN
-#
-connection default;
-SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
-START TRANSACTION;
-
-connection con1;
-START TRANSACTION;
-INSERT INTO t1 VALUES (1001);
-COMMIT;
-
-connection default;
-SELECT COUNT(*) FROM t1 WHERE s1 = 1001;
---echo Should be 1
-ROLLBACK AND CHAIN;
-
-connection con1;
-INSERT INTO t1 VALUES (1002);
-COMMIT;
-
-connection default;
-SELECT COUNT(*) FROM t1 WHERE s1 = 1002;
---echo Should be 1
-COMMIT;
-SELECT * FROM t1;
-DELETE FROM t1 WHERE s1 >= 1000;
-COMMIT;
-
-#
-# Verify isolation level with @completion_type=1.
-# (A @@completion_type value of 1 is equivalentl to
-# explicitly adding "AND CHAIN" to COMMIT or ROLLBACK)
-#
-
-#
-# Verify that COMMIT AND NO CHAIN overrides the value
-# of @@completion_type
-#
-SET @@completion_type=1;
-
-connection default;
-SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
-START TRANSACTION;
-
-connection con1;
-START TRANSACTION;
-INSERT INTO t1 VALUES (1001);
-COMMIT;
-
-connection default;
-SELECT * FROM t1 WHERE s1 >= 1000;
---echo Should see 1001
-COMMIT AND NO CHAIN;
---echo default transaction is now in REPEATABLE READ
-
-connection con1;
-INSERT INTO t1 VALUES (1002);
-COMMIT;
-
-connection default;
-SELECT * FROM t1 WHERE s1 >= 1000;
---echo Should see 1001 and 1002
-
-connection con1;
-INSERT INTO t1 VALUES (1003);
-COMMIT;
-
-connection default;
-SELECT * FROM t1 WHERE s1 >= 1000;
---echo Should see 1001 and 1002, but NOT 1003
-COMMIT;
-
-SELECT * FROM t1;
-DELETE FROM t1 WHERE s1 >= 1000;
-COMMIT AND NO CHAIN;
-SET @@completion_type=0;
-COMMIT;
-
-#
-# Verify that ROLLBACK AND NO CHAIN overrides the value
-# of @@completion_type
-#
-connection default;
-SET @@completion_type=1;
-COMMIT AND NO CHAIN;
-SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
-START TRANSACTION;
-
-connection con1;
-START TRANSACTION;
-INSERT INTO t1 VALUES (1001);
-COMMIT;
-
-connection default;
-SELECT * FROM t1 WHERE s1 >= 1000;
---echo Should see 1001
-ROLLBACK AND NO CHAIN;
---echo default transaction is now in REPEATABLE READ
-
-connection con1;
-INSERT INTO t1 VALUES (1002);
-COMMIT;
-
-connection default;
-SELECT * FROM t1 WHERE s1 >= 1000;
---echo Should see 1001 and 1002
-
-connection con1;
-INSERT INTO t1 VALUES (1003);
-COMMIT;
-
-connection default;
-SELECT * FROM t1 WHERE s1 >= 1000;
---echo Should see 1001 and 1002, but NOT 1003
-
-COMMIT;
-SELECT * FROM t1;
-DELETE FROM t1 WHERE s1 >= 1000;
-COMMIT AND NO CHAIN;
-SET @@completion_type=0;
-COMMIT;
-
-#
-# Verify that in the sequence:
-# SET TRANSACTION ISOLATION LEVEL
-# SET SESSION ISOLATION LEVEL
-#
-# SET SESSION ISOLATION LEVEL has precedence over
-# SET TRANSACTION. (Note that this is _not_
-# in accordance with ISO 9075.)
-#
-connection default;
-
-SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
-SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
-START TRANSACTION;
-SELECT * FROM t1;
-
-connection con1;
-INSERT INTO t1 VALUES (1000);
-COMMIT;
-
-connection default;
-SELECT * FROM t1;
---echo Should get same result as above (i.e should not read '1000')
-COMMIT;
-
-DELETE FROM t1 WHERE s1 >= 1000;
-COMMIT;
-
-
-#
-# Verify that a transaction ended with an
-# implicit commit (i.e a DDL statement), the
-# @@completetion_type setting is ignored, and
-# the next transaction's isolation level is
-# the session level.
-#
-SET @@completion_type=1;
-COMMIT AND NO CHAIN;
-SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
-START TRANSACTION;
-TRUNCATE TABLE t1;
-INSERT INTO t1 VALUES (1000);
-SELECT * FROM t1;
---echo Should read '1000'
-
-connection con1;
-INSERT INTO t1 VALUES (1001);
-COMMIT;
-
-connection default;
-SELECT * FROM t1;
---echo Should only read the '1000' as this transaction is now in REP READ
-COMMIT AND NO CHAIN;
-
-SET @@completion_type=0;
-COMMIT AND NO CHAIN;
-
-
-#
-# Cleanup
-#
-SET @@autocommit=1;
-COMMIT;
-
-disconnect con1;
-
-DROP TABLE t1;
-
---echo #
---echo # End of test cases for Bug#20837
---echo #
-
-
---echo #
---echo # WL#5968 Implement START TRANSACTION READ (WRITE|ONLY);
---echo #
-
---echo #
---echo # Test 1: Check supported syntax
-
-START TRANSACTION;
-COMMIT;
-
-START TRANSACTION READ ONLY;
-COMMIT;
-
-START TRANSACTION READ WRITE;
-COMMIT;
-
---error ER_PARSE_ERROR
-START TRANSACTION READ ONLY, READ WRITE;
-
-START TRANSACTION READ ONLY, WITH CONSISTENT SNAPSHOT;
-COMMIT;
-
-START TRANSACTION READ WRITE, WITH CONSISTENT SNAPSHOT;
-COMMIT;
-
-START TRANSACTION WITH CONSISTENT SNAPSHOT, READ ONLY;
-COMMIT;
-
-START TRANSACTION WITH CONSISTENT SNAPSHOT, READ WRITE;
-COMMIT;
-
---error ER_PARSE_ERROR
-START TRANSACTION READ ONLY, WITH CONSISTENT SNAPSHOT, READ WRITE;
-
-SET TRANSACTION READ ONLY;
-SET TRANSACTION READ WRITE;
-SET TRANSACTION ISOLATION LEVEL SERIALIZABLE, READ ONLY;
-SET TRANSACTION ISOLATION LEVEL SERIALIZABLE, READ WRITE;
-SET TRANSACTION READ ONLY, ISOLATION LEVEL READ COMMITTED;
-SET TRANSACTION READ WRITE, ISOLATION LEVEL READ COMMITTED;
---error ER_PARSE_ERROR
-SET TRANSACTION READ ONLY, READ WRITE;
-COMMIT;
-
---echo #
---echo # Test 2: Check setting of variable.
-
-SET SESSION TRANSACTION READ WRITE;
-SELECT @@tx_read_only;
-
-SET SESSION TRANSACTION READ ONLY;
-SELECT @@tx_read_only;
-
-SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE;
-SELECT @@tx_read_only;
-
-SET SESSION TRANSACTION READ ONLY, ISOLATION LEVEL REPEATABLE READ;
-SELECT @@tx_read_only;
-
-START TRANSACTION;
---echo # Not allowed inside a transaction
---error ER_CANT_CHANGE_TX_CHARACTERISTICS
-SET TRANSACTION READ ONLY;
---echo # But these are allowed.
-SET SESSION TRANSACTION READ ONLY;
-SET GLOBAL TRANSACTION READ ONLY;
-COMMIT;
-
-# Reset to defaults
-SET SESSION TRANSACTION READ WRITE;
-SET GLOBAL TRANSACTION READ WRITE;
-
---echo #
---echo # Test 3: Test that write operations are properly blocked.
-
-CREATE TABLE t1(a INT);
-CREATE TEMPORARY TABLE temp_t2(a INT);
-
-SET SESSION TRANSACTION READ ONLY;
-
---echo # 1: DDL should be blocked, also on temporary tables.
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-CREATE TABLE t3(a INT);
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-ALTER TABLE t1 COMMENT "Test";
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-DROP TABLE t1;
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-CREATE TEMPORARY TABLE temp_t3(a INT);
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-ALTER TABLE temp_t2 COMMENT "Test";
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-DROP TEMPORARY TABLE temp_t2;
-
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-CREATE FUNCTION f1() RETURNS INT RETURN 1;
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-DROP FUNCTION f1;
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-CREATE PROCEDURE p1() BEGIN END;
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-DROP PROCEDURE p1;
-
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-CREATE VIEW v1 AS SELECT 1;
-SET SESSION TRANSACTION READ WRITE;
-CREATE VIEW v1 AS SELECT 1;
-SET SESSION TRANSACTION READ ONLY;
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-DROP VIEW v1;
-SET SESSION TRANSACTION READ WRITE;
-DROP VIEW v1;
-SET SESSION TRANSACTION READ ONLY;
-
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-RENAME TABLE t1 TO t2;
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-RENAME TABLE temp_t2 TO temp_t3;
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-TRUNCATE TABLE t1;
-
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-CREATE DATABASE db1;
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-DROP DATABASE db1;
-SET SESSION TRANSACTION READ WRITE;
-
---echo # 2: DML should be blocked on non-temporary tables.
-START TRANSACTION READ ONLY;
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-INSERT INTO t1 VALUES (1), (2);
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-UPDATE t1 SET a= 3;
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-DELETE FROM t1;
-
---echo # 3: DML should be allowed on temporary tables.
-INSERT INTO temp_t2 VALUES (1), (2);
-UPDATE temp_t2 SET a= 3;
-DELETE FROM temp_t2;
-
---echo # 4: Queries should not be blocked.
-SELECT * FROM t1;
-SELECT * FROM temp_t2;
-
-HANDLER t1 OPEN;
-HANDLER t1 READ FIRST;
-HANDLER t1 CLOSE;
-
-HANDLER temp_t2 OPEN;
-HANDLER temp_t2 READ FIRST;
-HANDLER temp_t2 CLOSE;
-
---echo # 5: Prepared statements
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-PREPARE stmt FROM "DELETE FROM t1";
-
-PREPARE stmt FROM "DELETE FROM temp_t2";
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-COMMIT;
-
---echo # 6: Stored routines
-
-delimiter |;
-CREATE FUNCTION f1() RETURNS INT
-BEGIN
- DELETE FROM t1;
- RETURN 1;
-END|
-
-CREATE FUNCTION f2() RETURNS INT
-BEGIN
- DELETE FROM temp_t2;
- RETURN 1;
-END|
-delimiter ;|
-
-CREATE PROCEDURE p1() DELETE FROM t1;
-CREATE PROCEDURE p2() DELETE FROM temp_t2;
-
-START TRANSACTION READ ONLY;
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-SELECT f1();
-SELECT f2();
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-CALL p1();
-CALL p2();
-COMMIT;
-
-DROP FUNCTION f1;
-DROP FUNCTION f2;
-DROP PROCEDURE p1;
-DROP PROCEDURE p2;
-
---echo # 7: Views
-CREATE VIEW v1 AS SELECT a FROM t1;
-# Not supported for temporary tables.
-
-START TRANSACTION READ ONLY;
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-INSERT INTO v1 VALUES (1), (2);
-SELECT * FROM v1;
-COMMIT;
-
-DROP VIEW v1;
-
---echo # 8: LOCK TABLE
-SET SESSION TRANSACTION READ ONLY;
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-LOCK TABLE t1 WRITE;
-
-LOCK TABLE t1 READ;
-UNLOCK TABLES;
-
-# Not supported for temporary tables.
-
-SET SESSION TRANSACTION READ WRITE;
-DROP TABLE temp_t2, t1;
-
---echo #
---echo # Test 4: SET TRANSACTION, CHAINing transactions
-
-CREATE TABLE t1(a INT);
-
-SET SESSION TRANSACTION READ ONLY;
-START TRANSACTION;
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-DELETE FROM t1;
-COMMIT;
-START TRANSACTION READ WRITE;
-DELETE FROM t1;
-COMMIT;
-
-SET SESSION TRANSACTION READ WRITE;
-SET TRANSACTION READ ONLY;
-START TRANSACTION;
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-DELETE FROM t1;
-COMMIT;
-START TRANSACTION READ WRITE;
-DELETE FROM t1;
-COMMIT;
-
-START TRANSACTION READ ONLY;
-SELECT * FROM t1;
-COMMIT AND CHAIN;
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-DELETE FROM t1;
-COMMIT;
-
-START TRANSACTION READ ONLY;
-SELECT * FROM t1;
-ROLLBACK AND CHAIN;
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-DELETE FROM t1;
-COMMIT;
-
-DROP TABLE t1;
-
---echo #
---echo # Test 5: Test that reserved keyword ONLY is still allowed as
---echo # identifier - both directly and in SPs.
-
-SET @only= 1;
-
-CREATE TABLE t1 (only INT);
-INSERT INTO t1 (only) values (1);
-SELECT only FROM t1 WHERE only = 1;
-DROP TABLE t1;
-
-DELIMITER |;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE only INT DEFAULT 1;
-END|
-DELIMITER ;|
-
-CALL p1();
-
-DROP PROCEDURE p1;
-
---echo #
---echo # Test 6: Check that XA transactions obey default access mode.
-
-CREATE TABLE t1(a INT);
-
-SET TRANSACTION READ ONLY;
-XA START 'test1';
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-INSERT INTO t1 VALUES (1);
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-UPDATE t1 SET a=2;
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-DELETE FROM t1;
-XA END 'test1';
-XA PREPARE 'test1';
-XA COMMIT 'test1';
-
-DROP TABLE t1;
-
---echo #
---echo # Test 7: SET TRANSACTION inside stored routines
-
-CREATE PROCEDURE p1() SET SESSION TRANSACTION READ ONLY;
-CALL p1();
-SELECT @@tx_read_only;
-SET SESSION TRANSACTION READ WRITE;
-DROP PROCEDURE p1;
-
-CREATE PROCEDURE p1() SET SESSION TRANSACTION READ ONLY,
- ISOLATION LEVEL SERIALIZABLE;
-CALL p1();
-SELECT @@tx_read_only;
-SET SESSION TRANSACTION READ WRITE, ISOLATION LEVEL REPEATABLE READ;
-DROP PROCEDURE p1;
-
-delimiter |;
-CREATE FUNCTION f1() RETURNS INT
-BEGIN
- SET SESSION TRANSACTION READ ONLY;
- RETURN 1;
-END|
-delimiter ;|
-
-SELECT f1();
-SELECT @@tx_read_only;
-SET SESSION TRANSACTION READ WRITE;
-DROP FUNCTION f1;
-
-delimiter |;
-CREATE FUNCTION f1() RETURNS INT
-BEGIN
- SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE, READ ONLY;
- RETURN 1;
-END|
-delimiter ;|
-
-SELECT f1();
-SELECT @@tx_read_only;
-SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE;
-DROP FUNCTION f1;
-
---echo #
---echo # Test 8: SET TRANSACTION and auto-commit
-
-SELECT @@autocommit;
-CREATE TABLE t1(a INT) engine=InnoDB;
-
-SET TRANSACTION READ ONLY;
-SELECT * FROM t1;
---echo # This statement should work, since last statement committed.
-INSERT INTO t1 VALUES (1);
-
-DROP TABLE t1;
diff --git a/mysql-test/t/commit_1innodb.test b/mysql-test/t/commit_1innodb.test
deleted file mode 100644
index a2337094f1a..00000000000
--- a/mysql-test/t/commit_1innodb.test
+++ /dev/null
@@ -1,8 +0,0 @@
--- source include/have_log_bin.inc
--- source include/have_innodb.inc
-
-call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
-
-let $engine_type = InnoDB;
-
--- source include/commit.inc
diff --git a/mysql-test/t/compare.test b/mysql-test/t/compare.test
deleted file mode 100644
index d2b2a7e5523..00000000000
--- a/mysql-test/t/compare.test
+++ /dev/null
@@ -1,96 +0,0 @@
-#
-# Bug when using comparions of strings and integers.
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-CREATE TABLE t1 (id CHAR(12) not null, PRIMARY KEY (id));
-insert into t1 values ('000000000001'),('000000000002');
-explain select * from t1 where id=000000000001;
-select * from t1 where id=000000000001;
-delete from t1 where id=000000000002;
-select * from t1;
-drop table t1;
-
-#
-# Check the following:
-# "a" == "a "
-# "a\0" < "a"
-# "a\0" < "a "
-
-SELECT 'a' = 'a ';
-SELECT 'a\0' < 'a';
-SELECT 'a\0' < 'a ';
-SELECT 'a\t' < 'a';
-SELECT 'a\t' < 'a ';
-
-CREATE TABLE t1 (a char(10) not null);
-INSERT INTO t1 VALUES ('a'),('a\0'),('a\t'),('a ');
-SELECT hex(a),STRCMP(a,'a'), STRCMP(a,'a ') FROM t1;
-DROP TABLE t1;
-
-# Bug #8134: Comparison against CHAR(31) at end of string
-SELECT CHAR(31) = '', '' = CHAR(31);
-# Extra test
-SELECT CHAR(30) = '', '' = CHAR(30);
-
-# End of 4.1 tests
-
-#
-#Bug #21159: Optimizer: wrong result after AND with different data types
-#
-create table t1 (a tinyint(1),b binary(1));
-insert into t1 values (0x01,0x01);
-select * from t1 where a=b;
-select * from t1 where a=b and b=0x01;
-drop table if exists t1;
-
-#
-# Bug #31887: DML Select statement not returning same results when executed
-# in version 5
-#
-
-CREATE TABLE t1 (b int(2) zerofill, c int(2) zerofill);
-INSERT INTO t1 (b,c) VALUES (1,2), (1,1), (2,2);
-
-SELECT CONCAT(b,c), CONCAT(b,c) = '0101' FROM t1;
-
-EXPLAIN EXTENDED SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101';
-SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101';
-
-CREATE TABLE t2 (a int);
-INSERT INTO t2 VALUES (1),(2);
-
-SELECT a,
- (SELECT COUNT(*) FROM t1
- WHERE b = t2.a AND CONCAT(b,c) = CONCAT('0',t2.a,'01')) x
-FROM t2 ORDER BY a;
-
-EXPLAIN EXTENDED
-SELECT a,
- (SELECT COUNT(*) FROM t1
- WHERE b = t2.a AND CONCAT(b,c) = CONCAT('0',t2.a,'01')) x
-FROM t2 ORDER BY a;
-
-DROP TABLE t1,t2;
-
-#
-# Bug #39353: Multiple conditions on timestamp column crashes server
-#
-
-CREATE TABLE t1 (a TIMESTAMP);
-INSERT INTO t1 VALUES (NOW()),(NOW()),(NOW());
-SELECT * FROM t1 WHERE a > '2008-01-01' AND a = '0000-00-00';
-DROP TABLE t1;
-
---echo End of 5.0 tests
-
-#
-# Bug #11764818 57692: Crash in item_func_in::val_int() with ZEROFILL
-#
-
-CREATE TABLE t1(a INT ZEROFILL);
-SELECT 1 FROM t1 WHERE t1.a IN (1, t1.a) AND t1.a=2;
-DROP TABLE t1;
diff --git a/mysql-test/t/compound.test b/mysql-test/t/compound.test
deleted file mode 100644
index 94a6c18b2f5..00000000000
--- a/mysql-test/t/compound.test
+++ /dev/null
@@ -1,160 +0,0 @@
-#
-# MDEV-5317 Compound statement / anonymous blocks
-#
-source include/have_log_bin.inc;
-delimiter |;
-
-CREATE TABLE t1 (a INT PRIMARY KEY)|
-
-BEGIN NOT ATOMIC
- INSERT INTO t1 VALUES (1);
- INSERT INTO t1 VALUES (2);
- INSERT INTO t1 VALUES (3);
-END|
-
-SELECT * FROM t1|
-PREPARE stmt FROM "BEGIN NOT ATOMIC
- INSERT INTO t1 VALUES (4);
- INSERT INTO t1 VALUES (5);
- INSERT INTO t1 VALUES (?);
-END";
-SET @val = 6|
-reset master|
-EXECUTE stmt USING @val|
-SELECT * FROM t1|
-
-# see how ?-placeholder was replaced with the value
-delimiter ;|
-source include/show_binlog_events.inc;
-delimiter |;
-
-DROP TABLE t1|
-
-#
-# test for default database
-#
-# * SP db is different from the current db
-CREATE DATABASE mysqltest1|
-CREATE PROCEDURE mysqltest1.sp1()
-BEGIN
- PREPARE stmt FROM "BEGIN NOT ATOMIC CREATE TABLE t1 AS SELECT DATABASE(); END";
- EXECUTE stmt;
-END|
-
-CALL mysqltest1.sp1()|
-SELECT * FROM mysqltest1.t1|
-
-USE mysqltest1|
-DROP DATABASE mysqltest1|
-
-# * no current db
---error ER_NO_DB_ERROR
-BEGIN NOT ATOMIC CREATE TABLE t1(a int); END|
-
-BEGIN NOT ATOMIC SET @a=1; CREATE TABLE test.t1(a int); END|
-
-USE test|
-show tables|
-drop table t1|
-
-# IF (without /**/ mysqltest treats if as its own command)
-/**/ if (select count(*) from information_schema.tables
- where table_schema='test' and table_name='t1') = 0
- then
- create table t1 (a int);
-end if|
-show tables|
-/**/ if (select count(*) from information_schema.tables
- where table_schema='test' and table_name='t1') = 0
- then
- create table t1 (a int);
-end if|
-show tables|
-
-# CASE simple
-case (select table_name from information_schema.tables where table_schema='test')
- when 't1' then create table t2 (b int);
- when 't2' then create table t3 (b int);
- else signal sqlstate '42S02';
-end case|
-show tables|
-
-# CASE searched
-case
- when database() = 'test' then create table t3 (test text);
- when now() < date'2001-02-03' then create table oops (machine time);
-end case|
-show tables|
-
-# LOOP
---error ER_TABLE_EXISTS_ERROR
-loop
- create table t4 (a int);
-end loop|
-show tables|
-
-# REPEAT
-set @a=0;
-repeat
- set @a = @a + 1;
-until @a > 5
-end repeat|
-select @a|
-
-# WHILE
---vertical_results
-/**/ while (select count(*) from information_schema.tables where table_schema='test')
-do
- select concat('drop table ', table_name) into @a
- from information_schema.tables where table_schema='test'
- order by table_name limit 1;
- select @a as 'executing:';
- prepare dt from @a;
- execute dt;
-end while|
---horizontal_results
-
-# see how ?-placeholder and SP variables are replaced with values
-create table t1 (x int)|
-create function fn(a int) returns int
-begin
- insert t1 values (a+7);
- return a+8;
-end|
-reset master|
-/**/ if fn(9) > 5 then
- select 1;
-end if|
-prepare stmt from "if fn(?) > 6 then
- begin
- declare a int;
- set a=?*2;
- insert t1 values(a+?);
- end;
-end if"|
-set @a=1, @b=2, @c=3|
-execute stmt using @a, @b, @c|
-delimiter ;|
-source include/show_binlog_events.inc;
-delimiter |;
-
-drop function fn|
-drop table t1|
-
-#
-# MDEV-6606 Server crashes in String::append on selecting sql_mode inside anonymous block
-# MDEV-6609 SQL inside an anonymous block is executed with wrong SQL_MODE
-#
-begin not atomic select @@sql_mode; end|
-create table t1 (a int)|
-select a from t1 having a > 1|
-begin not atomic select a from t1 having a > 1; end|
-drop table t1|
-
---echo #
---echo # MDEV-8615: Assertion `m_cpp_buf <= begin_ptr &&
---echo # begin_ptr <= m_cpp_buf + m_buf_length' failed in
---echo # Lex_input_stream::body_utf8_start
---echo #
---error ER_PARSE_ERROR
---query b'
diff --git a/mysql-test/t/compress.test b/mysql-test/t/compress.test
deleted file mode 100644
index 8fc21d9c961..00000000000
--- a/mysql-test/t/compress.test
+++ /dev/null
@@ -1,31 +0,0 @@
-# Turn on compression between the client and server
-# and run a number of tests
-
-# Can't test with embedded server
--- source include/not_embedded.inc
--- source include/have_compress.inc
-# Slow test, don't run during staging part
--- source include/not_staging.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-
-connect (comp_con,localhost,root,,,,,COMPRESS);
-
-# Check compression turned on
-SHOW STATUS LIKE 'Compression';
-select * from information_schema.session_status where variable_name= 'COMPRESSION';
-
-# Source select test case
--- source include/common-tests.inc
-
-# Check compression turned on
-SHOW STATUS LIKE 'Compression';
-
-connection default;
-disconnect comp_con;
-
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
-
diff --git a/mysql-test/t/concurrent_innodb_safelog-master.opt b/mysql-test/t/concurrent_innodb_safelog-master.opt
deleted file mode 100644
index 82dec8b25fd..00000000000
--- a/mysql-test/t/concurrent_innodb_safelog-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-innodb_lock_wait_timeout=1
diff --git a/mysql-test/t/concurrent_innodb_safelog.test b/mysql-test/t/concurrent_innodb_safelog.test
deleted file mode 100644
index 828df9ef717..00000000000
--- a/mysql-test/t/concurrent_innodb_safelog.test
+++ /dev/null
@@ -1,23 +0,0 @@
-# t/concurrent_innodb_safelog.test
-#
-# Concurrent InnoDB tests
-#
-# Last update:
-# 2006-07-26 ML test refactored (MySQL 5.1)
-# main code t/innodb_concurrent.test -> include/concurrent.inc
-# new wrapper t/concurrent_innodb.test
-# 2008-06-03 KP test refactored; removed name locks, added comments.
-# renamed wrapper t/concurrent_innodb.test ->
-# t/concurrent_innodb_unsafelog.test
-# new wrapper t/concurrent_innodb_safelog.test
-#
-
---source include/have_innodb.inc
-
-let $engine_type= InnoDB;
-
-SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ;
-# innodb_locks_unsafe_for_binlog not set for this test
-
---source include/concurrent.inc
-
diff --git a/mysql-test/t/concurrent_innodb_unsafelog-master.opt b/mysql-test/t/concurrent_innodb_unsafelog-master.opt
deleted file mode 100644
index ea9c1b860e9..00000000000
--- a/mysql-test/t/concurrent_innodb_unsafelog-master.opt
+++ /dev/null
@@ -1,2 +0,0 @@
---loose-innodb_locks_unsafe_for_binlog
---loose-innodb_lock_wait_timeout=1
diff --git a/mysql-test/t/concurrent_innodb_unsafelog.test b/mysql-test/t/concurrent_innodb_unsafelog.test
deleted file mode 100644
index e2c03655e43..00000000000
--- a/mysql-test/t/concurrent_innodb_unsafelog.test
+++ /dev/null
@@ -1,23 +0,0 @@
-# t/concurrent_innodb_unsafelog.test
-#
-# Concurrent InnoDB tests
-#
-# Last update:
-# 2006-07-26 ML test refactored (MySQL 5.1)
-# main code t/innodb_concurrent.test -> include/concurrent.inc
-# new wrapper t/concurrent_innodb.test
-# 2008-06-03 KP test refactored; removed name locks, added comments.
-# renamed wrapper t/concurrent_innodb.test ->
-# t/concurrent_innodb_unsafelog.test
-# new wrapper t/concurrent_innodb_safelog.test
-#
-
---source include/have_innodb.inc
-
-let $engine_type= InnoDB;
-
-SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ;
-# innodb_locks_unsafe_for_binlog is set fro this test.
-
---source include/concurrent.inc
-
diff --git a/mysql-test/t/connect.cnf b/mysql-test/t/connect.cnf
deleted file mode 100644
index 4f8d8b06b63..00000000000
--- a/mysql-test/t/connect.cnf
+++ /dev/null
@@ -1,8 +0,0 @@
-!include include/default_my.cnf
-
-[mysqld.1]
-extra-port= @ENV.MASTER_EXTRA_PORT
-extra-max-connections=1
-
-[ENV]
-MASTER_EXTRA_PORT= @OPT.port
diff --git a/mysql-test/t/connect.test b/mysql-test/t/connect.test
deleted file mode 100644
index 20989e70ef9..00000000000
--- a/mysql-test/t/connect.test
+++ /dev/null
@@ -1,459 +0,0 @@
-# This test is to check various cases of connections
-# with right and wrong password, with and without database
-# Unfortunately the check is incomplete as we can't connect without database
-
-# This test makes no sense with the embedded server
---source include/not_embedded.inc
-
-# check that CSV engine was compiled in, as the test relies on the presence
-# of the log tables (which are CSV-based). By connect mysql; show tables;
---source include/have_csv.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-SET global secure_auth=0;
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-#connect (con1,localhost,root,,"");
-#show tables;
-connect (con1,localhost,root,,mysql);
-show tables;
-connect (con2,localhost,root,,test);
-show tables;
-
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error ER_ACCESS_DENIED_ERROR
-connect (fail_con,localhost,root,z,test2);
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error ER_ACCESS_DENIED_ERROR
-connect (fail_con,localhost,root,z,);
-
-connection default;
-disconnect con1;
-disconnect con2;
-
-grant ALL on *.* to test@localhost identified by "gambling";
-grant ALL on *.* to test@127.0.0.1 identified by "gambling";
-
-# Now check this user with different databases
-#connect (con1,localhost,test,gambling,"");
-#show tables;
-connect (con3,localhost,test,gambling,mysql);
-show tables;
-connect (con4,localhost,test,gambling,test);
-show tables;
-
-connection default;
-disconnect con3;
-disconnect con4;
-
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error ER_ACCESS_DENIED_ERROR
-connect (fail_con,localhost,test,,test2);
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error ER_ACCESS_DENIED_ERROR
-# Need to protect "" within '' so it's interpreted literally
-connect (fail_con,localhost,test,,'""');
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error ER_ACCESS_DENIED_ERROR
-connect (fail_con,localhost,test,zorro,test2);
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error ER_ACCESS_DENIED_ERROR
-connect (fail_con,localhost,test,zorro,);
-
-# check if old password version also works
-update mysql.user set password=old_password("gambling2") where user=_binary"test";
-flush privileges;
-
-connect (con10,localhost,test,gambling2,);
-connect (con5,localhost,test,gambling2,mysql);
-connection con5;
-set password="";
---error ER_PASSWD_LENGTH
-set password='gambling3';
-set password=old_password('gambling3');
-show tables;
-connect (con6,localhost,test,gambling3,test);
-show tables;
-
-connection default;
-disconnect con10;
-disconnect con5;
-disconnect con6;
-
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error ER_ACCESS_DENIED_ERROR
-connect (fail_con,localhost,test,,test2);
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error ER_ACCESS_DENIED_ERROR
-connect (fail_con,localhost,test,,);
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error ER_ACCESS_DENIED_ERROR
-connect (fail_con,localhost,test,zorro,test2);
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error ER_ACCESS_DENIED_ERROR
-connect (fail_con,localhost,test,zorro,);
-
-
-# remove user 'test' so that other tests which may use 'test'
-# do not depend on this test.
-delete from mysql.user where user=_binary"test";
-flush privileges;
-
-#
-# Bug#12517 Clear user variables and replication events before
-# closing temp tables in thread cleanup.
-connect (con7,localhost,root,,test);
-connection con7;
-let $connection_id= `select connection_id()`;
-create table t1 (id integer not null auto_increment primary key);
-create temporary table t2(id integer not null auto_increment primary key);
-set @id := 1;
-delete from t1 where id like @id;
-connection default;
-disconnect con7;
-# Wait till the session con7 is disconnected
-let $wait_condition =
- SELECT COUNT(*) = 0
- FROM information_schema.processlist
- WHERE id = '$connection_id';
---source include/wait_condition.inc
-drop table t1;
-
---echo # ------------------------------------------------------------------
---echo # -- End of 4.1 tests
---echo # ------------------------------------------------------------------
-
-###########################################################################
-
---echo
---echo # -- Bug#33507: Event scheduler creates more threads than max_connections
---echo # -- which results in user lockout.
-
---echo
-CREATE USER mysqltest_u1@localhost;
-GRANT USAGE ON *.* TO mysqltest_u1@localhost;
-
-# NOTE: if the test case fails sporadically due to spurious connections,
-# consider disabling all users.
-
---echo
-let $saved_max_connections = `SELECT @@global.max_connections`;
-SET GLOBAL max_connections = 3;
-SET GLOBAL event_scheduler = ON;
-
---echo
---echo # -- Waiting for Event Scheduler to start...
-let $wait_condition =
- SELECT COUNT(*) = 1
- FROM information_schema.processlist
- WHERE user = 'event_scheduler';
---source include/wait_condition.inc
-
---echo
---echo # -- Disconnecting default connection...
---disconnect default
-
---echo
---echo # -- Check that we allow exactly three user connections, no matter how
---echo # -- many threads are running.
-
---echo
---echo # -- Connecting (1)...
-let $con_name = con_1;
-let $con_user_name = mysqltest_u1;
---source include/connect2.inc
-
---echo
---echo # -- Connecting (2)...
-let $con_name = con_2;
-let $con_user_name = mysqltest_u1;
---source include/connect2.inc
-
---echo
---echo # -- Connecting (3)...
-let $con_name = con_3;
-let $con_user_name = mysqltest_u1;
---source include/connect2.inc
-
---echo
---echo # -- Connecting (4) [should fail]...
-let $con_name = con_4;
-let $con_user_name = mysqltest_u1;
-let $wait_timeout = 5;
---source include/connect2.inc
-
---echo
---echo # -- Check that we allow one extra SUPER-user connection.
-
---echo
---echo # -- Connecting super (1)...
-let $con_name = con_super_1;
-let $con_user_name = root;
---source include/connect2.inc
-
---echo
---echo # -- Connecting super (2) [should fail]...
-let $con_name = con_super_2;
-let $con_user_name = root;
-let $wait_timeout = 5;
---source include/connect2.inc
-
---echo
---echo # -- Ensure that we have Event Scheduler thread, 3 ordinary user
---echo # -- connections and one extra super-user connection.
-SELECT user FROM information_schema.processlist ORDER BY id;
-
---echo
---echo # -- Resetting variables...
---eval SET GLOBAL max_connections = $saved_max_connections
-
---echo
---echo # -- Stopping Event Scheduler...
-SET GLOBAL event_scheduler = OFF;
-
---echo
---echo # -- Waiting for Event Scheduler to stop...
-let $wait_condition =
- SELECT COUNT(*) = 0
- FROM information_schema.processlist
- WHERE user = 'event_scheduler';
---source include/wait_condition.inc
-
---echo
---echo # -- That's it. Closing connections...
---disconnect con_1
---disconnect con_2
---disconnect con_3
---disconnect con_super_1
-
---echo
---echo # -- Restoring default connection...
---connect (default,localhost,root,,test)
-
---echo
---echo # -- Waiting for connections to close...
-let $wait_condition =
- SELECT COUNT(*) = 1
- FROM information_schema.processlist
- WHERE db = 'test';
---source include/wait_condition.inc
-
---echo
-DROP USER mysqltest_u1@localhost;
-
---echo
---echo # -- End of Bug#33507.
---echo
-
-###########################################################################
-
---echo # -- Bug#35074: max_used_connections is not correct.
---echo
-
-FLUSH STATUS;
-
---echo
-SHOW STATUS LIKE 'max_used_connections';
-
---echo
---echo # -- Starting Event Scheduler...
-SET GLOBAL event_scheduler = ON;
-
---echo # -- Waiting for Event Scheduler to start...
---source include/running_event_scheduler.inc
-
-# NOTE: We should use a new connection here instead of reconnect in order to
-# avoid races (we can not for sure when the connection being disconnected is
-# actually disconnected on the server).
-
---echo
---echo # -- Opening a new connection to check max_used_connections...
---connect (con_1,localhost,root)
-
---echo
---echo # -- Check that max_used_connections hasn't changed.
-SHOW STATUS LIKE 'max_used_connections';
-
---echo
---echo # -- Closing new connection...
---disconnect con_1
---connection default
-
---echo
---echo # -- Stopping Event Scheduler...
-SET GLOBAL event_scheduler = OFF;
-
---echo # -- Waiting for Event Scheduler to stop...
---source include/no_running_events.inc
-
---echo
---echo # -- End of Bug#35074.
---echo
-
-# Test connections to the extra port.
-
-connect(extracon,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,);
-connection extracon;
-SELECT 'Connection on extra port ok';
-
-connect(extracon2,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,);
-connection extracon2;
-SELECT 'Connection on extra port 2 ok';
-
---disable_abort_on_error
---disable_result_log
---disable_query_log
-connect(extracon3,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,);
---enable_query_log
---enable_result_log
---enable_abort_on_error
-let $error = $mysql_errno;
-if (!$error)
-{
- --echo # -- Error: managed to establish more than --extra-max-connections + 1 connections
-}
-if ($error)
-{
- --echo # -- Success: more than --extra-max-connections + 1 normal connections not possible
-}
-
-###########################################################################
-
---echo #
---echo # -- Bug#49752: 2469.126.2 unintentionally breaks authentication
---echo # against MySQL 5.1 server
---echo #
-
-GRANT ALL ON test.* TO 'O1234567890123456789012345678901234567890123456789012345678901234567890123456789'@'localhost' IDENTIFIED BY 'test123';
-
-FLUSH PRIVILEGES;
-
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
-connect (con1,localhost,O1234567890123456789012345678901234567890123456789012345678901234567890123456789x,test123,test);
-disconnect con1;
-
-connection default;
-
-DROP USER 'O1234567890123456789012345678901234567890123456789012345678901234567890123456789'@'localhost';
-
-FLUSH PRIVILEGES;
-
---echo #
---echo # -- End of Bug#49752
---echo #
-
---echo # ------------------------------------------------------------------
---echo # -- End of 5.1 tests
---echo # ------------------------------------------------------------------
-
---disconnect extracon
---disconnect extracon2
---connection default
-
-#
-# A couple of plugin tests - for builtin plugins only
-#
-CREATE USER mysqltest_up1 IDENTIFIED VIA mysql_native_password using '*E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB';
-CREATE USER mysqltest_up2 IDENTIFIED VIA mysql_old_password using '09301740536db389';
-
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error ER_ACCESS_DENIED_ERROR
-connect(pcon1,localhost,mysqltest_up1,foo,,$MASTER_MYPORT,);
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
-connect(pcon2,localhost,mysqltest_up1,bar,,$MASTER_MYPORT,);
-connection pcon2;
-select user(), current_user();
-disconnect pcon2;
-
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error ER_ACCESS_DENIED_ERROR
-connect(pcon3,localhost,mysqltest_up2,newpw,,$MASTER_MYPORT,);
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
-connect(pcon4,localhost,mysqltest_up2,oldpw,,$MASTER_MYPORT,);
-connection pcon4;
-select user(), current_user();
-disconnect pcon4;
-
-#
-# lp:683112 Maria 5.2 incorrectly reports "(using password: NO)"
-# even when password is specified
-#
-# test "access denied" error for nonexisting user with and without a password
-#
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error ER_ACCESS_DENIED_ERROR
-connect(pcon5,localhost,mysqltest_nouser,newpw,,$MASTER_MYPORT,);
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error ER_ACCESS_DENIED_ERROR
-connect(pcon5,localhost,mysqltest_nouser,,,$MASTER_MYPORT,);
-
-connection default;
-
-#
-# MDEV-6253 MySQL Users Break when Migrating from MySQL 5.1 to MariaDB 10.0.10
-#
-# cannot connect when password is set and plugin=mysql_native_password
-#
-update mysql.user set plugin='mysql_native_password' where user = 'mysqltest_up1';
-update mysql.user set plugin='mysql_old_password' where user = 'mysqltest_up2';
-select user, password, plugin, authentication_string from mysql.user
- where user like 'mysqltest_up_';
-flush privileges;
-
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
-connect(pcon6,localhost,mysqltest_up1,bar,,$MASTER_MYPORT,);
-connection pcon6;
-select user(), current_user();
-disconnect pcon6;
-
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
-connect(pcon7,localhost,mysqltest_up2,oldpw,,$MASTER_MYPORT,);
-connection pcon7;
-select user(), current_user();
-disconnect pcon7;
-connection default;
-
-DROP USER mysqltest_up1@'%';
-DROP USER mysqltest_up2@'%';
-
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
-
-
---echo #
---echo # BUG#1010351: New "via" keyword in 5.2+ can't be used as identifier anymore
---echo #
-create table t1 (via int);
-alter table t1 add key(via);
-drop table t1;
-
-create table t1 (col1 int);
-alter table t1 add via int not null;
-drop table t1;
-
---disable_warnings
-drop procedure if exists p1;
---enable_warnings
-
-delimiter |;
-create procedure p1(x int)
-foo: loop
- if x = 0 then
- leave foo;
- end if;
- select 'test';
- set x = x-1;
-end loop foo|
-
-delimiter ;|
-call p1(2);
-drop procedure p1;
-
-
-
-SET global secure_auth=default;
diff --git a/mysql-test/t/connect2.cnf b/mysql-test/t/connect2.cnf
deleted file mode 100644
index 0acd221b871..00000000000
--- a/mysql-test/t/connect2.cnf
+++ /dev/null
@@ -1,9 +0,0 @@
-!include include/default_my.cnf
-
-[mysqld.1]
-extra-port= @ENV.MASTER_EXTRA_PORT
-extra-max-connections=2
-thread_handling=pool-of-threads
-
-[ENV]
-MASTER_EXTRA_PORT= @OPT.port
diff --git a/mysql-test/t/connect2.test b/mysql-test/t/connect2.test
deleted file mode 100644
index 9d2a438aa0a..00000000000
--- a/mysql-test/t/connect2.test
+++ /dev/null
@@ -1,83 +0,0 @@
-# This test is to check various cases of connections, some which require
-# DBUG
-
-# This test makes no sense with the embedded server
---source include/not_embedded.inc
---source include/have_debug.inc
-call mtr.add_suppression("Allocation failed");
-SET @old_debug= @@session.debug;
-set @old_thread_cache_size=@@global.thread_cache_size;
-set @@global.thread_cache_size=0;
-# Test connections to the
-
-connect(con1,localhost,root,,test,,);
-select 1;
-disconnect con1;
-connection default;
-set global debug_dbug='+d,simulate_failed_connection_1';
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error 1041,2013
-connect(con1,localhost,root,,test,,);
-connection default;
-set global debug_dbug=@old_debug;
-set global debug_dbug='+d,simulate_failed_connection_2';
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error 1041,2013
-connect(con1,localhost,root,,test,,);
---enable_result_log
-connection default;
-set global debug_dbug=@old_debug;
-connect(con1,localhost,root,,test,,);
-select 1;
-disconnect con1;
-
-# Test connections to the extra port.
-connect(con1,localhost,root,,test,$MASTER_EXTRA_PORT,);
-select 1;
-disconnect con1;
-connection default;
-set global debug_dbug='+d,simulate_failed_connection_1';
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_EXTRA_PORT MASTER_PORT
---error 1041,2013
-connect(con1,localhost,root,,test,$MASTER_EXTRA_PORT,);
-connection default;
-set global debug_dbug=@old_debug;
-set global debug_dbug='+d,simulate_failed_connection_2';
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_EXTRA_PORT MASTER_PORT
---error 1041,2013
-connect(con1,localhost,root,,test,$MASTER_EXTRA_PORT,);
-connection default;
-set global debug_dbug=@old_debug;
-connect(con1,localhost,root,,test,$MASTER_EXTRA_PORT,);
-select 1;
-disconnect con1;
-connection default;
-
-#
-# Test thread cache
-#
-set @@global.thread_cache_size=2;
-connect(con1,localhost,root,,test,$MASTER_EXTRA_PORT,);
-select 1;
-connect(con2,localhost,root,,test,$MASTER_EXTRA_PORT,);
-select 1;
-disconnect con1;
-disconnect con2;
-connection default;
-set global debug_dbug='+d,simulate_failed_connection_2';
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_EXTRA_PORT MASTER_PORT
---error 1041,2013
-connect(con1,localhost,root,,test,$MASTER_EXTRA_PORT,);
-connection default;
-
-# Check that threads_connected didn't count aborted connections
-let $count_sessions= 1;
---source include/wait_until_count_sessions.inc
-show status like "Threads_connected";
-
-#
-# Cleanup
-#
-
-set global debug_dbug=@old_debug;
-set global thread_cache_size=@old_thread_cache_size;
diff --git a/mysql-test/t/consistent_snapshot.test b/mysql-test/t/consistent_snapshot.test
deleted file mode 100644
index a481e757bed..00000000000
--- a/mysql-test/t/consistent_snapshot.test
+++ /dev/null
@@ -1,69 +0,0 @@
---source include/have_innodb.inc
-
-# 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,,);
-
---echo ### Test 1:
---echo ### - While a consistent snapshot transaction is executed,
---echo ### no external inserts should be visible to the transaction.
-
-connection con1;
-CREATE TABLE t1 (a INT) ENGINE=innodb;
-START TRANSACTION WITH CONSISTENT SNAPSHOT;
-
-connection con2;
-INSERT INTO t1 VALUES(1);
-
-connection con1;
-SELECT * FROM t1; # if consistent snapshot was set as expected, we
-# should see nothing.
-COMMIT;
-
---echo ### Test 2:
---echo ### - For any non-consistent snapshot transaction, external
---echo ### committed inserts should be visible to the transaction.
-
-DELETE FROM t1;
-START TRANSACTION; # Now we omit WITH CONSISTENT SNAPSHOT
-
-connection con2;
-INSERT INTO t1 VALUES(1);
-
-connection con1;
-SELECT * FROM t1; # if consistent snapshot was not set, as expected, we
-# should see 1.
-COMMIT;
-
---echo ### Test 3:
---echo ### - Bug#44664: valgrind warning for COMMIT_AND_CHAIN and ROLLBACK_AND_CHAIN
---echo ### Chaining a transaction does not retain consistency level.
-
-START TRANSACTION WITH CONSISTENT SNAPSHOT;
-DELETE FROM t1;
-COMMIT WORK AND CHAIN;
-
-connection con2;
-INSERT INTO t1 VALUES(1);
-
-connection con1;
-SELECT * FROM t1; # if consistent snapshot was not set, as expected, we
-# should see 1.
-COMMIT;
-
-connection default;
-disconnect con1;
-disconnect con2;
-DROP TABLE t1;
-
-# End of 4.1 tests
-
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
-
diff --git a/mysql-test/t/constraints.test b/mysql-test/t/constraints.test
deleted file mode 100644
index 1997c23bfa9..00000000000
--- a/mysql-test/t/constraints.test
+++ /dev/null
@@ -1,79 +0,0 @@
-#
-# Testing of constraints
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1 (a int check (a>0));
-show create table t1;
-insert into t1 values (1);
---error ER_CONSTRAINT_FAILED
-insert into t1 values (0);
-drop table t1;
-create table t1 (a int, b int, check (a>b));
-show create table t1;
-insert into t1 values (1,0);
---error ER_CONSTRAINT_FAILED
-insert into t1 values (0,1);
-drop table t1;
-create table t1 (a int ,b int, constraint abc check (a>b));
-show create table t1;
-insert into t1 values (1,0);
---error ER_CONSTRAINT_FAILED
-insert into t1 values (0,1);
-drop table t1;
-create table t1 (a int null);
-show create table t1;
-insert into t1 values (1),(NULL);
-drop table t1;
-create table t1 (a int null);
-alter table t1 add constraint constraint_1 unique (a);
-alter table t1 add constraint unique key_1(a);
-alter table t1 add constraint constraint_2 unique key_2(a);
-show create table t1;
-drop table t1;
-
-# End of 4.1 tests
-
-#
-# Bug#35578 (Parser allows useless/illegal CREATE TABLE syntax)
-#
-
---disable_warnings
-drop table if exists t_illegal;
---enable_warnings
-
---error ER_PARSE_ERROR
-create table t_illegal (a int, b int, check a>b);
-
---error ER_PARSE_ERROR
-create table t_illegal (a int, b int, constraint abc check a>b);
-
---error ER_PARSE_ERROR
-create table t_illegal (a int, b int, constraint abc);
-
-#
-# Bug#11714 (Non-sensical ALTER TABLE ADD CONSTRAINT allowed)
-#
-
---disable_warnings
-drop table if exists t_11714;
---enable_warnings
-
-create table t_11714(a int, b int);
-
---error ER_PARSE_ERROR
-alter table t_11714 add constraint cons1;
-
-drop table t_11714;
-
-#
-# Bug#38696 (CREATE TABLE ... CHECK ... allows illegal syntax)
-
---error ER_PARSE_ERROR
-CREATE TABLE t_illegal (col_1 INT CHECK something (whatever));
-
---error ER_PARSE_ERROR
-CREATE TABLE t_illegal (col_1 INT CHECK something);
-
diff --git a/mysql-test/t/contributors.test b/mysql-test/t/contributors.test
deleted file mode 100644
index e463c4a888b..00000000000
--- a/mysql-test/t/contributors.test
+++ /dev/null
@@ -1 +0,0 @@
-SHOW CONTRIBUTORS;
diff --git a/mysql-test/t/count_distinct.test b/mysql-test/t/count_distinct.test
deleted file mode 100644
index 86045e862e7..00000000000
--- a/mysql-test/t/count_distinct.test
+++ /dev/null
@@ -1,154 +0,0 @@
-#
-# Problem with count(distinct)
-#
-
---disable_warnings
-drop table if exists t1,t2,t3;
---enable_warnings
-
-create table t1 (libname varchar(21) not null, city text, primary key (libname));
-create table t2 (isbn varchar(21) not null, author text, title text, primary key (isbn));
-create table t3 (isbn varchar(21) not null, libname varchar(21) not null, quantity int ,primary key (isbn,libname));
-insert into t2 values ('001','Daffy','A duck''s life');
-insert into t2 values ('002','Bugs','A rabbit\'s life');
-insert into t2 values ('003','Cowboy','Life on the range');
-insert into t2 values ('000','Anonymous','Wanna buy this book?');
-insert into t2 values ('004','Best Seller','One Heckuva book');
-insert into t2 values ('005','EveryoneBuys','This very book');
-insert into t2 values ('006','San Fran','It is a san fran lifestyle');
-insert into t2 values ('007','BerkAuthor','Cool.Berkley.the.book');
-insert into t3 values('000','New York Public Libra','1');
-insert into t3 values('001','New York Public Libra','2');
-insert into t3 values('002','New York Public Libra','3');
-insert into t3 values('003','New York Public Libra','4');
-insert into t3 values('004','New York Public Libra','5');
-insert into t3 values('005','New York Public Libra','6');
-insert into t3 values('006','San Fransisco Public','5');
-insert into t3 values('007','Berkeley Public1','3');
-insert into t3 values('007','Berkeley Public2','3');
-insert into t3 values('001','NYC Lib','8');
-insert into t1 values ('New York Public Libra','New York');
-insert into t1 values ('San Fransisco Public','San Fran');
-insert into t1 values ('Berkeley Public1','Berkeley');
-insert into t1 values ('Berkeley Public2','Berkeley');
-insert into t1 values ('NYC Lib','New York');
-select t2.isbn,city,t1.libname,count(t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city,t1.libname;
-select t2.isbn,city,t1.libname,count(distinct t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city having count(distinct t1.libname) > 1;
-select t2.isbn,city,t1.libname,count(distinct t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city having count(distinct concat(t1.libname,'a')) > 1;
-
-select t2.isbn,city,@bar:=t1.libname,count(distinct t1.libname) as a
- from t3 left join t1 on t3.libname=t1.libname left join t2
- on t3.isbn=t2.isbn group by city having count(distinct
- t1.libname) > 1;
-#
-# Wrong result, see bug#49872
-#
-SELECT @bar;
-
-select t2.isbn,city,concat(@bar:=t1.libname),count(distinct t1.libname) as a
- from t3 left join t1 on t3.libname=t1.libname left join t2
- on t3.isbn=t2.isbn group by city having count(distinct
- t1.libname) > 1;
-#
-# Wrong result, see bug#49872
-#
-SELECT @bar;
-
-drop table t1, t2, t3;
-
-#
-# Problem with LEFT JOIN
-#
-
-create table t1 (f1 int);
-insert into t1 values (1);
-create table t2 (f1 int,f2 int);
-select t1.f1,count(distinct t2.f2),count(distinct 1,NULL) from t1 left join t2 on t1.f1=t2.f1 group by t1.f1;
-drop table t1,t2;
-
-
-#
-# Empty tables
-#
-create table t1 (f int);
-select count(distinct f) from t1;
-drop table t1;
-
-# End of 4.1 tests
-
-#
-# Bug #6515
-#
-
-create table t1 (a char(3), b char(20), primary key (a, b));
-insert into t1 values ('ABW', 'Dutch'), ('ABW', 'English');
-select count(distinct a) from t1 group by b;
-drop table t1;
-
-#
-# Bug #9593 "The combination of COUNT, DISTINCT and CONCAT
-# seems to lock the server"
-# Bug appears only on Windows system
-#
-
-create table t1 (f1 int, f2 int);
-insert into t1 values (0,1),(1,2);
-select count(distinct if(f1,3,f2)) from t1;
-drop table t1;
-
-#
-# Bug #51980 "mysqld service crashes with a simple COUNT(DISTINCT) query
-# over a view"
-#
-
-create table t1 (i int);
-insert into t1 values (0), (1);
-create view v1 as select * from t1;
-select count(distinct i) from v1;
-drop table t1;
-drop view v1;
-
-#
-# MDEV-12136 SELECT COUNT(DISTINCT) returns the wrong value when tmp_table_size is limited
-#
-create table t1 (user_id char(64) character set utf8);
-insert t1 values(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17);
-set @@tmp_table_size = 1024;
-select count(distinct user_id) from t1;
-alter table t1 modify user_id char(128) character set utf8;
-select count(distinct user_id) from t1;
-drop table t1;
-set @@tmp_table_size = default;
-
-#
-# MDEV-13457: Wrong result for aggregate function with distinct clause when the value for
-# tmp_table_size is small
-#
-
-create table t1 (
-a VARCHAR(1020),
-b int
-);
-insert into t1 values
-( 0 , 1 ),
-( 1 , 2 ),
-( 2 , 3 ),
-( 3 , 4 ),
-( 4 , 5 ),
-( 5 , 6 ),
-( 6 , 7 ),
-( 7 , 8 ),
-( 8 , 9 ),
-( 9 , 10 ),
-( 0 , 11 ),
-( 1 , 12 ),
-( 2 , 13 ),
-( 3 , 14 );
-set @@tmp_table_size=1024;
-select count(distinct a) from t1;
-drop table t1;
-set @@tmp_table_size = default;
-
-#
-# End of 5.5 tests
-#
diff --git a/mysql-test/t/count_distinct2-master.opt b/mysql-test/t/count_distinct2-master.opt
deleted file mode 100644
index 2fa4c2b903d..00000000000
--- a/mysql-test/t/count_distinct2-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---max_heap_table_size=16384
diff --git a/mysql-test/t/count_distinct2.test b/mysql-test/t/count_distinct2.test
deleted file mode 100644
index 95086ad04aa..00000000000
--- a/mysql-test/t/count_distinct2.test
+++ /dev/null
@@ -1,86 +0,0 @@
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1(n1 int, n2 int, s char(20), vs varchar(20), t text);
-insert into t1 values (1,11, 'one','eleven', 'eleven'),
- (1,11, 'one','eleven', 'eleven'),
- (2,11, 'two','eleven', 'eleven'),
- (2,12, 'two','twevle', 'twelve'),
- (2,13, 'two','thirteen', 'foo'),
- (2,13, 'two','thirteen', 'foo'),
- (2,13, 'two','thirteen', 'bar'),
- (NULL,13, 'two','thirteen', 'bar'),
- (2,NULL, 'two','thirteen', 'bar'),
- (2,13, NULL,'thirteen', 'bar'),
- (2,13, 'two',NULL, 'bar'),
- (2,13, 'two','thirteen', NULL);
-
-select distinct n1 from t1;
-select count(distinct n1) from t1;
-
-select distinct n2 from t1;
-select count(distinct n2) from t1;
-
-select distinct s from t1;
-select count(distinct s) from t1;
-
-select distinct vs from t1;
-select count(distinct vs) from t1;
-
-select distinct t from t1;
-select count(distinct t) from t1;
-
-select distinct n1,n2 from t1;
-select count(distinct n1,n2) from t1;
-
-select distinct n1,s from t1;
-select count(distinct n1,s) from t1;
-
-select distinct s,n1,vs from t1;
-select count(distinct s,n1,vs) from t1;
-
-select distinct s,t from t1;
-select count(distinct s,t) from t1;
-
-select count(distinct n1), count(distinct n2) from t1;
-
-select count(distinct n2), n1 from t1 group by n1;
-drop table t1;
-
-# test the conversion from tree to MyISAM
-create table t1 (n int default NULL);
-let $1=5000;
---disable_query_log
-begin;
-while ($1)
-{
- eval insert into t1 values($1);
- dec $1;
-}
-commit;
---enable_query_log
-
-flush status;
-select count(distinct n) from t1;
-show status like 'Created_tmp_disk_tables';
-drop table t1;
-
-# Test use of MyISAM tmp tables
-create table t1 (s text);
-let $1=5000;
---disable_query_log
-begin;
-while ($1)
-{
- eval insert into t1 values('$1');
- dec $1;
-}
-commit;
---enable_query_log
-flush status;
-select count(distinct s) from t1;
-show status like 'Created_tmp_disk_tables';
-drop table t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/count_distinct3.test b/mysql-test/t/count_distinct3.test
deleted file mode 100644
index 8aecd628423..00000000000
--- a/mysql-test/t/count_distinct3.test
+++ /dev/null
@@ -1,52 +0,0 @@
-# Bug #958 a big table without indices and select with group by doesnt work
-# this is a test for error 1032 in count(distinct) + group by, introduced in
-# mysql-4.1
-#
-
-# Slow test
---source include/big_test.inc
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-CREATE TABLE t1 (id INTEGER, grp TINYINT, id_rev INTEGER);
-
---disable_query_log
-SET @rnd_max= 2147483647;
-let $1 = 1000;
-begin;
-while ($1)
-{
- SET @rnd= RAND();
- SET @id = CAST(@rnd * @rnd_max AS UNSIGNED);
- SET @id_rev= @rnd_max - @id;
- SET @grp= CAST(127.0 * @rnd AS UNSIGNED);
- INSERT INTO t1 (id, grp, id_rev) VALUES (@id, @grp, @id_rev);
- dec $1;
-}
-commit;
-# We increase the size of t1 here.
-SET @orig_myisam_sort_buffer_size = @@session.myisam_sort_buffer_size;
-SET session myisam_sort_buffer_size=20000000;
-INSERT INTO t1
-SELECT A.id, A.grp, A.id_rev
-FROM
- t1 A,
- (SELECT * FROM t1 B LIMIT 100) B,
- (SELECT * FROM t1 Z LIMIT 42) Z;
---enable_query_log
-
-SELECT COUNT(*) FROM t1;
-
-# As t1 contains random numbers, results are different from test to test.
-# That's okay, because we test only that select doesn't yield an
-# error. Note, that --disable_result_log doesn't suppress error output.
---disable_result_log
-SELECT COUNT(DISTINCT id) FROM t1 GROUP BY grp;
---enable_result_log
-
---echo # Begin cleanup
-SET session myisam_sort_buffer_size = @orig_myisam_sort_buffer_size;
-DROP TABLE t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/crash_commit_before-master.opt b/mysql-test/t/crash_commit_before-master.opt
deleted file mode 100644
index 9bcf94dca97..00000000000
--- a/mysql-test/t/crash_commit_before-master.opt
+++ /dev/null
@@ -1,3 +0,0 @@
---skip-stack-trace --skip-core-file
---default-storage-engine=MyISAM
---loose-skip-innodb-file-per-table
diff --git a/mysql-test/t/crash_commit_before.test b/mysql-test/t/crash_commit_before.test
deleted file mode 100644
index 93b96de6e53..00000000000
--- a/mysql-test/t/crash_commit_before.test
+++ /dev/null
@@ -1,37 +0,0 @@
--- source include/not_embedded.inc
-# Don't test this under valgrind, memory leaks will occur
---source include/not_valgrind.inc
-# Avoid CrashReporter popup on Mac
---source include/not_crashrep.inc
-
-# Binary must be compiled with debug for crash to occur
---source include/have_debug.inc
-
---source include/have_innodb.inc
-
-CREATE TABLE t1(a int) engine=innodb;
-START TRANSACTION;
-insert into t1 values(9);
-
-# Setup the mysqld to crash at certain point
-SET GLOBAL debug_dbug="d,crash_commit_before";
-
-# Write file to make mysql-test-run.pl expect crash and restart
---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-
-# Run the crashing query
---error 2013
-COMMIT;
-
-# Turn on reconnect
---enable_reconnect
-
-# Call script that will poll the server waiting for it to be back online again
---source include/wait_until_connected_again.inc
-
-SHOW CREATE TABLE t1;
-
-SELECT * FROM t1;
-
-
-DROP TABLE t1;
diff --git a/mysql-test/t/create-big.test b/mysql-test/t/create-big.test
deleted file mode 100644
index 7f20a8b42af..00000000000
--- a/mysql-test/t/create-big.test
+++ /dev/null
@@ -1,552 +0,0 @@
-# Tests for various concurrency-related aspects of CREATE TABLE ... SELECT
-# and CREATE TABLE like implementation.
-#
-# Note that we don't test general CREATE TABLE ... SELECT/LIKE functionality
-# here as it is already covered by create.test. We are more interested in
-# extreme cases.
-#
-# This test takes rather long time so let us run it only in --big-test mode
---source include/big_test.inc
-# We need the Debug Sync Facility.
---source include/have_debug_sync.inc
-# Some of tests below also use binlog to check that statements are
-# executed and logged in correct order
---source include/have_binlog_format_mixed_or_statement.inc
-# Save the initial number of concurrent sessions.
---source include/count_sessions.inc
-
-# Create auxilliary connections
-connect (addconroot1, localhost, root,,);
-connect (addconroot2, localhost, root,,);
-connect (addconroot3, localhost, root,,);
-connection default;
-
---disable_warnings
-drop table if exists t1,t2,t3,t4,t5;
---enable_warnings
-set debug_sync='RESET';
-
-#
-# Tests for concurrency problems in CREATE TABLE ... SELECT
-#
-# We introduce delays between various stages of table creation
-# and check that other statements dealing with this table cannot
-# interfere during those delays.
-#
-# What happens in situation when other statement messes with
-# table to be created before it is created ?
-# Concurrent CREATE TABLE
-set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
---send create table t1 select 1 as i;
-connection addconroot1;
-set debug_sync='now WAIT_FOR parked';
---send create table t1 (j char(5));
-connection addconroot2;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "create table t1 (j char(5))";
---source include/wait_condition.inc
-set debug_sync='now SIGNAL go';
-connection default;
---reap
-connection addconroot1;
---error ER_TABLE_EXISTS_ERROR
---reap
-connection default;
-show create table t1;
-drop table t1;
-
-# Concurrent CREATE TABLE ... SELECT
-set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
---send create table t1 select 1 as i;
-connection addconroot1;
-set debug_sync='now WAIT_FOR parked';
---send create table t1 select 'Test' as j;
-connection addconroot2;
-# Wait until the above CREATE TABLE t1 is blocked due to CREATE
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "create table t1 select 'Test' as j";
---source include/wait_condition.inc
-set debug_sync='now SIGNAL go';
-connection default;
---reap
-connection addconroot1;
---error ER_TABLE_EXISTS_ERROR
---reap
-connection default;
-show create table t1;
-drop table t1;
-
-# Concurrent CREATE TABLE LIKE
-create table t3 (j char(5));
-set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
---send create table t1 select 1 as i;
-connection addconroot1;
-set debug_sync='now WAIT_FOR parked';
---send create table t1 like t3;
-connection addconroot2;
-# Wait until the above CREATE TABLE t1 is blocked due to CREATE
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "create table t1 like t3";
---source include/wait_condition.inc
-set debug_sync='now SIGNAL go';
-connection default;
---reap
-connection addconroot1;
---error ER_TABLE_EXISTS_ERROR
---reap
-connection default;
-show create table t1;
-drop table t1;
-
-# Concurrent RENAME TABLE
-set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
---send create table t1 select 1 as i;
-connection addconroot1;
-set debug_sync='now WAIT_FOR parked';
---send rename table t3 to t1;
-connection addconroot2;
-# Wait until the above RENAME TABLE is blocked due to CREATE
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "rename table t3 to t1";
---source include/wait_condition.inc
-set debug_sync='now SIGNAL go';
-connection default;
---reap
-connection addconroot1;
---error ER_TABLE_EXISTS_ERROR
---reap
-connection default;
-show create table t1;
-drop table t1;
-
-# Concurrent ALTER TABLE RENAME
-set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
---send create table t1 select 1 as i;
-connection addconroot1;
-set debug_sync='now WAIT_FOR parked';
---send alter table t3 rename to t1
-connection addconroot2;
-# Wait until the above ALTER TABLE RENAME is blocked due to CREATE
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "alter table t3 rename to t1";
---source include/wait_condition.inc
-set debug_sync='now SIGNAL go';
-connection default;
---reap
-connection addconroot1;
---error ER_TABLE_EXISTS_ERROR
---reap
-connection default;
-show create table t1;
-drop table t1;
-
-# Concurrent ALTER TABLE RENAME which also adds column
-set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
---send create table t1 select 1 as i;
-connection addconroot1;
-set debug_sync='now WAIT_FOR parked';
---send alter table t3 rename to t1, add k int
-connection addconroot2;
-# Wait until the above ALTER TABLE RENAME is blocked due to CREATE
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "alter table t3 rename to t1, add k int";
---source include/wait_condition.inc
-set debug_sync='now SIGNAL go';
-connection default;
---reap
-connection addconroot1;
---error ER_TABLE_EXISTS_ERROR
---reap
-connection default;
-show create table t1;
-drop table t1,t3;
-
-# What happens if other statement sneaks in after the table
-# creation but before its opening ?
-set debug_sync='create_table_select_before_open SIGNAL parked WAIT_FOR go';
-connection default;
-
-# Concurrent DROP TABLE
-set debug_sync='create_table_select_before_open SIGNAL parked WAIT_FOR go';
---send create table t1 select 1 as i;
-connection addconroot1;
-set debug_sync='now WAIT_FOR parked';
---send drop table t1;
-connection addconroot2;
-# Wait until the above DROP TABLE is blocked due to CREATE
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "drop table t1";
---source include/wait_condition.inc
-set debug_sync='now SIGNAL go';
-connection default;
---reap
-connection addconroot1;
---reap
-connection default;
-
-# Concurrent RENAME TABLE
-set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
---send create table t1 select 1 as i;
-connection addconroot1;
-set debug_sync='now WAIT_FOR parked';
---send rename table t1 to t2;
-connection addconroot2;
-# Wait until the above RENAME TABLE is blocked due to CREATE
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "rename table t1 to t2";
---source include/wait_condition.inc
-set debug_sync='now SIGNAL go';
-connection default;
---reap
-connection addconroot1;
---reap
-connection default;
-drop table t2;
-
-# Concurrent SELECT
-set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
---send create table t1 select 1 as i;
-connection addconroot1;
-set debug_sync='now WAIT_FOR parked';
---send select * from t1;
-connection addconroot2;
-# Wait until the above SELECT is blocked due to CREATE
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "select * from t1";
---source include/wait_condition.inc
-set debug_sync='now SIGNAL go';
-connection default;
---reap
-connection addconroot1;
---reap
-connection default;
-drop table t1;
-
-# Concurrent INSERT
-set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
---send create table t1 select 1 as i;
-connection addconroot1;
-set debug_sync='now WAIT_FOR parked';
---send insert into t1 values (2);
-connection addconroot2;
-# Wait until the above INSERT is blocked due to CREATE
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "insert into t1 values (2)";
---source include/wait_condition.inc
-set debug_sync='now SIGNAL go';
-connection default;
---reap
-connection addconroot1;
---reap
-connection default;
-select * from t1;
-drop table t1;
-
-# Concurrent CREATE TRIGGER
-set @a:=0;
-set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
---send create table t1 select 1 as i;
-connection addconroot1;
-set debug_sync='now WAIT_FOR parked';
---send create trigger t1_bi before insert on t1 for each row set @a:=1;
-connection addconroot2;
-# Wait until the above CREATE TRIGGER is blocked due to CREATE TABLE
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "create trigger t1_bi before insert on t1 for each row set @a:=1";
---source include/wait_condition.inc
-set debug_sync='now SIGNAL go';
-connection default;
---reap
-connection addconroot1;
---reap
-connection default;
-select @a;
-drop table t1;
-
-# Okay, now the same tests for the potential gap between open and lock
-set debug_sync='create_table_select_before_lock SIGNAL parked WAIT_FOR go';
-
-# Concurrent DROP TABLE
---send create table t1 select 1 as i;
-connection addconroot1;
-set debug_sync='now WAIT_FOR parked';
---send drop table t1;
-connection addconroot2;
-# Wait until the above DROP TABLE is blocked due to CREATE TABLE
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "drop table t1";
---source include/wait_condition.inc
-set debug_sync='now SIGNAL go';
-connection default;
---reap
-connection addconroot1;
---reap
-connection default;
-
-# Concurrent RENAME TABLE
-set debug_sync='create_table_select_before_lock SIGNAL parked WAIT_FOR go';
---send create table t1 select 1 as i;
-connection addconroot1;
-set debug_sync='now WAIT_FOR parked';
---send rename table t1 to t2;
-connection addconroot2;
-# Wait until the above RENAME TABLE is blocked due to CREATE TABLE
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "rename table t1 to t2";
---source include/wait_condition.inc
-set debug_sync='now SIGNAL go';
-connection default;
---reap
-connection addconroot1;
---reap
-connection default;
-drop table t2;
-
-# Concurrent SELECT
-set debug_sync='create_table_select_before_lock SIGNAL parked WAIT_FOR go';
---send create table t1 select 1 as i;
-connection addconroot1;
-set debug_sync='now WAIT_FOR parked';
---send select * from t1;
-connection addconroot2;
-# Wait until the above SELECT is blocked due to CREATE TABLE
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "select * from t1";
---source include/wait_condition.inc
-set debug_sync='now SIGNAL go';
-connection default;
---reap
-connection addconroot1;
---reap
-connection default;
-drop table t1;
-
-# Concurrent INSERT
-set debug_sync='create_table_select_before_lock SIGNAL parked WAIT_FOR go';
---send create table t1 select 1 as i;
-connection addconroot1;
-set debug_sync='now WAIT_FOR parked';
---send insert into t1 values (2);
-connection addconroot2;
-# Wait until the above INSERT INTO t1 is blocked due to CREATE TABLE
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "insert into t1 values (2)";
---source include/wait_condition.inc
-set debug_sync='now SIGNAL go';
-connection default;
---reap
-connection addconroot1;
---reap
-connection default;
-select * from t1;
-drop table t1;
-
-# Concurrent CREATE TRIGGER
-set @a:=0;
-set debug_sync='create_table_select_before_lock SIGNAL parked WAIT_FOR go';
---send create table t1 select 1 as i;
-connection addconroot1;
-set debug_sync='now WAIT_FOR parked';
---send create trigger t1_bi before insert on t1 for each row set @a:=1;
-connection addconroot2;
-# Wait until the above CREATE TRIGGER is blocked due to CREATE TABLE
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "create trigger t1_bi before insert on t1 for each row set @a:=1";
---source include/wait_condition.inc
-set debug_sync='now SIGNAL go';
-connection default;
---reap
-connection addconroot1;
---reap
-connection default;
-select @a;
-drop table t1;
-
-# Concurrent DROP TABLE
-set debug_sync='create_table_select_before_check_if_exists SIGNAL parked WAIT_FOR go';
---send create table if not exists t1 select 1 as i;
-connection addconroot1;
-set debug_sync='now WAIT_FOR parked';
---send drop table t1;
-connection addconroot2;
-# Wait until the above DROP TABLE is blocked due to CREATE TABLE
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "drop table t1";
---source include/wait_condition.inc
-set debug_sync='now SIGNAL go';
-connection default;
---reap
-connection addconroot1;
---reap
-connection default;
-
-# Concurrent CREATE TRIGGER
-create table t1 (i int);
-set @a:=0;
-set debug_sync='create_table_select_before_check_if_exists SIGNAL parked WAIT_FOR go';
---send create table if not exists t1 select 1 as i;
-connection addconroot1;
-set debug_sync='now WAIT_FOR parked';
---send create trigger t1_bi before insert on t1 for each row set @a:=1;
-connection addconroot2;
-# Wait until the above DROP TABLE is blocked due to CREATE TABLE
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info like "create trigger%";
---source include/wait_condition.inc
-set debug_sync='now SIGNAL go';
-connection default;
---reap
-connection addconroot1;
---reap
-connection default;
-select @a;
-select * from t1;
-drop table t1;
-
-# Tests for possible concurrency issues with CREATE TABLE ... LIKE
-#
-# Bug #18950 "create table like does not obtain LOCK_open"
-# Bug #23667 "CREATE TABLE LIKE is not isolated from alteration by other
-# connections"
-#
-# Again the idea of this test is that we introduce artificial delays on
-# various stages of table creation and check that concurrent statements
-# for tables from CREATE TABLE ... LIKE are not interfering.
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-set debug_sync='RESET';
-
-# What happens if some statements sneak in right after we have
-# acquired locks and opened source table ?
-create table t1 (i int);
-set debug_sync='create_table_like_after_open SIGNAL parked WAIT_FOR go';
-# Reset binlog to have clear start
-reset master;
---send create table t2 like t1;
-connection addconroot1;
-set debug_sync='now WAIT_FOR parked';
-# DML on source table should be allowed to run concurrently
-insert into t1 values (1);
-# And DDL should wait
---send drop table t1;
-connection addconroot2;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "drop table t1";
---source include/wait_condition.inc
-set debug_sync='now SIGNAL go';
-connection default;
---reap
-connection addconroot1;
---reap
-connection default;
-show create table t2;
-drop table t2;
-# Let us check that statements were executed/binlogged in correct order
-source include/show_binlog_events.inc;
-
-# Now check the gap between table creation and binlogging
-create table t1 (i int);
-set debug_sync='create_table_like_before_binlog SIGNAL parked WAIT_FOR go';
-reset master;
---send create table t2 like t1;
-connection addconroot1;
-set debug_sync='now WAIT_FOR parked';
---send insert into t2 values (1);
-connection addconroot2;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "insert into t2 values (1)";
---source include/wait_condition.inc
-set debug_sync='now SIGNAL go';
-connection default;
---reap
-
-connection addconroot1;
---reap
-connection default;
-drop table t2;
-set debug_sync='create_table_like_before_binlog SIGNAL parked WAIT_FOR go';
---send create table t2 like t1;
-connection addconroot1;
-set debug_sync='now WAIT_FOR parked';
---send drop table t2;
-connection addconroot2;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "drop table t2";
---source include/wait_condition.inc
-set debug_sync='now SIGNAL go';
-connection default;
---reap
-connection addconroot1;
---reap
-connection default;
-set debug_sync='create_table_like_before_binlog SIGNAL parked WAIT_FOR go';
---send create table t2 like t1;
-connection addconroot1;
-set debug_sync='now WAIT_FOR parked';
---send drop table t1;
-connection addconroot2;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "drop table t1";
---source include/wait_condition.inc
-set debug_sync='now SIGNAL go';
-connection default;
---reap
-connection addconroot1;
---reap
-connection default;
-drop table t2;
-disconnect addconroot1;
-disconnect addconroot2;
-disconnect addconroot3;
-
-set debug_sync='RESET';
-source include/show_binlog_events.inc;
-# 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
diff --git a/mysql-test/t/create-uca.test b/mysql-test/t/create-uca.test
deleted file mode 100644
index 0acb51f7286..00000000000
--- a/mysql-test/t/create-uca.test
+++ /dev/null
@@ -1,26 +0,0 @@
-# Prerequisites
-let collation=utf8_unicode_ci;
---source include/have_collation.inc
-
-# Initial cleanup
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-#
-# Bug#21380: DEFAULT definition not always transfered by CREATE
-# TABLE/SELECT to the new table.
-#
-
-CREATE TABLE t1(
- c1 INT DEFAULT 12 COMMENT 'column1',
- c2 INT NULL COMMENT 'column2',
- c3 INT NOT NULL COMMENT 'column3',
- c4 VARCHAR(255) CHARACTER SET utf8 NOT NULL DEFAULT 'a',
- c5 VARCHAR(255) COLLATE utf8_unicode_ci NULL DEFAULT 'b',
- c6 VARCHAR(255))
- COLLATE latin1_bin;
-SHOW CREATE TABLE t1;
-CREATE TABLE t2 AS SELECT * FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t1,t2;
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
deleted file mode 100644
index af5c427852c..00000000000
--- a/mysql-test/t/create.test
+++ /dev/null
@@ -1,1943 +0,0 @@
-call mtr.add_suppression("table or database name 't-1'");
-#
-# Check some special create statements.
-#
-
---disable_warnings
-drop table if exists t1,t2,t3,t4,t5;
-drop database if exists mysqltest;
-drop view if exists v1;
---enable_warnings
-
-create table t1 (b char(0));
-insert into t1 values (""),(null);
-select * from t1;
-drop table if exists t1;
-
-create table t1 (b char(0) not null);
-create table if not exists t1 (b char(0) not null);
-insert into t1 values (""),(null);
-select * from t1;
-drop table t1;
-
-create table t1 (a int not null auto_increment,primary key (a)) engine=heap;
-drop table t1;
-
-#
-# Test of some CREATE TABLE'S that should fail
-#
-
---error 1146
-create table t2 engine=heap select * from t1;
---error 1146
-create table t2 select auto+1 from t1;
-drop table if exists t1,t2;
---error 1167
-create table t1 (b char(0) not null, index(b));
---error 1163
-create table t1 (a int not null,b text) engine=heap;
-drop table if exists t1;
-
---error 1075
-create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) engine=heap;
-
--- error 1049
-create table not_existing_database.test (a int);
-create table `a/a` (a int);
-show create table `a/a`;
-create table t1 like `a/a`;
-drop table `a/a`;
-drop table `t1`;
---error 1103
-create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int);
---error 1059
-create table a (`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` int);
-
-#
-# Some wrong defaults, so these creates should fail too (Bug #5902)
-#
-create table t1 (a datetime default now());
-drop table t1;
-create table t1 (a datetime on update now());
-drop table t1;
---error 1067
-create table t1 (a int default 100 auto_increment);
---error 1067
-create table t1 (a tinyint default 1000);
---error 1067
-create table t1 (a varchar(5) default 'abcdef');
-
-create table t1 (a varchar(5) default 'abcde');
-insert into t1 values();
-select * from t1;
---error 1067
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-alter table t1 alter column a set default 'abcdef';
-drop table t1;
-
-#
-# test of dummy table names
-#
-
-create table 1ea10 (1a20 int,1e int);
-insert into 1ea10 values(1,1);
-select 1ea10.1a20,1e+ 1e+10 from 1ea10;
-drop table 1ea10;
-create table t1 (t1.index int);
-drop table t1;
-# Test that we get warning for this
-drop database if exists mysqltest;
-create database mysqltest;
-create table mysqltest.$test1 (a$1 int, $b int, c$ int);
-insert into mysqltest.$test1 values (1,2,3);
-select a$1, $b, c$ from mysqltest.$test1;
-create table mysqltest.test2$ (a int);
-drop table mysqltest.test2$;
-drop database mysqltest;
-
---error 1103
-create table `` (a int);
---error 1103
-drop table if exists ``;
---error 1166
-create table t1 (`` int);
---error 1280
-create table t1 (i int, index `` (i));
-
-#
-# CREATE TABLE under LOCK TABLES
-#
-# We don't allow creation of non-temporary tables under LOCK TABLES
-# as following meta-data locking protocol in this case can lead to
-# deadlock.
-create table t1 (i int);
-lock tables t1 read;
---error ER_TABLE_NOT_LOCKED
-create table t2 (j int);
-# OTOH creating of temporary table should be OK
-create temporary table t2 (j int);
-drop temporary table t2;
-unlock tables;
-drop table t1;
-
-#
-# Test of CREATE ... SELECT with indexes
-#
-
-create table t1 (a int auto_increment not null primary key, B CHAR(20));
-insert into t1 (b) values ("hello"),("my"),("world");
-create table t2 (key (b)) select * from t1;
-explain select * from t2 where b="world";
-select * from t2 where b="world";
-drop table t1,t2;
-
-#
-# Test types after CREATE ... SELECT
-#
-
-create table t1(x varchar(50) );
-create table t2 select x from t1 where 1=2;
-describe t1;
-describe t2;
-drop table t2;
-create table t2 select now() as a , curtime() as b, curdate() as c , 1+1 as d , 1.0 + 1 as e , 33333333333333333 + 3 as f;
-describe t2;
-drop table t2;
-create table t2 select CAST("2001-12-29" AS DATE) as d, CAST("20:45:11" AS TIME) as t, CAST("2001-12-29 20:45:11" AS DATETIME) as dt;
-describe t2;
-drop table t1,t2;
-
-#
-# Test of CREATE ... SELECT with duplicate fields
-#
-
-create table t1 (a tinyint);
-create table t2 (a int) select * from t1;
-describe t1;
-describe t2;
-drop table if exists t2;
---error 1060
-create table t2 (a int, a float) select * from t1;
-drop table if exists t2;
---error 1060
-create table t2 (a int) select a as b, a+1 as b from t1;
-drop table if exists t2;
---error 1060
-create table t2 (b int) select a as b, a+1 as b from t1;
-drop table if exists t1,t2;
-
-#
-# Test CREATE ... SELECT when insert fails
-#
-
-CREATE TABLE t1 (a int not null);
-INSERT INTO t1 values (1),(2),(1);
---error ER_DUP_ENTRY
-CREATE TABLE t2 (primary key(a)) SELECT * FROM t1;
---error 1146
-SELECT * from t2;
-DROP TABLE t1;
-DROP TABLE IF EXISTS t2;
-
-#
-# Test of primary key with 32 index
-#
-
-create table t1 (a int not null, b int, primary key(a), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b));
-show create table t1;
-drop table t1;
-create table t1 select if(1,'1','0'), month("2002-08-02");
-drop table t1;
-create table t1 select if('2002'='2002','Y','N');
-select * from t1;
-drop table if exists t1;
-
-#
-# Test default table type
-#
-SET SESSION storage_engine="heap";
-SELECT @@storage_engine;
-CREATE TABLE t1 (a int not null);
-show create table t1;
-drop table t1;
---error 1286
-SET SESSION storage_engine="gemini";
-SELECT @@storage_engine;
-CREATE TABLE t1 (a int not null);
-show create table t1;
-SET SESSION storage_engine=default;
-drop table t1;
-
-
-#
-# ISO requires that primary keys are implicitly NOT NULL
-#
-create table t1 ( k1 varchar(2), k2 int, primary key(k1,k2));
-insert into t1 values ("a", 1), ("b", 2);
---error 1048
-insert into t1 values ("c", NULL);
---error 1048
-insert into t1 values (NULL, 3);
---error 1048
-insert into t1 values (NULL, NULL);
-drop table t1;
-
-#
-# Bug # 801
-#
-
-create table t1 select x'4132';
-drop table t1;
-
-#
-# bug #1434
-#
-
-create table t1 select 1,2,3;
-create table if not exists t1 select 1,2;
-create table if not exists t1 select 1,2,3,4;
-create table if not exists t1 select 1;
-select * from t1;
-drop table t1;
-
-#
-# Test create table if not exists with duplicate key error
-#
-
-flush status;
-create table t1 (a int not null, b int, primary key (a));
-insert into t1 values (1,1);
-create table if not exists t1 select 2;
-select * from t1;
-create table if not exists t1 select 3 as 'a',4 as 'b';
-show warnings;
-show status like "Opened_tables";
-select * from t1;
-drop table t1;
-
-#
-# Test for Bug #2985
-# "Table truncated when creating another table name with Spaces"
-#
-
---error 1103
-create table `t1 `(a int);
---error 1102
-create database `db1 `;
---error 1166
-create table t1(`a ` int);
-
-#
-# Test for Bug #3481
-# "Parser permits multiple commas without syntax error"
-#
-
---error 1064
-create table t1 (a int,);
---error 1064
-create table t1 (a int,,b int);
---error 1064
-create table t1 (,b int);
-
-#
-# Test create with foreign keys
-#
-
-create table t1 (a int, key(a));
-create table t2 (b int, foreign key(b) references t1(a), key(b));
-drop table if exists t2,t1;
-
-#
-# Test for CREATE TABLE .. LIKE ..
-#
-
-create table t1(id int not null, name char(20));
-insert into t1 values(10,'mysql'),(20,'monty- the creator');
-create table t2(id int not null);
-insert into t2 values(10),(20);
-create table t3 like t1;
-show create table t3;
-select * from t3;
-# Disable PS becasue of @@warning_count
-create table if not exists t3 like t1;
---disable_ps_protocol
-select @@warning_count;
---enable_ps_protocol
-create temporary table t3 like t2;
-show create table t3;
-select * from t3;
-drop table t3;
-show create table t3;
-select * from t3;
-drop table t2, t3;
-create database mysqltest;
-create table mysqltest.t3 like t1;
-create temporary table t3 like mysqltest.t3;
-show create table t3;
-create table t2 like t3;
-show create table t2;
-select * from t2;
-create table t3 like t1;
---error 1050
-create table t3 like mysqltest.t3;
---error 1049
-create table non_existing_database.t1 like t1;
---error ER_NO_SUCH_TABLE
-create table t3 like non_existing_table;
---error 1050
-create temporary table t3 like t1;
-drop table t1, t2, t3;
-drop table t3;
-drop database mysqltest;
-
-#
-# CREATE TABLE LIKE under LOCK TABLES
-#
-# Similarly to ordinary CREATE TABLE we don't allow creation of
-# non-temporary tables under LOCK TABLES. Also we require source
-# table to be locked.
-create table t1 (i int);
-create table t2 (j int);
-lock tables t1 read;
---error ER_TABLE_NOT_LOCKED
-create table t3 like t1;
-# OTOH creating of temporary table should be OK
-create temporary table t3 like t1;
-drop temporary table t3;
-# Source table should be locked
---error ER_TABLE_NOT_LOCKED
-create temporary table t3 like t2;
-unlock tables;
-drop tables t1, t2;
-
-#
-# Test default table type
-#
-SET SESSION storage_engine="heap";
-SELECT @@storage_engine;
-CREATE TABLE t1 (a int not null);
-show create table t1;
-drop table t1;
---error 1286
-SET SESSION storage_engine="gemini";
-SELECT @@storage_engine;
-CREATE TABLE t1 (a int not null);
-show create table t1;
-SET SESSION storage_engine=default;
-drop table t1;
-
-#
-# Test types of data for create select with functions
-#
-
-create table t1(a int,b int,c int unsigned,d date,e char,f datetime,g time,h blob);
-insert into t1(a)values(1);
-insert into t1(a,b,c,d,e,f,g,h)
-values(2,-2,2,'1825-12-14','a','2003-1-1 3:2:1','4:3:2','binary data');
-select * from t1;
-select a,
- ifnull(b,cast(-7 as signed)) as b,
- ifnull(c,cast(7 as unsigned)) as c,
- ifnull(d,cast('2000-01-01' as date)) as d,
- ifnull(e,cast('b' as char)) as e,
- ifnull(f,cast('2000-01-01' as datetime)) as f,
- ifnull(g,cast('5:4:3' as time)) as g,
- ifnull(h,cast('yet another binary data' as binary)) as h,
- addtime(cast('1:0:0' as time),cast('1:0:0' as time)) as dd
-from t1;
-
-create table t2
-select
- a,
- ifnull(b,cast(-7 as signed)) as b,
- ifnull(c,cast(7 as unsigned)) as c,
- ifnull(d,cast('2000-01-01' as date)) as d,
- ifnull(e,cast('b' as char)) as e,
- ifnull(f,cast('2000-01-01' as datetime)) as f,
- ifnull(g,cast('5:4:3' as time)) as g,
- ifnull(h,cast('yet another binary data' as binary)) as h,
- addtime(cast('1:0:0' as time),cast('1:0:0' as time)) as dd
-from t1;
-explain t2;
-select * from t2;
-drop table t1, t2;
-
-CREATE TABLE t1 (
- c_tinytext tinytext,
- c_text text,
- c_mediumtext mediumtext,
- c_longtext longtext
-);
-CREATE TABLE t2 AS SELECT
- ifnull(c_tinytext, CAST('yet another binary data' AS BINARY)),
- ifnull(c_text, CAST('yet another binary data' AS BINARY)),
- ifnull(c_mediumtext, CAST('yet another binary data' AS BINARY)),
- ifnull(c_longtext, CAST('yet another binary data' AS BINARY))
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-DROP TABLE t1;
-
-create table t1 (a tinyint, b smallint, c mediumint, d int, e bigint, f float(3,2), g double(4,3), h decimal(5,4), i year, j date, k timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, l datetime, m enum('a','b'), n set('a','b'), o char(10));
-create table t2 select ifnull(a,a), ifnull(b,b), ifnull(c,c), ifnull(d,d), ifnull(e,e), ifnull(f,f), ifnull(g,g), ifnull(h,h), ifnull(i,i), ifnull(j,j), ifnull(k,k), ifnull(l,l), ifnull(m,m), ifnull(n,n), ifnull(o,o) from t1;
-show create table t2;
-drop table t1,t2;
-
-#
-# Test of default()
-#
-create table t1(str varchar(10) default 'def',strnull varchar(10),intg int default '10',rel double default '3.14');
-insert into t1 values ('','',0,0.0);
-describe t1;
-create table t2 select default(str) as str, default(strnull) as strnull, default(intg) as intg, default(rel) as rel from t1;
-describe t2;
-drop table t1, t2;
-
-#
-# Bug #2075
-#
-
-create table t1(name varchar(10), age smallint default -1);
-describe t1;
-create table t2(name varchar(10), age smallint default - 1);
-describe t2;
-drop table t1, t2;
-
-#
-# test for bug #1427 "enum allows duplicate values in the list"
-#
-
-create table t1(cenum enum('a'), cset set('b'));
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-create table t2(cenum enum('a','a'), cset set('b','b'));
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-create table t3(cenum enum('a','A','a','c','c'), cset set('b','B','b','d','d'));
-drop table t1, t2, t3;
-
-#
-# Bug #1209
-#
-
-create database mysqltest;
-use mysqltest;
-select database();
-drop database mysqltest;
-select database();
-
-# Connect without a database as user mysqltest_1
-create user mysqltest_1;
-connect (user1,localhost,mysqltest_1,,*NO-ONE*);
-connection user1;
-select database(), user();
-connection default;
-disconnect user1;
-drop user mysqltest_1;
-use test;
-
-#
-# Test for Bug 856 'Naming a key "Primary" causes trouble'
-#
-
---error 1280
-create table t1 (a int, index `primary` (a));
---error 1280
-create table t1 (a int, index `PRIMARY` (a));
-
-create table t1 (`primary` int, index(`primary`));
-show create table t1;
-create table t2 (`PRIMARY` int, index(`PRIMARY`));
-show create table t2;
-
-create table t3 (a int);
---error 1280
-alter table t3 add index `primary` (a);
---error 1280
-alter table t3 add index `PRIMARY` (a);
-
-create table t4 (`primary` int);
-alter table t4 add index(`primary`);
-show create table t4;
-create table t5 (`PRIMARY` int);
-alter table t5 add index(`PRIMARY`);
-show create table t5;
-
-drop table t1, t2, t3, t4, t5;
-
-#
-# bug #3266 TEXT in CREATE TABLE SELECT
-#
-
-CREATE TABLE t1(id varchar(10) NOT NULL PRIMARY KEY, dsc longtext);
-INSERT INTO t1 VALUES ('5000000001', NULL),('5000000003', 'Test'),('5000000004', NULL);
-CREATE TABLE t2(id varchar(15) NOT NULL, proc varchar(100) NOT NULL, runID varchar(16) NOT NULL, start datetime NOT NULL, PRIMARY KEY (id,proc,runID,start));
-
-INSERT INTO t2 VALUES ('5000000001', 'proc01', '20031029090650', '2003-10-29 13:38:40'),('5000000001', 'proc02', '20031029090650', '2003-10-29 13:38:51'),('5000000001', 'proc03', '20031029090650', '2003-10-29 13:38:11'),('5000000002', 'proc09', '20031024013310', '2003-10-24 01:33:11'),('5000000002', 'proc09', '20031024153537', '2003-10-24 15:36:04'),('5000000004', 'proc01', '20031024013641', '2003-10-24 01:37:29'),('5000000004', 'proc02', '20031024013641', '2003-10-24 01:37:39');
-
-CREATE TABLE t3 SELECT t1.dsc,COUNT(DISTINCT t2.id) AS countOfRuns FROM t1 LEFT JOIN t2 ON (t1.id=t2.id) GROUP BY t1.id;
-SELECT * FROM t3;
-drop table t1, t2, t3;
-
-#
-# Bug#9666: Can't use 'DEFAULT FALSE' for column of type bool
-#
-create table t1 (b bool not null default false);
-create table t2 (b bool not null default true);
-insert into t1 values ();
-insert into t2 values ();
-select * from t1;
-select * from t2;
-drop table t1,t2;
-
-#
-# Bug#10224 - ANALYZE TABLE crashing with simultaneous
-# CREATE ... SELECT statement.
-# This tests two additional possible errors and a hang if
-# an improper fix is present.
-#
-create table t1 (a int);
---error ER_TABLE_EXISTS_ERROR
-create table t1 select * from t1;
---error ER_WRONG_OBJECT
-create table t2 union = (t1) select * from t1;
-flush tables with read lock;
-unlock tables;
-drop table t1;
-
-#
-# Bug#10413: Invalid column name is not rejected
-#
---error 1103
-create table t1(column.name int);
---error 1103
-create table t1(test.column.name int);
---error 1102
-create table t1(xyz.t1.name int);
-create table t1(t1.name int);
-create table t2(test.t2.name int);
-drop table t1,t2;
-
-#
-# Bug #12537: UNION produces longtext instead of varchar
-#
-CREATE TABLE t1 (f1 VARCHAR(255) CHARACTER SET utf8);
-CREATE TABLE t2 AS SELECT LEFT(f1,171) AS f2 FROM t1 UNION SELECT LEFT(f1,171) AS f2 FROM t1;
-DESC t2;
-DROP TABLE t1,t2;
-
-#
-# Bug#12913 Simple SQL can crash server or connection
-#
-CREATE TABLE t12913 (f1 ENUM ('a','b')) AS SELECT 'a' AS f1;
-SELECT * FROM t12913;
-DROP TABLE t12913;
-
-#
-# Bug#11028: Crash on create table like
-#
-create database mysqltest;
-use mysqltest;
-drop database mysqltest;
---error ER_NO_DB_ERROR
-create table test.t1 like x;
---disable_warnings
-drop table if exists test.t1;
---enable_warnings
-
-#
-# Bug #6859: Bogus error message on attempt to CREATE TABLE t LIKE view
-#
-create database mysqltest;
-use mysqltest;
-create view v1 as select 'foo' from dual;
---error 1347
-create table t1 like v1;
-drop view v1;
-drop database mysqltest;
-# Bug #6008 MySQL does not create warnings when
-# creating database and using IF NOT EXISTS
-#
-create database mysqltest;
-create database if not exists mysqltest character set latin2;
-show create database mysqltest;
-drop database mysqltest;
-use test;
-create table t1 (a int);
-create table if not exists t1 (a int);
-drop table t1;
-
-# BUG#14139
-create table t1 (
- a varchar(112) charset utf8 collate utf8_bin not null,
- primary key (a)
-) select 'test' as a ;
-#--warning 1364
-show create table t1;
-drop table t1;
-
-#
-# BUG#14480: assert failure in CREATE ... SELECT because of wrong
-# calculation of number of NULLs.
-#
-CREATE TABLE t2 (
- a int(11) default NULL
-);
-insert into t2 values(111);
-
-#--warning 1364
-create table t1 (
- a varchar(12) charset utf8 collate utf8_bin not null,
- b int not null, primary key (a)
-) select a, 1 as b from t2 ;
-show create table t1;
-drop table t1;
-
-#--warning 1364
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-create table t1 (
- a varchar(12) charset utf8 collate utf8_bin not null,
- b int not null, primary key (a)
-) select a, 1 as c from t2 ;
-show create table t1;
-drop table t1;
-
-#--warning 1364
-create table t1 (
- a varchar(12) charset utf8 collate utf8_bin not null,
- b int null, primary key (a)
-) select a, 1 as c from t2 ;
-show create table t1;
-drop table t1;
-
-#--warning 1364
-create table t1 (
- a varchar(12) charset utf8 collate utf8_bin not null,
- b int not null, primary key (a)
-) select 'a' as a , 1 as b from t2 ;
-show create table t1;
-drop table t1;
-
-#--warning 1364
-create table t1 (
- a varchar(12) charset utf8 collate utf8_bin,
- b int not null, primary key (a)
-) select 'a' as a , 1 as b from t2 ;
-show create table t1;
-drop table t1, t2;
-
-create table t1 (
- a1 int not null,
- a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int
-);
-insert into t1 values (1,1,1, 1,1,1, 1,1,1);
-
-#--warning 1364
-create table t2 (
- a1 varchar(12) charset utf8 collate utf8_bin not null,
- a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int,
- primary key (a1)
-) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ;
-drop table t2;
-
-#--warning 1364
-create table t2 (
- a1 varchar(12) charset utf8 collate utf8_bin,
- a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int
-) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1;
-
-drop table t1, t2;
-#--warning 1364
-create table t1 (
- a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int
-);
-insert into t1 values (1,1,1, 1,1,1, 1,1,1);
-
-#--warning 1364
-create table t2 (
- a1 varchar(12) charset utf8 collate utf8_bin not null,
- a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int,
- primary key (a1)
-) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ;
-
-# Test the default value
-drop table t2;
-
-create table t2 ( a int default 3, b int default 3)
- select a1,a2 from t1;
-show create table t2;
-
-drop table t1, t2;
-
-#
-# Bug #15316 SET value having comma not correctly handled
-#
---error 1367
-create table t1(a set("a,b","c,d") not null);
-
-# End of 4.1 tests
-
-
-#
-# Bug #14155: Maximum value of MAX_ROWS handled incorrectly on 64-bit
-# platforms
-#
-create table t1 (i int) engine=myisam max_rows=100000000000;
-show create table t1;
-alter table t1 max_rows=100;
-show create table t1;
-alter table t1 max_rows=100000000000;
-show create table t1;
-drop table t1;
-
-
-#
-# Tests for errors happening at various stages of CREATE TABLES ... SELECT
-#
-# (Also checks that it behaves atomically in the sense that in case
-# of error it is automatically dropped if it has not existed before.)
-#
-# Error during open_and_lock_tables() of tables
---error ER_NO_SUCH_TABLE
-create table t1 select * from t2;
-# A special case which is also caught during open tables pahse
---error ER_NO_SUCH_TABLE
-create table t1 select * from t1;
-# Error which happens before select_create::prepare()
---error ER_CANT_AGGREGATE_2COLLATIONS
-create table t1 select coalesce('a' collate latin1_swedish_ci,'b' collate latin1_bin);
-# Error during table creation
---error ER_KEY_COLUMN_DOES_NOT_EXITS
-create table t1 (primary key(a)) select "b" as b;
-# Error in select_create::prepare() which is not related to table creation
-create table t1 (a int);
-create table if not exists t1 select 1 as a, 2 as b;
-drop table t1;
-# Finally error which happens during insert
---error ER_DUP_ENTRY
-create table t1 (primary key (a)) (select 1 as a) union all (select 1 as a);
-# What happens if table already exists ?
-create table t1 (i int);
---error ER_TABLE_EXISTS_ERROR
-create table t1 select 1 as i;
-create table if not exists t1 select 1 as i;
-select * from t1;
-# After WL#5370, it just generates a warning that the table already exists.
-create table if not exists t1 select * from t1;
-select * from t1;
-drop table t1;
-# Error before select_create::prepare()
---error ER_CANT_AGGREGATE_2COLLATIONS
-create table t1 select coalesce('a' collate latin1_swedish_ci,'b' collate latin1_bin);
-
-
-# Base vs temporary tables dillema (a.k.a. bug#24508 "Inconsistent
-# results of CREATE TABLE ... SELECT when temporary table exists").
-# In this situation we either have to create non-temporary table and
-# insert data in it or insert data in temporary table without creation of
-# permanent table. After patch for Bug#47418, we create the base table and
-# instert data into it, even though a temporary table exists with the same
-# name.
-create temporary table t1 (j int);
-create table if not exists t1 select 1;
-select * from t1;
-drop temporary table t1;
-select * from t1;
-drop table t1;
-
-
-#
-# CREATE TABLE ... SELECT and LOCK TABLES
-#
-# There is little sense in using CREATE TABLE ... SELECT under
-# LOCK TABLES as it mostly does not work. At least we check that
-# the server doesn't crash, hang and produces sensible errors.
-# Includes test for bug #20662 "Infinite loop in CREATE TABLE
-# IF NOT EXISTS ... SELECT with locked tables".
-create table t1 (i int);
-insert into t1 values (1), (2);
-lock tables t1 read;
---error ER_TABLE_NOT_LOCKED
-create table t2 select * from t1;
---error ER_TABLE_NOT_LOCKED
-create table if not exists t2 select * from t1;
-unlock tables;
-create table t2 (j int);
-lock tables t1 read;
---error ER_TABLE_NOT_LOCKED
-create table t2 select * from t1;
-# This should not be ever allowed as it will undermine
-# lock-all-at-once approach
---error ER_TABLE_NOT_LOCKED
-create table if not exists t2 select * from t1;
-unlock tables;
-lock table t1 read, t2 read;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-create table t2 select * from t1;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-create table if not exists t2 select * from t1;
-unlock tables;
-lock table t1 read, t2 write;
---error ER_TABLE_EXISTS_ERROR
-create table t2 select * from t1;
-# This is the only case which really works.
-create table if not exists t2 select * from t1;
-select * from t1;
-unlock tables;
-drop table t2;
-
-# OTOH CREATE TEMPORARY TABLE ... SELECT should work
-# well under LOCK TABLES.
-lock tables t1 read;
-create temporary table t2 select * from t1;
-create temporary table if not exists t2 select * from t1;
-select * from t2;
-unlock tables;
-drop table t1, t2;
-
-
-#
-# Bug#21772: can not name a column 'upgrade' when create a table
-#
-create table t1 (upgrade int);
-drop table t1;
-
-
---echo
---echo Bug #26104 Bug on foreign key class constructor
---echo
---echo Check that ref_columns is initalized correctly in the constructor
---echo and semantic checks in mysql_prepare_table work.
---echo
---echo We do not need a storage engine that supports foreign keys
---echo for this test, as the checks are purely syntax-based, and the
---echo syntax is supported for all engines.
---echo
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-create table t1(a int not null, b int not null, primary key (a, b));
---error ER_WRONG_FK_DEF
-create table t2(a int not null, b int not null, c int not null, primary key (a),
-foreign key fk_bug26104 (b,c) references t1(a));
-drop table t1;
-
-#
-# Bug#15130:CREATE .. SELECT was denied to use advantages of the SQL_BIG_RESULT.
-#
-create table t1(f1 int,f2 int);
-insert into t1 value(1,1),(1,2),(1,3),(2,1),(2,2),(2,3);
-flush status;
-create table t2 select sql_big_result f1,count(f2) from t1 group by f1;
-show status like 'handler_read%';
-drop table t1,t2;
-
-#
-# Bug #25162: Backing up DB from 5.1 adds 'USING BTREE' to KEYs on table creates
-#
-
-# Show that the old syntax for index type is supported
-CREATE TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1));
-DROP TABLE t1;
-
-# Show that the new syntax for index type is supported
-CREATE TABLE t1(c1 VARCHAR(33), KEY (c1) USING BTREE);
-DROP TABLE t1;
-
-# Show that in case of multiple index type definitions, the last one takes
-# precedence
-
-CREATE TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1) USING HASH) ENGINE=MEMORY;
-SHOW INDEX FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1(c1 VARCHAR(33), KEY USING HASH (c1) USING BTREE) ENGINE=MEMORY;
-SHOW INDEX FROM t1;
-DROP TABLE t1;
-
-#
-# Bug#35924 DEFINER should be stored 'quoted' in I_S
-#
---error ER_UNKNOWN_ERROR
-create user mysqltest_1@'test@test';
-
-#
-# Bug#38821: Assert table->auto_increment_field_not_null failed in open_table()
-#
-CREATE TABLE t1 (a INTEGER AUTO_INCREMENT PRIMARY KEY, b INTEGER NOT NULL);
-INSERT IGNORE INTO t1 (b) VALUES (5);
-
-CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
- SELECT a FROM t1;
---error 1062
-INSERT INTO t2 SELECT a FROM t1;
---error 1062
-INSERT INTO t2 SELECT a FROM t1;
-
-DROP TABLE t1, t2;
-
---echo #
---echo # BUG#46384 - mysqld segfault when trying to create table with same
---echo # name as existing view
---echo #
-
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (a INT);
-
-INSERT INTO t1 VALUES (1),(2),(3);
-INSERT INTO t2 VALUES (1),(2),(3);
-
-CREATE VIEW v1 AS SELECT t1.a FROM t1, t2;
---error ER_TABLE_EXISTS_ERROR
-CREATE TABLE v1 AS SELECT * FROM t1;
-
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
---echo End of 5.0 tests
-
-#
-# Test of behaviour with CREATE ... SELECT
-#
-
-CREATE TABLE t1 (a int, b int);
-insert into t1 values (1,1),(1,2);
---error ER_DUP_ENTRY
-CREATE TABLE t2 (primary key (a)) select * from t1;
-# This should give warning
-drop table if exists t2;
---error ER_DUP_ENTRY
-CREATE TEMPORARY TABLE t2 (primary key (a)) select * from t1;
-# This should give warning
-drop table if exists t2;
-CREATE TABLE t2 (a int, b int, primary key (a));
---error ER_DUP_ENTRY
-INSERT INTO t2 select * from t1;
-SELECT * from t2;
-TRUNCATE table t2;
---error ER_DUP_ENTRY
-INSERT INTO t2 select * from t1;
-SELECT * from t2;
-drop table t2;
-
-CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a));
---error ER_DUP_ENTRY
-INSERT INTO t2 SELECT * FROM t1;
-SELECT * from t2;
-drop table t1,t2;
-
-
-#
-# Test incorrect database names
-#
-
---error 1102
-CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
---error 1102
-DROP DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
-
-# TODO: enable these tests when RENAME DATABASE is implemented.
-# --error 1049
-# RENAME DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa TO a;
-# --error 1102
-# RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
-# create database mysqltest;
-# --error 1102
-# RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
-# drop database mysqltest;
-
---error 1102
-USE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
---error 1102
-SHOW CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
-
-#
-# Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte
-#
-set names utf8;
-
-create database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
-use имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
-select database();
-use test;
-
-select SCHEMA_NAME from information_schema.schemata
-where schema_name='имя_базы_в_кодировке_утф8_длиной_больше_чем_45';
-
-drop database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
-create table имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48
-(
- имя_поля_в_кодировке_утф8_длиной_больше_чем_45 int,
- index имя_индекса_в_кодировке_утф8_длиной_больше_чем_48 (имя_поля_в_кодировке_утф8_длиной_больше_чем_45)
-);
-
-create view имя_вью_кодировке_утф8_длиной_больше_чем_42 as
-select имя_поля_в_кодировке_утф8_длиной_больше_чем_45
-from имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
-
-# database, table, field, key, view
-select * from имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
-
---sorted_result
-select TABLE_NAME from information_schema.tables where
-table_schema='test';
-
-select COLUMN_NAME from information_schema.columns where
-table_schema='test';
-
-select INDEX_NAME from information_schema.statistics where
-table_schema='test';
-
-select TABLE_NAME from information_schema.views where
-table_schema='test';
-
-show create table имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
-show create view имя_вью_кодировке_утф8_длиной_больше_чем_42;
-
-create trigger имя_триггера_в_кодировке_утф8_длиной_больше_чем_49
-before insert on имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48 for each row set @a:=1;
-select TRIGGER_NAME from information_schema.triggers where
-trigger_schema='test';
-drop trigger имя_триггера_в_кодировке_утф8_длиной_больше_чем_49;
---error 1059
-create trigger
-очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66
-before insert on имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48 for each row set @a:=1;
---error 1059
-drop trigger очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66;
-
-create procedure имя_процедуры_в_кодировке_утф8_длиной_больше_чем_50()
-begin
-end;
-select ROUTINE_NAME from information_schema.routines where
-routine_schema='test';
-drop procedure имя_процедуры_в_кодировке_утф8_длиной_больше_чем_50;
---error 1059
-create procedure очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66()
-begin
-end;
-
-create function имя_функции_в_кодировке_утф8_длиной_больше_чем_49()
- returns int
-return 0;
-select ROUTINE_NAME from information_schema.routines where
-routine_schema='test';
-drop function имя_функции_в_кодировке_утф8_длиной_больше_чем_49;
---error 1059
-create function очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66()
- returns int
-return 0;
-
-drop view имя_вью_кодировке_утф8_длиной_больше_чем_42;
-drop table имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
-set names default;
-
-#
-# Bug#21136 CREATE TABLE SELECT within CREATE TABLE SELECT causes server crash
-#
-
---disable_warnings
-drop table if exists t1,t2,t3;
-drop function if exists f1;
---enable_warnings
-
---delimiter |
-create function f1() returns int
-begin
- declare res int;
- create temporary table t3 select 1 i;
- set res:= (select count(*) from t1);
- drop temporary table t3;
- return res;
-end|
---delimiter ;
-create table t1 as select 1;
-create table t2 as select f1() from t1;
-drop table t1,t2;
-drop function f1;
-
-#
-# Bug#25629 CREATE TABLE LIKE does not work with INFORMATION_SCHEMA
-#
-create table t1 like information_schema.processlist;
---replace_result ENGINE=MyISAM "" ENGINE=Aria "" " PAGE_CHECKSUM=1" "" " PAGE_CHECKSUM=0" ""
-show create table t1;
-drop table t1;
-create temporary table t1 like information_schema.processlist;
---replace_result ENGINE=MyISAM "" ENGINE=Aria "" " PAGE_CHECKSUM=1" "" " PAGE_CHECKSUM=0" ""
-show create table t1;
-drop table t1;
-create table t1 like information_schema.character_sets;
-show create table t1;
-drop table t1;
-
-###########################################################################
-
---echo
---echo # --
---echo # -- Bug#18834: ALTER TABLE ADD INDEX on table with two timestamp fields
---echo # --
---echo
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS t2;
-DROP TABLE IF EXISTS t3;
---enable_warnings
-
---echo
-
-CREATE TABLE t1(c1 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c2 TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00');
-
---echo
-
-SET sql_mode = NO_ZERO_DATE;
-
---echo
---error ER_INVALID_DEFAULT
-CREATE TABLE t2(c1 TIMESTAMP, c2 TIMESTAMP DEFAULT 0);
-
---echo
---error ER_INVALID_DEFAULT
-CREATE TABLE t2(c1 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c2 TIMESTAMP NOT NULL);
-
---echo
---echo # -- Check that NULL column still can be created.
-CREATE TABLE t2(c1 TIMESTAMP NULL);
-
---echo
---echo # -- Check ALTER TABLE.
---error ER_INVALID_DEFAULT
-ALTER TABLE t1 ADD INDEX(c1);
-
---echo
---echo # -- Check DATETIME.
-SET sql_mode = '';
-
---echo
-
-CREATE TABLE t3(c1 DATETIME NOT NULL);
-INSERT INTO t3 VALUES (0);
-
---echo
-SET sql_mode = TRADITIONAL;
-
---echo
---error ER_TRUNCATED_WRONG_VALUE
-ALTER TABLE t3 ADD INDEX(c1);
-
---echo
---echo # -- Cleanup.
-
-SET sql_mode = '';
-DROP TABLE t1;
-DROP TABLE t2;
-DROP TABLE t3;
-
---echo
---echo # -- End of Bug#18834.
-
-###########################################################################
-
---echo
---echo # --
---echo # -- Bug#34274: Invalid handling of 'DEFAULT 0' for YEAR data type.
---echo # --
---echo
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
---echo
-CREATE TABLE t1(c1 YEAR DEFAULT 2008, c2 YEAR DEFAULT 0);
-
---echo
-SHOW CREATE TABLE t1;
-
---echo
-INSERT INTO t1 VALUES();
-
---echo
-SELECT * FROM t1;
-
---echo
-ALTER TABLE t1 MODIFY c1 YEAR DEFAULT 0;
-
---echo
-SHOW CREATE TABLE t1;
-
---echo
-INSERT INTO t1 VALUES();
-
---echo
-SELECT * FROM t1;
-
---echo
-DROP TABLE t1;
-
---echo
---echo # -- End of Bug#34274
-
-###########################################################################
-
-#
-# Bug#40104 regression with table names?
-#
-create table `me:i`(id int);
-drop table `me:i`;
-
-###########################################################################
-
-#
-# Bug#45829 CREATE TABLE TRANSACTIONAL PAGE_CHECKSUM ROW_FORMAT=PAGE accepted, does nothing
-#
-
---echo
---echo # --
---echo # -- Bug#45829: CREATE TABLE TRANSACTIONAL PAGE_CHECKSUM ROW_FORMAT=PAGE accepted, does nothing
---echo # --
---echo
-
---disable_warnings
-drop table if exists t1,t2,t3;
---enable_warnings
---echo # Fix modified for MariaDB: we support this syntax
-create table t1 (a int) transactional=0;
-create table t2 (a int) page_checksum=1;
-create table t3 (a int) row_format=page;
-drop table t1,t2,t3;
---echo
---echo # -- End of Bug#45829
-
-#
-# new table creation/renaming is NOT blocked if old encoded table present
-#
-let $MYSQLD_DATADIR= `select @@datadir`;
-create table `#mysql50#t-1` (a int) engine=myisam;
-insert into `#mysql50#t-1` values (1);
-show tables;
-create table `t-1` (a int);
-show tables;
-# selects can distinguish between the two tables
-select * from `t-1`;
-select * from `#mysql50#t-1`;
-drop table `t-1`;
-create table t1 (a int);
-alter table t1 rename `t-1`;
-show tables;
-drop table `t-1`;
-create table t1 (a int);
-rename table t1 to `t-1`;
-show tables;
-drop table `#mysql50#t-1`, `t-1`;
-
---echo
---echo End of 5.1 tests
-
-
-###########################################################################
-
---echo
---echo # --
---echo # -- Bug #43054 Assertion `!table->auto_increment_field_not_null'
---echo # -- failed when redefining trigger
---echo
-
-#--disable_abort_on_error
-
-CREATE TABLE B (
- pk INTEGER AUTO_INCREMENT,
- int_key INTEGER NOT NULL,
- PRIMARY KEY (pk),
- KEY (int_key)
-);
-
-INSERT IGNORE INTO B VALUES ('9', '9');
-
-CREATE TABLE IF NOT EXISTS t1 (
- `pk` INTEGER NOT NULL AUTO_INCREMENT ,
- `int` INTEGER ,
- PRIMARY KEY ( `pk` )
-) SELECT `pk` , `int_key` FROM B ;
-
---delimiter |
-
-CREATE TRIGGER f BEFORE INSERT ON t1 FOR EACH ROW
-BEGIN
- INSERT INTO t1 ( `int` ) VALUES (4 ),( 8 ),( 2 ) ;
-END ; |
-
---delimiter ;
---error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
-INSERT INTO t1 (pk, int_key) SELECT `pk` , `int_key` FROM B ;
-
---delimiter |
---error ER_TRG_ALREADY_EXISTS
-CREATE TRIGGER f BEFORE INSERT ON t1 FOR EACH ROW
-BEGIN
- UPDATE A SET `pk`=1 WHERE `pk`=0 ;
-END ;|
-
-CREATE TRIGGER f1 BEFORE INSERT ON t1 FOR EACH ROW
-BEGIN
- UPDATE A SET `pk`=1 WHERE `pk`=0 ;
-END ;|
-
---delimiter ;
-
-DROP TABLE t1;
-DROP TABLE B;
-
---echo #
---echo # Bug #47107 assert in notify_shared_lock on incorrect
---echo # CREATE TABLE , HANDLER
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1(f1 integer);
-
---echo # The following CREATE TABLEs before gave an assert.
-
-HANDLER t1 OPEN AS A;
---error ER_TABLE_EXISTS_ERROR
-CREATE TABLE t1 SELECT 1 AS f2;
-
-HANDLER t1 OPEN AS A;
---error ER_TABLE_EXISTS_ERROR
-CREATE TABLE t1(f1 integer);
-
-CREATE TABLE t2(f1 integer);
-HANDLER t1 OPEN AS A;
---error ER_TABLE_EXISTS_ERROR
-CREATE TABLE t1 LIKE t2;
-
-DROP TABLE t2;
-DROP TABLE t1;
-
---echo #
---echo # Bug #48800 CREATE TABLE t...SELECT fails if t is a
---echo # temporary table
---echo #
-
-CREATE TEMPORARY TABLE t1 (a INT);
-CREATE TABLE t1 (a INT);
-
-CREATE TEMPORARY TABLE t2 (a INT);
-CREATE VIEW t2 AS SELECT 1;
-
-CREATE TABLE t3 (a INT);
-CREATE TEMPORARY TABLE t3 SELECT 1;
-
-CREATE TEMPORARY TABLE t4 (a INT);
-CREATE TABLE t4 AS SELECT 1;
-
-DROP TEMPORARY TABLE t1, t2, t3, t4;
-DROP TABLE t1, t3, t4;
-DROP VIEW t2;
-
---echo #
---echo # Bug #49193 CREATE TABLE reacts differently depending
---echo # on whether data is selected or not
---echo #
-
-CREATE TEMPORARY TABLE t2 (ID INT);
-INSERT INTO t2 VALUES (1),(2),(3);
-
-# Case 1 -- did not fail
-CREATE TEMPORARY TABLE t1 (ID INT);
-CREATE TABLE IF NOT EXISTS t1 (ID INT);
-INSERT INTO t1 SELECT * FROM t2;
-SELECT * FROM t1;
-DROP TEMPORARY TABLE t1;
-SELECT * FROM t1;
-
-DROP TABLE t1;
-
-# Case 2 -- The DROP TABLE t1 failed with
-# Table 'test.t1' doesn't exist in the SELECT *
-# as the (permanent) table was not created
-CREATE TEMPORARY TABLE t1 (ID INT);
-CREATE TABLE IF NOT EXISTS t1 SELECT * FROM t2;
-SELECT * FROM t1;
-DROP TEMPORARY TABLE t1;
-SELECT * FROM t1;
-
-DROP TABLE t1;
-
-# Case 3 -- The CREATE TABLE failed with
-# Table 't1' already exists
-CREATE TEMPORARY TABLE t1 (ID INT);
-CREATE TABLE t1 SELECT * FROM t2;
-SELECT * FROM t1;
-DROP TEMPORARY TABLE t1;
-SELECT * FROM t1;
-
-DROP TABLE t1;
-
-DROP TEMPORARY TABLE t2;
-
-
---echo #
---echo # Bug #22909 "Using CREATE ... LIKE is possible to create field
---echo # with invalid default value"
---echo #
---echo # Altough original bug report suggests to use older version of MySQL
---echo # for producing .FRM with invalid defaults we use sql_mode to achieve
---echo # the same effect.
---disable_warnings
-drop tables if exists t1, t2;
---enable_warnings
---echo # Attempt to create table with invalid default should fail in normal mode
---error ER_INVALID_DEFAULT
-create table t1 (dt datetime default '2008-02-31 00:00:00');
-set @old_mode= @@sql_mode;
-set @@sql_mode='ALLOW_INVALID_DATES';
---echo # The same should be possible in relaxed mode
-create table t1 (dt datetime default '2008-02-31 00:00:00');
-set @@sql_mode= @old_mode;
---echo # In normal mode attempt to create copy of table with invalid
---echo # default should fail
---error ER_INVALID_DEFAULT
-create table t2 like t1;
-set @@sql_mode='ALLOW_INVALID_DATES';
---echo # But should work in relaxed mode
-create table t2 like t1;
---echo # Check that table definitions match
-show create table t1;
-show create table t2;
-set @@sql_mode= @old_mode;
-drop tables t1, t2;
-#
-# Bug#47132 CREATE TABLE.. SELECT.. data not inserted if table
-# is view over multiple tables
-#
-
-CREATE TABLE t1 (id int);
-CREATE TABLE t2 (id int);
-INSERT INTO t1 VALUES (1), (1);
-INSERT INTO t2 VALUES (2), (2);
-
-CREATE VIEW v1 AS SELECT id FROM t2;
-CREATE TABLE IF NOT EXISTS v1(a int, b int) SELECT id, id as di FROM t1;
-SHOW CREATE TABLE v1;
-SELECT * FROM t2;
-SELECT * FROM v1;
-DROP VIEW v1;
-
-CREATE TEMPORARY TABLE tt1 AS SELECT id FROM t2;
-CREATE TEMPORARY TABLE IF NOT EXISTS tt1(a int, b int) SELECT id, id FROM t1;
-SELECT * FROM t2;
-SELECT * FROM tt1;
-DROP TEMPORARY TABLE tt1;
-
-DROP TABLE t1, t2;
-
-
---echo #
---echo # WL#5370 "Changing 'CREATE TABLE IF NOT EXISTS ... SELECT'
---echo # behaviour.
---echo #
-
---echo #
---echo # 1. Basic case: a base table.
---echo #
-
-create table if not exists t1 (a int) select 1 as a;
-select * from t1;
---error ER_TABLE_EXISTS_ERROR
-create table t1 (a int) select 2 as a;
-select * from t1;
---echo # Produces an essential warning ER_TABLE_EXISTS.
-create table if not exists t1 (a int) select 2 as a;
---echo # No new data in t1.
-select * from t1;
-drop table t1;
-
---echo #
---echo # 2. A temporary table.
---echo #
-
-create temporary table if not exists t1 (a int) select 1 as a;
-select * from t1;
---error ER_TABLE_EXISTS_ERROR
-create temporary table t1 (a int) select 2 as a;
-select * from t1;
---echo # An essential warning.
-create temporary table if not exists t1 (a int) select 2 as a;
---echo # No new data in t1.
-select * from t1;
-drop temporary table t1;
-
---echo #
---echo # 3. Creating a base table in presence of a temporary table.
---echo #
-
-create table t1 (a int);
---echo # Create a view for convenience of querying t1 shadowed by a temp.
-create view v1 as select a from t1;
-drop table t1;
-create temporary table t1 (a int) select 1 as a;
-create table if not exists t1 (a int) select 2 as a;
-select * from t1;
-select * from v1;
---echo # Note: an essential warning.
-create table if not exists t1 (a int) select 3 as a;
-select * from t1;
-select * from v1;
-drop temporary table t1;
-select * from t1;
-drop view v1;
-drop table t1;
-
---echo #
---echo # 4. Creating a temporary table in presence of a base table.
---echo #
-
-create table t1 (a int) select 1 as a;
-create temporary table if not exists t1 select 2 as a;
-select * from t1;
---echo # Note: an essential warning.
-create temporary table if not exists t1 select 3 as a;
-select * from t1;
-drop temporary table t1;
-select * from t1;
-drop table t1;
-
---echo #
---echo # 5. Creating a base table in presence of an updatable view.
---echo #
-create table t2 (a int unique);
-create view t1 as select a from t2;
-insert into t1 (a) values (1);
---error ER_TABLE_EXISTS_ERROR
-create table t1 (a int);
---echo # Note: an essential warning.
-create table if not exists t1 (a int);
---error ER_TABLE_EXISTS_ERROR
-create table t1 (a int) select 2 as a;
-select * from t1;
---echo # Note: an essential warning.
-create table if not exists t1 (a int) select 2 as a;
-select * from t1;
-select * from t2;
-create temporary table if not exists t1 (a int) select 3 as a;
-select * from t1;
-select * from t2;
---echo # Note: an essential warning.
-create temporary table if not exists t1 (a int) select 4 as a;
-select * from t1;
-select * from t2;
-drop temporary table t1;
-
---echo #
---echo # Repeating the test with a non-updatable view.
---echo #
-drop view t1;
-create view t1 as select a + 5 as a from t2;
---error ER_NON_INSERTABLE_TABLE
-insert into t1 (a) values (1);
---error ER_NONUPDATEABLE_COLUMN
-update t1 set a=3 where a=2;
-
---error ER_TABLE_EXISTS_ERROR
-create table t1 (a int);
---echo # Note: an essential warning.
-create table if not exists t1 (a int);
---error ER_TABLE_EXISTS_ERROR
-create table t1 (a int) select 2 as a;
-select * from t1;
---echo # Note: an essential warning.
-create table if not exists t1 (a int) select 2 as a;
-select * from t1;
-select * from t2;
-create temporary table if not exists t1 (a int) select 3 as a;
-select * from t1;
-select * from t2;
---echo # Note: an essential warning.
-create temporary table if not exists t1 (a int) select 4 as a;
-select * from t1;
-select * from t2;
-drop temporary table t1;
-drop view t1;
-drop table t2;
-
---echo #
---echo # Repeating the test with a view select a constant number
---echo #
-create view t1 as select 1 as a;
---error ER_NON_INSERTABLE_TABLE
-insert into t1 (a) values (1);
---error ER_NON_UPDATABLE_TABLE
-update t1 set a=3 where a=2;
-
---error ER_TABLE_EXISTS_ERROR
-create table t1 (a int);
---echo # Note: an essential warning.
-create table if not exists t1 (a int);
---error ER_TABLE_EXISTS_ERROR
-create table t1 (a int) select 2 as a;
-select * from t1;
---echo # Note: an essential warning.
-create table if not exists t1 (a int) select 2 as a;
-select * from t1;
-create temporary table if not exists t1 (a int) select 3 as a;
-select * from t1;
---echo # Note: an essential warning.
-create temporary table if not exists t1 (a int) select 4 as a;
-select * from t1;
-drop temporary table t1;
-drop view t1;
-
-
---echo #
---echo # 6. Test of unique_table().
---echo #
-
-create table t1 (a int) select 1 as a;
-create temporary table if not exists t1 (a int) select * from t1;
-create temporary table if not exists t1 (a int) select * from t1;
-select * from t1;
-drop temporary table t1;
-select * from t1;
-drop table t1;
-create temporary table t1 (a int) select 1 as a;
-create table if not exists t1 (a int) select * from t1;
-create table if not exists t1 (a int) select * from t1;
-select * from t1;
-drop temporary table t1;
-select * from t1;
-drop table t1;
---error ER_NO_SUCH_TABLE
-create table if not exists t1 (a int) select * from t1;
-
---echo #
---echo # 7. Test of non-matching columns, REPLACE and IGNORE.
---echo #
-
-create table t1 (a int) select 1 as b, 2 as c;
-select * from t1;
-drop table t1;
-create table if not exists t1 (a int, b date, c date) select 1 as b, 2 as c;
-select * from t1;
-drop table t1;
-set @@session.sql_mode='STRICT_ALL_TABLES';
---error ER_TRUNCATED_WRONG_VALUE
-create table if not exists t1 (a int, b date, c date) select 1 as b, 2 as c;
---error ER_NO_SUCH_TABLE
-select * from t1;
---error ER_TRUNCATED_WRONG_VALUE
-create table if not exists t1 (a int, b date, c date)
- replace select 1 as b, 2 as c;
---error ER_NO_SUCH_TABLE
-select * from t1;
-
-create table if not exists t1 (a int, b date, c date)
- ignore select 1 as b, 2 as c;
-select * from t1;
-set @@session.sql_mode=default;
-drop table t1;
-
-create table if not exists t1 (a int unique, b int)
- replace select 1 as a, 1 as b union select 1 as a, 2 as b;
-select * from t1;
-drop table t1;
-create table if not exists t1 (a int unique, b int)
- ignore select 1 as a, 1 as b union select 1 as a, 2 as b;
-select * from t1;
-drop table t1;
-
---echo #
---echo # Checking that CREATE IF NOT EXISTS is not blocked by running SELECT
---echo #
-
-create table t1 (a int, b int) engine=myisam;
-create table t2 (a int, b int) engine=myisam;
-insert into t1 values (1,1);
-lock tables t1 read;
-connect (user1,localhost,root,,test);
-set @@lock_wait_timeout=5;
-create table if not exists t1 (a int, b int);
-create table if not exists t1 (a int, b int) select 2,2;
-create table if not exists t1 like t2;
---error ER_TABLE_EXISTS_ERROR
-create table t1 (a int, b int);
---error ER_TABLE_EXISTS_ERROR
-create table t1 (a int, b int) select 2,2;
---error ER_TABLE_EXISTS_ERROR
-create table t1 like t2;
---error ER_LOCK_WAIT_TIMEOUT
-create or replace table t1 (a int, b int) select 2,2;
-disconnect user1;
-connection default;
-select * from t1;
-unlock tables;
-drop table t1,t2;
-
---echo #
---echo # MDEV-6179: dynamic columns functions/cast()/convert() doesn't
---echo # play nice with CREATE/ALTER TABLE
---echo #
-create table t1 (
- color char(32) as (COLUMN_GET(dynamic_cols, 1 as char)) persistent,
- cl char(32) as (COLUMN_GET(COLUMN_ADD(COLUMN_CREATE(1 , 'blue' as char), 2, 'ttt'), i as char)) persistent,
- item_name varchar(32) primary key, -- A common attribute for all items
- i int,
- dynamic_cols blob -- Dynamic columns will be stored here
-);
-INSERT INTO t1(item_name, dynamic_cols, i) VALUES
- ('MariaDB T-shirt', COLUMN_CREATE(1, 'blue', 2, 'XL'), 1);
-INSERT INTO t1(item_name, dynamic_cols, i) VALUES
- ('Thinkpad Laptop', COLUMN_CREATE(1, 'black', 3, 500), 2);
-
-select item_name, color, cl from t1;
-show create table t1;
-
-drop table t1;
-
-create table t1 (
- n int,
- c char(32) as (convert(cast(n as char), char)) persistent
-);
-insert into t1(n) values (1),(2),(3);
-
-select * from t1;
-show create table t1;
-
-drop table t1;
-
-#
-# MDEV-7050: MySQL#74603 - Assertion `comma_length > 0' failed in mysql_prepare_create_table
-#
-set @@session.collation_server=filename;
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-create table t1(a enum('',''));
-drop table t1;
-set @@session.collation_server=default;
-
---echo #
---echo # MDEV-7765: Crash (Assertion `!table || (!table->write_set ||
---echo # bitmap_is_set(table->write_set, field_index) ||
---echo # bitmap_is_set(table->vcol_set, field_index))' fails)
---echo # on using function over not created table
---echo #
-
-DELIMITER |;
-CREATE function f1() returns int
-BEGIN
- declare n int;
- set n:= (select count(*) from t1);
- return n;
-end|
-DELIMITER ;|
--- error ER_NO_SUCH_TABLE
-create table t1 as select f1();
-drop function f1;
-
---echo #
---echo # MDEV-10274 Bundling insert with create statement
---echo # for table with unsigned Decimal primary key issues warning 1194
---echo #
-
-create table t1(ID decimal(2,1) unsigned NOT NULL, PRIMARY KEY (ID))engine=memory
- select 2.1 ID;
-drop table t1;
-
-#
-# many keys with long names and comments
-#
---error ER_CANT_CREATE_TABLE
-create table t1 (
- f01 int, f02 int, f03 int, f04 int, f05 int, f06 int, f07 int, f08 int, f09 int, f10 int, f11 int, f12 int, f13 int, f14 int, f15 int, f16 int, f17 int, f18 int, f19 int, f20 int, f21 int, f22 int, f23 int, f24 int, f25 int, f26 int, f27 int, f28 int, f29 int, f30 int, f31 int, f32 int, f33 int, f34 int, f35 int, f36 int, f37 int, f38 int, f39 int, f40 int, f41 int, f42 int, f43 int, f44 int, f45 int, f46 int, f47 int, f48 int, f49 int, f50 int, f51 int, f52 int, f53 int, f54 int, f55 int, f56 int, f57 int, f58 int, f59 int, f60 int, f61 int, f62 int, f63 int, f64 int,
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0001 (f01) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0002 (f02) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0003 (f03) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0004 (f04) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0005 (f05) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0006 (f06) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0007 (f07) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0008 (f08) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0009 (f09) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0010 (f10) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0011 (f11) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0012 (f12) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0013 (f13) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0014 (f14) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0015 (f15) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0016 (f16) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0017 (f17) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0018 (f18) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0019 (f19) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0020 (f20) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0021 (f21) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0022 (f22) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0023 (f23) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0024 (f24) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0025 (f25) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0026 (f26) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0027 (f27) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0028 (f28) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0029 (f29) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0030 (f30) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0031 (f31) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0032 (f32) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0033 (f33) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0034 (f34) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0035 (f35) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0036 (f36) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0037 (f37) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0038 (f38) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0039 (f39) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0040 (f40) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0041 (f41) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0042 (f42) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0043 (f43) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0044 (f44) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0045 (f45) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0046 (f46) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0047 (f47) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0048 (f48) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0049 (f49) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0050 (f50) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0051 (f51) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0052 (f52) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0053 (f53) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0054 (f54) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0055 (f55) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0056 (f56) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0057 (f57) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0058 (f58) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0059 (f59) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0060 (f60) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0061 (f61) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0062 (f62) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0063 (f63) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0064 (f64) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- fend int);
-
-create table t1 (
- f01 int, f02 int, f03 int, f04 int, f05 int, f06 int, f07 int, f08 int, f09 int, f10 int, f11 int, f12 int, f13 int, f14 int, f15 int, f16 int, f17 int, f18 int, f19 int, f20 int, f21 int, f22 int, f23 int, f24 int, f25 int, f26 int, f27 int, f28 int, f29 int, f30 int, f31 int, f32 int, f33 int, f34 int, f35 int, f36 int, f37 int, f38 int, f39 int, f40 int, f41 int, f42 int, f43 int, f44 int, f45 int, f46 int, f47 int, f48 int, f49 int, f50 int, f51 int, f52 int, f53 int, f54 int, f55 int, f56 int, f57 int, f58 int, f59 int, f60 int, f61 int, f62 int, f63 int, f64 int,
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0001 (f01) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0002 (f02) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0003 (f03) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0004 (f04) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0005 (f05) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0006 (f06) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0007 (f07) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0008 (f08) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0009 (f09) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0010 (f10) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0011 (f11) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0012 (f12) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0013 (f13) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0014 (f14) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0015 (f15) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0016 (f16) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0017 (f17) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0018 (f18) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0019 (f19) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0020 (f20) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0021 (f21) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0022 (f22) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0023 (f23) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0024 (f24) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0025 (f25) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0026 (f26) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0027 (f27) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0028 (f28) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0029 (f29) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0030 (f30) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0031 (f31) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0032 (f32) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0033 (f33) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0034 (f34) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0035 (f35) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0036 (f36) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0037 (f37) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0038 (f38) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0039 (f39) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0040 (f40) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0041 (f41) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0042 (f42) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0043 (f43) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0044 (f44) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0045 (f45) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0046 (f46) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0047 (f47) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0048 (f48) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0049 (f49) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0050 (f50) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0051 (f51) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0052 (f52) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0053 (f53) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0054 (f54) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0055 (f55) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0056 (f56) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0057 (f57) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0058 (f58) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0059 (f59) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0060 (f60) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0061 (f61) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0062 (f62) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0063 (f63) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
- fend int);
---error ER_CANT_CREATE_TABLE
-alter table t1 add
- key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0064 (f64) comment 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy';
-drop table t1;
-
---echo End of 5.5 tests
-
-#
-# MDEV-4880 Attempt to create a table without columns produces ER_ILLEGAL_HA instead of ER_TABLE_MUST_HAVE_COLUMNS
-#
---error ER_TABLE_MUST_HAVE_COLUMNS
-create table t1;
-
-#
-# MDEV-11231 Server crashes in check_duplicate_key on CREATE TABLE ... SELECT
-#
-create table t1 (i int, j int, key(i), key(i)) as select 1 as i, 2 as j;
-drop table t1;
diff --git a/mysql-test/t/create_delayed.test b/mysql-test/t/create_delayed.test
deleted file mode 100644
index e99886d97d1..00000000000
--- a/mysql-test/t/create_delayed.test
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# Ensure that INSERT DELAYED works with CREATE TABLE on existing table
-#
-
--- source include/big_test.inc
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
---disable_query_log
---disable_result_log
-
---let $run=1000
-
---echo Starting test
-
-while ($run)
-{
-# --echo # $run attempts left...
- CREATE TABLE t1 ( f1 INTEGER AUTO_INCREMENT, PRIMARY KEY (f1)) ENGINE=MyISAM;
- INSERT DELAYED t1 VALUES (4);
---error ER_TABLE_EXISTS_ERROR
- CREATE TABLE t1 AS SELECT 1 AS f1;
-
- REPLACE DELAYED t1 VALUES (5);
- DROP TABLE t1;
---dec $run
-}
-
---enable_query_log
---enable_result_log
-
---echo # All done
diff --git a/mysql-test/t/create_drop_binlog.test b/mysql-test/t/create_drop_binlog.test
deleted file mode 100644
index 6b2b1bbf1f5..00000000000
--- a/mysql-test/t/create_drop_binlog.test
+++ /dev/null
@@ -1,198 +0,0 @@
---source include/have_udf.inc
---source include/have_log_bin.inc
---source include/binlog_start_pos.inc
-
-reset master;
-
---let $pos=`select $binlog_start_pos + 73`
-
---let $binlog_file=query_get_value(SHOW MASTER STATUS, File, 1)
---let $binlog_start=query_get_value(SHOW MASTER STATUS, Position, 1)
-
-CREATE OR REPLACE DATABASE d1;
-CREATE OR REPLACE DATABASE d1;
-DROP DATABASE d1;
-CREATE DATABASE IF NOT EXISTS d1;
-CREATE DATABASE IF NOT EXISTS d1;
-DROP DATABASE IF EXISTS d1;
-DROP DATABASE IF EXISTS d1;
---echo "Runnig SHOW BINLOG EVENTS"
---replace_column 1 # 2 # 5 #
---replace_regex /xid=[0-9]+/xid=XX/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/ /Server.ver.*/VERSIONS/
---disable_query_log
---eval SHOW BINLOG EVENTS FROM $binlog_start;
---enable_query_log
-RESET MASTER;
-USE test;
-
-
-CREATE OR REPLACE FUNCTION f1() RETURNS INT RETURN 1;
-CREATE OR REPLACE FUNCTION f1() RETURNS INT RETURN 1;
-DROP FUNCTION f1;
-CREATE FUNCTION IF NOT EXISTS f1() RETURNS INT RETURN 1;
-CREATE FUNCTION IF NOT EXISTS f1() RETURNS INT RETURN 1;
-DROP FUNCTION IF EXISTS f1;
-DROP FUNCTION IF EXISTS f1;
---replace_column 1 # 2 # 5 #
---replace_regex /xid=[0-9]+/xid=XX/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/ /Server.ver.*/VER/
-SHOW BINLOG EVENTS;
-RESET MASTER;
-
-
-CREATE TABLE t1 (a DATETIME);
-CREATE OR REPLACE PROCEDURE p1() DELETE FROM t1;
-CREATE OR REPLACE PROCEDURE p1() DELETE FROM t1;
-DROP PROCEDURE p1;
-CREATE PROCEDURE IF NOT EXISTS p1() DELETE FROM t1;
-CREATE PROCEDURE IF NOT EXISTS p1() DELETE FROM t1;
-DROP PROCEDURE IF EXISTS p1;
-DROP PROCEDURE IF EXISTS p1;
---replace_column 1 # 2 # 5 #
---replace_regex /xid=[0-9]+/xid=XX/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/ /Server.ver.*/VER/
-SHOW BINLOG EVENTS;
-DROP TABLE t1;
-RESET MASTER;
-
-
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE OR REPLACE FUNCTION metaphon RETURNS STRING SONAME '$UDF_EXAMPLE_SO';
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE OR REPLACE FUNCTION metaphon RETURNS STRING SONAME '$UDF_EXAMPLE_SO';
-DROP FUNCTION metaphon;
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE FUNCTION IF NOT EXISTS metaphon RETURNS STRING SONAME '$UDF_EXAMPLE_SO';
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE FUNCTION IF NOT EXISTS metaphon RETURNS STRING SONAME '$UDF_EXAMPLE_SO';
-DROP FUNCTION IF EXISTS metaphon;
-DROP FUNCTION IF EXISTS metaphon;
---replace_column 1 # 2 # 5 #
---replace_result $UDF_EXAMPLE_SO UDM_EXAMPLE_LIB
---replace_regex /xid=[0-9]+/xid=XX/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/ /Server.ver.*/VER/
-SHOW BINLOG EVENTS;
-RESET MASTER;
-
-
---echo #
---echo # CREATE SERVER is not logged
---echo #
-CREATE OR REPLACE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'root', HOST 'localhost', DATABASE 'test');
-CREATE OR REPLACE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'root', HOST 'localhost', DATABASE 'test');
-DROP SERVER s1;
-CREATE SERVER IF NOT EXISTS s1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'root', HOST 'localhost', DATABASE 'test');
-CREATE SERVER IF NOT EXISTS s1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'root', HOST 'localhost', DATABASE 'test');
-DROP SERVER IF EXISTS s1;
-DROP SERVER IF EXISTS s1;
---replace_column 1 # 2 # 5 #
---replace_regex /xid=[0-9]+/xid=XX/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/ /Server.ver.*/VER/
-SHOW BINLOG EVENTS;
-RESET MASTER;
-
-
-
-CREATE OR REPLACE VIEW v1 AS SELECT 1;
-CREATE OR REPLACE VIEW v1 AS SELECT 1;
-DROP VIEW v1;
-CREATE VIEW IF NOT EXISTS v1 AS SELECT 1;
-CREATE VIEW IF NOT EXISTS v1 AS SELECT 1;
-DROP VIEW IF EXISTS v1;
-DROP VIEW IF EXISTS v1;
---replace_column 1 # 2 # 5 #
---replace_regex /xid=[0-9]+/xid=XX/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/ /Server.ver.*/VER/
-SHOW BINLOG EVENTS;
-RESET MASTER;
-
-CREATE OR REPLACE ROLE r1;
-CREATE OR REPLACE ROLE r1;
-DROP ROLE r1;
-CREATE ROLE IF NOT EXISTS r1;
-CREATE ROLE IF NOT EXISTS r1;
-DROP ROLE IF EXISTS r1;
-DROP ROLE IF EXISTS r1;
---replace_column 1 # 2 # 5 #
---replace_regex /xid=[0-9]+/xid=XX/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/ /Server.ver.*/VER/
-SHOW BINLOG EVENTS;
-RESET MASTER;
-
-CREATE OR REPLACE USER u1@localhost;
-CREATE OR REPLACE USER u1@localhost;
-DROP USER u1@localhost;
-CREATE USER IF NOT EXISTS u1@localhost;
-CREATE USER IF NOT EXISTS u1@localhost;
-DROP USER IF EXISTS u1@localhost;
-DROP USER IF EXISTS u1@localhost;
---replace_column 1 # 2 # 5 #
---replace_regex /xid=[0-9]+/xid=XX/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/ /Server.ver.*/VER/
-SHOW BINLOG EVENTS;
-RESET MASTER;
-
-
-SET timestamp=UNIX_TIMESTAMP('2014-11-01 10:20:30');
-CREATE OR REPLACE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO DROP TABLE IF EXISTS t1;
-CREATE OR REPLACE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO DROP TABLE IF EXISTS t2;
-SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
-DROP EVENT ev1;
-DROP EVENT IF EXISTS ev1;
-
---replace_column 1 # 2 # 5 #
---replace_regex /xid=[0-9]+/xid=XX/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/ /Server.ver.*/VER/
-SHOW BINLOG EVENTS;
-RESET MASTER;
-
-CREATE TABLE t1 (a INT);
-CREATE OR REPLACE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=10;
-CREATE OR REPLACE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=11;
-DROP TRIGGER tr1;
-CREATE TRIGGER IF NOT EXISTS tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=20;
-CREATE TRIGGER IF NOT EXISTS tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=21;
-DROP TRIGGER IF EXISTS tr1;
-DROP TRIGGER IF EXISTS tr1;
-DROP TABLE t1;
-
---replace_column 1 # 2 # 5 #
---replace_regex /xid=[0-9]+/xid=XX/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/ /Server.ver.*/VER/
-SHOW BINLOG EVENTS;
-RESET MASTER;
-
-
-CREATE TABLE t1(a INT, b INT);
-CREATE TABLE IF NOT EXISTS t1(a INT, b INT);
-CREATE OR REPLACE INDEX i1 ON t1(a);
-CREATE OR REPLACE INDEX i1 ON t1(a);
-CREATE OR REPLACE INDEX i1 ON t1(a,b);
-CREATE OR REPLACE INDEX i1 ON t1(a,b);
-DROP TABLE t1;
---replace_column 1 # 2 # 5 #
---replace_regex /xid=[0-9]+/xid=XX/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/ /Server.ver.*/VER/
-SHOW BINLOG EVENTS;
-RESET MASTER;
-
-# Test RESET MASTER TO
-
-RESET MASTER;
---replace_result $pos <pos>
-SHOW MASTER STATUS;
-RESET MASTER TO 100;
---replace_result $pos <pos>
-SHOW MASTER STATUS;
-RESET MASTER;
---replace_result $pos <pos>
-SHOW MASTER STATUS;
-
-#
-# mdev-7817 ALTER TABLE {ADD|DROP} INDEX IF [NOT] EXISTS does not get written into binlog if nothing to do
-#
-
-CREATE TABLE t1(a INT, b INT);
-CREATE TABLE IF NOT EXISTS t1(a INT, b INT);
-CREATE INDEX IF NOT EXISTS i1 ON t1(a);
-CREATE INDEX IF NOT EXISTS i1 ON t1(a);
-SHOW CREATE TABLE t1;
-DROP INDEX IF EXISTS i1 ON t1;
-DROP INDEX IF EXISTS i1 ON t1;
-DROP TABLE t1;
-DROP TABLE IF EXISTS t1;
---replace_column 1 # 2 # 5 #
---replace_regex /xid=[0-9]+/xid=XX/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/ /Server.ver.*/VER/
-SHOW BINLOG EVENTS;
-RESET MASTER;
-
diff --git a/mysql-test/t/create_drop_db.test b/mysql-test/t/create_drop_db.test
deleted file mode 100644
index 13391c35a4d..00000000000
--- a/mysql-test/t/create_drop_db.test
+++ /dev/null
@@ -1,32 +0,0 @@
-# Enable diisplaying rows affected
---enable_info
-
-CREATE DATABASE IF NOT EXISTS db1;
-
-CREATE DATABASE IF NOT EXISTS db1;
-CREATE TABLE db1.t1 (a INT);
-SHOW TABLES IN db1;
-
-CREATE OR REPLACE DATABASE db1;
-SHOW TABLES IN db1;
-
---error ER_WRONG_USAGE
-CREATE OR REPLACE DATABASE IF NOT EXISTS db2;
-
-DROP DATABASE db1;
-
-DROP DATABASE IF EXISTS db1;
-
---error ER_DB_DROP_EXISTS
-DROP DATABASE db1;
-
-CREATE OR REPLACE DATABASE db1;
-SHOW TABLES IN db1;
-
---error ER_DB_CREATE_EXISTS
-CREATE DATABASE db1;
-
-DROP DATABASE IF EXISTS db1;
-DROP DATABASE IF EXISTS db1;
-
---disable_info
diff --git a/mysql-test/t/create_drop_event.test b/mysql-test/t/create_drop_event.test
deleted file mode 100644
index d885a39e453..00000000000
--- a/mysql-test/t/create_drop_event.test
+++ /dev/null
@@ -1,47 +0,0 @@
---source include/not_embedded.inc
-
-SET timestamp=UNIX_TIMESTAMP('2014-11-01 10:20:30');
-SET GLOBAL event_scheduler=off;
-
-CREATE TABLE t1 (a INT);
-
---error ER_WRONG_USAGE
-CREATE OR REPLACE EVENT IF NOT EXISTS ev1 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE db1;
-
-CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (10);
-SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
---source include/count_sessions.inc
-SET GLOBAL event_scheduler=on;
-let $wait_condition= SELECT count(*)>0 FROM t1;
---source include/wait_condition.inc
-SELECT DISTINCT a FROM t1;
-SET GLOBAL event_scheduler=off;
---source include/wait_until_count_sessions.inc
-DELETE FROM t1;
-
---error ER_EVENT_ALREADY_EXISTS
-CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (11);
-SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
-CREATE EVENT IF NOT EXISTS ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (12);
-SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
-CREATE OR REPLACE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (13);
-SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
-
-SET GLOBAL event_scheduler=on;
-let $wait_condition= SELECT count(*)>0 FROM t1;
---source include/wait_condition.inc
-SELECT DISTINCT a FROM t1;
-SET GLOBAL event_scheduler=off;
---source include/wait_until_count_sessions.inc
-DELETE FROM t1;
-
-DROP EVENT IF EXISTS ev1;
-SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
-DROP EVENT IF EXISTS ev1;
---error ER_EVENT_DOES_NOT_EXIST
-DROP EVENT ev1;
-SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
-
-DROP TABLE t1;
-
-SET timestamp=DEFAULT;
diff --git a/mysql-test/t/create_drop_function.test b/mysql-test/t/create_drop_function.test
deleted file mode 100644
index e4d3d684cd5..00000000000
--- a/mysql-test/t/create_drop_function.test
+++ /dev/null
@@ -1,41 +0,0 @@
-SET timestamp=UNIX_TIMESTAMP('2014-09-30 08:00:00');
-
-CREATE FUNCTION f1(str char(20))
-RETURNS CHAR(100)
-RETURN CONCAT('Hello, ', str, '!');
-SELECT * FROM mysql.proc WHERE name like 'f1';
-SELECT f1('world');
-
---error ER_SP_ALREADY_EXISTS
-CREATE FUNCTION f1(str char(20))
-RETURNS TEXT
-RETURN CONCAT('Hello2, ', str, '!');
-SELECT body FROM mysql.proc WHERE name like 'f1';
-
-CREATE FUNCTION IF NOT EXISTS f1(str char(20))
-RETURNS CHAR(100)
-RETURN CONCAT('Hello3, ', str, '!');
-SELECT body FROM mysql.proc WHERE name like 'f1';
-
---error ER_WRONG_USAGE
-CREATE OR REPLACE FUNCTION IF NOT EXISTS f1(str char(20))
-RETURNS CHAR(100)
-RETURN CONCAT('Hello4, ', str, '!');
-SELECT body FROM mysql.proc WHERE name like 'f1';
-
-CREATE OR REPLACE FUNCTION f1(str char(20))
-RETURNS CHAR(100)
-RETURN CONCAT('Hello5, ', str, '!');
-SELECT body FROM mysql.proc WHERE name like 'f1';
-
-DROP FUNCTION f1;
-CREATE FUNCTION IF NOT EXISTS f1(str char(20))
-RETURNS CHAR(100)
-RETURN CONCAT('Hello6, ', str, '!');
-SELECT body FROM mysql.proc WHERE name like 'f1';
-SELECT f1('world');
-
-DROP FUNCTION IF EXISTS f1;
-SELECT body FROM mysql.proc WHERE name like 'f1';
-DROP FUNCTION IF EXISTS f1;
-
diff --git a/mysql-test/t/create_drop_index.test b/mysql-test/t/create_drop_index.test
deleted file mode 100644
index 4c861266325..00000000000
--- a/mysql-test/t/create_drop_index.test
+++ /dev/null
@@ -1,16 +0,0 @@
-CREATE TABLE t1(a INT, b INT);
-CREATE INDEX IF NOT EXISTS i1 ON t1(a);
-SHOW CREATE TABLE t1;
-DROP INDEX IF EXISTS i1 ON t1;
-SHOW CREATE TABLE t1;
-DROP INDEX IF EXISTS i1 ON t1;
-SHOW CREATE TABLE t1;
-
-CREATE OR REPLACE INDEX i1 ON t1(a);
-SHOW CREATE TABLE t1;
-CREATE OR REPLACE INDEX i1 ON t1(a,b);
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
---error ER_WRONG_USAGE
-CREATE OR REPLACE INDEX IF NOT EXISTS i1 ON t1(b,a);
diff --git a/mysql-test/t/create_drop_procedure.test b/mysql-test/t/create_drop_procedure.test
deleted file mode 100644
index 50e6b1cc61c..00000000000
--- a/mysql-test/t/create_drop_procedure.test
+++ /dev/null
@@ -1,41 +0,0 @@
-CREATE TABLE t1 (id INT);
-DELIMITER $$;
-CREATE PROCEDURE proc1 (OUT cnt INT) COMMENT 'comment1' BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$
-DELIMITER ;$$
-CALL proc1(@cnt);
-SELECT @cnt;
-INSERT INTO t1 VALUES (1), (2), (3);
-CALL proc1(@cnt);
-SELECT @cnt;
-
-DELIMITER $$;
---error ER_SP_ALREADY_EXISTS
-CREATE PROCEDURE proc1 (OUT cnt INT) COMMENT 'comment2'
- BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$
-SELECT comment FROM mysql.proc WHERE name='proc1'$$
-
-CREATE PROCEDURE IF NOT EXISTS proc1 (OUT cnt INT) COMMENT 'comment3'
- BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$
-SELECT comment FROM mysql.proc WHERE name='proc1'$$
-
---error ER_WRONG_USAGE
-CREATE OR REPLACE PROCEDURE IF NOT EXISTS proc1 (OUT cnt INT) COMMENT 'comment4'
- BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$
-SELECT comment FROM mysql.proc WHERE name='proc1'$$
-
-CREATE OR REPLACE PROCEDURE proc1 (OUT cnt INT) COMMENT 'comment5'
- BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$
-SELECT comment FROM mysql.proc WHERE name='proc1'$$
-
-DELIMITER ;$$
-DROP PROCEDURE proc1;
-DELIMITER $$;
-CREATE PROCEDURE IF NOT EXISTS proc1 (OUT cnt INT) BEGIN SELECT COUNT(*) INTO cnt FROM t1; END$$
-DELIMITER ;$$
-INSERT INTO t1 VALUES (1), (2), (3);
-CALL proc1(@cnt);
-SELECT @cnt;
-
-DROP TABLE IF EXISTS t1;
-DROP PROCEDURE IF EXISTS proc1;
-DROP PROCEDURE IF EXISTS proc1;
diff --git a/mysql-test/t/create_drop_role.test b/mysql-test/t/create_drop_role.test
deleted file mode 100644
index be33083e6c4..00000000000
--- a/mysql-test/t/create_drop_role.test
+++ /dev/null
@@ -1,56 +0,0 @@
---source include/not_embedded.inc
-
-CREATE ROLE IF NOT EXISTS role1 WITH ADMIN user1;
-SELECT * FROM mysql.roles_mapping;
-DROP ROLE role1;
-
-CREATE OR REPLACE ROLE role1 WITH ADMIN user2;
-SELECT * FROM mysql.roles_mapping WHERE Role='role1';
-CREATE OR REPLACE ROLE role1 WITH ADMIN user3;
-SELECT * FROM mysql.roles_mapping WHERE Role='role1';
-CREATE ROLE IF NOT EXISTS role1 WITH ADMIN user4;
-SELECT * FROM mysql.roles_mapping WHERE Role='role1';
-DROP ROLE IF EXISTS role1;
-SELECT * FROM mysql.roles_mapping WHERE Role='role1';
-DROP ROLE IF EXISTS role1;
-
-
-CREATE ROLE role_1;
-
-CREATE ROLE IF NOT EXISTS role_1;
-CREATE OR REPLACE ROLE role_1;
-
---error ER_WRONG_USAGE
-CREATE OR REPLACE ROLE IF NOT EXISTS role_1;
-
---error ER_CANNOT_USER
-CREATE ROLE role_1;
-
-CREATE USER u1@localhost;
-REVOKE SHOW DATABASES ON *.* FROM 'u1'@'localhost';
-GRANT SHOW DATABASES ON *.* TO role_1;
-GRANT role_1 TO u1@localhost;
-
-connect (user_a, localhost, u1,,);
-connection user_a;
-
-SELECT CURRENT_USER;
-
-SHOW DATABASES;
-SELECT CURRENT_ROLE;
-SET ROLE role_1;
-SELECT CURRENT_ROLE;
-SHOW DATABASES;
-SET ROLE NONE;
-
-connect (user_b, localhost, root,,);
-connection user_b;
-
---echo # Clearing up
-DROP ROLE role_1;
-DROP ROLE IF EXISTS role_1;
-
---error ER_CANNOT_USER
-DROP ROLE role_1;
-
-DROP USER u1@localhost;
diff --git a/mysql-test/t/create_drop_server.test b/mysql-test/t/create_drop_server.test
deleted file mode 100644
index 1b9e9b2a788..00000000000
--- a/mysql-test/t/create_drop_server.test
+++ /dev/null
@@ -1,34 +0,0 @@
---echo #
---echo # MDEV-7285 SERVER: CREATE OR REPLACE and CREATE IF NOT EXISTS
---echo #
-
-CREATE SERVER IF NOT EXISTS server1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'user1', HOST 'localhost', DATABASE 'test0');
-SELECT server_name, username, db FROM mysql.servers;
-CREATE SERVER IF NOT EXISTS server1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'user2', HOST 'localhost', DATABASE 'test1');
-SELECT server_name, username, db FROM mysql.servers;
-CREATE OR REPLACE SERVER server1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'user3', HOST 'localhost', DATABASE 'test2');
-SELECT server_name, username, db FROM mysql.servers;
-DROP SERVER IF EXISTS server1;
-SELECT server_name, username, db FROM mysql.servers;
-DROP SERVER IF EXISTS server1;
-
-
-CREATE SERVER server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test0');
---error ER_FOREIGN_SERVER_EXISTS
-CREATE SERVER server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test1');
-CREATE SERVER IF NOT EXISTS server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test2');
-SELECT server_name, username, db FROM mysql.servers;
---error ER_WRONG_USAGE
-CREATE OR REPLACE SERVER IF NOT EXISTS server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test3');
-CREATE OR REPLACE SERVER server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test4');
-SELECT server_name, username, db FROM mysql.servers;
-DROP SERVER server_1;
-
-
-# MDEV-726 convert host names to lowercase
-
-CREATE SERVER server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'Remote', HOST 'Server.Example.Com', DATABASE 'test');
-SELECT Host FROM mysql.servers WHERE Server_Name = 'server_1';
-ALTER SERVER server_1 OPTIONS(HOST 'Server.Example.Org');
-SELECT Host FROM mysql.servers WHERE Server_Name = 'server_1';
-DROP SERVER server_1;
diff --git a/mysql-test/t/create_drop_trigger.test b/mysql-test/t/create_drop_trigger.test
deleted file mode 100644
index 0f19f5cf09f..00000000000
--- a/mysql-test/t/create_drop_trigger.test
+++ /dev/null
@@ -1,30 +0,0 @@
-CREATE DATABASE db1;
-USE db1;
-CREATE TABLE t1 (val INT);
-CREATE TRIGGER IF NOT EXISTS val_sum BEFORE INSERT ON t1 FOR EACH ROW SET @sum = @sum + NEW.val;
-SET @sum=0;
-INSERT INTO t1 VALUES (10), (20), (30);
-SELECT @sum;
-
-CREATE TRIGGER IF NOT EXISTS val_sum_new BEFORE INSERT ON t1 FOR EACH ROW SET @sum = @sum + NEW.val;
-
-CREATE TRIGGER IF NOT EXISTS val_sum AFTER INSERT ON t1 FOR EACH ROW SET @sum = @sum + 1 + NEW.val;
-
---error ER_WRONG_USAGE
-CREATE OR REPLACE TRIGGER IF NOT EXISTS val_sum BEFORE INSERT ON t1 FOR EACH ROW SET @sum = @sum + 2 + NEW.val;
-SELECT ACTION_STATEMENT FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='val_sum';
-
-CREATE OR REPLACE TRIGGER val_sum BEFORE INSERT ON t1 FOR EACH ROW SET @sum = @sum + 3 + NEW.val;
-SELECT ACTION_STATEMENT FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='val_sum';
-
---error ER_TRG_ALREADY_EXISTS
-CREATE TRIGGER val_sum BEFORE INSERT ON t1 FOR EACH ROW SET @sum = @sum + 4 + NEW.val;
-SELECT ACTION_STATEMENT FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='val_sum';
-
---echo # Clearing up
-DROP TRIGGER IF EXISTS val_sum;
-SELECT ACTION_STATEMENT FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME='val_sum';
-DROP TRIGGER IF EXISTS val_sum;
-
-DROP TABLE t1;
-DROP DATABASE db1;
diff --git a/mysql-test/t/create_drop_udf.test b/mysql-test/t/create_drop_udf.test
deleted file mode 100644
index 5908bf04e90..00000000000
--- a/mysql-test/t/create_drop_udf.test
+++ /dev/null
@@ -1,37 +0,0 @@
---source include/have_udf.inc
-
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE FUNCTION IF NOT EXISTS metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO";
-SELECT ret FROM mysql.func WHERE name like 'metaphon';
-
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
---error ER_UDF_EXISTS
-CREATE FUNCTION metaphon RETURNS INT SONAME "$UDF_EXAMPLE_SO";
-SELECT ret FROM mysql.func WHERE name like 'metaphon';
-
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE FUNCTION IF NOT EXISTS metaphon RETURNS REAL SONAME "$UDF_EXAMPLE_SO";
-SELECT ret FROM mysql.func WHERE name like 'metaphon';
-
-DROP FUNCTION IF EXISTS metaphon;
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE FUNCTION IF NOT EXISTS metaphon RETURNS REAL SONAME "$UDF_EXAMPLE_SO";
-SELECT ret FROM mysql.func WHERE name like 'metaphon';
-
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
---error ER_WRONG_USAGE
-eval CREATE OR REPLACE FUNCTION IF NOT EXISTS metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO";
-SELECT ret FROM mysql.func WHERE name like 'metaphon';
-
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE OR REPLACE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO";
-SELECT ret FROM mysql.func WHERE name like 'metaphon';
-
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
---error ER_UDF_EXISTS
-eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO";
-SELECT metaphon('mariadb');
-
-DROP FUNCTION metaphon;
-DROP FUNCTION IF EXISTS metaphon;
diff --git a/mysql-test/t/create_drop_user.test b/mysql-test/t/create_drop_user.test
deleted file mode 100644
index 949782a2daf..00000000000
--- a/mysql-test/t/create_drop_user.test
+++ /dev/null
@@ -1,46 +0,0 @@
---source include/not_embedded.inc
-
-CREATE USER IF NOT EXISTS u1@localhost IDENTIFIED BY 'pw1';
-SELECT password FROM mysql.user WHERE user='u1';
-
-CREATE USER IF NOT EXISTS u1@localhost IDENTIFIED BY 'pw2';
-SELECT password FROM mysql.user WHERE user='u1';
-
-CREATE OR REPLACE USER u1@localhost IDENTIFIED BY 'pw3';
-SELECT password FROM mysql.user WHERE user='u1';
-
---error ER_WRONG_USAGE
-CREATE OR REPLACE USER IF NOT EXISTS u1@localhost IDENTIFIED BY 'pw4';
-SELECT password FROM mysql.user WHERE user='u1';
-
-DROP USER IF EXISTS u1@localhost;
-DROP USER IF EXISTS u1@localhost;
-
---error ER_CANNOT_USER
-DROP USER u1@localhost;
-
-CREATE OR REPLACE USER u1@localhost;
-
---error ER_CANNOT_USER
-CREATE USER u1@localhost;
-
-DROP USER u1@localhost;
-
-CREATE USER u1;
-
---error ER_CANNOT_USER
-CREATE USER u1, u2;
-
---error ER_CANNOT_USER
-CREATE USER u2;
-
---error ER_PASSWD_LENGTH
-CREATE OR REPLACE USER u1 IDENTIFIED BY PASSWORD 'password', u2;
-
-CREATE OR REPLACE USER u1 IDENTIFIED BY PASSWORD 'abcdefghijklmnop', u2;
-
-DROP USER u1;
-DROP USER IF EXISTS u1, u2;
-
---error ER_CANNOT_USER
-DROP USER u2;
diff --git a/mysql-test/t/create_drop_view.test b/mysql-test/t/create_drop_view.test
deleted file mode 100644
index 5f5df43a7e0..00000000000
--- a/mysql-test/t/create_drop_view.test
+++ /dev/null
@@ -1,27 +0,0 @@
-CREATE TABLE t1(id INT);
-CREATE VIEW IF NOT EXISTS v1 AS SELECT * FROM t1 WHERE id>10;
-INSERT INTO t1 VALUES (5), (8), (10), (20), (30);
-SELECT * FROM t1;
-SELECT * FROM v1;
-
---error ER_TABLE_EXISTS_ERROR
-CREATE VIEW v1 AS SELECT * FROM t1 WHERE id>11;
-SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME='v1';
-
-CREATE VIEW IF NOT EXISTS v1 AS SELECT * FROM t1 WHERE id>12;
-SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME='v1';
-
---error ER_WRONG_USAGE
-CREATE OR REPLACE VIEW IF NOT EXISTS v1 AS SELECT * FROM t1 WHERE id>13;
-SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME='v1';
-
-CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1 WHERE id>14;
-SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME='v1';
-
-INSERT INTO t1 VALUES (50), (80), (3), (2), (40);
-SELECT * FROM t1;
-SELECT * FROM v1;
-
-DROP VIEW IF EXISTS v1;
-DROP VIEW IF EXISTS v1;
-DROP TABLE t1;
diff --git a/mysql-test/t/create_not_windows.test b/mysql-test/t/create_not_windows.test
deleted file mode 100644
index b612e31e3aa..00000000000
--- a/mysql-test/t/create_not_windows.test
+++ /dev/null
@@ -1,43 +0,0 @@
-# Non-windows specific create tests.
-
---source include/not_windows.inc
-
-#
-# Bug#19479:mysqldump creates invalid dump
-#
---disable_warnings
-drop table if exists `about:text`;
---enable_warnings
-create table `about:text` (
-_id int not null auto_increment,
-`about:text` varchar(255) not null default '',
-primary key (_id)
-);
-
-show create table `about:text`;
-drop table `about:text`;
-
-
-# End of 5.0 tests
-
-#
-# Bug#16532:mysql server assert in debug if table det is removed
-#
-use test;
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1(a int) engine=myisam;
-insert into t1 values(1);
-let $MYSQLD_DATADIR= `select @@datadir`;
-remove_file $MYSQLD_DATADIR/test/t1.frm;
---echo "We get an error because the table is in the definition cache"
---error ER_TABLE_EXISTS_ERROR
-create table t1(a int, b int);
---echo "Flush the cache and recreate the table anew to be able to drop it"
-flush tables;
-show open tables like "t%";
-create table t1(a int, b int, c int);
---echo "Try to select from the table. This should not crash the server"
-select count(a) from t1;
-drop table t1;
diff --git a/mysql-test/t/create_or_replace-master.opt b/mysql-test/t/create_or_replace-master.opt
deleted file mode 100644
index e94228f2f33..00000000000
--- a/mysql-test/t/create_or_replace-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---log-output=TABLE,FILE --general-log=1 --slow-query-log=1
diff --git a/mysql-test/t/create_or_replace.test b/mysql-test/t/create_or_replace.test
deleted file mode 100644
index 4ef4189694b..00000000000
--- a/mysql-test/t/create_or_replace.test
+++ /dev/null
@@ -1,422 +0,0 @@
-#
-# Check CREATE OR REPLACE TABLE
-#
-
---source include/have_innodb.inc
---source include/have_metadata_lock_info.inc
---disable_warnings
-drop table if exists t1,t2,t3;
---enable_warnings
-
-#
-# Create help table
-#
-
-CREATE TABLE t2 (a int);
-INSERT INTO t2 VALUES(1),(2),(3);
-
---echo #
---echo # Check first syntax and wrong usage
---echo #
-
---error ER_WRONG_USAGE
-CREATE OR REPLACE TABLE IF NOT EXISTS t1 (a int);
-
-# check that we don't try to create a log table in use
---error ER_BAD_LOG_STATEMENT
-create or replace table mysql.general_log (a int);
---error ER_BAD_LOG_STATEMENT
-create or replace table mysql.slow_log (a int);
-
---echo #
---echo # Usage when table doesn't exist
---echo #
-
-CREATE OR REPLACE TABLE t1 (a int);
---error ER_TABLE_EXISTS_ERROR
-CREATE TABLE t1 (a int);
-DROP TABLE t1;
-CREATE OR REPLACE TEMPORARY TABLE t1 (a int);
---error ER_TABLE_EXISTS_ERROR
-CREATE TEMPORARY TABLE t1 (a int, b int, c int);
-DROP TEMPORARY TABLE t1;
-
---echo #
---echo # Testing with temporary tables
---echo #
-
-CREATE OR REPLACE TABLE t1 (a int);
-CREATE OR REPLACE TEMPORARY TABLE t1 (a int);
-CREATE OR REPLACE TEMPORARY TABLE t1 (a int, b int);
-SHOW CREATE TABLE t1;
-DROP TEMPORARY TABLE t1;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-# Test also with InnoDB
-create temporary table t1 (i int) engine=InnoDB;
-create or replace temporary table t1 (a int, b int) engine=InnoDB;
-create or replace temporary table t1 (j int);
-show create table t1;
-drop table t1;
-
-# Using lock tables on normal tables with create or replace on temp tables
-CREATE OR REPLACE TABLE t1 (a int);
-LOCK TABLES t1 write;
-CREATE OR REPLACE TEMPORARY TABLE t1 (a int);
-CREATE OR REPLACE TEMPORARY TABLE t1 (a int, b int);
-CREATE OR REPLACE TEMPORARY TABLE t1 (a int, b int) engine= innodb;
-CREATE OR REPLACE TEMPORARY TABLE t1 (a int) engine= innodb;
-CREATE OR REPLACE TEMPORARY TABLE t1 (a int, b int) engine=myisam;
-SHOW CREATE TABLE t1;
-DROP TEMPORARY TABLE t1;
-SHOW CREATE TABLE t1;
-# Verify that table is still locked
---error ER_TABLE_NOT_LOCKED
-CREATE OR REPLACE TABLE t2 (a int);
-DROP TABLE t1;
-UNLOCK TABLES;
-
-#
-# Using CREATE SELECT
-#
-
-CREATE OR REPLACE TEMPORARY TABLE t1 (a int) SELECT * from t2;
-SELECT * FROM t1;
-CREATE OR REPLACE TEMPORARY TABLE t1 (b int) SELECT * from t2;
-SELECT * FROM t1;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-CREATE TEMPORARY TABLE t1 AS SELECT a FROM t2;
-CREATE TEMPORARY TABLE IF NOT EXISTS t1(a int, b int) SELECT 1,2 FROM t2;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a int);
-CREATE OR REPLACE TABLE t1 AS SELECT 1;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-create table t1 (a int);
---error ER_UPDATE_TABLE_USED
-create or replace table t1 as select * from t1;
---error ER_UPDATE_TABLE_USED
-create or replace table t1 as select a from (select a from t1) as t3;
---error ER_UPDATE_TABLE_USED
-create or replace table t1 as select a from t2 where t2.a in (select a from t1);
-drop table t1;
-
---echo #
---echo # Testing with normal tables
---echo #
-
-CREATE OR REPLACE TABLE t1 (a int);
-CREATE OR REPLACE TABLE t1 (a int, b int);
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a int) SELECT * from t2;
-SELECT * FROM t1;
-TRUNCATE TABLE t1;
-CREATE TABLE IF NOT EXISTS t1 (a int) SELECT * from t2;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (i int);
-CREATE OR REPLACE TABLE t1 AS SELECT 1;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-# Using lock tables with CREATE OR REPLACE
-CREATE OR REPLACE TABLE t1 (a int);
-LOCK TABLES t1 write,t2 write;
-CREATE OR REPLACE TABLE t1 (a int, b int);
-# Verify if table is still locked
-SELECT * FROM t1;
-INSERT INTO t1 values(1,1);
-CREATE OR REPLACE TABLE t1 (a int, b int, c int);
-INSERT INTO t1 values(1,1,1);
---error ER_TABLE_NOT_LOCKED
-CREATE OR REPLACE TABLE t3 (a int);
-UNLOCK TABLES;
-DROP TABLE t1;
-
-# Using lock tables with CREATE OR REPLACE ... SELECT
-CREATE OR REPLACE TABLE t1 (a int);
-LOCK TABLES t1 write,t2 write;
-CREATE OR REPLACE TABLE t1 (a int, b int) select a,1 from t2;
-# Verify if table is still locked
-SELECT * FROM t2;
-SELECT * FROM t1;
-SELECT * FROM t1;
-INSERT INTO t1 values(1,1,1);
-CREATE OR REPLACE TABLE t1 (a int, b int, c int, d int);
-INSERT INTO t1 values(1,1,1,1);
---error ER_TABLE_NOT_LOCKED
-CREATE OR REPLACE TABLE t3 (a int);
-UNLOCK TABLES;
-DROP TABLE t1;
-
-CREATE OR REPLACE TABLE t1 (a int);
-LOCK TABLES t1 write,t2 write, t1 as t1_read read;
-CREATE OR REPLACE TABLE t1 (a int, b int) select a,1 from t2;
-SELECT * FROM t1;
-SELECT * FROM t2;
---error ER_TABLE_NOT_LOCKED
-SELECT * FROM t1 as t1_read;
-DROP TABLE t1;
-UNLOCK TABLES;
-
-CREATE OR REPLACE TABLE t1 (a int);
-LOCK TABLE t1 WRITE;
-CREATE OR REPLACE TABLE t1 AS SELECT 1;
-SELECT * from t1;
---error ER_TABLE_NOT_LOCKED
-SELECT * from t2;
-DROP TABLE t1;
-
---echo #
---echo # Test also with InnoDB (transactional engine)
---echo #
-
-create table t1 (i int) engine=innodb;
-lock table t1 write;
-create or replace table t1 (j int);
-unlock tables;
-show create table t1;
-drop table t1;
-
-create table t1 (i int) engine=InnoDB;
-lock table t1 write, t2 write;
-create or replace table t1 (j int) engine=innodb;
-unlock tables;
-drop table t1;
-
-create table t1 (i int) engine=InnoDB;
-create table t3 (i int) engine=InnoDB;
-insert into t3 values(1),(2),(3);
-create table t4 (i int) engine=InnoDB;
-insert into t4 values(1);
-lock table t1 write, t2 write, t3 write, t4 write;
-create or replace table t1 (a int, i int) engine=innodb select t2.a,t3.i from t2,t3;
-select * from t4;
-unlock tables;
-select * from t1 order by a,i;
-drop table t1,t3,t4;
-
---echo #
---echo # Test the meta data locks are freed properly
---echo #
-
-create database mysqltest2;
-
-drop table if exists test.t1,mysqltest2.t2;
-create table test.t1 (i int);
-create table mysqltest2.t2 like test.t1;
-lock table test.t1 write, mysqltest2.t2 write;
---replace_column 1 #
---sorted_result
-select * from information_schema.metadata_lock_info;
---error ER_TABLE_MUST_HAVE_COLUMNS
-create or replace table test.t1;
-show tables;
---replace_column 1 #
---sorted_result
-select * from information_schema.metadata_lock_info;
---error ER_TABLE_MUST_HAVE_COLUMNS
-create or replace table mysqltest2.t2;
---replace_column 1 #
---sorted_result
-select * from information_schema.metadata_lock_info;
-create table t1 (i int);
-drop table t1;
-
-create table test.t1 (i int);
-create table mysqltest2.t2 like test.t1;
-lock table test.t1 write, mysqltest2.t2 write;
---replace_column 1 #
---sorted_result
-select * from information_schema.metadata_lock_info;
---error ER_DUP_FIELDNAME
-create or replace table test.t1 (a int) select 1 as 'a', 2 as 'a';
-show tables;
---replace_column 1 #
---sorted_result
-select * from information_schema.metadata_lock_info;
---error ER_DUP_FIELDNAME
-create or replace table mysqltest2.t2 (a int) select 1 as 'a', 2 as 'a';
---replace_column 1 #
---sorted_result
-select * from information_schema.metadata_lock_info;
-create table t1 (i int);
-drop table t1;
-drop database mysqltest2;
-
---echo #
---echo # Testing CREATE .. LIKE
---echo #
-
-create or replace table t1 like t2;
-create or replace table t1 like t2;
-show create table t1;
-drop table t1;
-create table t1 (b int);
-lock tables t1 write, t2 read;
-create or replace table t1 like t2;
-SELECT * FROM t1;
-INSERT INTO t1 values(1);
-CREATE OR REPLACE TABLE t1 like t2;
-INSERT INTO t1 values(2);
-unlock tables;
-show create table t1;
-drop table t1;
-
-create or replace table t1 like t2;
---error ER_NONUNIQ_TABLE
-create or replace table t1 like t1;
-drop table t1;
-
-CREATE TEMPORARY TABLE t1 like t2;
---error ER_NONUNIQ_TABLE
-CREATE OR REPLACE TABLE t1 like t1;
---error ER_NONUNIQ_TABLE
-CREATE OR REPLACE TABLE t1 like t1;
-drop table t1;
-
-CREATE TEMPORARY TABLE t1 like t2;
-CREATE OR REPLACE TEMPORARY TABLE t3 like t1;
---error ER_NONUNIQ_TABLE
-CREATE OR REPLACE TEMPORARY TABLE t3 like t3;
-drop table t1,t3;
-
---echo #
---echo # Test with prepared statements
---echo #
-
-prepare stmt1 from 'create or replace table t1 select * from t2';
-execute stmt1;
-select * from t1;
-execute stmt1;
-select * from t1;
-drop table t1;
-execute stmt1;
-select * from t1;
-deallocate prepare stmt1;
-drop table t1;
-
---echo #
---echo # Test with views
---echo #
-
-create view t1 as select 1;
-create table if not exists t1 (a int);
---error ER_IT_IS_A_VIEW
-create or replace table t1 (a int);
---error ER_IT_IS_A_VIEW
-drop table t1;
-drop view t1;
-
---echo #
---echo # MDEV-5602 CREATE OR REPLACE obtains stricter locks than the
---echo # connection had before
---echo #
-
-create table t1 (a int);
-lock table t1 write, t2 read;
---replace_column 1 #
---sorted_result
-select * from information_schema.metadata_lock_info;
-create or replace table t1 (i int);
---replace_column 1 #
---sorted_result
-select * from information_schema.metadata_lock_info;
-create or replace table t1 like t2;
---replace_column 1 #
---sorted_result
-select * from information_schema.metadata_lock_info;
-create or replace table t1 select 1 as f1;
---replace_column 1 #
---sorted_result
-select * from information_schema.metadata_lock_info;
-drop table t1;
-unlock tables;
-
---echo #
---echo # MDEV-6560
---echo # Assertion `! is_set() ' failed in Diagnostics_area::set_ok_status
---echo #
-
-CREATE TABLE t1 (col_int_nokey INT) ENGINE=InnoDB;
-
-CREATE OR REPLACE TEMPORARY TABLE tmp LIKE t1;
-LOCK TABLE t1 WRITE;
-
---connect (con1,localhost,root,,test)
---let $con_id = `SELECT CONNECTION_ID()`
---send CREATE OR REPLACE TABLE t1 LIKE tmp
---connection default
-let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state= 'Waiting for table metadata lock';
---source include/wait_condition.inc
---replace_result $con_id con_id
---eval KILL QUERY $con_id
-
---connection con1
---error ER_QUERY_INTERRUPTED
---reap
---send CREATE OR REPLACE TABLE t1 (a int)
-
---connection default
-let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state= 'Waiting for table metadata lock';
---source include/wait_condition.inc
---replace_result $con_id con_id
---eval KILL QUERY $con_id
-
---connection con1
---error ER_QUERY_INTERRUPTED
---reap
---disconnect con1
---connection default
-
-drop table t1;
-
-#
-# Cleanup
-#
-DROP TABLE t2;
-
---echo #
---echo # MDEV-10824 - Crash in CREATE OR REPLACE TABLE t1 AS SELECT spfunc()
---echo #
-CREATE TABLE t1(a INT);
-CREATE FUNCTION f1() RETURNS VARCHAR(16383) RETURN 'test';
-CREATE OR REPLACE TABLE t1 AS SELECT f1();
-LOCK TABLE t1 WRITE;
-CREATE OR REPLACE TABLE t1 AS SELECT f1();
-UNLOCK TABLES;
-DROP FUNCTION f1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-11071 - Assertion `thd->transaction.stmt.is_empty()' failed in
---echo # Locked_tables_list::unlock_locked_tables
---echo #
-CREATE TEMPORARY TABLE t1(a INT) ENGINE=InnoDB;
-CREATE TEMPORARY TABLE t2(a INT);
-CREATE TABLE t3(a INT);
-LOCK TABLE t2 WRITE;
-SELECT * FROM t2;
-# drops t2
---error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE
-CREATE OR REPLACE TEMPORARY TABLE t1(a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
-# make sure we didn't leave locked tables mode
---error ER_TABLE_NOT_LOCKED
-SELECT * FROM t3;
-# drops t1
---error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE
-CREATE OR REPLACE TEMPORARY TABLE t2(a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
-# make sure we didn't leave locked tables mode
---error ER_TABLE_NOT_LOCKED
-SELECT * FROM t3;
-UNLOCK TABLES;
-DROP TABLE t3;
diff --git a/mysql-test/t/create_or_replace2.test b/mysql-test/t/create_or_replace2.test
deleted file mode 100644
index 199e5523811..00000000000
--- a/mysql-test/t/create_or_replace2.test
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# Check CREATE OR REPLACE TABLE for test that requires DEBUG
-#
-
---source include/have_debug.inc
---source include/have_binlog_format_row.inc
---source include/have_innodb.inc
---source include/master-slave.inc
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-SET @old_debug= @@session.debug;
-
-#
-# MDEV-5854
-# Interrupted CREATE OR REPLACE is written into binlog, and in a wrong format
-#
-
-CREATE TABLE t1 (i INT, KEY(i)) ENGINE=InnoDB;
-CREATE OR REPLACE TEMPORARY TABLE tmp (a int, b int, key(a)) engine=myisam;
-set debug_dbug='+d,send_kill_after_delete';
-CREATE OR REPLACE TABLE t1 LIKE tmp;
-set debug_dbug=@old_debug;
-SHOW TABLES;
-show create table t1;
---sync_slave_with_master
-SHOW TABLES;
---connection master
-
---disable_warnings
-drop temporary table if exists tmp;
---enable_warnings
-drop table t1;
---source include/rpl_end.inc
diff --git a/mysql-test/t/create_or_replace_permission.test b/mysql-test/t/create_or_replace_permission.test
deleted file mode 100644
index 0e833a125bd..00000000000
--- a/mysql-test/t/create_or_replace_permission.test
+++ /dev/null
@@ -1,71 +0,0 @@
---source include/have_udf.inc
-# Grant tests not performed with embedded server
--- source include/not_embedded.inc
-
-set local sql_mode="";
-set global sql_mode="";
---echo #
---echo # Tests for checking permission denied on CREATE OR REPLACE if DROP
---echo # access is revoked
---echo #
-
---echo # These statements do not need special tests for CREATE OR REPLACE,
---echo # because they do not have separate permissions for create and drop:
---echo # CREATE OR REPLACE EVENT (uses EVENT_ACL for both CREATE and DROP)
---echo # CREATE OR DROP SERVER (uses SUPER_ALC for both CREATE and DROP)
---echo # CREATE OR DROP TRIGGER (uses TRIGGER_ACL for both CREATE and DROP)
-
-SELECT CURRENT_USER;
-CREATE DATABASE db1;
-GRANT ALL ON db1.* TO mysqltest_1@localhost;
-REVOKE DROP ON db1.* FROM mysqltest_1@localhost;
-REVOKE ALTER ROUTINE ON db1.* FROM mysqltest_1@localhost;
-GRANT DELETE ON mysql.* TO mysqltest_1@localhost;
-REVOKE DELETE ON mysql.* FROM mysqltest_1@localhost;
-FLUSH PRIVILEGES;
-
-connect (user_a, localhost, mysqltest_1,,);
-connection user_a;
-SELECT CURRENT_USER;
-
-# mysqltest_1 has CREATE privilege on db1
---error ER_DB_CREATE_EXISTS
-CREATE DATABASE db1;
-
-# mysqltest_1 has no DROP privilege on db1
---error ER_DBACCESS_DENIED_ERROR
-CREATE OR REPLACE DATABASE db1;
-
-# mysqltest_1 has no any privileges on db2
---error ER_DBACCESS_DENIED_ERROR
-CREATE OR REPLACE DATABASE db2;
-
-USE db1;
---error ER_TABLEACCESS_DENIED_ERROR
-CREATE OR REPLACE TABLE t1(id INT);
-
---error ER_PROCACCESS_DENIED_ERROR
-CREATE OR REPLACE PROCEDURE proc1 (OUT cnt INT) BEGIN END;
-
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
---error ER_DBACCESS_DENIED_ERROR
-eval CREATE OR REPLACE FUNCTION lookup RETURNS STRING SONAME "$UDF_EXAMPLE_SO";
-
---error ER_PROCACCESS_DENIED_ERROR
-CREATE OR REPLACE FUNCTION hello(str char(20)) RETURNS TEXT RETURN CONCAT('Hello, ', str, '!');
-
---error ER_SPECIFIC_ACCESS_DENIED_ERROR
-CREATE OR REPLACE USER u1@localhost;
-
---error ER_SPECIFIC_ACCESS_DENIED_ERROR
-CREATE OR REPLACE ROLE developer;
-
-connection default;
-SELECT CURRENT_USER;
-REVOKE ALL ON db1.* FROM mysqltest_1@localhost;
-DROP DATABASE IF EXISTS db2;
-DROP DATABASE db1;
-DROP USER mysqltest_1@localhost;
-
-
-set global sql_mode=default;
diff --git a/mysql-test/t/create_select_tmp.test b/mysql-test/t/create_select_tmp.test
deleted file mode 100644
index ef3315aed97..00000000000
--- a/mysql-test/t/create_select_tmp.test
+++ /dev/null
@@ -1,39 +0,0 @@
-# Testcase for BUG#4551
-# The bug was that when the table was TEMPORARY, it was not deleted if
-# the CREATE SELECT failed (the code intended too, but it actually
-# didn't). And as the CREATE TEMPORARY TABLE was not written to the
-# binlog if it was a transactional table, it resulted in an
-# inconsistency between binlog and the internal list of temp tables.
-
-# This does not work for RBR yet.
---source include/have_binlog_format_mixed_or_statement.inc
-
---disable_query_log
-CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
---enable_query_log
-
--- source include/have_innodb.inc
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-CREATE TABLE t1 ( a int );
-INSERT INTO t1 VALUES (1),(2),(1);
---error ER_DUP_ENTRY
-CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
---error 1146
-select * from t2;
---error ER_DUP_ENTRY
-CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
---error 1146
-select * from t2;
---error ER_DUP_ENTRY
-CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
---error 1146
-select * from t2;
---error ER_DUP_ENTRY
-CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
---error 1146
-select * from t2;
-drop table t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/create_user.test b/mysql-test/t/create_user.test
deleted file mode 100644
index f04cb3e302a..00000000000
--- a/mysql-test/t/create_user.test
+++ /dev/null
@@ -1,58 +0,0 @@
---source include/not_embedded.inc
-
-create user foo;
-select * from mysql.user where user = 'foo';
-drop user foo;
-
-create user foo identified by 'password';
-select * from mysql.user where user = 'foo';
-drop user foo;
-
-create user foo identified by 'password' require SSL;
-select * from mysql.user where user = 'foo';
-drop user foo;
-
-create user foo identified by 'password' require X509;
-select * from mysql.user where user = 'foo';
-drop user foo;
-
-create user foo identified by 'password' require CIPHER 'cipher';
-select * from mysql.user where user = 'foo';
-drop user foo;
-
-create user foo identified by 'password' require ISSUER 'issuer';
-select * from mysql.user where user = 'foo';
-drop user foo;
-
-create user foo identified by 'password' require SUBJECT 'subject';
-select * from mysql.user where user = 'foo';
-drop user foo;
-
-create user foo identified by 'password' require CIPHER 'cipher'
- SUBJECT 'subject';
-select * from mysql.user where user = 'foo';
-drop user foo;
-
-create user foo identified by 'password' require CIPHER 'cipher'
- AND SUBJECT 'subject'
- AND ISSUER 'issuer';
-select * from mysql.user where user = 'foo';
-drop user foo;
-
-create user foo, foo2 identified by 'password' require CIPHER 'cipher'
- AND SUBJECT 'subject'
- AND ISSUER 'issuer';
-select * from mysql.user where user like 'foo';
-
---echo #--warning ER_USER_CREATE_EXISTS
-create user if not exists foo, foo2 identified by 'password2'
- require CIPHER 'cipher2' AND SUBJECT 'subject2' AND ISSUER 'issuer2';
-select * from mysql.user where user like 'foo';
-drop user foo, foo2;
-
-create user foo with MAX_QUERIES_PER_HOUR 10
- MAX_UPDATES_PER_HOUR 20
- MAX_CONNECTIONS_PER_HOUR 30
- MAX_USER_CONNECTIONS 40;
-select * from mysql.user where user like 'foo';
-drop user foo;
diff --git a/mysql-test/t/create_w_max_indexes_128.test b/mysql-test/t/create_w_max_indexes_128.test
deleted file mode 100644
index 46aa3c3b671..00000000000
--- a/mysql-test/t/create_w_max_indexes_128.test
+++ /dev/null
@@ -1,571 +0,0 @@
---source include/no_valgrind_without_big.inc
---source include/have_max_indexes_128.inc
-
-create table t1 (
- c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, c8 int,
- c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int,
-
- key a001_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a002_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a003_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a004_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a005_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a006_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a007_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a008_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a009_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- key a010_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a011_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a012_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a013_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a014_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a015_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a016_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a017_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a018_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a019_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- key a020_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a021_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a022_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a023_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a024_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a025_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a026_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a027_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a028_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a029_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- key a030_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a031_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a032_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a033_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a034_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a035_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a036_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a037_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a038_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a039_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- key a040_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a041_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a042_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a043_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a044_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a045_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a046_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a047_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a048_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a049_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- key a050_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a051_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a052_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a053_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a054_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a055_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a056_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a057_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a058_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a059_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- key a060_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a061_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a062_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a063_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a064_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a065_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a066_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a067_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a068_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a069_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- key a070_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a071_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a072_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a073_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a074_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a075_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a076_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a077_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a078_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a079_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- key a080_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a081_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a082_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a083_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a084_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a085_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a086_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a087_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a088_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a089_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- key a090_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a091_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a092_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a093_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a094_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a095_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a096_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a097_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a098_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a099_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- key a100_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a101_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a102_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a103_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a104_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a105_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a106_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a107_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a108_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a109_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- key a110_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a111_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a112_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a113_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a114_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a115_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a116_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a117_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a118_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a119_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- key a120_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a121_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a122_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a123_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a124_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a125_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a126_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a127_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a128_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16)
-);
-
-# Check that the table is not corrupted
-show create table t1;
-flush tables;
-show create table t1;
-
-# Repeat test using ALTER to add indexes
-
-drop table t1;
-create table t1 (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int,
-c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int);
-
-alter table t1
-
- add key a001_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a002_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a003_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a004_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a005_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a006_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a007_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a008_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a009_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- add key a010_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a011_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a012_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a013_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a014_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a015_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a016_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a017_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a018_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a019_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- add key a020_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a021_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a022_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a023_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a024_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a025_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a026_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a027_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a028_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a029_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- add key a030_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a031_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a032_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a033_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a034_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a035_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a036_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a037_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a038_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a039_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- add key a040_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a041_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a042_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a043_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a044_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a045_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a046_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a047_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a048_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a049_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- add key a050_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a051_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a052_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a053_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a054_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a055_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a056_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a057_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a058_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a059_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- add key a060_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a061_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a062_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a063_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a064_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a065_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a066_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a067_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a068_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a069_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- add key a070_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a071_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a072_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a073_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a074_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a075_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a076_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a077_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a078_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a079_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- add key a080_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a081_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a082_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a083_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a084_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a085_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a086_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a087_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a088_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a089_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- add key a090_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a091_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a092_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a093_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a094_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a095_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a096_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a097_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a098_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a099_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- add key a100_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a101_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a102_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a103_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a104_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a105_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a106_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a107_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a108_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a109_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- add key a110_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a111_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a112_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a113_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a114_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a115_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a116_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a117_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a118_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a119_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- add key a120_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a121_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a122_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a123_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a124_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a125_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a126_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a127_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a128_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16);
-
-show create table t1;
-flush tables;
-show create table t1;
-
---error ER_TOO_MANY_KEYS
-alter table t1 add key
- a129_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16);
-
-drop table t1;
-
---echo "End of tests"
diff --git a/mysql-test/t/create_w_max_indexes_64.test b/mysql-test/t/create_w_max_indexes_64.test
deleted file mode 100644
index 6e614ecf2e5..00000000000
--- a/mysql-test/t/create_w_max_indexes_64.test
+++ /dev/null
@@ -1,334 +0,0 @@
---source include/no_valgrind_without_big.inc
---source include/have_max_indexes_64.inc
-#
-# Bug #26642: create index corrupts table definition in .frm
-#
-# Problem with creating keys with maximum key-parts and maximum name length
-# This test is made for a mysql server supporting names up to 64 bytes
-# and a maximum of 16 key segements per Key
-#
-
-create table t1 (
- c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, c8 int,
- c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int,
-
- key a001_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a002_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a003_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a004_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a005_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a006_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a007_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a008_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a009_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- key a010_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a011_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a012_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a013_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a014_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a015_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a016_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a017_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a018_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a019_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- key a020_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a021_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a022_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a023_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a024_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a025_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a026_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a027_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a028_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a029_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- key a030_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a031_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a032_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a033_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a034_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a035_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a036_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a037_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a038_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a039_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- key a040_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a041_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a042_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a043_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a044_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a045_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a046_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a047_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a048_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a049_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- key a050_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a051_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a052_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a053_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a054_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a055_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a056_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a057_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a058_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a059_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- key a060_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a061_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a062_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a063_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- key a064_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16)
-);
-
-# Check that the table is not corrupted
-show create table t1;
-flush tables;
-show create table t1;
-
-# Repeat test using ALTER to add indexes
-
-drop table t1;
-create table t1 (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int,
-c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int);
-
-alter table t1
-
- add key a001_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a002_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a003_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a004_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a005_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a006_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a007_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a008_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a009_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- add key a010_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a011_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a012_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a013_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a014_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a015_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a016_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a017_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a018_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a019_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- add key a020_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a021_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a022_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a023_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a024_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a025_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a026_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a027_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a028_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a029_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- add key a030_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a031_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a032_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a033_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a034_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a035_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a036_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a037_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a038_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a039_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- add key a040_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a041_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a042_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a043_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a044_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a045_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a046_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a047_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a048_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a049_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- add key a050_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a051_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a052_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a053_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a054_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a055_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a056_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a057_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a058_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a059_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
-
- add key a060_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a061_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a062_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a063_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
- add key a064_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16);
-
-show create table t1;
-flush tables;
-show create table t1;
-
-# Test the server limits; if any of these pass, all above tests need
-# to be rewritten to hit the limit
-#
-# Ensure limit is really 64 keys
---error 1069
-alter table t1 add key
- a065_long_123456789_123456789_123456789_123456789_123456789_1234 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16);
-
-drop table t1;
-
-# Ensure limit is really 16 key parts per key
-
-create table t1 (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int,
-c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int,
-c16 int, c17 int, c18 int,c19 int,c20 int,c21 int,c22 int,c23 int,c24 int,c25 int,c26 int,c27 int,c28 int,c29 int,c30 int,c31 int,c32 int, c33 int);
-
-# Get error for max key parts
---error 1070
-alter table t1 add key i1 (
- c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16, c17,c18,c19,c20,c21,c22,c23,c24,c25,c26,c27,c28,c29,c30,c31,c32,c33);
-
-# Get error for max key-name length
---error 1059
-alter table t1 add key
- a001_long_123456789_123456789_123456789_123456789_123456789_12345 (c1);
-
-show create table t1;
-
-drop table t1;
-
---echo "End of tests"
diff --git a/mysql-test/t/cte_grant.test b/mysql-test/t/cte_grant.test
deleted file mode 100644
index c6627c05829..00000000000
--- a/mysql-test/t/cte_grant.test
+++ /dev/null
@@ -1,130 +0,0 @@
-# Can't test with embedded server
--- source include/not_embedded.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-connect (root,localhost,root,,test);
-connection root;
-
---disable_warnings
-create database mysqltest;
---enable_warnings
-
-create user mysqltest_1@localhost;
-connect (user1,localhost,mysqltest_1,,test);
-connection user1;
-
-connection root;
-
-create table mysqltest.t1 (a int, b int);
-insert into mysqltest.t1 values (2,10), (1,30);
-create table mysqltest.t2 (c int, d char(32));
-insert into mysqltest.t2 values (1,'xxx'), (1,'zzz');
-
-grant select on mysqltest.t1 to mysqltest_1@localhost;
-grant select (c) on mysqltest.t2 to mysqltest_1@localhost;
-
-connection user1;
-with t as (select c from mysqltest.t2 where c < 2)
-select t.c,t1.b from t,mysqltest.t1 where t.c=t1.a;
---error ER_COLUMNACCESS_DENIED_ERROR
-select t.c,t.d,t1.b
-from (select c,d from mysqltest.t2 where c < 2) as t, mysqltest.t1
-where t.c=t1.a;
---error ER_COLUMNACCESS_DENIED_ERROR
-with t as (select c,d from mysqltest.t2 where c < 2)
-select t.c,t.d,t1.b from t,mysqltest.t1 where t.c=t1.a;
-
-connection root;
-
-create view mysqltest.v1(f1,f2) as
-with t as (select c from mysqltest.t2 where c < 2)
-select t.c,t1.b from t,mysqltest.t1 where t.c=t1.a;
-create view mysqltest.v2(c,d) as
-with t as (select a from mysqltest.t1 where a>=3)
-select t.a,b from t,mysqltest.t1 where mysqltest.t1.a = t.a;
-
-grant select on mysqltest.v1 to mysqltest_1@localhost;
-grant select (c) on mysqltest.v2 to mysqltest_1@localhost;
-grant create view on mysqltest.* to mysqltest_1@localhost;
-
-connection user1;
-
-create view mysqltest.v3(c,d) as
-with t as (select c from mysqltest.t2 where c < 2)
-select t.c,t1.b from t,mysqltest.t1 where t.c=t1.a;
---error ER_COLUMNACCESS_DENIED_ERROR
-create view mysqltest.v4(f1,f2,f3) as
-with t as (select c,d from mysqltest.t2 where c < 2)
-select t.c,t.d,t1.b from t,mysqltest.t1 where t.c=t1.a;
-
-select * from mysqltest.v1;
-
-select c from mysqltest.v2;
-# there are no privileges on column 'd'
---error ER_COLUMNACCESS_DENIED_ERROR
-select d from mysqltest.v2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-select * from mysqltest.v3;
-connection root;
-grant select on mysqltest.v3 to mysqltest_1@localhost;
-connection user1;
-select * from mysqltest.v3;
-
-connection root;
-revoke all privileges on mysqltest.v1 from mysqltest_1@localhost;
-drop user mysqltest_1@localhost;
-drop database mysqltest;
-
---echo #
---echo # MDEV-13453: privileges checking for CTE
---echo #
-
-create database db;
-use db;
-create table t1 (i int);
-insert into t1
- values (3), (7), (1), (4), (2), (3), (1);
-
-create table t2 (a int, b int);
-insert into t2
- values (3,10), (7,11), (1,17), (4,15), (2,11), (3,10), (1,15);
-
-create user foo@localhost;
-grant SELECT on db.t1 to foo@localhost;
-grant SELECT(a) on db.t2 to foo@localhost;
-
---connect (con1,localhost,foo,,)
-use db;
-with cte as (select * from t1 where i < 4)
- select * from cte;
-with cte as (select * from t1 where i < 4 group by i)
- select * from cte;
-with cte as (select * from t1 where i < 4)
- select * from cte cte1 where i < 2 union select * from cte cte2 where i > 2;
-with cte as (select * from t1 where i < 4 group by i)
- select * from cte cte1 where i < 2 union select * from cte cte2 where i > 2;
-
---error ER_COLUMNACCESS_DENIED_ERROR
-with cte as (select b from t2 where a < 4)
- select * from cte cte1 where b < 15 union select * from cte cte2 where b > 15;
-with cte as (select a from t2 where a < 4)
- select * from cte cte1 where a < 2 union select * from cte cte2 where a > 2;
-
---connection default
-revoke SELECT on db.t1 from foo@localhost;
-
---connection con1
-
---error ER_TABLEACCESS_DENIED_ERROR
-with cte as (select * from t1 where i < 4)
- select * from cte;
-
-# Cleanup
---disconnect con1
-
---connection default
-drop database db;
-drop user foo@localhost;
diff --git a/mysql-test/t/cte_nonrecursive.test b/mysql-test/t/cte_nonrecursive.test
deleted file mode 100644
index 5e1770496f6..00000000000
--- a/mysql-test/t/cte_nonrecursive.test
+++ /dev/null
@@ -1,1014 +0,0 @@
-create table t1 (a int, b varchar(32));
-insert into t1 values
- (4,'aaaa' ), (7,'bb'), (1,'ccc'), (4,'dd');
-insert into t1 values
- (3,'eee'), (7,'bb'), (1,'fff'), (4,'ggg');
-create table t2 (c int);
-insert into t2 values
- (2), (4), (5), (3);
-
---echo # select certain field in the specification of t
-with t as (select a from t1 where b >= 'c')
- select * from t2,t where t2.c=t.a;
-select * from t2, (select a from t1 where b >= 'c') as t
- where t2.c=t.a;
-explain
-with t as (select a from t1 where b >= 'c')
- select * from t2,t where t2.c=t.a;
-explain
-select * from t2, (select a from t1 where b >= 'c') as t
- where t2.c=t.a;
-
---echo # select '*' in the specification of t
-with t as (select * from t1 where b >= 'c')
- select * from t2,t where t2.c=t.a;
-select * from t2, (select * from t1 where b >= 'c') as t
- where t2.c=t.a;
-explain
-with t as (select * from t1 where b >= 'c')
- select * from t2,t where t2.c=t.a;
-explain
-select * from t2, (select * from t1 where b >= 'c') as t
- where t2.c=t.a;
-
---echo # rename fields returned by the specication when defining t
-with t(f1,f2) as (select * from t1 where b >= 'c')
- select * from t2,t where t2.c=t.f1;
-explain
-with t(f1,f2) as (select * from t1 where b >= 'c')
- select * from t2,t where t2.c=t.f1;
-
---echo # materialized query specifying t
-with t as (select a, count(*) from t1 where b >= 'c' group by a)
- select * from t2,t where t2.c=t.a;
-select * from t2, (select a, count(*) from t1 where b >= 'c' group by a) as t
- where t2.c=t.a;
-explain
-with t as (select a, count(*) from t1 where b >= 'c' group by a)
- select * from t2,t where t2.c=t.a;
-explain
-select * from t2, (select a, count(*) from t1 where b >= 'c' group by a) as t
- where t2.c=t.a;
-
---echo # specivication of t contains having
-with t as (select a, count(*) from t1 where b >= 'c'
- group by a having count(*)=1 )
- select * from t2,t where t2.c=t.a;
-select * from t2, (select a, count(*) from t1 where b >= 'c'
- group by a having count(*)=1) t
- where t2.c=t.a;
-
---echo # main query contains having
-with t as (select * from t2 where c <= 4)
- select a, count(*) from t1,t where t1.a=t.c group by a having count(*)=1;
-select a, count(*) from t1, (select * from t2 where c <= 4) t
- where t1.a=t.c group by a having count(*)=1;
-
---echo # main query contains group by + order by
-with t as (select * from t2 where c <= 4 )
- select a, count(*) from t1,t where t1.a=t.c group by a order by count(*);
-select a, count(*) from t1, (select * from t2 where c <= 4 ) t
- where t1.a=t.c group by a order by count(*);
-
---echo # main query contains group by + order by + limit
-with t as (select * from t2 where c <= 4 )
- select a, count(*) from t1,t
- where t1.a=t.c group by a order by count(*) desc limit 1;
-select a, count(*) from t1, (select * from t2 where c <= 4 ) t
- where t1.a=t.c group by a order by count(*) desc limit 1;
-
-
---echo # t is used in a subquery
-with t as (select a from t1 where a<5)
- select * from t2 where c in (select a from t);
-select * from t2
- where c in (select a from (select a from t1 where a<5) as t);
-explain
-with t as (select a from t1 where a<5)
- select * from t2 where c in (select a from t);
-explain
-select * from t2
- where c in (select a from (select a from t1 where a<5) as t);
-
---echo # materialized t is used in a subquery
-with t as (select count(*) as c from t1 where b >= 'c' group by a)
- select * from t2 where c in (select c from t);
-select * from t2
- where c in (select c from (select count(*) as c from t1
- where b >= 'c' group by a) as t);
-explain
-with t as (select count(*) as c from t1 where b >= 'c' group by a)
- select * from t2 where c in (select c from t);
-explain
-select * from t2
- where c in (select c from (select count(*) as c from t1
- where b >= 'c' group by a) as t);
-
---echo # two references to t specified by a query
---echo # selecting a field: both in main query
-with t as (select a from t1 where b >= 'c')
- select * from t as r1, t as r2 where r1.a=r2.a;
-select * from (select a from t1 where b >= 'c') as r1,
- (select a from t1 where b >= 'c') as r2
- where r1.a=r2.a;
-explain
-with t as (select a from t1 where b >= 'c')
- select * from t as r1, t as r2 where r1.a=r2.a;
-explain
-select * from (select a from t1 where b >= 'c') as r1,
- (select a from t1 where b >= 'c') as r2
- where r1.a=r2.a;
-
---echo # two references to materialized t: both in main query
-with t as (select distinct a from t1 where b >= 'c')
- select * from t as r1, t as r2 where r1.a=r2.a;
-select * from (select distinct a from t1 where b >= 'c') as r1,
- (select distinct a from t1 where b >= 'c') as r2
- where r1.a=r2.a;
-explain
-with t as (select distinct a from t1 where b >= 'c')
- select * from t as r1, t as r2 where r1.a=r2.a;
-explain
-select * from (select distinct a from t1 where b >= 'c') as r1,
- (select distinct a from t1 where b >= 'c') as r2
- where r1.a=r2.a;
-
---echo # two references to t specified by a query
---echo # selecting all fields: both in main query
-with t as (select * from t1 where b >= 'c')
- select * from t as r1, t as r2 where r1.a=r2.a;
-select * from (select * from t1 where b >= 'c') as r1,
- (select * from t1 where b >= 'c') as r2
- where r1.a=r2.a;
-explain
-with t as (select * from t1 where b >= 'c')
- select * from t as r1, t as r2 where r1.a=r2.a;
-explain
-select * from (select * from t1 where b >= 'c') as r1,
- (select * from t1 where b >= 'c') as r2
- where r1.a=r2.a;
-
---echo # two references to t specifying explicitly column names
-with t(c) as (select a from t1 where b >= 'c')
- select * from t r1, t r2 where r1.c=r2.c;
-
---echo # t two references of t used in different parts of a union
-with t as (select a from t1 where b >= 'c')
- select * from t where a < 2
- union
- select * from t where a >= 4;
-select * from (select a from t1 where b >= 'c') as t
- where t.a < 2
-union
-select * from (select a from t1 where b >= 'c') as t
- where t.a >= 4;
-explain
-with t as (select a from t1 where b >= 'c')
- select * from t where a < 2
- union
- select * from t where a >= 4;
-explain
-select * from (select a from t1 where b >= 'c') as t
- where t.a < 2
-union
-select * from (select a from t1 where b >= 'c') as t
- where t.a >= 4;
-
---echo # specification of t contains union
-with t as (select a from t1 where b >= 'f'
- union
- select c as a from t2 where c < 4)
- select * from t2,t where t2.c=t.a;
-select * from t2,
- (select a from t1 where b >= 'f'
- union
- select c as a from t2 where c < 4) as t
- where t2.c=t.a;
-explain
-with t as (select a from t1 where b >= 'f'
- union
- select c as a from t2 where c < 4)
- select * from t2,t where t2.c=t.a;
-explain
-select * from t2,
- (select a from t1 where b >= 'f'
- union
- select c as a from t2 where c < 4) as t
- where t2.c=t.a;
-
---echo # t is defined in the with clause of a subquery
-select t1.a,t1.b from t1,t2
- where t1.a>t2.c and
- t2.c in (with t as (select * from t1 where t1.a<5)
- select t2.c from t2,t where t2.c=t.a);
-select t1.a,t1.b from t1,t2
- where t1.a>t2.c and
- t2.c in (select t2.c
- from t2,(select * from t1 where t1.a<5) as t
- where t2.c=t.a);
-explain
-select t1.a,t1.b from t1,t2
- where t1.a>t2.c and
- t2.c in (with t as (select * from t1 where t1.a<5)
- select t2.c from t2,t where t2.c=t.a);
-explain
-select t1.a,t1.b from t1,t2
- where t1.a>t2.c and
- t2.c in (select t2.c
- from t2,(select * from t1 where t1.a<5) as t
- where t2.c=t.a);
-
---echo # two different definitions of t: one in the with clause of the main query,
---echo # the other in the with clause of a subquery
-with t as (select c from t2 where c >= 4)
- select t1.a,t1.b from t1,t
- where t1.a=t.c and
- t.c in (with t as (select * from t1 where t1.a<5)
- select t2.c from t2,t where t2.c=t.a);
-select t1.a,t1.b from t1, (select c from t2 where c >= 4) as t
- where t1.a=t.c and
- t.c in (select t2.c from t2, (select * from t1 where t1.a<5) as t
- where t2.c=t.a);
-explain
-with t as (select c from t2 where c >= 4)
- select t1.a,t1.b from t1,t
- where t1.a=t.c and
- t.c in (with t as (select * from t1 where t1.a<5)
- select t2.c from t2,t where t2.c=t.a);
-explain
-select t1.a,t1.b from t1, (select c from t2 where c >= 4) as t
- where t1.a=t.c and
- t.c in (select t2.c from t2, (select * from t1 where t1.a<5) as t
- where t2.c=t.a);
-
---echo # another with table tt is defined in the with clause of a subquery
---echo # from the specification of t
-with t as (select * from t1
- where a>2 and
- b in (with tt as (select * from t2 where t2.c<5)
- select t1.b from t1,tt where t1.a=tt.c))
- select t.a, count(*) from t1,t where t1.a=t.a group by t.a;
-select t.a, count(*)
- from t1,
- (select * from t1
- where a>2 and
- b in (select t1.b
- from t1,
- (select * from t2 where t2.c<5) as tt
- where t1.a=tt.c)) as t
- where t1.a=t.a group by t.a;
-explain
-with t as (select * from t1
- where a>2 and
- b in (with tt as (select * from t2 where t2.c<5)
- select t1.b from t1,tt where t1.a=tt.c))
- select t.a, count(*) from t1,t where t1.a=t.a group by t.a;
-explain
-select t.a, count(*)
- from t1,
- (select * from t1
- where a>2 and
- b in (select t1.b
- from t1,
- (select * from t2 where t2.c<5) as tt
- where t1.a=tt.c)) as t
- where t1.a=t.a group by t.a;
-
---echo # with clause in the specification of a derived table
-select *
- from t1,
- (with t as (select a from t1 where b >= 'c')
- select * from t2,t where t2.c=t.a) as tt
- where t1.b > 'f' and tt.a=t1.a;
-select *
- from t1,
- (select * from t2,
- (select a from t1 where b >= 'c') as t
- where t2.c=t.a) as tt
- where t1.b > 'f' and tt.a=t1.a;
-explain
-select *
- from t1,
- (with t as (select a from t1 where b >= 'c')
- select * from t2,t where t2.c=t.a) as tt
- where t1.b > 'f' and tt.a=t1.a;
-explain
-select *
- from t1,
- (select * from t2,
- (select a from t1 where b >= 'c') as t
- where t2.c=t.a) as tt
- where t1.b > 'f' and tt.a=t1.a;
-
---echo # with claused in the specification of a view
-create view v1 as
-with t as (select a from t1 where b >= 'c')
- select * from t2,t where t2.c=t.a;
-show create view v1;
-select * from v1;
-explain
-select * from v1;
-
---echo # with claused in the specification of a materialized view
-create view v2 as
-with t as (select a, count(*) from t1 where b >= 'c' group by a)
- select * from t2,t where t2.c=t.a;
-show create view v2;
-select * from v2;
-explain
-select * from v2;
-
---echo # with clause in the specification of a view that whose definition
---echo # table alias for a with table
-create view v3 as
-with t(c) as (select a from t1 where b >= 'c')
-select * from t r1 where r1.c=4;
-show create view v3;
-select * from v3;
-
---echo # with clause in the specification of a view that whose definition
---echo # two table aliases for for the same with table
-create view v4(c,d) as
-with t(c) as (select a from t1 where b >= 'c')
-select * from t r1, t r2 where r1.c=r2.c and r2.c=4;
-show create view v4;
-select * from v4;
-explain
-select * from v4;
-
-drop view v1,v2,v3,v4;
-
-
---echo # currently any views containing with clause are not updatable
-create view v1(a) as
-with t as (select a from t1 where b >= 'c')
- select t.a from t2,t where t2.c=t.a;
---error ER_NON_UPDATABLE_TABLE
-update v1 set a=0 where a > 4;
-drop view v1;
-
-
---echo # prepare of a query containing a definition of a with table t
-prepare stmt1 from "
-with t as (select a from t1 where b >= 'c')
- select * from t2,t where t2.c=t.a;
-";
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-
---echo # prepare of a query containing a definition of a materialized t
-prepare stmt1 from "
-with t as (select a, count(*) from t1 where b >= 'c' group by a)
- select * from t2,t where t2.c=t.a;
-";
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-
---echo # prepare of a query containing two references to with table t
-prepare stmt1 from "
-with t as (select * from t1 where b >= 'c')
- select * from t as r1, t as r2 where r1.a=r2.a;
-";
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-
---ERROR ER_WITH_COL_WRONG_LIST
-with t(f) as (select * from t1 where b >= 'c')
- select * from t2,t where t2.c=t.f1;
-
---ERROR ER_DUP_FIELDNAME
-with t(f1,f1) as (select * from t1 where b >= 'c')
- select * from t2,t where t2.c=t.f1;
-
---ERROR ER_DUP_QUERY_NAME
-with t as (select * from t2 where c>3),
- t as (select a from t1 where a>2)
- select * from t,t1 where t1.a=t.c;
-
---ERROR ER_NO_SUCH_TABLE
-with t as (select a from s where a<5),
- s as (select a from t1 where b>='d')
- select * from t,s where t.a=s.a;
-
-with recursive
- t as (select a from s where a<5),
- s as (select a from t1 where b>='d')
- select * from t,s where t.a=s.a;
-
---ERROR ER_RECURSIVE_WITHOUT_ANCHORS
-with recursive t as (select * from s where a>2),
- s as (select a from t1,r where t1.a>r.c),
- r as (select c from t,t2 where t.a=t2.c)
- select * from r where r.c<7;
-
---ERROR ER_RECURSIVE_WITHOUT_ANCHORS
-with recursive
- t as (select * from s where a>2),
- s as (select a from t1,r where t1.a>r.c),
- r as (select c from t,t2 where t.a=t2.c)
- select * from r where r.c<7;
-
---ERROR ER_RECURSIVE_WITHOUT_ANCHORS
-with recursive
- t as (select * from t1
- where a in (select c from s where b<='ccc') and b>'b'),
- s as (select * from t1,t2
- where t1.a=t2.c and t1.c in (select a from t where a<5))
- select * from s where s.b>'aaa';
-
---ERROR ER_RECURSIVE_WITHOUT_ANCHORS
-with recursive
- t as (select * from t1 where b>'aaa' and b <='d')
- select t.b from t,t2
- where t.a=t2.c and
- t2.c in (with recursive
- s as (select t1.a from s,t1 where t1.a=s.a and t1.b<'c')
- select * from s);
---echo #erroneous definition of unreferenced with table t
---ERROR ER_BAD_FIELD_ERROR
-with t as (select count(*) from t1 where d>='f' group by a)
- select t1.b from t2,t1 where t1.a = t2.c;
-
-with t as (select count(*) from t1 where b>='f' group by a)
- select t1.b from t2,t1 where t1.a = t2.c;
-
---echo #erroneous definition of s referring to unreferenced t
---ERROR ER_BAD_FIELD_ERROR
-with t(d) as (select count(*) from t1 where b<='ccc' group by b),
- s as (select * from t1 where a in (select t2.d from t2,t where t2.c=t.d))
- select t1.b from t1,t2 where t1.a=t2.c;
---ERROR ER_BAD_FIELD_ERROR
-with t(d) as (select count(*) from t1 where b<='ccc' group by b),
- s as (select * from t1 where a in (select t2.c from t2,t where t2.c=t.c))
- select t1.b from t1,t2 where t1.a=t2.c;
-
-with t(d) as (select count(*) from t1 where b<='ccc' group by b),
- s as (select * from t1 where a in (select t2.c from t2,t where t2.c=t.d))
- select t1.b from t1,t2 where t1.a=t2.c;
-
---echo #erroneous definition of unreferenced with table t
---ERROR ER_WITH_COL_WRONG_LIST
-with t(f) as (select * from t1 where b >= 'c')
- select t1.b from t2,t1 where t1.a = t2.c;
-
---echo #erroneous definition of unreferenced with table t
---ERROR ER_DUP_FIELDNAME
-with t(f1,f1) as (select * from t1 where b >= 'c')
- select t1.b from t2,t1 where t1.a = t2.c;
-
---echo # explain for query with unreferenced with table
-
-explain
-with t as (select a from t1 where b >= 'c')
- select t1.b from t2,t1 where t1.a = t2.c;
-
-explain
-with t as (select a, count(*) from t1 where b >= 'c' group by a)
- select t1.b from t2,t1 where t1.a = t2.c;
-
---echo # too many with elements in with clause
-let $m= 65;
-let $i= $m;
-dec $i;
-let $q= with s$m as (select * from t1);
-while ($i)
-{
- let $q= $q, s$i as (select * from t1) ;
- dec $i;
- }
-let $q= $q select * from s$m;
---ERROR ER_TOO_MANY_DEFINITIONS_IN_WITH_CLAUSE
-eval $q;
-
-drop table t1,t2;
-
---echo #
---echo # Bug mdev-9937: View used in the specification of with table
---echo # refers to the base table with the same name
---echo #
-
-create table t1 (a int);
-insert into t1 values (20), (30), (10);
-create view v1 as select * from t1 where a > 10;
-
-with t1 as (select * from v1) select * from t1;
-
-drop view v1;
-drop table t1;
-
---echo #
---echo # Bug mdev-10058: Invalid derived table with WITH clause
---echo #
-
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (a INT);
-CREATE TABLE t3 (a INT);
-INSERT INTO t1 VALUES (1),(2),(3);
-INSERT INTO t2 VALUES (1),(2),(3);
-INSERT INTO t3 VALUES (1),(2),(3);
-
---ERROR ER_PARSE_ERROR
-SELECT * FROM (WITH a AS (SELECT * FROM t1) (t2 NATURAL JOIN t3));
-
-SELECT * FROM (WITH a AS (SELECT * FROM t1) SELECT * FROM t2 NATURAL JOIN t3) AS d1;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # Bug mdev-10344: the WITH clause of the query refers to a view that uses
---echo # a base table with the same name as a CTE table from the clause
---echo #
-
-
-create table ten(a int primary key);
-insert into ten values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table one_k(a int primary key);
-insert into one_k select A.a + B.a* 10 + C.a * 100 from ten A, ten B, ten C;
-
-create view v1 as select * from ten;
-
-select * from v1;
-
-drop view v1;
-drop table ten, one_k;
-
---echo #
---echo # MDEV-10057 : Crash with EXPLAIN + WITH + constant query
---echo #
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1),(2),(3);
-SELECT * FROM (WITH a AS (SELECT * FROM t1) SELECT 1) AS t1;
-EXPLAIN SELECT * FROM (WITH a AS (SELECT * FROM t1) SELECT 1) AS t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-10058: Suspicious EXPLAIN output for a derived table + WITH + joined table
---echo #
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (a INT);
-CREATE TABLE t3 (a INT);
-INSERT INTO t1 VALUES (1),(2),(3);
-INSERT INTO t2 VALUES (1),(2),(3);
-INSERT INTO t3 VALUES (1),(2),(3);
---error ER_PARSE_ERROR
-EXPLAIN SELECT * FROM (WITH a AS (SELECT * FROM t1) (t2 NATURAL JOIN t3));
-explain SELECT * FROM (WITH a AS (SELECT * FROM t1) SELECT * FROM t2 NATURAL JOIN t3) AS d1;
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # MDEV-10729: Server crashes in st_select_lex::set_explain_type
---echo #
-CREATE TABLE t1 (i1 INT, KEY(i1)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (4),(8);
-
-CREATE TABLE t2 (a2 INT, b2 INT, KEY(b2)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (8,7);
-
-CREATE TABLE t3 (i3 INT) ENGINE=MyISAM;
-INSERT INTO t3 VALUES (2),(6);
-
-SELECT * FROM t1, t2 WHERE a2 = i1 and b2 >= i1 AND i1 IN ( SELECT i3 FROM t3 )
-UNION
-SELECT * FROM t1, t2 WHERE a2 = i1 and b2 >= i1 AND i1 IN ( SELECT i3 FROM t3 )
-;
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # MDEV-10923: mergeable CTE used twice in the query
---echo #
-
-create table employees (
- name varchar(32),
- dept varchar(32),
- country varchar(8)
-);
-
-insert into employees
-values
-('Sergei Golubchik', 'Development', 'DE'),
-('Claudio Nanni', 'Support', 'ES'),
-('Sergei Petrunia', 'Development', 'RU');
-
-with eng as
-(
- select * from employees
- where dept in ('Development','Support')
-),
-eu_eng as
-(
- select * from eng where country IN ('DE','ES','RU')
-)
-select * from eu_eng T1
-where
- not exists (select 1 from eu_eng T2
- where T2.country=T1.country
- and T2.name <> T1.name);
-
-drop table employees;
-
---echo #
---echo # MDEV-11818: EXPLAIN EXTENDED for a query with optimized away CTE table
---echo #
-
-CREATE TABLE t1 (i INT, c VARCHAR(3));
-INSERT INTO t1 VALUES (1,'foo');
-
-EXPLAIN EXTENDED
-WITH cte AS ( SELECT * FROM t1 ) SELECT i FROM cte;
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-12185: view defintion contains WITH clause with
---echo # several specifications of CTE
---echo #
-
-with
- alias1 as (select 1 as one),
- alias2 as (select 2 as two)
-select one, two from alias1, alias2;
-
-create view v1 as
-with
- alias1 as (select 1 as one),
- alias2 as (select 2 as two)
-select one, two from alias1, alias2;
-
-select * from v1;
-show create view v1;
-
-drop view v1;
-
---echo #
---echo # MDEV-12440: the same CTE table is used twice
---echo #
-
-create table t1 (a int, b varchar(32));
-insert into t1 values
- (4,'aaaa' ), (7,'bb'), (1,'ccc'), (4,'dd');
-
---echo # cte2 is used in the main query and in the spec for ct3
-with
-cte1 as (select * from t1 where b >= 'c'),
-cte2 as (select * from cte1 where a < 7),
-cte3 as (select * from cte2 where a > 1)
-select * from cte2, cte3 where cte2.a = cte3.a;
-
---echo # cte2 is used twice in the spec for ct3
-with
-cte1 as (select * from t1 where b >= 'b'),
-cte2 as (select * from cte1 where b > 'c'),
-cte3 as (select * from cte2 where a > 1 union select * from cte2 where a > 1)
-select * from cte3;
-
-drop table t1;
-
---echo #
---echo # MDEV-12558: CTE with the same name as temporary table
---echo #
-
-CREATE TABLE t ENGINE=MyISAM AS SELECT 1 AS i;
-CREATE TEMPORARY TABLE cte ENGINE=MyISAM AS SELECT 2 AS f;
-
-WITH cte AS ( SELECT i FROM t ) SELECT * FROM cte;
-WITH cte AS ( SELECT i FROM t GROUP BY i) SELECT * FROM cte;
-
-SELECT * FROM cte;
-
-DROP TABLE cte;
-DROP TABLE t;
-
---echo #
---echo # MDEV-13107: SHOW TABLE STATUS, SHOW CREATE VIEW
---echo # for CTEs that use derived tables
---echo #
-
-create table t1(a int) engine=myisam;
-insert into t1 values (3), (1), (2);
-create table t2 (b int) engine=myisam;
-insert into t2 values (2), (10);
-
-create view v1 as
-with t as (select s.a from (select t1.a from t1) s),
- r as(select t.a from t2, t where t2.b=t.a)
- select a from r;
-
-create view v2 as
-with t as (select s.a from (select t1.a from t1) s),
- r as(select t.a from t2, t where t2.b=t.a)
- select a from t1;
-
---disable_result_log
-show table status;
---enable_result_log
-
-show create view v1;
-show create view v2;
-
-select * from v1;
-select * from v2;
-
-prepare stmt1 from "select * from v1";
-execute stmt1;
-execute stmt1;
-prepare stmt2 from "select * from v2";
-execute stmt2;
-execute stmt2;
-
-deallocate prepare stmt1;
-deallocate prepare stmt2;
-
-drop view v1,v2;
-drop table t1,t2;
-
---echo #
---echo # MDEV-13796: UNION of two materialized CTEs
---echo #
-
-CREATE TABLE t1 (id int, k int);
-CREATE TABLE t2 (id int);
-INSERT INTO t1 VALUES (3,5), (1,7), (4,3);
-INSERT INTO t2 VALUES (4), (3), (2);
-
-let $q=
-WITH d1 AS (SELECT SUM(k) FROM t1, t2 as t2 WHERE t1.id = t2.id),
- d2 AS (SELECT SUM(k) FROM t1, t2 as t2 WHERE t1.id = t2.id)
-SELECT * FROM d1 UNION SELECT * FROM d2;
-
-eval $q;
-eval explain $q;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-13780: tower of embedding CTEs with multiple usage of them
---echo #
-
-create table t1 (a int);
-insert into t1 values (3), (2), (4), (7), (1), (2), (5);
-
-let $q=
-with cte_e as
-(
- with cte_o as
- (
- with cte_i as (select * from t1 where a < 7)
- select * from cte_i where a > 1
- )
- select * from cte_o as cto_o1 where a < 3
- union
- select * from cte_o as cto_o2 where a > 4
-)
-select * from cte_e as cte_e1 where a > 1
-union
-select * from cte_e as cte_e2;
-
-eval $q;
-eval explain extended $q;
-
-drop table t1;
-
---echo #
---echo # MDEV-13753: embedded CTE in a VIEW created in prepared statement
---echo #
-
-SET @sql_query = "
- CREATE OR REPLACE VIEW cte_test AS
- WITH cte1 AS ( SELECT 1 as a from dual )
- , cte2 AS ( SELECT * FROM cte1 )
- SELECT * FROM cte2;
-";
-PREPARE stmt FROM @sql_query;
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-
-SHOW CREATE VIEW cte_test;
-SELECT * FROM cte_test;
-
-DROP VIEW cte_test;
-
---echo #
---echo # mdev-14755 : PS for query using CTE in select with subquery
---echo #
-
-create table t1 (a int);
-insert into t1 values
- (7), (2), (8), (1), (3), (2), (7), (5), (4), (7), (9), (8);
-
-let $q1=
-with cte as
-(select a from t1 where a between 4 and 7 group by a)
-(select a from cte where exists( select a from t1 where cte.a=t1.a ))
-union
-(select a from t1 where a < 2);
-
-eval $q1;
-eval prepare stmt from "$q1";
-execute stmt;
-execute stmt;
-deallocate prepare stmt;
-
-let $q2=
-with cte as
-(select a from t1 where a between 4 and 7 group by a)
-(select a from t1 where a < 2)
-union
-(select a from cte where exists( select a from t1 where cte.a=t1.a ));
-
-eval $q2;
-eval prepare stmt from "$q2";
-execute stmt;
-execute stmt;
-deallocate prepare stmt;
-
-let $q3=
-with cte as
-(select a from t1 where a between 4 and 7)
-(select a from t1 where a < 2)
-union
-(select a from cte where exists( select a from t1 where cte.a=t1.a ));
-
-eval $q3;
-eval prepare stmt from "$q3";
-execute stmt;
-execute stmt;
-deallocate prepare stmt;
-
-let $q4=
-with cte as
-(select a from t1 where a between 4 and 7)
-(select a from cte
- where exists( select a from t1 where t1.a < 2 and cte.a=t1.a ))
-union
-(select a from cte where exists( select a from t1 where cte.a=t1.a ));
-
-eval $q4;
-eval prepare stmt from "$q4";
-execute stmt;
-execute stmt;
-deallocate prepare stmt;
-
-drop table t1;
-
---echo #
---echo # MDEV-14852: CTE using temporary table in query
---echo # with two references to the CTE
---echo #
-
-create temporary table t1 (i int);
-insert into t1 values (5),(4),(1),(2),(3);
-
-with
-c1 as (select i from t1),
-c2 as (select i from c1 where c1.i=2)
-select i from c1 where i > 3 union select i from c2;
-
-drop table t1;
-
-create table t1 (term char(10));
-create temporary table t2 (term char(10));
-
-insert into t1 values ('TERM01'),('TERM02'),('TERM03');
-insert into t2 values ('TERM02'),('TERM03'),('TERM04');
-
-with c1 as (select * from t1), c2 as (select * from t2)
-(select * from c1 left outer join c2 on c1.term = c2.term)
-union all
-(select * from c1 right outer join c2 on c1.term = c2.term
- where c1.term is null);
-
-drop table t1,t2;
-
---echo #
---echo # MDEV-14969: view using subquery with attached CTE
---echo #
-
-create table region (
- r_regionkey int,
- r_name char(25),
- primary key (r_regionkey)
-);
-insert into region values
-(0,'AFRICA'), (1,'AMERICA'), (2,'ASIA'), (3,'EUROPE'), (4,'MIDDLE EAST');
-
-create table nation (
- n_nationkey int,
- n_name char(25),
- n_regionkey int,
- primary key (n_nationkey),
- key i_n_regionkey (n_regionkey)
-);
-insert into nation values
-(0,'ALGERIA',0), (1,'ARGENTINA',1), (2,'BRAZIL',1), (3,'CANADA',1),
-(4,'EGYPT',4), (5,'ETHIOPIA',0), (6,'FRANCE',3), (7,'GERMANY',3),
-(8,'INDIA',2), (9,'INDONESIA',2), (10,'IRAN',4), (11,'IRAQ',4),
-(12,'JAPAN',2), (13,'JORDAN',4), (14,'KENYA',0), (15,'MOROCCO',0),
-(16,'MOZAMBIQUE',0), (17,'PERU',1), (18,'CHINA',2), (19,'ROMANIA',3),
-(20,'SAUDI ARABIA',4), (21,'VIETNAM',2), (22,'RUSSIA',3),
-(23,'UNITED KINGDOM',3), (24,'UNITED STATES',1);
-
-select * from nation n ,region r
- where n.n_regionkey = r.r_regionkey and
- r.r_regionkey in
- (with t as (select * from region where r_regionkey <= 3 )
- select r_regionkey from t where r_name <> "ASIA");
-
-create view v as
-select * from nation n ,region r
- where n.n_regionkey = r.r_regionkey and
- r.r_regionkey in
- (with t as (select * from region where r_regionkey <= 3)
- select r_regionkey from t where r_name <> "ASIA");
-
-show create view v;
-select * from v;
-
-drop view v;
-drop table region, nation;
-
---echo #
---echo # MDEV-15120: cte name used with database name
---echo #
-
---error ER_NO_SUCH_TABLE
-WITH cte AS (SELECT 1 AS a) SELECT test.cte.a FROM test.cte;
-
-CREATE DATABASE db1;
-USE db1;
-
---error ER_NO_SUCH_TABLE
-WITH cte AS (SELECT 1 AS a) SELECT db1.cte.a FROM db1.cte;
-
-DROP DATABASE db1;
-USE test;
-
---echo #
---echo # MDEV-15119: CTE c2 specified after CTE c1 and is used in
---echo # CTE c3 that is embedded into the spec of c1
---echo #
-
-CREATE TABLE t1 (i int);
-INSERT INTO t1 VALUES (1),(2),(3);
-
---error ER_NO_SUCH_TABLE
-WITH c1 AS (WITH c3 AS (SELECT * FROM c2) SELECT * FROM c3),
- c2 AS (SELECT * FROM t1)
-SELECT * FROM c1;
-
-WITH RECURSIVE c1 AS (WITH c3 AS (SELECT * FROM c2) SELECT * FROM c3),
- c2 AS (SELECT * FROM t1)
-SELECT * FROM c1;
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-14297: Lost name of a explicitly named CTE column used in
---echo # the non-recursive CTE via prepared statement
---echo #
-
-CREATE TABLE t1 (i int);
-INSERT INTO t1 VALUES (1),(2),(3);
-
-PREPARE stmt FROM "WITH cte(a) AS (SELECT 1) SELECT * FROM cte";
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-
-PREPARE stmt FROM "CREATE VIEW v1 AS WITH cte(a) AS (SELECT 1) SELECT * FROM cte";
-EXECUTE stmt;
-SELECT * FROM v1;
-DEALLOCATE PREPARE stmt;
-
-PREPARE stmt FROM "CREATE VIEW v2 AS WITH cte(a) AS (SELECT * FROM t1) SELECT * FROM cte";
-EXECUTE stmt;
-SELECT * FROM v2;
-DEALLOCATE PREPARE stmt;
-
-DROP TABLE t1;
-DROP VIEW v1,v2;
-
---echo #
---echo # MDEV-15478: Lost name of a explicitly named CTE column used in
---echo # the non-recursive CTE defined with UNION
---echo #
-
-CREATE TABLE t1 (x int, y int);
-INSERT INTO t1 VALUES (1,2),(2,7),(3,3);
-
-WITH cte(a) AS (SELECT 1 UNION SELECT 2) SELECT * FROM cte;
-
-WITH cte(a) AS (SELECT 1 UNION SELECT 2) SELECT a FROM cte;
-
-WITH cte(a) AS (SELECT 1 UNION ALL SELECT 1) SELECT a FROM cte;
-
-WITH cte(a) AS (SELECT x from t1 UNION SELECT 4) SELECT a FROM cte;
-
-WITH cte(a) AS (SELECT 4 UNION SELECT x FROM t1 UNION SELECT 5)
-SELECT a FROM cte;
-
-WITH cte(a,b) AS (SELECT 4,5 UNION SELECT 4,3) SELECT a,b FROM cte;
-
-DROP TABLE t1;
diff --git a/mysql-test/t/cte_recursive.test b/mysql-test/t/cte_recursive.test
deleted file mode 100644
index 7ed55a1daaa..00000000000
--- a/mysql-test/t/cte_recursive.test
+++ /dev/null
@@ -1,2310 +0,0 @@
-create table t1 (a int, b varchar(32));
-insert into t1 values
-(4,'aaaa' ), (7,'bb'), (1,'ccc'), (4,'dd');
-insert into t1 values
-(3,'eee'), (7,'bb'), (1,'fff'), (4,'ggg');
-
---ERROR ER_UNACCEPTABLE_MUTUAL_RECURSION
-with recursive
-t as
-(
- select * from t1 where t1.b >= 'c'
- union
- select * from r
-),
-r as
-(
- select * from t
- union
- select t1.* from t1,r where r.a+1 = t1.a
-)
-select * from r;
-
-
---ERROR ER_UNACCEPTABLE_MUTUAL_RECURSION
-with recursive
-a1(a,b) as
-(select * from t1 where t1.a>3
-union
-select * from b1 where b1.a >3
-union
-select * from c1 where c1.a>3),
-b1(a,b) as
-(select * from a1 where a1.b > 'ccc'
-union
-select * from c1 where c1.b > 'ddd'),
-c1(a,b) as
-(select * from a1 where a1.a<6 and a1.b< 'zz'
-union
-select * from b1 where b1.b > 'auu')
-select * from c1;
-
-drop table t1;
-
-
---echo # WITH RECURSIVE vs just WITH
-
-create table t1 (a int);
-insert into t1 values
- (0), (1), (2), (3), (4);
-create table t2 (a int);
-insert into t2 values
- (1), (2), (3), (4), (5);
-
-
---echo # just WITH : s refers to t defined after s
---ERROR ER_NO_SUCH_TABLE
-with
- s(a) as (select t.a + 10 from t),
- t(a) as (select t1.a from t1)
-select * from s;
-
---echo # WITH RECURSIVE: s refers to t defined after s
-with recursive
- s(a) as (select t.a + 10 from t),
- t(a) as (select t1.a from t1)
-select * from s;
-
---echo # just WITH : defined t1 is non-recursive and uses base tables t1,t2
-with
-t1 as
-(
-select a from t2 where t2.a=3
-union
-select t2.a from t1,t2 where t1.a+1=t2.a
-)
-select * from t1;
-
-explain
-with
-t1 as
-(
-select a from t2 where t2.a=3
-union
-select t2.a from t1,t2 where t1.a+1=t2.a
-)
-select * from t1;
-
-
---echo #WITH RECURSIVE : defined t1 is recursive and uses only base table t2
-with recursive
-t1 as
-(
-select a from t2 where t2.a=3
-union
-select t2.a from t1,t2 where t1.a+1=t2.a
-)
-select * from t1;
-
-explain
-with recursive
-t1 as
-(
-select a from t2 where t2.a=3
-union
-select t2.a from t1,t2 where t1.a+1=t2.a
-)
-select * from t1;
-
---echo # just WITH : types of t1 columns are determined by all parts of union
-
-create view v1 as
-with
-t1 as
-(
-select a from t2 where t2.a=3
-union
-select t2.a+1 from t1,t2 where t1.a=t2.a
-)
-select * from t1;
-
-show columns from v1;
-
-
---echo # WITH RECURSIVE : types of t1 columns are determined by anchor parts
-
-create view v2 as
-with recursive
-t1 as
-(
-select a from t2 where t2.a=3
-union
-select t2.a+1 from t1,t2 where t1.a=t2.a
-)
-select * from t1;
-
-show columns from v2;
-
-drop view v1,v2;
-
-drop table t1,t2;
-
-
-create table folks(id int, name char(32), dob date, father int, mother int);
-
-insert into folks values
-(100, 'Me', '2000-01-01', 20, 30),
-(20, 'Dad', '1970-02-02', 10, 9),
-(30, 'Mom', '1975-03-03', 8, 7),
-(10, 'Grandpa Bill', '1940-04-05', null, null),
-(9, 'Grandma Ann', '1941-10-15', null, null),
-(25, 'Uncle Jim', '1968-11-18', 8, 7),
-(98, 'Sister Amy', '2001-06-20', 20, 30),
-(7, 'Grandma Sally', '1943-08-23', null, 6),
-(8, 'Grandpa Ben', '1940-10-21', null, null),
-(6, 'Grandgrandma Martha', '1923-05-17', null, null),
-(67, 'Cousin Eddie', '1992-02-28', 25, 27),
-(27, 'Auntie Melinda', '1971-03-29', null, null);
-
---echo # simple recursion with one anchor and one recursive select
---echo # the anchor is the first select in the specification
-with recursive
-ancestors
-as
-(
- select *
- from folks
- where name = 'Me' and dob = '2000-01-01'
- union
- select p.id, p.name, p.dob, p.father, p.mother
- from folks as p, ancestors AS a
- where p.id = a.father or p.id = a.mother
-)
-select * from ancestors;
-
---echo # simple recursion with one anchor and one recursive select
---echo # the anchor is the last select in the specification
-with recursive
-ancestors
-as
-(
- select p.*
- from folks as p, ancestors AS a
- where p.id = a.father or p.id = a.mother
- union
- select *
- from folks
- where name = 'Me' and dob = '2000-01-01'
-)
-select * from ancestors;
-
---echo # simple recursion with one anchor and one recursive select
---echo # the anchor is the first select in the specification
-with recursive
-ancestors
-as
-(
- select *
- from folks
- where name = 'Cousin Eddie'
- union
- select p.*
- from folks as p, ancestors as a
- where p.id = a.father or p.id = a.mother
-)
-select * from ancestors;
-
---echo # simple recursion with or in anchor and or in recursive part
-with recursive
-ancestors
-as
-(
- select *
- from folks
- where name = 'Me' or name='Sister Amy'
- union
- select p.*
- from folks as p, ancestors as a
- where p.id = a.father or p.id = a.mother
-)
-select * from ancestors;
-
---echo # two recursive definition, one uses another
-with recursive
-prev_gen
-as
-(
- select folks.*
- from folks, prev_gen
- where folks.id=prev_gen.father or folks.id=prev_gen.mother
- union
- select *
- from folks
- where name='Me'
-),
-ancestors
-as
-(
- select *
- from folks
- where name='Me'
- union
- select *
- from ancestors
- union
- select *
- from prev_gen
-)
-select ancestors.name, ancestors.dob from ancestors;
-
---echo # recursive definition with two attached non-recursive
-with recursive
-ancestors(id,name,dob)
-as
-(
- with
- father(child_id,id,name,dob)
- as
- (
- select folks.id, f.id, f.name, f.dob
- from folks, folks f
- where folks.father=f.id
-
- ),
- mother(child_id,id,name,dob)
- as
- (
- select folks.id, m.id, m.name, m.dob
- from folks, folks m
- where folks.mother=m.id
-
- )
- select folks.id, folks.name, folks.dob
- from folks
- where name='Me'
- union
- select f.id, f.name, f.dob
- from ancestors a, father f
- where f.child_id=a.id
- union
- select m.id, m.name, m.dob
- from ancestors a, mother m
- where m.child_id=a.id
-
-)
-select ancestors.name, ancestors.dob from ancestors;
-
---echo # simple recursion with one anchor and one recursive select
---echo # the anchor is the first select in the specification
-with recursive
-descendants
-as
-(
- select *
- from folks
- where name = 'Grandpa Bill'
- union
- select folks.*
- from folks, descendants as d
- where d.id=folks.father or d.id=folks.mother
-)
-select * from descendants;
-
---echo # simple recursion with one anchor and one recursive select
---echo # the anchor is the first select in the specification
-with recursive
-descendants
-as
-(
- select *
- from folks
- where name = 'Grandma Sally'
- union
- select folks.*
- from folks, descendants as d
- where d.id=folks.father or d.id=folks.mother
-)
-select * from descendants;
-
-
---echo # simple recursive table used three times in the main query
-with recursive
-ancestors
-as
-(
- select *
- from folks
- where name = 'Me' and dob = '2000-01-01'
- union
- select p.*
- from folks as p, ancestors AS a
- where p.id = a.father OR p.id = a.mother
-)
-select *
- from ancestors t1, ancestors t2
- where exists (select * from ancestors a
- where a.father=t1.id AND a.mother=t2.id);
-
-
---echo # simple recursive table used three times in the main query
-with
-ancestor_couples(husband, h_dob, wife, w_dob)
-as
-(
-with recursive
-ancestors
-as
-(
- select *
- from folks
- where name = 'Me'
- union
- select p.*
- from folks as p, ancestors AS a
- where p.id = a.father OR p.id = a.mother
-)
-select t1.name, t1.dob, t2.name, t2.dob
- from ancestors t1, ancestors t2
- where exists (select * from ancestors a
- where a.father=t1.id AND a.mother=t2.id)
-)
-select * from ancestor_couples;
-
-
---echo # simple recursion with two selects in recursive part
-with recursive
-ancestors
-as
-(
- select *
- from folks
- where name = 'Me'
- union
- select p.*
- from folks as p, ancestors as fa
- where p.id = fa.father
- union
- select p.*
- from folks as p, ancestors as ma
- where p.id = ma.mother
-)
-select * from ancestors;
-
-
---echo # mutual recursion with renaming
-with recursive
-ancestor_couples(h_id, h_name, h_dob, h_father, h_mother,
- w_id, w_name, w_dob, w_father, w_mother)
-as
-(
- select h.*, w.*
- from folks h, folks w, coupled_ancestors a
- where a.father = h.id AND a.mother = w.id
- union
- select h.*, w.*
- from folks v, folks h, folks w
- where v.name = 'Me' and
- (v.father = h.id AND v.mother= w.id)
-),
-coupled_ancestors (id, name, dob, father, mother)
-as
-(
- select h_id, h_name, h_dob, h_father, h_mother
- from ancestor_couples
- union
- select w_id, w_name, w_dob, w_father, w_mother
- from ancestor_couples
-)
-select h_name, h_dob, w_name, w_dob
- from ancestor_couples;
-
-
---echo # mutual recursion with union all
-with recursive
-ancestor_couples(h_id, h_name, h_dob, h_father, h_mother,
- w_id, w_name, w_dob, w_father, w_mother)
-as
-(
- select h.*, w.*
- from folks h, folks w, coupled_ancestors a
- where a.father = h.id AND a.mother = w.id
- union
- select h.*, w.*
- from folks v, folks h, folks w
- where v.name = 'Me' and
- (v.father = h.id AND v.mother= w.id)
-),
-coupled_ancestors (id, name, dob, father, mother)
-as
-(
- select h_id, h_name, h_dob, h_father, h_mother
- from ancestor_couples
- union all
- select w_id, w_name, w_dob, w_father, w_mother
- from ancestor_couples
-)
-select h_name, h_dob, w_name, w_dob
- from ancestor_couples;
-
-
---echo # mutual recursion with renaming
-with recursive
-ancestor_couples(h_id, h_name, h_dob, h_father, h_mother,
- w_id, w_name, w_dob, w_father, w_mother)
-as
-(
- select h.*, w.*
- from folks h, folks w, coupled_ancestors a
- where a.father = h.id AND a.mother = w.id
- union
- select h.*, w.*
- from folks v, folks h, folks w
- where v.name = 'Me' and
- (v.father = h.id AND v.mother= w.id)
-),
-coupled_ancestors (id, name, dob, father, mother)
-as
-(
- select h_id, h_name, h_dob, h_father, h_mother
- from ancestor_couples
- union
- select w_id, w_name, w_dob, w_father, w_mother
- from ancestor_couples
-)
-select h_name, h_dob, w_name, w_dob
- from ancestor_couples;
-
-
---echo # mutual recursion with union all
-with recursive
-ancestor_couples(h_id, h_name, h_dob, h_father, h_mother,
- w_id, w_name, w_dob, w_father, w_mother)
-as
-(
- select h.*, w.*
- from folks h, folks w, coupled_ancestors a
- where a.father = h.id AND a.mother = w.id
-),
-coupled_ancestors (id, name, dob, father, mother)
-as
-(
- select *
- from folks
- where name = 'Me'
- union all
- select h_id, h_name, h_dob, h_father, h_mother
- from ancestor_couples
- union all
- select w_id, w_name, w_dob, w_father, w_mother
- from ancestor_couples
-)
-select h_name, h_dob, w_name, w_dob
- from ancestor_couples;
-
---echo # mutual recursion with one select in the first definition
-with recursive
-ancestor_couple_ids(h_id, w_id)
-as
-(
- select a.father, a.mother
- from coupled_ancestors a
- where a.father is not null and a.mother is not null
-),
-coupled_ancestors (id, name, dob, father, mother)
-as
-(
- select *
- from folks
- where name = 'Me'
- union all
- select p.*
- from folks p, ancestor_couple_ids fa
- where p.id = fa.h_id
- union all
- select p.*
- from folks p, ancestor_couple_ids ma
- where p.id = ma.w_id
-)
-select *
- from ancestor_couple_ids;
-
-
---echo # join of a mutually recursive table with base tables
-with recursive
-ancestor_couple_ids(h_id, w_id)
-as
-(
- select a.father, a.mother
- from coupled_ancestors a
- where a.father is not null and a.mother is not null
-),
-coupled_ancestors (id, name, dob, father, mother)
-as
-(
- select *
- from folks
- where name = 'Me'
- union all
- select p.*
- from folks p, ancestor_couple_ids fa
- where p.id = fa.h_id
- union all
- select p.*
- from folks p, ancestor_couple_ids ma
- where p.id = ma.w_id
-)
-select h.name, h.dob, w.name, w.dob
- from ancestor_couple_ids c, folks h, folks w
- where c.h_id = h.id and c.w_id= w.id;
-
-
---echo # join of two mutually recursive tables
-with recursive
-ancestor_couple_ids(h_id, w_id)
-as
-(
- select a.father, a.mother
- from coupled_ancestors a
- where a.father is not null and a.mother is not null
-),
-coupled_ancestors (id, name, dob, father, mother)
-as
-(
- select *
- from folks
- where name = 'Me'
- union all
- select p.*
- from folks p, ancestor_couple_ids fa
- where p.id = fa.h_id
- union all
- select p.*
- from folks p, ancestor_couple_ids ma
- where p.id = ma.w_id
-)
-select h.name, h.dob, w.name, w.dob
- from ancestor_couple_ids c, coupled_ancestors h, coupled_ancestors w
- where c.h_id = h.id and c.w_id= w.id;
-
-explain extended
-with recursive
-ancestor_couple_ids(h_id, w_id)
-as
-(
- select a.father, a.mother
- from coupled_ancestors a
- where a.father is not null and a.mother is not null
-),
-coupled_ancestors (id, name, dob, father, mother)
-as
-(
- select *
- from folks
- where name = 'Me'
- union all
- select p.*
- from folks p, ancestor_couple_ids fa
- where p.id = fa.h_id
- union all
- select p.*
- from folks p, ancestor_couple_ids ma
- where p.id = ma.w_id
-)
-select h.name, h.dob, w.name, w.dob
- from ancestor_couple_ids c, coupled_ancestors h, coupled_ancestors w
- where c.h_id = h.id and c.w_id= w.id;
-
-
---echo # simple mutual recursion
-with recursive
-ancestor_couple_ids(h_id, w_id)
-as
-(
- select a.father, a.mother
- from coupled_ancestors a
-),
-coupled_ancestors (id, name, dob, father, mother)
-as
-(
- select *
- from folks
- where name = 'Me'
- union all
- select p.*
- from folks p, ancestor_couple_ids fa
- where p.id = fa.h_id
- union all
- select p.*
- from folks p, ancestor_couple_ids ma
- where p.id = ma.w_id
-)
-select *
- from ancestor_couple_ids;
-
-
---echo # join of two mutually recursive tables
-with recursive
-ancestor_couple_ids(h_id, w_id)
-as
-(
- select a.father, a.mother
- from coupled_ancestors a
-),
-coupled_ancestors (id, name, dob, father, mother)
-as
-(
- select *
- from folks
- where name = 'Me'
- union all
- select p.*
- from folks p, ancestor_couple_ids fa
- where p.id = fa.h_id
- union all
- select p.*
- from folks p, ancestor_couple_ids ma
- where p.id = ma.w_id
-)
-select h.name, h.dob, w.name, w.dob
- from ancestor_couple_ids c, coupled_ancestors h, coupled_ancestors w
- where c.h_id = h.id and c.w_id= w.id;
-
-
---echo # execution of prepared query using a recursive table
-prepare stmt1 from "
-with recursive
-ancestors
-as
-(
- select *
- from folks
- where name = 'Me' and dob = '2000-01-01'
- union
- select p.id, p.name, p.dob, p.father, p.mother
- from folks as p, ancestors AS a
- where p.id = a.father or p.id = a.mother
-)
-select * from ancestors;
-";
-
-execute stmt1;
-execute stmt1;
-
-deallocate prepare stmt1;
-
-
---echo # view using a recursive table
-create view v1 as
-with recursive
-ancestors
-as
-(
- select *
- from folks
- where name = 'Me' and dob = '2000-01-01'
- union
- select p.id, p.name, p.dob, p.father, p.mother
- from folks as p, ancestors AS a
- where p.id = a.father or p.id = a.mother
-)
-select * from ancestors;
-
-show create view v1;
-
-select * from v1;
-
-create view v2 as
-with recursive
-ancestors
-as
-(
- select *
- from folks
- where name = 'Me'
- union
- select p.*
- from folks as p, ancestors as fa
- where p.id = fa.father
- union
- select p.*
- from folks as p, ancestors as ma
- where p.id = ma.mother
-)
-select * from ancestors;
-
-show create view v2;
-
-select * from v2;
-
-drop view v1,v2;
-
-
-explain extended
-with recursive
-ancestors
-as
-(
- select *
- from folks
- where name = 'Me' and dob = '2000-01-01'
- union
- select p.id, p.name, p.dob, p.father, p.mother
- from folks as p, ancestors AS a
- where p.id = a.father or p.id = a.mother
-)
-select * from ancestors;
-
-
---echo # recursive spec with two anchor selects and two recursive ones
-with recursive
-ancestor_ids (id)
-as
-(
- select father from folks where name = 'Me'
- union
- select mother from folks where name = 'Me'
- union
- select father from folks, ancestor_ids a where folks.id = a.id
- union
- select mother from folks, ancestor_ids a where folks.id = a.id
-),
-ancestors
-as
-(
- select p.* from folks as p, ancestor_ids as a
- where p.id = a.id
-)
-select * from ancestors;
-
-
---echo # recursive spec using union all
-with recursive
-ancestors
-as
-(
- select *
- from folks
- where name = 'Me'
- union all
- select p.*
- from folks as p, ancestors as fa
- where p.id = fa.father
- union all
- select p.*
- from folks as p, ancestors as ma
- where p.id = ma.mother
-)
-select * from ancestors;
-
-
---ERROR ER_NOT_STANDARD_COMPLIANT_RECURSIVE
-with recursive
-ancestor_ids (id, generation)
-as
-(
- select father, 1 from folks where name = 'Me' and father is not null
- union all
- select mother, 1 from folks where name = 'Me' and mother is not null
- union all
- select father, fa.generation+1 from folks, ancestor_ids fa
- where folks.id = fa.id and (father not in (select id from ancestor_ids))
- union all
- select mother, ma.generation+1 from folks, ancestor_ids ma
- where folks.id = ma.id and (mother not in (select id from ancestor_ids))
-)
-select generation, name from ancestor_ids a, folks
- where a.id = folks.id;
-
-set standard_compliant_cte=0;
-
---ERROR ER_WITH_COL_WRONG_LIST
-with recursive
-ancestor_ids (id, generation)
-as
-(
- select father from folks where name = 'Me' and father is not null
- union all
- select mother from folks where name = 'Me' and mother is not null
- union all
- select father, fa.generation+1 from folks, ancestor_ids fa
- where folks.id = fa.id and (father not in (select id from ancestor_ids))
- union all
- select mother, ma.generation+1 from folks, ancestor_ids ma
- where folks.id = ma.id and (mother not in (select id from ancestor_ids))
-)
-select generation, name from ancestor_ids a, folks
- where a.id = folks.id;
-
-with recursive
-ancestor_ids (id, generation)
-as
-(
- select father, 1 from folks where name = 'Me' and father is not null
- union all
- select mother, 1 from folks where name = 'Me' and mother is not null
- union all
- select father, fa.generation+1 from folks, ancestor_ids fa
- where folks.id = fa.id and father is not null and
- (father not in (select id from ancestor_ids))
- union all
- select mother, ma.generation+1 from folks, ancestor_ids ma
- where folks.id = ma.id and mother is not null and
- (mother not in (select id from ancestor_ids))
-)
-select generation, name from ancestor_ids a, folks
- where a.id = folks.id;
-
-set standard_compliant_cte=1;
-
---ERROR ER_NOT_STANDARD_COMPLIANT_RECURSIVE
-with recursive
-coupled_ancestor_ids (id)
-as
-(
- select father from folks where name = 'Me' and father is not null
- union
- select mother from folks where name = 'Me' and mother is not null
- union
- select n.father
- from folks, coupled_ancestor_ids fa, coupled_ancestor_ids ma, folks n
- where folks.father = fa.id and folks.mother = ma.id and
- (fa.id = n.id or ma.id = n.id) and
- n.father is not null and n.mother is not null
- union
- select n.mother
- from folks, coupled_ancestor_ids fa, coupled_ancestor_ids ma, folks n
- where folks.father = fa.id and folks.mother = ma.id and
- (fa.id = n.id or ma.id = n.id) and
- n.father is not null and n.mother is not null
-)
-select p.* from coupled_ancestor_ids a, folks p
- where a.id = p.id;
-
-set statement standard_compliant_cte=0 for
-with recursive
-coupled_ancestor_ids (id)
-as
-(
- select father from folks where name = 'Me' and father is not null
- union
- select mother from folks where name = 'Me' and mother is not null
- union
- select n.father
- from folks, coupled_ancestor_ids fa, coupled_ancestor_ids ma, folks n
- where folks.father = fa.id and folks.mother = ma.id and
- (fa.id = n.id or ma.id = n.id) and
- n.father is not null and n.mother is not null
- union
- select n.mother
- from folks, coupled_ancestor_ids fa, coupled_ancestor_ids ma, folks n
- where folks.father = fa.id and folks.mother = ma.id and
- (fa.id = n.id or ma.id = n.id) and
- n.father is not null and n.mother is not null
-)
-select p.* from coupled_ancestor_ids a, folks p
- where a.id = p.id;
-
---ERROR ER_NOT_STANDARD_COMPLIANT_RECURSIVE
-with recursive
-ancestor_ids (id)
-as
-(
- select father from folks where name = 'Me'
- union
- select mother from folks where name = 'Me'
- union
- select father from folks left join ancestor_ids a on folks.id = a.id
- union
- select mother from folks left join ancestor_ids a on folks.id = a.id
-),
-ancestors
-as
-(
- select p.* from folks as p, ancestor_ids as a
- where p.id = a.id
-)
-select * from ancestors;
-
-set statement standard_compliant_cte=0 for
-with recursive
-ancestor_ids (id)
-as
-(
- select father from folks where name = 'Me'
- union
- select mother from folks where name = 'Me'
- union
- select father from folks left join ancestor_ids a on folks.id = a.id
- union
- select mother from folks left join ancestor_ids a on folks.id = a.id
-),
-ancestors
-as
-(
- select p.* from folks as p, ancestor_ids as a
- where p.id = a.id
-)
-select * from ancestors;
-
-with recursive
-ancestor_ids (id, generation)
-as
-(
- select father, 1 from folks where name = 'Me'
- union
- select mother, 1 from folks where name = 'Me'
- union
- select father, a.generation+1 from folks, ancestor_ids a
- where folks.id = a.id
- union
- select mother, a.generation+1 from folks, ancestor_ids a
- where folks.id = a.id
-),
-ancestors
-as
-(
- select generation, name from folks as p, ancestor_ids as a
- where p.id = a.id
-)
-select * from ancestors;
-
---ERROR ER_NOT_STANDARD_COMPLIANT_RECURSIVE
-with recursive
-ancestor_ids (id, generation)
-as
-(
- select father, 1 from folks where name = 'Me'
- union
- select mother, 1 from folks where name = 'Me'
- union
- select max(father), max(a.generation)+1 from folks, ancestor_ids a
- where folks.id = a.id
- group by a.generation
- union
- select max(mother), max(a.generation)+1 from folks, ancestor_ids a
- where folks.id = a.id
- group by a.generation
-),
-ancestors
-as
-(
- select generation, name from folks as p, ancestor_ids as a
- where p.id = a.id
-)
-select * from ancestors;
-
-set statement standard_compliant_cte=0 for
-with recursive
-ancestor_ids (id, generation)
-as
-(
- select father, 1 from folks where name = 'Me'
- union
- select mother, 1 from folks where name = 'Me'
- union
- select max(father), a.generation+1 from folks, ancestor_ids a
- where folks.id = a.id
- group by a.generation
- union
- select max(mother), a.generation+1 from folks, ancestor_ids a
- where folks.id = a.id
- group by a.generation
-),
-ancestors
-as
-(
- select generation, name from folks as p, ancestor_ids as a
- where p.id = a.id
-)
-select * from ancestors;
-
-set statement max_recursive_iterations=1 for
-with recursive
-ancestor_ids (id, generation)
-as
-(
- select father, 1 from folks where name = 'Me'
- union
- select mother, 1 from folks where name = 'Me'
- union
- select father, a.generation+1 from folks, ancestor_ids a
- where folks.id = a.id
- union
- select mother, a.generation+1 from folks, ancestor_ids a
- where folks.id = a.id
-),
-ancestors
-as
-(
- select generation, name from folks as p, ancestor_ids as a
- where p.id = a.id
-)
-select * from ancestors;
-
---echo # query with recursive tables using key access
-
-alter table folks add primary key (id);
-
-explain
-with recursive
-ancestors
-as
-(
- select *
- from folks
- where name = 'Me'
- union
- select p.*
- from folks as p, ancestors as fa
- where p.id = fa.father
- union
- select p.*
- from folks as p, ancestors as ma
- where p.id = ma.mother
-)
-select * from ancestors;
-
-
-with recursive
-ancestors
-as
-(
- select *
- from folks
- where name = 'Me'
- union
- select p.*
- from folks as p, ancestors as fa
- where p.id = fa.father
- union
- select p.*
- from folks as p, ancestors as ma
- where p.id = ma.mother
-)
-select * from ancestors;
-
-
---echo #
---echo # EXPLAIN FORMAT=JSON on a query where one recursive CTE uses another:
---echo #
-explain
-with recursive
-prev_gen
-as
-(
- select folks.*
- from folks, prev_gen
- where folks.id=prev_gen.father or folks.id=prev_gen.mother
- union
- select *
- from folks
- where name='Me'
-),
-ancestors
-as
-(
- select *
- from folks
- where name='Me'
- union
- select *
- from ancestors
- union
- select *
- from prev_gen
-)
-select ancestors.name, ancestors.dob from ancestors;
-
-explain FORMAT=JSON
-with recursive
-prev_gen
-as
-(
- select folks.*
- from folks, prev_gen
- where folks.id=prev_gen.father or folks.id=prev_gen.mother
- union
- select *
- from folks
- where name='Me'
-),
-ancestors
-as
-(
- select *
- from folks
- where name='Me2'
- union
- select *
- from ancestors where id < 234
- union
- select *
- from prev_gen where id < 345
-)
-select ancestors.name, ancestors.dob from ancestors;
-
---echo #
-explain format=json
-with recursive
-ancestor_couples(h_id, h_name, h_dob, h_father, h_mother,
- w_id, w_name, w_dob, w_father, w_mother)
-as
-(
- select h.*, w.*
- from folks h, folks w, coupled_ancestors a
- where a.father = h.id AND a.mother = w.id
- union
- select h.*, w.*
- from folks v, folks h, folks w
- where v.name = 'Me' and
- (v.father = h.id AND v.mother= w.id)
-),
-coupled_ancestors (id, name, dob, father, mother)
-as
-(
- select h_id, h_name, h_dob, h_father, h_mother
- from ancestor_couples
- union all
- select w_id, w_name, w_dob, w_father, w_mother
- from ancestor_couples
-)
-select h_name, h_dob, w_name, w_dob
- from ancestor_couples;
-
-
-create table my_ancestors
-with recursive
-ancestor_ids (id)
-as
-(
- select father from folks where name = 'Me'
- union
- select mother from folks where name = 'Me'
- union
- select father from folks, ancestor_ids a where folks.id = a.id
- union
- select mother from folks, ancestor_ids a where folks.id = a.id
-)
-select p.* from folks as p, ancestor_ids as a where p.id = a.id;
-
-select * from my_ancestors;
-
-delete from my_ancestors;
-
-insert into my_ancestors
-with recursive
-ancestor_ids (id)
-as
-(
- select father from folks where name = 'Me'
- union
- select mother from folks where name = 'Me'
- union
- select father from folks, ancestor_ids a where folks.id = a.id
- union
- select mother from folks, ancestor_ids a where folks.id = a.id
-)
-select p.* from folks as p, ancestor_ids as a where p.id = a.id;
-
-select * from my_ancestors;
-
-drop table my_ancestors;
-
---echo #
---echo # MDEV-10883: execution of prepared statement from SELECT
---echo # with recursive CTE that renames columns
---echo #
-
-prepare stmt from"
-with recursive
-ancestor_ids (id)
-as
-(
- select father from folks where name = 'Me'
- union
- select mother from folks where name = 'Me'
- union
- select father from folks, ancestor_ids a where folks.id = a.id
- union
- select mother from folks, ancestor_ids a where folks.id = a.id
-)
-select p.* from folks as p, ancestor_ids as a where p.id = a.id;
-";
-execute stmt;
-deallocate prepare stmt;
-
---echo #
---echo # MDEV-10881: execution of prepared statement from
---echo # CREATE ... SELECT, INSERT ... SELECT
---echo #
-
-prepare stmt from"
-create table my_ancestors
-with recursive
-ancestor_ids (id)
-as
-(
- select father from folks where name = 'Me'
- union
- select mother from folks where name = 'Me'
- union
- select father from folks, ancestor_ids a where folks.id = a.id
- union
- select mother from folks, ancestor_ids a where folks.id = a.id
-)
-select p.* from folks as p, ancestor_ids as a where p.id = a.id;
-";
-execute stmt;
-deallocate prepare stmt;
-select * from my_ancestors;
-
-delete from my_ancestors;
-
-prepare stmt from"
-insert into my_ancestors
-with recursive
-ancestor_ids (id)
-as
-(
- select father from folks where name = 'Me'
- union
- select mother from folks where name = 'Me'
- union
- select father from folks, ancestor_ids a where folks.id = a.id
- union
- select mother from folks, ancestor_ids a where folks.id = a.id
-)
-select p.* from folks as p, ancestor_ids as a where p.id = a.id;
-";
-execute stmt;
-deallocate prepare stmt;
-select * from my_ancestors;
-
-drop table my_ancestors;
-
---echo #
---echo # MDEV-10933: WITH clause together with SELECT in parenthesis
---echo # CREATE SELECT
---echo #
-
-create table my_ancestors
-(
-with recursive
-ancestor_ids (id)
-as
-(
- select father from folks where name = 'Me'
- union
- select mother from folks where name = 'Me'
- union
- select father from folks, ancestor_ids a where folks.id = a.id
- union
- select mother from folks, ancestor_ids a where folks.id = a.id
-)
-select p.* from folks as p, ancestor_ids as a where p.id = a.id
-);
-select * from my_ancestors;
-drop table my_ancestors;
-
-drop table folks;
-
---echo #
---echo # MDEV-10372: [bb-10.2-mdev9864 tree] EXPLAIN with recursive CTE enters endless recursion
---echo #
-create table t1(a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-explain format=json
-with recursive t as (select a from t1 union select a+10 from t where a < 1000)
-select * from t;
-
-drop table t1;
-
-
---echo #
---echo # MDEV-10737: recursive union with several anchors at the end
---echo #
-
-WITH RECURSIVE cte(n) AS
- ( SELECT n+1 FROM cte WHERE n < 5 UNION SELECT 1 UNION SELECT 1 )
-SELECT * FROM cte;
-
---echo #
---echo # MDEV-10736: recursive definition with anchor over a table with blob
---echo #
-
-CREATE TABLE t1 (f VARCHAR(1024));
-WITH RECURSIVE cte(f) AS
- (SELECT t1.f FROM t1 UNION ALL SELECT cte.f FROM cte)
-SELECT * FROM cte as t;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-10899: mergeable derived in the spec of recursive CTE
---echo #
-
-create table t1 (a int);
-insert into t1 values
- (0), (1), (2), (3), (4);
-create table t2 (a int);
-insert into t2 values
- (1), (2), (3), (4), (5);
-
-with recursive
-t1 as
-(
-select x.a from (select a from t2 where t2.a=3) x
-union
-select t2.a from t1,t2 where t1.a+1=t2.a
-)
-select * from t1;
-
-explain
-with recursive
-t1 as
-(
-select x.a from (select a from t2 where t2.a=3) x
-union
-select t2.a from t1,t2 where t1.a+1=t2.a
-)
-select * from t1;
-
-drop table t1,t2;
-
---echo #
---echo # MDEV-11278: non-mergeable view in the spec of recursive CTE
---echo #
-
-create table t1 (a int);
-insert into t1 values
- (0), (1), (2), (3), (4);
-create table t2 (a int);
-insert into t2 values
- (1), (2), (3), (4), (5);
-
-create view v1 as
- select a from t2 where a < 3
- union
- select a from t2 where a > 4;
-
-with recursive
-t1 as
-(
-select a from v1 where a=1
-union
-select v1.a from t1,v1 where t1.a+1=v1.a
-)
-select * from t1;
-
-drop view v1;
-drop table t1,t2;
-
-
---echo #
---echo # MDEV-11259: recursive CTE with concatenation operation
---echo #
-
-DROP TABLE IF EXISTS edges;
-CREATE TABLE edges(
- a int(10) unsigned NOT NULL,
- b int(10) unsigned NOT NULL,
- PRIMARY KEY (a,b),
- KEY b(b)
-);
-
-INSERT INTO edges
- VALUES (1,3),(2,1),(2,4),(3,4),(3,5),(3,6),(4,7),(5,1),(5,6),(6,1);
-
-DROP TABLE IF EXISTS edges2;
-CREATE VIEW edges2 (a, b) AS
- SELECT a, b FROM edges UNION ALL SELECT b, a FROM edges;
-
---sorted_result
-WITH RECURSIVE transitive_closure(a, b, distance, path_string) AS
-( SELECT a, b, 1 AS distance,
- concat(a, '.', b, '.') AS path_string
- FROM edges
-
- UNION ALL
-
- SELECT tc.a, e.b, tc.distance + 1,
- concat(tc.path_string, e.b, '.') AS path_string
- FROM edges AS e
- JOIN transitive_closure AS tc
- ON e.a = tc.b
- WHERE tc.path_string NOT LIKE concat('%', e.b, '.%')
-)
-SELECT * FROM transitive_closure
-ORDER BY a, b, distance;
-
---sorted_result
-WITH RECURSIVE transitive_closure(a, b, distance, path_string) AS
-( SELECT a, b, 1 AS distance,
- concat(a, '.', b, '.') AS path_string
- FROM edges
- WHERE a = 1 -- source
-
- UNION ALL
-
- SELECT tc.a, e.b, tc.distance + 1,
- concat(tc.path_string, e.b, '.') AS path_string
- FROM edges AS e
- JOIN transitive_closure AS tc ON e.a = tc.b
- WHERE tc.path_string NOT LIKE concat('%', e.b, '.%')
-)
- SELECT * FROM transitive_closure
- WHERE b = 6 -- destination
-ORDER BY a, b, distance;
-
---sorted_result
-WITH RECURSIVE transitive_closure(a, b, distance, path_string) AS
-( SELECT a, b, 1 AS distance,
- concat(a, '.', b, '.') AS path_string
- FROM edges2
-
- UNION ALL
-
- SELECT tc.a, e.b, tc.distance + 1,
- concat(tc.path_string, e.b, '.') AS path_string
- FROM edges2 AS e
- JOIN transitive_closure AS tc ON e.a = tc.b
- WHERE tc.path_string NOT LIKE concat('%', e.b, '.%')
-)
-SELECT * FROM transitive_closure
-ORDER BY a, b, distance;
-
---sorted_result
-WITH RECURSIVE transitive_closure(a, b, distance, path_string)
-AS
-( SELECT a, b, 1 AS distance,
- concat(a, '.', b, '.') AS path_string
- FROM edges2
-
- UNION ALL
-
- SELECT tc.a, e.b, tc.distance + 1,
- concat(tc.path_string, e.b, '.') AS path_string
- FROM edges2 AS e
- JOIN transitive_closure AS tc ON e.a = tc.b
- WHERE tc.path_string NOT LIKE concat('%', e.b, '.%')
-)
-SELECT a, b, min(distance) AS dist FROM transitive_closure
-GROUP BY a, b
-ORDER BY a, dist, b;
-
-DROP VIEW edges2;
-DROP TABLE edges;
-
-
---echo #
---echo # MDEV-11674: recursive CTE table that cannot be stored
---echo # in a heap table
---echo #
-
-create table t1 (id int, test_data varchar(36));
-
-insert into t1(id, test_data)
-select id, test_data
- from (
- with recursive data_generator(id, test_data) as (
- select 1 as id, uuid() as test_data
- union all
- select id + 1, uuid() from data_generator where id < 150000
- )
- select * from data_generator
- ) as a;
-
-drop table t1;
-
---echo #
---echo # MDEV-10773: ANALYZE for query with recursive CTE
---echo #
-
---source include/analyze-format.inc
-analyze format=json
-with recursive src(counter) as
-(select 1
- union
- select counter+1 from src where counter<10
-) select * from src;
-
---echo #
---echo # mdev-12360: recursive reference in left operand of LEFT JOIN
---echo #
-
-create table folks(id int, name char(32), dob date, father int, mother int);
-
-insert into folks values
-(100, 'Me', '2000-01-01', 20, 30),
-(20, 'Dad', '1970-02-02', 10, 9),
-(30, 'Mom', '1975-03-03', 8, 7),
-(10, 'Grandpa Bill', '1940-04-05', null, null),
-(9, 'Grandma Ann', '1941-10-15', null, null),
-(25, 'Uncle Jim', '1968-11-18', 8, 7),
-(98, 'Sister Amy', '2001-06-20', 20, 30),
-(7, 'Grandma Sally', '1943-08-23', null, 6),
-(8, 'Grandpa Ben', '1940-10-21', null, null),
-(6, 'Grandgrandma Martha', '1923-05-17', null, null),
-(67, 'Cousin Eddie', '1992-02-28', 25, 27),
-(27, 'Auntie Melinda', '1971-03-29', null, null);
-
-with recursive
-ancestor_ids (id)
-as
-(
- select father from folks where name = 'Me'
- union
- select mother from folks where name = 'Me'
- union
- select father from ancestor_ids as a left join folks on folks.id = a.id
- union
- select mother from ancestor_ids as a left join folks on folks.id = a.id
-),
-ancestors
-as
-(
- select p.* from folks as p, ancestor_ids as a
- where p.id = a.id
-)
-select * from ancestors;
-
-drop table folks;
-
---echo #
---echo # mdev-12368: crash with mutually recursive CTE
---echo # that arenot Standard compliant
---echo #
-
-create table value_nodes (v char(4));
-create table module_nodes(m char(4));
-create table module_arguments(m char(4), v char(4));
-create table module_results(m char(4), v char(4));
-
---ERROR ER_NOT_STANDARD_COMPLIANT_RECURSIVE
-with recursive
-reached_values as
-(
- select v from value_nodes where v in ('v3','v7','v9')
- union
- select module_results.v from module_results, applied_modules
- where module_results.m = applied_modules.m
-),
-applied_modules as
-(
- select module_nodes.m
- from
- module_nodes
- left join
- (
- module_arguments
- left join
- reached_values
- on module_arguments.v = reached_values.v
- )
- on reached_values.v is null and
- module_nodes.m = module_arguments.m
- where module_arguments.m is null
-)
-select * from reached_values;
-
-drop table value_nodes, module_nodes, module_arguments, module_results;
-
---echo #
---echo # mdev-12375: query using one of two mutually recursive CTEs
---echo # whose non-recursive part returns an empty set
---echo #
-
-create table value_nodes (v char(4));
-insert into value_nodes values
- ('v1'), ('v2'), ('v3'), ('v4'), ('v5'), ('v6'), ('v7'), ('v8'), ('v9'),
- ('v10'), ('v11'), ('v12'), ('v13'), ('v14'), ('v15'), ('v16');
-create table module_nodes(m char(4));
-insert into module_nodes values
- ('m1'), ('m2'), ('m3'), ('m4'), ('m5'), ('m6'), ('m7');
-create table module_arguments(m char(4), v char(4));
-insert into module_arguments values
- ('m1','v3'), ('m1','v9'),
- ('m2','v4'), ('m2','v3'), ('m2','v7'),
- ('m3','v6'),
- ('m4','v4'), ('m4','v1'),
- ('m5','v10'), ('m5','v8'), ('m5','v3'),
- ('m6','v8'), ('m6','v1'),
- ('m7','v11'), ('m7','v12');
-create table module_results(m char(4), v char(4));
-insert into module_results values
- ('m1','v4'),
- ('m2','v1'), ('m2','v6'),
- ('m3','v10'),
- ('m4','v8'),
- ('m5','v11'), ('m5','v9'),
- ('m6','v12'), ('m6','v4'),
- ('m7','v2');
-
-set statement max_recursive_iterations=2, standard_compliant_cte=0 for
-with recursive
-reached_values as
-(
- select v from value_nodes where v in ('v3','v7','v9')
- union
- select module_results.v from module_results, applied_modules
- where module_results.m = applied_modules.m
-),
-applied_modules as
-(
- select * from module_nodes where 1=0
- union
- select module_nodes.m
- from
- module_nodes
- left join
- (
- module_arguments
- left join
- reached_values
- on module_arguments.v = reached_values.v
- )
- on reached_values.v is null and
- module_nodes.m = module_arguments.m
- where module_arguments.m is null
-)
-select * from applied_modules;
-
-drop table value_nodes, module_nodes, module_arguments, module_results;
-
---echo #
---echo # mdev-12519: recursive references in subqueries
---echo #
-
-create table t1 (lp char(4) not null, rp char(4) not null);
-insert into t1 values
- ('p1','p2'), ('p2','p3'), ('p3','p4'), ('p4','p5'),
- ('p2','p7'), ('p7','p8'), ('p8','p3'), ('p8','p4');
-
-set standard_compliant_cte=0;
-
-with recursive
-reachables(p) as
-(
- select lp from t1 where lp = 'p1'
- union
- select t1.rp from reachables, t1
- where t1.lp = reachables.p
-)
-select * from reachables;
-
-with recursive
-reachables(p) as
-(
- select lp from t1 where lp = 'p1'
- union
- select t1.rp from reachables, t1
- where 'p3' not in (select * from reachables) and
- t1.lp = reachables.p
-)
-select * from reachables;
-
-with recursive
-reachables(p) as
-(
- select lp from t1 where lp = 'p1'
- union
- select t1.rp from reachables, t1
- where 'p3' not in (select p from reachables where p <= 'p5'
- union
- select p from reachables where p > 'p5') and
- t1.lp = reachables.p
-)
-select * from reachables;
-
-prepare stmt from "
-with recursive
-reachables(p) as
-(
- select lp from t1 where lp = 'p1'
- union
- select t1.rp from reachables, t1
- where 'p3' not in (select p from reachables where p <= 'p5'
- union
- select p from reachables where p > 'p5') and
- t1.lp = reachables.p
-)
-select * from reachables;
-";
-
-execute stmt;
-execute stmt;
-
-deallocate prepare stmt;
-
-drop table t1;
-
-create table objects(v char(4) not null);
-insert into objects values
- ('v1'), ('v2'), ('v3'), ('v4'), ('v5'),
- ('v6'), ('v7'), ('v8'), ('v9'), ('v10');
-
-create table modules(m char(4) not null);
-insert into modules values
- ('m1'), ('m2'), ('m3'), ('m4');
-
-create table module_arguments(m char(4) not null, v char(4) not null);
-insert into module_arguments values
- ('m1','v3'), ('m1','v9'),
- ('m2','v4'), ('m2','v7'),
- ('m3','v6'), ('m4','v2');
-
-create table module_results(m char(4) not null, v char(4) not null);
-insert into module_results values
- ('m1','v4'),
- ('m2','v1'), ('m2','v6'),
- ('m3','v10'), ('m4','v7');
-
-set standard_compliant_cte=0;
-
-with recursive
-reached_objects as
-(
- select v, 'init' as m from objects where v in ('v3','v7','v9')
- union
- select module_results.v, module_results.m from module_results, applied_modules
- where module_results.m = applied_modules.m
-),
-applied_modules as
-(
- select * from modules where 1=0
- union
- select modules.m
- from
- modules
- where
- not exists (select * from module_arguments
- where module_arguments.m = modules.m and
- module_arguments.v not in
- (select v from reached_objects))
-)
-select * from reached_objects;
-
-with recursive
-reached_objects as
-(
- select v, 'init' as m from objects where v in ('v3','v7','v9')
- union
- select module_results.v, module_results.m from module_results, applied_modules
- where module_results.m = applied_modules.m
-),
-applied_modules as
-(
- select * from modules where 1=0
- union
- select modules.m
- from
- modules
- where
- 'v6' not in (select v from reached_objects) and
- not exists (select * from module_arguments
- where module_arguments.m = modules.m and
- module_arguments.v not in
- (select v from reached_objects))
-)
-select * from reached_objects;
-
-prepare stmt from "
-with recursive
-reached_objects as
-(
- select v, 'init' as m from objects where v in ('v3','v7','v9')
- union
- select module_results.v, module_results.m from module_results, applied_modules
- where module_results.m = applied_modules.m
-),
-applied_modules as
-(
- select * from modules where 1=0
- union
- select modules.m
- from
- modules
- where
- 'v6' not in (select v from reached_objects) and
- not exists (select * from module_arguments
- where module_arguments.m = modules.m and
- module_arguments.v not in
- (select v from reached_objects))
-)
-select * from reached_objects;
-";
-
-execute stmt;
-execute stmt;
-
-deallocate prepare stmt;
-
-drop table objects, modules, module_arguments, module_results;
-
-set standard_compliant_cte=default;
-select @@standard_compliant_cte;
-
---echo #
---echo # mdev-12554: impossible where in recursive select
---echo #
-
-CREATE TABLE t1 (i int);
-INSERT INTO t1 VALUES (1),(2);
-
-WITH RECURSIVE
-cte(f) AS ( SELECT i FROM t1 UNION SELECT f FROM t1, cte WHERE 1=0 )
-SELECT * FROM cte;
-
-DROP TABLE t1;
-
---echo #
---echo # mdev-12556: recursive execution uses Aria temporary tables
---echo #
-
-CREATE TABLE t (c1 varchar(255), c2 tinytext);
-INSERT INTO t VALUES ('a','a'),('b','b'),('c','c'),('d','d');
-
-let $q1=
-WITH RECURSIVE cte(f) AS (
- SELECT c1 FROM t
- UNION
- SELECT c1 FROM t, cte
-) SELECT COUNT(*) FROM cte;
-
-let $q2=
-WITH RECURSIVE cte(f) AS (
- SELECT c2 FROM t
- UNION
- SELECT c2 FROM t, cte
-) SELECT COUNT(*) FROM cte;
-
-eval ANALYZE $q1;
-eval $q1;
-
-eval ANALYZE $q2;
-eval $q2;
-
-DROP TABLE t;
-
---echo #
---echo # mdev-12563: no recursive references on the top level of the CTE spec
---echo #
-
-CREATE TABLE t (i int);
-INSERT INTO t VALUES (3), (1),(2);
-
-SET standard_compliant_cte=0;
-
-WITH RECURSIVE cte(f) AS (
- SELECT i FROM t
- UNION
- SELECT i FROM t WHERE i NOT IN ( SELECT * FROM cte )
-) SELECT * FROM cte;
-
-WITH RECURSIVE cte(f) AS (
- SELECT i FROM t
- UNION
- SELECT i FROM t WHERE i NOT IN ( SELECT * FROM cte WHERE i < 2 )
- UNION
- SELECT i FROM t WHERE i NOT IN ( SELECT * FROM cte WHERE i > 2 )
-) SELECT * FROM cte;
-
-WITH RECURSIVE cte(f) AS (
- SELECT i FROM t
- UNION
- SELECT i FROM t
- WHERE i NOT IN ( SELECT * FROM cte WHERE i < 2
- UNION
- SELECT * FROM cte WHERE i > 2)
-) SELECT * FROM cte;
-
-WITH RECURSIVE cte(f) AS (
- SELECT i FROM t
- UNION
- SELECT i FROM t
- WHERE i NOT IN ( SELECT * FROM t
- WHERE i IN ( SELECT * FROM cte ) GROUP BY i )
-) SELECT * FROM cte;
-
-WITH RECURSIVE cte(f) AS (
- SELECT i FROM t
- UNION
- SELECT i FROM t WHERE i NOT IN ( SELECT * FROM cte )
- UNION
- SELECT * FROM cte WHERE f > 2
-) SELECT * FROM cte;
-
-set standard_compliant_cte=default;
-
-DROP TABLE t;
-
---echo #
---echo # mdev-14184: recursive CTE embedded into CTE with multiple references
---echo #
-
-WITH
-cte1 AS (
- SELECT n FROM (
- WITH RECURSIVE rec_cte(n) AS (
- SELECT 1 as n1
- UNION ALL
- SELECT n+1 as n2 FROM rec_cte WHERE n < 3
- ) SELECT n FROM rec_cte
- ) AS X
-),
-cte2 as (
- SELECT 2 FROM cte1
-)
-SELECT *
-FROM cte1;
-
---echo #
---echo # mdev-14629: a user-defined variable is defined by the recursive CTE
---echo #
-
-set @var=
-(
- with recursive cte_tab(a) as (
- select 1
- union
- select a+1 from cte_tab
- where a<3)
- select count(*) from cte_tab
-);
-
-select @var;
-
-create table t1(a int, b int);
-insert into t1 values (3,8),(1,5),(5,7),(7,4),(4,3);
-
-set @var=
-(
- with recursive summ(a,s) as (
- select 1, 0 union
- select t1.b, t1.b+summ.s from summ, t1
- where summ.a=t1.a)
- select s from summ
- order by a desc
- limit 1
-);
-
-select @var;
-
---ERROR ER_UNACCEPTABLE_MUTUAL_RECURSION
-set @var=
-(
- with recursive
- cte_1 as (
- select 1
- union
- select * from cte_2),
- cte_2 as (
- select * from cte_1
- union
- select a from t1, cte_2
- where t1.a=cte_2.a)
- select * from cte_2
- limit 1
-);
-
-drop table t1;
-
---echo #
---echo # mdev-14777: crash caused by the same as in mdev-14755
---echo #
-
---source include/have_sequence.inc
-
-CREATE TABLE t1 (i1 int NOT NULL, i2 int);
-CREATE TABLE t2 (d1 int NOT NULL PRIMARY KEY);
-CREATE TABLE t3 (i int );
-
-insert into t1 select seq,seq from seq_1_to_100000;
-insert into t2 select seq from seq_1000_to_100000;
-insert into t3 select seq from seq_1_to_1000;
-
-SELECT *
-FROM
-(
- SELECT *
- FROM
- (
- WITH RECURSIVE rt AS
- (
- SELECT i2 P, i1 C FROM t1 WHERE i1 IN (SELECT d1 FROM t2)
- UNION
- SELECT t1.i2 P, rt.C C FROM t1, rt
- )
- SELECT C,P
- FROM ( SELECT P,C FROM rt WHERE NOT EXISTS (SELECT 1 FROM t1) ) Y
- ) X
- WHERE 1 = 1
-) K, t3;
-
-drop table t1,t2,t3;
-
---echo #
---echo # mdev-14879: subquery with recursive reference in WHERE of CTE
---echo #
-
-create table flights
-(departure varchar(32),
- arrival varchar(32),
- carrier varchar(20),
- flight_number char(7));
-
-insert into flights values
-('Seattle', 'Frankfurt', 'Lufthansa', 'LH 491'),
-('Seattle', 'Chicago', 'American', 'AA 2573'),
-('Seattle', 'Los Angeles', 'Alaska Air', 'AS 410'),
-('Chicago', 'New York', 'American', 'AA 375'),
-('Chicago', 'Montreal', 'Air Canada', 'AC 3053'),
-('Los Angeles', 'New York', 'Delta', 'DL 1197'),
-('Moscow', 'Tokyo', 'Aeroflot', 'SU 264'),
-('New York', 'Paris', 'Air France', 'AF 23'),
-('Frankfurt', 'Moscow', 'Lufthansa', 'LH 1444'),
-('Tokyo', 'Seattle', 'ANA', 'NH 178'),
-('Los Angeles', 'Tokyo', 'ANA', 'NH 175'),
-('Moscow', 'Los Angeles', 'Aeroflot', 'SU 106'),
-('Montreal', 'Paris', 'Air Canada', 'AC 870'),
-('Cairo', 'Paris', 'Air France', 'AF 503'),
-('New York', 'Seattle', 'American', 'AA 45'),
-('Paris', 'Chicago', 'Air France', 'AF 6734');
-
-with recursive destinations (city) as
-( select a.arrival from flights a where a.departure='Cairo'
- union
- select b.arrival from destinations r, flights b where r.city=b.departure)
-select * from destinations;
-
-set standard_compliant_cte=0;
-
-let $q=
-with recursive destinations (city, legs) as
-(
- select a.arrival, 1 from flights a where a.departure='Cairo'
- union
- select b.arrival, r.legs + 1 from destinations r, flights b
- where r.city=b.departure and b.arrival not in (select city from destinations)
-)
-select * from destinations;
-
-eval $q;
-eval explain extended $q;
-
-set standard_compliant_cte=default;
-
-drop table flights;
-
---echo #
---echo # MDEV-15162: Setting user variable in recursive CTE
---echo #
-
-SET @c=1;
-
-WITH RECURSIVE cte AS
- (SELECT 5
- UNION
- SELECT @c:=@c+1 FROM cte WHERE @c<3)
-SELECT * FROM cte;
-
-
---echo #
---echo # MDEV-14217 [db crash] Recursive CTE when SELECT includes new field
---echo #
-
-CREATE TEMPORARY TABLE a_tbl (
- a VARCHAR(33) PRIMARY KEY,
- b VARCHAR(33)
-);
-
-INSERT INTO a_tbl VALUES ('block0', 'block0'), ('block1', NULL);
-
---error ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT
-WITH RECURSIVE Q0 AS (
- SELECT T0.a, T0.b, 5
- FROM a_tbl T0
- WHERE b IS NULL
- UNION ALL
- SELECT T1.a, T1.b
- FROM Q0
- JOIN a_tbl T1
- ON T1.a=Q0.a
-) SELECT distinct(Q0.a), Q0.b
- FROM Q0;
-DROP TABLE a_tbl;
-
---error ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT
-WITH RECURSIVE x AS (SELECT 1,2 UNION ALL SELECT 1 FROM x) SELECT * FROM x;
-
---echo #
---echo # MDEV-15162: Setting user variable in recursive CTE
---echo #
-
-SET @c=1;
-
-WITH RECURSIVE cte AS
- (SELECT 5
- UNION
- SELECT @c:=@c+1 FROM cte WHERE @c<3)
-SELECT * FROM cte;
-
---echo #
---echo # MDEV-14883: recursive references in operands of INTERSECT / EXCEPT
---echo #
-
-create table flights
-(departure varchar(32),
- arrival varchar(32),
- carrier varchar(20),
- flight_number char(7));
-
-insert into flights values
-('Seattle', 'Frankfurt', 'Lufthansa', 'LH 491'),
-('Seattle', 'Amsterdam', 'KLM', 'KL 6032'),
-('Seattle', 'Chicago', 'American', 'AA 2573'),
-('Seattle', 'Los Angeles', 'Alaska Air', 'AS 410'),
-('Chicago', 'New York', 'American', 'AA 375'),
-('Chicago', 'Montreal', 'Air Canada', 'AC 3053'),
-('Los Angeles', 'New York', 'Delta', 'DL 1197'),
-('New York', 'London', 'British Airways', 'BA 1511'),
-('London', 'Moscow', 'British Airways', 'BA 233'),
-('Moscow', 'Tokyo', 'Aeroflot', 'SU 264'),
-('Moscow', 'Dubai', 'Emirates', 'EK 2421'),
-('Dubai', 'Tokyo', 'Emirates', 'EK 318'),
-('Dubai', 'Bangkok', 'Emirates', 'EK 2142'),
-('Beijing', 'Bangkok', 'Air China', 'CA 757'),
-('Beijing', 'Tokyo', 'Air China', 'CA 6653'),
-('Moscow', 'Bangkok', 'Aeroflot', 'SU 270'),
-('New York', 'Reykjavik', 'Icelandair', 'FL 416'),
-('New York', 'Paris', 'Air France', 'AF 23'),
-('Amsterdam', 'Moscow', 'KLM', 'KL 903'),
-('Frankfurt', 'Dubai', 'Lufthansa', 'LH 630'),
-('Frankfurt', 'Moscow', 'Lufthansa', 'LH 1444'),
-('Reykjavik', 'London', 'British Airways', 'BA 2229'),
-('Frankfurt', 'Beijing', 'Air China', 'CA 966'),
-('Tokyo', 'Seattle', 'ANA', 'NH 178'),
-('Los Angeles', 'Tokyo', 'ANA', 'NH 175'),
-('Moscow', 'Los Angeles', 'Aeroflot', 'SU 106'),
-('Montreal', 'Paris', 'Air Canada', 'AC 870'),
-('London', 'Delhi', 'British Airways', 'BA 143'),
-('Delhi', 'Bangkok', 'Air India', 'AI 306'),
-('Delhi', 'Dubai', 'Air India', 'AI 995'),
-('Dubai', 'Cairo', 'Emirates', 'EK 927'),
-('Cairo', 'Paris', 'Air France', 'AF 503'),
-('Amsterdam', 'New York', 'Delta', 'DL 47'),
-('New York', 'Seattle', 'American', 'AA 45'),
-('Paris', 'Chicago', 'Air France', 'AF 6734');
-
-create table distances
-(city1 varchar(32),
- city2 varchar(32),
- dist int);
-
-insert into distances values
-('Seattle', 'Frankfurt', 5080),
-('Seattle', 'Amsterdam', 4859),
-('Seattle', 'Chicago', 1733),
-('Seattle', 'Los Angeles', 960),
-('Chicago', 'New York', 712),
-('Chicago', 'Montreal', 746),
-('Los Angeles', 'New York', 2446),
-('New York', 'London', 3459),
-('London', 'Moscow', 1554),
-('Moscow', 'Tokyo', 4647),
-('Moscow', 'Dubai', 2298),
-('Dubai', 'Tokyo', 4929),
-('Dubai', 'Bangkok', 3050),
-('Beijing', 'Bangkok', 2046),
-('Beijing', 'Tokyo', 1301),
-('Moscow', 'Bangkok', 4390),
-('New York', 'Reykjavik', 2613),
-('New York', 'Paris', 3625),
-('Amsterdam', 'Moscow', 1334),
-('Frankfurt', 'Dubai', 3003),
-('Frankfurt', 'Moscow', 1256),
-('Reykjavik', 'London', 1173),
-('Frankfurt', 'Beijing', 4836),
-('Tokyo', 'Seattle', 4783),
-('Los Angeles', 'Tokyo', 5479),
-('Moscow', 'Los Angeles', 6071),
-('Moscow', 'Reykjavik', 2052),
-('Montreal', 'Paris', 3425),
-('London', 'Delhi', 4159),
-('London', 'Paris', 214),
-('Delhi', 'Bangkok', 1810),
-('Delhi', 'Dubai', 1369),
-('Delhi', 'Beijing', 2350),
-('Dubai', 'Cairo', 1501),
-('Cairo', 'Paris', 1992),
-('Amsterdam', 'New York', 3643),
-('New York', 'Seattle', 2402),
-('Paris', 'Chicago', 4136),
-('Paris', 'Los Angeles', 5647);
-
-with recursive destinations (city) as
-(
- select a.arrival from flights a where a.departure = 'Seattle'
- union
- select b.arrival from destinations r, flights b where r.city = b.departure
-)
-select * from destinations;
-
-with recursive destinations (city) as
-(
- select a.arrival from flights a, distances d
- where a.departure = 'Seattle' and
- a.departure = d.city1 and a.arrival = d.city2 and
- d.dist < 4000
- union
- select b.arrival from destinations r, flights b, distances d
- where r.city = b.departure and
- b.departure = d.city1 and b.arrival = d.city2 and
- d.dist < 4000
-)
-select * from destinations;
-
-set standard_compliant_cte=0;
-
-with recursive legs_to_destinations
- (departure, arrival, dist, leg_no, acc_mileage) as
-(
- select a.departure, a.arrival, d.dist, 1, d.dist
- from flights a, distances d
- where a.departure = 'Seattle' and
- a.departure = d.city1 and a.arrival = d.city2 and
- d.dist < 4000
- union all
- select b.departure, b.arrival, d.dist, r.leg_no + 1, r.acc_mileage + d.dist
- from legs_to_destinations r, flights b, distances d
- where r.arrival = b.departure and
- b.departure = d.city1 and b.arrival = d.city2 and
- d.dist < 4000 and
- b.arrival not in (select arrival from legs_to_destinations)
-)
-select * from legs_to_destinations;
-
-set standard_compliant_cte=default;
-
-with recursive destinations (city) as
-(
- select a.arrival from flights a, distances d
- where a.departure = 'Seattle' and
- a.departure = d.city1 and a.arrival = d.city2 and
- d.dist < 4000
- union
- select b.arrival from destinations r, flights b
- where r.city = b.departure
- intersect
- select city2 from destinations s, distances d
- where s.city = d.city1 and d.dist < 4000
-)
-select * from destinations;
-
-with recursive destinations (city) as
-(
- select a.arrival from flights a where a.departure = 'Seattle'
- union
- select * from
- (
- select b.arrival from destinations r, flights b
- where r.city = b.departure
- except
- select arrival from flights
- where arrival in
- ('New York', 'London', 'Moscow', 'Dubai', 'Cairo', 'Tokyo')
- ) t
-)
-select * from destinations;
-
-drop table flights, distances;
diff --git a/mysql-test/t/ctype_ascii.test b/mysql-test/t/ctype_ascii.test
deleted file mode 100644
index 2a5118c7d34..00000000000
--- a/mysql-test/t/ctype_ascii.test
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# Bug #27562: ascii.xml invalid?
-#
-set names ascii;
-select 'e'='`';
-select 'y'='~';
-create table t1 (a char(1) character set ascii);
-insert into t1 (a) values (' '), ('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'), ('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'), ('!'), ('@'), ('#'), ('$'), ('%'), ('^'), ('&'), ('*'), ('('), (')'), ('_'), ('+'), ('`'), ('~'), ('1'), ('2'), ('3'), ('4'), ('5'), ('6'), ('7'), ('8'), ('9'), ('0'), ('['), (']'), ('\\'), ('|'), ('}'), ('{'), ('"'), (':'), (''''), (';'), ('/'), ('.'), (','), ('?'), ('>'), ('<'), ('\n'), ('\t'), ('\a'), ('\f'), ('\v');
-select t1a.a, t1b.a from t1 as t1a, t1 as t1b where t1a.a=t1b.a order by binary t1a.a, binary t1b.a;
-drop table t1;
-
-#
---echo End of 5.0 tests.
diff --git a/mysql-test/t/ctype_big5.test b/mysql-test/t/ctype_big5.test
deleted file mode 100644
index 410203c7c86..00000000000
--- a/mysql-test/t/ctype_big5.test
+++ /dev/null
@@ -1,271 +0,0 @@
--- source include/have_big5.inc
-
-#
-# Tests with the big5 character set
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-SET @test_character_set= 'big5';
-SET @test_collation= 'big5_chinese_ci';
--- source include/ctype_common.inc
-
-SET NAMES big5;
-SET collation_connection='big5_chinese_ci';
--- source include/ctype_filesort.inc
--- source include/ctype_innodb_like.inc
--- source include/ctype_like_escape.inc
--- source include/ctype_like_range_f1f2.inc
--- source include/ctype_ascii_order.inc
--- source include/ctype_pad_space.inc
-SET collation_connection='big5_bin';
--- source include/ctype_filesort.inc
--- source include/ctype_innodb_like.inc
--- source include/ctype_like_escape.inc
--- source include/ctype_like_range_f1f2.inc
--- source include/ctype_pad_space.inc
-
-#
-# Bugs#9357: TEXT columns break string with special word in BIG5 charset.
-#
-SET NAMES big5;
-CREATE TABLE t1 (a text) character set big5;
-INSERT INTO t1 VALUES ('');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-#
-# BUG#12075 - FULLTEXT non-functional for big5 strings
-#
-CREATE TABLE t1 (a CHAR(50) CHARACTER SET big5 NOT NULL, FULLTEXT(a));
-INSERT INTO t1 VALUES(0xA741ADCCA66EB6DC20A7DAADCCABDCA66E);
-SELECT HEX(a) FROM t1 WHERE MATCH(a) AGAINST (0xA741ADCCA66EB6DC IN BOOLEAN MODE);
-DROP TABLE t1;
-
-#
-# Bug#12476 Some big5 codes are still missing.
-#
-set names big5;
-create table t1 (a char character set big5);
-insert into t1 values (0xF9D6),(0xF9D7),(0xF9D8),(0xF9D9);
-insert into t1 values (0xF9DA),(0xF9DB),(0xF9DC);
-# Check round trip
-select hex(a) a, hex(@u:=convert(a using utf8)) b,
-hex(convert(@u using big5)) c from t1 order by a;
-# Check that there is no "illegal mix of collations" error with Unicode.
-alter table t1 convert to character set utf8;
-select hex(a) from t1 where a = _big5 0xF9DC;
-drop table t1;
-
-#
-# Bugs#15375: Unassigned multibyte codes are broken
-# into parts when converting to Unicode.
-# This query should return 0x003F0041. I.e. it should
-# scan unassigned double-byte character 0xC840, convert
-# it as QUESTION MARK 0x003F and then scan the next
-# character, which is a single byte character 0x41.
-#
-select hex(convert(_big5 0xC84041 using ucs2));
-
---echo End of 4.1 tests
-
-#
-# Bug#26711 "binary content 0x00 sometimes becomes 0x5C 0x00 after dump/load"
-#
-set names big5;
-create table t1 (a blob);
-insert into t1 values (0xEE00);
-select * into outfile 'test/t1.txt' from t1;
-delete from t1;
-let $MYSQLD_DATADIR= `select @@datadir`;
---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
---eval select hex(load_file('$MYSQLD_DATADIR/test/t1.txt'));
-load data infile 't1.txt' into table t1;
-select hex(a) from t1;
---remove_file $MYSQLD_DATADIR/test/t1.txt
-drop table t1;
-
---echo End of 5.0 tests
-
-
---echo #
---echo # Start of 5.5 tests
---echo #
-
---echo #
---echo # Testing WL#4583 Case conversion in Asian character sets
---echo #
-#
-# Populate t1 with all hex digits
-#
-SET NAMES utf8;
-SET collation_connection=big5_chinese_ci;
-CREATE TABLE t1 (b VARCHAR(2));
-INSERT INTO t1 VALUES ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7');
-INSERT INTO t1 VALUES ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F');
-#
-# Populate tables head and tail with values '00'-'FF'
-#
-CREATE TEMPORARY TABLE head AS SELECT concat(b1.b, b2.b) AS head FROM t1 b1, t1 b2;
-CREATE TEMPORARY TABLE tail AS SELECT concat(b1.b, b2.b) AS tail FROM t1 b1, t1 b2;
-DROP TABLE t1;
-#
-# Populate table t1 with all values [80..FF][20..FF]
-# Expected valid big5 codes: [A1..F9][40..7E,A1..FE] (89x157=13973)
-#
-CREATE TABLE t1 AS
-SELECT concat(head, tail) AS code, ' ' AS a
-FROM head, tail
-WHERE (head BETWEEN '80' AND 'FF') AND (tail BETWEEN '20' AND 'FF')
-ORDER BY head, tail;
-DROP TEMPORARY TABLE head, tail;
-SHOW CREATE TABLE t1;
-SELECT COUNT(*) FROM t1;
-UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code;
-SELECT COUNT(*) FROM t1 WHERE a<>'?';
-#
-# Display all characters that have upper or lower case mapping.
-#
-SELECT code, hex(upper(a)), hex(lower(a)),a, upper(a), lower(a) FROM t1 WHERE hex(a)<>hex(upper(a)) OR hex(a)<>hex(lower(a));
-#
-# Make sure all possible conversion happened
-#
-# Expect U+2160 to U+2169 ROMAN NUMERAL ONE to ROMAN NUMERAL TEN
-#
-SELECT * FROM t1
-WHERE HEX(CAST(LOWER(a) AS CHAR CHARACTER SET utf8)) <>
- HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
-#
-# Expect U+0430 to U+0433 CYRILLIC SMALL LETTER A, BE, VE, GHE
-# Expect U+043D to U+0442 CYRILLIC SMALL LETTER EN, O, PE, ER, ES, TE
-#
-SELECT * FROM t1
-WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <>
- HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
-DROP TABLE t1;
-
---echo #
---echo # End of 5.5 tests
---echo #
-
-
---echo #
---echo # Start of 5.6 tests
---echo #
-
---echo #
---echo # WL#3664 WEIGHT_STRING
---echo #
-
-set names big5;
---source include/weight_string.inc
---source include/weight_string_l1.inc
---source include/weight_string_A1A1.inc
-
-set collation_connection=big5_bin;
---source include/weight_string.inc
---source include/weight_string_l1.inc
---source include/weight_string_A1A1.inc
-
---echo #
---echo # End of 5.6 tests
---echo #
-
---echo #
---echo # Start of 10.0 tests
---echo #
-
-let $ctype_unescape_combinations=selected;
---source include/ctype_unescape.inc
-
---character_set big5
-SET NAMES big5;
---source include/ctype_E05C.inc
-
-
-#
-# Checking unassigned character 0xC840 in an ENUM
-#
-
-SET NAMES big5;
-CREATE TABLE t1 (a ENUM('@') CHARACTER SET big5);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES ('@');
-INSERT INTO t1 VALUES (_big5 0xC840);
-INSERT INTO t1 VALUES (0xC840);
-SELECT HEX(a),a FROM t1;
-DROP TABLE t1;
-
-SET NAMES binary;
-CREATE TABLE t1 (a ENUM('@') CHARACTER SET big5);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES ('@');
-INSERT INTO t1 VALUES (_big5 0xC840);
-INSERT INTO t1 VALUES (0xC840);
-SELECT HEX(a),a FROM t1;
-DROP TABLE t1;
-
-
-#
-# Checking unassigned character in CHAR, VARCHAR, TEXT
-#
-
-SET NAMES big5;
-CREATE TABLE t1 (
- c1 CHAR(10) CHARACTER SET big5,
- c2 VARCHAR(10) CHARACTER SET big5,
- c3 TEXT CHARACTER SET big5
-);
-INSERT INTO t1 VALUES ('@','@','@');
-INSERT INTO t1 VALUES (_big5 0xC840,_big5 0xC840,_big5 0xC840);
-INSERT INTO t1 VALUES (0xC840,0xC840,0xC840);
-SELECT HEX(c1),HEX(c2),HEX(c3) FROM t1;
-DROP TABLE t1;
-
-SET NAMES binary;
-CREATE TABLE t1 (
- c1 CHAR(10) CHARACTER SET big5,
- c2 VARCHAR(10) CHARACTER SET big5,
- c3 TEXT CHARACTER SET big5
-);
-INSERT INTO t1 VALUES ('@','@','@');
-INSERT INTO t1 VALUES (_big5 0xC840,_big5 0xC840,_big5 0xC840);
-INSERT INTO t1 VALUES (0xC840,0xC840,0xC840);
-SELECT HEX(c1),HEX(c2),HEX(c3) FROM t1;
-DROP TABLE t1;
-
-
-#
-# Checking binary->big5 conversion of an unassigned character 0xC840 in optimizer
-#
-SET NAMES binary;
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET big5, KEY(a));
-INSERT INTO t1 VALUES (0xC840),(0xC841),(0xC842);
-SELECT HEX(a) FROM t1 WHERE a='@';
-SELECT HEX(a) FROM t1 IGNORE KEY(a) WHERE a='@';
-DROP TABLE t1;
-
---echo #
---echo # End of 10.0 tests
---echo #
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-9711 NO PAD Collatons
---echo #
-SET character_set_connection=big5;
-let $coll='big5_chinese_nopad_ci';
-let $coll_pad='big5_chinese_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='big5_nopad_bin';
-let $coll_pad='big5_bin';
---source include/ctype_pad_all_engines.inc
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/ctype_binary.test b/mysql-test/t/ctype_binary.test
deleted file mode 100644
index 8da4eaff572..00000000000
--- a/mysql-test/t/ctype_binary.test
+++ /dev/null
@@ -1,76 +0,0 @@
-
-set names binary;
-
---echo #
---echo # Start of 5.5 tests
---echo #
-
---source include/ctype_numconv.inc
-
---echo #
---echo # End of 5.5 tests
---echo #
-
-
---echo #
---echo # Start of 10.0 tests
---echo #
-
-SET NAMES binary;
---source include/ctype_like_cond_propagation.inc
-
---echo #
---echo # MDEV-7629 Regression: Bit and hex string literals changed column names in 10.0.14
---echo #
-SELECT _binary 0x7E, _binary X'7E', _binary B'01111110';
-
---echo #
---echo # End of 10.0 tests
---echo #
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-8695 Wrong result for SELECT..WHERE varchar_column='a' AND CRC32(varchar_column)=3904355907
---echo #
-CREATE TABLE t1 (a VARBINARY(10));
-INSERT INTO t1 VALUES ('a'),('a ');
-SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE CRC32(a)=3904355907;
-SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE a='a' AND CRC32(a)=3904355907;
---echo # Okey to propagate 'a' into CRC32(a)
-EXPLAIN EXTENDED SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE a='a' AND CRC32(a)=3904355907;
-SELECT a, HEX(a) FROM t1 WHERE HEX(a)='61';
-SELECT *,HEX(a) FROM t1 WHERE a='a' AND HEX(a)='61';
---echo # Okey to propagate 'a' into HEX(a)
-EXPLAIN EXTENDED SELECT *,HEX(a) FROM t1 WHERE a='a' AND HEX(a)='61';
-SELECT * FROM t1 WHERE a='a';
-SELECT * FROM t1 WHERE LENGTH(a)=2;
-SELECT * FROM t1 WHERE a='a' AND LENGTH(a)=2;
---echo # Okey to propagate 'a' into LENGTH(a)
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND LENGTH(a)=2;
-SELECT * FROM t1 WHERE a='a ';
-SELECT * FROM t1 WHERE a='a ' AND LENGTH(a)=2;
---echo # Okey to propagate 'a ' into LENGTH(a)
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a ' AND LENGTH(a)=2;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8723 Wrong result for SELECT..WHERE COLLATION(a)='binary' AND a='a'
---echo #
-CREATE TABLE t1 (a VARBINARY(10));
-INSERT INTO t1 VALUES ('a'),('A');
-SELECT * FROM t1 WHERE COLLATION(a)='binary' AND a='a';
-SELECT * FROM t1 WHERE CHARSET(a)='binary' AND a='a';
-SELECT * FROM t1 WHERE COERCIBILITY(a)=2 AND a='a';
-SELECT * FROM t1 WHERE WEIGHT_STRING(a)='a' AND a='a';
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE COLLATION(a)='binary' AND a='a';
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE CHARSET(a)='binary' AND a='a';
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE COERCIBILITY(a)=2 AND a='a';
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE WEIGHT_STRING(a)='a' AND a='a';
-DROP TABLE t1;
-
---echo #
---echo # End of 10.1 tests
---echo #
diff --git a/mysql-test/t/ctype_collate.test b/mysql-test/t/ctype_collate.test
deleted file mode 100644
index 6704395a0a1..00000000000
--- a/mysql-test/t/ctype_collate.test
+++ /dev/null
@@ -1,341 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS t2;
---enable_warnings
-
-CREATE TABLE t1 (
- latin1_f CHAR(32) CHARACTER SET latin1 NOT NULL
-);
-
---error 1253
-CREATE TABLE t2 (
- latin1_f CHAR(32) CHARACTER SET latin1 COLLATE koi8r_general_ci NOT NULL
-);
-
---error 1273
-CREATE TABLE t2 (
- latin1_f CHAR(32) CHARACTER SET latin1 COLLATE some_non_existing_col NOT NULL
-);
-
-
-INSERT INTO t1 (latin1_f) VALUES (_latin1'A');
-INSERT INTO t1 (latin1_f) VALUES (_latin1'a');
-
-INSERT INTO t1 (latin1_f) VALUES (_latin1'AD');
-INSERT INTO t1 (latin1_f) VALUES (_latin1'ad');
-
-INSERT INTO t1 (latin1_f) VALUES (_latin1'AE');
-INSERT INTO t1 (latin1_f) VALUES (_latin1'ae');
-
-INSERT INTO t1 (latin1_f) VALUES (_latin1'AF');
-INSERT INTO t1 (latin1_f) VALUES (_latin1'af');
-
-INSERT INTO t1 (latin1_f) VALUES (_latin1'');
-INSERT INTO t1 (latin1_f) VALUES (_latin1'');
-
-INSERT INTO t1 (latin1_f) VALUES (_latin1'');
-INSERT INTO t1 (latin1_f) VALUES (_latin1'');
-
-INSERT INTO t1 (latin1_f) VALUES (_latin1'B');
-INSERT INTO t1 (latin1_f) VALUES (_latin1'b');
-
-INSERT INTO t1 (latin1_f) VALUES (_latin1'U');
-INSERT INTO t1 (latin1_f) VALUES (_latin1'u');
-
-INSERT INTO t1 (latin1_f) VALUES (_latin1'UE');
-INSERT INTO t1 (latin1_f) VALUES (_latin1'ue');
-
-INSERT INTO t1 (latin1_f) VALUES (_latin1'');
-INSERT INTO t1 (latin1_f) VALUES (_latin1'');
-
-INSERT INTO t1 (latin1_f) VALUES (_latin1'SS');
-INSERT INTO t1 (latin1_f) VALUES (_latin1'ss');
-INSERT INTO t1 (latin1_f) VALUES (_latin1'');
-
-INSERT INTO t1 (latin1_f) VALUES (_latin1'Y');
-INSERT INTO t1 (latin1_f) VALUES (_latin1'y');
-
-INSERT INTO t1 (latin1_f) VALUES (_latin1'Z');
-INSERT INTO t1 (latin1_f) VALUES (_latin1'z');
-
-
-# ORDER BY
-
-SELECT latin1_f FROM t1 ORDER BY latin1_f;
-SELECT latin1_f FROM t1 ORDER BY latin1_f COLLATE latin1_swedish_ci;
-SELECT latin1_f FROM t1 ORDER BY latin1_f COLLATE latin1_german2_ci;
-SELECT latin1_f FROM t1 ORDER BY latin1_f COLLATE latin1_general_ci;
-SELECT latin1_f FROM t1 ORDER BY latin1_f COLLATE latin1_bin;
---error 1253
-SELECT latin1_f FROM t1 ORDER BY latin1_f COLLATE koi8r_general_ci;
-
-# SELECT latin1_f COLLATE koi8r FROM t1 ;
-
-# AS + ORDER BY
-SELECT latin1_f COLLATE latin1_swedish_ci AS latin1_f_as FROM t1 ORDER BY latin1_f_as;
-SELECT latin1_f COLLATE latin1_german2_ci AS latin1_f_as FROM t1 ORDER BY latin1_f_as;
-SELECT latin1_f COLLATE latin1_general_ci AS latin1_f_as FROM t1 ORDER BY latin1_f_as;
-SELECT latin1_f COLLATE latin1_bin AS latin1_f_as FROM t1 ORDER BY latin1_f_as;
---error 1253
-SELECT latin1_f COLLATE koi8r_general_ci AS latin1_f_as FROM t1 ORDER BY latin1_f_as;
-
-
-# GROUP BY
-
-SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f;
-SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f COLLATE latin1_swedish_ci;
-SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f COLLATE latin1_german2_ci;
-SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f COLLATE latin1_general_ci;
-SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f COLLATE latin1_bin;
---error 1253
-SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f COLLATE koi8r_general_ci;
-
-
-# DISTINCT
-
-SELECT DISTINCT latin1_f FROM t1;
-SELECT DISTINCT latin1_f COLLATE latin1_swedish_ci FROM t1;
-SELECT DISTINCT latin1_f COLLATE latin1_german2_ci FROM t1;
-SELECT DISTINCT latin1_f COLLATE latin1_general_ci FROM t1;
-SELECT DISTINCT latin1_f COLLATE latin1_bin FROM t1;
---error 1273
-SELECT DISTINCT latin1_f COLLATE koi8r FROM t1;
-
-
-# Aggregates
-
---disable_parsing
-SELECT MAX(k COLLATE latin1_german2_ci)
-FROM t1
-WHERE
-SELECT *
-FROM t1
-WHERE (_latin1'Mu"ller' COLLATE latin1_german2_ci) = k
-HAVING
-SELECT *
-FROM t1
-HAVING (_latin1'Mu"ller' COLLATE latin1_german2_ci) = k;
---enable_parsing
-
-#
-# Check that SHOW displays COLLATE clause
-#
-
-SHOW CREATE TABLE t1;
-SHOW FIELDS FROM t1;
-ALTER TABLE t1 CHANGE latin1_f
-latin1_f CHAR(32) CHARACTER SET latin1 COLLATE latin1_bin;
-SHOW CREATE TABLE t1;
-SHOW FIELDS FROM t1;
-ALTER TABLE t1 CHARACTER SET latin1 COLLATE latin1_bin;
-SHOW CREATE TABLE t1;
-SHOW FIELDS FROM t1;
-
-#
-# Check SET CHARACTER SET
-#
-
-SET CHARACTER SET 'latin1';
-SHOW VARIABLES LIKE 'character_set_client';
-SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
-explain extended SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
-
-SET CHARACTER SET koi8r;
-SHOW VARIABLES LIKE 'collation_client';
-SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
-
---error 1115
-SET CHARACTER SET 'DEFAULT';
-
-DROP TABLE t1;
-
-CREATE TABLE t1
-(s1 CHAR(5) COLLATE latin1_german1_ci,
- s2 CHAR(5) COLLATE latin1_swedish_ci);
---error 1267
-SELECT * FROM t1 WHERE s1 = s2;
-DROP TABLE t1;
-
-
-CREATE TABLE t1
-(s1 CHAR(5) COLLATE latin1_german1_ci,
- s2 CHAR(5) COLLATE latin1_swedish_ci,
- s3 CHAR(5) COLLATE latin1_bin);
-INSERT INTO t1 VALUES ('a','A','A');
---error 1267
-SELECT * FROM t1 WHERE s1 = s2;
-SELECT * FROM t1 WHERE s1 = s3;
-SELECT * FROM t1 WHERE s2 = s3;
-DROP TABLE t1;
-
-
-#
-# Test that optimizer doesn't use indexes with wrong collation
-#
-#
-# BUG#48447, Delivering too few records with indexes using collate syntax
-#
-create table t1 (a varchar(1) character set latin1 collate latin1_general_ci);
-insert into t1 values ('A'),('a'),('B'),('b'),('C'),('c');
-select * from t1 where a > 'B' collate latin1_bin;
-select * from t1 where a <> 'B' collate latin1_bin;
-create index i on t1 (a);
-select * from t1 where a > 'B' collate latin1_bin;
-select * from t1 where a <> 'B' collate latin1_bin;
-drop table t1;
-
-SET NAMES latin1;
-CREATE TABLE t1
-(s1 char(10) COLLATE latin1_german1_ci,
- s2 char(10) COLLATE latin1_swedish_ci,
- KEY(s1),
- KEY(s2));
-
-INSERT INTO t1 VALUES ('a','a');
-INSERT INTO t1 VALUES ('b','b');
-INSERT INTO t1 VALUES ('c','c');
-INSERT INTO t1 VALUES ('d','d');
-INSERT INTO t1 VALUES ('e','e');
-INSERT INTO t1 VALUES ('f','f');
-INSERT INTO t1 VALUES ('g','g');
-INSERT INTO t1 VALUES ('h','h');
-INSERT INTO t1 VALUES ('i','i');
-INSERT INTO t1 VALUES ('j','j');
-
-EXPLAIN SELECT * FROM t1 WHERE s1='a';
-EXPLAIN SELECT * FROM t1 WHERE s2='a';
-EXPLAIN SELECT * FROM t1 WHERE s1='a' COLLATE latin1_german1_ci;
-EXPLAIN SELECT * FROM t1 WHERE s2='a' COLLATE latin1_german1_ci;
-
-EXPLAIN SELECT * FROM t1 WHERE s1 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci;
-EXPLAIN SELECT * FROM t1 WHERE s2 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci;
-
-EXPLAIN SELECT * FROM t1 WHERE s1 IN ('a','b' COLLATE latin1_german1_ci);
-EXPLAIN SELECT * FROM t1 WHERE s2 IN ('a','b' COLLATE latin1_german1_ci);
-
-EXPLAIN SELECT * FROM t1 WHERE s1 LIKE 'a' COLLATE latin1_german1_ci;
-EXPLAIN SELECT * FROM t1 WHERE s2 LIKE 'a' COLLATE latin1_german1_ci;
-
-DROP TABLE t1;
-
-# End of 4.1 tests
-
-#
-# Bug#29261: Sort order of the collation wasn't used when comparing trailing
-# spaces.
-#
-create table t1(f1 varchar(10) character set latin2 collate latin2_hungarian_ci, key(f1));
-insert into t1 set f1=0x3F3F9DC73F;
-insert into t1 set f1=0x3F3F1E563F;
-insert into t1 set f1=0x3F3F;
-check table t1 extended;
-drop table t1;
-
-#
-# Bug#29461: Sort order of the collation wasn't used when comparing characters
-# with the space character.
-#
-create table t1 (a varchar(2) character set latin7 collate latin7_general_ci,key(a));
-insert into t1 set a=0x4c20;
-insert into t1 set a=0x6c;
-insert into t1 set a=0x4c98;
-check table t1 extended;
-drop table t1;
-
-#
-# Bug#41627 Illegal mix of collations in LEAST / GREATEST / CASE
-#
-select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci);
-create table t1
-select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci) as f1;
-show create table t1;
-drop table t1;
-
-select case _latin1'a' when _latin2'b' then 1 when _latin5'c' collate
-latin5_turkish_ci then 2 else 3 end;
-
-select concat(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci);
-
-
---echo #
---echo # Bug#11765016 57926: ILLEGAL MIX OF COLLATIONS FOR OPERATION 'UNION' .. USING CONCAT/FUNCTION/
---echo # Not a bug: only adding coverage tests
---echo #
-SET NAMES latin1 COLLATE latin1_german2_ci;
-CREATE DATABASE test1 DEFAULT CHARACTER SET latin1 COLLATE latin1_german2_ci;
-USE test1;
-DELIMITER //;
---echo #
---echo # Using "COLLATE latin1_swedish_ci" as the default collation for latin1
---echo #
-CREATE FUNCTION `getText`() RETURNS varchar(20) CHARSET latin1
-BEGIN
- RETURN "Testtext";
-END;//
-DELIMITER ;//
-SELECT getText(), CHARSET(getText()), COLLATION(getText()), COERCIBILITY(getText());
---error ER_CANT_AGGREGATE_NCOLLATIONS
-CREATE TABLE t1 AS SELECT ' - ' AS a UNION SELECT getText();
-DROP FUNCTION getText;
---echo #
---echo # Using "CHARACTER SET latin1 COLLATE latin1_german2_ci" as the database defaults
---echo #
-DELIMITER //;
-CREATE FUNCTION `getText`() RETURNS varchar(20)
-BEGIN
- RETURN "Testtext";
-END;//
-DELIMITER ;//
-SELECT getText(), CHARSET(getText()), COLLATION(getText()), COERCIBILITY(getText());
-CREATE TABLE t1 AS SELECT ' - ' AS a UNION SELECT getText();
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-DROP FUNCTION getText;
---echo #
---echo # Using explicit "CHARACTER SET latin1 COLLATE latin1_german2_ci"
---echo #
-DELIMITER //;
-CREATE FUNCTION `getText`() RETURNS varchar(20) CHARACTER SET latin1 COLLATE latin1_german2_ci
-BEGIN
- RETURN "Testtext";
-END;//
-DELIMITER ;//
-SELECT getText(), CHARSET(getText()), COLLATION(getText()), COERCIBILITY(getText());
-CREATE TABLE t1 AS SELECT ' - ' AS a UNION SELECT getText();
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-DROP FUNCTION getText;
-DROP DATABASE test1;
-USE test;
-SET NAMES latin1;
-
---echo #
---echo # MDEV-11320, MySQL BUG#81810: Inconsistent sort order for blob/text between InnoDB and filesort
---echo #
-
-CREATE TABLE t1 (
- b LONGTEXT CHARACTER SET "latin1" COLLATE "latin1_bin",
- KEY b (b(32))
-);
-INSERT INTO t1 (b) VALUES ('a'), (_binary 0x1), (_binary 0x0), ('');
-
-
-drop table t1;
-
-CREATE TABLE t1 (
- b LONGTEXT CHARACTER SET "latin1" COLLATE "latin1_bin",
- PRIMARY KEY b (b(32))
-);
-
-INSERT INTO t1 (b) VALUES ('a'), (_binary 0x1), (_binary 0x0), ('');
-
-explain
-select hex(b) from t1 force index (PRIMARY) where b<'zzz';
-select hex(b) from t1 force index (PRIMARY) where b<'zzz';
-
-explain
-select hex(b) from t1 where b<'zzz' order by b;
-select hex(b) from t1 where b<'zzz' order by b;
-
-drop table t1;
-
diff --git a/mysql-test/t/ctype_cp1250_ch.test b/mysql-test/t/ctype_cp1250_ch.test
deleted file mode 100644
index 0bbe4cafca6..00000000000
--- a/mysql-test/t/ctype_cp1250_ch.test
+++ /dev/null
@@ -1,116 +0,0 @@
--- source include/have_cp1250_ch.inc
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-SHOW COLLATION LIKE 'cp1250_czech_cs';
-
-SET @test_character_set= 'cp1250';
-SET @test_collation= 'cp1250_general_ci';
--- source include/ctype_common.inc
--- source include/ctype_like_cond_propagation.inc
-
-SET @test_character_set= 'cp1250';
-SET @test_collation= 'cp1250_czech_cs';
--- source include/ctype_common.inc
-
-
-
-#
-# Bugs: #8840: Empty string comparison and character set 'cp1250'
-#
-
-CREATE TABLE t1 (a char(16)) character set cp1250 collate cp1250_czech_cs;
-INSERT INTO t1 VALUES ('');
-SELECT a, length(a), a='', a=' ', a=' ' FROM t1;
-DROP TABLE t1;
-
-#
-# Bug#9759 Empty result with 'LIKE' and cp1250_czech_cs
-#
-CREATE TABLE t1 (
- popisek varchar(30) collate cp1250_general_ci NOT NULL default '',
- PRIMARY KEY (`popisek`)
-);
-INSERT INTO t1 VALUES ('2005-01-1');
-SELECT * FROM t1 WHERE popisek = '2005-01-1';
-SELECT * FROM t1 WHERE popisek LIKE '2005-01-1';
-drop table t1;
-
-#
-# Bug#13347: empty result from query with like and cp1250 charset
-#
-set names cp1250;
-CREATE TABLE t1
-(
- id INT AUTO_INCREMENT PRIMARY KEY,
- str VARCHAR(32) CHARACTER SET cp1250 COLLATE cp1250_czech_cs NOT NULL default '',
- UNIQUE KEY (str)
-);
-
-INSERT INTO t1 VALUES (NULL, 'a');
-INSERT INTO t1 VALUES (NULL, 'aa');
-INSERT INTO t1 VALUES (NULL, 'aaa');
-INSERT INTO t1 VALUES (NULL, 'aaaa');
-INSERT INTO t1 VALUES (NULL, 'aaaaa');
-INSERT INTO t1 VALUES (NULL, 'aaaaaa');
-INSERT INTO t1 VALUES (NULL, 'aaaaaaa');
-select * from t1 where str like 'aa%';
-drop table t1;
-
-#
-# Bug#19741 segfault with cp1250 charset + like + primary key + 64bit os
-#
-set names cp1250;
-create table t1 (a varchar(15) collate cp1250_czech_cs NOT NULL, primary key(a));
-insert into t1 values("abcdefgh");
-insert into t1 values("");
-select a from t1 where a like "abcdefgh";
-drop table t1;
-
-set names cp1250 collate cp1250_czech_cs;
---source include/ctype_pad_space.inc
---source include/ctype_filesort.inc
-
-# End of 4.1 tests
-
-#
-# Bug #48053 String::c_ptr has a race and/or does an invalid
-# memory reference
-# (triggered by Valgrind tests)
-# (see also ctype_eucjpms.test, ctype_cp1250.test, ctype_cp1251.test)
-#
---error 1649
-set global LC_MESSAGES=convert((@@global.log_bin_trust_function_creators)
- using cp1250);
-
-
---echo #
---echo # Start of 5.6 tests
---echo #
-
---echo #
---echo # WL#3664 WEIGHT_STRING
---echo #
-
---echo #
---echo # Note:
---echo # cp1250_czech_cs does not support WEIGHT_STRING in full extent
---echo #
-
-set names cp1250 collate cp1250_czech_cs;
---source include/weight_string.inc
---source include/weight_string_euro.inc
---source include/weight_string_chde.inc
---source include/weight_string_l1.inc
---source include/weight_string_l2.inc
---source include/weight_string_l12.inc
-
---echo #
---echo # End of 5.6 tests
---echo #
-
diff --git a/mysql-test/t/ctype_cp1251.test b/mysql-test/t/ctype_cp1251.test
deleted file mode 100644
index 97978463407..00000000000
--- a/mysql-test/t/ctype_cp1251.test
+++ /dev/null
@@ -1,145 +0,0 @@
-# Test of charset cp1251
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-SET NAMES cp1251;
-
-#
-# Test problem with LEFT() (Bug #514)
-#
-
-create table t1 (a varchar(10) not null) character set cp1251;
-insert into t1 values ("a"),("ab"),("abc");
-select * from t1;
-select a, left(a,1) as b from t1;
-select a, left(a,1) as b from t1 group by a;
-SELECT DISTINCT RIGHT(a,1) from t1;
-drop table t1;
-
-#
-# Test of binary and upper/lower
-#
-create table t1 (a char(3) binary, b binary(3)) character set cp1251;
-insert into t1 values ('aaa','bbb'),('AAA','BBB');
-select upper(a),upper(b) from t1;
-select lower(a),lower(b) from t1;
-select * from t1 where upper(a)='AAA';
-select * from t1 where lower(a)='aaa';
-select * from t1 where upper(b)='BBB';
-select * from t1 where lower(b)='bbb';
-select charset(a), charset(b), charset(binary 'ccc') from t1 limit 1;
-select collation(a), collation(b), collation(binary 'ccc') from t1 limit 1;
-drop table t1;
-
-# Test for BUG#8560
-create table t1 (
- a varchar(16) character set cp1251 collate cp1251_bin not null,
- b int(10) default null,
- primary key(a)
-) charset=cp1251;
-insert into t1 (a) values ('air'),
- ('we'),('g'),('we_toshko'), ('s0urce'),('we_ivo'),('we_iliyan'),
- ('we_martin'),('vw_grado'),('vw_vasko'),('tn_vili'),('tn_kalina'),
- ('tn_fakira'),('vw_silvia'),('vw_starshi'),('vw_geo'),('vw_b0x1');
-
---sorted_result
-select * from t1 where a like 'we_%';
-drop table t1;
-
-#
-# Bug#158 ENUM and SET types does not accept valid cp1251 character
-#
-CREATE TABLE t1 (
- e1 enum(''),
- e2 enum('')
-) ENGINE=MYISAM character set cp1251;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-# End of 4.1 tests
-
---echo #
---echo # Start of 5.1 tests
---echo #
-
---source include/ctype_8bit.inc
---source include/ctype_pad_space.inc
-
-#
-# Bug #48053 String::c_ptr has a race and/or does an invalid
-# memory reference
-# (triggered by Valgrind tests)
-# (see also ctype_eucjpms.test, ctype_cp1250.test, ctype_cp1251.test)
-#
---error 1649
-set global LC_TIME_NAMES=convert((-8388608) using cp1251);
-
-
---echo #
---echo # End of 5.1 tests
---echo #
-
---echo #
---echo # Start of 5.5 tests
---echo #
-
---source include/ctype_numconv.inc
-
---echo #
---echo # Bug#60101 COALESCE with cp1251 tables causes [Err] 1267 - Illegal mix of collations
---echo #
-CREATE TABLE t1 (test1 INT, test2 VARCHAR(255));
-SHOW CREATE TABLE t1;
-SELECT COALESCE(IF(test1=1, 1, NULL), test2) FROM t1;
-SELECT COALESCE(IF(test1=1, NULL, 1), test2) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-5459 Illegal mix of collations for datetime
---echo #
-SET NAMES cp1251;
-CREATE TABLE t1 (dt DATETIME);
-INSERT INTO t1 VALUES ('2014-01-02 10:20:30');
-SELECT date(dt) FROM t1 WHERE (CASE WHEN 1 THEN date(dt) ELSE null END >= '2013-12-01 00:00:00');
-DROP TABLE t1;
-
---echo #
---echo # End of 5.5 tests
---echo #
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-8688 Wrong result for SELECT..WHERE varchar_column IN (1,2,3) AND varchar_column=' 1';
---echo #
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET cp1251 COLLATE cp1251_ukrainian_ci);
-INSERT INTO t1 VALUES (' 1'),('`1');
-SELECT * FROM t1 WHERE a IN (1,2,3);
-SELECT * FROM t1 WHERE a IN (1,2,3) AND a=' 1';
-SELECT * FROM t1 WHERE a IN (1,2,3,'4') AND a=' 1';
-# Equality should not propagate ' 1' to IN: incompatible comparison context
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2,3) AND a=' 1';
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2,3,'x') AND a=' 1';
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-8671 Wrong result for SELECT..WHERE varchar_column=' 1' AND (varchar_column XOR '1')
---echo #
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET cp1251 COLLATE cp1251_ukrainian_ci);
-INSERT INTO t1 VALUES (' 1'),('`1');
-SELECT * FROM t1 WHERE a=' 1';
-SELECT * FROM t1 WHERE (a XOR '0');
-SELECT * FROM t1 WHERE a=' 1' AND (a XOR '0');
---echo # ' 1' should not be propagated into (a XIR '0')
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=' 1' AND (a XOR '0');
-DROP TABLE t1;
-
-
---echo #
---echo # End of 10.1 tests
---echo #
diff --git a/mysql-test/t/ctype_cp850.test b/mysql-test/t/ctype_cp850.test
deleted file mode 100644
index 358829eb351..00000000000
--- a/mysql-test/t/ctype_cp850.test
+++ /dev/null
@@ -1,16 +0,0 @@
---echo #
---echo # Start of 5.5 tests
---echo #
-
---echo #
---echo # MDEV-9862 Illegal mix of collation, when comparing column with CASE expression
---echo #
-SET NAMES cp850;
-CREATE TABLE t1 (a CHAR(1) CHARACTER SET latin1);
-SELECT a FROM t1 WHERE CASE a WHEN 'aaaa' THEN 'Y' WHEN 'aaaa' THEN 'Y' ELSE NULL END <> a;
-DROP TABLE t1;
-
-
---echo #
---echo # End of 5.5 tests
---echo #
diff --git a/mysql-test/t/ctype_cp932.test b/mysql-test/t/ctype_cp932.test
deleted file mode 100644
index 2486ca8a79e..00000000000
--- a/mysql-test/t/ctype_cp932.test
+++ /dev/null
@@ -1,49 +0,0 @@
--- source include/have_cp932.inc
---echo #
---echo # Bug #11755818 LIKE DOESN'T MATCH WHEN CP932_BIN/SJIS_BIN COLLATIONS ARE
---echo # USED.
---echo #
-
-SET @old_character_set_client= @@character_set_client;
-SET @old_character_set_connection= @@character_set_connection;
-SET @old_character_set_results= @@character_set_results;
-SET character_set_client= 'utf8';
-SET character_set_connection= 'utf8';
-SET character_set_results= 'utf8';
-
-CREATE TABLE t1 (a VARCHAR(10) COLLATE cp932_bin);
-INSERT INTO t1 VALUES('カカ');
-SELECT * FROM t1 WHERE a LIKE '%カ';
-SELECT * FROM t1 WHERE a LIKE '_カ';
-SELECT * FROM t1 WHERE a LIKE '%_カ';
-
-ALTER TABLE t1 MODIFY a VARCHAR(100) COLLATE sjis_bin;
-SELECT * FROM t1 WHERE a LIKE '%カ';
-SELECT * FROM t1 WHERE a LIKE '_カ';
-SELECT * FROM t1 WHERE a LIKE '%_カ';
-DROP TABLE t1;
-
-## Reset to initial values
-SET @@character_set_client= @old_character_set_client;
-SET @@character_set_connection= @old_character_set_connection;
-SET @@character_set_results= @old_character_set_results;
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-9711 NO PAD Collatons
---echo #
-SET character_set_connection=cp932;
-let $coll='cp932_japanese_nopad_ci';
-let $coll_pad='cp932_japanese_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='cp932_nopad_bin';
-let $coll_pad='cp932_bin';
---source include/ctype_pad_all_engines.inc
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/ctype_cp932_binlog_row.test b/mysql-test/t/ctype_cp932_binlog_row.test
deleted file mode 100644
index 38614ea45c0..00000000000
--- a/mysql-test/t/ctype_cp932_binlog_row.test
+++ /dev/null
@@ -1,5 +0,0 @@
-# This is a wrapper for binlog.test so that the same test case can be used
-# For both statement and row based bin logs 11/07/2005 [jbm]
-
--- source include/have_binlog_format_row.inc
--- source extra/binlog_tests/ctype_cp932_binlog.test
diff --git a/mysql-test/t/ctype_cp932_binlog_stm.test b/mysql-test/t/ctype_cp932_binlog_stm.test
deleted file mode 100644
index 78e5725218a..00000000000
--- a/mysql-test/t/ctype_cp932_binlog_stm.test
+++ /dev/null
@@ -1,198 +0,0 @@
-# This is a wrapper for binlog.test so that the same test case can be used
-# For both statement and row based bin logs 11/07/2005 [jbm]
-
--- source include/have_binlog_format_mixed_or_statement.inc
--- source extra/binlog_tests/ctype_cp932_binlog.test
-
-call mtr.add_suppression('Error in Log_event::read_log_event()');
---disable_query_log
-CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
---enable_query_log
-
-#
-# Bug#18293: Values in stored procedure written to binlog unescaped
-#
-let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
-
-delimiter |;
-CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1,
- s2 CHAR(50) CHARACTER SET cp932,
- d DECIMAL(10,2))|
-CREATE PROCEDURE bug18293 (IN ins1 CHAR(50),
- IN ins2 CHAR(50) CHARACTER SET cp932,
- IN ind DECIMAL(10,2))
- BEGIN
- INSERT INTO t4 VALUES (ins1, ins2, ind);
- END|
-CALL bug18293("Foo's a Bar", _cp932 0xED40ED41ED42, 47.93)|
-SELECT HEX(s1),HEX(s2),d FROM t4|
-DROP PROCEDURE bug18293|
-DROP TABLE t4|
-delimiter ;|
-source include/show_binlog_events.inc;
-
---echo End of 5.0 tests
-
-#
-# #28436: Incorrect position in SHOW BINLOG EVENTS causes server coredump
-# Note: 364 is a magic position (found experimentally, depends on
-# the log's contents) that caused the server crash.
-
-call mtr.add_suppression("Error in Log_event::read_log_event\\\(\\\): 'Found invalid");
-
---error 1220
-SHOW BINLOG EVENTS FROM 504;
-
---echo Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
-CREATE TABLE t1 (a varchar(16)) character set cp932;
-INSERT INTO t1 VALUES (0x8372835E),(0x8352835E);
-SELECT hex(a), hex(lower(a)), hex(upper(a)) FROM t1 ORDER BY binary(a);
-DROP TABLE t1;
-
---echo End of 5.1 tests
-
-
---echo #
---echo # Start of 5.5 tests
---echo #
-
---echo #
---echo # Testing WL#4583 Case conversion in Asian character sets
---echo #
-#
-# Populate t1 with all hex digits
-#
-SET NAMES utf8;
-SET collation_connection=cp932_japanese_ci;
-CREATE TABLE t1 (b VARCHAR(2));
-INSERT INTO t1 VALUES ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7');
-INSERT INTO t1 VALUES ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F');
-#
-# Populate tables head and tail with values '00'-'FF'
-#
---disable_warnings
-CREATE TEMPORARY TABLE head AS SELECT concat(b1.b, b2.b) AS head FROM t1 b1, t1 b2;
-CREATE TEMPORARY TABLE tail AS SELECT concat(b1.b, b2.b) AS tail FROM t1 b1, t1 b2;
---enable_warnings
-DROP TABLE t1;
-#
-# Populate table t1 with all codes [80..FF][20..FF]
-# excluding Half Width Kana [A1..DF]
-# Expected valid cp932 multibyte codes:
-# [81..9F,E0..FC][40..7E,80..fC] (60x188=11280 characters)
-#
-CREATE TABLE t1 AS
-SELECT concat(head, tail) AS code, ' ' AS a
-FROM head, tail
-WHERE (head BETWEEN '80' AND 'FF') AND (head NOT BETWEEN 'A1' AND 'DF')
-AND (tail BETWEEN '20' AND 'FF')
-ORDER BY head, tail;
-#
-# Populate t1 with Half Width Kana [A1..DF]
-#
---disable_warnings
-INSERT IGNORE t1 (code) SELECT head FROM head
-WHERE (head BETWEEN 'A1' AND 'DF')
-ORDER BY head;
---enable_warnings
-DROP TEMPORARY TABLE head, tail;
-SHOW CREATE TABLE t1;
-UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code;
-SELECT COUNT(*) FROM t1;
-SELECT COUNT(*) FROM t1 WHERE a<>'?' AND OCTET_LENGTH(a)=1;
-SELECT COUNT(*) FROM t1 WHERE a<>'' AND OCTET_LENGTH(a)=2;
-#
-# Display all characters that have upper or lower case mapping.
-#
-SELECT code, hex(upper(a)), hex(lower(a)),a, upper(a), lower(a) FROM t1
-WHERE hex(a)<>hex(upper(a)) OR hex(a)<>hex(lower(a))
-ORDER BY code;
-#
-# Make sure all possible conversion happened
-#
-# Expect U+212B ANGSTROM SIGN
-#
-SELECT * FROM t1
-WHERE HEX(CAST(LOWER(a) AS CHAR CHARACTER SET utf8)) <>
- HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
-#
-# Expect no results
-#
-SELECT * FROM t1
-WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <>
- HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
-
---echo #
---echo # WL#3090 Japanese Character Set adjustments
---echo # Test cp932->Unicode conversion
---echo #
-SELECT HEX(a), HEX(CONVERT(a USING utf8)) as b FROM t1
-WHERE a<>'' HAVING b<>'3F' ORDER BY code;
-
-DROP TABLE t1;
-
-
---echo #
---echo # WL#3090 Japanese Character Set adjustments
---echo # Test Unicode->cp932 conversion
---echo #
---source include/ctype_utf8_table.inc
-SELECT HEX(a), HEX(CONVERT(a using cp932)) as b FROM t1 HAVING b<>'3F' ORDER BY BINARY a;
-DROP TABLE t1;
-
-
---echo #
---echo # Bug#MDEV-4489 Replication of big5, cp932, gbk, sjis strings makes wrong values on slave
---echo #
-let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
-SET NAMES cp932;
-CREATE TABLE t1 (a INT);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (0x31);
-INSERT INTO t1 VALUES (X'31');
-PREPARE stmt FROM 'INSERT INTO t1 (a) VALUES (?)';
-SET @a='1';
-SELECT charset(@a);
-EXECUTE stmt USING @a;
-DROP PREPARE stmt;
-DROP TABLE t1;
---source include/show_binlog_events.inc
-
-
---echo #
---echo # End of 5.5 tests
---echo #
-
-
---echo #
---echo # Start of 5.6 tests
---echo #
-
---echo #
---echo # WL#3664 WEIGHT_STRING
---echo #
-
-set names cp932;
---source include/weight_string.inc
---source include/weight_string_l1.inc
---source include/weight_string_8140.inc
-
-set collation_connection=cp932_bin;
---source include/weight_string.inc
---source include/weight_string_l1.inc
---source include/weight_string_8140.inc
-
---echo #
---echo # End of 5.6 tests
---echo #
-
-
---echo #
---echo # Start of 10.0 tests
---echo #
-SET NAMES cp932;
---source include/ctype_E05C.inc
-
---echo #
---echo # End of 10.0 tests
---echo #
diff --git a/mysql-test/t/ctype_create.test b/mysql-test/t/ctype_create.test
deleted file mode 100644
index 61fc5292094..00000000000
--- a/mysql-test/t/ctype_create.test
+++ /dev/null
@@ -1,143 +0,0 @@
-#
-# Test for various CREATE statements and character sets
-#
-
-
-# Check that the database charset is taken from server charset by default:
-# - Change local character_set_server variable to latin5.
-# - Create database with and without CHARACTER SET specification.
-# At the same time check fix for the
-# Bug#2151:
-# "USE db" with non-default character set should never affect
-# further CREATE DATABASEs.
-
-
-SET @@character_set_server=latin5;
-CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET cp1251;
-USE mysqltest1;
-CREATE DATABASE mysqltest2;
-
-#
-# This should be cp1251
-#
-SHOW CREATE DATABASE mysqltest1;
-
-#
-# Database "mysqltest2" should take the default latin5 value from
-# the server level.
-# Afterwards, table "d2.t1" should inherit the default latin5 value from
-# the database "mysqltest2", using database option hash.
-#
-SHOW CREATE DATABASE mysqltest2;
-CREATE TABLE mysqltest2.t1 (a char(10));
-SHOW CREATE TABLE mysqltest2.t1;
-DROP TABLE mysqltest2.t1;
-
-#
-# Now we check if the database charset is updated in
-# the database options hash when we ALTER DATABASE.
-#
-ALTER DATABASE mysqltest2 DEFAULT CHARACTER SET latin7;
-CREATE TABLE mysqltest2.t1 (a char(10));
-SHOW CREATE TABLE mysqltest2.t1;
-DROP DATABASE mysqltest2;
-
-#
-# Now we check if the database charset is removed from
-# the database option hash when we DROP DATABASE.
-#
-CREATE DATABASE mysqltest2 CHARACTER SET latin2;
-CREATE TABLE mysqltest2.t1 (a char(10));
-SHOW CREATE TABLE mysqltest2.t1;
-DROP DATABASE mysqltest2;
-
-#
-# Check that table value uses database level by default
-#
-USE mysqltest1;
-CREATE TABLE t1 (a char(10));
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-#
-# Bug#3255
-#
-CREATE TABLE t1 (a char(10)) DEFAULT CHARACTER SET latin1;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-CREATE TABLE t1 (a char(10))
-DEFAULT CHARACTER SET latin1 COLLATE latin1_german1_ci;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-#
-# Bug#
-# CREATE TABLE and CREATE DATABASE didn't fail in some cases
-#
---error 1302
-create table t1 (a char) character set latin1 character set latin2;
---error 1253
-create table t1 (a char) character set latin1 collate latin2_bin;
---error 1302
-create database d1 default character set latin1 character set latin2;
---error 1253
-create database d1 default character set latin1 collate latin2_bin;
-
-#
-#
-DROP DATABASE mysqltest1;
-
-
-#
-# Synatx: 'ALTER DATABASE' without db_name
-#
-CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET latin7;
-use mysqltest2;
-ALTER DATABASE DEFAULT CHARACTER SET latin2;
-show create database mysqltest2;
-drop database mysqltest2;
---error 1046
-ALTER DATABASE DEFAULT CHARACTER SET latin2;
-
-# End of 4.1 tests
-
---error 1102
-ALTER DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa DEFAULT CHARACTER SET latin2;
---error 1102
-ALTER DATABASE `` DEFAULT CHARACTER SET latin2;
-USE test;
-
---echo #
---echo # Start of 10.0 tests
---echo #
-
---echo #
---echo # MDEV-7387 Alter table xxx CHARACTER SET utf8, CONVERT TO CHARACTER SET latin1 should fail
---echo #
---error ER_CONFLICTING_DECLARATIONS
-CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET DEFAULT, CHARACTER SET utf8;
---error ER_CONFLICTING_DECLARATIONS
-CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET utf8, CHARACTER SET DEFAULT;
-CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET utf8, CHARACTER SET utf8;
-DROP TABLE t1;
-CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET DEFAULT, CHARACTER SET DEFAULT;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1, b VARCHAR(10) CHARACTER SET utf8);
---error ER_CONFLICTING_DECLARATIONS
-ALTER TABLE t1 CONVERT TO CHARACTER SET utf8, CHARACTER SET latin1;
---error ER_CONFLICTING_DECLARATIONS
-ALTER TABLE t1 CONVERT TO CHARACTER SET utf8, CHARACTER SET DEFAULT;
---error ER_CONFLICTING_DECLARATIONS
-ALTER TABLE t1 CONVERT TO CHARACTER SET latin1, CHARACTER SET utf8;
---error ER_CONFLICTING_DECLARATIONS
-ALTER TABLE t1 CONVERT TO CHARACTER SET latin1, CHARACTER SET DEFAULT;
---error ER_CONFLICTING_DECLARATIONS
-ALTER TABLE t1 CONVERT TO CHARACTER SET DEFAULT, CHARACTER SET utf8;
---error ER_CONFLICTING_DECLARATIONS
-ALTER TABLE t1 CONVERT TO CHARACTER SET DEFAULT, CHARACTER SET latin1;
-DROP TABLE t1;
-
---echo #
---echo # End of 10.0 tests
---echo #
diff --git a/mysql-test/t/ctype_errors.test b/mysql-test/t/ctype_errors.test
deleted file mode 100644
index b228a3b9f19..00000000000
--- a/mysql-test/t/ctype_errors.test
+++ /dev/null
@@ -1,60 +0,0 @@
---echo Start of 5.4 tests
-
-#
-# ls_messages
-#
-CREATE TABLE t1(f1 INT);
-connect (con1,localhost,root,,test);
-connection con1;
-SET lc_messages=ru_RU;
-SHOW VARIABLES LIKE 'lc_messages';
---error ER_TABLE_EXISTS_ERROR
-CREATE TABLE t1(f1 INT);
-SET NAMES utf8;
---error ER_TABLE_EXISTS_ERROR
-CREATE TABLE t1(f1 INT);
-connection default;
-SHOW VARIABLES LIKE 'lc_messages';
---error ER_TABLE_EXISTS_ERROR
-CREATE TABLE t1(f1 INT);
-
-SHOW GLOBAL VARIABLES LIKE 'lc_messages';
-SET GLOBAL lc_messages=ru_RU;
-SHOW GLOBAL VARIABLES LIKE 'lc_messages';
-SET GLOBAL lc_messages=en_US;
-
-disconnect con1;
-DROP TABLE t1;
-
-#
-# Bug#1406 Tablename in Errormessage not in default characterset
-#
---error ER_BAD_TABLE_ERROR
-drop table `ק`;
-
-#
-# Bug#14602 Error messages not returned in character_set_results
-#
-connect (con1,localhost,root,,test);
-connection con1;
-SET lc_messages=cs_CZ;
-SET NAMES UTF8;
---error ER_BAD_DB_ERROR
-USE nonexistant;
-disconnect con1;
-connection default;
-
---echo #
---echo # Bug#12736295: Buffer overflow for variable converted_err
---echo # with non-latin1 server error message
---echo #
-
-connect (con1,localhost,root,,test);
-SET lc_messages=ru_RU;
-SET NAMES latin1;
---error ER_PARSE_ERROR
---query SELECT '01234567890123456789012345678901234\'
-disconnect con1;
-connection default;
-
---echo End of 5.5 tests
diff --git a/mysql-test/t/ctype_eucjpms.test b/mysql-test/t/ctype_eucjpms.test
deleted file mode 100644
index c69abc32a03..00000000000
--- a/mysql-test/t/ctype_eucjpms.test
+++ /dev/null
@@ -1,596 +0,0 @@
--- source include/have_eucjpms.inc
-
-
---disable_warnings
-drop table if exists t1;
-drop table if exists t2;
-drop table if exists t3;
-drop table if exists t4;
---enable_warnings
-
-set names eucjpms;
-set character_set_database = eucjpms;
-
-CREATE TABLE t1(c1 CHAR(1)) DEFAULT CHARACTER SET = eucjpms;
-
-#Characters which are converted to Unicode ambiguously
-INSERT INTO t1 VALUES
-(0x5C),(0x7E),(0xA1B1),(0xA1BD),(0xA1C0),(0xA1C1),(0xA1C2),(0xA1DD),(0xA1F1),(0xA1F2),(0xA1EF),(0xA2CC),(0x8FA2B7),(0x8FA2C3);
-
-#NEC ROW 13 characters (0x8740 - 0x879C of cp932)
-INSERT INTO t1 VALUES
-(0xADA1),(0xADA2),(0xADA3),(0xADA4),(0xADA5),(0xADA6),(0xADA7),(0xADA8),
-(0xADA9),(0xADAA),(0xADAB),(0xADAC),(0xADAD),(0xADAE),(0xADAF),(0xADB0),
-(0xADB1),(0xADB2),(0xADB3),(0xADB4),(0xADB5),(0xADB6),(0xADB7),(0xADB8),
-(0xADB9),(0xADBA),(0xADBB),(0xADBC),(0xADBD),(0xADBE),(0xADC0),(0xADC1),
-(0xADC2),(0xADC3),(0xADC4),(0xADC5),(0xADC6),(0xADC7),(0xADC8),(0xADC9),
-(0xADCA),(0xADCB),(0xADCC),(0xADCD),(0xADCE),(0xADCF),(0xADD0),(0xADD1),
-(0xADD2),(0xADD3),(0xADD4),(0xADD5),(0xADD6),(0xADDF),(0xADE0),(0xADE1),
-(0xADE2),(0xADE3),(0xADE4),(0xADE5),(0xADE6),(0xADE7),(0xADE8),(0xADE9),
-(0xADEA),(0xADEB),(0xADEC),(0xADED),(0xADEE),(0xADEF),(0xADF0),(0xADF1),
-(0xADF2),(0xADF3),(0xADF4),(0xADF5),(0xADF6),(0xADF7),(0xADF8),(0xADF9),
-(0xADFA),(0xADFB),(0xADFC);
-
-#IBM Selected Kanji and Non-Kanji (0xFA40 - 0xFC4B of cp932)
-INSERT INTO t1 VALUES
-(0x8FF3F3),(0x8FF3F4),(0x8FF3F5),(0x8FF3F6),(0x8FF3F7),(0x8FF3F8),(0x8FF3F9),(0x8FF3FA),
-(0x8FF3FB),(0x8FF3FC),(0x8FF3FD),(0x8FF3FE),(0x8FF4A1),(0x8FF4A2),(0x8FF4A3),(0x8FF4A4),
-(0x8FF4A5),(0x8FF4A6),(0x8FF4A7),(0x8FF4A8),(0xA2CC),(0x8FA2C3),(0x8FF4A9),(0x8FF4AA),
-(0x8FF4AB),(0x8FF4AC),(0x8FF4AD),(0xA2E8),(0x8FD4E3),(0x8FDCDF),(0x8FE4E9),(0x8FE3F8),
-(0x8FD9A1),(0x8FB1BB),(0x8FF4AE),(0x8FC2AD),(0x8FC3FC),(0x8FE4D0),(0x8FC2BF),(0x8FBCF4),
-(0x8FB0A9),(0x8FB0C8),(0x8FF4AF),(0x8FB0D2),(0x8FB0D4),(0x8FB0E3),(0x8FB0EE),(0x8FB1A7),
-(0x8FB1A3),(0x8FB1AC),(0x8FB1A9),(0x8FB1BE),(0x8FB1DF),(0x8FB1D8),(0x8FB1C8),(0x8FB1D7),
-(0x8FB1E3),(0x8FB1F4),(0x8FB1E1),(0x8FB2A3),(0x8FF4B0),(0x8FB2BB),(0x8FB2E6),(0x8FB2ED),
-(0x8FB2F5),(0x8FB2FC),(0x8FF4B1),(0x8FB3B5),(0x8FB3D8),(0x8FB3DB),(0x8FB3E5),(0x8FB3EE),
-(0x8FB3FB),(0x8FF4B2),(0x8FF4B3),(0x8FB4C0),(0x8FB4C7),(0x8FB4D0),(0x8FB4DE),(0x8FF4B4),
-(0x8FB5AA),(0x8FF4B5),(0x8FB5AF),(0x8FB5C4),(0x8FB5E8),(0x8FF4B6),(0x8FB7C2),(0x8FB7E4),
-(0x8FB7E8),(0x8FB7E7),(0x8FF4B7),(0x8FF4B8),(0x8FF4B9),(0x8FB8CE),(0x8FB8E1),(0x8FB8F5),
-(0x8FB8F7),(0x8FB8F8),(0x8FB8FC),(0x8FB9AF),(0x8FB9B7),(0x8FBABE),(0x8FBADB),(0x8FCDAA),
-(0x8FBAE1),(0x8FF4BA),(0x8FBAEB),(0x8FBBB3),(0x8FBBB8),(0x8FF4BB),(0x8FBBCA),(0x8FF4BC),
-(0x8FF4BD),(0x8FBBD0),(0x8FBBDE),(0x8FBBF4),(0x8FBBF5),(0x8FBBF9),(0x8FBCE4),(0x8FBCED),
-(0x8FBCFE),(0x8FF4BE),(0x8FBDC2),(0x8FBDE7),(0x8FF4BF),(0x8FBDF0),(0x8FBEB0),(0x8FBEAC),
-(0x8FF4C0),(0x8FBEB3),(0x8FBEBD),(0x8FBECD),(0x8FBEC9),(0x8FBEE4),(0x8FBFA8),(0x8FBFC9),
-(0x8FC0C4),(0x8FC0E4),(0x8FC0F4),(0x8FC1A6),(0x8FF4C1),(0x8FC1F5),(0x8FC1FC),(0x8FF4C2),
-(0x8FC1F8),(0x8FC2AB),(0x8FC2A1),(0x8FC2A5),(0x8FF4C3),(0x8FC2B8),(0x8FC2BA),(0x8FF4C4),
-(0x8FC2C4),(0x8FC2D2),(0x8FC2D7),(0x8FC2DB),(0x8FC2DE),(0x8FC2ED),(0x8FC2F0),(0x8FF4C5),
-(0x8FC3A1),(0x8FC3B5),(0x8FC3C9),(0x8FC3B9),(0x8FF4C6),(0x8FC3D8),(0x8FC3FE),(0x8FF4C7),
-(0x8FC4CC),(0x8FF4C8),(0x8FC4D9),(0x8FC4EA),(0x8FC4FD),(0x8FF4C9),(0x8FC5A7),(0x8FC5B5),
-(0x8FC5B6),(0x8FF4CA),(0x8FC5D5),(0x8FC6B8),(0x8FC6D7),(0x8FC6E0),(0x8FC6EA),(0x8FC6E3),
-(0x8FC7A1),(0x8FC7AB),(0x8FC7C7),(0x8FC7C3),(0x8FC7CB),(0x8FC7CF),(0x8FC7D9),(0x8FF4CB),
-(0x8FF4CC),(0x8FC7E6),(0x8FC7EE),(0x8FC7FC),(0x8FC7EB),(0x8FC7F0),(0x8FC8B1),(0x8FC8E5),
-(0x8FC8F8),(0x8FC9A6),(0x8FC9AB),(0x8FC9AD),(0x8FF4CD),(0x8FC9CA),(0x8FC9D3),(0x8FC9E9),
-(0x8FC9E3),(0x8FC9FC),(0x8FC9F4),(0x8FC9F5),(0x8FF4CE),(0x8FCAB3),(0x8FCABD),(0x8FCAEF),
-(0x8FCAF1),(0x8FCBAE),(0x8FF4CF),(0x8FCBCA),(0x8FCBE6),(0x8FCBEA),(0x8FCBF0),(0x8FCBF4),
-(0x8FCBEE),(0x8FCCA5),(0x8FCBF9),(0x8FCCAB),(0x8FCCAE),(0x8FCCAD),(0x8FCCB2),(0x8FCCC2),
-(0x8FCCD0),(0x8FCCD9),(0x8FF4D0),(0x8FCDBB),(0x8FF4D1),(0x8FCEBB),(0x8FF4D2),(0x8FCEBA),
-(0x8FCEC3),(0x8FF4D3),(0x8FCEF2),(0x8FB3DD),(0x8FCFD5),(0x8FCFE2),(0x8FCFE9),(0x8FCFED),
-(0x8FF4D4),(0x8FF4D5),(0x8FF4D6),(0x8FF4D7),(0x8FD0E5),(0x8FF4D8),(0x8FD0E9),(0x8FD1E8),
-(0x8FF4D9),(0x8FF4DA),(0x8FD1EC),(0x8FD2BB),(0x8FF4DB),(0x8FD3E1),(0x8FD3E8),(0x8FD4A7),
-(0x8FF4DC),(0x8FF4DD),(0x8FD4D4),(0x8FD4F2),(0x8FD5AE),(0x8FF4DE),(0x8FD7DE),(0x8FF4DF),
-(0x8FD8A2),(0x8FD8B7),(0x8FD8C1),(0x8FD8D1),(0x8FD8F4),(0x8FD9C6),(0x8FD9C8),(0x8FD9D1),
-(0x8FF4E0),(0x8FF4E1),(0x8FF4E2),(0x8FF4E3),(0x8FF4E4),(0x8FDCD3),(0x8FDDC8),(0x8FDDD4),
-(0x8FDDEA),(0x8FDDFA),(0x8FDEA4),(0x8FDEB0),(0x8FF4E5),(0x8FDEB5),(0x8FDECB),(0x8FF4E6),
-(0x8FDFB9),(0x8FF4E7),(0x8FDFC3),(0x8FF4E8),(0x8FF4E9),(0x8FE0D9),(0x8FF4EA),(0x8FF4EB),
-(0x8FE1E2),(0x8FF4EC),(0x8FF4ED),(0x8FF4EE),(0x8FE2C7),(0x8FE3A8),(0x8FE3A6),(0x8FE3A9),
-(0x8FE3AF),(0x8FE3B0),(0x8FE3AA),(0x8FE3AB),(0x8FE3BC),(0x8FE3C1),(0x8FE3BF),(0x8FE3D5),
-(0x8FE3D8),(0x8FE3D6),(0x8FE3DF),(0x8FE3E3),(0x8FE3E1),(0x8FE3D4),(0x8FE3E9),(0x8FE4A6),
-(0x8FE3F1),(0x8FE3F2),(0x8FE4CB),(0x8FE4C1),(0x8FE4C3),(0x8FE4BE),(0x8FF4EF),(0x8FE4C0),
-(0x8FE4C7),(0x8FE4BF),(0x8FE4E0),(0x8FE4DE),(0x8FE4D1),(0x8FF4F0),(0x8FE4DC),(0x8FE4D2),
-(0x8FE4DB),(0x8FE4D4),(0x8FE4FA),(0x8FE4EF),(0x8FE5B3),(0x8FE5BF),(0x8FE5C9),(0x8FE5D0),
-(0x8FE5E2),(0x8FE5EA),(0x8FE5EB),(0x8FF4F1),(0x8FF4F2),(0x8FF4F3),(0x8FE6E8),(0x8FE6EF),
-(0x8FE7AC),(0x8FF4F4),(0x8FE7AE),(0x8FF4F5),(0x8FE7B1),(0x8FF4F6),(0x8FE7B2),(0x8FE8B1),
-(0x8FE8B6),(0x8FF4F7),(0x8FF4F8),(0x8FE8DD),(0x8FF4F9),(0x8FF4FA),(0x8FE9D1),(0x8FF4FB),
-(0x8FE9ED),(0x8FEACD),(0x8FF4FC),(0x8FEADB),(0x8FEAE6),(0x8FEAEA),(0x8FEBA5),(0x8FEBFB),
-(0x8FEBFA),(0x8FF4FD),(0x8FECD6),(0x8FF4FE);
-
-#User defined characters (0xF040-F9FC of cp932)
-INSERT INTO t1 VALUES
-(0xF5A1),(0xF5A2),(0xF5A3),(0xF5A4),(0xF5A5),(0xF5A6),(0xF5A7),(0xF5A8),
-(0xF5A9),(0xF5AA),(0xF5AB),(0xF5AC),(0xF5AD),(0xF5AE),(0xF5AF),(0xF5B0),
-(0xF5B1),(0xF5B2),(0xF5B3),(0xF5B4),(0xF5B5),(0xF5B6),(0xF5B7),(0xF5B8),
-(0xF5B9),(0xF5BA),(0xF5BB),(0xF5BC),(0xF5BD),(0xF5BE),(0xF5BF),(0xF5C0),
-(0xF5C1),(0xF5C2),(0xF5C3),(0xF5C4),(0xF5C5),(0xF5C6),(0xF5C7),(0xF5C8),
-(0xF5C9),(0xF5CA),(0xF5CB),(0xF5CC),(0xF5CD),(0xF5CE),(0xF5CF),(0xF5D0),
-(0xF5D1),(0xF5D2),(0xF5D3),(0xF5D4),(0xF5D5),(0xF5D6),(0xF5D7),(0xF5D8),
-(0xF5D9),(0xF5DA),(0xF5DB),(0xF5DC),(0xF5DD),(0xF5DE),(0xF5DF),(0xF5E0),
-(0xF5E1),(0xF5E2),(0xF5E3),(0xF5E4),(0xF5E5),(0xF5E6),(0xF5E7),(0xF5E8),
-(0xF5E9),(0xF5EA),(0xF5EB),(0xF5EC),(0xF5ED),(0xF5EE),(0xF5EF),(0xF5F0),
-(0xF5F1),(0xF5F2),(0xF5F3),(0xF5F4),(0xF5F5),(0xF5F6),(0xF5F7),(0xF5F8),
-(0xF5F9),(0xF5FA),(0xF5FB),(0xF5FC),(0xF5FD),(0xF5FE),
-(0xF6A1),(0xF6A2),(0xF6A3),(0xF6A4),(0xF6A5),(0xF6A6),(0xF6A7),(0xF6A8),
-(0xF6A9),(0xF6AA),(0xF6AB),(0xF6AC),(0xF6AD),(0xF6AE),(0xF6AF),(0xF6B0),
-(0xF6B1),(0xF6B2),(0xF6B3),(0xF6B4),(0xF6B5),(0xF6B6),(0xF6B7),(0xF6B8),
-(0xF6B9),(0xF6BA),(0xF6BB),(0xF6BC),(0xF6BD),(0xF6BE),(0xF6BF),(0xF6C0),
-(0xF6C1),(0xF6C2),(0xF6C3),(0xF6C4),(0xF6C5),(0xF6C6),(0xF6C7),(0xF6C8),
-(0xF6C9),(0xF6CA),(0xF6CB),(0xF6CC),(0xF6CD),(0xF6CE),(0xF6CF),(0xF6D0),
-(0xF6D1),(0xF6D2),(0xF6D3),(0xF6D4),(0xF6D5),(0xF6D6),(0xF6D7),(0xF6D8),
-(0xF6D9),(0xF6DA),(0xF6DB),(0xF6DC),(0xF6DD),(0xF6DE),(0xF6DF),(0xF6E0),
-(0xF6E1),(0xF6E2),(0xF6E3),(0xF6E4),(0xF6E5),(0xF6E6),(0xF6E7),(0xF6E8),
-(0xF6E9),(0xF6EA),(0xF6EB),(0xF6EC),(0xF6ED),(0xF6EE),(0xF6EF),(0xF6F0),
-(0xF6F1),(0xF6F2),(0xF6F3),(0xF6F4),(0xF6F5),(0xF6F6),(0xF6F7),(0xF6F8),
-(0xF6F9),(0xF6FA),(0xF6FB),(0xF6FC),(0xF6FD),(0xF6FE),
-(0xF7A1),(0xF7A2),(0xF7A3),(0xF7A4),(0xF7A5),(0xF7A6),(0xF7A7),(0xF7A8),
-(0xF7A9),(0xF7AA),(0xF7AB),(0xF7AC),(0xF7AD),(0xF7AE),(0xF7AF),(0xF7B0),
-(0xF7B1),(0xF7B2),(0xF7B3),(0xF7B4),(0xF7B5),(0xF7B6),(0xF7B7),(0xF7B8),
-(0xF7B9),(0xF7BA),(0xF7BB),(0xF7BC),(0xF7BD),(0xF7BE),(0xF7BF),(0xF7C0),
-(0xF7C1),(0xF7C2),(0xF7C3),(0xF7C4),(0xF7C5),(0xF7C6),(0xF7C7),(0xF7C8),
-(0xF7C9),(0xF7CA),(0xF7CB),(0xF7CC),(0xF7CD),(0xF7CE),(0xF7CF),(0xF7D0),
-(0xF7D1),(0xF7D2),(0xF7D3),(0xF7D4),(0xF7D5),(0xF7D6),(0xF7D7),(0xF7D8),
-(0xF7D9),(0xF7DA),(0xF7DB),(0xF7DC),(0xF7DD),(0xF7DE),(0xF7DF),(0xF7E0),
-(0xF7E1),(0xF7E2),(0xF7E3),(0xF7E4),(0xF7E5),(0xF7E6),(0xF7E7),(0xF7E8),
-(0xF7E9),(0xF7EA),(0xF7EB),(0xF7EC),(0xF7ED),(0xF7EE),(0xF7EF),(0xF7F0),
-(0xF7F1),(0xF7F2),(0xF7F3),(0xF7F4),(0xF7F5),(0xF7F6),(0xF7F7),(0xF7F8),
-(0xF7F9),(0xF7FA),(0xF7FB),(0xF7FC),(0xF7FD),(0xF7FE),
-(0xF8A1),(0xF8A2),(0xF8A3),(0xF8A4),(0xF8A5),(0xF8A6),(0xF8A7),(0xF8A8),
-(0xF8A9),(0xF8AA),(0xF8AB),(0xF8AC),(0xF8AD),(0xF8AE),(0xF8AF),(0xF8B0),
-(0xF8B1),(0xF8B2),(0xF8B3),(0xF8B4),(0xF8B5),(0xF8B6),(0xF8B7),(0xF8B8),
-(0xF8B9),(0xF8BA),(0xF8BB),(0xF8BC),(0xF8BD),(0xF8BE),(0xF8BF),(0xF8C0),
-(0xF8C1),(0xF8C2),(0xF8C3),(0xF8C4),(0xF8C5),(0xF8C6),(0xF8C7),(0xF8C8),
-(0xF8C9),(0xF8CA),(0xF8CB),(0xF8CC),(0xF8CD),(0xF8CE),(0xF8CF),(0xF8D0),
-(0xF8D1),(0xF8D2),(0xF8D3),(0xF8D4),(0xF8D5),(0xF8D6),(0xF8D7),(0xF8D8),
-(0xF8D9),(0xF8DA),(0xF8DB),(0xF8DC),(0xF8DD),(0xF8DE),(0xF8DF),(0xF8E0),
-(0xF8E1),(0xF8E2),(0xF8E3),(0xF8E4),(0xF8E5),(0xF8E6),(0xF8E7),(0xF8E8),
-(0xF8E9),(0xF8EA),(0xF8EB),(0xF8EC),(0xF8ED),(0xF8EE),(0xF8EF),(0xF8F0),
-(0xF8F1),(0xF8F2),(0xF8F3),(0xF8F4),(0xF8F5),(0xF8F6),(0xF8F7),(0xF8F8),
-(0xF8F9),(0xF8FA),(0xF8FB),(0xF8FC),(0xF8FD),(0xF8FE),
-(0xF9A1),(0xF9A2),(0xF9A3),(0xF9A4),(0xF9A5),(0xF9A6),(0xF9A7),(0xF9A8),
-(0xF9A9),(0xF9AA),(0xF9AB),(0xF9AC),(0xF9AD),(0xF9AE),(0xF9AF),(0xF9B0),
-(0xF9B1),(0xF9B2),(0xF9B3),(0xF9B4),(0xF9B5),(0xF9B6),(0xF9B7),(0xF9B8),
-(0xF9B9),(0xF9BA),(0xF9BB),(0xF9BC),(0xF9BD),(0xF9BE),(0xF9BF),(0xF9C0),
-(0xF9C1),(0xF9C2),(0xF9C3),(0xF9C4),(0xF9C5),(0xF9C6),(0xF9C7),(0xF9C8),
-(0xF9C9),(0xF9CA),(0xF9CB),(0xF9CC),(0xF9CD),(0xF9CE),(0xF9CF),(0xF9D0),
-(0xF9D1),(0xF9D2),(0xF9D3),(0xF9D4),(0xF9D5),(0xF9D6),(0xF9D7),(0xF9D8),
-(0xF9D9),(0xF9DA),(0xF9DB),(0xF9DC),(0xF9DD),(0xF9DE),(0xF9DF),(0xF9E0),
-(0xF9E1),(0xF9E2),(0xF9E3),(0xF9E4),(0xF9E5),(0xF9E6),(0xF9E7),(0xF9E8),
-(0xF9E9),(0xF9EA),(0xF9EB),(0xF9EC),(0xF9ED),(0xF9EE),(0xF9EF),(0xF9F0),
-(0xF9F1),(0xF9F2),(0xF9F3),(0xF9F4),(0xF9F5),(0xF9F6),(0xF9F7),(0xF9F8),
-(0xF9F9),(0xF9FA),(0xF9FB),(0xF9FC),(0xF9FD),(0xF9FE),
-(0xFAA1),(0xFAA2),(0xFAA3),(0xFAA4),(0xFAA5),(0xFAA6),(0xFAA7),(0xFAA8),
-(0xFAA9),(0xFAAA),(0xFAAB),(0xFAAC),(0xFAAD),(0xFAAE),(0xFAAF),(0xFAB0),
-(0xFAB1),(0xFAB2),(0xFAB3),(0xFAB4),(0xFAB5),(0xFAB6),(0xFAB7),(0xFAB8),
-(0xFAB9),(0xFABA),(0xFABB),(0xFABC),(0xFABD),(0xFABE),(0xFABF),(0xFAC0),
-(0xFAC1),(0xFAC2),(0xFAC3),(0xFAC4),(0xFAC5),(0xFAC6),(0xFAC7),(0xFAC8),
-(0xFAC9),(0xFACA),(0xFACB),(0xFACC),(0xFACD),(0xFACE),(0xFACF),(0xFAD0),
-(0xFAD1),(0xFAD2),(0xFAD3),(0xFAD4),(0xFAD5),(0xFAD6),(0xFAD7),(0xFAD8),
-(0xFAD9),(0xFADA),(0xFADB),(0xFADC),(0xFADD),(0xFADE),(0xFADF),(0xFAE0),
-(0xFAE1),(0xFAE2),(0xFAE3),(0xFAE4),(0xFAE5),(0xFAE6),(0xFAE7),(0xFAE8),
-(0xFAE9),(0xFAEA),(0xFAEB),(0xFAEC),(0xFAED),(0xFAEE),(0xFAEF),(0xFAF0),
-(0xFAF1),(0xFAF2),(0xFAF3),(0xFAF4),(0xFAF5),(0xFAF6),(0xFAF7),(0xFAF8),
-(0xFAF9),(0xFAFA),(0xFAFB),(0xFAFC),(0xFAFD),(0xFAFE),
-(0xFBA1),(0xFBA2),(0xFBA3),(0xFBA4),(0xFBA5),(0xFBA6),(0xFBA7),(0xFBA8),
-(0xFBA9),(0xFBAA),(0xFBAB),(0xFBAC),(0xFBAD),(0xFBAE),(0xFBAF),(0xFBB0),
-(0xFBB1),(0xFBB2),(0xFBB3),(0xFBB4),(0xFBB5),(0xFBB6),(0xFBB7),(0xFBB8),
-(0xFBB9),(0xFBBA),(0xFBBB),(0xFBBC),(0xFBBD),(0xFBBE),(0xFBBF),(0xFBC0),
-(0xFBC1),(0xFBC2),(0xFBC3),(0xFBC4),(0xFBC5),(0xFBC6),(0xFBC7),(0xFBC8),
-(0xFBC9),(0xFBCA),(0xFBCB),(0xFBCC),(0xFBCD),(0xFBCE),(0xFBCF),(0xFBD0),
-(0xFBD1),(0xFBD2),(0xFBD3),(0xFBD4),(0xFBD5),(0xFBD6),(0xFBD7),(0xFBD8),
-(0xFBD9),(0xFBDA),(0xFBDB),(0xFBDC),(0xFBDD),(0xFBDE),(0xFBDF),(0xFBE0),
-(0xFBE1),(0xFBE2),(0xFBE3),(0xFBE4),(0xFBE5),(0xFBE6),(0xFBE7),(0xFBE8),
-(0xFBE9),(0xFBEA),(0xFBEB),(0xFBEC),(0xFBED),(0xFBEE),(0xFBEF),(0xFBF0),
-(0xFBF1),(0xFBF2),(0xFBF3),(0xFBF4),(0xFBF5),(0xFBF6),(0xFBF7),(0xFBF8),
-(0xFBF9),(0xFBFA),(0xFBFB),(0xFBFC),(0xFBFD),(0xFBFE),
-(0xFCA1),(0xFCA2),(0xFCA3),(0xFCA4),(0xFCA5),(0xFCA6),(0xFCA7),(0xFCA8),
-(0xFCA9),(0xFCAA),(0xFCAB),(0xFCAC),(0xFCAD),(0xFCAE),(0xFCAF),(0xFCB0),
-(0xFCB1),(0xFCB2),(0xFCB3),(0xFCB4),(0xFCB5),(0xFCB6),(0xFCB7),(0xFCB8),
-(0xFCB9),(0xFCBA),(0xFCBB),(0xFCBC),(0xFCBD),(0xFCBE),(0xFCBF),(0xFCC0),
-(0xFCC1),(0xFCC2),(0xFCC3),(0xFCC4),(0xFCC5),(0xFCC6),(0xFCC7),(0xFCC8),
-(0xFCC9),(0xFCCA),(0xFCCB),(0xFCCC),(0xFCCD),(0xFCCE),(0xFCCF),(0xFCD0),
-(0xFCD1),(0xFCD2),(0xFCD3),(0xFCD4),(0xFCD5),(0xFCD6),(0xFCD7),(0xFCD8),
-(0xFCD9),(0xFCDA),(0xFCDB),(0xFCDC),(0xFCDD),(0xFCDE),(0xFCDF),(0xFCE0),
-(0xFCE1),(0xFCE2),(0xFCE3),(0xFCE4),(0xFCE5),(0xFCE6),(0xFCE7),(0xFCE8),
-(0xFCE9),(0xFCEA),(0xFCEB),(0xFCEC),(0xFCED),(0xFCEE),(0xFCEF),(0xFCF0),
-(0xFCF1),(0xFCF2),(0xFCF3),(0xFCF4),(0xFCF5),(0xFCF6),(0xFCF7),(0xFCF8),
-(0xFCF9),(0xFCFA),(0xFCFB),(0xFCFC),(0xFCFD),(0xFCFE),
-(0xFDA1),(0xFDA2),(0xFDA3),(0xFDA4),(0xFDA5),(0xFDA6),(0xFDA7),(0xFDA8),
-(0xFDA9),(0xFDAA),(0xFDAB),(0xFDAC),(0xFDAD),(0xFDAE),(0xFDAF),(0xFDB0),
-(0xFDB1),(0xFDB2),(0xFDB3),(0xFDB4),(0xFDB5),(0xFDB6),(0xFDB7),(0xFDB8),
-(0xFDB9),(0xFDBA),(0xFDBB),(0xFDBC),(0xFDBD),(0xFDBE),(0xFDBF),(0xFDC0),
-(0xFDC1),(0xFDC2),(0xFDC3),(0xFDC4),(0xFDC5),(0xFDC6),(0xFDC7),(0xFDC8),
-(0xFDC9),(0xFDCA),(0xFDCB),(0xFDCC),(0xFDCD),(0xFDCE),(0xFDCF),(0xFDD0),
-(0xFDD1),(0xFDD2),(0xFDD3),(0xFDD4),(0xFDD5),(0xFDD6),(0xFDD7),(0xFDD8),
-(0xFDD9),(0xFDDA),(0xFDDB),(0xFDDC),(0xFDDD),(0xFDDE),(0xFDDF),(0xFDE0),
-(0xFDE1),(0xFDE2),(0xFDE3),(0xFDE4),(0xFDE5),(0xFDE6),(0xFDE7),(0xFDE8),
-(0xFDE9),(0xFDEA),(0xFDEB),(0xFDEC),(0xFDED),(0xFDEE),(0xFDEF),(0xFDF0),
-(0xFDF1),(0xFDF2),(0xFDF3),(0xFDF4),(0xFDF5),(0xFDF6),(0xFDF7),(0xFDF8),
-(0xFDF9),(0xFDFA),(0xFDFB),(0xFDFC),(0xFDFD),(0xFDFE),
-(0xFEA1),(0xFEA2),(0xFEA3),(0xFEA4),(0xFEA5),(0xFEA6),(0xFEA7),(0xFEA8),
-(0xFEA9),(0xFEAA),(0xFEAB),(0xFEAC),(0xFEAD),(0xFEAE),(0xFEAF),(0xFEB0),
-(0xFEB1),(0xFEB2),(0xFEB3),(0xFEB4),(0xFEB5),(0xFEB6),(0xFEB7),(0xFEB8),
-(0xFEB9),(0xFEBA),(0xFEBB),(0xFEBC),(0xFEBD),(0xFEBE),(0xFEBF),(0xFEC0),
-(0xFEC1),(0xFEC2),(0xFEC3),(0xFEC4),(0xFEC5),(0xFEC6),(0xFEC7),(0xFEC8),
-(0xFEC9),(0xFECA),(0xFECB),(0xFECC),(0xFECD),(0xFECE),(0xFECF),(0xFED0),
-(0xFED1),(0xFED2),(0xFED3),(0xFED4),(0xFED5),(0xFED6),(0xFED7),(0xFED8),
-(0xFED9),(0xFEDA),(0xFEDB),(0xFEDC),(0xFEDD),(0xFEDE),(0xFEDF),(0xFEE0),
-(0xFEE1),(0xFEE2),(0xFEE3),(0xFEE4),(0xFEE5),(0xFEE6),(0xFEE7),(0xFEE8),
-(0xFEE9),(0xFEEA),(0xFEEB),(0xFEEC),(0xFEED),(0xFEEE),(0xFEEF),(0xFEF0),
-(0xFEF1),(0xFEF2),(0xFEF3),(0xFEF4),(0xFEF5),(0xFEF6),(0xFEF7),(0xFEF8),
-(0xFEF9),(0xFEFA),(0xFEFB),(0xFEFC),(0xFEFD),(0xFEFE),
-(0x8FF5A1),(0x8FF5A2),(0x8FF5A3),(0x8FF5A4),(0x8FF5A5),(0x8FF5A6),(0x8FF5A7),(0x8FF5A8),
-(0x8FF5A9),(0x8FF5AA),(0x8FF5AB),(0x8FF5AC),(0x8FF5AD),(0x8FF5AE),(0x8FF5AF),(0x8FF5B0),
-(0x8FF5B1),(0x8FF5B2),(0x8FF5B3),(0x8FF5B4),(0x8FF5B5),(0x8FF5B6),(0x8FF5B7),(0x8FF5B8),
-(0x8FF5B9),(0x8FF5BA),(0x8FF5BB),(0x8FF5BC),(0x8FF5BD),(0x8FF5BE),(0x8FF5BF),(0x8FF5C0),
-(0x8FF5C1),(0x8FF5C2),(0x8FF5C3),(0x8FF5C4),(0x8FF5C5),(0x8FF5C6),(0x8FF5C7),(0x8FF5C8),
-(0x8FF5C9),(0x8FF5CA),(0x8FF5CB),(0x8FF5CC),(0x8FF5CD),(0x8FF5CE),(0x8FF5CF),(0x8FF5D0),
-(0x8FF5D1),(0x8FF5D2),(0x8FF5D3),(0x8FF5D4),(0x8FF5D5),(0x8FF5D6),(0x8FF5D7),(0x8FF5D8),
-(0x8FF5D9),(0x8FF5DA),(0x8FF5DB),(0x8FF5DC),(0x8FF5DD),(0x8FF5DE),(0x8FF5DF),(0x8FF5E0),
-(0x8FF5E1),(0x8FF5E2),(0x8FF5E3),(0x8FF5E4),(0x8FF5E5),(0x8FF5E6),(0x8FF5E7),(0x8FF5E8),
-(0x8FF5E9),(0x8FF5EA),(0x8FF5EB),(0x8FF5EC),(0x8FF5ED),(0x8FF5EE),(0x8FF5EF),(0x8FF5F0),
-(0x8FF5F1),(0x8FF5F2),(0x8FF5F3),(0x8FF5F4),(0x8FF5F5),(0x8FF5F6),(0x8FF5F7),(0x8FF5F8),
-(0x8FF5F9),(0x8FF5FA),(0x8FF5FB),(0x8FF5FC),(0x8FF5FD),(0x8FF5FE),
-(0x8FF6A1),(0x8FF6A2),(0x8FF6A3),(0x8FF6A4),(0x8FF6A5),(0x8FF6A6),(0x8FF6A7),(0x8FF6A8),
-(0x8FF6A9),(0x8FF6AA),(0x8FF6AB),(0x8FF6AC),(0x8FF6AD),(0x8FF6AE),(0x8FF6AF),(0x8FF6B0),
-(0x8FF6B1),(0x8FF6B2),(0x8FF6B3),(0x8FF6B4),(0x8FF6B5),(0x8FF6B6),(0x8FF6B7),(0x8FF6B8),
-(0x8FF6B9),(0x8FF6BA),(0x8FF6BB),(0x8FF6BC),(0x8FF6BD),(0x8FF6BE),(0x8FF6BF),(0x8FF6C0),
-(0x8FF6C1),(0x8FF6C2),(0x8FF6C3),(0x8FF6C4),(0x8FF6C5),(0x8FF6C6),(0x8FF6C7),(0x8FF6C8),
-(0x8FF6C9),(0x8FF6CA),(0x8FF6CB),(0x8FF6CC),(0x8FF6CD),(0x8FF6CE),(0x8FF6CF),(0x8FF6D0),
-(0x8FF6D1),(0x8FF6D2),(0x8FF6D3),(0x8FF6D4),(0x8FF6D5),(0x8FF6D6),(0x8FF6D7),(0x8FF6D8),
-(0x8FF6D9),(0x8FF6DA),(0x8FF6DB),(0x8FF6DC),(0x8FF6DD),(0x8FF6DE),(0x8FF6DF),(0x8FF6E0),
-(0x8FF6E1),(0x8FF6E2),(0x8FF6E3),(0x8FF6E4),(0x8FF6E5),(0x8FF6E6),(0x8FF6E7),(0x8FF6E8),
-(0x8FF6E9),(0x8FF6EA),(0x8FF6EB),(0x8FF6EC),(0x8FF6ED),(0x8FF6EE),(0x8FF6EF),(0x8FF6F0),
-(0x8FF6F1),(0x8FF6F2),(0x8FF6F3),(0x8FF6F4),(0x8FF6F5),(0x8FF6F6),(0x8FF6F7),(0x8FF6F8),
-(0x8FF6F9),(0x8FF6FA),(0x8FF6FB),(0x8FF6FC),(0x8FF6FD),(0x8FF6FE),
-(0x8FF7A1),(0x8FF7A2),(0x8FF7A3),(0x8FF7A4),(0x8FF7A5),(0x8FF7A6),(0x8FF7A7),(0x8FF7A8),
-(0x8FF7A9),(0x8FF7AA),(0x8FF7AB),(0x8FF7AC),(0x8FF7AD),(0x8FF7AE),(0x8FF7AF),(0x8FF7B0),
-(0x8FF7B1),(0x8FF7B2),(0x8FF7B3),(0x8FF7B4),(0x8FF7B5),(0x8FF7B6),(0x8FF7B7),(0x8FF7B8),
-(0x8FF7B9),(0x8FF7BA),(0x8FF7BB),(0x8FF7BC),(0x8FF7BD),(0x8FF7BE),(0x8FF7BF),(0x8FF7C0),
-(0x8FF7C1),(0x8FF7C2),(0x8FF7C3),(0x8FF7C4),(0x8FF7C5),(0x8FF7C6),(0x8FF7C7),(0x8FF7C8),
-(0x8FF7C9),(0x8FF7CA),(0x8FF7CB),(0x8FF7CC),(0x8FF7CD),(0x8FF7CE),(0x8FF7CF),(0x8FF7D0),
-(0x8FF7D1),(0x8FF7D2),(0x8FF7D3),(0x8FF7D4),(0x8FF7D5),(0x8FF7D6),(0x8FF7D7),(0x8FF7D8),
-(0x8FF7D9),(0x8FF7DA),(0x8FF7DB),(0x8FF7DC),(0x8FF7DD),(0x8FF7DE),(0x8FF7DF),(0x8FF7E0),
-(0x8FF7E1),(0x8FF7E2),(0x8FF7E3),(0x8FF7E4),(0x8FF7E5),(0x8FF7E6),(0x8FF7E7),(0x8FF7E8),
-(0x8FF7E9),(0x8FF7EA),(0x8FF7EB),(0x8FF7EC),(0x8FF7ED),(0x8FF7EE),(0x8FF7EF),(0x8FF7F0),
-(0x8FF7F1),(0x8FF7F2),(0x8FF7F3),(0x8FF7F4),(0x8FF7F5),(0x8FF7F6),(0x8FF7F7),(0x8FF7F8),
-(0x8FF7F9),(0x8FF7FA),(0x8FF7FB),(0x8FF7FC),(0x8FF7FD),(0x8FF7FE),
-(0x8FF8A1),(0x8FF8A2),(0x8FF8A3),(0x8FF8A4),(0x8FF8A5),(0x8FF8A6),(0x8FF8A7),(0x8FF8A8),
-(0x8FF8A9),(0x8FF8AA),(0x8FF8AB),(0x8FF8AC),(0x8FF8AD),(0x8FF8AE),(0x8FF8AF),(0x8FF8B0),
-(0x8FF8B1),(0x8FF8B2),(0x8FF8B3),(0x8FF8B4),(0x8FF8B5),(0x8FF8B6),(0x8FF8B7),(0x8FF8B8),
-(0x8FF8B9),(0x8FF8BA),(0x8FF8BB),(0x8FF8BC),(0x8FF8BD),(0x8FF8BE),(0x8FF8BF),(0x8FF8C0),
-(0x8FF8C1),(0x8FF8C2),(0x8FF8C3),(0x8FF8C4),(0x8FF8C5),(0x8FF8C6),(0x8FF8C7),(0x8FF8C8),
-(0x8FF8C9),(0x8FF8CA),(0x8FF8CB),(0x8FF8CC),(0x8FF8CD),(0x8FF8CE),(0x8FF8CF),(0x8FF8D0),
-(0x8FF8D1),(0x8FF8D2),(0x8FF8D3),(0x8FF8D4),(0x8FF8D5),(0x8FF8D6),(0x8FF8D7),(0x8FF8D8),
-(0x8FF8D9),(0x8FF8DA),(0x8FF8DB),(0x8FF8DC),(0x8FF8DD),(0x8FF8DE),(0x8FF8DF),(0x8FF8E0),
-(0x8FF8E1),(0x8FF8E2),(0x8FF8E3),(0x8FF8E4),(0x8FF8E5),(0x8FF8E6),(0x8FF8E7),(0x8FF8E8),
-(0x8FF8E9),(0x8FF8EA),(0x8FF8EB),(0x8FF8EC),(0x8FF8ED),(0x8FF8EE),(0x8FF8EF),(0x8FF8F0),
-(0x8FF8F1),(0x8FF8F2),(0x8FF8F3),(0x8FF8F4),(0x8FF8F5),(0x8FF8F6),(0x8FF8F7),(0x8FF8F8),
-(0x8FF8F9),(0x8FF8FA),(0x8FF8FB),(0x8FF8FC),(0x8FF8FD),(0x8FF8FE),
-(0x8FF9A1),(0x8FF9A2),(0x8FF9A3),(0x8FF9A4),(0x8FF9A5),(0x8FF9A6),(0x8FF9A7),(0x8FF9A8),
-(0x8FF9A9),(0x8FF9AA),(0x8FF9AB),(0x8FF9AC),(0x8FF9AD),(0x8FF9AE),(0x8FF9AF),(0x8FF9B0),
-(0x8FF9B1),(0x8FF9B2),(0x8FF9B3),(0x8FF9B4),(0x8FF9B5),(0x8FF9B6),(0x8FF9B7),(0x8FF9B8),
-(0x8FF9B9),(0x8FF9BA),(0x8FF9BB),(0x8FF9BC),(0x8FF9BD),(0x8FF9BE),(0x8FF9BF),(0x8FF9C0),
-(0x8FF9C1),(0x8FF9C2),(0x8FF9C3),(0x8FF9C4),(0x8FF9C5),(0x8FF9C6),(0x8FF9C7),(0x8FF9C8),
-(0x8FF9C9),(0x8FF9CA),(0x8FF9CB),(0x8FF9CC),(0x8FF9CD),(0x8FF9CE),(0x8FF9CF),(0x8FF9D0),
-(0x8FF9D1),(0x8FF9D2),(0x8FF9D3),(0x8FF9D4),(0x8FF9D5),(0x8FF9D6),(0x8FF9D7),(0x8FF9D8),
-(0x8FF9D9),(0x8FF9DA),(0x8FF9DB),(0x8FF9DC),(0x8FF9DD),(0x8FF9DE),(0x8FF9DF),(0x8FF9E0),
-(0x8FF9E1),(0x8FF9E2),(0x8FF9E3),(0x8FF9E4),(0x8FF9E5),(0x8FF9E6),(0x8FF9E7),(0x8FF9E8),
-(0x8FF9E9),(0x8FF9EA),(0x8FF9EB),(0x8FF9EC),(0x8FF9ED),(0x8FF9EE),(0x8FF9EF),(0x8FF9F0),
-(0x8FF9F1),(0x8FF9F2),(0x8FF9F3),(0x8FF9F4),(0x8FF9F5),(0x8FF9F6),(0x8FF9F7),(0x8FF9F8),
-(0x8FF9F9),(0x8FF9FA),(0x8FF9FB),(0x8FF9FC),(0x8FF9FD),(0x8FF9FE),
-(0x8FFAA1),(0x8FFAA2),(0x8FFAA3),(0x8FFAA4),(0x8FFAA5),(0x8FFAA6),(0x8FFAA7),(0x8FFAA8),
-(0x8FFAA9),(0x8FFAAA),(0x8FFAAB),(0x8FFAAC),(0x8FFAAD),(0x8FFAAE),(0x8FFAAF),(0x8FFAB0),
-(0x8FFAB1),(0x8FFAB2),(0x8FFAB3),(0x8FFAB4),(0x8FFAB5),(0x8FFAB6),(0x8FFAB7),(0x8FFAB8),
-(0x8FFAB9),(0x8FFABA),(0x8FFABB),(0x8FFABC),(0x8FFABD),(0x8FFABE),(0x8FFABF),(0x8FFAC0),
-(0x8FFAC1),(0x8FFAC2),(0x8FFAC3),(0x8FFAC4),(0x8FFAC5),(0x8FFAC6),(0x8FFAC7),(0x8FFAC8),
-(0x8FFAC9),(0x8FFACA),(0x8FFACB),(0x8FFACC),(0x8FFACD),(0x8FFACE),(0x8FFACF),(0x8FFAD0),
-(0x8FFAD1),(0x8FFAD2),(0x8FFAD3),(0x8FFAD4),(0x8FFAD5),(0x8FFAD6),(0x8FFAD7),(0x8FFAD8),
-(0x8FFAD9),(0x8FFADA),(0x8FFADB),(0x8FFADC),(0x8FFADD),(0x8FFADE),(0x8FFADF),(0x8FFAE0),
-(0x8FFAE1),(0x8FFAE2),(0x8FFAE3),(0x8FFAE4),(0x8FFAE5),(0x8FFAE6),(0x8FFAE7),(0x8FFAE8),
-(0x8FFAE9),(0x8FFAEA),(0x8FFAEB),(0x8FFAEC),(0x8FFAED),(0x8FFAEE),(0x8FFAEF),(0x8FFAF0),
-(0x8FFAF1),(0x8FFAF2),(0x8FFAF3),(0x8FFAF4),(0x8FFAF5),(0x8FFAF6),(0x8FFAF7),(0x8FFAF8),
-(0x8FFAF9),(0x8FFAFA),(0x8FFAFB),(0x8FFAFC),(0x8FFAFD),(0x8FFAFE),
-(0x8FFBA1),(0x8FFBA2),(0x8FFBA3),(0x8FFBA4),(0x8FFBA5),(0x8FFBA6),(0x8FFBA7),(0x8FFBA8),
-(0x8FFBA9),(0x8FFBAA),(0x8FFBAB),(0x8FFBAC),(0x8FFBAD),(0x8FFBAE),(0x8FFBAF),(0x8FFBB0),
-(0x8FFBB1),(0x8FFBB2),(0x8FFBB3),(0x8FFBB4),(0x8FFBB5),(0x8FFBB6),(0x8FFBB7),(0x8FFBB8),
-(0x8FFBB9),(0x8FFBBA),(0x8FFBBB),(0x8FFBBC),(0x8FFBBD),(0x8FFBBE),(0x8FFBBF),(0x8FFBC0),
-(0x8FFBC1),(0x8FFBC2),(0x8FFBC3),(0x8FFBC4),(0x8FFBC5),(0x8FFBC6),(0x8FFBC7),(0x8FFBC8),
-(0x8FFBC9),(0x8FFBCA),(0x8FFBCB),(0x8FFBCC),(0x8FFBCD),(0x8FFBCE),(0x8FFBCF),(0x8FFBD0),
-(0x8FFBD1),(0x8FFBD2),(0x8FFBD3),(0x8FFBD4),(0x8FFBD5),(0x8FFBD6),(0x8FFBD7),(0x8FFBD8),
-(0x8FFBD9),(0x8FFBDA),(0x8FFBDB),(0x8FFBDC),(0x8FFBDD),(0x8FFBDE),(0x8FFBDF),(0x8FFBE0),
-(0x8FFBE1),(0x8FFBE2),(0x8FFBE3),(0x8FFBE4),(0x8FFBE5),(0x8FFBE6),(0x8FFBE7),(0x8FFBE8),
-(0x8FFBE9),(0x8FFBEA),(0x8FFBEB),(0x8FFBEC),(0x8FFBED),(0x8FFBEE),(0x8FFBEF),(0x8FFBF0),
-(0x8FFBF1),(0x8FFBF2),(0x8FFBF3),(0x8FFBF4),(0x8FFBF5),(0x8FFBF6),(0x8FFBF7),(0x8FFBF8),
-(0x8FFBF9),(0x8FFBFA),(0x8FFBFB),(0x8FFBFC),(0x8FFBFD),(0x8FFBFE),
-(0x8FFCA1),(0x8FFCA2),(0x8FFCA3),(0x8FFCA4),(0x8FFCA5),(0x8FFCA6),(0x8FFCA7),(0x8FFCA8),
-(0x8FFCA9),(0x8FFCAA),(0x8FFCAB),(0x8FFCAC),(0x8FFCAD),(0x8FFCAE),(0x8FFCAF),(0x8FFCB0),
-(0x8FFCB1),(0x8FFCB2),(0x8FFCB3),(0x8FFCB4),(0x8FFCB5),(0x8FFCB6),(0x8FFCB7),(0x8FFCB8),
-(0x8FFCB9),(0x8FFCBA),(0x8FFCBB),(0x8FFCBC),(0x8FFCBD),(0x8FFCBE),(0x8FFCBF),(0x8FFCC0),
-(0x8FFCC1),(0x8FFCC2),(0x8FFCC3),(0x8FFCC4),(0x8FFCC5),(0x8FFCC6),(0x8FFCC7),(0x8FFCC8),
-(0x8FFCC9),(0x8FFCCA),(0x8FFCCB),(0x8FFCCC),(0x8FFCCD),(0x8FFCCE),(0x8FFCCF),(0x8FFCD0),
-(0x8FFCD1),(0x8FFCD2),(0x8FFCD3),(0x8FFCD4),(0x8FFCD5),(0x8FFCD6),(0x8FFCD7),(0x8FFCD8),
-(0x8FFCD9),(0x8FFCDA),(0x8FFCDB),(0x8FFCDC),(0x8FFCDD),(0x8FFCDE),(0x8FFCDF),(0x8FFCE0),
-(0x8FFCE1),(0x8FFCE2),(0x8FFCE3),(0x8FFCE4),(0x8FFCE5),(0x8FFCE6),(0x8FFCE7),(0x8FFCE8),
-(0x8FFCE9),(0x8FFCEA),(0x8FFCEB),(0x8FFCEC),(0x8FFCED),(0x8FFCEE),(0x8FFCEF),(0x8FFCF0),
-(0x8FFCF1),(0x8FFCF2),(0x8FFCF3),(0x8FFCF4),(0x8FFCF5),(0x8FFCF6),(0x8FFCF7),(0x8FFCF8),
-(0x8FFCF9),(0x8FFCFA),(0x8FFCFB),(0x8FFCFC),(0x8FFCFD),(0x8FFCFE),
-(0x8FFDA1),(0x8FFDA2),(0x8FFDA3),(0x8FFDA4),(0x8FFDA5),(0x8FFDA6),(0x8FFDA7),(0x8FFDA8),
-(0x8FFDA9),(0x8FFDAA),(0x8FFDAB),(0x8FFDAC),(0x8FFDAD),(0x8FFDAE),(0x8FFDAF),(0x8FFDB0),
-(0x8FFDB1),(0x8FFDB2),(0x8FFDB3),(0x8FFDB4),(0x8FFDB5),(0x8FFDB6),(0x8FFDB7),(0x8FFDB8),
-(0x8FFDB9),(0x8FFDBA),(0x8FFDBB),(0x8FFDBC),(0x8FFDBD),(0x8FFDBE),(0x8FFDBF),(0x8FFDC0),
-(0x8FFDC1),(0x8FFDC2),(0x8FFDC3),(0x8FFDC4),(0x8FFDC5),(0x8FFDC6),(0x8FFDC7),(0x8FFDC8),
-(0x8FFDC9),(0x8FFDCA),(0x8FFDCB),(0x8FFDCC),(0x8FFDCD),(0x8FFDCE),(0x8FFDCF),(0x8FFDD0),
-(0x8FFDD1),(0x8FFDD2),(0x8FFDD3),(0x8FFDD4),(0x8FFDD5),(0x8FFDD6),(0x8FFDD7),(0x8FFDD8),
-(0x8FFDD9),(0x8FFDDA),(0x8FFDDB),(0x8FFDDC),(0x8FFDDD),(0x8FFDDE),(0x8FFDDF),(0x8FFDE0),
-(0x8FFDE1),(0x8FFDE2),(0x8FFDE3),(0x8FFDE4),(0x8FFDE5),(0x8FFDE6),(0x8FFDE7),(0x8FFDE8),
-(0x8FFDE9),(0x8FFDEA),(0x8FFDEB),(0x8FFDEC),(0x8FFDED),(0x8FFDEE),(0x8FFDEF),(0x8FFDF0),
-(0x8FFDF1),(0x8FFDF2),(0x8FFDF3),(0x8FFDF4),(0x8FFDF5),(0x8FFDF6),(0x8FFDF7),(0x8FFDF8),
-(0x8FFDF9),(0x8FFDFA),(0x8FFDFB),(0x8FFDFC),(0x8FFDFD),(0x8FFDFE),
-(0x8FFEA1),(0x8FFEA2),(0x8FFEA3),(0x8FFEA4),(0x8FFEA5),(0x8FFEA6),(0x8FFEA7),(0x8FFEA8),
-(0x8FFEA9),(0x8FFEAA),(0x8FFEAB),(0x8FFEAC),(0x8FFEAD),(0x8FFEAE),(0x8FFEAF),(0x8FFEB0),
-(0x8FFEB1),(0x8FFEB2),(0x8FFEB3),(0x8FFEB4),(0x8FFEB5),(0x8FFEB6),(0x8FFEB7),(0x8FFEB8),
-(0x8FFEB9),(0x8FFEBA),(0x8FFEBB),(0x8FFEBC),(0x8FFEBD),(0x8FFEBE),(0x8FFEBF),(0x8FFEC0),
-(0x8FFEC1),(0x8FFEC2),(0x8FFEC3),(0x8FFEC4),(0x8FFEC5),(0x8FFEC6),(0x8FFEC7),(0x8FFEC8),
-(0x8FFEC9),(0x8FFECA),(0x8FFECB),(0x8FFECC),(0x8FFECD),(0x8FFECE),(0x8FFECF),(0x8FFED0),
-(0x8FFED1),(0x8FFED2),(0x8FFED3),(0x8FFED4),(0x8FFED5),(0x8FFED6),(0x8FFED7),(0x8FFED8),
-(0x8FFED9),(0x8FFEDA),(0x8FFEDB),(0x8FFEDC),(0x8FFEDD),(0x8FFEDE),(0x8FFEDF),(0x8FFEE0),
-(0x8FFEE1),(0x8FFEE2),(0x8FFEE3),(0x8FFEE4),(0x8FFEE5),(0x8FFEE6),(0x8FFEE7),(0x8FFEE8),
-(0x8FFEE9),(0x8FFEEA),(0x8FFEEB),(0x8FFEEC),(0x8FFEED),(0x8FFEEE),(0x8FFEEF),(0x8FFEF0),
-(0x8FFEF1),(0x8FFEF2),(0x8FFEF3),(0x8FFEF4),(0x8FFEF5),(0x8FFEF6),(0x8FFEF7),(0x8FFEF8),
-(0x8FFEF9),(0x8FFEFA),(0x8FFEFB),(0x8FFEFC),(0x8FFEFD),(0x8FFEFE);
-
-#Test that all the characters are stored correctly
-SELECT HEX(c1) FROM t1;
-
-#Test conversion to ucs2
-CREATE TABLE t2 SELECT CONVERT(c1 USING ucs2) AS c1 FROM t1;
-SELECT HEX(c1) FROM t2;
-
-#Test round trip conversion
-CREATE TABLE t3 SELECT CONVERT(c1 USING eucjpms) AS c1 FROM t2;
-SELECT HEX(c1) FROM t3;
-
-#Test conversion to cp932
-CREATE TABLE t4 SELECT CONVERT(c1 USING cp932) AS c1 FROM t1;
-SELECT HEX(c1) FROM t4;
-
-DROP TABLE t1;
-DROP TABLE t2;
-DROP TABLE t3;
-DROP TABLE t4;
-
-#Test bug#11717
-CREATE TABLE t1(c1 varchar(10)) default character set = eucjpms;
-
-insert into t1 values(_ucs2 0x00F7);
-insert into t1 values(_eucjpms 0xA1E0);
-insert into t1 values(_ujis 0xA1E0);
-insert into t1 values(_sjis 0x8180);
-insert into t1 values(_cp932 0x8180);
-
-SELECT HEX(c1) FROM t1;
-
-DROP TABLE t1;
-
-SET collation_connection='eucjpms_japanese_ci';
--- source include/ctype_filesort.inc
--- source include/ctype_like_range_f1f2.inc
-SET collation_connection='eucjpms_bin';
--- source include/ctype_filesort.inc
--- source include/ctype_like_range_f1f2.inc
-
-#
-# Bugs#15375: Unassigned multibyte codes are broken
-# into parts when converting to Unicode.
-# This query should return 0x003F0041. I.e. it should
-# scan unassigned double-byte character 0xA5FE, convert
-# it as QUESTION MARK 0x003F and then scan the next
-# character, which is a single byte character 0x41.
-#
-select hex(convert(_eucjpms 0xA5FE41 using ucs2));
-# This one should return 0x003F0041:
-# scan unassigned three-byte character 0x8FABF8,
-# convert it as QUESTION MARK 0x003F and then scan
-# the next character, which is a single byte character 0x41.
-select hex(convert(_eucjpms 0x8FABF841 using ucs2));
-
-
-#
-# Bug #48053 String::c_ptr has a race and/or does an invalid
-# memory reference
-# (triggered by Valgrind tests)
-# (see also ctype_eucjpms.test, ctype_cp1250.test, ctype_cp1251.test)
-#
---error 1649
-set global LC_TIME_NAMES=convert((convert((0x63) using eucjpms)) using utf8);
-
-
---echo #
---echo # Start of 5.5 tests
---echo #
-
---echo #
---echo # Testing WL#4583 Case conversion in Asian character sets
---echo #
-#
-# Populate t1 with all hex digits
-#
-SET NAMES utf8;
-SET collation_connection=eucjpms_japanese_ci;
-CREATE TABLE t1 (b VARCHAR(2));
-INSERT INTO t1 VALUES ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7');
-INSERT INTO t1 VALUES ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F');
-#
-# Populate tables head and tail with values '00'-'FF'
-#
-CREATE TEMPORARY TABLE head AS SELECT concat(b1.b, b2.b) AS head FROM t1 b1, t1 b2;
-CREATE TEMPORARY TABLE tail AS SELECT concat(b1.b, b2.b) AS tail FROM t1 b1, t1 b2;
-DROP TABLE t1;
-#
-# Populate table t1 with all eucjpms codes.
-#
-CREATE TABLE t1 AS SELECT 'XXXXXX' AS code, ' ' AS a LIMIT 0;
-#
-# Pupulate JIS-X-0201 range (Half Width Kana)
-# Expected valid code range: [8E][A1..DF] (1x63 characters)
-#
-INSERT IGNORE INTO t1 (code) SELECT concat('8E', head) FROM head
-WHERE (head BETWEEN 'A1' AND 'DF') ORDER BY head;
-#
-# Populate JIS-X-0208 range
-# Expected valid codes: [A1..FE][A1..FE] (94x94=8836 characters)
-#
-INSERT IGNORE INTO t1 (code) SELECT concat(head, tail)
-FROM head, tail
-WHERE (head BETWEEN '80' AND 'FF') AND (head NOT BETWEEN '8E' AND '8F')
-AND (tail BETWEEN '20' AND 'FF')
-ORDER BY head, tail;
-#
-# Populate JIS-X-0212 range
-# Expected valid codes [8F][A1..FE][A1..FE] (1x94x94=8836 characters)
-#
-INSERT IGNORE INTO t1 (code) SELECT concat('8F', head, tail)
-FROM head, tail
-WHERE (head BETWEEN '80' AND 'FF') AND (tail BETWEEN '20' AND 'FF')
-ORDER BY head, tail;
-DROP TEMPORARY TABLE head, tail;
-SHOW CREATE TABLE t1;
-
-UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code;
-SELECT COUNT(*) FROM t1;
-SELECT COUNT(*) FROM t1 WHERE a<>'';
-SELECT COUNT(*) FROM t1 WHERE a<>'' AND a<>'?';
-SELECT COUNT(*) FROM t1 WHERE a<>'' AND OCTET_LENGTH(a)=2;
-SELECT * FROM t1 WHERE CHAR_LENGTH(a)=2;
-SELECT COUNT(*) FROM t1 WHERE a<>'' AND OCTET_LENGTH(a)=3;
-
-
-#
-# Display all characters that have upper or lower case mapping.
-#
-SELECT code, hex(upper(a)), hex(lower(a)),a, upper(a), lower(a) FROM t1 WHERE hex(a)<>hex(upper(a)) OR hex(a)<>hex(lower(a)) ORDER BY code;
-#
-# Make sure all possible conversion happened
-#
-# Expect U+0122 LATIN CAPITAL LETTER G WITH CEDILLA
-#
-SELECT * FROM t1
-WHERE HEX(CAST(LOWER(a) AS CHAR CHARACTER SET utf8)) <>
- HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
-#
-# Expect U+00F0 LATIN SMALL LETTER ETH
-# Expect U+01F5 LATIN SMALL LETTER G WITH ACUTE
-#
-SELECT * FROM t1
-WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <>
- HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
-
---echo #
---echo # WL#3090 Japanese Character Set adjustments
---echo # Test sjis->Unicode conversion
---echo #
-SELECT HEX(a), HEX(CONVERT(a USING utf8)) as b FROM t1
-WHERE a<>'' HAVING b<>'3F' ORDER BY code;
-
-DROP TABLE t1;
-
-
---echo #
---echo # WL#3090 Japanese Character Set adjustments
---echo # Test Unicode->sjis conversion
---echo #
---source include/ctype_utf8_table.inc
-SELECT HEX(a), HEX(CONVERT(a using sjis)) as b FROM t1 HAVING b<>'3F' ORDER BY BINARY a;
-DROP TABLE t1;
-
-
-
---echo #
---echo # End of 5.5 tests
---echo #
-
---echo #
---echo # Start of 5.6 tests
---echo #
-
---echo #
---echo # WL#3664 WEIGHT_STRING
---echo #
-
-set names eucjpms;
---source include/weight_string.inc
---source include/weight_string_l1.inc
---source include/weight_string_A1A1.inc
---source include/weight_string_8EA1.inc
---source include/weight_string_8FA2C3.inc
-
-set collation_connection=eucjpms_bin;
---source include/weight_string.inc
---source include/weight_string_l1.inc
---source include/weight_string_A1A1.inc
---source include/weight_string_8EA1.inc
---source include/weight_string_8FA2C3.inc
-
---echo #
---echo # End of 5.6 tests
---echo #
-
-
---echo #
---echo # Start of 10.0 tests
---echo #
-
---echo #
---echo # MDEV-6776 ujis and eucjmps erroneously accept 0x8EA0 as a valid byte sequence
---echo #
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET eucjpms);
-INSERT IGNORE INTO t1 VALUES (0x8EA0);
-SELECT HEX(a), CHAR_LENGTH(a) FROM t1;
-DROP TABLE t1;
---error ER_INVALID_CHARACTER_STRING
-SELECT _eucjpms 0x8EA0;
-
-
---echo #
---echo # End of 10.0 tests
---echo #
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-8215 Asian MB3 charsets: compare broken bytes as "greater than any non-broken character"
---echo #
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET eucjpms, KEY(a));
-# [x00-x7F] # ASCII/JIS-Roman
-# [x8E][xA1-xDF] # half-width katakana
-# [x8F][xA1-xFE][xA1-xFE] # JIS X 0212-1990
-# [xA1-xFE][xA1-xFE] # JIS X 0208:1997
-INSERT INTO t1 VALUES ('a'),(0x7F);
-INSERT INTO t1 VALUES (0x8EA1),(0x8EDF);
-INSERT INTO t1 VALUES (0x8FA1A1),(0x8FFEFE);
-INSERT INTO t1 VALUES (0xA1A1),(0xDEDE),(0xDFDF),(0xE0E0),(0xFEFE);
-SELECT HEX(a) FROM t1 ORDER BY a;
-ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET eucjpms COLLATE eucjpms_bin;
-SELECT HEX(a) FROM t1 ORDER BY a;
-DROP TABLE t1;
-
---echo #
---echo # End of 10.1 tests
---echo #
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-9842 LOAD DATA INFILE does not work well with a TEXT column when using sjis
---echo #
-CREATE TABLE t1 (a TEXT CHARACTER SET eucjpms);
-LOAD DATA INFILE '../../std_data/loaddata/mdev9823.ujis.txt' IGNORE INTO TABLE t1 CHARACTER SET eucjpms IGNORE 4 LINES;
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-9711 NO PAD Collatons
---echo #
-SET character_set_connection=eucjpms;
-let $coll='eucjpms_japanese_nopad_ci';
-let $coll_pad='eucjpms_japanese_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='eucjpms_nopad_bin';
-let $coll_pad='eucjpms_bin';
---source include/ctype_pad_all_engines.inc
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/ctype_euckr.test b/mysql-test/t/ctype_euckr.test
deleted file mode 100644
index 950c60c47e5..00000000000
--- a/mysql-test/t/ctype_euckr.test
+++ /dev/null
@@ -1,219 +0,0 @@
--- source include/have_euckr.inc
-
-#
-# Tests with the euckr character set
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-SET @test_character_set= 'euckr';
-SET @test_collation= 'euckr_korean_ci';
--- source include/ctype_common.inc
-
-SET NAMES euckr;
-SET collation_connection='euckr_korean_ci';
--- source include/ctype_filesort.inc
--- source include/ctype_innodb_like.inc
--- source include/ctype_like_escape.inc
--- source include/ctype_like_range_f1f2.inc
-SET collation_connection='euckr_bin';
--- source include/ctype_filesort.inc
--- source include/ctype_innodb_like.inc
--- source include/ctype_like_escape.inc
--- source include/ctype_like_range_f1f2.inc
-
-#
-# Bug#15377 Valid multibyte sequences are truncated on INSERT
-#
-SET NAMES euckr;
-CREATE TABLE t1 (a text) character set euckr;
-INSERT INTO t1 VALUES (0xA2E6),(0xFEF7);
-SELECT hex(a) FROM t1 ORDER BY a;
-DROP TABLE t1;
-
-# End of 4.1 tests
-
-#
-#Bug #30315 Character sets: insertion of euckr code value 0xa141 fails
-#
-create table t1 (s1 varchar(5) character set euckr);
-# Insert some valid characters
-insert into t1 values (0xA141);
-insert into t1 values (0xA15A);
-insert into t1 values (0xA161);
-insert into t1 values (0xA17A);
-insert into t1 values (0xA181);
-insert into t1 values (0xA1FE);
-# Insert some invalid characters
-insert ignore into t1 values (0xA140);
-insert ignore into t1 values (0xA15B);
-insert ignore into t1 values (0xA160);
-insert ignore into t1 values (0xA17B);
-insert ignore into t1 values (0xA180);
-insert ignore into t1 values (0xA1FF);
-select hex(s1), hex(convert(s1 using utf8)) from t1 order by binary s1;
-drop table t1;
-
---echo End of 5.0 tests
-
-
---echo Start of 5.4 tests
-
---echo #
---echo # WL#3997 New euckr characters
---echo #
-SET NAMES utf8;
-CREATE TABLE t1 (a varchar(10) character set euckr);
-INSERT INTO t1 VALUES (0xA2E6), (0xA2E7);
-SELECT hex(a), hex(@utf8:=convert(a using utf8)), hex(convert(@utf8 using euckr)) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # WL#3332 Korean Enhancements
---echo # euckr valid codes are now [81..FE][41..5A,61..7A,81..FE]
---echo #
-
-CREATE TABLE t1 (a binary(1), key(a));
---disable_query_log
-let $1=255;
-begin;
-while($1)
-{
- eval INSERT INTO t1 VALUES (unhex(hex($1)));
- dec $1;
-}
-commit;
---enable_query_log
-
-CREATE TABLE t2 (s VARCHAR(4), a VARCHAR(1) CHARACTER SET euckr);
---disable_warnings
-INSERT INTO t2
-SELECT hex(concat(t11.a, t12.a)), concat(t11.a, t12.a)
-FROM t1 t11, t1 t12
-WHERE t11.a >= 0x81 AND t11.a <= 0xFE
-AND t12.a >= 0x41 AND t12.a <= 0xFE
-ORDER BY t11.a, t12.a;
---enable_warnings
-SELECT s as bad_code FROM t2 WHERE a='?' ORDER BY s;
-DELETE FROM t2 WHERE a='?';
-ALTER TABLE t2 ADD u VARCHAR(1) CHARACTER SET utf8, ADD a2 VARCHAR(1) CHARACTER SET euckr;
---disable_warnings
-UPDATE IGNORE t2 SET u=a, a2=u;
---enable_warnings
-SELECT s as unassigned_code FROM t2 WHERE u='?';
-DELETE FROM t2 WHERE u='?';
-# Make sure there are no euckr->utf8->euckr roundtrip problems
-SELECT count(*) as roundtrip_problem_chars FROM t2 WHERE hex(a) <> hex(a2);
-SELECT s, hex(a), hex(u), hex(a2) FROM t2 ORDER BY s;
-DROP TABLE t1, t2;
-
---echo End of 5.4 tests
-
-
-
---echo #
---echo # Start of 5.5 tests
---echo #
-
---echo #
---echo # Testing WL#4583 Case conversion in Asian character sets
---echo #
-#
-# Populate t1 with all hex digits
-#
-SET NAMES utf8;
-SET collation_connection=euckr_korean_ci;
-CREATE TABLE t1 (b VARCHAR(2));
-INSERT INTO t1 VALUES ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7');
-INSERT INTO t1 VALUES ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F');
-#
-# Populate tables head and tail with values '00'-'FF'
-#
-CREATE TEMPORARY TABLE head AS SELECT concat(b1.b, b2.b) AS head FROM t1 b1, t1 b2;
-CREATE TEMPORARY TABLE tail AS SELECT concat(b1.b, b2.b) AS tail FROM t1 b1, t1 b2;
-DROP TABLE t1;
-#
-# Populate table t1 with all codes [80..FF][20..FF]
-# Expected valid euckr codes: [81..FE][41..5A,61..7A,81..FE]
-#
-CREATE TABLE t1 AS
-SELECT concat(head, tail) AS code, ' ' AS a
-FROM head, tail
-WHERE (head BETWEEN '80' AND 'FF') AND (tail BETWEEN '20' AND 'FF')
-ORDER BY head, tail;
-DROP TEMPORARY TABLE head, tail;
-SHOW CREATE TABLE t1;
-UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code;
-SELECT COUNT(*) FROM t1 WHERE a<>'?';
-#
-# Display all characters that have upper or lower case mapping.
-#
-SELECT code, hex(upper(a)), hex(lower(a)),a, upper(a), lower(a) FROM t1 WHERE hex(a)<>hex(upper(a)) OR hex(a)<>hex(lower(a));
-#
-# Make sure all possible conversion happened
-#
-# Expect U+212B ANGSTROM SIGN
-#
-SELECT * FROM t1
-WHERE HEX(CAST(LOWER(a) AS CHAR CHARACTER SET utf8)) <>
- HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
-#
-# Expect U+0111 LATIN SMALL LETTER D WITH STROKE
-# Expect U+24D0 to U+24E9 CIRCLED LATIN SMALL LETTER A to Z
-#
-SELECT * FROM t1
-WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <>
- HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
-
-DROP TABLE t1;
-
-
-
-
---echo #
---echo # End of 5.5 tests
---echo #
-
-
---echo #
---echo # Start of 5.6 tests
---echo #
-
---echo #
---echo # WL#3664 WEIGHT_STRING
---echo #
-set names euckr;
---source include/weight_string.inc
---source include/weight_string_l1.inc
---source include/weight_string_A1A1.inc
-
-set collation_connection=euckr_bin;
---source include/weight_string.inc
---source include/weight_string_l1.inc
---source include/weight_string_A1A1.inc
-
---echo #
---echo # End of 5.6 tests
---echo #
-
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-9711 NO PAD Collatons
---echo #
-SET character_set_connection=euckr;
-let $coll='euckr_korean_nopad_ci';
-let $coll_pad='euckr_korean_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='euckr_nopad_bin';
-let $coll_pad='euckr_bin';
---source include/ctype_pad_all_engines.inc
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/ctype_filename.test b/mysql-test/t/ctype_filename.test
deleted file mode 100644
index 7ec07293a2b..00000000000
--- a/mysql-test/t/ctype_filename.test
+++ /dev/null
@@ -1,29 +0,0 @@
---disable_warnings
-drop table if exists con, aux, nul, lpt1, com1, `clock$`;
---enable_warnings
-
-create table con (a int);
-drop table con;
-
-create table aux (a int);
-drop table aux;
-
-create table nul (a int);
-drop table nul;
-
-create table lpt1 (a int);
-drop table lpt1;
-
-create table com1 (a int);
-drop table com1;
-
-create table `clock$` (a int);
-drop table `clock$`;
-
-select convert(convert(',' using filename) using binary);
-
---echo #
---echo # MDEV-7677 my_charset_handler_filename has a wrong "ismbchar" member
---echo #
-SET NAMES utf8;
-SELECT @a:=CONVERT('aя' USING filename) AS `@a`, BINARY @a, REVERSE(@a), HEX(@a), HEX(REVERSE(@a));
diff --git a/mysql-test/t/ctype_filesystem-master.opt b/mysql-test/t/ctype_filesystem-master.opt
deleted file mode 100644
index 44127f68664..00000000000
--- a/mysql-test/t/ctype_filesystem-master.opt
+++ /dev/null
@@ -1,2 +0,0 @@
---character-sets-dir=$MYSQL_TEST_DIR/
---character-set-filesystem=latin1
diff --git a/mysql-test/t/ctype_filesystem.test b/mysql-test/t/ctype_filesystem.test
deleted file mode 100644
index 42f1ef06478..00000000000
--- a/mysql-test/t/ctype_filesystem.test
+++ /dev/null
@@ -1,8 +0,0 @@
---source include/not_windows.inc
-
-SET CHARACTER SET utf8;
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
-SHOW VARIABLES like 'character_sets_dir';
-SHOW VARIABLES like 'character_set_filesystem';
-SHOW VARIABLES like 'character_set_client';
-SET CHARACTER SET default;
diff --git a/mysql-test/t/ctype_gb2312.test b/mysql-test/t/ctype_gb2312.test
deleted file mode 100644
index 4489168a163..00000000000
--- a/mysql-test/t/ctype_gb2312.test
+++ /dev/null
@@ -1,182 +0,0 @@
--- source include/have_gb2312.inc
-
-#
-# Tests with the gb2312 character set
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-SET @test_character_set= 'gb2312';
-SET @test_collation= 'gb2312_chinese_ci';
--- source include/ctype_common.inc
-
-SET NAMES gb2312;
-SET collation_connection='gb2312_chinese_ci';
--- source include/ctype_filesort.inc
--- source include/ctype_innodb_like.inc
--- source include/ctype_like_escape.inc
--- source include/ctype_like_range_f1f2.inc
--- source include/ctype_ascii_order.inc
-SET collation_connection='gb2312_bin';
--- source include/ctype_filesort.inc
--- source include/ctype_innodb_like.inc
--- source include/ctype_like_escape.inc
--- source include/ctype_like_range_f1f2.inc
-
-#
-# Bug#15377 Valid multibyte sequences are truncated on INSERT
-#
-SET NAMES gb2312;
-CREATE TABLE t1 (a text) character set gb2312;
-INSERT INTO t1 VALUES (0xA2A1),(0xD7FE);
-SELECT hex(a) FROM t1 ORDER BY a;
-DROP TABLE t1;
-
-# End of 4.1 tests
-
-
---echo #
---echo # Start of 5.5 tests
---echo #
-
---echo #
---echo # Testing WL#4583 Case conversion in Asian character sets
---echo #
-#
-# Populate t1 with all hex digits
-#
-SET NAMES utf8;
-SET collation_connection=gb2312_chinese_ci;
-CREATE TABLE t1 (b VARCHAR(2));
-INSERT INTO t1 VALUES ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7');
-INSERT INTO t1 VALUES ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F');
-#
-# Populate tables head and tail with values '00'-'FF'
-#
-CREATE TEMPORARY TABLE head AS SELECT concat(b1.b, b2.b) AS head FROM t1 b1, t1 b2;
-CREATE TEMPORARY TABLE tail AS SELECT concat(b1.b, b2.b) AS tail FROM t1 b1, t1 b2;
-DROP TABLE t1;
-#
-# Populate table t1 with all codes [80..FF][20..FF]
-# Expected valid gb2312 codes [A1..F7][A1..FE]
-#
-CREATE TABLE t1 AS
-SELECT concat(head, tail) AS code, ' ' AS a
-FROM head, tail
-WHERE (head BETWEEN '80' AND 'FF') AND (tail BETWEEN '20' AND 'FF')
-ORDER BY head, tail;
-DROP TEMPORARY TABLE head, tail;
-SHOW CREATE TABLE t1;
-UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code;
-SELECT COUNT(*) FROM t1 WHERE a<>'?';
-#
-# Display all characters that have upper or lower case mapping.
-#
-SELECT code, hex(upper(a)), hex(lower(a)),a, upper(a), lower(a) FROM t1 WHERE hex(a)<>hex(upper(a)) OR hex(a)<>hex(lower(a));
-#
-# Make sure all possible conversion happened
-#
-# Expect U+2160 to U+216B ROMAN NUMERAL ONE to ROMAN NUMERAL TWELVE
-#
-SELECT * FROM t1
-WHERE HEX(CAST(LOWER(a) AS CHAR CHARACTER SET utf8)) <>
- HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
-#
-# Expect
-# U+00E0 LATIN SMALL LETTER A WITH GRAVE
-# U+00E1 LATIN SMALL LETTER A WITH ACUTE
-# U+00E8 LATIN SMALL LETTER E WITH GRAVE
-# U+00E9 LATIN SMALL LETTER E WITH ACUTE
-# U+00EA LATIN SMALL LETTER E WITH CIRCUMFLEX
-# U+00EC LATIN SMALL LETTER I WITH GRAVE
-# U+00ED LATIN SMALL LETTER I WITH ACUTE
-# U+00F2 LATIN SMALL LETTER O WITH GRAVE
-# U+00F3 LATIN SMALL LETTER O WITH ACUTE
-# U+00F9 LATIN SMALL LETTER U WITH GRAVE
-# U+00FA LATIN SMALL LETTER U WITH ACUTE
-# U+00FC LATIN SMALL LETTER U WITH DIAERESIS
-# U+0101 LATIN SMALL LETTER A WITH MACRON
-# U+0113 LATIN SMALL LETTER E WITH MACRON
-# U+011B LATIN SMALL LETTER E WITH CARON
-# U+012B LATIN SMALL LETTER I WITH MACRON
-# U+0144 LATIN SMALL LETTER N WITH ACUTE
-# U+0148 LATIN SMALL LETTER N WITH CARON
-# U+014D LATIN SMALL LETTER O WITH MACRON
-# U+016B LATIN SMALL LETTER U WITH MACRON
-# U+01CE LATIN SMALL LETTER A WITH CARON
-# U+01D0 LATIN SMALL LETTER I WITH CARON
-# U+01D2 LATIN SMALL LETTER O WITH CARON
-# U+01D4 LATIN SMALL LETTER U WITH CARON
-# U+01D6 LATIN SMALL LETTER U WITH DIAERESIS AND MACRON
-# U+01D8 LATIN SMALL LETTER U WITH DIAERESIS AND ACUTE
-# U+01DA LATIN SMALL LETTER U WITH DIAERESIS AND CARON
-# U+01DC LATIN SMALL LETTER U WITH DIAERESIS AND GRAVE
-#
-SELECT * FROM t1
-WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <>
- HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
-
-DROP TABLE t1;
-
-
-
-
---echo #
---echo # End of 5.5 tests
---echo #
-
-
-
---echo #
---echo # Start of 5.6 tests
---echo #
-
---echo #
---echo # WL#3664 WEIGHT_STRING
---echo #
-
-set names gb2312;
---source include/weight_string.inc
---source include/weight_string_l1.inc
---source include/weight_string_A1A1.inc
-
-set collation_connection=gb2312_bin;
---source include/weight_string.inc
---source include/weight_string_l1.inc
---source include/weight_string_A1A1.inc
-
---echo #
---echo # End of 5.6 tests
---echo #
-
---echo #
---echo # Start of 10.0 tests
---echo #
-
-let $ctype_unescape_combinations=selected;
---source include/ctype_unescape.inc
-
---echo #
---echo # End of 10.0 tests
---echo #
-
-
---echo #
---echo # Start of 10.2 tests
---echo #
---echo #
---echo # MDEV-9711 NO PAD Collatons
---echo #
-SET character_set_connection=gb2312;
-let $coll='gb2312_chinese_nopad_ci';
-let $coll_pad='gb2312_chinese_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='gb2312_nopad_bin';
-let $coll_pad='gb2312_bin';
---source include/ctype_pad_all_engines.inc
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/ctype_gbk.test b/mysql-test/t/ctype_gbk.test
deleted file mode 100644
index a3dc7f4af44..00000000000
--- a/mysql-test/t/ctype_gbk.test
+++ /dev/null
@@ -1,483 +0,0 @@
--- source include/have_gbk.inc
-
-#
-# Tests with the gbk character set
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-SET @test_character_set= 'gbk';
-SET @test_collation= 'gbk_chinese_ci';
--- source include/ctype_common.inc
-
-SET NAMES gbk;
-SET collation_connection='gbk_chinese_ci';
--- source include/ctype_filesort.inc
--- source include/ctype_innodb_like.inc
--- source include/ctype_like_escape.inc
--- source include/ctype_like_range_f1f2.inc
--- source include/ctype_ascii_order.inc
-SET collation_connection='gbk_bin';
--- source include/ctype_filesort.inc
--- source include/ctype_innodb_like.inc
--- source include/ctype_like_escape.inc
--- source include/ctype_like_range_f1f2.inc
-
-#
-# Bug#11987 mysql will truncate the text when
-# the text contain GBK char:"0xA3A0" and "0xA1"
-#
-SET NAMES gbk;
-CREATE TABLE t1 (a text) character set gbk;
-INSERT INTO t1 VALUES (0xA3A0),(0xA1A1);
-SELECT hex(a) FROM t1 ORDER BY a;
-DROP TABLE t1;
-
-#
-# Bugs#15375: Unassigned multibyte codes are broken
-# into parts when converting to Unicode.
-# This query should return 0x003F0041. I.e. it should
-# scan unassigned double-byte character 0xA140, convert
-# it as QUESTION MARK 0x003F and then scan the next
-# character, which is a single byte character 0x41.
-#
-select hex(convert(_gbk 0xA14041 using ucs2));
-
-# End of 4.1 tests
-
-#
-# Bug#21620 ALTER TABLE affects other columns
-#
-create table t1 (c1 text not null, c2 text not null) character set gbk;
-alter table t1 change c1 c1 mediumtext character set gbk not null;
-show create table t1;
-drop table t1;
-
-#
-# Bug#35993: severe memory corruption and crash with multibyte conversion
-#
-
-CREATE TABLE t1(a MEDIUMTEXT CHARACTER SET gbk,
- b MEDIUMTEXT CHARACTER SET big5);
-INSERT INTO t1 VALUES
- (REPEAT(0x1125,200000), REPEAT(0x1125,200000)), ('', ''), ('', '');
-
-SELECT a FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll;
-SELECT b FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll;
-
-DROP TABLES t1;
-
---echo End of 5.0 tests
-
-
---echo #
---echo # Start of 5.5 tests
---echo #
-
---echo #
---echo # Testing WL#4583 Case conversion in Asian character sets
---echo #
-#
-# Populate t1 with all hex digits
-#
-SET NAMES utf8;
-SET collation_connection=gbk_chinese_ci;
-CREATE TABLE t1 (b VARCHAR(2));
-INSERT INTO t1 VALUES ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7');
-INSERT INTO t1 VALUES ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F');
-#
-# Populate tables head and tail with values '00'-'FF'
-#
-CREATE TEMPORARY TABLE head AS SELECT concat(b1.b, b2.b) AS head FROM t1 b1, t1 b2;
-CREATE TEMPORARY TABLE tail AS SELECT concat(b1.b, b2.b) AS tail FROM t1 b1, t1 b2;
-DROP TABLE t1;
-#
-# Populate table t1 with all codes [80..FF][20..FF]
-# Expected valid gbk codes [81..FE][40..7E,80..FE]
-#
-CREATE TABLE t1 AS
-SELECT concat(head, tail) AS code, ' ' AS a
-FROM head, tail
-WHERE (head BETWEEN '80' AND 'FF') AND (tail BETWEEN '20' AND 'FF')
-ORDER BY head, tail;
-DROP TEMPORARY TABLE head, tail;
-SHOW CREATE TABLE t1;
-UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code;
-SELECT COUNT(*) FROM t1 WHERE a<>'?';
-#
-# Display all characters that have upper or lower case mapping.
-#
-SELECT code, hex(upper(a)), hex(lower(a)),a, upper(a), lower(a) FROM t1 WHERE hex(a)<>hex(upper(a)) OR hex(a)<>hex(lower(a));
-#
-# Make sure all possible conversion happened
-#
-# Expect U+216A to U+216B ROMAN NUMERAL ELEVEN to ROMAN TWELVE
-#
-SELECT * FROM t1
-WHERE HEX(CAST(LOWER(a) AS CHAR CHARACTER SET utf8)) <>
- HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
-#
-# Expect
-# U+00E0 LATIN SMALL LETTER A WITH GRAVE
-# U+00E1 LATIN SMALL LETTER A WITH ACUTE
-# U+00E8 LATIN SMALL LETTER E WITH GRAVE
-# U+00E9 LATIN SMALL LETTER E WITH ACUTE
-# U+00EA LATIN SMALL LETTER E WITH CIRCUMFLEX
-# U+00EC LATIN SMALL LETTER I WITH GRAVE
-# U+00ED LATIN SMALL LETTER I WITH ACUTE
-# U+00F2 LATIN SMALL LETTER O WITH GRAVE
-# U+00F3 LATIN SMALL LETTER O WITH ACUTE
-# U+00F9 LATIN SMALL LETTER U WITH GRAVE
-# U+00FA LATIN SMALL LETTER U WITH ACUTE
-# U+00FC LATIN SMALL LETTER U WITH DIAERESIS
-# U+0101 LATIN SMALL LETTER A WITH MACRON
-# U+0113 LATIN SMALL LETTER E WITH MACRON
-# U+011B LATIN SMALL LETTER E WITH CARON
-# U+012B LATIN SMALL LETTER I WITH MACRON
-# U+0144 LATIN SMALL LETTER N WITH ACUTE
-# U+0148 LATIN SMALL LETTER N WITH CARON
-# U+014D LATIN SMALL LETTER O WITH MACRON
-# U+016B LATIN SMALL LETTER U WITH MACRON
-# U+01CE LATIN SMALL LETTER A WITH CARON
-# U+01D0 LATIN SMALL LETTER I WITH CARON
-# U+01D2 LATIN SMALL LETTER O WITH CARON
-# U+01D4 LATIN SMALL LETTER U WITH CARON
-# U+01D6 LATIN SMALL LETTER U WITH DIAERESIS AND MACRON
-# U+01D8 LATIN SMALL LETTER U WITH DIAERESIS AND ACUTE
-# U+01DA LATIN SMALL LETTER U WITH DIAERESIS AND CARON
-# U+01DC LATIN SMALL LETTER U WITH DIAERESIS AND GRAVE
-#
-SELECT * FROM t1
-WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <>
- HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
-
-DROP TABLE t1;
-
-
-
-
---echo #
---echo # End of 5.5 tests
---echo #
-
-
---echo #
---echo # Start of 5.6 tests
---echo #
-
---echo #
---echo # WL#3664 WEIGHT_STRING
---echo #
-
-set names gbk;
---source include/weight_string.inc
---source include/weight_string_l1.inc
---source include/weight_string_A1A1.inc
---source include/weight_string_8140.inc
---source include/weight_string_8EA1.inc
-
-set collation_connection=gbk_bin;
---source include/weight_string.inc
---source include/weight_string_l1.inc
---source include/weight_string_A1A1.inc
---source include/weight_string_8140.inc
---source include/weight_string_8EA1.inc
-
---echo #
---echo # End of 5.6 tests
---echo #
-
---echo #
---echo # Start of 10.0 tests
---echo #
-
-let $ctype_unescape_combinations=selected;
---source include/ctype_unescape.inc
-
---character_set gbk
-SET NAMES gbk;
---source include/ctype_E05C.inc
-
---echo #
---echo # MDEV-9886 Illegal mix of collations with a view comparing a field to a binary constant
---echo #
-
-SET NAMES latin1;
-CREATE TABLE t1 (a TEXT CHARACTER SET gbk);
-INSERT INTO t1 VALUES (0xEE5D);
-SELECT a<>0xEE5D AS a FROM t1;
-CREATE VIEW v1 AS SELECT a<>0xEE5D AS a FROM t1;
-SHOW CREATE VIEW v1;
-SELECT * FROM v1;
-DROP VIEW v1;
-DROP TABLE t1;
-
-
---echo #
---echo # End of 10.0 tests
---echo #
-
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-6566 Different INSERT behaviour on bad bytes with and without character set conversion
---echo #
-
-CREATE TABLE t1 (
- id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
- b VARBINARY(16),
- type SET('ascii','bad','head','tail','mb2','unassigned')
-);
-INSERT INTO t1 (b, type) VALUES (0x40, 'ascii,tail');
-INSERT INTO t1 (b, type) VALUES (0x80, 'tail');
-INSERT INTO t1 (b, type) VALUES (0x81, 'head,tail');
-INSERT INTO t1 (b, type) VALUES (0xFF, 'bad');
-INSERT INTO t1 (b, type) VALUES (0xA140, 'mb2,unassigned');
-INSERT INTO t1 (b, type) VALUES (0xA1A3, 'mb2');
-INSERT INTO t1 (b, type) VALUES (0xFE40, 'mb2');
-CREATE TABLE t2 AS SELECT
- CONCAT(t1.b,t2.b) AS b,
- t1.type AS type1,
- t2.type AS type2,
- CONCAT('[',t1.type,'][',t2.type,']') AS comment
-FROM t1, t1 t2;
-
-CREATE TABLE t3
-(
- b VARBINARY(16),
- c VARCHAR(16) CHARACTER SET gbk,
- comment VARCHAR(128)
-);
---echo #
---echo # A combination of two valid characters, should give no warnings
---echo #
-INSERT INTO t3 (b,c,comment) SELECT b,b,comment FROM t2
-WHERE
- (FIND_IN_SET('ascii',type1) OR FIND_IN_SET('mb2',type1)) AND
- (FIND_IN_SET('ascii',type2) OR FIND_IN_SET('mb2',type2))
-ORDER BY b;
-SELECT COUNT(*) FROM t3;
-SELECT HEX(c),comment FROM t3 WHERE b=c ORDER BY b;
-SELECT HEX(c),HEX(b),comment FROM t3 WHERE b<>c ORDER BY b;
-DELETE FROM t2 WHERE b IN (SELECT b FROM t3);
-DELETE FROM t3;
-
---echo #
---echo # Sequences that start with a tail or a bad byte,
---echo # or end with a bad byte, all should be fixed.
---echo #
-INSERT IGNORE INTO t3 (b,c,comment) SELECT b,b,comment FROM t2
-WHERE type1='tail' OR type1='bad' OR type2='bad'
-ORDER BY b;
-SELECT COUNT(*) FROM t3;
-SELECT HEX(c),comment FROM t3 WHERE b=c ORDER BY b;
-SELECT HEX(c),HEX(b),comment FROM t3 WHERE b<>c ORDER BY b;
-DELETE FROM t2 WHERE b IN (SELECT b FROM t3);
-DELETE FROM t3;
-
---echo #
---echo # Sequences that start with an ASCII or an MB2 character,
---echo # followed by a non-ASCII tail, all should be fixed.
---echo #
-INSERT IGNORE INTO t3 (b,c,comment) SELECT b,b,comment FROM t2
-WHERE (FIND_IN_SET('mb2',type1) OR FIND_IN_SET('ascii',type1))
- AND (FIND_IN_SET('tail',type2) AND NOT FIND_IN_SET('ascii',type2))
-ORDER BY b;
-SELECT COUNT(*) FROM t3;
-SELECT HEX(c),comment FROM t3 WHERE b=c ORDER BY b;
-SELECT HEX(c),HEX(b),comment FROM t3 WHERE b<>c ORDER BY b;
-DELETE FROM t2 WHERE b IN (SELECT b FROM t3);
-DELETE FROM t3;
-
---echo #
---echo # Other sequences
---echo #
-INSERT INTO t3 (b,c,comment) SELECT b,b,comment FROM t2 ORDER BY b;
-SELECT COUNT(*) FROM t3;
-SELECT HEX(c),comment FROM t3 WHERE b=c ORDER BY b;
-SELECT HEX(c),HEX(b),comment FROM t3 WHERE b<>c ORDER BY b;
-DELETE FROM t3;
-DROP TABLE t3;
-DROP TABLE t2;
-
-CREATE TABLE t2 AS SELECT
- CONCAT(t1.b,t2.b,t3.b) AS b,
- t1.type AS type1,
- t2.type AS type2,
- t3.type AS type3,
- CONCAT('[',t1.type,'][',t2.type,'][',t3.type,']') AS comment
-FROM t1, t1 t2,t1 t3;
-SELECT COUNT(*) FROM t2;
-
-CREATE TABLE t3
-(
- b VARBINARY(16),
- c VARCHAR(16) CHARACTER SET gbk,
- comment VARCHAR(128)
-);
-
---echo #
---echo # A combination of three valid characters, should give no warnings
---echo #
-INSERT INTO t3 (b,c,comment) SELECT b,b,comment FROM t2
-WHERE
- (FIND_IN_SET('ascii',type1) OR FIND_IN_SET('mb2',type1)) AND
- (FIND_IN_SET('ascii',type2) OR FIND_IN_SET('mb2',type2)) AND
- (FIND_IN_SET('ascii',type3) OR FIND_IN_SET('mb2',type3))
-ORDER BY b;
-SELECT COUNT(*) FROM t3;
-SELECT HEX(c),comment FROM t3 WHERE b=c ORDER BY b;
-SELECT HEX(c),HEX(b),comment FROM t3 WHERE b<>c ORDER BY b;
-DELETE FROM t2 WHERE b IN (SELECT b FROM t3);
-DELETE FROM t3;
-
---echo #
---echo # Sequences that start with a tail or a bad byte,
---echo # or have a bad byte, all should be fixed.
---echo #
-INSERT IGNORE INTO t3 (b,c,comment) SELECT b,b,comment FROM t2
-WHERE type1='tail' OR type1='bad' OR type2='bad' OR type3='bad'
-ORDER BY b;
-SELECT COUNT(*) FROM t3;
-SELECT HEX(c),comment FROM t3 WHERE b=c ORDER BY b;
-SELECT HEX(c),HEX(b),comment FROM t3 WHERE b<>c ORDER BY b;
-DELETE FROM t2 WHERE b IN (SELECT b FROM t3);
-DELETE FROM t3;
-
---echo #
---echo # Sequences that start with an ASCII or an MB2 character,
---echo # followed by a pure non-ASCII tail, all should be fixed.
---echo #
-INSERT IGNORE INTO t3 (b,c,comment) SELECT b,b,comment FROM t2
-WHERE (FIND_IN_SET('mb2',type1) OR FIND_IN_SET('ascii',type1))
- AND type2='tail'
-ORDER BY b;
-SELECT COUNT(*) FROM t3;
-SELECT HEX(c),comment FROM t3 WHERE b=c ORDER BY b;
-SELECT HEX(c),HEX(b),comment FROM t3 WHERE b<>c ORDER BY b;
-DELETE FROM t2 WHERE b IN (SELECT b FROM t3);
-DELETE FROM t3;
-
---echo #
---echo # Sequences that consist of two ASCII or MB2 characters,
---echo # followed by a pure non-ASCII tail, all should be fixed.
---echo #
-INSERT IGNORE INTO t3 (b,c,comment) SELECT b,b,comment FROM t2
-WHERE (FIND_IN_SET('mb2',type1) OR FIND_IN_SET('ascii',type1)) AND
- (FIND_IN_SET('mb2',type2) OR FIND_IN_SET('ascii',type2)) AND
- type3='tail'
-ORDER BY b;
-SELECT COUNT(*) FROM t3;
-SELECT HEX(c),comment FROM t3 WHERE b=c ORDER BY b;
-SELECT HEX(c),HEX(b),comment FROM t3 WHERE b<>c ORDER BY b;
-DELETE FROM t2 WHERE b IN (SELECT b FROM t3);
-DELETE FROM t3;
-
-
---echo #
---echo # Sequences that consist of two MB2 characters,
---echo # followed by a non-ASCII head or tail, all should be fixed.
---echo #
-INSERT IGNORE INTO t3 (b,c,comment) SELECT b,b,comment FROM t2
-WHERE FIND_IN_SET('mb2',type1) AND FIND_IN_SET('mb2',type2)
- AND NOT FIND_IN_SET('ascii',type3)
- AND NOT FIND_IN_SET('mb2',type3)
-ORDER BY b;
-SELECT COUNT(*) FROM t3;
-SELECT HEX(c),comment FROM t3 WHERE b=c ORDER BY b;
-SELECT HEX(c),HEX(b),comment FROM t3 WHERE b<>c ORDER BY b;
-DELETE FROM t2 WHERE b IN (SELECT b FROM t3);
-DELETE FROM t3;
-
-
---echo #
---echo # Sequences that consist of head + tail + MB2 should go without warnings
---echo #
-INSERT INTO t3 (b,c,comment) SELECT b,b,comment FROM t2
-WHERE FIND_IN_SET('head',type1)
- AND FIND_IN_SET('tail',type2)
- AND FIND_IN_SET('mb2',type3)
-ORDER BY b;
-SELECT COUNT(*) FROM t3;
-SELECT HEX(c),comment FROM t3 WHERE b=c ORDER BY b;
-SELECT HEX(c),HEX(b),comment FROM t3 WHERE b<>c ORDER BY b;
-DELETE FROM t2 WHERE b IN (SELECT b FROM t3);
-DELETE FROM t3;
-
---echo #
---echo # Sequences that consist of (ascii or mb2) + head + tail should go without warnings
---echo #
-INSERT INTO t3 (b,c,comment) SELECT b,b,comment FROM t2
-WHERE (FIND_IN_SET('ascii',type1) OR FIND_IN_SET('mb2',type1))
- AND FIND_IN_SET('head',type2)
- AND FIND_IN_SET('tail',type3)
-ORDER BY b;
-SELECT COUNT(*) FROM t3;
-SELECT HEX(c),comment FROM t3 WHERE b=c ORDER BY b;
-SELECT HEX(c),HEX(b),comment FROM t3 WHERE b<>c ORDER BY b;
-DELETE FROM t2 WHERE b IN (SELECT b FROM t3);
-DELETE FROM t3;
-
-
-#--echo #
-#--echo # Other sequences
-#--echo #
-INSERT IGNORE INTO t3 (b,c,comment) SELECT b,b,comment FROM t2 ORDER BY b;
-SELECT COUNT(*) FROM t3;
-SELECT HEX(c),comment FROM t3 WHERE b=c ORDER BY b;
-SELECT HEX(c),HEX(b),comment FROM t3 WHERE b<>c ORDER BY b;
-
-DROP TABLE t3;
-DROP TABLE t2;
-DROP TABLE t1;
-
---echo #
---echo # END OF MDEV-6566 Different INSERT behaviour on bad bytes with and without character set conversion
---echo #
-
---echo #
---echo # MDEV-7661 Unexpected result for: CAST(0xHHHH AS CHAR CHARACTER SET xxx) for incorrect byte sequences
---echo #
-set sql_mode='';
-SELECT HEX(CAST(0xA341 AS CHAR CHARACTER SET gb2312));
-SELECT HEX(CONVERT(CAST(0xA341 AS CHAR CHARACTER SET gb2312) USING utf8));
-set sql_mode=default;
-
-
---echo #
---echo # End of 10.1 tests
---echo #
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-9811 LOAD DATA INFILE does not work well with gbk in some cases
---echo #
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET gbk);
-LOAD DATA INFILE '../../std_data/loaddata/mdev8711.txt' INTO TABLE t1 CHARACTER SET gbk LINES TERMINATED BY '@';
-SELECT HEX(a) FROM t1;
-DELETE FROM t1;
-LOAD DATA INFILE '../../std_data/loaddata/mdev8711.txt' INTO TABLE t1 CHARACTER SET gbk LINES TERMINATED BY '@' IGNORE 1 LINES;
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
---echo #
---echo # MDEV-9711 NO PAD Collatons
---echo #
-SET character_set_connection=gbk;
-let $coll='gbk_chinese_nopad_ci';
-let $coll_pad='gbk_chinese_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='gbk_nopad_bin';
-let $coll_pad='gbk_bin';
---source include/ctype_pad_all_engines.inc
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/ctype_gbk_binlog.test b/mysql-test/t/ctype_gbk_binlog.test
deleted file mode 100644
index e4c1bee19af..00000000000
--- a/mysql-test/t/ctype_gbk_binlog.test
+++ /dev/null
@@ -1,37 +0,0 @@
--- source include/have_binlog_format_mixed_or_statement.inc
--- source include/have_gbk.inc
-
-RESET MASTER;
-SET NAMES gbk;
---character_set gbk
-
-CREATE TABLE t1 (
- f1 BLOB
-) ENGINE=MyISAM DEFAULT CHARSET=gbk;
-
-delimiter |;
-CREATE PROCEDURE p1(IN val BLOB)
-BEGIN
- SET @tval = val;
- SET @sql_cmd = CONCAT_WS(' ', 'insert into t1(f1) values(?)');
- PREPARE stmt FROM @sql_cmd;
- EXECUTE stmt USING @tval;
- DEALLOCATE PREPARE stmt;
-END|
-delimiter ;|
-
-SET @`tcontent`:=_binary 0x50434B000900000000000000E9000000 COLLATE `binary`/*!*/;
-CALL p1(@`tcontent`);
-
-FLUSH LOGS;
-DROP PROCEDURE p1;
-RENAME TABLE t1 to t2;
-
-let $MYSQLD_DATADIR= `select @@datadir`;
---exec $MYSQL_BINLOG --force-if-open --short-form $MYSQLD_DATADIR/master-bin.000001 | $MYSQL
-SELECT hex(f1) FROM t2;
-SELECT hex(f1) FROM t1;
-
-DROP PROCEDURE p1;
-DROP TABLE t1;
-DROP TABLE t2;
diff --git a/mysql-test/t/ctype_gbk_export_import.test b/mysql-test/t/ctype_gbk_export_import.test
deleted file mode 100644
index f0d0b70fce6..00000000000
--- a/mysql-test/t/ctype_gbk_export_import.test
+++ /dev/null
@@ -1,161 +0,0 @@
---source include/not_windows.inc
---source include/have_case_sensitive_file_system.inc
---source include/have_gbk.inc
-
-#
-# Check if we're running on a POSIX-locale machine
-#
-
---disable_query_log
---exec locale -a > $MYSQLTEST_VARDIR/tmp/locale_a_gbk.output 2>/dev/null || true
-SET @file=REPLACE(LOAD_FILE('../../tmp/locale_a_gbk.output'), '-', '');
-# Note, file content must be case sensitive. See mysql_locale_posix.test
---remove_file $MYSQLTEST_VARDIR/tmp/locale_a_gbk.output
-if (`SELECT (IFNULL(@file,'') NOT LIKE '%\nzh_CN.gbk\n%')`)
-{
- Skip Need POSIX locale zh_CN.gbk;
-}
---enable_query_log
-
-
---disable_warnings
-DROP DATABASE IF EXISTS gbk;
---enable_warnings
-
-CREATE DATABASE gbk DEFAULT CHARACTER SET gbk;
-USE gbk;
-
-CREATE TABLE t1 (
- id INT NOT NULL,
- a1 TEXT NOT NULL,
- a2 TEXT CHARACTER SET utf8 NOT NULL,
- b1 BLOB NOT NULL,
- eol TEXT NOT NULL);
-
-DELIMITER |;
-CREATE PROCEDURE populate()
-BEGIN
- TRUNCATE TABLE t1;
- INSERT INTO t1 SET id=1, a1=0xEE5C, a2=_gbk 0xEE5C, b1=0xEE5C, eol='$';
- INSERT INTO t1 SET id=2, a1=0xEE5C5C, a2=_gbk 0xEE5C5C, b1=0xEE5C5C, eol='$';
-END|
-
-CREATE FUNCTION cmt(id INT, field_name TEXT, field_value BLOB)
- RETURNS TEXT CHARACTER SET utf8
-BEGIN
- DECLARE comment TEXT CHARACTER SET utf8;
- DECLARE expected_value_01 BLOB;
- DECLARE expected_value_02 BLOB;
- SET comment= CASE field_name WHEN 'a1' THEN 'TEXT-GBK' WHEN 'a2' THEN 'TEXT-UTF8' WHEN 'b1' THEN 'BLOB' ELSE '' END;
- SET expected_value_01= CASE field_name WHEN 'a1' THEN 0xEE5C WHEN 'a2' THEN 0xE9A0AB WHEN 'b1' THEN 0xEE5C ELSE '' END;
- SET expected_value_02= CASE field_name WHEN 'a1' THEN 0xEE5C5C WHEN 'a2' THEN 0xE9A0AB5C WHEN 'b1' THEN 0xEE5C5C ELSE '' END;
- RETURN IF(CASE id
- WHEN 1 THEN expected_value_01
- WHEN 2 THEN expected_value_02
- ELSE ''
- END <> field_value,
- CONCAT('BAD-', comment), '');
-END|
-
-CREATE FUNCTION display_file(file BLOB) RETURNS TEXT CHARACTER SET utf8
-BEGIN
- SET file=REPLACE(file, 0x09, '----');
- SET file=REPLACE(file, 0x0A, '++++');
- RETURN REPLACE(REPLACE(HEX(file), '2D2D2D2D','-'), '2B2B2B2B','|');
-END|
-
-DELIMITER ;|
-
-CREATE VIEW v1 AS
-SELECT
- id,
- CONCAT(RPAD(HEX(a1),50,' '), cmt(id, 'a1', a1)) AS a1,
- CONCAT(RPAD(HEX(a2),50,' '), cmt(id, 'a2', a2)) AS a2,
- CONCAT(RPAD(HEX(b1),50,' '), cmt(id, 'b1', b1)) AS b1,
- CONCAT(RPAD(HEX(eol),50,' '), IF(eol<>'$','BAD-EOL','')) AS eol,
- '---' AS `---`
-FROM t1;
-SHOW CREATE TABLE t1;
-
---echo #
---echo # Dump using SELECT INTO OUTFILE
---echo #
-
---perl
-my $dir= $ENV{'MYSQL_TMP_DIR'};
-open (my $FILE, '>', "$dir/tmpgbk.inc") or die "open(): $!";
-for $LOCALE ("zh_CN.gbk") {
-for $DUMP_OPTIONS ("--default-character-set=auto", "--default-character-set=gbk","--default-character-set=utf8") {
-for $DUMP_CHARSET_CLAUSE ("", "CHARACTER SET gbk", "CHARACTER SET utf8", "CHARACTER SET binary") {
-for $RESTORE_OPTIONS ("--default-character-set=auto", "--default-character-set=gbk","--default-character-set=utf8") {
-for $RESTORE_CHARSET_CLAUSE ("", "CHARACTER SET gbk", "CHARACTER SET utf8", "CHARACTER SET binary") {
-print $FILE <<END
---echo Start of {$LOCALE}{$DUMP_OPTIONS $DUMP_CHARSET_CLAUSE}{$RESTORE_OPTIONS $RESTORE_CHARSET_CLAUSE}
---echo Locale: $LOCALE
---echo OUTFILE: $DUMP_OPTIONS $DUMP_CHARSET_CLAUSE
---echo INFILE: $RESTORE_OPTIONS $RESTORE_CHARSET_CLAUSE
---disable_query_log
-CALL populate();
---exec LC_ALL=$LOCALE \$MYSQL $DUMP_OPTIONS gbk -e "SELECT * INTO OUTFILE '\$MYSQLTEST_VARDIR/tmp/t1' $DUMP_CHARSET_CLAUSE FROM t1"
---vertical_results
-TRUNCATE TABLE t1;
---eval SELECT display_file(LOAD_FILE('\$MYSQLTEST_VARDIR/tmp/t1')) AS file;
---exec LC_ALL=$LOCALE \$MYSQL $RESTORE_OPTIONS gbk -e "LOAD DATA INFILE '\$MYSQLTEST_VARDIR/tmp/t1' IGNORE INTO TABLE t1 $RESTORE_CHARSET_CLAUSE"
-SELECT * FROM v1;
---echo End of {$LOCALE}{$DUMP_OPTIONS $DUMP_CHARSET_CLAUSE}{$RESTORE_OPTIONS $RESTORE_CHARSET_CLAUSE}
---echo
---echo
---horizontal_results
---enable_query_log
---remove_file \$MYSQLTEST_VARDIR/tmp/t1
-END
-}}}}}
-close $FILE
-EOF
---source $MYSQL_TMP_DIR/tmpgbk.inc
---remove_file $MYSQL_TMP_DIR/tmpgbk.inc
-
-
---echo #
---echo # Dump using mysqldump -Tdir
---echo #
-
---exec mkdir $MYSQLTEST_VARDIR/tmp/tmpgbk
---perl
-my $dir= $ENV{'MYSQL_TMP_DIR'};
-open (my $FILE, '>', "$dir/tmpgbk.inc") or die "open(): $!";
-for $LOCALE ("zh_CN.gbk") {
-for $DUMP_OPTIONS ("--default-character-set=binary","--default-character-set=gbk","--default-character-set=utf8") {
-for $RESTORE_OPTIONS ("--default-character-set=auto","--default-character-set=binary","--default-character-set=gbk","--default-character-set=utf8") {
-for $RESTORE_CHARSET_CLAUSE ("", "CHARACTER SET gbk", "CHARACTER SET utf8", "CHARACTER SET binary") {
-print $FILE <<END
---echo Start of {$LOCALE}{$DUMP_OPTIONS}{$RESTORE_OPTIONS $RESTORE_CHARSET_CLAUSE}
---echo Locale: $LOCALE
---echo mysqldump: $DUMP_OPTIONS
---echo INFILE: $RESTORE_OPTIONS $RESTORE_CHARSET_CLAUSE
---disable_query_log
-CALL populate();
---exec LC_ALL=$LOCALE \$MYSQL_DUMP $DUMP_OPTIONS -T\$MYSQLTEST_VARDIR/tmp/tmpgbk gbk t1
---vertical_results
-TRUNCATE TABLE t1;
---eval SELECT display_file(LOAD_FILE('\$MYSQLTEST_VARDIR/tmp/tmpgbk/t1.txt')) AS file;
---exec LC_ALL=$LOCALE \$MYSQL $RESTORE_OPTIONS gbk -e "LOAD DATA INFILE '\$MYSQLTEST_VARDIR/tmp/tmpgbk/t1.txt' IGNORE INTO TABLE t1 $RESTORE_CHARSET_CLAUSE"
-SELECT * FROM v1;
---echo End of {$LOCALE}{$DUMP_OPTIONS}{$RESTORE_OPTIONS $RESTORE_CHARSET_CLAUSE}
---echo
---echo
---horizontal_results
---enable_query_log
---remove_file \$MYSQLTEST_VARDIR/tmp/tmpgbk/t1.txt
---remove_file \$MYSQLTEST_VARDIR/tmp/tmpgbk/t1.sql
-END
-}}}}
-close $FILE
-EOF
---source $MYSQL_TMP_DIR/tmpgbk.inc
---remove_file $MYSQL_TMP_DIR/tmpgbk.inc
---rmdir $MYSQLTEST_VARDIR/tmp/tmpgbk
-
-
-DROP DATABASE gbk;
-USE test;
diff --git a/mysql-test/t/ctype_hebrew.test b/mysql-test/t/ctype_hebrew.test
deleted file mode 100644
index f786d05141d..00000000000
--- a/mysql-test/t/ctype_hebrew.test
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# BUG #24037: Lossy Hebrew to Unicode conversion
-#
-# Test if LRM and RLM characters are correctly converted to UTF-8
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-SET NAMES hebrew;
-CREATE TABLE t1 (a char(1)) DEFAULT CHARSET=hebrew;
-INSERT INTO t1 VALUES (0xFD),(0xFE);
-ALTER TABLE t1 CONVERT TO CHARACTER SET utf8;
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
---echo End of 4.1 tests
diff --git a/mysql-test/t/ctype_latin1.test b/mysql-test/t/ctype_latin1.test
deleted file mode 100644
index 38f147708b8..00000000000
--- a/mysql-test/t/ctype_latin1.test
+++ /dev/null
@@ -1,428 +0,0 @@
-#
-# Tests with the latin1 character set
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-#
-# WL 1494: Treat latin1 as cp1252 for unicode conversion
-#
-
-SET NAMES latin1;
-CREATE TABLE t1 (a char(1) character set latin1);
-INSERT INTO t1 VALUES (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07);
-INSERT INTO t1 VALUES (0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
-INSERT INTO t1 VALUES (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17);
-INSERT INTO t1 VALUES (0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
-INSERT INTO t1 VALUES (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27);
-INSERT INTO t1 VALUES (0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
-INSERT INTO t1 VALUES (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37);
-INSERT INTO t1 VALUES (0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
-INSERT INTO t1 VALUES (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47);
-INSERT INTO t1 VALUES (0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
-INSERT INTO t1 VALUES (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57);
-INSERT INTO t1 VALUES (0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
-INSERT INTO t1 VALUES (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67);
-INSERT INTO t1 VALUES (0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
-INSERT INTO t1 VALUES (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77);
-INSERT INTO t1 VALUES (0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
-INSERT INTO t1 VALUES (0x80),(0x81),(0x82),(0x83),(0x84),(0x85),(0x86),(0x87);
-INSERT INTO t1 VALUES (0x88),(0x89),(0x8A),(0x8B),(0x8C),(0x8D),(0x8E),(0x8F);
-INSERT INTO t1 VALUES (0x90),(0x91),(0x92),(0x93),(0x94),(0x95),(0x96),(0x97);
-INSERT INTO t1 VALUES (0x98),(0x99),(0x9A),(0x9B),(0x9C),(0x9D),(0x9E),(0x9F);
-INSERT INTO t1 VALUES (0xA0),(0xA1),(0xA2),(0xA3),(0xA4),(0xA5),(0xA6),(0xA7);
-INSERT INTO t1 VALUES (0xA8),(0xA9),(0xAA),(0xAB),(0xAC),(0xAD),(0xAE),(0xAF);
-INSERT INTO t1 VALUES (0xB0),(0xB1),(0xB2),(0xB3),(0xB4),(0xB5),(0xB6),(0xB7);
-INSERT INTO t1 VALUES (0xB8),(0xB9),(0xBA),(0xBB),(0xBC),(0xBD),(0xBE),(0xBF);
-INSERT INTO t1 VALUES (0xC0),(0xC1),(0xC2),(0xC3),(0xC4),(0xC5),(0xC6),(0xC7);
-INSERT INTO t1 VALUES (0xC8),(0xC9),(0xCA),(0xCB),(0xCC),(0xCD),(0xCE),(0xCF);
-INSERT INTO t1 VALUES (0xD0),(0xD1),(0xD2),(0xD3),(0xD4),(0xD5),(0xD6),(0xD7);
-INSERT INTO t1 VALUES (0xD8),(0xD9),(0xDA),(0xDB),(0xDC),(0xDD),(0xDE),(0xDF);
-INSERT INTO t1 VALUES (0xE0),(0xE1),(0xE2),(0xE3),(0xE4),(0xE5),(0xE6),(0xE7);
-INSERT INTO t1 VALUES (0xE8),(0xE9),(0xEA),(0xEB),(0xEC),(0xED),(0xEE),(0xEF);
-INSERT INTO t1 VALUES (0xF0),(0xF1),(0xF2),(0xF3),(0xF4),(0xF5),(0xF6),(0xF7);
-INSERT INTO t1 VALUES (0xF8),(0xF9),(0xFA),(0xFB),(0xFC),(0xFD),(0xFE),(0xFF);
-
-#
-# 0x81 0x8D 0x8F 0x90 0x9D are undefined in cp1252
-#
-SELECT
- hex(a),
- hex(@u:=convert(a using utf8)),
- hex(@l:=convert(@u using latin1)),
- a=@l FROM t1;
-DROP TABLE t1;
-
-#
-# Bug#13145: A table named "C-cedilla" can't be dropped.
-# Accept extended cp1252 letters as valid identifiers.
-# This test partially checks that "ctype" array is correct
-# for cp1252 extended characters 0x80-0x9F.
-#
-# 0x83 0x0192 #LATIN SMALL LETTER F WITH HOOK
-# 0x8A 0x0160 #LATIN CAPITAL LETTER S WITH CARON
-# 0x8C 0x0152 #LATIN CAPITAL LIGATURE OE
-# 0x8E 0x017D #LATIN CAPITAL LETTER Z WITH CARON
-# 0x9A 0x0161 #LATIN SMALL LETTER S WITH CARON
-# 0x9C 0x0153 #LATIN SMALL LIGATURE OE
-# 0x9E 0x017E #LATIN SMALL LETTER Z WITH CARON
-# 0x9F 0x0178 #LATIN CAPITAL LETTER Y WITH DIAERESIS
-#
-SELECT 1 as , 2 as , 3 as , 4 as , 5 as , 6 as , 7 as , 8 as ;
-
-#
-# Bug #6737: REGEXP gives wrong result with case sensitive collation
-#
-select 'a' regexp 'A' collate latin1_general_ci;
-select 'a' regexp 'A' collate latin1_general_cs;
-select 'a' regexp 'A' collate latin1_bin;
-
-
-SET @test_character_set= 'latin1';
-SET @test_collation= 'latin1_swedish_ci';
--- source include/ctype_common.inc
-
-SET collation_connection='latin1_swedish_ci';
--- source include/ctype_filesort.inc
--- source include/ctype_like_escape.inc
--- source include/ctype_str_to_date.inc
--- source include/ctype_pad_space.inc
-SET collation_connection='latin1_bin';
--- source include/ctype_filesort.inc
--- source include/ctype_like_escape.inc
--- source include/ctype_pad_space.inc
-
-#
-# Bug#8041
-# An unknown character (e.g. 0x84) should result in ERROR,
-# It was treated like a space character earlier.
-# Howerver, it should still work fine as a string part.
---error 1064
-CREATE TABLE a (a int);
-SELECT 'a' as str;
-
-
-#
-# Bug#18321: Can't store EuroSign with latin1_german1_ci and latin1_general_ci
-# The problem was in latin1->utf8->latin1 round trip.
-#
-set @str= _latin1 'ABC ߲~ @ abc';
-SELECT convert(@str collate latin1_bin using utf8);
-SELECT convert(@str collate latin1_general_ci using utf8);
-SELECT convert(@str collate latin1_german1_ci using utf8);
-SELECT convert(@str collate latin1_danish_ci using utf8);
-SELECT convert(@str collate latin1_spanish_ci using utf8);
-SELECT convert(@str collate latin1_german2_ci using utf8);
-SELECT convert(@str collate latin1_swedish_ci using utf8);
-
-# End of 4.1 tests
-
-SET NAMES latin1;
---disable_warnings
-DROP TABLE IF EXISTS `abcdef`;
---enable_warnings
-CREATE TABLE `abcdef` (i int);
-INSERT INTO `abcdef` VALUES (1);
-INSERT INTO abcdef VALUES (2);
-SELECT * FROM `abcdef`;
-SELECT * FROM abcdef;
-DROP TABLE `abcdef`;
-#
-# Bug#29499 Converting 'del' from ascii to Unicode results in 'question mark'
-#
-select hex(cast(_ascii 0x7f as char(1) character set latin1));
-
---echo End of 5.0 tests
-
-
---echo #
---echo # Bug#58022 ... like ... escape export_set ( ... ) crashes when export_set returns warnings
---echo #
-SELECT '' LIKE '' ESCAPE EXPORT_SET(1, 1, 1, 1, '');
-
---echo End of 5.1 tests
-
-
---echo #
---echo # Start of 5.5 tests
---echo #
-
---source include/ctype_numconv.inc
-
---echo #
---echo # Bug#11764503 (Bug#57341) Query in EXPLAIN EXTENDED shows wrong characters
---echo #
-# Test latin1 client erroneously started with --default-character-set=utf8
-# EXPLAIN output should still be pretty readable.
-# We're using 'ó' (\xC3\xB3) as a magic sequence:
-# - it's "LATIN CAPITAL LETTER A WITH TILDE ABOVE + SUPERSCRIPT 3" in latin1
-# - it's "LATIN SMALL LETTER O WITH ACUTE ABOVE" in utf8.
-SET NAMES utf8;
-EXPLAIN EXTENDED SELECT 'abcdó', _latin1'abcdó', _utf8'abcdó';
-# Test normal latin1
-SET NAMES latin1;
-EXPLAIN EXTENDED SELECT 'abcdó', _latin1'abcdó', _utf8'abcdó';
-
-
---echo #
---echo # End of 5.5 tests
---echo #
-
-
-
---echo #
---echo # Start of 5.6 tests
---echo #
-
---echo #
---echo # WL#3664 WEIGHT_STRING
---echo #
-
-set @@collation_connection=latin1_swedish_ci;
---source include/weight_string.inc
---source include/weight_string_euro.inc
---source include/weight_string_l1.inc
-
-set @@collation_connection=latin1_bin;
---source include/weight_string.inc
---source include/weight_string_euro.inc
---source include/weight_string_l1.inc
-
-set @@collation_connection=latin1_general_cs;
---source include/weight_string.inc
---source include/weight_string_euro.inc
---source include/weight_string_l1.inc
-
-set @@collation_connection=binary;
---source include/weight_string.inc
---source include/weight_string_euro.inc
---source include/weight_string_l1.inc
-
-set names latin1;
-
---echo #
---echo # End of 5.6 tests
---echo #
-
---echo #
---echo # Start of 10.0 tests
---echo #
-
-let $ctype_unescape_combinations=selected;
---source include/ctype_unescape.inc
-
-SET NAMES latin1;
---source include/ctype_like_cond_propagation.inc
-
-SET NAMES latin1 COLLATE latin1_bin;
---source include/ctype_like_cond_propagation.inc
-
-
---echo #
---echo # MDEV-6752 Trailing incomplete characters are not replaced to question marks on conversion
---echo #
-SET NAMES utf8, character_set_connection=latin1;
-SELECT '';
-SELECT HEX('');
-SELECT HEX(CAST('' AS CHAR CHARACTER SET utf8));
-SELECT HEX(CAST('' AS CHAR CHARACTER SET latin1));
-SELECT HEX(CONVERT('' USING utf8));
-SELECT HEX(CONVERT('' USING latin1));
-SELECT 'x';
-SELECT HEX('x');
-SELECT HEX(CAST('x' AS CHAR CHARACTER SET utf8));
-SELECT HEX(CAST('x' AS CHAR CHARACTER SET latin1));
-SELECT HEX(CONVERT('x' USING utf8));
-SELECT HEX(CONVERT('x' USING latin1));
-SET NAMES utf8;
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
-INSERT IGNORE INTO t1 VALUES (''),('#');
-SHOW WARNINGS;
-SELECT HEX(a),a FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-7629 Regression: Bit and hex string literals changed column names in 10.0.14
---echo #
-SELECT _latin1 0x7E, _latin1 X'7E', _latin1 B'01111110';
-
-
---echo #
---echo # MDEV-9886 Illegal mix of collations with a view comparing a field to a binary constant
---echo #
-
-SET NAMES latin1;
-CREATE TABLE t1 (a TEXT CHARACTER SET latin1);
-INSERT INTO t1 VALUES (0xC0);
-SELECT a<>0xEE5D AS a FROM t1;
-CREATE VIEW v1 AS SELECT a<>0xC0 AS a FROM t1;
-SHOW CREATE VIEW v1;
-SELECT * FROM v1;
-DROP VIEW v1;
-DROP TABLE t1;
-
-
---echo #
---echo # End of 10.0 tests
---echo #
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-8661 Wrong result for SELECT..WHERE a='a' AND a='a' COLLATE latin1_bin
---echo #
-SET NAMES latin1;
-CREATE TABLE t1 (a CHAR(10));
-INSERT INTO t1 VALUES ('a'),('A');
-SELECT * FROM t1 WHERE a='a' AND a='a' COLLATE latin1_bin;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci);
-INSERT INTO t1 VALUES ('a'),('A');
-SELECT * FROM t1 WHERE a='a' COLLATE latin1_bin AND a='A' COLLATE latin1_swedish_ci;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8679 Equal field propagation is not used for VARCHAR when it safely could
---echo #
-CREATE TABLE t1 (a VARCHAR(10));
-INSERT INTO t1 VALUES ('10'),('11'),('12');
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='10' AND IF(a='10',1,0)=1;
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='10' AND CASE WHEN a='10' THEN 1 ELSE 0 END;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8680 Wrong result for SELECT..WHERE a IN ('a' COLLATE latin1_bin,'b') AND a='a'
---echo #
-SET NAMES latin1;
-CREATE TABLE t1 (a VARCHAR(10));
-INSERT INTO t1 VALUES ('a'),('A');
-SELECT * FROM t1 WHERE a IN ('a' COLLATE latin1_bin,'b');
-SELECT * FROM t1 WHERE a IN ('a' COLLATE latin1_bin,'b') AND a='a';
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN ('a' COLLATE latin1_bin,'b') AND a='a';
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8698 Wrong result for SELECT..WHERE a BETWEEN 'a' AND 'c' COLLATE latin1_bin;
---echo #
-SET NAMES latin1;
-CREATE TABLE t1 (a VARCHAR(10));
-INSERT INTO t1 VALUES ('a'),('A'),('b'),('B'),('c'),('C');
-SELECT * FROM t1 WHERE a BETWEEN 'a' AND 'c' COLLATE latin1_bin;
-SELECT * FROM t1 WHERE a BETWEEN 'a' AND 'c' COLLATE latin1_bin AND a='a';
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a BETWEEN 'a' AND 'c' COLLATE latin1_bin AND a='a';
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8707 Wrong result for SELECT..WHERE varchar_column=DATE'2001-01-01' AND varchar_column='2001-01-01'
---echo #
-SET NAMES latin1;
-CREATE TABLE t1 (a VARCHAR(40));
-INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-01x');
-SELECT * FROM t1 WHERE a=DATE'2001-01-01' AND a='2001-01-01';
-SELECT * FROM t1 WHERE a='2001-01-01' AND a=DATE'2001-01-01';
-SELECT * FROM t1 WHERE (a,a)=('2001-01-01x',DATE'2001-01-01');
-SELECT * FROM t1 WHERE (a,a)=(DATE'2001-01-01','2001-01-01x');
-SELECT * FROM t1 WHERE (a,a)=('2001-01-01',DATE'2001-01-01');
-SELECT * FROM t1 WHERE (a,a)=(DATE'2001-01-01','2001-01-01');
-DROP TABLE t1;
-CREATE TABLE t1 (a ENUM('2001-01-01','2001-01-01x'));
-INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-01x');
-SELECT * FROM t1 WHERE a=DATE'2001-01-01' AND a='2001-01-01';
-SELECT * FROM t1 WHERE a='2001-01-01' AND a=DATE'2001-01-01';
-SELECT * FROM t1 WHERE (a,a)=('2001-01-01x',DATE'2001-01-01');
-SELECT * FROM t1 WHERE (a,a)=(DATE'2001-01-01','2001-01-01x');
-SELECT * FROM t1 WHERE (a,a)=('2001-01-01',DATE'2001-01-01');
-SELECT * FROM t1 WHERE (a,a)=(DATE'2001-01-01','2001-01-01');
-DROP TABLE t1;
-CREATE TABLE t1 (a VARCHAR(40),b VARCHAR(40));
-INSERT INTO t1 VALUES ('2001-01-01','2001-01-01x');
-SELECT * FROM t1 WHERE a=b AND a=DATE'2001-01-01';
-DROP TABLE t1;
-CREATE TABLE t1 (a ENUM('2001-01-01','2001-01-01x'),b ENUM('2001-01-01','2001-01-01x'));
-INSERT INTO t1 VALUES ('2001-01-01','2001-01-01x');
-SELECT * FROM t1 WHERE a=b AND a=DATE'2001-01-01';
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8695 Wrong result for SELECT..WHERE varchar_column='a' AND CRC32(varchar_column)=3904355907
---echo #
-CREATE TABLE t1 (a VARCHAR(10) COLLATE latin1_bin);
-INSERT INTO t1 VALUES ('a'),('a ');
-SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE CRC32(a)=3904355907;
-SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE a='a' AND CRC32(a)=3904355907;
---echo # 'a' should not be propagated into CRC32(a)
-EXPLAIN EXTENDED SELECT a, LENGTH(a), CRC32(a) FROM t1 WHERE a='a' AND CRC32(a)=3904355907;
-SELECT a, HEX(a) FROM t1 WHERE HEX(a)='61';
-SELECT *,HEX(a) FROM t1 WHERE a='a' AND HEX(a)='61';
---echo # 'a' should not be propagated into HEX(a)
-EXPLAIN EXTENDED SELECT *,HEX(a) FROM t1 WHERE a='a' AND HEX(a)='61';
-SELECT * FROM t1 WHERE a='a';
-SELECT * FROM t1 WHERE LENGTH(a)=2;
-SELECT * FROM t1 WHERE a='a' AND LENGTH(a)=2;
---echo # 'a' should not be propagated into LENGTH(a)
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND LENGTH(a)=2;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8712 Wrong result for SELECT..WHERE latin1_bin_column=_latin1'a' AND latin1_bin_column='A'
---echo #
-SET NAMES latin1;
-CREATE TABLE t1 (a VARCHAR(20) COLLATE latin1_bin);
-INSERT INTO t1 VALUES ('a'),('b');
-SELECT * FROM t1 WHERE a='A';
-SELECT * FROM t1 WHERE a='A' AND a=_latin1'a';
-SELECT * FROM t1 WHERE a=_latin1'a' AND a='A';
-SELECT * FROM t1 WHERE a=_latin1'A';
-SELECT * FROM t1 WHERE a=_latin1'A' AND a=_latin1'a';
-SELECT * FROM t1 WHERE a=_latin1'a' AND a=_latin1'A';
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8253 EXPLAIN SELECT prints unexpected characters
---echo #
-SET NAMES latin1;
-CREATE TABLE t1 (a DECIMAL(10,1),b DECIMAL(10,1),c VARCHAR(10),d VARCHAR(10));
-INSERT INTO t1 VALUES (1.5,1.5,'1','1'),(3.5,3.5,'3','3');
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE COALESCE(c,0)='3 ' AND COALESCE(d,0)=COALESCE(c,0);
-DROP TABLE t1;
-
---echo #
---echo # MDEV-15005 ASAN: stack-buffer-overflow in my_strnncollsp_simple
---echo #
-
-SET NAMES latin1;
-SELECT CONVERT(1, CHAR) IN ('100', 10, '101');
-SELECT CONVERT(1, CHAR) IN ('100', 10, '1');
-SELECT CONVERT(1, CHAR) IN ('100', '10', '1');
-
---echo #
---echo # End of 10.1 tests
---echo #
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-9711 NO PAD Collatons
---echo #
-SET character_set_connection=latin1;
-let $coll='latin1_swedish_nopad_ci';
-let $coll_pad='latin1_swedish_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='latin1_nopad_bin';
-let $coll_pad='latin1_bin';
---source include/ctype_pad_all_engines.inc
-
-SET NAMES latin1;
---source include/ctype_like_range_mdev14350.inc
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/ctype_latin1_de-master.opt b/mysql-test/t/ctype_latin1_de-master.opt
deleted file mode 100644
index 0c072424de9..00000000000
--- a/mysql-test/t/ctype_latin1_de-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---character-set-server=latin1 --collation-server=latin1_german2_ci
diff --git a/mysql-test/t/ctype_latin1_de.test b/mysql-test/t/ctype_latin1_de.test
deleted file mode 100644
index 29a52c36db6..00000000000
--- a/mysql-test/t/ctype_latin1_de.test
+++ /dev/null
@@ -1,182 +0,0 @@
-#
-# Test latin_de character set
-#
-
-set names latin1;
-set @@collation_connection=latin1_german2_ci;
-
-select @@collation_connection;
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1 (a char (20) not null, b int not null auto_increment, index (a,b));
-insert into t1 (a) values (''),('ac'),('ae'),('ad'),('c'),('aeb');
-insert into t1 (a) values ('c'),('uc'),('ue'),('ud'),(''),('ueb'),('uf');
-insert into t1 (a) values (''),('oc'),('a'),('oe'),('od'),('c'),('oeb');
-insert into t1 (a) values ('s'),('ss'),(''),('b'),('ssa'),('ssc'),('a');
-insert into t1 (a) values ('e'),('u'),('o'),(''),('a'),('aeae');
-insert into t1 (a) values ('q'),('a'),('u'),('o'),(''),(''),('a');
-select a,b from t1 order by a,b;
-select a,b from t1 order by upper(a),b;
-select a from t1 order by a desc;
-check table t1;
-select * from t1 where a like "%";
-select * from t1 where a like binary "%%";
-select * from t1 where a like "%%";
-select * from t1 where a like "%U%";
-select * from t1 where a like "%ss%";
-drop table t1;
-
-# The following should all be true
-select strcmp('','ae'),strcmp('ae',''),strcmp('aeq','q'),strcmp('q','aeq');
-select strcmp('ss',''),strcmp('','ss'),strcmp('s','sss'),strcmp('q','ssq');
-
-# The following should all return -1
-select strcmp('','af'),strcmp('a',''),strcmp('','aeq'),strcmp('','aeaeq');
-select strcmp('ss','a'),strcmp('','ssa'),strcmp('sa','sssb'),strcmp('s','');
-select strcmp('','o'),strcmp('','u'),strcmp('','oeb');
-
-# The following should all return 1
-select strcmp('af',''),strcmp('','a'),strcmp('aeq',''),strcmp('aeaeq','');
-select strcmp('a','ss'),strcmp('ssa',''),strcmp('sssb','sa'),strcmp('','s');
-select strcmp('u','a'),strcmp('u','');
-
-#
-# overlapping combo's
-#
-select strcmp('s', 'a'), strcmp('a', 'x');
-#
-# Some other simple tests with the current character set
-#
-
-create table t1 (a varchar(10), key(a), fulltext (a));
-insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test");
-select * from t1 where a like "abc%";
-select * from t1 where a like "test%";
-select * from t1 where a like "te_t";
-select * from t1 where match a against ("te*" in boolean mode)+0;
-drop table t1;
-
-#
-# Test bug report #152 (problem with index on latin1_de)
-#
-
-#
-# The below checks both binary and character comparisons.
-#
-create table t1 (word varchar(255) not null, word2 varchar(255) not null default '', index(word));
-show create table t1;
-insert into t1 (word) values ('ss'),(0xDF),(0xE4),('ae');
-update t1 set word2=word;
-select word, word=binary 0xdf as t from t1 having t > 0;
-select word, word=cast(0xdf AS CHAR) as t from t1 having t > 0;
-select * from t1 where word=binary 0xDF;
-select * from t1 where word=CAST(0xDF as CHAR);
-select * from t1 where word2=binary 0xDF;
-select * from t1 where word2=CAST(0xDF as CHAR);
-select * from t1 where word='ae';
-select * from t1 where word= 0xe4 or word=CAST(0xe4 as CHAR);
-select * from t1 where word between binary 0xDF and binary 0xDF;
-select * from t1 where word between CAST(0xDF AS CHAR) and CAST(0xDF AS CHAR);
-select * from t1 where word like 'ae';
-select * from t1 where word like 'AE';
-select * from t1 where word like binary 0xDF;
-select * from t1 where word like CAST(0xDF as CHAR);
-drop table t1;
-
-#
-# Bug #5447 Select does not find records
-#
-CREATE TABLE t1 (
- autor varchar(80) NOT NULL default '',
- PRIMARY KEY (autor)
-);
-INSERT INTO t1 VALUES ('Powell, B.'),('Powell, Bud.'),('Powell, L. H.'),('Power, H.'),
-('Poynter, M. A. L. Lane'),('Poynting, J. H. und J. J. Thomson.'),('Pozzi, S(amuel-Jean).'),
-('Pozzi, Samuel-Jean.'),('Pozzo, A.'),('Pozzoli, Serge.');
-SELECT * FROM t1 WHERE autor LIKE 'Poz%' ORDER BY autor;
-DROP TABLE t1;
-
-#
-# Test of special character in german collation
-#
-
-CREATE TABLE t1 (
-s1 CHAR(5) CHARACTER SET latin1 COLLATE latin1_german2_ci
-);
-show create table t1;
-INSERT INTO t1 VALUES ('');
-INSERT INTO t1 VALUES ('ue');
-SELECT DISTINCT s1 FROM t1;
-SELECT s1,COUNT(*) FROM t1 GROUP BY s1;
-SELECT COUNT(DISTINCT s1) FROM t1;
-SELECT FIELD('ue',s1), FIELD('',s1), s1='ue', s1='' FROM t1;
-DROP TABLE t1;
-
--- source include/ctype_filesort.inc
--- source include/ctype_german.inc
-
-#
-# Bug#7878 with utf8_general_ci, equals (=) has problem with
-# accent insensitivity.
-# Although originally this problem was found with UTF8 character set,
-# '=' behaved wrong for latin1_german2_ci as well.
-# Let's check it does not work incorrect anymore.
-#
-SET NAMES latin1;
-CREATE TABLE t1 (
- col1 varchar(255) NOT NULL default ''
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 collate latin1_german2_ci;
-INSERT INTO t1 VALUES (''),('ss'),('ss');
-ALTER TABLE t1 ADD KEY ifword(col1);
-SELECT * FROM t1 WHERE col1='' ORDER BY col1, BINARY col1;
-DROP TABLE t1;
-
-# End of 4.1 tests
-
-#
-# Bug#9509
-#
-create table t1 (s1 char(5) character set latin1 collate latin1_german2_ci);
-insert into t1 values (0xf6) /* this is o-umlaut */;
-select * from t1 where length(s1)=1 and s1='oe';
-drop table t1;
-
---echo End of 5.1 tests
-
-
---echo #
---echo # Start of 5.6 tests
---echo #
-
---echo #
---echo # WL#3664 WEIGHT_STRING
---echo #
-
-set @@collation_connection=latin1_german2_ci;
---source include/weight_string.inc
---source include/weight_string_euro.inc
---source include/weight_string_l1.inc
-select hex(weight_string(''));
-select hex(weight_string(''));
-select hex(weight_string(''));
-select hex(weight_string(''));
-select hex(weight_string(''));
-select hex(weight_string(''));
-select hex(weight_string('S'));
-select hex(weight_string('s'));
-select hex(weight_string(''));
-select hex(weight_string('' as char(1)));
-select hex(weight_string('' as char(1)));
-select hex(weight_string('' as char(1)));
-select hex(weight_string('' as char(1)));
-select hex(weight_string('x' as char(2)));
-select hex(weight_string('x' as char(2)));
-select hex(weight_string('x' as char(2)));
-select hex(weight_string('x' as char(2)));
-
---echo #
---echo # End of 5.6 tests
---echo #
diff --git a/mysql-test/t/ctype_latin2.test b/mysql-test/t/ctype_latin2.test
deleted file mode 100644
index e80515993f2..00000000000
--- a/mysql-test/t/ctype_latin2.test
+++ /dev/null
@@ -1,76 +0,0 @@
-
-# Tests with the latin1 character set
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-SET NAMES latin2;
-CREATE TABLE t1 (a char(1) character set latin2);
-INSERT INTO t1 VALUES (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27);
-INSERT INTO t1 VALUES (0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
-INSERT INTO t1 VALUES (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37);
-INSERT INTO t1 VALUES (0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
-INSERT INTO t1 VALUES (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47);
-INSERT INTO t1 VALUES (0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
-INSERT INTO t1 VALUES (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57);
-INSERT INTO t1 VALUES (0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
-INSERT INTO t1 VALUES (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67);
-INSERT INTO t1 VALUES (0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
-INSERT INTO t1 VALUES (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77);
-INSERT INTO t1 VALUES (0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
-INSERT INTO t1 VALUES (0x80),(0x81),(0x82),(0x83),(0x84),(0x85),(0x86),(0x87);
-INSERT INTO t1 VALUES (0x88),(0x89),(0x8A),(0x8B),(0x8C),(0x8D),(0x8E),(0x8F);
-INSERT INTO t1 VALUES (0x90),(0x91),(0x92),(0x93),(0x94),(0x95),(0x96),(0x97);
-INSERT INTO t1 VALUES (0x98),(0x99),(0x9A),(0x9B),(0x9C),(0x9D),(0x9E),(0x9F);
-INSERT INTO t1 VALUES (0xA0),(0xA1),(0xA2),(0xA3),(0xA4),(0xA5),(0xA6),(0xA7);
-INSERT INTO t1 VALUES (0xA8),(0xA9),(0xAA),(0xAB),(0xAC),(0xAD),(0xAE),(0xAF);
-INSERT INTO t1 VALUES (0xB0),(0xB1),(0xB2),(0xB3),(0xB4),(0xB5),(0xB6),(0xB7);
-INSERT INTO t1 VALUES (0xB8),(0xB9),(0xBA),(0xBB),(0xBC),(0xBD),(0xBE),(0xBF);
-INSERT INTO t1 VALUES (0xC0),(0xC1),(0xC2),(0xC3),(0xC4),(0xC5),(0xC6),(0xC7);
-INSERT INTO t1 VALUES (0xC8),(0xC9),(0xCA),(0xCB),(0xCC),(0xCD),(0xCE),(0xCF);
-INSERT INTO t1 VALUES (0xD0),(0xD1),(0xD2),(0xD3),(0xD4),(0xD5),(0xD6),(0xD7);
-INSERT INTO t1 VALUES (0xD8),(0xD9),(0xDA),(0xDB),(0xDC),(0xDD),(0xDE),(0xDF);
-INSERT INTO t1 VALUES (0xE0),(0xE1),(0xE2),(0xE3),(0xE4),(0xE5),(0xE6),(0xE7);
-INSERT INTO t1 VALUES (0xE8),(0xE9),(0xEA),(0xEB),(0xEC),(0xED),(0xEE),(0xEF);
-INSERT INTO t1 VALUES (0xF0),(0xF1),(0xF2),(0xF3),(0xF4),(0xF5),(0xF6),(0xF7);
-INSERT INTO t1 VALUES (0xF8),(0xF9),(0xFA),(0xFB),(0xFC),(0xFD),(0xFE),(0xFF);
-
-#
-# Bug#6504 upper/lower conversion bug
-#
-SELECT hex(a) ha, hex(lower(a)) hl, hex(upper(a)) hu,
-a, lower(a) l, upper(a) u from t1 order by ha;
-
-
-#
-# Bug#6505 wrong sorting order
-#
-SELECT group_concat(a collate latin2_croatian_ci order by binary a) from t1 group by a collate latin2_croatian_ci;
-drop table t1;
-
-# End of 4.1 tests
-
---echo End of 5.1 tests
-
-
---echo #
---echo # Start of 5.6 tests
---echo #
-
---echo #
---echo # WL#3664 WEIGHT_STRING
---echo #
-
-set names latin2;
---source include/weight_string.inc
---source include/weight_string_l1.inc
---source include/ctype_datetime.inc
-
-set collation_connection=latin2_bin;
---source include/weight_string.inc
---source include/weight_string_l1.inc
-
---echo #
---echo # End of 5.6 tests
---echo #
diff --git a/mysql-test/t/ctype_latin2_ch.test b/mysql-test/t/ctype_latin2_ch.test
deleted file mode 100644
index 06ccd2c9782..00000000000
--- a/mysql-test/t/ctype_latin2_ch.test
+++ /dev/null
@@ -1,245 +0,0 @@
--- source include/have_latin2_ch.inc
-
-#
-# Tests with latin2_czech_cs
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-#
-# Bug#17374: select ... like 'A%' operator fails
-# to find value on columuns with key
-#
-set names latin2;
-select 'A' = 'a' collate latin2_czech_cs;
-create table t1 (
- id int(5) not null,
- tt char(255) not null
-) character set latin2 collate latin2_czech_cs;
-insert into t1 values (1,'Aa');
-insert into t1 values (2,'Aas');
-alter table t1 add primary key aaa(tt);
-select * from t1 where tt like 'Aa%';
-select * from t1 ignore index (primary) where tt like 'Aa%';
-select * from t1 where tt like '%Aa%';
-select * from t1 where tt like 'AA%';
-select * from t1 ignore index (primary) where tt like 'AA%';
-select * from t1 where tt like '%AA%';
-
-drop table t1;
-
-# End of 4.1 tests
-
-set names latin2 collate latin2_czech_cs;
---source include/ctype_pad_space.inc
---source include/ctype_like_cond_propagation.inc
-
-# We can not use ctype_filesort.inc because
-# order of SPACE and TAB is not strict
-#--source include/ctype_filesort.inc
-#
-
-#
-# Bug#29459 server died handling latin2 collate latin2_czech_cs
-#
-create table t1 (
- a varchar(2) character set latin2 collate latin2_czech_cs,
- primary key(a)
-);
-insert into t1 set a=0x5ff;
-insert into t1 set a=0xff;
-select hex(a) from t1;
-drop table t1;
-
-#
-# Bug#33452 Primary difference between capital and small letters U and O
-#
-create table t1 (
- ch varchar(1),
- name varchar(64)
-) character set latin2 collate latin2_czech_cs;
-
-insert into t1 values (0x6F,'LATIN SMALL LETTER O');
-insert into t1 values (0xF3,'LATIN SMALL LETTER O WITH ACUTE');
-insert into t1 values (0xF4,'LATIN SMALL LETTER O WITH CIRCUMFLEX');
-insert into t1 values (0xF6,'LATIN SMALL LETTER O WITH DIAERESIS');
-insert into t1 values (0xF5,'LATIN SMALL LETTER O WITH DOUBLE ACUTE');
-insert into t1 values (0x4F,'LATIN CAPITAL LETTER O');
-insert into t1 values (0xD3,'LATIN CAPITAL LETTER O WITH ACUTE');
-insert into t1 values (0xD4,'LATIN CAPITAL LETTER O WITH CURCUMFLEX');
-insert into t1 values (0xD6,'LATIN CAPITAL LETTER O WITH DIAERESIS');
-insert into t1 values (0xD5,'LATIN CAPITAL LETTER O WITH DOUBLE ACUTE');
-
-insert into t1 values (0x75,'LATIN SMALL LETTER U');
-insert into t1 values (0xFA,'LATIN SMALL LETTER U WITH ACUTE');
-insert into t1 values (0xF9,'LATIN SMALL LETTER U WITH RING ABOVE');
-insert into t1 values (0xFC,'LATIN SMALL LETTER U WITH DIAERESIS');
-insert into t1 values (0xFB,'LATIN SMALL LETTER U WITH DOUBLE ACUTE');
-insert into t1 values (0x55,'LATIN CAPITAL LETTER U');
-insert into t1 values (0xDA,'LATIN CAPITAL LETTER U WITH ACUTE');
-insert into t1 values (0xD9,'LATIN CAPITAL LETTER U WITH RING ABOVE');
-insert into t1 values (0xDC,'LATIN CAPITAL LETTER U WITH DIAERESIS');
-insert into t1 values (0xDB,'LATIN CAPITAL LETTER U WITH DOUBLE ACUTE');
-select
-hex(weight_string(ch level 1)) l1,
-hex(weight_string(ch level 2)) l2,
-hex(weight_string(ch level 3)) l3,
-hex(weight_string(ch level 4)) l4,
-name from t1 order by binary l1, binary l2, binary l3, binary l4;
-drop table t1;
-
-#
-# Bug#33791 Wrong ORDER BY with latin2_czech_cs
-#
-set names utf8;
-create table t1 (
-ch varchar(1),
-name varchar(64)
-) character set latin2 collate latin2_czech_cs;
-insert into t1 values (0x4F,'LATIN CAPITAL LETTER O');
-insert into t1 values (0xD3,'LATIN CAPITAL LETTER O WITH ACUTE');
-insert into t1 values (0xD4,'LATIN CAPITAL LETTER O WITH CURCUMFLEX');
-insert into t1 values (0xD6,'LATIN CAPITAL LETTER O WITH DIAERESIS');
-insert into t1 values (0xD5,'LATIN CAPITAL LETTER O WITH DOUBLE ACUTE');
-insert into t1 values (0x75,'LATIN _SMALL_ LETTER U');
-insert into t1 values (0xFA,'LATIN _SMALL_ LETTER U WITH ACUTE');
-insert into t1 values (0xF9,'LATIN _SMALL_ LETTER U WITH RING ABOVE');
-insert into t1 values (0xFC,'LATIN _SMALL_ LETTER U WITH DIAERESIS');
-insert into t1 values (0xFB,'LATIN _SMALL_ LETTER U WITH DOUBLE ACUTE');
-# Testing order by Field_varchar
-select ch,
- hex(weight_string(ch level 1)) l1,
- hex(weight_string(ch level 2)) l2,
- hex(weight_string(ch level 3)) l3,
- hex(weight_string(ch level 4)) l4,
- name from t1 order by ch;
-alter table t1 modify ch char(1), modify name char(64);
-# Testing order by Field_char
-select ch,
- hex(weight_string(ch level 1)) l1,
- hex(weight_string(ch level 2)) l2,
- hex(weight_string(ch level 3)) l3,
- hex(weight_string(ch level 4)) l4,
- name from t1 order by ch;
-# Testing order by Item
-select ch,
- hex(weight_string(ch level 1)) l1,
- hex(weight_string(ch level 2)) l2,
- hex(weight_string(ch level 3)) l3,
- hex(weight_string(ch level 4)) l4,
- name from t1 order by concat(ch);
-drop table t1;
-
-#
-# Bug #30462 Character sets: search failures with case sensitive collations
-#
-SET collation_connection=latin2_czech_cs;
-CREATE TABLE t1 ENGINE=MYISAM AS SELECT repeat('a', 5) AS s1 LIMIT 0;
-INSERT INTO t1 VALUES ('x'),('y'),('z'),('X'),('Y'),('Z');
-SELECT * FROM t1 GROUP BY s1;
-SELECT * FROM t1 ORDER BY s1;
-CREATE INDEX i1 ON t1 (s1);
-SELECT * FROM t1 GROUP BY s1;
-SELECT * FROM t1 ORDER BY s1;
-DROP TABLE t1;
-
-set sql_mode="";
---disable_warnings
-CREATE TABLE t1 ENGINE=INNODB AS SELECT repeat('a', 5) AS s1 LIMIT 0;
---enable_warnings
-INSERT INTO t1 VALUES ('x'),('y'),('z'),('X'),('Y'),('Z');
-SELECT * FROM t1 GROUP BY s1;
-SELECT * FROM t1 ORDER BY s1;
-CREATE INDEX i1 ON t1 (s1);
-SELECT * FROM t1 GROUP BY s1;
-SELECT * FROM t1 ORDER BY s1;
-DROP TABLE t1;
-
---disable_warnings
-SET sql_mode='';
-CREATE TABLE t1 ENGINE=FALCON AS SELECT repeat('a', 5) AS s1 LIMIT 0;
-SET sql_mode=DEFAULT;
---enable_warnings
-INSERT INTO t1 VALUES ('x'),('y'),('z'),('X'),('Y'),('Z');
-SELECT * FROM t1 GROUP BY s1;
-SELECT * FROM t1 ORDER BY s1;
-CREATE INDEX i1 ON t1 (s1);
-SELECT * FROM t1 GROUP BY s1;
-SELECT * FROM t1 ORDER BY s1;
-DROP TABLE t1;
-
---disable_warnings
-SET sql_mode='';
-CREATE TABLE t1 ENGINE=MARIA AS SELECT repeat('a', 5) AS s1 LIMIT 0;
-SET sql_mode=DEFAULT;
---enable_warnings
-INSERT INTO t1 VALUES ('x'),('y'),('z'),('X'),('Y'),('Z');
-SELECT * FROM t1 GROUP BY s1;
-SELECT * FROM t1 ORDER BY s1;
-CREATE INDEX i1 ON t1 (s1);
-SELECT * FROM t1 GROUP BY s1;
-SELECT * FROM t1 ORDER BY s1;
-DROP TABLE t1;
-
-SET NAMES latin2;
-
-
-#
-# Bug#37854 Test fails/aborts for collate latin2_czech_cs used with SET and ENUM datatypes
-#
-CREATE TABLE t2(colours SET('red','blue','yellow'))CHARACTER SET latin2 COLLATE
-latin2_czech_cs;
-CREATE TABLE t1(continent ENUM('Asia', 'Europe','Africa','Antartica'))CHARACTER SET latin2
-COLLATE latin2_czech_cs;
-INSERT INTO t1 VALUES('Asia');
-INSERT INTO t2 VALUES('blue');
-SELECT * FROM t1;
-SELECT * FROM t2;
-DROP TABLE t1, t2;
-
-#
-# Bug#40805 Cannot restore table
-#
-CREATE TABLE `t1` (
- `ID` smallint(5) unsigned zerofill NOT NULL AUTO_INCREMENT,
- `Post` enum('','B','O','Z','U') COLLATE latin2_czech_cs DEFAULT NULL,
- PRIMARY KEY (`ID`)
-) ENGINE=MyISAM AUTO_INCREMENT=135 DEFAULT CHARSET=latin2;
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (ID,Post) VALUES (00041,'');
-SELECT ID, Post, HEX(WEIGHT_STRING(Post)) FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # Start of 5.6 tests
---echo #
-
---echo #
---echo # WL#3664 WEIGHT_STRING
---echo #
-
-set names latin2 collate latin2_czech_cs;
---source include/ctype_pad_space.inc
-# We can not use ctype_filesort.inc because
-# order of SPACE and TAB is not strict
-#--source include/ctype_filesort.inc
-
---echo #
---echo # Note:
---echo # latin2_czech_cs does not support WEIGHT_STRING in full extent
---echo #
---source include/weight_string.inc
---source include/weight_string_chde.inc
---source include/weight_string_l1.inc
---source include/weight_string_l2.inc
---source include/weight_string_l3.inc
---source include/weight_string_l4.inc
---source include/weight_string_l12.inc
---source include/weight_string_l14.inc
-
---echo #
---echo # End of 5.6 tests
---echo #
-
diff --git a/mysql-test/t/ctype_ldml-master.opt b/mysql-test/t/ctype_ldml-master.opt
deleted file mode 100644
index 250dd2cb5a2..00000000000
--- a/mysql-test/t/ctype_ldml-master.opt
+++ /dev/null
@@ -1,2 +0,0 @@
---character-sets-dir=$MYSQL_TEST_DIR/std_data/ldml/
---log-error=$MYSQLTEST_VARDIR/tmp/ctype_ldml_log.err
diff --git a/mysql-test/t/ctype_ldml.test b/mysql-test/t/ctype_ldml.test
deleted file mode 100644
index a6cba4b9780..00000000000
--- a/mysql-test/t/ctype_ldml.test
+++ /dev/null
@@ -1,604 +0,0 @@
---source include/have_ucs2.inc
---source include/have_utf8mb4.inc
---source include/have_utf16.inc
---source include/have_utf32.inc
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
---echo In the following tests we change the order of letter "b"
---echo making it equal to letter "a", and check that it works
---echo with all Unicode character sets
-set names utf8;
-
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
-show variables like 'character_sets_dir%';
-
-show collation like 'utf8_phone_ci';
-CREATE TABLE t1 (
- name VARCHAR(64),
- phone VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_phone_ci
-);
-INSERT INTO t1 VALUES ('Svoj','+7 912 800 80 02');
-INSERT INTO t1 VALUES ('Hf','+7 (912) 800 80 04');
-INSERT INTO t1 VALUES ('Bar','+7-912-800-80-01');
-INSERT INTO t1 VALUES ('Ramil','(7912) 800 80 03');
-INSERT INTO t1 VALUES ('Sanja','+380 (912) 8008005');
-SELECT * FROM t1 ORDER BY phone;
-SELECT * FROM t1 WHERE phone='+7(912)800-80-01';
-SELECT * FROM t1 WHERE phone='79128008001';
-SELECT * FROM t1 WHERE phone='7 9 1 2 8 0 0 8 0 0 1';
-DROP TABLE t1;
-
-show collation like 'utf8_test_ci';
-create table t1 (c1 char(1) character set utf8 collate utf8_test_ci);
-insert into t1 values ('a');
-select * from t1 where c1='b';
-drop table t1;
-
-show collation like 'ucs2_test_ci';
-create table t1 (c1 char(1) character set ucs2 collate ucs2_test_ci);
-insert into t1 values ('a');
-select * from t1 where c1='b';
-drop table t1;
-
-show collation like 'utf8mb4_test_ci';
-create table t1 (c1 char(1) character set utf8mb4 collate utf8mb4_test_ci);
-insert into t1 values ('a');
-select * from t1 where c1='b';
-drop table t1;
-
-show collation like 'utf16_test_ci';
-create table t1 (c1 char(1) character set utf16 collate utf16_test_ci);
-insert into t1 values ('a');
-select * from t1 where c1='b';
-drop table t1;
-
-show collation like 'utf32_test_ci';
-create table t1 (c1 char(1) character set utf32 collate utf32_test_ci);
-insert into t1 values ('a');
-select * from t1 where c1='b';
-drop table t1;
-
-# make sure utf8_test_ci is Unicode-5.0.0
-SELECT hex(weight_string(_utf8mb4'a' collate utf8mb4_test_ci));
-SELECT hex(weight_string(convert(_utf32 0x10002 using utf8mb4) collate utf8mb4_test_ci));
-SELECT hex(@a:=convert(_utf32 0x10400 using utf8mb4) collate utf8mb4_test_ci), hex(lower(@a));
-SELECT hex(@a:=convert(_utf32 0x10428 using utf8mb4) collate utf8mb4_test_ci), hex(upper(@a));
-SELECT hex(@a:=convert(_utf32 0x2C00 using utf8mb4) collate utf8mb4_test_ci), hex(lower(@a));
-SELECT hex(@a:=convert(_utf32 0x2C30 using utf8mb4) collate utf8mb4_test_ci), hex(upper(@a));
-
-# check that it works with supplementary characters
-SELECT hex(weight_string(convert(_utf32 0x61 using utf8mb4) collate utf8mb4_test_ci));
-SELECT hex(weight_string(convert(_utf32 0x62 using utf8mb4) collate utf8mb4_test_ci));
-SELECT hex(weight_string(convert(_utf32 0x10062 using utf8mb4) collate utf8mb4_test_ci));
-SELECT hex(weight_string(convert(_utf32 0x10400 using utf8mb4) collate utf8mb4_test_ci));
-SELECT hex(weight_string(convert(_utf32 0x100400 using utf8mb4) collate utf8mb4_test_ci));
-
-# check contractions with non-ascii characters
-SELECT hex(weight_string(_utf8mb4 0x64 collate utf8mb4_test_ci));
-SELECT hex(weight_string(convert(_ucs2 0x0064017e using utf8mb4) collate utf8mb4_test_ci));
-SELECT hex(weight_string(convert(_ucs2 0x0044017e using utf8mb4) collate utf8mb4_test_ci));
-SELECT hex(weight_string(convert(_ucs2 0x0044017d using utf8mb4) collate utf8mb4_test_ci));
-
-
-#
-# Bug#41084 full-text index added to custom UCA collation not working
-#
-CREATE TABLE t1 (
- col1 varchar(100) character set utf8 collate utf8_test_ci
-);
-INSERT INTO t1 (col1) VALUES ('abcd'),('efgh'),('ijkl');
-ALTER TABLE t1 ADD FULLTEXT INDEX (col1);
-SELECT * FROM t1 where match (col1) against ('abcd');
-SELECT * FROM t1 where match (col1) against ('abcd' IN BOOLEAN MODE);
-ALTER TABLE t1 ADD (col2 varchar(100) character set latin1);
-UPDATE t1 SET col2=col1;
-SELECT * FROM t1 WHERE col1=col2 ORDER BY col1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#45645 Mysql server close all connection and restart using lower function
---echo #
-CREATE TABLE t1 (a VARCHAR(10)) CHARACTER SET utf8 COLLATE utf8_test_ci;
-INSERT INTO t1 (a) VALUES ('hello!');
-SELECT * FROM t1 WHERE LOWER(a)=LOWER('N');
-DROP TABLE t1;
-
---echo #
---echo # Bug#51976 LDML collations issue (cyrillic example)
---echo #
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_test_ci);
-INSERT INTO t1 (a) VALUES ('Hello');
-SELECT a, UPPER(a), LOWER(a) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#43827 Server closes connections and restarts
---echo #
-# Crash happened with a user-defined utf8 collation,
-# on attempt to insert a string longer than the column can store.
-CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_test_ci);
-INSERT IGNORE INTO t1 SELECT REPEAT('a',11);
-DROP TABLE t1;
-
-#
-# Vietnamese experimental collation
-#
---echo Vietnamese experimental collation
-
-show collation like 'ucs2_vn_ci';
-create table t1 (c1 char(1) character set ucs2 collate ucs2_vn_ci);
-insert into t1 values (0x0061),(0x0041),(0x00E0),(0x00C0),(0x1EA3),(0x1EA2),
- (0x00E3),(0x00C3),(0x00E1),(0x00C1),(0x1EA1),(0x1EA0);
-insert into t1 values (0x0103),(0x0102),(0x1EB1),(0x1EB0),(0x1EB3),(0x1EB2),
- (0x1EB5),(0x1EB4),(0x1EAF),(0x1EAE),(0x1EB7),(0x1EB6);
-insert into t1 values (0x00E2),(0x00C2),(0x1EA7),(0x1EA6),(0x1EA9),(0x1EA8),
- (0x1EAB),(0x1EAA),(0x1EA5),(0x1EA4),(0x1EAD),(0x1EAC);
-insert into t1 values ('b'),('B'),('c'),('C');
-insert into t1 values ('d'),('D'),(0x0111),(0x0110);
-insert into t1 values (0x0065),(0x0045),(0x00E8),(0x00C8),(0x1EBB),(0x1EBA),
- (0x1EBD),(0x1EBC),(0x00E9),(0x00C9),(0x1EB9),(0x1EB8);
-insert into t1 values (0x00EA),(0x00CA),(0x1EC1),(0x1EC0),(0x1EC3),(0x1EC2),
- (0x1EC5),(0x1EC4),(0x1EBF),(0x1EBE),(0x1EC7),(0x1EC6);
-insert into t1 values ('g'),('G'),('h'),('H');
-insert into t1 values (0x0069),(0x0049),(0x00EC),(0x00CC),(0x1EC9),(0x1EC8),
- (0x0129),(0x0128),(0x00ED),(0x00CD),(0x1ECB),(0x1ECA);
-insert into t1 values ('k'),('K'),('l'),('L'),('m'),('M');
-insert into t1 values (0x006F),(0x004F),(0x00F2),(0x00D2),(0x1ECF),(0x1ECE),
- (0x00F5),(0x00D5),(0x00F3),(0x00D3),(0x1ECD),(0x1ECC);
-insert into t1 values (0x00F4),(0x00D4),(0x1ED3),(0x1ED2),(0x1ED5),(0x1ED4),
- (0x1ED7),(0x1ED6),(0x1ED1),(0x1ED0),(0x1ED9),(0x1ED8);
-insert into t1 values (0x01A1),(0x01A0),(0x1EDD),(0x1EDC),(0x1EDF),(0x1EDE),
- (0x1EE1),(0x1EE0),(0x1EDB),(0x1EDA),(0x1EE3),(0x1EE2);
-insert into t1 values ('p'),('P'),('q'),('Q'),('r'),('R'),('s'),('S'),('t'),('T');
-insert into t1 values (0x0075),(0x0055),(0x00F9),(0x00D9),(0x1EE7),(0x1EE6),
- (0x0169),(0x0168),(0x00FA),(0x00DA),(0x1EE5),(0x1EE4);
-insert into t1 values (0x01B0),(0x01AF),(0x1EEB),(0x1EEA),(0x1EED),(0x1EEC),
- (0x1EEF),(0x1EEE),(0x1EE9),(0x1EE8),(0x1EF1),(0x1EF0);
-insert into t1 values ('v'),('V'),('x'),('X');
-insert into t1 values (0x0079),(0x0059),(0x1EF3),(0x1EF2),(0x1EF7),(0x1EF6),
- (0x1EF9),(0x1EF8),(0x00FD),(0x00DD),(0x1EF5),(0x1EF4);
-select hex(c1) as h, c1 from t1 order by c1, h;
-select group_concat(hex(c1) order by hex(c1)) from t1 group by c1;
-select group_concat(c1 order by hex(c1) SEPARATOR '') from t1 group by c1;
-drop table t1;
-
---echo Bug#46448 trailing spaces are not ignored when user collation maps space != 0x20
-set names latin1;
-show collation like 'latin1_test';
-select "foo" = "foo " collate latin1_test;
-
--- echo The following tests check that two-byte collation IDs work
-# The file ../std-data/Index.xml has a number of collations with high IDs.
-
-# Test that the "ID" column in I_S and SHOW queries can handle two bytes
-select * from information_schema.collations where id>256 and is_compiled<>'Yes' order by id;
-show collation like '%test%';
-
-# Test that two-byte collation ID is correctly transfered to the client side.
-show collation like 'ucs2_vn_ci';
-create table t1 (c1 char(1) character set ucs2 collate ucs2_vn_ci);
-insert into t1 values (0x0061);
---enable_metadata
-set @@character_set_results=NULL;
-select * from t1;
---disable_metadata
-drop table t1;
-
-#
-# Check maximum collation ID (2047 as of MySQL-6.0.9)
-#
-CREATE TABLE t1 (s1 char(10) character set utf8 collate utf8_maxuserid_ci);
-INSERT INTO t1 VALUES ('a'),('b');
-SELECT * FROM t1 WHERE s1='a' ORDER BY BINARY s1;
-DROP TABLE t1;
-
-
-#
-# Bug#47756 Setting 2byte collation ID with 'set names' crashes the server
-#
-SET NAMES utf8 COLLATE utf8_phone_ci;
-SHOW COLLATION LIKE 'utf8_phone_ci';
-SET NAMES utf8;
-
-# make sure utf8mb4_test_400_ci is Unicode-4.0.0 based
-SELECT hex(weight_string(_utf8mb4'a' collate utf8mb4_test_400_ci));
-SELECT hex(weight_string(convert(_utf32 0x10002 using utf8mb4) collate utf8mb4_test_400_ci));
-SELECT hex(@a:=convert(_utf32 0x10400 using utf8mb4) collate utf8mb4_test_400_ci), hex(lower(@a));
-SELECT hex(@a:=convert(_utf32 0x10428 using utf8mb4) collate utf8mb4_test_400_ci), hex(upper(@a));
-SELECT hex(@a:=convert(_utf32 0x2C00 using utf8mb4) collate utf8mb4_test_400_ci), hex(lower(@a));
-SELECT hex(@a:=convert(_utf32 0x2C30 using utf8mb4) collate utf8mb4_test_400_ci), hex(upper(@a));
-
---echo #
---echo # WL#5624 Collation customization improvements
---echo #
-SET NAMES utf8 COLLATE utf8_5624_1;
-CREATE TABLE t1 AS SELECT REPEAT(' ', 16) AS a LIMIT 0;
-# Part 1,2,3: long contractions and expansions
-# Part 7: Quarternary difference
-INSERT INTO t1 VALUES ('012345'),('001234'),('000123'),('000012'),('000001');
-INSERT INTO t1 VALUES ('12345'),('01234'),('00123'),('00012'),('00001');
-INSERT INTO t1 VALUES ('1234'),('0123'),('0012'),('0001');
-INSERT INTO t1 VALUES ('123'),('012'),('001');
-INSERT INTO t1 VALUES ('12'),('01');
-INSERT INTO t1 VALUES ('1'),('9');
-INSERT INTO t1 VALUES ('ГАИ'),('ГИБДД');
-# Part 4: reset before
-# Part 6: characters rather than escape sequences
-INSERT INTO t1 VALUES ('a'),('b'),('c'),('d'),('e');
-INSERT INTO t1 VALUES ('cz'),('Ċ'),('ċ');
-INSERT INTO t1 VALUES ('f'),('fz'),('g'),('Ġ'),('ġ');
-INSERT INTO t1 VALUES ('h'),('hz'),('GĦ'),('Għ'),('gĦ'),('għ');
-INSERT INTO t1 VALUES ('i'),('iz'),('Ħ'),('ħ');
-INSERT INTO t1 VALUES ('y'),('yz'),('z'),('Ż'),('ż');
-INSERT INTO t1 VALUES ('ā'),('Ā'),('á'),('Á'),('à'),('À');
-INSERT INTO t1 VALUES ('ē'),('é'),('ě'),('ê'),('Ē'),('É'),('Ě'),('Ê');
-# Part 8: Abbreviated shift syntax
-INSERT INTO t1 VALUES ('a'),('~'),('!'),('@'),('#'),('$'),('%'),('^');
-INSERT INTO t1 VALUES ('('),(')'),('-'),('+'),('|'),('='),(':'),(';');
-INSERT INTO t1 VALUES ('"'),('\''),('?');
-# Part 9: Normal expansion syntax
-INSERT INTO t1 VALUES ('ch'),('k'),('cs'),('ccs'),('cscs');
-# Part 10: Previous context
-INSERT INTO t1 VALUES ('aa-'),('ab-'),('ac-'),('ad-'),('ae-'),('af-'),('az-');
-# Part 12: Logical reset positions
-INSERT INTO t1 VALUES ('lp-fni'),('lp-lni');
-INSERT INTO t1 VALUES ('lp-fpi'),('lp-lpi');
-INSERT INTO t1 VALUES ('lp-fsi'),('lp-lsi');
-INSERT INTO t1 VALUES ('lp-fti'),('lp-lti');
-INSERT INTO t1 VALUES ('lp-ft'),('lp-lt');
-INSERT INTO t1 VALUES ('lp-fv'),('lp-lv');
-# Logical positions with reset before
-INSERT INTO t1 VALUES ('lb-fni'),('lb-lni');
-INSERT INTO t1 VALUES ('lb-fv'),('lb-lv');
-# Part 5: Long tailoring
-INSERT INTO t1 VALUES (_ucs2 0x3106),(_ucs2 0x3110), (_ucs2 0x3111), (_ucs2 0x3112);
-INSERT INTO t1 VALUES (_ucs2 0x32A3), (_ucs2 0x3231);
-INSERT INTO t1 VALUES (_ucs2 0x84D9), (_ucs2 0x98F5), (_ucs2 0x7CF3), (_ucs2 0x5497);
-SELECT a, HEX(WEIGHT_STRING(a)) FROM t1 ORDER BY a, LENGTH(a), BINARY a;
---echo #
---echo # WL#5624, the same test with UCS2
---echo #
-ALTER TABLE t1 CONVERT TO CHARACTER SET ucs2 COLLATE ucs2_5624_1;
-SELECT a, HEX(WEIGHT_STRING(a)) FROM t1 ORDER BY a, LENGTH(a), BINARY(a);
-DROP TABLE t1;
-
---echo #
---echo # WL#5624, unsupported features
---echo #
-# Part 13: More verbosity
---error ER_UNKNOWN_COLLATION
-SET NAMES utf8 COLLATE utf8_5624_2;
-SHOW WARNINGS;
-
---error ER_UNKNOWN_COLLATION
-SELECT _utf8'test' COLLATE utf8_5624_2;
-SHOW WARNINGS;
-
---echo #
---echo # WL#5624, reset before primary ignorable
---echo #
---error ER_UNKNOWN_COLLATION
-SET NAMES utf8 COLLATE utf8_5624_3;
-SHOW WARNINGS;
-
---echo #
---echo # WL#5624, \u without hex digits is equal to {'\\', 'u'}
---echo #
-SET NAMES utf8 COLLATE utf8_5624_4;
-CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0;
-INSERT INTO t1 VALUES ('\\'),('u'),('x'),('X');
-SELECT a, HEX(WEIGHT_STRING(a)) FROM t1 ORDER BY a, LENGTH(a), BINARY(a);
-DROP TABLE t1;
-
---echo #
---echo # WL#5624, testing Bengali collations
---echo #
-SET NAMES utf8, collation_connection=utf8_bengali_standard_ci;
-CREATE TABLE t1 AS SELECT REPEAT (' ', 10) AS a LIMIT 0;
-INSERT INTO t1 VALUES (_ucs2 0x09FA), (_ucs2 0x09F8), (_ucs2 0x09F9), (_ucs2 0x09F2);
-INSERT INTO t1 VALUES (_ucs2 0x09DC), (_ucs2 0x09A109BC);
-INSERT INTO t1 VALUES (_ucs2 0x09A2), (_ucs2 0x09DD), (_ucs2 0x09A209BC);
-INSERT INTO t1 VALUES (_ucs2 0x09A3);
-SELECT HEX(WEIGHT_STRING(a)), HEX(CONVERT(a USING ucs2)), HEX(a)
-FROM t1 ORDER BY a, BINARY a;
-DROP TABLE t1;
-
-SET NAMES utf8, collation_connection=utf8_bengali_traditional_ci;
-CREATE TABLE t1 AS SELECT REPEAT (' ', 10) AS a LIMIT 0;
-INSERT INTO t1 VALUES
-(_ucs2 0x0985),(_ucs2 0x0986),(_ucs2 0x0987),(_ucs2 0x0988),
-(_ucs2 0x0989),(_ucs2 0x098A),(_ucs2 0x098B),(_ucs2 0x09E0),
-(_ucs2 0x098C),(_ucs2 0x09E1),(_ucs2 0x098F),(_ucs2 0x0990),
-(_ucs2 0x0993);
-
-INSERT INTO t1 VALUES
-(_ucs2 0x0994),(_ucs2 0x0982),(_ucs2 0x0983),(_ucs2 0x0981),
-(_ucs2 0x099509CD), (_ucs2 0x099609CD), (_ucs2 0x099709CD), (_ucs2 0x099809CD),
-(_ucs2 0x099909CD), (_ucs2 0x099A09CD), (_ucs2 0x099B09CD), (_ucs2 0x099C09CD),
-(_ucs2 0x099D09CD), (_ucs2 0x099E09CD), (_ucs2 0x099F09CD), (_ucs2 0x09A009CD),
-(_ucs2 0x09A109CD), (_ucs2 0x09A209CD), (_ucs2 0x09A309CD),
-(_ucs2 0x09CE), (_ucs2 0x09A409CD200D), (_ucs2 0x09A409CD),
-(_ucs2 0x09A509CD),(_ucs2 0x09A609CD),
-(_ucs2 0x09A709CD), (_ucs2 0x09A809CD), (_ucs2 0x09AA09CD), (_ucs2 0x09AB09CD),
-(_ucs2 0x09AC09CD), (_ucs2 0x09AD09CD), (_ucs2 0x09AE09CD), (_ucs2 0x09AF09CD),
-(_ucs2 0x09B009CD), (_ucs2 0x09F009CD), (_ucs2 0x09B209CD), (_ucs2 0x09F109CD),
-(_ucs2 0x09B609CD), (_ucs2 0x09B709CD), (_ucs2 0x09B809CD), (_ucs2 0x09B909CD);
-
-INSERT INTO t1 VALUES
- (_ucs2 0x099509CD0985),(_ucs2 0x0995),
- (_ucs2 0x099509CD0986),(_ucs2 0x099509BE),
- (_ucs2 0x099509CD0987),(_ucs2 0x099509BF),
- (_ucs2 0x099509CD0988),(_ucs2 0x099509C0),
- (_ucs2 0x099509CD0989),(_ucs2 0x099509C1),
- (_ucs2 0x099509CD098A),(_ucs2 0x099509C2),
- (_ucs2 0x099509CD098B),(_ucs2 0x099509C3),
- (_ucs2 0x099509CD09E0),(_ucs2 0x099509C4),
- (_ucs2 0x099509CD098C),(_ucs2 0x099509E2),
- (_ucs2 0x099509CD09E1),(_ucs2 0x099509E3),
- (_ucs2 0x099509CD098F),(_ucs2 0x099509C7),
- (_ucs2 0x099509CD0990),(_ucs2 0x099509C8),
- (_ucs2 0x099509CD0993),(_ucs2 0x099509CB),
- (_ucs2 0x099509CD0994),(_ucs2 0x099509CC);
-
-SELECT HEX(WEIGHT_STRING(a)), HEX(CONVERT(a USING ucs2)), HEX(a)
-FROM t1 ORDER BY a, BINARY(a);
-SELECT HEX(WEIGHT_STRING(a)) as wa,
-GROUP_CONCAT(HEX(CONVERT(a USING ucs2)) ORDER BY LENGTH(a), BINARY a)
-FROM t1 GROUP BY a ORDER BY a;
-DROP TABLE t1;
-
---echo #
---echo # WL#5624, shift after, using expansion
---echo #
-SET NAMES utf8 COLLATE utf8_5624_5;
-CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0;
-INSERT INTO t1 VALUES ('0'),('1'),('0z'),(_ucs2 0x0030FF9D);
-INSERT INTO t1 VALUES ('a'),('b'),('c'),('d'),('e'),('f'),('g'),('h'),('i');
-INSERT INTO t1 VALUES ('j'),('k'),('l'),('m'),('n'),('o'),('p'),('q'),('r');
-INSERT INTO t1 VALUES ('s'),('t'),('u'),('v'),('w'),('x'),('y'),('z');
-INSERT INTO t1 VALUES ('aa'),('aaa');
-INSERT INTO t1 VALUES ('A'),('B'),('C'),('D'),('E'),('F'),('G'),('H'),('I');
-INSERT INTO t1 VALUES ('J'),('K'),('L'),('M'),('N'),('O'),('P'),('Q'),('R');
-INSERT INTO t1 VALUES ('S'),('T'),('U'),('V'),('W'),('X'),('Y'),('Z');
-INSERT INTO t1 VALUES ('AA'),('AAA');
-INSERT INTO t1 VALUES ('001'),('002');
-
-SELECT a, HEX(WEIGHT_STRING(a)) FROM t1 ORDER BY a, LENGTH(a), BINARY(a);
-DROP TABLE t1;
-
---error ER_UNKNOWN_COLLATION
-SET NAMES utf8 COLLATE utf8_5624_5_bad;
-SHOW WARNINGS;
-
---echo #
---echo # End of WL#5624
---echo #
-
-
---echo #
---echo # Bug#14197426 PARSE ERRORS IN LOADABLE UCA / LDML COLLATIONS ARE SILENTLY IGNORED
---echo #
-
---let $out_file= $MYSQLTEST_VARDIR/tmp/ctype_ldml_log.err
---let OUTF= $out_file
-# Error messages are not seen in error log in embedded version
---let EMBEDDED=`SELECT IF(version() LIKE '%embedded%',2,0)`
---echo # Search for occurrences of [ERROR] Syntax error at '[strength tertiary]'
-
-perl;
- use strict;
- my $outf= $ENV{'OUTF'} or die "OUTF not set";
- open(FILE, "$outf") or die("Unable to open $outf: $!\n");
- my $count_error= grep(/\[ERROR\] Syntax error at '\[strength tertiary\]'/gi,<FILE>);
- my $count_error= $count_error + $ENV{"EMBEDDED"};
- print "Occurances : $count_error\n";
- close(FILE);
-EOF
-
-
---echo #
---echo # MDEV-8686 A user defined collation utf8_confusables doesn't work
---echo #
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_implicit_weights_ci);
-INSERT INTO t1 VALUES ('a'),('b'),('c');
-INSERT INTO t1 VALUES (_ucs2 0x1500),(_ucs2 0x1501);
-INSERT INTO t1 VALUES (_ucs2 0x3400),(_ucs2 0x3560),(_ucs2 0x3561),(_ucs2 0x3600);
-INSERT INTO t1 VALUES (_ucs2 0x3700),(_ucs2 0x3701);
-SELECT HEX(CONVERT(a USING ucs2)) AS ch, HEX(WEIGHT_STRING(a)) AS w, HEX(WEIGHT_STRING(a COLLATE utf8_unicode_ci)) AS ducet FROM t1 ORDER BY a,ch;
-DROP TABLE t1;
-
-
---echo #
---echo # Testing that the MY_CS_PUREASCII flag is set properly
---echo # Comparison between ascii2 and latin1 should not give "illegal collation error"
---echo #
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ascii2, b VARCHAR(10) CHARACTER SET latin1);
-INSERT INTO t1 VALUES ('a','a'),('b','b');
-SELECT * FROM t1 WHERE a=b;
-ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET ascii2 COLLATE ascii2_bin2;
-SELECT * FROM t1 WHERE a=b;
-ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET ascii2 COLLATE ascii2_bin;
-SELECT * FROM t1 WHERE a=b;
-ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET ascii2 COLLATE ascii2_general_inherited_ci;
-SELECT * FROM t1 WHERE a=b;
-ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET ascii2 COLLATE ascii2_general_inherited2_ci;
-SELECT * FROM t1 WHERE a=b;
-DROP TABLE t1;
-
---echo #
---echo # Testing that in case of two binary collations
---echo # "BINARY" in a column definition uses the collation with the least id
---echo #
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ascii2 BINARY);
-INSERT INTO t1 VALUES ('test');
-SELECT COLLATION(a) FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # Testing mixing of two binary collations of the same character set
---echo #
-CREATE TABLE t1 (
- a VARCHAR(10) CHARACTER SET ascii2 COLLATE ascii2_bin,
- b VARCHAR(10) CHARACTER SET ascii2 COLLATE ascii2_bin2
-);
-INSERT INTO t1 VALUES ('a','a');
---error ER_CANT_AGGREGATE_2COLLATIONS
-SELECT * FROM t1 WHERE a=b;
-DROP TABLE t1;
-
---echo #
---echo # Testing bad collation inheritance
---echo #
---error ER_UNKNOWN_COLLATION
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ascii2 COLLATE ascii2_badly_inherited_ci);
-
---echo #
---echo # Testing that the MY_CS_CSSORT flag is set properly
---echo #
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_test);
-INSERT INTO t1 VALUES ('a'),('A');
-# should be case insensitive
-SELECT * FROM t1 WHERE a RLIKE 'a';
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_test2_cs);
-INSERT INTO t1 VALUES ('a'),('A');
- # should be case sensitive
-SELECT * FROM t1 WHERE a RLIKE 'a';
-DROP TABLE t1;
-
---echo #
---echo # MDEV-9711 NO PAD collations
---echo #
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ascii2 COLLATE ascii2_general_nopad_ci);
-INSERT INTO t1 VALUES ('a'),('a '),('A'),('A ');
-SELECT a, a='a', a='a ', HEX(a), LOWER(a), UPPER(a), CONVERT(a USING utf8) FROM t1;
-ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET ascii2 COLLATE ascii2_nopad_bin;
-SELECT a, a='a', a='a ', HEX(a), LOWER(a), UPPER(a), CONVERT(a USING utf8) FROM t1;
-ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_swedish_nopad2_ci;
-SELECT a, a='a', a='a ', HEX(a), LOWER(a), UPPER(a), CONVERT(a USING utf8) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-10877 xxx_unicode_nopad_ci collations
---echo #
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_test_520_nopad_ci);
-INSERT INTO t1 VALUES ('a'),('b'),('a '),('b ');
-SELECT
- HEX(a),
- WEIGHT_STRING(a)=WEIGHT_STRING(a COLLATE utf8mb4_unicode_ci) AS is_400,
- WEIGHT_STRING(a)=WEIGHT_STRING(a COLLATE utf8mb4_unicode_520_ci) AS is_520
-FROM t1
-ORDER BY a;
-SELECT COUNT(DISTINCT a) FROM t1;
-SELECT HEX(a), REPLACE(a,' ','<SP>') FROM t1 WHERE a='a';
-SELECT HEX(a), REPLACE(a,' ','<SP>') FROM t1 ORDER BY a;
-SELECT HEX(a), REPLACE(a,' ','<SP>') FROM t1 ORDER BY a DESC;
-DROP TABLE t1;
-
-
-SET NAMES utf8 COLLATE utf8_czech_test_w2;
-CREATE TABLE t1 AS SELECT SPACE(10) AS c1 LIMIT 0;
---source include/ctype_unicode_latin.inc
-INSERT INTO t1 VALUES ('a ');
-SELECT c1, HEX(WEIGHT_STRING(c1 LEVEL 1)), HEX(WEIGHT_STRING(c1 LEVEL 2)) FROM t1 ORDER BY c1, BINARY c1;
-SELECT c1, HEX(WEIGHT_STRING(c1 AS CHAR(3) LEVEL 1)), HEX(WEIGHT_STRING(c1 AS CHAR(3) LEVEL 2)) FROM t1 WHERE c1 BETWEEN 'a' AND 'aZ' ORDER BY c1, BINARY c1;
-DROP TABLE t1;
-
-SELECT 'a' = 'a ';
-SELECT 'a' < 'á';
-SELECT 'áa' < 'ab';
-SELECT 'á' < 'ä';
-SELECT 'äa' < 'áb';
-SELECT 'c' < 'č';
-SELECT 'cb' < 'ča';
-SELECT 'd' < 'ď';
-SELECT 'ďa' < 'db';
-SELECT 'e' < 'é';
-SELECT 'éa' < 'eb';
-SELECT 'é' < 'ě';
-SELECT 'ěa' < 'éb';
-SELECT 'i' < 'í';
-SELECT 'ía' < 'ib';
-SELECT 'n' < 'ň';
-SELECT 'ňa' < 'nb';
-SELECT 'o' < 'ó';
-SELECT 'óa' < 'ob';
-SELECT 'ó' < 'ö';
-SELECT 'öa' < 'ób';
-SELECT 'r' < 'ř';
-SELECT 'rb' < 'řa';
-SELECT 's' < 'š';
-SELECT 'sb' < 'ša';
-SELECT 't' < 'ť';
-SELECT 'ťa' < 'tb';
-SELECT 'u' < 'ú';
-SELECT 'úa' < 'ub';
-SELECT 'ú' < 'ů';
-SELECT 'ůa' < 'úb';
-SELECT 'ů' < 'ü';
-SELECT 'üa' < 'ůb';
-SELECT 'y' < 'ý';
-SELECT 'ýa' < 'yb';
-SELECT 'z' < 'ž';
-SELECT 'zb' < 'ža';
-SELECT 'hž' < 'ch';
-SELECT 'chž'< 'i';
-
-
-
-SET NAMES utf8 COLLATE utf8_czech_test_nopad_w2;
-CREATE TABLE t1 AS SELECT SPACE(10) AS c1 LIMIT 0;
---source include/ctype_unicode_latin.inc
-INSERT INTO t1 VALUES ('a ');
-SELECT c1, HEX(WEIGHT_STRING(c1 LEVEL 1)), HEX(WEIGHT_STRING(c1 LEVEL 2)) FROM t1 ORDER BY c1, BINARY c1;
-SELECT c1, HEX(WEIGHT_STRING(c1 AS CHAR(3) LEVEL 1)), HEX(WEIGHT_STRING(c1 AS CHAR(3) LEVEL 2)) FROM t1 WHERE c1 BETWEEN 'a' AND 'aZ' ORDER BY c1, BINARY c1;
-DROP TABLE t1;
-
-SELECT 'a' = 'a ';
-SELECT 'a' < 'á';
-SELECT 'áa' < 'ab';
-SELECT 'á' < 'ä';
-SELECT 'äa' < 'áb';
-SELECT 'c' < 'č';
-SELECT 'cb' < 'ča';
-SELECT 'd' < 'ď';
-SELECT 'ďa' < 'db';
-SELECT 'e' < 'é';
-SELECT 'éa' < 'eb';
-SELECT 'é' < 'ě';
-SELECT 'ěa' < 'éb';
-SELECT 'i' < 'í';
-SELECT 'ía' < 'ib';
-SELECT 'n' < 'ň';
-SELECT 'ňa' < 'nb';
-SELECT 'o' < 'ó';
-SELECT 'óa' < 'ob';
-SELECT 'ó' < 'ö';
-SELECT 'öa' < 'ób';
-SELECT 'r' < 'ř';
-SELECT 'rb' < 'řa';
-SELECT 's' < 'š';
-SELECT 'sb' < 'ša';
-SELECT 't' < 'ť';
-SELECT 'ťa' < 'tb';
-SELECT 'u' < 'ú';
-SELECT 'úa' < 'ub';
-SELECT 'ú' < 'ů';
-SELECT 'ůa' < 'úb';
-SELECT 'ů' < 'ü';
-SELECT 'üa' < 'ůb';
-SELECT 'y' < 'ý';
-SELECT 'ýa' < 'yb';
-SELECT 'z' < 'ž';
-SELECT 'zb' < 'ža';
-SELECT 'hž' < 'ch';
-SELECT 'chž'< 'i';
-
-
---error ER_UNKNOWN_COLLATION
-SELECT 'a' COLLATE utf8_czech_test_bad_w2;
diff --git a/mysql-test/t/ctype_like_range.test b/mysql-test/t/ctype_like_range.test
deleted file mode 100644
index 3055abe5f59..00000000000
--- a/mysql-test/t/ctype_like_range.test
+++ /dev/null
@@ -1,199 +0,0 @@
---source include/have_debug.inc
---source include/have_ucs2.inc
---source include/have_utf16.inc
---source include/have_utf32.inc
---source include/have_utf8mb4.inc
-
-SET NAMES utf8;
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP VIEW IF EXISTS v1;
---enable_warnings
-
-CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, a VARBINARY(32));
-INSERT INTO t1 (a) VALUES (''),('_'),('%'),('\_'),('\%'),('\\');
-INSERT INTO t1 (a) VALUES ('a'),('c');
-INSERT INTO t1 (a) VALUES ('a_'),('c_');
-INSERT INTO t1 (a) VALUES ('a%'),('c%');
-INSERT INTO t1 (a) VALUES ('aa'),('cc'),('ch');
-INSERT INTO t1 (a) VALUES ('aa_'),('cc_'),('ch_');
-INSERT INTO t1 (a) VALUES ('aa%'),('cc%'),('ch%');
-INSERT INTO t1 (a) VALUES ('aaa'),('ccc'),('cch');
-INSERT INTO t1 (a) VALUES ('aaa_'),('ccc_'),('cch_');
-INSERT INTO t1 (a) VALUES ('aaa%'),('ccc%'),('cch%');
-INSERT INTO t1 (a) VALUES ('aaaaaaaaaaaaaaaaaaaa');
-INSERT INTO t1 (a) VALUES ('caaaaaaaaaaaaaaaaaaa');
-
-CREATE VIEW v1 AS
- SELECT id, 'a' AS name, a AS val FROM t1
-UNION
- SELECT id, 'mn', HEX(LIKE_RANGE_MIN(a, 16)) AS min FROM t1
-UNION
- SELECT id, 'mx', HEX(LIKE_RANGE_MAX(a, 16)) AS max FROM t1
-UNION
- SELECT id, 'sp', REPEAT('-', 32) AS sep FROM t1
-ORDER BY id, name;
-SELECT * FROM v1;
-
-ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET latin1;
-SELECT * FROM v1;
-
-ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf8;
-INSERT INTO t1 (a) VALUES (_ucs2 0x0425),(_ucs2 0x045F);
-INSERT INTO t1 (a) VALUES (_ucs2 0x2525),(_ucs2 0x5F5F);
-SELECT * FROM v1;
-
-ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_unicode_ci;
-SELECT * FROM v1;
-
-ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_czech_ci;
-SELECT * FROM v1;
-
-# Note, 16 bytes is enough for 16/3= 5 characters
-# For the 'aaaaaaaa' value contraction breaks apart
-# For the 'caaaaaaa' value contraction does not break apart
-ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_danish_ci;
-SELECT * FROM v1;
-
-ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_thai_520_w2;
-SELECT * FROM v1;
-
-ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf8mb4;
-SELECT * FROM v1;
-
-ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-SELECT * FROM v1;
-
-ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_czech_ci;
-SELECT * FROM v1;
-
-# Note, 16 bytes is enough for 16/4= 4 characters
-# For the 'aaaaaaaa' value contraction does not break apart
-# For the 'caaaaaaa' value contraction breaks apart
-ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_danish_ci;
-SELECT * FROM v1;
-
-ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_thai_520_w2;
-SELECT * FROM v1;
-
-ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;
-SELECT * FROM v1;
-
-ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET ucs2;
-SELECT * FROM v1;
-
-ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci;
-SELECT * FROM v1;
-
-ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_czech_ci;
-SELECT * FROM v1;
-
-ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_danish_ci;
-SELECT * FROM v1;
-
-ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_thai_520_w2;
-SELECT * FROM v1;
-
-ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf16;
-SELECT * FROM v1;
-
-ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf16 COLLATE utf16_unicode_ci;
-SELECT * FROM v1;
-
-ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf16 COLLATE utf16_czech_ci;
-SELECT * FROM v1;
-
-# Note, 16 bytes is enough for 16/3= 5 characters
-# For the 'aaaaaaaa' value contraction does not break apart
-# For the 'caaaaaaa' value contraction breaks apart
-ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf16 COLLATE utf16_danish_ci;
-SELECT * FROM v1;
-
-ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf16 COLLATE utf16_thai_520_w2;
-SELECT * FROM v1;
-
-ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf16 COLLATE utf16_unicode_520_ci;
-SELECT * FROM v1;
-
-ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf32;
-SELECT * FROM v1;
-
-ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf32 COLLATE utf32_unicode_ci;
-SELECT * FROM v1;
-
-ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf32 COLLATE utf32_czech_ci;
-SELECT * FROM v1;
-
-ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf32 COLLATE utf32_danish_ci;
-SELECT * FROM v1;
-
-ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf32 COLLATE utf32_thai_520_w2;
-SELECT * FROM v1;
-
-ALTER TABLE t1 MODIFY a VARCHAR(32) CHARACTER SET utf32 COLLATE utf32_unicode_520_ci;
-SELECT * FROM v1;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-10134 Add full support for DEFAULT
---echo #
-CREATE TABLE t1 (
- a VARCHAR(10),
- mn VARCHAR(10) DEFAULT LIKE_RANGE_MIN(a,10),
- mx VARCHAR(10) DEFAULT LIKE_RANGE_MAX(a,10)
-);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('a'),('a_'),('a%');
-SELECT a, HEX(mn), HEX(mx) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-14350 Index use with collation utf8mb4_unicode_nopad_ci on LIKE pattern with wrong results
---echo #
-
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_swedish_nopad_ci);
-INSERT INTO t1 VALUES ('111%');
-SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_general_nopad_ci);
-INSERT INTO t1 VALUES ('111%');
-SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_unicode_nopad_ci);
-INSERT INTO t1 VALUES ('111%');
-SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_nopad_ci);
-INSERT INTO t1 VALUES ('111%');
-SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ucs2 COLLATE ucs2_unicode_nopad_ci);
-INSERT INTO t1 VALUES ('111%');
-SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf16 COLLATE utf16_unicode_nopad_ci);
-INSERT INTO t1 VALUES ('111%');
-SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf32 COLLATE utf32_unicode_nopad_ci);
-INSERT INTO t1 VALUES ('111%');
-SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/ctype_many.test b/mysql-test/t/ctype_many.test
deleted file mode 100644
index a619b16416c..00000000000
--- a/mysql-test/t/ctype_many.test
+++ /dev/null
@@ -1,353 +0,0 @@
--- source include/have_ucs2.inc
--- source include/have_utf8mb4.inc
--- source include/have_utf16.inc
--- source include/have_utf32.inc
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-SET CHARACTER SET latin1;
-
-CREATE TABLE t1 (
- comment CHAR(32) ASCII NOT NULL,
- koi8_ru_f CHAR(32) CHARACTER SET koi8r NOT NULL default ''
-) CHARSET=latin5;
-
-SHOW CREATE TABLE t1;
-ALTER TABLE t1 CHANGE comment comment CHAR(32) CHARACTER SET latin2 NOT NULL;
-SHOW CREATE TABLE t1;
-ALTER TABLE t1 ADD latin5_f CHAR(32) NOT NULL;
-SHOW CREATE TABLE t1;
-ALTER TABLE t1 DEFAULT CHARSET=latin2;
-ALTER TABLE t1 ADD latin2_f CHAR(32) NOT NULL;
-SHOW CREATE TABLE t1;
-ALTER TABLE t1 DROP latin2_f, DROP latin5_f;
-SHOW CREATE TABLE t1;
-
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('a','LAT SMALL A');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('b','LAT SMALL B');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('c','LAT SMALL C');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('d','LAT SMALL D');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('e','LAT SMALL E');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('f','LAT SMALL F');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('g','LAT SMALL G');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('h','LAT SMALL H');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('i','LAT SMALL I');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('j','LAT SMALL J');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('k','LAT SMALL K');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('l','LAT SMALL L');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('m','LAT SMALL M');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('n','LAT SMALL N');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('o','LAT SMALL O');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('p','LAT SMALL P');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('q','LAT SMALL Q');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('r','LAT SMALL R');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('s','LAT SMALL S');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('t','LAT SMALL T');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('u','LAT SMALL U');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('v','LAT SMALL V');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('w','LAT SMALL W');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('x','LAT SMALL X');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('y','LAT SMALL Y');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('z','LAT SMALL Z');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('A','LAT CAPIT A');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('B','LAT CAPIT B');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('C','LAT CAPIT C');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('D','LAT CAPIT D');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('E','LAT CAPIT E');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('F','LAT CAPIT F');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('G','LAT CAPIT G');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('H','LAT CAPIT H');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('I','LAT CAPIT I');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('J','LAT CAPIT J');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('K','LAT CAPIT K');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('L','LAT CAPIT L');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('M','LAT CAPIT M');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('N','LAT CAPIT N');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('O','LAT CAPIT O');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('P','LAT CAPIT P');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Q','LAT CAPIT Q');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('R','LAT CAPIT R');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('S','LAT CAPIT S');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('T','LAT CAPIT T');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('U','LAT CAPIT U');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('V','LAT CAPIT V');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('W','LAT CAPIT W');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('X','LAT CAPIT X');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Y','LAT CAPIT Y');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Z','LAT CAPIT Z');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL A');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL BE');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL VE');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL GE');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL DE');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL IE');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL IO');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL ZHE');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL ZE');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL I');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL KA');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL EL');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL EM');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL EN');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL O');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL PE');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL ER');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL ES');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL TE');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL U');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL EF');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL HA');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL TSE');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL CHE');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL SHA');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL SCHA');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL HARD SIGN');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL YERU');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL SOFT SIGN');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL E');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL YU');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR SMALL YA');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT A');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT BE');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT VE');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT GE');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT DE');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT IE');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT IO');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT ZHE');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT ZE');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT I');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT KA');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT EL');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT EM');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT EN');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT O');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT PE');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT ER');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT ES');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT TE');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT U');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT EF');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT HA');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT TSE');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT CHE');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT SHA');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT SCHA');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT HARD SIGN');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT YERU');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT SOFT SIGN');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT E');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT YU');
-INSERT INTO t1 (koi8_ru_f,comment) VALUES (_koi8r'','CYR CAPIT YA');
-
-SET CHARACTER SET utf8;
-SELECT koi8_ru_f,MIN(comment),COUNT(*) FROM t1 GROUP BY 1;
-
-ALTER TABLE t1 ADD utf8_f CHAR(32) CHARACTER SET utf8 NOT NULL default '';
-UPDATE t1 SET utf8_f=CONVERT(koi8_ru_f USING utf8);
-SET CHARACTER SET koi8r;
-SELECT * FROM t1;
-
-
-ALTER TABLE t1 ADD bin_f CHAR(1) BYTE NOT NULL default '';
-UPDATE t1 SET bin_f=koi8_ru_f;
-SELECT COUNT(DISTINCT bin_f),COUNT(DISTINCT koi8_ru_f),COUNT(DISTINCT utf8_f) FROM t1;
-
-SELECT koi8_ru_f,MIN(comment) FROM t1 GROUP BY 1;
-SELECT utf8_f,MIN(comment) FROM t1 GROUP BY 1;
-SELECT DISTINCT koi8_ru_f FROM t1;
-SELECT DISTINCT utf8_f FROM t1;
-SELECT lower(koi8_ru_f) FROM t1 ORDER BY 1 DESC;
-SELECT lower(utf8_f) FROM t1 ORDER BY 1 DESC;
-
-SELECT t11.comment,t12.comment
-FROM t1 t11,t1 t12 WHERE CONVERT(t11.koi8_ru_f USING utf8)=t12.utf8_f
-ORDER BY t11.koi8_ru_f,t11.comment,t12.comment;
-
-SELECT t11.comment,t12.comment
-FROM t1 t11,t1 t12
-WHERE t11.koi8_ru_f=CONVERT(t12.utf8_f USING koi8r)
-ORDER BY t12.utf8_f,t11.comment,t12.comment;
-
-SET CHARACTER SET utf8;
-ALTER TABLE t1 ADD ucs2_f CHAR(32) CHARACTER SET ucs2;
-
---disable_warnings
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-ALTER TABLE t1 CHANGE ucs2_f ucs2_f CHAR(32) UNICODE NOT NULL;
---enable_warnings
-
-INSERT INTO t1 (ucs2_f,comment) VALUES (0x0391,'GREEK CAPIT ALPHA');
-INSERT INTO t1 (ucs2_f,comment) VALUES (0x0392,'GREEK CAPIT BETA');
-INSERT INTO t1 (ucs2_f,comment) VALUES (0x0393,'GREEK CAPIT GAMMA');
-INSERT INTO t1 (ucs2_f,comment) VALUES (0x0394,'GREEK CAPIT DELTA');
-INSERT INTO t1 (ucs2_f,comment) VALUES (0x0395,'GREEK CAPIT EPSILON');
-INSERT INTO t1 (ucs2_f,comment) VALUES (0x03B1,'GREEK SMALL ALPHA');
-INSERT INTO t1 (ucs2_f,comment) VALUES (0x03B2,'GREEK SMALL BETA');
-INSERT INTO t1 (ucs2_f,comment) VALUES (0x03B3,'GREEK SMALL GAMMA');
-INSERT INTO t1 (ucs2_f,comment) VALUES (0x03B4,'GREEK SMALL DELTA');
-INSERT INTO t1 (ucs2_f,comment) VALUES (0x03B5,'GREEK SMALL EPSILON');
-INSERT INTO t1 (ucs2_f,comment) VALUES (0x0531,'ARMENIAN CAPIT AYB');
-INSERT INTO t1 (ucs2_f,comment) VALUES (0x0532,'ARMENIAN CAPIT BEN');
-INSERT INTO t1 (ucs2_f,comment) VALUES (0x0533,'ARMENIAN CAPIT GIM');
-INSERT INTO t1 (ucs2_f,comment) VALUES (0x0534,'ARMENIAN CAPIT DA');
-INSERT INTO t1 (ucs2_f,comment) VALUES (0x0535,'ARMENIAN CAPIT ECH');
-INSERT INTO t1 (ucs2_f,comment) VALUES (0x0536,'ARMENIAN CAPIT ZA');
-INSERT INTO t1 (ucs2_f,comment) VALUES (0x0561,'ARMENIAN SMALL YAB');
-INSERT INTO t1 (ucs2_f,comment) VALUES (0x0562,'ARMENIAN SMALL BEN');
-INSERT INTO t1 (ucs2_f,comment) VALUES (0x0563,'ARMENIAN SMALL GIM');
-INSERT INTO t1 (ucs2_f,comment) VALUES (0x0564,'ARMENIAN SMALL DA');
-INSERT INTO t1 (ucs2_f,comment) VALUES (0x0565,'ARMENIAN SMALL ECH');
-INSERT INTO t1 (ucs2_f,comment) VALUES (0x0566,'ARMENIAN SMALL ZA');
-
-ALTER TABLE t1 ADD armscii8_f CHAR(32) CHARACTER SET armscii8 NOT NULL;
-ALTER TABLE t1 ADD greek_f CHAR(32) CHARACTER SET greek NOT NULL;
-UPDATE t1 SET greek_f=CONVERT(ucs2_f USING greek) WHERE comment LIKE _latin2'GRE%';
-UPDATE t1 SET armscii8_f=CONVERT(ucs2_f USING armscii8) WHERE comment LIKE _latin2'ARM%';
-UPDATE t1 SET utf8_f=CONVERT(ucs2_f USING utf8) WHERE utf8_f=_utf8'';
-UPDATE t1 SET ucs2_f=CONVERT(utf8_f USING ucs2) WHERE ucs2_f=_ucs2'';
-SELECT comment, koi8_ru_f, utf8_f, hex(bin_f), ucs2_f, armscii8_f, greek_f FROM t1;
-SET CHARACTER SET 'binary';
-SELECT * FROM t1;
-SELECT min(comment),count(*) FROM t1 GROUP BY ucs2_f;
-DROP TABLE t1;
-
-# End of 4.1 tests
-
-
---echo #
---echo # Start of 5.1 tests
---echo #
-
---echo #
---echo # Bug#58371 Assertion failed: !s.uses_buffer_owned_by(this) with format string function
---echo #
-
-SET NAMES latin1;
-DO CONVERT(CAST(SUBSTRING_INDEX(FORMAT(1,'1111'), FORMAT('','Zpq'),1)
- AS BINARY(0)) USING utf8);
---echo #
---echo # End of 5.1 tests
---echo #
-
---echo #
---echo # Start of 5.5 tests
---echo #
-
---echo #
---echo # WL#1213 Implement 4-byte UTF8, UTF16 and UTF32
---echo # Testing that only utf8mb4 is superset for utf8
---echo # No other Unicode character set pairs have superset/subset relations
---echo #
-
-CREATE TABLE t1 (
- utf8 CHAR CHARACTER SET utf8,
- utf8mb4 CHAR CHARACTER SET utf8mb4,
- ucs2 CHAR CHARACTER SET ucs2,
- utf16 CHAR CHARACTER SET utf16,
- utf32 CHAR CHARACTER SET utf32
-);
-INSERT INTO t1 VALUES ('','','','','');
-
-# utf8mb4 is superset only for utf8
-SELECT CHARSET(CONCAT(utf8, utf8mb4)) FROM t1;
---error ER_CANT_AGGREGATE_2COLLATIONS
-SELECT CHARSET(CONCAT(utf8, ucs2)) FROM t1;
---error ER_CANT_AGGREGATE_2COLLATIONS
-SELECT CHARSET(CONCAT(utf8, utf16)) FROM t1;
---error ER_CANT_AGGREGATE_2COLLATIONS
-SELECT CHARSET(CONCAT(utf8, utf32)) FROM t1;
-
-
-# utf8mb4 is superset only for utf8
-SELECT CHARSET(CONCAT(utf8mb4, utf8)) FROM t1;
---error ER_CANT_AGGREGATE_2COLLATIONS
-SELECT CHARSET(CONCAT(utf8mb4, ucs2)) FROM t1;
---error ER_CANT_AGGREGATE_2COLLATIONS
-SELECT CHARSET(CONCAT(utf8mb4, utf16)) FROM t1;
---error ER_CANT_AGGREGATE_2COLLATIONS
-SELECT CHARSET(CONCAT(utf8mb4, utf32)) FROM t1;
-
-
-# ucs2 is not a superset for the other Unicode character sets
---error ER_CANT_AGGREGATE_2COLLATIONS
-SELECT CHARSET(CONCAT(ucs2, utf8)) FROM t1;
---error ER_CANT_AGGREGATE_2COLLATIONS
-SELECT CHARSET(CONCAT(ucs2, utf8mb4)) FROM t1;
---error ER_CANT_AGGREGATE_2COLLATIONS
-SELECT CHARSET(CONCAT(ucs2, utf16)) FROM t1;
---error ER_CANT_AGGREGATE_2COLLATIONS
-SELECT CHARSET(CONCAT(ucs2, utf32)) FROM t1;
-
-
-# utf16 is not a superset for the other Unicode character sets
---error ER_CANT_AGGREGATE_2COLLATIONS
-SELECT CHARSET(CONCAT(utf16, utf8)) FROM t1;
---error ER_CANT_AGGREGATE_2COLLATIONS
-SELECT CHARSET(CONCAT(utf16, ucs2)) FROM t1;
---error ER_CANT_AGGREGATE_2COLLATIONS
-SELECT CHARSET(CONCAT(utf16, utf8mb4)) FROM t1;
---error ER_CANT_AGGREGATE_2COLLATIONS
-SELECT CHARSET(CONCAT(utf16, utf32)) FROM t1;
-
-
-# utf32 is not a superset for the other Unicode character sets
---error ER_CANT_AGGREGATE_2COLLATIONS
-SELECT CHARSET(CONCAT(utf32, utf8)) FROM t1;
---error ER_CANT_AGGREGATE_2COLLATIONS
-SELECT CHARSET(CONCAT(utf32, ucs2)) FROM t1;
---error ER_CANT_AGGREGATE_2COLLATIONS
-SELECT CHARSET(CONCAT(utf32, utf8mb4)) FROM t1;
---error ER_CANT_AGGREGATE_2COLLATIONS
-SELECT CHARSET(CONCAT(utf32, utf16)) FROM t1;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug#58321 No warning when characters outside BMP0 is converted to UCS2
---echo #
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf32);
-CREATE TABLE t2 (a VARCHAR(10) CHARACTER SET ucs2);
-INSERT INTO t1 VALUES (0x10082), (0x12345);
-INSERT IGNORE INTO t2 SELECT * FROM t1;
-SELECT HEX(a) FROM t2;
-DROP TABLE t1;
-DROP TABLE t2;
-
-
---echo #
---echo # End of 5.5 tests
---echo #
-
---echo #
---echo # Bug#11766143 59185: ASSERTION FAILED: (FIXED == 1), FILE
---echo # ITEM_STRFUNC.CC, LINE 2760
---echo #
-CREATE TABLE t1 (a CHAR(1) CHARSET UTF8);
-INSERT INTO t1 VALUES ('a'), ('b');
-CREATE TABLE t2 (a BINARY(1));
---error ER_SUBQUERY_NO_1_ROW
-SELECT * FROM t2 WHERE a=(SELECT a FROM t1) AND a=_LATIN1'x';
-DROP TABLE t2;
-DROP TABLE t1;
-
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-8362 dash '-' is not recognized in charset armscii8 on select where query
---echo #
-CREATE TABLE t1 (a VARCHAR(64) CHARACTER SET armscii8);
-INSERT INTO t1 VALUES ('abc-def');
-SELECT * FROM t1 WHERE a='abc-def';
-SELECT * FROM t1 WHERE a LIKE 'abc%';
-DROP TABLE t1;
-SELECT HEX(CONVERT(_utf8 0x2728292C2D2E USING armscii8));
-
---echo #
---echo # End of 10.1 tests
---echo #
diff --git a/mysql-test/t/ctype_mb.test b/mysql-test/t/ctype_mb.test
deleted file mode 100644
index cd5ab503d55..00000000000
--- a/mysql-test/t/ctype_mb.test
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# Test of alter table
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-CREATE TABLE t1 SELECT _utf8'test' as c1, _utf8'тест' as c2;
-SHOW CREATE TABLE t1;
-DELETE FROM t1;
-ALTER TABLE t1 ADD c3 CHAR(4) CHARACTER SET utf8;
-SHOW CREATE TABLE t1;
-INSERT IGNORE INTO t1 VALUES ('aaaabbbbccccdddd','aaaabbbbccccdddd','aaaabbbbccccdddd');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a CHAR(4) CHARACTER SET utf8, KEY key_a(a(3)));
-SHOW CREATE TABLE t1;
-SHOW KEYS FROM t1;
-ALTER TABLE t1 CHANGE a a CHAR(4);
-SHOW CREATE TABLE t1;
-SHOW KEYS FROM t1;
-ALTER TABLE t1 CHANGE a a CHAR(4) CHARACTER SET utf8;
-SHOW CREATE TABLE t1;
-SHOW KEYS FROM t1;
-DROP TABLE t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/ctype_nopad_8bit.test b/mysql-test/t/ctype_nopad_8bit.test
deleted file mode 100644
index fc60bbd7759..00000000000
--- a/mysql-test/t/ctype_nopad_8bit.test
+++ /dev/null
@@ -1,239 +0,0 @@
-#
-# Tests with the nopad 8 bit character sets
-#
-
---echo #
---echo # MDEV-9711 NO PAD Collatons
---echo #
-SET character_set_connection=dec8;
-let $coll='dec8_swedish_nopad_ci';
-let $coll_pad='dec8_swedish_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='dec8_nopad_bin';
-let $coll_pad='dec8_bin';
---source include/ctype_pad_all_engines.inc
-
-
-SET character_set_connection=cp850;
-let $coll='cp850_general_nopad_ci';
-let $coll_pad='cp850_general_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='cp850_nopad_bin';
-let $coll_pad='cp850_bin';
---source include/ctype_pad_all_engines.inc
-
-
-SET character_set_connection=hp8;
-let $coll='hp8_english_nopad_ci';
-let $coll_pad='hp8_english_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='hp8_nopad_bin';
-let $coll_pad='hp8_bin';
---source include/ctype_pad_all_engines.inc
-
-
-SET character_set_connection=koi8r;
-let $coll='koi8r_general_nopad_ci';
-let $coll_pad='koi8r_general_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='koi8r_nopad_bin';
-let $coll_pad='koi8r_bin';
---source include/ctype_pad_all_engines.inc
-
-
-SET character_set_connection=latin2;
-let $coll='latin2_general_nopad_ci';
-let $coll_pad='latin2_general_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='latin2_nopad_bin';
-let $coll_pad='latin2_bin';
---source include/ctype_pad_all_engines.inc
-
-
-SET character_set_connection=swe7;
-let $coll='swe7_swedish_nopad_ci';
-let $coll_pad='swe7_swedish_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='swe7_nopad_bin';
-let $coll_pad='swe7_bin';
---source include/ctype_pad_all_engines.inc
-
-
-SET character_set_connection=ascii;
-let $coll='ascii_general_nopad_ci';
-let $coll_pad='ascii_general_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='ascii_nopad_bin';
-let $coll_pad='ascii_bin';
---source include/ctype_pad_all_engines.inc
-
-
-SET character_set_connection=hebrew;
-let $coll='hebrew_general_nopad_ci';
-let $coll_pad='hebrew_general_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='hebrew_nopad_bin';
-let $coll_pad='hebrew_bin';
---source include/ctype_pad_all_engines.inc
-
-
-SET character_set_connection=koi8u;
-let $coll='koi8u_general_nopad_ci';
-let $coll_pad='koi8u_general_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='koi8u_nopad_bin';
-let $coll_pad='koi8u_bin';
---source include/ctype_pad_all_engines.inc
-
-
-SET character_set_connection=greek;
-let $coll='greek_general_nopad_ci';
-let $coll_pad='greek_general_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='greek_nopad_bin';
-let $coll_pad='greek_bin';
---source include/ctype_pad_all_engines.inc
-
-
-SET character_set_connection=cp1250;
-let $coll='cp1250_general_nopad_ci';
-let $coll_pad='cp1250_general_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='cp1250_nopad_bin';
-let $coll_pad='cp1250_bin';
---source include/ctype_pad_all_engines.inc
-
-
-SET character_set_connection=cp1257;
-let $coll='cp1257_general_nopad_ci';
-let $coll_pad='cp1257_general_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='cp1257_nopad_bin';
-let $coll_pad='cp1257_bin';
---source include/ctype_pad_all_engines.inc
-
-
-SET character_set_connection=latin5;
-let $coll='latin5_turkish_nopad_ci';
-let $coll_pad='latin5_turkish_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='latin5_nopad_bin';
-let $coll_pad='latin5_bin';
---source include/ctype_pad_all_engines.inc
-
-
-SET character_set_connection=armscii8;
-let $coll='armscii8_general_nopad_ci';
-let $coll_pad='armscii8_general_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='armscii8_nopad_bin';
-let $coll_pad='armscii8_bin';
---source include/ctype_pad_all_engines.inc
-
-
-SET character_set_connection=cp866;
-let $coll='cp866_general_nopad_ci';
-let $coll_pad='cp866_general_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='cp866_nopad_bin';
-let $coll_pad='cp866_bin';
---source include/ctype_pad_all_engines.inc
-
-
-SET character_set_connection=keybcs2;
-let $coll='keybcs2_general_nopad_ci';
-let $coll_pad='keybcs2_general_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='keybcs2_nopad_bin';
-let $coll_pad='keybcs2_bin';
---source include/ctype_pad_all_engines.inc
-
-
-SET character_set_connection=macce;
-let $coll='macce_general_nopad_ci';
-let $coll_pad='macce_general_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='macce_nopad_bin';
-let $coll_pad='macce_bin';
---source include/ctype_pad_all_engines.inc
-
-
-SET character_set_connection=macroman;
-let $coll='macroman_general_nopad_ci';
-let $coll_pad='macroman_general_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='macroman_nopad_bin';
-let $coll_pad='macroman_bin';
---source include/ctype_pad_all_engines.inc
-
-
-SET character_set_connection=cp852;
-let $coll='cp852_general_nopad_ci';
-let $coll_pad='cp852_general_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='cp852_nopad_bin';
-let $coll_pad='cp852_bin';
---source include/ctype_pad_all_engines.inc
-
-
-SET character_set_connection=latin7;
-let $coll='latin7_general_nopad_ci';
-let $coll_pad='latin7_general_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='latin7_nopad_bin';
-let $coll_pad='latin7_bin';
---source include/ctype_pad_all_engines.inc
-
-
-SET character_set_connection=cp1251;
-let $coll='cp1251_general_nopad_ci';
-let $coll_pad='cp1251_general_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='cp1251_nopad_bin';
-let $coll_pad='cp1251_bin';
---source include/ctype_pad_all_engines.inc
-
-
-SET character_set_connection=cp1256;
-let $coll='cp1256_general_nopad_ci';
-let $coll_pad='cp1256_general_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='cp1256_nopad_bin';
-let $coll_pad='cp1256_bin';
---source include/ctype_pad_all_engines.inc
-
-
-SET character_set_connection=geostd8;
-let $coll='geostd8_general_nopad_ci';
-let $coll_pad='geostd8_general_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='geostd8_nopad_bin';
-let $coll_pad='geostd8_bin';
---source include/ctype_pad_all_engines.inc
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/ctype_partitions.test b/mysql-test/t/ctype_partitions.test
deleted file mode 100644
index f80a2c98a1b..00000000000
--- a/mysql-test/t/ctype_partitions.test
+++ /dev/null
@@ -1,29 +0,0 @@
---source include/have_partition.inc
-
---echo #
---echo # MDEV-6255 DUPLICATE KEY Errors on SELECT .. GROUP BY that uses temporary and filesort
---echo #
-
-# cp1251_ukrainian_ci: 0x20 SPACE is equal to 0x60 GRAVE ACCENT
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET cp1251 COLLATE cp1251_ukrainian_ci);
-INSERT INTO t1 VALUES (0x20),(0x60),(0x6060),(0x606060);
-SELECT HEX(a) FROM t1 WHERE a=0x60;
-ALTER TABLE t1 PARTITION BY KEY(a) PARTITIONS 3;
-SELECT HEX(a) FROM t1 WHERE a=0x60;
-DROP TABLE t1;
-
-# koi8u_general_ci: 0x20 SPACE is equal to 0x60 GRAVE ACCENT
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET koi8u COLLATE koi8u_general_ci);
-INSERT INTO t1 VALUES (0x20),(0x60),(0x6060),(0x606060);
-SELECT HEX(a) FROM t1 WHERE a=0x60;
-ALTER TABLE t1 PARTITION BY KEY(a) PARTITIONS 3;
-SELECT HEX(a) FROM t1 WHERE a=0x60;
-DROP TABLE t1;
-
-# cp1250_general_ci: 0x20 SPACE is equal to 0xA0 NO-BREAK SPACE
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET cp1250 COLLATE cp1250_general_ci);
-INSERT INTO t1 VALUES (0x20),(0xA0),(0xA0A0),(0xA0A0A0);
-SELECT HEX(a) FROM t1 WHERE a=0xA0;
-ALTER TABLE t1 PARTITION BY KEY(a) PARTITIONS 3;
-SELECT HEX(a) FROM t1 WHERE a=0xA0;
-DROP TABLE t1;
diff --git a/mysql-test/t/ctype_recoding.test b/mysql-test/t/ctype_recoding.test
deleted file mode 100644
index ba2e65b3626..00000000000
--- a/mysql-test/t/ctype_recoding.test
+++ /dev/null
@@ -1,256 +0,0 @@
-SET CHARACTER SET koi8r;
-
---disable_warnings
-DROP TABLE IF EXISTS , t1, t2;
---enable_warnings
-
-SET CHARACTER SET koi8r;
-CREATE TABLE t1 (a CHAR(10) CHARACTER SET cp1251) SELECT _koi8r'' AS a;
-CREATE TABLE t2 (a CHAR(10) CHARACTER SET utf8);
-SHOW CREATE TABLE t1;
-SELECT a FROM t1;
-SELECT HEX(a) FROM t1;
-INSERT t2 SELECT * FROM t1;
-SELECT HEX(a) FROM t2;
-DROP TABLE t1, t2;
-
-
-#
-# Check that long strings conversion does not fail (bug#2218)
-#
-CREATE TABLE t1 (description text character set cp1250 NOT NULL);
-INSERT INTO t1 (description) VALUES (_latin2'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddde');
-SELECT description FROM t1;
-DROP TABLE t1;
-
-# same with TEXT
-CREATE TABLE t1 (a TEXT CHARACTER SET cp1251) SELECT _koi8r'' AS a;
-CREATE TABLE t2 (a TEXT CHARACTER SET utf8);
-SHOW CREATE TABLE t1;
-SELECT HEX(a) FROM t1;
-INSERT t2 SELECT * FROM t1;
-SELECT HEX(a) FROM t2;
-DROP TABLE t1, t2;
-
-CREATE TABLE ``
-(
- CHAR(32) CHARACTER SET koi8r NOT NULL COMMENT " "
-) COMMENT " ";
-
-SHOW TABLES;
-SHOW CREATE TABLE ;
-SHOW FIELDS FROM ;
-
-SET CHARACTER SET cp1251;
-SHOW TABLES;
-SHOW CREATE TABLE ;
-SHOW FIELDS FROM ;
-
-
-SET CHARACTER SET utf8;
-SHOW TABLES;
-SHOW CREATE TABLE таблица;
-SHOW FIELDS FROM таблица;
-
-SET CHARACTER SET koi8r;
-DROP TABLE ;
-SET CHARACTER SET default;
-
-# Test for Item_func_conv_charset::fix_fields (bug #3704)
-SET NAMES UTF8;
-CREATE TABLE t1 (t text) DEFAULT CHARSET UTF8;
-INSERT INTO t1 (t) VALUES ('x');
-SELECT 1 FROM t1 WHERE CONCAT(_latin1'x') = t;
-DROP TABLE t1;
-
-SET CHARACTER SET koi8r;
-CREATE DATABASE ;
-USE ;
-SHOW TABLES;
-SHOW TABLES IN ;
-SET CHARACTER SET cp1251;
-SHOW TABLES;
-SHOW TABLES IN ;
-SET CHARACTER SET koi8r;
-DROP DATABASE ;
-
-SET NAMES koi8r;
-SELECT hex('');
-SET character_set_connection=cp1251;
-SELECT hex('');
-
-USE test;
-
-# Bug#4417
-# Check that identifiers and strings are not converted
-# when the client character set is binary.
-
-SET NAMES binary;
-CREATE TABLE `тест` (`тест` int);
-SHOW CREATE TABLE `тест`;
-SET NAMES utf8;
-SHOW CREATE TABLE `тест`;
-DROP TABLE `тест`;
-SET NAMES binary;
-SET character_set_connection=utf8;
-SELECT 'тест' as s;
-SET NAMES utf8;
-SET character_set_connection=binary;
-SELECT 'тест' as s;
-
-# Bug#4417, another aspect:
-# Check that both "SHOW CREATE TABLE" and "SHOW COLUMNS"
-# return column names and default values in UTF8 after "SET NAMES BINARY"
-
-SET NAMES latin1;
-CREATE TABLE t1 (`` CHAR(128) DEFAULT '', `1` ENUM('1','2') DEFAULT '2');
-SHOW CREATE TABLE t1;
-SHOW COLUMNS FROM t1;
-SET NAMES binary;
-SHOW CREATE TABLE t1;
-SHOW COLUMNS FROM t1;
-DROP TABLE t1;
-
-
-#
-# Test that we allow only well-formed UTF8 identitiers
-#
-SET NAMES binary;
---error 1300
-CREATE TABLE `good` (a int);
-SET NAMES utf8;
---error 1300
-CREATE TABLE `good` (a int);
-
-
-#
-# Test that we produce a warnign when conversion loses data.
-#
-set names latin1;
-create table t1 (a char(10) character set koi8r, b text character set koi8r);
-insert into t1 values ('test','test');
-insert ignore into t1 values ('','');
-drop table t1;
-
-#
-# Try to apply an automatic conversion in some cases:
-# E.g. when mixing a column to a string, the string
-# is converted into the column character set.
-# If conversion loses data, then error. Otherwise,
-# the string is replaced by its converted representation
-#
-set names koi8r;
-create table t1 (a char(10) character set cp1251);
-insert into t1 values (_koi8r'');
-# this is possible:
-select * from t1 where a=_koi8r'';
-# this is possible, because we have a function with constant arguments:
-select * from t1 where a=concat(_koi8r'');
-# this is not posible, cannot convert _latin1'' into cp1251:
---error 1267
-select * from t1 where a=_latin1'';
-drop table t1;
-set names latin1;
-
-#
-# Test the same with ascii
-#
-set names ascii;
-create table t1 (a char(1) character set latin1);
-insert into t1 values ('a');
-select * from t1 where a='a';
-drop table t1;
-set names latin1;
-
-#
-# Bug#10446 Illegal mix of collations
-#
-create table t1 (a char(10) character set utf8 collate utf8_bin);
-insert into t1 values (' xxx');
-select * from t1 where a=lpad('xxx',10,' ');
-drop table t1;
-
-#
-# Check more automatic conversion
-#
-set names koi8r;
-create table t1 (c1 char(10) character set cp1251);
-insert into t1 values ('');
-select c1 from t1 where c1 between '' and '';
-select ifnull(c1,''), ifnull(null,c1) from t1;
-select if(1,c1,''), if(0,c1,'') from t1;
-select coalesce('',c1), coalesce(null,c1) from t1;
-select least(c1,''), greatest(c1,'') from t1;
-select locate(c1,''), locate('',c1) from t1;
-select field(c1,''),field('',c1) from t1;
-select concat(c1,''), concat('',c1) from t1;
-select concat_ws(c1,'',''), concat_ws('',c1,'') from t1;
-select replace(c1,'',''), replace('',c1,'') from t1;
-select substring_index(c1,'',2) from t1;
-select elt(1,c1,''),elt(1,'',c1) from t1;
-select make_set(3,c1,''), make_set(3,'',c1) from t1;
-select insert(c1,1,2,''),insert('',1,2,c1) from t1;
-select trim(c1 from ''),trim('' from c1) from t1;
-select lpad(c1,3,''), lpad('',3,c1) from t1;
-select rpad(c1,3,''), rpad('',3,c1) from t1;
-# TODO
-#select case c1 when '' then '' when '' then '' else 'c' end from t1;
-#select export_set(5,c1,''), export_set(5,'',c1) from t1;
-drop table t1;
-
-#
-# Bug 20695: problem with field default value's character set
-#
-
-set names koi8r;
-create table t1(a char character set cp1251 default _koi8r 0xFF);
-show create table t1;
-drop table t1;
---error 1067
-create table t1(a char character set latin1 default _cp1251 0xFF);
-
---echo End of 4.1 tests
-
-SET CHARACTER SET DEFAULT;
---echo #
---echo # LP BUG#944504 Item_func_conv_charset tries to execute subquery constant
---echo #
-SET optimizer_switch = 'in_to_exists=on';
-SET character_set_connection = utf8;
-CREATE TABLE t1 ( a VARCHAR(1) );
-INSERT INTO t1 VALUES ('m'),('n');
-CREATE VIEW v1 AS SELECT 'w' ;
-SELECT * FROM t1 WHERE a < ALL ( SELECT * FROM v1 );
-drop view v1;
-drop table t1;
-SET character_set_connection = default;
-SET optimizer_switch= default;
-
---echo #End of 5.3 tests
-
---echo #
---echo # Start of 5.5 tests
---echo #
-
---echo #
---echo # MDEV-10181 Illegal mix of collation for a field and an ASCII string as a view field
---echo #
-SET NAMES utf8;
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
-INSERT INTO t1 VALUES ('A'),('a'),('B'),('b');
-CREATE VIEW v1 AS SELECT 'a';
-SELECT * FROM v1,t1 where t1.a=v1.a;
-DROP VIEW v1;
-DROP TABLE t1;
-
-SET NAMES utf8;
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
-INSERT INTO t1 VALUES ('a'),('b'),('c');
-CREATE VIEW v1 AS SELECT 'a' AS a UNION SELECT 'b';
-SELECT * FROM v1,t1 WHERE t1.a=v1.a;
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo #
---echo # End of 5.5 tests
---echo #
diff --git a/mysql-test/t/ctype_sjis.test b/mysql-test/t/ctype_sjis.test
deleted file mode 100644
index 9a8ce414c14..00000000000
--- a/mysql-test/t/ctype_sjis.test
+++ /dev/null
@@ -1,262 +0,0 @@
--- source include/have_sjis.inc
-
-#
-# Tests with the sjis character set
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-set names sjis;
-
-select 'a' like 'a';
-select 'A' like 'a';
-select 'A' like 'a' collate sjis_bin;
-
-set @sjis1= _sjis 0xa1a2a3a4a5a6a7a8a9aaabacadaeaf;
-set @sjis2= _sjis 0xb0b1b2b3b4b5b6b7b8b9babbbcbdbebf;
-set @sjis3= _sjis 0xc0c1c2c3c4c5c6c7c8c9cacbcccdcecf;
-set @sjis4= _sjis 0xd0d1d2d3d4d5d6d7d8d9dadbdcdddedf;
-
-set @utf81= CONVERT(@sjis1 USING utf8);
-set @utf82= CONVERT(@sjis2 USING utf8);
-set @utf83= CONVERT(@sjis3 USING utf8);
-set @utf84= CONVERT(@sjis4 USING utf8);
-
-select hex(@utf81);
-select hex(@utf82);
-select hex(@utf83);
-select hex(@utf84);
-
-select hex(CONVERT(@utf81 USING sjis));
-select hex(CONVERT(@utf82 USING sjis));
-select hex(CONVERT(@utf83 USING sjis));
-select hex(CONVERT(@utf84 USING sjis));
-
-#
-# Allow to insert extra CP932 characters
-# into a SJIS column
-#
-create table t1 (a char(10) character set sjis);
-insert into t1 values (0x878A);
-select hex(a) from t1;
-drop table t1;
-
-#
-# Bug #6206 ENUMs are not case sensitive even if declared BINARY
-#
-create table t1(c enum(0x9353,0x9373) character set sjis);
-show create table t1;
-insert into t1 values (0x9353);
-insert into t1 values (0x9373);
-select hex(c) from t1;
-drop table t1;
-
-#
-# Bug #6223 Japanese half-width kana characters get truncated
-#
-SET NAMES sjis;
-CREATE TABLE t1 (
- c char(16) default NULL
-) ENGINE=MyISAM DEFAULT CHARSET=sjis;
-insert into t1 values(0xb1),(0xb2),(0xb3);
-select hex(c) from t1;
-drop table t1;
-
-
-SET collation_connection='sjis_japanese_ci';
--- source include/ctype_filesort.inc
--- source include/ctype_innodb_like.inc
--- source include/ctype_like_escape.inc
--- source include/ctype_like_range_f1f2.inc
--- source include/ctype_str_to_date.inc
-SET collation_connection='sjis_bin';
--- source include/ctype_filesort.inc
--- source include/ctype_innodb_like.inc
--- source include/ctype_like_escape.inc
--- source include/ctype_like_range_f1f2.inc
-
-# Check parsing of string literals in SJIS with multibyte characters that
-# have an embedded \ in them. (Bug #8303)
-
---character_set sjis
-SET NAMES sjis;
-SELECT HEX('@\') FROM DUAL;
-
-# End of 4.1 tests
-
---echo # Start of 5.1 tests
-
---echo Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
-CREATE TABLE t1 (a varchar(16)) character set sjis;
-INSERT INTO t1 VALUES (0x8372835E),(0x8352835E);
-SELECT hex(a), hex(lower(a)), hex(upper(a)) FROM t1 ORDER BY binary(a);
-DROP TABLE t1;
-
---echo #
---echo # Bug#11766519 - Bug#59648: MY_STRTOLL10_MB2: ASSERTION `(*ENDPTR - S) % 2 == 0' FAILED.
---echo #
-# In the below string backslash (0x5C) is a part of a multi-byte
-# character, so it should not be quoted.
-SELECT QUOTE('\');
-
-
---echo # End of 5.1 tests
-
-
---echo #
---echo # Start of 5.5 tests
---echo #
-
---echo #
---echo # Testing WL#4583 Case conversion in Asian character sets
---echo #
-#
-# Populate t1 with all hex digits
-#
-SET NAMES utf8;
-SET collation_connection=sjis_japanese_ci;
-CREATE TABLE t1 (b VARCHAR(2));
-INSERT INTO t1 VALUES ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7');
-INSERT INTO t1 VALUES ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F');
-#
-# Populate tables head and tail with values '00'-'FF'
-#
-CREATE TEMPORARY TABLE head AS SELECT concat(b1.b, b2.b) AS head FROM t1 b1, t1 b2;
-CREATE TEMPORARY TABLE tail AS SELECT concat(b1.b, b2.b) AS tail FROM t1 b1, t1 b2;
-DROP TABLE t1;
-#
-# Populate table t1 with all codes [80..FF][20..FF]
-# excluding Half Width Kana [A1..DF]
-# Expected valid sjis codes:
-# [81..9F,E0..FC][40..7E,80..fC] (60x188=11280 characters)
-#
-CREATE TABLE t1 AS
-SELECT concat(head, tail) AS code, ' ' AS a
-FROM head, tail
-WHERE (head BETWEEN '80' AND 'FF') AND (head NOT BETWEEN 'A1' AND 'DF')
-AND (tail BETWEEN '20' AND 'FF')
-ORDER BY head, tail;
-#
-# Populate Half Width Kana: [A1..DF]
-#
-INSERT IGNORE t1 (code) SELECT head FROM head WHERE (head BETWEEN 'A1' AND 'DF');
-DROP TEMPORARY TABLE head, tail;
-SHOW CREATE TABLE t1;
-UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code;
-SELECT COUNT(*) FROM t1;
-SELECT COUNT(*) FROM t1 WHERE a<>'?' AND OCTET_LENGTH(a)=1;
-SELECT COUNT(*) FROM t1 WHERE a<>'' AND OCTET_LENGTH(a)=2;
-#
-# Display all characters that have upper or lower case mapping.
-#
-SELECT code, hex(upper(a)), hex(lower(a)),a, upper(a), lower(a)
-FROM t1
-WHERE hex(a)<>hex(upper(a)) OR hex(a)<>hex(lower(a))
-ORDER BY code;
-#
-# Make sure all possible conversion happened
-#
-# Expect U+212B ANGSTROM SIGN
-#
-SELECT * FROM t1
-WHERE HEX(CAST(LOWER(a) AS CHAR CHARACTER SET utf8)) <>
- HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
-#
-# Expect no results
-#
-SELECT * FROM t1
-WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <>
- HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
-
---echo #
---echo # WL#3090 Japanese Character Set adjustments
---echo # Test sjis->Unicode conversion
---echo #
-SELECT HEX(a), HEX(CONVERT(a USING utf8)) as b FROM t1
-WHERE a<>'' HAVING b<>'3F' ORDER BY code;
-
-DROP TABLE t1;
-
-
---echo #
---echo # WL#3090 Japanese Character Set adjustments
---echo # Test Unicode->sjis conversion
---echo #
---source include/ctype_utf8_table.inc
-SELECT HEX(a), HEX(CONVERT(a using sjis)) as b FROM t1 HAVING b<>'3F' ORDER BY BINARY a;
-DROP TABLE t1;
-
-
---echo #
---echo # End of 5.5 tests
---echo #
-
-
---echo #
---echo # Start of 5.6 tests
---echo #
-
---echo #
---echo # WL#3664 WEIGHT_STRING
---echo #
-
-set names sjis;
---source include/weight_string.inc
---source include/weight_string_l1.inc
---source include/weight_string_8140.inc
-
-
-set collation_connection=sjis_bin;
---source include/weight_string.inc
---source include/weight_string_l1.inc
---source include/weight_string_8140.inc
-
---echo #
---echo # End of 5.6 tests
---echo #
-
---echo #
---echo # Start of 10.0 tests
---echo #
-
-let $ctype_unescape_combinations=selected;
---source include/ctype_unescape.inc
-
---character_set sjis
-SET NAMES sjis;
---source include/ctype_E05C.inc
-
-
---echo #
---echo # End of 10.0 tests
---echo #
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-9842 LOAD DATA INFILE does not work well with a TEXT column when using sjis
---echo #
-CREATE TABLE t1 (a TEXT CHARACTER SET sjis);
-LOAD DATA INFILE '../../std_data/loaddata/mdev9842.txt' INTO TABLE t1 CHARACTER SET sjis;
-SELECT HEX(a) FROM t1;
-SELECT a=CONCAT('x', REPEAT(_sjis 0x835C, 200)) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-9711 NO PAD Collatons
---echo #
-SET character_set_connection=sjis;
-let $coll='sjis_japanese_nopad_ci';
-let $coll_pad='sjis_japanese_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='sjis_nopad_bin';
-let $coll_pad='sjis_bin';
---source include/ctype_pad_all_engines.inc
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/ctype_swe7.test b/mysql-test/t/ctype_swe7.test
deleted file mode 100644
index 2e648a89406..00000000000
--- a/mysql-test/t/ctype_swe7.test
+++ /dev/null
@@ -1,40 +0,0 @@
---echo #
---echo # Start of 10.0 tests
---echo #
-
-SET NAMES swe7;
-
-#
-# Test escape sequences.
-# This also covers:
-# MDEV-6737 Stored routines do now work with swe7: "The table mysql.proc is missing, corrupt, or contains bad data"
-# as uses stored functions actively.
-#
-
-let $ctype_unescape_combinations=selected;
---source include/ctype_unescape.inc
-
---echo #
---echo # End of 10.0 tests
---echo #
-
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-9711 NO PAD Collatons
---echo #
-SET character_set_connection=swe7;
-let $coll='swe7_swedish_nopad_ci';
-let $coll_pad='swe7_swedish_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='swe7_nopad_bin';
-let $coll_pad='swe7_bin';
---source include/ctype_pad_all_engines.inc
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/ctype_tis620.test b/mysql-test/t/ctype_tis620.test
deleted file mode 100644
index 7bc248aec2b..00000000000
--- a/mysql-test/t/ctype_tis620.test
+++ /dev/null
@@ -1,214 +0,0 @@
--- source include/have_tis620.inc
-
-#
-# Tests with the big5 character set
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-#
-# Bug 1552: tis620 <-> unicode conversion crashed
-# Check tis620 -> utf8 -> tis620 round trip conversion
-#
-
-SET @pl0= _tis620 0x000102030405060708090A0B0C0D0E0F;
-SET @pl1= _tis620 0x101112131415161718191A1B1C1D1E1F;
-SET @pl2= _tis620 0x202122232425262728292A2B2C2D2E2F;
-SET @pl3= _tis620 0x303132333435363738393A3B3C3D3E3F;
-SET @pl4= _tis620 0x404142434445464748494A4B4C4D4E4F;
-SET @pl5= _tis620 0x505152535455565758595A5B5C5D5E5F;
-SET @pl6= _tis620 0x606162636465666768696A6B6C6D6E6F;
-SET @pl7= _tis620 0x707172737475767778797A7B7C7D7E7F;
-SET @pl8= _tis620 0x808182838485868788898A8B8C8D8E8F;
-SET @pl9= _tis620 0x909192939495969798999A9B9C9D9E9F;
-SET @plA= _tis620 0xA0A1A2A3A4A5A6A7A8A9AAABACADAEAF;
-SET @plB= _tis620 0xB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF;
-SET @plC= _tis620 0xC0C1C2C3C4C5C6C7C8C9CACBCCCDCECF;
-SET @plD= _tis620 0xD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF;
-SET @plE= _tis620 0xE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF;
-SET @plF= _tis620 0xF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF;
-
-SELECT hex(@u0:=convert(@pl0 using utf8));
-SELECT hex(@u1:=convert(@pl1 using utf8));
-SELECT hex(@u2:=convert(@pl2 using utf8));
-SELECT hex(@u3:=convert(@pl3 using utf8));
-SELECT hex(@u4:=convert(@pl4 using utf8));
-SELECT hex(@u5:=convert(@pl5 using utf8));
-SELECT hex(@u6:=convert(@pl6 using utf8));
-SELECT hex(@u7:=convert(@pl7 using utf8));
-SELECT hex(@u8:=convert(@pl8 using utf8));
-SELECT hex(@u9:=convert(@pl9 using utf8));
-SELECT hex(@uA:=convert(@plA using utf8));
-SELECT hex(@uB:=convert(@plB using utf8));
-SELECT hex(@uC:=convert(@plC using utf8));
-SELECT hex(@uD:=convert(@plD using utf8));
-SELECT hex(@uE:=convert(@plE using utf8));
-SELECT hex(@uF:=convert(@plF using utf8));
-
-SELECT hex(convert(@u0 USING tis620));
-SELECT hex(convert(@u1 USING tis620));
-SELECT hex(convert(@u2 USING tis620));
-SELECT hex(convert(@u3 USING tis620));
-SELECT hex(convert(@u4 USING tis620));
-SELECT hex(convert(@u5 USING tis620));
-SELECT hex(convert(@u6 USING tis620));
-SELECT hex(convert(@u7 USING tis620));
-SELECT hex(convert(@u8 USING tis620));
-SELECT hex(convert(@u9 USING tis620));
-SELECT hex(convert(@uA USING tis620));
-SELECT hex(convert(@uB USING tis620));
-SELECT hex(convert(@uC USING tis620));
-SELECT hex(convert(@uD USING tis620));
-SELECT hex(convert(@uE USING tis620));
-SELECT hex(convert(@uF USING tis620));
-
-SET NAMES tis620;
-
-CREATE TABLE t1 (
- recid int(11) NOT NULL auto_increment,
- dyninfo text,
- PRIMARY KEY (recid)
-) ENGINE=MyISAM CHARACTER SET tis620;
-
-show create table t1;
-
-INSERT INTO t1 VALUES (1,'color=\"STB,NPG\"\r\nengine=\"J30A13\"\r\nframe=\"MRHCG1640YP4\"\r\ngrade=\"V6\"\r\nmodel=\"ACCORD\"\r\nmodelcode=\"CG164YEN\"\r\ntype=\"VT6\"\r\n');
-INSERT INTO t1 VALUES (2,'color=\"HTM,NPG,DEG,RGS\"\r\nengine=\"F23A5YP1\"\r\nframe=\"MRHCF8640YP3\"\r\ngrade=\"EXi AT\"\r\nmodel=\"ACCORD\"\r\nmodelcode=\"CF864YE\"\r\ntype=\"EXA\"\r\n');
-
-SELECT DISTINCT
- (IF( LOCATE( 'year=\"', dyninfo ) = 1,
- SUBSTRING( dyninfo, 6+1, LOCATE('\"\r',dyninfo) - 6 -1),
- IF( LOCATE( '\nyear=\"', dyninfo ),
- SUBSTRING( dyninfo, LOCATE( '\nyear=\"', dyninfo ) + 7,
- LOCATE( '\"\r', SUBSTRING( dyninfo, LOCATE( '\nyear=\"', dyninfo ) +7 )) - 1), '' ))) AS year
-FROM t1
-HAVING year != '' ORDER BY year;
-
-DROP TABLE t1;
-
-
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1
-(
- name varchar(50) NOT NULL default '',
- excelorder int(11) NOT NULL default '0',
- neworder int(11) NOT NULL default '0'
-) ENGINE=MyISAM DEFAULT CHARSET=tis620;
-
-INSERT INTO `t1` VALUES ('+45 BRETT',4,1),('+55 BRETT',5,2),('+56 BRETT',6,3),('-.55 BRETT',2,4),('-45 BRETT',8,5),('-55 BRETT',13,6),('.-55 BRETT',3,7),('.55 BRETT',1,8),('45 BRETT',7,9),('5 5 BRETT3',9,10),('5 5 BRETT2',10,11),('5 5 BRETT1',11,12),('5-5 BRETT',14,13),('55 BRETT',12,14),('55+ BRETT',17,15),('55- BRETT',15,16),('55. BRETT',16,17),('.˭ԧ ',1630,1630),('§',1599,1599),('',1638,1638),('صˡ (1989)',1583,1583),('ʻԹ',1586,1586),('ѵ',1706,1706),('繨Ե',1623,1623),('繨Ե',1622,1622),('',1591,1591),('Գ',1592,1592),('ҵ',1595,1595),('',1627,1627),('',1626,1626),('ѡɳ',1628,1628),('Ǵ',1624,1624),('Ǿ',1625,1625),('ԧ',1708,1708),('ԧķ',1709,1709),('ԧ',1707,1707),('Ҵ',1496,1496),('â',1702,1702),('çҹ硡ا෾',1712,1712),('è԰',1713,1713),('ó',1703,1703),('Ԥҿ',1584,1584),('',1585,1585),('š ӡѴ',1594,1594),('',1587,1587),('',1590,1590),('',1588,1588),('¸Թ',1629,1629),('Թ',1589,1589),('',1553,1553),('⹪',1554,1554),('þᾤ ô',1704,1704),('þᾤ ͹ʵѤ',1711,1711),('þᾤ͹ʵѤ',1705,1705),('ͧ',1710,1710),('ͧͧ',1593,1593),('',1555,1555),('',1952,1952),('Ǵ',1951,1951),('ԹԹ¹',1949,1949),(' ҹʻ',1950,1950),('Թ',1497,1497),('ǧͧ',1639,1639),('',1560,1560),('е',1643,1643),('оԹ',1644,1644),('оվ',1645,1645),('оվó',1646,1646),('оվ',1647,1647),('Ǵ',2452,2452),('',2438,2438),('ɰ',2050,2050),('ɰ',2051,2051),('Ѩ',2439,2439),('Ѯ',1558,1558),('',2410,2410),('',2413,2413),('',2432,2432),('',2435,2435),('ѡ',2412,2412),('¤ҡд',2411,2411),('­',2455,2455),('Ҿó',2434,2434),('Ҿ',2433,2433),('èԵ',2436,2436),('',2431,2431),('ô',2052,2052),('ô',2437,2437),('͹ѭ',2453,2453),('͹',2454,2454),('',2414,2414),('ǧ',2430,2430),('ǹ',1557,1557),('ؤ',1641,1641),('',2440,2440),('ѡ',1640,1640),('Ҫ',1559,1559),('ѡɳ',2420,2420),('Ǥ',2415,2415),('dz',2416,2416),('dz',2417,2417),('ǹ',2419,2419),('ǹԵ',2418,2418),('ͧˡ',2456,2456),('ʡ',2405,2405),('ʡä',2406,2406),('ʧ',2424,2424),('ΧѲҡþ',1598,1598),('ʧ͹',2422,2422),('ʧ',2421,2421),('ʧͧ',2423,2423),('ʶ',2407,2407),('ʹѡ',2428,2428),('ʹҡ',2427,2427),('ʹ',2426,2426),('ʹ',2408,2408),('ʹآ',2429,2429),('ʹ',2409,2409),('ʹ硫',2425,2425),('..ʷ',2676,2676),('ŷ ',2716,2716),(' ÷ Դ',2712,2712),('Թ๪',2713,2713),('繨',1642,1642),('Ԩʫ',2687,2687),(' ..ʫ',2690,2690),(' դ',2691,2691),('...',2693,2693),('... ʫ',2692,2692),(' ŨʵԤ',2694,2694),('¾',2717,2717),('硫Ź',2678,2678),(' ',2684,2684),('...',2685,2685),('... (.)',2686,2686),(' ()',2688,2688),(' š',2697,2697),(' ʷ ͹ ᾤ',2695,2695),(' ᡹',2696,2696),('.. ˡ',2701,2701),('.. š',2702,2702),('...š',2703,2703),('..Թ͵ 1999',2704,2704),('...',2698,2698),('...ᾤ',2699,2699),('..Ե',2700,2700),('ષ',2715,2715),('չԷѹԫԪ',2705,2705),('ſ ʫ',2714,2714),('͡Ҫ',2679,2679),('͡Թ',2680,2680),('͡Է',2681,2681),('͡ö',2683,2683),('͡͹ѹ',2682,2682),('͡',2677,2677),('Χԭ Թ',2725,2725),('ʹྪ',1600,1600),('͹',2709,2709),('͹',2710,2710),('ͺʷ()',2711,2711),('Ϳ ԤԤ (ا෾)',2689,2689),('',2707,2707),('',2708,2708),(';ѹ',2706,2706),('',1674,1674),('',1675,1675),('ó',1511,1511),('Թ',1510,1510),('ԡ',1564,1564),('ѡѡ',1649,1649),('ѡԵѷ',1650,1650),('ѡ',1498,1498),('ѡ',1648,1648),('Ѥ',1499,1499),('ѧä',1651,1651),('ѧѹ',1652,1652),('ѧ',1653,1653),('ѧʵź',1561,1561),('Ѫ',1654,1654),('Ѫ',1655,1655),('ѪҾ',1656,1656),('Ѫ',1657,1657),('Ѫ',1658,1658),('Ѫա',1659,1659),('Ѫվ',1660,1660),('Ѱش',1662,1662),('Ѱ',1661,1661),('ѳ',1500,1500),('ѳ',1562,1562),('ѵ',1672,1672),('ѵó',1673,1673),('ѵ',1663,1663),('ѵ',1665,1665),('ѵ',1664,1664),('ѵó',1667,1667),('ѵ',1668,1668),('ѵ',1669,1669),('ѵó',1671,1671),('ѵҾ',1670,1670),('ѵ',1666,1666),('ѷ',1505,1505),('ѷѧ',1506,1506),('ѷó',1508,1508),('ѷԹ',1509,1509),('ѷĴ',1507,1507),('ѷ÷',1501,1501),('ѷþ',1503,1503),('ѷþ',1504,1504),('ѷþ',1502,1502),('ѷ',1563,1563),('ѹ ',1601,1601),('',1681,1681),('',1572,1572),('չ',1682,1682),('હ',1678,1678),('ô',1521,1521),('ô',1531,1531),('⹪',1570,1570),('⹷',1571,1571),('Գ',1524,1524),('Թ',1525,1525),('Թ',1526,1526),('ǹ',1522,1522),('Ǿѹ',1523,1523),('Ե',1527,1527),('ó',1602,1602),('Ź . 2000',1578,1578),('',1573,1573),('',1575,1575),('ó',1576,1576),('Թ',1574,1574),('ҡ',1512,1512),('Ҥ',1513,1513),('ԨԵ',1528,1528),('Ҫҹ',1565,1565),('Ҫѹ',1676,1676),('Ҫ٪',1677,1677),('ԭ',1530,1530),('ԭѡ',1529,1529),('ҳ',1514,1514),('ҳ',1566,1566),('ҳ',1679,1679),('ҳ',1515,1515),('ҳó',1517,1517),('ҳؾ',1516,1516),('ҵ',1680,1680),('Ե',1577,1577),('ҹ',1568,1568),('ҹԵ',1569,1569),('ҹ',1567,1567),('ҹѲ',1518,1518),('ҹѵ',1519,1519),('Ҿ',1520,1520),('վ',1579,1579),('ò',1535,1535),('԰ҹ',1533,1533),('Ծ',1534,1534),('¹͹Ԥ',1621,1621),('',1532,1532),('صˡ',1701,1701),('д',1582,1582),('Ե',1536,1536),('ٹ Ŵ',1618,1618),('ٹ Ŵ',1619,1619),('ٹդ Դ',1620,1620),('СԨʵ',1744,1744),('ä',1739,1739),('ѡ',1738,1738),('آ',1740,1740),('ͪ',1737,1737),('ѡ',1742,1742),('ö ¸',1743,1743),('Ȫ',1741,1741),('Ĵ',1556,1556),('',206,206),('ȹ',211,211),('§§Թ๪',179,179),('§ѡ',180,180),('§',177,177),('§',178,178),('ԡ',174,174),('ԡ',175,175),('ԡ',176,176),('ҹѹ',1537,1537),('žѹ',205,205),('Է',208,208),('Է',209,209),('Թ',210,210),('稾س',170,170),('',190,190),('',196,195),('ѹ',191,191),('',195,196),('',182,182),('',192,192),('',193,193),('Թ',183,183),('',203,203),('',204,204),('',184,184),('',185,185),('ش',186,186),('',194,194),('Թ',187,187),('Թ',213,213),('',212,212),('ȡ',181,181),('ɳ',188,188),('ɴ',189,189),('õ',197,197),('õʴ',201,201),('õѡ',200,200),('õԻ',198,198),('õԾ',199,199),('ź ͹礪',207,207),('ࡪ',171,171),('ࡳԡ',172,172),('ࡵ',173,173),('͡',202,202),('',235,235),(' ꡫ',262,262),('... չ',263,263),(' (Ź)',270,270),('',267,267),('Ш',269,269),('षշʫ',264,264),('ह 硫 ()',266,266),('ह ()',265,265),('᤹ Թô',268,268),('Ե',271,271),('§ط',1597,1597),('ԹعõԹҤԹ',274,274),('خѵ',1538,1538),('',1539,1539),('šûѡ',1540,1540),('§',409,409),('ԭ',407,407),('ԭŧ俿',408,408),('',414,414),('ä',415,415),('Ҿ',411,411),('ɮ',410,410),('Ե',413,413),('',412,412),('ਵ',401,401),('ਹ',402,402),('ਹ乫 ()',405,405),('ਹԷ',406,406),('è',1631,1631),('ਹ',403,403),('ਹç',404,404),('ش',436,436),('Ŵ',435,435),('Թ',434,434),('',428,428),('',433,433),('ѭ',429,429),('',430,430),('ҵ',431,431),('ѹ',432,432),('ɰ',555,555),('- ͹ Ū',556,556),('-͹Ÿ',557,557),('§Χêҧ',563,563),('Ե',559,559),('ǹҭ',558,558),('Ǫҭ Թʷ (1989)',564,564),('ǪҭԹʷ (1989)',565,565),('ǪҭԹʷ (1989)',566,566),('ǪҭԹʷ(1989)',567,567),('Դѡ',562,562),('ԴԵ',560,560),('Դ',561,561),('⪤',568,568),('⪤',569,569),('ય',554,554),('⪵',570,570),('⪵',571,571),('⪵ظ',572,572),('',589,589),('',588,588),('óç',1632,1632),('',1546,1546),('ѵ',1547,1547),('Դ',1541,1541),('',1545,1545),('',1544,1544),('ҭ',1542,1542),('Ԩ',1543,1543),('',708,708),('ФԵ',705,705),('ô',1633,1633),('പ',703,703),('പ',704,704),('͹',707,707),('͹',706,706),('പ',720,720),(' ѹ',723,723),('͹',721,721),('͹',722,722),('ԧѡ',734,734),('',802,802),('',803,803),('Դ',804,804),('෾',799,799),('෾ķ',801,801),('෾Ժ',800,800),('',1550,1550),('',1551,1551),('ѵ',1043,1043),('ùԮ',1634,1634),('٭',1552,1552),('',1549,1549),('๵ô',1042,1042),('',1548,1548),('ó',1117,1117),(' ſ',1118,1118),('ອ',1114,1114),('ອó',1116,1116),('ອѡɳ 鹵',1115,1115),('ອ',1113,1113),('',1265,1265),('',1268,1268),('Է',1269,1269),('Ĵ',1267,1267),('',1266,1266),('Կ',1264,1264),('آ',1270,1270),('ŹԿ',1271,1271),('ԧ',1291,1291),('༴',1290,1290),('',1475,1475),('',1476,1476),('Ԫ շ ',1468,1468),(' Թ',1456,1456),('',1457,1457),('',1467,1467),('筨ѹ',1461,1461),('筷Ծ',1462,1462),('筹',1463,1463),('筻',1464,1464),('筼',1465,1465),('签',1466,1466),('þѷ',1637,1637),('§',1471,1471),('þվ',1635,1635),('þվѲ',1636,1636),('ԹĴ',1470,1470),('ԹԵ',1469,1469),('ྪѵ',1458,1458),('ྪԹ',1460,1460),('ྪŴ',1459,1459),('ᾴ (Ź)',1472,1472),('ᾴ(Ź)',1473,1473),('Ᾱ ѹ',1474,1474),(' Թ๪',1495,1495),('ç',1494,1494),('',1683,1683),('ó',1615,1615),('Ҿ',1614,1614),('',1617,1617),('Ǵ',1616,1616),('й',1700,1700),('',1684,1684),('è',1693,1693),('è좹',1694,1694),('ͧ',1692,1692),('',1691,1691),('Ѫ',1689,1689),('ѵ',1690,1690),('ྪ',1688,1688),('Է',1696,1696),('س',1697,1697),('ó',1695,1695),('觷',1686,1686),('觷Ծ',1685,1685),('觹',1687,1687),('آ',1580,1580),('ؤž',1603,1603),('ب',1698,1698),('ب',1699,1699),('ش',1604,1604),('طԵ',1581,1581),('ط§',1607,1607),('ط',1605,1605),('ط',1606,1606),('ظҵ',1608,1608),('ع',1609,1609),('ؾ',1610,1610),('ؾǴ',1612,1612),('ؾԹ',1613,1613),('ؾҾ',1611,1611),('Ѫ',1792,1792),('',1768,1768),('óó',1785,1785),('ó',1786,1786),('ó',1784,1784),('ó',1783,1783),('óǴ',1787,1787),('ó',1788,1788),('ó',1773,1774),('ó',1789,1789),('ó',1790,1790),('óԵ',1770,1770),('ó',1771,1771),('ó',1772,1772),('ó',1774,1773),('ó',1775,1775),('ó',1776,1776),('ó',1778,1778),('ó',1777,1777),('ó',1779,1779),('ó',1780,1780),('ó',1781,1781),('ó',1782,1782),('෾',1762,1762),('ø',1791,1791),('ط',1769,1769),('ó',1794,1794),('ø',1795,1795),('Ѳ',1796,1796),('',1797,1797),('ѭ',1798,1798),('',1799,1799),('ó',1803,1803),('ѵ',1804,1804),('',1810,1810),('ó',1812,1812),('ز',1806,1806),('ظ',1807,1807),('',1811,1811),('ѡɳ',1805,1805),('ҧѵ',1801,1801),('ҧ',1800,1800),('Թ',1808,1808),('Թ',1809,1809),('Ҿ',1802,1802),('ѡɳ',1793,1793),('á',1758,1758),('ê',1759,1759),('êҵ',1760,1760),('ôɰ',1761,1761),('øѹ',1763,1763),('ùت',1764,1764),('þ',1767,1767),('þ',1765,1765),('þ',1766,1766),('س',1813,1813),('ͧ',1819,1819),('ѹ',1817,1817),('Գ',1815,1815),('Թ',1816,1816),('',1818,1818),('CHEE KUNG FOOK',18,18),('CHEN CHIA YI',19,19),('CHI WAI DAVIT',20,20),('ʹ',1843,1843),('Ⱦ',1842,1842),('',1839,1839),('',1840,1840),('',1841,1841),('Ѫ',1822,1822),('Ѫѭ',1823,1823),('Ѫ',1825,1825),('ѪԹ',1824,1824),('Ѫá',1820,1820),('Ѫþ',1821,1821),('Ѳ',1826,1826),('Ѳ',1827,1827),('ѹѪ',1836,1836),('ѹ',1828,1828),('ѹ',1835,1835),('ѹҢ',1837,1837),('ѹʶ',1838,1838),('ѹ',1829,1829),('ѹҵ',1830,1830),('ѹ',1831,1831),('ѹ',1832,1832),('ѹ',1833,1833),('ѹ',1834,1834),(' ¹ ',1916,1916),('',1886,1886),('è',1889,1889),('⪵',1921,1921),('പ',1922,1922),('ط',1925,1925),('ó',1926,1926),('',1929,1929),('പ',1933,1933),('ط',1936,1936),('ó',1937,1937),('Ѳ',1938,1938),('ѡ',1939,1939),('Ъ',1930,1930),('Ъ',1932,1932),('Ъҵ',1931,1931),('о',1935,1935),('о',1934,1934),('ѡ',1927,1927),('Է',1928,1928),('Ѫ',1887,1887),('ѵ',1888,1888),('',1849,1849),('',1875,1875),('ó',1940,1940),('ѵ',1879,1879),('',1881,1881),('ɳ',1880,1880),('ҡó',1876,1876),('Ҥ',1877,1877),('Ԫ',1848,1848),('Ҿó',1878,1878),('Ե',1882,1882),('',1883,1883),('ó',1885,1885),('ž',1884,1884),('ɰ',1863,1863),('ê',1920,1920),('',1864,1864),('þ',1924,1924),('þ',1923,1923),('س',1850,1850),('',1901,1901),('ø',1902,1902),('Ѳ',1903,1903),('Ѳ',1904,1904),('ب',1910,1910),('ص',1906,1906),('ɮ',1908,1908),('ɰ',1909,1909),('',1907,1907),('԰ѡ',1911,1911),('Է',1912,1912),('ٵ',1915,1915),('ʹ',1851,1851),('ȹ',1905,1905),('ط',1914,1913),('ط',1913,1914),('ѳ',1890,1890),('ó',1891,1891),('',1893,1893),('ѳ',1892,1892),('Թ',1894,1894),('Ե',1895,1895),('',1896,1896),('ѵ',1898,1898),('ó',1900,1900),('ѡɳ',1899,1899),('ž',1897,1897),('Ԥ',1853,1853),('Ԥ ÷',1852,1852),('Ԩ',1856,1856),('Ԩó',1854,1854),('ԨԵ',1855,1855),('Ԫ',1859,1859),('Ԫҭ',1860,1860),('ԪԵ',1861,1861),('Ԫ',1857,1857),('Ԫب',1858,1858),('Ԫش',1862,1862),('ի (2000)',1917,1917),('ԭش',1865,1865),('Ա',1866,1866),('ҳ',1844,1844),('ճ',1918,1918),('Է',1868,1868),('Է',1869,1869),('ҷԵ',1845,1845),('ҷԹ',1846,1846),('ҷԹ',1847,1847),('Է',1870,1870),('ԷѪ',1867,1867),('Թä',1871,1871),('Թ',1872,1872),('չ',1919,1919),('ԹԨ',1873,1873),('Ժ',1874,1874),('¾',1814,1814),('ǧ͹',1745,1745),('ǧҵ',1749,1749),('ǧ',1750,1750),('ǧ侱 ',1746,1746),('ǧ侱',1748,1748),('ǧ侱',1747,1747),('Ǩѵ',1751,1751),('Ǫ',1752,1752),('ǹʹѹ',1754,1754),('ǹѪ',1753,1753),('ǹ',1755,1755),('ǹԪ',1756,1756),('ǹԴ',1757,1757),('زѵ',1948,1948),('زԡ',1941,1941),('زԪ',1942,1942),('زԹ',1944,1944),('زԹѹ',1943,1943),('زԾ',1947,1947),('زԾ',1945,1945),('زԾ',1946,1946),(' Ҵ',2054,2054),('.͹ѹ繨 ͹͹ʵѤ',2055,2055),('',2078,2078),('',2113,2113),('԰',2142,2142),('',2108,2108),('',2111,2111),('',2112,2112),('ѡ',2114,2114),('ö',2109,2109),('ȹ',2110,2110),('õ',2080,2080),('',2088,2088),('⪤',2093,2093),('പ',2095,2095),('',2107,2107),('',1959,1959),('ǧ',2119,2119),('',2120,2120),('',2126,2126),('ѧ',2127,2127),('ѡ',2121,2121),('',2122,2122),('˭ԧ',2125,2125),('آ',2123,2123),('ع',2124,2124),('',2128,2128),('ѭ',1960,1960),('ѭ',2143,2143),('ѳ',1962,1962),('ѳ',1961,1961),('',2133,2133),('',2139,2139),('ٹ',2140,2140),('ѵ',1977,1977),('',1976,1976),('',1963,1963),('',1957,1957),('',2136,2136),('͹',2134,2134),('',2135,2135),('ѹ ',2137,2137),('ô',2138,2138),('',1975,1975),('ظ',2146,2146),('Ѩ',1978,1978),('Ѳ',1979,1979),('ԡ',1980,1980),('ز',1964,1964),('ز',2147,2147),('ظ',1965,1965),('ظ',2148,2148),('\n',1984,1983),('',1983,1984),('ѡ',1981,1981),('ʡ',1982,1982),('ó͹ŷ ͹ Ѻ',1985,1985),('Ӿصˡ',1987,1987),('͹',1986,1986),('ҡ',2144,2144),('ըѹ',1967,1967),('ըѹ',1968,1968),('ҭԵ',2145,2145),('շͧŷ',1969,1969),('շͧصˡѾ',1970,1970),('Է',2131,2130),('Է',2130,2131),('ҹ',2129,2129),('Թ',2446,2446),('Թ',2149,2149),('չ',1971,1971),('Թ',1966,1966),('ջ',1973,1973),('ջ',1972,1972),('վ',1974,1974),('ó',1956,1956),('ѡɳ',2118,2118),('Ťкص',2152,2152),('Ĵ',2115,2115),('ķ',2117,2117),('ķ',2116,2116),('',2079,2079),('',2081,2081),('Դ',2082,2082),('Ե',2083,2083),('Ե',2086,2085),('Ե',2085,2086),('Ե',2084,2084),('Թ',2087,2087),('ê',1958,1958),('',2089,2089),('',2092,2092),('ҭ',2090,2090),('ҵ',2091,2091),('',2094,2094),('ᵹ ()',2066,2066),('ç',2096,2096),('֡',2097,2097),('ѵ',2098,2098),('ó',2100,2100),('ح',2099,2099),(' ź',2076,2076),('ͧ',2101,2101),('໫',2077,2077),('',2104,2104),('',2106,2106),('',2105,2105),('',2102,2102),('',2103,2103),('',2141,2141),('ب',2150,2150),('ت',2132,2132),('ʴ',2154,2154),('è',2155,2155),('ó',2156,2156),('ҹ',2448,2448),('ѡɳ',2153,2153),('з͹',2161,2161),('',1989,1989),('õõ',2158,2158),('',1990,1990),('',1993,1993),('',1994,1994),('',1995,1995),('',1996,1996),('Ը',1991,1991),('Ծ',1992,1992),('Ծѹ',2157,2157),('',2062,2062),('',2061,2061),('˾',2159,2159),('ѹ',2449,2449),('Ҵ',2160,2160),('ķ',2170,2170),('ѹ',2169,2169),('',2451,2451),('ʹ',2450,2450),('ѡԹ',2003,2003),('ѡ',1997,1997),('ѡ',1998,1998),('ѡǧ',2000,2000),('ѡԺ',2002,2002),('ѡ',1999,1999),('ѡ',2001,2001),('ѧ',2162,2162),('Ѩ',2163,2163),('ѭ',2165,2165),('ѭ',2164,2164),('ѭ',2166,2166),('ѹʹ',2004,2004),('ѹ',2167,2167),('ѹԪ',2168,2168),('',2176,2176),('è',2030,2030),('è',2188,2188),('è',2228,2228),('ê',2189,2189),('¹',2181,2181),('',2174,2174),('',2195,2195),('',2196,2196),('',2183,2183),('',2007,2007),('س',2184,2184),('ع',2185,2185),('ѳ',2186,2186),('ѳ',2187,2187),('',2009,2009),('Ѩ',2024,2024),('ѵ',2025,2025),('ѵ',2223,2223),('',2006,2006),('',2023,2023),('',2222,2222),('',2012,2012),('പ',2214,2214),('ö',2175,2175),('',2022,2022),('ó',2027,2027),('ó',2225,2225),('Ѳ',2226,2226),('Ѳ',2028,2028),('Ѳ',2227,2227),('ѡ',2029,2029),('ѡɳ',2026,2026),('ѡɳ',2224,2224),('ԡ',2010,2010),('Ԩѹ',2011,2011),('Ԫ',2013,2013),('Ԫ',2213,2213),('ҭ',2197,2197),('Էȹ',2014,2014),('Ը',2015,2015),('Թѵ',2216,2216),('Թö',2017,2017),('Թ',2016,2016),('Թ',2215,2215),('Թت',2018,2018),('Ի',2217,2217),('Ҿ',2008,2008),('Ծ',2020,2020),('Ծ',2219,2219),('Ծó',2021,2021),('Ծó',2220,2220),('Ծѹ',2221,2221),('Ծ',2019,2019),('Ծ',2218,2218),('',2182,2182),('俿-ҫҡ',2180,2180),('ª',2177,2177),('§',2194,2194),('¹',2178,2178),('½',2179,2179),('ó',2036,2036),('ԡ',2231,2231),('Ե',2192,2192),('Ҿ',2035,2035),('',2229,2229),('Ǿ',2033,2033),('Ǿ',2034,2034),('',2032,2032),('',2190,2190),('',2199,2199),('',2191,2191),('Ż',2031,2031),('ķ',2198,2198),('Ҥ',2171,2171),('ԧ',2200,2200),('ԧ',2201,2201),('ԧ',2202,2202),('Եҹѹ',2203,2203),('ԵҾ',2204,2204),('Է',2205,2205),('Էപ',2208,2208),('Է',2206,2206),('ԷԪ',2207,2207),('ԷԾ',2209,2209),('ԷԾó',2210,2210),('ԷԾ',2211,2211),('ҸԵ',2172,2172),('չ',2230,2230),('ӹѡºἹا෾ҹ',2193,2193),('ҹԵ',2173,2173),('ҹŹ',2005,2005),('Թ',2212,2212),('ѡԵ',2151,2151),('',1988,1988),('ķ',2447,2447),('ʡѵ',2057,2057),('ʡѵ',2056,2056),('ȡó',1954,1954),('˧',2441,2441),('ʧǹ',2060,2060),('ʧ',2064,2064),('ʧѴ',2063,2063),('ʧҹ',2059,2059),('ʧó',2058,2058),('Ȩ',1955,1955),('ʴѺԳ',2065,2065),('ʶ',2068,2068),('ʶҾ',2067,2067),('˷',2442,2442),('˷ѵ',2444,2444),('˷·Ծ',2443,2443),('ʹ',2069,2069),('ʹͧ',2073,2073),('ʹ',2074,2074),('ʹԴ',2075,2075),('˹ķ',2445,2445),('ʹ',2070,2070),('ʹ',2072,2072),('ʹ',2071,2071),('',2042,2042),('ѵ',2043,2043),('ó',2044,2044),('',2329,2329),('Ե',2041,2041),('ɰ',2353,2353),('⪤',2328,2328),('പ',2354,2354),('',2348,2348),('ա',2349,2349),('',2053,2053),('Ѳ',2046,2046),('Է',2047,2047),('ѡ',2048,2048),('ѡ',2360,2360),('Է',2361,2361),('Ѥ',2330,2330),('Ѫա',2362,2362),('ѵ',2331,2331),('ѵ',2367,2367),('ѵǴ',2365,2364),('ѵ',2363,2363),('ѵǴ',2364,2365),('ѵ',2366,2366),('ѷ',2332,2332),('',2333,2333),('ó',2338,2338),('',2381,2381),('',2382,2382),('ѵ',2383,2383),('ѹ',2375,2375),('ѹ',2376,2376),('',2377,2377),('',2380,2380),('§',2371,2371),('ô',2339,2339),('¹',2372,2372),('¹',2373,2373),('¾',2374,2374),('Ǵ',2340,2340),('',2049,2049),('',2345,2345),('',2344,2344),('ҧ',2368,2368),('Ԫ',2369,2369),('ԭ',2341,2341),('ҳ',2334,2334),('Ե',2346,2346),('Ե',2347,2347),('ոҾ',2378,2378),('Թ',2370,2370),('Ҿ',2335,2335),('Ҿ',2336,2336),('վ',2379,2379),('Ҿó',2337,2337),('ѡɳ',2045,2045),('',2037,2037),('Ԩ',2038,2038),('Ԩ',2326,2326),('áԨ',2350,2350),('',2039,2039),('ê',2351,2351),('',2327,2327),('êҵ',2352,2352),('÷Թ',2355,2355),('෾',2289,2289),('',2343,2343),('๵',2307,2307),('',2342,2342),('',2040,2040),('þѹ',2358,2358),('þѹ',2359,2359),('þ',2357,2357),('þ',2356,2356),('ó',2386,2386),('ó',2388,2388),('ó',2389,2389),('ó',2390,2390),('ó',2387,2387),('ѵ',2391,2391),('ѷ',2385,2385),('Ѳ',2392,2392),('Ѳ',2393,2393),('Ѳ',2394,2394),('ѵ',2395,2395),('Ѫ',2402,2402),('',2396,2396),('',2401,2401),('Ԫ',2397,2397),('Ԫ',2398,2398),('Դ',2399,2399),('Է',2400,2400),('ʪ',2404,2404),('',2403,2403),('Ѵ',2384,2384),('ء',2232,2232),('ءѭ',2233,2233),('ءԨ',2235,2235),('ءԵ',2236,2236),('ءյ',2237,2237),('ءҹ',2234,2234),('ء',2238,2238),('آ',2239,2239),('آʴš',2242,2242),('آѹ',2243,2243),('آĴ',2241,2241),('آ',2240,2240),('آ',2244,2244),('ؤ',2245,2245),('ؤ',2246,2246),('ب',2247,2247),('بԵ',2248,2248),('بԵ',2250,2250),('بԵ',2249,2249),('بԹ',2251,2251),('بԹ',2252,2252),('بԹ',2253,2253),('ت',2255,2255),('ت',2258,2258),('تԹ',2259,2259),('تҴ',2256,2256),('تԵ',2260,2260),('تҵ',2257,2257),('تԹ',2261,2261),('ت',2254,2254),('ر',2262,2262),('س',2263,2263),('شҷ',2265,2265),('شʧǹ',2264,2264),('ش',2266,2266),('شѵ',2270,2270),('ش',2269,2269),('ش',2271,2271),('ش鹷',2272,2272),('شҪ',2267,2267),('شҾ',2268,2268),('ط',2282,2282),('ط',2283,2283),('طȹ',2284,2284),('ط',2288,2288),('طԵ',2285,2285),('طԹ',2286,2286),('طԾ',2287,2287),('طѲ',2280,2280),('طѡ',2281,2281),('ط쾧',2278,2278),('طԡҨ',2274,2274),('طԪ',2275,2275),('طҷԾ',2273,2273),('طԹѹ',2276,2276),('طԹ',2277,2277),('طԾó',2279,2279),('ظ',2294,2294),('ظ',2295,2295),('ظ',2296,2296),('ظѡ',2293,2293),('ظԴ',2292,2292),('ظҷԾ',2290,2290),('ظҹԸ',2291,2291),('عѷ',2299,2299),('عѹ',2300,2300),('عѹ',2301,2301),('ع',2306,2306),('ع',2303,2303),('ع',2304,2304),('ع',2305,2305),('عԵ',2302,2302),('ع',2297,2297),('ع',2298,2298),('ػճ',2309,2309),('ػдɰ',2308,2308),('ػд',2312,2312),('ػ',2311,2311),('ػҳ',2310,2310),('ػѭ',2313,2313),('ؾ',2316,2316),('ؾ',2318,2318),('ؾó',2317,2317),('ؾѲ',2320,2320),('ؾѵ',2321,2321),('ؾ',2325,2325),('ؾ',2324,2324),('ؾԪ쪭',2322,2322),('ؾԹ',2323,2323),('ؾ',2319,2319),('ؾ',2315,2315),('ؾ',2314,2314),('GEORGE',21,21),('.ԭ',2457,2457),('ѵ',2515,2515),('෾',2514,2514),('ѡ',2516,2516),('',2517,2517),('ѷ',2534,2534),('ѡɳ',2518,2518),('æ',2535,2535),('ê',2513,2513),('ó',2536,2536),('öԷ',2540,2540),('ö',2538,2538),('ö',2539,2539),('ö',2537,2537),('๵',2530,2530),('ó',2542,2542),('Է Թ๪',2543,2543),('',2544,2544),('',2545,2545),('',2546,2546),('',2551,2551),('͹',2547,2547),('',2548,2548),('ѭ',2549,2549),('ѭ',2550,2550),('ѹ',2496,2496),('ѡ',2507,2507),('',2555,2555),('ó',2556,2556),('Ҵ',2505,2505),('વ',2501,2501),('ô',2506,2506),('പ',2503,2503),('Ѳ',2508,2508),('ѹ',2509,2509),('',2511,2511),('',2557,2557),('',2558,2558),('ѡ',2510,2510),('',2559,2559),('Է',2512,2512),('Ԫ',2497,2497),('Ԫ',2552,2552),('Ԫ ',2498,2498),('Ԫҵ',2499,2499),('Ԫҵ',2500,2500),('ԭ',2502,2502),('Ե',2519,2519),('Թѹ',2504,2504),('Թ',2553,2553),('Թ',2520,2520),('Թ',2554,2554),('Ĵ',2541,2541),('è',2522,2522),('ê',2523,2523),('êس',2524,2524),('óѭ',2525,2525),('⳷',2459,2459),('÷',2526,2526),('÷Ԫ',2527,2527),('ùԵ',2528,2528),('⹪',2495,2495),('ùت',2529,2529),('þó',2531,2531),('þԹ',2532,2532),('þԹ',2533,2533),('س',2560,2560),('سѵ',2561,2561),('س',2562,2562),('س',2563,2563),('س',2564,2564),('ظѹ',2521,2521),('ª',2567,2567),('ҹ',2574,2574),('Ф礷',2573,2573),('·Ծ',2571,2571),('',2612,2612),('',2570,2570),('ʷ ',2572,2572),('ʷ ',2723,2723),('ͤ ',2568,2568),('ͤ',2569,2569),('ó',2594,2594),('',2592,2592),('ó',2593,2593),('Ѥപ',2575,2575),('ѤԷ',2578,2578),('ѤԹ',2579,2579),('Ѥ',2580,2580),('ѤþѨ',2577,2577),('Ѥþ',2576,2576),('ѧʹ',2581,2581),('Ѩ',2582,2582),('Ѫ',2583,2583),('ѭ',2587,2587),('ѭҾ',2584,2584),('ѭ',2585,2585),('ѭ',2586,2586),('ѭ',2588,2588),('Ѯ',2589,2589),('ѹ',2590,2590),('ѻ',2591,2591),('ѹ',2616,2616),('',2617,2617),(' ê',2641,2641),('ó',2606,2606),('',2615,2615),(' Ե',2613,2613),('ػ⫹ԤԤѾ',2614,2614),('ѡ',2618,2618),('',2607,2607),('',2621,2621),('',2633,2633),('ó',2611,2611),('',2622,2622),(' ҩ (ູѹ',2623,2623),('ѵ',2624,2624),('',2620,2620),('ó',2625,2625),('ҡ',2608,2608),('ҳ',2609,2609),('Ҿ',2610,2610),('Ҿ',2619,2619),('',2642,2642),('ꡫ Թ๪ਹ ',2634,2634),('',2632,2632),('Ҥ',2595,2595),('ԧ˷',2635,2635),('Ҩç',2596,2596),('ҫ- ',2597,2597),('ҳѹ',2598,2598),('ҷԡ',2599,2599),('շի',2643,2643),('ҷԵ',2600,2600),('ԷԾ',2636,2636),('Թ()',2638,2638),('ӹ',2626,2626),('ҹѴ',2603,2603),('ҹѹ',2604,2604),('ӹҨ',2627,2627),('Թ䫷',2637,2637),('Թ',2639,2639),('ҹ',2601,2601),('ҹ',2602,2602),('ҹҾ',2605,2605),('Ծ',2640,2640),('Ӿ',2628,2628),('Ӿó',2629,2629),('Ӿѹ',2631,2631),('Ӿ',2630,2630),('صˡ()',2724,2724),('ŧó',2566,2566),('ŧ',2565,2565),('ͧҨ',2458,2458),('ʹá',2460,2460),('ʹ',2461,2461),('ʹѡ',2462,2462),('ʹ',2463,2463),('ʹപ',2465,2465),('ʹžѲ',2464,2464),('͵Թت',2466,2466),('͵Ծ',2467,2467),('ͶԪ',2468,2468),('͸Ի',2469,2469),('͹Ѫ',2473,2473),('͹ѭ',2474,2474),('͹ѹѡ',2476,2476),('͹ѹ',2475,2475),('͹ó',2471,2471),('͹Ү',2470,2470),('͹',2472,2472),('͹',2491,2491),('͹ѡ',2489,2489),('͹ѵ',2490,2490),('͹Ѳ',2492,2492),('͹ó',2494,2494),('͹ѡ',2493,2493),('͹ءԵ',2477,2477),('͹ء',2478,2478),('͹ت',2479,2479),('͹تԵ',2480,2480),('͹ش',2481,2481),('͹ص',2483,2483),('͹ص',2482,2482),('͹طԵ',2484,2484),('͹ؾ',2487,2487),('͹ؾѹ',2488,2488),('͹ؾ',2485,2485),('͹ؾ',2486,2486),('',2665,2665),('',2667,2667),('Ҿ',2666,2666),('෹',2660,2660),('',2673,2673),('',2674,2674),('',2644,2644),('ɳ',2672,2672),('',2661,2661),('',2675,2675),('',2668,2668),('ѵ',2670,2670),('ó',2671,2671),('þ',2669,2669),('سǴ',2645,2645),('ش',2646,2646),('ش',2654,2654),('شԤ ԤԻ',2650,2650),('شþѹ',2652,2652),('شѡ',2653,2653),('شѡɳ',2651,2651),('ش',2648,2648),('شѹ',2649,2649),('ش',2647,2647),('ص',2655,2655),('صˡͺʵԡ',2656,2656),('ط',2657,2657),('طó',2658,2658),('ط',2659,2659),('غ',2662,2662),('غó',2664,2664),('غžó',2663,2663),('KAWAIJIT',22,22),('KAWALJIT',23,23),('KOJI',24,24),('LOUIS',25,25),('PETER',26,26),('SHERMAN',27,27),('TAN',28,28),('Willem Arnold',29,29),('WONG',30,30),('WU',31,31),('',1718,1718),('´',1721,1721),('',1719,1719),('ͧ',1720,1720),('ѡ',1724,1724),('ѡɳ',1723,1723),('ѡ',1722,1722),('ѭ',1725,1725),('Ѵ',1726,1726),('Ѵó',1727,1727),('Ѵ',1728,1728),('ѷѡ',1729,1729),('',1734,1734),('ѳ',1730,1730),('ó',1735,1735),('',1732,1732),('',1731,1731),('Թó',1733,1733),('Դ',1716,1716),('Ե',1717,1717),('ͪ',1736,1736),('',1596,1596),('ǷԹ',1953,1953),('...Թ๪',2721,2721),('...Թ๪ (Ҫ)',2718,2718),('..ʹҹ ෤ ӡѴ',2719,2719),('..͹ҹ ෤ ӡѴ',2720,2720),('',2722,2722),('෾',215,215),('ä',214,214),('øѪ',216,216),('ѵ',575,575),('',574,574),('',576,576),('¹ѹ',573,573),('С',709,709),('ç',726,726),('෾',725,725),('÷',724,724),('',805,805),(' ͹ ͹ Ŵ',806,806),(' ͹ ྐྵ',807,807),('- ..',824,808),('Ť͹صҡ',821,822),('¹Ե',820,821),('§觷',808,809),('ѳ',810,811),('ŷ )',813,814),('繷 )',811,812),('繷',812,813),('ʵԡ',819,820),('Թ ԡ',823,824),('Թ ͵͹÷',822,823),('¤Թ',809,810),('´͹ྐྵ',814,815),('µԵ',815,816),('¸ҹ',817,818),('¸ҾҳԪ',816,817),('¾͡',818,819),('ķ',1714,1714),('ķԪ',1715,1715),('伷',1292,1292),('',1485,1485),('è',1486,1486),('Է',1481,1481),('ʳ',1480,1480),('Ѫ',1482,1482),('ѵ',1483,1483),('Թ',1484,1484),('ķ',1479,1479),('',1488,1488),('',1490,1490),('',1489,1489),('԰',1491,1491),('Թ',1487,1487),('侱',1477,1477),('侺',1478,1478),('.շԾ ͹ᵹ',32,32),('íԡ',65,65),('óԡ',66,66),('óԡ',67,67),('Է',69,69),('',68,68),('Шҫ',72,72),('ͧ',70,70),('ͧԾ',71,71),('ձ',73,73),('',49,49),('Ѫ',55,55),('ѵ',56,56),('',54,54),('ó',57,57),('ũѵ',50,50),('ŷԾ',51,51),('ž',52,52),('žó',53,53),('á',60,60),('á',58,58),('á',59,59),('ê',61,61),('ó',62,62),('ùѹ',63,63),('û',64,64),('ا෾Ե',74,74),('اػó',76,76),('ا¤鹷 Թ๪',75,75),('س',77,77),('',93,93),('',94,94),('õ',98,98),('ѹ',97,97),('Ԫ',95,95),('Դ',96,96),('ͺ',100,100),('ͺ',102,102),('ͺ',99,99),('ͺح',101,101),(' ',103,103),('Ҷ',117,117),('ҷ',118,118),('',119,119),('ѵ',121,121),('ҳ',120,120),('ѭ',104,104),('ѭѤ',105,105),('ѭ',106,106),('ѭ',107,107),('ѭ',108,108),('ѳԡ',110,110),('ѳ',109,109),('ѳ',111,111),('ѹѵ',116,116),('ѹ',112,112),('ѹԡ',113,113),('ѹ',115,115),('ѹԪ',114,114),('',128,128),('Է',127,127),('˧',134,134),('',157,157),('õ',158,158),('س',129,129),('',130,130),('觡ҭ',135,135),('',133,133),('Ԩó',137,137),('Ԩ',136,136),('ҭó',122,122),('ҭ',123,123),('Եԡ',153,153),('Եԡó',154,154),('Եԡѭ',155,155),('ԵԪҭ',156,156),('Ե',138,138),('Եѵ',150,150),('Ե',148,148),('Ե',149,149),('ԵѲ',151,151),('Եѡ',152,152),('Եԡѹ',139,139),('ԵԪ',140,140),('Եԭ',141,141),('ԵԹѹ',142,142),('ԵԾѲ',146,146),('ԵԾѹ',147,147),('ԵԾ',145,145),('ԵԾ',143,143),('ԵԾ',144,144),('Ӹ',131,131),('ҹ',124,124),('ҹ',125,125),('ҹ',126,126),('Ӿ',132,132),(' Թʵ',169,169),('ɮ',84,84),('ɮ',85,85),('ɮվ',86,86),('ɳ',89,89),('ɳ',90,90),('ɳ',91,91),('ɳ',88,88),('ɳ',87,87),('ɴ',92,92),('Ⱦó',83,83),('Īó',78,78),('ĵ',80,80),('ĵ',82,82),('ĵԡҹ',81,81),('ĵԸ',79,79),('',35,35),('',33,33),('',34,34),('ѭ',36,36),('ɰ',48,48),('',37,37),('ѵ',43,43),('ó',45,45),('',46,46),('ҭ',47,47),('ķ',44,44),('ҭ',38,38),('',39,39),('',40,40),('ت',41,41),('',42,42),('طѹ',159,159),(' ͹ 硫',160,160),('Һ',168,168),('',167,167),('',163,163),('Ǵ',165,165),('',166,166),('Ŵ',164,164),('Źѹ',161,161),('Ź',162,162),('ѭͧ',228,228),('ѭ͹',231,231),('ѭ',223,223),('ѭ͹',225,225),('ѭ',227,227),('ѭ',230,230),('ѭؾ',229,229),('ѭ',224,224),('ѭ',226,226),('Ծ',233,233),('ѵҳ',232,232),('',217,217),('õ',218,218),('',219,219),('ѡ',220,220),('ɰ',221,221),('ɰ',222,222),('عͧ',234,234),('',249,249),('ҿʷ',250,250),('Ԫ',247,247),('ѡ',248,248),('હ',238,238),('',244,244),('',246,246),('Ԥ ͹ ê',251,251),('§',257,257),('˧',256,256),('ʪ',253,253),('ó',255,255),('ҤԹ',254,254),('ҫ',252,252),('ح',260,260),('ٻҹ',261,261),('പ',237,237),('',236,236),('ز',240,240),('',241,241),('',242,242),('ҡ',239,239),('ص',243,243),('',245,245),('سҡ',258,258),('سշ',259,259),('',273,273),('Ԩ',272,272),('',298,298),('',285,285),('ѡ',299,299),('ø',287,287),('¾',286,286),('ʪ',290,290),('ʾ',291,291),('',289,289),('ѭ',288,288),('',294,294),('ó',295,295),('Թ',292,292),('Թ',293,293),('٭',297,297),('ظԴ',296,296),('ѭ',300,300),('ѡ',304,304),('ѡѵ',305,305),('ѡ',307,307),('ѡԹ',306,306),('ѡáɳ',302,302),('ѡáĪ',301,301),('ѡþѹ',303,303),('ѡѯ',308,308),('Ѵҧҹ繨',309,309),('ѵô',310,310),('ѹ',311,311),('ѹ',314,314),('ѹѵ',321,321),('ѹ',315,315),('ѹ',320,320),('ѹ',322,322),('ѹ',323,323),('ѹش',324,324),('ѹԾ',316,316),('ѹ',317,317),('ѹ',318,318),('ѹ',319,319),('ѹ',326,326),('ѹ',327,327),('ѹ',329,329),('ѹó',328,328),('ѹԡ',325,325),('ѹ',312,312),('ѹ',313,313),('ѷ',361,361),('',362,362),('ԭ',344,344),('ó',363,363),('Ѳ',364,364),('',369,369),('Ѳ',386,386),('ѡ',370,370),('йѹ',385,385),('о',367,367),('оó',368,368),('ѡ',365,365),('ѡ',384,384),('ش',366,366),('෤Ԥ (Ź)',388,388),('',343,343),('Ѫ',371,371),('Ѱ',372,372),('ó',376,376),('ѵ',333,333),('',377,377),('',378,378),('ó',379,379),('',380,380),('ز',381,381),('Ҥ',373,373),('ҹت',374,374),('Ҿ',375,375),('þ',359,359),('þó',383,383),('þѹ',360,360),('ѵ',338,338),('ó',339,339),('س',334,334),('س',335,335),('عѹ',336,336),('غص',337,337),(' ᤻Ե ()',387,387),('ͧ',345,345),('Գ',346,346),('Ե',354,354),('Եó',355,355),('ԵŴ',353,353),('Ե',349,349),('Ե',347,347),('Ե',348,348),('Ե',350,350),('Ե',351,351),('ԵԹѹ',352,352),('ҵç',331,331),('ҵù',332,332),('ҵؾ',330,330),('շի çѹ)',382,382),('ӹ',340,340),('ӹ',341,341),('Թ',356,356),('Թر',357,357),('Թ',358,358),('ӻ',342,342),('ѡ',277,277),('ѡ',278,278),('ѡɳ',279,279),('',275,275),('ų',276,276),('ç',283,283),('ķ',284,284),('ؾ',280,280),('ؾѹ',282,282),('ؾ',281,281),('ѵ',395,395),('',397,397),('ó',398,398),('',399,399),('ѡɳ',400,400),('Ŵ',396,396),('رѵ',393,393),('ر',391,391),('ر',392,392),('رó',394,394),('رҷԾ',389,389),('رҾѹ',390,390),('ó',419,419),('͹',420,420),('ѵó',422,422),('ѵ',423,423),('ѵê',421,421),('ѹѵ',425,425),('ѹ',424,424),('',416,416),('ͧ',417,417),('Ҵ',418,418),(' ',426,426),('ͨ',427,427),('.ѡҹ',437,437),('',450,450),('',454,454),('ٹت',455,455),('¾',456,456),('',463,463),('Ѫ',461,461),('Ѷѹ',462,462),('ó',460,460),('Թѵ',465,465),('Թ',464,464),('Ҿ',459,459),('¹',458,458),('ٹت',452,452),('ٹط',453,453),('',451,451),('',479,479),('Ե',478,478),('ǹ',475,475),('ǹ',476,476),('ǹ',477,477),('͹',485,485),('й',484,484),('',480,480),('ѭѭ',483,483),('ͩѵ',481,481),('ͷԾ',482,482),('',509,509),('',508,508),('ѵ',511,511),('ѷ',505,505),('',506,506),('§',507,507),('ԭʵ',496,496),('ط',510,510),('Ѳ',512,512),('Է',513,513),('Թ',514,514),('ªҭ',498,498),('ª',497,497),('³ç',499,499),('¸Ѳ',500,500),('¹ѹ',502,502),('¹',501,501),('¾',503,503),('¾',504,504),('Ѫ',489,489),('Ѫ',488,488),('Ѫ',490,490),('Ѫ',491,491),('Ѫ',493,492),('Ѫ',492,493),('Ѫ',486,486),('Ѫ',487,487),('ѭ',495,495),('ѭ',494,494),('',524,524),('ѳ',526,526),('Ҿ',534,534),('',525,525),('ҭ',515,515),('ҭط',518,518),('ҭѡ',519,519),('ҭ',516,516),('ҭç',517,517),('Դ',529,529),('ҵ',520,520),('ҵԪ',521,521),('ҹ',522,522),('Թ',530,530),('Թѵ',532,532),('ԹѲ',533,533),('ӹ',528,528),('ӹҭ',527,527),('ҹ',523,523),('Թѹ',531,531),('',544,544),('õ',545,545),('ѡ',553,553),('٨Ե',546,546),('٨Ե',547,547),('٪',548,548),('٪ҵ',549,549),('٪վ',550,550),('پ',551,551),('پ',552,552),('',468,468),('',469,469),('ҡ',470,470),('ԡ',471,471),('Դ',472,472),('Ե',473,473),('Ե',474,474),('Ÿ',467,467),('ŸԪ',466,466),('',457,457),('Ѫ',438,438),('ҡ',439,439),('ó',442,442),('',443,443),('⪵',444,444),('ѭ',445,445),('Ѱ',446,446),('ѹó',447,447),('',448,448),('Դ',449,449),('ѹ',440,440),('',441,441),('蹨Ե',535,535),('',542,542),('',541,541),('',539,539),('',540,540),('վ',543,543),('شҾ',536,536),('ص',538,538),('صԡҭ',537,537),('͹',577,577),(' ',580,580),(' ',581,581),('...Թʵ',584,584),('..صˡ',582,582),('..Ť',583,583),('繨觫Ѿ',586,586),(' ا෾',578,578),('ԡ ()',579,579),('մ صˡ',585,585),('',587,587),('ҳѤ',590,590),('չ',591,591),('ǧ',592,592),('ԵѪ',605,605),('Եѵ',606,606),('Ե',604,604),('Ե',600,600),('Եԡҹ',598,598),('ԵԳѰ',599,599),('ԵԹѹ',601,601),('ԵԾ',603,603),('ԵԾ',602,602),('Եҹ',597,597),('ҹѹ',593,593),('ҹ',595,595),('ҹԵ',594,594),('һԷ',596,596),('ت',607,607),('ѷ',609,609),('ѷáó',610,610),('çѡ',617,617),('çѡ',619,619),('çķ',618,618),('ç',611,611),('çԷ',615,615),('çѡ',616,616),('çķ',614,614),('ç',612,612),('çѪ',613,613),('˷',620,620),('Ѫ',621,621),('ѭ',622,622),('Ѯ',623,623),('Ѯó',624,624),('ѯ',625,625),('Ѱ',626,626),('Ѱ',645,645),('Ѱ',646,646),('Ѱ',643,643),('Ѱ',644,644),('Ѱ',647,647),('ѰѪ',648,648),('ѰѲ',649,649),('Ѱѵ',650,650),('Ѱز',651,651),('Ѱѭ',653,653),('Ѱѡ',652,652),('Ѱ˷',654,654),('Ѱԡ',655,655),('Ѱó',627,627),('Ѱҹ',629,629),('Ѱĵ',628,628),('Ѱ',630,630),('Ѱ',632,632),('Ѱѭ',631,631),('Ѱ',633,633),('Ѱ',634,634),('Ѱѹ',636,636),('Ѱ',635,635),('Ѱó',637,637),('Ѱ',641,641),('Ѱ',642,642),('Ѱ',638,638),('Ѱ',639,639),('Ѱ',640,640),('ç',657,657),('Ԫҡ',656,656),('Ե',608,608),('ت',658,658),('쪹',661,661),('س',662,662),('ǧѵ',674,674),('ǧ',667,667),('ǧ͹',669,669),('ǧ',673,673),('ǧ˷',675,675),('ǧ',665,665),('ǧѹ',666,666),('ǧ',668,668),('ǧ',670,670),('ǧ',671,671),('ǧ',672,672),('͡',676,676),('..͹ ()',695,695),('á',692,692),('ѵ',680,680),('ó',681,681),('ԡ',682,682),('Գ',683,683),('Թ',684,684),('ҹ',679,679),('ç',689,689),('ç',690,690),('ó',677,677),('ù',678,678),('Թ',688,688),('س',685,685),('',687,687),('ǻС',686,686),('',691,691),('ȡ',693,693),('ʷѵ',694,694),('Ĵ',663,663),('ķ',664,664),('',659,659),('ؾ',660,660),('Ե',701,701),('Եѳ',702,702),('ɮ',698,698),('ɳ',699,699),('ɴ',700,700),('Ѳ',697,697),('¾',696,696),('ѹ',712,712),('Թʵԡ',711,711),('ͨѡ',710,710),('觨ʹ',713,713),('',714,714),('',715,715),('',717,717),('',718,718),('꡵',716,716),('ѡɳ',719,719),('',729,729),('',730,730),('',731,731),('',733,733),('ҳؾ',732,732),('ѡ',727,727),('Ե',728,728),('ȹ',745,745),('Ѿäʴ',746,746),('ç',737,737),('çز',741,741),('ç',742,742),('çѡ',743,743),('ç',744,744),('ç»蹷',738,738),('ç',739,739),('ç',740,740),('',748,748),('Ѳ',752,752),('',753,753),('ѡ',754,754),('Ԫ',747,747),('ժ',749,749),('ջ',750,750),('վ',751,751),('ҷѲ',773,773),('Ⱦ',755,755),('Ⱦ',756,756),('ͧ',759,759),('ͧآ',763,763),('ͧԹ',764,764),('ͧ',757,757),('ͧ',758,758),('ͧҹ',760,760),('ͧѹ',761,761),('ͧѹ',762,762),('ó',772,772),('ȹó',768,768),('ȹ',770,770),('ȹ',771,771),('ȹվ',769,769),('ѡ',765,765),('Ѵ',766,766),('Ѻ',767,767),(' Թʷ',791,791),('..ѷ ͹ չ',794,794),('...Թ๪',795,795),('...;',792,792),('...Թʷ',793,793),(' ⴿ Թʵ',796,796),('',789,789),('Ⱦ',790,790),('Ԧ',774,774),('Թ᤹ Թʷ',775,775),('Ծó',778,778),('Ծس',779,779),('Ծ',780,780),('Ծ',781,781),('Ծ',782,782),('ԾǴ',777,777),('ԾҾ',776,776),('Ծó',783,783),('Ծ',784,784),('Ծ',785,785),('Ծش',786,786),('Ծó',788,788),('Ծҡ',787,787),('',798,798),('ԹԷ ԫ',797,797),('ѡ',735,735),('',736,736),('ʵ',861,861),('٭',860,860),('',857,857),('',858,858),('ѹ',859,859),('ѵ',865,865),('Ѫ',863,863),('Ѫ',864,864),('ѪѲ',869,869),('ѪǴ',868,868),('Ѫ',866,866),('Ѫ',867,867),('ѭô',877,877),('ѭ',870,870),('ѭ',871,871),('ѭѲ',872,872),('ѭԪ',873,873),('ѭѹ',874,874),('ѭ',875,875),('ѭԷ',876,876),('ѷ',896,896),('Ҿ',897,897),('Ѳ',898,898),('',901,901),('Ѳ',904,904),('Ъ',902,902),('о',903,903),('ѡ',899,899),('ҹԾѹ',900,900),('',883,883),('Թ',884,884),('çѵ',886,886),('ç',885,885),('ê',890,890),('÷Ծ',882,882),('ùت',891,891),('þѲ',895,895),('þ',894,894),('þ',892,892),('þ',893,893),('ҡ',878,878),('Ҵ',879,879),('Դѵ',887,887),('ԵԹѹ',888,888),('ҹ',881,881),('Թաҭ',889,889),('ҹԹ',880,880),('ĵ',862,862),('',826,826),('',825,825),('Ѱ',827,827),('è',834,834),('Ѫ',832,832),('ѵ',833,833),('Ѳ',836,836),('ѹ',837,837),('Ե',838,838),('Է',839,839),('Ǵ',835,835),('Ѫ',841,841),('Է',840,840),('',846,846),('ѪԴ',842,842),('ѭ',843,843),('ѹ',844,844),('ѹ',845,845),('',847,847),('ó',850,850),('ѡ',852,852),('',851,851),('Ѫ',853,853),('ɰ',855,855),('Ҥͺ ѵԹ Ңҡ',849,849),('Ҥáاظ ',848,848),('Դ',854,854),('',856,856),('',828,828),('ĵ',829,829),('',830,830),('',831,831),(' Ԫ շ ',906,906),(' ',905,905),('',946,946),('ѷ',939,939),('õ',947,947),('ó',929,929),('',930,930),('ó',931,931),('',932,932),('',940,940),('',945,945),('ط',934,934),('ó',935,935),('',943,943),('ɰ',944,944),('Թ',936,936),('Թ',941,941),('Թപ',942,942),('Ҿ',933,933),('ê',937,937),('',928,928),('þ',938,938),('ѵ',956,956),('',960,960),('Ũѹ',957,957),('ũ',958,958),('ž',959,959),('ǡó',954,954),('Ǿ',955,955),('ѹꡫ',992,992),('ྪ',991,991),('',994,994),('ӷԾ',988,988),('ӽ',989,989),('¹',980,980),('ѭ',961,961),('ѯ',962,962),('ѱ',963,963),('ѷ',964,964),('ѷ',965,965),('ѹ',966,966),('ѹѵ',973,973),('ѹ',972,972),('ѹó',975,975),('ѹǧ',974,974),('ѹѡ',976,976),('ѹ',977,977),('ѹ',979,979),('ѹԡҹ',978,978),('ѹ',967,967),('ѹ',968,968),('ѹ',969,969),('ѹ',970,970),('ѹ',971,971),('',983,983),('',1016,1016),('',1017,1017),('ѹ',1018,1018),('',985,985),('',1015,1015),('ѵ',986,986),('ó',1019,1019),('Թ',984,984),('ź',1024,1024),('',998,998),(' ',993,993),('ب',1020,1020),('ص',1021,1021),('ૹ鹵͹ ᾤࡨ',1025,1025),('Ѳ',1026,1026),('ѵ',1027,1027),('ѵ',1028,1028),('ҵ',1029,1029),('Թ',987,987),('',1030,1030),('',1033,1033),('Ҫ',1031,1031),('Ҿ',1032,1032),('',1022,1022),('غ',1023,1023),('ԡ',995,995),('Ԥ',996,996),('Ԫêվ',997,997),('үǧ',981,981),('Դ',999,999),('Դ',1000,1000),('Ե',1001,1001),('ҵ',982,982),('Ե',1002,1002),('Ե',1003,1003),('յ',1034,1034),('Ե',1005,1005),('ԵԾ',1004,1004),('Է',1006,1006),('Էȹ',1007,1007),('Էȹ',1008,1008),('ԸǴ',1009,1009),('Ի͹ྐྵ()',1010,1010),('Ծѷ',1013,1013),('Ծѹ',1014,1014),('Ӿ',990,990),('Ծ',1012,1012),('Ծ',1011,1011),('žó',953,953),('ҳ',952,952),('',951,951),('ij',948,948),('Ĵ',949,949),('ķ',950,950),('',907,907),('û ͹Ҥ (1994)',908,908),('ѡɳ',911,911),('',909,909),('ت',910,910),('',912,912),('',914,914),('Թ',913,913),('ѡ',915,915),('ѵ',924,924),('',923,923),('',916,916),('ó',926,926),('Ҿ',927,927),('Է',925,925),('',917,917),('',918,918),('ѵ',919,919),('',921,921),('',922,922),('',920,920),('',1039,1039),('',1041,1041),('ʺ',1040,1040),('ت',1037,1037),('ت',1038,1038),('تԹ',1035,1035),('تҶ',1036,1036),('§',1050,1050),('Դ',1049,1049),('',1051,1051),('è',1047,1047),('è',1048,1048),('õ',1052,1052),('ê',1053,1053),('ѧ',1054,1054),('ѭ',1055,1055),('ѭѵ',1056,1056),('ѳԵ',1057,1057),('ѳԵ',1058,1058),('ѵáاظ',1060,1060),('ѵáا',1059,1059),('ѹѡ',1061,1061),(' ͹ ʡ',1067,1067),(' ê ӡѴ',1066,1066),('..',1068,1068),('...硡ҧ',1069,1069),('ا',1064,1064),('ǵᾤ',1065,1065),('ҧ͡շ緷',1062,1062),('ҹ',1063,1063),(' ()',1111,1111),('ῤ ()',1112,1112),('',1044,1044),('ѵ',1045,1045),(' Թ ',1046,1046),('ѭ',1101,1101),('Թ',1102,1102),('',1103,1103),('',1108,1108),('ó',1109,1109),('Թ',1105,1105),('Ҿ',1104,1104),('',1110,1110),('ɡ',1106,1106),('ɺ',1107,1107),('ح',1085,1085),('ح',1086,1086),('حʧ',1098,1098),('حѡ',1087,1087),('حѧ',1084,1084),('ح',1083,1083),('ح',1090,1090),('حõ',1070,1070),('حԴ',1075,1075),('ح',1091,1091),('ح',1093,1093),('ح ͻ',1092,1092),('حԹ',1095,1095),('حʹͧ',1094,1094),('ح׺',1096,1096),('حآ',1097,1097),('حѺ',1088,1088),('ح',1089,1089),('ح',1071,1071),('ح',1072,1072),('ح',1073,1073),('حغ',1074,1074),('ح͹',1076,1076),('حѾ',1077,1077),('ح',1078,1078),('حͧ',1079,1079),('ح',1080,1080),('حԷ',1081,1081),('ح',1082,1082),('سԵ',1099,1099),('ػ',1100,1100),('ª',1179,1179),('',1186,1186),('',1171,1171),('԰',1193,1193),('¾',1172,1172),('',1163,1163),('',1164,1164),('Ҿ',1165,1165),('',1166,1166),('ó',1169,1169),('',1170,1170),('Թ',1175,1175),('Ҿ',1167,1167),('Ҿó',1168,1168),('',1177,1177),('',1178,1178),('',1173,1173),('§',1174,1174),('ͧ',1156,1156),('ط',1176,1176),('ѵ',1180,1180),('ѵ',1181,1181),('ճ',1185,1185),('Ե',1182,1182),('Է',1183,1183),('Է',1184,1184),('',1190,1190),('ҷ',1188,1188),('Է',1191,1191),('ҹ',1189,1189),('ʧ',1187,1187),('׺',1192,1192),('',1162,1162),('Сͺ',1138,1138),('С',1139,1139),('СԵ',1140,1140),('СԨ',1141,1141),('СԵ',1142,1142),('Фͧ',1143,1143),('ШǺ',1145,1145),('Шѡ',1146,1146),('ШԵ',1147,1147),('ШԵ',1144,1144),('Ъ',1148,1148),('ЪԵ',1149,1149),('Ъ',1150,1150),('г',1151,1151),('дɰ',1152,1152),('зѺ',1153,1153),('зջ',1154,1154),('зԾ',1155,1155),('оѲ',1160,1160),('оѹ',1161,1161),('оķ',1159,1159),('о',1157,1157),('о',1158,1158),('',1132,1132),('Ѫ',1194,1194),('',1200,1200),('ó',1213,1213),('ó',1208,1208),('ö',1201,1201),('Թ',1135,1135),('',1136,1136),('Ǵ',1134,1134),('ȹ',1209,1209),('ȹ',1210,1210),('ҡ',1195,1195),('ҧ',1196,1196),('ժ',1211,1211),('Ҫ',1197,1197),('խ',1212,1212),('ԭ',1202,1202),('ԭ',1203,1203),('ԭ',1204,1204),('ҳ',1198,1198),('ҳ',1199,1199),('Գ',1205,1205),('ҳ',1133,1133),('Է',1206,1206),('Թ',1207,1207),('ص',1137,1137),('ճѪ',1214,1214),('ճ',1215,1215),('ѹ',1216,1216),('ѹ',1217,1217),('ͧ',1218,1218),('ѭ',1219,1219),('ѭ',1220,1220),('ѭҾ',1221,1221),('ѭҾ',1222,1222),('ѳ',1223,1223),('ѷ',1224,1224),('ѷ',1225,1225),('ѷǴ',1226,1226),('ѵ',1246,1246),('ó',1245,1245),('ó',1247,1247),('Ѳ',1248,1248),('',1250,1250),('',1259,1259),('ѡ',1260,1260),('Ъ',1251,1251),('йѹ',1253,1253),('й',1252,1252),('йت',1254,1254),('о',1256,1256),('оѹ',1257,1257),('оѹ',1258,1258),('о',1255,1255),('ѡ',1249,1249),('Ԫҵ',1230,1230),('Ԫҵ',1231,1231),('ճ',1233,1233),('Ҿ',1261,1261),('Ծѹ',1232,1232),('¡ҭ',1239,1239),('¹ѹ',1240,1240),('¹ү',1241,1241),('¾',1244,1244),('¾',1242,1242),('¾',1243,1243),('⹪',1238,1238),('',1237,1237),('˹ѹ',1234,1234),('ѹ',1262,1262),('ҳ',1227,1227),('Ե',1235,1235),('ԵѪ',1236,1236),('ҹ',1228,1228),('ҹྪ',1229,1229),('ó',1119,1119),('',1120,1120),('',1123,1123),('ԭ',1121,1121),('Ծ',1122,1122),('Ѳ',1124,1124),('Դ',1126,1126),('Ե',1127,1127),('',1125,1125),('',1128,1128),('',1130,1130),('',1129,1129),('Ѵ',1131,1131),('س',1263,1263),('',1277,1277),('ͧ',1279,1279),('ͧó',1278,1278),('͹',1280,1280),('¡äѧͧҧӹѡѴا෾ҹ',1285,1285),('Ң˹٪ԹΧ',1281,1281),('Ң˹٫ԹΧ',1282,1282),('Ңع˹٫ԹΧ',1283,1283),('ҹ 繨',1284,1284),('آ',1286,1286),('˭',1289,1289),('༴',1288,1288),('ҡͧ',1272,1272),('Ҿó',1273,1273),('',1274,1274),('Ե',1275,1275),('اѡ',1276,1276),('ʴ',1287,1287),('¡äѧͧҧ ӹѡѴا෾ҹ',1293,1293),('',1319,1319),('',1338,1338),('ó³',1344,1344),('óó',1345,1345),('ó',1347,1347),('óԡ',1346,1346),('ó',1339,1339),('ó',1340,1340),('óǴ',1341,1341),('ó',1342,1342),('ó',1343,1343),('෾',1326,1326),('øԴ',1348,1348),('',1337,1337),('',1349,1349),('',1350,1350),(' 3 ͹Ҥ',1360,1360),(' 3 ',1359,1359),('лᴧ ͹Ҥ',1357,1357),('лᴧ ͹Ҥ ӡѴ',1358,1358),('ǧ',1353,1353),('Ѳ',1355,1355),('ä',1354,1354),('',1356,1356),('ѡ',1351,1351),('',1352,1352),('Ԥ ͹ʵԡ',1362,1362),('Թԫ',1363,1363),('',1361,1361),('á',1320,1320),('èԵ',1321,1321),('ê',1322,1322),('÷',1325,1325),('÷Ծ',1323,1323),('÷Ծ',1324,1324),('ù',1328,1328),('ùԵԿ͹մ',1329,1329),('¹',1317,1317),('ù',1327,1327),('þó',1332,1332),('þ',1335,1335),('þ',1336,1336),('þ',1333,1333),('þ§',1334,1334),('þ',1330,1330),('þ',1331,1331),('ا',1318,1318),('ǧѵ',1372,1372),('ǧ',1371,1371),('ǧͧ',1370,1370),('Թ',1373,1373),('ࡵ',1374,1374),('ʾ',1391,1391),('',1390,1390),('Ѫ',1376,1376),('Ѫ',1377,1377),('Ѫ',1378,1378),('Ѫ',1382,1382),('Ѫó',1379,1379),('Ѫó',1384,1384),('Ѫ',1380,1380),('ѪԹ',1381,1381),('Ѫվ',1383,1383),('Ѫ',1375,1375),('Ѳ',1385,1385),('Ѳ',1387,1387),('Ѳ',1386,1386),('Ѳ',1388,1388),('ѷ',1389,1389),(' ',1397,1397),('.. ʫ',1439,1439),('..ʵԡ ͹ѹ',1440,1440),('..ʵԡ͹ѹ',1441,1441),('..ʷ ͷ',1438,1438),('',1430,1430),('',1428,1428),('ز',1446,1446),('',1448,1448),('ѡ',1451,1451),('о',1450,1450),('о',1449,1449),('Ż',1447,1447),('ҡ͹Թ෤',1396,1396),('',1429,1429),('ɰ',1409,1408),('ɰ',1408,1409),('ય',1406,1406),('ય',1407,1407),('صˡ',1394,1394),('÷ѵ',1444,1444),('෾',1415,1415),('',1420,1420),('ó',1425,1425),('Ѥ',1426,1426),('',1421,1421),('',1427,1427),('쪹',1422,1422),('оó',1423,1423),('',1424,1424),('þѲ',1445,1445),('س',1431,1431),('',1434,1434),('ɰ',1432,1432),('ɰ',1437,1437),('԰',1435,1435),('Է',1436,1436),('ɳ',1433,1433),('ԨԵ',1398,1398),('Ԫ',1401,1401),('Ԫ',1402,1402),('ԪѲ',1403,1403),('ԪԵ',1404,1404),('ԪԵ',1405,1405),('Ԫ',1399,1399),('Ԫ',1400,1400),('Ա',1410,1410),('ҳ',1393,1393),('ҳԪ',1392,1392),('Գش',1411,1411),('Գ',1412,1412),('Է',1413,1413),('Էѡ',1414,1414),('Ըҹ',1416,1416),('չԡ 硫',1442,1442),('չԡ硫',1443,1443),('ҹͧ',1395,1395),('Թ',1417,1417),('Ժ',1418,1418),('ԾѲ',1419,1419),('ŷͧ;_',1454,1454),('ż',1455,1455),('ٹѡ',1453,1453),('ٹѹ',1452,1452),('෾',1366,1366),('Է',1369,1369),('šɳ',1364,1364),('Ū',1365,1365),('žѪ',1367,1367),('žѲ',1368,1368),('Ѥ',1300,1300),('õ',1294,1294),('෾',1296,1296),('෾',1302,1302),('ѡ',1304,1304),('ѹ',1305,1305),('',1301,1301),('͹ѹ',1306,1306),('',1295,1295),('',1303,1303),('ѹ',1298,1298),('ԾѲ',1299,1299),('ȸ',1297,1297),('',1312,1312),('ҹ',1311,1311),('',1307,1307),('',1308,1308),('',1310,1310),('ö',1309,1309),('',1313,1313),('',1314,1314),('ѹ',1315,1315),('Դ',1316,1316),('չԡ 硫',1493,1493),('ԡ',1492,1492);
-SELECT name FROM t1 ORDER BY name;
-DROP TABLE t1;
-
-#
-# Check the following:
-# "a" == "a "
-# "a\0" < "a"
-# "a\0" < "a "
-
-SELECT 'a' = 'a ';
-SELECT 'a\0' < 'a';
-SELECT 'a\0' < 'a ';
-SELECT 'a\t' < 'a';
-SELECT 'a\t' < 'a ';
-
-CREATE TABLE t1 (a char(10) not null) CHARACTER SET tis620;
-INSERT INTO t1 VALUES ('a'),('a\0'),('a\t'),('a ');
-SELECT hex(a),STRCMP(a,'a'), STRCMP(a,'a ') FROM t1;
-DROP TABLE t1;
-
-#
-# Bug#6608
-#
-CREATE TABLE t1 (
- `id` int(11) NOT NULL auto_increment,
- `url` varchar(200) NOT NULL default '',
- `name` varchar(250) NOT NULL default '',
- `type` int(11) NOT NULL default '0',
- `website` varchar(250) NOT NULL default '',
- `adddate` date NOT NULL default '0000-00-00',
- `size` varchar(20) NOT NULL default '',
- `movieid` int(11) NOT NULL default '0',
- `musicid` int(11) NOT NULL default '0',
- `star` varchar(20) NOT NULL default '',
- `download` int(11) NOT NULL default '0',
- `lastweek` int(11) NOT NULL default '0',
- `thisweek` int(11) NOT NULL default '0',
- `page` varchar(250) NOT NULL default '',
- PRIMARY KEY (`id`),
- UNIQUE KEY `url` (`url`)
-) CHARACTER SET tis620;
-
-INSERT INTO t1 VALUES
-(1,'http://www.siamzone.com/download/download/000001-frodo_1024.jpg','The Lord
-of the Rings
-Wallpapers',1,'http://www.lordoftherings.net','2002-01-22','',448,0,'',3805,0,0,
-'');
-INSERT INTO t1 VALUES (2,'http://www.othemovie.com/OScreenSaver1.EXE','O
-Screensaver',2,'','2002-01-22','',491,0,'',519,0,0,'');
-INSERT INTO t1 VALUES
-(3,'http://www.siamzone.com/download/download/000003-jasonx2(800x600).jpg','Jaso
-n X Wallpapers',1,'','2002-05-31','',579,0,'',1091,0,0,'');
-select * from t1 order by id;
-DROP TABLE t1;
-
-
-SET collation_connection='tis620_thai_ci';
--- source include/ctype_filesort.inc
--- source include/ctype_like_escape.inc
---source include/ctype_ascii_order.inc
--- source include/ctype_like_cond_propagation.inc
-SET collation_connection='tis620_bin';
--- source include/ctype_filesort.inc
--- source include/ctype_like_escape.inc
--- source include/ctype_like_cond_propagation.inc
-
-# End of 4.1 tests
-
-
---echo #
---echo # Start of 5.6 tests
---echo #
-
---echo #
---echo # WL#3664 WEIGHT_STRING
---echo #
-
-set names tis620;
-set collation_connection=tis620_thai_ci;
---source include/weight_string.inc
---source include/weight_string_l1.inc
---source include/ctype_pad_space.inc
-select hex(weight_string(cast(0xE0A1 as char)));
-select hex(weight_string(cast(0xE0A1 as char) as char(1)));
-
-set collation_connection=tis620_bin;
---source include/weight_string.inc
---source include/weight_string_l1.inc
---source include/ctype_pad_space.inc
-select hex(weight_string(cast(0xE0A1 as char)));
-select hex(weight_string(cast(0xE0A1 as char) as char(1)));
-
---echo #
---echo # End of 5.6 tests
---echo #
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-9711 NO PAD Collatons
---echo #
-SET character_set_connection=tis620;
-let $coll='tis620_thai_nopad_ci';
-let $coll_pad='tis620_thai_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='tis620_nopad_bin';
-let $coll_pad='tis620_bin';
---source include/ctype_pad_all_engines.inc
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/ctype_uca.test b/mysql-test/t/ctype_uca.test
deleted file mode 100644
index 15a945fde6d..00000000000
--- a/mysql-test/t/ctype_uca.test
+++ /dev/null
@@ -1,679 +0,0 @@
--- source include/have_ucs2.inc
--- source include/have_utf8mb4.inc
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-#
-# Test Unicode collations.
-#
-set names utf8;
-
-#
-# Check trailing spaces
-#
-set collation_connection=utf8_unicode_ci;
-
-select 'a' = 'a', 'a' = 'a ', 'a ' = 'a';
-
-select 'a\t' = 'a' , 'a\t' < 'a' , 'a\t' > 'a';
-select 'a\t' = 'a ', 'a\t' < 'a ', 'a\t' > 'a ';
-
-select 'a' = 'a\t', 'a' < 'a\t', 'a' > 'a\t';
-select 'a ' = 'a\t', 'a ' < 'a\t', 'a ' > 'a\t';
-
-select 'a a' > 'a', 'a \t' < 'a';
-
-#
-# Bug #6787 LIKE not working properly with _ and utf8 data
-#
-select 'c' like '\_' as want0;
-
-#
-# Bug #5679 utf8_unicode_ci LIKE--trailing % doesn't equal zero characters
-#
-CREATE TABLE t (
- c char(20) NOT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-INSERT INTO t VALUES ('a'),('ab'),('aba');
-ALTER TABLE t ADD INDEX (c);
-SELECT c FROM t WHERE c LIKE 'a%';
-#should find 3 rows but only found 2
-DROP TABLE t;
-
-create table t1 (c1 char(10) character set utf8 collate utf8_bin);
-
---source include/ctype_unicode_latin.inc
-
-select group_concat(c1 order by c1) from t1 group by c1 collate utf8_unicode_ci;
-select group_concat(c1 order by c1) from t1 group by c1 collate utf8_icelandic_ci;
-select group_concat(c1 order by c1) from t1 group by c1 collate utf8_latvian_ci;
-select group_concat(c1 order by c1) from t1 group by c1 collate utf8_romanian_ci;
-select group_concat(c1 order by c1) from t1 group by c1 collate utf8_slovenian_ci;
-select group_concat(c1 order by c1) from t1 group by c1 collate utf8_polish_ci;
-select group_concat(c1 order by c1) from t1 group by c1 collate utf8_estonian_ci;
-select group_concat(c1 order by c1) from t1 group by c1 collate utf8_spanish_ci;
-select group_concat(c1 order by c1) from t1 group by c1 collate utf8_swedish_ci;
-select group_concat(c1 order by c1) from t1 group by c1 collate utf8_turkish_ci;
-
-select group_concat(c1 order by c1) from t1 group by c1 collate utf8_czech_ci;
-select group_concat(c1 order by c1) from t1 group by c1 collate utf8_danish_ci;
-select group_concat(c1 order by c1) from t1 group by c1 collate utf8_lithuanian_ci;
-select group_concat(c1 order by c1) from t1 group by c1 collate utf8_slovak_ci;
-select group_concat(c1 order by c1) from t1 group by c1 collate utf8_spanish2_ci;
-select group_concat(c1 order by c1) from t1 group by c1 collate utf8_roman_ci;
-select group_concat(c1 order by c1) from t1 group by c1 collate utf8_esperanto_ci;
-select group_concat(c1 order by c1) from t1 group by c1 collate utf8_hungarian_ci;
-select group_concat(c1 order by c1) from t1 group by c1 collate utf8_croatian_mysql561_ci;
-select group_concat(c1 order by c1) from t1 group by c1 collate utf8_croatian_ci;
-select group_concat(c1 order by c1) from t1 group by c1 collate utf8_german2_ci;
-select group_concat(c1 order by c1) from t1 group by c1 collate utf8_unicode_520_ci;
-select group_concat(c1 order by c1) from t1 group by c1 collate utf8_vietnamese_ci;
-select group_concat(c1 order by c1) from t1 group by c1 collate utf8_thai_520_w2;
-
-ALTER TABLE t1 CONVERT TO CHARACTER SET ucs2 COLLATE ucs2_bin;
-SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_unicode_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_icelandic_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_latvian_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_romanian_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_slovenian_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_polish_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_estonian_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_spanish_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_swedish_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_turkish_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_czech_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_danish_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_lithuanian_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_slovak_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_spanish2_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_roman_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_esperanto_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_hungarian_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_croatian_mysql561_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_croatian_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_german2_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_unicode_520_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1) FROM t1 GROUP BY c1 COLLATE ucs2_vietnamese_ci;
-
-drop table t1;
-
-#
-# Bug#5324
-#
-SET NAMES utf8;
-#test1
-CREATE TABLE t1 (c varchar(255) NOT NULL COLLATE utf8_general_ci, INDEX (c));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B403B11F770308 USING utf8));
-#Check one row
-SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf8)
-COLLATE utf8_general_ci;
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B4 USING utf8));
-#Check two rows
-SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf8)
-COLLATE utf8_general_ci ORDER BY c;
-DROP TABLE t1;
-#test2
-CREATE TABLE t1 (c varchar(255) NOT NULL COLLATE ucs2_unicode_ci, INDEX (c));
-INSERT INTO t1 VALUES (_ucs2 0x039C03C903B403B11F770308);
-#Check one row
-SELECT * FROM t1 WHERE c LIKE _ucs2 0x039C0025 COLLATE ucs2_unicode_ci;
-INSERT INTO t1 VALUES (_ucs2 0x039C03C903B4);
-#Check two rows
-SELECT * FROM t1 WHERE c LIKE _ucs2 0x039C0025
-COLLATE ucs2_unicode_ci ORDER BY c;
-DROP TABLE t1;
-#test 3
-CREATE TABLE t1 (c varchar(255) NOT NULL COLLATE utf8_unicode_ci, INDEX (c));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B403B11F770308 USING utf8));
-#Check one row row
-SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf8) COLLATE utf8_unicode_ci;
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B4 USING utf8));
-#Check two rows
-SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf8)
-COLLATE utf8_unicode_ci ORDER BY c;
-DROP TABLE t1;
-
-CREATE TABLE t1 (
- col1 CHAR(32) CHARACTER SET utf8 NOT NULL
-);
-
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0041004100410627 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0041004100410628 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0041004100410647 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0041004100410648 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0633064A0651062F USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062D06330646 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0642064A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06320627062F0647 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062806310627064A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064706450647 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F062706460634062C0648064A06270646064A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A90647 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A06270631064A062E USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062706460642064406270628 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A0631062706460650 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627062F064806270631062F USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280631062706480646200C06310627 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062E064806270646062F0647 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0648 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A062D062A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0623062B064A0631 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06220646 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0642063106270631 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06AF06310641062A0647 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270646062F USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0634062E0635064A0651062A064A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628062706310632 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270633062A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063906A90633 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270648060C USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F0631 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062D062F0648062F USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628064A0633062A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0648067E0646062C USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06330627064406AF064A060C USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063306270644 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606450627064A0646062F0647 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A06280631064A0632 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645062C06440633 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280648062F060C USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628064A0646 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06350641062D0627062A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A0646 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A9062A06270628 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280647 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x068606340645 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645064A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062E06480631062F USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0686064706310647 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06420648064A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450635064506510645 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06310627 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0646063406270646 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645064A200C062F0647062F060C USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0647063106860646062F USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06390645064400BB USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A9064806340634 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064706500646064A064606AF USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627062D063306270646 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064A062706310634062706370631 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450646062A06340631 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0634062F0647 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F0633062A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A064806270646 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0647064506270646 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064806510644 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0634062E064A0635 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F0627062F USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280627 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A064106270648062A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062D06270644062A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A064106A906510631 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063A064406280647 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F06270631062F USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064A06A9064A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270632 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063106470628063106270646 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606470636062A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064506340631064806370647 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A063106270646 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0646064A0632 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064A06A9 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645062D064206510642 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0637063106270632 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064106310647064606AF USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0645062F06510646 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A063106270646064A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280648062F USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A90627063106470627064A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270648 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0639063106350647 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064506480631 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0633064A06270633064A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064A063106270646060C USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062D064806320647 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063906440645 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F062706460634 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450642062706440627062A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F064A06AF0631 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0648064A06980647 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0646062706450647 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064506480631062F USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628062D062B USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0628063106310633064A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606480634062A0647 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450646 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A064606470627 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0622064606860647 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F064806310647 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064206270645062A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x067E0631062F062706320645 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0698062706460648064A0647 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0648064A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F06390648062A0650 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063306500631 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F0646064A0633064F0646 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063106270633 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0647064A0626062A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0639064406480645200C063406310642064A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280639062F0627064B USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645062F063106330647 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062206410631064A06420627064A064A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F06270646063406AF06270647 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06440646062F0646 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x067E064A06480633062A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0647064606AF06270645064A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x067E0633 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0622063A06270632 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062C064606AF USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062C064706270646 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F064806510645 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063406470631 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A9064506280631064A062C USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450646062A06420644 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A90631062F0646062F USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06470645 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06310641062A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06220646062C0627 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064506270646062F USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0627 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062706A9062A06280631 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606380631 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F06480644062A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F06480628062706310647 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606330628062A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645063306270639062F USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0634062F USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06480632064A0631 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0645062E062A06270631 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06330641064A0631 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627064606AF0644064A0633 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0642064A200C06320627062F0647 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280627063206AF0634062A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0647064506330631 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06220644064506270646064A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06270634 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06220645062F0647 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A906270631064A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x067E0631062F0627062E062A0647 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063906440645064A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x0627062F0628064A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062D062F0651 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064606280648062F060C USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06480644064A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x063906480636060C USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06340627064A062F USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064506470645 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062A0631 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06220646060C USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06470645063306310634 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A90627064606480646 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062E0627064606480627062F06AF064A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06AF06310645064A USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280648062C0648062F USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062206480631062F USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F0648 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06A90627064506440627064B USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x064A06A9062F064A06AF0631 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06AF USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x062F064406280633062A0647 USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06280648062F0646062F USING utf8));
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x06450647064506270646 USING utf8));
-SELECT HEX(CONVERT(col1 USING ucs2)) FROM t1 ORDER BY col1 COLLATE utf8_persian_ci, col1 COLLATE utf8_bin;
-DROP TABLE t1;
-
-#
-# Test all characters that appear in utf8_persia_ci tailoring
-#
-CREATE TABLE t1 (
- a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_persian_ci,
- offs INT NOT NULL
-);
-INSERT INTO t1 VALUES
-(_ucs2 0x066D, 1),(_ucs2 0x064E, 2),(_ucs2 0xFE76, 3),(_ucs2 0xFE77, 4),
-(_ucs2 0x0650, 5),(_ucs2 0xFE7A, 6),(_ucs2 0xFE7B, 7),(_ucs2 0x064F, 8),
-(_ucs2 0xFE78, 9),(_ucs2 0xFE79,10),(_ucs2 0x064B,11),(_ucs2 0xFE70,12),
-(_ucs2 0xFE71,13),(_ucs2 0x064D,14),(_ucs2 0xFE74,15),(_ucs2 0x064C,16),
-(_ucs2 0xFE72,17),
-
-(_ucs2 0xFE7F, 1),(_ucs2 0x0653, 2),(_ucs2 0x0654, 3),(_ucs2 0x0655, 4),
-(_ucs2 0x0670, 5),
-
-(_ucs2 0x0669, 1),(_ucs2 0x0622, 2),(_ucs2 0x0627, 3),(_ucs2 0x0671, 4),
-(_ucs2 0x0621, 5),(_ucs2 0x0623, 6),(_ucs2 0x0625, 7),(_ucs2 0x0624, 8),
-(_ucs2 0x0626, 9),
-
-(_ucs2 0x0642, 1),(_ucs2 0x06A9, 2),(_ucs2 0x0643, 3),
-
-(_ucs2 0x0648, 1),(_ucs2 0x0647, 2),(_ucs2 0x0629, 3),(_ucs2 0x06C0, 4),
-(_ucs2 0x06CC, 5),(_ucs2 0x0649, 6),(_ucs2 0x064A, 7),
-
-(_ucs2 0xFE80, 1),(_ucs2 0xFE81, 2),(_ucs2 0xFE82, 3),(_ucs2 0xFE8D, 4),
-(_ucs2 0xFE8E, 5),(_ucs2 0xFB50, 6),(_ucs2 0xFB51, 7),(_ucs2 0xFE80, 8),
-(_ucs2 0xFE83, 9),(_ucs2 0xFE84,10),(_ucs2 0xFE87,11),(_ucs2 0xFE88,12),
-(_ucs2 0xFE85,13),(_ucs2 0xFE86,14),(_ucs2 0x0689,16),(_ucs2 0x068A,17),
-
-(_ucs2 0xFEAE, 1),(_ucs2 0xFDFC, 2),
-
-(_ucs2 0xFED8, 1),(_ucs2 0xFB8E, 2),(_ucs2 0xFB8F, 3),(_ucs2 0xFB90, 4),
-(_ucs2 0xFB91, 5),(_ucs2 0xFED9, 6),(_ucs2 0xFEDA, 7),(_ucs2 0xFEDB, 8),
-(_ucs2 0xFEDC, 9),
-
-(_ucs2 0xFEEE, 1),(_ucs2 0xFEE9, 2),(_ucs2 0xFEEA, 3),(_ucs2 0xFEEB, 4),
-(_ucs2 0xFEEC, 5),(_ucs2 0xFE93, 6),(_ucs2 0xFE94, 7),(_ucs2 0xFBA4, 8),
-(_ucs2 0xFBA5, 9),(_ucs2 0xFBFC,10),(_ucs2 0xFBFD,11),(_ucs2 0xFBFE,12),
-(_ucs2 0xFBFF,13),(_ucs2 0xFEEF,14),(_ucs2 0xFEF0,15),(_ucs2 0xFEF1,16),
-(_ucs2 0xFEF2,17),(_ucs2 0xFEF3,18),(_ucs2 0xFEF4,19),(_ucs2 0xFEF5,20),
-(_ucs2 0xFEF6,21),(_ucs2 0xFEF7,22),(_ucs2 0xFEF8,23),(_ucs2 0xFEF9,24),
-(_ucs2 0xFEFA,25),(_ucs2 0xFEFB,26),(_ucs2 0xFEFC,27);
-
-SELECT HEX(CONVERT(a USING ucs2)), offs, hex(weight_string(a)), a
-FROM t1 ORDER BY a, offs, BINARY a;
-DROP TABLE t1;
-
-SET @test_character_set= 'utf8';
-SET @test_collation= 'utf8_swedish_ci';
--- source include/ctype_common.inc
-
-#
-# Bug 7111 server crashes when regexp is used
-#
-create table t1 (a varchar(1)) character set utf8 collate utf8_estonian_ci;
-insert into t1 values ('A'),('B'),('C'),('a'),('b'),('c');
-select a, a regexp '[a]' from t1 order by binary a;
-drop table t1;
-
-SET collation_connection='utf8_unicode_ci';
--- source include/ctype_filesort.inc
--- source include/ctype_like_escape.inc
--- source include/ctype_german.inc
-
-# End of 4.1 tests
-
-#
-# Check UPPER/LOWER changeing length
-#
-# Result shorter than argument
-CREATE TABLE t1 (id int, a varchar(30) character set utf8);
-INSERT INTO t1 VALUES (1, _ucs2 0x01310069), (2, _ucs2 0x01310131);
-INSERT INTO t1 VALUES (3, _ucs2 0x00690069), (4, _ucs2 0x01300049);
-INSERT INTO t1 VALUES (5, _ucs2 0x01300130), (6, _ucs2 0x00490049);
-SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
-FROM t1 ORDER BY id;
-ALTER TABLE t1 MODIFY a VARCHAR(30) character set utf8 collate utf8_turkish_ci;
-SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
-FROM t1 ORDER BY id;
-DROP TABLE t1;
-
-#
-# Bug #27079 Crash while grouping empty ucs2 strings
-#
-CREATE TABLE t1 (
- c1 text character set ucs2 collate ucs2_polish_ci NOT NULL
-) ENGINE=MyISAM;
-insert into t1 values (''),('a');
-SELECT COUNT(*), c1 FROM t1 GROUP BY c1;
-DROP TABLE IF EXISTS t1;
-
-#
-# Bug#27345 Incorrect data returned when range-read from utf8_danish_ci indexes
-#
-set names utf8;
-create table t1 (
- a varchar(255),
- key a(a)
-) character set utf8 collate utf8_danish_ci;
-insert into t1 values ('åaaaa'),('ååaaa'),('aaaaa');
-select a as like_a from t1 where a like 'a%';
-select a as like_aa from t1 where a like 'aa%';
-select a as like_aaa from t1 where a like 'aaa%';
-select a as like_aaaa from t1 where a like 'aaaa%';
-select a as like_aaaaa from t1 where a like 'aaaaa%';
-alter table t1 convert to character set ucs2 collate ucs2_danish_ci;
-select a as like_a from t1 where a like 'a%';
-select a as like_aa from t1 where a like 'aa%';
-select a as like_aaa from t1 where a like 'aaa%';
-select a as like_aaaa from t1 where a like 'aaaa%';
-select a as like_aaaaa from t1 where a like 'aaaaa%';
-drop table t1;
-
-create table t1 (
- a varchar(255),
- key(a)
-) character set utf8 collate utf8_spanish2_ci;
-insert into t1 values ('aaaaa'),('lllll'),('zzzzz');
-select a as like_l from t1 where a like 'l%';
-select a as like_ll from t1 where a like 'll%';
-select a as like_lll from t1 where a like 'lll%';
-select a as like_llll from t1 where a like 'llll%';
-select a as like_lllll from t1 where a like 'lllll%';
-alter table t1 convert to character set ucs2 collate ucs2_spanish2_ci;
-select a as like_l from t1 where a like 'l%';
-select a as like_ll from t1 where a like 'll%';
-select a as like_lll from t1 where a like 'lll%';
-select a as like_llll from t1 where a like 'llll%';
-select a as like_lllll from t1 where a like 'lllll%';
-drop table t1;
-
-create table t1 (
- a varchar(255),
- key a(a)
-) character set utf8 collate utf8_czech_ci;
-# In Czech 'ch' is a single letter between 'h' and 'i'
-insert into t1 values
-('b'),('c'),('d'),('e'),('f'),('g'),('h'),('ch'),('i'),('j');
-select * from t1 where a like 'c%';
-alter table t1 convert to character set ucs2 collate ucs2_czech_ci;
-select * from t1 where a like 'c%';
-drop table t1;
-
-set collation_connection=ucs2_unicode_ci;
--- source include/ctype_regex.inc
--- source include/ctype_like_range_f1f2.inc
-set names utf8;
-
--- echo End for 5.0 tests
---echo End of 5.1 tests
-
---echo #
---echo # Start of 5.5 tests
---echo #
-#
-# Test my_like_range and contractions
-#
-SET collation_connection=utf8_czech_ci;
---source include/ctype_czech.inc
---source include/ctype_like_ignorable.inc
-SET collation_connection=ucs2_czech_ci;
---source include/ctype_czech.inc
---source include/ctype_like_ignorable.inc
-
-create table t1 (a int, c1 varchar(200) collate utf8_croatian_mysql561_ci, key (c1));
-insert into t1 values (1,'=> DZ'),(2,'=> Dz'),(3,'=> dz'),(4,'=> dZ');
-insert into t1 values (5,'=> DŽ'),(6,'=> Dž'),(7,'=> dž'),(8,'=> dŽ');
-insert into t1 values (9,'=> dž'),(10,'=> DŽ');
-select c1 from t1;
-select concat(c1) from t1 order by c1;
-select * from t1 where c1 like '=> d%';
-select * from t1 where concat(c1) like '=> d%';
-select * from t1 where c1 like '=> dz%';
-select * from t1 where concat(c1) like '=> dz%';
-select * from t1 where c1 like '=> dž%';
-select * from t1 where concat(c1) like '=> dž%';
-select * from t1 where c1 = '=> dž';
-select * from t1 where concat(c1) = '=> dž';
-drop table t1;
-
-
---echo #
---echo # MDEV-7649 wrong result when comparing utf8 column with an invalid literal
---echo #
-
-SET NAMES utf8 COLLATE utf8_unicode_ci;
---let ENGINE=MyISAM
---source include/ctype_utf8_ilseq.inc
---let ENGINE=HEAP
---source include/ctype_utf8_ilseq.inc
-
---echo #
---echo # End of 5.5 tests
---echo #
-
-
---echo #
---echo # Start of 5.6 tests
---echo #
-
---echo #
---echo # WL#3664 WEIGHT_STRING
---echo #
-
-set collation_connection=ucs2_unicode_ci;
---source include/weight_string.inc
---source include/weight_string_euro.inc
---source include/weight_string_l1.inc
-
-set @@collation_connection=utf8_unicode_ci;
---source include/weight_string.inc
---source include/weight_string_euro.inc
---source include/weight_string_l1.inc
-
-set @@collation_connection=utf8_czech_ci;
---source include/weight_string_chde.inc
-
-set @@collation_connection=ucs2_czech_ci;
---source include/weight_string_chde.inc
-
---echo #
---echo # Bug#33077 weight of supplementary characters is not 0xfffd
---echo #
-select hex(weight_string(_utf8mb4 0xF0908080 /* U+10000 */ collate utf8mb4_unicode_ci));
-
---echo #
---echo # Bug#53064 garbled data when using utf8_german2_ci collation
---echo #
-CREATE TABLE t1 (s1 VARCHAR(10) COLLATE utf8_german2_ci);
-INSERT INTO t1 VALUES ('a'),('ae'),('af');
-SELECT s1,hex(s1),hex(weight_string(s1)) FROM t1 ORDER BY s1;
-DROP TABLE t1;
-
---echo #
---echo # WL#4013 Unicode german2 collation
---echo #
-SET collation_connection=utf8_german2_ci;
---source include/ctype_german.inc
-
---echo #
---echo # WL#2673 Unicode Collation Algorithm new version
---echo #
-SET NAMES utf8mb4 COLLATE utf8mb4_unicode_520_ci;
---source include/ctype_unicode520.inc
-
---echo #
---echo # End of 5.6 tests
---echo #
-
-
---echo #
---echo # Start of MariaDB-10.0 tests
---echo #
---echo
-
-SET NAMES utf8 COLLATE utf8_unicode_ci;
---source include/ctype_like_cond_propagation.inc
---source include/ctype_like_cond_propagation_utf8_german.inc
-
-SET NAMES utf8 COLLATE utf8_german2_ci;
---source include/ctype_like_cond_propagation.inc
---source include/ctype_like_cond_propagation_utf8_german.inc
-
---echo #
---echo # MDEV-4929 Myanmar collation
---echo #
-SET NAMES utf8 COLLATE utf8_myanmar_ci;
---source include/ctype_myanmar.inc
-SET collation_connection=ucs2_myanmar_ci;
---source include/ctype_myanmar.inc
-
---echo #
---echo # MDEV-7366 SELECT 'a' = BINARY 'A' returns 1 (utf8 charset, utf8_unicode_ci collation)
---echo #
-SET NAMES utf8 COLLATE utf8_unicode_ci;
-SELECT 'a' = BINARY 'A';
-SELECT BINARY 'A' = 'a';
-
---echo #
---echo # Wrong result set for WHERE a='oe' COLLATE utf8_german2_ci AND a='oe'
---echo #
-SET NAMES utf8 COLLATE utf8_german2_ci;
-CREATE TABLE t1 (a CHAR(10) CHARACTER SET utf8);
-INSERT INTO t1 VALUES ('ö'),('oe');
-SELECT * FROM t1 WHERE a='oe' AND a='oe' COLLATE utf8_german2_ci;
-SELECT * FROM t1 WHERE a='oe' COLLATE utf8_german2_ci AND a='oe';
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='oe' AND a='oe' COLLATE utf8_german2_ci;
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='oe' COLLATE utf8_german2_ci AND a='oe';
-DROP TABLE t1;
-
---echo #
---echo # End of MariaDB-10.0 tests
---echo #
-
---echo #
---echo # Start of MariaDB-10.1 tests
---echo #
-
---echo #
---echo # MDEV-6973 XOR aggregates argument collations
---echo #
-SELECT '10' COLLATE utf8_general_ci XOR '20' COLLATE utf8_unicode_ci;
-
---echo #
---echo # MDEV-8705 Wrong result for SELECT..WHERE latin1_bin_column='a' AND latin1_bin_column='A'
---echo #
-SET NAMES utf8 COLLATE utf8_german2_ci;
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_bin);
-INSERT INTO t1 VALUES ('a'),('A');
-SELECT * FROM t1 WHERE a='a';
-SELECT * FROM t1 WHERE a=_utf8'a';
-# Make sure this does not return "Illegal mix of collations"
-SELECT * FROM t1 WHERE a='a' AND a=_utf8'a';
-DROP TABLE t1;
-
-
-SET NAMES utf8 COLLATE utf8_thai_520_w2;
---source include/ctype_uca_w2.inc
---source include/ctype_thai.inc
-
-SET NAMES utf8;
-SET collation_connection=ucs2_thai_520_w2;
---source include/ctype_uca_w2.inc
---source include/ctype_thai.inc
-
---echo #
---echo # End of MariaDB-10.1 tests
---echo #
-
-
---echo #
---echo # Start of MariaDB-10.2 tests
---echo #
-
---echo #
---echo # MDEV-9407 Illegal mix of collation when using GROUP_CONCAT in a VIEW
---echo #
-SET NAMES utf8;
-CREATE TABLE t1 (col1 VARCHAR(12) CHARACTER SET utf8 COLLATE utf8_unicode_ci);
-INSERT INTO t1 VALUES ('a'),('b');
-CREATE VIEW v1 AS SELECT group_concat('f') AS col1;
-SELECT col1 FROM v1 UNION SELECT col1 FROM t1;
-DROP VIEW v1;
-DROP TABLE t1;
-
-
---echo #
---echo # End of MariaDB-10.2 tests
---echo #
diff --git a/mysql-test/t/ctype_uca_innodb.test b/mysql-test/t/ctype_uca_innodb.test
deleted file mode 100644
index cb6caff4a03..00000000000
--- a/mysql-test/t/ctype_uca_innodb.test
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-# Tests for UCA collations with InnoDB
-#
-
-let collation=utf8_unicode_ci;
---source include/have_collation.inc
---source include/have_innodb.inc
-
-
---echo #
---echo # Start of 5.5 tests
---echo #
-
-
---echo #
---echo # MDEV-7649 wrong result when comparing utf8 column with an invalid literal
---echo #
-
-SET NAMES utf8 COLLATE utf8_unicode_ci;
---let ENGINE=InnoDB
---source include/ctype_utf8_ilseq.inc
-
---echo #
---echo # End of 5.5 tests
---echo #
diff --git a/mysql-test/t/ctype_uca_partitions.test b/mysql-test/t/ctype_uca_partitions.test
deleted file mode 100644
index 5734bb52008..00000000000
--- a/mysql-test/t/ctype_uca_partitions.test
+++ /dev/null
@@ -1,38 +0,0 @@
---source include/have_partition.inc
-
-SET NAMES utf8;
-
-CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_thai_520_w2)
-PARTITION BY KEY(c1) PARTITIONS 3;
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES ('A'),('À'),('Á'),('Â'),('Ã'),('Ä'),('Å');
-INSERT INTO t1 VALUES ('B');
-INSERT INTO t1 VALUES ('C');
-INSERT INTO t1 VALUES ('D');
-INSERT INTO t1 VALUES ('E');
-INSERT INTO t1 VALUES ('F');
-INSERT INTO t1 VALUES ('G');
-INSERT INTO t1 VALUES ('H');
-INSERT INTO t1 VALUES ('I');
-INSERT INTO t1 VALUES ('J');
-INSERT INTO t1 VALUES ('K');
-INSERT INTO t1 VALUES ('L'),('Ĺ'),('Ļ'),('Ľ'),('Ŀ'),('Ł');
-INSERT INTO t1 VALUES ('M');
-INSERT INTO t1 VALUES ('N');
-INSERT INTO t1 VALUES ('O'),('Ò'),('Ó'),('Ô'),('Õ'),('Ö'),('Ø');
-INSERT INTO t1 VALUES ('P');
-INSERT INTO t1 VALUES ('Q');
-INSERT INTO t1 VALUES ('R');
-INSERT INTO t1 VALUES ('S');
-INSERT INTO t1 VALUES ('T');
-INSERT INTO t1 VALUES ('U');
-INSERT INTO t1 VALUES ('V');
-INSERT INTO t1 VALUES ('W');
-INSERT INTO t1 VALUES ('X');
-INSERT INTO t1 VALUES ('Y');
-INSERT INTO t1 VALUES ('Z');
-
-SELECT * FROM t1 PARTITION (p0) ORDER BY c1;
-SELECT * FROM t1 PARTITION (p1) ORDER BY c1;
-SELECT * FROM t1 PARTITION (p2) ORDER BY c1;
-DROP TABLE t1;
diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test
deleted file mode 100644
index d7a4fd48ccd..00000000000
--- a/mysql-test/t/ctype_ucs.test
+++ /dev/null
@@ -1,1069 +0,0 @@
--- source include/have_ucs2.inc
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-SET @test_character_set= 'ucs2';
-SET @test_collation= 'ucs2_general_ci';
--- source include/ctype_common.inc
-
-SET NAMES latin1;
-SET character_set_connection=ucs2;
--- source include/endspace.inc
-
-SET CHARACTER SET koi8r;
-
-#
-# BUG#49028, error in LIKE with ucs2
-#
-create table t1 (a varchar(2) character set ucs2 collate ucs2_bin, key(a));
-insert into t1 values ('A'),('A'),('B'),('C'),('D'),('A\t');
-insert into t1 values ('A\0'),('A\0'),('A\0'),('A\0'),('AZ');
-select hex(a) from t1 where a like 'A_' order by a;
-select hex(a) from t1 ignore key(a) where a like 'A_' order by a;
-drop table t1;
-
-#
-# Check that 0x20 is only trimmed when it is
-# a part of real SPACE character, not just a part
-# of a multibyte sequence.
-# Note, CYRILLIC LETTER ER is used as an example, which
-# is stored as 0x0420 in UCS2, thus contains 0x20 in the
-# low byte. The second character is THREE-PER-M, U+2004,
-# which contains 0x20 in the high byte.
-#
-
-CREATE TABLE t1 (word VARCHAR(64) CHARACTER SET ucs2, word2 CHAR(64) CHARACTER SET ucs2);
-INSERT INTO t1 VALUES (_koi8r'',_koi8r''), (X'2004',X'2004');
-SELECT hex(word) FROM t1 ORDER BY word;
-SELECT hex(word2) FROM t1 ORDER BY word2;
-DELETE FROM t1;
-
-#
-# Check that real spaces are correctly trimmed.
-#
-
-INSERT INTO t1 VALUES (X'042000200020',X'042000200020'), (X'200400200020', X'200400200020');
-SELECT hex(word) FROM t1 ORDER BY word;
-SELECT hex(word2) FROM t1 ORDER BY word2;
-DROP TABLE t1;
-
-#
-# Check LPAD/RPAD
-#
-SELECT LPAD(_ucs2 X'0420',10,_ucs2 X'0421');
-SELECT LPAD(_ucs2 X'0420',10,_ucs2 X'04210422');
-SELECT LPAD(_ucs2 X'0420',10,_ucs2 X'042104220423');
-SELECT LPAD(_ucs2 X'0420042104220423042404250426042704280429042A042B',10,_ucs2 X'042104220423');
-
-SELECT RPAD(_ucs2 X'0420',10,_ucs2 X'0421');
-SELECT RPAD(_ucs2 X'0420',10,_ucs2 X'04210422');
-SELECT RPAD(_ucs2 X'0420',10,_ucs2 X'042104220423');
-SELECT RPAD(_ucs2 X'0420042104220423042404250426042704280429042A042B',10,_ucs2 X'042104220423');
-
-CREATE TABLE t1 SELECT
-LPAD(_ucs2 X'0420',10,_ucs2 X'0421') l,
-RPAD(_ucs2 X'0420',10,_ucs2 X'0421') r;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
---echo #
---echo # Bug #51876 : crash/memory underrun when loading data with ucs2
---echo # and reverse() function
---echo #
-
---echo # Problem # 1 (original report): wrong parsing of ucs2 data
-SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
-CREATE TABLE t1(a INT);
-LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
-(@b) SET a=REVERSE(@b);
---echo # should return 2 zeroes (as the value is truncated)
-SELECT * FROM t1;
-
-DROP TABLE t1;
-let $MYSQLD_DATADIR= `select @@datadir`;
-remove_file $MYSQLD_DATADIR/test/tmpp.txt;
-
-
---echo # Problem # 2 : if you write and read ucs2 data to a file they're lost
-SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
-CREATE TABLE t1(a INT);
-LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
-(@b) SET a=REVERSE(@b);
---echo # should return 0 and 1 (10 reversed)
-SELECT * FROM t1;
-
-DROP TABLE t1;
-let $MYSQLD_DATADIR= `select @@datadir`;
-remove_file $MYSQLD_DATADIR/test/tmpp2.txt;
-
-
-
-#
-# BUG3946
-#
-
-create table t2(f1 Char(30));
-insert into t2 values ("103000"), ("22720000"), ("3401200"), ("78000");
-select lpad(f1, 12, "-o-/") from t2;
-drop table t2;
-
-######################################################
-#
-# Test of like
-#
-
-SET NAMES koi8r;
-SET character_set_connection=ucs2;
---source include/ctype_like.inc
-
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ucs2);
-INSERT INTO t1 VALUES (''),(''),(''),(''),(''),('');
-INSERT INTO t1 VALUES (''),(''),(''),('');
-INSERT INTO t1 VALUES (''),(''),(''),('');
-INSERT INTO t1 VALUES (''),(''),(''),('');
-SELECT * FROM t1 WHERE a LIKE '%%';
-SELECT * FROM t1 WHERE a LIKE '%%';
-SELECT * FROM t1 WHERE a LIKE '%';
-SELECT * FROM t1 WHERE a LIKE '%' COLLATE ucs2_bin;
-DROP TABLE t1;
-
-#
-# Bug 1181
-#
-CREATE TABLE t1 (word varchar(64) NOT NULL, PRIMARY KEY (word))
-ENGINE=MyISAM CHARACTER SET ucs2 COLLATE ucs2_general_ci;
-INSERT INTO t1 (word) VALUES ("cat");
-SELECT * FROM t1 WHERE word LIKE "c%";
-SELECT * FROM t1 WHERE word LIKE "ca_";
-SELECT * FROM t1 WHERE word LIKE "cat";
-SELECT * FROM t1 WHERE word LIKE _ucs2 x'00630025';
-SELECT * FROM t1 WHERE word LIKE _ucs2 x'00630061005F';
-DROP TABLE t1;
-
-#
-# Check that INSERT works fine.
-# This invokes charpos() function.
-select insert(_ucs2 0x006100620063,10,2,_ucs2 0x006400650066);
-select insert(_ucs2 0x006100620063,1,2,_ucs2 0x006400650066);
-
-######################################################
-
-#
-# Bug 1264
-#
-# Description:
-#
-# When using a ucs2 table in MySQL,
-# either with ucs2_general_ci or ucs2_bin collation,
-# words are returned in an incorrect order when using ORDER BY
-# on an _indexed_ CHAR or VARCHAR column. They are sorted with
-# the longest word *first* instead of last. I.E. The word "aardvark"
-# is in the results before the word "a".
-#
-# If there is no index for the column, the problem does not occur.
-#
-# Interestingly, if there is no second column, the words are returned
-# in the correct order.
-#
-# According to EXPLAIN, it looks like when the output includes columns that
-# are not part of the index sorted on, it does a filesort, which fails.
-# Using a straight index yields correct results.
-
-SET NAMES latin1;
-
-#
-# Two fields, index
-#
-
-CREATE TABLE t1 (
- word VARCHAR(64),
- bar INT(11) default 0,
- PRIMARY KEY (word))
- ENGINE=MyISAM
- CHARSET ucs2
- COLLATE ucs2_general_ci ;
-
-INSERT INTO t1 (word) VALUES ("aar");
-INSERT INTO t1 (word) VALUES ("a");
-INSERT INTO t1 (word) VALUES ("aardvar");
-INSERT INTO t1 (word) VALUES ("aardvark");
-INSERT INTO t1 (word) VALUES ("aardvara");
-INSERT INTO t1 (word) VALUES ("aardvarz");
-EXPLAIN SELECT * FROM t1 ORDER BY word;
-SELECT * FROM t1 ORDER BY word;
-EXPLAIN SELECT word FROM t1 ORDER BY word;
-SELECT word FROM t1 ORDER by word;
-DROP TABLE t1;
-
-#
-# One field, index
-#
-
-CREATE TABLE t1 (
- word VARCHAR(64) ,
- PRIMARY KEY (word))
- ENGINE=MyISAM
- CHARSET ucs2
- COLLATE ucs2_general_ci;
-
-INSERT INTO t1 (word) VALUES ("aar");
-INSERT INTO t1 (word) VALUES ("a");
-INSERT INTO t1 (word) VALUES ("aardvar");
-INSERT INTO t1 (word) VALUES ("aardvark");
-INSERT INTO t1 (word) VALUES ("aardvara");
-INSERT INTO t1 (word) VALUES ("aardvarz");
-EXPLAIN SELECT * FROM t1 ORDER BY WORD;
-SELECT * FROM t1 ORDER BY word;
-DROP TABLE t1;
-
-
-#
-# Two fields, no index
-#
-
-CREATE TABLE t1 (
- word TEXT,
- bar INT(11) AUTO_INCREMENT,
- PRIMARY KEY (bar))
- ENGINE=MyISAM
- CHARSET ucs2
- COLLATE ucs2_general_ci ;
-INSERT INTO t1 (word) VALUES ("aar");
-INSERT INTO t1 (word) VALUES ("a" );
-INSERT INTO t1 (word) VALUES ("aardvar");
-INSERT INTO t1 (word) VALUES ("aardvark");
-INSERT INTO t1 (word) VALUES ("aardvara");
-INSERT INTO t1 (word) VALUES ("aardvarz");
-EXPLAIN SELECT * FROM t1 ORDER BY word;
-SELECT * FROM t1 ORDER BY word;
-EXPLAIN SELECT word FROM t1 ORDER BY word;
-SELECT word FROM t1 ORDER BY word;
-DROP TABLE t1;
-
-#
-# END OF Bug 1264 test
-#
-########################################################
-
-
-# Bug #2390
-# Check alignment for constants
-#
-SELECT HEX(_ucs2 0x0);
-SELECT HEX(_ucs2 0x01);
-SELECT HEX(_ucs2 0x012);
-SELECT HEX(_ucs2 0x0123);
-SELECT HEX(_ucs2 0x01234);
-SELECT HEX(_ucs2 0x012345);
-SELECT HEX(_ucs2 0x0123456);
-SELECT HEX(_ucs2 0x01234567);
-SELECT HEX(_ucs2 0x012345678);
-SELECT HEX(_ucs2 0x0123456789);
-SELECT HEX(_ucs2 0x0123456789A);
-SELECT HEX(_ucs2 0x0123456789AB);
-SELECT HEX(_ucs2 0x0123456789ABC);
-SELECT HEX(_ucs2 0x0123456789ABCD);
-SELECT HEX(_ucs2 0x0123456789ABCDE);
-SELECT HEX(_ucs2 0x0123456789ABCDEF);
-
-#
-# Check alignment for from-binary-conversion with CAST and CONVERT
-#
-SELECT hex(cast(0xAA as char character set ucs2));
-SELECT hex(convert(0xAA using ucs2));
-
-#
-# Check alignment for string types
-#
-CREATE TABLE t1 (a char(10) character set ucs2);
-INSERT INTO t1 VALUES (0xA),(0xAA),(0xAAA),(0xAAAA),(0xAAAAA);
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a varchar(10) character set ucs2);
-INSERT INTO t1 VALUES (0xA),(0xAA),(0xAAA),(0xAAAA),(0xAAAAA);
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a text character set ucs2);
-INSERT INTO t1 VALUES (0xA),(0xAA),(0xAAA),(0xAAAA),(0xAAAAA);
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a mediumtext character set ucs2);
-INSERT INTO t1 VALUES (0xA),(0xAA),(0xAAA),(0xAAAA),(0xAAAAA);
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a longtext character set ucs2);
-INSERT INTO t1 VALUES (0xA),(0xAA),(0xAAA),(0xAAAA),(0xAAAAA);
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
-# the same should be also done with enum and set
-
-
-#
-# Bug #5024 Server crashes with queries on fields
-# with certain charset/collation settings
-#
-
-create table t1 (s1 char character set `ucs2` collate `ucs2_czech_ci`);
-insert into t1 values ('0'),('1'),('2'),('a'),('b'),('c');
-select s1 from t1 where s1 > 'a' order by s1;
-drop table t1;
-
-#
-# Bug #5081 : UCS2 fields are filled with '0x2020'
-# after extending field length
-#
-create table t1(a char(1)) default charset = ucs2;
-insert into t1 values ('a'),('b'),('c');
-alter table t1 modify a char(5);
-select a, hex(a) from t1;
-drop table t1;
-
-#
-# Check prepare statement from an UCS2 string
-#
-set @ivar= 1234;
-set @str1 = 'select ?';
-set @str2 = convert(@str1 using ucs2);
-prepare stmt1 from @str2;
-execute stmt1 using @ivar;
-
-#
-# Check that ucs2 works with ENUM and SET type
-#
-set names latin1;
-create table t1 (a enum('x','y','z') character set ucs2);
-show create table t1;
-insert into t1 values ('x');
-insert into t1 values ('y');
-insert into t1 values ('z');
-select a, hex(a) from t1 order by a;
-alter table t1 change a a enum('x','y','z','d','e','','','') character set ucs2;
-show create table t1;
-insert into t1 values ('D');
-insert into t1 values ('E ');
-insert into t1 values ('');
-insert into t1 values ('');
-insert into t1 values ('');
-select a, hex(a) from t1 order by a;
-drop table t1;
-
-create table t1 (a set ('x','y','z','','','') character set ucs2);
-show create table t1;
-insert into t1 values ('x');
-insert into t1 values ('y');
-insert into t1 values ('z');
-insert into t1 values ('x,y');
-insert into t1 values ('x,y,z,,,');
-select a, hex(a) from t1 order by a;
-drop table t1;
-
-#
-# Bug#7302 UCS2 data in ENUM fields get truncated when new column is added
-#
-create table t1(a enum('a','b','c')) default character set ucs2;
-insert into t1 values('a'),('b'),('c');
-alter table t1 add b char(1);
-show warnings;
-select * from t1 order by a;
-drop table t1;
-
-SET collation_connection='ucs2_general_ci';
--- source include/ctype_filesort.inc
--- source include/ctype_like_escape.inc
--- source include/ctype_german.inc
--- source include/ctype_like_range_f1f2.inc
--- source include/ctype_str_to_date.inc
-SET NAMES latin1;
-SET collation_connection='ucs2_bin';
--- source include/ctype_filesort.inc
--- source include/ctype_like_escape.inc
--- source include/ctype_like_range_f1f2.inc
-
-#
-# Bug#10344 Some string functions fail for UCS2
-#
-select hex(substr(_ucs2 0x00e400e50068,1));
-select hex(substr(_ucs2 0x00e400e50068,2));
-select hex(substr(_ucs2 0x00e400e50068,3));
-select hex(substr(_ucs2 0x00e400e50068,-1));
-select hex(substr(_ucs2 0x00e400e50068,-2));
-select hex(substr(_ucs2 0x00e400e50068,-3));
-
-SET NAMES latin1;
-#
-# Bug#8235
-#
-# This bug also helped to find another problem that
-# INSERT of a UCS2 string containing a negative number
-# into a unsigned int column didn't produce warnings.
-# This test covers both problems.
-#
-SET collation_connection='ucs2_swedish_ci';
-CREATE TABLE t1 (Field1 int(10) default '0');
-# no warnings, negative numbers are allowed
-INSERT INTO t1 VALUES ('-1');
-SELECT * FROM t1;
-DROP TABLE t1;
-CREATE TABLE t1 (Field1 int(10) unsigned default '0');
-# this should generate a "Data truncated" warning
-INSERT IGNORE INTO t1 VALUES ('-1');
-DROP TABLE t1;
-SET NAMES latin1;
-
-#
-# Bug#18691 Converting number to UNICODE string returns invalid result
-#
-SELECT CONVERT(103, CHAR(50) UNICODE);
-SELECT CONVERT(103.0, CHAR(50) UNICODE);
-SELECT CONVERT(-103, CHAR(50) UNICODE);
-SELECT CONVERT(-103.0, CHAR(50) UNICODE);
-
-#
-# Bug#9557 MyISAM utf8 table crash
-#
-CREATE TABLE t1 (
- a varchar(255) NOT NULL default '',
- KEY a (a)
-) ENGINE=MyISAM DEFAULT CHARSET=ucs2 COLLATE ucs2_general_ci;
-insert into t1 values (0x803d);
-insert into t1 values (0x005b);
-select hex(a) from t1;
-drop table t1;
-
-#
-# Bug #14583 Bug on query using a LIKE on indexed field with ucs2_bin collation
-#
-set sql_mode="";
---disable_warnings
-create table t1(f1 varchar(5) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL) engine=InnoDB;
---enable_warnings
-set sql_mode=default;
-insert into t1 values('a');
-create index t1f1 on t1(f1);
-select f1 from t1 where f1 like 'a%';
-drop table t1;
-
-#
-# Bug#9442 Set parameter make query fail if column character set is UCS2
-#
-create table t1 (utext varchar(20) character set ucs2);
-insert into t1 values ("lily");
-insert into t1 values ("river");
-prepare stmt from 'select utext from t1 where utext like ?';
-set @param1='%%';
-execute stmt using @param1;
-execute stmt using @param1;
-select utext from t1 where utext like '%%';
-drop table t1;
-deallocate prepare stmt;
-
-#
-# Bug#22052 Trailing spaces are not removed from UNICODE fields in an index
-#
-create table t1 (
- a char(10) unicode not null,
- index a (a)
-) engine=myisam;
-insert into t1 values (repeat(0x201f, 10));
-insert into t1 values (repeat(0x2020, 10));
-insert into t1 values (repeat(0x2021, 10));
-# make sure "index read" is used
-explain select hex(a) from t1 order by a;
-select hex(a) from t1 order by a;
-alter table t1 drop index a;
-select hex(a) from t1 order by a;
-drop table t1;
-
-#
-# Bug #20076: server crashes for a query with GROUP BY if MIN/MAX aggregation
-# over a 'ucs2' field uses a temporary table
-#
-
-CREATE TABLE t1 (id int, s char(5) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci);
-INSERT INTO t1 VALUES (1, 'ZZZZZ'), (1, 'ZZZ'), (2, 'ZZZ'), (2, 'ZZZZZ');
-
-SELECT id, MIN(s) FROM t1 GROUP BY id;
-
-DROP TABLE t1;
-
-#
-# Bug #20536: md5() with GROUP BY and UCS2 return different results on myisam/innodb
-#
-
---disable_warnings
-drop table if exists bug20536;
---enable_warnings
-
-set names latin1;
-create table bug20536 (id bigint not null auto_increment primary key, name
-varchar(255) character set ucs2 not null);
-insert into `bug20536` (`id`,`name`) values (1, _latin1 x'7465737431'), (2, "'test\\_2'");
-select md5(name) from bug20536;
-select sha1(name) from bug20536;
-select make_set(3, name, upper(name)) from bug20536;
-select export_set(5, name, upper(name)) from bug20536;
-select export_set(5, name, upper(name), ",", 5) from bug20536;
-
-#
-# Bug #20108: corrupted default enum value for a ucs2 field
-#
-
-CREATE TABLE t1 (
- status enum('active','passive') collate latin1_general_ci
- NOT NULL default 'passive'
-);
-SHOW CREATE TABLE t1;
-ALTER TABLE t1 ADD a int NOT NULL AFTER status;
-
-CREATE TABLE t2 (
- status enum('active','passive') collate ucs2_turkish_ci
- NOT NULL default 'passive'
-);
-SHOW CREATE TABLE t2;
-ALTER TABLE t2 ADD a int NOT NULL AFTER status;
-
-DROP TABLE t1,t2;
-
-
-# Some broken functions: add these tests just to document current behavior.
-
-# PASSWORD and OLD_PASSWORD don't work with UCS2 strings, but to fix it would
-# not be backwards compatible in all cases, so it's best to leave it alone
-select password(name) from bug20536;
-select old_password(name) from bug20536;
-
-# Disable test case as encrypt relies on 'crypt' function.
-# "decrypt" is noramlly tested in func_crypt.test which have a
-# "have_crypt.inc" test
---disable_parsing
-# ENCRYPT relies on OS function crypt() which takes a NUL-terminated string; it
-# doesn't return good results for strings with embedded 0 bytes. It won't be
-# fixed unless we choose to re-implement the crypt() function ourselves to take
-# an extra size_t string_length argument.
-select encrypt(name, 'SALT') from bug20536;
---enable_parsing
-
-# QUOTE doesn't work with UCS2 data. It would require a total rewrite
-# of Item_func_quote::val_str(), which isn't worthwhile until UCS2 is
-# supported fully as a client character set.
-select quote(name) from bug20536;
-
-drop table bug20536;
-
-#
-# Bug #31615: crash after set names ucs2 collate xxx
-#
---error 1231
-set names ucs2;
---error 1231
-set names ucs2 collate ucs2_bin;
---error 1231
-set character_set_client= ucs2;
---error 1231
-set character_set_client= concat('ucs', substr('2', 1));
-
-#
-# BUG#31159 - fulltext search on ucs2 column crashes server
-#
-CREATE TABLE t1(a TEXT CHARSET ucs2 COLLATE ucs2_unicode_ci);
-INSERT INTO t1 VALUES('abcd');
-SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abcd' IN BOOLEAN MODE);
-DROP TABLE t1;
-
---echo End of 4.1 tests
-
-#
-# Conversion from an UCS2 string to a decimal column
-#
-CREATE TABLE t1 (a varchar(64) character set ucs2, b decimal(10,3));
-INSERT INTO t1 VALUES ("1.1", 0), ("2.1", 0);
-update t1 set b=a;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-#
-# Bug#9442 Set parameter make query fail if column character set is UCS2
-#
-create table t1 (utext varchar(20) character set ucs2);
-insert into t1 values ("lily");
-insert into t1 values ("river");
-prepare stmt from 'select utext from t1 where utext like ?';
-set @param1='%%';
-execute stmt using @param1;
-execute stmt using @param1;
-select utext from t1 where utext like '%%';
-drop table t1;
-deallocate prepare stmt;
-
-#
-# Bug#22638 SOUNDEX broken for international characters
-#
-set names latin1;
-set character_set_connection=ucs2;
-select soundex(''),soundex('he'),soundex('hello all folks'),soundex('#3556 in bugdb');
-select hex(soundex('')),hex(soundex('he')),hex(soundex('hello all folks')),hex(soundex('#3556 in bugdb'));
-select 'mood' sounds like 'mud';
-# Cyrillic A, BE, VE
-select hex(soundex(_ucs2 0x041004110412));
-# Make sure that "U+00BF INVERTED QUESTION MARK" is not considered as letter
-select hex(soundex(_ucs2 0x00BF00C0));
-set names latin1;
-
-#
-# Bug #14290: character_maximum_length for text fields
-#
-create table t1(a blob, b text charset utf8, c text charset ucs2);
-select data_type, character_octet_length, character_maximum_length
- from information_schema.columns where table_name='t1';
-drop table t1;
-
-#
-# Bug#28925 GROUP_CONCAT inserts wrong separators for a ucs2 column
-#
-create table t1 (a char(1) character set ucs2);
-insert into t1 values ('a'),('b'),('c');
-select hex(group_concat(a)) from t1;
-select collation(group_concat(a)) from t1;
-drop table t1;
-
-set names latin1;
-create table t1 (a char(1) character set latin1);
-insert into t1 values ('a'),('b'),('c');
-set character_set_connection=ucs2;
-select hex(group_concat(a separator ',')) from t1;
-select collation(group_concat(a separator ',')) from t1;
-drop table t1;
-set names latin1;
-
-#
-# Bug#29499 Converting 'del' from ascii to Unicode results in 'question mark'
-#
-create table t1 (s1 char(1) character set ascii, s2 char(1) character set ucs2);
-insert into t1 (s1) values (0x7f);
-update t1 set s2 = s1;
-select hex(s2) from t1;
-select hex(convert(s1 using latin1)) from t1;
-drop table t1;
-
-#
-# Conversion from UCS2 to ASCII is possible
-# if the UCS2 string consists of only ASCII characters
-#
-create table t1 (a varchar(15) character set ascii not null, b int);
-insert into t1 values ('a',1);
-select concat(a,if(b<10,_ucs2 0x0061,_ucs2 0x0062)) from t1;
-select concat(a,if(b>10,_ucs2 0x0061,_ucs2 0x0062)) from t1;
-select * from t1 where a=if(b<10,_ucs2 0x0061,_ucs2 0x0062);
-select * from t1 where a=if(b>10,_ucs2 0x0061,_ucs2 0x0062);
-
-#
-# Conversion from UCS2 to ASCII is not possible if
-# the UCS2 string has non-ASCII characters
-#
---error 1267
-select concat(a,if(b<10,_ucs2 0x00C0,_ucs2 0x0062)) from t1;
---error 1267
-select concat(a,if(b>10,_ucs2 0x00C0,_ucs2 0x0062)) from t1;
---error 1267
-select concat(a,if(b<10,_ucs2 0x0062,_ucs2 0x00C0)) from t1;
---error 1267
-select concat(a,if(b>10,_ucs2 0x0062,_ucs2 0x00C0)) from t1;
---error 1267
-select * from t1 where a=if(b<10,_ucs2 0x00C0,_ucs2 0x0062);
---error 1267
-select * from t1 where a=if(b<10,_ucs2 0x0062,_ucs2 0x00C0);
-drop table t1;
-
-#
-# Bug#35720 ucs2 + pad_char_to_full_length = failure
-#
-CREATE TABLE t1 (s1 CHAR(5) CHARACTER SET UCS2);
-INSERT INTO t1 VALUES ('a');
-SET @@sql_mode=pad_char_to_full_length;
-SELECT HEX(s1) FROM t1;
-SET @@sql_mode=default;
-SELECT HEX(s1) FROM t1;
-DROP TABLE t1;
-
-set collation_connection=ucs2_general_ci;
---source include/ctype_regex.inc
-set names latin1;
-#
-# Bug#30981 CHAR(0x41 USING ucs2) doesn't add leading zero
-#
-select hex(char(0x41 using ucs2));
-
-#
-# Bug#37575: UCASE fails on monthname
-#
-SET character_set_connection=ucs2;
-SELECT CHARSET(DAYNAME(19700101));
-SELECT CHARSET(MONTHNAME(19700101));
-SELECT LOWER(DAYNAME(19700101));
-SELECT LOWER(MONTHNAME(19700101));
-SELECT UPPER(DAYNAME(19700101));
-SELECT UPPER(MONTHNAME(19700101));
-SELECT HEX(MONTHNAME(19700101));
-SELECT HEX(DAYNAME(19700101));
-SET LC_TIME_NAMES=ru_RU;
-SET NAMES utf8;
-SET character_set_connection=ucs2;
-SELECT CHARSET(DAYNAME(19700101));
-SELECT CHARSET(MONTHNAME(19700101));
-SELECT LOWER(DAYNAME(19700101));
-SELECT LOWER(MONTHNAME(19700101));
-SELECT UPPER(DAYNAME(19700101));
-SELECT UPPER(MONTHNAME(19700101));
-SELECT HEX(MONTHNAME(19700101));
-SELECT HEX(DAYNAME(19700101));
-SET character_set_connection=latin1;
-
---echo #
---echo # Bug#52120 create view cause Assertion failed: 0, file .\item_subselect.cc, line 817
---echo #
-CREATE TABLE t1 (a CHAR(1) CHARSET ascii, b CHAR(1) CHARSET latin1);
-CREATE VIEW v1 AS SELECT 1 from t1
-WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1'));
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#59648 my_strtoll10_mb2: Assertion `(*endptr - s) % 2 == 0' failed.
---echo #
---disable_warnings
-# Enable warnings when "MDEV-8844 Unreadable control characters printed as is in warnings" is fixed
-SELECT HEX(CHAR(COALESCE(NULL, CHAR(COUNT('%s') USING ucs2), 1, @@global.license, NULL) USING cp850));
---enable_warnings
-SELECT CONVERT(QUOTE(CHAR(0xf5 using ucs2)), SIGNED);
-
---echo End of 5.0 tests
-
---echo #
---echo # Start of 5.1 tests
---echo #
-
-#
-# Checking my_like_range_ucs2
-#
-SET NAMES utf8;
-CREATE TABLE t1 (
- a varchar(10) CHARACTER SET ucs2 COLLATE ucs2_czech_ci,
- key(a)
-);
-INSERT INTO t1 VALUES
-('aa'),('bb'),('cc'),('dd'),('ee'),('ff'),('gg'),('hh'),('ii'),
-('jj'),('kk'),('ll'),('mm'),('nn'),('oo'),('pp'),('rr'),('ss'),
-('tt'),('uu'),('vv'),('ww'),('xx'),('yy'),('zz');
-INSERT INTO t1 VALUES ('ca'),('cz'),('ch');
-INSERT INTO t1 VALUES ('da'),('dz'), (X'0064017E');
-# This one should scan only one row
-EXPLAIN SELECT * FROM t1 WHERE a LIKE 'b%';
-# This one should scan many rows: 'c' is a contraction head
-EXPLAIN SELECT * FROM t1 WHERE a LIKE 'c%';
-SELECT * FROM t1 WHERE a LIKE 'c%';
-EXPLAIN SELECT * FROM t1 WHERE a LIKE 'ch%';
-SELECT * FROM t1 WHERE a LIKE 'ch%';
-ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET ucs2 COLLATE ucs2_croatian_ci;
-EXPLAIN SELECT * FROM t1 WHERE a LIKE 'd%';
-SELECT hex(concat('d',_ucs2 0x017E,'%'));
-EXPLAIN SELECT * FROM t1 WHERE a LIKE concat('d',_ucs2 0x017E,'%');
-SELECT hex(a) FROM t1 WHERE a LIKE concat('D',_ucs2 0x017E,'%');
-
-DROP TABLE t1;
-
---echo #
---echo # End of 5.1 tests
---echo #
-
---echo #
---echo # Start of 5.5 tests
---echo #
-
-SET NAMES latin1;
-SET collation_connection=ucs2_general_ci;
---source include/ctype_numconv.inc
-SET NAMES latin1;
-
---echo #
---echo # Bug #13832953 MY_STRNXFRM_UNICODE: ASSERTION `SRC' FAILED
---echo #
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-CREATE TABLE t1 (c1 SET('','') CHARACTER SET ucs2);
-INSERT INTO t1 VALUES ('');
-SELECT COALESCE(c1) FROM t1 ORDER BY 1;
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-5745 analyze MySQL fix for bug#12368495
---echo #
-SELECT CHAR_LENGTH(TRIM(LEADING 0x000000 FROM _ucs2 0x0061));
-SELECT CHAR_LENGTH(TRIM(LEADING 0x0001 FROM _ucs2 0x0061));
-SELECT CHAR_LENGTH(TRIM(LEADING 0x00 FROM _ucs2 0x0061));
-
-SELECT CHAR_LENGTH(TRIM(TRAILING 0x000000 FROM _ucs2 0x0061));
-SELECT CHAR_LENGTH(TRIM(TRAILING 0x0001 FROM _ucs2 0x0061));
-SELECT CHAR_LENGTH(TRIM(TRAILING 0x61 FROM _ucs2 0x0061));
-
-SELECT CHAR_LENGTH(TRIM(BOTH 0x000000 FROM _ucs2 0x0061));
-SELECT CHAR_LENGTH(TRIM(BOTH 0x0001 FROM _ucs2 0x0061));
-SELECT CHAR_LENGTH(TRIM(BOTH 0x61 FROM _ucs2 0x0061));
-SELECT CHAR_LENGTH(TRIM(BOTH 0x00 FROM _ucs2 0x0061));
-
---echo #
---echo # MDEV-11685: sql_mode can't be set with non-ascii connection charset
---echo #
-SET character_set_connection=ucs2;
-SET sql_mode='NO_ENGINE_SUBSTITUTION';
-SELECT @@sql_mode;
-SET sql_mode=DEFAULT;
-SET NAMES utf8;
-
---echo #
---echo # MDEV-13972 crash in Item_func_sec_to_time::get_date
---echo #
-
-SELECT SEC_TO_TIME(CONVERT(900*24*60*60 USING ucs2));
-
---echo #
---echo # MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535
---echo #
-
-set sql_mode="";
-CREATE TABLE t1 (c1 VARCHAR(32766) CHARACTER SET ucs2);
-DESCRIBE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 VARCHAR(32767) CHARACTER SET ucs2);
-DESCRIBE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 VARCHAR(32768) CHARACTER SET ucs2);
-DESCRIBE t1;
-DROP TABLE t1;
-set sql_mode=default;
-
-
---echo #
---echo # End of 5.5 tests
---echo #
-
-
---echo #
---echo # Start of 5.6 tests
---echo #
-
---echo #
---echo # WL#3664 WEIGHT_STRING
---echo #
-
-set collation_connection=ucs2_general_ci;
---source include/weight_string.inc
---source include/weight_string_euro.inc
---source include/weight_string_l1.inc
-
-set collation_connection=ucs2_bin;
---source include/weight_string.inc
---source include/weight_string_euro.inc
---source include/weight_string_l1.inc
-
---echo #
---echo # Bug #36418 Character sets: crash if char(256 using utf32)
---echo #
-select hex(char(0x01 using ucs2));
-select hex(char(0x0102 using ucs2));
-select hex(char(0x010203 using ucs2));
-select hex(char(0x01020304 using ucs2));
-
---echo #
---echo # Bug#10094 Displays wrong error message for UNIQUE key index on CHAR(255) Unicode datatype
---echo #
-CREATE TABLE t1 (f1 CHAR(255) unicode);
-INSERT INTO t1 values ('abc'),('bcd'),('abc');
---error ER_DUP_ENTRY
-ALTER TABLE t1 ADD UNIQUE Index_1 (f1);
-DROP TABLE t1;
-
---echo #
---echo # Test how character set works with date/time
---echo #
-SET collation_connection=ucs2_general_ci;
---source include/ctype_datetime.inc
-SET NAMES latin1;
-
---echo #
---echo # WL#4013 Unicode german2 collation
---echo #
-SET collation_connection=ucs2_german2_ci;
---source include/ctype_german.inc
-
---echo #
---echo # Bug#59145 valgrind warnings for uninitialized values in my_strtoll10_mb2
---echo #
-SET NAMES latin1;
-SELECT CONVERT(CHAR(NULL USING ucs2), UNSIGNED);
-DO IFNULL(CHAR(NULL USING ucs2), '');
-DO CAST(CONVERT('' USING ucs2) AS UNSIGNED);
-
---echo #
---echo # Test error message for conversion using different charset
---echo #
-
-CREATE TABLE t1 (a DECIMAL(2,0));
-
-SET sql_mode='strict_all_tables';
---error ER_WARN_DATA_OUT_OF_RANGE
-INSERT INTO t1 VALUES (CONVERT('9e99999999' USING ucs2));
-SET sql_mode=DEFAULT;
-
-INSERT IGNORE INTO t1 VALUES (CONVERT('aaa' USING ucs2));
-
-DROP TABLE t1;
-
---echo #
---echo # End of 5.6 tests
---echo #
-
-
---echo #
---echo # Start of 10.0 tests
---echo #
-
-SET NAMES latin1, collation_connection=ucs2_bin;
---source include/ctype_like_cond_propagation.inc
-SET NAMES latin1, collation_connection=ucs2_general_ci;
---source include/ctype_like_cond_propagation.inc
-SET NAMES latin1;
-
---echo #
---echo # MDEV-6661 PI() does not work well in UCS2/UTF16/UTF32 context
---echo #
-SELECT CONCAT(CONVERT('pi=' USING ucs2),PI()) AS PI;
-
---echo #
---echo # MDEV-6695 Bad column name for UCS2 string literals
---echo #
-SET NAMES utf8, character_set_connection=ucs2;
-SELECT 'a','aa';
-
---echo #
---echo # MDEV-10306 Wrong results with combination of CONCAT, SUBSTR and CONVERT in subquery
---echo #
-
-SET NAMES utf8, character_set_connection=ucs2;
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch=_utf8'derived_merge=on';
-CREATE TABLE t1 (t VARCHAR(10) CHARSET latin1);
-INSERT INTO t1 VALUES('abcdefghi');
-SET NAMES utf8, character_set_connection=ucs2;
-SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT HEX(t) t2 FROM t1) sub;
-SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT TO_BASE64(t) t2 FROM t1) sub;
-DROP TABLE t1;
-SET optimizer_switch=@save_optimizer_switch;
-
-
---echo #
---echo # End of 10.0 tests
---echo #
-
-#
-# CAST (... BINARY)
-#
-select collation(cast("a" as char(10) unicode binary));
-select collation(cast("a" as char(10) binary unicode));
-
---echo #
---echo # MDEV-8222 "string_field LIKE int_const" returns a wrong result in case of UCS2
---echo #
-CREATE TABLE t1 (a VARCHAR(10) CHARSET ucs2);
-INSERT INTO t1 VALUES ('1');
-SELECT * FROM t1 WHERE a LIKE 1;
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-8253 EXPLAIN SELECT prints unexpected characters
---echo #
-SET NAMES latin1, character_set_connection=ucs2;
-CREATE TABLE t1 (a DECIMAL(10,1),b DECIMAL(10,1),c VARCHAR(10),d VARCHAR(10));
-INSERT INTO t1 VALUES (1.5,1.5,'1','1'),(3.5,3.5,'3','3');
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE COALESCE(c,0)='3 ' AND COALESCE(d,0)=COALESCE(c,0);
-DROP TABLE t1;
-
---echo #
---echo # MDEV-9178 Wrong result for CAST(CONVERT('1IJ3' USING ucs2) AS SIGNED)
---echo #
-SET NAMES utf8;
-SELECT CAST(CONVERT('1IJ3' USING ucs2) AS SIGNED);
-
---echo #
---echo # End of 10.1 tests
---echo #
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-9711 NO PAD Collatons
---echo #
-SET character_set_connection=ucs2;
-let $coll='ucs2_general_nopad_ci';
-let $coll_pad='ucs2_general_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='ucs2_nopad_bin';
-let $coll_pad='ucs2_bin';
---source include/ctype_pad_all_engines.inc
-
---echo #
---echo # MDEV-10585 EXECUTE IMMEDIATE statement
---echo #
-SET character_set_connection=ucs2;
-EXECUTE IMMEDIATE 'SELECT COLLATION("a")';
-
-SET @stmt='SELECT COLLATION("a")';
-EXECUTE IMMEDIATE @stmt;
-
---echo #
---echo # MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions
---echo #
-SET NAMES utf8, collation_connection=ucs2_bin;
-SET @stmt='SELECT COLLATION(''a'')';
-EXECUTE IMMEDIATE @stmt;
-
-SET NAMES utf8, character_set_connection=ucs2;
-SET @stmt='SELECT COLLATION(''a'')';
-EXECUTE IMMEDIATE @stmt;
-
-EXECUTE IMMEDIATE CONCAT('SELECT ''a'' FROM DUAL');
-
-SELECT HEX('aä') FROM DUAL;
-EXECUTE IMMEDIATE 'SELECT HEX(''aä'') FROM DUAL';
-EXECUTE IMMEDIATE CONCAT('SELECT HEX(''aä'') FROM DUAL');
-EXECUTE IMMEDIATE CONCAT('SELECT HEX(''aä'') FROM ', 'DUAL');
-PREPARE stmt FROM 'SELECT HEX(''aä'') FROM DUAL';
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-
-SET @table='DUAL';
-SELECT HEX(@table);
-EXECUTE IMMEDIATE CONCAT('SELECT HEX(''aä'') FROM ', @table);
-EXECUTE IMMEDIATE CONCAT('SELECT HEX(''aä'') FROM ', CONVERT(@table USING utf8));
-SET @stmt='SELECT HEX(''aä'') FROM DUAL';
-EXECUTE IMMEDIATE @stmt;
-PREPARE stmt FROM @stmt;
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/ctype_ucs2_def-master.opt b/mysql-test/t/ctype_ucs2_def-master.opt
deleted file mode 100644
index 711ec42bd8a..00000000000
--- a/mysql-test/t/ctype_ucs2_def-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---collation-server=ucs2_unicode_ci --character-set-server=ucs2,latin1
diff --git a/mysql-test/t/ctype_ucs2_def.test b/mysql-test/t/ctype_ucs2_def.test
deleted file mode 100644
index e297fa5ccf1..00000000000
--- a/mysql-test/t/ctype_ucs2_def.test
+++ /dev/null
@@ -1,57 +0,0 @@
--- source include/have_ucs2.inc
-
-call mtr.add_suppression("'ucs2' can not be used as client character set");
-
-#
-# MySQL Bug#15276: MySQL ignores collation-server
-#
-show variables like 'collation_server';
-
-#
-# Bug#18004 Connecting crashes server when default charset is UCS2
-#
-show variables like "%character_set_ser%";
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-create table t1 (a int);
-drop table t1;
-
---echo End of 4.1 tests
-
-#
-# Bug #28925 GROUP_CONCAT inserts wrong separators for a ucs2 column
-# Check that GROUP_CONCAT works fine with --default-character-set=ucs2
-#
-create table t1 (a char(1) character set latin1);
-insert into t1 values ('a'),('b'),('c');
-select hex(group_concat(a)) from t1;
-drop table t1;
-#
-# Bug #27643: query failed : 1114 (The table '' is full)
-#
-# Check that HASH indexes ignore trailing spaces when comparing
-# strings with the ucs2_bin collation
-
-CREATE TABLE t1(col1 VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL,
- col2 VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL,
- UNIQUE KEY key1 USING HASH (col1, col2)) ENGINE=MEMORY;
-INSERT INTO t1 VALUES('A', 'A'), ('B', 'B'), ('C', 'C');
---error ER_DUP_ENTRY
-INSERT INTO t1 VALUES('A ', 'A ');
-DROP TABLE t1;
-
-#
-# Bug#32705 - myisam corruption: Key in wrong position
-# at page 1024 with ucs2_bin
-#
-CREATE TABLE t1 (
- c1 CHAR(255) CHARACTER SET UCS2 COLLATE UCS2_BIN NOT NULL,
- KEY(c1)
- ) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('marshall\'s');
-INSERT INTO t1 VALUES ('marsh');
-CHECK TABLE t1 EXTENDED;
-DROP TABLE t1;
-
---echo End of 5.0 tests
diff --git a/mysql-test/t/ctype_ucs2_query_cache-master.opt b/mysql-test/t/ctype_ucs2_query_cache-master.opt
deleted file mode 100644
index 413ebb9f898..00000000000
--- a/mysql-test/t/ctype_ucs2_query_cache-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---collation-server=ucs2_unicode_ci --character-set-server=ucs2,latin1 --query-cache-size=1048576
diff --git a/mysql-test/t/ctype_ucs2_query_cache.test b/mysql-test/t/ctype_ucs2_query_cache.test
deleted file mode 100644
index ace826aec44..00000000000
--- a/mysql-test/t/ctype_ucs2_query_cache.test
+++ /dev/null
@@ -1,22 +0,0 @@
--- source include/have_query_cache.inc
--- source include/have_ucs2.inc
-
-call mtr.add_suppression("'ucs2' can not be used as client character set");
-
---echo #
---echo # Start of 5.5 tests
---echo #
-
---echo #
---echo # Bug#MDEV-4518 Server crashes in is_white_space when it's run
---echo # with query cache, charset ucs2 and collation ucs2_unicode_ci
---echo #
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1),(2),(3),(4);
-SELECT * FROM t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # End of 5.5 tests
---echo #
diff --git a/mysql-test/t/ctype_ucs2_uca.test b/mysql-test/t/ctype_ucs2_uca.test
deleted file mode 100644
index 0aed0956f6c..00000000000
--- a/mysql-test/t/ctype_ucs2_uca.test
+++ /dev/null
@@ -1,25 +0,0 @@
--- source include/have_ucs2.inc
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-10877 xxx_unicode_nopad_ci collations
---echo #
-SET NAMES utf8, character_set_connection=ucs2;
-let $coll='ucs2_unicode_nopad_ci';
-let $coll_pad='ucs2_unicode_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='ucs2_unicode_520_nopad_ci';
-let $coll_pad='ucs2_unicode_520_ci';
---source include/ctype_pad_all_engines.inc
-
-SET NAMES utf8, collation_connection=ucs2_unicode_520_nopad_ci;
---source include/ctype_like_range_mdev14350.inc
-SET NAMES utf8;
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/ctype_ujis.test b/mysql-test/t/ctype_ujis.test
deleted file mode 100644
index ff9c61c05ba..00000000000
--- a/mysql-test/t/ctype_ujis.test
+++ /dev/null
@@ -1,1427 +0,0 @@
--- source include/have_ujis.inc
-
-#
-# Tests with the ujis character set
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-set names ujis;
-
-#
-# Test problem with LEFT()
-#
-
-create table t1 (c text character set ujis);
-insert into t1 values (0xa4a2),(0xa4a3);
-select hex(left(c,1)) from t1 group by c;
-drop table t1;
-
-#
-#
-#
-select locate(0xa2a1,0xa1a2a1a3);
-select locate(_ujis 0xa2a1,_ujis 0xa1a2a1a3);
-select locate(_ujis 0xa2a1,_ujis 0xa1a2a1a3 collate ujis_bin);
-select locate('he','hello');
-select locate('he','hello',2);
-select locate('lo','hello',2);
-select locate('HE','hello');
-select locate('HE','hello',2);
-select locate('LO','hello',2);
-select locate('HE','hello' collate ujis_bin);
-select locate('HE','hello' collate ujis_bin,2);
-select locate('LO','hello' collate ujis_bin,2);
-select locate(_ujis 0xa1a3,_ujis 0xa1a2a1a3);
-
-select 0xa1a2a1a3 like concat(_binary'%',0xa2a1,_binary'%');
-select _ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%');
-select _ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%') collate ujis_bin;
-select 'a' like 'a';
-select 'A' like 'a';
-select 'A' like 'a' collate ujis_bin;
-
-#
-# Bug 3290: Hald-width Katakana conversion problem.
-# Check ujis-utf8-ujis round trip.
-#
-set @ujis1= _ujis 0x8EA18EA28EA38EA48EA58EA68EA78EA88EA98EAA8EAB8EAC8EAD8EAE8EAF;
-set @ujis2= _ujis 0x8EB08EB18EB28EB38EB48EB58EB68EB78EB88EB98EBA8EBB8EBC8EBD8EBE8EBF;
-set @ujis3= _ujis 0x8EC08EC18EC28EC38EC48EC58EC68EC78EC88EC98ECA8ECB8ECC8ECD8ECE8ECF;
-set @ujis4= _ujis 0x8ED08ED18ED28ED38ED48ED58ED68ED78ED88ED98EDA8EDB8EDC8EDD8EDE8EDF;
-
-select hex(@utf81:= CONVERT(@ujis1 USING utf8));
-select hex(@utf82:= CONVERT(@ujis2 USING utf8));
-select hex(@utf83:= CONVERT(@ujis3 USING utf8));
-select hex(@utf84:= CONVERT(@ujis4 USING utf8));
-
-select @ujis1 = CONVERT(@utf81 USING ujis);
-select @ujis2 = CONVERT(@utf82 USING ujis);
-select @ujis3 = CONVERT(@utf83 USING ujis);
-select @ujis4 = CONVERT(@utf84 USING ujis);
-
-#
-# Testing with '%' and index (Bug #3438)
-#
-
-drop table if exists t1;
-create table t1 (c1 varchar(8)) default character set 'ujis';
-insert into t1 values (0xA4A2),(0xA2A2),(0xA4A2);
-select c1 as 'no index' from t1 where c1 like cast(concat(0xA4A2, '%') as char character set ujis);
-create index idx_c1 on t1(c1);
-select c1 as 'using index' from t1 where c1 like cast(concat(0xA4A2, '%') as char character set ujis);
-select c1 as 'no index' from t1 where c1 like cast(concat('%',0xA4A2, '%') as char character set ujis);
-drop table t1;
-
-
-# Bug 2077
-CREATE TABLE t1 (
- a char(1) NOT NULL default '',
- b enum('','') default NULL
-) CHARACTER SET ujis;
-SHOW CREATE TABLE t1;
-SHOW COLUMNS FROM t1;
-DROP TABLE t1;
-
-#
-# Bug #6345 Unexpected behaviour with partial indices
-#
-set sql_mode="";
---disable_warnings
-CREATE TABLE t1
-(
- a INTEGER NOT NULL,
- b VARCHAR(50) NOT NULL DEFAULT '',
- PRIMARY KEY (a),
- KEY b (b(10))
-) ENGINE=InnoDB CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
---enable_warnings
-set sql_mode=default;
-INSERT INTO t1 (a, b) VALUES (0, 'aaabbbcccddd');
-INSERT INTO t1 (a, b) VALUES (1, 'eeefffggghhh');
-INSERT INTO t1 (a, b) VALUES (2, 'iiijjjkkkl');
-SELECT t1.* FROM t1 WHERE b='aaabbbcccddd' ORDER BY a;
-SELECT t1.* FROM t1 WHERE b='eeefffggghhh' ORDER BY a;
-SELECT t1.* FROM t1 WHERE b='iiijjjkkkl' ORDER BY a;
-DROP TABLE t1;
---disable_warnings
-CREATE TABLE t1
-(
- a INTEGER NOT NULL,
- b VARCHAR(50) NOT NULL DEFAULT '',
- PRIMARY KEY (a),
- KEY b (b(10))
-) ENGINE=MyISAM CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
---enable_warnings
-INSERT INTO t1 (a, b) VALUES (0, 'aaabbbcccddd');
-INSERT INTO t1 (a, b) VALUES (1, 'eeefffggghhh');
-INSERT INTO t1 (a, b) VALUES (2, 'iiijjjkkkl');
-SELECT t1.* FROM t1 WHERE b='aaabbbcccddd' ORDER BY a;
-SELECT t1.* FROM t1 WHERE b='eeefffggghhh' ORDER BY a;
-SELECT t1.* FROM t1 WHERE b='iiijjjkkkl' ORDER BY a;
-DROP TABLE t1;
-
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1(c char(1)) character set ujis;
-INSERT INTO t1 VALUES(0xA2AF);
-INSERT INTO t1 VALUES(0xA2B0);
-INSERT INTO t1 VALUES(0xA2B1);
-INSERT INTO t1 VALUES(0xA2B2);
-INSERT INTO t1 VALUES(0xA2B3);
-INSERT INTO t1 VALUES(0xA2B4);
-INSERT INTO t1 VALUES(0xA2B5);
-INSERT INTO t1 VALUES(0xA2B6);
-INSERT INTO t1 VALUES(0xA2B7);
-INSERT INTO t1 VALUES(0xA2B8);
-INSERT INTO t1 VALUES(0xA2B9);
-INSERT INTO t1 VALUES(0xA2C2);
-INSERT INTO t1 VALUES(0xA2C3);
-INSERT INTO t1 VALUES(0xA2C4);
-INSERT INTO t1 VALUES(0xA2C5);
-INSERT INTO t1 VALUES(0xA2C6);
-INSERT INTO t1 VALUES(0xA2C7);
-INSERT INTO t1 VALUES(0xA2C8);
-INSERT INTO t1 VALUES(0xA2C9);
-INSERT INTO t1 VALUES(0xA2D1);
-INSERT INTO t1 VALUES(0xA2D2);
-INSERT INTO t1 VALUES(0xA2D3);
-INSERT INTO t1 VALUES(0xA2D4);
-INSERT INTO t1 VALUES(0xA2D5);
-INSERT INTO t1 VALUES(0xA2D6);
-INSERT INTO t1 VALUES(0xA2D7);
-INSERT INTO t1 VALUES(0xA2D8);
-INSERT INTO t1 VALUES(0xA2D9);
-INSERT INTO t1 VALUES(0xA2DA);
-INSERT INTO t1 VALUES(0xA2DB);
-INSERT INTO t1 VALUES(0xA2EB);
-INSERT INTO t1 VALUES(0xA2EC);
-INSERT INTO t1 VALUES(0xA2ED);
-INSERT INTO t1 VALUES(0xA2EE);
-INSERT INTO t1 VALUES(0xA2EF);
-INSERT INTO t1 VALUES(0xA2F0);
-INSERT INTO t1 VALUES(0xA2F1);
-INSERT INTO t1 VALUES(0xA2FA);
-INSERT INTO t1 VALUES(0xA2FB);
-INSERT INTO t1 VALUES(0xA2FC);
-INSERT INTO t1 VALUES(0xA2FD);
-INSERT INTO t1 VALUES(0xA3A1);
-INSERT INTO t1 VALUES(0xA3A2);
-INSERT INTO t1 VALUES(0xA3A3);
-INSERT INTO t1 VALUES(0xA3A4);
-INSERT INTO t1 VALUES(0xA3A5);
-INSERT INTO t1 VALUES(0xA3A6);
-INSERT INTO t1 VALUES(0xA3A7);
-INSERT INTO t1 VALUES(0xA3A8);
-INSERT INTO t1 VALUES(0xA3A9);
-INSERT INTO t1 VALUES(0xA3AA);
-INSERT INTO t1 VALUES(0xA3AB);
-INSERT INTO t1 VALUES(0xA3AC);
-INSERT INTO t1 VALUES(0xA3AD);
-INSERT INTO t1 VALUES(0xA3AE);
-INSERT INTO t1 VALUES(0xA3AF);
-INSERT INTO t1 VALUES(0xA3BA);
-INSERT INTO t1 VALUES(0xA3BB);
-INSERT INTO t1 VALUES(0xA3BC);
-INSERT INTO t1 VALUES(0xA3BD);
-INSERT INTO t1 VALUES(0xA3BE);
-INSERT INTO t1 VALUES(0xA3BF);
-INSERT INTO t1 VALUES(0xA3C0);
-INSERT INTO t1 VALUES(0xA3DB);
-INSERT INTO t1 VALUES(0xA3DC);
-INSERT INTO t1 VALUES(0xA3DD);
-INSERT INTO t1 VALUES(0xA3DE);
-INSERT INTO t1 VALUES(0xA3DF);
-INSERT INTO t1 VALUES(0xA3E0);
-INSERT INTO t1 VALUES(0xA3FB);
-INSERT INTO t1 VALUES(0xA3FC);
-INSERT INTO t1 VALUES(0xA3FD);
-INSERT INTO t1 VALUES(0xA3FE);
-INSERT INTO t1 VALUES(0xA4F4);
-INSERT INTO t1 VALUES(0xA4F5);
-INSERT INTO t1 VALUES(0xA4F6);
-INSERT INTO t1 VALUES(0xA4F7);
-INSERT INTO t1 VALUES(0xA4F8);
-INSERT INTO t1 VALUES(0xA4F9);
-INSERT INTO t1 VALUES(0xA4FA);
-INSERT INTO t1 VALUES(0xA4FB);
-INSERT INTO t1 VALUES(0xA4FC);
-INSERT INTO t1 VALUES(0xA4FD);
-INSERT INTO t1 VALUES(0xA4FE);
-INSERT INTO t1 VALUES(0xA5F7);
-INSERT INTO t1 VALUES(0xA5F8);
-INSERT INTO t1 VALUES(0xA5F9);
-INSERT INTO t1 VALUES(0xA5FA);
-INSERT INTO t1 VALUES(0xA5FB);
-INSERT INTO t1 VALUES(0xA5FC);
-INSERT INTO t1 VALUES(0xA5FD);
-INSERT INTO t1 VALUES(0xA5FE);
-INSERT INTO t1 VALUES(0xA6B9);
-INSERT INTO t1 VALUES(0xA6BA);
-INSERT INTO t1 VALUES(0xA6BB);
-INSERT INTO t1 VALUES(0xA6BC);
-INSERT INTO t1 VALUES(0xA6BD);
-INSERT INTO t1 VALUES(0xA6BE);
-INSERT INTO t1 VALUES(0xA6BF);
-INSERT INTO t1 VALUES(0xA6C0);
-INSERT INTO t1 VALUES(0xA6D9);
-INSERT INTO t1 VALUES(0xA6DA);
-INSERT INTO t1 VALUES(0xA6DB);
-INSERT INTO t1 VALUES(0xA6DC);
-INSERT INTO t1 VALUES(0xA6DD);
-INSERT INTO t1 VALUES(0xA6DE);
-INSERT INTO t1 VALUES(0xA6DF);
-INSERT INTO t1 VALUES(0xA6E0);
-INSERT INTO t1 VALUES(0xA6E1);
-INSERT INTO t1 VALUES(0xA6E2);
-INSERT INTO t1 VALUES(0xA6E3);
-INSERT INTO t1 VALUES(0xA6E4);
-INSERT INTO t1 VALUES(0xA6E5);
-INSERT INTO t1 VALUES(0xA6E6);
-INSERT INTO t1 VALUES(0xA6E7);
-INSERT INTO t1 VALUES(0xA6E8);
-INSERT INTO t1 VALUES(0xA6E9);
-INSERT INTO t1 VALUES(0xA6EA);
-INSERT INTO t1 VALUES(0xA6EB);
-INSERT INTO t1 VALUES(0xA6EC);
-INSERT INTO t1 VALUES(0xA6ED);
-INSERT INTO t1 VALUES(0xA6EE);
-INSERT INTO t1 VALUES(0xA6EF);
-INSERT INTO t1 VALUES(0xA6F0);
-INSERT INTO t1 VALUES(0xA6F1);
-INSERT INTO t1 VALUES(0xA6F2);
-INSERT INTO t1 VALUES(0xA6F3);
-INSERT INTO t1 VALUES(0xA6F4);
-INSERT INTO t1 VALUES(0xA6F5);
-INSERT INTO t1 VALUES(0xA6F6);
-INSERT INTO t1 VALUES(0xA6F7);
-INSERT INTO t1 VALUES(0xA6F8);
-INSERT INTO t1 VALUES(0xA6F9);
-INSERT INTO t1 VALUES(0xA6FA);
-INSERT INTO t1 VALUES(0xA6FB);
-INSERT INTO t1 VALUES(0xA6FC);
-INSERT INTO t1 VALUES(0xA6FD);
-INSERT INTO t1 VALUES(0xA6FE);
-INSERT INTO t1 VALUES(0xA7C2);
-INSERT INTO t1 VALUES(0xA7C3);
-INSERT INTO t1 VALUES(0xA7C4);
-INSERT INTO t1 VALUES(0xA7C5);
-INSERT INTO t1 VALUES(0xA7C6);
-INSERT INTO t1 VALUES(0xA7C7);
-INSERT INTO t1 VALUES(0xA7C8);
-INSERT INTO t1 VALUES(0xA7C9);
-INSERT INTO t1 VALUES(0xA7CA);
-INSERT INTO t1 VALUES(0xA7CB);
-INSERT INTO t1 VALUES(0xA7CC);
-INSERT INTO t1 VALUES(0xA7CD);
-INSERT INTO t1 VALUES(0xA7CE);
-INSERT INTO t1 VALUES(0xA7CF);
-INSERT INTO t1 VALUES(0xA7D0);
-INSERT INTO t1 VALUES(0xA7F2);
-INSERT INTO t1 VALUES(0xA7F3);
-INSERT INTO t1 VALUES(0xA7F4);
-INSERT INTO t1 VALUES(0xA7F5);
-INSERT INTO t1 VALUES(0xA7F6);
-INSERT INTO t1 VALUES(0xA7F7);
-INSERT INTO t1 VALUES(0xA7F8);
-INSERT INTO t1 VALUES(0xA7F9);
-INSERT INTO t1 VALUES(0xA7FA);
-INSERT INTO t1 VALUES(0xA7FB);
-INSERT INTO t1 VALUES(0xA7FC);
-INSERT INTO t1 VALUES(0xA7FD);
-INSERT INTO t1 VALUES(0xA7FE);
-INSERT INTO t1 VALUES(0xA8C1);
-INSERT INTO t1 VALUES(0xA8C2);
-INSERT INTO t1 VALUES(0xA8C3);
-INSERT INTO t1 VALUES(0xA8C4);
-INSERT INTO t1 VALUES(0xA8C5);
-INSERT INTO t1 VALUES(0xA8C6);
-INSERT INTO t1 VALUES(0xA8C7);
-INSERT INTO t1 VALUES(0xA8C8);
-INSERT INTO t1 VALUES(0xA8C9);
-INSERT INTO t1 VALUES(0xA8CA);
-INSERT INTO t1 VALUES(0xA8CB);
-INSERT INTO t1 VALUES(0xA8CC);
-INSERT INTO t1 VALUES(0xA8CD);
-INSERT INTO t1 VALUES(0xA8CE);
-INSERT INTO t1 VALUES(0xA8CF);
-INSERT INTO t1 VALUES(0xA8D0);
-INSERT INTO t1 VALUES(0xA8D1);
-INSERT INTO t1 VALUES(0xA8D2);
-INSERT INTO t1 VALUES(0xA8D3);
-INSERT INTO t1 VALUES(0xA8D4);
-INSERT INTO t1 VALUES(0xA8D5);
-INSERT INTO t1 VALUES(0xA8D6);
-INSERT INTO t1 VALUES(0xA8D7);
-INSERT INTO t1 VALUES(0xA8D8);
-INSERT INTO t1 VALUES(0xA8D9);
-INSERT INTO t1 VALUES(0xA8DA);
-INSERT INTO t1 VALUES(0xA8DB);
-INSERT INTO t1 VALUES(0xA8DC);
-INSERT INTO t1 VALUES(0xA8DD);
-INSERT INTO t1 VALUES(0xA8DE);
-INSERT INTO t1 VALUES(0xA8DF);
-INSERT INTO t1 VALUES(0xA8E0);
-INSERT INTO t1 VALUES(0xA8E1);
-INSERT INTO t1 VALUES(0xA8E2);
-INSERT INTO t1 VALUES(0xA8E3);
-INSERT INTO t1 VALUES(0xA8E4);
-INSERT INTO t1 VALUES(0xA8E5);
-INSERT INTO t1 VALUES(0xA8E6);
-INSERT INTO t1 VALUES(0xA8E7);
-INSERT INTO t1 VALUES(0xA8E8);
-INSERT INTO t1 VALUES(0xA8E9);
-INSERT INTO t1 VALUES(0xA8EA);
-INSERT INTO t1 VALUES(0xA8EB);
-INSERT INTO t1 VALUES(0xA8EC);
-INSERT INTO t1 VALUES(0xA8ED);
-INSERT INTO t1 VALUES(0xA8EE);
-INSERT INTO t1 VALUES(0xA8EF);
-INSERT INTO t1 VALUES(0xA8F0);
-INSERT INTO t1 VALUES(0xA8F1);
-INSERT INTO t1 VALUES(0xA8F2);
-INSERT INTO t1 VALUES(0xA8F3);
-INSERT INTO t1 VALUES(0xA8F4);
-INSERT INTO t1 VALUES(0xA8F5);
-INSERT INTO t1 VALUES(0xA8F6);
-INSERT INTO t1 VALUES(0xA8F7);
-INSERT INTO t1 VALUES(0xA8F8);
-INSERT INTO t1 VALUES(0xA8F9);
-INSERT INTO t1 VALUES(0xA8FA);
-INSERT INTO t1 VALUES(0xA8FB);
-INSERT INTO t1 VALUES(0xA8FC);
-INSERT INTO t1 VALUES(0xA8FD);
-INSERT INTO t1 VALUES(0xA8FE);
-INSERT INTO t1 VALUES(0xA9A1);
-INSERT INTO t1 VALUES(0xA9A2);
-INSERT INTO t1 VALUES(0xA9A3);
-INSERT INTO t1 VALUES(0xA9A4);
-INSERT INTO t1 VALUES(0xA9A5);
-INSERT INTO t1 VALUES(0xA9A6);
-INSERT INTO t1 VALUES(0xA9A7);
-INSERT INTO t1 VALUES(0xA9A8);
-INSERT INTO t1 VALUES(0xA9A9);
-INSERT INTO t1 VALUES(0xA9AA);
-INSERT INTO t1 VALUES(0xA9AB);
-INSERT INTO t1 VALUES(0xA9AC);
-INSERT INTO t1 VALUES(0xA9AD);
-INSERT INTO t1 VALUES(0xA9AE);
-INSERT INTO t1 VALUES(0xA9AF);
-INSERT INTO t1 VALUES(0xA9B0);
-INSERT INTO t1 VALUES(0xA9B1);
-INSERT INTO t1 VALUES(0xA9B2);
-INSERT INTO t1 VALUES(0xA9B3);
-INSERT INTO t1 VALUES(0xA9B4);
-INSERT INTO t1 VALUES(0xA9B5);
-INSERT INTO t1 VALUES(0xA9B6);
-INSERT INTO t1 VALUES(0xA9B7);
-INSERT INTO t1 VALUES(0xA9B8);
-INSERT INTO t1 VALUES(0xA9B9);
-INSERT INTO t1 VALUES(0xA9BA);
-INSERT INTO t1 VALUES(0xA9BB);
-INSERT INTO t1 VALUES(0xA9BC);
-INSERT INTO t1 VALUES(0xA9BD);
-INSERT INTO t1 VALUES(0xA9BE);
-INSERT INTO t1 VALUES(0xA9BF);
-INSERT INTO t1 VALUES(0xA9C0);
-INSERT INTO t1 VALUES(0xA9C1);
-INSERT INTO t1 VALUES(0xA9C2);
-INSERT INTO t1 VALUES(0xA9C3);
-INSERT INTO t1 VALUES(0xA9C4);
-INSERT INTO t1 VALUES(0xA9C5);
-INSERT INTO t1 VALUES(0xA9C6);
-INSERT INTO t1 VALUES(0xA9C7);
-INSERT INTO t1 VALUES(0xA9C8);
-INSERT INTO t1 VALUES(0xA9C9);
-INSERT INTO t1 VALUES(0xA9CA);
-INSERT INTO t1 VALUES(0xA9CB);
-INSERT INTO t1 VALUES(0xA9CC);
-INSERT INTO t1 VALUES(0xA9CD);
-INSERT INTO t1 VALUES(0xA9CE);
-INSERT INTO t1 VALUES(0xA9CF);
-INSERT INTO t1 VALUES(0xA9D0);
-INSERT INTO t1 VALUES(0xA9D1);
-INSERT INTO t1 VALUES(0xA9D2);
-INSERT INTO t1 VALUES(0xA9D3);
-INSERT INTO t1 VALUES(0xA9D4);
-INSERT INTO t1 VALUES(0xA9D5);
-INSERT INTO t1 VALUES(0xA9D6);
-INSERT INTO t1 VALUES(0xA9D7);
-INSERT INTO t1 VALUES(0xA9D8);
-INSERT INTO t1 VALUES(0xA9D9);
-INSERT INTO t1 VALUES(0xA9DA);
-INSERT INTO t1 VALUES(0xA9DB);
-INSERT INTO t1 VALUES(0xA9DC);
-INSERT INTO t1 VALUES(0xA9DD);
-INSERT INTO t1 VALUES(0xA9DE);
-INSERT INTO t1 VALUES(0xA9DF);
-INSERT INTO t1 VALUES(0xA9E0);
-INSERT INTO t1 VALUES(0xA9E1);
-INSERT INTO t1 VALUES(0xA9E2);
-INSERT INTO t1 VALUES(0xA9E3);
-INSERT INTO t1 VALUES(0xA9E4);
-INSERT INTO t1 VALUES(0xA9E5);
-INSERT INTO t1 VALUES(0xA9E6);
-INSERT INTO t1 VALUES(0xA9E7);
-INSERT INTO t1 VALUES(0xA9E8);
-INSERT INTO t1 VALUES(0xA9E9);
-INSERT INTO t1 VALUES(0xA9EA);
-INSERT INTO t1 VALUES(0xA9EB);
-INSERT INTO t1 VALUES(0xA9EC);
-INSERT INTO t1 VALUES(0xA9ED);
-INSERT INTO t1 VALUES(0xA9EE);
-INSERT INTO t1 VALUES(0xA9EF);
-INSERT INTO t1 VALUES(0xA9F0);
-INSERT INTO t1 VALUES(0xA9F1);
-INSERT INTO t1 VALUES(0xA9F2);
-INSERT INTO t1 VALUES(0xA9F3);
-INSERT INTO t1 VALUES(0xA9F4);
-INSERT INTO t1 VALUES(0xA9F5);
-INSERT INTO t1 VALUES(0xA9F6);
-INSERT INTO t1 VALUES(0xA9F7);
-INSERT INTO t1 VALUES(0xA9F8);
-INSERT INTO t1 VALUES(0xA9F9);
-INSERT INTO t1 VALUES(0xA9FA);
-INSERT INTO t1 VALUES(0xA9FB);
-INSERT INTO t1 VALUES(0xA9FC);
-INSERT INTO t1 VALUES(0xA9FD);
-INSERT INTO t1 VALUES(0xA9FE);
-INSERT INTO t1 VALUES(0xAAA1);
-INSERT INTO t1 VALUES(0xAAA2);
-INSERT INTO t1 VALUES(0xAAA3);
-INSERT INTO t1 VALUES(0xAAA4);
-INSERT INTO t1 VALUES(0xAAA5);
-INSERT INTO t1 VALUES(0xAAA6);
-INSERT INTO t1 VALUES(0xAAA7);
-INSERT INTO t1 VALUES(0xAAA8);
-INSERT INTO t1 VALUES(0xAAA9);
-INSERT INTO t1 VALUES(0xAAAA);
-INSERT INTO t1 VALUES(0xAAAB);
-INSERT INTO t1 VALUES(0xAAAC);
-INSERT INTO t1 VALUES(0xAAAD);
-INSERT INTO t1 VALUES(0xAAAE);
-INSERT INTO t1 VALUES(0xAAAF);
-INSERT INTO t1 VALUES(0xAAB0);
-INSERT INTO t1 VALUES(0xAAB1);
-INSERT INTO t1 VALUES(0xAAB2);
-INSERT INTO t1 VALUES(0xAAB3);
-INSERT INTO t1 VALUES(0xAAB4);
-INSERT INTO t1 VALUES(0xAAB5);
-INSERT INTO t1 VALUES(0xAAB6);
-INSERT INTO t1 VALUES(0xAAB7);
-INSERT INTO t1 VALUES(0xAAB8);
-INSERT INTO t1 VALUES(0xAAB9);
-INSERT INTO t1 VALUES(0xAABA);
-INSERT INTO t1 VALUES(0xAABB);
-INSERT INTO t1 VALUES(0xAABC);
-INSERT INTO t1 VALUES(0xAABD);
-INSERT INTO t1 VALUES(0xAABE);
-INSERT INTO t1 VALUES(0xAABF);
-INSERT INTO t1 VALUES(0xAAC0);
-INSERT INTO t1 VALUES(0xAAC1);
-INSERT INTO t1 VALUES(0xAAC2);
-INSERT INTO t1 VALUES(0xAAC3);
-INSERT INTO t1 VALUES(0xAAC4);
-INSERT INTO t1 VALUES(0xAAC5);
-INSERT INTO t1 VALUES(0xAAC6);
-INSERT INTO t1 VALUES(0xAAC7);
-INSERT INTO t1 VALUES(0xAAC8);
-INSERT INTO t1 VALUES(0xAAC9);
-INSERT INTO t1 VALUES(0xAACA);
-INSERT INTO t1 VALUES(0xAACB);
-INSERT INTO t1 VALUES(0xAACC);
-INSERT INTO t1 VALUES(0xAACD);
-INSERT INTO t1 VALUES(0xAACE);
-INSERT INTO t1 VALUES(0xAACF);
-INSERT INTO t1 VALUES(0xAAD0);
-INSERT INTO t1 VALUES(0xAAD1);
-INSERT INTO t1 VALUES(0xAAD2);
-INSERT INTO t1 VALUES(0xAAD3);
-INSERT INTO t1 VALUES(0xAAD4);
-INSERT INTO t1 VALUES(0xAAD5);
-INSERT INTO t1 VALUES(0xAAD6);
-INSERT INTO t1 VALUES(0xAAD7);
-INSERT INTO t1 VALUES(0xAAD8);
-INSERT INTO t1 VALUES(0xAAD9);
-INSERT INTO t1 VALUES(0xAADA);
-INSERT INTO t1 VALUES(0xAADB);
-INSERT INTO t1 VALUES(0xAADC);
-INSERT INTO t1 VALUES(0xAADD);
-INSERT INTO t1 VALUES(0xAADE);
-INSERT INTO t1 VALUES(0xAADF);
-INSERT INTO t1 VALUES(0xAAE0);
-INSERT INTO t1 VALUES(0xAAE1);
-INSERT INTO t1 VALUES(0xAAE2);
-INSERT INTO t1 VALUES(0xAAE3);
-INSERT INTO t1 VALUES(0xAAE4);
-INSERT INTO t1 VALUES(0xAAE5);
-INSERT INTO t1 VALUES(0xAAE6);
-INSERT INTO t1 VALUES(0xAAE7);
-INSERT INTO t1 VALUES(0xAAE8);
-INSERT INTO t1 VALUES(0xAAE9);
-INSERT INTO t1 VALUES(0xAAEA);
-INSERT INTO t1 VALUES(0xAAEB);
-INSERT INTO t1 VALUES(0xAAEC);
-INSERT INTO t1 VALUES(0xAAED);
-INSERT INTO t1 VALUES(0xAAEE);
-INSERT INTO t1 VALUES(0xAAEF);
-INSERT INTO t1 VALUES(0xAAF0);
-INSERT INTO t1 VALUES(0xAAF1);
-INSERT INTO t1 VALUES(0xAAF2);
-INSERT INTO t1 VALUES(0xAAF3);
-INSERT INTO t1 VALUES(0xAAF4);
-INSERT INTO t1 VALUES(0xAAF5);
-INSERT INTO t1 VALUES(0xAAF6);
-INSERT INTO t1 VALUES(0xAAF7);
-INSERT INTO t1 VALUES(0xAAF8);
-INSERT INTO t1 VALUES(0xAAF9);
-INSERT INTO t1 VALUES(0xAAFA);
-INSERT INTO t1 VALUES(0xAAFB);
-INSERT INTO t1 VALUES(0xAAFC);
-INSERT INTO t1 VALUES(0xAAFD);
-INSERT INTO t1 VALUES(0xAAFE);
-INSERT INTO t1 VALUES(0xABA1);
-INSERT INTO t1 VALUES(0xABA2);
-INSERT INTO t1 VALUES(0xABA3);
-INSERT INTO t1 VALUES(0xABA4);
-INSERT INTO t1 VALUES(0xABA5);
-INSERT INTO t1 VALUES(0xABA6);
-INSERT INTO t1 VALUES(0xABA7);
-INSERT INTO t1 VALUES(0xABA8);
-INSERT INTO t1 VALUES(0xABA9);
-INSERT INTO t1 VALUES(0xABAA);
-INSERT INTO t1 VALUES(0xABAB);
-INSERT INTO t1 VALUES(0xABAC);
-INSERT INTO t1 VALUES(0xABAD);
-INSERT INTO t1 VALUES(0xABAE);
-INSERT INTO t1 VALUES(0xABAF);
-INSERT INTO t1 VALUES(0xABB0);
-INSERT INTO t1 VALUES(0xABB1);
-INSERT INTO t1 VALUES(0xABB2);
-INSERT INTO t1 VALUES(0xABB3);
-INSERT INTO t1 VALUES(0xABB4);
-INSERT INTO t1 VALUES(0xABB5);
-INSERT INTO t1 VALUES(0xABB6);
-INSERT INTO t1 VALUES(0xABB7);
-INSERT INTO t1 VALUES(0xABB8);
-INSERT INTO t1 VALUES(0xABB9);
-INSERT INTO t1 VALUES(0xABBA);
-INSERT INTO t1 VALUES(0xABBB);
-INSERT INTO t1 VALUES(0xABBC);
-INSERT INTO t1 VALUES(0xABBD);
-INSERT INTO t1 VALUES(0xABBE);
-INSERT INTO t1 VALUES(0xABBF);
-INSERT INTO t1 VALUES(0xABC0);
-INSERT INTO t1 VALUES(0xABC1);
-INSERT INTO t1 VALUES(0xABC2);
-INSERT INTO t1 VALUES(0xABC3);
-INSERT INTO t1 VALUES(0xABC4);
-INSERT INTO t1 VALUES(0xABC5);
-INSERT INTO t1 VALUES(0xABC6);
-INSERT INTO t1 VALUES(0xABC7);
-INSERT INTO t1 VALUES(0xABC8);
-INSERT INTO t1 VALUES(0xABC9);
-INSERT INTO t1 VALUES(0xABCA);
-INSERT INTO t1 VALUES(0xABCB);
-INSERT INTO t1 VALUES(0xABCC);
-INSERT INTO t1 VALUES(0xABCD);
-INSERT INTO t1 VALUES(0xABCE);
-INSERT INTO t1 VALUES(0xABCF);
-INSERT INTO t1 VALUES(0xABD0);
-INSERT INTO t1 VALUES(0xABD1);
-INSERT INTO t1 VALUES(0xABD2);
-INSERT INTO t1 VALUES(0xABD3);
-INSERT INTO t1 VALUES(0xABD4);
-INSERT INTO t1 VALUES(0xABD5);
-INSERT INTO t1 VALUES(0xABD6);
-INSERT INTO t1 VALUES(0xABD7);
-INSERT INTO t1 VALUES(0xABD8);
-INSERT INTO t1 VALUES(0xABD9);
-INSERT INTO t1 VALUES(0xABDA);
-INSERT INTO t1 VALUES(0xABDB);
-INSERT INTO t1 VALUES(0xABDC);
-INSERT INTO t1 VALUES(0xABDD);
-INSERT INTO t1 VALUES(0xABDE);
-INSERT INTO t1 VALUES(0xABDF);
-INSERT INTO t1 VALUES(0xABE0);
-INSERT INTO t1 VALUES(0xABE1);
-INSERT INTO t1 VALUES(0xABE2);
-INSERT INTO t1 VALUES(0xABE3);
-INSERT INTO t1 VALUES(0xABE4);
-INSERT INTO t1 VALUES(0xABE5);
-INSERT INTO t1 VALUES(0xABE6);
-INSERT INTO t1 VALUES(0xABE7);
-INSERT INTO t1 VALUES(0xABE8);
-INSERT INTO t1 VALUES(0xABE9);
-INSERT INTO t1 VALUES(0xABEA);
-INSERT INTO t1 VALUES(0xABEB);
-INSERT INTO t1 VALUES(0xABEC);
-INSERT INTO t1 VALUES(0xABED);
-INSERT INTO t1 VALUES(0xABEE);
-INSERT INTO t1 VALUES(0xABEF);
-INSERT INTO t1 VALUES(0xABF0);
-INSERT INTO t1 VALUES(0xABF1);
-INSERT INTO t1 VALUES(0xABF2);
-INSERT INTO t1 VALUES(0xABF3);
-INSERT INTO t1 VALUES(0xABF4);
-INSERT INTO t1 VALUES(0xABF5);
-INSERT INTO t1 VALUES(0xABF6);
-INSERT INTO t1 VALUES(0xABF7);
-INSERT INTO t1 VALUES(0xABF8);
-INSERT INTO t1 VALUES(0xABF9);
-INSERT INTO t1 VALUES(0xABFA);
-INSERT INTO t1 VALUES(0xABFB);
-INSERT INTO t1 VALUES(0xABFC);
-INSERT INTO t1 VALUES(0xABFD);
-INSERT INTO t1 VALUES(0xABFE);
-INSERT INTO t1 VALUES(0xACA1);
-INSERT INTO t1 VALUES(0xACA2);
-INSERT INTO t1 VALUES(0xACA3);
-INSERT INTO t1 VALUES(0xACA4);
-INSERT INTO t1 VALUES(0xACA5);
-INSERT INTO t1 VALUES(0xACA6);
-INSERT INTO t1 VALUES(0xACA7);
-INSERT INTO t1 VALUES(0xACA8);
-INSERT INTO t1 VALUES(0xACA9);
-INSERT INTO t1 VALUES(0xACAA);
-INSERT INTO t1 VALUES(0xACAB);
-INSERT INTO t1 VALUES(0xACAC);
-INSERT INTO t1 VALUES(0xACAD);
-INSERT INTO t1 VALUES(0xACAE);
-INSERT INTO t1 VALUES(0xACAF);
-INSERT INTO t1 VALUES(0xACB0);
-INSERT INTO t1 VALUES(0xACB1);
-INSERT INTO t1 VALUES(0xACB2);
-INSERT INTO t1 VALUES(0xACB3);
-INSERT INTO t1 VALUES(0xACB4);
-INSERT INTO t1 VALUES(0xACB5);
-INSERT INTO t1 VALUES(0xACB6);
-INSERT INTO t1 VALUES(0xACB7);
-INSERT INTO t1 VALUES(0xACB8);
-INSERT INTO t1 VALUES(0xACB9);
-INSERT INTO t1 VALUES(0xACBA);
-INSERT INTO t1 VALUES(0xACBB);
-INSERT INTO t1 VALUES(0xACBC);
-INSERT INTO t1 VALUES(0xACBD);
-INSERT INTO t1 VALUES(0xACBE);
-INSERT INTO t1 VALUES(0xACBF);
-INSERT INTO t1 VALUES(0xACC0);
-INSERT INTO t1 VALUES(0xACC1);
-INSERT INTO t1 VALUES(0xACC2);
-INSERT INTO t1 VALUES(0xACC3);
-INSERT INTO t1 VALUES(0xACC4);
-INSERT INTO t1 VALUES(0xACC5);
-INSERT INTO t1 VALUES(0xACC6);
-INSERT INTO t1 VALUES(0xACC7);
-INSERT INTO t1 VALUES(0xACC8);
-INSERT INTO t1 VALUES(0xACC9);
-INSERT INTO t1 VALUES(0xACCA);
-INSERT INTO t1 VALUES(0xACCB);
-INSERT INTO t1 VALUES(0xACCC);
-INSERT INTO t1 VALUES(0xACCD);
-INSERT INTO t1 VALUES(0xACCE);
-INSERT INTO t1 VALUES(0xACCF);
-INSERT INTO t1 VALUES(0xACD0);
-INSERT INTO t1 VALUES(0xACD1);
-INSERT INTO t1 VALUES(0xACD2);
-INSERT INTO t1 VALUES(0xACD3);
-INSERT INTO t1 VALUES(0xACD4);
-INSERT INTO t1 VALUES(0xACD5);
-INSERT INTO t1 VALUES(0xACD6);
-INSERT INTO t1 VALUES(0xACD7);
-INSERT INTO t1 VALUES(0xACD8);
-INSERT INTO t1 VALUES(0xACD9);
-INSERT INTO t1 VALUES(0xACDA);
-INSERT INTO t1 VALUES(0xACDB);
-INSERT INTO t1 VALUES(0xACDC);
-INSERT INTO t1 VALUES(0xACDD);
-INSERT INTO t1 VALUES(0xACDE);
-INSERT INTO t1 VALUES(0xACDF);
-INSERT INTO t1 VALUES(0xACE0);
-INSERT INTO t1 VALUES(0xACE1);
-INSERT INTO t1 VALUES(0xACE2);
-INSERT INTO t1 VALUES(0xACE3);
-INSERT INTO t1 VALUES(0xACE4);
-INSERT INTO t1 VALUES(0xACE5);
-INSERT INTO t1 VALUES(0xACE6);
-INSERT INTO t1 VALUES(0xACE7);
-INSERT INTO t1 VALUES(0xACE8);
-INSERT INTO t1 VALUES(0xACE9);
-INSERT INTO t1 VALUES(0xACEA);
-INSERT INTO t1 VALUES(0xACEB);
-INSERT INTO t1 VALUES(0xACEC);
-INSERT INTO t1 VALUES(0xACED);
-INSERT INTO t1 VALUES(0xACEE);
-INSERT INTO t1 VALUES(0xACEF);
-INSERT INTO t1 VALUES(0xACF0);
-INSERT INTO t1 VALUES(0xACF1);
-INSERT INTO t1 VALUES(0xACF2);
-INSERT INTO t1 VALUES(0xACF3);
-INSERT INTO t1 VALUES(0xACF4);
-INSERT INTO t1 VALUES(0xACF5);
-INSERT INTO t1 VALUES(0xACF6);
-INSERT INTO t1 VALUES(0xACF7);
-INSERT INTO t1 VALUES(0xACF8);
-INSERT INTO t1 VALUES(0xACF9);
-INSERT INTO t1 VALUES(0xACFA);
-INSERT INTO t1 VALUES(0xACFB);
-INSERT INTO t1 VALUES(0xACFC);
-INSERT INTO t1 VALUES(0xACFD);
-INSERT INTO t1 VALUES(0xACFE);
-INSERT INTO t1 VALUES(0xADA1);
-INSERT INTO t1 VALUES(0xADA2);
-INSERT INTO t1 VALUES(0xADA3);
-INSERT INTO t1 VALUES(0xADA4);
-INSERT INTO t1 VALUES(0xADA5);
-INSERT INTO t1 VALUES(0xADA6);
-INSERT INTO t1 VALUES(0xADA7);
-INSERT INTO t1 VALUES(0xADA8);
-INSERT INTO t1 VALUES(0xADA9);
-INSERT INTO t1 VALUES(0xADAA);
-INSERT INTO t1 VALUES(0xADAB);
-INSERT INTO t1 VALUES(0xADAC);
-INSERT INTO t1 VALUES(0xADAD);
-INSERT INTO t1 VALUES(0xADAE);
-INSERT INTO t1 VALUES(0xADAF);
-INSERT INTO t1 VALUES(0xADB0);
-INSERT INTO t1 VALUES(0xADB1);
-INSERT INTO t1 VALUES(0xADB2);
-INSERT INTO t1 VALUES(0xADB3);
-INSERT INTO t1 VALUES(0xADB4);
-INSERT INTO t1 VALUES(0xADB5);
-INSERT INTO t1 VALUES(0xADB6);
-INSERT INTO t1 VALUES(0xADB7);
-INSERT INTO t1 VALUES(0xADB8);
-INSERT INTO t1 VALUES(0xADB9);
-INSERT INTO t1 VALUES(0xADBA);
-INSERT INTO t1 VALUES(0xADBB);
-INSERT INTO t1 VALUES(0xADBC);
-INSERT INTO t1 VALUES(0xADBD);
-INSERT INTO t1 VALUES(0xADBE);
-INSERT INTO t1 VALUES(0xADBF);
-INSERT INTO t1 VALUES(0xADC0);
-INSERT INTO t1 VALUES(0xADC1);
-INSERT INTO t1 VALUES(0xADC2);
-INSERT INTO t1 VALUES(0xADC3);
-INSERT INTO t1 VALUES(0xADC4);
-INSERT INTO t1 VALUES(0xADC5);
-INSERT INTO t1 VALUES(0xADC6);
-INSERT INTO t1 VALUES(0xADC7);
-INSERT INTO t1 VALUES(0xADC8);
-INSERT INTO t1 VALUES(0xADC9);
-INSERT INTO t1 VALUES(0xADCA);
-INSERT INTO t1 VALUES(0xADCB);
-INSERT INTO t1 VALUES(0xADCC);
-INSERT INTO t1 VALUES(0xADCD);
-INSERT INTO t1 VALUES(0xADCE);
-INSERT INTO t1 VALUES(0xADCF);
-INSERT INTO t1 VALUES(0xADD0);
-INSERT INTO t1 VALUES(0xADD1);
-INSERT INTO t1 VALUES(0xADD2);
-INSERT INTO t1 VALUES(0xADD3);
-INSERT INTO t1 VALUES(0xADD4);
-INSERT INTO t1 VALUES(0xADD5);
-INSERT INTO t1 VALUES(0xADD6);
-INSERT INTO t1 VALUES(0xADD7);
-INSERT INTO t1 VALUES(0xADD8);
-INSERT INTO t1 VALUES(0xADD9);
-INSERT INTO t1 VALUES(0xADDA);
-INSERT INTO t1 VALUES(0xADDB);
-INSERT INTO t1 VALUES(0xADDC);
-INSERT INTO t1 VALUES(0xADDD);
-INSERT INTO t1 VALUES(0xADDE);
-INSERT INTO t1 VALUES(0xADDF);
-INSERT INTO t1 VALUES(0xADE0);
-INSERT INTO t1 VALUES(0xADE1);
-INSERT INTO t1 VALUES(0xADE2);
-INSERT INTO t1 VALUES(0xADE3);
-INSERT INTO t1 VALUES(0xADE4);
-INSERT INTO t1 VALUES(0xADE5);
-INSERT INTO t1 VALUES(0xADE6);
-INSERT INTO t1 VALUES(0xADE7);
-INSERT INTO t1 VALUES(0xADE8);
-INSERT INTO t1 VALUES(0xADE9);
-INSERT INTO t1 VALUES(0xADEA);
-INSERT INTO t1 VALUES(0xADEB);
-INSERT INTO t1 VALUES(0xADEC);
-INSERT INTO t1 VALUES(0xADED);
-INSERT INTO t1 VALUES(0xADEE);
-INSERT INTO t1 VALUES(0xADEF);
-INSERT INTO t1 VALUES(0xADF0);
-INSERT INTO t1 VALUES(0xADF1);
-INSERT INTO t1 VALUES(0xADF2);
-INSERT INTO t1 VALUES(0xADF3);
-INSERT INTO t1 VALUES(0xADF4);
-INSERT INTO t1 VALUES(0xADF5);
-INSERT INTO t1 VALUES(0xADF6);
-INSERT INTO t1 VALUES(0xADF7);
-INSERT INTO t1 VALUES(0xADF8);
-INSERT INTO t1 VALUES(0xADF9);
-INSERT INTO t1 VALUES(0xADFA);
-INSERT INTO t1 VALUES(0xADFB);
-INSERT INTO t1 VALUES(0xADFC);
-INSERT INTO t1 VALUES(0xADFD);
-INSERT INTO t1 VALUES(0xADFE);
-INSERT INTO t1 VALUES(0xAEA1);
-INSERT INTO t1 VALUES(0xAEA2);
-INSERT INTO t1 VALUES(0xAEA3);
-INSERT INTO t1 VALUES(0xAEA4);
-INSERT INTO t1 VALUES(0xAEA5);
-INSERT INTO t1 VALUES(0xAEA6);
-INSERT INTO t1 VALUES(0xAEA7);
-INSERT INTO t1 VALUES(0xAEA8);
-INSERT INTO t1 VALUES(0xAEA9);
-INSERT INTO t1 VALUES(0xAEAA);
-INSERT INTO t1 VALUES(0xAEAB);
-INSERT INTO t1 VALUES(0xAEAC);
-INSERT INTO t1 VALUES(0xAEAD);
-INSERT INTO t1 VALUES(0xAEAE);
-INSERT INTO t1 VALUES(0xAEAF);
-INSERT INTO t1 VALUES(0xAEB0);
-INSERT INTO t1 VALUES(0xAEB1);
-INSERT INTO t1 VALUES(0xAEB2);
-INSERT INTO t1 VALUES(0xAEB3);
-INSERT INTO t1 VALUES(0xAEB4);
-INSERT INTO t1 VALUES(0xAEB5);
-INSERT INTO t1 VALUES(0xAEB6);
-INSERT INTO t1 VALUES(0xAEB7);
-INSERT INTO t1 VALUES(0xAEB8);
-INSERT INTO t1 VALUES(0xAEB9);
-INSERT INTO t1 VALUES(0xAEBA);
-INSERT INTO t1 VALUES(0xAEBB);
-INSERT INTO t1 VALUES(0xAEBC);
-INSERT INTO t1 VALUES(0xAEBD);
-INSERT INTO t1 VALUES(0xAEBE);
-INSERT INTO t1 VALUES(0xAEBF);
-INSERT INTO t1 VALUES(0xAEC0);
-INSERT INTO t1 VALUES(0xAEC1);
-INSERT INTO t1 VALUES(0xAEC2);
-INSERT INTO t1 VALUES(0xAEC3);
-INSERT INTO t1 VALUES(0xAEC4);
-INSERT INTO t1 VALUES(0xAEC5);
-INSERT INTO t1 VALUES(0xAEC6);
-INSERT INTO t1 VALUES(0xAEC7);
-INSERT INTO t1 VALUES(0xAEC8);
-INSERT INTO t1 VALUES(0xAEC9);
-INSERT INTO t1 VALUES(0xAECA);
-INSERT INTO t1 VALUES(0xAECB);
-INSERT INTO t1 VALUES(0xAECC);
-INSERT INTO t1 VALUES(0xAECD);
-INSERT INTO t1 VALUES(0xAECE);
-INSERT INTO t1 VALUES(0xAECF);
-INSERT INTO t1 VALUES(0xAED0);
-INSERT INTO t1 VALUES(0xAED1);
-INSERT INTO t1 VALUES(0xAED2);
-INSERT INTO t1 VALUES(0xAED3);
-INSERT INTO t1 VALUES(0xAED4);
-INSERT INTO t1 VALUES(0xAED5);
-INSERT INTO t1 VALUES(0xAED6);
-INSERT INTO t1 VALUES(0xAED7);
-INSERT INTO t1 VALUES(0xAED8);
-INSERT INTO t1 VALUES(0xAED9);
-INSERT INTO t1 VALUES(0xAEDA);
-INSERT INTO t1 VALUES(0xAEDB);
-INSERT INTO t1 VALUES(0xAEDC);
-INSERT INTO t1 VALUES(0xAEDD);
-INSERT INTO t1 VALUES(0xAEDE);
-INSERT INTO t1 VALUES(0xAEDF);
-INSERT INTO t1 VALUES(0xAEE0);
-INSERT INTO t1 VALUES(0xAEE1);
-INSERT INTO t1 VALUES(0xAEE2);
-INSERT INTO t1 VALUES(0xAEE3);
-INSERT INTO t1 VALUES(0xAEE4);
-INSERT INTO t1 VALUES(0xAEE5);
-INSERT INTO t1 VALUES(0xAEE6);
-INSERT INTO t1 VALUES(0xAEE7);
-INSERT INTO t1 VALUES(0xAEE8);
-INSERT INTO t1 VALUES(0xAEE9);
-INSERT INTO t1 VALUES(0xAEEA);
-INSERT INTO t1 VALUES(0xAEEB);
-INSERT INTO t1 VALUES(0xAEEC);
-INSERT INTO t1 VALUES(0xAEED);
-INSERT INTO t1 VALUES(0xAEEE);
-INSERT INTO t1 VALUES(0xAEEF);
-INSERT INTO t1 VALUES(0xAEF0);
-INSERT INTO t1 VALUES(0xAEF1);
-INSERT INTO t1 VALUES(0xAEF2);
-INSERT INTO t1 VALUES(0xAEF3);
-INSERT INTO t1 VALUES(0xAEF4);
-INSERT INTO t1 VALUES(0xAEF5);
-INSERT INTO t1 VALUES(0xAEF6);
-INSERT INTO t1 VALUES(0xAEF7);
-INSERT INTO t1 VALUES(0xAEF8);
-INSERT INTO t1 VALUES(0xAEF9);
-INSERT INTO t1 VALUES(0xAEFA);
-INSERT INTO t1 VALUES(0xAEFB);
-INSERT INTO t1 VALUES(0xAEFC);
-INSERT INTO t1 VALUES(0xAEFD);
-INSERT INTO t1 VALUES(0xAEFE);
-INSERT INTO t1 VALUES(0xAFA1);
-INSERT INTO t1 VALUES(0xAFA2);
-INSERT INTO t1 VALUES(0xAFA3);
-INSERT INTO t1 VALUES(0xAFA4);
-INSERT INTO t1 VALUES(0xAFA5);
-INSERT INTO t1 VALUES(0xAFA6);
-INSERT INTO t1 VALUES(0xAFA7);
-INSERT INTO t1 VALUES(0xAFA8);
-INSERT INTO t1 VALUES(0xAFA9);
-INSERT INTO t1 VALUES(0xAFAA);
-INSERT INTO t1 VALUES(0xAFAB);
-INSERT INTO t1 VALUES(0xAFAC);
-INSERT INTO t1 VALUES(0xAFAD);
-INSERT INTO t1 VALUES(0xAFAE);
-INSERT INTO t1 VALUES(0xAFAF);
-INSERT INTO t1 VALUES(0xAFB0);
-INSERT INTO t1 VALUES(0xAFB1);
-INSERT INTO t1 VALUES(0xAFB2);
-INSERT INTO t1 VALUES(0xAFB3);
-INSERT INTO t1 VALUES(0xAFB4);
-INSERT INTO t1 VALUES(0xAFB5);
-INSERT INTO t1 VALUES(0xAFB6);
-INSERT INTO t1 VALUES(0xAFB7);
-INSERT INTO t1 VALUES(0xAFB8);
-INSERT INTO t1 VALUES(0xAFB9);
-INSERT INTO t1 VALUES(0xAFBA);
-INSERT INTO t1 VALUES(0xAFBB);
-INSERT INTO t1 VALUES(0xAFBC);
-INSERT INTO t1 VALUES(0xAFBD);
-INSERT INTO t1 VALUES(0xAFBE);
-INSERT INTO t1 VALUES(0xAFBF);
-INSERT INTO t1 VALUES(0xAFC0);
-INSERT INTO t1 VALUES(0xAFC1);
-INSERT INTO t1 VALUES(0xAFC2);
-INSERT INTO t1 VALUES(0xAFC3);
-INSERT INTO t1 VALUES(0xAFC4);
-INSERT INTO t1 VALUES(0xAFC5);
-INSERT INTO t1 VALUES(0xAFC6);
-INSERT INTO t1 VALUES(0xAFC7);
-INSERT INTO t1 VALUES(0xAFC8);
-INSERT INTO t1 VALUES(0xAFC9);
-INSERT INTO t1 VALUES(0xAFCA);
-INSERT INTO t1 VALUES(0xAFCB);
-INSERT INTO t1 VALUES(0xAFCC);
-INSERT INTO t1 VALUES(0xAFCD);
-INSERT INTO t1 VALUES(0xAFCE);
-INSERT INTO t1 VALUES(0xAFCF);
-INSERT INTO t1 VALUES(0xAFD0);
-INSERT INTO t1 VALUES(0xAFD1);
-INSERT INTO t1 VALUES(0xAFD2);
-INSERT INTO t1 VALUES(0xAFD3);
-INSERT INTO t1 VALUES(0xAFD4);
-INSERT INTO t1 VALUES(0xAFD5);
-INSERT INTO t1 VALUES(0xAFD6);
-INSERT INTO t1 VALUES(0xAFD7);
-INSERT INTO t1 VALUES(0xAFD8);
-INSERT INTO t1 VALUES(0xAFD9);
-INSERT INTO t1 VALUES(0xAFDA);
-INSERT INTO t1 VALUES(0xAFDB);
-INSERT INTO t1 VALUES(0xAFDC);
-INSERT INTO t1 VALUES(0xAFDD);
-INSERT INTO t1 VALUES(0xAFDE);
-INSERT INTO t1 VALUES(0xAFDF);
-INSERT INTO t1 VALUES(0xAFE0);
-INSERT INTO t1 VALUES(0xAFE1);
-INSERT INTO t1 VALUES(0xAFE2);
-INSERT INTO t1 VALUES(0xAFE3);
-INSERT INTO t1 VALUES(0xAFE4);
-INSERT INTO t1 VALUES(0xAFE5);
-INSERT INTO t1 VALUES(0xAFE6);
-INSERT INTO t1 VALUES(0xAFE7);
-INSERT INTO t1 VALUES(0xAFE8);
-INSERT INTO t1 VALUES(0xAFE9);
-INSERT INTO t1 VALUES(0xAFEA);
-INSERT INTO t1 VALUES(0xAFEB);
-INSERT INTO t1 VALUES(0xAFEC);
-INSERT INTO t1 VALUES(0xAFED);
-INSERT INTO t1 VALUES(0xAFEE);
-INSERT INTO t1 VALUES(0xAFEF);
-INSERT INTO t1 VALUES(0xAFF0);
-INSERT INTO t1 VALUES(0xAFF1);
-INSERT INTO t1 VALUES(0xAFF2);
-INSERT INTO t1 VALUES(0xAFF3);
-INSERT INTO t1 VALUES(0xAFF4);
-INSERT INTO t1 VALUES(0xAFF5);
-INSERT INTO t1 VALUES(0xAFF6);
-INSERT INTO t1 VALUES(0xAFF7);
-INSERT INTO t1 VALUES(0xAFF8);
-INSERT INTO t1 VALUES(0xAFF9);
-INSERT INTO t1 VALUES(0xAFFA);
-INSERT INTO t1 VALUES(0xAFFB);
-INSERT INTO t1 VALUES(0xAFFC);
-INSERT INTO t1 VALUES(0xAFFD);
-INSERT INTO t1 VALUES(0xAFFE);
-INSERT INTO t1 VALUES(0xCFD4);
-INSERT INTO t1 VALUES(0xCFD5);
-INSERT INTO t1 VALUES(0xCFD6);
-INSERT INTO t1 VALUES(0xCFD7);
-INSERT INTO t1 VALUES(0xCFD8);
-INSERT INTO t1 VALUES(0xCFD9);
-INSERT INTO t1 VALUES(0xCFDA);
-INSERT INTO t1 VALUES(0xCFDB);
-INSERT INTO t1 VALUES(0xCFDC);
-INSERT INTO t1 VALUES(0xCFDD);
-INSERT INTO t1 VALUES(0xCFDE);
-INSERT INTO t1 VALUES(0xCFDF);
-INSERT INTO t1 VALUES(0xCFE0);
-INSERT INTO t1 VALUES(0xCFE1);
-INSERT INTO t1 VALUES(0xCFE2);
-INSERT INTO t1 VALUES(0xCFE3);
-INSERT INTO t1 VALUES(0xCFE4);
-INSERT INTO t1 VALUES(0xCFE5);
-INSERT INTO t1 VALUES(0xCFE6);
-INSERT INTO t1 VALUES(0xCFE7);
-INSERT INTO t1 VALUES(0xCFE8);
-INSERT INTO t1 VALUES(0xCFE9);
-INSERT INTO t1 VALUES(0xCFEA);
-INSERT INTO t1 VALUES(0xCFEB);
-INSERT INTO t1 VALUES(0xCFEC);
-INSERT INTO t1 VALUES(0xCFED);
-INSERT INTO t1 VALUES(0xCFEE);
-INSERT INTO t1 VALUES(0xCFEF);
-INSERT INTO t1 VALUES(0xCFF0);
-INSERT INTO t1 VALUES(0xCFF1);
-INSERT INTO t1 VALUES(0xCFF2);
-INSERT INTO t1 VALUES(0xCFF3);
-INSERT INTO t1 VALUES(0xCFF4);
-INSERT INTO t1 VALUES(0xCFF5);
-INSERT INTO t1 VALUES(0xCFF6);
-INSERT INTO t1 VALUES(0xCFF7);
-INSERT INTO t1 VALUES(0xCFF8);
-INSERT INTO t1 VALUES(0xCFF9);
-INSERT INTO t1 VALUES(0xCFFA);
-INSERT INTO t1 VALUES(0xCFFB);
-INSERT INTO t1 VALUES(0xCFFC);
-INSERT INTO t1 VALUES(0xCFFD);
-INSERT INTO t1 VALUES(0xCFFE);
-INSERT INTO t1 VALUES(0xF4A7);
-INSERT INTO t1 VALUES(0xF4A8);
-INSERT INTO t1 VALUES(0xF4A9);
-INSERT INTO t1 VALUES(0xF4AA);
-INSERT INTO t1 VALUES(0xF4AB);
-INSERT INTO t1 VALUES(0xF4AC);
-INSERT INTO t1 VALUES(0xF4AD);
-INSERT INTO t1 VALUES(0xF4AE);
-INSERT INTO t1 VALUES(0xF4AF);
-INSERT INTO t1 VALUES(0xF4B0);
-INSERT INTO t1 VALUES(0xF4B1);
-INSERT INTO t1 VALUES(0xF4B2);
-INSERT INTO t1 VALUES(0xF4B3);
-INSERT INTO t1 VALUES(0xF4B4);
-INSERT INTO t1 VALUES(0xF4B5);
-INSERT INTO t1 VALUES(0xF4B6);
-INSERT INTO t1 VALUES(0xF4B7);
-INSERT INTO t1 VALUES(0xF4B8);
-INSERT INTO t1 VALUES(0xF4B9);
-INSERT INTO t1 VALUES(0xF4BA);
-INSERT INTO t1 VALUES(0xF4BB);
-INSERT INTO t1 VALUES(0xF4BC);
-INSERT INTO t1 VALUES(0xF4BD);
-INSERT INTO t1 VALUES(0xF4BE);
-INSERT INTO t1 VALUES(0xF4BF);
-INSERT INTO t1 VALUES(0xF4C0);
-INSERT INTO t1 VALUES(0xF4C1);
-INSERT INTO t1 VALUES(0xF4C2);
-INSERT INTO t1 VALUES(0xF4C3);
-INSERT INTO t1 VALUES(0xF4C4);
-INSERT INTO t1 VALUES(0xF4C5);
-INSERT INTO t1 VALUES(0xF4C6);
-INSERT INTO t1 VALUES(0xF4C7);
-INSERT INTO t1 VALUES(0xF4C8);
-INSERT INTO t1 VALUES(0xF4C9);
-INSERT INTO t1 VALUES(0xF4CA);
-INSERT INTO t1 VALUES(0xF4CB);
-INSERT INTO t1 VALUES(0xF4CC);
-INSERT INTO t1 VALUES(0xF4CD);
-INSERT INTO t1 VALUES(0xF4CE);
-INSERT INTO t1 VALUES(0xF4CF);
-INSERT INTO t1 VALUES(0xF4D0);
-INSERT INTO t1 VALUES(0xF4D1);
-INSERT INTO t1 VALUES(0xF4D2);
-INSERT INTO t1 VALUES(0xF4D3);
-INSERT INTO t1 VALUES(0xF4D4);
-INSERT INTO t1 VALUES(0xF4D5);
-INSERT INTO t1 VALUES(0xF4D6);
-INSERT INTO t1 VALUES(0xF4D7);
-INSERT INTO t1 VALUES(0xF4D8);
-INSERT INTO t1 VALUES(0xF4D9);
-INSERT INTO t1 VALUES(0xF4DA);
-INSERT INTO t1 VALUES(0xF4DB);
-INSERT INTO t1 VALUES(0xF4DC);
-INSERT INTO t1 VALUES(0xF4DD);
-INSERT INTO t1 VALUES(0xF4DE);
-INSERT INTO t1 VALUES(0xF4DF);
-INSERT INTO t1 VALUES(0xF4E0);
-INSERT INTO t1 VALUES(0xF4E1);
-INSERT INTO t1 VALUES(0xF4E2);
-INSERT INTO t1 VALUES(0xF4E3);
-INSERT INTO t1 VALUES(0xF4E4);
-INSERT INTO t1 VALUES(0xF4E5);
-INSERT INTO t1 VALUES(0xF4E6);
-INSERT INTO t1 VALUES(0xF4E7);
-INSERT INTO t1 VALUES(0xF4E8);
-INSERT INTO t1 VALUES(0xF4E9);
-INSERT INTO t1 VALUES(0xF4EA);
-INSERT INTO t1 VALUES(0xF4EB);
-INSERT INTO t1 VALUES(0xF4EC);
-INSERT INTO t1 VALUES(0xF4ED);
-INSERT INTO t1 VALUES(0xF4EE);
-INSERT INTO t1 VALUES(0xF4EF);
-INSERT INTO t1 VALUES(0xF4F0);
-INSERT INTO t1 VALUES(0xF4F1);
-INSERT INTO t1 VALUES(0xF4F2);
-INSERT INTO t1 VALUES(0xF4F3);
-INSERT INTO t1 VALUES(0xF4F4);
-INSERT INTO t1 VALUES(0xF4F5);
-INSERT INTO t1 VALUES(0xF4F6);
-INSERT INTO t1 VALUES(0xF4F7);
-INSERT INTO t1 VALUES(0xF4F8);
-INSERT INTO t1 VALUES(0xF4F9);
-INSERT INTO t1 VALUES(0xF4FA);
-INSERT INTO t1 VALUES(0xF4FB);
-INSERT INTO t1 VALUES(0xF4FC);
-INSERT INTO t1 VALUES(0xF4FD);
-INSERT INTO t1 VALUES(0xF4FE);
-SELECT HEX(c) FROM t1 ORDER BY BINARY c;
-DROP TABLE t1;
-
-
-SET collation_connection='ujis_japanese_ci';
--- source include/ctype_filesort.inc
--- source include/ctype_innodb_like.inc
--- source include/ctype_like_escape.inc
--- source include/ctype_like_range_f1f2.inc
-SET collation_connection='ujis_bin';
--- source include/ctype_filesort.inc
--- source include/ctype_innodb_like.inc
--- source include/ctype_like_escape.inc
--- source include/ctype_like_range_f1f2.inc
-
-#
-# Bugs#15375: Unassigned multibyte codes are broken
-# into parts when converting to Unicode.
-# This query should return 0x003F0041. I.e. it should
-# scan unassigned double-byte character 0xA5FE, convert
-# it as QUESTION MARK 0x003F and then scan the next
-# character, which is a single byte character 0x41.
-#
-select hex(convert(_ujis 0xA5FE41 using ucs2));
-# This one should return 0x003F0041:
-# scan unassigned three-byte character 0x8FABF8,
-# convert it as QUESTION MARK 0x003F and then scan
-# the next character, which is a single byte character 0x41.
-select hex(convert(_ujis 0x8FABF841 using ucs2));
-
-# End of 4.1 tests
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
-DROP PROCEDURE IF EXISTS sp1;
---enable_warnings
-
-set names ujis;
-set character_set_database = ujis;
-set character_set_server = ujis;
-
-CREATE TABLE t1(c1 char(2)) default charset = ujis;
-CREATE TABLE t2(c2 char(2)) default charset = ujis;
-
-INSERT INTO t1 VALUES(_ujis 0xA4A2);
-
-DELIMITER |;
-CREATE PROCEDURE sp1()
-BEGIN
- DECLARE a CHAR(2) CHARSET ujis;
- DECLARE cur1 CURSOR FOR SELECT c1 FROM t1;
- OPEN cur1;
- FETCH cur1 INTO a;
- INSERT INTO t2 VALUES (a);
- CLOSE cur1;
-END|
-DELIMITER ;|
-CALL sp1();
-
-#The data in t1 and t2 should be the same but different
-SELECT c1,c2 FROM t1,t2;
-
-#Since the result of hex(convert(_latin1 0xA4A2 using ujis))
-#equals to hex(c2), it seems that the value which was inserted
-#by using cursor is interpreted as latin1 character set
-SELECT hex(convert(_latin1 0xA4A2 using ujis)),hex(c2) FROM t1,t2;
-
-DROP PROCEDURE sp1;
-DROP TABLE t1;
-DROP TABLE t2;
-
---echo #
---echo # Bug#57257 Replace(ExtractValue(...)) causes MySQL crash
---echo #
-SET NAMES utf8;
-SELECT CONVERT(REPLACE(EXPORT_SET('a','a','a','','a'),'00','') USING ujis);
-
-
-set names default;
-set character_set_database=default;
-set character_set_server=default;
-
---echo End of 5.1 tests
-
---echo #
---echo # Start of 5.5 tests
---echo #
-
---echo #
---echo # Testing WL#4583 Case conversion in Asian character sets
---echo #
-#
-# Populate t1 with all hex digits
-#
-SET NAMES utf8;
-SET collation_connection=ujis_japanese_ci;
-CREATE TABLE t1 (b VARCHAR(2));
-INSERT INTO t1 VALUES ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7');
-INSERT INTO t1 VALUES ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F');
-#
-# Populate tables head and tail with values '00'-'FF'
-#
-CREATE TEMPORARY TABLE head AS SELECT concat(b1.b, b2.b) AS head FROM t1 b1, t1 b2;
-CREATE TEMPORARY TABLE tail AS SELECT concat(b1.b, b2.b) AS tail FROM t1 b1, t1 b2;
-DROP TABLE t1;
-#
-# Populate table t1 with all ujis codes.
-#
-#
-CREATE TABLE t1 AS SELECT 'XXXXXX' AS code, ' ' AS a LIMIT 0;
-#
-# Pupulate JIS-X-0201 range (Half Width Kana)
-# Valid characters: [8E][A1-DF]
-#
-INSERT IGNORE INTO t1 (code) SELECT concat('8E', head) FROM head
-WHERE (head BETWEEN 'A1' AND 'DF') ORDER BY head;
-#
-# Populate JIS-X-0208 range
-# Expected valid range: [A1..FE][A1..FE]
-#
-INSERT IGNORE INTO t1 (code) SELECT concat(head, tail)
-FROM head, tail
-WHERE (head BETWEEN '80' AND 'FF') AND (head NOT BETWEEN '8E' AND '8F')
-AND (tail BETWEEN '20' AND 'FF')
-ORDER BY head, tail;
-#
-# Populate JIS-X-0212 range
-# Expected valid range: [8F][A1..FE][A1..FE]
-#
-INSERT IGNORE INTO t1 (code) SELECT concat('8F', head, tail)
-FROM head, tail
-WHERE (head BETWEEN '80' AND 'FF') AND (tail BETWEEN '80' AND 'FF')
-ORDER BY head, tail;
-DROP TEMPORARY TABLE head, tail;
-SHOW CREATE TABLE t1;
-
-UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code;
-SELECT COUNT(*) FROM t1;
-SELECT COUNT(*) FROM t1 WHERE a<>'?';
-SELECT COUNT(*) FROM t1 WHERE a<>'' AND OCTET_LENGTH(a)=2;
-SELECT COUNT(*) FROM t1 WHERE a<>'' AND OCTET_LENGTH(a)=3;
-#
-# Display all characters that have upper or lower case mapping.
-#
-SELECT code, hex(upper(a)), hex(lower(a)),a, upper(a), lower(a) FROM t1 WHERE hex(a)<>hex(upper(a)) OR hex(a)<>hex(lower(a)) ORDER BY code;
-#
-# Make sure all possible conversion happened
-#
-# Expect U+0122 LATIN CAPITAL LETTER G WITH CEDILLA
-#
-SELECT * FROM t1
-WHERE HEX(CAST(LOWER(a) AS CHAR CHARACTER SET utf8)) <>
- HEX(LOWER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
-#
-# U+00F0 LATIN SMALL LETTER ETH
-# U+01F5 LATIN SMALL LETTER G WITH ACUTE
-#
-SELECT * FROM t1
-WHERE HEX(CAST(UPPER(a) AS CHAR CHARACTER SET utf8)) <>
- HEX(UPPER(CAST(a AS CHAR CHARACTER SET utf8))) ORDER BY code;
-
---echo #
---echo # WL#3090 Japanese Character Set adjustments
---echo # Test sjis->Unicode conversion
---echo #
-SELECT HEX(a), HEX(CONVERT(a USING utf8)) as b FROM t1
-WHERE a<>'' HAVING b<>'3F' ORDER BY code;
-
-DROP TABLE t1;
-
-
---echo #
---echo # WL#3090 Japanese Character Set adjustments
---echo # Test Unicode->sjis conversion
---echo #
---source include/ctype_utf8_table.inc
-SELECT HEX(a), HEX(CONVERT(a using sjis)) as b FROM t1 HAVING b<>'3F' ORDER BY BINARY a;
-DROP TABLE t1;
-
-
-
---echo #
---echo # End of 5.5 tests
---echo #
-
-
---echo #
---echo # Start of 5.6 tests
---echo #
-
---echo #
---echo # WL#3664 WEIGHT_STRING
---echo #
-
-set names ujis;
---source include/weight_string.inc
---source include/weight_string_l1.inc
---source include/weight_string_A1A1.inc
---source include/weight_string_8EA1.inc
---source include/weight_string_8FA2C3.inc
-
-set collation_connection=ujis_bin;
---source include/weight_string.inc
---source include/weight_string_l1.inc
---source include/weight_string_A1A1.inc
---source include/weight_string_8EA1.inc
---source include/weight_string_8FA2C3.inc
-
---echo #
---echo # End of 5.6 tests
---echo #
-
-
---echo #
---echo # Start of 10.0 tests
---echo #
-
---echo #
---echo # MDEV-6776 ujis and eucjmps erroneously accept 0x8EA0 as a valid byte sequence
---echo #
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ujis);
-INSERT IGNORE INTO t1 VALUES (0x8EA0);
-SELECT HEX(a), CHAR_LENGTH(a) FROM t1;
-DROP TABLE t1;
---error ER_INVALID_CHARACTER_STRING
-SELECT _ujis 0x8EA0;
-
-
---echo #
---echo # End of 10.0 tests
---echo #
-
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-8215 Asian MB3 charsets: compare broken bytes as "greater than any non-broken character"
---echo #
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ujis, KEY(a));
-# [x00-x7F] # ASCII/JIS-Roman
-# [x8E][xA1-xDF] # half-width katakana
-# [x8F][xA1-xFE][xA1-xFE] # JIS X 0212-1990
-# [xA1-xFE][xA1-xFE] # JIS X 0208:1997
-INSERT INTO t1 VALUES ('a'),(0x7F);
-INSERT INTO t1 VALUES (0x8EA1),(0x8EDF);
-INSERT INTO t1 VALUES (0x8FA1A1),(0x8FFEFE);
-INSERT INTO t1 VALUES (0xA1A1),(0xDEDE),(0xDFDF),(0xE0E0),(0xFEFE);
-SELECT HEX(a) FROM t1 ORDER BY a;
-ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET ujis COLLATE ujis_bin;
-SELECT HEX(a) FROM t1 ORDER BY a;DROP TABLE t1;
-
---echo #
---echo # End of 10.1 tests
---echo #
-
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-9842 LOAD DATA INFILE does not work well with a TEXT column when using sjis
---echo #
-CREATE TABLE t1 (a TEXT CHARACTER SET ujis);
-LOAD DATA INFILE '../../std_data/loaddata/mdev9823.ujis.txt' IGNORE INTO TABLE t1 CHARACTER SET ujis IGNORE 4 LINES;
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-9711 NO PAD Collatons
---echo #
-SET character_set_connection=ujis;
-let $coll='ujis_japanese_nopad_ci';
-let $coll_pad='ujis_japanese_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='ujis_nopad_bin';
-let $coll_pad='ujis_bin';
---source include/ctype_pad_all_engines.inc
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/ctype_ujis_ucs2.test b/mysql-test/t/ctype_ujis_ucs2.test
deleted file mode 100644
index 8616eea36d1..00000000000
--- a/mysql-test/t/ctype_ujis_ucs2.test
+++ /dev/null
@@ -1,1306 +0,0 @@
--- source include/have_ujis.inc
--- source include/have_ucs2.inc
-
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-
-#
-# Tests for UJIS-to-Unicode and Unicode-to-UJIS mapping
-#
-# MySQL's "ujis" is x-eucjp-unicode-0.9.
-#
-
-#
-# A helper table, with codes 0xA1..0xFE
-#
-create table t2 (code binary(1));
-insert into t2 values (0xA1),(0xA2),(0xA3),(0xA4),(0xA5),(0xA6),(0xA7);
-insert into t2 values (0xA8),(0xA9),(0xAA),(0xAB),(0xAC),(0xAD),(0xAE),(0xAF);
-insert into t2 values (0xB0),(0xB1),(0xB2),(0xB3),(0xB4),(0xB5),(0xB6),(0xB7);
-insert into t2 values (0xB8),(0xB9),(0xBA),(0xBB),(0xBC),(0xBD),(0xBE),(0xBF);
-insert into t2 values (0xC0),(0xC1),(0xC2),(0xC3),(0xC4),(0xC5),(0xC6),(0xC7);
-insert into t2 values (0xC8),(0xC9),(0xCA),(0xCB),(0xCC),(0xCD),(0xCE),(0xCF);
-insert into t2 values (0xD0),(0xD1),(0xD2),(0xD3),(0xD4),(0xD5),(0xD6),(0xD7);
-insert into t2 values (0xD8),(0xD9),(0xDA),(0xDB),(0xDC),(0xDD),(0xDE),(0xDF);
-insert into t2 values (0xE0),(0xE1),(0xE2),(0xE3),(0xE4),(0xE5),(0xE6),(0xE7);
-insert into t2 values (0xE8),(0xE9),(0xEA),(0xEB),(0xEC),(0xED),(0xEE),(0xEF);
-insert into t2 values (0xF0),(0xF1),(0xF2),(0xF3),(0xF4),(0xF5),(0xF6),(0xF7);
-insert into t2 values (0xF8),(0xF9),(0xFA),(0xFB),(0xFC),(0xFD),(0xFE);
-
-create table t1
-(
- ujis varchar(1) character set ujis collate ujis_bin primary key,
- ucs2 varchar(1) character set ucs2 not null default '',
- ujis2 varchar(1) character set ujis not null default '',
- name varchar(64) character set ujis not null default ''
-);
-
-#
-# A character from the ASCII (code set 0)
-# is represented by one byte, in the range 0x00 - 0x7E.
-#
-
-insert into t1 set ujis=0x00, name='U+0000 NULL';
-insert into t1 set ujis=0x01, name='U+0001 START OF HEADING';
-insert into t1 set ujis=0x02, name='U+0002 START OF TEXT';
-insert into t1 set ujis=0x03, name='U+0003 END OF TEXT';
-insert into t1 set ujis=0x04, name='U+0004 END OF TRANSMISSION';
-insert into t1 set ujis=0x05, name='U+0005 ENQUIRY';
-insert into t1 set ujis=0x06, name='U+0006 ACKNOWLEDGE';
-insert into t1 set ujis=0x07, name='U+0007 BELL';
-insert into t1 set ujis=0x08, name='U+0008 BACKSPACE';
-insert into t1 set ujis=0x09, name='U+0009 HORIZONTAL TABULATION';
-insert into t1 set ujis=0x0A, name='U+000A LINE FEED';
-insert into t1 set ujis=0x0B, name='U+000B VERTICAL TABULATION';
-insert into t1 set ujis=0x0C, name='U+000C FORM FEED';
-insert into t1 set ujis=0x0D, name='U+000D CARRIAGE RETURN';
-insert into t1 set ujis=0x0E, name='U+000E SHIFT OUT';
-insert into t1 set ujis=0x0F, name='U+000F SHIFT IN';
-insert into t1 set ujis=0x10, name='U+0010 DATA LINK ESCAPE';
-insert into t1 set ujis=0x11, name='U+0011 DEVICE CONTROL ONE';
-insert into t1 set ujis=0x12, name='U+0012 DEVICE CONTROL TWO';
-insert into t1 set ujis=0x13, name='U+0013 DEVICE CONTROL THREE';
-insert into t1 set ujis=0x14, name='U+0014 DEVICE CONTROL FOUR';
-insert into t1 set ujis=0x15, name='U+0015 NEGATIVE ACKNOWLEDGE';
-insert into t1 set ujis=0x16, name='U+0016 SYNCHRONOUS IDLE';
-insert into t1 set ujis=0x17, name='U+0017 END OF TRANSMISSION BLOCK';
-insert into t1 set ujis=0x18, name='U+0018 CANCEL';
-insert into t1 set ujis=0x19, name='U+0019 END OF MEDIUM';
-insert into t1 set ujis=0x1A, name='U+001A SUBSTITUTE';
-insert into t1 set ujis=0x1B, name='U+001B ESCAPE';
-insert into t1 set ujis=0x1C, name='U+001C FILE SEPARATOR';
-insert into t1 set ujis=0x1D, name='U+001D GROUP SEPARATOR';
-insert into t1 set ujis=0x1E, name='U+001E RECORD SEPARATOR';
-insert into t1 set ujis=0x1F, name='U+001F UNIT SEPARATOR';
-insert into t1 set ujis=0x20, name='U+0020 SPACE';
-insert into t1 set ujis=0x21, name='U+0021 EXCLAMATION MARK';
-insert into t1 set ujis=0x22, name='U+0022 QUOTATION MARK';
-insert into t1 set ujis=0x23, name='U+0023 NUMBER SIGN';
-insert into t1 set ujis=0x24, name='U+0024 DOLLAR SIGN';
-insert into t1 set ujis=0x25, name='U+0025 PERCENT SIGN';
-insert into t1 set ujis=0x26, name='U+0026 AMPERSAND';
-insert into t1 set ujis=0x27, name='U+0027 APOSTROPHE';
-insert into t1 set ujis=0x28, name='U+0028 LEFT PARENTHESIS';
-insert into t1 set ujis=0x29, name='U+0029 RIGHT PARENTHESIS';
-insert into t1 set ujis=0x2A, name='U+002A ASTERISK';
-insert into t1 set ujis=0x2B, name='U+002B PLUS SIGN';
-insert into t1 set ujis=0x2C, name='U+002C COMMA';
-insert into t1 set ujis=0x2D, name='U+002D HYPHEN-MINUS';
-insert into t1 set ujis=0x2E, name='U+002E FULL STOP';
-insert into t1 set ujis=0x2F, name='U+002F SOLIDUS';
-insert into t1 set ujis=0x30, name='U+0030 DIGIT ZERO';
-insert into t1 set ujis=0x31, name='U+0031 DIGIT ONE';
-insert into t1 set ujis=0x32, name='U+0032 DIGIT TWO';
-insert into t1 set ujis=0x33, name='U+0033 DIGIT THREE';
-insert into t1 set ujis=0x34, name='U+0034 DIGIT FOUR';
-insert into t1 set ujis=0x35, name='U+0035 DIGIT FIVE';
-insert into t1 set ujis=0x36, name='U+0036 DIGIT SIX';
-insert into t1 set ujis=0x37, name='U+0037 DIGIT SEVEN';
-insert into t1 set ujis=0x38, name='U+0038 DIGIT EIGHT';
-insert into t1 set ujis=0x39, name='U+0039 DIGIT NINE';
-insert into t1 set ujis=0x3A, name='U+003A COLON';
-insert into t1 set ujis=0x3B, name='U+003B SEMICOLON';
-insert into t1 set ujis=0x3C, name='U+003C LESS-THAN SIGN';
-insert into t1 set ujis=0x3D, name='U+003D EQUALS SIGN';
-insert into t1 set ujis=0x3E, name='U+003E GREATER-THAN SIGN';
-insert into t1 set ujis=0x3F, name='U+003F QUESTION MARK';
-insert into t1 set ujis=0x40, name='U+0040 COMMERCIAL AT';
-insert into t1 set ujis=0x41, name='U+0041 LATIN CAPITAL LETTER A';
-insert into t1 set ujis=0x42, name='U+0042 LATIN CAPITAL LETTER B';
-insert into t1 set ujis=0x43, name='U+0043 LATIN CAPITAL LETTER C';
-insert into t1 set ujis=0x44, name='U+0044 LATIN CAPITAL LETTER D';
-insert into t1 set ujis=0x45, name='U+0045 LATIN CAPITAL LETTER E';
-insert into t1 set ujis=0x46, name='U+0046 LATIN CAPITAL LETTER F';
-insert into t1 set ujis=0x47, name='U+0047 LATIN CAPITAL LETTER G';
-insert into t1 set ujis=0x48, name='U+0048 LATIN CAPITAL LETTER H';
-insert into t1 set ujis=0x49, name='U+0049 LATIN CAPITAL LETTER I';
-insert into t1 set ujis=0x4A, name='U+004A LATIN CAPITAL LETTER J';
-insert into t1 set ujis=0x4B, name='U+004B LATIN CAPITAL LETTER K';
-insert into t1 set ujis=0x4C, name='U+004C LATIN CAPITAL LETTER L';
-insert into t1 set ujis=0x4D, name='U+004D LATIN CAPITAL LETTER M';
-insert into t1 set ujis=0x4E, name='U+004E LATIN CAPITAL LETTER N';
-insert into t1 set ujis=0x4F, name='U+004F LATIN CAPITAL LETTER O';
-insert into t1 set ujis=0x50, name='U+0050 LATIN CAPITAL LETTER P';
-insert into t1 set ujis=0x51, name='U+0051 LATIN CAPITAL LETTER Q';
-insert into t1 set ujis=0x52, name='U+0052 LATIN CAPITAL LETTER R';
-insert into t1 set ujis=0x53, name='U+0053 LATIN CAPITAL LETTER S';
-insert into t1 set ujis=0x54, name='U+0054 LATIN CAPITAL LETTER T';
-insert into t1 set ujis=0x55, name='U+0055 LATIN CAPITAL LETTER U';
-insert into t1 set ujis=0x56, name='U+0056 LATIN CAPITAL LETTER V';
-insert into t1 set ujis=0x57, name='U+0057 LATIN CAPITAL LETTER W';
-insert into t1 set ujis=0x58, name='U+0058 LATIN CAPITAL LETTER X';
-insert into t1 set ujis=0x59, name='U+0059 LATIN CAPITAL LETTER Y';
-insert into t1 set ujis=0x5A, name='U+005A LATIN CAPITAL LETTER Z';
-insert into t1 set ujis=0x5B, name='U+005B LEFT SQUARE BRACKET';
-insert into t1 set ujis=0x5C, name='U+005C REVERSE SOLIDUS';
-insert into t1 set ujis=0x5D, name='U+005D RIGHT SQUARE BRACKET';
-insert into t1 set ujis=0x5E, name='U+005E CIRCUMFLEX ACCENT';
-insert into t1 set ujis=0x5F, name='U+005F LOW LINE';
-insert into t1 set ujis=0x60, name='U+0060 GRAVE ACCENT';
-insert into t1 set ujis=0x61, name='U+0061 LATIN SMALL LETTER A';
-insert into t1 set ujis=0x62, name='U+0062 LATIN SMALL LETTER B';
-insert into t1 set ujis=0x63, name='U+0063 LATIN SMALL LETTER C';
-insert into t1 set ujis=0x64, name='U+0064 LATIN SMALL LETTER D';
-insert into t1 set ujis=0x65, name='U+0065 LATIN SMALL LETTER E';
-insert into t1 set ujis=0x66, name='U+0066 LATIN SMALL LETTER F';
-insert into t1 set ujis=0x67, name='U+0067 LATIN SMALL LETTER G';
-insert into t1 set ujis=0x68, name='U+0068 LATIN SMALL LETTER H';
-insert into t1 set ujis=0x69, name='U+0069 LATIN SMALL LETTER I';
-insert into t1 set ujis=0x6A, name='U+006A LATIN SMALL LETTER J';
-insert into t1 set ujis=0x6B, name='U+006B LATIN SMALL LETTER K';
-insert into t1 set ujis=0x6C, name='U+006C LATIN SMALL LETTER L';
-insert into t1 set ujis=0x6D, name='U+006D LATIN SMALL LETTER M';
-insert into t1 set ujis=0x6E, name='U+006E LATIN SMALL LETTER N';
-insert into t1 set ujis=0x6F, name='U+006F LATIN SMALL LETTER O';
-insert into t1 set ujis=0x70, name='U+0070 LATIN SMALL LETTER P';
-insert into t1 set ujis=0x71, name='U+0071 LATIN SMALL LETTER Q';
-insert into t1 set ujis=0x72, name='U+0072 LATIN SMALL LETTER R';
-insert into t1 set ujis=0x73, name='U+0073 LATIN SMALL LETTER S';
-insert into t1 set ujis=0x74, name='U+0074 LATIN SMALL LETTER T';
-insert into t1 set ujis=0x75, name='U+0075 LATIN SMALL LETTER U';
-insert into t1 set ujis=0x76, name='U+0076 LATIN SMALL LETTER V';
-insert into t1 set ujis=0x77, name='U+0077 LATIN SMALL LETTER W';
-insert into t1 set ujis=0x78, name='U+0078 LATIN SMALL LETTER X';
-insert into t1 set ujis=0x79, name='U+0079 LATIN SMALL LETTER Y';
-insert into t1 set ujis=0x7A, name='U+007A LATIN SMALL LETTER Z';
-insert into t1 set ujis=0x7B, name='U+007B LEFT CURLY BRACKET';
-insert into t1 set ujis=0x7C, name='U+007C VERTICAL LINE';
-insert into t1 set ujis=0x7D, name='U+007D RIGHT CURLY BRACKET';
-insert into t1 set ujis=0x7E, name='U+007E TILDE';
-insert into t1 set ujis=0x7F, name='U+007F DELETE';
-
-
-#
-# A character from JIS-X-0208 (code set 1)
-# is represented by two bytes,
-# both in the range 0xA1 - 0xFE.
-# Codes according to:
-# ftp://ftp.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/JIS/JIS0208.TXT
-#
-# Fill table t1 with codes "[A1..FE][A1..FE]" using helper table t2.
-# 8836 codes total:
-#
-insert into t1 (ujis) select concat(t21.code,t22.code) from t2 t21, t2 t22 order by 1;
-
-update t1 set name='U+3000 IDEOGRAPHIC SPACE' where ujis=0xA1A1;
-update t1 set name='U+3001 IDEOGRAPHIC COMMA' where ujis=0xA1A2;
-update t1 set name='U+3002 IDEOGRAPHIC FULL STOP' where ujis=0xA1A3;
-update t1 set name='U+FF0C FULLWIDTH COMMA' where ujis=0xA1A4;
-update t1 set name='U+FF0E FULLWIDTH FULL STOP' where ujis=0xA1A5;
-update t1 set name='U+30FB KATAKANA MIDDLE DOT' where ujis=0xA1A6;
-update t1 set name='U+FF1A FULLWIDTH COLON' where ujis=0xA1A7;
-update t1 set name='U+FF1B FULLWIDTH SEMICOLON' where ujis=0xA1A8;
-update t1 set name='U+FF1F FULLWIDTH QUESTION MARK' where ujis=0xA1A9;
-update t1 set name='U+FF01 FULLWIDTH EXCLAMATION MARK' where ujis=0xA1AA;
-update t1 set name='U+309B KATAKANA-HIRAGANA VOICED SOUND MARK' where ujis=0xA1AB;
-update t1 set name='U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK' where ujis=0xA1AC;
-update t1 set name='U+00B4 ACUTE ACCENT' where ujis=0xA1AD;
-update t1 set name='U+FF40 FULLWIDTH GRAVE ACCENT' where ujis=0xA1AE;
-update t1 set name='U+00A8 DIAERESIS' where ujis=0xA1AF;
-update t1 set name='U+FF3E FULLWIDTH CIRCUMFLEX ACCENT' where ujis=0xA1B0;
-update t1 set name='U+FFE3 FULLWIDTH MACRON' where ujis=0xA1B1;
-update t1 set name='U+FF3F FULLWIDTH LOW LINE' where ujis=0xA1B2;
-update t1 set name='U+30FD KATAKANA ITERATION MARK' where ujis=0xA1B3;
-update t1 set name='U+30FE KATAKANA VOICED ITERATION MARK' where ujis=0xA1B4;
-update t1 set name='U+309D HIRAGANA ITERATION MARK' where ujis=0xA1B5;
-update t1 set name='U+309E HIRAGANA VOICED ITERATION MARK' where ujis=0xA1B6;
-update t1 set name='U+3003 DITTO MARK' where ujis=0xA1B7;
-update t1 set name='U+4EDD <CJK>' where ujis=0xA1B8;
-update t1 set name='U+3005 IDEOGRAPHIC ITERATION MARK' where ujis=0xA1B9;
-update t1 set name='U+3006 IDEOGRAPHIC CLOSING MARK' where ujis=0xA1BA;
-update t1 set name='U+3007 IDEOGRAPHIC NUMBER ZERO' where ujis=0xA1BB;
-update t1 set name='U+30FC KATAKANA-HIRAGANA PROLONGED SOUND MARK' where ujis=0xA1BC;
-update t1 set name='U+2015 HORIZONTAL BAR' where ujis=0xA1BD;
-update t1 set name='U+2010 HYPHEN' where ujis=0xA1BE;
-update t1 set name='U+FF0F FULLWIDTH SOLIDUS' where ujis=0xA1BF;
-update t1 set name='U+005C REVERSE SOLIDUS' where ujis=0xA1C0;
-update t1 set name='U+301C WAVE DASH' where ujis=0xA1C1;
-update t1 set name='U+2016 DOUBLE VERTICAL LINE' where ujis=0xA1C2;
-update t1 set name='U+FF5C FULLWIDTH VERTICAL LINE' where ujis=0xA1C3;
-update t1 set name='U+2026 HORIZONTAL ELLIPSIS' where ujis=0xA1C4;
-update t1 set name='U+2025 TWO DOT LEADER' where ujis=0xA1C5;
-update t1 set name='U+2018 LEFT SINGLE QUOTATION MARK' where ujis=0xA1C6;
-update t1 set name='U+2019 RIGHT SINGLE QUOTATION MARK' where ujis=0xA1C7;
-update t1 set name='U+201C LEFT DOUBLE QUOTATION MARK' where ujis=0xA1C8;
-update t1 set name='U+201D RIGHT DOUBLE QUOTATION MARK' where ujis=0xA1C9;
-update t1 set name='U+FF08 FULLWIDTH LEFT PARENTHESIS' where ujis=0xA1CA;
-update t1 set name='U+FF09 FULLWIDTH RIGHT PARENTHESIS' where ujis=0xA1CB;
-update t1 set name='U+3014 LEFT TORTOISE SHELL BRACKET' where ujis=0xA1CC;
-update t1 set name='U+3015 RIGHT TORTOISE SHELL BRACKET' where ujis=0xA1CD;
-update t1 set name='U+FF3B FULLWIDTH LEFT SQUARE BRACKET' where ujis=0xA1CE;
-update t1 set name='U+FF3D FULLWIDTH RIGHT SQUARE BRACKET' where ujis=0xA1CF;
-update t1 set name='U+FF5B FULLWIDTH LEFT CURLY BRACKET' where ujis=0xA1D0;
-update t1 set name='U+FF5D FULLWIDTH RIGHT CURLY BRACKET' where ujis=0xA1D1;
-update t1 set name='U+3008 LEFT ANGLE BRACKET' where ujis=0xA1D2;
-update t1 set name='U+3009 RIGHT ANGLE BRACKET' where ujis=0xA1D3;
-update t1 set name='U+300A LEFT DOUBLE ANGLE BRACKET' where ujis=0xA1D4;
-update t1 set name='U+300B RIGHT DOUBLE ANGLE BRACKET' where ujis=0xA1D5;
-update t1 set name='U+300C LEFT CORNER BRACKET' where ujis=0xA1D6;
-update t1 set name='U+300D RIGHT CORNER BRACKET' where ujis=0xA1D7;
-update t1 set name='U+300E LEFT WHITE CORNER BRACKET' where ujis=0xA1D8;
-update t1 set name='U+300F RIGHT WHITE CORNER BRACKET' where ujis=0xA1D9;
-update t1 set name='U+3010 LEFT BLACK LENTICULAR BRACKET' where ujis=0xA1DA;
-update t1 set name='U+3011 RIGHT BLACK LENTICULAR BRACKET' where ujis=0xA1DB;
-update t1 set name='U+FF0B FULLWIDTH PLUS SIGN' where ujis=0xA1DC;
-update t1 set name='U+2212 MINUS SIGN' where ujis=0xA1DD;
-update t1 set name='U+00B1 PLUS-MINUS SIGN' where ujis=0xA1DE;
-update t1 set name='U+00D7 MULTIPLICATION SIGN' where ujis=0xA1DF;
-update t1 set name='U+00F7 DIVISION SIGN' where ujis=0xA1E0;
-update t1 set name='U+FF1D FULLWIDTH EQUALS SIGN' where ujis=0xA1E1;
-update t1 set name='U+2260 NOT EQUAL TO' where ujis=0xA1E2;
-update t1 set name='U+FF1C FULLWIDTH LESS-THAN SIGN' where ujis=0xA1E3;
-update t1 set name='U+FF1E FULLWIDTH GREATER-THAN SIGN' where ujis=0xA1E4;
-update t1 set name='U+2266 LESS-THAN OVER EQUAL TO' where ujis=0xA1E5;
-update t1 set name='U+2267 GREATER-THAN OVER EQUAL TO' where ujis=0xA1E6;
-update t1 set name='U+221E INFINITY' where ujis=0xA1E7;
-update t1 set name='U+2234 THEREFORE' where ujis=0xA1E8;
-update t1 set name='U+2642 MALE SIGN' where ujis=0xA1E9;
-update t1 set name='U+2640 FEMALE SIGN' where ujis=0xA1EA;
-update t1 set name='U+00B0 DEGREE SIGN' where ujis=0xA1EB;
-update t1 set name='U+2032 PRIME' where ujis=0xA1EC;
-update t1 set name='U+2033 DOUBLE PRIME' where ujis=0xA1ED;
-update t1 set name='U+2103 DEGREE CELSIUS' where ujis=0xA1EE;
-update t1 set name='U+FFE5 FULLWIDTH YEN SIGN' where ujis=0xA1EF;
-update t1 set name='U+FF04 FULLWIDTH DOLLAR SIGN' where ujis=0xA1F0;
-update t1 set name='U+00A2 CENT SIGN' where ujis=0xA1F1;
-update t1 set name='U+00A3 POUND SIGN' where ujis=0xA1F2;
-update t1 set name='U+FF05 FULLWIDTH PERCENT SIGN' where ujis=0xA1F3;
-update t1 set name='U+FF03 FULLWIDTH NUMBER SIGN' where ujis=0xA1F4;
-update t1 set name='U+FF06 FULLWIDTH AMPERSAND' where ujis=0xA1F5;
-update t1 set name='U+FF0A FULLWIDTH ASTERISK' where ujis=0xA1F6;
-update t1 set name='U+FF20 FULLWIDTH COMMERCIAL AT' where ujis=0xA1F7;
-update t1 set name='U+00A7 SECTION SIGN' where ujis=0xA1F8;
-update t1 set name='U+2606 WHITE STAR' where ujis=0xA1F9;
-update t1 set name='U+2605 BLACK STAR' where ujis=0xA1FA;
-update t1 set name='U+25CB WHITE CIRCLE' where ujis=0xA1FB;
-update t1 set name='U+25CF BLACK CIRCLE' where ujis=0xA1FC;
-update t1 set name='U+25CE BULLSEYE' where ujis=0xA1FD;
-update t1 set name='U+25C7 WHITE DIAMOND' where ujis=0xA1FE;
-update t1 set name='U+25C6 BLACK DIAMOND' where ujis=0xA2A1;
-update t1 set name='U+25A1 WHITE SQUARE' where ujis=0xA2A2;
-update t1 set name='U+25A0 BLACK SQUARE' where ujis=0xA2A3;
-update t1 set name='U+25B3 WHITE UP-POINTING TRIANGLE' where ujis=0xA2A4;
-update t1 set name='U+25B2 BLACK UP-POINTING TRIANGLE' where ujis=0xA2A5;
-update t1 set name='U+25BD WHITE DOWN-POINTING TRIANGLE' where ujis=0xA2A6;
-update t1 set name='U+25BC BLACK DOWN-POINTING TRIANGLE' where ujis=0xA2A7;
-update t1 set name='U+203B REFERENCE MARK' where ujis=0xA2A8;
-update t1 set name='U+3012 POSTAL MARK' where ujis=0xA2A9;
-update t1 set name='U+2192 RIGHTWARDS ARROW' where ujis=0xA2AA;
-update t1 set name='U+2190 LEFTWARDS ARROW' where ujis=0xA2AB;
-update t1 set name='U+2191 UPWARDS ARROW' where ujis=0xA2AC;
-update t1 set name='U+2193 DOWNWARDS ARROW' where ujis=0xA2AD;
-update t1 set name='U+3013 GETA MARK' where ujis=0xA2AE;
-update t1 set name='U+2208 ELEMENT OF' where ujis=0xA2BA;
-update t1 set name='U+220B CONTAINS AS MEMBER' where ujis=0xA2BB;
-update t1 set name='U+2286 SUBset OF OR EQUAL TO' where ujis=0xA2BC;
-update t1 set name='U+2287 SUPERset OF OR EQUAL TO' where ujis=0xA2BD;
-update t1 set name='U+2282 SUBset OF' where ujis=0xA2BE;
-update t1 set name='U+2283 SUPERset OF' where ujis=0xA2BF;
-update t1 set name='U+222A UNION' where ujis=0xA2C0;
-update t1 set name='U+2229 INTERSECTION' where ujis=0xA2C1;
-update t1 set name='U+2227 LOGICAL AND' where ujis=0xA2CA;
-update t1 set name='U+2228 LOGICAL OR' where ujis=0xA2CB;
-update t1 set name='U+00AC NOT SIGN' where ujis=0xA2CC;
-update t1 set name='U+21D2 RIGHTWARDS DOUBLE ARROW' where ujis=0xA2CD;
-update t1 set name='U+21D4 LEFT RIGHT DOUBLE ARROW' where ujis=0xA2CE;
-update t1 set name='U+2200 FOR ALL' where ujis=0xA2CF;
-update t1 set name='U+2203 THERE EXISTS' where ujis=0xA2D0;
-update t1 set name='U+2220 ANGLE' where ujis=0xA2DC;
-update t1 set name='U+22A5 UP TACK' where ujis=0xA2DD;
-update t1 set name='U+2312 ARC' where ujis=0xA2DE;
-update t1 set name='U+2202 PARTIAL DIFFERENTIAL' where ujis=0xA2DF;
-update t1 set name='U+2207 NABLA' where ujis=0xA2E0;
-update t1 set name='U+2261 IDENTICAL TO' where ujis=0xA2E1;
-update t1 set name='U+2252 APPROXIMATELY EQUAL TO OR THE IMAGE OF' where ujis=0xA2E2;
-update t1 set name='U+226A MUCH LESS-THAN' where ujis=0xA2E3;
-update t1 set name='U+226B MUCH GREATER-THAN' where ujis=0xA2E4;
-update t1 set name='U+221A SQUARE ROOT' where ujis=0xA2E5;
-update t1 set name='U+223D REVERSED TILDE' where ujis=0xA2E6;
-update t1 set name='U+221D PROPORTIONAL TO' where ujis=0xA2E7;
-update t1 set name='U+2235 BECAUSE' where ujis=0xA2E8;
-update t1 set name='U+222B INTEGRAL' where ujis=0xA2E9;
-update t1 set name='U+222C DOUBLE INTEGRAL' where ujis=0xA2EA;
-update t1 set name='U+212B ANGSTROM SIGN' where ujis=0xA2F2;
-update t1 set name='U+2030 PER MILLE SIGN' where ujis=0xA2F3;
-update t1 set name='U+266F MUSIC SHARP SIGN' where ujis=0xA2F4;
-update t1 set name='U+266D MUSIC FLAT SIGN' where ujis=0xA2F5;
-update t1 set name='U+266A EIGHTH NOTE' where ujis=0xA2F6;
-update t1 set name='U+2020 DAGGER' where ujis=0xA2F7;
-update t1 set name='U+2021 DOUBLE DAGGER' where ujis=0xA2F8;
-update t1 set name='U+00B6 PILCROW SIGN' where ujis=0xA2F9;
-update t1 set name='U+25EF LARGE CIRCLE' where ujis=0xA2FE;
-update t1 set name='U+FF10 FULLWIDTH DIGIT ZERO' where ujis=0xA3B0;
-update t1 set name='U+FF11 FULLWIDTH DIGIT ONE' where ujis=0xA3B1;
-update t1 set name='U+FF12 FULLWIDTH DIGIT TWO' where ujis=0xA3B2;
-update t1 set name='U+FF13 FULLWIDTH DIGIT THREE' where ujis=0xA3B3;
-update t1 set name='U+FF14 FULLWIDTH DIGIT FOUR' where ujis=0xA3B4;
-update t1 set name='U+FF15 FULLWIDTH DIGIT FIVE' where ujis=0xA3B5;
-update t1 set name='U+FF16 FULLWIDTH DIGIT SIX' where ujis=0xA3B6;
-update t1 set name='U+FF17 FULLWIDTH DIGIT SEVEN' where ujis=0xA3B7;
-update t1 set name='U+FF18 FULLWIDTH DIGIT EIGHT' where ujis=0xA3B8;
-update t1 set name='U+FF19 FULLWIDTH DIGIT NINE' where ujis=0xA3B9;
-update t1 set name='U+FF21 FULLWIDTH LATIN CAPITAL LETTER A' where ujis=0xA3C1;
-update t1 set name='U+FF22 FULLWIDTH LATIN CAPITAL LETTER B' where ujis=0xA3C2;
-update t1 set name='U+FF23 FULLWIDTH LATIN CAPITAL LETTER C' where ujis=0xA3C3;
-update t1 set name='U+FF24 FULLWIDTH LATIN CAPITAL LETTER D' where ujis=0xA3C4;
-update t1 set name='U+FF25 FULLWIDTH LATIN CAPITAL LETTER E' where ujis=0xA3C5;
-update t1 set name='U+FF26 FULLWIDTH LATIN CAPITAL LETTER F' where ujis=0xA3C6;
-update t1 set name='U+FF27 FULLWIDTH LATIN CAPITAL LETTER G' where ujis=0xA3C7;
-update t1 set name='U+FF28 FULLWIDTH LATIN CAPITAL LETTER H' where ujis=0xA3C8;
-update t1 set name='U+FF29 FULLWIDTH LATIN CAPITAL LETTER I' where ujis=0xA3C9;
-update t1 set name='U+FF2A FULLWIDTH LATIN CAPITAL LETTER J' where ujis=0xA3CA;
-update t1 set name='U+FF2B FULLWIDTH LATIN CAPITAL LETTER K' where ujis=0xA3CB;
-update t1 set name='U+FF2C FULLWIDTH LATIN CAPITAL LETTER L' where ujis=0xA3CC;
-update t1 set name='U+FF2D FULLWIDTH LATIN CAPITAL LETTER M' where ujis=0xA3CD;
-update t1 set name='U+FF2E FULLWIDTH LATIN CAPITAL LETTER N' where ujis=0xA3CE;
-update t1 set name='U+FF2F FULLWIDTH LATIN CAPITAL LETTER O' where ujis=0xA3CF;
-update t1 set name='U+FF30 FULLWIDTH LATIN CAPITAL LETTER P' where ujis=0xA3D0;
-update t1 set name='U+FF31 FULLWIDTH LATIN CAPITAL LETTER Q' where ujis=0xA3D1;
-update t1 set name='U+FF32 FULLWIDTH LATIN CAPITAL LETTER R' where ujis=0xA3D2;
-update t1 set name='U+FF33 FULLWIDTH LATIN CAPITAL LETTER S' where ujis=0xA3D3;
-update t1 set name='U+FF34 FULLWIDTH LATIN CAPITAL LETTER T' where ujis=0xA3D4;
-update t1 set name='U+FF35 FULLWIDTH LATIN CAPITAL LETTER U' where ujis=0xA3D5;
-update t1 set name='U+FF36 FULLWIDTH LATIN CAPITAL LETTER V' where ujis=0xA3D6;
-update t1 set name='U+FF37 FULLWIDTH LATIN CAPITAL LETTER W' where ujis=0xA3D7;
-update t1 set name='U+FF38 FULLWIDTH LATIN CAPITAL LETTER X' where ujis=0xA3D8;
-update t1 set name='U+FF39 FULLWIDTH LATIN CAPITAL LETTER Y' where ujis=0xA3D9;
-update t1 set name='U+FF3A FULLWIDTH LATIN CAPITAL LETTER Z' where ujis=0xA3DA;
-update t1 set name='U+FF41 FULLWIDTH LATIN SMALL LETTER A' where ujis=0xA3E1;
-update t1 set name='U+FF42 FULLWIDTH LATIN SMALL LETTER B' where ujis=0xA3E2;
-update t1 set name='U+FF43 FULLWIDTH LATIN SMALL LETTER C' where ujis=0xA3E3;
-update t1 set name='U+FF44 FULLWIDTH LATIN SMALL LETTER D' where ujis=0xA3E4;
-update t1 set name='U+FF45 FULLWIDTH LATIN SMALL LETTER E' where ujis=0xA3E5;
-update t1 set name='U+FF46 FULLWIDTH LATIN SMALL LETTER F' where ujis=0xA3E6;
-update t1 set name='U+FF47 FULLWIDTH LATIN SMALL LETTER G' where ujis=0xA3E7;
-update t1 set name='U+FF48 FULLWIDTH LATIN SMALL LETTER H' where ujis=0xA3E8;
-update t1 set name='U+FF49 FULLWIDTH LATIN SMALL LETTER I' where ujis=0xA3E9;
-update t1 set name='U+FF4A FULLWIDTH LATIN SMALL LETTER J' where ujis=0xA3EA;
-update t1 set name='U+FF4B FULLWIDTH LATIN SMALL LETTER K' where ujis=0xA3EB;
-update t1 set name='U+FF4C FULLWIDTH LATIN SMALL LETTER L' where ujis=0xA3EC;
-update t1 set name='U+FF4D FULLWIDTH LATIN SMALL LETTER M' where ujis=0xA3ED;
-update t1 set name='U+FF4E FULLWIDTH LATIN SMALL LETTER N' where ujis=0xA3EE;
-update t1 set name='U+FF4F FULLWIDTH LATIN SMALL LETTER O' where ujis=0xA3EF;
-update t1 set name='U+FF50 FULLWIDTH LATIN SMALL LETTER P' where ujis=0xA3F0;
-update t1 set name='U+FF51 FULLWIDTH LATIN SMALL LETTER Q' where ujis=0xA3F1;
-update t1 set name='U+FF52 FULLWIDTH LATIN SMALL LETTER R' where ujis=0xA3F2;
-update t1 set name='U+FF53 FULLWIDTH LATIN SMALL LETTER S' where ujis=0xA3F3;
-update t1 set name='U+FF54 FULLWIDTH LATIN SMALL LETTER T' where ujis=0xA3F4;
-update t1 set name='U+FF55 FULLWIDTH LATIN SMALL LETTER U' where ujis=0xA3F5;
-update t1 set name='U+FF56 FULLWIDTH LATIN SMALL LETTER V' where ujis=0xA3F6;
-update t1 set name='U+FF57 FULLWIDTH LATIN SMALL LETTER W' where ujis=0xA3F7;
-update t1 set name='U+FF58 FULLWIDTH LATIN SMALL LETTER X' where ujis=0xA3F8;
-update t1 set name='U+FF59 FULLWIDTH LATIN SMALL LETTER Y' where ujis=0xA3F9;
-update t1 set name='U+FF5A FULLWIDTH LATIN SMALL LETTER Z' where ujis=0xA3FA;
-update t1 set name='U+3041 HIRAGANA LETTER SMALL A' where ujis=0xA4A1;
-update t1 set name='U+3042 HIRAGANA LETTER A' where ujis=0xA4A2;
-update t1 set name='U+3043 HIRAGANA LETTER SMALL I' where ujis=0xA4A3;
-update t1 set name='U+3044 HIRAGANA LETTER I' where ujis=0xA4A4;
-update t1 set name='U+3045 HIRAGANA LETTER SMALL U' where ujis=0xA4A5;
-update t1 set name='U+3046 HIRAGANA LETTER U' where ujis=0xA4A6;
-update t1 set name='U+3047 HIRAGANA LETTER SMALL E' where ujis=0xA4A7;
-update t1 set name='U+3048 HIRAGANA LETTER E' where ujis=0xA4A8;
-update t1 set name='U+3049 HIRAGANA LETTER SMALL O' where ujis=0xA4A9;
-update t1 set name='U+304A HIRAGANA LETTER O' where ujis=0xA4AA;
-update t1 set name='U+304B HIRAGANA LETTER KA' where ujis=0xA4AB;
-update t1 set name='U+304C HIRAGANA LETTER GA' where ujis=0xA4AC;
-update t1 set name='U+304D HIRAGANA LETTER KI' where ujis=0xA4AD;
-update t1 set name='U+304E HIRAGANA LETTER GI' where ujis=0xA4AE;
-update t1 set name='U+304F HIRAGANA LETTER KU' where ujis=0xA4AF;
-update t1 set name='U+3050 HIRAGANA LETTER GU' where ujis=0xA4B0;
-update t1 set name='U+3051 HIRAGANA LETTER KE' where ujis=0xA4B1;
-update t1 set name='U+3052 HIRAGANA LETTER GE' where ujis=0xA4B2;
-update t1 set name='U+3053 HIRAGANA LETTER KO' where ujis=0xA4B3;
-update t1 set name='U+3054 HIRAGANA LETTER GO' where ujis=0xA4B4;
-update t1 set name='U+3055 HIRAGANA LETTER SA' where ujis=0xA4B5;
-update t1 set name='U+3056 HIRAGANA LETTER ZA' where ujis=0xA4B6;
-update t1 set name='U+3057 HIRAGANA LETTER SI' where ujis=0xA4B7;
-update t1 set name='U+3058 HIRAGANA LETTER ZI' where ujis=0xA4B8;
-update t1 set name='U+3059 HIRAGANA LETTER SU' where ujis=0xA4B9;
-update t1 set name='U+305A HIRAGANA LETTER ZU' where ujis=0xA4BA;
-update t1 set name='U+305B HIRAGANA LETTER SE' where ujis=0xA4BB;
-update t1 set name='U+305C HIRAGANA LETTER ZE' where ujis=0xA4BC;
-update t1 set name='U+305D HIRAGANA LETTER SO' where ujis=0xA4BD;
-update t1 set name='U+305E HIRAGANA LETTER ZO' where ujis=0xA4BE;
-update t1 set name='U+305F HIRAGANA LETTER TA' where ujis=0xA4BF;
-update t1 set name='U+3060 HIRAGANA LETTER DA' where ujis=0xA4C0;
-update t1 set name='U+3061 HIRAGANA LETTER TI' where ujis=0xA4C1;
-update t1 set name='U+3062 HIRAGANA LETTER DI' where ujis=0xA4C2;
-update t1 set name='U+3063 HIRAGANA LETTER SMALL TU' where ujis=0xA4C3;
-update t1 set name='U+3064 HIRAGANA LETTER TU' where ujis=0xA4C4;
-update t1 set name='U+3065 HIRAGANA LETTER DU' where ujis=0xA4C5;
-update t1 set name='U+3066 HIRAGANA LETTER TE' where ujis=0xA4C6;
-update t1 set name='U+3067 HIRAGANA LETTER DE' where ujis=0xA4C7;
-update t1 set name='U+3068 HIRAGANA LETTER TO' where ujis=0xA4C8;
-update t1 set name='U+3069 HIRAGANA LETTER DO' where ujis=0xA4C9;
-update t1 set name='U+306A HIRAGANA LETTER NA' where ujis=0xA4CA;
-update t1 set name='U+306B HIRAGANA LETTER NI' where ujis=0xA4CB;
-update t1 set name='U+306C HIRAGANA LETTER NU' where ujis=0xA4CC;
-update t1 set name='U+306D HIRAGANA LETTER NE' where ujis=0xA4CD;
-update t1 set name='U+306E HIRAGANA LETTER NO' where ujis=0xA4CE;
-update t1 set name='U+306F HIRAGANA LETTER HA' where ujis=0xA4CF;
-update t1 set name='U+3070 HIRAGANA LETTER BA' where ujis=0xA4D0;
-update t1 set name='U+3071 HIRAGANA LETTER PA' where ujis=0xA4D1;
-update t1 set name='U+3072 HIRAGANA LETTER HI' where ujis=0xA4D2;
-update t1 set name='U+3073 HIRAGANA LETTER BI' where ujis=0xA4D3;
-update t1 set name='U+3074 HIRAGANA LETTER PI' where ujis=0xA4D4;
-update t1 set name='U+3075 HIRAGANA LETTER HU' where ujis=0xA4D5;
-update t1 set name='U+3076 HIRAGANA LETTER BU' where ujis=0xA4D6;
-update t1 set name='U+3077 HIRAGANA LETTER PU' where ujis=0xA4D7;
-update t1 set name='U+3078 HIRAGANA LETTER HE' where ujis=0xA4D8;
-update t1 set name='U+3079 HIRAGANA LETTER BE' where ujis=0xA4D9;
-update t1 set name='U+307A HIRAGANA LETTER PE' where ujis=0xA4DA;
-update t1 set name='U+307B HIRAGANA LETTER HO' where ujis=0xA4DB;
-update t1 set name='U+307C HIRAGANA LETTER BO' where ujis=0xA4DC;
-update t1 set name='U+307D HIRAGANA LETTER PO' where ujis=0xA4DD;
-update t1 set name='U+307E HIRAGANA LETTER MA' where ujis=0xA4DE;
-update t1 set name='U+307F HIRAGANA LETTER MI' where ujis=0xA4DF;
-update t1 set name='U+3080 HIRAGANA LETTER MU' where ujis=0xA4E0;
-update t1 set name='U+3081 HIRAGANA LETTER ME' where ujis=0xA4E1;
-update t1 set name='U+3082 HIRAGANA LETTER MO' where ujis=0xA4E2;
-update t1 set name='U+3083 HIRAGANA LETTER SMALL YA' where ujis=0xA4E3;
-update t1 set name='U+3084 HIRAGANA LETTER YA' where ujis=0xA4E4;
-update t1 set name='U+3085 HIRAGANA LETTER SMALL YU' where ujis=0xA4E5;
-update t1 set name='U+3086 HIRAGANA LETTER YU' where ujis=0xA4E6;
-update t1 set name='U+3087 HIRAGANA LETTER SMALL YO' where ujis=0xA4E7;
-update t1 set name='U+3088 HIRAGANA LETTER YO' where ujis=0xA4E8;
-update t1 set name='U+3089 HIRAGANA LETTER RA' where ujis=0xA4E9;
-update t1 set name='U+308A HIRAGANA LETTER RI' where ujis=0xA4EA;
-update t1 set name='U+308B HIRAGANA LETTER RU' where ujis=0xA4EB;
-update t1 set name='U+308C HIRAGANA LETTER RE' where ujis=0xA4EC;
-update t1 set name='U+308D HIRAGANA LETTER RO' where ujis=0xA4ED;
-update t1 set name='U+308E HIRAGANA LETTER SMALL WA' where ujis=0xA4EE;
-update t1 set name='U+308F HIRAGANA LETTER WA' where ujis=0xA4EF;
-update t1 set name='U+3090 HIRAGANA LETTER WI' where ujis=0xA4F0;
-update t1 set name='U+3091 HIRAGANA LETTER WE' where ujis=0xA4F1;
-update t1 set name='U+3092 HIRAGANA LETTER WO' where ujis=0xA4F2;
-update t1 set name='U+3093 HIRAGANA LETTER N' where ujis=0xA4F3;
-update t1 set name='U+30A1 KATAKANA LETTER SMALL A' where ujis=0xA5A1;
-update t1 set name='U+30A2 KATAKANA LETTER A' where ujis=0xA5A2;
-update t1 set name='U+30A3 KATAKANA LETTER SMALL I' where ujis=0xA5A3;
-update t1 set name='U+30A4 KATAKANA LETTER I' where ujis=0xA5A4;
-update t1 set name='U+30A5 KATAKANA LETTER SMALL U' where ujis=0xA5A5;
-update t1 set name='U+30A6 KATAKANA LETTER U' where ujis=0xA5A6;
-update t1 set name='U+30A7 KATAKANA LETTER SMALL E' where ujis=0xA5A7;
-update t1 set name='U+30A8 KATAKANA LETTER E' where ujis=0xA5A8;
-update t1 set name='U+30A9 KATAKANA LETTER SMALL O' where ujis=0xA5A9;
-update t1 set name='U+30AA KATAKANA LETTER O' where ujis=0xA5AA;
-update t1 set name='U+30AB KATAKANA LETTER KA' where ujis=0xA5AB;
-update t1 set name='U+30AC KATAKANA LETTER GA' where ujis=0xA5AC;
-update t1 set name='U+30AD KATAKANA LETTER KI' where ujis=0xA5AD;
-update t1 set name='U+30AE KATAKANA LETTER GI' where ujis=0xA5AE;
-update t1 set name='U+30AF KATAKANA LETTER KU' where ujis=0xA5AF;
-update t1 set name='U+30B0 KATAKANA LETTER GU' where ujis=0xA5B0;
-update t1 set name='U+30B1 KATAKANA LETTER KE' where ujis=0xA5B1;
-update t1 set name='U+30B2 KATAKANA LETTER GE' where ujis=0xA5B2;
-update t1 set name='U+30B3 KATAKANA LETTER KO' where ujis=0xA5B3;
-update t1 set name='U+30B4 KATAKANA LETTER GO' where ujis=0xA5B4;
-update t1 set name='U+30B5 KATAKANA LETTER SA' where ujis=0xA5B5;
-update t1 set name='U+30B6 KATAKANA LETTER ZA' where ujis=0xA5B6;
-update t1 set name='U+30B7 KATAKANA LETTER SI' where ujis=0xA5B7;
-update t1 set name='U+30B8 KATAKANA LETTER ZI' where ujis=0xA5B8;
-update t1 set name='U+30B9 KATAKANA LETTER SU' where ujis=0xA5B9;
-update t1 set name='U+30BA KATAKANA LETTER ZU' where ujis=0xA5BA;
-update t1 set name='U+30BB KATAKANA LETTER SE' where ujis=0xA5BB;
-update t1 set name='U+30BC KATAKANA LETTER ZE' where ujis=0xA5BC;
-update t1 set name='U+30BD KATAKANA LETTER SO' where ujis=0xA5BD;
-update t1 set name='U+30BE KATAKANA LETTER ZO' where ujis=0xA5BE;
-update t1 set name='U+30BF KATAKANA LETTER TA' where ujis=0xA5BF;
-update t1 set name='U+30C0 KATAKANA LETTER DA' where ujis=0xA5C0;
-update t1 set name='U+30C1 KATAKANA LETTER TI' where ujis=0xA5C1;
-update t1 set name='U+30C2 KATAKANA LETTER DI' where ujis=0xA5C2;
-update t1 set name='U+30C3 KATAKANA LETTER SMALL TU' where ujis=0xA5C3;
-update t1 set name='U+30C4 KATAKANA LETTER TU' where ujis=0xA5C4;
-update t1 set name='U+30C5 KATAKANA LETTER DU' where ujis=0xA5C5;
-update t1 set name='U+30C6 KATAKANA LETTER TE' where ujis=0xA5C6;
-update t1 set name='U+30C7 KATAKANA LETTER DE' where ujis=0xA5C7;
-update t1 set name='U+30C8 KATAKANA LETTER TO' where ujis=0xA5C8;
-update t1 set name='U+30C9 KATAKANA LETTER DO' where ujis=0xA5C9;
-update t1 set name='U+30CA KATAKANA LETTER NA' where ujis=0xA5CA;
-update t1 set name='U+30CB KATAKANA LETTER NI' where ujis=0xA5CB;
-update t1 set name='U+30CC KATAKANA LETTER NU' where ujis=0xA5CC;
-update t1 set name='U+30CD KATAKANA LETTER NE' where ujis=0xA5CD;
-update t1 set name='U+30CE KATAKANA LETTER NO' where ujis=0xA5CE;
-update t1 set name='U+30CF KATAKANA LETTER HA' where ujis=0xA5CF;
-update t1 set name='U+30D0 KATAKANA LETTER BA' where ujis=0xA5D0;
-update t1 set name='U+30D1 KATAKANA LETTER PA' where ujis=0xA5D1;
-update t1 set name='U+30D2 KATAKANA LETTER HI' where ujis=0xA5D2;
-update t1 set name='U+30D3 KATAKANA LETTER BI' where ujis=0xA5D3;
-update t1 set name='U+30D4 KATAKANA LETTER PI' where ujis=0xA5D4;
-update t1 set name='U+30D5 KATAKANA LETTER HU' where ujis=0xA5D5;
-update t1 set name='U+30D6 KATAKANA LETTER BU' where ujis=0xA5D6;
-update t1 set name='U+30D7 KATAKANA LETTER PU' where ujis=0xA5D7;
-update t1 set name='U+30D8 KATAKANA LETTER HE' where ujis=0xA5D8;
-update t1 set name='U+30D9 KATAKANA LETTER BE' where ujis=0xA5D9;
-update t1 set name='U+30DA KATAKANA LETTER PE' where ujis=0xA5DA;
-update t1 set name='U+30DB KATAKANA LETTER HO' where ujis=0xA5DB;
-update t1 set name='U+30DC KATAKANA LETTER BO' where ujis=0xA5DC;
-update t1 set name='U+30DD KATAKANA LETTER PO' where ujis=0xA5DD;
-update t1 set name='U+30DE KATAKANA LETTER MA' where ujis=0xA5DE;
-update t1 set name='U+30DF KATAKANA LETTER MI' where ujis=0xA5DF;
-update t1 set name='U+30E0 KATAKANA LETTER MU' where ujis=0xA5E0;
-update t1 set name='U+30E1 KATAKANA LETTER ME' where ujis=0xA5E1;
-update t1 set name='U+30E2 KATAKANA LETTER MO' where ujis=0xA5E2;
-update t1 set name='U+30E3 KATAKANA LETTER SMALL YA' where ujis=0xA5E3;
-update t1 set name='U+30E4 KATAKANA LETTER YA' where ujis=0xA5E4;
-update t1 set name='U+30E5 KATAKANA LETTER SMALL YU' where ujis=0xA5E5;
-update t1 set name='U+30E6 KATAKANA LETTER YU' where ujis=0xA5E6;
-update t1 set name='U+30E7 KATAKANA LETTER SMALL YO' where ujis=0xA5E7;
-update t1 set name='U+30E8 KATAKANA LETTER YO' where ujis=0xA5E8;
-update t1 set name='U+30E9 KATAKANA LETTER RA' where ujis=0xA5E9;
-update t1 set name='U+30EA KATAKANA LETTER RI' where ujis=0xA5EA;
-update t1 set name='U+30EB KATAKANA LETTER RU' where ujis=0xA5EB;
-update t1 set name='U+30EC KATAKANA LETTER RE' where ujis=0xA5EC;
-update t1 set name='U+30ED KATAKANA LETTER RO' where ujis=0xA5ED;
-update t1 set name='U+30EE KATAKANA LETTER SMALL WA' where ujis=0xA5EE;
-update t1 set name='U+30EF KATAKANA LETTER WA' where ujis=0xA5EF;
-update t1 set name='U+30F0 KATAKANA LETTER WI' where ujis=0xA5F0;
-update t1 set name='U+30F1 KATAKANA LETTER WE' where ujis=0xA5F1;
-update t1 set name='U+30F2 KATAKANA LETTER WO' where ujis=0xA5F2;
-update t1 set name='U+30F3 KATAKANA LETTER N' where ujis=0xA5F3;
-update t1 set name='U+30F4 KATAKANA LETTER VU' where ujis=0xA5F4;
-update t1 set name='U+30F5 KATAKANA LETTER SMALL KA' where ujis=0xA5F5;
-update t1 set name='U+30F6 KATAKANA LETTER SMALL KE' where ujis=0xA5F6;
-update t1 set name='U+0391 GREEK CAPITAL LETTER ALPHA' where ujis=0xA6A1;
-update t1 set name='U+0392 GREEK CAPITAL LETTER BETA' where ujis=0xA6A2;
-update t1 set name='U+0393 GREEK CAPITAL LETTER GAMMA' where ujis=0xA6A3;
-update t1 set name='U+0394 GREEK CAPITAL LETTER DELTA' where ujis=0xA6A4;
-update t1 set name='U+0395 GREEK CAPITAL LETTER EPSILON' where ujis=0xA6A5;
-update t1 set name='U+0396 GREEK CAPITAL LETTER ZETA' where ujis=0xA6A6;
-update t1 set name='U+0397 GREEK CAPITAL LETTER ETA' where ujis=0xA6A7;
-update t1 set name='U+0398 GREEK CAPITAL LETTER THETA' where ujis=0xA6A8;
-update t1 set name='U+0399 GREEK CAPITAL LETTER IOTA' where ujis=0xA6A9;
-update t1 set name='U+039A GREEK CAPITAL LETTER KAPPA' where ujis=0xA6AA;
-update t1 set name='U+039B GREEK CAPITAL LETTER LAMDA' where ujis=0xA6AB;
-update t1 set name='U+039C GREEK CAPITAL LETTER MU' where ujis=0xA6AC;
-update t1 set name='U+039D GREEK CAPITAL LETTER NU' where ujis=0xA6AD;
-update t1 set name='U+039E GREEK CAPITAL LETTER XI' where ujis=0xA6AE;
-update t1 set name='U+039F GREEK CAPITAL LETTER OMICRON' where ujis=0xA6AF;
-update t1 set name='U+03A0 GREEK CAPITAL LETTER PI' where ujis=0xA6B0;
-update t1 set name='U+03A1 GREEK CAPITAL LETTER RHO' where ujis=0xA6B1;
-update t1 set name='U+03A3 GREEK CAPITAL LETTER SIGMA' where ujis=0xA6B2;
-update t1 set name='U+03A4 GREEK CAPITAL LETTER TAU' where ujis=0xA6B3;
-update t1 set name='U+03A5 GREEK CAPITAL LETTER UPSILON' where ujis=0xA6B4;
-update t1 set name='U+03A6 GREEK CAPITAL LETTER PHI' where ujis=0xA6B5;
-update t1 set name='U+03A7 GREEK CAPITAL LETTER CHI' where ujis=0xA6B6;
-update t1 set name='U+03A8 GREEK CAPITAL LETTER PSI' where ujis=0xA6B7;
-update t1 set name='U+03A9 GREEK CAPITAL LETTER OMEGA' where ujis=0xA6B8;
-update t1 set name='U+03B1 GREEK SMALL LETTER ALPHA' where ujis=0xA6C1;
-update t1 set name='U+03B2 GREEK SMALL LETTER BETA' where ujis=0xA6C2;
-update t1 set name='U+03B3 GREEK SMALL LETTER GAMMA' where ujis=0xA6C3;
-update t1 set name='U+03B4 GREEK SMALL LETTER DELTA' where ujis=0xA6C4;
-update t1 set name='U+03B5 GREEK SMALL LETTER EPSILON' where ujis=0xA6C5;
-update t1 set name='U+03B6 GREEK SMALL LETTER ZETA' where ujis=0xA6C6;
-update t1 set name='U+03B7 GREEK SMALL LETTER ETA' where ujis=0xA6C7;
-update t1 set name='U+03B8 GREEK SMALL LETTER THETA' where ujis=0xA6C8;
-update t1 set name='U+03B9 GREEK SMALL LETTER IOTA' where ujis=0xA6C9;
-update t1 set name='U+03BA GREEK SMALL LETTER KAPPA' where ujis=0xA6CA;
-update t1 set name='U+03BB GREEK SMALL LETTER LAMDA' where ujis=0xA6CB;
-update t1 set name='U+03BC GREEK SMALL LETTER MU' where ujis=0xA6CC;
-update t1 set name='U+03BD GREEK SMALL LETTER NU' where ujis=0xA6CD;
-update t1 set name='U+03BE GREEK SMALL LETTER XI' where ujis=0xA6CE;
-update t1 set name='U+03BF GREEK SMALL LETTER OMICRON' where ujis=0xA6CF;
-update t1 set name='U+03C0 GREEK SMALL LETTER PI' where ujis=0xA6D0;
-update t1 set name='U+03C1 GREEK SMALL LETTER RHO' where ujis=0xA6D1;
-update t1 set name='U+03C3 GREEK SMALL LETTER SIGMA' where ujis=0xA6D2;
-update t1 set name='U+03C4 GREEK SMALL LETTER TAU' where ujis=0xA6D3;
-update t1 set name='U+03C5 GREEK SMALL LETTER UPSILON' where ujis=0xA6D4;
-update t1 set name='U+03C6 GREEK SMALL LETTER PHI' where ujis=0xA6D5;
-update t1 set name='U+03C7 GREEK SMALL LETTER CHI' where ujis=0xA6D6;
-update t1 set name='U+03C8 GREEK SMALL LETTER PSI' where ujis=0xA6D7;
-update t1 set name='U+03C9 GREEK SMALL LETTER OMEGA' where ujis=0xA6D8;
-update t1 set name='U+0410 CYRILLIC CAPITAL LETTER A' where ujis=0xA7A1;
-update t1 set name='U+0411 CYRILLIC CAPITAL LETTER BE' where ujis=0xA7A2;
-update t1 set name='U+0412 CYRILLIC CAPITAL LETTER VE' where ujis=0xA7A3;
-update t1 set name='U+0413 CYRILLIC CAPITAL LETTER GHE' where ujis=0xA7A4;
-update t1 set name='U+0414 CYRILLIC CAPITAL LETTER DE' where ujis=0xA7A5;
-update t1 set name='U+0415 CYRILLIC CAPITAL LETTER IE' where ujis=0xA7A6;
-update t1 set name='U+0401 CYRILLIC CAPITAL LETTER IO' where ujis=0xA7A7;
-update t1 set name='U+0416 CYRILLIC CAPITAL LETTER ZHE' where ujis=0xA7A8;
-update t1 set name='U+0417 CYRILLIC CAPITAL LETTER ZE' where ujis=0xA7A9;
-update t1 set name='U+0418 CYRILLIC CAPITAL LETTER I' where ujis=0xA7AA;
-update t1 set name='U+0419 CYRILLIC CAPITAL LETTER SHORT I' where ujis=0xA7AB;
-update t1 set name='U+041A CYRILLIC CAPITAL LETTER KA' where ujis=0xA7AC;
-update t1 set name='U+041B CYRILLIC CAPITAL LETTER EL' where ujis=0xA7AD;
-update t1 set name='U+041C CYRILLIC CAPITAL LETTER EM' where ujis=0xA7AE;
-update t1 set name='U+041D CYRILLIC CAPITAL LETTER EN' where ujis=0xA7AF;
-update t1 set name='U+041E CYRILLIC CAPITAL LETTER O' where ujis=0xA7B0;
-update t1 set name='U+041F CYRILLIC CAPITAL LETTER PE' where ujis=0xA7B1;
-update t1 set name='U+0420 CYRILLIC CAPITAL LETTER ER' where ujis=0xA7B2;
-update t1 set name='U+0421 CYRILLIC CAPITAL LETTER ES' where ujis=0xA7B3;
-update t1 set name='U+0422 CYRILLIC CAPITAL LETTER TE' where ujis=0xA7B4;
-update t1 set name='U+0423 CYRILLIC CAPITAL LETTER U' where ujis=0xA7B5;
-update t1 set name='U+0424 CYRILLIC CAPITAL LETTER EF' where ujis=0xA7B6;
-update t1 set name='U+0425 CYRILLIC CAPITAL LETTER HA' where ujis=0xA7B7;
-update t1 set name='U+0426 CYRILLIC CAPITAL LETTER TSE' where ujis=0xA7B8;
-update t1 set name='U+0427 CYRILLIC CAPITAL LETTER CHE' where ujis=0xA7B9;
-update t1 set name='U+0428 CYRILLIC CAPITAL LETTER SHA' where ujis=0xA7BA;
-update t1 set name='U+0429 CYRILLIC CAPITAL LETTER SHCHA' where ujis=0xA7BB;
-update t1 set name='U+042A CYRILLIC CAPITAL LETTER HARD SIGN' where ujis=0xA7BC;
-update t1 set name='U+042B CYRILLIC CAPITAL LETTER YERU' where ujis=0xA7BD;
-update t1 set name='U+042C CYRILLIC CAPITAL LETTER SOFT SIGN' where ujis=0xA7BE;
-update t1 set name='U+042D CYRILLIC CAPITAL LETTER E' where ujis=0xA7BF;
-update t1 set name='U+042E CYRILLIC CAPITAL LETTER YU' where ujis=0xA7C0;
-update t1 set name='U+042F CYRILLIC CAPITAL LETTER YA' where ujis=0xA7C1;
-update t1 set name='U+0430 CYRILLIC SMALL LETTER A' where ujis=0xA7D1;
-update t1 set name='U+0431 CYRILLIC SMALL LETTER BE' where ujis=0xA7D2;
-update t1 set name='U+0432 CYRILLIC SMALL LETTER VE' where ujis=0xA7D3;
-update t1 set name='U+0433 CYRILLIC SMALL LETTER GHE' where ujis=0xA7D4;
-update t1 set name='U+0434 CYRILLIC SMALL LETTER DE' where ujis=0xA7D5;
-update t1 set name='U+0435 CYRILLIC SMALL LETTER IE' where ujis=0xA7D6;
-update t1 set name='U+0451 CYRILLIC SMALL LETTER IO' where ujis=0xA7D7;
-update t1 set name='U+0436 CYRILLIC SMALL LETTER ZHE' where ujis=0xA7D8;
-update t1 set name='U+0437 CYRILLIC SMALL LETTER ZE' where ujis=0xA7D9;
-update t1 set name='U+0438 CYRILLIC SMALL LETTER I' where ujis=0xA7DA;
-update t1 set name='U+0439 CYRILLIC SMALL LETTER SHORT I' where ujis=0xA7DB;
-update t1 set name='U+043A CYRILLIC SMALL LETTER KA' where ujis=0xA7DC;
-update t1 set name='U+043B CYRILLIC SMALL LETTER EL' where ujis=0xA7DD;
-update t1 set name='U+043C CYRILLIC SMALL LETTER EM' where ujis=0xA7DE;
-update t1 set name='U+043D CYRILLIC SMALL LETTER EN' where ujis=0xA7DF;
-update t1 set name='U+043E CYRILLIC SMALL LETTER O' where ujis=0xA7E0;
-update t1 set name='U+043F CYRILLIC SMALL LETTER PE' where ujis=0xA7E1;
-update t1 set name='U+0440 CYRILLIC SMALL LETTER ER' where ujis=0xA7E2;
-update t1 set name='U+0441 CYRILLIC SMALL LETTER ES' where ujis=0xA7E3;
-update t1 set name='U+0442 CYRILLIC SMALL LETTER TE' where ujis=0xA7E4;
-update t1 set name='U+0443 CYRILLIC SMALL LETTER U' where ujis=0xA7E5;
-update t1 set name='U+0444 CYRILLIC SMALL LETTER EF' where ujis=0xA7E6;
-update t1 set name='U+0445 CYRILLIC SMALL LETTER HA' where ujis=0xA7E7;
-update t1 set name='U+0446 CYRILLIC SMALL LETTER TSE' where ujis=0xA7E8;
-update t1 set name='U+0447 CYRILLIC SMALL LETTER CHE' where ujis=0xA7E9;
-update t1 set name='U+0448 CYRILLIC SMALL LETTER SHA' where ujis=0xA7EA;
-update t1 set name='U+0449 CYRILLIC SMALL LETTER SHCHA' where ujis=0xA7EB;
-update t1 set name='U+044A CYRILLIC SMALL LETTER HARD SIGN' where ujis=0xA7EC;
-update t1 set name='U+044B CYRILLIC SMALL LETTER YERU' where ujis=0xA7ED;
-update t1 set name='U+044C CYRILLIC SMALL LETTER SOFT SIGN' where ujis=0xA7EE;
-update t1 set name='U+044D CYRILLIC SMALL LETTER E' where ujis=0xA7EF;
-update t1 set name='U+044E CYRILLIC SMALL LETTER YU' where ujis=0xA7F0;
-update t1 set name='U+044F CYRILLIC SMALL LETTER YA' where ujis=0xA7F1;
-update t1 set name='U+2500 BOX DRAWINGS LIGHT HORIZONTAL' where ujis=0xA8A1;
-update t1 set name='U+2502 BOX DRAWINGS LIGHT VERTICAL' where ujis=0xA8A2;
-update t1 set name='U+250C BOX DRAWINGS LIGHT DOWN AND RIGHT' where ujis=0xA8A3;
-update t1 set name='U+2510 BOX DRAWINGS LIGHT DOWN AND LEFT' where ujis=0xA8A4;
-update t1 set name='U+2518 BOX DRAWINGS LIGHT UP AND LEFT' where ujis=0xA8A5;
-update t1 set name='U+2514 BOX DRAWINGS LIGHT UP AND RIGHT' where ujis=0xA8A6;
-update t1 set name='U+251C BOX DRAWINGS LIGHT VERTICAL AND RIGHT' where ujis=0xA8A7;
-update t1 set name='U+252C BOX DRAWINGS LIGHT DOWN AND HORIZONTAL' where ujis=0xA8A8;
-update t1 set name='U+2524 BOX DRAWINGS LIGHT VERTICAL AND LEFT' where ujis=0xA8A9;
-update t1 set name='U+2534 BOX DRAWINGS LIGHT UP AND HORIZONTAL' where ujis=0xA8AA;
-update t1 set name='U+253C BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL' where ujis=0xA8AB;
-update t1 set name='U+2501 BOX DRAWINGS HEAVY HORIZONTAL' where ujis=0xA8AC;
-update t1 set name='U+2503 BOX DRAWINGS HEAVY VERTICAL' where ujis=0xA8AD;
-update t1 set name='U+250F BOX DRAWINGS HEAVY DOWN AND RIGHT' where ujis=0xA8AE;
-update t1 set name='U+2513 BOX DRAWINGS HEAVY DOWN AND LEFT' where ujis=0xA8AF;
-update t1 set name='U+251B BOX DRAWINGS HEAVY UP AND LEFT' where ujis=0xA8B0;
-update t1 set name='U+2517 BOX DRAWINGS HEAVY UP AND RIGHT' where ujis=0xA8B1;
-update t1 set name='U+2523 BOX DRAWINGS HEAVY VERTICAL AND RIGHT' where ujis=0xA8B2;
-update t1 set name='U+2533 BOX DRAWINGS HEAVY DOWN AND HORIZONTAL' where ujis=0xA8B3;
-update t1 set name='U+252B BOX DRAWINGS HEAVY VERTICAL AND LEFT' where ujis=0xA8B4;
-update t1 set name='U+253B BOX DRAWINGS HEAVY UP AND HORIZONTAL' where ujis=0xA8B5;
-update t1 set name='U+254B BOX DRAWINGS HEAVY VERTICAL AND HORIZONTAL' where ujis=0xA8B6;
-update t1 set name='U+2520 BOX DRAWINGS VERTICAL HEAVY AND RIGHT LIGHT' where ujis=0xA8B7;
-update t1 set name='U+252F BOX DRAWINGS DOWN LIGHT AND HORIZONTAL HEAVY' where ujis=0xA8B8;
-update t1 set name='U+2528 BOX DRAWINGS VERTICAL HEAVY AND LEFT LIGHT' where ujis=0xA8B9;
-update t1 set name='U+2537 BOX DRAWINGS UP LIGHT AND HORIZONTAL HEAVY' where ujis=0xA8BA;
-update t1 set name='U+253F BOX DRAWINGS VERTICAL LIGHT AND HORIZONTAL HEAVY' where ujis=0xA8BB;
-update t1 set name='U+251D BOX DRAWINGS VERTICAL LIGHT AND RIGHT HEAVY' where ujis=0xA8BC;
-update t1 set name='U+2530 BOX DRAWINGS DOWN HEAVY AND HORIZONTAL LIGHT' where ujis=0xA8BD;
-update t1 set name='U+2525 BOX DRAWINGS VERTICAL LIGHT AND LEFT HEAVY' where ujis=0xA8BE;
-update t1 set name='U+2538 BOX DRAWINGS UP HEAVY AND HORIZONTAL LIGHT' where ujis=0xA8BF;
-update t1 set name='U+2542 BOX DRAWINGS VERTICAL HEAVY AND HORIZONTAL LIGHT' where ujis=0xA8C0;
-
-#
-# [B0..BF][A1..FE] - 16*94=1504 codes assigned
-#
-update t1 set name='<CJK>' where ujis >= 0xB0A1 AND ujis <= 0xBFFE;
-
-#
-# [C0..CE][A1..FE] = 15*94=1410 codes assigned
-#
-update t1 set name='<CJK>' where ujis >= 0xC0A1 AND ujis <= 0xCEFE;
-
-#
-# 0xCFxx - 51 codes assigned
-#
-update t1 set name='U+84EE <CJK>' where ujis=0xCFA1;
-update t1 set name='U+9023 <CJK>' where ujis=0xCFA2;
-update t1 set name='U+932C <CJK>' where ujis=0xCFA3;
-update t1 set name='U+5442 <CJK>' where ujis=0xCFA4;
-update t1 set name='U+9B6F <CJK>' where ujis=0xCFA5;
-update t1 set name='U+6AD3 <CJK>' where ujis=0xCFA6;
-update t1 set name='U+7089 <CJK>' where ujis=0xCFA7;
-update t1 set name='U+8CC2 <CJK>' where ujis=0xCFA8;
-update t1 set name='U+8DEF <CJK>' where ujis=0xCFA9;
-update t1 set name='U+9732 <CJK>' where ujis=0xCFAA;
-update t1 set name='U+52B4 <CJK>' where ujis=0xCFAB;
-update t1 set name='U+5A41 <CJK>' where ujis=0xCFAC;
-update t1 set name='U+5ECA <CJK>' where ujis=0xCFAD;
-update t1 set name='U+5F04 <CJK>' where ujis=0xCFAE;
-update t1 set name='U+6717 <CJK>' where ujis=0xCFAF;
-update t1 set name='U+697C <CJK>' where ujis=0xCFB0;
-update t1 set name='U+6994 <CJK>' where ujis=0xCFB1;
-update t1 set name='U+6D6A <CJK>' where ujis=0xCFB2;
-update t1 set name='U+6F0F <CJK>' where ujis=0xCFB3;
-update t1 set name='U+7262 <CJK>' where ujis=0xCFB4;
-update t1 set name='U+72FC <CJK>' where ujis=0xCFB5;
-update t1 set name='U+7BED <CJK>' where ujis=0xCFB6;
-update t1 set name='U+8001 <CJK>' where ujis=0xCFB7;
-update t1 set name='U+807E <CJK>' where ujis=0xCFB8;
-update t1 set name='U+874B <CJK>' where ujis=0xCFB9;
-update t1 set name='U+90CE <CJK>' where ujis=0xCFBA;
-update t1 set name='U+516D <CJK>' where ujis=0xCFBB;
-update t1 set name='U+9E93 <CJK>' where ujis=0xCFBC;
-update t1 set name='U+7984 <CJK>' where ujis=0xCFBD;
-update t1 set name='U+808B <CJK>' where ujis=0xCFBE;
-update t1 set name='U+9332 <CJK>' where ujis=0xCFBF;
-update t1 set name='U+8AD6 <CJK>' where ujis=0xCFC0;
-update t1 set name='U+502D <CJK>' where ujis=0xCFC1;
-update t1 set name='U+548C <CJK>' where ujis=0xCFC2;
-update t1 set name='U+8A71 <CJK>' where ujis=0xCFC3;
-update t1 set name='U+6B6A <CJK>' where ujis=0xCFC4;
-update t1 set name='U+8CC4 <CJK>' where ujis=0xCFC5;
-update t1 set name='U+8107 <CJK>' where ujis=0xCFC6;
-update t1 set name='U+60D1 <CJK>' where ujis=0xCFC7;
-update t1 set name='U+67A0 <CJK>' where ujis=0xCFC8;
-update t1 set name='U+9DF2 <CJK>' where ujis=0xCFC9;
-update t1 set name='U+4E99 <CJK>' where ujis=0xCFCA;
-update t1 set name='U+4E98 <CJK>' where ujis=0xCFCB;
-update t1 set name='U+9C10 <CJK>' where ujis=0xCFCC;
-update t1 set name='U+8A6B <CJK>' where ujis=0xCFCD;
-update t1 set name='U+85C1 <CJK>' where ujis=0xCFCE;
-update t1 set name='U+8568 <CJK>' where ujis=0xCFCF;
-update t1 set name='U+6900 <CJK>' where ujis=0xCFD0;
-update t1 set name='U+6E7E <CJK>' where ujis=0xCFD1;
-update t1 set name='U+7897 <CJK>' where ujis=0xCFD2;
-update t1 set name='U+8155 <CJK>' where ujis=0xCFD3;
-
-#
-# [D0..DF][A1..FE] - all 16*94=1504 codes assigned
-#
-update t1 set name='<CJK>' where ujis >= 0xD0A1 AND ujis <= 0xDFFE;
-
-#
-# [E0..EF][A1..FE] - all codes assigned, 16*94=1504 total
-#
-update t1 set name='<CJK>' where ujis >= 0xE0A1 AND ujis <= 0xEFFE;
-
-#
-# [F0..F3][A1..FE] - all codes assigned, 4*94=376 total
-#
-update t1 set name='<CJK>' where ujis >= 0xF0A1 AND ujis <= 0xF3FE;
-
-# 0xF4xx - six codes assigned
-update t1 set name='U+582F <CJK>' where ujis=0xF4A1;
-update t1 set name='U+69C7 <CJK>' where ujis=0xF4A2;
-update t1 set name='U+9059 <CJK>' where ujis=0xF4A3;
-update t1 set name='U+7464 <CJK>' where ujis=0xF4A4;
-update t1 set name='U+51DC <CJK>' where ujis=0xF4A5;
-update t1 set name='U+7199 <CJK>' where ujis=0xF4A6;
-
-# [F5..FE][A1..FE] - User defined range
-update t1 set name='User defined range #1' where ujis >= 0xF5A1 AND ujis <= 0xFEFE;
-
-
-# A character from the upper half of JIS-X-0201
-# (half-width kana, code set 2)
-# is represented by two bytes:
-# the first being 0x8E,
-# the second in the range 0xA1 - 0xDF.
-# Codes according to:
-# ftp://ftp.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/JIS/JIS0201.TXT
-
-insert into t1 (ujis,name) values (0x8EA1,'U+FF61 HALFWIDTH IDEOGRAPHIC FULL STOP');
-insert into t1 (ujis,name) values (0x8EA2,'U+FF62 HALFWIDTH LEFT CORNER BRACKET');
-insert into t1 (ujis,name) values (0x8EA3,'U+FF63 HALFWIDTH RIGHT CORNER BRACKET');
-insert into t1 (ujis,name) values (0x8EA4,'U+FF64 HALFWIDTH IDEOGRAPHIC COMMA');
-insert into t1 (ujis,name) values (0x8EA5,'U+FF65 HALFWIDTH KATAKANA MIDDLE DOT');
-insert into t1 (ujis,name) values (0x8EA6,'U+FF66 HALFWIDTH KATAKANA LETTER WO');
-insert into t1 (ujis,name) values (0x8EA7,'U+FF67 HALFWIDTH KATAKANA LETTER SMALL A');
-insert into t1 (ujis,name) values (0x8EA8,'U+FF68 HALFWIDTH KATAKANA LETTER SMALL I');
-insert into t1 (ujis,name) values (0x8EA9,'U+FF69 HALFWIDTH KATAKANA LETTER SMALL U');
-insert into t1 (ujis,name) values (0x8EAA,'U+FF6A HALFWIDTH KATAKANA LETTER SMALL E');
-insert into t1 (ujis,name) values (0x8EAB,'U+FF6B HALFWIDTH KATAKANA LETTER SMALL O');
-insert into t1 (ujis,name) values (0x8EAC,'U+FF6C HALFWIDTH KATAKANA LETTER SMALL YA');
-insert into t1 (ujis,name) values (0x8EAD,'U+FF6D HALFWIDTH KATAKANA LETTER SMALL YU');
-insert into t1 (ujis,name) values (0x8EAE,'U+FF6E HALFWIDTH KATAKANA LETTER SMALL YO');
-insert into t1 (ujis,name) values (0x8EAF,'U+FF6F HALFWIDTH KATAKANA LETTER SMALL TU');
-insert into t1 (ujis,name) values (0x8EB0,'U+FF70 HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK');
-insert into t1 (ujis,name) values (0x8EB1,'U+FF71 HALFWIDTH KATAKANA LETTER A');
-insert into t1 (ujis,name) values (0x8EB2,'U+FF72 HALFWIDTH KATAKANA LETTER I');
-insert into t1 (ujis,name) values (0x8EB3,'U+FF73 HALFWIDTH KATAKANA LETTER U');
-insert into t1 (ujis,name) values (0x8EB4,'U+FF74 HALFWIDTH KATAKANA LETTER E');
-insert into t1 (ujis,name) values (0x8EB5,'U+FF75 HALFWIDTH KATAKANA LETTER O');
-insert into t1 (ujis,name) values (0x8EB6,'U+FF76 HALFWIDTH KATAKANA LETTER KA');
-insert into t1 (ujis,name) values (0x8EB7,'U+FF77 HALFWIDTH KATAKANA LETTER KI');
-insert into t1 (ujis,name) values (0x8EB8,'U+FF78 HALFWIDTH KATAKANA LETTER KU');
-insert into t1 (ujis,name) values (0x8EB9,'U+FF79 HALFWIDTH KATAKANA LETTER KE');
-insert into t1 (ujis,name) values (0x8EBA,'U+FF7A HALFWIDTH KATAKANA LETTER KO');
-insert into t1 (ujis,name) values (0x8EBB,'U+FF7B HALFWIDTH KATAKANA LETTER SA');
-insert into t1 (ujis,name) values (0x8EBC,'U+FF7C HALFWIDTH KATAKANA LETTER SI');
-insert into t1 (ujis,name) values (0x8EBD,'U+FF7D HALFWIDTH KATAKANA LETTER SU');
-insert into t1 (ujis,name) values (0x8EBE,'U+FF7E HALFWIDTH KATAKANA LETTER SE');
-insert into t1 (ujis,name) values (0x8EBF,'U+FF7F HALFWIDTH KATAKANA LETTER SO');
-insert into t1 (ujis,name) values (0x8EC0,'U+FF80 HALFWIDTH KATAKANA LETTER TA');
-insert into t1 (ujis,name) values (0x8EC1,'U+FF81 HALFWIDTH KATAKANA LETTER TI');
-insert into t1 (ujis,name) values (0x8EC2,'U+FF82 HALFWIDTH KATAKANA LETTER TU');
-insert into t1 (ujis,name) values (0x8EC3,'U+FF83 HALFWIDTH KATAKANA LETTER TE');
-insert into t1 (ujis,name) values (0x8EC4,'U+FF84 HALFWIDTH KATAKANA LETTER TO');
-insert into t1 (ujis,name) values (0x8EC5,'U+FF85 HALFWIDTH KATAKANA LETTER NA');
-insert into t1 (ujis,name) values (0x8EC6,'U+FF86 HALFWIDTH KATAKANA LETTER NI');
-insert into t1 (ujis,name) values (0x8EC7,'U+FF87 HALFWIDTH KATAKANA LETTER NU');
-insert into t1 (ujis,name) values (0x8EC8,'U+FF88 HALFWIDTH KATAKANA LETTER NE');
-insert into t1 (ujis,name) values (0x8EC9,'U+FF89 HALFWIDTH KATAKANA LETTER NO');
-insert into t1 (ujis,name) values (0x8ECA,'U+FF8A HALFWIDTH KATAKANA LETTER HA');
-insert into t1 (ujis,name) values (0x8ECB,'U+FF8B HALFWIDTH KATAKANA LETTER HI');
-insert into t1 (ujis,name) values (0x8ECC,'U+FF8C HALFWIDTH KATAKANA LETTER HU');
-insert into t1 (ujis,name) values (0x8ECD,'U+FF8D HALFWIDTH KATAKANA LETTER HE');
-insert into t1 (ujis,name) values (0x8ECE,'U+FF8E HALFWIDTH KATAKANA LETTER HO');
-insert into t1 (ujis,name) values (0x8ECF,'U+FF8F HALFWIDTH KATAKANA LETTER MA');
-insert into t1 (ujis,name) values (0x8ED0,'U+FF90 HALFWIDTH KATAKANA LETTER MI');
-insert into t1 (ujis,name) values (0x8ED1,'U+FF91 HALFWIDTH KATAKANA LETTER MU');
-insert into t1 (ujis,name) values (0x8ED2,'U+FF92 HALFWIDTH KATAKANA LETTER ME');
-insert into t1 (ujis,name) values (0x8ED3,'U+FF93 HALFWIDTH KATAKANA LETTER MO');
-insert into t1 (ujis,name) values (0x8ED4,'U+FF94 HALFWIDTH KATAKANA LETTER YA');
-insert into t1 (ujis,name) values (0x8ED5,'U+FF95 HALFWIDTH KATAKANA LETTER YU');
-insert into t1 (ujis,name) values (0x8ED6,'U+FF96 HALFWIDTH KATAKANA LETTER YO');
-insert into t1 (ujis,name) values (0x8ED7,'U+FF97 HALFWIDTH KATAKANA LETTER RA');
-insert into t1 (ujis,name) values (0x8ED8,'U+FF98 HALFWIDTH KATAKANA LETTER RI');
-insert into t1 (ujis,name) values (0x8ED9,'U+FF99 HALFWIDTH KATAKANA LETTER RU');
-insert into t1 (ujis,name) values (0x8EDA,'U+FF9A HALFWIDTH KATAKANA LETTER RE');
-insert into t1 (ujis,name) values (0x8EDB,'U+FF9B HALFWIDTH KATAKANA LETTER RO');
-insert into t1 (ujis,name) values (0x8EDC,'U+FF9C HALFWIDTH KATAKANA LETTER WA');
-insert into t1 (ujis,name) values (0x8EDD,'U+FF9D HALFWIDTH KATAKANA LETTER N');
-insert into t1 (ujis,name) values (0x8EDE,'U+FF9E HALFWIDTH KATAKANA VOICED SOUND MARK');
-insert into t1 (ujis,name) values (0x8EDF,'U+FF9F HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK');
-
-
-#
-# A character from JIS-X-0212 (code set 3)
-# is represented by three bytes,
-# the first being 0x8F,
-# the following two in the range 0xA1 - 0xFE.
-# ftp://ftp.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/JIS/JIS0212.TXT
-#
-# Fill table t1 with codes [8F][A1..FE][A1..FE] using helper table t2,
-# 8836 codes total
-#
-insert into t1 (ujis) select concat(0x8F,t21.code,t22.code) from t2 t21, t2 t22 order by 1;
-
-update t1 set name='U+02D8 BREVE' where ujis=0x8FA2AF;
-update t1 set name='U+02C7 CARON (Mandarin Chinese third tone)' where ujis=0x8FA2B0;
-update t1 set name='U+00B8 CEDILLA' where ujis=0x8FA2B1;
-update t1 set name='U+02D9 DOT ABOVE (Mandarin Chinese light tone)' where ujis=0x8FA2B2;
-update t1 set name='U+02DD DOUBLE ACUTE ACCENT' where ujis=0x8FA2B3;
-update t1 set name='U+00AF MACRON' where ujis=0x8FA2B4;
-update t1 set name='U+02DB OGONEK' where ujis=0x8FA2B5;
-update t1 set name='U+02DA RING ABOVE' where ujis=0x8FA2B6;
-update t1 set name='U+007E TILDE' where ujis=0x8FA2B7;
-update t1 set name='U+0384 GREEK TONOS' where ujis=0x8FA2B8;
-update t1 set name='U+0385 GREEK DIALYTIKA TONOS' where ujis=0x8FA2B9;
-update t1 set name='U+00A1 INVERTED EXCLAMATION MARK' where ujis=0x8FA2C2;
-update t1 set name='U+00A6 BROKEN BAR' where ujis=0x8FA2C3;
-update t1 set name='U+00BF INVERTED QUESTION MARK' where ujis=0x8FA2C4;
-update t1 set name='U+00BA MASCULINE ORDINAL INDICATOR' where ujis=0x8FA2EB;
-update t1 set name='U+00AA FEMININE ORDINAL INDICATOR' where ujis=0x8FA2EC;
-update t1 set name='U+00A9 COPYRIGHT SIGN' where ujis=0x8FA2ED;
-update t1 set name='U+00AE REGISTERED SIGN' where ujis=0x8FA2EE;
-update t1 set name='U+2122 TRADE MARK SIGN' where ujis=0x8FA2EF;
-update t1 set name='U+00A4 CURRENCY SIGN' where ujis=0x8FA2F0;
-update t1 set name='U+2116 NUMERO SIGN' where ujis=0x8FA2F1;
-update t1 set name='U+0386 GREEK CAPITAL LETTER ALPHA WITH TONOS' where ujis=0x8FA6E1;
-update t1 set name='U+0388 GREEK CAPITAL LETTER EPSILON WITH TONOS' where ujis=0x8FA6E2;
-update t1 set name='U+0389 GREEK CAPITAL LETTER ETA WITH TONOS' where ujis=0x8FA6E3;
-update t1 set name='U+038A GREEK CAPITAL LETTER IOTA WITH TONOS' where ujis=0x8FA6E4;
-update t1 set name='U+03AA GREEK CAPITAL LETTER IOTA WITH DIALYTIKA' where ujis=0x8FA6E5;
-update t1 set name='U+038C GREEK CAPITAL LETTER OMICRON WITH TONOS' where ujis=0x8FA6E7;
-update t1 set name='U+038E GREEK CAPITAL LETTER UPSILON WITH TONOS' where ujis=0x8FA6E9;
-update t1 set name='U+03AB GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA' where ujis=0x8FA6EA;
-update t1 set name='U+038F GREEK CAPITAL LETTER OMEGA WITH TONOS' where ujis=0x8FA6EC;
-update t1 set name='U+03AC GREEK SMALL LETTER ALPHA WITH TONOS' where ujis=0x8FA6F1;
-update t1 set name='U+03AD GREEK SMALL LETTER EPSILON WITH TONOS' where ujis=0x8FA6F2;
-update t1 set name='U+03AE GREEK SMALL LETTER ETA WITH TONOS' where ujis=0x8FA6F3;
-update t1 set name='U+03AF GREEK SMALL LETTER IOTA WITH TONOS' where ujis=0x8FA6F4;
-update t1 set name='U+03CA GREEK SMALL LETTER IOTA WITH DIALYTIKA' where ujis=0x8FA6F5;
-update t1 set name='U+0390 GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS' where ujis=0x8FA6F6;
-update t1 set name='U+03CC GREEK SMALL LETTER OMICRON WITH TONOS' where ujis=0x8FA6F7;
-update t1 set name='U+03C2 GREEK SMALL LETTER FINAL SIGMA' where ujis=0x8FA6F8;
-update t1 set name='U+03CD GREEK SMALL LETTER UPSILON WITH TONOS' where ujis=0x8FA6F9;
-update t1 set name='U+03CB GREEK SMALL LETTER UPSILON WITH DIALYTIKA' where ujis=0x8FA6FA;
-update t1 set name='U+03B0 GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS' where ujis=0x8FA6FB;
-update t1 set name='U+03CE GREEK SMALL LETTER OMEGA WITH TONOS' where ujis=0x8FA6FC;
-update t1 set name='U+0402 CYRILLIC CAPITAL LETTER DJE' where ujis=0x8FA7C2;
-update t1 set name='U+0403 CYRILLIC CAPITAL LETTER GJE' where ujis=0x8FA7C3;
-update t1 set name='U+0404 CYRILLIC CAPITAL LETTER UKRAINIAN IE' where ujis=0x8FA7C4;
-update t1 set name='U+0405 CYRILLIC CAPITAL LETTER DZE' where ujis=0x8FA7C5;
-update t1 set name='U+0406 CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I' where ujis=0x8FA7C6;
-update t1 set name='U+0407 CYRILLIC CAPITAL LETTER YI' where ujis=0x8FA7C7;
-update t1 set name='U+0408 CYRILLIC CAPITAL LETTER JE' where ujis=0x8FA7C8;
-update t1 set name='U+0409 CYRILLIC CAPITAL LETTER LJE' where ujis=0x8FA7C9;
-update t1 set name='U+040A CYRILLIC CAPITAL LETTER NJE' where ujis=0x8FA7CA;
-update t1 set name='U+040B CYRILLIC CAPITAL LETTER TSHE' where ujis=0x8FA7CB;
-update t1 set name='U+040C CYRILLIC CAPITAL LETTER KJE' where ujis=0x8FA7CC;
-update t1 set name='U+040E CYRILLIC CAPITAL LETTER SHORT U' where ujis=0x8FA7CD;
-update t1 set name='U+040F CYRILLIC CAPITAL LETTER DZHE' where ujis=0x8FA7CE;
-update t1 set name='U+0452 CYRILLIC SMALL LETTER DJE' where ujis=0x8FA7F2;
-update t1 set name='U+0453 CYRILLIC SMALL LETTER GJE' where ujis=0x8FA7F3;
-update t1 set name='U+0454 CYRILLIC SMALL LETTER UKRAINIAN IE' where ujis=0x8FA7F4;
-update t1 set name='U+0455 CYRILLIC SMALL LETTER DZE' where ujis=0x8FA7F5;
-update t1 set name='U+0456 CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I' where ujis=0x8FA7F6;
-update t1 set name='U+0457 CYRILLIC SMALL LETTER YI' where ujis=0x8FA7F7;
-update t1 set name='U+0458 CYRILLIC SMALL LETTER JE' where ujis=0x8FA7F8;
-update t1 set name='U+0459 CYRILLIC SMALL LETTER LJE' where ujis=0x8FA7F9;
-update t1 set name='U+045A CYRILLIC SMALL LETTER NJE' where ujis=0x8FA7FA;
-update t1 set name='U+045B CYRILLIC SMALL LETTER TSHE' where ujis=0x8FA7FB;
-update t1 set name='U+045C CYRILLIC SMALL LETTER KJE' where ujis=0x8FA7FC;
-update t1 set name='U+045E CYRILLIC SMALL LETTER SHORT U' where ujis=0x8FA7FD;
-update t1 set name='U+045F CYRILLIC SMALL LETTER DZHE' where ujis=0x8FA7FE;
-update t1 set name='U+00C6 LATIN CAPITAL LIGATURE AE' where ujis=0x8FA9A1;
-update t1 set name='U+0110 LATIN CAPITAL LETTER D WITH STROKE' where ujis=0x8FA9A2;
-update t1 set name='U+0126 LATIN CAPITAL LETTER H WITH STROKE' where ujis=0x8FA9A4;
-update t1 set name='U+0132 LATIN CAPITAL LIGATURE IJ' where ujis=0x8FA9A6;
-update t1 set name='U+0141 LATIN CAPITAL LETTER L WITH STROKE' where ujis=0x8FA9A8;
-update t1 set name='U+013F LATIN CAPITAL LETTER L WITH MIDDLE DOT' where ujis=0x8FA9A9;
-update t1 set name='U+014A LATIN CAPITAL LETTER ENG' where ujis=0x8FA9AB;
-update t1 set name='U+00D8 LATIN CAPITAL LETTER O WITH STROKE' where ujis=0x8FA9AC;
-update t1 set name='U+0152 LATIN CAPITAL LIGATURE OE' where ujis=0x8FA9AD;
-update t1 set name='U+0166 LATIN CAPITAL LETTER T WITH STROKE' where ujis=0x8FA9AF;
-update t1 set name='U+00DE LATIN CAPITAL LETTER THORN' where ujis=0x8FA9B0;
-update t1 set name='U+00E6 LATIN SMALL LIGATURE AE' where ujis=0x8FA9C1;
-update t1 set name='U+0111 LATIN SMALL LETTER D WITH STROKE' where ujis=0x8FA9C2;
-update t1 set name='U+00F0 LATIN SMALL LETTER ETH' where ujis=0x8FA9C3;
-update t1 set name='U+0127 LATIN SMALL LETTER H WITH STROKE' where ujis=0x8FA9C4;
-update t1 set name='U+0131 LATIN SMALL LETTER DOTLESS I' where ujis=0x8FA9C5;
-update t1 set name='U+0133 LATIN SMALL LIGATURE IJ' where ujis=0x8FA9C6;
-update t1 set name='U+0138 LATIN SMALL LETTER KRA' where ujis=0x8FA9C7;
-update t1 set name='U+0142 LATIN SMALL LETTER L WITH STROKE' where ujis=0x8FA9C8;
-update t1 set name='U+0140 LATIN SMALL LETTER L WITH MIDDLE DOT' where ujis=0x8FA9C9;
-update t1 set name='U+0149 LATIN SMALL LETTER N PRECEDED BY APOSTROPHE' where ujis=0x8FA9CA;
-update t1 set name='U+014B LATIN SMALL LETTER ENG' where ujis=0x8FA9CB;
-update t1 set name='U+00F8 LATIN SMALL LETTER O WITH STROKE' where ujis=0x8FA9CC;
-update t1 set name='U+0153 LATIN SMALL LIGATURE OE' where ujis=0x8FA9CD;
-update t1 set name='U+00DF LATIN SMALL LETTER SHARP S' where ujis=0x8FA9CE;
-update t1 set name='U+0167 LATIN SMALL LETTER T WITH STROKE' where ujis=0x8FA9CF;
-update t1 set name='U+00FE LATIN SMALL LETTER THORN' where ujis=0x8FA9D0;
-update t1 set name='U+00C1 LATIN CAPITAL LETTER A WITH ACUTE' where ujis=0x8FAAA1;
-update t1 set name='U+00C0 LATIN CAPITAL LETTER A WITH GRAVE' where ujis=0x8FAAA2;
-update t1 set name='U+00C4 LATIN CAPITAL LETTER A WITH DIAERESIS' where ujis=0x8FAAA3;
-update t1 set name='U+00C2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX' where ujis=0x8FAAA4;
-update t1 set name='U+0102 LATIN CAPITAL LETTER A WITH BREVE' where ujis=0x8FAAA5;
-update t1 set name='U+01CD LATIN CAPITAL LETTER A WITH CARON' where ujis=0x8FAAA6;
-update t1 set name='U+0100 LATIN CAPITAL LETTER A WITH MACRON' where ujis=0x8FAAA7;
-update t1 set name='U+0104 LATIN CAPITAL LETTER A WITH OGONEK' where ujis=0x8FAAA8;
-update t1 set name='U+00C5 LATIN CAPITAL LETTER A WITH RING ABOVE' where ujis=0x8FAAA9;
-update t1 set name='U+00C3 LATIN CAPITAL LETTER A WITH TILDE' where ujis=0x8FAAAA;
-update t1 set name='U+0106 LATIN CAPITAL LETTER C WITH ACUTE' where ujis=0x8FAAAB;
-update t1 set name='U+0108 LATIN CAPITAL LETTER C WITH CIRCUMFLEX' where ujis=0x8FAAAC;
-update t1 set name='U+010C LATIN CAPITAL LETTER C WITH CARON' where ujis=0x8FAAAD;
-update t1 set name='U+00C7 LATIN CAPITAL LETTER C WITH CEDILLA' where ujis=0x8FAAAE;
-update t1 set name='U+010A LATIN CAPITAL LETTER C WITH DOT ABOVE' where ujis=0x8FAAAF;
-update t1 set name='U+010E LATIN CAPITAL LETTER D WITH CARON' where ujis=0x8FAAB0;
-update t1 set name='U+00C9 LATIN CAPITAL LETTER E WITH ACUTE' where ujis=0x8FAAB1;
-update t1 set name='U+00C8 LATIN CAPITAL LETTER E WITH GRAVE' where ujis=0x8FAAB2;
-update t1 set name='U+00CB LATIN CAPITAL LETTER E WITH DIAERESIS' where ujis=0x8FAAB3;
-update t1 set name='U+00CA LATIN CAPITAL LETTER E WITH CIRCUMFLEX' where ujis=0x8FAAB4;
-update t1 set name='U+011A LATIN CAPITAL LETTER E WITH CARON' where ujis=0x8FAAB5;
-update t1 set name='U+0116 LATIN CAPITAL LETTER E WITH DOT ABOVE' where ujis=0x8FAAB6;
-update t1 set name='U+0112 LATIN CAPITAL LETTER E WITH MACRON' where ujis=0x8FAAB7;
-update t1 set name='U+0118 LATIN CAPITAL LETTER E WITH OGONEK' where ujis=0x8FAAB8;
-update t1 set name='U+011C LATIN CAPITAL LETTER G WITH CIRCUMFLEX' where ujis=0x8FAABA;
-update t1 set name='U+011E LATIN CAPITAL LETTER G WITH BREVE' where ujis=0x8FAABB;
-update t1 set name='U+0122 LATIN CAPITAL LETTER G WITH CEDILLA' where ujis=0x8FAABC;
-update t1 set name='U+0120 LATIN CAPITAL LETTER G WITH DOT ABOVE' where ujis=0x8FAABD;
-update t1 set name='U+0124 LATIN CAPITAL LETTER H WITH CIRCUMFLEX' where ujis=0x8FAABE;
-update t1 set name='U+00CD LATIN CAPITAL LETTER I WITH ACUTE' where ujis=0x8FAABF;
-update t1 set name='U+00CC LATIN CAPITAL LETTER I WITH GRAVE' where ujis=0x8FAAC0;
-update t1 set name='U+00CF LATIN CAPITAL LETTER I WITH DIAERESIS' where ujis=0x8FAAC1;
-update t1 set name='U+00CE LATIN CAPITAL LETTER I WITH CIRCUMFLEX' where ujis=0x8FAAC2;
-update t1 set name='U+01CF LATIN CAPITAL LETTER I WITH CARON' where ujis=0x8FAAC3;
-update t1 set name='U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE' where ujis=0x8FAAC4;
-update t1 set name='U+012A LATIN CAPITAL LETTER I WITH MACRON' where ujis=0x8FAAC5;
-update t1 set name='U+012E LATIN CAPITAL LETTER I WITH OGONEK' where ujis=0x8FAAC6;
-update t1 set name='U+0128 LATIN CAPITAL LETTER I WITH TILDE' where ujis=0x8FAAC7;
-update t1 set name='U+0134 LATIN CAPITAL LETTER J WITH CIRCUMFLEX' where ujis=0x8FAAC8;
-update t1 set name='U+0136 LATIN CAPITAL LETTER K WITH CEDILLA' where ujis=0x8FAAC9;
-update t1 set name='U+0139 LATIN CAPITAL LETTER L WITH ACUTE' where ujis=0x8FAACA;
-update t1 set name='U+013D LATIN CAPITAL LETTER L WITH CARON' where ujis=0x8FAACB;
-update t1 set name='U+013B LATIN CAPITAL LETTER L WITH CEDILLA' where ujis=0x8FAACC;
-update t1 set name='U+0143 LATIN CAPITAL LETTER N WITH ACUTE' where ujis=0x8FAACD;
-update t1 set name='U+0147 LATIN CAPITAL LETTER N WITH CARON' where ujis=0x8FAACE;
-update t1 set name='U+0145 LATIN CAPITAL LETTER N WITH CEDILLA' where ujis=0x8FAACF;
-update t1 set name='U+00D1 LATIN CAPITAL LETTER N WITH TILDE' where ujis=0x8FAAD0;
-update t1 set name='U+00D3 LATIN CAPITAL LETTER O WITH ACUTE' where ujis=0x8FAAD1;
-update t1 set name='U+00D2 LATIN CAPITAL LETTER O WITH GRAVE' where ujis=0x8FAAD2;
-update t1 set name='U+00D6 LATIN CAPITAL LETTER O WITH DIAERESIS' where ujis=0x8FAAD3;
-update t1 set name='U+00D4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX' where ujis=0x8FAAD4;
-update t1 set name='U+01D1 LATIN CAPITAL LETTER O WITH CARON' where ujis=0x8FAAD5;
-update t1 set name='U+0150 LATIN CAPITAL LETTER O WITH DOUBLE ACUTE' where ujis=0x8FAAD6;
-update t1 set name='U+014C LATIN CAPITAL LETTER O WITH MACRON' where ujis=0x8FAAD7;
-update t1 set name='U+00D5 LATIN CAPITAL LETTER O WITH TILDE' where ujis=0x8FAAD8;
-update t1 set name='U+0154 LATIN CAPITAL LETTER R WITH ACUTE' where ujis=0x8FAAD9;
-update t1 set name='U+0158 LATIN CAPITAL LETTER R WITH CARON' where ujis=0x8FAADA;
-update t1 set name='U+0156 LATIN CAPITAL LETTER R WITH CEDILLA' where ujis=0x8FAADB;
-update t1 set name='U+015A LATIN CAPITAL LETTER S WITH ACUTE' where ujis=0x8FAADC;
-update t1 set name='U+015C LATIN CAPITAL LETTER S WITH CIRCUMFLEX' where ujis=0x8FAADD;
-update t1 set name='U+0160 LATIN CAPITAL LETTER S WITH CARON' where ujis=0x8FAADE;
-update t1 set name='U+015E LATIN CAPITAL LETTER S WITH CEDILLA' where ujis=0x8FAADF;
-update t1 set name='U+0164 LATIN CAPITAL LETTER T WITH CARON' where ujis=0x8FAAE0;
-update t1 set name='U+0162 LATIN CAPITAL LETTER T WITH CEDILLA' where ujis=0x8FAAE1;
-update t1 set name='U+00DA LATIN CAPITAL LETTER U WITH ACUTE' where ujis=0x8FAAE2;
-update t1 set name='U+00D9 LATIN CAPITAL LETTER U WITH GRAVE' where ujis=0x8FAAE3;
-update t1 set name='U+00DC LATIN CAPITAL LETTER U WITH DIAERESIS' where ujis=0x8FAAE4;
-update t1 set name='U+00DB LATIN CAPITAL LETTER U WITH CIRCUMFLEX' where ujis=0x8FAAE5;
-update t1 set name='U+016C LATIN CAPITAL LETTER U WITH BREVE' where ujis=0x8FAAE6;
-update t1 set name='U+01D3 LATIN CAPITAL LETTER U WITH CARON' where ujis=0x8FAAE7;
-update t1 set name='U+0170 LATIN CAPITAL LETTER U WITH DOUBLE ACUTE' where ujis=0x8FAAE8;
-update t1 set name='U+016A LATIN CAPITAL LETTER U WITH MACRON' where ujis=0x8FAAE9;
-update t1 set name='U+0172 LATIN CAPITAL LETTER U WITH OGONEK' where ujis=0x8FAAEA;
-update t1 set name='U+016E LATIN CAPITAL LETTER U WITH RING ABOVE' where ujis=0x8FAAEB;
-update t1 set name='U+0168 LATIN CAPITAL LETTER U WITH TILDE' where ujis=0x8FAAEC;
-update t1 set name='U+01D7 LATIN CAPITAL LETTER U WITH DIAERESIS AND ACUTE' where ujis=0x8FAAED;
-update t1 set name='U+01DB LATIN CAPITAL LETTER U WITH DIAERESIS AND GRAVE' where ujis=0x8FAAEE;
-update t1 set name='U+01D9 LATIN CAPITAL LETTER U WITH DIAERESIS AND CARON' where ujis=0x8FAAEF;
-update t1 set name='U+01D5 LATIN CAPITAL LETTER U WITH DIAERESIS AND MACRON' where ujis=0x8FAAF0;
-update t1 set name='U+0174 LATIN CAPITAL LETTER W WITH CIRCUMFLEX' where ujis=0x8FAAF1;
-update t1 set name='U+00DD LATIN CAPITAL LETTER Y WITH ACUTE' where ujis=0x8FAAF2;
-update t1 set name='U+0178 LATIN CAPITAL LETTER Y WITH DIAERESIS' where ujis=0x8FAAF3;
-update t1 set name='U+0176 LATIN CAPITAL LETTER Y WITH CIRCUMFLEX' where ujis=0x8FAAF4;
-update t1 set name='U+0179 LATIN CAPITAL LETTER Z WITH ACUTE' where ujis=0x8FAAF5;
-update t1 set name='U+017D LATIN CAPITAL LETTER Z WITH CARON' where ujis=0x8FAAF6;
-update t1 set name='U+017B LATIN CAPITAL LETTER Z WITH DOT ABOVE' where ujis=0x8FAAF7;
-update t1 set name='U+00E1 LATIN SMALL LETTER A WITH ACUTE' where ujis=0x8FABA1;
-update t1 set name='U+00E0 LATIN SMALL LETTER A WITH GRAVE' where ujis=0x8FABA2;
-update t1 set name='U+00E4 LATIN SMALL LETTER A WITH DIAERESIS' where ujis=0x8FABA3;
-update t1 set name='U+00E2 LATIN SMALL LETTER A WITH CIRCUMFLEX' where ujis=0x8FABA4;
-update t1 set name='U+0103 LATIN SMALL LETTER A WITH BREVE' where ujis=0x8FABA5;
-update t1 set name='U+01CE LATIN SMALL LETTER A WITH CARON' where ujis=0x8FABA6;
-update t1 set name='U+0101 LATIN SMALL LETTER A WITH MACRON' where ujis=0x8FABA7;
-update t1 set name='U+0105 LATIN SMALL LETTER A WITH OGONEK' where ujis=0x8FABA8;
-update t1 set name='U+00E5 LATIN SMALL LETTER A WITH RING ABOVE' where ujis=0x8FABA9;
-update t1 set name='U+00E3 LATIN SMALL LETTER A WITH TILDE' where ujis=0x8FABAA;
-update t1 set name='U+0107 LATIN SMALL LETTER C WITH ACUTE' where ujis=0x8FABAB;
-update t1 set name='U+0109 LATIN SMALL LETTER C WITH CIRCUMFLEX' where ujis=0x8FABAC;
-update t1 set name='U+010D LATIN SMALL LETTER C WITH CARON' where ujis=0x8FABAD;
-update t1 set name='U+00E7 LATIN SMALL LETTER C WITH CEDILLA' where ujis=0x8FABAE;
-update t1 set name='U+010B LATIN SMALL LETTER C WITH DOT ABOVE' where ujis=0x8FABAF;
-update t1 set name='U+010F LATIN SMALL LETTER D WITH CARON' where ujis=0x8FABB0;
-update t1 set name='U+00E9 LATIN SMALL LETTER E WITH ACUTE' where ujis=0x8FABB1;
-update t1 set name='U+00E8 LATIN SMALL LETTER E WITH GRAVE' where ujis=0x8FABB2;
-update t1 set name='U+00EB LATIN SMALL LETTER E WITH DIAERESIS' where ujis=0x8FABB3;
-update t1 set name='U+00EA LATIN SMALL LETTER E WITH CIRCUMFLEX' where ujis=0x8FABB4;
-update t1 set name='U+011B LATIN SMALL LETTER E WITH CARON' where ujis=0x8FABB5;
-update t1 set name='U+0117 LATIN SMALL LETTER E WITH DOT ABOVE' where ujis=0x8FABB6;
-update t1 set name='U+0113 LATIN SMALL LETTER E WITH MACRON' where ujis=0x8FABB7;
-update t1 set name='U+0119 LATIN SMALL LETTER E WITH OGONEK' where ujis=0x8FABB8;
-update t1 set name='U+01F5 LATIN SMALL LETTER G WITH ACUTE' where ujis=0x8FABB9;
-update t1 set name='U+011D LATIN SMALL LETTER G WITH CIRCUMFLEX' where ujis=0x8FABBA;
-update t1 set name='U+011F LATIN SMALL LETTER G WITH BREVE' where ujis=0x8FABBB;
-update t1 set name='U+0121 LATIN SMALL LETTER G WITH DOT ABOVE' where ujis=0x8FABBD;
-update t1 set name='U+0125 LATIN SMALL LETTER H WITH CIRCUMFLEX' where ujis=0x8FABBE;
-update t1 set name='U+00ED LATIN SMALL LETTER I WITH ACUTE' where ujis=0x8FABBF;
-update t1 set name='U+00EC LATIN SMALL LETTER I WITH GRAVE' where ujis=0x8FABC0;
-update t1 set name='U+00EF LATIN SMALL LETTER I WITH DIAERESIS' where ujis=0x8FABC1;
-update t1 set name='U+00EE LATIN SMALL LETTER I WITH CIRCUMFLEX' where ujis=0x8FABC2;
-update t1 set name='U+01D0 LATIN SMALL LETTER I WITH CARON' where ujis=0x8FABC3;
-update t1 set name='U+012B LATIN SMALL LETTER I WITH MACRON' where ujis=0x8FABC5;
-update t1 set name='U+012F LATIN SMALL LETTER I WITH OGONEK' where ujis=0x8FABC6;
-update t1 set name='U+0129 LATIN SMALL LETTER I WITH TILDE' where ujis=0x8FABC7;
-update t1 set name='U+0135 LATIN SMALL LETTER J WITH CIRCUMFLEX' where ujis=0x8FABC8;
-update t1 set name='U+0137 LATIN SMALL LETTER K WITH CEDILLA' where ujis=0x8FABC9;
-update t1 set name='U+013A LATIN SMALL LETTER L WITH ACUTE' where ujis=0x8FABCA;
-update t1 set name='U+013E LATIN SMALL LETTER L WITH CARON' where ujis=0x8FABCB;
-update t1 set name='U+013C LATIN SMALL LETTER L WITH CEDILLA' where ujis=0x8FABCC;
-update t1 set name='U+0144 LATIN SMALL LETTER N WITH ACUTE' where ujis=0x8FABCD;
-update t1 set name='U+0148 LATIN SMALL LETTER N WITH CARON' where ujis=0x8FABCE;
-update t1 set name='U+0146 LATIN SMALL LETTER N WITH CEDILLA' where ujis=0x8FABCF;
-update t1 set name='U+00F1 LATIN SMALL LETTER N WITH TILDE' where ujis=0x8FABD0;
-update t1 set name='U+00F3 LATIN SMALL LETTER O WITH ACUTE' where ujis=0x8FABD1;
-update t1 set name='U+00F2 LATIN SMALL LETTER O WITH GRAVE' where ujis=0x8FABD2;
-update t1 set name='U+00F6 LATIN SMALL LETTER O WITH DIAERESIS' where ujis=0x8FABD3;
-update t1 set name='U+00F4 LATIN SMALL LETTER O WITH CIRCUMFLEX' where ujis=0x8FABD4;
-update t1 set name='U+01D2 LATIN SMALL LETTER O WITH CARON' where ujis=0x8FABD5;
-update t1 set name='U+0151 LATIN SMALL LETTER O WITH DOUBLE ACUTE' where ujis=0x8FABD6;
-update t1 set name='U+014D LATIN SMALL LETTER O WITH MACRON' where ujis=0x8FABD7;
-update t1 set name='U+00F5 LATIN SMALL LETTER O WITH TILDE' where ujis=0x8FABD8;
-update t1 set name='U+0155 LATIN SMALL LETTER R WITH ACUTE' where ujis=0x8FABD9;
-update t1 set name='U+0159 LATIN SMALL LETTER R WITH CARON' where ujis=0x8FABDA;
-update t1 set name='U+0157 LATIN SMALL LETTER R WITH CEDILLA' where ujis=0x8FABDB;
-update t1 set name='U+015B LATIN SMALL LETTER S WITH ACUTE' where ujis=0x8FABDC;
-update t1 set name='U+015D LATIN SMALL LETTER S WITH CIRCUMFLEX' where ujis=0x8FABDD;
-update t1 set name='U+0161 LATIN SMALL LETTER S WITH CARON' where ujis=0x8FABDE;
-update t1 set name='U+015F LATIN SMALL LETTER S WITH CEDILLA' where ujis=0x8FABDF;
-update t1 set name='U+0165 LATIN SMALL LETTER T WITH CARON' where ujis=0x8FABE0;
-update t1 set name='U+0163 LATIN SMALL LETTER T WITH CEDILLA' where ujis=0x8FABE1;
-update t1 set name='U+00FA LATIN SMALL LETTER U WITH ACUTE' where ujis=0x8FABE2;
-update t1 set name='U+00F9 LATIN SMALL LETTER U WITH GRAVE' where ujis=0x8FABE3;
-update t1 set name='U+00FC LATIN SMALL LETTER U WITH DIAERESIS' where ujis=0x8FABE4;
-update t1 set name='U+00FB LATIN SMALL LETTER U WITH CIRCUMFLEX' where ujis=0x8FABE5;
-update t1 set name='U+016D LATIN SMALL LETTER U WITH BREVE' where ujis=0x8FABE6;
-update t1 set name='U+01D4 LATIN SMALL LETTER U WITH CARON' where ujis=0x8FABE7;
-update t1 set name='U+0171 LATIN SMALL LETTER U WITH DOUBLE ACUTE' where ujis=0x8FABE8;
-update t1 set name='U+016B LATIN SMALL LETTER U WITH MACRON' where ujis=0x8FABE9;
-update t1 set name='U+0173 LATIN SMALL LETTER U WITH OGONEK' where ujis=0x8FABEA;
-update t1 set name='U+016F LATIN SMALL LETTER U WITH RING ABOVE' where ujis=0x8FABEB;
-update t1 set name='U+0169 LATIN SMALL LETTER U WITH TILDE' where ujis=0x8FABEC;
-update t1 set name='U+01D8 LATIN SMALL LETTER U WITH DIAERESIS AND ACUTE' where ujis=0x8FABED;
-update t1 set name='U+01DC LATIN SMALL LETTER U WITH DIAERESIS AND GRAVE' where ujis=0x8FABEE;
-update t1 set name='U+01DA LATIN SMALL LETTER U WITH DIAERESIS AND CARON' where ujis=0x8FABEF;
-update t1 set name='U+01D6 LATIN SMALL LETTER U WITH DIAERESIS AND MACRON' where ujis=0x8FABF0;
-update t1 set name='U+0175 LATIN SMALL LETTER W WITH CIRCUMFLEX' where ujis=0x8FABF1;
-update t1 set name='U+00FD LATIN SMALL LETTER Y WITH ACUTE' where ujis=0x8FABF2;
-update t1 set name='U+00FF LATIN SMALL LETTER Y WITH DIAERESIS' where ujis=0x8FABF3;
-update t1 set name='U+0177 LATIN SMALL LETTER Y WITH CIRCUMFLEX' where ujis=0x8FABF4;
-update t1 set name='U+017A LATIN SMALL LETTER Z WITH ACUTE' where ujis=0x8FABF5;
-update t1 set name='U+017E LATIN SMALL LETTER Z WITH CARON' where ujis=0x8FABF6;
-update t1 set name='U+017C LATIN SMALL LETTER Z WITH DOT ABOVE' where ujis=0x8FABF7;
-
-# [8F][B0..BF][A1..FE] - all 16*94=1504 codes assigned
-update t1 set name='<CJK>' where ujis >= 0x8FB0A1 AND ujis <= 0x8FBFFE;
-
-# [8F][C0..CF][A1..FE] - all 16*94=1504 codes assigned
-update t1 set name='<CJK>' where ujis >= 0x8FC0A1 AND ujis <= 0x8FCFFE;
-
-# [8F][D0..DF][A1..FE] - all 16*94=1504 codes assigned
-update t1 set name='<CJK>' where ujis >= 0x8FD0A1 AND ujis <= 0x8FDFFE;
-
-# [8F][E0..EC][A1..FE] - all 13*94=1222 codes assigned
-update t1 set name='<CJK>' where ujis >= 0x8FE0A1 AND ujis <= 0x8FECFE;
-
-#
-update t1 set name='U+9EF8 <CJK>' where ujis=0x8FEDA1;
-update t1 set name='U+9EFF <CJK>' where ujis=0x8FEDA2;
-update t1 set name='U+9F02 <CJK>' where ujis=0x8FEDA3;
-update t1 set name='U+9F03 <CJK>' where ujis=0x8FEDA4;
-update t1 set name='U+9F09 <CJK>' where ujis=0x8FEDA5;
-update t1 set name='U+9F0F <CJK>' where ujis=0x8FEDA6;
-update t1 set name='U+9F10 <CJK>' where ujis=0x8FEDA7;
-update t1 set name='U+9F11 <CJK>' where ujis=0x8FEDA8;
-update t1 set name='U+9F12 <CJK>' where ujis=0x8FEDA9;
-update t1 set name='U+9F14 <CJK>' where ujis=0x8FEDAA;
-update t1 set name='U+9F16 <CJK>' where ujis=0x8FEDAB;
-update t1 set name='U+9F17 <CJK>' where ujis=0x8FEDAC;
-update t1 set name='U+9F19 <CJK>' where ujis=0x8FEDAD;
-update t1 set name='U+9F1A <CJK>' where ujis=0x8FEDAE;
-update t1 set name='U+9F1B <CJK>' where ujis=0x8FEDAF;
-
-update t1 set name='U+9F1F <CJK>' where ujis=0x8FEDB0;
-update t1 set name='U+9F22 <CJK>' where ujis=0x8FEDB1;
-update t1 set name='U+9F26 <CJK>' where ujis=0x8FEDB2;
-update t1 set name='U+9F2A <CJK>' where ujis=0x8FEDB3;
-update t1 set name='U+9F2B <CJK>' where ujis=0x8FEDB4;
-update t1 set name='U+9F2F <CJK>' where ujis=0x8FEDB5;
-update t1 set name='U+9F31 <CJK>' where ujis=0x8FEDB6;
-update t1 set name='U+9F32 <CJK>' where ujis=0x8FEDB7;
-update t1 set name='U+9F34 <CJK>' where ujis=0x8FEDB8;
-update t1 set name='U+9F37 <CJK>' where ujis=0x8FEDB9;
-update t1 set name='U+9F39 <CJK>' where ujis=0x8FEDBA;
-update t1 set name='U+9F3A <CJK>' where ujis=0x8FEDBB;
-update t1 set name='U+9F3C <CJK>' where ujis=0x8FEDBC;
-update t1 set name='U+9F3D <CJK>' where ujis=0x8FEDBD;
-update t1 set name='U+9F3F <CJK>' where ujis=0x8FEDBE;
-update t1 set name='U+9F41 <CJK>' where ujis=0x8FEDBF;
-
-update t1 set name='U+9F43 <CJK>' where ujis=0x8FEDC0;
-update t1 set name='U+9F44 <CJK>' where ujis=0x8FEDC1;
-update t1 set name='U+9F45 <CJK>' where ujis=0x8FEDC2;
-update t1 set name='U+9F46 <CJK>' where ujis=0x8FEDC3;
-update t1 set name='U+9F47 <CJK>' where ujis=0x8FEDC4;
-update t1 set name='U+9F53 <CJK>' where ujis=0x8FEDC5;
-update t1 set name='U+9F55 <CJK>' where ujis=0x8FEDC6;
-update t1 set name='U+9F56 <CJK>' where ujis=0x8FEDC7;
-update t1 set name='U+9F57 <CJK>' where ujis=0x8FEDC8;
-update t1 set name='U+9F58 <CJK>' where ujis=0x8FEDC9;
-update t1 set name='U+9F5A <CJK>' where ujis=0x8FEDCA;
-update t1 set name='U+9F5D <CJK>' where ujis=0x8FEDCB;
-update t1 set name='U+9F5E <CJK>' where ujis=0x8FEDCC;
-update t1 set name='U+9F68 <CJK>' where ujis=0x8FEDCD;
-update t1 set name='U+9F69 <CJK>' where ujis=0x8FEDCE;
-update t1 set name='U+9F6D <CJK>' where ujis=0x8FEDCF;
-
-update t1 set name='U+9F6E <CJK>' where ujis=0x8FEDD0;
-update t1 set name='U+9F6F <CJK>' where ujis=0x8FEDD1;
-update t1 set name='U+9F70 <CJK>' where ujis=0x8FEDD2;
-update t1 set name='U+9F71 <CJK>' where ujis=0x8FEDD3;
-update t1 set name='U+9F73 <CJK>' where ujis=0x8FEDD4;
-update t1 set name='U+9F75 <CJK>' where ujis=0x8FEDD5;
-update t1 set name='U+9F7A <CJK>' where ujis=0x8FEDD6;
-update t1 set name='U+9F7D <CJK>' where ujis=0x8FEDD7;
-update t1 set name='U+9F8F <CJK>' where ujis=0x8FEDD8;
-update t1 set name='U+9F90 <CJK>' where ujis=0x8FEDD9;
-update t1 set name='U+9F91 <CJK>' where ujis=0x8FEDDA;
-update t1 set name='U+9F92 <CJK>' where ujis=0x8FEDDB;
-update t1 set name='U+9F94 <CJK>' where ujis=0x8FEDDC;
-update t1 set name='U+9F96 <CJK>' where ujis=0x8FEDDD;
-update t1 set name='U+9F97 <CJK>' where ujis=0x8FEDDE;
-update t1 set name='U+9F9E <CJK>' where ujis=0x8FEDDF;
-
-update t1 set name='U+9FA1 <CJK>' where ujis=0x8FEDE0;
-update t1 set name='U+9FA2 <CJK>' where ujis=0x8FEDE1;
-update t1 set name='U+9FA3 <CJK>' where ujis=0x8FEDE2;
-update t1 set name='U+9FA5 <CJK>' where ujis=0x8FEDE3;
-
-# [8F][F5..FE][A1..FE] - User defined range
-update t1 set name='User defined range #2' where ujis >= 0x8FF5A1 and ujis <= 0x8FFEFE;
-
-# Other characters are not assigned
-update t1 set name='UNASSIGNED' where name='';
-
-update ignore t1 set ucs2=ujis, ujis2=ucs2;
---echo Characters with safe Unicode round trip
-select hex(ujis), hex(ucs2), hex(ujis2), name from t1 where ujis=ujis2 order by ujis;
---echo Characters with unsafe Unicode round trip
-select hex(ujis), hex(ucs2), hex(ujis2), name from t1 where ujis<>ujis2 order by ujis;
-drop table t1;
-
-drop table t2;
-
-#
-# Tricky characters, which have different mapping
-# in various euc-jp versions. See WL#1820 for details.
-#
-create table t1 (
- ujis varchar(1) character set ujis,
- name varchar(64),
- ucs2 varchar(1) character set ucs2,
- ujis2 varchar(1) character set ujis
-);
-insert into t1 (ujis,name) values (0x5C, 'U+005C REVERSE SOLIDUS');
-insert into t1 (ujis,name) values (0x7E, 'U+007E TILDE');
-insert into t1 (ujis,name) values (0xA1B1, 'U+FFE3 FULLWIDTH MACRON');
-insert into t1 (ujis,name) values (0xA1BD, 'U+2015 HORIZONTAL BAR');
-insert into t1 (ujis,name) values (0xA1C0, 'U+005C REVERSE SOLIDUS');
-insert into t1 (ujis,name) values (0xA1C1, 'U+301C WAVE DASH');
-insert into t1 (ujis,name) values (0xA1C2, 'U+2016 DOUBLE VERTICAL LINE');
-insert into t1 (ujis,name) values (0xA1DD, 'U+2212 MINUS SIGN');
-insert into t1 (ujis,name) values (0xA1F1, 'U+00A2 CENT SIGN');
-insert into t1 (ujis,name) values (0xA1F2, 'U+00A3 POUND SIGN');
-insert into t1 (ujis,name) values (0xA1EF, 'U+FFE5 FULLWIDTH YEN SIGN');
-insert into t1 (ujis,name) values (0xA2CC, 'U+00AC NOT SIGN');
-insert into t1 (ujis,name) values (0x8FA2B7, 'U+007E TILDE');
-insert into t1 (ujis,name) values (0x8FA2C3, 'U+00A6 BROKEN BAR');
-update t1 set ucs2=ujis, ujis2=ucs2;
-select hex(ujis), hex(ucs2), hex(ujis2), name from t1;
-drop table t1;
-
-#
-# Unicode characters which are not in x-eucjp-unicode-0.9
-#
-create table t1 (
- ujis char(1) character set ujis,
- ucs2 char(1) character set ucs2,
- name char(64)
-);
-insert into t1 (ucs2,name) values (0x00A5,'U+00A5 YEN SIGN');
-insert into t1 (ucs2,name) values (0x2014,'U+2014 EM DASH');
-insert into t1 (ucs2,name) values (0x203E,'U+203E OVERLINE');
-insert into t1 (ucs2,name) values (0x2225,'U+2225 PARALLEL TO');
-insert into t1 (ucs2,name) values (0xFF0D,'U+FF0D FULLWIDTH HYPHEN-MINUS');
-insert into t1 (ucs2,name) values (0xFF3C,'U+FF3C FULLWIDTH REVERSE SOLIDUS');
-insert into t1 (ucs2,name) values (0xFF5E,'U+FF5E FULLWIDTH TILDE');
-insert into t1 (ucs2,name) values (0xFFE0,'U+FFE0 FULLWIDTH CENT SIGN');
-insert into t1 (ucs2,name) values (0xFFE1,'U+FFE1 FULLWIDTH POUND SIGN');
-insert into t1 (ucs2,name) values (0xFFE2,'U+FFE2 FULLWIDTH NOT SIGN');
-insert into t1 (ucs2,name) values (0xFFE4,'U+FFE4 FULLWIDTH BROKEN BAR');
-update ignore t1 set ujis=ucs2;
-select hex(ucs2),hex(ujis),name from t1 order by name;
-drop table t1;
-
---echo End of 5.1 tests
diff --git a/mysql-test/t/ctype_upgrade.test b/mysql-test/t/ctype_upgrade.test
deleted file mode 100644
index 62567c5afe4..00000000000
--- a/mysql-test/t/ctype_upgrade.test
+++ /dev/null
@@ -1,199 +0,0 @@
--- source include/mysql_upgrade_preparation.inc
--- source include/have_innodb.inc
-
-call mtr.add_suppression("Table rebuild required");
-let $MYSQLD_DATADIR= `select @@datadir`;
-
---echo #
---echo # Upgrade from Maria-5.3.13:
---echo # Checking utf8_croatian_ci in a VARCHAR column
---echo #
-
---echo # Copying maria050313_utf8_croatian_ci.* to MYSQLD_DATADIR
---copy_file std_data/ctype_upgrade/maria050313_utf8_croatian_ci.frm $MYSQLD_DATADIR/test/maria050313_utf8_croatian_ci.frm
---copy_file std_data/ctype_upgrade/maria050313_utf8_croatian_ci.MYD $MYSQLD_DATADIR/test/maria050313_utf8_croatian_ci.MYD
---copy_file std_data/ctype_upgrade/maria050313_utf8_croatian_ci.MYI $MYSQLD_DATADIR/test/maria050313_utf8_croatian_ci.MYI
-# Following test should show that table is corrupted
-CHECK TABLE maria050313_utf8_croatian_ci FOR UPGRADE;
---error ER_TABLE_NEEDS_REBUILD
-SHOW CREATE TABLE maria050313_utf8_croatian_ci;
-# Check that REPAIR fixes the table
-REPAIR TABLE maria050313_utf8_croatian_ci;
-CHECK TABLE maria050313_utf8_croatian_ci FOR UPGRADE;
-SHOW CREATE TABLE maria050313_utf8_croatian_ci;
-SELECT count(*) FROM maria050313_utf8_croatian_ci;
-DROP TABLE maria050313_utf8_croatian_ci;
-
---echo # Copying maria050313_utf8_croatian_ci.* to MYSQLD_DATADIR
---copy_file std_data/ctype_upgrade/maria050313_utf8_croatian_ci.frm $MYSQLD_DATADIR/test/maria050313_utf8_croatian_ci.frm
---copy_file std_data/ctype_upgrade/maria050313_utf8_croatian_ci.MYD $MYSQLD_DATADIR/test/maria050313_utf8_croatian_ci.MYD
---copy_file std_data/ctype_upgrade/maria050313_utf8_croatian_ci.MYI $MYSQLD_DATADIR/test/maria050313_utf8_croatian_ci.MYI
-ALTER TABLE maria050313_utf8_croatian_ci FORCE;
-SHOW CREATE TABLE maria050313_utf8_croatian_ci;
-SELECT GROUP_CONCAT(a ORDER BY BINARY a) FROM maria050313_utf8_croatian_ci GROUP BY a;
-DROP TABLE maria050313_utf8_croatian_ci;
-
-
---echo #
---echo # Upgrade from Maria-5.3.13:
---echo # Checking ucs2_croatian_ci in the table default collation
---echo #
-
---echo # Copying maria050313_ucs2_croatian_ci.* to MYSQLD_DATADIR
---copy_file std_data/ctype_upgrade/maria050313_ucs2_croatian_ci_def.frm $MYSQLD_DATADIR/test/maria050313_ucs2_croatian_ci_def.frm
---copy_file std_data/ctype_upgrade/maria050313_ucs2_croatian_ci_def.MYD $MYSQLD_DATADIR/test/maria050313_ucs2_croatian_ci_def.MYD
---copy_file std_data/ctype_upgrade/maria050313_ucs2_croatian_ci_def.MYI $MYSQLD_DATADIR/test/maria050313_ucs2_croatian_ci_def.MYI
-CHECK TABLE maria050313_ucs2_croatian_ci_def FOR UPGRADE;
---error ER_TABLE_NEEDS_REBUILD
-SELECT count(*) FROM maria050313_ucs2_croatian_ci_def;
-REPAIR TABLE maria050313_ucs2_croatian_ci_def;
-SHOW CREATE TABLE maria050313_ucs2_croatian_ci_def;
-DROP TABLE maria050313_ucs2_croatian_ci_def;
-
---echo # Copying maria050313_ucs2_croatian_ci.* to MYSQLD_DATADIR
---copy_file std_data/ctype_upgrade/maria050313_ucs2_croatian_ci_def.frm $MYSQLD_DATADIR/test/maria050313_ucs2_croatian_ci_def.frm
---copy_file std_data/ctype_upgrade/maria050313_ucs2_croatian_ci_def.MYD $MYSQLD_DATADIR/test/maria050313_ucs2_croatian_ci_def.MYD
---copy_file std_data/ctype_upgrade/maria050313_ucs2_croatian_ci_def.MYI $MYSQLD_DATADIR/test/maria050313_ucs2_croatian_ci_def.MYI
-CHECK TABLE maria050313_ucs2_croatian_ci_def;
-REPAIR TABLE maria050313_ucs2_croatian_ci_def;
-CHECK TABLE maria050313_ucs2_croatian_ci_def;
-SHOW CREATE TABLE maria050313_ucs2_croatian_ci_def;
-SELECT * FROM maria050313_ucs2_croatian_ci_def ORDER BY a;
-DROP TABLE maria050313_ucs2_croatian_ci_def;
-
-
-
---echo #
---echo # Upgrade from Maria-5.5.33
---echo # Checking utf8_croatian_ci, utf8mb4_croatian_ci, ucs2_croatian_ci,
---echo # utf16_croatian_ci, utf32_croatian_ci
---echo #
-
---echo # Copying maria050533_xxx_croatian_ci.* to MYSQLD_DATADIR
---copy_file std_data/ctype_upgrade/maria050533_xxx_croatian_ci.frm $MYSQLD_DATADIR/test/maria050533_xxx_croatian_ci.frm
---copy_file std_data/ctype_upgrade/maria050533_xxx_croatian_ci.MYD $MYSQLD_DATADIR/test/maria050533_xxx_croatian_ci.MYD
---copy_file std_data/ctype_upgrade/maria050533_xxx_croatian_ci.MYI $MYSQLD_DATADIR/test/maria050533_xxx_croatian_ci.MYI
-CHECK TABLE maria050533_xxx_croatian_ci FOR UPGRADE;
-REPAIR TABLE maria050533_xxx_croatian_ci;
-SHOW CREATE TABLE maria050533_xxx_croatian_ci;
-SELECT count(*) FROM maria050533_xxx_croatian_ci;
-DROP TABLE maria050533_xxx_croatian_ci;
-
---echo # Copying maria050533_xxx_croatian_ci.* to MYSQLD_DATADIR
---copy_file std_data/ctype_upgrade/maria050533_xxx_croatian_ci.frm $MYSQLD_DATADIR/test/maria050533_xxx_croatian_ci.frm
---copy_file std_data/ctype_upgrade/maria050533_xxx_croatian_ci.MYD $MYSQLD_DATADIR/test/maria050533_xxx_croatian_ci.MYD
---copy_file std_data/ctype_upgrade/maria050533_xxx_croatian_ci.MYI $MYSQLD_DATADIR/test/maria050533_xxx_croatian_ci.MYI
-ALTER TABLE maria050533_xxx_croatian_ci FORCE;
-SHOW CREATE TABLE maria050533_xxx_croatian_ci;
-SELECT GROUP_CONCAT(a ORDER BY BINARY a) FROM maria050533_xxx_croatian_ci GROUP BY a;
-SELECT GROUP_CONCAT(b ORDER BY BINARY b) FROM maria050533_xxx_croatian_ci GROUP BY b;
-SELECT GROUP_CONCAT(c ORDER BY BINARY c) FROM maria050533_xxx_croatian_ci GROUP BY c;
-SELECT GROUP_CONCAT(d ORDER BY BINARY d) FROM maria050533_xxx_croatian_ci GROUP BY d;
-SELECT GROUP_CONCAT(e ORDER BY BINARY e) FROM maria050533_xxx_croatian_ci GROUP BY e;
-DROP TABLE maria050533_xxx_croatian_ci;
-
-
---echo #
---echo # Upgrade from Maria-10.0.4
---echo # Checking utf8_croatian_ci, utf8mb4_croatian_ci, ucs2_croatian_ci,
---echo # utf16_croatian_ci, utf32_croatian_ci
---echo #
-
---echo # Copying maria100004_xxx_croatian_ci.* to MYSQLD_DATADIR
---copy_file std_data/ctype_upgrade/maria100004_xxx_croatian_ci.frm $MYSQLD_DATADIR/test/maria100004_xxx_croatian_ci.frm
---copy_file std_data/ctype_upgrade/maria100004_xxx_croatian_ci.MYD $MYSQLD_DATADIR/test/maria100004_xxx_croatian_ci.MYD
---copy_file std_data/ctype_upgrade/maria100004_xxx_croatian_ci.MYI $MYSQLD_DATADIR/test/maria100004_xxx_croatian_ci.MYI
-CHECK TABLE maria100004_xxx_croatian_ci FOR UPGRADE;
---error ER_TABLE_NEEDS_REBUILD
-SELECT count(*) FROM maria100004_xxx_croatian_ci;
-REPAIR TABLE maria100004_xxx_croatian_ci;
-SHOW CREATE TABLE maria100004_xxx_croatian_ci;
-DROP TABLE maria100004_xxx_croatian_ci;
-
---echo # Copying maria100004_xxx_croatian_ci.* to MYSQLD_DATADIR
---copy_file std_data/ctype_upgrade/maria100004_xxx_croatian_ci.frm $MYSQLD_DATADIR/test/maria100004_xxx_croatian_ci.frm
---copy_file std_data/ctype_upgrade/maria100004_xxx_croatian_ci.MYD $MYSQLD_DATADIR/test/maria100004_xxx_croatian_ci.MYD
---copy_file std_data/ctype_upgrade/maria100004_xxx_croatian_ci.MYI $MYSQLD_DATADIR/test/maria100004_xxx_croatian_ci.MYI
-ALTER TABLE maria100004_xxx_croatian_ci FORCE;
-SHOW CREATE TABLE maria100004_xxx_croatian_ci;
-SELECT GROUP_CONCAT(a ORDER BY BINARY a) FROM maria100004_xxx_croatian_ci GROUP BY a;
-SELECT GROUP_CONCAT(b ORDER BY BINARY b) FROM maria100004_xxx_croatian_ci GROUP BY b;
-SELECT GROUP_CONCAT(c ORDER BY BINARY c) FROM maria100004_xxx_croatian_ci GROUP BY c;
-SELECT GROUP_CONCAT(d ORDER BY BINARY d) FROM maria100004_xxx_croatian_ci GROUP BY d;
-SELECT GROUP_CONCAT(e ORDER BY BINARY e) FROM maria100004_xxx_croatian_ci GROUP BY e;
-DROP TABLE maria100004_xxx_croatian_ci;
-
-
-
---echo #
---echo # Upgrade from MySQL-5.6.14
---echo # Checking utf8_croatian_ci, utf8mb4_croatian_ci, ucs2_croatian_ci,
---echo # utf16_croatian_ci, utf32_croatian_ci
---echo #
-
---echo # Copying mysql050614_xxx_croatian_ci.* to MYSQLD_DATADIR
---copy_file std_data/ctype_upgrade/mysql050614_xxx_croatian_ci.frm $MYSQLD_DATADIR/test/mysql050614_xxx_croatian_ci.frm
---copy_file std_data/ctype_upgrade/mysql050614_xxx_croatian_ci.MYD $MYSQLD_DATADIR/test/mysql050614_xxx_croatian_ci.MYD
---copy_file std_data/ctype_upgrade/mysql050614_xxx_croatian_ci.MYI $MYSQLD_DATADIR/test/mysql050614_xxx_croatian_ci.MYI
-CHECK TABLE mysql050614_xxx_croatian_ci FOR UPGRADE;
-SHOW CREATE TABLE mysql050614_xxx_croatian_ci;
-SELECT GROUP_CONCAT(a ORDER BY BINARY a) FROM mysql050614_xxx_croatian_ci GROUP BY a;
-SELECT GROUP_CONCAT(b ORDER BY BINARY b) FROM mysql050614_xxx_croatian_ci GROUP BY b;
-SELECT GROUP_CONCAT(c ORDER BY BINARY c) FROM mysql050614_xxx_croatian_ci GROUP BY c;
-SELECT GROUP_CONCAT(d ORDER BY BINARY d) FROM mysql050614_xxx_croatian_ci GROUP BY d;
-SELECT GROUP_CONCAT(e ORDER BY BINARY e) FROM mysql050614_xxx_croatian_ci GROUP BY e;
-DROP TABLE mysql050614_xxx_croatian_ci;
-
-
---echo #
---echo # Checking mysql_upgrade
---echo #
---copy_file std_data/ctype_upgrade/maria050313_utf8_croatian_ci.frm $MYSQLD_DATADIR/test/maria050313_utf8_croatian_ci.frm
---copy_file std_data/ctype_upgrade/maria050313_utf8_croatian_ci.MYD $MYSQLD_DATADIR/test/maria050313_utf8_croatian_ci.MYD
---copy_file std_data/ctype_upgrade/maria050313_utf8_croatian_ci.MYI $MYSQLD_DATADIR/test/maria050313_utf8_croatian_ci.MYI
-
---copy_file std_data/ctype_upgrade/maria050313_ucs2_croatian_ci_def.frm $MYSQLD_DATADIR/test/maria050313_ucs2_croatian_ci_def.frm
---copy_file std_data/ctype_upgrade/maria050313_ucs2_croatian_ci_def.MYD $MYSQLD_DATADIR/test/maria050313_ucs2_croatian_ci_def.MYD
---copy_file std_data/ctype_upgrade/maria050313_ucs2_croatian_ci_def.MYI $MYSQLD_DATADIR/test/maria050313_ucs2_croatian_ci_def.MYI
-
---copy_file std_data/ctype_upgrade/maria050533_xxx_croatian_ci.frm $MYSQLD_DATADIR/test/maria050533_xxx_croatian_ci.frm
---copy_file std_data/ctype_upgrade/maria050533_xxx_croatian_ci.MYD $MYSQLD_DATADIR/test/maria050533_xxx_croatian_ci.MYD
---copy_file std_data/ctype_upgrade/maria050533_xxx_croatian_ci.MYI $MYSQLD_DATADIR/test/maria050533_xxx_croatian_ci.MYI
-
---copy_file std_data/ctype_upgrade/maria100004_xxx_croatian_ci.frm $MYSQLD_DATADIR/test/maria100004_xxx_croatian_ci.frm
---copy_file std_data/ctype_upgrade/maria100004_xxx_croatian_ci.MYD $MYSQLD_DATADIR/test/maria100004_xxx_croatian_ci.MYD
---copy_file std_data/ctype_upgrade/maria100004_xxx_croatian_ci.MYI $MYSQLD_DATADIR/test/maria100004_xxx_croatian_ci.MYI
-
---copy_file std_data/ctype_upgrade/mysql050614_xxx_croatian_ci.frm $MYSQLD_DATADIR/test/mysql050614_xxx_croatian_ci.frm
---copy_file std_data/ctype_upgrade/mysql050614_xxx_croatian_ci.MYD $MYSQLD_DATADIR/test/mysql050614_xxx_croatian_ci.MYD
---copy_file std_data/ctype_upgrade/mysql050614_xxx_croatian_ci.MYI $MYSQLD_DATADIR/test/mysql050614_xxx_croatian_ci.MYI
-
---echo # Running mysql_upgrade
---exec $MYSQL_UPGRADE 2>&1
-
-
---echo # Running mysql_upgrade for the second time
---echo # This should report OK for all tables
---exec $MYSQL_UPGRADE --force 2>&1
-
-SHOW CREATE TABLE maria050313_ucs2_croatian_ci_def;
-SELECT * FROM maria050313_ucs2_croatian_ci_def ORDER BY a;
-
-SHOW CREATE TABLE maria050313_utf8_croatian_ci;
-SELECT GROUP_CONCAT(a ORDER BY BINARY a) FROM maria050313_utf8_croatian_ci GROUP BY a;
-
-SHOW CREATE TABLE maria050533_xxx_croatian_ci;
-SELECT GROUP_CONCAT(a ORDER BY BINARY a) FROM maria050533_xxx_croatian_ci GROUP BY a;
-
-SHOW CREATE TABLE maria100004_xxx_croatian_ci;
-SELECT GROUP_CONCAT(a ORDER BY BINARY a) FROM maria100004_xxx_croatian_ci GROUP BY a;
-
-SHOW CREATE TABLE mysql050614_xxx_croatian_ci;
-SELECT GROUP_CONCAT(a ORDER BY BINARY a) FROM mysql050614_xxx_croatian_ci GROUP BY a;
-
-remove_file $MYSQLD_DATADIR/mysql_upgrade_info;
-DROP TABLE maria050313_ucs2_croatian_ci_def;
-DROP TABLE maria050313_utf8_croatian_ci;
-DROP TABLE maria050533_xxx_croatian_ci;
-DROP TABLE maria100004_xxx_croatian_ci;
-DROP TABLE mysql050614_xxx_croatian_ci;
diff --git a/mysql-test/t/ctype_utf16.test b/mysql-test/t/ctype_utf16.test
deleted file mode 100644
index 526f5251055..00000000000
--- a/mysql-test/t/ctype_utf16.test
+++ /dev/null
@@ -1,930 +0,0 @@
--- source include/have_utf16.inc
--- source include/have_utf8mb4.inc
-
-
-SET TIME_ZONE='+03:00';
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
---echo #
---echo # Start of 5.5 tests
---echo #
-
-SET NAMES latin1;
-SET character_set_connection=utf16;
-select hex('a'), hex('a ');
--- source include/endspace.inc
-
-
-# Check that incomplete utf16 characters in HEX notation
-# are left-padded with zeros
-#
-select hex(_utf16 0x44);
-select hex(_utf16 0x3344);
-select hex(_utf16 0x113344);
-
-
-# Check that 0x20 is only trimmed when it is
-# a part of real SPACE character, not just a part
-# of a multibyte sequence.
-# Note, CYRILLIC LETTER ER is used as an example, which
-# is stored as 0x0420 in utf16, thus contains 0x20 in the
-# low byte. The second character is THREE-PER-M, U+2004,
-# which contains 0x20 in the high byte.
-
-CREATE TABLE t1 (word VARCHAR(64), word2 CHAR(64)) CHARACTER SET utf16;
-INSERT INTO t1 VALUES (_koi8r 0xF2, _koi8r 0xF2), (X'2004',X'2004');
-SELECT hex(word) FROM t1 ORDER BY word;
-SELECT hex(word2) FROM t1 ORDER BY word2;
-DELETE FROM t1;
-
-#
-# Check that real spaces are correctly trimmed.
-#
-INSERT INTO t1 VALUES (X'042000200020',X'042000200020'), (X'200400200020', X'200400200020');
-SELECT hex(word) FROM t1 ORDER BY word;
-SELECT hex(word2) FROM t1 ORDER BY word2;
-DROP TABLE t1;
-
-
-#
-# Check LPAD/RPAD
-#
-SELECT hex(LPAD(_utf16 X'0420',10,_utf16 X'0421'));
-SELECT hex(LPAD(_utf16 X'0420',10,_utf16 X'04210422'));
-SELECT hex(LPAD(_utf16 X'0420',10,_utf16 X'042104220423'));
-SELECT hex(LPAD(_utf16 X'0420042104220423042404250426042704280429042A042B',10,_utf16 X'042104220423'));
-SELECT hex(LPAD(_utf16 X'D800DC00', 10, _utf16 X'0421'));
-SELECT hex(LPAD(_utf16 X'0421', 10, _utf16 X'D800DC00'));
-
-SELECT hex(RPAD(_utf16 X'0420',10,_utf16 X'0421'));
-SELECT hex(RPAD(_utf16 X'0420',10,_utf16 X'04210422'));
-SELECT hex(RPAD(_utf16 X'0420',10,_utf16 X'042104220423'));
-SELECT hex(RPAD(_utf16 X'0420042104220423042404250426042704280429042A042B',10,_utf16 X'042104220423'));
-SELECT hex(RPAD(_utf16 X'D800DC00', 10, _utf16 X'0421'));
-SELECT hex(RPAD(_utf16 X'0421', 10, _utf16 X'D800DC00'));
-
-CREATE TABLE t1 SELECT
-LPAD(_utf16 X'0420',10,_utf16 X'0421') l,
-RPAD(_utf16 X'0420',10,_utf16 X'0421') r;
-SHOW CREATE TABLE t1;
-select hex(l), hex(r) from t1;
-DROP TABLE t1;
-
-create table t1 (f1 char(30));
-insert into t1 values ("103000"), ("22720000"), ("3401200"), ("78000");
-select lpad(f1, 12, "-o-/") from t1;
-drop table t1;
-
-######################################################
-#
-# Test of like
-#
-
-SET NAMES latin1;
-SET character_set_connection=utf16;
---source include/ctype_like.inc
-
-SET NAMES utf8;
-SET character_set_connection=utf16;
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf16);
-INSERT INTO t1 VALUES ('фыва'),('Фыва'),('фЫва'),('фыВа'),('фывА'),('ФЫВА');
-INSERT INTO t1 VALUES ('фывапролдж'),('Фывапролдж'),('фЫвапролдж'),('фыВапролдж');
-INSERT INTO t1 VALUES ('фывАпролдж'),('фываПролдж'),('фывапРолдж'),('фывапрОлдж');
-INSERT INTO t1 VALUES ('фывапроЛдж'),('фывапролДж'),('фывапролдЖ'),('ФЫВАПРОЛДЖ');
-SELECT * FROM t1 WHERE a LIKE '%фЫва%' ORDER BY BINARY a;
-SELECT * FROM t1 WHERE a LIKE '%фЫв%' ORDER BY BINARY a;
-SELECT * FROM t1 WHERE a LIKE 'фЫва%' ORDER BY BINARY a;
-SELECT * FROM t1 WHERE a LIKE 'фЫва%' COLLATE utf16_bin ORDER BY BINARY a;
-DROP TABLE t1;
-
-CREATE TABLE t1 (word varchar(64) NOT NULL, PRIMARY KEY (word))
-ENGINE=MyISAM CHARACTER SET utf16;
-INSERT INTO t1 (word) VALUES ("cat");
-SELECT * FROM t1 WHERE word LIKE "c%";
-SELECT * FROM t1 WHERE word LIKE "ca_";
-SELECT * FROM t1 WHERE word LIKE "cat";
-SELECT * FROM t1 WHERE word LIKE _utf16 x'00630025'; # "c%"
-SELECT * FROM t1 WHERE word LIKE _utf16 x'00630061005F'; # "ca_"
-DROP TABLE t1;
-
-
-#
-# Check that INSERT() works fine.
-# This invokes charpos() function.
-select insert(_utf16 0x006100620063,10,2,_utf16 0x006400650066);
-select insert(_utf16 0x006100620063,1,2,_utf16 0x006400650066);
-
-########################################################
-#
-# Bug 1264
-#
-# Description:
-#
-# When using a ucs2 table in MySQL,
-# either with ucs2_general_ci or ucs2_bin collation,
-# words are returned in an incorrect order when using ORDER BY
-# on an _indexed_ CHAR or VARCHAR column. They are sorted with
-# the longest word *first* instead of last. I.E. The word "aardvark"
-# is in the results before the word "a".
-#
-# If there is no index for the column, the problem does not occur.
-#
-# Interestingly, if there is no second column, the words are returned
-# in the correct order.
-#
-# According to EXPLAIN, it looks like when the output includes columns that
-# are not part of the index sorted on, it does a filesort, which fails.
-# Using a straight index yields correct results.
-
-SET NAMES latin1;
-
-#
-# Two fields, index
-#
-
-CREATE TABLE t1 (
- word VARCHAR(64),
- bar INT(11) default 0,
- PRIMARY KEY (word))
- ENGINE=MyISAM
- CHARSET utf16
- COLLATE utf16_general_ci ;
-
-INSERT INTO t1 (word) VALUES ("aar");
-INSERT INTO t1 (word) VALUES ("a");
-INSERT INTO t1 (word) VALUES ("aardvar");
-INSERT INTO t1 (word) VALUES ("aardvark");
-INSERT INTO t1 (word) VALUES ("aardvara");
-INSERT INTO t1 (word) VALUES ("aardvarz");
-EXPLAIN SELECT * FROM t1 ORDER BY word;
-SELECT * FROM t1 ORDER BY word;
-EXPLAIN SELECT word FROM t1 ORDER BY word;
-SELECT word FROM t1 ORDER by word;
-DROP TABLE t1;
-
-
-#
-# One field, index
-#
-
-CREATE TABLE t1 (
- word VARCHAR(64) ,
- PRIMARY KEY (word))
- ENGINE=MyISAM
- CHARSET utf16
- COLLATE utf16_general_ci;
-
-INSERT INTO t1 (word) VALUES ("aar");
-INSERT INTO t1 (word) VALUES ("a");
-INSERT INTO t1 (word) VALUES ("aardvar");
-INSERT INTO t1 (word) VALUES ("aardvark");
-INSERT INTO t1 (word) VALUES ("aardvara");
-INSERT INTO t1 (word) VALUES ("aardvarz");
-EXPLAIN SELECT * FROM t1 ORDER BY WORD;
-SELECT * FROM t1 ORDER BY word;
-DROP TABLE t1;
-
-
-#
-# Two fields, no index
-#
-
-CREATE TABLE t1 (
- word TEXT,
- bar INT(11) AUTO_INCREMENT,
- PRIMARY KEY (bar))
- ENGINE=MyISAM
- CHARSET utf16
- COLLATE utf16_general_ci ;
-INSERT INTO t1 (word) VALUES ("aar");
-INSERT INTO t1 (word) VALUES ("a" );
-INSERT INTO t1 (word) VALUES ("aardvar");
-INSERT INTO t1 (word) VALUES ("aardvark");
-INSERT INTO t1 (word) VALUES ("aardvara");
-INSERT INTO t1 (word) VALUES ("aardvarz");
-EXPLAIN SELECT * FROM t1 ORDER BY word;
-SELECT * FROM t1 ORDER BY word;
-EXPLAIN SELECT word FROM t1 ORDER BY word;
-SELECT word FROM t1 ORDER BY word;
-DROP TABLE t1;
-
-#
-# END OF Bug 1264 test
-#
-########################################################
-
-
-#
-# Check alignment for from-binary-conversion with CAST and CONVERT
-#
-SELECT hex(cast(0xAA as char character set utf16));
-SELECT hex(convert(0xAA using utf16));
-
-#
-# Check alignment for string types
-#
-CREATE TABLE t1 (a char(10) character set utf16);
-INSERT INTO t1 VALUES (0x1),(0x11),(0x111),(0x1111),(0x11111);
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a varchar(10) character set utf16);
-INSERT INTO t1 VALUES (0x1),(0x11),(0x111),(0x1111),(0x11111);
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a text character set utf16);
-INSERT INTO t1 VALUES (0x1),(0x11),(0x111),(0x1111),(0x11111);
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a mediumtext character set utf16);
-INSERT INTO t1 VALUES (0x1),(0x11),(0x111),(0x1111),(0x11111);
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a longtext character set utf16);
-INSERT INTO t1 VALUES (0x1),(0x11),(0x111),(0x1111),(0x11111);
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
-##
-## Bug #5024 Server crashes with queries on fields
-## with certain charset/collation settings
-##
-##
-#create table t1 (s1 char character set utf16 collate utf16_czech_ci);
-#insert into t1 values ('0'),('1'),('2'),('a'),('b'),('c');
-#select s1 from t1 where s1 > 'a' order by s1;
-#drop table t1;
-#
-
-#
-# Bug #5081 : UCS2 fields are filled with '0x2020'
-# after extending field length
-#
-create table t1(a char(1)) default charset utf16;
-insert into t1 values ('a'),('b'),('c');
-alter table t1 modify a char(5);
-select a, hex(a) from t1;
-drop table t1;
-
-#
-# Check prepare statement from an UTF16 string
-#
-set @ivar= 1234;
-set @str1 = 'select ?';
-set @str2 = convert(@str1 using utf16);
-prepare stmt1 from @str2;
-execute stmt1 using @ivar;
-
-#
-# Check that utf16 works with ENUM and SET type
-#
-set names utf8;
-create table t1 (a enum('x','y','z') character set utf16);
-show create table t1;
-insert into t1 values ('x');
-insert into t1 values ('y');
-insert into t1 values ('z');
-select a, hex(a) from t1 order by a;
-alter table t1 change a a enum('x','y','z','d','e','ä','ö','ü') character set utf16;
-show create table t1;
-insert into t1 values ('D');
-insert into t1 values ('E ');
-insert into t1 values ('ä');
-insert into t1 values ('ö');
-insert into t1 values ('ü');
-select a, hex(a) from t1 order by a;
-drop table t1;
-
-create table t1 (a set ('x','y','z','ä','ö','ü') character set utf16);
-show create table t1;
-insert into t1 values ('x');
-insert into t1 values ('y');
-insert into t1 values ('z');
-insert into t1 values ('x,y');
-insert into t1 values ('x,y,z,ä,ö,ü');
-select a, hex(a) from t1 order by a;
-drop table t1;
-
-#
-# Bug#7302 UCS2 data in ENUM fields get truncated when new column is added
-#
-create table t1(a enum('a','b','c')) default character set utf16;
-insert into t1 values('a'),('b'),('c');
-alter table t1 add b char(1);
-show warnings;
-select * from t1 order by a;
-drop table t1;
-
-SET NAMES latin1;
-SET collation_connection='utf16_general_ci';
--- source include/ctype_filesort.inc
--- source include/ctype_like_escape.inc
-SET NAMES latin1;
-SET collation_connection='utf16_bin';
--- source include/ctype_filesort.inc
--- source include/ctype_filesort2.inc
--- source include/ctype_like_escape.inc
-
-#
-# Bug#10344 Some string functions fail for UCS2
-#
-select hex(substr(_utf16 0x00e400e50068,1));
-select hex(substr(_utf16 0x00e400e50068,2));
-select hex(substr(_utf16 0x00e400e50068,3));
-select hex(substr(_utf16 0x00e400e50068,-1));
-select hex(substr(_utf16 0x00e400e50068,-2));
-select hex(substr(_utf16 0x00e400e50068,-3));
-select hex(substr(_utf16 0x00e400e5D800DC00,1));
-select hex(substr(_utf16 0x00e400e5D800DC00,2));
-select hex(substr(_utf16 0x00e400e5D800DC00,3));
-select hex(substr(_utf16 0x00e400e5D800DC00,-1));
-select hex(substr(_utf16 0x00e400e5D800DC00,-2));
-select hex(substr(_utf16 0x00e400e5D800DC00,-3));
-
-SET NAMES latin1;
-
-##
-## Bug#8235
-##
-## This bug also helped to find another problem that
-## INSERT of a UCS2 string containing a negative number
-## into a unsigned int column didn't produce warnings.
-## This test covers both problems.
-##
-##SET collation_connection='ucs2_swedish_ci';
-##CREATE TABLE t1 (Field1 int(10) default '0');
-### no warnings, negative numbers are allowed
-##INSERT INTO t1 VALUES ('-1');
-##SELECT * FROM t1;
-##DROP TABLE t1;
-##CREATE TABLE t1 (Field1 int(10) unsigned default '0');
-### this should generate a "Data truncated" warning
-##INSERT INTO t1 VALUES ('-1');
-##DROP TABLE t1;
-##SET NAMES latin1;
-
-###
-### Bug #14583 Bug on query using a LIKE on indexed field with ucs2_bin collation
-###
-##--disable_warnings
-##create table t1(f1 varchar(5) CHARACTER SET utf16 COLLATE utf16_bin NOT NULL) engine=InnoDB;
-##--enable_warnings
-##insert into t1 values('a');
-##create index t1f1 on t1(f1);
-##select f1 from t1 where f1 like 'a%';
-##drop table t1;
-
-#
-# Bug#9442 Set parameter make query fail if column character set is UCS2
-#
-create table t1 (utext varchar(20) character set utf16);
-insert into t1 values ("lily");
-insert into t1 values ("river");
-prepare stmt from 'select utext from t1 where utext like ?';
-set @param1='%%';
-execute stmt using @param1;
-execute stmt using @param1;
-select utext from t1 where utext like '%%';
-drop table t1;
-deallocate prepare stmt;
-
-#
-# Bug#22052 Trailing spaces are not removed from UNICODE fields in an index
-#
-create table t1 (
- a char(10) character set utf16 not null,
- index a (a)
-) engine=myisam;
-insert into t1 values (repeat(0x201f, 10));
-insert into t1 values (repeat(0x2020, 10));
-insert into t1 values (repeat(0x2021, 10));
-# make sure "index read" is used
-explain select hex(a) from t1 order by a;
-select hex(a) from t1 order by a;
-alter table t1 drop index a;
-select hex(a) from t1 order by a;
-drop table t1;
-
-##
-## Bug #20076: server crashes for a query with GROUP BY if MIN/MAX aggregation
-## over a 'ucs2' field uses a temporary table
-##
-##CREATE TABLE t1 (id int, s char(5) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci);
-##INSERT INTO t1 VALUES (1, 'ZZZZZ'), (1, 'ZZZ'), (2, 'ZZZ'), (2, 'ZZZZZ');
-##SELECT id, MIN(s) FROM t1 GROUP BY id;
-##DROP TABLE t1;
-
-###
-### Bug #20536: md5() with GROUP BY and UCS2 return different results on myisam/innodb
-###
-##
-##--disable_warnings
-##drop table if exists bug20536;
-##--enable_warnings
-##
-##set names latin1;
-##create table bug20536 (id bigint not null auto_increment primary key, name
-##varchar(255) character set ucs2 not null);
-##insert into `bug20536` (`id`,`name`) values (1, _latin1 x'7465737431'), (2, "'test\\_2'");
-##select md5(name) from bug20536;
-##select sha1(name) from bug20536;
-##select make_set(3, name, upper(name)) from bug20536;
-##select export_set(5, name, upper(name)) from bug20536;
-##select export_set(5, name, upper(name), ",", 5) from bug20536;
-
-#
-# Bug #20108: corrupted default enum value for a ucs2 field
-#
-
-CREATE TABLE t1 (
- status enum('active','passive') character set utf16 collate utf16_general_ci
- NOT NULL default 'passive'
-);
-SHOW CREATE TABLE t1;
-ALTER TABLE t1 ADD a int NOT NULL AFTER status;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-##CREATE TABLE t2 (
-## status enum('active','passive') collate ucs2_turkish_ci
-## NOT NULL default 'passive'
-##);
-##SHOW CREATE TABLE t2;
-##ALTER TABLE t2 ADD a int NOT NULL AFTER status;
-##DROP TABLE t2;
-
-
---echo End of 4.1 tests
-
-#
-# Conversion from an UTF16 string to a decimal column
-#
-CREATE TABLE t1 (a varchar(64) character set utf16, b decimal(10,3));
-INSERT INTO t1 VALUES ("1.1", 0), ("2.1", 0);
-update t1 set b=a;
-SELECT *, hex(a) FROM t1;
-DROP TABLE t1;
-
-#
-# Bug#9442 Set parameter make query fail if column character set is UCS2
-#
-create table t1 (utext varchar(20) character set utf16);
-insert into t1 values ("lily");
-insert into t1 values ("river");
-prepare stmt from 'select utext from t1 where utext like ?';
-set @param1='%%';
-execute stmt using @param1;
-execute stmt using @param1;
-select utext from t1 where utext like '%%';
-drop table t1;
-deallocate prepare stmt;
-
-#
-# Bug#22638 SOUNDEX broken for international characters
-#
-set names latin1;
-set character_set_connection=utf16;
-select soundex(''),soundex('he'),soundex('hello all folks'),soundex('#3556 in bugdb');
-select hex(soundex('')),hex(soundex('he')),hex(soundex('hello all folks')),hex(soundex('#3556 in bugdb'));
-select 'mood' sounds like 'mud';
-# Cyrillic A, BE, VE
-select hex(soundex(_utf16 0x041004110412));
-# Make sure that "U+00BF INVERTED QUESTION MARK" is not considered as letter
-select hex(soundex(_utf16 0x00BF00C0));
-set names latin1;
-
-#
-# Bug #14290: character_maximum_length for text fields
-#
-create table t1(a blob, b text charset utf16);
-select data_type, character_octet_length, character_maximum_length
- from information_schema.columns where table_name='t1';
-drop table t1;
-
-
-set names latin1;
-set collation_connection=utf16_general_ci;
-#
-# Testing cs->coll->instr()
-#
-select position('bb' in 'abba');
-
-#
-# Testing cs->coll->hash_sort()
-#
-create table t1 (a varchar(10) character set utf16) engine=heap;
-insert into t1 values ('a'),('A'),('b'),('B');
-select * from t1 where a='a' order by binary a;
-select hex(min(binary a)),count(*) from t1 group by a;
-drop table t1;
-
-#
-# Testing cs->cset->numchars()
-#
-select char_length('abcd'), octet_length('abcd');
-select char_length(_utf16 0xD800DC00), octet_length(_utf16 0xD800DC00);
-select char_length(_utf16 0xD87FDFFF), octet_length(_utf16 0xD87FDFFF);
-
-#
-# Testing cs->cset->charpos()
-#
-select left('abcd',2);
-select hex(left(_utf16 0xD800DC00D87FDFFF, 1));
-select hex(right(_utf16 0xD800DC00D87FDFFF, 1));
-
-#
-# Testing cs->cset->well_formed_length()
-#
-create table t1 (a varchar(10) character set utf16);
-# Bad sequences
---error ER_INVALID_CHARACTER_STRING
-insert into t1 values (_utf16 0xD800);
---error ER_INVALID_CHARACTER_STRING
-insert into t1 values (_utf16 0xDC00);
---error ER_INVALID_CHARACTER_STRING
-insert into t1 values (_utf16 0xD800D800);
---error ER_INVALID_CHARACTER_STRING
-insert into t1 values (_utf16 0xD800E800);
---error ER_INVALID_CHARACTER_STRING
-insert into t1 values (_utf16 0xD8000800);
-# Good sequences
-insert into t1 values (_utf16 0xD800DC00);
-insert into t1 values (_utf16 0xD800DCFF);
-insert into t1 values (_utf16 0xDBFFDC00);
-insert into t1 values (_utf16 0xDBFFDCFF);
-select hex(a) from t1;
-drop table t1;
-
-#
-# Bug#32393 Character sets: illegal characters in utf16 columns
-#
-# Tests that cs->cset->wc_mb() doesn't accept surrogate parts
-#
-# via alter
-#
-create table t1 (s1 varchar(50) character set ucs2);
-insert into t1 values (0xdf84);
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-alter table t1 modify column s1 varchar(50) character set utf16;
-select hex(s1) from t1;
-drop table t1;
-#
-# via update
-#
-create table t1 (s1 varchar(5) character set ucs2, s2 varchar(5) character set utf16);
-insert into t1 (s1) values (0xdf84);
-update ignore t1 set s2 = s1;
-select hex(s2) from t1;
-drop table t1;
-
-
-
-#
-# Testing cs->cset->lengthsp()
-#
-create table t1 (a char(10)) character set utf16;
-insert into t1 values ('a ');
-select hex(a) from t1;
-drop table t1;
-
-#
-# Testing cs->cset->caseup() and cs->cset->casedn()
-#
-select upper('abcd'), lower('ABCD');
-
-#
-# TODO: str_to_datetime() is broken and doesn't work with ucs2 and utf16
-# Testing cs->cset->snprintf()
-#
-#create table t1 (a date);
-#insert into t1 values ('2007-09-16');
-#select * from t1;
-#drop table t1;
-
-#
-# Testing cs->cset->l10tostr
-# !!! Not used in the code
-
-#
-# Testing cs->cset->ll10tostr
-#
-create table t1 (a varchar(10) character set utf16);
-insert into t1 values (123456);
-select a, hex(a) from t1;
-drop table t1;
-
-
-# Testing cs->cset->fill
-# SOUNDEX fills strings with DIGIT ZERO up to four characters
-select hex(soundex('a'));
-
-#
-# Testing cs->cset->strntol
-# !!! Not used in the code
-
-#
-# Testing cs->cset->strntoul
-#
-create table t1 (a enum ('a','b','c')) character set utf16;
-insert into t1 values ('1');
-select * from t1;
-drop table t1;
-
-#
-# Testing cs->cset->strntoll and cs->cset->strntoull
-#
-set names latin1;
-select hex(conv(convert('123' using utf16), -10, 16));
-select hex(conv(convert('123' using utf16), 10, 16));
-
-#
-# Testing cs->cset->strntod
-#
-set names latin1;
-set character_set_connection=utf16;
-select 1.1 + '1.2';
-select 1.1 + '1.2xxx';
-
-# Testing strntoll10_utf16
-# Testing cs->cset->strtoll10
-select left('aaa','1');
---source include/ctype_strtoll10.inc
-
-#
-# Testing cs->cset->strntoull10rnd
-#
-create table t1 (a int);
-insert into t1 values ('-1234.1e2');
-insert ignore into t1 values ('-1234.1e2xxxx');
-insert into t1 values ('-1234.1e2 ');
-select * from t1;
-drop table t1;
-
-#
-# Testing cs->cset->scan
-#
-create table t1 (a int);
-insert into t1 values ('1 ');
-insert ignore into t1 values ('1 x');
-select * from t1;
-drop table t1;
-
-#
-# Testing auto-conversion to TEXT
-#
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-create table t1 (a varchar(17000) character set utf16);
-show create table t1;
-drop table t1;
-
-#
-# Testing that maximim possible key length is 1000 bytes
-#
-create table t1 (a varchar(250) character set utf16 primary key);
-show create table t1;
-drop table t1;
---error ER_TOO_LONG_KEY
-create table t1 (a varchar(334) character set utf16 primary key);
-
-#
-# Conversion to utf8
-#
-create table t1 (a char(1) character set utf16);
-insert into t1 values (0xD800DC00),(0xD800DCFF),(0xDB7FDC00),(0xDB7FDCFF);
-insert into t1 values (0x00C0), (0x00FF),(0xE000), (0xFFFF);
-select hex(a), hex(@a:=convert(a using utf8mb4)), hex(convert(@a using utf16)) from t1;
-drop table t1;
-
-#
-# Test basic regex functionality
-#
-set collation_connection=utf16_general_ci;
---source include/ctype_regex.inc
-set names latin1;
-
-#
-# Test how character set works with date/time
-#
-SET collation_connection=utf16_general_ci;
---source include/ctype_datetime.inc
-SET NAMES latin1;
-
-#
-# Bug#33073 Character sets: ordering fails with utf32
-#
-SET collation_connection=utf16_general_ci;
-CREATE TABLE t1 AS SELECT repeat('a',2) as s1 LIMIT 0;
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES ('ab'),('AE'),('ab'),('AE');
-SELECT * FROM t1 ORDER BY s1;
-SET max_sort_length=4;
-SELECT * FROM t1 ORDER BY s1;
-DROP TABLE t1;
-SET max_sort_length=DEFAULT;
-SET NAMES latin1;
-
---echo #
---echo # Bug#52520 Difference in tinytext utf column metadata
---echo #
-CREATE TABLE t1 (
- s1 TINYTEXT CHARACTER SET utf16,
- s2 TEXT CHARACTER SET utf16,
- s3 MEDIUMTEXT CHARACTER SET utf16,
- s4 LONGTEXT CHARACTER SET utf16
-);
---enable_metadata
-SET NAMES utf8, @@character_set_results=NULL;
-SELECT *, HEX(s1) FROM t1;
-SET NAMES latin1;
-SELECT *, HEX(s1) FROM t1;
-SET NAMES utf8;
-SELECT *, HEX(s1) FROM t1;
---disable_metadata
-CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t1, t2;
-
---echo #
---echo # Bug#11753363 (Bug#44793) Character sets: case clause, ucs2 or utf32, failure
---echo #
-SELECT CASE _latin1'a' WHEN _utf16'a' THEN 'A' END;
-SELECT CASE _utf16'a' WHEN _latin1'a' THEN 'A' END;
-CREATE TABLE t1 (s1 CHAR(5) CHARACTER SET utf16);
-INSERT INTO t1 VALUES ('a');
-SELECT CASE s1 WHEN 'a' THEN 'b' ELSE 'c' END FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#12340997
---echo # DATE_ADD/DATE_SUB WITH INTERVAL CRASHES IN GET_INTERVAL_VALUE()
---echo #
-
-SELECT space(date_add(101, INTERVAL CHAR('1' USING utf16) hour_second));
-
-
---echo #
---echo # Bug#11750518 41090: ORDER BY TRUNCATES GROUP_CONCAT RESULT
---echo #
-
-SET NAMES utf8, @@character_set_connection=utf16;
-SET STATEMENT group_concat_max_len=1024 FOR
-SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l
-FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body
-UNION ALL
-SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1
-GROUP BY id
-ORDER BY l DESC;
-
-SET STATEMENT group_concat_max_len=1024 FOR
-SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l
-FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body
-UNION ALL
-SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1;
-
-#
-## TODO: add tests for all engines
-#
-
---echo #
---echo # MDEV-6865 Merge Bug#18935421 RPAD DIES WITH CERTAIN PADSTR INTPUTS..
---echo #
---error ER_INVALID_CHARACTER_STRING
-DO RPAD(_utf16 0x0061 COLLATE utf16_unicode_ci, 10000, 0x0061DE989999);
---error ER_INVALID_CHARACTER_STRING
-DO LPAD(_utf16 0x0061 COLLATE utf16_unicode_ci, 10000, 0x0061DE989999);
-
---echo #
---echo # MDEV-11685: sql_mode can't be set with non-ascii connection charset
---echo #
-SET character_set_connection=utf16;
-SET sql_mode='NO_ENGINE_SUBSTITUTION';
-SELECT @@sql_mode;
-SET sql_mode=DEFAULT;
-SET NAMES utf8;
-
---echo #
---echo # End of 5.5 tests
---echo #
-
-
---echo #
---echo # Start of 5.6 tests
---echo #
-
---echo #
---echo # WL#3664 WEIGHT_STRING
---echo #
-
-set collation_connection=utf16_general_ci;
---source include/weight_string.inc
---source include/weight_string_euro.inc
-select hex(weight_string(_utf16 0xD800DC00));
-select hex(weight_string(_utf16 0xD800DC01));
---source include/weight_string_l1.inc
-
-set collation_connection=utf16_bin;
---source include/weight_string.inc
---source include/weight_string_euro.inc
---source include/weight_string_l1.inc
-
---echo #
---echo # End of 5.6 tests
---echo #
-
---echo #
---echo # Start of 10.0 tests
---echo #
-
---echo #
---echo # MDEV-6661 PI() does not work well in UCS2/UTF16/UTF32 context
---echo #
-SELECT CONCAT(CONVERT('pi=' USING utf16),PI()) AS PI;
-
---echo #
---echo # MDEV-6666 Malformed result for CONCAT(utf8_column, binary_string)
---echo #
-
-SET NAMES utf8mb4;
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf16);
-INSERT INTO t1 VALUES ('a');
---error ER_INVALID_CHARACTER_STRING
-SELECT CONCAT(a,0xD800) FROM t1;
-SELECT CONCAT(a,0xD800DC00) FROM t1;
-SELECT CONCAT(a,0x00FF) FROM t1;
-DROP TABLE t1;
---error ER_INVALID_CHARACTER_STRING
-SELECT CONCAT(_utf16'a' COLLATE utf16_unicode_ci, _binary 0xD800);
-PREPARE stmt FROM "SELECT CONCAT(_utf16'a' COLLATE utf16_unicode_ci, ?)";
-SET @arg00=_binary 0xD800;
---error ER_INVALID_CHARACTER_STRING
-EXECUTE stmt USING @arg00;
-SET @arg00=_binary 0xD800DC00;
-EXECUTE stmt USING @arg00;
-SET @arg00=_binary 0x00FF;
-EXECUTE stmt USING @arg00;
-DEALLOCATE PREPARE stmt;
-
---echo #
---echo # End of 10.0 tests
---echo #
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character"
---echo #
-CREATE TABLE t1 (
- id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
- a VARCHAR(10) CHARACTER SET utf16, KEY(a,id)
-);
-INSERT INTO t1 (a) VALUES (_utf8mb4 0x61);
-INSERT INTO t1 (a) VALUES (_utf8mb4 0xC280),(_utf8mb4 0xDFBF);
-INSERT INTO t1 (a) VALUES (_utf8mb4 0xE0A080),(_utf8mb4 0xEFBFBF);
-INSERT INTO t1 (a) VALUES (_utf8mb4 0xF0908080),(_utf8mb4 0xF48FBFBF);
-SELECT id,HEX(a) FROM t1 ORDER BY a,id;
-SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
-SELECT COUNT(DISTINCT a) FROM t1;
-ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf16 COLLATE utf16_bin;
-SELECT id,HEX(a) FROM t1 ORDER BY a;
-SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
-SELECT COUNT(DISTINCT a) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-9178 Wrong result for CAST(CONVERT('1IJ3' USING utf16) AS SIGNED)
---echo #
-SET NAMES utf8;
-SELECT CAST(CONVERT('1IJ3' USING utf16) AS SIGNED);
-
-
---echo #
---echo # End of 10.1 tests
---echo #
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-9711 NO PAD Collatons
---echo #
-SET character_set_connection=utf16;
-let $coll='utf16_general_nopad_ci';
-let $coll_pad='utf16_general_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='utf16_nopad_bin';
-let $coll_pad='utf16_bin';
---source include/ctype_pad_all_engines.inc
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/ctype_utf16_def-master.opt b/mysql-test/t/ctype_utf16_def-master.opt
deleted file mode 100644
index 55bb5d14bbd..00000000000
--- a/mysql-test/t/ctype_utf16_def-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---character-set-server=utf16,latin1
diff --git a/mysql-test/t/ctype_utf16_def.test b/mysql-test/t/ctype_utf16_def.test
deleted file mode 100644
index 0829cd53285..00000000000
--- a/mysql-test/t/ctype_utf16_def.test
+++ /dev/null
@@ -1,9 +0,0 @@
---source include/have_utf16.inc
-call mtr.add_suppression("'utf16' can not be used as client character set");
-
-#
-# Bug #32391 Character sets: crash with --character-set-server
-#
-SHOW VARIABLES LIKE 'collation_server';
-SHOW VARIABLES LIKE 'character_set_server';
-SHOW VARIABLES LIKE 'ft_stopword_file';
diff --git a/mysql-test/t/ctype_utf16_uca.test b/mysql-test/t/ctype_utf16_uca.test
deleted file mode 100644
index 46d572fbe81..00000000000
--- a/mysql-test/t/ctype_utf16_uca.test
+++ /dev/null
@@ -1,248 +0,0 @@
--- source include/have_ucs2.inc
--- source include/have_utf16.inc
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
---echo #
---echo # Start of 5.5 tests
---echo #
-
-set names utf8;
-set collation_connection=utf16_unicode_ci;
-select hex('a'), hex('a ');
--- source include/endspace.inc
-
-#
-# Bug #6787 LIKE not working properly with _ and utf8 data
-#
-select 'c' like '\_' as want0;
-
-#
-# Bug #5679 utf8_unicode_ci LIKE--trailing % doesn't equal zero characters
-#
-CREATE TABLE t (
- c char(20) NOT NULL
-) ENGINE=MyISAM DEFAULT CHARACTER SET utf16 COLLATE utf16_unicode_ci;
-INSERT INTO t VALUES ('a'),('ab'),('aba');
-ALTER TABLE t ADD INDEX (c);
-SELECT c FROM t WHERE c LIKE 'a%';
-DROP TABLE t;
-
-
-create table t1 (c1 char(10) character set utf16 collate utf16_bin);
-
---source include/ctype_unicode_latin.inc
-
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_unicode_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_icelandic_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_latvian_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_romanian_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_slovenian_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_polish_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_estonian_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_spanish_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_swedish_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_turkish_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_czech_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_danish_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_lithuanian_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_slovak_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_spanish2_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_roman_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_esperanto_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_hungarian_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_croatian_mysql561_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_croatian_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_german2_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_unicode_520_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_vietnamese_ci;
-
-drop table t1;
-
-#
-# Bug#5324
-#
-SET NAMES utf8;
-
-CREATE TABLE t1 (c varchar(200) CHARACTER SET utf16 COLLATE utf16_general_ci NOT NULL, INDEX (c));
-INSERT INTO t1 VALUES (0x039C03C903B403B11F770308);
-#Check one row
-SELECT * FROM t1 WHERE c LIKE _utf16 0x039C0025 COLLATE utf16_general_ci;
-INSERT INTO t1 VALUES (0x039C03C903B4);
-#Check two rows
-SELECT * FROM t1 WHERE c LIKE _utf16 0x039C0025
-COLLATE utf16_general_ci ORDER BY c;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c varchar(200) CHARACTER SET utf16 COLLATE utf16_unicode_ci NOT NULL, INDEX (c));
-INSERT INTO t1 VALUES (0x039C03C903B403B11F770308);
-#Check one row
-SELECT * FROM t1 WHERE c LIKE _utf16 0x039C0025 COLLATE utf16_unicode_ci;
-INSERT INTO t1 VALUES (0x039C03C903B4);
-#Check two rows
-SELECT * FROM t1 WHERE c LIKE _utf16 0x039C0025
-COLLATE utf16_unicode_ci ORDER BY c;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c varchar(200) CHARACTER SET utf16 COLLATE utf16_unicode_ci NOT NULL, INDEX (c));
-INSERT INTO t1 VALUES (0x039C03C903B403B11F770308);
-#Check one row row
-SELECT * FROM t1 WHERE c LIKE _utf16 0x039C0025 COLLATE utf16_unicode_ci;
-INSERT INTO t1 VALUES (0x039C03C903B4);
-#Check two rows
-SELECT * FROM t1 WHERE c LIKE _utf16 0x039C0025
-COLLATE utf16_unicode_ci ORDER BY c;
-DROP TABLE t1;
-
-
-SET NAMES utf8;
-SET @test_character_set='utf16';
-SET @test_collation='utf16_swedish_ci';
--- source include/ctype_common.inc
-
-
-SET collation_connection='utf16_unicode_ci';
--- source include/ctype_filesort.inc
--- source include/ctype_like_escape.inc
--- source include/ctype_german.inc
-
---echo End of 4.1 tests
-
-#
-# Check UPPER/LOWER changing length
-#
-# Result shorter than argument
-CREATE TABLE t1 (id int, a varchar(30) character set utf16);
-INSERT INTO t1 VALUES (1, 0x01310069), (2, 0x01310131);
-INSERT INTO t1 VALUES (3, 0x00690069), (4, 0x01300049);
-INSERT INTO t1 VALUES (5, 0x01300130), (6, 0x00490049);
-SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
-FROM t1 ORDER BY id;
-ALTER TABLE t1 MODIFY a VARCHAR(30) character set utf16 collate utf16_turkish_ci;
-SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
-FROM t1 ORDER BY id;
-DROP TABLE t1;
-
-#
-# Bug #27079 Crash while grouping empty ucs2 strings
-#
-CREATE TABLE t1 (
- c1 text character set utf16 collate utf16_polish_ci NOT NULL
-) ENGINE=MyISAM;
-insert into t1 values (''),('a');
-SELECT COUNT(*), c1 FROM t1 GROUP BY c1;
-DROP TABLE IF EXISTS t1;
-
-
-#
-# Test basic regex functionality
-#
-set collation_connection=utf16_unicode_ci;
---source include/ctype_regex.inc
-
-#
-# Test my_like_range and contractions
-#
-SET collation_connection=utf16_czech_ci;
---source include/ctype_czech.inc
---source include/ctype_like_ignorable.inc
-
-
---echo #
---echo # End of 5.5 tests
---echo #
-
-
-
---echo #
---echo # Start of 5.6 tests
---echo #
-
---echo #
---echo # WL#3664 WEIGHT_STRING
---echo #
-
-set collation_connection=utf16_unicode_ci;
---source include/weight_string.inc
---source include/weight_string_euro.inc
-select hex(weight_string(_utf16 0xD800DC00 collate utf16_unicode_ci));
-select hex(weight_string(_utf16 0xD800DC01 collate utf16_unicode_ci));
---source include/weight_string_l1.inc
-
-set @@collation_connection=utf16_czech_ci;
---source include/weight_string_chde.inc
-
-#
-# WL#4013 Unicode german2 collation
-#
-SET NAMES utf8;
-SET collation_connection=utf16_german2_ci;
---source include/ctype_german.inc
-
---echo #
---echo # WL#2673 Unicode Collation Algorithm new version
---echo #
-SET NAMES utf8mb4;
-SET collation_connection=utf16_unicode_520_ci;
---source include/ctype_unicode520.inc
-
---echo #
---echo # End of 5.6 tests
---echo #
-
-
---echo #
---echo # Start of MariaDB-10.0 tests
---echo #
---echo
-
---echo #
---echo # MDEV-4929 Myanmar collation
---echo #
-SET NAMES utf8;
-SET collation_connection=utf16_myanmar_ci;
---source include/ctype_myanmar.inc
-
---echo #
---echo # End of MariaDB-10.0 tests
---echo #
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
-SET NAMES utf8;
-SET collation_connection=utf16_thai_520_w2;
---source include/ctype_uca_w2.inc
---source include/ctype_thai.inc
-
---echo #
---echo # End of 10.1 tests
---echo #
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-10877 xxx_unicode_nopad_ci collations
---echo #
-SET NAMES utf8, character_set_connection=utf16;
-let $coll='utf16_unicode_nopad_ci';
-let $coll_pad='utf16_unicode_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='utf16_unicode_520_nopad_ci';
-let $coll_pad='utf16_unicode_520_ci';
---source include/ctype_pad_all_engines.inc
-
-SET NAMES utf8, collation_connection=utf16_unicode_520_nopad_ci;
---source include/ctype_like_range_mdev14350.inc
-SET NAMES utf8;
-
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/ctype_utf16le.test b/mysql-test/t/ctype_utf16le.test
deleted file mode 100644
index 79cf875852a..00000000000
--- a/mysql-test/t/ctype_utf16le.test
+++ /dev/null
@@ -1,802 +0,0 @@
--- source include/have_ucs2.inc
--- source include/have_utf16.inc
--- source include/have_utf32.inc
--- source include/have_utf8mb4.inc
-
-
-SET TIME_ZONE='+03:00';
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
---echo #
---echo # Start of 5.6 tests
---echo #
-
-SET NAMES utf8mb4, collation_connection=utf16le_general_ci;
-SELECT HEX('a'), HEX('a ');
--- source include/endspace.inc
-
-
---echo #
---echo # Check that incomplete utf16le characters in HEX notation
---echo # are left-padded with zeros
---echo #
-SELECT HEX(_utf16le 0x44);
-SELECT HEX(_utf16le 0x3344);
-SELECT HEX(_utf16le 0x113344);
-
---echo #
---echo # Check that 0x20 is only trimmed when it is
---echo # a part of real SPACE character, not just a part
---echo # of a multibyte sequence.
---echo # Note, CYRILLIC LETTER ER is used as an example, which
---echo # is stored as 0x0420 in utf16le, thus contains 0x20 in the
---echo # low byte. The second character is THREE-PER-M, U+2004,
---echo # which contains 0x20 in the high byte.
---echo #
-
-CREATE TABLE t1 (word VARCHAR(64), word2 CHAR(64)) CHARACTER SET utf16le;
-INSERT INTO t1 VALUES (_koi8r 0xF2, _koi8r 0xF2), (_ucs2 X'2004',_ucs2 X'2004');
-SELECT HEX(word) FROM t1 ORDER BY word;
-SELECT HEX(word2) FROM t1 ORDER BY word2;
-DELETE FROM t1;
-
---echo #
---echo # Check that real spaces are correctly trimmed.
---echo #
-INSERT INTO t1 VALUES (_ucs2 X'042000200020', _ucs2 X'042000200020');
-INSERT INTO t1 VALUES (_ucs2 X'200400200020', _ucs2 X'200400200020');
-SELECT HEX(word) FROM t1 ORDER BY word;
-SELECT HEX(word2) FROM t1 ORDER BY word2;
-DROP TABLE t1;
-
-
---echo #
---echo # Check LPAD/RPAD
---echo #
-CREATE TABLE t1 (a VARCHAR(10), pad INT, b VARCHAR(10)) CHARACTER SET utf16le;
-INSERT INTO t1 VALUES (_ucs2 X'0420', 10, _ucs2 X'0421');
-INSERT INTO t1 VALUES (_ucs2 X'0420', 10, _ucs2 X'04210422');
-INSERT INTO t1 VALUES (_ucs2 X'0420', 10, _ucs2 X'042104220423');
-INSERT IGNORE INTO t1 VALUES (_ucs2 X'0420042104220423042404250426042704280429042A042B',10,_ucs2 X'042104220423');
-INSERT INTO t1 VALUES (_utf32 X'010000', 10, _ucs2 X'0421');
-INSERT INTO t1 VALUES (_ucs2 X'0421', 10, _utf32 X'010000');
-SELECT a, pad, b, LPAD(a, pad, b), HEX(LPAD(a, pad, b)) FROM t1;
-DROP TABLE t1;
-
-
-CREATE TABLE t1 SELECT
-LPAD(_utf16le X'2004',10,_utf16le X'2104') l,
-RPAD(_utf16le X'2004',10,_utf16le X'2104') r;
-SHOW CREATE TABLE t1;
-SELECT HEX(l), HEX(r) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (f1 CHAR(30));
-INSERT INTO t1 VALUES ("103000"), ("22720000"), ("3401200"), ("78000");
-SELECT LPAD(f1, 12, "-o-/") FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Testing LIKE
---echo #
-
-SET NAMES utf8, collation_connection=utf16le_general_ci;
---source include/ctype_like.inc
-
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf16le);
-INSERT INTO t1 VALUES ('фыва'),('Фыва'),('фЫва'),('фыВа'),('фывА'),('ФЫВА');
-INSERT INTO t1 VALUES ('фывапролдж'),('Фывапролдж'),('фЫвапролдж'),('фыВапролдж');
-INSERT INTO t1 VALUES ('фывАпролдж'),('фываПролдж'),('фывапРолдж'),('фывапрОлдж');
-INSERT INTO t1 VALUES ('фывапроЛдж'),('фывапролДж'),('фывапролдЖ'),('ФЫВАПРОЛДЖ');
-SELECT * FROM t1 WHERE a LIKE '%фЫва%' ORDER BY BINARY a;
-SELECT * FROM t1 WHERE a LIKE '%фЫв%' ORDER BY BINARY a;
-SELECT * FROM t1 WHERE a LIKE 'фЫва%' ORDER BY BINARY a;
-SELECT * FROM t1 WHERE a LIKE 'фЫва%' COLLATE utf16le_bin ORDER BY BINARY a;
-DROP TABLE t1;
-
-CREATE TABLE t1 (word VARCHAR(64) NOT NULL, PRIMARY KEY (word))
-ENGINE=MyISAM CHARACTER SET utf16le;
-INSERT INTO t1 (word) VALUES ("cat");
-SELECT * FROM t1 WHERE word LIKE "c%";
-SELECT * FROM t1 WHERE word LIKE "ca_";
-SELECT * FROM t1 WHERE word LIKE "cat";
-SELECT * FROM t1 WHERE word LIKE _ucs2 x'00630025'; # "c%"
-SELECT * FROM t1 WHERE word LIKE _ucs2 x'00630061005F'; # "ca_"
-DROP TABLE t1;
-
-
---echo #
---echo # Check that INSERT() works fine.
---echo # This invokes charpos() function.
---echo #
-CREATE TABLE t1 (
- a VARCHAR(10) CHARACTER SET utf16le,
- b VARCHAR(10) CHARACTER SET utf16le);
-INSERT INTO t1 VALUES ('abc', 'def');
-SELECT INSERT(a, 10, 2, b) FROM t1;
-SELECT INSERT(a, 1, 2, b) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#1264
---echo #
-# Description:
-#
-# When USING a ucs2 TABLE in MySQL,
-# either with ucs2_general_ci or ucs2_bin collation,
-# words are returned in an incorrect order when USING ORDER BY
-# on an _indexed_ CHAR or VARCHAR column. They are sorted with
-# the longest word *first* instead of last. I.E. The word "aardvark"
-# is in the results before the word "a".
-#
-# If there is no index for the column, the problem does not occur.
-#
-# Interestingly, if there is no second column, the words are returned
-# in the correct order.
-#
-# According to EXPLAIN, it looks like when the output includes columns that
-# are not part of the index sorted on, it does a filesort, which fails.
-# Using a straight index yields correct results.
-
-SET NAMES utf8, collation_connection=utf16le_general_ci;
-
---echo #
---echo # Two fields, index
---echo #
-
-CREATE TABLE t1 (
- word VARCHAR(64),
- bar INT(11) DEFAULT 0,
- PRIMARY KEY (word))
- ENGINE=MyISAM
- CHARSET utf16le
- COLLATE utf16le_general_ci ;
-
-INSERT INTO t1 (word) VALUES ("aar");
-INSERT INTO t1 (word) VALUES ("a");
-INSERT INTO t1 (word) VALUES ("aardvar");
-INSERT INTO t1 (word) VALUES ("aardvark");
-INSERT INTO t1 (word) VALUES ("aardvara");
-INSERT INTO t1 (word) VALUES ("aardvarz");
-EXPLAIN SELECT * FROM t1 ORDER BY word;
-SELECT * FROM t1 ORDER BY word;
-EXPLAIN SELECT word FROM t1 ORDER BY word;
-SELECT word FROM t1 ORDER by word;
-DROP TABLE t1;
-
-
---echo #
---echo # One field, index
---echo #
-
-CREATE TABLE t1 (
- word VARCHAR(64) ,
- PRIMARY KEY (word))
- ENGINE=MyISAM
- CHARSET utf16le
- COLLATE utf16le_general_ci;
-
-INSERT INTO t1 (word) VALUES ("aar");
-INSERT INTO t1 (word) VALUES ("a");
-INSERT INTO t1 (word) VALUES ("aardvar");
-INSERT INTO t1 (word) VALUES ("aardvark");
-INSERT INTO t1 (word) VALUES ("aardvara");
-INSERT INTO t1 (word) VALUES ("aardvarz");
-EXPLAIN SELECT * FROM t1 ORDER BY WORD;
-SELECT * FROM t1 ORDER BY word;
-DROP TABLE t1;
-
-
---echo #
---echo # Two fields, no index
---echo #
-
-CREATE TABLE t1 (
- word TEXT,
- bar INT(11) AUTO_INCREMENT,
- PRIMARY KEY (bar))
- ENGINE=MyISAM
- CHARSET utf16le
- COLLATE utf16le_general_ci ;
-INSERT INTO t1 (word) VALUES ("aar");
-INSERT INTO t1 (word) VALUES ("a" );
-INSERT INTO t1 (word) VALUES ("aardvar");
-INSERT INTO t1 (word) VALUES ("aardvark");
-INSERT INTO t1 (word) VALUES ("aardvara");
-INSERT INTO t1 (word) VALUES ("aardvarz");
-EXPLAIN SELECT * FROM t1 ORDER BY word;
-SELECT * FROM t1 ORDER BY word;
-EXPLAIN SELECT word FROM t1 ORDER BY word;
-SELECT word FROM t1 ORDER BY word;
-DROP TABLE t1;
-
---echo #
---echo # END OF Bug 1264 test
---echo #
-
-
---echo #
---echo # Check alignment for from-binary-conversion with CAST and CONVERT
---echo #
-SELECT HEX(CAST(0xAA as char CHARACTER SET utf16le));
-SELECT HEX(CONVERT(0xAA USING utf16le));
-
---echo #
---echo # Check alignment for string types
---echo #
-CREATE TABLE t1 (a CHAR(10) CHARACTER SET utf16le);
-INSERT INTO t1 VALUES (0x1),(0x11),(0x111),(0x1111),(0x11111);
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf16le);
-INSERT INTO t1 VALUES (0x1),(0x11),(0x111),(0x1111),(0x11111);
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a TEXT CHARACTER SET utf16le);
-INSERT INTO t1 VALUES (0x1),(0x11),(0x111),(0x1111),(0x11111);
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a MEDIUMTEXT CHARACTER SET utf16le);
-INSERT INTO t1 VALUES (0x1),(0x11),(0x111),(0x1111),(0x11111);
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a LONGTEXT CHARACTER SET utf16le);
-INSERT INTO t1 VALUES (0x1),(0x11),(0x111),(0x1111),(0x11111);
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # Bug#5081 : UCS2 fields are filled with '0x2020'
---echo # after extending field length
---echo #
-
-CREATE TABLE t1(a CHAR(1)) DEFAULT CHARSET utf16le;
-INSERT INTO t1 VALUES ('a'),('b'),('c');
-ALTER TABLE t1 MODIFY a CHAR(5);
-SELECT a, HEX(a) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Check prepare statement from an UTF16 string
---echo #
-SET NAMES latin1;
-SET @ivar= 1234;
-SET @str1 = 'SELECT ?';
-SET @str2 = CONVERT(@str1 USING utf16le);
-PREPARE stmt1 FROM @str2;
-EXECUTE stmt1 USING @ivar;
-
---echo #
---echo # Check that utf16le works with ENUM and SET type
---echo #
-SET NAMES utf8, collation_connection=utf16le_general_ci;
-CREATE TABLE t1 (a ENUM('x','y','z') CHARACTER SET utf16le);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES ('x');
-INSERT INTO t1 VALUES ('y');
-INSERT INTO t1 VALUES ('z');
-SELECT a, HEX(a) FROM t1 ORDER BY a;
-ALTER TABLE t1 CHANGE a a ENUM('x','y','z','d','e','ä','ö','ü') CHARACTER SET utf16le;
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES ('D');
-INSERT INTO t1 VALUES ('E ');
-INSERT INTO t1 VALUES ('ä');
-INSERT INTO t1 VALUES ('ö');
-INSERT INTO t1 VALUES ('ü');
-SELECT a, HEX(a) FROM t1 ORDER BY a;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a set ('x','y','z','ä','ö','ü') CHARACTER SET utf16le);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES ('x');
-INSERT INTO t1 VALUES ('y');
-INSERT INTO t1 VALUES ('z');
-INSERT INTO t1 VALUES ('x,y');
-INSERT INTO t1 VALUES ('x,y,z,ä,ö,ü');
-SELECT a, HEX(a) FROM t1 ORDER BY a;
-DROP TABLE t1;
-
---echo #
---echo # Bug#7302 UCS2 data in ENUM fields get truncated when new column is added
---echo #
-CREATE TABLE t1(a ENUM('a','b','c')) DEFAULT CHARACTER SET utf16le;
-INSERT INTO t1 VALUES('a'),('b'),('c');
-ALTER TABLE t1 ADD b CHAR(1);
-SHOW WARNINGS;
-SELECT * FROM t1 ORDER BY a;
-DROP TABLE t1;
-
-SET NAMES utf8, collation_connection='utf16le_general_ci';
--- source include/ctype_filesort.inc
--- source include/ctype_like_escape.inc
-SET NAMES utf8, collation_connection='utf16le_bin';
--- source include/ctype_filesort.inc
--- source include/ctype_filesort2.inc
--- source include/ctype_like_escape.inc
-
---echo #
---echo # Bug#10344 Some string functions fail for UCS2
---echo #
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf16le, pos INT);
-INSERT INTO t1 VALUES (_ucs2 0x00e400e50068,1);
-INSERT INTO t1 VALUES (_ucs2 0x00e400e50068,2);
-INSERT INTO t1 VALUES (_ucs2 0x00e400e50068,3);
-INSERT INTO t1 VALUES (_ucs2 0x00e400e50068,-1);
-INSERT INTO t1 VALUES (_ucs2 0x00e400e50068,-2);
-INSERT INTO t1 VALUES (_ucs2 0x00e400e50068,-3);
-INSERT INTO t1 VALUES (_utf32 0x000000e4000000e500010000, 1);
-INSERT INTO t1 VALUES (_utf32 0x000000e4000000e500010000, 2);
-INSERT INTO t1 VALUES (_utf32 0x000000e4000000e500010000, 3);
-INSERT INTO t1 VALUES (_utf32 0x000000e4000000e500010000, -1);
-INSERT INTO t1 VALUES (_utf32 0x000000e4000000e500010000, -2);
-INSERT INTO t1 VALUES (_utf32 0x000000e4000000e500010000, -3);
-SELECT HEX(SUBSTR(a, pos)), SUBSTR(a, pos) FROM t1;
-DROP TABLE t1;
-
-SET NAMES utf8, collation_connection=utf16le_general_ci;
-
---echo #
---echo # Bug#9442 Set parameter make query fail if column CHARACTER SET is UCS2
---echo #
-CREATE TABLE t1 (utext VARCHAR(20) CHARACTER SET utf16le);
-INSERT INTO t1 VALUES ("lily");
-INSERT INTO t1 VALUES ("river");
-PREPARE stmt FROM 'SELECT utext FROM t1 where utext like ?';
-SET @param1='%%';
-EXECUTE stmt USING @param1;
-EXECUTE stmt USING @param1;
-SELECT utext FROM t1 where utext like '%%';
-DROP TABLE t1;
-DEALLOCATE PREPARE stmt;
-
---echo #
---echo # Bug#22052 Trailing spaces are not removed FROM UNICODE fields in an index
---echo #
-CREATE TABLE t1 (
- a CHAR(10) CHARACTER SET utf16le NOT NULL,
- INDEX a (a)
-) engine=myisam;
-INSERT INTO t1 VALUES (REPEAT(_ucs2 0x201f, 10));
-INSERT INTO t1 VALUES (REPEAT(_ucs2 0x2020, 10));
-INSERT INTO t1 VALUES (REPEAT(_ucs2 0x2021, 10));
---echo # make sure "index read" is used
-explain SELECT HEX(a) FROM t1 ORDER BY a;
-SELECT HEX(a) FROM t1 ORDER BY a;
-ALTER TABLE t1 DROP INDEX a;
-SELECT HEX(a) FROM t1 ORDER BY a;
-DROP TABLE t1;
-
---echo #
---echo # Bug #20108: corrupted default enum value for a ucs2 field
---echo #
-CREATE TABLE t1 (
- status ENUM('active','passive') CHARACTER SET utf16le COLLATE utf16le_general_ci
- NOT NULL DEFAULT 'passive'
-);
-SHOW CREATE TABLE t1;
-ALTER TABLE t1 ADD a int NOT NULL AFTER status;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-
---echo #
---echo # Conversion FROM an UTF16LE string to a decimal column
---echo #
-CREATE TABLE t1 (a VARCHAR(64) CHARACTER SET utf16le, b DECIMAL(10,3));
-INSERT INTO t1 VALUES ("1.1", 0), ("2.1", 0);
-UPDATE t1 set b=a;
-SELECT *, HEX(a) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#9442 Set parameter make query fail if column CHARACTER SET is UCS2
---echo #
-CREATE TABLE t1 (utext VARCHAR(20) CHARACTER SET utf16le);
-INSERT INTO t1 VALUES ("lily");
-INSERT INTO t1 VALUES ("river");
-PREPARE stmt FROM 'SELECT utext FROM t1 where utext like ?';
-SET @param1='%%';
-EXECUTE stmt USING @param1;
-EXECUTE stmt USING @param1;
-SELECT utext FROM t1 where utext like '%%';
-DROP TABLE t1;
-DEALLOCATE PREPARE stmt;
-
---echo #
---echo # Bug#22638 SOUNDEX broken for international characters
---echo #
-SET NAMES utf8, collation_connection=utf16le_general_ci;
-SELECT SOUNDEX(''),SOUNDEX('he'),SOUNDEX('hello all folks'),SOUNDEX('#3556 in bugdb');
-SELECT HEX(SOUNDEX('')),HEX(SOUNDEX('he')),HEX(SOUNDEX('hello all folks')),HEX(SOUNDEX('#3556 in bugdb'));
-SELECT 'mood' sounds like 'mud';
---echo # Cyrillic A, BE, VE
-SELECT HEX(SOUNDEX(_utf16le 0x041004110412));
---echo # Make sure that "U+00BF INVERTED QUESTION MARK" is not considered as letter
-SELECT HEX(SOUNDEX(_utf16le 0x00BF00C0));
-
---echo #
---echo # Bug#14290: character_maximum_length for text fields
---echo #
-CREATE TABLE t1(a BLOB, b TEXT CHARSET utf16le);
-SELECT data_type, character_octet_length, character_maximum_length
- FROM information_schema.columns where table_name='t1';
-DROP TABLE t1;
-
-
-SET NAMES utf8, collation_connection=utf16le_general_ci;
-
---echo #
---echo # Testing cs->coll->instr()
---echo #
-SELECT POSITION('bb' IN 'abba');
-
---echo #
---echo # Testing cs->coll->hash_sort()
---echo #
-SET NAMES utf8, collation_connection=utf16le_bin;
---source include/ctype_heap.inc
-SET NAMES utf8, collation_connection=utf16le_general_ci;
---source include/ctype_heap.inc
-
---echo #
---echo # Testing cs->cset->numchars()
---echo #
-SELECT CHAR_LENGTH('abcd'), OCTET_LENGTH('abcd');
-SELECT CHAR_LENGTH(_utf16le 0x00D800DC), OCTET_LENGTH(_utf16le 0x00D800DC);
-SELECT CHAR_LENGTH(_utf16le 0x7DD8FFDF), OCTET_LENGTH(_utf16le 0x7FD8DDDF);
-
---echo #
---echo # Testing cs->cset->charpos()
---echo #
-SELECT LEFT('abcd',2);
-SELECT HEX(LEFT(_utf16le 0x00D800DC7FD8FFDF, 1));
-SELECT HEX(RIGHT(_utf16le 0x00D800DC7FD8FFDF, 1));
-
---echo #
---echo # Testing cs->cset->well_formed_length()
---echo #
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf16le);
---echo # Bad sequences
---error ER_INVALID_CHARACTER_STRING
-INSERT INTO t1 VALUES (_utf16le 0x00D8);
---error ER_INVALID_CHARACTER_STRING
-INSERT INTO t1 VALUES (_utf16le 0x00DC);
---error ER_INVALID_CHARACTER_STRING
-INSERT INTO t1 VALUES (_utf16le 0x00D800D8);
---error ER_INVALID_CHARACTER_STRING
-INSERT INTO t1 VALUES (_utf16le 0x00D800E8);
---error ER_INVALID_CHARACTER_STRING
-INSERT INTO t1 VALUES (_utf16le 0x00D80008);
---echo # Good sequences
-INSERT INTO t1 VALUES (_utf16le 0x00D800DC);
-INSERT INTO t1 VALUES (_utf16le 0x00D8FFDC);
-INSERT INTO t1 VALUES (_utf16le 0xFFDB00DC);
-INSERT INTO t1 VALUES (_utf16le 0xFFDBFFDC);
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#32393 Character sets: illegal characters in utf16le columns
---echo #
---echo # Tests that cs->cset->wc_mb() doesn't accept surrogate parts
---echo #
---echo # via ALTER
---echo #
-CREATE TABLE t1 (s1 VARCHAR(50) CHARACTER SET ucs2);
-INSERT INTO t1 VALUES (0xDF84);
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-ALTER TABLE t1 MODIFY column s1 VARCHAR(50) CHARACTER SET utf16le;
-SELECT HEX(s1) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # via UPDATE
---echo #
-CREATE TABLE t1 (s1 VARCHAR(5) CHARACTER SET ucs2, s2 VARCHAR(5) CHARACTER SET utf16le);
-INSERT INTO t1 (s1) VALUES (0xdf84);
-UPDATE IGNORE t1 set s2 = s1;
-SELECT HEX(s2) FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # Testing cs->cset->lengthsp()
---echo #
-CREATE TABLE t1 (a CHAR(10)) CHARACTER SET utf16le;
-INSERT INTO t1 VALUES ('a ');
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # Testing cs->cset->caseup() and cs->cset->casedn()
---echo #
-SELECT UPPER('abcd'), LOWER('ABCD');
-
---echo #
---echo # Checking str_to_datetime()
---echo #
-select @@collation_connection;
-CREATE TABLE t1 (a date);
-INSERT INTO t1 VALUES ('2007-09-16');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # Testing cs->cset->ll10tostr
---echo #
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf16le);
-INSERT INTO t1 VALUES (123456);
-SELECT a, HEX(a) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Testing cs->cset->fill
---echo # SOUNDEX fills strings with DIGIT ZERO up to four characters
---echo #
-SELECT SOUNDEX('a'), HEX(SOUNDEX('a'));
-
-
---echo #
---echo # Testing cs->cset->strntoul
---echo #
-CREATE TABLE t1 (a enum ('a','b','c')) CHARACTER SET utf16le;
-INSERT INTO t1 VALUES ('1');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # Testing cs->cset->strntoll and cs->cset->strntoull
---echo #
-SET NAMES latin1;
-SELECT HEX(CONV(CONVERT('123' USING utf16le), -10, 16));
-SELECT HEX(CONV(CONVERT('123' USING utf16le), 10, 16));
-SET NAMES utf8, collation_connection=utf16le_general_ci;
-
-
---echo #
---echo # Testing cs->cset->strntod
---echo #
-SET NAMES utf8, collation_connection=utf16le_general_ci;
-SELECT 1.1 + '1.2';
-SELECT 1.1 + '1.2xxx';
-
-
---echo #
---echo # Testing cs->cset->strtoll10
---echo #
-SELECT LEFT('aaa','1');
-CREATE TABLE t1 AS SELECT REPEAT('abcd', 128) AS a;
-SELECT LEFT(a, '2') FROM t1;
-SELECT LEFT(a, ' \t \t 2') FROM t1;
-SELECT LEFT(a, ' \t \t +2') FROM t1;
-SELECT SUBSTR(a, '-2') FROM t1;
-SELECT SUBSTR(a, ' \t \t -2') FROM t1;
-SELECT LEFT(a, '00002') FROM t1;
-SELECT LEFT(a, ' \t \t 00002') FROM t1;
-SELECT LEFT(a, ' \t \t +00002') FROM t1;
-SELECT SUBSTR(a, '-00002') FROM t1;
-SELECT SUBSTR(a, ' \t \t -00002') FROM t1;
-DROP TABLE t1;
-CREATE TABLE t1 AS SELECT REPEAT('abcd', 128) AS a LIMIT 0;
-INSERT INTO t1 VALUES ('255'), ('65535'),('16777215'),('4294967295'),
-('1099511627775'),('281474976710655'),('72057594037927935'),
-('1844674407370955161'),('18446744073709551614'), ('18446744073709551615');
-SELECT a, CAST(a AS SIGNED), CAST(a AS UNSIGNED) FROM t1;
-UPDATE t1 SET a=CONCAT('-', a);
-SELECT a, CAST(a AS SIGNED) FROM t1;
-DROP TABLE t1;
-
---source include/ctype_strtoll10.inc
-
---echo #
---echo # Testing cs->cset->strntoull10rnd
---echo #
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES ('-1234.1e2');
-INSERT IGNORE INTO t1 VALUES ('-1234.1e2xxxx');
-INSERT INTO t1 VALUES ('-1234.1e2 ');
-INSERT INTO t1 VALUES ('123');
-INSERT INTO t1 VALUES ('-124');
-INSERT INTO t1 VALUES ('+125');
-INSERT INTO t1 VALUES (' \t \t 123');
-INSERT INTO t1 VALUES (' \t \t -124');
-INSERT INTO t1 VALUES (' \t \t +125');
-INSERT INTO t1 VALUES (' \t \t 000123');
-INSERT INTO t1 VALUES (' \t \t -000124');
-INSERT INTO t1 VALUES (' \t \t +000125');
-SELECT * FROM t1;
-DROP TABLE t1;
-CREATE TABLE t1 (a BIGINT UNSIGNED);
-INSERT INTO t1 VALUES ('255'), ('65535'),('16777215'),('4294967295'),
-('1099511627775'),('281474976710655'),('72057594037927935'),
-('1844674407370955161'),('18446744073709551614'), ('18446744073709551615');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # Testing cs->cset->scan
---echo #
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES ('1 ');
-INSERT IGNORE INTO t1 VALUES ('1 x');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # Testing auto-conversion to TEXT
---echo #
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-CREATE TABLE t1 (a VARCHAR(17000) CHARACTER SET utf16le);
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-
---echo #
---echo # Testing that maximim possible key length is 1000 bytes
---echo #
-CREATE TABLE t1 (a VARCHAR(250) CHARACTER SET utf16le PRIMARY KEY);
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
---error ER_TOO_LONG_KEY
-CREATE TABLE t1 (a VARCHAR(334) CHARACTER SET utf16le PRIMARY KEY);
-
-
---echo #
---echo # Conversion to utf8
---echo #
-CREATE TABLE t1 (a CHAR(1) CHARACTER SET utf16le);
-INSERT INTO t1 VALUES (0x00D800DC),(0x00D8FFDC),(0x7FDB00DC),(0x7FDBFFDC);
-INSERT INTO t1 VALUES (0xC000), (0xFF00),(0x00E0), (0xFFFF);
-SELECT HEX(a), HEX(@a:=CONVERT(a USING utf8mb4)), HEX(CONVERT(@a USING utf16le)) FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # Test basic regex functionality
---echo #
-SET NAMES utf8, collation_connection=utf16le_general_ci;
---source include/ctype_regex.inc
-
-
---echo #
---echo # Test how CHARACTER SET works with date/time
---echo #
---source include/ctype_datetime.inc
-
-
---echo #
---echo # Bug#33073 Character sets: ordering fails with utf32
---echo #
-SET NAMES utf8, collation_connection=utf16le_general_ci;
-CREATE TABLE t1 AS SELECT REPEAT('a',2) as s1 LIMIT 0;
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES ('ab'),('AE'),('ab'),('AE');
-SELECT * FROM t1 ORDER BY s1;
-SET max_sort_length=4;
-SELECT * FROM t1 ORDER BY s1;
-DROP TABLE t1;
-SET max_sort_length=DEFAULT;
-
-
---echo #
---echo # Bug#52520 Difference in tinytext utf column metadata
---echo #
-CREATE TABLE t1 (
- s1 TINYTEXT CHARACTER SET utf16le,
- s2 TEXT CHARACTER SET utf16le,
- s3 MEDIUMTEXT CHARACTER SET utf16le,
- s4 LONGTEXT CHARACTER SET utf16le
-);
---enable_metadata
-SET NAMES utf8, @@character_set_results=NULL;
-SELECT *, HEX(s1) FROM t1;
-SET NAMES latin1;
-SELECT *, HEX(s1) FROM t1;
-SET NAMES utf8;
-SELECT *, HEX(s1) FROM t1;
---disable_metadata
-CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t1, t2;
-
---echo #
---echo # Problem found by Roy during review
---echo # MY_CS_BINSORT was not set for utf16le_bin,
---echo # so filesort did not work well
---echo #
-SET NAMES utf8, @@collation_connection=utf16le_bin;
-CREATE TABLE t1 AS SELECT REPEAT(' ', 10) as c LIMIT 0;
-# the problem in fact reproduced even without the primary key:
-ALTER TABLE t1 ADD PRIMARY KEY(c);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES ('abc'),('zyx'),('acb');
-SELECT UPPER(c) FROM t1 ORDER BY 1 DESC;
-DROP TABLE t1;
-
-
---echo #
---echo # WL#3664 WEIGHT_STRING
---echo #
-
-SET NAMES utf8, collation_connection=utf16le_general_ci;
---source include/weight_string.inc
---source include/weight_string_euro.inc
-SELECT HEX(WEIGHT_STRING(_utf16le 0x00D800DC));
-SELECT HEX(WEIGHT_STRING(_utf16le 0x00D801DC));
---source include/weight_string_l1.inc
-
-SET NAMES utf8, collation_connection=utf16le_bin;
---source include/weight_string.inc
---source include/weight_string_euro.inc
---source include/weight_string_l1.inc
-
---echo #
---echo # End of 5.6 tests
---echo #
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character"
---echo #
-CREATE TABLE t1 (
- id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
- a VARCHAR(10) CHARACTER SET utf16le, KEY(a,id)
-);
-INSERT INTO t1 (a) VALUES (_utf8mb4 0x61);
-INSERT INTO t1 (a) VALUES (_utf8mb4 0xC280),(_utf8mb4 0xDFBF);
-INSERT INTO t1 (a) VALUES (_utf8mb4 0xE0A080),(_utf8mb4 0xEFBFBF);
-INSERT INTO t1 (a) VALUES (_utf8mb4 0xF0908080),(_utf8mb4 0xF48FBFBF);
-SELECT id,HEX(a) FROM t1 ORDER BY a,id;
-SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
-SELECT COUNT(DISTINCT a) FROM t1;
-ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf16le COLLATE utf16le_bin;
-SELECT id,HEX(a) FROM t1 ORDER BY a;
-SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
-SELECT COUNT(DISTINCT a) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-9178 Wrong result for CAST(CONVERT('1IJ3' USING ucs2) AS SIGNED)
---echo #
-SET NAMES utf8;
-SELECT CAST(CONVERT('1IJ3' USING utf16le) AS SIGNED);
-
---echo #
---echo # End of 10.1 tests
---echo #
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-9711 NO PAD Collatons
---echo #
-SET character_set_connection=utf16le;
-let $coll='utf16le_general_nopad_ci';
-let $coll_pad='utf16le_general_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='utf16le_nopad_bin';
-let $coll_pad='utf16le_bin';
---source include/ctype_pad_all_engines.inc
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/ctype_utf32.test b/mysql-test/t/ctype_utf32.test
deleted file mode 100644
index 6f036898d15..00000000000
--- a/mysql-test/t/ctype_utf32.test
+++ /dev/null
@@ -1,1032 +0,0 @@
--- source include/have_utf32.inc
--- source include/have_utf8mb4.inc
-
-SET TIME_ZONE = '+03:00';
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
---echo #
---echo # Start of 5.5 tests
---echo #
-
-SET NAMES latin1;
-SET character_set_connection=utf32;
-select hex('a'), hex('a ');
--- source include/endspace.inc
-
-#
-# Check that incomplete utf32 characters in HEX notation
-# are left-padded with zeros
-#
-select hex(_utf32 0x44);
-select hex(_utf32 0x3344);
-select hex(_utf32 0x103344);
-
-select hex(_utf32 X'44');
-select hex(_utf32 X'3344');
-select hex(_utf32 X'103344');
-
-
-#
-# Check that 0x20 is only trimmed when it is
-# a part of real SPACE character, not just a part
-# of a multibyte sequence.
-# Note, CYRILLIC LETTER ER is used as an example, which
-# is stored as 0x0420 in UCS2, thus contains 0x20 in the
-# low byte. The second character is THREE-PER-M, U+2004,
-# which contains 0x20 in the high byte.
-#
-
-CREATE TABLE t1 (word VARCHAR(64), word2 CHAR(64)) CHARACTER SET utf32;
-INSERT INTO t1 VALUES (_koi8r 0xF2, _koi8r 0xF2), (X'2004',X'2004');
-SELECT hex(word) FROM t1 ORDER BY word;
-SELECT hex(word2) FROM t1 ORDER BY word2;
-DELETE FROM t1;
-
-#
-# Check that real spaces are correctly trimmed.
-#
-
-INSERT INTO t1 VALUES
- (X'000004200000002000000020',X'000004200000002000000020'),
- (X'000020040000002000000020',X'000020040000002000000020');
-SELECT hex(word) FROM t1 ORDER BY word;
-SELECT hex(word2) FROM t1 ORDER BY word2;
-DROP TABLE t1;
-
-#
-# Check LPAD/RPAD
-#
-SELECT hex(LPAD(_utf32 X'0420',10,_utf32 X'0421'));
-SELECT hex(LPAD(_utf32 X'0420',10,_utf32 X'0000042100000422'));
-SELECT hex(LPAD(_utf32 X'0420',10,_utf32 X'000004210000042200000423'));
-SELECT hex(LPAD(_utf32 X'000004200000042100000422000004230000042400000425000004260000042700000428000004290000042A0000042B',10,_utf32 X'000004210000042200000423'));
-
-SELECT hex(RPAD(_utf32 X'0420',10,_utf32 X'0421'));
-SELECT hex(RPAD(_utf32 X'0420',10,_utf32 X'0000042100000422'));
-SELECT hex(RPAD(_utf32 X'0420',10,_utf32 X'000004210000042200000423'));
-SELECT hex(RPAD(_utf32 X'000004200000042100000422000004230000042400000425000004260000042700000428000004290000042A0000042B',10,_utf32 X'000004210000042200000423'));
-
-CREATE TABLE t1 SELECT
-LPAD(_utf32 X'0420',10,_utf32 X'0421') l,
-RPAD(_utf32 X'0420',10,_utf32 X'0421') r;
-SHOW CREATE TABLE t1;
-select hex(l), hex(r) from t1;
-DROP TABLE t1;
-
-create table t1 (f1 char(30));
-insert into t1 values ("103000"), ("22720000"), ("3401200"), ("78000");
-select lpad(f1, 12, "-o-/") from t1;
-drop table t1;
-
-######################################################
-#
-# Test of like
-#
-
-SET NAMES latin1;
-SET character_set_connection=utf32;
---source include/ctype_like.inc
-
-SET NAMES utf8;
-SET character_set_connection=utf32;
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf32);
-INSERT INTO t1 VALUES ('фыва'),('Фыва'),('фЫва'),('фыВа'),('фывА'),('ФЫВА');
-INSERT INTO t1 VALUES ('фывапролдж'),('Фывапролдж'),('фЫвапролдж'),('фыВапролдж');
-INSERT INTO t1 VALUES ('фывАпролдж'),('фываПролдж'),('фывапРолдж'),('фывапрОлдж');
-INSERT INTO t1 VALUES ('фывапроЛдж'),('фывапролДж'),('фывапролдЖ'),('ФЫВАПРОЛДЖ');
-SELECT * FROM t1 WHERE a LIKE '%фЫва%' ORDER BY BINARY a;
-SELECT * FROM t1 WHERE a LIKE '%фЫв%' ORDER BY BINARY a;
-SELECT * FROM t1 WHERE a LIKE 'фЫва%' ORDER BY BINARY a;
-SELECT * FROM t1 WHERE a LIKE 'фЫва%' COLLATE utf32_bin ORDER BY BINARY a;
-DROP TABLE t1;
-
-CREATE TABLE t1 (word varchar(64) NOT NULL, PRIMARY KEY (word))
-ENGINE=MyISAM CHARACTER SET utf32;
-INSERT INTO t1 (word) VALUES ("cat");
-SELECT * FROM t1 WHERE word LIKE "c%";
-SELECT * FROM t1 WHERE word LIKE "ca_";
-SELECT * FROM t1 WHERE word LIKE "cat";
-SELECT * FROM t1 WHERE word LIKE _utf32 x'0000006300000025'; # "c%"
-SELECT * FROM t1 WHERE word LIKE _utf32 x'00000063000000610000005F'; # "ca_"
-DROP TABLE t1;
-
-
-#
-# Check that INSERT() works fine.
-# This invokes charpos() function.
-select insert(_utf32 0x000000610000006200000063,10,2,_utf32 0x000000640000006500000066);
-select insert(_utf32 0x000000610000006200000063,1,2,_utf32 0x000000640000006500000066);
-
-#######################################################
-
-#
-# Bug 1264
-#
-# Description:
-#
-# When using a ucs2 table in MySQL,
-# either with ucs2_general_ci or ucs2_bin collation,
-# words are returned in an incorrect order when using ORDER BY
-# on an _indexed_ CHAR or VARCHAR column. They are sorted with
-# the longest word *first* instead of last. I.E. The word "aardvark"
-# is in the results before the word "a".
-#
-# If there is no index for the column, the problem does not occur.
-#
-# Interestingly, if there is no second column, the words are returned
-# in the correct order.
-#
-# According to EXPLAIN, it looks like when the output includes columns that
-# are not part of the index sorted on, it does a filesort, which fails.
-# Using a straight index yields correct results.
-
-SET NAMES latin1;
-
-#
-# Two fields, index
-#
-
-CREATE TABLE t1 (
- word VARCHAR(64),
- bar INT(11) default 0,
- PRIMARY KEY (word))
- ENGINE=MyISAM
- CHARSET utf32
- COLLATE utf32_general_ci ;
-
-INSERT INTO t1 (word) VALUES ("aar");
-INSERT INTO t1 (word) VALUES ("a");
-INSERT INTO t1 (word) VALUES ("aardvar");
-INSERT INTO t1 (word) VALUES ("aardvark");
-INSERT INTO t1 (word) VALUES ("aardvara");
-INSERT INTO t1 (word) VALUES ("aardvarz");
-EXPLAIN SELECT * FROM t1 ORDER BY word;
-SELECT * FROM t1 ORDER BY word;
-EXPLAIN SELECT word FROM t1 ORDER BY word;
-SELECT word FROM t1 ORDER by word;
-DROP TABLE t1;
-
-
-#
-# One field, index
-#
-
-CREATE TABLE t1 (
- word VARCHAR(64) ,
- PRIMARY KEY (word))
- ENGINE=MyISAM
- CHARSET utf32
- COLLATE utf32_general_ci;
-
-INSERT INTO t1 (word) VALUES ("aar");
-INSERT INTO t1 (word) VALUES ("a");
-INSERT INTO t1 (word) VALUES ("aardvar");
-INSERT INTO t1 (word) VALUES ("aardvark");
-INSERT INTO t1 (word) VALUES ("aardvara");
-INSERT INTO t1 (word) VALUES ("aardvarz");
-EXPLAIN SELECT * FROM t1 ORDER BY WORD;
-SELECT * FROM t1 ORDER BY word;
-DROP TABLE t1;
-
-
-#
-# Two fields, no index
-#
-
-CREATE TABLE t1 (
- word TEXT,
- bar INT(11) AUTO_INCREMENT,
- PRIMARY KEY (bar))
- ENGINE=MyISAM
- CHARSET utf32
- COLLATE utf32_general_ci ;
-INSERT INTO t1 (word) VALUES ("aar");
-INSERT INTO t1 (word) VALUES ("a" );
-INSERT INTO t1 (word) VALUES ("aardvar");
-INSERT INTO t1 (word) VALUES ("aardvark");
-INSERT INTO t1 (word) VALUES ("aardvara");
-INSERT INTO t1 (word) VALUES ("aardvarz");
-EXPLAIN SELECT * FROM t1 ORDER BY word;
-SELECT * FROM t1 ORDER BY word;
-EXPLAIN SELECT word FROM t1 ORDER BY word;
-SELECT word FROM t1 ORDER BY word;
-DROP TABLE t1;
-
-#
-# END OF Bug 1264 test
-#
-########################################################
-
-
-#
-# Check alignment for from-binary-conversion with CAST and CONVERT
-#
-SELECT hex(cast(0xAA as char character set utf32));
-SELECT hex(convert(0xAA using utf32));
-
-#
-# Check alignment for string types
-#
-CREATE TABLE t1 (a char(10) character set utf32);
-INSERT INTO t1 VALUES (0x1),(0x11),(0x111),(0x1111),(0x11111);
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a varchar(10) character set utf32);
-INSERT INTO t1 VALUES (0x1),(0x11),(0x111),(0x1111),(0x11111);
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a text character set utf32);
-INSERT INTO t1 VALUES (0x1),(0x11),(0x111),(0x1111),(0x11111);
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a mediumtext character set utf32);
-INSERT INTO t1 VALUES (0x1),(0x11),(0x111),(0x1111),(0x11111);
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a longtext character set utf32);
-INSERT INTO t1 VALUES (0x1),(0x11),(0x111),(0x1111),(0x11111);
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
-##
-## Bug #5024 Server crashes with queries on fields
-## with certain charset/collation settings
-##
-#
-#create table t1 (s1 char character set `ucs2` collate `ucs2_czech_ci`);
-#insert into t1 values ('0'),('1'),('2'),('a'),('b'),('c');
-#select s1 from t1 where s1 > 'a' order by s1;
-#drop table t1;
-
-#
-# Bug #5081 : UCS2 fields are filled with '0x2020'
-# after extending field length
-#
-create table t1(a char(1)) default charset utf32;
-insert into t1 values ('a'),('b'),('c');
-alter table t1 modify a char(5);
-select a, hex(a) from t1;
-drop table t1;
-
-#
-# Check prepare statement from an UTF32 string
-#
-set @ivar= 1234;
-set @str1 = 'select ?';
-set @str2 = convert(@str1 using utf32);
-prepare stmt1 from @str2;
-execute stmt1 using @ivar;
-
-#
-# Check that utf32 works with ENUM and SET type
-#
-set names utf8;
-create table t1 (a enum('x','y','z') character set utf32);
-show create table t1;
-insert into t1 values ('x');
-insert into t1 values ('y');
-insert into t1 values ('z');
-select a, hex(a) from t1 order by a;
-alter table t1 change a a enum('x','y','z','d','e','ä','ö','ü') character set utf32;
-show create table t1;
-insert into t1 values ('D');
-insert into t1 values ('E ');
-insert into t1 values ('ä');
-insert into t1 values ('ö');
-insert into t1 values ('ü');
-select a, hex(a) from t1 order by a;
-drop table t1;
-
-create table t1 (a set ('x','y','z','ä','ö','ü') character set utf32);
-show create table t1;
-insert into t1 values ('x');
-insert into t1 values ('y');
-insert into t1 values ('z');
-insert into t1 values ('x,y');
-insert into t1 values ('x,y,z,ä,ö,ü');
-select a, hex(a) from t1 order by a;
-drop table t1;
-
-#
-# Bug#7302 UCS2 data in ENUM fields get truncated when new column is added
-#
-create table t1(a enum('a','b','c')) default character set utf32;
-insert into t1 values('a'),('b'),('c');
-alter table t1 add b char(1);
-show warnings;
-select * from t1 order by a;
-drop table t1;
-
-SET NAMES latin1;
-SET collation_connection='utf32_general_ci';
--- source include/ctype_filesort.inc
--- source include/ctype_like_escape.inc
-SET NAMES latin1;
-SET collation_connection='utf32_bin';
--- source include/ctype_filesort.inc
--- source include/ctype_filesort2.inc
--- source include/ctype_like_escape.inc
-
-#
-# Bug#10344 Some string functions fail for UCS2
-#
-select hex(substr(_utf32 0x000000e4000000e500000068,1));
-select hex(substr(_utf32 0x000000e4000000e500000068,2));
-select hex(substr(_utf32 0x000000e4000000e500000068,3));
-select hex(substr(_utf32 0x000000e4000000e500000068,-1));
-select hex(substr(_utf32 0x000000e4000000e500000068,-2));
-select hex(substr(_utf32 0x000000e4000000e500000068,-3));
-
-#SET NAMES latin1;
-#
-# Bug#8235
-#
-# This bug also helped to find another problem that
-# INSERT of a UCS2 string containing a negative number
-# into a unsigned int column didn't produce warnings.
-# This test covers both problems.
-#
-#SET collation_connection='ucs2_swedish_ci';
-#CREATE TABLE t1 (Field1 int(10) default '0');
-## no warnings, negative numbers are allowed
-#INSERT INTO t1 VALUES ('-1');
-#SELECT * FROM t1;
-#DROP TABLE t1;
-#CREATE TABLE t1 (Field1 int(10) unsigned default '0');
-## this should generate a "Data truncated" warning
-#INSERT INTO t1 VALUES ('-1');
-#DROP TABLE t1;
-#SET NAMES latin1;
-
-#
-##
-## Bug#18691 Converting number to UNICODE string returns invalid result
-##
-#SELECT CONVERT(103, CHAR(50) UNICODE);
-#SELECT CONVERT(103.0, CHAR(50) UNICODE);
-#SELECT CONVERT(-103, CHAR(50) UNICODE);
-#SELECT CONVERT(-103.0, CHAR(50) UNICODE);
-
-#
-# Bug#9557 MyISAM utf8 table crash
-#
-CREATE TABLE t1 (
- a varchar(250) NOT NULL default '',
- KEY a (a)
-) ENGINE=MyISAM DEFAULT CHARSET=utf32 COLLATE utf32_general_ci;
-insert into t1 values (0x803d);
-insert into t1 values (0x005b);
-select hex(a) from t1;
-drop table t1;
-
-##
-## Bug #14583 Bug on query using a LIKE on indexed field with ucs2_bin collation
-##
-#--disable_warnings
-#create table t1(f1 varchar(5) CHARACTER SET utf32 COLLATE utf32_bin NOT NULL) engine=InnoDB;
-#--enable_warnings
-#insert into t1 values('a');
-#create index t1f1 on t1(f1);
-#select f1 from t1 where f1 like 'a%';
-#drop table t1;
-
-#
-# Bug#9442 Set parameter make query fail if column character set is UCS2
-#
-create table t1 (utext varchar(20) character set utf32);
-insert into t1 values ("lily");
-insert into t1 values ("river");
-prepare stmt from 'select utext from t1 where utext like ?';
-set @param1='%%';
-execute stmt using @param1;
-execute stmt using @param1;
-select utext from t1 where utext like '%%';
-drop table t1;
-deallocate prepare stmt;
-
-#
-# Bug#22052 Trailing spaces are not removed from UNICODE fields in an index
-#
-create table t1 (
- a char(10) character set utf32 not null,
- index a (a)
-) engine=myisam;
-insert into t1 values (repeat(0x0000201f, 10));
-insert into t1 values (repeat(0x00002020, 10));
-insert into t1 values (repeat(0x00002021, 10));
-# make sure "index read" is used
-explain select hex(a) from t1 order by a;
-select hex(a) from t1 order by a;
-alter table t1 drop index a;
-select hex(a) from t1 order by a;
-drop table t1;
-
-#
-# Bug #20076: server crashes for a query with GROUP BY if MIN/MAX aggregation
-# over a 'ucs2' field uses a temporary table
-#
-#CREATE TABLE t1 (id int, s char(5) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci);
-#INSERT INTO t1 VALUES (1, 'ZZZZZ'), (1, 'ZZZ'), (2, 'ZZZ'), (2, 'ZZZZZ');
-#SELECT id, MIN(s) FROM t1 GROUP BY id;
-#DROP TABLE t1;
-
-##
-## Bug #20536: md5() with GROUP BY and UCS2 return different results on myisam/innodb
-##
-#
-#--disable_warnings
-#drop table if exists bug20536;
-#--enable_warnings
-#
-#set names latin1;
-#create table bug20536 (id bigint not null auto_increment primary key, name
-#varchar(255) character set ucs2 not null);
-#insert into `bug20536` (`id`,`name`) values (1, _latin1 x'7465737431'), (2, "'test\\_2'");
-#select md5(name) from bug20536;
-#select sha1(name) from bug20536;
-#select make_set(3, name, upper(name)) from bug20536;
-#select export_set(5, name, upper(name)) from bug20536;
-#select export_set(5, name, upper(name), ",", 5) from bug20536;
-
-#
-# Bug #20108: corrupted default enum value for a ucs2 field
-#
-
-CREATE TABLE t1 (
- status enum('active','passive') character set utf32 collate utf32_general_ci
- NOT NULL default 'passive'
-);
-SHOW CREATE TABLE t1;
-ALTER TABLE t1 ADD a int NOT NULL AFTER status;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-#CREATE TABLE t2 (
-# status enum('active','passive') collate ucs2_turkish_ci
-# NOT NULL default 'passive'
-#);
-#SHOW CREATE TABLE t2;
-#ALTER TABLE t2 ADD a int NOT NULL AFTER status;
-#DROP TABLE t2;
-
-
-## Some broken functions: add these tests just to document current behavior.
-#
-## PASSWORD and OLD_PASSWORD don't work with UCS2 strings, but to fix it would
-## not be backwards compatible in all cases, so it's best to leave it alone
-#select password(name) from bug20536;
-#select old_password(name) from bug20536;
-#
-## Disable test case as encrypt relies on 'crypt' function.
-## "decrypt" is noramlly tested in func_crypt.test which have a
-## "have_crypt.inc" test
-#--disable_parsing
-## ENCRYPT relies on OS function crypt() which takes a NUL-terminated string; it
-## doesn't return good results for strings with embedded 0 bytes. It won't be
-## fixed unless we choose to re-implement the crypt() function ourselves to take
-## an extra size_t string_length argument.
-#select encrypt(name, 'SALT') from bug20536;
-#--enable_parsing
-#
-## QUOTE doesn't work with UCS2 data. It would require a total rewrite
-## of Item_func_quote::val_str(), which isn't worthwhile until UCS2 is
-## supported fully as a client character set.
-#select quote(name) from bug20536;
-#
-#drop table bug20536;
-#
---echo End of 4.1 tests
-
-
-#
-# Conversion from an UTF32 string to a decimal column
-#
-CREATE TABLE t1 (a varchar(64) character set utf32, b decimal(10,3));
-INSERT INTO t1 VALUES ("1.1", 0), ("2.1", 0);
-update t1 set b=a;
-SELECT *, hex(a) FROM t1;
-DROP TABLE t1;
-
-#
-# Bug#9442 Set parameter make query fail if column character set is UCS2
-#
-create table t1 (utext varchar(20) character set utf32);
-insert into t1 values ("lily");
-insert into t1 values ("river");
-prepare stmt from 'select utext from t1 where utext like ?';
-set @param1='%%';
-execute stmt using @param1;
-execute stmt using @param1;
-select utext from t1 where utext like '%%';
-drop table t1;
-deallocate prepare stmt;
-
-#
-# Bug#22638 SOUNDEX broken for international characters
-#
-set names latin1;
-set character_set_connection=utf32;
-select soundex(''),soundex('he'),soundex('hello all folks'),soundex('#3556 in bugdb');
-select hex(soundex('')),hex(soundex('he')),hex(soundex('hello all folks')),hex(soundex('#3556 in bugdb'));
-select 'mood' sounds like 'mud';
-# Cyrillic A, BE, VE
-select hex(soundex(_utf32 0x000004100000041100000412));
-# Make sure that "U+00BF INVERTED QUESTION MARK" is not considered as letter
-select hex(soundex(_utf32 0x000000BF000000C0));
-set names latin1;
-
-#
-# Bug #14290: character_maximum_length for text fields
-#
-create table t1(a blob, b text charset utf32);
-select data_type, character_octet_length, character_maximum_length
- from information_schema.columns where table_name='t1';
-drop table t1;
-
-
-set names latin1;
-set collation_connection=utf32_general_ci;
-#
-# Testing cs->coll->instr()
-#
-select position('bb' in 'abba');
-
-#
-# Testing cs->coll->hash_sort()
-#
-create table t1 (a varchar(10) character set utf32) engine=heap;
-insert into t1 values ('a'),('A'),('b'),('B');
-select * from t1 where a='a' order by binary a;
-select hex(min(binary a)),count(*) from t1 group by a;
-drop table t1;
-
-#
-# Testing cs->cset->numchars()
-#
-select char_length('abcd'), octet_length('abcd');
-
-#
-# Testing cs->cset->charpos()
-#
-select left('abcd',2);
-
-#
-# Testing cs->cset->well_formed_length()
-#
-create table t1 (a varchar(10) character set utf32);
-insert into t1 values (_utf32 0x0010FFFF);
---error ER_INVALID_CHARACTER_STRING
-insert into t1 values (_utf32 0x00110000);
---error ER_INVALID_CHARACTER_STRING
-insert into t1 values (_utf32 0x00110101);
---error ER_INVALID_CHARACTER_STRING
-insert into t1 values (_utf32 0x01000101);
---error ER_INVALID_CHARACTER_STRING
-insert into t1 values (_utf32 0x11000101);
-select hex(a) from t1;
-drop table t1;
-
-#
-# Bug#32914 Character sets: illegal characters in utf8 and utf32 columns
-#
-create table t1 (utf32 varchar(2) character set utf32);
---echo Wrong character with pad
-insert ignore into t1 values (0x110000);
---echo Wrong chsaracter without pad
-insert ignore into t1 values (0x00110000);
---echo Wrong character with pad followed by another wrong character
-insert ignore into t1 values (0x11000000110000);
---echo Good character with pad followed by bad character
-insert ignore into t1 values (0x10000000110000);
---echo Good character without pad followed by bad character
-insert ignore into t1 values (0x0010000000110000);
---echo Wrong character with the second byte higher than 0x10
-insert ignore into t1 values (0x00800037);
---echo Wrong character with pad with the second byte higher than 0x10
-insert ignore into t1 values (0x00800037);
-drop table t1;
-
-#
-# Bug#32394 Character sets: crash if comparison with 0xfffd
-#
-select _utf32'a' collate utf32_general_ci = 0xfffd;
-select hex(concat(_utf32 0x0410 collate utf32_general_ci, 0x61));
-create table t1 (s1 varchar(5) character set utf32);
-insert into t1 values (0xfffd);
-select case when s1 = 0xfffd then 1 else 0 end from t1;
-select hex(s1) from t1 where s1 = 0xfffd;
-drop table t1;
-
-#
-# Testing cs->cset->lengthsp()
-#
-create table t1 (a char(10)) character set utf32;
-insert into t1 values ('a ');
-select hex(a) from t1;
-drop table t1;
-
-#
-# Testing cs->cset->caseup() and cs->cset->casedn()
-#
-select upper('abcd'), lower('ABCD');
-
-#
-# TODO: str_to_datetime() is broken and doesn't work with ucs2 and utf32
-# Testing cs->cset->snprintf()
-#
-#create table t1 (a date);
-#insert into t1 values ('2007-09-16');
-#select * from t1;
-#drop table t1;
-
-#
-# Testing cs->cset->l10tostr
-# !!! Not used in the code
-
-#
-# Testing cs->cset->ll10tostr
-#
-create table t1 (a varchar(10) character set utf32);
-insert into t1 values (123456);
-select a, hex(a) from t1;
-drop table t1;
-
-#
-# Testing cs->cset->fill
-# SOUNDEX fills strings with DIGIT ZERO up to four characters
-select hex(soundex('a'));
-
-#
-# Testing cs->cset->strntol
-# !!! Not used in the code
-
-#
-# Testing cs->cset->strntoul
-#
-create table t1 (a enum ('a','b','c')) character set utf32;
-insert into t1 values ('1');
-select * from t1;
-drop table t1;
-
-#
-# Testing cs->cset->strntoll and cs->cset->strntoull
-#
-set names latin1;
-select hex(conv(convert('123' using utf32), -10, 16));
-select hex(conv(convert('123' using utf32), 10, 16));
-
-#
-# Testing cs->cset->strntod
-#
-set names latin1;
-set character_set_connection=utf32;
-select 1.1 + '1.2';
-select 1.1 + '1.2xxx';
-
-# Testing strntoll10_utf32
-# Testing cs->cset->strtoll10
-select left('aaa','1');
---source include/ctype_strtoll10.inc
-
-#
-# Testing cs->cset->strntoull10rnd
-#
-create table t1 (a int);
-insert into t1 values ('-1234.1e2');
-insert ignore into t1 values ('-1234.1e2xxxx');
-insert into t1 values ('-1234.1e2 ');
-select * from t1;
-drop table t1;
-
-#
-# Testing cs->cset->scan
-#
-create table t1 (a int);
-insert into t1 values ('1 ');
-insert ignore into t1 values ('1 x');
-select * from t1;
-drop table t1;
-
-#
-# Testing auto-conversion to TEXT
-#
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-create table t1 (a varchar(17000) character set utf32);
-show create table t1;
-drop table t1;
-
-#
-# Testing that maximim possible key length is 1332 bytes
-#
-create table t1 (a varchar(250) character set utf32 primary key);
-show create table t1;
-drop table t1;
---error ER_TOO_LONG_KEY
-create table t1 (a varchar(334) character set utf32 primary key);
-
-#
-# Testing mi_check with long key values
-#
-create table t1 (a varchar(333) character set utf32, key(a));
-insert into t1 values (repeat('a',333)), (repeat('b',333));
-flush tables;
-check table t1;
-drop table t1;
-
-#
-# Test how character set works with date/time
-#
-SET collation_connection=utf32_general_ci;
---source include/ctype_datetime.inc
-SET NAMES latin1;
-
-#
-# Test basic regex functionality
-#
-set collation_connection=utf32_general_ci;
---source include/ctype_regex.inc
-set names latin1;
-
-
-# TODO: add tests for all engines
-
-#
-# Bug #36418 Character sets: crash if char(256 using utf32)
-#
-select hex(char(0x01 using utf32));
-select hex(char(0x0102 using utf32));
-select hex(char(0x010203 using utf32));
-select hex(char(0x01020304 using utf32));
-create table t1 (s1 varchar(1) character set utf32, s2 text character set utf32);
-create index i on t1 (s1);
-insert into t1 values (char(256 using utf32), char(256 using utf32));
-select hex(s1), hex(s2) from t1;
-drop table t1;
-
-
-#
-# Bug#33073 Character sets: ordering fails with utf32
-#
-SET collation_connection=utf32_general_ci;
-CREATE TABLE t1 AS SELECT repeat('a',2) as s1 LIMIT 0;
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES ('ab'),('AE'),('ab'),('AE');
-SELECT * FROM t1 ORDER BY s1;
-SET max_sort_length=4;
-SELECT * FROM t1 ORDER BY s1;
-DROP TABLE t1;
-SET max_sort_length=DEFAULT;
-SET NAMES latin1;
-
---echo #
---echo # Bug#52520 Difference in tinytext utf column metadata
---echo #
-CREATE TABLE t1 (
- s1 TINYTEXT CHARACTER SET utf32,
- s2 TEXT CHARACTER SET utf32,
- s3 MEDIUMTEXT CHARACTER SET utf32,
- s4 LONGTEXT CHARACTER SET utf32
-);
---enable_metadata
-SET NAMES utf8mb4, @@character_set_results=NULL;
-SELECT *, HEX(s1) FROM t1;
-SET NAMES latin1;
-SELECT *, HEX(s1) FROM t1;
-SET NAMES utf8mb4;
-SELECT *, HEX(s1) FROM t1;
---disable_metadata
-CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t1, t2;
-
-
---echo #
---echo # Bug#45263 utf32_general_ci, bad effects around CREATE TABLE AS SELECT
---echo #
-SET collation_connection=utf32_general_ci;
-CREATE TABLE t1 AS SELECT HEX(0x00) AS my_col;
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#32859 Character sets: no warning with non-fitting chariot wheel
---echo #
-CREATE TABLE t1 (utf32 CHAR(5) CHARACTER SET utf32, latin1 CHAR(5) CHARACTER SET latin1);
-INSERT INTO t1 (utf32) VALUES (0xc581);
-UPDATE IGNORE t1 SET latin1 = utf32;
-DELETE FROM t1;
-INSERT INTO t1 (utf32) VALUES (0x100cc);
-UPDATE IGNORE t1 SET latin1 = utf32;
-DROP TABLE t1;
-
---echo #
---echo # Bug#55912 FORMAT with locale set fails for numbers < 1000
---echo #
-SET collation_connection=utf32_general_ci;
-CREATE TABLE t1 AS SELECT format(123,2,'no_NO');
-SHOW CREATE TABLE t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#42511 mysqld: ctype-ucs2.c:2044: my_strnncollsp_utf32: Assertion (tlen % 4) == 0' faied
---echo #
-CREATE TABLE t1 (
- b char(250) CHARACTER SET utf32,
- key (b)
-) ENGINE=MYISAM;
-INSERT INTO t1 VALUES ('d'),('f');
-SELECT * FROM t1 WHERE b BETWEEN 'a' AND 'z';
-DROP TABLE t1;
-
---echo #
---echo # Bug#11753363 (Bug#44793) Character sets: case clause, ucs2 or utf32, failure
---echo #
-SELECT CASE _latin1'a' WHEN _utf32'a' THEN 'A' END;
-SELECT CASE _utf32'a' WHEN _latin1'a' THEN 'A' END;
-CREATE TABLE t1 (s1 CHAR(5) CHARACTER SET utf32);
-INSERT INTO t1 VALUES ('a');
-SELECT CASE s1 WHEN 'a' THEN 'b' ELSE 'c' END FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#11750518 41090: ORDER BY TRUNCATES GROUP_CONCAT RESULT
---echo #
-
-SET NAMES utf8, @@character_set_connection=utf32;
-SET STATEMENT group_concat_max_len=1024 FOR
-SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l
-FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body
-UNION ALL
-SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1
-GROUP BY id
-ORDER BY l DESC;
-
---echo #
---echo # incorrect charset for val_str_ascii
---echo #
-
-SELECT '2010-10-10 10:10:10' + INTERVAL GeometryType(GeomFromText('POINT(1 1)')) hour_second;
-
---echo #
---echo # MDEV-5745 analyze MySQL fix for bug#12368495
---echo #
-SELECT CHAR_LENGTH(TRIM(LEADING 0x0000000000 FROM _utf32 0x00000061));
-SELECT CHAR_LENGTH(TRIM(LEADING 0x0001 FROM _utf32 0x00000061));
-SELECT CHAR_LENGTH(TRIM(LEADING 0x00 FROM _utf32 0x00000061));
-
-SELECT CHAR_LENGTH(TRIM(TRAILING 0x0000000000 FROM _utf32 0x00000061));
-SELECT CHAR_LENGTH(TRIM(TRAILING 0x0001 FROM _utf32 0x00000061));
-SELECT CHAR_LENGTH(TRIM(TRAILING 0x61 FROM _utf32 0x00000061));
-
-SELECT CHAR_LENGTH(TRIM(BOTH 0x0000000000 FROM _utf32 0x00000061));
-SELECT CHAR_LENGTH(TRIM(BOTH 0x0001 FROM _utf32 0x00000061));
-SELECT CHAR_LENGTH(TRIM(BOTH 0x61 FROM _utf32 0x00000061));
-SELECT CHAR_LENGTH(TRIM(BOTH 0x00 FROM _utf32 0x00000061));
-
-#
-# potential signedness issue
-#
-select hex(lower(cast(0xffff0000 as char character set utf32))) as c;
-
---echo #
---echo # MDEV-11685: sql_mode can't be set with non-ascii connection charset
---echo #
-SET character_set_connection=utf32;
-SET sql_mode='NO_ENGINE_SUBSTITUTION';
-SELECT @@sql_mode;
-SET sql_mode=DEFAULT;
-SET NAMES utf8;
-
---echo #
---echo # MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535
---echo #
-
-set sql_mode='';
-CREATE TABLE t1 (c1 VARCHAR(16383) CHARACTER SET utf32);
-DESCRIBE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 VARCHAR(16384) CHARACTER SET utf32);
-DESCRIBE t1;
-DROP TABLE t1;
-set sql_mode=default;
-
-
---echo #
---echo # End of 5.5 tests
---echo #
-
-
---echo #
---echo # Start of 5.6 tests
---echo #
-
---echo #
---echo # WL#3664 WEIGHT_STRING
---echo #
-
-set collation_connection=utf32_general_ci;
---source include/weight_string.inc
---source include/weight_string_euro.inc
-select hex(weight_string(_utf32 0x10000));
-select hex(weight_string(_utf32 0x10001));
---source include/weight_string_l1.inc
-
-set collation_connection=utf32_bin;
---source include/weight_string.inc
---source include/weight_string_euro.inc
---source include/weight_string_l1.inc
-
---echo #
---echo # End of 5.6 tests
---echo #
-
-
---echo #
---echo # Start of 10.0 tests
---echo #
-
---echo #
---echo # MDEV-6661 PI() does not work well in UCS2/UTF16/UTF32 context
---echo #
-SELECT CONCAT(CONVERT('pi=' USING utf32),PI()) AS PI;
-
---echo #
---echo # MDEV-6666 Malformed result for CONCAT(utf8_column, binary_string)
---echo #
-
-SET NAMES utf8mb4;
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf32);
-INSERT INTO t1 VALUES ('a');
---error ER_INVALID_CHARACTER_STRING
-SELECT CONCAT(a,0x20FFFF) FROM t1;
-SELECT CONCAT(a,0x010000) FROM t1;
-SELECT CONCAT(a,0x00FF) FROM t1;
-DROP TABLE t1;
---error ER_INVALID_CHARACTER_STRING
-SELECT CONCAT(_utf32'a' COLLATE utf32_unicode_ci, _binary 0x20FFFF);
-PREPARE stmt FROM "SELECT CONCAT(_utf32'a' COLLATE utf32_unicode_ci, ?)";
-SET @arg00=_binary 0x20FFFF;
---error ER_INVALID_CHARACTER_STRING
-EXECUTE stmt USING @arg00;
-SET @arg00=_binary 0x010000;
-EXECUTE stmt USING @arg00;
-SET @arg00=_binary 0x00FF;
-EXECUTE stmt USING @arg00;
-DEALLOCATE PREPARE stmt;
-
---echo #
---echo # End of 10.0 tests
---echo #
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-8419 utf32: compare broken bytes as "greater than any non-broken character"
---echo #
-# Make sure that all non-BMP characters are compared as equal
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf32, KEY(a));
-INSERT INTO t1 VALUES (0x10000),(0x10001),(0x10002);
-SELECT COUNT(DISTINCT a) FROM t1;
-DROP TABLE t1;
-SELECT _utf32 0x10001=_utf32 0x10002;
-
---echo #
---echo # MDEV-9178 Wrong result for CAST(CONVERT('1IJ3' USING ucs2) AS SIGNED)
---echo #
-SET NAMES utf8;
-SELECT CAST(CONVERT('1IJ3' USING utf32) AS SIGNED);
-
---echo #
---echo # End of 10.1 tests
---echo #
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-9711 NO PAD Collatons
---echo #
-SET character_set_connection=utf32;
-let $coll='utf32_general_nopad_ci';
-let $coll_pad='utf32_general_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='utf32_nopad_bin';
-let $coll_pad='utf32_bin';
---source include/ctype_pad_all_engines.inc
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/ctype_utf32_uca.test b/mysql-test/t/ctype_utf32_uca.test
deleted file mode 100644
index 334d8fd1d48..00000000000
--- a/mysql-test/t/ctype_utf32_uca.test
+++ /dev/null
@@ -1,270 +0,0 @@
--- source include/have_ucs2.inc
--- source include/have_utf32.inc
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
---echo #
---echo # Start of 5.5 tests
---echo #
-
-set names utf8;
-set collation_connection=utf32_unicode_ci;
-select hex('a'), hex('a ');
--- source include/endspace.inc
-
-#
-# Bug #6787 LIKE not working properly with _ and utf8 data
-#
-select 'c' like '\_' as want0;
-
-#
-# Bug #5679 utf8_unicode_ci LIKE--trailing % doesn't equal zero characters
-#
-CREATE TABLE t (
- c char(20) NOT NULL
-) ENGINE=MyISAM DEFAULT CHARACTER SET utf32 COLLATE=utf32_unicode_ci;
-INSERT INTO t VALUES ('a'),('ab'),('aba');
-ALTER TABLE t ADD INDEX (c);
-SELECT c FROM t WHERE c LIKE 'a%';
-DROP TABLE t;
-
-
-create table t1 (c1 char(10) character set utf32 collate utf32_bin);
-
---source include/ctype_unicode_latin.inc
-
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_unicode_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_icelandic_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_latvian_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_romanian_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_slovenian_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_polish_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_estonian_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_spanish_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_swedish_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_turkish_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_czech_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_danish_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_lithuanian_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_slovak_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_spanish2_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_roman_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_esperanto_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_hungarian_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_croatian_mysql561_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_croatian_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_german2_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_unicode_520_ci;
-select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_vietnamese_ci;
-
-drop table t1;
-
-#
-# Bug#5324
-#
-SET NAMES utf8;
-#test1
-CREATE TABLE t1 (c varchar(200) CHARACTER SET utf32 COLLATE utf32_general_ci NOT NULL, INDEX (c));
-INSERT INTO t1 VALUES (_ucs2 0x039C03C903B403B11F770308);
-#Check one row
-SELECT * FROM t1 WHERE c LIKE _utf32 0x0000039C00000025 COLLATE utf32_general_ci;
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B4 USING utf8));
-#Check two rows
-SELECT * FROM t1 WHERE c LIKE _utf32 0x0000039C00000025
-COLLATE utf32_general_ci ORDER BY c;
-DROP TABLE t1;
-#test2
-CREATE TABLE t1 (c varchar(200) CHARACTER SET utf32 COLLATE utf32_unicode_ci NOT NULL, INDEX (c));
-INSERT INTO t1 VALUES (_ucs2 0x039C03C903B403B11F770308);
-#Check one row
-SELECT * FROM t1 WHERE c LIKE _utf32 0x0000039C00000025 COLLATE utf32_unicode_ci;
-INSERT INTO t1 VALUES (_ucs2 0x039C03C903B4);
-#Check two rows
-SELECT * FROM t1 WHERE c LIKE _utf32 0x0000039C00000025
-COLLATE utf32_unicode_ci ORDER BY c;
-DROP TABLE t1;
-#test 3
-CREATE TABLE t1 (c varchar(200) CHARACTER SET utf32 COLLATE utf32_unicode_ci NOT NULL, INDEX (c));
-INSERT INTO t1 VALUES (_ucs2 0x039C03C903B403B11F770308);
-#Check one row row
-SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf32) COLLATE utf32_unicode_ci;
-INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B4 USING utf8));
-#Check two rows
-SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf32)
-COLLATE utf32_unicode_ci ORDER BY c;
-DROP TABLE t1;
-
-
-SET NAMES utf8;
-SET @test_character_set='utf32';
-SET @test_collation='utf32_swedish_ci';
--- source include/ctype_common.inc
-
-
-SET collation_connection='utf32_unicode_ci';
--- source include/ctype_filesort.inc
--- source include/ctype_like_escape.inc
--- source include/ctype_german.inc
-
---echo End of 4.1 tests
-
-#
-# Check UPPER/LOWER changing length
-#
-# Result shorter than argument
-CREATE TABLE t1 (id int, a varchar(30) character set utf32);
-INSERT INTO t1 VALUES (1, _ucs2 0x01310069), (2, _ucs2 0x01310131);
-INSERT INTO t1 VALUES (3, _ucs2 0x00690069), (4, _ucs2 0x01300049);
-INSERT INTO t1 VALUES (5, _ucs2 0x01300130), (6, _ucs2 0x00490049);
-SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
-FROM t1 ORDER BY id;
-ALTER TABLE t1 MODIFY a VARCHAR(30) character set utf32 collate utf32_turkish_ci;
-SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
-FROM t1 ORDER BY id;
-DROP TABLE t1;
-
-#
-# Bug #27079 Crash while grouping empty ucs2 strings
-#
-CREATE TABLE t1 (
- c1 text character set utf32 collate utf32_polish_ci NOT NULL
-) ENGINE=MyISAM;
-insert into t1 values (''),('a');
-SELECT COUNT(*), c1 FROM t1 GROUP BY c1;
-DROP TABLE IF EXISTS t1;
-
-
-#
-# Test basic regex functionality
-#
-set collation_connection=utf32_unicode_ci;
---source include/ctype_regex.inc
-
-
-#
-# Test my_like_range and contractions
-#
-SET collation_connection=utf32_czech_ci;
---source include/ctype_czech.inc
---source include/ctype_like_ignorable.inc
-
---echo #
---echo # Bug #12319710 : INVALID MEMORY READ AND/OR CRASH IN
---echo # MY_UCA_CHARCMP WITH UTF32
---echo #
-
-SET collation_connection=utf32_unicode_ci;
-CREATE TABLE t1 (a TEXT CHARACTER SET utf32 COLLATE utf32_turkish_ci NOT NULL);
-INSERT INTO t1 VALUES ('a'), ('b');
-CREATE TABLE t2 (b VARBINARY(5) NOT NULL);
-
---echo #insert chars outside of BMP
-INSERT INTO t2 VALUEs (0x082837),(0x082837);
-
---echo #test for read-out-of-bounds with non-BMP chars as a LIKE pattern
-SELECT * FROM t1,t2 WHERE a LIKE b;
-
---echo #test the original statement
-SELECT 1 FROM t1 AS t1_0 NATURAL LEFT OUTER JOIN t2 AS t2_0
-RIGHT JOIN t1 AS t1_1 ON t1_0.a LIKE t2_0.b;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # End of 5.5 tests
---echo #
-
-
---echo #
---echo # Start of 5.6 tests
---echo #
-
---echo #
---echo # WL#3664 WEIGHT_STRING
---echo #
-
-set collation_connection=utf32_unicode_ci;
---source include/weight_string.inc
---source include/weight_string_euro.inc
-select hex(weight_string(_utf32 0x10000 collate utf32_unicode_ci));
-select hex(weight_string(_utf32 0x10001 collate utf32_unicode_ci));
---source include/weight_string_l1.inc
-
-set @@collation_connection=utf32_czech_ci;
---source include/weight_string_chde.inc
-
-#
-# WL#4013 Unicode german2 collation
-#
-SET NAMES utf8;
-SET collation_connection=utf32_german2_ci;
---source include/ctype_german.inc
-
---echo #
---echo # WL#2673 Unicode Collation Algorithm new version
---echo #
-SET NAMES utf8mb4;
-SET collation_connection=utf32_unicode_520_ci;
---source include/ctype_unicode520.inc
-
---echo #
---echo # End of 5.6 tests
---echo #
-
-
---echo #
---echo # Start of MariaDB-10.0 tests
---echo #
---echo
-
---echo #
---echo # MDEV-4929 Myanmar collation
---echo #
-SET NAMES utf8;
-SET collation_connection=utf32_myanmar_ci;
---source include/ctype_myanmar.inc
-
---echo #
---echo # End of MariaDB-10.0 tests
---echo #
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
-SET NAMES utf8;
-SET collation_connection=utf32_thai_520_w2;
---source include/ctype_uca_w2.inc
---source include/ctype_thai.inc
-
---echo #
---echo # End of 10.1 tests
---echo #
-
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-10877 xxx_unicode_nopad_ci collations
---echo #
-SET NAMES utf8, character_set_connection=utf32;
-let $coll='utf32_unicode_nopad_ci';
-let $coll_pad='utf32_unicode_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='utf32_unicode_520_nopad_ci';
-let $coll_pad='utf32_unicode_520_ci';
---source include/ctype_pad_all_engines.inc
-
-SET NAMES utf8, collation_connection=utf32_unicode_520_nopad_ci;
---source include/ctype_like_range_mdev14350.inc
-SET NAMES utf8;
-
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/ctype_utf8-master.opt b/mysql-test/t/ctype_utf8-master.opt
deleted file mode 100644
index 96f0ce3f36c..00000000000
--- a/mysql-test/t/ctype_utf8-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---default-storage-engine=MyISAM
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
deleted file mode 100644
index 20a60d370a0..00000000000
--- a/mysql-test/t/ctype_utf8.test
+++ /dev/null
@@ -1,2178 +0,0 @@
-#
-# Tests with the utf8 character set
-#
-
-let collation=utf8_unicode_ci;
---source include/have_collation.inc
-SET TIME_ZONE='+03:00';
-
---source include/have_innodb.inc
-
---disable_warnings
-drop table if exists t1,t2,t3,t4;
-drop database if exists mysqltest;
---enable_warnings
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-set names utf8;
-
-select left(_utf8 0xD0B0D0B1D0B2,1);
-select right(_utf8 0xD0B0D0B2D0B2,1);
-
-select locate('he','hello');
-select locate('he','hello',2);
-select locate('lo','hello',2);
-select locate('HE','hello');
-select locate('HE','hello',2);
-select locate('LO','hello',2);
-select locate('HE','hello' collate utf8_bin);
-select locate('HE','hello' collate utf8_bin,2);
-select locate('LO','hello' collate utf8_bin,2);
-
-select locate(_utf8 0xD0B1, _utf8 0xD0B0D0B1D0B2);
-select locate(_utf8 0xD091, _utf8 0xD0B0D0B1D0B2);
-select locate(_utf8 0xD0B1, _utf8 0xD0B0D091D0B2);
-select locate(_utf8 0xD091, _utf8 0xD0B0D0B1D0B2 collate utf8_bin);
-select locate(_utf8 0xD0B1, _utf8 0xD0B0D091D0B2 collate utf8_bin);
-
-select length(_utf8 0xD0B1), bit_length(_utf8 0xD0B1), char_length(_utf8 0xD0B1);
-
-select 'a' like 'a';
-select 'A' like 'a';
-select 'A' like 'a' collate utf8_bin;
-select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%');
-
-# Bug #6040: can't retrieve records with umlaut
-# characters in case insensitive manner.
-# Case insensitive search LIKE comparison
-# was broken for multibyte characters:
-select convert(_latin1'Gnter Andr' using utf8) like CONVERT(_latin1'GNTER%' USING utf8);
-select CONVERT(_koi8r'' USING utf8) LIKE CONVERT(_koi8r'' USING utf8);
-select CONVERT(_koi8r'' USING utf8) LIKE CONVERT(_koi8r'' USING utf8);
-
-#
-# Check the following:
-# "a" == "a "
-# "a\0" < "a"
-# "a\0" < "a "
-
-SELECT 'a' = 'a ';
-SELECT 'a\0' < 'a';
-SELECT 'a\0' < 'a ';
-SELECT 'a\t' < 'a';
-SELECT 'a\t' < 'a ';
-
-#
-# The same for binary collation
-#
-SELECT 'a' = 'a ' collate utf8_bin;
-SELECT 'a\0' < 'a' collate utf8_bin;
-SELECT 'a\0' < 'a ' collate utf8_bin;
-SELECT 'a\t' < 'a' collate utf8_bin;
-SELECT 'a\t' < 'a ' collate utf8_bin;
-
-CREATE TABLE t1 (a char(10) character set utf8 not null);
-INSERT INTO t1 VALUES ('a'),('a\0'),('a\t'),('a ');
-SELECT hex(a),STRCMP(a,'a'), STRCMP(a,'a ') FROM t1;
-DROP TABLE t1;
-
-#
-# Fix this, it should return 1:
-#
-#select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD091,_utf8 '%');
-#
-
-#
-# Bug 2367: INSERT() behaviour is different for different charsets.
-#
-select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
-select insert("aa",100,1,"b"),insert("aa",1,3,"b");
-
-#
-# LELF() didn't work well with utf8 in some cases too.
-#
-select char_length(left(@a:='тест',5)), length(@a), @a;
-
-
-#
-# CREATE ... SELECT
-#
-create table t1 select date_format("2004-01-19 10:10:10", "%Y-%m-%d");
-show create table t1;
-select * from t1;
-drop table t1;
-
-#
-# Bug#22646 LC_TIME_NAMES: Assignment to non-UTF8 target fails
-#
-set names utf8;
-set LC_TIME_NAMES='fr_FR';
-create table t1 (s1 char(20) character set latin1);
-insert into t1 values (date_format('2004-02-02','%M'));
-select hex(s1) from t1;
-drop table t1;
-create table t1 (s1 char(20) character set koi8r);
-set LC_TIME_NAMES='ru_RU';
-insert into t1 values (date_format('2004-02-02','%M'));
-insert into t1 values (date_format('2004-02-02','%b'));
-insert into t1 values (date_format('2004-02-02','%W'));
-insert into t1 values (date_format('2004-02-02','%a'));
-select hex(s1), s1 from t1;
-drop table t1;
-set LC_TIME_NAMES='en_US';
-
-
-#
-# Bug #2366 Wrong utf8 behaviour when data is truncated
-#
-set names koi8r;
-create table t1 (s1 char(1) character set utf8);
-insert ignore into t1 values (_koi8r'');
-select s1,hex(s1),char_length(s1),octet_length(s1) from t1;
-drop table t1;
-
-create table t1 (s1 tinytext character set utf8);
-insert ignore into t1 select repeat('a',300);
-insert ignore into t1 select repeat('',300);
-insert ignore into t1 select repeat('a',300);
-insert ignore into t1 select repeat('a',300);
-insert ignore into t1 select repeat('',300);
-select hex(s1) from t1;
-select length(s1),char_length(s1) from t1;
-drop table t1;
-
-create table t1 (s1 text character set utf8);
-insert ignore into t1 select repeat('a',66000);
-insert ignore into t1 select repeat('',66000);
-insert ignore into t1 select repeat('a',66000);
-insert ignore into t1 select repeat('a',66000);
-insert ignore into t1 select repeat('',66000);
-select length(s1),char_length(s1) from t1;
-drop table t1;
-
-#
-# Bug #2368 Multibyte charsets do not check that incoming data is well-formed
-#
-create table t1 (s1 char(10) character set utf8);
-insert ignore into t1 values (0x41FF);
-select hex(s1) from t1;
-drop table t1;
-
-create table t1 (s1 varchar(10) character set utf8);
-insert ignore into t1 values (0x41FF);
-select hex(s1) from t1;
-drop table t1;
-
-create table t1 (s1 text character set utf8);
-insert ignore into t1 values (0x41FF);
-select hex(s1) from t1;
-drop table t1;
-
-#
-# Bug 2699
-# UTF8 breaks primary keys for cols > 333 characters
-#
---error 1071
-create table t1 (a text character set utf8, primary key(a(371)));
-
-
-#
-# Bug 2959
-# UTF8 charset breaks joins with mixed column/string constant
-#
-CREATE TABLE t1 ( a varchar(10) ) CHARACTER SET utf8;
-INSERT INTO t1 VALUES ( 'test' );
-SELECT a.a, b.a FROM t1 a, t1 b WHERE a.a = b.a;
-SELECT a.a, b.a FROM t1 a, t1 b WHERE a.a = 'test' and b.a = 'test';
-SELECT a.a, b.a FROM t1 a, t1 b WHERE a.a = b.a and a.a = 'test';
-DROP TABLE t1;
-
-create table t1 (a char(255) character set utf8);
-insert into t1 values('b'),('b');
-select * from t1 where a = 'b';
-select * from t1 where a = 'b' and a = 'b';
-select * from t1 where a = 'b' and a != 'b';
-drop table t1;
-
-#
-# Testing regexp
-#
-set names utf8;
---source include/ctype_regex.inc
---source include/ctype_regex_utf8.inc
-
-#
-# Bug #4555
-# ALTER TABLE crashes mysqld with enum column collated utf8_unicode_ci
-#
-CREATE TABLE t1 (a enum ('Y', 'N') DEFAULT 'N' COLLATE utf8_unicode_ci);
-ALTER TABLE t1 ADD COLUMN b CHAR(20);
-DROP TABLE t1;
-
-# Customer Support Center issue # 3299
-# ENUM and SET multibyte fields computed their length wronly
-# when converted into a char field
-set names utf8;
-create table t1 (a enum('aaaa','проба') character set utf8);
-show create table t1;
-insert into t1 values ('проба');
-select * from t1;
-create table t2 select ifnull(a,a) from t1;
-show create table t2;
-select * from t2;
-drop table t1;
-drop table t2;
-
-#
-# Bug 4521: unique key prefix interacts poorly with utf8
-# MYISAM: keys with prefix compression, case insensitive collation.
-#
-create table t1 (c varchar(30) character set utf8, unique(c(10)));
-insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
-insert into t1 values ('aaaaaaaaaa');
---error ER_DUP_ENTRY
-insert into t1 values ('aaaaaaaaaaa');
---error ER_DUP_ENTRY
-insert into t1 values ('aaaaaaaaaaaa');
-insert into t1 values (repeat('b',20));
-select c c1 from t1 where c='1';
-select c c2 from t1 where c='2';
-select c c3 from t1 where c='3';
-select c cx from t1 where c='x';
-select c cy from t1 where c='y';
-select c cz from t1 where c='z';
-select c ca10 from t1 where c='aaaaaaaaaa';
-select c cb20 from t1 where c=repeat('b',20);
-drop table t1;
-
-#
-# Bug 4521: unique key prefix interacts poorly with utf8
-# InnoDB: keys with prefix compression, case insensitive collation.
-#
-create table t1 (c varchar(30) character set utf8, unique(c(10))) engine=innodb;
-insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
-insert into t1 values ('aaaaaaaaaa');
---error ER_DUP_ENTRY
-insert into t1 values ('aaaaaaaaaaa');
---error ER_DUP_ENTRY
-insert into t1 values ('aaaaaaaaaaaa');
-insert into t1 values (repeat('b',20));
-select c c1 from t1 where c='1';
-select c c2 from t1 where c='2';
-select c c3 from t1 where c='3';
-select c cx from t1 where c='x';
-select c cy from t1 where c='y';
-select c cz from t1 where c='z';
-select c ca10 from t1 where c='aaaaaaaaaa';
-select c cb20 from t1 where c=repeat('b',20);
-drop table t1;
-#
-# Bug 4521: unique key prefix interacts poorly with utf8
-# MYISAM: fixed length keys, case insensitive collation
-#
-create table t1 (c char(3) character set utf8, unique (c(2)));
-insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
-insert into t1 values ('a');
-insert into t1 values ('aa');
---error ER_DUP_ENTRY
-insert into t1 values ('aaa');
-insert into t1 values ('b');
-insert into t1 values ('bb');
---error ER_DUP_ENTRY
-insert into t1 values ('bbb');
-insert into t1 values ('а');
-insert into t1 values ('аа');
---error ER_DUP_ENTRY
-insert into t1 values ('ааа');
-insert into t1 values ('б');
-insert into t1 values ('бб');
---error ER_DUP_ENTRY
-insert into t1 values ('ббб');
-insert into t1 values ('ꪪ');
-insert into t1 values ('ꪪꪪ');
---error ER_DUP_ENTRY
-insert into t1 values ('ꪪꪪꪪ');
-drop table t1;
-#
-# Bug 4521: unique key prefix interacts poorly with utf8
-# InnoDB: fixed length keys, case insensitive collation
-#
-create table t1 (c char(3) character set utf8, unique (c(2))) engine=innodb;
-insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
-insert into t1 values ('a');
-insert into t1 values ('aa');
---error ER_DUP_ENTRY
-insert into t1 values ('aaa');
-insert into t1 values ('b');
-insert into t1 values ('bb');
---error ER_DUP_ENTRY
-insert into t1 values ('bbb');
-insert into t1 values ('а');
-insert into t1 values ('аа');
---error ER_DUP_ENTRY
-insert into t1 values ('ааа');
-insert into t1 values ('б');
-insert into t1 values ('бб');
---error ER_DUP_ENTRY
-insert into t1 values ('ббб');
-insert into t1 values ('ꪪ');
-insert into t1 values ('ꪪꪪ');
---error ER_DUP_ENTRY
-insert into t1 values ('ꪪꪪꪪ');
-drop table t1;
-#
-# Bug 4531: unique key prefix interacts poorly with utf8
-# Check HEAP+HASH, case insensitive collation
-#
-create table t1 (
-c char(10) character set utf8,
-unique key a using hash (c(1))
-) engine=heap;
-show create table t1;
-insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
---error ER_DUP_ENTRY
-insert into t1 values ('aa');
---error ER_DUP_ENTRY
-insert into t1 values ('aaa');
-insert into t1 values ('б');
---error ER_DUP_ENTRY
-insert into t1 values ('бб');
---error ER_DUP_ENTRY
-insert into t1 values ('ббб');
-select c as c_all from t1 order by c;
-select c as c_a from t1 where c='a';
-select c as c_a from t1 where c='б';
-drop table t1;
-
-#
-# Bug 4531: unique key prefix interacts poorly with utf8
-# Check HEAP+BTREE, case insensitive collation
-#
-create table t1 (
-c char(10) character set utf8,
-unique key a using btree (c(1))
-) engine=heap;
-show create table t1;
-insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
---error ER_DUP_ENTRY
-insert into t1 values ('aa');
---error ER_DUP_ENTRY
-insert into t1 values ('aaa');
-insert into t1 values ('б');
---error ER_DUP_ENTRY
-insert into t1 values ('бб');
---error ER_DUP_ENTRY
-insert into t1 values ('ббб');
-select c as c_all from t1 order by c;
-select c as c_a from t1 where c='a';
-select c as c_a from t1 where c='б';
-drop table t1;
-
-#
-# Bug 4531: unique key prefix interacts poorly with utf8
-# Check BDB, case insensitive collation
-#
-create table t1 (
-c char(10) character set utf8,
-unique key a (c(1))
-) engine=innodb;
-insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
---error ER_DUP_ENTRY
-insert into t1 values ('aa');
---error ER_DUP_ENTRY
-insert into t1 values ('aaa');
-insert into t1 values ('б');
---error ER_DUP_ENTRY
-insert into t1 values ('бб');
---error ER_DUP_ENTRY
-insert into t1 values ('ббб');
-select c as c_all from t1 order by c;
-select c as c_a from t1 where c='a';
-select c as c_a from t1 where c='б';
-drop table t1;
-
-#
-# Bug 4521: unique key prefix interacts poorly with utf8
-# MYISAM: keys with prefix compression, binary collation.
-#
-create table t1 (c varchar(30) character set utf8 collate utf8_bin, unique(c(10)));
-insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
-insert into t1 values ('aaaaaaaaaa');
---error ER_DUP_ENTRY
-insert into t1 values ('aaaaaaaaaaa');
---error ER_DUP_ENTRY
-insert into t1 values ('aaaaaaaaaaaa');
-insert into t1 values (repeat('b',20));
-select c c1 from t1 where c='1';
-select c c2 from t1 where c='2';
-select c c3 from t1 where c='3';
-select c cx from t1 where c='x';
-select c cy from t1 where c='y';
-select c cz from t1 where c='z';
-select c ca10 from t1 where c='aaaaaaaaaa';
-select c cb20 from t1 where c=repeat('b',20);
-drop table t1;
-
-#
-# Bug 4521: unique key prefix interacts poorly with utf8
-# MYISAM: fixed length keys, binary collation
-#
-create table t1 (c char(3) character set utf8 collate utf8_bin, unique (c(2)));
-insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
-insert into t1 values ('a');
-insert into t1 values ('aa');
---error ER_DUP_ENTRY
-insert into t1 values ('aaa');
-insert into t1 values ('b');
-insert into t1 values ('bb');
---error ER_DUP_ENTRY
-insert into t1 values ('bbb');
-insert into t1 values ('а');
-insert into t1 values ('аа');
---error ER_DUP_ENTRY
-insert into t1 values ('ааа');
-insert into t1 values ('б');
-insert into t1 values ('бб');
---error ER_DUP_ENTRY
-insert into t1 values ('ббб');
-insert into t1 values ('ꪪ');
-insert into t1 values ('ꪪꪪ');
---error ER_DUP_ENTRY
-insert into t1 values ('ꪪꪪꪪ');
-drop table t1;
-
-#
-# Bug 4531: unique key prefix interacts poorly with utf8
-# Check HEAP+HASH, binary collation
-#
-create table t1 (
-c char(10) character set utf8 collate utf8_bin,
-unique key a using hash (c(1))
-) engine=heap;
-show create table t1;
-insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
---error ER_DUP_ENTRY
-insert into t1 values ('aa');
---error ER_DUP_ENTRY
-insert into t1 values ('aaa');
-insert into t1 values ('б');
---error ER_DUP_ENTRY
-insert into t1 values ('бб');
---error ER_DUP_ENTRY
-insert into t1 values ('ббб');
-select c as c_all from t1 order by c;
-select c as c_a from t1 where c='a';
-select c as c_a from t1 where c='б';
-drop table t1;
-
-#
-# Bug 4531: unique key prefix interacts poorly with utf8
-# Check HEAP+BTREE, binary collation
-#
-create table t1 (
-c char(10) character set utf8 collate utf8_bin,
-unique key a using btree (c(1))
-) engine=heap;
-show create table t1;
-insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
---error ER_DUP_ENTRY
-insert into t1 values ('aa');
---error ER_DUP_ENTRY
-insert into t1 values ('aaa');
-insert into t1 values ('б');
---error ER_DUP_ENTRY
-insert into t1 values ('бб');
---error ER_DUP_ENTRY
-insert into t1 values ('ббб');
-select c as c_all from t1 order by c;
-select c as c_a from t1 where c='a';
-select c as c_a from t1 where c='б';
-drop table t1;
-
-#
-# Bug 4531: unique key prefix interacts poorly with utf8
-# Check BDB, binary collation
-#
-create table t1 (
-c char(10) character set utf8 collate utf8_bin,
-unique key a (c(1))
-) engine=innodb;
-insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
---error ER_DUP_ENTRY
-insert into t1 values ('aa');
---error ER_DUP_ENTRY
-insert into t1 values ('aaa');
-insert into t1 values ('б');
---error ER_DUP_ENTRY
-insert into t1 values ('бб');
---error ER_DUP_ENTRY
-insert into t1 values ('ббб');
-select c as c_all from t1 order by c;
-select c as c_a from t1 where c='a';
-select c as c_a from t1 where c='б';
-drop table t1;
-
-
-# Bug#4594: column index make = failed for gbk, but like works
-# Check MYISAM
-#
-create table t1 (
- str varchar(255) character set utf8 not null,
- key str (str(2))
-) engine=myisam;
-INSERT INTO t1 VALUES ('str');
-INSERT INTO t1 VALUES ('str2');
-select * from t1 where str='str';
-drop table t1;
-
-# Bug#4594: column index make = failed for gbk, but like works
-# Check InnoDB
-#
-create table t1 (
- str varchar(255) character set utf8 not null,
- key str (str(2))
-) engine=innodb;
-INSERT INTO t1 VALUES ('str');
-INSERT INTO t1 VALUES ('str2');
-select * from t1 where str='str';
-drop table t1;
-
-# the same for HEAP+BTREE
-#
-
-create table t1 (
- str varchar(255) character set utf8 not null,
- key str using btree (str(2))
-) engine=heap;
-INSERT INTO t1 VALUES ('str');
-INSERT INTO t1 VALUES ('str2');
-select * from t1 where str='str';
-drop table t1;
-
-# the same for HEAP+HASH
-#
-
-create table t1 (
- str varchar(255) character set utf8 not null,
- key str using hash (str(2))
-) engine=heap;
-INSERT INTO t1 VALUES ('str');
-INSERT INTO t1 VALUES ('str2');
-select * from t1 where str='str';
-drop table t1;
-
-# the same for BDB
-#
-
-create table t1 (
- str varchar(255) character set utf8 not null,
- key str (str(2))
-) engine=innodb;
-INSERT INTO t1 VALUES ('str');
-INSERT INTO t1 VALUES ('str2');
-select * from t1 where str='str';
-drop table t1;
-
-#
-# Bug #5397: Crash with varchar binary and LIKE
-#
-CREATE TABLE t1 (a varchar(32) BINARY) CHARACTER SET utf8;
-INSERT INTO t1 VALUES ('test');
-SELECT a FROM t1 WHERE a LIKE '%te';
-DROP TABLE t1;
-
-#
-# Bug #5723: length(<varchar utf8 field>) returns varying results
-#
-SET NAMES utf8;
-CREATE TABLE t1 (
- subject varchar(255) character set utf8 collate utf8_unicode_ci,
- p varchar(15) character set utf8
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-INSERT INTO t1 VALUES ('谷川俊二と申しますが、インターネット予約の会員登録をしましたところ、メールアドレスを間違えてしまい会員IDが受け取ることが出来ませんでした。間違えアドレスはtani-shun@n.vodafone.ne.jpを書き込みました。どうすればよいですか? その他、住所等は間違えありません。連絡ください。よろしくお願いします。m(__)m','040312-000057');
-INSERT INTO t1 VALUES ('aaa','bbb');
-SELECT length(subject) FROM t1;
-SELECT length(subject) FROM t1 ORDER BY 1;
-DROP TABLE t1;
-
-#
-# Bug #5832 SELECT doesn't return records in some cases
-#
-CREATE TABLE t1 (
- id int unsigned NOT NULL auto_increment,
- list_id smallint unsigned NOT NULL,
- term TEXT NOT NULL,
- PRIMARY KEY(id),
- INDEX(list_id, term(4))
-) ENGINE=MYISAM CHARSET=utf8;
-INSERT INTO t1 SET list_id = 1, term = "letterc";
-INSERT INTO t1 SET list_id = 1, term = "letterb";
-INSERT INTO t1 SET list_id = 1, term = "lettera";
-INSERT INTO t1 SET list_id = 1, term = "letterd";
-SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterc");
-SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterb");
-SELECT id FROM t1 WHERE (list_id = 1) AND (term = "lettera");
-SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterd");
-DROP TABLE t1;
-
-
-#
-# Bug #6043 erratic searching for diacriticals in indexed MyISAM UTF-8 table
-#
-SET NAMES latin1;
-CREATE TABLE t1 (
- id int unsigned NOT NULL auto_increment,
- list_id smallint unsigned NOT NULL,
- term text NOT NULL,
- PRIMARY KEY(id),
- INDEX(list_id, term(19))
-) ENGINE=MyISAM CHARSET=utf8;
-INSERT INTO t1 set list_id = 1, term = "testtest";
-INSERT INTO t1 set list_id = 1, term = "testetest";
-INSERT INTO t1 set list_id = 1, term = "testtest";
-SELECT id, term FROM t1 where (list_id = 1) AND (term = "testtest");
-SELECT id, term FROM t1 where (list_id = 1) AND (term = "testetest");
-SELECT id, term FROM t1 where (list_id = 1) AND (term = "testtest");
-DROP TABLE t1;
-
-#
-# Bug #6019 SELECT tries to use too short prefix index on utf8 data
-#
-set names utf8;
-create table t1 (
- a int primary key,
- b varchar(6),
- index b3(b(3))
-) engine=innodb character set=utf8;
-insert into t1 values(1,'foo'),(2,'foobar');
-select * from t1 where b like 'foob%';
-alter table t1 engine=innodb;
-select * from t1 where b like 'foob%';
-drop table t1;
-
-#
-# Test for calculate_interval_lengths() function
-#
-create table t1 (
- a enum('петя','вася','анюта') character set utf8 not null default 'анюта',
- b set('петя','вася','анюта') character set utf8 not null default 'анюта'
-);
-create table t2 select concat(a,_utf8'') as a, concat(b,_utf8'')as b from t1;
-show create table t2;
-drop table t2;
-drop table t1;
-
-#
-# Bug #6787 LIKE not working properly with _ and utf8 data
-#
-select 'c' like '\_' as want0;
-
-#
-# SUBSTR with negative offset didn't work with multi-byte strings
-#
-SELECT SUBSTR('вася',-2);
-
-
-#
-# Bug #7730 Server crash using soundex on an utf8 table
-#
-create table t1 (id integer, a varchar(100) character set utf8 collate utf8_unicode_ci);
-insert into t1 values (1, 'Test');
-select * from t1 where soundex(a) = soundex('Test');
-select * from t1 where soundex(a) = soundex('TEST');
-select * from t1 where soundex(a) = soundex('test');
-drop table t1;
-
-#
-# Bug#22638 SOUNDEX broken for international characters
-#
-select soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB);
-select hex(soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB));
-select soundex(_utf8 0xD091D092D093);
-select hex(soundex(_utf8 0xD091D092D093));
-
-
-SET collation_connection='utf8_general_ci';
--- source include/ctype_filesort.inc
--- source include/ctype_like_escape.inc
--- source include/ctype_german.inc
--- source include/ctype_str_to_date.inc
-SET collation_connection='utf8_bin';
--- source include/ctype_filesort.inc
--- source include/ctype_like_escape.inc
-
-#
-# Bug #7874 CONCAT() gives wrong results mixing
-# latin1 field and utf8 string literals
-#
-CREATE TABLE t1 (
- user varchar(255) NOT NULL default ''
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-INSERT INTO t1 VALUES ('one'),('two');
-SELECT CHARSET('a');
-SELECT user, CONCAT('<', user, '>') AS c FROM t1;
-DROP TABLE t1;
-
-#
-# Bug#8785
-# the same problem with the above, but with nested CONCATs
-#
-create table t1 (f1 varchar(1) not null) default charset utf8;
-insert into t1 values (''), ('');
-select concat(concat(_latin1'->',f1),_latin1'<-') from t1;
-drop table t1;
-
-#
-# Bug#8385: utf8_general_ci treats Cyrillic letters I and SHORT I as the same
-#
-select convert(_koi8r'' using utf8) < convert(_koi8r'' using utf8);
-
-#
-# Bugs#5980: NULL requires a characterset in a union
-#
-set names latin1;
-create table t1 (a varchar(10)) character set utf8;
-insert into t1 values ('test');
-select ifnull(a,'') from t1;
-drop table t1;
-select repeat(_utf8'+',3) as h union select NULL;
-select ifnull(NULL, _utf8'string');
-
-#
-# Bug#9509 Optimizer: wrong result after AND with comparisons
-#
-set names utf8;
-create table t1 (s1 char(5) character set utf8 collate utf8_lithuanian_ci);
-insert into t1 values ('I'),('K'),('Y');
-select * from t1 where s1 < 'K' and s1 = 'Y';
-select * from t1 where 'K' > s1 and s1 = 'Y';
-drop table t1;
-
-create table t1 (s1 char(5) character set utf8 collate utf8_czech_ci);
-insert into t1 values ('c'),('d'),('h'),('ch'),('CH'),('cH'),('Ch'),('i');
-select * from t1 where s1 > 'd' and s1 = 'CH';
-select * from t1 where 'd' < s1 and s1 = 'CH';
-select * from t1 where s1 = 'cH' and s1 <> 'ch';
-select * from t1 where 'cH' = s1 and s1 <> 'ch';
-drop table t1;
-
-#
-# Bug#10714: Inserting double value into utf8 column crashes server
-#
-create table t1 (a varchar(255)) default character set utf8;
-insert into t1 values (1.0);
-drop table t1;
-
-#
-# Bug#10253 compound index length and utf8 char set
-# produces invalid query results
-#
-create table t1 (
- id int not null,
- city varchar(20) not null,
- key (city(7),id)
-) character set=utf8;
-insert into t1 values (1,'Durban North');
-insert into t1 values (2,'Durban');
-select * from t1 where city = 'Durban';
-select * from t1 where city = 'Durban ';
-drop table t1;
-
-#
-# Bug #11819 CREATE TABLE with a SET DEFAULT 0 and UTF8 crashes server.
-#
---error 1067
-create table t1 (x set('A', 'B') default 0) character set utf8;
---error 1067
-create table t1 (x enum('A', 'B') default 0) character set utf8;
-
-
-#
-# Test for bug #11167: join for utf8 varchar value longer than 255 bytes
-#
-
-SET NAMES UTF8;
-
-CREATE TABLE t1 (
- `id` int(20) NOT NULL auto_increment,
- `country` varchar(100) NOT NULL default '',
- `shortcode` varchar(100) NOT NULL default '',
- `operator` varchar(100) NOT NULL default '',
- `momid` varchar(30) NOT NULL default '',
- `keyword` varchar(160) NOT NULL default '',
- `content` varchar(160) NOT NULL default '',
- `second_token` varchar(160) default NULL,
- `gateway_id` int(11) NOT NULL default '0',
- `created` datetime NOT NULL default '0000-00-00 00:00:00',
- `msisdn` varchar(15) NOT NULL default '',
- PRIMARY KEY (`id`),
- UNIQUE KEY `MSCCSPK_20030521130957121` (`momid`),
- KEY `IX_mobile_originated_message_keyword` (`keyword`),
- KEY `IX_mobile_originated_message_created` (`created`),
- KEY `IX_mobile_originated_message_support` (`msisdn`,`momid`,`keyword`,`gateway_id`,`created`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-
-INSERT INTO t1 VALUES
-(1,'blah','464','aaa','fkc1c9ilc20x0hgae7lx6j09','ERR','ERR Имри.Афимим.Аеимимримдмримрмрирор имримримримр имридм ирбднримрфмририримрфмфмим.Ад.Д имдимримрад.Адимримримрмдиримримримр м.Дадимфшьмримд им.Адимимрн имадми','ИМРИ.АФИМИМ.АЕИМИМРИМДМРИМРМРИРОР',3,'2005-06-01 17:30:43','1234567890'),
-(2,'blah','464','aaa','haxpl2ilc20x00bj4tt2m5ti','11','11 g','G',3,'2005-06-02 22:43:10','1234567890');
-
-CREATE TABLE t2 (
- `msisdn` varchar(15) NOT NULL default '',
- `operator_id` int(11) NOT NULL default '0',
- `created` datetime NOT NULL default '0000-00-00 00:00:00',
- UNIQUE KEY `PK_user` (`msisdn`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
-INSERT INTO t2 VALUES ('1234567890',2,'2005-05-24 13:53:25');
-
-SELECT content, t2.msisdn FROM t1, t2 WHERE t1.msisdn = '1234567890';
-
-DROP TABLE t1,t2;
-
-#
-# Bug#11591: CHAR column with utf8 does not work properly
-# (more chars than expected)
-#
-create table t1 (a char(20) character set utf8);
-insert into t1 values ('123456'),('андрей');
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-alter table t1 modify a char(2) character set utf8;
-select char_length(a), length(a), a from t1 order by a;
-drop table t1;
-
-#
-# Bugs#12611
-# ESCAPE + LIKE do not work when the escape char is a multibyte one
-#
-set names utf8;
-select 'andre%' like 'andreñ%' escape 'ñ';
-
-#
-# Bugs#11754: SET NAMES utf8 followed by SELECT "A\\" LIKE "A\\" returns 0
-#
-set names utf8;
-select 'a\\' like 'a\\';
-select 'aa\\' like 'a%\\';
-
-create table t1 (a char(10), key(a)) character set utf8;
-insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test");
-select * from t1 where a like "abc%";
-select * from t1 where a like concat("abc","%");
-select * from t1 where a like "ABC%";
-select * from t1 where a like "test%";
-select * from t1 where a like "te_t";
-select * from t1 where a like "%a%";
-select * from t1 where a like "%abcd%";
-select * from t1 where a like "%abc\d%";
-drop table t1;
-
-
-#
-# Bug#9557 MyISAM utf8 table crash
-#
-CREATE TABLE t1 (
- a varchar(255) NOT NULL default '',
- KEY a (a)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE utf8_general_ci;
-insert into t1 values (_utf8 0xe880bd);
-insert into t1 values (_utf8 0x5b);
-select hex(a) from t1;
-drop table t1;
-
-#
-# Bug#13751 find_in_set: Illegal mix of collations
-#
-set names 'latin1';
-create table t1 (a varchar(255)) default charset=utf8;
-select * from t1 where find_in_set('-1', a);
-drop table t1;
-
-#
-# Bug#13233: select distinct char(column) fails with utf8
-#
-create table t1 (a int);
-insert into t1 values (48),(49),(50);
-set names utf8;
-select distinct char(a) from t1;
-drop table t1;
-
-#
-# Bug#15581: COALESCE function truncates mutli-byte TINYTEXT values
-#
-CREATE TABLE t1 (t TINYTEXT CHARACTER SET utf8);
-INSERT INTO t1 VALUES(REPEAT('a', 100));
-CREATE TEMPORARY TABLE t2 SELECT COALESCE(t) AS bug FROM t1;
-SELECT LENGTH(bug) FROM t2;
-DROP TABLE t2;
-DROP TABLE t1;
-
-#
-# Bug#17313: N'xxx' and _utf8'xxx' are not equivalent
-#
-CREATE TABLE t1 (item varchar(255)) default character set utf8;
-INSERT INTO t1 VALUES (N'\\');
-INSERT INTO t1 VALUES (_utf8'\\');
-INSERT INTO t1 VALUES (N'Cote d\'Ivoire');
-INSERT INTO t1 VALUES (_utf8'Cote d\'Ivoire');
-SELECT item FROM t1 ORDER BY item;
-DROP TABLE t1;
-
-#
-# Bug#17705: Corruption of compressed index when index length changes between
-# 254 and 256
-#
-
-SET NAMES utf8;
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1(a VARCHAR(255), KEY(a)) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
-INSERT INTO t1 VALUES('uu');
-check table t1;
-INSERT INTO t1 VALUES('uU');
-check table t1;
-INSERT INTO t1 VALUES('uu');
-check table t1;
-INSERT INTO t1 VALUES('uuABC');
-check table t1;
-INSERT INTO t1 VALUES('UuABC');
-check table t1;
-INSERT INTO t1 VALUES('uuABC');
-check table t1;
-alter table t1 add b int;
-INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',1);
-INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',2);
-delete from t1 where b=1;
-INSERT INTO t1 VALUES('UUABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',1);
-check table t1;
-INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',3);
-INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',4);
-delete from t1 where b=3;
-INSERT INTO t1 VALUES('uUABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',3);
-check table t1;
-drop table t1;
-
-#
-# Bug#20471 LIKE search fails with indexed utf8 char column
-#
-set names utf8;
-create table t1 (s1 char(5) character set utf8);
-insert into t1 values
-('a'),('b'),(null),('ペテルグル'),('ü'),('Y');
-create index it1 on t1 (s1);
-select s1 as before_delete_general_ci from t1 where s1 like 'ペテ%';
-delete from t1 where s1 = 'Y';
-select s1 as after_delete_general_ci from t1 where s1 like 'ペテ%';
-drop table t1;
-
-set names utf8;
-create table t1 (s1 char(5) character set utf8 collate utf8_unicode_ci);
-insert into t1 values
-('a'),('b'),(null),('ペテルグル'),('ü'),('Y');
-create index it1 on t1 (s1);
-select s1 as before_delete_unicode_ci from t1 where s1 like 'ペテ%';
-delete from t1 where s1 = 'Y';
-select s1 as after_delete_unicode_ci from t1 where s1 like 'ペテ%';
-drop table t1;
-
-set names utf8;
-create table t1 (s1 char(5) character set utf8 collate utf8_bin);
-insert into t1 values
-('a'),('b'),(null),('ペテルグル'),('ü'),('Y');
-create index it1 on t1 (s1);
-select s1 as before_delete_bin from t1 where s1 like 'ペテ%';
-delete from t1 where s1 = 'Y';
-select s1 as after_delete_bin from t1 where s1 like 'ペテ%';
-drop table t1;
-
-# additional tests from duplicate bug#20744 MySQL return no result
-
-set names utf8;
-create table t1 (a varchar(30) not null primary key)
-engine=innodb default character set utf8 collate utf8_general_ci;
-insert into t1 values ('あいうえおかきくけこさしすせそ');
-insert into t1 values ('さしすせそかきくけこあいうえお');
-select a as gci1 from t1 where a like 'さしすせそかきくけこあいうえお%';
-select a as gci2 from t1 where a like 'あいうえおかきくけこさしすせそ';
-drop table t1;
-
-set names utf8;
-create table t1 (a varchar(30) not null primary key)
-engine=innodb default character set utf8 collate utf8_unicode_ci;
-insert into t1 values ('あいうえおかきくけこさしすせそ');
-insert into t1 values ('さしすせそかきくけこあいうえお');
-select a as uci1 from t1 where a like 'さしすせそかきくけこあいうえお%';
-select a as uci2 from t1 where a like 'あいうえおかきくけこさしすせそ';
-drop table t1;
-
-set names utf8;
-create table t1 (a varchar(30) not null primary key)
-engine=innodb default character set utf8 collate utf8_bin;
-insert into t1 values ('あいうえおかきくけこさしすせそ');
-insert into t1 values ('さしすせそかきくけこあいうえお');
-select a as bin1 from t1 where a like 'さしすせそかきくけこあいうえお%';
-select a as bin2 from t1 where a like 'あいうえおかきくけこさしすせそ';
-drop table t1;
-
-
-
-#
-# Bug#14896: Comparison with a key in a partial index over mb chararacter field
-#
-
-SET NAMES utf8;
-CREATE TABLE t1 (id int PRIMARY KEY,
- a varchar(16) collate utf8_unicode_ci NOT NULL default '',
- b int,
- f varchar(128) default 'XXX',
- INDEX (a(4))
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-INSERT INTO t1(id, a, b) VALUES
- (1, 'cccc', 50), (2, 'cccc', 70), (3, 'cccc', 30),
- (4, 'cccc', 30), (5, 'cccc', 20), (6, 'bbbbbb', 40),
- (7, 'dddd', 30), (8, 'aaaa', 10), (9, 'aaaa', 50),
- (10, 'eeeee', 40), (11, 'bbbbbb', 60);
-
-SELECT id, a, b FROM t1;
-
-SELECT id, a, b FROM t1 WHERE a BETWEEN 'aaaa' AND 'bbbbbb';
-
-SELECT id, a FROM t1 WHERE a='bbbbbb';
-SELECT id, a FROM t1 WHERE a='bbbbbb' ORDER BY b;
-
-DROP TABLE t1;
-
-#
-# Bug#16674: LIKE predicate for a utf8 character set column
-#
-
-SET NAMES utf8;
-
-CREATE TABLE t1 (
- a CHAR(13) DEFAULT '',
- INDEX(a)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-INSERT INTO t1 VALUES
- ('Käli Käli 2-4'), ('Käli Käli 2-4'),
- ('Käli Käli 2+4'), ('Käli Käli 2+4'),
- ('Käli Käli 2-6'), ('Käli Käli 2-6');
-INSERT INTO t1 SELECT * FROM t1;
-
-CREATE TABLE t2 (
- a CHAR(13) DEFAULT '',
- INDEX(a)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
-
-INSERT INTO t2 VALUES
- ('Kali Kali 2-4'), ('Kali Kali 2-4'),
- ('Kali Kali 2+4'), ('Kali Kali 2+4'),
- ('Kali Kali 2-6'), ('Kali Kali 2-6');
-INSERT INTO t2 SELECT * FROM t2;
-
-SELECT a FROM t1 WHERE a LIKE 'Käli Käli 2+4';
-SELECT a FROM t2 WHERE a LIKE 'Kali Kali 2+4';
-
-EXPLAIN SELECT a FROM t1 WHERE a LIKE 'Käli Käli 2+4';
-EXPLAIN SELECT a FROM t1 WHERE a = 'Käli Käli 2+4';
-EXPLAIN SELECT a FROM t2 WHERE a LIKE 'Kali Kali 2+4';
-EXPLAIN SELECT a FROM t2 WHERE a = 'Kali Kali 2+4';
-
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (
- a char(255) DEFAULT '',
- KEY(a(10))
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-INSERT INTO t1 VALUES ('Käli Käli 2-4');
-SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%';
-INSERT INTO t1 VALUES ('Käli Käli 2-4');
-SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%';
-DROP TABLE t1;
-
-CREATE TABLE t1 (
- a char(255) DEFAULT ''
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-INSERT INTO t1 VALUES ('Käli Käli 2-4');
-INSERT INTO t1 VALUES ('Käli Käli 2-4');
-SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%';
-ALTER TABLE t1 ADD KEY (a(10));
-SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%';
-DROP TABLE t1;
-
-#
-# Bug#18359: LIKE predicate for a 'utf8' text column with a partial index
-# (see bug #16674 as well)
-#
-
-SET NAMES latin2;
-
-CREATE TABLE t1 (
- id int(11) NOT NULL default '0',
- tid int(11) NOT NULL default '0',
- val text NOT NULL,
- INDEX idx(tid, val(10))
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-
-INSERT INTO t1 VALUES
- (40988,72,'VOLN ADSL'),(41009,72,'VOLN ADSL'),
- (41032,72,'VOLN ADSL'),(41038,72,'VOLN ADSL'),
- (41063,72,'VOLN ADSL'),(41537,72,'VOLN ADSL Office'),
- (42141,72,'VOLN ADSL'),(42565,72,'VOLN ADSL Combi'),
- (42749,72,'VOLN ADSL'),(44205,72,'VOLN ADSL');
-
-SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLNY ADSL';
-SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLN ADSL';
-SELECT * FROM t1 WHERE tid=72 and val LIKE '%VOLN ADSL';
-
-ALTER TABLE t1 DROP KEY idx;
-ALTER TABLE t1 ADD KEY idx (tid,val(11));
-
-SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLN ADSL';
-
-DROP TABLE t1;
-
-#
-# Bug 20709: problem with utf8 fields in temporary tables
-#
-
-create table t1(a char(200) collate utf8_unicode_ci NOT NULL default '')
- default charset=utf8 collate=utf8_unicode_ci;
-insert into t1 values (unhex('65')), (unhex('C3A9')), (unhex('65'));
--- disable_query_log
--- disable_result_log
-analyze table t1;
--- enable_result_log
--- enable_query_log
-explain select distinct a from t1;
-select distinct a from t1;
-explain select a from t1 group by a;
-select a from t1 group by a;
-drop table t1;
-
-#
-# Bug #20204: "order by" changes the results returned
-#
-
-create table t1(a char(10)) default charset utf8;
-insert into t1 values ('123'), ('456');
--- disable_query_log
--- disable_result_log
-analyze table t1;
--- enable_result_log
--- enable_query_log
-explain
- select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1;
-select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1;
-drop table t1;
-
-#
-# Bug #34349: Passing invalid parameter to CHAR() in an ORDER BY causes
-# MySQL to hang
-#
-
-SET CHARACTER SET utf8;
-SHOW VARIABLES LIKE 'character\_set\_%';
-CREATE DATABASE crashtest DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
-USE crashtest;
-CREATE TABLE crashtest (crash char(10)) DEFAULT CHARSET=utf8;
-INSERT INTO crashtest VALUES ('35'), ('36'), ('37');
-SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8);
-INSERT INTO crashtest VALUES ('-1000');
--- disable_query_log
--- disable_result_log
-ANALYZE TABLE crashtest;
--- enable_result_log
--- enable_query_log
-EXPLAIN SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8);
-SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8);
-DROP TABLE crashtest;
-DROP DATABASE crashtest;
-USE test;
-SET CHARACTER SET default;
-
-# End of 4.1 tests
-
-#
-# Test for bug #11484: wrong results for a DISTINCT varchar column in uft8.
-#
-
-CREATE TABLE t1(id varchar(20) NOT NULL) DEFAULT CHARSET=utf8;
-INSERT INTO t1 VALUES ('xxx'), ('aa'), ('yyy'), ('aa');
-
-SELECT id FROM t1;
-SELECT DISTINCT id FROM t1;
-SELECT DISTINCT id FROM t1 ORDER BY id;
-
-DROP TABLE t1;
-
-#
-# Bug#20095 Changing length of VARCHAR field with UTF8
-# collation does not truncate values
-#
-create table t1 (
- a varchar(26) not null
-) default character set utf8;
-insert into t1 (a) values ('abcdefghijklmnopqrstuvwxyz');
-select * from t1;
-# varchar to varchar
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-alter table t1 change a a varchar(20) character set utf8 not null;
-select * from t1;
-# varchar to char
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-alter table t1 change a a char(15) character set utf8 not null;
-select * from t1;
-# char to char
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-alter table t1 change a a char(10) character set utf8 not null;
-select * from t1;
-# char to varchar
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-alter table t1 change a a varchar(5) character set utf8 not null;
-select * from t1;
-drop table t1;
-
-#
-# Check that do_varstring2_mb produces a warning
-#
-create table t1 (
- a varchar(4000) not null
-) default character set utf8;
-insert into t1 values (repeat('a',4000));
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-alter table t1 change a a varchar(3000) character set utf8 not null;
-select length(a) from t1;
-drop table t1;
-
-
-#
-# Bug#10504: Character set does not support traditional mode
-# Bug#14146: CHAR(...USING ...) and CONVERT(CHAR(...) USING...)
-# produce different results
-#
-set names utf8;
-# correct value
-select hex(char(1 using utf8));
-select char(0xd1,0x8f using utf8);
-select char(0xd18f using utf8);
-select char(53647 using utf8);
-# incorrect value: return with warning
-select char(0xff,0x8f using utf8);
-select convert(char(0xff,0x8f) using utf8);
-# incorrect value in strict mode: return NULL with "Error" level warning
-set sql_mode=traditional;
-select char(0xff,0x8f using utf8);
-select char(195 using utf8);
-select char(196 using utf8);
-select char(2557 using utf8);
-select convert(char(0xff,0x8f) using utf8);
-
-#
-# Check convert + char + using
-#
-select hex(convert(char(2557 using latin1) using utf8));
-
-#
-# char() without USING returns "binary" by default, any argument is ok
-#
-select hex(char(195));
-select hex(char(196));
-select hex(char(2557));
-
-
-
-#
-# Bug#12891: UNION doesn't return DISTINCT result for multi-byte characters
-#
-set names utf8;
-create table t1 (a char(1)) default character set utf8;
-create table t2 (a char(1)) default character set utf8;
-insert into t1 values('a'),('a'),(0xE38182),(0xE38182);
-insert into t1 values('i'),('i'),(0xE38184),(0xE38184);
-select * from t1 union distinct select * from t2;
-drop table t1,t2;
-
-
-#
-# Bug#12371: executing prepared statement fails (illegal mix of collations)
-#
-set names utf8;
-create table t1 (a char(10), b varchar(10));
-insert into t1 values ('bar','kostja');
-insert into t1 values ('kostja','bar');
-prepare my_stmt from "select * from t1 where a=?";
-set @a:='bar';
-execute my_stmt using @a;
-set @a:='kostja';
-execute my_stmt using @a;
-set @a:=null;
-execute my_stmt using @a;
-drop table if exists t1;
-
-
-#
-# Bug#21505 Create view - illegal mix of collation for operation 'UNION'
-#
---disable_warnings
-drop table if exists t1;
-drop view if exists v1, v2;
---enable_warnings
-set names utf8;
-create table t1(col1 varchar(12) character set utf8 collate utf8_unicode_ci);
-insert into t1 values('t1_val');
-create view v1 as select 'v1_val' as col1;
-select coercibility(col1), collation(col1) from v1;
-create view v2 as select col1 from v1 union select col1 from t1;
-select coercibility(col1), collation(col1)from v2;
-drop view v1, v2;
-create view v1 as select 'v1_val' collate utf8_swedish_ci as col1;
-select coercibility(col1), collation(col1) from v1;
-create view v2 as select col1 from v1 union select col1 from t1;
-select coercibility(col1), collation(col1) from v2;
-drop view v1, v2;
-drop table t1;
-
-#
-# Check conversion of NCHAR strings to subset (e.g. latin1).
-# Conversion is possible if string repertoire is ASCII.
-# Conversion is not possible if the string have extended characters
-#
-set names utf8;
-create table t1 (a varchar(10) character set latin1, b int);
-insert into t1 values ('a',1);
-select concat(a, if(b>10, N'x', N'y')) from t1;
---error 1267
-select concat(a, if(b>10, N'æ', N'ß')) from t1;
-drop table t1;
-
-# Conversion tests for character set introducers
-set names utf8;
-create table t1 (a varchar(10) character set latin1, b int);
-insert into t1 values ('a',1);
-select concat(a, if(b>10, _utf8'x', _utf8'y')) from t1;
---error 1267
-select concat(a, if(b>10, _utf8'æ', _utf8'ß')) from t1;
-drop table t1;
-
-# Conversion tests for introducer + HEX string
-set names utf8;
-create table t1 (a varchar(10) character set latin1, b int);
-insert into t1 values ('a',1);
-select concat(a, if(b>10, _utf8 0x78, _utf8 0x79)) from t1;
---error 1267
-select concat(a, if(b>10, _utf8 0xC3A6, _utf8 0xC3AF)) from t1;
-drop table t1;
-
-# Conversion tests for "text_literal TEXT_STRING_literal" syntax structure
-set names utf8;
-create table t1 (a varchar(10) character set latin1, b int);
-insert into t1 values ('a',1);
-select concat(a, if(b>10, 'x' 'x', 'y' 'y')) from t1;
---error 1267
-select concat(a, if(b>10, 'x' 'æ', 'y' 'ß')) from t1;
-drop table t1;
-
-#
-# Bug#19960: Inconsistent results when joining
-# InnoDB tables using partial UTF8 indexes
-#
-
-CREATE TABLE t1 (
- colA int(11) NOT NULL,
- colB varchar(255) character set utf8 NOT NULL,
- PRIMARY KEY (colA)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-INSERT INTO t1 (colA, colB) VALUES (1, 'foo'), (2, 'foo bar');
-CREATE TABLE t2 (
- colA int(11) NOT NULL,
- colB varchar(255) character set utf8 NOT NULL,
- KEY bad (colA,colB(3))
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-INSERT INTO t2 (colA, colB) VALUES (1, 'foo'),(2, 'foo bar');
-SELECT * FROM t1 JOIN t2 ON t1.colA=t2.colA AND t1.colB=t2.colB
-WHERE t1.colA < 3;
-DROP TABLE t1, t2;
-
-#
-# Bug#29205: truncation of UTF8 values when the UNION statement
-# forces collation to the binary charset
-#
-
-SELECT 'н1234567890' UNION SELECT _binary '1';
-SELECT 'н1234567890' UNION SELECT 1;
-
-SELECT '1' UNION SELECT 'н1234567890';
-SELECT 1 UNION SELECT 'н1234567890';
-
-CREATE TABLE t1 (c VARCHAR(11)) CHARACTER SET utf8;
-CREATE TABLE t2 (b CHAR(1) CHARACTER SET binary, i INT);
-
-INSERT INTO t1 (c) VALUES ('н1234567890');
-INSERT INTO t2 (b, i) VALUES ('1', 1);
-
-SELECT c FROM t1 UNION SELECT b FROM t2;
-SELECT c FROM t1 UNION SELECT i FROM t2;
-
-SELECT b FROM t2 UNION SELECT c FROM t1;
-SELECT i FROM t2 UNION SELECT c FROM t1;
-
-DROP TABLE t1, t2;
-
-#
-# Bug#30982: CHAR(..USING..) can return a not-well-formed string
-# Bug #30986: Character set introducer followed by a HEX string can return bad result
-#
-set sql_mode=traditional;
-select hex(char(0xFF using utf8));
-select hex(convert(0xFF using utf8));
---error ER_INVALID_CHARACTER_STRING
-select hex(_utf8 0x616263FF);
---error ER_INVALID_CHARACTER_STRING
-select hex(_utf8 X'616263FF');
---error ER_INVALID_CHARACTER_STRING
-select hex(_utf8 B'001111111111');
---error ER_INVALID_CHARACTER_STRING
-select (_utf8 X'616263FF');
-set sql_mode=default;
-select hex(char(0xFF using utf8));
-select hex(convert(0xFF using utf8));
---error ER_INVALID_CHARACTER_STRING
-select hex(_utf8 0x616263FF);
---error ER_INVALID_CHARACTER_STRING
-select hex(_utf8 X'616263FF');
---error ER_INVALID_CHARACTER_STRING
-select hex(_utf8 B'001111111111');
---error ER_INVALID_CHARACTER_STRING
-select (_utf8 X'616263FF');
-
---echo #
---echo # Bug#44131 Binary-mode "order by" returns records in incorrect order for UTF-8 strings
---echo #
-CREATE TABLE t1 (id int not null primary key, name varchar(10)) character set utf8;
-INSERT INTO t1 VALUES
-(2,'一二三01'),(3,'一二三09'),(4,'一二三02'),(5,'一二三08'),
-(6,'一二三11'),(7,'一二三91'),(8,'一二三21'),(9,'一二三81');
-SELECT * FROM t1 ORDER BY BINARY(name);
-DROP TABLE t1;
-
-#
-# Bug #36772: When using UTF8, CONVERT with GROUP BY returns truncated results
-#
-CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL);
-INSERT INTO t1 VALUES (70000, 1092), (70001, 1085), (70002, 1065);
-SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
-SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1;
-ALTER TABLE t1 ADD UNIQUE (b);
-SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
-DROP INDEX b ON t1;
-SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
-ALTER TABLE t1 ADD INDEX (b);
-SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) from t1 GROUP BY b;
-DROP TABLE t1;
-
---echo End of 5.0 tests
-
-
-#
-# Bug #57272: crash in rpad() when using utf8
-#
-SELECT LENGTH(RPAD(0.0115E88, 61297, _utf8'яэюя'));
-SELECT LENGTH(RPAD(0.0115E88, 61297, _utf8'йцуя'));
-SELECT HEX(RPAD(0x20, 2, _utf8 0xD18F));
-SELECT HEX(RPAD(0x20, 4, _utf8 0xD18F));
-SELECT HEX(LPAD(0x20, 2, _utf8 0xD18F));
-SELECT HEX(LPAD(0x20, 4, _utf8 0xD18F));
-
-SELECT HEX(RPAD(_utf8 0xD18F, 3, 0x20));
-SELECT HEX(LPAD(_utf8 0xD18F, 3, 0x20));
-
-SELECT HEX(INSERT(_utf8 0xD18F, 2, 1, 0x20));
-SELECT HEX(INSERT(_utf8 0xD18FD18E, 2, 1, 0x20));
-
---echo #
---echo # Bug#11752408 - 43593: DUMP/BACKUP/RESTORE/UPGRADE TOOLS FAILS BECAUSE OF UTF8_GENERAL_CI
---echo #
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_general_mysql500_ci);
-INSERT INTO t1 VALUES ('a'),('r'),('s'),(_latin1 0xDF),(_latin1 0xF7),('t'),('z');
-SELECT * FROM t1 ORDER BY a;
-SELECT a, COUNT(*) FROM t1 GROUP BY a;
-DROP TABLE t1;
-
---echo End of 5.1 tests
-
-
---echo Start of 5.4 tests
-
-#
-# WL#1213: utf8mb3 is an alias for utf8
-#
-SET NAMES utf8mb3;
-SHOW VARIABLES LIKE 'character_set_results%';
-CREATE TABLE t1 (a CHAR CHARACTER SET utf8mb3 COLLATE utf8mb3_bin);
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-SELECT _utf8mb3'test';
-
-#
-# Bug#26180: Can't add columns to tables created with utf8 text indexes
-#
-CREATE TABLE t1 (
- clipid INT NOT NULL,
- Tape TINYTEXT,
- PRIMARY KEY (clipid),
- KEY tape(Tape(255))
-) CHARACTER SET=utf8;
-ALTER TABLE t1 ADD mos TINYINT DEFAULT 0 AFTER clipid;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-#
-# Bug#26474: Add Sinhala script (Sri Lanka) collation to MySQL
-#
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-CREATE TABLE t1 (
- predicted_order int NOT NULL,
- utf8_encoding VARCHAR(10) NOT NULL
-) CHARACTER SET utf8;
-INSERT INTO t1 VALUES (19, x'E0B696'), (30, x'E0B69AE0B798'), (61, x'E0B6AF'), (93, x'E0B799'), (52, x'E0B6A6'), (73, x'E0B6BBE0B78AE2808D'), (3, x'E0B686'), (56, x'E0B6AA'), (55, x'E0B6A9'), (70, x'E0B6B9'), (94, x'E0B79A'), (80, x'E0B785'), (25, x'E0B69AE0B791'), (48, x'E0B6A2'), (13, x'E0B690'), (86, x'E0B793'), (91, x'E0B79F'), (81, x'E0B786'), (79, x'E0B784'), (14, x'E0B691'), (99, x'E0B78A'), (8, x'E0B68B'), (68, x'E0B6B7'), (22, x'E0B69A'), (16, x'E0B693'), (33, x'E0B69AE0B7B3'), (38, x'E0B69AE0B79D'), (21, x'E0B683'), (11, x'E0B68E'), (77, x'E0B782'), (40, x'E0B69AE0B78A'), (101, x'E0B78AE2808DE0B6BB'), (35, x'E0B69AE0B79A'), (1, x'E0B7B4'), (9, x'E0B68C'), (96, x'E0B79C'), (6, x'E0B689'), (95, x'E0B79B'), (88, x'E0B796'), (64, x'E0B6B3'), (26, x'E0B69AE0B792'), (82, x'E0B78F'), (28, x'E0B69AE0B794'), (39, x'E0B69AE0B79E'), (97, x'E0B79D'), (2, x'E0B685'), (75, x'E0B780'), (34, x'E0B69AE0B799'), (69, x'E0B6B8'), (83, x'E0B790'), (18, x'E0B695'), (90, x'E0B7B2'), (17, x'E0B694'), (72, x'E0B6BB'), (66, x'E0B6B5'), (59, x'E0B6AD'), (44, x'E0B69E'), (15, x'E0B692'), (23, x'E0B69AE0B78F'), (65, x'E0B6B4'), (42, x'E0B69C'), (63, x'E0B6B1'), (85, x'E0B792'), (47, x'E0B6A1'), (49, x'E0B6A3'), (92, x'E0B7B3'), (78, x'E0B783'), (36, x'E0B69AE0B79B'), (4, x'E0B687'), (24, x'E0B69AE0B790'), (87, x'E0B794'), (37, x'E0B69AE0B79C'), (32, x'E0B69AE0B79F'), (29, x'E0B69AE0B796'), (43, x'E0B69D'), (62, x'E0B6B0'), (100, x'E0B78AE2808DE0B6BA'), (60, x'E0B6AE'), (45, x'E0B69F'), (12, x'E0B68F'), (46, x'E0B6A0'), (50, x'E0B6A5'), (51, x'E0B6A4'), (5, x'E0B688'), (76, x'E0B781'), (89, x'E0B798'), (74, x'E0B6BD'), (10, x'E0B68D'), (57, x'E0B6AB'), (71, x'E0B6BA'), (58, x'E0B6AC'), (27, x'E0B69AE0B793'), (54, x'E0B6A8'), (84, x'E0B791'), (31, x'E0B69AE0B7B2'), (98, x'E0B79E'), (53, x'E0B6A7'), (41, x'E0B69B'), (67, x'E0B6B6'), (7, x'E0B68A'), (20, x'E0B682');
-SELECT predicted_order, hex(utf8_encoding) FROM t1 ORDER BY utf8_encoding COLLATE utf8_sinhala_ci;
-DROP TABLE t1;
-#
-# Postfix for Bug#26474
-#
-SET NAMES utf8 COLLATE utf8_sinhala_ci;
-CREATE TABLE t1 (s1 VARCHAR(10) COLLATE utf8_sinhala_ci);
-INSERT INTO t1 VALUES ('a'),('ae'),('af');
-SELECT s1,hex(s1) FROM t1 ORDER BY s1;
-SELECT * FROM t1 ORDER BY s1;
-DROP TABLE t1;
-
---echo End of 5.4 tests
-
---echo #
---echo # Start of 5.5 tests
---echo #
-
---echo #
---echo # Bug#52520 Difference in tinytext utf column metadata
---echo #
-CREATE TABLE t1 (
- s1 TINYTEXT CHARACTER SET utf8,
- s2 TEXT CHARACTER SET utf8,
- s3 MEDIUMTEXT CHARACTER SET utf8,
- s4 LONGTEXT CHARACTER SET utf8
-);
---enable_metadata
-SET NAMES utf8, @@character_set_results=NULL;
-SELECT *, HEX(s1) FROM t1;
-SET NAMES latin1;
-SELECT *, HEX(s1) FROM t1;
-SET NAMES utf8;
-SELECT *, HEX(s1) FROM t1;
---disable_metadata
-CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t1, t2;
-
-
-SET NAMES utf8;
---source include/ctype_numconv.inc
-
---echo #
---echo # Bug#57687 crash when reporting duplicate group_key error and utf8
---echo # Bug#58081 Duplicate entry error when doing GROUP BY
---echo # MDEV-9332 Bug after upgrade to 10.1.10
---echo #
-SET NAMES utf8;
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (0), (0), (1), (0), (0);
-SELECT COUNT(*) FROM t1, t1 t2
-GROUP BY INSERT('', t2.a, t1.a, (@@global.max_binlog_size));
-DROP TABLE t1;
-
---echo #
---echo # Bug#11764503 (Bug#57341) Query in EXPLAIN EXTENDED shows wrong characters
---echo #
-# Emulate utf8 client erroneously started with --default-character-set=latin1,
-# as in the bug report. EXPLAIN output should still be pretty readable
-SET NAMES latin1;
-EXPLAIN EXTENDED SELECT 'abcdÁÂÃÄÅ', _latin1'abcdÁÂÃÄÅ', _utf8'abcdÁÂÃÄÅ' AS u;
-# Test normal utf8
-SET NAMES utf8;
-EXPLAIN EXTENDED SELECT 'abcdÁÂÃÄÅ', _latin1'abcdÁÂÃÄÅ', _utf8'abcdÁÂÃÄÅ';
-
---echo #
---echo # Bug#11750518 41090: ORDER BY TRUNCATES GROUP_CONCAT RESULT
---echo #
-
-SET NAMES utf8;
-SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l
-FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body
-UNION ALL
-SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1
-GROUP BY id
-ORDER BY l DESC;
-
-SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l
-FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body
-UNION ALL
-SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1;
-
---echo #
---echo # MDEV-7814 Assertion `args[0]->fixed' fails in Item_func_conv_charset::Item_func_conv_charset
---echo #
-CREATE TABLE t1(a CHAR(1) CHARACTER SET latin1, b INT NOT NULL);
-CREATE TABLE t2(a CHAR(1) CHARACTER SET utf8 COLLATE utf8_general_ci, b INT NOT NULL);
-SELECT (SELECT t2.a FROM t2 WHERE t2.a=t1.a) AS aa, b, COUNT(b) FROM t1 GROUP BY aa;
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-7649 wrong result when comparing utf8 column with an invalid literal
---echo #
-
-SET NAMES utf8 COLLATE utf8_general_ci;
---let ENGINE=InnoDB
---source include/ctype_utf8_ilseq.inc
---let ENGINE=MyISAM
---source include/ctype_utf8_ilseq.inc
---let ENGINE=HEAP
---source include/ctype_utf8_ilseq.inc
-
---echo #
---echo # MDEV-8067 correct fix for MySQL Bug # 19699237: UNINITIALIZED VARIABLE IN ITEM_FIELD::STR_RESULT
---echo #
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8);
-CREATE TABLE t2 (a VARCHAR(10) CHARACTER SET latin1);
-INSERT INTO t1 VALUES ('aaa');
-INSERT INTO t2 VALUES ('aaa');
-SELECT (SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2);
-INSERT INTO t1 VALUES ('aaa');
-INSERT INTO t2 VALUES ('aaa');
-# Running the below query crashed with two rows
---error ER_SUBQUERY_NO_1_ROW
-SELECT (SELECT CONCAT(a),1 FROM t1) <=> (SELECT CONCAT(a),1 FROM t2);
-DROP TABLE t1, t2;
-
---echo #
---echo # MDEV-8630 Datetime value dropped in "INSERT ... SELECT ... ON DUPLICATE KEY"
---echo #
-SET NAMES utf8;
-CREATE TABLE t1 (id2 int, ts timestamp);
-INSERT INTO t1 VALUES (1,'2012-06-11 15:17:34'),(2,'2012-06-11 15:18:24');
-CREATE TABLE t2 AS SELECT
- COALESCE(ts, 0) AS c0,
- GREATEST(COALESCE(ts, 0), COALESCE(ts, 0)) AS c1,
- GREATEST(CASE WHEN 1 THEN ts ELSE 0 END, CASE WHEN 1 THEN ts ELSE 0 END) AS c2,
- GREATEST(IFNULL(ts,0), IFNULL(ts,0)) AS c3,
- GREATEST(IF(1,ts,0), IF(1,ts,0)) AS c4
-FROM t1;
-SHOW CREATE TABLE t2;
-SELECT * FROM t2;
-DROP TABLE t2, t1;
-
---echo #
---echo # MDEV-9319 ALTER from a bigger to a smaller blob type truncates too much data
---echo #
-SET NAMES utf8;
-CREATE TABLE t1 (a TEXT CHARACTER SET utf8);
-INSERT INTO t1 VALUES (REPEAT('A',100));
-SELECT OCTET_LENGTH(a) FROM t1;
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-ALTER TABLE t1 MODIFY a TINYTEXT CHARACTER SET utf8;
-SELECT OCTET_LENGTH(a),a FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8402 Bug#77473 Bug#21317406 TRUNCATED DATA WITH SUBQUERY & UTF8
---echo #
---echo #
-
-SET NAMES utf8;
-SELECT length(rpad(_utf8 0xD0B1, 65536, _utf8 0xD0B2)) AS data;
-SELECT length(data) AS len FROM (
- SELECT rpad(_utf8 0xD0B1, 65536, _utf8 0xD0B2) AS data
-) AS sub;
-
-SELECT length(rpad(_utf8 0xD0B1, 65535, _utf8 0xD0B2)) AS data;
-SELECT length(data) AS len FROM (
- SELECT rpad(_utf8 0xD0B1, 65535, _utf8 0xD0B2) AS data
-) AS sub;
-
-SELECT length(data) AS len FROM (SELECT REPEAT('ä', 36766) AS data) AS sub;
-SELECT length(data) AS len FROM (SELECT REPEAT('ä', 36767) AS data) AS sub;
-SELECT length(data) AS len FROM (SELECT REPEAT('ä', 36778) AS data) AS sub;
-SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65535) AS data) AS sub;
-SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65536) AS data) AS sub;
-SELECT length(data) AS len FROM (SELECT REPEAT('ä', 65537) AS data) AS sub;
-
---echo #
---echo # MDEV-10717 Assertion `!null_value' failed in virtual bool Item::send(Protocol*, String*)
---echo #
-CREATE TABLE t1 (i INT, KEY(i));
-INSERT INTO t1 VALUES (20081205),(20050327);
-SELECT HEX(i), HEX(CHAR(i USING utf8)) FROM t1;
-SET sql_mode='STRICT_ALL_TABLES';
-SELECT HEX(i), HEX(CHAR(i USING utf8)) FROM t1;
-# Avoid garbage in the output
---replace_column 1 ###
-SELECT CHAR(i USING utf8) FROM t1;
-SET sql_mode=DEFAULT;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535
---echo #
-
-SET sql_mode='';
-CREATE TABLE t1 (c1 VARCHAR(21844) CHARACTER SET utf8);
-DESCRIBE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 VARCHAR(21845) CHARACTER SET utf8);
-DESCRIBE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 VARCHAR(21846) CHARACTER SET utf8);
-DESCRIBE t1;
-DROP TABLE t1;
-SET sql_mode=default;
-
---echo #
---echo # End of 5.5 tests
---echo #
-
---echo #
---echo # Start of 5.6 tests
---echo #
-
---echo #
---echo # WL#3664 WEIGHT_STRING
---echo #
-
-set names utf8;
---source include/weight_string.inc
---source include/weight_string_euro.inc
---source include/weight_string_l1.inc
-
-set @@collation_connection=utf8_bin;
---source include/weight_string.inc
---source include/weight_string_euro.inc
---source include/weight_string_l1.inc
-
---echo #
---echo # Checking strnxfrm() with odd length
---echo #
-set max_sort_length=5;
-select @@max_sort_length;
-create table t1 (a varchar(128) character set utf8 collate utf8_general_ci);
-insert into t1 values ('a'),('b'),('c');
-select * from t1 order by a;
-alter table t1 modify a varchar(128) character set utf8 collate utf8_bin;
-select * from t1 order by a;
-drop table t1;
-set max_sort_length=default;
-
---echo #
---echo # End of 5.6 tests
---echo #
-
---echo #
---echo # Start of 10.0 tests
---echo #
-
-SET NAMES utf8 COLLATE utf8_bin;
---source include/ctype_like_cond_propagation.inc
-SET NAMES utf8;
---source include/ctype_like_cond_propagation.inc
---source include/ctype_like_cond_propagation_utf8_german.inc
-
-
---echo #
---echo # MDEV-6666 Malformed result for CONCAT(utf8_column, binary_string)
---echo #
-
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8);
-INSERT INTO t1 VALUES ('a');
---error ER_INVALID_CHARACTER_STRING
-SELECT CONCAT(a,0xFF) FROM t1;
-SELECT CONCAT(a,0xC3BF) FROM t1;
-DROP TABLE t1;
---error ER_INVALID_CHARACTER_STRING
-SELECT CONCAT('a' COLLATE utf8_unicode_ci, _binary 0xFF);
-PREPARE stmt FROM "SELECT CONCAT('a' COLLATE utf8_unicode_ci, ?)";
-SET @arg00=_binary 0xFF;
---error ER_INVALID_CHARACTER_STRING
-EXECUTE stmt USING @arg00;
-DEALLOCATE PREPARE stmt;
-SET NAMES latin1;
-PREPARE stmt FROM "SELECT CONCAT(_utf8'a' COLLATE utf8_unicode_ci, ?)";
-EXECUTE stmt USING @no_such_var;
-DEALLOCATE PREPARE stmt;
-SET NAMES utf8;
-
---echo #
---echo # MDEV-6679 Different optimizer plan for "a BETWEEN 'string' AND ?" and "a BETWEEN ? AND 'string'"
---echo #
-SET NAMES utf8, collation_connection=utf8_swedish_ci;
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8, b INT NOT NULL DEFAULT 0, key(a));
-INSERT INTO t1 (a) VALUES ('a'),('b'),('c'),('d'),('¢');
-SET @arg='¢';
-PREPARE stmt FROM "EXPLAIN SELECT * FROM t1 WHERE a BETWEEN _utf8'¢' and ?";
-EXECUTE stmt USING @arg;
-PREPARE stmt FROM "EXPLAIN SELECT * FROM t1 WHERE a between ? and _utf8'¢'";
-EXECUTE stmt USING @arg;
-DEALLOCATE PREPARE stmt;
-DROP TABLE t1;
-
--- echo #
--- echo # MDEV-6683 A parameter and a string literal with the same values are not recognized as equal by the optimizer
--- echo #
-
-SET NAMES utf8, collation_connection=utf8_swedish_ci;
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1, b INT NOT NULL DEFAULT 0, key(a));
-INSERT INTO t1 (a) VALUES ('a'),('b'),('c'),('d'),('¢');
-SET @arg='¢';
-PREPARE stmt FROM "EXPLAIN SELECT * FROM t1 WHERE a BETWEEN _utf8'¢' and ?";
-EXECUTE stmt USING @arg;
-PREPARE stmt FROM "EXPLAIN SELECT * FROM t1 WHERE a between ? and _utf8'¢'";
-EXECUTE stmt USING @arg;
-DEALLOCATE PREPARE stmt;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-6688 Illegal mix of collation with bit string B'01100001'
---echo #
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1, b INT);
-INSERT INTO t1 VALUES ('a',1);
-SELECT CONCAT(a, IF(b>10, _utf8 X'61', _utf8 X'61')) FROM t1;
-SELECT CONCAT(a, IF(b>10, _utf8 X'61', _utf8 B'01100001')) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-6694 Illegal mix of collation with a PS parameter
---echo #
-SET NAMES utf8;
-CREATE TABLE t1 (a INT, b VARCHAR(10) CHARACTER SET latin1);
-INSERT INTO t1 VALUES (1,'a');
-SELECT CONCAT(b,IF(a,'b','b')) FROM t1;
-PREPARE stmt FROM "SELECT CONCAT(b,IF(a,?,?)) FROM t1";
-SET @b='b';
-EXECUTE stmt USING @b,@b;
-SET @b='';
-EXECUTE stmt USING @b,@b;
-SET @b='я';
---error ER_CANT_AGGREGATE_2COLLATIONS
-EXECUTE stmt USING @b,@b;
-DEALLOCATE PREPARE stmt;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-7629 Regression: Bit and hex string literals changed column names in 10.0.14
---echo #
-SELECT _utf8 0x7E, _utf8 X'7E', _utf8 B'01111110';
-
-
-let $ctype_unescape_combinations=selected;
---source include/ctype_unescape.inc
-
---echo #
---echo # MDEV-12681 Wrong VIEW results for CHAR(0xDF USING latin1)
---echo #
-
-SET NAMES utf8;
-SELECT CHAR(0xDF USING latin1);
-CREATE OR REPLACE VIEW v1 AS SELECT CHAR(0xDF USING latin1) AS c;
-SHOW CREATE VIEW v1;
-SELECT * FROM v1;
-DROP VIEW v1;
-
-
---echo #
---echo # End of 10.0 tests
---echo #
-
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-6572 "USE dbname" with a bad sequence erroneously connects to a wrong database
---echo #
-SET NAMES utf8;
---error ER_INVALID_CHARACTER_STRING
-SELECT * FROM `test😁😁test`;
-
---echo #
---echo #MDEV-8256 A part of a ROW comparison is erroneously optimized away
---echo #
-SET NAMES utf8;
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8);
-INSERT INTO t1 VALUES ('1e1'),('1é1');
-SELECT * FROM t1 WHERE a=10;
-SELECT * FROM t1 WHERE a='1e1';
-SELECT * FROM t1 WHERE a=10 AND a='1e1';
-SELECT * FROM t1 WHERE (a,a)=(10,'1e1');
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a,a)=(10,'1e1');
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8688 Wrong result for SELECT..WHERE varchar_column IN (1,2,3) AND varchar_column=' 1';
---echo #
-SET NAMES utf8;
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
-INSERT INTO t1 VALUES ('1e1'),('1ë1');
-SELECT * FROM t1 WHERE a IN (1,2);
-SELECT * FROM t1 WHERE a IN (1,2) AND a='1ë1';
-SELECT * FROM t1 WHERE a IN (1,2,'x') AND a='1ë1';
-# Equality should not propagate '1ë1' to IN: incompatible comparison context
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2) AND a='1ë1';
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a IN (1,2,'x') AND a='1ë1';
-DROP TABLE IF EXISTS t1;
-
-
---echo #
---echo # MDEV-8816 Equal field propagation is not applied for WHERE varbinary_column>=_utf8'a' COLLATE utf8_swedish_ci AND varbinary_column='A';
---echo #
-CREATE TABLE t1 (c VARBINARY(10));
-INSERT INTO t1 VALUES ('a'),('A');
-SELECT * FROM t1 WHERE c>=_utf8'a' COLLATE utf8_general_ci AND c='A';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE c>=_utf8'a' COLLATE utf8_general_ci AND c='A';
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-7231 Field ROUTINE_DEFINITION in INFORMATION_SCHEMA.`ROUTINES` contains broken procedure body when used shielding quotes inside.
---echo #
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
-SELECT CONCAT('ABC = ''',1,''''), CONCAT('ABC = ',2);
-SELECT '''', """", '\'', "\"";
-SELECT '<tab> <tab>\t<tab>';
-SELECT '<nl>
-<nl>\n<nl>';
-SELECT 'test';
-SELECT 'tëst';
-SELECT 'test\0';
-SELECT 'tëst\0';
-SELECT _binary'test';
-SELECT _binary'test\0';
-SELECT N'''', N"""", N'\'', N"\"";
-SELECT N'<tab> <tab>\t<tab>';
-SELECT N'<nl>
-<nl>\n<nl>';
-SELECT N'test';
-SELECT N'tëst';
-SELECT N'test\0';
-SELECT N'tëst\0';
-END$$
-DELIMITER ;$$
-SELECT ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES
-WHERE ROUTINE_SCHEMA='test' AND SPECIFIC_NAME ='p1';
-SELECT body_utf8 FROM mysql.proc WHERE name='p1';
-DROP PROCEDURE p1;
-
-SET @@SQL_MODE='NO_BACKSLASH_ESCAPES';
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
-SELECT CONCAT('ABC = ''',1,''''), CONCAT('ABC = ',2);
-SELECT '''', """";
-SELECT '<tab> <tab>\t<tab>';
-SELECT '<nl>
-<nl>\n<nl>';
-SELECT 'test';
-SELECT 'tëst';
-SELECT 'test\0';
-SELECT 'tëst\0';
-SELECT _binary'test';
-SELECT _binary'test\0';
-SELECT N'''', N"""";
-SELECT N'<tab> <tab>\t<tab>';
-SELECT N'<nl>
-<nl>\n<nl>';
-SELECT N'test';
-SELECT N'tëst';
-SELECT N'test\0';
-SELECT N'tëst\0';
-END$$
-DELIMITER ;$$
-SELECT ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES
-WHERE ROUTINE_SCHEMA='test' AND SPECIFIC_NAME ='p1';
-SELECT body_utf8 FROM mysql.proc WHERE name='p1';
-DROP PROCEDURE p1;
-SET @@SQL_MODE=default;
-
-
-# TODO: Uncomment the below test whe we fix:
-# MDEV-9623INFORMATION_SCHEMA.ROUTINES.ROUTINE_DEFINITION does not handle binary literals well
-#
-#SET NAMES binary;
-#CREATE FUNCTION f1() RETURNS TEXT RETURN CONCAT('i','й');
-#SELECT ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES
-#WHERE ROUTINE_SCHEMA='test' AND SPECIFIC_NAME ='f1';
-#SELECT body_utf8 FROM mysql.proc WHERE name='f1';
-#DROP FUNCTION f1;
-#SET NAMES utf8;
-
---echo #
---echo # MDEV-10191 non convertible chars convert() resulted in Null instead "?" on Windows
---echo #
-
-SET sql_mode='STRICT_TRANS_TABLES';
-SELECT CONVERT(_utf8 0xC499 USING latin1);
-SELECT CAST(_utf8 0xC499 AS CHAR CHARACTER SET latin1);
-
-SET sql_mode=default;
-SELECT CONVERT(_utf8 0xC499 USING latin1);
-SELECT CAST(_utf8 0xC499 AS CHAR CHARACTER SET latin1);
-
-
---echo #
---echo # MDEV-15005 ASAN: stack-buffer-overflow in my_strnncollsp_simple
---echo #
-
-SET NAMES utf8;
-SELECT CONVERT(1, CHAR) IN ('100', 10, '101');
-SELECT CONVERT(1, CHAR) IN ('100', 10, '1');
-SELECT CONVERT(1, CHAR) IN ('100', '10', '1');
-
-
---echo #
---echo # End of 10.1 tests
---echo #
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-9824 LOAD DATA does not work with multi-byte strings in LINES TERMINATED BY when IGNORE is specified
---echo #
-CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET utf8);
-LOAD DATA INFILE '../../std_data/loaddata/mdev9824.txt' INTO TABLE t1 CHARACTER SET utf8 LINES TERMINATED BY 'ёё';
-SELECT c1 FROM t1;
-DELETE FROM t1;
-LOAD DATA INFILE '../../std_data/loaddata/mdev9824.txt' INTO TABLE t1 CHARACTER SET utf8 LINES TERMINATED BY 'ёё' IGNORE 1 LINES;
-SELECT c1 FROM t1 ORDER BY c1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-9842 LOAD DATA INFILE does not work well with a TEXT column when using sjis
---echo #
-CREATE TABLE t1 (a TEXT CHARACTER SET utf8);
-LOAD DATA INFILE '../../std_data/loaddata/mdev9823.utf8mb4.txt' IGNORE INTO TABLE t1 CHARACTER SET utf8 IGNORE 4 LINES;
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-9874 LOAD XML INFILE does not handle well broken multi-byte characters
---echo #
-CREATE TABLE t1 (a TEXT CHARACTER SET utf8);
-LOAD XML INFILE '../../std_data/loaddata/mdev9874.xml' IGNORE INTO TABLE t1 CHARACTER SET utf8 ROWS IDENTIFIED BY '<row>';
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-10134 Add full support for DEFAULT
---echo #
-
-# This test uses some magic codes:
-# _latin1 0xC39F is "A WITH TILDE + Y WITH DIAERESIS"
-# _utf8 0xC39F is "SHARP S"
-
-# "A WITH TILDE + Y WITH DIAERESIS" in DEFAULT.
-SET NAMES latin1;
-CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET latin1 DEFAULT CONCAT('ß'));
-SET NAMES utf8;
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (DEFAULT);
-SELECT HEX(a),a FROM t1;
-SET NAMES latin1;
-ALTER TABLE t1 ADD b VARCHAR(30) CHARACTER SET latin1 DEFAULT CONCAT('ß');
-SET NAMES utf8;
-ALTER TABLE t1 ADD c VARCHAR(30) CHARACTER SET latin1 DEFAULT CONCAT('ß');
-SHOW CREATE TABLE t1;
-# Testing that DEFAULT is independent on the current "SET NAMES".
-DELETE FROM t1;
-INSERT INTO t1 VALUES();
-SELECT * FROM t1;
-SET NAMES latin1;
-DELETE FROM t1;
-INSERT INTO t1 VALUES();
-SET NAMES utf8;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-SET NAMES latin1;
-CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET utf8 DEFAULT CONCAT('ß'));
-SET NAMES utf8;
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (DEFAULT);
-SELECT HEX(a), a FROM t1;
-DROP TABLE t1;
-
-# "SHARP S" in DEFAULT
-SET NAMES utf8;
-CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET latin1 DEFAULT CONCAT('ß'));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (DEFAULT);
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
-SET NAMES utf8;
-CREATE TABLE t1 (a VARCHAR(30) CHARACTER SET utf8 DEFAULT CONCAT('ß'));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (DEFAULT);
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-9711 NO PAD Collatons
---echo #
-let $coll='utf8_general_nopad_ci';
-let $coll_pad='utf8_general_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='utf8_nopad_bin';
-let $coll_pad='utf8_bin';
---source include/ctype_pad_all_engines.inc
-
---echo #
---echo # End of 10.2 tests
---echo #
-
---echo #
---echo # Start of 10.3 tests
---echo #
-
-
---echo #
---echo # MDEV-11155 Bad error message when creating a SET column with comma and non-ASCII characters
---echo #
-
-SET NAMES utf8;
---error ER_ILLEGAL_VALUE_FOR_TYPE
-CREATE TABLE t1 (a SET('a,bü'));
-
---echo #
---echo # MDEV-12607 Hybrid functions create wrong VARBINARY length when mixing character and binary data
---echo #
-SET sql_mode='';
-SET NAMES utf8;
-CREATE OR REPLACE TABLE t1 AS SELECT COALESCE('ßa',_binary 'a');
-SELECT * FROM t1;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-SET sql_mode=DEFAULT;
-
-
---echo #
---echo # End of 10.3 tests
---echo #
diff --git a/mysql-test/t/ctype_utf8_uca.test b/mysql-test/t/ctype_utf8_uca.test
deleted file mode 100644
index 0879b4d2810..00000000000
--- a/mysql-test/t/ctype_utf8_uca.test
+++ /dev/null
@@ -1,23 +0,0 @@
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-10877 xxx_unicode_nopad_ci collations
---echo #
-SET NAMES utf8;
-let $coll='utf8_unicode_nopad_ci';
-let $coll_pad='utf8_unicode_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='utf8_unicode_520_nopad_ci';
-let $coll_pad='utf8_unicode_520_ci';
---source include/ctype_pad_all_engines.inc
-
-SET NAMES utf8 COLLATE utf8_unicode_nopad_ci;
---source include/ctype_like_range_mdev14350.inc
-
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/ctype_utf8mb4-master.opt b/mysql-test/t/ctype_utf8mb4-master.opt
deleted file mode 100644
index 96f0ce3f36c..00000000000
--- a/mysql-test/t/ctype_utf8mb4-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---default-storage-engine=MyISAM
diff --git a/mysql-test/t/ctype_utf8mb4.test b/mysql-test/t/ctype_utf8mb4.test
deleted file mode 100644
index 7aa644fe8a9..00000000000
--- a/mysql-test/t/ctype_utf8mb4.test
+++ /dev/null
@@ -1,2015 +0,0 @@
---source include/have_utf8mb4.inc
-
-#
-# Tests with the utf8mb4 character set
-#
-
---source include/have_innodb.inc
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
---echo #
---echo # Start of 5.5 tests
---echo #
-
-set names utf8mb4;
-
-select left(_utf8mb4 0xD0B0D0B1D0B2,1);
-select right(_utf8mb4 0xD0B0D0B2D0B2,1);
-
-select locate('he','hello');
-select locate('he','hello',2);
-select locate('lo','hello',2);
-select locate('HE','hello');
-select locate('HE','hello',2);
-select locate('LO','hello',2);
-select locate('HE','hello' collate utf8mb4_bin);
-select locate('HE','hello' collate utf8mb4_bin,2);
-select locate('LO','hello' collate utf8mb4_bin,2);
-
-select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D0B1D0B2);
-select locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2);
-select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2);
-select locate(_utf8mb4 0xD091, _utf8mb4 0xD0B0D0B1D0B2 collate utf8mb4_bin);
-select locate(_utf8mb4 0xD0B1, _utf8mb4 0xD0B0D091D0B2 collate utf8mb4_bin);
-
-select length(_utf8mb4 0xD0B1), bit_length(_utf8mb4 0xD0B1), char_length(_utf8mb4 0xD0B1);
-
-select 'a' like 'a';
-select 'A' like 'a';
-select 'A' like 'a' collate utf8mb4_bin;
-select _utf8mb4 0xD0B0D0B1D0B2 like concat(_utf8mb4'%',_utf8mb4 0xD0B1,_utf8mb4 '%');
-
-# Bug #6040: can't retrieve records with umlaut
-# characters in case insensitive manner.
-# Case insensitive search LIKE comparison
-# was broken for multibyte characters:
-select convert(_latin1'Gnter Andr' using utf8mb4) like CONVERT(_latin1'GNTER%' USING utf8mb4);
-select CONVERT(_koi8r'' USING utf8mb4) LIKE CONVERT(_koi8r'' USING utf8mb4);
-select CONVERT(_koi8r'' USING utf8mb4) LIKE CONVERT(_koi8r'' USING utf8mb4);
-
-#
-# Check the following:
-# "a" == "a "
-# "a\0" < "a"
-# "a\0" < "a "
-
-SELECT 'a' = 'a ';
-SELECT 'a\0' < 'a';
-SELECT 'a\0' < 'a ';
-SELECT 'a\t' < 'a';
-SELECT 'a\t' < 'a ';
-
-#
-# The same for binary collation
-#
-SELECT 'a' = 'a ' collate utf8mb4_bin;
-SELECT 'a\0' < 'a' collate utf8mb4_bin;
-SELECT 'a\0' < 'a ' collate utf8mb4_bin;
-SELECT 'a\t' < 'a' collate utf8mb4_bin;
-SELECT 'a\t' < 'a ' collate utf8mb4_bin;
-
-CREATE TABLE t1 (a char(10) character set utf8mb4 not null);
-INSERT INTO t1 VALUES ('a'),('a\0'),('a\t'),('a ');
-SELECT hex(a),STRCMP(a,'a'), STRCMP(a,'a ') FROM t1;
-DROP TABLE t1;
-
-#
-# Fix this, it should return 1:
-#
-#select _utf8mb4 0xD0B0D0B1D0B2 like concat(_utf8mb4'%',_utf8mb4 0xD091,_utf8mb4 '%');
-#
-
-#
-# Bug 2367: INSERT() behaviour is different for different charsets.
-#
-select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
-select insert("aa",100,1,"b"),insert("aa",1,3,"b");
-
-#
-# LELF() didn't work well with utf8mb4 in some cases too.
-#
-select char_length(left(@a:='тест',5)), length(@a), @a;
-
-
-#
-# CREATE ... SELECT
-#
-create table t1 select date_format("2004-01-19 10:10:10", "%Y-%m-%d");
-show create table t1;
-select * from t1;
-drop table t1;
-
-#
-# Bug#22646 LC_TIME_NAMES: Assignment to non-UTF8 target fails
-#
-set names utf8mb4;
-set LC_TIME_NAMES='fr_FR';
-create table t1 (s1 char(20) character set latin1);
-insert into t1 values (date_format('2004-02-02','%M'));
-select hex(s1) from t1;
-drop table t1;
-create table t1 (s1 char(20) character set koi8r);
-set LC_TIME_NAMES='ru_RU';
-insert into t1 values (date_format('2004-02-02','%M'));
-insert into t1 values (date_format('2004-02-02','%b'));
-insert into t1 values (date_format('2004-02-02','%W'));
-insert into t1 values (date_format('2004-02-02','%a'));
-select hex(s1), s1 from t1;
-drop table t1;
-set LC_TIME_NAMES='en_US';
-
-
-#
-# Bug #2366 Wrong utf8mb4 behaviour when data is truncated
-#
-set names koi8r;
-create table t1 (s1 char(1) character set utf8mb4);
-insert ignore into t1 values (_koi8r'');
-select s1,hex(s1),char_length(s1),octet_length(s1) from t1;
-drop table t1;
-
-create table t1 (s1 tinytext character set utf8mb4);
-insert ignore into t1 select repeat('a',300);
-insert ignore into t1 select repeat('',300);
-insert ignore into t1 select repeat('a',300);
-insert ignore into t1 select repeat('a',300);
-insert ignore into t1 select repeat('',300);
-select hex(s1) from t1;
-select length(s1),char_length(s1) from t1;
-drop table t1;
-
-create table t1 (s1 text character set utf8mb4);
-insert ignore into t1 select repeat('a',66000);
-insert ignore into t1 select repeat('',66000);
-insert ignore into t1 select repeat('a',66000);
-insert ignore into t1 select repeat('a',66000);
-insert ignore into t1 select repeat('',66000);
-select length(s1),char_length(s1) from t1;
-drop table t1;
-
-#
-# Bug #2368 Multibyte charsets do not check that incoming data is well-formed
-#
-create table t1 (s1 char(10) character set utf8mb4);
-insert ignore into t1 values (0x41FF);
-select hex(s1) from t1;
-drop table t1;
-
-create table t1 (s1 varchar(10) character set utf8mb4);
-insert ignore into t1 values (0x41FF);
-select hex(s1) from t1;
-drop table t1;
-
-create table t1 (s1 text character set utf8mb4);
-insert ignore into t1 values (0x41FF);
-select hex(s1) from t1;
-drop table t1;
-
-#
-# Bug 2699
-# UTF8 breaks primary keys for cols > 333 characters
-#
---error 1071
-create table t1 (a text character set utf8mb4, primary key(a(371)));
-
-
-#
-# Bug 2959
-# UTF8 charset breaks joins with mixed column/string constant
-#
-CREATE TABLE t1 ( a varchar(10) ) CHARACTER SET utf8mb4;
-INSERT INTO t1 VALUES ( 'test' );
-SELECT a.a, b.a FROM t1 a, t1 b WHERE a.a = b.a;
-SELECT a.a, b.a FROM t1 a, t1 b WHERE a.a = 'test' and b.a = 'test';
-SELECT a.a, b.a FROM t1 a, t1 b WHERE a.a = b.a and a.a = 'test';
-DROP TABLE t1;
-
-create table t1 (a char(255) character set utf8mb4);
-insert into t1 values('b'),('b');
-select * from t1 where a = 'b';
-select * from t1 where a = 'b' and a = 'b';
-select * from t1 where a = 'b' and a != 'b';
-drop table t1;
-
-#
-# Testing regexp
-#
-set names utf8mb4;
---source include/ctype_regex.inc
---source include/ctype_regex_utf8.inc
-
-#
-# Bug #4555
-# ALTER TABLE crashes mysqld with enum column collated utf8mb4_unicode_ci
-#
-CREATE TABLE t1 (a enum ('Y', 'N') DEFAULT 'N' COLLATE utf8mb4_unicode_ci);
-ALTER TABLE t1 ADD COLUMN b CHAR(20);
-DROP TABLE t1;
-
-# Customer Support Center issue # 3299
-# ENUM and SET multibyte fields computed their length wronly
-# when converted into a char field
-set names utf8mb4;
-create table t1 (a enum('aaaa','проба') character set utf8mb4);
-show create table t1;
-insert into t1 values ('проба');
-select * from t1;
-create table t2 select ifnull(a,a) from t1;
-show create table t2;
-select * from t2;
-drop table t1;
-drop table t2;
-
-#
-# Bug 4521: unique key prefix interacts poorly with utf8mb4
-# MYISAM: keys with prefix compression, case insensitive collation.
-#
-create table t1 (c varchar(30) character set utf8mb4, unique(c(10)));
-insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
-insert into t1 values ('aaaaaaaaaa');
---error ER_DUP_ENTRY
-insert into t1 values ('aaaaaaaaaaa');
---error ER_DUP_ENTRY
-insert into t1 values ('aaaaaaaaaaaa');
-insert into t1 values (repeat('b',20));
-select c c1 from t1 where c='1';
-select c c2 from t1 where c='2';
-select c c3 from t1 where c='3';
-select c cx from t1 where c='x';
-select c cy from t1 where c='y';
-select c cz from t1 where c='z';
-select c ca10 from t1 where c='aaaaaaaaaa';
-select c cb20 from t1 where c=repeat('b',20);
-drop table t1;
-
-#
-# Bug 4521: unique key prefix interacts poorly with utf8mb4
-# InnoDB: keys with prefix compression, case insensitive collation.
-#
---disable_warnings
-create table t1 (c varchar(30) character set utf8mb4, unique(c(10))) engine=innodb;
---enable_warnings
-insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
-insert into t1 values ('aaaaaaaaaa');
---error ER_DUP_ENTRY
-insert into t1 values ('aaaaaaaaaaa');
---error ER_DUP_ENTRY
-insert into t1 values ('aaaaaaaaaaaa');
-insert into t1 values (repeat('b',20));
-select c c1 from t1 where c='1';
-select c c2 from t1 where c='2';
-select c c3 from t1 where c='3';
-select c cx from t1 where c='x';
-select c cy from t1 where c='y';
-select c cz from t1 where c='z';
-select c ca10 from t1 where c='aaaaaaaaaa';
-select c cb20 from t1 where c=repeat('b',20);
-drop table t1;
-#
-# Bug 4521: unique key prefix interacts poorly with utf8mb4
-# MYISAM: fixed length keys, case insensitive collation
-#
-create table t1 (c char(3) character set utf8mb4, unique (c(2)));
-insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
-insert into t1 values ('a');
-insert into t1 values ('aa');
---error ER_DUP_ENTRY
-insert into t1 values ('aaa');
-insert into t1 values ('b');
-insert into t1 values ('bb');
---error ER_DUP_ENTRY
-insert into t1 values ('bbb');
-insert into t1 values ('а');
-insert into t1 values ('аа');
---error ER_DUP_ENTRY
-insert into t1 values ('ааа');
-insert into t1 values ('б');
-insert into t1 values ('бб');
---error ER_DUP_ENTRY
-insert into t1 values ('ббб');
-insert into t1 values ('ꪪ');
-insert into t1 values ('ꪪꪪ');
---error ER_DUP_ENTRY
-insert into t1 values ('ꪪꪪꪪ');
-drop table t1;
-#
-# Bug 4521: unique key prefix interacts poorly with utf8mb4
-# InnoDB: fixed length keys, case insensitive collation
-#
---disable_warnings
-create table t1 (c char(3) character set utf8mb4, unique (c(2))) engine=innodb;
---enable_warnings
-insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
-insert into t1 values ('a');
-insert into t1 values ('aa');
---error ER_DUP_ENTRY
-insert into t1 values ('aaa');
-insert into t1 values ('b');
-insert into t1 values ('bb');
---error ER_DUP_ENTRY
-insert into t1 values ('bbb');
-insert into t1 values ('а');
-insert into t1 values ('аа');
---error ER_DUP_ENTRY
-insert into t1 values ('ааа');
-insert into t1 values ('б');
-insert into t1 values ('бб');
---error ER_DUP_ENTRY
-insert into t1 values ('ббб');
-insert into t1 values ('ꪪ');
-insert into t1 values ('ꪪꪪ');
---error ER_DUP_ENTRY
-insert into t1 values ('ꪪꪪꪪ');
-drop table t1;
-#
-# Bug 4531: unique key prefix interacts poorly with utf8mb4
-# Check HEAP+HASH, case insensitive collation
-#
-create table t1 (
-c char(10) character set utf8mb4,
-unique key a using hash (c(1))
-) engine=heap;
-show create table t1;
-insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
---error ER_DUP_ENTRY
-insert into t1 values ('aa');
---error ER_DUP_ENTRY
-insert into t1 values ('aaa');
-insert into t1 values ('б');
---error ER_DUP_ENTRY
-insert into t1 values ('бб');
---error ER_DUP_ENTRY
-insert into t1 values ('ббб');
-select c as c_all from t1 order by c;
-select c as c_a from t1 where c='a';
-select c as c_a from t1 where c='б';
-drop table t1;
-
-#
-# Bug 4531: unique key prefix interacts poorly with utf8mb4
-# Check HEAP+BTREE, case insensitive collation
-#
-create table t1 (
-c char(10) character set utf8mb4,
-unique key a using btree (c(1))
-) engine=heap;
-show create table t1;
-insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
---error ER_DUP_ENTRY
-insert into t1 values ('aa');
---error ER_DUP_ENTRY
-insert into t1 values ('aaa');
-insert into t1 values ('б');
---error ER_DUP_ENTRY
-insert into t1 values ('бб');
---error ER_DUP_ENTRY
-insert into t1 values ('ббб');
-select c as c_all from t1 order by c;
-select c as c_a from t1 where c='a';
-select c as c_a from t1 where c='б';
-drop table t1;
-
-#
-# Bug 4531: unique key prefix interacts poorly with utf8mb4
-# Check BDB, case insensitive collation
-#
---disable_warnings
-create table t1 (
-c char(10) character set utf8mb4,
-unique key a (c(1))
-) engine=innodb;
---enable_warnings
-insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
---error ER_DUP_ENTRY
-insert into t1 values ('aa');
---error ER_DUP_ENTRY
-insert into t1 values ('aaa');
-insert into t1 values ('б');
---error ER_DUP_ENTRY
-insert into t1 values ('бб');
---error ER_DUP_ENTRY
-insert into t1 values ('ббб');
-select c as c_all from t1 order by c;
-select c as c_a from t1 where c='a';
-select c as c_a from t1 where c='б';
-drop table t1;
-
-#
-# Bug 4521: unique key prefix interacts poorly with utf8mb4
-# MYISAM: keys with prefix compression, binary collation.
-#
-create table t1 (c varchar(30) character set utf8mb4 collate utf8mb4_bin, unique(c(10)));
-insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z');
-insert into t1 values ('aaaaaaaaaa');
---error ER_DUP_ENTRY
-insert into t1 values ('aaaaaaaaaaa');
---error ER_DUP_ENTRY
-insert into t1 values ('aaaaaaaaaaaa');
-insert into t1 values (repeat('b',20));
-select c c1 from t1 where c='1';
-select c c2 from t1 where c='2';
-select c c3 from t1 where c='3';
-select c cx from t1 where c='x';
-select c cy from t1 where c='y';
-select c cz from t1 where c='z';
-select c ca10 from t1 where c='aaaaaaaaaa';
-select c cb20 from t1 where c=repeat('b',20);
-drop table t1;
-
-#
-# Bug 4521: unique key prefix interacts poorly with utf8mb4
-# MYISAM: fixed length keys, binary collation
-#
-create table t1 (c char(3) character set utf8mb4 collate utf8mb4_bin, unique (c(2)));
-insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z');
-insert into t1 values ('a');
-insert into t1 values ('aa');
---error ER_DUP_ENTRY
-insert into t1 values ('aaa');
-insert into t1 values ('b');
-insert into t1 values ('bb');
---error ER_DUP_ENTRY
-insert into t1 values ('bbb');
-insert into t1 values ('а');
-insert into t1 values ('аа');
---error ER_DUP_ENTRY
-insert into t1 values ('ааа');
-insert into t1 values ('б');
-insert into t1 values ('бб');
---error ER_DUP_ENTRY
-insert into t1 values ('ббб');
-insert into t1 values ('ꪪ');
-insert into t1 values ('ꪪꪪ');
---error ER_DUP_ENTRY
-insert into t1 values ('ꪪꪪꪪ');
-drop table t1;
-
-#
-# Bug 4531: unique key prefix interacts poorly with utf8mb4
-# Check HEAP+HASH, binary collation
-#
-create table t1 (
-c char(10) character set utf8mb4 collate utf8mb4_bin,
-unique key a using hash (c(1))
-) engine=heap;
-show create table t1;
-insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
---error ER_DUP_ENTRY
-insert into t1 values ('aa');
---error ER_DUP_ENTRY
-insert into t1 values ('aaa');
-insert into t1 values ('б');
---error ER_DUP_ENTRY
-insert into t1 values ('бб');
---error ER_DUP_ENTRY
-insert into t1 values ('ббб');
-select c as c_all from t1 order by c;
-select c as c_a from t1 where c='a';
-select c as c_a from t1 where c='б';
-drop table t1;
-
-#
-# Bug 4531: unique key prefix interacts poorly with utf8mb4
-# Check HEAP+BTREE, binary collation
-#
-create table t1 (
-c char(10) character set utf8mb4 collate utf8mb4_bin,
-unique key a using btree (c(1))
-) engine=heap;
-show create table t1;
-insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
---error ER_DUP_ENTRY
-insert into t1 values ('aa');
---error ER_DUP_ENTRY
-insert into t1 values ('aaa');
-insert into t1 values ('б');
---error ER_DUP_ENTRY
-insert into t1 values ('бб');
---error ER_DUP_ENTRY
-insert into t1 values ('ббб');
-select c as c_all from t1 order by c;
-select c as c_a from t1 where c='a';
-select c as c_a from t1 where c='б';
-drop table t1;
-
-#
-# Bug 4531: unique key prefix interacts poorly with utf8mb4
-# Check BDB, binary collation
-#
---disable_warnings
-create table t1 (
-c char(10) character set utf8mb4 collate utf8mb4_bin,
-unique key a (c(1))
-) engine=innodb;
---enable_warnings
-insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
---error ER_DUP_ENTRY
-insert into t1 values ('aa');
---error ER_DUP_ENTRY
-insert into t1 values ('aaa');
-insert into t1 values ('б');
---error ER_DUP_ENTRY
-insert into t1 values ('бб');
---error ER_DUP_ENTRY
-insert into t1 values ('ббб');
-select c as c_all from t1 order by c;
-select c as c_a from t1 where c='a';
-select c as c_a from t1 where c='б';
-drop table t1;
-
-
-# Bug#4594: column index make = failed for gbk, but like works
-# Check MYISAM
-#
-create table t1 (
- str varchar(255) character set utf8mb4 not null,
- key str (str(2))
-) engine=myisam;
-INSERT INTO t1 VALUES ('str');
-INSERT INTO t1 VALUES ('str2');
-select * from t1 where str='str';
-drop table t1;
-
-# Bug#4594: column index make = failed for gbk, but like works
-# Check InnoDB
-#
---disable_warnings
-create table t1 (
- str varchar(255) character set utf8mb4 not null,
- key str (str(2))
-) engine=innodb;
---enable_warnings
-INSERT INTO t1 VALUES ('str');
-INSERT INTO t1 VALUES ('str2');
-select * from t1 where str='str';
-drop table t1;
-
-# the same for HEAP+BTREE
-#
-
-create table t1 (
- str varchar(255) character set utf8mb4 not null,
- key str using btree (str(2))
-) engine=heap;
-INSERT INTO t1 VALUES ('str');
-INSERT INTO t1 VALUES ('str2');
-select * from t1 where str='str';
-drop table t1;
-
-# the same for HEAP+HASH
-#
-
-create table t1 (
- str varchar(255) character set utf8mb4 not null,
- key str using hash (str(2))
-) engine=heap;
-INSERT INTO t1 VALUES ('str');
-INSERT INTO t1 VALUES ('str2');
-select * from t1 where str='str';
-drop table t1;
-
-# the same for BDB
-#
-
---disable_warnings
-create table t1 (
- str varchar(255) character set utf8mb4 not null,
- key str (str(2))
-) engine=innodb;
---enable_warnings
-INSERT INTO t1 VALUES ('str');
-INSERT INTO t1 VALUES ('str2');
-select * from t1 where str='str';
-drop table t1;
-
-#
-# Bug #5397: Crash with varchar binary and LIKE
-#
-CREATE TABLE t1 (a varchar(32) BINARY) CHARACTER SET utf8mb4;
-INSERT INTO t1 VALUES ('test');
-SELECT a FROM t1 WHERE a LIKE '%te';
-DROP TABLE t1;
-
-#
-# Bug #5723: length(<varchar utf8mb4 field>) returns varying results
-#
---disable_warnings
-SET NAMES utf8mb4;
---disable_warnings
-CREATE TABLE t1 (
- subject varchar(255) character set utf8mb4 collate utf8mb4_unicode_ci,
- p varchar(15) character set utf8mb4
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
---enable_warnings
-INSERT INTO t1 VALUES ('谷川俊二と申しますが、インターネット予約の会員登録をしましたところ、メールアドレスを間違えてしまい会員IDが受け取ることが出来ませんでした。間違えアドレスはtani-shun@n.vodafone.ne.jpを書き込みました。どうすればよいですか? その他、住所等は間違えありません。連絡ください。よろしくお願いします。m(__)m','040312-000057');
-INSERT INTO t1 VALUES ('aaa','bbb');
-SELECT length(subject) FROM t1;
-SELECT length(subject) FROM t1 ORDER BY 1;
-DROP TABLE t1;
-
-#
-# Bug #5832 SELECT doesn't return records in some cases
-#
-CREATE TABLE t1 (
- id int unsigned NOT NULL auto_increment,
- list_id smallint unsigned NOT NULL,
- term TEXT NOT NULL,
- PRIMARY KEY(id),
- INDEX(list_id, term(4))
-) ENGINE=MYISAM CHARSET=utf8mb4;
-INSERT INTO t1 SET list_id = 1, term = "letterc";
-INSERT INTO t1 SET list_id = 1, term = "letterb";
-INSERT INTO t1 SET list_id = 1, term = "lettera";
-INSERT INTO t1 SET list_id = 1, term = "letterd";
-SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterc");
-SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterb");
-SELECT id FROM t1 WHERE (list_id = 1) AND (term = "lettera");
-SELECT id FROM t1 WHERE (list_id = 1) AND (term = "letterd");
-DROP TABLE t1;
-
-
-#
-# Bug #6043 erratic searching for diacriticals in indexed MyISAM UTF-8 table
-#
-SET NAMES latin1;
-CREATE TABLE t1 (
- id int unsigned NOT NULL auto_increment,
- list_id smallint unsigned NOT NULL,
- term text NOT NULL,
- PRIMARY KEY(id),
- INDEX(list_id, term(19))
-) ENGINE=MyISAM CHARSET=utf8mb4;
-INSERT INTO t1 set list_id = 1, term = "testtest";
-INSERT INTO t1 set list_id = 1, term = "testetest";
-INSERT INTO t1 set list_id = 1, term = "testtest";
-SELECT id, term FROM t1 where (list_id = 1) AND (term = "testtest");
-SELECT id, term FROM t1 where (list_id = 1) AND (term = "testetest");
-SELECT id, term FROM t1 where (list_id = 1) AND (term = "testtest");
-DROP TABLE t1;
-
-#
-# Bug #6019 SELECT tries to use too short prefix index on utf8mb4 data
-#
-set names utf8mb4;
---disable_warnings
-create table t1 (
- a int primary key,
- b varchar(6),
- index b3(b(3))
-) engine=innodb character set=utf8mb4;
---enable_warnings
-insert into t1 values(1,'foo'),(2,'foobar');
-select * from t1 where b like 'foob%';
---disable_warnings
-alter table t1 engine=innodb;
---enable_warnings
-select * from t1 where b like 'foob%';
-drop table t1;
-
-#
-# Test for calculate_interval_lengths() function
-#
-create table t1 (
- a enum('петя','вася','анюта') character set utf8mb4 not null default 'анюта',
- b set('петя','вася','анюта') character set utf8mb4 not null default 'анюта'
-);
-create table t2 select concat(a,_utf8mb4'') as a, concat(b,_utf8mb4'')as b from t1;
-show create table t2;
-drop table t2;
-drop table t1;
-
-#
-# Bug #6787 LIKE not working properly with _ and utf8mb4 data
-#
-select 'c' like '\_' as want0;
-
-#
-# SUBSTR with negative offset didn't work with multi-byte strings
-#
-SELECT SUBSTR('вася',-2);
-
-
-#
-# Bug #7730 Server crash using soundex on an utf8mb4 table
-#
-create table t1 (id integer, a varchar(100) character set utf8mb4 collate utf8mb4_unicode_ci);
-insert into t1 values (1, 'Test');
-select * from t1 where soundex(a) = soundex('Test');
-select * from t1 where soundex(a) = soundex('TEST');
-select * from t1 where soundex(a) = soundex('test');
-drop table t1;
-
-#
-# Bug#22638 SOUNDEX broken for international characters
-#
-select soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB);
-select hex(soundex(_utf8mb4 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB));
-select soundex(_utf8mb4 0xD091D092D093);
-select hex(soundex(_utf8mb4 0xD091D092D093));
-
-
-SET collation_connection='utf8mb4_general_ci';
--- source include/ctype_filesort.inc
--- source include/ctype_like_escape.inc
--- source include/ctype_german.inc
-SET collation_connection='utf8mb4_bin';
--- source include/ctype_filesort.inc
--- source include/ctype_filesort2.inc
--- source include/ctype_like_escape.inc
-
-#
-# Bug #7874 CONCAT() gives wrong results mixing
-# latin1 field and utf8mb4 string literals
-#
-CREATE TABLE t1 (
- user varchar(255) NOT NULL default ''
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-INSERT INTO t1 VALUES ('one'),('two');
-SELECT CHARSET('a');
-SELECT user, CONCAT('<', user, '>') AS c FROM t1;
-DROP TABLE t1;
-
-#
-# Bug#8785
-# the same problem with the above, but with nested CONCATs
-#
-create table t1 (f1 varchar(1) not null) default charset utf8mb4;
-insert into t1 values (''), ('');
-select concat(concat(_latin1'->',f1),_latin1'<-') from t1;
-drop table t1;
-
-#
-# Bug#8385: utf8mb4_general_ci treats Cyrillic letters I and SHORT I as the same
-#
-select convert(_koi8r'' using utf8mb4) < convert(_koi8r'' using utf8mb4);
-
-#
-# Bugs#5980: NULL requires a characterset in a union
-#
-set names latin1;
-create table t1 (a varchar(10)) character set utf8mb4;
-insert into t1 values ('test');
-select ifnull(a,'') from t1;
-drop table t1;
-select repeat(_utf8mb4'+',3) as h union select NULL;
-select ifnull(NULL, _utf8mb4'string');
-
-#
-# Bug#9509 Optimizer: wrong result after AND with comparisons
-#
-set names utf8mb4;
-create table t1 (s1 char(5) character set utf8mb4 collate utf8mb4_lithuanian_ci);
-insert into t1 values ('I'),('K'),('Y');
-select * from t1 where s1 < 'K' and s1 = 'Y';
-select * from t1 where 'K' > s1 and s1 = 'Y';
-drop table t1;
-
-create table t1 (s1 char(5) character set utf8mb4 collate utf8mb4_czech_ci);
-insert into t1 values ('c'),('d'),('h'),('ch'),('CH'),('cH'),('Ch'),('i');
-select * from t1 where s1 > 'd' and s1 = 'CH';
-select * from t1 where 'd' < s1 and s1 = 'CH';
-select * from t1 where s1 = 'cH' and s1 <> 'ch';
-select * from t1 where 'cH' = s1 and s1 <> 'ch';
-drop table t1;
-
-#
-# Bug#10714: Inserting double value into utf8mb4 column crashes server
-#
-create table t1 (a varchar(255)) default character set utf8mb4;
-insert into t1 values (1.0);
-drop table t1;
-
-#
-# Bug#10253 compound index length and utf8mb4 char set
-# produces invalid query results
-#
-create table t1 (
- id int not null,
- city varchar(20) not null,
- key (city(7),id)
-) character set=utf8mb4;
-insert into t1 values (1,'Durban North');
-insert into t1 values (2,'Durban');
-select * from t1 where city = 'Durban';
-select * from t1 where city = 'Durban ';
-drop table t1;
-
-#
-# Bug #11819 CREATE TABLE with a SET DEFAULT 0 and UTF8 crashes server.
-#
---error 1067
-create table t1 (x set('A', 'B') default 0) character set utf8mb4;
---error 1067
-create table t1 (x enum('A', 'B') default 0) character set utf8mb4;
-
-
-#
-# Test for bug #11167: join for utf8mb4 varchar value longer than 255 bytes
-#
-
-SET NAMES UTF8;
-
-CREATE TABLE t1 (
- `id` int(20) NOT NULL auto_increment,
- `country` varchar(100) NOT NULL default '',
- `shortcode` varchar(100) NOT NULL default '',
- `operator` varchar(100) NOT NULL default '',
- `momid` varchar(30) NOT NULL default '',
- `keyword` varchar(160) NOT NULL default '',
- `content` varchar(160) NOT NULL default '',
- `second_token` varchar(160) default NULL,
- `gateway_id` int(11) NOT NULL default '0',
- `created` datetime NOT NULL default '0000-00-00 00:00:00',
- `msisdn` varchar(15) NOT NULL default '',
- PRIMARY KEY (`id`),
- UNIQUE KEY `MSCCSPK_20030521130957121` (`momid`),
- KEY `IX_mobile_originated_message_keyword` (`keyword`),
- KEY `IX_mobile_originated_message_created` (`created`),
- KEY `IX_mobile_originated_message_support` (`msisdn`,`momid`,`keyword`,`gateway_id`,`created`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
-
-INSERT INTO t1 VALUES
-(1,'blah','464','aaa','fkc1c9ilc20x0hgae7lx6j09','ERR','ERR Имри.Афимим.Аеимимримдмримрмрирор имримримримр имридм ирбднримрфмририримрфмфмим.Ад.Д имдимримрад.Адимримримрмдиримримримр м.Дадимфшьмримд им.Адимимрн имадми','ИМРИ.АФИМИМ.АЕИМИМРИМДМРИМРМРИРОР',3,'2005-06-01 17:30:43','1234567890'),
-(2,'blah','464','aaa','haxpl2ilc20x00bj4tt2m5ti','11','11 g','G',3,'2005-06-02 22:43:10','1234567890');
-
---disable_warnings
-CREATE TABLE t2 (
- `msisdn` varchar(15) NOT NULL default '',
- `operator_id` int(11) NOT NULL default '0',
- `created` datetime NOT NULL default '0000-00-00 00:00:00',
- UNIQUE KEY `PK_user` (`msisdn`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
---enable_warnings
-
-INSERT INTO t2 VALUES ('1234567890',2,'2005-05-24 13:53:25');
-
-SELECT content, t2.msisdn FROM t1, t2 WHERE t1.msisdn = '1234567890';
-
-DROP TABLE t1,t2;
-
-#
-# Bug#11591: CHAR column with utf8mb4 does not work properly
-# (more chars than expected)
-#
-create table t1 (a char(20) character set utf8mb4);
-insert into t1 values ('123456'),('андрей');
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-alter table t1 modify a char(2) character set utf8mb4;
-select char_length(a), length(a), a from t1 order by a;
-drop table t1;
-
-#
-# Bugs#12611
-# ESCAPE + LIKE do not work when the escape char is a multibyte one
-#
-set names utf8mb4;
-select 'andre%' like 'andreñ%' escape 'ñ';
-
-#
-# Bugs#11754: SET NAMES utf8mb4 followed by SELECT "A\\" LIKE "A\\" returns 0
-#
-set names utf8mb4;
-select 'a\\' like 'a\\';
-select 'aa\\' like 'a%\\';
-
-create table t1 (a char(10), key(a)) character set utf8mb4;
-insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test");
-select * from t1 where a like "abc%";
-select * from t1 where a like concat("abc","%");
-select * from t1 where a like "ABC%";
-select * from t1 where a like "test%";
-select * from t1 where a like "te_t";
-select * from t1 where a like "%a%";
-select * from t1 where a like "%abcd%";
-select * from t1 where a like "%abc\d%";
-drop table t1;
-
-
-#
-# Bug#9557 MyISAM utf8mb4 table crash
-#
-CREATE TABLE t1 (
- a varchar(255) NOT NULL default '',
- KEY a (a)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;
-insert into t1 values (_utf8mb4 0xe880bd);
-insert into t1 values (_utf8mb4 0x5b);
-select hex(a) from t1;
-drop table t1;
-
-#
-# Bug#13751 find_in_set: Illegal mix of collations
-#
-set names 'latin1';
-create table t1 (a varchar(255)) default charset=utf8mb4;
-select * from t1 where find_in_set('-1', a);
-drop table t1;
-
-#
-# Bug#13233: select distinct char(column) fails with utf8mb4
-#
-create table t1 (a int);
-insert into t1 values (48),(49),(50);
-set names utf8mb4;
-select distinct char(a) from t1;
-drop table t1;
-
-#
-# Bug#15581: COALESCE function truncates mutli-byte TINYTEXT values
-#
-CREATE TABLE t1 (t TINYTEXT CHARACTER SET utf8mb4);
-INSERT INTO t1 VALUES(REPEAT('a', 100));
-CREATE TEMPORARY TABLE t2 SELECT COALESCE(t) AS bug FROM t1;
-SELECT LENGTH(bug) FROM t2;
-DROP TABLE t2;
-DROP TABLE t1;
-
-#
-# Bug#17313: N'xxx' and _utf8mb4'xxx' are not equivalent
-#
-CREATE TABLE t1 (item varchar(255)) default character set utf8mb4;
-INSERT INTO t1 VALUES (N'\\');
-INSERT INTO t1 VALUES (_utf8mb4'\\');
-INSERT INTO t1 VALUES (N'Cote d\'Ivoire');
-INSERT INTO t1 VALUES (_utf8mb4'Cote d\'Ivoire');
-SELECT item FROM t1 ORDER BY item;
-DROP TABLE t1;
-
-#
-# Bug#17705: Corruption of compressed index when index length changes between
-# 254 and 256
-#
-
-SET NAMES utf8mb4;
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1(a VARCHAR(255), KEY(a)) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
-INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
-INSERT INTO t1 VALUES('uu');
-check table t1;
-INSERT INTO t1 VALUES('uU');
-check table t1;
-INSERT INTO t1 VALUES('uu');
-check table t1;
-INSERT INTO t1 VALUES('uuABC');
-check table t1;
-INSERT INTO t1 VALUES('UuABC');
-check table t1;
-INSERT INTO t1 VALUES('uuABC');
-check table t1;
-alter table t1 add b int;
-INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',1);
-INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',2);
-delete from t1 where b=1;
-INSERT INTO t1 VALUES('UUABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',1);
-check table t1;
-INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',3);
-INSERT INTO t1 VALUES('uuABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',4);
-delete from t1 where b=3;
-INSERT INTO t1 VALUES('uUABCDEFGHIGKLMNOPRSTUVWXYZ̈bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',3);
-check table t1;
-drop table t1;
-
-#
-# Bug#20471 LIKE search fails with indexed utf8mb4 char column
-#
-set names utf8mb4;
-create table t1 (s1 char(5) character set utf8mb4);
-insert into t1 values
-('a'),('b'),(null),('ペテルグル'),('ü'),('Y');
-create index it1 on t1 (s1);
-select s1 as before_delete_general_ci from t1 where s1 like 'ペテ%';
-delete from t1 where s1 = 'Y';
-select s1 as after_delete_general_ci from t1 where s1 like 'ペテ%';
-drop table t1;
-
-set names utf8mb4;
-create table t1 (s1 char(5) character set utf8mb4 collate utf8mb4_unicode_ci);
-insert into t1 values
-('a'),('b'),(null),('ペテルグル'),('ü'),('Y');
-create index it1 on t1 (s1);
-select s1 as before_delete_unicode_ci from t1 where s1 like 'ペテ%';
-delete from t1 where s1 = 'Y';
-select s1 as after_delete_unicode_ci from t1 where s1 like 'ペテ%';
-drop table t1;
-
-set names utf8mb4;
-create table t1 (s1 char(5) character set utf8mb4 collate utf8mb4_bin);
-insert into t1 values
-('a'),('b'),(null),('ペテルグル'),('ü'),('Y');
-create index it1 on t1 (s1);
-select s1 as before_delete_bin from t1 where s1 like 'ペテ%';
-delete from t1 where s1 = 'Y';
-select s1 as after_delete_bin from t1 where s1 like 'ペテ%';
-drop table t1;
-
-# additional tests from duplicate bug#20744 MySQL return no result
-
-set names utf8mb4;
---disable_warnings
-create table t1 (a varchar(30) not null primary key)
-engine=innodb default character set utf8mb4 collate utf8mb4_general_ci;
---enable_warnings
-insert into t1 values ('あいうえおかきくけこさしすせそ');
-insert into t1 values ('さしすせそかきくけこあいうえお');
-select a as gci1 from t1 where a like 'さしすせそかきくけこあいうえお%';
-select a as gci2 from t1 where a like 'あいうえおかきくけこさしすせそ';
-drop table t1;
-
-set names utf8mb4;
---disable_warnings
-create table t1 (a varchar(30) not null primary key)
-engine=innodb default character set utf8mb4 collate utf8mb4_unicode_ci;
---enable_warnings
-insert into t1 values ('あいうえおかきくけこさしすせそ');
-insert into t1 values ('さしすせそかきくけこあいうえお');
-select a as uci1 from t1 where a like 'さしすせそかきくけこあいうえお%';
-select a as uci2 from t1 where a like 'あいうえおかきくけこさしすせそ';
-drop table t1;
-
-set names utf8mb4;
---disable_warnings
-create table t1 (a varchar(30) not null primary key)
-engine=innodb default character set utf8mb4 collate utf8mb4_bin;
---enable_warnings
-insert into t1 values ('あいうえおかきくけこさしすせそ');
-insert into t1 values ('さしすせそかきくけこあいうえお');
-select a as bin1 from t1 where a like 'さしすせそかきくけこあいうえお%';
-select a as bin2 from t1 where a like 'あいうえおかきくけこさしすせそ';
-drop table t1;
-
-
-
-#
-# Bug#14896: Comparison with a key in a partial index over mb chararacter field
-#
-
-SET NAMES utf8mb4;
-CREATE TABLE t1 (id int PRIMARY KEY,
- a varchar(16) collate utf8mb4_unicode_ci NOT NULL default '',
- b int,
- f varchar(128) default 'XXX',
- INDEX (a(4))
-) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-INSERT INTO t1(id, a, b) VALUES
- (1, 'cccc', 50), (2, 'cccc', 70), (3, 'cccc', 30),
- (4, 'cccc', 30), (5, 'cccc', 20), (6, 'bbbbbb', 40),
- (7, 'dddd', 30), (8, 'aaaa', 10), (9, 'aaaa', 50),
- (10, 'eeeee', 40), (11, 'bbbbbb', 60);
-
-SELECT id, a, b FROM t1;
-
-SELECT id, a, b FROM t1 WHERE a BETWEEN 'aaaa' AND 'bbbbbb';
-
-SELECT id, a FROM t1 WHERE a='bbbbbb';
-SELECT id, a FROM t1 WHERE a='bbbbbb' ORDER BY b;
-
-DROP TABLE t1;
-
-#
-# Bug#16674: LIKE predicate for a utf8mb4 character set column
-#
-
-SET NAMES utf8mb4;
-
-CREATE TABLE t1 (
- a CHAR(13) DEFAULT '',
- INDEX(a)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-INSERT INTO t1 VALUES
- ('Käli Käli 2-4'), ('Käli Käli 2-4'),
- ('Käli Käli 2+4'), ('Käli Käli 2+4'),
- ('Käli Käli 2-6'), ('Käli Käli 2-6');
-INSERT INTO t1 SELECT * FROM t1;
-
-CREATE TABLE t2 (
- a CHAR(13) DEFAULT '',
- INDEX(a)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
-
-INSERT INTO t2 VALUES
- ('Kali Kali 2-4'), ('Kali Kali 2-4'),
- ('Kali Kali 2+4'), ('Kali Kali 2+4'),
- ('Kali Kali 2-6'), ('Kali Kali 2-6');
-INSERT INTO t2 SELECT * FROM t2;
-
-SELECT a FROM t1 WHERE a LIKE 'Käli Käli 2+4';
-SELECT a FROM t2 WHERE a LIKE 'Kali Kali 2+4';
-
-EXPLAIN SELECT a FROM t1 WHERE a LIKE 'Käli Käli 2+4';
-EXPLAIN SELECT a FROM t1 WHERE a = 'Käli Käli 2+4';
-EXPLAIN SELECT a FROM t2 WHERE a LIKE 'Kali Kali 2+4';
-EXPLAIN SELECT a FROM t2 WHERE a = 'Kali Kali 2+4';
-
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (
- a char(255) DEFAULT '',
- KEY(a(10))
-) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-INSERT INTO t1 VALUES ('Käli Käli 2-4');
-SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%';
-INSERT INTO t1 VALUES ('Käli Käli 2-4');
-SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%';
-DROP TABLE t1;
-
-CREATE TABLE t1 (
- a char(255) DEFAULT ''
-) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-INSERT INTO t1 VALUES ('Käli Käli 2-4');
-INSERT INTO t1 VALUES ('Käli Käli 2-4');
-SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%';
-ALTER TABLE t1 ADD KEY (a(10));
-SELECT * FROM t1 WHERE a LIKE 'Käli Käli 2%';
-DROP TABLE t1;
-
-#
-# Bug#18359: LIKE predicate for a 'utf8mb4' text column with a partial index
-# (see bug #16674 as well)
-#
-
-SET NAMES latin2;
-
-CREATE TABLE t1 (
- id int(11) NOT NULL default '0',
- tid int(11) NOT NULL default '0',
- val text NOT NULL,
- INDEX idx(tid, val(10))
-) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
-
-INSERT INTO t1 VALUES
- (40988,72,'VOLN ADSL'),(41009,72,'VOLN ADSL'),
- (41032,72,'VOLN ADSL'),(41038,72,'VOLN ADSL'),
- (41063,72,'VOLN ADSL'),(41537,72,'VOLN ADSL Office'),
- (42141,72,'VOLN ADSL'),(42565,72,'VOLN ADSL Combi'),
- (42749,72,'VOLN ADSL'),(44205,72,'VOLN ADSL');
-
-SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLNY ADSL';
-SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLN ADSL';
-SELECT * FROM t1 WHERE tid=72 and val LIKE '%VOLN ADSL';
-
-ALTER TABLE t1 DROP KEY idx;
-ALTER TABLE t1 ADD KEY idx (tid,val(11));
-
-SELECT * FROM t1 WHERE tid=72 and val LIKE 'VOLN ADSL';
-
-DROP TABLE t1;
-
-#
-# Bug 20709: problem with utf8mb4 fields in temporary tables
-#
-
-create table t1(a char(200) collate utf8mb4_unicode_ci NOT NULL default '')
- default charset=utf8mb4 collate=utf8mb4_unicode_ci;
-insert into t1 values (unhex('65')), (unhex('C3A9')), (unhex('65'));
-explain select distinct a from t1;
-select distinct a from t1;
-explain select a from t1 group by a;
-select a from t1 group by a;
-drop table t1;
-
-#
-# Bug #20204: "order by" changes the results returned
-#
-
-create table t1(a char(10)) default charset utf8mb4;
-insert into t1 values ('123'), ('456');
-explain
- select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1;
-select substr(Z.a,-1), Z.a from t1 as Y join t1 as Z on Y.a=Z.a order by 1;
-drop table t1;
-
-#
-# Bug #34349: Passing invalid parameter to CHAR() in an ORDER BY causes
-# MySQL to hang
-#
-
-SET CHARACTER SET utf8mb4;
-SHOW VARIABLES LIKE 'character\_set\_%';
-CREATE DATABASE crashtest DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
-USE crashtest;
-CREATE TABLE crashtest (crash char(10)) DEFAULT CHARSET=utf8mb4;
-INSERT INTO crashtest VALUES ('35'), ('36'), ('37');
-SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8mb4);
-INSERT INTO crashtest VALUES ('-1000');
-EXPLAIN SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8mb4);
-SELECT * FROM crashtest ORDER BY CHAR(crash USING utf8mb4);
-DROP TABLE crashtest;
-DROP DATABASE crashtest;
-USE test;
-SET CHARACTER SET default;
-
-# End of 4.1 tests
-
-#
-# Test for bug #11484: wrong results for a DISTINCT varchar column in uft8.
-#
-
-CREATE TABLE t1(id varchar(20) NOT NULL) DEFAULT CHARSET=utf8mb4;
-INSERT INTO t1 VALUES ('xxx'), ('aa'), ('yyy'), ('aa');
-
-SELECT id FROM t1;
-SELECT DISTINCT id FROM t1;
-SELECT DISTINCT id FROM t1 ORDER BY id;
-
-DROP TABLE t1;
-
-#
-# Bug#20095 Changing length of VARCHAR field with UTF8
-# collation does not truncate values
-#
-create table t1 (
- a varchar(26) not null
-) default character set utf8mb4;
-insert into t1 (a) values ('abcdefghijklmnopqrstuvwxyz');
-select * from t1;
-# varchar to varchar
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-alter table t1 change a a varchar(20) character set utf8mb4 not null;
-select * from t1;
-# varchar to char
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-alter table t1 change a a char(15) character set utf8mb4 not null;
-select * from t1;
-# char to char
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-alter table t1 change a a char(10) character set utf8mb4 not null;
-select * from t1;
-# char to varchar
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-alter table t1 change a a varchar(5) character set utf8mb4 not null;
-select * from t1;
-drop table t1;
-
-#
-# Check that do_varstring2_mb produces a warning
-#
-create table t1 (
- a varchar(4000) not null
-) default character set utf8mb4;
-insert into t1 values (repeat('a',4000));
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-alter table t1 change a a varchar(3000) character set utf8mb4 not null;
-select length(a) from t1;
-drop table t1;
-
-
-#
-# Bug#10504: Character set does not support traditional mode
-# Bug#14146: CHAR(...USING ...) and CONVERT(CHAR(...) USING...)
-# produce different results
-#
-set names utf8mb4;
-# correct value
-select hex(char(1 using utf8mb4));
-select char(0xd1,0x8f using utf8mb4);
-select char(0xd18f using utf8mb4);
-select char(53647 using utf8mb4);
-# incorrect value: return with warning
-select char(0xff,0x8f using utf8mb4);
-select convert(char(0xff,0x8f) using utf8mb4);
-# incorrect value in strict mode: return NULL with "Error" level warning
-set sql_mode=traditional;
-select char(0xff,0x8f using utf8mb4);
-select char(195 using utf8mb4);
-select char(196 using utf8mb4);
-select char(2557 using utf8mb4);
-select convert(char(0xff,0x8f) using utf8mb4);
-
-#
-# Check convert + char + using
-#
-select hex(convert(char(2557 using latin1) using utf8mb4));
-
-#
-# char() without USING returns "binary" by default, any argument is ok
-#
-select hex(char(195));
-select hex(char(196));
-select hex(char(2557));
-
-
-
-#
-# Bug#12891: UNION doesn't return DISTINCT result for multi-byte characters
-#
-set names utf8mb4;
-create table t1 (a char(1)) default character set utf8mb4;
-create table t2 (a char(1)) default character set utf8mb4;
-insert into t1 values('a'),('a'),(0xE38182),(0xE38182);
-insert into t1 values('i'),('i'),(0xE38184),(0xE38184);
-select * from t1 union distinct select * from t2;
-drop table t1,t2;
-
-
-#
-# Bug#12371: executing prepared statement fails (illegal mix of collations)
-#
-set names utf8mb4;
-create table t1 (a char(10), b varchar(10));
-insert into t1 values ('bar','kostja');
-insert into t1 values ('kostja','bar');
-prepare my_stmt from "select * from t1 where a=?";
-set @a:='bar';
-execute my_stmt using @a;
-set @a:='kostja';
-execute my_stmt using @a;
-set @a:=null;
-execute my_stmt using @a;
-drop table if exists t1;
-
-
-#
-# Bug#21505 Create view - illegal mix of collation for operation 'UNION'
-#
---disable_warnings
-drop table if exists t1;
-drop view if exists v1, v2;
---enable_warnings
-set names utf8mb4;
-create table t1(col1 varchar(12) character set utf8mb4 collate utf8mb4_unicode_ci);
-insert into t1 values('t1_val');
-create view v1 as select 'v1_val' as col1;
-select coercibility(col1), collation(col1) from v1;
-create view v2 as select col1 from v1 union select col1 from t1;
-select coercibility(col1), collation(col1)from v2;
-drop view v1, v2;
-create view v1 as select 'v1_val' collate utf8mb4_swedish_ci as col1;
-select coercibility(col1), collation(col1) from v1;
-create view v2 as select col1 from v1 union select col1 from t1;
-select coercibility(col1), collation(col1) from v2;
-drop view v1, v2;
-drop table t1;
-
-#
-# Check conversion of NCHAR strings to subset (e.g. latin1).
-# Conversion is possible if string repertoire is ASCII.
-# Conversion is not possible if the string have extended characters
-#
-set names utf8mb4;
-create table t1 (a varchar(10) character set latin1, b int);
-insert into t1 values ('a',1);
-select concat(a, if(b>10, N'x', N'y')) from t1;
---error 1267
-select concat(a, if(b>10, N'æ', N'ß')) from t1;
-drop table t1;
-
-# Conversion tests for character set introducers
-set names utf8mb4;
-create table t1 (a varchar(10) character set latin1, b int);
-insert into t1 values ('a',1);
-select concat(a, if(b>10, _utf8mb4'x', _utf8mb4'y')) from t1;
---error 1267
-select concat(a, if(b>10, _utf8mb4'æ', _utf8mb4'ß')) from t1;
-drop table t1;
-
-# Conversion tests for introducer + HEX string
-set names utf8mb4;
-create table t1 (a varchar(10) character set latin1, b int);
-insert into t1 values ('a',1);
-select concat(a, if(b>10, _utf8mb4 0x78, _utf8mb4 0x79)) from t1;
---error 1267
-select concat(a, if(b>10, _utf8mb4 0xC3A6, _utf8mb4 0xC3AF)) from t1;
-drop table t1;
-
-# Conversion tests for "text_literal TEXT_STRING_literal" syntax structure
-set names utf8mb4;
-create table t1 (a varchar(10) character set latin1, b int);
-insert into t1 values ('a',1);
-select concat(a, if(b>10, 'x' 'x', 'y' 'y')) from t1;
---error 1267
-select concat(a, if(b>10, 'x' 'æ', 'y' 'ß')) from t1;
-drop table t1;
-
-
-#
-# Bug#19960: Inconsistent results when joining
-# InnoDB tables using partial UTF8 indexes
-#
---disable_warnings
-CREATE TABLE t1 (
- colA int(11) NOT NULL,
- colB varchar(255) character set utf8mb4 NOT NULL,
- PRIMARY KEY (colA)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
---enable_warnings
-INSERT INTO t1 (colA, colB) VALUES (1, 'foo'), (2, 'foo bar');
---disable_warnings
-CREATE TABLE t2 (
- colA int(11) NOT NULL,
- colB varchar(255) character set utf8mb4 NOT NULL,
- KEY bad (colA,colB(3))
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
---enable_warnings
-INSERT INTO t2 (colA, colB) VALUES (1, 'foo'),(2, 'foo bar');
-SELECT * FROM t1 JOIN t2 ON t1.colA=t2.colA AND t1.colB=t2.colB
-WHERE t1.colA < 3;
-DROP TABLE t1, t2;
-
-#
-# Bug#29205: truncation of UTF8 values when the UNION statement
-# forces collation to the binary charset
-#
-
-SELECT 'н1234567890' UNION SELECT _binary '1';
-SELECT 'н1234567890' UNION SELECT 1;
-
-SELECT '1' UNION SELECT 'н1234567890';
-SELECT 1 UNION SELECT 'н1234567890';
-
-CREATE TABLE t1 (c VARCHAR(11)) CHARACTER SET utf8mb4;
-CREATE TABLE t2 (b CHAR(1) CHARACTER SET binary, i INT);
-
-INSERT INTO t1 (c) VALUES ('н1234567890');
-INSERT INTO t2 (b, i) VALUES ('1', 1);
-
-SELECT c FROM t1 UNION SELECT b FROM t2;
-SELECT c FROM t1 UNION SELECT i FROM t2;
-
-SELECT b FROM t2 UNION SELECT c FROM t1;
-SELECT i FROM t2 UNION SELECT c FROM t1;
-
-DROP TABLE t1, t2;
-
-#
-# Bug#30982: CHAR(..USING..) can return a not-well-formed string
-# Bug #30986: Character set introducer followed by a HEX string can return bad result
-#
-set sql_mode=traditional;
-select hex(char(0xFF using utf8mb4));
-select hex(convert(0xFF using utf8mb4));
---error ER_INVALID_CHARACTER_STRING
-select hex(_utf8mb4 0x616263FF);
---error ER_INVALID_CHARACTER_STRING
-select hex(_utf8mb4 X'616263FF');
---error ER_INVALID_CHARACTER_STRING
-select hex(_utf8mb4 B'001111111111');
---error ER_INVALID_CHARACTER_STRING
-select (_utf8mb4 X'616263FF');
-set sql_mode=default;
-select hex(char(0xFF using utf8mb4));
-select hex(convert(0xFF using utf8mb4));
---error ER_INVALID_CHARACTER_STRING
-select hex(_utf8mb4 0x616263FF);
---error ER_INVALID_CHARACTER_STRING
-select hex(_utf8mb4 X'616263FF');
---error ER_INVALID_CHARACTER_STRING
-select hex(_utf8mb4 B'001111111111');
---error ER_INVALID_CHARACTER_STRING
-select (_utf8mb4 X'616263FF');
-
-#
-# Bug #36772: When using UTF8, CONVERT with GROUP BY returns truncated results
-#
-CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL);
-INSERT INTO t1 VALUES (70000, 1092), (70001, 1085), (70002, 1065);
-SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
-SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1;
-ALTER TABLE t1 ADD UNIQUE (b);
-SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
-DROP INDEX b ON t1;
-SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
-ALTER TABLE t1 ADD INDEX (b);
-SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) from t1 GROUP BY b;
-DROP TABLE t1;
-
---echo #
---echo # Bug#26474: Add Sinhala script (Sri Lanka) collation to MySQL
---echo #
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-CREATE TABLE t1 (
- predicted_order int NOT NULL,
- utf8mb4_encoding VARCHAR(10) NOT NULL
-) CHARACTER SET utf8mb4;
-INSERT INTO t1 VALUES (19, x'E0B696'), (30, x'E0B69AE0B798'), (61, x'E0B6AF'), (93, x'E0B799'), (52, x'E0B6A6'), (73, x'E0B6BBE0B78AE2808D'), (3, x'E0B686'), (56, x'E0B6AA'), (55, x'E0B6A9'), (70, x'E0B6B9'), (94, x'E0B79A'), (80, x'E0B785'), (25, x'E0B69AE0B791'), (48, x'E0B6A2'), (13, x'E0B690'), (86, x'E0B793'), (91, x'E0B79F'), (81, x'E0B786'), (79, x'E0B784'), (14, x'E0B691'), (99, x'E0B78A'), (8, x'E0B68B'), (68, x'E0B6B7'), (22, x'E0B69A'), (16, x'E0B693'), (33, x'E0B69AE0B7B3'), (38, x'E0B69AE0B79D'), (21, x'E0B683'), (11, x'E0B68E'), (77, x'E0B782'), (40, x'E0B69AE0B78A'), (101, x'E0B78AE2808DE0B6BB'), (35, x'E0B69AE0B79A'), (1, x'E0B7B4'), (9, x'E0B68C'), (96, x'E0B79C'), (6, x'E0B689'), (95, x'E0B79B'), (88, x'E0B796'), (64, x'E0B6B3'), (26, x'E0B69AE0B792'), (82, x'E0B78F'), (28, x'E0B69AE0B794'), (39, x'E0B69AE0B79E'), (97, x'E0B79D'), (2, x'E0B685'), (75, x'E0B780'), (34, x'E0B69AE0B799'), (69, x'E0B6B8'), (83, x'E0B790'), (18, x'E0B695'), (90, x'E0B7B2'), (17, x'E0B694'), (72, x'E0B6BB'), (66, x'E0B6B5'), (59, x'E0B6AD'), (44, x'E0B69E'), (15, x'E0B692'), (23, x'E0B69AE0B78F'), (65, x'E0B6B4'), (42, x'E0B69C'), (63, x'E0B6B1'), (85, x'E0B792'), (47, x'E0B6A1'), (49, x'E0B6A3'), (92, x'E0B7B3'), (78, x'E0B783'), (36, x'E0B69AE0B79B'), (4, x'E0B687'), (24, x'E0B69AE0B790'), (87, x'E0B794'), (37, x'E0B69AE0B79C'), (32, x'E0B69AE0B79F'), (29, x'E0B69AE0B796'), (43, x'E0B69D'), (62, x'E0B6B0'), (100, x'E0B78AE2808DE0B6BA'), (60, x'E0B6AE'), (45, x'E0B69F'), (12, x'E0B68F'), (46, x'E0B6A0'), (50, x'E0B6A5'), (51, x'E0B6A4'), (5, x'E0B688'), (76, x'E0B781'), (89, x'E0B798'), (74, x'E0B6BD'), (10, x'E0B68D'), (57, x'E0B6AB'), (71, x'E0B6BA'), (58, x'E0B6AC'), (27, x'E0B69AE0B793'), (54, x'E0B6A8'), (84, x'E0B791'), (31, x'E0B69AE0B7B2'), (98, x'E0B79E'), (53, x'E0B6A7'), (41, x'E0B69B'), (67, x'E0B6B6'), (7, x'E0B68A'), (20, x'E0B682');
-SELECT predicted_order, hex(utf8mb4_encoding) FROM t1 ORDER BY utf8mb4_encoding COLLATE utf8mb4_sinhala_ci;
-DROP TABLE t1;
-
---echo #
---echo # Bug#32914 Character sets: illegal characters in utf8mb4 and utf32 columns
---echo #
-create table t1 (utf8mb4 char(1) character set utf8mb4);
---echo Testing [F0][90..BF][80..BF][80..BF]
-insert into t1 values (0xF0908080);
-insert into t1 values (0xF0BFBFBF);
-insert ignore into t1 values (0xF08F8080);
-select hex(utf8mb4) from t1 order by binary utf8mb4;
-delete from t1;
-
---echo Testing [F2..F3][80..BF][80..BF][80..BF]
-insert into t1 values (0xF2808080);
-insert into t1 values (0xF2BFBFBF);
-select hex(utf8mb4) from t1 order by binary utf8mb4;
-delete from t1;
-
---echo Testing [F4][80..8F][80..BF][80..BF]
-insert into t1 values (0xF4808080);
-insert into t1 values (0xF48F8080);
-insert ignore into t1 values (0xF4908080);
-select hex(utf8mb4) from t1 order by binary utf8mb4;
-drop table t1;
-
-
---echo #
---echo # Check strnxfrm() with odd length
---echo #
-set max_sort_length=5;
-select @@max_sort_length;
-create table t1 (a varchar(128) character set utf8mb4 collate utf8mb4_general_ci);
-insert into t1 values ('a'),('b'),('c');
-select * from t1 order by a;
-alter table t1 modify a varchar(128) character set utf8mb4 collate utf8mb4_bin;
-select * from t1 order by a;
-drop table t1;
-set max_sort_length=default;
-
---echo #
---echo # Bug#26180: Can't add columns to tables created with utf8mb4 text indexes
---echo #
-CREATE TABLE t1 (
- clipid INT NOT NULL,
- Tape TINYTEXT,
- PRIMARY KEY (clipid),
- KEY tape(Tape(255))
-) CHARACTER SET=utf8mb4;
-ALTER TABLE t1 ADD mos TINYINT DEFAULT 0 AFTER clipid;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-
-#--echo #
-#--echo # Check that supplementary characters are not allowed in identifiers
-#--echo #
-# TODO: activate this when system_charset_info is changed to utf8mb4
-#--error 1300
-#CREATE DATABASE `𐀀`;
-#--error 1300
-#CREATE TABLE `𐀀` (a int);
-#--error 1166
-#CREATE TABLE test.t1 SELECT '𐀀';
-#--error 1300
-#CREATE USER `𐀀`;
-
---echo #
---echo # Testing 4-byte values.
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-CREATE TABLE t1 (
- u_decimal int NOT NULL,
- utf8mb4_encoding VARCHAR(10) NOT NULL
-) CHARACTER SET utf8mb4;
-# Source of the following values: http://www.fileformat.info/info/unicode/block/index.htm
-# SINGLE BARLINE
-INSERT INTO t1 VALUES (119040, x'f09d8480'),
-# G CLEF
- (119070, x'f09d849e'),
-# HALF NOTE
- (119134, x'f09d859e'),
-# MUSICAL SYMBOL CROIX
- (119247, x'f09d878f'),
-# MATHEMATICAL BOLD ITALIC CAPITAL DELTA
- (120607, x'f09d9c9f'),
-# SANS-SERIF BOLD ITALIC CAPITAL PI
- (120735, x'f09d9e9f'),
-# <Plane 16 Private Use, Last> (last 4 byte character)
- (1114111, x'f48fbfbf'),
-# VARIATION SELECTOR-256
- (917999, x'f3a087af');
-# All from musical chars
-INSERT INTO t1 VALUES (119070, x'f09d849ef09d859ef09d859ef09d8480f09d859ff09d859ff09d859ff09d85a0f09d85a0f09d8480');
-# Mix of 3-byte and 4-byte chars
-INSERT INTO t1 VALUES (65131, x'efb9abf09d849ef09d859ef09d859ef09d8480f09d859fefb9abefb9abf09d85a0efb9ab');
-# All from musical chars, but 11 instead of 10 chars. truncated
-INSERT IGNORE INTO t1 VALUES (119070, x'f09d849ef09d859ef09d859ef09d8480f09d859ff09d859ff09d859ff09d85a0f09d85a0f09d8480f09d85a0');
-
-SELECT u_decimal, hex(utf8mb4_encoding) FROM t1 ORDER BY utf8mb4_encoding COLLATE utf8mb4_general_ci, BINARY utf8mb4_encoding;
-
-# First invalid 4 byte value
-INSERT IGNORE INTO t1 VALUES (1114111, x'f5808080');
-
-SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE
- table_name= 't1' AND column_name= 'utf8mb4_encoding';
-
---disable_warnings
-DROP TABLE IF EXISTS t2;
---enable_warnings
-CREATE TABLE t2 (
- u_decimal int NOT NULL,
- utf8mb3_encoding VARCHAR(10) NOT NULL
-) CHARACTER SET utf8mb3;
-# LATIN CAPITAL LETTER VEND
-INSERT INTO t2 VALUES (42856, x'ea9da8');
-# SMALL COMMERCIAL AT
-INSERT INTO t2 VALUES (65131, x'efb9ab');
-# <Plane 16 Private Use, Last> (last 4 byte character)
-INSERT IGNORE INTO t2 VALUES (1114111, x'f48fbfbf');
-
-SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE
- table_name= 't2' AND column_name= 'utf8mb3_encoding';
-
-# Update a 3-byte char col with a 4-byte char, error
-UPDATE IGNORE t2 SET utf8mb3_encoding= x'f48fbfbd' where u_decimal= 42856;
-
-# Update to a 3-byte char casted to 4-byte, error?
-UPDATE t2 SET utf8mb3_encoding= _utf8mb4 x'ea9da8' where u_decimal= 42856;
-
-# Returns utfmb4
-SELECT HEX(CONCAT(utf8mb4_encoding, _utf8 x'ea9da8')) FROM t1;
-SELECT HEX(CONCAT(utf8mb4_encoding, utf8mb3_encoding)) FROM t1,t2;
-
-#--error ER_INVALID_CHARACTER_STRING
-#SELECT CONCAT(_utf8 utf8mb4_encoding, _utf8 '|') FROM t1;
-#--error ER_INVALID_CHARACTER_STRING
-#SELECT CONCAT(_utf8mb3 utf8mb4_encoding, _utf8 '|') FROM t1;
-
-SELECT count(*) FROM t1, t2
- WHERE t1.utf8mb4_encoding > t2.utf8mb3_encoding;
-
-# Alter from 4-byte charset to 3-byte charset, error
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-ALTER TABLE t1 CONVERT TO CHARACTER SET utf8;
-SHOW CREATE TABLE t1;
-SELECT u_decimal,hex(utf8mb4_encoding),utf8mb4_encoding FROM t1;
-
-# Alter table from utf8 to utf8mb4
-ALTER TABLE t2 CONVERT TO CHARACTER SET utf8mb4;
-SHOW CREATE TABLE t2;
-SELECT u_decimal,hex(utf8mb3_encoding) FROM t2;
-
-# Alter table back from utf8mb4 to utf8
-ALTER TABLE t2 CONVERT TO CHARACTER SET utf8mb3;
-SHOW CREATE TABLE t2;
-SELECT u_decimal,hex(utf8mb3_encoding) FROM t2;
-
-# ALter of utf8mb4 column to utf8
-ALTER TABLE t1 MODIFY utf8mb4_encoding VARCHAR(10) CHARACTER SET utf8mb3;
-SHOW CREATE TABLE t1;
-SELECT u_decimal,hex(utf8mb4_encoding) FROM t1;
-
-# ALter of utf8 column to utf8mb4
-ALTER TABLE t1 MODIFY utf8mb4_encoding VARCHAR(10) CHARACTER SET utf8mb4;
-SHOW CREATE TABLE t1;
-SELECT u_decimal,hex(utf8mb4_encoding) FROM t1;
-
-# ALter of utf8 column to utf8mb4
-ALTER TABLE t2 MODIFY utf8mb3_encoding VARCHAR(10) CHARACTER SET utf8mb4;
-SHOW CREATE TABLE t2;
-SELECT u_decimal,hex(utf8mb3_encoding) FROM t2;
-
---disable_warnings
-DROP TABLE IF EXISTS t3;
---enable_warnings
-CREATE TABLE t3 (
- u_decimal int NOT NULL,
- utf8mb3_encoding VARCHAR(10) NOT NULL
-) CHARACTER SET utf8;
-
-# Insert select utf8mb4 (4-byte) into utf8 (3-byte), error
-#--error ER_INVALID_CHARACTER_STRING
-INSERT INTO t3 SELECT * FROM t1;
-
---disable_warnings
-DROP TABLE IF EXISTS t4;
---enable_warnings
-CREATE TABLE t4 (
- u_decimal int NOT NULL,
- utf8mb4_encoding VARCHAR(10) NOT NULL
-) CHARACTER SET utf8mb4;
-
-# Insert select utf8 (3-byte) into utf8mb4 (4-byte)
-INSERT INTO t3 SELECT * FROM t2;
-
-DROP TABLE t1;
-DROP TABLE t2;
-DROP TABLE t3;
-DROP TABLE t4;
-
---echo #
---echo # Testing that mixing utf8 and utf8mb4 collations returns utf8mb4
---echo #
-SELECT CHARSET(CONCAT(_utf8mb4'a',_utf8'b'));
-
-CREATE TABLE t1 (utf8mb4 VARCHAR(10) CHARACTER SET utf8mb4 NOT NULL);
-INSERT INTO t1 VALUES (x'ea9da8'),(x'f48fbfbf');
-SELECT CONCAT(utf8mb4, _utf8 x'ea9da8') FROM t1 LIMIT 0;
-
-CREATE TABLE t2 (utf8mb3 VARCHAR(10) CHARACTER SET utf8mb3 NOT NULL);
-INSERT INTO t2 VALUES (x'ea9da8');
-
-SELECT HEX(CONCAT(utf8mb4, utf8mb3)) FROM t1,t2 ORDER BY 1;
-SELECT CHARSET(CONCAT(utf8mb4, utf8mb3)) FROM t1, t2 LIMIT 1;
-
-CREATE TEMPORARY TABLE t3 AS SELECT *, concat(utf8mb4,utf8mb3) FROM t1, t2;
-SHOW CREATE TABLE t3;
-DROP TEMPORARY TABLE t3;
-
-SELECT * FROM t1, t2 WHERE t1.utf8mb4 > t2.utf8mb3;
-SELECT * FROM t1, t2 WHERE t1.utf8mb4 = t2.utf8mb3;
-SELECT * FROM t1, t2 WHERE t1.utf8mb4 < t2.utf8mb3;
-
-DROP TABLE t1;
-DROP TABLE t2;
-
---echo #
---echo # Check that mixing utf8mb4 with an invalid utf8 constant returns error
---echo #
-# This should perhaps be changed to return ER_INVALID_CHARACTER_STRING
-CREATE TABLE t1 (utf8mb4 VARCHAR(10) CHARACTER SET utf8mb4);
-INSERT INTO t1 VALUES (x'f48fbfbf');
---error ER_CANT_AGGREGATE_2COLLATIONS
-SELECT CONCAT(utf8mb4, _utf8 '') FROM t1;
---error ER_CANT_AGGREGATE_2COLLATIONS
-SELECT CONCAT('a', _utf8 '') FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # Bug#51675 Server crashes on inserting 4 byte char.
---echo # after ALTER TABLE to 'utf8mb4'
---echo #
-SET NAMES utf8;
-CREATE TABLE t1 (
- subject varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
- p VARCHAR(15) CHARACTER SET utf8
-) DEFAULT CHARSET=latin1;
-
-# Alter old table, add index
-ALTER TABLE t1 ADD INDEX (subject);
-
-# Alter old 'utf8' table to new 'utf8mb4'
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-ALTER TABLE t1
- DEFAULT CHARACTER SET utf8,
- MODIFY subject varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
- MODIFY p varchar(255) CHARACTER SET utf8;
-SHOW CREATE TABLE t1;
-
-INSERT INTO t1(subject) VALUES ('abcd');
-# Insert 4 byte characters
-INSERT INTO t1(subject) VALUES(x'f0909080');
-DROP TABLE t1;
-
-#
-# Make sure fulltext does not crash on supplementary characters
-#
-CREATE TABLE t1 (a TEXT CHARACTER SET utf8mb4, FULLTEXT INDEX(a));
-INSERT INTO t1 VALUES (0xF0A08080 /* U+20000 */ );
-DROP TABLE t1;
-
---echo #
---echo # Bug #51676 Server crashes on SELECT, ORDER BY on 'utf8mb4' column
---echo #
-SET NAMES utf8mb4;
-CREATE TABLE t1 (
- subject varchar(255) character set utf8mb4 collate utf8mb4_unicode_ci,
- p varchar(15) character set utf8mb4
-) DEFAULT CHARSET=latin1;
-# Insert 4 byte characters
-# 4byte character
-INSERT INTO t1(subject) VALUES(0xF0909080);
-# mix of 3 byte & 4 byte
-INSERT INTO t1(subject) VALUES(0x616263F0909080646566);
-SHOW CREATE TABLE t1;
-SELECT * FROM t1 ORDER BY 1;
-SELECT hex(subject), length(subject), char_length(subject), octet_length(subject) FROM t1 ORDER BY 1;
-SELECT subject FROM t1 ORDER BY 1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#52520 Difference in tinytext utf column metadata
---echo #
-CREATE TABLE t1 (
- s1 TINYTEXT CHARACTER SET utf8mb4,
- s2 TEXT CHARACTER SET utf8mb4,
- s3 MEDIUMTEXT CHARACTER SET utf8mb4,
- s4 LONGTEXT CHARACTER SET utf8mb4
-);
---enable_metadata
-SET NAMES utf8mb4, @@character_set_results=NULL;
-SELECT *, HEX(s1) FROM t1;
-SET NAMES latin1;
-SELECT *, HEX(s1) FROM t1;
-SET NAMES utf8mb4;
-SELECT *, HEX(s1) FROM t1;
---disable_metadata
-CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t1, t2;
-
---echo #
---echo # Bug#13581962 HIGH MEMORY USAGE ATTEMPT, THEN CRASH WITH LONGTEXT, UNION, USER VARIABLE
---echo # Bug#14096619 UNABLE TO RESTORE DATABASE DUMP
---echo #
-
-CREATE TABLE t1(f1 LONGTEXT CHARACTER SET utf8mb4);
-INSERT INTO t1 VALUES ('a');
-SELECT @a:= CAST(f1 AS SIGNED) FROM t1
-UNION ALL
-SELECT CAST(f1 AS SIGNED) FROM t1;
-DROP TABLE t1;
-
---echo # End of test for Bug#13581962,Bug#14096619
-
---echo #
---echo # MDEV-9319 ALTER from a bigger to a smaller blob type truncates too much data
---echo #
-SET NAMES utf8mb4;
-CREATE TABLE t1 (a TEXT CHARACTER SET utf8mb4);
-INSERT INTO t1 VALUES (REPEAT('😎',100));
-SELECT OCTET_LENGTH(a) FROM t1;
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-ALTER TABLE t1 MODIFY a TINYTEXT CHARACTER SET utf8mb4;
-SELECT OCTET_LENGTH(a),a FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-8402 Bug#77473 Bug#21317406 TRUNCATED DATA WITH SUBQUERY & UTF8
---echo #
---echo #
-
-SET NAMES utf8mb4;
-SELECT length(repeat(_utf8mb4 0xE29883, 21844)) AS data;
-SELECT length(data) AS len
-FROM ( SELECT repeat(_utf8mb4 0xE29883, 21844) AS data ) AS sub;
-
-SELECT length(repeat(_utf8mb4 0xE29883, 21846)) AS data;
-SELECT length(data) AS len
-FROM ( SELECT repeat(_utf8mb4 0xE29883, 21846) AS data ) AS sub;
-
-SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 21844) AS data ) AS sub;
-SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 21845) AS data ) AS sub;
-SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 21846) AS data ) AS sub;
-SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 65535) AS data ) AS sub;
-SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 65536) AS data ) AS sub;
-
---echo #
---echo # End of 5.5 tests
---echo #
-
-
---echo #
---echo # WL#3664 WEIGHT_STRING
---echo #
-
-set names utf8mb4;
---source include/weight_string.inc
---source include/weight_string_euro.inc
---source include/weight_string_l1.inc
-
-set @@collation_connection=utf8mb4_bin;
---source include/weight_string.inc
---source include/weight_string_euro.inc
---source include/weight_string_l1.inc
-
---echo #
---echo # End of 5.6 tests
---echo #
-
---echo #
---echo # Start of 10.0 tests
---echo #
-
---echo #
---echo # MDEV-11343 LOAD DATA INFILE fails to load data with an escape character followed by a multi-byte character
---echo #
-CREATE TABLE t1 (a TEXT CHARACTER SET utf8mb4);
-LOAD DATA INFILE '../../std_data/loaddata/mdev-11343.txt' INTO TABLE t1 CHARACTER SET utf8mb4;
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-6566 Different INSERT behaviour on bad bytes with and without character set conversion
---echo #
-
---echo #
---echo # This test sets session character set to 3-byte utf8,
---echo # but then sends a 4-byte sequence (which is wrong for 3-byte utf8).
---echo # It should be replaced to four question marks: '????' in both columns
---echo # (i.e. four unknown bytes are replaced to four question marks),
---echo # then the rest of the string should be stored, so we get 'a ???? b'.
---echo #
-SET NAMES utf8;
-CREATE TABLE t1 (
- a VARCHAR(32) CHARACTER SET utf8mb4,
- b VARCHAR(32) CHARACTER SET utf8
-);
-INSERT IGNORE INTO t1 SELECT 'a 😁 b', 'a 😁 b';
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # This test sets session character set to 4-byte utf8,
---echo # then normally sends a 4-byte sequence.
---echo # It should be stored AS IS into the utf8mb4 column (a),
---echo # and should be replaced to a single question mark in the utf8 column (b)
---echo # (i.e. one character that cannot be converted is replaced to one question mark).
---echo #
-
-SET NAMES utf8mb4;
-CREATE TABLE t1 (
- a VARCHAR(32) CHARACTER SET utf8mb4,
- b VARCHAR(32) CHARACTER SET utf8
-);
-INSERT IGNORE INTO t1 SELECT 'a 😁 b', 'a 😁 b';
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8949: COLUMN_CREATE unicode name breakage
---echo #
-
-SET NAMES utf8mb4;
-SELECT COLUMN_JSON(COLUMN_CREATE(_utf8mb4 0xF09F988E, 1));
-SELECT COLUMN_LIST(COLUMN_CREATE(_utf8mb4 0xF09F988E, 1));
-SELECT COLUMN_GET(COLUMN_CREATE(_utf8mb4 0xF09F988E, 1), _utf8mb4 0xF09F988E
-as int);
-
-CREATE TABLE t1 AS SELECT
- COLUMN_LIST(COLUMN_CREATE('a',1)),
- COLUMN_JSON(COLUMN_CREATE('b',1));
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-SET NAMES default;
-
---echo #
---echo # End of 10.0 tests
---echo #
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-6572 "USE dbname" with a bad sequence erroneously connects to a wrong database
---echo #
-SET NAMES utf8mb4;
---error ER_INVALID_CHARACTER_STRING
-SELECT * FROM `test😁😁test`;
-
---echo #
---echo # MDEV-7231 Field ROUTINE_DEFINITION in INFORMATION_SCHEMA.`ROUTINES` contains broken procedure body when used shielding quotes inside.
---echo #
-# Non-BMP characters should be replaced to '?' in ROUTINE_DEFINITION/body_utf8
-SET NAMES utf8mb4;
-CREATE FUNCTION f1() RETURNS TEXT CHARACTER SET utf8mb4
-RETURN CONCAT('😎','x😎','😎y','x😎y');
-SELECT ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES
-WHERE ROUTINE_SCHEMA='test' AND SPECIFIC_NAME ='f1';
-SELECT body_utf8 FROM mysql.proc WHERE name='f1';
-DROP FUNCTION f1;
-
---echo #
---echo # End of 10.1 tests
---echo #
-
-
---echo #
---echo # End of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-9842 LOAD DATA INFILE does not work well with a TEXT column when using sjis
---echo #
-CREATE TABLE t1 (a TEXT CHARACTER SET utf8mb4);
-LOAD DATA INFILE '../../std_data/loaddata/mdev9823.utf8mb4.txt' IGNORE INTO TABLE t1 CHARACTER SET utf8mb4 IGNORE 4 LINES;
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-9711 NO PAD Collatons
---echo #
-let $coll='utf8mb4_general_nopad_ci';
-let $coll_pad='utf8mb4_general_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='utf8mb4_nopad_bin';
-let $coll_pad='utf8mb4_bin';
---source include/ctype_pad_all_engines.inc
-
---echo #
---echo # MDEV-10867 PREPARE..EXECUTE is not consistent about non-ASCII characters
---echo #
-SET NAMES utf8mb4;
-SELECT '😎' AS c;
-
-SET @src='SELECT ''😎'' AS c';
-PREPARE stmt FROM @src;
-EXECUTE stmt;
-EXECUTE IMMEDIATE @src;
-
-PREPARE stmt FROM 'SELECT ''😎'' AS c';
-EXECUTE stmt;
-EXECUTE IMMEDIATE 'SELECT ''😎'' AS c';
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/ctype_utf8mb4_heap.test b/mysql-test/t/ctype_utf8mb4_heap.test
deleted file mode 100644
index 5611ea9746f..00000000000
--- a/mysql-test/t/ctype_utf8mb4_heap.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_utf8mb4.inc
-
-let $engine= heap;
-let $is_heap= 1;
---source include/ctype_utf8mb4.inc
-
diff --git a/mysql-test/t/ctype_utf8mb4_innodb-master.opt b/mysql-test/t/ctype_utf8mb4_innodb-master.opt
deleted file mode 100644
index 96f0ce3f36c..00000000000
--- a/mysql-test/t/ctype_utf8mb4_innodb-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---default-storage-engine=MyISAM
diff --git a/mysql-test/t/ctype_utf8mb4_innodb.test b/mysql-test/t/ctype_utf8mb4_innodb.test
deleted file mode 100644
index 3bf0612a1ab..00000000000
--- a/mysql-test/t/ctype_utf8mb4_innodb.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_utf8mb4.inc
---source include/have_innodb.inc
-
-let $engine= InnoDB;
---source include/ctype_utf8mb4.inc
-
diff --git a/mysql-test/t/ctype_utf8mb4_myisam.test b/mysql-test/t/ctype_utf8mb4_myisam.test
deleted file mode 100644
index e7ec43633f9..00000000000
--- a/mysql-test/t/ctype_utf8mb4_myisam.test
+++ /dev/null
@@ -1,5 +0,0 @@
---source include/have_utf8mb4.inc
-
-let $engine= MyISAM;
---source include/ctype_utf8mb4.inc
-
diff --git a/mysql-test/t/ctype_utf8mb4_uca.test b/mysql-test/t/ctype_utf8mb4_uca.test
deleted file mode 100644
index 160cb48bad6..00000000000
--- a/mysql-test/t/ctype_utf8mb4_uca.test
+++ /dev/null
@@ -1,110 +0,0 @@
--- source include/have_ucs2.inc
--- source include/have_utf8mb4.inc
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
---echo #
---echo # Start of 5.5 tests
---echo #
-
-SET NAMES utf8mb4;
-CREATE TABLE t1 (c1 CHAR(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin);
-
---source include/ctype_unicode_latin.inc
-
-SELECT GROUP_CONCAT(c1 ORDER BY c1 SEPARATOR '') FROM t1 GROUP BY c1 COLLATE utf8mb4_unicode_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1 SEPARATOR '') FROM t1 GROUP BY c1 COLLATE utf8mb4_icelandic_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1 SEPARATOR '') FROM t1 GROUP BY c1 COLLATE utf8mb4_latvian_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1 SEPARATOR '') FROM t1 GROUP BY c1 COLLATE utf8mb4_romanian_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1 SEPARATOR '') FROM t1 GROUP BY c1 COLLATE utf8mb4_slovenian_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1 SEPARATOR '') FROM t1 GROUP BY c1 COLLATE utf8mb4_polish_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1 SEPARATOR '') FROM t1 GROUP BY c1 COLLATE utf8mb4_estonian_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1 SEPARATOR '') FROM t1 GROUP BY c1 COLLATE utf8mb4_spanish_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1 SEPARATOR '') FROM t1 GROUP BY c1 COLLATE utf8mb4_swedish_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1 SEPARATOR '') FROM t1 GROUP BY c1 COLLATE utf8mb4_turkish_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1 SEPARATOR '') FROM t1 GROUP BY c1 COLLATE utf8mb4_czech_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1 SEPARATOR '') FROM t1 GROUP BY c1 COLLATE utf8mb4_danish_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1 SEPARATOR '') FROM t1 GROUP BY c1 COLLATE utf8mb4_lithuanian_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1 SEPARATOR '') FROM t1 GROUP BY c1 COLLATE utf8mb4_slovak_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1 SEPARATOR '') FROM t1 GROUP BY c1 COLLATE utf8mb4_spanish2_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1 SEPARATOR '') FROM t1 GROUP BY c1 COLLATE utf8mb4_roman_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1 SEPARATOR '') FROM t1 GROUP BY c1 COLLATE utf8mb4_esperanto_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1 SEPARATOR '') FROM t1 GROUP BY c1 COLLATE utf8mb4_hungarian_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1 SEPARATOR '') FROM t1 GROUP BY c1 COLLATE utf8mb4_croatian_mysql561_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1 SEPARATOR '') FROM t1 GROUP BY c1 COLLATE utf8mb4_croatian_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1 SEPARATOR '') FROM t1 GROUP BY c1 COLLATE utf8mb4_german2_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1 SEPARATOR '') FROM t1 GROUP BY c1 COLLATE utf8mb4_unicode_520_ci;
-SELECT GROUP_CONCAT(c1 ORDER BY c1 SEPARATOR '') FROM t1 GROUP BY c1 COLLATE utf8mb4_vietnamese_ci;
-
-DROP TABLE t1;
-
---echo #
---echo # Start of 5.5 tests
---echo #
-#
-# Bug#57737 Character sets: search fails with like, contraction, index
-# Test my_like_range and contractions
-#
-SET collation_connection=utf8mb4_czech_ci;
---source include/ctype_czech.inc
---source include/ctype_like_ignorable.inc
-
---echo #
---echo # End of 5.5 tests
---echo #
-
-
---echo #
---echo # Start of MariaDB-10.0 tests
---echo #
---echo
-
---echo #
---echo # MDEV-4929 Myanmar collation
---echo #
-SET NAMES utf8mb4 COLLATE utf8mb4_myanmar_ci;
---source include/ctype_myanmar.inc
-
---echo #
---echo # End of MariaDB-10.0 tests
---echo #
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
-SET NAMES utf8;
-SET collation_connection=utf8mb4_thai_520_w2;
---source include/ctype_uca_w2.inc
---source include/ctype_thai.inc
-
---echo #
---echo # End of 10.1 tests
---echo #
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-9711 NO PAD Collatons
---echo #
-SET NAMES utf8mb4;
-let $coll='utf8mb4_unicode_nopad_ci';
-let $coll_pad='utf8mb4_unicode_ci';
---source include/ctype_pad_all_engines.inc
-
-let $coll='utf8mb4_unicode_520_nopad_ci';
-let $coll_pad='utf8mb4_unicode_520_ci';
---source include/ctype_pad_all_engines.inc
-
-SET NAMES utf8mb4 COLLATE utf8mb4_unicode_520_nopad_ci;
---source include/ctype_like_range_mdev14350.inc
-SET NAMES utf8mb4;
-
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/custom_aggregate_functions.test b/mysql-test/t/custom_aggregate_functions.test
deleted file mode 100644
index 13eb3bed2af..00000000000
--- a/mysql-test/t/custom_aggregate_functions.test
+++ /dev/null
@@ -1,785 +0,0 @@
-create table t2 (sal int(10));
-delimiter |;
-
-create aggregate function f1(x INT) returns int
-begin
- declare continue handler for not found return 0;
- loop
- fetch group next row;
- insert into t2 (sal) values (x);
- end loop;
-end|
-
-delimiter ;|
-
-create table t1 (sal int(10),id int(10));
-INSERT INTO t1 (sal,id) VALUES (5000,1);
-INSERT INTO t1 (sal,id) VALUES (2000,1);
-INSERT INTO t1 (sal,id) VALUES (1000,1);
-select f1(sal) from t1 where id>= 1;
-select * from t2;
-drop table t2;
-drop function f1;
-
-delimiter |;
---error ER_INVALID_AGGREGATE_FUNCTION
-create aggregate function f1(x INT) returns INT
-begin
- insert into t1(sal) values (x);
- return x;
-end|
-
---error ER_NOT_AGGREGATE_FUNCTION
-create function f1(x INT) returns INT
-begin
- set x=5;
- fetch group next row;
-return x+1;
-end |
-
-create aggregate function f1(x INT) returns INT
-begin
- declare continue handler for not found return x;
- loop
- fetch group next row;
- end loop;
-end |
-delimiter ;|
-
-select f1(1);
-show create function f1;
---error ER_PARSE_ERROR
-alter function f1 aggregate none;
-show create function f1;
-select f1(1);
-drop function f1;
-
-
-delimiter |;
-
-
-create aggregate function f2(i int) returns int
-begin
- FEtCH GROUP NEXT ROW;
- if i <= 0 then
- return 0;
- elseif i = 1 then
- return (select count(*) from t1 where id = i);
- else
- return (select count(*) + f2( i - 1) from t1 where id = i);
- end if;
-end|
-select f2(1)|
-# Since currently recursive functions are disallowed ER_SP_NO_RECURSION
-# error will be returned, once we will allow them error about
-# insufficient number of locked tables will be returned instead.
---error ER_SP_NO_RECURSION
-select f2(2)|
---error ER_SP_NO_RECURSION
-select f2(3)|
-drop function f2|
-
-create aggregate function f1(x int) returns int
-begin
- declare mini int default 0;
- declare continue handler for not found return mini;
- loop
- fetch group next row;
- set mini= mini+x;
- fetch group next row;
- end loop;
-end|
-
-
-delimiter ;|
-
-select f1(10);
-select f1(sal) from t1;
-select f1(sal) from t1 where 1=0;
-drop function f1;
-delimiter |;
-
-
-#WITHOUT RETURN STATEMENT IN AGGREGATE FUNCTIONS
---error 1320
-create aggregate function f1(x int) returns int
-begin
- declare mini int default 0;
- LOOP
- FETCH GROUP NEXT ROW;
- set mini = mini + x;
- END LOOP;
-end|
-
-#without handler
-create aggregate function f1(x int) returns int
-begin
- declare mini int default 0;
- LOOP
- FETCH GROUP NEXT ROW;
- set mini = mini + x;
- END LOOP;
- return -1;
-end|
-
---error 1329
-select f1(sal) from t1|
-drop function f1|
-
-#without loop
-create aggregate function f1(x int) returns int
-begin
- declare mini int default 0;
- declare continue handler for not found return mini;
- FETCH GROUP NEXT ROW;
- set mini = mini + x;
-end|
-
---error 1321
-select f1(sal) from t1|
-drop function f1|
-
-
-create aggregate function f1(x int) returns int
-begin
- declare mini int default 0;
- declare continue handler for not found set mini=-1;
- LOOP
- FETCH GROUP NEXT ROW;
- set mini = mini + x;
- END LOOP;
- return 0;
-end|
-
---error 1321
-select f1(sal) from t1|
-drop function f1|
-drop table t1|
-
-delimiter ;|
-
-# primary indexing
-
-create table t1 (sal int, id int, val int, counter int, primary key(id));
-INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 10, 2);
-INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 2, 16, 2);
-INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 3, 18, 1);
-INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 4, 15, 3);
-INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 5, 11, 5);
-
-delimiter |;
-
-create aggregate function f1(x INT) returns double
-begin
- declare z double default 0;
- declare continue handler for not found return z;
- loop
- fetch group next row;
- set z= z+x;
- end loop;
-end|
-
-delimiter ;|
-
---sorted_result
-select id, f1(sal) from t1 where id>= 1 group by counter order by val;
---sorted_result
-select id, f1(sal) from t1;
---sorted_result
-select id, f1(sal) from t1 where id>= 1;
---sorted_result
-select id, f1(sal) from t1 where id>= 1 group by counter;
---sorted_result
-select id, f1(sal) from t1 where id>= 1 group by id;
---sorted_result
-select id, f1(sal) from t1 where id>= 1 group by val;
---sorted_result
-select id, f1(sal) from t1 where id>= 1 group by counter order by counter;
---sorted_result
-select id, f1(sal) from t1 where id>= 1 group by counter order by val;
---sorted_result
-select id, f1(sal) from t1 where id>= 1 group by counter order by id;
---sorted_result
-select id, f1(sal) from t1 where id>= 1 group by val order by counter;
---sorted_result
-select id, f1(sal) from t1 where id>= 1 group by val order by id;
---sorted_result
-select id, f1(sal) from t1 where id>= 1 group by val order by val;
-drop table t1;
-
-#unique index
-
-create table t1 (sal int, id int, val int, counter int, primary key(id), unique key(val));
-
-INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 10, 2);
-INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 2, NULL, 2);
-INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 3, 18, 1);
-INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 4, 15, 3);
-INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 5, 11, 5);
-
---sorted_result
-select id, f1(sal) from t1;
---sorted_result
-select id, f1(sal) from t1 where id>= 1;
---sorted_result
-select id, f1(sal) from t1 where id>= 1 group by counter;
---sorted_result
-select id, f1(sal) from t1 where id>= 1 group by id;
---sorted_result
-select id, f1(sal) from t1 where id>= 1 group by val;
---sorted_result
-select id, f1(sal) from t1 where id>= 1 group by counter order by counter;
---sorted_result
-select id, f1(sal) from t1 where id>= 1 group by counter order by val;
---sorted_result
-select id, f1(sal) from t1 where id>= 1 group by counter order by id;
---sorted_result
-select id, f1(sal) from t1 where id>= 1 group by val order by counter;
---sorted_result
-select id, f1(sal) from t1 where id>= 1 group by val order by id;
---sorted_result
-select id, f1(sal) from t1 where id>= 1 group by val order by val;
-drop table t1;
-
-# compound indexing
-create table t1 (sal int, id int, val int, counter int, primary key(id), INDEX name (val,counter));
-
-INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 10, 2);
-INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 2, 10, 4);
-INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 3, 18, 1);
-INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 4, 11, 3);
-INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 5, 11, 5);
---sorted_result
-select id, f1(sal) from t1;
---sorted_result
-select id, f1(sal) from t1 where id>= 1;
---sorted_result
-select id, f1(sal) from t1 where id>= 1 group by counter;
---sorted_result
-select id, f1(sal) from t1 where id>= 1 group by id;
---sorted_result
-select id, f1(sal) from t1 where id>= 1 group by val;
---sorted_result
-select id, f1(sal) from t1 where id>= 1 group by counter order by counter;
---sorted_result
-select id, f1(sal) from t1 where id>= 1 group by counter order by val;
---sorted_result
-select id, f1(sal) from t1 where id>= 1 group by counter order by id;
---sorted_result
-select id, f1(sal) from t1 where id>= 1 group by val order by counter;
---sorted_result
-select id, f1(sal) from t1 where id>= 1 group by val order by id;
---sorted_result
-select id, f1(sal) from t1 where id>= 1 group by val order by val;
-drop table t1;
-drop function f1;
-
-# prepared statement with aggregate functions
-
-delimiter |;
-
-create aggregate function f1(x INT) returns double
-begin
- declare z double default 0;
- declare continue handler for not found return z;
- loop
- fetch group next row;
- set z= z+x;
- end loop;
-end|
-
-create aggregate function f2() returns double
-begin
- declare z int default 0;
- declare continue handler for not found return z;
- loop
- fetch group next row;
- set z = z+1;
- end loop;
-end|
-
-delimiter ;|
-
-create table t1 (sal int, id int, val int, counter int);
-INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 10, 2);
-INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 1, 16, 5);
-INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 2, 18, 1);
-INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 3, 15, 3);
-INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 4, 11, 4);
-
-prepare test from "select f2() from t1 where id>= ?";
-set @param= 2;
-execute test using @param;
-execute test using @param;
-execute test using @param;
-execute test using @param;
-set @param= 1;
-execute test using @param;
-set @param= 3;
-execute test using @param;
-set @param= 4;
-execute test using @param;
-deallocate prepare test;
-
-prepare test from "select f1(sal) from t1 where id>= ?";
-set @param= 2;
-execute test using @param;
-execute test using @param;
-execute test using @param;
-execute test using @param;
-set @param= 1;
-execute test using @param;
-set @param= 3;
-execute test using @param;
-set @param= 4;
-execute test using @param;
-set @param= 5;
-execute test using @param;
-deallocate prepare test;
-
-drop function f2;
-
-prepare test from "select f1(sal) from t1 where id>= ?";
-set @param= 2;
-execute test using @param;
-drop function f1;
-
-create function f1(x int) returns int
- return -1;
-
-execute test using @param;
-
-drop function f1;
-
-delimiter |;
-
-create aggregate function f1(x INT) returns double
-begin
- declare z double default 0;
- declare continue handler for not found return z;
- loop
- fetch group next row;
- set z= z+x;
- end loop;
-end|
-
-delimiter ;|
-
-execute test using @param;
-
-deallocate prepare test;
-
-drop table t1;
-drop function f1;
-
-create table t1 (sal int, id int, val varchar(10), counter int);
-INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 'ab', 2);
-INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 1, 'cd', 5);
-INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 'ef', 1);
-INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 3, 'gh', 3);
-INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 4, 'ij', 4);
-
-create table t2 (sal int, id int, val int, counter int);
-INSERT INTO t2 (sal, id, val, counter) VALUES (1000, 2, 10, 2);
-INSERT INTO t2 (sal, id, val, counter) VALUES (2000, 1, 16, 5);
-INSERT INTO t2 (sal, id, val, counter) VALUES (6000, 2, 18, 1);
-INSERT INTO t2 (sal, id, val, counter) VALUES (5000, 3, 15, 3);
-INSERT INTO t2 (sal, id, val, counter) VALUES (3000, 4, 11, 4);
-delimiter |;
-
-create aggregate function f1(x double) returns double
-begin
- declare z double default 0;
- declare continue handler for not found return z;
- loop
- fetch group next row;
- set z= z+x;
- end loop;
-end|
-
-create aggregate function f2(x INT) returns CHAR(10)
- begin
- declare mini INT default 0;
- declare continue handler for not found return mini;
- loop
- fetch group next row;
- set mini= mini + x;
- end loop;
-end|
-
-create aggregate function f3(x INT) returns CHAR(10)
- begin
- declare mini INT default 0;
- declare continue handler for not found return mini;
- loop
- fetch group next row;
- set mini= mini + x;
- fetch group next row;
- set mini= mini - x;
- end loop;
-end|
-
-create aggregate function f4(x INT, y varchar(10)) returns varchar(1000)
-begin
- declare str varchar(1000) default '';
- declare continue handler for not found return str;
- loop
- fetch group next row;
- set str= concat(str,y);
- end loop;
-end|
-
-create aggregate function f5(x INT) returns varchar(1000)
-begin
- declare z int default 0;
- DECLARE cur1 CURSOR FOR SELECT sal FROM test.t2;
- declare continue handler for not found return 0;
- loop
- fetch group next row;
- set z = z+x;
- end loop;
-end|
-
-
-
-create function f6(x int) returns int
-return (select f1(sal) from t1)|
-
-delimiter ;|
-
-select f1(sal) from t1;
-
-# group by test
-
---sorted_result
-select f1(sal) from t1 where id>= 1 group by counter;
-
-# multiple fetch statements in the loop
---sorted_result
-select f3(sal) from t1;
-
-# incorrect column type
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-select f2(val) from t1;
-
-#subquery
---sorted_result
-select val, id, c from (select f1(sal) as c from t2) as t1, t2;
-
-#multiple calls to an aggregate function
---sorted_result
-select f1(sal),f1(val), f1(id), f1(sal) from t2;
-
-#string type, also more than one areguments
---sorted_result
-select f4(sal, val) from t1;
-
-#select f1((select sal from t2 where id= 1)) from t1;
---sorted_result
-select c from (select f1(sal) as c from t2) as t1;
-
-# this fails as more than one row is returned
-#select f1((select val from t2 where id > 1)) from t1;
-
-select f1((select val from t2 where 0 > 1)) from t1;
-select f1((select val from t2 where id= 1)) from t1;
-
-select f5(sal) from t1;
-
-SELECT f1(sal)*f1(sal) FROM t1;
-
---sorted_result
-SELECT (SELECT f1(sal) FROM t1) FROM t2;
---sorted_result
-select id, f1(sal) from t1;
---sorted_result
-select id, f1(sal) from t1 where id>= 1;
---sorted_result
-select f1(sal), f1(sal) from t1 where id>= 1 group by counter;
---sorted_result
-select f1(sal), f1(sal) from t1 where id>= 1 group by id ;
---sorted_result
-select f1(sal) from t1 where id>= 1 group by id ;
-select f1(sal) from t1 where id>= 1 order by counter;
-select f1(sal) from t1 where id>= 1 group by id order by counter;
-select counter, id, f1(sal) from t1 where id>= 1 group by id order by counter;
-select id, f1(sal) from t1 where id>= 1 group by id order by counter;
-drop table t1;
-drop table t2;
-drop function f1;
-drop function f2;
-drop function f3;
-drop function f4;
-drop function f5;
-drop function f6;
-
-
-delimiter |;
-
-# aggregate AND function
-
-create aggregate function f1(x INT) returns INT
-begin
- declare z double default 1000;
- declare continue handler for not found return z;
- loop
- fetch group next row;
- set z= (z&x);
- end loop;
-end|
-
-delimiter ;|
-
-create table t1 (sal int, id int, val int, counter int);
-INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 2, 10, 2);
-INSERT INTO t1 (sal, id, val, counter) VALUES (7000, 1, 16, 5);
-INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 2, 18, 1);
-INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 3, 15, 3);
-INSERT INTO t1 (sal, id, val, counter) VALUES (3000, 4, 11, 4);
-INSERT INTO t1 (sal, id, val, counter) VALUES (2000, 5, 10, 7);
-INSERT INTO t1 (sal, id, val, counter) VALUES (5000, 7, 13, 8);
-INSERT INTO t1 (sal, id, val, counter) VALUES (6000, 6, 19, 9);
-INSERT INTO t1 (sal, id, val, counter) VALUES (7000, 7, 12, 0);
-INSERT INTO t1 (sal, id, val, counter) VALUES (4000, 6, 14, 1);
-INSERT INTO t1 (sal, id, val, counter) VALUES (8000, 5, 19, 3);
-INSERT INTO t1 (sal, id, val, counter) VALUES (9000, 4, 11, 4);
-INSERT INTO t1 (sal, id, val, counter) VALUES (1000, 3, 11, 2);
-
-select f1(sal) from t1 where id>= 1;
-drop function f1;
-
-delimiter |;
-
-# aggregate AVG function
-
-create aggregate function f1(x INT) returns double
-begin
- declare z double default 0;
- declare count double default 0;
- declare continue handler for not found return z/count;
- loop
- fetch group next row;
- set z= z+x;
- set count= count+1;
- end loop;
-end|
-
-delimiter ;|
-select f1(sal) from t1 where id>= 1;
-drop function f1;
-delimiter |;
-
-# aggregate MAX function
-
-create aggregate function f1(x INT) returns INT
-begin
- declare maxi INT default -1;
- declare continue handler for not found return maxi;
- loop
- fetch group next row;
- if maxi < x then
- set maxi= x;
- end if;
- end loop;
-end|
-
-delimiter ;|
-select f1(sal) from t1 where id>= 1;
-drop function f1;
-delimiter |;
-
-# aggregate MIN function
-
-create aggregate function f1(x INT) returns double
-begin
- declare mini INT default 100000;
- declare continue handler for not found return mini;
- loop
- fetch group next row;
- if mini > x then
- set mini = x;
- end if;
- end loop;
-end|
-
-delimiter ;|
-select f1(sal) from t1 where id>= 1;
-drop function f1;
-delimiter |;
-
-# aggregate XOR function
-
-create aggregate function f1(x INT) returns double
-begin
- declare z double default 0;
- declare continue handler for not found return z;
- loop
- fetch group next row;
- set z= z^x;
- end loop;
-end|
-
-delimiter ;|
-select f1(sal) from t1 where id>= 1;
-drop function f1;
-delimiter |;
-
-# aggregate SUM function
-
-create aggregate function f1(x INT) returns INT
-begin
- declare z int default 0;
- declare continue handler for not found return z;
- loop
- fetch group next row;
- set z= z+x;
- end loop;
-end|
-
-delimiter ;|
-select f1(sal) from t1 where id>= 1;
-delimiter |;
-
-
-create aggregate function f2() returns INT
-begin
- declare z double default 0;
- declare continue handler for not found return z;
- loop
- fetch group next row;
- set z= z+1;
- end loop;
-end|
-
-delimiter ;|
-
-# no parameters
-select f2() from t1;
-
-create table t2 (sal int, id int);
-INSERT INTO t2 (sal, id) VALUES (NULL, 1);
-INSERT INTO t2 (sal, id) VALUES (2000, 1);
-INSERT INTO t2 (sal, id) VALUES (3000, 1);
-
-# null values
-select f1(sal) from t2;
-
-# no tables
-select f1(1);
-
-# aggregate function called from regular functions
-create function f3() returns int
-return (select f1(sal) from t1);
-select f3();
-
-create function f4() returns INT
-return 1;
-
-# regular functions called from aggregate functions
-delimiter |;
-create aggregate function f5() returns INT
-begin
- declare z double default 0;
- declare continue handler for not found return z;
- loop
- fetch group next row;
- set z= z+f3();
- end loop;
-end|
-
-delimiter ;|
-select f5() from t2;
-delimiter |;
-
-# aggregate functions called from aggregate functions
-create aggregate function f6(x INT) returns INT
-begin
- declare z int default 0;
- declare continue handler for not found return z;
- loop
- fetch group next row;
- if x then
- set z= z+(select f1(sal) from t1);
- end if;
- end loop;
-end|
-
-delimiter ;|
-select f6(sal) from t2;
-
-# GROUP BY AND ORDER BY
---sorted_result
-select id, f1(sal) from t1 where id>= 1 group by id;
---sorted_result
-select counter, f1(sal) from t1 where id>= 1 group by counter;
---sorted_result
-select val, f1(sal) from t1 where id>= 1 group by val;
---sorted_result
-select counter, f1(sal) from t1 where id>= 1 group by id order by counter;
---sorted_result
-select counter, id, f1(sal), f1(sal) from t1 where id>= 1 group by id order by counter;
---sorted_result
-select counter, id, f1(sal), sum(distinct sal) from t1 where id>= 1 group by id order by counter desc;
-
-
-##### insert aggregate function value into a table ######
-create table t3 (i int);
-INSERT INTO t3 (i) select f1(sal) from t1;
-select * from t3;
-
-delimiter |;
-
-create aggregate function f7(x INT) returns INT
-begin
- declare z int default 0;
- DECLARE done BOOLEAN DEFAULT FALSE;
- DECLARE a,b,c INT;
- DECLARE cur1 CURSOR FOR SELECT id FROM test.t2;
- declare continue handler for not found return z;
-
- outer_loop: LOOP
- FETCH GROUP NEXT ROW;
- set z= z+x;
- inner_block: begin
- DECLARE cur2 CURSOR FOR SELECT id FROM test.t2;
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
- OPEN cur2;
-
- read_loop: LOOP
- FETCH cur2 INTO a;
- IF done THEN
- CLOSE cur2;
- LEAVE read_loop;
- END IF;
- END LOOP read_loop;
-
- end inner_block;
- END LOOP outer_loop;
-
-end|
-
-delimiter ;|
-select f7(sal) from t1;
-
-drop table t1;
-drop table t2;
-drop table t3;
-drop function f1;
-drop function f2;
-drop function f3;
-drop function f4;
-drop function f5;
-drop function f6;
-drop function f7;
-
-delimiter |;
-create aggregate function f1(x date) returns date
-begin
- declare continue handler for not found return x;
- loop
- fetch group next row;
- end loop;
-end|
-delimiter ;|
-select f1('2001-01-01'),cast(f1('2001-01-01') as time);
-drop function f1;
diff --git a/mysql-test/t/date_formats-master.opt b/mysql-test/t/date_formats-master.opt
deleted file mode 100644
index ab243fe729c..00000000000
--- a/mysql-test/t/date_formats-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---date-format=%d.%m.%Y --time-format=%H.%i.%s
diff --git a/mysql-test/t/date_formats.test b/mysql-test/t/date_formats.test
deleted file mode 100644
index 3bf6fabbf6d..00000000000
--- a/mysql-test/t/date_formats.test
+++ /dev/null
@@ -1,377 +0,0 @@
-#
-# Test of date format functions
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-SELECT variable_name, variable_value
-FROM information_schema.global_variables
-WHERE variable_name IN ('date_format', 'datetime_format', 'time_format')
-ORDER BY variable_name;
-
-SELECT variable_name, variable_value
-FROM information_schema.session_variables
-WHERE variable_name IN ('date_format', 'datetime_format', 'time_format')
-ORDER BY variable_name;
-
-#
-# The following tests will work only when we at some point will enable
-# dynamic changing of formats
-#
-
-# SET time_format='%H%i%s';
-# SET time_format='%H:%i:%s.%f';
-# SET time_format='%h-%i-%s.%f%p';
-# SET time_format='%h:%i:%s.%f %p';
-# SET time_format='%h:%i:%s%p';
-#
-# SET date_format='%Y%m%d';
-# SET date_format='%Y.%m.%d';
-# SET date_format='%d.%m.%Y';
-# SET date_format='%m-%d-%Y';
-#
-# --error ER_WRONG_VALUE_FOR_VAR
-# SET datetime_format= NULL;
-# set datetime_format= '%Y%m%d%H%i%s';
-# set datetime_format= '%Y-%m-%d %H:%i:%s';
-# set datetime_format= '%m-%d-%y %H:%i:%s.%f';
-# set datetime_format= '%d-%m-%Y %h:%i:%s%p';
-# set datetime_format= '%H:%i:%s %Y-%m-%d';
-# set datetime_format= '%H:%i:%s.%f %m-%d-%Y';
-# set datetime_format= '%h:%i:%s %p %Y-%m-%d';
-# set datetime_format= '%h:%i:%s.%f %p %Y-%m-%d';
-#
-# SELECT variable_name, variable_value
-# FROM information_schema.session_variables
-# WHERE variable_name IN ('date_format', 'datetime_format', 'time_format')
-# ORDER BY variable_name;
-#
-# --error 1231
-# SET time_format='%h:%i:%s';
-# --error 1231
-# SET time_format='%H %i:%s';
-# --error 1231
-# SET time_format='%H::%i:%s';
-# --error 1231
-# SET time_format='%H:%i:%s%f';
-# --error 1231
-# SET time_format='%H:%i.%f:%s';
-# --error 1231
-# SET time_format='%H:%i:%s%p';
-# --error 1231
-# SET time_format='%h:%i:%s.%f %p %Y-%m-%d';
-# --error 1231
-# SET time_format='%H%i%s.%f';
-# --error 1231
-# SET time_format='%H:%i-%s.%f';
-# --error 1231
-# SET date_format='%d.%m.%d';
-# --error 1231
-# SET datetime_format='%h.%m.%y %d.%i.%s';
-# --error 1231
-# set datetime_format= '%H:%i:%s.%f %p %Y-%m-%d';
-#
-# #
-# # Test GLOBAL values
-#
-# set GLOBAL datetime_format= '%H:%i:%s %Y-%m-%d';
-# SET SESSION datetime_format=default;
-# select @@global.datetime_format, @@session.datetime_format;
-# SET GLOBAL datetime_format=default;
-# SET SESSION datetime_format=default;
-# select @@global.datetime_format, @@session.datetime_format;
-#
-# SET GLOBAL date_format=default;
-# SET GLOBAL time_format=default;
-# SET GLOBAL datetime_format=default;
-# SET time_format=default;
-# SET date_format=default;
-# SET datetime_format=default;
-
-# SET date_format='%d.%m.%Y';
-# select CAST('01.01.2001' as DATE) as a;
-# SET datetime_format='%d.%m.%Y %H.%i.%s';
-# select CAST('01.01.2001 05.12.06' as DATETIME) as a;
-# SET time_format='%H.%i.%s';
-# select CAST('05.12.06' as TIME) as a;
-#
-# SET datetime_format='%d.%m.%Y %h:%i:%s %p';
-# select CAST('01.01.2001 05:12:06AM' as DATETIME) as a;
-# select CAST('01.01.2001 05:12:06 PM' as DATETIME) as a;
-#
-# SET time_format='%h:%i:%s %p';
-# select CAST('05:12:06 AM' as TIME) as a;
-# select CAST('05:12:06.1234PM' as TIME) as a;
-#
-# SET time_format='%h.%i.%s %p';
-# SET date_format='%d.%m.%y';
-# SET datetime_format='%d.%m.%y %h.%i.%s %p';
-# select CAST('12-12-06' as DATE) as a;
-#
-# select adddate('01.01.97 11.59.59.000001 PM', 10);
-# select datediff('31.12.97 11.59:59.000001 PM','01.01.98');
-# select weekofyear('31.11.97 11:59:59.000001 PM');
-# select makedate(1997,1);
-# select addtime('31.12.97 11.59.59.999999 PM', '1 1.1.1.000002');
-# select maketime(23,11,12);
-# select timediff('01.01.97 11:59:59.000001 PM','31.12.95 11:59:59.000002 PM');
-#
-# SET time_format='%i:%s:%H';
-# select cast(str_to_date('15-01-2001 12:59:59', '%d-%m-%Y %H:%i:%S') as TIME);
-
-#
-# Test of str_to_date
-#
-
-select str_to_date(concat('15-01-2001',' 2:59:58.999'),
- concat('%d-%m-%Y',' ','%H:%i:%s.%f'));
-select STR_TO_DATE('2004.12.12 22.30.61','%Y.%m.%d %T');
-
-create table t1 (date char(30), format char(30) not null);
-insert into t1 values
-('2003-01-02 10:11:12', '%Y-%m-%d %H:%i:%S'),
-('03-01-02 8:11:2.123456', '%y-%m-%d %H:%i:%S.%#'),
-('0003-01-02 8:11:2.123456', '%Y-%m-%d %H:%i:%S.%#'),
-('03-01-02 8:11:2.123456', '%Y-%m-%d %H:%i:%S.%#'),
-('2003-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p'),
-('2003-01-02 01:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f%p'),
-('2003-01-02 02:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f %p'),
-('2003-01-02 12:11:12.12345 am', '%Y-%m-%d %h:%i:%S.%f%p'),
-('2003-01-02 11:11:12Pm', '%Y-%m-%d %h:%i:%S%p'),
-('10:20:10', '%H:%i:%s'),
-('10:20:10', '%h:%i:%s.%f'),
-('10:20:10', '%T'),
-('10:20:10AM', '%h:%i:%s%p'),
-('10:20:10AM', '%r'),
-('10:20:10.44AM', '%h:%i:%s.%f%p'),
-('15-01-2001 12:59:58', '%d-%m-%Y %H:%i:%S'),
-('15 September 2001', '%d %M %Y'),
-('15 SEPTEMB 2001', '%d %M %Y'),
-('15 MAY 2001', '%d %b %Y'),
-('15th May 2001', '%D %b %Y'),
-('Sunday 15 MAY 2001', '%W %d %b %Y'),
-('Sund 15 MAY 2001', '%W %d %b %Y'),
-('Tuesday 00 2002', '%W %U %Y'),
-('Thursday 53 1998', '%W %u %Y'),
-('Sunday 01 2001', '%W %v %x'),
-('Tuesday 52 2001', '%W %V %X'),
-('060 2004', '%j %Y'),
-('4 53 1998', '%w %u %Y'),
-('15-01-2001', '%d-%m-%Y %H:%i:%S'),
-('15-01-20', '%d-%m-%y'),
-('15-2001-1', '%d-%Y-%c');
-
-select date,format,str_to_date(date, format) as str_to_date from t1;
-# Use as a string
-select date,format,concat('',str_to_date(date, format)) as con from t1;
-# Use as datetime
-select date,format,cast(str_to_date(date, format) as datetime) as datetime from t1;
-select date,format,DATE(str_to_date(date, format)) as date2 from t1;
-select date,format,TIME(str_to_date(date, format)) as time from t1;
-select date,format,concat(TIME(str_to_date(date, format))) as time2 from t1;
-# Test small bug in %f handling
-select concat('',str_to_date('8:11:2.123456 03-01-02','%H:%i:%S.%f %y-%m-%d'));
-
-# Test wrong dates or converion specifiers
-
-truncate table t1;
-insert into t1 values
-('2003-01-02 10:11:12 PM', '%Y-%m-%d %H:%i:%S %p'),
-('2003-01-02 10:11:12.123456', '%Y-%m-%d %h:%i:%S %p'),
-('2003-01-02 10:11:12AM', '%Y-%m-%d %h:%i:%S.%f %p'),
-('2003-01-02 10:11:12AN', '%Y-%m-%d %h:%i:%S%p'),
-('2003-01-02 10:11:12 PM', '%y-%m-%d %H:%i:%S %p'),
-('10:20:10AM', '%H:%i:%s%p'),
-('15 Septembei 2001', '%d %M %Y'),
-('15 Ju 2001', '%d %M %Y'),
-('Sund 15 MA', '%W %d %b %Y'),
-('Thursdai 12 1998', '%W %u %Y'),
-('Sunday 01 2001', '%W %v %X'),
-('Tuesday 52 2001', '%W %V %x'),
-('Tuesday 52 2001', '%W %V %Y'),
-('Tuesday 52 2001', '%W %u %x'),
-('7 53 1998', '%w %u %Y'),
-(NULL, get_format(DATE,'USA'));
-select date,format,str_to_date(date, format) as str_to_date from t1;
-select date,format,concat(str_to_date(date, format),'') as con from t1;
-
-# Test 'maybe' date formats and 'strange but correct' results
-
-truncate table t1;
-insert into t1 values
-('10:20:10AM', '%h:%i:%s'),
-('2003-01-02 10:11:12', '%Y-%m-%d %h:%i:%S'),
-('03-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p');
-
-select date,format,str_to_date(date, format) as str_to_date from t1;
-select date,format,concat(str_to_date(date, format),'') as con from t1;
-
-drop table t1;
-
-#
-# Test of get_format
-#
-
-select get_format(DATE, 'USA') as a;
-select get_format(TIME, 'internal') as a;
-select get_format(DATETIME, 'eur') as a;
-select get_format(TIMESTAMP, 'eur') as a;
-select get_format(DATE, 'TEST') as a;
-select str_to_date('15-01-2001 12:59:59', GET_FORMAT(DATE,'USA'));
-
-explain extended select makedate(1997,1), addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM"),cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME), maketime(23,11,12),microsecond("1997-12-31 23:59:59.000001");
-
-#
-# Test of date_format()
-#
-
-create table t1 (d date);
-insert into t1 values ('2004-07-14'),('2005-07-14');
-select date_format(d,"%d") from t1 order by 1;
-drop table t1;
-
-# PS doesn't support fractional seconds
---disable_ps_protocol
-select str_to_date("2003-....01ABCD-02 10:11:12.0012", "%Y-%.%m%@-%d %H:%i:%S.%f") as a;
-
-
-create table t1 select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f") as f1,
- str_to_date("10:11:12.0012", "%H:%i:%S.%f") as f2,
- str_to_date("2003-01-02", "%Y-%m-%d") as f3,
- str_to_date("02", "%d") as f4, str_to_date("02 10", "%d %H") as f5;
-describe t1;
-select * from t1;
-drop table t1;
-
-create table t1 select "02 10" as a, "%d %H" as b;
-select str_to_date(a,b) from t1;
-create table t2 select str_to_date(a,b) from t1;
-describe t2;
-select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f") as f1,
- str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S") as f2,
- str_to_date("2003-01-02", "%Y-%m-%d") as f3,
- str_to_date("02 10:11:12", "%d %H:%i:%S.%f") as f4,
- str_to_date("02 10:11:12", "%d %H:%i:%S") as f5,
- str_to_date("02 10", "%d %f") as f6;
-drop table t1, t2;
-select str_to_date("2003-01-02 10:11:12.0012ABCD", "%Y-%m-%d %H:%i:%S.%f") as f1,
- addtime("-01:01:01.01 GGG", "-23:59:59.1") as f2,
- microsecond("1997-12-31 23:59:59.01XXXX") as f3;
-
-select str_to_date("2003-04-05 g", "%Y-%m-%d") as f1,
- str_to_date("2003-04-05 10:11:12.101010234567", "%Y-%m-%d %H:%i:%S.%f") as f2;
---enable_ps_protocol
-
-#
-# Test of locale dependent date format (WL#2928 Date Translation NRE)
-#
-set names latin1;
-select date_format('2004-01-01','%W (%a), %e %M (%b) %Y');
-set lc_time_names=ru_RU;
-set names koi8r;
-select date_format('2004-01-01','%W (%a), %e %M (%b) %Y');
-set lc_time_names=de_DE;
-set names latin1;
-select date_format('2004-01-01','%W (%a), %e %M (%b) %Y');
-set names latin1;
-set lc_time_names=en_US;
-
-#
-# Bug #14016
-#
-create table t1 (f1 datetime);
-insert into t1 (f1) values ("2005-01-01");
-insert into t1 (f1) values ("2005-02-01");
-select date_format(f1, "%m") as d1, date_format(f1, "%M") as d2 from t1 order by date_format(f1, "%M");
-drop table t1;
-
-#
-# Bug #15828
-#
-select str_to_date( 1, NULL );
-select str_to_date( NULL, 1 );
-select str_to_date( 1, IF(1=1,NULL,NULL) );
-
-#
-# Bug#11326
-# TIME_FORMAT using "%r" returns wrong hour using 24:00:00 in TIME column
-#
-# This tests that 24:00:00 does not return PM, when it should be AM.
-# Some other values are being tested same time.
-#
-
-SELECT TIME_FORMAT("24:00:00", '%r');
-SELECT TIME_FORMAT("00:00:00", '%r');
-SELECT TIME_FORMAT("12:00:00", '%r');
-SELECT TIME_FORMAT("15:00:00", '%r');
-SELECT TIME_FORMAT("01:00:00", '%r');
-SELECT TIME_FORMAT("25:00:00", '%r');
-
-#
-# Bug#11324
-# TIME_FORMAT using "%l:%i" returns 36:00 with 24:00:00 in TIME column
-#
-# This tests that 24:00:00 does not change to "36:00 AM". Testing
-# some other values same time.
-#
-
-SELECT TIME_FORMAT("00:00:00", '%l %p');
-SELECT TIME_FORMAT("01:00:00", '%l %p');
-SELECT TIME_FORMAT("12:00:00", '%l %p');
-SELECT TIME_FORMAT("23:00:00", '%l %p');
-SELECT TIME_FORMAT("24:00:00", '%l %p');
-SELECT TIME_FORMAT("25:00:00", '%l %p');
-
-#
-# Bug#20729: Bad date_format() call makes mysql server crash
-#
-SELECT DATE_FORMAT('%Y-%m-%d %H:%i:%s', 1151414896);
-
-#
-# Bug #22029: str_to_date returning NULL
-#
-
-select str_to_date('04 /30/2004', '%m /%d/%Y');
-select str_to_date('04/30 /2004', '%m /%d /%Y');
-select str_to_date('04/30/2004 ', '%m/%d/%Y ');
-
---echo "End of 4.1 tests"
-
-#
-# Bug #41470: DATE_FORMAT() crashes the complete server with a valid date
-#
-
-# show that these two do not crash the server:
-SELECT DATE_FORMAT("0000-01-01",'%W %d %M %Y') as valid_date;
-SELECT DATE_FORMAT("0000-02-28",'%W %d %M %Y') as valid_date;
-# show that date within the Gregorian range render correct results: (THU)
-SELECT DATE_FORMAT("2009-01-01",'%W %d %M %Y') as valid_date;
-
---echo "End of 5.0 tests"
-
-
---echo #
---echo # Start of 5.1 tests
---echo #
-
---echo #
---echo # Bug#58005 utf8 + get_format causes failed assertion: !str || str != Ptr'
---echo #
-SET NAMES utf8;
-SELECT LEAST('%', GET_FORMAT(datetime, 'eur'), CAST(GET_FORMAT(datetime, 'eur') AS CHAR(65535)));
-SET NAMES latin1;
-
---echo #
---echo # End of 5.1 tests
---echo #
-
-#
-# TIME_FORMAT and non-time format specifiers
-#
-select time_format('2001-01-01 02:02:02', '%d.%m.%Y');
-select time_format('2001-01-01 02:02:02', '%d %T');
-select time_format('01 02:02:02', '%d %T');
-select time_format('01 02:02:02', '%T');
-select time_format('2001-01-01 02:02:02', '%T');
diff --git a/mysql-test/t/datetime_456.test b/mysql-test/t/datetime_456.test
deleted file mode 100644
index 0c187959d52..00000000000
--- a/mysql-test/t/datetime_456.test
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# MDEV-456 An out-of-range datetime value (with a 5-digit year) can be created and cause troubles
-#
-create table t1 (d datetime);
-insert t1 values (addtime('9999-12-31 23:59:59', '00:00:01')),
- (from_days(3652499));
-select * from t1;
-drop table t1;
diff --git a/mysql-test/t/ddl_i18n_koi8r.test b/mysql-test/t/ddl_i18n_koi8r.test
deleted file mode 100644
index 5e2417fab4d..00000000000
--- a/mysql-test/t/ddl_i18n_koi8r.test
+++ /dev/null
@@ -1,1121 +0,0 @@
-# Objects to test:
-# - stored procedures/functions;
-# - triggers;
-# - events;
-# - views;
-#
-# For stored routines:
-# - create a database with collation utf8_unicode_ci;
-# - create an object, which
-# - contains SP-var with explicit CHARSET-clause;
-# - contains SP-var without CHARSET-clause;
-# - contains text constant;
-# - has localized routine/parameter names;
-# - check:
-# - execute;
-# - SHOW CREATE output;
-# - SHOW output;
-# - SELECT FROM INFORMATION_SCHEMA output;
-# - alter database character set;
-# - change connection collation;
-# - check again;
-# - dump definition using mysqldump;
-# - drop object;
-# - restore object;
-#
-
-set sql_mode="";
-
-###########################################################################
-#
-# NOTE: this file contains text in UTF8 and KOI8-R encodings.
-#
-###########################################################################
-
-# Test requires server to accept client connections (for mysqldump portions)
---source include/not_embedded.inc
---source include/have_utf8.inc
---source include/have_cp866.inc
---source include/have_cp1251.inc
---source include/have_koi8r.inc
-let collation=utf8_unicode_ci;
---source include/have_collation.inc
-
-###########################################################################
-
-set names koi8r;
-delimiter |;
-
-###########################################################################
-#
-# * Views.
-#
-###########################################################################
-
---echo
---echo -------------------------------------------------------------------
---echo Views
---echo -------------------------------------------------------------------
---echo
-
-#
-# Preparation:
-#
-
-# - Create database with fixed, pre-defined character set.
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest1|
---enable_warnings
-
-CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
-
-use mysqltest1|
-
-CREATE TABLE t1( INT)|
-INSERT INTO t1 VALUES(1)|
-
-# - Create views;
-
---echo
-
-CREATE VIEW v1 AS
- SELECT '' AS c1, AS c2
- FROM t1|
-
---echo
-
-CREATE VIEW v2 AS SELECT _utf8'тест' as c1|
-
---echo
-
-CREATE VIEW v3 AS SELECT _utf8'тест'|
-
---echo
-
-#
-# First-round checks.
-#
-
---source include/ddl_i18n.check_views.inc
-
-#
-# Change running environment (alter database character set, change session
-# variables).
-#
-
---echo
---echo
-
-ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
-
-#
-# Second-round checks:
-#
-
-# - Change connection to flush cache;
-
---connect (con2,localhost,root,,)
-
-# - Switch environment variables and trigger loading views;
-
-SET @@character_set_client= cp1251|
-SET @@character_set_results= cp1251|
-SET @@collation_connection= cp1251_general_ci|
-
---disable_result_log
-SELECT * FROM mysqltest1.v1|
-SELECT * FROM mysqltest1.v2|
-SELECT * FROM mysqltest1.v3|
---enable_result_log
-
-use mysqltest1|
-
-# - Restore environment;
-
-set names koi8r|
-
-# - Check!
-
---source include/ddl_i18n.check_views.inc
-
-#
-# Check mysqldump.
-#
-
-# - Dump mysqltest1;
-
---let $views_dump1 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.views.mysqltest1.sql
-
---echo
---echo ---> Dumping mysqltest1 to ddl_i18n_koi8r.views.mysqltest1.sql
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --databases mysqltest1 > $views_dump1
-
-# - Clean mysqltest1;
-
---echo
---echo
-
-DROP DATABASE mysqltest1|
-
-# - Restore mysqltest1;
-
---echo
---echo
-
---echo ---> Restoring mysqltest1...
---exec $MYSQL test < $views_dump1
-
---remove_file $views_dump1
-
-#
-# Third-round checks.
-#
-
-# - Change connection to flush cache;
-
---connect (con3,localhost,root,,)
-
-# - Switch environment variables and trigger loading views;
-
-SET @@character_set_client= cp1251|
-SET @@character_set_results= cp1251|
-SET @@collation_connection= cp1251_general_ci|
-
---disable_result_log
-SELECT * FROM mysqltest1.v1|
-SELECT * FROM mysqltest1.v2|
-SELECT * FROM mysqltest1.v3|
---enable_result_log
-
-use mysqltest1|
-
-# - Restore environment;
-
-set names koi8r|
-
-# - Check!
-
---source include/ddl_i18n.check_views.inc
-
-#
-# Cleanup.
-#
-
---connection default
---disconnect con2
---disconnect con3
-
-use test|
-
-DROP DATABASE mysqltest1|
-
-###########################################################################
-#
-# * Stored procedures/functions.
-#
-###########################################################################
-
---echo
---echo -------------------------------------------------------------------
---echo Stored procedures/functions
---echo -------------------------------------------------------------------
---echo
-
-#
-# Preparation:
-#
-
-# - Create database with fixed, pre-defined character set.
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest1|
-DROP DATABASE IF EXISTS mysqltest2|
---enable_warnings
-
-CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
-CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
-
-use mysqltest1|
-
-# - Create two stored routines -- with and without explicit
-# CHARSET-clause for SP-variable;
-#
-
---echo
-
-# - Procedure p1
-
-CREATE PROCEDURE p1(
- INOUT 1 CHAR(10),
- OUT 2 CHAR(10))
-BEGIN
- DECLARE 1 CHAR(10);
-
- SELECT
- COLLATION(1) AS c1,
- COLLATION(1) AS c2,
- COLLATION(2) AS c3;
-
- SELECT
- COLLATION('') AS c4,
- COLLATION(_koi8r '') AS c5,
- COLLATION(_utf8 'текст') AS c6,
- @@collation_connection AS c7,
- @@character_set_client AS c8;
-
- SET 1 = 'a';
- SET 2 = 'b';
-END|
-
---echo
-
-# - Procedure p2
-
-CREATE PROCEDURE p2(
- INOUT 1 CHAR(10) CHARACTER SET utf8,
- OUT 2 CHAR(10) CHARACTER SET utf8)
-BEGIN
- DECLARE 1 CHAR(10) CHARACTER SET utf8;
-
- SELECT
- COLLATION(1) AS c1,
- COLLATION(1) AS c2,
- COLLATION(2) AS c3;
-
- SELECT
- COLLATION('') AS c4,
- COLLATION(_koi8r '') AS c5,
- COLLATION(_utf8 'текст') AS c6,
- @@collation_connection AS c7,
- @@character_set_client AS c8;
-
- SET 1 = 'a';
- SET 2 = 'b';
-END|
-
---echo
-
-# - Procedure p3
-
-CREATE PROCEDURE mysqltest2.p3(
- INOUT 1 CHAR(10),
- OUT 2 CHAR(10))
-BEGIN
- DECLARE 1 CHAR(10);
-
- SELECT
- COLLATION(1) AS c1,
- COLLATION(1) AS c2,
- COLLATION(2) AS c3;
-
- SELECT
- COLLATION('') AS c4,
- COLLATION(_koi8r '') AS c5,
- COLLATION(_utf8 'текст') AS c6,
- @@collation_connection AS c7,
- @@character_set_client AS c8;
-
- SET 1 = 'a';
- SET 2 = 'b';
-END|
-
---echo
-
-# - Procedure p4
-
-CREATE PROCEDURE mysqltest2.p4(
- INOUT 1 CHAR(10) CHARACTER SET utf8,
- OUT 2 CHAR(10) CHARACTER SET utf8)
-BEGIN
- DECLARE 1 CHAR(10) CHARACTER SET utf8;
-
- SELECT
- COLLATION(1) AS c1,
- COLLATION(1) AS c2,
- COLLATION(2) AS c3;
-
- SELECT
- COLLATION('') AS c4,
- COLLATION(_koi8r '') AS c5,
- COLLATION(_utf8 'текст') AS c6,
- @@collation_connection AS c7,
- @@character_set_client AS c8;
-
- SET 1 = 'a';
- SET 2 = 'b';
-END|
-
-#
-# First-round checks.
-#
-
---source include/ddl_i18n.check_sp.inc
-
-#
-# Change running environment (alter database character set, change session
-# variables).
-#
-
---echo
---echo
-
-ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
-ALTER DATABASE mysqltest2 COLLATE cp866_general_ci|
-
-#
-# Second-round checks:
-#
-
-# - Change connection to flush SP-cache;
-
---connect (con2,localhost,root,,mysqltest1)
-
-# - Switch environment variables and trigger loading stored procedures;
-
-SET @@character_set_client= cp1251|
-SET @@character_set_results= cp1251|
-SET @@collation_connection= cp1251_general_ci|
-
-CALL p1(@a, @b)|
-CALL p2(@a, @b)|
-CALL mysqltest2.p3(@a, @b)|
-CALL mysqltest2.p4(@a, @b)|
-
-# - Restore environment;
-
-set names koi8r|
-
-# - Check!
-
---source include/ddl_i18n.check_sp.inc
-
-#
-# Check mysqldump.
-#
-
-# - Dump mysqltest1, mysqltest2;
-
---let $sp_dump1 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.sp.mysqltest1.sql
---let $sp_dump2 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.sp.mysqltest2.sql
-
---echo
---echo ---> Dump of mysqltest1
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --compact --routines --databases mysqltest1
-
---echo
---echo ---> Dumping mysqltest1 to ddl_i18n_koi8r.sp.mysqltest1.sql
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --compact --routines --databases mysqltest1 > $sp_dump1
-
---echo
---echo ---> Dump of mysqltest2
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --compact --routines --databases mysqltest2
-
---echo
---echo ---> Dumping mysqltest2 to ddl_i18n_koi8r.sp.mysqltest2.sql
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --compact --routines --databases mysqltest2 > $sp_dump2
-
-# - Clean mysqltest1, mysqltest2;
-
---echo
---echo
-
-DROP DATABASE mysqltest1|
-DROP DATABASE mysqltest2|
-
-# - Restore mysqltest1;
-
---echo
---echo
-
---echo ---> Restoring mysqltest1...
---exec $MYSQL test < $sp_dump1
-
---echo ---> Restoring mysqltest2...
---exec $MYSQL test < $sp_dump2
-
---remove_file $sp_dump1
---remove_file $sp_dump2
-
-#
-# Third-round checks.
-#
-
-# - Change connection to flush SP-cache;
-
---connect (con3,localhost,root,,mysqltest1)
-
-# - Switch environment variables and trigger loading stored procedures;
-
-SET @@character_set_client= cp1251|
-SET @@character_set_results= cp1251|
-SET @@collation_connection= cp1251_general_ci|
-
-CALL p1(@a, @b)|
-CALL p2(@a, @b)|
-CALL mysqltest2.p3(@a, @b)|
-CALL mysqltest2.p4(@a, @b)|
-
-# - Restore environment;
-
-set names koi8r|
-
-# - Check!
-
---source include/ddl_i18n.check_sp.inc
-
-#
-# Cleanup.
-#
-
---connection default
---disconnect con2
---disconnect con3
-
-use test|
-
-DROP DATABASE mysqltest1|
-DROP DATABASE mysqltest2|
-
-###########################################################################
-#
-# * Triggers.
-#
-###########################################################################
-
---echo
---echo -------------------------------------------------------------------
---echo Triggers
---echo -------------------------------------------------------------------
---echo
-
-#
-# Preparation:
-#
-
-# - Create database with fixed, pre-defined character set;
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest1|
-DROP DATABASE IF EXISTS mysqltest2|
---enable_warnings
-
-CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
-CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
-
-use mysqltest1|
-
-# - Create tables for triggers;
-
-CREATE TABLE t1(c INT)|
-CREATE TABLE mysqltest2.t1(c INT)|
-
-# - Create log tables;
-
-CREATE TABLE log(msg VARCHAR(255))|
-CREATE TABLE mysqltest2.log(msg VARCHAR(255))|
-
-
-# - Create triggers -- with and without explicit CHARSET-clause for
-# SP-variable;
-#
-
---echo
-
-# - Trigger trg1
-
-CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW
-BEGIN
- DECLARE 1 CHAR(10);
-
- INSERT INTO log VALUES(COLLATION(1));
- INSERT INTO log VALUES(COLLATION(''));
- INSERT INTO log VALUES(COLLATION(_koi8r ''));
- INSERT INTO log VALUES(COLLATION(_utf8 'текст'));
- INSERT INTO log VALUES(@@collation_connection);
- INSERT INTO log VALUES(@@character_set_client);
-
- SET @a1 = '';
- SET @a1 = _koi8r '';
- SET @a2 = _utf8 'текст';
-END|
-
---echo
-
-# - Trigger trg2
-
-CREATE TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW
-BEGIN
- DECLARE 1 CHAR(10) CHARACTER SET utf8;
-
- INSERT INTO log VALUES(COLLATION(1));
- INSERT INTO log VALUES(COLLATION(''));
- INSERT INTO log VALUES(COLLATION(_koi8r ''));
- INSERT INTO log VALUES(COLLATION(_utf8 'текст'));
- INSERT INTO log VALUES(@@collation_connection);
- INSERT INTO log VALUES(@@character_set_client);
-
- SET @b1 = '';
- SET @b1 = _koi8r '';
- SET @b2 = _utf8 'текст';
-END|
-
---echo
-
-# - Trigger trg3
-
-CREATE TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW
-BEGIN
- DECLARE 1 CHAR(10);
-
- INSERT INTO log VALUES(COLLATION(1));
- INSERT INTO log VALUES(COLLATION(''));
- INSERT INTO log VALUES(COLLATION(_koi8r ''));
- INSERT INTO log VALUES(COLLATION(_utf8 'текст'));
- INSERT INTO log VALUES(@@collation_connection);
- INSERT INTO log VALUES(@@character_set_client);
-
- SET @a1 = '';
- SET @a1 = _koi8r '';
- SET @a2 = _utf8 'текст';
-END|
-
---echo
-
-# - Trigger trg4
-
-CREATE TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW
-BEGIN
- DECLARE 1 CHAR(10) CHARACTER SET utf8;
-
- INSERT INTO log VALUES(COLLATION(1));
- INSERT INTO log VALUES(COLLATION(''));
- INSERT INTO log VALUES(COLLATION(_koi8r ''));
- INSERT INTO log VALUES(COLLATION(_utf8 'текст'));
- INSERT INTO log VALUES(@@collation_connection);
- INSERT INTO log VALUES(@@character_set_client);
-
- SET @b1 = '';
- SET @b1 = _koi8r '';
- SET @b2 = _utf8 'текст';
-END|
-
---echo
-
-#
-# First-round checks.
-#
-
---source include/ddl_i18n.check_triggers.inc
-
-#
-# Change running environment (alter database character set, change session
-# variables).
-#
-
---echo
---echo
-
-ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
-ALTER DATABASE mysqltest2 COLLATE cp866_general_ci|
-
-#
-# Second-round checks:
-#
-
-# - Flush table cache;
-
-ALTER TABLE t1 ADD COLUMN fake INT|
-ALTER TABLE t1 DROP COLUMN fake|
-
-ALTER TABLE mysqltest2.t1 ADD COLUMN fake INT|
-ALTER TABLE mysqltest2.t1 DROP COLUMN fake|
-
-# - Switch environment variables and initiate loading of triggers
-# (connect using NULL database);
-
---connect (con2,localhost,root,,)
-
-SET @@character_set_client= cp1251|
-SET @@character_set_results= cp1251|
-SET @@collation_connection= cp1251_general_ci|
-
-INSERT INTO mysqltest1.t1 VALUES(0)|
-INSERT INTO mysqltest2.t1 VALUES(0)|
-
-DELETE FROM mysqltest1.log|
-DELETE FROM mysqltest2.log|
-
-# - Restore environment;
-
-set names koi8r|
-
-use mysqltest1|
-
-# - Check!
-
---source include/ddl_i18n.check_triggers.inc
-
-#
-# Check mysqldump.
-#
-
-# - Dump mysqltest1, mysqltest2;
-
---let $triggers_dump1 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.triggers.mysqltest1.sql
---let $triggers_dump2 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.triggers.mysqltest2.sql
-
---echo
---echo ---> Dump of mysqltest1
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --compact --triggers --databases mysqltest1
-
---echo
---echo ---> Dumping mysqltest1 to ddl_i18n_koi8r.triggers.mysqltest1.sql
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --compact --triggers --databases mysqltest1 > $triggers_dump1
-
---echo
---echo ---> Dump of mysqltest2
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --compact --triggers --databases mysqltest2
-
---echo
---echo ---> Dumping mysqltest2 to ddl_i18n_koi8r.triggers.mysqltest2.sql
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --compact --triggers --databases mysqltest2 > $triggers_dump2
-
-# - Clean mysqltest1, mysqltest2;
-
---echo
---echo
-
-DROP DATABASE mysqltest1|
-DROP DATABASE mysqltest2|
-
-# - Restore mysqltest1;
-
---echo
---echo
-
---echo ---> Restoring mysqltest1...
---exec $MYSQL test < $triggers_dump1
-
---echo ---> Restoring mysqltest2...
---exec $MYSQL test < $triggers_dump2
-
---remove_file $triggers_dump1
---remove_file $triggers_dump2
-
-#
-# Third-round checks.
-#
-
-# - Flush table cache;
-
-ALTER TABLE mysqltest1.t1 ADD COLUMN fake INT|
-ALTER TABLE mysqltest1.t1 DROP COLUMN fake|
-
-ALTER TABLE mysqltest2.t1 ADD COLUMN fake INT|
-ALTER TABLE mysqltest2.t1 DROP COLUMN fake|
-
-# - Switch environment variables and initiate loading of triggers
-# (connect using NULL database);
-
---connect (con3,localhost,root,,)
-
-SET @@character_set_client= cp1251|
-SET @@character_set_results= cp1251|
-SET @@collation_connection= cp1251_general_ci|
-
-INSERT INTO mysqltest1.t1 VALUES(0)|
-INSERT INTO mysqltest2.t1 VALUES(0)|
-
-DELETE FROM mysqltest1.log|
-DELETE FROM mysqltest2.log|
-
-# - Restore environment;
-
-set names koi8r|
-
-use mysqltest1|
-
-# - Check!
-
---source include/ddl_i18n.check_triggers.inc
-
-#
-# Cleanup.
-#
-
---connection default
---disconnect con2
---disconnect con3
-
-use test|
-
-DROP DATABASE mysqltest1|
-DROP DATABASE mysqltest2|
-
-###########################################################################
-#
-# * Events
-#
-# We don't have EXECUTE EVENT so far, so this test is limited. It checks that
-# event with non-latin1 symbols can be created, dumped, restored and SHOW
-# statements work properly.
-#
-###########################################################################
-
---echo
---echo -------------------------------------------------------------------
---echo Events
---echo -------------------------------------------------------------------
---echo
-
-#
-# Preparation:
-#
-
-# - Create database with fixed, pre-defined character set.
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest1|
-DROP DATABASE IF EXISTS mysqltest2|
---enable_warnings
-
-CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
-CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
-
-use mysqltest1|
-
-# - Create two stored routines -- with and without explicit
-# CHARSET-clause for SP-variable;
-#
-
---echo
-
-# - Event ev1
-
-CREATE EVENT ev1 ON SCHEDULE AT '2030-01-01 00:00:00' DO
-BEGIN
- DECLARE 1 CHAR(10);
-
- SELECT
- COLLATION(1) AS c1,
- COLLATION('') AS c2,
- COLLATION(_koi8r '') AS c3,
- COLLATION(_utf8 'текст') AS c4,
- @@collation_connection AS c5,
- @@character_set_client AS c6;
-END|
-
---echo
-
-# - Event ev2
-
-CREATE EVENT ev2 ON SCHEDULE AT '2030-01-01 00:00:00' DO
-BEGIN
- DECLARE 1 CHAR(10) CHARACTER SET utf8;
-
- SELECT
- COLLATION(1) AS c1,
- COLLATION('') AS c2,
- COLLATION(_koi8r '') AS c3,
- COLLATION(_utf8 'текст') AS c4,
- @@collation_connection AS c5,
- @@character_set_client AS c6;
-END|
-
---echo
-
-# - Event ev3
-
-CREATE EVENT mysqltest2.ev3 ON SCHEDULE AT '2030-01-01 00:00:00' DO
-BEGIN
- DECLARE 1 CHAR(10) CHARACTER SET utf8;
-
- SELECT
- COLLATION(1) AS c1,
- COLLATION('') AS c2,
- COLLATION(_koi8r '') AS c3,
- COLLATION(_utf8 'текст') AS c4,
- @@collation_connection AS c5,
- @@character_set_client AS c6;
-END|
-
---echo
-
-# - Event ev4
-
-CREATE EVENT mysqltest2.ev4 ON SCHEDULE AT '2030-01-01 00:00:00' DO
-BEGIN
- DECLARE 1 CHAR(10) CHARACTER SET utf8;
-
- SELECT
- COLLATION(1) AS c1,
- COLLATION('') AS c2,
- COLLATION(_koi8r '') AS c3,
- COLLATION(_utf8 'текст') AS c4,
- @@collation_connection AS c5,
- @@character_set_client AS c6;
-END|
-
---echo
-
-
-#
-# First-round checks.
-#
-
---source include/ddl_i18n.check_events.inc
-
-#
-# Change running environment (alter database character set, change session
-# variables).
-#
-
---echo
---echo
-
-ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
-ALTER DATABASE mysqltest2 COLLATE cp866_general_ci|
-
-#
-# Second-round checks:
-#
-
-# - Change connection to flush cache;
-
---connect (con2,localhost,root,,mysqltest1)
-
-# - Switch environment variables and trigger loading stored procedures;
-
-SET @@character_set_client= cp1251|
-SET @@character_set_results= cp1251|
-SET @@collation_connection= cp1251_general_ci|
-
---disable_result_log
-SHOW CREATE EVENT ev1|
-SHOW CREATE EVENT ev2|
-SHOW CREATE EVENT mysqltest2.ev3|
-SHOW CREATE EVENT mysqltest2.ev4|
---enable_result_log
-
-# - Restore environment;
-
-set names koi8r|
-
-# - Check!
-
---source include/ddl_i18n.check_events.inc
-
-#
-# Check mysqldump.
-#
-
-# - Dump mysqltest1, mysqltest2;
-
---let $events_dump1 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.events.mysqltest1.sql
---let $events_dump2 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.events.mysqltest2.sql
-
---echo
---echo ---> Dump of mysqltest1
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --compact --events --databases mysqltest1
-
---echo
---echo ---> Dumping mysqltest1 to ddl_i18n_koi8r.events.mysqltest1.sql
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --compact --events --databases mysqltest1 > $events_dump1
-
---echo
---echo ---> Dump of mysqltest2
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --compact --events --databases mysqltest2
-
---echo
---echo ---> Dumping mysqltest2 to ddl_i18n_koi8r.events.mysqltest2.sql
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --compact --events --databases mysqltest2 > $events_dump2
-
-# - Clean mysqltest1, mysqltest2;
-
---echo
---echo
-
-DROP DATABASE mysqltest1|
-DROP DATABASE mysqltest2|
-
-# - Restore mysqltest1;
-
---echo
---echo
-
---echo ---> Restoring mysqltest1...
---exec $MYSQL test < $events_dump1
-
---echo ---> Restoring mysqltest2...
---exec $MYSQL test < $events_dump2
-
---remove_file $events_dump1
---remove_file $events_dump2
-
-#
-# Third-round checks.
-#
-
-# - Change connection to flush cache;
-
---connect (con3,localhost,root,,mysqltest1)
-
-# - Switch environment variables and trigger loading stored procedures;
-
-SET @@character_set_client= cp1251|
-SET @@character_set_results= cp1251|
-SET @@collation_connection= cp1251_general_ci|
-
---disable_result_log
-SHOW CREATE EVENT ev1|
-SHOW CREATE EVENT ev2|
-SHOW CREATE EVENT mysqltest2.ev3|
-SHOW CREATE EVENT mysqltest2.ev4|
---enable_result_log
-
-# - Restore environment;
-
-set names koi8r|
-
-# - Check!
-
---source include/ddl_i18n.check_events.inc
-
-###########################################################################
-#
-# * DDL statements inside stored routine.
-#
-# Here we check that DDL statements use actual database collation even if they
-# are called from stored routine.
-#
-###########################################################################
-
---echo
---echo -------------------------------------------------------------------
---echo DDL statements within stored routine.
---echo -------------------------------------------------------------------
---echo
-
-#
-# Preparation:
-#
-
-# - Create database with fixed, pre-defined character set.
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest1|
-DROP DATABASE IF EXISTS mysqltest2|
---enable_warnings
-
-CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
-CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
-
-use mysqltest1|
-
-# - Create procedures;
-
---echo
-
-CREATE PROCEDURE p1()
-BEGIN
- CREATE TABLE t1(col1 VARCHAR(10));
- SHOW CREATE TABLE t1;
-END|
-
---echo
-
-CREATE PROCEDURE mysqltest2.p2()
-BEGIN
- CREATE TABLE t2(col1 VARCHAR(10));
- SHOW CREATE TABLE t2;
-END|
-
---echo
-
-#
-# First-round checks.
-#
-
-CALL p1()|
-
---echo
-
-SHOW CREATE TABLE t1|
-
---echo
---echo
-
-CALL mysqltest2.p2()|
-
---echo
-
-SHOW CREATE TABLE mysqltest2.t2|
-
-#
-# Alter database.
-#
-
---echo
-
-ALTER DATABASE mysqltest1 COLLATE cp1251_general_cs|
-ALTER DATABASE mysqltest2 COLLATE cp1251_general_cs|
-
-DROP TABLE t1|
-DROP TABLE mysqltest2.t2|
-
---echo
-
-#
-# Second-round checks.
-#
-
-CALL p1()|
-
---echo
-
-SHOW CREATE TABLE t1|
-
---echo
---echo
-
-CALL mysqltest2.p2()|
-
---echo
-
-SHOW CREATE TABLE mysqltest2.t2|
-
-###########################################################################
-#
-# That's it.
-#
-###########################################################################
-
-#
-# Cleanup.
-#
-delimiter ;|
-
---connection con2
---disconnect con2
---source include/wait_until_disconnected.inc
---connection con3
---disconnect con3
---source include/wait_until_disconnected.inc
---connection default
-USE test;
-DROP DATABASE mysqltest1;
-DROP DATABASE mysqltest2;
diff --git a/mysql-test/t/ddl_i18n_utf8.test b/mysql-test/t/ddl_i18n_utf8.test
deleted file mode 100644
index 9fecad87515..00000000000
--- a/mysql-test/t/ddl_i18n_utf8.test
+++ /dev/null
@@ -1,1124 +0,0 @@
-# Objects to test:
-# - stored procedures/functions;
-# - triggers;
-# - events;
-# - views;
-#
-# For stored routines:
-# - create a database with collation utf8_unicode_ci;
-# - create an object, which
-# - contains SP-var with explicit CHARSET-clause;
-# - contains SP-var without CHARSET-clause;
-# - contains text constant;
-# - has localized routine/parameter names;
-# - check:
-# - execute;
-# - SHOW CREATE output;
-# - SHOW output;
-# - SELECT FROM INFORMATION_SCHEMA output;
-# - alter database character set;
-# - change connection collation;
-# - check again;
-# - dump definition using mysqldump;
-# - drop object;
-# - restore object;
-#
-
-###########################################################################
-#
-# NOTE: this file contains text in UTF8 and KOI8-R encodings.
-#
-###########################################################################
-
-set sql_mode="";
-
-# Test requires server to accept client connections (for mysqldump portions)
---source include/not_embedded.inc
---source include/have_utf8.inc
---source include/have_cp866.inc
---source include/have_cp1251.inc
---source include/have_koi8r.inc
-let collation=utf8_unicode_ci;
---source include/have_collation.inc
-
-###########################################################################
-
-set names utf8;
-delimiter |;
-
-###########################################################################
-#
-# * Views.
-#
-###########################################################################
-
---echo
---echo -------------------------------------------------------------------
---echo Views
---echo -------------------------------------------------------------------
---echo
-
-#
-# Preparation:
-#
-
-# - Create database with fixed, pre-defined character set.
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest1|
---enable_warnings
-
-CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
-
-use mysqltest1|
-
-CREATE TABLE t1(кол INT)|
-INSERT INTO t1 VALUES(1)|
-
-# - Create views;
-
---echo
-
-CREATE VIEW v1 AS
- SELECT 'тест' AS c1, кол AS c2
- FROM t1|
-
---echo
-
-CREATE VIEW v2 AS SELECT _koi8r'' as c1|
-
---echo
-
-CREATE VIEW v3 AS SELECT _koi8r''|
-
---echo
-
-#
-# First-round checks.
-#
-
---source include/ddl_i18n.check_views.inc
-
-#
-# Change running environment (alter database character set, change session
-# variables).
-#
-
---echo
---echo
-
-ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
-
-#
-# Second-round checks:
-#
-
-# - Change connection to flush cache;
-
---connect (con2,localhost,root,,)
-
-# - Switch environment variables and trigger loading views;
-
-SET @@character_set_client= cp1251|
-SET @@character_set_results= cp1251|
-SET @@collation_connection= cp1251_general_ci|
-
---disable_result_log
-SELECT * FROM mysqltest1.v1|
-SELECT * FROM mysqltest1.v2|
-SELECT * FROM mysqltest1.v3|
---enable_result_log
-
-use mysqltest1|
-
-# - Restore environment;
-
-set names utf8|
-
-# - Check!
-
---source include/ddl_i18n.check_views.inc
-
-#
-# Check mysqldump.
-#
-
-# - Dump mysqltest1;
-
---let $views_dump1 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8views.mysqltest1.sql
-
---echo
---echo ---> Dumping mysqltest1 to ddl_i18n_utf8views.mysqltest1.sql
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --databases mysqltest1 > $views_dump1
-
-# - Clean mysqltest1;
-
---echo
---echo
-
-DROP DATABASE mysqltest1|
-
-# - Restore mysqltest1;
-
---echo
---echo
-
---echo ---> Restoring mysqltest1...
---exec $MYSQL test < $views_dump1
-
---remove_file $views_dump1
-
-#
-# Third-round checks.
-#
-
-# - Change connection to flush cache;
-
---connect (con3,localhost,root,,)
-
-# - Switch environment variables and trigger loading views;
-
-SET @@character_set_client= cp1251|
-SET @@character_set_results= cp1251|
-SET @@collation_connection= cp1251_general_ci|
-
---disable_result_log
-SELECT * FROM mysqltest1.v1|
-SELECT * FROM mysqltest1.v2|
-SELECT * FROM mysqltest1.v3|
---enable_result_log
-
-use mysqltest1|
-
-# - Restore environment;
-
-set names utf8|
-
-# - Check!
-
---source include/ddl_i18n.check_views.inc
-
-#
-# Cleanup.
-#
-
---connection default
-
---disconnect con2
---disconnect con3
-
-use test|
-
-DROP DATABASE mysqltest1|
-
-###########################################################################
-#
-# * Stored procedures/functions.
-#
-###########################################################################
-
---echo
---echo -------------------------------------------------------------------
---echo Stored procedures/functions
---echo -------------------------------------------------------------------
---echo
-
-#
-# Preparation:
-#
-
-# - Create database with fixed, pre-defined character set.
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest1|
-DROP DATABASE IF EXISTS mysqltest2|
---enable_warnings
-
-CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
-CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
-
-use mysqltest1|
-
-# - Create two stored routines -- with and without explicit
-# CHARSET-clause for SP-variable;
-#
-
---echo
-
-# - Procedure p1
-
-CREATE PROCEDURE p1(
- INOUT парам1 CHAR(10),
- OUT парам2 CHAR(10))
-BEGIN
- DECLARE перем1 CHAR(10);
-
- SELECT
- COLLATION(перем1) AS c1,
- COLLATION(парам1) AS c2,
- COLLATION(парам2) AS c3;
-
- SELECT
- COLLATION('текст') AS c4,
- COLLATION(_utf8 'текст') AS c5,
- COLLATION(_koi8r '') AS c6,
- @@collation_connection AS c7,
- @@character_set_client AS c8;
-
- SET парам1 = 'a';
- SET парам2 = 'b';
-END|
-
---echo
-
-# - Procedure p2
-
-CREATE PROCEDURE p2(
- INOUT парам1 CHAR(10) CHARACTER SET utf8,
- OUT парам2 CHAR(10) CHARACTER SET utf8)
-BEGIN
- DECLARE перем1 CHAR(10) CHARACTER SET utf8;
-
- SELECT
- COLLATION(перем1) AS c1,
- COLLATION(парам1) AS c2,
- COLLATION(парам2) AS c3;
-
- SELECT
- COLLATION('текст') AS c4,
- COLLATION(_utf8 'текст') AS c5,
- COLLATION(_koi8r '') AS c6,
- @@collation_connection AS c7,
- @@character_set_client AS c8;
-
- SET парам1 = 'a';
- SET парам2 = 'b';
-END|
-
---echo
-
-# - Procedure p3
-
-CREATE PROCEDURE mysqltest2.p3(
- INOUT парам1 CHAR(10),
- OUT парам2 CHAR(10))
-BEGIN
- DECLARE перем1 CHAR(10);
-
- SELECT
- COLLATION(перем1) AS c1,
- COLLATION(парам1) AS c2,
- COLLATION(парам2) AS c3;
-
- SELECT
- COLLATION('текст') AS c4,
- COLLATION(_utf8 'текст') AS c5,
- COLLATION(_koi8r '') AS c6,
- @@collation_connection AS c7,
- @@character_set_client AS c8;
-
- SET парам1 = 'a';
- SET парам2 = 'b';
-END|
-
---echo
-
-# - Procedure p4
-
-CREATE PROCEDURE mysqltest2.p4(
- INOUT парам1 CHAR(10) CHARACTER SET utf8,
- OUT парам2 CHAR(10) CHARACTER SET utf8)
-BEGIN
- DECLARE перем1 CHAR(10) CHARACTER SET utf8;
-
- SELECT
- COLLATION(перем1) AS c1,
- COLLATION(парам1) AS c2,
- COLLATION(парам2) AS c3;
-
- SELECT
- COLLATION('текст') AS c4,
- COLLATION(_utf8 'текст') AS c5,
- COLLATION(_koi8r '') AS c6,
- @@collation_connection AS c7,
- @@character_set_client AS c8;
-
- SET парам1 = 'a';
- SET парам2 = 'b';
-END|
-
-#
-# First-round checks.
-#
-
---source include/ddl_i18n.check_sp.inc
-
-#
-# Change running environment (alter database character set, change session
-# variables).
-#
-
---echo
---echo
-
-ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
-ALTER DATABASE mysqltest2 COLLATE cp866_general_ci|
-
-#
-# Second-round checks:
-#
-
-# - Change connection to flush SP-cache;
-
---connect (con2,localhost,root,,mysqltest1)
-
-# - Switch environment variables and trigger loading stored procedures;
-
-SET @@character_set_client= cp1251|
-SET @@character_set_results= cp1251|
-SET @@collation_connection= cp1251_general_ci|
-
-CALL p1(@a, @b)|
-CALL p2(@a, @b)|
-CALL mysqltest2.p3(@a, @b)|
-CALL mysqltest2.p4(@a, @b)|
-
-# - Restore environment;
-
-set names utf8|
-
-# - Check!
-
---source include/ddl_i18n.check_sp.inc
-
-#
-# Check mysqldump.
-#
-
-# - Dump mysqltest1, mysqltest2;
-
---let $sp_dump1 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8sp.mysqltest1.sql
---let $sp_dump2 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8sp.mysqltest2.sql
-
---echo
---echo ---> Dump of mysqltest1
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --compact --routines --databases mysqltest1
-
---echo
---echo ---> Dumping mysqltest1 to ddl_i18n_utf8sp.mysqltest1.sql
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --compact --routines --databases mysqltest1 > $sp_dump1
-
---echo
---echo ---> Dump of mysqltest2
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --compact --routines --databases mysqltest2
-
---echo
---echo ---> Dumping mysqltest2 to ddl_i18n_utf8sp.mysqltest2.sql
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --compact --routines --databases mysqltest2 > $sp_dump2
-
-# - Clean mysqltest1, mysqltest2;
-
---echo
---echo
-
-DROP DATABASE mysqltest1|
-DROP DATABASE mysqltest2|
-
-# - Restore mysqltest1;
-
---echo
---echo
-
---echo ---> Restoring mysqltest1...
---exec $MYSQL test < $sp_dump1
-
---echo ---> Restoring mysqltest2...
---exec $MYSQL test < $sp_dump2
-
---remove_file $sp_dump1
---remove_file $sp_dump2
-
-#
-# Third-round checks.
-#
-
-# - Change connection to flush SP-cache;
-
---connect (con3,localhost,root,,mysqltest1)
-
-# - Switch environment variables and trigger loading stored procedures;
-
-SET @@character_set_client= cp1251|
-SET @@character_set_results= cp1251|
-SET @@collation_connection= cp1251_general_ci|
-
-CALL p1(@a, @b)|
-CALL p2(@a, @b)|
-CALL mysqltest2.p3(@a, @b)|
-CALL mysqltest2.p4(@a, @b)|
-
-# - Restore environment;
-
-set names utf8|
-
-# - Check!
-
---source include/ddl_i18n.check_sp.inc
-
-#
-# Cleanup.
-#
-
---connection default
-
---disconnect con2
---disconnect con3
-
-use test|
-
-DROP DATABASE mysqltest1|
-DROP DATABASE mysqltest2|
-
-###########################################################################
-#
-# * Triggers.
-#
-###########################################################################
-
---echo
---echo -------------------------------------------------------------------
---echo Triggers
---echo -------------------------------------------------------------------
---echo
-
-#
-# Preparation:
-#
-
-# - Create database with fixed, pre-defined character set;
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest1|
-DROP DATABASE IF EXISTS mysqltest2|
---enable_warnings
-
-CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
-CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
-
-use mysqltest1|
-
-# - Create tables for triggers;
-
-CREATE TABLE t1(c INT)|
-CREATE TABLE mysqltest2.t1(c INT)|
-
-# - Create log tables;
-
-CREATE TABLE log(msg VARCHAR(255))|
-CREATE TABLE mysqltest2.log(msg VARCHAR(255))|
-
-
-# - Create triggers -- with and without explicit CHARSET-clause for
-# SP-variable;
-#
-
---echo
-
-# - Trigger trg1
-
-CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW
-BEGIN
- DECLARE перем1 CHAR(10);
-
- INSERT INTO log VALUES(COLLATION(перем1));
- INSERT INTO log VALUES(COLLATION('текст'));
- INSERT INTO log VALUES(COLLATION(_utf8 'текст'));
- INSERT INTO log VALUES(COLLATION(_koi8r ''));
- INSERT INTO log VALUES(@@collation_connection);
- INSERT INTO log VALUES(@@character_set_client);
-
- SET @a1 = 'текст';
- SET @a2 = _utf8 'текст';
- SET @a3 = _koi8r '';
-END|
-
---echo
-
-# - Trigger trg2
-
-CREATE TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW
-BEGIN
- DECLARE перем1 CHAR(10) CHARACTER SET utf8;
-
- INSERT INTO log VALUES(COLLATION(перем1));
- INSERT INTO log VALUES(COLLATION('текст'));
- INSERT INTO log VALUES(COLLATION(_utf8 'текст'));
- INSERT INTO log VALUES(COLLATION(_koi8r ''));
- INSERT INTO log VALUES(@@collation_connection);
- INSERT INTO log VALUES(@@character_set_client);
-
- SET @b1 = 'текст';
- SET @b2 = _utf8 'текст';
- SET @b3 = _koi8r '';
-END|
-
---echo
-
-# - Trigger trg3
-
-CREATE TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW
-BEGIN
- DECLARE перем1 CHAR(10);
-
- INSERT INTO log VALUES(COLLATION(перем1));
- INSERT INTO log VALUES(COLLATION('текст'));
- INSERT INTO log VALUES(COLLATION(_utf8 'текст'));
- INSERT INTO log VALUES(COLLATION(_koi8r ''));
- INSERT INTO log VALUES(@@collation_connection);
- INSERT INTO log VALUES(@@character_set_client);
-
- SET @a1 = 'текст';
- SET @a2 = _utf8 'текст';
- SET @a3 = _koi8r '';
-END|
-
---echo
-
-# - Trigger trg4
-
-CREATE TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW
-BEGIN
- DECLARE перем1 CHAR(10) CHARACTER SET utf8;
-
- INSERT INTO log VALUES(COLLATION(перем1));
- INSERT INTO log VALUES(COLLATION('текст'));
- INSERT INTO log VALUES(COLLATION(_utf8 'текст'));
- INSERT INTO log VALUES(COLLATION(_koi8r ''));
- INSERT INTO log VALUES(@@collation_connection);
- INSERT INTO log VALUES(@@character_set_client);
-
- SET @b1 = 'текст';
- SET @b2 = _utf8 'текст';
- SET @b3 = _koi8r '';
-END|
-
---echo
-
-#
-# First-round checks.
-#
-
---source include/ddl_i18n.check_triggers.inc
-
-#
-# Change running environment (alter database character set, change session
-# variables).
-#
-
---echo
---echo
-
-ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
-ALTER DATABASE mysqltest2 COLLATE cp866_general_ci|
-
-#
-# Second-round checks:
-#
-
-# - Flush table cache;
-
-ALTER TABLE t1 ADD COLUMN fake INT|
-ALTER TABLE t1 DROP COLUMN fake|
-
-ALTER TABLE mysqltest2.t1 ADD COLUMN fake INT|
-ALTER TABLE mysqltest2.t1 DROP COLUMN fake|
-
-# - Switch environment variables and initiate loading of triggers
-# (connect using NULL database);
-
---connect (con2,localhost,root,,)
-
-SET @@character_set_client= cp1251|
-SET @@character_set_results= cp1251|
-SET @@collation_connection= cp1251_general_ci|
-
-INSERT INTO mysqltest1.t1 VALUES(0)|
-INSERT INTO mysqltest2.t1 VALUES(0)|
-
-DELETE FROM mysqltest1.log|
-DELETE FROM mysqltest2.log|
-
-# - Restore environment;
-
-set names utf8|
-
-use mysqltest1|
-
-# - Check!
-
---source include/ddl_i18n.check_triggers.inc
-
-#
-# Check mysqldump.
-#
-
-# - Dump mysqltest1, mysqltest2;
-
---let $triggers_dump1 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8triggers.mysqltest1.sql
---let $triggers_dump2 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8triggers.mysqltest2.sql
-
---echo
---echo ---> Dump of mysqltest1
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --compact --triggers --databases mysqltest1
-
---echo
---echo ---> Dumping mysqltest1 to ddl_i18n_utf8triggers.mysqltest1.sql
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --compact --triggers --databases mysqltest1 > $triggers_dump1
-
---echo
---echo ---> Dump of mysqltest2
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --compact --triggers --databases mysqltest2
-
---echo
---echo ---> Dumping mysqltest2 to ddl_i18n_utf8triggers.mysqltest2.sql
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --compact --triggers --databases mysqltest2 > $triggers_dump2
-
-# - Clean mysqltest1, mysqltest2;
-
---echo
---echo
-
-DROP DATABASE mysqltest1|
-DROP DATABASE mysqltest2|
-
-# - Restore mysqltest1;
-
---echo
---echo
-
---echo ---> Restoring mysqltest1...
---exec $MYSQL test < $triggers_dump1
-
---echo ---> Restoring mysqltest2...
---exec $MYSQL test < $triggers_dump2
-
---remove_file $triggers_dump1
---remove_file $triggers_dump2
-
-#
-# Third-round checks.
-#
-
-# - Flush table cache;
-
-ALTER TABLE mysqltest1.t1 ADD COLUMN fake INT|
-ALTER TABLE mysqltest1.t1 DROP COLUMN fake|
-
-ALTER TABLE mysqltest2.t1 ADD COLUMN fake INT|
-ALTER TABLE mysqltest2.t1 DROP COLUMN fake|
-
-# - Switch environment variables and initiate loading of triggers
-# (connect using NULL database);
-
---connect (con3,localhost,root,,)
-
-SET @@character_set_client= cp1251|
-SET @@character_set_results= cp1251|
-SET @@collation_connection= cp1251_general_ci|
-
-INSERT INTO mysqltest1.t1 VALUES(0)|
-INSERT INTO mysqltest2.t1 VALUES(0)|
-
-DELETE FROM mysqltest1.log|
-DELETE FROM mysqltest2.log|
-
-# - Restore environment;
-
-set names utf8|
-
-use mysqltest1|
-
-# - Check!
-
---source include/ddl_i18n.check_triggers.inc
-
-#
-# Cleanup.
-#
-
---connection default
-
---disconnect con2
---disconnect con3
-
-use test|
-
-DROP DATABASE mysqltest1|
-DROP DATABASE mysqltest2|
-
-###########################################################################
-#
-# * Events
-#
-# We don't have EXECUTE EVENT so far, so this test is limited. It checks that
-# event with non-latin1 symbols can be created, dumped, restored and SHOW
-# statements work properly.
-#
-###########################################################################
-
---echo
---echo -------------------------------------------------------------------
---echo Events
---echo -------------------------------------------------------------------
---echo
-
-#
-# Preparation:
-#
-
-# - Create database with fixed, pre-defined character set.
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest1|
-DROP DATABASE IF EXISTS mysqltest2|
---enable_warnings
-
-CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
-CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
-
-use mysqltest1|
-
-# - Create two stored routines -- with and without explicit
-# CHARSET-clause for SP-variable;
-#
-
---echo
-
-# - Event ev1
-
-CREATE EVENT ev1 ON SCHEDULE AT '2030-01-01 00:00:00' DO
-BEGIN
- DECLARE перем1 CHAR(10);
-
- SELECT
- COLLATION(перем1) AS c1,
- COLLATION('текст') AS c2,
- COLLATION(_utf8 'текст') AS c3,
- COLLATION(_koi8r '') AS c4,
- @@collation_connection AS c5,
- @@character_set_client AS c6;
-END|
-
---echo
-
-# - Event ev2
-
-CREATE EVENT ev2 ON SCHEDULE AT '2030-01-01 00:00:00' DO
-BEGIN
- DECLARE перем1 CHAR(10) CHARACTER SET utf8;
-
- SELECT
- COLLATION(перем1) AS c1,
- COLLATION('текст') AS c2,
- COLLATION(_utf8 'текст') AS c3,
- COLLATION(_koi8r '') AS c4,
- @@collation_connection AS c5,
- @@character_set_client AS c6;
-END|
-
---echo
-
-# - Event ev3
-
-CREATE EVENT mysqltest2.ev3 ON SCHEDULE AT '2030-01-01 00:00:00' DO
-BEGIN
- DECLARE перем1 CHAR(10) CHARACTER SET utf8;
-
- SELECT
- COLLATION(перем1) AS c1,
- COLLATION('текст') AS c2,
- COLLATION(_utf8 'текст') AS c3,
- COLLATION(_koi8r '') AS c4,
- @@collation_connection AS c5,
- @@character_set_client AS c6;
-END|
-
---echo
-
-# - Event ev4
-
-CREATE EVENT mysqltest2.ev4 ON SCHEDULE AT '2030-01-01 00:00:00' DO
-BEGIN
- DECLARE перем1 CHAR(10) CHARACTER SET utf8;
-
- SELECT
- COLLATION(перем1) AS c1,
- COLLATION('текст') AS c2,
- COLLATION(_utf8 'текст') AS c3,
- COLLATION(_koi8r '') AS c4,
- @@collation_connection AS c5,
- @@character_set_client AS c6;
-END|
-
---echo
-
-
-#
-# First-round checks.
-#
-
---source include/ddl_i18n.check_events.inc
-
-#
-# Change running environment (alter database character set, change session
-# variables).
-#
-
---echo
---echo
-
-ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
-ALTER DATABASE mysqltest2 COLLATE cp866_general_ci|
-
-#
-# Second-round checks:
-#
-
-# - Change connection to flush cache;
-
---connect (con2,localhost,root,,mysqltest1)
-
-# - Switch environment variables and trigger loading stored procedures;
-
-SET @@character_set_client= cp1251|
-SET @@character_set_results= cp1251|
-SET @@collation_connection= cp1251_general_ci|
-
---disable_result_log
-SHOW CREATE EVENT ev1|
-SHOW CREATE EVENT ev2|
-SHOW CREATE EVENT mysqltest2.ev3|
-SHOW CREATE EVENT mysqltest2.ev4|
---enable_result_log
-
-# - Restore environment;
-
-set names utf8|
-
-# - Check!
-
---source include/ddl_i18n.check_events.inc
-
-#
-# Check mysqldump.
-#
-
-# - Dump mysqltest1, mysqltest2;
-
---let $events_dump1 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8events.mysqltest1.sql
---let $events_dump2 = $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8events.mysqltest2.sql
-
---echo
---echo ---> Dump of mysqltest1
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --compact --events --databases mysqltest1
-
---echo
---echo ---> Dumping mysqltest1 to ddl_i18n_utf8events.mysqltest1.sql
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --compact --events --databases mysqltest1 > $events_dump1
-
---echo
---echo ---> Dump of mysqltest2
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --compact --events --databases mysqltest2
-
---echo
---echo ---> Dumping mysqltest2 to ddl_i18n_utf8events.mysqltest2.sql
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --compact --events --databases mysqltest2 > $events_dump2
-
-# - Clean mysqltest1, mysqltest2;
-
---echo
---echo
-
-DROP DATABASE mysqltest1|
-DROP DATABASE mysqltest2|
-
-# - Restore mysqltest1;
-
---echo
---echo
-
---echo ---> Restoring mysqltest1...
---exec $MYSQL test < $events_dump1
-
---echo ---> Restoring mysqltest2...
---exec $MYSQL test < $events_dump2
-
---remove_file $events_dump1
---remove_file $events_dump2
-
-#
-# Third-round checks.
-#
-
-# - Change connection to flush cache;
-
---connect (con3,localhost,root,,mysqltest1)
-
-# - Switch environment variables and trigger loading stored procedures;
-
-SET @@character_set_client= cp1251|
-SET @@character_set_results= cp1251|
-SET @@collation_connection= cp1251_general_ci|
-
---disable_result_log
-SHOW CREATE EVENT ev1|
-SHOW CREATE EVENT ev2|
-SHOW CREATE EVENT mysqltest2.ev3|
-SHOW CREATE EVENT mysqltest2.ev4|
---enable_result_log
-
-# - Restore environment;
-
-set names utf8|
-
-# - Check!
-
---source include/ddl_i18n.check_events.inc
-
-###########################################################################
-#
-# * DDL statements inside stored routine.
-#
-# Here we check that DDL statements use actual database collation even if they
-# are called from stored routine.
-#
-###########################################################################
-
---echo
---echo -------------------------------------------------------------------
---echo DDL statements within stored routine.
---echo -------------------------------------------------------------------
---echo
-
-#
-# Preparation:
-#
-
-# - Create database with fixed, pre-defined character set.
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest1|
-DROP DATABASE IF EXISTS mysqltest2|
---enable_warnings
-
-CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
-CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci|
-
-use mysqltest1|
-
-# - Create procedures;
-
---echo
-
-CREATE PROCEDURE p1()
-BEGIN
- CREATE TABLE t1(col1 VARCHAR(10));
- SHOW CREATE TABLE t1;
-END|
-
---echo
-
-CREATE PROCEDURE mysqltest2.p2()
-BEGIN
- CREATE TABLE t2(col1 VARCHAR(10));
- SHOW CREATE TABLE t2;
-END|
-
---echo
-
-#
-# First-round checks.
-#
-
-CALL p1()|
-
---echo
-
-SHOW CREATE TABLE t1|
-
---echo
---echo
-
-CALL mysqltest2.p2()|
-
---echo
-
-SHOW CREATE TABLE mysqltest2.t2|
-
-#
-# Alter database.
-#
-
---echo
-
-ALTER DATABASE mysqltest1 COLLATE cp1251_general_cs|
-ALTER DATABASE mysqltest2 COLLATE cp1251_general_cs|
-
-DROP TABLE t1|
-DROP TABLE mysqltest2.t2|
-
---echo
-
-#
-# Second-round checks.
-#
-
-CALL p1()|
-
---echo
-
-SHOW CREATE TABLE t1|
-
---echo
---echo
-
-CALL mysqltest2.p2()|
-
---echo
-
-SHOW CREATE TABLE mysqltest2.t2|
-
-###########################################################################
-#
-# That's it.
-#
-###########################################################################
-
-#
-# Cleanup.
-#
-delimiter ;|
-
---connection con2
---disconnect con2
---source include/wait_until_disconnected.inc
---connection con3
---disconnect con3
---source include/wait_until_disconnected.inc
---connection default
-USE test;
-DROP DATABASE mysqltest1;
-DROP DATABASE mysqltest2;
diff --git a/mysql-test/t/deadlock_innodb.test b/mysql-test/t/deadlock_innodb.test
deleted file mode 100644
index 08e3e256790..00000000000
--- a/mysql-test/t/deadlock_innodb.test
+++ /dev/null
@@ -1,16 +0,0 @@
-# t/deadlock_innodb.test
-#
-#
-# Last update:
-# 2006-07-26 ML test refactored (MySQL 5.1)
-# main code --> include/deadlock.inc
-# new wrapper t/deadlock_innodb.test
-#
-
-# Can't test this with embedded server
--- source include/not_embedded.inc
-
---source include/have_innodb.inc
-let $engine_type= InnoDB;
-
---source include/deadlock.inc
diff --git a/mysql-test/t/debug_sync.test b/mysql-test/t/debug_sync.test
deleted file mode 100644
index 89414939f59..00000000000
--- a/mysql-test/t/debug_sync.test
+++ /dev/null
@@ -1,427 +0,0 @@
-###################### t/debug_sync.test ###############################
-# #
-# Testing of the Debug Sync Facility. #
-# #
-# There is important documentation within sql/debug_sync.cc #
-# #
-# Used objects in this test case: #
-# p0 - synchronization point 0. Non-existent dummy sync point. #
-# s1 - signal 1. #
-# s2 - signal 2. #
-# #
-# Creation: #
-# 2008-02-18 istruewing #
-# #
-########################################################################
-
-#
-# We need the Debug Sync Facility.
-#
---source include/have_debug_sync.inc
-
-#
-# We are checking privileges, which the embedded server cannot do.
-#
---source include/not_embedded.inc
-
-#
-# Preparative cleanup.
-#
---disable_warnings
-SET DEBUG_SYNC= 'RESET';
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-#
-# Show the special system variable.
-# It shows ON or OFF depending on the command line option --debug-sync.
-# The test case assumes it is ON (command line option present).
-#
-SHOW VARIABLES LIKE 'DEBUG_SYNC';
-
-#
-# Syntax. Valid forms.
-#
-SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
-SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2';
-SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 HIT_LIMIT 3';
-SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6';
-SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 EXECUTE 2 HIT_LIMIT 3';
-SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 EXECUTE 2';
-SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 HIT_LIMIT 3';
-SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2';
-SET DEBUG_SYNC='p0 SIGNAL s1 EXECUTE 2 HIT_LIMIT 3';
-SET DEBUG_SYNC='p0 SIGNAL s1 EXECUTE 2';
-SET DEBUG_SYNC='p0 SIGNAL s1 HIT_LIMIT 3';
-SET DEBUG_SYNC='p0 SIGNAL s1';
-SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
-SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2';
-SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 HIT_LIMIT 3';
-SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6';
-SET DEBUG_SYNC='p0 WAIT_FOR s2 EXECUTE 2 HIT_LIMIT 3';
-SET DEBUG_SYNC='p0 WAIT_FOR s2 EXECUTE 2';
-SET DEBUG_SYNC='p0 WAIT_FOR s2 HIT_LIMIT 3';
-SET DEBUG_SYNC='p0 WAIT_FOR s2';
-SET DEBUG_SYNC='p0 HIT_LIMIT 3';
-SET DEBUG_SYNC='p0 CLEAR';
-SET DEBUG_SYNC='p0 TEST';
-SET DEBUG_SYNC='RESET';
-
-#
-# Syntax. Valid forms. Lower case.
-#
-set debug_sync='p0 signal s1 wait_for s2 timeout 6 execute 2 hit_limit 3';
-set debug_sync='p0 signal s1 wait_for s2 timeout 6 execute 2';
-set debug_sync='p0 signal s1 wait_for s2 timeout 6 hit_limit 3';
-set debug_sync='p0 signal s1 wait_for s2 timeout 6';
-set debug_sync='p0 signal s1 wait_for s2 execute 2 hit_limit 3';
-set debug_sync='p0 signal s1 wait_for s2 execute 2';
-set debug_sync='p0 signal s1 wait_for s2 hit_limit 3';
-set debug_sync='p0 signal s1 wait_for s2';
-set debug_sync='p0 signal s1 execute 2 hit_limit 3';
-set debug_sync='p0 signal s1 execute 2';
-set debug_sync='p0 signal s1 hit_limit 3';
-set debug_sync='p0 signal s1';
-set debug_sync='p0 wait_for s2 timeout 6 execute 2 hit_limit 3';
-set debug_sync='p0 wait_for s2 timeout 6 execute 2';
-set debug_sync='p0 wait_for s2 timeout 6 hit_limit 3';
-set debug_sync='p0 wait_for s2 timeout 6';
-set debug_sync='p0 wait_for s2 execute 2 hit_limit 3';
-set debug_sync='p0 wait_for s2 execute 2';
-set debug_sync='p0 wait_for s2 hit_limit 3';
-set debug_sync='p0 wait_for s2';
-set debug_sync='p0 hit_limit 3';
-set debug_sync='p0 clear';
-set debug_sync='p0 test';
-set debug_sync='reset';
-
-#
-# Syntax. Valid forms. Line wrap, leading, mid, trailing space.
-#
-SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6
- EXECUTE 2 HIT_LIMIT 3';
-SET DEBUG_SYNC=' p0 SIGNAL s1 WAIT_FOR s2';
-SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2';
-SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 ';
-SET DEBUG_SYNC=' p0 SIGNAL s1 WAIT_FOR s2 ';
-SET DEBUG_SYNC=' p0 SIGNAL s1 WAIT_FOR s2 ';
-
-#
-# Syntax. Invalid forms.
-#
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC=' ';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 EXECUTE 2';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 TIMEOUT 6 EXECUTE 2';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 TIMEOUT 6';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 WAIT_FOR s2 SIGNAL s1';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 WAIT_FOR s2 SIGNAL s1 EXECUTE 2';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 WAIT_FOR s2 SIGNAL s1 TIMEOUT 6 EXECUTE 2';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 WAIT_FOR s2 SIGNAL s1 TIMEOUT 6';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 SIGNAL s1 EXECUTE 2';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 SIGNAL s1';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 TIMEOUT 6 WAIT_FOR s2 EXECUTE 2';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 TIMEOUT 6 WAIT_FOR s2';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 SIGNAL s1 TIMEOUT 6 EXECUTE 2';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 SIGNAL s1 TIMEOUT 6';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 EXECUTE 2 SIGNAL s1 TIMEOUT 6';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 TIMEOUT 6 SIGNAL s1';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 EXECUTE 2 TIMEOUT 6 SIGNAL s1';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 CLEAR HIT_LIMIT 3';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='CLEAR';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 CLEAR p0';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='TEST';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 TEST p0';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 RESET';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='RESET p0';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 RESET p0';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 SIGNAL ';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 WAIT_FOR ';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 SIGNAL s1 EXECUTE ';
-
-#
-# Syntax. Invalid keywords used.
-#
---error ER_UNKNOWN_SYSTEM_VARIABLE
-SET DEBUG_SYNCx='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 SIGNAx s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOx s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIT 3';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUx 0 EXECUTE 2 HIT_LIMIT 3';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTx 2 HIT_LIMIT 3';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 SIGNAL s1 WAIT_FOR s2 TIMEOUT 6 EXECUTE 2 HIT_LIMIx 3';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 CLEARx';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 TESTx';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='RESETx';
-
-#
-# Syntax. Invalid numbers. Decimal only.
-#
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 0x6 EXECUTE 2 HIT_LIMIT 3';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 6 EXECUTE 0x2 HIT_LIMIT 3';
---error ER_PARSE_ERROR
-SET DEBUG_SYNC='p0 WAIT_FOR s2 TIMEOUT 7 EXECUTE 2 HIT_LIMIT 0x3';
-
-#
-# Syntax. Invalid value type.
-#
---error ER_WRONG_TYPE_FOR_VAR
-SET DEBUG_SYNC= 7;
-
-#
-# Syntax. DEBUG_SYNC is a SESSION-only variable.
-#
---error ER_LOCAL_VARIABLE
-SET GLOBAL DEBUG_SYNC= 'p0 CLEAR';
-
-#
-# Syntax. The variable value does not need to be a string literal.
-#
-SET @myvar= 'now SIGNAL from_myvar';
-SET DEBUG_SYNC= @myvar;
-SHOW VARIABLES LIKE 'DEBUG_SYNC';
-#
-SET DEBUG_SYNC= LEFT('now SIGNAL from_function_cut_here', 24);
-SHOW VARIABLES LIKE 'DEBUG_SYNC';
-
-#
-# Functional tests.
-#
-# NOTE: There is the special synchronization point 'now'. It is placed
-# immediately after setting of the DEBUG_SYNC variable.
-# So it is executed before the SET statement ends.
-#
-# NOTE: There is only one global signal (say "signal post" or "flag mast").
-# A SIGNAL action writes its signal into it ("sets a flag").
-# The signal persists until explicitly overwritten.
-# To avoid confusion for later tests, it is recommended to clear
-# the signal by signalling "empty" ("setting the 'empty' flag"):
-# SET DEBUG_SYNC= 'now SIGNAL empty';
-# Preferably you can reset the whole facility with:
-# SET DEBUG_SYNC= 'RESET';
-# The signal is then '' (really empty) which connot be done otherwise.
-#
-
-#
-# Time out immediately. This gives just a warning.
-#
-SET DEBUG_SYNC= 'now SIGNAL something';
-SHOW VARIABLES LIKE 'DEBUG_SYNC';
-# Suppress warning number
---replace_column 2 ####
-SET DEBUG_SYNC= 'now WAIT_FOR nothing TIMEOUT 0';
-#
-# If signal is present already, TIMEOUT 0 does not give a warning.
-#
-SET DEBUG_SYNC= 'now SIGNAL nothing';
-SHOW VARIABLES LIKE 'DEBUG_SYNC';
-SET DEBUG_SYNC= 'now WAIT_FOR nothing TIMEOUT 0';
-
-#
-# EXECUTE 0 is effectively a no-op.
-#
-SET DEBUG_SYNC= 'now SIGNAL something EXECUTE 0';
-SHOW VARIABLES LIKE 'DEBUG_SYNC';
-SET DEBUG_SYNC= 'now WAIT_FOR anotherthing TIMEOUT 0 EXECUTE 0';
-
-#
-# Run into HIT_LIMIT. This gives an error.
-#
---error ER_DEBUG_SYNC_HIT_LIMIT
-SET DEBUG_SYNC= 'now HIT_LIMIT 1';
-
-#
-# Many actions. Watch the array growing and shrinking in the debug trace:
-# egrep 'query:|debug_sync_action:' mysql-test/var/log/master.trace
-#
-SET DEBUG_SYNC= 'RESET';
-SHOW VARIABLES LIKE 'DEBUG_SYNC';
-SET DEBUG_SYNC= 'p1abcd SIGNAL s1 EXECUTE 2';
-SET DEBUG_SYNC= 'p2abc SIGNAL s2 EXECUTE 2';
-SET DEBUG_SYNC= 'p9abcdef SIGNAL s9 EXECUTE 2';
-SET DEBUG_SYNC= 'p4a SIGNAL s4 EXECUTE 2';
-SET DEBUG_SYNC= 'p5abcde SIGNAL s5 EXECUTE 2';
-SET DEBUG_SYNC= 'p6ab SIGNAL s6 EXECUTE 2';
-SET DEBUG_SYNC= 'p7 SIGNAL s7 EXECUTE 2';
-SET DEBUG_SYNC= 'p8abcdef SIGNAL s8 EXECUTE 2';
-SET DEBUG_SYNC= 'p3abcdef SIGNAL s3 EXECUTE 2';
-#
-# Execute some actions to show they exist. Each sets a distinct signal.
-#
-SET DEBUG_SYNC= 'p4a TEST';
-SHOW VARIABLES LIKE 'DEBUG_SYNC';
-SET DEBUG_SYNC= 'p1abcd TEST';
-SHOW VARIABLES LIKE 'DEBUG_SYNC';
-SET DEBUG_SYNC= 'p7 TEST';
-SHOW VARIABLES LIKE 'DEBUG_SYNC';
-SET DEBUG_SYNC= 'p9abcdef TEST';
-SHOW VARIABLES LIKE 'DEBUG_SYNC';
-SET DEBUG_SYNC= 'p3abcdef TEST';
-SHOW VARIABLES LIKE 'DEBUG_SYNC';
-#
-# Clear the actions.
-#
-SET DEBUG_SYNC= 'p1abcd CLEAR';
-SET DEBUG_SYNC= 'p2abc CLEAR';
-SET DEBUG_SYNC= 'p5abcde CLEAR';
-SET DEBUG_SYNC= 'p6ab CLEAR';
-SET DEBUG_SYNC= 'p8abcdef CLEAR';
-SET DEBUG_SYNC= 'p9abcdef CLEAR';
-SET DEBUG_SYNC= 'p3abcdef CLEAR';
-SET DEBUG_SYNC= 'p4a CLEAR';
-SET DEBUG_SYNC= 'p7 CLEAR';
-#
-# Execute some actions to show they have gone.
-#
-SET DEBUG_SYNC= 'p1abcd TEST';
-SHOW VARIABLES LIKE 'DEBUG_SYNC';
-SET DEBUG_SYNC= 'p7 TEST';
-SHOW VARIABLES LIKE 'DEBUG_SYNC';
-SET DEBUG_SYNC= 'p9abcdef TEST';
-SHOW VARIABLES LIKE 'DEBUG_SYNC';
-#
-# Now cleanup. Actions are clear already, but signal needs to be cleared.
-#
-SET DEBUG_SYNC= 'RESET';
-SHOW VARIABLES LIKE 'DEBUG_SYNC';
-
-#
-# Facility requires SUPER privilege.
-#
-CREATE USER mysqltest_1@localhost;
-GRANT SUPER ON *.* TO mysqltest_1@localhost;
-connect (con1,localhost,mysqltest_1,,);
-SET DEBUG_SYNC= 'RESET';
-disconnect con1;
-connection default;
-DROP USER mysqltest_1@localhost;
-#
-CREATE USER mysqltest_2@localhost;
-GRANT ALL ON *.* TO mysqltest_2@localhost;
-REVOKE SUPER ON *.* FROM mysqltest_2@localhost;
-connect (con1,localhost,mysqltest_2,,);
---error ER_SPECIFIC_ACCESS_DENIED_ERROR
-SET DEBUG_SYNC= 'RESET';
-disconnect con1;
-connection default;
-DROP USER mysqltest_2@localhost;
-
-#
-# Example 1.
-#
-# Preparative cleanup.
---disable_warnings
-SET DEBUG_SYNC= 'RESET';
-DROP TABLE IF EXISTS t1;
---enable_warnings
-#
-# Test.
-CREATE TABLE t1 (c1 INT);
- connect (con1,localhost,root,,);
- SET DEBUG_SYNC= 'before_lock_tables_takes_lock
- SIGNAL opened WAIT_FOR flushed';
- send INSERT INTO t1 VALUES(1);
-connection default;
-SET DEBUG_SYNC= 'now WAIT_FOR opened';
-SET DEBUG_SYNC= 'after_flush_unlock SIGNAL flushed';
-FLUSH TABLE t1;
- connection con1;
- reap;
- disconnect con1;
-connection default;
-DROP TABLE t1;
-
-#
-# Example 2.
-#
-# Preparative cleanup.
---disable_warnings
-SET DEBUG_SYNC= 'RESET';
-DROP TABLE IF EXISTS t1;
---enable_warnings
-#
-# Test.
-CREATE TABLE t1 (c1 INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1);
-SELECT GET_LOCK('mysqltest_lock', 100);
-
-connect (con1,localhost,root,,);
---echo # Sending:
---send UPDATE t1 SET c1=GET_LOCK('mysqltest_lock', 100);
-
-connect (con2,localhost,root,,);
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "User lock" and
- info = "UPDATE t1 SET c1=GET_LOCK('mysqltest_lock', 100)";
---source include/wait_condition.inc
-
-# Retain action after use. First used by general_log.
-SET DEBUG_SYNC= 'wait_for_lock SIGNAL locked EXECUTE 2';
-send INSERT INTO t1 VALUES (1);
-
-connection default;
-# Wait until INSERT waits for lock.
-SET DEBUG_SYNC= 'now WAIT_FOR locked';
-# let UPDATE continue.
-SELECT RELEASE_LOCK('mysqltest_lock');
-connection con1;
---echo # Reaping UPDATE
-reap;
-SELECT RELEASE_LOCK('mysqltest_lock');
-
-connection con2;
---echo retrieve INSERT result.
-reap;
-disconnect con1;
-disconnect con2;
-connection default;
-DROP TABLE t1;
-
-#
-# Cleanup after test case.
-# Otherwise signal would contain 'flushed' here,
-# which could confuse the next test.
-#
-SET DEBUG_SYNC= 'RESET';
-
diff --git a/mysql-test/t/default.test b/mysql-test/t/default.test
deleted file mode 100644
index 44778bc568a..00000000000
--- a/mysql-test/t/default.test
+++ /dev/null
@@ -1,2106 +0,0 @@
-#
-# test of already fixed bugs
-#
---disable_warnings
-drop table if exists t1,t2,t3,t4,t5,t6;
-drop database if exists mysqltest;
-
-#
-# Bug 10838
-# Insert causes warnings for no default values and corrupts tables
-#
-set sql_mode="";
-CREATE TABLE t1 (a varchar(30) binary NOT NULL DEFAULT ' ',
- b varchar(1) binary NOT NULL DEFAULT ' ',
- c varchar(4) binary NOT NULL DEFAULT '0000',
- d tinyblob NULL,
- e tinyblob NULL,
- f tinyblob NULL,
- g tinyblob NULL,
- h tinyblob NULL,
- i tinyblob NULL,
- j tinyblob NULL,
- k tinyblob NULL,
- l tinyblob NULL,
- m tinyblob NULL,
- n tinyblob NULL,
- o tinyblob NULL,
- p tinyblob NULL,
- q varchar(30) binary NOT NULL DEFAULT ' ',
- r varchar(30) binary NOT NULL DEFAULT ' ',
- s tinyblob NULL,
- t varchar(4) binary NOT NULL DEFAULT ' ',
- u varchar(1) binary NOT NULL DEFAULT ' ',
- v varchar(30) binary NOT NULL DEFAULT ' ',
- w varchar(30) binary NOT NULL DEFAULT ' ',
- x tinyblob NULL,
- y varchar(5) binary NOT NULL DEFAULT ' ',
- z varchar(20) binary NOT NULL DEFAULT ' ',
- a1 varchar(30) binary NOT NULL DEFAULT ' ',
- b1 tinyblob NULL)
-ENGINE=InnoDB DEFAULT CHARACTER SET = latin1 COLLATE latin1_bin;
---enable_warnings
-set sql_mode=default;
-
-INSERT into t1 (b) values ('1');
-SHOW WARNINGS;
-SELECT * from t1;
-
-CREATE TABLE t2 (a varchar(30) binary NOT NULL DEFAULT ' ',
- b varchar(1) binary NOT NULL DEFAULT ' ',
- c varchar(4) binary NOT NULL DEFAULT '0000',
- d tinyblob NULL,
- e tinyblob NULL,
- f tinyblob NULL,
- g tinyblob NULL,
- h tinyblob NULL,
- i tinyblob NULL,
- j tinyblob NULL,
- k tinyblob NULL,
- l tinyblob NULL,
- m tinyblob NULL,
- n tinyblob NULL,
- o tinyblob NULL,
- p tinyblob NULL,
- q varchar(30) binary NOT NULL DEFAULT ' ',
- r varchar(30) binary NOT NULL DEFAULT ' ',
- s tinyblob NULL,
- t varchar(4) binary NOT NULL DEFAULT ' ',
- u varchar(1) binary NOT NULL DEFAULT ' ',
- v varchar(30) binary NOT NULL DEFAULT ' ',
- w varchar(30) binary NOT NULL DEFAULT ' ',
- x tinyblob NULL,
- y varchar(5) binary NOT NULL DEFAULT ' ',
- z varchar(20) binary NOT NULL DEFAULT ' ',
- a1 varchar(30) binary NOT NULL DEFAULT ' ',
- b1 tinyblob NULL)
-ENGINE=MyISAM DEFAULT CHARACTER SET = latin1 COLLATE latin1_bin;
-
-SHOW CREATE TABLE t2;
-INSERT into t2 (b) values ('1');
-SHOW WARNINGS;
-SELECT * from t2;
-
-drop table t1;
-drop table t2;
-
-
-#
-# Bug#20691: DATETIME col (NOT NULL, NO DEFAULT) may insert garbage when specifying DEFAULT
-#
-# From the docs:
-# If the column can take NULL as a value, the column is defined with an
-# explicit DEFAULT NULL clause. This is the same as before 5.0.2.
-#
-# If the column cannot take NULL as the value, MySQL defines the column with
-# no explicit DEFAULT clause. For data entry, if an INSERT or REPLACE
-# statement includes no value for the column, MySQL handles the column
-# according to the SQL mode in effect at the time:
-#
-# * If strict SQL mode is not enabled, MySQL sets the column to the
-# implicit default value for the column data type.
-#
-# * If strict mode is enabled, an error occurs for transactional tables and
-# the statement is rolled back. For non-transactional tables, an error
-# occurs, but if this happens for the second or subsequent row of a
-# multiple-row statement, the preceding rows will have been inserted.
-#
-create table bug20691 (i int, d datetime NOT NULL, dn datetime not null default '0000-00-00 00:00:00');
-insert ignore into bug20691 values (1, DEFAULT, DEFAULT), (1, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (1, DEFAULT, DEFAULT);
-insert ignore into bug20691 (i) values (2);
-desc bug20691;
-insert ignore into bug20691 values (3, DEFAULT, DEFAULT), (3, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (3, DEFAULT, DEFAULT);
-insert ignore into bug20691 (i) values (4);
-insert ignore into bug20691 values (5, DEFAULT, DEFAULT), (5, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (5, DEFAULT, DEFAULT);
-SET sql_mode = 'ALLOW_INVALID_DATES';
-insert into bug20691 values (6, DEFAULT, DEFAULT), (6, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (6, DEFAULT, DEFAULT);
-SET sql_mode = 'STRICT_ALL_TABLES';
---error 1364
-insert into bug20691 values (7, DEFAULT, DEFAULT), (7, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (7, DEFAULT, DEFAULT);
-select * from bug20691 order by i asc;
-drop table bug20691;
-
-SET sql_mode = '';
-create table bug20691 (
- a set('one', 'two', 'three') not null,
- b enum('small', 'medium', 'large', 'enormous', 'ellisonego') not null,
- c time not null,
- d date not null,
- e int not null,
- f long not null,
- g blob not null,
- h datetime not null,
- i decimal not null,
- x int);
-insert into bug20691 values (2, 3, 5, '0007-01-01', 11, 13, 17, '0019-01-01 00:00:00', 23, 1);
-insert into bug20691 (x) values (2);
-insert into bug20691 values (2, 3, 5, '0007-01-01', 11, 13, 17, '0019-01-01 00:00:00', 23, 3);
-insert into bug20691 values (DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, 4);
-select * from bug20691 order by x asc;
-drop table bug20691;
-
-create table t1 (id int not null);
-insert into t1 values(default);
-
-create view v1 (c) as select id from t1;
-insert into t1 values(default);
-drop view v1;
-drop table t1;
-
-#
-# Bug #39002: crash with
-# INSERT ... SELECT ... ON DUPLICATE KEY UPDATE col=DEFAULT
-#
-
-create table t1 (a int unique);
-create table t2 (b int default 10);
-insert into t1 (a) values (1);
-insert into t2 (b) values (1);
-
-insert into t1 (a) select b from t2 on duplicate key update a=default;
-select * from t1;
-
-insert into t1 (a) values (1);
-insert into t1 (a) select b from t2 on duplicate key update a=default(b);
-select * from t1;
-
-drop table t1, t2;
-
---echo # End of 5.0 tests
-
---echo #
---echo # Start of 10.0 tests
---echo #
-
---echo #
---echo # MDEV-11265 Access defied when CREATE VIIEW v1 AS SELECT DEFAULT(column) FROM t1
---echo #
-
-CREATE TABLE t1 (a INT DEFAULT 10);
-INSERT INTO t1 VALUES (11);
-CREATE VIEW v1 AS SELECT a AS a FROM t1;
-CREATE VIEW v2 AS SELECT DEFAULT(a) AS a FROM t1;
-CREATE VIEW v3 AS SELECT VALUE(a) AS a FROM t1;
-SELECT * FROM v1;
-SELECT * FROM v2;
-SELECT * FROM v3;
---error ER_NONUPDATEABLE_COLUMN
-UPDATE v2 SET a=123;
---error ER_NONUPDATEABLE_COLUMN
-UPDATE v3 SET a=123;
-DROP VIEW v3;
-DROP VIEW v2;
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-10780 Server crashes in in create_tmp_table
---echo #
-
-# Note, the problem was not repeatable with a non-fresh connection.
---connect (con1,localhost,root,,test)
-CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ();
-INSERT INTO t1 VALUES ();
-SELECT DISTINCT DEFAULT (pk) FROM t1 GROUP BY RAND() WITH ROLLUP;
---disconnect con1
---connection default
-DROP TABLE t1;
-
---echo #
---echo # End of 10.0 tests
---echo #
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
-# Using DEFAULT(col) in WHERE condition
-CREATE TABLE t1 (a INT DEFAULT 100, b INT DEFAULT NULL);
-INSERT INTO t1 VALUES ();
-SELECT * FROM t1 WHERE DEFAULT(a);
-SELECT * FROM t1 WHERE DEFAULT(b);
-DROP TABLE IF EXISTS t1;
-
-
---echo #
---echo # End of 10.1 tests
---echo #
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
-SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30.123456');
-
---echo #
---echo # Check that CURRENT_TIMESTAMP works as before
---echo #
-
-CREATE or replace TABLE t1 (event_time TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
-SHOW CREATE TABLE t1;
-
-CREATE or replace TABLE t1 (event_time TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(2) ON UPDATE CURRENT_TIMESTAMP);
-SHOW CREATE TABLE t1;
-
-CREATE or replace TABLE t1 (event_time TIMESTAMP(6) NOT NULL DEFAULT SYSDATE(2) ON UPDATE CURRENT_TIMESTAMP);
-SHOW CREATE TABLE t1;
-
-drop table t1;
-
---echo #
---echo # Check default expressions
---echo #
-
-create or replace table t1 (a int default 1, b int default (a+1), c int default (a+b)) engine myisam;
-show create table t1;
-insert into t1 values ();
-insert into t1 (a) values (2);
-insert into t1 (a,b) values (10,20);
-insert into t1 (a,b,c) values (100,200,400);
-select * from t1;
-truncate table t1;
-insert delayed into t1 values ();
-insert delayed into t1 (a) values (2);
-insert delayed into t1 (a,b) values (10,20);
-insert delayed into t1 (a,b,c) values (100,200,400);
-flush tables t1;
-select * from t1;
-
-create or replace table t1 (a int, b blob default (1), c blob default "hello", t text default concat(a,b,c)) engine=myisam;
-show create table t1;
-insert into t1 (a) values (2);
-insert into t1 (a,b) values (10,"test1");
-insert into t1 (a,b,c) values (10,"test2","test3");
-insert delayed into t1 (a,b) values (10,"test4");
-flush tables t1;
-select * from t1;
-drop table t1;
-
-create or replace table t1 (a bigint default uuid_short());
-insert into t1 values();
-select a > 0 from t1;
-drop table t1;
-
-create or replace table t1 (param_list int DEFAULT (1+1) NOT NULL);
---error ER_PARSE_ERROR
-create or replace table t1 (param_list int DEFAULT 1+1 NOT NULL);
-create or replace table t1 (param_list blob DEFAULT "" NOT NULL);
-
-drop table t1;
-
-create table t1 (a int);
-insert into t1 values(-1);
-alter table t1 add b int default 1, add c int default -1, add d int default (1+1), add e timestamp;
-select a,b,c,d,e from t1;
-insert into t1 values(10,10,10,10,0);
-alter table t1 add f int default (1+1+1) null, add g int default (1+1+1+1) not null,add h int default (2+2+2+2);
-select a,b,c,d,e,f,g,h from t1;
-show create table t1;
-
-create table t2 like t1;
-show create table t2;
-insert into t2 (a) values (100);
-select a,b,c,d,e,f,g,h from t2;
-drop table t1,t2;
-
-create table t1 (a int default (1----1), b int default - 1, c int default +1, e int default (--1));
-show create table t1;
-insert into t1 values();
-insert into t1 values();
-select * from t1;
-drop table t1;
-
---echo #
---echo # Create or replace can delete a table on error
---echo #
-create table t1 (a int);
---error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD
-create or replace table t1 (a int default b, b int default a);
---error ER_NO_SUCH_TABLE
-show create table t1;
-
---echo #
---echo # Refering to other columns
---echo #
-
-create or replace table t1 (a int default 1, b int default a);
-create or replace table t1 (a int default 1, b int as (a));
-create or replace table t1 (a int default b, b int default 1);
-create or replace table t1 (a int as (b), b int default 1);
-create or replace table t1 (a int as (b), b int default (1+1));
-create or replace table t1 (a int default 1, b int as (c), c int default (a+1));
-create or replace table t1 (a int default (1+1), b int as (c), c int default (a+1));
-create or replace table t1 (a varchar(128) default @@version);
-create or replace table t1 (a int not null, b int as (a));
-create or replace table t1 (a int not null, b int default (a+1));
-
-
---error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD
-create or replace table t1 (a int default a);
-create or replace table t1 (a int default b, b int default (1+1));
---error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD
-create or replace table t1 (a int default 1, b int as (c), c int as (a+1));
---error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD
-CREATE TABLE t1 (a INT DEFAULT (DEFAULT(a)));
---error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD
-CREATE TABLE t1 (a INT DEFAULT(DEFAULT(b)), b INT DEFAULT(DEFAULT(a)));
---error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD
-CREATE TABLE t1 (a INT DEFAULT(DEFAULT(b)) NOT NULL, b INT DEFAULT(DEFAULT(a)) NOT NULL);
-
---echo #
---echo # Allow defaults to refer to not default fields
---echo #
-
-create or replace table t1 (a int default b, b int not null);
-insert into t1 values();
-insert into t1 (a) values(1);
-insert into t1 (b) values(2);
-insert into t1 (a,b) values(3,4);
-select * from t1;
-drop table t1;
-CREATE OR REPLACE TABLE t1 (a INT DEFAULT @v); drop table t1;
-CREATE TABLE t1 (a INT DEFAULT @v:=1); drop table t1;
-
---echo #
---echo # Error handling
---echo #
-
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-create or replace table t1 (a bigint default xxx());
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-create or replace table t1 (a bigint default (select (1)));
---error ER_OPERAND_COLUMNS
-create or replace table t1 (a bigint default (1,2,3));
---error ER_OPERAND_COLUMNS
-create or replace table t1 (a bigint default ((1,2,3)));
---error ER_PARSE_ERROR
-CREATE TABLE t1 (a INT, b INT, c INT DEFAULT a DIV b);
---error ER_PARSE_ERROR
-CREATE TABLE t1 (a INT, b INT DEFAULT -a);
-
---echo #
---echo # Invalid DEFAULT expressions
---echo #
-
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-CREATE TABLE t1 (a INT DEFAULT ((SELECT 1)));
-
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-CREATE TABLE t1 (a INT DEFAULT (EXISTS (SELECT 1)));
-
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-CREATE TABLE t1 (a INT DEFAULT (1=ANY (SELECT 1)));
-
---error ER_OPERAND_COLUMNS
-CREATE TABLE t1 (a INT DEFAULT ROW(1,1));
-
---error ER_OPERAND_COLUMNS
-CREATE TABLE t1 (a INT DEFAULT (1,1));
-
---error ER_OPERAND_COLUMNS
-CREATE TABLE t1 (a INT DEFAULT ((1,1)));
-
---error ER_PARSE_ERROR,2031
-CREATE TABLE t1 (a INT DEFAULT ?);
---error ER_PARSE_ERROR,2031
-CREATE TABLE t1 (a INT DEFAULT(?));
-
---error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD
-CREATE TABLE t1 (a INT DEFAULT (b), b INT DEFAULT(a));
-
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-CREATE TABLE t1 (a INT DEFAULT(NAME_CONST('xxx', 'yyy'));
-
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-CREATE TABLE t1 (a INT DEFAULT COUNT(*));
-
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-CREATE TABLE t1 (a INT DEFAULT COUNT(1));
-
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-CREATE TABLE t1 (a INT DEFAULT AVG(1));
-
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-CREATE TABLE t1 (a INT DEFAULT MIN(1));
-
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-CREATE TABLE t1 (a INT DEFAULT GROUP_CONCAT(1));
-
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-CREATE TABLE t1 (a INT DEFAULT ROW_NUMBER() OVER ());
-
-CREATE FUNCTION f1() RETURNS INT RETURN 1;
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-CREATE TABLE t1 (a INT DEFAULT f1());
-DROP FUNCTION f1;
-
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-CREATE PROCEDURE p1(par INT) CREATE TABLE t1 (a INT DEFAULT par);
-
---error ER_BAD_FIELD_ERROR
-CREATE TABLE t1 (a INT DEFAULT par);
-
-CREATE PROCEDURE p1() CREATE TABLE t1 (a INT DEFAULT par);
---error ER_BAD_FIELD_ERROR
-CALL p1;
-DROP PROCEDURE p1;
-
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-CREATE TABLE t1 (a INT DEFAULT VALUE(a));
-
-
-CREATE TABLE t1 (a INT);
-# "Explicit or implicit commit is not allowed in stored function or trigger
-# because the entire CREATE TABLE is actually not allowed in triggers!
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW CREATE TABLE t2 (a INT DEFAULT NEW.a);
-# This is OK to return Function or expression is not allowed for 'DEFAULT'
-# because CREATE TEMPORARY TABLE is allowed in triggers
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-CREATE TRIGGER tr1 AFTER INSERT ON t1 FOR EACH ROW CREATE TEMPORARY TABLE t2 (a INT DEFAULT NEW.a);
-DROP TABLE t1;
-
---echo #
---echo # Prepared statements
---echo #
-
-PREPARE stmt FROM 'CREATE TABLE t1 (a INT DEFAULT(?))';
-set @a=1;
-execute stmt using @a;
-show create table t1;
-drop table t1;
-set @a=-1;
-execute stmt using @a;
-show create table t1;
-drop table t1;
-DEALLOCATE PREPARE stmt;
-
-PREPARE stmt FROM 'CREATE TABLE t1 (a INT DEFAULT(?), b INT DEFAULT(?))';
-set @a=1, @b=2;
-execute stmt using @a,@b;
-show create table t1;
-drop table t1;
-DEALLOCATE PREPARE stmt;
-
-#
-# We can't have an expression for prepared statements
-#
-
-prepare stmt from 'create table t1 (a int default(?+?))';
-set @a=1;
-execute stmt using @a,@a;
-deallocate prepare stmt;
-show create table t1;
-drop table t1;
-
---echo #
---echo # Parenthesized Item_basic_constant
---echo #
-
-
-# It would be better if SHOW would display PI() rather than '3.141592653589793'
-# The problem is that PI() is declared as a basic constant item and it
-# could cause some problems changing it.
-
-CREATE TABLE t1 (
- i01 INT DEFAULT (((1))),
- i02 INT DEFAULT (((0x3939))),
- i03 INT DEFAULT (((1.0))),
- i04 INT DEFAULT (((1e0))),
- i05 INT DEFAULT (((NULL))),
-
- f01 DOUBLE DEFAULT (((PI()))),
-
- s01 VARCHAR(10) DEFAULT (((_latin1'test'))),
- s02 VARCHAR(10) DEFAULT ((('test'))),
- s03 VARCHAR(10) DEFAULT (((0x40))),
- s04 VARCHAR(10) DEFAULT (((X'40'))),
- s05 VARCHAR(10) DEFAULT (((B'1000000'))),
-
- d01 TIME DEFAULT (((TIME'10:20:30'))),
- d02 DATE DEFAULT (((DATE'2001-01-01'))),
- d03 DATETIME DEFAULT (((TIMESTAMP'2001-01-01 10:20:30')))
-);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES ();
---vertical_results
-SELECT * FROM t1;
---horizontal_results
-DROP TABLE t1;
-
-
---echo #
---echo # COALESCE(Item_basic_constant)
---echo #
-
-# i02 INT DEFAULT 0x3939 -- gives 14649 (see the previous query),
-# because it treats as a number
-# i02 INT DEFAULT COALESCE(0x3939) -- gives 99, because it converts to string
-#
-# should be at least documented
-
-CREATE TABLE t1 (
- i01 INT DEFAULT COALESCE(1),
- i02 INT DEFAULT COALESCE(0x3939),
- i03 INT DEFAULT COALESCE(1.0),
- i04 INT DEFAULT COALESCE(1e0),
- i05 INT DEFAULT COALESCE(NULL),
-
- f01 DOUBLE DEFAULT COALESCE(PI()),
-
- s01 VARCHAR(10) DEFAULT COALESCE(_latin1'test'),
- s02 VARCHAR(10) DEFAULT COALESCE('test'),
- s03 VARCHAR(10) DEFAULT COALESCE(0x40),
- s04 VARCHAR(10) DEFAULT COALESCE(X'40'),
- s05 VARCHAR(10) DEFAULT COALESCE(B'1000000'),
-
- d01 TIME DEFAULT COALESCE(TIME'10:20:30'),
- d02 DATE DEFAULT COALESCE(DATE'2001-01-01'),
- d03 DATETIME DEFAULT COALESCE(TIMESTAMP'2001-01-01 10:20:30')
-);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES ();
---vertical_results
-SELECT * FROM t1;
---horizontal_results
-DROP TABLE t1;
-
-
---echo #
---echo # TINYINT: out of range
---echo #
---error ER_INVALID_DEFAULT
-CREATE TABLE t1 (a TINYINT DEFAULT 300 NOT NULL);
---error ER_INVALID_DEFAULT
-CREATE TABLE t1 (a TINYINT DEFAULT 128 NOT NULL);
---error ER_INVALID_DEFAULT
-CREATE TABLE t1 (a TINYINT DEFAULT -500 NOT NULL);
-
---echo #
---echo # INT: simple numeric expressions
---echo #
-CREATE TABLE t1 (a INT DEFAULT 1 NOT NULL);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT DEFAULT COALESCE(1) NOT NULL);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # INT: simple string expressions
---echo #
-
-CREATE TABLE t1 (a INT DEFAULT '1' NOT NULL);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT DEFAULT CONCAT('1') NOT NULL);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT DEFAULT COALESCE('1') NOT NULL);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # INT: string expressions with garbage
---echo #
---error ER_INVALID_DEFAULT
-CREATE TABLE t1 (a INT DEFAULT 'x');
---error ER_INVALID_DEFAULT
-CREATE TABLE t1 (a INT DEFAULT CONCAT('x'));
---error ER_INVALID_DEFAULT
-CREATE TABLE t1 (a INT DEFAULT COALESCE('x'));
---error ER_INVALID_DEFAULT
-CREATE TABLE t1 (a INT DEFAULT (((((COALESCE('x')))))));
-
---echo #
---echo # INT: string expressions with numbers + garbage
---echo #
-
---error ER_INVALID_DEFAULT
-CREATE TABLE t1 (a INT DEFAULT '1x');
---error ER_INVALID_DEFAULT
-CREATE TABLE t1 (a INT DEFAULT COALESCE('1x'));
---error ER_INVALID_DEFAULT
-CREATE TABLE t1 (a INT DEFAULT CONCAT('1x'));
-
---echo #
---echo # INT: string expressions with numbers + trailing space
---echo #
-
-CREATE TABLE t1 (a INT DEFAULT '1 ');
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-# unlike constant, this preserve trailing spaces
-# and sends a note on INSERT. Perhaps CREATE should be rejected
-CREATE TABLE t1 (a INT DEFAULT CONCAT('1 '));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-# unlike constant, this preserve trailing spaces
-# and sends a note on INSERT
-CREATE TABLE t1 (a INT DEFAULT COALESCE('1 '));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # INT: a HEX value
---echo #
-CREATE TABLE t1 (a INT DEFAULT 0x61 NOT NULL);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # VARCHAR: good defaults
---echo #
-CREATE TABLE t1 (a VARCHAR(30) DEFAULT 'xxx' NOT NULL);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(2) DEFAULT 0x41 NOT NULL);
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(2) DEFAULT CONCAT(0x41) NOT NULL);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(2) DEFAULT COALESCE(0x41) NOT NULL);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(2) DEFAULT CONCAT(_utf8 0x41) NOT NULL);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(2) DEFAULT CONCAT(_utf8 X'41') NOT NULL);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # VARCHAR: Too long default
---echo #
---error ER_INVALID_DEFAULT
-CREATE TABLE t1 (a VARCHAR(2) DEFAULT 'xxx' NOT NULL);
---error ER_INVALID_DEFAULT
-CREATE TABLE t1 (a VARCHAR(2) DEFAULT CONCAT('xxx') NOT NULL);
-
---echo #
---echo # VARCHAR: Too long default with non-important data
---echo #
---error ER_INVALID_DEFAULT
-CREATE TABLE t1 (a VARCHAR(2) DEFAULT 'xx ' NOT NULL);
---error ER_INVALID_DEFAULT
-CREATE TABLE t1 (a VARCHAR(2) DEFAULT CONCAT('xx ') NOT NULL);
-
---echo #
---echo # VARCHAR: conversion failures
---echo #
-
-# DEFAULT with a Cyrillic letter for a Latin1 column
---error ER_INVALID_DEFAULT
-CREATE TABLE t1 (a VARCHAR(2) CHARACTER SET latin1 DEFAULT _utf8 X'D18F' NOT NULL);
---error ER_INVALID_DEFAULT
-CREATE TABLE t1 (a VARCHAR(2) CHARACTER SET latin1 DEFAULT CONCAT(_utf8 X'D18F') NOT NULL);
---error ER_INVALID_DEFAULT
-CREATE TABLE t1 (a VARCHAR(2) CHARACTER SET latin1 DEFAULT CONCAT(_utf8 0xD18F) NOT NULL);
-
---echo #
---echo # Field as a default value
---echo #
-
-CREATE TABLE t1 (a INT, b INT DEFAULT (a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (1, 1);
-INSERT INTO t1 VALUES (DEFAULT, DEFAULT);
-INSERT INTO t1 VALUES (1, DEFAULT);
-INSERT INTO t1 VALUES (DEFAULT, 1);
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Function DEFAULT(field)
---echo #
-
-CREATE TABLE t1 (a INT DEFAULT(DEFAULT(b)), b INT DEFAULT 1);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (DEFAULT, DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT DEFAULT 1, b INT DEFAULT(DEFAULT(a)));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (DEFAULT, DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # SQL Standard <datetime value function> as a <default option>
---echo #
-
-CREATE TABLE t1 (a DATETIME DEFAULT CURRENT_TIMESTAMP);
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a TIME DEFAULT CURRENT_TIME);
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DATE DEFAULT CURRENT_DATE);
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
---echo #
---echo # DECIMAL + CURRENT_TIMESTAMP, no truncation
---echo #
-CREATE TABLE t1 (a DECIMAL(30,6) DEFAULT CURRENT_TIMESTAMP(6));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES ();
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DECIMAL(30,6) DEFAULT COALESCE(CURRENT_TIMESTAMP(6)));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES();
-INSERT IGNORE INTO t1 VALUES();
-SET sql_mode = 'STRICT_ALL_TABLES';
-INSERT INTO t1 VALUES();
-SET sql_mode = DEFAULT;
-DROP TABLE t1;
-
---echo #
---echo # DECIMAL + CURRENT_TIME, no truncation
---echo #
-CREATE TABLE t1 (a DECIMAL(30,6) DEFAULT COALESCE(CURRENT_TIME(6)));
-SHOW CREATE TABLE t1;
-INSERT IGNORE INTO t1 VALUES();
-DROP TABLE t1;
-
---echo #
---echo # DECIMAL + CURRENT_DATE, no truncation
---echo #
-CREATE TABLE t1 (a DECIMAL(30,6) DEFAULT COALESCE(CURRENT_DATE));
-SHOW CREATE TABLE t1;
-INSERT IGNORE INTO t1 VALUES();
-DROP TABLE t1;
-
-
---echo #
---echo # COALESCE for SQL Standard <datetime value function>
---echo #
-
-CREATE TABLE t1 (a TIMESTAMP DEFAULT COALESCE(CURRENT_TIMESTAMP));
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DATE DEFAULT COALESCE(CURRENT_DATE));
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a TIME DEFAULT COALESCE(CURRENT_TIME));
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (
- a TIMESTAMP DEFAULT CURRENT_TIMESTAMP(6),
- b TIMESTAMP DEFAULT COALESCE(CURRENT_TIMESTAMP(6))
-);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES ();
-SELECT CURRENT_TIMESTAMP(6);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (
- a DECIMAL(30,0) DEFAULT CURRENT_TIMESTAMP(6),
- b DECIMAL(30,0) DEFAULT COALESCE(CURRENT_TIMESTAMP(6))
-);
-SHOW CREATE TABLE t1;
-INSERT IGNORE INTO t1 VALUES ();
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Check DEFAULT() function
---echo #
-
-CREATE TABLE `t1` (`a` int(11) DEFAULT (3+3),`b` int(11) DEFAULT '1000');
-SHOW CREATE TABLE t1;
-insert into t1 values (1,1),(2,2);
-insert into t1 values (default,default);
-select * from t1;
-select default(a),b from t1;
-select a,default(b) from t1;
-drop table t1;
-
-
---echo #
---echo # Real functions
---echo #
-
-CREATE TABLE t1 (a DECIMAL(10,1), b DOUBLE DEFAULT CAST(a AS DOUBLE));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (10.1, DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DOUBLE, b DOUBLE DEFAULT EXP(a), c DOUBLE DEFAULT LOG(b), d DOUBLE DEFAULT LOG(4, b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (2, DEFAULT, DEFAULT, DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b DOUBLE DEFAULT LOG2(a), c DOUBLE DEFAULT LOG10(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (4, DEFAULT, DEFAULT);
-INSERT INTO t1 VALUES (100, DEFAULT, DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
-CREATE TABLE t1 (a DOUBLE, b DOUBLE DEFAULT SQRT(a), c DOUBLE DEFAULT POW(a,3));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (4, DEFAULT, DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DOUBLE, b DOUBLE DEFAULT ACOS(a), c DOUBLE DEFAULT ASIN(a), d DOUBLE DEFAULT ATAN(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (1, DEFAULT, DEFAULT, DEFAULT);
-SELECT a, b/PI(), c/PI(), d/PI() FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DOUBLE, b DOUBLE DEFAULT COS(a), c DOUBLE DEFAULT SIN(a), d DOUBLE DEFAULT TAN(a), e DOUBLE DEFAULT COT(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (PI()/3);
-SELECT ROUND(a,3), ROUND(b,3), ROUND(c,3), ROUND(d,3), ROUND(e,3) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DOUBLE DEFAULT RAND());
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (DEFAULT);
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DOUBLE, b DOUBLE DEFAULT DEGREES(a), c DOUBLE DEFAULT RADIANS(b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (PI(), DEFAULT, DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # INT result functions
---echo #
-
-CREATE TABLE t1 (a INT, b INT DEFAULT INTERVAL(a, 10, 20, 30, 40));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (34);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b INT, c INT DEFAULT (a DIV b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a, b) VALUES (13, 3);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b INT DEFAULT SIGN(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (-10),(0), (10);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(30), b INT DEFAULT FIELD(a, 'Hej', 'ej', 'Heja', 'hej', 'foo'));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('ej');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(30), b INT DEFAULT FIND_IN_SET(a, 'Hej,ej,Heja,hej,foo'));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('ej');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(30), b INT DEFAULT ASCII(a), c INT DEFAULT ORD(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('a');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a TEXT DEFAULT UUID_SHORT());
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES ();
-SELECT a>0 FROM t1;
-DROP TABLE t1;
-
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-CREATE TABLE t1 (a INT DEFAULT BENCHMARK(1,1));
-
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-CREATE TABLE t1 (a INT DEFAULT GET_LOCK('a',1));
-
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-CREATE TABLE t1 (a INT DEFAULT RELEASE_LOCK('a'));
-
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-CREATE TABLE t1 (a INT DEFAULT IS_USED_LOCK('a'));
-
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-CREATE TABLE t1 (a INT DEFAULT IS_FREE_LOCK('a'));
-
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-CREATE TABLE t1 (a INT DEFAULT SLEEP(1));
-
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-CREATE TABLE t1 (a INT DEFAULT ROW_COUNT());
-
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-CREATE TABLE t1 (a INT DEFAULT FOUND_ROWS());
-
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-CREATE TABLE t1 (a INT DEFAULT MASTER_POS_WAIT('test',100));
-
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-CREATE TABLE t1 (a INT DEFAULT MASTER_GTID_WAIT('test'));
-
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-CREATE TABLE t1 (a VARCHAR(30), b DOUBLE DEFAULT MATCH (a) AGAINST('bbbb' IN BOOLEAN MODE));
-
---echo #
---echo # Temporal functions
---echo #
-
---echo # Item_temporal_hybrid_func
-
-CREATE TABLE t1 (a DATE, b INT, c DATE DEFAULT DATE_ADD(a, INTERVAL b DAY));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES ('2001-01-01', 30, DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DATE, b TIME, c DATETIME DEFAULT ADDTIME(a, b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES ('2001-01-01', '10:20:30', DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(32), b VARCHAR(32), c DATE DEFAULT STR_TO_DATE(a,b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES ('01,5,2013','%d,%m,%Y', DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo # Item_datefunc
-
-SET time_zone='-10:00';
-SET timestamp=UNIX_TIMESTAMP('2001-01-01 23:59:59');
-CREATE TABLE t1 (a DATE DEFAULT CURDATE(), b DATE DEFAULT UTC_DATE());
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES ();
-SELECT * FROM t1;
-DROP TABLE t1;
-SET time_zone=DEFAULT, timestamp= DEFAULT;
-
-CREATE TABLE t1 (a INT, b DATE DEFAULT FROM_DAYS(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (730669, DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DATE, b DATE DEFAULT LAST_DAY(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES ('2003-02-05', DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (yy INT, yd INT, d DATE DEFAULT MAKEDATE(yy, yd));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (2011,32,DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo # Item_timefunc
-
-SET time_zone='-10:00';
-SET timestamp=UNIX_TIMESTAMP('2001-01-01 23:59:59');
-CREATE TABLE t1 (a TIME DEFAULT CURTIME(), b TIME DEFAULT UTC_TIME());
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES ();
-SELECT * FROM t1;
-DROP TABLE t1;
-SET time_zone=DEFAULT, timestamp= DEFAULT;
-
-CREATE TABLE t1 (a INT, b TIME DEFAULT SEC_TO_TIME(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (2378, DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DATETIME, b DATETIME, c TIME DEFAULT TIMEDIFF(a,b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES ('2000:01:01 00:00:00', '2000:01:02 10:20:30', DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (hh INT, mm INT, ss INT, t TIME DEFAULT MAKETIME(hh,mm,ss));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (10,20,30,DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
---echo # Item_datetimefunc
-
-SET time_zone='-10:00';
-SET timestamp=UNIX_TIMESTAMP('2001-01-01 23:59:59');
-CREATE TABLE t1 (a TIMESTAMP DEFAULT NOW(), b TIMESTAMP DEFAULT UTC_TIMESTAMP());
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES ();
-SELECT * FROM t1;
-DROP TABLE t1;
-SET time_zone=DEFAULT, timestamp= DEFAULT;
-
-# SYSDATE is evaluated during get_date() rather than fix_fields.
-CREATE TABLE t1 (a TIMESTAMP(6) DEFAULT SYSDATE(6), s INT, b TIMESTAMP(6) DEFAULT SYSDATE(6));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (DEFAULT(a), SLEEP(0.1), DEFAULT(b));
-SELECT b>a FROM t1;
-DROP TABLE t1;
-
-SET time_zone='+00:00';
-CREATE TABLE t1 (a INT, b TIMESTAMP DEFAULT FROM_UNIXTIME(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (1447430881, DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-SET time_zone=DEFAULT;
-
-CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP DEFAULT CONVERT_TZ(a, '-10:00', '+10:00'));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES ('2001-01-01 10:20:30', DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo # Item_temporal_typecast
-CREATE TABLE t1 (a INT, b DATE DEFAULT CAST(a AS DATE));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (20010203, DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b TIME DEFAULT CAST(a AS TIME));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (102030, DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a BIGINT, b DATETIME DEFAULT CAST(a AS DATETIME));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (20010203102030, DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # Functions with temporal input
---echo #
-
-CREATE TABLE t1 (a INT, b INT, c INT DEFAULT PERIOD_ADD(a,b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a,b) VALUES (200801, 2);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b INT, c INT DEFAULT PERIOD_DIFF(a,b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a,b) VALUES (200802, 200703);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b INT DEFAULT TO_DAYS(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (950501);
-SELECT * FROM t1;
-DROP TABLE t1;
-CREATE TABLE t1 (a DATE, b INT DEFAULT TO_DAYS(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('2007-10-07');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b BIGINT DEFAULT TO_SECONDS(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (950501);
-SELECT * FROM t1;
-DROP TABLE t1;
-CREATE TABLE t1 (a DATE, b BIGINT DEFAULT TO_SECONDS(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('2009-11-29');
-SELECT * FROM t1;
-DROP TABLE t1;
-CREATE TABLE t1 (a DATETIME, b BIGINT DEFAULT TO_SECONDS(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('2009-11-29 13:43:32');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DATE, b BIGINT DEFAULT DAYOFMONTH(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('2007-02-03');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DATE, b BIGINT DEFAULT DAYOFWEEK(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('2007-02-03');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DATE, b BIGINT DEFAULT DAYOFYEAR(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('2007-02-03');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a TIME, b INT DEFAULT HOUR(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('10:05:03');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a TIME, b INT DEFAULT MINUTE(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('10:05:03');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a TIME, b INT DEFAULT SECOND(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('10:05:03');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DATETIME(6), b INT DEFAULT MICROSECOND(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('2009-12-31 23:59:59.000010');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DATE, b INT DEFAULT YEAR(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('1987-01-01');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DATE, b INT DEFAULT MONTH(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('1987-01-01');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DATE, b INT DEFAULT WEEK(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('1987-02-01');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DATE, b INT DEFAULT YEARWEEK(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('2000-01-01');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DATE, b INT DEFAULT QUARTER(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('2008-04-01');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DATE, b INT DEFAULT EXTRACT(YEAR FROM a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('2009-07-02');
-SELECT * FROM t1;
-DROP TABLE t1;
-CREATE TABLE t1 (a DATETIME, b INT DEFAULT EXTRACT(YEAR_MONTH FROM a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('2009-07-02 01:02:03');
-SELECT * FROM t1;
-DROP TABLE t1;
-CREATE TABLE t1 (a DATETIME, b INT DEFAULT EXTRACT(DAY_MINUTE FROM a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('2009-07-02 01:02:03');
-SELECT * FROM t1;
-DROP TABLE t1;
-CREATE TABLE t1 (a DATETIME(6), b INT DEFAULT EXTRACT(MICROSECOND FROM a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('2009-07-02 01:02:03.000123');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DATE, b DATE, c INT DEFAULT TIMESTAMPDIFF(MONTH,a,b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a,b) VALUES ('2003-02-01','2003-05-01');
-SELECT * FROM t1;
-DROP TABLE t1;
-CREATE TABLE t1 (a DATE, b DATE, c INT DEFAULT TIMESTAMPDIFF(YEAR,a,b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a,b) VALUES ('2002-05-01','2001-01-01');
-SELECT * FROM t1;
-DROP TABLE t1;
-CREATE TABLE t1 (a DATE, b DATETIME, c INT DEFAULT TIMESTAMPDIFF(MINUTE,a,b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a,b) VALUES ('2003-02-01','2003-05-01 12:05:55');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-#
-# MDEV-10355 Weird error message upon CREATE TABLE with DEFAULT
-#
-# Column default value expression that includes a temporal function
-#
-CREATE OR REPLACE TABLE t1 ( col INT DEFAULT ( 1 LIKE ( NOW() BETWEEN '2000-01-01' AND '2012-12-12' ) ) );
-SHOW CREATE TABLE t1;
-SET timestamp = UNIX_TIMESTAMP( '2004-04-04' );
-INSERT INTO t1 VALUES( DEFAULT );
-SET timestamp = DEFAULT;
-INSERT INTO t1 VALUES( DEFAULT );
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # Hybrid type functions
---echo #
-
-CREATE TABLE t1 (a INT, b INT, c INT DEFAULT COALESCE(a,b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (NULL, 1, DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
-CREATE TABLE t1 (a INT, b INT, c INT DEFAULT IFNULL(a,b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (NULL, 2, DEFAULT);
-INSERT INTO t1 VALUES (1, 2, DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
-CREATE TABLE t1 (a INT, b INT, c INT DEFAULT NULLIF(a,b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (1, 1, DEFAULT);
-INSERT INTO t1 VALUES (1, 2, DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b INT, c INT DEFAULT IF(a,b,2));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (0, 1, DEFAULT);
-INSERT INTO t1 VALUES (1, 1, DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b INT, c INT DEFAULT CASE WHEN a THEN b ELSE 2 END);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (0, 1, DEFAULT);
-INSERT INTO t1 VALUES (1, 1, DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b INT DEFAULT (-a));
-SHOW CREATE TABLE t1;
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (10, DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b INT DEFAULT ABS(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (-10, DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DOUBLE, b INT DEFAULT CEILING(a), c INT DEFAULT FLOOR(a), d INT DEFAULT ROUND(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (1.5, DEFAULT, DEFAULT, DEFAULT);
-INSERT INTO t1 VALUES (-1.5, DEFAULT, DEFAULT, DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b INT, c INT DEFAULT (a+b), d INT DEFAULT (a-b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (2, 1, DEFAULT, DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b INT, c INT DEFAULT (a*b), d INT DEFAULT (a/b), e INT DEFAULT (a MOD b));
-SHOW CREATE TABLE t1;
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (7, 3, DEFAULT, DEFAULT, DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-SET time_zone='+00:00';
-CREATE TABLE t1 (a DATETIME, b INT DEFAULT UNIX_TIMESTAMP(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES ('2001-01-01 10:20:30', DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-SET time_zone=DEFAULT;
-
-CREATE TABLE t1 (a TIME, b INT DEFAULT TIME_TO_SEC(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES ('22:23:00', DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b INT, c INT DEFAULT LEAST(a,b), d INT DEFAULT GREATEST(a,b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (0, 1, DEFAULT, DEFAULT);
-INSERT INTO t1 VALUES (1, 1, DEFAULT, DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b INT, c INT DEFAULT LAST_VALUE(a,b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (1, 2, DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # CAST
---echo #
-CREATE TABLE t1 (a VARCHAR(30), b DECIMAL(10,6) DEFAULT CAST(a AS DECIMAL(10,1)));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('123.456');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DECIMAL(10,3),
- b VARCHAR(10) DEFAULT CAST(a AS CHAR(10)),
- c VARCHAR(10) DEFAULT CAST(a AS CHAR(4)));
-SHOW CREATE TABLE t1;
-INSERT IGNORE INTO t1 (a) VALUES (123.456);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b INT UNSIGNED DEFAULT CAST(a AS UNSIGNED));
-SHOW CREATE TABLE t1;
-INSERT IGNORE INTO t1 (a) VALUES (-1);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a BIGINT UNSIGNED, b BIGINT SIGNED DEFAULT CAST(a AS SIGNED));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (0xFFFFFFFFFFFFFFFF);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (
- a VARCHAR(10) CHARACTER SET latin1,
- b VARCHAR(10) CHARACTER SET latin1 DEFAULT a COLLATE latin1_bin,
- c VARCHAR(10) CHARACTER SET utf8 DEFAULT CONVERT(a USING utf8),
- d VARBINARY(10) DEFAULT (BINARY(a))
-);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('a');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # Bit functions
---echo #
-
-CREATE TABLE t1 (a INT, b INT DEFAULT BIT_COUNT(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (7);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b INT, c INT DEFAULT (a|b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a,b) VALUES (1,2);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b INT, c INT DEFAULT (a&b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a,b) VALUES (5,4);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b INT, c INT DEFAULT (a^b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a,b) VALUES (11,3);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b INT, c INT DEFAULT (a&~b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a,b) VALUES (5,1);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b INT, c INT DEFAULT (a<<b), d INT DEFAULT (a>>b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a,b) VALUES (5,1);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # String functions
---echo #
-
-CREATE TABLE t1 (a VARCHAR(10), b VARCHAR(20) DEFAULT REVERSE(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('abcd');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10), b VARCHAR(10) DEFAULT UPPER(a), c VARCHAR(10) DEFAULT LOWER(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('ABcd');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10), b VARCHAR(10) DEFAULT LEFT(a,1), c VARCHAR(10) DEFAULT RIGHT(a,1), d VARCHAR(10) DEFAULT SUBSTR(a,2,2));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('abcd');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(20), b VARCHAR(20) DEFAULT SUBSTRING_INDEX(a,'.',2));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('www.mariadb.org');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10), b VARCHAR(10), c VARCHAR(20) DEFAULT CONCAT(a,b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a,b) VALUES ('a','b');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10), b VARCHAR(10), c VARCHAR(20) DEFAULT CONCAT_WS(',',a,b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a,b) VALUES ('a','b');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10), b VARCHAR(10) DEFAULT REPLACE(a,'a','A'));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('abc');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10), b VARCHAR(10) DEFAULT REGEXP_REPLACE(a,'[0-9]','.'));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('a1b2c');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10), b VARCHAR(10) DEFAULT REGEXP_SUBSTR(a,'[0-9]+'));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('ab12cd');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(20), b VARCHAR(20) DEFAULT SOUNDEX(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('tester');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(20), b VARCHAR(20) DEFAULT QUOTE(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('a\'b');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10), b VARCHAR(10) DEFAULT LPAD(a,10,'.'), c VARCHAR(10) DEFAULT RPAD(a,10,'.'));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('ab');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10), b VARCHAR(10) DEFAULT LTRIM(a), c VARCHAR(10) DEFAULT RTRIM(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (' ab ');
-SELECT a, HEX(b), HEX(c) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10), b VARCHAR(10) DEFAULT TRIM(BOTH 'a' FROM a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('abba');
-SELECT a, b FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b VARCHAR(10) DEFAULT SPACE(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (3);
-SELECT a, HEX(b) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b VARCHAR(10), c VARCHAR(10) DEFAULT REPEAT(b,a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a,b) VALUES (3,'x');
-SELECT a, b, c FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (str VARCHAR(10), pos INT, len INT, newstr VARCHAR(10), result VARCHAR(10) DEFAULT INSERT(str,pos,len,newstr));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (str,pos,len,newstr) VALUES ('Quadratic', 3, 4, 'What');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (n INT, res VARCHAR(10) DEFAULT ELT(n,'ej', 'Heja', 'hej', 'foo'));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (n) VALUES (1);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (bits INT, res VARCHAR(10) DEFAULT MAKE_SET(bits,'a','b','c','d'));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (bits) VALUES (1|4);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b VARCHAR(10) DEFAULT CHAR(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (77);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b VARCHAR(10) DEFAULT CONV(a,10,16));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (64);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b INT, c VARCHAR(30) DEFAULT FORMAT(a,b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a,b) VALUES (10000,3);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b INT, l VARCHAR(10), c VARCHAR(30) DEFAULT FORMAT(a,b,l));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a,b,l) VALUES (10000,2,'no_NO'),(10000,2,'ru_RU'),(10000,2,'ar_BH');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10), b VARCHAR(20) DEFAULT GET_FORMAT(DATE,a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('EUR'),('USA'),('JIS'),('ISO'),('INTERNAL');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (
- bits INT,
- v_on VARCHAR(10),
- v_off VARCHAR(10),
- v_separator VARCHAR(10),
- number_of_bits INT,
- x VARCHAR(30) DEFAULT EXPORT_SET(bits, v_on, v_off, v_separator, number_of_bits)
-);
-SHOW CREATE TABLE t1;
-INSERT IGNORE INTO t1 VALUES (0x50006,'Y','N','',64,DEFAULT);
-SELECT * FROM t1;
-DROP TABLE t1;
-
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-CREATE TABLE t1 (a VARCHAR(30), b BLOB DEFAULT LOAD_FILE(a));
-
---echo #
---echo # Predicates
---echo #
-
-CREATE TABLE t1 (a INT, b INT DEFAULT (NOT a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (NULL),(0),(1);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b INT, x INT DEFAULT (a XOR b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a,b) VALUES (0,0),(0,1),(1,0),(1,1);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b INT DEFAULT (a IS TRUE), c INT DEFAULT (a IS NOT TRUE));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (NULL),(0),(1);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b INT DEFAULT (a IS FALSE), c INT DEFAULT (a IS NOT FALSE));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (NULL),(0),(1);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b INT DEFAULT (a IS NULL), c INT DEFAULT (a IS NOT NULL));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (NULL),(0),(1);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b INT DEFAULT (a IS UNKNOWN), c INT DEFAULT (a IS NOT UNKNOWN));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (NULL),(0),(1);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT,
- eq INT DEFAULT (a=0), equal INT DEFAULT (a<=>0),
- ne INT DEFAULT (a<>0),
- lt INT DEFAULT (a<0), le INT DEFAULT (a<=0),
- gt INT DEFAULT (a>0), ge INT DEFAULT (a>=0));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (NULL),(-1),(0),(1);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT (a LIKE 'a%'));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT (a RLIKE 'a$'));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT (a IN ('aaa','bbb')));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb'),('ccc');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT (a NOT IN ('aaa','bbb')));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb'),('ccc');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT (a BETWEEN 'aaa' AND 'bbb'));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb'),('ccc');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT (a NOT BETWEEN 'aaa' AND 'bbb'));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('AAA'),('aaa'),('bbb'),('ccc');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a TEXT DEFAULT UUID());
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES ();
-SELECT LENGTH(a)>0 FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Numeric result functions with string input
---echo #
-
-CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT STRCMP(a,'b'));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('A'),('a'),('B'),('b'),('C'),('c');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT LENGTH(a), c INT DEFAULT CHAR_LENGTH(a), d INT DEFAULT BIT_LENGTH(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('a'),('aa'),('aaa');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT LOCATE('a',a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('xa'),('xxa'),('xxxa');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT REGEXP_INSTR(a, 'a'));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('xa'),('xxa'),('xxxa');
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # INT result metadata functions
---echo #
-
-# QQ: LAST_INSERT_ID() should probably be allowed
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-CREATE TABLE t1
-(
- id SERIAL PRIMARY KEY,
- b INT DEFAULT LAST_INSERT_ID()
-);
-
-CREATE TABLE t1 (a INT DEFAULT CONNECTION_ID());
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES();
-SELECT a>0 FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10), b INT DEFAULT COERCIBILITY(a), c INT DEFAULT COERCIBILITY(b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('test');
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # String result metadata functions
---echo #
-CREATE TABLE t1 (
- a VARCHAR(10) CHARACTER SET latin1,
- b VARCHAR(20) DEFAULT CHARSET(a),
- c VARCHAR(20) DEFAULT COLLATION(a)
-);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('test');
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Hash, compression, encode/decode
---echo #
-CREATE TABLE t1 (a VARCHAR(10), b BIGINT DEFAULT CRC32(a), c TEXT DEFAULT MD5(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('a');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10), b TEXT DEFAULT TO_BASE64(a), c TEXT DEFAULT FROM_BASE64(b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('aaaabbbb');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10), b TEXT DEFAULT HEX(a), c TEXT DEFAULT UNHEX(b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('aaaabbbb');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10), b TEXT DEFAULT ENCODE(a,'test'), c TEXT DEFAULT DECODE(b,'test'));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('aaaabbbb');
-SELECT a, HEX(b), c FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(30), b TEXT DEFAULT PASSWORD(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('notagoodpwd');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (
- a VARCHAR(30),
- b BLOB DEFAULT AES_ENCRYPT(a, 'passwd'),
- c TEXT DEFAULT AES_DECRYPT(b, 'passwd')
-);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('test');
-SELECT c FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Collations
---echo #
-
---error ER_BAD_DATA
-CREATE TABLE t1 (a VARCHAR(20) CHARACTER SET latin1 DEFAULT CONCAT('')) CHARACTER SET koi8r COLLATE koi8r_bin;
-CREATE OR REPLACE TABLE t1 (a char(2) default concat('A') COLLATE utf8mb4_unicode_ci);
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-#
-# Order of evaluation:
-#
-create table t1 (a int default 1, b int default (rand()*0+2), c int);
-insert t1 (c) values (a);
-insert t1 (c) values (b);
-select * from t1;
-drop table t1;
-
-#
-# ALTER ... SET DEFAULT
-#
-create table t1 (a int default 1, b int default (1+1), c int);
-show create table t1;
-alter table t1 alter a set default (2+3), alter b set default 4,
- alter c set default (-a);
---error ER_PARSE_ERROR
-alter table t1 alter a set default 1+2;
-show create table t1;
-drop table t1;
-
-#
-# CREATE ... SELECT
-#
-create table t1 (a int default 5 check (a>10), b int default (5+5), c int as (a+b));
-create table t2 as select a, b, c from t1;
-create table t3 as select max(a), max(b), max(c) from t1;
-show create table t2;
-show create table t3;
-drop table t1, t2, t3;
-
---echo # MDEV-11359: Implement IGNORE for bulk operation
-create table t1 (a int primary key default 0, b int default 3);
-insert into t1 values (1, ignore);
-insert into t1 values (2, ignore);
-replace into t1 values (2, ignore);
-replace into t1 values (3, ignore);
-replace into t1 values (4, 6);
-replace into t1 values (5, 7);
-update t1 set a=6,b=ignore where a=5;
-insert into t1 values (ignore, ignore);
---error ER_DUP_ENTRY
-insert into t1 values (ignore, ignore);
-select * from t1 order by a;
-delete from t1 where a < 4;
---echo # actually insert default instead of ignoring
---echo # (but REPLACE is non standard operator)
-replace into t1 values (4, ignore);
-select * from t1 order by a;
-drop table t1;
-
-#using in load
-create table t1 (a int default 100, b int, c varchar(60) default 'x');
-load data infile '../../std_data/rpl_loaddata.dat' into table t1 (a, @b) set b=@b+10, c=ignore;
-select * from t1;
-drop table t1;
-
-#using in duplicate
-CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT);
-CREATE TABLE t2 (a INT);
-INSERT INTO t2 VALUES (1),(2),(3),(2);
-INSERT INTO t1 SELECT a FROM t2 ON DUPLICATE KEY UPDATE a=DEFAULT;
-SELECT * FROM t1 order by a;
-truncate table t1;
-# efectively it is DEFALT
-INSERT INTO t1 SELECT a FROM t2 ON DUPLICATE KEY UPDATE a=IGNORE;
-SELECT * FROM t1 order by a;
-DROP TABLE t1,t2;
-
-create table t1 (a int primary key default 0, b int default 3);
-prepare insstmt from "insert into t1 values (?, ?)";
-prepare repstmt from "replace into t1 values (?, ?)";
-prepare updstmt from "update t1 set a=6,b=? where a=5";
-execute insstmt using 1, ignore;
-execute insstmt using 2, ignore;
-execute repstmt using 2, ignore;
-execute repstmt using 3, ignore;
-execute repstmt using 4, 6;
-execute repstmt using 5, 7;
-execute updstmt using ignore;
-execute insstmt using ignore, ignore;
---error ER_DUP_ENTRY
-execute insstmt using ignore, ignore;
-select * from t1 order by a;
-delete from t1 where a < 4;
-execute repstmt using 4, ignore;
-select * from t1 order by a;
-drop table t1;
-
---echo #
---echo # DEVAULT & PS adoption
---echo #
-
-
-# Correct usage
-CREATE TABLE t1 (a INT DEFAULT 10, b INT DEFAULT NULL);
-EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?,?)' USING IGNORE, IGNORE;
-SELECT * FROM t1;
-UPDATE t1 SET a=20, b=30;
-SELECT * FROM t1;
-EXECUTE IMMEDIATE 'UPDATE t1 SET a=?,b=?' USING IGNORE, IGNORE;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-# Incorrect usage in a expression in INSERT..VALUES
-CREATE TABLE t1 (a INT DEFAULT 10);
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?+1)' USING IGNORE;
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (CONCAT(?,?))' USING IGNORE, 'test';
-DROP TABLE t1;
-
-# Incorrect usage in UPDATE..SET
-CREATE TABLE t1 (a INT DEFAULT 10);
-INSERT INTO t1 VALUES (20);
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'UPDATE t1 SET a=?+1' USING IGNORE;
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'UPDATE t1 SET a=CONCAT(?,?)' USING IGNORE, 'test';
-DROP TABLE t1;
-
-
-# Incorrect usage in not an UPDATE/INSERT query at all
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'SELECT CAST(? AS SIGNED)' USING IGNORE;
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'SELECT CAST(? AS DOUBLE)' USING IGNORE;
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'SELECT CAST(? AS CHAR)' USING IGNORE;
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'SELECT CAST(? AS DECIMAL(10,1))' USING IGNORE;
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'SELECT CAST(? AS TIME)' USING IGNORE;
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'SELECT CAST(? AS DATE)' USING IGNORE;
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'SELECT CAST(? AS DATETIME)' USING IGNORE;
-
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'SELECT ?+1' USING IGNORE;
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'SELECT CONCAT(?,?)' USING IGNORE,'test';
-
-
-# Incorrect usage in the LIMIT clause
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'SELECT 1 LIMIT ?' USING IGNORE;
-CREATE TABLE t1 (a INT DEFAULT 10);
-INSERT INTO t1 VALUES (1),(2),(3);
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'SELECT * FROM t1 LIMIT ?' USING IGNORE;
-DROP TABLE t1;
-
-
---echo # The output of this query in 'Note' is a syntactically incorrect query.
---echo # But as it's never logged, it's ok. It should be human readable only.
-EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT ?' USING IGNORE;
-
-
-# This tests Item_param::eq() for IGNORE as a bound value
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1),(2),(3);
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE ?+a<=>?+a' USING DEFAULT,DEFAULT;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-11134 Assertion `fixed' failed in Item::const_charset_converter(THD*, CHARSET_INFO*, bool, const char*)
---echo #
-
-SET NAMES utf8;
-PREPARE stmt FROM "CREATE OR REPLACE TABLE t1 (c CHAR(8) DEFAULT ?)";
-SET @a='';
-EXECUTE stmt USING @a;
-EXECUTE stmt USING @a;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-SET @a='A';
-EXECUTE stmt USING @a;
-EXECUTE stmt USING @a;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-SET @a=_utf8 0xC380; # LATIN CAPITAL LETTER A WITH GRAVE
-EXECUTE stmt USING @a;
-EXECUTE stmt USING @a;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-SET @a=_utf8 0xD18F; # Cyrillic letter into a latin1 column
---error ER_INVALID_DEFAULT
-EXECUTE stmt USING @a;
---error ER_INVALID_DEFAULT
-EXECUTE stmt USING @a;
-DEALLOCATE PREPARE stmt;
-
-#
-# ANSI_QUOTES
-#
-set sql_mode=ansi_quotes;
-create table t1 (a int, b int default (a+1));
-show create table t1;
-insert t1 (a) values (10);
-set sql_mode='';
-show create table t1;
-insert t1 (a) values (20);
-flush tables;
-show create table t1;
-insert t1 (a) values (30);
-select * from t1;
-drop table t1;
-set sql_mode=default;
-
-#
-# MDEV-10201 Bad results for CREATE TABLE t1 (a INT DEFAULT b, b INT DEFAULT 4)
-#
-create table t1 (a int default b, b int default 4, t text);
-insert into t1 (b, t) values (5, '1 column is omitted');
-insert into t1 values (default, 5, '2 column gets DEFAULT, keyword');
-insert into t1 values (default(a), 5, '3 column gets DEFAULT(a), expression');
-insert into t1 values (default(a)+0, 5, '4 also expression DEFAULT(0)+0');
-insert into t1 values (b, 5, '5 the value of the DEFAULT(a), that is b');
-select * from t1 order by t;
-drop table t1;
-
-#
-# MDEV-10352 Server crashes in Field::set_default on CREATE TABLE
-#
---error ER_EXPRESSION_REFERS_TO_UNINIT_FIELD
-create table t1 (col1 int default(-(default(col1))));
-
-#
-# MDEV-10354 Assertion `! is_set()' failed in Diagnostics_area::set_ok_status on CREATE TABLE with invalid default
-#
---error ER_DATA_OUT_OF_RANGE
-create table t1 (col int default (yearweek((exp(710)))));
-
---echo #
---echo # MDEV-13707 Server in ORACLE mode crashes on ALTER with wrong DEFAULT clause
---echo #
-
-CREATE OR REPLACE TABLE t1(i int);
---error ER_BAD_FIELD_ERROR
-ALTER TABLE t1 ADD b CHAR(255) DEFAULT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`;
-DROP TABLE t1;
-
-
---echo # end of 10.2 test
diff --git a/mysql-test/t/default_debug.test b/mysql-test/t/default_debug.test
deleted file mode 100644
index cdde26569ca..00000000000
--- a/mysql-test/t/default_debug.test
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# Race condition in DEFAULT() with expressions
-#
-
-source include/have_debug_sync.inc;
-
-create table t1 (a int, b int default (a+1));
-insert t1 values (1,10), (2,20), (3,30);
-connect (con1, localhost, root);
-select a,b,default(b) from t1;
-set debug_sync='after_Item_default_value_calculate WAIT_FOR go';
-send select a,b,default(b) from t1;
-connection default;
-let $wait_condition=select count(*) from information_schema.processlist where state like 'debug sync%';
-source include/wait_condition.inc;
-set debug_sync='ha_write_row_start SIGNAL go';
-insert t1 values (100,default(b));
-connection con1;
-reap;
-connection default;
-drop table t1;
-set debug_sync='RESET';
diff --git a/mysql-test/t/default_session.test b/mysql-test/t/default_session.test
deleted file mode 100644
index 7796354ffd4..00000000000
--- a/mysql-test/t/default_session.test
+++ /dev/null
@@ -1,82 +0,0 @@
-#
-# DEFAULT clause with functions that depend on the current session state
-#
-
-source include/not_embedded.inc;
-
-create database mysqltest1;
-
-create user ''@localhost;
-create user foo@localhost;
-create role bar;
-grant select on *.* to ''@localhost;
-grant select,insert on *.* to foo@localhost;
-grant select,insert on *.* to bar;
-grant bar to ''@localhost;
-
-create table t1 (n varchar(100),
- u varchar(100) default user(),
- cu varchar(100) default current_user(),
- cr varchar(100) default current_role(),
- d varchar(100) default database());
-
-create definer=foo@localhost view mysqltest1.v1 as select * from t1;
-create definer=bar view v2 as select * from t1;
-create view v3 as select * from v2;
-
-create definer=foo@localhost view mysqltest1.v4 as select default(n),default(u),default(cu),default(cr), default(d) from t1;
-create definer=bar view v5 as select default(n),default(u),default(cu),default(cr), default(d) from t1;
-create view v6 as select * from v5;
-
-insert t1 (n) values ('t1');
-insert mysqltest1.v1 (n) values ('v1');
-insert v2 (n) values ('v2');
-insert v3 (n) values ('v3');
-
-select default(n),default(u),default(cu),default(cr), default(d) from t1 limit 1;
-select * from mysqltest1.v4 limit 1;
-select * from v5 limit 1;
-select * from v6 limit 1;
-
-connect (conn,localhost,conn,,mysqltest1);
-set role bar;
-insert test.t1 (n) values ('t1');
-insert v1 (n) values ('v1');
-insert test.v2 (n) values ('v2');
-insert test.v3 (n) values ('v3');
-
-select default(n),default(u),default(cu),default(cr), default(d) from test.t1 limit 1;
-select * from v4 limit 1;
-select * from test.v5 limit 1;
-select * from test.v6 limit 1;
-connection default;
-disconnect conn;
-
-select * from t1;
-drop database mysqltest1;
-drop view v2, v3, v5, v6;
-drop table t1;
-drop user ''@localhost;
-drop user foo@localhost;
-drop role bar;
-
-create table t1 (a date,
- mn varchar(100) default monthname(a),
- dn varchar(100) default dayname(a),
- df varchar(100) default date_format(a, "%a, %b"));
-
-insert t1 (a) values ('2010-12-2');
-set lc_time_names=de_DE;
-insert t1 (a) values ('2010-12-2');
-set lc_time_names=default;
-
-select * from t1;
-drop table t1;
-
-create table t1 (a varchar(100) default @@sql_mode);
-insert t1 () values ();
-set sql_mode=ansi;
-insert t1 () values ();
-set sql_mode=default;
-select * from t1;
-drop table t1;
diff --git a/mysql-test/t/default_storage_engine.test b/mysql-test/t/default_storage_engine.test
deleted file mode 100644
index dd6f4728f47..00000000000
--- a/mysql-test/t/default_storage_engine.test
+++ /dev/null
@@ -1,16 +0,0 @@
-if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME = 'innodb' AND PLUGIN_LIBRARY IS NULL`)
-{
- --skip Requires built-in InnoDB.
-}
-
-let $cmd=`select replace("$MYSQLD_BOOTSTRAP_CMD --skip-innodb", " --default-storage-engine=myisam", "")`;
-
-#
-# Now it *must* fail, because if InnoDB is compiled in, it is used as a default
-# storage engine. but $cmd includes --skip-innodb
-#
-error 1;
-exec $cmd;
-
-echo "all ok"; # to not have zero-length result file
-
diff --git a/mysql-test/t/delayed.test b/mysql-test/t/delayed.test
deleted file mode 100644
index dea16c84a51..00000000000
--- a/mysql-test/t/delayed.test
+++ /dev/null
@@ -1,644 +0,0 @@
-# delayed works differently in embedded server
---source include/not_embedded.inc
-# Don't test this under valgrind, memory leaks will occur
---source include/not_valgrind.inc
-# Avoid CrashReporter popup on Mac
---source include/not_crashrep.inc
-# Binary must be compiled with debug for crash to occur
---source include/have_debug_sync.inc
-
-#
-# test of DELAYED insert and timestamps
-# (Can't be tested with purify :( )
-#
-
-# limit the test to engines which support INSERT DELAYED
-disable_query_log;
---require r/true.require
-select @@global.storage_engine in
-("memory","myisam","archive","blackhole") and
-@@session.storage_engine in
-("memory","myisam","archive","blackhole") as `TRUE`;
-enable_query_log;
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a char(10), tmsp timestamp);
-insert into t1 set a = 1;
-insert delayed into t1 set a = 2;
-insert into t1 set a = 3, tmsp=NULL;
-insert delayed into t1 set a = 4;
-insert delayed into t1 set a = 5, tmsp = 19711006010203;
-insert delayed into t1 (a, tmsp) values (6, 19711006010203);
-insert delayed into t1 (a, tmsp) values (7, NULL);
-# Wait until the rows are flushed to the table files.
-FLUSH TABLE t1;
-insert into t1 set a = 8,tmsp=19711006010203;
-select * from t1 where tmsp=0;
-select * from t1 where tmsp=19711006010203;
-drop table t1;
-
-#
-# Test bug when inserting NULL into an auto_increment field with
-# INSERT DELAYED
-#
-
-create table t1 (a int not null auto_increment primary key, b char(10));
-insert delayed into t1 values (1,"b");
-insert delayed into t1 values (null,"c");
-insert delayed into t1 values (3,"d"),(null,"e");
---error 1136
-insert delayed into t1 values (3,"this will give an","error");
-# Wait until the rows are flushed to the table files.
-FLUSH TABLE t1;
-show status like 'not_flushed_delayed_rows';
-select * from t1;
-drop table t1;
-
-# End of 4.1 tests
-
-#
-# Bug #12226: Crash when a delayed insert fails due to a duplicate key
-#
-create table t1 (a int not null primary key);
-insert into t1 values (1);
-insert delayed into t1 values (1);
-select * from t1;
-drop table t1;
-
-#
-# Bug #20195: INSERT DELAYED with auto_increment is assigned wrong values
-#
-CREATE TABLE t1 ( a int(10) NOT NULL auto_increment, PRIMARY KEY (a));
-
-# Make one delayed insert to start the separate thread
-insert delayed into t1 values(null);
-
-# Do some normal inserts
-insert into t1 values(null);
-insert into t1 values(null);
-
-# Discarded, since the delayed-counter is 2, which is already used
-insert delayed into t1 values(null);
-
-# Discarded, since the delayed-counter is 3, which is already used
-insert delayed into t1 values(null);
-
-# Works, since the delayed-counter is 4, which is unused
-insert delayed into t1 values(null);
-
-# Do some more inserts
-insert into t1 values(null);
-insert into t1 values(null);
-insert into t1 values(null);
-
-# Delete one of the above to make a hole
-delete from t1 where a=6;
-
-# Discarded, since the delayed-counter is 5, which is already used
-insert delayed into t1 values(null);
-
-# Works, since the delayed-counter is 6, which is unused (the row we deleted)
-insert delayed into t1 values(null);
-
-# Discarded, since the delayed-counter is 7, which is already used
-insert delayed into t1 values(null);
-
-# Works, since the delayed-counter is 8, which is unused
-insert delayed into t1 values(null);
-
-# Wait until the rows are flushed to the table files.
-FLUSH TABLE t1;
-# Check what we have now
-select * from t1 order by a;
-
-DROP TABLE t1;
-
-#
-# Bug#20627 - INSERT DELAYED does not honour auto_increment_* variables
-#
-SET @bug20627_old_auto_increment_offset=
- @@auto_increment_offset;
-SET @bug20627_old_auto_increment_increment=
- @@auto_increment_increment;
-SET @bug20627_old_session_auto_increment_offset=
- @@session.auto_increment_offset;
-SET @bug20627_old_session_auto_increment_increment=
- @@session.auto_increment_increment;
-SET @@auto_increment_offset= 2;
-SET @@auto_increment_increment= 3;
-SET @@session.auto_increment_offset= 4;
-SET @@session.auto_increment_increment= 5;
-#
-# Normal insert as reference.
-CREATE TABLE t1 (
- c1 INT NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (c1)
- );
-INSERT INTO t1 VALUES (NULL),(NULL),(NULL);
-# Check what we have now
-SELECT * FROM t1;
-DROP TABLE t1;
-#
-# Delayed insert.
-CREATE TABLE t1 (
- c1 INT NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (c1)
- );
-INSERT DELAYED INTO t1 VALUES (NULL),(NULL),(NULL);
-# Wait until the rows are flushed to the table files.
-FLUSH TABLE t1;
-# Check what we have now
-SELECT * FROM t1;
-DROP TABLE t1;
-#
-# Cleanup
-SET @@auto_increment_offset=
- @bug20627_old_auto_increment_offset;
-SET @@auto_increment_increment=
- @bug20627_old_auto_increment_increment;
-SET @@session.auto_increment_offset=
- @bug20627_old_session_auto_increment_offset;
-SET @@session.auto_increment_increment=
- @bug20627_old_session_auto_increment_increment;
-
-#
-# Bug#20830 - INSERT DELAYED does not honour SET INSERT_ID
-#
-SET @bug20830_old_auto_increment_offset=
- @@auto_increment_offset;
-SET @bug20830_old_auto_increment_increment=
- @@auto_increment_increment;
-SET @bug20830_old_session_auto_increment_offset=
- @@session.auto_increment_offset;
-SET @bug20830_old_session_auto_increment_increment=
- @@session.auto_increment_increment;
-SET @@auto_increment_offset= 2;
-SET @@auto_increment_increment= 3;
-SET @@session.auto_increment_offset= 4;
-SET @@session.auto_increment_increment= 5;
-#
-# Normal insert as reference.
-CREATE TABLE t1 (
- c1 INT(11) NOT NULL AUTO_INCREMENT,
- c2 INT(11) DEFAULT NULL,
- PRIMARY KEY (c1)
- );
-SET insert_id= 14;
-INSERT INTO t1 VALUES(NULL, 11), (NULL, 12), (NULL, 13);
-INSERT INTO t1 VALUES(NULL, 21), (NULL, 22), (NULL, 23);
-# Restart sequence at a different value.
-INSERT INTO t1 VALUES( 69, 31), (NULL, 32), (NULL, 33);
-INSERT INTO t1 VALUES(NULL, 41), (NULL, 42), (NULL, 43);
-# Restart sequence at a different value.
-SET insert_id= 114;
-INSERT INTO t1 VALUES(NULL, 51), (NULL, 52), (NULL, 53);
-INSERT INTO t1 VALUES(NULL, 61), (NULL, 62), (NULL, 63);
-# Set one value below the maximum value.
-INSERT INTO t1 VALUES( 49, 71), (NULL, 72), (NULL, 73);
-INSERT INTO t1 VALUES(NULL, 81), (NULL, 82), (NULL, 83);
-# Create a duplicate value.
-SET insert_id= 114;
---error ER_DUP_ENTRY
-INSERT INTO t1 VALUES(NULL, 91);
-INSERT INTO t1 VALUES (NULL, 92), (NULL, 93);
-# Check what we have now
-SELECT * FROM t1;
-SELECT COUNT(*) FROM t1;
-SELECT SUM(c1) FROM t1;
-DROP TABLE t1;
-#
-# Delayed insert.
-CREATE TABLE t1 (
- c1 INT(11) NOT NULL AUTO_INCREMENT,
- c2 INT(11) DEFAULT NULL,
- PRIMARY KEY (c1)
- );
-SET insert_id= 14;
-INSERT DELAYED INTO t1 VALUES(NULL, 11), (NULL, 12), (NULL, 13);
-INSERT DELAYED INTO t1 VALUES(NULL, 21), (NULL, 22), (NULL, 23);
-# Restart sequence at a different value.
-INSERT DELAYED INTO t1 VALUES( 69, 31), (NULL, 32), (NULL, 33);
-INSERT DELAYED INTO t1 VALUES(NULL, 41), (NULL, 42), (NULL, 43);
-# Restart sequence at a different value.
-SET insert_id= 114;
-INSERT DELAYED INTO t1 VALUES(NULL, 51), (NULL, 52), (NULL, 53);
-INSERT DELAYED INTO t1 VALUES(NULL, 61), (NULL, 62), (NULL, 63);
-# Set one value below the maximum value.
-INSERT DELAYED INTO t1 VALUES( 49, 71), (NULL, 72), (NULL, 73);
-INSERT DELAYED INTO t1 VALUES(NULL, 81), (NULL, 82), (NULL, 83);
-# Create a duplicate value.
-SET insert_id= 114;
-INSERT DELAYED INTO t1 VALUES(NULL, 91);
-INSERT DELAYED INTO t1 VALUES (NULL, 92), (NULL, 93);
-# Wait until the rows are flushed to the table files.
-FLUSH TABLE t1;
-# Check what we have now
-SELECT * FROM t1;
-SELECT COUNT(*) FROM t1;
-SELECT SUM(c1) FROM t1;
-DROP TABLE t1;
-#
-# Cleanup
-SET @@auto_increment_offset=
- @bug20830_old_auto_increment_offset;
-SET @@auto_increment_increment=
- @bug20830_old_auto_increment_increment;
-SET @@session.auto_increment_offset=
- @bug20830_old_session_auto_increment_offset;
-SET @@session.auto_increment_increment=
- @bug20830_old_session_auto_increment_increment;
-
-#
-# BUG#26238 - inserted delayed always inserts 0 for BIT columns
-#
-CREATE TABLE t1(a BIT);
-INSERT DELAYED INTO t1 VALUES(1);
-FLUSH TABLE t1;
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
-#
-# Bug #32676: insert delayed crash with wrong column and function specified
-#
-CREATE TABLE t1 (a INT);
---error ER_SP_DOES_NOT_EXIST
-INSERT DELAYED INTO t1 SET a= b();
---error ER_BAD_FIELD_ERROR
-INSERT DELAYED INTO t1 SET b= 1;
---error ER_SP_DOES_NOT_EXIST
-INSERT DELAYED INTO t1 SET b= b();
-DROP TABLE t1;
-
---echo End of 5.0 tests
-
-#
-# Bug#27358 INSERT DELAYED does not honour SQL_MODE of the client
-#
---disable_warnings
-DROP TABLE IF EXISTS t1,t2;
---enable_warnings
-SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO';
-CREATE TABLE `t1` (
- `id` int(11) PRIMARY KEY auto_increment,
- `f1` varchar(10) NOT NULL UNIQUE
-);
-INSERT DELAYED INTO t1 VALUES(0,"test1");
-sleep 1;
-SELECT * FROM t1;
-SET SQL_MODE='PIPES_AS_CONCAT';
-INSERT DELAYED INTO t1 VALUES(0,'a' || 'b');
-sleep 1;
-SELECT * FROM t1;
-SET SQL_MODE='ERROR_FOR_DIVISION_BY_ZERO,STRICT_ALL_TABLES';
---error 1365
-INSERT DELAYED INTO t1 VALUES(mod(1,0),"test3");
-CREATE TABLE t2 (
- `id` int(11) PRIMARY KEY auto_increment,
- `f1` date
-);
-SET SQL_MODE='NO_ZERO_DATE,STRICT_ALL_TABLES,NO_ZERO_IN_DATE';
---error ER_TRUNCATED_WRONG_VALUE
-INSERT DELAYED INTO t2 VALUES (0,'0000-00-00');
---error ER_TRUNCATED_WRONG_VALUE
-INSERT DELAYED INTO t2 VALUES (0,'2007-00-00');
-DROP TABLE t1,t2;
-
-#
-# Bug#40536: SELECT is blocked by INSERT DELAYED waiting on upgrading lock,
-# even with low_priority_updates
-#
-
-set @old_delayed_updates = @@global.low_priority_updates;
-set global low_priority_updates = 1;
-select @@global.low_priority_updates;
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a int, b int);
-insert into t1 values (1,1);
-lock table t1 read;
-connect (update,localhost,root,,);
-connection update;
---send insert delayed into t1 values (2,2);
-connection default;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where command = "Delayed insert" and state = "Waiting for table level lock";
---source include/wait_condition.inc
-connect (select,localhost,root,,);
-select * from t1;
-connection default;
-select * from t1;
-connection default;
-disconnect update;
-disconnect select;
-unlock tables;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where command = "Delayed insert" and state = "Waiting for INSERT";
---source include/wait_condition.inc
-select * from t1;
-drop table t1;
-
-set global low_priority_updates = @old_delayed_updates;
-
-
---echo #
---echo # Bug #47682 strange behaviour of INSERT DELAYED
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-CREATE TABLE t1 (f1 integer);
-CREATE TABLE t2 (f1 integer);
-
-FLUSH TABLES WITH READ LOCK;
-LOCK TABLES t1 READ;
-
-# ER_CANT_UPDATE_WITH_READLOCK with normal execution
-# ER_TABLE_NOT_LOCKED when executed as prepared statement
---error ER_CANT_UPDATE_WITH_READLOCK, ER_TABLE_NOT_LOCKED
-INSERT DELAYED INTO t2 VALUES (1);
-
-UNLOCK TABLES;
-DROP TABLE t1, t2;
-
-
---echo End of 5.1 tests
-
-
-
---echo #
---echo # Bug #47274 assert in open_table on CREATE TABLE <already existing>
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS t2;
---enable_warnings
-
-CREATE TABLE t1 ( f1 INTEGER AUTO_INCREMENT, PRIMARY KEY (f1));
-
---echo # The following CREATE TABLEs before gave an assert.
-
-INSERT DELAYED t1 VALUES (4);
---error ER_TABLE_EXISTS_ERROR
-CREATE TABLE t1 AS SELECT 1 AS f1;
-
-REPLACE DELAYED t1 VALUES (5);
---error ER_TABLE_EXISTS_ERROR
-CREATE TABLE t1 AS SELECT 1 AS f1;
-
-INSERT DELAYED t1 VALUES (6);
---error ER_TABLE_EXISTS_ERROR
-CREATE TABLE t1 (f1 INTEGER);
-
-CREATE TABLE t2 (f1 INTEGER);
-INSERT DELAYED t1 VALUES (7);
---error ER_TABLE_EXISTS_ERROR
-CREATE TABLE t1 LIKE t2;
-
-DROP TABLE t2;
-DROP TABLE t1;
-
-
---echo #
---echo # Bug#54332 Deadlock with two connections doing LOCK TABLE+INSERT DELAYED
---echo #
-
---echo # This test is not supposed to work under --ps-protocol since
---echo # INSERT DELAYED doesn't work under LOCK TABLES with this protocol.
---disable_ps_protocol
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (a INT);
-CREATE TABLE t3 (a INT);
-
---echo # Test 1: Using LOCK TABLE
-
-connect (con1, localhost, root);
-LOCK TABLE t1 WRITE;
-
-connection default;
-LOCK TABLE t2 WRITE;
---echo # Sending:
---send INSERT DELAYED INTO t1 VALUES (1)
-
-connection con1;
---echo # Wait until INSERT DELAYED is blocked on table 't1'.
-let $wait_condition=
- SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for table metadata lock"
- AND info = "INSERT DELAYED INTO t1 VALUES (1)";
---source include/wait_condition.inc
---error ER_LOCK_DEADLOCK
-INSERT DELAYED INTO t2 VALUES (1);
-UNLOCK TABLES;
-
-connection default;
---echo # Reaping: INSERT DELAYED INTO t1 VALUES (1)
---reap
-UNLOCK TABLES;
-
---echo # Test 2: Using ALTER TABLE
-
-START TRANSACTION;
-SELECT * FROM t1 WHERE a=0;
-
-connection con1;
---echo # Sending:
---send ALTER TABLE t1 MODIFY a INT UNSIGNED;
-
-connection default;
---echo # Wait until ALTER TABLE is blocked on table 't1'.
-let $wait_condition=
- SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for table metadata lock"
- AND info LIKE "ALTER TABLE t1%";
---source include/wait_condition.inc
---error ER_LOCK_DEADLOCK
-INSERT DELAYED INTO t1 VALUES (3);
-COMMIT;
-
-connection con1;
---echo # Reaping: ALTER TABLE t1 COMMENT 'test'
---reap
-
---echo # Test 3: Using RENAME TABLE
-
-connection default;
-START TRANSACTION;
-INSERT INTO t2 VALUES (1);
-
-connection con1;
---echo # Sending:
---send RENAME TABLE t1 to t5, t2 to t4
-
-connection default;
---echo # Wait until RENAME TABLE is blocked on table 't1'.
-let $wait_condition=
- SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for table metadata lock"
- AND info = "RENAME TABLE t1 to t5, t2 to t4";
---source include/wait_condition.inc
---error ER_LOCK_DEADLOCK
-INSERT DELAYED INTO t1 VALUES (4);
-COMMIT;
-
-connection con1;
---echo # Reaping: RENAME TABLE t1 to t5, t2 to t4
---reap
-
-connection default;
---echo # Reverting the renames
-RENAME TABLE t5 to t1, t4 to t2;
-
---echo # Test 4: Two INSERT DELAYED on the same table
-
-START TRANSACTION;
-INSERT INTO t2 VALUES (1);
-
-connect (con2, localhost, root);
---send LOCK TABLE t1 WRITE, t2 WRITE
-
-connection con1;
---echo # Wait until LOCK TABLE is blocked on table 't2'.
-let $wait_condition=
- SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for table metadata lock"
- AND info = "LOCK TABLE t1 WRITE, t2 WRITE";
---source include/wait_condition.inc
---send INSERT DELAYED INTO t1 VALUES (5)
-
-connection default;
---echo # Wait until INSERT DELAYED is blocked on table 't1'.
-let $wait_condition=
- SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for table metadata lock"
- AND info = "INSERT DELAYED INTO t1 VALUES (5)";
---source include/wait_condition.inc
---error ER_LOCK_DEADLOCK
-INSERT DELAYED INTO t1 VALUES (6);
-COMMIT;
-
-connection con2;
---echo # Reaping: LOCK TABLE t1 WRITE, t2 WRITE
---reap
-UNLOCK TABLES;
-
-connection con1;
---echo # Reaping: INSERT DELAYED INTO t1 VALUES (5)
---reap
-
-connection default;
-
---echo # Test 5: LOCK TABLES + INSERT DELAYED in one connection.
---echo # This test has triggered some asserts in metadata locking
---echo # subsystem at some point in time..
-LOCK TABLE t1 WRITE;
-INSERT DELAYED INTO t2 VALUES (7);
-UNLOCK TABLES;
-SET AUTOCOMMIT= 0;
-LOCK TABLE t1 WRITE;
-INSERT DELAYED INTO t2 VALUES (8);
-UNLOCK TABLES;
-SET AUTOCOMMIT= 1;
-
-connection con2;
-disconnect con2;
---source include/wait_until_disconnected.inc
-connection con1;
-disconnect con1;
---source include/wait_until_disconnected.inc
-
-connection default;
-DROP TABLE t1, t2, t3;
---enable_ps_protocol
-
-
---echo #
---echo # Test for bug #56251 "Deadlock with INSERT DELAYED and MERGE tables".
---echo #
-connect (con1,localhost,root,,);
-connection default;
---disable_warnings
-drop table if exists t1, t2, tm;
---enable_warnings
-create table t1(a int);
-create table t2(a int);
-create table tm(a int) engine=merge union=(t1, t2);
-begin;
-select * from t1;
-
-connection con1;
---echo # Sending:
---send alter table t1 comment 'test'
-
-connection default;
---echo # Wait until ALTER TABLE blocks and starts waiting
---echo # for connection 'default'. It should wait with a
---echo # pending SNW lock on 't1'.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "alter table t1 comment 'test'";
---source include/wait_condition.inc
---echo # Attempt to perform delayed insert into 'tm' should not lead
---echo # to a deadlock. Instead error ER_DELAYED_NOT_SUPPORTED should
---echo # be emitted.
---error ER_DELAYED_NOT_SUPPORTED
-insert delayed into tm values (1);
---echo # Unblock ALTER TABLE.
-commit;
-
-connection con1;
---echo # Reaping ALTER TABLE:
---reap
-
-disconnect con1;
---source include/wait_until_disconnected.inc
-connection default;
-drop tables tm, t1, t2;
-
---echo #
---echo # MDEV-9621 INSERT DELAYED fails on insert for tables with many columns
---echo #
-
-CREATE TABLE t1 (
- a int,b int,c int,d int,e int,f int,g int,h int,i int,j int,k int,l int,m int,n int,o int,p int,q int,r int,s int,t int,u int,v int,x int,y int,z int
-) ENGINE=MyISAM;
-
-INSERT DELAYED INTO t1 (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,x,y,z)
-values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
-INSERT DELAYED INTO t1 (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,x,y,z)
-values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
-drop table t1;
-
---echo #
---echo # INSERT DELAYED hangs if table was crashed
---echo #
-
-create table t1 (a int, b int) engine=myisam;
-insert into t1 values (1,1);
-
-# Will come back with t1 crashed.
---source include/crash_mysqld.inc
-
-call mtr.add_suppression(" marked as crashed and should be repaired");
-call mtr.add_suppression("Checking table");
-
---replace_result '\\' '/'
-insert delayed into t1 values (2,2);
-insert delayed into t1 values (3,3);
-flush tables t1;
-select * from t1;
-drop table t1;
diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test
deleted file mode 100644
index c82420640c2..00000000000
--- a/mysql-test/t/delete.test
+++ /dev/null
@@ -1,584 +0,0 @@
-#
-# Check for problems with delete
-#
-
-call mtr.add_suppression("Sort aborted.*");
-
---disable_warnings
-drop table if exists t1,t2,t3,t11,t12;
---enable_warnings
-CREATE TABLE t1 (a tinyint(3), b tinyint(5));
-INSERT INTO t1 VALUES (1,1);
-INSERT LOW_PRIORITY INTO t1 VALUES (1,2);
-INSERT INTO t1 VALUES (1,3);
-DELETE from t1 where a=1 limit 1;
-DELETE LOW_PRIORITY from t1 where a=1;
-
-INSERT INTO t1 VALUES (1,1);
-DELETE from t1;
-LOCK TABLE t1 write;
-INSERT INTO t1 VALUES (1,2);
-DELETE from t1;
-UNLOCK TABLES;
-INSERT INTO t1 VALUES (1,2);
-SET AUTOCOMMIT=0;
-DELETE from t1;
-SET AUTOCOMMIT=1;
-drop table t1;
-
-#
-# Test of delete when the delete will cause a node to disappear and reappear
-# (This assumes a block size of 1024)
-#
-
-create table t1 (
- a bigint not null,
- b bigint not null default 0,
- c bigint not null default 0,
- d bigint not null default 0,
- e bigint not null default 0,
- f bigint not null default 0,
- g bigint not null default 0,
- h bigint not null default 0,
- i bigint not null default 0,
- j bigint not null default 0,
- primary key (a,b,c,d,e,f,g,h,i,j));
-insert into t1 (a) values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23);
-delete from t1 where a=26;
-drop table t1;
-create table t1 (
- a bigint not null,
- b bigint not null default 0,
- c bigint not null default 0,
- d bigint not null default 0,
- e bigint not null default 0,
- f bigint not null default 0,
- g bigint not null default 0,
- h bigint not null default 0,
- i bigint not null default 0,
- j bigint not null default 0,
- primary key (a,b,c,d,e,f,g,h,i,j));
-insert into t1 (a) values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
-delete from t1 where a=27;
-drop table t1;
-
-CREATE TABLE `t1` (
- `i` int(10) NOT NULL default '0',
- `i2` int(10) NOT NULL default '0',
- PRIMARY KEY (`i`)
-);
--- error 1054
-DELETE FROM t1 USING t1 WHERE post='1';
-drop table t1;
-
-#
-# CHAR(0) bug - not actually DELETE bug, but anyway...
-#
-
-CREATE TABLE t1 (
- bool char(0) default NULL,
- not_null varchar(20) binary NOT NULL default '',
- misc integer not null,
- PRIMARY KEY (not_null)
-) ENGINE=MyISAM;
-
-INSERT INTO t1 VALUES (NULL,'a',4), (NULL,'b',5), (NULL,'c',6), (NULL,'d',7);
-
-select * from t1 where misc > 5 and bool is null;
-delete from t1 where misc > 5 and bool is null;
-select * from t1 where misc > 5 and bool is null;
-
-select count(*) from t1;
-delete from t1 where 1 > 2;
-select count(*) from t1;
-delete from t1 where 3 > 2;
-select count(*) from t1;
-
-drop table t1;
-#
-# Bug #5733: Table handler error with self-join multi-table DELETE
-#
-
-create table t1 (a int not null auto_increment primary key, b char(32));
-insert into t1 (b) values ('apple'), ('apple');
-select * from t1;
-delete t1 from t1, t1 as t2 where t1.b = t2.b and t1.a > t2.a;
-select * from t1;
-drop table t1;
-
-#
-# IGNORE option
-#
-create table t11 (a int NOT NULL, b int, primary key (a));
-create table t12 (a int NOT NULL, b int, primary key (a));
-create table t2 (a int NOT NULL, b int, primary key (a));
-insert into t11 values (0, 10),(1, 11),(2, 12);
-insert into t12 values (33, 10),(0, 11),(2, 12);
-insert into t2 values (1, 21),(2, 12),(3, 23);
-select * from t11;
-select * from t12;
-select * from t2;
--- error 1242
-delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
-select * from t11;
-select * from t12;
-delete ignore t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
-select * from t11;
-select * from t12;
-insert into t11 values (2, 12);
--- error 1242
-delete from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
-select * from t11;
-delete ignore from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
-select * from t11;
-drop table t11, t12, t2;
-
-#
-# Bug #4198: deletion and KEYREAD
-#
-
-create table t1 (a int, b int, unique key (a), key (b));
-insert into t1 values (3, 3), (7, 7);
-delete t1 from t1 where a = 3;
-check table t1;
-select * from t1;
-drop table t1;
-
-#
-# Bug #8392: delete with ORDER BY containing a direct reference to the table
-#
-
-CREATE TABLE t1 ( a int PRIMARY KEY );
-DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a;
-INSERT INTO t1 VALUES (0),(1),(2);
-DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a LIMIT 1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-#
-# Bug #21392: multi-table delete with alias table name fails with
-# 1003: Incorrect table name
-#
-
-create table t1 (a int);
-delete `4.t1` from t1 as `4.t1` where `4.t1`.a = 5;
-delete FROM `4.t1` USING t1 as `4.t1` where `4.t1`.a = 5;
-drop table t1;
-
-#
-# Bug#17711: DELETE doesn't use index when ORDER BY, LIMIT and
-# non-restricting WHERE is present.
-#
-create table t1(f1 int primary key);
-insert into t1 values (4),(3),(1),(2);
-delete from t1 where (@a:= f1) order by f1 limit 1;
-select @a;
-drop table t1;
-
-# BUG#30385 "Server crash when deleting with order by and limit"
-CREATE TABLE t1 (
- `date` date ,
- `time` time ,
- `seq` int(10) unsigned NOT NULL auto_increment,
- PRIMARY KEY (`seq`),
- KEY `seq` (`seq`),
- KEY `time` (`time`),
- KEY `date` (`date`)
-);
-DELETE FROM t1 ORDER BY date ASC, time ASC LIMIT 1;
-drop table t1;
-
---echo End of 4.1 tests
-
-#
-# Test of multi-delete where we are not scanning the first table
-#
-
-CREATE TABLE t1 (a int not null,b int not null);
-CREATE TABLE t2 (a int not null, b int not null, primary key (a,b));
-CREATE TABLE t3 (a int not null, b int not null, primary key (a,b));
-insert into t1 values (1,1),(2,1),(1,3);
-insert into t2 values (1,1),(2,2),(3,3);
-insert into t3 values (1,1),(2,1),(1,3);
-select * from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
-explain select * from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
-delete t2.*,t3.* from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
-# This should be empty
-select * from t3;
-drop table t1,t2,t3;
-
-#
-# Bug #8143: deleting '0000-00-00' values using IS NULL
-#
-
-create table t1(a date not null);
-insert into t1 values (0);
-select * from t1 where a is null;
-delete from t1 where a is null;
-select count(*) from t1;
-drop table t1;
-
-#
-# Bug #26186: delete order by, sometimes accept unknown column
-#
-CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1);
-
---error ER_BAD_FIELD_ERROR
-DELETE FROM t1 ORDER BY x;
-
-# even columns from a table not used in query (and not even existing)
---error ER_BAD_FIELD_ERROR
-DELETE FROM t1 ORDER BY t2.x;
-
-# subquery (as long as the subquery from is valid or DUAL)
---error ER_BAD_FIELD_ERROR
-DELETE FROM t1 ORDER BY (SELECT x);
-
-DROP TABLE t1;
-
-#
-# Bug #30234: Unexpected behavior using DELETE with AS and USING
-# '
-CREATE TABLE t1 (
- a INT
-);
-
-CREATE TABLE t2 (
- a INT
-);
-
-CREATE DATABASE db1;
-CREATE TABLE db1.t1 (
- a INT
-);
-INSERT INTO db1.t1 (a) SELECT * FROM t1;
-
-CREATE DATABASE db2;
-CREATE TABLE db2.t1 (
- a INT
-);
-INSERT INTO db2.t1 (a) SELECT * FROM t2;
-
---error ER_PARSE_ERROR
-DELETE FROM t1 alias USING t1, t2 alias WHERE t1.a = alias.a;
-DELETE FROM alias USING t1, t2 alias WHERE t1.a = alias.a;
-DELETE FROM t1, alias USING t1, t2 alias WHERE t1.a = alias.a;
---error ER_UNKNOWN_TABLE
-DELETE FROM t1, t2 USING t1, t2 alias WHERE t1.a = alias.a;
---error ER_PARSE_ERROR
-DELETE FROM db1.t1 alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a;
-DELETE FROM alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a;
---error ER_UNKNOWN_TABLE
-DELETE FROM db2.alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a;
-DELETE FROM t1 USING t1 WHERE a = 1;
-SELECT * FROM t1;
---error ER_PARSE_ERROR
-DELETE FROM t1 alias USING t1 alias WHERE a = 2;
-SELECT * FROM t1;
-
-DROP TABLE t1, t2;
-DROP DATABASE db1;
-DROP DATABASE db2;
-
-#
-# Bug 31742: delete from ... order by function call that causes an error,
-# asserts server
-#
-
-CREATE FUNCTION f1() RETURNS INT RETURN 1;
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (0);
---error 1318
-DELETE FROM t1 ORDER BY (f1(10)) LIMIT 1;
-DROP TABLE t1;
-DROP FUNCTION f1;
-
-
---echo #
---echo # Bug #49552 : sql_buffer_result cause crash + not found records
---echo # in multitable delete/subquery
---echo #
-
-CREATE TABLE t1(a INT);
-INSERT INTO t1 VALUES (1),(2),(3);
-SET SESSION SQL_BUFFER_RESULT=1;
-DELETE t1 FROM (SELECT SUM(a) a FROM t1) x,t1;
-
-SET SESSION SQL_BUFFER_RESULT=DEFAULT;
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo End of 5.0 tests
-
-#
-# Bug#27525: table not found when using multi-table-deletes with aliases over
-# several databas
-# Bug#21148: MULTI-DELETE fails to resolve a table by alias if it's from a
-# different database
-#
-
---disable_warnings
-DROP DATABASE IF EXISTS db1;
-DROP DATABASE IF EXISTS db2;
-DROP DATABASE IF EXISTS db3;
-DROP DATABASE IF EXISTS db4;
-DROP TABLE IF EXISTS t1, t2;
-DROP PROCEDURE IF EXISTS count;
---enable_warnings
-USE test;
-CREATE DATABASE db1;
-CREATE DATABASE db2;
-
-CREATE TABLE db1.t1 (a INT, b INT);
-INSERT INTO db1.t1 VALUES (1,1),(2,2),(3,3);
-CREATE TABLE db1.t2 AS SELECT * FROM db1.t1;
-CREATE TABLE db2.t1 AS SELECT * FROM db1.t2;
-CREATE TABLE db2.t2 AS SELECT * FROM db2.t1;
-CREATE TABLE t1 AS SELECT * FROM db2.t2;
-CREATE TABLE t2 AS SELECT * FROM t1;
-
-delimiter |;
-CREATE PROCEDURE count_rows()
-BEGIN
- SELECT COUNT(*) AS "COUNT(db1.t1)" FROM db1.t1;
- SELECT COUNT(*) AS "COUNT(db1.t2)" FROM db1.t2;
- SELECT COUNT(*) AS "COUNT(db2.t1)" FROM db2.t1;
- SELECT COUNT(*) AS "COUNT(db2.t2)" FROM db2.t2;
- SELECT COUNT(*) AS "COUNT(test.t1)" FROM test.t1;
- SELECT COUNT(*) AS "COUNT(test.t2)" FROM test.t2;
-END|
-delimiter ;|
-
-#
-# Testing without a selected database
-#
-
-CREATE DATABASE db3;
-USE db3;
-DROP DATABASE db3;
---error ER_NO_DB_ERROR
-SELECT * FROM t1;
-
-# Detect missing table references
-
---error ER_NO_DB_ERROR
-DELETE a1,a2 FROM db1.t1, db2.t2;
---error ER_NO_DB_ERROR
-DELETE a1,a2 FROM db1.t1, db2.t2;
---error ER_NO_DB_ERROR
-DELETE a1,a2 FROM db1.t1 AS a1, db2.t2;
---error ER_NO_DB_ERROR
-DELETE a1,a2 FROM db1.t1, db2.t2 AS a2;
---error ER_NO_DB_ERROR
-DELETE a1,a2 FROM db3.t1 AS a1, db4.t2 AS a2;
---error ER_NO_DB_ERROR
-DELETE a1,a2 FROM db3.t1 AS a1, db4.t2 AS a2;
-
---error ER_NO_DB_ERROR
-DELETE FROM a1,a2 USING db1.t1, db2.t2;
---error ER_NO_DB_ERROR
-DELETE FROM a1,a2 USING db1.t1, db2.t2;
---error ER_NO_DB_ERROR
-DELETE FROM a1,a2 USING db1.t1 AS a1, db2.t2;
---error ER_NO_DB_ERROR
-DELETE FROM a1,a2 USING db1.t1, db2.t2 AS a2;
---error ER_NO_DB_ERROR
-DELETE FROM a1,a2 USING db3.t1 AS a1, db4.t2 AS a2;
---error ER_NO_DB_ERROR
-DELETE FROM a1,a2 USING db3.t1 AS a1, db4.t2 AS a2;
-
-# Ambiguous table references
-
---error ER_NO_DB_ERROR
-DELETE a1 FROM db1.t1 AS a1, db2.t2 AS a1;
---error ER_NO_DB_ERROR
-DELETE a1 FROM db1.a1, db2.t2 AS a1;
---error ER_NO_DB_ERROR
-DELETE a1 FROM a1, db1.t1 AS a1;
---error ER_NO_DB_ERROR
-DELETE t1 FROM db1.t1, db2.t1 AS a1;
---error ER_NO_DB_ERROR
-DELETE t1 FROM db1.t1 AS a1, db2.t1 AS a2;
---error ER_NO_DB_ERROR
-DELETE t1 FROM db1.t1, db2.t1;
-
-# Test all again, now with a selected database
-
-USE test;
-
-# Detect missing table references
-
---error ER_UNKNOWN_TABLE
-DELETE a1,a2 FROM db1.t1, db2.t2;
---error ER_UNKNOWN_TABLE
-DELETE a1,a2 FROM db1.t1, db2.t2;
---error ER_UNKNOWN_TABLE
-DELETE a1,a2 FROM db1.t1 AS a1, db2.t2;
---error ER_UNKNOWN_TABLE
-DELETE a1,a2 FROM db1.t1, db2.t2 AS a2;
---error ER_NO_SUCH_TABLE
-DELETE a1,a2 FROM db3.t1 AS a1, db4.t2 AS a2;
---error ER_NO_SUCH_TABLE
-DELETE a1,a2 FROM db3.t1 AS a1, db4.t2 AS a2;
-
---error ER_UNKNOWN_TABLE
-DELETE FROM a1,a2 USING db1.t1, db2.t2;
---error ER_UNKNOWN_TABLE
-DELETE FROM a1,a2 USING db1.t1, db2.t2;
---error ER_UNKNOWN_TABLE
-DELETE FROM a1,a2 USING db1.t1 AS a1, db2.t2;
---error ER_UNKNOWN_TABLE
-DELETE FROM a1,a2 USING db1.t1, db2.t2 AS a2;
---error ER_NO_SUCH_TABLE
-DELETE FROM a1,a2 USING db3.t1 AS a1, db4.t2 AS a2;
---error ER_NO_SUCH_TABLE
-DELETE FROM a1,a2 USING db3.t1 AS a1, db4.t2 AS a2;
-
-# Ambiguous table references
-
---error ER_NONUNIQ_TABLE
-DELETE a1 FROM db1.t1 AS a1, db2.t2 AS a1;
---error ER_NO_SUCH_TABLE
-DELETE a1 FROM db1.a1, db2.t2 AS a1;
---error ER_NONUNIQ_TABLE
-DELETE a1 FROM a1, db1.t1 AS a1;
---error ER_UNKNOWN_TABLE
-DELETE t1 FROM db1.t1, db2.t1 AS a1;
---error ER_UNKNOWN_TABLE
-DELETE t1 FROM db1.t1 AS a1, db2.t1 AS a2;
---error ER_UNKNOWN_TABLE
-DELETE t1 FROM db1.t1, db2.t1;
-
-# Test multiple-table cross database deletes
-
-DELETE t1 FROM db1.t2 AS t1, db2.t2 AS t2 WHERE t2.a = 1 AND t1.a = t2.a;
-SELECT ROW_COUNT();
-CALL count_rows();
-DELETE a1, a2 FROM db2.t1 AS a1, t2 AS a2 WHERE a1.a = 2 AND a2.a = 2;
-SELECT ROW_COUNT();
-CALL count_rows();
-
-DROP DATABASE db1;
-DROP DATABASE db2;
-DROP PROCEDURE count_rows;
-DROP TABLE t1, t2;
-
---echo #
---echo # Bug#46958: Assertion in Diagnostics_area::set_ok_status, trigger,
---echo # merge table
---echo #
-CREATE TABLE t1 ( a INT );
-CREATE TABLE t2 ( a INT );
-CREATE TABLE t3 ( a INT );
-
-INSERT INTO t1 VALUES (1), (2);
-INSERT INTO t2 VALUES (1), (2);
-INSERT INTO t3 VALUES (1), (2);
-
-CREATE TRIGGER tr1 BEFORE DELETE ON t2
-FOR EACH ROW INSERT INTO no_such_table VALUES (1);
-
---error ER_NO_SUCH_TABLE
-DELETE t1, t2, t3 FROM t1, t2, t3;
-
-SELECT * FROM t1;
-SELECT * FROM t2;
-SELECT * FROM t3;
-
-DROP TABLE t1, t2, t3;
-
-CREATE TABLE t1 ( a INT );
-CREATE TABLE t2 ( a INT );
-CREATE TABLE t3 ( a INT );
-
-INSERT INTO t1 VALUES (1), (2);
-INSERT INTO t2 VALUES (1), (2);
-INSERT INTO t3 VALUES (1), (2);
-
-CREATE TRIGGER tr1 AFTER DELETE ON t2
-FOR EACH ROW INSERT INTO no_such_table VALUES (1);
-
---error ER_NO_SUCH_TABLE
-DELETE t1, t2, t3 FROM t1, t2, t3;
-
-SELECT * FROM t1;
-SELECT * FROM t2;
-SELECT * FROM t3;
-
-DROP TABLE t1, t2, t3;
-
---echo #
---echo # Bug #46425 crash in Diagnostics_area::set_ok_status,
---echo # empty statement, DELETE IGNORE
---echo #
-
-CREATE table t1 (i INTEGER);
-
-INSERT INTO t1 VALUES (1);
-
---delimiter |
-
-CREATE TRIGGER tr1 AFTER DELETE ON t1 FOR EACH ROW
-BEGIN
- INSERT INTO t1 SELECT * FROM t1 AS A;
-END |
-
---delimiter ;
---error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
-DELETE IGNORE FROM t1;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug #53450: Crash/assertion
---echo # "virtual int ha_myisam::index_first(uchar*)") at assert.c:81
---echo #
-
-CREATE TABLE t1 (a INT, b INT, c INT,
- INDEX(a), INDEX(b), INDEX(c));
-INSERT INTO t1 VALUES (1,2,3), (4,5,6), (7,8,9);
-
-DELETE FROM t1 WHERE a = 10 OR b = 20 ORDER BY c LIMIT 1;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug #53034: Multiple-table DELETE statements not accepting
---echo # "Access compatibility" syntax
---echo #
-
-CREATE TABLE t1 (id INT);
-CREATE TABLE t2 LIKE t1;
-CREATE TABLE t3 LIKE t1;
-
-DELETE FROM t1.*, test.t2.*, a.* USING t1, t2, t3 AS a;
-
-DROP TABLE t1, t2, t3;
-
---echo End of 5.1 tests
-
-
---echo #
---echo # Bug#51099 Assertion in mysql_multi_delete_prepare()
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1, v2;
---enable_warnings
-
-CREATE TABLE t1(a INT);
-CREATE TABLE t2(b INT);
-CREATE VIEW v1 AS SELECT a, b FROM t1, t2;
-CREATE VIEW v2 AS SELECT a FROM v1;
-
-# This is a normal delete
---error ER_VIEW_DELETE_MERGE_VIEW
-DELETE FROM v2;
-# This is a multi table delete, check that we get the same error
-# This caused the assertion.
---error ER_VIEW_DELETE_MERGE_VIEW
-DELETE v2 FROM v2;
-
-DROP VIEW v2, v1;
-DROP TABLE t1, t2;
diff --git a/mysql-test/t/delete_returning.test b/mysql-test/t/delete_returning.test
deleted file mode 100644
index 4448a6bcccd..00000000000
--- a/mysql-test/t/delete_returning.test
+++ /dev/null
@@ -1,172 +0,0 @@
-#
-# Tests for DELETE FROM <table> ... RETURNING <expr>,...
-#
---disable_warnings
-drop table if exists t1,t2;
-drop view if exists v1;
-drop procedure if exists p1;
---enable_warnings
-
-CREATE TABLE t1 (a int, b varchar(32));
-INSERT INTO t1 VALUES
- (7,'ggggggg'), (1,'a'), (3,'ccc'),
- (4,'dddd'), (1,'A'), (2,'BB'), (4,'DDDD'),
- (5,'EEEEE'), (7,'GGGGGGG'), (2,'bb');
-
-CREATE TABLE t1c SELECT * FROM t1;
-
-CREATE TABLE t2 (c int);
-INSERT INTO t2 VALUES
- (4), (5), (7), (1);
-
-CREATE TABLE t2c SELECT * FROM t2;
-
-CREATE VIEW v1 AS SELECT a, UPPER(b) FROM t1;
-
-# DELETE FROM <table> ... RETURNING *
-
-DELETE FROM t1 WHERE a=2 RETURNING * ;
-SELECT * FROM t1;
-
-INSERT INTO t1 VALUES (2,'BB'), (2,'bb');
-
-# DELETE FROM <table> ... RETURNING <col>
-
-DELETE FROM t1 WHERE a=2 RETURNING b;
-SELECT * FROM t1;
-
-# DELETE FROM <table> ... RETURNING <not existing col>
---error ER_BAD_FIELD_ERROR
-DELETE FROM t1 WHERE a=2 RETURNING c;
-
-INSERT INTO t1 VALUES (2,'BB'), (2,'bb');
-
-# DELETE FROM <table> ... RETURNING <col>, <expr>
-
-DELETE FROM t1 WHERE a=2 RETURNING a, UPPER(b);
-SELECT * FROM t1;
-
-INSERT INTO t1 VALUES (2,'BB'), (2,'bb');
-
-# DELETE FROM <table> ... RETURNING <col> with no rows to be deleted
-
-DELETE FROM t1 WHERE a=6 RETURNING b;
-SELECT * FROM t1;
-
-# DELETE FROM <table> ... RETURNING <expr with aggr function>
-
---error ER_INVALID_GROUP_FUNC_USE
-DELETE FROM t1 WHERE a=2 RETURNING MAX(b);
-
-# DELETE FROM <table> ... RETURNING <expr with subquery>
-
-DELETE FROM t1 WHERE a < 5 RETURNING a, (SELECT MIN(c) FROM t2 WHERE c=a+1);
-SELECT * FROM t1;
-
-DELETE FROM t1;
-INSERT INTO t1 SELECT * FROM t1c;
-
-DELETE FROM t2 WHERE c < 5
- RETURNING (SELECT GROUP_CONCAT(b) FROM t1 GROUP BY a HAVING a=c);
-SELECT * FROM t2;
-
-DELETE FROM t2;
-INSERT INTO t2 SELECT * FROM t2c;
-
-# DELETE FROM <table> ... RETURNING <expr with function invocation>
-
-DELIMITER |;
-
-CREATE FUNCTION f(arg INT) RETURNS TEXT
-BEGIN
- RETURN (SELECT GROUP_CONCAT(b) FROM t1 WHERE a=arg);
-END|
-
-DELIMITER ;|
-
-DELETE FROM t2 WHERE c < 5 RETURNING f(c);
-SELECT * FROM t2;
-
-DELETE FROM t2;
-INSERT INTO t2 SELECT * FROM t2c;
-
-DROP FUNCTION f;
-
-# DELETE FROM <view> ... RETURNING <col>, <col>
-
-DELETE FROM v1 WHERE a < 5 RETURNING * ;
-SELECT * FROM t1;
-
-DELETE FROM t1;
-INSERT INTO t1 SELECT * FROM t1c;
-
-# DELETE FROM <view> ... RETURNING <expr>
-
-CREATE VIEW v11(a,c) AS SELECT a, COUNT(b) FROM t1 GROUP BY a;
--- error ER_NON_UPDATABLE_TABLE
-DELETE FROM v11 WHERE a < 5 RETURNING * ;
-DROP VIEW v11;
-
-# prepared DELETE FROM <table> ... RETURNING <expr>
-
-PREPARE stmt FROM
-"DELETE FROM t1 WHERE a=2 ORDER BY b LIMIT 1 RETURNING a, UPPER(b)";
-EXECUTE stmt;
-SELECT * FROM t1;
-EXECUTE stmt;
-SELECT * FROM t1;
-DEALLOCATE PREPARE stmt;
-
-# Cleanup
-DROP VIEW v1;
-DROP TABLE t1,t2;
-DROP TABLE t1c,t2c;
-
---echo #
---echo # Bug mdev-4918: DELETE ... RETURNING subquery with more than 1 row
---echo #
-
-CREATE TABLE t1 (i1 int);
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE TABLE t2 (i2 int);
-INSERT INTO t2 VALUES (1),(2);
-
---error ER_SUBQUERY_NO_1_ROW
-DELETE FROM t1 ORDER BY i1 RETURNING ( SELECT i2 FROM t2 );
-
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-4919: Packets out of order on a SELECT after calling a procedure with DELETE .. RETURNING
---echo #
-CREATE TABLE t1 (i INT);
-INSERT INTO t1 VALUES (1),(2);
---delimiter |
-CREATE PROCEDURE p1 (a INT)
-BEGIN
- DELETE FROM t1 WHERE i = a RETURNING *;
- INSERT INTO t1 VALUES (a);
-END |
---delimiter ;
-
-CALL p1(1);
-SELECT * FROM t1;
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-13776: DELETE ... RETURNING with sql_mode='ONLY_FULL_GROUP_BY'
---echo #
-
-set @sql_mode_save= @@sql_mode;
-set sql_mode='ONLY_FULL_GROUP_BY';
-
-CREATE TABLE t1 (id INT);
-INSERT INTO t1 VALUE(1),(2),(3);
-
-DELETE FROM t1 WHERE id > 2 RETURNING *;
-
-set sql_mode=@sql_mode_save;
-
-DROP TABLE t1;
diff --git a/mysql-test/t/delete_returning_grant.test b/mysql-test/t/delete_returning_grant.test
deleted file mode 100644
index 67613603a72..00000000000
--- a/mysql-test/t/delete_returning_grant.test
+++ /dev/null
@@ -1,82 +0,0 @@
-#
-# Tests for DELETE FROM <table> ... RETURNING <expr>,...
-#
---source include/not_embedded.inc
-
-set GLOBAL sql_mode="";
-set LOCAL sql_mode="";
-
-CREATE TABLE t1 (a int(11), b varchar(32));
-INSERT INTO t1 VALUES (7,'ggggggg'),(1,'a'),(3,'ccc'),(4,'dddd'),(1,'A'),
- (2,'BB'),(4,'DDDD'),(5,'EEEEE'),(7,'GGGGGGG'),(2,'bb');
-CREATE VIEW v1 AS SELECT a, UPPER(b) FROM t1;
-
-# DELETE FROM <table> ... RETURNING ... with checking privileges
-
-connect (root,localhost,root,,test);
-connection root;
---disable_warnings
-CREATE DATABASE mysqltest;
---enable_warnings
-
-CREATE TABLE mysqltest.t1 SELECT * FROM t1;
-GRANT DELETE ON mysqltest.* TO mysqltest_1@localhost;
-
-GRANT SELECT(b) ON mysqltest.t1 TO mysqltest_1@localhost;
-
-connect (user1,localhost,mysqltest_1,,test);
-
-connection user1;
-
---error ER_COLUMNACCESS_DENIED_ERROR
-DELETE FROM mysqltest.t1 WHERE a=2 RETURNING b;
-
-DELETE FROM mysqltest.t1 RETURNING b;
-
-connection root;
-SELECT * FROM mysqltest.t1;
-INSERT INTO mysqltest.t1 SELECT * FROM t1;
-
-GRANT SELECT(a) ON mysqltest.t1 TO mysqltest_1@localhost;
-
-DELETE FROM mysqltest.t1 WHERE a=2 RETURNING b;
-
-SELECT * FROM mysqltest.t1;
-INSERT INTO mysqltest.t1 SELECT * FROM t1;
-
-connection root;
-CREATE VIEW mysqltest.v1(a) AS SELECT a FROM mysqltest.t1;
-GRANT SELECT, INSERT ON mysqltest.t1 TO mysqltest_1@localhost;
-
-connection user1;
-
-DELETE FROM mysqltest.v1;
-SELECT * FROM mysqltest.t1;
-
-INSERT INTO mysqltest.t1 SELECT * FROM t1;
-
---error ER_COLUMNACCESS_DENIED_ERROR
-DELETE FROM mysqltest.v1 RETURNING a;
-
-connection root;
-GRANT SELECT ON mysqltest.* TO mysqltest_1@localhost;
-
-connection user1;
-DELETE FROM mysqltest.v1 RETURNING a;
-SELECT * FROM mysqltest.t1;
-
-INSERT INTO mysqltest.t1 SELECT * FROM t1;
-
-connection root;
---disable_warnings
-DROP DATABASE mysqltest;
---enable_warnings
-
-disconnect user1;
-DROP USER mysqltest_1@localhost;
-
-# Cleanup
-DROP VIEW v1;
-DROP TABLE t1;
-
-set GLOBAL sql_mode=default;
diff --git a/mysql-test/t/delete_use_source.test b/mysql-test/t/delete_use_source.test
deleted file mode 100644
index 93065c6fe23..00000000000
--- a/mysql-test/t/delete_use_source.test
+++ /dev/null
@@ -1,133 +0,0 @@
---source include/have_sequence.inc
---source include/have_innodb.inc
-create table t1(c1 integer not null,c2 integer not null, key (c1)) engine=InnoDb;
-create view v1 as select * from t1 where c1 in (0,1);
-
-insert t1 select 0,seq from seq_1_to_500;
-insert t1 select 1,seq from seq_1_to_100;
-insert t1 select 2,seq from seq_1_to_50;
-insert t1 select 3,seq from seq_1_to_20;
-analyze table t1;
-
---echo #
---echo # Delete with limit (quick select - range acces)
---echo #
-
-start transaction;
---enable_info
-delete from t1 where (select count(*) from t1 b where b.c1=t1.c1) = 500 limit 1;
-delete from t1 where (select count(*) from t1 b where b.c1=t1.c1) = 500 limit 1;
---disable_info
-select count(*) from v1 where c1=0;
-rollback;
-
---echo #
---echo # Delete
---echo #
-
-start transaction;
---enable_info ONCE
-delete from t1 where (select count(*) from t1 b where b.c1=t1.c1) = 500 ;
-rollback;
-
---echo #
---echo # Delete with exists
---echo #
-
-start transaction;
-select count(*) from v1 where c1=2;
---enable_info
-delete from t1 where c1=2 and exists(select 'x' from t1 b where b.c2<10);
-delete from t1 where c1=2 and exists(select 'x' from t1 b where b.c2<10);
---disable_info
-select count(*) from v1 where c1=2;
-rollback;
-
---echo #
---echo # Delete through a view with limit (range access)
---echo #
-
-start transaction;
-explain delete from v1 where (select count(*) from t1 b where b.c1=v1.c1) = 500 limit 1;
---enable_info
-delete from v1 where (select count(*) from t1 b where b.c1=v1.c1) = 500 limit 1;
-delete from v1 where (select count(*) from t1 b where b.c1=v1.c1) = 500 limit 1;
---disable_info
-select count(*) from v1 where c1=0;
-rollback;
-
---echo #
---echo # Delete through a view (ALL access)
---echo #
-
-start transaction;
-explain delete from v1 where (select count(*) from t1 b where b.c1=v1.c1) = 500;
---enable_info ONCE
-delete from v1 where (select count(*) from t1 b where b.c1=v1.c1) = 500 ;
-select count(*) from v1 where c1=0;
-rollback;
-
---echo #
---echo # Delete failed due to trigger
---echo #
-
-delimiter /;
-create trigger trg after delete on t1 for each row
-begin
- declare c int;
- begin
- if old.c1 = 1 then
- select count(*) into c from t1 where c1!=old.c1;
- SIGNAL SQLSTATE '45000' set table_name=c;
- end if;
- end;
-end;
-/
-delimiter ;/
-
-start transaction;
---error ER_SIGNAL_EXCEPTION
-delete from t1 where c1=1 and (select count(*) from t1 b where b.c1=t1.c1) > 0 order by c2 asc limit 10;
-rollback;
-start transaction;
---error ER_SIGNAL_EXCEPTION
-delete from t1 where (select count(*) from t1 b where b.c1=t1.c1) > 0 order by c1 desc limit 100;
-select c1,count(*) from t1 group by c1;
-rollback;
-
-drop trigger trg;
-
---echo #
---echo # Delete through a view with returning
---echo #
-
-start transaction;
-delete from t1 where (select count(*) from t1 b where b.c1=t1.c1) = 500 order by c2 asc limit 10 returning c1,c2;
-rollback;
-start transaction;
-delete from t1 where (select count(*) from t1 b where b.c1=t1.c1) = 500 order by c2 desc limit 10 returning c1,c2;
-rollback;
-
-drop view v1;
-drop table t1;
-
---echo #
---echo # Delete from table with more than 150000 rows
---echo #
-create table t1(c1 integer not null,c2 integer not null, key (c1));
-insert t1 select 0,seq from seq_1_to_128000;
-insert t1 select 1,seq from seq_1_to_25600;
-select count(*) from t1;
-
---echo # with a lot of memory for sort_buffer_size
-set session sort_buffer_size = 1024000;
---enable_info ONCE
-delete from t1 where c1=0 and exists(select 'x' from t1 b where b.c1<10);
-
---echo # with little memory for sort_buffer_size
-insert t1 select 0,seq from seq_1_to_128000;
-set session sort_buffer_size = 1024;
---enable_info ONCE
-delete from t1 where c1=0 and exists(select 'x' from t1 b where b.c1<10);
-
-drop table t1;
diff --git a/mysql-test/t/delimiter_case_mdev_10728.sql b/mysql-test/t/delimiter_case_mdev_10728.sql
deleted file mode 100644
index 72a1dcd9a9e..00000000000
--- a/mysql-test/t/delimiter_case_mdev_10728.sql
+++ /dev/null
@@ -1,3 +0,0 @@
-DeLiMiTeR A;
-SELECT 1 A;
-delimiter ;
diff --git a/mysql-test/t/delimiter_command_case_sensitivity.test b/mysql-test/t/delimiter_command_case_sensitivity.test
deleted file mode 100644
index 11d1cf75aa0..00000000000
--- a/mysql-test/t/delimiter_command_case_sensitivity.test
+++ /dev/null
@@ -1,4 +0,0 @@
-source include/not_embedded.inc;
-
-# MDEV-10728
---exec $MYSQL --default-character-set=binary < "t/delimiter_case_mdev_10728.sql"
diff --git a/mysql-test/t/deprecated_features.test b/mysql-test/t/deprecated_features.test
deleted file mode 100644
index a9c5a5ae5ff..00000000000
--- a/mysql-test/t/deprecated_features.test
+++ /dev/null
@@ -1,25 +0,0 @@
---error ER_UNKNOWN_SYSTEM_VARIABLE
-set global log_bin_trust_routine_creators=1;
---error ER_UNKNOWN_SYSTEM_VARIABLE
-set table_type='MyISAM';
---error ER_UNKNOWN_SYSTEM_VARIABLE
-select @@table_type='MyISAM';
---error ER_PARSE_ERROR
-backup table t1 to 'data.txt';
---error ER_PARSE_ERROR
-restore table t1 from 'data.txt';
---error ER_PARSE_ERROR
-show plugin;
---error ER_PARSE_ERROR
-load table t1 from master;
---error ER_PARSE_ERROR
-load data from master;
---error ER_PARSE_ERROR
-SHOW INNODB STATUS;
---error ER_PARSE_ERROR
-create table t1 (t6 timestamp) type=myisam;
---error ER_PARSE_ERROR
-show table types;
---error ER_PARSE_ERROR
-show mutex status;
-
diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test
deleted file mode 100644
index 466d79af409..00000000000
--- a/mysql-test/t/derived.test
+++ /dev/null
@@ -1,1013 +0,0 @@
-# Initialize
---disable_warnings
-drop table if exists t1,t2,t3;
---enable_warnings
-
-set @save_derived_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='derived_merge=off,derived_with_keys=off';
-
-select * from (select 2 from DUAL) b;
--- error 1054
-SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b;
--- error 1054
-SELECT 1 as a FROM (SELECT a UNION SELECT 1) b;
-CREATE TABLE t1 (a int not null, b char (10) not null);
-insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c');
-CREATE TABLE t2 (a int not null, b char (10) not null);
-insert into t2 values (3,'c'),(4,'d'),(5,'f'),(6,'e');
-select t1.a,t3.y from t1,(select a as y from t2 where b='c') as t3 where t1.a = t3.y;
-select t1.a,t3.a from t1,(select * from t2 where b='c') as t3 where t1.a = t3.a;
-CREATE TABLE t3 (a int not null, b char (10) not null);
-insert into t3 values (3,'f'),(4,'y'),(5,'z'),(6,'c');
-select t1.a,t4.y from t1,(select t2.a as y from t2,(select t3.b from t3 where t3.a>3) as t5 where t2.b=t5.b) as t4 where t1.a = t4.y;
---error 1054
-SELECT a FROM (SELECT 1 FROM (SELECT 1) a HAVING a=1) b;
---error 1052
-SELECT a,b as a FROM (SELECT '1' as a,'2' as b) b HAVING a=1;
-SELECT a,2 as a FROM (SELECT '1' as a) b HAVING a=2;
-SELECT a,2 as a FROM (SELECT '1' as a) b HAVING a=1;
---error 1054
-SELECT 1 FROM (SELECT 1) a WHERE a=2;
---error 1054
-SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) as a;
-select * from t1 as x1, (select * from t1) as x2;
-explain select * from t1 as x1, (select * from t1) as x2;
-drop table if exists t2,t3;
-select * from (select 1) as a;
-select a from (select 1 as a) as b;
-select 1 from (select 1) as a;
-select * from (select * from t1 union select * from t1) a;
-select * from (select * from t1 union all select * from t1) a;
-select * from (select * from t1 union all select * from t1 limit 2) a;
-explain select * from (select * from t1 union select * from t1) a;
-explain select * from (select * from t1 union all select * from t1) a;
-CREATE TABLE t2 (a int not null);
-insert into t2 values(1);
-select * from (select * from t1 where t1.a=(select a from t2 where t2.a=t1.a)) a;
-select * from (select * from t1 where t1.a=(select t2.a from t2 where t2.a=t1.a) union select t1.a, t1.b from t1) a;
-explain select * from (select t1.*, t2.a as t2a from t1,t2 where t1.a=t2.a) t1;
-drop table t1, t2;
-create table t1(a int not null, t char(8), index(a));
---disable_query_log
-begin;
-let $1 = 10000;
-while ($1)
- {
- eval insert into t1 values ($1,'$1');
- dec $1;
- }
-commit;
---enable_query_log
-SELECT * FROM (SELECT * FROM t1) as b ORDER BY a ASC LIMIT 0,20;
-explain select count(*) from t1 as tt1, (select * from t1) as tt2;
-drop table t1;
-SELECT * FROM (SELECT (SELECT * FROM (SELECT 1 as a) as a )) as b;
-select * from (select 1 as a) b left join (select 2 as a) c using(a);
---error 1054
-SELECT * FROM (SELECT 1 UNION SELECT a) b;
---error 1054
-SELECT 1 as a FROM (SELECT a UNION SELECT 1) b;
---error 1054
-SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b;
---error 1054
-select 1 from (select 2) a order by 0;
-
-#
-# Test of explain (bug #251)
-#
-
-create table t1 (id int);
-insert into t1 values (1),(2),(3);
-describe select * from (select * from t1 group by id) bar;
-drop table t1;
-
-#
-# test->used_keys test for derived tables
-#
-create table t1 (mat_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, matintnum CHAR(6) NOT NULL, test MEDIUMINT UNSIGNED NULL);
-create table t2 (mat_id MEDIUMINT UNSIGNED NOT NULL, pla_id MEDIUMINT UNSIGNED NOT NULL);
-insert into t1 values (NULL, 'a', 1), (NULL, 'b', 2), (NULL, 'c', 3), (NULL, 'd', 4), (NULL, 'e', 5), (NULL, 'f', 6), (NULL, 'g', 7), (NULL, 'h', 8), (NULL, 'i', 9);
-insert into t2 values (1, 100), (1, 101), (1, 102), (2, 100), (2, 103), (2, 104), (3, 101), (3, 102), (3, 105);
-
-SELECT STRAIGHT_JOIN d.pla_id, m2.mat_id FROM t1 m2 INNER JOIN (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id) d ON d.matintnum=m2.matintnum;
-SELECT STRAIGHT_JOIN d.pla_id, m2.test FROM t1 m2 INNER JOIN (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id) d ON d.matintnum=m2.matintnum;
-
-explain SELECT STRAIGHT_JOIN d.pla_id, m2.mat_id FROM t1 m2 INNER JOIN (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id) d ON d.matintnum=m2.matintnum;
-explain SELECT STRAIGHT_JOIN d.pla_id, m2.test FROM t1 m2 INNER JOIN (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id) d ON d.matintnum=m2.matintnum;
-drop table t1,t2;
-
-#
-# derived table reference
-#
-SELECT a.x FROM (SELECT 1 AS x) AS a HAVING a.x = 1;
-
-#
-# Test for select if database is not selected.
-#
-# Connect without a database as user mysqltest_1
-create user mysqltest_1;
-create table t1 select 1 as a;
-connect (con1,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,$MASTER_MYSOCK);
-connection con1;
-set optimizer_switch='derived_merge=off,derived_with_keys=off';
---error 1046
-select 2 as a from (select * from t1) b;
-use test;
-select 2 as a from (select * from t1) b;
-drop table t1;
---error 1064
-select mail_id, if(folder.f_description!='', folder.f_description, folder.f_name) as folder_name, date, address_id, phrase, address, subject from folder, (select mail.mail_id as mail_id, date_format(mail.h_date, '%b %e, %Y %h:%i') as date, mail.folder_id, sender.address_id as address_id, sender.phrase as phrase, sender.address as address, mail.h_subject as subject from mail left join mxa as mxa_sender on mail.mail_id=mxa_sender.mail_id and mxa_sender.type='from' left join address as sender on mxa_sender.address_id=sender.address_id mxa as mxa_recipient, address as recipient, where 1 and mail.mail_id=mxa_recipient.mail_id and mxa_recipient.address_id=recipient.address_id and mxa_recipient.type='to' and match(sender.phrase, sender.address, sender.comment) against ('jeremy' in boolean mode) and match(recipient.phrase, recipient.address, recipient.comment) against ('monty' in boolean mode) order by mail.h_date desc limit 0, 25 ) as query where query.folder_id=folder.folder_id;
-
-#
-# UPDATE/DELETE/INSERT of derived tables
-#
-create table t1 (a int);
-insert into t1 values (1),(2),(3);
--- error 1288
-update (select * from t1) as t1 set a = 5;
--- error 1064
-delete from (select * from t1);
--- error 1064
-insert into (select * from t1) values (5);
-drop table t1;
-
-#
-# deived tables with subquery inside all by one table
-#
-create table t1 (E1 INTEGER UNSIGNED NOT NULL, E2 INTEGER UNSIGNED NOT NULL, E3 INTEGER UNSIGNED NOT NULL, PRIMARY KEY(E1)
-);
-insert into t1 VALUES(1,1,1), (2,2,1);
-select count(*) from t1 INNER JOIN (SELECT A.E1, A.E2, A.E3 FROM t1 AS A WHERE A.E3 = (SELECT MAX(B.E3) FROM t1 AS B WHERE A.E2 = B.E2)) AS THEMAX ON t1.E1 = THEMAX.E2 AND t1.E1 = t1.E2;
-explain select count(*) from t1 INNER JOIN (SELECT A.E1, A.E2, A.E3 FROM t1 AS A WHERE A.E3 = (SELECT MAX(B.E3) FROM t1 AS B WHERE A.E2 = B.E2)) AS THEMAX ON t1.E1 = THEMAX.E2 AND t1.E1 = t1.E2;
-drop table t1;
-
-create table t1 (a int);
-insert into t1 values (1),(2);
-select * from ( select * from t1 union select * from t1) a,(select * from t1 union select * from t1) b;
-explain select * from ( select * from t1 union select * from t1) a,(select * from t1 union select * from t1) b;
-drop table t1;
-
-#
-# multi-update & multi-delete with derived tables
-#
-CREATE TABLE `t1` (
- `N` int(11) unsigned NOT NULL default '0',
- `M` tinyint(1) default '0'
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-INSERT INTO `t1` (N, M) VALUES (1, 0),(1, 0),(1, 0),(2, 0),(2, 0),(3, 0);
-UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2;
-select * from t1;
--- error 1288
-UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2, P2.N = 2;
--- error 1054
-UPDATE `t1` AS P1 INNER JOIN (SELECT aaaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2;
-delete P1.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
-select * from t1;
---replace_result P2 p2
---error ER_NON_UPDATABLE_TABLE
-delete P1.*,P2.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
--- error 1054
-delete P1.* from `t1` AS P1 INNER JOIN (SELECT aaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
-drop table t1;
-
-#
-# correct lex->current_select
-#
-CREATE TABLE t1 (
- OBJECTID int(11) NOT NULL default '0',
- SORTORDER int(11) NOT NULL auto_increment,
- KEY t1_SortIndex (SORTORDER),
- KEY t1_IdIndex (OBJECTID)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-CREATE TABLE t2 (
- ID int(11) default NULL,
- PARID int(11) default NULL,
- UNIQUE KEY t2_ID_IDX (ID),
- KEY t2_PARID_IDX (PARID)
-) engine=MyISAM DEFAULT CHARSET=latin1;
-INSERT INTO t2 VALUES (1000,0),(1001,0),(1002,0),(1003,0),(1008,1),(1009,1),(1010,1),(1011,1),(1016,2);
-CREATE TABLE t3 (
- ID int(11) default NULL,
- DATA decimal(10,2) default NULL,
- UNIQUE KEY t3_ID_IDX (ID)
-) engine=MyISAM DEFAULT CHARSET=latin1;
-INSERT INTO t3 VALUES (1000,0.00),(1001,0.25),(1002,0.50),(1003,0.75),(1008,1.00),(1009,1.25),(1010,1.50),(1011,1.75);
-select 497, TMP.ID, NULL from (select 497 as ID, MAX(t3.DATA) as DATA from t1 join t2 on (t1.ObjectID = t2.ID) join t3 on (t1.ObjectID = t3.ID) group by t2.ParID order by DATA DESC) as TMP;
-drop table t1, t2, t3;
-
-#
-# explain derived
-#
-CREATE TABLE t1 (name char(1) default NULL, val int(5) default NULL);
-INSERT INTO t1 VALUES ('a',1), ('a',2), ('a',2), ('a',2), ('a',3), ('a',6), ('a',7), ('a',11), ('a',11), ('a',12), ('a',13), ('a',13), ('a',20), ('b',2), ('b',3), ('b',4), ('b',5);
-SELECT s.name, AVG(s.val) AS median FROM (SELECT x.name, x.val FROM t1 x, t1 y WHERE x.name=y.name GROUP BY x.name, x.val HAVING SUM(y.val <= x.val) >= COUNT(*)/2 AND SUM(y.val >= x.val) >= COUNT(*)/2) AS s GROUP BY s.name;
-explain SELECT s.name, AVG(s.val) AS median FROM (SELECT x.name, x.val FROM t1 x, t1 y WHERE x.name=y.name GROUP BY x.name, x.val HAVING SUM(y.val <= x.val) >= COUNT(*)/2 AND SUM(y.val >= x.val) >= COUNT(*)/2) AS s GROUP BY s.name;
-drop table t1;
-
-#
-# "Using index" in explain
-#
-create table t2 (a int, b int, primary key (a));
-insert into t2 values (1,7),(2,7);
-explain select a from t2 where a>1;
-explain select a from (select a from t2 where a>1) tt;
-drop table t2;
-
-#
-# select list counter
-#
-CREATE TABLE `t1` ( `itemid` int(11) NOT NULL default '0', `grpid` varchar(15) NOT NULL default '', `vendor` int(11) NOT NULL default '0', `date_` date NOT NULL default '0000-00-00', `price` decimal(12,2) NOT NULL default '0.00', PRIMARY KEY (`itemid`,`grpid`,`vendor`,`date_`), KEY `itemid` (`itemid`,`vendor`), KEY `itemid_2` (`itemid`,`date_`));
-insert into t1 values (128, 'rozn', 2, curdate(), 10),
- (128, 'rozn', 1, curdate(), 10);
-SELECT MIN(price) min, MAX(price) max, AVG(price) avg FROM (SELECT SUBSTRING( MAX(concat(date_,";",price)), 12) price FROM t1 WHERE itemid=128 AND grpid='rozn' GROUP BY itemid, grpid, vendor) lastprices;
-DROP TABLE t1;
-
-#
-# DISTINCT over grouped select on subquery in the FROM clause
-#
-create table t1 (a integer, b integer);
-insert into t1 values (1,4), (2,2),(2,2), (4,1),(4,1),(4,1),(4,1);
-select distinct sum(b) from t1 group by a;
-select distinct sum(b) from (select a,b from t1) y group by a;
-drop table t1;
-
-
-#
-# Test for bug #7413 "Subquery with non-scalar results participating in
-# select list of derived table crashes server" aka "VIEW with sub query can
-# cause the MySQL server to crash". If we have encountered problem during
-# filling of derived table we should report error and perform cleanup
-# properly.
-#
-CREATE TABLE t1 (a char(10), b char(10));
-INSERT INTO t1 VALUES ('root','localhost'), ('root','%');
---error 1242
-SELECT * FROM (SELECT (SELECT a.a FROM t1 AS a WHERE a.a = b.a) FROM t1 AS b) AS c;
-DROP TABLE t1;
-#
-# test of union subquery in the FROM clause with complex distinct/all (BUG#6565)
-#
-create table t1(a int);
-create table t2(a int);
-create table t3(a int);
-insert into t1 values(1),(1);
-insert into t2 values(2),(2);
-insert into t3 values(3),(3);
-select * from t1 union distinct select * from t2 union all select * from t3;
-select * from (select * from t1 union distinct select * from t2 union all select * from t3) X;
-drop table t1, t2, t3;
-
-#
-# Bug #11864 non unique names are allowed in subquery
-#
-create table t1 (a int);
-create table t2 (a int);
---error 1060
-select * from (select * from t1,t2) foo;
-drop table t1,t2;
-
-#
-# Bug#10586 - query works with 4.1.8, but not with 4.1.11
-#
-create table t1 (ID int unsigned not null auto_increment,
- DATA varchar(5) not null, primary key (ID));
-create table t2 (ID int unsigned not null auto_increment,
- DATA varchar(5) not null, FID int unsigned not null,
- primary key (ID));
-select A.* from (t1 inner join (select * from t2) as A on t1.ID = A.FID);
-select t2.* from ((select * from t1) as A inner join t2 on A.ID = t2.FID);
-select t2.* from (select * from t1) as A inner join t2 on A.ID = t2.FID;
-drop table t1, t2;
-
-connection con1;
-disconnect con1;
---source include/wait_until_disconnected.inc
-connection default;
-drop user mysqltest_1;
-
---echo # End of 4.1 tests
-
-#
-# Bug #41156: List of derived tables acts like a chain of
-# mutually-nested subqueries
-#
-
-SELECT 0 FROM
-(SELECT 0) t01, (SELECT 0) t02, (SELECT 0) t03, (SELECT 0) t04, (SELECT 0) t05,
-(SELECT 0) t06, (SELECT 0) t07, (SELECT 0) t08, (SELECT 0) t09, (SELECT 0) t10,
-(SELECT 0) t11, (SELECT 0) t12, (SELECT 0) t13, (SELECT 0) t14, (SELECT 0) t15,
-(SELECT 0) t16, (SELECT 0) t17, (SELECT 0) t18, (SELECT 0) t19, (SELECT 0) t20,
-(SELECT 0) t21, (SELECT 0) t22, (SELECT 0) t23, (SELECT 0) t24, (SELECT 0) t25,
-(SELECT 0) t26, (SELECT 0) t27, (SELECT 0) t28, (SELECT 0) t29, (SELECT 0) t30,
-(SELECT 0) t31, (SELECT 0) t32, (SELECT 0) t33, (SELECT 0) t34, (SELECT 0) t35,
-(SELECT 0) t36, (SELECT 0) t37, (SELECT 0) t38, (SELECT 0) t39, (SELECT 0) t40,
-(SELECT 0) t41, (SELECT 0) t42, (SELECT 0) t43, (SELECT 0) t44, (SELECT 0) t45,
-(SELECT 0) t46, (SELECT 0) t47, (SELECT 0) t48, (SELECT 0) t49, (SELECT 0) t50,
-(SELECT 0) t51, (SELECT 0) t52, (SELECT 0) t53, (SELECT 0) t54, (SELECT 0) t55,
-(SELECT 0) t56, (SELECT 0) t57, (SELECT 0) t58, (SELECT 0) t59, (SELECT 0) t60,
-(SELECT 0) t61; # 61 == MAX_TABLES
-
---echo #
---echo # A nested materialized derived table is used before being populated.
---echo # (addon for bug#19077)
---echo #
-
-CREATE TABLE t1 (i INT, j BIGINT);
-INSERT INTO t1 VALUES (1, 2), (2, 2), (3, 2);
-SELECT * FROM (SELECT MIN(i) FROM t1
-WHERE j = SUBSTRING('12', (SELECT * FROM (SELECT MIN(j) FROM t1) t2))) t3;
-DROP TABLE t1;
-
---echo # End of 5.0 tests
-
---echo #
---echo # MDEV-5005: Subquery in Procedure somehow affecting temporary table
---echo #
-
-create temporary table if not exists t1 (id int not null);
-
-select A.* from ( select tt.* from t1 tt ) A;
-
-prepare stmt from "select A.* from ( select tt.* from t1 tt ) A ";
-execute stmt;
-deallocate prepare stmt;
-
-drop temporary table t1;
-
---delimiter |
-CREATE PROCEDURE p ()
-BEGIN
- select A.* from ( select tt.* from t1 tt ) A ;
-END |
---delimiter ;
-
-create temporary table if not exists t1 (id int not null);
-
-CALL p();
-CALL p();
-
-drop procedure p;
-
-drop temporary table t1;
-
-
---echo #
---echo # MDEV-5143: update of a joined table with a nested subquery with
---echo # a syntax error crashes mysqld with signal 11
---echo #
-
-create table t1 (id int(11) not null auto_increment, val varchar(100) null,primary key (id));
-create table t2 (id int(11) not null auto_increment, val varchar(100) null,primary key (id));
-
-insert into t1 (val) values('a');
-insert into t2 (val) values('1');
-
---error ER_BAD_FIELD_ERROR
-update
- (
- select
- val
- from
- (
- select
- v.val
- from
- t2 wrong_table_alias
- ) t4
- ) t3
- inner join t1 on
- t1.id=t3.val
-set
- t1.val=t3.val
-;
-
-drop table t1, t2;
-
---echo #
---echo # MDEV-5353: server crash on subselect if WHERE applied to some
---echo # result field
---echo #
-
-SELECT * FROM
-( SELECT 100 a, subsel.b FROM ( SELECT 200 b ) subsel ) tmp
-WHERE tmp.b;
-SELECT * FROM
-( SELECT 100 a, subsel.b FROM ( SELECT 200 b ) subsel ) tmp
-WHERE tmp.a;
-
---echo #
---echo # MDEV-5356: Server crashes in Item_equal::contains on 2nd
---echo # execution of a PS
---echo #
-CREATE TABLE t1 (a INT, b INT);
-INSERT INTO t1 VALUES (1,2),(3,4);
-
-CREATE TABLE t2 (c INT);
-INSERT INTO t2 VALUES (5),(6);
-
-CREATE TABLE t3 (d INT);
-INSERT INTO t3 VALUES (7),(8);
-
-CREATE PROCEDURE pr()
- UPDATE t3,
- (SELECT c FROM
- (SELECT 1 FROM t1 WHERE a=72 AND NOT b) sq,
- t2
- ) sq2
- SET d=sq2.c;
-
-CALL pr();
-CALL pr();
-CALL pr();
-
-drop procedure pr;
-drop table t1,t2,t3;
-
---echo # End of 5.3 tests
-
---echo #
---echo # Bug#58730 Assertion failed: table->key_read == 0 in close_thread_table,
---echo # temptable views
---echo #
-
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (b INT, KEY (b));
-INSERT INTO t1 VALUES (1),(1);
-INSERT INTO t2 VALUES (1),(1);
-
-CREATE algorithm=temptable VIEW v1 AS
- SELECT 1 FROM t1 LEFT JOIN t1 t3 ON 1 > (SELECT 1 FROM t1);
-CREATE algorithm=temptable VIEW v2 AS SELECT 1 FROM t2;
-
-# This caused the assert to be triggered.
-EXPLAIN SELECT 1 FROM t1 JOIN v1 ON 1 > (SELECT 1 FROM v2);
---error ER_SUBQUERY_NO_1_ROW
-SELECT 1 FROM t1 JOIN v1 ON 1 > (SELECT 1 FROM v2);
-
-DROP TABLE t1, t2;
-DROP VIEW v1, v2;
-
-#
-# MDEV-614 lp:1050806 - different result for a query using subquery between 5.5.25 and 5.5.27
-# MySQL Bug#66845 Wrong result (extra row) on a FROM subquery with a variable and ORDER BY
-#
-create table t1 (n bigint(20) unsigned, d1 datetime, d2 datetime, key (d1));
-insert t1 values (2085,'2012-01-01 00:00:00','2013-01-01 00:00:00');
-insert t1 values (2084,'2012-02-01 00:00:00','2013-01-01 00:00:00');
-insert t1 values (2088,'2012-03-01 00:00:00','2013-01-01 00:00:00');
-select * from (
- select n, d1, d2, @result := 0 as result
- from t1
- where d1 < '2012-12-12 12:12:12' and n in (2085, 2084) order by d2 asc
-) as calculated_result;
-drop table t1;
-
-#
-# MDEV-5012 Server crashes in Item_ref::real_item on EXPLAIN with select subqueries or views, constant table, derived_merge+derived_with_keys
-#
-set @save_derived_optimizer_switch_bug=@@optimizer_switch;
-SET optimizer_switch = 'derived_merge=on,derived_with_keys=on,in_to_exists=on';
-CREATE TABLE t1 (a INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (8);
-CREATE TABLE t2 (b INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (1),(7);
-EXPLAIN SELECT * FROM (SELECT * FROM t1) AS table1,
- (SELECT DISTINCT * FROM t2) AS table2 WHERE b = a AND a <> ANY (SELECT 9);
-DROP TABLE t1, t2;
-set optimizer_switch=@save_derived_optimizer_switch_bug;
-
---echo #
---echo # MDEV-6163: Error while executing an update query that has the
---echo # same table in a sub-query
---echo #
-
-set @save_derived_optimizer_switch_bug=@@optimizer_switch;
-SET optimizer_switch = 'derived_merge=on';
-create table t1 (balance float, accountId varchar(64), primary key (accountId));
-
-insert into t1 (accountId,balance) values
-('dealer-1',199354.0),('dealer-2',0),('dealer-3',0),('dealer-5',0),('FINANCE',-200000),('OPERATOR',0);
-
-update t1 set balance=(select sum(balance) from (SELECT balance FROM t1 where accountId like 'dealer%') AS copied) where accountId = 'OPERATOR';
-set optimizer_switch=@save_derived_optimizer_switch_bug;
-drop table t1;
-
---echo #
---echo # MDEV-6219:Server crashes in Bitmap<64u>::merge
---echo # (this=0x180, map2=...) on 2nd execution of PS with INSERT .. SELECT,
---echo # derived_merge
---echo #
-
-CREATE TABLE t1 (a VARCHAR(8)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('foo'),('bar');
-
-create procedure p1()
- INSERT INTO t1 SELECT * FROM (
- SELECT * FROM t1
- ) AS sq
- WHERE sq.a IN ( SELECT 'baz' FROM DUAL );
-
-call p1();
-call p1();
-drop procedure p1;
-
-PREPARE stmt FROM "
- INSERT INTO t1 SELECT * FROM (
- SELECT * FROM t1
- ) AS sq
- WHERE sq.a IN ( SELECT 'baz' FROM DUAL )
-";
-
-EXECUTE stmt;
-EXECUTE stmt;
-
-deallocate prepare stmt;
-
-drop table t1;
-
---echo #
---echo # MDEV-6892: WHERE does not apply
---echo #
-create table t1 (id int);
-create table t2 (id int);
-insert into t1 values(1),(2),(3);
-insert into t2 values(4),(5),(6);
-#explain extended
-select x.id, message from (select id from t1) x left join
-(select id, 1 as message from t2) y on x.id=y.id
-where coalesce(message,0) <> 0;
-drop table t1,t2;
-
---echo #
---echo # MDEV-7827: Assertion `!table || (!table->read_set ||
---echo # bitmap_is_set(table->read_set, field_index))' failed
---echo # in Field_long::val_str on EXPLAIN EXTENDED
---echo #
-
-CREATE TABLE t1 (f1 INT, f2 INT, KEY(f2)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (6,9);
-
-CREATE TABLE t2 (f3 INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (2),(0);
-
-EXPLAIN EXTENDED
-SELECT f1 FROM ( SELECT * FROM t1 ) AS sq
-WHERE f1 IN (
- SELECT f3 FROM t2 WHERE f2 IN (
- SELECT f3 FROM t2 HAVING f3 >= 8
- )
-);
-
-DROP TABLE t2,t1;
-
---echo #
---echo # MDEV-9462: Out of memory using explain on 2 empty tables
---echo #
-
-CREATE TABLE `t1` (
- `REC_GROUP` char(2) DEFAULT NULL,
- `CLIENT_INFO` text CHARACTER SET utf8,
- `NAME` text,
- `PHONE_NUMBER` text,
- `ATTENTION_NAME` text,
- `PAYMENT_TERM` text CHARACTER SET utf8,
- `CREDIT_LIMIT` decimal(12,2) DEFAULT NULL,
- `LAST_PAY_DATE` text CHARACTER SET utf8,
- `TOTAL` double DEFAULT NULL,
- `TOTAL_MCL` double DEFAULT NULL,
- `TOTAL_MFS` double DEFAULT NULL,
- `TOTAL_MIS` double DEFAULT NULL,
- `BEFORE_DUE_7_MCL` double DEFAULT NULL,
- `BEFORE_DUE_7_MFS` double DEFAULT NULL,
- `BEFORE_DUE_7_MIS` double DEFAULT NULL,
- `PER1_MCL` double DEFAULT NULL,
- `PER1_MFS` double DEFAULT NULL,
- `PER1_MIS` double DEFAULT NULL,
- `PER2_MCL` double DEFAULT NULL,
- `PER2_MFS` double DEFAULT NULL,
- `PER2_MIS` double DEFAULT NULL,
- `PER3_MCL` double DEFAULT NULL,
- `PER3_MFS` double DEFAULT NULL,
- `PER3_MIS` double DEFAULT NULL,
- `PER4_MCL` double DEFAULT NULL,
- `PER4_MFS` double DEFAULT NULL,
- `PER4_MIS` double DEFAULT NULL,
- `PER5_MCL` double DEFAULT NULL,
- `PER5_MFS` double DEFAULT NULL,
- `PER5_MIS` double DEFAULT NULL,
- `PER6_MCL` double DEFAULT NULL,
- `PER6_MFS` double DEFAULT NULL,
- `PER6_MIS` double DEFAULT NULL,
- `PER7_MCL` double DEFAULT NULL,
- `PER7_MFS` double DEFAULT NULL,
- `PER7_MIS` double DEFAULT NULL,
- `BEFORE_DUE_7` double DEFAULT NULL,
- `PER1` double DEFAULT NULL,
- `PER2` double DEFAULT NULL,
- `PER3` double DEFAULT NULL,
- `PER4` double DEFAULT NULL,
- `PER5` double DEFAULT NULL,
- `PER6` double DEFAULT NULL,
- `PER7` double DEFAULT NULL,
- `REF` varchar(30) DEFAULT NULL,
- `TYPE` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL
-);
-
-
-CREATE TABLE `t2` (
- `RECEIVABLE_GROUP` char(2) DEFAULT NULL,
- `CLIENT_NUMBER` varchar(35) DEFAULT NULL,
- `CLIENT_NAME` varchar(73) DEFAULT NULL,
- `PHONE_NUMBER` char(12) DEFAULT NULL,
- `ATTENTION_NAME` char(26) DEFAULT NULL,
- `PAYMENT_TERM` varchar(26) CHARACTER SET utf8 DEFAULT NULL,
- `CREDIT_LIMIT` decimal(12,2) DEFAULT NULL,
- `LAST_PAY_DATE` varchar(42) CHARACTER SET utf8 DEFAULT NULL,
- `TOTAL` decimal(12,2) DEFAULT NULL,
- `BEFORE_DUE_7` decimal(12,2) DEFAULT NULL,
- `PER1` decimal(12,2) DEFAULT NULL,
- `PER2` decimal(12,2) DEFAULT NULL,
- `PER3` decimal(12,2) DEFAULT NULL,
- `PER4` decimal(12,2) DEFAULT NULL,
- `PER5` decimal(12,2) DEFAULT NULL,
- `PER6` decimal(12,2) DEFAULT NULL,
- `PER7` decimal(12,2) DEFAULT NULL,
- `DIVISION` varchar(3) CHARACTER SET utf8 NOT NULL,
- `CLIENT_INFO` varchar(294) CHARACTER SET utf8 DEFAULT NULL,
- `EXCHANGE_RATE` double NOT NULL,
- `REF` varchar(30) DEFAULT NULL
-);
-
-explain
-SELECT A.RECEIVABLE_GROUP,A.CLIENT_INFO,A.CLIENT_NAME,A.PHONE_NUMBER,A.ATTENTION_NAME,A.PAYMENT_TERM,A.CREDIT_LIMIT,A.LAST_PAY_DATE,A.TOTAL,
-COALESCE(B.TOTAL_MCL,0) AS TOTAL_MCL,
-COALESCE(C.TOTAL_MFS,0) AS TOTAL_MFS,
-COALESCE(D.TOTAL_MIS,0) AS TOTAL_MIS,
-COALESCE(F.BEFORE_DUE_7_MCL,0) AS BEFORE_DUE_7_MCL,
-COALESCE(G.BEFORE_DUE_7_MFS,0) AS BEFORE_DUE_7_MFS,
-COALESCE(H.BEFORE_DUE_7_MIS,0) AS BEFORE_DUE_7_MIS,
-COALESCE(I.PER1_MCL,0) AS PER1_MCL,
-COALESCE(J.PER1_MFS,0) AS PER1_MFS,
-COALESCE(K.PER1_MIS,0) AS PER1_MIS,
-COALESCE(L.PER2_MCL,0) AS PER2_MCL,
-COALESCE(M.PER2_MFS,0) AS PER2_MFS,
-COALESCE(N.PER2_MIS,0) AS PER2_MIS,
-COALESCE(O.PER3_MCL,0) AS PER3_MCL,
-COALESCE(P.PER3_MFS,0) AS PER3_MFS,
-COALESCE(R.PER3_MIS,0) AS PER3_MIS,
-COALESCE(S.PER4_MCL,0) AS PER4_MCL,
-COALESCE(T.PER4_MFS,0) AS PER4_MFS,
-COALESCE(U.PER4_MIS,0) AS PER4_MIS,
-COALESCE(V.PER5_MCL,0) AS PER5_MCL,
-COALESCE(X.PER5_MFS,0) AS PER5_MFS,
-COALESCE(Z.PER5_MIS,0) AS PER5_MIS,
-COALESCE(Q.PER6_MCL,0) AS PER6_MCL,
-COALESCE(Y.PER6_MFS,0) AS PER6_MFS,
-COALESCE(W.PER6_MIS,0) AS PER6_MIS,
-COALESCE(A1.PER7_MCL,0) AS PER7_MCL,
-COALESCE(B1.PER7_MFS,0) AS PER7_MFS,
-COALESCE(C1.PER7_MIS,0) AS PER7_MIS,
-A.BEFORE_DUE_7,A.PER1,A.PER2,A.PER3,A.PER4,A.PER5,A.PER6,A.PER7,
-CONCAT(A.DIVISION,'-',A.CLIENT_NUMBER) AS REF,"2" AS TYPE FROM
-(SELECT RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,
-GROUP_CONCAT(DISTINCT CLIENT_INFO SEPARATOR '<br>') AS CLIENT_INFO,
-GROUP_CONCAT(DISTINCT CLIENT_NAME SEPARATOR '<br>') AS CLIENT_NAME,
-GROUP_CONCAT( DISTINCT `PHONE_NUMBER` SEPARATOR '<br>' ) AS PHONE_NUMBER ,
-GROUP_CONCAT( DISTINCT `ATTENTION_NAME` SEPARATOR '<br>' ) AS ATTENTION_NAME,
-GROUP_CONCAT( DISTINCT `PAYMENT_TERM` SEPARATOR '<br>' ) AS PAYMENT_TERM,
-CREDIT_LIMIT ,
-GROUP_CONCAT( `LAST_PAY_DATE` SEPARATOR '<br>' ) AS LAST_PAY_DATE,
-SUM( `TOTAL`*EXCHANGE_RATE ) AS TOTAL,
-SUM( `BEFORE_DUE_7`*EXCHANGE_RATE ) AS BEFORE_DUE_7,
-SUM( `PER1`*EXCHANGE_RATE ) AS PER1,
-SUM( `PER2`*EXCHANGE_RATE ) AS PER2,
-SUM( `PER3`*EXCHANGE_RATE ) AS PER3,
-SUM( `PER4`*EXCHANGE_RATE ) AS PER4,
-SUM( `PER5`*EXCHANGE_RATE ) AS PER5,
-SUM( `PER6`*EXCHANGE_RATE ) AS PER6,
-SUM( `PER7`*EXCHANGE_RATE ) AS PER7
-FROM `t2`
-WHERE REF IS NULL GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT) AS A
-LEFT JOIN
-(SELECT RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT,SUM( `TOTAL`*EXCHANGE_RATE ) AS TOTAL_MCL
-FROM `t2`
-WHERE REF IS NULL AND DIVISION="MCL" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT) AS B ON A.CLIENT_NUMBER=B.CLIENT_NUMBER AND
-A.DIVISION=B.DIVISION AND A.RECEIVABLE_GROUP=B.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=B.CREDIT_LIMIT
-LEFT JOIN
-(SELECT RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT,SUM( `TOTAL`*EXCHANGE_RATE ) AS TOTAL_MFS
-FROM `t2`
-WHERE REF IS NULL AND DIVISION="MFS" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT) AS C ON A.CLIENT_NUMBER=C.CLIENT_NUMBER
-AND
-A.DIVISION=C.DIVISION AND A.RECEIVABLE_GROUP=C.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=C.CREDIT_LIMIT
-LEFT JOIN
-(SELECT RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT,SUM( `TOTAL`*EXCHANGE_RATE ) AS TOTAL_MIS
-FROM `t2`
-WHERE REF IS NULL AND DIVISION="MIS" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT) AS D ON A.CLIENT_NUMBER=D.CLIENT_NUMBER AND
-A.DIVISION=D.DIVISION AND A.RECEIVABLE_GROUP=D.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=D.CREDIT_LIMIT
-LEFT JOIN
-(SELECT RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT,SUM( BEFORE_DUE_7*EXCHANGE_RATE ) AS BEFORE_DUE_7_MCL
-FROM `t2`
-WHERE REF IS NULL AND DIVISION="MCL" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT) AS F ON A.CLIENT_NUMBER=F.CLIENT_NUMBER AND
-A.DIVISION=F.DIVISION AND A.RECEIVABLE_GROUP=F.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=F.CREDIT_LIMIT
-LEFT JOIN
-(SELECT RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT,SUM( BEFORE_DUE_7*EXCHANGE_RATE ) AS BEFORE_DUE_7_MFS
-FROM `t2`
-WHERE REF IS NULL AND DIVISION="MFS" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT) AS G ON A.CLIENT_NUMBER=G.CLIENT_NUMBER AND
-A.DIVISION=G.DIVISION AND A.RECEIVABLE_GROUP=G.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=G.CREDIT_LIMIT
-LEFT JOIN
-(SELECT RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT,SUM( BEFORE_DUE_7*EXCHANGE_RATE ) AS BEFORE_DUE_7_MIS
-FROM `t2`
-WHERE REF IS NULL AND DIVISION="MIS" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT) AS H ON A.CLIENT_NUMBER=H.CLIENT_NUMBER AND
-A.DIVISION=H.DIVISION AND A.RECEIVABLE_GROUP=H.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=H.CREDIT_LIMIT
-LEFT JOIN
-(SELECT RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT,SUM( PER1*EXCHANGE_RATE ) AS PER1_MCL
-FROM `t2`
-WHERE REF IS NULL AND DIVISION="MCL" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT) AS I ON A.CLIENT_NUMBER=I.CLIENT_NUMBER AND
-A.DIVISION=I.DIVISION AND A.RECEIVABLE_GROUP=I.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=I.CREDIT_LIMIT
-LEFT JOIN
-(SELECT RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT,SUM( PER1*EXCHANGE_RATE ) AS PER1_MFS
-FROM `t2`
-WHERE REF IS NULL AND DIVISION="MFS" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT) AS J ON A.CLIENT_NUMBER=J.CLIENT_NUMBER AND
-A.DIVISION=J.DIVISION AND A.RECEIVABLE_GROUP=J.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=J.CREDIT_LIMIT
-LEFT JOIN
-(SELECT RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT,SUM( PER1*EXCHANGE_RATE ) AS PER1_MIS
-FROM `t2`
-WHERE REF IS NULL AND DIVISION="MIS" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT) AS K ON A.CLIENT_NUMBER=K.CLIENT_NUMBER AND
-A.DIVISION=K.DIVISION AND A.RECEIVABLE_GROUP=K.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=K.CREDIT_LIMIT
-LEFT JOIN
-(SELECT RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT,SUM( PER2*EXCHANGE_RATE ) AS PER2_MCL
-FROM `t2`
-WHERE REF IS NULL AND DIVISION="MCL" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT) AS L ON A.CLIENT_NUMBER=L.CLIENT_NUMBER AND
-A.DIVISION=L.DIVISION AND A.RECEIVABLE_GROUP=L.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=L.CREDIT_LIMIT
-LEFT JOIN
-(SELECT RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT,SUM( PER2*EXCHANGE_RATE ) AS PER2_MFS
-FROM `t2`
-WHERE REF IS NULL AND DIVISION="MFS" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT) AS M ON A.CLIENT_NUMBER=M.CLIENT_NUMBER AND
-A.DIVISION=M.DIVISION AND A.RECEIVABLE_GROUP=M.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=M.CREDIT_LIMIT
-LEFT JOIN
-(SELECT RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT,SUM( PER2*EXCHANGE_RATE ) AS PER2_MIS
-FROM `t2`
-WHERE REF IS NULL AND DIVISION="MIS" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT) AS N ON A.CLIENT_NUMBER=N.CLIENT_NUMBER AND
-A.DIVISION=N.DIVISION AND A.RECEIVABLE_GROUP=N.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=N.CREDIT_LIMIT
-LEFT JOIN
-(SELECT RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT,SUM( PER3*EXCHANGE_RATE ) AS PER3_MCL
-FROM `t2`
-WHERE REF IS NULL AND DIVISION="MCL" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT) AS O ON A.CLIENT_NUMBER=O.CLIENT_NUMBER AND
-A.DIVISION=O.DIVISION AND A.RECEIVABLE_GROUP=O.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=O.CREDIT_LIMIT
-LEFT JOIN
-(SELECT RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT,SUM( PER3*EXCHANGE_RATE ) AS PER3_MFS
-FROM `t2`
-WHERE REF IS NULL AND DIVISION="MFS" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT) AS P ON A.CLIENT_NUMBER=P.CLIENT_NUMBER AND
-A.DIVISION=P.DIVISION AND A.RECEIVABLE_GROUP=P.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=P.CREDIT_LIMIT
-LEFT JOIN
-(SELECT RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT,SUM( PER3*EXCHANGE_RATE ) AS PER3_MIS
-FROM `t2`
-WHERE REF IS NULL AND DIVISION="MIS" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT) AS R ON A.CLIENT_NUMBER=R.CLIENT_NUMBER AND
-A.DIVISION=R.DIVISION AND A.RECEIVABLE_GROUP=R.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=R.CREDIT_LIMIT
-LEFT JOIN
-(SELECT RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT,SUM( PER4*EXCHANGE_RATE ) AS PER4_MCL
-FROM `t2`
-WHERE REF IS NULL AND DIVISION="MCL" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT) AS S ON A.CLIENT_NUMBER=S.CLIENT_NUMBER AND
-A.DIVISION=S.DIVISION AND A.RECEIVABLE_GROUP=S.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=S.CREDIT_LIMIT
-LEFT JOIN
-(SELECT RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT,SUM( PER4*EXCHANGE_RATE ) AS PER4_MFS
-FROM `t2`
-WHERE REF IS NULL AND DIVISION="MFS" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT) AS T ON A.CLIENT_NUMBER=T.CLIENT_NUMBER AND
-A.DIVISION=T.DIVISION AND A.RECEIVABLE_GROUP=T.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=T.CREDIT_LIMIT
-LEFT JOIN
-(SELECT RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT,SUM( PER4*EXCHANGE_RATE ) AS PER4_MIS
-FROM `t2`
-WHERE REF IS NULL AND DIVISION="MIS" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT) AS U ON A.CLIENT_NUMBER=U.CLIENT_NUMBER AND
-A.DIVISION=U.DIVISION AND A.RECEIVABLE_GROUP=U.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=U.CREDIT_LIMIT
-LEFT JOIN
-(SELECT RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT,SUM( PER5*EXCHANGE_RATE ) AS PER5_MCL
-FROM `t2`
-WHERE REF IS NULL AND DIVISION="MCL" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT) AS V ON A.CLIENT_NUMBER=V.CLIENT_NUMBER AND
-A.DIVISION=V.DIVISION AND A.RECEIVABLE_GROUP=V.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=V.CREDIT_LIMIT
-LEFT JOIN
-(SELECT RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT,SUM( PER5*EXCHANGE_RATE ) AS PER5_MFS
-FROM `t2`
-WHERE REF IS NULL AND DIVISION="MFS" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT) AS X ON A.CLIENT_NUMBER=X.CLIENT_NUMBER AND
-A.DIVISION=X.DIVISION AND A.RECEIVABLE_GROUP=X.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=X.CREDIT_LIMIT
-LEFT JOIN
-(SELECT RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT,SUM( PER5*EXCHANGE_RATE ) AS PER5_MIS
-FROM `t2`
-WHERE REF IS NULL AND DIVISION="MIS" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT) AS Z ON A.CLIENT_NUMBER=Z.CLIENT_NUMBER AND
-A.DIVISION=Z.DIVISION AND A.RECEIVABLE_GROUP=Z.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=Z.CREDIT_LIMIT
-LEFT JOIN
-(SELECT RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT,SUM( PER6*EXCHANGE_RATE ) AS PER6_MCL
-FROM `t2`
-WHERE REF IS NULL AND DIVISION="MCL" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT) AS Q ON A.CLIENT_NUMBER=Q.CLIENT_NUMBER AND
-A.DIVISION=Q.DIVISION AND A.RECEIVABLE_GROUP=Q.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=Q.CREDIT_LIMIT
-LEFT JOIN
-(SELECT RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT,SUM( PER6*EXCHANGE_RATE ) AS PER6_MFS
-FROM `t2`
-WHERE REF IS NULL AND DIVISION="MFS" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT) AS Y ON A.CLIENT_NUMBER=Y.CLIENT_NUMBER AND
-A.DIVISION=Y.DIVISION AND A.RECEIVABLE_GROUP=Y.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=Y.CREDIT_LIMIT
-LEFT JOIN
-(SELECT RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT,SUM( PER6*EXCHANGE_RATE ) AS PER6_MIS
-FROM `t2`
-WHERE REF IS NULL AND DIVISION="MIS" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT) AS W ON A.CLIENT_NUMBER=W.CLIENT_NUMBER AND
-A.DIVISION=W.DIVISION AND A.RECEIVABLE_GROUP=W.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=W.CREDIT_LIMIT
-LEFT JOIN
-(SELECT RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT,SUM( PER7*EXCHANGE_RATE ) AS PER7_MCL
-FROM `t2`
-WHERE REF IS NULL AND DIVISION="MCL" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT) AS A1 ON A.CLIENT_NUMBER=A1.CLIENT_NUMBER AND
-A.DIVISION=A1.DIVISION AND A.RECEIVABLE_GROUP=A1.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=A1.CREDIT_LIMIT
-LEFT JOIN
-(SELECT RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT,SUM( PER7*EXCHANGE_RATE ) AS PER7_MFS
-FROM `t2`
-WHERE REF IS NULL AND DIVISION="MFS" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT) AS B1 ON A.CLIENT_NUMBER=B1.CLIENT_NUMBER AND
-A.DIVISION=B1.DIVISION AND A.RECEIVABLE_GROUP=B1.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=B1.CREDIT_LIMIT
-LEFT JOIN
-(SELECT RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT,SUM( PER7*EXCHANGE_RATE ) AS PER7_MIS
-FROM `t2`
-WHERE REF IS NULL AND DIVISION="MIS" GROUP BY RECEIVABLE_GROUP,DIVISION,CLIENT_NUMBER,CREDIT_LIMIT) AS C1 ON A.CLIENT_NUMBER=C1.CLIENT_NUMBER AND
-A.DIVISION=C1.DIVISION AND A.RECEIVABLE_GROUP=C1.RECEIVABLE_GROUP AND A.CREDIT_LIMIT=C1.CREDIT_LIMIT
-ORDER BY TOTAL DESC;
-
-DROP TABLES t1,t2;
-
-set optimizer_switch=@save_derived_optimizer_switch;
-
---echo #
---echo # MDEV-10663: Use of Inline table columns in HAVING clause
---echo # throws 1463 Error
---echo #
-
-set @save_sql_mode = @@sql_mode;
-set sql_mode='ONLY_FULL_GROUP_BY,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
-
-CREATE TABLE `example1463` (
- `Customer` varchar(255) NOT NULL,
- `DeliveryStatus` varchar(255) NOT NULL,
- `OrderSize` int(11) NOT NULL
-);
-INSERT INTO example1463 VALUES ('Charlie', 'Success', 100);
-INSERT INTO example1463 VALUES ('David', 'Success', 110);
-INSERT INTO example1463 VALUES ('Charlie', 'Failed', 200);
-INSERT INTO example1463 VALUES ('David', 'Success', 100);
-INSERT INTO example1463 VALUES ('David', 'Unknown', 100);
-INSERT INTO example1463 VALUES ('Edward', 'Success', 150);
-INSERT INTO example1463 VALUES ('Edward', 'Pending', 150);
-
-SELECT Customer, Success, SUM(OrderSize)
- FROM (SELECT Customer,
- CASE WHEN DeliveryStatus='Success' THEN 'Yes' ELSE 'No' END AS Success,
- OrderSize
- FROM example1463) as subQ
- GROUP BY Success, Customer
- WITH ROLLUP;
-SELECT Customer, Success, SUM(OrderSize)
- FROM (SELECT Customer,
- CASE WHEN DeliveryStatus='Success' THEN 'Yes' ELSE 'No' END AS Success,
- OrderSize
- FROM example1463) as subQ
- GROUP BY Success, Customer;
-SELECT Customer, Success, SUM(OrderSize)
- FROM (SELECT Customer,
- CASE WHEN DeliveryStatus='Success' THEN 'Yes' ELSE 'No' END AS Success,
- OrderSize
- FROM example1463) as subQ
- GROUP BY Success, Customer
- HAVING Success IS NOT NULL;
-
-DROP TABLE example1463;
-set sql_mode= @save_sql_mode;
-
---echo #
---echo # MDEV-9028: SELECT DISTINCT constant column of derived table
---echo # used as the second operand of LEFT JOIN
---echo #
-
-create table t1 (id int, data varchar(255));
-insert into t1 values (1,'yes'),(2,'yes');
-
-select distinct t1.id, tt.id, tt.data
- from t1
- left join
- (select t1.id, 'yes' as data from t1) as tt
- on t1.id = tt.id;
-
-select distinct t1.id, tt.id, tt.data
- from t1
- left join
- (select t1.id, 'yes' as data from t1 where id > 1) as tt
- on t1.id = tt.id;
-
-drop table t1;
-
---echo #
---echo # MDEV-14241: Server crash in key_copy / get_matching_chain_by_join_key
---echo # or valgrind warnings
---echo #
-
-CREATE TABLE t1 (a VARCHAR(10)) ENGINE=MyISAM;
-CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
-INSERT INTO t1 VALUES ('foo'),('bar');
-
-CREATE TABLE t2 (b integer auto_increment primary key) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (NULL),(NULL);
-
-CREATE TABLE t3 (c VARCHAR(1024) CHARACTER SET utf8, d INT) ENGINE=MyISAM;
-CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v3 AS SELECT * FROM t3;
-INSERT INTO t3 VALUES ('abc',NULL),('def',4);
-
-SET join_cache_level= 8;
-explain
-SELECT * FROM v1, t2, v3 WHERE a = c AND b = d;
-SELECT * FROM v1, t2, v3 WHERE a = c AND b = d;
-
-DROP VIEW v1, v3;
-DROP TABLE t1, t2, t3;
-
---echo #
---echo # MDEV-14786: Server crashes in Item_cond::transform on 2nd
---echo # execution of SP querying from a view
---echo #
-create table t1 (i int, row_start timestamp(6) not null default now(),
- row_end timestamp(6) not null default '2030-01-01 0:0:0');
-create view v1 as select i from t1 where i < 5 and (row_end =
-TIMESTAMP'2030-01-01 0:0:0' or row_end is null);
-create procedure pr(x int) select i from v1;
-call pr(1);
-call pr(2);
-drop procedure pr;
-drop view v1;
-drop table t1;
-
---echo # end of 5.5
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-8747 Wrong result for SELECT..WHERE derived_table_column='a' AND derived_table_column<>_latin1'A' COLLATE latin1_bin
---echo #
-CREATE TABLE t1 (a VARCHAR(10));
-INSERT INTO t1 VALUES ('a'),('A');
-SELECT * FROM t1 WHERE a='a' AND a <> _latin1'A' COLLATE latin1_bin;
-SELECT * FROM (SELECT * FROM t1) AS table1 WHERE a='a' AND a <> _latin1'A' COLLATE latin1_bin;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a ENUM('5','6'));
-INSERT INTO t1 VALUES ('5'),('6');
-SELECT * FROM (SELECT * FROM t1) AS table1 WHERE a='5';
-SELECT * FROM (SELECT * FROM t1) AS table1 WHERE a=1;
-SELECT * FROM (SELECT * FROM t1) AS table1 WHERE a='5' AND a=1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8749 Wrong result for SELECT..WHERE derived_table_enum_column='number' AND derived_table_enum_column OP number2
---echo #
-CREATE TABLE t1 (a ENUM('5','6'));
-INSERT INTO t1 VALUES ('5'),('6');
-SELECT * FROM (SELECT * FROM t1) AS table1 WHERE a='5';
-SELECT * FROM (SELECT * FROM t1) AS table1 WHERE a=1;
-SELECT * FROM (SELECT * FROM t1) AS table1 WHERE a='5' AND a=1;
-DROP TABLE t1;
-
---echo #
---echo # End of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-10554: Assertion `!derived->first_select()->
---echo # exclude_from_table_unique_test || derived->outer_select()->
---echo # exclude_from_table_unique_test'
---echo # failed in TABLE_LIST::set_check_merged()
---echo #
-
-CREATE TABLE t1 (f INT);
-CREATE ALGORITHM = TEMPTABLE VIEW v1 AS SELECT * FROM ( SELECT * FROM t1 ) AS sq;
-
-PREPARE stmt FROM 'SELECT * FROM v1';
-EXECUTE stmt;
-EXECUTE stmt;
-
-drop view v1;
-drop table t1;
-
---echo #
---echo # MDEV-11363: Assertion `!derived->first_sel ect()->first_inner_unit() ||
---echo # derived->first_select()->first_inner_unit()->first_select()->
---echo # exclude_from_table_unique_test' failed in
---echo # TABLE_LIST::set_check_materialized()
---echo #
-
-CREATE TABLE t1 (f1 INT);
-CREATE TABLE t2 (f2 INT);
-CREATE TABLE t3 (f3 INT);
-CREATE VIEW v1 AS ( SELECT f1 AS f FROM t1 ) UNION ( SELECT f2 AS f FROM t2 );
-CREATE VIEW v2 AS SELECT f3 AS f FROM t3;
-CREATE VIEW v3 AS SELECT f FROM ( SELECT f3 AS f FROM v1, t3 ) AS sq;
-CREATE VIEW v4 AS SELECT COUNT(*) as f FROM v3;
-REPLACE INTO v2 ( SELECT * FROM v4 ) UNION ( SELECT f FROM v2 );
-
-drop view v1,v2,v3,v4;
-drop table t1,t2,t3;
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/derived_cond_pushdown.test b/mysql-test/t/derived_cond_pushdown.test
deleted file mode 100644
index e728a9590a1..00000000000
--- a/mysql-test/t/derived_cond_pushdown.test
+++ /dev/null
@@ -1,2615 +0,0 @@
-let $no_pushdown= set statement optimizer_switch='condition_pushdown_for_derived=off' for;
-
-create table t1 (a int, b int, c int);
-create table t2 (a int, b int, c int, d decimal);
-insert into t1 values
- (1,21,345), (1,33,7), (8,33,114), (1,21,500), (1,19,107), (5,14,787),
- (8,33,123), (9,10,211), (5,16,207), (1,33,988), (5,27,132), (1,21,104),
- (6,20,309), (6,20,315), (1,21,101), (8,33,404), (9,10,800), (1,21,123),
- (7,11,708), (6,20,214);
-insert into t2 values
- (2,3,207,207.0000), (1,21,909,12.0000), (7,13,312,406.0000),
- (8,64,248,107.0000), (6,20,315,279.3333), (1,19,203,107.0000),
- (8,80,800,314.0000), (3,12,231,190.0000), (6,23,303,909.0000);
-
-create table t1_double(a int, b double, c double);
-insert into t1_double values
- (1,23.4,14.3333), (1,12.5,18.9), (3,12.5,18.9),
- (4,33.4,14.3333), (4,14.3333,13.65), (5,17.89,7.22),
- (6,33.4,14.3), (10,33.4,13.65), (11,33.4,13.65);
-
-create table t2_double(a int, b double, c double);
-insert into t2_double values
- (1,22.4,14.3333), (1,12.5,18.9), (2,22.4,18.9),
- (4,33.4,14.3333), (5,22.4,13.65), (7,17.89,18.9),
- (6,33.4,14.3333), (10,31.4,13.65), (12,33.4,13.65);
-
-create table t1_char(a char, b char(8), c int);
-insert into t1_char values
- ('a','Ivan',1), ('b','Vika',2), ('b','Inga',6), ('c','Vika',7),
- ('b','Ivan',7), ('a','Alex',6), ('b','Inga',5), ('d','Ron',9),
- ('d','Harry',2), ('d','Hermione',3), ('c','Ivan',3), ('c','Harry',4);
-
-create table t2_char(a char, b char(8), c int);
-insert into t2_char values
- ('b','Ivan',1), ('c','Vinny',3), ('c','Inga',9), ('a','Vika',1),
- ('c','Ivan',2), ('b','Ali',6), ('c','Inga',2), ('a','Ron',9),
- ('d','Harry',1), ('b','Hermes',3), ('b','Ivan',11), ('b','Harry',4);
-
-create table t1_decimal (a decimal(3,1), b decimal(3,1), c int);
-insert into t1_decimal values
- (1,1,23),(2,2,11),(3,3,16),
- (1,1,12),(1,1,14),(2,3,15),
- (2,1,13),(2,3,11),(3,3,16);
-
-create table t2_decimal (a decimal(3,1), b decimal(3,1), c int);
-insert into t2_decimal values
- (2,1,13),(2,2,11),(3,3,16),
- (1,3,22),(1,3,14),(2,2,15),
- (2,1,43),(2,3,11),(2,3,16);
-
-create view v1 as select a, b, max(c) as max_c, avg(c) as avg_c from t1
- group by a,b having max_c < 707;
-
-create view v2 as select a, b, max(c) as max_c, avg(c) as avg_c from t1
- where t1.a>5 group by a,b having max_c < 707;
-
-create view v3 as select a, b, min(c) as min_c from t1
- where t1.a<10 group by a,b having min_c > 109;
-
-create view v4 as
- select a, b, min(max_c) as min_c from v1
- where (v1.a<15) group by a,b;
-
-create view v_union as
- select a, b, min(c) as c from t1
- where t1.a<10 group by a,b having c > 109
- union
- select a, b, max(c) as c from t1
- where t1.b>10 group by a,b having c < 300;
-
-create view v2_union as
- select a, b, min(c) as c from t1
- where t1.a<10 group by a,b having c > 109
- union
- select a, b, max(c) as c from t1
- where t1.b>10 group by a,b having c < 300
- union
- select a, b, avg(c) as c from t1
- where t1.c>300 group by a,b having c < 707;
-
-create view v3_union as
- select a, b, (a+1) as c from t1
- where t1.a<10
- union
- select a, b, c from t1
- where t1.b>10 and t1.c>100;
-
-create view v4_union as
- select a, b, max(c)-100 as c from t1
- where t1.a<10 group by a,b having c > 109
- union
- select a, b, (c+100) as c from t1
- where t1.b>10;
-
-create view v_double as
- select a, avg(a/4) as avg_a, b, c from t1_double
- where (b>12.2) group by b,c having (avg_a<22.333);
-
-create view v_char as
- select a, b, max(c) as max_c from t1_char
- group by a,b having max_c < 9;
-
-create view v_decimal as
- select a, b, avg(c) as avg_c from t1_decimal
- group by a,b having (avg_c>12);
-
---echo # conjunctive subformula : pushing into HAVING
-let $query= select * from v1,t2 where (v1.max_c>214) and (t2.a>v1.a);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-let $query=
- select * from
- (select a, b, max(c) as max_c, avg(c) as avg_c from t1
- group by a,b having max_c < 707) v1,
- t2 where (v1.a=t2.a) and (v1.max_c>300);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # extracted or formula : pushing into HAVING
-let $query=
- select * from v1,t2 where
- ((v1.max_c>400) and (t2.a>v1.a)) or ((v1.max_c<135) and (t2.a<v1.a));
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-let $query=
- select * from v1,t2 where
- ((v1.max_c>300) and (v1.avg_c>t2.d) and (v1.b=t2.b)) or
- ((v1.max_c<135) and (v1.max_c<t2.c) and (v1.a=t2.a));
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # conjunctive subformula : pushing into WHERE
-let $query= select * from v1,t2 where (v1.a>6) and (t2.b>v1.b);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-let $query= select * from v2,t2 where (v2.b>25) and (t2.a<v2.a);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # extracted or formula : pushing into WHERE
-let $query=
- select * from v1,t2 where
- ((v1.a>7) and (t2.c<v1.max_c)) or ((v1.a<2) and (t2.b<v1.b));
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-let $query=
- select * from v2,t2 where
- ((v2.a>7) and (t2.c<v2.max_c)) or ((v2.a>5) and (t2.b<v2.b));
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-let $query=
- select * from v1,t2 where
- ((v1.a>4) and (v1.b>t2.b) and (v1.max_c=t2.d)) or
- ((v1.a<2) and (v1.max_c<t2.c) and (v1.max_c=t2.d));
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # conjunctive subformulas : pushing into HAVING and WHERE
-let $query=
- select * from v1,t2 where (v1.a<2) and (v1.max_c>400) and (t2.b>v1.b);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-let $query=
- select * from v_double as v,t2_double as t where
- (v.a=t.a) and (v.avg_a>0.45) and (v.b>10);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-let $query=
- select * from v_decimal as v,t2_decimal as t where
- (v.a=t.a) and (v.avg_c>15) and (v.b>1);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # extracted or formula : pushing into HAVING and WHERE
-let $query=
- select * from v1,t2 where
- ((v1.a>7) and (v1.max_c>300) and (t2.c<v1.max_c)) or
- ((v1.a<4) and (v1.max_c<500) and (t2.b<v1.b));
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-let $query=
- select * from v1,t2 where ((v1.a<2) and (v1.max_c>120)) or (v1.a>7);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # extracted or formulas : pushing into WHERE and HAVING
-let $query=
- select * from v1,t2 where
- ((v1.a<2) and (v1.max_c>120) and (v1.b=t2.b)) or (v1.a>7);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-let $query=
- select * from v1,t2 where
- ((v1.a<2) and (v1.max_c<200) and (t2.c>v1.max_c) and (v1.max_c=t2.d)) or
- ((v1.a>4) and (v1.max_c<500) and (t2.b<v1.b) and (v1.max_c=t2.c));
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # prepare of a query containing extracted or formula
-prepare stmt from "select * from v1,t2 where
- ((v1.max_c>400) and (t2.a>v1.a)) or ((v1.max_c<135) and (t2.a<v1.a));";
-execute stmt;
-execute stmt;
-deallocate prepare stmt;
-prepare stmt from
- "explain format=json select * from v1,t2 where
- ((v1.max_c>400) and (t2.a>v1.a)) or ((v1.max_c<135) and (t2.a<v1.a));";
-execute stmt;
-execute stmt;
-deallocate prepare stmt;
-
---echo # conjunctive subformula : pushing into WHERE
---echo # pushing equalities
-let $query=
- select * from v1,t2 where (t2.a=v1.a) and (v1.b=t2.b) and (v1.a=1);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-let $query= select * from v1,t2 where (v1.a=5) and (v1.max_c=t2.d);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # conjunctive subformula : pushing into WHERE using equalities
-let $query= select * from v1,t2 where (t2.a<5) and (v1.a=t2.a);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-let $query=
- select * from v1,t2 where (v1.a=v1.b) and (v1.a=t2.a);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # conjunctive subformula : pushing into HAVING using equalities
-let $query= select * from v1,t2 where (t2.c>150) and (v1.max_c=t2.c);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # extracted and formula : pushing into WHERE
---echo # pushing equalities
-let $query=
- select * from v1,t2 where (v1.a=v1.b) and (v1.a=t2.a) and (v1.a=3);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-let $query=
- select * from v1,t2 where (v1.a=1) and (v1.b=21) and (t2.a=2);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-let $query=
- select * from v_char as v,t2_char as t where
- (v.a='c') and (v.b<'Hermes') and ((v.b=t.b) or (v.max_c>20));
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # extracted and formula : pushing into WHERE using equalities
---echo # pushing equalities
-let $query=
-select * from v_decimal as v,t2_decimal as t where
- (v.a=v.b) and (v.b=t.b) and ((t.b>1) or (v.a=1));
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # extracted or formula : pushing into HAVING using equalities
-let $query=
- select * from v1,t2
- where ((t2.a<4) and (v1.a=t2.a)) or ((t2.c>150) and (v1.max_c=t2.c));
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # conjunctive subformulas : pushing into WHERE and HAVING using equalities
-let $query=
- select * from v1,t2
- where ((t2.a>5) and (v1.a=t2.a)) and ((t2.c>250) and (v1.max_c=t2.c));
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # conjunctive subformulas : pushing into WHERE and HAVING
---echo # pushing equalities
-let $query=
- select * from
- (select a, b, max(c) as max_c, avg(c) as avg_c from t1
- group by a,b having max_c < 707) v1,
- t2 where (v1.a=8) and (v1.a=t2.a) and (v1.max_c=404);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # conjunctive subformulas : pushing into WHERE and HAVING
-let $query=
- select * from v1,t2 where
- (v1.a>3) and (v1.max_c>200) and (t2.b<v1.b) and (t2.d=v1.max_c);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # conjunctive subformula : pushing into WHERE
---echo # extracted or formula : pushing into HAVING using equalities
---echo # pushing equalities
-let $query=
- select * from v_double as v,t2_double as t where
- (v.b=v.c) and (v.c=t.c) and ((t.c>10) or (v.a=1));
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # conjunctive subformula : pushing into WHERE
---echo # extracted or formula : pushing into HAVING using equalities
-let $query=
- select * from v_double as v,t2_double as t where
- (((v.a>0.2) or (v.b<17)) or (t.c>17)) and (t.c=v.c) and (v.c>18);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # extracted or formula : pushing into WHERE
---echo # conjunctive subformula : pushing into HAVING
---echo # pushing equalities
-let $query=
- select * from v_decimal as v,t2_decimal as t where
- (((v.a>4) or (v.a=2)) or (v.b>3)) and (v.avg_c=13);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-let $query=
- select * from
- (select a, b, max(c) as max_c, avg(c) as avg_c from t1
- where t1.a>5 group by a,b having max_c < 707) v1,
- t2 where (v1.a=t2.a) and (v1.max_c>300) and (v1.a=v1.b);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # nothing to push
-let $query=
- select * from v1,t2 where (t2.a<2) and (t2.c>900);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.b=t2.b);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-let $query=
- select * from v1,t2 where
- (t2.a=v1.a) or (v1.b=t2.b) and ((v1.a=1) or (v1.a=6));
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-let $query=
- select * from v1,t2 where (v1.a=1) or (v1.b=21) or (t2.a=2);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-let $query=
- select * from v1,t2 where
- (t2.a<2) and (t2.c>900) and ((v1.a<t2.a) or (t2.a<11));
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using several derived tables : nothing to push
-let $query= select * from v1,v2,t2 where
- (v1.a=v2.a) and (v1.a=t2.a) and (v2.b<50);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-let $query=
- select * from v1,v2,t2 where
- ((v1.a=v2.a) or (v1.a=t2.a)) and (t2.b<50) and (v1.b=v2.b);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-let $query=
- select * from v1,v2,t2 where
- ((v1.a=v2.a) and (v1.a=t2.a)) or ((v2.b>13) and (t2.c<115));
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using several derived tables : pushing in all tables
---echo # conjunctive subformula : pushing into HAVING
---echo # extracted or formula : pushing into WHERE
---echo # pushing equalities
-let $query=
- select * from v1,v2,t2 where ((v1.a=v2.a) or (v1.a=t2.a)) and
- ((v2.b<50) or (v2.b=19)) and (v1.max_c<300);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using several derived tables : pushing only in one table
---echo # conjunctive subformula : pushing into WHERE
---echo # pushing equalities
-let $query=
- select * from v1,v2,t2 where
- (v1.a=t2.a) and (v1.a=v1.b) and (v1.a=v2.a) and (v2.max_c<300);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using several derived tables : pushing only in one table
---echo # extracted and formula : pushing into WHERE
---echo # conjunctive subformula : pushing into WHERE using equalities
---echo # pushing equalities
-let $query=
- select * from v1,v2,t2 where (v1.a=1) and (v1.b>10) and (v1.b=v2.b);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # extracted or formula : pushing into WHERE
---echo # conjunctive subformula : pushing into WHERE using equalities
---echo # pushing equalities
-let $query=
- select * from v_char as v,t2_char as t where
- (v.a=t.a) and (t.a='b') and ((v.b='Vika') or (v.b='Ali'));
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using several derived tables : pushing in all tables
---echo # extracted or formula : pushing into WHERE
---echo # conjunctive subformulas : pushing into HAVING
---echo # pushing equalities
-let $query=
- select * from v1,v2,v3,t2 where
- ((v1.a=v2.a) or (v1.a=t2.a)) and ((v3.b<50) or (v3.b=33))
- and (v1.max_c<500) and (v3.a=t2.a) and (v2.max_c>300);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using several derived tables : pushing in all tables
---echo # conjunctive subformulas : pushing into HAVING
-let $query=
- select * from
- (select a, b, max(c) as max_c, avg(c) as avg_c from t1
- where t1.a>5 group by a,b having max_c < 707) v1,
- (select a, b, min(c) as min_c from t1
- where t1.a>5 group by a,b having min_c < 707) v2,
- t2 where (v1.a=v2.a) and (v1.b=t2.b) and (v1.max_c>130) and (v2.min_c<130);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using several derived tables : pushing in all tables
---echo # extracted or formulas : pushing into HAVING
---echo # conjunctive subformula : pushing into HAVING
-let $query=
- select * from
- (select a, b, max(c) as max_c, avg(c) as avg_c from t1
- where t1.a>5 group by a,b having max_c < 707) v1,
- (select a, b, min(c) as min_c from t1
- where t1.a>5 group by a,b having min_c < 707) v2,
- (select a, b, avg(c) as avg_c from t1
- where t1.a<8 group by a,b) v3,
- t2 where (v1.a=v2.a) and (v1.b=v3.b) and ((v3.avg_c>170) or (v3.a<5))
- and ((v1.avg_c<400) or (v1.a>1)) and (v2.min_c<200);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # extracted or formula : pushing into HAVING
---echo # conjunctive subformula : pushing into WHERE
-let $query=
- select * from
- (select a, b, max(c) as max_c, avg(c) as avg_c from t1
- group by a,b having max_c < 707) v1,
- t2 where ((v1.a=1) or (v1.max_c<300)) and (v1.b>25);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # extracted and formula : pushing into WHERE
---echo # conjunctive subformula : pushing into HAVING
-let $query=
- select * from
- (select a, b, max(c) as max_c, avg(c) as avg_c from t1
- where t1.a>5 group by a,b having max_c < 707) v1,
- t2 where (v1.a=t2.a) and (v1.max_c>300) and (v1.b<30);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using query with union
---echo # conjunctive subformula : pushing into WHERE
---echo # conjunctive subformulas : pushing into HAVING and WHERE
-let $query=
- select * from v1,t2 where (v1.a<5) and (v1.b=t2.b) and (t2.c>800)
- union
- select * from v1,t2 where (v1.max_c>100) and (v1.a>7) and (t2.d>800);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using query with union
---echo # extracted and formula : pushing into WHERE
---echo # extracted or formula : pushing into HAVING
---echo # pushing equalities
-let $query=
- select * from v1,t2 where (v1.a<5) and (v1.b=t2.b) and (v1.b=19)
- union
- select * from v1,t2 where ((v1.max_c>400) or (v1.avg_c>270)) and (v1.a<t2.a);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using query with union
---echo # extracted or formula : pushing into HAVING
---echo # extracted or formula : pushing into WHERE
---echo # pushing equalities
-let $query=
- select * from v1,t2 where
- ((t2.a=v1.a) or (v1.b=t2.b)) and ((v1.a=1) or (v1.a=6))
- union
- select * from v1,t2 where ((v1.a>3) and (v1.b>27)) or (v1.max_c>550);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using query with union
---echo # extracted or formula : pushing into HAVING
---echo # conjunctive subformulas : pushing into WHERE
---echo # pushing equalities
-let $query=
- select * from v1,t2 where
- ((v1.a=1) and (v1.a=t2.a)) and ((v1.max_c<500) or (v1.avg_c>500))
- union
- select * from v2,t2 where
- ((v2.a<t2.b) or (v2.max_c>200)) and (v2.b>10) and (t2.a<2)
- union
- select * from v2,t2 where
- (v2.max_c=t2.c) and (v2.b<10);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using derived table with union
---echo # conjunctive subformulas : pushing into WHERE and HAVING
-let $query= select * from v_union,t2 where (v_union.a<3) and (v_union.c>100);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using derived table with union
---echo # conjunctive subformula : pushing into WHERE
---echo # extracted or formula : pushing into HAVING
-let $query=
- select * from v_union,t2 where
- ((v_union.a<2) or (v_union.c>800)) and (v_union.b>12);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using derived table with union
---echo # conjunctive subformula : pushing into HAVING
---echo # conjunctive subformula : pushing into WHERE
---echo # pushing equalities
-let $query=
- select * from v_union,t2 where
- (v_union.a=1) and (v_union.a=t2.a) and (v_union.c<200);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-let $query=
- select * from v_char as v,t2_char as t where
- (v.a=t.a) and (v.b='Vika') and (v.max_c>2);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using derived table with union
---echo # using several derived tables : pushing in all tables
---echo # conjunctive subformula : pushing into WHERE using equalities
---echo # pushing equalities
-let $query=
- select * from v_union,v1,t2 where
- (v_union.a=v1.a) and (v1.a=t2.a) and (t2.a=1)
- and ((v_union.c>800) or (v1.max_c>200));
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using derived table with union
---echo # extracted or formula : pushing into WHERE
---echo # conjunctive subformula : pushing into HAVING
---echo # pushing equalities
-let $query=
- select * from v2_union as v,t2 where
- ((v.a=6) or (v.a=8)) and (v.c>200) and (v.a=t2.a);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using derived table with union of selects without aggregation
---echo # extracted conjunctive predicate: pushing in WHERE of both selects
-let $query=
- select * from v3_union as v,t2 where (v.a=t2.a) and (v.c>6);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using derived table with union of selects without aggregation
---echo # extracted conjunctive OR subformula: pushing in WHERE using equalities
-let $query=
- select * from v3_union as v,t2 where (v.a=t2.a) and ((t2.a>1) or (v.b<20));
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using derived table with union of selects without aggregation
---echo # extracted the whole condition: in WHERE of both selects
-let $query=
- select * from v3_union as v,t2 where
- (v.a=t2.a) and ((v.b=19) or (v.b=21)) and ((v.c<3) or (v.c>600));
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using derived table with union of
---echo # a select without aggregation and a select with aggregation
---echo # extracted conjunctive predicate: pushing in WHERE of both selects
-let $query=
- select * from v4_union as v,t2 where (v.a=t2.a) and (v.b<20);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using derived table with union of
---echo # a select without aggregation and a select with aggregation
---echo # extracted subformula: pushing in WHERE of one select
---echo # extracted subformula: pushing in HAVING of the other select
---echo # extracted sub-subformula: pushing in WHERE of the other select
---echo # using an equality in all pushdowns
-let $query=
- select * from v4_union as v,t2 where
- (v.a=t2.a) and ((t2.a<3) or (v.b<40)) and (v.c>500);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using embedded derived table : pushing the same conditions
---echo # using several derived tables : pushing in all tables
---echo # conjunctive subformula : pushing into WHERE
---echo # extracted and formula : pushing into WHERE
-let $query=
-select * from v4,v1 where
- (v4.a<13) and (v1.a>5) and (v1.b>12);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using embedded view : nothing to push
---echo # using several derived tables : pushing only in one table
---echo # conjunctive subformula : pushing into WHERE
-let $query=
- select * from v4,v1,t2 where
- (v4.a=t2.a) and (v4.a=v1.a) and (v1.b>30);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using embedded view : pushing different conditions
---echo # using several derived tables : pushing in all tables
---echo # conjunctive subformula : pushing into WHERE using equalities
---echo # extracted and formula : pushing into WHERE using equalities
---echo # conjunctive subformula : pushing into HAVING
-let $query=
- select * from v4,v1,t2 where
- (v4.a=t2.a) and (v4.a>1) and (v4.a=v1.a) and (v4.min_c>100) and (v1.b<30);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using embedded view : pushing different conditions
---echo # using several derived tables : pushing in all tables
---echo # extracted or formula : pushing into WHERE
---echo # conjunctive subformula : pushing into HAVING
-let $query=
- select * from v4,v1,t2 where
- (((v4.b>10) and (v4.a>1)) or (v4.b<20)) and (v1.max_c>200) and (v1.a=v4.a);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using embedded view : pushing different conditions
---echo # using several derived tables : pushing only in one table
---echo # extracted or formula : pushing into WHERE
---echo # extracted or formula : pushing into HAVING
-let $query=
- select * from v4,v2 where
- ((v4.a>12) and (v4.min_c<300) and (v4.b>13)) or (v4.a<1);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using embedded view : pushing different conditions
---echo # using several derived tables : pushing only in one table
---echo # conjunctive subformula : pushing into WHERE
---echo # conjunctive subformula : pushing into HAVING
---echo # pushing equalities
-let $query=
- select * from v4,v2 where
- (v4.a=v2.b) and (v4.a=v4.b) and (v4.min_c<100);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using embedded view : pushing the same conditions
---echo # using several derived tables : pushing in all tables
---echo # extracted and formula : pushing into WHERE using equalities
---echo # conjunctive subformula : pushing into WHERE
---echo # pushing equalities
-let $query=
- select * from v4,v2 where
- (v4.a=v2.b) and (v4.a=v4.b) and (v2.b<30);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using embedded view : pushing the same conditions
---echo # using several derived tables : pushing in all tables
---echo # extracted or formula : pushing into WHERE using equalities
---echo # extracted and formula : pushing into WHERE using equalities
---echo # pushing equalities
-let $query=
- select * from v4,v2 where
- (v4.a=v2.b) and (v4.a=v4.b) and ((v2.b<30) or (v4.a>2));
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using embedded view : pushing the same conditions
---echo # using several derived tables : pushing in all tables
---echo # extracted or formula : pushing into WHERE
---echo # conjunctive subformula : pushing into WHERE
---echo # pushing equalities
-let $query=
- select * from v4,v2 where
- (((v4.a<12) and (v4.b>13)) or (v4.a>10)) and
- (v4.min_c=v2.max_c) and (v4.min_c>100);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using embedded view : pushing the same conditions
---echo # using several derived tables : pushing only in one table
---echo # extracted or formula : pushing into WHERE
-let $query=
- select * from v4,v2,t2 where
- (((v4.a<12) and (t2.b>13)) or (v4.a>10)) and
- (v4.min_c=t2.c) and (t2.c>100);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-drop view v1,v2,v3,v4;
-drop view v_union,v2_union,v3_union,v4_union;
-drop view v_double,v_char,v_decimal;
-drop table t1,t2,t1_double,t2_double,t1_char,t2_char,t1_decimal,t2_decimal;
-
---echo #
---echo # MDEV-14579: pushdown conditions into materialized views/derived tables
---echo # that are defined with EXIST or/and INTERSECT
---echo #
-
-create table t1 (a int, b int, c int);
-create table t2 (a int, b int, c int);
-
-insert into t1 values
- (1,21,345), (1,33,7), (8,33,114), (1,21,500), (1,19,117), (5,14,787),
- (8,33,123), (9,10,211), (5,16,207), (1,33,988), (5,27,132), (1,21,104),
- (6,20,309), (6,20,315), (1,21,101), (4,33,404), (9,10,800), (1,21,123);
-
-insert into t2 values
- (2,3,207), (1,16,909), (5,14,312),
- (5,33,207), (6,20,211), (1,19,132),
- (8,33,117), (3,21,231), (6,23,303);
-
-create view v1 as
- select a, b, min(c) as c from t1
- where t1.a<9 group by a,b having c < 300
- intersect
- select a, b, min(c) as c from t1
- where t1.b>10 group by a,b having c > 100;
-
---echo # using intersect in view definition
---echo # conjunctive subformulas : pushing into WHERE
-let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a<5);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using intersect in view definition
---echo # conjunctive subformulas : pushing into WHERE
---echo # pushing equalities
-let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a=8);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using intersect in view definition
---echo # conjunctive subformulas : pushing into WHERE using equalities
-let $query= select * from v1,t2 where (v1.a=t2.a) and (t2.a=8);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using intersect in view definition
---echo # conjunctive subformulas : pushing into HAVING
-let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.c>200);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using intersect in view definition
---echo # conjunctive subformulas : pushing into WHERE
---echo # conjunctive subformulas : pushing into HAVING
-let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a<5) and (v1.c>110);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using intersect in view definition
---echo # extracted or formula : pushing into WHERE
-let $query=
- select * from v1,t2 where (v1.a=t2.a) and ((v1.b>27) or (v1.b<19));
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using intersect in view definition
---echo # extracted or formula : pushing into HAVING
-let $query=
- select * from v1,t2 where
- (v1.a=t2.a) and ((v1.c>200) or (v1.c<105));
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using intersect in view definition
---echo # extracted or formula : pushing into WHERE
---echo # extracted or formula : pushing into HAVING using equalities
---echo # pushing equalities
-let $query=
- select * from v1,t2 where
- ((v1.a>3) and (t2.c>110) and (v1.c=t2.c)) or
- ((v1.a=1) and (v1.c<110));
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using intersect in view definition
---echo # prepare of a query
---echo # conjunctive subformulas : pushing into WHERE
---echo # conjunctive subformulas : pushing into HAVING
-prepare stmt from "select * from v1,t2
- where (v1.a=t2.a) and (v1.a<5) and (v1.c>110);";
-execute stmt;
-execute stmt;
-deallocate prepare stmt;
-
---echo # using intersect in derived table definition
---echo # extracted or formula : pushing into WHERE using equalities
---echo # extracted or formula : pushing into HAVING
---echo # pushing equalities
-let $query=
- select *
- from t2,
- (select a, b, min(c) as c from t1
- where t1.a<9 group by a,b having c < 300
- intersect
- select a, b, min(c) as c from t1
- where t1.b>10 group by a,b having c > 100) as d1
- where
- (d1.b=t2.b) and
- (((t2.b>13) and (t2.c=909)) or
- ((d1.a<4) and (d1.c<200)));
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-drop view v1;
-
-create view v1 as
- select a, b, max(c) as c from t1
- where t1.a<9 group by a,b having c > 200
- except
- select a, b, max(c) as c from t1
- where t1.b>10 group by a,b having c < 300;
-
---echo # using except in view definition
---echo # conjunctive subformulas : pushing into WHERE
-let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a<5);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using except in view definition
---echo # conjunctive subformulas : pushing into WHERE
---echo # pushing equalities
-let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a=6);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using except in view definition
---echo # conjunctive subformulas : pushing into WHERE using equalities
-let $query= select * from v1,t2 where (v1.a=t2.a) and (t2.a=6);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using except in view definition
---echo # conjunctive subformulas : pushing into HAVING
-let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.c>500);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using except in view definition
---echo # conjunctive subformulas : pushing into WHERE
---echo # conjunctive subformulas : pushing into HAVING
-let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a<5) and (v1.c>500);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using except in view definition
---echo # extracted or formula : pushing into WHERE
-let $query=
- select * from v1,t2 where (v1.a=t2.a) and ((v1.b>27) or (v1.b<19));
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using except in view definition
---echo # extracted or formula : pushing into HAVING
-let $query=
- select * from v1,t2 where
- (v1.a=t2.a) and ((v1.c<400) or (v1.c>800));
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using except in view definition
---echo # extracted or formula : pushing into WHERE
---echo # extracted or formula : pushing into HAVING using equalities
---echo # pushing equalities
-let $query=
- select * from v1,t2 where
- (v1.c=t2.c) and
- ((v1.a>1) and (t2.c<500)) or
- ((v1.a=1) and (v1.c>500));
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
---echo # using except in view definition
---echo # prepare of a query
---echo # conjunctive subformulas : pushing into WHERE
---echo # conjunctive subformulas : pushing into HAVING
-prepare stmt from "select * from v1,t2
- where (v1.a=t2.a) and (v1.a<5) and (v1.c>500);";
-execute stmt;
-execute stmt;
-deallocate prepare stmt;
-
---echo # using except in view definition
---echo # extracted or formula : pushing into WHERE using equalities
---echo # extracted or formula : pushing into HAVING
---echo # pushing equalities
-let $query=
- select *
- from t2,
- (select a, b, max(c) as c from t1
- where t1.a<9 group by a,b having c > 200
- except
- select a, b, max(c) as c from t1
- where t1.b>10 group by a,b having c < 300) as d1
- where
- (d1.b=t2.b) and
- (((t2.b>13) and (t2.c=988)) or
- ((d1.a>4) and (d1.c>500)));
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-drop view v1;
-
---echo # using union and intersect in view definition
---echo # conjunctive subformulas : pushing into WHERE and HAVING
-create view v1 as
- select a, b, min(c) as c from t1
- where t1.a<9 group by a,b having c > 200
- union
- select a, b, max(c) as c from t1
- where t1.b>10 group by a,b having c < 300
- intersect
- select a, b, max(c) as c from t1
- where t1.a>3 group by a,b having c < 530;
-
-let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a>5) and (v1.c>200);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-drop view v1;
-
---echo # using union and intersect in view definition
---echo # conjunctive subformulas : pushing into WHERE and HAVING
-create view v1 as
- select a, b, min(c) as c from t1
- where t1.a<9 group by a,b having c > 200
- intersect
- select a, b, max(c) as c from t1
- where t1.a>3 group by a,b having c < 500
- union
- select a, b, max(c) as c from t1
- where t1.b>10 group by a,b having c < 300;
-
-let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<200);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-drop view v1;
-
---echo # using union and except in view definition
---echo # conjunctive subformulas : pushing into WHERE and HAVING
-create view v1 as
- select a, b, min(c) as c from t1
- where t1.a<9 group by a,b having c > 200
- union
- select a, b, max(c) as c from t1
- where t1.b>10 group by a,b having c < 300
- except
- select a, b, max(c) as c from t1
- where t1.a>3 group by a,b having c < 530;
-
-let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a>5) and (v1.c>200);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-drop view v1;
-
---echo # using union and except in view definition
---echo # conjunctive subformulas : pushing into WHERE and HAVING
-create view v1 as
- select a, b, min(c) as c from t1
- where t1.a<9 group by a,b having c > 200
- except
- select a, b, max(c) as c from t1
- where t1.a>3 group by a,b having c < 500
- union
- select a, b, max(c) as c from t1
- where t1.b>10 group by a,b having c < 300;
-
-let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<200);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-drop view v1;
-
---echo # using except and intersect in view definition
---echo # conjunctive subformulas : pushing into WHERE and HAVING
-create view v1 as
- select a, b, max(c) as c from t1
- where t1.b>10 group by a,b having c < 300
- intersect
- select a, b, max(c) as c from t1
- where t1.a<7 group by a,b having c < 500
- except
- select a, b, max(c) as c from t1
- where t1.a<9 group by a,b having c > 150;
-
-let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<150);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-drop view v1;
-
---echo # using except and intersect in view definition
---echo # conjunctive subformulas : pushing into WHERE and HAVING
-create view v1 as
- select a, b, max(c) as c from t1
- where t1.b>10 group by a,b having c < 300
- except
- select a, b, max(c) as c from t1
- where t1.a<9 group by a,b having c > 150
- intersect
- select a, b, max(c) as c from t1
- where t1.a<7 group by a,b having c < 500;
-
-let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<130);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-drop view v1;
-
---echo # using except, intersect and union in view definition
---echo # conjunctive subformulas : pushing into WHERE and HAVING
-create view v1 as
- select a, b, max(c) as c from t1
- where t1.b>10 group by a,b having c < 300
- except
- select a, b, max(c) as c from t1
- where t1.a<9 group by a,b having c > 150
- intersect
- select a, b, max(c) as c from t1
- where t1.a<7 group by a,b having c < 500
- union
- select a, b, max(c) as c from t1
- where t1.a<7 group by a,b having c < 120;
-
-let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.c<130);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-drop view v1;
-
---echo # using intersect in view definition
---echo # using embedded view
---echo # conjunctive subformulas : pushing into WHERE and HAVING
-create view v1 as
- select a, b, max(c) as c from t1
- where t1.b>10 group by a,b having c < 300
- intersect
- select a, b, max(c) as c from t1
- where t1.a<9 group by a,b having c > 120;
-
-create view v2 as
- select a, b, max(c) as c from v1
- where v1.a<7 group by a,b;
-
-let $query= select * from v2,t2 where (v2.a=t2.a) and (v2.a>4) and (v2.c<150);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-drop view v1,v2;
-
---echo # using except in view definition
---echo # using embedded view
---echo # conjunctive subformulas : pushing into WHERE and HAVING
-create view v1 as
- select a, b, max(c) as c from t1
- where t1.b>10 group by a,b having c < 300
- except
- select a, b, max(c) as c from t1
- where t1.a<9 group by a,b having c > 150;
-
-create view v2 as
- select a, b, max(c) as c from v1
- where v1.a<7 group by a,b;
-
-let $query= select * from v2,t2 where (v2.a=t2.a) and (v2.a>4) and (v2.c<150);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-drop view v1,v2;
-
---echo # using intersect in view definition
---echo # conditions are pushed in different parts of selects
---echo # conjunctive subformulas : pushing into WHERE and HAVING
-create view v1 as
- select a, b, max(c) as c from t1
- where t1.a<9 group by a having c > 300
- intersect
- select a, b, max(c) as c from t1
- where t1.b<21 group by b having c > 200;
-
-let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a>4) and (v1.b>12) and (v1.c<450);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-drop view v1;
-
---echo # using except in view definition
---echo # conditions are pushed in different parts of selects
---echo # conjunctive subformulas : pushing into WHERE and HAVING
-create view v1 as
- select a, b, max(c) as c from t1
- where t1.b>20 group by a having c > 300
- except
- select a, b, max(c) as c from t1
- where t1.a<7 group by b having c > 150;
-
-let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a<2) and (v1.b<30) and (v1.c>450);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-drop view v1;
-
---echo # using except and union in view definition
---echo # conditions are pushed in different parts of selects
---echo # conjunctive subformulas : pushing into HAVING
---echo # extracted or formula : pushing into WHERE
---echo # extracted or formula : pushing into HAVING
-create view v1 as
- select a, b, max(c) as c from t1
- where t1.b>20 group by a having c > 300
- except
- select a, b, max(c) as c from t1
- where t1.a<7 group by b having c > 150;
-
-let $query= select * from v1,t2 where (v1.a=t2.a) and ((v1.a<2) or (v1.a<5)) and (v1.c>450);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-drop view v1;
-
---echo # using union and intersect in view definition
---echo # conditions are pushed in different parts of selects
---echo # conjunctive subformulas : pushing into WHERE and HAVING
-create view v1 as
- select a, b, max(c) as c from t1
- where t1.a<9 group by a having c > 100
- intersect
- select a, b, max(c) as c from t1
- where t1.a>3 group by b having c < 800
- union
- select a, b, max(c) as c from t1
- where t1.b>10 group by a,b having c > 300;
-
-let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.a>1) and (v1.b > 12) and (v1.c>400);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-drop view v1;
-
-create table t3 (a int, b int, c int);
-insert into t3 values
- (1,21,345), (2,33,7), (8,33,114), (3,21,500), (1,19,107), (5,14,787),
- (4,33,123), (9,10,211), (11,16,207), (10,33,988), (5,27,132), (12,21,104),
- (6,20,309), (16,20,315), (16,21,101), (18,33,404), (19,10,800), (10,21,123),
- (17,11,708), (6,20,214);
-
-create index i1 on t3(a);
-
---echo # conjunctive subformulas : pushing into WHERE
---echo # pushed condition gives range access
-create view v1 as
- select a, b, max(c) as max_c from t3
- where a>0 group by a;
-
-let $query= select * from v1,t2 where (v1.b=t2.b) and (v1.a<5);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-drop view v1;
-
---echo # using union in view definition
---echo # conjunctive subformulas : pushing into WHERE
---echo # pushed condition gives range access
-create view v1 as
- select a, b, max(c) as c from t3
- where t3.a>1 group by a
- union
- select a, b, max(c) as c from t3
- where t3.a>2 group by a;
-
-let $query= select * from v1,t2 where (v1.b=t2.b) and (v1.a<4);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-drop view v1;
-
---echo # using union in view definition
---echo # conjunctive subformulas : pushing into WHERE
---echo # pushed condition gives range access in one of the selects
-create view v1 as
- select a, b, max(c) as c from t3
- where t3.a>1 group by a
- union
- select a, b, max(c) as c from t3
- where t3.b<21 group by b;
-
-let $query= select * from v1,t2 where (v1.b=t2.b) and (v1.a<3);
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-drop view v1;
-
-alter table t3 drop index i1;
-
-drop table t1,t2,t3;
-
---echo #
---echo # MDEV-10782: condition extracted from a multiple equality
---echo # pushed into HAVING
---echo #
-
-CREATE TABLE t1 (i int);
-INSERT INTO t1 VALUES (1),(2);
-EXPLAIN EXTENDED
-SELECT *
- FROM ( SELECT * FROM ( SELECT MIN(i) as f FROM t1 ) sq1 ) AS sq2
- WHERE f = 8;
-SELECT *
- FROM ( SELECT * FROM ( SELECT MIN(i) as f FROM t1 ) sq1 ) AS sq2
- WHERE f = 8;
-SELECT *
- FROM ( SELECT * FROM ( SELECT MIN(i) as f FROM t1 ) sq1 ) AS sq2
- WHERE f = 1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-10783: pushdown into constant view
---echo #
-
-CREATE TABLE t1 (i int) ENGINE=MyISAM;
-CREATE VIEW v AS SELECT 5;
-SELECT * FROM t1 WHERE 1 IN ( SELECT * FROM v );
-DROP VIEW v;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-10785: second execution of a query with condition
---echo # pushed into view
---echo #
-
-CREATE TABLE t1 (i int);
-CREATE VIEW v1 AS SELECT i FROM t1 WHERE i < 5;
-CREATE FUNCTION f (in1 int) RETURNS int RETURN in1;
-CREATE VIEW v2 AS SELECT * FROM v1 GROUP BY i;
-PREPARE stmt FROM "SELECT * FROM v2 WHERE f(0) <> 2";
-EXECUTE stmt;
-EXECUTE stmt;
-DROP FUNCTION f;
-DROP VIEW v2,v1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-10884: condition pushdown into derived specified by
---echo # 1. unit with SELECT containing ORDER BY ... LIMIT
---echo # 2. unit containing global ORDER BY ... LIMIT
---echo #
-
-create table t1(a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-select a from t1 order by a limit 5;
-
-set statement optimizer_switch='condition_pushdown_for_derived=off' for
-select * from (select a from t1 order by a limit 5) t where t.a not in (1,2,3);
-set statement optimizer_switch='condition_pushdown_for_derived=on' for
-select * from (select a from t1 order by a limit 5) t where t.a not in (1,2,3);
-
-select a from t1 where a < 4 union select a from t1 where a > 5
- order by a limit 5;
-set statement optimizer_switch='condition_pushdown_for_derived=off' for
-select * from
-(select a from t1 where a < 4 union select a from t1 where a > 5
- order by a limit 5) t where t.a not in (2,9);
-set statement optimizer_switch='condition_pushdown_for_derived=on' for
-select * from
-(select a from t1 where a < 4 union select a from t1 where a > 5
- order by a limit 5) t where t.a not in (2,9);
-
-drop table t1;
-
---echo #
---echo # MDEV-11072: pushdown of the condition obtained
---echo # after constant row substitution
---echo #
-
-CREATE TABLE t1 (a INT) ENGINE=MyISAM;
-CREATE TABLE t2 (b INT) ENGINE=MyISAM;
-CREATE OR REPLACE VIEW v2 AS SELECT * FROM t2;
-CREATE TABLE t3 (c INT) ENGINE=MyISAM;
-CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v3 AS SELECT * FROM t3;
-
-SELECT * FROM t1 WHERE a IN (
- SELECT b FROM v2 WHERE b < a OR b IN (
- SELECT c FROM v3 WHERE c = a
- )
-);
-
-INSERT INTO t1 VALUES (2);
-INSERT INTO t2 VALUES (3), (2);
-INSERT INTO t3 VALUES (4), (1), (2), (7);
-
-SELECT * FROM t1 WHERE a IN (
- SELECT b FROM v2 WHERE b < a OR b IN (
- SELECT c FROM v3 WHERE c = a
- )
-);
-
-EXPLAIN FORMAT=JSON
-SELECT * FROM t1 WHERE a IN (
- SELECT b FROM v2 WHERE b < a OR b IN (
- SELECT c FROM v3 WHERE c = a
- )
-);
-
-CREATE TABLE t4 (d INT, e INT) ENGINE=MyISAM;
-INSERT INTO t4 VALUES (1,10),(3,11),(2,10),(2,20),(3,21);
-CREATE OR REPLACE VIEW v4 AS
-SELECT d, sum(e) AS s FROM t4 GROUP BY d;
-
-let $query =
-SELECT * FROM t1 WHERE a IN (
- SELECT b FROM v2 WHERE b < a OR b IN (
- SELECT d FROM v4 WHERE s > a
- )
-);
-
-eval $no_pushdown $query;
-eval $query;
-eval explain $query;
-eval explain format=json $query;
-
-DROP VIEW v2,v3,v4;
-DROP TABLE t1,t2,t3,t4;
-
---echo #
---echo # MDEV-10800: pushdown of the condition obtained
---echo # after constant row substitution
---echo #
-
-
-CREATE TABLE t1 (a INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1);
-
-CREATE TABLE t2 (b INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (3),(4);
-CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2;
-
-SELECT * FROM
-( SELECT * FROM t1
- WHERE EXISTS ( SELECT * FROM v2 WHERE b = a ) ) AS sq;
-
-EXPLAIN FORMAT=JSON
-SELECT * FROM
-( SELECT * FROM t1
- WHERE EXISTS ( SELECT * FROM v2 WHERE b = a ) ) AS sq;
-
-DROP VIEW v2;
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-11102: condition pushdown into materialized inner table
---echo # of outer join is not applied as not being valid
---echo #
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (0),(2);
-
-CREATE TABLE t2 (b INT);
-INSERT INTO t2 VALUES (1),(2);
-
-CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2;
-
-SELECT * FROM t1 LEFT JOIN t2 ON a = b WHERE b IS NULL;
-
-SELECT * FROM t1 LEFT JOIN v2 ON a = b WHERE b IS NULL;
-
-EXPLAIN FORMAT=JSON
-SELECT * FROM t1 LEFT JOIN v2 ON a = b WHERE b IS NULL;
-
-DROP VIEW v2;
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-11103: pushdown condition with ANY subquery
---echo #
-
-CREATE TABLE t1 (i INT);
-CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
-INSERT INTO t1 VALUES (1),(2);
-
-EXPLAIN FORMAT=JSON
-SELECT * FROM v1 WHERE i <= ANY ( SELECT 3 );
-
-SELECT * FROM v1 WHERE i <= ANY ( SELECT 3 );
-
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-11315: condition with outer reference to mergeable derived
---echo #
-
-CREATE TABLE t1 (pk1 INT PRIMARY KEY, a INT, b INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (10,7,1),(11,0,2);
-
-CREATE TABLE t2 (pk2 INT PRIMARY KEY, c INT, d DATETIME) ENGINE=MyISAM;
-INSERT INTO t2 VALUES
- (1,4,'2008-09-27 00:34:58'),
- (2,5,'2007-05-28 00:00:00'),
- (3,6,'2009-07-25 09:21:20');
-
-CREATE VIEW v1 AS SELECT * FROM t1;
-CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2;
-
-SELECT * FROM v1 AS sq
- WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100;
-EXPLAIN FORMAT=JSON
-SELECT * FROM v1 AS sq
- WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100;
-
-SELECT * FROM ( SELECT * FROM t1 ) AS sq
- WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100;
-EXPLAIN FORMAT=JSON
-SELECT * FROM ( SELECT * FROM t1 ) AS sq
- WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100;
-
-DROP VIEW v1,v2;
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-11313: pushdown of the condition obtained
---echo # after constant row substitution
---echo #
-
-CREATE TABLE t1 (a INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(2);
-CREATE TABLE t2 (b INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (50);
-CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
-
-SELECT ( SELECT COUNT(*) FROM v1 WHERE a = t2.b ) AS f FROM t2 GROUP BY f;
-EXPLAIN FORMAT=JSON
-SELECT ( SELECT COUNT(*) FROM v1 WHERE a = t2.b ) AS f FROM t2 GROUP BY f;
-
-CREATE TABLE t3 (a INT, b INT) ENGINE=MYISAM;
-INSERT INTO t3 VALUES (1,10),(3,11),(2,10),(2,20),(3,21);
-CREATE VIEW v2 AS SELECT a, sum(b) AS s FROM t3 GROUP BY a ;
-SELECT ( SELECT COUNT(*) FROM v2 WHERE s < t2.b ) AS f FROM t2 GROUP BY f;
-EXPLAIN FORMAT=JSON
-SELECT ( SELECT COUNT(*) FROM v2 WHERE s < t2.b ) AS f FROM t2 GROUP BY f;
-
-
-DROP VIEW v1,v2;
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # MDEV-10882: pushdown of the predicate with cached value
---echo #
-
-CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL) ENGINE=MyISAM;
-CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
-INSERT INTO t1 VALUES (1,2),(3,4);
-
-CREATE TABLE t2 (c INT NOT NULL) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (5),(6);
-
-SELECT a, GROUP_CONCAT(b) FROM v1
- WHERE b IN ( SELECT COUNT(c) FROM t2 ) GROUP BY a;
-
-EXPLAIN FORMAT=JSON
-SELECT a, GROUP_CONCAT(b) FROM v1
- WHERE b IN ( SELECT COUNT(c) FROM t2 ) GROUP BY a;
-
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-10836: pushdown of the predicate with cached value
---echo #
-
-CREATE TABLE t (pk INT PRIMARY KEY, f INT) ENGINE=MyISAM;
-CREATE ALGORITHM=TEMPTABLE VIEW v AS SELECT * FROM t;
-INSERT INTO t VALUES (1,1),(3,2);
-
-SELECT * FROM v AS v1, v AS v2
- WHERE v2.pk > v1.f AND v1.f IN ( SELECT COUNT(pk) FROM t );
-
-EXPLAIN FORMAT=JSON
-SELECT * FROM v AS v1, v AS v2
- WHERE v2.pk > v1.f AND v1.f IN ( SELECT COUNT(pk) FROM t );
-
-DROP VIEW v;
-DROP TABLE t;
-
---echo #
---echo # MDEV-11488: pushdown of the predicate with cached value
---echo #
-
-CREATE TABLE t1 (i INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(3),(2);
-
-CREATE TABLE t2 (j INT, KEY(j)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (3),(4);
-
-SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq
- WHERE i IN ( SELECT MIN(j) FROM t2 );
-EXPLAIN FORMAT=JSON
-SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq
- WHERE i IN ( SELECT MIN(j) FROM t2 );
-
-UPDATE t2 SET j = 2 WHERE j = 3;
-SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq
- WHERE i IN ( SELECT MIN(j) FROM t2 );
-
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (i FLOAT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1.5),(3.2),(2.71);
-
-CREATE TABLE t2 (j FLOAT, KEY(j)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (3.2),(2.71);
-
-SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq
- WHERE i IN ( SELECT MIN(j) FROM t2 );
-EXPLAIN FORMAT=JSON
-SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq
- WHERE i IN ( SELECT MIN(j) FROM t2 );
-
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (i DECIMAL(10,2)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1.5),(3.21),(2.47);
-
-CREATE TABLE t2 (j DECIMAL(10,2), KEY(j)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (3.21),(4.55);
-
-SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq
- WHERE i IN ( SELECT MIN(j) FROM t2 );
-EXPLAIN FORMAT=JSON
-SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq
- WHERE i IN ( SELECT MIN(j) FROM t2 );
-
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (i VARCHAR(32)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('cc'),('aa'),('ddd');
-
-CREATE TABLE t2 (j VARCHAR(16), KEY(j)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES ('bbb'),('aa');
-
-SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq
- WHERE i IN ( SELECT MIN(j) FROM t2 );
-EXPLAIN FORMAT=JSON
-SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq
- WHERE i IN ( SELECT MIN(j) FROM t2 );
-
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (i DATETIME) ENGINE=MyISAM;
-INSERT INTO t1 VALUES
- ('2008-09-27 00:34:58'),('2007-05-28 00:00:00'), ('2009-07-25 09:21:20');
-
-CREATE TABLE t2 (j DATETIME, KEY(j)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES
- ('2007-05-28 00:00:00'), ('2010-08-25 00:00:00');
-
-SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq
- WHERE i IN ( SELECT MIN(j) FROM t2 );
-EXPLAIN FORMAT=JSON
-SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq
- WHERE i IN ( SELECT MIN(j) FROM t2 );
-
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (i DATE) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('2008-09-27'),('2007-05-28'), ('2009-07-25');
-
-CREATE TABLE t2 (j DATE, KEY(j)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES ('2007-05-28'), ('2010-08-25');
-
-SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq
- WHERE i IN ( SELECT MIN(j) FROM t2 );
-EXPLAIN FORMAT=JSON
-SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq
- WHERE i IN ( SELECT MIN(j) FROM t2 );
-
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (i TIME) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('00:34:58'),('10:00:02'), ('09:21:20');
-
-CREATE TABLE t2 (j TIME, KEY(j)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES ('10:00:02'), ('11:00:10');
-
-SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq
- WHERE i IN ( SELECT MIN(j) FROM t2 );
-EXPLAIN FORMAT=JSON
-SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq
- WHERE i IN ( SELECT MIN(j) FROM t2 );
-
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-11593: pushdown of condition with NULLIF
---echo #
-
-CREATE TABLE t1 (i INT);
-CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
-
-INSERT INTO t1 VALUES (2), (1);
-
-SELECT * FROM v1 WHERE NULLIF(1, i);
-EXPLAIN FORMAT=JSON
-SELECT * FROM v1 WHERE NULLIF(1, i);
-
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-11608: pushdown of the predicate with cached null value
---echo #
-
-CREATE TABLE t1 (c VARCHAR(3));
-CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
-INSERT INTO t1 VALUES ('foo'),('bar');
-
-CREATE TABLE t2 (c VARCHAR(3));
-INSERT INTO t2 VALUES ('foo'),('xyz');
-
-SELECT * FROM v1 WHERE v1.c IN ( SELECT MIN(c) FROM t2 WHERE 0 );
-EXPLAIN FORMAT=JSON
-SELECT * FROM v1 WHERE v1.c IN ( SELECT MIN(c) FROM t2 WHERE 0 );
-
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (d DECIMAL(10,2));
-CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
-INSERT INTO t1 VALUES (5.37),(1.1);
-
-CREATE TABLE t2 (d DECIMAL(10,2));
-INSERT INTO t2 VALUES ('1.1'),('2.23');
-
-SELECT * FROM v1 WHERE v1.d IN ( SELECT MIN(d) FROM t2 WHERE 0 );
-
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-11820: second execution of PS for query
---echo # with false subquery predicate in WHERE
---echo #
-
-CREATE TABLE t1 (c VARCHAR(3)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('foo'),('bar');
-CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
-CREATE TABLE t2 (a INT);
-INSERT INTO t2 VALUES (3), (4);
-
-PREPARE stmt1 FROM
-" SELECT * FROM v1 WHERE 1 IN (SELECT a FROM t2) OR c = 'foo'";
-PREPARE stmt2 FROM
-"EXPLAIN FORMAT=JSON
- SELECT * FROM v1 WHERE 1 IN (SELECT a FROM t2) OR c = 'foo'";
-EXECUTE stmt1;
-EXECUTE stmt2;
-INSERT INTO t2 SELECT a+1 FROM t2;
-INSERT INTO t2 SELECT a+1 FROM t2;
-INSERT INTO t2 SELECT a+1 FROM t2;
-INSERT INTO t2 SELECT a+1 FROM t2;
-INSERT INTO t2 SELECT a+1 FROM t2;
-INSERT INTO t2 SELECT a+1 FROM t2;
-EXECUTE stmt1;
-EXECUTE stmt2;
-DEALLOCATE PREPARE stmt1;
-# the result here will change after the merge with the fix for mdev-11859
-DEALLOCATE PREPARE stmt2;
-
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-12373: pushdown into derived with side effects is prohibited
---echo #
-
-CREATE TABLE sales_documents (
- id int NOT NULL AUTO_INCREMENT,
- sale_id int NULL DEFAULT NULL,
- type tinyint unsigned NULL DEFAULT NULL,
- data text NULL DEFAULT NULL COLLATE 'utf8_unicode_ci',
- date date NULL DEFAULT NULL,
- order_number int unsigned NULL DEFAULT NULL,
- created_at int NULL DEFAULT NULL,
- updated_at int NULL DEFAULT NULL,
- generated tinyint NOT NULL DEFAULT '0',
- synced_at int NOT NULL DEFAULT '0',
- sum decimal(13,2) NOT NULL DEFAULT '0',
- PRIMARY KEY (id)
-);
-
-INSERT INTO sales_documents
-(id, sale_id, type, order_number, data, created_at,
- updated_at, date, generated, synced_at, sum)
-VALUES
-(555, 165, 3, 5, '{}', 1486538300, 1486722835, '2017-02-17', 0, 1486538313, 2320.00),
-(556, 165, 2, 3, '{}', 1486538304, 1486563125, '2017-02-08', 1, 1486538302, 2320.00),
-(557, 158, 2, 2, '{}', 1486538661, 1486538661, '2017-02-08', 0, 1486538660, 2320.00),
-(558, 171, 1, 3, '{}', 1486539104, 1488203405, '2017-02-08', 1, 1486539102, 23230.00),
-(559, 171, 2, 5, '{}', 1486549233, 1487146010, '2017-02-08', 1, 1486549225, 37690.00),
-(560, 172, 1, 1, '{}', 1486658260, 1488203409, '2017-02-09', 1, 1486658256, 40312.00),
-(561, 172, 2, 1, '{}', 1486711997, 1486711997, '2017-02-10', 1, 1486711996, 40312.00),
-(562, 172, 3, 1, '{}', 1486712104, 1486721395, '2017-02-10', 1, 1486712101, 40312.00),
-(563, 171, 3, 2, '{}', 1486712953, 1486720244, '2017-02-10', 1, 1486712910, 23230.00),
-(564, 170, 1, 2, '{}', 1486715948, 1488203410, '2017-02-10', 1, 1486715930, 28873.00),
-(565, 170, 3, 3, '{}', 1486716782, 1486717426, '2017-02-10', 1, 1486716779, 61948.00),
-(566, 166, 3, 4, '{}', 1486720947, 1486720947, '2017-02-10', 1, 1486720945, 4640.00),
-(567, 167, 3, 5, '{}', 1486722741, 1486722783, '2017-02-26', 0, 1486722738, 14755.00),
-(568, 165, 1, 4, '{}', 1486722849, 1486722849, '2017-02-10', 0, 1486722846, 2320.00),
-(569, 173, 2, 2, '{}', 1486723073, 1487071275, '2017-02-10', 1, 1486723071, 14282.00),
-(570, 173, 1, 4, '{}', 1486723100, 1488203412, '2017-02-10', 1, 1486723099, 14282.00),
-(571, 167, 2, 4, '{}', 1486730859, 1486730859, '2017-02-10', 1, 1486730856, 18655.00),
-(572, 167, 1, 5, '{}', 1486730883, 1488203412, '2017-02-10', 1, 1486730877, 18655.00),
-(573, 174, 2, 51, '{}', 1486731622, 1487060259, '2017-02-10', 1, 1486731620, 7140.00),
-(574, 174, 3, 5, '{}', 1486993472, 1486993472, '2017-02-13', 1, 1488216147, 28020.00),
-(575, 174, 1, 6, '{}', 1486993530, 1488203412, '2017-02-13', 1, 1486993505, 7140.00),
-(576, 173, 3, 6, '{}', 1487071425, 1487071425, '2017-02-14', 0, 1487071422, 14282.00),
-(577, 178, 2, 6, '{}', 1487327372, 1487327372, '2017-02-17', 1, 1487327370, 12321.00),
-(578, 177, 2, 7, '{}', 1487327394, 1487327394, '2017-02-17', 0, 1487327391, 4270.00),
-(579, 182, 3, 6, '{}', 1487750589, 1487751693, '2017-02-22', 1, 1487751688, 4270.00),
-(580, 182, 2, 7, '{}', 1487750601, 1487750663, '2017-02-22', 1, 1487750598, 4270.00),
-(581, 182, 1, 7, '{}', 1487750694, 1488203412, '2017-02-22', 1, 1487750692, 4270.00),
-(582, 185, 3, 7, '{}', 1487774051, 1487774051, '2017-02-22', 0, 1487774043, 8913.00),
-(583, 184, 3, 7, '{}', 1487774071, 1487774235, '2017-02-22', 0, 1487774093, 3285.00),
-(584, 184, 2, 8, '{}', 1487774074, 1487774074, '2017-02-22', 0, 1487774073, 3285.00),
-(585, 184, 1, 8, '{}', 1487774081, 1487774081, '2017-02-22', 0, 1487774075, 3285.00),
-(586, 193, 2, 8, '{}', 1487955294, 1487955318, '2017-02-24', 0, 1487955311, 4270.00),
-(587, 193, 1, 8, '{}', 1487955324, 1487955324, '2017-02-24', 0, 1487955320, 4270.00),
-(588, 193, 3, 7, '{}', 1487955341, 1487955341, '2017-02-24', 0, 1487955325, 4270.00),
-(589, 186, 1, 8, '{}', 1487957291, 1487957464, '2017-02-24', 0, 1487957459, 6960.00),
-(590, 186, 2, 8, '{}', 1487957308, 1487957468, '2017-02-24', 0, 1487957465, 6960.00),
-(591, 186, 3, 7, '{}', 1487957312, 1487957473, '2017-02-24', 0, 1487957469, 6960.00),
-(592, 194, 1, 8, '{}', 1488193293, 1488203412, '2017-02-27', 1, 1488193280, 2320.00),
-(593, 194, 2, 8, '{}', 1488193304, 1488193304, '2017-02-27', 1, 1488193303, 2320.00),
-(594, 210, 1, 9, '{}', 1488198896, 1488198896, '2017-02-27', 0, 1488198885, 4270.00),
-(595, 210, 2, 12, '{}', 1488198901, 1488198901, '2017-02-27', 1, 1488532585, 4270.00),
-(596, 210, 3, 10, '{}', 1488198904, 1488198904, '2017-02-27', 1, 1488532565, 4270.00),
-(597, 209, 2, 9, '{}', 1488200016, 1488450772, '2017-02-27', 1, 1488450449, 4270.00),
-(598, 209, 1, 9, '{}', 1488200020, 1488200063, '2017-02-27', 1, 1488200017, 4271.00),
-(599, 209, 3, 7, '{}', 1488200053, 1488200053, '2017-02-27', 0, 1488200021, 4271.00),
-(600, 211, 2, 10, '{}', 1488216265, 1489402027, '2017-02-27', 1, 1488216264, 2320.00),
-(601, 211, 3, 7, '{}', 1488216281, 1488216281, '2017-02-27', 1, 1488216276, 2320.00),
-(602, 211, 1, 10, '{}', 1488216283, 1488216283, '2017-02-27', 1, 1488216282, 2320.00),
-(603, 198, 2, 11, '{}', 1488280125, 1488280125, '2017-02-28', 0, 1488280095, 4270.00),
-(604, 198, 1, 11, '{}', 1488280160, 1488280160, '2017-02-28', 0, 1488280126, 4270.00),
-(605, 198, 3, 8, '{}', 1488280440, 1488280440, '2017-02-28', 0, 1488280435, 4270.00),
-(606, 212, 1, 12, '{}', 1488286301, 1489402168, '2017-02-28', 1, 1488286295, 13825.00),
-(607, 212, 3, 8, '{}', 1488289644, 1488289690, '2017-02-28', 1, 1488289642, 25295.00),
-(608, 212, 2, 13, '{}', 1488290350, 1488290431, '2017-02-28', 1, 1488290347, 13133.75),
-(609, 213, 1, 11, '{}', 1488529470, 1488529470, '2017-03-03', 1, 1488529461, 5660.00),
-(610, 213, 2, 11, '{}', 1488529484, 1488529484, '2017-03-03', 1, 1488529479, 5660.00),
-(611, 213, 3, 9, '{}', 1488529493, 1488529493, '2017-03-03', 1, 1488529489, 5660.00),
-(612, 197, 2, 13, '{}', 1489400715, 1489400715, '2017-03-13', 0, 1489398959, 4270.00),
-(613, 219, 3, 11, '{}', 1490084337, 1490181958, '2017-03-21', 1, 1490084334, 73526.00),
-(614, 216, 3, 11, '{}', 1490085757, 1490086717, '2017-03-21', 0, 1490085755, 5377.00);
-
-SELECT * FROM
-(SELECT @row := @row + 1 as row, a.* from (
- SELECT t.order_number
- FROM sales_documents t
- WHERE
- t.type = 2 AND
- t.date >= '2017-01-01' AND
- t.date <= '2017-12-31' AND
- t.order_number IS NOT NULL AND
- t.generated = 1
- GROUP BY t.order_number
-) a, (SELECT @row := 0) r) t
-WHERE row <> order_number;
-
-DROP TABLE sales_documents;
-
---echo #
---echo # MDEV-12845: pushdown from merged derived using equalities
---echo #
-
-create table t1 (a int);
-insert into t1 values
- (4), (8), (5), (3), (10), (2), (7);
-
-create table t2 (b int, c int);
-insert into t2 values
- (2,1), (5,2), (2,2), (4,1), (4,3),
- (5,3), (2,4), (4,6), (2,1);
-
-create view v1 as
-select b, sum(c) as s from t2 group by b;
-
-create view v2 as
-select distinct b, c from t2;
-
-create view v3 as
-select b, max(c) as m from t2 group by b;
-
-let $q1=
-select b
-from ( select t1.a, v1.b, v1.s from t1, v1 where t1.a = v1.b ) as t
-where b > 2;
-
-eval $q1;
-eval explain format=json $q1;
-
-let $q2=
-select a
-from ( select t1.a, v1.b, v1.s from t1, v1 where t1.a = v1.b ) as t
-where a > 2;
-
-eval $q2;
-eval explain format=json $q2;
-
-let $q3=
-select a
-from ( select t1.a, v2.b, v2.c from t1, v2 where t1.a = v2.b ) as t
-where a > 2;
-
-eval $q3;
-eval explain format=json $q3;
-
-let $q4=
-select a
-from ( select t1.a, v3.b, v3.m from t1, v3 where t1.a = v3.m ) as t
-where a > 2;
-
-eval $q4;
-eval explain format=json $q4;
-
-drop view v1,v2,v3;
-drop table t1,t2;
-
---echo #
---echo # MDEV-13166: pushdown from merged derived
---echo #
-
-CREATE TABLE t1 (i int) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(2);
-CREATE VIEW v1 AS SELECT MAX(i) AS f FROM t1;
-
-let $q=
-SELECT * FROM ( SELECT * FROM v1 ) AS sq WHERE f > 0;
-
-eval $q;
-eval explain format=json $q;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-13193: pushdown of equality extracted from multiple equality
---echo #
-
-CREATE TABLE t1 (i1 int, KEY(i1)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE TABLE t2 (i2 int) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (2),(4);
-
-CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2;
-
-let $q=
-SELECT * FROM t1, ( SELECT * FROM v2 ) AS sq
- WHERE i1 = 1 AND ( i1 = i2 OR i1 = 2 );
-
-eval $q;
-eval explain format=json $q;
-
-DROP VIEW v2;
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-14237: derived with regexp_substr() in select list
---echo #
-
-create table t1 (a char(8));
-insert into t1 values ('b'), ('a'), ('xx');
-
-let $q=
-select *
-from ( select distinct regexp_substr(t1.a,'^[A-Za-z]+') as f from t1) as t
-where t.f = 'a' or t.f = 'b';
-
-eval $q;
-eval explain format=json $q;
-
-drop table t1;
-
---echo #
---echo # MDEV-13454: consequence of mdev-14368 fixed for 5.5
---echo #
-
-SET sql_mode = 'ONLY_FULL_GROUP_BY';
-
-create table t1 (id int, id2 int);
-insert into t1 values (1,1),(2,3),(3,4),(7,2);
-
-create table t2(id2 int);
-insert t2 values (1),(2),(3);
-
-let $q=
-SELECT * FROM t1
- LEFT OUTER JOIN
- (SELECT id2, COUNT(*) as ct FROM t2 GROUP BY id2) vc USING (id2)
-WHERE (vc.ct>0);
-
-eval $q;
-eval EXPLAIN FORMAT=JSON $q;
-
-DROP TABLE t1,t2;
-
-SET sql_mode = DEFAULT;
-
---echo #
---echo # MDEV-10855: Pushdown into derived with window functions
---echo #
-
-set @save_optimizer_switch= @@optimizer_switch;
-set optimizer_switch='split_materialized=off';
-
-create table t1 (a int, c varchar(16));
-insert into t1 values
-(8,'aa'), (5,'cc'), (1,'bb'), (2,'aa'), (9,'cc'),
-(7,'aa'), (2,'aa'), (7,'bb');
-
-create table t2 (a int, b int, c varchar(16), index idx(a,c));
-insert into t2 values
- (7,10,'cc'), (1,20,'aa'), (2,23,'bb'), (7,18,'cc'), (1,30,'bb'),
- (4,71,'xx'), (3,15,'aa'), (7,82,'bb'), (8,12,'dd'), (4,15,'aa'),
- (11,33,'yy'), (10,42,'zz'), (4,53,'xx'), (10,17,'yy'), (7,12,'bb'),
- (8,20,'dd'), (7,32,'bb'), (1,50,'aa'), (3,40,'bb'), (3,77,'aa');
-
-let $q1=
-select * from (select a, c, sum(b) over (partition by a,c) from t2) as t
- where t.a > 2 and t.c in ('aa','bb','cc');
-
-eval $no_pushdown $q1;
-eval $q1;
-eval explain $q1;
-eval explain format=json $q1;
-
-let $q2=
-select * from
-(
- select 1 as n, a, c, sum(b) over (partition by a,c) as s from t2
- union all
- select 2 as n, a, c, sum(b) over (partition by a) as s from t2
-) as t
-where t.a > 2 and t.c in ('aa','bb','cc');
-
-eval $no_pushdown $q2;
-eval $q2;
-eval explain $q2;
-eval explain format=json $q2;
-
-let $q3=
-select *
-from (select a, c, sum(b) over (partition by a,c) as s from t2) as t, t1
- where t1.a=t.a and t1.c=t.c and t1.c in ('aa','bb','cc');
-
-eval $no_pushdown $q3;
-eval $q3;
-eval explain $q3;
-eval explain format=json $q3;
-
-let $q4=
-select * from
-(
- select 1 as n, a, c, sum(b) over (partition by a,c) as s from t2
- union all
- select 2 as n, a, c, sum(b) over (partition by a) as s from t2
- union all
- select 3 as n, a, c, sum(b) as s from t2 group by a
-) as t
-where t.a > 2 and t.c in ('aa','bb','cc');
-
-eval $no_pushdown $q4;
-eval $q4;
-eval explain $q4;
-eval explain format=json $q4;
-
-let $q5=
-select * from (select a, c,
- sum(b) over (partition by a,c) as sum_b,
- avg(b) over (partition by a,c) as avg_b
- from t2 ) as t
- where t.a > 2 and t.c in ('aa','bb','cc');
-
-eval $no_pushdown $q5;
-eval $q5;
-eval explain $q5;
-eval explain format=json $q5;
-
-let $q6=
-select * from (select a, c,
- sum(b) over (partition by a,c) as sum_b,
- avg(b) over (partition by a) as avg_b
- from t2 ) as t
- where t.a > 2 and t.c in ('aa','bb','cc');
-
-eval $no_pushdown $q6;
-eval $q6;
-eval explain $q6;
-eval explain format=json $q6;
-
-let $q7=
-select * from (select a, c,
- sum(b) over (partition by a,c) as sum_b,
- avg(b) over (partition by c) as avg_b
- from t2 ) as t
- where t.a > 2 and t.c in ('aa','bb','cc');
-
-eval $no_pushdown $q7;
-eval $q7;
-eval explain $q7;
-eval explain format=json $q7;
-
-drop table t1,t2;
-
-set optimizer_switch= @save_optimizer_switch;
-
---echo #
---echo # MDEV-13369: Optimization for equi-joins of grouping derived tables
---echo # (Splitting derived tables / views with GROUP BY)
---echo # MDEV-13389: Optimization for equi-joins of derived tables with WF
---echo # (Splitting derived tables / views with window functions)
---echo #
-
-let
-$no_splitting= set statement optimizer_switch='split_materialized=off' for;
-
-create table t1 (a int, b int, index idx_b(b)) engine=myisam;
-insert into t1 values
-(8,3), (5,7), (1,2), (2,1), (9,7), (7,5), (2,2), (7,3),
-(9,3), (8,1), (4,5), (2,3);
-
-create table t2 (a int, b int, c char(127), index idx_a(a)) engine=myisam;
-insert into t2 values
- (7,10,'x'), (1,20,'a'), (2,23,'b'), (7,18,'z'), (1,30,'c'),
- (4,71,'d'), (3,15,'x'), (7,82,'y'), (8,12,'t'), (4,15,'b'),
- (11,33,'a'), (10,42,'u'), (4,53,'p'), (10,17,'r'), (2,90,'x'),
- (17,10,'s'), (11,20,'v'), (12,23,'y'), (17,18,'a'), (11,30,'d'),
- (24,71,'h'), (23,15,'i'), (27,82,'k'), (28,12,'p'), (24,15,'q'),
- (31,33,'f'), (30,42,'h'), (40,53,'m'), (30,17,'o'), (21,90,'b'),
- (37,10,'e'), (31,20,'g'), (32,23,'f'), (37,18,'n'), (41,30,'l'),
- (54,71,'j'), (53,15,'w'), (57,82,'z'), (58,12,'k'), (54,15,'p'),
- (61,33,'c'), (60,42,'a'), (62,53,'x'), (67,17,'g'), (64,90,'v');
-
-insert into t2 select a+10, b+10, concat(c,'f') from t2;
-
-analyze table t1,t2;
-
-let $q1=
-select t1.a,t.s,t.m
-from t1 join
- (select a, sum(t2.b) as s, min(t2.c) as m from t2 group by t2.a) t
- on t1.a=t.a
-where t1.b < 3;
-
-eval $no_splitting $q1;
-eval $q1;
-eval explain extended $q1;
-eval explain format=json $q1;
-eval prepare stmt from "$q1";
-execute stmt;
-execute stmt;
-deallocate prepare stmt;
-
-let $q10=
-select t1.a,t.s,t.m
-from t1 join
- (select a, sum(t2.b) as s, min(t2.b) as m from t2 group by t2.a) t
- on t1.a=t.a
-where t1.b <= 5;
-
-eval $no_splitting $q10;
-eval $q10;
-eval explain extended $q10;
-eval explain format=json $q10;
-eval prepare stmt from "$q10";
-execute stmt;
-execute stmt;
-deallocate prepare stmt;
-
-delete from t1 where t1.b between 2 and 5;
-
-let $q2=
-select t1.a,t.max,t.min
-from t1 left join
- (select a, max(t2.b) max, min(t2.b) min from t2 group by t2.a) t
- on t1.a=t.a;
-
-eval $no_splitting $q2;
-eval $q2;
-eval explain extended $q2;
-eval explain format=json $q2;
-
-create table t3 (a int, b int, c char(127), index idx_b(b)) engine=myisam;
-insert into t3 values
-(8,11,'aa'), (5,15,'cc'), (1,14,'bb'), (2,12,'aa'), (7,17,'cc'),
-(7,18,'aa'), (2,11,'aa'), (7,10,'bb'), (3,11,'dd'), (4,12,'ee'),
-(5,14,'dd'), (9,12,'ee');
-
-create table t4 (a int, b int, c char(127), index idx(a,c)) engine=myisam;
-insert into t4 values
- (7,10,'cc'), (1,20,'aa'), (2,23,'bb'), (7,18,'cc'), (1,30,'bb'),
- (4,71,'xx'), (3,15,'aa'), (7,82,'aa'), (8,12,'dd'), (4,15,'aa'),
- (11,33,'yy'), (10,42,'zz'), (4,53,'xx'), (10,17,'yy'), (7,12,'cc'),
- (8,20,'dd'), (7,32,'bb'), (1,50,'aa'), (3,40,'bb'), (3,77,'aa');
-
-insert into t4 select a+10, b+10, concat(c,'f') from t4;
-
-analyze table t3,t4;
-
-let $q3=
-select t3.a,t3.c,t.max,t.min
-from t3 join
- (select a, c, max(b) max, min(b) min from t4 group by a,c) t
- on t3.a=t.a and t3.c=t.c
-where t3.b > 15;
-
-eval $no_splitting $q3;
-eval $q3;
-eval explain extended $q3;
-eval explain format=json $q3;
-
-let $q30=
-select t3.a,t3.c,t.max,t.min
-from t3 join
- (select a, c, max(b) max, min(b) min from t4 group by a,c) t
- on t3.a=t.a and t3.c=t.c
-where t3.b <= 15;
-
-eval $no_splitting $q30;
-eval $q30;
-eval explain extended $q30;
-eval explain format=json $q30;
-
-let $q4=
-select t3.a,t3.c,t.max,t.min
-from t3 join
- (select a, c, max(b) max, min(b) min from t4 group by c,a) t
- on t3.a=t.a and t3.c=t.c
-where t3.b > 15;
-
-eval $no_splitting $q4;
-eval $q4;
-eval explain extended $q4;
-eval explain format=json $q4;
-
-let $q40=
-select t3.a,t3.c,t.max,t.min
-from t3 join
- (select a, c, max(b) max, min(b) min from t4 group by c,a) t
- on t3.a=t.a and t3.c=t.c
-where t3.b <= 15;
-
-eval $no_splitting $q40;
-eval $q40;
-eval explain extended $q40;
-eval explain format=json $q40;
-
-drop index idx_a on t2;
-create index idx on t2(c,b);
-create index idx_a on t3(a);
-create index idx_c on t4(c);
-insert into t3 select a+10, b+10, concat(c,'f') from t3;
-insert into t3 select a+100, b+100, concat(c,'g') from t3;
-insert into t4 select a+100, b+100, concat(c,'g') from t4;
-insert into t4 select a+1000, b+1000, concat(c,'h') from t4;
-
-analyze table t2,t3,t4;
-
-let $q5=
-select t2.a,t2.b,t2.c,t.c as t_c,t.max,t.min
-from t2, t3, (select c, max(b) max, min(b) min from t4 group by c) t
-where t2.b between 80 and 85 and t2.c in ('y','z') and t2.a=t3.a and t3.c=t.c;
-
-eval $no_splitting $q5;
-eval $q5;
-eval explain extended $q5;
-eval explain format=json $q5;
-
-let $q50=
-select t2.a,t2.b,t2.c,t.c as t_c,t.max,t.min
-from t2, t3, (select c, max(b) max, min(b) min from t4 group by c) t
-where t2.b < 40 and t2.a=t3.a and t3.c=t.c;
-
-eval $no_splitting $q50;
-eval $q50;
-eval explain extended $q50;
-eval explain format=json $q50;
-
-let $q6=
-select *
-from t2, t3, (select c, b, sum(b) over (partition by c) from t4 ) t
-where t2.b between 80 and 85 and t2.c in ('y','z') and t2.a=t3.a and t3.c=t.c;
-
-eval $no_splitting $q6;
-eval $q6;
-eval explain extended $q6;
-eval explain format=json $q6;
-
-let $q60=
-select *
-from t2, t3, (select c, b, sum(b) over (partition by c) from t4 ) t
-where t2.b < 40 and t2.a=t3.a and t3.c=t.c;
-
-eval $no_splitting $q60;
-eval $q60;
-eval explain extended $q60;
-eval explain format=json $q60;
-
-drop table t1,t2,t3,t4;
-
---echo #
---echo # MDEV-13709: Optimization for semi-joins of grouping derived tables
---echo # (Splitting derived tables / views with GROUP BY)
---echo #
-
-CREATE TABLE t1 (i int);
-INSERT INTO t1 VALUES (1),(9),(3);
-
-CREATE TABLE t2 (a int, i int);
-INSERT INTO t2 VALUES (1,9),(2,3),(3,7),(4,1);
-
-CREATE TABLE t3 (a int, c char(127), index(c));
-INSERT INTO t3 VALUES (1,'foo'),(3,'bar'),(4,'foo'),(2,'bar');
-INSERT INTO t3 SELECT a, concat(c,'a') FROM t3;
-
-CREATE TABLE t4 (a int, c char(127), index(a));
-INSERT INTO t4 VALUES
- (3,'abc'),(1,'foo'),(4,'def'),(8,'xxx'),(3,'yyy'),
- (5,'zzz'),(9,'xyz'),(2,'yxz'),(5,'zxy'),(7,'zyx') ;
-
-ANALYZE TABLE t1,t2,t3,t4;
-
-CREATE VIEW v1 AS
-SELECT c FROM t3
- WHERE a IN ( SELECT t2.a FROM t1 JOIN t2 WHERE t1.i = t2.i ) GROUP BY c ;
-
-let $q1=
-SELECT * FROM t4 WHERE c IN ( SELECT c FROM v1 ) and a < 2;
-
-eval $no_splitting $q1;
-eval $q1;
-eval explain extended $q1;
-eval explain format=json $q1;
-
-DROP VIEW v1;
-DROP TABLE t1,t2,t3,t4;
-
---echo #
---echo # MDEV-13710: Optimization for equi-joins of grouping derived tables
---echo # (Splitting derived tables / views with GROUP BY) :
---echo # FROM list of the derived table contains constant tables
---echo #
-
-CREATE TABLE t1 (a int, INDEX(a)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (9),(5),(1);
-
-CREATE TABLE t2 (b int) ENGINE=MyISAM;
-
-CREATE TABLE t3 (c varchar(8), d int) ENGINE=MyISAM;
-INSERT INTO t3 VALUES ('foo',2),('bar',6);
-
-CREATE VIEW v1 AS SELECT a FROM t1, t2 GROUP BY a;
-
-SELECT * FROM t3
- WHERE d IN ( SELECT * FROM v1 ) AND c LIKE 'z%' OR c IS NULL;
-
-DROP VIEW v1;
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # MDEV-13734: Optimization for equi-joins of grouping derived tables
---echo # (Splitting derived tables / views with GROUP BY) :
---echo # derived table / view is empty
---echo #
-
-CREATE TABLE t1 (a int, b int, INDEX(a)) ENGINE=MyISAM;
-CREATE TABLE t2 (c int) ENGINE=MyISAM;
-
-CREATE VIEW v1 AS SELECT a, b FROM t1 STRAIGHT_JOIN t2;
-CREATE VIEW v2 AS SELECT a, max(b) as bmax FROM v1 GROUP BY a;
-CREATE VIEW v3 AS SELECT v2.* FROM t1 JOIN v2 ON t1.b = v2.bmax ;
-
-SELECT * FROM v3 JOIN t1 ON (bmax = b);
-
-DROP VIEW v1,v2,v3;
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-14845: Impossible where for derived with GROUP BY
---echo #
-
-CREATE TABLE t1 (pk INT PRIMARY KEY);
-
-INSERT INTO t1 VALUES (1),(2);
-
-let $q=
-WITH cte AS ( SELECT pk FROM t1 WHERE pk IS NULL GROUP BY pk )
-SELECT * FROM cte;
-
-eval $q;
-eval EXPLAIN EXTENDED $q;
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-14880: assertion failure in optimizer when splitting is applied
---echo #
-
-CREATE TABLE t1 (pk1 INT PRIMARY KEY, f INT) ENGINE=Aria;
-INSERT INTO t1 VALUES (1,0),(2,0);
-
-CREATE TABLE t2 (pk2 INT PRIMARY KEY) ENGINE=Aria;
-INSERT INTO t2 VALUES (1),(2),(3);
-
-CREATE VIEW v2 AS SELECT pk2, COUNT(*) AS cnt FROM t2 GROUP BY pk2;
-
-let $q=
-SELECT * FROM t1 INNER JOIN v2 ON pk1 = pk2 WHERE f <> 5;
-
-eval $q;
-eval EXPLAIN EXTENDED $q;
-eval EXPLAIN FORMAT=JSON $q;
-
-DROP VIEW v2;
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-15017: splittable table is constant table
---echo #
-
-CREATE TABLE t1 (a INT) ENGINE=MyISAM;
-
-CREATE TABLE t2 (pk INT, b INT, PRIMARY KEY (pk)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (1,2),(3,4);
-
-CREATE VIEW v2 AS SELECT pk, MIN(b) FROM t2 GROUP BY pk;
-
-SELECT * FROM t1 LEFT JOIN v2 ON (a = pk);
-
-DROP VIEW v2;
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-14994: splittable table with no rows
---echo #
-
-CREATE TABLE t1 (f INT PRIMARY KEY) ENGINE=MyISAM;
-CREATE VIEW v1 AS SELECT a.* FROM t1 AS a STRAIGHT_JOIN t1 AS b;
-CREATE VIEW v2 AS SELECT f FROM v1 GROUP BY f;
-
-SELECT * FROM v1 JOIN v2 ON v1.f = v2.f;
-EXPLAIN EXTENDED
-SELECT * FROM v1 JOIN v2 ON v1.f = v2.f;
-
-DROP VIEW v1,v2;
-DROP TABLE t1;
diff --git a/mysql-test/t/derived_opt.test b/mysql-test/t/derived_opt.test
deleted file mode 100644
index 7f19553e4e5..00000000000
--- a/mysql-test/t/derived_opt.test
+++ /dev/null
@@ -1,367 +0,0 @@
-# Initialize
---disable_warnings
-drop table if exists t0,t1,t2,t3;
-drop database if exists test1;
---enable_warnings
-
-set @exit_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='derived_merge=on,derived_with_keys=on';
-# The 'default' value within the scope of this test:
-set @save_optimizer_switch=@@optimizer_switch;
-
-CREATE TABLE t1 (a int not null, b char (10) not null);
-insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c');
-CREATE TABLE t2 (a int not null, b char (10) not null);
-insert into t2 values (3,'c'),(4,'d'),(5,'f'),(6,'e');
-CREATE TABLE t3 (a int not null, b char (10) not null);
-insert into t3 values (3,'f'),(4,'y'),(5,'z'),(6,'c');
-select * from t1 as x1, (select * from t1) as x2;
-explain select * from t1 as x1, (select * from t1) as x2;
-drop table if exists t2,t3;
-
-CREATE TABLE t2 (a int not null);
-insert into t2 values(1);
-select * from (select t1.*, t2.a as t2a from t1,t2 where t1.a=t2.a) t1;
-explain select * from (select t1.*, t2.a as t2a from t1,t2 where t1.a=t2.a) t1;
-drop table t1, t2;
-
-create table t1(a int not null, t char(8), index(a));
---disable_query_log
-begin;
-let $1 = 10000;
-while ($1)
- {
- eval insert into t1 values ($1,'$1');
- dec $1;
- }
-commit;
---enable_query_log
-SELECT * FROM (SELECT * FROM t1) as b ORDER BY a ASC LIMIT 0,20;
-explain select count(*) from t1 as tt1, (select * from t1) as tt2;
-drop table t1;
-
-#
-# test->used_keys test for derived tables
-#
-create table t1 (mat_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, matintnum CHAR(6) NOT NULL, test MEDIUMINT UNSIGNED NULL);
-create table t2 (mat_id MEDIUMINT UNSIGNED NOT NULL, pla_id MEDIUMINT UNSIGNED NOT NULL);
-insert into t1 values (NULL, 'a', 1), (NULL, 'b', 2), (NULL, 'c', 3), (NULL, 'd', 4), (NULL, 'e', 5), (NULL, 'f', 6), (NULL, 'g', 7), (NULL, 'h', 8), (NULL, 'i', 9);
-insert into t2 values (1, 100), (1, 101), (1, 102), (2, 100), (2, 103), (2, 104), (3, 101), (3, 102), (3, 105);
-
-SELECT STRAIGHT_JOIN d.pla_id, m2.mat_id FROM t1 m2 INNER JOIN (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id) d ON d.matintnum=m2.matintnum;
-SELECT STRAIGHT_JOIN d.pla_id, m2.test FROM t1 m2 INNER JOIN (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id) d ON d.matintnum=m2.matintnum;
-
-explain SELECT STRAIGHT_JOIN d.pla_id, m2.mat_id FROM t1 m2 INNER JOIN (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id) d ON d.matintnum=m2.matintnum;
-explain SELECT STRAIGHT_JOIN d.pla_id, m2.test FROM t1 m2 INNER JOIN (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id) d ON d.matintnum=m2.matintnum;
-drop table t1,t2;
-
-#
-# deived tables with subquery inside all by one table
-#
-create table t1 (E1 INTEGER UNSIGNED NOT NULL, E2 INTEGER UNSIGNED NOT NULL, E3 INTEGER UNSIGNED NOT NULL, PRIMARY KEY(E1)
-);
-insert into t1 VALUES(1,1,1), (2,2,1);
-select count(*) from t1 INNER JOIN (SELECT A.E1, A.E2, A.E3 FROM t1 AS A WHERE A.E3 = (SELECT MAX(B.E3) FROM t1 AS B WHERE A.E2 = B.E2)) AS THEMAX ON t1.E1 = THEMAX.E2 AND t1.E1 = t1.E2;
-explain select count(*) from t1 INNER JOIN (SELECT A.E1, A.E2, A.E3 FROM t1 AS A WHERE A.E3 = (SELECT MAX(B.E3) FROM t1 AS B WHERE A.E2 = B.E2)) AS THEMAX ON t1.E1 = THEMAX.E2 AND t1.E1 = t1.E2;
-drop table t1;
-
-create table t1 (a int);
-insert into t1 values (1),(2);
-select * from ( select * from t1 union select * from t1) a,(select * from t1 union select * from t1) b;
-explain select * from ( select * from t1 union select * from t1) a,(select * from t1 union select * from t1) b;
-drop table t1;
-
-#
-# "Using index" in explain
-#
-create table t2 (a int, b int, primary key (a));
-insert into t2 values (1,7),(2,7);
-explain select a from t2 where a>1;
-explain select a from (select a from t2 where a>1) tt;
-drop table t2;
-
-#
-# prepared EXPLAIN
-#
-create table t1
-(
- c1 tinyint, c2 smallint, c3 mediumint, c4 int,
- c5 integer, c6 bigint, c7 float, c8 double,
- c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
- c13 date, c14 datetime, c15 timestamp, c16 time,
- c17 year, c18 bit, c19 bool, c20 char,
- c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
- c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
- c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
- c32 set('monday', 'tuesday', 'wednesday')
-) engine = MYISAM ;
-create table t2 like t1;
-
-set @save_optimizer_switch=@@optimizer_switch;
-set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=off";
-
-set @stmt= ' 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 ' ;
-prepare stmt1 from @stmt ;
-execute stmt1 ;
-execute stmt1 ;
-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;
-deallocate prepare stmt1;
-drop tables t1,t2;
-
-set @@optimizer_switch=@save_optimizer_switch;
-
---echo #
---echo # LP bug #793436: query with a derived table for which optimizer proves
---echo # that it contains not more than 1 row
---echo #
-
-CREATE TABLE t1 (a int, KEY (a)) ;
-INSERT INTO t1 VALUES (3), (1);
-CREATE TABLE t2 (a int);
-INSERT INTO t2 VALUES (3);
-
-EXPLAIN
-SELECT * FROM (SELECT DISTINCT * FROM t2) t, t1 WHERE t1.a = t.a;
-SELECT * FROM (SELECT DISTINCT * FROM t2) t, t1 WHERE t1.a = t.a;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # LP bug #800518: crash with a query over a derived table
---echo # when a min/max optimization is applied
---echo #
-
-CREATE TABLE t1 (a int, b int, c varchar(10), INDEX idx(a,b)) ;
-INSERT INTO t1 VALUES
- (100, 3, 'xxx'), (200, 7, 'yyyyyyy'), (100, 1, 't'),
- (200, 4, 'aaaa'), (100, 3, 'eee'), (100, 5, 'zzzzz');
-
-EXPLAIN
-SELECT MAX(b) FROM (SELECT * FROM t1) AS t WHERE a = 100;
-SELECT MAX(b) FROM (SELECT * FROM t1) AS t WHERE a = 100;
-
-DROP TABLE t1;
-
---echo #
---echo # LP bug #799499: query over a materialized view
---echo # accessed by a key
---echo #
-
-CREATE TABLE t1 (a int) ;
-INSERT INTO t1 VALUES (8);
-
-CREATE TABLE t2 (a int, b int) ;
-INSERT INTO t2 VALUES
- (262, NULL), (253, 190), (260, NULL), (250, 163), (188, 8),
- (257,200), (256, NULL), (255, 8), (249, NULL), (259, 7);
-
-CREATE VIEW v1 AS SELECT a, MIN(b) AS b FROM t2 GROUP BY a;
-
-EXPLAIN
-SELECT * FROM v1, t1 WHERE v1.b=t1.a ORDER BY v1.a;
-SELECT * FROM v1, t1 WHERE v1.b=t1.a ORDER BY v1.a;
-
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
---echo #
---echo # LP bug #800085: crash with a query using a simple derived table
---echo # (fixed by the patch for bug 798621)
---echo #
-
-CREATE TABLE t1 (f1 int, f2 varchar(32)) ;
-INSERT INTO t1 VALUES (NULL,'j'), (8,'c');
-
-CREATE TABLE t2 (f1 int);
-INSERT INTO t2 VALUES (1), (5);
-
-SELECT DISTINCT t.f1 FROM (SELECT * FROM t1) AS t, t2
- WHERE t.f2='s' AND t.f2 LIKE '%a%' OR t.f1<>0 ORDER BY t.f2;
-
-DROP TABLE t1, t2;
-
---echo #
---echo # BUG##806524: Assertion `join->best_read < 1.7976931348623157e+308 with table_elimination=on and derived_merge=on
---echo #
-CREATE TABLE t1 ( f4 int) ;
-CREATE TABLE t2 ( f4 int) ;
-CREATE TABLE t3 ( f1 int NOT NULL , PRIMARY KEY (f1)) ;
-CREATE TABLE t4 ( f2 int, f4 int) ;
-
-SELECT *
-FROM ( SELECT * FROM t1 ) AS alias1
-RIGHT JOIN (
- t2 AS alias2
- LEFT JOIN (
- SELECT t4.*
- FROM ( SELECT * FROM t3 ) AS SQ1_alias1
- RIGHT JOIN t4
- ON t4.f2 = SQ1_alias1.f1
- ) AS alias3
- ON alias3.f4 != 0
-) ON alias3.f4 != 0;
-
-drop table t1,t2,t3,t4;
-
---echo #
---echo # LP BUG#910123 MariaDB 5.3.3 causes 1093 error on Drupal
---echo # Fix: force materialization in case of conflict
---echo #
-SET optimizer_switch='derived_merge=on';
-CREATE TABLE t1 ( i INT );
-INSERT INTO t1 VALUES ( (SELECT 1 FROM ( SELECT * FROM t1 ) as a) );
-drop table t1;
-set optimizer_switch=@save_optimizer_switch;
-
---echo #
---echo # MDEV-3801 Reproducible sub select join crash on 5.3.8 and 5.3.9
---echo #
-
-CREATE TABLE t1 (
- pk int(10) unsigned NOT NULL AUTO_INCREMENT,
- a char(2) DEFAULT NULL,
- PRIMARY KEY (pk),
- KEY a (a)
-) ENGINE=MyISAM;
-INSERT INTO t1 (a)
-VALUES (NULL),(NULL),(NULL),('AB'),(NULL),('CD'),(NULL),(NULL);
-INSERT INTO t1 SELECT NULL, a1.a FROM t1 a1, t1 a2, t1 a3, t1 a4, t1 a5;
-
-CREATE TABLE t2 (
- pk int(10) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY
-) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
-INSERT INTO t2 SELECT NULL FROM t2 a1, t2 a2, t2 a3, t2 a4, t2 a5;
-
-CREATE TABLE t3 (
- pk int(10) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY
-) ENGINE=MyISAM;
-INSERT INTO t3 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
-INSERT INTO t3 SELECT NULL FROM t3 a1, t3 a2, t3 a3, t3 a4, t3 a5;
-
-CREATE TABLE t4 (
- a char(2) NOT NULL DEFAULT '',
- PRIMARY KEY (a)
-) ENGINE=MyISAM;
-INSERT INTO t4 VALUES ('CD');
-
-set @@tmp_table_size=8192;
-
---replace_column 9 #
-EXPLAIN
-SELECT * FROM t3 AS tx JOIN t2 AS ty ON (tx.pk = ty.pk)
-WHERE
- tx.pk IN
- (SELECT *
- FROM (SELECT DISTINCT ta.pk
- FROM t3 AS ta
- JOIN t2 AS tb ON (ta.pk = tb.pk)
- JOIN t1 AS tc ON (tb.pk = tc.pk)
- JOIN t4 AS td ON tc.a = td.a) tu)
-limit 10;
-
-SELECT * FROM t3 AS tX JOIN t2 AS tY ON (tX.pk = tY.pk)
-WHERE
- tX.pk IN
- (SELECT *
- FROM (SELECT DISTINCT tA.pk
- FROM t3 AS tA
- JOIN t2 AS tB ON (tA.pk = tB.pk)
- JOIN t1 AS tC ON (tB.pk = tC.pk)
- JOIN t4 AS tD ON tC.a = tD.a) tU)
-limit 10;
-
-drop table t1, t2, t3, t4;
-
---echo #
---echo # MDEV-6888: Query spends a long time in best_extension_by_limited_search with mrr enabled
---echo #
-create database test1;
-use test1;
-
-set @tmp_jcl= @@join_cache_level;
-set @tmp_os= @@optimizer_switch;
-set join_cache_level=8;
-set optimizer_switch='mrr=on,mrr_sort_keys=on';
-
-CREATE TABLE t0 (
- f1 bigint(20) DEFAULT NULL,
- f2 char(50) DEFAULT NULL
-) ENGINE=MEMORY DEFAULT CHARSET=latin1;
-INSERT INTO t0 VALUES (NULL,'numeric column is NULL'),(0,NULL),(5,'five'),(1,'one'),(2,'two');
-
-CREATE TABLE t1 (
- f1 decimal(64,30) DEFAULT NULL,
- f2 varchar(50) DEFAULT NULL
-) ENGINE=MEMORY DEFAULT CHARSET=latin1;
-
-INSERT INTO t1 VALUES
-(NULL,'numeric column is NULL'),
-(0.000000000000000000000000000000,NULL),
-(5.000000000000000000000000000000,'five'),
-(1.000000000000000000000000000000,'one'),
-(3.000000000000000000000000000000,'three');
-
-CREATE TABLE t2 (
- f1 double DEFAULT NULL,
- f2 varbinary(50) DEFAULT NULL
-) ENGINE=MEMORY DEFAULT CHARSET=latin1;
-INSERT INTO t2 VALUES (NULL,'numeric column is NULL'),(0,NULL),(5,'five'),(2,'two'),(3,'three');
-
-create VIEW v0 AS select f1,f2 from t1 ;
-
-let $cnt= 27;
-while ($cnt)
-{
-# i runs from 1 to 27
- let $i= `select 28 - $cnt`;
- let $prev=`select $i - 1`;
-
-# rem = i mod 3
- let $rem= `select MOD($i, 3)`;
-# view uses $i, $prev and $rem:
- eval create VIEW v$i AS select tab1_v$i.f1,tab1_v$i.f2 from t$rem tab1_v$i join v$prev tab2 on tab1_v$i.f1 = tab2.f1 and tab1_v$i.f2 = tab2.f2;
- dec $cnt;
-}
-
-EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1, CAST(f2 AS CHAR) AS f2 FROM v27;
---echo # This used to hang forever:
-EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1, CAST(f2 AS CHAR) AS f2 FROM v27;
-
-use test;
-drop database test1;
-set join_cache_level=@tmp_jcl;
-set optimizer_switch=@tmp_os;
-
-
---echo #
---echo # MDEV-6879: Dereference of NULL primary_file->table in DsMrr_impl::get_disk_sweep_mrr_cost()
---echo #
-create table t1(a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t2 (a int, b int, c text);
-insert into t2
-select
- A.a + B.a* 10,
- A.a + B.a* 10,
- 'blob-data'
-from t1 A, t1 B;
-
-set @tmp_jcl= @@join_cache_level;
-set @tmp_os= @@optimizer_switch;
-set join_cache_level=6;
-set @@optimizer_switch='derived_merge=on,derived_with_keys=on,mrr=on';
-explain
-select * from
- t1 join
- (select * from t2 order by a limit 1000) as D1
-where
- D1.a= t1.a;
-
-set join_cache_level=@tmp_jcl;
-set optimizer_switch=@tmp_os;
-drop table t1, t2;
-
-# The following command must be the last one the file
-set optimizer_switch=@exit_optimizer_switch;
diff --git a/mysql-test/t/derived_view.test b/mysql-test/t/derived_view.test
deleted file mode 100644
index 9b0cf9dca7d..00000000000
--- a/mysql-test/t/derived_view.test
+++ /dev/null
@@ -1,1954 +0,0 @@
---disable_warnings
-drop table if exists t1,t2;
-drop view if exists v1,v2,v3,v4;
---enable_warnings
-
-set @exit_optimizer_switch=@@optimizer_switch;
-set @exit_join_cache_level=@@join_cache_level;
-set optimizer_switch='derived_merge=on,derived_with_keys=on';
-# The 'default' value within the scope of this test:
-set @save_optimizer_switch=@@optimizer_switch;
-set join_cache_level=1;
-
-create table t1(f1 int, f11 int);
-create table t2(f2 int, f22 int);
-insert into t1 values(1,1),(2,2),(3,3),(5,5),(9,9),(7,7);
-insert into t1 values(17,17),(13,13),(11,11),(15,15),(19,19);
-insert into t2 values(1,1),(3,3),(2,2),(4,4),(8,8),(6,6);
-insert into t2 values(12,12),(14,14),(10,10),(18,18),(16,16);
-
---echo Tests:
-
---echo for merged derived tables
---echo explain for simple derived
-explain select * from (select * from t1) tt;
-select * from (select * from t1) tt;
---echo explain for multitable derived
-explain extended select * from (select * from t1 join t2 on f1=f2) tt;
-select * from (select * from t1 join t2 on f1=f2) tt;
---echo explain for derived with where
-explain extended
- select * from (select * from t1 where f1 in (2,3)) tt where f11=2;
-select * from (select * from t1 where f1 in (2,3)) tt where f11=2;
---echo join of derived
-explain extended
- select * from (select * from t1 where f1 in (2,3)) tt join
- (select * from t1 where f1 in (1,2)) aa on tt.f1=aa.f1;
-select * from (select * from t1 where f1 in (2,3)) tt join
- (select * from t1 where f1 in (1,2)) aa on tt.f1=aa.f1;
-
-flush status;
-explain extended
- select * from (select * from t1 where f1 in (2,3)) tt where f11=2;
-show status like 'Handler_read%';
-flush status;
-select * from (select * from t1 where f1 in (2,3)) tt where f11=2;
-show status like 'Handler_read%';
-
---echo for merged views
-create view v1 as select * from t1;
-create view v2 as select * from t1 join t2 on f1=f2;
-create view v3 as select * from t1 where f1 in (2,3);
-create view v4 as select * from t2 where f2 in (2,3);
---echo explain for simple views
-explain extended select * from v1;
-select * from v1;
---echo explain for multitable views
-explain extended select * from v2;
-select * from v2;
---echo explain for views with where
-explain extended select * from v3 where f11 in (1,3);
-select * from v3 where f11 in (1,3);
---echo explain for joined views
-explain extended
- select * from v3 join v4 on f1=f2;
-select * from v3 join v4 on f1=f2;
-
-flush status;
-explain extended select * from v4 where f2 in (1,3);
-show status like 'Handler_read%';
-flush status;
-select * from v4 where f2 in (1,3);
-show status like 'Handler_read%';
-
---echo for materialized derived tables
---echo explain for simple derived
-explain extended select * from (select * from t1 group by f1) tt;
-select * from (select * from t1 having f1=f1) tt;
---echo explain showing created indexes
-explain extended
- select * from t1 join (select * from t2 group by f2) tt on f1=f2;
-select * from t1 join (select * from t2 group by f2) tt on f1=f2;
---echo explain showing late materialization
-flush status;
-explain select * from t1 join (select * from t2 group by f2) tt on f1=f2;
-show status like 'Handler_read%';
-flush status;
-select * from t1 join (select * from t2 group by f2) tt on f1=f2;
-show status like 'Handler_read%';
-
---echo for materialized views
-drop view v1,v2,v3;
-create view v1 as select * from t1 group by f1;
-create view v2 as select * from t2 group by f2;
-create view v3 as select t1.f1,t1.f11 from t1 join t1 as t11 where t1.f1=t11.f1
- having t1.f1<100;
---echo explain for simple derived
-explain extended select * from v1;
-select * from v1;
---echo explain showing created indexes
-explain extended select * from t1 join v2 on f1=f2;
-select * from t1 join v2 on f1=f2;
-explain extended
- select * from t1,v3 as v31,v3 where t1.f1=v31.f1 and t1.f1=v3.f1;
-flush status;
-select * from t1,v3 as v31,v3 where t1.f1=v31.f1 and t1.f1=v3.f1;
-show status like 'Handler_read%';
---echo explain showing late materialization
-flush status;
-explain select * from t1 join v2 on f1=f2;
-show status like 'Handler_read%';
-flush status;
-select * from t1 join v2 on f1=f2;
-show status like 'Handler_read%';
-
-explain extended select * from v1 join v4 on f1=f2;
-explain format=json select * from v1 join v4 on f1=f2;
-select * from v1 join v4 on f1=f2;
-
---echo merged derived in merged derived
-explain extended select * from (select * from
- (select * from t1 where f1 < 7) tt where f1 > 2) zz;
-select * from (select * from
- (select * from t1 where f1 < 7) tt where f1 > 2) zz;
-
---echo materialized derived in merged derived
-explain extended select * from (select * from
- (select * from t1 where f1 < 7 group by f1) tt where f1 > 2) zz;
-select * from (select * from
- (select * from t1 where f1 < 7 group by f1) tt where f1 > 2) zz;
-
---echo merged derived in materialized derived
-explain extended select * from (select * from
- (select * from t1 where f1 < 7) tt where f1 > 2 group by f1) zz;
-select * from (select * from
- (select * from t1 where f1 < 7) tt where f1 > 2 group by f1) zz;
-
---echo materialized derived in materialized derived
-explain extended select * from (select * from
- (select * from t1 where f1 < 7 group by f1) tt where f1 > 2 group by f1) zz;
-explain format=json select * from (select * from
- (select * from t1 where f1 < 7 group by f1) tt where f1 > 2 group by f1) zz;
-select * from (select * from
- (select * from t1 where f1 < 7 group by f1) tt where f1 > 2 group by f1) zz;
-
---echo mat in merged derived join mat in merged derived
-explain extended select * from
- (select * from (select * from t1 where f1 < 7 group by f1) tt where f1 > 2) x
-join
- (select * from (select * from t1 where f1 < 7 group by f1) tt where f1 > 2) z
- on x.f1 = z.f1;
-explain format=json select * from
- (select * from (select * from t1 where f1 < 7 group by f1) tt where f1 > 2) x
-join
- (select * from (select * from t1 where f1 < 7 group by f1) tt where f1 > 2) z
- on x.f1 = z.f1;
-
-flush status;
-select * from
- (select * from (select * from t1 where f1 < 7 group by f1) tt where f1 > 2) x
-join
- (select * from (select * from t1 where f1 < 7 group by f1) tt where f1 > 2) z
- on x.f1 = z.f1;
-show status like 'Handler_read%';
-flush status;
-
---echo merged in merged derived join merged in merged derived
-explain extended select * from
- (select * from
- (select * from t1 where f1 < 7 ) tt where f1 > 2 ) x
-join
- (select * from
- (select * from t1 where f1 < 7 ) tt where f1 > 2 ) z
- on x.f1 = z.f1;
-
-select * from
- (select * from
- (select * from t1 where f1 < 7 ) tt where f1 > 2 ) x
-join
- (select * from
- (select * from t1 where f1 < 7 ) tt where f1 > 2 ) z
- on x.f1 = z.f1;
-
---echo materialized in materialized derived join
---echo materialized in materialized derived
-explain extended select * from
- (select * from
- (select * from t1 where f1 < 7 group by f1) tt where f1 > 2 group by f1) x
-join
- (select * from
- (select * from t1 where f1 < 7 group by f1) tt where f1 > 2 group by f1) z
- on x.f1 = z.f1;
-explain format=json select * from
- (select * from
- (select * from t1 where f1 < 7 group by f1) tt where f1 > 2 group by f1) x
-join
- (select * from
- (select * from t1 where f1 < 7 group by f1) tt where f1 > 2 group by f1) z
- on x.f1 = z.f1;
-
-select * from
- (select * from
- (select * from t1 where f1 < 7 group by f1) tt where f1 > 2 group by f1) x
-join
- (select * from
- (select * from t1 where f1 < 7 group by f1) tt where f1 > 2 group by f1) z
- on x.f1 = z.f1;
-
---echo merged view in materialized derived
-explain extended
-select * from (select * from v4 group by 1) tt;
-select * from (select * from v4 group by 1) tt;
-
---echo materialized view in merged derived
-explain extended
-select * from ( select * from v1 where f1 < 7) tt;
-explain format=json
-select * from ( select * from v1 where f1 < 7) tt;
-select * from ( select * from v1 where f1 < 7) tt;
-
---echo merged view in a merged view in a merged derived
-create view v6 as select * from v4 where f2 < 7;
-explain extended select * from (select * from v6) tt;
-select * from (select * from v6) tt;
-
---echo materialized view in a merged view in a materialized derived
-create view v7 as select * from v1;
-explain extended select * from (select * from v7 group by 1) tt;
-select * from (select * from v7 group by 1) tt;
-
---echo join of above two
-explain extended select * from v6 join v7 on f2=f1;
-explain format=json select * from v6 join v7 on f2=f1;
-select * from v6 join v7 on f2=f1;
-
---echo test two keys
-explain select * from t1 join (select * from t2 group by f2) tt on t1.f1=tt.f2 join t1 xx on tt.f22=xx.f1;
-select * from t1 join (select * from t2 group by f2) tt on t1.f1=tt.f2 join t1 xx on tt.f22=xx.f1;
-
-
---echo TODO: Add test with 64 tables mergeable view to test fall back to
---echo materialization on tables > MAX_TABLES merge
-drop table t1,t2;
-drop view v1,v2,v3,v4,v6,v7;
-
---echo #
---echo # LP bug #794909: crash when defining possible keys for
---echo # a materialized view/derived_table
---echo #
-
-CREATE TABLE t1 (f1 int) ;
-INSERT INTO t1 VALUES (149), (150), (224), (29);
-
-CREATE TABLE t2 (f1 int, KEY (f1));
-INSERT INTO t2 VALUES (149), (NULL), (224);
-
-CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
-
-EXPLAIN
-SELECT * FROM v1 JOIN t2 ON v1.f1 = t2.f1;
-SELECT * FROM v1 JOIN t2 ON v1.f1 = t2.f1;
-
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
---echo #
---echo # LP bug #794890: abort failure on multi-update with view
---echo #
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (20), (7);
-CREATE TABLE t2 (a int);
-INSERT INTO t2 VALUES (7), (9), (7);
-
-CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT a FROM t1;
-
-CREATE VIEW v2 AS SELECT t2.a FROM t2, v1 WHERE t2.a=t2.a;
-UPDATE v2 SET a = 2;
-SELECT * FROM t2;
-
-UPDATE t1,v2 SET t1.a = 3;
-SELECT * FROM t1;
-
-DELETE t1 FROM t1,v2;
-SELECT * FROM t1;
-
-DROP VIEW v1,v2;
-DROP TABLE t1,t2;
-
---echo #
---echo # LP bug #802023: MIN/MAX optimization
---echo # for mergeable derived tables and views
---echo #
-
-CREATE TABLE t1 (a int, b int, c varchar(32), INDEX idx(a,b));
-INSERT INTO t1 VALUES
- (7, 74, 'yyyyyyy'), (9, 97, 'aaaaaaaaa'), (2, 23, 'tt'),
- (5, 55, 'ddddd'), (2, 27, 'ss'), (7, 76, 'xxxxxxx'),
- (7, 79, 'zzzzzzz'), (9, 92, 'bbbbbbbbb'), (2, 25, 'pp'),
- (5, 53, 'eeeee'), (2, 23, 'qq'), (7, 76,'wwwwwww'),
- (7, 74, 'uuuuuuu'), (9, 92, 'ccccccccc'), (2, 25, 'oo');
-
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-SELECT MIN(a) FROM t1 WHERE a >= 5;
-EXPLAIN
-SELECT MIN(a) FROM t1 WHERE a >= 5;
-
-SELECT MIN(a) FROM (SELECT * FROM t1) t WHERE a >= 5;
-EXPLAIN
-SELECT MIN(a) FROM(SELECT * FROM t1) t WHERE a >= 5;
-
-SELECT MIN(a) FROM v1 WHERE a >= 5;
-EXPLAIN
-SELECT MIN(a) FROM v1 WHERE a >= 5;
-
-SELECT MAX(b) FROM t1 WHERE a=7 AND b<75;
-EXPLAIN
-SELECT MAX(b) FROM t1 WHERE a=7 AND b<75;
-
-SELECT MAX(b) FROM (SELECT * FROM t1) t WHERE a=7 AND b<75;
-EXPLAIN
-SELECT MAX(b) FROM (SELECT * FROM t1) t WHERE a=7 AND b<75;
-
-SELECT MAX(b) FROM v1 WHERE a=7 AND b<75;
-EXPLAIN
-SELECT MAX(b) FROM v1 WHERE a=7 AND b<75;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-
---echo #
---echo # LP bug #800535: GROUP BY query with nested left join
---echo # and a derived table in the nest
---echo #
-
-CREATE TABLE t1 (a int) ;
-INSERT INTO t1 VALUES (1), (2);
-
-CREATE TABLE t2 (a int NOT NULL);
-INSERT INTO t2 VALUES (1), (2);
-
-CREATE TABLE t3 (a int, b int);
-INSERT INTO t3 VALUES (3,3), (4,4);
-
-EXPLAIN EXTENDED
-SELECT t.a FROM t1 LEFT JOIN
- (t2 t JOIN t3 ON t3.b > 5) ON t.a >= 1
- GROUP BY t.a;
-SELECT t.a FROM t1 LEFT JOIN
- (t2 t JOIN t3 ON t3.b > 5) ON t.a >= 1
- GROUP BY t.a;
-
-EXPLAIN EXTENDED
-SELECT t.a FROM t1 LEFT JOIN
- (( SELECT * FROM t2 ) t JOIN t3 ON t3.b > 5) ON t.a >= 1
- GROUP BY t.a;
-SELECT t.a FROM t1 LEFT JOIN
- (( SELECT * FROM t2 ) t JOIN t3 ON t3.b > 5) ON t.a >= 1
- GROUP BY t.a;
-
-CREATE VIEW v1 AS SELECT * FROM t2;
-
-EXPLAIN EXTENDED
-SELECT t.a FROM t1 LEFT JOIN
- (v1 t JOIN t3 ON t3.b > 5) ON t.a >= 1
- GROUP BY t.a;
-SELECT t.a FROM t1 LEFT JOIN
- (v1 t JOIN t3 ON t3.b > 5) ON t.a >= 1
- GROUP BY t.a;
-
-DROP VIEW v1;
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # LP bug #803410: materialized view/dt accessed by two-component key
---echo #
-
-CREATE TABLE t1 (a varchar(1));
-INSERT INTO t1 VALUES ('c');
-
-CREATE TABLE t2 (a varchar(1) , KEY (a)) ;
-INSERT INTO t2 VALUES ('c'), (NULL), ('r');
-
-CREATE TABLE t3 (a varchar(1), b varchar(1));
-INSERT INTO t3 VALUES
- ('e', 'c'), ('c', 'c'), ('c', 'r'), ('g', 'a'), ('b', 'x'), ('b', 'y'),
- ('h', 'w'), ('d', 'z'), ('k', 'v'), ('j', 's'), ('m', 'p'), ('l', 'q');
-
-CREATE VIEW v1 AS SELECT a, MIN(b) AS b FROM t3 GROUP BY a;
-
-EXPLAIN
-SELECT * FROM t1, t2, v1 WHERE t2.a=t1.a AND t2.a=v1.a AND t2.a=v1.b;
-SELECT * FROM t1, t2, v1 WHERE t2.a=t1.a AND t2.a=v1.a AND t2.a=v1.b;
-
-DROP VIEW v1;
-DROP TABLE t1,t2,t3;
-
-
---echo #
---echo # LP bug #802845: select from derived table with limit 0
---echo #
-
-SELECT * FROM (SELECT 1 LIMIT 0) t;
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (7), (1), (3);
-
-SELECT * FROM (SELECT * FROM t1 LIMIT 0) t;
-
-DROP TABLE t1;
-
---echo #
---echo # LP bug #803851: materialized view + IN->EXISTS
---echo #
-
-SET SESSION optimizer_switch='semijoin=off,derived_with_keys=on,materialization=off';
-
-CREATE TABLE t1 (a int, b int);
-INSERT INTO t1 VALUES (2,2), (3,3), (1,1);
-
-CREATE TABLE t2 (a int);
-INSERT INTO t2 VALUES (1), (2), (1);
-
-CREATE TABLE t3 (a int);
-INSERT INTO t3 VALUES (3), (1), (2), (1);
-
-CREATE VIEW v1 AS SELECT a, MAX(b) AS b FROM t1 GROUP BY a;
-
-EXPLAIN EXTENDED
-SELECT * FROM t3
- WHERE t3.a IN (SELECT v1.a FROM v1, t2 WHERE t2.a = v1.b);
-SELECT * FROM t3
- WHERE t3.a IN (SELECT v1.a FROM v1, t2 WHERE t2.a = v1.b);
-
-SET SESSION optimizer_switch=@save_optimizer_switch;
-
-DROP VIEW v1;
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # LP bug #804515: materialized derived + ORDER BY
---echo #
-
-CREATE TABLE t1 (f1 varchar(1), f2 varchar(1), KEY (f2));
-INSERT INTO t1 VALUES
- ('r','x'), ('x','d'), ('x','r'), ('r','f'), ('x','x');
-
-CREATE TABLE t2 (f1 varchar(1), f2 varchar(1));
-INSERT INTO t2 VALUES ('s','x');
-
-CREATE TABLE t3 (f1 varchar(1), f2 varchar(1), KEY (f2));
-INSERT INTO t3 VALUES
- (NULL,'x'), (NULL,'f'), ('t','p'), (NULL,'j'), ('g','c');
-
-CREATE TABLE t4 (f1 int, f2 varchar(1), KEY (f2,f1)) ;
-INSERT INTO t4 VALUES (1,'x'), (5,'r');
-
-EXPLAIN
-SELECT t.f1 AS f
- FROM (SELECT DISTINCT t1.* FROM t1,t2 WHERE t2.f2 = t1.f2) t,t3,t4
- WHERE t4.f2 = t3.f2 AND t4.f2 = t.f1 ORDER BY f;
-SELECT t.f1 AS f
- FROM (SELECT DISTINCT t1.* FROM t1,t2 WHERE t2.f2 = t1.f2) t,t3,t4
- WHERE t4.f2 = t3.f2 AND t4.f2 = t.f1 ORDER BY f;
-
-DROP TABLE t1,t2,t3,t4;
-
---echo #
---echo # LP bug #806431: join over materialized derived with key
---echo #
-
-CREATE TABLE t1 (a int, b int);
-INSERT INTO t1 VALUES (0,0),(3,0),(1,0);
-
-CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT a,b FROM t1 ;
-
-SET SESSION optimizer_switch='derived_with_keys=off';
-SELECT * FROM t1 AS t JOIN v1 AS v WHERE t.a = v.b AND t.b = v.b;
-SET SESSION optimizer_switch='derived_with_keys=on';
-EXPLAIN
-SELECT * FROM t1 AS t JOIN v1 AS v WHERE t.a = v.b AND t.b = v.b;
-SELECT * FROM t1 AS t JOIN v1 AS v WHERE t.a = v.b AND t.b = v.b;
-
-SET SESSION optimizer_switch=@save_optimizer_switch;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo #
---echo # LP bug #806477: left join over merged join with
---echo # where condition containing f=f
---echo #
-
-CREATE TABLE t1 (a int NOT NULL);
-INSERT INTO t1 VALUES (1), (50), (0);
-
-CREATE TABLE t2 (a int);
-
-CREATE TABLE t3 (a int, b int);
-INSERT INTO t3 VALUES (76,2), (1,NULL);
-
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-SELECT t3.b, v1.a
- FROM t3 LEFT JOIN (t2, v1) ON t3.a <> 0
- WHERE v1.a = v1.a OR t3.b <> 0;
-EXPLAIN EXTENDED
-SELECT t3.b, v1.a
- FROM t3 LEFT JOIN (t2, v1) ON t3.a <> 0
- WHERE v1.a = v1.a OR t3.b <> 0;
-
-DROP VIEW v1;
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # LP bug #806510: subquery with outer reference
---echo # to a derived_table/view
---echo #
-
-CREATE TABLE t1 (a int) ;
-INSERT INTO t1 VALUES (4), (NULL);
-
-CREATE TABLE t2 (a int) ;
-INSERT INTO t2 VALUES (8), (0);
-
-CREATE TABLE t3 (a int, b int) ;
-INSERT INTO t3 VALUES (7,8);
-
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-SELECT * FROM t1 t
- WHERE EXISTS (SELECT t3.a FROM t3, t2
- WHERE t2.a = t3.b AND t.a != 0);
-EXPLAIN
-SELECT * FROM t1 t
- WHERE EXISTS (SELECT t3.a FROM t3, t2
- WHERE t2.a = t3.b AND t.a != 0);
-
-SELECT * FROM (SELECT * FROM t1) t
- WHERE EXISTS (SELECT t3.a FROM t3, t2
- WHERE t2.a = t3.b AND t.a != 0);
-EXPLAIN
-SELECT * FROM (SELECT * FROM t1) t
- WHERE EXISTS (SELECT t3.a FROM t3, t2
- WHERE t2.a = t3.b AND t.a != 0);
-
-SELECT * FROM v1 t
- WHERE EXISTS (SELECT t3.a FROM t3, t2
- WHERE t2.a = t3.b AND t.a != 0);
-EXPLAIN
-SELECT * FROM v1 t
- WHERE EXISTS (SELECT t3.a FROM t3, t2
- WHERE t2.a = t3.b AND t.a != 0);
-
-DROP VIEW v1;
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # LP bug #806097: left join over a view + DISTINCT
---echo #
-
-CREATE TABLE t1 (a int, b int);
-INSERT INTO t1 VALUES (252,6), (232,0), (174,232);
-
-CREATE TABLE t2 (a int);
-INSERT INTO t2 VALUES (232), (174);
-
-CREATE TABLE t3 (c int);
-INSERT INTO t3 VALUES (1), (2);
-
-CREATE VIEW v1 AS SELECT t2.a FROM t3,t2;
-
-SELECT v1.a FROM t1 LEFT JOIN v1 ON t1.b = 0;
-
-SELECT DISTINCT t2.a FROM t1 LEFT JOIN (t3,t2) ON t1.b = 0;
-EXPLAIN
-SELECT DISTINCT t2.a FROM t1 LEFT JOIN (t3,t2) ON t1.b = 0;
-
-SELECT DISTINCT v1.a FROM t1 LEFT JOIN v1 ON t1.b = 0;
-EXPLAIN
-SELECT DISTINCT v1.a FROM t1 LEFT JOIN v1 ON t1.b = 0;
-
-DROP VIEW v1;
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # LP bug #806504: right join over a view/derived table
---echo #
-
-CREATE TABLE t1 (a int, b int) ;
-INSERT INTO t1 VALUES (0,0);
-
-CREATE TABLE t2 (a int) ;
-INSERT INTO t2 VALUES (0), (0);
-
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-SELECT * FROM t2 RIGHT JOIN (SELECT * FROM t1) AS t ON t.a != 0
- WHERE t.a IN (SELECT b FROM t1);
-EXPLAIN EXTENDED
-SELECT * FROM t2 RIGHT JOIN (SELECT * FROM t1) AS t ON t.a != 0
- WHERE t.a IN (SELECT b FROM t1);
-
-SELECT * FROM t2 RIGHT JOIN v1 AS t ON t.a != 0
- WHERE t.a IN (SELECT b FROM t1);
-EXPLAIN EXTENDED
-SELECT * FROM t2 RIGHT JOIN v1 AS t ON t.a != 0
- WHERE t.a IN (SELECT b FROM t1);
-
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
---echo #
---echo # LP bug #809206: DISTINCT in derived table / view
---echo #
-
-CREATE TABLE t1 (a int) ;
-INSERT INTO t1 VALUES (0);
-
-CREATE TABLE t2 (a varchar(32), b int, KEY (a)) ;
-INSERT INTO t2 VALUES
- ('j',28), ('c',29), ('i',26), ('c',29), ('k',27),
- ('j',28), ('c',29), ('i',25), ('d',26), ('k',27),
- ('n',28), ('d',29), ('m',26), ('e',29), ('p',27),
- ('w',28), ('x',29), ('y',25), ('z',26), ('s',27);
-
-
-CREATE TABLE t3 (a varchar(32));
-INSERT INTO t3 VALUES ('j'), ('c');
-
-CREATE VIEW v1 AS SELECT DISTINCT t2.b FROM t1,t2,t3 WHERE t3.a = t2.a;
-
-SELECT DISTINCT t2.b FROM t1,t2,t3 WHERE t3.a = t2.a;
-EXPLAIN
-SELECT DISTINCT t2.b FROM t1,t2,t3 WHERE t3.a = t2.a;
-
-SELECT * FROM (SELECT DISTINCT t2.b FROM t1,t2,t3 WHERE t3.a = t2.a) t;
-EXPLAIN
-SELECT * FROM (SELECT DISTINCT t2.b FROM t1,t2,t3 WHERE t3.a = t2.a) t;
-
-SELECT * FROM v1;
-EXPLAIN
-SELECT * FROM v1;
-
-DROP VIEW v1;
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # LP bug #809179: right join over a derived table / view
---echo #
-
-CREATE TABLE t1 (a int, b int);
-INSERT INTO t1 VALUES (6,5);
-
-CREATE TABLE t2 (a int, b int);
-INSERT INTO t2 VALUES (1,0);
-
-CREATE TABLE t3 (a int, b int);
-INSERT INTO t3 VALUES (6,5);
-
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-SELECT t.a,t.b FROM t3 RIGHT JOIN (t1 AS t, t2) ON t2.b != 0
- WHERE (t.a,t.b) NOT IN (SELECT 7, 5);
-EXPLAIN EXTENDED
-SELECT t.a,t.b FROM t3 RIGHT JOIN (t1 AS t, t2) ON t2.b != 0
- WHERE (t.a,t.b) NOT IN (SELECT 7, 5);
-
-SELECT t.a,t.b FROM t3 RIGHT JOIN ((SELECT * FROM t1) AS t, t2) ON t2.b != 0
- WHERE (t.a,t.b) NOT IN (SELECT 7, 5);
-EXPLAIN EXTENDED
-SELECT t.a,t.b FROM t3 RIGHT JOIN ((SELECT * FROM t1) AS t, t2) ON t2.b != 0
- WHERE (t.a,t.b) NOT IN (SELECT 7, 5);
-
-SELECT t.a,t.b FROM t3 RIGHT JOIN (v1 AS t, t2) ON t2.b != 0
- WHERE (t.a,t.b) NOT IN (SELECT 7, 5);
-EXPLAIN EXTENDED
-SELECT t.a,t.b FROM t3 RIGHT JOIN (v1 AS t, t2) ON t2.b != 0
- WHERE (t.a,t.b) NOT IN (SELECT 7, 5);
-
-DROP VIEW v1;
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # LP bug #794901: insert into a multi-table view
---echo #
-
-CREATE TABLE t1 (a int);
-CREATE TABLE t2 (a int);
-CREATE TABLE t3 (a int);
-
-CREATE VIEW v1 AS SELECT t1.a FROM t1,t2;
-CREATE VIEW v2 AS SELECT a FROM t2 GROUP BY a;
-CREATE VIEW v3 AS SELECT v1.a FROM v1,v2;
-
--- error ER_NON_INSERTABLE_TABLE
-INSERT INTO v3(a) VALUES (1);
-
-DROP VIEW v1,v2,v3;
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # LP bug #793448: materialized view accessed by two-component key
---echo #
-
-CREATE TABLE t1 (a int, b int);
-INSERT INTO t1 VALUES (9,3), (2,5);
-
-CREATE TABLE t2 (a int, b int);
-INSERT INTO t2 VALUES (9,3), (3,7), (9,1), (2,5), (2,4), (3,8);
-
-CREATE TABLE t3 (a int, b int);
-INSERT INTO t3 VALUES (10,3), (9,7), (9,1), (2,4);
-
-CREATE VIEW v1(a,b) AS SELECT a, MAX(b) FROM t2 GROUP BY a;
-CREATE VIEW v2(a,b) AS SELECT a,b FROM t2 UNION SELECT a,b FROM t3;
-
-SELECT * FROM v1;
-SELECT a FROM t1 WHERE (a,b) IN (SELECT * FROM v1);
-EXPLAIN
-SELECT a FROM t1 WHERE (a,b) IN (SELECT * FROM v1);
-
-SELECT * FROM v2;
-SELECT a FROM t1 WHERE (a,b) IN (SELECT * FROM v2);
-EXPLAIN
-SELECT a FROM t1 WHERE (a,b) IN (SELECT * FROM v2);
-
-DROP VIEW v1,v2;
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # LP bug #804686: query over a derived table using a view
---echo # with a degenerated where condition
---echo #
-
-CREATE TABLE t1 (a int, b int);
-INSERT INTO t1 VALUES (0,0), (1,0), (0,0), (1,1), (1,0);
-CREATE VIEW v1 AS SELECT a,b FROM t1;
-CREATE VIEW v2 AS SELECT a, MAX(b) AS b FROM t1 GROUP BY a;
-
-SELECT * FROM (SELECT b FROM v1 WHERE b = 0) t WHERE b<>0;
-SELECT * FROM (SELECT b FROM v2 WHERE b = 0) t WHERE b<>0;
-SELECT * FROM (SELECT b FROM v1 WHERE b = 0) t WHERE b;
-SELECT * FROM (SELECT b FROM v2 WHERE b = 0) t WHERE b;
-EXPLAIN EXTENDED
-SELECT * FROM (SELECT b FROM v1 WHERE b = 0) t WHERE b;
-EXPLAIN EXTENDED
-SELECT * FROM (SELECT b FROM v2 WHERE b = 0) t WHERE b;
-
-DROP VIEW v1,v2;
-DROP TABLE t1;
-
---echo #
---echo # LP bug #819716: crash with embedded tableless materialized derived
---echo # with a variable
---echo #
-
-set optimizer_switch='derived_merge=off';
-EXPLAIN
-SELECT * FROM (SELECT * FROM (SELECT @b) AS t) AS s;
-SELECT * FROM (SELECT * FROM (SELECT @b) AS t) AS s;
-set optimizer_switch='derived_merge=on';
-
---echo #
---echo # LP bug #823826: view over join + IS NULL in WHERE
---echo #
-
-CREATE TABLE t1 (a int) ;
-INSERT INTO t1 VALUES (1), (1);
-
-CREATE TABLE t2 (b int) ;
-INSERT INTO t2 VALUES (9), (NULL), (7);
-
-CREATE VIEW v1 AS SELECT * FROM t1,t2;
-
-EXPLAIN
-SELECT * FROM (SELECT * FROM t1,t2) t WHERE b IS NULL;
-SELECT * FROM (SELECT * FROM t1,t2) t WHERE b IS NULL;
-
-EXPLAIN
-SELECT * FROM v1 WHERE b IS NULL;
-SELECT * FROM v1 WHERE b IS NULL;
-
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
---echo #
---echo # LP bug #823835: a duplicate of #823189 with derived table
---echo #
-
-CREATE TABLE t1 (a varchar(32)) ;
-INSERT INTO t1 VALUES ('r'), ('p');
-
-CREATE TABLE t2 (a int NOT NULL, b varchar(32)) ;
-INSERT INTO t2 VALUES (28,'j');
-
-CREATE TABLE t3 (a int);
-INSERT INTO t3 VALUES (0), (0);
-
-EXPLAIN EXTENDED
-SELECT * FROM (SELECT * FROM t1) AS t
-WHERE EXISTS (SELECT t2.a FROM t3 RIGHT JOIN t2 ON (t3.a = t2.a)
- WHERE t2.b < t.a);
-SELECT * FROM (SELECT * FROM t1) AS t
-WHERE EXISTS (SELECT t2.a FROM t3 RIGHT JOIN t2 ON (t3.a = t2.a)
- WHERE t2.b < t.a);
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # LP bug #824463: nested outer join using a merged view
---echo # as an inner table
---echo #
-
-CREATE TABLE t1 (b int, a int) ;
-
-CREATE TABLE t2 (a int) ;
-INSERT INTO t2 VALUES (5), (6);
-
-CREATE TABLE t3 (a int , c int) ;
-INSERT INTO t3 VALUES (22,1), (23,-1);
-
-CREATE TABLE t4 (a int);
-
-CREATE TABLE t5 (d int) ;
-INSERT INTO t5 VALUES (0), (7), (3), (5);
-
-CREATE VIEW v2 AS SELECT * FROM t2;
-CREATE VIEW v3 AS SELECT * FROM t3;
-
-EXPLAIN EXTENDED
-SELECT STRAIGHT_JOIN *
- FROM ( t2 AS s2
- JOIN
- ( t3 AS s3
- LEFT JOIN
- ( t4 LEFT JOIN t3 ON t4.a != 0 )
- ON s3.a != 0)
- ON s2.a != 0)
- JOIN t5 ON s3.c != 0 AND t5.d = 0;
-SELECT STRAIGHT_JOIN *
- FROM ( t2 AS s2
- JOIN
- ( t3 AS s3
- LEFT JOIN
- ( t4 LEFT JOIN t3 ON t4.a != 0 )
- ON s3.a != 0)
- ON s2.a != 0)
- JOIN t5 ON s3.c != 0 AND t5.d = 0;
-
-EXPLAIN EXTENDED
-SELECT STRAIGHT_JOIN *
- FROM t2 AS s2 , t5,
- (t3 LEFT JOIN (t4 LEFT JOIN t3 AS s3 ON t4.a != 0) ON t3.a != 0)
- WHERE s2.a != 0 AND t3.c != 0 AND t5.d = 0;
-SELECT STRAIGHT_JOIN *
- FROM t2 AS s2 , t5,
- (t3 LEFT JOIN (t4 LEFT JOIN t3 AS s3 ON t4.a != 0) ON t3.a != 0)
- WHERE s2.a != 0 AND t3.c != 0 AND t5.d = 0;
-
-EXPLAIN EXTENDED
-SELECT STRAIGHT_JOIN *
- FROM v2 AS s2 , t5,
- (t3 LEFT JOIN (t4 LEFT JOIN v3 AS s3 ON t4.a != 0) ON t3.a != 0)
- WHERE s2.a != 0 AND t3.c != 0 AND t5.d = 0;
-SELECT STRAIGHT_JOIN *
- FROM v2 AS s2 , t5,
- (t3 LEFT JOIN (t4 LEFT JOIN v3 AS s3 ON t4.a != 0) ON t3.a != 0)
- WHERE s2.a != 0 AND t3.c != 0 AND t5.d = 0;
-
-SELECT STRAIGHT_JOIN *
- FROM ( ( t2 AS s2
- LEFT JOIN
- ( t3 AS s3
- LEFT JOIN
- ( t4 AS s4 JOIN t3 ON s4.a != 0)
- ON s3.a != 0 )
- ON s2.a != 0)
- LEFT JOIN
- t1 AS s1
- ON s1.a != 0)
- JOIN t5 ON s3.c != 0;
-SELECT STRAIGHT_JOIN *
- FROM ( ( v2 AS s2
- LEFT JOIN
- ( v3 AS s3
- LEFT JOIN
- ( t4 AS s4 JOIN v3 ON s4.a != 0)
- ON s3.a != 0 )
- ON s2.a != 0)
- LEFT JOIN
- t1 AS s1
- ON s1.a != 0)
- JOIN t5 ON s3.c != 0;
-
-DROP VIEW v2,v3;
-DROP TABLE t1,t2,t3,t4,t5;
-
---echo #
---echo # LP bug #872735: derived used in a NOT IN subquery
---echo #
-
-CREATE TABLE t1 (b int NOT NULL);
-INSERT INTO t1 VALUES (9), (7);
-
-CREATE TABLE t2 (a int NOT NULL) ;
-INSERT INTO t2 VALUES (1), (2);
-
-CREATE TABLE t3 (
- a int NOT NULL , c int NOT NULL, d varchar(1) NOT NULL,
- KEY (c,a) , PRIMARY KEY (a)
-);
-INSERT INTO t3 VALUES
- (14,4,'a'), (15,7,'b'), (16,4,'c'), (17,1,'d'), (18,9,'e'),
- (19,4,'f'), (20,8,'g');
-
-SET SESSION optimizer_switch='derived_merge=on,subquery_cache=off,materialization=off';
-
---echo # The following two EXPLAINs must return the same execution plan
-EXPLAIN
-SELECT * FROM t1 , t2
- WHERE (t2.a ,t1.b) NOT IN (SELECT DISTINCT c,a FROM t3 t);
-EXPLAIN
-SELECT * FROM t1 , t2
- WHERE (t2.a ,t1.b) NOT IN (SELECT DISTINCT c,a FROM (SELECT * FROM t3) t);
-
-SELECT * FROM t1 , t2
- WHERE (t2.a ,t1.b) NOT IN (SELECT DISTINCT c,a FROM (SELECT * FROM t3) t);
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # LP bug #874006: materialized view used in IN subquery
---echo #
-
-CREATE TABLE t3 (a int NOT NULL, b varchar(1), c varchar(1));
-INSERT INTO t3 VALUES (19,NULL,NULL), (20,'r','r');
-
-CREATE TABLE t1 (a int, b varchar(1) , c varchar(1));
-INSERT INTO t1 VALUES (1,NULL,NULL), (5,'r','r'), (7,'y','y');
-
-CREATE TABLE t2 (a int NOT NULL , b int, c varchar(1));
-INSERT INTO t2 VALUES (4,3,'r');
-
-CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='semijoin_with_cache=off';
-SET SESSION optimizer_switch='derived_with_keys=off';
-EXPLAIN
-SELECT * FROM t3
- WHERE t3.b IN (SELECT v1.b FROM v1, t2
- WHERE t2.c = v1.c AND t2.c = v1.b AND v1.b = t3.c);
-SELECT * FROM t3
- WHERE t3.b IN (SELECT v1.b FROM v1, t2
- WHERE t2.c = v1.c AND t2.c = v1.b AND v1.b = t3.c);
-
-SET SESSION optimizer_switch='derived_with_keys=on';
-EXPLAIN
-SELECT * FROM t3
- WHERE t3.b IN (SELECT v1.b FROM v1, t2
- WHERE t2.c = v1.c AND t2.c = v1.b AND v1.b = t3.c);
-SELECT * FROM t3
- WHERE t3.b IN (SELECT v1.b FROM v1, t2
- WHERE t2.c = v1.c AND t2.c = v1.b AND v1.b = t3.c);
-SET optimizer_switch=@save_optimizer_switch;
-
-DROP VIEW v1;
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # LP bug #873263: materialized view used in correlated IN subquery
---echo #
-
-CREATE TABLE t1 (a int, b int) ;
-INSERT INTO t1 VALUES (5,4), (9,8);
-
-CREATE TABLE t2 (a int, b int) ;
-INSERT INTO t2 VALUES (4,5), (5,1);
-
-CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2;
-
-SET SESSION optimizer_switch='derived_with_keys=on';
-EXPLAIN
-SELECT * FROM t1 WHERE t1.b IN (SELECT v2.a FROM v2 WHERE v2.b = t1.a);
-SELECT * FROM t1 WHERE t1.b IN (SELECT v2.a FROM v2 WHERE v2.b = t1.a);
-
-DROP VIEW v2;
-DROP TABLE t1,t2;
-
---echo #
---echo # LP bug #877316: query over a view with correlated subquery in WHERE
---echo #
-
-CREATE TABLE t1 (a int, b int, PRIMARY KEY (a)) ;
-INSERT INTO t1 VALUES (18,2), (19,9);
-
-CREATE TABLE t2 (a int, b int) ;
-INSERT INTO t2 VALUES (10,8), (5,10);
-
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-SELECT t1.a FROM t1
- WHERE EXISTS (SELECT t2.a FROM t2 WHERE t2.b < t1.b);
-EXPLAIN
-SELECT t1.a FROM t1
- WHERE EXISTS (SELECT t2.a FROM t2 WHERE t2.b < t1.b);
-
-SELECT v1.a FROM v1
- WHERE EXISTS (SELECT t2.a FROM t2 WHERE t2.b < v1.b);
-EXPLAIN
-SELECT v1.a FROM v1
- WHERE EXISTS (SELECT t2.a FROM t2 WHERE t2.b < v1.b);
-
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
---echo #
---echo # LP bug #878199: join of two materialized views
---echo #
-
-CREATE TABLE t1 (a int, b varchar(1)) ;
-INSERT INTO t1 VALUES (7,'c'), (3,'h'), (7,'c');
-
-CREATE TABLE t2 (b varchar(1)) ;
-INSERT INTO t2 VALUES ('p'), ('c'), ('j'), ('c'), ('p');
-
-CREATE VIEW v1 AS SELECT * FROM t1 GROUP BY a,b;
-
-CREATE VIEW v2 AS SELECT * FROM t2 GROUP BY b;
-
-SET SESSION optimizer_switch = 'derived_with_keys=on';
-
-SELECT v1.a FROM v1,v2 WHERE v2.b = v1.b ORDER BY 1;
-EXPLAIN
-SELECT v1.a FROM v1,v2 WHERE v2.b = v1.b ORDER BY 1;
-
-DROP VIEW v1,v2;
-DROP TABLE t1,t2;
-
-
---echo #
---echo # Bug #743378: join over merged view employing BNL
---echo #
-
-CREATE TABLE t1 ( d varchar(1) NOT NULL) ;
-INSERT INTO t1 VALUES ('j'),('v'),('c');
-
-CREATE TABLE t2 (h time NOT NULL, d varchar(1) NOT NULL) ;
-INSERT INTO t2 VALUES ('05:03:03','w'),('02:59:24','d'),('00:01:58','e');
-
-CREATE TABLE t3 (
- b int NOT NULL, e varchar(1) NOT NULL, d varchar(1) NOT NULL, KEY (e,b)
-);
-INSERT INTO t3 VALUES (4,'x','x'),(9,'w','w'),(4,'d','d'),(8,'e','e');
-INSERT INTO t3 VALUES (14,'a','a'),(19,'b','b'),(14,'c','c'),(18,'d','d');
-
-CREATE TABLE t4 (i int NOT NULL, m varchar(1) NOT NULL) ;
-INSERT INTO t4 VALUES (8,'m'),(9,'d'),(2,'s'),(4,'r'),(8,'m');
-
-CREATE TABLE t5 (
- a int NOT NULL, c int NOT NULL, b int NOT NULL, f date NOT NULL,
- g date NOT NULL, h time NOT NULL, j time NOT NULL, k datetime NOT NULL
-);
-
-INSERT INTO t5 VALUES
- (1,4,0,'0000-00-00','0000-00-00','21:22:34','21:22:34','2002-02-13 17:30'),
- (2,6,8,'2004-09-18','2004-09-18','10:50:38','10:50:38','2008-09-27 00:34');
-
-CREATE VIEW v3 AS SELECT t3.*, t4.i FROM t3, t4, t5;
-
-SET SESSION join_cache_level = 1;
-SET SESSION join_buffer_size = 512;
-
-EXPLAIN
-SELECT t2.d FROM t1,t2,v3 WHERE v3.e = t2.d AND v3.i < 3;
-SELECT t2.d FROM t1,t2,v3 WHERE v3.e = t2.d AND v3.i < 3;
-
-SET SESSION join_cache_level = DEFAULT;
-SET SESSION join_buffer_size = DEFAULT;
-
-DROP VIEW v3;
-DROP TABLE t1,t2,t3,t4,t5;
-
---echo #
---echo # Bug #879882: right join within mergeable derived table
---echo #
-
-CREATE TABLE t1 (a varchar(1));
-INSERT INTO t1 VALUES ('c'), ('a');
-
-CREATE TABLE t2 (a int, b int, c varchar(1));
-INSERT INTO t2 VALUES (29,8,'c'), (39,7,'b');
-
-CREATE TABLE t3 (b int);
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='outer_join_with_cache=off';
-
-EXPLAIN EXTENDED
-SELECT t.b, t.c, t1.a
-FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
- WHERE t.b AND t.c = t1.a;
-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;
-
-EXPLAIN EXTENDED
-SELECT t.b, t.c, t1.a
-FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
- WHERE t.b <> 0 AND t.c = t1.a;
-SELECT t.b, t.c, t1.a
-FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
- WHERE t.b <> 0 AND t.c = t1.a;
-
-INSERT INTO t3 VALUES (100), (200);
-
-EXPLAIN EXTENDED
-SELECT t.b, t.c, t1.a
-FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
- WHERE t.b AND t.c = t1.a;
-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;
-
-EXPLAIN EXTENDED
-SELECT t.b, t.c, t1.a
-FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
- WHERE t.b <> 0 AND t.c = t1.a;
-SELECT t.b, t.c, t1.a
-FROM t1, (SELECT t2.b, t2.c FROM t3 RIGHT JOIN t2 ON t2.a = t3.b) AS t
- WHERE t.b <> 0 AND t.c = t1.a;
-
-SET optimizer_switch=@save_optimizer_switch;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # Bug #880724: materialized const view as inner table of outer join
---echo #
-
-CREATE TABLE t1 (a int, b varchar(1));
-INSERT INTO t1 VALUES (9,NULL), (6,'r'), (7,'c');
-
-CREATE TABLE t2 (a int);
-INSERT INTO t2 VALUES (6);
-
-CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2;
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='outer_join_with_cache=off';
-
-SET SESSION optimizer_switch = 'derived_with_keys=on';
-SET SESSION join_cache_level = 4;
-
-EXPLAIN
-SELECT t1.b,v2.a FROM t1 LEFT JOIN v2 ON v2.a = t1.a;
-SELECT t1.b,v2.a FROM t1 LEFT JOIN v2 ON v2.a = t1.a;
-
-CREATE TABLE t3 (a int, b varchar(1));
-INSERT INTO t3 VALUES (8,'x'), (5,'r'), (9,'y');
-
-EXPLAIN
-SELECT * FROM t3
- WHERE t3.b <> ANY (SELECT t1.b FROM t1 LEFT JOIN v2 ON v2.a = t1.a);
-SELECT * FROM t3
- WHERE t3.b <> ANY (SELECT t1.b FROM t1 LEFT JOIN v2 ON v2.a = t1.a);
-
-SET SESSION join_cache_level = default;
-
-SET optimizer_switch=@save_optimizer_switch;
-
-DROP VIEW v2;
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # Bug #881449: OUTER JOIN usin a merged view within IN subquery
---echo #
-
-CREATE TABLE t1 (a varchar(1)) ;
-INSERT INTO t1 VALUES ('y'), ('x');
-
-CREATE TABLE t2 (a int, PRIMARY KEY (a)) ;
-INSERT INTO t2 VALUES (1), (2);
-
-CREATE TABLE t3 (a int, b varchar(1)) ;
-INSERT INTO t3 VALUES (1,'x');
-
-CREATE VIEW v3 AS SELECT * FROM t3;
-
-SET SESSION optimizer_switch='semijoin=on';
-
-EXPLAIN
-SELECT * FROM t1 WHERE a IN (SELECT v3.b FROM t2 RIGHT JOIN v3 ON v3.a = t2.a);
-SELECT * FROM t1 WHERE a IN (SELECT v3.b FROM t2 RIGHT JOIN v3 ON v3.a = t2.a);
-
-set optimizer_switch= @save_optimizer_switch;
-
-DROP VIEW v3;
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # Bug #874035: view as an inner table of a materialized derived
---echo #
-
-CREATE TABLE t2 (a int NOT NULL);
-INSERT INTO t2 VALUES (7), (4);
-
-CREATE TABLE t1 (b int NOT NULL);
-INSERT INTO t1 VALUES (5), (7);
-CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
-SET @save_optimizer_switch=@@optimizer_switch;
-SET SESSION optimizer_switch='derived_merge=off';
-
-PREPARE st1 FROM
-'SELECT * FROM (SELECT * FROM t2 LEFT JOIN v1 ON t2.a = v1.b) AS t';
-EXECUTE st1;
-EXECUTE st1;
-DEALLOCATE PREPARE st1;
-
-set SESSION optimizer_switch= @save_optimizer_switch;
-
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
-
-
---echo #
---echo # LP bug #879939: assertion in ha_maria::enable_indexes
---echo # with derived_with_keys=on
---echo #
-
-CREATE TABLE t2 (a varchar(3));
-INSERT INTO t2 VALUES ('USA'), ('USA'), ('USA'), ('USA'), ('USA');
-
-CREATE TABLE t1 (a varchar(3), b varchar(35));
-INSERT INTO t1 VALUES
- ('USA','Lansing'), ('USA','Laredo'), ('USA','Las Vegas'),
- ('USA','Lexington-Fayett'), ('USA','Lincoln'), ('USA','Little Rock'),
- ('USA','Livonia'), ('USA','Long Beach'), ('USA','Los Angeles'),
- ('USA','Louisville'), ('USA','Lowell'), ('USA','Lubbock'),
- ('USA','Macon'), ('USA','Madison'), ('USA','Manchester'),
- ('USA','McAllen'), ('USA','Memphis'), ('USA','Mesa'),
- ('USA','Mesquite'), ('USA','Metairie'), ('USA','Miami');
-
-CREATE TABLE t3 (a varchar(35));
-INSERT INTO t3 VALUES ('Miami');
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch = 'derived_with_keys=on';
-SET @@tmp_table_size=1024*4;
-explain SELECT * FROM (SELECT t1.* FROM t1, t2) AS t JOIN t3 ON t3.a = t.b;
-SELECT * FROM (SELECT t1.* FROM t1, t2) AS t JOIN t3 ON t3.a = t.b;
-SET @@tmp_table_size=1024*1024*16;
-SELECT * FROM (SELECT t1.* FROM t1, t2) AS t JOIN t3 ON t3.a = t.b;
-SET @@tmp_table_size=default;
-set SESSION optimizer_switch= @save_optimizer_switch;
-drop table t1,t2,t3;
-
---echo #
---echo # BUG#882994: Crash in QUICK_RANGE_SELECT::reset with derived_with_keys
---echo #
-CREATE TABLE t2 (
- pk varchar(33),
- col_varchar_key varchar(3) NOT NULL,
- col_varchar_nokey varchar(52) NOT NULL);
-
-INSERT INTO t2 VALUES ('NICSpanish','NIC','Spanish'),
- ('NERHausa','NER','Hausa'),('NGAJoruba','NGA','Joruba'),
- ('NIUNiue','NIU','Niue'),('NFKEnglish','NFK','English'),
- ('NORNorwegian','NOR','Norwegian'),('CIVAkan','CIV','Akan'),
- ('OMNArabic','OMN','Arabic'),('PAKPunjabi','PAK','Punjabi'),
- ('PLWPalau','PLW','Palau'),('PANSpanish','PAN','Spanish'),
- ('PNGPapuan Langua','PNG','Papuan Languages'), ('PRYSpanish','PRY','Spanish'),
- ('PERSpanish','PER','Spanish'), ('PCNPitcairnese','PCN','Pitcairnese'),
- ('MNPPhilippene La','MNP','Philippene Langu'),('PRTPortuguese','PRT','Portuguese'),
- ('PRISpanish','PRI','Spanish'),('POLPolish','POL','Polish'),('GNQFang','GNQ','Fang');
-
-CREATE TABLE t1 ( col_varchar_nokey varchar(52) NOT NULL ) ;
-INSERT INTO t1 VALUES ('Chinese'),('English'),('French'),('German'),
- ('Italian'),('Japanese'),('Korean'),('Polish'),('Portuguese'),('Spanish'),
- ('Tagalog'),('Vietnamese');
-CREATE TABLE t3 ( col_varchar_key varchar(52)) ;
-INSERT INTO t3 VALUES ('United States');
-
-set @tmp_882994= @@max_heap_table_size;
---disable_warnings
-set max_heap_table_size=1;
---enable_warnings
-
-SELECT *
-FROM t3 JOIN
-( SELECT t2.* FROM t1, t2 ) AS alias2
-ON ( alias2.col_varchar_nokey = t3.col_varchar_key )
-ORDER BY CONCAT(alias2.col_varchar_nokey);
-
-set max_heap_table_size= @tmp_882994;
-drop table t1,t2,t3;
-
---echo #
---echo # LP bug #917990: Bad estimate of #rows for derived table with LIMIT
---echo #
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES
- (8), (3), (4), (7), (9), (5), (1), (2);
-
-SELECT * FROM (SELECT * FROM t1 LIMIT 3) t;
-EXPLAIN
-SELECT * FROM (SELECT * FROM t1 LIMIT 3) t;
-
-DROP TABLE t1;
-
---echo #
---echo # LP BUG#921878 incorrect check of items during columns union types
---echo # aggregation for merged derived tables
---echo #
-SET @save_optimizer_switch=@@optimizer_switch;
-SET SESSION optimizer_switch='derived_merge=on';
-CREATE TABLE t1 ( a ENUM( 'x', 'y' ) );
-insert into t1 values ('x');
-CREATE TABLE t2 LIKE t1;
-insert into t1 values ('y');
-CREATE TABLE t3 LIKE t1;
-INSERT INTO t3
- SELECT * FROM ( SELECT * FROM t1 ) AS A
- UNION SELECT * FROM t2;
-select * from t3;
-
-drop table t1,t2,t3;
-
-set SESSION optimizer_switch= @save_optimizer_switch;
-
---echo #
---echo # LP BUG#944782: derived table from an information schema table
---echo #
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET SESSION optimizer_switch='derived_merge=on';
-SET SESSION optimizer_switch='derived_with_keys=on';
-
-CREATE TABLE t1 (c1 int PRIMARY KEY, c2 char(5));
-
-EXPLAIN
-SELECT COUNT(*) > 0
- FROM INFORMATION_SCHEMA.COLUMNS
- INNER JOIN
- (SELECT TABLE_SCHEMA,
- GROUP_CONCAT(COLUMN_NAME ORDER BY SEQ_IN_INDEX ASC) AS COL_NAMES
- FROM INFORMATION_SCHEMA.STATISTICS
- GROUP BY TABLE_SCHEMA) AS UNIQUES
- ON ( COLUMNS.TABLE_SCHEMA = UNIQUES.TABLE_SCHEMA);
-
-# this query crashed in mariadb-5.5.20
-SELECT COUNT(*) > 0
- FROM INFORMATION_SCHEMA.COLUMNS
- INNER JOIN
- (SELECT TABLE_SCHEMA,
- GROUP_CONCAT(COLUMN_NAME ORDER BY SEQ_IN_INDEX ASC) AS COL_NAMES
- FROM INFORMATION_SCHEMA.STATISTICS
- GROUP BY TABLE_SCHEMA) AS UNIQUES
- ON ( COLUMNS.TABLE_SCHEMA = UNIQUES.TABLE_SCHEMA);
-
-DROP TABLE t1;
-
-SET SESSION optimizer_switch= @save_optimizer_switch;
-
---echo #
---echo # LP BUG#953649: crash when estimating the cost of a look-up
---echo # into a derived table to be materialized
---echo #
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (132);
-
-CREATE TABLE t2 (b int, c varchar(256));
-INSERT INTO t2 VALUES (132,'test1'), (120,'text2'), (132,'text3');
-
-CREATE VIEW v AS
- SELECT b, GROUP_CONCAT(c) AS gc FROM t2 GROUP BY b;
-
-SET @save_optimizer_switch=@@optimizer_switch;
-
-SET SESSION optimizer_switch='derived_merge=off';
-SET SESSION optimizer_switch='derived_with_keys=off';
-EXPLAIN
-SELECT * FROM t1, v WHERE a = b;
-SELECT * FROM t1, v WHERE a = b;
-
-SET SESSION optimizer_switch='derived_merge=on';
-SET SESSION optimizer_switch='derived_with_keys=on';
-EXPLAIN
-SELECT * FROM t1, v WHERE a = b;
-SELECT * FROM t1, v WHERE a = b;
-
-SET SESSION optimizer_switch= @save_optimizer_switch;
-
-DROP VIEW v;
-DROP TABLE t1,t2;
-
---echo #
---echo # LP BUG#968720 crash due to converting to materialized and
---echo # natural join made only once
---echo #
-
-SET @save968720_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch = 'derived_merge=on';
-
-CREATE TABLE t1 (a int, INDEX(a));
-INSERT INTO t1 VALUES (1);
-
-CREATE TABLE t2 (a int, INDEX(a));
-INSERT INTO t2 VALUES (1), (2);
-
-INSERT INTO t1 SELECT a FROM (SELECT a FROM test.t1) AS s1 NATURAL JOIN
-t2 AS s2;
-SELECT * FROM t1;
-
-DELETE FROM t1;
-INSERT INTO t1 VALUES (1);
-
-PREPARE stmt FROM "
-INSERT INTO t1 SELECT a FROM (SELECT a FROM test.t1) AS s1 NATURAL JOIN
-t2 AS s2;
-";
-EXECUTE stmt;
-SELECT * FROM t1;
-EXECUTE stmt;
-SELECT * FROM t1;
-
-drop table t1,t2;
-set optimizer_switch=@save968720_optimizer_switch;
-
---echo #
---echo # LP BUG#978847 Server crashes in Item_ref::real_item on
---echo # INSERT .. SELECT with FROM subquery and derived_merge=ON
-SET @save978847_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch = 'derived_merge=on';
-
-CREATE TABLE t1 ( a INT, b INT );
-INSERT INTO t1 VALUES (2,1),(3,2);
-
-select * from t1;
-INSERT INTO t1 SELECT * FROM
- ( SELECT * FROM t1 ) AS alias;
-select * from t1;
-prepare stmt1 from 'INSERT INTO t1 SELECT SQL_BIG_RESULT * FROM
- ( SELECT * FROM t1 ) AS alias';
-execute stmt1;
-select * from t1;
-execute stmt1;
-select * from t1;
-
-drop table t1;
-
-set optimizer_switch=@save978847_optimizer_switch;
-
-
---echo #
---echo # LP bug998516 Server hangs on INSERT .. SELECT with derived_merge,
---echo # FROM subquery, UNION
---echo #
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1),(2);
-CREATE TABLE t2 (b INT);
-INSERT INTO t2 VALUES (3),(4);
-INSERT INTO t1 SELECT * FROM ( SELECT * FROM t1 ) AS alias UNION SELECT * FROM t2;
-select * from t1;
-drop table t1,t2;
-
---echo #
---echo # MDEV-3873: Wrong result (extra rows) with NOT IN and
---echo # a subquery from a MERGE view
---echo #
-
-CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (4),(7),(0);
-
-CREATE TABLE t2 (b INT NOT NULL) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (1),(2);
-
-CREATE TABLE t3 (c INT NOT NULL) ENGINE=MyISAM;
-INSERT INTO t3 VALUES (4),(6),(3);
-
-CREATE TABLE t4 (d INT NOT NULL) ENGINE=MyISAM;
-INSERT INTO t4 VALUES (4),(5),(3);
-
-CREATE TABLE tv (e INT NOT NULL) ENGINE=MyISAM;
-INSERT INTO tv VALUES (1),(3);
-
-CREATE ALGORITHM=TEMPTABLE VIEW v_temptable AS SELECT * FROM tv;
-CREATE ALGORITHM=MERGE VIEW v_merge AS SELECT * FROM tv;
-
-SELECT * FROM t1, t2
-WHERE a NOT IN ( SELECT e FROM t3 LEFT JOIN v_temptable ON (c = e) WHERE c <> b ) AND a < b;
-
-SELECT * FROM t1, t2
-WHERE a NOT IN ( SELECT e FROM t3 LEFT JOIN v_merge ON (c = e) WHERE c <> b ) AND a < b;
-
-SELECT * FROM t1, t2
-WHERE a NOT IN ( SELECT e FROM t3 LEFT JOIN (SELECT * FROM tv) as derived ON (c = e) WHERE c <> b ) AND a < b;
-
-drop view v_temptable, v_merge;
-drop table t1,t2,t3,t4,tv;
-
---echo #
---echo # MDEV-3912: Wrong result (extra rows) with FROM subquery inside
---echo # ALL subquery, LEFT JOIN, derived_merge.
---echo # (duplicate of MDEV-3873 (above))
---echo #
-
-SET @save3912_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch = 'derived_merge=on,in_to_exists=on';
-
-CREATE TABLE t1 (a INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (4),(8);
-
-CREATE TABLE t2 (b INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (7),(0);
-
-CREATE TABLE t3 (c INT, d INT NOT NULL) ENGINE=MyISAM;
-INSERT INTO t3 VALUES (0,4),(8,6);
-
-SELECT * FROM t1
-WHERE a >= ALL (
-SELECT d FROM t2 LEFT JOIN ( SELECT * FROM t3 ) AS alias ON ( c = b )
-WHERE b >= a
-);
-set optimizer_switch=@save3912_optimizer_switch;
-drop table t1, t2, t3;
-
---echo #
---echo # MDEV-4209: equi-join on BLOB column from materialized view
---echo # or derived table
---echo #
-
-set @save_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='derived_with_keys=on';
-
-CREATE TABLE t1 (c1 text, c2 int);
-INSERT INTO t1 VALUES ('a',1), ('c',3), ('g',7), ('d',4), ('c',3);
-CREATE TABLE t2 (c1 text, c2 int);
-INSERT INTO t2 VALUES ('b',2), ('c',3);
-CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
-
-EXPLAIN EXTENDED
-SELECT v1.c1, v1.c2 FROM v1, t2 WHERE v1.c1=t2.c1 AND v1.c2=t2.c2;
-SELECT v1.c1, v1.c2 FROM v1, t2 WHERE v1.c1=t2.c1 AND v1.c2=t2.c2;
-
-EXPLAIN EXTENDED
-SELECT t2.c1, t2.c2 FROM (SELECT c1 g, MAX(c2) m FROM t1 GROUP BY c1) t, t2
- WHERE t.g=t2.c1 AND t.m=t2.c2;
-SELECT t2.c1, t2.c2 FROM (SELECT c1 g, MAX(c2) m FROM t1 GROUP BY c1) t, t2
- WHERE t.g=t2.c1 AND t.m=t2.c2;
-
-EXPLAIN EXTENDED
-SELECT v1.c1, v1.c2, t2.c1, t2.c2 FROM v1, t2 WHERE v1.c1=t2.c1;
-SELECT v1.c1, v1.c2, t2.c1, t2.c2 FROM v1, t2 WHERE v1.c1=t2.c1;
-
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
-set optimizer_switch=@save_optimizer_switch;
-
-
---echo #
---echo # mdev-5078: sum over a view/derived table
---echo #
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 (a) VALUES (1), (2);
-
-CREATE TABLE t2 (b int(11));
-INSERT INTO t2 (b) VALUES (1), (2);
-
-CREATE VIEW v AS SELECT b as c FROM t2;
-
-SELECT a, (SELECT SUM(a + c) FROM v) FROM t1;
-
-SELECT a, (SELECT SUM(a + c) FROM (SELECT b as c FROM t2) AS v1) FROM t1;
-
-DROP VIEW v;
-DROP TABLE t1,t2;
-
---echo #
---echo # mdev-5105: memory overwrite in multi-table update
---echo # using natural join with a view
---echo #
-
-create table t1(a int,b tinyint,c tinyint)engine=myisam;
-create table t2(a tinyint,b float,c int, d int, e int, f int, key (b), key(c), key(d), key(e), key(f))engine=myisam;
-create table t3(a int,b int,c int, d int, e int, f int, key(a), key(b), key(c), key(d), key(e), key(f))engine=myisam;
-create view v1 as select t2.b a, t1.b b, t2.c c, t2.d d, t2.e e, t2.f f from t1,t2 where t1.a=t2.a;
-
-update t3 natural join v1 set a:=1;
-drop view v1;
-drop table t1,t2,t3;
-
---echo #
---echo # mdev-5288: assertion failure for query over a view with ORDER BY
---echo #
-
-CREATE TABLE t1 (a int, b int) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (4,1);
-
-CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
-EXPLAIN EXTENDED SELECT a FROM v1 WHERE a > 100 ORDER BY b;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-#
-# MDEV-5414: RAND() in a subselect : different behavior in MariaDB and MySQL
-#
-CREATE TABLE IF NOT EXISTS `galleries` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `name` varchar(100) NOT NULL,
- `year` int(11) DEFAULT NULL,
- PRIMARY KEY (`id`),
- UNIQUE KEY `name` (`name`)
-) DEFAULT CHARSET=utf8;
-
-CREATE TABLE IF NOT EXISTS `pictures` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `name` varchar(100) NOT NULL,
- `width` float DEFAULT NULL,
- `height` float DEFAULT NULL,
- `year` int(4) DEFAULT NULL,
- `technique` varchar(50) DEFAULT NULL,
- `comment` varchar(2000) DEFAULT NULL,
- `gallery_id` int(11) NOT NULL,
- `type` int(11) NOT NULL,
- PRIMARY KEY (`id`),
- KEY `gallery_id` (`gallery_id`)
-) DEFAULT CHARSET=utf8 ;
-
-ALTER TABLE `pictures`
- ADD CONSTRAINT `pictures_ibfk_1` FOREIGN KEY (`gallery_id`) REFERENCES `galleries` (`id`);
-
-INSERT INTO `galleries` (`id`, `name`, `year`) VALUES
-(1, 'Quand le noir et blanc invite le taupe', 2013),
-(2, 'Une touche de couleur', 2012),
-(3, 'Éclats', 2011),
-(4, 'Gris béton', 2010),
-(5, 'Expression du spalter', 2010),
-(6, 'Zénitude', 2009),
-(7, 'La force du rouge', 2008),
-(8, 'Sphères', NULL),
-(9, 'Centre', 2009),
-(10, 'Nébuleuse', NULL);
-
-INSERT INTO `pictures` (`id`, `name`, `width`, `height`, `year`, `technique`, `comment`, `gallery_id`, `type`) VALUES
-(1, 'Éclaircie', 72.5, 100, NULL, NULL, NULL, 1, 1),
-(2, 'Architecture', 81, 100, NULL, NULL, NULL, 1, 1),
-(3, 'Nouveau souffle', 72.5, 100, NULL, NULL, NULL, 1, 1),
-(4, 'Échanges (2)', 89, 116, NULL, NULL, NULL, 1, 1),
-(5, 'Échanges', 89, 116, NULL, NULL, NULL, 1, 1),
-(6, 'Fenêtre de vie', 81, 116, NULL, NULL, NULL, 1, 1),
-(7, 'Architecture', 81, 100, NULL, NULL, NULL, 1, 1),
-(8, 'Nouveau souffle (2)', 72.5, 100, NULL, NULL, NULL, 1, 1),
-(9, 'Fluidité', 89, 116, NULL, NULL, NULL, 1, 1),
-(10, 'Nouveau Monde', 89, 125, NULL, NULL, NULL, 1, 1),
-(11, 'Mirage', 73, 100, NULL, NULL, NULL, 1, 1),
-(12, 'Équilibre', 72.5, 116, NULL, NULL, NULL, 2, 1),
-(13, 'Fusion', 72.5, 116, NULL, NULL, NULL, 2, 1),
-(14, 'Étincelles', NULL, NULL, NULL, NULL, NULL, 3, 1),
-(15, 'Régénérescence', NULL, NULL, NULL, NULL, NULL, 3, 1),
-(16, 'Chaleur', 80, 80, NULL, NULL, NULL, 4, 1),
-(17, 'Création', 90, 90, NULL, NULL, NULL, 4, 1),
-(18, 'Horizon', 92, 73, NULL, NULL, NULL, 4, 1),
-(19, 'Labyrinthe', 81, 100, NULL, NULL, NULL, 4, 1),
-(20, 'Miroir', 80, 116, NULL, NULL, NULL, 5, 1),
-(21, 'Libération', 81, 116, NULL, NULL, NULL, 5, 1),
-(22, 'Éclats', 81, 116, NULL, NULL, NULL, 5, 1),
-(23, 'Zénitude', 116, 89, NULL, NULL, NULL, 6, 1),
-(24, 'Écritures lointaines', 90, 90, NULL, NULL, NULL, 7, 1),
-(25, 'Émergence', 80, 80, NULL, NULL, NULL, 7, 1),
-(26, 'Liberté', 50, 50, NULL, NULL, NULL, 7, 1),
-(27, 'Silhouettes amérindiennes', 701, 70, NULL, NULL, NULL, 7, 1),
-(28, 'Puissance', 81, 100, NULL, NULL, NULL, 8, 1),
-(29, 'Source', 73, 116, NULL, NULL, NULL, 8, 1),
-(30, 'Comme une ville qui prend vie', 50, 100, 2008, NULL, NULL, 9, 1),
-(31, 'Suspension azur', 80, 80, NULL, NULL, NULL, 9, 1),
-(32, 'Nébuleuse', 70, 70, NULL, NULL, NULL, 10, 1),
-(33, 'Œuvre commandée 120 P', 114, 195, NULL, NULL, NULL, 1, 2),
-(34, 'Œuvre commandée 120 P', 114, 195, NULL, NULL, NULL, 1, 2),
-(35, 'Œuvre commandée 120 P', 114, 195, NULL, NULL, NULL, 1, 2),
-(36, 'Œuvre commandée 120 P', 114, 195, NULL, NULL, NULL, 1, 2),
-(37, 'Œuvre commandée 120 P', 114, 195, NULL, NULL, NULL, 1, 2),
-(38, 'Œuvre commandée 120 P', 114, 195, NULL, NULL, NULL, 1, 2);
-
-# Now we only lest explain to be sure that table materialized. If
-# in the future merged derived table will be processed in a way that
-# rand() can be called only once then other way of testing correctness
-# of this query should be put here.
-explain
-SELECT g.id AS gallery_id,
- g.name AS gallery_name,
- p.id AS picture_id,
- p.name AS picture_name,
- g.p_random AS r1,
- g.p_random AS r2,
- g.p_random AS r3
-FROM
-(
- SELECT gal.id,
- gal.name,
- (
- SELECT pi.id
- FROM pictures pi
- WHERE pi.gallery_id = gal.id
- ORDER BY RAND()
- LIMIT 1
- ) AS p_random
- FROM galleries gal
-) g
-LEFT JOIN pictures p
- ON p.id = g.p_random
-ORDER BY gallery_name ASC
-;
-
-drop table galleries, pictures;
-
---echo #
---echo # MDEV-5740: Assertion
---echo #`!derived->first_select()->exclude_from_table_unique_test ||
---echo #derived->outer_select()-> exclude_from_table_unique_test'
---echo #failed on 2nd execution of PS with derived_merge
---echo #
-
-set @save_optimizer_switch5740=@@optimizer_switch;
-SET optimizer_switch = 'derived_merge=on';
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1),(2);
-CREATE TABLE t2 (b INT);
-INSERT INTO t2 VALUES (3),(4);
-
-PREPARE stmt FROM '
- INSERT INTO t1 SELECT * FROM t2 UNION SELECT * FROM (SELECT * FROM t1) AS sq
-';
-EXECUTE stmt;
-select * from t1;
-EXECUTE stmt;
-select * from t1;
-deallocate prepare stmt;
-
-drop table t1,t2;
-set optimizer_switch=@save_optimizer_switch5740;
-
---echo #
---echo # Bug mdev-5721: possible long key access to a materialized derived table
---echo # (see also the test case for Bug#13261277 that is actually the same bug)
---echo #
-
-CREATE TABLE t1 (
- id varchar(255) NOT NULL DEFAULT '',
- familyid int(11) DEFAULT NULL,
- withdrawndate date DEFAULT NULL,
- KEY index_td_familyid_id (familyid,id)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-
-CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- activefromts datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- shortdescription text,
- useraccessfamily varchar(512) DEFAULT NULL,
- serialized longtext,
- PRIMARY KEY (id)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-
-insert into t1 values ('picture/89/1369722032695.pmd',89,NULL);
-insert into t1 values ('picture/90/1369832057370.pmd',90,NULL);
-insert into t2 values (38,'2013-03-04 07:49:22','desc','CODE','string');
-
-EXPLAIN
-SELECT * FROM t2 x,
-(SELECT t2.useraccessfamily, t2.serialized AS picturesubuser, COUNT(*)
- FROM t2, t1 GROUP BY t2.useraccessfamily, picturesubuser) y
-WHERE x.useraccessfamily = y.useraccessfamily;
-
-SELECT * FROM t2 x,
-(SELECT t2.useraccessfamily, t2.serialized AS picturesubuser, COUNT(*)
- FROM t2, t1 GROUP BY t2.useraccessfamily, picturesubuser) y
-WHERE x.useraccessfamily = y.useraccessfamily;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug#13261277: Unchecked key length caused missing records.
---echo #
-
-CREATE TABLE t1 (
- col_varchar varchar(1024) CHARACTER SET utf8 DEFAULT NULL,
- stub1 varchar(1024) CHARACTER SET utf8 DEFAULT NULL,
- stub2 varchar(1024) CHARACTER SET utf8 DEFAULT NULL,
- stub3 varchar(1024) CHARACTER SET utf8 DEFAULT NULL
-);
-
-INSERT INTO t1 VALUES
- ('d','d','l','ther'),
- (NULL,'s','NJBIQ','trzetuchv'),
- (-715390976,'coul','MYWFB','cfhtrzetu'),
- (1696792576,'f','i\'s','c'),
- (1,'i','ltpemcfhtr','gsltpemcf'),
- (-663027712,'mgsltpemcf','sa','amgsltpem'),
- (-1686700032,'JPRVK','i','vamgsltpe'),
- (NULL,'STUNB','UNVJV','u'),
- (5,'oka','qyihvamgsl','AXSMD'),
- (NULL,'tqwmqyihva','h','yntqwmqyi'),
- (3,'EGMJN','e','e');
-
-CREATE TABLE t2 (
- col_varchar varchar(10) DEFAULT NULL,
- col_int INT DEFAULT NULL
-);
-
-INSERT INTO t2 VALUES ('d',9);
-
-set optimizer_switch='derived_merge=off,derived_with_keys=on';
-
-SET @save_heap_size= @@max_heap_table_size;
-SET @@max_heap_table_size= 16384;
-
-SELECT t2.col_int
-FROM t2
- RIGHT JOIN ( SELECT * FROM t1 ) AS dt
- ON t2.col_varchar = dt.col_varchar
-WHERE t2.col_int IS NOT NULL ;
-
---echo # Shouldn't use auto_key0 for derived table
-EXPLAIN
-SELECT t2.col_int
-FROM t2
- RIGHT JOIN ( SELECT * FROM t1 ) AS dt
- ON t2.col_varchar = dt.col_varchar
-WHERE t2.col_int IS NOT NULL ;
-
-SET @@max_heap_table_size= @save_heap_size;
-SET optimizer_switch=@save_optimizer_switch;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # end of 5.3 tests
---echo #
-
---echo #
---echo # Bug mdev-11161: The second execution of prepared statement
---echo # does not use generated key for materialized
---echo # derived table / view
---echo # (actually this is a 5.3 bug.)
---echo #
-
-create table t1 (
- mat_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
- matintnum CHAR(6) NOT NULL,
- test MEDIUMINT UNSIGNED NULL
-);
-create table t2 (
- mat_id MEDIUMINT UNSIGNED NOT NULL,
- pla_id MEDIUMINT UNSIGNED NOT NULL
-);
-insert into t1 values
- (NULL, 'a', 1), (NULL, 'b', 2), (NULL, 'c', 3), (NULL, 'd', 4),
- (NULL, 'e', 5), (NULL, 'f', 6), (NULL, 'g', 7), (NULL, 'h', 8),
- (NULL, 'i', 9);
-insert into t2 values
- (1, 100), (1, 101), (1, 102), (2, 100), (2, 103), (2, 104),
- (3, 101), (3, 102), (3, 105);
-
-explain
- SELECT STRAIGHT_JOIN d.pla_id, m2.mat_id
- FROM t1 m2
- INNER JOIN
- (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum
- FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id
- GROUP BY mp.pla_id) d
- ON d.matintnum=m2.matintnum;
-
-prepare stmt1 from
-"SELECT STRAIGHT_JOIN d.pla_id, m2.mat_id
- FROM t1 m2
- INNER JOIN
- (SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum
- FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id
- GROUP BY mp.pla_id) d
- ON d.matintnum=m2.matintnum";
-
-flush status;
-execute stmt1;
-show status like '%Handler_read%';
-
-flush status;
-execute stmt1;
-show status like '%Handler_read%';
-
-deallocate prepare stmt1;
-
-drop table t1,t2;
-
---echo #
---echo # Bug mdev-12670: mergeable derived / view with subqueries
---echo # subject to semi-join optimizations
---echo # (actually this is a 5.3 bug.)
---echo #
-
-create table t1 (a int) engine=myisam;
-insert into t1 values (5),(3),(2),(7),(2),(5),(1);
-create table t2 (b int, index idx(b)) engine=myisam;
-insert into t2 values (2),(3),(2),(1),(3),(4);
-insert into t2 select b+10 from t2;
-insert into t2 select b+10 from t2;
-insert into t2 select b+10 from t2;
-insert into t2 select b+10 from t2;
-insert into t2 select b+10 from t2;
-insert into t2 select b+10 from t2;
-insert into t2 select b+10 from t2;
-insert into t2 select b+10 from t2;
-insert into t2 select b+10 from t2;
-insert into t2 select b+10 from t2;
-analyze table t1,t2;
-
-explain select a from t1 where a in (select b from t2);
-explain select * from (select a from t1 where a in (select b from t2)) t;
-create view v1 as select a from t1 where a in (select b from t2);
-explain select * from v1;
-
-drop view v1;
-drop table t1,t2;
-
---echo #
---echo # Bug mdev-12812: mergeable derived / view with subqueries
---echo # NOT subject to semi-join optimizations
---echo #
-
-CREATE TABLE t1 (c1 varchar(3)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('foo'),('foo');
-
-CREATE TABLE t2 (c2 varchar(3)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES ('bar'),('qux'),('foo');
-
-let $q=
-SELECT STRAIGHT_JOIN *
- FROM ( SELECT * FROM t1 WHERE c1 IN ( SELECT c2 FROM t2 ) ) AS sq;
-
-eval $q;
-eval EXPLAIN EXTENDED $q;
-
-DROP TABLE t1, t2;
-
-# The following command must be the last one the file
-set optimizer_switch=@exit_optimizer_switch;
-set join_cache_level=@exit_join_cache_level;
diff --git a/mysql-test/t/dirty_close.test b/mysql-test/t/dirty_close.test
deleted file mode 100644
index e49618170ab..00000000000
--- a/mysql-test/t/dirty_close.test
+++ /dev/null
@@ -1,60 +0,0 @@
---source include/not_embedded.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-connection con1;
-dirty_close con1;
-connection con2;
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (n INT);
-INSERT INTO t1 VALUES (1),(2),(3);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-connection default;
-disconnect con2;
-
-# End of 4.1 tests
-
-#
-# Bug#10374 GET_LOCK does not let connection to close on the server side if it's aborted
-#
-
-connection default;
-SELECT GET_LOCK("dangling", 0);
-connect(con1, localhost, root,,);
-connection con1;
---send SELECT GET_LOCK('dangling', 3600);
-connection default;
-let $wait_condition=
- SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = "User lock"
- AND INFO = "SELECT GET_LOCK('dangling', 3600)";
---source include/wait_condition.inc
-dirty_close con1;
-let $wait_condition=
- SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = "User lock"
- AND INFO = "SELECT GET_LOCK('dangling', 3600)";
---source include/wait_condition.inc
-connect(con1, localhost, root,,);
---send SELECT GET_LOCK('dangling', 3600);
-connection default;
-let $wait_condition=
- SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = "User lock"
- AND INFO = "SELECT GET_LOCK('dangling', 3600)";
---source include/wait_condition.inc
-SELECT RELEASE_LOCK('dangling');
-connection con1;
---reap
-connection default;
-disconnect con1;
-
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
-
diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test
deleted file mode 100644
index 7cf3d6810bb..00000000000
--- a/mysql-test/t/distinct.test
+++ /dev/null
@@ -1,793 +0,0 @@
-#
-# Bug with distinct and INSERT INTO
-# Bug with group by and not used fields
-#
-
---disable_warnings
-drop table if exists t1,t2,t3;
---enable_warnings
-
-CREATE TABLE t1 (id int,facility char(20));
-CREATE TABLE t2 (facility char(20));
-INSERT INTO t1 VALUES (NULL,NULL);
-INSERT INTO t1 VALUES (-1,'');
-INSERT INTO t1 VALUES (0,'');
-INSERT INTO t1 VALUES (1,'/L');
-INSERT INTO t1 VALUES (2,'A01');
-INSERT INTO t1 VALUES (3,'ANC');
-INSERT INTO t1 VALUES (4,'F01');
-INSERT INTO t1 VALUES (5,'FBX');
-INSERT INTO t1 VALUES (6,'MT');
-INSERT INTO t1 VALUES (7,'P');
-INSERT INTO t1 VALUES (8,'RV');
-INSERT INTO t1 VALUES (9,'SRV');
-INSERT INTO t1 VALUES (10,'VMT');
-INSERT INTO t2 SELECT DISTINCT FACILITY FROM t1;
-
-select id from t1 group by id;
-select * from t1 order by id;
-select id-5,facility from t1 order by "id-5";
-select id,concat(facility) from t1 group by id ;
-select id+0 as a,max(id),concat(facility) as b from t1 group by a order by b desc,a;
-select id >= 0 and id <= 5 as grp,count(*) from t1 group by grp;
-
-SELECT DISTINCT FACILITY FROM t1;
-SELECT FACILITY FROM t2;
-SELECT count(*) from t1,t2 where t1.facility=t2.facility;
-select count(facility) from t1;
-select count(*) from t1;
-select count(*) from t1 where facility IS NULL;
-select count(*) from t1 where facility = NULL;
-select count(*) from t1 where facility IS NOT NULL;
-select count(*) from t1 where id IS NULL;
-select count(*) from t1 where id IS NOT NULL;
-
-drop table t1,t2;
-
-#
-# Problem with distinct without results
-#
-CREATE TABLE t1 (UserId int(11) DEFAULT '0' NOT NULL);
-INSERT INTO t1 VALUES (20);
-INSERT INTO t1 VALUES (27);
-
-SELECT UserId FROM t1 WHERE Userid=22;
-SELECT UserId FROM t1 WHERE UserId=22 group by Userid;
-SELECT DISTINCT UserId FROM t1 WHERE UserId=22 group by Userid;
-SELECT DISTINCT UserId FROM t1 WHERE UserId=22;
-drop table t1;
-
-#
-# Test of distinct
-#
-
-CREATE TABLE t1 (a int(10) unsigned not null primary key,b int(10) unsigned);
-INSERT INTO t1 VALUES (1,1),(2,1),(3,1),(4,1);
-CREATE TABLE t2 (a int(10) unsigned not null, key (A));
-INSERT INTO t2 VALUES (1),(2);
-CREATE TABLE t3 (a int(10) unsigned, key(A), b text);
-INSERT INTO t3 VALUES (1,'1'),(2,'2');
-SELECT DISTINCT t3.b FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
-INSERT INTO t2 values (1),(2),(3);
-INSERT INTO t3 VALUES (1,'1'),(2,'2'),(1,'1'),(2,'2');
-explain SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
-SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
-
-# Create a lot of data into t3;
-create temporary table t4 select * from t3;
-insert into t3 select * from t4;
-insert into t4 select * from t3;
-insert into t3 select * from t4;
-insert into t4 select * from t3;
-insert into t3 select * from t4;
-insert into t4 select * from t3;
-insert into t3 select * from t4;
-
-explain select distinct t1.a from t1,t3 where t1.a=t3.a;
-#flush status;
-select distinct t1.a from t1,t3 where t1.a=t3.a;
-#show status like 'Handler%';
-#flush status;
-select distinct 1 from t1,t3 where t1.a=t3.a;
-#show status like 'Handler%';
-
-explain SELECT distinct t1.a from t1;
-explain SELECT distinct t1.a from t1 order by a desc;
-explain SELECT t1.a from t1 group by a order by a desc;
-explain SELECT distinct t1.a from t1 order by a desc limit 1;
-explain SELECT distinct a from t3 order by a desc limit 2;
-explain SELECT distinct a,b from t3 order by a+1;
-explain SELECT distinct a,b from t3 order by a limit 2;
-explain SELECT a,b from t3 group by a,b order by a+1;
-
-drop table t1,t2,t3,t4;
-
-CREATE TABLE t1 (name varchar(255));
-INSERT INTO t1 VALUES ('aa'),('ab'),('ac'),('ad'),('ae');
-SELECT DISTINCT * FROM t1 LIMIT 2;
-SELECT DISTINCT name FROM t1 LIMIT 2;
-SELECT DISTINCT 1 FROM t1 LIMIT 2;
-drop table t1;
-
-CREATE TABLE t1 (
- ID int(11) NOT NULL auto_increment,
- NAME varchar(75) DEFAULT '' NOT NULL,
- LINK_ID int(11) DEFAULT '0' NOT NULL,
- PRIMARY KEY (ID),
- KEY NAME (NAME),
- KEY LINK_ID (LINK_ID)
-);
-
-INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (1,'Mike',0),(2,'Jack',0),(3,'Bill',0);
-
-CREATE TABLE t2 (
- ID int(11) NOT NULL auto_increment,
- NAME varchar(150) DEFAULT '' NOT NULL,
- PRIMARY KEY (ID),
- KEY NAME (NAME)
-);
-
-SELECT DISTINCT
- t2.id AS key_link_id,
- t2.name AS link
-FROM t1
-LEFT JOIN t2 ON t1.link_id=t2.id
-GROUP BY t1.id
-ORDER BY link;
-drop table t1,t2;
-
-#
-# Problem with table dependencies
-#
-
-create table t1 (
- id int not null,
- name tinytext not null,
- unique (id)
-);
-create table t2 (
- id int not null,
- idx int not null,
- unique (id, idx)
-);
-create table t3 (
- id int not null,
- idx int not null,
- unique (id, idx)
-);
-insert into t1 values (1,'yes'), (2,'no');
-insert into t2 values (1,1);
-insert into t3 values (1,1);
-
-set @save_join_cache_level=@@join_cache_level;
-set join_cache_level=1;
-
-EXPLAIN
-SELECT DISTINCT
- t1.id
-from
- t1
- straight_join
- t2
- straight_join
- t3
- straight_join
- t1 as j_lj_t2 left join t2 as t2_lj
- on j_lj_t2.id=t2_lj.id
- straight_join
- t1 as j_lj_t3 left join t3 as t3_lj
- on j_lj_t3.id=t3_lj.id
-WHERE
- ((t1.id=j_lj_t2.id AND t2_lj.id IS NULL) OR (t1.id=t2.id AND t2.idx=2))
- AND ((t1.id=j_lj_t3.id AND t3_lj.id IS NULL) OR (t1.id=t3.id AND t3.idx=2));
-SELECT DISTINCT
- t1.id
-from
- t1
- straight_join
- t2
- straight_join
- t3
- straight_join
- t1 as j_lj_t2 left join t2 as t2_lj
- on j_lj_t2.id=t2_lj.id
- straight_join
- t1 as j_lj_t3 left join t3 as t3_lj
- on j_lj_t3.id=t3_lj.id
-WHERE
- ((t1.id=j_lj_t2.id AND t2_lj.id IS NULL) OR (t1.id=t2.id AND t2.idx=2))
- AND ((t1.id=j_lj_t3.id AND t3_lj.id IS NULL) OR (t1.id=t3.id AND t3.idx=2));
-drop table t1,t2,t3;
-
-set join_cache_level=@save_join_cache_level;
-
-#
-# Test using DISTINCT on a function that contains a group function
-# This also test the case when one doesn't use all fields in GROUP BY.
-#
-
-create table t1 (a int not null, b int not null, t time);
-insert into t1 values (1,1,"00:06:15"),(1,2,"00:06:15"),(1,2,"00:30:15"),(1,3,"00:06:15"),(1,3,"00:30:15");
-select a,sec_to_time(sum(time_to_sec(t))) from t1 group by a,b;
-select distinct a,sec_to_time(sum(time_to_sec(t))) from t1 group by a,b;
-create table t2 (a int not null primary key, b int);
-insert into t2 values (1,1),(2,2),(3,3);
-select t1.a,sec_to_time(sum(time_to_sec(t))) from t1 left join t2 on (t1.b=t2.a) group by t1.a,t2.b;
-select distinct t1.a,sec_to_time(sum(time_to_sec(t))) from t1 left join t2 on (t1.b=t2.a) group by t1.a,t2.b;
-drop table t1,t2;
-
-#
-# Test problem with DISTINCT and HAVING
-#
-create table t1 (a int not null,b char(5), c text);
-insert into t1 (a) values (1),(2),(3),(4),(1),(2),(3),(4);
-select distinct a from t1 group by b,a having a > 2 order by a desc;
-select distinct a,c from t1 group by b,c,a having a > 2 order by a desc;
-drop table t1;
-
-#
-# Test problem with DISTINCT and ORDER BY DESC
-#
-
-create table t1 (a char(1), key(a)) engine=myisam;
-insert into t1 values('1'),('1');
-select * from t1 where a >= '1';
-select distinct a from t1 order by a desc;
-select distinct a from t1 where a >= '1' order by a desc;
-drop table t1;
-
-#
-# Test when using a not previously used column in ORDER BY
-#
-
-CREATE TABLE t1 (email varchar(50), infoID BIGINT, dateentered DATETIME);
-CREATE TABLE t2 (infoID BIGINT, shipcode varchar(10));
-
-INSERT INTO t1 (email, infoID, dateentered) VALUES
- ('test1@testdomain.com', 1, '2002-07-30 22:56:38'),
- ('test1@testdomain.com', 1, '2002-07-27 22:58:16'),
- ('test2@testdomain.com', 1, '2002-06-19 15:22:19'),
- ('test2@testdomain.com', 2, '2002-06-18 14:23:47'),
- ('test3@testdomain.com', 1, '2002-05-19 22:17:32');
-
-INSERT INTO t2(infoID, shipcode) VALUES
- (1, 'Z001'),
- (2, 'R002');
-
-SELECT DISTINCTROW email, shipcode FROM t1, t2 WHERE t1.infoID=t2.infoID;
-SELECT DISTINCTROW email FROM t1 ORDER BY dateentered DESC;
-SELECT DISTINCTROW email, shipcode FROM t1, t2 WHERE t1.infoID=t2.infoID ORDER BY dateentered DESC;
-drop table t1,t2;
-
-#
-# test with table.* in DISTINCT
-#
-
-CREATE TABLE t1 (privatemessageid int(10) unsigned NOT NULL auto_increment, folderid smallint(6) NOT NULL default '0', userid int(10) unsigned NOT NULL default '0', touserid int(10) unsigned NOT NULL default '0', fromuserid int(10) unsigned NOT NULL default '0', title varchar(250) NOT NULL default '', message mediumtext NOT NULL, dateline int(10) unsigned NOT NULL default '0', showsignature smallint(6) NOT NULL default '0', iconid smallint(5) unsigned NOT NULL default '0', messageread smallint(6) NOT NULL default '0', readtime int(10) unsigned NOT NULL default '0', receipt smallint(6) unsigned NOT NULL default '0', deleteprompt smallint(6) unsigned NOT NULL default '0', multiplerecipients smallint(6) unsigned NOT NULL default '0', PRIMARY KEY (privatemessageid), KEY userid (userid)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (128,0,33,33,8,':D','',996121863,1,0,2,996122850,2,0,0);
-CREATE TABLE t2 (userid int(10) unsigned NOT NULL auto_increment, usergroupid smallint(5) unsigned NOT NULL default '0', username varchar(50) NOT NULL default '', password varchar(50) NOT NULL default '', email varchar(50) NOT NULL default '', styleid smallint(5) unsigned NOT NULL default '0', parentemail varchar(50) NOT NULL default '', coppauser smallint(6) NOT NULL default '0', homepage varchar(100) NOT NULL default '', icq varchar(20) NOT NULL default '', aim varchar(20) NOT NULL default '', yahoo varchar(20) NOT NULL default '', signature mediumtext NOT NULL, adminemail smallint(6) NOT NULL default '0', showemail smallint(6) NOT NULL default '0', invisible smallint(6) NOT NULL default '0', usertitle varchar(250) NOT NULL default '', customtitle smallint(6) NOT NULL default '0', joindate int(10) unsigned NOT NULL default '0', cookieuser smallint(6) NOT NULL default '0', daysprune smallint(6) NOT NULL default '0', lastvisit int(10) unsigned NOT NULL default '0', lastactivity int(10) unsigned NOT NULL default '0', lastpost int(10) unsigned NOT NULL default '0', posts smallint(5) unsigned NOT NULL default '0', timezoneoffset varchar(4) NOT NULL default '', emailnotification smallint(6) NOT NULL default '0', buddylist mediumtext NOT NULL, ignorelist mediumtext NOT NULL, pmfolders mediumtext NOT NULL, receivepm smallint(6) NOT NULL default '0', emailonpm smallint(6) NOT NULL default '0', pmpopup smallint(6) NOT NULL default '0', avatarid smallint(6) NOT NULL default '0', avatarrevision int(6) unsigned NOT NULL default '0', options smallint(6) NOT NULL default '15', birthday date NOT NULL default '0000-00-00', maxposts smallint(6) NOT NULL default '-1', startofweek smallint(6) NOT NULL default '1', ipaddress varchar(20) NOT NULL default '', referrerid int(10) unsigned NOT NULL default '0', nosessionhash smallint(6) NOT NULL default '0', autorefresh smallint(6) NOT NULL default '-1', messagepopup tinyint(2) NOT NULL default '0', inforum smallint(5) unsigned NOT NULL default '0', ratenum smallint(5) unsigned NOT NULL default '0', ratetotal smallint(5) unsigned NOT NULL default '0', allowrate smallint(5) unsigned NOT NULL default '1', PRIMARY KEY (userid), KEY usergroupid (usergroupid), KEY username (username), KEY inforum (inforum)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (33,6,'Kevin','0','kevin@stileproject.com',1,'',0,'http://www.stileproject.com','','','','',1,1,0,'Administrator',0,996120694,1,-1,1030996168,1031027028,1030599436,36,'-6',0,'','','',1,0,1,0,0,15,'0000-00-00',-1,1,'64.0.0.0',0,1,-1,0,0,4,19,1);
-SELECT DISTINCT t1.*, t2.* FROM t1 LEFT JOIN t2 ON (t2.userid = t1.touserid);
-DROP TABLE t1,t2;
-
-#
-# test with const_item in ORDER BY
-#
-
-CREATE TABLE t1 (a int primary key, b int, c int);
-INSERT t1 VALUES (1,2,3);
-CREATE TABLE t2 (a int primary key, b int, c int);
-INSERT t2 VALUES (3,4,5);
-SELECT DISTINCT t1.a, t2.b FROM t1, t2 WHERE t1.a=1 ORDER BY t2.c;
-DROP TABLE t1,t2;
-
-#
-# Test of LEFT() with distinct
-#
-
-CREATE table t1 ( `id` int(11) NOT NULL auto_increment, `name` varchar(50) NOT NULL default '', PRIMARY KEY (`id`)) ENGINE=MyISAM AUTO_INCREMENT=3 ;
-INSERT INTO t1 VALUES (1, 'aaaaa');
-INSERT INTO t1 VALUES (3, 'aaaaa');
-INSERT INTO t1 VALUES (2, 'eeeeeee');
-select distinct left(name,1) as name from t1;
-drop table t1;
-
-#
-# Test case from sel000100
-#
-
-CREATE TABLE t1 (
- ID int(11) NOT NULL auto_increment,
- NAME varchar(75) DEFAULT '' NOT NULL,
- LINK_ID int(11) DEFAULT '0' NOT NULL,
- PRIMARY KEY (ID),
- KEY NAME (NAME),
- KEY LINK_ID (LINK_ID)
-);
-
-INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (1,'Mike',0);
-INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (2,'Jack',0);
-INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (3,'Bill',0);
-
-CREATE TABLE t2 (
- ID int(11) NOT NULL auto_increment,
- NAME varchar(150) DEFAULT '' NOT NULL,
- PRIMARY KEY (ID),
- KEY NAME (NAME)
-);
-
-SELECT DISTINCT
- t2.id AS key_link_id,
- t2.name AS link
-FROM t1
-LEFT JOIN t2 ON t1.link_id=t2.id
-GROUP BY t1.id
-ORDER BY link;
-drop table t1,t2;
-
-#
-# test case for #674
-#
-
-CREATE TABLE t1 (
- html varchar(5) default NULL,
- rin int(11) default '0',
- rout int(11) default '0'
-) ENGINE=MyISAM;
-
-INSERT INTO t1 VALUES ('1',1,0);
-SELECT DISTINCT html,SUM(rout)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin;
-drop table t1;
-
-#
-# Test cases for #12625: DISTINCT for a list with constants
-#
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
-SELECT DISTINCT a, 1 FROM t1;
-SELECT DISTINCT 1, a FROM t1;
-
-CREATE TABLE t2 (a int, b int);
-INSERT INTO t2 VALUES (1,1),(2,2),(2,3),(2,4),(3,5);
-SELECT DISTINCT a, b, 2 FROM t2;
-SELECT DISTINCT 2, a, b FROM t2;
-SELECT DISTINCT a, 2, b FROM t2;
-
-DROP TABLE t1,t2;
-#
-# Bug#16458: Simple SELECT FOR UPDATE causes "Result Set not updatable"
-# error.
-#
-CREATE TABLE t1(a INT PRIMARY KEY, b INT);
-INSERT INTO t1 VALUES (1,1), (2,1), (3,1);
-EXPLAIN SELECT DISTINCT a FROM t1;
-EXPLAIN SELECT DISTINCT a,b FROM t1;
-EXPLAIN SELECT DISTINCT t1_1.a, t1_1.b FROM t1 t1_1, t1 t1_2;
-EXPLAIN SELECT DISTINCT t1_1.a, t1_1.b FROM t1 t1_1, t1 t1_2
- WHERE t1_1.a = t1_2.a;
-EXPLAIN SELECT a FROM t1 GROUP BY a;
-EXPLAIN SELECT a,b FROM t1 GROUP BY a,b;
-EXPLAIN SELECT DISTINCT a,b FROM t1 GROUP BY a,b;
-
-CREATE TABLE t2(a INT, b INT NOT NULL, c INT NOT NULL, d INT,
- PRIMARY KEY (a,b));
-INSERT INTO t2 VALUES (1,1,1,50), (1,2,3,40), (2,1,3,4);
-EXPLAIN SELECT DISTINCT a FROM t2;
-EXPLAIN SELECT DISTINCT a,a FROM t2;
-EXPLAIN SELECT DISTINCT b,a FROM t2;
-EXPLAIN SELECT DISTINCT a,c FROM t2;
-EXPLAIN SELECT DISTINCT c,a,b FROM t2;
-
-EXPLAIN SELECT DISTINCT a,b,d FROM t2 GROUP BY c,b,d;
-CREATE UNIQUE INDEX c_b_unq ON t2 (c,b);
-EXPLAIN SELECT DISTINCT a,b,d FROM t2 GROUP BY c,b,d;
-
-DROP TABLE t1,t2;
-
-# Bug 9784 DISTINCT IFNULL truncates data
-#
-create table t1 (id int, dsc varchar(50));
-insert into t1 values (1, "line number one"), (2, "line number two"), (3, "line number three");
-select distinct id, IFNULL(dsc, '-') from t1;
-drop table t1;
-
-#
-# Bug 21456: SELECT DISTINCT(x) produces incorrect results when using order by
-#
-CREATE TABLE t1 (a int primary key, b int);
-
-INSERT INTO t1 (a,b) values (1,1), (2,3), (3,2);
-
-explain SELECT DISTINCT a, b FROM t1 ORDER BY b;
-SELECT DISTINCT a, b FROM t1 ORDER BY b;
-DROP TABLE t1;
-
-# End of 4.1 tests
-
-
-#
-# Bug #15745 ( COUNT(DISTINCT CONCAT(x,y)) returns wrong result)
-#
-CREATE TABLE t1 (
- ID int(11) NOT NULL auto_increment,
- x varchar(20) default NULL,
- y decimal(10,0) default NULL,
- PRIMARY KEY (ID),
- KEY (y)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-
-INSERT INTO t1 VALUES
-(1,'ba','-1'),
-(2,'ba','1150'),
-(306,'ba','-1'),
-(307,'ba','1150'),
-(611,'ba','-1'),
-(612,'ba','1150');
-
-select count(distinct x,y) from t1;
-select count(distinct concat(x,y)) from t1;
-drop table t1;
-
-#
-# Bug #18068: SELECT DISTINCT
-#
-CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b));
-
-INSERT INTO t1 VALUES (1, 101);
-INSERT INTO t1 SELECT a + 1, a + 101 FROM t1;
-INSERT INTO t1 SELECT a + 2, a + 102 FROM t1;
-INSERT INTO t1 SELECT a + 4, a + 104 FROM t1;
-INSERT INTO t1 SELECT a + 8, a + 108 FROM t1;
-
-EXPLAIN SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a;
-SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a;
-
-DROP TABLE t1;
-
-#Bug #20836: Selecting into variables results in wrong results being returned
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (id INT NOT NULL, fruit_id INT NOT NULL, fruit_name varchar(20)
-default NULL);
-
-INSERT INTO t1 VALUES (1,1,'ORANGE');
-INSERT INTO t1 VALUES (2,2,'APPLE');
-INSERT INTO t1 VALUES (3,2,'APPLE');
-INSERT INTO t1 VALUES (4,3,'PEAR');
-
-SELECT DISTINCT fruit_id, fruit_name INTO @v1, @v2 FROM t1 WHERE fruit_name =
-'APPLE';
-SELECT @v1, @v2;
-
-SELECT DISTINCT fruit_id, fruit_name INTO @v3, @v4 FROM t1 GROUP BY fruit_id,
-fruit_name HAVING fruit_name = 'APPLE';
-SELECT @v3, @v4;
-
-SELECT DISTINCT @v5:= fruit_id, @v6:= fruit_name INTO @v7, @v8 FROM t1 WHERE
-fruit_name = 'APPLE';
-SELECT @v5, @v6, @v7, @v8;
-
-SELECT DISTINCT @v5 + fruit_id, CONCAT(@v6, fruit_name) INTO @v9, @v10 FROM t1
-WHERE fruit_name = 'APPLE';
-SELECT @v5, @v6, @v7, @v8, @v9, @v10;
-
-SELECT DISTINCT @v11:= @v5 + fruit_id, @v12:= CONCAT(@v6, fruit_name) INTO
-@v13, @v14 FROM t1 WHERE fruit_name = 'APPLE';
-SELECT @v11, @v12, @v13, @v14;
-
-SELECT DISTINCT @v13, @v14 INTO @v15, @v16 FROM t1 WHERE fruit_name = 'APPLE';
-SELECT @v15, @v16;
-
-SELECT DISTINCT 2 + 2, 'Bob' INTO @v17, @v18 FROM t1 WHERE fruit_name =
-'APPLE';
-SELECT @v17, @v18;
-
---disable_warnings
-DROP TABLE IF EXISTS t2;
---enable_warnings
-
-CREATE TABLE t2 (fruit_id INT NOT NULL, fruit_name varchar(20)
-default NULL);
-
-SELECT DISTINCT fruit_id, fruit_name INTO OUTFILE
-'../../tmp/data1.tmp' FROM t1 WHERE fruit_name = 'APPLE';
-LOAD DATA INFILE '../../tmp/data1.tmp' INTO TABLE t2;
---error 0,1
---remove_file $MYSQLTEST_VARDIR/tmp/data1.tmp
-
-SELECT DISTINCT @v19:= fruit_id, @v20:= fruit_name INTO OUTFILE
-'../../tmp/data2.tmp' FROM t1 WHERE fruit_name = 'APPLE';
-LOAD DATA INFILE '../../tmp/data2.tmp' INTO TABLE t2;
---remove_file $MYSQLTEST_VARDIR/tmp/data2.tmp
-
-SELECT @v19, @v20;
-SELECT * FROM t2;
-
-DROP TABLE t1;
-DROP TABLE t2;
-
-#
-# Bug #15881: cast problems
-#
-CREATE TABLE t1 (a CHAR(1)); INSERT INTO t1 VALUES('A'), (0);
-SELECT a FROM t1 WHERE a=0;
-SELECT DISTINCT a FROM t1 WHERE a=0;
-DROP TABLE t1;
-CREATE TABLE t1 (a DATE);
-INSERT INTO t1 VALUES ('1972-07-29'), ('1972-02-06');
-EXPLAIN SELECT (SELECT DISTINCT a FROM t1 WHERE a = '2002-08-03');
-EXPLAIN SELECT (SELECT DISTINCT ADDDATE(a,1) FROM t1
- WHERE ADDDATE(a,1) = '2002-08-03');
-CREATE TABLE t2 (a CHAR(5) CHARACTER SET latin1 COLLATE latin1_general_ci);
-INSERT INTO t2 VALUES (0xf6);
-INSERT INTO t2 VALUES ('oe');
-
-SELECT COUNT(*) FROM (SELECT DISTINCT a FROM t2) dt;
-SELECT COUNT(*) FROM
- (SELECT DISTINCT a FROM t2 WHERE a='oe' COLLATE latin1_german2_ci) dt;
-
-DROP TABLE t1, t2;
-
-#
-# Bug #25551: inconsistent behaviour in grouping NULL, depending on index type
-#
-CREATE TABLE t1 (a INT, UNIQUE (a));
-INSERT INTO t1 VALUES (4),(null),(2),(1),(null),(3);
-EXPLAIN SELECT DISTINCT a FROM t1;
-#result must have one row with NULL
-SELECT DISTINCT a FROM t1;
-EXPLAIN SELECT a FROM t1 GROUP BY a;
-#result must have one row with NULL
-SELECT a FROM t1 GROUP BY a;
-
-DROP TABLE t1;
-
-#
-#Bug #27659: SELECT DISTINCT returns incorrect result set when field is
-#repeated
-#
-#
-CREATE TABLE t1 (a INT, b INT);
-INSERT INTO t1 VALUES(1,1),(1,2),(1,3);
-SELECT DISTINCT a, b FROM t1;
-SELECT DISTINCT a, a, b FROM t1;
-DROP TABLE t1;
-
---echo End of 5.0 tests
-
-#
-# Bug #34928: Confusion by having Primary Key and Index
-#
-CREATE TABLE t1(a INT, b INT, c INT, d INT default 0, e INT default 0,
- PRIMARY KEY(a,b,c,d,e),
- KEY(a,b,d,c)
-);
-
-INSERT INTO t1(a, b, c) VALUES (1, 1, 1),
- (1, 1, 2),
- (1, 1, 3),
- (1, 2, 1),
- (1, 2, 2),
- (1, 2, 3);
-
-EXPLAIN SELECT DISTINCT a, b, d, c FROM t1;
-
-SELECT DISTINCT a, b, d, c FROM t1;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug #46159: simple query that never returns
---echo #
-
-# Set max_heap_table_size to the minimum value so that GROUP BY table in the
-# SELECT query below gets converted to MyISAM
-SET @old_max_heap_table_size = @@max_heap_table_size;
-SET @@max_heap_table_size = 16384;
-
-# Set sort_buffer_size to the mininum value so that remove_duplicates() calls
-# remove_dup_with_compare()
-SET @old_sort_buffer_size = @@sort_buffer_size;
-SET @@sort_buffer_size = 32804;
-
-CREATE TABLE t1(c1 int, c2 VARCHAR(20));
-INSERT INTO t1 VALUES (1, '1'), (1, '1'), (2, '2'), (3, '1'), (3, '1'), (4, '4');
-# Now we just need to pad the table with random data so we have enough unique
-# values to force conversion of the GROUP BY table to MyISAM
-INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
-INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
-INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
-INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
-INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
-INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
-INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
-INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
-
-# First rows of the GROUP BY table that will be processed by
-# remove_dup_with_compare()
-SELECT c1, c2, COUNT(*) FROM t1 GROUP BY c1 LIMIT 4;
-
-# The actual test case
-SELECT DISTINCT c2 FROM t1 GROUP BY c1 HAVING COUNT(*) > 1;
-
-# Cleanup
-
-DROP TABLE t1;
-SET @@sort_buffer_size = @old_sort_buffer_size;
-SET @@max_heap_table_size = @old_max_heap_table_size;
-
---echo End of 5.1 tests
-
-#
-# test_if_equality_guarantees_uniqueness() and dates
-#
-create table t1 (a varchar(100));
-insert t1 values ('2010-10-10'), ('20101010');
-select * from t1 where a = DATE('2010-10-10');
-select distinct a from t1 where a = DATE('2010-10-10');
-explain select distinct a from t1 where a = DATE('2010-10-10');
-drop table t1;
-#
-# test_if_equality_guarantees_uniqueness() and different type combinations
-#
---echo # date = string
-create table t1 (a date);
-insert t1 values ('2010-10-10'), ('20101010');
-explain select distinct a from t1 where a = '2010-10-10';
-drop table t1;
---echo # double = string
-create table t1 (a double);
-insert t1 values (2), (2);
-explain select distinct a from t1 where a = '2';
---echo # double = int
-explain select distinct a from t1 where a = 2;
---echo # string = double
-alter table t1 modify a varchar(100);
-explain select distinct a from t1 where a = 2e0;
-drop table t1;
-
-#
-# lp:731124 Loss of precision on DISTINCT
-#
-create table t1 (f1 varchar(40));
-insert into t1 values ('2010-10-10 00:00:00.0001'),('2010-10-10 00:00:00.0002'),('2010-10-10 00:00:00.0003');
-select time(f1) from t1 ;
-select distinct time(f1) from t1 ;
-drop table t1;
-
-#
-# MDEV-3875 Wrong result (missing row) on a DISTINCT query with the same subquery in the SELECT list and GROUP BY
-# MySQL Bug#66896 Distinct not distinguishing 0 from NULL when GROUP BY is used
-#
-create table t1(i int, g int); # remove_dup_with_hash_index
-insert into t1 values (null, 1), (0, 2);
-select distinct i from t1 group by g;
-drop table t1;
-
-create table t1(i int, g blob); # remove_dup_with_compare
-insert into t1 values (null, 1), (0, 2);
-select distinct i from t1 group by g;
-drop table t1;
-
-create table t1 (a int) engine=myisam;
-insert into t1 values (0),(7);
-create table t2 (b int) engine=myisam;
-insert into t2 values (7),(0),(3);
-create algorithm=temptable view v as
-select distinct (select max(a) from t1 where alias.b = a) as field1 from t2 as alias group by field1;
-select * from v;
-select distinct (select max(a) from t1 where alias.b = a) as field1 from t2 as alias group by field1;
-drop view v;
-drop table t1, t2;
-
-#
-# Bug mdev-5028: invalid distinct optimization when join buffer is used
-#
-
-CREATE TABLE t1 (
- id int, i1 int, i2 int DEFAULT 0,
- d1 date DEFAULT '2000-01-01', d2 date DEFAULT '2000-01-01',
- t1 time DEFAULT '00:00:00', t2 time DEFAULT '00:00:00',
- dt1 datetime NOT NULL DEFAULT '2000-01-01 00:00:00',
- dt2 datetime NOT NULL DEFAULT '2000-01-01 00:00:00',
- c1 varchar(1) NOT NULL, c2 varchar(1) NOT NULL
-) ENGINE=MyISAM;
-
-CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
-
-INSERT INTO t1 (id,i1,c1,c2) VALUES
-(1,7,'t','t'),(2,4,'k','k'),(3,2,'e','e'),(4,0,'i','i'),(5,1,'t','t'),(6,91,'m','m'),
-(7,6,'z','z'),(8,3,'c','c'),(9,6,'i','i'),(10,8,'v','v'), (11,1,'l','l'),(12,4,'j','j'),
-(13,5,'w','w'),(14,0,'r','r'),(15,7,'o','o'),(16,9,'o','o'),(17,7,'u','u'),(18,6,'f','f'),
-(19,0,'l','l'),(20,6,'g','g'),(21,1,'e','e'),(22,7,'y','y'),(23,0,'p','p'),(24,6,'v','v'),
-(25,5,'d','d'),(26,9,'i','i'),(27,5,'z','z'),(28,2,'q','q'),(29,4,'j','j'),(30,9,'m','m'),
-(31,8,'d','d'),(32,5,'r','r'),(33,1,'r','r'),(34,1,'k','k'),(35,4,'p','p'),(36,2,'x','x'),
-(37,5,'w','w'),(38,0,'k','k'),(39,7,'y','y'),(40,4,'p','p'),(41,9,'l','l'),(42,2,'u','u'),
-(43,3,'r','r'),(44,5,'y','y'),(45,3,'u','u'),(46,9,'t','t'),(47,8,'f','f'),(48,2,'f','f'),
-(49,2,'q','q'),(50,6,'v','v'),(51,6,'u','u'),(52,0,'b','b'),(53,1,'n','n'),(54,2,'p','p'),
-(55,0,'y','y'),(56,1,'l','l'),(57,1,'c','c'),(58,0,'d','d'),(59,2,'y','y'),(60,7,'l','l'),
-(61,6,'m','m'),(62,9,'q','q'),(63,0,'j','j'),(64,3,'u','u'),(65,4,'w','w'),(66,5,'p','p'),
-(67,8,'z','z'),(68,5,'u','u'),(69,7,'b','b'),(70,0,'f','f'),(71,6,'u','u'),(72,1,'i','i'),
-(73,9,'s','s'),(74,3,'y','y'),(75,5,'s','s'),(76,8,'x','x'),(77,3,'s','s'),(78,3,'l','l'),
-(79,8,'b','b'),(80,0,'p','p'),(81,9,'m','m'),(82,5,'k','k'),(83,7,'u','u'),(84,0,'y','y'),
-(85,2,'x','x'),(86,5,'h','h'),(87,5,'j','j'),(88,5,'o','o'),(89,9,'o','o'),(90,1,'c','c'),
-(91,7,'k','k'),(92,9,'t','t'),(93,3,'h','h'),(94,6,'g','g'),(95,9,'r','r'),(96,2,'i','i');
-
-CREATE TABLE t2 (i INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (7),(8);
-
-SELECT STRAIGHT_JOIN COUNT(DISTINCT t1.id) FROM
- t1, v1, t2 WHERE v1.id = t2.i AND t1.i1 = v1.i1 AND t2.i != 3;
-
-EXPLAIN EXTENDED
-SELECT STRAIGHT_JOIN DISTINCT t1.id FROM
- t1, v1, t2 WHERE v1.id = t2.i AND t1.i1 = v1.i1 AND t2.i != 3;
-
-set join_buffer_size=1024;
---sorted_result
-SELECT STRAIGHT_JOIN DISTINCT t1.id FROM
- t1, v1, t2 WHERE v1.id = t2.i AND t1.i1 = v1.i1 AND t2.i != 3;
-
-set join_buffer_size=1024*16;
---sorted_result
-SELECT STRAIGHT_JOIN DISTINCT t1.id FROM
- t1, v1, t2 WHERE v1.id = t2.i AND t1.i1 = v1.i1 AND t2.i != 3;
-
-set join_buffer_size=default;
-SELECT STRAIGHT_JOIN DISTINCT t1.id FROM
- t1, v1, t2 WHERE v1.id = t2.i AND t1.i1 = v1.i1 AND t2.i != 3;
-
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug #11744875: 4082: integer lengths cause truncation with distinct concat and innodb
---echo #
-
-CREATE TABLE t1 (a INT(1), b INT(1));
-INSERT INTO t1 VALUES (1111, 2222), (3333, 4444);
-SELECT DISTINCT CONCAT(a,b) AS c FROM t1 ORDER BY 1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#16539979 BASIC SELECT COUNT(DISTINCT ID) IS BROKEN.
---echo # Bug#17867117 ERROR RESULT WHEN "COUNT + DISTINCT + CASE WHEN" NEED MERGE_WALK
---echo #
-
-SET @tmp_table_size_save= @@tmp_table_size;
-SET @@tmp_table_size= 1024;
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
-INSERT INTO t1 SELECT a+8 FROM t1;
-INSERT INTO t1 SELECT a+16 FROM t1;
-INSERT INTO t1 SELECT a+32 FROM t1;
-INSERT INTO t1 SELECT a+64 FROM t1;
-INSERT INTO t1 VALUE(NULL);
-SELECT COUNT(DISTINCT a) FROM t1;
-SELECT COUNT(DISTINCT (a+0)) FROM t1;
-DROP TABLE t1;
-
-create table tb(
-id int auto_increment primary key,
-v varchar(32))
-engine=myisam charset=gbk;
-insert into tb(v) values("aaa");
-insert into tb(v) (select v from tb);
-insert into tb(v) (select v from tb);
-insert into tb(v) (select v from tb);
-insert into tb(v) (select v from tb);
-insert into tb(v) (select v from tb);
-insert into tb(v) (select v from tb);
-
-update tb set v=concat(v, id);
-select count(distinct case when id<=64 then id end) from tb;
-select count(distinct case when id<=63 then id end) from tb;
-drop table tb;
-
-SET @@tmp_table_size= @tmp_table_size_save;
-
---echo End of 5.5 tests
diff --git a/mysql-test/t/drop-no_root.test b/mysql-test/t/drop-no_root.test
deleted file mode 100644
index 8fb5b3f74a8..00000000000
--- a/mysql-test/t/drop-no_root.test
+++ /dev/null
@@ -1,85 +0,0 @@
-# This test uses chmod, can't be run with root permissions
---source include/not_as_root.inc
-
-###########################################################################
-
---echo
---echo # --
---echo # -- Bug#26704: Failing DROP DATABASE brings mysql-client out of sync.
---echo # --
-
---echo
---disable_warnings
-DROP DATABASE IF EXISTS mysql_test;
---enable_warnings
-
---echo
-CREATE DATABASE mysql_test;
-CREATE TABLE mysql_test.t1(c INT);
-
-use mysql_test;
-
-let $MYSQLD_DATADIR= `select @@datadir`;
-
---echo
---echo chmod 000 mysql_test/t1.frm
---chmod 0000 $MYSQLD_DATADIR/mysql_test/t1.frm
-
-# NOTE: For the DROP DATABASE below we need:
-# - disable result log because ER_DB_DROP_RMDIR contains errno, which can be
-# different on different platforms.
-# - expect different error codes, because Windows and UNIX behaves
-# differently (see below).
-#
-# NOTE: Windows and UNIX behaves differently in this test case:
-#
-# - on UNIX when t1.frm is chmoded to 000, it is perfectly deleted
-# by the first DROP DATABASE, but some other files (t1.MYI and t1.MYD) left
-# in the directory. So, we have to explicitly removes them before the
-# second DROP DATABASE.
-#
-# - on Windows when t1.frm is chmoded to 000, it is not deleted by the first
-# DROP DATABASE, but all other files in the database directory are deleted.
-# Thus, we have to change the t1.frm permissions again and delete it
-# explicitly before the second DROP DATABASE.
-#
-# All those differences do not really matter for the idea of this test case:
-# checking that if DROP DATABASE failed, the client is Ok.
-
---echo
---disable_result_log
---error ER_DB_DROP_RMDIR,6
-DROP DATABASE mysql_test;
---enable_result_log
-
---echo
-SELECT DATABASE();
-
-# Remove t1.MYI and t1.MYD. On UNIX it should succeed. On Windows, it fails.
---echo
---echo rm -f mysql_test/t1.MYD mysql_test/t1.MYI
---error 0, 1
---remove_file $MYSQLD_DATADIR/mysql_test/t1.MYD
---error 0, 1
---remove_file $MYSQLD_DATADIR/mysql_test/t1.MYI
-
-# Make t1.frm removable: fail on UNIX, succeed on Windows.
---echo chmod 666 mysql_test/t1.frm
---error 0, 1
---chmod 0666 $MYSQLD_DATADIR/mysql_test/t1.frm
-
-# Remove t1.frm: fail on UNIX, succeed on Windows.
---echo rm -f mysql_test/t1.frm
---error 0, 1
---remove_file $MYSQLD_DATADIR/mysql_test/t1.frm
-
---echo
-DROP DATABASE mysql_test;
-
---echo
-use test;
-
---echo
---echo # -- End of Bug#26704.
-
-###########################################################################
diff --git a/mysql-test/t/drop.test b/mysql-test/t/drop.test
deleted file mode 100644
index 6f506dd7215..00000000000
--- a/mysql-test/t/drop.test
+++ /dev/null
@@ -1,324 +0,0 @@
-call mtr.add_suppression("table or database name 'abc`def'");
-
-# Initialise
---disable_warnings
-drop table if exists t1;
-drop database if exists mysqltest;
-# If earlier test failed
-drop database if exists client_test_db;
---enable_warnings
-
---error 1051
-drop table t1;
-create table t1(n int);
-insert into t1 values(1);
-create temporary table t1( n int);
-insert into t1 values(2);
---error 1050
-create table t1(n int);
-drop table t1;
-select * from t1;
-
-# now test for a bug in drop database - it is important that the name
-# of the table is the same as the name of the database - in the original
-# code this triggered a bug
-create database mysqltest;
-drop database if exists mysqltest;
-create database mysqltest;
-create table mysqltest.mysqltest (n int);
-insert into mysqltest.mysqltest values (4);
-select * from mysqltest.mysqltest;
---enable_info
-drop database if exists mysqltest;
---disable_info
-create database mysqltest;
-
-#
-# drop many tables - bug#3891
-# we'll do it in mysqltest db, to be able to use longer table names
-# (tableN instead on tN)
-#
-use mysqltest;
---error 1051
-drop table table1, table2, table3, table4, table5, table6,
-table7, table8, table9, table10, table11, table12, table13,
-table14, table15, table16, table17, table18, table19, table20,
-table21, table22, table23, table24, table25, table26, table27,
-table28;
-
---error 1051
-drop table table1, table2, table3, table4, table5, table6,
-table7, table8, table9, table10, table11, table12, table13,
-table14, table15, table16, table17, table18, table19, table20,
-table21, table22, table23, table24, table25, table26, table27,
-table28, table29, table30;
-
-use test;
-drop database mysqltest;
-
-# test drop/create database and FLUSH TABLES WITH READ LOCK
-flush tables with read lock;
---error 1209,1223
-create database mysqltest;
-unlock tables;
-create database mysqltest;
-show databases;
-flush tables with read lock;
---error 1208,1223
-drop database mysqltest;
-unlock tables;
-drop database mysqltest;
-show databases;
---error 1008
-drop database mysqltest;
-
-# test create table and FLUSH TABLES WITH READ LOCK
-drop table t1;
-flush tables with read lock;
---error 1223
-create table t1(n int);
-unlock tables;
-create table t1(n int);
-show tables;
-drop table t1;
-
-# End of 4.1 tests
-
-
-#
-# Test for bug#21216 "Simultaneous DROP TABLE and SHOW OPEN TABLES causes
-# server to crash". Crash (caused by failed assertion in 5.0 or by null
-# pointer dereference in 5.1) happened when one ran SHOW OPEN TABLES
-# while concurrently doing DROP TABLE (or RENAME TABLE, CREATE TABLE LIKE
-# or any other command that takes name-lock) in other connection.
-#
-# Also includes test for similar bug#12212 "Crash that happens during
-# removing of database name from cache" reappeared in 5.1 as bug#19403
-# In its case crash happened when one concurrently executed DROP DATABASE
-# and one of name-locking command.
-#
---disable_warnings
-drop database if exists mysqltest;
-drop table if exists t1;
---enable_warnings
-create table t1 (i int);
-create database mysqltest;
-lock tables t1 read;
-connect (addconroot1, localhost, root,,);
---send drop table t1
-connect (addconroot2, localhost, root,,);
-# Server should not crash in any of the following statements
---disable_result_log
-show open tables;
---enable_result_log
---send drop database mysqltest
-connection default;
-select 1;
-unlock tables;
-connection addconroot1;
---reap
-connection addconroot2;
---reap
-disconnect addconroot2;
---source include/wait_until_disconnected.inc
-connection addconroot1;
-disconnect addconroot1;
---source include/wait_until_disconnected.inc
-connection default;
-
-#
-# Bug#25858 Some DROP TABLE under LOCK TABLES can cause deadlocks
-#
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-create table t1 (a int);
-create table t2 (a int);
-lock table t1 read;
---error ER_TABLE_NOT_LOCKED
-drop table t2;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-drop table t1;
-unlock tables;
-drop table t1,t2;
-connect (addconroot, localhost, root,,);
-connection default;
-create table t1 (i int);
-create table t2 (i int);
-lock tables t1 read;
-connection addconroot;
-lock tables t2 read;
---error ER_TABLE_NOT_LOCKED
-drop table t1;
-connection default;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-drop table t1,t2;
-disconnect addconroot;
-connection default;
-unlock tables;
-drop table t1,t2;
-
---echo End of 5.0 tests
-
-#
-# Bug#30152 MySQLD crash duing alter table causes DROP DATABASE to FAIL due to temp file
-#
-create database mysql_test;
-create table mysql_test.t1(f1 int);
-create table mysql_test.`#sql-347f_7` (f1 int);
-create table mysql_test.`#sql-347f_8` (f1 int);
-drop table mysql_test.`#sql-347f_8`;
-let $MYSQLD_DATADIR= `select @@datadir`;
-copy_file $MYSQLD_DATADIR/mysql_test/t1.frm $MYSQLD_DATADIR/mysql_test/#sql-347f_6.frm;
-drop database mysql_test;
-
-###########################################################################
-
---echo
---echo # --
---echo # -- Bug#29958: Weird message on DROP DATABASE if mysql.proc does not
---echo # -- exist.
---echo # --
-
---disable_warnings
-DROP DATABASE IF EXISTS mysql_test;
---enable_warnings
-
-CREATE DATABASE mysql_test;
-
-let $MYSQLD_DATADIR= `select @@datadir`;
-
---let $proc_frm = $MYSQLD_DATADIR/mysql/proc.frm
---let $proc_MYD = $MYSQLD_DATADIR/mysql/proc.MYD
---let $proc_MYI = $MYSQLD_DATADIR/mysql/proc.MYI
-
---let $copy_of_proc_frm = $MYSQLTEST_VARDIR/tmp/bug29958.copy.frm
---let $copy_of_proc_MYD = $MYSQLTEST_VARDIR/tmp/bug29958.copy.MYD
---let $copy_of_proc_MYI = $MYSQLTEST_VARDIR/tmp/bug29958.copy.MYI
-
---copy_file $proc_frm $copy_of_proc_frm
---copy_file $proc_MYD $copy_of_proc_MYD
---copy_file $proc_MYI $copy_of_proc_MYI
-
-DROP TABLE mysql.proc;
-
-DROP DATABASE mysql_test;
-
---copy_file $copy_of_proc_frm $proc_frm
---copy_file $copy_of_proc_MYD $proc_MYD
---copy_file $copy_of_proc_MYI $proc_MYI
-
---remove_file $copy_of_proc_frm
---remove_file $copy_of_proc_MYD
---remove_file $copy_of_proc_MYI
-
---echo
---echo # --
---echo # -- End of Bug#29958.
---echo # --
-
-###########################################################################
-
---echo
-#
-# Bug#26703: DROP DATABASE fails if database contains a #mysql50# table with backticks
-#
-create database mysqltestbug26703;
-use mysqltestbug26703;
-create table `#mysql50#abc``def` ( id int );
---error ER_WRONG_TABLE_NAME
-create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int);
-create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int);
-create table `#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1234` (a int);
---error ER_WRONG_TABLE_NAME
-create table `#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa12345` (a int);
-show tables;
-use test;
-drop database mysqltestbug26703;
-
---echo End of 5.1 tests
-
-###########################################################################
-
---echo
---echo # --
---echo # -- Bug#37431 (DROP TABLE does not report errors correctly).
---echo # --
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
---error ER_BAD_TABLE_ERROR
-DROP TABLE t1;
-
-SHOW WARNINGS;
-
---echo
---echo # --
---echo # -- End of Bug#37431.
---echo # --
-
-
---echo #
---echo # Bug#54282 Crash in MDL_context::upgrade_shared_lock_to_exclusive
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (a INT);
-LOCK TABLE t1 WRITE;
---error ER_NONUNIQ_TABLE
-DROP TABLE t1, t1;
-
-UNLOCK TABLES;
-DROP TABLE t1;
-
---echo #
---echo # BUG#34750: Print database name in Unknown Table error message
---echo #
-
---echo
---echo # Test error message when droping table/view
-
---error ER_BAD_TABLE_ERROR
-DROP TABLE table1;
---error ER_BAD_TABLE_ERROR
-DROP TABLE table1,table2;
---error ER_UNKNOWN_VIEW
-DROP VIEW view1,view2,view3,view4;
---echo
-DROP TABLE IF EXISTS table1;
-DROP TABLE IF EXISTS table1,table2;
-DROP VIEW IF EXISTS view1,view2,view3,view4;
-
---echo
---echo # Test error message when trigger does not find table
-
-CREATE TABLE table1(a int);
-CREATE TABLE table2(b int);
-
-# Database name is only available (for printing) if specified in
-# the trigger definition
-CREATE TRIGGER trg1 AFTER INSERT ON table1
-FOR EACH ROW
- INSERT INTO table2 SELECT t.notable.*;
-
---error ER_BAD_TABLE_ERROR
-INSERT INTO table1 VALUES (1);
-
-DROP TABLE table1,table2;
-
---echo # End BUG#34750
-
---echo #
---echo # MDEV-11105 Table named 'db' has weird side effect.
---echo #
-
-CREATE DATABASE mysqltest;
-CREATE TABLE mysqltest.db(id INT);
-DROP DATABASE mysqltest;
-
diff --git a/mysql-test/t/drop_bad_db_type.test b/mysql-test/t/drop_bad_db_type.test
deleted file mode 100644
index 00b79dabddf..00000000000
--- a/mysql-test/t/drop_bad_db_type.test
+++ /dev/null
@@ -1,31 +0,0 @@
-
---source include/have_debug.inc
-
-if (!$HA_ARCHIVE_SO) {
- skip Needs Archive plugin;
-}
-
-let $mysqld_datadir= `select @@datadir`;
-
-set debug_dbug='+d,unstable_db_type';
-
-install soname 'ha_archive';
-create table t1 (a int) engine=archive;
-insert t1 values (1),(2),(3);
-flush tables;
-uninstall soname 'ha_archive';
-
---vertical_results
-select table_schema, table_name from information_schema.tables where table_name like 't1';
-select table_schema, table_name, engine, version from information_schema.tables where table_name like 't1';
-select table_schema, table_name, engine, row_format from information_schema.tables where table_name like 't1';
---horizontal_results
-
-install soname 'ha_archive';
---list_files $mysqld_datadir/test
-drop table t1;
---list_files $mysqld_datadir/test
-uninstall soname 'ha_archive';
-
-set debug_dbug='-d,unstable_db_type';
-
diff --git a/mysql-test/t/dyncol.test b/mysql-test/t/dyncol.test
deleted file mode 100644
index f2c0a31c898..00000000000
--- a/mysql-test/t/dyncol.test
+++ /dev/null
@@ -1,984 +0,0 @@
-#
-# Dynamic column function test
-#
-
---echo #
---echo # column create
---echo #
-select hex(COLUMN_CREATE(1, NULL AS char character set utf8));
-select hex(COLUMN_CREATE(1, "afaf" AS char character set utf8));
-select hex(COLUMN_CREATE(1, 1212 AS char character set utf8));
-select hex(COLUMN_CREATE(1, 12.12 AS char character set utf8));
-select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS char character set utf8));
-select hex(COLUMN_CREATE(1, NULL AS unsigned int));
-select hex(COLUMN_CREATE(1, 1212 AS unsigned int));
-select hex(COLUMN_CREATE(1, 7 AS unsigned int));
-select hex(COLUMN_CREATE(1, 8 AS unsigned int));
-select hex(COLUMN_CREATE(1, 127 AS unsigned int));
-select hex(COLUMN_CREATE(1, 128 AS unsigned int));
-select hex(COLUMN_CREATE(1, 12.12 AS unsigned int));
-select hex(COLUMN_CREATE(1, ~0));
-select hex(COLUMN_CREATE(1, -1));
-select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS unsigned int));
-select hex(COLUMN_CREATE(1, NULL AS int));
-select hex(COLUMN_CREATE(1, 1212 AS int));
-select hex(COLUMN_CREATE(1, 7 AS int));
-select hex(COLUMN_CREATE(1, 8 AS int));
-select hex(COLUMN_CREATE(1, 127 AS int));
-select hex(COLUMN_CREATE(1, 128 AS int));
-select hex(COLUMN_CREATE(1, 12.12 AS int));
-select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS int));
-select hex(COLUMN_CREATE(1, NULL AS double));
-select hex(COLUMN_CREATE(1, 1212 AS double));
-select hex(COLUMN_CREATE(1, 12.12 AS double));
-select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS double));
-select hex(COLUMN_CREATE(1, NULL AS decimal));
-select hex(COLUMN_CREATE(1, 1212 AS decimal));
-select hex(COLUMN_CREATE(1, 7 AS decimal));
-select hex(COLUMN_CREATE(1, 8 AS decimal));
-select hex(COLUMN_CREATE(1, 127 AS decimal));
-select hex(COLUMN_CREATE(1, 128 AS decimal));
-select hex(COLUMN_CREATE(1, 12.12 AS decimal));
-select hex(COLUMN_CREATE(1, 99999999999999999999999999999 AS decimal));
-select hex(COLUMN_CREATE(1, NULL AS date));
-select hex(COLUMN_CREATE(1, "2011-04-05" AS date));
-select hex(COLUMN_CREATE(1, NULL AS time));
-select hex(COLUMN_CREATE(1, "0:45:49.000001" AS time));
-select hex(COLUMN_CREATE(1, NULL AS datetime));
-select hex(COLUMN_CREATE(1, "2011-04-05 0:45:49.000001" AS datetime));
-select hex(COLUMN_CREATE(1, "afaf" AS char character set utf8,
- 2, 1212 AS unsigned int,
- 3, 1212 AS int,
- 4, 12.12 AS double,
- 4+1, 12.12 AS decimal,
- 6, "2011-04-05" AS date,
- 7, "- 0:45:49.000001" AS time,
- 8, "2011-04-05 0:45:49.000001" AS datetime));
-explain extended
-select hex(COLUMN_CREATE(1, "afaf" AS char character set utf8,
- 2, 1212 AS unsigned int,
- 3, 1212 AS int,
- 4, 12.12 AS double,
- 4+1, 12.12 AS decimal,
- 6, "2011-04-05" AS date,
- 7, "- 0:45:49.000001" AS time,
- 8, "2011-04-05 0:45:49.000001" AS datetime));
-select hex(column_create(1, 0.0 AS decimal));
-select hex(column_create(1, 1.0 AS decimal));
-
---echo #
---echo # column get uint
---echo #
-select column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned int);
-explain extended
-select column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned int);
-explain extended
-select column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned);
-select column_get(column_create(1, 1212 AS decimal), 1 as unsigned int);
-select column_get(column_create(1, 1212 AS double), 1 as unsigned int);
-select column_get(column_create(1, 1212 AS int), 1 as unsigned int);
-select column_get(column_create(1, "1212" AS char), 1 as unsigned int);
-select column_get(column_create(1, "2011-04-05" AS date), 1 as unsigned int);
-select column_get(column_create(1, "8:46:06.23434" AS time), 1 as unsigned int);
-select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as unsigned int);
-select column_get(column_create(1, NULL AS unsigned int), 1 as unsigned int);
---echo # column geint truncation & warnings
-select column_get(column_create(1, -1212 AS int), 1 as unsigned int);
-select column_get(column_create(1, 99999999999999999999999999999 AS decimal), 1 as unsigned int);
-select column_get(column_create(1, 999.9999999999999999 AS decimal), 1 as unsigned int);
-select column_get(column_create(1, -1 AS decimal), 1 as unsigned int);
---replace_result e+029 e+29
-select column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as unsigned int);
-select column_get(column_create(1, 999.9 AS double), 1 as unsigned int);
-select column_get(column_create(1, -1 AS double), 1 as unsigned int);
-select column_get(column_create(1, "1212III" AS char), 1 as unsigned int);
-
---echo #
---echo # column get int
---echo #
-select column_get(column_create(1, 1212 AS int), 1 as int);
-explain extended
-select column_get(column_create(1, 1212 AS int), 1 as int);
-explain extended
-select column_get(column_create(1, 1212 AS int), 1 as signed int);
-select column_get(column_create(1, -1212 AS int), 1 as int);
-select column_get(column_create(1, 1212 AS decimal), 1 as int);
-select column_get(column_create(1, 1212 AS double), 1 as int);
-select column_get(column_create(1, 1212 AS unsigned int), 1 as int);
-select column_get(column_create(1, "1212" AS char), 1 as int);
-select column_get(column_create(1, "-1212" AS char), 1 as int);
-select column_get(column_create(1, "2011-04-05" AS date), 1 as int);
-select column_get(column_create(1, "8:46:06.23434" AS time), 1 as int);
-select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as int);
-select column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as int);
-select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as int);
-select column_get(column_create(1, NULL AS int), 1 as int);
---echo #column gett truncation & warnings
-select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as int);
-select column_get(column_create(1, 99999999999999999999999999999 AS decimal), 1 as int);
-select column_get(column_create(1, -99999999999999999999999999999 AS decimal), 1 as int);
-select column_get(column_create(1, 999.9999999999999999 AS decimal), 1 as int);
-select column_get(column_create(1, 999.9 AS double), 1 as int);
---replace_result e+029 e+29
-select column_get(column_create(1, -99999999999999999999999999999 AS double), 1 as int);
-select column_get(column_create(1, "-1212III" AS char), 1 as int);
-select column_get(column_create(1, "1212III" AS char), 1 as int);
-select column_get(COLUMN_CREATE(1, ~0), 1 as signed);
-select column_get(COLUMN_CREATE(1, ~0), 1 as unsigned);
-select column_get(COLUMN_CREATE(1, -1), 1 as signed);
-select column_get(COLUMN_CREATE(1, -1), 1 as unsigned);
-
---echo #
---echo #column get char
---echo #
-select column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset utf8);
-explain extended
-select column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset utf8);
-select column_get(column_create(1, 1212 AS unsigned int), 1 as char charset utf8);
-select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as char charset utf8);
-select column_get(column_create(1, 1212 AS int), 1 as char charset utf8);
-select column_get(column_create(1, -1212 AS int), 1 as char charset utf8);
-select column_get(column_create(1, 9223372036854775807 AS int), 1 as char charset utf8);
-select column_get(column_create(1, -9223372036854775808 AS int), 1 as char charset utf8);
-select column_get(column_create(1, 1212.12 AS decimal), 1 as char charset utf8);
-select column_get(column_create(1, 1212.12 AS double), 1 as char charset utf8);
-select column_get(column_create(1, "2011-04-05" AS date), 1 as char charset utf8);
-select column_get(column_create(1, "8:46:06.23434" AS time), 1 as char charset utf8);
-select column_get(column_create(1, "8:46:06.23434" AS time(0)), 1 as char charset utf8);
-select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as char charset utf8);
-select column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as char charset utf8);
-select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as char charset utf8);
-select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(0)), 1 as char charset utf8);
-select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as char charset utf8);
-select column_get(column_create(1, NULL AS char charset utf8), 1 as char charset utf8);
-select column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset binary);
-explain extended
-select column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset binary);
-
---echo #
---echo # column get real
---echo #
-select column_get(column_create(1, 1212.12 AS double), 1 as double);
-explain extended
-select column_get(column_create(1, 1212.12 AS double), 1 as double);
-explain extended
-select column_get(column_create(1, 1212.12 AS double), 1 as double(6,2));
-select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as double);
-select column_get(column_create(1, 9223372036854775807 AS int), 1 as double);
-select column_get(column_create(1, -9223372036854775808 AS int), 1 as double);
-select column_get(column_create(1, 99999999999999999999999999999 AS decimal), 1 as double);
-select column_get(column_create(1, -99999999999999999999999999999 AS decimal), 1 as double);
-select column_get(column_create(1, "2011-04-05" AS date), 1 as double);
-select column_get(column_create(1, "8:46:06.23434" AS time), 1 as double);
-select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as double);
-select column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as double);
-select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as double);
-select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime(6)), 1 as double);
-# The replace result is needed for windows.
-select round(column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as double(20,6)),3);
-select column_get(column_create(1, NULL AS double), 1 as double);
-
--- echo # column get real truncation & warnings
-select column_get(column_create(1, "1223.5aa" AS char), 1 as double);
-select column_get(column_create(1, "aa" AS char), 1 as double);
-select column_get(column_create(1, "1223.5555" AS double), 1 as double(5,2));
-select column_get(column_create(1, "1223.5555" AS double), 1 as double(3,2));
-
---echo #
---echo # column get decimal
---echo #
-select column_get(column_create(1, 1212.12 AS double), 1 as decimal);
-select column_get(column_create(1, 1212.12 AS double), 1 as decimal(6,2));
-explain extended
-select column_get(column_create(1, 1212.12 AS double), 1 as decimal);
-explain extended
-select column_get(column_create(1, 1212.12 AS double), 1 as decimal(6,2));
-select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as decimal(20,0));
-select column_get(column_create(1, 9223372036854775807 AS int), 1 as decimal(32,0));
-select column_get(column_create(1, -9223372036854775808 AS int), 1 as decimal(32,0));
-select column_get(column_create(1, -99999999999999999999999999999 AS decimal), 1 as decimal(40,10));
-select column_get(column_create(1, "2011-04-05" AS date), 1 as decimal(32,6));
-select column_get(column_create(1, "8:46:06.23434" AS time), 1 as decimal(32,6));
-select column_get(column_create(1, "8:46:06.23434" AS time(6)), 1 as decimal(32,6));
-select column_get(column_create(1, "-808:46:06.23434" AS time(6)), 1 as decimal(32,6));
-select column_get(column_create(1, "2011-04-05 8:46:06.123456" AS datetime), 1 as decimal(32,6));
-select column_get(column_create(1, "2011-04-05 8:46:06.123456" AS datetime(6)), 1 as decimal(32,6));
-select column_get(column_create(1, "2011-04-05 8:46:06.12345678" AS datetime(6)), 1 as decimal(32,8));
-select column_get(column_create(1, NULL as decimal), 1 as decimal(32,10));
-select column_get(column_create(1, "1223.5555" as decimal(10,5)), 1 as decimal(6,2));
-
--- echo # column get decimal truncation & warnings
-select column_get(column_create(1, "1223.5aa" AS char), 1 as decimal(32,10));
-select column_get(column_create(1, "aa" AS char), 1 as decimal(32,10));
-select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as decimal);
-select column_get(column_create(1, 9223372036854775807 AS int), 1 as decimal);
-select column_get(column_create(1, -9223372036854775808 AS int), 1 as decimal);
-select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as decimal);
-select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as decimal);
-select column_get(column_create(1, "1223.5555" as double), 1 as decimal(5,2));
-select column_get(column_create(1, "-1223.5555" as double), 1 as decimal(5,2));
-select column_get(column_create(1, "1223.5555" AS double), 1 as decimal(3,2));
-select column_get(column_create(1, "1223.5555" AS decimal(10,5)), 1 as decimal(3,2));
-select column_get(column_create(1, 0.0 AS decimal,2, 0.0 as decimal), 1 as decimal);
-
---echo #
---echo # column get datetime
---echo #
-select column_get(column_create(1, 20010203101112.121314 as double), 1 as datetime);
-select column_get(column_create(1, 20010203101112.121314 as decimal), 1 as datetime);
-select column_get(column_create(1, 20010203101112 as unsigned int), 1 as datetime);
-select column_get(column_create(1, 20010203101112 as int), 1 as datetime);
-select column_get(column_create(1, "20010203101112" as char), 1 as datetime);
-select column_get(column_create(1, "2001-02-03 10:11:12" as char), 1 as datetime);
-select column_get(column_create(1, "2001-02-03 10:11:12.121314" as char), 1 as datetime);
-select column_get(column_create(1, "2001-02-03 10:11:12.121314"), 1 as datetime);
-select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as datetime);
-select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as datetime(0));
-select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as datetime(6));
-select column_get(column_create(1, "2011-00-00 8:46:06.23434" AS CHAR), 1 as datetime);
-select column_get(column_create(1, "2011-00-01 8:46:06.23434" AS CHAR), 1 as datetime);
-
-select column_get(column_create(1, 20010203 as unsigned int), 1 as datetime);
-select column_get(column_create(1, 20010203 as int), 1 as datetime);
-select column_get(column_create(1, 20010203), 1 as datetime);
-select column_get(column_create(1, 20010203.0), 1 as datetime);
-select column_get(column_create(1, 20010203.0 as double), 1 as datetime);
-select column_get(column_create(1, "2001-02-03"), 1 as datetime);
-select column_get(column_create(1, "20010203"), 1 as datetime);
-select column_get(column_create(1, 0), 1 as datetime);
-select column_get(column_create(1, "2001021"), 1 as datetime);
-
-SET timestamp=unix_timestamp('2001-02-03 10:20:30');
-select column_get(column_create(1, "8:46:06.23434" AS time), 1 as datetime);
-select column_get(column_create(1, "-808:46:06.23434" AS time), 1 as datetime);
-SET timestamp=DEFAULT;
-
-set @@sql_mode="allow_invalid_dates";
-select column_get(column_create(1, "2011-02-30 18:46:06.23434" AS CHAR), 1 as datetime);
-select column_get(column_create(1, "0000-00-000" AS CHAR), 1 as datetime);
-select column_get(column_create(1, "2001-00-02" AS CHAR), 1 as datetime);
-set @@sql_mode="";
-
--- echo # column get datetime truncation & warnings
-select column_get(column_create(1, "1223.5aa" AS char), 1 as datetime);
---replace_result e+019 e+19
-select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as datetime);
-select column_get(column_create(1, 9223372036854775807 AS int), 1 as datetime);
-select column_get(column_create(1, -9223372036854775808 AS int), 1 as datetime);
-select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as datetime);
---replace_result e+029 e+29
-select column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as datetime);
-select column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as datetime);
-select column_get(column_create(1, "2011-13-01 8:46:06.23434" AS CHAR), 1 as datetime);
-select column_get(column_create(1, "2011-02-30 8:46:06.23434" AS CHAR), 1 as datetime);
-select column_get(column_create(1, "20010231"), 1 as datetime);
-select column_get(column_create(1, "0" AS CHAR), 1 as datetime);
-
-
---echo #
---echo # column get date
---echo #
-select column_get(column_create(1, 20010203101112.121314 as double), 1 as date);
-select column_get(column_create(1, 20010203101112.121314 as decimal), 1 as date);
-select column_get(column_create(1, 20010203101112 as unsigned int), 1 as date);
-select column_get(column_create(1, 20010203101112 as int), 1 as date);
-select column_get(column_create(1, "20010203101112" as char), 1 as date);
-select column_get(column_create(1, "2001-02-03 10:11:12" as char), 1 as date);
-select column_get(column_create(1, "2001-02-03 10:11:12.121314" as char), 1 as date);
-select column_get(column_create(1, "2001-02-03 10:11:12.121314"), 1 as date);
-select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as date);
-select column_get(column_create(1, "2011-00-00 8:46:06.23434" AS CHAR), 1 as date);
-select column_get(column_create(1, "2011-00-01 8:46:06.23434" AS CHAR), 1 as date);
-
-select column_get(column_create(1, 20010203 as unsigned int), 1 as date);
-select column_get(column_create(1, 20010203 as int), 1 as date);
-select column_get(column_create(1, 20010203), 1 as date);
-select column_get(column_create(1, 20010203.0), 1 as date);
-select column_get(column_create(1, 20010203.0 as double), 1 as date);
-select column_get(column_create(1, "2001-02-03"), 1 as date);
-select column_get(column_create(1, "20010203"), 1 as date);
-select column_get(column_create(1, 0), 1 as date);
-select column_get(column_create(1, "2001021"), 1 as date);
-
-set @@sql_mode="allow_invalid_dates";
-select column_get(column_create(1, "2011-02-30 18:46:06.23434" AS CHAR), 1 as date);
-select column_get(column_create(1, "0000-00-000" AS CHAR), 1 as date);
-select column_get(column_create(1, "2001-00-02" AS CHAR), 1 as date);
-set @@sql_mode="";
-
--- echo # column get date truncation & warnings
-select column_get(column_create(1, "1223.5aa" AS char), 1 as date);
---replace_result e+019 e+19
-select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as date);
-select column_get(column_create(1, 9223372036854775807 AS int), 1 as date);
-select column_get(column_create(1, -9223372036854775808 AS int), 1 as date);
-select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as date);
---replace_result e+029 e+29
-select column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as date);
-select column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as date);
-select column_get(column_create(1, "2011-13-01 8:46:06.23434" AS CHAR), 1 as date);
-select column_get(column_create(1, "2011-02-30 8:46:06.23434" AS CHAR), 1 as date);
-select column_get(column_create(1, "20010231"), 1 as date);
-select column_get(column_create(1, "0" AS CHAR), 1 as date);
-
---echo #
---echo # column get time
---echo #
-select column_get(column_create(1, 20010203101112.121314 as double), 1 as time);
-select column_get(column_create(1, 20010203101112.121314 as decimal), 1 as time);
-select column_get(column_create(1, 20010203101112 as unsigned int), 1 as time);
-select column_get(column_create(1, 8080102 as unsigned int), 1 as time);
-select column_get(column_create(1, 20010203101112 as int), 1 as time);
-select column_get(column_create(1, -8080102 as int), 1 as time);
-select column_get(column_create(1, "20010203101112" as char), 1 as time);
-select column_get(column_create(1, "2001-02-03 10:11:12" as char), 1 as time);
-select column_get(column_create(1, "2001-02-03 10:11:12.121314" as char), 1 as time);
-select column_get(column_create(1, "2001-02-03 10:11:12.121314" as char), 1 as time(6));
-select column_get(column_create(1, "2001-02-03 10:11:12.121314"), 1 as time);
-select column_get(column_create(1, "2011-04-05 8:46:06.23434" AS datetime), 1 as time(6));
-select column_get(column_create(1, "2011-00-00 8:46:06.23434" AS CHAR), 1 as time(6));
-select column_get(column_create(1, "2011-00-01 8:46:06.23434" AS CHAR), 1 as time(6));
-select column_get(column_create(1, "830:46:06.23434" AS CHAR), 1 as time(6));
-select column_get(column_create(1, "830:46:06" AS CHAR), 1 as time(6));
-select cast("-830:46:06.23434" AS time(6));
-select 1,cast("-830:46:06.23434" AS time(6));
-select hex(column_create(1, "-830:46:06.23434" AS CHAR));
-select column_get(column_create(1, "-830:46:06.23434" AS CHAR), 1 as time(6));
-select column_get(column_create(1, "0" AS CHAR), 1 as time);
-select column_get(column_create(1, "6" AS CHAR), 1 as time);
-select column_get(column_create(1, "1:6" AS CHAR), 1 as time);
-select column_get(column_create(1, "2:1:6" AS CHAR), 1 as time);
-
-select column_get(column_create(1, 0), 1 as time);
-select column_get(column_create(1, "2001021"), 1 as time);
-
-set @@sql_mode="allow_invalid_dates";
-select column_get(column_create(1, "2011-02-30 18:46:06.23434" AS CHAR), 1 as time);
-set @@sql_mode="";
-
--- echo # column get date truncation & warnings
-select column_get(column_create(1, "1223.5aa" AS char), 1 as time);
-select column_get(column_create(1, "1223.5aa" AS char), 1 as time(3));
---replace_result e+019 e+19
-select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as time);
-select column_get(column_create(1, 9223372036854775807 AS int), 1 as time);
-select column_get(column_create(1, -9223372036854775808 AS int), 1 as time);
-select column_get(column_create(1, 99999999999999999999999999999 AS decimal(32,10)), 1 as time);
---replace_result e+029 e+29
-select column_get(column_create(1, 99999999999999999999999999999 AS double), 1 as time);
-select column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as time);
-select column_get(column_create(1, "2011-13-01 8:46:06.23434" AS CHAR), 1 as time);
-select column_get(column_create(1, "2011-02-30 8:46:06.23434" AS CHAR), 1 as time);
-select column_get(column_create(1, "2001-02-03"), 1 as time);
-select column_get(column_create(1, "20010203"), 1 as time);
-
-
--- echo # column add
-select hex(column_add(column_create(1, 1212 as integer), 2, 1212 as integer));
-select hex(column_add(column_create(1, 1212 as integer), 1, 1212 as integer));
-select hex(column_add(column_create(1, 1212 as integer), 1, NULL as integer));
-select hex(column_add(column_create(1, 1212 as integer), 2, NULL as integer));
-select hex(column_add(column_create(1, 1212 as integer), 2, 1212 as integer, 1, 11 as integer));
-select column_get(column_add(column_create(1, 1212 as integer), 2, 1212 as integer, 1, 11 as integer), 1 as integer);
-select column_get(column_add(column_create(1, 1212 as integer), 2, 1212 as integer, 1, 11 as integer), 2 as integer);
-select hex(column_add(column_create(1, 1212 as integer), 1, 1212 as integer, 2, 11 as integer));
-select hex(column_add(column_create(1, NULL as integer), 1, 1212 as integer, 2, 11 as integer));
-select hex(column_add(column_create(1, 1212 as integer, 2, 1212 as integer), 1, 11 as integer));
-select hex(column_add(column_create(1, 1), 1, null));
-select column_list(column_add(column_create(1, 1), 1, null));
-select column_list(column_add(column_create(1, 1), 1, ""));
-select hex(column_add("", 1, 1));
-
--- echo # column delete
-select hex(column_delete(column_create(1, 1212 as integer, 2, 1212 as integer), 1));
-select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 2));
-select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 3));
-select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 4));
-select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 2, 1));
-select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 2, 3));
-select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 1, 2, 3));
-select hex(column_delete(column_create(1, 1 as integer, 2, 2 as integer, 3, 3 as integer), 1, 2, 3, 10));
-select hex(column_delete(column_create(1, 1), 1));
-select hex(column_delete("", 1));
-
--- echo # column exists
-select column_exists(column_create(1, 1212 as integer, 2, 1212 as integer), 1);
-select column_exists(column_create(1, 1212 as integer, 2, 1212 as integer), 4);
-
--- echo # column list
-select column_list(column_create(1, 1212 as integer, 2, 1212 as integer));
-select column_list(column_create(1, 1212 as integer));
-select column_list(column_create(1, NULL as integer));
-
---echo #
---echo # check error handling
---echo #
---error ER_DYN_COL_DATA
-select HEX(COLUMN_CREATE(1, 5, 1, 5));
---error 1064
-select HEX(COLUMN_CREATE("", 1, 5, 1, 5));
---error ER_DYN_COL_WRONG_FORMAT
-select COLUMN_LIST("a");
---error ER_DYN_COL_WRONG_FORMAT
-select column_delete("a", 1);
-select hex(column_delete("", 1));
---error ER_DYN_COL_DATA
-select hex(column_delete("", -1));
---error ER_DYN_COL_DATA
-select hex(column_create(-1, 1));
---error ER_DYN_COL_DATA
-select hex(column_create(65536, 1));
---error ER_DYN_COL_DATA
-select hex(column_add("", -1, 1));
---error ER_DYN_COL_DATA
-select hex(column_add("", 65536, 1));
-select hex(column_get("", -1 as int));
-
---echo #
---echo # Test with table
---echo #
-
-# create table with 'str' to hold a set of dynamic columns
-create table t1 (id int primary key, str mediumblob);
-insert into t1 values (1, ''), (2, ''), (3, ''), (4, ''), (5, null);
-
-# Selecting a non existing column
-select id, str, column_get(str, 1 as int) from t1;
-
-# Add some dynamic columns. One and do it with create or add.
-update t1 set str=column_create(1, id, 2, "a") where id < 3;
-update t1 set str=column_add(str, 1, id, 2, "b") where id >= 4;
-
-# Show some data, if it exists
-select id, column_get(str, 1 as int), column_get(str, 2 as char) from t1 where column_exists(str,1) or column_exists(str,2);
-
-# Add data to row 5 and 6
-update t1 set str=column_create(1, id, 10, "test") where id = 5;
-insert into t1 values (6, column_create(10, "test2"));
-
-# Update some of the columns and add a new column 3
-update t1 set str=column_add(str, 2, 'c', 1, column_get(str, 1 as int) + 1, 3, 100) where id > 2;
-
-# Check data
---sorted_result
-select id, length(str), column_get(str, 1 as int), column_get(str, 2 as char), column_get(str, 3 as int) from t1;
-
-# You can do anything with the columns, like SUM() or GROUP
-select column_get(str, 2 as char), sum(column_get(str, 1 as int)) from t1 group by column_get(str, 2 as char);
-select column_get(str, 2 as char), sum(column_get(str, 1 as int)) from t1 where column_exists(str, 2) <> 0 group by 1;
-select sum(column_get(str, 1 as int)) from t1 group by column_get(str, 2 as char) order by sum(column_get(str, 1 as int)) desc;
-select sum(column_get(str, 1 as int)) from t1 group by column_get(str, 2 as char) having sum(column_get(str, 1 as int)) > 2;
-select sum(column_get(str, 1 as int)) from t1 where column_get(str, 3 as int) > 50 group by column_get(str, 2 as char);
-
-# Deleting of column
-select id, column_list(str) from t1 where id= 5;
-update t1 set str=column_delete(str, 3, 4, 2) where id= 5;
-
---sorted_result
-select id, length(str), column_list(str), column_get(str, 1 as int), column_get(str, 2 as char), column_get(str, 3 as int) from t1;
-
-update t1 set str=column_add(str, 4, 45 as char, 2, 'c') where id= 5;
-select id, length(str), column_list(str), column_get(str, 1 as int), column_get(str, 2 as char), column_get(str, 3 as int) from t1 where id = 5;
-
-# Check which column exists
---sorted_result
-select id, length(str), column_list(str), column_exists(str, 4) from t1;
-select sum(column_get(str, 1 as int)), column_list(str) from t1 group by 2;
---sorted_result
-select id, hex(str) from t1;
-
-# Check with a bit larger strings
-
-update t1 set str=column_add(str, 4, repeat("a", 100000)) where id=5;
-select id from t1 where column_get(str,4 as char(100000)) = repeat("a", 100000);
-select id from t1 where column_get(str,4 as char(100)) = repeat("a", 100);
-update t1 set str=column_add(str, 4, repeat("b", 10000)) where id=5;
-select id from t1 where column_get(str,4 as char(100000)) = repeat("b", 10000);
-update t1 set str=column_add(str, 4, repeat("c", 100)) where id=5;
-select id from t1 where column_get(str,4 as char(100000)) = repeat("c", 100);
-update t1 set str=column_add(str, 4, repeat("d", 10000)) where id=5;
-select id from t1 where column_get(str,4 as char(100000)) = repeat("d", 10000);
-update t1 set str=column_add(str, 4, repeat("e", 10), 5, repeat("f", 100000)) where id=5;
-select id from t1 where column_get(str,5 as char(100000)) = repeat("f", 100000);
-select id, column_list(str), length(str) from t1 where id=5;
-update t1 set str=column_delete(str, 5) where id=5;
-select id, column_list(str), length(str) from t1 where id=5;
-
-drop table t1;
-
---echo #
---echo # LP#778905: Assertion `value->year <= 9999' failed in
---echo # dynamic_column_date_store
---echo #
-
---error ER_DYN_COL_WRONG_FORMAT
-SELECT COLUMN_GET( 'a' , 2 AS DATE );
---error ER_DYN_COL_WRONG_FORMAT
-SELECT COLUMN_CREATE( 1 , COLUMN_GET( 'a' , 2 AS DATE ) );
-
---echo #
---echo # LP#778912: Assertion `field_pos < field_count' failed in
---echo # Protocol_text::store in maria-5.3-mwl34
---echo #
-
-CREATE TABLE t1 ( f1 blob );
-INSERT INTO t1 VALUES (NULL);
-INSERT INTO t1 SET f1 = COLUMN_CREATE( 2 , 'cde' );
-SELECT HEX(COLUMN_ADD(f1, 1, 'abc')), COLUMN_LIST(f1) FROM t1;
-
-# Don't print strange characters on screen
---disable_result_log
-SELECT COLUMN_ADD(f1, 1, 'abc'), COLUMN_LIST(f1) FROM t1;
---enable_result_log
-DROP TABLE t1;
-
---echo #
---echo # Some dynamic strings that caused crashes in the past
---echo #
-
-set @a=0x0102000200030004000F0D086B74697A6A7176746F6B687563726A746E7A746A666163726C6F7A6B62636B6B756B666779666977617369796F67756C726D62677A72756E63626D78636D7077706A6F736C6D636464696770786B6371637A6A6A6463737A6A676879716462637178646C666E6B6C726A637677696E7271746C616D646368687A6C707869786D666F666261797470616A63797673737A796D74747475666B717573687A79696E7276706F796A6E767361796A6F6D646F6378677A667074746363736A796D67746C786F697873686464616265616A7A6F7168707A6B776B6376737A6B72666C6F666C69636163686F6B666D627166786A71616F;
---error ER_DYN_COL_WRONG_FORMAT
-select column_add(@a, 3, "a");
-
---echo #
---echo # LP#781233 mysqld: decimal.c:1459: decimal_bin_size:
---echo # Assertion `scale >= 0 && precision > 0 && scale <= precision' ...
---echo #
-
-set @a=0x00020008000009000C2C010080;
-select COLUMN_GET(@a, 9 AS DECIMAL);
-select hex(COLUMN_CREATE(0, COLUMN_GET(@a, 9 AS DECIMAL)));
-select hex(COLUMN_CREATE(0, COLUMN_GET(@a, 9 AS DECIMAL(19,0))));
-
-select hex(COLUMN_CREATE(0, COLUMN_GET(COLUMN_CREATE(0, 0.0 as decimal), 0 as decimal)));
-select hex(COLUMN_CREATE(0, 0.0 as decimal));
-
---echo #
---echo # MDEV-4292: parse error when selecting on views using dynamic column
---echo #
-create table t1 (i int, d blob);
-
-create view v1 as select i, column_get(d, 1 as binary) as a from t1;
-select * from v1;
-show create view v1;
-drop view v1;
-
-create view v1 as select i, column_get(d, 1 as int) as a from t1;
-select * from v1;
-show create view v1;
-drop view v1;
-
-create view v1 as select i, column_get(d, 1 as unsigned int) as a from t1;
-select * from v1;
-show create view v1;
-drop view v1;
-
-create view v1 as select i, column_get(d, 1 as date) as a from t1;
-select * from v1;
-show create view v1;
-drop view v1;
-
-create view v1 as select i, column_get(d, 1 as time) as a from t1;
-select * from v1;
-show create view v1;
-drop view v1;
-
-create view v1 as select i, column_get(d, 1 as datetime) as a from t1;
-select * from v1;
-show create view v1;
-drop view v1;
-
-create view v1 as select i, column_get(d, 1 as decimal) as a from t1;
-select * from v1;
-show create view v1;
-drop view v1;
-
-create view v1 as select i, column_get(d, 1 as double) as a from t1;
-select * from v1;
-show create view v1;
-drop view v1;
-
-create view v1 as select i, column_get(d, 1 as char) as a from t1;
-select * from v1;
-show create view v1;
-drop view v1;
-
-drop table t1;
-
---echo #
---echo # MDEV-4811: Assertion `offset < 0x1f' fails in type_and_offset_store
---echo # on COLUMN_ADD
---echo #
-
-CREATE TABLE t1 (dyn TINYBLOB) ENGINE=MyISAM;
-INSERT INTO t1 SET dyn = COLUMN_CREATE( 40, REPEAT('a', 233), 4, REPEAT('b', 322) );
---error ER_DYN_COL_WRONG_FORMAT
-SELECT COLUMN_ADD( dyn, 6, REPEAT('x',80), 4, REPEAT('y',215) AS INTEGER ) FROM t1;
-delete from t1;
---echo #above test with 10.0 format
-INSERT INTO t1 SET dyn = COLUMN_CREATE( 'a', REPEAT('a', 250), 'b', REPEAT('b', 322) );
---error ER_DYN_COL_WRONG_FORMAT
-SELECT COLUMN_ADD( dyn, 'c', REPEAT('x',80), 'b', REPEAT('y',215) AS INTEGER ) FROM t1;
-
-
-DROP table t1;
-
---echo #
---echo # MDEV-4812: Valgrind warnings (Invalid write) in
---echo # dynamic_column_update_many on COLUMN_ADD
---echo #
-CREATE TABLE t1 (dyncol TINYBLOB) ENGINE=MyISAM;
-
-INSERT INTO t1 SET dyncol = COLUMN_CREATE( 7, REPEAT('k',487), 209, REPEAT('x',464) );
---error 0,ER_DYN_COL_WRONG_FORMAT
-SELECT COLUMN_ADD( dyncol, 7, '22:22:22', 8, REPEAT('x',270) AS CHAR ) FROM t1;
-delete from t1;
-INSERT INTO t1 SET dyncol = COLUMN_CREATE( 'a', REPEAT('k',487), 'b', REPEAT('x',464) );
---error 0,ER_DYN_COL_WRONG_FORMAT
-SELECT COLUMN_ADD( dyncol, 'a', '22:22:22', 'c', REPEAT('x',270) AS CHAR ) FROM t1;
-
-DROP table t1;
-
---echo #
---echo # MDEV-4858 Wrong results for a huge unsigned value inserted into a TIME column
---echo #
-SELECT
- column_get(column_create(1, -999999999999999 AS int), 1 AS TIME) AS t1,
- column_get(column_create(1, -9223372036854775808 AS int), 1 AS TIME) AS t2;
-
---echo #
---echo # end of 5.3 tests
---echo #
-
-#
-# MySQL Bug#16997513 MY_STRTOLL10 ACCEPTING OVERFLOWED UNSIGNED LONG LONG VALUES AS NORMAL ONES
-# (incorrect overflow check in my_strtoll10())
-#
-select column_get(column_create(1, "18446744073709552001" as char), 1 as int);
-
---echo #
---echo # MDEV-7505 - Too large scale in DECIMAL dynamic column getter crashes
---echo # mysqld
---echo #
---error ER_TOO_BIG_SCALE
-SELECT COLUMN_GET(`x`, 'y' AS DECIMAL(5,50));
-
---echo #
---echo # test of symbolic names
---echo #
---echo # creation test (names)
-set names utf8;
-select hex(column_create("адын", 1212));
-select hex(column_create("1212", 1212));
-select hex(column_create(1212, 2, "www", 3));
-select hex(column_create("1212", 2, "www", 3));
-select hex(column_create("1212", 2, 3, 3));
-select hex(column_create("1212", 2, "адын", 1, 3, 3));
-set names default;
-
---echo # fetching column test (names)
-set names utf8;
-select column_get(column_create("адын", 1212), "адын" as int);
-select column_get(column_create("1212", 2, "адын", 1, 3, 3), "адын" as int);
-select column_get(column_create("1212", 2, "адын", 1, 3, 3), 1212 as int);
-select column_get(column_create("1212", 2, "адын", 1, 3, 3), "3" as int);
-select column_get(column_create("1212", 2, "адын", 1, 3, 3), 3 as int);
-select column_get(column_create("1212", 2, "адын", 1, 3, 3), 4 as int);
-select column_get(column_create("1212", 2, "адын", 1, 3, 3), "4" as int);
-set names default;
-
---echo # column existance test (names)
-set names utf8;
-select column_exists(column_create("адын", 1212), "адын");
-select column_exists(column_create("адын", 1212), "aады");
-select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "адын");
-select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 1212);
-select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "3");
-select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 3);
-select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 4);
-select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "4");
-set names default;
-
---echo # column changing test (names)
-select hex(column_add(column_create(1, "AAA"), "b", "BBB"));
-select hex(column_add(column_create("1", "AAA"), "b", "BBB"));
-select column_get(column_add(column_create(1, "AAA"), "b", "BBB"), 1 as char);
-select column_get(column_add(column_create(1, "AAA"), "b", "BBB"), "b" as char);
-select hex(column_add(column_create("a", "AAA"), 1, "BBB"));
-select hex(column_add(column_create("a", "AAA"), "1", "BBB"));
-select hex(column_add(column_create("a", 1212 as integer), "b", "1212" as integer));
-select hex(column_add(column_create("a", 1212 as integer), "a", "1212" as integer));
-select hex(column_add(column_create("a", 1212 as integer), "a", NULL as integer));
-select hex(column_add(column_create("a", 1212 as integer), "b", NULL as integer));
-select hex(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer));
-select column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer), "a" as integer);
-select column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer), "b" as integer);
-select hex(column_add(column_create("a", 1212 as integer), "a", 1212 as integer, "b", 11 as integer));
-select hex(column_add(column_create("a", NULL as integer), "a", 1212 as integer, "b", 11 as integer));
-select hex(column_add(column_create("a", 1212 as integer, "b", 1212 as integer), "a", 11 as integer));
-select hex(column_add(column_create("a", 1), "a", null));
-select column_list(column_add(column_create("a", 1), "a", null));
-select column_list(column_add(column_create("a", 1), "a", ""));
-select hex(column_add("", "a", 1));
-
--- echo # column delete (names)
-select hex(column_delete(column_create("a", 1212 as integer, "b", 1212 as integer), "a"));
-select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b"));
-select hex(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer));
-select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "c"));
-select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "d"));
-select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "a"));
-select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "c"));
-select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "a", "b", "c"));
-select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "a", "b", "c", "e"));
-select hex(column_delete(column_create("a", 1), "a"));
-select hex(column_delete("", "a"));
-
---echo #
---echo # MDEV-458 DNAMES: Server crashes on using an unquoted string
---echo # as a dynamic column name
---echo #
---error ER_BAD_FIELD_ERROR
-select COLUMN_CREATE(color, "black");
-
---echo #
---echo # MDEV-489 Assertion `offset < 0x1f' failed in
---echo # type_and_offset_store on COLUMN_ADD
---echo #
-CREATE TABLE t1 (f1 tinyblob);
-
-INSERT INTO t1 VALUES (COLUMN_CREATE('col1', REPEAT('a',30)));
-select column_check(f1) from t1;
-UPDATE t1 SET f1 = COLUMN_ADD( f1, REPEAT('b',211), 'val2' );
-# we can't detect last string cut with 100% probability,
-# because we detect it by string end
-select column_check(f1) from t1;
-UPDATE t1 SET f1 = COLUMN_ADD( f1, REPEAT('c',211), 'val3' );
-select column_check(f1) from t1;
-
-drop table t1;
-
---echo #
---echo # MDEV-490/MDEV-491 null as arguments
---echo #
-SELECT COLUMN_GET( COLUMN_CREATE( 'col', 'val' ), NULL AS CHAR );
-SELECT COLUMN_GET( NULL, 'col' as char );
-SELECT COLUMN_EXISTS( COLUMN_CREATE( 'col', 'val' ), NULL);
-SELECT COLUMN_EXISTS( NULL, 'col');
-SELECT COLUMN_CREATE( NULL, 'val' );
-SELECT COLUMN_ADD( NULL, 'val', 'col');
-
---echo #
---echo # MDEV-488: Assertion `column_name->length < 255' failed on a
---echo # column name with length 255 (precisely)
---echo #
-SELECT hex(COLUMN_CREATE(REPEAT('a',255),1));
---error ER_DYN_COL_DATA
-SELECT hex(COLUMN_CREATE(REPEAT('a',65536),1));
-
---echo #
---echo # JSON conversion
---echo #
-select column_json(column_create("int", -1212 as int, "uint", 12334 as unsigned int, "decimal", "23.344" as decimal, "double", 1.23444e50 as double, "string", 'gdgd\\dhdjh"dhdhd' as char, "time", "0:45:49.000001" AS time, "datetime", "2011-04-05 0:45:49.000001" AS datetime, "date", "2011-04-05" AS date));
-select column_json(column_create(1, -1212 as int, 2, 12334 as unsigned int, 3, "23.344" as decimal, 4, 1.23444e50 as double, 5, 'gdgd\\dhdjh"dhdhd' as char, 6, "0:45:49.000001" AS time, 7, "2011-04-05 0:45:49.000001" AS datetime, 8, "2011-04-05" AS date));
-
---echo #
---echo # CHECK test
---echo #
-SELECT COLUMN_CHECK(COLUMN_CREATE(1,'a'));
-SELECT COLUMN_CHECK('abracadabra');
-SELECT COLUMN_CHECK('');
-SELECT COLUMN_CHECK(NULL);
-
---echo #
---echo # escaping check
---echo #
-select column_json(column_create("string", "'\"/\\`.,whatever")),hex(column_create("string", "'\"/\\`.,whatever"));
-
---echo #
---echo # embedding test
---echo #
-select column_json(column_create("val", "val", "emb", column_create("val2", "val2")));
-select column_json(column_create(1, "val", 2, column_create(3, "val2")));
-
---echo #
---echo # Time encoding
---echo #
-select hex(column_create("t", "800:46:06.23434" AS time)) as hex,
- column_json(column_create("t", "800:46:06.23434" AS time)) as js;
-select hex(column_create(1, "800:46:06.23434" AS time)) as hex,
- column_json(column_create(1, "800:46:06.23434" AS time)) as js;
-
-select hex(column_create("t", "800:46:06" AS time)) as hex,
- column_json(column_create("t", "800:46:06" AS time)) as js;
-select hex(column_create(1, "800:46:06" AS time)) as hex,
- column_json(column_create(1, "800:46:06" AS time)) as js;
-
-select hex(column_create("t", "2012-12-21 10:46:06.23434" AS datetime)) as hex,
- column_json(column_create("t", "2012-12-21 10:46:06.23434" AS datetime)) as js;
-select hex(column_create(1, "2012-12-21 10:46:06.23434" AS datetime)) as hex,
- column_json(column_create(1, "2012-12-21 10:46:06.23434" AS datetime)) as js;
-
-select hex(column_create("t", "2012-12-21 10:46:06" AS datetime)) as hex,
- column_json(column_create("t", "2012-12-21 10:46:06" AS datetime)) as js;
-select hex(column_create(1, "2012-12-21 10:46:06" AS datetime)) as hex,
- column_json(column_create(1, "2012-12-21 10:46:06" AS datetime)) as js;
-
---echo #
---echo # MDEV-4849: Out of memory error and valgrind warnings on COLUMN_ADD
---echo #
-CREATE TABLE t1 (dyncol tinyblob) ENGINE=MyISAM;
-
-INSERT INTO t1 SET dyncol = COLUMN_CREATE( 3, REPEAT('a',330), 4, 'x' );
---error ER_DYN_COL_WRONG_FORMAT
-SELECT COLUMN_ADD( COLUMN_ADD( dyncol, 1, REPEAT('b',130) ), 3, 'y' ) FROM t1;
-
-DROP TABLE t1;
-
---echo #
---echo #MDEV-5840: group_concat( column_json(dynamic_column )) return empty
---echo #result
---echo #
-create table t1 (dyn blob);
-insert into t1 values (column_create('name1','value1','name2','value2'));
-select group_concat(cast(column_json(dyn) as char)) from t1;
-
-drop table t1;
-
---echo #
---echo # MDEV-7116: Dynamic column hangs/segfaults
---echo #
-create table t1 (
- impressions mediumblob
-);
-
-insert into t1 values ("");
-
-update t1
-set impressions = column_add(impressions,
- 'total', 12,
- '2014-10-28 16:00:00', 3,
- '2014-10-30 15:00:00', 3,
- '2014-11-04 09:00:00', 6
- );
-update t1
-set impressions = column_add(impressions,
- 'total', "a12",
- '2014-10-28 16:00:00', "a3",
- '2014-10-30 15:00:00', "a3",
- '2014-11-04 09:00:00', "a6"
- );
-
-drop table t1;
-
---echo #
---echo # MDEV-8565: COLUMN_CHECK fails on valid data
---echo #
-
-SELECT COLUMN_CHECK(COLUMN_CREATE('a',0,'b','1'));
-
-SELECT COLUMN_CHECK(COLUMN_CREATE('a',1,'b','1'));
-
-SELECT COLUMN_JSON(COLUMN_CREATE('a',0,'b','1'));
-
-SELECT COLUMN_JSON(COLUMN_CREATE('a',1,'b','1'));
-
---echo #
---echo # MDEV-8401: COLUMN_CREATE(name, value as DOUBLE) results in string
---echo #
-SELECT COLUMN_JSON(
- COLUMN_CREATE(
- 'one', 123.456,
- 'two', 123.456 as DOUBLE
- )
-);
-
---echo #
---echo # MDEV-8521: Drastic loss of precision in COLUMN_JSON() on DOUBLEs
---echo #
-
-select column_get(column_create('float', 1.23456789012345E+100 as double), 'float' as double);
-select column_json(column_create('float', 1.23456789012345E+100 as double));
-select column_json(column_create('float', 1.23456789012345E+10 as double));
-
---echo #
---echo # MDEV-9147: Character set is ignored in Dynamic Column for saved string
---echo #
-SET NAMES utf8;
-SELECT COLUMN_GET(COLUMN_CREATE(1, 0xC2A2 AS CHAR CHARACTER SET latin1), 1 AS CHAR CHARACTER SET utf8) AS a;
-SELECT COLUMN_GET(COLUMN_CREATE(1, 0xC2A2 AS CHAR CHARACTER SET utf8), 1 AS CHAR CHARACTER SET utf8) AS a;
-
---echo #
---echo # MDEV-9167: COLUMN_CHECK fails on valid decimal data
---echo #
-
-SELECT COLUMN_CHECK(COLUMN_CREATE('a',0 AS DECIMAL,'b',1 AS DECIMAL));
-
-SELECT COLUMN_CHECK(COLUMN_CREATE('a',1 AS DECIMAL,'b',1 AS DECIMAL));
-
-SELECT COLUMN_JSON(COLUMN_CREATE('a',0 AS DECIMAL,'b',1 AS DECIMAL));
-
-SELECT COLUMN_JSON(COLUMN_CREATE('a',1 AS DECIMAL,'b',1 AS DECIMAL));
-
-
---echo #
---echo # MDEV-7533: COLUMN_JSON() doesn't escape control characters
---echo # in string values
---echo #
-SELECT COLUMN_JSON(COLUMN_CREATE('test','"\\\t\n\Z')) AS json;
-SELECT COLUMN_JSON(COLUMN_CREATE('test','First line\nSecond line')) AS json;
-
---echo #
---echo # MDEV-15230: column_json breaks cyrillic in 10.1.31
---echo #
-set names utf8;
-create table t1 (b blob);
-insert into t1 values (column_create('description',column_create('title','Описание')));
-select column_json(b) from t1;
-drop table t1;
-
---echo #
---echo # end of 10.0 tests
---echo #
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
-#
-# Item_func_dyncol_add::print
-#
-create view v1 as select column_get(column_add(column_create(1 , 'blue' as char), 2, 'ttt'), 1 as char);
-show create view v1;
-select * from v1;
-drop view v1;
-
---echo #
---echo # MDEV-10134 Add full support for DEFAULT
---echo #
-CREATE TABLE t1 (
- name VARCHAR(10),
- value VARCHAR(10),
- dyncol0 BLOB DEFAULT COLUMN_CREATE(name, value),
- value_dyncol0_name0 VARCHAR(10) DEFAULT COLUMN_GET(dyncol0, 'name0' AS CHAR),
- dyncol1 BLOB DEFAULT COLUMN_ADD(dyncol0, 'name1', 'value1'),
- value_dyncol1_name1 VARCHAR(10) DEFAULT COLUMN_GET(dyncol1, 'name1' AS CHAR),
- dyncol2 BLOB DEFAULT COLUMN_DELETE(dyncol1, 'name1'),
- dyncol2_exists_name0 INT DEFAULT COLUMN_EXISTS(dyncol2, 'name0'),
- dyncol2_exists_name1 INT DEFAULT COLUMN_EXISTS(dyncol2, 'name1'),
- dyncol2_check INT DEFAULT COLUMN_CHECK(dyncol2),
- dyncol1_list TEXT DEFAULT COLUMN_LIST(dyncol1),
- dyncol1_json TEXT DEFAULT COLUMN_JSON(dyncol1)
-);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (name,value) VALUES ('name0', 'value0');
-SELECT value_dyncol0_name0, value_dyncol1_name1 FROM t1;
-SELECT dyncol2_check, dyncol2_exists_name0, dyncol2_exists_name1 FROM t1;
-SELECT dyncol1_list FROM t1;
-SELECT dyncol1_json FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/empty_server_name-8224.test b/mysql-test/t/empty_server_name-8224.test
deleted file mode 100644
index b15e9d82eb8..00000000000
--- a/mysql-test/t/empty_server_name-8224.test
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# MDEV-8224 Server crashes in get_server_from_table_to_cache on empty name
-#
---source include/not_embedded.inc
-create server '' foreign data wrapper w2 options (host '127.0.0.1');
---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server 10
---source include/wait_until_disconnected.inc
---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-
--- enable_reconnect
--- source include/wait_until_connected_again.inc
-drop server '';
diff --git a/mysql-test/t/empty_string_literal.test b/mysql-test/t/empty_string_literal.test
deleted file mode 100644
index 71e98d872bb..00000000000
--- a/mysql-test/t/empty_string_literal.test
+++ /dev/null
@@ -1,8 +0,0 @@
-USE test;
---echo #
---echo # MDEV-14013 : sql_mode=EMPTY_STRING_IS_NULL
---echo #
-
-set @mode='EMPTY_STRING_IS_NULL';
-
---source include/empty_string_literal.inc
diff --git a/mysql-test/t/empty_table.test b/mysql-test/t/empty_table.test
deleted file mode 100644
index 754671868ba..00000000000
--- a/mysql-test/t/empty_table.test
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Some special cases with empty tables
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1 (nr int(5) not null auto_increment,b blob,str char(10), primary key (nr));
-select count(*) from t1;
-select * from t1;
-select * from t1 limit 0;
-show status like "Empty_queries";
-drop table t1;
-
-#
-# Accessing a non existing table should not increase Empty_queries
-#
-
---error 1146
-select * from t2;
-show status like "Empty_queries";
-
-# End of 4.1 tests
diff --git a/mysql-test/t/empty_user_table.test b/mysql-test/t/empty_user_table.test
deleted file mode 100644
index b54f2109e30..00000000000
--- a/mysql-test/t/empty_user_table.test
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# MDEV-4462 mysqld gets SIGFPE when mysql.user table is empty
-#
-
-source include/not_embedded.inc;
-
-create table t1 as select * from mysql.user;
-truncate table mysql.user;
-flush privileges;
-
-# connecting via unix socket gives ER_ACCESS_DENIED_ERROR
-# connecting via tcp/ip gives ER_HOST_NOT_PRIVILEGED
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error ER_ACCESS_DENIED_ERROR,ER_HOST_NOT_PRIVILEGED
-connect (fail,localhost,u1);
-
-insert mysql.user select * from t1;
-drop table t1;
-flush privileges;
-
diff --git a/mysql-test/t/endspace.test b/mysql-test/t/endspace.test
deleted file mode 100644
index 69b8133c5f7..00000000000
--- a/mysql-test/t/endspace.test
+++ /dev/null
@@ -1,103 +0,0 @@
-#
-# Test problem with characters < ' ' at end of strings (Bug #3152)
-#
-
--- source include/have_innodb.inc
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
--- source include/endspace.inc
-
-#
-# Test MyISAM tables.
-#
-
-create table t1 (text1 varchar(32) not NULL, KEY key1 (text1));
-insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
-check table t1;
-select * from t1 ignore key (key1) where text1='teststring' or
- text1 like 'teststring_%' ORDER BY text1;
-select * from t1 where text1='teststring' or text1 like 'teststring_%';
-select * from t1 where text1='teststring' or text1 > 'teststring\t';
-select * from t1 order by text1;
-explain select * from t1 order by text1;
-
-alter table t1 modify text1 char(32) binary not null;
-check table t1;
-select * from t1 ignore key (key1) where text1='teststring' or
- text1 like 'teststring_%' ORDER BY text1;
-select concat('|', text1, '|') as c from t1 where text1='teststring' or text1 like 'teststring_%' order by c;
-select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
-select text1, length(text1) from t1 order by text1;
-select text1, length(text1) from t1 order by binary text1;
-
-alter table t1 modify text1 blob not null, drop key key1, add key key1 (text1(20));
-insert into t1 values ('teststring ');
-select concat('|', text1, '|') from t1 order by text1;
-select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
-select concat('|', text1, '|') from t1 where text1='teststring';
-select concat('|', text1, '|') from t1 where text1='teststring ';
-
-alter table t1 modify text1 text not null, pack_keys=1;
-select concat('|', text1, '|') from t1 where text1='teststring';
-select concat('|', text1, '|') from t1 where text1='teststring ';
-explain select concat('|', text1, '|') from t1 where text1='teststring ';
-select concat('|', text1, '|') from t1 where text1 like 'teststring_%';
-select concat('|', text1, '|') as c from t1 where text1='teststring' or text1 like 'teststring_%' order by c;
-select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
-select concat('|', text1, '|') from t1 order by text1;
-drop table t1;
-
-create table t1 (text1 varchar(32) not NULL, KEY key1 (text1)) pack_keys=0;
-insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
-select concat('|', text1, '|') as c from t1 where text1='teststring' or text1 like 'teststring_%' order by c;
-select concat('|', text1, '|') from t1 where text1='teststring' or text1 >= 'teststring\t';
-drop table t1;
-
-# Test HEAP tables (with BTREE keys)
-
-create table t1 (text1 varchar(32) not NULL, KEY key1 using BTREE (text1)) engine=heap;
-insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
-select * from t1 ignore key (key1) where text1='teststring' or
- text1 like 'teststring_%' ORDER BY text1;
-select * from t1 where text1='teststring' or text1 like 'teststring_%';
-select * from t1 where text1='teststring' or text1 >= 'teststring\t';
-select * from t1 order by text1;
-explain select * from t1 order by text1;
-
-alter table t1 modify text1 char(32) binary not null;
-select * from t1 order by text1;
-drop table t1;
-
-#
-# Test InnoDB tables
-#
-
-create table t1 (text1 varchar(32) not NULL, KEY key1 (text1)) engine=innodb;
-insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
-check table t1;
-select * from t1 where text1='teststring' or text1 like 'teststring_%';
-select * from t1 where text1='teststring' or text1 > 'teststring\t';
-select * from t1 order by text1;
-explain select * from t1 order by text1;
-
-alter table t1 modify text1 char(32) binary not null;
-select * from t1 order by text1;
-
-alter table t1 modify text1 blob not null, drop key key1, add key key1 (text1(20));
-insert into t1 values ('teststring ');
-select concat('|', text1, '|') from t1 order by text1;
-
-alter table t1 modify text1 text not null, pack_keys=1;
-select * from t1 where text1 like 'teststring_%';
-
-# The following gives wrong result in InnoDB
---sorted_result
-select text1, length(text1) from t1 where text1='teststring' or text1 like 'teststring_%';
---sorted_result
-select text1, length(text1) from t1 where text1='teststring' or text1 >= 'teststring\t';
-select concat('|', text1, '|') from t1 order by text1;
-drop table t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/enforce_storage_engine.test b/mysql-test/t/enforce_storage_engine.test
deleted file mode 100644
index 6b422477fe6..00000000000
--- a/mysql-test/t/enforce_storage_engine.test
+++ /dev/null
@@ -1,111 +0,0 @@
--- source include/not_embedded.inc
-
-set local sql_mode="";
-set global sql_mode="";
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-SET SESSION enforce_storage_engine=MyISAM;
-select @@session.enforce_storage_engine;
-CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=Memory;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=MyISAM;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10));
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-SET SESSION sql_mode='NO_ENGINE_SUBSTITUTION';
-CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=MyISAM;
-SHOW CREATE TABLE t1;
-INSERT INTO t1 values (1,'abba');
-
---error 1286
-CREATE TABLE t2 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=Memory;
-
-SET SESSION sql_mode='';
-
-SET SESSION enforce_storage_engine=MyISAM;
-select @@session.enforce_storage_engine;
-select * from t1;
-drop table t1;
-
-CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10));
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
---error 1286
-SET SESSION enforce_storage_engine=FooBar;
-
-select @@session.enforce_storage_engine;
-
---source include/add_anonymous_users.inc
-
-connect (con1,localhost,user_1,,);
-connection con1;
---error 1227
-SET SESSION enforce_storage_engine=MyISAM;
-disconnect con1;
-
-connection default;
-
---source include/delete_anonymous_users.inc
-
-SET SESSION enforce_storage_engine=NULL;
-
-SET SESSION sql_mode='NO_ENGINE_SUBSTITUTION';
-CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=Memory;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=MyISAM;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10));
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-SET GLOBAL enforce_storage_engine=Memory;
-SET SESSION sql_mode='';
-
-connect (con1,localhost,root,,);
-connection con1;
-select @@session.enforce_storage_engine;
-select @@global.enforce_storage_engine;
-CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10));
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-connection default;
-disconnect con1;
-
-set global sql_mode=default;
-SET SESSION enforce_storage_engine=NULL;
-SET GLOBAL enforce_storage_engine=NULL;
-
-#
-# MDEV-8577: With enforce-storage-engine mysql_upgrade corrupts the schema:
-# ALTER TABLE should either bypass enforce-storage-engine, or mysql_upgrade
-# should refuse to run
-#
-CREATE TABLE t3 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=MyISAM;
-INSERT INTO t3 values (NULL, 'test');
-SET SESSION enforce_storage_engine=Memory;
-ALTER TABLE t3 ENGINE=MyISAM;
-SHOW CREATE TABLE t3;
-DROP TABLE t3;
-SET SESSION enforce_storage_engine=NULL;
-CREATE TABLE t3 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=MyISAM;
-INSERT INTO t3 values (NULL, 'test');
-SET SESSION enforce_storage_engine=Memory;
-ALTER TABLE t3 ADD COLUMN c3 INT;
-SHOW CREATE TABLE t3;
-DROP TABLE t3;
-
-SET SESSION enforce_storage_engine=NULL;
-SET GLOBAL enforce_storage_engine=NULL; \ No newline at end of file
diff --git a/mysql-test/t/enforce_storage_engine_opt.opt b/mysql-test/t/enforce_storage_engine_opt.opt
deleted file mode 100644
index 9f09b57e395..00000000000
--- a/mysql-test/t/enforce_storage_engine_opt.opt
+++ /dev/null
@@ -1 +0,0 @@
---enforce-storage-engine=myisam
diff --git a/mysql-test/t/enforce_storage_engine_opt.test b/mysql-test/t/enforce_storage_engine_opt.test
deleted file mode 100644
index 7ca7f94d3dc..00000000000
--- a/mysql-test/t/enforce_storage_engine_opt.test
+++ /dev/null
@@ -1,7 +0,0 @@
-SET SQL_MODE="";
-create table t1 (c1 int primary key auto_increment, c2 varchar(10)) engine=memory;
-show create table t1;
-set session sql_mode='no_engine_substitution';
---error 1286
-create table t2 (c1 int primary key auto_increment, c2 varchar(10)) engine=memory;
-drop table t1;
diff --git a/mysql-test/t/engine_error_in_alter-8453.test b/mysql-test/t/engine_error_in_alter-8453.test
deleted file mode 100644
index c4600ec07fe..00000000000
--- a/mysql-test/t/engine_error_in_alter-8453.test
+++ /dev/null
@@ -1,11 +0,0 @@
-#
-# MDEV-8453 Alter table not returning engine errors
-#
---source include/have_debug.inc
-
-create table t1 (a int, b int);
-set debug_dbug='+d,external_lock_failure';
---error ER_GET_ERRMSG
-alter table t1 add column c int;
-set debug_dbug='';
-drop table t1;
diff --git a/mysql-test/t/error_simulation-master.opt b/mysql-test/t/error_simulation-master.opt
deleted file mode 100644
index c9f8d7bd0c0..00000000000
--- a/mysql-test/t/error_simulation-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---tmpdir=$MYSQLTEST_VARDIR/tmp
diff --git a/mysql-test/t/error_simulation.test b/mysql-test/t/error_simulation.test
deleted file mode 100644
index beaaf603754..00000000000
--- a/mysql-test/t/error_simulation.test
+++ /dev/null
@@ -1,164 +0,0 @@
--- source include/have_debug.inc
---source include/not_embedded.inc
-
-#
-# Bug #28499: crash for grouping query when tmp_table_size is too small
-#
-
-DROP TABLE IF EXISTS t1;
-
-CREATE TABLE t1 (
- a varchar(32) character set utf8 collate utf8_bin NOT NULL,
- b varchar(32) character set utf8 collate utf8_bin NOT NULL )
-ENGINE=MyISAM DEFAULT CHARSET=utf8;
-
-INSERT INTO t1 VALUES
- ('AAAAAAAAAA','AAAAAAAAAA'), ('AAAAAAAAAB','AAAAAAAAAB '),
- ('AAAAAAAAAB','AAAAAAAAAB'), ('AAAAAAAAAC','AAAAAAAAAC'),
- ('AAAAAAAAAD','AAAAAAAAAD'), ('AAAAAAAAAE','AAAAAAAAAE'),
- ('AAAAAAAAAF','AAAAAAAAAF'), ('AAAAAAAAAG','AAAAAAAAAG'),
- ('AAAAAAAAAH','AAAAAAAAAH'), ('AAAAAAAAAI','AAAAAAAAAI'),
- ('AAAAAAAAAJ','AAAAAAAAAJ'), ('AAAAAAAAAK','AAAAAAAAAK');
-
-set tmp_table_size=1024;
-
-# Set debug flag so an error is returned when
-# tmp table in query is converted from heap to myisam
-set session debug_dbug="+d,raise_error";
-
---replace_regex /in table '[^']+'/in table 'tmp_table'/
---error ER_DUP_KEY
-SELECT MAX(a) FROM t1 GROUP BY a,b;
-
-set tmp_table_size=default;
-DROP TABLE t1;
-
-
---echo #
---echo # Bug #50946: fast index creation still seems to copy the table
---echo #
-CREATE TABLE t1 (a INT(100) NOT NULL);
-INSERT INTO t1 VALUES (1), (0), (2);
-SET SESSION debug_dbug='+d,alter_table_only_index_change';
-ALTER TABLE t1 ADD INDEX a(a);
-SET SESSION debug_dbug=DEFAULT;
-SHOW CREATE TABLE t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#42064: low memory crash when importing hex strings, in Item_hex_string::Item_hex_string
---echo #
-
-CREATE TABLE t1(a BLOB);
-
-SET SESSION debug_dbug="+d,bug42064_simulate_oom";
-# May fail with either ER_OUT_OF_RESOURCES or EE_OUTOFMEMORY
---error ER_OUT_OF_RESOURCES, 5
-INSERT INTO t1 VALUES("");
-SET SESSION debug_dbug=DEFAULT;
-
-DROP TABLE t1;
-
--- echo #
--- echo # Bug#41660: Sort-index_merge for non-first join table may require
--- echo # O(#scans) memory
--- echo #
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9);
-
-CREATE TABLE t2 (a INT, b INT, filler CHAR(100), KEY(a), KEY(b));
-INSERT INTO t2 SELECT 1000, 1000, 'filler' FROM t1 A, t1 B, t1 C;
-INSERT INTO t2 VALUES (1, 1, 'data');
-
---echo # the example query uses LEFT JOIN only for the sake of being able to
---echo # demonstrate the issue with a very small dataset. (left outer join
---echo # disables the use of join buffering, so we get the second table
---echo # re-scanned for every record in the outer table. if we used inner join,
---echo # we would need to have thousands of records and/or more columns in both
---echo # tables so that the join buffer is filled and re-scans are triggered).
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='outer_join_with_cache=off';
-
-SET SESSION debug_dbug= '+d,only_one_Unique_may_be_created';
-
---replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x
-EXPLAIN
-SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 );
-SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 );
-
-SET SESSION debug_dbug= DEFAULT;
-
-SET optimizer_switch=@save_optimizer_switch;
-
-DROP TABLE t1, t2;
-
-
---echo #
---echo # Bug#11747970 34660: CRASH WHEN FEDERATED TABLE LOSES CONNECTION DURING INSERT ... SELECT
---echo #
-CREATE TABLE t1(f1 INT, KEY(f1));
-CREATE TABLE t2(f1 INT);
-INSERT INTO t1 VALUES (1),(2);
-INSERT INTO t2 VALUES (1),(2);
-SET SESSION debug_dbug="+d,bug11747970_raise_error";
---error ER_QUERY_INTERRUPTED
-INSERT IGNORE INTO t2 SELECT f1 FROM t1 a WHERE NOT EXISTS (SELECT 1 FROM t2 b WHERE a.f1 = b.f1);
-SET SESSION debug_dbug = DEFAULT;
-DROP TABLE t1,t2;
-
-
---echo #
---echo # End of 5.1 tests
---echo #
-
-
---echo #
---echo # BUG#11747548:DETECT ORPHAN TEMP-POOL FILES, AND HANDLE GRACEFULLY.
---echo #
-
---echo #Set up.
-CREATE TABLE pid_table(pid_no INT);
-CREATE TABLE t1 (a BLOB);
-INSERT INTO t1 VALUES (1), (2);
-
---echo #Create MYD and MYI files for intrinsic temp table.
---let $pid_file=`SELECT @@pid_file`
---replace_result $pid_file pid_file
---eval LOAD DATA LOCAL INFILE '$pid_file' INTO TABLE pid_table
---let $temp_file= `SELECT CONCAT('#sql_', LCASE(HEX(pid_no)), '_0') FROM pid_table`
---write_file $MYSQLTEST_VARDIR/tmp/$temp_file.MYD
-EOF
---write_file $MYSQLTEST_VARDIR/tmp/$temp_file.MYI
-EOF
---write_file $MYSQLTEST_VARDIR/tmp/$temp_file.MAD
-EOF
---write_file $MYSQLTEST_VARDIR/tmp/$temp_file.MAI
-EOF
-
---echo #Reports an error since the temp file already exists.
---replace_regex /.*Can't create\/write *.*/Can't create or write to file/
-#--error 1
-SELECT a FROM t1 ORDER BY rand(1);
-
---echo #With patch, the query executes successfully.
-SELECT a FROM t1 ORDER BY rand(1);
-
---echo #cleanup
-DROP TABLE t1, pid_table;
-
-
-
---echo #
---echo # MDEV-12416 OOM in create_virtual_tmp_table() makes the server crash
---echo #
-
-CREATE FUNCTION f1(a INT) RETURNS INT RETURN a;
-SET SESSION debug_dbug="+d,simulate_create_virtual_tmp_table_out_of_memory";
-# May fail with either ER_OUT_OF_RESOURCES or EE_OUTOFMEMORY
---error ER_OUT_OF_RESOURCES, 5
-SELECT f1(1);
-DROP FUNCTION f1;
-SET SESSION debug_dbug=DEFAULT;
diff --git a/mysql-test/t/errors.test b/mysql-test/t/errors.test
deleted file mode 100644
index 73d94d10382..00000000000
--- a/mysql-test/t/errors.test
+++ /dev/null
@@ -1,226 +0,0 @@
-#
-# Test some error conditions
-#
---source include/have_sequence.inc
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
---error 1146
-insert into t1 values(1);
---error 1146
-delete from t1;
---error 1146
-update t1 set a=1;
-create table t1 (a int);
---error 1054
-select count(test.t1.b) from t1;
---error 1054
-select count(not_existing_database.t1) from t1;
---error 1054
-select count(not_existing_database.t1.a) from t1;
---error 1044,1146
-select count(not_existing_database.t1.a) from not_existing_database.t1;
---error 1054
-select 1 from t1 order by 2;
---error 1054
-select 1 from t1 group by 2;
---error 1054
-select 1 from t1 order by t1.b;
---error 1054
-select count(*),b from t1;
-drop table t1;
-
-# End of 4.1 tests
-
-#
-# Bug #6080: Error message for a field with a display width that is too long
-#
---error 1439
-create table t1 (a int(256));
-set sql_mode='traditional';
---error 1074
-create table t1 (a varchar(66000));
-set sql_mode=default;
-
-#
-# Bug #27513: mysql 5.0.x + NULL pointer DoS
-#
-CREATE TABLE t1 (a INT);
-SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
-INSERT INTO t1 VALUES(1);
-SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
-INSERT INTO t1 VALUES(2),(3);
-SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
-DROP TABLE t1;
-
-#
-# Bug #28677: SELECT on missing column gives extra error
-#
-CREATE TABLE t1( a INT );
---error ER_BAD_FIELD_ERROR
-SELECT b FROM t1;
-SHOW ERRORS;
---error ER_BAD_FIELD_ERROR
-CREATE TABLE t2 SELECT b FROM t1;
-SHOW ERRORS;
---error ER_BAD_FIELD_ERROR
-INSERT INTO t1 SELECT b FROM t1;
-DROP TABLE t1;
-# End of 5.0 tests
-
-flush status;
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-create table t1 (a int unique);
-create table t2 (a int);
-drop function if exists f1;
-drop function if exists f2;
-
-delimiter |;
-
-create function f1() returns int
-begin
- insert into t1 (a) values (1);
- insert into t1 (a) values (1);
- return 1;
-end|
-create function f2() returns int
-begin
- insert into t2 (a) values (1);
- return 2;
-end|
-delimiter ;|
-
-flush status;
---error 1062
-select f1(), f2();
-show status like 'Com_insert';
-select * from t1;
-select * from t2;
-drop table t1;
-drop table t2;
-drop function f1;
-drop function f2;
-
-#
-# testing the value encoding in the error messages
-#
-# should be TR\xC3\x9CE, TRE, TRE
-#
-SET NAMES utf8;
---error ER_WRONG_VALUE_FOR_VAR
-SET sql_quote_show_create= _binary x'5452C39C45';
---error ER_WRONG_VALUE_FOR_VAR
-SET sql_quote_show_create= _utf8 x'5452C39C45';
---error ER_WRONG_VALUE_FOR_VAR
-SET sql_quote_show_create=_latin1 x'5452DC45';
---error ER_WRONG_VALUE_FOR_VAR
-SET sql_quote_show_create='TRÜE';
---error ER_WRONG_VALUE_FOR_VAR
-SET sql_quote_show_create=TRÜE;
-
-SET NAMES latin1;
---error ER_WRONG_VALUE_FOR_VAR
-SET sql_quote_show_create= _binary x'5452C39C45';
---error ER_WRONG_VALUE_FOR_VAR
-SET sql_quote_show_create= _utf8 x'5452C39C45';
---error ER_WRONG_VALUE_FOR_VAR
-SET sql_quote_show_create=_latin1 x'5452DC45';
---error ER_WRONG_VALUE_FOR_VAR
-SET sql_quote_show_create='TRE';
---error ER_WRONG_VALUE_FOR_VAR
-SET sql_quote_show_create=TRE;
-
-SET NAMES binary;
---error ER_WRONG_VALUE_FOR_VAR
-SET sql_quote_show_create= _binary x'5452C39C45';
---error ER_WRONG_VALUE_FOR_VAR
-SET sql_quote_show_create= _utf8 x'5452C39C45';
---error ER_WRONG_VALUE_FOR_VAR
-SET sql_quote_show_create=_latin1 x'5452DC45';
-
---echo #
---echo # Bug#52430 Incorrect key in the error message for duplicate key error involving BINARY type
---echo #
-CREATE TABLE t1(c1 BINARY(10), c2 BINARY(10), c3 BINARY(10),
-PRIMARY KEY(c1,c2,c3));
-INSERT INTO t1 (c1,c2,c3) VALUES('abc','abc','abc');
---error ER_DUP_ENTRY
-INSERT INTO t1 (c1,c2,c3) VALUES('abc','abc','abc');
-DROP TABLE t1;
-
-CREATE TABLE t1 (f1 VARBINARY(19) PRIMARY KEY);
-INSERT INTO t1 VALUES ('abc\0\0');
---error ER_DUP_ENTRY
-INSERT INTO t1 VALUES ('abc\0\0');
-DROP TABLE t1;
-
---echo #
---echo # Bug#57882: Item_func_conv_charset::val_str(String*):
---echo # Assertion `fixed == 1' failed
---echo #
-
---error ER_DATA_OUT_OF_RANGE
-SELECT (CONVERT('0' USING latin1) IN (CHAR(COT('v') USING utf8),''));
-
-SET NAMES utf8 COLLATE utf8_latvian_ci ;
---error ER_DATA_OUT_OF_RANGE
-SELECT UPDATEXML(-73 * -2465717823867977728,@@global.auto_increment_increment,null);
-
---echo #
---echo # End Bug#57882
---echo #
-
-#
-# Bug #13031606 VALUES() IN A SELECT STATEMENT CRASHES SERVER
-#
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2(a INT PRIMARY KEY, b INT);
---error ER_BAD_FIELD_ERROR
-SELECT '' AS b FROM t1 GROUP BY VALUE(b);
---error ER_BAD_FIELD_ERROR
-REPLACE t2(b) SELECT '' AS b FROM t1 GROUP BY VALUE(b);
---error ER_BAD_FIELD_ERROR
-UPDATE t2 SET a=(SELECT '' AS b FROM t1 GROUP BY VALUE(b));
---error ER_BAD_FIELD_ERROR
-INSERT INTO t2 VALUES (1,0) ON DUPLICATE KEY UPDATE
- b=(SELECT '' AS b FROM t1 GROUP BY VALUE(b));
-INSERT INTO t2(a,b) VALUES (1,0) ON DUPLICATE KEY UPDATE
- b=(SELECT VALUE(a)+2 FROM t1);
-DROP TABLE t1, t2;
-
---echo #
---echo # MDEV-492: incorrect error check before sending OK in mysql_update
---echo #
-CREATE TABLE t1 (a CHAR(3), b BLOB);
---error ER_DYN_COL_DATA
-UPDATE t1 SET a = 'new'
-WHERE COLUMN_CREATE( 1, 'v', 1, 'w' ) IS NULL;
-drop table t1;
-
-#
-# errors caused by max_session_mem_used
-#
---disable_result_log
-set max_session_mem_used = 50000;
---error 0,ER_OPTION_PREVENTS_STATEMENT
-select * from seq_1_to_1000;
-set max_session_mem_used = 8192;
---error 0,ER_OPTION_PREVENTS_STATEMENT
-select * from seq_1_to_1000;
---enable_result_log
-# We may not be able to execute any more queries with this connection
-# because of too little memory#
-
-
---echo #
---echo # MDEV-14269 errors.test fails with valgrind (Conditional jump or move depends on uninitialised value)
---echo #
-
-SET NAMES utf8;
---error ER_DATA_OUT_OF_RANGE
-SELECT UPDATEXML(-73 * -2465717823867977728,@@global.auto_increment_increment,null);
---error ER_DATA_OUT_OF_RANGE
-SELECT UPDATEXML(-73 * -2465717823867977728,@@global.long_query_time,null);
diff --git a/mysql-test/t/events_1.test b/mysql-test/t/events_1.test
deleted file mode 100644
index 9768127f458..00000000000
--- a/mysql-test/t/events_1.test
+++ /dev/null
@@ -1,493 +0,0 @@
-# changes 2008-02-20 hhunger splitted events.test into events_1 and events_2
-# changes 2008-02-22 hhunger replaced all sleep by wait_condition
-#
-# Can't test with embedded server that doesn't support grants
--- source include/not_embedded.inc
-
-set sql_mode="";
-
-call mtr.add_suppression("Column count of mysql.event is wrong. Expected .*, found .*\. The table is probably corrupted");
-
---disable_warnings
-drop database if exists events_test;
-drop database if exists db_x;
-drop database if exists mysqltest_db2;
-drop database if exists mysqltest_no_such_database;
---enable_warnings
-create database events_test;
-use events_test;
-
-#
-# START: BUG #17289 Events: missing privilege check for drop database
-#
-CREATE USER pauline@localhost;
-CREATE DATABASE db_x;
-GRANT EVENT ON db_x.* TO pauline@localhost;
-USE db_x;
-CREATE TABLE x_table(a int);
-connect (priv_conn,localhost,pauline,,db_x);
-CREATE EVENT e_x1 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE db_x;
-CREATE EVENT e_x2 ON SCHEDULE EVERY 1 SECOND DO DROP TABLE x_table;
-connection default;
-SHOW DATABASES LIKE 'db_x';
-SET GLOBAL event_scheduler=1;
-let $wait_condition= SELECT count(*)= 1 FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME LIKE 'db_x';
---source include/wait_condition.inc
-SHOW DATABASES LIKE 'db_x';
-SHOW TABLES FROM db_x;
-SET GLOBAL event_scheduler=off;
-connection priv_conn;
-DROP EVENT e_x1;
-DROP EVENT e_x2;
-disconnect priv_conn;
-connection default;
-DROP DATABASE db_x;
-DROP USER pauline@localhost;
-USE events_test;
-#
-# END: BUG #17289 Events: missing privilege check for drop database
-#
-SET GLOBAL event_scheduler=off;
-drop event if exists event1;
-create event event1 on schedule every 15 minute starts now() ends date_add(now(), interval 5 hour) DO begin end;
-alter event event1 rename to event2 enable;
-alter event event2 disable;
-alter event event2 enable;
-alter event event2 on completion not preserve;
-delimiter __;
-alter event event2 on schedule every 1 year on completion preserve rename to event3 comment "new comment" do begin select 1; end__
-delimiter ;__
-alter event event3 rename to event2;
-
-drop event event2;
-create event event2 on schedule every 2 second starts now() ends date_add(now(), interval 5 hour) comment "some" DO begin end;
-drop event event2;
-
-#
-# BUG #16537 (Events: mysql.event.starts is null)
-#
-CREATE EVENT event_starts_test ON SCHEDULE EVERY 10 SECOND COMMENT "" DO SELECT 1;
-SELECT interval_field, interval_value, body FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
-SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
-ALTER EVENT event_starts_test ON SCHEDULE AT '2020-02-02 20:00:02';
-SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
-ALTER EVENT event_starts_test COMMENT "non-empty comment";
-SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
-ALTER EVENT event_starts_test COMMENT "";
-SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
-DROP EVENT event_starts_test;
-
-CREATE EVENT event_starts_test ON SCHEDULE EVERY 20 SECOND STARTS '2020-02-02 20:00:02' ENDS '2022-02-02 20:00:02' DO SELECT 2;
-SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
-ALTER EVENT event_starts_test COMMENT "non-empty comment";
-SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
-ALTER EVENT event_starts_test COMMENT "";
-SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
-DROP EVENT event_starts_test;
-#
-#
-create table test_nested(a int);
-create event e_43 on schedule every 1 second do set @a = 5;
---error ER_EVENT_RECURSION_FORBIDDEN
-alter event e_43 do alter event e_43 do set @a = 4;
-delimiter |;
-alter event e_43 do
-begin
- alter event e_43 on schedule every 5 minute;
- insert into test_nested values(1);
-end|
-delimiter ;|
-set global event_scheduler = on;
-let $wait_condition= SELECT count(*)>0 from mysql.event where name='e_43' and interval_value= 5;
---source include/wait_condition.inc
-select db, name, body, status, interval_field, interval_value from mysql.event;
-drop event e_43;
-drop table test_nested;
-
---echo "Let's check whether we can use non-qualified names"
-create table non_qualif(a int);
-create event non_qualif_ev on schedule every 10 minute do insert into non_qualif values (800219);
-let $wait_condition=SELECT count(*)= 1 from non_qualif where a=800219;
---source include/wait_condition.inc
-select * from non_qualif;
-drop event non_qualif_ev;
-drop table non_qualif;
-
---error ER_EVENT_DOES_NOT_EXIST
-alter event non_existant rename to non_existant_too;
-
-set global event_scheduler = off;
-create event existant on schedule at now() + interval 1 year do select 12;
---error ER_EVENT_ALREADY_EXISTS
-alter event non_existant rename to existant;
---error ER_EVENT_SAME_NAME
-alter event existant rename to events_test.existant;
-drop event existant;
-
-
-create table t_event3 (a int, b float);
-drop event if exists event3;
-create event event3 on schedule every 50 + 10 minute starts date_add(curdate(), interval 5 minute) ends date_add(curdate(), interval 5 day) comment "portokala_comment" DO insert into t_event3 values (unix_timestamp(), rand());
-let $wait_condition=SELECT count(*)=0 from t_event3;
---source include/wait_condition.inc
-select count(*) from t_event3;
-drop event event3;
-drop table t_event3;
-
-
-set names utf8;
-#
-# SHOW CREATE EVENT test begin
-#
-CREATE EVENT root6 ON SCHEDULE EVERY '10:20' MINUTE_SECOND ON COMPLETION PRESERVE ENABLE COMMENT 'some comment' DO select 1;
---replace_regex /STARTS '[^']+'/STARTS '#'/
-SHOW CREATE EVENT root6;
-create event root7 on schedule every 2 year do select 1;
---replace_regex /STARTS '[^']+'/STARTS '#'/
-SHOW CREATE EVENT root7;
-create event root8 on schedule every '2:5' year_month do select 1;
---replace_regex /STARTS '[^']+'/STARTS '#'/
-SHOW CREATE EVENT root8;
-create event root8_1 on schedule every '2:15' year_month do select 1;
---replace_regex /STARTS '[^']+'/STARTS '#'/
-SHOW CREATE EVENT root8_1;
-create event root9 on schedule every 2 week ON COMPLETION PRESERVE DISABLE COMMENT 'коментар на кирилица' do select 1;
---replace_regex /STARTS '[^']+'/STARTS '#'/
-SHOW CREATE EVENT root9;
-create event root10 on schedule every '20:5' day_hour do select 1;
---replace_regex /STARTS '[^']+'/STARTS '#'/
-SHOW CREATE EVENT root10;
-create event root11 on schedule every '20:25' day_hour do select 1;
---replace_regex /STARTS '[^']+'/STARTS '#'/
-SHOW CREATE EVENT root11;
-create event root12 on schedule every '20:25' hour_minute do select 1;
---replace_regex /STARTS '[^']+'/STARTS '#'/
-SHOW CREATE EVENT root12;
-create event root13 on schedule every '25:25' hour_minute do select 1;
---replace_regex /STARTS '[^']+'/STARTS '#'/
-SHOW CREATE EVENT root13;
-create event root13_1 on schedule every '11:65' hour_minute do select 1;
---replace_regex /STARTS '[^']+'/STARTS '#'/
-SHOW CREATE EVENT root13_1;
-create event root14 on schedule every '35:35' minute_second do select 1;
---replace_regex /STARTS '[^']+'/STARTS '#'/
-SHOW CREATE EVENT root14;
-create event root15 on schedule every '35:66' minute_second do select 1;
---replace_regex /STARTS '[^']+'/STARTS '#'/
-SHOW CREATE EVENT root15;
-create event root16 on schedule every '35:56' day_minute do select 1;
---replace_regex /STARTS '[^']+'/STARTS '#'/
-SHOW CREATE EVENT root16;
-create event root17 on schedule every '35:12:45' day_minute do select 1;
---replace_regex /STARTS '[^']+'/STARTS '#'/
-SHOW CREATE EVENT root17;
-create event root17_1 on schedule every '35:25:65' day_minute do select 1;
---replace_regex /STARTS '[^']+'/STARTS '#'/
-SHOW CREATE EVENT root17_1;
-create event root18 on schedule every '35:12:45' hour_second do select 1;
---replace_regex /STARTS '[^']+'/STARTS '#'/
-SHOW CREATE EVENT root18;
-create event root19 on schedule every '15:59:85' hour_second do select 1;
---replace_regex /STARTS '[^']+'/STARTS '#'/
-SHOW CREATE EVENT root19;
-create event root20 on schedule every '50:20:12:45' day_second do select 1;
---replace_regex /STARTS '[^']+'/STARTS '#'/
-SHOW CREATE EVENT root20;
-set names cp1251;
-create event 21 on schedule every '50:23:59:95' day_second COMMENT ' 1251 ' do select 1;
---replace_regex /STARTS '[^']+'/STARTS '#'/
-SHOW CREATE EVENT 21;
-insert into mysql.event (
- db,
- name,
- body,
- definer,
- interval_value,
- interval_field,
- originator,
- character_set_client,
- collation_connection,
- db_collation,
- body_utf8)
-values (
- database(),
- "root22",
- "select 1",
- user(),
- 100,
- "SECOND_MICROSECOND",
- 1,
- 'utf8',
- 'utf8_general_ci',
- 'utf8_general_ci',
- 'select 1');
---error ER_NOT_SUPPORTED_YET
-show create event root22;
---error ER_NOT_SUPPORTED_YET
-SHOW EVENTS;
-drop event root22;
---error ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG
-create event root23 on schedule every -100 year do select 1;
---error ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG
-create event root23 on schedule every 222222222222222222222 year do select 1;
-drop event root6;
-drop event root7;
-drop event root8;
-drop event root8_1;
-drop event root9;
-drop event root10;
-drop event root11;
-drop event root12;
-drop event root13;
-drop event root13_1;
-drop event root14;
-drop event root15;
-drop event root16;
-drop event root17;
-drop event root17_1;
-drop event root18;
-drop event root19;
-drop event root20;
-drop event 21;
-
-set names latin1;
-#
-# SHOW CREATE EVENT test end
-#
-
-#
-# mysql.event intact checking
-# Check that the server does not crash if
-# one has destroyed or tampered with the event table.
-# Please see see for events_restart_phase* tests to
-# see the server behavior at start up with bad mysql.event
-# table.
-#
-#
---echo Create a test event. Only event metadata is relevant,
---echo the actual schedule and body are not.
-#
-CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing";
---replace_column 8 # 9 #
-SHOW EVENTS;
-#
---echo Try to alter mysql.event: the server should fail to load
---echo event information after mysql.event was tampered with.
---echo
---echo First, let's add a column to the end and check the error is emitted.
---echo
-ALTER TABLE mysql.event ADD dummy INT;
---error ER_EVENT_OPEN_TABLE_FAILED
-SHOW EVENTS;
---error ER_EVENT_OPEN_TABLE_FAILED
-SELECT event_name FROM INFORMATION_SCHEMA.events;
---error ER_EVENT_OPEN_TABLE_FAILED
-SHOW CREATE EVENT intact_check;
---error ER_EVENT_OPEN_TABLE_FAILED
-DROP EVENT no_such_event;
---error ER_EVENT_OPEN_TABLE_FAILED
-CREATE EVENT intact_check_1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
---error ER_EVENT_OPEN_TABLE_FAILED
-ALTER EVENT intact_check_1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
---error ER_EVENT_OPEN_TABLE_FAILED
-ALTER EVENT intact_check_1 RENAME TO intact_check_2;
---error ER_EVENT_OPEN_TABLE_FAILED
-DROP EVENT intact_check_1;
---error ER_EVENT_OPEN_TABLE_FAILED
-DROP EVENT intact_check_2;
---error ER_EVENT_OPEN_TABLE_FAILED
-DROP EVENT intact_check;
-DROP DATABASE IF EXISTS mysqltest_no_such_database;
-CREATE DATABASE mysqltest_db2;
-DROP DATABASE mysqltest_db2;
-SELECT @@event_scheduler;
-SHOW VARIABLES LIKE 'event_scheduler';
-SET GLOBAL event_scheduler=OFF;
-# Clean up
-ALTER TABLE mysql.event DROP dummy;
-DROP EVENT intact_check;
-CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing";
---echo
---echo Now let's add a column to the first position: the server
---echo expects to see event schema name there
---echo
-ALTER TABLE mysql.event ADD dummy INT FIRST;
---error ER_EVENT_OPEN_TABLE_FAILED
-SHOW EVENTS;
---error ER_EVENT_OPEN_TABLE_FAILED
-SELECT event_name FROM INFORMATION_SCHEMA.events;
---error ER_EVENT_OPEN_TABLE_FAILED
-SHOW CREATE EVENT intact_check;
---error ER_EVENT_OPEN_TABLE_FAILED
-DROP EVENT no_such_event;
---error ER_EVENT_OPEN_TABLE_FAILED
-CREATE EVENT intact_check_1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
---error ER_EVENT_OPEN_TABLE_FAILED
-ALTER EVENT intact_check_1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
---error ER_EVENT_OPEN_TABLE_FAILED
-ALTER EVENT intact_check_1 RENAME TO intact_check_2;
---error ER_EVENT_OPEN_TABLE_FAILED
-DROP EVENT intact_check_1;
---error ER_EVENT_OPEN_TABLE_FAILED
-DROP EVENT intact_check_2;
---error ER_EVENT_OPEN_TABLE_FAILED
-DROP EVENT intact_check;
-# Should work OK
-DROP DATABASE IF EXISTS mysqltest_no_such_database;
-CREATE DATABASE mysqltest_db2;
-DROP DATABASE mysqltest_db2;
-SELECT @@event_scheduler;
-SHOW VARIABLES LIKE 'event_scheduler';
-SET GLOBAL event_scheduler=OFF;
---echo Clean up
-ALTER TABLE mysql.event DROP dummy;
-DELETE FROM mysql.event;
-CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing";
---echo Back up the table, further changes are not reversible
-CREATE TABLE event_like LIKE mysql.event;
-INSERT INTO event_like SELECT * FROM mysql.event;
---echo
---echo Drop some columns and try more checks.
---echo
---echo
-ALTER TABLE mysql.event DROP comment, DROP starts;
---error ER_EVENT_OPEN_TABLE_FAILED
-SHOW EVENTS;
---error ER_EVENT_OPEN_TABLE_FAILED
-SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
---error ER_EVENT_OPEN_TABLE_FAILED
-SHOW CREATE EVENT intact_check;
---error ER_EVENT_OPEN_TABLE_FAILED
-DROP EVENT no_such_event;
---error ER_EVENT_OPEN_TABLE_FAILED
-CREATE EVENT intact_check_1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
---error ER_EVENT_OPEN_TABLE_FAILED
-ALTER EVENT intact_check_1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
---error ER_EVENT_OPEN_TABLE_FAILED
-ALTER EVENT intact_check_1 RENAME TO intact_check_2;
---error ER_EVENT_OPEN_TABLE_FAILED
-DROP EVENT intact_check_1;
---error ER_EVENT_OPEN_TABLE_FAILED
-DROP EVENT intact_check_2;
---error ER_EVENT_OPEN_TABLE_FAILED
-DROP EVENT intact_check;
-DROP DATABASE IF EXISTS mysqltest_no_such_database;
-CREATE DATABASE mysqltest_db2;
-DROP DATABASE mysqltest_db2;
-SELECT @@event_scheduler;
-SHOW VARIABLES LIKE 'event_scheduler';
-SET GLOBAL event_scheduler=OFF;
---echo
---echo Now drop the table, and test again
---echo
---echo
-DROP TABLE mysql.event;
---error ER_NO_SUCH_TABLE
-SHOW EVENTS;
---error ER_NO_SUCH_TABLE
-SELECT event_name FROM INFORMATION_SCHEMA.events;
---error ER_NO_SUCH_TABLE
-SHOW CREATE EVENT intact_check;
---error ER_NO_SUCH_TABLE
-DROP EVENT no_such_event;
---error ER_NO_SUCH_TABLE
-CREATE EVENT intact_check_1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
---error ER_NO_SUCH_TABLE
-ALTER EVENT intact_check_1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
---error ER_NO_SUCH_TABLE
-ALTER EVENT intact_check_1 RENAME TO intact_check_2;
---error ER_NO_SUCH_TABLE
-DROP EVENT intact_check_1;
---error ER_NO_SUCH_TABLE
-DROP EVENT intact_check_2;
---error ER_NO_SUCH_TABLE
-DROP EVENT intact_check;
-DROP DATABASE IF EXISTS mysqltest_no_such_database;
-CREATE DATABASE mysqltest_db2;
-DROP DATABASE mysqltest_db2;
---echo OK, there is an unnecessary warning about the non-existent table
---echo but it's not easy to fix and no one complained about it.
---echo A similar warning is printed if mysql.proc is missing.
-SHOW WARNINGS;
-SELECT @@event_scheduler;
-SHOW VARIABLES LIKE 'event_scheduler';
-SET GLOBAL event_scheduler=OFF;
---echo Restore the original table.
-CREATE TABLE mysql.event like event_like;
-DROP TABLE event_like;
---replace_column 8 # 9 #
-SHOW EVENTS;
-
---echo
---echo #
---echo # Bug#12394306: the sever may crash if mysql.event is corrupted
---echo #
-
---echo
-CREATE EVENT ev1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
-ALTER EVENT ev1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
-
---echo
-CREATE TABLE event_original LIKE mysql.event;
-INSERT INTO event_original SELECT * FROM mysql.event;
-
---echo
-ALTER TABLE mysql.event MODIFY modified CHAR(1);
-
---echo
---error ER_EVENT_OPEN_TABLE_FAILED
-SHOW EVENTS;
-
---echo
---error ER_EVENT_OPEN_TABLE_FAILED
-SELECT event_name, created, last_altered FROM information_schema.events;
-
---echo
---error ER_EVENT_OPEN_TABLE_FAILED
-CREATE EVENT ev2 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
-
---echo
---error ER_EVENT_OPEN_TABLE_FAILED
-ALTER EVENT ev1 ON SCHEDULE EVERY 9 HOUR DO SELECT 9;
-
---echo
-DROP TABLE mysql.event;
-RENAME TABLE event_original TO mysql.event;
-
---echo
-DROP EVENT ev1;
-
---echo
-SHOW EVENTS;
-
-
---echo #
---echo # MDEV-9524 Cannot load from mysql.event when sql_mode is set to PAD_CHAR_TO_FULL_LENGTH
---echo #
-CREATE TABLE t1 (a INT);
-CREATE EVENT ev1 ON SCHEDULE EVERY 5 SECOND DO DELETE FROM t1;
---replace_column 8 # 9 #
-SHOW EVENTS;
-SET sql_mode=PAD_CHAR_TO_FULL_LENGTH;
---replace_column 8 # 9 #
-SHOW EVENTS;
-DROP EVENT ev1;
-CREATE EVENT ev1 ON SCHEDULE EVERY 5 SECOND DO DELETE FROM t1;
---replace_column 8 # 9 #
-SHOW EVENTS;
-DROP EVENT ev1;
-DROP TABLE t1;
-SET sql_mode=DEFAULT;
-
-
---echo
---echo #
---echo # End of tests
---echo #
-
-let $wait_condition=
- select count(*) = 0 from information_schema.processlist
- where db='events_test' and command = 'Connect' and user=current_user();
---source include/wait_condition.inc
-
-drop database events_test;
diff --git a/mysql-test/t/events_2.test b/mysql-test/t/events_2.test
deleted file mode 100644
index 12ce9210b0a..00000000000
--- a/mysql-test/t/events_2.test
+++ /dev/null
@@ -1,524 +0,0 @@
-# changes 2008-02-20 hhunger splitted events.test into events_1 and events_2
-#
-# Can't test with embedded server that doesn't support grants
--- source include/not_embedded.inc
-
-set sql_mode="";
-
---disable_warnings
-drop database if exists events_test;
---enable_warnings
-create database events_test;
-use events_test;
-
-#
-# mysql.event intact checking end
-#
-
-create event e_26 on schedule at '2037-01-01 00:00:00' disable do set @a = 5;
-select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event;
-drop event e_26;
---error ER_WRONG_VALUE
-create event e_26 on schedule at NULL disable do set @a = 5;
---error ER_WRONG_VALUE
-create event e_26 on schedule at 'definitely not a datetime' disable do set @a = 5;
-
-set names utf8;
-create event задачка on schedule every 123 minute starts now() ends now() + interval 1 month do select 1;
-drop event задачка;
-
---echo "DISABLE the scheduler. Testing that it does not work when the variable is 0"
-set global event_scheduler=off;
-select definer, name, db from mysql.event;
-select get_lock("test_lock1", 20);
-create event закачка on schedule every 10 hour do select get_lock("test_lock1", 20);
---echo "Should return 1 row"
-select definer, name, db from mysql.event;
-
---echo "Should be only 0 process"
-select /*1*/ user, host, db, command, state, info
- from information_schema.processlist
- where (user='event_scheduler')
- order by info;
-select release_lock("test_lock1");
-drop event закачка;
---echo "Should have 0 events"
-select count(*) from mysql.event;
-
-#
-#
-#
---echo "ENABLE the scheduler and get a lock"
-set global event_scheduler=on;
-select get_lock("test_lock2", 20);
---echo "Create an event which tries to acquire a mutex. The event locks on the mutex"
-create event закачка on schedule every 10 hour do select get_lock("test_lock2", 20);
-
---echo "Should have only 2 processes: the scheduler and the locked event"
-let $wait_condition= select count(*) = 2 from information_schema.processlist
- where ( (state like 'User lock%' AND info like 'select get_lock%')
- OR (command='Daemon' AND user='event_scheduler' AND
- state = 'Waiting for next activation'));
---source include/wait_condition.inc
-
-select /*2*/ user, host, db, command, state, info
- from information_schema.processlist
- where (info like "select get_lock%" OR user='event_scheduler')
- order by info;
---echo "Release the mutex, the event worker should finish."
-select release_lock("test_lock2");
-drop event закачка;
-
-# Wait for get_lock("test_lock2") to complete,
-# to avoid polluting the next test information_schema.processlist
-let $wait_condition= select count(*) = 0 from information_schema.processlist
- where info='select get_lock("test_lock2", 20)';
---source include/wait_condition.inc
-
-
-##
-## 1. get a lock
-## 2. create an event
-## 3. sleep so it has time to start
-## 4. should appear in processlist
-## 5. kill the scheduler, it will wait for the child to stop
-## 6. both processes should be there on show processlist
-## 7. release the lock and sleep, both scheduler and child should end
-set global event_scheduler=1;
-select get_lock("test_lock2_1", 20);
-create event закачка21 on schedule every 10 hour do select get_lock("test_lock2_1", 20);
-
---echo "Should have only 2 processes: the scheduler and the locked event"
-let $wait_condition= select count(*) = 2 from information_schema.processlist
- where ( (state like 'User lock%' AND info like 'select get_lock%')
- OR (command='Daemon' AND user='event_scheduler' AND
- state = 'Waiting for next activation'));
---source include/wait_condition.inc
-
-select /*3*/ user, host, db, command, state, info
- from information_schema.processlist
- where (info like "select get_lock%" OR user='event_scheduler')
- order by info;
-
-set global event_scheduler=off;
-
-let $wait_condition= select count(*) =1 from information_schema.processlist
- where (info like "select get_lock%" OR user='event_scheduler');
---source include/wait_condition.inc
-
---echo "Should have only our process now:"
-select /*4*/ user, host, db, command, state, info
- from information_schema.processlist
- where (info like "select get_lock%" OR user='event_scheduler')
- order by info;
-select release_lock("test_lock2_1");
-drop event закачка21;
-let $wait_condition=
- select count(*) = 0 from information_schema.processlist
- where db='events_test' and command = 'Connect' and user=current_user();
---source include/wait_condition.inc
-
-####
-# Bug #16410 Events: CREATE EVENT is legal in a CREATE TRIGGER statement
-#
-create table t_16 (s1 int);
---error ER_EVENT_RECURSION_FORBIDDEN
-create trigger t_16_bi before insert on t_16 for each row create event e_16 on schedule every 1 second do set @a=5;
-drop table t_16;
-#
-# end of test case
-####
-
-#
-# START: BUG #17453: Creating Event crash the server
-#
-create event white_space
-on schedule every 10 hour
-disable
-do
-select 1;
-select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
-drop event white_space;
-create event white_space on schedule every 10 hour disable do
-
-select 2;
-select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
-drop event white_space;
-create event white_space on schedule every 10 hour disable do select 3;
-select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
-drop event white_space;
-#
-# END: BUG #17453: Creating Event crash the server
-#
-
-#
-# Bug#17403 "Events: packets out of order with show create event"
-#
-create event e1 on schedule every 1 year do set @a = 5;
-create table t1 (s1 int);
---error ER_SP_NO_RETSET
-create trigger t1_ai after insert on t1 for each row show create event e1;
-drop table t1;
-drop event e1;
-
-##set global event_scheduler=1;
-##select get_lock("test_lock3", 20);
-##create event закачка on schedule every 10 hour do select get_lock("test_lock3", 20);
-##select sleep(2);
-##select /*5*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
-##drop event закачка;
-##select release_lock("test_lock3");
-
-#
-# test with very often occuring event
-# (disabled for now, locks)
-##select get_lock("test_lock4", 20);
-##create event закачка4 on schedule every 1 second do select get_lock("test_lock4", 20);
-##select sleep(3);
-##select /*6*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
-##drop event закачка4;
-##select release_lock("test_lock4");
-
-##set global event_scheduler=off;
-##select sleep(2);
-##--replace_column 1 # 6 #
-##show processlist;
-##select count(*) from mysql.event;
-
-#
-# Test wrong syntax
-#
-
---error ER_WRONG_DB_NAME
-SHOW EVENTS FROM aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
---error ER_WRONG_DB_NAME
-SHOW EVENTS FROM ``;
-
-SHOW EVENTS FROM `events\\test`;
-#
-# A check for events SQL under LOCK TABLES and in pre-locked mode.
-#
---echo
---echo LOCK TABLES mode.
---echo
-#
-# SHOW CREATE EVENT and INFORMATION_SCHEMA.events are available and
-# cause an implicit lock/unlock of mysql.event table, regardless of the
-# currently locked tables.
-#
-create table t1 (a int);
-create event e1 on schedule every 10 hour do select 1;
-#
-lock table t1 read;
-#
---replace_regex /STARTS '[^']+'/STARTS '#'/
-show create event e1;
-select event_name from information_schema.events;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-create event e2 on schedule every 10 hour do select 1;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-alter event e2 disable;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-alter event e2 rename to e3;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-drop event e2;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-drop event e1;
-unlock tables;
-#
-lock table t1 write;
-#
---replace_regex /STARTS '[^']+'/STARTS '#'/
-show create event e1;
-select event_name from information_schema.events;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-create event e2 on schedule every 10 hour do select 1;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-alter event e2 disable;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-alter event e2 rename to e3;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-drop event e2;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-drop event e1;
-unlock tables;
-#
-lock table t1 read, mysql.event read;
-#
---replace_regex /STARTS '[^']+'/STARTS '#'/
-show create event e1;
-select event_name from information_schema.events;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-create event e2 on schedule every 10 hour do select 1;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-alter event e2 disable;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-alter event e2 rename to e3;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-drop event e2;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-drop event e1;
-unlock tables;
-#
-lock table t1 write, mysql.event read;
-#
---replace_regex /STARTS '[^']+'/STARTS '#'/
-show create event e1;
-select event_name from information_schema.events;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-create event e2 on schedule every 10 hour do select 1;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-alter event e2 disable;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-alter event e2 rename to e3;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-drop event e2;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-drop event e1;
-unlock tables;
-#
---error ER_WRONG_LOCK_OF_SYSTEM_TABLE
-lock table t1 read, mysql.event write;
-#
---error ER_WRONG_LOCK_OF_SYSTEM_TABLE
-lock table t1 write, mysql.event write;
-#
-lock table mysql.event write;
---replace_regex /STARTS '[^']+'/STARTS '#'/
-show create event e1;
-select event_name from information_schema.events;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-create event e2 on schedule every 10 hour do select 1;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-alter event e2 disable;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-alter event e2 rename to e3;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-drop event e3;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-drop event e1;
-unlock tables;
-drop event e1;
---echo Make sure we have left no events
-select event_name from information_schema.events;
---echo
---echo Events in sub-statements, events and prelocking
---echo
---echo
-create event e1 on schedule every 10 hour do select 1;
-delimiter |;
---error ER_SP_NO_RETSET
-create function f1() returns int
-begin
- show create event e1;
- return 1;
-end|
---error ER_SP_NO_RETSET
-create trigger trg before insert on t1 for each row
-begin
- show create event e1;
-end|
---error ER_SP_NO_RETSET
-create function f1() returns int
-begin
- select event_name from information_schema.events;
- return 1;
-end|
---error ER_SP_NO_RETSET
-create trigger trg before insert on t1 for each row
-begin
- select event_name from information_schema.events;
-end|
---error ER_EVENT_RECURSION_FORBIDDEN
-create function f1() returns int
-begin
- create event e2 on schedule every 10 hour do select 1;
- return 1;
-end|
---error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-create function f1() returns int
-begin
- alter event e1 rename to e2;
- return 1;
-end|
---error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-create function f1() returns int
-begin
- drop event e2;
- return 1;
-end|
---echo ----------------------------------------------------------------------
-create trigger trg before insert on t1 for each row
-begin
- set new.a= f1();
-end|
-create function f1() returns int
-begin
- call p1();
- return 0;
-end|
-create procedure p1()
-begin
- select event_name from information_schema.events;
-end|
---error ER_SP_NO_RETSET
-insert into t1 (a) values (1)|
-drop procedure p1|
-create procedure p1()
-begin
- show create event e1;
-end|
---error ER_SP_NO_RETSET
-insert into t1 (a) values (1)|
-drop procedure p1|
-create procedure p1()
-begin
- create temporary table tmp select event_name from information_schema.events;
-end|
---echo expected to work, since we redirect the output into a tmp table
-insert into t1 (a) values (1)|
-select * from tmp|
-drop temporary table tmp|
-drop procedure p1|
-create procedure p1()
-begin
- alter event e1 rename to e2;
-end|
---error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-insert into t1 (a) values (1)|
-drop procedure p1|
-create procedure p1()
-begin
- drop event e1;
-end|
---error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-insert into t1 (a) values (1)|
-drop table t1|
-drop event e1|
-delimiter ;|
-
-#
-# Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte
-#
-set names utf8;
-create event имя_события_в_кодировке_утф8_длиной_больше_чем_48 on schedule every 2 year do select 1;
-select EVENT_NAME from information_schema.events
-where event_schema='test';
-drop event имя_события_в_кодировке_утф8_длиной_больше_чем_48;
---error 1059
-create event
-очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66
-on schedule every 2 year do select 1;
-
-#
-# Bug#35981: ALTER EVENT causes the server to change the PRESERVE option.
-#
-
-create event event_35981 on schedule every 6 month on completion preserve
-disable
-do
- select 1;
-
-echo The following SELECTs should all give 1;
-
-# show current ON_COMPLETION
-select count(*) from information_schema.events
-where event_schema = database() and event_name = 'event_35981' and
- on_completion = 'PRESERVE';
-
-# show ON_COMPLETION remains "PRESERVE" when not given in ALTER EVENT
-alter event event_35981 enable;
-select count(*) from information_schema.events
-where event_schema = database() and event_name = 'event_35981' and
- on_completion = 'PRESERVE';
-
-# show we can change ON_COMPLETION
-alter event event_35981 on completion not preserve;
-select count(*) from information_schema.events
-where event_schema = database() and event_name = 'event_35981' and
- on_completion = 'NOT PRESERVE';
-
-# show ON_COMPLETION remains "NOT PRESERVE" when not given in ALTER EVENT
-alter event event_35981 disable;
-select count(*) from information_schema.events
-where event_schema = database() and event_name = 'event_35981' and
- on_completion = 'NOT PRESERVE';
-
-# show we can change ON_COMPLETION
-alter event event_35981 on completion preserve;
-select count(*) from information_schema.events
-where event_schema = database() and event_name = 'event_35981' and
- on_completion = 'PRESERVE';
-
-
-drop event event_35981;
-
-create event event_35981 on schedule every 6 month disable
-do
- select 1;
-
-# show that the defaults for CREATE EVENT are still correct (NOT PRESERVE)
-select count(*) from information_schema.events
-where event_schema = database() and event_name = 'event_35981' and
- on_completion = 'NOT PRESERVE';
-
-drop event event_35981;
-
-
-# show that backdating doesn't break
-
-create event event_35981 on schedule every 1 hour starts current_timestamp
- on completion not preserve
-do
- select 1;
-
-# should fail thanks to above's NOT PRESERVE
---error ER_EVENT_CANNOT_ALTER_IN_THE_PAST
-alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00'
- ends '1999-01-02 00:00:00';
-
-drop event event_35981;
-
-create event event_35981 on schedule every 1 hour starts current_timestamp
- on completion not preserve
-do
- select 1;
-
-# succeed with warning
-alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00'
- ends '1999-01-02 00:00:00' on completion preserve;
-
-drop event event_35981;
-
-
-
-create event event_35981 on schedule every 1 hour starts current_timestamp
- on completion preserve
-do
- select 1;
-
-# this should succeed thanks to above PRESERVE! give a warning though.
-alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00'
- ends '1999-01-02 00:00:00';
-
-# this should fail, as the event would have passed already
---error ER_EVENT_CANNOT_ALTER_IN_THE_PAST
-alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00'
- ends '1999-01-02 00:00:00' on completion not preserve;
-
-# should succeed giving a warning
-alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00'
- ends '1999-01-02 00:00:00' on completion preserve;
-
-drop event event_35981;
-
-#
-# End of tests
-#
-
-let $wait_condition=
- select count(*) = 0 from information_schema.processlist
- where db='events_test' and command = 'Connect' and user=current_user();
---source include/wait_condition.inc
-
-drop database events_test;
diff --git a/mysql-test/t/events_bugs-master.opt b/mysql-test/t/events_bugs-master.opt
deleted file mode 100644
index f93413a61e5..00000000000
--- a/mysql-test/t/events_bugs-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---event-scheduler
diff --git a/mysql-test/t/events_bugs.test b/mysql-test/t/events_bugs.test
deleted file mode 100644
index 76288c8fbae..00000000000
--- a/mysql-test/t/events_bugs.test
+++ /dev/null
@@ -1,1301 +0,0 @@
-#### t/events_bugs.test
-#
-# Last change:
-# 2009-01-08 mleich
-# - Fix for
-# Bug#41111 events_bugs fails sporadically on pushbuild
-# - Avoid effects of
-# Bug#41925 Warning 1366 Incorrect string value: ... for column processlist.info
-#
-# Please set $
-SET SQL_MODE="";
-let $fixed_bug41925= 0;
-#
-# Dear maintainer of this test. Please do NOT remove the next big comment.
-# The tests for events were quite unstable over a significant time because the
-# effects of events in general and their representation within the processlist
-# were partially not known. Therefore I had to make excessive experiments.
-# The comment with the outcome of these experiments will be moved into a README
-# file as soon as the tests for events get their own testsuite.
-#
-# Outcome of some experiments (mleich, mysql-5.1 2008-12):
-# --------------------------------------------------------
-# 0. Most time used setup:
-# High parallel I/O load
-# set global event_scheduler= off;
-# sleep 3;
-# use events_test;
-# create event e_16407 on schedule every 2 second do
-# begin
-# select 'FIRST COMMAND', sleep(0.5);
-# select 'SECOND COMMAND';
-# end|
-# set global event_scheduler= on;
-# Start observation of the processlist
-#
-#
-# 1. SET GLOBAL event_scheduler = 'ON' and immediate observation of the processlist.
-# 1.1 Effects around event scheduler:
-# 1.1.1 First phase (very short)
-# No user 'event_scheduler' within information_schema.processlist.
-# 1.1.2 Second phase observed (independend of probably existing events and very short) was
-# USER HOST DB COMMAND TIME STATE INFO
-# event_scheduler localhost NULL Daemon 0 Initialized NULL
-# 1.1.3 Third phase observed:
-# 1.1.3.1 Case we do not have existing events (rather long)
-# USER HOST DB COMMAND TIME STATE INFO
-# event_scheduler localhost NULL Daemon 0 Waiting on empty queue NULL
-# 1.1.3.2 Case there exists already an event
-# 1.1.3.2.1 Event executor is not visible in processlist but comes up soon
-# USER HOST DB COMMAND TIME STATE INFO
-# event_scheduler localhost NULL Daemon 0 NULL
-# or
-# event_scheduler localhost NULL Daemon 0 NULL NULL
-# 1.1.3.2.2 A bit later, at least one event executor is or was visible in processlist
-# The states mentioned in 3.2.1 or a bit later
-# USER HOST DB COMMAND TIME STATE INFO
-# event_scheduler localhost NULL Daemon 0 Waiting for next activation NULL
-# 1.2 Effects around event executor:
-# Typical processlist content:
-# USER evtest1 -- Definer of event
-# DB events_test -- DB during time of event creation (use DB is not allowed in events)
-# COMMAND Connect
-# STATE NULL
-# INFO SET @evname = 'ev_sched_1823' -- Part of the event code
-#
-# State before "User sleep select 'FIRST COMMAND', sleep(0.5);"
-# ID USER HOST DB COMMAND TIME STATE INFO
-# 7 event_scheduler localhost NULL Connect 0 NULL NULL
-# !! The user is not the event creator and the DB is different. !!
-# !! This means that we must get later a change of the identity. !!
-# or
-# USER HOST DB COMMAND TIME STATE INFO
-# root localhost events_test Connect 0 checking permissions
-# or
-# USER HOST DB COMMAND TIME STATE INFO
-# root localhost events_test Connect 0 checking permissions CREATE PROCEDURE ....
-# or
-# USER HOST DB COMMAND TIME STATE INFO
-# root localhost events_test Connect 0 NULL select 'FIRST COMMAND', sleep(0.5)
-# or
-# USER HOST DB COMMAND TIME STATE INFO
-# root localhost events_test Connect 0 checking permissions select 'FIRST COMMAND'...
-# or
-# USER HOST DB COMMAND TIME STATE INFO
-# root localhost events_test Connect 0 Opening table select 'FIRST COMMAND', sleep(0.5)
-# or
-# USER HOST DB COMMAND TIME STATE INFO
-# root localhost events_test Connect 0 Locked select 'FIRST COMMAND', sleep(0.5)
-# or
-# USER HOST DB COMMAND TIME STATE INFO
-# root localhost events_test Connect 0 executing select 'FIRST COMMAND', sleep(0.5)
-#
-# State "User sleep select 'FIRST COMMAND', sleep(0.5);" reached
-# USER HOST DB COMMAND TIME STATE INFO
-# root localhost events_test Connect 0 User sleep select 'FIRST COMMAND', sleep(0.5)
-#
-# State at end (! It looks like a slow CREATE PROC !) of event code execution was sometimes
-# USER HOST DB COMMAND TIME STATE INFO
-# root localhost events_test Connect 0 logging slow query CREATE PROCEDURE `e_16407`...
-#
-# State after running some event code was sometimes
-# USER HOST DB COMMAND TIME STATE INFO
-# root localhost events_test Connect 0 logging slow query select 'SECOND COMMAND'
-#
-# State somewhere (I guess just before the event executor disappears)
-# USER HOST DB COMMAND TIME STATE INFO
-# Event thread fin <empty> events_test Connect 0 Clearing NULL
-#
-#
-# 2. SET GLOBAL event_scheduler = 'OFF';
-# Immediate observation of the processlist.
-# Effects:
-# 1. I never found the user 'event_scheduler' within the processlist.
-# 2. Events just during execution could be found within the processlist
-# = It does not look like "SET GLOBAL event_scheduler = 'OFF'" stops them.
-# ==> Everything mentioned in 1.2 above could be observed.
-#
-# Several subtests were weak because they showed random result set differences after issuing
-# "SET GLOBAL EVENT_SCHEDULER= off;".
-# 1. Reason one: There were already event executors
-# Fix: Wait till there is no event executor active ==> no session WHERE
-# - command IN ('Connect')
-# There must be no parallel session being just in "Connect" phase!
-# or
-# - user = <who created the maybe current running events>
-# There must be no parallel session of this person.
-# or user = 'event_scheduler' with command = 'Connect'
-# The session which will soon change its identity to event creator.
-#
-# 2. Reason two: If an event modifies a MyISAM table than a delayed visibilty of changes
-# might occur (concurrent_inserts=on or delayed inserts ...).
-#
-
-# Can't test with embedded server that doesn't support grants
--- source include/not_embedded.inc
-
---disable_warnings
-drop database if exists events_test;
-drop database if exists mysqltest_db1;
-drop database if exists mysqltest_db2;
---enable_warnings
-create database events_test;
-use events_test;
-# We use MyISAM tables and must avoid effects (visibility of changes might be
-# delayed) caused by concurrent_insert on (default).
-set @concurrent_insert= @@global.concurrent_insert;
-set @@global.concurrent_insert = 0;
-
-#
-# START: Bug #31332 --event-scheduler option misbehaving
-#
-
-# NOTE!! this test must come first! It's testing that the --event-scheduler
-# option with no argument in events_bugs-master.opt turns the scheduler on.
-
-select * from information_schema.global_variables where variable_name like 'event_scheduler';
-# Check that the event_scheduler is really running
---source include/running_event_scheduler.inc
-
-SET GLOBAL event_scheduler = 'OFF';
---source include/check_events_off.inc
-
-#
-# END: Bug #31332
-#
-
-#
-# START - 16415: Events: event names are case sensitive
-#
-CREATE EVENT lower_case ON SCHEDULE EVERY 1 MINUTE DO SELECT 1;
---error ER_EVENT_ALREADY_EXISTS
-CREATE EVENT Lower_case ON SCHEDULE EVERY 2 MINUTE DO SELECT 2;
-DROP EVENT Lower_case;
-SET NAMES cp1251;
-CREATE EVENT __1251 ON SCHEDULE EVERY 1 YEAR DO SELECT 100;
---error ER_EVENT_ALREADY_EXISTS
-CREATE EVENT __1251 ON SCHEDULE EVERY 2 YEAR DO SELECT 200;
-DROP EVENT __1251;
-SET NAMES utf8;
-CREATE EVENT долен_регистър_утф8 ON SCHEDULE EVERY 3 YEAR DO SELECT 300;
---error ER_EVENT_ALREADY_EXISTS
-CREATE EVENT ДОЛЕН_регистър_утф8 ON SCHEDULE EVERY 4 YEAR DO SELECT 400;
-DROP EVENT ДОЛЕН_регистър_утф8;
-SET NAMES latin1;
-#
-# END - 16415: Events: event names are case sensitive
-#
-
-#
-# START - BUG#16408: Events: crash for an event in a procedure
-#
-set @a=3;
---error ER_EVENT_RECURSION_FORBIDDEN
-CREATE PROCEDURE p_16 () CREATE EVENT e_16 ON SCHEDULE EVERY @a SECOND DO SET @a=5;
-#
-# END - BUG#16408: Events: crash for an event in a procedure
-#
-
-#
-# Start - 16396: Events: Distant-future dates become past dates
-#
---error ER_WRONG_VALUE
-create event e_55 on schedule at 99990101000000 do drop table t;
---error ER_WRONG_VALUE
-create event e_55 on schedule every 10 hour starts 99990101000000 do drop table t;
---error ER_EVENT_ENDS_BEFORE_STARTS
-create event e_55 on schedule every 10 minute ends 99990101000000 do drop table t;
---error ER_WRONG_VALUE
-create event e_55 on schedule at 10000101000000 do drop table t;
-
-# For the purpose of backup we allow times in the past. Here, no
-# error will be given, but the event won't be created. One may think
-# of that as if the event was created, then it turned out it's in the
-# past, so it was dropped because of implicit ON COMPLETION NOT
-# PRESERVE.
-create event e_55 on schedule at 20000101000000 do drop table t;
-show events;
-
---error ER_PARSE_ERROR
-create event e_55 on schedule at 20200101000000 starts 10000101000000 do drop table t;
---error ER_PARSE_ERROR
-create event e_55 on schedule at 20200101000000 ends 10000101000000 do drop table t;
---error ER_PARSE_ERROR
-create event e_55 on schedule at 20200101000000 starts 10000101000000 ends 10000101000000 do drop table t;
---error ER_WRONG_VALUE
-create event e_55 on schedule every 10 hour starts 10000101000000 do drop table t;
-
-#
-# End - 16396: Events: Distant-future dates become past dates
-#
-
-#
-# Start - 16407: Events: Changes in sql_mode won't be taken into account
-#
-set global event_scheduler=off;
---source include/check_events_off.inc
-delete from mysql.event;
-set global event_scheduler= on;
---source include/running_event_scheduler.inc
-set @old_sql_mode:=@@sql_mode;
-set sql_mode=ansi;
-select get_lock('test_bug16407', 60);
-delimiter |;
-create event e_16407 on schedule every 60 second do
-begin
- select get_lock('test_bug16407', 60);
-end|
-delimiter ;|
-
-# The default session has the user lock.
-# We wait till one event runs and hangs when trying to get the user lock.
-let $wait_condition=
- select count(*) > 0 from information_schema.processlist
- where state = 'User lock' and info = 'select get_lock(\'test_bug16407\', 60)';
---source include/wait_condition.inc
-
---echo "Now if everything is fine the event has compiled and is locked"
-# Expect to see one session in events_test waiting for the user lock.
-select /*1*/ user, host, db, info from information_schema.processlist
-where state = 'User lock' and info = 'select get_lock(\'test_bug16407\', 60)';
-select release_lock('test_bug16407');
-# Try to avoid
-# Bug#39863 events_bugs fails sporadically on pushbuild (extra processes in I_S.PROCESSLIST)
-# which is most probably caused by
-# Bug#32782 User lock hash fails to find lock
-# "various issues related to missing or incorrect return results
-# from release_lock()."
-# Therefore we check here if the event executor is no more locked or
-# we waited >= 5 seconds for this to happen.
-let $wait_timeout= 5;
-let $wait_condition=
- select count(*) = 0 from information_schema.processlist
- where state = 'User lock' and info = 'select get_lock(\'test_bug16407\', 60)';
---source include/wait_condition.inc
-if (!`$wait_condition`)
-{
- --echo ERROR: There must be no session with
- --echo state = 'User lock' and info = 'select get_lock('test_bug16407', 60)
- --echo within the processlist.
- --echo We probably hit Bug#32782 User lock hash fails to find lock
- SELECT * FROM information_schema.processlist;
- --echo Abort
- exit;
-}
-
-set global event_scheduler= off;
-# Wait till the event scheduler and all event executors have finished their work.
---source include/check_events_off.inc
-
-select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
---echo "Let's check whether we change the sql_mode on ALTER EVENT"
-set sql_mode='traditional';
-alter event e_16407 do select 1;
-select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
-drop event e_16407;
-
-set sql_mode="ansi";
-select get_lock('ee_16407_2', 60);
-
-set global event_scheduler= 1;
---source include/running_event_scheduler.inc
---echo "Another sql_mode test"
-set sql_mode="traditional";
-create table events_smode_test(ev_name char(10), a date);
---echo "This should never insert something"
-delimiter |;
-create event ee_16407_2 on schedule every 60 second do
-begin
- select get_lock('ee_16407_2', 60); /*ee_16407_2*/
- select release_lock('ee_16407_2');
- insert into events_test.events_smode_test values('ee_16407_2','1980-19-02');
-end|
---error ER_TRUNCATED_WRONG_VALUE
-insert into events_test.events_smode_test values ('test','1980-19-02')|
---echo "This is ok"
-create event ee_16407_3 on schedule every 60 second do
-begin
- select get_lock('ee_16407_2', 60); /*ee_16407_3*/
- select release_lock('ee_16407_2');
- insert into events_test.events_smode_test values ('ee_16407_3','1980-02-19');
- insert into events_test.events_smode_test values ('ee_16407_3','1980-02-29');
-end|
-set sql_mode=""|
---echo "This will insert rows but they will be truncated"
-create event ee_16407_4 on schedule every 60 second do
-begin
- select get_lock('ee_16407_2', 60); /*ee_16407_4*/
- select release_lock('ee_16407_2');
- insert into events_test.events_smode_test values ('ee_16407_4','10-11-1956');
-end|
-delimiter ;|
-select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
-
-# We wait till we have three event executors waiting for the removal of the lock.
-let $wait_condition=
- select count(*) = 3 from information_schema.processlist
- where state = 'User lock' and info = 'select get_lock(\'ee_16407_2\', 60)';
---source include/wait_condition.inc
-
-# There is an extreme low risk that an additional event execution is just coming
-# up because
-# - the events have to be started every 60 seconds.
-# - we are just after event creation + waiting for seeing 3 locked
-# We expect to see three event executors in state 'User lock'.
-select /*2*/ user, host, db, info from information_schema.processlist
-where state = 'User lock' and info = 'select get_lock(\'ee_16407_2\', 60)';
-
-select release_lock('ee_16407_2');
-
-# Try to avoid
-# Bug#39863 events_bugs fails sporadically on pushbuild (extra processes in I_S.PROCESSLIST)
-# which is most probably caused by
-# Bug#32782 User lock hash fails to find lock
-# "various issues related to missing or incorrect return results
-# from release_lock()."
-# Therefore we check here if the event executing sessions disappeared or
-# we waited >= 5 seconds for this to happen.
-let $wait_timeout= 5;
-let $wait_condition=
- select count(*) = 0
- from information_schema.processlist
- where state = 'User lock' and info = 'select get_lock(\'ee_16407_2\', 60)';
---source include/wait_condition.inc
-if (!`$wait_condition`)
-{
- --echo ERROR: There must be no session with
- --echo state = 'User lock' and info = 'select get_lock('test_bug16407_2', 60)
- --echo within the processlist.
- --echo We probably hit Bug#32782 User lock hash fails to find lock
- SELECT * FROM information_schema.processlist;
- --echo Abort
- exit;
-}
-
-# We expect to see no event executors in state 'User lock'.
-if(!$fixed_bug41925)
-{
- --disable_warnings
-}
-select /*3*/ user, host, db, info from information_schema.processlist
-where state = 'User lock' and info = 'select get_lock(\'ee_16407_2\', 60)';
-if(!$fixed_bug41925)
-{
- --enable_warnings
-}
-
-set global event_scheduler= off;
-# Wait till the event scheduler and all event executors have finished their work.
-# Without this the next queries will give unstable results.
---source include/check_events_off.inc
-
-select * from events_test.events_smode_test order by ev_name, a;
---echo "OK, last check before we drop them"
-select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
-drop event ee_16407_2;
-drop event ee_16407_3;
-drop event ee_16407_4;
-
-
---echo "And now one last test regarding sql_mode and call of SP from an event"
-delete from events_test.events_smode_test;
-set sql_mode='ansi';
-select get_lock('ee_16407_5', 60);
-
-set global event_scheduler= on;
---source include/running_event_scheduler.inc
-
-set sql_mode='traditional';
-delimiter |;
-# ee_16407_5_pendant() should not insert anything because of invalid date.
-create procedure ee_16407_5_pendant() begin insert into events_test.events_smode_test values('ee_16407_5','2001-02-29'); end|
-create procedure ee_16407_6_pendant() begin insert into events_test.events_smode_test values('ee_16407_6','2004-02-29'); end|
-create event ee_16407_5 on schedule every 60 second do
-begin
- select get_lock('ee_16407_5', 60); /*ee_16407_5*/
- select release_lock('ee_16407_5');
- call events_test.ee_16407_5_pendant();
-end|
-create event ee_16407_6 on schedule every 60 second do
-begin
- select get_lock('ee_16407_5', 60); /*ee_16407_6*/
- select release_lock('ee_16407_5');
- call events_test.ee_16407_6_pendant();
-end|
-delimiter ;|
-
-let $wait_condition=
- select count(*) = 2 from information_schema.processlist
- where state = 'User lock' and info = 'select get_lock(\'ee_16407_5\', 60)';
---source include/wait_condition.inc
-
---echo "Should have 2 locked processes"
-select /*4*/ user, host, db, info from information_schema.processlist
-where state = 'User lock' and info = 'select get_lock(\'ee_16407_5\', 60)';
-
-select release_lock('ee_16407_5');
-
-let $wait_condition=
- select count(*) = 0 from information_schema.processlist
- where state = 'User lock' and info = 'select get_lock(\'ee_16407_5\', 60)';
---source include/wait_condition.inc
-
---echo "Should have 0 processes locked"
-if(!$fixed_bug41925)
-{
- --disable_warnings
-}
-select /*5*/ user, host, db, info from information_schema.processlist
-where state = 'User lock' and info = 'select get_lock(\'ee_16407_5\', 60)';
-if(!$fixed_bug41925)
-{
- --enable_warnings
-}
-
-# Wait till all event executors have finished their work, so that we can be sure
-# that their changes to events_smode_test are done.
---source include/no_running_events.inc
-
-select * from events_test.events_smode_test order by ev_name, a;
---echo "And here we check one more time before we drop the events"
-select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
-
-drop event ee_16407_5;
-drop event ee_16407_6;
-drop procedure ee_16407_5_pendant;
-drop procedure ee_16407_6_pendant;
-set global event_scheduler= off;
---source include/check_events_off.inc
-drop table events_smode_test;
-set sql_mode=@old_sql_mode;
-#
-# End - 16407: Events: Changes in sql_mode won't be taken into account
-#
-
-#
-# START - 18897: Events: unauthorized action possible with alter event rename
-#
-set global event_scheduler=off;
---source include/check_events_off.inc
---disable_warnings
-delete from mysql.user where User like 'mysqltest_%';
-delete from mysql.db where User like 'mysqltest_%';
-flush privileges;
-drop database if exists mysqltest_db1;
---enable_warnings
-create user mysqltest_user1@localhost;
-create database mysqltest_db1;
-grant event on events_test.* to mysqltest_user1@localhost;
-connect (conn2,localhost,mysqltest_user1,,events_test);
-create event mysqltest_user1 on schedule every 10 second do select 42;
---error ER_DBACCESS_DENIED_ERROR
-alter event mysqltest_user1 rename to mysqltest_db1.mysqltest_user1;
---echo "Let's test now rename when there is no select DB"
-disconnect conn2;
-connect (conn2,localhost,mysqltest_user1,,*NO-ONE*);
-select database();
---error ER_NO_DB_ERROR
-alter event events_test.mysqltest_user1 rename to mysqltest_user1;
-select event_schema, event_name, definer, event_type, status from information_schema.events;
-drop event events_test.mysqltest_user1;
-disconnect conn2;
-connection default;
-drop user mysqltest_user1@localhost;
-drop database mysqltest_db1;
-#
-# END - 18897: Events: unauthorized action possible with alter event rename
-#
-
-#
-# START - BUG#16394: Events: Crash if schedule contains SELECT
-#
---error ER_SUBQUERIES_NOT_SUPPORTED
-create event e_53 on schedule at (select s1 from ttx) do drop table t;
---error ER_SUBQUERIES_NOT_SUPPORTED
-create event e_53 on schedule every (select s1 from ttx) second do drop table t;
---error ER_SUBQUERIES_NOT_SUPPORTED
-create event e_53 on schedule every 5 second starts (select s1 from ttx) do drop table t;
---error ER_SUBQUERIES_NOT_SUPPORTED
-create event e_53 on schedule every 5 second ends (select s1 from ttx) do drop table t;
-#
-# END - BUG#16394: Events: Crash if schedule contains SELECT
-#
-
-#
-# START - BUG#22397: Events: crash with procedure which alters events
-#
---disable_warnings
-drop event if exists e_16;
-drop procedure if exists p_16;
---enable_warnings
-create event e_16 on schedule every 1 second do set @a=5;
-create procedure p_16 () alter event e_16 on schedule every @a second;
-set @a = null;
---error ER_WRONG_VALUE
-call p_16();
---error ER_WRONG_VALUE
-call p_16();
-set @a= 6;
-call p_16();
-
-drop procedure p_16;
-drop event e_16;
-
-#
-# START - BUG#22830 Events: crash with procedure which alters events with function
-#
---disable_warnings
-drop function if exists f22830;
-drop event if exists e22830;
-drop event if exists e22830_1;
-drop event if exists e22830_2;
-drop event if exists e22830_3;
-drop event if exists e22830_4;
-drop table if exists t1;
-drop table if exists t2;
---enable_warnings
-create table t1 (a int);
-insert into t1 values (2);
-create table t2 (a char(20));
-insert into t2 values ("e22830_1");
-create function f22830 () returns int return 5;
-
-select get_lock('ee_22830', 60);
-set global event_scheduler=on;
---source include/running_event_scheduler.inc
-
-delimiter |;
-create procedure p22830_wait()
-begin
- select get_lock('ee_22830', 60);
- select release_lock('ee_22830');
-end|
-
---error ER_SUBQUERIES_NOT_SUPPORTED
-create event e22830 on schedule every f22830() second do
-begin
- call p22830_wait();
- select 123;
-end|
-create event e22830_1 on schedule every 1 hour do
-begin
- call p22830_wait();
- alter event e22830_1 on schedule every (select 8 from dual) hour;
-end|
-create event e22830_2 on schedule every 1 hour do
-begin
- call p22830_wait();
- alter event e22830_2 on schedule every (select 8 from t1) hour;
-end|
-create event e22830_3 on schedule every 1 hour do
-begin
- call p22830_wait();
- alter event e22830_3 on schedule every f22830() hour;
-end|
-create event e22830_4 on schedule every 1 hour do
-begin
- call p22830_wait();
- alter event e22830_4 on schedule every (select f22830() from dual) hour;
-end|
-delimiter ;|
-
---echo "All events should be blocked in get_lock()"
-select event_name, event_definition, interval_value, interval_field from information_schema.events order by event_name;
-
-select release_lock('ee_22830');
-
-let $wait_condition=
- select group_concat(interval_value order by interval_value) = '1,1,1,8'
- from information_schema.events;
---source include/wait_condition.inc
-
-set global event_scheduler=off;
---source include/check_events_off.inc
-select event_name, event_definition, interval_value, interval_field from information_schema.events order by event_name;
-drop procedure p22830_wait;
-drop function f22830;
---error ER_PARSE_ERROR
-drop event (select a from t2);
-drop event e22830_1;
-drop event e22830_2;
-drop event e22830_3;
-drop event e22830_4;
-drop table t1;
-drop table t2;
-
-
-#
-# BUG#16425: Events: no DEFINER clause
-#
---error 0,ER_CANNOT_USER
-DROP USER mysqltest_u1@localhost;
-
-CREATE USER mysqltest_u1@localhost;
-GRANT EVENT ON events_test.* TO mysqltest_u1@localhost;
-
-CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
-SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
-DROP EVENT e1;
-
-CREATE DEFINER=CURRENT_USER EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
-SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
-ALTER DEFINER=mysqltest_u1@localhost EVENT e1 ON SCHEDULE EVERY 1 HOUR;
-SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
-DROP EVENT e1;
-
-CREATE DEFINER=CURRENT_USER() EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
-SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
-DROP EVENT e1;
-
-CREATE DEFINER=mysqltest_u1@localhost EVENT e1 ON SCHEDULE EVERY 1 DAY DO
- SELECT 1;
-SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
-DROP EVENT e1;
-
-connect (conn1, localhost, mysqltest_u1, , events_test);
-
-CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
-SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
-DROP EVENT e1;
-
-CREATE DEFINER=CURRENT_USER EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
-SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
---error ER_SPECIFIC_ACCESS_DENIED_ERROR
-ALTER DEFINER=root@localhost EVENT e1 ON SCHEDULE EVERY 1 HOUR;
-SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
-DROP EVENT e1;
-
-CREATE DEFINER=CURRENT_USER() EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
-SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
-DROP EVENT e1;
-
---error ER_SPECIFIC_ACCESS_DENIED_ERROR
-CREATE DEFINER=root@localhost EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
---error ER_EVENT_DOES_NOT_EXIST
-DROP EVENT e1;
-
-disconnect conn1;
-connection default;
-
-DROP USER mysqltest_u1@localhost;
-
-
-#
-# BUG#16420: Events: timestamps become UTC
-# BUG#26429: SHOW CREATE EVENT is incorrect for an event that
-# STARTS NOW()
-# BUG#26431: Impossible to re-create an event from backup if its
-# STARTS clause is in the past
-# WL#3698: Events: execution in local time zone
-#
-# Here we only check non-concurrent aspects of the patch.
-# For the actual tests of time zones please see events_time_zone.test
-#
-SET GLOBAL EVENT_SCHEDULER= OFF;
---source include/check_events_off.inc
-SET @save_time_zone= @@TIME_ZONE;
-
-#----------------------------------------------------------------------
-
-# We will use a separate connection because SET TIMESTAMP will stop
-# the clock in that connection.
-
-SET TIME_ZONE= '+00:00';
-SET TIMESTAMP= UNIX_TIMESTAMP('2005-12-31 23:58:59');
-
-
-# Test when event time zone is updated on ALTER EVENT.
-#
-
-CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
-SHOW EVENTS;
-
-# Test storing and updating of the event time zone.
-#
-SET TIME_ZONE= '-01:00';
-ALTER EVENT e1 ON SCHEDULE EVERY 1 DAY STARTS '2000-01-01 00:00:00';
-SHOW EVENTS;
-
-# This will update event time zone.
-SET TIME_ZONE= '+02:00';
-ALTER EVENT e1 ON SCHEDULE AT '2000-01-02 00:00:00'
- ON COMPLETION PRESERVE DISABLE;
-SHOW EVENTS;
-
-# This will update event time zone.
-SET TIME_ZONE= '-03:00';
-ALTER EVENT e1 ON SCHEDULE EVERY 1 DAY ENDS '2030-01-03 00:00:00'
- ON COMPLETION PRESERVE DISABLE;
-SHOW EVENTS;
-
-# This will not update event time zone, as no time is being adjusted.
-SET TIME_ZONE= '+04:00';
-ALTER EVENT e1 DO SELECT 2;
-SHOW EVENTS;
-
-DROP EVENT e1;
-
-#----------------------------------------------------------------------
-
-# Create some events.
-SET TIME_ZONE='+05:00';
-CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' DO
- SELECT 1;
-
-SET TIMESTAMP= @@TIMESTAMP + 1;
-
-SET TIME_ZONE='-05:00';
-CREATE EVENT e2 ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' DO
- SELECT 1;
-
-SET TIMESTAMP= @@TIMESTAMP + 1;
-
-SET TIME_ZONE='+00:00';
-CREATE EVENT e3 ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' DO
- SELECT 1;
-
-
-# Test INFORMATION_SCHEMA.EVENTS.
-#
-
-SELECT * FROM INFORMATION_SCHEMA.EVENTS ORDER BY event_name;
-
-
-# Test SHOW EVENTS.
-#
-
-SHOW EVENTS;
-
-
-# Test SHOW CREATE EVENT.
-#
-
-SHOW CREATE EVENT e1;
-SHOW CREATE EVENT e2;
-SHOW CREATE EVENT e3;
-
-#----------------------------------------------------------------------
-
-# Test times in the past.
-#
-
---echo The following should fail, and nothing should be altered.
-
---error ER_EVENT_CANNOT_ALTER_IN_THE_PAST
-ALTER EVENT e1 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'
- ENDS '1999-01-02 00:00:00';
-
---error ER_EVENT_CANNOT_ALTER_IN_THE_PAST
-ALTER EVENT e1 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'
- ENDS '1999-01-02 00:00:00' DISABLE;
-
---echo The following should give warnings, and nothing should be created.
-
-CREATE EVENT e4 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'
- ENDS '1999-01-02 00:00:00'
-DO
- SELECT 1;
-
-CREATE EVENT e4 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'
- ENDS '1999-01-02 00:00:00' DISABLE
-DO
- SELECT 1;
-
-CREATE EVENT e4 ON SCHEDULE AT '1999-01-01 00:00:00' DO
- SELECT 1;
-
-CREATE EVENT e4 ON SCHEDULE AT '1999-01-01 00:00:00' DISABLE
-DO
- SELECT 1;
-
-SHOW EVENTS;
-
---echo The following should succeed giving a warning.
-
-ALTER EVENT e1 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'
- ENDS '1999-01-02 00:00:00' ON COMPLETION PRESERVE;
-
-CREATE EVENT e4 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'
- ENDS '1999-01-02 00:00:00' ON COMPLETION PRESERVE
-DO
- SELECT 1;
-
-CREATE EVENT e5 ON SCHEDULE AT '1999-01-01 00:00:00'
- ON COMPLETION PRESERVE
-DO
- SELECT 1;
-
---echo The following should succeed without warnings.
-
-ALTER EVENT e2 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00';
-
-ALTER EVENT e3 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'
- ENDS '1999-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE;
-
-CREATE EVENT e6 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00' DO
- SELECT 1;
-
-CREATE EVENT e7 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'
- ENDS '1999-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE
-DO
- SELECT 1;
-
-CREATE EVENT e8 ON SCHEDULE AT '1999-01-01 00:00:00'
- ON COMPLETION PRESERVE DISABLE
-DO
- SELECT 1;
-
-SHOW EVENTS;
-
-
-DROP EVENT e8;
-DROP EVENT e7;
-DROP EVENT e6;
-DROP EVENT e5;
-DROP EVENT e4;
-DROP EVENT e3;
-DROP EVENT e2;
-DROP EVENT e1;
-
-SET TIME_ZONE=@save_time_zone;
-SET TIMESTAMP=DEFAULT;
-
-#
-# START - BUG#28666 CREATE EVENT ... EVERY 0 SECOND let server crash
-#
---disable_warnings
-drop event if exists new_event;
---enable_warnings
---error ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG
-CREATE EVENT new_event ON SCHEDULE EVERY 0 SECOND DO SELECT 1;
---error ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG
-CREATE EVENT new_event ON SCHEDULE EVERY (SELECT 0) SECOND DO SELECT 1;
---error ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG
-CREATE EVENT new_event ON SCHEDULE EVERY "abcdef" SECOND DO SELECT 1;
---error ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG
-CREATE EVENT new_event ON SCHEDULE EVERY "0abcdef" SECOND DO SELECT 1;
---error ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG
-CREATE EVENT new_event ON SCHEDULE EVERY "a1bcdef" SECOND DO SELECT 1;
-
---error ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG
-CREATE EVENT new_event ON SCHEDULE EVERY (SELECT "abcdef" UNION SELECT "abcdef") SECOND DO SELECT 1;
---error ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG
-CREATE EVENT new_event ON SCHEDULE EVERY (SELECT "0abcdef") SECOND DO SELECT 1;
---error ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG
-CREATE EVENT new_event ON SCHEDULE EVERY (SELECT "a1bcdef") SECOND DO SELECT 1;
-
---error ER_WRONG_VALUE
-CREATE EVENT new_event ON SCHEDULE AT "every day" DO SELECT 1;
---error ER_WRONG_VALUE
-CREATE EVENT new_event ON SCHEDULE AT "0every day" DO SELECT 1;
---error ER_WRONG_VALUE
-CREATE EVENT new_event ON SCHEDULE AT (SELECT "every day") DO SELECT 1;
-
---error ER_PARSE_ERROR
-CREATE EVENT new_event ON SCHEDULE AT NOW() STARTS NOW() DO SELECT 1;
---error ER_PARSE_ERROR
-CREATE EVENT new_event ON SCHEDULE AT NOW() ENDS NOW() DO SELECT 1;
---error ER_PARSE_ERROR
-CREATE EVENT new_event ON SCHEDULE AT NOW() STARTS NOW() ENDS NOW() DO SELECT 1;
-
-#
-# START - BUG#28924 If I drop the user who is the definer of an active event
-# then server cores
-#
-let $engine=MyISAM;
-USE test;
-SHOW GRANTS FOR CURRENT_USER;
-SET GLOBAL event_scheduler = ON;
---source include/running_event_scheduler.inc
-eval
-CREATE TABLE events_test.event_log
-(id int KEY AUTO_INCREMENT, ev_nm char(40), ev_cnt int, ev_tm timestamp)
-ENGINE=$engine;
-SET autocommit=0;
-CREATE USER evtest1@localhost;
-SET PASSWORD FOR evtest1@localhost = password('ev1');
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM evtest1@localhost;
-GRANT create, insert, select, event ON events_test.* TO evtest1@localhost;
-GRANT select,insert ON test.* TO evtest1@localhost;
-SHOW GRANTS FOR evtest1@localhost;
-
---replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK
-connect (e1,localhost,evtest1,ev1,events_test,$MASTER_MYPORT,$MASTER_MYSOCK);
-DELIMITER |;
-CREATE EVENT ev_sched_1823 ON SCHEDULE EVERY 2 SECOND
-DO BEGIN
- SET AUTOCOMMIT = 0;
- SET @evname = 'ev_sched_1823';
- SET @cnt = 0;
- SELECT COUNT(*) INTO @cnt FROM events_test.event_log WHERE ev_nm = @evname;
- IF @cnt < 6 THEN
- INSERT INTO events_test.event_log VALUES (NULL,@evname,@cnt+1,current_timestamp());
- COMMIT;
- END IF;
- SELECT COUNT(*) INTO @cnt FROM events_test.event_log WHERE ev_nm = @evname;
- IF @cnt < 6 THEN
- INSERT INTO events_test.event_log VALUES (NULL,@evname,@cnt+1,current_timestamp());
- ROLLBACK;
- END IF;
-END;|
-DELIMITER ;|
-# 1. Show that the new created event is runnable and gets executed within a
-# reasonable time like 4 seconds. Till ~ 2 seconds could pass on a heavy
-# loaded testing box before something gets executed).
-# Detection of execution is via the records inserted by the event.
---echo Sleep till the first INSERT into events_test.event_log occurred
-let $wait_timeout= 4;
-let $wait_condition=
-SELECT COUNT(*) > 0 FROM events_test.event_log;
---source include/wait_condition.inc
-SELECT COUNT(*) > 0 AS "Expect 1" FROM events_test.event_log;
-#
-connection default;
-DROP USER evtest1@localhost;
-# 2. If we meet BUG#28924 again than a server crash happens within the next
-# few seconds
-# 3. Check that the event is never executed again
-# It could be that an event execution was running before the DROP USER
-# and all implicite actions belonging to this are completed.
-# Lets assume that ~ 4 seconds waiting are enough for the event
-# scheduler to detect that
---echo Sleep 4 seconds
-sleep 4;
-SELECT COUNT(*) INTO @row_cnt FROM events_test.event_log;
-# Give the event mechanism ~ 4 seconds to do something wrong
-# (execute the event of the dropped user -> inser rows).
---echo Sleep 4 seconds
-sleep 4;
-SELECT COUNT(*) > @row_cnt AS "Expect 0" FROM events_test.event_log;
-#
-# Cleanup
-disconnect e1;
-DROP EVENT events_test.ev_sched_1823;
-DROP TABLE events_test.event_log;
-SET GLOBAL event_scheduler = OFF;
---source include/check_events_off.inc
-
-
-#
-# Bug#28641 CREATE EVENT with '2038.01.18 03:00:00' let server crash.
-#
-SET GLOBAL event_scheduler= ON;
---source include/running_event_scheduler.inc
-DELIMITER |;
-CREATE EVENT bug28641 ON SCHEDULE AT '2038.01.18 03:00:00'
-DO BEGIN
- SELECT 1;
-END;|
-
-DELIMITER ;|
-SET GLOBAL event_scheduler= OFF;
---source include/check_events_off.inc
-DROP EVENT bug28641;
-
-###########################################################################
-
---echo
---echo #####################################################################
---echo #
---echo # BUG#31111: --read-only crashes MySQL (events fail to load).
---echo #
---echo #####################################################################
---echo
-
---error 0,ER_CANNOT_USER
-DROP USER mysqltest_u1@localhost;
-
---disable_warnings
-DROP EVENT IF EXISTS e1;
-DROP EVENT IF EXISTS e2;
---enable_warnings
-
---echo
-
-# Check that an ordinary user can not create/update/drop events in the
-# read-only mode.
-
-GRANT EVENT ON *.* TO mysqltest_u1@localhost;
-
---echo
-
-SET GLOBAL READ_ONLY = 1;
-
---echo
-
---connect(u1_con,localhost,mysqltest_u1,,events_test)
-
---echo
-
---error ER_OPTION_PREVENTS_STATEMENT
-CREATE EVENT e1 ON SCHEDULE AT '2020-01-01 00:00:00' DO SET @a = 1;
-
---echo
-
---error ER_OPTION_PREVENTS_STATEMENT
-ALTER EVENT e1 COMMENT 'comment';
-
---echo
-
---error ER_OPTION_PREVENTS_STATEMENT
-DROP EVENT e1;
-
---echo
-
-# Check that the super user still can create/update/drop events.
-
---connect(root_con,localhost,root,,events_test)
-
---echo
-
-CREATE EVENT e1 ON SCHEDULE AT '2020-01-01 00:00:00' DO SET @a = 1;
-
---echo
-
-ALTER EVENT e1 COMMENT 'comment';
-
---echo
-
-DROP EVENT e1;
-
---echo
-
-#
-# Switch to read-write mode; create test events under the user mysqltest_u1;
-# switch back to read-only mode.
-#
-
-SET GLOBAL READ_ONLY = 0;
-
---echo
-
---connection u1_con
-
---echo
-
-CREATE EVENT e1 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND DO SET @a = 1;
-CREATE EVENT e2 ON SCHEDULE EVERY 1 SECOND DO SET @a = 1;
-
---echo
-
-SELECT
- event_name,
- last_executed IS NULL,
- definer
-FROM INFORMATION_SCHEMA.EVENTS
-WHERE event_schema = 'events_test';
-
---echo
-
---connection root_con
-
---echo
-
-SET GLOBAL READ_ONLY = 1;
-
-# Check that the event scheduler is able to update event.
-
---echo
-
-SET GLOBAL EVENT_SCHEDULER = ON;
---source include/running_event_scheduler.inc
-
---echo
-
---echo # Waiting for the event scheduler to execute and drop event e1...
-
-let $wait_timeout = 4;
-let $wait_condition =
- SELECT COUNT(*) = 0
- FROM INFORMATION_SCHEMA.EVENTS
- WHERE event_schema = 'events_test' AND event_name = 'e1';
---source include/wait_condition.inc
-
---echo
-
---echo # Waiting for the event scheduler to execute and update event e2...
-
-let $wait_condition =
- SELECT last_executed IS NOT NULL
- FROM INFORMATION_SCHEMA.EVENTS
- WHERE event_schema = 'events_test' AND event_name = 'e2';
---source include/wait_condition.inc
-
---echo
-
-SET GLOBAL EVENT_SCHEDULER = OFF;
---source include/check_events_off.inc
-
---echo
-
-SELECT
- event_name,
- last_executed IS NULL,
- definer
-FROM INFORMATION_SCHEMA.EVENTS
-WHERE event_schema = 'events_test';
-
---echo
-
---error ER_EVENT_DOES_NOT_EXIST
-DROP EVENT e1;
-
---echo
---echo # Cleanup.
---echo
-
-DROP EVENT e2;
-
---echo
-
-SET GLOBAL READ_ONLY = 0;
-
---echo
-
---disconnect u1_con
---disconnect root_con
---connection default
-
---echo
-
-DROP USER mysqltest_u1@localhost;
-
---echo
---echo #####################################################################
---echo #
---echo # End of BUG#31111.
---echo #
---echo #####################################################################
---echo
-
-#
-# Bug#32633 Can not create any routine if SQL_MODE=no_engine_substitution
-#
-# Ensure that when new SQL modes are introduced, they are also added to
-# the mysql.event table.
-#
-
---disable_warnings
-drop procedure if exists p;
---enable_warnings
-set @old_mode= @@sql_mode;
-set @@sql_mode= cast(pow(2,32)-1 as unsigned integer);
-create event e1 on schedule every 1 day do select 1;
-select @@sql_mode into @full_mode;
-set @@sql_mode= @old_mode;
-select replace(@full_mode, 'ALLOW_INVALID_DATES', 'INVALID_DATES') into @full_mode;
-select name from mysql.event where name = 'e1' and sql_mode = @full_mode;
-drop event e1;
-
-#
-# Bug#36540: CREATE EVENT and ALTER EVENT statements fail with large server_id
-#
-
-SET @old_server_id = @@GLOBAL.server_id;
-SET GLOBAL server_id = (1 << 32) - 1;
-SELECT @@GLOBAL.server_id;
-CREATE EVENT ev1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
-SELECT event_name, originator FROM INFORMATION_SCHEMA.EVENTS;
-DROP EVENT ev1;
-SET GLOBAL server_id = @old_server_id;
-
-#
-# Bug#11751148: show events shows events in other schema
-#
-
-CREATE DATABASE event_test12;
-USE event_test12;
-CREATE EVENT ev1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
-CREATE DATABASE event_test1;
-USE event_test1;
-# Following show events should not show ev1
-SHOW EVENTS;
-DROP DATABASE event_test1;
-DROP DATABASE event_test12;
-
---echo #
---echo # Bug#12546938 (formerly known as bug#61005):
---echo # CREATE IF NOT EXIST EVENT WILL CREATE MULTIPLE RUNNING EVENTS
---echo #
-USE events_test;
-SET GLOBAL event_scheduler = ON;
-
---disable_warnings
-DROP TABLE IF EXISTS table_bug12546938;
-DROP EVENT IF EXISTS event_Bug12546938;
---enable_warnings
-CREATE TABLE table_bug12546938 (i INT);
-
-delimiter |;
-
---echo # Create an event which will be executed with a small delay
---echo # and won't be automatically dropped after that.
-CREATE EVENT event_Bug12546938
-ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND ON COMPLETION PRESERVE
-ENABLE DO
-BEGIN
- INSERT INTO table_bug12546938 VALUES(1);
-END
-|
-
---echo # Now try to create the same event using CREATE EVENT IF NOT EXISTS.
---echo # A warning should be emitted. A new event should not be created nor
---echo # the old event should be re-executed.
-CREATE EVENT IF NOT EXISTS event_bug12546938
-ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND ON COMPLETION PRESERVE
-ENABLE DO
-BEGIN
- INSERT INTO table_bug12546938 VALUES (1);
-END
-|
-
-delimiter ;|
-
---echo # Wait until at least one instance of event is executed.
-let $wait_condition= SELECT COUNT(*) FROM table_bug12546938;
---source include/wait_condition.inc
-
---echo # Check that only one instance of our event was executed.
-SELECT COUNT(*) FROM table_bug12546938;
-
---echo # Clean-up.
-DROP EVENT IF EXISTS event_Bug12546938;
-DROP TABLE table_bug12546938;
-SET GLOBAL EVENT_SCHEDULER = OFF;
-
-#
-# Bug#11764334 - 57156: ALTER EVENT CHANGES THE EVENT STATUS
-#
---disable_warnings
-DROP DATABASE IF EXISTS event_test11764334;
---enable_warnings
-CREATE DATABASE event_test11764334;
-USE event_test11764334;
-CREATE EVENT ev1 ON SCHEDULE EVERY 3 SECOND DISABLE DO SELECT 1;
---replace_column 9 # 10 #
-SHOW EVENTS IN event_test11764334 WHERE NAME='ev1';
-ALTER EVENT ev1 ON SCHEDULE EVERY 4 SECOND;
---replace_column 9 # 10 #
-SHOW EVENTS IN event_test11764334 WHERE NAME='ev1';
-DROP EVENT ev1;
-DROP DATABASE event_test11764334;
-USE test;
-###########################################################################
-#
-# End of tests
-#
-# !!! KEEP this section AT THE END of this file !!!
-#
-###########################################################################
-
-# Ensure that all event executors have finished their work and cannot harm
-# the next test.
---source include/no_running_events.inc
-
-DROP DATABASE events_test;
-# Restore the original state i.e to how it was when test started
-# (option with no argument in events_bugs-master.opt turns the scheduler on).
-SET GLOBAL event_scheduler= 'ON';
---source include/running_event_scheduler.inc
-SET @@global.concurrent_insert= @concurrent_insert;
-# THIS MUST BE THE LAST LINE in this file.
diff --git a/mysql-test/t/events_embedded.test b/mysql-test/t/events_embedded.test
deleted file mode 100644
index 9922ea6dfee..00000000000
--- a/mysql-test/t/events_embedded.test
+++ /dev/null
@@ -1,5 +0,0 @@
---source include/is_embedded.inc
-
---error 1193
-set global event_scheduler=ON;
-
diff --git a/mysql-test/t/events_grant.test b/mysql-test/t/events_grant.test
deleted file mode 100644
index 8db4333cc03..00000000000
--- a/mysql-test/t/events_grant.test
+++ /dev/null
@@ -1,113 +0,0 @@
-# Can't test with embedded server that doesn't support grants
--- source include/not_embedded.inc
-
-CREATE DATABASE IF NOT EXISTS events_test;
-use events_test;
-#
-# Events grants test begin
-#
-CREATE EVENT one_event ON SCHEDULE EVERY 10 SECOND DO SELECT 123;
---replace_column 8 # 9 #
-SHOW EVENTS;
-SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
-CREATE DATABASE events_test2;
-CREATE USER ev_test@localhost;
-GRANT ALL ON events_test.* to ev_test@localhost;
-GRANT ALL ON events_test2.* to ev_test@localhost;
-REVOKE EVENT ON events_test2.* FROM ev_test@localhost;
-#now we are on con1
-connect (ev_con1,localhost,ev_test,,events_test2);
-select "NEW CONNECTION";
-SELECT USER(), DATABASE();
-SHOW GRANTS;
---echo "Here comes an error:";
-#NO EVENT_ACL on events_test2
---error 1044
-SHOW EVENTS;
-USE events_test;
---echo "We should see one event";
---replace_column 8 # 9 #
-SHOW EVENTS;
-#now create an event with the same name but we are different user
-SELECT CONCAT("Let's create some new events from the name of ", USER());
---error ER_EVENT_ALREADY_EXISTS
-CREATE EVENT one_event ON SCHEDULE EVERY 20 SECOND DO SELECT 123;
-CREATE EVENT two_event ON SCHEDULE EVERY 20 SECOND ON COMPLETION NOT PRESERVE COMMENT "two event" DO SELECT 123;
-CREATE EVENT three_event ON SCHEDULE EVERY 20 SECOND ON COMPLETION PRESERVE COMMENT "three event" DO SELECT 123;
-
---echo "Now we should see 3 events:";
---replace_column 8 # 9 #
-SHOW EVENTS;
-
---echo "This should show us only 2 events:";
---replace_column 8 # 9 #
-SHOW EVENTS LIKE 't%event';
-
---echo "This should show us no events:";
---replace_column 8 # 9 #
-SHOW EVENTS FROM test LIKE '%';
-#ok, we are back
-connection default;
-GRANT EVENT ON events_test2.* TO ev_test@localhost;
-connection ev_con1;
-USE events_test2;
-CREATE EVENT four_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42;
-connection default;
-USE events_test;
---echo "We should see 4 events : one_event, two_event, three_event & four_event"
-SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
-DROP DATABASE events_test2;
---echo "We should see 3 events : one_event, two_event, three_event"
-SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
-
-connection default;
-CREATE DATABASE events_test2;
-USE events_test2;
-CREATE EVENT five_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42;
-
-connection ev_con1;
---echo "Should see 4 events - one, two, three & five"
-SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
-connection default;
-REVOKE EVENT ON events_test2.* FROM ev_test@localhost;
-connection ev_con1;
-USE test;
---echo "Should see 3 events - one, two & three"
-SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
---echo "Let's test ALTER EVENT which changes the definer"
-USE events_test;
-ALTER EVENT one_event ON SCHEDULE EVERY 10 SECOND;
---echo "The definer should be ev_test@localhost"
-SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
-connection default;
-USE events_test;
-ALTER EVENT one_event COMMENT "comment";
-connection ev_con1;
---echo "The definer should be root@localhost"
-SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
-ALTER EVENT one_event DO SELECT 12;
---echo "The definer should be ev_test@localhost"
-SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
-connection default;
---echo "make the definer again root@localhost"
-ALTER EVENT one_event COMMENT "new comment";
-connection ev_con1;
---echo "test DROP by another user"
-DROP EVENT one_event;
-connection default;
---echo "One event should not be there"
-SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
-connection ev_con1;
-disconnect ev_con1;
---source include/wait_until_disconnected.inc
-connection default;
-DROP USER ev_test@localhost;
-DROP DATABASE events_test2;
-
-#
-# End of tests
-#
-
---source include/check_events_off.inc
-
-DROP DATABASE events_test;
diff --git a/mysql-test/t/events_logs_tests-master.opt b/mysql-test/t/events_logs_tests-master.opt
deleted file mode 100644
index 73d26b7260d..00000000000
--- a/mysql-test/t/events_logs_tests-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---slow-query-log --log-output=table --general-log --general-log-file="" --slow-query-log-file=""
diff --git a/mysql-test/t/events_logs_tests.test b/mysql-test/t/events_logs_tests.test
deleted file mode 100644
index c3bbff90723..00000000000
--- a/mysql-test/t/events_logs_tests.test
+++ /dev/null
@@ -1,90 +0,0 @@
-# Can't test with embedded server that doesn't support grants
--- source include/not_embedded.inc
-
---disable_warnings
-drop database if exists events_test;
---enable_warnings
-create database if not exists events_test;
-use events_test;
---echo
---echo We use procedure here because its statements won't be
---echo logged into the general log. If we had used normal select
---echo that are logged in different ways depending on whether the
---echo test suite is run in normal mode or with --ps-protocol
---echo
-delimiter |;
-create procedure select_general_log()
-begin
- select user_host, argument from mysql.general_log
- where argument like '%events_logs_test%';
-end|
-delimiter ;|
---echo
---echo Check that general query log works, but sub-statements
---echo of the stored procedure do not leave traces in it.
---echo
-truncate mysql.general_log;
-# Logging format in ps protocol is slightly different
---disable_ps_protocol
-select 'events_logs_tests' as outside_event;
---enable_ps_protocol
---replace_column 1 USER_HOST
-call select_general_log();
---echo
---echo Check that unlike sub-statements of stored procedures,
---echo sub-statements of events are present in the general log.
---echo
-set global event_scheduler=on;
-truncate mysql.general_log;
-create event ev_log_general on schedule at now() on completion not preserve do select 'events_logs_test' as inside_event;
---let $wait_condition=select count(*)=0 from information_schema.events where event_name='ev_log_general'
---source include/wait_condition.inc
---replace_column 1 USER_HOST
-call select_general_log();
-
---echo
---echo Check slow query log
---echo
---echo Ensure that slow logging is on
-show variables like 'slow_query_log';
---echo
---echo Demonstrate that session value has no effect
---echo
-set @@session.long_query_time=1;
-set @@global.long_query_time=300;
-truncate mysql.slow_log;
-create event ev_log_general on schedule at now() on completion not preserve
- do select 'events_logs_test' as inside_event, sleep(1.5);
---let $wait_condition=select count(*)=0 from information_schema.events where event_name='ev_log_general'
---source include/wait_condition.inc
---echo
---echo Nothing should be logged
---echo
---replace_column 1 USER_HOST
-select user_host, db, sql_text from mysql.slow_log
- where sql_text like 'select \'events_logs_test\'%';
-set @@global.long_query_time=1;
-truncate mysql.slow_log;
-create event ev_log_general on schedule at now() on completion not preserve
- do select 'events_logs_test' as inside_event, sleep(1.5);
---let $wait_condition=select count(*)=0 from information_schema.events where event_name='ev_log_general'
---source include/wait_condition.inc
---echo
---echo Event sub-statement should be logged.
---echo
---replace_column 1 USER_HOST
-select user_host, db, sql_text from mysql.slow_log
- where sql_text like 'select \'events_logs_test\'%';
-
-drop database events_test;
-set global event_scheduler=off;
-set @@global.long_query_time=default;
-set @@session.long_query_time=default;
-
-#
-# Safety
-#
-let $wait_condition=
- select count(*) = 0 from information_schema.processlist
- where db='events_test' and command = 'Connect' and user=current_user();
---source include/wait_condition.inc
diff --git a/mysql-test/t/events_microsec.test b/mysql-test/t/events_microsec.test
deleted file mode 100644
index 3e9abf6ec56..00000000000
--- a/mysql-test/t/events_microsec.test
+++ /dev/null
@@ -1,21 +0,0 @@
-# Can't test with embedded server that doesn't support grants
--- source include/not_embedded.inc
-
---disable_warnings
-create database if not exists events_test;
---enable_warnings
-
-use events_test;
-
---error ER_NOT_SUPPORTED_YET
-CREATE EVENT micro_test ON SCHEDULE EVERY 100 MICROSECOND DO SELECT 1;
---error ER_NOT_SUPPORTED_YET
-CREATE EVENT micro_test ON SCHEDULE EVERY 100 DAY_MICROSECOND DO SELECT 1;
---error ER_NOT_SUPPORTED_YET
-CREATE EVENT micro_test ON SCHEDULE EVERY 100 HOUR_MICROSECOND DO SELECT 1;
---error ER_NOT_SUPPORTED_YET
-CREATE EVENT micro_test ON SCHEDULE EVERY 100 MINUTE_MICROSECOND DO SELECT 1;
---error ER_NOT_SUPPORTED_YET
-CREATE EVENT micro_test ON SCHEDULE EVERY 100 SECOND_MICROSECOND DO SELECT 1;
-
-drop database events_test;
diff --git a/mysql-test/t/events_restart-master.opt b/mysql-test/t/events_restart-master.opt
deleted file mode 100644
index f93413a61e5..00000000000
--- a/mysql-test/t/events_restart-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---event-scheduler
diff --git a/mysql-test/t/events_restart.test b/mysql-test/t/events_restart.test
deleted file mode 100644
index 7f01859e059..00000000000
--- a/mysql-test/t/events_restart.test
+++ /dev/null
@@ -1,141 +0,0 @@
-# Can't test with embedded server that doesn't support grants
--- source include/not_embedded.inc
-
-call mtr.add_suppression("Column count of mysql.event is wrong. Expected .*, found .*\. The table is probably corrupted");
-
-#
-# Test that when the server is restarted, it checks mysql.event table,
-# and disables the scheduler if it's not up to date.
-#
-
-# Switch off the scheduler for now.
-set global event_scheduler=off;
-
---disable_warnings
-drop database if exists events_test;
---enable_warnings
-create database events_test;
-use events_test;
-create table execution_log(name char(10));
-
-create event abc1 on schedule every 1 second do
- insert into execution_log value('abc1');
-create event abc2 on schedule every 1 second do
- insert into execution_log value('abc2');
-create event abc3 on schedule every 1 second do
- insert into execution_log value('abc3');
-#
-# There are various conditions when a server would regard mysql.event
-# table as damaged:
-# - the table has more column than specified in the compiled in value, but
-# the version of the server which created the table is the same
-# - the column count in the table is less than the compiled in value
-# - some column has an incompatible type specification (for what is an
-# incompatible type specification please refer to the comments in the source
-#
-# Unfortunately, in order to test a condition, we need to restart the
-# server. Therefore, here we test only one simple case: changing the data
-# type of the 'body' field to blob.
-#
-# First, let's do a backup to not depend on actual definition of mysql.event
-create table event_like like mysql.event;
-insert into event_like select * from mysql.event;
-# Now let's alter the table and restart the server
-alter table mysql.event
- change column body body longtext character set utf8 collate utf8_bin;
---echo "Now we restart the server"
-
---source include/restart_mysqld.inc
-
-use events_test;
-# Event scheduler should be disabled: the system tables are damaged
-select @@event_scheduler;
-# Try various Event Scheduler operation and check the output.
---error ER_EVENTS_DB_ERROR
-show events;
---error ER_EVENTS_DB_ERROR
-select event_name from information_schema.events;
---error ER_EVENTS_DB_ERROR
-show create event intact_check;
---error ER_EVENTS_DB_ERROR
-drop event no_such_event;
---error ER_EVENTS_DB_ERROR
-create event intact_check_1 on schedule every 5 hour do select 5;
---error ER_EVENTS_DB_ERROR
-alter event intact_check_1 on schedule every 8 hour do select 8;
---error ER_EVENTS_DB_ERROR
-alter event intact_check_1 rename to intact_check_2;
---error ER_EVENTS_DB_ERROR
-drop event intact_check_1;
---error ER_EVENTS_DB_ERROR
-drop event intact_check_2;
---error ER_EVENTS_DB_ERROR
-drop event intact_check;
---error ER_STARTUP
-set global event_scheduler=on;
---error ER_STARTUP
-set global event_scheduler=off;
-show variables like 'event_scheduler';
---echo Make sure that we still can create and drop databases,
---echo and no warnings are produced.
-drop database if exists mysqltest_database_not_exists;
-create database mysqltest_db1;
-drop database mysqltest_db1;
---echo Restore the original mysql.event table
-drop table mysql.event;
-rename table event_like to mysql.event;
-
---echo check that we can now enable events without restart
-set global event_scheduler=original;
-select @@global.event_scheduler;
-set global event_scheduler=on;
-select @@global.event_scheduler;
---sorted_result
---replace_column 6 # 9 # 10 #
-show events;
-
---echo Now let's restart the server again
-
---source include/restart_mysqld.inc
-
-# We need this file primarily to make sure that the scheduler is restarted
-# and enabled after we have restored mysql.event table.
-# This is the final step of the "cleanup".
-#
-# Make sure also that events are executed OK after restart, just in case.
-use events_test;
-# Make sure the scheduler was started successfully
-select @@event_scheduler;
-let $wait_condition=select count(distinct name)=3 from execution_log;
---source include/wait_condition.inc
-drop table execution_log;
-# Will drop all events
-drop database events_test;
-
-let $wait_condition=
- select count(*) = 0 from information_schema.processlist
- where db='events_test' and command = 'Connect' and user=current_user();
---source include/wait_condition.inc
-
---echo #
---echo # Test for bug#11748899 -- EVENT SET TO DISABLED AND ON COMPLETION
---echo # NOT PRESERVE IS DELETED AT SERVER
---echo #
-SELECT @@event_scheduler;
-USE test;
---disable_warnings
-DROP EVENT IF EXISTS e1;
---enable_warnings
-CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND DISABLE DO SELECT 1;
---replace_column 6 # 9 # 10 #
-SHOW EVENTS;
-
---echo "Now we restart the server"
---source include/restart_mysqld.inc
-USE test;
-SELECT @@event_scheduler;
---replace_column 6 # 9 # 10 #
-SHOW EVENTS;
-DROP EVENT e1;
-
---echo # end test for bug#11748899
diff --git a/mysql-test/t/events_scheduling.test b/mysql-test/t/events_scheduling.test
deleted file mode 100644
index 5f16f8bea6a..00000000000
--- a/mysql-test/t/events_scheduling.test
+++ /dev/null
@@ -1,148 +0,0 @@
-# Can't test with embedded server that doesn't support events
--- source include/not_embedded.inc
-
-CREATE DATABASE IF NOT EXISTS events_test;
-USE events_test;
-
-SET @event_scheduler=@@global.event_scheduler;
-SET GLOBAL event_scheduler=OFF;
---echo Try again to make sure it's allowed
-SET GLOBAL event_scheduler=OFF;
-SHOW VARIABLES LIKE 'event_scheduler';
-SET GLOBAL event_scheduler=1;
-SHOW VARIABLES LIKE 'event_scheduler';
-SET GLOBAL event_scheduler=0;
-SHOW VARIABLES LIKE 'event_scheduler';
-SET GLOBAL event_scheduler=ON;
---echo Try again to make sure it's allowed
-SET GLOBAL event_scheduler=ON;
-SHOW VARIABLES LIKE 'event_scheduler';
---error ER_WRONG_VALUE_FOR_VAR
-SET GLOBAL event_scheduler=DISABLED;
-SHOW VARIABLES LIKE 'event_scheduler';
---error ER_WRONG_VALUE_FOR_VAR
-SET GLOBAL event_scheduler=-1;
-SHOW VARIABLES LIKE 'event_scheduler';
---error ER_WRONG_VALUE_FOR_VAR
-SET GLOBAL event_scheduler=2;
-SHOW VARIABLES LIKE 'event_scheduler';
---error ER_WRONG_VALUE_FOR_VAR
-SET GLOBAL event_scheduler=5;
-SHOW VARIABLES LIKE 'event_scheduler';
-
-CREATE TABLE table_1(a int);
-CREATE TABLE table_2(a int);
-CREATE TABLE table_3(a int);
-CREATE TABLE table_4(a int);
-
-SET GLOBAL event_scheduler=ON;
-# We need to have 2 to make it safe with valgrind. This is probably because
-# of when we calculate the timestamp value
-CREATE EVENT event_1 ON SCHEDULE EVERY 2 SECOND
-DO
- INSERT INTO table_1 VALUES (1);
-
-CREATE EVENT event_2 ON SCHEDULE EVERY 1 SECOND
-ENDS NOW() + INTERVAL 6 SECOND
-ON COMPLETION PRESERVE
-DO
- INSERT INTO table_2 VALUES (1);
-
-CREATE EVENT event_3 ON SCHEDULE EVERY 2 SECOND ENDS NOW() + INTERVAL 1 SECOND
-ON COMPLETION NOT PRESERVE
-DO
- INSERT INTO table_3 VALUES (1);
-
-CREATE EVENT event_4 ON SCHEDULE EVERY 1 SECOND ENDS NOW() + INTERVAL 1 SECOND
-ON COMPLETION PRESERVE
-DO
- INSERT INTO table_4 VALUES (1);
-
-# Let event_1 insert at least 4 records into the table
-let $wait_condition=select count(*) >= 4 from table_1;
---source include/wait_condition.inc
-# Minimum of passed time is 6 seconds assuming
-# - event executions starts immediate after creation
-# - 4 times event_1 means an insert at ect, ect+2, ect+4, ect+6
-# ect = event creation time
-
-# Let event_2 reach the end of its execution interval
-let $wait_condition=select count(*) = 0 from information_schema.events
-where event_name='event_2' and status='enabled';
---source include/wait_condition.inc
-# Minimum of passed time is 6 seconds.
-# See wait_condition for event_1 above and ENDS condition for event_2.
-
-# Let event_3, which is ON COMPLETION NOT PRESERVE execute and drop itself
-let $wait_condition=select count(*) = 0 from information_schema.events
-where event_name='event_3';
---source include/wait_condition.inc
-
-# Let event_4 reach the end of its execution interval
-let $wait_condition=select count(*) = 0 from information_schema.events
-where event_name='event_4' and status='enabled';
---source include/wait_condition.inc
-
-#
-# On a busy system the scheduler may skip execution of events,
-# we can't reliably expect that the data in a table to be modified
-# by an event will be exact. Thus we do not SELECT from the tables
-# in this test. See also
-# Bug#39854 events_scheduling fails sporadically on pushbuild
-#
-
-SELECT IF(TIME_TO_SEC(TIMEDIFF(ENDS,STARTS))=6, 'OK', 'ERROR')
-FROM INFORMATION_SCHEMA.EVENTS
-WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='event_2';
-
---echo "Already dropped because ended. Therefore an error."
---error ER_EVENT_DOES_NOT_EXIST
-DROP EVENT event_3;
-
-DROP EVENT event_1;
---echo "Should be preserved"
-SELECT EVENT_NAME, STATUS FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_NAME;
-DROP EVENT event_2;
-DROP EVENT event_4;
-DROP TABLE table_1;
-DROP TABLE table_2;
-DROP TABLE table_3;
-DROP TABLE table_4;
-
--- echo
--- echo Bug #50087 Interval arithmetic for Event_queue_element is not portable.
--- echo
-
-CREATE TABLE t1(a int);
-
-CREATE EVENT e1 ON SCHEDULE EVERY 1 MONTH
-STARTS NOW() - INTERVAL 1 MONTH
-ENDS NOW() + INTERVAL 2 MONTH
-ON COMPLETION PRESERVE
-DO
- INSERT INTO t1 VALUES (1);
-
-CREATE EVENT e2 ON SCHEDULE EVERY 1 MONTH
-STARTS NOW()
-ENDS NOW() + INTERVAL 11 MONTH
-ON COMPLETION PRESERVE
-DO
- INSERT INTO t1 VALUES (1);
-
-DROP TABLE t1;
-DROP EVENT e1;
-DROP EVENT e2;
-
-
-DROP DATABASE events_test;
-SET GLOBAL event_scheduler=@event_scheduler;
-
-#
-# End of tests
-#
-
-let $wait_condition=
- select count(*) = 0 from information_schema.processlist
- where db='events_test' and command = 'Connect' and user=current_user();
---source include/wait_condition.inc
-
diff --git a/mysql-test/t/events_slowlog.test b/mysql-test/t/events_slowlog.test
deleted file mode 100644
index 9679714dba3..00000000000
--- a/mysql-test/t/events_slowlog.test
+++ /dev/null
@@ -1,28 +0,0 @@
---source include/not_embedded.inc
-#
-# MDEV-11552 Queries executed by event scheduler are written to slow log incorrectly or not written at all
-#
-set @event_scheduler_save= @@global.event_scheduler;
-set @slow_query_log_save= @@global.slow_query_log;
-
-set global event_scheduler= on;
-set global slow_query_log= on;
-set global long_query_time=0.2;
-
-create table t1 (i int);
-insert into t1 values (0);
-create event ev on schedule at CURRENT_TIMESTAMP + INTERVAL 1 second do update t1 set i=1+sleep(0.5);
-
---let wait_condition= select i from t1 where i > 0
---source include/wait_condition.inc
-
---let SEARCH_FILE = `SELECT @@slow_query_log_file`
---let SEARCH_PATTERN= update t1 set i=1
---let SEARCH_RANGE= -1000
---source include/search_pattern_in_file.inc
-
-drop table t1;
-
-set global event_scheduler= @event_scheduler_save;
-set global slow_query_log= @slow_query_log_save;
-set global long_query_time= @@session.long_query_time;
diff --git a/mysql-test/t/events_stress.test b/mysql-test/t/events_stress.test
deleted file mode 100644
index 8ea7633877b..00000000000
--- a/mysql-test/t/events_stress.test
+++ /dev/null
@@ -1,142 +0,0 @@
-# Can't test with embedded server that doesn't support grants
---source include/not_embedded.inc
---source include/big_test.inc
-
-CREATE DATABASE IF NOT EXISTS events_test;
-#
-# DROP DATABASE test start (bug #16406)
-#
-CREATE DATABASE events_conn1_test2;
-# BUG#20676: MySQL in debug mode has a limit of 100 waiters
-# (in mysys/thr_lock.c), so use three different tables to insert into.
-CREATE TABLE events_test.fill_it1(test_name varchar(20), occur datetime);
-CREATE TABLE events_test.fill_it2(test_name varchar(20), occur datetime);
-CREATE TABLE events_test.fill_it3(test_name varchar(20), occur datetime);
-CREATE USER event_user2@localhost;
-CREATE DATABASE events_conn2_db;
-GRANT ALL ON *.* TO event_user2@localhost;
-CREATE USER event_user3@localhost;
-CREATE DATABASE events_conn3_db;
-GRANT ALL ON *.* TO event_user3@localhost;
-connect (conn2,localhost,event_user2,,events_conn2_db);
---echo "In the second connection we create some events which won't be dropped till the end"
---disable_query_log
-let $1= 50;
-while ($1)
-{
- eval CREATE EVENT conn2_ev$1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO events_test.fill_it1 VALUES("conn2_ev$1", NOW());
- dec $1;
-}
---enable_query_log
-connect (conn3,localhost,event_user3,,events_conn3_db);
---echo "In the second connection we create some events which won't be dropped till the end"
---disable_query_log
-let $1= 50;
-while ($1)
-{
- eval CREATE EVENT conn3_ev$1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO events_test.fill_it1 VALUES("conn3_ev$1", NOW());
- dec $1;
-}
---enable_query_log
-connection default;
-USE events_conn1_test2;
-CREATE EVENT ev_drop1 ON SCHEDULE EVERY 10 MINUTE DISABLE DO SELECT 1;
-CREATE EVENT ev_drop2 ON SCHEDULE EVERY 10 MINUTE DISABLE DO SELECT 1;
-CREATE EVENT ev_drop3 ON SCHEDULE EVERY 10 MINUTE DISABLE DO SELECT 1;
-USE events_test;
-SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS;
-SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
-DROP DATABASE events_conn1_test2;
-SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
-
---echo "Now testing stability - dropping db -> events while they are running"
-CREATE DATABASE events_conn1_test2;
-USE events_conn1_test2;
---disable_query_log
-let $1= 50;
-while ($1)
-{
- eval CREATE EVENT conn1_round1_ev$1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO events_test.fill_it2 VALUES("conn1_round1_ev$1", NOW());
- dec $1;
-}
---enable_query_log
-SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
-SET @old_event_scheduler=@@event_scheduler;
-SET GLOBAL event_scheduler=on;
---sleep 2.5
-DROP DATABASE events_conn1_test2;
-
-SET GLOBAL event_scheduler=off;
-SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
-CREATE DATABASE events_conn1_test3;
-USE events_conn1_test3;
---disable_query_log
-let $1= 50;
-while ($1)
-{
- eval CREATE EVENT conn1_round2_ev$1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO events_test.fill_it2 VALUES("conn1_round2_ev$1", NOW());
- dec $1;
-}
---enable_query_log
-SET GLOBAL event_scheduler=on;
-SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test3';
-CREATE DATABASE events_conn1_test4;
-USE events_conn1_test4;
---disable_query_log
-let $1= 50;
-while ($1)
-{
- eval CREATE EVENT conn1_round3_ev$1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO events_test.fill_it3 VALUES("conn1_round3_ev$1", NOW());
- dec $1;
-}
---enable_query_log
-
-CREATE DATABASE events_conn1_test2;
-USE events_conn1_test2;
---disable_query_log
-let $1= 50;
-while ($1)
-{
- eval CREATE EVENT ev_round4_drop$1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO events_test.fill_it3 VALUES("conn1_round4_ev$1", NOW());
- dec $1;
-}
---enable_query_log
-SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
---sleep 2.5
-connection conn2;
---send
-DROP DATABASE events_conn2_db;
-connection conn3;
---send
-DROP DATABASE events_conn3_db;
-connection default;
-# --send
-DROP DATABASE events_conn1_test2;
-DROP DATABASE events_conn1_test3;
-SET GLOBAL event_scheduler=off;
-DROP DATABASE events_conn1_test4;
-SET GLOBAL event_scheduler=on;
-connection conn2;
-reap;
-disconnect conn2;
-connection conn3;
-reap;
-disconnect conn3;
-connection default;
-USE events_test;
-DROP TABLE fill_it1;
-DROP TABLE fill_it2;
-DROP TABLE fill_it3;
---disable_query_log
-DROP USER event_user2@localhost;
-DROP USER event_user3@localhost;
---enable_query_log
-#
-# DROP DATABASE test end (bug #16406)
-#
-
-DROP DATABASE events_test;
-
-# Cleanup
-SET GLOBAL event_scheduler=@old_event_scheduler;
---source include/check_events_off.inc
diff --git a/mysql-test/t/events_time_zone.test b/mysql-test/t/events_time_zone.test
deleted file mode 100644
index 5291eb96e6b..00000000000
--- a/mysql-test/t/events_time_zone.test
+++ /dev/null
@@ -1,336 +0,0 @@
-# 1. This test case is sensitive to execution timing. You may control
-# this sensitivity by the parameter below. Small values will result
-# in fast but more unstable execution, large values will improve
-# stability at the cost of speed. Basically, N is a number of seconds
-# to wait for operation to complete. Should be positive. Test runs
-# about 25*N seconds (it sleeps most of the time, so CPU speed is not
-# relevant).
-let $N = 6;
-#
-# 2. Some subtests
-# - create a new time zone
-# - run some statements
-# - delete the new time zone.
-# But the time zone name used gets somewhere cached and it cannot be
-# "reused" later in the same or another session for a new time zone.
-# Experiments (2008-11 MySQL 5.1) showed that none of the available
-# RESET/FLUSH commands removes these entries.
-# 2008-11 MySQL 5.1 Bug#39979 main.events_time_zone does not clean up
-# second bad effect
-# Therefore we compute unique and unusual timezone names to minimize
-# the likelihood that a later test uses the same name.
-#
-# 3. The subtests mentioned in 2. cause that the AUTO_INCREMENT value
-# within "SHOW CREATE TABLE mysql.timezone" differ from the initial one.
-# (Bug#39979 main.events_time_zone does not clean up)
-# Therefore we reset this value after each of these subtests.
-#
-# Note(mleich):
-# There is a significant likelihood that future improvements of the server
-# cause that the solutions for the issues mentioned in 2. and 3. will no
-# more work.
-# A mysql-test-run.pl feature which allows to enforce
-# 1. Server shutdown (-> Problem mentioned in 2. disappears)
-# 2. Reset all data to initial state (-> Problem mentioned in 3. disappears)
-# 3. Server start
-# after a tests would be a perfect replacement.
-#
-
-# Can't test with embedded server that doesn't support grants
--- source include/not_embedded.inc
-
---source include/big_test.inc
-
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest_db1;
---enable_warnings
-
-CREATE DATABASE mysqltest_db1;
-
-let $old_db= `SELECT DATABASE()`;
-USE mysqltest_db1;
-
-SET GLOBAL EVENT_SCHEDULER= OFF;
-SET @save_time_zone= @@TIME_ZONE;
-
-
-#
-# BUG#16420: Events: timestamps become UTC
-# BUG#26429: SHOW CREATE EVENT is incorrect for an event that
-# STARTS NOW()
-# BUG#26431: Impossible to re-create an event from backup if its
-# STARTS clause is in the past
-# WL#3698: Events: execution in local time zone
-#
-
-#----------------------------------------------------------------------
-
-# Create rounding function.
-
-# Disable query log to hide actual value of $N.
---disable_query_log
-eval SET @step= $N;
---enable_query_log
-
-# Since we are working in a separate database, we may use any names we
-# like.
-CREATE TABLE t_step (step INT);
-INSERT INTO t_step VALUES (@step);
-
-# We can't use @variables in function, because it will be called from
-# the event thread, and 'eval' doesn't work for multi-statements, so
-# we can't interpolate $variables either, hence we fetch the step
-# value from the table.
-delimiter //;
-CREATE FUNCTION round_to_step(i INT, n INT) RETURNS INT
-BEGIN
- DECLARE step INT;
-
- SELECT * INTO step FROM t_step;
-
- # We add 0.1 as a protection from inexact division.
- RETURN FLOOR((i % (step * n) + 0.1) / step);
-END//
-delimiter ;//
-
-
-# Test time computations wrt Daylight Saving Time shifts. We also
-# test here that the event operates in its time zone (see what NOW()
-# returns).
-#
-
-# Create a fake time zone with time transitions every 3*$N second.
-
-SET @step3= @step * 3;
-SET @step6= @step * 6;
-
-SET @unix_time= UNIX_TIMESTAMP() - 1;
-SET @unix_time= @unix_time - @unix_time % @step6;
-
-INSERT INTO mysql.time_zone VALUES (NULL, 'N');
-SET @tzid= LAST_INSERT_ID();
-INSERT INTO mysql.time_zone_transition_type
- VALUES (@tzid, 0, 0, 0, 'b16420_0');
-INSERT INTO mysql.time_zone_transition_type
- VALUES (@tzid, 1, @step3 - @step, 1, 'b16420_1');
-
-let $transition_unix_time= `SELECT @unix_time`;
-let $count= 30;
---disable_query_log
-begin;
-while ($count)
-{
- eval INSERT INTO mysql.time_zone_transition
- VALUES (@tzid, $transition_unix_time,
- $transition_unix_time % @step6 = 0);
- let $transition_unix_time= `SELECT $transition_unix_time + @step3`;
- dec $count;
-}
-commit;
---enable_query_log
-let $tz_name = `SELECT CONCAT('b16420_a',UNIX_TIMESTAMP())`;
---replace_result $tz_name <TZ_NAME_1>
-eval INSERT INTO mysql.time_zone_name VALUES ('$tz_name', @tzid);
-
-CREATE TABLE t1 (count INT, unix_time INT, local_time INT, comment CHAR(80));
-CREATE TABLE t2 (count INT);
-INSERT INTO t2 VALUES (1);
-
-delimiter //;
-CREATE FUNCTION f1(comment CHAR(80)) RETURNS INT
-BEGIN
- DECLARE orig_tz CHAR(64);
- DECLARE unix_time INT;
- DECLARE local_now DATETIME;
- DECLARE utc_now DATETIME;
- DECLARE local_time INT;
-
- SET unix_time= UNIX_TIMESTAMP();
- SET local_now= FROM_UNIXTIME(unix_time);
- SET orig_tz= @@TIME_ZONE;
- SET TIME_ZONE = '+00:00';
- SET utc_now= FROM_UNIXTIME(unix_time);
- SET TIME_ZONE= orig_tz;
- SET local_time = unix_time + TIMESTAMPDIFF(SECOND, utc_now, local_now);
-
- SET unix_time= round_to_step(unix_time, 6);
- SET local_time= round_to_step(local_time, 6);
-
- INSERT INTO t1 VALUES ((SELECT count FROM t2),
- unix_time, local_time, comment);
- RETURN 0;
-END//
-delimiter ;//
-
-SET TIME_ZONE= '+00:00';
-CREATE EVENT e1 ON SCHEDULE EVERY @step SECOND
- STARTS FROM_UNIXTIME(@unix_time) DO SELECT f1("<e1>");
-
---replace_result $tz_name <TZ_NAME_1>
-eval SET TIME_ZONE= '$tz_name';
-CREATE EVENT e2 ON SCHEDULE EVERY @step SECOND
- STARTS FROM_UNIXTIME(@unix_time) DO SELECT f1("<e2>");
-
-# We want to start at the beginning of the DST cycle, so we wait
-# untill current time divides by @step6.
-let $wait_timeout= `SELECT @step6*2 + 1`;
-let $wait_condition= SELECT UNIX_TIMESTAMP() % @step6 = @step6 - 1;
---source include/wait_condition.inc
-# The second wait is needed because after the first wait we may end up
-# on the ending edge of a second. Second wait will bring us to the
-# beginning edge.
-let $wait_timeout= `SELECT @step*2 + 1`;
-let $wait_condition= SELECT UNIX_TIMESTAMP() % @step6 = 0;
---source include/wait_condition.inc
-
-# Note that after the scheduler is enabled, the event will be
-# scheduled only for the next second.
-SET GLOBAL EVENT_SCHEDULER= ON;
-
-# We want to run after the events are executed.
-SELECT SLEEP(@step / 2);
-
-let $count= 7;
---disable_query_log
---disable_result_log
-while ($count)
-{
- SELECT SLEEP(@step);
-
- eval SELECT CASE $count
- WHEN 5 THEN f1(CONCAT("Second pass after backward -2 step shift,",
- " e2 should not be executed"))
- WHEN 4 THEN f1(CONCAT("Second pass after backward -2 step shift,",
- " e2 should not be executed"))
- WHEN 2 THEN f1(CONCAT("Forward +2 step shift, local 0, 1 are skipped,",
- " e2 should be executed"))
- ELSE f1("e2 should be executed")
- END;
- UPDATE t2 SET count= count + 1;
-
- dec $count;
-}
---enable_result_log
---enable_query_log
-
-SET GLOBAL EVENT_SCHEDULER= OFF;
-
-SELECT * FROM t1 ORDER BY count, comment;
-
-SET TIME_ZONE= @save_time_zone;
-
-DROP EVENT e2;
-DROP EVENT e1;
-DROP FUNCTION f1;
-DROP TABLE t1, t2;
-
-DELETE FROM mysql.time_zone_name WHERE time_zone_id = @tzid;
-DELETE FROM mysql.time_zone_transition_type WHERE time_zone_id = @tzid;
-DELETE FROM mysql.time_zone_transition WHERE time_zone_id = @tzid;
-DELETE FROM mysql.time_zone WHERE time_zone_id = @tzid;
-let $time_zone_auto_inc = `SELECT MAX(Time_zone_id) + 1 FROM mysql.time_zone`;
-eval ALTER TABLE mysql.time_zone AUTO_INCREMENT = $time_zone_auto_inc;
-
-#----------------------------------------------------------------------
-
-# Test MONTH interval.
-#
-
-SET TIME_ZONE= '+00:00';
-
-CREATE TABLE t1 (event CHAR(2), dt DATE, offset INT);
-
-INSERT INTO mysql.time_zone VALUES (NULL, 'N');
-SET @tzid= LAST_INSERT_ID();
-
-SET @now= UNIX_TIMESTAMP();
-SET @offset_month_01= UNIX_TIMESTAMP('2030-01-31 12:00:00') - @now;
-SET @offset_month_02= UNIX_TIMESTAMP('2030-02-28 12:00:00') - @now - 5*@step;
-SET @offset_month_03= UNIX_TIMESTAMP('2030-03-31 12:00:00') - @now - 5*@step;
-SET @offset_month_04= UNIX_TIMESTAMP('2030-04-30 12:00:00') - @now - 13*@step;
-
-INSERT INTO mysql.time_zone_transition_type
- VALUES (@tzid, 0, @offset_month_01, 0, 'b16420_0');
-INSERT INTO mysql.time_zone_transition_type
- VALUES (@tzid, 1, @offset_month_02, 1, 'b16420_1');
-INSERT INTO mysql.time_zone_transition_type
- VALUES (@tzid, 2, @offset_month_03, 1, 'b16420_2');
-INSERT INTO mysql.time_zone_transition_type
- VALUES (@tzid, 3, @offset_month_04, 1, 'b16420_3');
-INSERT INTO mysql.time_zone_transition
- VALUES (@tzid, @now, 0);
-INSERT INTO mysql.time_zone_transition
- VALUES (@tzid, @now + 3 * @step, 1);
-INSERT INTO mysql.time_zone_transition
- VALUES (@tzid, @now + 7 * @step, 2);
-INSERT INTO mysql.time_zone_transition
- VALUES (@tzid, @now + 12 * @step, 3);
-let $tz_name = `SELECT CONCAT('b16420_b',UNIX_TIMESTAMP())`;
---replace_result $tz_name <TZ_NAME_2>
-eval INSERT INTO mysql.time_zone_name VALUES ('$tz_name', @tzid);
-
---replace_result $tz_name <TZ_NAME_2>
-eval SET TIME_ZONE= '$tz_name';
-
-SET GLOBAL EVENT_SCHEDULER= ON;
-
-let $now= `SELECT @now`;
---disable_query_log
-eval CREATE EVENT e1 ON SCHEDULE EVERY 1 MONTH
- STARTS FROM_UNIXTIME($now - @step) DO
- INSERT INTO t1 VALUES
- ("e1", NOW(), round_to_step(UNIX_TIMESTAMP() - $now, 4) - 1);
-eval CREATE EVENT e2 ON SCHEDULE EVERY 1 MONTH
- STARTS FROM_UNIXTIME($now + @step) DO
- INSERT INTO t1 VALUES
- ("e2", NOW(), round_to_step(UNIX_TIMESTAMP() - $now, 4) - 1);
---enable_query_log
-
-let $wait_timeout= `SELECT 16 * @step`;
-let $wait_condition= SELECT COUNT(*) = 7 FROM t1;
---source include/wait_condition.inc
-
-SET GLOBAL EVENT_SCHEDULER= OFF;
-
---echo Below we should see the following:
---echo - On Jan 31 only e2 is executed, because we started later than
---echo e1 should have been executed. Offset of e2 is 0 because of
---echo the late start, not 1.
---echo - The next execution is on Feb 28 (last day of Feb). Both events
---echo are executed in their times, offsets are -1 and 1.
---echo - The next time is Mar 31. Because the time of event
---echo execution was skipped over, events are executed right away,
---echo offsets are 2 and 2.
---echo - The next time is Apr 30. Events are again executed in their
---echo appointed times, offsets are -1 and 1.
-SELECT * FROM t1 ORDER BY dt, event;
-
-DROP EVENT e2;
-DROP EVENT e1;
-DROP TABLE t1;
-
-SET TIME_ZONE= @save_time_zone;
-
-DELETE FROM mysql.time_zone_name WHERE time_zone_id = @tzid;
-DELETE FROM mysql.time_zone_transition_type WHERE time_zone_id = @tzid;
-DELETE FROM mysql.time_zone_transition WHERE time_zone_id = @tzid;
-DELETE FROM mysql.time_zone WHERE time_zone_id = @tzid;
-let $time_zone_auto_inc = `SELECT MAX(Time_zone_id) + 1 FROM mysql.time_zone`;
-eval ALTER TABLE mysql.time_zone AUTO_INCREMENT = $time_zone_auto_inc;
-
-DROP FUNCTION round_to_step;
-DROP TABLE t_step;
-
-
-DROP DATABASE mysqltest_db1;
---disable_query_log
-eval USE $old_db;
-
---enable_query_log
-let $wait_condition=
- SELECT COUNT(*) = 0 FROM information_schema.processlist
- WHERE db='mysqltest_db1' AND command = 'Connect' AND user=current_user();
---source include/wait_condition.inc
-
---echo End of 5.1 tests.
diff --git a/mysql-test/t/events_trans.test b/mysql-test/t/events_trans.test
deleted file mode 100644
index eea24f19577..00000000000
--- a/mysql-test/t/events_trans.test
+++ /dev/null
@@ -1,151 +0,0 @@
-#
-# Tests that require transactions
-#
--- source include/have_innodb.inc
--- source include/not_embedded.inc
-
-set sql_mode="";
-
---disable_warnings
-drop database if exists events_test;
-drop database if exists mysqltest_no_such_database;
---enable_warnings
-create database events_test;
-use events_test;
-
---echo
---echo Test that Events DDL issue an implicit COMMIT
---echo
---echo
-set autocommit=off;
-# Sanity check
-select @@autocommit;
-create table t1 (a varchar(255)) engine=innodb;
-# Basic: check that successful Events DDL commits pending transaction
-begin work;
-insert into t1 (a) values ("OK: create event");
-create event e1 on schedule every 1 day do select 1;
-rollback work;
-select * from t1;
-delete from t1;
-commit work;
-#
-begin work;
-insert into t1 (a) values ("OK: alter event");
-alter event e1 on schedule every 2 day do select 2;
-rollback work;
-select * from t1;
-delete from t1;
-commit work;
-#
-begin work;
-insert into t1 (a) values ("OK: alter event rename");
-alter event e1 rename to e2;
-rollback work;
-select * from t1;
-delete from t1;
-commit work;
-#
-begin work;
-insert into t1 (a) values ("OK: drop event");
-drop event e2;
-rollback work;
-select * from t1;
-delete from t1;
-commit work;
-#
-begin work;
-insert into t1 (a) values ("OK: drop event if exists");
-drop event if exists e2;
-rollback work;
-select * from t1;
-delete from t1;
-commit work;
-#
-create event e1 on schedule every 1 day do select 1;
-begin work;
-insert into t1 (a) values ("OK: create event if not exists");
-create event if not exists e1 on schedule every 2 day do select 2;
-rollback work;
-select * from t1;
-delete from t1;
-commit work;
---echo
---echo Now check various error conditions: make sure we issue an
---echo implicit commit anyway
---echo
-#
-begin work;
-insert into t1 (a) values ("OK: create event: event already exists");
---error ER_EVENT_ALREADY_EXISTS
-create event e1 on schedule every 2 day do select 2;
-rollback work;
-select * from t1;
-delete from t1;
-commit work;
-#
-begin work;
-insert into t1 (a) values ("OK: alter event rename: rename to same name");
---error ER_EVENT_SAME_NAME
-alter event e1 rename to e1;
-rollback work;
-select * from t1;
-delete from t1;
-commit work;
-#
-create event e2 on schedule every 3 day do select 3;
-begin work;
-insert into t1 (a) values ("OK: alter event rename: destination exists");
---error ER_EVENT_ALREADY_EXISTS
-alter event e2 rename to e1;
-rollback work;
-select * from t1;
-delete from t1;
-commit work;
-#
-begin work;
-insert into t1 (a) values ("OK: create event: database does not exist");
---error ER_BAD_DB_ERROR
-create event mysqltest_no_such_database.e1 on schedule every 1 day do select 1;
-rollback work;
-select * from t1;
-delete from t1;
-commit work;
-
-#
-# Cleanup
-#
-
-let $wait_condition=
- select count(*) = 0 from information_schema.processlist
- where db='events_test' and command = 'Connect' and user=current_user();
---source include/wait_condition.inc
-
-drop database events_test;
-
-
---echo #
---echo # Bug#54105 assert in MDL_context::release_locks_stored_before
---echo #
-
-USE test;
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
-DROP EVENT IF EXISTS e1;
---enable_warnings
-
-CREATE TABLE t1 (a INT) ENGINE=InnoDB;
-CREATE TABLE t2 (a INT);
-CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
-
-START TRANSACTION;
-INSERT INTO t1 VALUES (1);
-SAVEPOINT A;
---replace_regex /STARTS '[^']+'/STARTS '#'/
-SHOW CREATE EVENT e1;
-SELECT * FROM t2;
-ROLLBACK WORK TO SAVEPOINT A;
-
-DROP TABLE t1, t2;
-DROP EVENT e1;
diff --git a/mysql-test/t/events_trans_notembedded.test b/mysql-test/t/events_trans_notembedded.test
deleted file mode 100644
index 3cf823bf713..00000000000
--- a/mysql-test/t/events_trans_notembedded.test
+++ /dev/null
@@ -1,68 +0,0 @@
-#
-# Tests that require transactions
-#
--- source include/not_embedded.inc
--- source include/have_innodb.inc
---disable_warnings
-drop database if exists events_test;
-drop database if exists mysqltest_db2;
---enable_warnings
-create database events_test;
-use events_test;
-
-#
-# Privilege checks
-#
-create user mysqltest_user1@localhost;
-grant create, insert, select, delete on mysqltest_db2.*
- to mysqltest_user1@localhost;
-create database mysqltest_db2;
-connect (conn1,localhost,mysqltest_user1,,mysqltest_db2);
-set autocommit=off;
-# Sanity check
-select @@autocommit;
-create table t1 (a varchar(255)) engine=innodb;
-# Not enough privileges to CREATE EVENT
-begin work;
-insert into t1 (a) values ("OK: create event: insufficient privileges");
---error ER_DBACCESS_DENIED_ERROR
-create event e1 on schedule every 1 day do select 1;
-rollback work;
-select * from t1;
-delete from t1;
-commit work;
-# Not enough privileges to ALTER EVENT
-begin work;
-insert into t1 (a) values ("OK: alter event: insufficient privileges");
---error ER_DBACCESS_DENIED_ERROR
-alter event e1 on schedule every 1 day do select 1;
-rollback work;
-select * from t1;
-delete from t1;
-commit work;
-# Not enough privileges to DROP EVENT
-begin work;
-insert into t1 (a) values ("OK: drop event: insufficient privileges");
---error ER_DBACCESS_DENIED_ERROR
-drop event e1;
-rollback work;
-select * from t1;
-delete from t1;
-commit work;
-# Cleanup
-disconnect conn1;
---source include/wait_until_disconnected.inc
-connection default;
-drop user mysqltest_user1@localhost;
-drop database mysqltest_db2;
-
-#
-# Cleanup
-#
-let $wait_condition=
- select count(*) = 0 from information_schema.processlist
- where db='events_test' and command = 'Connect' and user=current_user();
---source include/wait_condition.inc
-
-drop database events_test;
-
diff --git a/mysql-test/t/except.test b/mysql-test/t/except.test
deleted file mode 100644
index f88d9b29e35..00000000000
--- a/mysql-test/t/except.test
+++ /dev/null
@@ -1,97 +0,0 @@
-create table t1 (a int, b int) engine=MyISAM;
-create table t2 (c int, d int) engine=MyISAM;
-insert into t1 values (1,1),(2,2);
-insert into t2 values (2,2),(3,3);
-
-(select a,b from t1) except (select c,d from t2);
-EXPLAIN (select a,b from t1) except (select c,d from t2);
-EXPLAIN extended (select a,b from t1) except (select c,d from t2);
-EXPLAIN extended select * from ((select a,b from t1) except (select c,d from t2)) a;
-EXPLAIN format=json (select a,b from t1) except (select c,d from t2);
-
---replace_regex /"r_total_time_ms": [0-9e\.\-+]*,/"r_total_time_ms": "REPLACED",/
-ANALYZE format=json (select a,b from t1) except (select c,d from t2);
---replace_regex /"r_total_time_ms": [0-9e\.\-+]*,/"r_total_time_ms": "REPLACED",/
-ANALYZE format=json select * from ((select a,b from t1) except (select c,d from t2)) a;
-select * from ((select a,b from t1) except (select c,d from t2)) a;
-
-prepare stmt from "(select a,b from t1) except (select c,d from t2)";
-execute stmt;
-execute stmt;
-
-prepare stmt from "select * from ((select a,b from t1) except (select c,d from t2)) a";
-execute stmt;
-execute stmt;
-
-drop tables t1,t2;
-
-
-create table t1 (a int, b int) engine=MyISAM;
-create table t2 (c int, d int) engine=MyISAM;
-create table t3 (e int, f int) engine=MyISAM;
-create table t4 (g int, h int) engine=MyISAM;
-insert into t1 values (1,1),(2,2);
-insert into t2 values (2,2),(3,3);
-insert into t3 values (4,4),(5,5);
-insert into t4 values (4,4),(7,7);
-
-(select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4);
-EXPLAIN (select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4);
-EXPLAIN (select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4);
-EXPLAIN extended select * from ((select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4)) a;
-EXPLAIN format=json (select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4);
-
---replace_regex /"r_total_time_ms": [0-9e\.\-+]*,/"r_total_time_ms": "REPLACED",/
-ANALYZE format=json (select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4);
---replace_regex /"r_total_time_ms": [0-9e\.\-+]*,/"r_total_time_ms": "REPLACED",/
-ANALYZE format=json select * from ((select a,b,e,f from t1,t3) except
-(select c,d,g,h from t2,t4)) a;
-select * from ((select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4)) a;
-
-prepare stmt from "(select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4)";
-execute stmt;
-execute stmt;
-
-prepare stmt from "select * from ((select a,b,e,f from t1,t3) except (select c,d,g,h from t2,t4)) a";
-execute stmt;
-execute stmt;
-
-drop tables t1,t2,t3,t4;
-
-select 1 as a from dual except select 1 from dual;
-(select 1 from dual) except (select 1 from dual);
---error ER_WRONG_USAGE
-(select 1 from dual into @v) except (select 1 from dual);
---error ER_PARSE_ERROR
-select 1 from dual ORDER BY 1 except select 1 from dual;
-
-select 1 as a from dual union all select 1 from dual;
---error ER_WRONG_USAGE
-select 1 from dual except all select 1 from dual;
-
-
-create table t1 (a int, b blob, a1 int, b1 blob) engine=MyISAM;
-create table t2 (c int, d blob, c1 int, d1 blob) engine=MyISAM;
-insert into t1 values (1,"ddd", 1, "sdfrrwwww"),(2, "fgh", 2, "dffggtt");
-insert into t2 values (2, "fgh", 2, "dffggtt"),(3, "ffggddd", 3, "dfgg");
-
-(select a,b,b1 from t1) except (select c,d,d1 from t2);
-# make sure that blob is used
-create table t3 (select a,b,b1 from t1) except (select c,d,d1 from t2);
-show create table t3;
-
-drop tables t1,t2,t3;
-
---echo #
---echo # MDEV-13723: Server crashes in ha_heap::find_unique_row or
---echo # Assertion `0' failed in st_select_lex_unit::optimize with INTERSECT
---echo #
-CREATE TABLE t (i INT);
-INSERT INTO t VALUES (1),(2);
-
-SELECT * FROM t WHERE i != ANY ( SELECT 3 EXCEPT SELECT 3 );
-
-drop table t;
-
-
---echo # End of 10.3 tests
diff --git a/mysql-test/t/execution_constants.test b/mysql-test/t/execution_constants.test
deleted file mode 100644
index 285197cd1f4..00000000000
--- a/mysql-test/t/execution_constants.test
+++ /dev/null
@@ -1,84 +0,0 @@
-# In embedded server we don't really have a control over stack usage
--- source include/not_embedded.inc
-
-#
-# Bug#21476: Lost Database Connection During Query
-#
-# When the amount of stack space we think we need to report an error is
-# actually too small, then we can get SEGVs. But, we don't want to reserve
-# space that we could use to get real work done. So, we want the reserved
-# space small, and this test verifies that the reservation is not too small.
-
-CREATE TABLE `t_bug21476` (
- `ID_BOARD` smallint(5) unsigned NOT NULL default '0',
- `ID_MEMBER` mediumint(8) unsigned NOT NULL default '0',
- `logTime` int(10) unsigned NOT NULL default '0',
- `ID_MSG` mediumint(8) unsigned NOT NULL default '0',
- PRIMARY KEY (`ID_MEMBER`,`ID_BOARD`),
- KEY `logTime` (`logTime`)
-) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_bulgarian_ci;
-
-INSERT INTO `t_bug21476` VALUES (2,2,1154870939,0),(1,2,1154870957,0),(2,183,1154941362,0),(2,84,1154904301,0),(1,84,1154905867,0),(2,13,1154947484,10271),(3,84,1154880549,0),(1,6,1154892183,0),(2,25,1154947581,10271),(3,25,1154904760,0),(1,25,1154947373,10271),(1,179,1154899992,0),(2,179,1154899410,0),(5,25,1154901666,0),(2,329,1154902026,0),(3,329,1154902040,0),(1,329,1154902058,0),(1,13,1154930841,0),(3,85,1154904987,0),(1,183,1154929665,0),(3,13,1154931268,0),(1,85,1154936888,0),(1,169,1154937959,0),(2,169,1154941717,0),(3,183,1154939810,0),(3,169,1154941734,0);
-
-delimiter //;
-let $query_head=UPDATE t_bug21476 SET ID_MSG = IF(logTime BETWEEN 1 AND 1101770053, 2, //
-let $query_tail =) WHERE logTime BETWEEN 1 AND 1104091539 AND ID_MSG = 0//
-
-# Scan over the possible stack heights, trying to recurse to exactly that
-# depth. Eventually, we will reach our imposed limit on height and try to
-# raise an error. If the remaining stack space is enough to raise that error,
-# we will get an error-number of 1436 and quit the loop. If it's not enough
-# space, we should get a SEGV
-
-# Well more than enough recursions to find the end of our stack.
-let $i = 100000//
-disable_query_log//
-disable_result_log//
-while ($i)
-{
- # If we SEGV because the min stack size is exceeded, this would return error
- # 2013 .
- error 0,ER_STACK_OVERRUN_NEED_MORE //
- eval $query_head 0 $query_tail//
-
- if ($mysql_errno)
- {
- # We reached the place where we reported an error about the stack limit,
- # and we successfully returned the error. That means that at the stack
- # limit, we still have enough space reserved to report an error.
- let $i = 1//
-
- # Check that mysql_errname is ER_STACK_OVERRUN_NEED_MORE
- if ($mysql_errname != ER_STACK_OVERRUN_NEED_MORE)
- {
- die Wrong error triggered, expected ER_STACK_OVERRUN_NEED_MORE but got $mysql_errname//
- }
-
- }
-
- # Multiplying by three stack frames should be fine enough resolution.
- # Trading exactness for speed.
-
- # go one more level deep
- let $query_head = $query_head IF(logTime <= 1104091$i, $i, //
- let $query_tail =) $query_tail//
-
- # go one more level deep
- let $query_head = $query_head IF(logTime <= 1105091$i, $i, //
- let $query_tail =) $query_tail//
-
- # go one more level deep
- let $query_head = $query_head IF(logTime <= 1106091$i, $i, //
- let $query_tail =) $query_tail//
-
- dec $i//
-}
-enable_result_log//
-enable_query_log//
-
-echo Assertion: mysql_errname ER_STACK_OVERRUN_NEED_MORE == $mysql_errname//
-
-delimiter ;//
-DROP TABLE `t_bug21476`;
-
---echo End of 5.0 tests.
diff --git a/mysql-test/t/explain.test b/mysql-test/t/explain.test
deleted file mode 100644
index d5be354c852..00000000000
--- a/mysql-test/t/explain.test
+++ /dev/null
@@ -1,335 +0,0 @@
-#
-# Test of different EXPLAINs
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (id int not null, str char(10), unique(str));
-explain select * from t1;
-insert into t1 values (1, null),(2, null),(3, "foo"),(4, "bar");
-select * from t1 where str is null;
-select * from t1 where str="foo";
-explain select * from t1 where str is null;
-explain select * from t1 where str="foo";
-explain select * from t1 ignore key (str) where str="foo";
-explain select * from t1 use key (str,str) where str="foo";
-
-#The following should give errors
---error 1176
-explain select * from t1 use key (str,str,foo) where str="foo";
---error 1176
-explain select * from t1 ignore key (str,str,foo) where str="foo";
-drop table t1;
-
-explain select 1;
-
-create table t1 (a int not null);
-explain select count(*) from t1;
-insert into t1 values(1);
-explain select count(*) from t1;
-insert into t1 values(1);
-explain select count(*) from t1;
-drop table t1;
-
-#
-# Bug #3403 Wrong encoding in EXPLAIN SELECT output
-#
-set names koi8r;
-create table (0 int, 1 int, key 0 (0), key 01 (0,1));
-insert into (0) values (1);
-insert into (0) values (2);
-explain select 0 from where 0=1;
-drop table ;
-set names latin1;
-
-# End of 4.1 tests
-
-
-#
-# Bug#15463: EXPLAIN SELECT..INTO hangs the client (QB, command line)
-#
-select 3 into @v1;
-explain select 3 into @v1;
-
-#
-# Bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were
-# optimized away.
-#
-create table t1(f1 int, f2 int);
-insert into t1 values (1,1);
-create view v1 as select * from t1 where f1=1;
-explain extended select * from v1 where f2=1;
-explain extended select * from t1 where 0;
-explain extended select * from t1 where 1;
-explain extended select * from t1 having 0;
-explain extended select * from t1 having 1;
-drop view v1;
-drop table t1;
-
-#
-# Bug #32241: memory corruption due to large index map in 'Range checked for
-# each record'
-#
-
-CREATE TABLE t1(c INT);
-INSERT INTO t1 VALUES (),();
-
-CREATE TABLE t2 (b INT,
-KEY(b),KEY(b),KEY(b),KEY(b),KEY(b),
-KEY(b),KEY(b),KEY(b),KEY(b),KEY(b),
-KEY(b),KEY(b),KEY(b),KEY(b),KEY(b),
-KEY(b),KEY(b),KEY(b),KEY(b),KEY(b),
-KEY(b),KEY(b),KEY(b),KEY(b),KEY(b),
-KEY(b),KEY(b),KEY(b),KEY(b),KEY(b),
-KEY(b),KEY(b),KEY(b),KEY(b),KEY(b),
-KEY(b),KEY(b),KEY(b),KEY(b),KEY(b));
-
-INSERT INTO t2 VALUES (),(),();
-
-# We only need to make sure that there is no buffer overrun and the index map
-# is displayed correctly
---replace_column 1 X 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X
-EXPLAIN SELECT 1 FROM
- (SELECT 1 FROM t2,t1 WHERE b < c GROUP BY 1 LIMIT 1) AS d2;
-DROP TABLE t2;
-DROP TABLE t1;
-
-#
-# Bug #34773: query with explain extended and derived table / other table
-# crashes server
-#
-
-CREATE TABLE t1(a INT);
-CREATE TABLE t2(a INT);
-INSERT INTO t1 VALUES (1),(2);
-INSERT INTO t2 VALUES (1),(2);
-
-EXPLAIN EXTENDED SELECT 1
- FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1;
-
-EXPLAIN EXTENDED SELECT 1
- FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1;
-
-prepare s1 from
-'EXPLAIN EXTENDED SELECT 1
- FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1';
-execute s1;
-
-prepare s1 from
-'EXPLAIN EXTENDED SELECT 1
- FROM (SELECT COUNT(DISTINCT t1.a) FROM t1,t2 GROUP BY t1.a) AS s1';
-execute s1;
-execute s1;
-
-DROP TABLE t1,t2;
-
-
-#
-# Bug #43354: Use key hint can crash server in explain extended query
-#
-
-CREATE TABLE t1 (a INT PRIMARY KEY);
-
---error ER_KEY_DOES_NOT_EXITS
-EXPLAIN EXTENDED SELECT COUNT(a) FROM t1 USE KEY(a);
-
-DROP TABLE t1;
-
-#
-# Bug#45989 memory leak after explain encounters an error in the query
-#
-CREATE TABLE t1(a LONGTEXT);
-INSERT INTO t1 VALUES (repeat('a',@@global.max_allowed_packet));
-INSERT INTO t1 VALUES (repeat('b',@@global.max_allowed_packet));
---error ER_BAD_FIELD_ERROR
-EXPLAIN SELECT DISTINCT 1 FROM t1,
- (SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) as d1
- WHERE t1.a = d1.a;
-DROP TABLE t1;
-
---echo #
---echo # Bug#48295:
---echo # explain extended crash with subquery and ONLY_FULL_GROUP_BY sql_mode
---echo #
-
-CREATE TABLE t1 (f1 INT not null);
-
-SELECT @@session.sql_mode INTO @old_sql_mode;
-SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
-
-# EXPLAIN EXTENDED (with subselect). used to crash. should give NOTICE.
-# Before moving max/min optimization to optimize phase this statement
-# generated error, but as far as original query do not contain aggregate
-# function user should not see error
-# --error ER_MIX_OF_GROUP_FUNC_AND_FIELDS
-EXPLAIN EXTENDED SELECT 1 FROM t1
- WHERE f1 > ALL( SELECT t.f1 FROM t1,t1 AS t );
-
-SET SESSION sql_mode=@old_sql_mode;
-
-DROP TABLE t1;
-
---echo End of 5.0 tests.
-
---echo #
---echo # Bug#37870: Usage of uninitialized value caused failed assertion.
---echo #
-create table t1 (dt datetime not null, t time not null);
-create table t2 (dt datetime not null);
-insert into t1 values ('2001-01-01 1:1:1', '1:1:1'),
-('2001-01-01 1:1:1', '1:1:1');
-insert into t2 values ('2001-01-01 1:1:1'), ('2001-01-01 1:1:1');
-SET @save_join_cache_level=@@join_cache_level;
-SET join_cache_level=0;
-flush tables;
-EXPLAIN SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN (SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.dt IS NULL );
-flush tables;
-SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN (SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.dt IS NULL );
-flush tables;
-EXPLAIN SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN ( SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.t < '2005-11-13 7:41:31' );
-flush tables;
-SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN ( SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.t < '2005-11-13 7:41:31' );
-SET join_cache_level=@save_join_cache_level;
-drop tables t1, t2;
-
---echo #
---echo # Bug#47669: Query showed by EXPLAIN EXTENDED gives different result from original query
---echo #
-
-CREATE TABLE t1 (c int);
-INSERT INTO t1 VALUES (NULL);
-CREATE TABLE t2 (d int);
-INSERT INTO t2 VALUES (NULL), (0);
-EXPLAIN EXTENDED SELECT (SELECT 1 FROM t2 WHERE d = c) FROM t1;
-DROP TABLE t1, t2;
-
---echo #
---echo # Bug#30302: Tables that were optimized away are printed in the
---echo # EXPLAIN EXTENDED warning.
---echo #
-create table t1(f1 int);
-create table t2(f2 int);
-insert into t1 values(1);
-insert into t2 values(1),(2);
-explain extended select * from t1 where f1=1;
-explain extended select * from t1 join t2 on f1=f2 where f1=1;
-drop table t1,t2;
-
---echo #
---echo # Bug #48419: another explain crash..
---echo #
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (b BLOB, KEY b(b(100)));
-INSERT INTO t2 VALUES ('1'), ('2'), ('3');
-
-FLUSH TABLES;
-
-EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT 1 FROM t1 t JOIN t2 WHERE b <= 1 AND t.a);
-
-DROP TABLE t1, t2;
-
---echo #
---echo # Bug #48573: difference of index selection between rpm binary and
---echo # .tar.gz, windows vs linux..
---echo #
-
-CREATE TABLE t1(c1 INT, c2 INT, c4 INT, c5 INT, KEY(c2, c5), KEY(c2, c4, c5));
-INSERT INTO t1 VALUES(4, 1, 1, 1);
-INSERT INTO t1 VALUES(3, 1, 1, 1);
-INSERT INTO t1 VALUES(2, 1, 1, 1);
-INSERT INTO t1 VALUES(1, 1, 1, 1);
-
-EXPLAIN SELECT c1 FROM t1 WHERE c2 = 1 AND c4 = 1 AND c5 = 1;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug#56814 Explain + subselect + fulltext crashes server
---echo #
-
-CREATE TABLE t1(f1 VARCHAR(6) NOT NULL,
-FULLTEXT KEY(f1),UNIQUE(f1));
-INSERT INTO t1 VALUES ('test');
-
-EXPLAIN SELECT 1 FROM t1
-WHERE 1 > ALL((SELECT t1.f1 FROM t1 JOIN t1 a ON (MATCH(t1.f1) AGAINST (""))
-WHERE t1.f1 GROUP BY t1.f1));
-
-PREPARE stmt FROM
-'EXPLAIN SELECT 1 FROM t1
- WHERE 1 > ALL((SELECT t1.f1 FROM t1 RIGHT OUTER JOIN t1 a
- ON (MATCH(t1.f1) AGAINST (""))
- WHERE t1.f1 GROUP BY t1.f1))';
-
-EXECUTE stmt;
-EXECUTE stmt;
-
-DEALLOCATE PREPARE stmt;
-
-PREPARE stmt FROM
-'EXPLAIN SELECT 1 FROM t1
- WHERE 1 > ALL((SELECT t1.f1 FROM t1 JOIN t1 a
- ON (MATCH(t1.f1) AGAINST (""))
- WHERE t1.f1 GROUP BY t1.f1))';
-
-EXECUTE stmt;
-EXECUTE stmt;
-
-DEALLOCATE PREPARE stmt;
-
-DROP TABLE t1;
-
---echo End of 5.1 tests.
-
---echo #
---echo # Bug#11829785 EXPLAIN EXTENDED CRASH WITH RIGHT OUTER JOIN, SUBQUERIES
---echo #
-
-CREATE TABLE t1(a INT);
-
-INSERT INTO t1 VALUES (0), (0);
-
-PREPARE s FROM
-'EXPLAIN EXTENDED
-SELECT SUBSTRING(1, (SELECT 1 FROM t1 a1 RIGHT OUTER JOIN t1 ON 0)) AS d
-FROM t1 WHERE 0 > ANY (SELECT @a FROM t1)';
-
---error ER_SUBQUERY_NO_1_ROW
-EXECUTE s;
-
-DEALLOCATE PREPARE s;
-DROP TABLE t1;
-
---echo #
---echo # Bug#776295: EXPLAIN EXTENDED with always false multiple equality
---echo # in the WHERE condition of a derived table
---echo #
-
-CREATE TABLE t1 (a int) ;
-
-CREATE TABLE t2 (a int) ;
-INSERT INTO t2 VALUES (8);
-
-set @tmp_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='derived_merge=off,derived_with_keys=off';
-EXPLAIN EXTENDED
-SELECT * FROM ( SELECT t1.a FROM t1,t2 WHERE t2.a = t1.a ) AS t;
-set optimizer_switch=@tmp_optimizer_switch;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-7215: EXPLAIN REPLACE produces an error:
---echo # Column count doesn't match value count
---echo #
-create table t1 (a int);
-insert into t1 values (1);
-create table t2 (b int, c int);
-
-replace into t2 select 100, (select a from t1);
-explain replace into t2 select 100, (select a from t1);
-#analyze replace into t2 select 100, (select a from t1);
-
-drop table t1, t2;
-
---echo # End of 10.1 tests
diff --git a/mysql-test/t/explain_json.test b/mysql-test/t/explain_json.test
deleted file mode 100644
index c3665b1818b..00000000000
--- a/mysql-test/t/explain_json.test
+++ /dev/null
@@ -1,419 +0,0 @@
-#
-# EXPLAIN FORMAT=JSON tests. These are tests developed for MariaDB.
-#
---disable_warnings
-drop table if exists t0,t1,t2;
---enable_warnings
-
-create table t0(a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-explain format=json select * from t0;
-
-explain format=json select * from t0 where 1>2;
-
-explain format=json select * from t0 where a<3;
-
---echo # Try a basic join
-create table t1 (a int, b int, filler char(32), key(a));
-insert into t1
-select
- a.a + b.a* 10 + c.a * 100,
- a.a + b.a* 10 + c.a * 100,
- 'filler'
-from t0 a, t0 b, t0 c;
-
-explain format=json select * from t0,t1 where t1.a=t0.a;
-
---echo # Try range and index_merge
-create table t2 (a1 int, a2 int, b1 int, b2 int, key(a1,a2), key(b1,b2));
-insert into t2 select a,a,a,a from t1;
-
-explain format=json select * from t2 where a1<5;
-
-explain format=json select * from t2 where a1=1 or b1=2;
-explain format=json select * from t2 where a1=1 or (b1=2 and b2=3);
-
-explain format=json select * from t2 where (a1=1 and a2=1) or
- (b1=2 and b2=1);
-
---echo # Try ref access on two key components
-
-explain format=json select * from t0,t2 where t2.b1=t0.a and t2.b2=4;
-
-drop table t1,t2;
-
---echo #
---echo # Try a UNION
---echo #
-explain format=json select * from t0 A union select * from t0 B;
-explain format=json select * from t0 A union all select * from t0 B;
-
---echo #
---echo # Subqueries
---echo #
-create table t1 (a int, b int);
-insert into t1 select a,a from t0;
-explain format=json select a, a > (select max(b) from t1 where t1.b=t0.a) from t0;
-
-explain format=json
-select * from t0 where
- a > (select max(b) from t1 where t1.b=t0.a) or a < 3 ;
-
-drop table t1;
-
---echo #
---echo # Join buffering
---echo #
-create table t1 (a int, b int);
-insert into t1 select tbl1.a+10*tbl2.a, tbl1.a+10*tbl2.a from t0 tbl1, t0 tbl2;
-
-explain format=json
-select * from t1 tbl1, t1 tbl2 where tbl1.a=tbl2.a and tbl1.b < 3 and tbl2.b < 5;
-
-drop table t1;
-
---echo #
---echo # Single-table UPDATE/DELETE, INSERT
---echo #
-explain format=json delete from t0;
-explain format=json delete from t0 where 1 > 2;
-
-explain format=json delete from t0 where a < 3;
-
-explain format=json update t0 set a=3 where a in (2,3,4);
-
-explain format=json insert into t0 values (1);
-
-create table t1 like t0;
-explain format=json insert into t1 values ((select max(a) from t0));
-
-drop table t1;
-
---echo #
---echo # A derived table
---echo #
-create table t1 (a int, b int);
-insert into t1 select a,a from t0;
-explain format=json
-select * from (select a, count(*) as cnt from t1 group by a) as tbl
-where cnt>0;
-
-explain format=json
-select * from (select a, count(*) as cnt from t1 group by a) as tbl1, t1 as
-tbl2 where cnt=tbl2.a;
-
---echo #
---echo # Non-merged semi-join (aka JTBM)
---echo #
-explain format=json
-select * from t1 where a in (select max(a) from t1 group by b);
-
---echo #
---echo # Semi-join Materialization
---echo #
-create table t2 like t1;
-insert into t2 select * from t1;
-explain format=json
-select * from t1,t2 where t1.a in ( select a from t0);
-
---echo #
---echo # First-Match
---echo #
-explain
-select * from t2 where t2.a in ( select a from t1 where t1.b=t2.b);
-explain format=json
-select * from t2 where t2.a in ( select a from t1 where t1.b=t2.b);
-
---echo #
---echo # Duplicate Weedout
---echo #
-set @tmp= @@optimizer_switch;
-set optimizer_switch='firstmatch=off';
-explain
-select * from t2 where t2.a in ( select a from t1 where t1.b=t2.b);
-explain format=json
-select * from t2 where t2.a in ( select a from t1 where t1.b=t2.b);
-set optimizer_switch=@tmp;
-
-drop table t1,t2;
-
---echo #
---echo # MRR for range access (no BKA, just MRR)
---echo #
-create table t1 (a int, b int, key(a));
-insert into t1 select tbl1.a+10*tbl2.a, 12345 from t0 tbl1, t0 tbl2;
-set @tmp= @@optimizer_switch;
-set optimizer_switch='mrr=on,mrr_sort_keys=on';
-
-explain format=json select * from t1 where a < 3;
-
---echo # 'Range checked for each record'
-set optimizer_switch=@tmp;
-explain format=json
-select * from t1 tbl1, t1 tbl2 where tbl2.a < tbl1.b;
-
-drop table t1;
-drop table t0;
-
---echo #
---echo # MDEV-7265: "Full scan on NULL key", the join case
---echo #
-
-CREATE TABLE t1 (a INT, KEY(a));
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE TABLE t2 (b INT);
-INSERT INTO t2 VALUES (3),(4);
-
-EXPLAIN FORMAT=JSON SELECT * FROM t1 AS outer_t1 WHERE a <> ALL ( SELECT a FROM t1, t2 WHERE b <> outer_t1.a );
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Join's constant expression
---echo #
-create table t0(a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1(a int, b int);
-insert into t1 select tbl1.a+10*tbl2.a, 1234 from t0 tbl1, t0 tbl2;
-
-explain format=json
-select * from t0
-where
- 20000 > all (select max(tbl1.a + tbl2.a)
- from t1 tbl1, t1 tbl2 where tbl1.b=tbl2.b);
-
-drop table t1;
-drop table t0;
-
---echo #
---echo # MDEV-7264: Assertion `0' failed in subselect_engine::get_identifier() on EXPLAIN JSON
---echo #
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE TABLE t2 (b INT);
-INSERT INTO t2 VALUES (3),(4);
-
-EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE a <> ALL ( SELECT b FROM t2 );
-DROP TABLE t1, t2;
-
---echo #
---echo # MDEV-7927: Server crashes in in Time_and_counter_tracker::incr_loops
---echo #
-CREATE TABLE t1 (i INT);
-INSERT INTO t1 VALUES (1),(2);
-EXPLAIN SELECT * FROM t1 WHERE 3 IN ( SELECT 4 UNION SELECT 5 );
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-7860: EXPLAIN FORMAT=JSON crashes for loose scan query
---echo #
-
-create table t2(a int);
-insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t1 (a int, b int, c int, d int, key(a,b,c));
-insert into t1 select A.a, B.a, C.a, D.a from t2 A, t2 B, t2 C, t2 D;
-explain select count(distinct b) from t1 group by a;
-explain format=json select count(distinct b) from t1 group by a;
---source include/analyze-format.inc
-analyze format=json select count(distinct b) from t1 group by a;
-drop table t1,t2;
-
---echo #
---echo # Try both variants of LooseScan (data/queries borrowed from group_min_max.test)
---echo #
-
-create table t1 (
- a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(248) default ' '
-);
-
-insert into t1 (a1, a2, b, c, d) values
-('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
-('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
-('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
-('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
-('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
-('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
-('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
-('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
-('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
-('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
-('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
-('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
-('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
-('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
-('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
-('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4'),
-('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
-('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
-('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
-('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
-('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
-('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
-('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
-('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
-('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
-('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
-('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
-('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
-('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
-('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
-('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
-('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4');
-
-create index idx_t1_0 on t1 (a1);
-create index idx_t1_1 on t1 (a1,a2,b,c);
-create index idx_t1_2 on t1 (a1,a2,b);
-analyze table t1;
-
-explain select count(distinct a1,a2,b) from t1 where (a2 >= 'b') and (b = 'a');
-explain select count(distinct a1,a2,b,c) from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
-
-explain format=json select count(distinct a1,a2,b) from t1 where (a2 >= 'b') and (b = 'a');
-explain format=json select count(distinct a1,a2,b,c) from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
-
-drop table t1;
-
---echo #
---echo # MDEV-8786 Wrong result for SELECT FORMAT=JSON * FROM t1 WHERE a=_latin1 0xDF
---echo #
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
-INSERT INTO t1 VALUES ('a'),('b');
-EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE a=_latin1 0xDF;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8785 Wrong results for EXPLAIN EXTENDED...WHERE NULLIF(latin1_col, _utf8'a' COLLATE utf8_bin) IS NOT NULL
---echo #
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
-INSERT INTO t1 VALUES ('a'),('A');
-EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE NULLIF(a,_utf8'a' COLLATE utf8_bin);
-DROP TABLE t1;
-
---echo #
---echo # MDEV-7970: EXPLAIN FORMAT=JSON does not print HAVING
---echo #
-create table t0(a int);
-insert into t0 values (0),(1),(2),(3);
-create table t1(a int);
-insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
-create table t2 (
- a int,
- b int,
- key (a)
-);
-insert into t2 select A.a*1000 + B.a, A.a*1000 + B.a from t0 A, t1 B;
---echo # normal HAVING
-explain format=json select a, max(b) as TOP from t2 group by a having TOP > a;
---echo # HAVING is always TRUE (not printed)
-explain format=json select a, max(b) as TOP from t2 group by a having 1<>2;
---echo # HAVING is always FALSE (intercepted by message)
-explain format=json select a, max(b) as TOP from t2 group by a having 1=2;
---echo # HAVING is absent
-explain format=json select a, max(b) as TOP from t2 group by a;
-drop table t0, t1, t2;
-
---echo #
---echo # MDEV-8829: Assertion `0' failed in Explain_table_access::tag_to_json
---echo #
-
---echo # Check ET_CONST_ROW_NOT_FOUND
-create table t1 (i int) engine=myisam;
-explain
-select * from t1;
-explain format=json
-select * from t1;
-analyze format=json
-select * from t1;
-drop table t1;
-
---echo # Check ET_IMPOSSIBLE_ON_CONDITION
-create table t1 (a int);
-create table t2 (pk int primary key);
-
-insert into t1 values (1),(2);
-insert into t2 values (1),(2);
-
-explain
-select * from t1 left join t2 on t2.pk > 10 and t2.pk < 0;
-explain format=json
-select * from t1 left join t2 on t2.pk > 10 and t2.pk < 0;
---source include/analyze-format.inc
-analyze format=json
-select * from t1 left join t2 on t2.pk > 10 and t2.pk < 0;
-
---echo # Check ET_NOT_EXISTS:
-explain
-select * from t1 left join t2 on t2.pk=t1.a where t2.pk is null;
-explain format=json
-select * from t1 left join t2 on t2.pk=t1.a where t2.pk is null;
---source include/analyze-format.inc
-analyze format=json
-select * from t1 left join t2 on t2.pk=t1.a where t2.pk is null;
-
---echo # Check ET_DISTINCT
-explain
-select distinct t1.a from t1 join t2 on t2.pk=t1.a;
-explain format=json
-select distinct t1.a from t1 join t2 on t2.pk=t1.a;
---source include/analyze-format.inc
-analyze format=json
-select distinct t1.a from t1 join t2 on t2.pk=t1.a;
-drop table t1,t2;
-
---echo # Check ET_USING_INDEX_CONDITION_BKA
-create table t1(a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t2(a int);
-insert into t2 select A.a + B.a* 10 + C.a * 100 from t1 A, t1 B, t1 C;
-
-create table t3(a int, b int);
-insert into t3 select a,a from t1;
-
-create table t4(a int, b int, c int, filler char(100), key (a,b));
-insert into t4 select a,a,a, 'filler-data' from t2;
-
-set @tmp_optimizer_switch=@@optimizer_switch;
-set @tmp_join_cache_level=@@join_cache_level;
-set optimizer_switch='mrr=on';
-set join_cache_level=6;
-explain
-select * from t3,t4 where t3.a=t4.a and (t4.b+1 <= t3.b+1);
-explain format=json
-select * from t3,t4 where t3.a=t4.a and (t4.b+1 <= t3.b+1);
---source include/analyze-format.inc
-analyze format=json
-select * from t3,t4 where t3.a=t4.a and (t4.b+1 <= t3.b+1);
-set optimizer_switch=@tmp_optimizer_switch;
-set join_cache_level=@tmp_join_cache_level;
-
-drop table t1,t2,t3,t4;
-
---echo #
---echo # MDEV-9652: EXPLAIN FORMAT=JSON should show outer_ref_cond
---echo #
-create table t0(a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t1 (a int, b int);
-insert into t1 select a,a from t0;
-
-explain format=json
-select a, (select max(a) from t1 where t0.a<5 and t1.b<t0.a) from t0;
-drop table t0,t1;
-
---echo #
---echo # MDEV-10844: EXPLAIN FORMAT=JSON doesn't show order direction for filesort
---echo #
-
-create table t1 (a int, b int);
-insert into t1 values (1,2),(3,4),(2,3);
-explain format=json select * from t1 order by a, b desc;
-explain format=json select * from t1 order by a desc, b desc;
-explain format=json select * from t1 order by a desc, b ;
-drop table t1;
-
diff --git a/mysql-test/t/explain_json_format_partitions.test b/mysql-test/t/explain_json_format_partitions.test
deleted file mode 100644
index 4c7d3f165d1..00000000000
--- a/mysql-test/t/explain_json_format_partitions.test
+++ /dev/null
@@ -1,17 +0,0 @@
-
---source include/have_partition.inc
-create table t2(a int);
-insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t1 (
- a int not null
-) partition by key(a);
-insert into t1 select a from t2;
-explain partitions select * from t1 where a in (2,3,4);
-explain format=json select * from t1 where a in (2,3,4);
---source include/analyze-format.inc
-analyze format=json select * from t1 where a in (2,3,4);
---source include/analyze-format.inc
-analyze format=json update t1 set a=a+10 where a in (2,3,4);
---source include/analyze-format.inc
-analyze format=json delete from t1 where a in (20,30,40);
-drop table t1,t2;
diff --git a/mysql-test/t/explain_json_innodb.test b/mysql-test/t/explain_json_innodb.test
deleted file mode 100644
index f70df5d5349..00000000000
--- a/mysql-test/t/explain_json_innodb.test
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# MariaDB's EXPLAIN FORMAT=JSON tests that require InnoDB.
-#
---source include/have_innodb.inc
-
---disable_warnings
-drop table if exists t0,t1,t2;
---enable_warnings
-
---echo #
---echo # MDEV-7266: Assertion `!element_started' failed in Json_writer& Json_writer::add_member
---echo #
-
-CREATE TABLE t1 (a INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE TABLE t2 (column_name_1 INT, column_name_2 VARCHAR(52)) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (3,'United States');
-
-CREATE TABLE t3 (b INT, c VARCHAR(3), PRIMARY KEY (c,b)) ENGINE=InnoDB;
-INSERT INTO t3 VALUES (4,'USA'),(5,'CAN');
-
-EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE 0 < ALL (
- SELECT tbl_alias1.column_name_1 FROM t2 AS tbl_alias1, t3 AS tbl_alias2
- WHERE tbl_alias2.b = tbl_alias1.column_name_1 AND tbl_alias2.c = tbl_alias1.column_name_2
-);
-
-drop table t1,t2,t3;
diff --git a/mysql-test/t/explain_non_select.test b/mysql-test/t/explain_non_select.test
deleted file mode 100644
index d9ff0fb7245..00000000000
--- a/mysql-test/t/explain_non_select.test
+++ /dev/null
@@ -1,252 +0,0 @@
-#
-# MariaDB tests for EXPLAIN UPDATE/DELETE.
-#
---source include/have_partition.inc
-
---disable_warnings
-drop table if exists t0, t1;
---enable_warnings
-
-create table t0 (a int) engine=myisam;
-insert into t0 values (1),(2),(3),(4),(5),(6),(7),(8);
-
---echo #
---echo # Tests for single-table DELETE
---echo #
-
-explain select * from t0 where a=3;
-explain delete from t0 where a=3;
-
---echo # DELETE without WHERE is a special case:
-explain delete from t0;
-
-create table t1 (a int, b int, filler char(100), key(a), key(b));
-insert into t1
-select A.a+10*B.a + 10*C.a, A.a+10*B.a + 10*C.a, 'filler'
-from t0 A, t0 B, t0 C;
-
---echo # This should use an index, possible_keys=NULL because there is no WHERE
-explain delete from t1 order by a limit 2;
-
---echo # This should use range, possible_keys={a,b}
-explain delete from t1 where a<20 and b < 10;
-
---echo # This should use ALL + filesort
-explain delete from t1 order by a+1 limit 2;
-
---echo # This should use range + using filesort
-explain delete from t1 where a<20 order by b limit 2;
-
---echo # Try some subqueries:
-explain delete from t1 where a < (select max(a) from t0);
-explain delete from t1 where a < (select max(a) from t0 where a < t1.b);
-
---echo #
---echo # Tests for multi-table DELETE
---echo #
-explain delete t1 from t0, t1 where t0.a = t1.a;
-drop table t0, t1;
-
---echo # ###################################################################
---echo # ## EXPLAIN UPDATE tests
---echo # ###################################################################
-create table t0 (a int) engine=myisam;
-insert into t0 values (1),(2),(3),(4),(5),(6),(7),(8);
-
-explain update t0 set a=3 where a=4;
-
-create table t1 (a int, b int, filler char(100), key(a), key(b));
-insert into t1
-select A.a+10*B.a + 10*C.a, A.a+10*B.a + 10*C.a, 'filler'
-from t0 A, t0 B, t0 C;
-
-explain update t1 set a=a+1 where 3>4;
-explain update t1 set a=a+1 where a=3 and a=4;
-
---echo # This should use an index, possible_keys=NULL because there is no WHERE
-explain update t1 set a=a+1 order by a limit 2;
-
---echo # This should use range, possible_keys={a,b}
-explain update t1 set filler='fooo' where a<20 and b < 10;
-
---echo # This should use ALL + filesort
-explain update t1 set filler='fooo' order by a+1 limit 2;
-
---echo # This should use range + using filesort
-explain update t1 set filler='fooo' where a<20 order by b limit 2;
-
---echo # Try some subqueries:
-explain update t1 set filler='fooo' where a < (select max(a) from t0);
-explain update t1 set filler='fooo' where a < (select max(a) from t0 where a < t1.b);
-
---echo #
---echo # Tests for multi-table UPDATE
---echo #
-explain update t0, t1 set t1.a=t1.a+1 where t0.a = t1.a;
-
-
-drop table t0, t1;
-
---echo #
---echo # Try DELETE ... RETURNING ...
---echo #
-create table t0 (a int);
-insert into t0 values (1),(2),(3),(4);
-explain delete from t0 where a=1 returning a;
-explain delete from t0 returning a;
-drop table t0;
-
---echo #
---echo # MDEV-5070 - EXPLAIN INSERT ... SELECT crashes on 10.0-base-explain-slowquerylog
---echo #
-create table t0 (a int);
-insert into t0 values (1),(2),(3),(4),(5),(6),(7),(8);
-create table t1 (a int);
-
-explain insert into t1 select * from t0;
-explain replace into t1 select * from t0;
-
-drop table t0, t1;
-
---echo #
---echo # MDEV-5067: Valgrind warnings (Invalid read) in QPF_table_access::print_explain
---echo #
-CREATE TABLE t1 (i INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (7),(0),(9);
-
-SELECT * FROM t1 INNER JOIN ( SELECT DISTINCT * FROM t1 ) AS sq ON (sq.i = t1.i);
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-5093, MDEV-5094: EXPLAIN PARTITIONS and EXPLAIN EXTENDED do not
---echo # work for EXPLAIN UPDATE.
---echo #
-create table t1 (i int);
-explain partitions update t1 set i = 3;
-
-create table t2 (a int, b int) partition by hash(a) partitions 5;
-insert into t2 values (0,0),(1,1),(2,2),(3,3),(4,4);
-
-explain partitions update t2 set b=3 where a in (3,4);
-explain partitions delete from t2 where a in (3,4);
-
-explain extended update t2 set b=3 where a in (3,4);
-explain extended delete from t2 where a in (3,4);
-
-drop table t1,t2;
-
---echo #
---echo # Check the special case where partition pruning removed all partitions
---echo #
-
-create table t1 (a int, b int)
-partition by range (a) (
- partition p0 values less than (10),
- partition p1 values less than (20),
- partition p2 values less than (30)
-);
-insert into t1 values (9,9), (19,19), (29,29);
-
-explain partitions select * from t1 where a in (32,33);
-
-explain partitions delete from t1 where a in (32,33);
-
-explain partitions update t1 set b=12345 where a in (32,33);
-
-drop table t1;
-
---echo #
---echo # Tests for EXPLAIN INSERT ... VALUES
---echo #
-create table t1 (a int, key(a));
-explain insert into t1 values (1),(2),(3);
-insert into t1 values (1),(2),(3);
-
-create table t2 (a int, b int);
-explain insert into t2 values
- (10, 1+(select max(a) from t1)),
- (11, 1+(select max(a+1) from t1));
-
-drop table t1,t2;
-
---echo #
---echo # MDEV-5122: "Commands out of sync", "Malformed packet" or client hang up on unique key violation
---echo #
-drop table if exists t1;
-
---disable_warnings
-drop function if exists f1;
---enable_warnings
-
-create table t1 (a int, unique(a));
-
-delimiter |;
-create function f1(x int)
- returns int
-begin
- insert into t1 values(x),(x);
- return 10;
-end|
-delimiter ;|
-
---error ER_DUP_ENTRY
-select f1(100);
-select 'OK';
-
-drop function f1;
-drop table t1;
-
---echo #
---echo # MDEV-7038: Assertion `status_var.memory_used == 0' failed in THD::~THD()
---echo # on disconnect after executing EXPLAIN for multi-table UPDATE
---echo #
-
-CREATE TABLE t1 (a INT);
-CREATE VIEW v1 AS SELECT * FROM t1;
-INSERT INTO t1 VALUES (1),(2);
-EXPLAIN UPDATE v1, mysql.user SET v1.a = v1.a + 1;
-DROP TABLE t1;
-DROP VIEW v1;
-
---echo #
---echo # MDEV-8299: MyISAM or Aria table gets corrupted after EXPLAIN INSERT and INSERT
---echo #
-CREATE TABLE t1 (pk INT NOT NULL AUTO_INCREMENT PRIMARY KEY, i INT, KEY(i)) ENGINE=MyISAM;
-INSERT INTO t1 (i) VALUES (100),(200);
-
-CREATE TABLE t2 (j INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (10),(20);
-
-EXPLAIN INSERT INTO t1 (i) SELECT j FROM t2;
-INSERT INTO t1 (i) VALUES (300);
-CHECK TABLE t1;
-
-DROP TABLE t1, t2;
-
---echo #
---echo # MDEV-8321: Assertion `! is_set()' failed in Diagnostics_area::set_eof_status on EXPLAIN INSERT ... UNION
---echo #
-
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (b INT);
-CREATE TABLE t3 (c INT);
-
-# Data is not necessary, tables can be empty as well
-INSERT INTO t1 VALUES (1),(2);
-INSERT INTO t2 VALUES (3),(4);
-INSERT INTO t3 VALUES (5),(6);
-
-EXPLAIN INSERT INTO t1 SELECT * FROM t2 UNION SELECT * FROM t3;
-drop table t1,t2,t3;
-
---echo #
---echo # MDEV-6223: Assertion `! is_set()' fails in Diagnostics_area::set_eof_status on EXPLAIN INSERT executed as a PS
---echo #
-CREATE TABLE t1 (a INT) ENGINE = MyISAM;
-CREATE TABLE t2 (b INT) ENGINE = MyISAM;
-INSERT INTO t2 VALUES (1),(2);
-PREPARE stmt FROM 'EXPLAIN INSERT INTO t1 SELECT * FROM t2';
-EXECUTE stmt;
-drop table t1,t2;
-
diff --git a/mysql-test/t/explain_slowquerylog-master.opt b/mysql-test/t/explain_slowquerylog-master.opt
deleted file mode 100644
index 0a3ad969e79..00000000000
--- a/mysql-test/t/explain_slowquerylog-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---slow-query-log --long-query-time=0.00000 --log-slow-verbosity=query_plan,explain
diff --git a/mysql-test/t/explain_slowquerylog.test b/mysql-test/t/explain_slowquerylog.test
deleted file mode 100644
index 6503a326eb8..00000000000
--- a/mysql-test/t/explain_slowquerylog.test
+++ /dev/null
@@ -1,63 +0,0 @@
-#
-# This is a test for EXPLAINs being written into slow query log.
-# For now, we just run the queries and hope not to crash.
-#
-#
---disable_warnings
-drop table if exists t0,t1;
---enable_warnings
-
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-explain select * from t0 where a < 3;
-
---echo #
---echo # MDEV-5045: Server crashes in QPF_query::print_explain with log_slow_verbosity='query_plan,explain'
---echo #
-set autocommit=1;
-drop table t0;
-
---echo #
---echo # MDEV-5047 virtual THD::~THD(): Assertion `status_var.memory_used == 0' fails on disconnect
---echo #
---connect (con1,localhost,root,,)
---error ER_NO_SUCH_TABLE
-ALTER TABLE nonexisting ENABLE KEYS;
-SHOW WARNINGS;
---disconnect con1
---connection default
-SELECT 1;
-
---echo #
---echo # MDEV-5060 Server crashes on EXPLAIN EXTENDED or EXPLAIN PARTITIONS with explain in slow_log
---echo #
-EXPLAIN PARTITIONS SELECT 1 ;
-
-
---echo #
---echo # MDEV-5106: Server crashes in Explain_union::print_explain on ER_TOO_BIG_SELECT with explain in slow log
---echo #
-CREATE TABLE t1 (i INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES
-(1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
-SET max_join_size = 10;
---error ER_TOO_BIG_SELECT
-( SELECT ta.* FROM t1 ta, t1 tb ) UNION ( SELECT * FROM t1 );
-SELECT 'Server still alive?' as 'Yes';
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-5308 Crash when running with slow_query_log=1
---echo #
-SET @save1= @@log_slow_rate_limit;
-SET @save2= @@long_query_time;
-
-SET log_slow_rate_limit=1000;
-SET long_query_time=0.000001;
-SELECT 1;
-
-SET log_slow_rate_limit=@save1;
-SET long_query_time=@save2;
-
diff --git a/mysql-test/t/ext_key_noPK_6794.test b/mysql-test/t/ext_key_noPK_6794.test
deleted file mode 100644
index fc8a2724c22..00000000000
--- a/mysql-test/t/ext_key_noPK_6794.test
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-# MDEV-6794 XtraDB no longer using UNIQUE as clustered index when PK missing
-#
-
---source include/have_innodb.inc
-
-create table t1 (c1 int not null, c2 int, unique index(c1), index (c2)) engine=innodb;
-insert into t1 (c1, c2) select 1, round(rand()*100);
-insert into t1 (c1, c2) select (select max(c1) from t1) + c1, c1*93563%100 from t1;
-insert into t1 (c1, c2) select (select max(c1) from t1) + c1, c1*93563%100 from t1;
-insert into t1 (c1, c2) select (select max(c1) from t1) + c1, c1*93563%100 from t1;
-select count(*) from t1;
---query_vertical explain select * from t1 where c2 = 1 order by c1
-drop table t1;
-
diff --git a/mysql-test/t/failed_auth_3909.test b/mysql-test/t/failed_auth_3909.test
deleted file mode 100644
index f72460691ea..00000000000
--- a/mysql-test/t/failed_auth_3909.test
+++ /dev/null
@@ -1,37 +0,0 @@
-source include/not_embedded.inc;
-
-#
-# MDEV-3909 remote user enumeration
-#
-# verify that for some failed login attemps (with wrong user names)
-# the server requests a plugin
-#
-optimize table mysql.user;
-insert ignore mysql.user (user,plugin) values ('foo','bar'),('bar','bar'),('baz','bar');
-flush privileges;
-
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error ER_PLUGIN_IS_NOT_LOADED
-connect (fail,localhost,u1);
-
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error ER_ACCESS_DENIED_ERROR
-connect (fail,localhost,u2);
-
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error ER_ACCESS_DENIED_ERROR
-connect (fail,localhost,u2,password);
-
---error ER_PLUGIN_IS_NOT_LOADED
-change_user u1;
-
---error ER_ACCESS_DENIED_ERROR
-change_user u2;
-
---error ER_ACCESS_DENIED_ERROR
-change_user u2,password;
-
-delete from mysql.user where plugin = 'bar';
-flush privileges;
-
-
diff --git a/mysql-test/t/failed_auth_unixsocket.test b/mysql-test/t/failed_auth_unixsocket.test
deleted file mode 100644
index f7345f44698..00000000000
--- a/mysql-test/t/failed_auth_unixsocket.test
+++ /dev/null
@@ -1,36 +0,0 @@
---source include/have_unix_socket.inc
-
-#
-# MDEV-3909 remote user enumeration
-# unix_socket tests
-#
-update mysql.user set plugin='unix_socket';
-flush privileges;
-
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT $USER USER
---error ER_PLUGIN_IS_NOT_LOADED
-connect (fail,localhost,$USER);
-
---error ER_PLUGIN_IS_NOT_LOADED
-change_user $USER;
-
-eval install plugin unix_socket soname '$AUTH_SOCKET_SO';
-
-# Make sure that the replace works, even if $USER is 'user' or something else
-# that matches other parts of the error message.
---echo connect(localhost,USER,,test,MASTER_PORT,MASTER_SOCKET);
---let $replace=Access denied for user '$USER'
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT $replace "Access denied for user 'USER'"
---disable_query_log
---error ER_ACCESS_DENIED_NO_PASSWORD_ERROR
-connect (fail,localhost,$USER);
---enable_query_log
-
---replace_result $replace "Access denied for user 'USER'"
---error ER_ACCESS_DENIED_NO_PASSWORD_ERROR
-change_user $USER;
-
-update mysql.user set plugin='';
-flush privileges;
-uninstall plugin unix_socket;
-
diff --git a/mysql-test/t/fast_prefix_index_fetch_innodb.test b/mysql-test/t/fast_prefix_index_fetch_innodb.test
deleted file mode 100644
index c3b3440d82d..00000000000
--- a/mysql-test/t/fast_prefix_index_fetch_innodb.test
+++ /dev/null
@@ -1,668 +0,0 @@
--- source include/have_innodb.inc
-
---disable_warnings
-drop table if exists prefixinno;
---enable_warnings
-
-set global innodb_prefix_index_cluster_optimization = ON;
-show variables like 'innodb_prefix_index_cluster_optimization';
-
---echo # Create a table with a large varchar field that we index the prefix
---echo # of and ensure we only trigger cluster lookups when we expect it.
-create table prefixinno (
- id int not null,
- fake_id int not null,
- bigfield varchar(4096),
- primary key(id),
- index bigfield_idx (bigfield(32)),
- index fake_id_bigfield_prefix (fake_id, bigfield(32))
-) engine=innodb;
-
-insert into prefixinno values (1, 1001, repeat('a', 1)),
- (8, 1008, repeat('b', 8)),
- (24, 1024, repeat('c', 24)),
- (31, 1031, repeat('d', 31)),
- (32, 1032, repeat('x', 32)),
- (33, 1033, repeat('y', 33)),
- (128, 1128, repeat('z', 128));
-
-select * from prefixinno;
-
-let $show_count_statement = show status like 'innodb_secondary_index_triggered_cluster_reads';
-let $show_opt_statement = show status like 'innodb_secondary_index_triggered_cluster_reads_avoided';
-
---echo # Baseline sanity check: 0, 0.
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-select "no-op query";
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval select $count - $base_count into @cluster_lookups;
-eval select $opt - $base_opt into @cluster_lookups_avoided;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
---echo # Eligible for optimization.
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-select id, bigfield from prefixinno where bigfield = repeat('d', 31);
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval select $count - $base_count into @cluster_lookups;
-eval select $opt - $base_opt into @cluster_lookups_avoided;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
---echo # Eligible for optimization, access via fake_id only.
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-select id, bigfield from prefixinno where fake_id = 1031;
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval select $count - $base_count into @cluster_lookups;
-eval select $opt - $base_opt into @cluster_lookups_avoided;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
---echo # Not eligible for optimization, access via fake_id of big row.
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-select id, bigfield from prefixinno where fake_id = 1033;
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval select $count - $base_count into @cluster_lookups;
-eval select $opt - $base_opt into @cluster_lookups_avoided;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
---echo # Not eligible for optimization.
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-select id, bigfield from prefixinno where bigfield = repeat('x', 32);
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval select $count - $base_count into @cluster_lookups;
-eval select $opt - $base_opt into @cluster_lookups_avoided;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
---echo # Not eligible for optimization.
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-select id, bigfield from prefixinno where bigfield = repeat('y', 33);
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval select $count - $base_count into @cluster_lookups;
-eval select $opt - $base_opt into @cluster_lookups_avoided;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
---echo # Eligible, should not increment lookup counter.
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-select id, bigfield from prefixinno where bigfield = repeat('b', 8);
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval select $count - $base_count into @cluster_lookups;
-eval select $opt - $base_opt into @cluster_lookups_avoided;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
---echo # Eligible, should not increment lookup counter.
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-select id, bigfield from prefixinno where bigfield = repeat('c', 24);
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval select $count - $base_count into @cluster_lookups;
-eval select $opt - $base_opt into @cluster_lookups_avoided;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
---echo # Should increment lookup counter.
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-select id, bigfield from prefixinno where bigfield = repeat('z', 128);
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval select $count - $base_count into @cluster_lookups;
-eval select $opt - $base_opt into @cluster_lookups_avoided;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
---echo # Disable optimization, confirm we still increment counter.
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-set global innodb_prefix_index_cluster_optimization = OFF;
-select id, bigfield from prefixinno where fake_id = 1033;
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval select $count - $base_count into @cluster_lookups;
-eval select $opt - $base_opt into @cluster_lookups_avoided;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
-drop table prefixinno;
-
---echo # Multi-byte handling case
-
-set global innodb_prefix_index_cluster_optimization = ON;
-SET NAMES utf8mb4;
-CREATE TABLE t1(
- f1 varchar(10) CHARACTER SET UTF8MB4 COLLATE UTF8MB4_BIN,
- INDEX (f1(3)))ENGINE=INNODB;
-
-INSERT INTO t1 VALUES('a'), ('cccc'), ('až'), ('cčc'), ('ggᵷg'), ('¢¢');
-INSERT INTO t1 VALUES('தமிழ்'), ('🐱🌑'), ('🌒'), ('🌑');
-INSERT INTO t1 VALUES('😊me'), ('eu€'), ('ls¢');
-
---echo # Eligible - record length is shorter than prefix
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'a';
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval set @cluster_lookups = $count - $base_count;
-eval set @cluster_lookups_avoided = $opt - $base_opt;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
---echo # Not eligible - record length longer than prefix length
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like 'c%';
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval set @cluster_lookups = $count - $base_count;
-eval set @cluster_lookups_avoided = $opt - $base_opt;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
---echo # Eligible - record length shorter than prefix length
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'až';
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval set @cluster_lookups = $count - $base_count;
-eval set @cluster_lookups_avoided = $opt - $base_opt;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
---echo # Not eligible - record length longer than prefix length
-
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'தமிழ்';
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval set @cluster_lookups = $count - $base_count;
-eval set @cluster_lookups_avoided = $opt - $base_opt;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
---echo # Not eligible - record length longer than prefix length
-
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like 'ggᵷ%';
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval set @cluster_lookups = $count - $base_count;
-eval set @cluster_lookups_avoided = $opt - $base_opt;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
---echo # Not eligible - record length longer than prefix length
-
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '😊%';
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval set @cluster_lookups = $count - $base_count;
-eval set @cluster_lookups_avoided = $opt - $base_opt;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
---echo # Not eligible - record length longer than prefix length
-
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'ls¢';
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval set @cluster_lookups = $count - $base_count;
-eval set @cluster_lookups_avoided = $opt - $base_opt;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
---echo # Eligible - record length shorter than prefix length
-
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '¢¢%';
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval set @cluster_lookups = $count - $base_count;
-eval set @cluster_lookups_avoided = $opt - $base_opt;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
---echo # Eligible - record length shorter than prefix length
-
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🐱🌑%';
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval set @cluster_lookups = $count - $base_count;
-eval set @cluster_lookups_avoided = $opt - $base_opt;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
---echo # Not eligible - record length longer than prefix length
-
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🌑%';
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval set @cluster_lookups = $count - $base_count;
-eval set @cluster_lookups_avoided = $opt - $base_opt;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
---echo # Not eligible - record length longer than prefix length
-
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🌒%';
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval set @cluster_lookups = $count - $base_count;
-eval set @cluster_lookups_avoided = $opt - $base_opt;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
-DROP TABLE t1;
-
---echo # Multi-byte with minimum character length > 1 bytes
-
-CREATE TABLE t1(
- f1 varchar(10) CHARACTER SET UTF16 COLLATE UTF16_BIN,
- INDEX (f1(3)))ENGINE=INNODB;
-
-INSERT INTO t1 VALUES('a'), ('cccc'), ('až'), ('cčc'), ('ggᵷg'), ('¢¢');
-INSERT INTO t1 VALUES('தமிழ்'), ('🐱🌑'), ('🌒'), ('🌑');
-INSERT INTO t1 VALUES('😊me'), ('eu€'), ('ls¢');
-
---echo # Eligible - record length is shorter than prefix
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'a';
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval set @cluster_lookups = $count - $base_count;
-eval set @cluster_lookups_avoided = $opt - $base_opt;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
---echo # Not eligible - record length longer than prefix length
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like 'c%';
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval set @cluster_lookups = $count - $base_count;
-eval set @cluster_lookups_avoided = $opt - $base_opt;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
---echo # Eligible - record length shorter than prefix length
-
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'až';
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval set @cluster_lookups = $count - $base_count;
-eval set @cluster_lookups_avoided = $opt - $base_opt;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
---echo # Not eligible - record length longer than prefix length
-
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'தமிழ்';
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval set @cluster_lookups = $count - $base_count;
-eval set @cluster_lookups_avoided = $opt - $base_opt;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
---echo # Not eligible - record length longer than prefix length
-
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like 'ggᵷ%';
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval set @cluster_lookups = $count - $base_count;
-eval set @cluster_lookups_avoided = $opt - $base_opt;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
---echo # Not eligible - record length longer than prefix length
-
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '😊%';
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval set @cluster_lookups = $count - $base_count;
-eval set @cluster_lookups_avoided = $opt - $base_opt;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
---echo # Not eligible - record length longer than prefix length
-
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 = 'ls¢';
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval set @cluster_lookups = $count - $base_count;
-eval set @cluster_lookups_avoided = $opt - $base_opt;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
---echo # Eligible - record length shorter than prefix length
-
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-SELECT f1 FROM t1 FORCE INDEX(`f1`) WHERE f1 like '¢¢%';
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval set @cluster_lookups = $count - $base_count;
-eval set @cluster_lookups_avoided = $opt - $base_opt;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
---echo # Eligible - record length shorter than prefix length
-
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🐱🌑%';
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval set @cluster_lookups = $count - $base_count;
-eval set @cluster_lookups_avoided = $opt - $base_opt;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
---echo # Eligible - record length is shorter than prefix length
-
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🌑%';
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval set @cluster_lookups = $count - $base_count;
-eval set @cluster_lookups_avoided = $opt - $base_opt;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
---echo # Eligible - record length is shorter than prefix length
-
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🌒%';
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval set @cluster_lookups = $count - $base_count;
-eval set @cluster_lookups_avoided = $opt - $base_opt;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
-DROP TABLE t1;
-
-CREATE TABLE t1(
- col1 INT,
- col2 BLOB DEFAULT NULL,
- INDEX `idx1`(col2(4), col1))ENGINE=INNODB;
-INSERT INTO t1 VALUES (2, 'test'), (3, repeat('test1', 2000));
-INSERT INTO t1(col1) VALUES(1);
-
---echo # Eligible - record length is shorter than prefix length
-
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-SELECT col1 FROM t1 FORCE INDEX (`idx1`) WHERE col2 is NULL;
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval set @cluster_lookups = $count - $base_count;
-eval set @cluster_lookups_avoided = $opt - $base_opt;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
---echo # Not eligible - record length longer than prefix index
-
-let $base_count = query_get_value($show_count_statement, Value, 1);
-let $base_opt = query_get_value($show_opt_statement, Value, 1);
-
-SELECT col1 FROM t1 FORCE INDEX (`idx1`) WHERE col2 like 'test1%';
-
-let $count = query_get_value($show_count_statement, Value, 1);
-let $opt = query_get_value($show_opt_statement, Value, 1);
-
---disable_query_log
-eval set @cluster_lookups = $count - $base_count;
-eval set @cluster_lookups_avoided = $opt - $base_opt;
---enable_query_log
-
-select @cluster_lookups;
-select @cluster_lookups_avoided;
-
-DROP TABLE t1;
-set global innodb_prefix_index_cluster_optimization = OFF;
diff --git a/mysql-test/t/features.test b/mysql-test/t/features.test
deleted file mode 100644
index 1241bd50bdd..00000000000
--- a/mysql-test/t/features.test
+++ /dev/null
@@ -1,141 +0,0 @@
-# Testing of feature statistics
-
--- source include/have_geometry.inc
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-set sql_mode="";
-
-flush status;
-
-show status like "feature%";
-
---echo #
---echo # Feature GIS
---echo #
-
-CREATE TABLE t1 (g POINT);
-SHOW FIELDS FROM t1;
-INSERT INTO t1 VALUES
- (PointFromText('POINT(10 10)')),
- (PointFromText('POINT(20 10)')),
- (PointFromText('POINT(20 20)')),
- (PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
-drop table t1;
-
-show status like "feature_gis";
-
---echo #
---echo # Feature dynamic columns
---echo #
-set @a= COLUMN_CREATE(1, 1212 AS int);
-set @b= column_add(@a, 2, 1212 as integer);
-select column_get(@b, 2 as integer);
-
-show status like "feature_dynamic_columns";
-
---echo #
---echo # Feature fulltext
---echo #
-
-CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b)) engine=myisam;
-INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),
- ('Full-text indexes', 'are called collections'),
- ('Only MyISAM tables','support collections'),
- ('Function MATCH ... AGAINST()','is used to do a search'),
- ('Full-text search in MySQL', 'implements vector space model');
-select * from t1 where MATCH(a,b) AGAINST ("collections");
-select * from t1 where MATCH(a,b) AGAINST ("indexes");
-drop table t1;
-
-# We need the following when running with --ps-protocol
---replace_result 4 2
-show status like "feature_fulltext";
-
-
---echo #
---echo # Feature locale
---echo #
-
-SET lc_messages=sr_RS;
-SET lc_messages=en_US;
-show status like "feature_locale";
-
---echo #
---echo # Feature subquery
---echo #
-
-select (select 2);
-SELECT (SELECT 1) UNION SELECT (SELECT 2);
-
-create table t1 (a int);
-insert into t1 values (2);
-select (select a from t1 where t1.a=t2.a), a from t1 as t2;
-drop table t1;
---replace_result 8 4
-show status like "feature_subquery";
-
---echo #
---echo # Feature timezone
---echo #
-
-SELECT FROM_UNIXTIME(unix_timestamp()) > "1970-01-01";
-set time_zone="+03:00";
-SELECT FROM_UNIXTIME(unix_timestamp()) > "1970-01-01";
-set time_zone= @@global.time_zone;
-show status like "feature_timezone";
-
---echo #
---echo # Feature triggers
---echo #
-
-create table t1 (i int);
---echo # let us test some very simple trigger
-create trigger trg before insert on t1 for each row set @a:=1;
-set @a:=0;
-select @a;
-insert into t1 values (1),(2);
-select @a;
---replace_column 6 #
-SHOW TRIGGERS IN test like 't1';
-drop trigger trg;
-drop table t1;
-
-show status like "%trigger%";
-
---echo #
---echo # Feature xml
---echo #
-SET @xml='<a aa1="aa1" aa2="aa2">a1<b ba1="ba1">b1<c>c1</c>b2</b>a2</a>';
-SELECT extractValue(@xml,'/a');
-select updatexml('<div><div><span>1</span><span>2</span></div></div>',
- '/','<tr><td>1</td><td>2</td></tr>') as upd1;
---replace_result 4 2
-show status like "feature_xml";
-
-
---echo #
---echo # Feature delayed_keys
---echo #
-
-create table t1 (a int, key(a)) engine=myisam delay_key_write=1;
-insert into t1 values(1);
-insert into t1 values(2);
-drop table t1;
-
-create table t1 (a int, key(a)) engine=aria delay_key_write=1;
-insert into t1 values(1);
-insert into t1 values(2);
-drop table t1;
-
-show status like "feature_delay_key_write";
-
-#
-# Feature CHECK CONSTRAINT
-#
-create table t1 (a int check (a > 5));
-create table t2 (b int, constraint foo check (b < 10));
-drop table t1, t2;
-show status like "feature_check_constraint";
diff --git a/mysql-test/t/file_contents.test b/mysql-test/t/file_contents.test
deleted file mode 100644
index 4734a0294f0..00000000000
--- a/mysql-test/t/file_contents.test
+++ /dev/null
@@ -1,70 +0,0 @@
-#
-# Testing files that were built to be packaged, both for existence and for contents
-#
-
-#
-# Bug #42969: Create MANIFEST files
-#
-# Use a Perl script to verify that files "docs/INFO_BIN" and "docs/INFO_SRC" do exist
-# and have the expected contents.
-
---perl
-print "\nChecking 'INFO_SRC' and 'INFO_BIN'\n";
-$dir_bin = $ENV{'MYSQL_BINDIR'};
-if ($dir_bin eq '/usr/') {
- # RPM package
- $dir_docs = $dir_bin;
- $dir_docs =~ s|/lib|/share/doc|;
- if(-d "$dir_docs/packages") {
- # SuSE: "packages/" in the documentation path
- $dir_docs = glob "$dir_docs/packages/MariaDB-server*";
- } else {
- # RedHat: version number in directory name
- $dir_docs = glob "$dir_docs/MariaDB-server*";
- }
-} elsif ($dir_bin eq '/usr') {
- # RPM build during development
- $dir_docs = "$dir_bin/share/doc";
- if(-d "$dir_docs/packages") {
- # SuSE: "packages/" in the documentation path
- $dir_docs = glob "$dir_docs/packages/MariaDB-server*";
- } else {
- # RedHat/Debian: version number in directory name
- $dir_docs = glob "$dir_docs/mariadb-server-*";
- $dir_docs = glob "$dir_docs/MariaDB-server*" unless -d $dir_docs;
- }
- # Slackware
- $dir_docs = glob "$dir_bin/doc/mariadb-[0-9]*" unless -d $dir_docs;
-} else {
- # tar.gz package, Windows, or developer work (in git)
- $dir_docs = $dir_bin;
- if(-d "$dir_docs/docs") {
- $dir_docs = "$dir_docs/docs"; # package
- } else {
- $dir_docs = "$dir_docs/Docs"; # development tree
- }
-}
-$found_version = "No line 'MariaDB source #.#.#' in $dir_docs/INFO_SRC";
-$found_revision = "No line 'revision-id: .....' in $dir_docs/INFO_SRC";
-open(I_SRC,"<","$dir_docs/INFO_SRC") or print "Cannot open 'INFO_SRC' in '$dir_docs' (starting from bindir '$dir_bin')\n";
-while(defined ($line = <I_SRC>)) {
- if ($line =~ m|^MariaDB source \d+\.\d\.\d+|) {$found_version = "Found MariaDB version number";}
- if ($line =~ m|^commit: \w{40}$|) {$found_revision = "Found GIT revision id";}
-}
-close I_SRC;
-print "INFO_SRC: $found_version / $found_revision\n";
-$found_compiler = "No line about compiler information";
-$found_features = "No line 'Feature flags'";
-open(I_BIN,"<","$dir_docs/INFO_BIN") or print "Cannot open 'INFO_BIN' in '$dir_docs' (starting from bindir '$dir_bin')\n";
-while(defined ($line = <I_BIN>)) {
- # "generator" on Windows, "flags" on Unix:
- if (($line =~ m| Compiler / generator used: |) ||
- ($line =~ m| Compiler flags used |)) {$found_compiler = "Found 'Compiler ... used' line";}
- if ($line =~ m| Feature flags used:|) {$found_features = "Found 'Feature flags' line";}
-}
-close I_BIN;
-print "INFO_BIN: $found_compiler / $found_features\n";
-EOF
-
---echo
---echo End of tests
diff --git a/mysql-test/t/filesort_bad_i_s-7585.test b/mysql-test/t/filesort_bad_i_s-7585.test
deleted file mode 100644
index daf70acdd52..00000000000
--- a/mysql-test/t/filesort_bad_i_s-7585.test
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# MDEV-7585 Assertion `thd->is_error() || kill_errno || thd->killed == ABORT_QUERY' failed in ha_rows filesort
-#
-SET sql_mode=STRICT_TRANS_TABLES;
-
-CREATE TABLE t0 (i INT) ENGINE=MyISAM;
-CREATE VIEW v1 AS SELECT * FROM t0;
-CREATE VIEW v2 AS SELECT * FROM v1;
-DROP VIEW IF EXISTS v1;
-
-CREATE TABLE t1 (i INT) ENGINE=MyISAM;
-INSERT INTO t1 SELECT TABLE_ROWS FROM information_schema.tables ORDER BY TABLE_ROWS;
-DROP VIEW v2;
-DROP TABLE t1, t0;
diff --git a/mysql-test/t/filesort_debug.test b/mysql-test/t/filesort_debug.test
deleted file mode 100644
index a8833617c09..00000000000
--- a/mysql-test/t/filesort_debug.test
+++ /dev/null
@@ -1,101 +0,0 @@
---source include/have_debug.inc
---source include/have_debug_sync.inc
---source include/count_sessions.inc
-
-call mtr.add_suppression("Sort aborted.*");
-
-SET @old_debug= @@session.debug;
-
---echo #
---echo # Bug#36022 please log more information about "Sort aborted" queries
---echo #
-
-CREATE TABLE t1(f0 int auto_increment primary key, f1 int);
-INSERT INTO t1(f1) VALUES (0),(1),(2),(3),(4),(5);
-
-SET session debug_dbug= '+d,alloc_sort_buffer_fail';
-CALL mtr.add_suppression("Out of sort memory");
---error ER_OUT_OF_SORTMEMORY
-SELECT * FROM t1 ORDER BY f1 ASC, f0;
-SET session debug_dbug= @old_debug;
-
-CREATE FUNCTION f1() RETURNS INT RETURN 1;
---error ER_SP_WRONG_NO_OF_ARGS
-DELETE FROM t1 ORDER BY (f1(10)) LIMIT 1;
-
-DROP TABLE t1;
-DROP FUNCTION f1;
-
---echo #
---echo # Bug #11747102
---echo # 30771: LOG MORE INFO ABOUT THREADS KILL'D AND SORT ABORTED MESSAGES
---echo #
-
-connect (con1, localhost, root);
-connect (con2, localhost, root);
-
-connection con1;
-CREATE TABLE t1(f0 int auto_increment primary key, f1 int);
-INSERT INTO t1(f1) VALUES (0),(1),(2),(3),(4),(5);
-
-let $ID= `SELECT @id := CONNECTION_ID()`;
-
-SET DEBUG_SYNC='filesort_start SIGNAL filesort_started WAIT_FOR filesort_killed';
---echo # Sending: (not reaped since connection is killed later)
---send SELECT * FROM t1 ORDER BY f1 ASC, f0
-
-connection con2;
-let $ignore= `SELECT @id := $ID`;
-SET DEBUG_SYNC='now WAIT_FOR filesort_started';
-KILL @id;
-SET DEBUG_SYNC='now SIGNAL filesort_killed';
-
-connection default;
-disconnect con1;
-disconnect con2;
---source include/wait_until_count_sessions.inc
-SET DEBUG_SYNC= "RESET";
-DROP TABLE t1;
-
---echo #
---echo # Bug#13832772 ASSERTION `THD->IS_ERROR() || KILL_ERRNO'
---echo # FAILED IN FILESORT/MYSQL_DELETE
---echo #
-
-CREATE TABLE t1 (
- c1 BLOB,
- c2 TEXT,
- c3 TEXT,
- c4 TEXT,
- c5 TEXT,
- c6 TEXT,
- c7 TEXT,
- c8 BLOB,
- c9 TEXT,
- c19 TEXT,
- pk INT,
- c20 TEXT,
- c21 BLOB,
- c22 TEXT,
- c23 TEXT,
- c24 TEXT,
- c25 TEXT,
- c26 BLOB,
- c27 TEXT,
- c28 TEXT,
- primary key (pk)
-);
-
-CALL mtr.add_suppression("Out of sort memory");
-
---error ER_OUT_OF_SORTMEMORY
-DELETE IGNORE FROM t1 ORDER BY c26,c7,c23,c4,c25,c5,c20,
-c19,c21,c8,c1,c27,c28,c3,c9,c22,c24,c6,c2,pk LIMIT 2;
-SHOW WARNINGS;
-
---error ER_OUT_OF_SORTMEMORY
-DELETE FROM t1 ORDER BY c26,c7,c23,c4,c25,c5,c20,
-c19,c21,c8,c1,c27,c28,c3,c9,c22,c24,c6,c2,pk LIMIT 2;
-SHOW WARNINGS;
-
-DROP TABLE t1;
diff --git a/mysql-test/t/fix_priv_tables.test b/mysql-test/t/fix_priv_tables.test
deleted file mode 100644
index 293d3915a05..00000000000
--- a/mysql-test/t/fix_priv_tables.test
+++ /dev/null
@@ -1,81 +0,0 @@
-# Embedded server doesn't support external clients
---source include/not_embedded.inc
-
-# Don't run this test if $MYSQL_FIX_PRIVILEGE_TABLES isn't set
-# to the location of mysql_fix_privilege_tables.sql
-if (!$MYSQL_FIX_PRIVILEGE_TABLES)
-{
- skip Test need MYSQL_FIX_PRIVILEGE_TABLES;
-}
-
-#
-# This is the test for mysql_fix_privilege_tables
-# It checks that a system tables from mysql 4.1.23
-# can be upgraded to current system table format
-#
-# Note: If this test fails, don't be confused about the errors reported
-# by mysql-test-run This shows warnings generated by
-# mysql_fix_system_tables which should be ignored.
-# Instead, concentrate on the errors in r/system_mysql_db.reject
-
---disable_warnings
-drop table if exists t1,t1aa,t2aa;
---enable_warnings
-
-set sql_mode="";
-
-#
-# Bug #20589 Missing some table level privileges after upgrade
-#
-# Add some grants that should survive the "upgrade"
-
---disable_warnings
-DROP DATABASE IF EXISTS testdb;
---enable_warnings
-CREATE DATABASE testdb;
-CREATE TABLE testdb.t1 (
- c1 INT,
- c3 INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
-
-CREATE VIEW testdb.v1 AS
- SELECT * FROM testdb.t1;
-
-GRANT CREATE VIEW, SHOW VIEW ON testdb.v1 TO 'show_view_tbl'@'localhost';
-SHOW GRANTS FOR 'show_view_tbl'@'localhost';
-echo;
-
-# Some extra GRANTS for more complete test
-GRANT SELECT(c1) on testdb.v1 to 'select_only_c1'@localhost;
-SHOW GRANTS FOR 'select_only_c1'@'localhost';
-echo;
-
--- disable_result_log
--- disable_query_log
-
-# Run the mysql_fix_privilege_tables.sql using "mysql --force"
-# Determine the number of open sessions
---source include/count_sessions.inc
---exec $MYSQL --force mysql < $MYSQL_FIX_PRIVILEGE_TABLES > $MYSQLTEST_VARDIR/tmp/fix_priv_tables.log 2>&1
---remove_file $MYSQLTEST_VARDIR/tmp/fix_priv_tables.log
-# Wait till the number of open sessions is <= the number before the run with $MYSQL
-# = The session caused by mysql has finished its disconnect
---source include/wait_until_count_sessions.inc
-
--- enable_query_log
--- enable_result_log
-
-echo "after fix privs";
-
-SHOW GRANTS FOR 'show_view_tbl'@'localhost';
-echo;
-SHOW GRANTS FOR 'select_only_c1'@'localhost';
-echo;
-
-DROP USER 'show_view_tbl'@'localhost';
-DROP USER 'select_only_c1'@'localhost';
-
-DROP VIEW testdb.v1;
-DROP TABLE testdb.t1;
-DROP DATABASE testdb;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/flush-innodb-notembedded.test b/mysql-test/t/flush-innodb-notembedded.test
deleted file mode 100644
index 1f73ba50fc4..00000000000
--- a/mysql-test/t/flush-innodb-notembedded.test
+++ /dev/null
@@ -1,61 +0,0 @@
---source include/have_innodb.inc
---source include/not_embedded.inc
-
-set sql_mode="";
-
---echo # Test 7: Check privileges required.
---echo #
-
-CREATE DATABASE db1;
-CREATE TABLE db1.t1 (a INT) engine= InnoDB;
-GRANT RELOAD, SELECT, LOCK TABLES ON *.* TO user1@localhost;
-GRANT CREATE, DROP ON *.* TO user2@localhost;
-GRANT RELOAD, SELECT ON *.* TO user3@localhost;
-GRANT SELECT, LOCK TABLES ON *.* TO user4@localhost;
-GRANT RELOAD, LOCK TABLES ON *.* TO user5@localhost;
-
---connect(con1, localhost, user1)
-FLUSH TABLE db1.t1 FOR EXPORT;
-UNLOCK TABLES;
---disconnect con1
---source include/wait_until_disconnected.inc
-
---connection default
-
---connect(con1, localhost, user2)
---error ER_SPECIFIC_ACCESS_DENIED_ERROR
-FLUSH TABLE db1.t1 FOR EXPORT;
---disconnect con1
---source include/wait_until_disconnected.inc
-
---connection default
-
---connect(con1, localhost, user3)
---error ER_DBACCESS_DENIED_ERROR
-FLUSH TABLE db1.t1 FOR EXPORT;
---disconnect con1
---source include/wait_until_disconnected.inc
-
---connection default
-
---connect(con1, localhost, user4)
---error ER_SPECIFIC_ACCESS_DENIED_ERROR
-FLUSH TABLE db1.t1 FOR EXPORT;
---disconnect con1
---source include/wait_until_disconnected.inc
-
---connection default
-
---connect(con1, localhost, user5)
---error ER_TABLEACCESS_DENIED_ERROR
-FLUSH TABLE db1.t1 FOR EXPORT;
---disconnect con1
---source include/wait_until_disconnected.inc
-
---connection default
-DROP USER user1@localhost, user2@localhost, user3@localhost,
- user4@localhost, user5@localhost;
-DROP TABLE db1.t1;
-DROP DATABASE db1;
-
---echo # End of 5.6 tests
diff --git a/mysql-test/t/flush-innodb.test b/mysql-test/t/flush-innodb.test
deleted file mode 100644
index bf7b79bb5a3..00000000000
--- a/mysql-test/t/flush-innodb.test
+++ /dev/null
@@ -1,434 +0,0 @@
---source include/have_innodb.inc
-
-# MDEV-254: Server hang with FLUSH TABLES WITH READ LOCK AND DISABLE CHECKPOINT
-FLUSH TABLES WITH READ LOCK AND DISABLE CHECKPOINT;
-UNLOCK TABLES;
-CREATE TABLE t1 ( m MEDIUMTEXT ) ENGINE=InnoDB;
-INSERT INTO t1 VALUES ( REPEAT('i',65535) );
-
-DROP TABLE t1;
-
---echo
---echo #
---echo # WL#6168: FLUSH TABLES ... FOR EXPORT -- parser
---echo #
---echo
-
---echo # Requires innodb_file_per_table
-SET @old_innodb_file_per_table= @@GLOBAL.innodb_file_per_table;
-SET GLOBAL innodb_file_per_table= 1;
-
---echo # new "EXPORT" keyword is a valid user variable name:
-
-SET @export = 10;
-
---echo # new "EXPORT" keyword is a valid SP parameter name:
-
-CREATE PROCEDURE p1(export INT) BEGIN END;
-DROP PROCEDURE p1;
-
---echo # new "EXPORT" keyword is a valid local variable name:
-
-DELIMITER |;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE export INT;
-END|
-DELIMITER ;|
-DROP PROCEDURE p1;
-
---echo # new "EXPORT" keyword is a valid SP name:
-
-CREATE PROCEDURE export() BEGIN END;
-DROP PROCEDURE export;
-
---echo # new FLUSH TABLES ... FOR EXPORT syntax:
-
---error ER_PARSE_ERROR
-FLUSH TABLES FOR EXPORT;
---error ER_PARSE_ERROR
-FLUSH TABLES WITH EXPORT;
-
-
-CREATE TABLE t1 (i INT) engine=InnoDB;
-CREATE TABLE t2 LIKE t1;
-
---error ER_PARSE_ERROR
-FLUSH TABLES t1,t2 WITH EXPORT;
-
-FLUSH TABLES t1, t2 FOR EXPORT;
-UNLOCK TABLES;
-
---echo # case check
-FLUSH TABLES t1, t2 for ExPoRt;
-UNLOCK TABLES;
---echo # With LOCAL keyword
-FLUSH LOCAL TABLES t1, t2 FOR EXPORT;
-UNLOCK TABLES;
---echo # Tables with fully qualified names
-FLUSH LOCAL TABLES test.t1, test.t2 for ExPoRt;
-UNLOCK TABLES;
-
-DROP TABLES t1, t2;
-
---echo # new "EXPORT" keyword is a valid table name:
-
-CREATE TABLE export (i INT) engine=InnoDB;
-
---echo # it's ok to lock the "export" table for export:
-
-FLUSH TABLE export FOR EXPORT;
-UNLOCK TABLES;
-
-DROP TABLE export;
-
-
---echo #
---echo # WL#6169 FLUSH TABLES ... FOR EXPORT -- runtime
---echo #
-
---echo # Test 1: Views, temporary tables, non-existent tables
---echo #
-
-CREATE VIEW v1 AS SELECT 1;
-CREATE TEMPORARY TABLE t1 (a INT);
-
---error ER_WRONG_OBJECT
-FLUSH TABLES v1 FOR EXPORT;
---error ER_NO_SUCH_TABLE
-FLUSH TABLES t1 FOR EXPORT;
---error ER_NO_SUCH_TABLE
-FLUSH TABLES non_existent FOR EXPORT;
-
-DROP TEMPORARY TABLE t1;
-DROP VIEW v1;
-
---echo # Test 2: Blocked by update transactions, blocks updates.
---echo #
-
-CREATE TABLE t1 (a INT PRIMARY KEY, b INT) engine= InnoDB;
-CREATE TABLE t2 (a INT) engine= InnoDB;
-
---connect (con1, localhost, root)
-START TRANSACTION;
-INSERT INTO t1 VALUES (1, 1);
-
---connection default
---echo # Should be blocked
---echo # Sending:
---send FLUSH TABLES t1 FOR EXPORT
-
---connection con1
-let $wait_condition=
- SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for table metadata lock" AND
- info = "FLUSH TABLES t1 FOR EXPORT";
---source include/wait_condition.inc
-COMMIT;
-
---connection default
---echo # Reaping: FLUSH TABLES t1 FOR EXPORT
---reap
-
---connection con1
---echo # Should not be blocked
-INSERT INTO t2 VALUES (1);
---echo # Should be blocked
---echo # Sending:
---send INSERT INTO t1 VALUES (2, 2)
-
---connection default
-let $wait_condition=
- SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for table metadata lock" AND
- info = "INSERT INTO t1 VALUES (2, 2)";
---source include/wait_condition.inc
-UNLOCK TABLES;
-
---connection con1
---echo # Reaping: INSERT INTO t1 VALUES (2, 2);
---reap
-
---echo # Test 3: Read operations should not be affected.
---echo #
-
-START TRANSACTION;
-SELECT * FROM t1;
-
---connection default
---echo # Should not be blocked
-FLUSH TABLES t1 FOR EXPORT;
-
---connection con1
-COMMIT;
---echo # Should not be blocked
-SELECT * FROM t1;
-
---connection default
-UNLOCK TABLES;
-
---echo # Test 4: Blocked by DDL, blocks DDL.
---echo #
-
-START TRANSACTION;
-SELECT * FROM t1;
-
---connect (con2, localhost, root)
---echo # Sending:
---send ALTER TABLE t1 ADD INDEX i1(b)
-
---connection con1
-let $wait_condition=
- SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for table metadata lock" AND
- info = "ALTER TABLE t1 ADD INDEX i1(b)";
---source include/wait_condition.inc
---echo # Should be blocked
---send FLUSH TABLE t1 FOR EXPORT
-
---connection default
-let $wait_condition=
- SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for table metadata lock" AND
- info = "FLUSH TABLE t1 FOR EXPORT";
---source include/wait_condition.inc
-COMMIT;
-
---connection con2
---echo # Reaping ALTER TABLE ...
---reap
-
---connection con1
---echo # Reaping FLUSH TABLE t1 FOR EXPORT
---reap
-UNLOCK TABLES;
-
---connection default
-FLUSH TABLE t1 FOR EXPORT;
-
---connection con2
---echo # Should be blocked
---send DROP TABLE t1
-
---connection default
-let $wait_condition=
- SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for table metadata lock" AND
- info = "DROP TABLE t1";
---source include/wait_condition.inc
-UNLOCK TABLES;
-
---connection con2
---echo # Reaping DROP TABLE t1
---reap
---disconnect con2
---source include/wait_until_disconnected.inc
-
---connection default
-DROP TABLE t2;
-
---echo # Test 5: Compatibilty with FLUSH TABLES WITH READ LOCK
---echo #
-
-CREATE TABLE t1(a INT) engine= InnoDB;
-FLUSH TABLES WITH READ LOCK;
-
---connection con1
---echo # This should not block
-FLUSH TABLE t1 FOR EXPORT;
-UNLOCK TABLES;
-
---connection default
-UNLOCK TABLES;
-DROP TABLE t1;
-
---echo # Test 6: Unsupported storage engines.
---echo #
-
-CREATE TABLE t1(a INT) engine= MEMORY;
---error ER_ILLEGAL_HA
-FLUSH TABLE t1 FOR EXPORT;
-DROP TABLE t1;
-
---connection con1
---disconnect con1
---source include/wait_until_disconnected.inc
-
---connection default
-
---echo # Test 7: Check privileges required.
---echo # in flush-innodb-notembedded.test
-
---echo # Test 8: FLUSH TABLE <table_list> FOR EXPORT is incompatible
---echo # with itself (to avoid race conditions in metadata
---echo # file handling).
---echo #
-
-CREATE TABLE t1 (a INT) engine= InnoDB;
-CREATE TABLE t2 (a INT) engine= InnoDB;
-
---connect (con1, localhost, root)
-FLUSH TABLE t1 FOR EXPORT;
-
---connection default
---echo # This should not block
-FLUSH TABLE t2 FOR EXPORT;
-UNLOCK TABLES;
---echo # This should block
---echo # Sending:
---send FLUSH TABLE t1 FOR EXPORT
-
---connection con1
-let $wait_condition=
- SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for table metadata lock" AND
- info = "FLUSH TABLE t1 FOR EXPORT";
---source include/wait_condition.inc
-UNLOCK TABLES;
-
---connection default
---echo # Reaping: FLUSH TABLE t1 FOR EXPORT
---reap
-UNLOCK TABLES;
-
---echo # Test 9: LOCK TABLES ... READ is not affected
---echo #
-
-LOCK TABLE t1 READ;
-
---connection con1
---echo # Should not block
-FLUSH TABLE t1 FOR EXPORT;
-UNLOCK TABLES;
-
---connection default
-UNLOCK TABLES;
-FLUSH TABLE t1 FOR EXPORT;
-
---connection con1
---echo # Should not block
-LOCK TABLE t1 READ;
-UNLOCK TABLES;
-
---connection default
-UNLOCK TABLES;
-
---connection con1
---disconnect con1
---source include/wait_until_disconnected.inc
-
---connection default
-DROP TABLE t1, t2;
-
---echo # Test 10: Lock is released if transaction is started after doing
---echo # 'flush table..' in same session
-
-CREATE TABLE t1 ( i INT ) ENGINE = Innodb;
-FLUSH TABLE t1 FOR EXPORT;
---echo # error as active locks already exist
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-FLUSH TABLE t1 FOR EXPORT;
---echo # active locks will be released due to start transaction
-START TRANSACTION;
---echo # passes as start transaction released ealier locks
-FLUSH TABLE t1 FOR EXPORT;
-UNLOCK TABLES;
-DROP TABLE t1;
-
---echo # Test 11: Test 'flush table with fully qualified table names
---echo # and with syntax local/NO_WRITE_TO_BINLOG
-
---connect (con1, localhost, root)
-
---connection default
-CREATE TABLE t1 ( i INT ) ENGINE = Innodb;
-INSERT INTO t1 VALUES (100),(200);
-FLUSH LOCAL TABLES test.t1 FOR EXPORT;
---connection con1
---echo # Should be blocked
---echo # Sending:
---send FLUSH LOCAL TABLES t1 FOR EXPORT
-
---connection default
-let $wait_condition=
- SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for table metadata lock" AND
- info = "FLUSH LOCAL TABLES t1 FOR EXPORT";
---source include/wait_condition.inc
-UNLOCK TABLE;
-
---connection con1
---echo # Reaping: FLUSH LOCAL TABLES t1 FOR EXPORT
---reap
-SELECT * FROM t1 ORDER BY i;
-
---connection default
---echo # Should be blocked
---echo # Sending:
---send FLUSH NO_WRITE_TO_BINLOG TABLES test.t1 FOR EXPORT
-
---connection con1
-let $wait_condition=
- SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for table metadata lock" AND
- info = "FLUSH NO_WRITE_TO_BINLOG TABLES test.t1 FOR EXPORT";
---source include/wait_condition.inc
-UNLOCK TABLES;
-
---connection default
---echo # Reaping: FLUSH NO_WRITE_TO_BINLOG TABLES test.t1 FOR EXPORT
---reap
-SELECT * FROM t1 ORDER BY i;
-UNLOCK TABLE;
-DROP TABLE t1;
-
---echo # Test 12: Active transaction get committed if user execute
---echo # "FLUSH TABLE ... FOR EXPORT" or "LOCK TABLE.."
-
---connection default
-CREATE TABLE t1 ( i INT ) ENGINE = Innodb;
-INSERT INTO t1 VALUES (100),(200);
-START TRANSACTION;
-INSERT INTO t1 VALUES (300);
---echo # 'flush table..' commit active transaction from same session
-FLUSH LOCAL TABLES test.t1 FOR EXPORT;
-ROLLBACK;
-SELECT * FROM t1 ORDER BY i;
-START TRANSACTION;
-INSERT INTO t1 VALUES (400);
---echo # 'lock table ..' commit active transaction from same session
-LOCK TABLES test.t1 READ;
-ROLLBACK;
-SELECT * FROM t1 ORDER BY i;
-UNLOCK TABLES;
-DROP TABLE t1;
-
---echo # Test 13: Verify "FLUSH TABLE ... FOR EXPORT" and "LOCK TABLE.."
---echo # in same session
-
---connection default
-CREATE TABLE t1 ( i INT ) ENGINE = Innodb;
---echo # Lock table
-LOCK TABLES test.t1 WRITE;
---echo # 'lock table ..' completes even if table lock is acquired
---echo # in same session using 'lock table'. Previous locks are released.
-LOCK TABLES test.t1 READ;
---echo # 'flush table ..' gives error if table lock is acquired
---echo # in same session using 'lock table ..'
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-FLUSH TABLES test.t1 FOR EXPORT;
---echo # 'lock table ..' completes even if table lock is acquired
---echo # in same session using 'flush table'. Previous locks are released.
-LOCK TABLES test.t1 WRITE;
-UNLOCK TABLES;
-DROP TABLE t1;
-
---connection con1
---disconnect con1
---source include/wait_until_disconnected.inc
---connection default
-
---echo # Reset innodb_file_per_table
-SET GLOBAL innodb_file_per_table= @old_innodb_file_per_table;
-
---echo # End of 5.6 tests
diff --git a/mysql-test/t/flush.test b/mysql-test/t/flush.test
deleted file mode 100644
index 81834b7de10..00000000000
--- a/mysql-test/t/flush.test
+++ /dev/null
@@ -1,675 +0,0 @@
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-connection con1;
-
---disable_warnings
-drop table if exists t1,t2;
-drop database if exists mysqltest;
---enable_warnings
-
-create temporary table t1(n int not null primary key);
-create table t2(n int);
-insert into t2 values(3);
-let $1=100;
-disable_query_log;
-while ($1)
-{
- connection con1;
- send replace into t1 select n from t2;
- connection con2;
- send flush tables;
- connection con1;
- reap;
- connection con2;
- reap;
- dec $1;
-}
-enable_query_log;
-connection con1;
-select * from t1;
-connection con2;
-flush tables with read lock and disable checkpoint;
---error 1223
-drop table t2;
-connection con1;
-send drop table t2;
-connection con2;
-unlock tables;
-connection con1;
-reap;
-
-#test if drop database will wait until we release the global read lock
-connection con1;
-create database mysqltest;
-create table mysqltest.t1(n int);
-insert into mysqltest.t1 values (23);
-flush tables with read lock;
-connection con2;
-send drop database mysqltest;
-connection con1;
-select * from mysqltest.t1;
-unlock tables;
-connection con2;
-reap;
-
-# test if dirty close releases global read lock
-connection con1;
-create table t1 (n int);
-flush tables with read lock;
-dirty_close con1;
-connection con2;
-insert into t1 values (345);
-select * from t1;
-drop table t1;
-
-#
-# Bug#9459 - deadlock with flush with lock, and lock table write
-#
-create table t1 (c1 int);
-lock table t1 write;
-# Cannot get the global read lock with write locked tables.
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-flush tables with read lock;
-lock table t1 read;
-# Cannot get the global read lock with read locked tables.
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-flush tables with read lock;
-unlock tables;
-flush tables with read lock;
---error 1223
-lock table t1 write;
-lock table t1 read;
---error 1223
-lock table t1 write;
-# Release all table locks and the global read lock.
-unlock tables;
-create table t2 (c1 int);
-create table t3 (c1 int);
-lock table t1 read, t2 read, t3 write;
-# Cannot get the global read lock with write locked tables.
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-flush tables with read lock;
-lock table t1 read, t2 read, t3 read;
-# Cannot get the global read lock with read locked tables.
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-flush tables with read lock;
-unlock tables;
-drop table t1, t2, t3;
-
-# End of 4.1 tests
-
-#
-# Test of deadlock problem when doing FLUSH TABLE with read lock
-# (Bug was in NTPL threads in Linux when using different mutex while
-# waiting for a condtion variable)
-
-create table t1 (c1 int);
-create table t2 (c1 int);
-
-connect (con1,localhost,root,,);
-connect (con3,localhost,root,,);
-
-connection con1;
-lock table t1 write;
-
-connection con2;
-send flush tables with read lock;
---sleep 1
-
-connection con3;
-send insert into t2 values(1);
---sleep 1
-
-connection con1;
-unlock tables;
-disconnect con1;
-
-connection con2;
-reap;
-disconnect con2;
-
-connection con3;
-# It hangs here (insert into t2 does not end).
-reap;
-disconnect con3;
-
-connection default;
-drop table t1, t2;
-
-#
-# Bug#32528 Global read lock with a low priority write lock causes a server crash
-#
-
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-
-set session low_priority_updates=1;
-
-create table t1 (a int);
-create table t2 (b int);
-
-lock tables t1 write;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-flush tables with read lock;
-unlock tables;
-
-lock tables t1 read, t2 write;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-flush tables with read lock;
-unlock tables;
-
-lock tables t1 read;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-flush tables with read lock;
-unlock tables;
-
-drop table t1, t2;
-
-set session low_priority_updates=default;
-
-#
-# Bug #33334 mysqltest_embedded crashes when disconnecting before reap
-#
-
-connect (con1,localhost,root,,);
-send select benchmark(200, (select sin(1))) > 1000;
-disconnect con1;
---source include/wait_until_disconnected.inc
-connection default;
-
---echo End of 5.0 tests
-
-#
-# Bug #26380: LOCK TABLES + FLUSH LOGS causes deadlock
-#
-set @old_general_log= @@general_log;
-set @old_read_only= @@read_only;
-set global general_log= on;
-
-flush tables with read lock;
-flush logs;
-unlock tables;
-
-set global read_only=1;
-flush logs;
-unlock tables;
-
-flush tables with read lock;
-flush logs;
-unlock tables;
-
-set global general_log= @old_general_log;
-set global read_only= @old_read_only;
-
---echo End of 5.1 tests
-
-
---echo #
---echo # Additional test for bug #51136 "Crash in pthread_rwlock_rdlock
---echo # on TEMPORARY + HANDLER + LOCK + SP".
---echo # Also see the main test for this bug in include/handler.inc.
---echo #
---disable_warnings
-drop tables if exists t1, t2;
---enable_warnings
-create table t1 (i int);
-create temporary table t2 (j int);
-flush tables with read lock;
-lock table t2 read;
---echo # This commit should not release any MDL locks.
-commit;
---echo # The below statement crashed before the bug fix as it
---echo # has attempted to release global shared metadata lock
---echo # which was already released by commit.
-unlock tables;
-drop tables t1, t2;
-
-
-
---echo #
---echo # Tests for WL#5000 FLUSH TABLES|TABLE table_list WITH READ LOCK
---echo #
---echo # I. Check the incompatible changes in the grammar.
---echo #
---error ER_PARSE_ERROR
-flush tables with read lock, hosts;
---error ER_PARSE_ERROR
-flush privileges, tables;
---error ER_PARSE_ERROR
-flush privileges, tables with read lock;
---error ER_PARSE_ERROR
-flush privileges, tables;
---error ER_PARSE_ERROR
-flush tables with read lock, tables;
-show tables;
---echo #
---echo # II. Check the allowed syntax.
---echo #
---disable_warnings
-drop table if exists t1, t2, t3;
---enable_warnings
-create table t1 (a int);
-create table t2 (a int);
-create table t3 (a int);
-lock table t1 read, t2 read;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-flush tables with read lock;
-unlock tables;
-flush tables with read lock;
-flush tables t1, t2 with read lock;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-flush tables t1, t2 with read lock;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-flush tables with read lock;
-select * from t1;
-select * from t2;
---error ER_TABLE_NOT_LOCKED
-select * from t3;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-insert into t1 (a) values (1);
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-insert into t2 (a) values (1);
---error ER_TABLE_NOT_LOCKED
-insert into t3 (a) values (1);
---error ER_NO_SUCH_TABLE
-lock table no_such_table read;
---echo #
---echo # We implicitly left the locked tables
---echo # mode but still have the read lock.
---echo #
---error ER_CANT_UPDATE_WITH_READLOCK
-insert into t2 (a) values (1);
-unlock tables;
-insert into t1 (a) values (1);
-insert into t2 (a) values (1);
-flush table t1, t2 with read lock;
-select * from t1;
-select * from t2;
---error ER_TABLE_NOT_LOCKED
-select * from t3;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-insert into t1 (a) values (2);
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-insert into t2 (a) values (2);
---error ER_TABLE_NOT_LOCKED
-insert into t3 (a) values (2);
---error ER_NO_SUCH_TABLE
-lock table no_such_table read;
-insert into t3 (a) values (2);
-
-
---echo #
---echo # III. Concurrent tests.
---echo #
-connect (con1,localhost,root,,);
---echo #
---echo # Check that flush tables <list> with read lock
---echo # does not affect non-locked tables.
-connection default;
---echo #
-flush tables t1 with read lock;
-connection con1;
-select * from t1;
-select * from t2;
-insert into t2 (a) values (3);
-connection default;
-unlock tables;
---echo #
---echo # Check that "FLUSH TABLES <list> WITH READ LOCK" is
---echo # compatible with active "FLUSH TABLES WITH READ LOCK".
---echo # Vice versa it is not true, since tables read-locked by
---echo # "FLUSH TABLES <list> WITH READ LOCK" can't be flushed.
-flush tables with read lock;
-connection con1;
-flush table t1 with read lock;
-select * from t1;
-unlock tables;
-connection default;
-unlock tables;
---echo #
---echo # Check that FLUSH TABLES t1 WITH READ LOCK
---echo # does not conflict with an existing FLUSH TABLES t2
---echo # WITH READ LOCK.
---echo #
-flush table t1 with read lock;
-connection con1;
-flush table t2 with read lock;
-unlock tables;
-connection default;
-unlock tables;
---echo #
---echo # Check that FLUSH TABLES t1 WITH READ LOCK
---echo # does not conflict with SET GLOBAL read_only=1.
---echo #
-set global read_only=1;
-connection con1;
-flush table t1 with read lock;
-unlock tables;
-connection default;
-set global read_only=0;
---echo #
---echo # Check that it's possible to read-lock
---echo # tables locked with FLUSH TABLE <list> WITH READ LOCK.
---echo #
-flush tables t1, t2 with read lock;
-connection con1;
-lock table t1 read, t2 read;
-unlock tables;
-connection default;
-unlock tables;
-
-connection con1;
-disconnect con1;
---source include/wait_until_disconnected.inc
-connection default;
-drop table t1, t2, t3;
-
---echo #
---echo # Bug#51710 FLUSH TABLES <view> WITH READ LOCK kills the server
---echo #
---disable_warnings
-drop view if exists v1, v2, v3;
-drop table if exists t1, v1;
---enable_warnings
-create table t1 (a int);
-create view v1 as select 1;
-create view v2 as select * from t1;
-create view v3 as select * from v2;
-
---error ER_WRONG_OBJECT
-flush table v1, v2, v3 with read lock;
---error ER_WRONG_OBJECT
-flush table v1 with read lock;
---error ER_WRONG_OBJECT
-flush table v2 with read lock;
---error ER_WRONG_OBJECT
-flush table v3 with read lock;
-create temporary table v1 (a int);
---error ER_WRONG_OBJECT
-flush table v1 with read lock;
-drop view v1;
-create table v1 (a int);
-flush table v1 with read lock;
-drop temporary table v1;
-unlock tables;
-drop view v2, v3;
-drop table t1, v1;
-
-
---echo #
---echo # FLUSH TABLES <list> WITH READ LOCK and HANDLER
---echo #
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a int, key a (a));
-insert into t1 (a) values (1), (2), (3);
-handler t1 open;
-handler t1 read a next;
-handler t1 read a next;
-flush tables t1 with read lock;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-handler t1 read a next;
-unlock tables;
---echo #
---echo # Sic: lost handler position.
---echo #
-handler t1 read a next;
-handler t1 close;
-drop table t1;
-
---echo #
---echo # Bug#52117 Pending FLUSH TALBES <list> aborts
---echo # transactions unnecessarily.
---echo #
---disable_warnings
-drop table if exists t1;
---enable_warnings
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-connection default;
-
-create table t1 (a int);
-begin;
-select * from t1;
-connection con1;
---echo #
---echo # Issue a LOCK TABLE t1 READ. We could use HANDLER t1 OPEN
---echo # or a long-running select -- anything that
---echo # prevents FLUSH TABLE t1 from immediate completion would do.
---echo #
-lock table t1 read;
-connection con2;
---echo #
---echo # FLUSH TABLE expels the table definition from the cache.
---echo # Sending 'flush table t1'...
-send flush table t1;
-connection default;
---echo # Let flush table sync in.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table flush"
- and info = "flush table t1";
---source include/wait_condition.inc
-send select * from t1;
-connection con1;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table flush"
- and info = "select * from t1";
-select * from t1;
-unlock tables;
-connection con2;
---echo # Reaping 'flush table t1'...
-reap;
-connection default;
---echo # Reaping 'select * from t1'...
-reap;
-commit;
-
---echo #
---echo # Repeat the same test but with FLUSH TABLES
---echo #
-
-begin;
-select * from t1;
-connection con1;
---echo #
---echo # Issue a LOCK TABLE t1 READ.
---echo #
-lock table t1 read;
-connection con2;
---echo #
---echo # FLUSH TABLES expels the table definition from the cache.
---echo # Sending 'flush tables'...
-send flush tables;
-connection default;
---echo # Let flush table sync in.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table flush"
- and info = "flush tables";
---source include/wait_condition.inc
-send select * from t1;
-connection con1;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table flush"
- and info = "select * from t1";
-select * from t1;
-unlock tables;
-connection con2;
---echo # Reaping 'flush tables'...
-reap;
-connection default;
---echo # Reaping 'select * from t1'...
-reap;
-commit;
-
---echo # Cleanup
-
-connection con1;
-disconnect con1;
---source include/wait_until_disconnected.inc
-connection con2;
-disconnect con2;
---source include/wait_until_disconnected.inc
-connection default;
-drop table t1;
-
-
---echo #
---echo # Test for bug #55273 "FLUSH TABLE tm WITH READ LOCK for Merge table
---echo # causes assert failure".
---echo #
---disable_warnings
-drop table if exists t1, t2, tm;
---enable_warnings
-create table t1 (i int);
-create table t2 (i int);
-create table tm (i int) engine=merge union=(t1, t2);
-insert into t1 values (1), (2);
-insert into t2 values (3), (4);
---echo # The below statement should succeed and lock merge
---echo # table for read. Only merge table gets flushed and
---echo # not underlying tables.
-flush tables tm with read lock;
-select * from tm;
---echo # Check that underlying tables are locked.
-select * from t1;
-select * from t2;
-unlock tables;
---echo # This statement should succeed as well and flush
---echo # all tables in the list.
-flush tables tm, t1, t2 with read lock;
-select * from tm;
---echo # Naturally, underlying tables should be locked in this case too.
-select * from t1;
-select * from t2;
-unlock tables;
-drop tables tm, t1, t2;
-
-
---echo #
---echo # Test for bug #57006 "Deadlock between HANDLER and
---echo # FLUSH TABLES WITH READ LOCK".
---echo #
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-connection default;
-create table t1 (i int);
-create table t2 (i int);
-handler t1 open;
-
-connection con1;
---echo # Sending:
---send flush tables with read lock
-
-connection con2;
---echo # Wait until FTWRL starts waiting for 't1' to be closed.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table flush"
- and info = "flush tables with read lock";
---source include/wait_condition.inc
-
-connection default;
---echo # The below statement should not cause deadlock.
---echo # Sending:
---send insert into t2 values (1)
-
-connection con2;
---echo # Wait until INSERT starts to wait for FTWRL to go away.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock"
- and info = "insert into t2 values (1)";
---source include/wait_condition.inc
-
-connection con1;
---echo # FTWRL should be able to continue now.
---echo # Reap FTWRL.
---reap
-unlock tables;
-
-connection default;
---echo # Reap INSERT.
---reap
-handler t1 close;
-
---echo # Cleanup.
-connection con1;
-disconnect con1;
---source include/wait_until_disconnected.inc
-connection con2;
-disconnect con2;
---source include/wait_until_disconnected.inc
-connection default;
-drop tables t1, t2;
-
-
---echo #
---echo # Bug#57649 FLUSH TABLES under FLUSH TABLES <list> WITH READ LOCK leads
---echo # to assert failure.
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (a INT);
-FLUSH TABLES t1 WITH READ LOCK;
-
-# All these triggered the assertion
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-FLUSH TABLES;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a= 1;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-ALTER TABLE t1 COMMENT 'test';
-
-UNLOCK TABLES;
-DROP TABLE t1;
-
-
---echo #
---echo # Test for bug #12641342 - "61401: UPDATE PERFORMANCE DEGRADES
---echo # GRADUALLY IF A TRIGGER EXISTS".
---echo #
---echo # One of side-effects of this bug was that a transaction which
---echo # involved DML statements requiring prelocking blocked concurrent
---echo # FLUSH TABLES WITH READ LOCK for the whole its duration, while
---echo # correct behavior in this case is to block FTWRL only for duration
---echo # of individual DML statements.
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-CREATE TABLE t1 (id INT PRIMARY KEY, value INT);
-INSERT INTO t1 VALUES (1, 1);
-CREATE TRIGGER t1_au AFTER UPDATE ON t1 FOR EACH ROW SET @var = "a";
-BEGIN;
-UPDATE t1 SET value= value + 1 WHERE id = 1;
-
-connect(con1, localhost, root);
---echo # The below FLUSH TABLES WITH READ LOCK should succeed and
---echo # should not be blocked by the transaction in default connection.
-FLUSH TABLES WITH READ LOCK;
-UNLOCK TABLES;
-disconnect con1;
---source include/wait_until_disconnected.inc
-
-connection default;
-COMMIT;
-DROP TABLE t1;
-
---echo #
---echo # Test flushing slave or relay logs twice
---echo #
---error ER_WRONG_USAGE
-flush relay logs,relay logs;
---error ER_WRONG_USAGE
-flush slave,slave;
diff --git a/mysql-test/t/flush2-master.opt b/mysql-test/t/flush2-master.opt
deleted file mode 100644
index 789275fa25e..00000000000
--- a/mysql-test/t/flush2-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---skip-log-bin
diff --git a/mysql-test/t/flush2.test b/mysql-test/t/flush2.test
deleted file mode 100644
index 496b57ccea4..00000000000
--- a/mysql-test/t/flush2.test
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# Bug#17733 Flushing logs causes daily server crash
-#
-
---source include/not_embedded.inc
-
-flush logs;
-set global expire_logs_days = 3;
-show variables like 'log_bin%';
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-show variables like 'relay_log%';
-flush logs;
-show variables like 'log_bin%';
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-show variables like 'relay_log%';
-set global expire_logs_days = 0;
diff --git a/mysql-test/t/flush_block_commit.test b/mysql-test/t/flush_block_commit.test
deleted file mode 100644
index 6a6120ce63f..00000000000
--- a/mysql-test/t/flush_block_commit.test
+++ /dev/null
@@ -1,98 +0,0 @@
-# Let's see if FLUSH TABLES WITH READ LOCK blocks COMMIT of existing
-# transactions.
-# We verify that we did not introduce a deadlock.
-# This is intended to mimick how mysqldump and innobackup work.
-
-# And it requires InnoDB
---source include/have_innodb.inc
-
---echo # Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-connect (con3,localhost,root,,);
-connection con1;
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-CREATE TABLE t1 (a INT) ENGINE=innodb;
-
-# blocks COMMIT ?
-
-BEGIN;
-INSERT INTO t1 VALUES(1);
-connection con2;
-FLUSH TABLES WITH READ LOCK;
-connection con1;
---echo # Sending:
---send COMMIT
-connection con2;
---echo # Wait until COMMIT gets blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for commit lock" and info = "COMMIT";
---source include/wait_condition.inc
---echo # Verify that 'con1' was blocked and data did not move.
-SELECT * FROM t1;
-UNLOCK TABLES;
-connection con1;
---echo # Reaping COMMIT
---reap
-
-# No deadlock ?
-
-connection con1;
-BEGIN;
-SELECT * FROM t1 FOR UPDATE;
-connection con2;
-BEGIN;
-send SELECT * FROM t1 FOR UPDATE; # blocked by con1
-sleep 1;
-connection con3;
-send FLUSH TABLES WITH READ LOCK; # blocked by con2
-connection con1;
-COMMIT; # should not be blocked by con3
-connection con2;
-reap;
-COMMIT;
-connection con3;
-reap;
-UNLOCK TABLES;
-
-# Bug#6732 FLUSH TABLES WITH READ LOCK + COMMIT hangs later FLUSH TABLES
-# WITH READ LOCK
-
-connection con2;
-COMMIT; # unlock InnoDB row locks to allow insertions
-connection con1;
-BEGIN;
-INSERT INTO t1 VALUES(10);
-FLUSH TABLES WITH READ LOCK;
-connection con2;
-FLUSH TABLES WITH READ LOCK; # bug caused hang here
-UNLOCK TABLES;
-
-# Bug#7358 SHOW CREATE DATABASE fails if open transaction
-
-BEGIN;
-SELECT * FROM t1;
-SHOW CREATE DATABASE test;
-COMMIT;
-
-
---echo # Cleanup
-connection default;
-disconnect con1;
-disconnect con2;
-disconnect con3;
-
---echo # We commit open transactions when we disconnect: only then we can
---echo # drop the table.
-DROP TABLE t1;
---echo # End of 4.1 tests
-
---echo # Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
-
diff --git a/mysql-test/t/flush_block_commit_notembedded.test b/mysql-test/t/flush_block_commit_notembedded.test
deleted file mode 100644
index 3d894c5f16c..00000000000
--- a/mysql-test/t/flush_block_commit_notembedded.test
+++ /dev/null
@@ -1,64 +0,0 @@
-# Let's see if FLUSH TABLES WITH READ LOCK blocks COMMIT of existing
-# transactions.
-# We verify that we did not introduce a deadlock.
-# This is intended to mimick how mysqldump and innobackup work.
-
---source include/have_log_bin.inc
-
-# And it requires InnoDB
---source include/have_log_bin.inc
---source include/have_innodb.inc
-
---echo # Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-
-# FLUSH TABLES WITH READ LOCK should block writes to binlog too
-connection con1;
-CREATE TABLE t1 (a INT) ENGINE=innodb;
-RESET MASTER;
-SET AUTOCOMMIT=0;
-SELECT 1;
-connection con2;
-FLUSH TABLES WITH READ LOCK;
---source include/show_binlog_events.inc
-connection con1;
-send INSERT INTO t1 VALUES (1);
-connection con2;
-sleep 1;
---source include/show_binlog_events.inc
-UNLOCK TABLES;
-connection con1;
-reap;
-DROP TABLE t1;
-SET AUTOCOMMIT=1;
-
-# GLR blocks new transactions
-create table t1 (a int) engine=innodb;
-connection con1;
-flush tables with read lock;
-connection con2;
-begin;
---send insert into t1 values (1);
-connection con1;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
- info = "insert into t1 values (1)";
---source include/wait_condition.inc
-unlock tables;
-connection con2;
---reap
-commit;
-drop table t1;
-
-connection default;
-disconnect con1;
-disconnect con2;
-
---echo # Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
-
diff --git a/mysql-test/t/flush_read_lock.test b/mysql-test/t/flush_read_lock.test
deleted file mode 100644
index 4a9752ae9f1..00000000000
--- a/mysql-test/t/flush_read_lock.test
+++ /dev/null
@@ -1,2024 +0,0 @@
-#
-# Test coverage for various aspects of FLUSH TABLES WITH READ LOCK
-# functionality.
-#
-
-# We need InnoDB for COMMIT/ROLLBACK related tests.
---source include/have_innodb.inc
-# We need the Debug Sync Facility.
---source include/have_debug_sync.inc
-# Parts of this test use DDL on events, BINLOG statement and
-# other statements which are not supported in embedded server.
--- source include/not_embedded.inc
-# Save the initial number of concurrent sessions.
---source include/count_sessions.inc
-
-set global sql_mode="";
-set local sql_mode="";
---echo # FTWRL takes two global metadata locks -- a global shared
---echo # metadata lock and the commit blocker lock.
---echo # The first lock prevents DDL from taking place.
---echo # Let's say that all DDL statements that take metadata
---echo # locks form class #1 -- incompatible with FTWRL because
---echo # take incompatible MDL table locks.
---echo # The first global lock doesn't, however, prevent standalone
---echo # COMMITs (or implicit COMMITs) from taking place, since a
---echo # COMMIT doesn't take table locks. It doesn't prevent
---echo # DDL on temporary tables either, since they don't
---echo # take any table locks either.
---echo # Most DDL statements do not perform an implicit commit
---echo # if operate on a temporary table. Examples are CREATE
---echo # TEMPORARY TABLE and DROP TEMPORARY TABLE.
---echo # Thus, these DDL statements can go through in presence
---echo # of FTWRL. This is class #2 -- compatible because
---echo # do not take incompatible MDL locks and do not issue
---echo # implicit commit..
---echo # (Although these operations do not commit, their effects
---echo # cannot be rolled back either.)
---echo # ALTER TABLE, ANALYZE, OPTIMIZE and some others always
---echo # issue an implicit commit, even if its argument is a
---echo # temporary table.
---echo # *Howewer* an implicit commit is a no-op if all engines
---echo # used since the start of transactiona are non-
---echo # transactional. Thus, for non-transactional engines,
---echo # these operations are not blocked by FTWRL.
---echo # This is class #3 -- compatible because do not take
---echo # MDL table locks and are non-transactional.
---echo # On the contrary, for transactional engines, there
---echo # is always a commit, regardless of whether a table
---echo # is temporary or not. Thus, for example, ALTER TABLE
---echo # for a transactional engine will wait for FTWRL,
---echo # even if the subject table is temporary.
---echo # Thus ALTER TABLE <temporary> is incompatible
---echo # with FTWRL. This is class #4 -- incompatible
---echo # becuase issue implicit COMMIT which is not a no-op.
---echo # Finally, there are administrative statements (such as
---echo # RESET SLAVE) that do not take any locks and do not
---echo # issue COMMIT.
---echo # This is class #5.
---echo # The goal of this coverage is to test statements
---echo # of all classes.
---echo # @todo: documents the effects of @@autocommit,
---echo # DML and temporary transactional tables.
-
---echo # Use MyISAM engine for the most of the tables
---echo # used in this test in order to be able to
---echo # check that DDL statements on temporary tables
---echo # are compatible with FTRWL.
---disable_warnings
-drop tables if exists t1_base, t2_base, t3_trans;
-drop tables if exists tm_base, tm_base_temp;
-drop database if exists mysqltest1;
---echo # We're going to test ALTER DATABASE UPGRADE
-drop database if exists `#mysql50#mysqltest-2`;
-drop procedure if exists p1;
-drop function if exists f1;
-drop view if exists v1;
-drop procedure if exists p2;
-drop function if exists f2_base;
-drop function if exists f2_temp;
-drop event if exists e1;
-drop event if exists e2;
---enable_warnings
-create table t1_base(i int) engine=myisam;
-create table t2_base(j int) engine=myisam;
-create table t3_trans(i int) engine=innodb;
-create temporary table t1_temp(i int) engine=myisam;
-create temporary table t2_temp(j int) engine=myisam;
-create temporary table t3_temp_trans(i int) engine=innodb;
-create database mysqltest1;
-create database `#mysql50#mysqltest-2`;
-create procedure p1() begin end;
-create function f1() returns int return 0;
-create view v1 as select 1 as i;
-create procedure p2(i int) begin end;
-delimiter |;
-create function f2_base() returns int
-begin
- insert into t1_base values (1);
- return 0;
-end|
-create function f2_temp() returns int
-begin
- insert into t1_temp values (1);
- return 0;
-end|
-delimiter ;|
-create event e1 on schedule every 1 minute do begin end;
-
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-connect (con3,localhost,root,,);
-connection default;
-
---echo #
---echo # Test compatibility of FLUSH TABLES WITH READ LOCK
---echo # with various statements.
---echo #
---echo # These tests don't cover some classes of statements:
---echo # - Replication-related - CHANGE MASTER TO, START/STOP SLAVE and etc
---echo # (all compatible with FTWRL).
---echo # - Plugin-related - INSTALL/UNINSTALL (incompatible with FTWRL,
---echo # require plugin support).
-
-let $con_aux1=con1;
-let $con_aux2=con2;
-let $cleanup_stmt2= ;
-let $skip_3rd_check= ;
-
---echo #
---echo # 1) ALTER variants.
---echo #
---echo # 1.1) ALTER TABLE
---echo #
---echo # 1.1.a) For base table should be incompatible with FTWRL.
---echo #
-let $statement= alter table t1_base add column c1 int;
-let $cleanup_stmt1= alter table t1_base drop column c1;
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 1.1.b) For a temporary table should be compatible with FTWRL.
---echo #
-let $statement= alter table t1_temp add column c1 int;
-let $cleanup_stmt= alter table t1_temp drop column c1;
---source include/check_ftwrl_compatible.inc
-
---echo #
---echo # 1.2) ALTER DATABASE should be incompatible with FTWRL.
---echo #
-let $statement= alter database mysqltest1 default character set utf8;
-let $cleanup_stmt1= alter database mysqltest1 default character set latin1;
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 1.3) ALTER DATABASE UPGRADE DATA DIRECTORY NAME should be
---echo # incompatible with FTWRL.
---echo #
-let $statement= alter database `#mysql50#mysqltest-2` upgrade data directory name;
-let $cleanup_stmt1= drop database `mysqltest-2`;
-let $cleanup_stmt2= create database `#mysql50#mysqltest-2`;
---source include/check_ftwrl_incompatible.inc
-let $cleanup_stmt2= ;
-
---echo #
---echo # 1.4) ALTER PROCEDURE should be incompatible with FTWRL.
---echo #
-let $statement= alter procedure p1 comment 'a';
-let $cleanup_stmt1= alter procedure p1 comment '';
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 1.5) ALTER FUNCTION should be incompatible with FTWRL.
---echo #
-let $statement= alter function f1 comment 'a';
-let $cleanup_stmt1= alter function f1 comment '';
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 1.6) ALTER VIEW should be incompatible with FTWRL.
---echo #
-let $statement= alter view v1 as select 2 as j;
-let $cleanup_stmt1= alter view v1 as select 1 as i;
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 1.7) ALTER EVENT should be incompatible with FTWRL.
---echo #
-let $statement= alter event e1 comment 'test';
-let $cleanup_stmt1= alter event e1 comment '';
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 1.x) The rest of ALTER statements (ALTER TABLESPACE,
---echo # ALTER LOGFILE GROUP and ALTER SERVER) are too
---echo # special to be tested here.
---echo #
-
-
---echo #
---echo # 2) ANALYZE TABLE statement is compatible with FTWRL.
---echo # See Bug#43336 ANALYZE and OPTIMIZE do not honour
---echo # --read-only for a discussion why.
---echo #
-let $statement= analyze table t1_base;
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
-
---echo #
---echo # 3) BEGIN, ROLLBACK and COMMIT statements.
---echo # BEGIN and ROLLBACK are compatible with FTWRL.
---echo # COMMIT is not.
---echo #
---echo # We need a special test for these statements as
---echo # FTWRL commits a transaction and because COMMIT
---echo # is handled in a special way.
-flush tables with read lock;
-begin;
---echo # ROLLBACK is allowed under FTWRL although there
---echo # no much sense in it. FTWRL commits any previous
---echo # changes and doesn't allows any DML after it.
---echo # So such a ROLLBACK is always a no-op.
-rollback;
---echo # Although COMMIT is incompatible with FTWRL in
---echo # other senses it is still allowed under FTWRL.
---echo # This fact relied upon by some versions of
---echo # innobackup tool.
---echo # Similarly to ROLLBACK it is a no-op in this situation.
-commit;
-unlock tables;
---echo # Check that BEGIN/ROLLBACK are not blocked and
---echo # COMMIT is blocked by active FTWRL in another
---echo # connection.
---echo #
-connection $con_aux1;
-flush tables with read lock;
-connection default;
-begin;
-connection $con_aux1;
-unlock tables;
-connection default;
---echo # Do some work so ROLLBACK is not a no-op.
-insert into t3_trans values (1);
-connection $con_aux1;
-flush tables with read lock;
-connection default;
-rollback;
-connection $con_aux1;
-unlock tables;
-connection default;
-begin;
---echo # Do some work so COMMIT is not a no-op.
-insert into t3_trans values (1);
-connection $con_aux1;
-flush tables with read lock;
-connection default;
---echo # Send:
---send commit
-connection $con_aux1;
---echo # Wait until COMMIT is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for commit lock" and
- info = "commit";
---source include/wait_condition.inc
-unlock tables;
-connection default;
---echo # Reap COMMIT.
---reap
-delete from t3_trans;
---echo #
---echo # Check that COMMIT blocks FTWRL in another connection.
-begin;
-insert into t3_trans values (1);
-set debug_sync='RESET';
-set debug_sync='ha_commit_trans_after_acquire_commit_lock SIGNAL parked WAIT_FOR go';
---send commit
-connection $con_aux1;
-set debug_sync='now WAIT_FOR parked';
---send flush tables with read lock
-connection $con_aux2;
---echo # Wait until FTWRL is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for commit lock" and
- info = "flush tables with read lock";
---source include/wait_condition.inc
-set debug_sync='now SIGNAL go';
-connection default;
---echo # Reap COMMIT.
---reap
-connection $con_aux1;
---echo # Reap FTWRL.
---reap
-unlock tables;
-connection default;
-delete from t3_trans;
-set debug_sync= "RESET";
---echo # We don't run similar test for BEGIN and ROLLBACK as
---echo # they release metadata locks in non-standard place.
-
-
---echo #
---echo # 4) BINLOG statement should be incompatible with FTWRL.
---echo #
---echo #
---echo # Provide format description BINLOG statement first.
-BINLOG '
-MfmqTA8BAAAAZwAAAGsAAAABAAQANS41LjctbTMtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA
-AAAAAAAAAAAAAAAAAAAx+apMEzgNAAgAEgAEBAQEEgAAVAAEGggAAAAICAgCAA==
-';
---echo # Now test compatibility for BINLOG statement which is
---echo # equivalent to INSERT INTO t1_base VALUES (1).
-let $statement= BINLOG '
-MfmqTBMBAAAALgAAAN0AAAAAACgAAAAAAAEABHRlc3QAB3QxX2Jhc2UAAQMAAQ==
-MfmqTBcBAAAAIgAAAP8AAAAAACgAAAAAAAEAAf/+AQAAAA==
-';
-let $cleanup_stmt1= delete from t1_base where i = 1 limit 1;
---echo # Skip last part of compatibility testing as this statement
---echo # releases metadata locks in non-standard place.
-let $skip_3rd_check= 1;
---source include/check_ftwrl_incompatible.inc
-let $skip_3rd_check= ;
-
-
---echo #
---echo # 5) CALL statement. This statement uses resources in two
---echo # ways: through expressions used as parameters and through
---echo # sub-statements. This test covers only usage through
---echo # parameters as sub-statements do locking individually.
---echo #
---echo # 5.a) In simple cases a parameter expression should be
---echo # compatible with FTWRL.
-let $statement= call p2((select count(*) from t1_base));
-let $cleanup_stmt1= ;
---echo # Skip last part of compatibility testing as this statement
---echo # releases metadata locks in non-standard place.
-let $skip_3rd_check= 1;
---source include/check_ftwrl_compatible.inc
-let $skip_3rd_check= ;
-
---echo #
---echo # 5.b) In case when an expression uses function which updates
---echo # base tables CALL should be incompatible with FTWRL.
---echo #
-let $statement= call p2(f2_base());
-let $cleanup_stmt1= ;
---echo # Skip last part of compatibility testing as this statement
---echo # releases metadata locks in non-standard place.
-let $skip_3rd_check= 1;
---source include/check_ftwrl_incompatible.inc
-let $skip_3rd_check= ;
-
---echo #
---echo # 5.c) If function used as argument updates temporary tables
---echo # CALL statement should be compatible with FTWRL.
---echo #
-let $statement= call p2(f2_temp());
-let $cleanup_stmt1= ;
---echo # Skip last part of compatibility testing as this statement
---echo # releases metadata locks in non-standard place.
-let $skip_3rd_check= 1;
---source include/check_ftwrl_compatible.inc
-let $skip_3rd_check= ;
-
-
---echo #
---echo # 6) CHECK TABLE statement is compatible with FTWRL.
---echo #
-let $statement= check table t1_base;
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
-
-
---echo #
---echo # 7) CHECKSUM TABLE statement is compatible with FTWRL.
---echo #
-let $statement= checksum table t1_base;
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
-
-
---echo #
---echo # 8) CREATE variants.
---echo #
---echo # 8.1) CREATE TABLE statement.
---echo #
---echo # 8.1.a) CREATE TABLE is incompatible with FTWRL when
---echo # base table is created.
-let $statement= create table t3_base(i int);
-let $cleanup_stmt1= drop table t3_base;
---source include/check_ftwrl_incompatible.inc
-
---echo # 8.1.b) CREATE TABLE is compatible with FTWRL when
---echo # temporary table is created.
-let $statement= create temporary table t3_temp(i int);
-let $cleanup_stmt= drop temporary tables t3_temp;
---source include/check_ftwrl_compatible.inc
-
---echo # 8.1.c) CREATE TABLE LIKE is incompatible with FTWRL when
---echo # base table is created.
-let $statement= create table t3_base like t1_temp;
-let $cleanup_stmt1= drop table t3_base;
---source include/check_ftwrl_incompatible.inc
-
---echo # 8.1.d) CREATE TABLE LIKE is compatible with FTWRL when
---echo # temporary table is created.
-let $statement= create temporary table t3_temp like t1_base;
-let $cleanup_stmt= drop temporary table t3_temp;
---source include/check_ftwrl_compatible.inc
-
---echo # 8.1.e) CREATE TABLE SELECT is incompatible with FTWRL when
---echo # base table is created.
-let $statement= create table t3_base select 1 as i;
-let $cleanup_stmt1= drop table t3_base;
---source include/check_ftwrl_incompatible.inc
-
---echo # 8.1.f) CREATE TABLE SELECT is compatible with FTWRL when
---echo # temporary table is created.
-let $statement= create temporary table t3_temp select 1 as i;
-let $cleanup_stmt= drop temporary table t3_temp;
---source include/check_ftwrl_compatible.inc
-
---echo # 8.2) CREATE INDEX statement.
---echo #
---echo # 8.2.a) CREATE INDEX is incompatible with FTWRL when
---echo # applied to base table.
-let $statement= create index i on t1_base (i);
-let $cleanup_stmt1= drop index i on t1_base;
---source include/check_ftwrl_incompatible.inc
-
---echo # 8.2.b) CREATE INDEX is compatible with FTWRL when
---echo # applied to temporary table.
-let $statement= create index i on t1_temp (i);
-let $cleanup_stmt= drop index i on t1_temp;
---source include/check_ftwrl_compatible.inc
-
---echo #
---echo # 8.3) CREATE DATABASE is incompatible with FTWRL.
---echo #
-let $statement= create database mysqltest2;
-let $cleanup_stmt1= drop database mysqltest2;
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 8.4) CREATE VIEW is incompatible with FTWRL.
---echo #
-let $statement= create view v2 as select 1 as j;
-let $cleanup_stmt1= drop view v2;
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 8.5) CREATE TRIGGER is incompatible with FTWRL.
---echo #
-let $statement= create trigger t1_bi before insert on t1_base for each row begin end;
-let $cleanup_stmt1= drop trigger t1_bi;
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 8.6) CREATE FUNCTION is incompatible with FTWRL.
---echo #
-let $statement= create function f2() returns int return 0;
-let $cleanup_stmt1= drop function f2;
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 8.7) CREATE PROCEDURE is incompatible with FTWRL.
---echo #
-let $statement= create procedure p3() begin end;
-let $cleanup_stmt1= drop procedure p3;
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 8.8) CREATE EVENT should be incompatible with FTWRL.
---echo #
-let $statement= create event e2 on schedule every 1 minute do begin end;
-let $cleanup_stmt1= drop event e2;
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 8.9) CREATE USER should be incompatible with FTWRL.
---echo #
-let $statement= create user mysqltest_u1;
-let $cleanup_stmt1= drop user mysqltest_u1;
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 8.x) The rest of CREATE variants (CREATE LOGFILE GROUP,
---echo # CREATE TABLESPACE and CREATE SERVER) are too special
---echo # to test here.
---echo #
-
-
---echo #
---echo # 9) PREPARE, EXECUTE and DEALLOCATE PREPARE statements.
---echo #
---echo # 9.1) PREPARE statement is compatible with FTWRL as it
---echo # doesn't change any data.
---echo #
---echo # 9.1.a) Prepare of simple INSERT statement.
---echo #
-let $statement= prepare stmt1 from 'insert into t1_base values (1)';
-let $cleanup_stmt= deallocate prepare stmt1;
---echo # Skip last part of compatibility testing as this statement
---echo # releases metadata locks in non-standard place.
-let $skip_3rd_check= 1;
---source include/check_ftwrl_compatible.inc
-let $skip_3rd_check= ;
-
---echo #
---echo # 9.1.b) Prepare of multi-UPDATE. At some point such statements
---echo # tried to acquire thr_lock.c locks during prepare phase.
---echo # This no longer happens and thus it is compatible with
---echo # FTWRL.
-let $statement= prepare stmt1 from 'update t1_base, t2_base set t1_base.i= 1 where t1_base.i = t2_base.j';
-let $cleanup_stmt= deallocate prepare stmt1;
---echo # Skip last part of compatibility testing as this statement
---echo # releases metadata locks in non-standard place.
-let $skip_3rd_check= 1;
---source include/check_ftwrl_compatible.inc
-let $skip_3rd_check= ;
-
---echo #
---echo # 9.1.c) Prepare of multi-DELETE. Again PREPARE of such
---echo # statement should be compatible with FTWRL.
-let $statement= prepare stmt1 from 'delete t1_base from t1_base, t2_base where t1_base.i = t2_base.j';
-let $cleanup_stmt= deallocate prepare stmt1;
---echo # Skip last part of compatibility testing as this statement
---echo # releases metadata locks in non-standard place.
-let $skip_3rd_check= 1;
---source include/check_ftwrl_compatible.inc
-let $skip_3rd_check= ;
-
---echo #
---echo # 9.2) Compatibility of EXECUTE statement depends on statement
---echo # to be executed.
---echo #
---echo # 9.2.a) EXECUTE for statement which is itself compatible with
---echo # FTWRL should be compatible.
-prepare stmt1 from 'select * from t1_base';
-let $statement= execute stmt1;
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
-deallocate prepare stmt1;
-
-call mtr.add_suppression("Slave SQL.*Can.t execute the query because you have a conflicting read lock., error.* 1223");
-
---echo #
---echo # 9.2.b) EXECUTE for statement which is incompatible with FTWRL
---echo # should be also incompatible.
---echo #
---echo # Check that EXECUTE is not allowed under FTWRL.
-prepare stmt1 from 'insert into t1_base values (1)';
-flush tables with read lock;
---error ER_CANT_UPDATE_WITH_READLOCK
-execute stmt1;
-unlock tables;
---echo # Check that active FTWRL in another connection
---echo # blocks EXECUTE which changes data.
---echo #
-connection $con_aux1;
-flush tables with read lock;
-connection default;
---send execute stmt1
-connection $con_aux1;
---echo # Check that EXECUTE is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
- info = "insert into t1_base values (1)";
---source include/wait_condition.inc
-unlock tables;
-connection default;
---echo # Reap EXECUTE.
---reap
-set debug_sync='RESET';
-set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
---send execute stmt1;
-connection $con_aux1;
-set debug_sync='now WAIT_FOR parked';
---send flush tables with read lock
-connection $con_aux2;
---echo # Wait until FTWRL is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
- info = "flush tables with read lock";
---source include/wait_condition.inc
-set debug_sync='now SIGNAL go';
-connection default;
---echo # Reap EXECUTE.
---reap
-connection $con_aux1;
---echo # Reap FTWRL.
---reap
-unlock tables;
-connection default;
-set debug_sync= "RESET";
-delete from t1_base;
-deallocate prepare stmt1;
-
---echo #
---echo # 9.3) DEALLOCATE PREPARE is compatible with FTWRL.
---echo #
-prepare stmt1 from 'insert into t1_base values (1)';
-let $statement= deallocate prepare stmt1;
-let $cleanup_stmt= prepare stmt1 from 'insert into t1_base values (1)';
---source include/check_ftwrl_compatible.inc
-deallocate prepare stmt1;
-
-
---echo #
---echo # 10) DELETE variations.
---echo #
---echo # 10.1) Simple DELETE.
---echo #
---echo # 10.1.a) Simple DELETE on base table is incompatible with FTWRL.
-let $statement= delete from t1_base;
-let $cleanup_stmt1= ;
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 10.1.b) Simple DELETE on temporary table is compatible with FTWRL.
-let $statement= delete from t1_temp;
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
-
---echo #
---echo # 10.2) Multi DELETE.
---echo #
---echo # 10.2.a) Multi DELETE on base tables is incompatible with FTWRL.
-let $statement= delete t1_base from t1_base, t2_base where t1_base.i = t2_base.j;
-let $cleanup_stmt1= ;
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 10.2.b) Multi DELETE on temporary tables is compatible with FTWRL.
-let $statement= delete t1_temp from t1_temp, t2_temp where t1_temp.i = t2_temp.j;
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
-
-
---echo #
---echo # 11) DESCRIBE should be compatible with FTWRL.
---echo #
-let $statement= describe t1_base;
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
-
-
---echo #
---echo # 12) Compatibility of DO statement with FTWRL depends on its
---echo # expression.
---echo #
---echo # 12.a) DO with expression which does not change base table
---echo # should be compatible with FTWRL.
-let $statement= do (select count(*) from t1_base);
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
-
---echo #
---echo # 12.b) DO which calls SF updating base table should be
---echo # incompatible with FTWRL.
-let $statement= do f2_base();
-let $cleanup_stmt1= delete from t1_base limit 1;
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 12.c) DO which calls SF updating temporary table should be
---echo # compatible with FTWRL.
-let $statement= do f2_temp();
-let $cleanup_stmt= delete from t1_temp limit 1;
---source include/check_ftwrl_compatible.inc
-
-
---echo #
---echo # 13) DROP variants.
---echo #
---echo # 13.1) DROP TABLES.
---echo #
---echo # 13.1.a) DROP TABLES which affects base tables is incompatible
---echo # with FTWRL.
-let $statement= drop table t2_base;
-let $cleanup_stmt1= create table t2_base(j int);
---source include/check_ftwrl_incompatible.inc
-
---echo # 13.1.b) DROP TABLES which affects only temporary tables
---echo # is compatible with FTWRL.
-let $statement= drop table t2_temp;
-let $cleanup_stmt= create temporary table t2_temp(j int);
---source include/check_ftwrl_compatible.inc
-
---echo #
---echo # 13.1.c) DROP TEMPORARY TABLES should be compatible with FTWRL.
-let $statement= drop temporary table t2_temp;
-let $cleanup_stmt= create temporary table t2_temp(j int);
---source include/check_ftwrl_compatible.inc
-
---echo #
---echo # 13.2) DROP INDEX.
---echo #
---echo # 13.2.a) DROP INDEX on a base table is incompatible with FTWRL.
-create index i on t1_base (i);
-let $statement= drop index i on t1_base;
-let $cleanup_stmt1= create index i on t1_base (i);
---source include/check_ftwrl_incompatible.inc
-drop index i on t1_base;
-
---echo #
---echo # 13.2.b) DROP INDEX on a temporary table is compatible with FTWRL.
-create index i on t1_temp (i);
-let $statement= drop index i on t1_temp;
-let $cleanup_stmt= create index i on t1_temp (i);
---source include/check_ftwrl_compatible.inc
-drop index i on t1_temp;
-
---echo #
---echo # 13.3) DROP DATABASE is incompatible with FTWRL
---echo #
-let $statement= drop database mysqltest1;
-let $cleanup_stmt1= create database mysqltest1;
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 13.4) DROP FUNCTION is incompatible with FTWRL.
---echo #
-let $statement= drop function f1;
-let $cleanup_stmt1= create function f1() returns int return 0;
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 13.5) DROP PROCEDURE is incompatible with FTWRL.
---echo #
-let $statement= drop procedure p1;
-let $cleanup_stmt1= create procedure p1() begin end;
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 13.6) DROP USER should be incompatible with FTWRL.
---echo #
-create user mysqltest_u1;
-let $statement= drop user mysqltest_u1;
-let $cleanup_stmt1= create user mysqltest_u1;
---source include/check_ftwrl_incompatible.inc
-drop user mysqltest_u1;
-
---echo #
---echo # 13.7) DROP VIEW should be incompatible with FTWRL.
---echo #
-let $statement= drop view v1;
-let $cleanup_stmt1= create view v1 as select 1 as i;
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 13.8) DROP EVENT should be incompatible with FTWRL.
---echo #
-let $statement= drop event e1;
-let $cleanup_stmt1= create event e1 on schedule every 1 minute do begin end;
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 13.9) DROP TRIGGER is incompatible with FTWRL.
---echo #
-create trigger t1_bi before insert on t1_base for each row begin end;
-let $statement= drop trigger t1_bi;
-let $cleanup_stmt1= create trigger t1_bi before insert on t1_base for each row begin end;
---source include/check_ftwrl_incompatible.inc
-drop trigger t1_bi;
-
---echo #
---echo # 13.x) The rest of DROP variants (DROP TABLESPACE, DROP LOGFILE
---echo # GROUP and DROP SERVER) are too special to test here.
---echo #
-
-
---echo #
---echo # 14) FLUSH variants.
---echo #
---echo # Test compatibility of _some_ important FLUSH variants with FTWRL.
---echo #
---echo # 14.1) FLUSH TABLES WITH READ LOCK is compatible with itself.
---echo #
---echo # Check that FTWRL statements can be run while FTWRL
---echo # is active in another connection.
---echo #
-flush tables with read lock;
---echo # The second FTWRL in a row is allowed at the moment.
---echo # It does not make much sense as it does only flush.
-flush tables with read lock;
-unlock tables;
-connection $con_aux1;
-flush tables with read lock;
-connection default;
-flush tables with read lock;
-unlock tables;
-connection $con_aux1;
-unlock tables;
-connection default;
-
---echo #
---echo # 14.2) FLUSH TABLES <list> WITH READ LOCK is not blocked by
---echo # active FTWRL. But since the latter keeps tables open
---echo # FTWRL is blocked by FLUSH TABLES <list> WITH READ LOCK.
-flush tables with read lock;
---echo # FT <list> WRL is allowed under FTWRL at the moment.
---echo # It does not make much sense though.
-flush tables t1_base, t2_base with read lock;
-unlock tables;
-connection $con_aux1;
-flush tables with read lock;
-connection default;
-flush tables t1_base, t2_base with read lock;
-unlock tables;
-connection $con_aux1;
-unlock tables;
-connection default;
-flush tables t1_base, t2_base with read lock;
-connection $con_aux1;
---send flush tables with read lock
-connection $con_aux2;
---echo # Wait until FTWRL is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table flush" and
- info = "flush tables with read lock";
---source include/wait_condition.inc
-connection default;
-unlock tables;
-connection $con_aux1;
---echo # Reap FTWRL.
---reap
-unlock tables;
-connection default;
-
-
---echo #
---echo # 14.3) FLUSH TABLES is compatible with FTWRL.
-let $statement= flush tables;
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
-
---echo #
---echo # 14.4) FLUSH TABLES <list> is compatible with FTWRL.
-let $statement= flush table t1_base, t2_base;
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
-
---echo #
---echo # 14.5) FLUSH PRIVILEGES is compatible with FTWRL.
-let $statement= flush privileges;
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
-
-
---echo #
---echo # 15) GRANT statement should be incompatible with FTWRL.
---echo #
-let $statement= grant all privileges on t1_base to mysqltest_u1;
-let $cleanup_stmt1= revoke all privileges on t1_base from mysqltest_u1;
---source include/check_ftwrl_incompatible.inc
-drop user mysqltest_u1;
-
-
---echo #
---echo # 16) All HANDLER variants are half-compatible with FTWRL.
---echo # I.e. they are not blocked by active FTWRL. But since open
---echo # HANDLER means open table instance FTWRL is blocked while
---echo # HANDLER is not closed.
---echo #
---echo # Check that HANDLER statements succeed under FTWRL.
-flush tables with read lock;
-handler t1_base open;
-handler t1_base read first;
-handler t1_base close;
-unlock tables;
---echo # Check that HANDLER statements can be run while FTWRL
---echo # is active in another connection.
---echo #
-connection $con_aux1;
-flush tables with read lock;
-connection default;
-handler t1_base open;
-handler t1_base read first;
-handler t1_base close;
-connection $con_aux1;
-unlock tables;
-connection default;
-
-
---echo #
---echo # 17) HELP statement is compatible with FTWRL.
---echo #
-let $statement= help no_such_topic;
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
-
-
---echo #
---echo # 18) INSERT statement.
---echo #
---echo # 18.a) Ordinary INSERT into base table is incompatible with FTWRL.
-let $statement= insert into t1_base values (1);
-let $cleanup_stmt1= delete from t1_base limit 1;
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 18.b) Ordinary INSERT into temp table is compatible with FTWRL.
-let $statement= insert into t1_temp values (1);
-let $cleanup_stmt= delete from t1_temp limit 1;
---source include/check_ftwrl_compatible.inc
-
---echo #
---echo # 18.c) INSERT DELAYED is incompatible with FTWRL.
-let $statement= insert delayed into t1_base values (1);
-let $cleanup_stmt1= ;
---source include/check_ftwrl_incompatible.inc
-delete from t1_base;
-
---echo #
---echo # 18.d) INSERT SELECT into base table is incompatible with FTWRL.
-let $statement= insert into t1_base select * from t1_temp;
-let $cleanup_stmt1= ;
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 18.e) INSERT SELECT into temp table is compatible with FTWRL.
-let $statement= insert into t1_temp select * from t1_base;
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
-
-
---echo #
---echo # 19) KILL statement is compatible with FTWRL.
---echo #
---echo # Check that KILL can be run under FTWRL.
-flush tables with read lock;
-set @id:= connection_id();
---error ER_QUERY_INTERRUPTED
-kill query @id;
-unlock tables;
---echo # Check that KILL statements can be run while FTWRL
---echo # is active in another connection.
---echo #
-connection $con_aux1;
-flush tables with read lock;
-connection default;
---error ER_QUERY_INTERRUPTED
-kill query @id;
-connection $con_aux1;
-unlock tables;
-connection default;
---echo # Finally check that KILL doesn't block FTWRL
-set debug_sync='RESET';
-set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
---send kill query @id
-connection $con_aux1;
-set debug_sync='now WAIT_FOR parked';
-flush tables with read lock;
-unlock tables;
-set debug_sync='now SIGNAL go';
-connection default;
---echo # Reap KILL.
---error ER_QUERY_INTERRUPTED
---reap
-set debug_sync='RESET';
-
-
---echo #
---echo # 20) LOAD DATA statement.
---echo #
---echo # 20.a) LOAD DATA into base table is incompatible with FTWRL.
-let $statement= load data infile '../../std_data/rpl_loaddata.dat' into table t1_base (@dummy, i);
-let $cleanup_stmt1= delete from t1_base;
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 20.b) LOAD DATA into temporary table is compatible with FTWRL.
-let $statement= load data infile '../../std_data/rpl_loaddata.dat' into table t1_temp (@dummy, i);
-let $cleanup_stmt= delete from t1_temp;
---source include/check_ftwrl_compatible.inc
-
-
---echo #
---echo # 21) LOCK/UNLOCK TABLES statements.
---echo #
---echo # LOCK TABLES statement always (almost) blocks FTWRL as it
---echo # keeps tables open until UNLOCK TABLES.
---echo # Active FTWRL on the other hand blocks only those
---echo # LOCK TABLES which allow updating of base tables.
---echo #
---echo # 21.a) LOCK TABLES READ is allowed under FTWRL and
---echo # is not blocked by active FTWRL.
-flush tables with read lock;
-lock tables t1_base read;
-unlock tables;
---echo #
-connection $con_aux1;
-flush tables with read lock;
-connection default;
-lock tables t1_base read;
-unlock tables;
-connection $con_aux1;
-unlock tables;
-connection default;
-
---echo #
---echo # 21.b) LOCK TABLES WRITE on a base table is disallowed
---echo # under FTWRL and should be blocked by active FTWRL.
-flush tables with read lock;
---error ER_CANT_UPDATE_WITH_READLOCK
-lock tables t1_base write;
-unlock tables;
---echo #
-connection $con_aux1;
-flush tables with read lock;
-connection default;
---send lock tables t1_base write
-connection $con_aux1;
---echo # Check that LOCK TABLES WRITE is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
- info = "lock tables t1_base write";
---source include/wait_condition.inc
-unlock tables;
-connection default;
---echo # Reap LOCK TABLES WRITE
---reap
-unlock tables;
-
---echo #
---echo # 21.c) LOCK TABLES WRITE on temporary table doesn't
---echo # make much sense but is allowed under FTWRL
---echo # and should not be blocked by active FTWRL.
-flush tables with read lock;
-lock tables t1_temp write;
-unlock tables;
---echo #
-connection $con_aux1;
-flush tables with read lock;
-connection default;
-lock tables t1_temp write;
-unlock tables;
-connection $con_aux1;
-unlock tables;
-connection default;
-
-
---echo #
---echo # 22) OPTIMIZE TABLE statement.
---echo #
---echo # 22.a) OPTIMIZE TABLE of base table is incompatible with FTWRL.
-flush tables with read lock;
---echo # OPTIMIZE statement returns errors as part of result-set.
-optimize table t1_base;
-unlock tables;
---echo #
-connection $con_aux1;
-flush tables with read lock;
-connection default;
---send optimize table t1_base
-connection $con_aux1;
---echo # Check that OPTIMIZE TABLE is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
- info = "optimize table t1_base";
---source include/wait_condition.inc
-unlock tables;
-connection default;
---echo # Reap OPTIMIZE TABLE
---reap
---echo # We don't check that active OPTIMIZE TABLE blocks
---echo # FTWRL as this one of statements releasing metadata
---echo # locks in non-standard place.
-
---echo #
---echo # 22.b) OPTIMIZE TABLE of temporary table is compatible with FTWRL.
-let $statement= optimize table t1_temp;
-let $cleanup_stmt= ;
---echo # Skip last part of compatibility testing as this statement
---echo # releases metadata locks in non-standard place.
-let $skip_3rd_check= 1;
---source include/check_ftwrl_compatible.inc
-let $skip_3rd_check= ;
-
-
---echo #
---echo # 23) CACHE statement is compatible with FTWRL.
---echo #
-let $statement= cache index t1_base in default;
-let $cleanup_stmt= ;
---echo # Skip last part of compatibility testing as this statement
---echo # releases metadata locks in non-standard place.
-let $skip_3rd_check= 1;
---source include/check_ftwrl_compatible.inc
-let $skip_3rd_check= ;
-
-
---echo #
---echo # 24) LOAD INDEX statement is compatible with FTWRL.
---echo #
-let $statement= load index into cache t1_base;
-let $cleanup_stmt= ;
---echo # Skip last part of compatibility testing as this statement
---echo # releases metadata locks in non-standard place.
-let $skip_3rd_check= 1;
---source include/check_ftwrl_compatible.inc
-let $skip_3rd_check= ;
-
-
---echo #
---echo # 25) SAVEPOINT/RELEASE SAVEPOINT/ROLLBACK TO SAVEPOINT are
---echo # compatible with FTWRL.
---echo #
---echo # Since manipulations on savepoint have to be done
---echo # inside transaction and FTWRL commits transaction we
---echo # need a special test for these statements.
-flush tables with read lock;
-begin;
-savepoint sv1;
-rollback to savepoint sv1;
-release savepoint sv1;
-unlock tables;
-commit;
---echo # Check that these statements are not blocked by
---echo # active FTWRL in another connection.
---echo #
-connection $con_aux1;
-flush tables with read lock;
-connection default;
-begin;
-connection $con_aux1;
-unlock tables;
-connection default;
---echo # Do some changes to avoid SAVEPOINT and friends
---echo # being almost no-ops.
-insert into t3_trans values (1);
-connection $con_aux1;
-flush tables with read lock;
-connection default;
-savepoint sv1;
-connection $con_aux1;
-unlock tables;
-connection default;
-insert into t3_trans values (2);
-connection $con_aux1;
-flush tables with read lock;
-connection default;
-rollback to savepoint sv1;
-release savepoint sv1;
-connection $con_aux1;
-unlock tables;
-connection default;
-rollback;
---echo # Check that these statements don't block FTWRL in
---echo # another connection.
-begin;
---echo # Do some changes to avoid SAVEPOINT and friends
---echo # being almost no-ops.
-insert into t3_trans values (1);
-set debug_sync='RESET';
-set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
---send savepoint sv1
-connection $con_aux1;
-set debug_sync='now WAIT_FOR parked';
-flush tables with read lock;
-unlock tables;
-set debug_sync='now SIGNAL go';
-connection default;
---echo # Reap SAVEPOINT
---reap
-insert into t3_trans values (2);
-set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
---send rollback to savepoint sv1
-connection $con_aux1;
-set debug_sync='now WAIT_FOR parked';
-flush tables with read lock;
-unlock tables;
-set debug_sync='now SIGNAL go';
-connection default;
---echo # Reap ROLLBACK TO SAVEPOINT
---reap
-set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
---send release savepoint sv1
-connection $con_aux1;
-set debug_sync='now WAIT_FOR parked';
-flush tables with read lock;
-unlock tables;
-set debug_sync='now SIGNAL go';
-connection default;
---echo # Reap RELEASE SAVEPOINT
---reap
-rollback;
-set debug_sync= "RESET";
-
-
---echo #
---echo # 26) RENAME variants.
---echo #
---echo # 26.1) RENAME TABLES is incompatible with FTWRL.
-let $statement= rename table t1_base to t3_base;
-let $cleanup_stmt1= rename table t3_base to t1_base;
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 26.2) RENAME USER is incompatible with FTWRL.
-create user mysqltest_u1;
-let $statement= rename user mysqltest_u1 to mysqltest_u2;
-let $cleanup_stmt1= rename user mysqltest_u2 to mysqltest_u1;
---source include/check_ftwrl_incompatible.inc
-drop user mysqltest_u1;
-
-
---echo #
---echo # 27) REPAIR TABLE statement.
---echo #
---echo # 27.a) REPAIR TABLE of base table is incompatible with FTWRL.
-flush tables with read lock;
---echo # REPAIR statement returns errors as part of result-set.
-repair table t1_base;
-unlock tables;
---echo #
-connection $con_aux1;
-flush tables with read lock;
-connection default;
---send repair table t1_base
-connection $con_aux1;
---echo # Check that REPAIR TABLE is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
- info = "repair table t1_base";
---source include/wait_condition.inc
-unlock tables;
-connection default;
---echo # Reap REPAIR TABLE
---reap
---echo # We don't check that active REPAIR TABLE blocks
---echo # FTWRL as this one of statements releasing metadata
---echo # locks in non-standard place.
-
---echo #
---echo # 27.b) REPAIR TABLE of temporary table is compatible with FTWRL.
-let $statement= repair table t1_temp;
-let $cleanup_stmt= ;
---echo # Skip last part of compatibility testing as this statement
---echo # releases metadata locks in non-standard place.
-let $skip_3rd_check= 1;
---source include/check_ftwrl_compatible.inc
-let $skip_3rd_check= ;
-
-
---echo #
---echo # 28) REPLACE statement.
---echo #
---echo # 28.a) Ordinary REPLACE into base table is incompatible with FTWRL.
-let $statement= replace into t1_base values (1);
-let $cleanup_stmt1= delete from t1_base limit 1;
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 28.b) Ordinary REPLACE into temp table is compatible with FTWRL.
-let $statement= replace into t1_temp values (1);
-let $cleanup_stmt= delete from t1_temp limit 1;
---source include/check_ftwrl_compatible.inc
-
---echo #
---echo # 28.c) REPLACE SELECT into base table is incompatible with FTWRL.
-let $statement= replace into t1_base select * from t1_temp;
-let $cleanup_stmt1= ;
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 28.d) REPLACE SELECT into temp table is compatible with FTWRL.
-let $statement= replace into t1_temp select * from t1_base;
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
-
-
---echo #
---echo # 29) REVOKE variants.
---echo #
---echo # 29.1) REVOKE privileges is incompatible with FTWRL.
-grant all privileges on t1_base to mysqltest_u1;
-let $statement= revoke all privileges on t1_base from mysqltest_u1;
-let $cleanup_stmt1= grant all privileges on t1_base to mysqltest_u1;
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 29.2) REVOKE ALL PRIVILEGES, GRANT OPTION is incompatible with FTWRL.
-let $statement= revoke all privileges, grant option from mysqltest_u1;
-let $cleanup_stmt1= grant all privileges on t1_base to mysqltest_u1;
---source include/check_ftwrl_incompatible.inc
-drop user mysqltest_u1;
-
-
---echo #
---echo # 30) Compatibility of SELECT statement with FTWRL depends on
---echo # locking mode used and on functions being invoked by it.
---echo #
---echo # 30.a) Simple SELECT which does not change tables should be
---echo # compatible with FTWRL.
-let $statement= select count(*) from t1_base;
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
-
---echo # 30.b) SELECT ... FOR UPDATE is incompatible with FTWRL.
-let $statement= select count(*) from t1_base for update;
-let $cleanup_stmt1= ;
---source include/check_ftwrl_incompatible.inc
-
---echo # 30.c) SELECT ... LOCK IN SHARE MODE is compatible with FTWRL.
-let $statement= select count(*) from t1_base lock in share mode;
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
-
---echo #
---echo # 30.d) SELECT which calls SF updating base table should be
---echo # incompatible with FTWRL.
-let $statement= select f2_base();
-let $cleanup_stmt1= delete from t1_base limit 1;
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 30.e) SELECT which calls SF updating temporary table should be
---echo # compatible with FTWRL.
-let $statement= select f2_temp();
-let $cleanup_stmt= delete from t1_temp limit 1;
---source include/check_ftwrl_compatible.inc
-
-
---echo #
---echo # 31) Compatibility of SET statement with FTWRL depends on its
---echo # expression and on whether it is a special SET statement.
---echo #
---echo # 31.a) Ordinary SET with expression which does not
---echo # changes base table should be compatible with FTWRL.
-let $statement= set @a:= (select count(*) from t1_base);
-let $cleanup_stmt= ;
---echo # Skip last part of compatibility testing as our helper debug
---echo # sync-point doesn't work for SET statements.
-let $skip_3rd_check= 1;
---source include/check_ftwrl_compatible.inc
-let $skip_3rd_check= ;
-
---echo #
---echo # 31.b) Ordinary SET which calls SF updating base table should
---echo # be incompatible with FTWRL.
-let $statement= set @a:= f2_base();
-let $cleanup_stmt1= delete from t1_base limit 1;
---echo # Skip last part of compatibility testing as our helper debug
---echo # sync-point doesn't work for SET statements.
-let $skip_3rd_check= 1;
---source include/check_ftwrl_incompatible.inc
-let $skip_3rd_check= ;
-
---echo #
---echo # 31.c) Ordinary SET which calls SF updating temporary table
---echo # should be compatible with FTWRL.
-let $statement= set @a:= f2_temp();
-let $cleanup_stmt= delete from t1_temp limit 1;
---echo # Skip last part of compatibility testing as our helper debug
---echo # sync-point doesn't work for SET statements.
-let $skip_3rd_check= 1;
---source include/check_ftwrl_compatible.inc
-let $skip_3rd_check= ;
-
---echo #
---echo # 31.d) Special SET variants have different compatibility with FTWRL.
---echo #
---echo # 31.d.I) SET PASSWORD is incompatible with FTWRL as it changes data.
-create user mysqltest_u1;
-let $statement= set password for 'mysqltest_u1' = password('');
-let $cleanup_stmt1= ;
---echo # Skip last part of compatibility testing as our helper debug
---echo # sync-point doesn't work for SET statements.
-let $skip_3rd_check= 1;
---source include/check_ftwrl_incompatible.inc
-let $skip_3rd_check= ;
-drop user mysqltest_u1;
---echo #
---echo # 31.d.II) SET READ_ONLY is compatible with FTWRL (but has no
---echo # effect when executed under it).
-let $statement= set global read_only= 1;
-let $cleanup_stmt= set global read_only= 0;
---echo # Skip last part of compatibility testing as our helper debug
---echo # sync-point doesn't work for SET statements.
-let $skip_3rd_check= 1;
---source include/check_ftwrl_compatible.inc
-let $skip_3rd_check= ;
---echo #
---echo # 31.d.III) Situation with SET AUTOCOMMIT is complex.
---echo # Turning auto-commit off is always compatible with FTWRL.
---echo # Turning auto-commit on causes implicit commit and so
---echo # is incompatible with FTWRL if there are changes to be
---echo # committed.
-flush tables with read lock;
-set autocommit= 0;
---echo # Turning auto-commit on causes implicit commit so can
---echo # be incompatible with FTWRL if there is something to
---echo # commit. But since even in this case we allow commits
---echo # under active FTWRL such statement should always succeed.
-insert into t3_temp_trans values (1);
-set autocommit= 1;
-unlock tables;
-delete from t3_temp_trans;
---echo # Check that SET AUTOCOMMIT=0 is not blocked and
---echo # SET AUTOCOMMIT=1 is blocked by active FTWRL in
---echo # another connection.
---echo #
-connection $con_aux1;
-flush tables with read lock;
-connection default;
-set autocommit= 0;
-connection $con_aux1;
-unlock tables;
-connection default;
---echo # Do some work so implicit commit in SET AUTOCOMMIT=1
---echo # is not a no-op.
-insert into t3_trans values (1);
-connection $con_aux1;
-flush tables with read lock;
-connection default;
---echo # Send:
---send set autocommit= 1
-connection $con_aux1;
---echo # Wait until SET AUTOCOMMIT=1 is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for commit lock" and
- info = "set autocommit= 1";
---source include/wait_condition.inc
-unlock tables;
-connection default;
---echo # Reap SET AUTOCOMMIT=1.
---reap
-delete from t3_trans;
---echo #
---echo # Check that SET AUTOCOMMIT=1 blocks FTWRL in another connection.
-set autocommit= 0;
-insert into t3_trans values (1);
-set debug_sync='RESET';
-set debug_sync='ha_commit_trans_after_acquire_commit_lock SIGNAL parked WAIT_FOR go';
---send set autocommit= 1
-connection $con_aux1;
-set debug_sync='now WAIT_FOR parked';
---send flush tables with read lock
-connection $con_aux2;
---echo # Wait until FTWRL is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for commit lock" and
- info = "flush tables with read lock";
---source include/wait_condition.inc
-set debug_sync='now SIGNAL go';
-connection default;
---echo # Reap SET AUTOCOMMIT=1.
---reap
-connection $con_aux1;
---echo # Reap FTWRL.
---reap
-unlock tables;
-connection default;
-delete from t3_trans;
-set debug_sync= "RESET";
-
-
---echo #
---echo # 32) SHOW statements are compatible with FTWRL.
---echo # Let us test _some_ of them.
---echo #
---echo # 32.1) SHOW TABLES.
-let $statement= show tables from test;
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
-
---echo #
---echo # 32.1) SHOW TABLES.
-let $statement= show tables from test;
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
-
---echo #
---echo # 32.2) SHOW EVENTS.
-let $statement= show events from test;
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
-
---echo #
---echo # 32.3) SHOW GRANTS.
-create user mysqltest_u1;
-let $statement= show grants for mysqltest_u1;
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
-drop user mysqltest_u1;
-
---echo #
---echo # 32.4) SHOW CREATE TABLE.
-let $statement= show create table t1_base;
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
-
---echo #
---echo # 32.5) SHOW CREATE FUNCTION.
-let $statement= show create function f1;
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
-
-
---echo #
---echo # 33) SIGNAL statement is compatible with FTWRL.
---echo #
---echo # Note that we don't cover RESIGNAL as it requires
---echo # active handler context.
-let $statement= signal sqlstate '01000';
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
-
-
---echo #
---echo # 34) TRUNCATE TABLE statement.
---echo #
---echo # 34.a) TRUNCATE of base table is incompatible with FTWRL.
-let $statement= truncate table t1_base;
-let $cleanup_stmt1= ;
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 34.b) TRUNCATE of temporary table is compatible with FTWRL.
-let $statement= truncate table t1_temp;
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
-
-
---echo #
---echo # 35) UPDATE variants.
---echo #
---echo # 35.1) Simple UPDATE.
---echo #
---echo # 35.1.a) Simple UPDATE on base table is incompatible with FTWRL.
-let $statement= update t1_base set i= 1 where i = 0;
-let $cleanup_stmt1= ;
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 35.1.b) Simple UPDATE on temporary table is compatible with FTWRL.
-let $statement= update t1_temp set i= 1 where i = 0;
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
-
---echo #
---echo # 35.2) Multi UPDATE.
---echo #
---echo # 35.2.a) Multi UPDATE on base tables is incompatible with FTWRL.
-let $statement= update t1_base, t2_base set t1_base.i= 1 where t1_base.i = t2_base.j;
-let $cleanup_stmt1= ;
---source include/check_ftwrl_incompatible.inc
-
---echo #
---echo # 35.2.b) Multi UPDATE on temporary tables is compatible with FTWRL.
-let $statement= update t1_temp, t2_temp set t1_temp.i= 1 where t1_temp.i = t2_temp.j;
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
-
-
---echo #
---echo # 36) USE statement is compatible with FTWRL.
---echo #
-let $statement= use mysqltest1;
-let $cleanup_stmt= use test;
---source include/check_ftwrl_compatible.inc
-
-
---echo #
---echo # 37) XA statements.
---echo #
---echo # XA statements are similar to BEGIN/COMMIT/ROLLBACK.
---echo #
---echo # XA BEGIN, END, PREPARE, ROLLBACK and RECOVER are compatible
---echo # with FTWRL. XA COMMIT is not.
-flush tables with read lock;
---echo # Although all below statements are allowed under FTWRL they
---echo # are almost no-ops as FTWRL does commit and does not allows
---echo # any non-temporary DML under it.
-xa start 'test1';
-xa end 'test1';
-xa prepare 'test1';
-xa rollback 'test1';
-xa start 'test1';
-xa end 'test1';
-xa prepare 'test1';
-xa commit 'test1';
---disable_result_log
-xa recover;
---enable_result_log
-unlock tables;
---echo # Check that XA non-COMMIT statements are not and COMMIT is
---echo # blocked by active FTWRL in another connection
---echo #
-connection $con_aux1;
-flush tables with read lock;
-connection default;
-xa start 'test1';
-connection $con_aux1;
-unlock tables;
-connection default;
-insert into t3_trans values (1);
-connection $con_aux1;
-flush tables with read lock;
-connection default;
-xa end 'test1';
-xa prepare 'test1';
-xa rollback 'test1';
-connection $con_aux1;
-unlock tables;
-connection default;
-xa start 'test1';
-insert into t3_trans values (1);
-connection $con_aux1;
-flush tables with read lock;
-connection default;
-connection default;
-xa end 'test1';
-xa prepare 'test1';
---echo # Send:
---send xa commit 'test1';
-connection $con_aux1;
---echo # Wait until XA COMMIT is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for commit lock" and
- info = "xa commit 'test1'";
---source include/wait_condition.inc
-unlock tables;
-connection default;
---echo # Reap XA COMMIT.
---reap
-delete from t3_trans;
---echo #
---echo # Check that XA COMMIT blocks FTWRL in another connection.
-xa start 'test1';
-insert into t3_trans values (1);
-xa end 'test1';
-xa prepare 'test1';
-set debug_sync='RESET';
-set debug_sync='trans_xa_commit_after_acquire_commit_lock SIGNAL parked WAIT_FOR go';
---send xa commit 'test1'
-connection $con_aux1;
-set debug_sync='now WAIT_FOR parked';
---send flush tables with read lock
-connection $con_aux2;
---echo # Wait until FTWRL is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for commit lock" and
- info = "flush tables with read lock";
---source include/wait_condition.inc
-set debug_sync='now SIGNAL go';
-connection default;
---echo # Reap XA COMMIT.
---reap
-connection $con_aux1;
---echo # Reap FTWRL.
---reap
-unlock tables;
-connection default;
-delete from t3_trans;
-set debug_sync= "RESET";
-
-
---echo #
---echo # 38) Test effect of auto-commit mode for DML on transactional
---echo # temporary tables.
---echo #
---echo # 38.1) When auto-commit is on each such a statement ends with commit
---echo # of changes to temporary tables. But since transactions doing
---echo # such changes are considered read only [sic!/QQ] this commit
---echo # is compatible with FTWRL.
---echo #
---echo # Let us demostrate this fact for some common DML statements.
-let $statement= delete from t3_temp_trans;
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
-
-let $statement= insert into t3_temp_trans values (1);
-let $cleanup_stmt= delete from t3_temp_trans limit 1;
---source include/check_ftwrl_compatible.inc
-
-let $statement= update t3_temp_trans, t2_temp set t3_temp_trans.i= 1 where t3_temp_trans.i = t2_temp.j;
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
-
---echo #
---echo # 38.2) When auto-commit is off DML on transaction temporary tables
---echo # is compatible with FTWRL.
---echo #
-set autocommit= 0;
-let $statement= delete from t3_temp_trans;
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
-
-let $statement= insert into t3_temp_trans values (1);
-let $cleanup_stmt= delete from t3_temp_trans limit 1;
---source include/check_ftwrl_compatible.inc
-
-let $statement= update t3_temp_trans, t2_temp set t3_temp_trans.i= 1 where t3_temp_trans.i = t2_temp.j;
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
-set autocommit= 1;
-
-
---echo #
---echo # 39) Test effect of DDL on transactional tables.
---echo #
---echo # 39.1) Due to implicit commit at the end of statement some of DDL
---echo # statements which are compatible with FTWRL in non-transactional
---echo # case are not compatible in case of transactional tables.
---echo #
---echo # 39.1.a) ANALYZE TABLE for transactional table is incompatible with
---echo # FTWRL.
-flush tables with read lock;
---echo # Implicit commits are allowed under FTWRL.
-analyze table t3_trans;
-unlock tables;
---echo #
-connection $con_aux1;
-flush tables with read lock;
-connection default;
---send analyze table t3_trans
-connection $con_aux1;
---echo # Check that ANALYZE TABLE is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for commit lock" and
- info = "analyze table t3_trans";
---source include/wait_condition.inc
-unlock tables;
-connection default;
---echo # Reap ANALYZE TABLE
---reap
-
---echo #
---echo # 39.1.b) CHECK TABLE for transactional table is compatible with FTWRL.
---echo # Although it does implicit commit at the end of statement it
---echo # is considered to be read-only operation.
-let $statement= check table t3_trans;
-let $cleanup_stmt= ;
---echo # Skip last part of compatibility testing as this statement
---echo # releases metadata locks in non-standard place.
-let $skip_3rd_check= 1;
---source include/check_ftwrl_compatible.inc
-let $skip_3rd_check= ;
-
---echo #
---echo # 39.2) Situation with DDL on temporary transactional tables is
---echo # complex.
---echo #
---echo # 39.2.a) Some statements compatible with FTWRL since they don't
---echo # do implicit commit.
---echo #
---echo # For example, CREATE TEMPORARY TABLE:
-let $statement= create temporary table t4_temp_trans(i int) engine=innodb;
-let $cleanup_stmt= drop temporary tables t4_temp_trans;
---source include/check_ftwrl_compatible.inc
---echo #
---echo # Or DROP TEMPORARY TABLE:
-let $statement= drop temporary tables t3_temp_trans;
-let $cleanup_stmt= create temporary table t3_temp_trans(i int) engine=innodb;
---source include/check_ftwrl_compatible.inc
---echo #
---echo # 39.2.b) Some statements do implicit commit but are considered
---echo # read-only and so are compatible with FTWRL.
---echo #
---echo # For example, REPAIR TABLE:
-let $statement= repair table t3_temp_trans;
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
---echo #
---echo # And ANALYZE TABLE:
-let $statement= analyze table t3_temp_trans;
-let $cleanup_stmt= ;
---source include/check_ftwrl_compatible.inc
---echo #
---echo # And ALTER TABLE:
-let $statement= alter table t3_temp_trans add column c1 int;
-let $cleanup_stmt= alter table t3_temp_trans drop column c1;
---source include/check_ftwrl_compatible.inc
-
---echo #
---echo # 40) Test effect of implicit commit for DDL which is otherwise
---echo # compatible with FTWRL. Implicit commit at the start of DDL
---echo # statement can make it incompatible with FTWRL if there are
---echo # some changes to be commited even in case when DDL statement
---echo # itself is compatible with FTWRL.
---echo #
---echo # For example CHECK TABLE for base non-transactional tables and
---echo # ALTER TABLE for temporary non-transactional tables are affected.
-begin;
-insert into t3_trans values (1);
---echo #
-connection $con_aux1;
-flush tables with read lock;
-connection default;
---send check table t1_base
-connection $con_aux1;
---echo # Check that CHECK TABLE is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for commit lock" and
- info = "check table t1_base";
---source include/wait_condition.inc
-unlock tables;
-connection default;
---echo # Reap CHECK TABLE
---reap
-begin;
-delete from t3_trans;
---echo #
-connection $con_aux1;
-flush tables with read lock;
-connection default;
---send alter table t1_temp add column c1 int
-connection $con_aux1;
---echo # Check that ALTER TABLE is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for commit lock" and
- info = "alter table t1_temp add column c1 int";
---source include/wait_condition.inc
-unlock tables;
-connection default;
---echo # Reap ALTER TABLE
---reap
-alter table t1_temp drop column c1;
-
-
---echo #
---echo # Check that FLUSH TABLES WITH READ LOCK is blocked by individual
---echo # statements and is not blocked in the presence of transaction which
---echo # has done some changes earlier but is idle now (or does only reads).
---echo # This allows to use this statement even on systems which has long
---echo # running transactions.
---echo #
-begin;
-insert into t1_base values (1);
-insert into t3_trans values (1);
-connection $con_aux1;
---echo # The below FTWRL should not be blocked by transaction in 'default'.
-flush tables with read lock;
-connection default;
---echo # Transaction still is able to read even with FTWRL active in another
---echo # connection.
-select * from t1_base;
-select * from t2_base;
-select * from t3_trans;
-connection $con_aux1;
-unlock tables;
-connection default;
-commit;
-delete from t1_base;
-delete from t3_trans;
-
-
---echo #
---echo # Check that impending FTWRL blocks new DML statements and
---echo # so can't be starved by a constant flow of DML.
---echo # (a.k.a. test for bug #54673 "It takes too long to get
---echo # readlock for 'FLUSH TABLES WITH READ LOCK'").
---echo #
-set debug_sync='RESET';
-set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
---send insert into t1_base values (1)
-connection $con_aux1;
-set debug_sync='now WAIT_FOR parked';
---send flush tables with read lock
-connection $con_aux2;
---echo # Wait until FTWRL is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
- info = "flush tables with read lock";
---source include/wait_condition.inc
---echo # Try to run another INSERT and see that it is blocked.
---send insert into t2_base values (1);
-connection con3;
---echo # Wait until new INSERT is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
- info = "insert into t2_base values (1)";
---echo # Unblock INSERT in the first connection.
-set debug_sync='now SIGNAL go';
-connection default;
---echo # Reap first INSERT.
---reap
-connection $con_aux1;
---echo # Reap FTWRL.
---reap
-unlock tables;
-connection $con_aux2;
---echo # Reap second INSERT.
---reap
-connection default;
-set debug_sync= "RESET";
-delete from t1_base;
-delete from t2_base;
-
---echo
---echo # Check that COMMIT thas is issued after
---echo # FLUSH TABLES WITH READ LOCK is not blocked by
---echo # FLUSH TABLES WITH READ LOCK from another connection.
---echo # This scenario is used in innobackup.pl. The COMMIT goes
---echo # through because the transaction started by FTWRL does
---echo # not modify any tables, and the commit blocker lock is
---echo # only taken when there were such modifications.
---echo
-flush tables with read lock;
-connection $con_aux1;
---echo # The below FTWRL should not be blocked by transaction in 'default'.
-flush tables with read lock;
-connection default;
-select * from t1_base;
-select * from t3_trans;
-commit;
-connection $con_aux1;
-select * from t1_base;
-select * from t3_trans;
-commit;
-unlock tables;
-connection default;
-unlock tables;
-
-
---echo #
---echo # Check how FLUSH TABLE WITH READ LOCK is handled for MERGE tables.
---echo # As usual there are tricky cases related to this type of tables.
---echo #
---echo #
---echo # 1) Most typical case - base MERGE table with base underlying tables.
---echo #
---echo # 1.a) DML statements which change data should be incompatible with FTWRL.
-create table tm_base (i int) engine=merge union=(t1_base) insert_method=last;
-let $statement= insert into tm_base values (1);
-let $cleanup_stmt1= delete from tm_base;
---source include/check_ftwrl_incompatible.inc
---echo #
---echo # 1.b) DDL statement on such table should be incompatible with FTWRL as well.
-let $statement= alter table tm_base insert_method=first;
-let $cleanup_stmt1= alter table tm_base insert_method=last;
---source include/check_ftwrl_incompatible.inc
-drop table tm_base;
-
---echo #
---echo # 2) Temporary MERGE table with base underlying tables.
---echo #
---echo # 2.a) DML statements which change data should be incompatible with FTWRL
---echo # as they affect base tables.
-create temporary table tm_temp_base (i int) engine=merge union=(t1_base) insert_method=last;
-let $statement= insert into tm_temp_base values (1);
-let $cleanup_stmt1= delete from tm_temp_base;
---source include/check_ftwrl_incompatible.inc
---echo #
---echo # 2.b) Some of DDL statements on such table can be compatible with FTWRL
---echo # as they don't affect base tables.
-let $statement= drop temporary tables tm_temp_base;
-let $cleanup_stmt= create temporary table tm_temp_base (i int) engine=merge union=(t1_base) insert_method=last;
---source include/check_ftwrl_compatible.inc
---echo #
---echo # 2.c) ALTER statement is incompatible with FTWRL. Even though it does
---echo # not change data in base table it still acquires strong metadata
---echo # locks on them.
-let $statement= alter table tm_temp_base insert_method=first;
-let $cleanup_stmt1= alter table tm_temp_base insert_method=last;
---source include/check_ftwrl_incompatible.inc
-drop table tm_temp_base;
-
---echo #
---echo # 3) Temporary MERGE table with temporary underlying tables.
---echo #
---echo # 3.a) DML statements should be compatible with FTWRL as
---echo # no base table is going to be affected.
-create temporary table tm_temp_temp (i int) engine=merge union=(t1_temp) insert_method=last;
-let $statement= insert into tm_temp_temp values (1);
-let $cleanup_stmt= delete from tm_temp_temp;
---source include/check_ftwrl_compatible.inc
---echo #
---echo # 3.b) DDL statements should be compatible with FTWRL as well
---echo # as no base table is going to be affected too.
-let $statement= alter table tm_temp_temp union=(t1_temp) insert_method=first;
-let $cleanup_stmt= alter table tm_temp_temp union=(t1_temp) insert_method=last;
---source include/check_ftwrl_compatible.inc
-drop table tm_temp_temp;
-
---echo #
---echo # 4) For the sake of completeness let us check that base MERGE tables
---echo # with temporary underlying tables are not functional.
-create table tm_base_temp (i int) engine=merge union=(t1_temp) insert_method=last;
---error ER_WRONG_MRG_TABLE
-select * from tm_base_temp;
-drop table tm_base_temp;
-
-
---echo #
---echo # Clean-up.
---echo #
-drop event e1;
-drop function f2_temp;
-drop function f2_base;
-drop procedure p2;
-drop view v1;
-drop function f1;
-drop procedure p1;
-drop database `#mysql50#mysqltest-2`;
-drop database mysqltest1;
-drop temporary tables t1_temp, t2_temp;
-drop tables t1_base, t2_base, t3_trans;
-disconnect con1;
-disconnect con2;
-disconnect con3;
-
-set global sql_mode=default;
-# 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
diff --git a/mysql-test/t/flush_read_lock_kill.test b/mysql-test/t/flush_read_lock_kill.test
deleted file mode 100644
index d83e5b3f1df..00000000000
--- a/mysql-test/t/flush_read_lock_kill.test
+++ /dev/null
@@ -1,80 +0,0 @@
-# Let's see if FLUSH TABLES WITH READ LOCK can be killed when waiting
-# for running commits to finish (in the past it could not)
-# This will not be a meaningful test on non-debug servers so will be
-# skipped.
-
-# This also won't work with the embedded server test
---source include/not_embedded.inc
-
---source include/have_debug.inc
-
-# This test needs transactional engine as otherwise COMMIT
-# won't block FLUSH TABLES WITH GLOBAL READ LOCK.
---source include/have_innodb.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-connection con1;
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-SET DEBUG_SYNC= 'RESET';
-CREATE TABLE t1 (kill_id INT) engine = InnoDB;
-INSERT INTO t1 VALUES(connection_id());
-
-connection default;
---echo # Start transaction.
-BEGIN;
-INSERT INTO t1 VALUES(connection_id());
---echo # Ensure that COMMIT will pause once it acquires protection
---echo # against its global read lock.
-SET DEBUG_SYNC='ha_commit_trans_after_acquire_commit_lock SIGNAL acquired WAIT_FOR go';
-
---echo # Sending:
---send COMMIT
-
-connection con1;
---echo # Wait till COMMIT acquires protection against global read
---echo # lock and pauses.
-SET DEBUG_SYNC='now WAIT_FOR acquired';
---echo # Sending:
-send FLUSH TABLES WITH READ LOCK;
-
-connection con2;
-SELECT ((@id := kill_id) - kill_id) FROM t1 LIMIT 1;
-
---echo # Wait till FLUSH TABLES WITH READ LOCK blocks due
---echo # to active COMMIT
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for commit lock"
- and info = "flush tables with read lock";
---source include/wait_condition.inc
-
---echo # Kill connection 'con1'.
-KILL CONNECTION @id;
-
-connection con1;
---echo # Try to reap FLUSH TABLES WITH READ LOCK,
---echo # it fail due to killed statement and connection.
---error 1317,2013
-reap;
-
-connection con2;
---echo # Resume COMMIT.
-SET DEBUG_SYNC='now SIGNAL go';
-
-connection default;
---echo # Reaping COMMIT.
---reap
-disconnect con2;
-DROP TABLE t1;
-SET DEBUG_SYNC= 'RESET';
-
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
-
diff --git a/mysql-test/t/flush_table.test b/mysql-test/t/flush_table.test
deleted file mode 100644
index e4fc1b0c39f..00000000000
--- a/mysql-test/t/flush_table.test
+++ /dev/null
@@ -1,129 +0,0 @@
-# TODO: Only run this if we have privilege to do flush table
-
-#
-# Test of flush table
-#
-
-# Should work in embedded server after mysqltest is fixed
--- source include/not_embedded.inc
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-create table t1 (a int not null auto_increment primary key);
-insert into t1 values(0);
-
-# Test for with read lock + flush
-
-lock table t1 read;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-flush table t1;
-unlock tables;
-
-# Test for with write lock + flush
-
-lock table t1 write;
-flush table t1;
-check table t1;
-unlock tables;
-
-# Test for with a write lock and a waiting read lock + flush
-
-lock table t1 write;
-connect (locker,localhost,root,,test);
-connection locker;
-send lock table t1 read;
-connection default;
-sleep 2;
-flush table t1;
-select * from t1;
-unlock tables;
-connection locker;
-reap;
-unlock tables;
-connection default;
-
-# Test for with a write lock and a waiting write lock + flush
-
-lock table t1 write;
-connection locker;
-send lock table t1 write;
-connection default;
-sleep 2;
-flush table t1;
-select * from t1;
-unlock tables;
-connection locker;
-reap;
-unlock tables;
-select * from t1;
-connection default;
-drop table t1;
-disconnect locker;
-
-#
-# In the following test FLUSH TABLES produces a deadlock
-# (hang forever) if the fix for BUG #3565 is missing.
-# And it shows that handler tables are re-opened after flush (BUG #4286).
-#
-create table t1(table_id char(20) primary key);
-create table t2(table_id char(20) primary key);
-insert into t1 values ('test.t1');
-insert into t1 values ('');
-insert into t2 values ('test.t2');
-insert into t2 values ('');
-handler t1 open as a1;
-handler t1 open as a2;
-handler t2 open;
-handler a1 read first limit 9;
-handler a2 read first limit 9;
-handler t2 read first limit 9;
-flush tables;
-handler a1 read first limit 9;
-handler a2 read first limit 9;
-handler t2 read first limit 9;
-#
---error 1066
-handler t1 open as a1;
---error 1066
-handler t1 open as a2;
---error 1066
-handler t2 open;
-handler a1 read first limit 9;
-handler a2 read first limit 9;
-handler t2 read first limit 9;
-flush table t1;
-handler a1 read first limit 9;
-handler a2 read first limit 9;
-handler t2 read first limit 9;
-flush table t2;
-handler t2 close;
-drop table t1;
-drop table t2;
-
-#
-# The fix for BUG #4286 cannot restore the position after a flush.
-#
-create table t1(table_id char(20) primary key);
-insert into t1 values ('Record-01');
-insert into t1 values ('Record-02');
-insert into t1 values ('Record-03');
-insert into t1 values ('Record-04');
-insert into t1 values ('Record-05');
-handler t1 open;
-handler t1 read first limit 1;
-handler t1 read next limit 1;
-handler t1 read next limit 1;
-flush table t1;
-handler t1 read next limit 1;
-handler t1 read next limit 1;
-handler t1 close;
-drop table t1;
-
-#
-# Bug #11934 Two sequential FLUSH TABLES WITH READ LOCK hangs client
-#
-FLUSH TABLES WITH READ LOCK ;
-FLUSH TABLES WITH READ LOCK ;
-UNLOCK TABLES;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/foreign_key.test b/mysql-test/t/foreign_key.test
deleted file mode 100644
index 17c93332cb3..00000000000
--- a/mysql-test/t/foreign_key.test
+++ /dev/null
@@ -1,120 +0,0 @@
-#
-# Test syntax of foreign keys
-#
-
--- source include/have_innodb.inc
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-create table t1 (
- a int not null references t2,
- b int not null references t2 (c),
- primary key (a,b),
- foreign key (a) references t3 match full,
- foreign key (a) references t3 match partial,
- foreign key (a,b) references t3 (c,d) on delete no action
- on update no action,
- foreign key (a,b) references t3 (c,d) on update cascade,
- foreign key (a,b) references t3 (c,d) on delete set default,
- foreign key (a,b) references t3 (c,d) on update set null);
-
-create index a on t1 (a);
-create unique index b on t1 (a,b);
-drop table t1;
-
-# End of 4.1 tests
-
-#
-# Test DELETE IGNORE
-# Bug#44987 DELETE IGNORE and FK constraint
-#
-
-create table t1 (id int primary key) engine = innodb;
-create table t2 (id int PRIMARY KEY, FOREIGN KEY (id) REFERENCES t1(id)) engine=innodb;
-insert into t1 values (1), (2), (3), (4), (5), (6);
-insert into t2 values (3), (5);
-
---error 1451
-delete from t1;
-select * from t1;
-
-delete ignore from t1;
-select row_count();
-select * from t1;
-drop table t2;
-drop table t1;
-
-#
-# Bug#34455 (Ambiguous foreign keys syntax is accepted)
-#
-
---disable_warnings
-drop table if exists t_34455;
---enable_warnings
-
-# 2 match clauses, illegal
---error ER_PARSE_ERROR
-create table t_34455 (
- a int not null,
- foreign key (a) references t3 (a) match full match partial);
-
-# match after on delete, illegal
---error ER_PARSE_ERROR
-create table t_34455 (
- a int not null,
- foreign key (a) references t3 (a) on delete set default match full);
-
-# match after on update, illegal
---error ER_PARSE_ERROR
-create table t_34455 (
- a int not null,
- foreign key (a) references t3 (a) on update set default match full);
-
-# 2 on delete clauses, illegal
---error ER_PARSE_ERROR
-create table t_34455 (
- a int not null,
- foreign key (a) references t3 (a)
- on delete set default on delete set default);
-
-# 2 on update clauses, illegal
---error ER_PARSE_ERROR
-create table t_34455 (
- a int not null,
- foreign key (a) references t3 (a)
- on update set default on update set default);
-
-create table t_34455 (a int not null);
-
-# 2 match clauses, illegal
---error ER_PARSE_ERROR
-alter table t_34455
- add foreign key (a) references t3 (a) match full match partial);
-
-# match after on delete, illegal
---error ER_PARSE_ERROR
-alter table t_34455
- add foreign key (a) references t3 (a) on delete set default match full);
-
-# match after on update, illegal
---error ER_PARSE_ERROR
-alter table t_34455
- add foreign key (a) references t3 (a) on update set default match full);
-
-# 2 on delete clauses, illegal
---error ER_PARSE_ERROR
-alter table t_34455
- add foreign key (a) references t3 (a)
- on delete set default on delete set default);
-
-# 2 on update clauses, illegal
---error ER_PARSE_ERROR
-alter table t_34455
- add foreign key (a) references t3 (a)
- on update set default on update set default);
-
-drop table t_34455;
-
-
diff --git a/mysql-test/t/frm_bad_row_type-7333.test b/mysql-test/t/frm_bad_row_type-7333.test
deleted file mode 100644
index 916550402c9..00000000000
--- a/mysql-test/t/frm_bad_row_type-7333.test
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# MDEV-7333 "'show table status like 'table_name'" on tokudb table lead to MariaDB crash
-#
-let $datadir= `select @@datadir`;
-call mtr.add_suppression("bad_row_type.frm: invalid value 11 for the field row_format");
-copy_file std_data/bad_row_type.MYD $datadir/test/bad_row_type.MYD;
-copy_file std_data/bad_row_type.MYI $datadir/test/bad_row_type.MYI;
-copy_file std_data/bad_row_type.frm $datadir/test/bad_row_type.frm;
-
-select * from bad_row_type;
-show create table bad_row_type;
-replace_column 12 x 13 x 19 x;
-show table status like 'bad_row_type';
-drop table bad_row_type;
diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test
deleted file mode 100644
index 2e53ce7f112..00000000000
--- a/mysql-test/t/fulltext.test
+++ /dev/null
@@ -1,718 +0,0 @@
-#
-# Test of fulltext index
-#
-
-let collation=utf8_unicode_ci;
---source include/have_collation.inc
-
---disable_warnings
-drop table if exists t1,t2,t3;
---enable_warnings
-
-CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b));
-INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),
- ('Full-text indexes', 'are called collections'),
- ('Only MyISAM tables','support collections'),
- ('Function MATCH ... AGAINST()','is used to do a search'),
- ('Full-text search in MySQL', 'implements vector space model');
-SHOW INDEX FROM t1;
-
-# nl search
-
-select * from t1 where MATCH(a,b) AGAINST ("collections");
-explain extended select * from t1 where MATCH(a,b) AGAINST ("collections");
-select * from t1 where MATCH(a,b) AGAINST ("indexes");
-select * from t1 where MATCH(a,b) AGAINST ("indexes collections");
-select * from t1 where MATCH(a,b) AGAINST ("only");
-
-# query expansion
-
-select * from t1 where MATCH(a,b) AGAINST ("collections" WITH QUERY EXPANSION);
-select * from t1 where MATCH(a,b) AGAINST ("indexes" WITH QUERY EXPANSION);
-select * from t1 where MATCH(a,b) AGAINST ("indexes collections" WITH QUERY EXPANSION);
-
-# IN NATURAL LANGUAGE MODE
-select * from t1 where MATCH(a,b) AGAINST ("indexes" IN NATURAL LANGUAGE MODE);
-select * from t1 where MATCH(a,b) AGAINST ("indexes" IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION);
---error 1064
-select * from t1 where MATCH(a,b) AGAINST ("indexes" IN BOOLEAN MODE WITH QUERY EXPANSION);
-
-# add_ft_keys() tests
-
-explain select * from t1 where MATCH(a,b) AGAINST ("collections");
-explain select * from t1 where MATCH(a,b) AGAINST ("collections")>0;
-explain select * from t1 where MATCH(a,b) AGAINST ("collections")>1;
-explain select * from t1 where MATCH(a,b) AGAINST ("collections")>=0;
-explain select * from t1 where MATCH(a,b) AGAINST ("collections")>=1;
-explain select * from t1 where 0<MATCH(a,b) AGAINST ("collections");
-explain select * from t1 where 1<MATCH(a,b) AGAINST ("collections");
-explain select * from t1 where 0<=MATCH(a,b) AGAINST ("collections");
-explain select * from t1 where 1<=MATCH(a,b) AGAINST ("collections");
-explain select * from t1 where MATCH(a,b) AGAINST ("collections")>0 and a like '%ll%';
-
-# boolean search
-
-select * from t1 where MATCH(a,b) AGAINST("support -collections" IN BOOLEAN MODE);
-explain extended select * from t1 where MATCH(a,b) AGAINST("support -collections" IN BOOLEAN MODE);
-select * from t1 where MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE);
-select * from t1 where MATCH(a,b) AGAINST("support +collections" IN BOOLEAN MODE);
-select * from t1 where MATCH(a,b) AGAINST("sear*" IN BOOLEAN MODE);
-select * from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
-select * from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
-select * from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
-select * from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
-select *, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
-select *, MATCH(a,b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1;
-
-select * from t1 where MATCH a,b AGAINST ("+call* +coll*" IN BOOLEAN MODE);
-
-select * from t1 where MATCH a,b AGAINST ('"support now"' IN BOOLEAN MODE);
-select * from t1 where MATCH a,b AGAINST ('"Now sUPPort"' IN BOOLEAN MODE);
-select * from t1 where MATCH a,b AGAINST ('"now support"' IN BOOLEAN MODE);
-select * from t1 where MATCH a,b AGAINST ('"text search" "now support"' IN BOOLEAN MODE);
-select * from t1 where MATCH a,b AGAINST ('"text search" -"now support"' IN BOOLEAN MODE);
-select * from t1 where MATCH a,b AGAINST ('"text search" +"now support"' IN BOOLEAN MODE);
-select * from t1 where MATCH a,b AGAINST ('"text i"' IN BOOLEAN MODE);
-select * from t1 where MATCH a,b AGAINST ('"xt indexes"' IN BOOLEAN MODE);
-
-select * from t1 where MATCH a,b AGAINST ('+(support collections) +foobar*' IN BOOLEAN MODE);
-select * from t1 where MATCH a,b AGAINST ('+(+(support collections)) +foobar*' IN BOOLEAN MODE);
-select * from t1 where MATCH a,b AGAINST ('+collections -supp* -foobar*' IN BOOLEAN MODE);
-
-# bug#2708, bug#3870 crash
-
-select * from t1 where MATCH a,b AGAINST('"space model' IN BOOLEAN MODE);
-
-# boolean w/o index:
-
-select * from t1 where MATCH a AGAINST ("search" IN BOOLEAN MODE);
-select * from t1 where MATCH b AGAINST ("sear*" IN BOOLEAN MODE);
-
-# UNION of fulltext's
-select * from t1 where MATCH(a,b) AGAINST ("collections") UNION ALL select * from t1 where MATCH(a,b) AGAINST ("indexes");
-
-#update/delete with fulltext index
-
-delete from t1 where a like "MySQL%";
-update t1 set a='some test foobar' where MATCH a,b AGAINST ('model');
-delete from t1 where MATCH(a,b) AGAINST ("indexes");
-select * from t1;
-drop table t1;
-
-#
-# why to scan strings for trunc*
-#
-create table t1 (a varchar(200) not null, fulltext (a));
-insert t1 values ("aaa10 bbb20"), ("aaa20 bbb15"), ("aaa30 bbb10");
-select * from t1 where match a against ("+aaa* +bbb*" in boolean mode);
-select * from t1 where match a against ("+aaa* +bbb1*" in boolean mode);
-select * from t1 where match a against ("+aaa* +ccc*" in boolean mode);
-select * from t1 where match a against ("+aaa10 +(bbb*)" in boolean mode);
-select * from t1 where match a against ("+(+aaa* +bbb1*)" in boolean mode);
-select * from t1 where match a against ("(+aaa* +bbb1*)" in boolean mode);
-drop table t1;
-
-#
-# Check bug reported by Matthias Urlichs
-#
-
-CREATE TABLE t1 (
- id int(11),
- ticket int(11),
- KEY ti (id),
- KEY tit (ticket)
-);
-INSERT INTO t1 VALUES (2,3),(1,2);
-
-CREATE TABLE t2 (
- ticket int(11),
- inhalt text,
- KEY tig (ticket),
- fulltext index tix (inhalt)
-);
-INSERT INTO t2 VALUES (1,'foo'),(2,'bar'),(3,'foobar');
-
-select t1.id FROM t2 as ttxt,t1,t1 as ticket2
-WHERE ticket2.id = ttxt.ticket AND t1.id = ticket2.ticket and
-match(ttxt.inhalt) against ('foobar');
-
-# In the following query MySQL didn't use the fulltext index
-select ticket2.id FROM t2 as ttxt,t2 INNER JOIN t1 as ticket2 ON
-ticket2.id = t2.ticket
-WHERE ticket2.id = ticket2.ticket and match(ttxt.inhalt) against ('foobar');
-
-INSERT INTO t1 VALUES (3,3);
-select ticket2.id FROM t2 as ttxt,t2
-INNER JOIN t1 as ticket2 ON ticket2.id = t2.ticket
-WHERE ticket2.id = ticket2.ticket and
- match(ttxt.inhalt) against ('foobar');
-
-# Check that we get 'fulltext' index in SHOW CREATE
-
-show keys from t2;
-show create table t2;
-
-# check for bug reported by Stephan Skusa
-
-select * from t2 where MATCH inhalt AGAINST (NULL);
-
-# MATCH in HAVING (pretty useless, but still it should work)
-
-select * from t2 where MATCH inhalt AGAINST ('foobar');
-select * from t2 having MATCH inhalt AGAINST ('foobar');
-
-#
-# check of fulltext errors
-#
-
---error 1283
-CREATE TABLE t3 (t int(11),i text,fulltext tix (t,i));
---error 1283
-CREATE TABLE t3 (t int(11),i text,
- j varchar(200) CHARACTER SET latin2,
- fulltext tix (i,j));
-
-CREATE TABLE t3 (
- ticket int(11),
- inhalt text,
- KEY tig (ticket),
- fulltext index tix (inhalt)
-);
-
---error 1210
-select * from t2 where MATCH inhalt AGAINST (t2.inhalt);
---error 1191
-select * from t2 where MATCH ticket AGAINST ('foobar');
---error 1210
-select * from t2,t3 where MATCH (t2.inhalt,t3.inhalt) AGAINST ('foobar');
-
-drop table t1,t2,t3;
-
-#
-# three more bugtests
-#
-
-CREATE TABLE t1 (
- id int(11) auto_increment,
- title varchar(100) default '',
- PRIMARY KEY (id),
- KEY ind5 (title)
-) ENGINE=MyISAM;
-
-CREATE FULLTEXT INDEX ft1 ON t1(title);
-insert into t1 (title) values ('this is a test');
-select * from t1 where match title against ('test' in boolean mode);
-update t1 set title='this is A test' where id=1;
-check table t1;
-update t1 set title='this test once revealed a bug' where id=1;
-select * from t1;
-update t1 set title=NULL where id=1;
-
-drop table t1;
-
-# one more bug - const_table related
-
-CREATE TABLE t1 (a int(11), b text, FULLTEXT KEY (b)) ENGINE=MyISAM;
-insert into t1 values (1,"I wonder why the fulltext index doesnt work?");
-SELECT * from t1 where MATCH (b) AGAINST ('apples');
-
-insert into t1 values (2,"fullaaa fullzzz");
-select * from t1 where match b against ('full*' in boolean mode);
-
-drop table t1;
-CREATE TABLE t1 ( id int(11) NOT NULL auto_increment primary key, mytext text NOT NULL, FULLTEXT KEY mytext (mytext)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,'my small mouse'),(2,'la-la-la'),(3,'It is so funny'),(4,'MySQL Tutorial');
-select 8 from t1;
-drop table t1;
-
-#
-# Check bug reported by Julian Ladisch
-# ERROR 1030: Got error 127 from table handler
-#
-
-create table t1 (a text, fulltext key (a));
-insert into t1 values ('aaaa');
-repair table t1;
-select * from t1 where match (a) against ('aaaa');
-drop table t1;
-
-#
-# bug #283 by jocelyn fournier <joc@presence-pc.com>
-# FULLTEXT index on a TEXT filed converted to a CHAR field doesn't work anymore
-#
-
-create table t1 ( ref_mag text not null, fulltext (ref_mag));
-insert into t1 values ('test');
-select ref_mag from t1 where match ref_mag against ('+test' in boolean mode);
-alter table t1 change ref_mag ref_mag char (255) not null;
-select ref_mag from t1 where match ref_mag against ('+test' in boolean mode);
-drop table t1;
-
-#
-# bug #942: JOIN
-#
-
-create table t1 (t1_id int(11) primary key, name varchar(32));
-insert into t1 values (1, 'data1');
-insert into t1 values (2, 'data2');
-create table t2 (t2_id int(11) primary key, t1_id int(11), name varchar(32));
-insert into t2 values (1, 1, 'xxfoo');
-insert into t2 values (2, 1, 'xxbar');
-insert into t2 values (3, 1, 'xxbuz');
-select * from t1 join t2 using(`t1_id`) where match (t1.name, t2.name) against('xxfoo' in boolean mode);
-
-#
-# Bug #7858: bug with many short (< ft_min_word_len) words in boolean search
-#
-select * from t2 where match name against ('*a*b*c*d*e*f*' in boolean mode);
-drop table t1,t2;
-
-#
-# bug with repair-by-sort and incorrect records estimation
-#
-
-create table t1 (a text, fulltext key (a));
-insert into t1 select "xxxx yyyy zzzz";
-drop table t1;
-
-#
-# UTF8
-#
-SET NAMES latin1;
-CREATE TABLE t1 (t text character set utf8 not null, fulltext(t));
-INSERT t1 VALUES ('Mit freundlichem Gr'), ('aus Osnabrck');
-SET NAMES koi8r;
-INSERT t1 VALUES (" - "),(", !"),
- (" , !"),(" !");
-SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('');
-SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('*' IN BOOLEAN MODE);
-SELECT * FROM t1 WHERE MATCH t AGAINST ('' IN BOOLEAN MODE);
-SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrck');
-SET NAMES latin1;
-SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrck');
-SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrueck');
-SELECT t, collation(t),FORMAT(MATCH t AGAINST ('Osnabruck'),6) FROM t1 WHERE MATCH t AGAINST ('Osnabruck');
-#alter table t1 modify t text character set latin1 collate latin1_german2_ci not null;
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-alter table t1 modify t varchar(200) collate latin1_german2_ci not null;
-SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrck');
-SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrueck');
-DROP TABLE t1;
-
-#
-# bug#3964
-#
-
-CREATE TABLE t1 (s varchar(255), FULLTEXT (s)) DEFAULT CHARSET=utf8;
-insert into t1 (s) values ('pra para para'),('para para para');
-select * from t1 where match(s) against('para' in boolean mode);
-select * from t1 where match(s) against('par*' in boolean mode);
-DROP TABLE t1;
-
-#
-# icc -ip bug (ip = interprocedural optimization)
-# bug#5528
-#
-CREATE TABLE t1 (h text, FULLTEXT (h));
-INSERT INTO t1 VALUES ('Jesses Hasse Ling and his syncopators of Swing');
-REPAIR TABLE t1;
-select count(*) from t1;
-drop table t1;
-
-#
-# testing out of bounds memory access in ft_nlq_find_relevance()
-# (bug#8522); visible in valgrind.
-#
-CREATE TABLE t1 ( a TEXT, FULLTEXT (a) );
-INSERT INTO t1 VALUES ('testing ft_nlq_find_relevance');
-SELECT MATCH(a) AGAINST ('nosuchword') FROM t1;
-DROP TABLE t1;
-#
-# bug#6784
-# mi_flush_bulk_insert (on dup key error in mi_write)
-# was mangling info->dupp_key_pos
-#
-
-create table t1 (a int primary key, b text, fulltext(b));
-create table t2 (a int, b text);
-insert t1 values (1, "aaaa"), (2, "bbbb");
-insert t2 values (10, "aaaa"), (2, "cccc");
-replace t1 select * from t2;
-drop table t1, t2;
-
-#
-# bug#8351
-#
-CREATE TABLE t1 (t VARCHAR(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci, FULLTEXT (t));
-SET NAMES latin1;
-INSERT INTO t1 VALUES('Mit freundlichem Gr aus Osnabrck');
-SELECT COUNT(*) FROM t1 WHERE MATCH(t) AGAINST ('"osnabrck"' IN BOOLEAN MODE);
-DROP TABLE t1;
-
-#
-# BUG#11684 - repair crashes mysql when table has fulltext index
-#
-
-CREATE TABLE t1 (a VARCHAR(30), FULLTEXT(a));
-INSERT INTO t1 VALUES('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
-SET myisam_repair_threads=2;
-REPAIR TABLE t1;
-SET myisam_repair_threads=@@global.myisam_repair_threads;
-
-#
-# BUG#5686 - #1034 - Incorrect key file for table - only utf8
-#
-INSERT INTO t1 VALUES('testword\'\'');
-SELECT a FROM t1 WHERE MATCH a AGAINST('testword' IN BOOLEAN MODE);
-SELECT a FROM t1 WHERE MATCH a AGAINST('testword\'\'' IN BOOLEAN MODE);
-
-#
-# BUG#14194: Problem with fulltext boolean search and apostrophe
-#
-INSERT INTO t1 VALUES('test\'s');
-SELECT a FROM t1 WHERE MATCH a AGAINST('test' IN BOOLEAN MODE);
-DROP TABLE t1;
-
-#
-# BUG#13835: max key length is 1000 bytes when trying to create
-# a fulltext index
-#
-CREATE TABLE t1 (a VARCHAR(10000), FULLTEXT(a));
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-#
-# BUG#14496: Crash or strange results with prepared statement,
-# MATCH and FULLTEXT
-#
-CREATE TABLE t1 (a TEXT, FULLTEXT KEY(a));
-INSERT INTO t1 VALUES('test'),('test1'),('test');
-PREPARE stmt from "SELECT a, FORMAT(MATCH(a) AGAINST('test1 test'),6) FROM t1 WHERE MATCH(a) AGAINST('test1 test')";
-EXECUTE stmt;
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-DROP TABLE t1;
-
-#
-# BUG#25951 - ignore/use index does not work with fulltext
-#
-CREATE TABLE t1 (a VARCHAR(255), FULLTEXT(a));
-SELECT * FROM t1 IGNORE INDEX(a) WHERE MATCH(a) AGAINST('test');
-ALTER TABLE t1 DISABLE KEYS;
---error 1191
-SELECT * FROM t1 WHERE MATCH(a) AGAINST('test');
-DROP TABLE t1;
-
-#
-# BUG#11392 - fulltext search bug
-#
-CREATE TABLE t1(a TEXT);
-INSERT INTO t1 VALUES(' aaaaa aaaa');
-SELECT * FROM t1 WHERE MATCH(a) AGAINST ('"aaaa"' IN BOOLEAN MODE);
-DROP TABLE t1;
-
-#
-# BUG#29445 - match ... against () never returns
-#
-CREATE TABLE t1(a VARCHAR(20), FULLTEXT(a));
-INSERT INTO t1 VALUES('Offside'),('City Of God');
-SELECT a FROM t1 WHERE MATCH a AGAINST ('+city of*' IN BOOLEAN MODE);
-SELECT a FROM t1 WHERE MATCH a AGAINST ('+city (of*)' IN BOOLEAN MODE);
-SELECT a FROM t1 WHERE MATCH a AGAINST ('+city* of*' IN BOOLEAN MODE);
-DROP TABLE t1;
-
-# End of 4.1 tests
-
-#
-# bug#34374 - mysql generates incorrect warning
-#
-create table t1(a text,b date,fulltext index(a))engine=myisam;
-insert into t1 set a='water',b='2008-08-04';
-select 1 from t1 where match(a) against ('water' in boolean mode) and b>='2008-08-01';
-drop table t1;
-show warnings;
-
-#
-# BUG#38842 - Fix for 25951 seems incorrect
-#
-CREATE TABLE t1 (a VARCHAR(255), b INT, FULLTEXT(a), KEY(b));
-INSERT INTO t1 VALUES('test', 1),('test', 1),('test', 1),('test', 1),
- ('test', 1),('test', 2),('test', 3),('test', 4);
-INSERT INTO t1 VALUES('test', 5),('test', 6),('test', 7),('test', 8),
- ('test', 5),('test', 6),('test', 7),('test', 8);
-
-EXPLAIN SELECT * FROM t1
-WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
-
-EXPLAIN SELECT * FROM t1 USE INDEX(a)
-WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
-
-EXPLAIN SELECT * FROM t1 FORCE INDEX(a)
-WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
-
-EXPLAIN SELECT * FROM t1 IGNORE INDEX(a)
-WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
-
-EXPLAIN SELECT * FROM t1 USE INDEX(b)
-WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
-
-EXPLAIN SELECT * FROM t1 FORCE INDEX(b)
-WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
-
-DROP TABLE t1;
-
-#
-# bug#34374 - mysql generates incorrect warning
-#
-create table t1(a text,b date,fulltext index(a))engine=myisam;
-insert into t1 set a='water',b='2008-08-04';
-select 1 from t1 where match(a) against ('water' in boolean mode) and b>='2008-08-01';
-drop table t1;
-show warnings;
-
-#
-# BUG#37245 - Full text search problem
-#
-CREATE TABLE t1(a CHAR(10));
-INSERT INTO t1 VALUES('aaa15');
-SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa16' IN BOOLEAN MODE) FROM t1;
-SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE) FROM t1;
-DROP TABLE t1;
-
-#
-# BUG#36737 - having + full text operator crashes mysql
-#
-CREATE TABLE t1(a TEXT);
---error ER_WRONG_ARGUMENTS
-SELECT GROUP_CONCAT(a) AS st FROM t1 HAVING MATCH(st) AGAINST('test' IN BOOLEAN MODE);
-DROP TABLE t1;
-
-#
-# BUG#42907 - Multi-term boolean fulltext query containing a single
-# quote fails in 5.1.x
-#
-CREATE TABLE t1(a VARCHAR(64), FULLTEXT(a));
-INSERT INTO t1 VALUES('awrd bwrd cwrd'),('awrd bwrd cwrd'),('awrd bwrd cwrd');
-SELECT * FROM t1 WHERE MATCH(a) AGAINST('+awrd bwrd* +cwrd*' IN BOOLEAN MODE);
-DROP TABLE t1;
-
-#
-# BUG#37740 Server crashes on execute statement with full text search and match against
-#
-CREATE TABLE t1 (col text, FULLTEXT KEY full_text (col));
-
-PREPARE s FROM
- "SELECT MATCH (col) AGAINST('findme') FROM t1 ORDER BY MATCH (col) AGAINST('findme')"
- ;
-
-EXECUTE s;
-DEALLOCATE PREPARE s;
-DROP TABLE t1;
-
-
---echo #
---echo # Bug #49250 : spatial btree index corruption and crash
---echo # Part two : fulltext syntax check
---echo #
-
---error ER_PARSE_ERROR
-CREATE TABLE t1(col1 TEXT,
- FULLTEXT INDEX USING BTREE (col1));
-CREATE TABLE t2(col1 TEXT);
---error ER_PARSE_ERROR
-CREATE FULLTEXT INDEX USING BTREE ON t2(col);
---error ER_PARSE_ERROR
-ALTER TABLE t2 ADD FULLTEXT INDEX USING BTREE (col1);
-
-DROP TABLE t2;
-
-
---echo End of 5.0 tests
-
-
---echo #
---echo # Bug #47930: MATCH IN BOOLEAN MODE returns too many results
---echo # inside subquery
---echo #
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (1), (2);
-
-CREATE TABLE t2 (a int, b2 char(10), FULLTEXT KEY b2 (b2));
-INSERT INTO t2 VALUES (1,'Scargill');
-
-CREATE TABLE t3 (a int, b int);
-INSERT INTO t3 VALUES (1,1), (2,1);
-
---echo # t2 should use full text index
-EXPLAIN
-SELECT count(*) FROM t1 WHERE
- not exists(
- SELECT 1 FROM t2, t3
- WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE)
- );
-
---echo # should return 0
-SELECT count(*) FROM t1 WHERE
- not exists(
- SELECT 1 FROM t2, t3
- WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE)
- );
-
---echo # should return 0
-SELECT count(*) FROM t1 WHERE
- not exists(
- SELECT 1 FROM t2 IGNORE INDEX (b2), t3
- WHERE t3.a=t1.a AND MATCH(b2) AGAINST('scargill' IN BOOLEAN MODE)
- );
-
-DROP TABLE t1,t2,t3;
-
-#
-# BUG#50351 - ft_min_word_len=2 Causes query to hang
-#
-CREATE TABLE t1 (a VARCHAR(4), FULLTEXT(a));
-INSERT INTO t1 VALUES
-('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
-('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
-('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
-('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
-('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
-('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
-('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
-('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
-('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
-('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
-('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
-('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),
-('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('cwrd'),('awrd'),('cwrd'),
-('awrd');
-SELECT COUNT(*) FROM t1 WHERE MATCH(a) AGAINST("+awrd bwrd* +cwrd*" IN BOOLEAN MODE);
-DROP TABLE t1;
-
---echo #
---echo # Bug #49445: Assertion failed: 0, file .\item_row.cc, line 55 with
---echo # fulltext search and row op
---echo #
-
-CREATE TABLE t1(a CHAR(1),FULLTEXT(a));
-SELECT 1 FROM t1 WHERE MATCH(a) AGAINST ('') AND ROW(a,a) > ROW(1,1);
-DROP TABLE t1;
-
---echo #
---echo # BUG#51866 - crash with repair by sort and fulltext keys
---echo #
-CREATE TABLE t1(a CHAR(4), FULLTEXT(a));
-INSERT INTO t1 VALUES('aaaa');
-SET myisam_sort_buffer_size=4;
-REPAIR TABLE t1;
-SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
-DROP TABLE t1;
-
---echo #
---echo # Bug#54484 explain + prepared statement: crash and Got error -1 from storage engine
---echo #
-
-CREATE TABLE t1(f1 VARCHAR(6) NOT NULL, FULLTEXT KEY(f1), UNIQUE(f1));
-INSERT INTO t1 VALUES ('test');
---disable_warnings
-SELECT 1 FROM t1 WHERE 1 >
- ALL((SELECT 1 FROM t1 JOIN t1 a
- ON (MATCH(t1.f1) against (""))
- WHERE t1.f1 GROUP BY t1.f1)) xor f1;
-
-PREPARE stmt FROM
-'SELECT 1 FROM t1 WHERE 1 >
- ALL((SELECT 1 FROM t1 RIGHT OUTER JOIN t1 a
- ON (MATCH(t1.f1) against (""))
- WHERE t1.f1 GROUP BY t1.f1)) xor f1';
-
-EXECUTE stmt;
-EXECUTE stmt;
-
-DEALLOCATE PREPARE stmt;
-
-PREPARE stmt FROM
-'SELECT 1 FROM t1 WHERE 1 >
- ALL((SELECT 1 FROM t1 JOIN t1 a
- ON (MATCH(t1.f1) against (""))
- WHERE t1.f1 GROUP BY t1.f1))';
-
-EXECUTE stmt;
-EXECUTE stmt;
-
-DEALLOCATE PREPARE stmt;
---enable_warnings
-
-DROP TABLE t1;
-
---echo End of 5.1 tests
-
---echo #
---echo # Start of 5.5 tests
---echo #
-
---echo #
---echo # MDEV-6146 Can't mix (latin1_swedish_ci,NUMERIC) and (utf8_unicode_ci,IMPLICIT) for MATCH
---echo #
-SET NAMES utf8;
-CREATE TABLE t1
-(
- txt text COLLATE utf8_unicode_ci NOT NULL,
- uid int(11) NOT NULL,
- id2 int(11) NOT NULL,
- KEY uid (uid),
- KEY id2 (id2)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-INSERT INTO t1 VALUES ('txt1',1234,5678);
-SELECT * FROM t1 WHERE MATCH (id2, uid, txt) AGAINST ('txt1' IN BOOLEAN MODE);
-SELECT * FROM t1 WHERE MATCH (id2, uid, txt) AGAINST ('1234' IN BOOLEAN MODE);
-SELECT * FROM t1 WHERE MATCH (id2, uid, txt) AGAINST ('5678' IN BOOLEAN MODE);
-DROP TABLE t1;
-
-CREATE TABLE t1 (
- txt1 text COLLATE utf8_unicode_ci NOT NULL,
- txt2 text COLLATE latin1_swedish_ci NOT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-INSERT INTO t1 VALUES ('nnn1 x1 y1 ööö1','mmm1 ùùù1');
-INSERT INTO t1 VALUES ('nnn2 x2 y2 ööö2','mmm2 ùùù2');
-INSERT INTO t1 VALUES ('nnn3 x3 y3 ööö3','mmm3 ùùù3');
-INSERT INTO t1 VALUES ('nnn4 x4 y4 ööö4','mmm4 ùùù4');
-INSERT INTO t1 VALUES ('nnn5 x5 y5 ööö5','mmm5 ');
-SELECT * FROM t1 WHERE MATCH (txt1,txt2) AGAINST ('ööö1' IN BOOLEAN MODE);
-SELECT * FROM t1 WHERE MATCH (txt1,txt2) AGAINST ('ùùù2' IN BOOLEAN MODE);
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-14743: Server crashes in Item_func_match::init_search
---echo #
-
-CREATE TABLE t1 (f VARCHAR(8));
-INSERT INTO t1 VALUES ('foo'),('bar');
-
-SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) );
-SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE )) as f1, MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) as f2 from t1 ;
-explain extended
-SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE )) as f1, MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) as f2 from t1 ;
-
-drop table t1;
-
---echo #
---echo # End of 5.5 tests
---echo #
-
-#
-# MDEV-318 IF (NOT) EXIST clauses for ALTER TABLE (MWL #252).
-#
-
-CREATE TABLE t1 (
- id int(11) auto_increment,
- title varchar(100) default '',
- PRIMARY KEY (id),
- KEY ind5 (title)
-) ENGINE=MyISAM;
-
-CREATE FULLTEXT INDEX IF NOT EXISTS ft1 ON t1(title);
-CREATE FULLTEXT INDEX IF NOT EXISTS ft1 ON t1(title);
-DROP TABLE t1;
diff --git a/mysql-test/t/fulltext2.test b/mysql-test/t/fulltext2.test
deleted file mode 100644
index 78c7c859e95..00000000000
--- a/mysql-test/t/fulltext2.test
+++ /dev/null
@@ -1,240 +0,0 @@
-#
-# test of new fulltext search features
-#
-
-let collation=utf8_unicode_ci;
---source include/have_collation.inc
-
-#
-# two-level tree
-#
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (
- i int(10) unsigned not null auto_increment primary key,
- a varchar(255) not null,
- FULLTEXT KEY (a)
-) ENGINE=MyISAM;
-
-# two-level entry, second-level tree with depth 2
---disable_query_log
-begin;
-let $1=260;
-while ($1)
-{
- eval insert t1 (a) values ('aaaxxx');
- dec $1;
-}
-
-# two-level entry, second-level tree has only one page
-let $1=255;
-while ($1)
-{
- eval insert t1 (a) values ('aaazzz');
- dec $1;
-}
-
-# one-level entry (entries)
-let $1=250;
-while ($1)
-{
- eval insert t1 (a) values ('aaayyy');
- dec $1;
-}
-commit;
---enable_query_log
-
-# converting to two-level
-repair table t1 quick;
-check table t1;
-optimize table t1; # BUG#5327 - mi_sort_index() of 2-level tree
-check table t1;
-
-select count(*) from t1 where match a against ('aaaxxx');
-select count(*) from t1 where match a against ('aaayyy');
-select count(*) from t1 where match a against ('aaazzz');
-select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
-select count(*) from t1 where match a against ('aaayyy' in boolean mode);
-select count(*) from t1 where match a against ('aaazzz' in boolean mode);
-select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz');
-select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz' in boolean mode);
-
-select count(*) from t1 where match a against ('aaax*' in boolean mode);
-select count(*) from t1 where match a against ('aaay*' in boolean mode);
-select count(*) from t1 where match a against ('aaa*' in boolean mode);
-
-# mi_write:
-
-insert t1 (a) values ('aaaxxx'),('aaayyy');
-# call to enlarge_root() below
-insert t1 (a) values ('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz');
-select count(*) from t1 where match a against ('aaaxxx');
-select count(*) from t1 where match a against ('aaayyy');
-select count(*) from t1 where match a against ('aaazzz');
-
-# mi_delete
-insert t1 (a) values ('aaaxxx 000000');
-select count(*) from t1 where match a against ('000000');
-delete from t1 where match a against ('000000');
-select count(*) from t1 where match a against ('000000');
-select count(*) from t1 where match a against ('aaaxxx');
-delete from t1 where match a against ('aaazzz');
-select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
-select count(*) from t1 where match a against ('aaayyy' in boolean mode);
-select count(*) from t1 where match a against ('aaazzz' in boolean mode);
-# double-check without index
-select count(*) from t1 where a = 'aaaxxx';
-select count(*) from t1 where a = 'aaayyy';
-select count(*) from t1 where a = 'aaazzz';
-
-# update
-insert t1 (a) values ('aaaxxx 000000');
-select count(*) from t1 where match a against ('000000');
-update t1 set a='aaazzz' where match a against ('000000');
-select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
-select count(*) from t1 where match a against ('aaazzz' in boolean mode);
-update t1 set a='aaazzz' where a = 'aaaxxx';
-update t1 set a='aaaxxx' where a = 'aaayyy';
-select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
-select count(*) from t1 where match a against ('aaayyy' in boolean mode);
-select count(*) from t1 where match a against ('aaazzz' in boolean mode);
-
-drop table t1;
-
-CREATE TABLE t1 (
- i int(10) unsigned not null auto_increment primary key,
- a varchar(255) not null,
- FULLTEXT KEY (a)
-) ENGINE=MyISAM;
-
-#
-# now same as about but w/o repair table
-# 2-level tree created by mi_write
-#
-
-# two-level entry, second-level tree with depth 2
---disable_query_log
-let $1=260;
-begin;
-while ($1)
-{
- eval insert t1 (a) values ('aaaxxx');
- dec $1;
-}
-let $1=255;
-while ($1)
-{
- eval insert t1 (a) values ('aaazzz');
- dec $1;
-}
-let $1=250;
-while ($1)
-{
- eval insert t1 (a) values ('aaayyy');
- dec $1;
-}
-commit;
---enable_query_log
-
-select count(*) from t1 where match a against ('aaaxxx');
-select count(*) from t1 where match a against ('aaayyy');
-select count(*) from t1 where match a against ('aaazzz');
-select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
-select count(*) from t1 where match a against ('aaayyy' in boolean mode);
-select count(*) from t1 where match a against ('aaazzz' in boolean mode);
-select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz');
-select count(*) from t1 where match a against ('aaaxxx aaayyy aaazzz' in boolean mode);
-
-select count(*) from t1 where match a against ('aaax*' in boolean mode);
-select count(*) from t1 where match a against ('aaay*' in boolean mode);
-select count(*) from t1 where match a against ('aaa*' in boolean mode);
-
-# mi_write:
-
-insert t1 (a) values ('aaaxxx'),('aaayyy');
-insert t1 (a) values ('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz'),('aaazzz');
-select count(*) from t1 where match a against ('aaaxxx');
-select count(*) from t1 where match a against ('aaayyy');
-select count(*) from t1 where match a against ('aaazzz');
-
-# mi_delete
-insert t1 (a) values ('aaaxxx 000000');
-select count(*) from t1 where match a against ('000000');
-delete from t1 where match a against ('000000');
-select count(*) from t1 where match a against ('000000');
-select count(*) from t1 where match a against ('aaaxxx');
-delete from t1 where match a against ('aaazzz');
-select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
-select count(*) from t1 where match a against ('aaayyy' in boolean mode);
-select count(*) from t1 where match a against ('aaazzz' in boolean mode);
-# double-check without index
-select count(*) from t1 where a = 'aaaxxx';
-select count(*) from t1 where a = 'aaayyy';
-select count(*) from t1 where a = 'aaazzz';
-
-# update
-insert t1 (a) values ('aaaxxx 000000');
-select count(*) from t1 where match a against ('000000');
-update t1 set a='aaazzz' where match a against ('000000');
-select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
-select count(*) from t1 where match a against ('aaazzz' in boolean mode);
-update t1 set a='aaazzz' where a = 'aaaxxx';
-update t1 set a='aaaxxx' where a = 'aaayyy';
-select count(*) from t1 where match a against ('aaaxxx' in boolean mode);
-select count(*) from t1 where match a against ('aaayyy' in boolean mode);
-select count(*) from t1 where match a against ('aaazzz' in boolean mode);
-drop table t1;
-
-#
-# BUG#11336
-#
-# for uca collation isalnum and strnncollsp don't agree on whether
-# 0xC2A0 is a space (strnncollsp is right, isalnum is wrong).
-#
-# they still don't, the bug was fixed by avoiding strnncollsp
-#
-
-set names utf8;
-create table t1(a text,fulltext(a)) collate=utf8_swedish_ci;
-insert into t1 values('test test '),('test'),('test'),('test'),
-('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
-('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
-('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
-('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
-('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
-('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
-('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
-('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
-('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
-('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
-('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
-('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
-('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
-('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'),
-('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test');
-delete from t1 limit 1;
-
-#
-# BUG#16489: utf8 + fulltext leads to corrupt index file.
-#
-truncate table t1;
-insert into t1 values('ab c d');
-update t1 set a='ab c d';
-select * from t1 where match a against('ab c' in boolean mode);
-drop table t1;
-set names latin1;
-
-# End of 4.1 tests
-
-#
-# BUG#19580 - FULLTEXT search produces wrong results on UTF-8 columns
-#
-SET NAMES utf8;
-CREATE TABLE t1(a VARCHAR(255), FULLTEXT(a)) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-INSERT INTO t1 VALUES('„MySQL“');
-SELECT a FROM t1 WHERE MATCH a AGAINST('“MySQL„' IN BOOLEAN MODE);
-DROP TABLE t1;
-SET NAMES latin1;
diff --git a/mysql-test/t/fulltext3.test b/mysql-test/t/fulltext3.test
deleted file mode 100644
index 66f940b495e..00000000000
--- a/mysql-test/t/fulltext3.test
+++ /dev/null
@@ -1,49 +0,0 @@
---source include/have_gbk.inc
-#
-# test of new fulltext search features
-#
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-
-#
-# BUG#29299 - repeatable myisam fulltext index corruption
-#
-CREATE TABLE t1(a VARCHAR(255) CHARACTER SET gbk, FULLTEXT(a));
-SET NAMES utf8;
-INSERT INTO t1 VALUES(0xF043616161),(0xBEF361616197C22061616161);
-SELECT HEX(a) FROM t1 WHERE MATCH(a) AGAINST(0x97C22061616161 IN BOOLEAN MODE);
-DELETE FROM t1 LIMIT 1;
-CHECK TABLE t1;
-SET NAMES latin1;
-DROP TABLE t1;
-
-# End of 5.0 tests
-
-#
-# BUG#29464 - load data infile into table with big5 chinese fulltext index
-# hangs 100% cpu
-#
-CREATE TABLE t1(a VARCHAR(2) CHARACTER SET big5 COLLATE big5_chinese_ci,
-FULLTEXT(a));
-INSERT INTO t1 VALUES(0xA3C2);
-DROP TABLE t1;
-
-# End of 5.1 tests
-
-#
-# MDEV-9986 Full-text search of the utf8mb4 column causes crash
-#
-create table t1 (
- id varchar(255),
- business_name text null collate utf8mb4_unicode_ci,
- street_address text,
- fulltext index ft (business_name),
- fulltext index ft2 (street_address)
-);
---error ER_FT_MATCHING_KEY_NOT_FOUND
-select * from t1 where match (business_name, street_address) against ('some business name and address here');
-select * from t1 where match (business_name, street_address) against ('some business name and address here' in boolean mode);
-drop table t1;
diff --git a/mysql-test/t/fulltext_cache.test b/mysql-test/t/fulltext_cache.test
deleted file mode 100644
index ea05f699506..00000000000
--- a/mysql-test/t/fulltext_cache.test
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# Bugreport due to Roy Nasser <roy@vem.ca>
-#
-
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-
-CREATE TABLE t1 (
- id int(10) unsigned NOT NULL auto_increment,
- q varchar(255) default NULL,
- PRIMARY KEY (id)
-);
-INSERT INTO t1 VALUES (1,'aaaaaaaaa dsaass de');
-INSERT INTO t1 VALUES (2,'ssde df s fsda sad er');
-CREATE TABLE t2 (
- id int(10) unsigned NOT NULL auto_increment,
- id2 int(10) unsigned default NULL,
- item varchar(255) default NULL,
- PRIMARY KEY (id),
- FULLTEXT KEY item(item)
-);
-INSERT INTO t2 VALUES (1,1,'sushi');
-INSERT INTO t2 VALUES (2,1,'Bolo de Chocolate');
-INSERT INTO t2 VALUES (3,1,'Feijoada');
-INSERT INTO t2 VALUES (4,1,'Mousse de Chocolate');
-INSERT INTO t2 VALUES (5,2,'um copo de Vodka');
-INSERT INTO t2 VALUES (6,2,'um chocolate Snickers');
-INSERT INTO t2 VALUES (7,1,'Bife');
-INSERT INTO t2 VALUES (8,1,'Pizza de Salmao');
-
-SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),6)
-as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
-
-SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE)
-as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
-
-SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),6)
-as x FROM t2, t1 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
-
-SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE)
-as x FROM t2, t1 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
-
-drop table t1, t2;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/fulltext_charsets.test b/mysql-test/t/fulltext_charsets.test
deleted file mode 100644
index 3ac9791bd1a..00000000000
--- a/mysql-test/t/fulltext_charsets.test
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-# MDEV-11241 Certain combining marks cause MariaDB to crash when doing Full-Text searches
-#
-set names utf8mb4;
-
-create table t1 (a int, b text, fulltext (b)) charset=utf8mb4 collate=utf8mb4_unicode_ci;
-insert t1 values (1000, 'C͓̙̯͔̩ͅͅi̩̘̜̲a̯̲̬̳̜̖̤o͕͓̜͓̺̖̗,̠̬͚ ̺T͇̲h͈̱e ̬̜D̖o̦̖͔̗͖̩̘c̣̼t̝͉̫̮̗o͉̫̭r̙͎̗.͓̪̥');
-select a from t1 where match(b) against ('ciao' in boolean mode);
-drop table t1;
-
diff --git a/mysql-test/t/fulltext_derived_4257.test b/mysql-test/t/fulltext_derived_4257.test
deleted file mode 100644
index 07626b8b557..00000000000
--- a/mysql-test/t/fulltext_derived_4257.test
+++ /dev/null
@@ -1,6 +0,0 @@
-set optimizer_switch = 'derived_merge=on';
-create table t1 (c1 char(8), c2 char(8)) engine=myisam;
-insert into t1 values ('test1','test2'),('test3','test4');
-select * from (select c1 from t1 where match (c2) against ('hello' in boolean mode)) as alias;
-drop table t1;
-
diff --git a/mysql-test/t/fulltext_derived_4316.test b/mysql-test/t/fulltext_derived_4316.test
deleted file mode 100644
index ecf4a0e7722..00000000000
--- a/mysql-test/t/fulltext_derived_4316.test
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# MATCH on the derived tables
-#
-
-#
-# MDEV-4316 MariaDB server crash with signal 11
-#
-
-create table t1 (ft text) engine=myisam;
-insert into t1 values ('test1'),('test2');
-select distinct match(ft) against("test1" in boolean mode) from
- (select distinct ft from t1) as t;
-drop table t1;
-
diff --git a/mysql-test/t/fulltext_distinct.test b/mysql-test/t/fulltext_distinct.test
deleted file mode 100644
index bf773c36844..00000000000
--- a/mysql-test/t/fulltext_distinct.test
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# Test of fulltext index
-# bug reported by Tibor Simko <tibor.simko@cern.ch>
-#
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-CREATE TABLE t1 (
- id mediumint unsigned NOT NULL auto_increment,
- tag char(6) NOT NULL default '',
- value text NOT NULL default '',
- PRIMARY KEY (id),
- KEY kt(tag),
- KEY kv(value(15)),
- FULLTEXT KEY kvf(value)
-) ENGINE=MyISAM;
-CREATE TABLE t2 (
- id_t2 mediumint unsigned NOT NULL default '0',
- id_t1 mediumint unsigned NOT NULL default '0',
- field_number tinyint unsigned NOT NULL default '0',
- PRIMARY KEY (id_t2,id_t1,field_number),
- KEY id_t1(id_t1)
-) ENGINE=MyISAM;
-
-INSERT INTO t1 (tag,value) VALUES ('foo123','bar111');
-INSERT INTO t1 (tag,value) VALUES ('foo123','bar222');
-INSERT INTO t1 (tag,value) VALUES ('bar345','baz333 ar');
-
-INSERT INTO t2 VALUES (2231626,64280,0);
-INSERT INTO t2 VALUES (2231626,64281,0);
-INSERT INTO t2 VALUES (12346, 3, 1);
-
-SELECT * FROM t1; SELECT * FROM t2;
-
-SELECT DISTINCT t2.id_t2 FROM t2, t1
-WHERE MATCH (t1.value) AGAINST ('baz333') AND t1.id = t2.id_t1;
-
-SELECT DISTINCT t2.id_t2 FROM t2, t1
-WHERE MATCH (t1.value) AGAINST ('baz333' IN BOOLEAN MODE)
-AND t1.id = t2.id_t1;
-
-DROP TABLE t1, t2;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/fulltext_left_join.test b/mysql-test/t/fulltext_left_join.test
deleted file mode 100644
index 3a81c1a5d1b..00000000000
--- a/mysql-test/t/fulltext_left_join.test
+++ /dev/null
@@ -1,113 +0,0 @@
-#
-# Test for bug from Jean-Cdric COSTA <jean-cedric.costa@ensmp.fr>
-#
-
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-
-CREATE TABLE t1 (
- id VARCHAR(255) NOT NULL PRIMARY KEY,
- sujet VARCHAR(255),
- motsclefs TEXT,
- texte MEDIUMTEXT,
- FULLTEXT(sujet, motsclefs, texte)
-);
-INSERT INTO t1 VALUES('123','toto','essai','test');
-INSERT INTO t1 VALUES('456','droit','penal','lawyer');
-INSERT INTO t1 VALUES('789','aaaaa','bbbbb','cccccc');
-CREATE TABLE t2 (
- id VARCHAR(255) NOT NULL,
- author VARCHAR(255) NOT NULL
-);
-INSERT INTO t2 VALUES('123', 'moi');
-INSERT INTO t2 VALUES('123', 'lui');
-INSERT INTO t2 VALUES('456', 'lui');
-
-select round(match(t1.texte,t1.sujet,t1.motsclefs) against('droit'),5)
- from t1 left join t2 on t2.id=t1.id;
-select match(t1.texte,t1.sujet,t1.motsclefs) against('droit' IN BOOLEAN MODE)
- from t1 left join t2 on t2.id=t1.id;
-
-drop table t1, t2;
-
-#
-# BUG#484, reported by Stephen Brandon <stephen@brandonitconsulting.co.uk>
-#
-
-create table t1 (venue_id int(11) default null, venue_text varchar(255) default null, dt datetime default null) engine=myisam;
-insert into t1 (venue_id, venue_text, dt) values (1, 'a1', '2003-05-23 19:30:00'),(null, 'a2', '2003-05-23 19:30:00');
-create table t2 (name varchar(255) not null default '', entity_id int(11) not null auto_increment, primary key (entity_id), fulltext key name (name)) engine=myisam;
-insert into t2 (name, entity_id) values ('aberdeen town hall', 1), ('glasgow royal concert hall', 2), ('queen\'s hall, edinburgh', 3);
-select * from t1 left join t2 on venue_id = entity_id where match(name) against('aberdeen' in boolean mode) and dt = '2003-05-23 19:30:00';
-select * from t1 left join t2 on venue_id = entity_id where match(name) against('aberdeen') and dt = '2003-05-23 19:30:00';
-select * from t1 left join t2 on (venue_id = entity_id and match(name) against('aberdeen' in boolean mode)) where dt = '2003-05-23 19:30:00';
-select * from t1 left join t2 on (venue_id = entity_id and match(name) against('aberdeen')) where dt = '2003-05-23 19:30:00';
-drop table t1,t2;
-
-#
-# BUG#14708
-# Inconsistent treatment of NULLs in LEFT JOINed FULLTEXT matching without index
-#
-
-create table t1 (id int not null primary key, d char(200) not null, e char(200));
-insert into t1 values (1, 'aword', null), (2, 'aword', 'bword'), (3, 'bword', null), (4, 'bword', 'aword'), (5, 'aword and bword', null);
-select * from t1 where match(d, e) against ('+aword +bword' in boolean mode);
-create table t2 (m_id int not null, f char(200), key (m_id));
-insert into t2 values (1, 'bword'), (3, 'aword'), (5, '');
-select * from t1 left join t2 on m_id = id where match(d, e, f) against ('+aword +bword' in boolean mode);
-drop table t1,t2;
-
-#
-# BUG#25637: LEFT JOIN with BOOLEAN FULLTEXT loses left table matches
-# (this is actually the same bug as bug #14708)
-#
-
-CREATE TABLE t1 (
- id int(10) NOT NULL auto_increment,
- link int(10) default NULL,
- name mediumtext default NULL,
- PRIMARY KEY (id),
- FULLTEXT (name)
-);
-INSERT INTO t1 VALUES (1, 1, 'string');
-INSERT INTO t1 VALUES (2, 0, 'string');
-CREATE TABLE t2 (
- id int(10) NOT NULL auto_increment,
- name mediumtext default NULL,
- PRIMARY KEY (id),
- FULLTEXT (name)
-);
-INSERT INTO t2 VALUES (1, 'string');
-
-SELECT t1.*, MATCH(t1.name) AGAINST('string') AS relevance
- FROM t1 LEFT JOIN t2 ON t1.link = t2.id
- WHERE MATCH(t1.name, t2.name) AGAINST('string' IN BOOLEAN MODE);
-
-DROP TABLE t1,t2;
-
-# End of 4.1 tests
-
-#
-# BUG#25729 - boolean full text search is confused by NULLs produced by LEFT
-# JOIN
-#
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (b INT, c TEXT, KEY(b));
-INSERT INTO t1 VALUES(1);
-INSERT INTO t2(b,c) VALUES(2,'castle'),(3,'castle');
-SELECT * FROM t1 LEFT JOIN t2 ON a=b WHERE MATCH(c) AGAINST('+castle' IN BOOLEAN MODE);
-DROP TABLE t1, t2;
-
---echo #
---echo # BUG#906357: Incorrect result with outer join and full text match
---echo #
-CREATE TABLE t1(f1 VARCHAR(6) NOT NULL, FULLTEXT KEY(f1), UNIQUE(f1));
-INSERT INTO t1 VALUES ('test');
-
-CREATE TABLE t2(f2 VARCHAR(6) NOT NULL, FULLTEXT KEY(f2), UNIQUE(f2));
-INSERT INTO t2 VALUES ('test');
-SELECT * FROM t2 LEFT OUTER JOIN t1 ON (MATCH(f1) against (""));
-SELECT * FROM t1 RIGHT OUTER JOIN t2 ON (MATCH(f1) against (""));
-
-DROP table t1,t2;
diff --git a/mysql-test/t/fulltext_multi.test b/mysql-test/t/fulltext_multi.test
deleted file mode 100644
index fe64fe88599..00000000000
--- a/mysql-test/t/fulltext_multi.test
+++ /dev/null
@@ -1,25 +0,0 @@
-# several FULLTEXT indexes in one table test
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (
- a int(11) NOT NULL auto_increment,
- b text,
- c varchar(254) default NULL,
- PRIMARY KEY (a),
- FULLTEXT KEY bb(b),
- FULLTEXT KEY cc(c),
- FULLTEXT KEY a(b,c)
-);
-
-INSERT INTO t1 VALUES (1,'lala lolo lili','oooo aaaa pppp');
-INSERT INTO t1 VALUES (2,'asdf fdsa','lkjh fghj');
-INSERT INTO t1 VALUES (3,'qpwoei','zmxnvb');
-
-SELECT a, round(MATCH b AGAINST ('lala lkjh'),5) FROM t1;
-SELECT a, round(MATCH c AGAINST ('lala lkjh'),5) FROM t1;
-SELECT a, round(MATCH b,c AGAINST ('lala lkjh'),5) FROM t1;
-drop table t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/fulltext_order_by.test b/mysql-test/t/fulltext_order_by.test
deleted file mode 100644
index 9fddf3b2fec..00000000000
--- a/mysql-test/t/fulltext_order_by.test
+++ /dev/null
@@ -1,154 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1,t2,t3;
---enable_warnings
-
-CREATE TABLE t1 (
- a INT AUTO_INCREMENT PRIMARY KEY,
- message CHAR(20),
- FULLTEXT(message)
-) comment = 'original testcase by sroussey@network54.com';
-INSERT INTO t1 (message) VALUES ("Testing"),("table"),("testbug"),
- ("steve"),("is"),("cool"),("steve is cool");
-# basic MATCH
-SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve');
-SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve');
-SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
-SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
-
-# MATCH + ORDER BY (with ft-ranges)
-SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY a;
-SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a;
-
-# MATCH + ORDER BY (with normal ranges) + UNIQUE
-SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve') ORDER BY a DESC;
-SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a DESC;
-
-# MATCH + ORDER BY + UNIQUE (const_table)
-SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve') ORDER BY 1;
-SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY 1;
-
-# ORDER BY MATCH
-SELECT IF(a=7,'steve-is-cool',IF(a=4,'cool', 'other')), FORMAT(MATCH (message) AGAINST ('steve'),6) as rel FROM t1 ORDER BY rel;
-SELECT IF(a=7,'match',IF(a=4,'match', 'no-match')), MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) as rel FROM t1 ORDER BY rel;
-
-#
-# BUG#6635 - test_if_skip_sort_order() thought it can skip filesort
-# for fulltext searches too
-#
-alter table t1 add key m (message);
-explain SELECT message FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY message;
-SELECT message FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY message desc;
-
-drop table t1;
-
-#
-# reused boolean scan bug
-#
-CREATE TABLE t1 (
- a INT AUTO_INCREMENT PRIMARY KEY,
- message CHAR(20),
- FULLTEXT(message)
-);
-INSERT INTO t1 (message) VALUES ("testbug"),("testbug foobar");
-SELECT a, MATCH (message) AGAINST ('t* f*' IN BOOLEAN MODE) as rel FROM t1;
-SELECT a, MATCH (message) AGAINST ('t* f*' IN BOOLEAN MODE) as rel FROM t1 ORDER BY rel,a;
-drop table t1;
-
-# BUG#11869
-CREATE TABLE t1 (
- id int(11) NOT NULL auto_increment,
- thread int(11) NOT NULL default '0',
- beitrag longtext NOT NULL,
- PRIMARY KEY (id),
- KEY thread (thread),
- FULLTEXT KEY beitrag (beitrag)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=7923 ;
-
-CREATE TABLE t2 (
- id int(11) NOT NULL auto_increment,
- text varchar(100) NOT NULL default '',
- PRIMARY KEY (id),
- KEY text (text)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=63 ;
-
-CREATE TABLE t3 (
- id int(11) NOT NULL auto_increment,
- forum int(11) NOT NULL default '0',
- betreff varchar(70) NOT NULL default '',
- PRIMARY KEY (id),
- KEY forum (forum),
- FULLTEXT KEY betreff (betreff)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=996 ;
-
---error ER_TABLENAME_NOT_ALLOWED_HERE
-select a.text, b.id, b.betreff
-from
- t2 a inner join t3 b on a.id = b.forum inner join
- t1 c on b.id = c.thread
-where
- match(b.betreff) against ('+abc' in boolean mode)
-group by a.text, b.id, b.betreff
-union
-select a.text, b.id, b.betreff
-from
- t2 a inner join t3 b on a.id = b.forum inner join
- t1 c on b.id = c.thread
-where
- match(c.beitrag) against ('+abc' in boolean mode)
-group by
- a.text, b.id, b.betreff
-order by
- match(b.betreff) against ('+abc' in boolean mode) desc;
-
---error ER_TABLENAME_NOT_ALLOWED_HERE
-select a.text, b.id, b.betreff
-from
- t2 a inner join t3 b on a.id = b.forum inner join
- t1 c on b.id = c.thread
-where
- match(b.betreff) against ('+abc' in boolean mode)
-union
-select a.text, b.id, b.betreff
-from
- t2 a inner join t3 b on a.id = b.forum inner join
- t1 c on b.id = c.thread
-where
- match(c.beitrag) against ('+abc' in boolean mode)
-order by
- match(b.betreff) against ('+abc' in boolean mode) desc;
-
-select a.text, b.id, b.betreff
-from
- t2 a inner join t3 b on a.id = b.forum inner join
- t1 c on b.id = c.thread
-where
- match(b.betreff) against ('+abc' in boolean mode)
-union
-select a.text, b.id, b.betreff
-from
- t2 a inner join t3 b on a.id = b.forum inner join
- t1 c on b.id = c.thread
-where
- match(c.beitrag) against ('+abc' in boolean mode)
-order by
- match(betreff) against ('+abc' in boolean mode) desc;
-
-# BUG#11869 part2: used table type doesn't support FULLTEXT indexes error
-(select b.id, b.betreff from t3 b) union
-(select b.id, b.betreff from t3 b)
-order by match(betreff) against ('+abc' in boolean mode) desc;
-
---error 1191
-(select b.id, b.betreff from t3 b) union
-(select b.id, b.betreff from t3 b)
-order by match(betreff) against ('+abc') desc;
-
-select distinct b.id, b.betreff from t3 b
-order by match(betreff) against ('+abc' in boolean mode) desc;
-
-select b.id, b.betreff from t3 b group by b.id+1
-order by match(betreff) against ('+abc' in boolean mode) desc;
-
-drop table t1,t2,t3;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/fulltext_update.test b/mysql-test/t/fulltext_update.test
deleted file mode 100644
index 14eb0de58a5..00000000000
--- a/mysql-test/t/fulltext_update.test
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# Test for bug by voi@ims.at
-#
-
---disable_warnings
-drop table if exists test;
---enable_warnings
-CREATE TABLE test (
- gnr INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
- url VARCHAR(80) DEFAULT '' NOT NULL,
- shortdesc VARCHAR(200) DEFAULT '' NOT NULL,
- longdesc text DEFAULT '' NOT NULL,
- description VARCHAR(80) DEFAULT '' NOT NULL,
- name VARCHAR(80) DEFAULT '' NOT NULL,
- FULLTEXT(url,description,shortdesc,longdesc),
- PRIMARY KEY(gnr)
-);
-
-insert into test (url,shortdesc,longdesc,description,name) VALUES
-("http:/test.at", "kurz", "lang","desc", "name");
-insert into test (url,shortdesc,longdesc,description,name) VALUES
-("http:/test.at", "kurz", "","desc", "name");
-update test set url='test', description='ddd', name='nam' where gnr=2;
-update test set url='test', shortdesc='ggg', longdesc='mmm',
-description='ddd', name='nam' where gnr=2;
-check table test;
-drop table test;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/fulltext_var.test b/mysql-test/t/fulltext_var.test
deleted file mode 100644
index a048dab7f40..00000000000
--- a/mysql-test/t/fulltext_var.test
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# Fulltext configurable parameters
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-# Save ft_boolean_syntax variable
-let $saved_ft_boolean_syntax=`select @@global.ft_boolean_syntax`;
-
-show variables like "ft\_%";
-
-create table t1 (b text not null);
-insert t1 values ('aaaaaa bbbbbb cccccc');
-insert t1 values ('bbbbbb cccccc');
-insert t1 values ('aaaaaa cccccc');
-select * from t1 where match b against ('+aaaaaa bbbbbb' in boolean mode);
--- error 1229
-set ft_boolean_syntax=' +-><()~*:""&|';
-set global ft_boolean_syntax=' +-><()~*:""&|';
-select * from t1 where match b against ('+aaaaaa bbbbbb' in boolean mode);
-set global ft_boolean_syntax='@ -><()~*:""&|';
-select * from t1 where match b against ('+aaaaaa bbbbbb' in boolean mode);
-select * from t1 where match b against ('+aaaaaa @bbbbbb' in boolean mode);
--- error 1231
-set global ft_boolean_syntax='@ -><()~*:""@|';
--- error 1231
-set global ft_boolean_syntax='+ -><()~*:""@!|';
-drop table t1;
-
-# Restore ft_boolean_syntax variable
---disable_query_log
-eval set global ft_boolean_syntax='$saved_ft_boolean_syntax';
---enable_query_log
-
-# End of 4.1 tests
diff --git a/mysql-test/t/func_analyse.test b/mysql-test/t/func_analyse.test
deleted file mode 100644
index d99f5c0fa9a..00000000000
--- a/mysql-test/t/func_analyse.test
+++ /dev/null
@@ -1,183 +0,0 @@
-#
-# Test of procedure analyse
-#
--- source include/have_innodb.inc
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-create table t1 (i int, j int, empty_string char(10), bool char(1), d date);
-insert into t1 values (1,2,"","Y","2002-03-03"), (3,4,"","N","2002-03-04"), (5,6,"","Y","2002-03-04"), (7,8,"","N","2002-03-05");
-select count(*) from t1 procedure analyse();
-select * from t1 procedure analyse();
-select * from t1 procedure analyse(2);
---error ER_PARSE_ERROR
-create table t2 select * from t1 procedure analyse();
-drop table t1;
-
---error ER_WRONG_USAGE
-EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE();
-
-#
-# Bug#2813 - analyse does not quote string values in enums from string
-#
-
-create table t1 (v varchar(128));
-insert into t1 values ('abc'),('abc\'def\\hij\"klm\0opq'),('\''),('\"'),('\\'),('a\0'),('b\''),('c\"'),('d\\'),('\'b'),('\"c'),('\\d'),('a\0\0\0b'),('a\'\'\'\'b'),('a\"\"\"\"b'),('a\\\\\\\\b'),('\'\0\\\"'),('\'\''),('\"\"'),('\\\\'),('The\ZEnd');
-select * from t1 procedure analyse();
-drop table t1;
-
-#decimal-related test
-
-create table t1 (df decimal(5,1));
-insert into t1 values(1.1);
-insert into t1 values(2.2);
-select * from t1 procedure analyse();
-drop table t1;
-
-#
-# Bug#10716 - Procedure Analyse results in wrong values for optimal field type
-#
-
-create table t1 (d double);
-insert into t1 values (100000);
-select * from t1 procedure analyse (1,1);
-drop table t1;
-
-#
-# Bug #14138 ROLLUP and PROCEDURE ANALYSE() hang server
-#
-create table t1 (product varchar(32), country_id int not null, year int,
- profit int);
-insert into t1 values ( 'Computer', 2,2000, 1200),
- ( 'TV', 1, 1999, 150),
- ( 'Calculator', 1, 1999,50),
- ( 'Computer', 1, 1999,1500),
- ( 'Computer', 1, 2000,1500),
- ( 'TV', 1, 2000, 150),
- ( 'TV', 2, 2000, 100),
- ( 'TV', 2, 2000, 100),
- ( 'Calculator', 1, 2000,75),
- ( 'Calculator', 2, 2000,75),
- ( 'TV', 1, 1999, 100),
- ( 'Computer', 1, 1999,1200),
- ( 'Computer', 2, 2000,1500),
- ( 'Calculator', 2, 2000,75),
- ( 'Phone', 3, 2003,10)
- ;
-create table t2 (country_id int primary key, country char(20) not null);
-insert into t2 values (1, 'USA'),(2,'India'), (3,'Finland');
-select product, sum(profit),avg(profit) from t1 group by product with rollup procedure analyse();
-drop table t1,t2;
-
-#
-# Bug #20305 PROCEDURE ANALYSE() returns wrong M for FLOAT(M, D) and DOUBLE(M, D)
-#
-
-create table t1 (f1 double(10,5), f2 char(10), f3 double(10,5));
-insert into t1 values (5.999, "5.9999", 5.99999), (9.555, "9.5555", 9.55555);
-select f1 from t1 procedure analyse(1, 1);
-select f2 from t1 procedure analyse(1, 1);
-select f3 from t1 procedure analyse(1, 1);
-drop table t1;
-
-#
-# Bug#46184 Crash, SELECT ... FROM derived table procedure analyze
-#
-CREATE TABLE t1(a INT,b INT,c INT,d INT,e INT,f INT,g INT,h INT,i INT,j INT,k INT);
-INSERT INTO t1 VALUES ();
---error ER_WRONG_USAGE
-SELECT * FROM (SELECT * FROM t1) d PROCEDURE ANALYSE();
-DROP TABLE t1;
-
---echo End of 4.1 tests
-
---echo #
---echo # Bug #48293: crash with procedure analyse, view with > 10 columns,
---echo # having clause...
---echo #
-
-CREATE TABLE t1(a INT, b INT, c INT, d INT, e INT,
- f INT, g INT, h INT, i INT, j INT,k INT);
-INSERT INTO t1 VALUES (),();
-
-CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
---echo #should have a derived table
-EXPLAIN SELECT * FROM v1;
---echo #should not crash
---error ER_WRONG_USAGE
-SELECT * FROM v1 PROCEDURE analyse();
---echo #should not crash
---error ER_WRONG_USAGE
-SELECT * FROM t1 a, v1, t1 b PROCEDURE analyse();
---echo #should not crash
---error ER_WRONG_USAGE
-SELECT * FROM (SELECT * FROM t1 having a > 1) x PROCEDURE analyse();
---echo #should not crash
---error ER_WRONG_USAGE
-SELECT * FROM t1 a, (SELECT * FROM t1 having a > 1) x, t1 b PROCEDURE analyse();
---echo #should not crash
---error ER_ORDER_WITH_PROC
-SELECT 1 FROM t1 group by a having a > 1 order by 1 PROCEDURE analyse();
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-CREATE TABLE t1(a INT);
-INSERT INTO t1 VALUES (1),(2);
-
---echo # should not crash
---error ER_PARSE_ERROR
-CREATE TABLE t2 SELECT 1 FROM t1, t1 t3 GROUP BY t3.a PROCEDURE ANALYSE();
-
-DROP TABLE t1;
-
-
---echo End of 5.0 tests
-
---echo #
---echo # Bug#11765202: Dbug_violation_helper::~Dbug_violation_helper(): Assertion `!_entered' failed.
---echo #
-
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (a VARCHAR(2) CHARSET UTF8 NOT NULL);
-INSERT INTO t1 VALUES ('e'),('e'),('e-');
-SELECT * FROM t1 PROCEDURE ANALYSE();
-DROP TABLE t1;
-
---echo #
---echo # Bug#11756242 48137: PROCEDURE ANALYSE() LEAKS MEMORY WHEN RETURNING NULL
---echo #
-
-CREATE TABLE t1(f1 INT) ENGINE=MYISAM;
-CREATE TABLE t2(f2 INT) ENGINE=INNODB;
-INSERT INTO t2 VALUES (1);
-SELECT DISTINCTROW f1 FROM t1 NATURAL RIGHT OUTER JOIN t2 PROCEDURE ANALYSE();
-SELECT * FROM t2 LIMIT 1 PROCEDURE ANALYSE();
-DROP TABLE t1, t2;
-
---echo End of 5.1 tests
-
---echo #
---echo # Start of 10.2 tests
---echo #
-(SELECT 1 FROM DUAL PROCEDURE ANALYSE());
-((SELECT 1 FROM DUAL PROCEDURE ANALYSE()));
-
-# TODO:
---error ER_PARSE_ERROR
-SELECT * FROM t1 UNION SELECT * FROM t1 PROCEDURE analyse();
-
---echo #
---echo # MDEV-10030 sql_yacc.yy: Split table_expression and remove PROCEDURE from create_select, select_paren_derived, select_derived2, query_specification
---echo #
-
---error ER_PARSE_ERROR
-SELECT * FROM (SELECT * FROM t1 PROCEDURE ANALYSE());
---ERROR ER_PARSE_ERROR
-SELECT * FROM t1 NATURAL JOIN (SELECT * FROM t2 PROCEDURE ANALYSE());
-
---error ER_PARSE_ERROR
-SELECT (SELECT 1 FROM t1 PROCEDURE ANALYSE()) FROM t2;
---error ER_PARSE_ERROR
-SELECT ((SELECT 1 FROM t1 PROCEDURE ANALYSE())) FROM t2;
diff --git a/mysql-test/t/func_compress.test b/mysql-test/t/func_compress.test
deleted file mode 100644
index 3fd9cad467b..00000000000
--- a/mysql-test/t/func_compress.test
+++ /dev/null
@@ -1,190 +0,0 @@
--- source include/have_compress.inc
-#
-# Test for compress and uncompress functions:
-#
-# Note that this test gives error in the gzip library when running under
-# valgrind, but these warnings can be ignored
-
-set global max_allowed_packet=1048576;
-connect (conn1,localhost,root,,);
-connection conn1;
-
-select @test_compress_string:='string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ';
-select length(@test_compress_string);
-
-select uncompress(compress(@test_compress_string));
-explain extended select uncompress(compress(@test_compress_string));
-select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
-explain extended select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
-select uncompressed_length(compress(@test_compress_string));
-select length(compress(@test_compress_string))<length(@test_compress_string);
-
-create table t1 (a text, b char(255), c char(4)) engine=myisam;
-insert into t1 (a,b,c) values (compress(@test_compress_string),compress(@test_compress_string),'d ');
-select uncompress(a) from t1;
-select uncompress(b) from t1;
-select concat('|',c,'|') from t1;
-drop table t1;
-
-select compress("");
-select uncompress("");
-select uncompress(compress(""));
-select uncompressed_length("");
-
-#
-# errors
-#
-
-create table t1 (a text);
-insert t1 values (compress(null)), ('A\0\0\0BBBBBBBB'), (compress(space(50000))), (space(50000));
-select length(a) from t1;
-select length(uncompress(a)) from t1;
-drop table t1;
-
-
-#
-# Bug #5497: a problem with large strings
-# note that when LOW_MEMORY is set the "test" below is meaningless
-#
-
-set @@global.max_allowed_packet=1048576*100;
---replace_result "''" XXX "'1'" XXX
-
-# reconnect to make the new max packet size take effect
---connect (newconn, localhost, root,,)
-eval select compress(repeat('aaaaaaaaaa', IF('$LOW_MEMORY', 10, 10000000))) is null;
-disconnect newconn;
---source include/wait_until_disconnected.inc
-connection default;
-set @@global.max_allowed_packet=default;
-
-#
-# Bug #18643: problem with null values
-#
-
-create table t1(a blob);
-insert into t1 values(NULL), (compress('a'));
-select uncompress(a), uncompressed_length(a) from t1;
-drop table t1;
-
-#
-# Bug #23254: problem with compress(NULL)
-#
-
-create table t1(a blob);
-insert into t1 values ('0'), (NULL), ('0');
---disable_result_log
-select compress(a), compress(a) from t1;
---enable_result_log
-select compress(a) is null from t1;
-drop table t1;
-
---echo End of 4.1 tests
-
-#
-# Bug #18539: uncompress(d) is null: impossible?
-#
-create table t1 (a varchar(32) not null);
-insert into t1 values ('foo');
-explain select * from t1 where uncompress(a) is null;
-select * from t1 where uncompress(a) is null;
-explain select *, uncompress(a) from t1;
-select *, uncompress(a) from t1;
-select *, uncompress(a), uncompress(a) is null from t1;
-drop table t1;
-
-#
-# Bug #44796: valgrind: too many my_longlong10_to_str_8bit warnings after
-# uncompressed_length
-#
-
-CREATE TABLE t1 (c1 INT);
-INSERT INTO t1 VALUES (1), (1111), (11111);
-
-# Disable warnings to avoid dependency on max_allowed_packet value
---disable_warnings
-SELECT UNCOMPRESS(c1), UNCOMPRESSED_LENGTH(c1) FROM t1;
---enable_warnings
-
-# We do not need the results, just make sure there are no valgrind errors
---disable_result_log
-EXPLAIN EXTENDED SELECT * FROM (SELECT UNCOMPRESSED_LENGTH(c1) FROM t1) AS s;
---enable_result_log
-
-DROP TABLE t1;
-
---echo End of 5.0 tests
---disable_result_log
---disable_query_log
-set @@global.max_allowed_packet=default;
---enable_result_log
---enable_query_log
-
-
---echo #
---echo # Start of 5.3 tests
---echo #
-
---echo #
---echo # MDEV-5783 Assertion `0' failed in make_sortkey(SORTPARAM*, uchar*, uchar*) on ORDER BY HEX(UNCOMPRESSED_LENGTH(pk))
---echo #
-CREATE TABLE t1 (pk INT PRIMARY KEY);
-INSERT INTO t1 VALUES (1),(2);
-SELECT UNCOMPRESSED_LENGTH(pk) FROM t1;
-# ORDER is not strict, so disable results
---disable_result_log
-SELECT * FROM t1 ORDER BY HEX(UNCOMPRESSED_LENGTH(pk));
---enable_result_log
-DROP TABLE t1;
-
---echo #
---echo # End of 5.3 tests
---echo #
-
-#
-# MDEV-4513 Valgrind warnings (Conditional jump or move depends on uninitialised value) in inflate on UNCOMPRESS
-#
-SELECT UNCOMPRESS(CAST(0 AS BINARY(5)));
-
-disconnect conn1;
-connection default;
-set global max_allowed_packet=default;
---echo #
---echo # End of 5.5 tests
---echo #
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-10864 Wrong result for WHERE .. (f2=COMPRESS('test') OR f2=COMPRESS('TEST'))
---echo #
-
-CREATE TABLE t1 (f1 VARCHAR(4), f2 VARCHAR(64), UNIQUE KEY k1 (f1,f2));
-INSERT INTO t1 VALUES ('test',compress('test')), ('TEST', compress('TEST'));
-SELECT f1,HEX(f2) FROM t1 ignore index(k1) WHERE f1='test' AND (f2= compress("test") OR f2= compress("TEST"));
-SELECT f1,HEX(f2) FROM t1 WHERE f1='test' AND (f2= compress("test") OR f2= compress("TEST"));
-SELECT f1,HEX(f2) FROM t1 WHERE f1='test' AND (f2= compress("TEST") OR f2= compress("test"));
-DROP TABLE t1;
-
---echo #
---echo # End of 10.1 tests
---echo #
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-10134 Add full support for DEFAULT
---echo #
-CREATE TABLE t1 (a TEXT, b BLOB DEFAULT COMPRESS(a), bl INT DEFAULT UNCOMPRESSED_LENGTH(b), a1 TEXT DEFAULT UNCOMPRESS(b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (REPEAT('a',100));
-SELECT bl, a1 FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/func_concat.test b/mysql-test/t/func_concat.test
deleted file mode 100644
index 69dd2c4063e..00000000000
--- a/mysql-test/t/func_concat.test
+++ /dev/null
@@ -1,244 +0,0 @@
-#
-# Test of problem with CONCAT_WS() and long separators.
-#
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP PROCEDURE IF EXISTS p1;
---enable_warnings
-
-CREATE TABLE t1 ( number INT NOT NULL, alpha CHAR(6) NOT NULL );
-INSERT INTO t1 VALUES (1413006,'idlfmv'),
-(1413065,'smpsfz'),(1413127,'sljrhx'),(1413304,'qerfnd');
-
-SELECT number, alpha, CONCAT_WS('<---->',number,alpha) AS new
-FROM t1 GROUP BY number;
-
-SELECT CONCAT_WS('<---->',number,alpha) AS new
-FROM t1 GROUP BY new LIMIT 1;
-
-SELECT number, alpha, CONCAT_WS('<->',number,alpha) AS new
-FROM t1 GROUP BY new LIMIT 1;
-
-SELECT number, alpha, CONCAT_WS('-',number,alpha,alpha,alpha,alpha,alpha,alpha,alpha) AS new
-FROM t1 GROUP BY new LIMIT 1;
-
-SELECT number, alpha, CONCAT_WS('<------------------>',number,alpha) AS new
-FROM t1 GROUP BY new LIMIT 1;
-drop table t1;
-
-#
-# Bug #5540: a problem with double type
-#
-
-create table t1 (a char(4), b double, c date, d tinyint(4));
-insert into t1 values ('AAAA', 105, '2003-03-01', 1);
-select * from t1 where concat(A,C,B,D) = 'AAAA2003-03-011051';
-drop table t1;
-
-# BUG#6825
-select 'a' union select concat('a', -4);
-select 'a' union select concat('a', -4.5);
-
-select 'a' union select concat('a', -(4 + 1));
-select 'a' union select concat('a', 4 - 5);
-
-select 'a' union select concat('a', -'3');
-select 'a' union select concat('a', -concat('3',4));
-
-select 'a' union select concat('a', -0);
---replace_result a-0.0 a0.0
-select 'a' union select concat('a', -0.0);
-
---replace_result a-0.0000 a0.0000
-select 'a' union select concat('a', -0.0000);
-
-#
-# Bug#16716: subselect in concat() may lead to a wrong result
-#
-select concat((select x from (select 'a' as x) as t1 ),
- (select y from (select 'b' as y) as t2 )) from (select 1 union select 2 )
- as t3;
-
-# End of 4.1 tests
-
-#
-# Bug#15962: CONCAT() in UNION may lead to a data trucation.
-#
-create table t1(f1 varchar(6)) charset=utf8;
-insert into t1 values ("123456");
-select concat(f1, 2) a from t1 union select 'x' a from t1;
-drop table t1;
-
-#
-# Bug #36488: regexp returns false matches, concatenating with previous rows
-#
-CREATE TABLE t1 (c1 varchar(100), c2 varchar(100));
-INSERT INTO t1 VALUES ('',''), ('','First'), ('Random','Random');
-SELECT * FROM t1 WHERE CONCAT(c1,' ',c2) REGEXP 'First.*';
-DROP TABLE t1;
-
---echo # End of 5.0 tests
-
-
---echo #
---echo # Bug #44743: Join in combination with concat does not always work
---echo #
-CREATE TABLE t1 (
- a VARCHAR(100) NOT NULL DEFAULT '0',
- b VARCHAR(2) NOT NULL DEFAULT '',
- c VARCHAR(2) NOT NULL DEFAULT '',
- d TEXT NOT NULL,
- PRIMARY KEY (a, b, c),
- KEY (a)
-) DEFAULT CHARSET=utf8;
-
-INSERT INTO t1 VALUES ('gui_A', 'a', 'b', 'str1'),
- ('gui_AB', 'a', 'b', 'str2'), ('gui_ABC', 'a', 'b', 'str3');
-
-CREATE TABLE t2 (
- a VARCHAR(100) NOT NULL DEFAULT '',
- PRIMARY KEY (a)
-) DEFAULT CHARSET=latin1;
-
-INSERT INTO t2 VALUES ('A'), ('AB'), ('ABC');
-
-SELECT CONCAT('gui_', t2.a), t1.d FROM t2
- LEFT JOIN t1 ON t1.a = CONCAT('gui_', t2.a) AND t1.b = 'a' AND t1.c = 'b';
-
-EXPLAIN SELECT CONCAT('gui_', t2.a), t1.d FROM t2
- LEFT JOIN t1 ON t1.a = CONCAT('gui_', t2.a) AND t1.b = 'a' AND t1.c = 'b';
-
-DROP TABLE t1, t2;
-
-
---echo #
---echo # Bug #50096: CONCAT_WS inside procedure returning wrong data
---echo #
-
-CREATE PROCEDURE p1(a varchar(255), b int, c int)
- SET @query = CONCAT_WS(",", a, b, c);
-
-CALL p1("abcde", "0", "1234");
-SELECT @query;
-
-DROP PROCEDURE p1;
-
---echo #
---echo # Bug #40625: Concat fails on DOUBLE values in a Stored Procedure,
---echo # while DECIMAL works
---echo #
-
-DELIMITER //;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE v1 DOUBLE(10,3);
- SET v1= 100;
- SET @s = CONCAT('########################################', 40 , v1);
- SELECT @s;
-END;//
-DELIMITER ;//
-
-CALL p1();
-CALL p1();
-
-DROP PROCEDURE p1;
-
---echo # End of 5.1 tests
-
-
---echo #
---echo # Start of 10.0 tests
---echo #
-
---echo #
---echo # MDEV-10306 Wrong results with combination of CONCAT, SUBSTR and CONVERT in subquery
---echo #
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='derived_merge=on';
-
-CREATE TABLE t1 (t VARCHAR(10) CHARSET latin1);
-INSERT INTO t1 VALUES('1234567');
-SELECT CONCAT(SUBSTR(t2, 1, 3), SUBSTR(t2, 5)) c1,
- CONCAT(SUBSTR(t2,1,3),'---',SUBSTR(t2,5)) c2
- FROM (SELECT CONVERT(t USING latin1) t2 FROM t1) sub;
-SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT CONVERT(t USING latin1) t2 FROM t1) sub;
-DROP TABLE t1;
-
-# Other functions affected by MDEV-10306
-
-CREATE TABLE t1 (t VARCHAR(10) CHARSET latin1);
-INSERT INTO t1 VALUES('1234567');
-SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT CONVERT(t USING latin1) t2 FROM t1) sub;
-SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT REVERSE(t) t2 FROM t1) sub;
-SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT SOUNDEX(t) t2 FROM t1) sub;
-SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT TO_BASE64(t) t2 FROM t1) sub;
-SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT WEIGHT_STRING(t) t2 FROM t1) sub;
-SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT HEX(t) t2 FROM t1) sub;
-SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT QUOTE(t) t2 FROM t1) sub;
-DROP TABLE t1;
-
-CREATE TABLE t1 (t VARCHAR(32) CHARSET latin1);
-INSERT INTO t1 VALUES(TO_BASE64('abcdefghi'));
-SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT FROM_BASE64(t) t2 FROM t1) sub;
-DROP TABLE t1;
-
-CREATE TABLE t1 (t VARCHAR(32) CHARSET latin1);
-INSERT INTO t1 VALUES(HEX('abcdefghi'));
-SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT UNHEX(t) t2 FROM t1) sub;
-DROP TABLE t1;
-
-CREATE TABLE t1 (t VARCHAR(30) CHARSET latin1);
-INSERT INTO t1 VALUES('test');
-SELECT LENGTH(CONCAT(t2)) c2 FROM (SELECT AES_ENCRYPT(t,'x') t2 FROM t1) sub;
-SELECT LENGTH(CONCAT(t2,'-',t2)) c2 FROM (SELECT AES_ENCRYPT(t,'x') t2 FROM t1) sub;
-SELECT LENGTH(CONCAT(t2,'--',t2)) c2 FROM (SELECT AES_ENCRYPT(t,'x') t2 FROM t1) sub;
-SELECT LENGTH(CONCAT(t2)) c2 FROM (SELECT AES_DECRYPT(AES_ENCRYPT(t,'x'),'x') t2 FROM t1) sub;
-SELECT LENGTH(CONCAT(t2,'-',t2)) c2 FROM (SELECT AES_DECRYPT(AES_ENCRYPT(t,'x'),'x') t2 FROM t1) sub;
-SELECT LENGTH(CONCAT(t2,'--',t2)) c2 FROM (SELECT AES_DECRYPT(AES_ENCRYPT(t,'x'),'x') t2 FROM t1) sub;
-DROP TABLE t1;
-
-
-# Functions not affected by MDEV-10306
-# They only had an unused tmp_value, which was removed.
-
-CREATE TABLE t1 (t VARCHAR(64) CHARSET latin1);
-INSERT INTO t1 VALUES('123456789');
-SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT MD5(t) t2 FROM t1) sub;
-SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT FORMAT(t,2) t2 FROM t1) sub;
-DROP TABLE t1;
-
-# Functions not affected by MDEV-10306
-# They already use tmp_value only for internal purposes and
-# return the result in the String passed to val_str()
-
-CREATE TABLE t1 (t VARCHAR(32) CHARSET latin1);
-INSERT INTO t1 VALUES('abcdefghi');
-SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT INSERT(t,3,4,'xxx') t2 FROM t1) sub;
-DROP TABLE t1;
-
-
-# Functions not affected by MDEV-10306
-# They use this code style:
-# String *res= args[0]->val_str(str);
-# tmp_value.set(*res, start, end);
-# return &tmp_value;
-
-CREATE TABLE t1 (t VARCHAR(10) CHARSET latin1);
-INSERT INTO t1 VALUES('abcdefghi');
-SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LEFT(t,10) t2 FROM t1) sub;
-SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT RIGHT(t,10) t2 FROM t1) sub;
-SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT SUBSTR(t,1,10) t2 FROM t1) sub;
-SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LTRIM(t) t2 FROM t1) sub;
-SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT RTRIM(t) t2 FROM t1) sub;
-SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT TRIM(t) t2 FROM t1) sub;
-DROP TABLE t1;
-
-SET optimizer_switch=@save_optimizer_switch;
-
---echo #
---echo # MDEV-13790 UNHEX() of a somewhat complicated CONCAT() returns NULL
---echo #
-
-SELECT UNHEX(CONCAT('414C2', HEX(8 + ROUND(RAND()*7)), SUBSTR(SHA(UUID()),6,33),HEX(2+ROUND(RAND()*8)))) IS NULL AS c1;
diff --git a/mysql-test/t/func_crypt.test b/mysql-test/t/func_crypt.test
deleted file mode 100644
index d091aa4ae86..00000000000
--- a/mysql-test/t/func_crypt.test
+++ /dev/null
@@ -1,122 +0,0 @@
--- source include/have_crypt.inc
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-select length(encrypt('foo', 'ff')) <> 0;
---replace_result $1$aa$4OSUA5cjdx0RUQ08opV27/ aaqPiZY5xR5l.
-
-create table t1 (name varchar(50), pw varchar(64));
-insert into t1 values ('tom', password('my_pass'));
-set @pass='my_pass';
-select name from t1 where name='tom' and pw=password(@pass);
-select name from t1 where name='tom' and pw=password(@undefined);
-drop table t1;
-
-# Test new and old password handling functions
-
-select password('abc');
-select password('');
-select old_password('abc');
-select old_password('');
-select password('gabbagabbahey');
-select old_password('idkfa');
-select length(password('1'));
---replace_result 60 13
-select length(encrypt('test'));
---replace_result \$2a\$04\$aO....................ql.D6ROU4Byvysj72xrV1ZAkrMKS8I6 aaqPiZY5xR5l.
-select encrypt('test','aa');
-select old_password(NULL);
-select password(NULL);
-set global old_passwords=on;
-select password('');
-select old_password('');
-select password('idkfa');
-select old_password('idkfa');
-set old_passwords=on;
-select password('idkfa');
-select old_password('idkfa');
-set global old_passwords=off;
-select password('idkfa');
-select old_password('idkfa');
-
-# this test shows that new scrambles honor spaces in passwords:
-set old_passwords=off;
-select password('idkfa ');
-select password('idkfa');
-select password(' idkfa');
-select old_password('idkfa');
-select old_password(' i d k f a ');
-
-explain extended select password('idkfa '), old_password('idkfa');
-
-#
-# Bug #13619: Crash on FreeBSD with salt like '_.'
-#
---replace_column 1 #
-select encrypt('1234','_.');
-
-# End of 4.1 tests
-
---echo #
---echo # Bug #44767: invalid memory reads in password() and old_password()
---echo # functions
---echo #
-
-CREATE TABLE t1(c1 MEDIUMBLOB);
-INSERT INTO t1 VALUES (REPEAT('a', 1024));
-SELECT OLD_PASSWORD(c1), PASSWORD(c1) FROM t1;
-DROP TABLE t1;
-
---echo # End of 5.0 tests
---echo #
---echo # Start of 10.0 tests
---echo #
-
---echo #
---echo # MDEV-10306 Wrong results with combination of CONCAT, SUBSTR and CONVERT in subquery
---echo #
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='derived_merge=on';
-# ENCRYPT() is not affected by MDEV-10306
-# It already uses tmp_value only for internal purposes and
-# returns the result in the String passed to val_str()
-CREATE TABLE t1 (t VARCHAR(32) CHARSET latin1);
-INSERT INTO t1 VALUES('abcdefghi');
-SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT ENCRYPT(t,'aa') t2 FROM t1) sub;
-DROP TABLE t1;
-SET optimizer_switch=@save_optimizer_switch;
-
---echo #
---echo # End of 10.0 tests
---echo #
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---let func=password
---source include/func_str_ascii_checksum.inc
---let func=old_password
---source include/func_str_ascii_checksum.inc
-
---echo #
---echo # MDEV-10864 Wrong result for WHERE .. (f2=COMPRESS('test') OR f2=COMPRESS('TEST'))
---echo #
-
-CREATE TABLE t1 (f1 VARCHAR(4), f2 VARCHAR(64), UNIQUE KEY k1 (f1,f2));
-INSERT INTO t1 VALUES ('test',encrypt('test','key')), ('TEST', encrypt('TEST','key'));
-SELECT f1 FROM t1 ignore index(k1) WHERE f1='test' AND (f2= encrypt('test','key') OR f2= encrypt('TEST','key'));
-SELECT f1 FROM t1 WHERE f1='test' AND (f2= encrypt('test','key') OR f2= encrypt('TEST','key'));
-SELECT f1 FROM t1 WHERE f1='test' AND (f2= encrypt('TEST','key') OR f2= encrypt('test','key'));
-DROP TABLE t1;
-
---echo # Start of 10.2 tests
-
-CREATE TABLE t1 (a VARCHAR(10), b VARCHAR(30) DEFAULT ENCRYPT(a,123));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('hello');
-SELECT * FROM t1;
-DROP TABLE t1;
diff --git a/mysql-test/t/func_date_add.test b/mysql-test/t/func_date_add.test
deleted file mode 100644
index f9287b952d2..00000000000
--- a/mysql-test/t/func_date_add.test
+++ /dev/null
@@ -1,171 +0,0 @@
-#
-# Test of DATE_ADD
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-CREATE TABLE t1 (
- visitor_id int(10) unsigned DEFAULT '0' NOT NULL,
- group_id int(10) unsigned DEFAULT '0' NOT NULL,
- hits int(10) unsigned DEFAULT '0' NOT NULL,
- sessions int(10) unsigned DEFAULT '0' NOT NULL,
- ts timestamp,
- PRIMARY KEY (visitor_id,group_id)
-)/*! engine=MyISAM */;
-INSERT INTO t1 VALUES (465931136,7,2,2,20000318160952);
-INSERT INTO t1 VALUES (173865424,2,2,2,20000318233615);
-INSERT INTO t1 VALUES (173865424,8,2,2,20000318233615);
-INSERT INTO t1 VALUES (173865424,39,2,2,20000318233615);
-INSERT INTO t1 VALUES (173865424,7,2,2,20000318233615);
-INSERT INTO t1 VALUES (173865424,3,2,2,20000318233615);
-INSERT INTO t1 VALUES (173865424,6,2,2,20000318233615);
-INSERT INTO t1 VALUES (173865424,60,2,2,20000318233615);
-INSERT INTO t1 VALUES (173865424,1502,2,2,20000318233615);
-INSERT INTO t1 VALUES (48985536,2,2,2,20000319013932);
-INSERT INTO t1 VALUES (48985536,8,2,2,20000319013932);
-INSERT INTO t1 VALUES (48985536,39,2,2,20000319013932);
-INSERT INTO t1 VALUES (48985536,7,2,2,20000319013932);
-INSERT INTO t1 VALUES (465931136,3,2,2,20000318160951);
-INSERT INTO t1 VALUES (465931136,119,1,1,20000318160953);
-INSERT INTO t1 VALUES (465931136,2,1,1,20000318160950);
-INSERT INTO t1 VALUES (465931136,8,1,1,20000318160950);
-INSERT INTO t1 VALUES (465931136,39,1,1,20000318160950);
-INSERT INTO t1 VALUES (1092858576,14,1,1,20000319013445);
-INSERT INTO t1 VALUES (357917728,3,2,2,20000319145026);
-INSERT INTO t1 VALUES (357917728,7,2,2,20000319145027);
-select visitor_id,max(ts) as mts from t1 group by visitor_id
-having mts < DATE_SUB(NOW(),INTERVAL 3 MONTH);
-select visitor_id,max(ts) as mts from t1 group by visitor_id
-having DATE_ADD(mts,INTERVAL 3 MONTH) < NOW();
-drop table t1;
-
-#
-# Bug #10627: Invalid date turned to NULL from date_sub/date_add in
-# traditional mode
-#
-set sql_mode='traditional';
-create table t1 (d date);
---error S22008
-insert into t1 (d) select date_sub('2000-01-01', INTERVAL 2001 YEAR);
---error S22008
-insert into t1 (d) select date_add('2000-01-01',interval 8000 year);
-# No warnings/errors from the next two
-insert into t1 values (date_add(NULL, INTERVAL 1 DAY));
-insert into t1 values (date_add('2000-01-04', INTERVAL NULL DAY));
-set sql_mode='';
-# These will all work now, and we'll end up with some NULL entries in the
-# table and some warnings.
-insert into t1 (d) select date_sub('2000-01-01', INTERVAL 2001 YEAR);
-insert into t1 (d) select date_add('2000-01-01',interval 8000 year);
-insert into t1 values (date_add(NULL, INTERVAL 1 DAY));
-insert into t1 values (date_add('2000-01-04', INTERVAL NULL DAY));
-select * from t1;
-drop table t1;
-
---echo End of 4.1 tests
-
-#
-# Bug#21811
-#
-# Make sure we end up with an appropriate
-# date format (DATE) after addition operation
-#
-SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 DAY;
-SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 MONTH;
-SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 YEAR;
-SELECT CAST('2006-09-26' AS DATE) + INTERVAL 1 WEEK;
-
-#
-# Bug#28450: The Item_date_add_interval in select list may fail the field
-# type assertion.
-#
-create table t1 (a int, b varchar(10));
-insert into t1 values (1, '2001-01-01'),(2, '2002-02-02');
-select '2007-01-01' + interval a day from t1;
-select b + interval a day from t1;
-drop table t1;
-
---echo End of 5.0 tests
-
-#
-# MDEV-4284 Assertion `cmp_items[(uint)cmp_type]' fails in sql/item_cmpfunc.cc
-#
-
-create table t1 (a varchar(10));
-insert t1 values ('2000-12-03'),('2008-05-03');
-select * from t1 where case a when adddate( '2012-12-12', 7 ) then true end;
-drop table t1;
-
---echo End of 5.5 tests
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-14452 Precision in INTERVAL xxx DAY_MICROSECOND parsed wrong?
---echo #
-
---vertical_results
-SELECT
- DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.5' DAY_MICROSECOND) c1,
- DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.50' DAY_MICROSECOND) c2,
- DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.500' DAY_MICROSECOND) c3,
- DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.5000' DAY_MICROSECOND) c4,
- DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.50000' DAY_MICROSECOND) c5,
- DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.500000' DAY_MICROSECOND) c6,
- DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.5000000' DAY_MICROSECOND) c7,
- DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.50000000' DAY_MICROSECOND) c8,
- DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.500000000' DAY_MICROSECOND) c9,
- DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.5000000000' DAY_MICROSECOND) c10,
- DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.50000000000' DAY_MICROSECOND) c11,
- DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.500000000000' DAY_MICROSECOND) c12,
- DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.5000000000000' DAY_MICROSECOND) c13,
- DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.50000000000000' DAY_MICROSECOND) c14,
- DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.500000000000000' DAY_MICROSECOND) c15,
- DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.5000000000000000' DAY_MICROSECOND) c16,
- DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.50000000000000000' DAY_MICROSECOND) c17,
- DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.500000000000000000' DAY_MICROSECOND) c18,
- DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.5000000000000000000' DAY_MICROSECOND) c19,
- DATE_ADD('1000-01-01 00:00:00', INTERVAL '0 00:00:01.50000000000000000000' DAY_MICROSECOND) c20
-;
---horizontal_results
-
-
---echo #
---echo # End of 10.1 tests
---echo #
-
-#
-# how + interval is printed
-#
-
-create or replace view v1 as select 3 & 20010101 + interval 2 day as x;
-show create view v1;
-select 3 & 20010101 + interval 2 day, x from v1;
-
-create or replace view v1 as select (3 & 20010101) + interval 2 day as x;
-show create view v1;
-select (3 & 20010101) + interval 2 day, x from v1;
-
-create or replace view v1 as select 3 & (20010101 + interval 2 day) as x;
-show create view v1;
-select 3 & (20010101 + interval 2 day), x from v1;
-
-create or replace view v1 as select 30 + 20010101 + interval 2 day as x;
-show create view v1;
-select 30 + 20010101 + interval 2 day, x from v1;
-
-create or replace view v1 as select (30 + 20010101) + interval 2 day as x;
-show create view v1;
-select (30 + 20010101) + interval 2 day, x from v1;
-
-create or replace view v1 as select 30 + (20010101 + interval 2 day) as x;
-show create view v1;
-select 30 + (20010101 + interval 2 day), x from v1;
-
-drop view v1;
-
---echo End of 10.2 tests
diff --git a/mysql-test/t/func_debug.test b/mysql-test/t/func_debug.test
deleted file mode 100644
index e0960f736cb..00000000000
--- a/mysql-test/t/func_debug.test
+++ /dev/null
@@ -1,477 +0,0 @@
---source include/have_debug.inc
-
-SET SESSION debug_dbug="+d,Item_func_in";
-SET SESSION debug_dbug="+d,Predicant_to_list_comparator";
-
---echo # Constant predicant, compatible types, bisect
-SELECT 1 IN (1,2);
-SELECT 1 IN (1,2,NULL);
-SELECT 1 NOT IN (1,2);
-SELECT 1 NOT IN (1,2,NULL);
-
-SELECT 1.0 IN (1.0,2.0);
-SELECT 1.0 IN (1.0,2.0,NULL);
-SELECT 1.0 NOT IN (1.0,2.0);
-SELECT 1.0 NOT IN (1.0,2.0,NULL);
-
-SELECT 1e0 IN (1e0,2e0);
-SELECT 1e0 IN (1e0,2e0,NULL);
-SELECT 1e0 NOT IN (1e0,2e0);
-SELECT 1e0 NOT IN (1e0,2e0,NULL);
-
-SELECT 'a' IN ('a','b');
-SELECT 'a' IN ('a','b',NULL);
-SELECT 'a' NOT IN ('a','b');
-SELECT 'a' NOT IN ('a','b',NULL);
-
-SELECT TIMESTAMP'2001-01-01 10:20:30' IN ('2001-01-01 10:20:30','2001-02-02 10:20:30');
-SELECT TIMESTAMP'2001-01-01 10:20:30' IN ('2001-01-01 10:20:30','2001-02-02 10:20:30',NULL);
-SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN ('2001-01-01 10:20:30','2001-02-02 10:20:30');
-SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN ('2001-01-01 10:20:30','2001-02-02 10:20:30',NULL);
-
-SELECT TIME'10:20:30' IN ('10:20:30','10:20:30');
-SELECT TIME'10:20:30' IN ('10:20:30','10:20:30',NULL);
-SELECT TIME'10:20:30' NOT IN ('10:20:30','10:20:30');
-SELECT TIME'10:20:30' NOT IN ('10:20:30','10:20:30',NULL);
-
-SELECT DATE'2001-01-01' IN ('2001-01-01','2001-02-02');
-SELECT DATE'2001-01-01' IN ('2001-01-01','2001-02-02',NULL);
-SELECT DATE'2001-01-01' NOT IN ('2001-01-01','2001-02-02');
-SELECT DATE'2001-01-01' NOT IN ('2001-01-01','2001-02-02',NULL);
-
-
---echo # Column predicant, compatible types, bisect
-
-# Special case: mixture of unsigned, signed and decimal
-CREATE TABLE t1 (a INT UNSIGNED);
-# a=1.0 is done as decimal, because decimal bits int
-# a=1 is done as decimal as well, because of different unsigned flag
-SELECT a IN (1.0, 1) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT);
-SELECT a IN (1,2,3) FROM t1;
-SELECT a IN (1,2,3,NULL) FROM t1;
-SELECT a IN (1.0, CAST(1 AS UNSIGNED)) FROM t1;
-SELECT a IN (1.0, CAST(1 AS UNSIGNED),NULL) FROM t1;
-SELECT a NOT IN (1,2,3) FROM t1;
-SELECT a NOT IN (1,2,3,NULL) FROM t1;
-SELECT a NOT IN (1.0, CAST(1 AS UNSIGNED)) FROM t1;
-SELECT a NOT IN (1.0, CAST(1 AS UNSIGNED),NULL) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DOUBLE);
-SELECT a IN (1e0,2,3.0) FROM t1;
-SELECT a IN (1e0,2,3.0,NULL) FROM t1;
-SELECT a NOT IN (1e0,2,3.0) FROM t1;
-SELECT a NOT IN (1e0,2,3.0,NULL) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DECIMAL(10,1));
-SELECT a IN (1,2.0,3.0) FROM t1;
-SELECT a IN (1,2.0,3.0,NULL) FROM t1;
-SELECT a NOT IN (1,2.0,3.0) FROM t1;
-SELECT a NOT IN (1,2.0,3.0,NULL) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10));
-SELECT a IN ('a','b','c') FROM t1;
-SELECT a IN ('a','b','c',NULL) FROM t1;
-SELECT a NOT IN ('a','b','c') FROM t1;
-SELECT a NOT IN ('a','b','c',NULL) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DATE);
-SELECT a IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0) FROM t1;
-SELECT a IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0,NULL) FROM t1;
-SELECT a NOT IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0) FROM t1;
-SELECT a NOT IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0,NULL) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a TIME);
-SELECT a IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0) FROM t1;
-SELECT a IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0,NULL) FROM t1;
-SELECT a NOT IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0) FROM t1;
-SELECT a NOT IN ('10:20:30',TIME'10:20:30',102030,102030.0,102030e0,NULL) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DATETIME);
-SELECT a IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0) FROM t1;
-SELECT a IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0,NULL) FROM t1;
-SELECT a NOT IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0) FROM t1;
-SELECT a NOT IN ('2001-01-01',TIMESTAMP'2001-01-01 10:20:30',DATE'2001-01-01',TIME'10:20:30',20010101102030,20010101102030.0,20010101102030e0,NULL) FROM t1;
-DROP TABLE t1;
-
---echo # Constant predicant, compatible types, no bisect
---echo # Bisect is not used because of non-constant expressions in the list
-CREATE TABLE t1 (a INT);
-SELECT 1 IN (a,1,2,3) FROM t1;
-SELECT 1 IN (a,1,2,3,NULL) FROM t1;
-SELECT 1 NOT IN (a,1,2,3) FROM t1;
-SELECT 1 NOT IN (a,1,2,3,NULL) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DOUBLE);
-SELECT 1 IN (a,1e0,2e0,3e0) FROM t1;
-SELECT 1 IN (a,1e0,2e0,3e0,NULL) FROM t1;
-SELECT 1 NOT IN (a,1e0,2e0,3e0) FROM t1;
-SELECT 1 NOT IN (a,1e0,2e0,3e0,NULL) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DECIMAL(10,1));
-SELECT 1 IN (a,1.0,2.0,3.0) FROM t1;
-SELECT 1 IN (a,1.0,2.0,3.0,NULL) FROM t1;
-SELECT 1 NOT IN (a,1.0,2.0,3.0) FROM t1;
-SELECT 1 NOT IN (a,1.0,2.0,3.0,NULL) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10));
-SELECT 'a' IN (a,'b','c') FROM t1;
-SELECT 'a' IN (a,'b','c',NULL) FROM t1;
-SELECT 'a' NOT IN (a,'b','c') FROM t1;
-SELECT 'a' NOT IN (a,'b','c',NULL) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DATE);
-SELECT DATE'2001-01-01' IN (a,'2001-01-01') FROM t1;
-SELECT DATE'2001-01-01' IN (a,'2001-01-01',NULL) FROM t1;
-SELECT DATE'2001-01-01' NOT IN (a,'2001-01-01') FROM t1;
-SELECT DATE'2001-01-01' NOT IN (a,'2001-01-01',NULL) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a TIME);
-SELECT TIME'10:20:30' IN (a,'10:20:30') FROM t1;
-SELECT TIME'10:20:30' IN (a,'10:20:30',NULL) FROM t1;
-SELECT TIME'10:20:30' NOT IN (a,'10:20:30') FROM t1;
-SELECT TIME'10:20:30' NOT IN (a,'10:20:30',NULL) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DATETIME);
-SELECT TIMESTAMP'2001-01-01 10:20:30' IN (a,TIMESTAMP'2001-01-01 10:20:30') FROM t1;
-SELECT TIMESTAMP'2001-01-01 10:20:30' IN (a,TIMESTAMP'2001-01-01 10:20:30',NULL) FROM t1;
-SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN (a,TIMESTAMP'2001-01-01 10:20:30') FROM t1;
-SELECT TIMESTAMP'2001-01-01 10:20:30' NOT IN (a,TIMESTAMP'2001-01-01 10:20:30',NULL) FROM t1;
-DROP TABLE t1;
-
-
---echo # Constant predicant, incompatible types, no bisect
-SELECT 1 IN (1,2e0);
-SELECT 1 IN (1,2e0,NULL);
-SELECT 1 NOT IN (1,2e0);
-SELECT 1 NOT IN (1,2e0,NULL);
-
-SELECT 1.0 IN (1.0,2e0);
-SELECT 1.0 IN (1.0,2e0,NULL);
-SELECT 1.0 NOT IN (1.0,2e0);
-SELECT 1.0 NOT IN (1.0,2e0,NULL);
-
-SELECT 1e0 IN (1.0,TIME'10:20:30');
-SELECT 1e0 IN (1.0,TIME'10:20:30',NULL);
-SELECT 1e0 NOT IN (1.0,TIME'10:20:30');
-SELECT 1e0 NOT IN (1.0,TIME'10:20:30',NULL);
-
-SELECT 'a' IN ('a',2);
-SELECT 'a' IN ('a',2,NULL);
-SELECT 'a' NOT IN ('a',2);
-SELECT 'a' NOT IN ('a',2,NULL);
-
-SELECT TIME'10:20:30' IN (1,TIME'10:20:30');
-SELECT TIME'10:20:30' IN (1,TIME'10:20:30',NULL);
-SELECT TIME'10:20:30' IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32');
-SELECT TIME'10:20:30' IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL);
-SELECT TIME'10:20:30' IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32');
-SELECT TIME'10:20:30' IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL);
-SELECT TIME'10:20:30' NOT IN (1,TIME'10:20:30');
-SELECT TIME'10:20:30' NOT IN (1,TIME'10:20:30',NULL);
-SELECT TIME'10:20:30' NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32');
-SELECT TIME'10:20:30' NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL);
-SELECT TIME'10:20:30' NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32');
-SELECT TIME'10:20:30' NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL);
-
---echo # Column predicant, incompatible types, no bisect
-CREATE TABLE t1 (a INT);
-SELECT a IN (1,1e0) FROM t1;
-SELECT a IN (1,1e0,NULL) FROM t1;
-SELECT a IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) FROM t1;
-SELECT a IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) FROM t1;
-SELECT a IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) FROM t1;
-SELECT a IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) FROM t1;
-SELECT a NOT IN (1,1e0) FROM t1;
-SELECT a NOT IN (1,1e0,NULL) FROM t1;
-SELECT a NOT IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) FROM t1;
-SELECT a NOT IN (CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) FROM t1;
-SELECT a NOT IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED)) FROM t1;
-SELECT a NOT IN (CAST(1 AS DECIMAL),CAST(1 AS SIGNED), CAST(1 AS UNSIGNED),NULL) FROM t1;
-
-SELECT a IN (1,1.0) FROM t1;
-SELECT a IN (1,1.0,NULL) FROM t1;
-SELECT a NOT IN (1,1.0) FROM t1;
-SELECT a NOT IN (1,1.0,NULL) FROM t1;
-
-SELECT a IN (1,'1') FROM t1;
-SELECT a IN (1,'1',NULL) FROM t1;
-SELECT a NOT IN (1,'1') FROM t1;
-SELECT a NOT IN (1,'1',NULL) FROM t1;
-
-SELECT a IN (1,TIME'10:20:30') FROM t1;
-SELECT a IN (1,TIME'10:20:30',NULL) FROM t1;
-SELECT a NOT IN (1,TIME'10:20:30') FROM t1;
-SELECT a NOT IN (1,TIME'10:20:30',NULL) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DECIMAL(10,0));
-SELECT a IN (1,1e0) FROM t1;
-SELECT a IN (1,1e0,NULL) FROM t1;
-SELECT a NOT IN (1,1e0) FROM t1;
-SELECT a NOT IN (1,1e0,NULL) FROM t1;
-
-SELECT a IN (1,'1') FROM t1;
-SELECT a IN (1,'1',NULL) FROM t1;
-SELECT a NOT IN (1,'1') FROM t1;
-SELECT a NOT IN (1,'1',NULL) FROM t1;
-
-SELECT a IN (1,TIME'10:20:30') FROM t1;
-SELECT a IN (1,TIME'10:20:30',NULL) FROM t1;
-SELECT a NOT IN (1,TIME'10:20:30') FROM t1;
-SELECT a NOT IN (1,TIME'10:20:30',NULL) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DOUBLE);
-SELECT a IN (1,TIME'10:20:30') FROM t1;
-SELECT a IN (1,TIME'10:20:30',NULL) FROM t1;
-SELECT a NOT IN (1,TIME'10:20:30') FROM t1;
-SELECT a NOT IN (1,TIME'10:20:30',NULL) FROM t1;
-
-SELECT a IN (1,DATE'2001-01-01') FROM t1;
-SELECT a IN (1,DATE'2001-01-01',NULL) FROM t1;
-SELECT a NOT IN (1,DATE'2001-01-01') FROM t1;
-SELECT a NOT IN (1,DATE'2001-01-01',NULL) FROM t1;
-
-SELECT a IN (1,TIMESTAMP'2001-01-01 10:20:30') FROM t1;
-SELECT a IN (1,TIMESTAMP'2001-01-01 10:20:30',NULL) FROM t1;
-SELECT a NOT IN (1,TIMESTAMP'2001-01-01 10:20:30') FROM t1;
-SELECT a NOT IN (1,TIMESTAMP'2001-01-01 10:20:30',NULL) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a VARCHAR(10));
-SELECT a IN ('a',1) FROM t1;
-SELECT a IN ('a',TIME'10:20:30') FROM t1;
-SELECT a NOT IN ('a',1) FROM t1;
-SELECT a NOT IN ('a',TIME'10:20:30') FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a TIME);
-SELECT a IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') FROM t1;
-SELECT a IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) FROM t1;
-SELECT a IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') FROM t1;
-SELECT a IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) FROM t1;
-SELECT a NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') FROM t1;
-SELECT a NOT IN (102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) FROM t1;
-SELECT a NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32') FROM t1;
-SELECT a NOT IN (102030, 102030, TIME'10:20:30',TIMESTAMP'2001-01-01 10:20:32',NULL) FROM t1;
-DROP TABLE t1;
-
-#
-# ROW tests
-#
-# ROW has additional conditions when bisect is possible (see item_cmpfunc.h):
-#
-# ((is_top_level_item && not_negated) || // 3
-# (arg0_can_not_be_null && list_does_not_have_nulls) // 4
-
-# Testing all combinations of the condition components
-#
-# tli - is_top_level_item
-# nneg - not_negated
-# a0nnul - arg0_can_not_be_null
-# lnnul - list_does_not_have_nulls
-# cond3 - condition 3 is true?
-# cond4 - condition 4 is true?
-# bisect - bisect is possible (cond3 orded with cond4)
-
-# Note:
-# - using an expression in SELECT list makes top_level_item() to be false
-# - using an expression in WHERE clause makes top_leve_item() to be true
-
---echo # Not top level, negated: cond3 is false
-
-# tli nneg a0nnul lnnul cond3 cond4 bisect
-# --- --- ------ ----- ----- ----- ------
-# 0 0 0 0 0 0 0
-# 0 0 0 1 0 0 0
-# 0 0 1 0 0 0 0
-# 0 0 1 1 0 1 1
-
-# ROW with scalar elements
-CREATE TABLE t1 (a INT);
-SELECT ROW(a,a) NOT IN ((1,1),(2,NULL)) FROM t1;
-SELECT ROW(a,a) NOT IN ((1,1),(2,2)) FROM t1;
-DROP TABLE t1;
-CREATE TABLE t1 (a INT NOT NULL, b INT);
-SELECT ROW(a,a) NOT IN ((1,1),(2,NULL)) FROM t1;
-SELECT ROW(a,a) NOT IN ((1,1),(2,2)) FROM t1;
-DROP TABLE t1;
-
-# ROW with a nested ROW
-CREATE TABLE t1 (a INT);
-SELECT ROW(a,(a,a)) NOT IN ((1,(1,1)),(2,(2,NULL))) FROM t1;
-SELECT ROW(a,(a,a)) NOT IN ((1,(1,1)),(2,(2,2))) FROM t1;
-DROP TABLE t1;
-CREATE TABLE t1 (a INT NOT NULL);
-SELECT ROW(a,(a,a)) NOT IN ((1,(1,1)),(2,(2,NULL))) FROM t1;
-SELECT ROW(a,(a,a)) NOT IN ((1,(1,1)),(2,(2,2))) FROM t1;
-DROP TABLE t1;
-
---echo # Not top level, not negated: cond3 is false
-
-# tli nneg a0nnul lnnul cond3 cond4 bisect
-# --- --- ------ ----- ----- ----- ------
-# 0 1 0 0 0 0 0
-# 0 1 0 1 0 0 0
-# 0 1 1 0 0 0 0
-# 0 1 1 1 0 1 1
-
-# ROW with scalar elements
-CREATE TABLE t1 (a INT);
-SELECT ROW(a,a) IN ((1,1),(2,NULL)) FROM t1;
-SELECT ROW(a,a) IN ((1,1),(2,2)) FROM t1;
-DROP TABLE t1;
-CREATE TABLE t1 (a INT NOT NULL);
-SELECT ROW(a,a) IN ((1,1),(2,NULL)) FROM t1;
-SELECT ROW(a,a) IN ((1,1),(2,2)) FROM t1;
-DROP TABLE t1;
-
-# ROW with a nested ROW
-CREATE TABLE t1 (a INT);
-SELECT ROW(a,(a,a)) IN ((1,(1,1)),(2,(2,NULL))) FROM t1;
-SELECT ROW(a,(a,a)) IN ((1,(1,1)),(2,(2,2))) FROM t1;
-DROP TABLE t1;
-CREATE TABLE t1 (a INT NOT NULL);
-SELECT ROW(a,(a,a)) IN ((1,(1,1)),(2,(2,NULL))) FROM t1;
-SELECT ROW(a,(a,a)) IN ((1,(1,1)),(2,(2,2))) FROM t1;
-DROP TABLE t1;
-
-
---echo # Top level, negated: cond3 is false
-
-# tli nneg a0nnul lnnul cond3 cond4 bisect
-# --- --- ------ ----- ----- ----- ------
-# 1 0 0 0 0 0 0
-# 1 0 0 1 0 0 0
-# 1 0 1 0 0 0 0
-# 1 0 1 1 0 1 1
-
-# ROW with scalar elements
-CREATE TABLE t1 (a INT);
-SELECT 1 FROM t1 WHERE ROW(a,a) NOT IN ((1,1),(2,NULL));
-SELECT 1 FROM t1 WHERE ROW(a,a) NOT IN ((1,1),(2,2));
-DROP TABLE t1;
-CREATE TABLE t1 (a INT NOT NULL);
-SELECT 1 FROM t1 WHERE ROW(a,a) NOT IN ((1,1),(2,NULL));
-SELECT 1 FROM t1 WHERE ROW(a,a) NOT IN ((1,1),(2,2));
-DROP TABLE t1;
-
-# ROW with a nested ROW
-CREATE TABLE t1 (a INT);
-SELECT 1 FROM t1 WHERE ROW(a,(a,a)) NOT IN ((1,(1,1)),(2,(2,NULL)));
-SELECT 1 FROM t1 WHERE ROW(a,(a,a)) NOT IN ((1,(1,1)),(2,(2,2)));
-DROP TABLE t1;
-CREATE TABLE t1 (a INT NOT NULL);
-SELECT 1 FROM t1 WHERE ROW(a,(a,a)) NOT IN ((1,(1,1)),(2,(2,NULL)));
-SELECT 1 FROM t1 WHERE ROW(a,(a,a)) NOT IN ((1,(1,1)),(2,(2,2)));
-DROP TABLE t1;
-
---echo # Top level, not negated: cond3 is true
-
-# tli nneg a0nnul lnnul cond3 cond4 bisect
-# --- --- ------ ----- ----- ----- ------
-# 1 1 0 0 1 0 1
-# 1 1 0 1 1 1 1
-# 1 1 1 0 1 0 1
-# 1 1 1 1 1 1 1
-
-# ROW with scalar elements
-CREATE TABLE t1 (a INT);
-SELECT 1 FROM t1 WHERE ROW(a,a) IN ((1,1),(2,NULL));
-SELECT 1 FROM t1 WHERE ROW(a,a) IN ((1,1),(2,2));
-DROP TABLE t1;
-CREATE TABLE t1 (a INT NOT NULL);
-SELECT 1 FROM t1 WHERE ROW(a,a) IN ((1,1),(2,NULL));
-SELECT 1 FROM t1 WHERE ROW(a,a) IN ((1,1),(2,2));
-DROP TABLE t1;
-
-# ROW with a nested ROW
-CREATE TABLE t1 (a INT);
-SELECT 1 FROM t1 WHERE ROW(a,(a,a)) IN ((1,(1,1)),(2,(2,NULL)));
-SELECT 1 FROM t1 WHERE ROW(a,(a,a)) IN ((1,(1,1)),(2,(2,2)));
-DROP TABLE t1;
-CREATE TABLE t1 (a INT NOT NULL);
-SELECT 1 FROM t1 WHERE ROW(a,(a,a)) IN ((1,(1,1)),(2,(2,NULL)));
-SELECT 1 FROM t1 WHERE ROW(a,(a,a)) IN ((1,(1,1)),(2,(2,2)));
-DROP TABLE t1;
-
---echo #
---echo # MDEV-11514 IN with a mixture of TIME and DATETIME returns a wrong result
---echo #
-
-SELECT TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32');
-
-PREPARE stmt FROM "SELECT
- TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32')";
-EXECUTE stmt;
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-
-CREATE TABLE t1 (a VARCHAR(10));
-INSERT INTO t1 VALUES ('A'),('B'),('A');
-# Compatible types
-SELECT a,NULL AS b FROM t1 GROUP BY a HAVING 'A' IN (b,'A');
-SELECT a,NULL AS b FROM t1 GROUP BY a HAVING 'A' IN ('A',b);
-SELECT a,NULL AS b FROM t1 GROUP BY a HAVING 'A' IN (b,a);
-SELECT a,NULL AS b FROM t1 GROUP BY a HAVING 'A' IN (a,b);
-# Incompatible types
-SELECT a,NULL AS b FROM t1 GROUP BY a HAVING 'A' IN (b,'A',10);
-SELECT a,NULL AS b FROM t1 GROUP BY a HAVING 'A' IN ('A',b,10);
-SELECT a,NULL AS b FROM t1 GROUP BY a HAVING 'A' IN (b,a,10);
-SELECT a,NULL AS b FROM t1 GROUP BY a HAVING 'A' IN (a,b,10);
-DROP TABLE t1;
-
---echo #
---echo # MDEV-11497 Wrong result for (int_expr IN (mixture of signed and unsigned expressions))
---echo #
-CREATE TABLE t1 (a BIGINT, b BIGINT UNSIGNED);
-INSERT INTO t1 VALUES (-9223372036854775808,18446744073709551615);
-SELECT * FROM t1 WHERE -1 IN (a,b);
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-11554 Wrong result for CASE on a mixture of signed and unsigned expressions
---echo #
-
-CREATE TABLE t1 (a BIGINT, b BIGINT UNSIGNED);
-INSERT INTO t1 VALUES (-9223372036854775808,18446744073709551615);
-SELECT
- CASE -1
- WHEN -9223372036854775808 THEN 'one'
- WHEN 18446744073709551615 THEN 'two'
- END AS c;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-11555 CASE with a mixture of TIME and DATETIME returns a wrong result
---echo #
-SELECT
- CASE TIME'10:20:30'
- WHEN 102030 THEN 'one'
- WHEN TIME'10:20:31' THEN 'two'
- END AS good,
- CASE TIME'10:20:30'
- WHEN 102030 THEN 'one'
- WHEN TIME'10:20:31' THEN 'two'
- WHEN TIMESTAMP'2001-01-01 10:20:32' THEN 'three'
- END AS was_bad_now_good;
-
-
-SET SESSION debug_dbug="-d,Predicant_to_list_comparator";
-SET SESSION debug_dbug="-d,Item_func_in";
diff --git a/mysql-test/t/func_default.test b/mysql-test/t/func_default.test
deleted file mode 100644
index fbd73990297..00000000000
--- a/mysql-test/t/func_default.test
+++ /dev/null
@@ -1,43 +0,0 @@
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-
-create table t1(str varchar(10) default 'def',strnull varchar(10),intg int default '10',rel double default '3.14');
-
-insert into t1 values ('','',0,0.0);
-select default(str), default(strnull), default(intg), default(rel) from t1;
-explain extended select default(str), default(strnull), default(intg), default(rel) from t1;
-select * from t1 where str <> default(str);
-explain select * from t1 where str <> default(str);
-
-#TODO: uncomment when bug will be fixed
-#create table t2 select default(str), default(strnull), default(intg), default(rel) from t1;
-#show create table from t1;
-#insert into t2 select select default(str), default(strnull), default(intg), default(rel) from t1;
-
-drop table t1;
-
-# End of 4.1 tests
-
-#
-# Bug #11314 (HAVING DEFAULT() hangs)
-#
-CREATE TABLE t1 (id int(11), s varchar(20));
-INSERT INTO t1 VALUES (1, 'one'), (2, 'two'), (3, 'three');
---error 1364
-SELECT s, 32 AS mi FROM t1 GROUP BY s HAVING DEFAULT(mi) IS NULL;
-DROP TABLE t1;
-
-#
-# 10.2 tests
-#
-
-set timestamp=unix_timestamp('2001-01-01 10:20:30.123456');
-create table t1 (a int default 1, b int default (a+1),
- c varchar(100) default 'foo', d text default 'bar',
- e timestamp default now(), f timestamp(6) default now(2));
-insert t1 () values ();
-insert t1 (a) values (10);
-select default(a),default(b),default(c),default(d),default(e),default(f) from t1;
-drop table t1;
diff --git a/mysql-test/t/func_des_encrypt.test b/mysql-test/t/func_des_encrypt.test
deleted file mode 100644
index c9661b81cc0..00000000000
--- a/mysql-test/t/func_des_encrypt.test
+++ /dev/null
@@ -1,39 +0,0 @@
--- source include/have_des.inc
-
-# This test can't be in func_encrypt.test, because it requires
-# --des-key-file to not be set.
-
-#
-# Bug #11643: des_encrypt() causes server to die
-#
-select des_encrypt('hello');
-
-# End of 4.1 tests
-
---echo #
---echo # Bug #11643: des_encrypt() causes server to die
---echo #
-
-CREATE TABLE t1 (des VARBINARY(200) NOT NULL DEFAULT '') ENGINE=MyISAM;
-
-INSERT INTO t1 VALUES ('1234'), ('12345'), ('123456'), ('1234567');
-
-UPDATE t1 SET des=DES_ENCRYPT('1234');
-
-SELECT LENGTH(des) FROM t1;
-SELECT DES_DECRYPT(des) FROM t1;
-
-SELECT
- LENGTH(DES_ENCRYPT('1234')),
- LENGTH(DES_ENCRYPT('12345')),
- LENGTH(DES_ENCRYPT('123456')),
- LENGTH(DES_ENCRYPT('1234567'));
-SELECT
- DES_DECRYPT(DES_ENCRYPT('1234')),
- DES_DECRYPT(DES_ENCRYPT('12345')),
- DES_DECRYPT(DES_ENCRYPT('123456')),
- DES_DECRYPT(DES_ENCRYPT('1234567'));
-
-DROP TABLE t1;
-
---Echo End of 5.0 tests
diff --git a/mysql-test/t/func_digest.test b/mysql-test/t/func_digest.test
deleted file mode 100644
index e7d73b4f368..00000000000
--- a/mysql-test/t/func_digest.test
+++ /dev/null
@@ -1,540 +0,0 @@
--- source include/have_ssl_crypto_functs.inc
-
-# These test data are from the NIST SHA Test Vectors for Hashing
-# Byte-Oriented Messages. See http://csrc.nist.gov/cryptval/shs.htm
-# Only the "ShortMsg" test data are used here.
-# Values of x'00' in the test data have been excluded; it is not clear
-# how to specify a length of 8 bits for a binary value like that.
-
-SELECT SHA1( x'a8' ) = '99f2aa95e36f95c2acb0eaf23998f030638f3f15' as NIST_SHA1_test_vector;
-SELECT SHA1( x'3000' ) = 'f944dcd635f9801f7ac90a407fbc479964dec024' as NIST_SHA1_test_vector;
-SELECT SHA1( x'42749e' ) = 'a444319e9b6cc1e8464c511ec0969c37d6bb2619' as NIST_SHA1_test_vector;
-SELECT SHA1( x'9fc3fe08' ) = '16a0ff84fcc156fd5d3ca3a744f20a232d172253' as NIST_SHA1_test_vector;
-SELECT SHA1( x'b5c1c6f1af' ) = 'fec9deebfcdedaf66dda525e1be43597a73a1f93' as NIST_SHA1_test_vector;
-SELECT SHA1( x'e47571e5022e' ) = '8ce051181f0ed5e9d0c498f6bc4caf448d20deb5' as NIST_SHA1_test_vector;
-SELECT SHA1( x'3e1b28839fb758' ) = '67da53837d89e03bf652ef09c369a3415937cfd3' as NIST_SHA1_test_vector;
-SELECT SHA1( x'a81350cbb224cb90' ) = '305e4ff9888ad855a78573cddf4c5640cce7e946' as NIST_SHA1_test_vector;
-SELECT SHA1( x'c243d167923dec3ce1' ) = '5902b77b3265f023f9bbc396ba1a93fa3509bde7' as NIST_SHA1_test_vector;
-SELECT SHA1( x'50ac18c59d6a37a29bf4' ) = 'fcade5f5d156bf6f9af97bdfa9c19bccfb4ff6ab' as NIST_SHA1_test_vector;
-SELECT SHA1( x'98e2b611ad3b1cccf634f6' ) = '1d20fbe00533c10e3cbd6b27088a5de0c632c4b5' as NIST_SHA1_test_vector;
-SELECT SHA1( x'73fe9afb68e1e8712e5d4eec' ) = '7e1b7e0f7a8f3455a9c03e9580fd63ae205a2d93' as NIST_SHA1_test_vector;
-SELECT SHA1( x'9e701ed7d412a9226a2a130e66' ) = '706f0677146307b20bb0e8d6311e329966884d13' as NIST_SHA1_test_vector;
-SELECT SHA1( x'6d3ee90413b0a7cbf69e5e6144ca' ) = 'a7241a703aaf0d53fe142f86bf2e849251fa8dff' as NIST_SHA1_test_vector;
-SELECT SHA1( x'fae24d56514efcb530fd4802f5e71f' ) = '400f53546916d33ad01a5e6df66822dfbdc4e9e6' as NIST_SHA1_test_vector;
-SELECT SHA1( x'c5a22dd6eda3fe2bdc4ddb3ce6b35fd1' ) = 'fac8ab93c1ae6c16f0311872b984f729dc928ccd' as NIST_SHA1_test_vector;
-SELECT SHA1( x'd98cded2adabf08fda356445c781802d95' ) = 'fba6d750c18da58f6e2aab10112b9a5ef3301b3b' as NIST_SHA1_test_vector;
-SELECT SHA1( x'bcc6d7087a84f00103ccb32e5f5487a751a2' ) = '29d27c2d44c205c8107f0351b05753ac708226b6' as NIST_SHA1_test_vector;
-SELECT SHA1( x'36ecacb1055434190dbbc556c48bafcb0feb0d' ) = 'b971bfc1ebd6f359e8d74cb7ecfe7f898d0ba845' as NIST_SHA1_test_vector;
-SELECT SHA1( x'5ff9edb69e8f6bbd498eb4537580b7fba7ad31d0' ) = '96d08c430094b9fcc164ad2fb6f72d0a24268f68' as NIST_SHA1_test_vector;
-SELECT SHA1( x'c95b441d8270822a46a798fae5defcf7b26abace36' ) = 'a287ea752a593d5209e287881a09c49fa3f0beb1' as NIST_SHA1_test_vector;
-SELECT SHA1( x'83104c1d8a55b28f906f1b72cb53f68cbb097b44f860' ) = 'a06c713779cbd88519ed4a585ac0cb8a5e9d612b' as NIST_SHA1_test_vector;
-SELECT SHA1( x'755175528d55c39c56493d697b790f099a5ce741f7754b' ) = 'bff7d52c13a3688132a1d407b1ab40f5b5ace298' as NIST_SHA1_test_vector;
-SELECT SHA1( x'088fc38128bbdb9fd7d65228b3184b3faac6c8715f07272f' ) = 'c7566b91d7b6f56bdfcaa9781a7b6841aacb17e9' as NIST_SHA1_test_vector;
-SELECT SHA1( x'a4a586eb9245a6c87e3adf1009ac8a49f46c07e14185016895' ) = 'ffa30c0b5c550ea4b1e34f8a60ec9295a1e06ac1' as NIST_SHA1_test_vector;
-SELECT SHA1( x'8e7c555270c006092c2a3189e2a526b873e2e269f0fb28245256' ) = '29e66ed23e914351e872aa761df6e4f1a07f4b81' as NIST_SHA1_test_vector;
-SELECT SHA1( x'a5f3bfa6bb0ba3b59f6b9cbdef8a558ec565e8aa3121f405e7f2f0' ) = 'b28cf5e5b806a01491d41f69bd9248765c5dc292' as NIST_SHA1_test_vector;
-SELECT SHA1( x'589054f0d2bd3c2c85b466bfd8ce18e6ec3e0b87d944cd093ba36469' ) = '60224fb72c46069652cd78bcd08029ef64da62f3' as NIST_SHA1_test_vector;
-SELECT SHA1( x'a0abb12083b5bbc78128601bf1cbdbc0fdf4b862b24d899953d8da0ff3' ) = 'b72c4a86f72608f24c05f3b9088ef92fba431df7' as NIST_SHA1_test_vector;
-SELECT SHA1( x'82143f4cea6fadbf998e128a8811dc75301cf1db4f079501ea568da68eeb' ) = '73779ad5d6b71b9b8328ef7220ff12eb167076ac' as NIST_SHA1_test_vector;
-SELECT SHA1( x'9f1231dd6df1ff7bc0b0d4f989d048672683ce35d956d2f57913046267e6f3' ) = 'a09671d4452d7cf50015c914a1e31973d20cc1a0' as NIST_SHA1_test_vector;
-SELECT SHA1( x'041c512b5eed791f80d3282f3a28df263bb1df95e1239a7650e5670fc2187919' ) = 'e88cdcd233d99184a6fd260b8fca1b7f7687aee0' as NIST_SHA1_test_vector;
-SELECT SHA1( x'17e81f6ae8c2e5579d69dafa6e070e7111461552d314b691e7a3e7a4feb3fae418' ) = '010def22850deb1168d525e8c84c28116cb8a269' as NIST_SHA1_test_vector;
-SELECT SHA1( x'd15976b23a1d712ad28fad04d805f572026b54dd64961fda94d5355a0cc98620cf77' ) = 'aeaa40ba1717ed5439b1e6ea901b294ba500f9ad' as NIST_SHA1_test_vector;
-SELECT SHA1( x'09fce4d434f6bd32a44e04b848ff50ec9f642a8a85b37a264dc73f130f22838443328f' ) = 'c6433791238795e34f080a5f1f1723f065463ca0' as NIST_SHA1_test_vector;
-SELECT SHA1( x'f17af27d776ec82a257d8d46d2b46b639462c56984cc1be9c1222eadb8b26594a25c709d' ) = 'e21e22b89c1bb944a32932e6b2a2f20d491982c3' as NIST_SHA1_test_vector;
-SELECT SHA1( x'b13ce635d6f8758143ffb114f2f601cb20b6276951416a2f94fbf4ad081779d79f4f195b22' ) = '575323a9661f5d28387964d2ba6ab92c17d05a8a' as NIST_SHA1_test_vector;
-SELECT SHA1( x'5498793f60916ff1c918dde572cdea76da8629ba4ead6d065de3dfb48de94d234cc1c5002910' ) = 'feb44494af72f245bfe68e86c4d7986d57c11db7' as NIST_SHA1_test_vector;
-SELECT SHA1( x'498a1e0b39fa49582ae688cd715c86fbaf8a81b8b11b4d1594c49c902d197c8ba8a621fd6e3be5' ) = 'cff2290b3648ba2831b98dde436a72f9ebf51eee' as NIST_SHA1_test_vector;
-SELECT SHA1( x'3a36ae71521f9af628b3e34dcb0d4513f84c78ee49f10416a98857150b8b15cb5c83afb4b570376e' ) = '9b4efe9d27b965905b0c3dab67b8d7c9ebacd56c' as NIST_SHA1_test_vector;
-SELECT SHA1( x'dcc76b40ae0ea3ba253e92ac50fcde791662c5b6c948538cffc2d95e9de99cac34dfca38910db2678f' ) = 'afedb0ff156205bcd831cbdbda43db8b0588c113' as NIST_SHA1_test_vector;
-SELECT SHA1( x'5b5ec6ec4fd3ad9c4906f65c747fd4233c11a1736b6b228b92e90cddabb0c7c2fcf9716d3fad261dff33' ) = '8deb1e858f88293a5e5e4d521a34b2a4efa70fc4' as NIST_SHA1_test_vector;
-SELECT SHA1( x'df48a37b29b1d6de4e94717d60cdb4293fcf170bba388bddf7a9035a15d433f20fd697c3e4c8b8c5f590ab' ) = '95cbdac0f74afa69cebd0e5c7defbc6faf0cbeaf' as NIST_SHA1_test_vector;
-SELECT SHA1( x'1f179b3b82250a65e1b0aee949e218e2f45c7a8dbfd6ba08de05c55acfc226b48c68d7f7057e5675cd96fcfc' ) = 'f0307bcb92842e5ae0cd4f4f14f3df7f877fbef2' as NIST_SHA1_test_vector;
-SELECT SHA1( x'ee3d72da3a44d971578972a8e6780ce64941267e0f7d0179b214fa97855e1790e888e09fbe3a70412176cb3b54' ) = '7b13bb0dbf14964bd63b133ac85e22100542ef55' as NIST_SHA1_test_vector;
-SELECT SHA1( x'd4d4c7843d312b30f610b3682254c8be96d5f6684503f8fbfbcd15774fc1b084d3741afb8d24aaa8ab9c104f7258' ) = 'c314d2b6cf439be678d2a74e890d96cfac1c02ed' as NIST_SHA1_test_vector;
-SELECT SHA1( x'32c094944f5936a190a0877fb9178a7bf60ceae36fd530671c5b38c5dbd5e6a6c0d615c2ac8ad04b213cc589541cf6' ) = '4d0be361e410b47a9d67d8ce0bb6a8e01c53c078' as NIST_SHA1_test_vector;
-SELECT SHA1( x'e5d3180c14bf27a5409fa12b104a8fd7e9639609bfde6ee82bbf9648be2546d29688a65e2e3f3da47a45ac14343c9c02' ) = 'e5353431ffae097f675cbf498869f6fbb6e1c9f2' as NIST_SHA1_test_vector;
-SELECT SHA1( x'e7b6e4b69f724327e41e1188a37f4fe38b1dba19cbf5a7311d6e32f1038e97ab506ee05aebebc1eed09fc0e357109818b9' ) = 'b8720a7068a085c018ab18961de2765aa6cd9ac4' as NIST_SHA1_test_vector;
-SELECT SHA1( x'bc880cb83b8ac68ef2fedc2da95e7677ce2aa18b0e2d8b322701f67af7d5e7a0d96e9e33326ccb7747cfff0852b961bfd475' ) = 'b0732181568543ba85f2b6da602b4b065d9931aa' as NIST_SHA1_test_vector;
-SELECT SHA1( x'235ea9c2ba7af25400f2e98a47a291b0bccdaad63faa2475721fda5510cc7dad814bce8dabb611790a6abe56030b798b75c944' ) = '9c22674cf3222c3ba921672694aafee4ce67b96b' as NIST_SHA1_test_vector;
-SELECT SHA1( x'07e3e29fed63104b8410f323b975fd9fba53f636af8c4e68a53fb202ca35dd9ee07cb169ec5186292e44c27e5696a967f5e67709' ) = 'd128335f4cecca9066cdae08958ce656ff0b4cfc' as NIST_SHA1_test_vector;
-SELECT SHA1( x'65d2a1dd60a517eb27bfbf530cf6a5458f9d5f4730058bd9814379547f34241822bf67e6335a6d8b5ed06abf8841884c636a25733f' ) = '0b67c57ac578de88a2ae055caeaec8bb9b0085a0' as NIST_SHA1_test_vector;
-SELECT SHA1( x'dcc86b3bd461615bab739d8daafac231c0f462e819ad29f9f14058f3ab5b75941d4241ea2f17ebb8a458831b37a9b16dead4a76a9b0e' ) = 'c766f912a89d4ccda88e0cce6a713ef5f178b596' as NIST_SHA1_test_vector;
-SELECT SHA1( x'4627d54f0568dc126b62a8c35fb46a9ac5024400f2995e51635636e1afc4373dbb848eb32df23914230560b82477e9c3572647a7f2bb92' ) = '9aa3925a9dcb177b15ccff9b78e70cf344858779' as NIST_SHA1_test_vector;
-SELECT SHA1( x'ba531affd4381168ef24d8b275a84d9254c7f5cc55fded53aa8024b2c5c5c8aa7146fe1d1b83d62b70467e9a2e2cb67b3361830adbab28d7' ) = '4811fa30042fc076acf37c8e2274d025307e5943' as NIST_SHA1_test_vector;
-SELECT SHA1( x'8764dcbcf89dcf4282eb644e3d568bdccb4b13508bfa7bfe0ffc05efd1390be22109969262992d377691eb4f77f3d59ea8466a74abf57b2ef4' ) = '6743018450c9730761ee2b130df9b91c1e118150' as NIST_SHA1_test_vector;
-SELECT SHA1( x'497d9df9ddb554f3d17870b1a31986c1be277bc44feff713544217a9f579623d18b5ffae306c25a45521d2759a72c0459b58957255ab592f3be4' ) = '71ad4a19d37d92a5e6ef3694ddbeb5aa61ada645' as NIST_SHA1_test_vector;
-SELECT SHA1( x'72c3c2e065aefa8d9f7a65229e818176eef05da83f835107ba90ec2e95472e73e538f783b416c04654ba8909f26a12db6e5c4e376b7615e4a25819' ) = 'a7d9dc68dacefb7d6116186048cb355cc548e11d' as NIST_SHA1_test_vector;
-SELECT SHA1( x'7cc9894454d0055ab5069a33984e2f712bef7e3124960d33559f5f3b81906bb66fe64da13c153ca7f5cabc89667314c32c01036d12ecaf5f9a78de98' ) = '142e429f0522ba5abf5131fa81df82d355b96909' as NIST_SHA1_test_vector;
-SELECT SHA1( x'74e8404d5a453c5f4d306f2cfa338ca65501c840ddab3fb82117933483afd6913c56aaf8a0a0a6b2a342fc3d9dc7599f4a850dfa15d06c61966d74ea59' ) = 'ef72db70dcbcab991e9637976c6faf00d22caae9' as NIST_SHA1_test_vector;
-SELECT SHA1( x'46fe5ed326c8fe376fcc92dc9e2714e2240d3253b105adfbb256ff7a19bc40975c604ad7c0071c4fd78a7cb64786e1bece548fa4833c04065fe593f6fb10' ) = 'f220a7457f4588d639dc21407c942e9843f8e26b' as NIST_SHA1_test_vector;
-SELECT SHA1( x'836dfa2524d621cf07c3d2908835de859e549d35030433c796b81272fd8bc0348e8ddbc7705a5ad1fdf2155b6bc48884ac0cd376925f069a37849c089c8645' ) = 'ddd2117b6e309c233ede85f962a0c2fc215e5c69' as NIST_SHA1_test_vector;
-SELECT SHA1( x'7e3a4c325cb9c52b88387f93d01ae86d42098f5efa7f9457388b5e74b6d28b2438d42d8b64703324d4aa25ab6aad153ae30cd2b2af4d5e5c00a8a2d0220c6116' ) = 'a3054427cdb13f164a610b348702724c808a0dcc' as NIST_SHA1_test_vector;
-
-# See Bug#13174 and WL#3986 -- SHA2 implementation
-
-SELECT SHA2( x'ff', 224 ) = 'e33f9d75e6ae1369dbabf81b96b4591ae46bba30b591a6b6c62542b5' as NIST_SHA224_test_vector;
-SELECT SHA2( x'984c', 224 ) = '2fa9df9157d9e027cfbc4c6a9df32e1adc0cbe2328ec2a63c5ae934e' as NIST_SHA224_test_vector;
-SELECT SHA2( x'50efd0', 224 ) = 'b5a9820413c2bf8211fbbf5df1337043b32fa4eafaf61a0c8e9ccede' as NIST_SHA224_test_vector;
-SELECT SHA2( x'e5e09924', 224 ) = 'fd19e74690d291467ce59f077df311638f1c3a46e510d0e49a67062d' as NIST_SHA224_test_vector;
-SELECT SHA2( x'21ebecb914', 224 ) = '78f4a71c21c694499ce1c7866611b14ace70d905012c356323c7c713' as NIST_SHA224_test_vector;
-SELECT SHA2( x'76aa302bc7bb', 224 ) = '8e0f460d8c1f9d9a850a3a0b06408becc4950a77d5e8f94dc8e86fd3' as NIST_SHA224_test_vector;
-SELECT SHA2( x'510db320ebc443', 224 ) = 'df4fc9bcd967feb83146fd4d2a7448d7d54119a14cb7ffc6753de703' as NIST_SHA224_test_vector;
-SELECT SHA2( x'17040eed0880ed95', 224 ) = '5c81df5f342d1284a08d846c223f0367ca385ba60908a7fc93470317' as NIST_SHA224_test_vector;
-SELECT SHA2( x'a92d4c1b971b963f65', 224 ) = 'a45eb31a2482b4581ac321b9175a386c69eb80d43191459e2de6bd0d' as NIST_SHA224_test_vector;
-SELECT SHA2( x'49c7e96152a2b42ab57f', 224 ) = '53953c275c4fc2f87ca044760a861920fbfc1550a4c822e47457f038' as NIST_SHA224_test_vector;
-SELECT SHA2( x'becc72bd1596ed064bfbdc', 224 ) = '98ec4bf49071d1b164fdbb415c67db965b7c5f191bb1801c76ea9dc1' as NIST_SHA224_test_vector;
-SELECT SHA2( x'635afe6c43cabe340d430b69', 224 ) = 'c3a2de40958d2a35e3775eb60aab09fb3097658ac96fe2e142d28dfc' as NIST_SHA224_test_vector;
-SELECT SHA2( x'c997165324078ed6160077dfea', 224 ) = '17c6235304dd830349bfd8ce7f8f1f41e52fc53bec7bb23382d2d598' as NIST_SHA224_test_vector;
-SELECT SHA2( x'f871896748653be45dcb64a2bd1a', 224 ) = '3ff8e241b0895a06854d6f660cd7ddfc9a6b36ca73092f2f0cf54109' as NIST_SHA224_test_vector;
-SELECT SHA2( x'b0ccdd6e9ed398117e1d3cd94b89c2', 224 ) = 'f38dc0dc7f1f93e95030db63f1231df91de8aaef76a39b1c08a6490b' as NIST_SHA224_test_vector;
-SELECT SHA2( x'0b6ea2ddda429ccbb8f5de3332ac8a00', 224 ) = 'd9f4451ec9baba4c98a9c02b41442c58e1cc3eeb1bcb6d00a2b488c1' as NIST_SHA224_test_vector;
-SELECT SHA2( x'9ab41a3b8c6c886dc3a57fdfad67fc655f', 224 ) = '2b82967b0e46d8cdc7ecab68a69e177dc01f665dcecc8de824f1bc2b' as NIST_SHA224_test_vector;
-SELECT SHA2( x'785eabb7e7ca7c476cdd9b227f015d905368', 224 ) = '5617b3824c26b7a8ed43d636ce27a8f1e65b23e307e4d05422d94b56' as NIST_SHA224_test_vector;
-SELECT SHA2( x'395883570fbfdbf39659bc838fb802c5cc323d', 224 ) = '4169ffec25b0c49a22cc7912f830d443ca4d3b0377ea0d22ca17f4e4' as NIST_SHA224_test_vector;
-SELECT SHA2( x'6e5ecbbc6f36ec985c253f7e4bb6b1f8ab6c4942', 224 ) = 'db29fe2091df09f0fb0483a11e8134ecd480a3e4ca60dd12bab1543b' as NIST_SHA224_test_vector;
-SELECT SHA2( x'393d8ef3671232dc6efcb3d6426fc88f730e946b5d', 224 ) = '6d34ae1f00d1d63a39209d15acb2c2420ff0899e11c3e673cd51cd24' as NIST_SHA224_test_vector;
-SELECT SHA2( x'f222e611d99b3728b5e308f9b9b637b9d493528c2865', 224 ) = '93552ec989b20284010fb79cc7001ba7a59754f1485f3a3c1b361d70' as NIST_SHA224_test_vector;
-SELECT SHA2( x'16cd2320dd785b07b681c86ad39e56549ee4d71aa9e69e', 224 ) = 'b9920881629965613c70a9b0a65eb9cd9b08945135fd2113586ba38c' as NIST_SHA224_test_vector;
-SELECT SHA2( x'ceef92454528483f45a6992d179abff266145f2da2d10eb1', 224 ) = 'b7c5e536233ce1c24c2ef6f502246fcedb0d746cade7c849f17d32f1' as NIST_SHA224_test_vector;
-SELECT SHA2( x'c2770ed3d60c1e7aa1a794818c1fbb9ad5cc5ef7329a8802b8', 224 ) = 'ec36a23fc74263583f1ae65daa968636c15a02e7ff72b0762fb7779f' as NIST_SHA224_test_vector;
-SELECT SHA2( x'cbf96bd642247c2dd8cf7593f3d88cf61aba22c059604751e737', 224 ) = 'db2ae7e115b8b441de017133c775496efa4a0958d5a322bab780f50e' as NIST_SHA224_test_vector;
-SELECT SHA2( x'be0a3d0d539017795cc9b21a6a10cd3fdc575f9303bedb4e8464b2', 224 ) = 'c2684880b50e9e8b8adcf348b71ff4fdbde66fe0c6b6b7197f87002b' as NIST_SHA224_test_vector;
-SELECT SHA2( x'8530e9fdb69ed9bd05466ab4639e47affb7a05c2212fb38c85f9b2bc', 224 ) = 'fa6d9af7f6f5d0da8ea58a00c3c8714673e6112a6405887fd77e56e3' as NIST_SHA224_test_vector;
-SELECT SHA2( x'd564b9e358cbee4766391e8679cc41c7f1f64f3713765ea151860a40cb', 224 ) = '9b93bf21dd9b587b1e7dccf3cc5df4f193a744a1a082ebf8df65c577' as NIST_SHA224_test_vector;
-SELECT SHA2( x'12841b7f08bf555156c996ad24ff5c6df0b23c1f25721b63f08ca1954fd1', 224 ) = '98586368ba2d17eef435c6225f3337e4ba21a8657bf3a84ae75f38a3' as NIST_SHA224_test_vector;
-SELECT SHA2( x'c90824f4096dcbc0a6d70cc1937c1306f501c66c85484b133689ca0e19a474', 224 ) = '735ab14d634b95c24e353ccafd4ab40fa5718e18eeb568905e79cfee' as NIST_SHA224_test_vector;
-SELECT SHA2( x'd28f6765c7c1e5f05c9ebd6065b9020d255f9dce6d2b932504d586b64b4b7ffe', 224 ) = '2a97b7e1e67a3e22230e51bd6d44a203ca4d3406a11e16f949b0a6c8' as NIST_SHA224_test_vector;
-SELECT SHA2( x'7a4464bb000276dfc851d80f73dcd7775141e8c427c48e7f30457e99616f0247f1', 224 ) = 'cc70020d59321c4ab85d60278e94b224d4d5aaa8491ab6a4bbbb04ca' as NIST_SHA224_test_vector;
-SELECT SHA2( x'852368eb5a59e558acd85299955c47760a17ffcebf045d8b45782dd575faad861254', 224 ) = 'f6da08d8f011b7c7b6feaa0e49a864499dfa6bd1e2da81d8c195884e' as NIST_SHA224_test_vector;
-SELECT SHA2( x'c90e047cf70ea40566ebd269b0e0b2cbc63245b84a06eba13975278fcde2a312a28b74', 224 ) = 'ce4e5baa8acd7653a3a8e62f0464ca286b41935864378c7667db6afc' as NIST_SHA224_test_vector;
-SELECT SHA2( x'887fd70602e7599169d276dfd8bf44f93fae5188b52794f40f7da3ccb1542769a4618dce', 224 ) = 'be05c2526351af82cad735f69f46ed8b3202b5c170098c932a8e9d84' as NIST_SHA224_test_vector;
-SELECT SHA2( x'ec1cd5fa0dfbb142e3b222664e2dbbc209d09c00e6addeea5bfb327c3ec3c43ecddd66d1f1', 224 ) = '85956e2a952ecf3b845268708ded872e1b1366b84f87e4775e668b76' as NIST_SHA224_test_vector;
-SELECT SHA2( x'b67734b20bbaec455be457845bf058599c33bbeaf734be122fbdd011d23298826022398eaf1c', 224 ) = 'd5ed34af21626fe43634ba7df4f569d8186d43c061e63cdb038dbc36' as NIST_SHA224_test_vector;
-SELECT SHA2( x'e09e7100af3ead397f9f5812a74e19a6a7571c7fb1b8b8ac69164f13eaaf760909905620dd0852', 224 ) = '41bcff813625d927814a70e78b22597d2119174f08ef28a1d9d6e654' as NIST_SHA224_test_vector;
-SELECT SHA2( x'1d6613e39dde0059bc3bfd6da940cd9d740a2b8dc5f31907ceb775407ed5cd5df73874354317d559', 224 ) = '675468fc5f71d5e53b913350355990a19c3677b76e0daf1dbac0aa24' as NIST_SHA224_test_vector;
-SELECT SHA2( x'57271ff1795bf74ef6668da1fe8ab0ccfd5050547015eb0af8c449eaace56943b4d7bb18145990c6c5', 224 ) = '6e3d10fb8d3c815636455b08fb1a732fe6ed542ab2e8325c314b6e49' as NIST_SHA224_test_vector;
-SELECT SHA2( x'3f91d8bf80cb744fe79360f6ecd3f482b95dc8f2dece127e46b82fd76a007fafc484767c8701f0798d35', 224 ) = '34233d574c300c57f481f0568cc43f71c07d9f25c59ef49de74ad2db' as NIST_SHA224_test_vector;
-SELECT SHA2( x'2408966adf5d3fba570366393882c3d68b5140dd3749a310c75a6efa6d7d038047e90cb9e28a1a00fdaf8c', 224 ) = 'ff0c34018f6c80705cacb86180f887491cd98d4a573f33c87398bb7a' as NIST_SHA224_test_vector;
-SELECT SHA2( x'adf2e47a62db5003a2d2893c917686cb8dc41fbbc92cd02b37eaba43ac93ea6d3feedec1f20645c0947d0746', 224 ) = 'e91f826d6b7fee1cf731fd3a47d00b17edf669e1471644f0a3bf8365' as NIST_SHA224_test_vector;
-SELECT SHA2( x'a8f17ae01bd749341b1cea3f73ef22c3a84e4ac38276f497c79ed23f4ae4d4f82488910d4258e8f0206be789d3', 224 ) = '026f1a48b71cdddd0335fc736cc9f6877bd67dc31e43f87cc04efb32' as NIST_SHA224_test_vector;
-SELECT SHA2( x'eab69fea2590a847e6046aeb81e201cf1797b8636baf7d30f09893bb27a987ad276265327df62b9f37067e573cb0', 224 ) = '7b626a24d06c3f41d458edb360bef9456fda3e90d3fcc546ad2a79cd' as NIST_SHA224_test_vector;
-SELECT SHA2( x'de1c468c1f27fc265a9497eb8dba257c5dfb8ff708ec27309bb6803e65bd823aab7fbd439dbefec589e120fb4f9825', 224 ) = '02fb84e794a91206437848a4449a2389343f42cbd2877a42d270d51f' as NIST_SHA224_test_vector;
-SELECT SHA2( x'8a01037a92ff0ba48edd3707f2533723890ade105ef3256fdddd73a236471b38027226ab29bb544e03285d81bd417c27', 224 ) = '67ab2856e368a0bd0fea2042217b31c238fdb73ff8f4ed33090edeb8' as NIST_SHA224_test_vector;
-SELECT SHA2( x'c9cc53bf67d6bf14d67e2ddc8e6683ef574961ff698f61cdd11e9d9c167272e61df0844f4a7702d7e8392c53cbc9121e33', 224 ) = 'ec263fa2ddfe9c7c05c2a025271176f703d487ea6067e35372d8c75f' as NIST_SHA224_test_vector;
-SELECT SHA2( x'6380c0a6b3439be6ba13bc10db16c212d8569eeb4567a56d3c49e341538fb32bcbc18d8f0a001e354be89e4995bb5ea6e9bb', 224 ) = 'c577e8faf9233892919ac571c2248d94d47cb7451b847d6628dfa52b' as NIST_SHA224_test_vector;
-SELECT SHA2( x'85f318cdefb50f71afb880ee058ad2e0b4310223b511f3da2d1006b69df7eb75581bb7a83b3e36ba98b0822e73b9d428f13c9b', 224 ) = '41b8b1081eb8571a8dd2af57f28336a77a47d0bb4d5968ee65d96ba0' as NIST_SHA224_test_vector;
-SELECT SHA2( x'faa67b20b0b7f00960a5681df1d18eeb0265b50e19e8195cfd0f686060d6810bc1d07ba691bbe90b95585c158b7a2a55105c6e06', 224 ) = '58757f96ba28896e079fd76a578bb1b98ac3c178af2840b327a238ab' as NIST_SHA224_test_vector;
-SELECT SHA2( x'b1f83a5ea85d72c9721d166b1e9c51d6cb0dd6fe6b2ac88fc728d883c4eaadf3e475882d0fa42808941ceb746b833755bded1892a5', 224 ) = '0a53a62f28cc4db2025dd9175e571912c1a8bd0b293d235f7a0c568a' as NIST_SHA224_test_vector;
-SELECT SHA2( x'ce2b647be7bf54ea15fe79121bb04f0a04cbc49bbf89f7f70dbe40a79d6970c674895a6d9332926ed4df7445160a684b99fa652dabdd', 224 ) = '0dd413647bb39859aa84933a49af8fc9009690be7fbfb05f7f383015' as NIST_SHA224_test_vector;
-SELECT SHA2( x'80d1d261afc7a40e810609b92e3617f68a2770a77f705ec2bb562354a6ef8ac69787c25f47426c0b8603f35b2c8d1ccc53e8de4cc30773', 224 ) = '1d47aa5186c55bad63f8a13f0e4543a6ef86ce6a18faade4d4d65ef7' as NIST_SHA224_test_vector;
-SELECT SHA2( x'3b51a4dbd579846dcadae119be589a91a7dd84a727595f6b1a0709946bf1f2222bb6d041e48b946f2a809ce174052a232aac1500ff30bea1', 224 ) = 'd9c6c0f3b8102496d408388660765ba83b601ee3bffc2d3013f095d5' as NIST_SHA224_test_vector;
-SELECT SHA2( x'9c76043970f3e2e1f533f85d86b41d394d8570270afe3f500fae28e88f957e051993efb16021633d3d3f26d9f7ad4a62c15e477b842ae5dfdf', 224 ) = '94a7213f15373971b135b47986b3135df4dd45589ba91562313dd70d' as NIST_SHA224_test_vector;
-SELECT SHA2( x'738b98206d062d99a1d1d7b43f6bed03e01875006c322ffb3bc0d6577a4aa2f6d1eb11f242a7e78e55ff736c72c315008e28fd440a1a35add7d3', 224 ) = 'c40bbb13d17298721c32ed46254a0cba547c4c2086902fadf739802b' as NIST_SHA224_test_vector;
-SELECT SHA2( x'88ff5518acc6aa5484d8e68c5731a04e877c692f68924a6d4e3d6ed3ea411bddd69de71d6e0e28dde2d5ac0689baaa417851f95b547c80ee6431ee', 224 ) = '9716f750b69fbf537147d5ef468b807425127d6c1df07ab085eb3fa5' as NIST_SHA224_test_vector;
-SELECT SHA2( x'eaf46a39648bd2baf7d240eb37d812ff9b0f8a838b097f41ba7f5265b69724debe664607d3b4f1871100387640c43ac1a7fb9ccf20df376472f70dc6', 224 ) = 'd180561849855da0369998d10c0ba2775ecd3bc7392a8da1014116f3' as NIST_SHA224_test_vector;
-SELECT SHA2( x'ef15b0ac7f267e7d9f4fab40b52ee9321a877fcd72443eed39bab7329f2eaba59698c39e29a681e50f04771780dbb74b47988af619ee650c251e1868ec', 224 ) = 'e75969253ec7b8caba5bdb0b024948430a217b3076fa90d4c881a8fa' as NIST_SHA224_test_vector;
-SELECT SHA2( x'71482c3b0c0b65470314c4028b9343cd9092579a4d3623501941ec7184dccefaa294ad8aa7a26ec7b46f66fdf1571209dcad0976e10030e52a9d2db2b855', 224 ) = 'cee2546181cf14a689f5c66a6141f171a0d2fb116e880778c13ba220' as NIST_SHA224_test_vector;
-SELECT SHA2( x'de38350f3fe504643d318bd131e6fb14f24e0762eaf5995170b1c4f552e0fb49b0f180d111261e7eb0971bd2177b6944efa31ce617472145f3052c910727f2', 224 ) = '7741192f3dfc1a50166dc6e6f18f6e8580bf45f098fd0559139d8adf' as NIST_SHA224_test_vector;
-SELECT SHA2( x'81675f6f8ac523cabf94a8a43370a91d9717826e5026e6cdcd23d49217c0c797a95e2ee483d11b8c7a633fd2d21b16900e3f5fda0717cfde3cf4060e6971c282', 224 ) = '3c699b3b62e432e10a255fa7f6a6dbfc6d4b5813d6dcae32142e09fa' as NIST_SHA224_test_vector;
-SELECT SHA2( x'bd', 256 ) = '68325720aabd7c82f30f554b313d0570c95accbb7dc4b5aae11204c08ffe732b' as NIST_SHA256_test_vector;
-SELECT SHA2( x'5fd4', 256 ) = '7c4fbf484498d21b487b9d61de8914b2eadaf2698712936d47c3ada2558f6788' as NIST_SHA256_test_vector;
-SELECT SHA2( x'b0bd69', 256 ) = '4096804221093ddccfbf46831490ea63e9e99414858f8d75ff7f642c7ca61803' as NIST_SHA256_test_vector;
-SELECT SHA2( x'c98c8e55', 256 ) = '7abc22c0ae5af26ce93dbb94433a0e0b2e119d014f8e7f65bd56c61ccccd9504' as NIST_SHA256_test_vector;
-SELECT SHA2( x'81a723d966', 256 ) = '7516fb8bb11350df2bf386bc3c33bd0f52cb4c67c6e4745e0488e62c2aea2605' as NIST_SHA256_test_vector;
-SELECT SHA2( x'c97a2db566e5', 256 ) = '0eb0281b27a4604709b0513b43ad29fdcff9a7a958554abc689d7fe35af703e4' as NIST_SHA256_test_vector;
-SELECT SHA2( x'f53210aa6ed72e', 256 ) = 'dee684641421d1ba5a65c71f986a117cbb3d619a052a0b3409306c629575c00f' as NIST_SHA256_test_vector;
-SELECT SHA2( x'0df1cd526b5a4edd', 256 ) = '47f527210d6e8f940b5082fec01b7305908fa2b49ea3ae597c19a3986097153c' as NIST_SHA256_test_vector;
-SELECT SHA2( x'b80233e2c53ab32cc3', 256 ) = 'c60d239cc6da3ad31f4de0c2d58a73ccf3f9279e504fa60ad55a31dcf686f3ca' as NIST_SHA256_test_vector;
-SELECT SHA2( x'5d54ed5b52d879aeb5dd', 256 ) = 'e0164d90dbfcf173bb88044fac596ccd03b8d247c79907aaa5701767fad7b576' as NIST_SHA256_test_vector;
-SELECT SHA2( x'df866ecb67ab00515f6247', 256 ) = 'dc990ef3109a7bcf626199db9ab7801213ceb0ad2ee398963b5061e39c05c7b5' as NIST_SHA256_test_vector;
-SELECT SHA2( x'0757de9485a2eaea51126077', 256 ) = 'c1c9a4daadcc8678835872c7f1f8824376ac7b412e1fc2285069b41afd51397e' as NIST_SHA256_test_vector;
-SELECT SHA2( x'7c66f5d443c11cfb39dd0aa715', 256 ) = '6840619417b4d8ecaa7902f8eaf2e82be2638dec97cb7e8fcc377007cc176718' as NIST_SHA256_test_vector;
-SELECT SHA2( x'329624fed35639fe54957b7d47a9', 256 ) = '0f5308ff22b828e18bd65afbc427e3c1a678962832519df5f2f803f68f55e10b' as NIST_SHA256_test_vector;
-SELECT SHA2( x'c34e59652acc043873ecf6a4ab1060', 256 ) = '0fdf1604ac0d717ec9587b4de5444aaade807589d90eb326eaf6acb58a051e79' as NIST_SHA256_test_vector;
-SELECT SHA2( x'fdf4700984ee11b70af1880d0e0fefd4', 256 ) = 'b01ae16eed3b4a770f127b98469ba26fe3d8e9f59d8a2983214afe6cff0e6b6c' as NIST_SHA256_test_vector;
-SELECT SHA2( x'ea40aadbefedb0e0d78d067c6cd65c2c87', 256 ) = '36157bbe61931d58a3a644953eaf131bbc2591c673a1f20353f51ca5054fc1c2' as NIST_SHA256_test_vector;
-SELECT SHA2( x'6d1092004670efab3af483d265d8e7b3da73', 256 ) = '67fbf35d360d72b101410794ccf197106c0e784afa9c80206a550b600dbf1f16' as NIST_SHA256_test_vector;
-SELECT SHA2( x'55a10148ae7b09ac4e71df438135bc70e873eb', 256 ) = 'cbe7965513af46dfd596dc5839cb82a5c6c7328034b1dd0042a9f4b71fb14430' as NIST_SHA256_test_vector;
-SELECT SHA2( x'a03f8fcd777bd933b4b0af8c5ce3d61308565649', 256 ) = 'ddfce4e8c7b38845e2a81b7fc27a06366467a9e111316014013f9701e2413ce0' as NIST_SHA256_test_vector;
-SELECT SHA2( x'8e5d6cba8d4b206381e33ca7339bec504f3d6119ba', 256 ) = '92f678a3e59d0dd3610eec3222b8c6ebd28eead530723fbd226747534da22b6c' as NIST_SHA256_test_vector;
-SELECT SHA2( x'96db1b62eed85f2628d0c25da534401fe80d13d09beb', 256 ) = '725bab4457c789d6a4cc4736b9c2c662cda18407150844d74d6aa4efd72dbb05' as NIST_SHA256_test_vector;
-SELECT SHA2( x'1c482a45dfbcda549729126b533477edfaf7476fde498f', 256 ) = '6523f24f225b996aad1a8b317e6e0f8e97673dcff3fd62a27ff9f3888ea1302d' as NIST_SHA256_test_vector;
-SELECT SHA2( x'0f677d8e4c6d6a057492670d99adb870adf68a36ead37919', 256 ) = '44acbbc6b48bf37ee088b9c8546fc46e5a5f0d637b5e444f628de186144087fd' as NIST_SHA256_test_vector;
-SELECT SHA2( x'c09056d597816542bffe4bb33e475dfb2d6293016906ddc18c', 256 ) = 'f4baeaef70588a0820d63c2401dd84f98adf7366782d196f8698d7dfd3db1c29' as NIST_SHA256_test_vector;
-SELECT SHA2( x'72f313fdcf52d0749c9937cc2e53f50b44d65a544876bab7d2f8', 256 ) = 'cfa67aa52fd675fca985f69f9ca58af62baead8c39723bb6bfbae8a5d4bb9beb' as NIST_SHA256_test_vector;
-SELECT SHA2( x'09f6fe6cbe6744149f792a4a827e4e8909627abf75301bf7bbd7f5', 256 ) = '657633891dc6274d6aeda78e7313dfb960eac9a24d29293a057b9746a18de4ec' as NIST_SHA256_test_vector;
-SELECT SHA2( x'9e1cfeb335bc331744247df4bbd56876a7f69298aaf6b9e7a8731889', 256 ) = '930058dd21cb48b2cf90eaca55322ddf48582687838a584928440504a2fde578' as NIST_SHA256_test_vector;
-SELECT SHA2( x'b8913001efb1b7f4bd975e349c5b2cbe66045bf0d2fb019b3bc0f059a4', 256 ) = 'a0eb0b7fad1d1b6de4f9096724a621720538a9c3f2f6d11134d68cb9ee52fc88' as NIST_SHA256_test_vector;
-SELECT SHA2( x'8f08537d50928c911a68b071d65b9e8f038264d3b62c5f33de18a484cde9', 256 ) = '10aad5cd4484387373577a881974f1a550782108bc88b4e2e8085e9c3e938bbb' as NIST_SHA256_test_vector;
-SELECT SHA2( x'fd846162c4da936d004ffe0cbe844d940f1c2953157cf4765dceba2a6f4c64', 256 ) = 'c13ba769aea0e478816f2f608b5cec3fe14672ea033088a8641cfe69b4ff57cb' as NIST_SHA256_test_vector;
-SELECT SHA2( x'8cf53d90077df9a043bf8d10b470b144784411c93a4d504556834dae3ea4a5bb', 256 ) = '56059e8cb3c2978b198208bf5ca1e1ea5659b737a506324b7cec75b5ebaf057d' as NIST_SHA256_test_vector;
-SELECT SHA2( x'1bbc2b15253c126e301f9f64b97be4ce13e96337687e2e78fbfd4c8daf4a5fa1cd', 256 ) = 'd973b5dcdae4cf2599f4db4068e4aa354f22d8901adc463ca3938c465578147b' as NIST_SHA256_test_vector;
-SELECT SHA2( x'c1bdb3bfc65dfe9a393331266c58d05fb9c8b7476bb717dadc29bc43dabd91504fc9', 256 ) = '57844e1d762e6b7bb86dbfcc5c5a59578d39cc665d1ddbe4de03a61778061af1' as NIST_SHA256_test_vector;
-SELECT SHA2( x'26eb621a45bd9c9c764ccbb672b99f2a8379c7bbf4fb07eec58a8b0ea4747b72196ccf', 256 ) = '73dc27bd45daccd0f811381230cf7f2a1d3ed1202e9a770af733146b1e166315' as NIST_SHA256_test_vector;
-SELECT SHA2( x'7e3e3986109162e0c56357048bbd86ff49b93644b7fb064e7280968650978466f02c9adf', 256 ) = '682c474799f5103252c3e2efef7f747783e514b54e93b8303b0e07ee4218f78e' as NIST_SHA256_test_vector;
-SELECT SHA2( x'763c1a9ea50bd72bfc516989ddf3eff2f208f64fccea3cf0ca8dba7f3d10e237c99226510f', 256 ) = '54d6cb2b09825eab064c8952113b9897a3344737cd186a8e6be0a0b258da3e57' as NIST_SHA256_test_vector;
-SELECT SHA2( x'e1a7ffea8417e7cd49b96e355fd44f3f7a150fab6dd8343dfba3b262eaf3a6175a3c4607552b', 256 ) = '83baa80caade404c446833ecef2e595bba6dce2cb7f7422fad2972a9fe327aca' as NIST_SHA256_test_vector;
-SELECT SHA2( x'692a18effad8317a11a5cddb917f7389e1be6dba34572a300e52e056047e758bc363a0be53784c', 256 ) = '0c0c6a6b27a6d7a7a5130d70db3b8bc1bd8001d103efe72f45b082cadbd03742' as NIST_SHA256_test_vector;
-SELECT SHA2( x'73fda1e1cb7dc9a9ece858d040d7105cc126eab153fb0bb55703f4317dfff97bd980f4523aee3a09', 256 ) = '9878f8804e00828b39261843f2b3eda19a7e9b9ff4cc2e23f7ea1f62f4491ff2' as NIST_SHA256_test_vector;
-SELECT SHA2( x'2321d88c19e3e6a8309a09a5428c01991e16446823f13b2f0db4ade30e9a7c3521868fb99b440f4802', 256 ) = 'f1bd3a8a74c8f0093038499ef63794d86fc6d82602a802a435718e61e7b396cc' as NIST_SHA256_test_vector;
-SELECT SHA2( x'b9eaebda29172b052bcc1e3a9c7f2eced43c084a86f89f61e7237425137c167aac29e4cac4071afafd3f', 256 ) = 'ea43ec91285145d8f29915b227a0e35c89f90d968f9a14332dad275cfd52d619' as NIST_SHA256_test_vector;
-SELECT SHA2( x'332daf07d3a6775b18572549a6e12b8a27d81b7c4abcc5bd0b2b9ff936546b0026af131cd3ecd8a10c29ab', 256 ) = 'a573959ba6b1c3bebfd6288c806b72a65650d23bd46d123816a2a6a0e47d1e66' as NIST_SHA256_test_vector;
-SELECT SHA2( x'30ac7eace1f2e41034c25a3d3e2db979c23dfaa7a4914b0da147625b3e1f12e9fedc1c41d8ee47dde84fb332', 256 ) = 'c0c3f40d34e711bfadf517b3a78140e379fba5f7edf2c1bc3ce82469dae4d2d5' as NIST_SHA256_test_vector;
-SELECT SHA2( x'02c3964c4ad9c4af97d373099302c2cd770ad06c7d8bd11c970161d861e917a854265e223da28031ee38041534', 256 ) = 'c13c622bf08a3d3cf1fd6fa5e26e505e551b1643bc5a0f59ed29541235218f77' as NIST_SHA256_test_vector;
-SELECT SHA2( x'b9eed82edcf0c7ba69f6f6ac5722cb61daecaf30437511582117ad36ad410ebc6582511ef6e32dce5f7a30ab543c', 256 ) = '6ac64caaeda4763d28a44b363823a6b819285410fb4162af6ca657396f6028d0' as NIST_SHA256_test_vector;
-SELECT SHA2( x'b574865024828bf651df070ac0cec1849aa6470901d2e30fa01dcb43862d9827344cf900f46fa9ef6d709e5e759f84', 256 ) = '4c839e8f8f373c25a9a3351257c6152258ff8e6a88dad42f30f2bbecab56c20b' as NIST_SHA256_test_vector;
-SELECT SHA2( x'eebcf5cd6b12c90db64ff71a0e08ccd956e170a50dad769480d6b1fb3eff4934cde90f9e9b930ee637a66285c10f4e8a', 256 ) = 'c117b9dce689c399ec99008788cd5d24d8396fab7d96315c4f3fe6d56da63bb3' as NIST_SHA256_test_vector;
-SELECT SHA2( x'1b7a73770d168da45bf2e512eee45153e02f4dfe3b42e50304a3d63d7826f0469562be8fdc6569b056a7dafcd53d1f597c', 256 ) = '0b42cfc3dd3d3198f06c30e087837ec6a6dd35d08e54e886c682709f8f42457a' as NIST_SHA256_test_vector;
-SELECT SHA2( x'0072ae2f3bda67736b9c66e2130260b3a4847bc3968e037cb6835efcc2014273336725cd5a94f592aef20a0a65b459a4415b', 256 ) = '217cf25b8b343c28336b1c1e9bed29e0c96045bc93daf426e490b608b0905c90' as NIST_SHA256_test_vector;
-SELECT SHA2( x'2ac748680f3bc1bf098c4be38c7194643b0d009e51c43630404cdfaf9807aa9b299094916c9466c31fe37fa630c6d3eadc9434', 256 ) = '3ea59e2e79513679a22e962f22408306f7e8f6e562c2f1f210e279fad8eaacc6' as NIST_SHA256_test_vector;
-SELECT SHA2( x'893d1a8863d234ee50e5a8c7650a4de047230ad03d268dde8921401ff97b79dfb97cf2426b0f782b79c7e75daa2155e1f4098ea7', 256 ) = 'f7808e03e5d5af43c2bffb66e35d1ecbd79f4d8fec44f821f73a235d17c70a89' as NIST_SHA256_test_vector;
-SELECT SHA2( x'cf673b96eaf241cfa3e262dc6fe65f08bcc2be56d8a2c9710eaddae212ded6859f0ff83e5e57d0e80a968b8ed24e74defeb5bbdad6', 256 ) = '9bdb7cf0492ace4620a47660acd127f951767b0738b5504451d6ed56e4fa3cbd' as NIST_SHA256_test_vector;
-SELECT SHA2( x'0d545be1f47b966214691c21278704e89a17d52dd96aeeeacc5325a9a1ddafdecd39407a4dfa72bd32856b4c5cc2ba838618830c8399', 256 ) = 'ad53e0db7e63211c8b00947908ce29660c4376e244e19cd30a659af65dc6f1fe' as NIST_SHA256_test_vector;
-SELECT SHA2( x'9eabfcd3603337df3dcd119d6287a9bc8bb94d650ef29bcf1b32e60d425adc2a35e06577d0c7ce2456cf260efee9e8d8aeeddb3d068f37', 256 ) = '83eeed2dfeb8d2604ab5ec1ac9b5dcab8cc2222518468bc5c24c16ce72e70687' as NIST_SHA256_test_vector;
-SELECT SHA2( x'2fc7b9e8b8dcaac64ecef4c5f91877543ac36ae494d9faf84b1d347b6cf925570db84043d6f500dcc153cef81d6f2437d913f3dbffad42d9', 256 ) = '6ef7e9f12267ebc4901267da147effdcdebcd6ec5393c7f62ec4c4f06ca72649' as NIST_SHA256_test_vector;
-SELECT SHA2( x'cf95929ab732f9ef5e8c3e6b4ed753852ee74e4fddf31b56c29a6ec95d23fcde2209eb7288b787f05d9036735c32ae2f01fc650d9cce4995a5', 256 ) = '3e5854169da065407fa465a4694f3fcb1d141480a8f84c970a0f63364ec8f590' as NIST_SHA256_test_vector;
-SELECT SHA2( x'826378013988684c40f4d917c7ed8b72aba66fd68f085d0b2eb20948ef3f349dbbc71f8e0ba845014586495a48902ee44505c673d2f76d473950', 256 ) = '5b506b823ef6658939aca22f52bbe5a4b849c31b8fa1d09139352e501137bc04' as NIST_SHA256_test_vector;
-SELECT SHA2( x'0cab6d38ce9849fcbd589f7235a6d2c2cb933e26e1ca6f4e78189104452c280c069b024e162769373f409d5cd0cb8160f0239418325d23ee6ad1bd', 256 ) = '92943076cda4c46718e55df64d7580e12b8fb2c2911e87851246ccf6791fa3e6' as NIST_SHA256_test_vector;
-SELECT SHA2( x'3fb4a8c5b57c14731179256608614c95c9725ddad5fbfa99111d4fa319d3015ad830601556e8e4c6d012d7da0e2c4f60f1605f6e4c058ec0f46988a3', 256 ) = '8e90da3eb146935264576f874fcc5a64b7a90ab6c8a36c15d855b0179f52f899' as NIST_SHA256_test_vector;
-SELECT SHA2( x'9050a6d002c90f6036c592b0f6b866713e7894d29645f4a19e0858b3ebd8078711c26d2601ca104d962dc6ce6ae92634ee7f3ca6baf8810e2126097a09', 256 ) = '03c516677735ae83dbe5a7e4c22c1ac1bfedcd46e7dd785f8bfe38e148eda632' as NIST_SHA256_test_vector;
-SELECT SHA2( x'd659ec136bacfa0b5c906aabedc93c01c5f1efa3f370a1432ea8778461703f0c67c454da12bac2da73b8abb755e5eaf10bddf52f6ca908d61bee80da0c64', 256 ) = 'fff2852957a0eeb577e73fd7d827f650261dfb9a8a65f52df4bbbc9b2d0ae50e' as NIST_SHA256_test_vector;
-SELECT SHA2( x'b498555658332b197bc5cb7adc5c1997aabbdcf1f7ffcc2b6b82eb0f350019d247f8e399c3559d3bb04eb049f28b344c7989c24db83f839b59028dc82fa670', 256 ) = 'bfbbf242f79bff4ae0aafb4ccf69b24fdca4342d83db1dfd1822c74a9e218e8d' as NIST_SHA256_test_vector;
-SELECT SHA2( x'3592ecfd1eac618fd390e7a9c24b656532509367c21a0eac1212ac83c0b20cd896eb72b801c4d212c5452bbbf09317b50c5c9fb1997553d2bbc29bb42f5748ad', 256 ) = '105a60865830ac3a371d3843324d4bb5fa8ec0e02ddaa389ad8da4f10215c454' as NIST_SHA256_test_vector;
-SELECT SHA2( x'ab', 384 ) = 'fb94d5be118865f6fcbc978b825da82cff188faec2f66cb84b2537d74b4938469854b0ca89e66fa2e182834736629f3d' as NIST_SHA384_test_vector;
-SELECT SHA2( x'7c27', 384 ) = '3d80be467df86d63abb9ea1d3f9cb39cd19890e7f2c53a6200bedc5006842b35e820dc4e0ca90ca9b97ab23ef07080fc' as NIST_SHA384_test_vector;
-SELECT SHA2( x'31f5ca', 384 ) = '78d54b943421fdf7ba90a7fb9637c2073aa480454bd841d39ff72f4511fc21fb67797b652c0c823229342873d3bef955' as NIST_SHA384_test_vector;
-SELECT SHA2( x'7bdee3f8', 384 ) = '8bdafba0777ee446c3431c2d7b1fbb631089f71d2ca417abc1d230e1aba64ec2f1c187474a6f4077d372c14ad407f99a' as NIST_SHA384_test_vector;
-SELECT SHA2( x'8f05604915', 384 ) = '504e414bf1db1060f14c8c799e25b1e0c4dcf1504ebbd129998f0ae283e6de86e0d3c7e879c73ec3b1836c3ee89c2649' as NIST_SHA384_test_vector;
-SELECT SHA2( x'665da6eda214', 384 ) = '4c022f112010908848312f8b8f1072625fd5c105399d562ea1d56130619a7eac8dfc3748fd05ee37e4b690be9daa9980' as NIST_SHA384_test_vector;
-SELECT SHA2( x'333b2459200d2b', 384 ) = '5dc6eb1bf26c54f2e0409f5a31aa97c37c8e168d0226e7d2764a11aff3fb76d15e9348520386d730e1998e530c59b56c' as NIST_SHA384_test_vector;
-SELECT SHA2( x'ad46049e0230c70e', 384 ) = 'c0bc9050670743f554a639e21a5870c864ef56ca831fceb7295b4c3050c3c20876839cfb0d1bcc11c9d64304ed008517' as NIST_SHA384_test_vector;
-SELECT SHA2( x'ffa6f17b0798388a71', 384 ) = '026c58cab40b45e5909bde1af1bc1ab2669af98a9e3eff10d1ba68f5e3f2adf47038c03b3cc0e07d5353b6ed4d0027e6' as NIST_SHA384_test_vector;
-SELECT SHA2( x'7eb8d60bf02398ffa689', 384 ) = '683c413c0bb9ecf3a0da7a88c314e85d4658ea4c7ea21b48ea5adafe66746a97e9fe40d7a3b4f1c3fd4a1fab75dcf422' as NIST_SHA384_test_vector;
-SELECT SHA2( x'c0cf1a3f73dfae7c114118', 384 ) = 'be9839e9ac6ac7a06dbc494823e52b43427b649d6c00d7be2a4ee1c99e75096a82aa9546f804f4c5e2d62afe3b269b06' as NIST_SHA384_test_vector;
-SELECT SHA2( x'ad5f06ce6e1632966e4a3bcb', 384 ) = '33e29cf43f8cf3c3680710b342126a020e72398ad4be6bae86511a7771d563bf6e76867eb8890d31fea793adb2843481' as NIST_SHA384_test_vector;
-SELECT SHA2( x'cb3d16ad70bf80e5a9b1113cc7', 384 ) = '64ea8d5538a7ad26c87ac68f5e30c454d150cd3311066124dfc11fd58a56b1d42339f410a09fe7478ffad037f412f992' as NIST_SHA384_test_vector;
-SELECT SHA2( x'842562ff1d0fc2c173825395a03a', 384 ) = '638c3239fa399faa786a12eae1acda4744cd8d65b7be4532d40de84a994096e929ac6d385d84183637cadfedf2941e86' as NIST_SHA384_test_vector;
-SELECT SHA2( x'cc95dd4d94b075071b31eeecbe9421', 384 ) = 'ebefdbf6230a671d7b1e31b26fd386f792074f8a897e395c5cf327b5cf9019220e661ed1edd1eb35ca5dd8fb4ba90389' as NIST_SHA384_test_vector;
-SELECT SHA2( x'daf8002b9394138220770bf3026ba123', 384 ) = 'ada9fb71becbea38bd3378b87d8b67906298d8a57b9c371462e88fce6528d30756dce80691c484f0ed787d4165d09aa0' as NIST_SHA384_test_vector;
-SELECT SHA2( x'7464d6ecd83a91466fcb1b2c671fae075c', 384 ) = '1cfc153ff54c2eb7825a8772da16b2a39f817fe2e27ec73f7393b3999102d02b480d25b22112aed7f44207d81ead5e2e' as NIST_SHA384_test_vector;
-SELECT SHA2( x'5520843bdf4af949ae3764b5a9c57c64f513', 384 ) = '8bbf382a606b530cae88e084c944cd32e1690139698e8c92edca1d330cc6675ecdc31c49101467737b0fca2ca71e83e9' as NIST_SHA384_test_vector;
-SELECT SHA2( x'b2a41b40e3b53d1dc5e37570193f9f76bb80a8', 384 ) = '78df76c6bf5f95fdce5e015eaa37a7e0782b42185c9c989903c26fd43015dd93d949c9ef1a21c858901a60633e840ce8' as NIST_SHA384_test_vector;
-SELECT SHA2( x'aa986e747d04b932ab8266f259f1ee18e87fd7e6', 384 ) = '81f50207238b98d4eac5907d3c61a982f0cd155a15a100659ea3cdd88cd705e282227161359cfed12ed384a82cf96bc0' as NIST_SHA384_test_vector;
-SELECT SHA2( x'948b333f042cc18a82cec0177f33c3bdbf185b5803', 384 ) = '5ca83aec2a89bb12ba15cd5c28bc685998f6e62de2ea2706144aa4e073b6b97be7750d0fb86e4a32499920d721a8e59b' as NIST_SHA384_test_vector;
-SELECT SHA2( x'57271feb9fadb6ef7c9c988258889583a7e2ed86bf7a', 384 ) = '8308f23dbd930f511998ec5cc95428870abb156729a166902b268bd6992ba335d81d9881035d4ec3509fea18015a4c4e' as NIST_SHA384_test_vector;
-SELECT SHA2( x'b1e6d9be83ca63c0dfd043898cf49690b30aeff093a6a7', 384 ) = '3a94cc56c3c7cc17d54a836b2920edacb0e27a93d63cc152da25010cfab7776bfbb2505af2a0528a1f0198a6375dbcd2' as NIST_SHA384_test_vector;
-SELECT SHA2( x'c030bb7a49275a4c0a80bc24c6c1d86f4467ca2aa1e6c900', 384 ) = 'ee66585df3f2e40a86d29f15a0f6e7674bf258d0c8dbf78698401fdf0f8b94fe45de202748024d244eb2b8d6e4bb6371' as NIST_SHA384_test_vector;
-SELECT SHA2( x'aead39a90fed8eaa4bbbe3b2641ef21f8e89321e94af581e78', 384 ) = '55836ec67d5b81f77b38300b7d13db81bcac7fa6b1d8839f65806965978f4fab0db69e50b74d3d1698ab9e10131fe28d' as NIST_SHA384_test_vector;
-SELECT SHA2( x'2b9e8d1adc0c06a4961299400245d54fd2258b6cff50314455f5', 384 ) = 'b858bf457211e1e10ceff855552eb4ce5067a7664d7008df210cb63502d04f5a03250b64acbdba78f2c30f4820204bb1' as NIST_SHA384_test_vector;
-SELECT SHA2( x'8e4a0b1b68b8115aee9569c4a1f33109373b790be267a8a8d5721a', 384 ) = '8e97304e6222cc6a93fedb2d526aea034c3d706ff59c1bac6b9c88c3afd15d2328c1615e94c43262d338ec89a545b855' as NIST_SHA384_test_vector;
-SELECT SHA2( x'300d1802549eaea76f75f4ad10b123bc55ca60afbc17353b369342d1', 384 ) = 'b9c1ea27080cffb70a36b07a44cefad77917d3e7c2429cc196175b21018c99d94e1bb125cb180d45b3241dc210536abc' as NIST_SHA384_test_vector;
-SELECT SHA2( x'fd628596a69e7038d31e1cf2acba11fb20f7cf9ed72b658668e23f38cd', 384 ) = '8bbb105eb0be34dfcb9b3dae06f77a3e21cce06f701339cbc3844237383295270af51ca28dc893108de65b163a75cc20' as NIST_SHA384_test_vector;
-SELECT SHA2( x'6d8393d6679e69244db604ea71226fdb4ad3e70e223832020f6032de245f', 384 ) = '4f200337cfa5b77032a7e5e0fa6dbd35a85e4cdba9e2d61d69f3d82dbc4d64e4ff2d029dc52cd2cff90270a0a5a016e8' as NIST_SHA384_test_vector;
-SELECT SHA2( x'922110e043965d39c2c124499d47877f1e9e33a27b72365b4d4812f443620f', 384 ) = '2ec96054f9d4b87ffb2b447eff8aa44d40200a099c8f6698ae7c86889d3b2beb7ba60634525c4cd3f4635191c822811a' as NIST_SHA384_test_vector;
-SELECT SHA2( x'b8211b7aa8ae99d26e35c06ea4b226e0a6e52172a40e7f0df5f67759ae2ee026', 384 ) = '093945494108573fbff96c4ea888181f798a022ee5e89137b688a15c5ac85c4da72b8c44558e62323b4de180962aea53' as NIST_SHA384_test_vector;
-SELECT SHA2( x'6966ef05235dddff26bec1853eb36840434604a79cd4d11702bff9258664b633d6', 384 ) = '8de0abf7a039124ebaf3570db07f3e7547633a5ac56f8c86f8bdcea7296033d7e19c329c381afc050002b7a7b219234c' as NIST_SHA384_test_vector;
-SELECT SHA2( x'11e8a909b7335c7713671d545943c7e24ec07a8d453935284dcfa67aa90c40f980c7', 384 ) = '4c07b1ac241d727cb0face5e306cbf5672f560acd8e26c7d6cf52782cafb5341733f167237ec56a8e245761c99508844' as NIST_SHA384_test_vector;
-SELECT SHA2( x'508d360e41e4f2d5356d6d63d1069d21ebfb2e60a0cd2e3fa0320acecd5cb973057e37', 384 ) = '5933be6cb65ba0c9aa50377f93f5b4311961739ba8de3407284974e8a659b900289da049161036278c77dc3e4f16f232' as NIST_SHA384_test_vector;
-SELECT SHA2( x'a382f5d82a34420b8779a3980ea138f4ea7aa5fe1074ae40760305727f455f40bae5cd4e', 384 ) = '381728f154103fc0de79131de07de5b81ab8e51a9b470e0dbf860f0f7cb6d8418cc604d00895634b2becea268c6e230a' as NIST_SHA384_test_vector;
-SELECT SHA2( x'63fe4a7f46ad6ebbd8644a6750c601ed00357c5f3ff602bba68f086e7f744a167ae31a8ca2', 384 ) = '1a9bf6ca1f0f435da889c59bec482755926e80b06bd46f80bbda9bf4a30a1630db22837380522146a36e5fb954a7779e' as NIST_SHA384_test_vector;
-SELECT SHA2( x'94d972dab4e15e51e8bf91890d2ef1a155e26ea03eb48fb7c5ff51c6d64a322208278996875a', 384 ) = '4926848163c834639686244f89c64bc90ebb2c57456a2c56705a7039dc1389fe81bfc3e4d4ac526173a53a2064604a3e' as NIST_SHA384_test_vector;
-SELECT SHA2( x'0c555adb19cd55039a9e27028184e89f44a8725f28cfc457bfd2a43eaf4e89c6b69cb72ceb04ac', 384 ) = 'b00119ff6f8d405608c74185121c05f76f2268a3726bfe3ffadf7b338b1df0e0557080ae533c56a31b8959037a88d69e' as NIST_SHA384_test_vector;
-SELECT SHA2( x'567c3828db664ac1e31624b8b5c7e344f39eebcbc43a2b0e318ca2a2d0e9219fa05d539c3543fcda', 384 ) = '636a24bf0d53cb13c27441633781005baec355c2ebd231e393df934275c404150b46d39f100b245064dd2d9f4e19f453' as NIST_SHA384_test_vector;
-SELECT SHA2( x'32a59e2acdff4c2aee788ab4c7cc36fd477ade2a906dd512acdc86467b6f094ff0a3f4367d6f744acc', 384 ) = '0749c3b9c115b3e29731947878fab9c9cff2286e3f9a24d62240278514c41bef220bbde040f23db4692f915ef40cc92e' as NIST_SHA384_test_vector;
-SELECT SHA2( x'cfc3ef84e70f9247d9c123de7be8c6e9ba4c7395dfa5556f110a707a1bac877e70c43da46cca7a40dde8', 384 ) = '2b3a9ee9aa7fdaa27d23fdecdf0a7da71d2e9b8e9948c5912f5d2d02a42f22d4e29c179b1c38a1e463569cdc9c2063cb' as NIST_SHA384_test_vector;
-SELECT SHA2( x'eaa144363d47bcd68c0c950be45ce1b87043c87140256fd449af1f1cad0da3f33d5df1883c640de266802b', 384 ) = '5263e9f3e8a1bb5634050ca89916a961a0ced1a92950ec20aef411e431d16cf9f77ef414b75ad922d9308f9dfe571e75' as NIST_SHA384_test_vector;
-SELECT SHA2( x'c63da62dc71e97de646f695b5a8c58fa6fae08e5fb622529a83a460976c2189802b5b8870771603b25a94622', 384 ) = 'f63558786f3f06cc84884f14a93a9ef96b1174af8e15296380f7057320bf21e2b5c0684b00a00d895267c3e1404142ff' as NIST_SHA384_test_vector;
-SELECT SHA2( x'5225b6563257ef806fb0eea5df034cc319db7a5b295f1075887861e64b3653ce9a706e6464ab32f6513dae2bf8', 384 ) = '5be5579e0bc2404523392f95cac2e3e9e59d398b11143e481594edc57cd04247355bee2fa80d0ef2e5dfc0f6f45c4fb4' as NIST_SHA384_test_vector;
-SELECT SHA2( x'c0b22bc12ecee79ea76f1907a8f435f657b7bb375c92ae11f2a248283e4aeca2df7b5c89c6332c704844775a7157', 384 ) = '1ea1bffd5aee1377de1af01d7c895ef5ebe1c1d72b532b43d5e264c158637414ad1416f21e9a32b194415d6e3e982906' as NIST_SHA384_test_vector;
-SELECT SHA2( x'0dd0f1807170ea493604c82293732648a106786e1a1df10d6021a4fcc1b9e940f9410225f878fe8ee678de8965ecf7', 384 ) = '2482561cd0e3468a5d8c75c3a1261cb36257536cb165c0f29f817d80833b6a002eee5dc778a953124d79d4d4835b12c4' as NIST_SHA384_test_vector;
-SELECT SHA2( x'78334108ce6261ddee5d98045bb307a6e8f3d0ee65c1d9bc7d28cd9edf3264fc9cb6e592d072e9238559616cd42eda58', 384 ) = '87feb45250c1e5b4cf701f86fb24d6a49b2c0d2de92db884e2fcdf5e323c0539c78e5a99fdaf56896eed27b897095741' as NIST_SHA384_test_vector;
-SELECT SHA2( x'e9d96ef05a41486b10ea2e5a9c7059e227ac4d4b61db664cbbfdb488d67c09583b0e4fcb4cdc1feb7be49042b99c4d9d31', 384 ) = 'c0d72a3a4cbee53ce48df9574b65dd0791b15b03202f7c13ada8cde3a4e8c220d9f3d00a3e37b31f44cf6fb5c7134e18' as NIST_SHA384_test_vector;
-SELECT SHA2( x'90413184900f9c0de1a1983e1eb348bd2c2654aa7b3e4474880d2df2a72f90afffb87f85d66b016d0f2db895f0b9c1b32994', 384 ) = '5c06fbe39a401c80f0463a485d6a32250218db63fb8ad77d1cfce824849d0a61b4acd5a36fa14b22a62beb758b780e6a' as NIST_SHA384_test_vector;
-SELECT SHA2( x'630fb204cedd5efd2a3c272e318e3b1b3277f8bb12d90b139203d90acf251e780f07d380bafb5620a711c5069989aaa50a8ede', 384 ) = '73e862668fab744ef2768a9bd2fc382532b99c03c4cdbd88eea4a224c56c187d48f8f9985b73d283ce03d71d49dd1c41' as NIST_SHA384_test_vector;
-SELECT SHA2( x'0f372d71e1c9941d7872956309db44db57108d8be1e0106859862f1a5989640052e0d874c55a3250b53dadb05c2d6efa1d50141c', 384 ) = '13712a36f85a7ff0b98838d674b058bafd11c8a3a9c5ce505bbab1eef6bd640644f94e47a73fd7cfda5a1ff30d830b2c' as NIST_SHA384_test_vector;
-SELECT SHA2( x'50dd69e3080e0d8a9713202b68c4e87fa2b57bdb940a39a8568c9a13adfc2a0530a7d156a93a583ebed8290cd16a561a2436dd0041', 384 ) = 'd22632b3ed8e83b528e40beb2ae4e01bdcff0e62cd0d48a35f92cd2d286ce5d72a597e0ff2cafbe9ea7eaef32ce5343d' as NIST_SHA384_test_vector;
-SELECT SHA2( x'ef4501c9eaca54649b6e7dea45005ec7716d7c787b37a79e5122de5178316db650d058d49853fca3349ff4662e273a3bfc1b8ef101db', 384 ) = 'a7574f6b0f1872483ee52be517172dd2193e67cf5b3994947dcbc2866274868c70391dadd8d81de7573ba658e2615871' as NIST_SHA384_test_vector;
-SELECT SHA2( x'9fa31c5626eee059714e363391284189666594b7ab694f6732498b637138f9a73e43c5bbd73fc13f25ffbfc742ca3eea380b4a960c4b9d', 384 ) = '055c9415e4a5c921eb9721cb32a5c0b47fb57b1af4884332557946717942615ca6251694381537f2a7edc490dfaa82f9' as NIST_SHA384_test_vector;
-SELECT SHA2( x'e2b76d556ee3b9475a1c54e18ebb0854c7971f543d1a25c9839bf0c7aee7dec0b9215ef828cdb23aec27f3ca87b9559a702cacc0b95f2f28', 384 ) = '6cae189d9765f9a56c825f5e24f5f5c9f60d80f57a35f788ea548e7755844e2592db2c7244a26d7c37ba9a3e5f744a3d' as NIST_SHA384_test_vector;
-SELECT SHA2( x'd189c6cfa4c14712cfae7fae68d66907595151886e88888bac3d5c79e5cc473289b067afbf482ee6b4db5bed33db29637766c60c3d1206bb1d', 384 ) = 'fc72b66aaead15676fea59cbbc20d39c929c8590a50a0a05d146c41fd92272da3a56f58f6cc93149fd65e91b3f1655a2' as NIST_SHA384_test_vector;
-SELECT SHA2( x'31981d12960c16661b3f7c7952871a7b00a975677da7557d5ed980f3523fc9e84a164999dda9edd7ea6a31b97f412a8ef924ca156de860f14757', 384 ) = 'a470316104c9828cd96f2b76886a37d01ae5c5a0e537097c4e397dda1c49c59a78d33f4c4d5dd634b7956920760eb0bf' as NIST_SHA384_test_vector;
-SELECT SHA2( x'44eb420655c5cb6e54645bb6d41dc4f8d5ffafcaeb61e06d9cbebb4709c30793d1a5f35832b85697713e3bc97c7c9d89cf146f8d948ee0da0e38dc', 384 ) = 'b0b028aca4364c92427c4d8edaa5f6dbe2b30e626433d20ce27e5bb74b17dc59f3e9e23e08ce9d49882cc26118e8fae1' as NIST_SHA384_test_vector;
-SELECT SHA2( x'0871e0c4f2885572f7847cec0629592df48515d2c3225be3248001f13ac2eb61a1a82c07afbd6ff7fad296971aaaa0f9b0f7d068a7850b41b9b68305', 384 ) = '503fb0ecc8b6bfbeff397b9fc02598651ebec429acd50e3add6a9752f576e24c5d933573ebcc23cdf06f807000370825' as NIST_SHA384_test_vector;
-SELECT SHA2( x'32a5984a4510ac51a9b876ef1eaed25e82a9adab45a817721dd99ae9fbbaca1f3d7e1e8625b2feb08a201d56cdf4099e0f1d019da1f6061bbc26349773', 384 ) = '0ba492631a4261465c137033eb1492ff8cdb0e06f8494e2c52fcf029b157f2127e0f4f75b5d3a10209ba70bd7eddec9d' as NIST_SHA384_test_vector;
-SELECT SHA2( x'3d62c78e081a996ea4ce2124d6816a62112b9c7eea5c142ecc23ba90ed2e8f6d803286be2d8e956fbe2b0b641ba624ba78b1db4fcdb6ff8486be89417c92', 384 ) = 'e6b6eb5d03c7caaca9f7a62c6cb48c0c5662686c975325d7b94878a43b64fc38a884b2c3635ba7f74df36402c974a7c8' as NIST_SHA384_test_vector;
-SELECT SHA2( x'78817bc3f6285eca108e54b14091d1ebb9ecb1b7555dcc5acf07cbab32153ad591a0de59f9d24852a44caafd6fc6ea788ef5f5ca7fb256243c580767b56e86', 384 ) = 'a0ed388522b9bf2737b10071c9e22c9d6db99bb3808ea3248959d075062d845b872d2eeabfa4e123b4f738a685a3c41d' as NIST_SHA384_test_vector;
-SELECT SHA2( x'58beabf979ab35abba29376d5dc227abb3d2ff4d90304982fc1079bc2b2880fcb0129e4fedf27898ce586a91b7681e0dba385e800e7926c0bc5afe0d9ca98650', 384 ) = 'a0888e1c4d7e80cbaaafa8bb1ca1ca912a932175c2ef982ce1f123a8c1aee9635ad75be52590a924bed3f5ec36c35690' as NIST_SHA384_test_vector;
-SELECT SHA2( x'd03e8048b7c387b43067b039e5b9a0f353d94824862dc485235683daac63a9c90044b1ec218157253a2cb532e114ac81993b85459b8ad8c9d6c4ad0434b9e26f1f', 384 ) = '370629f3dc8c8d4b79c3fe8f9033de2a4bd42874f7b3ffedb4b38d73e7959896c45572f08f2974c86e7a51a6117d1dbc' as NIST_SHA384_test_vector;
-SELECT SHA2( x'296a9a5b9a0d101f186d9fa6288c912202547cdf958569d2cbf235740eed38d10b0025dbb6de31058e98780d22149c19d4bcaf06dd7353fd91cd1f47e47f45622e14', 384 ) = '66d6336d30e32ca8ae874fd4869dc3ae94edd97484c385bc93a6384353ed358cebea55bfbda954ac16972596ea51384c' as NIST_SHA384_test_vector;
-SELECT SHA2( x'fe4d2ae2bd5484c7782648130e33f1e478a2deacaca1572ac1f9cb9953e55b2729249da8154d998c1c63180ed7a91faf19b7b6e3d3ceed0a346921a114147cba9281bb', 384 ) = '1df79be52e4a50b6fd14cae825139a39c30829081342b9c4de4fae59df8a0ff20c8a9fe3c498c9ff567a89a32b2e7210' as NIST_SHA384_test_vector;
-SELECT SHA2( x'6ff84418235fc6ab5d12c1bc6591c66a689e9f21b59e2b1d2c416929f265d2ad6a38ece7619d1c7989d2bb24294f6dd312f1aedbd557ae81338d5fbdd5e7cc3d3e30acad', 384 ) = '75df8657107143d13f309094728c3edc8e92dd36a504e0c0f5c9e8ce64bcc40af18630a1913e9f2214e6638c2bd68552' as NIST_SHA384_test_vector;
-SELECT SHA2( x'22817ea8761a32516e99c2c00a4d4e6290b46f3d819bcb31cb87e77e40543d87471c8fd6d25a7a5f904f4e0963a51d6a145312d246c0048ca82b4b606f4ad35c04316fd5f9', 384 ) = '51c1275486c73022fe476005a436a0f8623683d568a7e804d81329726fb30a64778b559cb2152a8a7d7889b67c77b1ce' as NIST_SHA384_test_vector;
-SELECT SHA2( x'd4070bd6e39c3da7751a714915e73e85b73ccb7857379044dc2c6105423da807f82af236876aadd5757a2f736975fb1b8fe540cc3ed8a328d9373e70f354e9b0b6c2b8378569', 384 ) = '87510a9917a6b12fadb3da68908606fab3c76b8e94e250eeae2817dfd4365991b1b517bcda578875fbfddcfdf1b7b142' as NIST_SHA384_test_vector;
-SELECT SHA2( x'f61034de4f9b0c2d203170cf0d344bd869fba4fca977bb5218175558ccea5438d8048a49c322cfd93991512a014b2cba2f643bc79ba42d139176dbe5ca00d8509b944ab76d47f9', 384 ) = '4c0e7b2409850cb0d22b8944d44876f097a40ee7a5e3cc4a7a20269516d1a3ae5b0b52b5af33d7a7cc5c839966c712ea' as NIST_SHA384_test_vector;
-SELECT SHA2( x'39b82498bfb4c821096255f6555e0638d06d9a7a4f62a8c83f4233e8dfa67edfad6121b81d635d8091ddad9586a69d210bdedfe178d19c2b5c1d082fb718397d6a6c39c7eb045ae8', 384 ) = '4dddda1188954064b4d134d8be7acc52207945894f97402cb0e8b2519c2b2ca449ca96a4ab4bdf078b0ef2fc9814a74d' as NIST_SHA384_test_vector;
-SELECT SHA2( x'2477a617791efe62db70e5592e0f815edc0dacaacb0c92928ca37b08d504e56431dcd665f67b70727735c6267c08ee0cef7f58a7d8d55db68c5e1bb5202381a724cca6138ec45f4df5', 384 ) = 'bee03bed3eaceb6d7ddfbfd5bac017fe346928f5a128b2fc0bba965d80cdcdac653af7dd433feaa6fbbe4c415d24ff3c' as NIST_SHA384_test_vector;
-SELECT SHA2( x'12812e2b54e6b89b199fbe3b695bbedaea02953969f5aa6cb6976983b50cf36ab241130ef52c75c1965512e09395efb3201d07943ebb85548f5937da69c7400d29ba0df5ca148a1cb665', 384 ) = '19227eb974a9f7079479e27ebd95aed4cdfed11ee12395cb5ac3ed04e384b6bbc174800ed6455c5a354f669b0ee90b62' as NIST_SHA384_test_vector;
-SELECT SHA2( x'e4776aff9f9176054f80f5edac658c95b0aa114a039fa08ab765ec0e350cd40877f837a9788908e6e9fba57c268a643168da6f5d3c97d3aa3458d318dcca8244ef0a91e9cb5265a723d86c', 384 ) = '37d1224bcc443bfc2d1770098da71b98fdf3256210c1eb4b489d3766de535f7aac9431a6cf37cb87dc5cebb5adf220fa' as NIST_SHA384_test_vector;
-SELECT SHA2( x'060e912736074954f440871c4b64d92e452ba79bb9dcad7f6510aee43cb867e30161c30c15b74d098e48ea7d888bc832c02192745f5ae6b813fb0882643fd885461b010beac67497da7915c9', 384 ) = '9f54ebcdfcf95e7acb00e6e99a8409c10eaf9cf9967266f8524f9467925b9525af07940227d2d947f9642eaab289bbc7' as NIST_SHA384_test_vector;
-SELECT SHA2( x'647ccd775229a0b7b1f4c4f81e58dc2963432954edc0a06981d3403d2aa4a2d276e0d2d9e15d5d7592fdab4245d48f96898d1d072b09bc2df24a7ca98c90a965c9c1a01e070ee120eed466515d', 384 ) = '938e9d2cb62164167b2d8ba8300ffcf007e0fdcc80f236ce113c304ae4bc589fcae301bff4e72a7f5179f397fe012915' as NIST_SHA384_test_vector;
-SELECT SHA2( x'717a756d3b651897c7dd97a926431d3277ca5d29aa2f7a3989a4245cf80d05ab7b6e5b75faa4e68ec15404e9cb221b69402337f53c94f4cbd2cc9f16516f98c2c5e5fa8fc10a7e645c279de77a22', 384 ) = '9ecf76b5e05ac4704389b2ef4f7205ace4d152ced735cdb451801eb709702b264aa02aa5efa9cb7c37b526ecd238a319' as NIST_SHA384_test_vector;
-SELECT SHA2( x'95530985e73134f6fef027c8c61f4b9308afd67de19ce70173d0d2efda44b8b461685cdcf6c531d5dce0b8f6a06208bf4e77ae63e474b88307bc0d3df5e40065bb152412a8b2615d013b4765f672a3', 384 ) = '5f181e9003766e88b6118b2d9bc8cf9425e34a6881a91fd87c5bba87121e6954b8599d6dbed8f2e7a74f2ea0755909ee' as NIST_SHA384_test_vector;
-SELECT SHA2( x'a707cfaea184546db789b53ac256c2f23563a767b1a11abed303d916513d546b45cca6b9c836ca64c3930cd7024cbd6b8a232b8b2d73d1175bb9ca053b548c4efa89d20864cadacfb138d16aa1668cac', 384 ) = '4a62f6f793b9f8c5e89498c5d45e52c50a3a004dd1c9213d9d1d0cb40f5fb0610cbe5eb261752764ff3fc35a32fd9aaa' as NIST_SHA384_test_vector;
-SELECT SHA2( x'9241ecb23c7fc0cd69bdfb825614de606332f0256a5ef0df4fb60d51d8bb5a98bf107c0f067fa56f8b3dc73bdc6f015b4cec5e064745bee6e2031477b62fd2b1ef18a2e6a05057ed5af82380fc3d0ae3cc', 384 ) = '9c3bdd4f0b8edd507740d4bc873e35d0963e4cafd27188cc0d63341d25dbf09912ef03903230b1f5c2d0a1c1b9e4b1c9' as NIST_SHA384_test_vector;
-SELECT SHA2( x'89f96eb0353730367f030d1e91b09debf27ab965570feb3ebd4e24f5b44eadfbfea2601558db1801984f665cf81986c3b2619139cddef3c83698206b12f3832c53e9b78a8997fa1dfbfbdf7df7fc435f66aa', 384 ) = 'a7ca6ca52bfa61a490b7de070ff6279ea87d816ad8754a6e529946141954aebcd9c1b1ca1d9fd39137f062c6a2eb7ddd' as NIST_SHA384_test_vector;
-SELECT SHA2( x'cd42b8496d6c5f23b06b440d6a17f03991e02140eeb51d1e1824477ea3c2f03995cd6f19191074e27807999344443ae9d7118725fc57d70febbe403b7b16648b93f68df5e1a2fd86cf327fa7b3f142a04604e7', 384 ) = 'f9910144685987e9500f006d3360d1c270bbe1a90fe658e2a1cf87f4aa32d9e41097cd964964b78589db448fc4de3900' as NIST_SHA384_test_vector;
-SELECT SHA2( x'105f9d121228137fa8138ca3c84d503d89a1d087874a2db18905fa8f616a438f147bceed3b7ea02aa908c3ba4e5b47fd5bf18770a759ae2552427970a8d63ee448492d7d85b1d61f0c18eb3fc7cf47e0020630c2', 384 ) = '8a98f8c9d86edaf0c6dc59be207cfc8ab18dc0b384d2fd9f4a358f42890a919de839eff5388327dc7b175f89e9168c55' as NIST_SHA384_test_vector;
-SELECT SHA2( x'd7448b7ffb746ec0bdd88106a725b84b59cccd317c21d446f8bc1687671f1c23c99a0a81796c2f83602bd90d68666ec13388b80d0eff8168209e60d8e740d2b8e6af8cb897c41025a7cf7f6b6238aed86d677ba2b3', 384 ) = 'fcfbdf092f428b59a1c51c55d0c09d68863c0d2b76368d80f106e0d24b25c4caae1f8a18de689ad0bf6327ff118295c1' as NIST_SHA384_test_vector;
-SELECT SHA2( x'd44bb6b3ebe582bec0c602118f430ac362547eb2ede95d78b681fe9a79f89a03caa00bb1fc94d3af4249604314668f68d4d66e7eb21b4641cde5d9f89ae3e8ee8ad9f826e7f3564bff5959e68503e7d434cf3af6b5d0', 384 ) = '4a6de936a59f5b85d03caece8be0eb1940a20afd38fcff9e83d3ca57d9da95344878528b42d4ce4931e8426a893124cd' as NIST_SHA384_test_vector;
-SELECT SHA2( x'9082f0080bd1030f74595b75376a5b1f7b1ffd2fa3d9751e1beb110a51976451013aa35eb6c34fc38e6914883d9ef2c3543e9a69c40d1b649d60bde61c1a2dfce5dadb668d73a1a65b9da55750ea80c064fba0a913f3ea', 384 ) = 'a3336329854e6dcac625ab1f10cce649687e431009071c9d4fe91bd9da82badc84aeb107ce4d226adb32adc39b66412b' as NIST_SHA384_test_vector;
-SELECT SHA2( x'14d5039c17beb28e8200a3d4a4febe87c23891c90d6fe903d00ba471eeb9c1e18c58b9b70b16123539d631f9c8d670c7ff8e7089afdbb194695c5f2dee1c6f4ce772eba0d6268ad24dd5840e5e97a4c052de9f9b9da2a4e0', 384 ) = '3af733d34b8905c0a06d8cb459e092546cc3e5b90b3e635bb090d871609932b2a219b577181edfbffa67ac7738450c84' as NIST_SHA384_test_vector;
-SELECT SHA2( x'95c025f86b7d76b086a8c592b2e9eca1397b0717bc837c5762a0392335c33d0fc8415a351d26392bc7cd9e324cadedb0cd76eee1e95dcdc9deb3656df1bdbd4211c0d3e6b75b990e10193ec05e47aec29c035c5260963f1706', 384 ) = '1ef611d4aa2ee16894eb7e17905f3d66bff8596811f20ef5906d71f9bd0ee3040269efa8ca4273ca43387241c624144d' as NIST_SHA384_test_vector;
-SELECT SHA2( x'984beb16e04ba209ff4dc567d53edda1de37eac9b8f805a5df924402bc63de4ade478f59870d3e8d6a28de1cb3a792ab4868141c4e8857a7f01d6b2c5b28a2c70dc5f1a650a5981701be05e59641f6e560cddfcc0ce28b437098', 384 ) = '47898d856fb815e3d208df5670acfec6c436eab9b0b1ec63f298a2b81e8d5d326562fbb284f3f7bc70024b5269e2ec2b' as NIST_SHA384_test_vector;
-SELECT SHA2( x'964c2903d33e9c10b8a7573f4ebdc7178decba00cd7971067d65f6da1794b019532e34d19c465e42c0b9a1e1eb599ba3d64bec773cae49148e7dccf6e7b78ea342bd7833ebfb560f33ca2df96895cf4d043bac8625b5eb033df9ba', 384 ) = 'b7ed21b6f2e1370febc83bc27479757bee06c4065f143d6dd93553448950361815c7ee09e961a98ed21100934a13bc23' as NIST_SHA384_test_vector;
-SELECT SHA2( x'00633ae4c920f41f16796c713bfd43ff92323a9b7b865350a088333a7e58cb9b215c372c2e35e6b127f2fcd0eb83f4237c708a8c05cbd8c91c63bf48443a883cb639cbf06123905b2fc8b5f68a7b90ca1fc5d4cde15bb96e514e576f', 384 ) = 'f0a86c75dab5034adf835bf62498226b9d4c5d0bf5237b371654058a024e06630c63c7d8ef8d0879e4767e9821d47599' as NIST_SHA384_test_vector;
-SELECT SHA2( x'6ad118436ce2e22a2b8b7118c8bc081ca9925ddb6f7a37d528983beac66a031cd1a87196586f43ee2d9fe7a7528290faaeae89d5042cca2526d9c951660d92064e7b1a3a9158d06b40c0762841552fd3fe29d9a55ade9cf2e90bc3af60', 384 ) = 'b4460710cf4d9147e9f73e26d97f039533a98ab4cd66399451318bf09a912ccf5267b39a0c8d4c2eeca1e9370a998dcb' as NIST_SHA384_test_vector;
-SELECT SHA2( x'330ecd4f7820328eb2d1442c9ff555c1c705cbac5f7223056e3936d32eb8bb7fb5bf0e89d4eb307a402f0e1aefb406e2c5e3a7b470c0b8ca91797ced1c3e35e70154e73a0c655e12091b72792ded8acab1385f68c09103af935a212bdb93', 384 ) = 'd8d0edefc5881544f7e72431b41b1b2fcfc198a47ae1b89d43bf118200b8529c60eab34963855283291386aadb0e67e9' as NIST_SHA384_test_vector;
-SELECT SHA2( x'32d5e868b0b48239a6d74799ae8046f4d98faa564f9b80233541c108d4bc8c31f7b6b3bc945e796eafbb9aa57c408c8ec4a0059889e4bd29edba758f50103839b9e1e127774fdd9f08f332223971c09e8f4fc7e5e607aa5e585af3fa60e896', 384 ) = '01817497f65899ff7dbd32c4a1c34fb0f6d1c9dc426cdaf6bc42d14c68a6e610aac9fcc47c02076162f1510777a416a5' as NIST_SHA384_test_vector;
-SELECT SHA2( x'57b51d10a4d2fb17ef0f204aa53cf112e1130c21d411cdf16a84176d2ae451ee5f66ae6875cfb2e6a586f233d5ee1bdab9f235513fe229722a7d812afc4f70751a3d128a2b5ef452c10cd71f3b3bb19bea0af5ff729814857319441f69298069', 384 ) = 'cb84599cf288ffa81aa50e0d1c4dfe30777e1b79d82fa05b45707a2e7dd747cd81b1af269206579cc183119f25997263' as NIST_SHA384_test_vector;
-SELECT SHA2( x'ca536a7bf66c8b1e451edc371699dc1afb79cfd06ea20f19bf6fa3ad510d12c7062179e4f8b1dcc86a41bac3fe3ce43228968f48e2b0a70fa17c66a988e126dcdc6173ceb9f9650c03482cd19ef4ed86e24acd8549244b226b10d2ec2dae8e3035', 384 ) = '8a740cb9d4a5432fa53d497ee3620b675b770ab29cb9c51a5a55eef75c7421b4e0dc2399f1e6bbe54690a88f8afc356b' as NIST_SHA384_test_vector;
-SELECT SHA2( x'bc57c2803382d1deb56a146767ac80c89183382e01990bb5aa1d3d2391168ad6eaf768fb7d738d014f92b14d7f0595306eb7441622a49800edee0134492d82320707fceba902af2e0c95fe634a85727bde6f022709a09248752db9a71941c7e75cb1', 384 ) = '33a9b367f842da5f8852a0c4c94594db7283f491ddc8b1cfcaf24681abebb912bd44abb46c18035ef2e4b6e009939228' as NIST_SHA384_test_vector;
-SELECT SHA2( x'cd23cfb189f7797d05244e2abb0db5d26d3ca0f0b8a5bec5ec2ff1fb1b70028970b894d6c252562169067d2051e272e74d3bc70cadee700912eb30e181f55107b7a3987bbcab7836bb5f86c811782d40a413a34c76f91ba17a233d9da67ed32b49ebc5', 384 ) = '2880eccd4926d1ccb4a364d0d2782af372dd22d2b99d3d66849aa04748687ae8e43898e01690bec09725642042442a1f' as NIST_SHA384_test_vector;
-SELECT SHA2( x'b85559ebc62b0b6fa87e6a8aef273808037cc5036a7e59b54753d68a21f69a79e62da39530bbf6dfc6d7415f66debf73c2455c66c8d11a44260ab3ed0eed806936e1997b24ec3e79a827755aaa6ff511255e431a74791b52cdab110b0bf37860b05983c6', 384 ) = '452ac0db3a324b2e6e566c7455e08b898ac5d87b401bef9cd5f8fcba22679a63ba70762127d44ad4c54d621dda18ca4e' as NIST_SHA384_test_vector;
-SELECT SHA2( x'2fa9d04bfab983c02abc09c3a30c22a4c0b086c6ae2f700b12a65d8df219118fd207dcb31d411b6dc7fc01b7312498064df3027d02c30561d220c7ceba22d5a859f96ad355caefa7fbbabe9e25482b5061dfc5a24fabd93a4bad38364c0a3a1d0ca903156a', 384 ) = 'be7f7895d6e7642f417141319ee4d2921ff385ac2821eb66f8fa4309de24d0986dee9040ec25a80f18738a7a48260374' as NIST_SHA384_test_vector;
-SELECT SHA2( x'beeb5575701b32d3b182bd37bb0692d7b9b2dd43cdae7bf5576f5c29752b2cefc690327e74b578cb71512c5a002b465478d16bdb448d119a2f95e5a0df82696e9e03e24e61d371e702e8800fd1ee5fe04bf32f0e296400779d3836fcd86b3190cfae2d8e3f5d', 384 ) = '4b4dc610f079c44075d6b171efc637ae14777331bfe9cb8fbc2f7c0123b37fb978ed15adab3ddcf821cd5457fb996217' as NIST_SHA384_test_vector;
-SELECT SHA2( x'e4a7bb1d0a354ced4b9fc7983c37002b06900ef50d920a3bcfcd132d0e0e95193130cbdfe83583a50f9622cbd5d6e7211d5d745824848ab764ed140fb91567f1c32cc81e8b242e3f69084ad7258fc5755cf1c92e25f9c24af55b663ec049f3db6141b7c43c29d6', 384 ) = 'c21e70712390ea83b033043f31e866b2c466d5371568104b00d788e6f1e66aab07a214484531e4d6293e7d38ce09539e' as NIST_SHA384_test_vector;
-SELECT SHA2( x'2dbf241980678ef9c529d4bdf273c2d44dc5e36bdd5a96331e0c6464f9729102f24bf15fa41ffde16a232605605e6aa48a0a2475523d28d438c80fc1c55fd02cc0fb9170a57dbc1d539454fa05e08a4a83588b4f9ae99d0dc95f6a503d899bf00098a9546dc9f035', 384 ) = '266afecf77e96fb08c2daa5f64c0da97c7791e0ae23bb22e7427226c717bcdcd5aeced0d942d5d10990a4ab37a6c6cbe' as NIST_SHA384_test_vector;
-SELECT SHA2( x'8bade35ccd57d6f8e2a3960cecf685c3787daf4b0f6efe360791ad219f00fe944c2b302a4d1eabf285077f148af20cb8fad802230ed88d2371c4c9ae52df7cc6b8e5049f154c8e041fca89f7db175b98faf45248696cdd0d245afc384b2bf54677e549054e68e6f855', 384 ) = 'b56d9b3094271468e18c7a59187c5eb1c29d3bf681c72941b13c30505ebddee94c004552cd766f69d734e2d82e644ab0' as NIST_SHA384_test_vector;
-SELECT SHA2( x'd5d4c78a18de6c9070dba887c956e407ec435936f69e228f084e96e2414fd69ce910a249ef1a715796f3c01d6b42aa1c7a33b984c11dfcfae5635998249825358be6f2e769b0a8c70376d8f489f94cdb49a0e3b5231b9c503d46f013f850653d221c606d6de73a671f2c', 384 ) = '2c8050c6f7b38754ca49ea444852d09a41d785a05844755ad6d7b731016b96a9fac81394af2bf24a4ba174d5b5f5cb13' as NIST_SHA384_test_vector;
-SELECT SHA2( x'2beec0efa2362159f8b84c089a0320ad88ded8e8f48d3cad0b4f18ec132bee71b6ece8099d6b10e6410cc344fe8b634d6af94d3ae4010bbc7070ca9ac2f50e9b9824a4a64dc1d928ab3ce9b60278baf476d0cab59d5c66634a701ea2a36675307a9edd0fdac2e2e7df4fa5', 384 ) = '833547cc4b44fa04763f5780be550528bc895ea70484fd53115993753236b514794a702b80bf50936b57093c5c0ffc28' as NIST_SHA384_test_vector;
-SELECT SHA2( x'31dad5b0ae329c30ef6c36cc1d1fadf533638b9faae39df25533f7438a64384282d60f75024efee53b485e17f08fa43dd60ae2ae40d99194fba18de4772361942814c5082c2865cd2e71e4898ae72132b248b97fd022cd9cad2d0522d1dfd446ec3bfe5174ea5850908ccf0c', 384 ) = 'df5bf69680ba0d6cbbb7fb564f13e41725c0de4bd7ec79dd01ffc138d1e9806360004fd836276b8abfa73f740dcacead' as NIST_SHA384_test_vector;
-SELECT SHA2( x'452faeebb6bf93bff2216f6788f66e2f2585cc300a5eec18bd3ca42eff30db90fffc57bfcdbdd05e11ce4937fde8a07f808e635bbda8e5a3bb6e91e55e877fad96724503d6261036c8f5f3d83fb67e0a6d2393fa568075a9847e22f2fc5ee3c8725921bfb9407acd7d60145234', 384 ) = '4c60377833fc16e4462001dd21a12ac0f0dd4f7f711f22595af6421f5f5f58d51e22a3b480bad1408f00868e9181eb4e' as NIST_SHA384_test_vector;
-SELECT SHA2( x'6a253181a99b76fd9206fe4e25fc55def54d5a217339a16e6fe1150ddcfce291d4cb9267dc4f75b068b9474ca2220d37677c401992c92d187e8b9cf1c67bb0474f7d0e3b89d4413cf1925e20db53e3746e2be511f0dd6bf0444e1540b03901b5e423ee223892a24a367a8af458f8', 384 ) = 'd1181abb0c8d93a166551accff380396e5ac90144416766108907e9dec4c514219bdc7fb3db6ae68eff12bd4d5765894' as NIST_SHA384_test_vector;
-SELECT SHA2( x'fc25ba418cf60566488551d34fc1e48246119bb0063739e1917aff244b047d986789a72f9f292bb228980205e57c45addb16438fe525d0faa807e0e8ca2254815f8213e1a4c35d1bf0325c7ee72ffc17f1d6fd76ebde47b51cc07db76a1cd4aecd5926e0058d42aa889c87c5bfa3b1', 384 ) = 'a4d8781fc35d998a62237b4344f8e1c26feecfba971adc0d7e09e887340cbe745778f714638571a813df1da0222e4011' as NIST_SHA384_test_vector;
-SELECT SHA2( x'0f44a8a890cd290806ec8fd8d502fcbed910c4cfa8e1d25c1886480f020366374548ad610d63442855f39a4eaae04d0b32494ba4eebe37403cb00ef8a0250a2dc3b0c61ebca1a4b98f796cb2f3a135d3595b899329f8c4e94f4cbd62f65fa87293653b0726f01064bd654b2d39ac7cbe', 384 ) = '0040f15059fb0fb7ad066670f88f23fb2c640459ca4682547e1d910187012c5c2dcb0c0113b049b73499cb596b0ecedd' as NIST_SHA384_test_vector;
-SELECT SHA2( x'7330de53e9fa3b47273102ec8b4c22841ebc8e421a6ae65ca9605362f0c6b3ce4c11f6dcdb77c79c3fa66f459eb5f7cced5b8db56f5f2a2a784f714a7775d9c333070ea3559e956b27e9af659ba381388fc271ba4ff2d3055c41c5cd6c1c57f1b17af04f5e57eddd68648af689fd06f18b', 384 ) = '95f2071081e32a72f1070ca99b9aeec8ee3a2ed9e5fa2d1cf5f16aa2bc98f5e0f9b5a6008cd2ce75e080d1b385df0782' as NIST_SHA384_test_vector;
-SELECT SHA2( x'95322db3ee47d16157f4508f0d52f3b1c31b1afaf2b12e7d7162d69245ea6e7bba39b547b377c5f73e4649e06b47ea505fdf0a74a43bb579c391d4f215a9a47ad69d679a7bdd5aed4575e68117931a81854359112d7e507a4a632b8786c4092f10e4ad73ef7f768a960b913cb83e6d8c5dd0', 384 ) = '21289bb824ff515e45c237d1c79891377f04c40107e71e1db95a9b83b088eaea76e7a4f3019bed4a759f236b2371b76e' as NIST_SHA384_test_vector;
-SELECT SHA2( x'845b92a5775471ed2fb6eae84e70bfa0c28184a8e0bb5403b7c6c2419e6912eb1005aa21ba62c382d1ae644ca9c391c484a9c0d9a85c8c04b4cfad7233302865726ec3d88ff9bc62d3c9ba5c41a104466f95f16795caa0b4e47de8f319469220519ec6101fa0c454dc0cd5603e9180ed2c4c00', 384 ) = 'a43a1e67855b8d2864e8c8b9eea2875f5ce21f33eb2ee9048e90a9665471653330df8f8b5209194125d8e12239c2d56a' as NIST_SHA384_test_vector;
-SELECT SHA2( x'6a34a6d3f5032aaf62f4eedfa3038eda5d0efe173fdc7b2e935dc13a12337f81fd72085769a44b3fdb110554143d35e72eb1d16ae8feb78c3f00e6a63e60ee56165ca56971cb1cff045bd1e9631e26561a4512aff92b17bfaf9574179b389bb1de7be5d3b57f8536065cbb6838ae4a6f48512baf', 384 ) = '0026006d0a5b8f44291f4a8ff8628d8dc428544eabde63c6be478fdbacb6215a4f35bc4e1dc66dacd1020d3012bb01e9' as NIST_SHA384_test_vector;
-SELECT SHA2( x'ba362b818e274a898553d9eb777e934416e3df2f238ea5c6e2076166cb3076b38270c4dc09117c2135e733925e3336195bc61ebaad6aa41afb7db63ebfdfca963e0f723abd903073f2928c7db9ce658b08b2850c25be782d162e9d9f5ad97d9ad6595c22126c0e89a59a0c35ee18c7a305ed3cacf1', 384 ) = '13229cc315e40b044dc9953a5c460b627113d5241885c37f26801c3aec167a3986ab60cdb4a41668c514d9df51a18405' as NIST_SHA384_test_vector;
-SELECT SHA2( x'17a761e66e007e550ab117c35550fc0fc34d6bccaa7986e855c4038b544b26421592ec5db90d8a9620e615f346fa83edd325d2d1edbf876751665ad2a2fe30b700f749a1ddcebba40cd71f411b398a8ae33abf865dbda2d7b808f09aa8cb2e8f005edf7a834bfac9f70c9b767c16f92f1c1698b5a37a', 384 ) = '60044682f7c4736dac3652052ab1eb5d48a24fa94e43b2a5ce55db1c9e569012a392ee690d5e17384631aba65e7533a1' as NIST_SHA384_test_vector;
-SELECT SHA2( x'8ae7073088b58154a7f6257657ea7e0615a7a0d834c60c7ade5cd4c5562c00b27f1a2f6fa2e382b26c0cb54e36188f048afe7d9be2da7a32b2e331d6a99d66503450924045b8cd7052fef162a0e7fd2bc14cb7845cca961f2cbade374b630d6bb16f76ccf79c2c3561b421db1cbf8f24c47797bd2afc29', 384 ) = 'bda24dcb1a3f7f52addd1baa0677918927656d7b458c11034f2166b2f8d72db2d1101e589541087ed9c72191260f8318' as NIST_SHA384_test_vector;
-SELECT SHA2( x'7b0f2d2f4522e57a4d9237d8778644360fead8815db49c0b796c8d3161ebac3b4963f783329f99dabe8c5e2743f969511e9b295f4a5489de31b46783c1c14812c3f34a7e68835a5225e6a64fc1945557ad0d768a931e37ae316058d46803df3890c90c6a0f558fab2aa6f99a1bdf71106349a848619a0f43', 384 ) = '5341d46e6d469718f54e0ad44e5e8cbfb091d9a156eaa1d7695764e6fd70770933f86090701b0404c0a2c9944a49c7f5' as NIST_SHA384_test_vector;
-SELECT SHA2( x'b98c44b9f1339dfd730270012ebcc5bc0c317aa777b4e5cb1cceb91eee342e0f6ef75c602afbe83484aae369b5e9ef27124ba4b98d85329c7e2347d6a479338966db4ac85f1189a91a057d9c1abf61fb1e9387e2a399f940a95e5f2ebad9238029a1d49a985dc886bc7b06436525625fb870eac8bfd781df25', 384 ) = '9bec1d2fd1e4ef91dc70589e4c50c06673b134720f1e0faa14a94c65fc6c3ff6c1934768b832da6d6342800b46c3a558' as NIST_SHA384_test_vector;
-SELECT SHA2( x'48e12a838c285b198e16f759d75ef1361c35b9316eb710d8b1861c8d4fb4b7892ee30d21dfaa6647183b40536443a1041912abc18afc71257fff09bbe2a6e306bb2c58c55fe58674e3da5c16d7b3f13231db1a1c88de3b7583165df590868168d90634f774a164a9d93b722a9a7688ca4ed72dc8ce2517d1a512', 384 ) = 'b6efc213b9396389f4ce18e2cfd22733dca2be8c611ee5b94a9a7be1e8f9c78d7736b49520d8ba9ee09ce16ab76fbba0' as NIST_SHA384_test_vector;
-SELECT SHA2( x'a34dbe4c6f53b1a60cba0260124ba5b3a72395bb4664bccdbf2a130a7fc10a3412152ac1e669f92e524c1e96d6c9c583a5df45046031000025fd8bc9c85210f4607ef06906c6acb6d95b05a94689621d863073146778140650c174797fd976d29672576b56d392e5aacd00c0e7f1442852006612e3a3be88485c14', 384 ) = '723f8ef0f28a234f8dda9f687ab51b2874b91a69ac7a20b107064e7b7c87c849f3ea39471e11ba43499d458e9044d4c4' as NIST_SHA384_test_vector;
-SELECT SHA2( x'd800e0a7cdd96a08ecf6e65dd4ca095605237cc6970932a62ce9fa5d23f3503f0ec079536638cf597eb3590bb65e9ea4f1e1bb9f493eb4c101fc0859ba8688c7eace683b8b3597bf10af4c789d22e2287710e5f8ba766d754af4aad80b2dc18a5571d6e7a29a6a438a33e82af2e07aec80f92159527905caef170a61', 384 ) = '0e1c22ae4d049d23cd7b332359a246e199d4d9b417aae5695874d5cd9ed61d76d2cde81cdb2beac9c4f1d53e00fa0c7d' as NIST_SHA384_test_vector;
-SELECT SHA2( x'cc8470e78492e4ed8598fd5f35ae83b4c49a37781bf066930f7ebdcedbe65f93cd8d35f43fb485f0c9e5c7f1b591b498b3f79fbdce4708b29f086fc8c1b7661585b1ea74e653f3ccbf5f4a963ba19b998dd3cbf8e2bf8b6f94a32edaa1d9b7f75bb7376c61b5560ccdcd2f56af28613ebbf662313e9e17535717a20b63', 384 ) = '3ff1a9007cb18a7e8be1e151ed4ec424bc1c813ab05a092d655d48e69a3cdcf395d204bf3979b0499b1cb18bf80bf8ce' as NIST_SHA384_test_vector;
-SELECT SHA2( x'30b06afaba1d3f66f8213d8f52cf3bc3727f3ebeb0739271ceba1a02e655e413a0990047a8d4930260332771d2e345cbe87746d6df8a66acf9a51abf7263a41bb6d2e4ebd11d713f2768e80c65fc8474b7a4ef483c5658ccb716c6ba8718ac89d925bdee1c3f01a4b5882969f460204947cee21eae2191586fd7c6fa0bbd', 384 ) = 'e399f9c298dffebc1ef90faca476ad2c478879705b9d988f66f320c7c8459fc6f42ac53197fddf3b1654157e3874e8ed' as NIST_SHA384_test_vector;
-SELECT SHA2( x'9551164bd1bcb607023b4572bd5c2e19e7bf9b4a28c08dd69d562c15cd3b5c2bdf4e908a0a35e3b84c4665535fa8b252e9b5ca8df3a31c809c64e44b0ecab7feb2ef5c14a0d4de3d5a48df61b90c2fe127349e200fd00e4292cccc337c1520eb76fd22f17de1d01e92095ea4b3cfcd4f0b04bf0a668f8aa4e7578bd4fd64bd', 384 ) = '4c41ea97b719f84239b3a19f96cd19e39daed16913d1d8767eaba572e29b0cc24bb864a4725d1f55440a5df7c35ee686' as NIST_SHA384_test_vector;
-SELECT SHA2( x'e06e21e2449ad75182808668167ca41150711fd4a8c64ffb51ae29f411adb5f84f58c2ea6e5cd88259c16eaa5f705d2842f3957e8a7d0e0e1f2a028217875a6bcd556628338ad00a6999d3b68ef3a8cad6ce41c3dc253a1e3a000dbd58f5858d81ef75663c2ea932d98f1d524a0e6d3d34898d6a46c7ba71cab8b06d79fe1ea4', 384 ) = 'fa707a7639a6ec82ff72db0490409ef3e8cef1cece79f11600cecd1f7ac71c13b09975f1e2a768840dab12863bc69b1c' as NIST_SHA384_test_vector;
-SELECT SHA2( x'8f', 512 ) = 'e4cd2d19931b5aad9c920f45f56f6ce34e3d38c6d319a6e11d0588ab8b838576d6ce6d68eea7c830de66e2bd96458bfa7aafbcbec981d4ed040498c3dd95f22a' as NIST_SHA512_test_vector;
-SELECT SHA2( x'e724', 512 ) = '7dbb520221a70287b23dbcf62bfc1b73136d858e86266732a7fffa875ecaa2c1b8f673b5c065d360c563a7b9539349f5f59bef8c0c593f9587e3cd50bb26a231' as NIST_SHA512_test_vector;
-SELECT SHA2( x'de4c90', 512 ) = '33ce98281045a5c4c9df0363d8196f1d7dfcd5ee46ac89776fd8a4344c12f123a66788af5bd41ceff1941aa5637654b4064c88c14e00465ab79a2fc6c97e1014' as NIST_SHA512_test_vector;
-SELECT SHA2( x'a801e94b', 512 ) = 'dadb1b5a27f9fece8d86adb2a51879beb1787ff28f4e8ce162cad7fee0f942efcabbf738bc6f797fc7cc79a3a75048cd4c82ca0757a324695bfb19a557e56e2f' as NIST_SHA512_test_vector;
-SELECT SHA2( x'94390d3502', 512 ) = 'b6175c4c4cccf69e0ce5f0312010886ea6b34d43673f942ae42483f9cbb7da817de4e11b5d58e25a3d9bd721a22cdffe1c40411cc45df1911fa5506129b69297' as NIST_SHA512_test_vector;
-SELECT SHA2( x'49297dd63e5f', 512 ) = '1fcc1e6f6870859d11649f5e5336a9cd16329c029baf04d5a6edf257889a2e9522b497dd656bb402da461307c4ee382e2e89380c8e6e6e7697f1e439f650fa94' as NIST_SHA512_test_vector;
-SELECT SHA2( x'c197f08557e421', 512 ) = 'ce69dec20db2e702f51c6232ab79f0890d6f82aaed54d8d0b15d8b02095957b4442a23b8d164be7b1f3669c7981b58ff6cd853149a625771bd666b19d8f0c35d' as NIST_SHA512_test_vector;
-SELECT SHA2( x'a90596a7112d3b9f', 512 ) = '7c42d9b5f5a215db32cfbff9e0e57716e2e4b1a7f87a7bc8121229c6d1fe5989df3dbf20fc71281dcbeb55743bfeab9346e7feeeb07e3cabfb2aaf6cfbc02bfa' as NIST_SHA512_test_vector;
-SELECT SHA2( x'3ae1953415660623c0', 512 ) = 'ac2501818c6d49f5f20534fbaf751f4d6f7288252298ea5a7011f2736200cd9721ff64ad6e672b08bcb2f463a251e9533c3f77465f4db3dd69be1d8b2c52937a' as NIST_SHA512_test_vector;
-SELECT SHA2( x'2bfc3a1b9cdf3485939b', 512 ) = '59dff49557ca098bdbb60cf9934f038890df27431b81369d0fdf92d22ccbbd3a90bc5d060ab2e974af784872e4567d4e2c42bb6375fd9a4ed3a434fc9f23a918' as NIST_SHA512_test_vector;
-SELECT SHA2( x'50f3b7d106cd77e9eec0d6', 512 ) = '814a68eca10f8861b7ac73d9d10a83d1d2f546dfe4c989b49fe9f17cc27d2897245b02f4bbbed4fda8d230534f0caaf2556126d69095e9bc8a4bf5eda4c351f8' as NIST_SHA512_test_vector;
-SELECT SHA2( x'3f08c108cce3eaa5f3bfa6bb', 512 ) = '8b7acaf0d36f877ece73f9318b20828fd79d2a3f28c71069b61ba88d455e4928e9744029bc7f12b417700fd195ee49ef337877bca76251123dd72365f10e36ae' as NIST_SHA512_test_vector;
-SELECT SHA2( x'1e1c81a3f9b48383e68487560f', 512 ) = 'e46861bf4c6b85af4366d6917b19f51efe66eaff16c7865a28d267125f8849244fa04b0b07f07274de2ca150a0549edb3628b87d4a5f73791de0930a702f604d' as NIST_SHA512_test_vector;
-SELECT SHA2( x'b48ada2484dcd78e6617c724b537', 512 ) = 'a1886c390fdd1503a6659f615403d0df814a50bc27854836ea40c90a04680a092733ea4deb7edf2d8cb6a35cef40f20d7b0f9fb0e42305087cbd813aabf599a6' as NIST_SHA512_test_vector;
-SELECT SHA2( x'bbd0a4de4250249c873f5b289159a7', 512 ) = '90953e45ef6c1fe975805ee62ab6431834c0934a81205d7e089068c157c9e2ddced188d869659457788f472f777273c76cb97a00807c83a769e651e11fb59f0d' as NIST_SHA512_test_vector;
-SELECT SHA2( x'cae35cda11064e34b54647556c105523', 512 ) = '72ee08a00931be0bf39f68575c256a1c5661a1b0ed3599c684be4d1f4412094178294773dd23a6adb8f6daebed0683f5750a59602a7244a667d5d8f74cca5b18' as NIST_SHA512_test_vector;
-SELECT SHA2( x'625656f0bf2e3f1dc2c9c4d310c650e016', 512 ) = '47eb9110c93ff62130fa987478cc72b403e019aee6a1c20d20a7d5122bc1ad9d97dbdc40346aa9c624054f76ac7fcefb72975ed946a4c1af04f82f5c137439d2' as NIST_SHA512_test_vector;
-SELECT SHA2( x'c7b15d4f0ace943eba8c3af2f51913285149', 512 ) = 'b0ce8a67c15c98176b787459fe2f1bb5fb01d505930805c0cd9f363f24f5b8dc4a16bd4c9c8ba354f726ca60cccc28bc540819ae1bbe50f6b6acfeeb86f03e88' as NIST_SHA512_test_vector;
-SELECT SHA2( x'62149e4dcc5b79f473d115629f2da21d8c4ad9', 512 ) = '15c77f321a179485aea271dfd0c1be284ecac543fc96a478a0ba93fb640ee708a6367c7123d35cd39be323c9beacb42c63046d7ca8f9bc749f800dde0e4d0dcf' as NIST_SHA512_test_vector;
-SELECT SHA2( x'5b9d847b7ef0965dd053a4d2da3b1e1637e71095', 512 ) = '9681299a52f5949e08b35563d6d35e9f72169f84ba76b9c01be6fbc81dee6000134e691a9b9bd7bc8940de1fc7e173261683b5c8ef7b0fc5bc014714971b0146' as NIST_SHA512_test_vector;
-SELECT SHA2( x'1b1045583ca3e8a0116521b9bcbd4dd7b613c34b1d', 512 ) = '888e6d7fea0c37b40ec32852879131cb0068c580e4280e80b74d204f9c90ea3e943fd27cf2b7ba3111340f8be68b5af89a4b5086de075de25697b9272e0c7278' as NIST_SHA512_test_vector;
-SELECT SHA2( x'938d2d59a18fdf52c343b632301344d6a5d9c70a07f4', 512 ) = '42d70b8a3bedcc1b23f7466f34aac87241c807a87283686cc15cdffed68a257dce74bfa708cc684f1c93142cbeab751070e9852d368a378495e6ad9f8d27e873' as NIST_SHA512_test_vector;
-SELECT SHA2( x'77d59ae1bbd09376bcc9f5ac46ee834bc979e07ca5e2f4', 512 ) = '9c229867a7f26055471f0174fa141f8a5e6ea6a11fc9efdc6cebac2f243467804cdc2e617be5a99e32e10a00550995f728c72c4fb25cb2b17164058ab4f7f3f6' as NIST_SHA512_test_vector;
-SELECT SHA2( x'370995549d249c7eab97a577c09920c3df6c545fa885f4ff', 512 ) = 'bb607aa94d04f3a81b6b48fdae601e15ba8d43805f5a0b096b843ae6a2b25ba58b8b4f78257b8110cac1e61d27c01a2c6e3738cad3a01150cbbc332b8ad42dd6' as NIST_SHA512_test_vector;
-SELECT SHA2( x'8a639dcf06aad53bc991d177c3d7a1661c96431876790f9d72', 512 ) = '5613c1ef219d4de9a3dd4081bb121671060616b3ec8b5cda50361c3d03a362e2c8559bd8cf421834109684adcac9bcfaf6d47e02ed3a39cd7bc2f52d0c81b329' as NIST_SHA512_test_vector;
-SELECT SHA2( x'9f311495c97643482637b51790bd1e3086571f05c4a173ae1605', 512 ) = 'ddc9b2687ab1d99038032deec57fed9f19e69fc2c550d9074099490d1e72751fd95cba099f5dc9c303a3b3e22b949ba8a04d26de046e14339333cc31e78f4f7e' as NIST_SHA512_test_vector;
-SELECT SHA2( x'69b522dae987f8b48864744dd571b39efa0051229011dc80b81989', 512 ) = 'd2f7740090d249237cd1acdbefc584b79aaccfc0e90e19a9f822f9e041e519928e5755a8ce91b4ca67c1355134e22a33fd5cad20d35f3fc58415fc12c6602acd' as NIST_SHA512_test_vector;
-SELECT SHA2( x'c9260d92c68ff1c5cae8f7c3e98869b66f13aa8b6cf1d5ff70ffa1fd', 512 ) = 'dcc1967130f155cfe1422048b8a7b559ce90b5182528310f9fdf93dee9b72029bda0b5a9c474c48c38ccd63915fa60197a87043fd9c399117dbc4c47a4ae5389' as NIST_SHA512_test_vector;
-SELECT SHA2( x'baf280aa618c46d1b4713d42a324e34fc13a8fc33e7703261534443c86', 512 ) = '40f3057c2e02fcff3915744d2a87a7cbed4d1ace0a62658694a5c0ada892dcf25202a5821f37f4842c4d631fb0b5795f3d252e6ab914556801ec99c4002c0510' as NIST_SHA512_test_vector;
-SELECT SHA2( x'9f91b4d09ebfef181f76596bb060085b3323185cd786460f47d6bac72188', 512 ) = 'eda1dda078e4245c51e837c2a8360b1440acfe2d58f7f32ea9a63dc2105e80ec5e162a23d8041cac382de7464c166e7162c620bbcc11d14d8e9b3cc88692b5f3' as NIST_SHA512_test_vector;
-SELECT SHA2( x'376549419a41ecf6e1776679cc9b87a4ddf70a9daf8880fd894a8a3233b64b', 512 ) = 'a971341f79a1081653952b717c7e18e2e2289a4551cec34eb15944f28abfffc7b23e6121ea52efdd4f5c615414d2a59df02392c4740d8f678a773f1e6cce2fe2' as NIST_SHA512_test_vector;
-SELECT SHA2( x'5f264a9fce6c0416c3c399c6a2912a5f33125616a24a5b3cca3e7e16b263aee9', 512 ) = 'dadd0e04ad21dee2937facaf3671e0e026b0d947b377bab623ad45e94872ee8767c2983a10f53f92072eabf9fe3b41b12211e442763274a24f553c658bdabeaa' as NIST_SHA512_test_vector;
-SELECT SHA2( x'6989bf1032bcbf82c96f7a140042dc9ba9cafb5d439be5c6daa69b5d28c65df600', 512 ) = '0044e76560daeedebf0b72b9be8a1437f5a9937e1f6ec8efa0bae0a490808e9d0d4babd3683b4414baf0e033c36b7748635ef9e745cd1dbab547af8e287d9644' as NIST_SHA512_test_vector;
-SELECT SHA2( x'4edbb49bbf3acb02ce83c5cc7f83d2c386e873ada14976712b67277cefb3c5633a10', 512 ) = 'fbe69d13bbb3b9aeb8fb67cea126302adf2984ed02168a13519dca66e56eb0b189587b3b6ca9f14efd8e0a434db7b0caf337d62b4cc0752ccb942f3ca29b4596' as NIST_SHA512_test_vector;
-SELECT SHA2( x'f0b1231cf60536f768e62f79dae86374660bde91a2e2fa94cff531e2536530406ace2c', 512 ) = '9bf2258b1ce68fa5982c296fec10c8343fdf5f995e82ea985b93f5437ab48e6615c7b7e9847c3c545ab909d5e54a6c3ea0166bb0bdfe838278dfd9834f5d25b0' as NIST_SHA512_test_vector;
-SELECT SHA2( x'785db29d4a665e802b68a406cd21dc776ea84e4daaf5a1df93a4973c03f6f75a3119ca70', 512 ) = '6e659b4a07e3aaaea4b49c211a2720f5db8fc81d9749c0a8c0ffce189de896cd3dcc1a1b6381e3d82230715840d4c6ada741d64bf76234ce98b28b2afc96ad74' as NIST_SHA512_test_vector;
-SELECT SHA2( x'8efcd15f3ff1156dcd64ad17bb1566c466429842f2cbb40a84941dc6b12b391037abc77deb', 512 ) = 'bfd174600f799e4a9aea0739fe5b4deb43baa809ee46ac27f59ab5e44d10f9a69c81eed24cfb1b4c6e6fd1c51925fa0b380e5d0cc9f36262d6e0c0cc1abd6331' as NIST_SHA512_test_vector;
-SELECT SHA2( x'807eb33d10722e025b01739f82d7494d242cdf137f510df5d888db691d19470acaa2439009af', 512 ) = 'c2c8abde43c0c73fa9392e7b262d453a3c0ee4aca293dc866defe6e07c0d717319eb3fe6a33775ca5949b20617df03152339af03bf89634d9865f7f1eff633d1' as NIST_SHA512_test_vector;
-SELECT SHA2( x'282cd5ebe30187854c5fdd6b1ab4e49143addc3dc0f12561900e6328ffb3dacf28211ab6b9dce1', 512 ) = 'de42e2933c0fd240d4025dfea77fa4763b55620230668acbfd2e6a6426c2d6446de71976009e77f7b3e17bac91259902f7dfe4f8142f7e65008b6ee2207268d9' as NIST_SHA512_test_vector;
-SELECT SHA2( x'4fb6eb7cec250c1763280b41b215f89791137212a67c758afc867478b223a800f025a72f1fa63881', 512 ) = '99ece2524110af64cf89eaed97b520343a97c859e3873860c2077b06e33337f0886af348bbdba1b41c0366d8a09db1ce2fb726d5d282525fcd1cc45aaf0e75dd' as NIST_SHA512_test_vector;
-SELECT SHA2( x'dbc0d771769987ed9c9a72a44a5728f929653d3d12c9efc7d1b109472962085719727b535e37b06b39', 512 ) = '1aac04e1cc461ca665bf12a578f8f32a6ebb7725686b5a6f461a5a035dad6d7565831caad2364f063ad73edcb210bb2fd04c2539c6eda849ec79baa934d7af94' as NIST_SHA512_test_vector;
-SELECT SHA2( x'b8c17a3fd266ed0374f61c19840f3db5f819271c9029acabc5252a1bfd2a5d03002a779eafda73cff4cb', 512 ) = '4800cbfbe54fbcd8c012180ccd82bbcc783b3413cdec87bd236786ebcb40eb3ad23f509eec53b23c2655959a0a2c53e81b5f3177e6c57883c0e09b48a09050b7' as NIST_SHA512_test_vector;
-SELECT SHA2( x'7ac3e7ae32d0677b28165d829a6b966b5fe032eb25f40299fe0735fd1b1134ead693ca0ef6ce88c82f3468', 512 ) = 'ebc398731a33113646c7c4dfc01fb0aa35214a2de32cbfa99f300b2feb1dbdce203fcea6625b7c2a7205ff1b08096b29b58581a2ea7326163a4f52cdbccd2b44' as NIST_SHA512_test_vector;
-SELECT SHA2( x'4c2645d588b606782a6f45c3725d69d31a251115e6494cad7ca80c197644d811b648c2b2f94a99dcafcd5fd9', 512 ) = '80d1d9053acc378f88f37cb828d3140a16f10810b3a515af301dcc1c7f030d752599a5f437bcde5ecf288afac9e1fb6c9a5e365c82afdf900a0eed6517d4be38' as NIST_SHA512_test_vector;
-SELECT SHA2( x'85ae73d64a09ac922396f80bd94d868a2359e3361bbe0fdbef3fd6e9d97f5dc05166fc2a81c64b29f93f80f4a4', 512 ) = '6a2ff2ef58640bc69dfbff046c6d8fb4a59a85dec77bf06346def8026dfa954e07992ffc364ccfe179e2949826b65db58dc53a05f61c5d6a279193203de9a2f9' as NIST_SHA512_test_vector;
-SELECT SHA2( x'b63a627c6923e0998c8c789f56dac741fe7c567cdb7bd4ccca52a39fd001970a005dfabb9faad32f876b6725c979', 512 ) = 'fe69011bfeb12b7987a1251b225575448d22fb46ca08e909574b96a1611433e0109619cb4c1489e101283d7d2c2dc163cac3ce2416cb06dc27820818f482b3aa' as NIST_SHA512_test_vector;
-SELECT SHA2( x'0261fbf7d72dfa185d1fd999c17e588ae37d6a646505e7ef03b581622228f9ccab7693b419fdc7fcd161390cb2d1eb', 512 ) = '29f146b6ca892586f198f2ba3f58c67d17199e34c19ac32e284047181d57e6bf4c176eb6ee084171ff2a96bd4bc312014351326ea3387e78e78687ee3127426a' as NIST_SHA512_test_vector;
-SELECT SHA2( x'7486acd86f8813a2583ce981d1cc8602864594b611ea132b1bce9f1cc4a2f6e545cbb539d4b86217c972affafe74fd51', 512 ) = '65cf4354a97b963597884f00701b8d4399e9b80612c3410bb223ef4523dd9ee19ab348e8a849128377a6c75622ef06e844b2b758c4aefa5d28c46d6e4dc7cba9' as NIST_SHA512_test_vector;
-SELECT SHA2( x'c33fe419b91191e51dc9fb32d40b43701e63d81d11e3918a460df9e1d2f3ea67779c5dff1caa80f07b3a09e71a0cca407c', 512 ) = 'ed5c3016c805319872023a70d900cc8a301738149ea83dc130a6ca19fc5348b2f4d7fc3b456d0cda749a72da116e6491dda0855ea7aa9b5bab9b7ce5efa423e0' as NIST_SHA512_test_vector;
-SELECT SHA2( x'bd50e2fe1f8f39f96e2044def04afd4c16c01bb1ed7694bab5b2610ece66813bdcbd40f023f4b96e336b9a39cafc2713f68b', 512 ) = '729c1246e155e8b36e92a6fafcdff556df95e7c131c65df68e710b5f04f6552914ee5aa2faa33e8c5827e1781c5af5320f158cebe481d7d0ac54be07c865ba39' as NIST_SHA512_test_vector;
-SELECT SHA2( x'5178db5a599b0664da75988433807d0a44a73d6e754220e3f948952e54c0d4b91a79c3e3fafb169bfcbdbb2d0799755ba67cc7', 512 ) = 'b3723d26e481feba3e3dbae2e36d9b29dd8636d34570d7ea3d6bbf8ce7a254ba2677107fad2decee62d8f27728d9cc433cee34e42b2c4f473153f697145684f5' as NIST_SHA512_test_vector;
-SELECT SHA2( x'e42a2a5e142f98e06ec42f5c78684269c4719c3317a4c5b8c90381386fe69ae6b84ddfe495756d6e9da92d56af5b9eb0d973d5ce', 512 ) = '5f51ff37bb70ceab5c1f5feb33f4f6ddcb7545d22249cff63bbe1a57be8e0ddd7d86131306b599fd8bd5a044daf9bcbb2a8c80eef2079bbd377e0b4acdd408d6' as NIST_SHA512_test_vector;
-SELECT SHA2( x'550495b8bf8bf10bca9a70cf0599a6cd61c1bd22da2e2def5935c753d9f7f896c9364ca7b26831c91a0afe89a83733f38979020511', 512 ) = '4cf0a13f66ac155088a8da8a344b1c4c62ef13ef0237966134345abb11dd0c456f25710ab13148510a6fd615e1863970e8277f45733b95fdf627a4321a48c595' as NIST_SHA512_test_vector;
-SELECT SHA2( x'b6cc4def48738118c35fe4bab82fa61ae8efb930fcf428aa7606aa34e8c577f763455a5f33fc0722c9deb07ef9c6d3c26618560f3aa4', 512 ) = 'e04a1c30b76920518af66f5db87d7642fc1ef2b903e45a8215bf1a5b6de6772427d9b576329c28b3262ff0c1802dc0e6c7b2ac21a0df26a867abf509619c8403' as NIST_SHA512_test_vector;
-SELECT SHA2( x'143c7d79790a56697dc803ec93e6c68f27f6761ce9b374bf6843e167e2b90e6f5ade347eec3166ac5e2cc3e6f7c9f0939445c677f82447', 512 ) = 'c9e076e1ea43672b08036e87afb175e32013da88408c92e5895165fe31a1c02d09c6246fe17e9e1696614e28b53ac0a6c50ade5f10949730b98d110c92cbd9b6' as NIST_SHA512_test_vector;
-SELECT SHA2( x'bb9e6086c137d0c68e6ba728f8c516a65b3ffe303d58b1593266fd51fe2e6713fab2b4dfb94aaeebeaf6245680f3335d118cc4d17c3356c8', 512 ) = '1c0294a68024d098e7fdc14490a34dd579f47a6abd96acddca73a450dc608a840cf308a873376b6917e17c237df0ab76a736105734623e72024b41504e0ebeb9' as NIST_SHA512_test_vector;
-SELECT SHA2( x'8dbe0cf088e68bd30156ebdcad3cb932a69bf8a11c36719948b04a7aa2f1da0e54ccbc57eede228c5bb96c5e1442fa7f93573e650bb5154c56', 512 ) = '77d81a877dab2228601a42bce6839f31b21e2b7964c308555a5462516b635e0f4d4d56b39778987c24b35f666b1667aafa4ecb3784d2ad130fd9882ecf1461b5' as NIST_SHA512_test_vector;
-SELECT SHA2( x'2de3f31fb5182e1cef0f982d0e001be75dda7753d3877f4fe8718530a84513ac06f7dcf87206f12dae0138f0dd4a1b52dd1a7df5d6c5f271133f', 512 ) = '588da105790cd974ecb2988ac398a72ceda9c5bcde026877b67b21443acb4434b78923a57341cb3da465b44a21717c42603bd904e2213b562c732342e26e61aa' as NIST_SHA512_test_vector;
-SELECT SHA2( x'c7680a02334453cf17fa4cd27cbf668e6cc12447aa0d710aa0b037ed991c2d9830cef104082e5683beb7ff011c572d899019d50bdc01f65c0e3729', 512 ) = '94829820a81040b549e89e7df9ac1d99851d57805a95cfd4044d09432f9f3abc803580a2397f38231ad391a1634c2f879e790f6e85045dd972dc080e3e7bc1b3' as NIST_SHA512_test_vector;
-SELECT SHA2( x'ab1d93fdd1d247ad983728157e634612c12d6d5223e204aeea3935ba2c884f9a49376817b97546f2082b80771e2ee056c4b90caf641a656c10ab30d3', 512 ) = 'e7e13c2abb76234415acaffa97ff804f22f20c9ef692044a00d4d49bf656963ab0770d19640081dbc9389d1382bad4fbc3dcd47fb1da671d0d046c34aed476bd' as NIST_SHA512_test_vector;
-SELECT SHA2( x'd3ad500384e30bf680afa762bbc558be9f7281ec53d51d113d4b5da5c62b92c65db44ed2be43c63474c97b7e9c7d1ab9edcea0f8f59cc134a5a78b5310', 512 ) = '54a49b06b483faa6d34a8e1ea7ff5bbc44af9bfceba30f62993093e0bef1134ddef01355b04b5b7678f8446b6cc9eb017d79723de360ff9c6a0adb3679cd03d1' as NIST_SHA512_test_vector;
-SELECT SHA2( x'9c542e4dd9a660850dc22a081c07453f233148f117726e00a9c59a536d7f98133c26a61ad78733a8cc03e6589e2ae253208b49c422c9fe8c4ff2b036560d', 512 ) = '8377f49071ee63696d231d960fc8f37f4a7751ece2121c4f59e00bec6a38f19148269e385a0d66b10246d3837a7eafd259dfa827fa0f961ff4baa9008bf81fcf' as NIST_SHA512_test_vector;
-SELECT SHA2( x'7bdee3f83c1af1cb0ffe6f1235d44f88d2436f234f211b8efd88d4dafb2c4f7159ebc14b7da65a64c6500f6d70449dc1b8dccb9c403fef87b47ab317aed319', 512 ) = 'b908c46311cf787a042a54756dc751d995ea57a76624940f70a18ae369ae82c9ce61ff819dbe95f2dab0886718055cb3a39e39a969277205290fa090d3d7fa6d' as NIST_SHA512_test_vector;
-SELECT SHA2( x'095c7f30824fc92858cc9347c085d578885ff3614dd38ee7ee94a0f44072c877047ee2ad166fdba0e744c3ed2c2b24c9d8a2934648dc84d3be666302110ae08f', 512 ) = 'd5cdaf83bb4a27eaad8d8f18e4bee9c25be949a761a0fd0fb2284cab143cad60beb5688734b2f81e9e2d640b425fd32ccb3d20d02d63c2c94c03ab3d9e7d9b4a' as NIST_SHA512_test_vector;
-SELECT SHA2( x'baf66cf83ab8a22878d02194b7c56599717cd3db4a594a8942a7fce32e3a7cf9695217b5c7c3681bca5327d0196442d92dd32fa64e1f804fbeceb81d340c5d4c8b', 512 ) = 'f63022f528910ee310028dfb0782db51b79f4b8063543f15eb008618c50f9b8721603f7381baf083b34beb01cbb8d985db3b8e1eb53854ce3bb62ce7434373b3' as NIST_SHA512_test_vector;
-SELECT SHA2( x'aaa20338001d524041919bbb13926d0729a099c27c599598d8ec22599bd12d4fbab8f3ce04bf690cabe7db3300c9d3b57e853ce00afcc7b2793f8eee5346f86fd6e6', 512 ) = 'af4a2fc9681166fe70d4f0fb8d219d56a1f4ce532a7db8f94c4432ac41e370295977dbb0c4e356a8d2b1d791d513029f96d144cd92f45bd4230cda84bfd04a69' as NIST_SHA512_test_vector;
-SELECT SHA2( x'8cf929dee0a854f7071f7062c911338e298655e0462f97a983f60455e6da77e5befa5d9f89efbc03145f7502e4cfc66bd5b912a601dfe5a4e3de3316bd06e0dd366985', 512 ) = 'f499e9f1b19c614857b63bb44c095cb19b7cf48c5d6e0a6eb15cbe0eeb61e0bdf7bf0f049cd3d146748196718698248360a174f878113305c6633f10ddff0b8f' as NIST_SHA512_test_vector;
-SELECT SHA2( x'47b8bae735771d17d740f537bfeeff1d4012d80379e81d238e89d1843961ff1382e4a0f5ca7dbe1c0ec7da186a008c30dcbb69b24bd42987c8a90a0a13876f1b6163cd6e', 512 ) = '6869157dbbb2117c0cadbd3402203fd7ccf22acb6a85b9efda4f3d3f54903a65b39260bcf8fae978f1559492113081171b7425bbd15b40a2a1c7d2557fe7cf44' as NIST_SHA512_test_vector;
-SELECT SHA2( x'eac31a21d4943d32747d63604d09b9b29a97f0a632b04024af98adb1cf2389e51bca3a1fc6fe3d77d7bd6bf48b627b00f4c1c918e77355c8156f0fd778da52bff121ae5f2f', 512 ) = '149e8b8ff19a532d22a72d9d0390d51a365f0c2fc288acffe99efa5cd21c37f9d39cd307faca020df2aab996fc6b46815133c52a87a3b1ae350833e3e6adb1ba' as NIST_SHA512_test_vector;
-SELECT SHA2( x'28cf2204c192776c904b1288b5b398f99c9189cd6988c4f69a334efbe7744fee6d085d9e0c5ffd0d0eab672509388aa606fb5063e26d23aef59ab011f274eb3f0e6e53496546', 512 ) = 'a6f42a3755bd9940d2f464b2efd42e26e7ad63b2ce26d39dccfe73aa7017e0d5babdc6ca8b8b0fdb27f014537863db09b92f100ea503490e4d1c7a4618372777' as NIST_SHA512_test_vector;
-SELECT SHA2( x'6efc3166fc8a21022171a50e793248b418dfe339c180728058b420d09a9ca4d60cf4d0ee3183679e00b63063958848b127a4bc353ace575d167fb91a77cfa9e58698ad0008d9d7', 512 ) = 'ce34cabc906f67243ccd62ea6363f7ecbb7da3c8640799ddcb5783946d54d68f98e743b4028c5800a7716d524b171920b3b3fa95b19991032622ff9ee90771d5' as NIST_SHA512_test_vector;
-SELECT SHA2( x'f278f968b3b8eac25ed38b4ac7d605930510bc8531c62eb06a281de11c84f0f382ba57e86af02e393986a4692e4c9ce0ebf353f731c24350eb8a48686edc026fff797a57950a082b', 512 ) = '08cfdf043c67b265027c343e05e188a78646414f7f2adbba5fe0a9409b8ce173edc93db26e0e79c191c909ee21c7307ea7c582be30d5377512088c791ea20bd6' as NIST_SHA512_test_vector;
-SELECT SHA2( x'816958892728429100099fbfe5512a367cd7ee2154c6fe99319f67c9a47d6350df9dcfe6c81ddf434c04113df6835f30c07bb9a2293eb227879a7a839f140c0f7371a85e5b7b841f57', 512 ) = '901313c1af212cdcb56cfdd1e2642c0387d6152368a8150cfb3ec6758b45eebced1a50dfbb473c9809accfb575e1eb653a8138080ae08fe85c7010ba8626853f' as NIST_SHA512_test_vector;
-SELECT SHA2( x'a2a1de6f0ea927b132bf987abdaa725b0e1e274e46830e99a2f75af608964df0dff9a99024fc6839bac5acd10202f921ac71a27fcda681aa3109ebf5f21ee3a849098ea3a551e844fae4', 512 ) = '6985aae9d3e97d29b4ba174b4aed7abc5beacc4946a00e6b0921f7978b8cd62fdf897a9ecf94ea2e053bb732f2d6b1a44c1eff9c0ce43bd5ad2aff41121aa12c' as NIST_SHA512_test_vector;
-SELECT SHA2( x'e17c9c1af29e6c3c10f97fdde3a35cf4d37157176fc711ef10ae42eab927b62f42c096d7b664e95af9775a47ae233c3957eccb06be8bb53995f9d9c359ca4eed7cbca791c290758aec180e', 512 ) = '07d0426622c4f5c5dadfd3978fe9edd52b90bd8a9cea32eec6dfbb5cbbaa2549bc7ff15b8568ec716bf315e28b108f35274e4d4cba1f97e7dd7d54d63f8128f4' as NIST_SHA512_test_vector;
-SELECT SHA2( x'45527df1eb7033e31c0733d7a384c642359a6118018ad43488a2c5faaf035d3b12a841589ca4c4ab55ab5b227ad4512dd39dbbdb4130af4097e5b119aa076eb3acdbad08b5de822ba34fc4e7', 512 ) = 'ac0fc8acd30a0c7d4e1a3f965d157af94c4c9d0fa172ad1d4e6b200cec02cf345f0318cc11aa2c9de2867f7c6768aa75548c30c6ae711a6e68ddd0b27be808e5' as NIST_SHA512_test_vector;
-SELECT SHA2( x'eb41a4fa67ff100792cdf1b7c3b8f88dc276ce1a2c3f9d7219dfd1defb0820d0caecc71c5e0b17641c4a31d4d4460e10eae7c26bb438015a2476e228a767e3eb4cec2db629da1a10fb06f5a50c', 512 ) = '382ce23a5bcd95acfb9dc3c9e6962a8ceac1512a0df09ce741fe4c2890e268c637826ee229869663dd8dc9cc83ca5802aba02a769a667dc0d180a24af90dec7c' as NIST_SHA512_test_vector;
-SELECT SHA2( x'dde16e701bf40e42cbb1ad213a84167da405963befd455b699c7e504f0481c7a81f81f72d299c04b542a0ab293531920b00430a4115a05e357c25f5d9060e3f2aeb22ba43970199e40b76b769567', 512 ) = 'd202fc7a97202fea9fdffda2f7cb874e2054c7d6747f904d198cf8d1831eadda653fe79198fe264ef88e480ec731af47165b080ea6078cb7c5bc71dc3fd4c65f' as NIST_SHA512_test_vector;
-SELECT SHA2( x'a530841c4cc46eafe5435317a3651d69db7aeb1ab75062092f5743c0350343f73072175aac4fce8d50f6636c10d99397a422ec2e389a27d965c9b70c605fa28971d29026a74921d0cbb984d0924d46', 512 ) = 'f7cedc950dd26e26b087940306a92f43f77ae039c34144aff8c5c2cb01214f18108f913e81d621e45a53e035a7f578fbe2d7831bf39c71ed9e7694d95d69efa5' as NIST_SHA512_test_vector;
-SELECT SHA2( x'd7289cfbdbb66582d93c8d1f03f9e3b4c57955c69a18622623c2d2d07afca413c42848f205040ecb3975df36a0832b3059a42279323d273abf6681eba9ee5474499ed09275c2a97d9ae6c7c80bde3e88', 512 ) = 'c527bb959f9b7314e10b83a89e22d52e9a47437050b67bf47be7805eb151e5bb08e3ecf4b78d3fbd40c115dab9ddd27fe033cae82e259a880872f74413d2945a' as NIST_SHA512_test_vector;
-SELECT SHA2( x'b6aa7703b126ffbcdaee16664e82ce20be9a90fa0968575a101d1b9fc6ae910586d811c8aa62d78d59a26ffda0426bb3c4445758d744ef0c8afd8f08420fea826e00ffd1178049d2b8f1368a5126db0db7', 512 ) = '0b54fd35a70ff3abc587670afba9c671c57a50bc6a2cdc2deae2a0c98495adfa4559519184f9812c844eb3dd4621facac85de88fdb2eba9fd38cbbea697923a8' as NIST_SHA512_test_vector;
-SELECT SHA2( x'1263458e97c49296f48ed339144f682a6fefb11b824c20807c2192953b2cdfa27690af7d3c7890519dfd469fa74a628294fd173741d148dce27ae578f5d1783c7431fb094f21ed321933a582012ce5810564', 512 ) = '4961166aacf83cba8b42614ac5e699788a995462be37019bc6d8281dc84ff07a19840d9e2e3f1fcbd995903b537de325087d81a85bee94430d96de56c2d6a275' as NIST_SHA512_test_vector;
-SELECT SHA2( x'caa784bf0dd2605026635e8b19db46249da32fe523fda345133afe3b592e175420e12204dd87d53990b2ca3647c7259fe3ae76d01ecee173cd397c526323f869b79984400770ee783c7b0ba36f015a59ad6de4', 512 ) = 'f6335ee270b1a6795528df400d0daec52eddfd0571a2c2c3722047fc1e08498263d43e2900150fc2d098ef1b72c6a28054a620d5f2bfde80714f0f07093cc14e' as NIST_SHA512_test_vector;
-SELECT SHA2( x'e1b77436f6d15a209fdc68a636d96cf38c6850d388dfe369119ddd242e9c1def6c4634a8818a27d42e2e71916a6748cbbca721b3e9b6766dcf04c709913edfb5f41f5831098961830dd4bfeb8d661219cd835a9e', 512 ) = '84067e9bd1a74088edbab9182a39a43e8fa9669a7918a5dd2b0dabe0daf2395b6d41ec828e89ae9ac5e63f54a0dbf7659c13ddc20d2d3d33f30fe5d1747ac341' as NIST_SHA512_test_vector;
-SELECT SHA2( x'cff920294053417495f5ba31281eda43e264ef8bad555fae2c5ff419a9ed78434fd3823299ec8f410a0154201fed531c82ffada180a037fdbd36cf662648f13f28e285971f3bfbf312959a4d9d65155c2eb4601675', 512 ) = '7a1d2a43df8e5f2521d93269d5fe069a555e460d0fb72bee3795c018d77ced248876f86f4e668756f035f2af5fb23c78529278c2a8d773eb060713c450f94559' as NIST_SHA512_test_vector;
-SELECT SHA2( x'03a0c0668e3984b2292d9bd4cf57051ba2240b053b9a2a5f3e9954ae316158ce8e559ed916ff174b69537463d43896cc6a44467c56c727dd6f0ce82a0ddbbe1c1b4212c76e9677be55b4de7e728c0d0ac8e14dd2144a', 512 ) = 'f1c616ce75361a068fc44e8626712dfd535dd37a0a9e8b3b1dfe9cc7b320864664b96193c3728450114c0f4093595202f82b7dd2a37d4b55f01ac24e6f108366' as NIST_SHA512_test_vector;
-SELECT SHA2( x'814c6906076a3a531d6cabd94025549fe78576b671bd8c785ca42212b75aea40da2b0d5854b6bf8a254e16662ea01c9ee596230e4d7c58f926629b9660c18ecbd661ec3839791d774a1907a24dc52616ba62df77355711', 512 ) = '52d5bd5dad0f1340fa3213ba2e94db95ac2bffacea3647bfb94163427fe7eebe5fe6f49160776da6cd9670a617aaab39bb73c5307424e61eb2cd03bdf186eeed' as NIST_SHA512_test_vector;
-SELECT SHA2( x'4edbba7c47286bdb1343da9127a036624ab9a42cec0e3412ba6a13d96f670392ed34097a8c96651eb22dc7c3a4f9c0049b1d77bd1be29d2880fea346da172a81fa83bb8fcd52b899e98e929d66c13d11efb8e1c91887d31a', 512 ) = '036b62ec6673ed63f225f6feb88933809c32edae2292925fb888181c1a0b36cae40e22aaa6db0061e92001e63e4e25886c1d5e8d49b84b928161ddcde950ad64' as NIST_SHA512_test_vector;
-SELECT SHA2( x'267b4d93feba7d7927ea2def7a11994cc35a8d3dc50e85607fbf130eaec7817893f1b7f5f675609a6b2a490cd4f70992278ae76e724df86e1c9688be6d1fbb0050b5749e5834765f02b2ca393afb6067203ef9bb0b054334ce', 512 ) = '7e2ecfef69de2b9fbf553e274dfdd983bf712ef581c4996c0e80590cc7e4e884842561a4690bc5e7c3b5299565f9374b0c97f8e966982a5b15699113541ba784' as NIST_SHA512_test_vector;
-SELECT SHA2( x'ee4ce14bfebdec4ae1b84d73bc62e143ec3098f5905a1e99478dba663be176515e0a80dff3d2d03751c70b7be330a758744651dca9a18b88cff19aa7d7ee9fde9f92040374851932d4d9ff1e78f7c6a692d9d2a9537a831ab08b', 512 ) = '3f2f168af618dc5fcafc8dd644295da4a022f975e3518ec5d1046a3e9ed16756dd5019e98fb85cdea2abf5e47c955c064f7bcdefb02d49c1f92b151c215217ea' as NIST_SHA512_test_vector;
-SELECT SHA2( x'e742e8c107336988161ca3343f532b59df8e6c02dceb9ce03833efa8e65f0ab6dc5bbaf6690be604c98cc292f7bc460bc2fcdf752334649cce184b6d07aa1da0b700279abf4873918c09f6f1ebac0bfe1f3a20bb3267af0b88d071', 512 ) = '745f4cbc34ca7727bf2ecd38aa24126e0566eb0ed633b5f3ddd92ecd74fea28059fd5d7b0810177f22be7d776aba3f63269328b7451b336cdfc78724c6c329b4' as NIST_SHA512_test_vector;
-SELECT SHA2( x'1511d4d2b955be39525983b9a9144e9f60eff6362928d3493675d1e3f1ebc259ec1df98a1b881466412f19ada882c5f9158420fffb2d5512ef0dc1e95c334aa1784df2057611ab0efedb6ea6da9787b1f2e1334e7a6b6c5a6a9f0437', 512 ) = 'd9bcfb54e8dcea3f8d6c7110e7fd397e52d6d62be2fa758e30d79c7ae89ddff0447e01414c7b9b6057fa1d70f064c27da9f5c4122d46c91ee2c1573ccc65c24c' as NIST_SHA512_test_vector;
-SELECT SHA2( x'5a040538682bda120fdc18b072408abd5f7627681d43f0b865051c1faee97353ae5ef8591dcacae2bc7b4cdb96e0844085f9c131f90c8147f59a91285a91765968c30c5482976ddb31fe148b6ca943b4177aa168c93828d2d2863ec97d', 512 ) = '45e61293e86f22b3a3f24f21a9297dbfda1c414d691606599030816332a0f73ca3e7f6d6cd5120e1274e91427e4305cd4599d60f8d2b3069430da6caf8fce103' as NIST_SHA512_test_vector;
-SELECT SHA2( x'a9abd6f42a85681483904d9a94b70dfec552f073495865bea4d0a4496a8993734a0be62b4ccd8bbd57a945ebf68c97405b72e3a1a592d3255ed5f827488db19959644f9a0492764bba54c6dfb199bbf2e4fed21c5bfceec5ac60f93bc2fc', 512 ) = '7aebcf0b69968dec55525b90722e5cfddae97e4bc0dd6630a88c24560ce7f6dc5ad365e1394c162b1fbab7dd159fac8d10e036e12da9102b36541486bf3a9273' as NIST_SHA512_test_vector;
-SELECT SHA2( x'55218435049cb8e9346c6e9602c3601c9fa5d2bf0c9c757d21ae8a9ed48c4a8eb80c86e8c4d98bd3566948917730b355611468553f209321337c11339d9dd2c79bb982edcc7e68dc5a038e8937ff2278a6391cd2fe3f21b9aa5ba7d875c35b', 512 ) = 'd78f40b72a42cbd0309417deea33ea3a317869e5242a6ef94aed63b96bfae036acdcd5144761e5077f8faf79d10c681a7c1144de553bdd9b742eb9aab76edd2a' as NIST_SHA512_test_vector;
-SELECT SHA2( x'e9a6317e3bc4d6cdd5a0833e52fb48baca16a9ba9b6c8ca469a0555763b54f04c87d4e41aa549258f30eefe5a52d2ba06657a8773b0842e094857b6d8911d6a0636280025e56356fade362b4bf4c875cc19be0c6644b447be0454dbf390eb966', 512 ) = 'b79ba8a1dabe9a89a383e8bb61750b4b84c90846671129abd1bed826345d97127c406b447664e3cf5305b5709baa29998c0f74b9f0038965be53a7620917d9c0' as NIST_SHA512_test_vector;
-SELECT SHA2( x'8d3108ebfbd2a6d248234e4eb76af905a899a886bcdba67e3a6d0e2eb2af8e1ce07b6a09d2b5c4244d231a7d6e7f10bc8dcb701366e56f717b5b32f9b48090b249c01a80e1305853fc69569e8e975f0beccd096dec9c72f548e3c8aa44e80f1391', 512 ) = '6d32fec68eba7bcd27a1ca2395e582add90bf74c8cc0926249dcfc333240cbec609976134c541796ff86e6c4481960339b06d00b4a4c55b423ddff52e9595be9' as NIST_SHA512_test_vector;
-SELECT SHA2( x'71599aa11c29f6629aacb58f1478e19988a504746cdeeb4894b7aa6a5541e08aebdd3c2e184d405f0e1145a18ff0c02953d5c34baadcc73262ada8d3eb09f123b9a25a88ea308f8e29c133dcd2502566569a02e4e22deb823bc288d9edcc4c1ea451', 512 ) = '30a38eaecdf787a4a2bc2e7e31e1c908112cea639cd882c0e88f0b3b8c131b5d791028150a3970ed79aba63421fb7735c068ccc3ef2ce500ba574f4e0515c360' as NIST_SHA512_test_vector;
-SELECT SHA2( x'c436115d8fa97b11dbca495353e7a37a82b0816c44e3c1647a2977f2023b8443e7486aa2d49b5e3fcf799f2f234807b59ef7dfc0fd99f8b4a553f76d9479f18296f438c6bce774150a92f54d7076479afcb907f74dcdf6f14b4d4cae15274f2f3b0023', 512 ) = '9a3bf2d701b6817baea83cd359257da3f6eb8cc34bf5169ec22a1dfc33001d6c4e7f866c2fb863dbe06106471437d0094215b9b17e7e27e90bd2eb05006e3d6a' as NIST_SHA512_test_vector;
-SELECT SHA2( x'5e2a3dcd2f860045cce291de5f501048a724cbacf9f1604085b4221adb4ebe42ae381f0ad7728ea29cbc1ee73309477c8231d11c29e6f32ec2e9bd9a677db3dc751dbb57906a39ebe86778c9bae84c861948f56fee5b471d3ea30849abc79ae13e40d95a', 512 ) = '2828051603cc729ddc9feede736ca9f352b69ab5a916042cf1f9f90cf1d529d7dd0577da13f11f4f7bfac4c4f2d9a327d4c9924ccc93b8c14428c6824c939a14' as NIST_SHA512_test_vector;
-SELECT SHA2( x'e5f4f4d833fc49da6dd083442214cb70d889efbefd2efdd820ac113b61f06bf3261ac4a51096e2d32e886b5c706ef7425e0168b0095b7e3c425fa6690b5613704bd61040c6e895c34b6918632fb1a5cdfb7331f462e42c597620558b1bc9d2e9bbf180af3b', 512 ) = 'bb66ae70b600735d0e9098f12fcd9aaac1f2141291e9bf54bb8e0013fce25ac1b878dfa5d0378814d84dd8892391da402891fbd7bcfec344ffe3272c5be7be66' as NIST_SHA512_test_vector;
-SELECT SHA2( x'85c2ce900c00d962f759c2091dd6c2e9211c36f7f7e348caa3aaccf444a968925208f822244e3095b51c83a5a71b446988330c2755fe5b693c7c8253a608c033758aab5a8aefd12b8bd6a071e38c83f60a3b4e51065edcff3278f6b53e0677f577b2aee048c9', 512 ) = 'ef50d18489656f7af6148e897d4ab3e631f0fd4f9fbd7f232a0ee288980b4cb10c2a1f890c77d13b4646ef133bb8816998dc8f88d5798ec7515f2c8ce607b655' as NIST_SHA512_test_vector;
-SELECT SHA2( x'f7f7f3bc1615653f479acd63042a0d15d636a071bdd02433d2bd156f2bccdc83ff6708490a68db91332e08ce6defbb0fdb4fda3137328a5374cff68ba2074cd713f40757bcc474b9ddc86ff4e5c86e39909ac22652f2193ef87c46968d2845d07ac6794df2d239', 512 ) = '11eb07f3a5c143026a7824197c02e2a52281fa82e15ef976a7e63941e16951f00321f206f09c2ebc0bf6fd00bb879df894952b98151b0e8cc27b34515e1bf4c0' as NIST_SHA512_test_vector;
-SELECT SHA2( x'd12a258ef4cc5ae35ba4e63aa23165945516f464aa098b966feb8ecf41389ef7ffa2b5f57ef972b97e4eb180dd585f530b178dd1beb6c22fe7b6967de4497c2bf7fce0cbf7997218454cc13802040b3e7f1c53f3f53bb5d67779f76124c3608ea180cd9ac7740109', 512 ) = 'a8e4b47f67f1541c7fc0f2a13c5abb33a1d4a5d733d794f22edf760b146485ac53bd03038ee76e322fcc23667c4c209f6c61287a8c9c044f0c9922752a9efc0c' as NIST_SHA512_test_vector;
-SELECT SHA2( x'a71a304ec61763764ad7881d54fe7d394e658e7588253ce223f23ce92fabc385102e01af2671eb19adcf3e1ee19fc1f9660bca36e8200367ff216e185521a7050ad06a8a5796545a72deee74b2b5e753f493a1653d78f0bfa13b1e0f631f32d25da871c7a2ad26a363', 512 ) = '2609ef79ea747fe6b00a50a2316c9d3ed2946adfd71cb3b1ad1262b3911add77c2bc76d121444c905ae865703e208bffd759b222b42b02cd13764c04298aab15' as NIST_SHA512_test_vector;
-SELECT SHA2( x'63df67c7eb2829ee72dd694949d92a24a0622c8f54ab6003089d9e4877d79a9508f415faa40c50fbc47dc67eceeb1ae7a1854f816e8a3720cb0c2e0402f50801af4747dd8aa891fa811d62340a16ff0db7abab080a251c528cc030a719afdd747e6166394603d532d046', 512 ) = '42463a62b1c92b3982dc4d666f8bf30ad5b3f383fc00ae3e65b5d4787ba0ce9f0c5e6d4d6446f1f480460fcac237dd1d82657b14dd8e4044954321ccba7f478f' as NIST_SHA512_test_vector;
-SELECT SHA2( x'b95900674bc78a86f4f9b2203b2950f6eac9a59665804c833b6f6e90fbb8368d4941842530b5e607baccc444becddaf8fa51eb2d6149b4fcb64220f55ae8bac263c96706ed5c558bb5422f9de4cb93b128bcc54b0950a51e7b7cde74af7761d02f7a12d22ac5c05c0ce25b', 512 ) = 'd420448ee2c6eabadfce5856fe93383ef559d144c97349bc0af48b1c19a926bb40b62d3cc9334804e6991cb073baf976dfb52ddee24b5ce36d1f6789eed83574' as NIST_SHA512_test_vector;
-SELECT SHA2( x'fe59b2da7c365a64901f6a132c957105844578ee0a2c955f9dfebd49fdc9dabd83d51df50fd096984127023aecb7e422c7a5d751668a22c069d48de8f46973875f8d19a22e053ec6437cf3945227ad7d96a599c9c2292fde3bda0abf847af7d3f9464ce8c11e7b77fee6e629', 512 ) = 'cc7cb1a4a616ae4806e48cbc176542a4d75a5b07c25d9324c124db13328e656ccd1cda4f946f0425c5d79c1ba165b1a12933b92f7bc3296fe98c72b15cad2d51' as NIST_SHA512_test_vector;
-SELECT SHA2( x'71f7ff4ba87d2bcb5ff81a1f42f47756f5189e6b5458011bff6ccaf41680c2af412d71bff4a8872af1397a980eef71a93893618cb8da75ceb5deb46ffacfde3bfae69657119bc61b0d18401fededa199e9057be6b2d9b366fae3278d37569437a40cb83c89c0b345bd7db3de69', 512 ) = '31b446c44b0aa2791cb7ab5834e4b8cdd2e3c5b4a96234b338c7b9431dab2bc532e4d71c7f84f07372c8a3f08feac37d0254cead9a9aa619d312a3c006992caa' as NIST_SHA512_test_vector;
-SELECT SHA2( x'52b5a7af72437136650e64a49078aa831d8d715c46364c88d0b0d543d53d9802c71a2c07b2b0a332c10e251a0497d75c70f80133285e7149fbe51acd2d5301c67a065aa7582bed237d31bf42a17defb58560de673446925488305d9ef164b9dd726277b7ec1b19b29f5e7c45ee93', 512 ) = '02bdc51f3e4e129a4b21347d835b3611165424eb6607440c816979e6806e27df12c50413740b1602da26db7ee3e55e5ab4a62a8eaae24ef1c68d1510fc824932' as NIST_SHA512_test_vector;
-SELECT SHA2( x'b698108304a44fda03e02fbd13bdaf3ae1c7786de61f7796312bcc6e678ce3bc0850e023f369413e2d5ebeefde4174f39ce143baec4075760648a073d9b9cda64f66d988d2a11c250ff4496ffa1295d9120c1c21e6c8806dd8b0d39a21a7b7d11541c35ba83329b6320896e86f165a', 512 ) = '131ecdf4840cdc45557516205f07cc277b7641d05afc57cb7fe534f59d9cbe611e0e6a7b6aad61f1d39fdc7559f3048ac4d0a41234ddf07423dc61dbfddb7a65' as NIST_SHA512_test_vector;
-SELECT SHA2( x'65f571e86f04f86dca7079e2ce8619a1f52057fed7cc9e88592a1a8c2196ccdb4d07d9cd643728868c052b78fe17fd29b8c3ae377130db99d2b88127e391125dc4adc95c9dde3b31d73e305a8dceb0863d5d619dc4ac100089cf8d12f8d6bcf732ade99c02415cf714e42d9061f35a40', 512 ) = '0cf871f3af1d3e5c9965619f479ba6b75be338afbf32b2a1fdec9361164357b2c4faebebff6e4a5af00389336434b5872285adb1e760ae99b19a812236000d22' as NIST_SHA512_test_vector;
-SELECT SHA2( x'188d1fc4347ad766311a74574b46be4c30886742bfd1eec90f6ac4a3b32dae8d3cf56a5d0053954d1a83cc97b29e12427f10713b894de4a734c075787a04a33e785706402c4c36cc7dc0e8cb7b0e5a98e987f213f91c22f1565e8e5667a971a5d39b3c9740cb818a61b8101c2f0060f976', 512 ) = 'b67a29b2280dae77184e2e7839a7f3b48f4054f9bd0ebf5ecf1694151966756ec4542b2285a53fa37515116c7db4f1aa492f9db0bbafa0567bdaea1bf0f26abd' as NIST_SHA512_test_vector;
-SELECT SHA2( x'9bae33d315dd0e4fbed1a571e7e5f902c9c027817679f46810ffaab139b92399ca6923a4c856ebe194aa0a6f61197740ebc3dd1d675c36eab58a9b2cdd8e5ac8b9274a0defb35bf5239871a86ae27342012e9ed63fc620b3c80de2e6041ea500cfb05019723d8814d2638225e88a159171c7', 512 ) = 'f3b2f66f9a9673ffc47d2c510d6de0a3ac90d59e9600f2600777b1d84446cf94588231a8b48987081209e320d62ae85acb4895731bef1710923ef0fa983340d0' as NIST_SHA512_test_vector;
-SELECT SHA2( x'a7d58b5cfb1841f6387ff658cfc44c2b14fbd1579f6d8276f2a38e885dc15ce81f16ce7fcef0c837f9b5ecb20b2fa83d722873ff0137537693d9a325f2c31386f777f046f216a6b14b75836c6a72bd62d589b70098a280a5ea2d9c540d7108ad7621781b2e31e34e78e741ecb4359483834625', 512 ) = '90fd55013bb36a390be5bbc34bf9ef76ab200deedf3844f79bf5128fdf6fe71332a612e5bb3c4a2bfaec1bcc5510f6f8ec8414d5e13b0ebf2a67e84ce2282d2b' as NIST_SHA512_test_vector;
-SELECT SHA2( x'c3bd6ef24c7c64ba3b198a8949bb824b4642b6910b72edd8af531d0efed7805226beeafcb4b75addbfc8cfc863ef5d50720a7fd465f4afb999f134f7b84c3cd7743e2afb7c12319ea887221d777682b6bcb4e090943a65fc9b83adfb6036d5001605d6f78cd511855f1f2b926e961a058e0a80ce', 512 ) = '99163db3dae57ca20c4327b88851f3c63187e5a2bbadf3c3dab341040619d2196c84c196cee861deea363f48a9f728b4816d2831033ab472f1c92e1ce748ba4f' as NIST_SHA512_test_vector;
-SELECT SHA2( x'9b6b821c5f536bbda82ff5036b6de56eb046a596469d9427b52aa12a74d718865c6abbc65d65151c702a0ba6cc63b4f15da16bbc724322feb69af92a614b0fb1aff497c892122f6da3226ea45f06bc0790ab677d09e9f34a96aab148334f93737c4f3eab652161b62b5d45858b1ea6b831aac26473', 512 ) = 'f65de5d478319608168bde654963b9d410b6aa5bfd8d25bf2165a94b5d2ceba0eb792a7bf132c6c189748ef16fe87e196c862a884b6e2da9804c92b60bcde824' as NIST_SHA512_test_vector;
-SELECT SHA2( x'616ab1a4a7782b8e1cc098b3ae4c70f7bec742fd7681a9475dba7b9f281c43b6d489f20cf117d10f4159ba8781e188318702ccaa8ddbc28fcd9083e34edb7bb1fdc41ef2ffacd7b04690416c628c9abe9a9e753b3cadae9b31caa31cd4b5a12105a39d1f783e25b953ee962af9578ee42023a4762a01', 512 ) = '43394563a74a6d0a036b1dfc206a2ff1e8a2443d8f69b63372fa959360fafd5178d8e8793b2a44116a64313797b60cea5c93cba97a1e6309c2aa9436a2815c21' as NIST_SHA512_test_vector;
-SELECT SHA2( x'9bf0e5967fc1359ec7093f1db06144268e176e08098ba9d085d8b50fe2b779dd66a19b1df7344d038ed86ad4e8a2c1ed7f79b107b877f6b95e91c23e4f7b0f7975c63436f84cb7b3b2cd635fe4da9ae127f2ec5ca5ece8f288943187b399d5c7b0a7db6aead01bb61d3053460ad1760b6fcc479036b127', 512 ) = 'abeb62f84f587b997e09ee255819531b986c86e2568df29ed77b68a597331f2a977203a2f66566e37cbfdacc090d0464c49839cee7a8ff569c008758b0b1172b' as NIST_SHA512_test_vector;
-SELECT SHA2( x'a19949a0d6340be4a91b7973b705bddb2021a0d58f04aad474e68ade940fb99bc48c5bacf126663d649505de44f03f8e5d68d4191f3667a5ead2e2878966175bfc82a3537a1118cfb68c5b2e626d4ae4f1e7a2cda2d420c2baefe76910432251cfe3ea3e78dc6ac12668410c166427056604d4991dc61e53', 512 ) = 'c7a4313191d56ef7a73064e271ac720322866a6ef82a42a2faeafdeb8d4da7df5200baaa286ee50c9464d0eb229b036c333ceae7b6a511af5c51dab79508641e' as NIST_SHA512_test_vector;
-SELECT SHA2( x'a949427f3fc83e578d9cc7ef6a510759f697bbe97d9739329e87b130ac7cb3c75480f16c80e547237cd9f8a9573a3bf28dabf6d6e2e7c90791554e46a6dd9fd6a9fb19317c1160fb8602a33412fc22b1f195edcd671aee5c452329e0526b4300efdf4135fbf593c7f53f51f86040c47e6c7e2837d2d8b01900', 512 ) = 'fe3347c05519b9c4a61fa289af3153c56f96d04f67041697ba09bf9722a04be2bb15ae2399170a9fe206db8d60cb9940c6d6826db99860f31fd83e9eb9f72c73' as NIST_SHA512_test_vector;
-SELECT SHA2( x'4157af0b3e7d291add80bdc7dac297a15861a6e66db24599e1eb1bd6331f3f63dd70a087d980a51f642810ee026d2835c2af1783c32491cff785b6c427073a5c388dc3b0ac1c920f6c8f664dc48c9d5dafb69d2255247283d213b8be39d7bcfed818de2fbe3a3a117b1d878b27073e43a6deff6b299b32def8fb', 512 ) = '6d90357d4fe398642e7b6099fa2fb2383dedb02db019e90b2ed4058dd55311156e79b8aa970035d098fd3c0e26626ca9af42af491b36eb40097c6223d21201ba' as NIST_SHA512_test_vector;
-SELECT SHA2( x'bc79986ccacf533b9ddbe2bcd15958c3bcd86063f325dc051007cbb8b32c70c8c764b192070dbd96c0cef1ced889fd3f0f8a42cd85057f537dbfadf3600b27ab05f80e292fc9ece157a5975cac9059d3599a4dfc06560c24a18e897e5e353abbfc9d79da4beb2942ebc79c0e5658b4a8206f49997e02cb9f06dd29', 512 ) = '1e1d4bb3839438383be702d61d60f098d70257baef0f4058260e8d300ece538a0c3133b327a7f25055916dc8c8a5c7cd419c95d0664aa53742e8be6abd4b22f5' as NIST_SHA512_test_vector;
-SELECT SHA2( x'0a45314284915ec9021fdd121a3c99e7c01bc73b696d26607131857abace8734975fa3b1e84e6ec686241d66e19f455de706e64128b9a8a6380c64925555e6314a44f2c9937384efc23e5cfc22d5babb998f6764d382f4ce9c5046e08e435349ed9d2670cf2929ae8016a3bc240580679e61518bb1ef933e65a6344c', 512 ) = 'f523ebd51c0f1d8e32a299f762f50826fd2341b8ae44d0c4841080bb626112ae1eafbb089b7adfd6e6668ac7ab684f78da2a23273058973e4cb660c297733912' as NIST_SHA512_test_vector;
-SELECT SHA2( x'8beea2e048193dfa755a594306ad9825c77659d037092ee09a6f91394a68d2364eac54042d76f9480443db08d7d73dc82582c1f3bfa1db7dda6785c762de34c391280b58c10b4f087ead1cd0e09b564f1710e12b487515b198246cbb86717ed77deb30a5a9df28810b1e8462c800cb02c7a923407a8bc5c2fc2cafde5d', 512 ) = 'a71b1ce1e582bca53d7615488335ca1ff351eb33a8c2c0105bec7ffcbd55e4533ee68209ec8b009066a2ff60b418d6b943816cca9b53b7bf64a34feaa4d63600' as NIST_SHA512_test_vector;
-SELECT SHA2( x'f4259473bfd39877bfe9597353d7ce8dd520c66d1fc7884e4e03b655c63a7721762dd4a35d7163304c1e23d4eecba8ea07b978e9f94eb4818cc5fbe7ee258b6df96fa955b51c44e71ec6d5c12726896ffe3ea23b92d71a46532e8ad838eb4bf50752db31d1bd82c5bb4a35e105d1ba4444190d0bf24b03c629a62dd1ac75', 512 ) = 'c8a04bf3881d0582e03563af73a675e40dc9918fcb5a138b8c6fdd057df0c11b112a6dc0664a0dff8a316c3a645ac87dd25b644d061700306bbd7dd805879b55' as NIST_SHA512_test_vector;
-SELECT SHA2( x'd60da691585b7c0c3714905411ae8e3515e8490dbbaf07d1b2431f501a96c7bcf4f52766d7e9b2c9e460b5cafc08303e30fce6ad78a2b055a8d31672a13d20bdc4066a33adb277171d47473a37af2c7af05dd989c134bcf09ea48e532c1628f62f8a9880417e74ffca126e2d2c6b29f23e554b29fc2cd4a77dfcae7925e784', 512 ) = 'ec83376ff6f633ee2d898d87a6a91efb0788bce188fac7d3c4c35f81ba6015640dbfad1f8584557ec210478a0cb566f1490643ce602aa5abfab63d46f7f1d4ee' as NIST_SHA512_test_vector;
-SELECT SHA2( x'b7d5d5f8955d1ad349b9e618c7987814f6dc7bdc6c4ee59a79902026685468d601cc74965361583bb0a8aa14f892e3c21be3094ad9e58b69cc5d6d28a9bea4afc39dc45ed065d81af04c91e5eb85a4b2bab76d774aafd8837c52811270d51a1f03300e7996cf6319128be5b328da818bde42ef8a471494919156a60d460191cc', 512 ) = '6e7fb797dfca7577432c0b339fe9003b36942a549b112d32016b257c9a866e4385e01d4e757d4378b8e61f5a8a29aa73f2daafdaab23dfe4e0b93df21374e594' as NIST_SHA512_test_vector;
-
-## Test some unusual parameters items.
-## First, the ones that must return NULL.
-SELECT SHA2( x'ff', 1 );
-SELECT SHA2( x'ff', 2 );
-SELECT SHA2( x'ff', 223 );
-SELECT SHA2( x'ff', 511 );
-SELECT SHA2( x'ff', least(123, 42) );
-SELECT SHA2( x'ff', 10000000000000 );
-SELECT SHA2( SHA2( NULL, 224), 224 );
-## Second, things that mustn't return NULL;
-SELECT SHA2( SHA2( x'ff', 224), 224 ) is not NULL;
-SELECT SHA2( SHA2( x'ff', NULL), 224 ) is not NULL;
-SELECT SHA2( SHA2( x'ff', 224), NULL ) is not NULL;
-SELECT SHA2( (select x'ff'), 224 ) is not NULL;
-SELECT SHA2( (select x'ff'), least(224, 500) ) is not NULL;
-SELECT SHA2( (select 1), NULL ) is not NULL;
-
-## Verify the digest lengths.
-# N bits -> N / 8 bytes -> N/8 * 2 nybbles
-SELECT LENGTH(SHA2( '', 224 )) / 2 * 8 = 224;
-SELECT LENGTH(SHA2( 'any', 256 )) / 2 * 8 = 256;
-SELECT LENGTH(SHA2( 'size', 384 )) / 2 * 8 = 384;
-SELECT LENGTH(SHA2( 'computed', 512 )) / 2 * 8 = 512;
-
---echo #
---echo # Bug#54661 sha2() returns BINARY result
---echo #
---enable_metadata
-SET NAMES binary;
-SELECT sha2('1',224);
-SET NAMES utf8;
-SELECT sha2('1',224);
-SET NAMES latin1;
-SELECT sha2('1',224);
---disable_metadata
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-10850 Wrong result for WHERE .. (f2=TO_BASE64('test') OR f2=TO_BAS E64('TEST'))
---echo #
-
-CREATE TABLE t1 (f1 VARCHAR(4), f2 VARCHAR(64), UNIQUE KEY k1 (f1,f2));
-INSERT INTO t1 VALUES ('test',SHA2('test',224)), ('TEST', SHA2('TEST',224));
-SELECT * FROM t1 IGNORE INDEX(k1) WHERE f1='test' AND (f2= SHA2("test",224) OR f2= SHA2("TEST",224));
-SELECT * FROM t1 WHERE f1='test' AND (f2= SHA2("test",224) OR f2= SHA2("TEST",224));
-SELECT * FROM t1 WHERE f1='test' AND (f2= SHA2("TEST",224) OR f2= SHA2("test",224));
-DROP TABLE t1;
-
---echo #
---echo # MDEV-10425 Assertion `collation.derivation == DERIVATION_IMPLICIT' failed in Item_func_conv_charset::fix_length_and_dec()
---echo #
-
-PREPARE stmt FROM "SELECT SHA2(CONVERT('foo' USING latin1), 224)";
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-10134 Add full support for DEFAULT
---echo #
-
-CREATE TABLE t1 (
- a VARCHAR(30),
- b TEXT DEFAULT SHA(a),
- c TEXT DEFAULT SHA2(a,224)
-);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('abc');
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/func_encrypt-master.opt b/mysql-test/t/func_encrypt-master.opt
deleted file mode 100644
index ab687810d5f..00000000000
--- a/mysql-test/t/func_encrypt-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-des-key-file=$MYSQL_TEST_DIR/std_data/des_key_file
diff --git a/mysql-test/t/func_encrypt.test b/mysql-test/t/func_encrypt.test
deleted file mode 100644
index e27a2bd46d3..00000000000
--- a/mysql-test/t/func_encrypt.test
+++ /dev/null
@@ -1,145 +0,0 @@
--- source include/have_des.inc
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1 (x blob);
-insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','The quick red fox jumped over the lazy brown dog'));
-insert into t1 values (des_encrypt('a','The quick red fox jumped over the lazy brown dog'));
-insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','a'));
-insert into t1 values (des_encrypt('ab','The quick red fox jumped over the lazy brown dog'));
-insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','ab'));
-insert into t1 values (des_encrypt('abc','The quick red fox jumped over the lazy brown dog'));
-insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abc'));
-insert into t1 values (des_encrypt('abcd','The quick red fox jumped over the lazy brown dog'));
-insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcd'));
-insert into t1 values (des_encrypt('abcde','The quick red fox jumped over the lazy brown dog'));
-insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcde'));
-insert into t1 values (des_encrypt('abcdef','The quick red fox jumped over the lazy brown dog'));
-insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcdef'));
-insert into t1 values (des_encrypt('abcdefg','The quick red fox jumped over the lazy brown dog'));
-insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcdefg'));
-insert into t1 values (des_encrypt('abcdefgh','The quick red fox jumped over the lazy brown dog'));
-insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcdefgh'));
-insert into t1 values (des_encrypt('abcdefghi','The quick red fox jumped over the lazy brown dog'));
-insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcdefghi'));
-insert into t1 values (des_encrypt('abcdefghij','The quick red fox jumped over the lazy brown dog'));
-insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcdefghij'));
-insert into t1 values (des_encrypt('abcdefghijk','The quick red fox jumped over the lazy brown dog'));
-insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','abcdefghijk'));
-insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','sabakala'));
-insert into t1 values (des_encrypt('quick red fox jumped over the lazy brown dog','sabakala'));
-insert into t1 values (des_encrypt('red fox jumped over the lazy brown dog','sabakala'));
-insert into t1 values (des_encrypt('fox jumped over the lazy brown dog','sabakala'));
-insert into t1 values (des_encrypt('jumped over the lazy brown dog','sabakala'));
-insert into t1 values (des_encrypt('over the lazy brown dog','sabakala'));
-insert into t1 values (des_encrypt('the lazy brown dog','sabakala'));
-insert into t1 values (des_encrypt('lazy brown dog','sabakala'));
-insert into t1 values (des_encrypt('brown dog','sabakala'));
-insert into t1 values (des_encrypt('dog','sabakala'));
-insert into t1 values (des_encrypt('dog!','sabakala'));
-insert into t1 values (des_encrypt('dog!!','sabakala'));
-insert into t1 values (des_encrypt('dog!!!','sabakala'));
-insert into t1 values (des_encrypt('dog!!!!','sabakala'));
-insert into t1 values (des_encrypt('dog!!!!!','sabakala'));
-insert into t1 values (des_encrypt('jumped over the lazy brown dog','sabakala'));
-insert into t1 values (des_encrypt('jumped over the lazy brown dog','sabakala'));
-select hex(x), hex(des_decrypt(x,'sabakala')) from t1;
-select des_decrypt(x,'sabakala') as s from t1 having s like '%dog%';
-drop table t1;
-
-#
-# Test default keys
-#
-select hex(des_encrypt("hello")),des_decrypt(des_encrypt("hello"));
-select des_decrypt(des_encrypt("hello",4));
-select des_decrypt(des_encrypt("hello",'test'),'test');
-select hex(des_encrypt("hello")),hex(des_encrypt("hello",5)),hex(des_encrypt("hello",'default_password'));
-select des_decrypt(des_encrypt("hello"),'default_password');
-select des_decrypt(des_encrypt("hello",4),'password4');
-
-# Test use of invalid parameters
-select des_encrypt("hello",10);
-select des_encrypt(NULL);
-select des_encrypt(NULL, 10);
-select des_encrypt(NULL, NULL);
-select des_encrypt(10, NULL);
-select des_encrypt("hello", NULL);
-
-select des_decrypt("hello",10);
-select des_decrypt(NULL);
-select des_decrypt(NULL, 10);
-select des_decrypt(NULL, NULL);
-select des_decrypt(10, NULL);
-select des_decrypt("hello", NULL);
-
-
-# Test flush
-SET @a=des_decrypt(des_encrypt("hello"));
-flush des_key_file;
-select @a = des_decrypt(des_encrypt("hello"));
-
-# Test usage of wrong password
-select hex("hello");
-select hex(des_decrypt(des_encrypt("hello",4),'password2'));
-select hex(des_decrypt(des_encrypt("hello","hidden")));
-
-explain extended select des_decrypt(des_encrypt("hello",4),'password2'), des_decrypt(des_encrypt("hello","hidden"));
-
-# End of 4.1 tests
-
-#
-# Bug#44365 valgrind warnings with encrypt() function
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (f1 smallint(6) default null, f2 mediumtext character set utf8)
-engine=myisam default charset=latin1;
-insert into t1 values (null,'contraction\'s');
-insert into t1 values (-15818,'requirement\'s');
---disable_result_log
-select encrypt(f1,f2) as a from t1,(select encrypt(f1,f2) as b from t1) a;
---enable_result_log
-drop table t1;
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-8369 Unexpected impossible WHERE for a condition on a ZEROFILL field
---echo #
-CREATE TABLE t1 (a INT(6) ZEROFILL);
-INSERT INTO t1 VALUES (1),(2);
-# This should not propagate a=1 into DES_ENCRYPT
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE a=1 AND DES_ENCRYPT('test',a)=_latin1 'abc' COLLATE latin1_bin;
-DROP TABLE t1;
-
---echo #
---echo # End of 10.1 tests
---echo #
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-10134 Add full support for DEFAULT
---echo #
-
-CREATE TABLE t1 (
- a VARCHAR(30),
- b BLOB DEFAULT DES_ENCRYPT(a, 'passwd'),
- c TEXT DEFAULT DES_DECRYPT(b, 'passwd')
-);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('test');
-SELECT c FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/func_encrypt_nossl.test b/mysql-test/t/func_encrypt_nossl.test
deleted file mode 100644
index 2dafaa671c4..00000000000
--- a/mysql-test/t/func_encrypt_nossl.test
+++ /dev/null
@@ -1,38 +0,0 @@
--- source include/not_ssl.inc
-
-#
-# Test output from des_encrypt and des_decrypt when server is
-# compiled without openssl suuport
-#
-select des_encrypt("test", 'akeystr');
-select des_encrypt("test", 1);
-select des_encrypt("test", 9);
-select des_encrypt("test", 100);
-select des_encrypt("test", NULL);
-select des_encrypt(NULL, NULL);
-select des_decrypt("test", 'anotherkeystr');
-select des_decrypt(1, 1);
-select des_decrypt(des_encrypt("test", 'thekey'));
-
-
-#
-# Test default keys
-#
-select hex(des_encrypt("hello")),des_decrypt(des_encrypt("hello"));
-select des_decrypt(des_encrypt("hello",4));
-select des_decrypt(des_encrypt("hello",'test'),'test');
-select hex(des_encrypt("hello")),hex(des_encrypt("hello",5)),hex(des_encrypt("hello",'default_password'));
-select des_decrypt(des_encrypt("hello"),'default_password');
-select des_decrypt(des_encrypt("hello",4),'password4');
-
-# Test flush
-SET @a=des_decrypt(des_encrypt("hello"));
-flush des_key_file;
-select @a = des_decrypt(des_encrypt("hello"));
-
-# Test usage of wrong password
-select hex("hello");
-select hex(des_decrypt(des_encrypt("hello",4),'password2'));
-select hex(des_decrypt(des_encrypt("hello","hidden")));
-
-# End of 4.1 tests
diff --git a/mysql-test/t/func_encrypt_ucs2.test b/mysql-test/t/func_encrypt_ucs2.test
deleted file mode 100644
index 1242c3b9e6a..00000000000
--- a/mysql-test/t/func_encrypt_ucs2.test
+++ /dev/null
@@ -1,12 +0,0 @@
--- source include/have_des.inc
--- source include/have_ucs2.inc
-
---echo #
---echo # Bug#59648 my_strtoll10_mb2: Assertion `(*endptr - s) % 2 == 0' failed.
---echo #
-
-SELECT CHAR_LENGTH(DES_ENCRYPT(0, CHAR('1' USING ucs2)));
-SELECT CONVERT(DES_ENCRYPT(0, CHAR('1' USING ucs2)),UNSIGNED);
-
-SELECT CHAR_LENGTH(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' USING ucs2)));
-SELECT CONVERT(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' using ucs2)), UNSIGNED);
diff --git a/mysql-test/t/func_equal.test b/mysql-test/t/func_equal.test
deleted file mode 100644
index f17ebb5bd84..00000000000
--- a/mysql-test/t/func_equal.test
+++ /dev/null
@@ -1,46 +0,0 @@
-# Initialise
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-#
-# Testing of the <=> operator
-#
-
-#
-# First some simple tests
-#
-
-select 0<=>0,0.0<=>0.0,0E0=0E0,"A"<=>"A",NULL<=>NULL;
-select 1<=>0,0<=>NULL,NULL<=>0;
-select 1.0<=>0.0,0.0<=>NULL,NULL<=>0.0;
-select "A"<=>"B","A"<=>NULL,NULL<=>"A";
-select 0<=>0.0, 0.0<=>0E0, 0E0<=>"0", 10.0<=>1E1, 10<=>10.0, 10<=>1E1;
-select 1.0<=>0E1,10<=>NULL,NULL<=>0.0, NULL<=>0E0;
-
-#
-# Test with tables
-#
-
-create table t1 (id int, value int);
-create table t2 (id int, value int);
-
-insert into t1 values (1,null);
-insert into t2 values (1,null);
-
-select t1.*, t2.*, t1.value<=>t2.value from t1, t2 where t1.id=t2.id and t1.id=1;
-select * from t1 where id <=>id;
-select * from t1 where value <=> value;
-select * from t1 where id <=> value or value<=>id;
-drop table t1,t2;
-
-#
-# Bug #12612: quoted bigint unsigned value and the use of "in" in where clause
-#
-create table t1 (a bigint unsigned);
-insert into t1 values (4828532208463511553);
-select * from t1 where a = '4828532208463511553';
-select * from t1 where a in ('4828532208463511553');
-drop table t1;
-
---echo #End of 4.1 tests
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
deleted file mode 100644
index 5cbc6969e02..00000000000
--- a/mysql-test/t/func_gconcat.test
+++ /dev/null
@@ -1,990 +0,0 @@
-#
-# simple test of group_concat function
-#
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-
-create table t1 (grp int, a bigint unsigned, c char(10) not null, d char(10) not null);
-insert into t1 values (1,1,"a","a");
-insert into t1 values (2,2,"b","a");
-insert into t1 values (2,3,"c","b");
-insert into t1 values (3,4,"E","a");
-insert into t1 values (3,5,"C","b");
-insert into t1 values (3,6,"D","b");
-insert into t1 values (3,7,"d","d");
-insert into t1 values (3,8,"d","d");
-insert into t1 values (3,9,"D","c");
-
-# Test of MySQL simple request
-select grp,group_concat(c) from t1 group by grp;
-explain extended select grp,group_concat(c) from t1 group by grp;
-select grp,group_concat(a,c) from t1 group by grp;
-select grp,group_concat("(",a,":",c,")") from t1 group by grp;
-
-# Test of MySQL with options
-select grp,group_concat(c separator ",") from t1 group by grp;
-select grp,group_concat(c separator "---->") from t1 group by grp;
-select grp,group_concat(c order by c) from t1 group by grp;
-select grp,group_concat(c order by c desc) from t1 group by grp;
-select grp,group_concat(d order by a) from t1 group by grp;
-select grp,group_concat(d order by a desc) from t1 group by grp;
---disable_warnings
-select grp,group_concat(a order by a,d+c-ascii(c)-a) from t1 group by grp;
-select grp,group_concat(a order by d+c-ascii(c),a) from t1 group by grp;
---enable_warnings
-select grp,group_concat(c order by 1) from t1 group by grp;
-select grp,group_concat(distinct c order by c) from t1 group by grp;
-select grp,group_concat(distinct c order by c desc) from t1 group by grp;
-explain extended select grp,group_concat(distinct c order by c desc) from t1 group by grp;
-select grp,group_concat(c order by c separator ",") from t1 group by grp;
-select grp,group_concat(c order by c desc separator ",") from t1 group by grp;
-select grp,group_concat(distinct c order by c separator ",") from t1 group by grp;
-explain extended select grp,group_concat(distinct c order by c separator ",") from t1 group by grp;
-select grp,group_concat(distinct c order by c desc separator ",") from t1 group by grp;
-
-# Test of SQL_LIST objects
-select grp,group_concat(c order by grp desc) from t1 group by grp order by grp;
-
-
-# Test transfer to real values
-
-select grp, group_concat(a separator "")+0 from t1 group by grp;
-select grp, group_concat(a separator "")+0.0 from t1 group by grp;
-select grp, ROUND(group_concat(a separator "")) from t1 group by grp;
-drop table t1;
-
-# Test NULL values
-
-create table t1 (grp int, c char(10));
-insert into t1 values (1,NULL),(2,"b"),(2,NULL),(3,"E"),(3,NULL),(3,"D"),(3,NULL),(3,NULL),(3,"D"),(4,""),(5,NULL);
-select grp,group_concat(c order by c) from t1 group by grp;
-
-# Test warnings
-
-set group_concat_max_len = 4;
-select grp,group_concat(c) from t1 group by grp;
-show warnings;
-set group_concat_max_len = 1024;
-
-# Test errors
-
---error 1111
-select group_concat(sum(c)) from t1 group by grp;
---error 1054
-select grp,group_concat(c order by 2) from t1 group by grp;
-
-drop table t1;
-
-# Test variable length
-
-create table t1 ( URL_ID int(11), URL varchar(80));
-create table t2 ( REQ_ID int(11), URL_ID int(11));
-insert into t1 values (4,'www.host.com'), (5,'www.google.com'),(5,'www.help.com');
-insert into t2 values (1,4), (5,4), (5,5);
-# Make this order independent
---replace_result www.help.com X www.host.com X www.google.com X
-select REQ_ID, Group_Concat(URL) as URL from t1, t2 where
-t2.URL_ID = t1.URL_ID group by REQ_ID;
-# check min/max function
---replace_result www.help.com X www.host.com X www.google.com X
-select REQ_ID, Group_Concat(URL) as URL, Min(t1.URL_ID) urll,
-Max(t1.URL_ID) urlg from t1, t2 where t2.URL_ID = t1.URL_ID group by REQ_ID;
-
-drop table t1;
-drop table t2;
-
-create table t1 (id int, name varchar(16));
-insert into t1 values (1,'longername'),(1,'evenlongername');
-select ifnull(group_concat(concat(t1.id, ':', t1.name)), 'shortname') as 'without distinct: how it should be' from t1;
-select distinct ifnull(group_concat(concat(t1.id, ':', t1.name)), 'shortname') as 'with distinct: cutoff at length of shortname' from t1;
-drop table t1;
-
-# check zero rows (bug#836)
-create table t1(id int);
-create table t2(id int);
-insert into t1 values(0),(1);
-select group_concat(t1.id) FROM t1,t2;
-drop table t1;
-drop table t2;
-
-# check having
-create table t1 (bar varchar(32));
-insert into t1 values('test1'),('test2');
-select group_concat(bar order by concat(bar,bar)) from t1;
-select group_concat(bar order by concat(bar,bar) desc) from t1;
-select bar from t1 having group_concat(bar)='';
-select bar from t1 having instr(group_concat(bar), "test") > 0;
-select bar from t1 having instr(group_concat(bar order by concat(bar,bar) desc), "test2,test1") > 0;
-drop table t1;
-
-# ORDER BY fix_fields()
-create table t1 (a int, a1 varchar(10));
-create table t2 (a0 int);
-insert into t1 values (0,"a"),(0,"b"),(1,"c");
-insert into t2 values (1),(2),(3);
-select group_concat(a1 order by (t1.a IN (select a0 from t2))) from t1;
-select group_concat(a1 order by (t1.a)) from t1;
-drop table t1, t2;
-
-#
-# Problem with GROUP BY (Bug #2695)
-#
-
-CREATE TABLE t1 (id1 tinyint(4) NOT NULL, id2 tinyint(4) NOT NULL);
-INSERT INTO t1 VALUES (1, 1),(1, 2),(1, 3),(1, 4),(1, 5),(2, 1),(2, 2),(2, 3);
-CREATE TABLE t2 (id1 tinyint(4) NOT NULL);
-INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
-SELECT t1.id1, GROUP_CONCAT(t1.id2 ORDER BY t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 AND t1.id1=1 GROUP BY t1.id1;
-SELECT t1.id1, GROUP_CONCAT(t1.id2 ORDER BY t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1;
-SELECT t1.id1, GROUP_CONCAT(t1.id2 ORDER BY t1.id2 DESC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1;
-SELECT t1.id1, GROUP_CONCAT(t1.id2 ORDER BY 6-t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1;
-
-# The following failed when it was run twice:
-SELECT t1.id1, GROUP_CONCAT(t1.id2,6-t1.id2 ORDER BY 6-t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1;
-SELECT t1.id1, GROUP_CONCAT(t1.id2,6-t1.id2 ORDER BY 6-t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1;
-
-SELECT t1.id1, GROUP_CONCAT(t1.id2,"/",6-t1.id2 ORDER BY 1+0,6-t1.id2,t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1;
-drop table t1,t2;
-
-#
-# Problem with distinct (Bug #3381)
-#
-
-create table t1 (s1 char(10), s2 int not null);
-insert into t1 values ('a',2),('b',2),('c',1),('a',3),('b',4),('c',4);
-select distinct s1 from t1 order by s2,s1;
-select group_concat(distinct s1) from t1;
-select group_concat(distinct s1 order by s2) from t1 where s2 < 4;
-# The following is wrong and needs to be fixed ASAP
-select group_concat(distinct s1 order by s2) from t1;
-drop table t1;
-
-#
-# Test with subqueries (Bug #3319)
-#
-
-create table t1 (a int, c int);
-insert into t1 values (1, 2), (2, 3), (2, 4), (3, 5);
-create table t2 (a int, c int);
-insert into t2 values (1, 5), (2, 4), (3, 3), (3,3);
-select group_concat(c) from t1;
-select group_concat(c order by (select c from t2 where t2.a=t1.a limit 1)) as grp from t1;
-select group_concat(c order by (select mid(group_concat(c order by a),1,5) from t2 where t2.a=t1.a)) as grp from t1;
-select group_concat(c order by (select mid(group_concat(c order by a),1,5) from t2 where t2.a=t1.a) desc) as grp from t1;
-select t1.a, group_concat(c order by (select c from t2 where t2.a=t1.a limit 1)) as grp from t1 group by 1;
-select t1.a, group_concat(c order by (select mid(group_concat(c order by a),1,5) from t2 where t2.a=t1.a)) as grp from t1 group by 1;
-select t1.a, group_concat(c order by (select mid(group_concat(c order by a),1,5) from t2 where t2.a=t1.a) desc) as grp from t1 group by 1;
-
-# The following returns random results as we are sorting on blob addresses
-select group_concat(c order by (select concat(5-t1.c,group_concat(c order by a)) from t2 where t2.a=t1.a)) as grp from t1;
-select group_concat(c order by (select concat(t1.c,group_concat(c)) from t2 where a=t1.a)) as grp from t1;
-
-select a,c,(select group_concat(c order by a) from t2 where a=t1.a) as grp from t1 order by grp;
-drop table t1,t2;
-
-#
-# group_concat of expression with GROUP BY and external GROUP BY
-#
-CREATE TABLE t1 ( a int );
-CREATE TABLE t2 ( a int );
-INSERT INTO t1 VALUES (1), (2);
-INSERT INTO t2 VALUES (1), (2);
-SELECT GROUP_CONCAT(t1.a*t2.a ORDER BY t2.a) FROM t1, t2 GROUP BY t1.a;
-DROP TABLE t1, t2;
-
-#
-# Bug #4035: group_concat() and HAVING
-#
-
-CREATE TABLE t1 (a char(4));
-INSERT INTO t1 VALUES ('John'), ('Anna'), ('Bill');
-SELECT GROUP_CONCAT(a SEPARATOR '||') AS names FROM t1
- HAVING names LIKE '%An%';
-SELECT GROUP_CONCAT(a SEPARATOR '###') AS names FROM t1
- HAVING LEFT(names, 1) ='J';
-DROP TABLE t1;
-
-#
-# check blobs
-#
-
-CREATE TABLE t1 ( a int, b TEXT );
-INSERT INTO t1 VALUES (1,'First Row'), (2,'Second Row');
-SELECT GROUP_CONCAT(b ORDER BY b) FROM t1 GROUP BY a;
-DROP TABLE t1;
-
-#
-# check null values #2
-#
-
-CREATE TABLE t1 (A_ID INT NOT NULL,A_DESC CHAR(3) NOT NULL,PRIMARY KEY (A_ID));
-INSERT INTO t1 VALUES (1,'ABC'), (2,'EFG'), (3,'HIJ');
-CREATE TABLE t2 (A_ID INT NOT NULL,B_DESC CHAR(3) NOT NULL,PRIMARY KEY (A_ID,B_DESC));
-INSERT INTO t2 VALUES (1,'A'),(1,'B'),(3,'F');
-SELECT t1.A_ID, GROUP_CONCAT(t2.B_DESC) AS B_DESC FROM t1 LEFT JOIN t2 ON t1.A_ID=t2.A_ID GROUP BY t1.A_ID ORDER BY t1.A_DESC;
-DROP TABLE t1;
-DROP TABLE t2;
-
-#
-# blobs
-#
-
-create table t1 (a int, b text);
-insert into t1 values (1, 'bb'), (1, 'ccc'), (1, 'a'), (1, 'bb'), (1, 'ccc');
-insert into t1 values (2, 'BB'), (2, 'CCC'), (2, 'A'), (2, 'BB'), (2, 'CCC');
-select group_concat(b) from t1 group by a;
-select group_concat(distinct b) from t1 group by a;
-select group_concat(b order by b) from t1 group by a;
-select group_concat(distinct b order by b) from t1 group by a;
-set local group_concat_max_len=4;
-select group_concat(b) from t1 group by a;
-select group_concat(distinct b) from t1 group by a;
-select group_concat(b order by b) from t1 group by a;
-select group_concat(distinct b order by b) from t1 group by a;
-
-#
-# long blobs
-#
-
-insert into t1 values (1, concat(repeat('1', 300), '2')),
-(1, concat(repeat('1', 300), '2')), (1, concat(repeat('0', 300), '1')),
-(2, concat(repeat('1', 300), '2')), (2, concat(repeat('1', 300), '2')),
-(2, concat(repeat('0', 300), '1'));
-set local group_concat_max_len=1024;
-select group_concat(b) from t1 group by a;
-select group_concat(distinct b) from t1 group by a;
-select group_concat(b order by b) from t1 group by a;
-select group_concat(distinct b order by b) from t1 group by a;
-set local group_concat_max_len=400;
-select group_concat(b) from t1 group by a;
-select group_concat(distinct b) from t1 group by a;
-select group_concat(b order by b) from t1 group by a;
-select group_concat(distinct b order by b) from t1 group by a;
-
-drop table t1;
-
-#
-# Bug#10201
-#
-create table t1 (a varchar(255) character set cp1250 collate cp1250_general_ci,
- b varchar(255) character set koi8r);
-insert into t1 values ('xxx','yyy');
-select collation(a) from t1;
-select collation(group_concat(a)) from t1;
-create table t2 select group_concat(a) as a from t1;
-show create table t2;
-select collation(group_concat(a,_koi8r'test')) from t1;
---error 1267
-select collation(group_concat(a,_koi8r 0xC1C2)) from t1;
---error 1267
-select collation(group_concat(a,b)) from t1;
-drop table t1;
-drop table t2;
-
-#
-# Bug #12829
-# Cannot convert the charset of a GROUP_CONCAT result
-#
-CREATE TABLE t1 (a CHAR(10) CHARACTER SET cp850);
-INSERT INTO t1 VALUES ('');
-SELECT a FROM t1;
-SELECT GROUP_CONCAT(a) FROM t1;
-DROP TABLE t1;
-
-#
-# bug #7769: group_concat returning null is checked in having
-#
-CREATE TABLE t1 (id int);
-SELECT GROUP_CONCAT(id) AS gc FROM t1 HAVING gc IS NULL;
-DROP TABLE t1;
-
-#
-# Bug #8656: Crash with group_concat on alias in outer table
-#
-create table t2 (a int, b int);
-insert into t2 values (1,1), (2,2);
-select b x, (select group_concat(x) from t2) from t2;
-drop table t2;
-
-#
-# Bug #7405: problems with rollup
-#
-
-create table t1 (d int not null auto_increment,primary key(d), a int, b int, c int);
-insert into t1(a,b) values (1,3), (1,4), (1,2), (2,7), (1,1), (1,2), (2,3), (2,3);
-select d,a,b from t1 order by a;
-explain select a, group_concat(b) from t1 group by a with rollup;
-select a, group_concat(b) from t1 group by a with rollup;
-select a, group_concat(distinct b) from t1 group by a with rollup;
-select a, group_concat(b order by b) from t1 group by a with rollup;
-select a, group_concat(distinct b order by b) from t1 group by a with rollup;
-drop table t1;
-
-#
-# Bug #6475
-#
-create table t1 (a char(3), b char(20), primary key (a, b));
-insert into t1 values ('ABW', 'Dutch'), ('ABW', 'English');
-select group_concat(a) from t1 group by b;
-drop table t1;
-#
-# Bug #12095: GROUP_CONCAT for one row table
-#
-
-CREATE TABLE t1 (
- aID smallint(5) unsigned NOT NULL auto_increment,
- sometitle varchar(255) NOT NULL default '',
- bID smallint(5) unsigned NOT NULL,
- PRIMARY KEY (aID),
- UNIQUE KEY sometitle (sometitle)
-);
-INSERT INTO t1 SET sometitle = 'title1', bID = 1;
-INSERT INTO t1 SET sometitle = 'title2', bID = 1;
-
-CREATE TABLE t2 (
- bID smallint(5) unsigned NOT NULL auto_increment,
- somename varchar(255) NOT NULL default '',
- PRIMARY KEY (bID),
- UNIQUE KEY somename (somename)
-);
-INSERT INTO t2 SET somename = 'test';
-
-SELECT COUNT(*), GROUP_CONCAT(DISTINCT t2.somename SEPARATOR ' |')
- FROM t1 JOIN t2 ON t1.bID = t2.bID;
-INSERT INTO t2 SET somename = 'test2';
-SELECT COUNT(*), GROUP_CONCAT(DISTINCT t2.somename SEPARATOR ' |')
- FROM t1 JOIN t2 ON t1.bID = t2.bID;
-DELETE FROM t2 WHERE somename = 'test2';
-SELECT COUNT(*), GROUP_CONCAT(DISTINCT t2.somename SEPARATOR ' |')
- FROM t1 JOIN t2 ON t1.bID = t2.bID;
-
-DROP TABLE t1,t2;
-
-#
-# Bug #12861 hang with group_concat insubquery FROM DUAL
-#
-select * from (select group_concat('c') from DUAL) t;
-
-#
-# Bug #12859 group_concat in subquery cause incorrect not null
-#
-create table t1 ( a int not null default 0);
-select * from (select group_concat(a) from t1) t2;
-select group_concat('x') UNION ALL select 1;
-drop table t1;
-
-#
-# Bug #12863 : missing separators after first empty concatenated elements
-#
-
-CREATE TABLE t1 (id int, a varchar(9));
-INSERT INTO t1 VALUES
- (2, ''), (1, ''), (2, 'x'), (1, 'y'), (3, 'z'), (3, '');
-
-SELECT GROUP_CONCAT(a) FROM t1;
-SELECT GROUP_CONCAT(a ORDER BY a) FROM t1;
-
-SELECT GROUP_CONCAT(a) FROM t1 GROUP BY id;
-SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY id;
-
-DROP TABLE t1;
-
-#
-# Bug #15560: GROUP_CONCAT wasn't ready for WITH ROLLUP queries
-#
-create table t1(f1 int);
-insert into t1 values(1),(2),(3);
-select f1, group_concat(f1+1) from t1 group by f1 with rollup;
-select count(distinct (f1+1)) from t1 group by f1 with rollup;
-drop table t1;
-
-#
-# Bug#14169 type of group_concat() result changed to blob if tmp_table was used
-#
-create table t1 (f1 int unsigned, f2 varchar(255));
-insert into t1 values (1,repeat('a',255)),(2,repeat('b',255));
---enable_metadata
-select f2,group_concat(f1) from t1 group by f2;
---disable_metadata
-drop table t1;
-
-# End of 4.1 tests
-
-#
-# Bug#8568 "GROUP_CONCAT returns string, unless in a UNION in which case
-# returns BLOB": add a test case, the bug can not be repeated any more.
-#
-
-set names latin1;
-create table t1 (a char, b char);
-insert into t1 values ('a', 'a'), ('a', 'b'), ('b', 'a'), ('b', 'b');
-create table t2 select group_concat(b) as a from t1 where a = 'a';
-create table t3 (select group_concat(a) as a from t1 where a = 'a') union
- (select group_concat(b) as a from t1 where a = 'b');
-select charset(a) from t2;
-select charset(a) from t3;
-drop table t1, t2, t3;
-set names default;
-
-#
-# Bug#18281 group_concat changes charset to binary
-#
-create table t1 (c1 varchar(10), c2 int);
-select charset(group_concat(c1 order by c2)) from t1;
-drop table t1;
-
-#
-# Bug #16712: group_concat returns odd string instead of intended result
-#
-CREATE TABLE t1 (a INT(10), b LONGTEXT, PRIMARY KEY (a));
-
-SET GROUP_CONCAT_MAX_LEN = 20000000;
-
-INSERT INTO t1 VALUES (1,REPEAT(CONCAT('A',CAST(CHAR(0) AS BINARY),'B'), 40000));
-INSERT INTO t1 SELECT a + 1, b FROM t1;
-
-SELECT a, CHAR_LENGTH(b) FROM t1;
-SELECT CHAR_LENGTH( GROUP_CONCAT(b) ) FROM t1;
-SET GROUP_CONCAT_MAX_LEN = 1024;
-DROP TABLE t1;
-
-#
-# Bug #22015: crash with GROUP_CONCAT over a derived table that
-# returns the results of aggregation by GROUP_CONCAT
-#
-
-CREATE TABLE t1 (a int, b int);
-
-INSERT INTO t1 VALUES (2,1), (1,2), (2,2), (1,3);
-
-SELECT GROUP_CONCAT(a), x
- FROM (SELECT a, GROUP_CONCAT(b) x FROM t1 GROUP BY a) AS s
- GROUP BY x;
-
-DROP TABLE t1;
-#
-# Bug#23451 GROUP_CONCAT truncates a multibyte utf8 character
-#
-set names utf8;
-create table t1
-(
- x text character set utf8 not null,
- y integer not null
-);
-insert into t1 values (repeat('a', 1022), 0), (repeat(_utf8 0xc3b7, 4), 0);
-let $1= 10;
-while ($1)
-{
- eval set group_concat_max_len= 1022 + $1;
- --disable_result_log
- select @x:=group_concat(x) from t1 group by y;
- --enable_result_log
- select @@group_concat_max_len, length(@x), char_length(@x), right(@x,12), right(HEX(@x),12);
- dec $1;
-}
-drop table t1;
-set group_concat_max_len=1024;
-set names latin1;
-
-#
-# Bug#14169 type of group_concat() result changed to blob if tmp_table was used
-#
-create table t1 (f1 int unsigned, f2 varchar(255));
-insert into t1 values (1,repeat('a',255)),(2,repeat('b',255));
---enable_metadata
-select f2,group_concat(f1) from t1 group by f2;
---disable_metadata
-drop table t1;
-
-#
-# Bug #26815: Unexpected built-in function behavior: group_concat(distinct
-# substring_index())
-#
-CREATE TABLE t1(a TEXT, b CHAR(20));
-INSERT INTO t1 VALUES ("one.1","one.1"),("two.2","two.2"),("one.3","one.3");
-SELECT GROUP_CONCAT(DISTINCT UCASE(a)) FROM t1;
-SELECT GROUP_CONCAT(DISTINCT UCASE(b)) FROM t1;
-DROP TABLE t1;
-
-#
-# Bug #28273: GROUP_CONCAT and ORDER BY: No warning when result gets truncated.
-#
-CREATE TABLE t1( a VARCHAR( 10 ), b INT );
-INSERT INTO t1 VALUES ( repeat( 'a', 10 ), 1),
- ( repeat( 'b', 10 ), 2);
-SET group_concat_max_len = 20;
-SELECT GROUP_CONCAT( a ) FROM t1;
-SELECT GROUP_CONCAT( DISTINCT a ) FROM t1;
-SELECT GROUP_CONCAT( a ORDER BY b ) FROM t1;
-SELECT GROUP_CONCAT( DISTINCT a ORDER BY b ) FROM t1;
-SET group_concat_max_len = DEFAULT;
-DROP TABLE t1;
-# Bug #23856:GROUP_CONCAT and ORDER BY: junk from previous rows for query on I_S
-#
-SET group_concat_max_len= 65535;
-CREATE TABLE t1( a TEXT, b INTEGER );
-INSERT INTO t1 VALUES ( 'a', 0 ), ( 'b', 1 );
-SELECT GROUP_CONCAT( a ORDER BY b ) FROM t1;
-SELECT GROUP_CONCAT(DISTINCT a ORDER BY b) FROM t1;
-SELECT GROUP_CONCAT(DISTINCT a) FROM t1;
-SET group_concat_max_len= 10;
-SELECT GROUP_CONCAT(a ORDER BY b) FROM t1;
-SELECT GROUP_CONCAT(DISTINCT a ORDER BY b) FROM t1;
-SELECT GROUP_CONCAT(DISTINCT a) FROM t1;
-
-SET group_concat_max_len= 65535;
-CREATE TABLE t2( a TEXT );
-INSERT INTO t2 VALUES( REPEAT( 'a', 5000 ) );
-INSERT INTO t2 VALUES( REPEAT( 'b', 5000 ) );
-INSERT INTO t2 VALUES( REPEAT( 'a', 5000 ) );
-SELECT LENGTH( GROUP_CONCAT( DISTINCT a ) ) FROM t2;
-
-CREATE TABLE t3( a TEXT, b INT );
-INSERT INTO t3 VALUES( REPEAT( 'a', 65534 ), 1 );
-INSERT INTO t3 VALUES( REPEAT( 'a', 65535 ), 2 );
-INSERT IGNORE INTO t3 VALUES( REPEAT( 'a', 65536 ), 3 );
-SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 1;
-SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 2;
-SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 3;
-
-SET group_concat_max_len= DEFAULT;
-DROP TABLE t1, t2, t3;
-
-#
-# Bug#29850: Wrong charset of the GROUP_CONCAT result when the select employs
-# a temporary table.
-#
-set names latin1;
-create table t1 (id int, name varchar(20)) DEFAULT CHARSET=utf8;
-insert into t1 (id, name) values (1, "ra");
-insert into t1 (id, name) values (2, "ra");
-select b.id, group_concat(b.name) from t1 a, t1 b group by b.id;
-drop table t1;
-
-#
-# Bug #31154: group_concat() and bit fields;
-#
-create table t1(a bit not null);
-insert ignore into t1 values (), (), ();
-select group_concat(distinct a) from t1;
-select group_concat(distinct a order by a) from t1;
-drop table t1;
-
-create table t1(a bit(2) not null);
-insert into t1 values (1), (0), (0), (3), (1);
-select group_concat(distinct a) from t1;
-select group_concat(distinct a order by a) from t1;
-select group_concat(distinct a order by a desc) from t1;
-drop table t1;
-
-create table t1(a bit(2), b varchar(10), c bit);
-insert into t1 values (1, 'a', 0), (0, 'b', 1), (0, 'c', 0), (3, 'd', 1),
-(1, 'e', 1), (3, 'f', 1), (0, 'g', 1);
-select group_concat(distinct a, c) from t1;
-select group_concat(distinct a, c order by a) from t1;
-select group_concat(distinct a, c) from t1;
-select group_concat(distinct a, c order by a, c) from t1;
-select group_concat(distinct a, c order by a desc, c desc) from t1;
-
-drop table t1;
-
-
-#
-# Bug#30897 GROUP_CONCAT returns extra comma on empty fields
-#
-create table t1 (f1 char(20));
-insert into t1 values (''),('');
-select group_concat(distinct f1) from t1;
-select group_concat(f1) from t1;
-drop table t1;
-# Bug#32798: DISTINCT in GROUP_CONCAT clause fails when ordering by a column
-# with null values
-#'
-CREATE TABLE t1 (a INT, b INT);
-
-INSERT INTO t1 VALUES (1, 1), (2, 2), (2, 3);
-
-SELECT GROUP_CONCAT(DISTINCT a ORDER BY b) FROM t1;
-SELECT GROUP_CONCAT(DISTINCT a ORDER BY b DESC) FROM t1;
-SELECT GROUP_CONCAT(DISTINCT a) FROM t1;
-
-SELECT GROUP_CONCAT(DISTINCT a + 1 ORDER BY 3 - b) FROM t1;
-SELECT GROUP_CONCAT(DISTINCT a + 1 ORDER BY b) FROM t1;
-SELECT GROUP_CONCAT(a ORDER BY 3 - b) FROM t1;
-
-CREATE TABLE t2 (a INT, b INT, c INT, d INT);
-
-# There is one duplicate in the expression list: 1,10
-# There is one duplicate in ORDER BY list, but that shouldnt matter: 1,10
-INSERT INTO t2 VALUES (1,1, 1,1), (1,1, 2,2), (1,2, 2,1), (2,1, 1,2);
-
-SELECT GROUP_CONCAT(DISTINCT a, b ORDER BY c, d) FROM t2;
-SELECT GROUP_CONCAT(DISTINCT a, b ORDER BY d, c) FROM t2;
-
-CREATE TABLE t3 (a INT, b INT, c INT);
-
-INSERT INTO t3 VALUES (1, 1, 1), (2, 1, 2), (3, 2, 1);
-
-SELECT GROUP_CONCAT(DISTINCT a, b ORDER BY b, c) FROM t3;
-SELECT GROUP_CONCAT(DISTINCT a, b ORDER BY c, b) FROM t3;
-
-SELECT GROUP_CONCAT(DISTINCT a, b ORDER BY a, b) FROM t1;
-SELECT GROUP_CONCAT(DISTINCT b, a ORDER BY a, b) FROM t1;
-SELECT GROUP_CONCAT(DISTINCT a, b ORDER BY b, a) FROM t1;
-SELECT GROUP_CONCAT(DISTINCT b, a ORDER BY a, b) FROM t1;
-SELECT GROUP_CONCAT(DISTINCT a ORDER BY a, b) FROM t1;
-SELECT GROUP_CONCAT(DISTINCT b ORDER BY b, a) FROM t1;
-SELECT GROUP_CONCAT(DISTINCT a, b ORDER BY a) FROM t1;
-SELECT GROUP_CONCAT(DISTINCT b, a ORDER BY b) FROM t1;
-
-DROP TABLE t1, t2, t3;
-
-#
-# Bug #34747: crash in debug assertion check after derived table
-#
-CREATE TABLE t1(a INT);
-INSERT INTO t1 VALUES (),();
-SELECT s1.d1 FROM
-(
- SELECT
- t1.a as d1,
- GROUP_CONCAT(DISTINCT t1.a) AS d2
- FROM
- t1 AS t1,
- t1 AS t2
- GROUP BY 1
-) AS s1;
-DROP TABLE t1;
-
-#
-# Bug #35298: GROUP_CONCAT with DISTINCT can crash the server
-#
-
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (a INT);
-
-INSERT INTO t1 VALUES(1);
-
-SELECT GROUP_CONCAT(DISTINCT t2.a) FROM t1 LEFT JOIN t2 ON t2.a = t1.a GROUP BY t1.a;
-
-DROP TABLE t1, t2;
-
-#
-# Bug #36024: group_concat distinct in subquery crash
-#
-
-CREATE TABLE t1 (a INT, KEY(a));
-CREATE TABLE t2 (b INT);
-
-INSERT INTO t1 VALUES (NULL), (8), (2);
-INSERT INTO t2 VALUES (4), (10);
-
-SELECT 1 FROM t1 WHERE t1.a NOT IN
-(
- SELECT GROUP_CONCAT(DISTINCT t1.a)
- FROM t1 WHERE t1.a IN
- (
- SELECT b FROM t2
- )
- AND NOT t1.a >= (SELECT t1.a FROM t1 LIMIT 1)
- GROUP BY t1.a
-);
-
-DROP TABLE t1, t2;
-
-#
-# Bug #49487: crash with explain extended and group_concat in a derived table
-#
-
-CREATE TABLE t1 (f1 INT);
-INSERT INTO t1 VALUES (),();
-
-EXPLAIN EXTENDED SELECT 1 FROM
- (SELECT DISTINCT GROUP_CONCAT(td.f1) FROM t1,t1 AS td GROUP BY td.f1) AS d,t1;
-
-SELECT 1 FROM
- (SELECT DISTINCT GROUP_CONCAT(td.f1) FROM t1,t1 AS td GROUP BY td.f1) AS d,t1;
-
-DROP TABLE t1;
-
---echo End of 5.0 tests
-
---echo #
---echo # Bug #52397: another crash with explain extended and group_concat
---echo #
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (0), (0);
-EXPLAIN EXTENDED SELECT 1 FROM
- (SELECT GROUP_CONCAT(t1.a ORDER BY t1.a ASC) FROM
- t1 t2, t1 GROUP BY t1.a) AS d;
-DROP TABLE t1;
-
-
---echo End of 5.0 tests
-
-
---echo #
---echo # Bug #54476: crash when group_concat and 'with rollup' in prepared statements
---echo #
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1), (2);
-
-PREPARE stmt FROM "SELECT GROUP_CONCAT(t1.a ORDER BY t1.a) FROM t1 JOIN t1 t2 GROUP BY t1.a WITH ROLLUP";
-EXECUTE stmt;
-EXECUTE stmt;
-
-DEALLOCATE PREPARE stmt;
-DROP TABLE t1;
-
---echo #
---echo # Bug#57194 group_concat cause crash and/or invalid memory reads with type errors
---echo #
-
-CREATE TABLE t1(f1 int);
-INSERT INTO t1 values (0),(0);
---disable_ps_protocol
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT POLYGON((SELECT 1 FROM (SELECT 1 IN (GROUP_CONCAT(t1.f1)) FROM t1, t1 t GROUP BY t.f1 ) d));
---enable_ps_protocol
-DROP TABLE t1;
-
---echo #
---echo # Bug#58396 group_concat and explain extended are still crashy
---echo #
-
-CREATE TABLE t1(a INT);
---error ER_UNKNOWN_ERROR
-EXPLAIN EXTENDED SELECT UPDATEXML('1', a, '1')
-FROM t1 ORDER BY (SELECT GROUP_CONCAT(1) FROM t1);
-SHOW WARNINGS;
-DROP TABLE t1;
-
---echo End of 5.1 tests
-
-
-#
-# Bug#36785: Wrong error message when group_concat() exceeds max length
-#
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-CREATE TABLE t1 (a VARCHAR(6), b INT);
-CREATE TABLE t2 (a VARCHAR(6), b INT);
-
-INSERT INTO t1 VALUES ('111111', 1);
-INSERT INTO t1 VALUES ('222222', 2);
-INSERT INTO t1 VALUES ('333333', 3);
-INSERT INTO t1 VALUES ('444444', 4);
-INSERT INTO t1 VALUES ('555555', 5);
-
-SET group_concat_max_len = 5;
-SET @old_sql_mode = @@sql_mode, @@sql_mode = 'traditional';
-
-SELECT GROUP_CONCAT(a), b FROM t1 GROUP BY b LIMIT 3;
---error ER_CUT_VALUE_GROUP_CONCAT
-INSERT INTO t2 SELECT GROUP_CONCAT(a), b FROM t1 GROUP BY b;
-UPDATE t1 SET a = '11111' WHERE b = 1;
-UPDATE t1 SET a = '22222' WHERE b = 2;
---error ER_CUT_VALUE_GROUP_CONCAT
-INSERT INTO t2 SELECT GROUP_CONCAT(a), b FROM t1 GROUP BY b;
-
-SET group_concat_max_len = DEFAULT;
-SET @@sql_mode = @old_sql_mode;
-DROP TABLE t1, t2;
-
-#
-# MDEV-3987 uninitialized read in Item_cond::fix_fields leads to crash: select .. where .. in ( select ... )
-#
-create table t1 (a char(1) character set utf8);
-insert into t1 values ('a'),('b');
-select 1 from t1 where a in (select group_concat(a) from t1);
-drop table t1;
-
-#
-# MDEV-7820 Server crashes in in my_strcasecmp_utf8 on subquery in ORDER BY clause of GROUP_CONCAT
-#
-CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('a'),('b');
-
-CREATE TABLE t2 (f2 VARCHAR(10)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES ('c');
-
-CREATE TABLE t3 (f3 VARCHAR(10)) ENGINE=MyISAM;
-INSERT INTO t3 VALUES ('d'),('e');
-
-SELECT GROUP_CONCAT( f2 ORDER BY ( f2 IN ( SELECT f1 FROM t1 WHERE f1 <= f2 ) ) ) AS field
-FROM ( SELECT * FROM t2 ) AS sq2, t3
-ORDER BY field;
-
-drop table t3, t2, t1;
-
---echo #
---echo # MDEV-7821 - Server crashes in Item_func_group_concat::fix_fields on 2nd
---echo # execution of PS
---echo #
-CREATE TABLE t1(a INT);
-INSERT INTO t1 VALUES(1),(2);
-PREPARE stmt FROM "SELECT GROUP_CONCAT(t1a.a ORDER BY 1, t1a.a=0) FROM t1 AS t1a, t1 AS t1b GROUP BY t1a.a";
-EXECUTE stmt;
-EXECUTE stmt;
-DROP TABLE t1;
-
---echo #
---echo # WL#6098 Eliminate GROUP_CONCAT intermediate result limitation.
---echo # Bug#13387020 GROUP_CONCAT WITH ORDER BY RESULTS ARE TRUNCATED.
---echo #
-
-
-SET group_concat_max_len= 9999999;
-CREATE TABLE t1 (f1 LONGTEXT , f2 INTEGER);
-INSERT INTO t1 VALUES (REPEAT('a', 500000), 0), (REPEAT('b', 500000), 1), (REPEAT('c', 500000), 2);
-
-SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1;
-SELECT LENGTH(GROUP_CONCAT(DISTINCT f1 ORDER BY f1 DESC)) FROM t1;
-SELECT SUBSTRING(GROUP_CONCAT(DISTINCT f1 ORDER BY f1 DESC), 1, 5) FROM t1;
-SELECT LENGTH(GROUP_CONCAT(DISTINCT f1)) FROM t1;
-
-SELECT LENGTH(GROUP_CONCAT(UPPER(f1) ORDER BY f2)) FROM t1;
-SELECT LENGTH(GROUP_CONCAT(DISTINCT UPPER(f1) ORDER BY f1)) FROM t1;
-SELECT SUBSTRING(GROUP_CONCAT(DISTINCT UPPER(f1) ORDER BY f1), 1, 5) FROM t1;
-SELECT LENGTH(GROUP_CONCAT(DISTINCT UPPER(f1))) FROM t1;
-
-CREATE TABLE t2 SELECT GROUP_CONCAT(f1 order by f2) FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE TABLE t2 SELECT GROUP_CONCAT(UPPER(f1) ORDER BY f2) FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-SET group_concat_max_len= 1024;
-SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1;
-
-SET group_concat_max_len= 499999;
-SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1 WHERE f2 = 0;
-SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1 GROUP BY f2;
-
-INSERT INTO t1 VALUES (REPEAT('a', 499999), 3), (REPEAT('b', 500000), 4);
-SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1 GROUP BY f2;
-
-DROP TABLE t1;
-SET group_concat_max_len= DEFAULT;
-
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-10124 Incorrect usage of CUBE/ROLLUP and ORDER BY with GROUP_CONCAT(a ORDER BY a)
---echo #
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (10),(20),(30);
-
-SELECT a,GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP;
-CREATE VIEW v1 AS
-SELECT a,GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP;
-SELECT * FROM v1;
-DROP VIEW v1;
-
-SELECT a,GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30';
-CREATE VIEW v1 AS
-SELECT a,GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30';
-SELECT * FROM v1;
-DROP VIEW v1;
-
-SELECT * FROM (SELECT a,GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30') t1;
-CREATE VIEW v1 AS
-SELECT * FROM (SELECT a,GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30') t1;
-SELECT * FROM v1;
-DROP VIEW v1;
-
-SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30');
-CREATE VIEW v1 AS
-SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP HAVING GROUP_CONCAT(a ORDER BY a)='10,20,30');
-SELECT * FROM v1;
-DROP VIEW v1;
-
-DROP TABLE t1;
-
---echo #
---echo # End of 10.2 tests
---echo #
-
-
---echo #
---echo # Start of 10.3 tests
---echo #
-
-#
-# MDEV-11297: Add support for LIMIT clause in GROUP_CONCAT()
-#
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-
-create table t1 (grp int, a bigint unsigned, c char(10) , d char(10) not null);
-insert into t1 values (1,1,NULL,"a");
-insert into t1 values (1,10,"b","a");
-insert into t1 values (1,11,"c","a");
-insert into t1 values (2,2,"c","a");
-insert into t1 values (2,3,"b","b");
-insert into t1 values (3,4,"E","a");
-insert into t1 values (3,5,"C","b");
-insert into t1 values (3,6,"D","c");
-insert into t1 values (3,7,"E","c");
-
-
-select grp,group_concat(c) from t1 group by grp;
-select grp,group_concat(c limit 1 ) from t1 group by grp;
-select grp,group_concat(c limit 1,1 ) from t1 group by grp;
-select grp,group_concat(c limit 1,10 ) from t1 group by grp;
-select grp,group_concat(c limit 1000) from t1 group by grp;
-select group_concat(grp limit 0) from t1;
---error ER_PARSE_ERROR
-select group_concat(grp limit "sdjadjs") from t1
---error ER_PARSE_ERROR
-select grp,group_concat(c limit 5.5) from t1 group by grp ;
-select grp,group_concat(distinct c limit 1,10 ) from t1 group by grp;
-select grp,group_concat(c order by a) from t1 group by grp;
-select grp,group_concat(c order by a limit 2 ) from t1 group by grp;
-select grp,group_concat(c order by a limit 1,1 ) from t1 group by grp;
-select grp,group_concat(c order by c) from t1 group by grp;
-select grp,group_concat(c order by c limit 2) from t1 group by grp;
-select grp,group_concat(c order by c desc) from t1 group by grp;
-select grp,group_concat(c order by c desc limit 2) from t1 group by grp;
-
-drop table t1;
-
-create table t2 (a int, b varchar(10));
-insert into t2 values(1,'a'),(1,'b'),(NULL,'c'),(2,'x'),(2,'y');
-select group_concat(a,b limit 2) from t2;
-
-set @x=4;
-prepare STMT from 'select group_concat(b limit ?) from t2';
-execute STMT using @x;
-set @x=2;
-execute STMT using @x;
-set @x=1000;
-execute STMT using @x;
-set @x=0;
-execute STMT using @x;
-set @x="adasfa";
---error ER_INVALID_VALUE_TO_LIMIT
-execute STMT using @x;
-set @x=-1;
---error ER_WRONG_ARGUMENTS
-execute STMT using @x;
-set @x=4;
-prepare STMT from 'select group_concat(a,b limit ?) from t2';
-execute STMT using @x;
-drop table t2;
-
---echo #
---echo # End of 10.3 tests
---echo #
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
deleted file mode 100644
index d847f7cd5f7..00000000000
--- a/mysql-test/t/func_group.test
+++ /dev/null
@@ -1,1731 +0,0 @@
-#
-# simple test of all group functions
-#
-
---disable_warnings
-drop table if exists t1,t2,t3,t4,t5,t6;
---enable_warnings
-
-set @sav_dpi= @@div_precision_increment;
-set div_precision_increment= 5;
-show variables like 'div_precision_increment';
-create table t1 (grp int, a bigint unsigned, c char(10) not null);
-insert into t1 values (1,1,"a");
-insert into t1 values (2,2,"b");
-insert into t1 values (2,3,"c");
-insert into t1 values (3,4,"E");
-insert into t1 values (3,5,"C");
-insert into t1 values (3,6,"D");
-
-# Test of MySQL field extension with and without matching records.
-#### Note: The two following statements may fail if the execution plan
-#### or optimizer is changed. The result for column c is undefined.
-select a,c,sum(a) from t1 group by a;
-select a,c,sum(a) from t1 where a > 10 group by a;
-select sum(a) from t1 where a > 10;
-select a from t1 order by rand(10);
-select distinct a from t1 order by rand(10);
-select count(distinct a),count(distinct grp) from t1;
-insert into t1 values (null,null,'');
-select count(distinct a),count(distinct grp) from t1;
-
-select sum(all a),count(all a),avg(all a),std(all a),variance(all a),bit_or(all a),bit_and(all a),min(all a),max(all a),min(all c),max(all c) from t1;
-select grp, sum(a),count(a),avg(a),std(a),variance(a),bit_or(a),bit_and(a),min(a),max(a),min(c),max(c) from t1 group by grp;
---disable_warnings
-select grp, sum(a)+count(a)+avg(a)+std(a)+variance(a)+bit_or(a)+bit_and(a)+min(a)+max(a)+min(c)+max(c) as sum from t1 group by grp;
---enable_warnings
-
-create table t2 (grp int, a bigint unsigned, c char(10));
-insert into t2 select grp,max(a)+max(grp),max(c) from t1 group by grp;
-
-# REPLACE ... SELECT doesn't yet work with PS
-replace into t2 select grp, a, c from t1 limit 2,1;
-select * from t2;
-
-drop table t1,t2;
-
-#
-# Problem with std()
-#
-
-CREATE TABLE t1 (id int(11),value1 float(10,2));
-INSERT INTO t1 VALUES (1,0.00),(1,1.00), (1,2.00), (2,10.00), (2,11.00), (2,12.00);
-CREATE TABLE t2 (id int(11),name char(20));
-INSERT INTO t2 VALUES (1,'Set One'),(2,'Set Two');
-select id, avg(value1), std(value1), variance(value1) from t1 group by id;
-select name, avg(value1), std(value1), variance(value1) from t1, t2 where t1.id = t2.id group by t1.id;
-drop table t1,t2;
-
-#
-# Test of bug in left join & avg
-#
-
-create table t1 (id int not null);
-create table t2 (id int not null,rating int null);
-insert into t1 values(1),(2),(3);
-insert into t2 values(1, 3),(2, NULL),(2, NULL),(3, 2),(3, NULL);
-select t1.id, avg(rating) from t1 left join t2 on ( t1.id = t2.id ) group by t1.id;
-# Test different types with avg()
-select sql_small_result t2.id, avg(rating) from t2 group by t2.id;
-select sql_big_result t2.id, avg(rating) from t2 group by t2.id;
-select sql_small_result t2.id, avg(rating+0.0e0) from t2 group by t2.id;
-select sql_big_result t2.id, avg(rating+0.0e0) from t2 group by t2.id;
-drop table t1,t2;
-
-#
-# test of count
-#
-create table t1 (a smallint(6) primary key, c char(10), b text);
-INSERT INTO t1 VALUES (1,'1','1');
-INSERT INTO t1 VALUES (2,'2','2');
-INSERT INTO t1 VALUES (4,'4','4');
-
-select count(*) from t1;
-select count(*) from t1 where a = 1;
-select count(*) from t1 where a = 100;
-select count(*) from t1 where a >= 10;
-select count(a) from t1 where a = 1;
-select count(a) from t1 where a = 100;
-select count(a) from t1 where a >= 10;
-select count(b) from t1 where b >= 2;
-select count(b) from t1 where b >= 10;
-select count(c) from t1 where c = 10;
-drop table t1;
-
-#
-# Test of bug in COUNT(i)*(i+0)
-#
-
-CREATE TABLE t1 (d DATETIME, i INT);
-INSERT INTO t1 VALUES (NOW(), 1);
-SELECT COUNT(i), i, COUNT(i)*i FROM t1 GROUP BY i;
-SELECT COUNT(i), (i+0), COUNT(i)*(i+0) FROM t1 GROUP BY i;
-DROP TABLE t1;
-
-#
-# Another SUM() problem with 3.23.2
-#
-
-create table t1 (
- num float(5,2),
- user char(20)
-);
-insert into t1 values (10.3,'nem'),(20.53,'monty'),(30.23,'sinisa');
-insert into t1 values (30.13,'nem'),(20.98,'monty'),(10.45,'sinisa');
-insert into t1 values (5.2,'nem'),(8.64,'monty'),(11.12,'sinisa');
-select sum(num) from t1;
-select sum(num) from t1 group by user;
-drop table t1;
-
-#
-# Test problem with MIN() optimization in case of null values
-#
-
-create table t1 (a1 int, a2 char(3), key k1(a1), key k2(a2));
-insert into t1 values(10,'aaa'), (10,null), (10,'bbb'), (20,'zzz');
-create table t2(a1 char(3), a2 int, a3 real, key k1(a1), key k2(a2, a1));
-select * from t1;
-# The following returned NULL in 4.0.10
-select min(a2) from t1;
-select max(t1.a1), max(t2.a2) from t1, t2;
-select max(t1.a1) from t1, t2;
-select max(t2.a2), max(t1.a1) from t1, t2;
-
-explain select min(a2) from t1;
-explain select max(t1.a1), max(t2.a2) from t1, t2;
-
-insert into t2 values('AAA', 10, 0.5);
-insert into t2 values('BBB', 20, 1.0);
-select t1.a1, t1.a2, t2.a1, t2.a2 from t1,t2;
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='outer_join_with_cache=off';
-select max(t1.a1), max(t2.a1) from t1, t2 where t2.a2=9;
-select max(t2.a1), max(t1.a1) from t1, t2 where t2.a2=9;
-select t1.a1, t1.a2, t2.a1, t2.a2 from t1 left outer join t2 on t1.a1=10;
-select max(t1.a2) from t1 left outer join t2 on t1.a1=10;
-select max(t2.a1) from t2 left outer join t1 on t2.a2=10 where t2.a2=20;
-select max(t2.a1) from t2 left outer join t1 on t2.a2=10 where t2.a2=10;
-select max(t2.a1) from t1 left outer join t2 on t1.a2=t2.a1 and 1=0 where t2.a1='AAA';
-select max(t1.a2),max(t2.a1) from t1 left outer join t2 on t1.a1=10;
-SET optimizer_switch=@save_optimizer_switch;
-drop table t1,t2;
-
-#
-# Test of group function and NULL values
-#
-
-CREATE TABLE t1 (a int, b int);
-select count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1;
-select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
-insert into t1 values (1,null);
-select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
-insert into t1 values (1,null);
-insert into t1 values (2,null);
-select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
-select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
-insert into t1 values (2,1);
-select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
-select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
-insert into t1 values (3,1);
-select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
-select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
-explain extended select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
-drop table t1;
-
-#
-# Bug #1972: test for bit_and(), bit_or() and negative values
-#
-create table t1 (col int);
-insert into t1 values (-1), (-2), (-3);
-select bit_and(col), bit_or(col) from t1;
-select SQL_BIG_RESULT bit_and(col), bit_or(col) from t1 group by col;
-drop table t1;
-
-#
-# Bug #3376: avg() and an empty table
-#
-
-create table t1 (a int);
-select avg(2) from t1;
-drop table t1;
-
-#
-# Tests to check MIN/MAX query optimization
-#
-
-# Create database schema
-create table t1(
- a1 char(3) primary key,
- a2 smallint,
- a3 char(3),
- a4 real,
- a5 date,
- key k1(a2,a3),
- key k2(a4 desc,a1),
- key k3(a5,a1)
-);
-create table t2(
- a1 char(3) primary key,
- a2 char(17),
- a3 char(2),
- a4 char(3),
- key k1(a3, a2),
- key k2(a4)
-);
-
-# Populate table t1
-insert into t1 values('AME',0,'SEA',0.100,date'1942-02-19');
-insert into t1 values('HBR',1,'SEA',0.085,date'1948-03-05');
-insert into t1 values('BOT',2,'SEA',0.085,date'1951-11-29');
-insert into t1 values('BMC',3,'SEA',0.085,date'1958-09-08');
-insert into t1 values('TWU',0,'LAX',0.080,date'1969-10-05');
-insert into t1 values('BDL',0,'DEN',0.080,date'1960-11-27');
-insert into t1 values('DTX',1,'NYC',0.080,date'1961-05-04');
-insert into t1 values('PLS',1,'WDC',0.075,date'1949-01-02');
-insert into t1 values('ZAJ',2,'CHI',0.075,date'1960-06-15');
-insert into t1 values('VVV',2,'MIN',0.075,date'1959-06-28');
-insert into t1 values('GTM',3,'DAL',0.070,date'1977-09-23');
-insert into t1 values('SSJ',null,'CHI',null,date'1974-03-19');
-insert into t1 values('KKK',3,'ATL',null,null);
-insert into t1 values('XXX',null,'MIN',null,null);
-insert into t1 values('WWW',1,'LED',null,null);
-
-# Populate table t2
-insert into t2 values('TKF','Seattle','WA','AME');
-insert into t2 values('LCC','Los Angeles','CA','TWU');
-insert into t2 values('DEN','Denver','CO','BDL');
-insert into t2 values('SDC','San Diego','CA','TWU');
-insert into t2 values('NOL','New Orleans','LA','GTM');
-insert into t2 values('LAK','Los Angeles','CA','TWU');
-insert into t2 values('AAA','AAA','AA','AME');
-
-# Show the table contents
-select * from t1;
-select * from t2;
-
-# Queries with min/max functions
-# which regular min/max optimization are applied to
-
-explain
-select min(a1) from t1;
-select min(a1) from t1;
-explain
-select max(a4) from t1;
-select max(a4) from t1;
-explain
-select min(a5), max(a5) from t1;
-select min(a5), max(a5) from t1;
-explain
-select min(a3) from t1 where a2 = 2;
-select min(a3) from t1 where a2 = 2;
-explain
-select min(a1), max(a1) from t1 where a4 = 0.080;
-select min(a1), max(a1) from t1 where a4 = 0.080;
-
-explain
-select min(t1.a5), max(t2.a3) from t1, t2;
-select min(t1.a5), max(t2.a3) from t1, t2;
-explain
-select min(t1.a3), max(t2.a2) from t1, t2 where t1.a2 = 0 and t2.a3 = 'CA';
-select min(t1.a3), max(t2.a2) from t1, t2 where t1.a2 = 0 and t2.a3 = 'CA';
-
-# Queries with min/max functions
-# which extended min/max optimization are applied to
-
-explain
-select min(a1) from t1 where a1 > 'KKK';
-select min(a1) from t1 where a1 > 'KKK';
-explain
-select min(a1) from t1 where a1 >= 'KKK';
-select min(a1) from t1 where a1 >= 'KKK';
-explain
-select max(a3) from t1 where a2 = 2 and a3 < 'SEA';
-select max(a3) from t1 where a2 = 2 and a3 < 'SEA';
-explain
-select max(a5) from t1 where a5 < date'1970-01-01';
-select max(a5) from t1 where a5 < date'1970-01-01';
-explain
-select max(a3) from t1 where a2 is null;
-select max(a3) from t1 where a2 is null;
-explain
-select max(a3) from t1 where a2 = 0 and a3 between 'K' and 'Q';
-select max(a3) from t1 where a2 = 0 and a3 between 'K' and 'Q';
-explain
-select min(a1), max(a1) from t1 where a1 between 'A' and 'P';
-select min(a1), max(a1) from t1 where a1 between 'A' and 'P';
-explain
-select max(a3) from t1 where a3 < 'SEA' and a2 = 2 and a3 <= 'MIN';
-select max(a3) from t1 where a3 < 'SEA' and a2 = 2 and a3 <= 'MIN';
-explain
-select max(a3) from t1 where a3 = 'MIN' and a2 = 2;
-select max(a3) from t1 where a3 = 'MIN' and a2 = 2;
-explain
-select max(a3) from t1 where a3 = 'DEN' and a2 = 2;
-select max(a3) from t1 where a3 = 'DEN' and a2 = 2;
-
-explain
-select max(t1.a3), min(t2.a2) from t1, t2 where t1.a2 = 2 and t1.a3 < 'MIN' and t2.a3 = 'CA';
-select max(t1.a3), min(t2.a2) from t1, t2 where t1.a2 = 2 and t1.a3 < 'MIN' and t2.a3 = 'CA';
-
-explain
-select max(a3) from t1 where a2 is null and a2 = 2;
-select max(a3) from t1 where a2 is null and a2 = 2;
-
-explain
-select max(a2) from t1 where a2 >= 1;
-select max(a2) from t1 where a2 >= 1;
-explain
-select min(a3) from t1 where a2 = 2 and a3 < 'SEA';
-select min(a3) from t1 where a2 = 2 and a3 < 'SEA';
-
-explain
-select min(a3) from t1 where a2 = 4;
-select min(a3) from t1 where a2 = 4;
-explain
-select min(a3) from t1 where a2 = 2 and a3 > 'SEA';
-select min(a3) from t1 where a2 = 2 and a3 > 'SEA';
-explain
-select (min(a4)+max(a4))/2 from t1;
-select (min(a4)+max(a4))/2 from t1;
-explain
-select min(a3) from t1 where 2 = a2;
-select min(a3) from t1 where 2 = a2;
-explain
-select max(a3) from t1 where a2 = 2 and 'SEA' > a3;
-select max(a3) from t1 where a2 = 2 and 'SEA' > a3;
-explain
-select max(a3) from t1 where a2 = 2 and 'SEA' < a3;
-select max(a3) from t1 where a2 = 2 and 'SEA' < a3;
-explain
-select min(a3) from t1 where a2 = 2 and a3 >= 'CHI';
-select min(a3) from t1 where a2 = 2 and a3 >= 'CHI';
-explain
-select min(a3) from t1 where a2 = 2 and a3 >= 'CHI' and a3 < 'SEA';
-select min(a3) from t1 where a2 = 2 and a3 >= 'CHI' and a3 < 'SEA';
-explain
-select min(a3) from t1 where a2 = 2 and a3 >= 'CHI' and a3 = 'MIN';
-select min(a3) from t1 where a2 = 2 and a3 >= 'CHI' and a3 = 'MIN';
-explain
-select min(a3) from t1 where a2 = 2 and a3 >= 'SEA' and a3 = 'MIN';
-select min(a3) from t1 where a2 = 2 and a3 >= 'SEA' and a3 = 'MIN';
-
-explain
-select min(t1.a1), min(t2.a4) from t1,t2 where t1.a1 < 'KKK' and t2.a4 < 'KKK';
-select min(t1.a1), min(t2.a4) from t1,t2 where t1.a1 < 'KKK' and t2.a4 < 'KKK';
-
-# Queries to which max/min optimization is not applied
-
-explain
-select min(a1) from t1 where a1 > 'KKK' or a1 < 'XXX';
-explain
-select min(a1) from t1 where a1 != 'KKK';
-explain
-select max(a3) from t1 where a2 < 2 and a3 < 'SEA';
-explain
-select max(t1.a3), min(t2.a2) from t1, t2 where t1.a2 = 2 and t1.a3 < 'MIN' and t2.a3 > 'CA';
-
-explain
-select min(a4 - 0.01) from t1;
-explain
-select max(a4 + 0.01) from t1;
-explain
-select min(a3) from t1 where (a2 +1 ) is null;
-explain
-select min(a3) from t1 where (a2 + 1) = 2;
-explain
-select min(a3) from t1 where 2 = (a2 + 1);
-explain
-select min(a2) from t1 where a2 < 2 * a2 - 8;
-explain
-select min(a1) from t1 where a1 between a3 and 'KKK';
-explain
-select min(a4) from t1 where (a4 + 0.01) between 0.07 and 0.08;
-explain
-select concat(min(t1.a1),min(t2.a4)) from t1, t2 where t2.a4 <> 'AME';
-drop table t1, t2;
-
-# Moved to func_group_innodb
-#--disable_warnings
-#create table t1 (USR_ID integer not null, MAX_REQ integer not null, constraint PK_SEA_USER primary key (USR_ID)) engine=InnoDB;
-#--enable_warnings
-#insert into t1 values (1, 3);
-#select count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ from t1 group by MAX_REQ;
-#select Case When Count(*) < MAX_REQ Then 1 Else 0 End from t1 where t1.USR_ID = 1 group by MAX_REQ;
-#drop table t1;
-
-
-create table t1 (a char(10));
-insert into t1 values ('a'),('b'),('c');
-select coercibility(max(a)) from t1;
-drop table t1;
-
-#
-# Bug #6658 MAX(column) returns incorrect coercibility
-#
-create table t1 (a char character set latin2);
-insert into t1 values ('a'),('b');
-select charset(max(a)), coercibility(max(a)),
- charset(min(a)), coercibility(min(a)) from t1;
-show create table t1;
-create table t2 select max(a),min(a) from t1;
-show create table t2;
-drop table t2;
-create table t2 select concat(a) from t1;
-show create table t2;
-drop table t2,t1;
-
-#
-# aggregate functions on static tables
-#
-create table t1 (a int);
-insert into t1 values (1);
-select max(a) as b from t1 having b=1;
-select a from t1 having a=1;
-drop table t1;
-
-#
-# Bug #3435: variance(const), stddev(const) and an empty table
-#
-
-create table t1 (a int);
-select variance(2) from t1;
-select stddev(2) from t1;
-drop table t1;
-
-
-#
-# cleunup() of optimized away count(*) and max/min
-#
-create table t1 (a int);
-insert into t1 values (1),(2);
-prepare stmt1 from 'SELECT COUNT(*) FROM t1';
-execute stmt1;
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-drop table t1;
-
-create table t1 (a int, primary key(a));
-insert into t1 values (1),(2);
-prepare stmt1 from 'SELECT max(a) FROM t1';
-execute stmt1;
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-drop table t1;
-
-#
-# Bug #5406 min/max optimization for empty set
-#
-
-CREATE TABLE t1 (a int primary key);
-INSERT INTO t1 VALUES (1),(2),(3),(4);
-
-SELECT MAX(a) FROM t1 WHERE a > 5;
-SELECT MIN(a) FROM t1 WHERE a < 0;
-
-DROP TABLE t1;
-
-#
-# Bug #5555 GROUP BY enum_field" returns incorrect results
-#
-
-CREATE TABLE t1 (
- id int(10) unsigned NOT NULL auto_increment,
- val enum('one','two','three') NOT NULL default 'one',
- PRIMARY KEY (id)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-
-INSERT INTO t1 VALUES
-(1,'one'),(2,'two'),(3,'three'),(4,'one'),(5,'two');
-
-select val, count(*) from t1 group by val;
-drop table t1;
-
-CREATE TABLE t1 (
- id int(10) unsigned NOT NULL auto_increment,
- val set('one','two','three') NOT NULL default 'one',
- PRIMARY KEY (id)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-
-INSERT INTO t1 VALUES
-(1,'one'),(2,'two'),(3,'three'),(4,'one'),(5,'two');
-
-select val, count(*) from t1 group by val;
-drop table t1;
-
-#
-# Bug #5615: type of aggregate function column wrong when using group by
-#
-
-create table t1(a int, b datetime);
-insert into t1 values (1, NOW()), (2, NOW());
-create table t2 select MAX(b) from t1 group by a;
-show create table t2;
-drop table t1, t2;
-
-#
-# Bug 7833: Wrong datatype of aggregate column is returned
-#
-
-create table t1(f1 datetime);
-insert into t1 values (now());
-create table t2 select f2 from (select max(now()) f2 from t1) a;
-show columns from t2;
-drop table t2;
-create table t2 select f2 from (select now() f2 from t1) a;
-show columns from t2;
-drop table t2, t1;
-
-#
-# Bug 8893: wrong result for min/max optimization with 2 indexes
-#
-
-CREATE TABLE t1(
- id int PRIMARY KEY,
- a int,
- b int,
- INDEX i_b_id(a,b,id),
- INDEX i_id(a,id)
-);
-INSERT INTO t1 VALUES
- (1,1,4), (2,2,1), (3,1,3), (4,2,1), (5,1,1);
-SELECT MAX(id) FROM t1 WHERE id < 3 AND a=2 AND b=6;
-DROP TABLE t1;
-
-# change the order of the last two index definitions
-
-CREATE TABLE t1(
- id int PRIMARY KEY,
- a int,
- b int,
- INDEX i_id(a,id),
- INDEX i_b_id(a,b,id)
-);
-INSERT INTO t1 VALUES
- (1,1,4), (2,2,1), (3,1,3), (4,2,1), (5,1,1);
-SELECT MAX(id) FROM t1 WHERE id < 3 AND a=2 AND b=6;
-DROP TABLE t1;
-
-
-#
-# Bug #12882 min/max inconsistent on empty table
-#
-# Test case moved to func_group_innodb
-#
-# Bug #18206: min/max optimization cannot be applied to partial index
-#
-
-CREATE TABLE t1 (id int PRIMARY KEY, b char(3), INDEX(b));
-INSERT INTO t1 VALUES (1,'xx'), (2,'aa');
-SELECT * FROM t1;
-
-SELECT MAX(b) FROM t1 WHERE b < 'ppppp';
-SHOW WARNINGS;
-SELECT MAX(b) FROM t1 WHERE b < 'pp';
-DROP TABLE t1;
-
-CREATE TABLE t1 (id int PRIMARY KEY, b char(16), INDEX(b(4)));
-INSERT INTO t1 VALUES (1, 'xxxxbbbb'), (2, 'xxxxaaaa');
-SELECT MAX(b) FROM t1;
-EXPLAIN SELECT MAX(b) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (id int , b varchar(512), INDEX(b(250))) COLLATE latin1_bin;
-INSERT INTO t1 VALUES
- (1,CONCAT(REPEAT('_', 250), "qq")), (1,CONCAT(REPEAT('_', 250), "zz")),
- (1,CONCAT(REPEAT('_', 250), "aa")), (1,CONCAT(REPEAT('_', 250), "ff"));
-
-SELECT MAX(b) FROM t1;
-EXPLAIN SELECT MAX(b) FROM t1;
-DROP TABLE t1;
-#
-# Bug #16792 query with subselect, join, and group not returning proper values
-#
-CREATE TABLE t1 (a INT, b INT);
-INSERT INTO t1 VALUES (1,1),(1,2),(2,3);
-
-SELECT (SELECT COUNT(DISTINCT t1.b)) FROM t1 GROUP BY t1.a;
-SELECT (SELECT COUNT(DISTINCT 12)) FROM t1 GROUP BY t1.a;
-# an attempt to test all aggregate function with no table.
-SELECT AVG(2), BIT_AND(2), BIT_OR(2), BIT_XOR(2), COUNT(*), COUNT(12),
- COUNT(DISTINCT 12), MIN(2),MAX(2),STD(2), VARIANCE(2),SUM(2),
- GROUP_CONCAT(2),GROUP_CONCAT(DISTINCT 2);
-DROP TABLE t1;
-
-# End of 4.1 tests
-
-#
-# decimal-related tests
-#
-create table t2 (ff double);
-insert into t2 values (2.2);
-select cast(sum(distinct ff) as decimal(5,2)) from t2;
-select cast(sum(distinct ff) as signed) from t2;
-select cast(variance(ff) as decimal(10,3)) from t2;
-select cast(min(ff) as decimal(5,2)) from t2;
-
-create table t1 (df decimal(5,1));
-insert into t1 values(1.1);
-insert into t1 values(2.2);
-select cast(sum(distinct df) as signed) from t1;
-select cast(min(df) as signed) from t1;
-select 1e8 * sum(distinct df) from t1;
-select 1e8 * min(df) from t1;
-
-create table t3 (ifl int);
-insert into t3 values(1), (2);
-select cast(min(ifl) as decimal(5,2)) from t3;
-
-drop table t1, t2, t3;
-
-
-#
-# BUG#3190, WL#1639: Standard Deviation STDDEV - 2 different calculations
-#
-
-CREATE TABLE t1 (id int(11),value1 float(10,2));
-INSERT INTO t1 VALUES (1,0.00),(1,1.00), (1,2.00), (2,10.00), (2,11.00), (2,12.00), (2,13.00);
-select id, stddev_pop(value1), var_pop(value1), stddev_samp(value1), var_samp(value1) from t1 group by id;
-DROP TABLE t1;
-
-#
-# BUG#8464 decimal AVG returns incorrect result
-#
-
-CREATE TABLE t1 (col1 decimal(16,12));
-INSERT INTO t1 VALUES (-5.00000000001),(-5.00000000002),(-5.00000000003),(-5.00000000000),(-5.00000000001),(-5.00000000002);
-insert into t1 select * from t1;
-select col1,count(col1),sum(col1),avg(col1) from t1 group by col1;
-DROP TABLE t1;
-
-#
-# BUG#8465 decimal MIN and MAX return incorrect result
-#
-
-create table t1 (col1 decimal(16,12));
-insert into t1 values (-5.00000000001);
-insert into t1 values (-5.00000000001);
-select col1,sum(col1),max(col1),min(col1) from t1 group by col1;
-delete from t1;
-insert into t1 values (5.00000000001);
-insert into t1 values (5.00000000001);
-select col1,sum(col1),max(col1),min(col1) from t1 group by col1;
-DROP TABLE t1;
-
-#
-# Test that new VARCHAR correctly works with COUNT(DISTINCT)
-#
-
-CREATE TABLE t1 (a VARCHAR(400));
-INSERT INTO t1 (a) VALUES ("A"), ("a"), ("a "), ("a "),
- ("B"), ("b"), ("b "), ("b ");
-SELECT COUNT(DISTINCT a) FROM t1;
-DROP TABLE t1;
-
-#
-# Test for buf #9210: GROUP BY with expression if a decimal type
-#
-
-CREATE TABLE t1 (a int, b int, c int);
-INSERT INTO t1 (a, b, c) VALUES
- (1,1,1), (1,1,2), (1,1,3),
- (1,2,1), (1,2,2), (1,2,3),
- (1,3,1), (1,3,2), (1,3,3),
- (2,1,1), (2,1,2), (2,1,3),
- (2,2,1), (2,2,2), (2,2,3),
- (2,3,1), (2,3,2), (2,3,3),
- (3,1,1), (3,1,2), (3,1,3),
- (3,2,1), (3,2,2), (3,2,3),
- (3,3,1), (3,3,2), (3,3,3);
-
-SELECT b/c as v, a FROM t1 ORDER BY v;
-SELECT b/c as v, SUM(a) FROM t1 GROUP BY v;
-SELECT SUM(a) FROM t1 GROUP BY b/c;
-
-DROP TABLE t1;
-set div_precision_increment= @sav_dpi;
-
-#
-# Bug #20868: Client connection is broken on SQL query error
-#
-CREATE TABLE t1 (a INT PRIMARY KEY, b INT);
-INSERT INTO t1 VALUES (1,1), (2,2);
-
-CREATE TABLE t2 (a INT PRIMARY KEY, b INT);
-INSERT INTO t2 VALUES (1,1), (3,3);
-
-SELECT SQL_NO_CACHE
- (SELECT SUM(c.a) FROM t1 ttt, t2 ccc
- WHERE ttt.a = ccc.b AND ttt.a = t.a GROUP BY ttt.a) AS minid
-FROM t1 t, t2 c WHERE t.a = c.b;
-
-DROP TABLE t1,t2;
-
-#
-# Bug #10966: Variance functions return wrong data type
-#
-
-create table t1 select variance(0);
-show create table t1;
-drop table t1;
-create table t1 select stddev(0);
-show create table t1;
-drop table t1;
-
-
-#
-# Bug#22555: STDDEV yields positive result for groups with only one row
-#
-
-create table bug22555 (i smallint primary key auto_increment, s1 smallint, s2 smallint, e decimal(30,10), o double);
-insert into bug22555 (s1, s2, e, o) values (53, 78, 11.4276528, 6.828112), (17, 78, 5.916793, 1.8502951), (18, 76, 2.679231, 9.17975591), (31, 62, 6.07831, 0.1), (19, 41, 5.37463, 15.1), (83, 73, 14.567426, 7.959222), (92, 53, 6.10151, 13.1856852), (7, 12, 13.92272, 3.442007), (92, 35, 11.95358909, 6.01376678), (38, 84, 2.572, 7.904571);
-select std(s1/s2) from bug22555 group by i;
-select std(e) from bug22555 group by i;
-select std(o) from bug22555 group by i;
-drop table bug22555;
-
-create table bug22555 (i smallint, s1 smallint, s2 smallint, o1 double, o2 double, e1 decimal, e2 decimal);
-insert into bug22555 values (1,53,78,53,78,53,78),(2,17,78,17,78,17,78),(3,18,76,18,76,18,76);
-select i, count(*) from bug22555 group by i;
-select std(s1/s2) from bug22555 where i=1;
-select std(s1/s2) from bug22555 where i=2;
-select std(s1/s2) from bug22555 where i=3;
-select std(s1/s2) from bug22555 where i=1 group by i;
-select std(s1/s2) from bug22555 where i=2 group by i;
-select std(s1/s2) from bug22555 where i=3 group by i;
-select std(s1/s2) from bug22555 group by i order by i;
-select i, count(*), std(o1/o2) from bug22555 group by i order by i;
-select i, count(*), std(e1/e2) from bug22555 group by i order by i;
-set @saved_div_precision_increment=@@div_precision_increment;
-set div_precision_increment=19;
-select i, count(*), variance(s1/s2) from bug22555 group by i order by i;
-select i, count(*), variance(o1/o2) from bug22555 group by i order by i;
-select i, count(*), variance(e1/e2) from bug22555 group by i order by i;
-select i, count(*), std(s1/s2) from bug22555 group by i order by i;
-select i, count(*), std(o1/o2) from bug22555 group by i order by i;
-select i, count(*), std(e1/e2) from bug22555 group by i order by i;
-set div_precision_increment=20;
-select i, count(*), variance(s1/s2) from bug22555 group by i order by i;
-select i, count(*), variance(o1/o2) from bug22555 group by i order by i;
-select i, count(*), variance(e1/e2) from bug22555 group by i order by i;
-select i, count(*), std(s1/s2) from bug22555 group by i order by i;
-select i, count(*), std(o1/o2) from bug22555 group by i order by i;
-select i, count(*), std(e1/e2) from bug22555 group by i order by i;
-set @@div_precision_increment=@saved_div_precision_increment;
-insert into bug22555 values (1,53,78,53,78,53,78),(2,17,78,17,78,17,78),(3,18,76,18,76,18,76);
-insert into bug22555 values (1,53,78,53,78,53,78),(2,17,78,17,78,17,78),(3,18,76,18,76,18,76);
-insert into bug22555 values (1,53,78,53,78,53,78),(2,17,78,17,78,17,78),(3,18,76,18,76,18,76);
-
-select i, count(*), std(s1/s2) from bug22555 group by i order by i;
-select i, count(*), round(std(o1/o2), 16) from bug22555 group by i order by i;
-select i, count(*), std(e1/e2) from bug22555 group by i order by i;
-select std(s1/s2) from bug22555;
-select std(o1/o2) from bug22555;
-select std(e1/e2) from bug22555;
-set @saved_div_precision_increment=@@div_precision_increment;
-set div_precision_increment=19;
-select i, count(*), std(s1/s2) from bug22555 group by i order by i;
-select i, count(*), round(std(o1/o2), 16) from bug22555 group by i order by i;
-select i, count(*), std(e1/e2) from bug22555 group by i order by i;
-select round(std(s1/s2), 17) from bug22555;
-select std(o1/o2) from bug22555;
-select round(std(e1/e2), 17) from bug22555;
-set div_precision_increment=20;
-select i, count(*), std(s1/s2) from bug22555 group by i order by i;
-select i, count(*), round(std(o1/o2), 16) from bug22555 group by i order by i;
-select i, count(*), std(e1/e2) from bug22555 group by i order by i;
-select round(std(s1/s2), 17) from bug22555;
-select std(o1/o2) from bug22555;
-select round(std(e1/e2), 17) from bug22555;
-set @@div_precision_increment=@saved_div_precision_increment;
-drop table bug22555;
-
-create table bug22555 (s smallint, o double, e decimal);
-insert into bug22555 values (1,1,1),(2,2,2),(3,3,3),(6,6,6),(7,7,7);
-select var_samp(s), var_pop(s) from bug22555;
-select var_samp(o), var_pop(o) from bug22555;
-select var_samp(e), var_pop(e) from bug22555;
-drop table bug22555;
-
-create table bug22555 (s smallint, o double, e decimal);
-insert into bug22555 values (null,null,null),(null,null,null);
-select var_samp(s) as 'null', var_pop(s) as 'null' from bug22555;
-select var_samp(o) as 'null', var_pop(o) as 'null' from bug22555;
-select var_samp(e) as 'null', var_pop(e) as 'null' from bug22555;
-insert into bug22555 values (1,1,1);
-select var_samp(s) as 'null', var_pop(s) as '0' from bug22555;
-select var_samp(o) as 'null', var_pop(o) as '0' from bug22555;
-select var_samp(e) as 'null', var_pop(e) as '0' from bug22555;
-insert into bug22555 values (2,2,2);
-select var_samp(s) as '0.5', var_pop(s) as '0.25' from bug22555;
-select var_samp(o) as '0.5', var_pop(o) as '0.25' from bug22555;
-select var_samp(e) as '0.5', var_pop(e) as '0.25' from bug22555;
-drop table bug22555;
-
-
-#
-# Bug #21976: Unnecessary warning with count(decimal)
-#
-
-create table t1 (a decimal(20));
-insert into t1 values (12345678901234567890);
-select count(a) from t1;
-select count(distinct a) from t1;
-drop table t1;
-
-#
-# Bug #23184: SELECT causes server crash
-#
-CREATE TABLE t1 (a INT, b INT);
-INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(1,8);
-INSERT INTO t1 SELECT a, b+8 FROM t1;
-INSERT INTO t1 SELECT a, b+16 FROM t1;
-INSERT INTO t1 SELECT a, b+32 FROM t1;
-INSERT INTO t1 SELECT a, b+64 FROM t1;
-INSERT INTO t1 SELECT a, b+128 FROM t1;
-INSERT INTO t1 SELECT a, b+256 FROM t1;
-INSERT INTO t1 SELECT a, b+512 FROM t1;
-INSERT INTO t1 SELECT a, b+1024 FROM t1;
-INSERT INTO t1 SELECT a, b+2048 FROM t1;
-INSERT INTO t1 SELECT a, b+4096 FROM t1;
-INSERT INTO t1 SELECT a, b+8192 FROM t1;
-INSERT INTO t1 SELECT a, b+16384 FROM t1;
-INSERT INTO t1 SELECT a, b+32768 FROM t1;
-SELECT a,COUNT(DISTINCT b) AS cnt FROM t1 GROUP BY a HAVING cnt > 50;
-SELECT a,SUM(DISTINCT b) AS sumation FROM t1 GROUP BY a HAVING sumation > 50;
-SELECT a,AVG(DISTINCT b) AS average FROM t1 GROUP BY a HAVING average > 50;
-
-DROP TABLE t1;
-
-#
-# Bug #27573: MIN() on an indexed column which is always NULL sets _other_
-# results to NULL
-#
-CREATE TABLE t1 ( a INT, b INT, KEY(a) );
-INSERT INTO t1 VALUES (NULL, 1), (NULL, 2);
-EXPLAIN SELECT MIN(a), MIN(b) FROM t1;
-SELECT MIN(a), MIN(b) FROM t1;
-
-CREATE TABLE t2( a INT, b INT, c INT, KEY(a, b) );
-INSERT INTO t2 ( a, b, c ) VALUES ( 1, NULL, 2 ), ( 1, 3, 4 ), ( 1, 4, 4 );
-EXPLAIN SELECT MIN(b), MIN(c) FROM t2 WHERE a = 1;
-SELECT MIN(b), MIN(c) FROM t2 WHERE a = 1;
-
-CREATE TABLE t3 (a INT, b INT, c int, KEY(a, b));
-INSERT INTO t3 VALUES (1, NULL, 1), (2, NULL, 2), (2, NULL, 2), (3, NULL, 3);
-EXPLAIN SELECT MIN(a), MIN(b) FROM t3 where a = 2;
-SELECT MIN(a), MIN(b) FROM t3 where a = 2;
-
-CREATE TABLE t4 (a INT, b INT, c int, KEY(a, b));
-INSERT INTO t4 VALUES (1, 1, 1), (2, NULL, 2), (2, NULL, 2), (3, 1, 3);
-EXPLAIN SELECT MIN(a), MIN(b) FROM t4 where a = 2;
-SELECT MIN(a), MIN(b) FROM t4 where a = 2;
-SELECT MIN(b), min(c) FROM t4 where a = 2;
-
-CREATE TABLE t5( a INT, b INT, KEY( a, b) );
-INSERT INTO t5 VALUES( 1, 1 ), ( 1, 2 );
-EXPLAIN SELECT MIN(a), MIN(b) FROM t5 WHERE a = 1;
-SELECT MIN(a), MIN(b) FROM t5 WHERE a = 1;
-SELECT MIN(a), MIN(b) FROM t5 WHERE a = 1 and b > 1;
-
-DROP TABLE t1, t2, t3, t4, t5;
-
-#
-# Bug #31156: mysqld: item_sum.cc:918:
-# virtual bool Item_sum_distinct::setup(THD*): Assertion
-#
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 values (),(),();
-SELECT (SELECT SLEEP(0) FROM t1 ORDER BY AVG(DISTINCT a) ) as x FROM t1
- GROUP BY x;
-SELECT 1 FROM t1 GROUP BY (SELECT SLEEP(0) FROM t1 ORDER BY AVG(DISTINCT a) );
-
-DROP TABLE t1;
-
-#
-# Bug #30715: Assertion failed: item_field->field->real_maybe_null(), file
-# .\opt_sum.cc, line
-#
-
-CREATE TABLE t1 (a int, b date NOT NULL, KEY k1 (a,b));
-SELECT MIN(b) FROM t1 WHERE a=1 AND b>'2007-08-01';
-DROP TABLE t1;
-
-#
-# Bug #31794: no syntax error on SELECT id FROM t HAVING count(*)>2;
-#
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1),(2),(3),(4);
-
-SET SQL_MODE=ONLY_FULL_GROUP_BY;
---error ER_MIX_OF_GROUP_FUNC_AND_FIELDS
-SELECT a FROM t1 HAVING COUNT(*)>2;
---error ER_MIX_OF_GROUP_FUNC_AND_FIELDS
-SELECT COUNT(*), a FROM t1;
-
-SET SQL_MODE=DEFAULT;
-SELECT a FROM t1 HAVING COUNT(*)>2;
-SELECT COUNT(*), a FROM t1;
-
-DROP TABLE t1;
-
-#
-# Bug #33133: Views are not transparent
-#
-
-set SQL_MODE=ONLY_FULL_GROUP_BY;
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1),(2),(3),(4);
-CREATE VIEW v1 AS SELECT a,(a + 1) AS y FROM t1;
-EXPLAIN EXTENDED SELECT y FROM v1 GROUP BY v1.y;
-
-DROP VIEW v1;
-DROP TABLE t1;
-SET SQL_MODE=DEFAULT;
-
-#
-# Bug #34512: CAST( AVG( double ) AS DECIMAL ) returns wrong results
-#
-
-CREATE TABLE t1(a DOUBLE);
-INSERT INTO t1 VALUES (10), (20);
-SELECT AVG(a), CAST(AVG(a) AS DECIMAL) FROM t1;
-
-DROP TABLE t1;
-
-#
-# Bug #37348: Crash in or immediately after JOIN::make_sum_func_list
-#
-
-CREATE TABLE derived1 (a bigint(21));
-INSERT INTO derived1 VALUES (2);
-
-
-CREATE TABLE D (
- pk int(11) NOT NULL AUTO_INCREMENT,
- int_nokey int(11) DEFAULT NULL,
- int_key int(11) DEFAULT NULL,
- filler blob,
- PRIMARY KEY (pk),
- KEY int_key (int_key)
-);
-
-INSERT INTO D VALUES
- (39,40,4,repeat(' X', 42)),
- (43,56,4,repeat(' X', 42)),
- (47,12,4,repeat(' X', 42)),
- (71,28,4,repeat(' X', 42)),
- (76,54,4,repeat(' X', 42)),
- (83,45,4,repeat(' X', 42)),
- (105,53,12,NULL);
-
-SELECT
- (SELECT COUNT( int_nokey )
- FROM derived1 AS X
- WHERE
- X.int_nokey < 61
- GROUP BY pk
- LIMIT 1)
-FROM D AS X
-WHERE X.int_key < 13
-GROUP BY int_nokey LIMIT 1;
-
-DROP TABLE derived1;
-DROP TABLE D;
-
-#
-# Bug #39656: Behaviour different for agg functions with & without where -
-# ONLY_FULL_GROUP_BY
-# MDEV-5617 mysqld crashes when running a query with ONLY_FULL_GROUP_BY
-#
-
-CREATE TABLE t1 (a INT, b INT);
-INSERT INTO t1 VALUES (1,1), (1,2), (1,3);
-CREATE TABLE t2 (b INT);
-INSERT INTO t2 VALUES (3),(4);
-
-SET SQL_MODE='ONLY_FULL_GROUP_BY';
-
-SELECT COUNT(*) FROM t1;
-SELECT COUNT(*) FROM t1 where a=1;
-
---error ER_MIX_OF_GROUP_FUNC_AND_FIELDS
-SELECT COUNT(*),a FROM t1;
-
-SELECT COUNT(*) FROM t1 a JOIN t1 b ON a.a= b.a;
-
---error ER_MIX_OF_GROUP_FUNC_AND_FIELDS
-SELECT COUNT(*), (SELECT count(*) FROM t1 inr WHERE inr.a = outr.a)
- FROM t1 outr;
-
---error ER_MIX_OF_GROUP_FUNC_AND_FIELDS
-SELECT COUNT(*) FROM t1 outr, (SELECT b, count(*) FROM t2) as t3;
-
-SELECT COUNT(*) FROM t1 outr where (1,1) in (SELECT a, count(*) FROM t2);
-
-SELECT COUNT(*) FROM t1 a JOIN t1 outr
- ON a.a= (SELECT count(*) FROM t1 inr WHERE inr.a = outr.a);
-
-SELECT * FROM (SELECT a FROM t1 GROUP BY a) sq JOIN t2 ON a = b;
-
-SET SQL_MODE=default;
-DROP TABLE t1,t2;
-
-
-###
---echo End of 5.0 tests
-
---echo #
---echo # BUG#47280 - strange results from count(*) with order by multiple
---echo # columns without where/group
---echo #
-
---echo #
---echo # Initialize test
---echo #
-
-CREATE TABLE t1 (
- pk INT NOT NULL,
- i INT,
- PRIMARY KEY (pk)
-);
-INSERT INTO t1 VALUES (1,11),(2,12),(3,13);
-
---echo #
---echo # Start test
---echo # All the following queries shall return 1 record
---echo #
-
---echo
---echo # Masking all correct values {11...13} for column i in this result.
---replace_column 2 #
-SELECT MAX(pk) as max, i
-FROM t1
-ORDER BY max;
-
---echo
-EXPLAIN
-SELECT MAX(pk) as max, i
-FROM t1
-ORDER BY max;
-
---echo
---echo # Only 11 is correct for collumn i in this result
-SELECT MAX(pk) as max, i
-FROM t1
-WHERE pk<2
-ORDER BY max;
-
---echo #
---echo # Cleanup
---echo #
-DROP TABLE t1;
-
---echo #
---echo # Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
---echo #
-create table t1 (f1 year(2), f2 year(4), f3 date, f4 datetime);
-insert into t1 values
- (98,1998,19980101,"1998-01-01 00:00:00"),
- (00,2000,20000101,"2000-01-01 00:00:01"),
- (02,2002,20020101,"2002-01-01 23:59:59"),
- (60,2060,20600101,"2060-01-01 11:11:11"),
- (70,1970,19700101,"1970-11-11 22:22:22"),
- (NULL,NULL,NULL,NULL),
- (71,1971,19710101,"1971-11-11 22:22:22");
-select min(f1),max(f1) from t1;
-select min(f2),max(f2) from t1;
-select min(f3),max(f3) from t1;
-select min(f4),max(f4) from t1;
-select a.f1 as a, b.f1 as b, a.f1 > b.f1 as gt,
- a.f1 < b.f1 as lt, a.f1<=>b.f1 as eq
-from t1 a, t1 b;
-select a.f1 as a, b.f2 as b, a.f1 > b.f2 as gt,
- a.f1 < b.f2 as lt, a.f1<=>b.f2 as eq
-from t1 a, t1 b;
-select a.f1 as a, b.f3 as b, a.f1 > b.f3 as gt,
- a.f1 < b.f3 as lt, a.f1<=>b.f3 as eq
-from t1 a, t1 b;
-select a.f1 as a, b.f4 as b, a.f1 > b.f4 as gt,
- a.f1 < b.f4 as lt, a.f1<=>b.f4 as eq
-from t1 a, t1 b;
-select *, f1 = f2 from t1;
-drop table t1;
-
---echo #
---echo # Bug #54465: assert: field_types == 0 || field_types[field_pos] ==
---echo # MYSQL_TYPE_LONGLONG
---echo #
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1), (2);
-
-SELECT MAX((SELECT 1 FROM t1 ORDER BY @var LIMIT 1)) m FROM t1 t2, t1
- ORDER BY t1.a;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug#58030 crash in Item_func_geometry_from_text::val_str
---echo #
-
---disable_result_log
-
-SELECT MAX(TIMESTAMP(RAND(0)));
-SELECT MIN(TIMESTAMP(RAND(0)));
-
---echo #
---echo # Bug#58177 crash and valgrind warnings in decimal and protocol sending functions...
---echo #
-
-SELECT MIN(GET_LOCK('aaaaaaaaaaaaaaaaa',0) / '0b1111111111111111111111111111111111111111111111111111111111111111111111111' ^ (RAND()));
-SELECT MIN(GET_LOCK('aaaaaaaaaaaaaaaaa',0) / '0b1111111111111111111111111111111111111111111111111111111111111111111111111' ^ (RAND()));
-SELECT MIN(GET_LOCK('aaaaaaaaaaaaaaaaa',0) / '0b1111111111111111111111111111111111111111111111111111111111111111111111111' ^ (RAND()));
-SELECT MIN(GET_LOCK('aaaaaaaaaaaaaaaaa',0) / '0b1111111111111111111111111111111111111111111111111111111111111111111111111' ^ (RAND()));
-SELECT RELEASE_LOCK('aaaaaaaaaaaaaaaaa');
-
---enable_result_log
-
-
---echo #
---echo # Bug #11766094 - 59132: MIN() AND MAX() REMOVE UNSIGNEDNESS
---echo #
-
-CREATE TABLE t1 (a BIGINT UNSIGNED);
-INSERT INTO t1 VALUES (18446668621106209655);
-SELECT MAX(LENGTH(a)), LENGTH(MAX(a)), MIN(a), MAX(a), CONCAT(MIN(a)), CONCAT(MAX(a)) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Bug #11766270 59343: YEAR(4): INCORRECT RESULT AND VALGRIND WARNINGS WITH MIN/MAX, UNION
---echo #
-
-CREATE TABLE t1(f1 YEAR(4));
-INSERT INTO t1 VALUES (0000),(2001);
---enable_metadata
-(SELECT MAX(f1) FROM t1) UNION (SELECT MAX(f1) FROM t1);
---disable_metadata
-DROP TABLE t1;
-
---echo #
---echo # LP BUG#813418 - incorrect optimisation of max/min by index for
---echo # negated BETWEEN
-CREATE TABLE t1 (a int, KEY (a));
-INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
-SELECT MAX(a) FROM t1 WHERE a NOT BETWEEN 3 AND 9;
-drop table t1;
-
---echo #
---echo End of 5.1 tests
-
---echo #
---echo # Bug #904345: MIN/MAX optimization with constant FALSE condition
---echo #
-
-CREATE TABLE t1 (a int NOT NULL, KEY(a));
-INSERT INTO t1 VALUES (10), (8), (11), (7), (15), (12), (9);
-
-CREATE TABLE t2 (a int, b int);
-INSERT INTO t2 VALUES
- (8,2), (6,9), (8,4), (5,3), (9,1);
-
-EXPLAIN EXTENDED
-SELECT MAX(a) FROM t1 WHERE (1,2) IN (SELECT 3,4) AND a<10;
-SELECT MAX(a) FROM t1 WHERE (1,2) IN (SELECT 3,4) AND a<10;
-
-EXPLAIN EXTENDED
-SELECT MAX(a) FROM t1 WHERE (1,2) IN (SELECT a,b FROM t2 WHERE b<5) and a<10;
-SELECT MAX(a) FROM t1 WHERE (1,2) IN (SELECT a,b FROM t2 WHERE b<5) and a<10;
-
-EXPLAIN EXTENDED
-SELECT MAX(a) FROM t1 WHERE RAND()*0<>0 AND a<10;
-SELECT MAX(a) FROM t1 WHERE RAND()*0<>0 AND a<10;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug #879860: MIN/MAX for subquery returning empty set
---echo #
-
-CREATE TABLE t1 (a int PRIMARY KEY);
-INSERT INTO t1 VALUES (1);
-
-CREATE TABLE t2 (a int NOT NULL);
-INSERT INTO t2 VALUES (10);
-
-CREATE TABLE t3 ( a int, b int);
-INSERT INTO t3 VALUES (19,1), (20,5);
-
-EXPLAIN EXTENDED
-SELECT (SELECT MIN(t1.a) FROM t1,t2 WHERE t2.a = t3.b) FROM t3;
-SELECT (SELECT MIN(t1.a) FROM t1,t2 WHERE t2.a = t3.b) FROM t3;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # Bug #884175: MIN/MAX for short varchar = long const
---echo #
-
-CREATE TABLE t1 (f1 varchar(1), f2 varchar(1), KEY (f2));
-INSERT INTO t1 VALUES ('b', 'b'), ('a','a');
-
-EXPLAIN
-SELECT MAX(f1) FROM t1 WHERE f1 = 'abc';
-SELECT MAX(f1) FROM t1 WHERE f1 = 'abc';
-
-EXPLAIN
-SELECT MAX(f2) FROM t1 WHERE f2 = 'abc';
-SELECT MAX(f2) FROM t1 WHERE f2 = 'abc';
-
-EXPLAIN
-SELECT MIN(f1) FROM t1 WHERE f1 >= 'abc';
-SELECT MIN(f1) FROM t1 WHERE f1 >= 'abc';
-
-EXPLAIN
-SELECT MIN(f2) FROM t1 WHERE f2 >= 'abc';
-SELECT MIN(f2) FROM t1 WHERE f2 >= 'abc';
-
-EXPLAIN
-SELECT MIN(f1) FROM t1 WHERE f1 BETWEEN 'abc' AND 'b' ;
-SELECT MIN(f1) FROM t1 WHERE f1 BETWEEN 'abc' AND 'b' ;
-
-EXPLAIN
-SELECT MIN(f2) FROM t1 WHERE f2 BETWEEN 'abc' AND 'b' ;
-SELECT MIN(f2) FROM t1 WHERE f2 BETWEEN 'abc' AND 'b' ;
-
-DROP TABLE t1;
-
-
---echo End of 5.2 tests
-
---echo #
---echo # BUG#46680 - Assertion failed in file item_subselect.cc,
---echo # line 305 crashing on HAVING subquery
---echo #
-
---echo # Create tables
---echo #
-
-CREATE TABLE t1 (
- pk INT,
- v VARCHAR(1) DEFAULT NULL,
- PRIMARY KEY(pk)
-);
-CREATE TABLE t2 LIKE t1;
-CREATE TABLE t3 LIKE t1;
-CREATE TABLE empty1 (a int);
-
-INSERT INTO t1 VALUES (1,'c'),(2,NULL);
-INSERT INTO t2 VALUES (3,'m'),(4,NULL);
-INSERT INTO t3 VALUES (1,'n');
-
-set @save_optimizer_switch=@@optimizer_switch;
-set @@optimizer_switch='materialization=on,in_to_exists=off,semijoin=off';
-
---echo
---echo #
---echo # 1) Test that subquery materialization is setup for query with
---echo # premature optimize() exit due to "Impossible WHERE"
---echo #
-SELECT MIN(t2.pk)
-FROM t2 JOIN t1 ON t1.pk=t2.pk
-WHERE 'j'
-HAVING ('m') IN (
-SELECT v
-FROM t2);
-
---echo
-EXPLAIN
-SELECT MIN(t2.pk)
-FROM t2 JOIN t1 ON t1.pk=t2.pk
-WHERE 'j'
-HAVING ('m') IN (
-SELECT v
-FROM t2);
-
---echo
---echo #
---echo # 2) Test that subquery materialization is setup for query with
---echo # premature optimize() exit due to "No matching min/max row"
---echo #
-SELECT MIN(t2.pk)
-FROM t2
-WHERE t2.pk>10
-HAVING ('m') IN (
-SELECT v
-FROM t2);
-
---echo
-EXPLAIN
-SELECT MIN(t2.pk)
-FROM t2
-WHERE t2.pk>10
-HAVING ('m') IN (
-SELECT v
-FROM t2);
-
---echo
---echo #
---echo # 3) Test that subquery materialization is setup for query with
---echo # premature optimize() exit due to "Select tables optimized away"
---echo #
-SELECT MIN(pk)
-FROM t1
-WHERE pk=NULL
-HAVING ('m') IN (
-SELECT v
-FROM t2);
-
---echo
-EXPLAIN
-SELECT MIN(pk)
-FROM t1
-WHERE pk=NULL
-HAVING ('m') IN (
-SELECT v
-FROM t2);
-
---echo
---echo #
---echo # 4) Test that subquery materialization is setup for query with
---echo # premature optimize() exit due to "No matching row in const table"
---echo #
---echo
-SELECT MIN(a)
-FROM (SELECT a FROM empty1) tt
-HAVING ('m') IN (
-SELECT v
-FROM t2);
-
---echo
-set @tmp_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='derived_merge=off,derived_with_keys=off';
-EXPLAIN
-SELECT MIN(a)
-FROM (SELECT a FROM empty1) tt
-HAVING ('m') IN (
-SELECT v
-FROM t2);
-set optimizer_switch=@tmp_optimizer_switch;
-
---echo
---echo #
---echo # 5) Test that subquery materialization is setup for query with
---echo # premature optimize() exit due to "Impossible WHERE noticed
---echo # after reading const tables"
---echo #
-SELECT min(t1.pk)
-FROM t1
-WHERE t1.pk IN (SELECT 1 from t3 where pk>10)
-HAVING ('m') IN (
-SELECT v
-FROM t2);
-
---echo
-EXPLAIN
-SELECT min(t1.pk)
-FROM t1
-WHERE t1.pk IN (SELECT 1 from t3 where pk>10)
-HAVING ('m') IN (
-SELECT v
-FROM t2);
-
-set @@optimizer_switch=@save_optimizer_switch;
-
---echo #
---echo # Cleanup for BUG#46680
---echo #
-DROP TABLE IF EXISTS t1,t2,t3,empty1;
-
-#
-# MDEV-4286 Server crashes in Protocol_text::store, stack smashing detected
-#
-create table t1 (i int, d date);
-insert into t1 values (1, '2008-10-02'), (2, '2010-12-12');
-select avg(export_set( 3, 'y', sha(i))), group_concat(d) from t1 group by d order by i;
-drop table t1;
-
---echo #
---echo # MDEV-4290: crash in st_select_lex::mark_as_dependent
---echo #
-create table `t1`(`a` int);
-
---error ER_INVALID_GROUP_FUNC_USE
-select 1 from t1 v1 right join t1 on count(*);
---error ER_INVALID_GROUP_FUNC_USE
-select 1 from t1 order by
-(
- select 1 from
- (
- select 1 from t1 v1 right join t1 on count(*)
- ) v
-);
-insert into t1 values (1),(1),(2),(2);
-select count(*) from t1;
-select z from (select count(*) as z from t1) v;
---echo # next is how it implemented now (may be changed in case of dependent
---echo # derived tables)
-select z from (select count(*) as z from t1) v group by 1;
-drop table t1;
-
-#
-# Bug mdev-5015: Degenerate OR condition in an aggregated join
-#
-
-CREATE TABLE t1 (i1 int, INDEX(i1));
-INSERT INTO t1 VALUES (9),(8);
-
-CREATE TABLE t2 (i2 int);
-INSERT INTO t2 VALUES (8),(4);
-
-
-CREATE TABLE t3 (i3 int, INDEX(i3));
-INSERT INTO t3 VALUES (9),(8);
-
-SELECT MAX(t3.i3) FROM t3, t2, t1 WHERE t1.i1 = t2.i2 AND ( 0 OR t3.i3 = t2.i2 );
-
-SELECT MAX(t3.i3) FROM t3, t2, t1 WHERE t1.i1 = t2.i2 AND t3.i3 = t2.i2;
-
-DROP TABLE t1,t2,t3;
-
---echo # end of 5.3 tests
-
---echo #
---echo # Bug#52123 Assertion failed: aggregator == aggr->Aggrtype(),
---echo # file .\item_sum.cc, line 587
---echo #
-
-CREATE TABLE t1(a int, KEY(a));
-INSERT INTO t1 VALUES (1), (2);
-SELECT 1 FROM t1 ORDER BY AVG(DISTINCT a);
-DROP TABLE t1;
-
---echo #
---echo # Bug#55648: Server crash on MIN/MAX on maximum time value
---echo #
-CREATE TABLE t1(c1 TIME NOT NULL);
-INSERT INTO t1 VALUES('837:59:59');
-INSERT INTO t1 VALUES('838:59:59');
-SELECT MAX(c1) FROM t1;
-DROP TABLE t1;
---echo # End of the bug#55648
-
---echo #
---echo # Bug#56120: Failed assertion on MIN/MAX on negative time value
---echo #
-CREATE TABLE t1(c1 TIME NOT NULL);
-INSERT INTO t1 VALUES('-00:00:01');
-SELECT MAX(c1),MIN(c1) FROM t1;
-DROP TABLE t1;
---echo # End of the bug#56120
-
---echo #
---echo # Bug#57932 "query with AVG(DISTINCT) returns NULL if last
---echo # aggregated value was NULL"
---echo #
-CREATE TABLE t1 (col_int_nokey int(11));
-INSERT INTO t1 VALUES (7),(8),(NULL);
-SELECT AVG(DISTINCT col_int_nokey) FROM t1;
-SELECT AVG(DISTINCT outr.col_int_nokey) FROM t1 AS outr LEFT JOIN t1 AS outr2 ON
-outr.col_int_nokey = outr2.col_int_nokey;
-DROP TABLE t1;
---echo # End of the bug#57932
-
-
---echo #
---echo # MDEV-5257: MIN/MAX Optimization (Select tables optimized away) does not work for DateTime
---echo # MDEV-3855: MIN/MAX optimization doesnt work for int_col > INET_ATON
---echo # (correct the fix for Bug #884175)
---echo #
-
-CREATE TABLE `t1` (
- `a` int(11) NOT NULL AUTO_INCREMENT,
- `b` datetime DEFAULT NULL,
- PRIMARY KEY (`a`),
- KEY `idx_b` (`b`)
-);
-
-INSERT INTO `t1` (b) VALUES ('2013-01-06 23:59:59');
-INSERT INTO `t1` (b) VALUES ('2013-02-06 23:59:59');
-INSERT INTO `t1` (b) VALUES ('2013-03-06 23:59:59');
-INSERT INTO `t1` (b) VALUES ('2013-04-06 23:59:59');
-INSERT INTO `t1` (b) VALUES ('2013-05-06 23:59:59');
-INSERT INTO `t1` (b) VALUES ('2013-06-06 23:59:59');
-INSERT INTO `t1` (b) VALUES ('2013-07-06 23:59:59');
-
---echo # The following should produce "Select tables optimized away"
-EXPLAIN SELECT MIN(b) FROM t1 WHERE b <= '2013-11-06 23:59:59';
-
--- connect (con1,localhost,root,,)
--- connection con1
-set names utf8;
--- echo # Should be the same as above:
-EXPLAIN SELECT MIN(b) FROM t1 WHERE b <= '2013-11-06 23:59:59';
-
---connection default
---disconnect con1
-
-DROP TABLE t1;
-
-CREATE TABLE `t1` (
- `a` int(11) NOT NULL AUTO_INCREMENT,
- `b` bigint(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- KEY `idx_b` (`b`)
-);
-
-insert into t1 (b) values (INET_ATON('192.168.0.1'));
-insert into t1 (b) values (INET_ATON('192.168.0.2'));
-insert into t1 (b) values (INET_ATON('192.168.0.3'));
-insert into t1 (b) values (INET_ATON('192.168.0.4'));
-insert into t1 (b) values (INET_ATON('192.168.200.200'));
---echo # should show "Select tables optimized away"
-explain select MIN(b) from t1 where b >= inet_aton('192.168.119.32');
-DROP TABLE t1;
-
---echo #
---echo # MDEV-6743 crash in GROUP_CONCAT(IF () ORDER BY 1)
---echo #
-
-CREATE TABLE t1 (pk INT, t2_id INT, t5_id INT, PRIMARY KEY (pk));
-INSERT INTO t1 VALUES (1,3,12),(2,3,15);
-
-CREATE TABLE t2 (pk INT, PRIMARY KEY (pk));
-INSERT INTO t2 VALUES (4),(5);
-
-CREATE TABLE t3 (t2_id INT, t4_id INT);
-INSERT INTO t3 VALUES (6,11),(7,12);
-
-CREATE TABLE t4 (id INT);
-INSERT INTO t4 VALUES (13),(14);
-
-CREATE TABLE t5 (pk INT, f VARCHAR(50), t6_id INT, PRIMARY KEY (pk));
-INSERT INTO t5 VALUES (9,'FOO',NULL);
-
-CREATE TABLE t6 (pk INT, f VARCHAR(120), b TINYINT(4), PRIMARY KEY (pk));
-
-PREPARE stmt FROM "
- SELECT t1.t2_id, GROUP_CONCAT(IF (t6.b, t6.f, t5.f) ORDER BY 1)
- FROM t1
- JOIN t2 ON t1.t2_id = t2.pk
- JOIN t3 ON t2.pk = t3.t2_id
- JOIN t4 ON t4.id = t3.t4_id
- JOIN t5 ON t1.t5_id = t5.pk
- LEFT JOIN t6 ON t6.pk = t5.t6_id
- GROUP BY t1.t2_id
-";
-
-EXECUTE stmt;
-EXECUTE stmt;
-EXECUTE stmt;
-
-DROP TABLE t1,t2,t3,t4,t5,t6;
-
---echo #
---echo # MDEV-10500 CASE/IF Statement returns multiple values and shifts further result values to the next column
---echo #
-
-CREATE TABLE t1 (
- id int not null AUTO_INCREMENT,
- active bool not null,
- data1 bigint,
- data2 bigint,
- data3 bigint,
- primary key (id)
-);
-INSERT INTO t1 (active,data1,data2,data3) VALUES (1,null,100,200);
-SELECT
- CASE WHEN active THEN SUM(data1) END AS C_1,
- SUM(data2) AS C_2,
- SUM(data3) AS C_3
-FROM t1;
-SELECT
- IF(active, SUM(data1), 5) AS C_1,
- SUM(data2) AS C_2,
- SUM(data3) AS C_3
-FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-10468 Assertion `nr >= 0.0' failed in Item_sum_std::val_real()
---echo #
-SELECT STDDEV_POP(f) FROM (SELECT "1e+309" AS f UNION SELECT "-1e+309" AS f) tbl;
-SELECT STDDEV(f) FROM (SELECT 1.7976931348623157e+308 AS f UNION SELECT -1.7976931348623157e+308 AS f) tbl;
-
---echo #
---echo # MDEV-8852 Implicit or explicit CAST from MAX(string) to INT,DOUBLE,DECIMAL does not produce warnings
---echo #
-SELECT MAX('x') << 1, CAST(MAX('x') AS DOUBLE), CAST(MAX('x') AS DECIMAL);
-
-
---echo #
---echo # MDEV-8918 Wrong result for CAST(AVG(a) AS SIGNED)
---echo #
-CREATE TABLE t1 (id INT, a BIGINT);
-INSERT INTO t1 VALUES (1,0x7FFFFFFFFFFFFFFF),(2,0x7FFFFFFFFFFFFFFF);
-SELECT id, AVG(a) AS avg, CAST(MIN(a) AS SIGNED) AS cast_min FROM t1 GROUP BY id HAVING avg!=123 ORDER BY id;
-SELECT id, AVG(a) AS avg, CAST(AVG(a) AS SIGNED) AS cast_avg FROM t1 GROUP BY id HAVING avg!=123 ORDER BY id;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-9656 Assertion `0' failed in Item_sum_field::get_tmp_table_field()
---echo #
-CREATE TABLE t1 (i INT);
-INSERT INTO t1 VALUES (1),(2);
-SELECT DISTINCT VAR_POP(1) FROM t1 GROUP BY @a := 's';
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8921 Wrong result for CAST(AVG(double_column) AS SIGNED)
---echo #
-CREATE TABLE t1 (id INT, a DOUBLE);
-INSERT INTO t1 VALUES (1,0x7FFFFFFFFFFFFFFF),(2,0x7FFFFFFFFFFFFFFF);
-SELECT id, AVG(a) AS avg, CAST(MIN(a) AS SIGNED) AS cast_min,CAST(AVG(a) AS SIGNED) AS cast_avg FROM t1 GROUP BY id HAVING avg!=123 ORDER BY id;
-DROP TABLE t1;
-CREATE TABLE t1 (a DOUBLE);
-INSERT INTO t1 VALUES (0x7FFFFFFFFFFFFFFF);
-SELECT MIN(a), SUM(a), CAST(SUM(a) AS SIGNED), CAST(AVG(a) AS SIGNED) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-7195 AVG() loses precision in INT context
---echo #
-CREATE TABLE t1 (
- auto SERIAL,
- fld1 bigint unsigned NOT NULL,
- companynr tinyint(2) unsigned zerofill DEFAULT '00' NOT NULL,
- UNIQUE fld1 (fld1)
-);
-INSERT INTO t1 VALUES (1,0x7FFFFFFFFFFFFFFF,00);
-INSERT INTO t1 VALUES (2,0x7FFFFFFFFFFFFFFE,37);
-INSERT INTO t1 VALUES (3,0x7FFFFFFFFFFFFFFC,37);
-SELECT companynr, AVG(fld1), AVG(fld1)<<0 AS avg1, CAST(AVG(fld1) AS UNSIGNED)<<0 AS avg2 FROM t1 GROUP BY companynr;
-DROP TABLE t1;
-
---echo #
---echo # case where aggregate resolved in the local SELECT
---echo # but outer ones are checked
---echo #
-create table t10 (a int , b int, c int);
-insert into t10 values (0,0,0),(1,1,1);
-create table t11 as select * from t10;
-create table t12 as select * from t10;
-explain extended select a from t10 where c<3 or a in (select c from t12 union select max(t10.b) from t11 group by t11.c);
-drop table t10,t11,t12;
---echo #
---echo # MDEV-10017: Get unexpected `Empty Set` for correlated subquery
---echo # with aggregate functions
---echo #
-
-create table t1(c1 int, c2 int, c3 int);
-insert into t1 values(1,1,1),(2,2,2),(3,3,3);
-select * from t1;
-create table t2(c1 int, c2 int);
-insert into t2 values(2,2);
-select * from t2;
---error ER_INVALID_GROUP_FUNC_USE
-explain extended
-select c1 from t1 having c1 >= (select t.c1 as c from t2 t order by (select min(t1.c1+c) from t2 tt));
---error ER_INVALID_GROUP_FUNC_USE
-select c1 from t1 having c1 >= (select t.c1 as c from t2 t order by (select min(t1.c1+c) from t2 tt));
-
-explain extended
-select c1 from t1 having c1 >= (select t.c1 as c from t2 t order by (select min(t1.c1+tt.c1) from t2 tt));
-select c1 from t1 having c1 >= (select t.c1 as c from t2 t order by (select min(t1.c1+tt.c1) from t2 tt));
-drop table t1,t2;
-
---echo #
---echo # MDEV-10556 Assertion `0' failed in virtual void Item_sum_field::set_result_field(Field*)
---echo #
-
-CREATE TABLE t1 (i INT, KEY(i)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (10),(20),(30);
-SELECT DISTINCT STDDEV(1) FROM t1 GROUP BY i ORDER BY BENCHMARK(0, BIT_XOR(i));
-DROP TABLE t1;
-
---echo #
---echo # End of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-13064: assertion `n < m_size' fails in Item::split_sum_func2()
---echo #
-
-create table t1 (i int) engine=MyISAM;
-insert into t1 value (1),(2);
-
-select count(*)+sleep(0) from t1;
-
-drop table t1;
-
---echo #
---echo # Start of 10.3 tests
---echo #
-
---echo #
---echo # MDEV-9408 CREATE TABLE SELECT MAX(int_column) creates different columns for table vs view
---echo #
-
-CREATE TABLE t1 (
- id int(11) NOT NULL PRIMARY KEY,
- country varchar(32),
- code int(11) default NULL
-);
-INSERT INTO t1 VALUES (1,'ITALY',100),(2,'ITALY',200),(3,'FRANCE',100), (4,'ITALY',100);
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-CREATE TABLE t2 AS SELECT code, COUNT(DISTINCT country), MAX(id) FROM t1 GROUP BY code ORDER BY MAX(id);
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE TABLE t2 AS SELECT code, COUNT(DISTINCT country), MAX(id) FROM v1 GROUP BY code ORDER BY MAX(id);
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-DROP VIEW v1;
-DROP TABLE t1;
diff --git a/mysql-test/t/func_group_innodb.test b/mysql-test/t/func_group_innodb.test
deleted file mode 100644
index 1d175f85ed9..00000000000
--- a/mysql-test/t/func_group_innodb.test
+++ /dev/null
@@ -1,195 +0,0 @@
-#
-# Test of group functions that depend on innodb
-#
-
---source include/have_innodb.inc
-
---disable_warnings
-create table t1 (USR_ID integer not null, MAX_REQ integer not null, constraint PK_SEA_USER primary key (USR_ID)) engine=InnoDB;
---enable_warnings
-insert into t1 values (1, 3);
-select count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ from t1 group by MAX_REQ;
-select Case When Count(*) < MAX_REQ Then 1 Else 0 End from t1 where t1.USR_ID = 1 group by MAX_REQ;
-drop table t1;
-
-
-#
-# Bug #12882 min/max inconsistent on empty table
-#
-
---disable_warnings
-create table t1m (a int) engine=myisam;
-create table t1i (a int) engine=innodb;
-create table t2m (a int) engine=myisam;
-create table t2i (a int) engine=innodb;
---enable_warnings
-insert into t2m values (5);
-insert into t2i values (5);
-
-# test with MyISAM
-select min(a) from t1m;
-select min(7) from t1m;
-select min(7) from DUAL;
-explain select min(7) from t2m join t1m;
-select min(7) from t2m join t1m;
-
-select max(a) from t1m;
-select max(7) from t1m;
-select max(7) from DUAL;
-explain select max(7) from t2m join t1m;
-select max(7) from t2m join t1m;
-
-select 1, min(a) from t1m where a=99;
-select 1, min(a) from t1m where 1=99;
-select 1, min(1) from t1m where a=99;
-select 1, min(1) from t1m where 1=99;
-
-select 1, max(a) from t1m where a=99;
-select 1, max(a) from t1m where 1=99;
-select 1, max(1) from t1m where a=99;
-select 1, max(1) from t1m where 1=99;
-
-# test with InnoDB
-select min(a) from t1i;
-select min(7) from t1i;
-select min(7) from DUAL;
-explain select min(7) from t2i join t1i;
-select min(7) from t2i join t1i;
-
-select max(a) from t1i;
-select max(7) from t1i;
-select max(7) from DUAL;
-explain select max(7) from t2i join t1i;
-select max(7) from t2i join t1i;
-
-select 1, min(a) from t1i where a=99;
-select 1, min(a) from t1i where 1=99;
-select 1, min(1) from t1i where a=99;
-select 1, min(1) from t1i where 1=99;
-
-select 1, max(a) from t1i where a=99;
-select 1, max(a) from t1i where 1=99;
-select 1, max(1) from t1i where a=99;
-select 1, max(1) from t1i where 1=99;
-
-# mixed MyISAM/InnoDB test
-explain select count(*), min(7), max(7) from t1m, t1i;
-select count(*), min(7), max(7) from t1m, t1i;
-
-explain select count(*), min(7), max(7) from t1m, t2i;
-select count(*), min(7), max(7) from t1m, t2i;
-
-explain select count(*), min(7), max(7) from t2m, t1i;
-select count(*), min(7), max(7) from t2m, t1i;
-
-drop table t1m, t1i, t2m, t2i;
-
---echo #
---echo # Bug #57954: BIT_AND function returns incorrect results when
---echo # semijoin=on
-
-CREATE TABLE c (
- pk INT,
- col_varchar_key VARCHAR(1),
- PRIMARY KEY (pk),
- KEY col_varchar_key (col_varchar_key)
-) ENGINE=InnoDB;
-INSERT INTO c VALUES (11,NULL);
-INSERT INTO c VALUES (16,'c');
-CREATE TABLE bb (
- pk INT,
- col_varchar_key VARCHAR(1),
- PRIMARY KEY (pk),
- KEY col_varchar_key (col_varchar_key)
-) ENGINE=InnoDB;
-INSERT INTO bb VALUES (10,NULL);
-
-SELECT straight_join BIT_AND(c.pk)
-FROM
- bb, c
- WHERE c.col_varchar_key='ABC'
-ORDER BY c.pk;
-
-DROP TABLE c,bb;
-
---echo #
---echo # Bug #58050: BIT_OR and BIT_XOR return incorrect results when
---echo # semijoin=on
---echo #
-
-CREATE TABLE t1 (pk INT PRIMARY KEY, b INT, c INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES(1, 1, 1);
-
-CREATE TABLE t2 (pk INT PRIMARY KEY, b INT, c INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1, 1, NULL);
-
-SELECT t1.* FROM t1 JOIN t2 ON t1.c=t2.c WHERE t1.pk=1;
-SELECT BIT_OR(t1.b) FROM t1 JOIN t2 ON t1.c=t2.c WHERE t1.pk=1;
-SELECT BIT_AND(t1.b) FROM t1 JOIN t2 ON t1.c=t2.c WHERE t1.pk=1;
-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 #
---echo # MDEV-4269: crash when grouping by values()
---echo #
-
-SELECT @@storage_engine INTO @old_engine;
-set storage_engine=innodb;
-
-create table y select 1 b;
-select 1 from y group by b;
-select 1 from y group by value(b);
-drop table y;
-SET storage_engine=@old_engine;
-
-### End of 5.1 tests
-
---echo #
---echo # Bug#13723054 CRASH WITH MIN/MAX AFTER QUICK_GROUP_MIN_MAX_SELECT::NEXT_MIN
---echo #
-
-CREATE TABLE t1(a BLOB, b VARCHAR(255) CHARSET LATIN1, c INT,
- KEY(b, c, a(765))) ENGINE=INNODB;
-INSERT INTO t1(a, b, c) VALUES
-('', 'a', 0), ('', 'a', null), ('', 'a', 0), ('', 'a', null), ('', 'a', 0);
-
--- disable_result_log
-ANALYZE TABLE t1;
--- enable_result_log
-
-SELECT MIN(c) FROM t1 GROUP BY b;
-EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b;
-
-DROP TABLE t1;
-
---echo End of 5.5 tests
diff --git a/mysql-test/t/func_hybrid_type.test b/mysql-test/t/func_hybrid_type.test
deleted file mode 100644
index 954c7de53fa..00000000000
--- a/mysql-test/t/func_hybrid_type.test
+++ /dev/null
@@ -1,617 +0,0 @@
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-8865 Wrong field type or metadata for COALESCE(signed_int_column, unsigned_int_column)
---echo #
-
---echo #
-CREATE TABLE t1 (a INT, b INT UNSIGNED);
-INSERT INTO t1 VALUES (1,1);
-INSERT INTO t1 VALUES (-1,1);
-INSERT INTO t1 VALUES (-2147483648,4294967295);
---source include/func_hybrid_type.inc
-DROP TABLE t1;
-
---echo #
-CREATE TABLE t1 (a INT, b INT);
-INSERT INTO t1 VALUES (1,1);
-INSERT INTO t1 VALUES (-2147483648,2147483647);
---source include/func_hybrid_type.inc
-DROP TABLE t1;
-
---echo #
-CREATE TABLE t1 (a BIGINT, b BIGINT UNSIGNED);
-INSERT INTO t1 VALUES (1,1);
-INSERT INTO t1 VALUES (-9223372036854775808,0xFFFFFFFFFFFFFFFF);
---source include/func_hybrid_type.inc
-DROP TABLE t1;
-
---echo #
-CREATE TABLE t1 (a BIGINT, b BIGINT);
-INSERT INTO t1 VALUES (1,1);
-INSERT INTO t1 VALUES (-9223372036854775808,9223372036854775807);
---source include/func_hybrid_type.inc
-DROP TABLE t1;
-
-# Testing BIT(N) types.
-# Using safe BIT(N) type and value to make sure
-# that "file func_hybrid_type.test" tells "ASCII text".
-
---echo #
-CREATE TABLE t1 (a INT, b BIT(8));
-INSERT INTO t1 VALUES (-2147483648,0x32);
---source include/func_hybrid_type.inc
-DROP TABLE t1;
-
---echo #
-CREATE TABLE t1 (a INT UNSIGNED, b BIT(8));
-INSERT INTO t1 VALUES (4294967295,0x32);
---source include/func_hybrid_type.inc
-DROP TABLE t1;
-
---echo #
-CREATE TABLE t1 (a BIT(7), b BIT(8));
-INSERT INTO t1 VALUES (0x32,0x32);
---source include/func_hybrid_type.inc
-DROP TABLE t1;
-
---echo #
-CREATE TABLE t1 (a FLOAT, b SMALLINT);
-INSERT INTO t1 VALUES (1,-32678);
---source include/func_hybrid_type.inc
-DROP TABLE t1;
-
---echo #
-CREATE TABLE t1 (a VARCHAR(10), b ENUM('b'));
-INSERT INTO t1 VALUES ('a','b');
---source include/func_hybrid_type.inc
-DROP TABLE t1;
-
---echo #
-CREATE TABLE t1 (a INT, b YEAR);
-INSERT INTO t1 VALUES (-2147483648,2015);
---source include/func_hybrid_type.inc
-DROP TABLE t1;
-
---echo #
-CREATE TABLE t1 (a INT UNSIGNED, b YEAR);
-INSERT INTO t1 VALUES (4294967295,2015);
---source include/func_hybrid_type.inc
-DROP TABLE t1;
-
---echo #
-SET timestamp=UNIX_TIMESTAMP('2001-01-01 01:02:03');
-CREATE TABLE t1 (a DATE, b TIME);
-INSERT INTO t1 VALUES ('2010-01-01','10:20:30');
---source include/func_hybrid_type.inc
-DROP TABLE t1;
-SET timestamp=DEFAULT;
-
---echo #
-SET timestamp=UNIX_TIMESTAMP('2001-01-01 01:02:03');
-CREATE TABLE t1 (a TIMESTAMP, b TIME);
-INSERT INTO t1 VALUES ('2010-01-01 00:00:00','10:20:30');
---source include/func_hybrid_type.inc
-DROP TABLE t1;
-SET timestamp=DEFAULT;
-
---echo #
-SET timestamp=UNIX_TIMESTAMP('2001-01-01 01:02:03');
-CREATE TABLE t1 (a DATETIME, b TIME);
-INSERT INTO t1 VALUES ('2010-01-01 00:00:00','10:20:30');
---source include/func_hybrid_type.inc
-DROP TABLE t1;
-SET timestamp=DEFAULT;
-
---echo #
-SET timestamp=UNIX_TIMESTAMP('2001-01-01 01:02:03');
-CREATE TABLE t1 (a DATETIME, b DATE);
-INSERT INTO t1 VALUES ('2010-01-01 10:20:30','2001-01-02');
---source include/func_hybrid_type.inc
-DROP TABLE t1;
-SET timestamp=DEFAULT;
-
-
---echo #
---echo # MDEV-8873 Wrong field type or metadata for LEAST(int_column,string_column)
---echo #
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-INSERT INTO t1 VALUES (-2147483648,'100x');
---source include/func_hybrid_type.inc
-DROP TABLE t1;
-
---echo #
---echo # MDEV-4848 Wrong metadata or column type for LEAST(1.0,'10')
---echo #
---disable_ps_protocol
---enable_metadata
-SELECT LEAST(1.0,'10');
---disable_metadata
---enable_ps_protocol
-CREATE TABLE t1 AS SELECT LEAST(1.0,'10');
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-657 LP:873142 - GREATEST() does not always return same signness of argument types
---echo #
-CREATE TABLE t1 (a BIGINT(20) UNSIGNED NOT NULL PRIMARY KEY);
-INSERT INTO t1 (a) VALUES (13836376518955650385) ON DUPLICATE KEY UPDATE a=GREATEST(a,VALUES(a));
-INSERT INTO t1 (a) VALUES (13836376518955650385) ON DUPLICATE KEY UPDATE a=GREATEST(a,VALUES(a));
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-5694 GREATEST(date, time) returns a wrong data type
---echo #
-SET timestamp=UNIX_TIMESTAMP('2010-01-01 01:02:03');
---disable_ps_protocol
---enable_metadata
-# Expect DATETIME type (12) in metadata
-SELECT GREATEST(CURRENT_TIME, CURRENT_DATE), COALESCE(CURRENT_TIME, CURRENT_DATE);
-CREATE TABLE t1 (a TIMESTAMP);
-INSERT INTO t1 VALUES ('2010-01-01 10:20:30');
-# Expect TIMESTAMP type (7) in metadata
-SELECT GREATEST(a,a) FROM t1;
-# Similar to this one
-SELECT COALESCE(a,a) FROM t1;
-DROP TABLE t1;
---disable_metadata
---enable_ps_protocol
-CREATE TABLE t1 (a TIMESTAMP, b DATETIME);
-CREATE TABLE t2 AS SELECT LEAST(a,a),LEAST(b,b),LEAST(a,b) FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-DROP TABLE t1;
-SET timestamp=DEFAULT;
-
---echo #
---echo # MDEV-8910 Wrong metadata or field type for MAX(COALESCE(string_field))
---echo #
-CREATE TABLE t1 (c1 TINYBLOB, c2 MEDIUMBLOB, c3 BLOB, c4 LONGBLOB);
-CREATE TABLE t2 AS
-SELECT
- MAX(COALESCE(c1)) AS c1,
- MAX(COALESCE(c2)) AS c2,
- MAX(COALESCE(c3)) AS c3,
- MAX(COALESCE(c4)) AS c4
-FROM t1;
-SHOW CREATE TABLE t2;
---disable_ps_protocol
---enable_metadata
-SELECT
- MAX(COALESCE(c1)) AS c1,
- MAX(COALESCE(c2)) AS c2,
- MAX(COALESCE(c3)) AS c3,
- MAX(COALESCE(c4)) AS c4
-FROM t1;
---disable_metadata
---enable_ps_protocol
-DROP TABLE t2;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 CHAR(1), c2 CHAR(255)) CHARACTER SET latin1;
-CREATE TABLE t2 AS
-SELECT
- MAX(COALESCE(c1)) AS c1,
- MAX(COALESCE(c2)) AS c2
-FROM t1;
-SHOW CREATE TABLE t2;
---disable_ps_protocol
---enable_metadata
-SELECT
- MAX(COALESCE(c1)) AS c1,
- MAX(COALESCE(c2)) AS c2
-FROM t1;
---disable_metadata
---enable_ps_protocol
-DROP TABLE t2;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 CHAR(1), c2 CHAR(255)) CHARACTER SET utf8;
-CREATE TABLE t2 AS
-SELECT
- MAX(COALESCE(c1)) AS c1,
- MAX(COALESCE(c2)) AS c2
-FROM t1;
-SHOW CREATE TABLE t2;
---disable_ps_protocol
---enable_metadata
-SELECT
- MAX(COALESCE(c1)) AS c1,
- MAX(COALESCE(c2)) AS c2
-FROM t1;
---disable_metadata
---enable_ps_protocol
-DROP TABLE t2;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 VARCHAR(1), c2 VARCHAR(255), c3 VARCHAR(20000)) CHARACTER SET latin1;
-CREATE TABLE t2 AS
-SELECT
- MAX(COALESCE(c1)) AS c1,
- MAX(COALESCE(c2)) AS c2,
- MAX(COALESCE(c3)) AS c3
-FROM t1;
-SHOW CREATE TABLE t2;
---disable_ps_protocol
---enable_metadata
-SELECT
- MAX(COALESCE(c1)) AS c1,
- MAX(COALESCE(c2)) AS c2,
- MAX(COALESCE(c3)) AS c3
-FROM t1;
---disable_metadata
---enable_ps_protocol
-DROP TABLE t2;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 VARCHAR(1), c2 VARCHAR(255), c3 VARCHAR(20000)) CHARACTER SET utf8;
-CREATE TABLE t2 AS
-SELECT
- MAX(COALESCE(c1)) AS c1,
- MAX(COALESCE(c2)) AS c2,
- MAX(COALESCE(c3)) AS c3
-FROM t1;
-SHOW CREATE TABLE t2;
---disable_ps_protocol
---enable_metadata
-SELECT
- MAX(COALESCE(c1)) AS c1,
- MAX(COALESCE(c2)) AS c2,
- MAX(COALESCE(c3)) AS c3
-FROM t1;
---disable_metadata
---enable_ps_protocol
-DROP TABLE t2;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 ENUM('a')) CHARACTER SET latin1;
-CREATE TABLE t2 AS
-SELECT
- MAX(COALESCE(c1)) AS c1
-FROM t1;
-SHOW CREATE TABLE t2;
---disable_ps_protocol
---enable_metadata
-SELECT
- MAX(COALESCE(c1)) AS c1
-FROM t1;
---disable_metadata
---enable_ps_protocol
-DROP TABLE t2;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 ENUM('a')) CHARACTER SET utf8;
-CREATE TABLE t2 AS
-SELECT
- MAX(COALESCE(c1)) AS c1
-FROM t1;
-SHOW CREATE TABLE t2;
---disable_ps_protocol
---enable_metadata
-SELECT
- MAX(COALESCE(c1)) AS c1
-FROM t1;
---disable_metadata
---enable_ps_protocol
-DROP TABLE t2;
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-8912 Wrong metadata or type for @c:=string_or_blob_field
---echo #
-CREATE TABLE t1 (c1 TINYBLOB, c2 BLOB, c3 MEDIUMBLOB, c4 LONGBLOB);
-CREATE TABLE t2 AS
-SELECT
- @c1:=c1 AS c1,
- @c2:=c2 AS c2,
- @c3:=c3 AS c3,
- @c4:=c4 AS c4
-FROM t1;
-SHOW CREATE TABLE t2;
---disable_ps_protocol
---enable_metadata
-SELECT
- @c1:=c1 AS c1,
- @c2:=c2 AS c2,
- @c3:=c3 AS c3,
- @c4:=c4 AS c4
-FROM t1;
---disable_metadata
---enable_ps_protocol
-DROP TABLE t2;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 CHAR(1), c2 CHAR(255)) CHARACTER SET latin1;
-CREATE TABLE t2 AS
-SELECT
- @c1:=c1 AS c1,
- @c2:=c2 AS c2
-FROM t1;
-SHOW CREATE TABLE t2;
---disable_ps_protocol
---enable_metadata
-SELECT
- @c1:=c1 AS c1,
- @c2:=c2 AS c2
-FROM t1;
---disable_metadata
---enable_ps_protocol
-DROP TABLE t2;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 CHAR(1), c2 CHAR(255)) CHARACTER SET utf8;
-CREATE TABLE t2 AS
-SELECT
- @c1:=c1 AS c1,
- @c2:=c2 AS c2
-FROM t1;
-SHOW CREATE TABLE t2;
---disable_ps_protocol
---enable_metadata
-SELECT
- @c1:=c1 AS c1,
- @c2:=c2 AS c2
-FROM t1;
---disable_metadata
---enable_ps_protocol
-DROP TABLE t2;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 VARCHAR(1), c2 VARCHAR(255), c3 VARCHAR(20000)) CHARACTER SET latin1;
-CREATE TABLE t2 AS
-SELECT
- @c:=c1 AS c1,
- @c:=c2 AS c2,
- @c:=c3 AS c3
-FROM t1;
-SHOW CREATE TABLE t2;
---disable_ps_protocol
---enable_metadata
-SELECT
- @c:=c1 AS c1,
- @c:=c2 AS c2,
- @c:=c3 AS c3
-FROM t1;
---disable_metadata
---enable_ps_protocol
-DROP TABLE t2;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 VARCHAR(1), c2 VARCHAR(255), c3 VARCHAR(20000)) CHARACTER SET utf8;
-CREATE TABLE t2 AS
-SELECT
- @c:=c1 AS c1,
- @c:=c2 AS c2,
- @c:=c3 AS c3
-FROM t1;
-SHOW CREATE TABLE t2;
---disable_ps_protocol
---enable_metadata
-SELECT
- @c:=c1 AS c1,
- @c:=c2 AS c2,
- @c:=c3 AS c3
-FROM t1;
---disable_metadata
---enable_ps_protocol
-DROP TABLE t2;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 ENUM('a')) CHARACTER SET latin1;
-CREATE TABLE t2 AS
-SELECT
- @c:=c1 AS c1
-FROM t1;
-SHOW CREATE TABLE t2;
---disable_ps_protocol
---enable_metadata
-SELECT
- @c:=c1 AS c1
-FROM t1;
---disable_metadata
---enable_ps_protocol
-DROP TABLE t2;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 ENUM('a')) CHARACTER SET utf8;
-CREATE TABLE t2 AS
-SELECT
- @c:=c1 AS c1
-FROM t1;
-SHOW CREATE TABLE t2;
---disable_ps_protocol
---enable_metadata
-SELECT
- @c:=c1 AS c1
-FROM t1;
---disable_metadata
---enable_ps_protocol
-DROP TABLE t2;
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-9653 Assertion `length || !scale' failed in uint my_decimal_length_to_precision(uint, uint, bool)
---echo #
-SELECT CASE 0 WHEN 1 THEN (CASE 2 WHEN 3 THEN NULL END) WHEN 4 THEN 5 END;
-SELECT CASE 0 WHEN 1 THEN (COALESCE(NULL)) WHEN 4 THEN 5 END;
-SELECT CASE WHEN TRUE THEN COALESCE(NULL) ELSE 4 END;
-
---disable_ps_protocol
---enable_metadata
-SELECT COALESCE(COALESCE(NULL), 1.1) AS c0, IF(0, COALESCE(NULL), 1.1) AS c1;
---disable_metadata
---enable_ps_protocol
-
-
---echo #
---echo # MDEV-9752 Wrong data type for COALEASCE(?,1) in prepared statements
---echo #
-PREPARE stmt FROM "CREATE TABLE t1 AS SELECT CONCAT(COALESCE(?,1)) AS a, CONCAT(CASE WHEN TRUE THEN ? ELSE 1 END) AS b";
-SET @a=1;
-EXECUTE stmt USING @a,@a;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
---echo #
---echo # End of 10.1 tests
---echo #
-
---echo #
---echo # Start of 10.3 tests
---echo #
-
---echo #
---echo # MDEV-12497 Wrong data type for LEAST(latin1_expr, utf8_expr)
---echo #
-
-CREATE TABLE t1 AS SELECT
- LEAST(_latin1'aaa',_utf8 0xC39F) AS c1,
- COALESCE(_latin1'aaa',_utf8 0xC39F) AS c2;
-SHOW CREATE TABLE t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-12504 Wrong data type for LEAST(date_expr,time_expr)
---echo #
-
-CREATE TABLE t1 AS SELECT
- LEAST(DATE'2001-01-01', TIME'10:20:30') AS c1,
- CONCAT(LEAST(DATE'2001-01-01', TIME'10:20:30')) AS c2;
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-12505 Wrong data type for GREATEST(bit_column, int_column)
---echo #
-
-CREATE TABLE t1 (a BIT(64),b INT);
-INSERT INTO t1 VALUES (0xFFFFFFFFFFFFFFFF,-1);
-SELECT a>b, COALESCE(a,b), GREATEST(a,b) FROM t1;
-CREATE TABLE t2 AS SELECT COALESCE(a,b),GREATEST(a,b) FROM t1;
-SELECT * FROM t2;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-12601 Hybrid functions create a column of an impossible type DOUBLE(256,4)
---echo #
-
-CREATE TABLE t1 (a DOUBLE(255,4),b DOUBLE(255,3));
-CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-12617 CASE and CASE-alike hybrid functions do not preserve exact data types
---echo #
-
-CREATE TABLE t1 (a FLOAT(10,2));
-CREATE TABLE t2 AS SELECT COALESCE(a) FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2, t1;
-
-CREATE TABLE t1 (a FLOAT(10,2));
-CREATE TABLE t2 AS SELECT LEAST(a,a) FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2, t1;
-
-CREATE TABLE t1 (a TINYINT(1));
-CREATE TABLE t2 AS SELECT COALESCE(a) FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2, t1;
-
-CREATE TABLE t1 (a TINYINT(1));
-CREATE TABLE t2 AS SELECT LEAST(a,a) FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2, t1;
-
---echo #
---echo # MDEV-12875 Wrong VIEW column data type for COALESCE(int_column)
---echo #
-
-CREATE TABLE t1 (a INT);
-CREATE OR REPLACE VIEW v1 AS SELECT COALESCE(a) FROM t1;
-DESCRIBE v1;
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-10309 COALESCE(12345678900) makes a column of a wrong type and truncates the data
---echo #
-
-CREATE TABLE t1 AS SELECT 12345678900 AS c1, COALESCE(12345678900) AS c2;
-SELECT * FROM t1;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 AS SELECT
- 9 AS i1, COALESCE(9) AS c1,
- 99 AS i2, COALESCE(99) AS c2,
- 999 AS i3, COALESCE(999) AS c3,
- 9999 AS i4, COALESCE(9999) AS c4,
- 99999 AS i5, COALESCE(99999) AS c5,
- 999999 AS i6, COALESCE(999999) AS c6,
- 9999999 AS i7, COALESCE(9999999) AS c7,
- 99999999 AS i8, COALESCE(99999999) AS c8,
- 999999999 AS i9, COALESCE(999999999) AS c9,
- 2147483647, COALESCE(2147483647),
- 2147483648, COALESCE(2147483648),
- 9999999999 AS i10, COALESCE(9999999999) AS c10,
- 99999999999 AS i11, COALESCE(99999999999) AS c11,
- 999999999999 AS i12, COALESCE(999999999999) AS c12,
- 9999999999999 AS i13, COALESCE(9999999999999) AS c13,
- 99999999999999 AS i14, COALESCE(99999999999999) AS c14,
- 999999999999999 AS i15, COALESCE(999999999999999) AS c15,
- 9999999999999999 AS i16, COALESCE(9999999999999999) AS c16,
- 99999999999999999 AS i17, COALESCE(99999999999999999) AS c17,
- 999999999999999999 AS i18, COALESCE(999999999999999999) AS c18,
- 9223372036854775807, COALESCE(9223372036854775807),
- 9223372036854775808, COALESCE(9223372036854775808),
- 9999999999999999999 AS i19, COALESCE(9999999999999999999) AS c19,
- 18446744073709551615, COALESCE(18446744073709551615),
- 18446744073709551616, COALESCE(18446744073709551616),
- 99999999999999999999 AS i20, COALESCE(99999999999999999999) AS c20,
- 999999999999999999999 AS i21, COALESCE(999999999999999999999) AS c21,
- 9999999999999999999999 AS i22, COALESCE(9999999999999999999999) AS c22;
-SHOW CREATE TABLE t1;
---vertical_results
-SELECT * FROM t1;
---horizontal_results
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-9406 CREATE TABLE..SELECT creates different columns for IFNULL() and equivalent COALESCE,CASE,IF
---echo #
-CREATE TABLE t1 (a SMALLINT);
-INSERT INTO t1 VALUES (1),(2);
-CREATE TABLE t2 AS SELECT
- IFNULL(a,a) AS c1,
- COALESCE(a,a) AS c2,
- CASE WHEN a IS NOT NULL THEN a ELSE a END AS c3,
- IF(a IS NULL,a,a) AS c4 FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2,t1;
-
-CREATE TABLE t1 AS SELECT
- connection_id() AS c0,
- IFNULL(connection_id(),connection_id()) AS c1,
- COALESCE(connection_id(), connection_id()) AS c2,
- CASE WHEN 0 THEN connection_id() ELSE connection_id() END AS c3,
- IF(0,connection_id(),connection_id()) AS c4;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
---echo #
---echo # End of 10.3 tests
---echo #
-
diff --git a/mysql-test/t/func_if.test b/mysql-test/t/func_if.test
deleted file mode 100644
index dc6749da26f..00000000000
--- a/mysql-test/t/func_if.test
+++ /dev/null
@@ -1,226 +0,0 @@
-#
-# Init section
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
---disable_query_log
-# Set timezone to something specific, to make it possible to use unix_timestamp
-set time_zone="+03:00";
---enable_query_log
-
-#
-# Simple IF tests
-#
-
-select IF(0,"ERROR","this"),IF(1,"is","ERROR"),IF(NULL,"ERROR","a"),IF(1,2,3)|0,IF(1,2.0,3.0)+0 ;
-
-#
-# Test of IF and case-sensitiveness
-#
-CREATE TABLE t1 (st varchar(255) NOT NULL, u int(11) NOT NULL) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('a',1),('A',1),('aa',1),('AA',1),('a',1),('aaa',0),('BBB',0);
-select if(1,st,st) s from t1 order by s;
-select if(u=1,st,st) s from t1 order by s;
-select if(u=1,binary st,st) s from t1 order by s;
-select if(u=1,st,binary st) s from t1 where st like "%a%" order by s;
-explain extended select if(u=1,st,binary st) s from t1 where st like "%a%" order by s;
-
-#
-# NULLIF test
-#
-select nullif(u, 1) from t1;
-explain extended select nullif(u, 1) from t1;
-drop table t1;
-select nullif(1,'test');
-
-#
-# Bug 2629
-#
-select NULLIF(NULL,NULL), NULLIF(NULL,1), NULLIF(NULL,1.0), NULLIF(NULL,"test");
-select NULLIF(1,NULL), NULLIF(1.0, NULL), NULLIF("test", NULL);
-
-#
-# Problem with IF()
-#
-
-create table t1 (num double(12,2));
-insert into t1 values (144.54);
-select sum(if(num is null,0.00,num)) from t1;
-drop table t1;
-create table t1 (x int, y int);
-insert into t1 values (0,6),(10,16),(20,26),(30,10),(40,46),(50,56);
-select min(if(y -x > 5,y,NULL)), max(if(y - x > 5,y,NULL)) from t1;
-drop table t1;
-
-#
-# BUG#3987
-#
-create table t1 (a int);
-insert t1 values (1),(2);
-select if(1>2,a,avg(a)) from t1;
-drop table t1;
-
-#
-# Bug #5595 NULLIF() IS NULL returns false if NULLIF() returns NULL
-#
-SELECT NULLIF(5,5) IS NULL, NULLIF(5,5) IS NOT NULL;
-
-#
-# Bug #9669 Ordering on IF function with FROM_UNIXTIME function fails
-#
-CREATE TABLE `t1` (
- `id` int(11) NOT NULL ,
- `date` int(10) default NULL,
- `text` varchar(32) NOT NULL
-);
-INSERT INTO t1 VALUES (1,1110000000,'Day 1'),(2,1111000000,'Day 2'),(3,1112000000,'Day 3');
-SELECT id, IF(date IS NULL, '-', FROM_UNIXTIME(date, '%d-%m-%Y')) AS date_ord, text FROM t1 ORDER BY date_ord ASC;
-SELECT id, IF(date IS NULL, '-', FROM_UNIXTIME(date, '%d-%m-%Y')) AS date_ord, text FROM t1 ORDER BY date_ord DESC;
-DROP TABLE t1;
-
-
-#
-# Test for bug #11142: evaluation of NULLIF when the first argument is NULL
-#
-
-CREATE TABLE t1 (a CHAR(10));
-INSERT INTO t1 VALUES ('aaa'), (NULL), (''), ('bbb');
-
-SELECT a, NULLIF(a,'') FROM t1;
-SELECT a, NULLIF(a,'') FROM t1 WHERE NULLIF(a,'') IS NULL;
-
-DROP TABLE t1;
-
-# End of 4.1 tests
-
-#
-# Bug #16272 IF function with decimal args can produce wrong result
-#
-create table t1 (f1 int, f2 int);
-insert into t1 values(1,1),(0,0);
-select f1, f2, if(f1, 40.0, 5.00) from t1 group by f1 order by f2;
-drop table t1;
-
-#
-# Bug#24532 (The return data type of IS TRUE is different from similar
-# operations)
-#
-# IF(x, unsigned, unsigned) should be unsigned.
-#
-
-select if(0, 18446744073709551610, 18446744073709551610);
-
-
-#
-# Bug #37662: nested if() inside sum() is parsed in exponential time
-#
-
-CREATE TABLE t1(a DECIMAL(10,3));
-
-# check : should be fast. more than few secs means failure.
-SELECT t1.a,
- IF((ROUND(t1.a,2)=1), 2,
- IF((ROUND(t1.a,2)=1), 2,
- IF((ROUND(t1.a,2)=1), 2,
- IF((ROUND(t1.a,2)=1), 2,
- IF((ROUND(t1.a,2)=1), 2,
- IF((ROUND(t1.a,2)=1), 2,
- IF((ROUND(t1.a,2)=1), 2,
- IF((ROUND(t1.a,2)=1), 2,
- IF((ROUND(t1.a,2)=1), 2,
- IF((ROUND(t1.a,2)=1), 2,
- IF((ROUND(t1.a,2)=1), 2,
- IF((ROUND(t1.a,2)=1), 2,
- IF((ROUND(t1.a,2)=1), 2,
- IF((ROUND(t1.a,2)=1), 2,
- IF((ROUND(t1.a,2)=1), 2,
- IF((ROUND(t1.a,2)=1), 2,
- IF((ROUND(t1.a,2)=1), 2,
- IF((ROUND(t1.a,2)=1), 2,
- IF((ROUND(t1.a,2)=1), 2,
- IF((ROUND(t1.a,2)=1), 2,
- IF((ROUND(t1.a,2)=1), 2,
- IF((ROUND(t1.a,2)=1), 2,
- IF((ROUND(t1.a,2)=1), 2,
- IF((ROUND(t1.a,2)=1), 2,
- IF((ROUND(t1.a,2)=1), 2,
- IF((ROUND(t1.a,2)=1), 2,
- IF((ROUND(t1.a,2)=1), 2,
- IF((ROUND(t1.a,2)=1), 2,
- IF((ROUND(t1.a,2)=1), 2,
- IF((ROUND(t1.a,2)=1), 2,0)))))))))))))))))))))))))))))) + 1
-FROM t1;
-
-DROP TABLE t1;
-
-#
-# Bug #40761: Assert on sum func on IF(..., CAST(longtext AS UNSIGNED), signed)
-# (was: LEFT JOIN on inline view crashes server)
-#
-
-CREATE TABLE t1 (c LONGTEXT);
-INSERT INTO t1 VALUES(1), (2), (3), (4), ('1234567890123456789');
-
-SELECT IF(1, CAST(c AS UNSIGNED), 0) FROM t1;
-SELECT * FROM (SELECT MAX(IF(1, CAST(c AS UNSIGNED), 0)) FROM t1) AS te;
-SELECT * FROM (SELECT MAX(IFNULL(CAST(c AS UNSIGNED), 0)) FROM t1) AS te;
-
-DROP TABLE t1;
-
---echo End of 5.0 tests
-
---echo #
---echo # Bug#55077: Assertion failed: width > 0 && to != ((void *)0), file .\dtoa.c
---echo #
-
-CREATE TABLE t1 (a LONGBLOB, b DOUBLE);
-INSERT INTO t1 VALUES (NULL, 0), (NULL, 1);
-
-SELECT IF(b, (SELECT a FROM t1 LIMIT 1), b) c FROM t1 GROUP BY c;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug#12532830
---echo # SIGFPE OR ASSERTION (PRECISION <= ((9 * 9) - 8*2)) && (DEC <= 30)
---echo #
-
-let $nines= 9999999999999999999999999999999999999;
-eval select
-sum(distinct(if('a',
- (select adddate(elt(convert($nines,decimal(64,0)),count(*)),
- interval 1 day))
- , .1))) as foo;
-
---echo #
---echo # LP bug#998321 Simple query with IF expression causes an
---echo # assertion abort (see also mysql Bug#12620084)
---echo #
-
-SELECT if(0, (SELECT min('hello')), NULL);
-SELECT if(1, (SELECT min('hello')), NULL);
-SELECT if(0, NULL, (SELECT min('hello')));
-SELECT if(1, NULL, (SELECT min('hello')));
-
---echo End of 5.2 tests
-
---echo #
---echo # MDEV-8663: IF Statement returns multiple values erroneously
---echo # (or Assertion `!null_value' failed in Item::send(Protocol*, String*)
---echo #
-CREATE TABLE `t1` (
-`datas` VARCHAR(25) NOT NULL
-) DEFAULT CHARSET=utf8;
-
-INSERT INTO `t1` VALUES ('1,2'), ('2,3'), ('3,4');
-
-SELECT IF(FIND_IN_SET('1', `datas`), 1.5, IF(FIND_IN_SET('2', `datas`), 2, NULL)) AS `First`, '1' AS `Second`, '2' AS `Third` FROM `t1`;
-
-drop table t1;
-
---disable_query_log
-# Restore timezone to default
-set time_zone= @@global.time_zone;
---enable_query_log
diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test
deleted file mode 100644
index b99fad159c2..00000000000
--- a/mysql-test/t/func_in.test
+++ /dev/null
@@ -1,692 +0,0 @@
-# Initialise
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-#
-# test of IN (NULL)
-#
-
-select 1 in (1,2,3);
-select 10 in (1,2,3);
-select NULL in (1,2,3);
-select 1 in (1,NULL,3);
-select 3 in (1,NULL,3);
-select 10 in (1,NULL,3);
-select 1.5 in (1.5,2.5,3.5);
-select 10.5 in (1.5,2.5,3.5);
-select NULL in (1.5,2.5,3.5);
-select 1.5 in (1.5,NULL,3.5);
-select 3.5 in (1.5,NULL,3.5);
-select 10.5 in (1.5,NULL,3.5);
-
-CREATE TABLE t1 (a int, b int, c int);
-insert into t1 values (1,2,3), (1,NULL,3);
-select 1 in (a,b,c) from t1;
-select 3 in (a,b,c) from t1;
-select 10 in (a,b,c) from t1;
-select NULL in (a,b,c) from t1;
-drop table t1;
-CREATE TABLE t1 (a float, b float, c float);
-insert into t1 values (1.5,2.5,3.5), (1.5,NULL,3.5);
-select 1.5 in (a,b,c) from t1;
-select 3.5 in (a,b,c) from t1;
-select 10.5 in (a,b,c) from t1;
-drop table t1;
-CREATE TABLE t1 (a varchar(10), b varchar(10), c varchar(10));
-insert into t1 values ('A','BC','EFD'), ('A',NULL,'EFD');
-select 'A' in (a,b,c) from t1;
-select 'EFD' in (a,b,c) from t1;
-select 'XSFGGHF' in (a,b,c) from t1;
-drop table t1;
-
-CREATE TABLE t1 (field char(1));
-INSERT INTO t1 VALUES ('A'),(NULL);
-SELECT * from t1 WHERE field IN (NULL);
-SELECT * from t1 WHERE field NOT IN (NULL);
-SELECT * from t1 where field = field;
-SELECT * from t1 where field <=> field;
-DELETE FROM t1 WHERE field NOT IN (NULL);
-SELECT * FROM t1;
-drop table t1;
-
-create table t1 (id int(10) primary key);
-insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9);
-select * from t1 where id in (2,5,9);
-drop table t1;
-
-create table t1 (
-a char(1) character set latin1 collate latin1_general_ci,
-b char(1) character set latin1 collate latin1_swedish_ci,
-c char(1) character set latin1 collate latin1_danish_ci
-);
-insert into t1 values ('A','B','C');
-insert into t1 values ('a','c','c');
---error 1267
-select * from t1 where a in (b);
---error 1270
-select * from t1 where a in (b,c);
---error 1271
-select * from t1 where 'a' in (a,b,c);
-select * from t1 where 'a' in (a);
-select * from t1 where a in ('a');
-select * from t1 where 'a' collate latin1_general_ci in (a,b,c);
-select * from t1 where 'a' collate latin1_bin in (a,b,c);
-select * from t1 where 'a' in (a,b,c collate latin1_bin);
-explain extended select * from t1 where 'a' in (a,b,c collate latin1_bin);
-drop table t1;
-
-set names utf8;
-create table t1 (a char(10) character set utf8 not null);
-insert into t1 values ('bbbb'),(_koi8r''),(_latin1'');
-select a from t1 where a in ('bbbb',_koi8r'',_latin1'') order by a;
-drop table t1;
-# Bug#7834 Illegal mix of collations in IN operator
-create table t1 (a char(10) character set latin1 not null);
-insert into t1 values ('a'),('b'),('c');
-select a from t1 where a IN ('a','b','c') order by a;
-drop table t1;
-set names latin1;
-
-select '1.0' in (1,2);
-select 1 in ('1.0',2);
-select 1 in (1,'2.0');
-select 1 in ('1.0',2.0);
-select 1 in (1.0,'2.0');
-select 1 in ('1.1',2);
-select 1 in ('1.1',2.0);
-
-# Test case for bug #6365
-
-create table t1 (a char(2) character set binary);
-insert into t1 values ('aa'), ('bb');
-select * from t1 where a in (NULL, 'aa');
-drop table t1;
-
-# BUG#13419
-create table t1 (id int, key(id));
-insert into t1 values (1),(2),(3);
-select count(*) from t1 where id not in (1);
-select count(*) from t1 where id not in (1,2);
-drop table t1;
-
-
-#
-# BUG#17047: CHAR() and IN() can return NULL without signaling NULL
-# result
-#
-# The problem was in the IN() function that ignored maybe_null flags
-# of all arguments except the first (the one _before_ the IN
-# keyword, '1' in the test case below).
-#
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 SELECT 1 IN (2, NULL);
---echo SELECT should return NULL.
-SELECT * FROM t1;
-
-DROP TABLE t1;
-
-
---echo End of 4.1 tests
-
-
-#
-# Bug #11885: WHERE condition with NOT IN (one element)
-#
-
-CREATE TABLE t1 (a int PRIMARY KEY);
-INSERT INTO t1 VALUES (44), (45), (46);
-
-SELECT * FROM t1 WHERE a IN (45);
-SELECT * FROM t1 WHERE a NOT IN (0, 45);
-SELECT * FROM t1 WHERE a NOT IN (45);
-
-CREATE VIEW v1 AS SELECT * FROM t1 WHERE a NOT IN (45);
-SHOW CREATE VIEW v1;
-SELECT * FROM v1;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-# BUG#15872: Excessive memory consumption of range analysis of NOT IN
-create table t1 (a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t2 (a int, filler char(200), key(a));
-
-insert into t2 select C.a*2, 'no' from t1 A, t1 B, t1 C;
-insert into t2 select C.a*2+1, 'yes' from t1 C;
-
-explain
-select * from t2 where a NOT IN (0, 2,4,6,8,10,12,14,16,18);
-select * from t2 where a NOT IN (0, 2,4,6,8,10,12,14,16,18);
-
-explain select * from t2 force index(a) where a NOT IN (2,2,2,2,2,2);
-explain select * from t2 force index(a) where a <> 2;
-
-drop table t2;
-
-#
-# Repeat the test for DATETIME
-#
-create table t2 (a datetime, filler char(200), key(a));
-
-insert into t2 select '2006-04-25 10:00:00' + interval C.a minute,
- 'no' from t1 A, t1 B, t1 C where C.a % 2 = 0;
-
-insert into t2 select '2006-04-25 10:00:00' + interval C.a*2+1 minute,
- 'yes' from t1 C;
-
-explain
-select * from t2 where a NOT IN (
- '2006-04-25 10:00:00','2006-04-25 10:02:00','2006-04-25 10:04:00',
- '2006-04-25 10:06:00', '2006-04-25 10:08:00');
-select * from t2 where a NOT IN (
- '2006-04-25 10:00:00','2006-04-25 10:02:00','2006-04-25 10:04:00',
- '2006-04-25 10:06:00', '2006-04-25 10:08:00');
-drop table t2;
-
-#
-# Repeat the test for CHAR(N)
-#
-create table t2 (a varchar(10), filler char(200), key(a));
-
-insert into t2 select 'foo', 'no' from t1 A, t1 B;
-insert into t2 select 'barbar', 'no' from t1 A, t1 B;
-insert into t2 select 'bazbazbaz', 'no' from t1 A, t1 B;
-
-insert into t2 values ('fon', '1'), ('fop','1'), ('barbaq','1'),
- ('barbas','1'), ('bazbazbay', '1'),('zz','1');
-
-explain select * from t2 where a not in('foo','barbar', 'bazbazbaz');
-
-drop table t2;
-
-#
-# Repeat for DECIMAL
-#
-create table t2 (a decimal(10,5), filler char(200), key(a));
-
-insert into t2 select 345.67890, 'no' from t1 A, t1 B;
-insert into t2 select 43245.34, 'no' from t1 A, t1 B;
-insert into t2 select 64224.56344, 'no' from t1 A, t1 B;
-
-insert into t2 values (0, '1'), (22334.123,'1'), (33333,'1'),
- (55555,'1'), (77777, '1');
-
-explain
-select * from t2 where a not in (345.67890, 43245.34, 64224.56344);
-select * from t2 where a not in (345.67890, 43245.34, 64224.56344);
-
-drop table t2;
-
-# Try a very big IN-list
-create table t2 (a int, key(a), b int);
-insert into t2 values (1,1),(2,2);
-
-set @cnt= 1;
-set @str="update t2 set b=1 where a not in (";
-select count(*) from (
- select @str:=concat(@str, @cnt:=@cnt+1, ",")
- from t1 A, t1 B, t1 C, t1 D) Z;
-
-set @str:=concat(@str, "10000)");
-select substr(@str, 1, 50);
-prepare s from @str;
-execute s;
-deallocate prepare s;
-set @str=NULL;
-
-drop table t2;
-drop table t1;
-
-# BUG#19618: Crash in range optimizer for
-# "unsigned_keypart NOT IN(negative_number,...)"
-# (introduced in fix BUG#15872)
-create table t1 (
- some_id smallint(5) unsigned,
- key (some_id)
-);
-insert into t1 values (1),(2);
-select some_id from t1 where some_id not in(2,-1);
-select some_id from t1 where some_id not in(-4,-1,-4);
-select some_id from t1 where some_id not in(-4,-1,3423534,2342342);
-
-#
-# BUG#24261: crash when WHERE contains NOT IN ('<negative value>') for unsigned column type
-#
-
-select some_id from t1 where some_id not in('-1', '0');
-
-drop table t1;
-
-#
-# BUG#20420: optimizer reports wrong keys on left join with IN
-#
-CREATE TABLE t1 (a int, b int, PRIMARY KEY (a));
-INSERT INTO t1 VALUES (1,1),(2,1),(3,1),(4,1),(5,1),(6,1);
-
-CREATE TABLE t2 (a int, b int, PRIMARY KEY (a));
-INSERT INTO t2 VALUES (3,2),(4,2),(100,100),(101,201),(102,102);
-
-CREATE TABLE t3 (a int PRIMARY KEY);
-INSERT INTO t3 VALUES (1),(2),(3),(4);
-
-CREATE TABLE t4 (a int PRIMARY KEY,b int);
-INSERT INTO t4 VALUES (1,1),(2,2),(1000,1000),(1001,1001),(1002,1002),
- (1003,1003),(1004,1004);
-
-EXPLAIN SELECT STRAIGHT_JOIN * FROM t3
- JOIN t1 ON t3.a=t1.a
- JOIN t2 ON t3.a=t2.a
- JOIN t4 WHERE t4.a IN (t1.b, t2.b);
-
-SELECT STRAIGHT_JOIN * FROM t3
- JOIN t1 ON t3.a=t1.a
- JOIN t2 ON t3.a=t2.a
- JOIN t4 WHERE t4.a IN (t1.b, t2.b);
-
-EXPLAIN SELECT STRAIGHT_JOIN
- (SELECT SUM(t4.a) FROM t4 WHERE t4.a IN (t1.b, t2.b))
- FROM t3, t1, t2
- WHERE t3.a=t1.a AND t3.a=t2.a;
-
-SELECT STRAIGHT_JOIN
- (SELECT SUM(t4.a) FROM t4 WHERE t4.a IN (t1.b, t2.b))
- FROM t3, t1, t2
- WHERE t3.a=t1.a AND t3.a=t2.a;
-
-DROP TABLE t1,t2,t3,t4;
-
-#
-# BUG#19342: IN works incorrectly for BIGINT UNSIGNED values
-#
-CREATE TABLE t1(a BIGINT UNSIGNED);
-INSERT INTO t1 VALUES (0xFFFFFFFFFFFFFFFF);
-
-SELECT * FROM t1 WHERE a=-1 OR a=-2 ;
-SELECT * FROM t1 WHERE a IN (-1, -2);
-
-CREATE TABLE t2 (a BIGINT UNSIGNED);
-insert into t2 values(13491727406643098568),
- (0x7fffffefffffffff),
- (0x7ffffffeffffffff),
- (0x7fffffffefffffff),
- (0x7ffffffffeffffff),
- (0x7fffffffffefffff),
- (0x7ffffffffffeffff),
- (0x7fffffffffffefff),
- (0x7ffffffffffffeff),
- (0x7fffffffffffffef),
- (0x7ffffffffffffffe),
- (0x7fffffffffffffff),
- (0x8000000000000000),
- (0x8000000000000001),
- (0x8000000000000002),
- (0x8000000000000300),
- (0x8000000000000400),
- (0x8000000000000401),
- (0x8000000000004001),
- (0x8000000000040001),
- (0x8000000000400001),
- (0x8000000004000001),
- (0x8000000040000001),
- (0x8000000400000001),
- (0x8000004000000001),
- (0x8000040000000001);
-
-SELECT HEX(a) FROM t2 WHERE a IN
- (CAST(0xBB3C3E98175D33C8 AS UNSIGNED),
- 42);
-
-SELECT HEX(a) FROM t2 WHERE a IN
- (CAST(0xBB3C3E98175D33C8 AS UNSIGNED),
- CAST(0x7fffffffffffffff AS UNSIGNED),
- CAST(0x8000000000000000 AS UNSIGNED),
- CAST(0x8000000000000400 AS UNSIGNED),
- CAST(0x8000000000000401 AS UNSIGNED),
- 42);
-
-SELECT HEX(a) FROM t2 WHERE a IN
- (CAST(0x7fffffffffffffff AS UNSIGNED),
- CAST(0x8000000000000001 AS UNSIGNED));
-SELECT HEX(a) FROM t2 WHERE a IN
- (CAST(0x7ffffffffffffffe AS UNSIGNED),
- CAST(0x7fffffffffffffff AS UNSIGNED));
-SELECT HEX(a) FROM t2 WHERE a IN
- (0x7ffffffffffffffe,
- 0x7fffffffffffffff,
- 'abc');
-
-CREATE TABLE t3 (a BIGINT UNSIGNED);
-INSERT INTO t3 VALUES (9223372036854775551);
-
-SELECT HEX(a) FROM t3 WHERE a IN (9223372036854775807, 42);
-
-CREATE TABLE t4 (a DATE);
-INSERT INTO t4 VALUES ('1972-02-06'), ('1972-07-29');
-SELECT * FROM t4 WHERE a IN ('1972-02-06','19772-07-29');
-
-DROP TABLE t1,t2,t3,t4;
-
-#
-# BUG#27362: IN with a decimal expression that may return NULL
-#
-
-CREATE TABLE t1 (id int not null);
-INSERT INTO t1 VALUES (1),(2);
-
-SELECT id FROM t1 WHERE id IN(4564, (SELECT IF(1=0,1,1/0)) );
-
-DROP TABLE t1;
-
---echo End of 5.0 tests
-
-
-#
-# Bug#18360: Type aggregation for IN and CASE may lead to a wrong result
-#
-create table t1(f1 char(1));
-insert into t1 values ('a'),('b'),('1');
-select f1 from t1 where f1 in ('a',1);
-select f1, case f1 when 'a' then '+' when 1 then '-' end from t1;
-create index t1f1_idx on t1(f1);
-select f1 from t1 where f1 in ('a',1);
-explain select f1 from t1 where f1 in ('a',1);
-select f1 from t1 where f1 in ('a','b');
-explain select f1 from t1 where f1 in ('a','b');
-select f1 from t1 where f1 in (2,1);
-explain select f1 from t1 where f1 in (2,1);
-create table t2(f2 int, index t2f2(f2));
-insert into t2 values(0),(1),(2);
-select f2 from t2 where f2 in ('a',2);
-explain select f2 from t2 where f2 in ('a',2);
-select f2 from t2 where f2 in ('a','b');
-explain select f2 from t2 where f2 in ('a','b');
-select f2 from t2 where f2 in (1,'b');
-explain select f2 from t2 where f2 in (1,'b');
-drop table t1, t2;
-
-#
-# Bug #31075: crash in get_func_mm_tree
-#
-
-create table t1 (a time, key(a));
-insert into t1 values (),(),(),(),(),(),(),(),(),();
-select a from t1 where a not in (a,a,a) group by a;
-drop table t1;
-
-#
-# Bug #37761: IN handles NULL differently for table-subquery and value-list
-#
-
-create table t1 (id int);
-select * from t1 where NOT id in (select null union all select 1);
-select * from t1 where NOT id in (null, 1);
-drop table t1;
-
-#
-# Bug #41363: crash of mysqld on windows with aggregate in case
-#
-
-CREATE TABLE t1(c0 INTEGER, c1 INTEGER, c2 INTEGER);
-INSERT INTO t1 VALUES(1, 1, 1), (1, 1, 1);
-
-SELECT CASE AVG (c0) WHEN c1 * c2 THEN 1 END FROM t1;
-SELECT CASE c1 * c2 WHEN SUM(c0) THEN 1 WHEN AVG(c0) THEN 2 END FROM t1;
-SELECT CASE c1 WHEN c1 + 1 THEN 1 END, ABS(AVG(c0)) FROM t1;
-
-DROP TABLE t1;
-
-#
-# Bug #44399: crash with statement using TEXT columns, aggregates, GROUP BY,
-# and HAVING
-#
-
-CREATE TABLE t1(a TEXT, b INT, c INT UNSIGNED, d DECIMAL(12,2), e REAL);
-INSERT INTO t1 VALUES('iynfj', 1, 1, 1, 1);
-INSERT INTO t1 VALUES('innfj', 2, 2, 2, 2);
-SELECT SUM( DISTINCT a ) FROM t1 GROUP BY a HAVING a IN ( AVG( 1 ), 1 + a);
-SELECT SUM( DISTINCT b ) FROM t1 GROUP BY b HAVING b IN ( AVG( 1 ), 1 + b);
-SELECT SUM( DISTINCT c ) FROM t1 GROUP BY c HAVING c IN ( AVG( 1 ), 1 + c);
-SELECT SUM( DISTINCT d ) FROM t1 GROUP BY d HAVING d IN ( AVG( 1 ), 1 + d);
-SELECT SUM( DISTINCT e ) FROM t1 GROUP BY e HAVING e IN ( AVG( 1 ), 1 + e);
-SELECT SUM( DISTINCT e ) FROM t1 GROUP BY b,c,d HAVING (b,c,d) IN
- ((AVG( 1 ), 1 + c, 1 + d), (AVG( 1 ), 2 + c, 2 + d));
-DROP TABLE t1;
-
---echo #
---echo # Bug #44139: Table scan when NULL appears in IN clause
---echo #
-
---disable_warnings
-
-CREATE TABLE t1 (
- c_int INT NOT NULL,
- c_decimal DECIMAL(5,2) NOT NULL,
- c_float FLOAT(5, 2) NOT NULL,
- c_bit BIT(10) NOT NULL,
- c_date DATE NOT NULL,
- c_datetime DATETIME NOT NULL,
- c_timestamp TIMESTAMP NOT NULL,
- c_time TIME NOT NULL,
- c_year YEAR NOT NULL,
- c_char CHAR(10) NOT NULL,
- INDEX(c_int), INDEX(c_decimal), INDEX(c_float), INDEX(c_bit), INDEX(c_date),
- INDEX(c_datetime), INDEX(c_timestamp), INDEX(c_time), INDEX(c_year),
- INDEX(c_char));
-
-INSERT IGNORE INTO t1 (c_int) VALUES (1), (2), (3), (4), (5);
-INSERT IGNORE INTO t1 (c_int) SELECT 0 FROM t1;
-INSERT IGNORE INTO t1 (c_int) SELECT 0 FROM t1;
-
---enable_warnings
-
-EXPLAIN SELECT * FROM t1 WHERE c_int IN (1, 2, 3);
-EXPLAIN SELECT * FROM t1 WHERE c_int IN (NULL, 1, 2, 3);
-
-EXPLAIN SELECT * FROM t1 WHERE c_int IN (1, 2, 3);
-EXPLAIN SELECT * FROM t1 WHERE c_int IN (1, NULL, 2, NULL, 3, NULL);
-EXPLAIN SELECT * FROM t1 WHERE c_int IN (NULL);
-EXPLAIN SELECT * FROM t1 WHERE c_int IN (NULL, NULL);
-
-EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (1, 2, 3);
-EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (NULL, 1, 2, 3);
-EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (NULL);
-EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (NULL, NULL);
-
-EXPLAIN SELECT * FROM t1 WHERE c_float IN (1, 2, 3);
-EXPLAIN SELECT * FROM t1 WHERE c_float IN (NULL, 1, 2, 3);
-EXPLAIN SELECT * FROM t1 WHERE c_float IN (NULL);
-EXPLAIN SELECT * FROM t1 WHERE c_float IN (NULL, NULL);
-
-EXPLAIN SELECT * FROM t1 WHERE c_bit IN (1, 2, 3);
-EXPLAIN SELECT * FROM t1 WHERE c_bit IN (NULL, 1, 2, 3);
-EXPLAIN SELECT * FROM t1 WHERE c_bit IN (NULL);
-EXPLAIN SELECT * FROM t1 WHERE c_bit IN (NULL, NULL);
-
-EXPLAIN SELECT * FROM t1 WHERE c_date
- IN ('2009-09-01', '2009-09-02', '2009-09-03');
-EXPLAIN SELECT * FROM t1 WHERE c_date
- IN (NULL, '2009-09-01', '2009-09-02', '2009-09-03');
-EXPLAIN SELECT * FROM t1 WHERE c_date IN (NULL);
-EXPLAIN SELECT * FROM t1 WHERE c_date IN (NULL, NULL);
-
-EXPLAIN SELECT * FROM t1 WHERE c_datetime
- IN ('2009-09-01 00:00:01', '2009-09-02 00:00:01', '2009-09-03 00:00:01');
-EXPLAIN SELECT * FROM t1 WHERE c_datetime
- IN (NULL, '2009-09-01 00:00:01', '2009-09-02 00:00:01', '2009-09-03 00:00:01');
-EXPLAIN SELECT * FROM t1 WHERE c_datetime IN (NULL);
-EXPLAIN SELECT * FROM t1 WHERE c_datetime IN (NULL, NULL);
-
-EXPLAIN SELECT * FROM t1 WHERE c_timestamp
- IN ('2009-09-01 00:00:01', '2009-09-01 00:00:02', '2009-09-01 00:00:03');
-EXPLAIN SELECT * FROM t1 WHERE c_timestamp
- IN (NULL, '2009-09-01 00:00:01', '2009-09-01 00:00:02', '2009-09-01 00:00:03');
-EXPLAIN SELECT * FROM t1 WHERE c_timestamp IN (NULL);
-EXPLAIN SELECT * FROM t1 WHERE c_timestamp IN (NULL, NULL);
-
-EXPLAIN SELECT * FROM t1 WHERE c_year IN (1, 2, 3);
-EXPLAIN SELECT * FROM t1 WHERE c_year IN (NULL, 1, 2, 3);
-EXPLAIN SELECT * FROM t1 WHERE c_year IN (NULL);
-EXPLAIN SELECT * FROM t1 WHERE c_year IN (NULL, NULL);
-
-EXPLAIN SELECT * FROM t1 WHERE c_char IN ('1', '2', '3');
-EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL, '1', '2', '3');
-EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL);
-EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL, NULL);
-
-DROP TABLE t1;
-
---echo #
---echo # Bug#54477: Crash on IN / CASE with NULL arguments
---echo #
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1), (2);
-
-SELECT 1 IN (NULL, a) FROM t1;
-
-SELECT a IN (a, a) FROM t1 GROUP BY a WITH ROLLUP;
-
-SELECT CASE a WHEN a THEN a END FROM t1 GROUP BY a WITH ROLLUP;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug #11766212 59270: NOT IN (YEAR( ... ), ... ) PRODUCES MANY VALGRIND WARNINGS
---echo #
-
-SELECT 1 IN (YEAR(FROM_UNIXTIME(NULL)) ,1);
-
---echo #
-
---echo #
---echo # Bug#13012483: EXPLAIN EXTENDED, PREPARED STATEMENT, CRASH IN CHECK_SIMPLE_EQUALITY
---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 test BUG#13012483
-
---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 #
---echo # End of 5.3 tests
---echo #
-
-#
-# Bug#26361149 MYSQL SERVER CRASHES AT: COL IN(IFNULL(CONST, COL), NAME_CONST('NAME', NULL))
-#
-create table t1 (a int);
-insert t1 values (1),(2),(3);
-select * from t1 where 1 in (a, name_const('a', null));
-drop table t1;
-
---echo #
---echo # End of 5.5 tests
---echo #
-
---echo #
---echo # MDEV-10020 InnoDB NOT IN Query Crash When One Item Is NULL
---echo #
-CREATE TABLE t1
-(
- a INT(11),
- b VARCHAR(10),
- KEY (b)
-);
-INSERT INTO t1 VALUES (1,'x'),(2,'y'),(3,'z');
-SELECT * FROM t1 WHERE b NOT IN (NULL, '', 'A');
-DROP TABLE t1;
-
---echo #
---echo # End of 10.0 tests
---echo #
-
---echo #
---echo # MDEV-8755 Equal field propagation is not performed any longer for the IN list when multiple comparison types
---echo #
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1),(2);
---echo # Ok to propagate equalities into the left IN argument in case of a single comparison type
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=1 AND a IN (1,2,3);
---echo # Ok to propagate equalities into IN () list, even if multiple comparison types
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=1 AND 1 IN (1,a,'3');
---echo # Not Ok to propagate equalities into the left IN argument in case of multiple comparison types
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=1 AND a IN (1,2,'3');
-DROP TABLE t1;
-
---echo #
---echo # Start of 10.3 tests
---echo #
-
---echo #
---echo # MDEV-11514 IN with a mixture of TIME and DATETIME returns a wrong result
---echo #
-
-SELECT TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32');
-PREPARE stmt FROM "SELECT TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32')";
-EXECUTE stmt;
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-
---echo #
---echo # MDEV-11497 Wrong result for (int_expr IN (mixture of signed and unsigned expressions))
---echo #
-CREATE TABLE t1 (a BIGINT, b BIGINT UNSIGNED);
-INSERT INTO t1 VALUES (-9223372036854775808,18446744073709551615);
-SELECT * FROM t1 WHERE -1 IN (a,b);
-PREPARE stmt FROM 'SELECT * FROM t1 WHERE -1 IN (a,b)';
-EXECUTE stmt;
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-15340 Wrong result HOUR(case_expression_with_time_and_datetime)
---echo #
-
-# This is to make sure that TIME_FUZZY_DATE is always passed to str_to_time(),
-# so empty strings are compared as TIME'00:00:00' all around the code:
-# when using Arg_comparator (e.g. in binary comparison operators), and
-# when not using it (e.g. in IN predicate).
-
-SELECT
- TIME'00:00:00'='' AS c1_true,
- TIME'00:00:00' IN ('', TIME'10:20:30') AS c2_true,
- TIME'00:00:00' NOT IN ('', TIME'10:20:30') AS c3_false;
diff --git a/mysql-test/t/func_int.test b/mysql-test/t/func_int.test
deleted file mode 100644
index 98794561933..00000000000
--- a/mysql-test/t/func_int.test
+++ /dev/null
@@ -1,188 +0,0 @@
---echo #
---echo # Start of 10.3 tests
---echo #
-
-
---echo #
---echo # MDEV-13965 Parameter data type control for Item_longlong_func
---echo #
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ROW(1,1) | 1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT 1 | ROW(1,1);
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ROW(1,1) & 1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT 1 & ROW(1,1);
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ROW(1,1) << 1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT 1 << ROW(1,1);
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ROW(1,1) >> 1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT 1 >> ROW(1,1);
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ~ROW(1,1);
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT TO_SECONDS(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT TIMESTAMPDIFF(SECOND,ROW(1,1), 1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT TIMESTAMPDIFF(SECOND,1, ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT INET_ATON(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT LAST_INSERT_ID(ROW(1,1));
-
-
---echo #
---echo # MDEV-13967 Parameter data type control for Item_long_func
---echo #
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT STRCMP(ROW(1,1),'');
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT STRCMP('',ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CHAR_LENGTH(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT OCTET_LENGTH(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT UNCOMPRESSED_LENGTH(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT COERCIBILITY(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ASCII(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CRC32(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ORD(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT SIGN(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT LOCATE(ROW(1,1),'a',1);
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT LOCATE('a',ROW(1,1),1);
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT LOCATE('a','a',ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT BIT_COUNT(ROW(1,1));
-
---error ER_OPERAND_COLUMNS
-SELECT BENCHMARK(1, ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT BENCHMARK(ROW(1,1),'');
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT SLEEP(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT GET_LOCK('x', ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT GET_LOCK(ROW(1,1),'x');
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT PERIOD_ADD(ROW(1,1),1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT PERIOD_ADD(1,ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT PERIOD_DIFF(ROW(1,1),1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT PERIOD_DIFF(1,ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT TO_DAYS(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT DAYOFMONTH(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT DAYOFYEAR(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT QUARTER(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT YEAR(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT YEARWEEK(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT WEEK(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT WEEK(ROW(1,1),1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT WEEK(1,ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT HOUR(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT MINUTE(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT SECOND(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT MICROSECOND(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT JSON_DEPTH(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT JSON_LENGTH(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT JSON_LENGTH('json', ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT JSON_LENGTH(ROW(1,1), ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT REGEXP_INSTR(ROW(1,1),'');
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT REGEXP_INSTR('',ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT FIND_IN_SET(ROW(1,1),'');
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT FIND_IN_SET('',ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT RELEASE_LOCK(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT IS_FREE_LOCK(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT IS_USED_LOCK(ROW(1,1));
-
---echo #
---echo # End of 10.3 tests
---echo #
diff --git a/mysql-test/t/func_isnull.test b/mysql-test/t/func_isnull.test
deleted file mode 100644
index 4c59fa3cbe8..00000000000
--- a/mysql-test/t/func_isnull.test
+++ /dev/null
@@ -1,88 +0,0 @@
-#
-# test of ISNULL()
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1 (id int auto_increment primary key not null, mydate date not null);
-insert into t1 values (0,"2002-05-01"),(0,"2002-05-01"),(0,"2002-05-01");
-flush tables;
-select * from t1 where isnull(to_days(mydate));
-drop table t1;
-
-# End of 4.1 tests
-
---echo #
---echo # Bug#53933 crash when using uncacheable subquery in the having clause of outer query
---echo #
-
-CREATE TABLE t1 (f1 INT);
-INSERT INTO t1 VALUES (0),(0);
-
-SELECT ISNULL((SELECT GET_LOCK('Bug#53933', 0) FROM t1 GROUP BY f1)) AS f2
-FROM t1 GROUP BY f1 HAVING f2 = f2;
-SELECT RELEASE_LOCK('Bug#53933');
-
-DROP TABLE t1;
-
---echo End of 5.0 tests
-
-#
-# Bug #41371 Select returns 1 row with condition "col is not null and col is null"
-#
-
-CREATE TABLE t1 (id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, PRIMARY KEY(id));
-INSERT INTO t1( id ) VALUES ( NULL );
-SELECT t1.id FROM t1 WHERE (id is not null and id is null );
-DROP TABLE t1;
-
---echo # End of 5.1 tests
-
---echo #
---echo # MDEV-14911: IS NULL for field from mergeable view
---echo #
-
-CREATE TABLE t1 (d1 datetime NOT NULL);
-INSERT INTO t1 VALUES
- ('0000-00-00 00:00:00'), ('0000-00-00 00:00:00'), ('1979-09-03 20:49:36');
-
-SELECT * FROM t1;
-SELECT * FROM t1 WHERE d1 IS NULL;
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE d1 IS NULL;
-SELECT count(*) FROM t1 WHERE d1 IS NULL;
-
-CREATE VIEW v1 AS (SELECT * FROM t1);
-SELECT * FROM v1;
-SELECT * FROM v1 WHERE d1 IS NULL;
-EXPLAIN EXTENDED SELECT * FROM v1 WHERE d1 IS NULL;
-SELECT count(*) FROM v1 WHERE d1 IS NULL;
-
-SET @save_optimizer_switch=@@optimizer_switch;
-
-SET SESSION optimizer_switch='derived_merge=off';
-SELECT count(*) FROM ( SELECT * FROM t1 ) AS a1 WHERE d1 IS NULL;
-SET SESSION optimizer_switch='derived_merge=on';
-SELECT count(*) FROM ( SELECT * FROM t1 ) AS a1 WHERE d1 IS NULL;
-
-SET optimizer_switch=@save_optimizer_switch;
-
-CREATE TABLE t2 (d1 datetime NOT NULL);
-INSERT INTO t2 VALUES
- ('1980-09-03 20:49:36'), ('0000-00-00 00:00:00'), ('1979-09-03 20:49:36');
-
-SELECT * FROM t2 LEFT JOIN t1 ON t2.d1=t1.d1 WHERE t1.d1 IS NULL;
-EXPLAIN EXTENDED
-SELECT * FROM t2 LEFT JOIN t1 ON t2.d1=t1.d1 WHERE t1.d1 IS NULL;
-
-SELECT * FROM t2 LEFT JOIN v1 ON t2.d1=v1.d1 WHERE v1.d1 IS NULL;
-EXPLAIN EXTENDED
-SELECT * FROM t2 LEFT JOIN v1 ON t2.d1=v1.d1 WHERE v1.d1 IS NULL;
-
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
---echo #
---echo # End of 5.5 tests
---echo #
diff --git a/mysql-test/t/func_json.test b/mysql-test/t/func_json.test
deleted file mode 100644
index 2669408fdce..00000000000
--- a/mysql-test/t/func_json.test
+++ /dev/null
@@ -1,426 +0,0 @@
-select json_valid('[1, 2]');
-select json_valid('"string"}');
-select json_valid('{"key1":1, "key2":[2,3]}');
-select json_valid('[false, true, null]');
-select json_valid(repeat('[', 1000));
-select json_valid(repeat('{"a":', 1000));
-
-select json_value('{"key1":123}', '$.key2');
-select json_value('{"key1":123}', '$.key1');
-select json_value('{"key1":[1,2,3]}', '$.key1');
-select json_value('{"key1": [1,2,3], "key1":123}', '$.key1');
-select JSON_VALUE('{ "x": [0,1], "y": "[0,1]", "z": "Mon\\\"t\\\"y" }','$.z');
-
-select json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key2');
-select json_query('{"key1":{"a":1, "b":[1,2]}}', '$.key1');
-select json_query('{"key1": 1}', '$.key1');
-select json_query('{"key1":123, "key1": [1,2,3]}', '$.key1');
-select json_query('{"key1":123, "key1": [1,2,3]}', concat('$', repeat('.k', 1000)));
-
-select json_array();
-select json_array(1);
-select json_array(1, "text", false, null);
-
-select json_array_append('["a", "b"]', '$', FALSE);
-select json_array_append('{"k1":1, "k2":["a", "b"]}', '$.k2', 2);
-select json_array_append('["a", ["b", "c"], "d"]', '$[0]', 2);
-
-select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[1]', 'x');
-select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[2]', 'x');
-select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[3]', 'x');
-select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[4]', 'x');
-select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[1].b[0]', 'x');
-select json_array_insert('true', '$', 1);
-select json_array_insert('["a", {"b": [1, 2]}, [3, 4]]', '$[2][1]', 'y');
-
-select json_contains('{"k1":123, "k2":345}', '123', '$.k1');
-select json_contains('"you"', '"you"');
-select json_contains('"youth"', '"you"');
---error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select json_contains('[1]', '[1]', '$', '$[0]');
-select json_contains('', '', '$');
-select json_contains('null', 'null', '$');
-select json_contains('"10"', '"10"', '$');
-select json_contains('"10"', '10', '$');
-select json_contains('10.1', '10', '$');
-select json_contains('10.0', '10', '$');
-select json_contains('[1]', '1');
-select json_contains('[2, 1]', '1');
-select json_contains('[2, [2, 3], 1]', '1');
-select json_contains('[4, [2, 3], 1]', '2');
-select json_contains('[2, 1]', '[1, 2]');
-select json_contains('[2, 1]', '[1, 0, 2]');
-select json_contains('[2, 0, 3, 1]', '[1, 2]');
-select json_contains('{"b":[1,2], "a":1}', '{"a":1, "b":2}');
-select json_contains('{"a":1}', '{}');
-select json_contains('[1, {"a":1}]', '{}');
-select json_contains('[1, {"a":1}]', '{"a":1}');
-select json_contains('[{"abc":"def", "def":"abc"}]', '["foo","bar"]');
-select json_contains('[{"abc":"def", "def":"abc"}, "bar"]', '["bar", {}]');
-select json_contains('[{"a":"b"},{"c":"d"}]','{"c":"d"}');
-
-select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[1]");
-select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.key2[10]");
-select json_contains_path('{"key1":1, "key2":[2,3]}', "oNE", "$.ma");
-select json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1");
-select json_contains_path('{"key1":1, "key2":[2,3]}', "one", "$.key1", "$.ma");
-select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.ma");
-select json_contains_path('{"key1":1, "key2":[2,3]}', "aLl", "$.key1", "$.key2");
-select json_contains_path('{ "a": true }', NULL, '$.a' );
-select json_contains_path('{ "a": true }', 'all', NULL );
-select json_contains_path('{"a":{"b":"c"}}', 'one', '$.a.*');
-
-select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1");
-select json_extract('{"key1":"asd", "key2":[2,3]}', "$.keyX", "$.keyY");
-select json_extract('{"key1":"asd", "key2":[2,3]}', "$.key1", "$.key2");
-select json_extract('{"key1":5, "key2":[2,3]}', "$.key1", "$.key2");
-select json_extract('{"key0":true, "key1":"qwe"}', "$.key1");
-select json_extract(json_object('foo', 'foobar'),'$');
-select json_extract('[10, 20, [30, 40]]', '$[2][*]');
-select json_extract('[10, 20, [{"a":3}, 30, 40]]', '$[2][*]');
-select json_extract('1', '$');
-select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]');
-select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]', '$[25]');
-select json_extract( '[{"a": [3, 4]}, {"b": 2}]', '$[0].a', '$[1].a');
-
-select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.k1', 'word');
-select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.d[3]', 3);
-select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.a[2]', 2);
-select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.c', 'word');
-
-select json_set('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]');
-
-select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]');
-select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.b', '[true, false]');
-
-set @j = '["a", ["b", "c"], "d"]';
-select json_remove(@j, '$[0]');
-select json_remove(@j, '$[1]');
-select json_remove(@j, '$[2]');
-set @j = '{"a": 1, "b": [2, 3]}';
-select json_remove(@j, '$.b');
-select json_remove(@j, '$.a');
-
-select json_object();
-select json_object("ki", 1, "mi", "ya");
-create table t1 as select json_object('id', 87, 'name', 'carrot') as f;
-show create table t1;
-select * from t1;
-drop table t1;
-
-select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2");
-select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[1]");
-select json_exists('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2[10]");
-
-select json_quote('"string"');
-create table t1 as select json_quote('foo');
-select * from t1;
-show create table t1;
-drop table t1;
-
---error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select json_merge('string');
-select json_merge('string', 123);
-select json_merge('"string"', 123);
-select json_merge('[1, 2]', '[true, false]');
-select json_merge('{"1": 2}', '{"true": false}');
-select json_merge('{"1": 2}', '{"true": false}', '{"3": 4}');
-select json_merge(NULL,json_object('foo', 1));
-select json_merge('a','b');
-select json_merge('{"a":"b"}','{"c":"d"}');
-SELECT JSON_MERGE('[1, 2]', '{"id": 47}');
-
-select json_type('{"k1":123, "k2":345}');
-select json_type('[123, "k2", 345]');
-select json_type("true");
-select json_type('123');
-select json_type('123.12');
-
-select json_keys('{"a":{"c":1, "d":2}, "b":2}');
-select json_keys('{"a":{"c":1, "d":2}, "b":2}', "$.a");
-select json_keys('{"a":{"c":1, "d":2}, "b":2}', "$.b");
-select json_keys('foo');
-#
-# mdev-12789 JSON_KEYS returns duplicate keys twice
-#
-select json_keys('{"a":{"c":1, "d":2}, "b":2, "c":1, "a":3, "b":1, "c":2}');
-select json_keys('{"c1": "value 1", "c1": "value 2"}');
-
-SET @j = '["abc", [{"k": "10"}, "def"], {"x":"abc"}, {"y":"bcd"}]';
-select json_search(@j, 'one', 'abc');
-select json_search(@j, 'all', 'abc');
-select json_search(@j, 'all', 'abc', NULL, '$[2]');
-select json_search(@j, 'all', 'abc', NULL, '$');
-select json_search(@j, 'all', '10', NULL, '$');
-select json_search(@j, 'all', '10', NULL, '$[*]');
-select json_search(@j, 'all', '10', NULL, '$[*][0].k');
-select json_search(@j, 'all', '10', NULL, '$**.k');
-create table t1( json_col text );
-insert into t1 values
-('{ "a": "foobar" }'),
- ('{ "a": "foobar", "b": "focus", "c": [ "arm", "foot", "shoulder" ] }');
-select json_search( json_col, 'all', 'foot' ) from t1;
-drop table t1;
-
-
-select json_unquote('"abc"');
-select json_unquote('abc');
-#
-# MDEV-13703 Illegal mix of collations for operation 'json_object' on using JSON_UNQUOTE as an argument.
-#
-create table t1 (c VARCHAR(8)) DEFAULT CHARSET=latin1;
-insert into t1 values ('abc'),('def');
-
-select json_object('foo', json_unquote(json_object('bar', c)),'qux', c) as fld from t1;
-drop table t1;
-
-select json_object("a", json_object("b", "abcd"));
-select json_object("a", '{"b": "abcd"}');
-select json_object("a", json_compact('{"b": "abcd"}'));
-
-select json_compact(NULL);
-select json_depth(json_compact(NULL));
-select json_depth('[[], {}]');
-select json_depth('[[[1,2,3],"s"], {}, []]');
-select json_depth('[10, {"a": 20}]');
-
-select json_length('');
-select json_length('{}');
-select json_length('[1, 2, {"a": 3}]');
-select json_length('{"a": 1, "b": {"c": 30}}', '$.b');
-select json_length('{"a": 1, "b": {"c": 30}}');
-select json_length('{}{');
-
-create table json (j INT);
-show create table json;
-drop table json;
-
-select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2]' );
-select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0]' );
-select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0]' );
-select json_length( '[ 1, [ 2, 3, 4 ], 5 ]', '$[2][0][0][0]' );
-select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2]' );
-select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0]' );
-select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0]' );
-select json_length( '[ 1, [ 2, 3, 4 ], {"a":5, "b":6} ]', '$[2][0][0][0]' );
-select json_length( '{"a":{"b":{"d":1}}, "a":{"c":{"d":1, "j":2}}}', '$.a[0][0][0].c' );
-
-select json_set('1', '$[0]', 100);
-select json_set('1', '$[0][0]', 100);
-select json_set('1', '$[1]', 100);
-select json_set('{"a":12}', '$[0]', 100);
-select json_set('{"a":12}', '$[0].a', 100);
-select json_set('{"a":12}', '$[0][0].a', 100);
-select json_set('{"a":12}', '$[0][1].a', 100);
-
-select json_value('{"\\"key1":123}', '$."\\"key1"');
-select json_value('{"\\"key1\\"":123}', '$."\\"key1\\""');
-select json_value('{"key 1":123}', '$."key 1"');
-
-select json_contains_path('{"a":[{"c":[1,{"a":[0,1,2]},3]}], "b":[1,2,3]}', 'one', "$**.a[2]");
-select json_contains_path('{"a":[{"c":[1,{"a":[0,1,2]},3]}], "b":[1,2,3]}', 'one', "$**.a[3]");
-
-select json_extract( '[1]', '$[0][0]' );
-select json_extract( '[1]', '$[1][0]' );
-select json_extract( '[1]', '$**[0]' );
-select json_extract( '[1]', '$**[0][0]' );
-
-select json_insert('1', '$[0]', 4);
-select json_replace('1', '$[0]', 4);
-select json_set('1', '$[0]', 4);
-select json_set('1', '$[1]', 4);
-select json_replace('1', '$[1]', 4);
-SELECT json_insert('[]', '$[0][0]', 100);
-SELECT json_insert('1', '$[0][0]', 100);
-SELECT json_replace('1', '$[0][0]', 100);
-SELECT json_replace('[]', '$[0][0]', 100);
-SELECT json_set('[]', '$[0][0]', 100);
-SELECT json_set('[]', '$[0][0][0]', 100);
-
-#
-# MDEV-11857 json_search() shows "Out of memory" with empty key.
-#
-SELECT JSON_search( '{"": "a"}', "one", 'a');
-
-#
-# MDEV-11858 json_merge() concatenates instead of merging.
-#
-
-select json_merge('{"a":"b"}', '{"a":"c"}') ;
-select json_merge('{"a":{"x":"b"}}', '{"a":"c"}') ;
-select json_merge('{"a":{"u":12, "x":"b"}}', '{"a":{"x":"c"}}') ;
-select json_merge('{"a":{"u":12, "x":"b", "r":1}}', '{"a":{"x":"c", "r":2}}') ;
-
-select json_compact('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}');
-select json_loose('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}');
-select json_detailed('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}');
-
-#
-# MDEV-11856 json_search doesn't search for values with double quotes character (")
-#
-
-SELECT JSON_search( '{"x": "\\""}', "one", '"');
-SELECT JSON_search( '{"x": "\\""}', "one", '\\"');
-
-#
-# MDEV-11833 JSON functions don't seem to respect max_allowed_packet.
-#
-set @@global.net_buffer_length=1024;
-set @@global.max_allowed_packet=2048;
---connect (newconn, localhost, root,,)
-
-show variables like 'net_buffer_length';
-show variables like 'max_allowed_packet';
-select json_array(repeat('a',1024),repeat('a',1024));
-select json_object("a", repeat('a',1024),"b", repeat('a',1024));
---connection default
-
-set @@global.max_allowed_packet = default;
-set @@global.net_buffer_length = default;
---disconnect newconn
-
-
-#
-# MDEV-12262 Assertion `!null_value' failed in virtual bool Item::send on JSON_REMOVE.
-#
-create table t1(j longtext, p longtext);
-insert into t1 values
- ('{"a":1,"b":2,"c":3}','$.a'),
- ('{"a":1,"b":2,"c":3}','$.b'),
- ('{"a":1,"b":2,"c":3}','$.c');
-select j, p, json_remove(j, p) from t1;
-drop table t1;
-
-#
-# MDEV-12364 Server crashes in __memcpy_sse2_unaligned / String::copy on JSON_SEARCH with variables.
-#
-SET @str = 'bar', @path = '$';
-SELECT JSON_SEARCH('{"foo":"bar"}', 'all' , @str, '%', @path);
-
-#
-# MDEV-12351 Assertion `cur_step->type & JSON_PATH_KEY' failed in json_find_path.
-#
-
-SELECT JSON_VALUE('[{"foo": 1},"bar"]', '$[*][0]');
-
-#
-# MDEV-12363 Assertion `0' failed in Type_handler_string_result::make_sort_key(uchar*, Item*, const SORT_FIELD_ATTR*, Sort_param*)
-#
-
-CREATE TABLE t1 (f INT NOT NULL);
-INSERT INTO t1 VALUES (0);
-SELECT JSON_KEYS(f) FROM t1 ORDER BY 1;
-DROP TABLE t1;
-
-#
-# MDEV-12324 Wrong result (phantom array value) on JSON_EXTRACT.
-#
-SELECT JSON_EXTRACT( '{"foo":"bar"}', '$[*].*' );
-SELECT JSON_EXTRACT( '{"foo":"bar"}', '$[*]' );
-
-#
-# MDEV-12604 Comparison of JSON_EXTRACT result differs with Mysql.
-#
-
-select JSON_EXTRACT('{"name":"value"}', '$.name') = 'value';
-select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = true;
-select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = false;
-select JSON_EXTRACT('{\"asdf\":true}', "$.\"asdf\"") = 1;
-select JSON_EXTRACT('{\"input1\":\"\\u00f6\"}', '$.\"input1\"');
-
-#
-# MDEV-129892 JSON_EXTRACT returns data for invalid JSON
-#
-select JSON_EXTRACT('{"foo": "bar" foobar foo invalid ', '$.foo');
-
-#
-# MDEV-13138 JSON_OBJECT returns null with strings containing backticks.
-#
-SELECT JSON_OBJECT('foo', '`');
-SELECT JSON_OBJECT("foo", "bar`bar");
-
-#
-# MDEV-13324 JSON_SET returns NULL instead of object.
-#
-SELECT JSON_SET('{}', '$.age', 87);
-
-#
-# MDEV-13104 Json functions.
-#
-SELECT JSON_MERGE('[]', '{"c":"d"}');
-
-#
-# MDEV-12774 JSON_EXTRACT fails with some escaped unicode as key.
-#
-
-SET @str = "{\"\\u00e4\\u00f6\":\"yes\"}";
-SET @path = "$.\"\\u00e4\\u00f6\"";
-select @str, @path, JSON_EXTRACT(@str, @path);
-SET @str = "{\"\\u00e4\":\"yes\"}";
-SET @path = "$.\"\\u00e4\"";
-select @str, @path, JSON_EXTRACT(@str, @path);
-
-#
-# MDEV-12877 Wrong result from JSON native function.
-#
-select json_array(5,json_query('[1,2]','$'));
-
-#
-# MDEV-13633 JSON_ARRAY() - bad output with some UTF8 characters.
-#
-
-SELECT JSON_ARRAY('1. ě 2. š 3. č 4. ř 5. ž 6. ý 7. á 8. í 9. é 10. ů 11. ú') AS json_data;
-SELECT JSON_OBJECT("user","Jožko Mrkvičká") as json_data;
-
-#
-# MDEV-12312 JSON_CONTAINS_PATH does not detect invalid path and returns TRUE.
-#
-
-select json_contains_path('{"foo":"bar"}', 'one', '$[]');
-
-#
-# MDEV-13971 crash in skip_num_constant.
-#
-select JSON_VALID(0x36f0c8dccd83c5eac156da);
-
-#
-# MDEV-13970 crash in Item_func_json_extract::read_json.
-#
-create table t1(a double not null);
-insert into t1 values (2),(1);
-select 1 from t1 where json_extract(a,'$','$[81]');
-drop table t1;
-
-#
-# MDEV-15561 json_extract returns NULL with numbers in scientific notation.
-#
-
-select json_extract('{"test":8.437e-5}','$.test');
-
---echo #
---echo # End of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
---echo #
-
---enable_metadata
---disable_ps_protocol
-
-SELECT
- JSON_VALID('{"id": 1, "name": "Monty"}') AS json_valid,
- JSON_EXISTS('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2") AS json_exists,
- JSON_CONTAINS('{"A": 0, "B": {"C": 1}, "D": 2}', '2', '$.A') AS ison_contains,
- JSON_CONTAINS_PATH('{"A": 1, "B": [2], "C": [3, 4]}', 'one', '$.A', '$.D') AS json_contains_path;
-
-SELECT
- JSON_LENGTH('{"a": 1, "b": {"c": 30}}') AS json_length,
- JSON_DEPTH('[10, {"a": 20}]') AS json_depnth;
-
---enable_ps_protocol
---disable_metadata
-
---echo #
---echo # End of 10.3 tests
---echo #
diff --git a/mysql-test/t/func_like.test b/mysql-test/t/func_like.test
deleted file mode 100644
index 5026bb76aa3..00000000000
--- a/mysql-test/t/func_like.test
+++ /dev/null
@@ -1,209 +0,0 @@
-#
-# Test of like
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1 (a varchar(10), key(a));
-insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test");
-explain extended select * from t1 where a like 'abc%';
-explain extended select * from t1 where a like concat('abc','%');
-select * from t1 where a like "abc%";
-select * from t1 where a like concat("abc","%");
-select * from t1 where a like "ABC%";
-select * from t1 where a like "test%";
-select * from t1 where a like "te_t";
-
-#
-# The following will test the Turbo Boyer-Moore code
-#
-select * from t1 where a like "%a%";
-select * from t1 where a like "%abcd%";
-select * from t1 where a like "%abc\d%";
-
-drop table t1;
-
-create table t1 (a varchar(10), key(a));
-
-#
-# Bug #2231
-#
-insert into t1 values ('a'), ('a\\b');
-select * from t1 where a like 'a\\%' escape '#';
-select * from t1 where a like 'a\\%' escape '#' and a like 'a\\\\b';
-
-#
-# Bug #4200: Prepared statement parameter as argument to ESCAPE
-#
-prepare stmt1 from 'select * from t1 where a like \'a\\%\' escape ?';
-set @esc='#';
-execute stmt1 using @esc;
-deallocate prepare stmt1;
-
-drop table t1;
-
-#
-# Bug #2885: like and datetime
-#
-
-create table t1 (a datetime);
-insert into t1 values ('2004-03-11 12:00:21');
-select * from t1 where a like '2004-03-11 12:00:21';
-drop table t1;
-
-#
-# Test like with non-default character set
-#
-
-SET NAMES koi8r;
-
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET koi8r);
-
-INSERT INTO t1 VALUES (''),(''),(''),(''),(''),('');
-INSERT INTO t1 VALUES (''),(''),(''),('');
-INSERT INTO t1 VALUES (''),(''),(''),('');
-INSERT INTO t1 VALUES (''),(''),(''),('');
-
-SELECT * FROM t1 WHERE a LIKE '%%';
-SELECT * FROM t1 WHERE a LIKE '%%';
-SELECT * FROM t1 WHERE a LIKE '%';
-
-DROP TABLE t1;
-
-# Bug #2547 Strange "like" behaviour in tables with default charset=cp1250
-# Test like with non-default character set using TurboBM
-#
-SET NAMES cp1250;
-CREATE TABLE t1 (a varchar(250) NOT NULL) DEFAULT CHARACTER SET=cp1250;
-INSERT INTO t1 VALUES
-('Techni Tapes Sp. z o.o.'),
-('Pojazdy Szynowe PESA Bydgoszcz SA Holding'),
-('AKAPESTER 1 P.P.H.U.'),
-('Pojazdy Szynowe PESA Bydgoszcz S A Holding'),
-('PPUH PESKA-I Maria Struniarska');
-
-select * from t1 where a like '%PESA%';
-select * from t1 where a like '%PESA %';
-select * from t1 where a like '%PES%';
-select * from t1 where a like '%PESKA%';
-select * from t1 where a like '%ESKA%';
-DROP TABLE t1;
-
-#
-# LIKE crashed for binary collations in some cases
-#
-select _cp866'aaaaaaaaa' like _cp866'%aaaa%' collate cp866_bin;
-
-#
-# Check 8bit escape character
-#
-set names koi8r;
-select 'andre%' like 'andre%' escape '';
-
-# Check 8bit escape character with charset conversion:
-# For "a LIKE b ESCAPE c" expressions,
-# escape character is converted into the operation character set,
-# which is result of aggregation of character sets of "a" and "b".
-# "c" itself doesn't take part in aggregation, because its collation
-# doesn't matter, escape character is always compared binary.
-# In the example below, escape character is converted from koi8r into cp1251:
-#
-select _cp1251'andre%' like convert('andre%' using cp1251) escape '';
-
-
---echo End of 4.1 tests
-
-
---echo #
---echo # Bug #54575: crash when joining tables with unique set column
---echo #
-CREATE TABLE t1(a SET('a') NOT NULL, UNIQUE KEY(a));
-CREATE TABLE t2(b INT PRIMARY KEY);
-INSERT IGNORE INTO t1 VALUES ();
-INSERT INTO t2 VALUES (1), (2), (3);
-SELECT 1 FROM t2 JOIN t1 ON 1 LIKE a GROUP BY a;
-DROP TABLE t1, t2;
-
---echo #
---echo # Bug#59149 valgrind warnings with "like .. escape .." function
---echo #
---error ER_WRONG_ARGUMENTS
-SELECT '' LIKE '1' ESCAPE COUNT(1);
-
---echo End of 5.1 tests
-
---echo #
---echo # Start of 10.0 tests
---echo #
-
---echo #
---echo # MDEV-5445 Server crashes in Item_func_like::fix_fields on LIKE ExtractValue(..)
---echo #
-SELECT 'a' LIKE REPEAT('',0);
-SELECT 'a' LIKE EXTRACTVALUE('bar','qux');
-
---echo #
---echo # End of 10.0 tests
---echo #
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-8257 Erroneous "Impossible where" when mixing decimal comparison and LIKE
---echo #
-CREATE TABLE t1 (a DECIMAL(8,2));
-INSERT INTO t1 VALUES (10),(20);
-SELECT * FROM t1 WHERE a=10.0;
-SELECT * FROM t1 WHERE a LIKE 10.00;
-SELECT * FROM t1 WHERE a=10.0 AND a LIKE 10.00;
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10.0 AND a LIKE 10.00;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8599 "WHERE varchar_field LIKE temporal_const" does not use range optimizer
---echo #
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1, KEY(a)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('00:00:00');
-INSERT INTO t1 VALUES ('00:00:01');
-INSERT INTO t1 VALUES ('00:00:02');
-INSERT INTO t1 VALUES ('00:00:03');
-INSERT INTO t1 VALUES ('00:00:04');
-INSERT INTO t1 VALUES ('00:00:05');
-INSERT INTO t1 VALUES ('00:00:06');
-INSERT INTO t1 VALUES ('00:00:07');
-EXPLAIN SELECT * FROM t1 WHERE a LIKE '00:00:00';
-EXPLAIN SELECT * FROM t1 WHERE a LIKE TIME'00:00:00';
-SELECT * FROM t1 WHERE a LIKE '00:00:00';
-SELECT * FROM t1 WHERE a LIKE TIME'00:00:00';
-DROP TABLE t1;
-
-
---echo #
---echo # End of 10.1 tests
---echo #
-
-#
-# Item_func_line::print()
-#
-create view v1 as select 'foo!' like 'foo!!', 'foo!' like 'foo!!' escape '!';
-show create view v1;
-select * from v1;
-drop view v1;
-
-create table t1 (a varchar(100),
- b int default (a like '%f\\_'),
- c int default (a like '%f\\_' escape ''),
- d int default (a like '%f\\_' escape '\\'));
-show create table t1;
-insert t1 (a) values ('1 f_'), ('1 f\\_');
-set sql_mode=no_backslash_escapes;
-insert t1 (a) values ('2 f_'), ('2 f\_');
-flush tables;
-insert t1 (a) values ('3 f_'), ('3 f\_');
-set sql_mode=default;
-select * from t1;
-drop table t1;
diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test
deleted file mode 100644
index 83e345ec890..00000000000
--- a/mysql-test/t/func_math.test
+++ /dev/null
@@ -1,661 +0,0 @@
-#
-# Test of math functions
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-select floor(5.5),floor(-5.5);
-explain extended select floor(5.5),floor(-5.5);
-select ceiling(5.5),ceiling(-5.5);
-explain extended select ceiling(5.5),ceiling(-5.5);
-select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2), truncate(-52.64,1),truncate(-52.64,-1);
-explain extended select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2), truncate(-52.64,1),truncate(-52.64,-1);
-select round(5.5),round(-5.5);
-explain extended select round(5.5),round(-5.5);
-select round(5.64,1),round(5.64,2),round(5.64,-1),round(5.64,-2);
-select abs(-10), sign(-5), sign(5), sign(0);
-explain extended select abs(-10), sign(-5), sign(5), sign(0);
---replace_result 2.0000000000000004 2
-select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2);
-explain extended select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2);
-select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
-explain extended select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
-select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
-explain extended select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
-select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
-explain extended select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
-select pow(10,log10(10)),power(2,4);
-explain extended select pow(10,log10(10)),power(2,4);
-set @@rand_seed1=10000000,@@rand_seed2=1000000;
-select rand(999999),rand();
-explain extended select rand(999999),rand();
-select pi(),format(sin(pi()/2),6),format(cos(pi()/2),6),format(abs(tan(pi())),6),format(cot(1),6),format(asin(1),6),format(acos(0),6),format(atan(1),6);
-explain extended select pi(),format(sin(pi()/2),6),format(cos(pi()/2),6),format(abs(tan(pi())),6),format(cot(1),6),format(asin(1),6),format(acos(0),6),format(atan(1),6);
-select degrees(pi()),radians(360);
-
-select format(atan(-2, 2), 6);
-select format(atan(pi(), 0), 6);
-select format(atan2(-2, 2), 6);
-select format(atan2(pi(), 0), 6);
-
-#
-# Bug #2338 Trignometric arithmatic problems
-#
-
-SELECT ACOS(1.0);
-SELECT ASIN(1.0);
-SELECT ACOS(0.2*5.0);
-SELECT ACOS(0.5*2.0);
-SELECT ASIN(0.8+0.2);
-SELECT ASIN(1.2-0.2);
-
-#
-# Bug #3051 FLOOR returns invalid
-#
-
-# This can't be tested as it's not portable
-#select floor(log(4)/log(2));
-#select floor(log(8)/log(2));
-#select floor(log(16)/log(2));
-
-#
-# Bug #9060 (format returns incorrect result)
-#
-select format(4.55, 1), format(4.551, 1);
-
-explain extended select degrees(pi()),radians(360);
-
-#
-# Bug #7281: problem with rand()
-#
-
---error 1054
-select rand(rand);
-
-# End of 4.1 tests
-
-#
-# Bug #8459 (FORMAT returns incorrect result)
-#
-create table t1 (col1 int, col2 decimal(60,30));
-insert into t1 values(1,1234567890.12345);
-select format(col2,7) from t1;
-select format(col2,8) from t1;
-insert into t1 values(7,1234567890123456.12345);
-select format(col2,6) from t1 where col1=7;
-drop table t1;
-
-
-#
-# Bug @10632 (Ceiling function returns wrong answer)
-#
-select ceil(0.09);
-select ceil(0.000000000000000009);
-
-#
-# Bug #9837: problem with round()
-#
-
-create table t1 select round(1, 6);
-show create table t1;
-select * from t1;
-drop table t1;
-
-#
-# Bug #11402: abs() forces rest of calculation to unsigned
-#
-select abs(-2) * -2;
-
-#
-# Bug #6172 RAND(a) should only accept constant values as arguments
-#
-CREATE TABLE t1 (a INT);
-
-INSERT INTO t1 VALUES (1),(1),(1),(2);
-SELECT CAST(RAND(2) * 1000 AS UNSIGNED), CAST(RAND(a) * 1000 AS UNSIGNED)
- FROM t1;
-SELECT CAST(RAND(2) * 1000 AS UNSIGNED), CAST(RAND(a) * 1000 AS UNSIGNED)
- FROM t1 WHERE a = 1;
-INSERT INTO t1 VALUES (3);
-SELECT CAST(RAND(2) * 1000 AS UNSIGNED), CAST(RAND(a) * 1000 AS UNSIGNED)
- FROM t1;
-SELECT CAST(RAND(2) * 1000 AS UNSIGNED), CAST(RAND(a) * 1000 AS UNSIGNED)
- FROM t1 WHERE a = 1;
-PREPARE stmt FROM
- "SELECT CAST(RAND(2) * 1000 AS UNSIGNED), CAST(RAND(?) * 1000 AS UNSIGNED)
- FROM t1 WHERE a = 1";
-set @var=2;
-EXECUTE stmt USING @var;
-
-DROP TABLE t1;
-
-#
-# Bug #14009: use of abs() on null value causes problems with filesort
-#
-# InnoDB is required to reproduce the fault, but it is okay if we default to
-# MyISAM when testing.
-set sql_mode="";
---disable_warnings
-create table t1 (a varchar(90), ts datetime not null, index (a)) engine=innodb default charset=utf8;
---enable_warnings
-set sql_mode=default;
-insert into t1 values ('http://www.foo.com/', now());
-select a from t1 where a='http://www.foo.com/' order by abs(timediff(ts, 0));
-drop table t1;
-
-# End of 4.1 tests
-
-#
-# Bug #13820 (No warning on log(negative)
-#
-set sql_mode='traditional';
-select ln(-1);
-select log10(-1);
-select log2(-1);
-select log(2,-1);
-select log(-2,1);
-set sql_mode='';
-
-#
-# Bug #8461 truncate() and round() return false results 2nd argument negative.
-#
-# round(a,-b) log_10(b) > a
-select round(111,-10);
-# round on bigint
-select round(-5000111000111000155,-1);
-# round on unsigned bigint
-select round(15000111000111000155,-1);
-# truncate on bigint
-select truncate(-5000111000111000155,-1);
-# truncate on unsigned bigint
-select truncate(15000111000111000155,-1);
-
-#
-# Bug#16678 FORMAT gives wrong result if client run with default-character-set=utf8
-#
-set names utf8;
-create table t1
-(f1 varchar(32) not null,
- f2 smallint(5) unsigned not null,
- f3 int(10) unsigned not null default '0')
-engine=myisam default charset=utf8;
-insert into t1 values ('zombie',0,0),('gold',1,10000),('silver',2,10000);
-
-create table t2
-(f1 int(10) unsigned not null,
- f2 int(10) unsigned not null,
- f3 smallint(5) unsigned not null)
-engine=myisam default charset=utf8;
-insert into t2 values (16777216,16787215,1),(33554432,33564431,2);
-
-select format(t2.f2-t2.f1+1,0) from t1,t2
-where t1.f2 = t2.f3 order by t1.f1;
-drop table t1, t2;
-set names default;
-
-# Bug 24912 -- misc functions have trouble with unsigned
-
-select cast(-2 as unsigned), 18446744073709551614, -2;
-select abs(cast(-2 as unsigned)), abs(18446744073709551614), abs(-2);
-select ceiling(cast(-2 as unsigned)), ceiling(18446744073709551614), ceiling(-2);
-select floor(cast(-2 as unsigned)), floor(18446744073709551614), floor(-2);
-select format(cast(-2 as unsigned), 2), format(18446744073709551614, 2), format(-2, 2);
-select sqrt(cast(-2 as unsigned)), sqrt(18446744073709551614), sqrt(-2);
-select round(cast(-2 as unsigned), 1), round(18446744073709551614, 1), round(-2, 1);
-select round(4, cast(-2 as unsigned)), round(4, 18446744073709551614), round(4, -2);
-select truncate(cast(-2 as unsigned), 1), truncate(18446744073709551614, 1), truncate(-2, 1);
-select truncate(4, cast(-2 as unsigned)), truncate(4, 18446744073709551614), truncate(4, -2);
-select round(10000000000000000000, -19), truncate(10000000000000000000, -19);
-select round(1e0, -309), truncate(1e0, -309);
-select round(1e1,308), truncate(1e1, 308);
-select round(1e1, 2147483648), truncate(1e1, 2147483648);
-select round(1.1e1, 4294967295), truncate(1.1e1, 4294967295);
-select round(1.12e1, 4294967296), truncate(1.12e1, 4294967296);
-select round(1.5, 2147483640), truncate(1.5, 2147483640);
-select round(1.5, -2147483649), round(1.5, 2147483648);
-select truncate(1.5, -2147483649), truncate(1.5, 2147483648);
-select round(1.5, -4294967296), round(1.5, 4294967296);
-select truncate(1.5, -4294967296), truncate(1.5, 4294967296);
-select round(1.5, -9223372036854775808), round(1.5, 9223372036854775808);
-select truncate(1.5, -9223372036854775808), truncate(1.5, 9223372036854775808);
-select round(1.5, 18446744073709551615), truncate(1.5, 18446744073709551615);
-select round(18446744073709551614, -1), truncate(18446744073709551614, -1);
-select round(4, -4294967200), truncate(4, -4294967200);
-select mod(cast(-2 as unsigned), 3), mod(18446744073709551614, 3), mod(-2, 3);
-select mod(5, cast(-2 as unsigned)), mod(5, 18446744073709551614), mod(5, -2);
-select pow(cast(-2 as unsigned), 5), pow(18446744073709551614, 5), pow(-2, 5);
-
-#
-# Bug #30587: mysql crashes when trying to group by TIME div NUMBER
-#
-
-CREATE TABLE t1 (a timestamp, b varchar(20), c bit(1));
-INSERT INTO t1 VALUES('1998-09-23', 'str1', 1), ('2003-03-25', 'str2', 0);
-SELECT a DIV 900 y FROM t1 GROUP BY y;
-SELECT DISTINCT a DIV 900 y FROM t1;
-SELECT b DIV 900 y FROM t1 GROUP BY y;
-SELECT c DIV 900 y FROM t1 GROUP BY y;
-DROP TABLE t1;
-
-CREATE TABLE t1(a LONGBLOB);
-INSERT INTO t1 VALUES('1'),('2'),('3');
-SELECT DISTINCT (a DIV 254576881) FROM t1;
-SELECT (a DIV 254576881) FROM t1 UNION ALL
- SELECT (a DIV 254576881) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1(a SET('a','b','c'));
-INSERT INTO t1 VALUES ('a');
-SELECT a DIV 2 FROM t1 UNION SELECT a DIV 2 FROM t1;
-DROP TABLE t1;
-
-#
-# Bug #15936: "round" differs on Windows to Unix
-#
-
-CREATE TABLE t1 (a DOUBLE);
-
-INSERT INTO t1 VALUES (-1.1), (1.1),
- (-1.5), (1.5),
- (-1.9), (1.9),
- (-2.1), (2.1),
- (-2.5), (2.5),
- (-2.9), (2.9),
-# Check numbers with absolute values > 2^53 - 1
-# (see comments for MAX_EXACT_INTEGER)
- (-1e16 - 0.5), (1e16 + 0.5),
- (-1e16 - 1.5), (1e16 + 1.5);
-
-SELECT a, ROUND(a) FROM t1;
-
-DROP TABLE t1;
-
-#
-# Bug#45152 crash with round() function on longtext column in a derived table
-#
-CREATE TABLE t1(f1 LONGTEXT) engine=myisam;
-INSERT INTO t1 VALUES ('a');
-SELECT 1 FROM (SELECT ROUND(f1) AS a FROM t1) AS s WHERE a LIKE 'a';
-SELECT 1 FROM (SELECT ROUND(f1, f1) AS a FROM t1) AS s WHERE a LIKE 'a';
-DROP TABLE t1;
-
---echo End of 5.0 tests
-
-#
-# Bug #31236: Inconsistent division by zero behavior for floating point numbers
-#
-# After the fix for bug #8433 we throw an error in the below test cases
-# rather than just return a NULL value.
-
---error ER_DATA_OUT_OF_RANGE
-SELECT 1e308 + 1e308;
---error ER_DATA_OUT_OF_RANGE
-SELECT -1e308 - 1e308;
---error ER_DATA_OUT_OF_RANGE
-SELECT 1e300 * 1e300;
---error ER_DATA_OUT_OF_RANGE
-SELECT 1e300 / 1e-300;
---error ER_DATA_OUT_OF_RANGE
-SELECT EXP(750);
---error ER_DATA_OUT_OF_RANGE
-SELECT POW(10, 309);
-
---echo #
---echo # Bug #44768: SIGFPE crash when selecting rand from a view
---echo # containing null
---echo #
-
-CREATE OR REPLACE VIEW v1 AS SELECT NULL AS a;
-SELECT RAND(a) FROM v1;
-DROP VIEW v1;
-
-SELECT RAND(a) FROM (SELECT NULL AS a) b;
-
-CREATE TABLE t1 (i INT);
-INSERT INTO t1 VALUES (NULL);
-SELECT RAND(i) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#57477 SIGFPE when dividing a huge number a negative number
---echo #
---error ER_DATA_OUT_OF_RANGE
-SELECT -9999999999999999991 DIV -1;
---error ER_DATA_OUT_OF_RANGE
-SELECT -9223372036854775808 DIV -1;
-SELECT -9223372036854775808 MOD -1;
-SELECT -9223372036854775808999 MOD -1;
-
-#
-# Bug #8457: Precision math:
-# DIV returns incorrect result with large decimal value
-# Bug #46606:Casting error for large numbers in 5.4 when 'div' is used
-
---error ER_DATA_OUT_OF_RANGE
-select 123456789012345678901234567890.123456789012345678901234567890 div 1 as x;
---error ER_DATA_OUT_OF_RANGE
-select "123456789012345678901234567890.123456789012345678901234567890" div 1 as x;
-SHOW WARNINGS;
-
---echo #
---echo # Bug#57810 case/when/then : Assertion failed: length || !scale
---echo #
-
-SELECT CASE(('')) WHEN (CONVERT(1, CHAR(1))) THEN (('' / 1)) END;
-CREATE TABLE t1 SELECT CAST((CASE(('')) WHEN (CONVERT(1, CHAR(1))) THEN (('' / 1)) END) AS CHAR) as C;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#11764994 57900: CREATE TABLE .. SELECT ASSERTS SCALE >= 0 && PRECISION > 0 && SCALE <= PR
---echo #
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-CREATE TABLE t1 SELECT CEIL(LINESTRINGFROMWKB(1) DIV NULL);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-CREATE TABLE t1 SELECT FLOOR(LINESTRINGFROMWKB(1) DIV NULL);
-
---echo #
---echo # Bug#11765923 58937: MANY VALGRIND ERRORS AFTER GROUPING BY RESULT OF DECIMAL COLUMN FUNCTION
---echo #
-
-CREATE TABLE t1(f1 DECIMAL(22,1));
-INSERT INTO t1 VALUES (0),(1);
-SELECT ROUND(f1, f1) FROM t1;
-SELECT ROUND(f1, f1) FROM t1 GROUP BY 1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#11764671 57533: UNINITIALISED VALUES IN COPY_AND_CONVERT (SQL_STRING.CC) WITH CERTAIN CHA
---echo #
-
-SELECT ROUND(LEAST(15, -4939092, 0.2704), STDDEV('a'));
-
---echo #
---echo # Bug#12392636 ASSERTION FAILED: SCALE >= 0 && PRECISION > 0 && SCALE <= PRECISION
---echo #
-
-SELECT SUM(DISTINCT (TRUNCATE((.1), NULL)));
-
---echo End of 5.1 tests
-
---echo #
---echo # Bug #8433: Overflow must be an error
---echo #
-
-# Floating point overflows
-# ========================
---error ER_DATA_OUT_OF_RANGE
-SELECT 1e308 + 1e308;
---error ER_DATA_OUT_OF_RANGE
-SELECT -1e308 - 1e308;
---error ER_DATA_OUT_OF_RANGE
-SELECT 1e300 * 1e300;
---error ER_DATA_OUT_OF_RANGE
-SELECT 1e300 / 1e-300;
---error ER_DATA_OUT_OF_RANGE
-SELECT EXP(750);
---error ER_DATA_OUT_OF_RANGE
-SELECT POW(10, 309);
---error ER_DATA_OUT_OF_RANGE
-SELECT COT(0);
---error ER_DATA_OUT_OF_RANGE
-SELECT DEGREES(1e307);
-
-# Integer overflows
-# =================
-
---error ER_DATA_OUT_OF_RANGE
-SELECT 9223372036854775808 + 9223372036854775808;
---error ER_DATA_OUT_OF_RANGE
-SELECT 18446744073709551615 + 1;
---error ER_DATA_OUT_OF_RANGE
-SELECT 1 + 18446744073709551615;
---error ER_DATA_OUT_OF_RANGE
-SELECT -2 + CAST(1 AS UNSIGNED);
---error ER_DATA_OUT_OF_RANGE
-SELECT CAST(1 AS UNSIGNED) + -2;
---error ER_DATA_OUT_OF_RANGE
-SELECT -9223372036854775808 + -9223372036854775808;
---error ER_DATA_OUT_OF_RANGE
-SELECT 9223372036854775807 + 9223372036854775807;
-
---error ER_DATA_OUT_OF_RANGE
-SELECT CAST(0 AS UNSIGNED) - 9223372036854775809;
---error ER_DATA_OUT_OF_RANGE
-SELECT 9223372036854775808 - 9223372036854775809;
---error ER_DATA_OUT_OF_RANGE
-SELECT CAST(1 AS UNSIGNED) - 2;
---error ER_DATA_OUT_OF_RANGE
-SELECT 18446744073709551615 - (-1);
---error ER_DATA_OUT_OF_RANGE
-SELECT -1 - 9223372036854775808;
---error ER_DATA_OUT_OF_RANGE
-SELECT -1 - CAST(1 AS UNSIGNED);
---error ER_DATA_OUT_OF_RANGE
-SELECT -9223372036854775808 - 1;
---error ER_DATA_OUT_OF_RANGE
-SELECT 9223372036854775807 - -9223372036854775808;
-
-# To test SIGNED overflow when subtraction arguments are both UNSIGNED
-set SQL_MODE='NO_UNSIGNED_SUBTRACTION';
---error ER_DATA_OUT_OF_RANGE
-SELECT 18446744073709551615 - 1;
---error ER_DATA_OUT_OF_RANGE
-SELECT 18446744073709551615 - CAST(1 AS UNSIGNED);
---error ER_DATA_OUT_OF_RANGE
-SELECT 18446744073709551614 - (-1);
---error ER_DATA_OUT_OF_RANGE
-SELECT 9223372036854775807 - -1;
-set SQL_MODE=default;
-
---error ER_DATA_OUT_OF_RANGE
-SELECT 4294967296 * 4294967296;
---error ER_DATA_OUT_OF_RANGE
-SELECT 9223372036854775808 * 2;
---error ER_DATA_OUT_OF_RANGE
-SELECT 9223372036854775808 * 2;
-# The following one triggers condition #3 from the comments in
-# Item_func_mul::int_op()
---error ER_DATA_OUT_OF_RANGE
-SELECT 7158278827 * 3221225472;
---error ER_DATA_OUT_OF_RANGE
-SELECT 9223372036854775807 * (-2);
---error ER_DATA_OUT_OF_RANGE
-SELECT CAST(1 as UNSIGNED) * (-1);
---error ER_DATA_OUT_OF_RANGE
-SELECT 9223372036854775807 * 2;
-
---error ER_DATA_OUT_OF_RANGE
-SELECT ABS(-9223372036854775808);
-
---error ER_DATA_OUT_OF_RANGE
-SELECT -9223372036854775808 DIV -1;
---error ER_DATA_OUT_OF_RANGE
-SELECT 18446744073709551615 DIV -1;
-
-
-# Have to create a table because the negation op may convert literals to DECIMAL
-CREATE TABLE t1(a BIGINT, b BIGINT UNSIGNED);
-INSERT INTO t1 VALUES(-9223372036854775808, 9223372036854775809);
-
---error ER_DATA_OUT_OF_RANGE
-SELECT -a FROM t1;
---error ER_DATA_OUT_OF_RANGE
-SELECT -b FROM t1;
-
-# try with two rows now
-INSERT INTO t1 VALUES(0,0);
-
---error ER_DATA_OUT_OF_RANGE
-SELECT -a FROM t1;
---error ER_DATA_OUT_OF_RANGE
-SELECT -b FROM t1;
-
-DROP TABLE t1;
-
-# Decimal overflows
-# =================
-
-SET @a:=999999999999999999999999999999999999999999999999999999999999999999999999999999999;
---error ER_DATA_OUT_OF_RANGE
-SELECT @a + @a;
---error ER_DATA_OUT_OF_RANGE
-SELECT @a * @a;
---error ER_DATA_OUT_OF_RANGE
-SELECT -@a - @a;
---error ER_DATA_OUT_OF_RANGE
-SELECT @a / 0.5;
-
-# Non-overflow tests to improve code coverage
-# ===========================================
-SELECT COT(1/0);
-SELECT -1 + 9223372036854775808;
-SELECT 2 DIV -2;
-SELECT -(1 DIV 0);
-# Crashed the server with SIGFPE before the bugfix
-SELECT -9223372036854775808 MOD -1;
-
---echo #
---echo # Bug #57209 valgrind + Assertion failed: dst > buf
---echo #
-SELECT floor(log10(format(concat_ws(5445796E25, 5306463, 30837), -358821)))
-as foo;
-
---echo #
---echo # Bug #58137 char(0) column cause:
---echo # my_gcvt: Assertion `width > 0 && to != ((void *)0)' failed
---echo #
-CREATE TABLE t1(a char(0));
-INSERT IGNORE INTO t1 (SELECT -pi());
-DROP TABLE t1;
-
---echo #
---echo # Bug #59241 invalid memory read
---echo # in do_div_mod with doubly assigned variables
---echo #
-SELECT ((@a:=@b:=1.0) div (@b:=@a:=get_format(datetime, 'usa')));
-
---echo #
---echo # Bug #59498 div function broken in mysql-trunk
---echo #
-SELECT 1 div null;
-
---echo #
---echo # Bug #11792200 - DIVIDING LARGE NUMBERS CAUSES STACK CORRUPTIONS
---echo #
-select (1.175494351E-37 div 1.7976931348623157E+308);
-
---echo #
---echo # Bug#12744991 - DECIMAL_ROUND(X,D) GIVES WRONG RESULTS WHEN D == N*(-9)
---echo #
-
-select round(999999999, -9);
-select round(999999999.0, -9);
-select round(999999999999999999, -18);
-select round(999999999999999999.0, -18);
-
---echo #
---echo # Bug#12537160 ASSERTION FAILED:
---echo # STOP0 <= &TO->BUF[TO->LEN] WITH LARGE NUMBER.
---echo #
-
-let $nine_81=
-999999999999999999999999999999999999999999999999999999999999999999999999999999999;
-
-eval select $nine_81 % 0.1 as foo;
-eval select $nine_81 % 0.0 as foo;
-
---echo #
---echo # Bug#12711164 - 61676:
---echo # RESULT OF DIV WITH DECIMAL AND INTEGER DOES NOT MAKE SENSE
---echo #
-
-select 5 div 2;
-select 5.0 div 2.0;
-select 5.0 div 2;
-select 5 div 2.0;
-select 5.9 div 2, 1.23456789e3 DIV 2, 1.23456789e9 DIV 2, 1.23456789e19 DIV 2;
-
---echo #
---echo # MDEV-10467 Assertion `nr >= 0.0' failed in Item_sum_std::val_real()
---echo #
-CREATE TABLE t1 (i INT);
-INSERT INTO t1 VALUES (1),(2);
-SELECT STDDEV_SAMP(ROUND('0', 309)) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # End of 5.5 tests
---echo #
-
---echo #
---echo # MDEV-5781 Item_sum_std::val_real(): Assertion `nr >= 0.0' fails on query with STDDEV_POP, ROUND and variable
---echo #
-SELECT STDDEV_POP(ROUND(0,@A:=2009)) FROM (SELECT 1 UNION SELECT 2) fake_table;
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo # Test zero
-select 0=0, 0=-0, 0.0= -0.0, 0.0 = -(0.0), 0.0E1=-0.0E1, 0.0E1=-(0.0E1);
-
---echo #
---echo # CRC32 tests
---echo #
-
-select CRC32(NULL), CRC32(''), CRC32('MySQL'), CRC32('mysql'), CRC32('01234567'), CRC32('012345678');
-
-#
-# MDEV-13673 Bad result in view
-#
-explain extended select (3-2)+1, (3/2)*1, 3-(2+1), 3/(2*1);
-
---echo #
---echo # Start of 10.3 tests
---echo #
-
---echo #
---echo # MDEV-12000 ROUND(expr,const_expr_returning_NULL) creates DOUBLE(0,0)
---echo #
-
-CREATE OR REPLACE TABLE t1 AS SELECT
- ROUND(10,NULL) AS c1,
- ROUND(10.1,NULL) AS c2,
- ROUND(10e0,NULL) AS c3;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-12857 Out-of-range errors on CREATE..SELECT 2222222222 DIV 1
---echo #
-
-SET sql_mode=STRICT_ALL_TABLES;
-CREATE OR REPLACE TABLE t1 AS SELECT
- 2 DIV 1 AS d01,
- 222222222 DIV 1 AS d09,
- 2222222222 DIV 1 AS d10;
-SHOW CREATE TABLE t1;
---vertical_results
-SELECT * FROM t1;
---horizontal_results
-DROP TABLE t1;
-SET sql_mode=DEFAULT;
-
-
---echo #
---echo # MDEV-12858 Out-of-range error for CREATE..SELECT unsigned_int_column+1
---echo #
-
-SET sql_mode=STRICT_ALL_TABLES;
-CREATE OR REPLACE TABLE t1 (a INT UNSIGNED NOT NULL);
-INSERT INTO t1 VALUES (0xFFFFFFFF);
-CREATE OR REPLACE TABLE t2 AS SELECT a+1 AS a FROM t1;
-SHOW CREATE TABLE t2;
-SELECT a, HEX(a) FROM t2;
-DROP TABLE t2;
-DROP TABLE t1;
-SET sql_mode=DEFAULT;
diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test
deleted file mode 100644
index 9f452e632ec..00000000000
--- a/mysql-test/t/func_misc.test
+++ /dev/null
@@ -1,1194 +0,0 @@
-#
-# Testing of misc functions
-#
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-select format(1.5555,0),format(123.5555,1),format(1234.5555,2),format(12345.55555,3),format(123456.5555,4),format(1234567.5555,5),format("12345.2399",2);
-
-select inet_ntoa(inet_aton("255.255.255.255.255.255.255.255"));
-select inet_aton("255.255.255.255.255"),inet_aton("255.255.1.255"),inet_aton("0.1.255");
-select inet_ntoa(1099511627775),inet_ntoa(4294902271),inet_ntoa(511);
-
-select hex(inet_aton('127'));
-select hex(inet_aton('127.1'));
-select hex(inet_aton('127.1.1'));
-
-select length(uuid()), charset(uuid()), length(unhex(replace(uuid(),_utf8'-',_utf8'')));
-
-# As we can assume we are the only user for the mysqld server, the difference
-# between two calls should be -1
-set @a= uuid_short();
-set @b= uuid_short();
-select @b - @a;
-
-#
-# Test for core dump with nan
-#
-select length(format('nan', 2)) > 0;
-
-#
-# Test for bug #628
-#
-select concat("$",format(2500,2));
-
-# Test for BUG#7716
-create table t1 ( a timestamp );
-insert into t1 values ( '2004-01-06 12:34' );
-select a from t1 where left(a+0,6) in ( left(20040106,6) );
-select a from t1 where left(a+0,6) = ( left(20040106,6) );
-
-select a from t1 where right(a+0,6) in ( right(20040106123400,6) );
-select a from t1 where right(a+0,6) = ( right(20040106123400,6) );
-
-select a from t1 where mid(a+0,6,3) in ( mid(20040106123400,6,3) );
-select a from t1 where mid(a+0,6,3) = ( mid(20040106123400,6,3) );
-
-drop table t1;
-
-
-#
-# Bug#16501: IS_USED_LOCK does not appear to work
-#
-
-CREATE TABLE t1 (conn CHAR(7), connection_id INT);
-INSERT INTO t1 VALUES ('default', CONNECTION_ID());
-
-SELECT GET_LOCK('bug16501',600);
-
-connect (con1,localhost,root,,);
-INSERT INTO t1 VALUES ('con1', CONNECTION_ID());
-SELECT IS_USED_LOCK('bug16501') = connection_id
-FROM t1
-WHERE conn = 'default';
-send SELECT GET_LOCK('bug16501',600);
-
-connection default;
-SELECT IS_USED_LOCK('bug16501') = CONNECTION_ID();
-SELECT RELEASE_LOCK('bug16501');
-connection con1;
-reap;
-connection default;
-SELECT IS_USED_LOCK('bug16501') = connection_id
-FROM t1
-WHERE conn = 'con1';
-
-connection con1;
-SELECT IS_USED_LOCK('bug16501') = CONNECTION_ID();
-SELECT RELEASE_LOCK('bug16501');
-SELECT IS_USED_LOCK('bug16501');
-
-disconnect con1;
-connection default;
-
-DROP TABLE t1;
-
-#
-# Bug #21531: EXPORT_SET() doesn't accept args with coercible character sets
-#
-select export_set(3, _latin1'foo', _utf8'bar', ',', 4);
-
---echo End of 4.1 tests
-
-
-#
-# Test for BUG#9535
-#
---disable_warnings
-create table t1 as select uuid(), length(uuid());
---enable_warnings
-show create table t1;
-drop table t1;
-
-#
-# Bug #21466: INET_ATON() returns signed, not unsigned
-#
-
-create table t1 select INET_ATON('255.255.0.1') as `a`;
-show create table t1;
-drop table t1;
-
-#
-# Bug#26093 (SELECT BENCHMARK() for SELECT statements does not produce
-# valid results)
-#
-
---disable_warnings
-drop table if exists table_26093;
-drop function if exists func_26093_a;
-drop function if exists func_26093_b;
---enable_warnings
-
-create table table_26093(a int);
-insert into table_26093 values
-(1), (2), (3), (4), (5),
-(6), (7), (8), (9), (10);
-
-delimiter //;
-
-create function func_26093_a(x int) returns int
-begin
- set @invoked := @invoked + 1;
- return x;
-end//
-
-create function func_26093_b(x int, y int) returns int
-begin
- set @invoked := @invoked + 1;
- return x;
-end//
-
-delimiter ;//
-
-select avg(a) from table_26093;
-
-select benchmark(100, (select avg(a) from table_26093));
-
-set @invoked := 0;
-select benchmark(100, (select avg(func_26093_a(a)) from table_26093));
-# Returns only 10, since intermediate results are cached.
-select @invoked;
-
-set @invoked := 0;
-select benchmark(100, (select avg(func_26093_b(a, rand())) from table_26093));
-# Returns 1000, due to rand() preventing caching.
-select @invoked;
-
---error ER_SUBQUERY_NO_1_ROW
-select benchmark(100, (select (a) from table_26093));
-
---error ER_OPERAND_COLUMNS
-select benchmark(100, (select 1, 1));
-
-drop table table_26093;
-drop function func_26093_a;
-drop function func_26093_b;
-
-#
-# Bug #30832: Assertion + crash with select name_const('test',now());
-#
---error ER_WRONG_ARGUMENTS
-SELECT NAME_CONST('test', NOW());
---error ER_WRONG_ARGUMENTS
-SELECT NAME_CONST('test', UPPER('test'));
-
-SELECT NAME_CONST('test', NULL);
-SELECT NAME_CONST('test', 1);
-SELECT NAME_CONST('test', -1);
-SELECT NAME_CONST('test', 1.0);
-SELECT NAME_CONST('test', -1.0);
-SELECT NAME_CONST('test', 'test');
-
-#
-# Bug #34749: Server crash when using NAME_CONST() with an aggregate function
-#
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1),(2),(3);
-# NAME_CONST() + aggregate.
-SELECT NAME_CONST('flag',1) * MAX(a) FROM t1;
-SELECT NAME_CONST('flag',1.5) * MAX(a) FROM t1;
-# Now, wrap the INT_ITEM in Item_func_neg and watch the pretty explosions
-SELECT NAME_CONST('flag',-1) * MAX(a) FROM t1;
-SELECT NAME_CONST('flag',-1.5) * MAX(a) FROM t1;
---error ER_WRONG_ARGUMENTS
-SELECT NAME_CONST('flag', SQRT(4)) * MAX(a) FROM t1;
---error ER_WRONG_ARGUMENTS
-SELECT NAME_CONST('flag',-SQRT(4)) * MAX(a) FROM t1;
-DROP TABLE t1;
-
-#
-# Bug #27545: erroneous usage of NAME_CONST with a name as the first parameter
-# resolved against a column name of a derived table hangs the client
-#
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (5), (2);
-
---error ER_WRONG_ARGUMENTS
-SELECT NAME_CONST(x,2) FROM (SELECT a x FROM t1) t;
-
-DROP TABLE t1;
-
-
-#
-# Bug #32559: connection hangs on query with name_const
-#
-CREATE TABLE t1(a INT);
-INSERT INTO t1 VALUES (), (), ();
---error ER_WRONG_ARGUMENTS
-SELECT NAME_CONST(a, '1') FROM t1;
---error ER_WRONG_ARGUMENTS
-SET INSERT_ID= NAME_CONST(a, a);
-DROP TABLE t1;
-
-#
-# Bug #31349: ERROR 1062 (23000): Duplicate entry '' for key 'group_key'
-#
-create table t1 (a int not null);
-insert into t1 values (-1), (-2);
-select min(a) from t1 group by inet_ntoa(a);
-drop table t1;
-
-#
-# BUG#34289 - Incorrect NAME_CONST substitution in stored procedures breaks
-# replication
-#
-SELECT NAME_CONST('var', 'value') COLLATE latin1_general_cs;
-
-#
-# Bug #35848: UUID() returns UUIDs with the wrong time
-#
-select @@session.time_zone into @save_tz;
-
-# make sure all times are UTC so the DayNr won't differ
-set @@session.time_zone='UTC';
-select uuid() into @my_uuid;
-# if version nibble isn't 1, the following calculations will be rubbish
-select mid(@my_uuid,15,1);
-select 24 * 60 * 60 * 1000 * 1000 * 10 into @my_uuid_one_day;
-select concat('0',mid(@my_uuid,16,3),mid(@my_uuid,10,4),left(@my_uuid,8)) into @my_uuidate;
-select floor(conv(@my_uuidate,16,10)/@my_uuid_one_day) into @my_uuid_date;
-select 141427 + datediff(curdate(),'1970-01-01') into @my_uuid_synthetic;
-# these should be identical; date part of UUID should be current date
-select @my_uuid_date - @my_uuid_synthetic;
-
-set @@session.time_zone=@save_tz;
-
-
-#
-# Bug#42014: Crash, name_const with collate
-#
-CREATE TABLE t1 (a DATE);
-SELECT * FROM t1 WHERE a = NAME_CONST('reportDate',
- _binary'2009-01-09' COLLATE 'binary');
-DROP TABLE t1;
-
-#
-# Bug#35515: Aliases of variables in binary log are ignored with NAME_CONST
-#
-select NAME_CONST('_id',1234) as id;
-
---echo End of 5.0 tests
-
-#
-# Bug #30389: connection_id() always return 0 in embedded server
-#
-
-select connection_id() > 0;
-
---echo #
---echo # Bug #54461: crash with longblob and union or update with subquery
---echo #
-
-CREATE TABLE t1 (a INT, b LONGBLOB);
-INSERT INTO t1 VALUES (1, '2'), (2, '3'), (3, '2');
-
-SELECT DISTINCT LEAST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
-SELECT DISTINCT GREATEST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
-
-DROP TABLE t1;
-
-
-#
-# Bug #57283: inet_ntoa() crashes
-#
-SELECT INET_NTOA(0);
-SELECT '1' IN ('1', INET_NTOA(0));
-
-#
-# MDEV-5655 Server crashes on NAME_CONST containing AND/OR expressions
-#
---error ER_WRONG_ARGUMENTS
-SELECT NAME_CONST('a', -(1 OR 2)) OR 1;
---error ER_WRONG_ARGUMENTS
-SELECT NAME_CONST('a', -(1 AND 2)) AND 1;
-SELECT NAME_CONST('a', -(1)) OR 1;
-
---echo #
---echo #MDEV-5446: Assertion `!table || (!table->read_set ||
---echo #bitmap_is_set(table->read_set, field_index))' fails on
---echo #EXPLAIN EXTENDED with VALUES function
---echo #
-CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,10);
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-EXPLAIN EXTENDED SELECT VALUE(b) FROM v1;
-
-drop view v1;
-drop table t1;
-
---echo End of 5.3 tests
-
---echo #
---echo # Bug #52165: Assertion failed: file .\dtoa.c, line 465
---echo #
-
-CREATE TABLE t1 (a SET('a'), b INT);
-INSERT INTO t1 VALUES ('', 0);
-
-SELECT COALESCE(a) = COALESCE(b) FROM t1;
-
-DROP TABLE t1;
-
-
---echo #
---echo # Bug #54461: crash with longblob and union or update with subquery
---echo #
-
-CREATE TABLE t1 (a INT, b LONGBLOB);
-INSERT INTO t1 VALUES (1, '2'), (2, '3'), (3, '2');
-
-SELECT DISTINCT LEAST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
-SELECT DISTINCT GREATEST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
-
-DROP TABLE t1;
-
-
-#
-# Bug #57283: inet_ntoa() crashes
-#
-SELECT INET_NTOA(0);
-SELECT '1' IN ('1', INET_NTOA(0));
-
-
---echo #
---echo # End of 5.1 tests
---echo #
-
-
---echo #
---echo # Bug #58199: name_const in the having clause crashes
---echo #
-
-CREATE TABLE t1 (a INT);
-
-# NAME_CONST() would seg.fault when used wrongly in a HAVING clause
---error ER_WRONG_ARGUMENTS
-SELECT 1 from t1 HAVING NAME_CONST('', a);
-
-DROP TABLE t1;
-
---echo #
---echo # Test or correct maybe_null of last_value
---echo #
-CREATE TABLE t1 (a char(2) not null );
-INSERT INTO t1 VALUES (4),(7),(1);
-set @optimizer_switch_save= @@optimizer_switch;
-set optimizer_switch='materialization=off';
-CREATE TABLE tv (e char(2) not null );
-INSERT INTO tv VALUES (1);
-CREATE ALGORITHM=MERGE VIEW v_merge AS SELECT * FROM tv;
-CREATE ALGORITHM=MERGE VIEW vm AS SELECT * FROM tv;
-explain extended
-select a from t1 left join v_merge on (a=e) where last_value(NULL,e) not in (select last_value(NULL,e) from vm);
-explain extended
-select a from t1 left join v_merge on (a=e) where e not in (select last_value(NULL,e) from vm);
-set optimizer_switch=@optimizer_switch_save;
-drop view v_merge, vm;
-drop table t1,tv;
-
---echo #
---echo # MDEV-4017 - GET_LOCK() with negative timeouts has strange behavior
---echo #
-SELECT GET_LOCK('ul1', NULL);
-SELECT GET_LOCK('ul1', -1);
-
---echo #
---echo # MDEV-8624 MariaDB hangs on query with many logical condition
---echo #
-CREATE TABLE `t1` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `submitdate` datetime DEFAULT NULL,
- `lastpage` int(11) DEFAULT NULL,
- `startlanguage` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
- `token` varchar(36) COLLATE utf8_unicode_ci DEFAULT NULL,
- `datestamp` datetime NOT NULL,
- `startdate` datetime NOT NULL,
- `ipaddr` text COLLATE utf8_unicode_ci,
- `refurl` text COLLATE utf8_unicode_ci,
- `57813X540X1723` text COLLATE utf8_unicode_ci,
- `57813X540X1724` text COLLATE utf8_unicode_ci,
- `57813X540X1725` text COLLATE utf8_unicode_ci,
- `57813X540X1726` double DEFAULT NULL,
- `57813X540X1909` double DEFAULT NULL,
- `57813X541X17271` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X541X17272` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X541X17273` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X541X17274` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X541X17275` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X541X17276` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X541X17281` text COLLATE utf8_unicode_ci,
- `57813X541X17282` text COLLATE utf8_unicode_ci,
- `57813X541X17283` text COLLATE utf8_unicode_ci,
- `57813X541X17284` text COLLATE utf8_unicode_ci,
- `57813X541X17285` text COLLATE utf8_unicode_ci,
- `57813X541X17286` text COLLATE utf8_unicode_ci,
- `57813X542X18131` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X542X18132` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X542X18133` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X542X18134` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X542X18135` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X542X18136` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X542X18137` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X542X18138` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X542X18139` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X542X18141` text COLLATE utf8_unicode_ci,
- `57813X542X18142` text COLLATE utf8_unicode_ci,
- `57813X542X18143` text COLLATE utf8_unicode_ci,
- `57813X542X18144` text COLLATE utf8_unicode_ci,
- `57813X542X18145` text COLLATE utf8_unicode_ci,
- `57813X542X18146` text COLLATE utf8_unicode_ci,
- `57813X542X18147` text COLLATE utf8_unicode_ci,
- `57813X542X18148` text COLLATE utf8_unicode_ci,
- `57813X542X18149` text COLLATE utf8_unicode_ci,
- `57813X543X18451` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X543X18452` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X543X18453` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X543X18454` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X543X18455` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X543X18456` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X543X18461` text COLLATE utf8_unicode_ci,
- `57813X543X18462` text COLLATE utf8_unicode_ci,
- `57813X543X18463` text COLLATE utf8_unicode_ci,
- `57813X543X18464` text COLLATE utf8_unicode_ci,
- `57813X543X18465` text COLLATE utf8_unicode_ci,
- `57813X543X18466` text COLLATE utf8_unicode_ci,
- `57813X544X18711` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X544X18712` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X544X18713` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X544X18714` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X544X18715` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X544X18716` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X544X18717` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X544X18718` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X544X18721` text COLLATE utf8_unicode_ci,
- `57813X544X18722` text COLLATE utf8_unicode_ci,
- `57813X544X18723` text COLLATE utf8_unicode_ci,
- `57813X544X18724` text COLLATE utf8_unicode_ci,
- `57813X544X18725` text COLLATE utf8_unicode_ci,
- `57813X544X18726` text COLLATE utf8_unicode_ci,
- `57813X544X18727` text COLLATE utf8_unicode_ci,
- `57813X544X18728` text COLLATE utf8_unicode_ci,
- `57813X546X1902` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X546X1903` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X546X1904` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
- `57813X545X1901` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL,
- PRIMARY KEY (`id`),
- KEY `lime_survey_57813_idx` (`token`),
- KEY `57813X540X1723` (`57813X540X1723`(100)),
- KEY `57813X540X1724` (`57813X540X1724`(100)),
- KEY `57813X540X1726` (`57813X540X1726`),
- KEY `57813X540X1725` (`57813X540X1725`(100)),
- KEY `57813X546X1902` (`57813X546X1902`),
- KEY `57813X546X1903` (`57813X546X1903`),
- KEY `57813X546X1904` (`57813X546X1904`)
-);
-
-SELECT
-COUNT(*) as `N`,
-ROUND(
- (
- SUM(
- (
- (
- IF( 57813X541X17271 IS NOT NULL AND 57813X541X17271 != '' AND 57813X541X17271 != '99', 57813X541X17271, 0 ) +
- IF( 57813X541X17272 IS NOT NULL AND 57813X541X17272 != '' AND 57813X541X17272 != '99', 57813X541X17272, 0 ) +
- IF( 57813X541X17273 IS NOT NULL AND 57813X541X17273 != '' AND 57813X541X17273 != '99', 57813X541X17273, 0 ) +
- IF( 57813X541X17274 IS NOT NULL AND 57813X541X17274 != '' AND 57813X541X17274 != '99', 57813X541X17274, 0 ) +
- IF( 57813X541X17275 IS NOT NULL AND 57813X541X17275 != '' AND 57813X541X17275 != '99', 57813X541X17275, 0 ) +
- IF( 57813X541X17276 IS NOT NULL AND 57813X541X17276 != '' AND 57813X541X17276 != '99', 57813X541X17276, 0 ) +
- IF( 57813X542X18131 IS NOT NULL AND 57813X542X18131 != '' AND 57813X542X18131 != '99', 57813X542X18131, 0 ) +
- IF( 57813X542X18132 IS NOT NULL AND 57813X542X18132 != '' AND 57813X542X18132 != '99', 57813X542X18132, 0 ) +
- IF( 57813X542X18133 IS NOT NULL AND 57813X542X18133 != '' AND 57813X542X18133 != '99', 57813X542X18133, 0 ) +
- IF( 57813X542X18134 IS NOT NULL AND 57813X542X18134 != '' AND 57813X542X18134 != '99', 57813X542X18134, 0 ) +
- IF( 57813X542X18135 IS NOT NULL AND 57813X542X18135 != '' AND 57813X542X18135 != '99', 57813X542X18135, 0 ) +
- IF( 57813X542X18136 IS NOT NULL AND 57813X542X18136 != '' AND 57813X542X18136 != '99', 57813X542X18136, 0 ) +
- IF( 57813X542X18137 IS NOT NULL AND 57813X542X18137 != '' AND 57813X542X18137 != '99', 57813X542X18137, 0 ) +
- IF( 57813X542X18138 IS NOT NULL AND 57813X542X18138 != '' AND 57813X542X18138 != '99', 57813X542X18138, 0 ) +
- IF( 57813X542X18139 IS NOT NULL AND 57813X542X18139 != '' AND 57813X542X18139 != '99', 57813X542X18139, 0 ) +
- IF( 57813X543X18451 IS NOT NULL AND 57813X543X18451 != '' AND 57813X543X18451 != '99', 57813X543X18451, 0 ) +
- IF( 57813X543X18452 IS NOT NULL AND 57813X543X18452 != '' AND 57813X543X18452 != '99', 57813X543X18452, 0 ) +
- IF( 57813X543X18453 IS NOT NULL AND 57813X543X18453 != '' AND 57813X543X18453 != '99', 57813X543X18453, 0 ) +
- IF( 57813X543X18454 IS NOT NULL AND 57813X543X18454 != '' AND 57813X543X18454 != '99', 57813X543X18454, 0 ) +
- IF( 57813X543X18455 IS NOT NULL AND 57813X543X18455 != '' AND 57813X543X18455 != '99', 57813X543X18455, 0 ) +
- IF( 57813X543X18456 IS NOT NULL AND 57813X543X18456 != '' AND 57813X543X18456 != '99', 57813X543X18456, 0 ) +
- IF( 57813X544X18711 IS NOT NULL AND 57813X544X18711 != '' AND 57813X544X18711 != '99', 57813X544X18711, 0 ) +
- IF( 57813X544X18712 IS NOT NULL AND 57813X544X18712 != '' AND 57813X544X18712 != '99', 57813X544X18712, 0 ) +
- IF( 57813X544X18713 IS NOT NULL AND 57813X544X18713 != '' AND 57813X544X18713 != '99', 57813X544X18713, 0 ) +
- IF( 57813X544X18714 IS NOT NULL AND 57813X544X18714 != '' AND 57813X544X18714 != '99', 57813X544X18714, 0 ) +
- IF( 57813X544X18715 IS NOT NULL AND 57813X544X18715 != '' AND 57813X544X18715 != '99', 57813X544X18715, 0 ) +
- IF( 57813X544X18716 IS NOT NULL AND 57813X544X18716 != '' AND 57813X544X18716 != '99', 57813X544X18716, 0 ) +
- IF( 57813X544X18717 IS NOT NULL AND 57813X544X18717 != '' AND 57813X544X18717 != '99', 57813X544X18717, 0 ) +
- IF( 57813X544X18718 IS NOT NULL AND 57813X544X18718 != '' AND 57813X544X18718 != '99', 57813X544X18718, 0 )
- )
- /
- (
- IF( 57813X541X17271 IS NOT NULL AND 57813X541X17271 != '' AND 57813X541X17271 != '99', 1, 0 ) +
- IF( 57813X541X17272 IS NOT NULL AND 57813X541X17272 != '' AND 57813X541X17272 != '99', 1, 0 ) +
- IF( 57813X541X17273 IS NOT NULL AND 57813X541X17273 != '' AND 57813X541X17273 != '99', 1, 0 ) +
- IF( 57813X541X17274 IS NOT NULL AND 57813X541X17274 != '' AND 57813X541X17274 != '99', 1, 0 ) +
- IF( 57813X541X17275 IS NOT NULL AND 57813X541X17275 != '' AND 57813X541X17275 != '99', 1, 0 ) +
- IF( 57813X541X17276 IS NOT NULL AND 57813X541X17276 != '' AND 57813X541X17276 != '99', 1, 0 ) +
- IF( 57813X542X18131 IS NOT NULL AND 57813X542X18131 != '' AND 57813X542X18131 != '99', 1, 0 ) +
- IF( 57813X542X18132 IS NOT NULL AND 57813X542X18132 != '' AND 57813X542X18132 != '99', 1, 0 ) +
- IF( 57813X542X18133 IS NOT NULL AND 57813X542X18133 != '' AND 57813X542X18133 != '99', 1, 0 ) +
- IF( 57813X542X18134 IS NOT NULL AND 57813X542X18134 != '' AND 57813X542X18134 != '99', 1, 0 ) +
- IF( 57813X542X18135 IS NOT NULL AND 57813X542X18135 != '' AND 57813X542X18135 != '99', 1, 0 ) +
- IF( 57813X542X18136 IS NOT NULL AND 57813X542X18136 != '' AND 57813X542X18136 != '99', 1, 0 ) +
- IF( 57813X542X18137 IS NOT NULL AND 57813X542X18137 != '' AND 57813X542X18137 != '99', 1, 0 ) +
- IF( 57813X542X18138 IS NOT NULL AND 57813X542X18138 != '' AND 57813X542X18138 != '99', 1, 0 ) +
- IF( 57813X542X18139 IS NOT NULL AND 57813X542X18139 != '' AND 57813X542X18139 != '99', 1, 0 ) +
- IF( 57813X543X18451 IS NOT NULL AND 57813X543X18451 != '' AND 57813X543X18451 != '99', 1, 0 ) +
- IF( 57813X543X18452 IS NOT NULL AND 57813X543X18452 != '' AND 57813X543X18452 != '99', 1, 0 ) +
- IF( 57813X543X18453 IS NOT NULL AND 57813X543X18453 != '' AND 57813X543X18453 != '99', 1, 0 ) +
- IF( 57813X543X18454 IS NOT NULL AND 57813X543X18454 != '' AND 57813X543X18454 != '99', 1, 0 ) +
- IF( 57813X543X18455 IS NOT NULL AND 57813X543X18455 != '' AND 57813X543X18455 != '99', 1, 0 ) +
- IF( 57813X543X18456 IS NOT NULL AND 57813X543X18456 != '' AND 57813X543X18456 != '99', 1, 0 ) +
- IF( 57813X544X18711 IS NOT NULL AND 57813X544X18711 != '' AND 57813X544X18711 != '99', 1, 0 ) +
- IF( 57813X544X18712 IS NOT NULL AND 57813X544X18712 != '' AND 57813X544X18712 != '99', 1, 0 ) +
- IF( 57813X544X18713 IS NOT NULL AND 57813X544X18713 != '' AND 57813X544X18713 != '99', 1, 0 ) +
- IF( 57813X544X18714 IS NOT NULL AND 57813X544X18714 != '' AND 57813X544X18714 != '99', 1, 0 ) +
- IF( 57813X544X18715 IS NOT NULL AND 57813X544X18715 != '' AND 57813X544X18715 != '99', 1, 0 ) +
- IF( 57813X544X18716 IS NOT NULL AND 57813X544X18716 != '' AND 57813X544X18716 != '99', 1, 0 ) +
- IF( 57813X544X18717 IS NOT NULL AND 57813X544X18717 != '' AND 57813X544X18717 != '99', 1, 0 ) +
- IF( 57813X544X18718 IS NOT NULL AND 57813X544X18718 != '' AND 57813X544X18718 != '99', 1, 0 )
- )
- )
- )
- / COUNT(*) ), 4) as `AVG`
-FROM `t1`
-WHERE `submitdate` IS NOT NULL
-AND (
- ( 57813X541X17271 IS NOT NULL AND 57813X541X17271 != '' AND 57813X541X17271 != '99' ) OR
- ( 57813X541X17272 IS NOT NULL AND 57813X541X17272 != '' AND 57813X541X17272 != '99' ) OR
- ( 57813X541X17273 IS NOT NULL AND 57813X541X17273 != '' AND 57813X541X17273 != '99' ) OR
- ( 57813X541X17274 IS NOT NULL AND 57813X541X17274 != '' AND 57813X541X17274 != '99' ) OR
- ( 57813X541X17275 IS NOT NULL AND 57813X541X17275 != '' AND 57813X541X17275 != '99' ) OR
- ( 57813X541X17276 IS NOT NULL AND 57813X541X17276 != '' AND 57813X541X17276 != '99' ) OR
- ( 57813X542X18131 IS NOT NULL AND 57813X542X18131 != '' AND 57813X542X18131 != '99' ) OR
- ( 57813X542X18132 IS NOT NULL AND 57813X542X18132 != '' AND 57813X542X18132 != '99' ) OR
- ( 57813X542X18133 IS NOT NULL AND 57813X542X18133 != '' AND 57813X542X18133 != '99' ) OR
- ( 57813X542X18134 IS NOT NULL AND 57813X542X18134 != '' AND 57813X542X18134 != '99' ) OR
- ( 57813X542X18135 IS NOT NULL AND 57813X542X18135 != '' AND 57813X542X18135 != '99' ) OR
- ( 57813X542X18136 IS NOT NULL AND 57813X542X18136 != '' AND 57813X542X18136 != '99' ) OR
- ( 57813X542X18137 IS NOT NULL AND 57813X542X18137 != '' AND 57813X542X18137 != '99' ) OR
- ( 57813X542X18138 IS NOT NULL AND 57813X542X18138 != '' AND 57813X542X18138 != '99' ) OR
- ( 57813X542X18139 IS NOT NULL AND 57813X542X18139 != '' AND 57813X542X18139 != '99' ) OR
- ( 57813X543X18451 IS NOT NULL AND 57813X543X18451 != '' AND 57813X543X18451 != '99' ) OR
- ( 57813X543X18452 IS NOT NULL AND 57813X543X18452 != '' AND 57813X543X18452 != '99' ) OR
- ( 57813X543X18453 IS NOT NULL AND 57813X543X18453 != '' AND 57813X543X18453 != '99' ) OR
- ( 57813X543X18454 IS NOT NULL AND 57813X543X18454 != '' AND 57813X543X18454 != '99' ) OR
- ( 57813X543X18455 IS NOT NULL AND 57813X543X18455 != '' AND 57813X543X18455 != '99' ) OR
- ( 57813X543X18456 IS NOT NULL AND 57813X543X18456 != '' AND 57813X543X18456 != '99' ) OR
- ( 57813X544X18711 IS NOT NULL AND 57813X544X18711 != '' AND 57813X544X18711 != '99' ) OR
- ( 57813X544X18712 IS NOT NULL AND 57813X544X18712 != '' AND 57813X544X18712 != '99' ) OR
- ( 57813X544X18713 IS NOT NULL AND 57813X544X18713 != '' AND 57813X544X18713 != '99' ) OR
- ( 57813X544X18714 IS NOT NULL AND 57813X544X18714 != '' AND 57813X544X18714 != '99' ) OR
- ( 57813X544X18715 IS NOT NULL AND 57813X544X18715 != '' AND 57813X544X18715 != '99' ) OR
- ( 57813X544X18716 IS NOT NULL AND 57813X544X18716 != '' AND 57813X544X18716 != '99' ) OR
- ( 57813X544X18717 IS NOT NULL AND 57813X544X18717 != '' AND 57813X544X18717 != '99' ) OR
- ( 57813X544X18718 IS NOT NULL AND 57813X544X18718 != '' AND 57813X544X18718 != '99' ) )
-AND 57813X540X1723 = 'Test';
-
-drop table t1;
-
-#
-# Bug#12735545 - PARSER STACK OVERFLOW WITH NAME_CONST
-# CONTAINING OR EXPRESSION
-#
---error ER_WRONG_ARGUMENTS
-SELECT NAME_CONST('a', -(1 OR 2)) OR 1;
---error ER_WRONG_ARGUMENTS
-SELECT NAME_CONST('a', -(1 AND 2)) OR 1;
-SELECT NAME_CONST('a', -(1)) OR 1;
-
---echo #
---echo # End of 5.5 tests
---echo #
-
---echo #
---echo # GET_LOCK, RELEASE_LOCK, IS_USED_LOCK functions test
---echo #
-
---echo # IS_USED_LOCK, IS_FREE_LOCK: the lock is not acquired
---echo # Note: IS_USED_LOCK returns NULL if the lock is unused
-select is_used_lock('test');
-select is_free_lock('test');
-
---echo # GET_LOCK returns 1 if it manages to acquire a lock
-select get_lock('test', 0);
-
---echo # IS_USED_LOCK, IS_FREE_LOCK: the lock is acquired
-select is_free_lock('test');
-select is_used_lock('test') = connection_id();
-
-connect (con1,localhost,root,,);
-connection con1;
---echo # IS_USED_LOCK, IS_FREE_LOCK: the lock is acquired in another
---echo # connection
-select is_used_lock('test') = connection_id();
-select is_free_lock('test');
-
---echo # GET_LOCK returns 0 if it can't acquire a lock (wait timeout)
-select get_lock('test', 0);
-
---echo # RELEASE_LOCK returns 0 if the lock belongs to another connection
-select release_lock('test');
-
-connection default;
-
---echo # RELEASE_LOCK returns 1 if it successfully releases a lock
-select release_lock('test');
---echo # RELEASE_LOCK returns NULL if it doesn't release a lock and there is no such lock
-select release_lock('test');
-
---echo # Test that get_lock() returns NULL if error.
-select get_lock('test', 0);
-connection con1;
-create table t1 select connection_id() as id;
-send select get_lock('test', 7200);
-
-connection default;
-let $wait_condition= SELECT count(*) > 0 FROM information_schema.processlist WHERE info LIKE 'select%' AND state='User lock';
-source include/wait_condition.inc;
-select (@id := id) - id from t1;
-kill query @id;
-
-connection con1;
-reap;
-
-connection default;
-
---echo # GET_LOCK() works recursively
-select get_lock('test', 0);
-select get_lock('test', 0);
-select get_lock('test', 0);
-
---echo # RELEASE_LOCK() needs to be called recursively then, too
-select release_lock('test');
-select release_lock('test');
-select release_lock('test');
-
---echo # Once the last instance of the lock is released,
---echo # the next call returns NULL
-select release_lock('test');
-
-
---echo # Multiple locks in the same session are OK
-select get_lock('test1', 0);
-select get_lock('test2', 0);
-select get_lock('test3', 0);
-
-select release_lock('test1');
-select release_lock('test2');
-select release_lock('test3');
-
---echo # Deadlocks are detected e.g. in case of a mutual wait
-select get_lock('test1', 0);
-
-connection con1;
-select get_lock('test2', 0);
-send select get_lock('test1', 7200);
-
-connection default;
-let $wait_condition= SELECT count(*) > 0 FROM information_schema.processlist WHERE info LIKE 'select%' AND state='User lock';
-source include/wait_condition.inc;
---error ER_LOCK_DEADLOCK
-select get_lock('test2', 7200);
-
-select release_lock('test1');
-
-connection con1;
-reap;
-select release_lock('test2');
-select release_lock('test1');
-
-connection default;
-
---echo # LOCK/UNLOCK TABLES works fine with a user lock.
-lock table t1 write;
-select get_lock('test', 0);
-unlock tables;
-commit;
-select release_lock('test');
-
---echo # GLOBAL READ LOCK works with fine with user locks
-select get_lock('test1', 0);
-flush tables with read lock;
-select get_lock('test2', 0);
-unlock tables;
-commit;
-select release_lock('test1');
-select release_lock('test2');
-
---echo # BEGIN/COMMIT/ROLLBACK don't unlock user locks.
-begin;
-select get_lock('test1', 0);
-select get_lock('test2', 0);
-select count(*) from t1;
-rollback;
-select release_lock('test1');
-select release_lock('test2');
-
---echo # Deadlocks between user locks and LOCK TABLES locks
---echo # are detected OK.
-select get_lock('test', 0);
-
-connection con1;
-lock table t1 write;
-send select get_lock('test', 7200);
-
-connection default;
-let $wait_condition= SELECT count(*) > 0 FROM information_schema.processlist WHERE info LIKE 'select%' AND state = 'User lock';
-source include/wait_condition.inc;
---error ER_LOCK_DEADLOCK
-lock table t1 read;
-
-select release_lock('test');
-
-connection con1;
-reap;
-select release_lock('test');
-unlock tables;
-
---echo # cleanup
-disconnect con1;
-connection default;
-drop table t1;
-
---echo # check too long identifier names
-select get_lock(repeat('a', 192), 0);
-select is_used_lock(repeat('a', 192)) = connection_id();
-select is_free_lock(repeat('a', 192));
-select release_lock(repeat('a', 192));
---error ER_TOO_LONG_IDENT
-select get_lock(repeat('a', 193), 0);
---error ER_TOO_LONG_IDENT
-select is_used_lock(repeat('a', 193));
---error ER_TOO_LONG_IDENT
-select is_free_lock(repeat('a', 193));
---error ER_TOO_LONG_IDENT
-select release_lock(repeat('a', 193));
-
-
---echo
---echo # --
---echo # -- WL#5787: IPv6-capable INET_ATON and INET_NTOA functions.
---echo # --
-
---echo
---echo # -- INET6_ATON: checking NULL, invalid types, out-of range values...
---echo
-
-SELECT INET6_ATON(NULL) IS NULL;
-SELECT INET6_ATON(123) IS NULL;
-SELECT INET6_ATON(123.45) IS NULL;
-SELECT INET6_ATON(NOW()) IS NULL;
-
-SELECT INET6_ATON('1.2.3') IS NULL;
-SELECT INET6_ATON('1.2.3.') IS NULL;
-SELECT INET6_ATON('1..3.4') IS NULL;
-SELECT INET6_ATON('-1.2.3.4') IS NULL;
-SELECT INET6_ATON('1.2.3.256') IS NULL;
-SELECT INET6_ATON('1.2.3.4.5') IS NULL;
-SELECT INET6_ATON('0001.2.3.4') IS NULL;
-SELECT INET6_ATON('0x1.2.3.4') IS NULL;
-SELECT INET6_ATON('a.2.3.4') IS NULL;
-
-SELECT INET6_ATON('1.2.3.4:80') IS NULL;
-SELECT INET6_ATON('1.2.3.4/32') IS NULL;
-
-SELECT INET6_ATON('mysql.com') IS NULL;
-
-SELECT INET6_ATON(':::') IS NULL;
-SELECT INET6_ATON(':1:2:3') IS NULL;
-SELECT INET6_ATON('1:2:3:') IS NULL;
-SELECT INET6_ATON(':1::2:3') IS NULL;
-SELECT INET6_ATON('1::2:3:') IS NULL;
-SELECT INET6_ATON('::00001') IS NULL;
-SELECT INET6_ATON('::00001:2') IS NULL;
-SELECT INET6_ATON('::12345') IS NULL;
-SELECT INET6_ATON('1020::3040::5060') IS NULL;
-SELECT INET6_ATON('::ABCZ') IS NULL;
-
-SELECT INET6_ATON('::0x1.2.3.4') IS NULL;
-SELECT INET6_ATON('::1.0x2.3.4') IS NULL;
-SELECT INET6_ATON('::a.b.c.d') IS NULL;
-
-SELECT INET6_ATON('::FFFF:0x1.2.3.4') IS NULL;
-SELECT INET6_ATON('::FFFF:1.0x2.3.4') IS NULL;
-SELECT INET6_ATON('::FFFF:a.b.c.d') IS NULL;
-
-SELECT INET6_ATON('::1.2.3.4:ABCD') IS NULL;
-
---echo # NOTE: such addresses are supported because getaddrinfo() supports them.
---echo # This is just to record the current behaviour.
-SELECT HEX(INET6_ATON('::ABCD:1.2.3.4'));
-
---echo
---echo # -- INET6_ATON: checking binary representation...
---echo
-
-SELECT HEX(INET6_ATON('0.0.0.0'));
-SELECT HEX(INET6_ATON('00.00.00.00'));
-SELECT HEX(INET6_ATON('000.000.000.000'));
-SELECT HEX(INET6_ATON('1.2.3.4'));
-SELECT HEX(INET6_ATON('01.02.03.04'));
-SELECT HEX(INET6_ATON('001.002.003.004'));
-SELECT HEX(INET6_ATON('255.255.255.255'));
-SELECT HEX(INET6_ATON('::'));
-SELECT HEX(INET6_ATON('0::0'));
-SELECT HEX(INET6_ATON('1::2'));
-SELECT HEX(INET6_ATON('0::'));
-SELECT HEX(INET6_ATON('1::'));
-SELECT HEX(INET6_ATON('::0'));
-SELECT HEX(INET6_ATON('::1'));
-SELECT HEX(INET6_ATON('1:2:3:4:5:6:7:8'));
-SELECT HEX(INET6_ATON('::2:3:4:5:6:7:8'));
-SELECT HEX(INET6_ATON('1::3:4:5:6:7:8'));
-SELECT HEX(INET6_ATON('1:2::4:5:6:7:8'));
-SELECT HEX(INET6_ATON('1:2:3::5:6:7:8'));
-SELECT HEX(INET6_ATON('1:2:3:4::6:7:8'));
-SELECT HEX(INET6_ATON('1:2:3:4:5::7:8'));
-SELECT HEX(INET6_ATON('1:2:3:4:5:6::8'));
-SELECT HEX(INET6_ATON('1:2:3:4:5:6:7::'));
-SELECT HEX(INET6_ATON('0000:0000::0000:0001'));
-SELECT HEX(INET6_ATON('1234:5678:9abc:def0:4321:8765:cba9:0fed'));
-SELECT HEX(INET6_ATON('0000:0000:0000:0000:0000:0000:0000:0001'));
-SELECT HEX(INET6_ATON('::C0A8:0102'));
-SELECT HEX(INET6_ATON('::c0a8:0102'));
-SELECT HEX(INET6_ATON('::192.168.1.2'));
-SELECT HEX(INET6_ATON('::FfFf:C0a8:0102'));
-SELECT HEX(INET6_ATON('::ffff:c0a8:0102'));
-SELECT HEX(INET6_ATON('::ffff:192.168.1.2'));
-SELECT HEX(INET6_ATON('::01.2.3.4'));
-SELECT HEX(INET6_ATON('::1.02.3.4'));
-SELECT HEX(INET6_ATON('::1.2.03.4'));
-SELECT HEX(INET6_ATON('::1.2.3.04'));
-SELECT HEX(INET6_ATON('::1.2.3.00'));
-SELECT HEX(INET6_ATON('::FFFF:01.2.3.4'));
-SELECT HEX(INET6_ATON('::FFFF:1.02.3.4'));
-SELECT HEX(INET6_ATON('::FFFF:1.2.03.4'));
-SELECT HEX(INET6_ATON('::FFFF:1.2.3.04'));
-SELECT HEX(INET6_ATON('::FFFF:1.2.3.00'));
-
---echo
---echo # -- INET6_ATON: checking the length is either 4 or 16...
---echo
-
-SELECT LENGTH(INET6_ATON('0.0.0.0'));
-SELECT LENGTH(INET6_ATON('255.255.255.255'));
-SELECT LENGTH(INET6_ATON('::'));
-SELECT LENGTH(INET6_ATON('1020:3040:5060:7080:90A0:B0C0:D0E0:F010'));
-
---echo
---echo # -- INET6_NTOA: checking NULL, invalid types, out-of range values...
---echo
-
-SELECT INET6_NTOA(NULL);
-SELECT INET6_NTOA(123);
-SELECT INET6_NTOA(123.456);
-SELECT INET6_NTOA(NOW());
-SELECT INET6_NTOA(UNHEX('C0A801')); # 3 bytes -> NULL
-SELECT INET6_NTOA(UNHEX('C0A80102')); # 4 bytes -> 192.168.1.2
-SELECT INET6_NTOA(UNHEX('C0A8010203')); # 5 bytes -> NULL
-SELECT INET6_NTOA(UNHEX('0102030405060708090A0B0C0D0E0F')); # 15 bytes -> NULL
-SELECT INET6_NTOA(UNHEX('0102030405060708090A0B0C0D0E0F10')); # 16 bytes -> IP
-SELECT INET6_NTOA(UNHEX('0102030405060708090A0B0C0D0E0F1011')); # 17 bytes -> NULL
-
-SELECT INET6_NTOA('1234'), INET6_NTOA(BINARY('1234'));
-SELECT INET6_NTOA('0123456789abcdef'), INET6_NTOA(BINARY('0123456789abcdef'));
-
---echo
---echo # -- Checking double-conversion...
---echo
-
-SELECT INET6_NTOA(INET6_ATON('::'));
-SELECT INET6_NTOA(INET6_ATON('0::0'));
-SELECT INET6_NTOA(INET6_ATON('1::2'));
-SELECT INET6_NTOA(INET6_ATON('0::'));
-SELECT INET6_NTOA(INET6_ATON('1::'));
-SELECT INET6_NTOA(INET6_ATON('::0'));
-SELECT INET6_NTOA(INET6_ATON('::1'));
-SELECT INET6_NTOA(INET6_ATON('1:2:3:4:5:6:7:8'));
-SELECT INET6_NTOA(INET6_ATON('::2:3:4:5:6:7:8'));
-SELECT INET6_NTOA(INET6_ATON('1::3:4:5:6:7:8'));
-SELECT INET6_NTOA(INET6_ATON('1:2::4:5:6:7:8'));
-SELECT INET6_NTOA(INET6_ATON('1:2:3::5:6:7:8'));
-SELECT INET6_NTOA(INET6_ATON('1:2:3:4::6:7:8'));
-SELECT INET6_NTOA(INET6_ATON('1:2:3:4:5::7:8'));
-SELECT INET6_NTOA(INET6_ATON('1:2:3:4:5:6::8'));
-SELECT INET6_NTOA(INET6_ATON('1:2:3:4:5:6:7::'));
-SELECT INET6_NTOA(INET6_ATON('0000:0000::0000:0001'));
-SELECT INET6_NTOA(INET6_ATON('1234:5678:9abc:def0:4321:8765:cba9:0fed'));
-SELECT INET6_NTOA(INET6_ATON('0000:0000:0000:0000:0000:0000:0000:0001'));
-SELECT INET6_NTOA(INET6_ATON('::C0A8:0102'));
-SELECT INET6_NTOA(INET6_ATON('::c0a8:0102'));
-SELECT INET6_NTOA(INET6_ATON('::192.168.1.2'));
-SELECT INET6_NTOA(INET6_ATON('::FfFf:C0a8:0102'));
-SELECT INET6_NTOA(INET6_ATON('::ffff:c0a8:0102'));
-SELECT INET6_NTOA(INET6_ATON('::ffff:192.168.1.2'));
-SELECT INET6_NTOA(INET6_ATON('::01.2.3.4'));
-SELECT INET6_NTOA(INET6_ATON('::1.02.3.4'));
-SELECT INET6_NTOA(INET6_ATON('::1.2.03.4'));
-SELECT INET6_NTOA(INET6_ATON('::1.2.3.04'));
-SELECT INET6_NTOA(INET6_ATON('::1.2.3.00'));
-SELECT INET6_NTOA(INET6_ATON('::FFFF:01.2.3.4'));
-SELECT INET6_NTOA(INET6_ATON('::FFFF:1.02.3.4'));
-SELECT INET6_NTOA(INET6_ATON('::FFFF:1.2.03.4'));
-SELECT INET6_NTOA(INET6_ATON('::FFFF:1.2.3.04'));
-SELECT INET6_NTOA(INET6_ATON('::FFFF:1.2.3.00'));
-
---echo
---echo # -- Comparing INET_ATON() and INET6_ATON()...
---echo
-
-SELECT HEX(INET_ATON('192.168.1.2'));
-SELECT HEX(INET6_ATON('192.168.1.2'));
-
-SELECT HEX(INET_ATON('255.255.255.255'));
-SELECT HEX(INET6_ATON('255.255.255.255'));
-
-SELECT HEX(INET_ATON('192.168.08.2'));
-SELECT HEX(INET6_ATON('192.168.08.2'));
-
-SELECT HEX(INET_ATON('192.168.0x8.2'));
-SELECT HEX(INET6_ATON('192.168.0x8.2'));
-
-SELECT HEX(INET_ATON('1.2.255'));
-SELECT HEX(INET6_ATON('1.2.255'));
-
-SELECT HEX(INET_ATON('1.2.256'));
-SELECT HEX(INET6_ATON('1.2.256'));
-
-SELECT HEX(INET_ATON('1.0002.3.4'));
-SELECT HEX(INET6_ATON('1.0002.3.4'));
-
-SELECT HEX(INET_ATON('1.2.3.4.5'));
-SELECT HEX(INET6_ATON('1.2.3.4.5'));
-
---echo
---echo # -- Checking mix of INET- and INET6- functions...
---echo
-
-SELECT HEX(INET6_ATON(INET_NTOA(INET_ATON('1.2.3.4')))) AS x;
-
---echo
---echo # -- Checking IS_IPV4() / IS_IPV6()...
---echo
-
-SELECT IS_IPV4(NULL);
-SELECT IS_IPV4(1);
-SELECT IS_IPV4(1.0);
-SELECT IS_IPV4('1.2.3.4');
-SELECT IS_IPV4('001.02.000.255');
-SELECT IS_IPV4('::1.2.0.255');
-SELECT IS_IPV4('::1');
-SELECT IS_IPV4(BINARY('1.2.3.4'));
-
-SELECT IS_IPV6(NULL);
-SELECT IS_IPV6(1);
-SELECT IS_IPV6(1.0);
-SELECT IS_IPV6('1.2.3.4');
-SELECT IS_IPV6('001.02.000.255');
-SELECT IS_IPV6('::001.02.000.255');
-SELECT IS_IPV6('::1.2.0.255');
-SELECT IS_IPV6('::1');
-SELECT IS_IPV6('0000:0000:0000:0000:0000:0000:0000:0001');
-SELECT IS_IPV6(BINARY('0000:0000:0000:0000:0000:0000:0000:0001'));
-
---echo
---echo # -- Checking IS_IPV4_MAPPED() and IS_IPV4_COMPAT()...
---echo
-
-SELECT IS_IPV4_MAPPED(INET6_ATON('1.2.3.4')),
- IS_IPV4_COMPAT(INET6_ATON('1.2.3.4'));
-SELECT IS_IPV4_MAPPED(INET6_ATON('::1.2.3.4')),
- IS_IPV4_COMPAT(INET6_ATON('::1.2.3.4'));
-SELECT IS_IPV4_MAPPED(INET6_ATON('::FFFF:1.2.3.4')),
- IS_IPV4_COMPAT(INET6_ATON('::FFFF:1.2.3.4'));
-SELECT IS_IPV4_MAPPED(INET6_ATON('::ABCD:1.2.3.4')),
- IS_IPV4_COMPAT(INET6_ATON('::ABCD:1.2.3.4'));
-SELECT IS_IPV4_MAPPED(INET6_ATON('::1')),
- IS_IPV4_COMPAT(INET6_ATON('::1'));
-SELECT IS_IPV4_MAPPED(INET6_ATON('::')),
- IS_IPV4_COMPAT(INET6_ATON('::'));
-
-# NOTE: IS_IPV4_COMPAT() / IS_IPV4_MAPPED() could work with "regular strings in
-# binary collation" too, but there is no way to create a "regular string"
-# starting with \0.
-
---echo
---echo # -- Checking IS_IPV4_COMPAT()...
---echo
-
---echo
---echo # -- Working with a table...
---echo
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS t2;
---enable_warnings
-
-CREATE TABLE t1(ip INT UNSIGNED);
-CREATE TABLE t2(ip VARBINARY(16));
-
---echo
-
-INSERT INTO t1 VALUES
- (INET_ATON('1.2.3.4')), (INET_ATON('255.255.255.255'));
-SELECT INET_NTOA(ip) FROM t1;
-
---echo
-
-INSERT INTO t2 SELECT INET6_ATON(INET_NTOA(ip)) FROM t1;
-SELECT INET6_NTOA(ip), HEX(ip), LENGTH(ip) FROM t2;
-DELETE FROM t2;
-
---echo
-
-INSERT INTO t2 VALUES
- (INET6_ATON('1.2.3.4')), (INET6_ATON('255.255.255.255')),
- (INET6_ATON('::1.2.3.4')), (INET6_ATON('::ffff:255.255.255.255')),
- (INET6_ATON('::')), (INET6_ATON('::1')),
- (INET6_ATON('1020:3040:5060:7080:90A0:B0C0:D0E0:F010'));
-SELECT INET6_NTOA(ip), HEX(ip), LENGTH(ip) FROM t2;
-
---echo
-
-DROP TABLE t1;
-DROP TABLE t2;
-
---echo #
---echo # MDEV-4018 : Microseconds in GET_LOCK()
---echo #
-
-connection default;
-select is_used_lock('test') = connection_id();
-
---echo # GET_LOCK returns 1 if it manages to acquire a lock
-select get_lock('test', 0);
-
-connect (con1,localhost,root,,);
-connection con1;
-select is_used_lock('test') = connection_id();
-select get_lock('test', 0);
-select get_lock('test', 1.0);
-select get_lock('test', 1.5);
-select get_lock('test', 0.1);
-select get_lock('test', 0.000001);
-select get_lock('test', 0.0000000000000001);
-
-connection default;
-select is_used_lock('test') = connection_id();
-select release_lock('test');
-
---echo
---echo # -- Done.
---echo
-
-
---echo #
---echo # MDEV-13685 Can not replay binary log due to Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8mb4_general_ci,COERCIBLE) for operation 'concat'
---echo #
-SET NAMES utf8;
-SELECT COERCIBILITY(NAME_CONST('name','test'));
-SELECT COERCIBILITY(NAME_CONST('name',TIME'00:00:00'));
-SELECT COERCIBILITY(NAME_CONST('name',15));
-SELECT CONCAT(NAME_CONST('name',15),'오');
-SET NAMES latin1;
-
---echo #
---echo # MDEV-14116 INET6_NTOA output is set as null to varchar(39) variable
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE ip_full_addr varchar(39) DEFAULT "";
- SELECT INET6_NTOA(UNHEX('20000000000000000000000000000000')) into ip_full_addr;
- SELECT ip_full_addr;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-10134 Add full support for DEFAULT
---echo #
-
-CREATE TABLE t1 (
- a VARCHAR(30),
- b BIGINT DEFAULT INET_ATON(a),
- a1 VARCHAR(30) DEFAULT INET_NTOA(b),
- c INT DEFAULT IS_IPV4(a),
- d INT DEFAULT IS_IPV6(a)
-);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('192.168.001.001'),('::1'),('xxx');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (
- str VARCHAR(128),
- addr VARBINARY(16) DEFAULT INET6_ATON(str),
- str1 VARCHAR(128) DEFAULT INET6_NTOA(addr),
- b INT DEFAULT IS_IPV4_COMPAT(addr),
- c INT DEFAULT IS_IPV4_MAPPED(addr)
-);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (str) VALUES ('::FFFF:192.168.0.1'),('::10.0.5.9');
-SELECT str, str1, b,c FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-14613: Assertion `fixed == 0' failed in Item_func::fix_fields
---echo #
-
-CREATE TABLE `t1` (
- `numgtfmt` char(10) COLLATE utf8_bin NOT NULL
-) DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-
-create view v1(numgtfmt)
-as
-select 'x' from t1
-union
-select 'x' from t1 ;
-
-SELECT * FROM v1 WHERE numgtfmt = NAME_CONST('wnumgtfmt',_utf8'QEDITIONS' COLLATE 'utf8_bin');
-
-# Cleanup
-DROP VIEW v1;
-DROP TABLE t1;
-
-
---echo #
---echo # End of 10.2 tests
---echo #
-
---echo #
---echo # Start of 10.3 tests
---echo #
-
---echo #
---echo # MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
---echo #
-
---enable_metadata
---disable_ps_protocol
-
-SELECT INET_ATON("255.255.255.255.255.255.255.255");
-
---enable_ps_protocol
---disable_metadata
diff --git a/mysql-test/t/func_op.test b/mysql-test/t/func_op.test
deleted file mode 100644
index 13fa40b513b..00000000000
--- a/mysql-test/t/func_op.test
+++ /dev/null
@@ -1,37 +0,0 @@
-# Description
-# -----------
-# Simple operands and arithmetic grouping
-
-select 1+1,1-1,1+1*2,8/5,8%5,mod(8,5),mod(8,5)|0,-(1+1)*-2;
-explain extended select 1+1,1-1,1+1*2,8/5,8%5,mod(8,5),mod(8,5)|0,-(1+1)*-2;
-select 1 | (1+1),5 & 3,bit_count(7) ;
-explain extended select 1 | (1+1),5 & 3,bit_count(7) ;
-select 1 << 32,1 << 63, 1 << 64, 4 >> 2, 4 >> 63, 1<< 63 >> 60;
-#
-# bug #1993: bit functions must be unsigned
-#
-select -1 | 0, -1 ^ 0, -1 & 0;
-select -1 | 1, -1 ^ 1, -1 & 1;
-select 1 | -1, 1 ^ -1, 1 & -1;
-select 0 | -1, 0 ^ -1, 0 & -1;
-select -1 >> 0, -1 << 0;
-select -1 >> 1, -1 << 1;
-
-#
-# Bug 13044: wrong bit_count() results
-#
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-create table t1(a int);
-create table t2(a int, b int);
-insert into t1 values (1), (2), (3);
-insert into t2 values (1, 7), (3, 7);
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='outer_join_with_cache=off';
-select t1.a, t2.a, t2.b, bit_count(t2.b) from t1 left join t2 on t1.a=t2.a;
-SET optimizer_switch=@save_optimizer_switch;
-drop table t1, t2;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/func_regexp.test b/mysql-test/t/func_regexp.test
deleted file mode 100644
index 6d5186269a5..00000000000
--- a/mysql-test/t/func_regexp.test
+++ /dev/null
@@ -1,112 +0,0 @@
-#
-# Some regexp tests
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-set names latin1;
---source include/ctype_regex.inc
-
-
-#
-# This test a bug in regexp on Alpha
-#
-
-create table t1 (xxx char(128));
-insert into t1 (xxx) values('this is a test of some long text to see what happens');
-select * from t1 where xxx regexp('is a test of some long text to');
-explain extended select * from t1 where xxx regexp('is a test of some long text to');
-select * from t1 where xxx regexp('is a test of some long text to ');
-select * from t1 where xxx regexp('is a test of some long text to s');
-select * from t1 where xxx regexp('is a test of some long text to se');
-drop table t1;
-
-create table t1 (xxx char(128));
-insert into t1 (xxx) values('this is some text: to test - out.reg exp (22/45)');
-select * from t1 where xxx REGEXP '^this is some text: to test - out\\.reg exp [[(][0-9]+[/\\][0-9]+[])][ ]*$';
-drop table t1;
-
-#
-# Check with different character sets and collations
-#
-select _latin1 0xFF regexp _latin1 '[[:lower:]]' COLLATE latin1_bin;
-select _koi8r 0xFF regexp _koi8r '[[:lower:]]' COLLATE koi8r_bin;
-select _latin1 0xFF regexp _latin1 '[[:upper:]]' COLLATE latin1_bin;
-select _koi8r 0xFF regexp _koi8r '[[:upper:]]' COLLATE koi8r_bin;
-
-select _latin1 0xF7 regexp _latin1 '[[:alpha:]]';
-select _koi8r 0xF7 regexp _koi8r '[[:alpha:]]';
-
-select _latin1'a' regexp _latin1'A' collate latin1_general_ci;
-select _latin1'a' regexp _latin1'A' collate latin1_bin;
-
-#
-# regexp cleanup()
-#
-create table t1 (a varchar(40));
-insert into t1 values ('C1'),('C2'),('R1'),('C3'),('R2'),('R3');
-prepare stmt1 from 'select a from t1 where a rlike ? order by a';
-set @a="^C.*";
-execute stmt1 using @a;
-set @a="^R.*";
-execute stmt1 using @a;
-deallocate prepare stmt1;
-drop table t1;
-
---echo End of 4.1 tests
-
-
-#
-# Bug #31440: 'select 1 regex null' asserts debug server
-#
-
-SELECT 1 REGEXP NULL;
-
-
-#
-# Bug #39021: SELECT REGEXP BINARY NULL never returns
-#
-
-SELECT '' REGEXP BINARY NULL;
-SELECT NULL REGEXP BINARY NULL;
-SELECT 'A' REGEXP BINARY NULL;
-SELECT "ABC" REGEXP BINARY NULL;
-
---echo End of 5.0 tests
-
-
-#
-# Bug #37337: Function returns different results
-#
-CREATE TABLE t1(a INT, b CHAR(4));
-INSERT INTO t1 VALUES (1, '6.1'), (1, '7.0'), (1, '8.0');
-PREPARE stmt1 FROM "SELECT a FROM t1 WHERE a=1 AND '7.0' REGEXP b LIMIT 1";
-EXECUTE stmt1;
-EXECUTE stmt1;
-EXECUTE stmt1;
-EXECUTE stmt1;
-DEALLOCATE PREPARE stmt1;
-DROP TABLE t1;
-
-
---echo End of 5.1 tests
-
-#
-# MDEV-5820 MySQL Bug #54805 definitions in regex/my_regex.h conflict with /usr/include/regex.h
-# Bug #55427 REGEXP does not recognize '\t' as [:blank:]
-#
-# Test that \t is indeed recognized as [[:blank:]]
-#
-SELECT ' ' REGEXP '[[:blank:]]';
-SELECT '\t' REGEXP '[[:blank:]]';
-
-SELECT ' ' REGEXP '[[:space:]]';
-SELECT '\t' REGEXP '[[:space:]]';
-
---echo #
---echo # MDEV-13967 Parameter data type control for Item_long_func
---echo #
-SELECT REGEXP_INSTR('111222333',2);
-
diff --git a/mysql-test/t/func_regexp_pcre.test b/mysql-test/t/func_regexp_pcre.test
deleted file mode 100644
index 21600390bb2..00000000000
--- a/mysql-test/t/func_regexp_pcre.test
+++ /dev/null
@@ -1,465 +0,0 @@
-
-SET NAMES utf8;
-
---echo #
---echo # MDEV-4425 REGEXP enhancements
---echo #
-
---echo #
---echo # Checking RLIKE
---echo #
-
-# Checking that à is a single character
-SELECT 'à' RLIKE '^.$';
-
-# Checking \x{FFFF} syntax and case sensitivity
-SELECT 'à' RLIKE '\\x{00E0}';
-SELECT 'À' RLIKE '\\x{00E0}';
-SELECT 'à' RLIKE '\\x{00C0}';
-SELECT 'À' RLIKE '\\x{00C0}';
-SELECT 'à' RLIKE '\\x{00E0}' COLLATE utf8_bin;
-SELECT 'À' RLIKE '\\x{00E0}' COLLATE utf8_bin;
-SELECT 'à' RLIKE '\\x{00C0}' COLLATE utf8_bin;
-SELECT 'À' RLIKE '\\x{00C0}' COLLATE utf8_bin;
-
-# Checking how (?i) and (?-i) affect case sensitivity
-CREATE TABLE t1 (s VARCHAR(10) CHARACTER SET utf8);
-INSERT INTO t1 VALUES ('a'),('A');
-CREATE TABLE t2 (p VARCHAR(10) CHARACTER SET utf8);
-INSERT INTO t2 VALUES ('a'),('(?i)a'),('(?-i)a'),('A'),('(?i)A'),('(?-i)A');
-SELECT s,p,s RLIKE p, s COLLATE utf8_bin RLIKE p FROM t1,t2 ORDER BY BINARY s, BINARY p;
-DROP TABLE t1,t2;
-
-
-# Checking Unicode character classes
-CREATE TABLE t1 (ch VARCHAR(22)) CHARACTER SET utf8;
-CREATE TABLE t2 (class VARCHAR(32)) CHARACTER SET utf8;
-INSERT INTO t1 VALUES ('Я'),('Σ'),('A'),('À');
-INSERT INTO t1 VALUES ('я'),('σ'),('a'),('à');
-INSERT INTO t1 VALUES ('㐗'),('갷'),('ප');
-INSERT INTO t1 VALUES ('1'),('௨');
-INSERT INTO t2 VALUES ('\\p{Cyrillic}'),('\\p{Greek}'),('\\p{Latin}');
-INSERT INTO t2 VALUES ('\\p{Han}'),('\\p{Hangul}');
-INSERT INTO t2 VALUES ('\\p{Sinhala}'), ('\\p{Tamil}');
-INSERT INTO t2 VALUES ('\\p{L}'),('\\p{Ll}'),('\\p{Lu}'),('\\p{L&}');
-INSERT INTO t2 VALUES ('[[:alpha:]]'),('[[:digit:]]');
-SELECT class, ch, ch RLIKE class FROM t1, t2 ORDER BY class, BINARY ch;
-DROP TABLE t1, t2;
-
-# Checking that UCP is disabled by default for binary data
-SELECT 0xFF RLIKE '\\w';
-SELECT 0xFF RLIKE '(*UCP)\\w';
-
-# newline character
-SELECT '\n' RLIKE '(*CR)';
-SELECT '\n' RLIKE '(*LF)';
-SELECT '\n' RLIKE '(*CRLF)';
-SELECT '\n' RLIKE '(*ANYCRLF)';
-SELECT '\n' RLIKE '(*ANY)';
-
-SELECT 'a\nb' RLIKE '(*LF)(?m)^a$';
-SELECT 'a\nb' RLIKE '(*CR)(?m)^a$';
-SELECT 'a\nb' RLIKE '(*CRLF)(?m)^a$';
-SELECT 'a\nb' RLIKE '(*ANYCRLF)(?m)^a$';
-
-SELECT 'a\rb' RLIKE '(*LF)(?m)^a$';
-SELECT 'a\rb' RLIKE '(*CR)(?m)^a$';
-SELECT 'a\rb' RLIKE '(*CRLF)(?m)^a$';
-SELECT 'a\rb' RLIKE '(*ANYCRLF)(?m)^a$';
-
-SELECT 'a\r\nb' RLIKE '(*LF)(?m)^a$';
-SELECT 'a\r\nb' RLIKE '(*CR)(?m)^a$';
-SELECT 'a\r\nb' RLIKE '(*CRLF)(?m)^a$';
-SELECT 'a\r\nb' RLIKE '(*ANYCRLF)(?m)^a$';
-
-#backreference
-SELECT 'aa' RLIKE '(a)\\g1';
-SELECT 'aa bb' RLIKE '(a)\\g1 (b)\\g2';
-
-#repitition
-SELECT 'aaaaa' RLIKE 'a{0,5}';
-SELECT 'aaaaa' RLIKE 'a{1,3}';
-SELECT 'aaaaa' RLIKE 'a{0,}';
-SELECT 'aaaaa' RLIKE 'a{10,20}';
-
-#Recursion
-SELECT 'aabb' RLIKE 'a(?R)?b';
-SELECT 'aabb' RLIKE 'aa(?R)?bb';
-
-#subroutine
-#SELECT 'abbbc' RLIKE '(a(b|(?1))*c)';
-#SELECT 'abca' RLIKE '([abc])(?1){3}';
-
-#Atomic grouping
-SELECT 'abcc' RLIKE 'a(?>bc|b)c';
-SELECT 'abc' RLIKE 'a(?>bc|b)c';
-
-#lookahead - negative
-SELECT 'ab' RLIKE 'a(?!b)';
-SELECT 'ac' RLIKE 'a(?!b)';
-
-#lookahead - positive
-SELECT 'ab' RLIKE 'a(?=b)';
-SELECT 'ac' RLIKE 'a(?=b)';
-
-#lookbehind - negative
-SELECT 'ab' RLIKE '(?<!a)b';
-SELECT 'cb' RLIKE '(?<!a)b';
-
-#lookbehind - positive
-SELECT 'ab' RLIKE '(?<=a)b';
-SELECT 'cb' RLIKE '(?<=a)b';
-
-# named subpatterns
-SELECT 'aa' RLIKE '(?P<pattern>a)(?P=pattern)';
-SELECT 'aba' RLIKE '(?P<pattern>a)b(?P=pattern)';
-
-#comments
-SELECT 'a' RLIKE 'a(?#comment)';
-SELECT 'aa' RLIKE 'a(?#comment)a';
-SELECT 'aba' RLIKE 'a(?#b)a';
-
-#ungreedy maching
-#SELECT 'ddd <ab>cc</ab> eee' RLIKE '<.+?>';
-
-#Extended character classes
-SELECT 'aaa' RLIKE '\\W\\W\\W';
-SELECT '%' RLIKE '\\W';
-SELECT '%a$' RLIKE '\\W.\\W';
-
-SELECT '123' RLIKE '\\d\\d\\d';
-SELECT 'aaa' RLIKE '\\d\\d\\d';
-SELECT '1a3' RLIKE '\\d.\\d';
-SELECT 'a1b' RLIKE '\\d.\\d';
-
-SELECT '8' RLIKE '\\D';
-SELECT 'a' RLIKE '\\D';
-SELECT '%' RLIKE '\\D';
-SELECT 'a1' RLIKE '\\D\\d';
-SELECT 'a1' RLIKE '\\d\\D';
-
-SELECT '\t' RLIKE '\\s';
-SELECT '\r' RLIKE '\\s';
-SELECT '\n' RLIKE '\\s';
-SELECT '\v' RLIKE '\\s';
-
-SELECT 'a' RLIKE '\\S';
-SELECT '1' RLIKE '\\S';
-SELECT '!' RLIKE '\\S';
-SELECT '.' RLIKE '\\S';
-
-# checking 0x00 bytes
-# Bug#70470 REGEXP fails to find matches after NUL character
-SELECT 'abc\0def' REGEXP 'def';
-SELECT 'abc\0def' REGEXP 'abc\\x{00}def';
-SELECT HEX(REGEXP_SUBSTR('abc\0def','abc\\x{00}def'));
-
-
---echo #
---echo # Checking REGEXP_REPLACE
---echo #
-
-# Check data type
-CREATE TABLE t1 AS SELECT REGEXP_REPLACE('abc','b','x');
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-# Check print()
-EXPLAIN EXTENDED SELECT REGEXP_REPLACE('abc','b','x');
-
-# Check decimals
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-CREATE TABLE t1 AS SELECT REGEXP_REPLACE('abc','b','x')+0;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-# Return NULL if any of the arguments are NULL
-SELECT REGEXP_REPLACE(NULL,'b','c');
-SELECT REGEXP_REPLACE('a',NULL,'c');
-SELECT REGEXP_REPLACE('a','b',NULL);
-
-# Return the original string if no match
-SELECT REGEXP_REPLACE('a','x','b');
-
-# Return the original string for an empty pattern
-SELECT REGEXP_REPLACE('a','','b');
-
-# Check that replace stops on the first empty match
-# 'a5b' matches the pattern and '5' is replaced to 'x'
-# then 'ab' matches the pattern, but the match '5*' is empty,
-# so replacing stops here.
-SELECT REGEXP_REPLACE('a5b ab a5b','(?<=a)5*(?=b)','x');
-
-# A modified version of the previous example,
-# to check that all matches are replaced if no empty match is met.
-SELECT REGEXP_REPLACE('a5b a5b a5b','(?<=a)5*(?=b)','x');
-
-
-# Check that case sensitiviry respects the collation
-SELECT REGEXP_REPLACE('A','a','b');
-SELECT REGEXP_REPLACE('a','A','b');
-SELECT REGEXP_REPLACE('A' COLLATE utf8_bin,'a','b');
-SELECT REGEXP_REPLACE('a' COLLATE utf8_bin,'A','b');
-
-# Pattern references in the "replace" string
-SELECT REGEXP_REPLACE('James Bond', '(.*) (.*)', '\\2, \\1 \\2');
-
-# Checking with UTF8
-SELECT REGEXP_REPLACE('абвгд','в','ц');
-
-# Check that it does not treat binary strings as UTF8
-SELECT REGEXP_REPLACE('г',0xB3,0xB4);
-
-# Check that it replaces all matches by default
-SELECT REGEXP_REPLACE('aaaa','a','b');
-
-# Replace all matches except the first letter
-SELECT REGEXP_REPLACE('aaaa','(?<=.)a','b');
-
-# Replace all matches except the last letter
-SELECT REGEXP_REPLACE('aaaa','a(?=.)','b');
-
-# Replace all matches except the first and the last letter
-SELECT REGEXP_REPLACE('aaaa','(?<=.)a(?=.)','b');
-
-# newline character
-SELECT REGEXP_REPLACE('a\nb','(*LF)(?m)^a$','c');
-SELECT REGEXP_REPLACE('a\nb','(*CR)(?m)^a$','c');
-SELECT REGEXP_REPLACE('a\nb','(*CRLF)(?m)^a$','c');
-SELECT REGEXP_REPLACE('a\nb','(*ANYCRLF)(?m)^a$','c');
-
-SELECT REGEXP_REPLACE('a\rb','(*LF)(?m)^a$','c');
-SELECT REGEXP_REPLACE('a\rb','(*CR)(?m)^a$','c');
-SELECT REGEXP_REPLACE('a\rb','(*CRLF)(?m)^a$','c');
-SELECT REGEXP_REPLACE('a\rb','(*ANYCRLF)(?m)^a$','c');
-
-SELECT REGEXP_REPLACE('a\r\nb','(*LF)(?m)^a$','c');
-SELECT REGEXP_REPLACE('a\r\nb','(*CR)(?m)^a$','c');
-SELECT REGEXP_REPLACE('a\r\nb','(*CRLF)(?m)^a$','c');
-SELECT REGEXP_REPLACE('a\r\nb','(*ANYCRLF)(?m)^a$','c');
-
-#backreference
-SELECT REGEXP_REPLACE('aa','(a)\\g1','b');
-SELECT REGEXP_REPLACE('aa bb','(a)\\g1 (b)\\g2','c');
-
-#repitition
-SELECT REGEXP_REPLACE('aaaaa','a{1,3}','b');
-SELECT REGEXP_REPLACE('aaaaa','a{10,20}','b');
-
-#Recursion
-SELECT REGEXP_REPLACE('daabbd','a(?R)?b','c');
-SELECT REGEXP_REPLACE('daabbd','aa(?R)?bb','c');
-
-#Atomic grouping
-SELECT REGEXP_REPLACE('dabccd','a(?>bc|b)c','e');
-SELECT REGEXP_REPLACE('dabcd','a(?>bc|b)c','e');
-
-#lookahead - negative
-SELECT REGEXP_REPLACE('ab','a(?!b)','e');
-SELECT REGEXP_REPLACE('ac','a(?!b)','e');
-
-#lookahead - positive
-SELECT REGEXP_REPLACE('ab','a(?=b)','e');
-SELECT REGEXP_REPLACE('ac','a(?=b)','e');
-
-#lookbehind - negative
-SELECT REGEXP_REPLACE('ab','(?<!a)b','e');
-SELECT REGEXP_REPLACE('cb','(?<!a)b','e');
-
-#lookbehind - positive
-SELECT REGEXP_REPLACE('ab','(?<=a)b','e');
-SELECT REGEXP_REPLACE('cb','(?<=a)b','e');
-
-# named subpatterns
-SELECT REGEXP_REPLACE('aa','(?P<pattern>a)(?P=pattern)','b');
-SELECT REGEXP_REPLACE('aba','(?P<pattern>a)b(?P=pattern)','c');
-
-#comments
-SELECT REGEXP_REPLACE('a','a(?#comment)','e');
-SELECT REGEXP_REPLACE('aa','a(?#comment)a','e');
-SELECT REGEXP_REPLACE('aba','a(?#b)a','e');
-
-#ungreedy maching
-SELECT REGEXP_REPLACE('ddd<ab>cc</ab>eee','<.+?>','*');
-
-#Extended character classes
-SELECT REGEXP_REPLACE('aaa','\\W\\W\\W','e');
-SELECT REGEXP_REPLACE('aaa','\\w\\w\\w','e');
-SELECT REGEXP_REPLACE('%','\\W','e');
-SELECT REGEXP_REPLACE('%a$','\\W.\\W','e');
-SELECT REGEXP_REPLACE('%a$','\\W\\w\\W','e');
-
-SELECT REGEXP_REPLACE('123','\\d\\d\\d\\d\\d\\d','e');
-SELECT REGEXP_REPLACE('123','\\d\\d\\d','e');
-SELECT REGEXP_REPLACE('aaa','\\d\\d\\d','e');
-SELECT REGEXP_REPLACE('1a3','\\d.\\d\\d.\\d','e');
-SELECT REGEXP_REPLACE('1a3','\\d.\\d','e');
-SELECT REGEXP_REPLACE('a1b','\\d.\\d','e');
-
-SELECT REGEXP_REPLACE('8','\\D','e');
-SELECT REGEXP_REPLACE('a','\\D','e');
-SELECT REGEXP_REPLACE('%','\\D','e');
-SELECT REGEXP_REPLACE('a1','\\D\\d','e');
-SELECT REGEXP_REPLACE('a1','\\d\\D','e');
-
-SELECT REGEXP_REPLACE('\t','\\s','e');
-SELECT REGEXP_REPLACE('\r','\\s','e');
-SELECT REGEXP_REPLACE('\n','\\s','e');
-
-SELECT REGEXP_REPLACE('a','\\S','e');
-SELECT REGEXP_REPLACE('1','\\S','e');
-SELECT REGEXP_REPLACE('!','\\S','e');
-SELECT REGEXP_REPLACE('.','\\S','e');
-
---echo #
---echo # Checking REGEXP_INSTR
---echo #
-SELECT REGEXP_INSTR('abcd','X');
-SELECT REGEXP_INSTR('abcd','a');
-SELECT REGEXP_INSTR('abcd','b');
-SELECT REGEXP_INSTR('abcd','c');
-SELECT REGEXP_INSTR('abcd','d');
-SELECT REGEXP_INSTR('aaaa','(?<=a)a');
-
-SELECT REGEXP_INSTR('вася','в');
-SELECT REGEXP_INSTR('вася','а');
-SELECT REGEXP_INSTR('вася','с');
-SELECT REGEXP_INSTR('вася','я');
-SELECT REGEXP_INSTR(CONVERT('вася' USING koi8r), CONVERT('в' USING koi8r));
-SELECT REGEXP_INSTR(CONVERT('вася' USING koi8r), CONVERT('а' USING koi8r));
-SELECT REGEXP_INSTR(CONVERT('вася' USING koi8r), CONVERT('с' USING koi8r));
-SELECT REGEXP_INSTR(CONVERT('вася' USING koi8r), CONVERT('я' USING koi8r));
-
-
---echo #
---echo # Checking REGEXP_SUBSTR
---echo #
-
-# Check data type
-CREATE TABLE t1 AS SELECT REGEXP_SUBSTR('abc','b');
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-# Check print()
-EXPLAIN EXTENDED SELECT REGEXP_SUBSTR('abc','b');
-
-# Check decimals
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-CREATE TABLE t1 AS SELECT REGEXP_SUBSTR('abc','b')+0;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-
-SELECT REGEXP_SUBSTR('See https://mariadb.org/en/foundation/ for details', 'https?://[^/]*');
-
-
---echo #
---echo # MDEV-6027 RLIKE: "." no longer matching new line
---echo #
-SELECT 'cat and\ndog' RLIKE 'cat.*dog';
-SELECT 'cat and\r\ndog' RLIKE 'cat.*dog';
-SELECT 'a\nb' RLIKE 'a.b';
-SELECT 'a\nb' RLIKE '(?-s)a.b';
-SET default_regex_flags='DOTALL';
-SELECT @@default_regex_flags;
-SELECT 'cat and\ndog' RLIKE 'cat.*dog';
-SELECT 'cat and\r\ndog' RLIKE 'cat.*dog';
-SELECT 'a\nb' RLIKE 'a.b';
-SELECT 'a\nb' RLIKE '(?-s)a.b';
-SET default_regex_flags=DEFAULT;
-
---error ER_REGEXP_ERROR
-SELECT REGEXP_SUBSTR('Monday Mon','^((?<DN>Mon|Fri|Sun)day|(?<DN>Tue)sday).*(?P=DN)$');
-SET default_regex_flags='DUPNAMES';
-SELECT REGEXP_SUBSTR('Monday Mon','^((?<DN>Mon|Fri|Sun)day|(?<DN>Tue)sday).*(?P=DN)$');
-SELECT REGEXP_SUBSTR('Tuesday Tue','^((?<DN>Mon|Fri|Sun)day|(?<DN>Tue)sday).*(?P=DN)$');
-SET default_regex_flags=DEFAULT;
-
-SELECT 'AB' RLIKE 'A B';
-SELECT 'AB' RLIKE 'A# this is a comment\nB';
-SET default_regex_flags='EXTENDED';
-SELECT 'AB' RLIKE 'A B';
-SELECT 'AB' RLIKE 'A# this is a comment\nB';
-SET default_regex_flags=DEFAULT;
-
-SELECT 'Aq' RLIKE 'A\\q';
-SET default_regex_flags='EXTRA';
---error ER_REGEXP_ERROR
-SELECT 'Aq' RLIKE 'A\\q';
-SET default_regex_flags=DEFAULT;
-
-SELECT 'a\nb\nc' RLIKE '^b$';
-SET default_regex_flags='MULTILINE';
-SELECT 'a\nb\nc' RLIKE '^b$';
-SET default_regex_flags=DEFAULT;
-
-SELECT REGEXP_SUBSTR('abc','.+');
-SELECT REGEXP_REPLACE('abc','^(.*)(.*)$','\\1/\\2');
-SET default_regex_flags='UNGREEDY';
-SELECT REGEXP_SUBSTR('abc','.+');
-SELECT REGEXP_REPLACE('abc','^(.*)(.*)$','\\1/\\2');
-SET default_regex_flags=DEFAULT;
-
---echo #
---echo # MDEV-6965 non-captured group \2 in regexp_replace
---echo #
-SELECT REGEXP_REPLACE('1 foo and bar', '(\\d+) foo and (\\d+ )?bar', '\\1 this and \\2that');
-
---echo #
---echo # MDEV-8102 REGEXP function fails to match hex values when expression is stored as a variable
---echo #
-
---echo # Testing a warning
-SET NAMES latin1;
-SET @regCheck= '\\xE0\\x01';
-SELECT 0xE001 REGEXP @regCheck;
-
---echo # Testing workaround N1: This makes the pattern to be a binary string:
-SET NAMES latin1;
-SET @regCheck= X'E001';
-SELECT 0xE001 REGEXP @regCheck;
-
---echo # Testing workaround N2: This also makes the pattern to be a binary string, using a different syntax:
-SET NAMES latin1;
-SET @regCheck= _binary '\\xE0\\x01';
-SELECT 0xE001 REGEXP @regCheck;
-
---echo # Testing workarond N3: This makes derivation of the subject string stronger (IMLICIT instead of COERCIBLE)
-SET NAMES latin1;
-SET @regCheck= '\\xE0\\x01';
-SELECT CAST(0xE001 AS BINARY) REGEXP @regCheck;
-
---echo # MDEV-12420: Testing recursion overflow
---replace_regex /[0-9]+ exceeded/NUM exceeded/
-SELECT 1 FROM dual WHERE ('Alpha,Bravo,Charlie,Delta,Echo,Foxtrot,StrataCentral,Golf,Hotel,India,Juliet,Kilo,Lima,Mike,StrataL3,November,Oscar,StrataL2,Sand,P3,P4SwitchTest,Arsys,Poppa,ExtensionMgr,Arp,Quebec,Romeo,StrataApiV2,PtReyes,Sierra,SandAcl,Arrow,Artools,BridgeTest,Tango,SandT,PAlaska,Namespace,Agent,Qos,PatchPanel,ProjectReport,Ark,Gimp,Agent,SliceAgent,Arnet,Bgp,Ale,Tommy,Central,AsicPktTestLib,Hsc,SandL3,Abuild,Pca9555,Standby,ControllerDut,CalSys,SandLib,Sb820,PointV2,BfnLib,Evpn,BfnSdk,Sflow,ManagementActive,AutoTest,GatedTest,Bgp,Sand,xinetd,BfnAgentLib,bf-utils,Hello,BfnState,Eos,Artest,Qos,Scd,ThermoMgr,Uniform,EosUtils,Eb,FanController,Central,BfnL3,BfnL2,tcp_wrappers,Victor,Environment,Route,Failover,Whiskey,Xray,Gimp,BfnFixed,Strata,SoCal,XApi,Msrp,XpProfile,tcpdump,PatchPanel,ArosTest,FhTest,Arbus,XpAcl,MacConc,XpApi,telnet,QosTest,Alpha2,BfnVlan,Stp,VxlanControllerTest,MplsAgent,Bravo2,Lanz,BfnMbb,Intf,XCtrl,Unicast,SandTunnel,L3Unicast,Ipsec,MplsTest,Rsvp,EthIntf,StageMgr,Sol,MplsUtils,Nat,Ira,P4NamespaceDut,Counters,Charlie2,Aqlc,Mlag,Power,OpenFlow,Lag,RestApi,BfdTest,strongs,Sfa,CEosUtils,Adt746,MaintenanceMode,MlagDut,EosImage,IpEth,MultiProtocol,Launcher,Max3179,Snmp,Acl,IpEthTest,PhyEee,bf-syslibs,tacc,XpL2,p4-ar-switch,p4-bf-switch,LdpTest,BfnPhy,Mirroring,Phy6,Ptp' REGEXP '^((?!\b(Strata|StrataApi|StrataApiV2)\b).)*$');
-
-#
-# MDEV-13173 An RLIKE that previously worked on 10.0 now returns "Got error 'pcre_exec: recursion limit of 100 exceeded' from regexp"
-#
-SELECT CONCAT(REPEAT('100,',60),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$';
---replace_regex /[0-9]+ exceeded/NUM exceeded/
-SELECT CONCAT(REPEAT('100,',200),'101') RLIKE '^(([1-9][0-9]*),)*[1-9][0-9]*$';
-
-SELECT REGEXP_INSTR(CONCAT(REPEAT('100,',60),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$');
---replace_regex /[0-9]+ exceeded/NUM exceeded/
-SELECT REGEXP_INSTR(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$');
-
-SELECT LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',60),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'));
---replace_regex /[0-9]+ exceeded/NUM exceeded/
-SELECT LENGTH(REGEXP_SUBSTR(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$'));
-
-SELECT LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',60),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', ''));
---replace_regex /[0-9]+ exceeded/NUM exceeded/
-SELECT LENGTH(REGEXP_REPLACE(CONCAT(REPEAT('100,',200),'101'), '^(([1-9][0-9]*),)*[1-9][0-9]*$', ''));
-
-#
-# MDEV-12942 REGEXP_INSTR returns 1 when using brackets
-#
-SELECT REGEXP_INSTR('a_kollision', 'oll');
-SELECT REGEXP_INSTR('a_kollision', '(oll)');
-SELECT REGEXP_INSTR('a_kollision', 'o([lm])\\1');
-
-#
-# MDEV-12939 A query crashes MariaDB in Item_func_regex::cleanup
-#
-SELECT a FROM (SELECT "aa" a) t WHERE a REGEXP '[0-9]';
diff --git a/mysql-test/t/func_regexp_pcre_debug.test b/mysql-test/t/func_regexp_pcre_debug.test
deleted file mode 100644
index c2581fa4110..00000000000
--- a/mysql-test/t/func_regexp_pcre_debug.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/have_debug.inc
-
-SET debug_dbug='+d,pcre_exec_error_123';
-SELECT 'a' RLIKE 'a';
-SET debug_dbug='';
-SELECT 'a' RLIKE 'a';
diff --git a/mysql-test/t/func_rollback.test b/mysql-test/t/func_rollback.test
deleted file mode 100644
index 87930909f91..00000000000
--- a/mysql-test/t/func_rollback.test
+++ /dev/null
@@ -1,488 +0,0 @@
-# func_rollback.test
-#
-# Test variations inspired by
-# Bug#12713 Error in a stored function called from a SELECT doesn't cause
-# ROLLBACK of statement
-# Essential of the bug:
-# - A SELECT using a FUNCTION processes a table.
-# - The SELECT affects more than row.
-# - The FUNCTION modifies a table.
-# - When processing the non first matching row, the function fails.
-# But the modification caused by the function when the SELECT processed the
-# first matching row is not reverted.
-#
-# Goal of this test: Attempts to catch a situation where
-# - a statement A involving the execution of one or more functions is run
-# - the function/functions themself contain one or more statements
-# modifying a table
-# - one of the modifying statements within one of the functions fails
-# - the table remains at least partially modified
-#
-# = There is no automatic ROLLBACK of changes caused by the failing
-# statement A.
-# = Statement A is not atomic.
-#
-# Notes:
-# - The table to be modified must use a transactional storage engine.
-# For example MyISAM cannot avoid the situation above.
-# - Some comments assume that the rows of the table t1_select are processed
-# in the order of insertion. That means
-# SELECT f1,f2 FROM t1_select
-# should have the same result set and row order like
-# SELECT f1,f2 FROM t1_select ORDER BY f1;
-# - The manual says that we get in non strict sql mode a warning around INSERT:
-# Inserting NULL into a column that has been declared NOT NULL.
-# For multiple-row INSERT statements or INSERT INTO ... SELECT statements,
-# the column is set to the implicit default value for the column data type.
-#
-# Created:
-# 2008-04-09 mleich
-#
-
-let $fixed_bug_35877 = 0;
-
-let $from_select = SELECT 1 AS f1,1 AS f2 UNION ALL SELECT 1,NULL;
-
---source include/have_innodb.inc
-let $engine = InnoDB;
-
---disable_warnings
-DROP TABLE IF EXISTS t1_select;
-DROP TABLE IF EXISTS t1_aux;
-DROP TABLE IF EXISTS t1_not_null;
-DROP VIEW IF EXISTS v1_not_null;
-DROP VIEW IF EXISTS v1_func;
-DROP TABLE IF EXISTS t1_fail;
-DROP FUNCTION IF EXISTS f1_simple_insert;
-DROP FUNCTION IF EXISTS f1_two_inserts;
-DROP FUNCTION IF EXISTS f1_insert_select;
---enable_warnings
-
-SET SESSION AUTOCOMMIT=0;
-SET SESSION sql_mode = '';
-
-CREATE TABLE t1_select (f1 BIGINT, f2 BIGINT) ENGINE = MEMORY;
-INSERT INTO t1_select(f1,f2) VALUES (1,-1),(2,NULL),(3,0),(4,1),(5,2);
-SELECT * FROM t1_select;
-
---replace_result $engine <transactional_engine>
-eval
-CREATE TABLE t1_not_null (f1 BIGINT, f2 BIGINT NOT NULL)
-ENGINE = $engine;
-SELECT * FROM t1_not_null;
-
---replace_result $engine <transactional_engine>
-eval
-CREATE TABLE t1_aux (f1 BIGINT, f2 BIGINT)
-ENGINE = $engine;
-SELECT * FROM t1_aux;
-COMMIT;
-
-# FUNCTION with "simple" INSERT
-delimiter //;
-CREATE FUNCTION f1_simple_insert(my_f1 INTEGER) RETURNS INTEGER
-BEGIN
- INSERT INTO t1_not_null SET f1 = 10, f2 = my_f1;
- RETURN 1;
-END//
-delimiter ;//
-
---echo
---echo # One f1_simple_insert execution per row, no NOT NULL violation
-SELECT f1_simple_insert(1);
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null;
-#
-SELECT f1_simple_insert(1) FROM t1_select;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null;
-
---echo
---echo # One f1_simple_insert execution per row, NOT NULL violation when the
---echo # SELECT processes the first row.
---error ER_BAD_NULL_ERROR
-SELECT f1_simple_insert(NULL);
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-#
---error ER_BAD_NULL_ERROR
-SELECT f1_simple_insert(NULL) FROM t1_select;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-#
---error ER_BAD_NULL_ERROR
-eval SELECT 1 FROM ($from_select) AS t1 WHERE f1_simple_insert(NULL) = 1;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-
---echo
---echo # One f1_simple_insert execution per row, NOT NULL violation when the
---echo # SELECT processes the non first row
---error ER_BAD_NULL_ERROR
-eval SELECT f1_simple_insert(f2) FROM ($from_select) AS t1;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-#
---error ER_BAD_NULL_ERROR
-SELECT f1_simple_insert(f2) FROM t1_select;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-
---echo
---echo # Two f1_simple_insert executions per row, NOT NULL violation when the
---echo # SELECT processes the first row.
---error ER_BAD_NULL_ERROR
-SELECT f1_simple_insert(1),f1_simple_insert(NULL);
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-#
---error ER_BAD_NULL_ERROR
-SELECT f1_simple_insert(NULL),f1_simple_insert(1);
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-
---echo
---echo # Two f1_simple_insert executions per row, NOT NULL violation when the
---echo # SELECT processes the non first row
---error ER_BAD_NULL_ERROR
-eval SELECT f1_simple_insert(f1),f1_simple_insert(f2) FROM ($from_select) AS t1;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-#
---error ER_BAD_NULL_ERROR
-eval SELECT f1_simple_insert(f2),f1_simple_insert(f1) FROM ($from_select) AS t1;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-#
---error ER_BAD_NULL_ERROR
-SELECT f1_simple_insert(f1),f1_simple_insert(f2) FROM t1_select;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-#
---error ER_BAD_NULL_ERROR
-SELECT f1_simple_insert(f2),f1_simple_insert(f1) FROM t1_select;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-#
---error ER_BAD_NULL_ERROR
-eval SELECT 1 FROM ($from_select) AS t1
-WHERE 1 = f1_simple_insert(f2) AND 1 = f1_simple_insert(f1);
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-
---echo
---echo # Nested functions, the inner fails
---error ER_BAD_NULL_ERROR
-SELECT f1_simple_insert(f1_simple_insert(NULL)) FROM t1_select;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
---echo
---echo # Nested functions, the outer fails
---error ER_BAD_NULL_ERROR
-SELECT f1_simple_insert(f1_simple_insert(1) + NULL) FROM t1_select;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-DROP FUNCTION f1_simple_insert;
-
-# FUNCTION with INSERT ... SELECT
-delimiter //;
-let $f1_insert_select =
-CREATE FUNCTION f1_insert_select(my_f1 INTEGER) RETURNS INTEGER
-BEGIN
- INSERT INTO t1_not_null SELECT * FROM t1_select WHERE f1 = my_f1;
- RETURN 1;
-END//
-delimiter ;//
-eval $f1_insert_select;
-#
---echo
---echo # f1_insert_select(2), tries to INSERT SELECT one row containing NULL
---echo # The fact that
---echo # - SELECT f1_insert_select(2); gives any result set and
---echo # - t1_not_null gets a row inserted
---echo # is covered by the manual.
-# Non strict sqlmode + INSERT SELECT --> NULL adjusted to default
-SELECT f1_insert_select(2);
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-DROP FUNCTION f1_insert_select;
-#
-SET SESSION sql_mode = 'traditional';
-eval $f1_insert_select;
---error ER_BAD_NULL_ERROR
-SELECT f1_insert_select(2);
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-DROP FUNCTION f1_insert_select;
-SET SESSION sql_mode = '';
-
-# FUNCTION with two simple INSERTs
---echo
---echo # Function tries to
---echo # 1. INSERT statement: Insert one row with NULL -> NOT NULL violation
---echo # 2. INSERT statement: Insert one row without NULL
-# I guess the execution of the function becomes aborted just when the
-# error happens.
-delimiter //;
-CREATE FUNCTION f1_two_inserts() RETURNS INTEGER
-BEGIN
- INSERT INTO t1_not_null SET f1 = 10, f2 = NULL;
- INSERT INTO t1_not_null SET f1 = 10, f2 = 10;
- RETURN 1;
-END//
-delimiter ;//
---error ER_BAD_NULL_ERROR
-SELECT f1_two_inserts();
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-DROP FUNCTION f1_two_inserts;
-#
---echo
---echo # Function tries to
---echo # 1. INSERT statement: Insert one row without NULL
---echo # 2. INSERT statement: Insert one row with NULL -> NOT NULL violation
-delimiter //;
-CREATE FUNCTION f1_two_inserts() RETURNS INTEGER
-BEGIN
- INSERT INTO t1_not_null SET f1 = 10, f2 = 10;
- INSERT INTO t1_not_null SET f1 = 10, f2 = NULL;
- RETURN 1;
-END//
-delimiter ;//
---error ER_BAD_NULL_ERROR
-SELECT f1_two_inserts();
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-
---echo
---echo # Function tries to
---echo # INSERT statement: Insert two rows
---echo # first row without NULL
---echo # second row with NULL -> NOT NULL violation
---echo # -> NOT NULL violation
-delimiter //;
-let $f1_insert_with_two_rows =
-CREATE FUNCTION f1_insert_with_two_rows() RETURNS INTEGER
-BEGIN
- INSERT INTO t1_not_null(f1,f2) VALUES (10,10),(10,NULL);
- RETURN 1;
-END//
-delimiter ;//
-eval $f1_insert_with_two_rows;
---echo # The fact that
---echo # - SELECT f1_insert_with_two_rows(); gives any result set and
---echo # - t1_not_null gets a row inserted
---echo # is covered by the manual.
-# Non strict sqlmode + multiple-row INSERT --> NULL adjusted to default
-SELECT f1_insert_with_two_rows();
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-DROP FUNCTION f1_insert_with_two_rows;
-#
-SET SESSION sql_mode = 'traditional';
-eval $f1_insert_with_two_rows;
---error ER_BAD_NULL_ERROR
-SELECT f1_insert_with_two_rows();
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-SET SESSION sql_mode = '';
-
---echo
---echo # FUNCTION in Correlated Subquery
---error ER_BAD_NULL_ERROR
-SELECT 1 FROM t1_select t1
-WHERE 1 = (SELECT f1_insert_with_two_rows() FROM t1_select t2
- WHERE t2.f1 = t1.f1);
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-
---echo
---echo # FUNCTION in JOIN
---error ER_BAD_NULL_ERROR
-SELECT 1 FROM t1_select t1, t1_select t2
-WHERE t1.f1 = t2.f1 AND t2.f1 = f1_insert_with_two_rows();
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-#
---error ER_BAD_NULL_ERROR
-SELECT STRAIGHT_JOIN * FROM t1_select t2 RIGHT JOIN t1_select t1
-ON t1.f1 = t1.f1 WHERE 1 = f1_insert_with_two_rows();
-
-DROP FUNCTION f1_insert_with_two_rows;
-
---echo
---echo # FUNCTION in UNION
---error ER_BAD_NULL_ERROR
-SELECT 1
-UNION ALL
-SELECT f1_two_inserts();
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-
---echo
---echo # FUNCTION in INSERT
---error ER_BAD_NULL_ERROR
-INSERT INTO t1_aux SET f1 = 1, f2 = f1_two_inserts();
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-#
---error ER_BAD_NULL_ERROR
-INSERT INTO t1_aux SELECT 1, f1_two_inserts();
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-SELECT * FROM t1_aux ORDER BY f1,f2;
-#
---error ER_BAD_NULL_ERROR
-INSERT INTO t1_aux VALUES(1,f1_two_inserts());
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-SELECT * FROM t1_aux ORDER BY f1,f2;
-
---echo
---echo # FUNCTION in DELETE
-INSERT INTO t1_aux VALUES (1,1);
-COMMIT;
---error ER_BAD_NULL_ERROR
-DELETE FROM t1_aux WHERE f1 = f1_two_inserts();
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-SELECT * FROM t1_aux ORDER BY f1,f2;
-
---echo
---echo # FUNCTION in UPDATE SET
-# FUNCTION in SET
---error ER_BAD_NULL_ERROR
-UPDATE t1_aux SET f2 = f1_two_inserts() + 1;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-SELECT * FROM t1_aux ORDER BY f1,f2;
-#
-if ($fixed_bug_35877)
-{
---echo
---echo # FUNCTION in UPDATE WHERE
-# Bug#35877 Update .. WHERE with function, constraint violation, crash
-UPDATE t1_aux SET f2 = 2 WHERE f1 = f1_two_inserts();
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-SELECT * FROM t1_aux ORDER BY f1,f2;
-}
-
---echo
---echo # FUNCTION in VIEW definition
-CREATE VIEW v1_func AS SELECT f1_two_inserts() FROM t1_select;
---error ER_BAD_NULL_ERROR
-SELECT * FROM v1_func;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-DROP VIEW v1_func;
-
---echo
---echo # FUNCTION in CREATE TABLE ... AS SELECT
---error ER_BAD_NULL_ERROR
-CREATE TABLE t1_fail AS SELECT f1_two_inserts() FROM t1_select;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-#
---error ER_BAD_NULL_ERROR
-CREATE TABLE t1_fail AS SELECT * FROM t1_select WHERE 1 = f1_two_inserts();
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-#
-
---echo
---echo # FUNCTION in ORDER BY
---error ER_BAD_NULL_ERROR
-SELECT * FROM t1_select ORDER BY f1,f1_two_inserts();
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-
---echo
---echo # FUNCTION in aggregate function
---error ER_BAD_NULL_ERROR
-SELECT AVG(f1_two_inserts()) FROM t1_select;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-
---echo
---echo # FUNCTION in HAVING
---error ER_BAD_NULL_ERROR
-SELECT 1 FROM t1_select HAVING AVG(f1) = f1_two_inserts() + 2;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-DROP FUNCTION f1_two_inserts;
-
---echo
---echo # FUNCTION modifies Updatable VIEW
-CREATE VIEW v1_not_null AS SELECT f1,f2 FROM t1_not_null WITH CHECK OPTION;
-delimiter //;
-CREATE FUNCTION f1_two_inserts_v1() RETURNS INTEGER
-BEGIN
- INSERT INTO v1_not_null SET f1 = 10, f2 = 10;
- INSERT INTO v1_not_null SET f1 = 10, f2 = NULL;
- RETURN 1;
-END//
-delimiter ;//
---error ER_BAD_NULL_ERROR
-SELECT f1_two_inserts_v1();
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-ROLLBACK;
-SELECT * FROM t1_not_null ORDER BY f1,f2;
-DROP FUNCTION f1_two_inserts_v1;
-DROP VIEW v1_not_null;
-
---echo
---echo # FUNCTION causes FOREIGN KEY constraint violation
-eval
-CREATE TABLE t1_parent (f1 BIGINT, f2 BIGINT, PRIMARY KEY(f1))
-ENGINE = $engine;
-INSERT INTO t1_parent VALUES (1,1);
-eval
-CREATE TABLE t1_child (f1 BIGINT, f2 BIGINT, PRIMARY KEY(f1),
-FOREIGN KEY (f1) REFERENCES t1_parent(f1))
-ENGINE = $engine;
---error ER_NO_REFERENCED_ROW_2
-delimiter //;
-CREATE FUNCTION f1_two_inserts() RETURNS INTEGER
-BEGIN
- INSERT INTO t1_child SET f1 = 1, f2 = 1;
- INSERT INTO t1_child SET f1 = 2, f2 = 2;
- RETURN 1;
-END//
-delimiter ;//
---error ER_NO_REFERENCED_ROW_2
-SELECT f1_two_inserts();
-SELECT * FROM t1_child;
-DROP TABLE t1_child;
-DROP TABLE t1_parent;
-DROP FUNCTION f1_two_inserts;
-
-# Cleanup
-DROP TABLE t1_select;
-DROP TABLE t1_aux;
-DROP TABLE t1_not_null;
diff --git a/mysql-test/t/func_sapdb.test b/mysql-test/t/func_sapdb.test
deleted file mode 100644
index 51bdebbec6d..00000000000
--- a/mysql-test/t/func_sapdb.test
+++ /dev/null
@@ -1,194 +0,0 @@
---disable_warnings
-drop table if exists t1, test;
---enable_warnings
-
-
-#
-# time functions
-#
-select extract(DAY_MICROSECOND FROM "1999-01-02 10:11:12.000123");
-select extract(HOUR_MICROSECOND FROM "1999-01-02 10:11:12.000123");
-select extract(MINUTE_MICROSECOND FROM "1999-01-02 10:11:12.000123");
-select extract(SECOND_MICROSECOND FROM "1999-01-02 10:11:12.000123");
-select extract(MICROSECOND FROM "1999-01-02 10:11:12.000123");
-select date_format("1997-12-31 23:59:59.000002", "%f");
-
-select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000 99:99:99.999999" DAY_MICROSECOND);
-select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99:99.999999" HOUR_MICROSECOND);
-select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000:99.999999" MINUTE_MICROSECOND);
-select date_add("1997-12-31 23:59:59.000002",INTERVAL "10000.999999" SECOND_MICROSECOND);
-select date_add("1997-12-31 23:59:59.000002",INTERVAL "999999" MICROSECOND);
-
-select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1 1:1:1.000002" DAY_MICROSECOND);
-select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1:1.000002" HOUR_MICROSECOND);
-select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1:1.000002" MINUTE_MICROSECOND);
-select date_sub("1998-01-01 00:00:00.000001",INTERVAL "1.000002" SECOND_MICROSECOND);
-select date_sub("1998-01-01 00:00:00.000001",INTERVAL "000002" MICROSECOND);
-
-#Date functions
-select adddate("1997-12-31 23:59:59.000001", 10);
-select subdate("1997-12-31 23:59:59.000001", 10);
-
-select datediff("1997-12-31 23:59:59.000001","1997-12-30");
-select datediff("1997-11-30 23:59:59.000001","1997-12-31");
-SET @@SQL_MODE="ALLOW_INVALID_DATES";
-select datediff("1997-11-31 23:59:59.000001","1997-12-31");
-SET @@SQL_MODE="";
-
-# This will give a warning
-select datediff("1997-11-31 23:59:59.000001","1997-12-31");
-select datediff("1997-11-30 23:59:59.000001",null);
-
-select weekofyear("1997-11-30 23:59:59.000001");
-
-select makedate(03,1);
-select makedate('0003',1);
-select makedate(1997,1);
-select makedate(1997,0);
-select makedate(9999,365);
-select makedate(9999,366);
-select makedate(100,1);
-
-#Time functions
-
-select addtime("1997-12-31 23:59:59.999999", "1 1:1:1.000002");
-select subtime("1997-12-31 23:59:59.000001", "1 1:1:1.000002");
-select addtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999");
-select subtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999");
-select subtime("01:00:00.999999", "02:00:00.999998");
-select subtime("02:01:01.999999", "01:01:01.999999");
-
-# PS doesn't support fractional seconds
---disable_ps_protocol
-select timediff("1997-01-01 23:59:59.000001","1995-12-31 23:59:59.000002");
-select timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002");
-select timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002");
-select timediff("1997-12-31 23:59:59.000001","23:59:59.000001");
-select timediff("2000:01:01 00:00:00", "2000:01:01 00:00:00.000001");
-select timediff("2005-01-11 15:48:49.999999", "2005-01-11 15:48:50");
---enable_ps_protocol
-
-select maketime(10,11,12);
-select maketime(25,11,12);
-select maketime(-25,11,12);
-
-# Extraction functions
-
-# PS doesn't support fractional seconds
---disable_ps_protocol
-select timestamp("2001-12-01", "01:01:01.999999");
-select timestamp("2001-13-01", "01:01:01.000001");
-select timestamp("2001-12-01", "25:01:01");
-select timestamp("2001-12-01 01:01:01.000100");
-select timestamp("2001-12-01");
-select day("1997-12-31 23:59:59.000001");
-select date("1997-12-31 23:59:59.000001");
-select date("1997-13-31 23:59:59.000001");
-select time("1997-12-31 23:59:59.000001");
-select time("1997-12-31 25:59:59.000001");
-select microsecond("1997-12-31 23:59:59.000001");
---enable_ps_protocol
-
-create table t1
-select makedate(1997,1) as f1,
- addtime(cast("1997-12-31 23:59:59.000001" as datetime(6)), "1 1:1:1.000002") as f2,
- addtime(cast("23:59:59.999999" as time(6)) , "1 1:1:1.000002") as f3,
- timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002") as f4,
- timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002") as f5,
- maketime(10,11,12) as f6,
- timestamp(cast("2001-12-01" as date), "01:01:01") as f7,
- date("1997-12-31 23:59:59.000001") as f8,
- time("1997-12-31 23:59:59.000001") as f9;
-describe t1;
-# PS doesn't support fractional seconds
---disable_ps_protocol
-select * from t1;
---enable_ps_protocol
-
-create table test(t1 datetime, t2 time, t3 time, t4 datetime);
-insert into test values
-('2001-01-01 01:01:01', '01:01:01', null, '2001-02-01 01:01:01'),
-('2001-01-01 01:01:01', '-01:01:01', '-23:59:59', "1997-12-31 23:59:59.000001"),
-('1997-12-31 23:59:59.000001', '-23:59:59', '-01:01:01', '2001-01-01 01:01:01'),
-('2001-01-01 01:01:01', '01:01:01', '-1 01:01:01', null),
-('2001-01-01 01:01:01', '-01:01:01', '1 01:01:01', '2001-01-01 01:01:01'),
-('2001-01-01 01:01:01', null, '-1 01:01:01', null),
-(null, null, null, null),
-('2001-01-01 01:01:01', '01:01:01', '1 01:01:01', '2001-01-01 01:01:01');
-
-SELECT ADDTIME(t1,t2) As ttt, ADDTIME(t2, t3) As qqq from test;
-# PS doesn't support fractional seconds
---disable_ps_protocol
-SELECT TIMEDIFF(t1, t4) As ttt, TIMEDIFF(t2, t3) As qqq,
- TIMEDIFF(t3, t2) As eee, TIMEDIFF(t2, t4) As rrr from test;
---enable_ps_protocol
-
-drop table t1, test;
-
-select addtime("-01:01:01.01", "-23:59:59.1") as a;
-select microsecond("1997-12-31 23:59:59.01") as a;
-select microsecond(19971231235959.01) as a;
-select date_add("1997-12-31",INTERVAL "10.09" SECOND_MICROSECOND) as a;
-# PS doesn't support fractional seconds
---disable_ps_protocol
-select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%S.%f");
---enable_ps_protocol
-
-# End of 4.1 tests
-
-
-
-#
-# Bug#37553: MySql Error Compare TimeDiff & Time
-#
-
-# calculations involving negative time values ignored sign
-select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10'),time('00:00:00');
-select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')>time('00:00:00');
-select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')<time('00:00:00');
-
-# show that conversion to DECIMAL no longer drops sign
-SELECT CAST(time('-73:42:12') AS DECIMAL);
-
-
-
-#
-# Bug#42525 - TIMEDIFF function
-#
-
-SELECT TIMEDIFF(TIME('17:00:00'),TIME('17:00:00'))=TIME('00:00:00') AS 1Eq,
- TIMEDIFF(TIME('17:59:00'),TIME('17:00:00'))=TIME('00:00:00') AS 1NEq1,
- TIMEDIFF(TIME('18:00:00'),TIME('17:00:00'))=TIME('00:00:00') AS 1NEq2,
- TIMEDIFF(TIME('17:00:00'),TIME('17:00:00'))= '00:00:00' AS 2Eq,
- TIMEDIFF(TIME('17:59:00'),TIME('17:00:00'))= '00:00:00' AS 2NEq1,
- TIMEDIFF(TIME('18:00:00'),TIME('17:00:00'))= '00:00:00' AS 2NEq2,
- TIMEDIFF(TIME('17:00:00'),TIME('17:00:00'))=TIME(0) AS 3Eq,
- TIMEDIFF(TIME('17:59:00'),TIME('17:00:00'))=TIME(0) AS 3NEq1,
- TIMEDIFF(TIME('18:00:00'),TIME('17:00:00'))=TIME(0) AS 3NEq2,
- TIME(0) AS Time0, TIME('00:00:00') AS Time00, '00:00:00' AS Literal0000,
- TIMEDIFF(TIME('17:59:00'),TIME('17:00:00')),
- TIMEDIFF(TIME('17:00:00'),TIME('17:59:00'));
-
-#
-# Bug#42661 - sec_to_time() and signedness
-#
-
-SELECT sec_to_time(3020399)=TIME('838:59:59');
-SELECT sec_to_time(-3020399)=TIME('-838:59:59');
-SELECT sec_to_time(-3020399)='-838:59:59';
-SELECT time(sec_to_time(-3020399))=TIME('-838:59:59');
-SELECT time(sec_to_time(-3020399))=TIME('-838:59:58');
-
-#
-# Bug#42662 - maketime() and signedness
-#
-
-# TIME(...) and CAST(... AS TIME) go through the same code-path here,
-# but we'll explicitly show show that both work in case the ever changes.
-SELECT maketime(-1,0,1)='-01:00:01';
-SELECT TIME(maketime(-1,0,1))=CAST('-01:00:01' AS TIME);
-SELECT maketime(-1,0,1)=CAST('-01:00:01' AS TIME);
-SELECT maketime(1,0,1)=CAST('01:00:01' AS TIME);
-SELECT maketime(1,0,1)=CAST('01:00:02' AS TIME);
-
-# End of 5.0 tests
diff --git a/mysql-test/t/func_set.test b/mysql-test/t/func_set.test
deleted file mode 100644
index 3509e225a34..00000000000
--- a/mysql-test/t/func_set.test
+++ /dev/null
@@ -1,149 +0,0 @@
-#
-# Testing if SET and similar functions
-#
-
-select interval(55,10,20,30,40,50,60,70,80,90,100),interval(3,1,1+1,1+1+1+1),field("IBM","NCA","ICL","SUN","IBM","DIGITAL"),field("A","B","C"),elt(2,"ONE","TWO","THREE"),interval(0,1,2,3,4),elt(1,1,2,3)|0,elt(1,1.1,1.2,1.3)+0;
-explain extended select INTERVAL(55,10,20,30,40,50,60,70,80,90,100),interval(3,1,1+1,1+1+1+1),field("IBM","NCA","ICL","SUN","IBM","DIGITAL"),field("A","B","C"),elt(2,"ONE","TWO","THREE"),interval(0,1,2,3,4),elt(1,1,2,3)|0,elt(1,1.1,1.2,1.3)+0;
-# Test 8 and 9 values (Bug #1561)
-SELECT INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56);
-SELECT INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56, 77);
-
-select find_in_set("b","a,b,c"),find_in_set("c","a,b,c"),find_in_set("dd","a,bbb,dd"),find_in_set("bbb","a,bbb,dd");
-select find_in_set("d","a,b,c"),find_in_set("dd","a,bbb,d"),find_in_set("bb","a,bbb,dd");
-select make_set(0,'a','b','c'),make_set(-1,'a','b','c'),make_set(1,'a','b','c'),make_set(2,'a','b','c'),make_set(1+2,concat('a','b'),'c');
-select make_set(NULL,'a','b','c'),make_set(1|4,'a',NULL,'c'),make_set(1+2,'a',NULL,'c');
-select export_set(9,"Y","N","-",5),export_set(9,"Y","N"),export_set(9,"Y","N","");
-
-#
-# Wrong usage of functions
-#
-select elt(2,1),field(NULL,"a","b","c");
-select field("b","a",NULL),field(1,0,NULL)+0,field(1.0,0.0,NULL)+0.0,field(1.0e1,0.0e1,NULL)+0.0e1;
-select field(NULL,"a",NULL),field(NULL,0,NULL)+0,field(NULL,0.0,NULL)+0.0,field(NULL,0.0e1,NULL)+0.0e1;
-select find_in_set("","a,b,c"),find_in_set("","a,b,c,"),find_in_set("",",a,b,c");
-select find_in_set("abc","abc"),find_in_set("ab","abc"),find_in_set("abcd","abc");
-select interval(null, 1, 10, 100);
-
-#
-# test for a bug with elt()
-#
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-create table t1 (id int(10) not null unique);
-create table t2 (id int(10) not null primary key, val int(10) not null);
-insert into t1 values (1),(2),(4);
-insert into t2 values (1,1),(2,1),(3,1),(4,2);
-
-select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id;
-select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id;
-drop table t1,t2;
-
-#
-# Bug4340: find_in_set is case insensitive even on binary operators
-#
-
-select find_in_set(binary 'a',binary 'A,B,C');
-select find_in_set('a',binary 'A,B,C');
-select find_in_set(binary 'a', 'A,B,C');
-
-#
-# Bug5513:FIND_IN_SET fails if set ends with a comma
-#
-select find_in_set('1','3,1,');
-
---echo End of 4.1 tests
-
-#
-# Bug #32560: crash with interval function and count(*)
-#
-SELECT INTERVAL(0.0, NULL);
-SELECT INTERVAL(0.0, CAST(NULL AS DECIMAL));
-SELECT INTERVAL(0.0, CAST(DATE(NULL) AS DECIMAL));
-SELECT INTERVAL(0.0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
-SELECT INTERVAL(0.0, CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL),
- CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL),
- CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL), CAST(NULL AS DECIMAL));
-SELECT INTERVAL(0.0, CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
- CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
- CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL),
- CAST(DATE(NULL) AS DECIMAL), CAST(DATE(NULL) AS DECIMAL));
-
---echo End of 5.0 tests
-
-#
-# Bug#44367 valgrind warnings with find_in_set() functions
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (f1 set('test1','test2','test3') character set utf8 default null)
-engine=myisam default charset=latin1;
-insert into t1 values (''),(null),(null),(''),(''),('');
-select find_in_set(f1,f1) as a from t1,(select find_in_set(f1,f1) as b from t1) a;
-drop table t1;
-#
-# Bug#45168: assertion with convert() and empty set value
-#
-CREATE TABLE t1( a SET('a', 'b', 'c') );
-CREATE TABLE t2( a SET('a', 'b', 'c') );
-
-INSERT IGNORE INTO t1 VALUES ('d');
-INSERT INTO t2 VALUES ('');
-
-SELECT CONVERT( a USING latin1 ) FROM t1;
-SELECT CONVERT( a USING latin1 ) FROM t2;
-
-DROP TABLE t1, t2;
-
---echo #
---echo # Start of 5.3 tests
---echo #
-
---echo #
---echo # MDEV-4512 Valgrind warnings in my_long10_to_str_8bit on INTERVAL and DATE_ADD with incorrect types
---echo #
-CREATE TABLE t1 (pk INT PRIMARY KEY);
-INSERT INTO t1 VALUES (10),(11);
-SELECT INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 ) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # End of 5.3 tests
---echo #
-
-
---echo #
---echo # BUG#59405: FIND_IN_SET won't work normaly after upgrade from 5.1 to 5.5
---echo #
-
-CREATE TABLE t1(days set('1','2','3','4','5','6','7'));
-INSERT INTO t1 VALUES('1,2,3,4,5,6,7'), (NULL), ('1,2,3,4,5,6,7');
-
---echo
-SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), days);
-SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), days) IS UNKNOWN;
-SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), NULL);
-SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), NULL) IS UNKNOWN;
-SELECT * FROM t1 WHERE FIND_IN_SET(7, days);
-SELECT * FROM t1 WHERE FIND_IN_SET(8, days);
-SELECT * FROM t1 WHERE FIND_IN_SET(NULL, days);
-SELECT * FROM t1 WHERE FIND_IN_SET(NULL, days) IS UNKNOWN;
-SELECT * FROM t1 WHERE FIND_IN_SET(NULL, NULL);
-SELECT * FROM t1 WHERE FIND_IN_SET(NULL, NULL) IS UNKNOWN;
-
---echo
-DROP TABLE t1;
-
---echo #
---echo # MDEV-14596 Crash in INTERVAL(ROW(..),ROW(..))
---echo #
-
---error ER_OPERAND_COLUMNS
-SELECT INTERVAL(ROW(1,1),ROW(1,2));
---error ER_OPERAND_COLUMNS
-SELECT INTERVAL(1,ROW(1,2));
---error ER_OPERAND_COLUMNS
-SELECT INTERVAL(ROW(1,2),1);
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
deleted file mode 100644
index dbb7502a3ec..00000000000
--- a/mysql-test/t/func_str.test
+++ /dev/null
@@ -1,1918 +0,0 @@
-# Description
-# -----------
-# Testing string functions
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-set global max_allowed_packet=1048576;
-connect (conn1,localhost,root,,);
-connection conn1;
-
-let $mysqld_datadir= `select @@datadir`;
-
-set names latin1;
-
-select 'hello',"'hello'",'""hello""','''h''e''l''l''o''',"hel""lo",'hel\'lo';
-select 'hello' 'monty';
-select length('\n\t\r\b\0\_\%\\');
-select bit_length('\n\t\r\b\0\_\%\\');
-select char_length('\n\t\r\b\0\_\%\\');
-select length(_latin1'\n\t\n\b\0\\_\\%\\');
-select concat('monty',' was here ','again'),length('hello'),char(ascii('h')),ord('h');
-select hex(char(256));
-select locate('he','hello'),locate('he','hello',2),locate('lo','hello',2) ;
-select instr('hello','HE'), instr('hello',binary 'HE'), instr(binary 'hello','HE');
-select position(binary 'll' in 'hello'),position('a' in binary 'hello');
-#
-# Bug#11728 string function LEFT,
-# strange undocumented behaviour, strict mode
-#
-select left('hello',null), right('hello',null);
-select left('hello',2),right('hello',2),substring('hello',2,2),mid('hello',1,5) ;
-select concat('',left(right(concat('what ',concat('is ','happening')),9),4),'',substring('monty',5,1)) ;
-select substring_index('www.tcx.se','.',-2),substring_index('www.tcx.se','.',1);
-select substring_index('www.tcx.se','tcx',1),substring_index('www.tcx.se','tcx',-1);
-select substring_index('.tcx.se','.',-2),substring_index('.tcx.se','.tcx',-1);
-select substring_index('aaaaaaaaa1','a',1);
-select substring_index('aaaaaaaaa1','aa',1);
-select substring_index('aaaaaaaaa1','aa',2);
-select substring_index('aaaaaaaaa1','aa',3);
-select substring_index('aaaaaaaaa1','aa',4);
-select substring_index('aaaaaaaaa1','aa',5);
-select substring_index('aaaaaaaaa1','aaa',1);
-select substring_index('aaaaaaaaa1','aaa',2);
-select substring_index('aaaaaaaaa1','aaa',3);
-select substring_index('aaaaaaaaa1','aaa',4);
-select substring_index('aaaaaaaaa1','aaaa',1);
-select substring_index('aaaaaaaaa1','aaaa',2);
-select substring_index('aaaaaaaaa1','1',1);
-select substring_index('aaaaaaaaa1','a',-1);
-select substring_index('aaaaaaaaa1','aa',-1);
-select substring_index('aaaaaaaaa1','aa',-2);
-select substring_index('aaaaaaaaa1','aa',-3);
-select substring_index('aaaaaaaaa1','aa',-4);
-select substring_index('aaaaaaaaa1','aa',-5);
-select substring_index('aaaaaaaaa1','aaa',-1);
-select substring_index('aaaaaaaaa1','aaa',-2);
-select substring_index('aaaaaaaaa1','aaa',-3);
-select substring_index('aaaaaaaaa1','aaa',-4);
-select substring_index('the king of thethe hill','the',-2);
-select substring_index('the king of the the hill','the',-2);
-select substring_index('the king of the the hill','the',-2);
-select substring_index('the king of the the hill',' the ',-1);
-select substring_index('the king of the the hill',' the ',-2);
-select substring_index('the king of the the hill',' ',-1);
-select substring_index('the king of the the hill',' ',-2);
-select substring_index('the king of the the hill',' ',-3);
-select substring_index('the king of the the hill',' ',-4);
-select substring_index('the king of the the hill',' ',-5);
-select substring_index('the king of the.the hill','the',-2);
-select substring_index('the king of thethethe.the hill','the',-3);
-select substring_index('the king of thethethe.the hill','the',-1);
-select substring_index('the king of the the hill','the',1);
-select substring_index('the king of the the hill','the',2);
-select substring_index('the king of the the hill','the',3);
-
-select concat(':',ltrim(' left '),':',rtrim(' right '),':');
-select concat(':',trim(leading from ' left '),':',trim(trailing from ' right '),':');
-select concat(':',trim(LEADING FROM ' left'),':',trim(TRAILING FROM ' right '),':');
-select concat(':',trim(' m '),':',trim(BOTH FROM ' y '),':',trim('*' FROM '*s*'),':');
-select concat(':',trim(BOTH 'ab' FROM 'ababmyabab'),':',trim(BOTH '*' FROM '***sql'),':');
-select concat(':',trim(LEADING '.*' FROM '.*my'),':',trim(TRAILING '.*' FROM 'sql.*.*'),':');
-select TRIM("foo" FROM "foo"), TRIM("foo" FROM "foook"), TRIM("foo" FROM "okfoo");
-
-select concat_ws(', ','monty','was here','again');
-select concat_ws(NULL,'a'),concat_ws(',',NULL,'');
-select concat_ws(',','',NULL,'a');
-SELECT CONCAT('"',CONCAT_WS('";"',repeat('a',60),repeat('b',60),repeat('c',60),repeat('d',100)), '"');
-
-select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
-select replace('aaaa','a','b'),replace('aaaa','aa','b'),replace('aaaa','a','bb'),replace('aaaa','','b'),replace('bbbb','a','c');
-select replace(concat(lcase(concat('THIS',' ','IS',' ','A',' ')),ucase('false'),' ','test'),'FALSE','REAL') ;
-select soundex(''),soundex('he'),soundex('hello all folks'),soundex('#3556 in bugdb');
-select 'mood' sounds like 'mud';
-select 'Glazgo' sounds like 'Liverpool';
-select null sounds like 'null';
-select 'null' sounds like null;
-select null sounds like null;
-select md5('hello');
-select crc32("123");
-select sha('abc');
-select sha1('abc');
-select aes_decrypt(aes_encrypt('abc','1'),'1');
-select aes_decrypt(aes_encrypt('abc','1'),1);
-select aes_encrypt(NULL,"a");
-select aes_encrypt("a",NULL);
-select aes_decrypt(NULL,"a");
-select aes_decrypt("a",NULL);
-select aes_decrypt("a","a");
-select aes_decrypt(aes_encrypt("","a"),"a");
-select aes_decrypt("", "a");
-select repeat('monty',5),concat('*',space(5),'*');
-select reverse('abc'),reverse('abcd');
-select rpad('a',4,'1'),rpad('a',4,'12'),rpad('abcd',3,'12'), rpad(11, 10 , 22), rpad("ab", 10, 22);
-select lpad('a',4,'1'),lpad('a',4,'12'),lpad('abcd',3,'12'), lpad(11, 10 , 22);
-select rpad(741653838,17,'0'),lpad(741653838,17,'0');
-select rpad('abcd',7,'ab'),lpad('abcd',7,'ab');
-select rpad('abcd',1,'ab'),lpad('abcd',1,'ab');
-select rpad('STRING', 20, CONCAT('p','a','d') );
-select lpad('STRING', 20, CONCAT('p','a','d') );
-select rpad('abcd',7),lpad('abcd',7);
-
-select LEAST(NULL,'HARRY','HARRIOT',NULL,'HAROLD'),GREATEST(NULL,'HARRY','HARRIOT',NULL,'HAROLD');
-select least(1,2,3) | greatest(16,32,8), least(5,4)*1,greatest(-1.0,1.0)*1,least(3,2,1)*1.0,greatest(1,1.1,1.0),least("10",9),greatest("A","B","0");
-
-select decode(encode(repeat("a",100000),"monty"),"monty")=repeat("a",100000);
-select decode(encode("abcdef","monty"),"monty")="abcdef";
-
-select quote('\'\"\\test');
-select quote(concat('abc\'', '\\cba'));
-select quote(1/0), quote('\0\Z');
-select length(quote(concat(char(0),"test")));
-select hex(quote(concat(char(224),char(227),char(230),char(231),char(232),char(234),char(235))));
-select unhex(hex("foobar")), hex(unhex("1234567890ABCDEF")), unhex("345678"), unhex(NULL);
-select hex(unhex("1")), hex(unhex("12")), hex(unhex("123")), hex(unhex("1234")), hex(unhex("12345")), hex(unhex("123456"));
-select length(unhex(md5("abrakadabra")));
-
-#
-# Bug #6564: QUOTE(NULL
-#
-
-select concat('a', quote(NULL));
-
-#
-# Wrong usage of functions
-#
-
-select reverse("");
-select insert("aa",100,1,"b"),insert("aa",1,3,"b"),left("aa",-1),substring("a",1,2);
-select elt(2,1),field(NULL,"a","b","c"),reverse("");
-select locate("a","b",2),locate("","a",1);
-select ltrim("a"),rtrim("a"),trim(BOTH "" from "a"),trim(BOTH " " from "a");
-select concat("1","2")|0,concat("1",".5")+0.0;
-select substring_index("www.tcx.se","",3);
-select length(repeat("a",100000000)),length(repeat("a",1000*64));
-select position("0" in "baaa" in (1)),position("0" in "1" in (1,2,3)),position("sql" in ("mysql"));
-select position(("1" in (1,2,3)) in "01");
-select length(repeat("a",65500)),length(concat(repeat("a",32000),repeat("a",32000))),length(replace("aaaaa","a",concat(repeat("a",10000)))),length(insert(repeat("a",40000),1,30000,repeat("b",50000)));
-select length(repeat("a",1000000)),length(concat(repeat("a",32000),repeat("a",32000),repeat("a",32000))),length(replace("aaaaa","a",concat(repeat("a",32000)))),length(insert(repeat("a",48000),1,1000,repeat("a",48000)));
-
-#
-# Problem med concat
-#
-
-create table t1 ( domain char(50) );
-insert into t1 VALUES ("hello.de" ), ("test.de" );
-select domain from t1 where concat('@', trim(leading '.' from concat('.', domain))) = '@hello.de';
-select domain from t1 where concat('@', trim(leading '.' from concat('.', domain))) = '@test.de';
-drop table t1;
-
-#
-# Test bug in concat_ws
-#
-
-CREATE TABLE t1 (
- id int(10) unsigned NOT NULL,
- title varchar(255) default NULL,
- prio int(10) unsigned default NULL,
- category int(10) unsigned default NULL,
- program int(10) unsigned default NULL,
- bugdesc text,
- created datetime default NULL,
- modified timestamp NOT NULL,
- bugstatus int(10) unsigned default NULL,
- submitter int(10) unsigned default NULL
-) ENGINE=MyISAM;
-
-INSERT INTO t1 VALUES (1,'Link',1,1,1,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa','2001-02-28 08:40:16',20010228084016,0,4);
-SELECT CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter), '"') FROM t1;
-SELECT CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugstatus,submitter), '"') FROM t1;
-SELECT CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter) FROM t1;
-SELECT bugdesc, REPLACE(bugdesc, 'xxxxxxxxxxxxxxxxxxxx', 'bbbbbbbbbbbbbbbbbbbb') from t1 group by bugdesc;
-drop table t1;
-
-#
-# Test bug in AES_DECRYPT() when called with wrong argument
-#
-
-CREATE TABLE t1 (id int(11) NOT NULL auto_increment, tmp text NOT NULL, KEY id (id)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1, 'a545f661efdd1fb66fdee3aab79945bf');
-SELECT 1 FROM t1 WHERE tmp=AES_DECRYPT(tmp,"password");
-DROP TABLE t1;
-
-CREATE TABLE t1 (
- wid int(10) unsigned NOT NULL auto_increment,
- data_podp date default NULL,
- status_wnio enum('nowy','podp','real','arch') NOT NULL default 'nowy',
- PRIMARY KEY(wid)
-);
-
-INSERT INTO t1 VALUES (8,NULL,'real');
-INSERT INTO t1 VALUES (9,NULL,'nowy');
-SELECT elt(status_wnio,data_podp) FROM t1 GROUP BY wid;
-DROP TABLE t1;
-
-#
-# test for #739
-
-CREATE TABLE t1 (title text) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('Congress reconvenes in September to debate welfare and adult education');
-INSERT INTO t1 VALUES ('House passes the CAREERS bill');
-SELECT CONCAT("</a>",RPAD("",(55 - LENGTH(title)),".")) from t1;
-DROP TABLE t1;
-
-#
-# test for Bug #2290 "output truncated with ELT when using DISTINCT"
-#
-
-CREATE TABLE t1 (i int, j int);
-INSERT INTO t1 VALUES (1,1),(2,2);
-SELECT DISTINCT i, ELT(j, '345', '34') FROM t1;
-DROP TABLE t1;
-
-#
-# bug #3756: quote and NULL
-#
-
-create table t1(a char(4));
-insert into t1 values ('one'),(NULL),('two'),('four');
-select a, quote(a), isnull(quote(a)), quote(a) is null, ifnull(quote(a), 'n') from t1;
-drop table t1;
-
-#
-# Bug #5498: TRIM fails with LEADING or TRAILING if remstr = str
-#
-
-select trim(trailing 'foo' from 'foo');
-select trim(leading 'foo' from 'foo');
-
-#
-# crashing bug with QUOTE() and LTRIM() or TRIM() fixed
-# Bug #7495
-#
-
-select quote(ltrim(concat(' ', 'a')));
-select quote(trim(concat(' ', 'a')));
-
-# Bad results from QUOTE(). Bug #8248
-CREATE TABLE t1 SELECT 1 UNION SELECT 2 UNION SELECT 3;
-SELECT QUOTE('A') FROM t1;
-DROP TABLE t1;
-
-# Test collation and coercibility
-#
-
-select 1=_latin1'1';
-select _latin1'1'=1;
-select _latin2'1'=1;
-select 1=_latin2'1';
---error 1267
-select _latin1'1'=_latin2'1';
-select row('a','b','c') = row('a','b','c');
-select row('A','b','c') = row('a','b','c');
-select row('A' COLLATE latin1_bin,'b','c') = row('a','b','c');
-select row('A','b','c') = row('a' COLLATE latin1_bin,'b','c');
---error 1267
-select row('A' COLLATE latin1_general_ci,'b','c') = row('a' COLLATE latin1_bin,'b','c');
-
---error 1267
-select concat(_latin1'a',_latin2'a');
---error 1270
-select concat(_latin1'a',_latin2'a',_latin5'a');
---error 1271
-select concat(_latin1'a',_latin2'a',_latin5'a',_latin7'a');
---error 1267
-select concat_ws(_latin1'a',_latin2'a');
-
-#
-# Test FIELD() and collations
-#
-select FIELD('b','A','B');
-select FIELD('B','A','B');
-select FIELD('b' COLLATE latin1_bin,'A','B');
-select FIELD('b','A' COLLATE latin1_bin,'B');
---error 1270
-select FIELD(_latin2'b','A','B');
---error 1270
-select FIELD('b',_latin2'A','B');
-select FIELD('1',_latin2'3','2',1);
-
-select POSITION(_latin1'B' IN _latin1'abcd');
-select POSITION(_latin1'B' IN _latin1'abcd' COLLATE latin1_bin);
-select POSITION(_latin1'B' COLLATE latin1_bin IN _latin1'abcd');
---error 1267
-select POSITION(_latin1'B' COLLATE latin1_general_ci IN _latin1'abcd' COLLATE latin1_bin);
---error 1267
-select POSITION(_latin1'B' IN _latin2'abcd');
-
-select FIND_IN_SET(_latin1'B',_latin1'a,b,c,d');
-
-# fix this:
---disable_parsing
-select FIND_IN_SET(_latin1'B',_latin1'a,b,c,d' COLLATE latin1_bin);
-select FIND_IN_SET(_latin1'B' COLLATE latin1_bin,_latin1'a,b,c,d');
---enable_parsing
-
---error 1267
-select FIND_IN_SET(_latin1'B' COLLATE latin1_general_ci,_latin1'a,b,c,d' COLLATE latin1_bin);
---error 1267
-select FIND_IN_SET(_latin1'B',_latin2'a,b,c,d');
-
-select SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin1'd',2);
-
-# fix this:
---disable_parsing
-select SUBSTRING_INDEX(_latin1'abcdabcdabcd' COLLATE latin1_bin,_latin1'd',2);
-select SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin1'd' COLLATE latin1_bin,2);
---enable_parsing
-
---error 1267
-select SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin2'd',2);
---error 1267
-select SUBSTRING_INDEX(_latin1'abcdabcdabcd' COLLATE latin1_general_ci,_latin1'd' COLLATE latin1_bin,2);
-
-select _latin1'B' between _latin1'a' and _latin1'c';
-select _latin1'B' collate latin1_bin between _latin1'a' and _latin1'c';
-select _latin1'B' between _latin1'a' collate latin1_bin and _latin1'c';
-select _latin1'B' between _latin1'a' and _latin1'c' collate latin1_bin;
---error 1270
-select _latin2'B' between _latin1'a' and _latin1'b';
---error 1270
-select _latin1'B' between _latin2'a' and _latin1'b';
---error 1270
-select _latin1'B' between _latin1'a' and _latin2'b';
---error 1270
-select _latin1'B' collate latin1_general_ci between _latin1'a' collate latin1_bin and _latin1'b';
-
-select _latin1'B' in (_latin1'a',_latin1'b');
-select _latin1'B' collate latin1_bin in (_latin1'a',_latin1'b');
-select _latin1'B' in (_latin1'a' collate latin1_bin,_latin1'b');
-select _latin1'B' in (_latin1'a',_latin1'b' collate latin1_bin);
---error 1270
-select _latin2'B' in (_latin1'a',_latin1'b');
---error 1270
-select _latin1'B' in (_latin2'a',_latin1'b');
---error 1270
-select _latin1'B' in (_latin1'a',_latin2'b');
---error 1270
-select _latin1'B' COLLATE latin1_general_ci in (_latin1'a' COLLATE latin1_bin,_latin1'b');
---error 1270
-select _latin1'B' COLLATE latin1_general_ci in (_latin1'a',_latin1'b' COLLATE latin1_bin);
-
-select collation(bin(130)), coercibility(bin(130));
-select collation(oct(130)), coercibility(oct(130));
-select collation(conv(130,16,10)), coercibility(conv(130,16,10));
-select collation(hex(130)), coercibility(hex(130));
-select collation(char(130)), coercibility(hex(130));
-select collation(format(130,10)), coercibility(format(130,10));
-select collation(lcase(_latin2'a')), coercibility(lcase(_latin2'a'));
-select collation(ucase(_latin2'a')), coercibility(ucase(_latin2'a'));
-select collation(left(_latin2'a',1)), coercibility(left(_latin2'a',1));
-select collation(right(_latin2'a',1)), coercibility(right(_latin2'a',1));
-select collation(substring(_latin2'a',1,1)), coercibility(substring(_latin2'a',1,1));
-select collation(concat(_latin2'a',_latin2'b')), coercibility(concat(_latin2'a',_latin2'b'));
-select collation(lpad(_latin2'a',4,_latin2'b')), coercibility(lpad(_latin2'a',4,_latin2'b'));
-select collation(lpad(_latin2'a',4)), coercibility(lpad(_latin2'a',4));
-select collation(rpad(_latin2'a',4,_latin2'b')), coercibility(rpad(_latin2'a',4,_latin2'b'));
-select collation(rpad(_latin2'a',4)), coercibility(rpad(_latin2'a',4));
-select collation(concat_ws(_latin2'a',_latin2'b')), coercibility(concat_ws(_latin2'a',_latin2'b'));
-select collation(make_set(255,_latin2'a',_latin2'b',_latin2'c')), coercibility(make_set(255,_latin2'a',_latin2'b',_latin2'c'));
-select collation(export_set(255,_latin2'y',_latin2'n',_latin2' ')), coercibility(export_set(255,_latin2'y',_latin2'n',_latin2' '));
-select collation(trim(_latin2' a ')), coercibility(trim(_latin2' a '));
-select collation(ltrim(_latin2' a ')), coercibility(ltrim(_latin2' a '));
-select collation(rtrim(_latin2' a ')), coercibility(rtrim(_latin2' a '));
-select collation(trim(LEADING _latin2' ' FROM _latin2'a')), coercibility(trim(LEADING _latin2'a' FROM _latin2'a'));
-select collation(trim(TRAILING _latin2' ' FROM _latin2'a')), coercibility(trim(TRAILING _latin2'a' FROM _latin2'a'));
-select collation(trim(BOTH _latin2' ' FROM _latin2'a')), coercibility(trim(BOTH _latin2'a' FROM _latin2'a'));
-select collation(repeat(_latin2'a',10)), coercibility(repeat(_latin2'a',10));
-select collation(reverse(_latin2'ab')), coercibility(reverse(_latin2'ab'));
-select collation(quote(_latin2'ab')), coercibility(quote(_latin2'ab'));
-select collation(soundex(_latin2'ab')), coercibility(soundex(_latin2'ab'));
-select collation(substring(_latin2'ab',1)), coercibility(substring(_latin2'ab',1));
-select collation(insert(_latin2'abcd',2,3,_latin2'ef')), coercibility(insert(_latin2'abcd',2,3,_latin2'ef'));
-select collation(replace(_latin2'abcd',_latin2'b',_latin2'B')), coercibility(replace(_latin2'abcd',_latin2'b',_latin2'B'));
-select collation(encode('abcd','ab')), coercibility(encode('abcd','ab'));
-
-create table t1
-select
- bin(130),
- oct(130),
- conv(130,16,10),
- hex(130),
- char(130),
- format(130,10),
- left(_latin2'a',1),
- right(_latin2'a',1),
- lcase(_latin2'a'),
- ucase(_latin2'a'),
- substring(_latin2'a',1,1),
- concat(_latin2'a',_latin2'b'),
- lpad(_latin2'a',4,_latin2'b'),
- rpad(_latin2'a',4,_latin2'b'),
- lpad(_latin2'a',4),
- rpad(_latin2'a',4),
- concat_ws(_latin2'a',_latin2'b'),
- make_set(255,_latin2'a',_latin2'b',_latin2'c'),
- export_set(255,_latin2'y',_latin2'n',_latin2' '),
- trim(_latin2' a '),
- ltrim(_latin2' a '),
- rtrim(_latin2' a '),
- trim(LEADING _latin2' ' FROM _latin2' a '),
- trim(TRAILING _latin2' ' FROM _latin2' a '),
- trim(BOTH _latin2' ' FROM _latin2' a '),
- repeat(_latin2'a',10),
- reverse(_latin2'ab'),
- quote(_latin2'ab'),
- soundex(_latin2'ab'),
- substring(_latin2'ab',1),
- insert(_latin2'abcd',2,3,_latin2'ef'),
- replace(_latin2'abcd',_latin2'b',_latin2'B'),
- encode('abcd','ab')
-;
-show create table t1;
-drop table t1;
-
-#
-# Bug#9129
-#
-create table t1 (a char character set latin2);
-insert into t1 values (null);
-select charset(a), collation(a), coercibility(a) from t1;
-drop table t1;
-select charset(null), collation(null), coercibility(null);
-#
-# Make sure OUTER JOIN is not replaced with a regular joun
-#
-CREATE TABLE t1 (a int, b int);
-CREATE TABLE t2 (a int, b int);
-INSERT INTO t1 VALUES (1,1),(2,2);
-INSERT INTO t2 VALUES (2,2),(3,3);
-select t1.*,t2.* from t1 left join t2 on (t1.b=t2.b)
-where collation(t2.a) = _utf8'binary' order by t1.a,t2.a;
-select t1.*,t2.* from t1 left join t2 on (t1.b=t2.b)
-where charset(t2.a) = _utf8'binary' order by t1.a,t2.a;
-select t1.*,t2.* from t1 left join t2 on (t1.b=t2.b)
-where coercibility(t2.a) = 5 order by t1.a,t2.a;
-DROP TABLE t1, t2;
-
-#
-# test for SUBSTR
-#
-select SUBSTR('abcdefg',3,2);
-select SUBSTRING('abcdefg',3,2);
-select SUBSTR('abcdefg',-3,2) FROM DUAL;
-select SUBSTR('abcdefg',-1,5) FROM DUAL;
-select SUBSTR('abcdefg',0,0) FROM DUAL;
-select SUBSTR('abcdefg',-1,-1) FROM DUAL;
-select SUBSTR('abcdefg',1,-1) FROM DUAL;
-
-#
-# Test that fix_fields doesn't follow to upper level (to comparison)
-# when an error on a lower level (in concat) has accured:
-#
-create table t7 (s1 char);
---error 1267
-select * from t7
-where concat(s1 collate latin1_general_ci,s1 collate latin1_swedish_ci) = 'AA';
-drop table t7;
-
-select substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2),substring_index("1abcd;2abcd;3abcd;4abcd", ';', -2);
-
-explain extended select md5('hello');
-explain extended select sha('abc');
-explain extended select sha1('abc');
-explain extended select soundex('');
-explain extended select 'mood' sounds like 'mud';
-explain extended select aes_decrypt(aes_encrypt('abc','1'),'1');
-explain extended select concat('*',space(5),'*');
-explain extended select reverse('abc');
-explain extended select rpad('a',4,'1');
-explain extended select lpad('a',4,'1');
-explain extended select rpad('a',4);
-explain extended select lpad('a',4);
-explain extended select concat_ws(',','',NULL,'a');
-explain extended select make_set(255,_latin2'a', _latin2'b', _latin2'c');
-explain extended select elt(2,1);
-explain extended select locate("a","b",2);
-explain extended select format(130,10);
-explain extended select char(0);
-explain extended select conv(130,16,10);
-explain extended select hex(130);
-explain extended select binary 'HE';
-explain extended select export_set(255,_latin2'y', _latin2'n', _latin2' ');
-explain extended select FIELD('b' COLLATE latin1_bin,'A','B');
-explain extended select FIND_IN_SET(_latin1'B', _latin1'a,b,c,d');
-explain extended select collation(conv(130,16,10));
-explain extended select coercibility(conv(130,16,10));
-explain extended select length('\n\t\r\b\0\_\%\\');
-explain extended select bit_length('\n\t\r\b\0\_\%\\');
-explain extended select bit_length('\n\t\r\b\0\_\%\\');
-explain extended select concat('monty',' was here ','again');
-explain extended select length('hello');
-explain extended select char(ascii('h'));
-explain extended select ord('h');
-explain extended select quote(1/0);
-explain extended select crc32("123");
-explain extended select replace('aaaa','a','b');
-explain extended select insert('txs',2,1,'hi');
-explain extended select left(_latin2'a',1);
-explain extended select right(_latin2'a',1);
-explain extended select lcase(_latin2'a');
-explain extended select ucase(_latin2'a');
-explain extended select SUBSTR('abcdefg',3,2);
-explain extended select substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2);
-explain extended select trim(_latin2' a ');
-explain extended select ltrim(_latin2' a ');
-explain extended select rtrim(_latin2' a ');
-explain extended select decode(encode(repeat("a",100000),"monty"),"monty");
-
-#
-# lpad returns incorrect result (Bug #2182)
-#
-
-SELECT lpad(12345, 5, "#");
-
-#
-# Problem the the CONV() function (Bug #2972)
-#
-
-SELECT conv(71, 10, 36), conv('1Z', 36, 10);
-SELECT conv(71, 10, 37), conv('1Z', 37, 10), conv(0,1,10),conv(0,0,10), conv(0,-1,10);
-
-#
-# Bug in SUBSTRING when mixed with CONCAT and ORDER BY (Bug #3089)
-#
-
-create table t1 (id int(1), str varchar(10)) DEFAULT CHARSET=utf8;
-insert into t1 values (1,'aaaaaaaaaa'), (2,'bbbbbbbbbb');
-create table t2 (id int(1), str varchar(10)) DEFAULT CHARSET=utf8;
-insert into t2 values (1,'cccccccccc'), (2,'dddddddddd');
-select substring(concat(t1.str, t2.str), 1, 15) "name" from t1, t2
-where t2.id=t1.id order by name;
-drop table t1, t2;
-
-#
-# Test case for conversion of long string value to integer (Bug #3472)
-#
-
-create table t1 (c1 INT, c2 INT UNSIGNED);
-insert ignore into t1 values ('21474836461','21474836461');
-insert ignore into t1 values ('-21474836461','-21474836461');
-show warnings;
-select * from t1;
-drop table t1;
-
-#
-# Bug #4878: LEFT() in integer/float context
-#
-
-select left(1234, 3) + 0;
-
-#
-# Bug #7101: bug with LEFT() when used as a field in GROUP BY aggregation
-#
-create table t1 (a int not null primary key, b varchar(40), c datetime);
-insert into t1 (a,b,c) values (1,'Tom','2004-12-10 12:13:14'),(2,'ball games','2004-12-10 12:13:14'), (3,'Basil','2004-12-10 12:13:14'), (4,'Dean','2004-12-10 12:13:14'),(5,'Ellis','2004-12-10 12:13:14'), (6,'Serg','2004-12-10 12:13:14'), (7,'Sergei','2004-12-10 12:13:14'),(8,'Georg','2004-12-10 12:13:14'),(9,'Salle','2004-12-10 12:13:14'),(10,'Sinisa','2004-12-10 12:13:14');
-select count(*) as total, left(c,10) as reg from t1 group by reg order by reg desc limit 0,12;
-drop table t1;
-
-#
-# Bug#7455 unexpected result: TRIM(<NULL> FROM <whatever>) gives NOT NULL
-# According to ANSI if one of the TRIM arguments is NULL, then the result
-# must be NULL too.
-#
-select trim(null from 'kate') as "must_be_null";
-select trim('xyz' from null) as "must_be_null";
-select trim(leading NULL from 'kate') as "must_be_null";
-select trim(trailing NULL from 'xyz') as "must_be_null";
-
-#
-# Bug #7751 - conversion for a bigint unsigned constant
-#
-
-CREATE TABLE t1 (
- id int(11) NOT NULL auto_increment,
- a bigint(20) unsigned default NULL,
- PRIMARY KEY (id)
-) ENGINE=MyISAM;
-
-INSERT INTO t1 VALUES
-('0','16307858876001849059');
-
-SELECT CONV('e251273eb74a8ee3', 16, 10);
-
-EXPLAIN
-SELECT id
- FROM t1
- WHERE a = 16307858876001849059;
-
-EXPLAIN
- SELECT id
- FROM t1
- WHERE a = CONV('e251273eb74a8ee3', 16, 10);
-
-DROP TABLE t1;
-
-#
-# Bug #6317: string function CHAR, parameter is NULL, wrong result
-#
-SELECT CHAR(NULL,121,83,81,'76') as my_column;
-SELECT CHAR_LENGTH(CHAR(NULL,121,83,81,'76')) as my_column;
-#
-# Test case for bug #8669: null aes_decrypt result in order by query
-#
-
-CREATE TABLE t1 (id int PRIMARY KEY, str char(255) NOT NULL);
-CREATE TABLE t2 (id int NOT NULL UNIQUE);
-INSERT INTO t2 VALUES (1),(2);
-INSERT INTO t1 VALUES (1, aes_encrypt('foo', 'bar'));
-INSERT INTO t1 VALUES (2, 'not valid');
-
-SELECT t1.id, aes_decrypt(str, 'bar') FROM t1, t2 WHERE t1.id = t2.id;
-SELECT t1.id, aes_decrypt(str, 'bar') FROM t1, t2 WHERE t1.id = t2.id
- ORDER BY t1.id;
-
-DROP TABLE t1, t2;
-
-#
-# Bug #10944: Mishandling of NULL arguments in FIELD()
-#
-select field(0,NULL,1,0), field("",NULL,"bar",""), field(0.0,NULL,1.0,0.0);
-select field(NULL,1,2,NULL), field(NULL,1,2,0);
-
-#
-# Bug #10124: access by integer index with a string key that is not a number
-#
-
-CREATE TABLE t1 (str varchar(20) PRIMARY KEY);
-CREATE TABLE t2 (num int primary key);
-INSERT INTO t1 VALUES ('notnumber');
-INSERT INTO t2 VALUES (0), (1);
-
-SELECT * FROM t1, t2 WHERE num=str;
-SELECT * FROM t1, t2 WHERE num=substring(str from 1 for 6);
-
-DROP TABLE t1,t2;
-
-#
-# Bug #11469: NOT NULL optimization wrongly used for arguments of CONCAT_WS
-#
-
-CREATE TABLE t1(
- id int(11) NOT NULL auto_increment,
- pc int(11) NOT NULL default '0',
- title varchar(20) default NULL,
- PRIMARY KEY (id)
-);
-
-INSERT INTO t1 VALUES
- (1, 0, 'Main'),
- (2, 1, 'Toys'),
- (3, 1, 'Games');
-
-SELECT t1.id, CONCAT_WS('->', t3.title, t2.title, t1.title) as col1
- FROM t1 LEFT JOIN t1 AS t2 ON t1.pc=t2.id
- LEFT JOIN t1 AS t3 ON t2.pc=t3.id;
-SELECT t1.id, CONCAT_WS('->', t3.title, t2.title, t1.title) as col1
- FROM t1 LEFT JOIN t1 AS t2 ON t1.pc=t2.id
- LEFT JOIN t1 AS t3 ON t2.pc=t3.id
- WHERE CONCAT_WS('->', t3.title, t2.title, t1.title) LIKE '%Toys%';
-
-DROP TABLE t1;
-
-
-CREATE TABLE t1(
- trackid int(10) unsigned NOT NULL auto_increment,
- trackname varchar(100) NOT NULL default '',
- PRIMARY KEY (trackid)
-);
-
-CREATE TABLE t2(
- artistid int(10) unsigned NOT NULL auto_increment,
- artistname varchar(100) NOT NULL default '',
- PRIMARY KEY (artistid)
-);
-
-CREATE TABLE t3(
- trackid int(10) unsigned NOT NULL,
- artistid int(10) unsigned NOT NULL,
- PRIMARY KEY (trackid,artistid)
-);
-
-INSERT INTO t1 VALUES (1, 'April In Paris'), (2, 'Autumn In New York');
-INSERT INTO t2 VALUES (1, 'Vernon Duke');
-INSERT INTO t3 VALUES (1,1);
-
-SELECT CONCAT_WS(' ', trackname, artistname) trackname, artistname
- FROM t1 LEFT JOIN t3 ON t1.trackid=t3.trackid
- LEFT JOIN t2 ON t2.artistid=t3.artistid
- WHERE CONCAT_WS(' ', trackname, artistname) LIKE '%In%';
-
-DROP TABLE t1,t2,t3;
-
-#
-# Correct length reporting from substring() (BUG#10269)
-#
-create table t1 (b varchar(5));
-insert t1 values ('ab'), ('abc'), ('abcd'), ('abcde');
-select *,substring(b,1),substring(b,-1),substring(b,-2),substring(b,-3),substring(b,-4),substring(b,-5) from t1;
-select * from (select *,substring(b,1),substring(b,-1),substring(b,-2),substring(b,-3),substring(b,-4),substring(b,-5) from t1) t;
-drop table t1;
-
-#
-# Bug #9854 hex() and out of range handling
-#
-select hex(29223372036854775809), hex(-29223372036854775809);
-
-#
-# Bug #11311: Incorrect length returned from LPAD() and RPAD()
-#
-create table t1 (i int);
-insert into t1 values (1000000000),(1);
---enable_metadata
-select lpad(i, 7, ' ') as t from t1;
-select rpad(i, 7, ' ') as t from t1;
---disable_metadata
-drop table t1;
-
-#
-# Bug #10418: LOAD_FILE does not behave like in manual if file does not exist
-#
-
-select load_file("lkjlkj");
-select ifnull(load_file("lkjlkj"),"it's null");
-
-#
-# Bug#15351: Wrong collation used for comparison of md5() and sha()
-# parameter can lead to a wrong result.
-#
-create table t1 (f1 varchar(4), f2 varchar(64), unique key k1 (f1,f2));
-insert into t1 values ( 'test',md5('test')), ('test', sha('test'));
-select * from t1 where f1='test' and (f2= md5("test") or f2= md5("TEST"));
-select * from t1 where f1='test' and (f2= md5("TEST") or f2= md5("test"));
-select * from t1 where f1='test' and (f2= sha("test") or f2= sha("TEST"));
-select * from t1 where f1='test' and (f2= sha("TEST") or f2= sha("test"));
-drop table t1;
-
-#
-# Bug#18243: REVERSE changes its argument
-#
-
-CREATE TABLE t1 (a varchar(10));
-INSERT INTO t1 VALUES ('abc'), ('xyz');
-
-SELECT a, CONCAT(a,' ',a) AS c FROM t1
- HAVING LEFT(c,LENGTH(c)-INSTR(REVERSE(c)," ")) = a;
-
-SELECT a, CONCAT(a,' ',a) AS c FROM t1
- HAVING LEFT(CONCAT(a,' ',a),
- LENGTH(CONCAT(a,' ',a))-
- INSTR(REVERSE(CONCAT(a,' ',a))," ")) = a;
-
-DROP TABLE t1;
-
-#
-# Bug#17526: WRONG PRINT for TRIM FUNCTION with two arguments
-#
-
-CREATE TABLE t1 (s varchar(10));
-INSERT INTO t1 VALUES ('yadda'), ('yaddy');
-
-EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(s) > 'ab';
-EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM('y' FROM s) > 'ab';
-EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(LEADING 'y' FROM s) > 'ab';
-EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(TRAILING 'y' FROM s) > 'ab';
-EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(BOTH 'y' FROM s) > 'ab';
-
-DROP TABLE t1;
-
-#
-# Bug#23409: ENCODE() and DECODE() functions aren't printed correctly
-#
-create table t1(f1 varchar(4));
-explain extended select encode(f1,'zxcv') as 'enc' from t1;
-explain extended select decode(f1,'zxcv') as 'enc' from t1;
-drop table t1;
-
-#
-# Bug #31758 inet_ntoa, oct, crashes server with null + filesort
-#
-create table t1 (a bigint not null)engine=myisam;
-insert into t1 set a = 1024*1024*1024*4;
-delete from t1 order by (inet_ntoa(a)) desc limit 10;
-drop table t1;
-create table t1 (a char(36) not null)engine=myisam;
-insert ignore into t1 set a = ' ';
-insert ignore into t1 set a = ' ';
-select * from t1 order by (oct(a));
-drop table t1;
-
---echo End of 4.1 tests
-
-#
-# Bug #13361: SELECT FORMAT(<decimal field with null>, 2) crashes
-#
-create table t1 (d decimal default null);
-insert into t1 values (null);
-select format(d, 2) from t1;
-drop table t1;
-
-#
-# Bug #14676: substring_index() returns incorrect results
-#
-create table t1 (c varchar(40));
-insert into t1 values ('y,abc'),('y,abc');
-select c, substring_index(lcase(c), @q:=',', -1) as res from t1;
-drop table t1;
-
-#
-# Bug #17043: Casting trimmed string to decimal loses precision
-#
-select cast(rtrim(' 20.06 ') as decimal(19,2));
-select cast(ltrim(' 20.06 ') as decimal(19,2));
-select cast(rtrim(ltrim(' 20.06 ')) as decimal(19,2));
-
-#
-# Bug #13975: "same string" + 0 has 2 different results
-#
-select conv("18383815659218730760",10,10) + 0;
-select "18383815659218730760" + 0;
-
-#
-# Bug #21698: substitution of a string field for a constant under a function
-#
-
-CREATE TABLE t1 (code varchar(10));
-INSERT INTO t1 VALUES ('a12'), ('A12'), ('a13');
-
-SELECT ASCII(code), code FROM t1 WHERE code='A12';
-SELECT ASCII(code), code FROM t1 WHERE code='A12' AND ASCII(code)=65;
-
-INSERT INTO t1 VALUES ('a12 '), ('A12 ');
-
-SELECT LENGTH(code), code FROM t1 WHERE code='A12';
-SELECT LENGTH(code), code FROM t1 WHERE code='A12' AND LENGTH(code)=5;
-
-ALTER TABLE t1 ADD INDEX (code);
-CREATE TABLE t2 (id varchar(10) PRIMARY KEY);
-INSERT INTO t2 VALUES ('a11'), ('a12'), ('a13'), ('a14');
-
-SELECT * FROM t1 INNER JOIN t2 ON t1.code=t2.id
- WHERE t2.id='a12' AND (LENGTH(code)=5 OR code < 'a00');
-EXPLAIN EXTENDED
-SELECT * FROM t1 INNER JOIN t2 ON code=id
- WHERE id='a12' AND (LENGTH(code)=5 OR code < 'a00');
-
-DROP TABLE t1,t2;
-
-#
-# Bug#22684: The Functions ENCODE, DECODE and FORMAT are not real functions
-#
-
-select encode(NULL, NULL);
-select encode("data", NULL);
-select encode(NULL, "password");
-
-select decode(NULL, NULL);
-select decode("data", NULL);
-select decode(NULL, "password");
-
-select format(NULL, NULL);
-select format(pi(), NULL);
-select format(NULL, 2);
-
-select benchmark(NULL, NULL);
-select benchmark(0, NULL);
-select benchmark(100, NULL);
-select benchmark(NULL, 1+1);
-
-#
-# Bug #20752: BENCHMARK with many iterations returns too quickly
-#
-
-# not a string, but belongs with the above Bug#22684
-select benchmark(-1, 1);
-
-#
-# Please note:
-# 1) The collation of the password is irrelevant, the encryption uses
-# the binary representation of the string without charset/collation.
-# 2) These tests can not print the encoded text directly, because it's binary,
-# and doing this would cause problems with source control.
-# Instead, an md5() checksum is used, to verify the result indirectly.
-# 3) Each md5() result must be identical.
-# 4) The md5() result must never change, and must be stable across releases.
-#
-set @password="password";
-set @my_data="clear text to encode";
-select md5(encode(@my_data, "password"));
-select md5(encode(@my_data, _utf8 "password"));
-select md5(encode(@my_data, binary "password"));
-select md5(encode(@my_data, _latin1 "password"));
-select md5(encode(@my_data, _koi8r "password"));
-select md5(encode(@my_data, (select "password" from dual)));
-select md5(encode(@my_data, concat("pass", "word")));
-select md5(encode(@my_data, @password));
-
-set @my_data="binary encoded data";
-select md5(decode(@my_data, "password"));
-select md5(decode(@my_data, _utf8 "password"));
-select md5(decode(@my_data, binary "password"));
-select md5(decode(@my_data, _latin1 "password"));
-select md5(decode(@my_data, _koi8r "password"));
-select md5(decode(@my_data, (select "password" from dual)));
-select md5(decode(@my_data, concat("pass", "word")));
-select md5(decode(@my_data, @password));
-
-set @dec=5;
-select format(pi(), (1+1));
-select format(pi(), (select 3 from dual));
-select format(pi(), @dec);
-
-set @bench_count=10;
-select benchmark(10, pi());
-select benchmark(5+5, pi());
-select benchmark((select 10 from dual), pi());
-select benchmark(@bench_count, pi());
-
-
-#
-# Bug #10963
-# 4294967296 18446744073709551616
-
-select locate('he','hello',-2);
-select locate('lo','hello',-4294967295);
-select locate('lo','hello',4294967295);
-select locate('lo','hello',-4294967296);
-select locate('lo','hello',4294967296);
-select locate('lo','hello',-4294967297);
-select locate('lo','hello',4294967297);
-select locate('lo','hello',-18446744073709551615);
-select locate('lo','hello',18446744073709551615);
-select locate('lo','hello',-18446744073709551616);
-select locate('lo','hello',18446744073709551616);
-select locate('lo','hello',-18446744073709551617);
-select locate('lo','hello',18446744073709551617);
-
-select left('hello', 10);
-select left('hello', 0);
-select left('hello', -1);
-select left('hello', -4294967295);
-select left('hello', 4294967295);
-select left('hello', -4294967296);
-select left('hello', 4294967296);
-select left('hello', -4294967297);
-select left('hello', 4294967297);
-select left('hello', -18446744073709551615);
-select left('hello', 18446744073709551615);
-select left('hello', -18446744073709551616);
-select left('hello', 18446744073709551616);
-select left('hello', -18446744073709551617);
-select left('hello', 18446744073709551617);
-
-select right('hello', 10);
-select right('hello', 0);
-select right('hello', -1);
-select right('hello', -4294967295);
-select right('hello', 4294967295);
-select right('hello', -4294967296);
-select right('hello', 4294967296);
-select right('hello', -4294967297);
-select right('hello', 4294967297);
-select right('hello', -18446744073709551615);
-select right('hello', 18446744073709551615);
-select right('hello', -18446744073709551616);
-select right('hello', 18446744073709551616);
-select right('hello', -18446744073709551617);
-select right('hello', 18446744073709551617);
-
-select substring('hello', 2, -1);
-
-select substring('hello', -1, 1);
-select substring('hello', -2, 1);
-select substring('hello', -4294967295, 1);
-select substring('hello', 4294967295, 1);
-select substring('hello', -4294967296, 1);
-select substring('hello', 4294967296, 1);
-select substring('hello', -4294967297, 1);
-select substring('hello', 4294967297, 1);
-select substring('hello', -18446744073709551615, 1);
-select substring('hello', 18446744073709551615, 1);
-select substring('hello', -18446744073709551616, 1);
-select substring('hello', 18446744073709551616, 1);
-select substring('hello', -18446744073709551617, 1);
-select substring('hello', 18446744073709551617, 1);
-select substring('hello', 1, -1);
-select substring('hello', 1, -4294967295);
-select substring('hello', 1, 4294967295);
-select substring('hello', 1, -4294967296);
-select substring('hello', 1, 4294967296);
-select substring('hello', 1, -4294967297);
-select substring('hello', 1, 4294967297);
-select substring('hello', 1, -18446744073709551615);
-select substring('hello', 1, 18446744073709551615);
-select substring('hello', 1, -18446744073709551616);
-select substring('hello', 1, 18446744073709551616);
-select substring('hello', 1, -18446744073709551617);
-select substring('hello', 1, 18446744073709551617);
-select substring('hello', -1, -1);
-select substring('hello', -4294967295, -4294967295);
-select substring('hello', 4294967295, 4294967295);
-select substring('hello', -4294967296, -4294967296);
-select substring('hello', 4294967296, 4294967296);
-select substring('hello', -4294967297, -4294967297);
-select substring('hello', 4294967297, 4294967297);
-select substring('hello', -18446744073709551615, -18446744073709551615);
-select substring('hello', 18446744073709551615, 18446744073709551615);
-select substring('hello', -18446744073709551616, -18446744073709551616);
-select substring('hello', 18446744073709551616, 18446744073709551616);
-select substring('hello', -18446744073709551617, -18446744073709551617);
-select substring('hello', 18446744073709551617, 18446744073709551617);
-
-select insert('hello', -1, 1, 'hi');
-select insert('hello', -4294967295, 1, 'hi');
-select insert('hello', 4294967295, 1, 'hi');
-select insert('hello', -4294967296, 1, 'hi');
-select insert('hello', 4294967296, 1, 'hi');
-select insert('hello', -4294967297, 1, 'hi');
-select insert('hello', 4294967297, 1, 'hi');
-select insert('hello', -18446744073709551615, 1, 'hi');
-select insert('hello', 18446744073709551615, 1, 'hi');
-select insert('hello', -18446744073709551616, 1, 'hi');
-select insert('hello', 18446744073709551616, 1, 'hi');
-select insert('hello', -18446744073709551617, 1, 'hi');
-select insert('hello', 18446744073709551617, 1, 'hi');
-select insert('hello', 1, -1, 'hi');
-select insert('hello', 1, -4294967295, 'hi');
-select insert('hello', 1, 4294967295, 'hi');
-select insert('hello', 1, -4294967296, 'hi');
-select insert('hello', 1, 4294967296, 'hi');
-select insert('hello', 1, -4294967297, 'hi');
-select insert('hello', 1, 4294967297, 'hi');
-select insert('hello', 1, -18446744073709551615, 'hi');
-select insert('hello', 1, 18446744073709551615, 'hi');
-select insert('hello', 1, -18446744073709551616, 'hi');
-select insert('hello', 1, 18446744073709551616, 'hi');
-select insert('hello', 1, -18446744073709551617, 'hi');
-select insert('hello', 1, 18446744073709551617, 'hi');
-select insert('hello', -1, -1, 'hi');
-select insert('hello', -4294967295, -4294967295, 'hi');
-select insert('hello', 4294967295, 4294967295, 'hi');
-select insert('hello', -4294967296, -4294967296, 'hi');
-select insert('hello', 4294967296, 4294967296, 'hi');
-select insert('hello', -4294967297, -4294967297, 'hi');
-select insert('hello', 4294967297, 4294967297, 'hi');
-select insert('hello', -18446744073709551615, -18446744073709551615, 'hi');
-select insert('hello', 18446744073709551615, 18446744073709551615, 'hi');
-select insert('hello', -18446744073709551616, -18446744073709551616, 'hi');
-select insert('hello', 18446744073709551616, 18446744073709551616, 'hi');
-select insert('hello', -18446744073709551617, -18446744073709551617, 'hi');
-select insert('hello', 18446744073709551617, 18446744073709551617, 'hi');
-
-select repeat('hello', -1);
-select repeat('hello', -4294967295);
-select repeat('hello', 4294967295);
-select repeat('hello', -4294967296);
-select repeat('hello', 4294967296);
-select repeat('hello', -4294967297);
-select repeat('hello', 4294967297);
-select repeat('hello', -18446744073709551615);
-select repeat('hello', 18446744073709551615);
-select repeat('hello', -18446744073709551616);
-select repeat('hello', 18446744073709551616);
-select repeat('hello', -18446744073709551617);
-select repeat('hello', 18446744073709551617);
-
-select space(-1);
-select space(-4294967295);
-select space(4294967295);
-select space(-4294967296);
-select space(4294967296);
-select space(-4294967297);
-select space(4294967297);
-select space(-18446744073709551615);
-select space(18446744073709551615);
-select space(-18446744073709551616);
-select space(18446744073709551616);
-select space(-18446744073709551617);
-select space(18446744073709551617);
-
-select rpad('hello', -1, '1');
-select rpad('hello', -4294967295, '1');
-select rpad('hello', 4294967295, '1');
-select rpad('hello', -4294967296, '1');
-select rpad('hello', 4294967296, '1');
-select rpad('hello', -4294967297, '1');
-select rpad('hello', 4294967297, '1');
-select rpad('hello', -18446744073709551615, '1');
-select rpad('hello', 18446744073709551615, '1');
-select rpad('hello', -18446744073709551616, '1');
-select rpad('hello', 18446744073709551616, '1');
-select rpad('hello', -18446744073709551617, '1');
-select rpad('hello', 18446744073709551617, '1');
-select rpad('hello', -1);
-select rpad('hello', -4294967295);
-select rpad('hello', 4294967295);
-select rpad('hello', -4294967296);
-select rpad('hello', 4294967296);
-select rpad('hello', -4294967297);
-select rpad('hello', 4294967297);
-select rpad('hello', -18446744073709551615);
-select rpad('hello', 18446744073709551615);
-select rpad('hello', -18446744073709551616);
-select rpad('hello', 18446744073709551616);
-select rpad('hello', -18446744073709551617);
-select rpad('hello', 18446744073709551617);
-select rpad('hello', 0, 'x');
-select rpad('hello', 0);
-
-select lpad('hello', -1, '1');
-select lpad('hello', -4294967295, '1');
-select lpad('hello', 4294967295, '1');
-select lpad('hello', -4294967296, '1');
-select lpad('hello', 4294967296, '1');
-select lpad('hello', -4294967297, '1');
-select lpad('hello', 4294967297, '1');
-select lpad('hello', -18446744073709551615, '1');
-select lpad('hello', 18446744073709551615, '1');
-select lpad('hello', -18446744073709551616, '1');
-select lpad('hello', 18446744073709551616, '1');
-select lpad('hello', -18446744073709551617, '1');
-select lpad('hello', 18446744073709551617, '1');
-select lpad('hello', -1);
-select lpad('hello', -4294967295);
-select lpad('hello', 4294967295);
-select lpad('hello', -4294967296);
-select lpad('hello', 4294967296);
-select lpad('hello', -4294967297);
-select lpad('hello', 4294967297);
-select lpad('hello', -18446744073709551615);
-select lpad('hello', 18446744073709551615);
-select lpad('hello', -18446744073709551616);
-select lpad('hello', 18446744073709551616);
-select lpad('hello', -18446744073709551617);
-select lpad('hello', 18446744073709551617);
-select lpad('hello', 0, 'x');
-select lpad('hello', 0);
-
---echo Check parameters count rpad / lpad
---error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select rpad('x');
---error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select rpad('x',2,'.','z');
-
---error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select lpad('x');
---error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select lpad('x',2,'.','z');
-
-#
-# BUG#17047: CHAR() and IN() can return NULL without signaling NULL
-# result
-#
-SET @orig_sql_mode = @@SQL_MODE;
-SET SQL_MODE=traditional;
-
-SELECT CHAR(0xff,0x8f USING utf8);
-SELECT CHAR(0xff,0x8f USING utf8) IS NULL;
-
-SET SQL_MODE=@orig_sql_mode;
-
-#
-# Bug #24947: problem with some string function with unsigned int parameters
-#
-
-select substring('abc', cast(2 as unsigned int));
-select repeat('a', cast(2 as unsigned int));
-select rpad('abc', cast(5 as unsigned integer), 'x');
-select lpad('abc', cast(5 as unsigned integer), 'x');
-select rpad('abc', cast(5 as unsigned integer));
-select lpad('abc', cast(5 as unsigned integer));
-
-#
-# Bug#15757: Wrong SUBSTRING() result when a tmp table was employed.
-#
-create table t1(f1 longtext);
-insert into t1 values ("123"),("456");
-select substring(f1,1,1) from t1 group by 1;
-create table t2(f1 varchar(3));
-insert into t1 values ("123"),("456");
-select substring(f1,4,1), substring(f1,-4,1) from t2;
-drop table t1,t2;
-
-#
-# Bug #25197 :repeat function returns null when using table field directly as count
-#
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE `t1` (
- `id` varchar(20) NOT NULL,
- `tire` tinyint(3) unsigned NOT NULL,
- PRIMARY KEY (`id`)
-);
-
-INSERT INTO `t1` (`id`, `tire`) VALUES ('A', 0), ('B', 1),('C', 2);
-
-SELECT REPEAT( '#', tire ) AS A,
- REPEAT( '#', tire % 999 ) AS B, tire FROM `t1`;
-
-SELECT REPEAT('0', CAST(0 AS UNSIGNED));
-SELECT REPEAT('0', -2);
-SELECT REPEAT('0', 2);
-
-DROP TABLE t1;
-
-#
-# Bug #26537: UNHEX() IS NULL comparison fails
-#
-SELECT UNHEX('G');
-SELECT UNHEX('G') IS NULL;
-
-#
-# Bug #26281: INSERT() function mishandles NUL on boundary condition
-#
-SELECT INSERT('abc', 3, 3, '1234');
-SELECT INSERT('abc', 4, 3, '1234');
-SELECT INSERT('abc', 5, 3, '1234');
-SELECT INSERT('abc', 6, 3, '1234');
-
-#
-# Bug #27530: Grouping on crc32, or create table select crc32
-#
-CREATE TABLE t1 (a INT);
-CREATE VIEW v1 AS SELECT CRC32(a) AS C FROM t1;
-
-INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
-SELECT CRC32(a), COUNT(*) FROM t1 GROUP BY 1;
-SELECT CRC32(a), COUNT(*) FROM t1 GROUP BY 1 ORDER BY 1;
-SELECT * FROM (SELECT CRC32(a) FROM t1) t2;
-CREATE TABLE t2 SELECT CRC32(a) FROM t1;
-desc t2;
-SELECT * FROM v1;
-SELECT * FROM (SELECT * FROM v1) x;
-
-DROP TABLE t1, t2;
-DROP VIEW v1;
-
-#
-# Bug #27932: LOCATE with argument evaluated to NULL
-#
-
-SELECT LOCATE('foo', NULL) FROM DUAL;
-SELECT LOCATE(NULL, 'o') FROM DUAL;
-SELECT LOCATE(NULL, NULL) FROM DUAL;
-SELECT LOCATE('foo', NULL) IS NULL FROM DUAL;
-SELECT LOCATE(NULL, 'o') IS NULL FROM DUAL;
-SELECT LOCATE(NULL, NULL) IS NULL FROM DUAL;
-SELECT ISNULL(LOCATE('foo', NULL)) FROM DUAL;
-SELECT ISNULL(LOCATE(NULL, 'o')) FROM DUAL;
-SELECT ISNULL(LOCATE(NULL, NULL)) FROM DUAL;
-SELECT LOCATE('foo', NULL) <=> NULL FROM DUAL;
-SELECT LOCATE(NULL, 'o') <=> NULL FROM DUAL;
-SELECT LOCATE(NULL, NULL) <=> NULL FROM DUAL;
-
-CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a varchar(10), p varchar(10));
-
-INSERT INTO t1 VALUES (1, 'foo', 'o');
-INSERT INTO t1 VALUES (2, 'foo', NULL);
-INSERT INTO t1 VALUES (3, NULL, 'o');
-INSERT INTO t1 VALUES (4, NULL, NULL);
-
-SELECT id, LOCATE(a,p) FROM t1;
-SELECT id, LOCATE(a,p) IS NULL FROM t1;
-SELECT id, ISNULL(LOCATE(a,p)) FROM t1;
-SELECT id, LOCATE(a,p) <=> NULL FROM t1;
-SELECT id FROM t1 WHERE LOCATE(a,p) IS NULL;
-SELECT id FROM t1 WHERE LOCATE(a,p) <=> NULL;
-
-DROP TABLE t1;
-
-#
-# Bug #27130: SUBSTR with UNSIGNED 0 as the last argument
-#
-
-SELECT SUBSTR('foo',1,0) FROM DUAL;
-SELECT SUBSTR('foo',1,CAST(0 AS SIGNED)) FROM DUAL;
-SELECT SUBSTR('foo',1,CAST(0 AS UNSIGNED)) FROM DUAL;
-
-CREATE TABLE t1 (a varchar(10), len int unsigned);
-INSERT INTO t1 VALUES ('bar', 2), ('foo', 0);
-
-SELECT SUBSTR(a,1,len) FROM t1;
-
-DROP TABLE t1;
-
-#
-# Bug #28850: Potential bugs related to the return type of the CHAR function
-#
-
-CREATE TABLE t1 AS SELECT CHAR(0x414243) as c1;
-SELECT HEX(c1) from t1;
-DROP TABLE t1;
-
-CREATE VIEW v1 AS SELECT CHAR(0x414243) as c1;
-SELECT HEX(c1) from v1;
-DROP VIEW v1;
-
-#
-# Bug #35558 Wrong server metadata blows up the client
-#
-create table t1(a float);
-insert into t1 values (1.33);
---enable_metadata
-select format(a, 2) from t1;
---disable_metadata
-drop table t1;
-
-#
-# Bug #41868: crash or memory overrun with concat + upper, date_format functions
-#
-
-CREATE TABLE t1 (c DATE, aa VARCHAR(30));
-INSERT INTO t1 VALUES ('2008-12-31','aaaaaa');
-SELECT DATE_FORMAT(c, GET_FORMAT(DATE, 'eur')) h, CONCAT(UPPER(aa),', ', aa) i FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # BUG#44774: load_file function produces valgrind warnings
---echo #
-CREATE TABLE t1 (a TINYBLOB);
-INSERT INTO t1 VALUES ('aaaaaaaa');
-SELECT LOAD_FILE(a) FROM t1;
-DROP TABLE t1;
-
-#
-# Bug#46815 CONCAT_WS returning wrong data
-#
-CREATE TABLE t1 (f2 VARCHAR(20));
-CREATE TABLE t2 (f2 VARCHAR(20));
-
-INSERT INTO t1 VALUES ('MIN'),('MAX');
-INSERT INTO t2 VALUES ('LOAD');
-
-SELECT CONCAT_WS('_', (SELECT t2.f2 FROM t2), t1.f2) AS concat_name FROM t1;
-
-DROP TABLE t1, t2;
-
-
---echo End of 5.0 tests
-
-#
-# Bug#44358 valgrind errors with decode() function
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1(f1 tinyint default null)engine=myisam;
-insert into t1 values (-1),(null);
-
-set @tmp_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='derived_merge=off,derived_with_keys=off';
-explain select 1 as a from t1,(select decode(f1,f1) as b from t1) a;
-explain select 1 as a from t1,(select encode(f1,f1) as b from t1) a;
-set optimizer_switch=@tmp_optimizer_switch;
-drop table t1;
-
-
---echo #
---echo # Bug#49141: Encode function is significantly slower in 5.1 compared to 5.0
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-CREATE TABLE t1 (a VARCHAR(20), b INT);
-CREATE TABLE t2 (a VARCHAR(20), b INT);
-
-INSERT INTO t1 VALUES ('ABC', 1);
-INSERT INTO t2 VALUES ('ABC', 1);
-
-SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), t2.a)
- FROM t1,t2 WHERE t1.b = t1.b > 0 GROUP BY t2.b;
-
-SELECT DECODE((SELECT ENCODE('secret', 'ABC') FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), t2.a)
- FROM t1,t2 WHERE t1.b = t1.b > 0 GROUP BY t2.b;
-
-SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b), 'ABC')
- FROM t1,t2 WHERE t1.b = t1.b > 0 GROUP BY t2.b;
-
-TRUNCATE TABLE t1;
-TRUNCATE TABLE t2;
-
-INSERT INTO t1 VALUES ('EDF', 3), ('BCD', 2), ('ABC', 1);
-INSERT INTO t2 VALUES ('EDF', 3), ('BCD', 2), ('ABC', 1);
-
-SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP BY t1.b LIMIT 1), t2.a)
- FROM t2 WHERE t2.b = 1 GROUP BY t2.b;
-
-DROP TABLE t1, t2;
-
---echo #
---echo # Bug#52164 Assertion failed: param.sort_length, file .\filesort.cc, line 149
---echo #
-CREATE TABLE t1 (a LONGBLOB NOT NULL);
-INSERT INTO t1 VALUES (''),('');
-SELECT 1 FROM t1, t1 t2
-ORDER BY QUOTE(t1.a);
-DROP TABLE t1;
-
---echo #
---echo # Bug#57913 large negative number to string conversion functions crash
---echo # Bug#57810 case/when/then : Assertion failed: length || !scale
---echo #
-SELECT '1' IN ('1', SUBSTRING(-9223372036854775809, 1));
-SELECT CONVERT(('' IN (REVERSE(CAST(('') AS DECIMAL)), '')), CHAR(3));
-
---echo #
---echo # Bug#58165: "my_empty_string" gets modified and causes LOAD DATA to fail
---echo # and other crashes
---echo #
-CREATE TABLE t1 ( a TEXT );
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT 'aaaaaaaaaaaaaa' INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug58165.txt';
-SELECT insert( substring_index( 'a', 'a', 'b' ), 1, 0, 'x' );
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug58165.txt' INTO TABLE t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-#
-# MDEV-759 lp:998340 - Valgrind complains on simple selects containing expression DAY(FROM_UNIXTIME(-1))
-#
-SELECT SUBSTRING('1', DAY(FROM_UNIXTIME(-1)));
-SELECT LEFT('1', DAY(FROM_UNIXTIME(-1)));
-SELECT RIGHT('1', DAY(FROM_UNIXTIME(-1)));
-SELECT REPEAT('1', DAY(FROM_UNIXTIME(-1)));
-SELECT RPAD('hi', DAY(FROM_UNIXTIME(-1)),'?');
-SELECT LPAD('hi', DAY(FROM_UNIXTIME(-1)),'?');
-SELECT RPAD('hi', DAY(FROM_UNIXTIME(-1)));
-SELECT LPAD('hi', DAY(FROM_UNIXTIME(-1)));
-
-#
-# MDEV-4289 Assertion `0' fails in make_sortkey with GROUP_CONCAT, MAKE_SET, GROUP BY
-#
-create table t1 (i int);
-insert into t1 values (null),(8);
-select group_concat( i ), make_set( i, 'a', 'b' ) field from t1 group by field;
-drop table t1;
-
---echo #
---echo # Bug#11766684 59851: UNINITIALISED VALUE IN ITEM_FUNC_LIKE::SELECT_OPTIMIZE WITH SUBQUERY AND
---echo #
-
-CREATE TABLE t2(a INT, KEY(a));
-INSERT INTO t2 VALUES (1),(2);
-CREATE TABLE t1(b INT, PRIMARY KEY(b));
-INSERT INTO t1 VALUES (0),(254);
-SELECT 1 FROM t2 WHERE a LIKE
-(SELECT EXPORT_SET(1, b, b, b, b) FROM t1 LIMIT 1);
-DROP TABLE t1, t2;
-
---echo End of 5.1 tests
-
---echo #
---echo # Start of 5.3 tests
---echo #
-
---echo #
---echo # Bug#11829861: SUBSTRING_INDEX() RESULTS IN MISSING CHARACTERS WHEN USED
---echo # INSIDE LOWER()
---echo #
-SET @user_at_host = 'root@mytinyhost-PC.local';
-SELECT LOWER(SUBSTRING_INDEX(@user_at_host, '@', -1));
---echo # End of test BUG#11829861
-
---echo #
---echo # Bug#42404: SUBSTRING_INDEX() RESULTS ARE INCONSISTENT
---echo #
-
-CREATE TABLE t (i INT NOT NULL, c CHAR(255) NOT NULL);
-INSERT INTO t VALUES (0,'.www.mysql.com'),(1,'.wwwmysqlcom');
-SELECT i, SUBSTRING_INDEX(c, '.', -2) FROM t WHERE i = 1;
-SELECT i, SUBSTRING_INDEX(c, '.', -2) FROM t;
-DROP TABLE t;
---echo # End of test BUG#42404
-
---echo #
---echo # End of 5.3 tests
---echo #
-
-
---echo Start of 5.4 tests
-#
-# WL#4584 Internationalized number format
-#
-SELECT format(12345678901234567890.123, 3);
-SELECT format(12345678901234567890.123, 3, NULL);
-SELECT format(12345678901234567890.123, 3, 'ar_AE');
-SELECT format(12345678901234567890.123, 3, 'ar_SA');
-SELECT format(12345678901234567890.123, 3, 'be_BY');
-SELECT format(12345678901234567890.123, 3, 'de_DE');
-SELECT format(12345678901234567890.123, 3, 'en_IN');
-SELECT format(12345678901234567890.123, 3, 'en_US');
-SELECT format(12345678901234567890.123, 3, 'it_CH');
-SELECT format(12345678901234567890.123, 3, 'ru_RU');
-SELECT format(12345678901234567890.123, 3, 'ta_IN');
-
-CREATE TABLE t1 (fmt CHAR(5) NOT NULL);
-INSERT INTO t1 VALUES ('ar_AE');
-INSERT INTO t1 VALUES ('ar_SA');
-INSERT INTO t1 VALUES ('be_BY');
-INSERT INTO t1 VALUES ('de_DE');
-INSERT INTO t1 VALUES ('en_IN');
-INSERT INTO t1 VALUES ('en_US');
-INSERT INTO t1 VALUES ('it_CH');
-INSERT INTO t1 VALUES ('ru_RU');
-INSERT INTO t1 VALUES ('ta_IN');
-SELECT fmt, format(12345678901234567890.123, 3, fmt) FROM t1 ORDER BY fmt;
-SELECT fmt, format(12345678901234567890.123, 0, fmt) FROM t1 ORDER BY fmt;
-SELECT fmt, format(12345678901234567890, 3, fmt) FROM t1 ORDER BY fmt;
-SELECT fmt, format(-12345678901234567890, 3, fmt) FROM t1 ORDER BY fmt;
-SELECT fmt, format(-02345678901234567890, 3, fmt) FROM t1 ORDER BY fmt;
-SELECT fmt, format(-00345678901234567890, 3, fmt) FROM t1 ORDER BY fmt;
-SELECT fmt, format(-00045678901234567890, 3, fmt) FROM t1 ORDER BY fmt;
-DROP TABLE t1;
-
-SELECT format(123, 1, 'Non-existent-locale');
-
---echo End of 5.4 tests
-
---echo #
---echo # Start of 5.5 tests
---echo #
-
---echo #
---echo # Bug#55912 FORMAT with locale set fails for numbers < 1000
---echo #
-SELECT FORMAT(123.33, 2, 'no_NO'), FORMAT(1123.33, 2, 'no_NO');
-SELECT FORMAT(12333e-2, 2, 'no_NO'), FORMAT(112333e-2, 2, 'no_NO');
-CREATE TABLE t1 AS SELECT format(123,2,'no_NO');
-SHOW CREATE TABLE t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#11764310 conv function crashes, negative argument to memcpy
---echo #
-SELECT CONV(1,-2147483648,-2147483648);
-
---echo #
---echo # Bug#12985030 SIMPLE QUERY WITH DECIMAL NUMBERS LEAKS MEMORY
---echo #
-
-SELECT (rpad(1.0,2048,1)) IS NOT FALSE;
-SELECT ((+0) IN
-((0b111111111111111111111111111111111111111111111111111),(rpad(1.0,2048,1)),
-(32767.1)));
-SELECT ((rpad(1.0,2048,1)) = ('4(') ^ (0.1));
-
---error 1690
-SELECT
-pow((rpad(10.0,2048,1)),(b'1111111111111111111111111111111111111111111'));
-SELECT ((rpad(1.0,2048,1)) + (0) ^ ('../'));
-SELECT stddev_samp(rpad(1.0,2048,1));
-SELECT ((127.1) not in ((rpad(1.0,2048,1)),(''),(-1.1)));
-SELECT ((0xf3) * (rpad(1.0,2048,1)) << (0xcc));
-
---echo #
---echo # Bug#13359121 LARGE NUMBERS, /STRINGS/DTOA.C:662:
---echo # BALLOC: ASSERTION `K <= 15' FAILED.
---echo # Bug#12985021 SIMPLE QUERY WITH DECIMAL NUMBERS TAKE AN
---echo # EXTRAORDINARY LONG TIME TO EXECUTE
-
-SELECT @tmp_max:= @@global.max_allowed_packet;
-SET @@global.max_allowed_packet=1024*1024*1024;
-# switching connection to allow the new max_allowed_packet take effect
---connect (newconn, localhost, root,,)
-
-SELECT @@global.max_allowed_packet;
-
-do
-format(rpad('111111111.1',
- 1111111,
- '999999999999999999999999999999999999999999'),0,'be_BY')
-;
-
-#
-# Originally it was DO instead of SELECT here.
-# But in mysqltest --disable_prepare_warnings affects SELECT queries only
-# and can't suppress prepare time warnings for DO.
-#
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT
-round(
- concat( (
- coalesce( (
- linefromwkb('2147483648',
- -b'1111111111111111111111111111111111111111111')),
- ( convert('[.DC2.]',decimal(30,30)) ),
- bit_count('')
- ) ),
- ( lpad( ( elt('01','}:K5')),
- sha1('P'),
- ( ( select '-9223372036854775808.1' > all (select '')))
- )
- )
- )
-) AS r;
-
---connection conn1
-SET @@global.max_allowed_packet:= @tmp_max;
---disconnect newconn
-#
-# Bug#11765562 58545:
-# EXPORT_SET() CAN BE USED TO MAKE ENTIRE SERVER COMPLETELY UNRESPONSIVE
-#
-SELECT @tmp_max:= @@global.max_allowed_packet;
-SET @@global.max_allowed_packet=1024*1024*1024;
-SELECT @@global.max_allowed_packet;
-SELECT CHAR_LENGTH(EXPORT_SET(1,1,1,REPEAT(1,100000000)));
-SET @@global.max_allowed_packet:= @tmp_max;
-
---echo #
---echo # MDEV-4272: DIV operator crashes in Item_func_int_div::val_int
---echo # (incorrect NULL value handling by convert)
---echo #
-create table t1(a int) select null;
-select 1 div convert(a using utf8) from t1;
-drop table t1;
-
-#
-# BUG#11757250: REPLACE(...) INSIDE A STORED PROCEDURE.
-#
-create table t1 (a int);
-create table t2 (a int);
-create procedure foo (var char(100))
- select replace(var, '00000000', table_name)
- from information_schema.tables where table_schema='test';
---sorted_result
-call foo('(( 00000000 ++ 00000000 ))');
-drop procedure foo;
-drop table t1,t2;
-
-#
-# Bug#18786138 SHA/MD5 HASHING FUNCTIONS DIE WITH "FILENAME" CHARACTER SET
-#
-select md5(_filename "a"), sha(_filename "a");
-
---echo #
---echo # End of 5.5 tests
---echo #
-
-
---echo #
---echo # Start of 5.6 tests
---echo #
-
---echo #
---echo # WL#5510 Functions to_base64 and from_base64
---echo #
-let $1=64;
-while($1)
-{
- dec $1;
- eval CREATE TABLE t1 AS SELECT TO_BASE64(REPEAT('a',$1)) AS to_base64;
- SHOW CREATE TABLE t1;
- SELECT to_base64, LENGTH(to_base64) FROM t1;
- CREATE TABLE t2 AS SELECT from_base64(to_base64) AS from_base64 FROM t1;
- SHOW CREATE TABLE t2;
- SELECT from_base64, LENGTH(from_base64) FROM t2;
- DROP TABLE t2;
- DROP TABLE t1;
- --echo
-}
-CREATE TABLE t1 (a VARBINARY(64));
-INSERT INTO t1 VALUES (0x00), (0x0000), (0x000000), (0x00000000);
-INSERT INTO t1 VALUES (0x00010203040506070809);
-SELECT TO_BASE64(a), hex(a) FROM t1 ORDER BY a;
-DROP TABLE t1;
-
---echo #
---echo # Test NULL output for NULL input
---echo #
-SELECT TO_BASE64(NULL);
-SELECT FROM_BASE64(NULL);
-
---echo #
---echo # RFC4648 test vectors
---echo #
-SELECT @b:= TO_BASE64(''), FROM_BASE64(@b); # ""
-SELECT @b:= TO_BASE64('f'), FROM_BASE64(@b); # "Zg=="
-SELECT @b:= TO_BASE64('fo'), FROM_BASE64(@b); # "Zm8="
-SELECT @b:= TO_BASE64('foo'), FROM_BASE64(@b); # "Zm9v"
-SELECT @b:= TO_BASE64('foob'), FROM_BASE64(@b); # "Zm9vYg=="
-SELECT @b:= TO_BASE64('fooba'), FROM_BASE64(@b); # "Zm9vYmE="
-SELECT @b:= TO_BASE64('foobar'), FROM_BASE64(@b); # "Zm9vYmFy"
-
-
---echo #
---echo # Invalid characters - return NULL
---echo #
-SELECT hex(FROM_BASE64('#'));
-SELECT hex(FROM_BASE64('A#'));
-SELECT hex(FROM_BASE64('AB#'));
-SELECT hex(FROM_BASE64('ABC#'));
-SELECT hex(FROM_BASE64('ABCD#'));
-
---echo #
---echo # "=" is not valid on the first and second positions of a quadruple
---echo #
-SELECT hex(FROM_BASE64('='));
-SELECT hex(FROM_BASE64('A='));
-SELECT hex(FROM_BASE64('ABCD='));
-SELECT hex(FROM_BASE64('ABCDE='));
-
---echo #
---echo # Incomplete sequences - return NULL
---echo #
-SELECT hex(FROM_BASE64('A'));
-SELECT hex(FROM_BASE64('AB'));
-SELECT hex(FROM_BASE64('ABC'));
-
---echo #
---echo # Unexpected input after pad characters - return NULL
---echo #
-SELECT hex(FROM_BASE64('AAA=x'));
-SELECT hex(FROM_BASE64('AA==x'));
-
-
---echo #
---echo # Delimiters are allowed at any position
---echo #
-SELECT hex(FROM_BASE64(' A B C D '));
-SELECT hex(FROM_BASE64(' A A = = '));
-SELECT hex(FROM_BASE64(' A A A = '));
-SELECT hex(FROM_BASE64(' A \n B \r C \t D '));
-
---echo #
---echo # Testing that to_base64 respects max_allowed_packet
---echo #
-SELECT LENGTH(TO_BASE64(REPEAT('a', @@max_allowed_packet-10)));
-
---echo #
---echo # Testing base64 with various data types
---echo #
-CREATE TABLE t1 (
- i1 INT,
- f1 FLOAT,
- dc1 DECIMAL(10,5),
- e1 ENUM('enum11','enum12','enum13'),
- s1 SET('set1','set2','set3'),
- t1 TIME,
- d1 DATE,
- dt1 DATETIME
-);
-INSERT INTO t1 VALUES
-(-12345, -456.789, 123.45, 'enum13', 'set1,set3',
-'01:02:03', '2010-01-01', '2011-01-01 02:03:04');
-SELECT FROM_BASE64(TO_BASE64(i1)) FROM t1;
-SELECT FROM_BASE64(TO_BASE64(f1)) FROM t1;
-SELECT FROM_BASE64(TO_BASE64(dc1)) FROM t1;
-SELECT FROM_BASE64(TO_BASE64(e1)) FROM t1;
-SELECT FROM_BASE64(TO_BASE64(s1)) FROM t1;
-SELECT FROM_BASE64(TO_BASE64(t1)) FROM t1;
-SELECT FROM_BASE64(TO_BASE64(d1)) FROM t1;
-SELECT FROM_BASE64(TO_BASE64(dt1)) FROM t1;
-DROP TABLE t1;
-
-
-#
-# BUG #12735829: SPACE() FUNCTION WARNING REFERS TO REPEAT() IN ER_WARN_ALLOWED_PACKET_OVERFLOWED
-#
-
-SELECT SPACE(@@global.max_allowed_packet*2);
-
-
-#
-# BUG #11746123-23637: CHARSET AND COLLATION OF THE FUNCTION SPACE()
-#
-
-SET NAMES latin1;
-PREPARE stmt FROM "SELECT COLLATION(space(2))";
-EXECUTE stmt;
-SET NAMES latin2;
-EXECUTE stmt;
-
-disconnect conn1;
-connection default;
-set global max_allowed_packet=default;
-
---echo #
---echo # End of 5.6 tests
---echo #
-
---echo #
---echo # Start of 10.0 tests
---echo #
-
---echo #
---echo # MDEV-12681 Wrong VIEW results for CHAR(0xDF USING latin1)
---echo #
-
-EXPLAIN EXTENDED SELECT CHAR(0xDF USING latin1);
-EXPLAIN EXTENDED SELECT CHAR(0xDF USING `binary`);
-EXPLAIN EXTENDED SELECT CHAR(0xDF);
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-8369 Unexpected impossible WHERE for a condition on a ZEROFILL field
---echo #
-CREATE TABLE t1 (a BIGINT(20) ZEROFILL);
-INSERT INTO t1 VALUES (18446744073709551615),(0);
-SELECT * FROM t1 WHERE a=18446744073709551615;
-SELECT * FROM t1 WHERE FORMAT(a,0)='18,446,744,073,709,551,615';
-SELECT * FROM t1 WHERE a=18446744073709551615 AND FORMAT(a,0)='18,446,744,073,709,551,615';
-# This should not propagate the equality into FORMAT()
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE a=18446744073709551615 AND FORMAT(a,0)='18,446,744,073,709,551,615';
-DROP TABLE t1;
-
---echo #
---echo # Bug#58081 Duplicate entry error when doing GROUP BY
---echo # MDEV-9332 Bug after upgrade to 10.1.10
---echo #
-SET NAMES latin1;
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (0),(0),(1),(0),(0);
-SELECT COUNT(*) FROM t1, t1 t2 GROUP BY INSERT('', t2.a, t1.a, @@global.max_binlog_size);
-DROP TABLE t1;
-
---let func=hex
---source include/func_str_ascii_checksum.inc
-
---let func=to_base64
---source include/func_str_ascii_checksum.inc
-
---echo #
---echo # MDEV-10864 Wrong result for WHERE .. (f2=COMPRESS('test') OR f2=COMPRESS('TEST'))
---echo #
-
-CREATE TABLE t1 (f1 VARCHAR(4), f2 VARCHAR(128), UNIQUE KEY k1 (f1,f2));
-INSERT INTO t1 VALUES ('YQ==',from_base64('YQ==')), ('Yq==', from_base64('Yq=='));
-SELECT f1,HEX(f2) FROM t1 ignore index(k1) WHERE f1='YQ==' AND (f2= from_base64("YQ==") OR f2= from_base64("Yq=="));
-SELECT f1,HEX(f2) FROM t1 WHERE f1='YQ==' AND (f2= from_base64("YQ==") OR f2= from_base64("Yq=="));
-SELECT f1,HEX(f2) FROM t1 WHERE f1='YQ==' AND (f2= from_base64("Yq==") OR f2= from_base64("YQ=="));
-DROP TABLE t1;
-
---echo #
---echo # End of 10.1 tests
---echo #
-
-
---echo #
---echo # Start of 10.3 tests
---echo #
-
---echo #
---echo # MDEV-12685 Oracle-compatible function CHR()
---echo #
-select chr(65);
-create database mysqltest1 CHARACTER SET = 'utf8' COLLATE = 'utf8_bin';
-use mysqltest1;
-select charset(chr(65)), length(chr(65)),char_length(chr(65));
-select charset(chr(14844588)), length(chr(14844588)),char_length(chr(14844588));
-drop database mysqltest1;
-use test;
-
---echo #
---echo # MDEV-12592 Illegal mix of collations with the HEX function
---echo #
-
-SET NAMES utf8;
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
-INSERT INTO t1 VALUES (0x09),('a');
-SELECT IF(a<' ',HEX(a),a) FROM t1 ORDER BY a;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-12783 sql_mode=ORACLE: Functions LENGTH() and LENGTHB()
---echo #
-SELECT LENGTHB('a'), LENGTHB(_utf8 0xC39F), LENGTHB(123), LENGTH(null);
-EXPLAIN EXTENDED SELECT LENGTH('a'), LENGTHB('a');
-
-
---echo #
---echo # MDEV-13555 Assertion `!item->null_value' failed in Type_handler::Item_send_str
---echo #
-
-CREATE TABLE t1 (c VARCHAR(8));
-INSERT INTO t1 VALUES (NULL),('bar');
-SELECT LPAD( c, 0, '?' ) FROM t1;
-SELECT RPAD( c, 0, '?' ) FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # End of 10.3 tests
---echo #
diff --git a/mysql-test/t/func_system.test b/mysql-test/t/func_system.test
deleted file mode 100644
index fa09e81a300..00000000000
--- a/mysql-test/t/func_system.test
+++ /dev/null
@@ -1,57 +0,0 @@
-#
-# system functions
-#
-
-select database();
-select charset(database());
-select database() = "test";
-select database() = _utf8"test";
-select database() = _latin1"test";
-
-select user() like "%@%";
-select user() like _utf8"%@%";
-select user() like _latin1"%@%";
-select charset(user());
-
-select version()>="03.23.29";
-select version()>=_utf8"03.23.29";
-select version()>=_latin1"03.23.29";
-select charset(version());
-explain extended select database(), user();
-
-create table t1 (version char(60)) select database(), user(), version() as 'version';
-show create table t1;
-drop table t1;
-
-select charset(charset(_utf8'a')), charset(collation(_utf8'a'));
-select collation(charset(_utf8'a')), collation(collation(_utf8'a'));
-create table t1 select charset(_utf8'a'), collation(_utf8'a');
-show create table t1;
-drop table t1;
-
-select TRUE,FALSE,NULL;
-
-#
-# Bug#12351: CONCAT with USER()/DATEBASE() and
-# a constant and a column gets strange results
-#
-create table t1 (c1 char(5)) character set=latin1;
-insert into t1 values('row 1');
-insert into t1 values('row 2');
-insert into t1 values('row 3');
-select concat(user(), '--', c1) from t1;
-select concat(database(), '--', c1) from t1;
-drop table t1;
-
-#
-# Bug#8291 Illegal collation mix with USER() function
-#
-create table t1 (a char(10)) character set latin1;
-select * from t1 where a=version();
-select * from t1 where a=database();
-select * from t1 where a=user();
-insert into t1 values ('a');
-select left(concat(a,version()),1) from t1;
-drop table t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/func_test.test b/mysql-test/t/func_test.test
deleted file mode 100644
index d1c0702da80..00000000000
--- a/mysql-test/t/func_test.test
+++ /dev/null
@@ -1,245 +0,0 @@
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-#
-# Testing of comparison functions
-#
-select 0=0,1>0,1>=1,1<0,1<=0,1!=0,strcmp("abc","abcd"),strcmp("b","a"),strcmp("a","a") ;
-select "a"<"b","a"<="b","b">="a","b">"a","a"="A","a"<>"b";
-select "a "="A", "A "="a", "a " <= "A b";
-select "abc" like "a%", "abc" not like "%d%", "a%" like "a\%","abc%" like "a%\%","abcd" like "a%b_%d", "a" like "%%a","abcde" like "a%_e","abc" like "abc%";
-select "a" like "%%b","a" like "%%ab","ab" like "a\%", "ab" like "_", "ab" like "ab_", "abc" like "%_d", "abc" like "abc%d";
-select '?' like '|%', '?' like '|%' ESCAPE '|', '%' like '|%', '%' like '|%' ESCAPE '|', '%' like '%';
-select 'abc' like '%c','abcabc' like '%c', "ab" like "", "ab" like "a", "ab" like "ab";
-select "Det hr r svenska" regexp "h[[:alpha:]]+r", "aba" regexp "^(a|b)*$";
-select "aba" regexp concat("^","a");
-select !0,NOT 0=1,!(0=0),1 AND 1,1 && 0,0 OR 1,1 || NULL, 1=1 or 1=1 and 1=0;
-select 2 between 1 and 3, "monty" between "max" and "my",2=2 and "monty" between "max" and "my" and 3=3;
-select 'b' between 'a' and 'c', 'B' between 'a' and 'c';
-select 2 in (3,2,5,9,5,1),"monty" in ("david","monty","allan"), 1.2 in (1.4,1.2,1.0);
-select -1.49 or -1.49,0.6 or 0.6;
-select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1;
-explain extended select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1;
-select 1 XOR 1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL;
-select 1 like 2 xor 2 like 1;
-select 10 % 7, 10 mod 7, 10 div 3;
-explain extended select 10 % 7, 10 mod 7, 10 div 3;
-select 18446744073709551615, 18446744073709551615 DIV 1, 18446744073709551615 DIV 2;
-explain extended select (1 << 64)-1, ((1 << 64)-1) DIV 1, ((1 << 64)-1) DIV 2;
-
-create table t1 (a int);
-insert t1 values (1);
-select * from t1 where 1 xor 1;
-explain extended select * from t1 where 1 xor 1;
-select - a from t1;
-explain extended select - a from t1;
-drop table t1;
-
-#
-# Wrong usage of functions
-#
-
-select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
-select 1 and 2 between 2 and 10, 2 between 2 and 10 and 1;
-select 1 and 0 or 2, 2 or 1 and 0;
-
-#
-# Coercibility
-#
-select _koi8r'a' = _koi8r'A';
-select _koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci;
-explain extended select _koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci;
-select _koi8r'a' = _koi8r'A' COLLATE koi8r_bin;
-select _koi8r'a' COLLATE koi8r_general_ci = _koi8r'A';
-select _koi8r'a' COLLATE koi8r_bin = _koi8r'A';
---error 1267
-select _koi8r'a' COLLATE koi8r_bin = _koi8r'A' COLLATE koi8r_general_ci;
---error 1267
-select _koi8r'a' = _latin1'A';
-
-select strcmp(_koi8r'a', _koi8r'A');
-select strcmp(_koi8r'a', _koi8r'A' COLLATE koi8r_general_ci);
-select strcmp(_koi8r'a', _koi8r'A' COLLATE koi8r_bin);
-select strcmp(_koi8r'a' COLLATE koi8r_general_ci, _koi8r'A');
-select strcmp(_koi8r'a' COLLATE koi8r_bin, _koi8r'A');
---error 1267
-select strcmp(_koi8r'a' COLLATE koi8r_general_ci, _koi8r'A' COLLATE koi8r_bin);
---error 1267
-select strcmp(_koi8r'a', _latin1'A');
-
-select _koi8r'a' LIKE _koi8r'A';
-select _koi8r'a' LIKE _koi8r'A' COLLATE koi8r_general_ci;
-select _koi8r'a' LIKE _koi8r'A' COLLATE koi8r_bin;
-select _koi8r'a' COLLATE koi8r_general_ci LIKE _koi8r'A';
-select _koi8r'a' COLLATE koi8r_bin LIKE _koi8r'A';
---error 1267
-select _koi8r'a' COLLATE koi8r_general_ci LIKE _koi8r'A' COLLATE koi8r_bin;
---error 1267
-select _koi8r'a' LIKE _latin1'A';
-
-#
-# Test for LEAST() BUG in LEFT JOIN
-#
-CREATE TABLE t1 ( faq_group_id int(11) NOT NULL default '0', faq_id int(11) NOT NULL default '0', title varchar(240) default NULL, keywords text, description longblob, solution longblob, status tinyint(4) NOT NULL default '0', access_id smallint(6) default NULL, lang_id smallint(6) NOT NULL default '0', created datetime NOT NULL default '0000-00-00 00:00:00', updated datetime default NULL, last_access datetime default NULL, last_notify datetime default NULL, solved_count int(11) NOT NULL default '0', static_solved int(11) default NULL, solved_1 int(11) default NULL, solved_2 int(11) default NULL, solved_3 int(11) default NULL, solved_4 int(11) default NULL, solved_5 int(11) default NULL, expires datetime default NULL, notes text, assigned_to smallint(6) default NULL, assigned_group smallint(6) default NULL, last_edited_by smallint(6) default NULL, orig_ref_no varchar(15) binary default NULL, c$fundstate smallint(6) default NULL, c$contributor smallint(6) default NULL, UNIQUE KEY t1$faq_id (faq_id), KEY t1$group_id$faq_id (faq_group_id,faq_id), KEY t1$c$fundstate (c$fundstate) ) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (82,82,'How to use the DynaVox Usage Counts Feature','usages count, number, corner, white, box, button','<as-html>\r\n<table width=\"100%\" border=\"0\">\r\n <tr>\r\n <td width=\"3%\"></td>\r\n <td width=\"97%\">\r\n <h3><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"#000000\">How \r\n To</font><!-- #BeginEditable \"CS_troubleshoot_question\" --><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"#000099\"><font color=\"#000000\">: \r\n Display or Hide the Usage Counts to find out how many times each button is being selected. </font></font><!-- #EndEditable --></h3>\r\n </td>\r\n </tr>\r\n</table>','<as-html>\r\n <table width=\"100%\" border=\"0\">\r\n <tr>\r\n <td width=\"3%\"></td>\r\n \r\n<td width=\"97%\"><!-- #BeginEditable \"CS_troubleshoot_answer\" --> \r\n \r\n<p><font color=\"#000000\" face=\"Verdana, Arial, Helvetica, sans-serif\">1. Select \r\n the <i>On/Setup</i> button to access the DynaVox Setup Menu.<br>\r\n 2. Select <b>Button Features.</b><br>\r\n 3. Below the <b>OK</b> button is the <b>Usage Counts</b> button.<br>\r\n a. If it says \"Hidden\" then the Usage Counts will not be displayed.<br>\r\n b. If it says \"Displayed\" then the Usage Counts will be shown.<br>\r\n c. Select the <b>Usage Counts</b> Option Ring once and it will toggle \r\n to the alternative option.<br>\r\n 4. Once the correct setting has been chosen, select <b>OK</b> to leave the <i>Button \r\n Features</i> menu.<br>\r\n 5. Select <b>OK</b> out of the <i>Setup</i> menu and return to the communication \r\n page.</font></p>\r\n <p><font color=\"#000000\" face=\"Verdana, Arial, Helvetica, sans-serif\">For \r\n further information on <i>Usage Counts,</i> see the <i>Button Features \r\n Menu Entry</i> in the DynaVox/DynaMyte Reference Manual.</font></p>\r\n<!-- #EndEditable --></td>\r\n </tr>\r\n</table>',4,1,1,'2001-11-16 16:43:34','2002-11-25 12:09:43','2003-07-24 01:04:48',NULL,11,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,11,NULL,NULL,NULL);
-CREATE TABLE t2 ( access_id smallint(6) NOT NULL default '0', name varchar(20) binary default NULL, rank smallint(6) NOT NULL default '0', KEY t2$access_id (access_id) ) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (1,'Everyone',2),(2,'Help',3),(3,'Customer Support',1);
-SELECT f_acc.rank, a1.rank, a2.rank FROM t1 LEFT JOIN t1 f1 ON (f1.access_id=1 AND f1.faq_group_id = t1.faq_group_id) LEFT JOIN t2 a1 ON (a1.access_id = f1.access_id) LEFT JOIN t1 f2 ON (f2.access_id=3 AND f2.faq_group_id = t1.faq_group_id) LEFT JOIN t2 a2 ON (a2.access_id = f2.access_id), t2 f_acc WHERE LEAST(a1.rank,a2.rank) = f_acc.rank;
-DROP TABLE t1,t2;
-
-#
-# Test for GREATEST() and LEAST() bug, which segfaulted 4.1.1 server
-#
-CREATE TABLE t1 (d varchar(6), k int);
-INSERT INTO t1 VALUES (NULL, 2);
-SELECT GREATEST(d,d) FROM t1 WHERE k=2;
-DROP TABLE t1;
-
-#
-# Bug #6138: mod and doubles
-#
-
-select 1197.90 mod 50;
-select 5.1 mod 3, 5.1 mod -3, -5.1 mod 3, -5.1 mod -3;
-
-#
-# Test for mod and signed integers
-#
-
-select 5 mod 3, 5 mod -3, -5 mod 3, -5 mod -3;
-
-#
-# Bug#23411: The "%" (MOD) operator is not documented; MOD-ing zero returns strange result
-# Manual: "Division by zero produces a NULL result"
-#
-select (12%0) <=> null as '1';
-select (12%0) is null as '1';
-select 12%0 as 'NULL';
-select 12%2 as '0';
-select 12%NULL as 'NULL';
-select 12 % null as 'NULL';
-select null % 12 as 'NULL';
-select null % 0 as 'NULL';
-select 0 % null as 'NULL';
-select null % null as 'NULL';
-
-select (12 mod 0) <=> null as '1';
-select (12 mod 0) is null as '1';
-select 12 mod 0 as 'NULL';
-select 12 mod 2 as '0';
-select 12 mod null as 'NULL';
-select null mod 12 as 'NULL';
-select null mod 0 as 'NULL';
-select 0 mod null as 'NULL';
-select null mod null as 'NULL';
-
-select mod(12.0, 0) as 'NULL';
-select mod(12, 0.0) as 'NULL';
-select mod(12, NULL) as 'NULL';
-select mod(12.0, NULL) as 'NULL';
-select mod(NULL, 2) as 'NULL';
-select mod(NULL, 2.0) as 'NULL';
-
-
-#
-# Bug#6726: NOT BETWEEN parse failure
-#
-create table t1 (a int, b int);
-insert into t1 values (1,2), (2,3), (3,4), (4,5);
-select * from t1 where a not between 1 and 2;
-select * from t1 where a not between 1 and 2 and b not between 3 and 4;
-drop table t1;
-
-#
-# Test for bug #12791: one of the arguments of LEAST/GREATEST is NULL
-#
-
-SELECT GREATEST(1,NULL) FROM DUAL;
-SELECT LEAST('xxx','aaa',NULL,'yyy') FROM DUAL;
-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);
-
-select not 1, not null, not not null, 1 is not null;
-
-drop table t1;
-
---echo #
---echo # Start of 10.0 tests
---echo #
-
---echo #
---echo # MDEV-7001 Bad result for NOT NOT STRCMP('a','b') and NOT NOT NULLIF(2,3)
---echo #
-SELECT NOT NOT strcmp('a','b');
-EXPLAIN EXTENDED SELECT NOT NOT strcmp('a','b');
-
---echo #
---echo # End of 10.0 tests
---echo #
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-8167 XOR returns bad results for an indexed column
---echo #
-CREATE TABLE t1 (
- id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
- k INTEGER UNSIGNED DEFAULT '0' NOT NULL,
- c CHAR(120) DEFAULT '' NOT NULL,
- pad CHAR(60) DEFAULT '' NOT NULL,
- PRIMARY KEY (id)
-) ENGINE=MyISAM;
-INSERT INTO t1 (k, c, pad) VALUES (10, 'a', 'xxx');
-INSERT INTO t1 (k, c, pad) VALUES (11, 'a', 'xxx');
-INSERT INTO t1 (k, c, pad) VALUES (12, 'a', 'xxx');
-INSERT INTO t1 (k, c, pad) VALUES (13, 'a', 'xxx');
-INSERT INTO t1 (k, c, pad) VALUES (14, 'a', 'xxx');
-INSERT INTO t1 (k, c, pad) VALUES (15, 'a', 'xxx');
-INSERT INTO t1 (k, c, pad) VALUES (16, 'a', 'xxx');
-SELECT * FROM t1 WHERE id XOR 0;
-SELECT * FROM t1 IGNORE KEY(PRIMARY) WHERE id XOR 0;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8871 Wrong result for CREATE TABLE .. SELECT LEAST(unsigned_column,unsigned_column)
---echo #
-CREATE TABLE t1 (a INT,b INT UNSIGNED);
-INSERT INTO t1 VALUES (-2147483648,4294967295);
---vertical_results
-SELECT a, b, LEAST(a,a), LEAST(b,b), LEAST(a,b), LEAST(b,a), GREATEST(a,b), GREATEST(b,a) FROM t1;
---horizontal_results
-CREATE TABLE t2 AS
-SELECT a, b, LEAST(a,a), LEAST(b,b), LEAST(a,b), LEAST(b,a), GREATEST(a,b), GREATEST(b,a) FROM t1;
-SHOW CREATE TABLE t2;
---vertical_results
-SELECT * FROM t2;
---horizontal_results
-DROP TABLE t2;
-DROP TABLE t1;
-
-
---echo #
---echo # End of 10.1 tests
---echo #
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
deleted file mode 100644
index 5417cb20a92..00000000000
--- a/mysql-test/t/func_time.test
+++ /dev/null
@@ -1,2059 +0,0 @@
-#
-# time functions
-#
---disable_warnings
-drop table if exists t1,t2,t3;
---enable_warnings
-
-# Set timezone to GMT-3, to make it possible to use "interval 3 hour"
-set time_zone="+03:00";
-
-select from_days(to_days("960101")),to_days(960201)-to_days("19960101"),to_days(date_add(curdate(), interval 1 day))-to_days(curdate()),weekday("1997-11-29");
-select period_add("9602",-12),period_diff(199505,"9404") ;
-
-select now()-now(),weekday(curdate())-weekday(now()),unix_timestamp()-unix_timestamp(now());
-select from_unixtime(unix_timestamp("1994-03-02 10:11:12")),from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s"),from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0;
-select sec_to_time(9001),sec_to_time(9001)+0,time_to_sec("15:12:22"),
- sec_to_time(time_to_sec("0:30:47")/6.21);
-select sec_to_time(9001.1), time_to_sec('15:12:22.123456'), time_to_sec(15.5566778899);
-select sec_to_time(time_to_sec('-838:59:59'));
-select sec_to_time('9001.1'), sec_to_time('1234567890123.123');
-select sec_to_time(-9001.1), sec_to_time(-9001.1) / 1,
- sec_to_time(-9001.1) / 1e0, sec_to_time(-9001) div 1;
---replace_result e+042 e+42
-select sec_to_time(90011e-1), sec_to_time(1234567890123e30);
-select sec_to_time(1234567890123), sec_to_time('99999999999999999999999999999');
-select now()-curdate()*1000000-curtime();
-select strcmp(current_timestamp(),concat(current_date()," ",current_time()));
-select strcmp(localtime(),concat(current_date()," ",current_time()));
-select strcmp(localtimestamp(),concat(current_date()," ",current_time()));
-select date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w");
-select date_format("1997-01-02", concat("%M %W %D ","%Y %y %m %d %h %i %s %w"));
-select dayofmonth("1997-01-02"),dayofmonth(19970323);
-select month("1997-01-02"),year("98-02-03"),dayofyear("1997-12-31");
-select month("2001-02-00"),year("2001-00-00");
-select DAYOFYEAR("1997-03-03"), WEEK("1998-03-03"), QUARTER(980303);
-select HOUR("1997-03-03 23:03:22"), MINUTE("23:03:22"), SECOND(230322);
-select TIME(230322), TIME(230322.33), TIME("230322.33");
-
-# Test of week and yearweek
-select week(19980101),week(19970101),week(19980101,1),week(19970101,1);
-select week(19981231),week(19971231),week(19981231,1),week(19971231,1);
-select week(19950101),week(19950101,1);
-select yearweek('1981-12-31',1),yearweek('1982-01-01',1),yearweek('1982-12-31',1),yearweek('1983-01-01',1);
-select yearweek('1987-01-01',1),yearweek('1987-01-01');
-select week("2000-01-01",0) as '2000', week("2001-01-01",0) as '2001', week("2002-01-01",0) as '2002',week("2003-01-01",0) as '2003', week("2004-01-01",0) as '2004', week("2005-01-01",0) as '2005', week("2006-01-01",0) as '2006';
-select week("2000-01-06",0) as '2000', week("2001-01-06",0) as '2001', week("2002-01-06",0) as '2002',week("2003-01-06",0) as '2003', week("2004-01-06",0) as '2004', week("2005-01-06",0) as '2005', week("2006-01-06",0) as '2006';
-select week("2000-01-01",1) as '2000', week("2001-01-01",1) as '2001', week("2002-01-01",1) as '2002',week("2003-01-01",1) as '2003', week("2004-01-01",1) as '2004', week("2005-01-01",1) as '2005', week("2006-01-01",1) as '2006';
-select week("2000-01-06",1) as '2000', week("2001-01-06",1) as '2001', week("2002-01-06",1) as '2002',week("2003-01-06",1) as '2003', week("2004-01-06",1) as '2004', week("2005-01-06",1) as '2005', week("2006-01-06",1) as '2006';
-select yearweek("2000-01-01",0) as '2000', yearweek("2001-01-01",0) as '2001', yearweek("2002-01-01",0) as '2002',yearweek("2003-01-01",0) as '2003', yearweek("2004-01-01",0) as '2004', yearweek("2005-01-01",0) as '2005', yearweek("2006-01-01",0) as '2006';
-select yearweek("2000-01-06",0) as '2000', yearweek("2001-01-06",0) as '2001', yearweek("2002-01-06",0) as '2002',yearweek("2003-01-06",0) as '2003', yearweek("2004-01-06",0) as '2004', yearweek("2005-01-06",0) as '2005', yearweek("2006-01-06",0) as '2006';
-select yearweek("2000-01-01",1) as '2000', yearweek("2001-01-01",1) as '2001', yearweek("2002-01-01",1) as '2002',yearweek("2003-01-01",1) as '2003', yearweek("2004-01-01",1) as '2004', yearweek("2005-01-01",1) as '2005', yearweek("2006-01-01",1) as '2006';
-select yearweek("2000-01-06",1) as '2000', yearweek("2001-01-06",1) as '2001', yearweek("2002-01-06",1) as '2002',yearweek("2003-01-06",1) as '2003', yearweek("2004-01-06",1) as '2004', yearweek("2005-01-06",1) as '2005', yearweek("2006-01-06",1) as '2006';
-select week(19981231,2), week(19981231,3), week(20000101,2), week(20000101,3);
-select week(20001231,2),week(20001231,3);
-
-select week(19981231,0) as '0', week(19981231,1) as '1', week(19981231,2) as '2', week(19981231,3) as '3', week(19981231,4) as '4', week(19981231,5) as '5', week(19981231,6) as '6', week(19981231,7) as '7';
-select week(20000101,0) as '0', week(20000101,1) as '1', week(20000101,2) as '2', week(20000101,3) as '3', week(20000101,4) as '4', week(20000101,5) as '5', week(20000101,6) as '6', week(20000101,7) as '7';
-select week(20000106,0) as '0', week(20000106,1) as '1', week(20000106,2) as '2', week(20000106,3) as '3', week(20000106,4) as '4', week(20000106,5) as '5', week(20000106,6) as '6', week(20000106,7) as '7';
-select week(20001231,0) as '0', week(20001231,1) as '1', week(20001231,2) as '2', week(20001231,3) as '3', week(20001231,4) as '4', week(20001231,5) as '5', week(20001231,6) as '6', week(20001231,7) as '7';
-select week(20010101,0) as '0', week(20010101,1) as '1', week(20010101,2) as '2', week(20010101,3) as '3', week(20010101,4) as '4', week(20010101,5) as '5', week(20010101,6) as '6', week(20010101,7) as '7';
-
-select yearweek(20001231,0), yearweek(20001231,1), yearweek(20001231,2), yearweek(20001231,3), yearweek(20001231,4), yearweek(20001231,5), yearweek(20001231,6), yearweek(20001231,7);
-
-set default_week_format = 6;
-select week(20001231), week(20001231,6);
-set default_week_format = 0;
-
-set default_week_format = 2;
-select week(20001231),week(20001231,2),week(20001231,0);
-set default_week_format = 0;
-
-select date_format('1998-12-31','%x-%v'),date_format('1999-01-01','%x-%v');
-select date_format('1999-12-31','%x-%v'),date_format('2000-01-01','%x-%v');
-
-select dayname("1962-03-03"),dayname("1962-03-03")+0;
-select monthname("1972-03-04"),monthname("1972-03-04")+0;
-select time_format(000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
-select time_format(010203,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131010203,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
-select time_format(131415,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131131415,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
-select time_format(010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
-select date_format(concat('19980131',131415),'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w');
-select date_format(19980021000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w');
-select date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND);
-select date_add("1997-12-31 23:59:59",INTERVAL 1 MINUTE);
-select date_add("1997-12-31 23:59:59",INTERVAL 1 HOUR);
-select date_add("1997-12-31 23:59:59",INTERVAL 1 DAY);
-select date_add("1997-12-31 23:59:59",INTERVAL 1 MONTH);
-select date_add("1997-12-31 23:59:59",INTERVAL 1 YEAR);
-select date_add("1997-12-31 23:59:59",INTERVAL "1:1" MINUTE_SECOND);
-select date_add("1997-12-31 23:59:59",INTERVAL "1:1" HOUR_MINUTE);
-select date_add("1997-12-31 23:59:59",INTERVAL "1:1" DAY_HOUR);
-select date_add("1997-12-31 23:59:59",INTERVAL "1 1" YEAR_MONTH);
-select date_add("1997-12-31 23:59:59",INTERVAL "1:1:1" HOUR_SECOND);
-select date_add("1997-12-31 23:59:59",INTERVAL "1 1:1" DAY_MINUTE);
-select date_add("1997-12-31 23:59:59",INTERVAL "1 1:1:1" DAY_SECOND);
-
-select date_sub("1998-01-01 00:00:00",INTERVAL 1 SECOND);
-select date_sub("1998-01-01 00:00:00",INTERVAL 1 MINUTE);
-select date_sub("1998-01-01 00:00:00",INTERVAL 1 HOUR);
-select date_sub("1998-01-01 00:00:00",INTERVAL 1 DAY);
-select date_sub("1998-01-01 00:00:00",INTERVAL 1 MONTH);
-select date_sub("1998-01-01 00:00:00",INTERVAL 1 YEAR);
-select date_sub("1998-01-01 00:00:00",INTERVAL "1:1" MINUTE_SECOND);
-select date_sub("1998-01-01 00:00:00",INTERVAL "1:1" HOUR_MINUTE);
-select date_sub("1998-01-01 00:00:00",INTERVAL "1:1" DAY_HOUR);
-select date_sub("1998-01-01 00:00:00",INTERVAL "1 1" YEAR_MONTH);
-select date_sub("1998-01-01 00:00:00",INTERVAL "1:1:1" HOUR_SECOND);
-select date_sub("1998-01-01 00:00:00",INTERVAL "1 1:1" DAY_MINUTE);
-select date_sub("1998-01-01 00:00:00",INTERVAL "1 1:1:1" DAY_SECOND);
-
-select date_add("1997-12-31 23:59:59",INTERVAL 100000 SECOND);
-select date_add("1997-12-31 23:59:59",INTERVAL -100000 MINUTE);
-select date_add("1997-12-31 23:59:59",INTERVAL 100000 HOUR);
-select date_add("1997-12-31 23:59:59",INTERVAL -100000 DAY);
-select date_add("1997-12-31 23:59:59",INTERVAL 100000 MONTH);
-select date_add("1997-12-31 23:59:59",INTERVAL -100000 YEAR);
-select date_add("1997-12-31 23:59:59",INTERVAL "10000:1" MINUTE_SECOND);
-select date_add("1997-12-31 23:59:59",INTERVAL "-10000:1" HOUR_MINUTE);
-select date_add("1997-12-31 23:59:59",INTERVAL "10000:1" DAY_HOUR);
-select date_add("1997-12-31 23:59:59",INTERVAL "-100 1" YEAR_MONTH);
-select date_add("1997-12-31 23:59:59",INTERVAL "10000:99:99" HOUR_SECOND);
-select date_add("1997-12-31 23:59:59",INTERVAL " -10000 99:99" DAY_MINUTE);
-select date_add("1997-12-31 23:59:59",INTERVAL "10000 99:99:99" DAY_SECOND);
-select "1997-12-31 23:59:59" + INTERVAL 1 SECOND;
-select INTERVAL 1 DAY + "1997-12-31";
-select "1998-01-01 00:00:00" - INTERVAL 1 SECOND;
-
-select date_sub("1998-01-02",INTERVAL 31 DAY);
-select date_add("1997-12-31",INTERVAL 1 SECOND);
-select date_add("1997-12-31",INTERVAL 1 DAY);
-select date_add(NULL,INTERVAL 100000 SECOND);
-select date_add("1997-12-31 23:59:59",INTERVAL NULL SECOND);
-select date_add("1997-12-31 23:59:59",INTERVAL NULL MINUTE_SECOND);
-select date_add("9999-12-31 23:59:59",INTERVAL 1 SECOND);
-select date_sub("0000-00-00 00:00:00",INTERVAL 1 SECOND);
-select date_add('1998-01-30',Interval 1 month);
-select date_add('1998-01-30',Interval '2:1' year_month);
-select date_add('1996-02-29',Interval '1' year);
-select extract(YEAR FROM "1999-01-02 10:11:12");
-select extract(YEAR_MONTH FROM "1999-01-02");
-select extract(DAY FROM "1999-01-02");
-select extract(DAY_HOUR FROM "1999-01-02 10:11:12");
-select extract(DAY_MINUTE FROM "02 10:11:12");
-select extract(DAY_SECOND FROM "225 10:11:12");
-select extract(HOUR FROM "1999-01-02 10:11:12");
-select extract(HOUR_MINUTE FROM "10:11:12");
-select extract(HOUR_SECOND FROM "10:11:12");
-select extract(MINUTE FROM "10:11:12");
-select extract(MINUTE_SECOND FROM "10:11:12");
-select extract(SECOND FROM "1999-01-02 10:11:12");
-select extract(MONTH FROM "2001-02-00");
-
-#
-# test EXTRACT QUARTER (Bug #18100)
-#
-
-SELECT EXTRACT(QUARTER FROM '2004-01-15') AS quarter;
-SELECT EXTRACT(QUARTER FROM '2004-02-15') AS quarter;
-SELECT EXTRACT(QUARTER FROM '2004-03-15') AS quarter;
-SELECT EXTRACT(QUARTER FROM '2004-04-15') AS quarter;
-SELECT EXTRACT(QUARTER FROM '2004-05-15') AS quarter;
-SELECT EXTRACT(QUARTER FROM '2004-06-15') AS quarter;
-SELECT EXTRACT(QUARTER FROM '2004-07-15') AS quarter;
-SELECT EXTRACT(QUARTER FROM '2004-08-15') AS quarter;
-SELECT EXTRACT(QUARTER FROM '2004-09-15') AS quarter;
-SELECT EXTRACT(QUARTER FROM '2004-10-15') AS quarter;
-SELECT EXTRACT(QUARTER FROM '2004-11-15') AS quarter;
-SELECT EXTRACT(QUARTER FROM '2004-12-15') AS quarter;
-#
-# MySQL Bugs: #12356: DATE_SUB or DATE_ADD incorrectly returns null
-#
-SELECT DATE_SUB(str_to_date('9999-12-31 00:01:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE);
-SELECT DATE_ADD(str_to_date('9999-12-30 23:59:00','%Y-%m-%d %H:%i:%s'), INTERVAL 1 MINUTE);
-
-#
-# Test big intervals (Bug #3498)
-#
-SELECT "1900-01-01 00:00:00" + INTERVAL 2147483648 SECOND;
-SELECT "1900-01-01 00:00:00" + INTERVAL "1:2147483647" MINUTE_SECOND;
-SELECT "1900-01-01 00:00:00" + INTERVAL "100000000:214748364700" MINUTE_SECOND;SELECT "1900-01-01 00:00:00" + INTERVAL 1<<37 SECOND;
-SELECT "1900-01-01 00:00:00" + INTERVAL 1<<31 MINUTE;
-SELECT "1900-01-01 00:00:00" + INTERVAL 1<<20 HOUR;
-
-SELECT "1900-01-01 00:00:00" + INTERVAL 1<<38 SECOND;
-SELECT "1900-01-01 00:00:00" + INTERVAL 1<<33 MINUTE;
-SELECT "1900-01-01 00:00:00" + INTERVAL 1<<30 HOUR;
-SELECT "1900-01-01 00:00:00" + INTERVAL "1000000000:214748364700" MINUTE_SECOND;
-
-#
-# Bug #614 (multiple extracts in where)
-#
-
-create table t1 (ctime varchar(20));
-insert into t1 values ('2001-01-12 12:23:40');
-select ctime, hour(ctime) from t1;
-select ctime from t1 where extract(MONTH FROM ctime) = 1 AND extract(YEAR FROM ctime) = 2001;
-drop table t1;
-
-#
-# Test bug with monthname() and NULL
-#
-
-create table t1 (id int);
-create table t2 (id int, date date);
-insert into t1 values (1);
-insert into t2 values (1, "0000-00-00");
-insert into t1 values (2);
-insert into t2 values (2, "2000-01-01");
-select monthname(date) from t1 inner join t2 on t1.id = t2.id;
-select monthname(date) from t1 inner join t2 on t1.id = t2.id order by t1.id;
-drop table t1,t2;
-
-#
-# Test bug with month() and year() on text fields with wrong information
-
-CREATE TABLE t1 (updated text) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('');
-SELECT month(updated) from t1;
-SELECT year(updated) from t1;
-drop table t1;
-
-#
-# Check that functions work identically on 0000-00-00 as a constant and on a
-# column
-#
-
-create table t1 (d date, dt datetime, t timestamp, c char(10));
-insert into t1 values ("0000-00-00", "0000-00-00", "0000-00-00", "0000-00-00");
-select dayofyear("0000-00-00"),dayofyear(d),dayofyear(dt),dayofyear(t),dayofyear(c) from t1;
-select dayofmonth("0000-00-00"),dayofmonth(d),dayofmonth(dt),dayofmonth(t),dayofmonth(c) from t1;
-select month("0000-00-00"),month(d),month(dt),month(t),month(c) from t1;
-select quarter("0000-00-00"),quarter(d),quarter(dt),quarter(t),quarter(c) from t1;
-select week("0000-00-00"),week(d),week(dt),week(t),week(c) from t1;
-select year("0000-00-00"),year(d),year(dt),year(t),year(c) from t1;
-select yearweek("0000-00-00"),yearweek(d),yearweek(dt),yearweek(t),yearweek(c) from t1;
-select to_days("0000-00-00"),to_days(d),to_days(dt),to_days(t),to_days(c) from t1;
-select extract(MONTH FROM "0000-00-00"),extract(MONTH FROM d),extract(MONTH FROM dt),extract(MONTH FROM t),extract(MONTH FROM c) from t1;
-drop table t1;
-
-
-#
-# Test problem with TIMESTAMP and BETWEEN
-#
-
-CREATE TABLE t1 ( start datetime default NULL);
-INSERT INTO t1 VALUES ('2002-10-21 00:00:00'),('2002-10-28 00:00:00'),('2002-11-04 00:00:00');
-CREATE TABLE t2 ( ctime1 timestamp NOT NULL, ctime2 timestamp NOT NULL);
-INSERT INTO t2 VALUES (20021029165106,20021105164731);
-CREATE TABLE t3 (ctime1 char(19) NOT NULL, ctime2 char(19) NOT NULL);
-INSERT INTO t3 VALUES ("2002-10-29 16:51:06","2002-11-05 16:47:31");
-
-# The following statement should be fixed to return a row in 4.1
-select * from t1, t2 where t1.start between t2.ctime1 and t2.ctime2;
-select * from t1, t2 where t1.start >= t2.ctime1 and t1.start <= t2.ctime2;
-select * from t1, t3 where t1.start between t3.ctime1 and t3.ctime2;
-drop table t1,t2,t3;
-
-#
-# Test unix timestamp
-#
-select @a:=FROM_UNIXTIME(1);
-select unix_timestamp(@a);
-select unix_timestamp('1969-12-01 19:00:01');
-
-#
-# Tests for bug #6439 "unix_timestamp() function returns wrong datetime
-# values for too big argument", bug #7515 "from_unixtime(0) now
-# returns NULL instead of the epoch" and bug #9191
-# "TIMESTAMP/from_unixtime() no longer accepts 2^31-1."
-# unix_timestamp() should return error for too big or negative argument.
-# It should return Epoch value for zero argument since it seems that many
-# users rely on this fact, from_unixtime() should work with values
-# up to INT_MAX32 because of the same reason.
-#
-select from_unixtime(-1);
-# check for from_unixtime(2^31-1) and from_unixtime(2^31)
-select from_unixtime(2147483647);
-select from_unixtime(2147483648);
-select from_unixtime(0);
-
-#
-# Some more tests for bug #9191 "TIMESTAMP/from_unixtime() no
-# longer accepts 2^31-1". Here we test that from_unixtime and
-# unix_timestamp are consistent, when working with boundary dates.
-#
-select unix_timestamp(from_unixtime(2147483647));
-select unix_timestamp(from_unixtime(2147483648));
-
-# check for invalid dates
-
-# bad year
-select unix_timestamp('2039-01-20 01:00:00');
-select unix_timestamp('1968-01-20 01:00:00');
-# bad month
-select unix_timestamp('2038-02-10 01:00:00');
-select unix_timestamp('1969-11-20 01:00:00');
-# bad day
-select unix_timestamp('2038-01-20 01:00:00');
-select unix_timestamp('1969-12-30 01:00:00');
-
-#
-# Check negative shift (we subtract several days for boundary dates during
-# conversion).
-select unix_timestamp('2038-01-17 12:00:00');
-
-#
-# Check positive shift. (it happens only on
-# platfroms with unsigned time_t, such as QNX)
-#
-select unix_timestamp('1970-01-01 03:00:01');
-
-# check bad date, close to the boundary (we cut them off in the very end)
-select unix_timestamp('2038-01-19 07:14:07');
-
-#
-# Bug #28759: DAYNAME() and MONTHNAME() return binary string
-#
-
-SELECT CHARSET(DAYNAME(19700101));
-SELECT CHARSET(MONTHNAME(19700101));
-SELECT LOWER(DAYNAME(19700101));
-SELECT LOWER(MONTHNAME(19700101));
-SELECT COERCIBILITY(MONTHNAME('1970-01-01')),COERCIBILITY(DAYNAME('1970-01-01'));
-
-#
-# Test types from + INTERVAL
-#
-
-CREATE TABLE t1 (datetime datetime, timestamp timestamp, date date, time time);
-INSERT INTO t1 values ("2001-01-02 03:04:05", "2002-01-02 03:04:05", "2003-01-02", "06:07:08");
-SELECT * from t1;
-select date_add("1997-12-31",INTERVAL 1 SECOND);
-select date_add("1997-12-31",INTERVAL "1 1" YEAR_MONTH);
-
-select date_add(datetime, INTERVAL 1 SECOND) from t1;
-select date_add(datetime, INTERVAL 1 YEAR) from t1;
-
-select date_add(date,INTERVAL 1 SECOND) from t1;
-select date_add(date,INTERVAL 1 MINUTE) from t1;
-select date_add(date,INTERVAL 1 HOUR) from t1;
-select date_add(date,INTERVAL 1 DAY) from t1;
-select date_add(date,INTERVAL 1 MONTH) from t1;
-select date_add(date,INTERVAL 1 YEAR) from t1;
-select date_add(date,INTERVAL "1:1" MINUTE_SECOND) from t1;
-select date_add(date,INTERVAL "1:1" HOUR_MINUTE) from t1;
-select date_add(date,INTERVAL "1:1" DAY_HOUR) from t1;
-select date_add(date,INTERVAL "1 1" YEAR_MONTH) from t1;
-select date_add(date,INTERVAL "1:1:1" HOUR_SECOND) from t1;
-select date_add(date,INTERVAL "1 1:1" DAY_MINUTE) from t1;
-select date_add(date,INTERVAL "1 1:1:1" DAY_SECOND) from t1;
-select date_add(date,INTERVAL "1" WEEK) from t1;
-select date_add(date,INTERVAL "1" QUARTER) from t1;
-select timestampadd(MINUTE, 1, date) from t1;
-select timestampadd(WEEK, 1, date) from t1;
-select timestampadd(SQL_TSI_SECOND, 1, date) from t1;
-
-select timestampdiff(MONTH, '2001-02-01', '2001-05-01') as a;
-select timestampdiff(YEAR, '2002-05-01', '2001-01-01') as a;
-select timestampdiff(QUARTER, '2002-05-01', '2001-01-01') as a;
-select timestampdiff(MONTH, '2000-03-28', '2000-02-29') as a;
-select timestampdiff(MONTH, '1991-03-28', '2000-02-29') as a;
-select timestampdiff(SQL_TSI_WEEK, '2001-02-01', '2001-05-01') as a;
-select timestampdiff(SQL_TSI_HOUR, '2001-02-01', '2001-05-01') as a;
-select timestampdiff(SQL_TSI_DAY, '2001-02-01', '2001-05-01') as a;
-select timestampdiff(SQL_TSI_MINUTE, '2001-02-01 12:59:59', '2001-05-01 12:58:59') as a;
-select timestampdiff(SQL_TSI_SECOND, '2001-02-01 12:59:59', '2001-05-01 12:58:58') as a;
-
-select timestampdiff(SQL_TSI_DAY, '1986-02-01', '1986-03-01') as a1,
- timestampdiff(SQL_TSI_DAY, '1900-02-01', '1900-03-01') as a2,
- timestampdiff(SQL_TSI_DAY, '1996-02-01', '1996-03-01') as a3,
- timestampdiff(SQL_TSI_DAY, '2000-02-01', '2000-03-01') as a4;
-
-# bug 16226
-SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-11 14:30:27');
-SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-11 14:30:28');
-SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-11 14:30:29');
-SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-12 14:30:27');
-SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-12 14:30:28');
-SELECT TIMESTAMPDIFF(day,'2006-01-10 14:30:28','2006-01-12 14:30:29');
-
-SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-17 14:30:27');
-SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-17 14:30:28');
-SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-17 14:30:29');
-SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-24 14:30:27');
-SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-24 14:30:28');
-SELECT TIMESTAMPDIFF(week,'2006-01-10 14:30:28','2006-01-24 14:30:29');
-
-SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-02-10 14:30:27');
-SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-02-10 14:30:28');
-SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-02-10 14:30:29');
-SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-03-10 14:30:27');
-SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-03-10 14:30:28');
-SELECT TIMESTAMPDIFF(month,'2006-01-10 14:30:28','2006-03-10 14:30:29');
-
-SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2007-01-10 14:30:27');
-SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2007-01-10 14:30:28');
-SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2007-01-10 14:30:29');
-SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:27');
-SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:28');
-SELECT TIMESTAMPDIFF(year,'2006-01-10 14:30:28','2008-01-10 14:30:29');
-
-# end of bug
-
-select date_add(time,INTERVAL 1 SECOND) from t1;
-drop table t1;
-
-# test for last_day
-select last_day('2000-02-05') as f1, last_day('2002-12-31') as f2,
- last_day('2003-03-32') as f3, last_day('2003-04-01') as f4,
- last_day('2001-01-01 01:01:01') as f5, last_day(NULL),
- last_day('2001-02-12');
-
-create table t1 select last_day('2000-02-05') as a,
- from_days(to_days("960101")) as b;
-describe t1;
-select * from t1;
-drop table t1;
-select last_day('2000-02-05') as a,
- from_days(to_days("960101")) as b;
-
-select date_add(last_day("1997-12-1"), INTERVAL 1 DAY);
-select length(last_day("1997-12-1"));
-select last_day("1997-12-1")+0;
-select last_day("1997-12-1")+0.0;
-
-# Test SAPDB UTC_% functions. This part is TZ dependant (It is supposed that
-# TZ variable set to GMT-3
-
-select strcmp(date_sub(localtimestamp(), interval 3 hour), utc_timestamp())=0;
-select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%T"), utc_time())=0;
-select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%Y-%m-%d"), utc_date())=0;
-select strcmp(date_format(utc_timestamp(),"%T"), utc_time())=0;
-select strcmp(date_format(utc_timestamp(),"%Y-%m-%d"), utc_date())=0;
-select strcmp(concat(utc_date(),' ',utc_time()),utc_timestamp())=0;
-
-explain extended select period_add("9602",-12),period_diff(199505,"9404"),from_days(to_days("960101")),dayofmonth("1997-01-02"), month("1997-01-02"), monthname("1972-03-04"),dayofyear("0000-00-00"),HOUR("1997-03-03 23:03:22"),MINUTE("23:03:22"),SECOND(230322),QUARTER(980303),WEEK("1998-03-03"),yearweek("2000-01-01",1),week(19950101,1),year("98-02-03"),weekday(curdate())-weekday(now()),dayname("1962-03-03"),unix_timestamp(),sec_to_time(time_to_sec("0:30:47")/6.21),curtime(),utc_time(),curdate(),utc_date(),utc_timestamp(),date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w"),from_unixtime(unix_timestamp("1994-03-02 10:11:12")),"1997-12-31 23:59:59" + INTERVAL 1 SECOND,"1998-01-01 00:00:00" - INTERVAL 1 SECOND,INTERVAL 1 DAY + "1997-12-31", extract(YEAR FROM "1999-01-02 10:11:12"),date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND);
-
-SET @TMP='2007-08-01 12:22:49';
-CREATE TABLE t1 (d DATETIME);
-INSERT INTO t1 VALUES ('2007-08-01 12:22:59');
-INSERT INTO t1 VALUES ('2007-08-01 12:23:01');
-INSERT INTO t1 VALUES ('2007-08-01 12:23:20');
-SELECT count(*) FROM t1 WHERE d>FROM_DAYS(TO_DAYS(@TMP)) AND d<=FROM_DAYS(TO_DAYS(@TMP)+1);
-DROP TABLE t1;
-
-#
-# Bug #10568
-#
-
-select last_day('2005-00-00');
-select last_day('2005-00-01');
-select last_day('2005-01-00');
-
-#
-# Bug #18501: monthname and NULLs
-#
-
-select monthname(str_to_date(null, '%m')), monthname(str_to_date(null, '%m')),
- monthname(str_to_date(1, '%m')), monthname(str_to_date(0, '%m'));
-
-#
-# Bug #16327: problem with timestamp < 1970
-#
-
-set time_zone='-6:00';
-create table t1(a timestamp);
-insert into t1 values (19691231190001);
-select * from t1;
-drop table t1;
-
-#
-# Bug#16377 result of DATE/TIME functions were compared as strings which
-# can lead to a wrong result.
-# Now wrong dates should be compared only with CAST()
-create table t1(f1 date, f2 time, f3 datetime);
-insert into t1 values ("2006-01-01", "12:01:01", "2006-01-01 12:01:01");
-insert into t1 values ("2006-01-02", "12:01:02", "2006-01-02 12:01:02");
-select f1 from t1 where f1 between CAST("2006-1-1" as date) and CAST(20060101 as date);
-select f1 from t1 where f1 between cast("2006-1-1" as date) and cast("2006.1.1" as date);
-select f1 from t1 where date(f1) between cast("2006-1-1" as date) and cast("2006.1.1" as date);
-select f2 from t1 where f2 between cast("12:1:2" as time) and cast("12:2:2" as time);
-select f2 from t1 where time(f2) between cast("12:1:2" as time) and cast("12:2:2" as time);
-select f3 from t1 where f3 between cast("2006-1-1 12:1:1" as datetime) and cast("2006-1-1 12:1:2" as datetime);
-select f3 from t1 where timestamp(f3) between cast("2006-1-1 12:1:1" as datetime) and cast("2006-1-1 12:1:2" as datetime);
-select f1 from t1 where cast("2006-1-1" as date) between f1 and f3;
-select f1 from t1 where cast("2006-1-1" as date) between date(f1) and date(f3);
-select f1 from t1 where cast("2006-1-1" as date) between f1 and cast('zzz' as date);
-select f1 from t1 where makedate(2006,1) between date(f1) and date(f3);
-select f1 from t1 where makedate(2006,2) between date(f1) and date(f3);
-drop table t1;
-
-#
-# Bug #16546
-#
-
-create table t1 select now() - now(), curtime() - curtime(),
- sec_to_time(1) + 0, from_unixtime(1) + 0;
-show create table t1;
-drop table t1;
-
-#
-# Bug #11655: Wrong time is returning from nested selects - maximum time exists
-#
-# check if SEC_TO_TIME() handles out-of-range values correctly
-SELECT SEC_TO_TIME(3300000);
-SELECT SEC_TO_TIME(3300000)+0;
-SELECT SEC_TO_TIME(3600 * 4294967296);
-
-# check if TIME_TO_SEC() handles out-of-range values correctly
-SELECT TIME_TO_SEC('916:40:00');
-
-# check if ADDTIME() handles out-of-range values correctly
-SELECT ADDTIME('500:00:00', '416:40:00');
-SELECT ADDTIME('916:40:00', '416:40:00');
-
-# check if SUBTIME() handles out-of-range values correctly
-SELECT SUBTIME('916:40:00', '416:40:00');
-SELECT SUBTIME('-916:40:00', '416:40:00');
-
-# check if MAKETIME() handles out-of-range values correctly
-SELECT MAKETIME(916,0,0);
-SELECT MAKETIME(4294967296, 0, 0);
-SELECT MAKETIME(-4294967296, 0, 0);
-SELECT MAKETIME(0, 4294967296, 0);
-SELECT MAKETIME(0, 0, 4294967296);
-SELECT MAKETIME(CAST(-1 AS UNSIGNED), 0, 0);
-
-# check if EXTRACT() handles out-of-range values correctly
-SELECT EXTRACT(HOUR FROM '10000:02:03');
-
-# check if we get proper warnings if both input string truncation
-# and out-of-range value occur
-CREATE TABLE t1(f1 TIME);
-INSERT IGNORE INTO t1 VALUES('916:00:00 a');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-#
-# Bug #20927: sec_to_time treats big unsigned as signed
-#
-# check if SEC_TO_TIME() handles BIGINT UNSIGNED values correctly
---replace_regex /'1.8446.*e.*19'/'1.84467440737096e+19'/
-SELECT SEC_TO_TIME(CAST(-1 AS UNSIGNED));
-
-#
-# 21913: DATE_FORMAT() Crashes mysql server if I use it through
-# mysql-connector-j driver.
-#
-
-SET NAMES latin1;
-SET character_set_results = NULL;
-SHOW VARIABLES LIKE 'character_set_results';
-
-CREATE TABLE testBug8868 (field1 DATE, field2 VARCHAR(32) CHARACTER SET BINARY);
-INSERT INTO testBug8868 VALUES ('2006-09-04', 'abcd');
-
-SELECT DATE_FORMAT(field1,'%b-%e %l:%i%p') as fmtddate, field2 FROM testBug8868;
-
-DROP TABLE testBug8868;
-
-SET NAMES DEFAULT;
-
-#
-# Bug #31160: MAKETIME() crashes server when returning NULL in ORDER BY using
-# filesort
-#
-CREATE TABLE t1 (
- a TIMESTAMP
-);
-INSERT INTO t1 VALUES (now()), (now());
-SELECT 1 FROM t1 ORDER BY MAKETIME(1, 1, a);
-DROP TABLE t1;
-#
-# Bug #19844 time_format in Union truncates values
-#
-
-(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H)
-union
-(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H);
-(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%k') As H)
-union
-(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%k') As H);
-(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%H') As H)
-union
-(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%H') As H);
-
-(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H)
-union
-(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H);
-
-#
-# Bug #23653: crash if last_day('0000-00-00')
-#
-
-select last_day('0000-00-00');
-
-#
-# Bug 23616: datetime functions with double argumets
-#
-
-select isnull(week(now() + 0)), isnull(week(now() + 0.2)),
- week(20061108), week(20061108.01), week(20061108085411.000002);
-
---echo End of 4.1 tests
-
-#
-# Bug #10590: %h, %I, and %l format specifies should all return results in
-# the 0-11 range
-#
-select time_format('100:00:00', '%H %k %h %I %l');
-
-#
-# Bug #12562: Make SYSDATE behave like it does in Oracle: always the current
-# time, regardless of magic to make NOW() always the same for the
-# entirety of a statement.
-SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
-SET GLOBAL log_bin_trust_function_creators = 1;
-
-create table t1 (a timestamp default '2005-05-05 01:01:01',
- b timestamp default '2005-05-05 01:01:01');
-delimiter //;
-drop function if exists t_slow_sysdate;
-create function t_slow_sysdate() returns timestamp
-begin
- do sleep(2);
- return sysdate();
-end;
-//
-
-insert into t1 set a = sysdate(), b = t_slow_sysdate();//
-
-create trigger t_before before insert on t1
-for each row begin
- set new.b = t_slow_sysdate();
-end
-//
-
-delimiter ;//
-
-insert into t1 set a = sysdate();
-
-select a != b from t1;
-
-drop trigger t_before;
-drop function t_slow_sysdate;
-drop table t1;
-
-SET GLOBAL log_bin_trust_function_creators = 0;
-
-create table t1 (a datetime, i int, b datetime);
-insert into t1 select sysdate(), sleep(2), sysdate() from dual;
-select a != b from t1;
-drop table t1;
-
-delimiter //;
-create procedure t_sysdate()
-begin
- select sysdate() into @a;
- do sleep(2);
- select sysdate() into @b;
- select @a != @b;
-end;
-//
-delimiter ;//
-call t_sysdate();
-drop procedure t_sysdate;
-SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
-
-#
-# Bug #13534: timestampdiff() returned incorrect results across leap years
-#
-select timestampdiff(month,'2004-09-11','2004-09-11');
-select timestampdiff(month,'2004-09-11','2005-09-11');
-select timestampdiff(month,'2004-09-11','2006-09-11');
-select timestampdiff(month,'2004-09-11','2007-09-11');
-select timestampdiff(month,'2005-09-11','2004-09-11');
-select timestampdiff(month,'2005-09-11','2003-09-11');
-
-select timestampdiff(month,'2004-02-28','2005-02-28');
-select timestampdiff(month,'2004-02-29','2005-02-28');
-select timestampdiff(month,'2004-02-28','2005-02-28');
-select timestampdiff(month,'2004-03-29','2005-03-28');
-select timestampdiff(month,'2003-02-28','2004-02-29');
-select timestampdiff(month,'2003-02-28','2005-02-28');
-
-select timestampdiff(month,'1999-09-11','2001-10-10');
-select timestampdiff(month,'1999-09-11','2001-9-11');
-
-select timestampdiff(year,'1999-09-11','2001-9-11');
-select timestampdiff(year,'2004-02-28','2005-02-28');
-select timestampdiff(year,'2004-02-29','2005-02-28');
-
-#
-# Bug #18618: BETWEEN for dates with the second argument being a constant
-# expression and the first and the third arguments being fields
-#
-
-CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, day date);
-CREATE TABLE t2 (id int NOT NULL PRIMARY KEY, day date);
-
-INSERT INTO t1 VALUES
- (1, '2005-06-01'), (2, '2005-02-01'), (3, '2005-07-01');
-INSERT INTO t2 VALUES
- (1, '2005-08-01'), (2, '2005-06-15'), (3, '2005-07-15');
-
-SELECT * FROM t1, t2
- WHERE t1.day BETWEEN
- '2005.09.01' - INTERVAL 6 MONTH AND t2.day;
-SELECT * FROM t1, t2
- WHERE CAST(t1.day AS DATE) BETWEEN
- '2005.09.01' - INTERVAL 6 MONTH AND t2.day;
-
-DROP TABLE t1,t2;
-
-
-# Restore timezone to default
-set time_zone= @@global.time_zone;
-
-#
-# Bug #22229: bug in DATE_ADD()
-#
-
-select str_to_date('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE;
-select str_to_date("1997-00-04 22:23:00","%Y-%m-%D") + interval 10 minute;
-
-#
-# Bug #21103: DATE column not compared as DATE
-#
-
-create table t1 (field DATE);
-insert into t1 values ('2006-11-06');
-select * from t1 where field < '2006-11-06 04:08:36.0';
-select * from t1 where field = '2006-11-06 04:08:36.0';
-select * from t1 where field = '2006-11-06';
-select * from t1 where CAST(field as DATETIME) < '2006-11-06 04:08:36.0';
-select * from t1 where CAST(field as DATE) < '2006-11-06 04:08:36.0';
-drop table t1;
-
-#
-# Bug #25643: SEC_TO_TIME function problem
-#
-CREATE TABLE t1 (a int, t1 time, t2 time, d date, PRIMARY KEY (a));
-INSERT INTO t1 VALUES (1, '10:00:00', NULL, NULL),
- (2, '11:00:00', '11:15:00', '1972-02-06');
-SELECT t1, t2, SEC_TO_TIME( TIME_TO_SEC( t2 ) - TIME_TO_SEC( t1 ) ), QUARTER(d)
- FROM t1;
-SELECT t1, t2, SEC_TO_TIME( TIME_TO_SEC( t2 ) - TIME_TO_SEC( t1 ) ), QUARTER(d)
- FROM t1 ORDER BY a DESC;
-DROP TABLE t1;
-
-#
-# Bug #20293: group by cuts off value from time_format
-#
-# Check if using GROUP BY with TIME_FORMAT() produces correct results
-
-SELECT TIME_FORMAT(SEC_TO_TIME(a),"%H:%i:%s") FROM (SELECT 3020399 AS a UNION SELECT 3020398 ) x GROUP BY 1;
-
-#
-# Bug#28875 Conversion between ASCII and LATIN1 charsets does not function
-#
-set names latin1;
-create table t1 (a varchar(15) character set ascii not null);
-insert into t1 values ('070514-000000');
-# Conversion of date_format() result to ASCII
-# is safe with the default locale en_US
---replace_column 1 #
-select concat(a,ifnull(min(date_format(now(), '%Y-%m-%d')),' ull')) from t1;
-# Error for swe7: it is not ASCII compatible
-set names swe7;
---error 1267
-select concat(a,ifnull(min(date_format(now(), '%Y-%m-%d')),' ull')) from t1;
-set names latin1;
-# Conversion of date_format() result to ASCII
-# is not safe with the non-default locale fr_FR
-# because month and day names can have accented characters
-set lc_time_names=fr_FR;
---error 1267
-select concat(a,ifnull(min(date_format(now(), '%Y-%m-%d')),' ull')) from t1;
-set lc_time_names=en_US;
-drop table t1;
-
-#
-# Bug#32180: DATE_ADD treats datetime numeric argument as DATE
-# instead of DATETIME
-#
-
-select DATE_ADD('20071108181000', INTERVAL 1 DAY);
-select DATE_ADD(20071108181000, INTERVAL 1 DAY);
-select DATE_ADD('20071108', INTERVAL 1 DAY);
-select DATE_ADD(20071108, INTERVAL 1 DAY);
-
-#
-# Bug#32770: LAST_DAY() returns a DATE, but somehow internally keeps
-# track of the TIME.
-#
-
-select LAST_DAY('2007-12-06 08:59:19.05') - INTERVAL 1 SECOND;
-
-# Bug#33834: FRAC_SECOND: Applicability not clear in documentation
-#
-# Test case removed since FRAC_SECOND was deprecated and
-# removed as part of WL#5154
-#
-
-#
-# Bug #36466:
-# Adding days to day_microsecond changes interpretation of microseconds
-#
-
-# show that we treat fractions of seconds correctly (zerofill from right to
-# six places) even if we left out fields on the left.
-select date_add('1000-01-01 00:00:00', interval '1.03:02:01.05' day_microsecond);
-select date_add('1000-01-01 00:00:00', interval '1.02' day_microsecond);
-
-
---echo #
---echo # Bug #52315 part 2 : utc_date() crashes when system time > year 2037
---echo #
-
---disable_result_log
-SET TIMESTAMP=-147490000; SELECT UTC_TIMESTAMP();
---error 0,ER_WRONG_VALUE_FOR_VAR
-SET TIMESTAMP=2147483648; SELECT UTC_TIMESTAMP();
-SET TIMESTAMP=2147483646; SELECT UTC_TIMESTAMP();
-SET TIMESTAMP=2147483647; SELECT UTC_TIMESTAMP();
-SET TIMESTAMP=0; SELECT UTC_TIMESTAMP();
-SET TIMESTAMP=-1; SELECT UTC_TIMESTAMP();
-SET TIMESTAMP=1; SELECT UTC_TIMESTAMP();
---enable_result_log
-
-#reset back the timestamp value
-SET TIMESTAMP=0;
-
-
---echo End of 5.0 tests
-
-#
-# Bug #18997
-#
-
-select date_sub("0050-01-01 00:00:01",INTERVAL 2 SECOND);
-select date_sub("0199-01-01 00:00:01",INTERVAL 2 SECOND);
-select date_add("0199-12-31 23:59:59",INTERVAL 2 SECOND);
-select date_sub("0200-01-01 00:00:01",INTERVAL 2 SECOND);
-select date_sub("0200-01-01 00:00:01",INTERVAL 1 SECOND);
-select date_sub("0200-01-01 00:00:01",INTERVAL 2 SECOND);
-select date_add("2001-01-01 23:59:59",INTERVAL -2000 YEAR);
-select date_sub("50-01-01 00:00:01",INTERVAL 2 SECOND);
-select date_sub("90-01-01 00:00:01",INTERVAL 2 SECOND);
-select date_sub("0069-01-01 00:00:01",INTERVAL 2 SECOND);
-select date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND);
-
-
-#
-# Bug #55565: debug assertion when ordering by expressions with user
-# variable assignments
-#
-
-CREATE TABLE t1(a DOUBLE NOT NULL);
-INSERT INTO t1 VALUES (0),(9.216e-096);
---echo # should not crash
-SELECT 1 FROM t1 ORDER BY @x:=makedate(a,a);
-DROP TABLE t1;
-
---echo #
---echo # Bug #52160: crash and inconsistent results when grouping
---echo # by a function and column
---echo #
-
-CREATE TABLE t1(a CHAR(10) NOT NULL);
-INSERT INTO t1 VALUES (''),('');
-SELECT COUNT(*) FROM t1 GROUP BY TIME_TO_SEC(a);
-DROP TABLE t1;
-
---echo #
---echo # Bug#11766112 59151:UNINITIALIZED VALUES IN EXTRACT_DATE_TIME WITH STR_TO_DATE(SPACE(..) ...
---echo #
-
-SELECT STR_TO_DATE(SPACE(2),'1');
-
---echo #
---echo # Bug#11765216 58154: UNINITIALIZED VARIABLE FORMAT IN STR_TO_DATE FUNCTION
---echo #
-
-SET GLOBAL SQL_MODE='';
---disable_warnings
-DO STR_TO_DATE((''), FROM_DAYS(@@GLOBAL.SQL_MODE));
---enable_warnings
-SET GLOBAL SQL_MODE=DEFAULT;
-
---echo #
---echo # Bug#11766087 59125: VALGRIND UNINITIALISED VALUE WARNING IN ULL2DEC, LONGLONG2DECIMAL
---echo #
-
-SELECT FORMAT(YEAR(STR_TO_DATE('',GET_FORMAT(TIME,''))),1);
-
---echo #
---echo # Bug#11766126 59166: ANOTHER DATETIME VALGRIND UNINITIALIZED WARNING
---echo #
-
---disable_result_log
-SELECT CAST((MONTH(FROM_UNIXTIME(@@GLOBAL.SQL_MODE))) AS BINARY(1025));
---enable_result_log
-
---echo #
---echo # Bug#11766124 59164: VALGRIND: UNINITIALIZED VALUE IN NUMBER_TO_DATETIME
---echo #
-
-SELECT ADDDATE(MONTH(FROM_UNIXTIME(NULL)),INTERVAL 1 HOUR);
-
---echo #
---echo # Bug#11889186 60503: CRASH IN MAKE_DATE_TIME WITH DATE_FORMAT / STR_TO_DATE COMBINATION
---echo #
-
-SELECT DATE_FORMAT('0000-00-11', '%W');
-SELECT DATE_FORMAT('0000-00-11', '%a');
-SELECT DATE_FORMAT('0000-00-11', '%w');
-
---echo #
---echo # Bug#12403504 AFTER FIX FOR #11889186 : ASSERTION FAILED: DELSUM+(INT) Y/4-TEMP > 0
---echo #
-
-SELECT MAKEDATE(11111111,1);
-SELECT WEEK(DATE_ADD(FROM_DAYS(1),INTERVAL 1 MONTH), 1);
-
---echo #
---echo # Bug#12584302 AFTER FIX FOR #12403504: ASSERTION FAILED: DELSUM+(INT) Y/4-TEMP > 0,
---echo #
-
-DO WEEK((DATE_ADD((CAST(0 AS DATE)), INTERVAL 1 YEAR_MONTH)), 5);
-
---echo #
---echo # BUG#13458237 INCONSISTENT HANDLING OF INVALIDE DATES WITH ZERO DAY
---echo # SIMILAR TO '2009-10-00'
---echo #
-
-query_vertical SELECT
- DATE('20091000'),
- STR_TO_DATE('200910','%Y%m'),
- LAST_DAY('2009-10-00'),
- LAST_DAY(DATE('2009-10-00')),
- LAST_DAY(DATE'2009-10-00'),
- LAST_DAY(STR_TO_DATE('200910','%Y%m')),
- WEEK('2009-10-00'),
- WEEK(DATE('2009-10-00')),
- WEEK(DATE'2009-10-00'),
- WEEK(STR_TO_DATE('200910','%Y%m')),
- WEEKOFYEAR('2009-10-00'),
- WEEKOFYEAR(DATE('2009-10-00')),
- WEEKOFYEAR(DATE'2009-10-00'),
- WEEKOFYEAR(STR_TO_DATE('200910','%Y%m')),
- DAYOFYEAR('2009-10-00'),
- DAYOFYEAR(DATE('2009-10-00')),
- DAYOFYEAR(DATE'2009-10-00'),
- DAYOFYEAR(STR_TO_DATE('200910','%Y%m')),
- WEEKDAY('2009-10-00'),
- WEEKDAY(DATE('2009-10-00')),
- WEEKDAY(DATE'2009-10-00'),
- WEEKDAY(STR_TO_DATE('200910','%Y%m')),
- TO_DAYs('2009-10-00'),
- TO_DAYs(DATE('2009-10-00')),
- TO_DAYs(DATE'2009-10-00'),
- TO_DAYs(STR_TO_DATE('200910','%Y%m'));
-
-query_vertical SELECT
- DATE('00000100'),
- STR_TO_DATE('000001','%Y%m'),
- LAST_DAY('0000-01-00'),
- LAST_DAY(DATE('0000-01-00')),
- LAST_DAY(DATE'0000-01-00'),
- LAST_DAY(STR_TO_DATE('000001','%Y%m')),
- WEEK('0000-01-00'),
- WEEK(DATE('0000-01-00')),
- WEEK(DATE'0000-01-00'),
- WEEK(STR_TO_DATE('000001','%Y%m')),
- WEEKOFYEAR('0000-01-00'),
- WEEKOFYEAR(DATE('0000-01-00')),
- WEEKOFYEAR(DATE'0000-01-00'),
- WEEKOFYEAR(STR_TO_DATE('000001','%Y%m')),
- DAYOFYEAR('0000-01-00'),
- DAYOFYEAR(DATE('0000-01-00')),
- DAYOFYEAR(DATE'0000-01-00'),
- DAYOFYEAR(STR_TO_DATE('000001','%Y%m')),
- WEEKDAY('0000-01-00'),
- WEEKDAY(DATE('0000-01-00')),
- WEEKDAY(DATE'0000-01-00'),
- WEEKDAY(STR_TO_DATE('000001','%Y%m')),
- TO_DAYs('0000-01-00'),
- TO_DAYs(DATE('0000-01-00')),
- TO_DAYs(DATE'0000-01-00'),
- TO_DAYs(STR_TO_DATE('000001','%Y%m'));
-
---echo End of 5.1 tests
-
---echo #
---echo # Bug#57039: constant subtime expression returns incorrect result.
---echo #
-CREATE TABLE t1 (`date_date` datetime NOT NULL);
-INSERT INTO t1 VALUES ('2008-01-03 00:00:00'), ('2008-01-03 00:00:00');
-SELECT * FROM t1 WHERE date_date >= subtime(now(), "00:30:00");
-SELECT * FROM t1 WHERE date_date <= addtime(date_add("2000-1-1", INTERVAL "1:1:1" HOUR_SECOND), "00:20:00");
-DROP TABLE t1;
-
---echo #
---echo # Bug#57512 str_to_date crash...
---echo #
-
-SELECT WEEK(STR_TO_DATE(NULL,0));
-SELECT SUBDATE(STR_TO_DATE(NULL,0), INTERVAL 1 HOUR);
-
---echo #
---echo # BUG#59895 - setting storage engine to null segfaults mysqld
---echo #
-SELECT MONTHNAME(0), MONTHNAME(0) IS NULL, MONTHNAME(0) + 1;
---error ER_WRONG_VALUE_FOR_VAR
-SET storage_engine=NULL;
-
-
---echo #
---echo # BUG#13354387 - CRASH IN IN MY_DECIMAL::OPERATOR FOR VIEW AND FUNCTION UNIX_TIMESTAMP
---echo # Part1 (5.5)
-SET time_zone='+03:00';
-CREATE TABLE t1 (a DATETIME NOT NULL);
-INSERT INTO t1 VALUES ('2009-09-20 07:32:39.06');
-INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00');
-CREATE VIEW v1 AS SELECT * FROM t1;
-SELECT CAST(UNIX_TIMESTAMP(a) AS DECIMAL(25,3)) AS c1 FROM v1 ORDER BY 1;
-DROP VIEW v1;
-DROP TABLE t1;
-SET time_zone=DEFAULT;
-
-
---echo #
---echo # Bug #59686 crash in String::copy() with time data type
---echo #
-
-SELECT min(timestampadd(month, 1>'', from_days('%Z')));
-
-SET timestamp=UNIX_TIMESTAMP('2001-01-01 00:00:00');
-create table t1(a time);
-insert into t1 values ('00:00:00'),('00:01:00');
-select 1 from t1 where 1 < some (select cast(a as datetime) from t1);
-drop table t1;
-SET timestamp=DEFAULT;
-
---echo #
---echo # Bug #21564557: INCONSISTENT OUTPUT FROM 5.5 AND 5.6
---echo # UNIX_TIMESTAMP(STR_TO_DATE('201506', "%Y%M"
---echo #
-
-SELECT UNIX_TIMESTAMP(STR_TO_DATE('201506', "%Y%m"));
-SELECT UNIX_TIMESTAMP('2015-06-00');
-SELECT UNIX_TIMESTAMP(STR_TO_DATE('0000-00-00 10:30:30', '%Y-%m-%d %h:%i:%s'));
-
-set sql_mode= 'TRADITIONAL';
-SELECT @@sql_mode;
-
-SELECT UNIX_TIMESTAMP(STR_TO_DATE('201506', "%Y%m"));
-SELECT UNIX_TIMESTAMP('2015-06-00');
-SELECT UNIX_TIMESTAMP(STR_TO_DATE('0000-00-00 10:30:30', '%Y-%m-%d %h:%i:%s'));
-
-set sql_mode= default;
-
-select time('10:10:10') > 10;
-select time('10:10:10') > 1010;
-select time('10:10:09') > 101010;
-select time('10:10:10') > 101010;
-select time('10:10:11') > 101010;
-
-select time(' 1 02:03:04') + interval 9 microsecond;
-select time(' 1 02:03:04') - interval 9 microsecond;
-select time('-1 02:03:04') + interval 9 microsecond;
-select time('-1 02:03:04') - interval 9 microsecond;
-select time(' 1 02:03:04') + interval '4:4:4' hour_second;
-select time(' 1 02:03:04') - interval '4:4:4' hour_second;
-select time('-1 02:03:04') + interval '4:4:4' hour_second;
-select time('-1 02:03:04') - interval '4:4:4' hour_second;
-select time(' 1 02:03:04') + interval 2 day;
-select time(' 1 02:03:04') - interval 2 day;
-select time('-1 02:03:04') + interval 2 day;
-select time('-1 02:03:04') - interval 2 day;
-
-select time('10 02:03:04') + interval 30 day;
-select time('10 02:03:04') + interval 1 year;
-
-# specially constructed queries to reach obscure places in the code
-# not touched by the more "normal" queries (and to increase the coverage)
-select cast('131415.123e0' as time);
-select cast('2010-01-02 03:04:05' as datetime) between null and '2010-01-02 03:04:04';
-select least(time('1:2:3'), '01:02:04', null) div 1;
-select truncate(least(time('1:2:3'), '01:02:04', null), 6);
-select cast(least(time('1:2:3'), '01:02:04', null) as decimal(3,1));
-select unix_timestamp(null);
-select truncate(date('2010-40-10'), 6);
-select extract(month from '2010-40-50');
-select subtime('0000-00-10 10:10:10', '30 10:00:00');
-
-#
-# lp:730637 Valgrind warnings in 5.1-micro
-#
-select cast(str_to_date(NULL, '%H:%i:%s') as time);
-
-create table t1 (f1 datetime, key (f1));
-insert into t1 values ('2000-09-12 00:00:00'), ('2007-04-25 05:08:49');
-select * from t1 where f1 > time('-23:00:06');
-drop table t1;
-
-#
-# lp:730627 TIME_to_ulonglong: Assertion `0' failed in 5.1-micro on wrong argument to MAKETIME
-#
-select maketime(20,61,10)+0;
-
-#
-# lp:731103 Assertion `maybe_null && item->null_value' failed with ORDER BY LAST_DAY()
-#
-create table t1 (f2 int not null) ;
-insert into t1 values (0),(0);
-select last_day(f2) from t1;
-select last_day(f2) from t1 where last_day(f2) is null;
-select * from t1 order by last_day (f2);
-drop table t1;
-
-#
-# lp:731815 Crash/valgrind warning Item::send with 5.1-micro
-#
-SET timestamp=unix_timestamp('2001-02-03 10:20:30');
-select convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime)), 'UTC', 'Europe/Moscow');
-SET timestamp=DEFAULT;
-
-#
-# lp:736370 Datetime functions in subquery context cause wrong result and bogus warnings in mysql-5.1-micr
-#
-create table t1 (f1 integer, f2 date);
-insert into t1 values (1,'2011-05-05'),(2,'2011-05-05'),(3,'2011-05-05'),(4,'2011-05-05'),(5,'2011-05-05'),(6, '2011-05-06');
-select * from t1 where 1 and concat(f2)=MAKEDATE(2011, 125);
-drop table t1;
-
-#
-# lp:736791 Crash in make_truncated_value_warning with LEAST()/GREATEST/COALESCE
-#
-create table t1 (f1 timestamp);
-insert into t1 values ('0000-00-00 00:00:00');
-select least(1, f1) from t1;
-drop table t1;
-
-#
-# lp:737092 Assertion `item->null_value' failed in get_datetime_value in 5.1-micro
-#
-SET timestamp=UNIX_TIMESTAMP('2014-04-14 10:10:10');
-select now() > coalesce(time('21:43:24'), date('2010-05-03'));
-SET timestamp=UNIX_TIMESTAMP('2014-04-14 22:22:22');
-select now() > coalesce(time('21:43:24'), date('2010-05-03'));
-SET timestamp=DEFAULT;
-
-#
-# lp:737104 Crash in DTCollation::set in 5.1-micro
-#
-create table t1 (f1 timestamp);
-select * from t1 where f1 > f1 and f1 <=> timestampadd(hour, 9 , '2010-01-01 16:55:35');
-drop table t1;
-
-#
-# lp:737111 Different behavior for TIMESTAMPADD with 0000-00-00 argument in 5.1-micro
-#
-create table t1 (f1 date);
-insert into t1 values ('0000-00-00');
-select timestampadd(week, 1, f1) from t1;
-select timestampadd(week, 1, date("0000-00-00"));
-drop table t1;
-
-#
-# lp:737450 Second Assertion `item->null_value' failed in 5.1-micro
-#
-create table t1 (f2 time not null, f3 datetime, f4 int not null, f5 timestamp);
-insert ignore t1 values ('04:38:11','0000-00-00 00:00:00',0,'0000-00-00 00:00:00');
-select least(greatest(f3, f2, f4), f5) from t1;
-drop table t1;
-
-#
-# lp:737474 Wrong result with DAY(COALESCE(NULL)) in 5.1-micro
-#
-select day(coalesce(null));
-
-#
-# lp:738067 Crash in get_datetime_value() in 5.1-micro
-#
-select timestamp(greatest('2002-08-20', '0000-00-00 00:00:00'));
-
-#
-# lp:738091 cast(timestamp() AS time returns NULL for 0000-00-00 00:00:00 in 5.1-micro
-#
-create table t1 (f1 datetime);
-insert into t1 values ('0000-00-00 00:00:00');
-select cast(f1 AS time) from t1;
-drop table t1;
-
-SET timestamp=UNIX_TIMESTAMP('2014-06-01 10:20:30');
-select greatest(cast("0-0-0" as date), cast("10:20:05" as time));
-select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '0000-00-00';
-select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01';
-select greatest(cast("0-0-0" as date), cast("10:20:05" as time)) = '2014-06-01 10:20:05';
-select cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetime(6));
-SET timestamp=DEFAULT;
-
-select microsecond('12:00:00.123456'), microsecond('2009-12-31 23:59:59.000010');
-
---error ER_TOO_BIG_PRECISION
-select now(258);
-
-#
-# MDEV-4293 Valgrind warnings (Conditional jump or move depends on uninitialised value) in remove_eq_conds on time functions with NULL argument in WHERE
-#
-SELECT 1 FROM DUAL WHERE YEAR(TIMEDIFF(NULL, '12:12:12'));
-SELECT 1 FROM DUAL WHERE MONTH(TIMEDIFF(NULL, '12:12:12'));
-SELECT 1 FROM DUAL WHERE DAYOFMONTH(TIMEDIFF(NULL, '12:12:12'));
-SELECT 1 FROM DUAL WHERE HOUR(TIMEDIFF(NULL, '12:12:12'));
-SELECT 1 FROM DUAL WHERE MINUTE(TIMEDIFF(NULL, '12:12:12'));
-SELECT 1 FROM DUAL WHERE SECOND(TIMEDIFF(NULL, '12:12:12'));
-
-
---echo #
---echo # MDEV-4511 Assertion `scale <= precision' fails on GROUP BY TIMEDIFF with incorrect types
---echo #
-CREATE TABLE t1 (a DATE) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('2005-05-04'),('2000-02-23');
-SELECT a FROM t1 GROUP BY TIMEDIFF('2004-06-12',a) * 1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DATE) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('2005-05-04'),('2000-02-23');
-SELECT a FROM t1 GROUP BY ADDTIME(a,'10')*1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DATE) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('2005-05-04'),('2000-02-23');
-SELECT * FROM t1 GROUP BY SEC_TO_TIME(concat(a,'10'))*1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DATE) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('2005-05-04'),('2000-02-23');
-SELECT * FROM t1 GROUP BY ADDTIME(timestamp('2001-01-01 00:00:00'),CAST(a AS SIGNED)&0xF)*1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DATE) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('2005-05-04'),('2000-02-23');
-SELECT * FROM t1 GROUP BY STR_TO_DATE(a,concat('%Y-%m-%d.%f',if(rand(),'','')))*1;
-DROP TABLE t1;
-
-CREATE TABLE t1 AS SELECT
- STR_TO_DATE('2001-01-01', '%Y-%m-%d') AS date_only,
- STR_TO_DATE('10:10:10', '%H:%i:%s') AS time_only,
- STR_TO_DATE('10:10:10.123', '%H:%i:%s.%f') AS time_microsecond,
- STR_TO_DATE('2001-01-01 10:10:10', '%Y-%m-%d %H:%i:%s') AS date_time,
- STR_TO_DATE('2001-01-01 10:10:10.123', '%Y-%m-%d %H:%i:%s.%f') AS date_time_microsecond;
-SHOW COLUMNS FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 AS SELECT
- SEC_TO_TIME(1)+0.1,
- SEC_TO_TIME(1.1)+0.1,
- SEC_TO_TIME(1.12)+0.1,
- SEC_TO_TIME(1.123456)+0.1,
- SEC_TO_TIME(1.1234567)+0.1;
-SHOW COLUMNS FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DATE) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('2005-05-04'),('2000-02-23');
-SELECT * FROM t1 GROUP BY FROM_UNIXTIME(concat(a,'10'))*1;
-SELECT * FROM t1 GROUP BY (-FROM_UNIXTIME(concat(a,'10')))*1;
-SELECT * FROM t1 GROUP BY (-FROM_UNIXTIME(concat(a,'10')));
-SELECT * FROM t1 GROUP BY ABS(FROM_UNIXTIME(concat(a,'10')));
-SELECT * FROM t1 GROUP BY @a:=(FROM_UNIXTIME(concat(a,'10'))*1);
-
-DROP TABLE t1;
-
-SET TIME_ZONE='+02:00';
-
---echo #
---echo # MDEV-6302 Wrong result set when using GROUP BY FROM_UNIXTIME(...)+0
---echo #
-CREATE TABLE t1 (a DATE);
-INSERT INTO t1 VALUES ('2005-05-04'),('2000-02-23');
-SELECT a, FROM_UNIXTIME(CONCAT(a,'10')) AS f1, FROM_UNIXTIME(CONCAT(a,'10'))+0 AS f2 FROM t1;
-SELECT * FROM t1 GROUP BY FROM_UNIXTIME(CONCAT(a,'10'))+0;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DATE) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('2005-05-04'),('2000-02-23');
-SELECT * FROM t1 GROUP BY FROM_UNIXTIME(concat(a,'10'))/1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DATE);
-INSERT INTO t1 VALUES ('2005-05-04');
-SELECT CONCAT(FROM_UNIXTIME(CONCAT(a,'10')) MOD FROM_UNIXTIME(CONCAT(a,'10'))) AS f2 FROM t1;
-SELECT CHAR_LENGTH(CONCAT(FROM_UNIXTIME(CONCAT(a,'10')) MOD FROM_UNIXTIME(CONCAT(a,'10')))) AS f2 FROM t1;
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-CREATE TABLE t2 AS SELECT CONCAT(FROM_UNIXTIME(CONCAT(a,'10')) MOD FROM_UNIXTIME(CONCAT(a,'10'))) AS f2 FROM t1;
-SHOW CREATE TABLE t2;
-SELECT * FROM t2;
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-4635 Crash in UNIX_TIMESTAMP(STR_TO_DATE('2020','%Y'))
---echo #
-SELECT UNIX_TIMESTAMP(STR_TO_DATE('2020','%Y'));
-
-SET TIME_ZONE=DEFAULT;
-
---echo #
---echo # MDEV-4863 COALESCE(time_or_datetime) returns wrong results in numeric context
---echo #
-CREATE TABLE t1 (a TIMESTAMP(3));
-INSERT INTO t1 VALUES ('2001-01-01 10:20:30.999');
-SELECT CAST(COALESCE(a,a) AS SIGNED) AS c1, CAST(COALESCE(a,a) AS DECIMAL(25,3)) AS c2, ROUND(COALESCE(a,a)) AS c2 FROM t1;
-DROP TABLE t1;
-CREATE TABLE t1 (a TIME(3));
-INSERT INTO t1 VALUES ('10:20:30.999');
-SELECT CAST(COALESCE(a,a) AS SIGNED) AS c1, CAST(COALESCE(a,a) AS DECIMAL(25,3)) AS c2, ROUND(COALESCE(a,a)) AS c2 FROM t1;
-DROP TABLE t1;
-
-SELECT
- CAST(COALESCE(DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30')) AS SIGNED) AS c1,
- CAST(COALESCE(DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30')) AS DECIMAL(25,4)) AS c2,
- COALESCE(DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))+0e0 AS c3,
- CONCAT(COALESCE(DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))) AS c4,
- TIME(COALESCE(DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))) AS c5,
- DATE(COALESCE(DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))) AS c6,
- TIMESTAMP(COALESCE(DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))) AS c7;
-
-SELECT
- CAST(COALESCE(TIMESTAMP('2001-01-02 10:20:30'),DATE('2001-01-01')) AS SIGNED) AS c1,
- CAST(COALESCE(TIMESTAMP('2001-01-02 10:20:30'),DATE('2001-01-01')) AS DECIMAL(25,4)) AS c2,
- COALESCE(TIMESTAMP('2001-01-02 10:20:30'),DATE('2001-01-01'))+0e0 AS c3,
- CONCAT(COALESCE(TIMESTAMP('2001-01-02 10:20:30'),DATE('2001-01-01'))) AS c4,
- TIME(COALESCE(TIMESTAMP('2001-01-02 10:20:30'),DATE('2001-01-01'))) AS c5,
- DATE(COALESCE(TIMESTAMP('2001-01-02 10:20:30'),DATE('2001-01-01'))) AS c6,
- TIMESTAMP(COALESCE(TIMESTAMP('2001-01-02 10:20:30'),DATE('2001-01-01'))) AS c7;
-
-SELECT
- CAST(IFNULL(DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30')) AS SIGNED) AS c1,
- CAST(IFNULL(DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30')) AS DECIMAL(25,4)) AS c2,
- IFNULL(DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))+0e0 AS c3,
- CONCAT(IFNULL(DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))) AS c4,
- TIME(IFNULL(DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))) AS c5,
- DATE(IFNULL(DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))) AS c6,
- TIMESTAMP(IFNULL(DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))) AS c7;
-
-SELECT
- CAST(IFNULL(TIMESTAMP('2001-01-02 10:20:30'),DATE('2001-01-01')) AS SIGNED) AS c1,
- CAST(IFNULL(TIMESTAMP('2001-01-02 10:20:30'),DATE('2001-01-01')) AS DECIMAL(25,4)) AS c2,
- IFNULL(TIMESTAMP('2001-01-02 10:20:30'),DATE('2001-01-01'))+0e0 AS c3,
- CONCAT(IFNULL(TIMESTAMP('2001-01-02 10:20:30'),DATE('2001-01-01'))) AS c4,
- TIME(IFNULL(TIMESTAMP('2001-01-02 10:20:30'),DATE('2001-01-01'))) AS c5,
- DATE(IFNULL(TIMESTAMP('2001-01-02 10:20:30'),DATE('2001-01-01'))) AS c6,
- TIMESTAMP(IFNULL(TIMESTAMP('2001-01-02 10:20:30'),DATE('2001-01-01'))) AS c7;
-
-SELECT
- CAST(IF(1,DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30')) AS SIGNED) AS c1,
- CAST(IF(1,DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30')) AS DECIMAL(25,4)) AS c2,
- IF(1,DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))+0e0 AS c3,
- CONCAT(IF(1,DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))) AS c4,
- TIME(IF(1,DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))) AS c5,
- DATE(IF(1,DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))) AS c6,
- TIMESTAMP(IF(1,DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))) AS c7;
-
-SELECT
- CAST(IF(0,DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30')) AS SIGNED) AS c1,
- CAST(IF(0,DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30')) AS DECIMAL(25,4)) AS c2,
- IF(0,DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))+0e0 AS c3,
- CONCAT(IF(0,DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))) AS c4,
- TIME(IF(0,DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))) AS c5,
- DATE(IF(0,DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))) AS c6,
- TIMESTAMP(IF(0,DATE('2001-01-01'),TIMESTAMP('2001-01-02 10:20:30'))) AS c7;
-
-SELECT
- CAST(CASE WHEN 1 THEN DATE('2001-01-01') ELSE TIMESTAMP('2001-01-02 10:20:30') END AS SIGNED) AS c1,
- CAST(CASE WHEN 1 THEN DATE('2001-01-01') ELSE TIMESTAMP('2001-01-02 10:20:30') END AS DECIMAL(25,4)) AS c2,
- CASE WHEN 1 THEN DATE('2001-01-01') ELSE TIMESTAMP('2001-01-02 10:20:30') END+0e0 AS c3,
- CONCAT(CASE WHEN 1 THEN DATE('2001-01-01') ELSE TIMESTAMP('2001-01-02 10:20:30') END) AS c4,
- TIME(CASE WHEN 1 THEN DATE('2001-01-01') ELSE TIMESTAMP('2001-01-02 10:20:30') END) AS c5,
- DATE(CASE WHEN 1 THEN DATE('2001-01-01') ELSE TIMESTAMP('2001-01-02 10:20:30') END) AS c6,
- TIMESTAMP(CASE WHEN 1 THEN DATE('2001-01-01') ELSE TIMESTAMP('2001-01-02 10:20:30') END) AS c7;
-
-SELECT
- CAST(CASE WHEN 0 THEN DATE('2001-01-01') ELSE TIMESTAMP('2001-01-02 10:20:30') END AS SIGNED) AS c1,
- CAST(CASE WHEN 0 THEN DATE('2001-01-01') ELSE TIMESTAMP('2001-01-02 10:20:30') END AS DECIMAL(25,4)) AS c2,
- CASE WHEN 0 THEN DATE('2001-01-01') ELSE TIMESTAMP('2001-01-02 10:20:30') END+0e0 AS c3,
- CONCAT(CASE WHEN 0 THEN DATE('2001-01-01') ELSE TIMESTAMP('2001-01-02 10:20:30') END) AS c4,
- TIME(CASE WHEN 0 THEN DATE('2001-01-01') ELSE TIMESTAMP('2001-01-02 10:20:30') END) AS c5,
- DATE(CASE WHEN 0 THEN DATE('2001-01-01') ELSE TIMESTAMP('2001-01-02 10:20:30') END) AS c6,
- TIMESTAMP(CASE WHEN 0 THEN DATE('2001-01-01') ELSE TIMESTAMP('2001-01-02 10:20:30') END) AS c7;
-
-CREATE TABLE t1 AS SELECT
- CONCAT(COALESCE(TIME(101010),TIME(101010))) AS c1,
- CONCAT(IF(0,TIME(101010),TIME(101010))) AS c2,
- CONCAT(IFNULL(TIME(101010),TIME(101010))) AS c3,
- CONCAT(CASE WHEN 1 THEN TIME(101010) ELSE TIME(101010) END) AS c4;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-4870 Wrong values of CASE, COALESCE, IFNULL on a combination of different temporal types
---echo #
-SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30');
-CREATE TABLE t1 (dt2 DATETIME(2), t3 TIME(3), d DATE);
-INSERT INTO t1 VALUES ('2001-01-01 00:00:00.12', '00:00:00.567', '2002-01-01');
-SELECT CASE WHEN 0 THEN dt2 ELSE t3 END FROM t1;
-CREATE TABLE t2 AS SELECT CASE WHEN 0 THEN dt2 ELSE t3 END FROM t1;
-SELECT * FROM t2;
-SHOW COLUMNS FROM t2;
-DROP TABLE t2;
-SELECT CASE WHEN 1 THEN dt2 ELSE t3 END FROM t1;
-SELECT CONCAT(CASE WHEN 1 THEN dt2 ELSE t3 END) FROM t1;
-SELECT CONCAT(CASE WHEN 0 THEN t3 ELSE dt2 END) FROM t1;
-SELECT CONCAT(CASE WHEN 1 THEN d ELSE t3 END) FROM t1;
-SELECT CASE WHEN 1 THEN t3 ELSE d END FROM t1;
-SELECT COALESCE(d, t3) FROM t1;
-SELECT CONCAT(COALESCE(d, t3)) FROM t1;
-SELECT COALESCE(dt2, t3) FROM t1;
-SELECT CONCAT(COALESCE(dt2, t3)) FROM t1;
-SELECT IFNULL(dt2, t3), CONCAT(IFNULL(dt2, t3)) FROM t1;
-SELECT IFNULL(d, t3), CONCAT(IFNULL(d, t3)) FROM t1;
-DROP TABLE t1;
-SET timestamp=DEFAULT;
-
---echo #
---echo # MDEV-4724 Some temporal functions do not preserve microseconds
---echo #
-SELECT MAKETIME(10,10,10.231);
-SELECT MAKETIME(0, 0, 59.9);
-CREATE TABLE t1 AS SELECT
- MAKETIME(10,00,00),
- MAKETIME(10,00,00.1),
- MAKETIME(10,00,00.12),
- MAKETIME(10,00,00.123),
- MAKETIME(10,00,00.1234),
- MAKETIME(10,00,00.12345),
- MAKETIME(10,00,00.123456);
-SHOW COLUMNS FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 AS SELECT
- TIME('10:00:00'),
- TIME('10:00:00.1'),
- TIME('10:00:00.12'),
- TIME('10:00:00.123'),
- TIME('10:00:00.1234'),
- TIME('10:00:00.12345'),
- TIME('10:00:00.12346');
-SHOW COLUMNS FROM t1;
-DROP TABLE t1;
-
-SET TIME_ZONE='+00:00';
-SET TIMESTAMP=UNIX_TIMESTAMP('2012-10-16 22:46:17');
-SELECT NOW(), UNIX_TIMESTAMP(), UNIX_TIMESTAMP(NOW()),UNIX_TIMESTAMP('2012-10-16 22:46:17');
-SET TIMESTAMP=UNIX_TIMESTAMP('1970-01-02 03:04:05.123456');
-SELECT @@timestamp, FROM_UNIXTIME(@@timestamp);
-SET TIME_ZONE=DEFAULT;
-SET TIMESTAMP=DEFAULT;
-
-SELECT TIME('2012-10-16 15:54:16.12');
-SELECT TIMESTAMP('2012-10-16 15:54:16.12');
-SELECT TIMEDIFF('10:10:10.1','00:00:00');
-SELECT TIME_TO_SEC('10:10:10');
-SELECT ADDTIME(TIME('10:10:10.1'),'10:10:10.12');
-SELECT ADDTIME(TIMESTAMP('2001-01-01 10:10:10.1'),'10:10:10.12');
-SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL 1 SECOND);
-SELECT DATE_ADD('2001-01-01 00:00:00.1', INTERVAL 1 SECOND);
-SELECT DATE_ADD('2001-01-01 00:00:00.12', INTERVAL 1 SECOND);
-SELECT DATE_ADD('2001-01-01 00:00:00.123', INTERVAL 1 SECOND);
-SELECT DATE_ADD('2001-01-01 00:00:00.1234', INTERVAL 1 SECOND);
-SELECT DATE_ADD('2001-01-01 00:00:00.12345', INTERVAL 1 SECOND);
-SELECT DATE_ADD('2001-01-01 00:00:00.123456', INTERVAL 1 SECOND);
-SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL 1 SECOND);
-SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL 1.1 SECOND);
-SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL 1.12 SECOND);
-SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL 1.123 SECOND);
-SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL 1.1234 SECOND);
-SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL 1.12345 SECOND);
-SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL 1.123456 SECOND);
-SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL -1 SECOND);
-SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL -1.1 SECOND);
-SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL -1.12 SECOND);
-SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL -1.123 SECOND);
-SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL -1.1234 SECOND);
-SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL -1.12345 SECOND);
-SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL -1.123456 SECOND);
-SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL 'xxx' SECOND);
-SELECT CONVERT_TZ('2001-01-01 10:20:30.12','+00:00','+01:00');
-
---echo #
---echo # MDEV-4861 TIME/DATETIME arithmetics does not preserve INTERVAL precision
---echo #
-CREATE TABLE t1 (t0 TIME);
-INSERT INTO t1 VALUES ('00:00:00');
-SELECT t0 + INTERVAL 1.1 SECOND FROM t1;
-CREATE TABLE t2 AS SELECT t0 + INTERVAL 1.1 SECOND FROM t1;
-SHOW COLUMNS FROM t2;
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (t0 DATETIME);
-INSERT INTO t1 VALUES ('2001-01-01 00:00:00');
-SELECT t0 + INTERVAL 1.1 SECOND FROM t1;
-CREATE TABLE t2 AS SELECT t0 + INTERVAL 1.1 SECOND FROM t1;
-SHOW COLUMNS FROM t2;
-DROP TABLE t1, t2;
-
-
---echo #
---echo # MDEV-4843 Wrong data type for TIMESTAMP('2001-01-01','10:10:10')
---echo #
-CREATE TABLE t1 AS SELECT
- TIMESTAMP('2001-01-01','10:10:10'),
- TIMESTAMP('2001-01-01','10:10:10.1'),
- TIMESTAMP('2001-01-01','10:10:10.12'),
- TIMESTAMP('2001-01-01','10:10:10.123'),
- TIMESTAMP('2001-01-01','10:10:10.1234'),
- TIMESTAMP('2001-01-01','10:10:10.12345'),
- TIMESTAMP('2001-01-01','10:10:10.123456'),
- TIMESTAMP('2001-01-01','10:10:10.1234567');
-SHOW COLUMNS FROM t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 AS SELECT
- TIMESTAMP('2001-01-01 00:00:00','10:10:10'),
- TIMESTAMP('2001-01-01 00:00:00.1','10:10:10'),
- TIMESTAMP('2001-01-01 00:00:00.12','10:10:10'),
- TIMESTAMP('2001-01-01 00:00:00.123','10:10:10'),
- TIMESTAMP('2001-01-01 00:00:00.1234','10:10:10'),
- TIMESTAMP('2001-01-01 00:00:00.12345','10:10:10'),
- TIMESTAMP('2001-01-01 00:00:00.123456','10:10:10'),
- TIMESTAMP('2001-01-01 00:00:00.1234567','10:10:10');
-SHOW COLUMNS FROM t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-SET timestamp=unix_timestamp('2001-02-03 10:20:30');
-CREATE TABLE t1 AS SELECT
- TIMESTAMP('00:00:00','10:10:10'),
- TIMESTAMP(TIME('00:00:00'),'10:10:10');
-SHOW COLUMNS FROM t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-SET timestamp=DEFAULT;
-
---echo #
---echo # MDEV-4869 Wrong result of MAKETIME(0, 0, -0.1)
---echo #
-SELECT MAKETIME(0, 0, -0.1);
-
---echo #
---echo # MDEV-4857 Wrong result of HOUR('1 00:00:00')
---echo #
-SET timestamp=unix_timestamp('2001-02-03 10:20:30');
-SELECT HOUR('1 02:00:00'), HOUR('26:00:00');
-SELECT HOUR(TIME'1 02:00:00'), HOUR(TIME'26:00:00');
-SELECT HOUR(TIME('1 02:00:00')), HOUR(TIME('26:00:00'));
-SELECT DAY(TIME('1 02:00:00')), DAY(TIME('26:00:00'));
-
-SELECT EXTRACT(HOUR FROM '1 02:00:00'), EXTRACT(HOUR FROM '26:00:00');
-SELECT EXTRACT(HOUR FROM TIME'1 02:00:00'), EXTRACT(HOUR FROM TIME'26:00:00');
-SELECT EXTRACT(HOUR FROM TIME('1 02:00:00')), EXTRACT(HOUR FROM TIME('26:00:00'));
-SELECT EXTRACT(DAY FROM TIME('1 02:00:00')), EXTRACT(DAY FROM TIME('26:00:00'));
-SET timestamp=DEFAULT;
-
---echo #
---echo # MDEV-5458 RQG hits 'sql/tztime.cc:799: my_time_t sec_since_epoch(int, int, int, int, int, int): Assertion `mon > 0 && mon < 13' failed.'
---echo #
-SET TIMESTAMP=UNIX_TIMESTAMP('2014-01-22 18:19:20');
-CREATE TABLE t1 (t TIME);
-INSERT INTO t1 VALUES ('03:22:30'),('18:30:05');
-SELECT CONVERT_TZ(GREATEST(t, CURRENT_DATE()), '+02:00', '+10:00') FROM t1;
-SELECT GREATEST(t, CURRENT_DATE()) FROM t1;
-DROP TABLE t1;
-SET TIMESTAMP=DEFAULT;
-
---echo #
---echo # MDEV-5504 Server crashes in String::length on SELECT with MONTHNAME, GROUP BY, ROLLUP
---echo #
-CREATE TABLE t1 (i INT);
-INSERT INTO t1 VALUES (1),(2);
-SELECT 1 FROM t1 GROUP BY MONTHNAME(0) WITH ROLLUP;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-6099 Bad results for DATE_ADD(.., INTERVAL 2000000000000000000.0 SECOND)
---echo #
-SELECT DATE_ADD('2001-01-01 10:20:30',INTERVAL 250000000000.0 SECOND) AS c1, DATE_ADD('2001-01-01 10:20:30',INTERVAL 2000000000000000000.0 SECOND) AS c2;
-
---echo #
---echo # MDEV-4838 Wrong metadata for DATE_ADD('string', INVERVAL)
---echo #
---enable_metadata
-SELECT DATE_ADD('2011-01-02 12:13:14', INTERVAL 1 MINUTE);
---disable_metadata
-
---echo #
---echo # MDEV-5450 Assertion `cached_field_ type == MYSQL_TYPE_STRING || ltime.time_type == MYSQL_TIMESTAMP_NONE || mysql_type_to_time_type(cached_field_type) == ltime.time_type' fails with IF, ISNULL, ADDDATE
---echo #
-
-CREATE TABLE t1 (a DATETIME, b DATE);
-INSERT INTO t1 VALUES (NULL, '2012-12-21');
-SELECT IF(1,ADDDATE(IFNULL(a,b),0),1) FROM t1;
-SELECT CAST(ADDDATE(IFNULL(a,b),0) AS CHAR) FROM t1;
-SELECT CAST(ADDDATE(COALESCE(a,b),0) AS CHAR) FROM t1;
-SELECT CAST(ADDDATE(CASE WHEN 0 THEN a ELSE b END,0) AS CHAR) FROM t1;
-SELECT IF(1,ADDTIME(IFNULL(a,b),0),1) FROM t1;
-SELECT CAST(ADDTIME(IFNULL(a,b),0) AS CHAR) FROM t1;
-SELECT CAST(ADDTIME(COALESCE(a,b),0) AS CHAR) FROM t1;
-SELECT CAST(ADDTIME(CASE WHEN 0 THEN a ELSE b END,0) AS CHAR) FROM t1;
-DROP TABLE t1;
-
-SET timestamp=unix_timestamp('2001-02-03 10:20:30');
-CREATE TABLE t1 (a DATETIME, b TIME);
-INSERT INTO t1 VALUES (NULL, '00:20:12');
-SELECT IF(1,ADDDATE(IFNULL(a,b),0),1) FROM t1;
-SELECT CAST(ADDDATE(IFNULL(a,b),0) AS CHAR) FROM t1;
-SELECT CAST(ADDDATE(COALESCE(a,b),0) AS CHAR) FROM t1;
-SELECT CAST(ADDDATE(CASE WHEN 0 THEN a ELSE b END,0) AS CHAR) FROM t1;
-SELECT IF(1,ADDTIME(IFNULL(a,b),0),1) FROM t1;
-SELECT CAST(ADDTIME(IFNULL(a,b),0) AS CHAR) FROM t1;
-SELECT CAST(ADDTIME(COALESCE(a,b),0) AS CHAR) FROM t1;
-SELECT CAST(ADDTIME(CASE WHEN 0 THEN a ELSE b END,0) AS CHAR) FROM t1;
-DROP TABLE t1;
-SET timestamp=DEFAULT;
-
-
---echo #
---echo # MDEV-5870 Assertion `ltime->neg == 0' fails with COALESCE, ADDDATE, MAKEDATE
---echo #
-CREATE TABLE t1 (dt DATETIME);
-INSERT INTO t1 VALUES ('2003-05-13 19:36:05'), ('2012-12-12 09:20:06');
-SELECT COALESCE(ADDDATE(MAKEDATE(2011,121), dt), '2006-09-12' ) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-6101 Hybrid functions do not add CURRENT_DATE when converting TIME to DATETIME
---echo #
-SET timestamp=UNIX_TIMESTAMP('2014-04-15 01:02:03');
-SELECT IF(1,TIME'10:20:30',DATE'2001-01-01');
-SELECT IFNULL(TIME'10:20:30',DATE'2001-01-01');
-SELECT CASE WHEN 1 THEN TIME'10:20:30' ELSE DATE'2001-01-01' END;
-SELECT COALESCE(TIME'10:20:30',DATE'2001-01-01');
-SET timestamp=DEFAULT;
-
---echo #
---echo # MDEV-5750 Assertion `ltime->year == 0' fails on a query with EXTRACT DAY_MINUTE and TIME column
---echo #
-SET timestamp=UNIX_TIMESTAMP('2010-01-01 00:00:00');
-CREATE TABLE t1 ( d DATE, t TIME );
-INSERT INTO t1 VALUES ('2008-12-05','22:34:09'),('2005-03-27','14:26:02');
-SELECT EXTRACT(DAY_MINUTE FROM GREATEST(t,d)), GREATEST(t,d) FROM t1;
-DROP TABLE t1;
-SET timestamp=DEFAULT;
-
---echo #
---echo # MDEV-7221 from_days fails after null value
---echo #
-CREATE TABLE t1 (
- id INT(11) NOT NULL PRIMARY KEY,
- date1 DATE NULL DEFAULT NULL
-);
-INSERT INTO t1 VALUES (12, '2011-05-12');
-INSERT INTO t1 VALUES (13, NULL);
-INSERT INTO t1 VALUES (14, '2009-10-23');
-INSERT INTO t1 VALUES (15, '2014-10-30');
-INSERT INTO t1 VALUES (16, NULL);
-INSERT INTO t1 VALUES (17, NULL);
-INSERT INTO t1 VALUES (18, '2010-10-13');
-SELECT a.id,a.date1,FROM_DAYS(TO_DAYS(a.date1)-10) as date2, DATE_ADD(a.date1,INTERVAL -10 DAY),TO_DAYS(a.date1)-10 FROM t1 a ORDER BY a.id;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-10524 Assertion `arg1_int >= 0' failed in Item_func_additive_op::result_precision()
---echo #
-SELECT 1 MOD ADDTIME( '13:58:57', '00:00:01' ) + 2;
-
---echo #
---echo # MDEV-11819 NO_ZERO_IN_DATE: Incorrect generated column value
---echo #
-
-SET sql_mode='NO_ZERO_IN_DATE';
-CREATE TABLE t1 (a TIME(6));
-INSERT INTO t1 SELECT timediff(timestamp'2008-12-31 23:59:59.000001',timestamp'2008-12-30 01:01:01.000002');
-SELECT * FROM t1;
-DROP TABLE t1;
-SET sql_mode=DEFAULT;
-
-
---echo #
---echo # MDEV-13972 crash in Item_func_sec_to_time::get_date
---echo #
-
-# The below query can return warning sporadically
---disable_warnings
-DO TO_DAYS(SEC_TO_TIME(TIME(CEILING(UUID()))));
---enable_warnings
-
-DO TO_DAYS(SEC_TO_TIME(MAKEDATE('',RAND(~('')))));
-SELECT SEC_TO_TIME(MAKEDATE(0,RAND(~0)));
-
-
---echo #
---echo # End of 5.5 tests
---echo #
-
---echo #
---echo # MDEV-8205 timediff returns null when comparing decimal time to time string value
---echo #
-
-# 1h difference
-SELECT
- TIMEDIFF('2014-01-01 00:00:00' , '2014-01-01 01:00:00' ) AS str_str,
- TIMEDIFF('2014-01-01 00:00:00' , 20140101010000.000 ) AS str_dec,
- TIMEDIFF(20140101000000.000 , 20140101010000.000 ) AS dec_dec,
- TIMEDIFF(20140101000000.000 , '2014-01-01 01:00:00' ) AS dec_str;
-
-# 1D1h difference
-SELECT
- TIMEDIFF('2014-01-01 00:00:00' , '2014-01-02 01:00:00' ) AS str_str,
- TIMEDIFF('2014-01-01 00:00:00' , 20140102010000.000 ) AS str_dec,
- TIMEDIFF(20140101000000.000 , 20140102010000.000 ) AS dec_dec,
- TIMEDIFF(20140101000000.000 , '2014-01-02 01:00:00' ) AS dec_str;
-
-# 1M1D1h difference
-SELECT
- TIMEDIFF('2014-01-01 00:00:00' , '2014-02-02 01:00:00' ) AS str_str,
- TIMEDIFF('2014-01-01 00:00:00' , 20140202010000.000 ) AS str_dec,
- TIMEDIFF(20140101000000.000 , 20140202010000.000 ) AS dec_dec,
- TIMEDIFF(20140101000000.000 , '2014-02-02 01:00:00' ) AS dec_str;
-
-# 2M1D1h difference
-SELECT
- TIMEDIFF('2014-01-01 00:00:00' , '2014-03-02 01:00:00' ) AS str_str,
- TIMEDIFF('2014-01-01 00:00:00' , 20140302010000.000 ) AS str_dec,
- TIMEDIFF(20140101000000.000 , 20140302010000.000 ) AS dec_dec,
- TIMEDIFF(20140101000000.000 , '2014-03-02 01:00:00' ) AS dec_str;
-
-
---echo #
---echo # MDEV-10787 Assertion `ltime->neg == 0' failed in void date_to_datetime(MYSQL_TIME*)
---echo #
-CREATE TABLE t1 (d DATE);
-INSERT INTO t1 VALUES ('2005-07-20'),('2012-12-21');
-SELECT REPLACE( ADDDATE( d, INTERVAL 0.6732771076944444 HOUR_SECOND ), '2', 'x' ) FROM t1;
-SELECT REPLACE( ADDDATE( d, INTERVAL '0.6732771076944444' HOUR_SECOND ), '2', 'x' ) FROM t1;
-SELECT CAST(ADDDATE( d, INTERVAL 6732771076944444 SECOND) AS CHAR) FROM t1;
-SELECT CAST(ADDDATE( d, INTERVAL '67327710769444:44' HOUR_SECOND) AS CHAR) FROM t1;
-SELECT CAST(ADDDATE( d, INTERVAL '673277107694:44:44' HOUR_SECOND) AS CHAR) FROM t1;
-DROP TABLE t1;
-
-# Maximum possible DAY_SECOND values in various formats
-SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:23:59:59' DAY_SECOND);
-SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:59:59' DAY_SECOND);
-SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:59' DAY_SECOND);
-SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:0:315569433599' DAY_SECOND);
-
-# Out-of-range INTERVAL DAY_SECOND values
-SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:0:0:315569433559' DAY_SECOND);
-SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:0:315569433559' DAY_SECOND);
-SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:315569433599' DAY_SECOND);
-
---echo #
---echo # MDEV-13202 Assertion `ltime->neg == 0' failed in date_to_datetime
---echo #
-
-CREATE TABLE t1 (i INT, d DATE);
-INSERT INTO t1 VALUES (1, '1970-01-01');
-SELECT MAX(NULLIF(i,1)) FROM t1 ORDER BY DATE_SUB(d,INTERVAL 17300000 HOUR);
-DROP TABLE t1;
-
-CREATE TABLE t1 (i INT, d DATE);
-INSERT INTO t1 VALUES (1, '1970-01-01');
-SELECT CONCAT(DATE_SUB(d, INTERVAL 17300000 HOUR)) FROM t1;
-DROP TABLE t1;
-
-SELECT CONCAT(DATE_SUB(TIMESTAMP'1970-01-01 00:00:00', INTERVAL 17300000 HOUR));
-
-
---echo #
---echo # End of 10.0 tests
---echo #
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-10317 EXCTACT(MINUTE_MICROSECOND) truncates data
---echo #
-
-let $query=
-SELECT
- a,
- EXTRACT(YEAR FROM a),
- EXTRACT(YEAR_MONTH FROM a),
- EXTRACT(QUARTER FROM a),
- EXTRACT(MONTH FROM a),
- EXTRACT(WEEK FROM a),
- EXTRACT(DAY FROM a),
- EXTRACT(DAY_HOUR FROM a),
- EXTRACT(DAY_MINUTE FROM a),
- EXTRACT(DAY_SECOND FROM a),
- EXTRACT(HOUR FROM a),
- EXTRACT(HOUR_MINUTE FROM a),
- EXTRACT(HOUR_SECOND FROM a),
- EXTRACT(MINUTE FROM a),
- EXTRACT(MINUTE_SECOND FROM a),
- EXTRACT(SECOND FROM a),
- EXTRACT(MICROSECOND FROM a),
- EXTRACT(DAY_MICROSECOND FROM a),
- EXTRACT(HOUR_MICROSECOND FROM a),
- EXTRACT(MINUTE_MICROSECOND FROM a),
- EXTRACT(SECOND_MICROSECOND FROM a)
-FROM t1;
-
-
-CREATE TABLE t1 (a DATETIME(6));
-INSERT INTO t1 VALUES ('1999-12-31 23:59:59.999999');
-
---vertical_results
---enable_metadata
---disable_ps_protocol
---eval $query
---enable_ps_protocol
---disable_metadata
---horizontal_results
-
---eval CREATE TABLE t2 AS $query
---vertical_results
-SELECT * FROM t2;
---horizontal_results
-SHOW CREATE TABLE t2;
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (a TIME(6));
-INSERT INTO t1 VALUES ('-838:59:59.999999'),('838:59:59.999999');
-
---vertical_results
---enable_metadata
---disable_ps_protocol
---eval $query
---enable_ps_protocol
---disable_metadata
---horizontal_results
-
---eval CREATE TABLE t2 AS $query
---vertical_results
-SELECT * FROM t2;
---horizontal_results
-SHOW CREATE TABLE t2;
-DROP TABLE t1,t2;
-
---echo #
---echo # End of 10.1 tests
---echo #
-
-
---echo #
---echo # Start of 10.3 tests
---echo #
-
---echo #
---echo # MDEV-12515 Wrong value when storing DATE_ADD() and ADDTIME() to a numeric field
---echo #
-
-SET sql_mode='';
-
-CREATE TABLE t1 AS SELECT
- DATE_ADD('2001-01-01',INTERVAL 1 DAY) AS c1,
- ADDTIME('10:20:30',1) AS c2;
-SHOW CREATE TABLE t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t2 (c INT);
-INSERT INTO t2 SELECT DATE_ADD('2001-01-01',INTERVAL 1 DAY);
-INSERT INTO t2 VALUES ('2001-01-02');
-SELECT * FROM t2;
-DROP TABLE t2;
-
-CREATE TABLE t2 (a INT);
-INSERT INTO t2 VALUES (ADDTIME('10:20:30',1));
-INSERT INTO t2 VALUES ('10:20:31');
-SELECT * FROM t2;
-DROP TABLE t2;
-
-SET sql_mode=DEFAULT;
-
-
---echo #
---echo # MDEV-12860 Out-of-range error on CREATE..SELECT with a view using MAX and EXTRACT(MINUTE_MICROSECOND..)
---echo #
-
-SET sql_mode=STRICT_ALL_TABLES;
-CREATE TABLE t1 (
- id bigint(11) NOT NULL PRIMARY KEY,
- dt datetime(6)
-);
-INSERT INTO t1 VALUES (1,'2001-01-01 11:22:33.123456');
-CREATE OR REPLACE VIEW v1 AS SELECT EXTRACT(MINUTE_MICROSECOND FROM dt) AS dt2 FROM t1;
-DESCRIBE v1;
-SELECT * FROM v1;
-CREATE TABLE t2 AS SELECT MAX(dt2) FROM v1;
-DESCRIBE t2;
-SELECT * FROM t2;
-DROP TABLE t2;
-DROP VIEW v1;
-DROP TABLE t1;
-SET sql_mode=DEFAULT;
-
---echo #
---echo # MDEV-12866 Out-of-range error with CREATE..SELECT..TO_SECONDS(NOW())
---echo #
-SET sql_mode=STRICT_ALL_TABLES;
-CREATE TABLE t1 AS SELECT TO_SECONDS('9999-12-31 23:59:59');
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-SET sql_mode=DEFAULT;
-
-
---echo #
---echo # MDEV-13966 Parameter data type control for Item_temporal_func
---echo #
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT FROM_DAYS(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT MAKEDATE(ROW(1,1),1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT MAKEDATE(1, ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT LAST_DAY(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT SEC_TO_TIME(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT TIMEDIFF(ROW(1,1),1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT TIMEDIFF(1, ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT MAKETIME(ROW(1,1),1,1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT MAKETIME(1, ROW(1,1), 1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT MAKETIME(1, 1, ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT FROM_UNIXTIME(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CONVERT_TZ(ROW(1,1),1,1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CONVERT_TZ(1, ROW(1,1), 1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CONVERT_TZ(1, 1, ROW(1,1));
-
-
---echo #
---echo # MDEV-15340 Wrong result HOUR(case_expression_with_time_and_datetime)
---echo #
-
-SET TIMESTAMP=UNIX_TIMESTAMP('2018-02-17 01:02:03');
-SELECT
- COALESCE(TIME'800:00:00', NOW()) AS c,
- HOUR(COALESCE(TIME'800:00:00',NOW())) AS hc;
-
-SELECT
- CASE WHEN TRUE THEN TIME'800:00:00' ELSE NOW() END AS c,
- HOUR(CASE WHEN TRUE THEN TIME'800:00:00' ELSE NOW() END) AS hc;
-
-SELECT
- IFNULL(TIME'800:00:00', NOW()) AS c,
- HOUR(IFNULL(TIME'800:00:00', NOW())) AS hc;
-
-SELECT
- IF(TRUE,TIME'800:00:00', NOW()) AS c,
- HOUR(IF(TRUE,TIME'800:00:00', NOW())) AS hc;
-
-SELECT
- ADDTIME(TIME'10:20:30', TIMESTAMP'2001-01-01 00:00:00') AS c1,
- ADDTIME(TIME'10:20:30', COALESCE(TIMESTAMP'2001-01-01 00:00:00',TIMESTAMP'2001-01-01 00:00:00')) AS c2,
- ADDTIME(TIME'10:20:30', DATE'2001-01-01') AS c3,
- ADDTIME(TIME'10:20:30', COALESCE(DATE'2001-01-01',TIMESTAMP'2001-01-01 00:00:00')) AS c4;
-
-#
-# Make sure that time functions that in 10.2 used get_arg0_time()
-# do not mix days to hours for dates with zero YYYYMM and non-zero days.
-#
-
-SELECT
- HOUR(TIMESTAMP'0000-00-01 10:00:00') AS h0,
- TIME_TO_SEC(TIMESTAMP'0000-00-01 10:00:00') AS tts0,
- TIME_TO_SEC(TIMESTAMP'0000-00-01 10:00:00.1') AS tts1,
- CAST(TIMESTAMP'0000-00-01 10:00:00' AS TIME) AS c0,
- CAST(TIMESTAMP'0000-00-01 10:00:00.1' AS TIME(1)) AS c2;
-
-SET TIMESTAMP=DEFAULT;
-
---echo #
---echo # MDEV-15363 Wrong result for CAST(LAST_DAY(TIME'00:00:00') AS TIME)
---echo #
-
-SET TIMESTAMP=UNIX_TIMESTAMP('2018-02-17 01:02:03');
-SELECT
- LAST_DAY(TIME'00:00:00') AS c1,
- CAST(CAST(LAST_DAY(TIME'00:00:00') AS DATE) AS TIME) AS c2,
- CAST(LAST_DAY(TIME'00:00:00') AS TIME) AS c3;
-SET TIMESTAMP=DEFAULT;
-
-
---echo #
---echo # MDEV-15702 Remove the use of STRING_ITEM from Item_func_date_format::fix_length_and_dec()
---echo #
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT DATE_FORMAT('2001-01-01',POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT DATE_FORMAT(POINT(1,1),'10');
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT DATE_FORMAT('2001-01-01',ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT DATE_FORMAT(ROW(1,1),'10');
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT DATE_FORMAT('2001-01-01','%Y',POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT DATE_FORMAT('2001-01-01','%Y',ROW(1,1));
-
-SELECT DATE_FORMAT('2001-01-01','%Y',@unknown_user_variable);
-
-CREATE TABLE t1 AS SELECT
- DATE_FORMAT('2001-01-01',NULL) AS c0,
- DATE_FORMAT('2001-01-01','10') AS c1,
- DATE_FORMAT('2001-01-01',10) AS c2,
- DATE_FORMAT('2001-01-01',10.0) AS c3,
- DATE_FORMAT('2001-01-01',10e0) AS c4,
- DATE_FORMAT('2001-01-01',TIME'10:20:30') AS c5;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-EXECUTE IMMEDIATE
-"CREATE TABLE t1 AS SELECT
- DATE_FORMAT('2001-01-01',?) AS c0,
- DATE_FORMAT('2001-01-01',?) AS c1,
- DATE_FORMAT('2001-01-01',?) AS c2,
- DATE_FORMAT('2001-01-01',?) AS c3,
- DATE_FORMAT('2001-01-01',?) AS c4,
- DATE_FORMAT('2001-01-01',?) AS c5"
-USING NULL, '10', 10, 10.0, 10e0, TIME'10:20:30';
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
diff --git a/mysql-test/t/func_time_hires.test b/mysql-test/t/func_time_hires.test
deleted file mode 100644
index 4dcd51a85ba..00000000000
--- a/mysql-test/t/func_time_hires.test
+++ /dev/null
@@ -1,108 +0,0 @@
-#
-# Test of timestamp with hires resolution;
-
-set time_zone='+03:00';
-set timestamp=unix_timestamp('2011-01-01 01:01:01.123456');
-
---vertical_results
-select sec_to_time(12345), sec_to_time(12345.6789), sec_to_time(1234567e-2);
-select now(), curtime(0), utc_timestamp(1), utc_time(2), current_time(3),
- current_timestamp(4), localtime(5), localtimestamp(6), time_to_sec('12:34:56'),
- time_to_sec('12:34:56.789');
-select sec_to_time(time_to_sec('1:2:3')), sec_to_time(time_to_sec('2:3:4.567890'));
-select time_to_sec(sec_to_time(11111)), time_to_sec(sec_to_time(11111.22222));
---horizontal_results
---error ER_TOO_BIG_PRECISION
-select current_timestamp(7);
---error ER_TOO_BIG_PRECISION
-select curtime(7);
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1 select sec_to_time(12345), sec_to_time(12345.6789),
- sec_to_time(1234567e-2), now(), curtime(0),
- utc_timestamp(1), utc_time(2), current_time(3),
- current_timestamp(4), localtime(5), localtimestamp(6),
- time_to_sec(123456), time_to_sec('12:34:56.789');
-show create table t1;
---query_vertical select * from t1
-drop table t1;
-
---query_vertical select unix_timestamp('2011-01-01 01:01:01'), unix_timestamp('2011-01-01 01:01:01.123456'), unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(0))), unix_timestamp(cast('2011-01-01 01:01:01.123456' as datetime(4)));
---query_vertical select from_unixtime(unix_timestamp('2011/1/1 1:1:1')), from_unixtime(unix_timestamp('2011/1/1 1:1:1.123456')), from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(0)))), from_unixtime(unix_timestamp(cast('2011/1/1 1:1:1.123456' as datetime(4))));
-
-select sec_to_time(3020399.99999), sec_to_time(3020399.999999), sec_to_time(3020399.9999999);
-select sec_to_time(-3020399.99999), sec_to_time(-3020399.999999), sec_to_time(-3020399.9999999);
-select 20010101000203.000000004 + interval 1 day;
-select 20010101000203.4 + interval 1 day;
-#
-# precision of expressions
-#
-set @a=cast('2011-01-02 12:13:14' as datetime);
-select @a + interval 1 minute;
-select @a + interval 10 microsecond;
-select @a + interval 10 microsecond + interval 999990 microsecond;
-
-#
-# CAST
-#
-set @a='2011-01-02 12:13:14.123456';
-create table t1 select CAST(@a AS DATETIME) as dauto,
- CAST(@a AS DATETIME(0)) as d0,
- CAST(@a AS DATETIME(1)) as d1,
- CAST(@a AS DATETIME(2)) as d2,
- CAST(@a AS DATETIME(3)) as d3,
- CAST(@a AS DATETIME(4)) as d4,
- CAST(@a AS DATETIME(5)) as d5,
- CAST(@a AS DATETIME(6)) as d6,
- CAST(@a AS TIME) as tauto,
- CAST(@a AS TIME(0)) as t0,
- CAST(@a AS TIME(1)) as t1,
- CAST(@a AS TIME(2)) as t2,
- CAST(@a AS TIME(3)) as t3,
- CAST(@a AS TIME(4)) as t4,
- CAST(@a AS TIME(5)) as t5,
- CAST(@a AS TIME(6)) as t6;
-show create table t1;
---query_vertical select * from t1
-drop table t1;
-explain extended select cast(cast(@a as datetime(4)) as time(0));
-select cast(cast(@a as time(2)) as time(6));
-
---error ER_TOO_BIG_PRECISION
-select CAST(@a AS DATETIME(7));
-
-#
-# CONVERT_TZ
-#
-SELECT CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00');
-SELECT CONVERT_TZ('2011-01-02 12:00:00.123', '+00:00', '+03:00');
-SELECT CONVERT_TZ('2011-01-02 12:00:00.123456', '+00:00', '+03:00');
-SELECT CONVERT_TZ(CAST('2010-10-10 10:10:10.123456' AS DATETIME(4)), '+00:00', '+03:00');
-
-#
-# Field::store_time()
-#
-create table t1 (a varchar(200));
-insert t1 values (now(6));
-select * from t1;
-drop table t1;
-
-#
-# lp:736358 Unexpected increased timestamp resolution with UNION
-#
-# timestamp(6) case is fixed:
-create table t1 (f1 timestamp(6));
-insert into t1 values ('2002-07-15 21:00:00');
-select time(f1) from t1;
-select time(f1) from t1 union all select time(f1 + interval 1 second) from t1;
-alter table t1 modify f1 timestamp;
-select time(f1) from t1;
-select time(f1) from t1 union all select time(f1 + interval 1 second) from t1;
-# but the effect cannot be eliminated completely:
-alter table t1 modify f1 varchar(100);
-select time(f1) from t1;
-select time(f1) from t1 union all select time(f1 + interval 1 second) from t1;
-drop table t1;
diff --git a/mysql-test/t/func_timestamp.test b/mysql-test/t/func_timestamp.test
deleted file mode 100644
index 05a91b06d28..00000000000
--- a/mysql-test/t/func_timestamp.test
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Tests that depend on the timestamp and the TZ variable
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-# Set timezone to GMT-3, to make it possible to use "interval 3 hour"
-set time_zone="+03:00";
-
-create table t1 (Zeit time, Tag tinyint not null, Monat tinyint not null,
-Jahr smallint not null, index(Tag), index(Monat), index(Jahr) );
-insert into t1 values ("09:26:00",16,9,1998),("09:26:00",16,9,1998);
-SELECT CONCAT(Jahr,'-',Monat,'-',Tag,' ',Zeit) AS Date,
- UNIX_TIMESTAMP(CONCAT(Jahr,'-',Monat,'-',Tag,' ',Zeit)) AS Unix
-FROM t1;
-drop table t1;
-
-# End of 4.1 tests
-
-# Restore timezone to default
-set time_zone= @@global.time_zone;
diff --git a/mysql-test/t/func_weight_string.test b/mysql-test/t/func_weight_string.test
deleted file mode 100644
index b376b996556..00000000000
--- a/mysql-test/t/func_weight_string.test
+++ /dev/null
@@ -1,173 +0,0 @@
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-
-set global max_allowed_packet=1048576;
-connect (conn1,localhost,root,,);
-connection conn1;
-
-set names latin1;
-
-#
-# If it's BLOB or BINARY or VARBINARY, then output = input.
-#
-select hex(weight_string(0x010203));
-
-#
-# "AS CHAR ( int )" causes padding on the right. The pad
-# character is always space, that is, 0x20 or 0x0020.
-# The padding occurs before the conversion to a weight.
-# The value of "int" is the number of characters, not the number of bytes.
-#
-select hex(weight_string('aa' as char(3)));
-
-#
-# The minimum value of 'int' is 1.
-#
---error 1064
-select hex(weight_string('a' as char(-1)));
---error 1064
-select hex(weight_string('a' as char(0)));
-select hex(weight_string('a' as char(1)));
-
-#
-# If 'int' is smaller than the length of 'string',
-# truncation will occur with no warning.
-#
-select hex(weight_string('ab' as char(1)));
-
-#
-# If "AS CHAR ( int )" is omitted, there is no padding and no truncation.
-#
-select hex(weight_string('ab'));
-
-#
-# "AS BINARY ( int )" is like CHAR(int) but causes padding of 0x00
-# so one doesn't have to use "CAST(string AS BINARY(int))".
-#
-select hex(weight_string('aa' as binary(3)));
-select hex(weight_string(cast('aa' as binary(3))));
-
-#
-# If and only if one specifies "LEVEL numeric-list" (not "range"),
-# one may follow any "number" with [ASC|DESC][REVERSE]
-#
---error 1064
-select hex(weight_string('ab' level 1-1 ASC));
---error 1064
-select hex(weight_string('ab' level 1-1 DESC));
---error 1064
-select hex(weight_string('ab' level 1-1 REVERSE));
-
-#
-# If one says "DESC", then the weights come out NOTed
-# or negated for that level.
-# If one says "REVERSE", then the weights come out in
-# reverse order for that level, that is, starting with
-# the last character and ending with the first character.
-#
-select hex(weight_string('ab' level 1 ASC));
-select hex(weight_string('ab' level 1 DESC));
-select hex(weight_string('ab' level 1 REVERSE));
-select hex(weight_string('ab' level 1 DESC REVERSE));
-
-#
-# If the result length is less than or equal to the
-# maximum possible length for the VARBINARY data type,
-# then the result data type is VARBINARY. Otherwise
-# the result data type is BLOB.
-#
-create table t1 select weight_string('test') as w;
-show create table t1;
-drop table t1;
-create table t1 select weight_string(repeat('t',66000)) as w;
-show create table t1;
-drop table t1;
-
-#
-# If input is NULL, then output is NULL.
-#
-select weight_string(NULL);
-
-#
-# WEIGHT_STRING and REVERSE will not be a new reserved word.
-#
-select 1 as weight_string, 2 as reverse;
-
-#
-# Check that collation derivation is copied from the argument
-#
-select coercibility(weight_string('test'));
-select coercibility(weight_string('test' collate latin1_swedish_ci));
-
-#
-# Bug#33663 Character sets: weight_string function,
-# varchar column, wrong result
-#
-create table t1 (s1 varchar(5));
-insert into t1 values ('a'),(null);
-select hex(weight_string(s1)) from t1 order by s1;
-drop table t1;
-
---echo #
---echo # BUG#11898467 - SERVER CRASHES ON SELECT HEX(WEIGHT_STRING(STR AS [CHAR|BINARY](N))) IF N IS BIG
---echo #
-SELECT HEX(WEIGHT_STRING('ab' AS CHAR(1000000000000000000)));
-SELECT HEX(WEIGHT_STRING('ab' AS BINARY(1000000000000000000)));
-
-disconnect conn1;
-connection default;
-set global max_allowed_packet=default;
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-8369 Unexpected impossible WHERE for a condition on a ZEROFILL field
---echo #
-CREATE TABLE t1 (a INT(6) ZEROFILL);
-INSERT INTO t1 VALUES (1),(2);
-SELECT * FROM t1 WHERE a=1;
-SELECT * FROM t1 WHERE WEIGHT_STRING(a) IS NULL;
-SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL;
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL;
-ALTER TABLE t1 MODIFY a DOUBLE ZEROFILL;
-SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL;
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL;
-ALTER TABLE t1 MODIFY a DECIMAL(10,1) ZEROFILL;
-SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL;
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE a=1 AND WEIGHT_STRING(a) IS NULL;
-DROP TABLE t1;
-
---echo #
---echo # End of 10.1 tests
---echo #
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-10134 Add full support for DEFAULT
---echo #
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1, b VARBINARY(10) DEFAULT WEIGHT_STRING(a AS CHAR(10)));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('a');
-SELECT a, HEX(b) FROM t1;
-DROP TABLE t1;
-
-#
-# Item_func_weight_string::print()
-#
-create view v1 as select weight_string("MySQL" as char(4));
-select * from v1;
-drop view v1;
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/function_defaults.test b/mysql-test/t/function_defaults.test
deleted file mode 100644
index f8b23d0eda8..00000000000
--- a/mysql-test/t/function_defaults.test
+++ /dev/null
@@ -1,21 +0,0 @@
---echo #
---echo # Test of function defaults for any server, including embedded.
---echo #
-
---echo #
---echo # Function defaults run 1. No microsecond precision.
---echo #
-let $current_timestamp=CURRENT_TIMESTAMP;
-let $now=NOW();
-let $timestamp=TIMESTAMP;
-let $datetime=DATETIME;
-source 'include/function_defaults.inc';
-
---echo #
---echo # Function defaults run 2. Six digits scale on seconds precision.
---echo #
-let $current_timestamp=CURRENT_TIMESTAMP(6);
-let $now=NOW(6);
-let $timestamp=TIMESTAMP(6);
-let $datetime=DATETIME(6);
-source 'include/function_defaults.inc';
diff --git a/mysql-test/t/function_defaults_innodb.test b/mysql-test/t/function_defaults_innodb.test
deleted file mode 100644
index de5a6d34b73..00000000000
--- a/mysql-test/t/function_defaults_innodb.test
+++ /dev/null
@@ -1,24 +0,0 @@
---echo #
---echo # Test of function defaults for any server, including embedded.
---echo #
-
---source include/have_innodb.inc
-set default_storage_engine=innodb;
-
---echo #
---echo # Function defaults run 1. No microsecond precision.
---echo #
-let $current_timestamp=CURRENT_TIMESTAMP;
-let $now=NOW();
-let $timestamp=TIMESTAMP;
-let $datetime=DATETIME;
-source 'include/function_defaults.inc';
-
---echo #
---echo # Function defaults run 2. Six digits scale on seconds precision.
---echo #
-let $current_timestamp=CURRENT_TIMESTAMP(6);
-let $now=NOW(6);
-let $timestamp=TIMESTAMP(6);
-let $datetime=DATETIME(6);
-source 'include/function_defaults.inc';
diff --git a/mysql-test/t/function_defaults_notembedded.test b/mysql-test/t/function_defaults_notembedded.test
deleted file mode 100644
index 3d686c4b272..00000000000
--- a/mysql-test/t/function_defaults_notembedded.test
+++ /dev/null
@@ -1,18 +0,0 @@
---echo #
---echo # Test of function defaults for non-embedded server.
---echo #
-
---source include/not_embedded.inc
---source include/have_debug_sync.inc
-
---echo #
---echo # Function defaults run 1. No microsecond precision.
---echo #
-let $timestamp=TIMESTAMP;
---source include/function_defaults_notembedded.inc
-
---echo #
---echo # Function defaults run 2. Six digits scale on seconds precision.
---echo #
-let $timestamp=TIMESTAMP(6);
---source include/function_defaults_notembedded.inc
diff --git a/mysql-test/t/gcc296.test b/mysql-test/t/gcc296.test
deleted file mode 100644
index bfcd56ff396..00000000000
--- a/mysql-test/t/gcc296.test
+++ /dev/null
@@ -1,22 +0,0 @@
-#try to crash gcc 2.96
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-CREATE TABLE t1 (
- kodoboru varchar(10) default NULL,
- obor tinytext,
- aobor tinytext,
- UNIQUE INDEX kodoboru (kodoboru),
- FULLTEXT KEY obor (obor),
- FULLTEXT KEY aobor (aobor)
-);
-INSERT INTO t1 VALUES ('0101000000','aaa','AAA');
-INSERT INTO t1 VALUES ('0102000000','bbb','BBB');
-INSERT INTO t1 VALUES ('0103000000','ccc','CCC');
-INSERT INTO t1 VALUES ('0104000000','xxx','XXX');
-
-select * from t1;
-drop table t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/get_diagnostics.test b/mysql-test/t/get_diagnostics.test
deleted file mode 100644
index a30bad72136..00000000000
--- a/mysql-test/t/get_diagnostics.test
+++ /dev/null
@@ -1,852 +0,0 @@
---echo #
---echo # WL#2111: GET DIAGNOSTICS tests
---echo #
-
---echo #
---echo # In MariaDB GET is not reserved
---echo #
-
-CREATE TABLE t1 (get INT);
-DROP TABLE t1;
-
-DELIMITER |;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE get INT DEFAULT 1;
-END|
-DELIMITER ;|
-DROP PROCEDURE p1;
-
-# but cannot be used as a label
-
-DELIMITER |;
---error ER_PARSE_ERROR
-CREATE PROCEDURE p1()
-get:
-BEGIN
- SELECT 1;
-END get|
-DELIMITER ;|
-
---echo #
---echo # Test non-reserved keywords: CURRENT, DIAGNOSTICS, NUMBER, RETURNED_SQLSTATE
---echo #
-
-CREATE TABLE t1 (current INT, diagnostics INT, number INT, returned_sqlstate INT);
-INSERT INTO t1 (current, diagnostics, number, returned_sqlstate) values (1,2,3,4);
-SELECT current, diagnostics, number, returned_sqlstate FROM t1 WHERE number = 3;
-SELECT `current`, `number` FROM t1 WHERE `current` = 1 AND `number` = 3;
-DROP TABLE t1;
-
-DELIMITER |;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE current INT DEFAULT 1;
- DECLARE diagnostics INT DEFAULT 2;
- DECLARE number INT DEFAULT 3;
- DECLARE returned_sqlstate INT DEFAULT 4;
- SELECT current, diagnostics, number, returned_sqlstate;
-END|
-DELIMITER ;|
-
-CALL p1();
-
-DROP PROCEDURE p1;
-
---echo #
---echo # Test GET DIAGNOSTICS syntax
---echo #
-
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
---enable_warnings
-
---error ER_PARSE_ERROR
-GET;
---error ER_PARSE_ERROR
-GET CURRENT;
---error ER_PARSE_ERROR
-GET DIAGNOSTICS;
---error ER_PARSE_ERROR
-GET CURRENT DIAGNOSTICS;
-
---echo
---echo # Statement information syntax
---echo
-
---error ER_PARSE_ERROR
-GET DIAGNOSTICS @var;
-
---error ER_SP_UNDECLARED_VAR
-GET DIAGNOSTICS var;
-
-DELIMITER |;
---error ER_SP_UNDECLARED_VAR
-CREATE PROCEDURE p1()
-BEGIN
- GET DIAGNOSTICS var;
-END|
-DELIMITER ;|
-
-DELIMITER |;
---error ER_PARSE_ERROR
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE var INT;
- GET DIAGNOSTICS var;
-END|
-DELIMITER ;|
-
---error ER_PARSE_ERROR
-GET DIAGNOSTICS @var =;
---error ER_PARSE_ERROR
-GET DIAGNOSTICS @var = INVALID;
---error ER_PARSE_ERROR
-GET DIAGNOSTICS @var = MORE;
---error ER_PARSE_ERROR
-GET DIAGNOSTICS @var = CLASS_ORIGIN;
---error ER_PARSE_ERROR
-GET DIAGNOSTICS @var = INVALID,;
---error ER_PARSE_ERROR
-GET DIAGNOSTICS @var1 = NUMBER, @var2;
---error ER_PARSE_ERROR
-GET DIAGNOSTICS @var1 = NUMBER, @var2 = INVALID;
---error ER_PARSE_ERROR
-GET DIAGNOSTICS @@var1 = NUMBER;
---error ER_PARSE_ERROR
-GET DIAGNOSTICS @var1 = NUMBER, @@var2 = NUMBER;
-
-DELIMITER |;
---error ER_PARSE_ERROR
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE var INT;
- GET DIAGNOSTICS var = INVALID;
-END|
-DELIMITER ;|
-
-DELIMITER |;
---error ER_SP_UNDECLARED_VAR
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE var CONDITION FOR SQLSTATE '12345';
- GET DIAGNOSTICS var = NUMBER;
-END|
-DELIMITER ;|
-
-DELIMITER |;
---error ER_SP_UNDECLARED_VAR
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE var INT;
- GET DIAGNOSTICS var = NUMBER, var1 = ROW_COUNT;
-END|
-DELIMITER ;|
-
-GET DIAGNOSTICS @var = NUMBER;
-GET DIAGNOSTICS @var = ROW_COUNT;
-GET DIAGNOSTICS @var1 = NUMBER, @var2 = ROW_COUNT;
-GET DIAGNOSTICS @var1 = ROW_COUNT, @var2 = NUMBER;
-
-DELIMITER |;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE var INT;
- DECLARE var1 INT;
- DECLARE var2 INT;
- GET DIAGNOSTICS var = NUMBER;
- GET DIAGNOSTICS var = ROW_COUNT;
- GET DIAGNOSTICS var1 = NUMBER, var2 = ROW_COUNT;
- GET DIAGNOSTICS var1 = ROW_COUNT, var2 = NUMBER;
-END|
-DELIMITER ;|
-
-DROP PROCEDURE p1;
-
---echo
---echo # Condition information syntax
---echo
-
---error ER_PARSE_ERROR
-GET DIAGNOSTICS CONDITION;
---error ER_PARSE_ERROR
-GET DIAGNOSTICS CONDITION a;
---error ER_PARSE_ERROR
-GET DIAGNOSTICS CONDITION 1;
-
---error ER_PARSE_ERROR
-GET DIAGNOSTICS CONDITION 1 @var;
-
---error ER_SP_UNDECLARED_VAR
-GET DIAGNOSTICS CONDITION 1 var;
-
-DELIMITER |;
---error ER_SP_UNDECLARED_VAR
-CREATE PROCEDURE p1()
-BEGIN
- GET DIAGNOSTICS CONDITION 1 var;
-END|
-DELIMITER ;|
-
-DELIMITER |;
---error ER_PARSE_ERROR
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE var INT;
- GET DIAGNOSTICS CONDITION 1 var;
-END|
-DELIMITER ;|
-
---error ER_PARSE_ERROR
-GET DIAGNOSTICS CONDITION 1 @var =;
---error ER_PARSE_ERROR
-GET DIAGNOSTICS CONDITION 1 @var = INVALID;
---error ER_PARSE_ERROR
-GET DIAGNOSTICS CONDITION 1 @var = NUMBER;
---error ER_PARSE_ERROR
-GET DIAGNOSTICS CONDITION 1 @var = INVALID,;
---error ER_PARSE_ERROR
-GET DIAGNOSTICS CONDITION 1 @var1 = CLASS_ORIGIN, @var2;
---error ER_PARSE_ERROR
-GET DIAGNOSTICS CONDITION 1 @var1 = CLASS_ORIGIN, @var2 = INVALID;
---error ER_PARSE_ERROR
-GET DIAGNOSTICS CONDITION 1 @@var1 = CLASS_ORIGIN;
---error ER_PARSE_ERROR
-GET DIAGNOSTICS CONDITION 1 @var1 = CLASS_ORIGIN, @@var2 = CLASS_ORIGIN;
-
-DELIMITER |;
---error ER_PARSE_ERROR
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE var INT;
- GET DIAGNOSTICS CONDITION 1 var = INVALID;
-END|
-DELIMITER ;|
-
-DELIMITER |;
---error ER_SP_UNDECLARED_VAR
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE var CONDITION FOR SQLSTATE '12345';
- GET DIAGNOSTICS CONDITION 1 var = NUMBER;
-END|
-DELIMITER ;|
-
-DELIMITER |;
---error ER_SP_UNDECLARED_VAR
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE var INT;
- GET DIAGNOSTICS CONDITION 1 var = CLASS_ORIGIN, var1 = SUBCLASS_ORIGIN;
-END|
-DELIMITER ;|
-
-GET DIAGNOSTICS CONDITION 1 @var = CLASS_ORIGIN;
-GET DIAGNOSTICS CONDITION 1 @var = SUBCLASS_ORIGIN;
-GET DIAGNOSTICS CONDITION 1 @var1 = CLASS_ORIGIN, @var2 = SUBCLASS_ORIGIN;
-GET DIAGNOSTICS CONDITION 1 @var1 = SUBCLASS_ORIGIN, @var2 = CLASS_ORIGIN;
-
-DELIMITER |;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE var INT;
- DECLARE var1 INT;
- DECLARE var2 INT;
- GET DIAGNOSTICS CONDITION 1 var = CLASS_ORIGIN;
- GET DIAGNOSTICS CONDITION 1 var = SUBCLASS_ORIGIN;
- GET DIAGNOSTICS CONDITION 1 var1 = CLASS_ORIGIN, var2 = SUBCLASS_ORIGIN;
- GET DIAGNOSTICS CONDITION 1 var1 = SUBCLASS_ORIGIN, var2 = CLASS_ORIGIN;
-END|
-DELIMITER ;|
-
-DROP PROCEDURE p1;
-
---echo # Condition number expression
-
---error ER_PARSE_ERROR
-GET DIAGNOSTICS CONDITION -1 @var = CLASS_ORIGIN;
---error ER_PARSE_ERROR
-GET DIAGNOSTICS CONDITION 1+1 @var = CLASS_ORIGIN;
---error ER_PARSE_ERROR
-GET DIAGNOSTICS CONDITION ? @var = CLASS_ORIGIN;
---error ER_PARSE_ERROR
-GET DIAGNOSTICS CONDITION (1) @var = CLASS_ORIGIN;
---error ER_PARSE_ERROR
-GET DIAGNOSTICS CONDITION p1() @var = CLASS_ORIGIN;
---error ER_PARSE_ERROR
-GET DIAGNOSTICS CONDITION ABS(2) @var = CLASS_ORIGIN;
-
-# Unfortunate side effects...
-GET DIAGNOSTICS CONDITION 1.1 @var = CLASS_ORIGIN;
-GET DIAGNOSTICS CONDITION "1" @var = CLASS_ORIGIN;
-
-# Reset warnings
-SELECT COUNT(max_questions) INTO @var FROM mysql.user;
-
-GET DIAGNOSTICS CONDITION 9999 @var = CLASS_ORIGIN;
-GET DIAGNOSTICS CONDITION NULL @var = CLASS_ORIGIN;
-GET DIAGNOSTICS CONDITION a @var = CLASS_ORIGIN;
-
-# Reset warnings
-SELECT COUNT(max_questions) INTO @var FROM mysql.user;
-
-SET @cond = 1;
-GET DIAGNOSTICS CONDITION @cond @var1 = CLASS_ORIGIN;
-
-SET @cond = "invalid";
-GET DIAGNOSTICS CONDITION @cond @var1 = CLASS_ORIGIN;
-
-# Reset warnings
-SELECT COUNT(max_questions) INTO @var FROM mysql.user;
-
-DELIMITER |;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cond INT DEFAULT 1;
- DECLARE var INT;
- GET DIAGNOSTICS CONDITION cond var = CLASS_ORIGIN;
-END|
-DELIMITER ;|
-
-DROP PROCEDURE p1;
-
-DELIMITER |;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cond TEXT;
- DECLARE var INT;
- GET DIAGNOSTICS CONDITION cond var = CLASS_ORIGIN;
-END|
-DELIMITER ;|
-
-CALL p1();
-
-DROP PROCEDURE p1;
-
---echo #
---echo # Test GET DIAGNOSTICS runtime
---echo #
-
---echo
---echo # GET DIAGNOSTICS cannot be the object of a PREPARE statement.
---echo
-
---error ER_UNSUPPORTED_PS
-PREPARE stmt FROM "GET DIAGNOSTICS CONDITION 1 @var = CLASS_ORIGIN";
---error ER_UNSUPPORTED_PS
-PREPARE stmt FROM "GET DIAGNOSTICS @var = NUMBER";
-
---echo
---echo # GET DIAGNOSTICS does not clear the diagnostics area.
---echo
-
-SELECT CAST(-19999999999999999999 AS SIGNED);
-GET DIAGNOSTICS @var = NUMBER;
-SHOW WARNINGS;
-
---echo #
---echo # If GET DIAGNOSTICS itself causes an error, an error message is appended.
---echo #
-
-SELECT CAST(-19999999999999999999 AS SIGNED);
-GET DIAGNOSTICS CONDITION 99999 @var = CLASS_ORIGIN;
-SHOW WARNINGS;
-
---echo
---echo # Statement information runtime
---echo
-
-SELECT CAST(-19999999999999999999 AS SIGNED),
- CAST(-19999999999999999999 AS SIGNED);
-GET DIAGNOSTICS @var = NUMBER;
-SELECT @var;
-
-SELECT COUNT(max_questions) INTO @var FROM mysql.user;
-GET DIAGNOSTICS @var = NUMBER;
-SELECT @var;
-
-SELECT 1;
-GET DIAGNOSTICS @var = ROW_COUNT;
-SELECT @var;
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1),(2),(3);
-GET DIAGNOSTICS @var = ROW_COUNT;
-SELECT @var;
-DROP TABLE t1;
-
-DELIMITER |;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE number INT;
- DECLARE row_count INT;
-
- SELECT CAST(-19999999999999999999 AS SIGNED),
- CAST(-19999999999999999999 AS SIGNED);
-
- GET DIAGNOSTICS number = NUMBER;
-
- CREATE TABLE t1 (a INT);
- INSERT INTO t1 VALUES (1),(2),(3);
- GET DIAGNOSTICS row_count = ROW_COUNT;
- DROP TABLE t1;
-
- SELECT number, row_count;
-
-END|
-DELIMITER ;|
-
-CALL p1();
-
-DROP PROCEDURE p1;
-
---echo
---echo # Condition information runtime
---echo
-
-SELECT CAST(-19999999999999999999 AS SIGNED);
-
-GET DIAGNOSTICS CONDITION 1
- @class_origin = CLASS_ORIGIN,
- @subclass_origin = SUBCLASS_ORIGIN,
- @constraint_catalog = CONSTRAINT_CATALOG,
- @constraint_schema = CONSTRAINT_SCHEMA,
- @constraint_name = CONSTRAINT_NAME,
- @catalog_name = CATALOG_NAME,
- @schema_name = SCHEMA_NAME,
- @table_name = TABLE_NAME,
- @column_name = COLUMN_NAME,
- @cursor_name = CURSOR_NAME,
- @message_text = MESSAGE_TEXT,
- @mysql_errno = MYSQL_ERRNO,
- @returned_sqlstate = RETURNED_SQLSTATE;
-
---vertical_results
-SELECT
- @class_origin,
- @subclass_origin,
- @constraint_catalog,
- @constraint_schema,
- @constraint_name,
- @catalog_name,
- @schema_name,
- @table_name,
- @column_name,
- @cursor_name,
- @message_text,
- @mysql_errno,
- @returned_sqlstate;
---horizontal_results
-
-DELIMITER |;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE class_origin TEXT DEFAULT "a";
- DECLARE subclass_origin TEXT DEFAULT "a";
- DECLARE constraint_catalog TEXT DEFAULT "a";
- DECLARE constraint_schema TEXT DEFAULT "a";
- DECLARE constraint_name TEXT DEFAULT "a";
- DECLARE catalog_name TEXT DEFAULT "a";
- DECLARE schema_name TEXT DEFAULT "a";
- DECLARE table_name TEXT DEFAULT "a";
- DECLARE column_name TEXT DEFAULT "a";
- DECLARE cursor_name TEXT DEFAULT "a";
- DECLARE message_text TEXT DEFAULT "a";
- DECLARE mysql_errno INT DEFAULT 1;
- DECLARE returned_sqlstate TEXT DEFAULT "a";
-
- SELECT CAST(-19999999999999999999 AS SIGNED);
-
- GET DIAGNOSTICS CONDITION 1
- class_origin = CLASS_ORIGIN,
- subclass_origin = SUBCLASS_ORIGIN,
- constraint_catalog = CONSTRAINT_CATALOG,
- constraint_schema = CONSTRAINT_SCHEMA,
- constraint_name = CONSTRAINT_NAME,
- catalog_name = CATALOG_NAME,
- schema_name = SCHEMA_NAME,
- table_name = TABLE_NAME,
- column_name = COLUMN_NAME,
- cursor_name = CURSOR_NAME,
- message_text = MESSAGE_TEXT,
- mysql_errno = MYSQL_ERRNO,
- returned_sqlstate = RETURNED_SQLSTATE;
-
- SELECT
- class_origin,
- subclass_origin,
- constraint_catalog,
- constraint_schema,
- constraint_name,
- catalog_name,
- schema_name,
- table_name,
- column_name,
- cursor_name,
- message_text,
- mysql_errno,
- returned_sqlstate;
-END|
-DELIMITER ;|
-
---vertical_results
-CALL p1();
---horizontal_results
-
-DROP PROCEDURE p1;
-
-DELIMITER |;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE errno1 INT;
- DECLARE errno2 INT;
- DECLARE msg1 TEXT;
- DECLARE msg2 TEXT;
-
- SELECT CAST(-19999999999999999999 AS SIGNED);
- GET DIAGNOSTICS CONDITION 99999 msg1 = MESSAGE_TEXT;
-
- GET DIAGNOSTICS CONDITION 1 errno1 = MYSQL_ERRNO, msg1 = MESSAGE_TEXT;
- GET DIAGNOSTICS CONDITION 2 errno2 = MYSQL_ERRNO, msg2 = MESSAGE_TEXT;
-
- SELECT errno1, msg1, errno2, msg2;
-END|
-DELIMITER ;|
-
---vertical_results
-CALL p1();
---horizontal_results
-
-DROP PROCEDURE p1;
-
---echo
---echo # Interaction with SIGNAL
---echo
-
-DELIMITER |;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE errno INT DEFAULT 0;
- DECLARE msg TEXT DEFAULT "foo";
- DECLARE cond CONDITION FOR SQLSTATE "01234";
- DECLARE CONTINUE HANDLER for 1012
- BEGIN
- GET DIAGNOSTICS CONDITION 1 errno = MYSQL_ERRNO, msg = MESSAGE_TEXT;
- END;
-
- SIGNAL cond SET MESSAGE_TEXT = "Signal message", MYSQL_ERRNO = 1012;
-
- SELECT errno, msg;
-END|
-DELIMITER ;|
-
---vertical_results
-CALL p1();
---horizontal_results
-
-DROP PROCEDURE p1;
-
-DELIMITER |;
-CREATE PROCEDURE p1()
-BEGIN
- SIGNAL SQLSTATE '77777' SET MYSQL_ERRNO = 1000, MESSAGE_TEXT='ÁÂÃÅÄ';
-END|
-DELIMITER ;|
-
---error 1000
-CALL p1();
-
-GET DIAGNOSTICS CONDITION 1
- @mysql_errno = MYSQL_ERRNO, @message_text = MESSAGE_TEXT,
- @returned_sqlstate = RETURNED_SQLSTATE, @class_origin = CLASS_ORIGIN;
-
---vertical_results
-SELECT @mysql_errno, @message_text, @returned_sqlstate, @class_origin;
---horizontal_results
-
-DROP PROCEDURE p1;
-
-DELIMITER |;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cond CONDITION FOR SQLSTATE '12345';
- SIGNAL cond SET
- CLASS_ORIGIN = 'CLASS_ORIGIN text',
- SUBCLASS_ORIGIN = 'SUBCLASS_ORIGIN text',
- CONSTRAINT_CATALOG = 'CONSTRAINT_CATALOG text',
- CONSTRAINT_SCHEMA = 'CONSTRAINT_SCHEMA text',
- CONSTRAINT_NAME = 'CONSTRAINT_NAME text',
- CATALOG_NAME = 'CATALOG_NAME text',
- SCHEMA_NAME = 'SCHEMA_NAME text',
- TABLE_NAME = 'TABLE_NAME text',
- COLUMN_NAME = 'COLUMN_NAME text',
- CURSOR_NAME = 'CURSOR_NAME text',
- MESSAGE_TEXT = 'MESSAGE_TEXT text',
- MYSQL_ERRNO = 54321;
-END|
-DELIMITER ;|
-
---error 54321
-CALL p1();
-
-GET DIAGNOSTICS CONDITION 1
- @class_origin = CLASS_ORIGIN,
- @subclass_origin = SUBCLASS_ORIGIN,
- @constraint_catalog = CONSTRAINT_CATALOG,
- @constraint_schema = CONSTRAINT_SCHEMA,
- @constraint_name = CONSTRAINT_NAME,
- @catalog_name = CATALOG_NAME,
- @schema_name = SCHEMA_NAME,
- @table_name = TABLE_NAME,
- @column_name = COLUMN_NAME,
- @cursor_name = CURSOR_NAME,
- @message_text = MESSAGE_TEXT,
- @mysql_errno = MYSQL_ERRNO,
- @returned_sqlstate = RETURNED_SQLSTATE;
-
---vertical_results
-SELECT
- @class_origin,
- @subclass_origin,
- @constraint_catalog,
- @constraint_schema,
- @constraint_name,
- @catalog_name,
- @schema_name,
- @table_name,
- @column_name,
- @cursor_name,
- @message_text,
- @mysql_errno,
- @returned_sqlstate;
---horizontal_results
-
-DROP PROCEDURE p1;
-
---echo #
---echo # Demonstration
---echo #
-
---echo
---echo # The same statement information item can be used multiple times.
---echo
-
-SHOW WARNINGS;
-DELIMITER |;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE var INT;
- GET DIAGNOSTICS var = NUMBER, @var = NUMBER;
- SELECT var, @var;
-END|
-DELIMITER ;|
-
-CALL p1();
-
-DROP PROCEDURE p1;
-
---echo
---echo # Setting TABLE_NAME is currently not implemented.
---echo
-
-DELIMITER |;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE v VARCHAR(64);
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
- GET DIAGNOSTICS CONDITION 1 v = TABLE_NAME;
- DROP TABLE no_such_table;
- SELECT v;
-END|
-DELIMITER ;|
-
-CALL p1();
-
-DROP PROCEDURE p1;
-
---echo
---echo # Message is truncated to fit into target. No truncation warning.
---echo
-
-DELIMITER |;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE v CHAR(1);
- CREATE TABLE IF NOT EXISTS t1 (a INT);
- GET DIAGNOSTICS CONDITION 1 v = MESSAGE_TEXT;
- SELECT v;
-END|
-DELIMITER ;|
-
-CREATE TABLE t1 (a INT);
-CALL p1();
-DROP TABLE t1;
-
-DROP PROCEDURE p1;
-
---echo
---echo # Returns number of rows updated by the UPDATE statements.
---echo
-
-DELIMITER |;
-CREATE PROCEDURE p1(IN param INT)
-LANGUAGE SQL
-BEGIN
- DECLARE v INT DEFAULT 0;
- DECLARE rcount_each INT;
- DECLARE rcount_total INT DEFAULT 0;
- WHILE v < 5 DO
- UPDATE t1 SET a = a * 1.1 WHERE b = param;
- GET DIAGNOSTICS rcount_each = ROW_COUNT;
- SET rcount_total = rcount_total + rcount_each;
- SET v = v + 1;
- END WHILE;
- SELECT rcount_total;
-END|
-DELIMITER ;|
-
-CREATE TABLE t1 (a REAL, b INT);
-INSERT INTO t1 VALUES (1.1, 1);
-CALL p1(1);
-DROP TABLE t1;
-
-DROP PROCEDURE p1;
-
---echo
---echo # GET DIAGNOSTICS doesn't clear the diagnostics area.
---echo
-
-DELIMITER |;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- BEGIN
- GET CURRENT DIAGNOSTICS CONDITION 1 @x = RETURNED_SQLSTATE;
- SIGNAL SQLSTATE '01002';
- GET CURRENT DIAGNOSTICS CONDITION 1 @y = RETURNED_SQLSTATE;
- END;
- SIGNAL SQLSTATE '01001';
- SELECT @x, @y;
-END|
-DELIMITER ;|
-
-CALL p1();
-
-DROP PROCEDURE p1;
-
---echo
---echo # Using OUT and INOUT parameters as the target variables.
---echo
-
-DELIMITER |;
-CREATE PROCEDURE p1(OUT number INT, INOUT message TEXT)
-BEGIN
- DECLARE warn CONDITION FOR SQLSTATE "01234";
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- BEGIN
- GET DIAGNOSTICS number = NUMBER;
- GET DIAGNOSTICS CONDITION 1 message = MESSAGE_TEXT;
- END;
- SELECT message;
- SIGNAL warn SET MESSAGE_TEXT = "inout parameter";
-END|
-DELIMITER ;|
-
-SET @var1 = 0;
-SET @var2 = "message text";
-CALL p1(@var1, @var2);
-SELECT @var1, @var2;
-
-DROP PROCEDURE p1;
-
---echo
---echo # Using an IN parameter as the target variable.
---echo
-
-DELIMITER |;
-CREATE PROCEDURE p1(IN number INT)
-BEGIN
- SELECT number;
- GET DIAGNOSTICS number = NUMBER;
- SELECT number;
-END|
-DELIMITER ;|
-
-SET @var1 = 9999;
-CALL p1(@var1);
-SELECT @var1;
-
-DROP PROCEDURE p1;
-
---echo
---echo # Using GET DIAGNOSTICS in a stored function.
---echo
-
-DELIMITER |;
-CREATE FUNCTION f1() RETURNS TEXT
-BEGIN
- DECLARE message TEXT;
- DECLARE warn CONDITION FOR SQLSTATE "01234";
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- BEGIN
- GET DIAGNOSTICS CONDITION 1 message = MESSAGE_TEXT;
- END;
- SIGNAL warn SET MESSAGE_TEXT = "message text";
- return message;
-END|
-DELIMITER ;|
-
-SELECT f1();
-
-DROP FUNCTION f1;
-
---echo
---echo # Using GET DIAGNOSTICS in a trigger.
---echo
-
-CREATE TABLE t1 (a INT);
-
-DELIMITER |;
-CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW
-BEGIN
- DECLARE var INT DEFAULT row_count();
- GET DIAGNOSTICS @var1 = ROW_COUNT;
- SET @var2 = var;
-END|
-DELIMITER ;|
-
-SET @var1 = 9999, @var2 = 9999;
-INSERT INTO t1 VALUES (1), (2);
-SELECT @var1, @var2;
-
-DROP TRIGGER trg1;
-DROP TABLE t1;
-
---echo
---echo # GET DIAGNOSTICS does not reset ROW_COUNT
---echo
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1);
-GET DIAGNOSTICS @var1 = ROW_COUNT;
-GET DIAGNOSTICS @var2 = ROW_COUNT;
-SELECT @var1, @var2;
-DROP TABLE t1;
-
---echo
---echo # Items are UTF8 (utf8_general_ci default collation)
---echo
-
-SELECT CAST(-19999999999999999999 AS SIGNED);
-GET DIAGNOSTICS CONDITION 1 @var1 = MESSAGE_TEXT, @var2 = CLASS_ORIGIN;
-SELECT CHARSET(@var1), COLLATION(@var1), COERCIBILITY(@var1);
-SELECT CHARSET(@var2), COLLATION(@var2), COERCIBILITY(@var2);
-
---echo #
---echo # Command statistics
---echo #
-
-FLUSH STATUS;
-SHOW STATUS LIKE 'Com%get_diagnostics';
-GET DIAGNOSTICS @var1 = NUMBER;
-SHOW STATUS LIKE 'Com%get_diagnostics';
diff --git a/mysql-test/t/gis-alter_table_online.test b/mysql-test/t/gis-alter_table_online.test
deleted file mode 100644
index be6d2137e77..00000000000
--- a/mysql-test/t/gis-alter_table_online.test
+++ /dev/null
@@ -1,82 +0,0 @@
---source include/have_innodb.inc
---source include/have_geometry.inc
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-8948 ALTER ... INPLACE does work for BINARY, BLOB
---echo #
-
-#
-# Blob variants to GEOMETRY
-#
-CREATE TABLE t1 (a TINYBLOB);
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE t1 MODIFY a GEOMETRY, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a MEDIUMBLOB);
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE t1 MODIFY a GEOMETRY, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a BLOB);
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE t1 MODIFY a GEOMETRY, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a LONGBLOB);
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE t1 MODIFY a GEOMETRY, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-#
-# GEOMETRY to BLOB variants
-#
-
-CREATE TABLE t1 (a GEOMETRY);
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE t1 MODIFY a TINYBLOB, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a GEOMETRY);
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE t1 MODIFY a MEDIUMBLOB, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a GEOMETRY);
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE t1 MODIFY a BLOB, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a GEOMETRY);
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE t1 MODIFY a LONGBLOB, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-#
-# Different GEOMETRY types
-#
-
-# Can't do INPLACE from a supertype to a subtype
-CREATE TABLE t1 (a GEOMETRY);
---error ER_ALTER_OPERATION_NOT_SUPPORTED
-ALTER TABLE t1 MODIFY a POLYGON, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-# Ok to do INPLACE from a subtype to a supertype
-CREATE TABLE t1 (a POLYGON);
-ALTER TABLE t1 MODIFY a GEOMETRY, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-# Ok to do INPLACE for two equal geometry subtypes
-CREATE TABLE t1 (a POLYGON);
-ALTER TABLE t1 MODIFY a POLYGON, ALGORITHM=INPLACE;
-DROP TABLE t1;
-
-
---echo #
---echo # End of 10.1 tests
---echo #
diff --git a/mysql-test/t/gis-debug.test b/mysql-test/t/gis-debug.test
deleted file mode 100644
index 588bc706370..00000000000
--- a/mysql-test/t/gis-debug.test
+++ /dev/null
@@ -1,113 +0,0 @@
---source include/have_geometry.inc
---source include/have_debug.inc
-
-SET @tmp=ST_GIS_DEBUG(1);
-
---source include/gis_debug.inc
-
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-10134 Add full support for DEFAULT
---echo #
-
---error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
-CREATE TABLE t1 (a INT DEFAULT ST_GIS_DEBUG(1));
-
---echo #
---echo # End of 10.2 tests
---echo #
-
---echo #
---echo # Start of 10.3 tests
---echo #
-
---echo #
---echo # Comparison data type aggregation for pluggable data types
---echo #
-
-SET SESSION debug_dbug="+d,Item_func_in";
-SET SESSION debug_dbug="+d,Predicant_to_list_comparator";
-
-CREATE TABLE t1 (a POINT);
-INSERT INTO t1 VALUES (POINT(1,1)),(POINT(1,2)),(POINT(1,3));
-SELECT COUNT(*) FROM t1 WHERE a IN (POINT(1,1),POINT(10,20),POINT(10,30));
-SELECT COUNT(*) FROM t1 WHERE a IN (POINT(1,1),POINT(10,20),POINT(10,30),'test');
-SELECT COUNT(*) FROM t1 WHERE a IN ('test','test1');
-DROP TABLE t1;
-
-CREATE TABLE t1 (a TEXT);
-INSERT INTO t1 VALUES ('test'),('test1'),('test2');
-SELECT * FROM t1 WHERE a IN ('test',POINT(1,1));
-DROP TABLE t1;
-
-SET SESSION debug_dbug="-d,Predicant_to_list_comparator";
-SET SESSION debug_dbug="-d,Item_func_in";
-
-
---echo #
---echo # MDEV-12238 Add Type_handler::Item_func_{plus|minus|mul|div|mod}_fix_length_and_dec()
---echo #
-
-# This tests is to check that operators '+' and '*' are commutative,
-# while operators '/', '-' and 'MOD' are not commutative.
-#
-# It forces substitution of type_aggregator_for_{plus|minus|mul|div|mod} to
-# type_aggregator_for_result / type_aggregator_non_commutative_test,
-# which have pairs:
-# (GEOMETRY,GEOMETRY)->GEOMETRY
-# (GEOMETRY,VARCHAR)->GEOMETRY
-# Note, they don't not have a pair:
-# (VARCHAR,GEOMETRY)->GEOMETRY
-#
-# Commutative operators should work for all these argument type combinations:
-# (GEOMETRY,GEOMETRY), (GEOMETRY,VARCHAR), (VARCHAR,GEOMETRY).
-# Non-commutative operators should work for:
-# (GEOMETRY,GEOMETRY), (GEOMETRY,VARCHAR),
-# but should fail for (VARCHAR,GEOMETRY).
-#
-# Note, LIMIT 0 is needed to avoid calling str_op(), which does DBUG_ASSERT(0).
-
-SET debug_dbug='+d,num_op';
-
-# (GEOMETRY,GEOMETRY) gives GEOMETRY for all operators
-CREATE TABLE t1 AS SELECT
- POINT(0,0)+POINT(0,0),
- POINT(0,0)-POINT(0,0),
- POINT(0,0)*POINT(0,0),
- POINT(0,0)/POINT(0,0),
- POINT(0,0) MOD POINT(0,0) LIMIT 0;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-# (GEOMETRY,VARCHAR) gives GEOMETRY for all operators
-CREATE TABLE t1 AS SELECT
- POINT(0,0)+'0',
- POINT(0,0)-'0',
- POINT(0,0)*'0',
- POINT(0,0)/'0',
- POINT(0,0) MOD '0' LIMIT 0;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-# (VARCHAR,GEOMETRY) gives GEOMETRY for commutative operators
-CREATE TABLE t1 AS SELECT
- '0'+POINT(0,0),
- '0'*POINT(0,0) LIMIT 0;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-# (VARCHAR,GEOMETRY) gives an error for non-commutative operators
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-CREATE TABLE t1 AS SELECT '0'-POINT(0,0) LIMIT 0;
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-CREATE TABLE t1 AS SELECT '0'/POINT(0,0) LIMIT 0;
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-CREATE TABLE t1 AS SELECT '0' MOD POINT(0,0) LIMIT 0;
-
-SET debug_dbug='-d,num_op';
diff --git a/mysql-test/t/gis-json.test b/mysql-test/t/gis-json.test
deleted file mode 100644
index b91ef235fd0..00000000000
--- a/mysql-test/t/gis-json.test
+++ /dev/null
@@ -1,49 +0,0 @@
--- source include/have_geometry.inc
-
-select st_asgeojson(geomfromtext('POINT(1 1)'));
-select st_asgeojson(geomfromtext('LINESTRING(10 10,20 10,20 20,10 20,10 10)'));
-select st_asgeojson(geomfromtext('POLYGON((10 10,20 10,20 20,10 20,10 10))'));
-select st_asgeojson(geomfromtext('MULTIPOLYGON(((10 10,20 10,20 20,10 20,10 10)))'));
-select st_asgeojson(geomfromtext('multilinestring((10 10,20 10,20 20,10 20,10 10))'));
-select st_asgeojson(geomfromtext('multipoint(10 10,20 10,20 20,10 20,10 10)'));
-select st_asgeojson(st_geomfromtext('GEOMETRYCOLLECTION(POINT(100 0),LINESTRING(101 0,102 1))'));
-
-SELECT st_astext(st_geomfromgeojson('{"type":"point","coordinates":[1,2]}'));
-SELECT st_astext(st_geomfromgeojson('{"type":"LineString","coordinates":[[1,2],[4,5],[7,8]]}'));
-SELECT st_astext(st_geomfromgeojson('{"type": "polygon", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}'));
-SELECT st_astext(st_geomfromgeojson('{"type":"multipoint","coordinates":[[1,2],[4,5],[7,8]]}'));
-SELECT st_astext(st_geomfromgeojson('{"type": "multilinestring", "coordinates": [[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]}'));
-SELECT st_astext(st_geomfromgeojson('{"type": "multipolygon", "coordinates": [[[[10, 10], [20, 10], [20, 20], [10, 20], [10, 10]]]]}'));
-SELECT st_astext(st_geomfromgeojson('{"type": "GeometryCollection", "geometries": [{"type": "Point","coordinates": [100.0, 0.0]}, {"type": "LineString","coordinates": [[101.0, 0.0],[102.0, 1.0]]}]}'));
-
-SELECT st_astext(st_geomfromgeojson('{"type":"point"}'));
-SELECT st_astext(st_geomfromgeojson('{"type":"point"'));
-SELECT st_astext(st_geomfromgeojson('{"type""point"}'));
-
-SELECT st_astext(st_geomfromgeojson('{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] } }'));
-SELECT st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}'));
-
---error ER_WRONG_VALUE_FOR_TYPE
-SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',5));
-
---error ER_GIS_INVALID_DATA
-SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',1));
-
-SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',2));
-SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',3));
-SELECT ST_AsText(ST_GeomFromGeoJSON('{ "type": "Point", "coordinates": [5.3, 15.0, 4.3]}',4));
-
-SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),2);
-SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),1);
-SELECT ST_AsGeoJSON(ST_GeomFromText('POINT(5.363 7.266)'),10);
-
-SELECT ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 1);
-SELECT ST_AsGeoJSON(ST_GeomFromText("POINT(10 11)"), 100, 5);
-
-SELECT st_astext(st_geomfromgeojson('{"type": "MultiLineString","coordinates": []}')) as a;
-SELECT st_astext(st_geomfromgeojson('{"type": "Polygon","coordinates": []}')) as a;
-SELECT st_astext(st_geomfromgeojson('{"type": "MultiPolygon","coordinates": []}')) as a;
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/gis-loaddata.test b/mysql-test/t/gis-loaddata.test
deleted file mode 100644
index ad6a2c56b08..00000000000
--- a/mysql-test/t/gis-loaddata.test
+++ /dev/null
@@ -1,21 +0,0 @@
---echo #
---echo # MDEV-15497 Wrong empty value in a GEOMETRY column on LOAD DATA
---echo #
-
-SET sql_mode='';
-
-CREATE TABLE t1 (id INT, a GEOMETRY NOT NULL);
---error ER_WARN_NULL_TO_NOTNULL
-LOAD DATA INFILE '../../std_data/loaddata/mdev-15497.txt' INTO TABLE t1;
---error ER_WARN_NULL_TO_NOTNULL
-LOAD DATA INFILE '../../std_data/loaddata/mdev-15497.txt' INTO TABLE t1 FIELDS TERMINATED BY '';
-DROP TABLE t1;
-
-
-CREATE TABLE t1 (id INT, a GEOMETRY);
-LOAD DATA INFILE '../../std_data/loaddata/mdev-15497.txt' INTO TABLE t1;
-SELECT * FROM t1;
-TRUNCATE TABLE t1;
-LOAD DATA INFILE '../../std_data/loaddata/mdev-15497.txt' INTO TABLE t1 FIELDS TERMINATED BY '';
-SELECT * FROM t1;
-DROP TABLE t1;
diff --git a/mysql-test/t/gis-precise.test b/mysql-test/t/gis-precise.test
deleted file mode 100644
index 07fabae6025..00000000000
--- a/mysql-test/t/gis-precise.test
+++ /dev/null
@@ -1,386 +0,0 @@
--- source include/have_geometry.inc
-
-
-#
-# Spatial objects
-#
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-select 1, ST_Intersects(GeomFromText('POLYGON((0 0,20 0,20 20,0 20,0 0))'), GeomFromText('POLYGON((10 10,30 10,30 30,10 30,10 10))'));
-select 0, ST_Intersects(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POLYGON((10 40, 40 50, 20 70, 10 40))'));
-select 1, ST_Intersects(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POINT(10 10)'));
-select 1, ST_Intersects(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))'));
-select 0, ST_Within(GeomFromText('POLYGON((0 0,20 10,10 30, 0 0))'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))'));
-select 1, ST_Within(GeomFromText('POLYGON((1 1,20 10,10 30, 1 1))'), GeomFromText('POLYGON((0 0,30 5,10 40, 0 0))'));
-
-
-create table t1 (g point);
-insert into t1 values
-(GeomFromText('POINT(2 2)')), (GeomFromText('POINT(2 4)')), (GeomFromText('POINT(2 6)')), (GeomFromText('POINT(2 8)')),
-(GeomFromText('POINT(4 2)')), (GeomFromText('POINT(4 4)')), (GeomFromText('POINT(4 6)')), (GeomFromText('POINT(4 8)')),
-(GeomFromText('POINT(6 2)')), (GeomFromText('POINT(6 4)')), (GeomFromText('POINT(6 6)')), (GeomFromText('POINT(6 8)')),
-(GeomFromText('POINT(8 2)')), (GeomFromText('POINT(8 4)')), (GeomFromText('POINT(8 6)')), (GeomFromText('POINT(8 8)'));
-
-select astext(g) from t1 where ST_Within(g, GeomFromText('POLYGON((5 1, 7 1, 7 7, 5 7, 3 3, 5 3, 5 1))'));
-select 'Contains';
-select astext(g) from t1 where ST_Contains(GeomFromText('POLYGON((5 1, 7 1, 7 7, 5 7, 3 3, 5 3, 5 1))'), g);
-select 'Intersects';
-select astext(g) from t1 where ST_Intersects(GeomFromText('POLYGON((5 1, 7 1, 7 7, 5 7, 3 3, 5 3, 5 1))'), g);
-select 'Contains';
-select astext(g) from t1 where ST_Contains(GeomFromText('POLYGON((5 1, 7 1, 7 7, 5 7, 3 3, 5 3, 5 1))'), g);
-select 'Contains2';
-select astext(g) from t1 where ST_Contains(GeomFromText('POLYGON((5 1, 7 1, 7 7, 5 7, 3 3, 5 3, 5 1), (5.01 3.01, 6 5, 9 5, 8 3, 5.01 3.01))'), g);
-
-DROP TABLE t1;
-
-select 0, ST_Within(GeomFromText('LINESTRING(15 15, 50 50, 60 60)'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))'));
-select 1, ST_Within(GeomFromText('LINESTRING(15 15, 16 16)'), GeomFromText('POLYGON((10 10,30 20,20 40, 10 10))'));
-
-
-select 1, ST_Intersects(GeomFromText('LINESTRING(15 15, 50 50)'), GeomFromText('LINESTRING(50 15, 15 50)'));
-select 0, ST_Intersects(GeomFromText('LINESTRING(15 15, 50 50)'), GeomFromText('LINESTRING(16 16, 51 51)'));
-
-select 1, ST_Intersects(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))'));
-
-select astext(ST_Union(geometryfromtext('point(1 1)'), geometryfromtext('polygon((0 0, 2 0, 1 2, 0 0))')));
-select astext(ST_Intersection(geometryfromtext('point(1 1)'), geometryfromtext('polygon((0 0, 2 0, 1 2, 0 0))')));
-
-select ST_Intersects(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))'));
-select ST_contains(GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)), ((6 6, 6 11, 11 11, 11 6, 6 6)))'), GeomFromText('POINT(5 10)'));
-select ST_Disjoint(GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), GeomFromText('POLYGON((10 10, 10 15, 15 15, 15 10, 10 10))'));
-select ST_Disjoint(GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), GeomFromText('POLYGON((10 10, 10 4, 4 4, 4 10, 10 10))'));
-select ST_Overlaps(GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), GeomFromText('POLYGON((10 10, 10 4, 4 4, 4 10, 10 10))'));
-select ST_Overlaps(GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))'), GeomFromText('POLYGON((1 1, 1 4, 4 4, 4 1, 1 1))'));
-
-# Distance tests
-select ST_DISTANCE(geomfromtext('polygon((0 0, 1 2, 2 1, 0 0))'), geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))'));
-select ST_DISTANCE(geomfromtext('polygon((0 0, 1 2, 2 1, 0 0))'), geomfromtext('linestring(0 1, 1 0)'));
-select ST_DISTANCE(geomfromtext('polygon((0 0, 3 6, 6 3, 0 0))'), geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))'));
-select ST_DISTANCE(geomfromtext('polygon((0 0, 3 6, 6 3, 0 0),(2 2, 3 4, 4 3, 2 2))'), geomfromtext('point(3 3)'));
-select ST_DISTANCE(geomfromtext('linestring(0 0, 3 6, 6 3, 0 0)'), geomfromtext('polygon((2 2, 3 4, 4 3, 2 2))'));
-
-
-# Operations tests
-select astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('POLYGON((50 5, 55 10, 0 45, 50 5))')));
-select astext(ST_Intersection(GeomFromText('LINESTRING(0 0, 50 45, 40 50, 0 0)'), GeomFromText('LINESTRING(50 5, 55 10, 0 45, 50 5)')));
-select astext(ST_Intersection(GeomFromText('LINESTRING(0 0, 50 45, 40 50)'), GeomFromText('LINESTRING(50 5, 55 10, 0 45)')));
-select astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('POINT(20 20)')));
-select astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200)')));
---replace_result 7.999999999999999 8
-select astext(ST_Intersection(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)')));
---replace_result 7.999999999999999 8
-select astext(ST_UNION(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)')));
-
-select astext(ST_intersection(geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), geomfromtext('polygon((0 0, 1 1, 0 2, 0 0))')));
-
-select astext(ST_symdifference(geomfromtext('polygon((0 0, 1 0, 0 1, 0 0))'), geomfromtext('polygon((0 0, 1 1, 0 2, 0 0))')));
---replace_result 7.999999999999999 8
-select astext(ST_UNION(GeomFromText('POLYGON((0 0, 50 45, 40 50, 0 0))'), GeomFromText('LINESTRING(-10 -10, 200 200, 199 201, -11 -9)')));
-
-# Buffer() tests
---replace_result 0012045437948276 00120454379482759
-select astext(ST_buffer(geometryfromtext('point(1 1)'), 1));
-create table t1(geom geometrycollection);
-insert into t1 values (geomfromtext('POLYGON((0 0, 10 10, 0 8, 0 0))'));
-insert into t1 values (geomfromtext('POLYGON((1 1, 10 10, 0 8, 1 1))'));
-select astext(geom), area(geom),round(area(ST_buffer(geom,2)), 7) from t1;
-select ST_NUMPOINTS(ST_EXTERIORRING(ST_buffer(geom,2))) from t1;
-
-set @geom=geomfromtext('LINESTRING(2 1, 4 2, 2 3, 2 5)');
-set @buff=ST_buffer(@geom,1);
---replace_result 40278744502097 40278744502096
-select ST_NUMPOINTS(ST_EXTERIORRING(@buff));
-
-# cleanup
-DROP TABLE t1;
-
-#Touches tests
-select st_touches(geomfromtext('point(0 0)'), geomfromtext('point(1 1)'));
-select st_touches(geomfromtext('point(1 1)'), geomfromtext('point(1 1)'));
-select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('point(1 1)'));
-select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('point(1 0)'));
-select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('point(1 2)'));
-select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('polygon((1 1.2, 1 0, 2 0, 1 1.2))'));
-select st_touches(geomfromtext('polygon((0 0, 2 2, 0 4, 0 0))'), geomfromtext('polygon((1 1, 1 0, 2 0, 1 1))'));
-
-#Equals test
-SELECT ST_Equals(PolyFromText('POLYGON((67 13, 67 18, 67 18, 59 18, 59 13, 67 13) )'),PolyFromText('POLYGON((67 13, 67 18, 59 19, 59 13, 59 13, 67 13) )')) as result;
-SELECT ST_Equals(PolyFromText('POLYGON((67 13, 67 18, 67 18, 59 18, 59 13, 67 13) )'),PolyFromText('POLYGON((67 13, 67 18, 59 18, 59 13, 59 13, 67 13) )')) as result;
-SELECT ST_Equals(PointFromText('POINT (12 13)'),PointFromText('POINT (12 13)')) as result;
-
-
---echo #
---echo # BUG#11755628/47429: INTERSECTION FUNCTION CRASHED MYSQLD
---echo # BUG#11759650/51979: UNION/INTERSECTION OF POLYGONS CRASHES MYSQL
---echo #
-
-SELECT ASTEXT(ST_UNION(GEOMFROMTEXT('POLYGON((525000 183300,525400
-183300,525400 18370, 525000 183700,525000 183300))'),
-geomfromtext('POLYGON((525298.67 183511.53,525296.57
-183510.39,525296.42 183510.31,525289.11 183506.62,525283.17
-183503.47,525280.98 183502.26,525278.63 183500.97,525278.39
-183500.84,525276.79 183500,525260.7 183491.55,525263.95
-183484.75,525265.58 183481.95,525278.97 183488.73,525276.5
-183493.45,525275.5 183495.7,525280.35 183498.2,525282.3
-183499.1,525282.2 183499.3,525283.55 183500,525301.75
-183509.35,525304.45 183504.25,525307.85 183504.95,525304.5
-183510.83,525302.81 183513.8,525298.67 183511.53),(525275.06
-183489.89,525272.06 183488.37,525268.94 183494.51,525271.94
-183496.03,525275.06 183489.89),(525263.26 183491.55,525266.15
-183493.04,525269.88 183485.82,525266.99 183484.33,525263.26
-183491.55))'))) st_u;
-
-SET @a=0x0000000001030000000200000005000000000000000000000000000000000000000000000000002440000000000000000000000000000024400000000000002440000000000000000000000000000024400000000000000000000000000000000000000000000000000000F03F000000000000F03F0000000000000040000000000000F03F00000000000000400000000000000040000000000000F03F0000000000000040000000000000F03F000000000000F03F;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ASTEXT(TOUCHES(@a, GEOMFROMTEXT('point(0 0)'))) t;
-
-
-# bug #801243 Assertion `(0)' failed in Gis_geometry_collection::init_from_opresult on ST_UNION
-
-SELECT astext(ST_UNION (
- PolyFromText('POLYGON(( 2 2 ,3 2,2 7,2 2),( 0 0,8 2,1 9,0 0))'),
- ExteriorRing( Envelope( MultiLineStringFromText('MULTILINESTRING((3 4,5 3),(3 0,0 5))')))));
-
-#bug 801189 ST_BUFFER asserts if radius = 0
-SELECT astext(ST_BUFFER(LineStringFromText('LINESTRING(0 0,1 1)'),0));
-
-#bug 801199 Infinite recursion in Gcalc_function::count_internal with ST_BUFFER over MULTIPOINT
-SELECT Round(ST_Area(ST_BUFFER(MultipointFromText('MULTIPOINT(7 7,3 7,7 2,7 4 ,7 7)'), 3)), 5);
-
-#bug 801212 Assertion with ST_INTERSECTION on NULL values
-SELECT ST_INTERSECTION(NULL, NULL);
-
-#bug 804305 Crash in wkb_get_double with ST_INTERSECTION
-SELECT ASTEXT(ST_INTERSECTION(
- MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)),
- ((0 5,3 5,3 0,0 0,0 1,2 1,2 2,0 2,0 5), (1 3,2 3,2 4,1 4,1 3)),
- ((2 2,5 2,4 4,2 8,2 2)))'),
- MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 4,2 5,3 5)),
- ((2 2,9 2,0 2,2 6,2 2)),
- ((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)),
- ((9 9,6 8,7 0,9 9)))')));
-
-#bug 804324 Assertion 0 in Gcalc_scan_iterator::pop_suitable_intersection
-
-SELECT ROUND(ST_LENGTH(ST_UNION(
- MULTILINESTRINGFROMTEXT('MULTILINESTRING((6 2,4 0,3 5,3 6,4 3,6 4,3 9,0 7,3 7,8 4,2 9,5 0),
- (8 2,1 3,9 0,4 4))'),
- MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 5,6 7,9 7,5 2,1 6,3 6))'))), 7);
-
-SELECT ST_NUMGEOMETRIES((ST_UNION(ST_UNION(
- MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 0,4 2,0 2,1 5,0 3,7 0,8 5,5 8),
- (6 2,4 0,3 5,3 6,4 3,6 4,3 9,0 7,3 7,8 4,2 9,5 0),
- (7 8,3 1,0 9,6 0,4 8),
- (9 3,0 4,5 9,6 4),
- (8 2,1 3,9 0,4 4))'),
- MULTILINESTRINGFROMTEXT('MULTILINESTRING((6 0,9 3,2 5,3 6,3 2),
- (2 5,6 7,9 7,5 2,1 6,3 6))')),
- MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((7 7,3 7,3 1,7 8,7 7)),
- ((3 5,2 4,2 5,3 5)),
- ((7 7,8 7,3 7,7 7,7 7)),
- ((0 5,3 5,3 4,1 4,1 3,3 3,3 0,0 0,0 5), (1 1,2 1,2 2,1 2,1 1)))'))));
-
-#bug #805860 Second assertion Assertion `n > 0 && n < SINUSES_CALCULATED*2+1' in get_n_sinco
-
-SELECT Round(ST_AREA(ST_BUFFER( ST_UNION(
- POLYGONFROMTEXT('POLYGON((7 7, 7 7, 7 4, 7 7, 7 7))'),
- POLYGONFROMTEXT('POLYGON((7 7, 4 7, 2 9, 7 6, 7 7))')), 1)), 6);
-
-
-#bug #804259 Second assertion in Gis_geometry_collection::init_from_opresult
-
-SELECT AsText(ST_UNION(MultiPolygonFromText('
- MULTIPOLYGON(((2 2, 2 8, 8 8, 8 2, 2 2), (4 4, 4 6, 6 6, 6 4, 4 4)),
- ((0 0, 8 3, 7 4, 0 0)),
- ((2 2, 2 8, 8 8, 8 2, 2 2), (4 4, 4 6, 6 6, 6 4, 4 4)))'),
-MultiPolygonFromText(' MULTIPOLYGON(((0 0, 1 9, 4 6, 0 0)),
- ((0 5, 3 5, 3 4, 1 4, 1 3, 3 3, 3 0, 0 0, 0 5), (1 1, 2 1, 2 2, 1 2, 1 1)),
- ((7 7, 4 7, 6 3, 7 2, 7 7)),
- ((0 5, 3 5, 3 4, 1 4, 1 3, 3 3, 3 0, 0 0, 0 5), (1 1, 2 1, 2 2, 1 2, 1 1))) ')));
-
-
-#bug 801217 Assertion `t1->result_range' in Gcalc_operation_reducer::end_couple
-
-SELECT AsText(ST_SYMDIFFERENCE(
- MultiLineStringFromText('MULTILINESTRING((7 7, 1 7, 8 5, 7 8, 7 7),
- (6 3, 3 4, 1 1, 9 9, 9 0, 8 4, 9 9))'),
- Envelope(GeometryFromText('MULTIPOINT(7 9, 0 0, 3 7, 1 6, 0 0)'))));
-
-#bug 804266 Memory corruption/valgrind warning/crash in move_hole() with ST_UNION
-
-SELECT AsText(ST_UNION(
- MultiPolygonFromText('MULTIPOLYGON(((9 9, 7 9, 1 1, 9 9)),
- ((2 2, 1 2, 3 3, 2 2, 2 2)),
- ((0 0, 7 5, 9 6, 0 0)),
- ((7 7, 5 7, 1 5, 7 1, 7 7)))'),
- MultiPolygonFromText('MULTIPOLYGON(((2 2, 2 2, 1 5, 2 7, 2 2)),
- ((0 5, 3 5, 3 0, 0 0, 0 5), (1 1, 2 1, 2 4, 1 4, 1 1)))')));
-
-#bug 802376 ST_INTERSECTION returns wrong result on two overlapping linestrings in maria-5.3-gis
-
-SELECT AsText( ST_INTERSECTION(
- LinestringFromText('LINESTRING( 3 5, 2 5, 2 4, 3 4, 3 5 ) ') ,
- LinestringFromText('LINESTRING( 3 5, 2 4, 2 5, 3 5 ) ')
-));
-
-#bug 801560 ST_UNION of adjacent polygons includes extra line in maria-5.3-gis
-
-SELECT AsText( ST_UNION(
- PolygonFromText(' POLYGON( ( 2 2 , 3 2 , 7 5 , 2 0 , 2 2 ) ) ') ,
- PolygonFromText(' POLYGON( ( 2 2 , 3 2 , 3 3 , 2 5 , 2 2 ) ) ') ) );
-
-#bug 801466 ST_INTERSECTION() returns invalid value on empty intersection in maria-5.3-gis
-
-SELECT AsText(ST_INTERSECTION(LinestringFromText('LINESTRING(1 1, 2 2)'), GeometryFromText('LINESTRING(3 3, 4 4)')));
-
-#bug 839341 100% CPU usage with ST_UNION in maria-5.3-gis
-SELECT AsText(ST_UNION(GEOMETRYFROMTEXT('POINT(8 1)') ,MULTILINESTRINGFROMTEXT('MULTILINESTRING((3 5, 2 5, 2 4, 3 4, 3 5))')));
-
-#bug 839318 Crash in Gcalc_scan_iterator::point::get_shape with ST_DISTANCE and MULTILINESTRING in maria-5.3-gis
-SELECT ST_DISTANCE(POINTFROMTEXT('POINT(7 1)'),MULTILINESTRINGFROMTEXT('MULTILINESTRING(
- (4 7,9 7,6 1,3 4,1 1), (3 5, 2 5, 2 4, 3 4, 3 5))'));
-
-#bug 839327 Crash in Gcalc_operation_reducer::end_couple with ST_UNION and MULTIPOLYGONs in 5.3-gis
-SELECT AsText(ST_UNION(POLYGONFROMTEXT('POLYGON((12 9, 3 6, 3 0, 12 9))'), POLYGONFROMTEXT('POLYGON((2 2, 7 2, 4 2, 2 0, 2 2))')));
-
-#bug 841622 Assertion `t->rp->type == Gcalc_function::shape_line' failed in Gcalc_operation_reducer::end_line in maria-5.3-gis
-
---replace_result 276 278
-SELECT ST_NUMPOINTS(ST_EXTERIORRING(ST_BUFFER(ST_UNION(
- MULTILINESTRINGFROMTEXT('MULTILINESTRING((3 4, 2 5, 7 6, 1 8),(0 0 ,1 6 ,0 1, 8 9, 2 4, 6 1, 3 5, 4 8), (9 3, 5 4, 1 8, 4 2, 5 8, 3 0))' ) ,
- MULTILINESTRINGFROMTEXT('MULTILINESTRING((3 4, 3 1, 2 7, 4 2, 6 2, 1 5))')
- ), 16)));
-
-#bug 841625 Assertion `m_poly_borders->next' failed in Gcalc_operation_reducer::count_slice in maria-5.3-gis
-
-SELECT ST_NUMGEOMETRIES(ST_DIFFERENCE (
- ST_UNION (
- MULTILINESTRINGFROMTEXT( ' MULTILINESTRING( ( 2 4 , 5 0 , 2 9 , 6 2 , 0 2 ) , ( 4 3 , 5 6 , 9 4 , 0 7 , 7 2 , 2 0 , 8 2 ) , ( 5 0 , 1 5 , 3 7 , 7 7 ) , ( 2 3 , 9 5 , 2 0 , 8 1 ) , ( 0 9 , 9 3 , 2 8 , 8 1 , 9 4 ) ) ' ),
- ST_UNION (
- MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( ( 2 2 , 7 2 , 6 2 , 2 6 , 2 2 ) ) , ( (3 5, 2 5, 2 4, 3 4, 3 5) ) ) ' ) ,
- ENVELOPE(
- MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( (3 5, 2 5, 2 4, 3 4, 3 5) ) ) ' )
- )
- )
- ),
- MULTILINESTRINGFROMTEXT( ' MULTILINESTRING( ( 2 9 , 1 3 , 7 3 , 8 5 ) , ( 5 0 , 8 1 , 2 0 , 7 4 , 1 0 ) , ( 9 2 , 5 2 , 6 5 , 8 8 , 0 2 ) , ( 0 8 , 3 9 , 4 0 , 1 0 ) , ( 0 0 , 7 6 , 8 3 , 0 0 ) ) ' )
-));
-
-
-#bug 841745 ssertion `!sp0->is_bottom()' failed in Gcalc_scan_iterator::find_intersections in maria-5.3-gis
-SELECT ASTEXT(ST_DIFFERENCE (
- POLYGONFROMTEXT( ' POLYGON( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) ' ) ,
- ST_UNION (
- MULTILINESTRINGFROMTEXT( ' MULTILINESTRING( (3 5, 2 5, 2 4, 3 4, 3 5) ) ' ) ,
- ST_SYMDIFFERENCE (
- MULTILINESTRINGFROMTEXT( ' MULTILINESTRING( ( 3 8 , 0 8 , 6 6 , 6 1 , 0 5 , 6 7 , 3 7 ) , ( 5 8 , 7 7 , 9 0 , 8 7 ) , ( 1 5 , 1 8 , 2 3 , 3 9 ) , ( 1 3 , 9 7 , 5 5 , 0 8 , 6 9 ) , ( 3 6 , 6 9 , 8 7 , 0 2 , 4 6 , 9 5 ) ) ' ) ,
- ST_UNION (
- MULTILINESTRINGFROMTEXT( ' MULTILINESTRING( ( 9 4 , 2 0 , 2 2 , 7 2 , 6 2 ) , ( 5 2 , 8 2 , 4 8 , 3 4 ) , ( 1 0 , 1 4 , 2 7 , 7 0 , 1 5 ) , ( 2 8 , 4 4 , 5 0 , 7 0 , 4 0 ) ) ' ) ,
- GEOMETRYFROMTEXT( ' MULTILINESTRING( ( 3 7 , 7 3 , 5 8 , 4 8 ) , ( 3 2 , 5 0 , 9 3 , 4 4 ) , ( 6 0 , 4 2 , 7 8 , 1 3 ) ) ' )
- )
- )
- )
-));
-
-#bug 841773 Assertion `t0->rp->type == t1->rp->type' failed in Gcalc_operation_reducer::end_couple in maria-5.3-gis
-SELECT ST_NUMGEOMETRIES(ST_UNION (
- MULTILINESTRINGFROMTEXT( ' MULTILINESTRING( ( 0 8 , 1 9 , 5 7 , 2 8 , 5 8 , 6 7 ) , ( 4 5 , 8 4 , 0 3 , 5 1 ) , ( 6 8 , 2 7 , 1 6 , 9 9 , 7 2 ) , ( 9 5 , 2 8 , 1 2 , 9 6 , 2 0 ) ) ' ) ,
- MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( ( 7 7 , 2 7, 6 8, 7 1 , 7 7 ) ) ) ' )
-));
-
-#bug 841662 Third assertion `n > 0 && n < SINUSES_CALCULATED*2+1' in get_n_sincos
-SELECT ST_BUFFER (
- LINESTRINGFROMTEXT( ' LINESTRING( 5 4 , 3 8 , 2 6 , 5 5 , 7 9 ) ' ) ,
- ST_DISTANCE (
- MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( (3 5, 2 4, 2 5, 3 5) ) , ( (3 5, 2 5, 2 4, 3 4, 3 5) ) , ( ( 0 0 , 8 3 , 9 5 , 0 0 ) ) ) ' ) ,
- ST_DIFFERENCE (
- MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( (3 5, 2 5, 2 4, 3 4, 3 5) ) ) ' ) ,
- MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) , ( ( 0 0 , 3 8 , 9 4 , 0 0 ) ) ) ' )
- )
- )
- ) ;
-SELECT ST_DISTANCE ( ST_DIFFERENCE ( MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( (3 5, 2 5, 2 4, 3 4, 3 5) ) ) ' ) , MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) , ( ( 0 0 , 3 8 , 9 4 , 0 0 ) ) ) ' ) ), MULTIPOLYGONFROMTEXT( ' MULTIPOLYGON( ( (3 5, 2 4, 2 5, 3 5) ) , ( (3 5, 2 5, 2 4, 3 4, 3 5) ) , ( ( 0 0 , 8 3 , 9 5 , 0 0 ) ) ) ' ) ) ;
-
-#bug 848939 Wrong result with ST_INTERSECTION between linestrings and a polygon in 5.3-gis
-SELECT ASTEXT(ST_INTERSECTION( GEOMETRYFROMTEXT('GEOMETRYCOLLECTION(LINESTRING(7 7,5.33333333333333 7),LINESTRING(5.33333333333333 7,0 7,5 8,5.33333333333333 7),LINESTRING(5.33333333333333 7,7 2,7 7),POLYGON((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5)))'), geomETRYFROMTEXT(' MULTILINESTRING( ( 5 1 , 3 7 , 6 1 , 7 0 ) , ( 1 6 , 8 5 , 7 5 , 5 6 ) )') ));
-
-#bug 855485 ST_CROSSES returns different result than PostGIS for overlapping polygons
-
-SELECT ST_CROSSES( GEOMETRYFROMTEXT(' POLYGON( (3 5, 2 4, 2 5, 3 5) ) ') , POLYGONFROMTEXT(' POLYGON((2 4,3 4,3 5,2 5,2 4)) '));
-
-#bug 855487 ST_WITHIN returns wrong result for partially overlapping polygons
-
-SELECT ST_WITHIN( POLYGONFROMTEXT(' POLYGON( (0 5, 3 5, 3 4, 2 0 , 1 0, 2 4 , 0 4, 0 5) ) ') , POLYGONFROMTEXT(' POLYGON( (0 5, 3 5, 3 4, 1 4 , 1 3 , 3 3 , 3 0 , 0 0 , 0 5), ( 1 1 , 2 1 , 2 2 , 1 2 , 1 1 ) ) ') );
-
-#bug 855492 ST_WITHIN returns TRUE on point on the edge of a polygon
-
-SELECT ST_WITHIN( POINTFROMTEXT(' POINT(1 2 ) ') , MULTIPOLYGONFROMTEXT(' MULTIPOLYGON( ( (0 5, 3 5, 3 0, 0 0, 0 5), ( 1 1 , 2 1 , 2 4, 1 4, 1 1 ) ) ) '));
-
-#bug 855497 ST_ENVELOPE of GEOMETRYCOLLECTION EMPTY returns NULL and not GEOMETRYCOLLECTION EMPTY
-
-select ST_ASTEXT(envelope(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION EMPTY')));
-
-#bug 855503 ST_EQUALS reports TRUE between a POLYGON and a MULTILINESTRING
-
-SELECT ST_EQUALS( GEOMETRYFROMTEXT(' MULTILINESTRING( (3 5, 2 5, 2 4, 3 4, 3 5) ) ') , GEOMETRYFROMTEXT(' POLYGON( (3 5, 2 5, 2 4, 3 4, 3 5) ) ') );
-
-#bug 855505 ST_TOUCHES reports TRUE for intersecting polygon and linestring
-
-SELECT ST_TOUCHES( GEOMETRYFROMTEXT(' LINESTRING( 1 1 , 1 4 , 5 0 , 8 3 ) ') , POLYGONFROMTEXT(' POLYGON( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) ') );
-
-#bug 857051 ST_EQUALS returns TRUE on two nonidentical MULTIPOINTs
-
-SELECT ST_EQUALS( MULTIPOINTFROMTEXT(' MULTIPOINT( 5 1 , 6 9 , 1 4 , 4 0 ) ') , MULTIPOINTFROMTEXT(' MULTIPOINT( 5 8 , 5 2 , 1 8 , 3 0 , 3 0 , 7 8 ) ') );
-SELECT ST_EQUALS( MULTIPOINTFROMTEXT(' MULTIPOINT( 5 1 , 6 9 , 1 4 , 4 0 ) ') , MULTIPOINTFROMTEXT('MULTIPOINT( 4 0 , 6 9 , 5 1, 1 4 )') );
-
-#bug 857050 ST_WITHIN returns wrong result with MULTIPOINT and POLYGON
-SELECT ST_WITHIN( MULTIPOINTFROMTEXT(' MULTIPOINT( 2 9 , 2 9 , 4 9 , 9 1 ) ') , POLYGONFROMTEXT(' POLYGON( ( 2 2 , 2 8 , 8 8 , 8 2 , 2 2 ) , ( 4 4 , 4 6 , 6 6 , 6 4 , 4 4 ) ) '));
-
-#bug 857087 Wrong result with ST_INTERSECTS and LINESTRINGs
-
-SELECT ST_INTERSECTS( GeomFromText('MULTILINESTRING( ( 4030 3045 , 3149 2461 , 3004 3831 , 3775 2976 ) )') , GeomFromText('LINESTRING(3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29,3039.07 3175.05,3039.07 3175.05,3058.41 3187.91,3081.52 3153.19,3042.99 3127.57,3019.89 3162.29)') );
-
-#bug 977201 ST_BUFFER fails with the negative D. TODO - check the result deeper.
-# select ASTEXT(ST_BUFFER(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'), -3));
-
-#bug 986977 Assertion `!cur_p->event' failed in Gcalc_scan_iterator::arrange_event(int, int)
-SELECT ST_NUMPOINTS(ST_EXTERIORRING(ST_BUFFER( POLYGONFROMTEXT( 'POLYGON( ( 0.0 -3.0,
- -2.910427500435995 0.727606875108998,
- -0.910427500435995 8.727606875108998,
- 7.664100588675687 1.503849116986468,
- 1.664100588675687 -2.496150883013531,
- 0.0 -3.0
-))' ), 3 )));
-
-# MDEV-5615 crash in Gcalc_function::add_operation
-select astext(buffer(st_linestringfromwkb(linestring(point(-1,1), point(-1,-2))),-1));
-
-# MDEV-7925 Inconsistent behavior of ST_Touches with a POINT as one of arguments
-select ST_Touches(ST_LineFromText('LINESTRING(0 0,5 5)'),ST_PointFromText('POINT(0 0)'));
-select ST_Touches(ST_PolygonFromText('POLYGON((0 0,0 5,5 5,5 0,0 0))'),ST_PointFromText('POINT(0 0)'));
-select ST_Touches(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'));
-
-# MDEV-12705 10.1.18-MariaDB-1~jessie - mysqld got signal 11.
-SELECT ST_RELATE(
- ST_DIFFERENCE(
- GEOMETRYFROMTEXT('
- MULTILINESTRING(
- ( 12841 36140, 8005 31007, 26555 31075, 52765 41191,
- 28978 6548, 45720 32057, 53345 3221 ),
- ( 8304 59107, 25233 31592, 40502 25303, 8205 42940 ),
- ( 7829 7305, 58841 56759, 64115 8512, 37562 54145, 2210 14701 ),
- ( 20379 2805, 40807 27770, 28147 14883, 26439 29383, 55663 5086 ),
- ( 35944 64702, 14433 23728, 49317 26241, 790 16941 )
- )
- '),
- GEOMETRYFROMTEXT('POINT(46061 13545)')
- ),
- GEOMETRYFROMTEXT('POINT(4599 60359)'),
- 'F*FFFF**F'
- ) as relate_res;
-
---source include/gis_debug.inc
-
diff --git a/mysql-test/t/gis-rt-precise.test b/mysql-test/t/gis-rt-precise.test
deleted file mode 100644
index 9c26aa05598..00000000000
--- a/mysql-test/t/gis-rt-precise.test
+++ /dev/null
@@ -1,86 +0,0 @@
--- source include/have_geometry.inc
-
-#
-# test of rtree (using with spatial data)
-#
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (
- fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
- g GEOMETRY NOT NULL,
- SPATIAL KEY(g)
-) ENGINE=MyISAM;
-
-SHOW CREATE TABLE t1;
-
---disable_query_log
-let $1=150;
-let $2=150;
-while ($1)
-{
- eval INSERT INTO t1 (g) VALUES (GeomFromText('LineString($1 $1, $2 $2)'));
- dec $1;
- inc $2;
-}
---enable_query_log
-
-SELECT count(*) FROM t1;
-EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 140))'));
-SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
-
-DROP TABLE t1;
-
-CREATE TABLE t1 (
- fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
- g GEOMETRY NOT NULL
-) ENGINE=MyISAM;
-
---disable_query_log
-let $1=10;
-while ($1)
-{
- let $2=10;
- while ($2)
- {
- eval INSERT INTO t1 (g) VALUES (LineString(Point($1 * 10 - 9, $2 * 10 - 9), Point($1 * 10, $2 * 10)));
- dec $2;
- }
- dec $1;
-}
---enable_query_log
-
-ALTER TABLE t1 ADD SPATIAL KEY(g);
-SHOW CREATE TABLE t1;
-SELECT count(*) FROM t1;
-EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g,
- GeomFromText('Polygon((40 40,60 40,60 60,40 40))'));
-SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g,
- GeomFromText('Polygon((40 40,60 40,60 60,40 40))'));
-
-DROP TABLE t1;
-
---echo End of 5.5 tests.
-
-#
-# MDEV-12078 Using spatial index changes type from point to geometry.
-#
-CREATE TABLE t1 (
- coordinate point NOT NULL,
- SPATIAL KEY coordinate (coordinate)
-) ENGINE=Aria DEFAULT CHARSET=ascii PAGE_CHECKSUM=1;
-
-SHOW COLUMNS FROM t1;
-
-INSERT INTO t1 (coordinate) VALUES(ST_PointFromText("POINT(0 0)"));
-INSERT INTO t1 (coordinate) VALUES(ST_PointFromText("POINT(10 0)"));
-INSERT INTO t1 (coordinate) VALUES(ST_PointFromText("POINT(10 10)"));
-INSERT INTO t1 (coordinate) VALUES(ST_PointFromText("POINT(0 10)"));
-INSERT INTO t1 (coordinate) VALUES(ST_PointFromText("POINT(5 5)"));
-
-SELECT astext(coordinate) FROM t1 WHERE ST_Intersects(ST_LineFromText("LINESTRING(0 0, 10 0, 10 10, 0 10)"), coordinate);
-
-SHOW COLUMNS FROM t1;
-
-DROP TABLE t1;
diff --git a/mysql-test/t/gis-rtree.test b/mysql-test/t/gis-rtree.test
deleted file mode 100644
index 41388090427..00000000000
--- a/mysql-test/t/gis-rtree.test
+++ /dev/null
@@ -1,1012 +0,0 @@
--- source include/have_geometry.inc
-
-#
-# test of rtree (using with spatial data)
-#
-
-CREATE TABLE t1 (
- fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
- g GEOMETRY NOT NULL,
- SPATIAL KEY(g)
-);
-
-SHOW CREATE TABLE t1;
-
-let $1=150;
-let $2=150;
-while ($1)
-{
- eval INSERT INTO t1 (g) VALUES (GeomFromText('LineString($1 $1, $2 $2)'));
- dec $1;
- inc $2;
-}
-
-SELECT count(*) FROM t1;
-EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
-SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
-
-DROP TABLE t1;
-
-CREATE TABLE t2 (
- fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
- g GEOMETRY NOT NULL
-);
-
-let $1=10;
-while ($1)
-{
- let $2=10;
- while ($2)
- {
- eval INSERT INTO t2 (g) VALUES (LineString(Point($1 * 10 - 9, $2 * 10 - 9), Point($1 * 10, $2 * 10)));
- dec $2;
- }
- dec $1;
-}
-
-ALTER TABLE t2 ADD SPATIAL KEY(g);
-SHOW CREATE TABLE t2;
-SELECT count(*) FROM t2;
-EXPLAIN SELECT fid, AsText(g) FROM t2 WHERE Within(g,
- GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
-SELECT fid, AsText(g) FROM t2 WHERE Within(g,
- GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
-
-let $1=10;
-while ($1)
-{
- let $2=10;
- while ($2)
- {
- eval DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(Point($1 * 10 - 9, $2 * 10 - 9), 0)));
- SELECT count(*) FROM t2;
- dec $2;
- }
- dec $1;
-}
-
-DROP TABLE t2;
-
-CREATE TABLE t1 (a geometry NOT NULL, SPATIAL (a));
-INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
-INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
-INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
-INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
-INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
-INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
-INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
-INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
-INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
-INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
-INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
-INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
-INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
-INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
-INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
-INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
-INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
-INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
-INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
-INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
-INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
-INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
-INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
-INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
-INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
-INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
-INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
-INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
-INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)"));
-check table t1;
-analyze table t1;
-drop table t1;
-
-#
-# The following crashed gis
-#
-
-CREATE TABLE t1 (
- fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
- g GEOMETRY NOT NULL,
- SPATIAL KEY(g)
-);
-
-INSERT INTO t1 (g) VALUES (GeomFromText('LineString(1 2, 2 3)')),(GeomFromText('LineString(1 2, 2 4)'));
-#select * from t1 where g<GeomFromText('LineString(1 2, 2 3)');
-drop table t1;
-
-CREATE TABLE t1 (
- line GEOMETRY NOT NULL,
- kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po',
- name VARCHAR(32),
-
- SPATIAL KEY (line)
-);
-
-ALTER TABLE t1 DISABLE KEYS;
-INSERT INTO t1 (name, kind, line) VALUES
- ("Aadaouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
- ("Aadassiye", "pp", GeomFromText("POINT(35.816667 36.216667)")),
- ("Aadbel", "pp", GeomFromText("POINT(34.533333 36.100000)")),
- ("Aadchit", "pp", GeomFromText("POINT(33.347222 35.423611)")),
- ("Aadchite", "pp", GeomFromText("POINT(33.347222 35.423611)")),
- ("Aadchit el Qoussair", "pp", GeomFromText("POINT(33.283333 35.483333)")),
- ("Aaddaye", "pp", GeomFromText("POINT(36.716667 40.833333)")),
- ("'Aadeissa", "pp", GeomFromText("POINT(32.823889 35.698889)")),
- ("Aaderup", "pp", GeomFromText("POINT(55.216667 11.766667)")),
- ("Qalaat Aades", "pp", GeomFromText("POINT(33.503333 35.377500)")),
- ("A ad'ino", "pp", GeomFromText("POINT(54.812222 38.209167)")),
- ("Aadi Noia", "pp", GeomFromText("POINT(13.800000 39.833333)")),
- ("Aad La Macta", "pp", GeomFromText("POINT(35.779444 -0.129167)")),
- ("Aadland", "pp", GeomFromText("POINT(60.366667 5.483333)")),
- ("Aadliye", "pp", GeomFromText("POINT(33.366667 36.333333)")),
- ("Aadloun", "pp", GeomFromText("POINT(33.403889 35.273889)")),
- ("Aadma", "pp", GeomFromText("POINT(58.798333 22.663889)")),
- ("Aadma Asundus", "pp", GeomFromText("POINT(58.798333 22.663889)")),
- ("Aadmoun", "pp", GeomFromText("POINT(34.150000 35.650000)")),
- ("Aadneram", "pp", GeomFromText("POINT(59.016667 6.933333)")),
- ("Aadneskaar", "pp", GeomFromText("POINT(58.083333 6.983333)")),
- ("Aadorf", "pp", GeomFromText("POINT(47.483333 8.900000)")),
- ("Aadorp", "pp", GeomFromText("POINT(52.366667 6.633333)")),
- ("Aadouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
- ("Aadoui", "pp", GeomFromText("POINT(34.450000 35.983333)")),
- ("Aadouiye", "pp", GeomFromText("POINT(34.583333 36.183333)")),
- ("Aadouss", "pp", GeomFromText("POINT(33.512500 35.601389)")),
- ("Aadra", "pp", GeomFromText("POINT(33.616667 36.500000)")),
- ("Aadzi", "pp", GeomFromText("POINT(38.100000 64.850000)"));
-
-ALTER TABLE t1 ENABLE KEYS;
-INSERT INTO t1 (name, kind, line) VALUES ("austria", "pp", GeomFromText('LINESTRING(14.9906 48.9887,14.9946 48.9904,14.9947 48.9916)'));
-drop table t1;
-
-CREATE TABLE t1 (st varchar(100));
-INSERT INTO t1 VALUES ("Fake string");
-CREATE TABLE t2 (geom GEOMETRY NOT NULL, SPATIAL KEY gk(geom));
---error 1416
-INSERT IGNORE INTO t2 SELECT GeomFromText(st) FROM t1;
-drop table t1, t2;
-
-CREATE TABLE t1 (`geometry` geometry NOT NULL default '',SPATIAL KEY `gndx` (`geometry`)) DEFAULT CHARSET=latin1;
-
-INSERT INTO t1 (geometry) VALUES
-(PolygonFromText('POLYGON((-18.6086111000 -66.9327777000, -18.6055555000
--66.8158332999, -18.7186111000 -66.8102777000, -18.7211111000 -66.9269443999,
--18.6086111000 -66.9327777000))'));
-
-INSERT INTO t1 (geometry) VALUES
-(PolygonFromText('POLYGON((-65.7402776999 -96.6686111000, -65.7372222000
--96.5516666000, -65.8502777000 -96.5461111000, -65.8527777000 -96.6627777000,
--65.7402776999 -96.6686111000))'));
-check table t1 extended;
-
-drop table t1;
-
-#
-# Bug#17877 - Corrupted spatial index
-#
-CREATE TABLE t1 (
- c1 geometry NOT NULL default '',
- SPATIAL KEY i1 (c1)
-) DEFAULT CHARSET=latin1;
-INSERT INTO t1 (c1) VALUES (
- PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
- -18.6055555000 -66.8158332999,
- -18.7186111000 -66.8102777000,
- -18.7211111000 -66.9269443999,
- -18.6086111000 -66.9327777000))'));
-# This showed a missing key.
-CHECK TABLE t1 EXTENDED;
-DROP TABLE t1;
-#
-CREATE TABLE t1 (
- c1 geometry NOT NULL default '',
- SPATIAL KEY i1 (c1)
-) DEFAULT CHARSET=latin1;
-INSERT INTO t1 (c1) VALUES (
- PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
- -18.6055555000 -66.8158332999,
- -18.7186111000 -66.8102777000,
- -18.7211111000 -66.9269443999,
- -18.6086111000 -66.9327777000))'));
-INSERT INTO t1 (c1) VALUES (
- PolygonFromText('POLYGON((-65.7402776999 -96.6686111000,
- -65.7372222000 -96.5516666000,
- -65.8502777000 -96.5461111000,
- -65.8527777000 -96.6627777000,
- -65.7402776999 -96.6686111000))'));
-# This is the same as the first insert to get a non-unique key.
-INSERT INTO t1 (c1) VALUES (
- PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
- -18.6055555000 -66.8158332999,
- -18.7186111000 -66.8102777000,
- -18.7211111000 -66.9269443999,
- -18.6086111000 -66.9327777000))'));
-# This showed (and still shows) OK.
-CHECK TABLE t1 EXTENDED;
-DROP TABLE t1;
-
-#
-# Bug #21888: Query on GEOMETRY field using PointFromWKB() results in lost connection
-#
-CREATE TABLE t1 (foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) );
-INSERT INTO t1 (foo) VALUES (POINT(1,1));
-INSERT INTO t1 (foo) VALUES (POINT(1,0));
-INSERT INTO t1 (foo) VALUES (POINT(0,1));
-INSERT INTO t1 (foo) VALUES (POINT(0,0));
-SELECT 1 FROM t1 WHERE foo != POINT(0,0);
-DROP TABLE t1;
-
-#
-# Bug#25673 - spatial index corruption, error 126 incorrect key file for table
-#
-CREATE TABLE t1 (id bigint(12) unsigned NOT NULL auto_increment,
- c2 varchar(15) collate utf8_bin default NULL,
- c1 varchar(15) collate utf8_bin default NULL,
- c3 varchar(10) collate utf8_bin default NULL,
- spatial_point point NOT NULL,
- PRIMARY KEY(id),
- SPATIAL KEY (spatial_point)
- ) DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-#
-INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
- ('y', 's', 'j', GeomFromText('POINT(167 74)')),
- ('r', 'n', 'd', GeomFromText('POINT(215 118)')),
- ('g', 'n', 'e', GeomFromText('POINT(203 98)')),
- ('h', 'd', 'd', GeomFromText('POINT(54 193)')),
- ('r', 'x', 'y', GeomFromText('POINT(47 69)')),
- ('t', 'q', 'r', GeomFromText('POINT(109 42)')),
- ('a', 'z', 'd', GeomFromText('POINT(0 154)')),
- ('x', 'v', 'o', GeomFromText('POINT(174 131)')),
- ('b', 'r', 'a', GeomFromText('POINT(114 253)')),
- ('x', 'z', 'i', GeomFromText('POINT(163 21)')),
- ('w', 'p', 'i', GeomFromText('POINT(42 102)')),
- ('g', 'j', 'j', GeomFromText('POINT(170 133)')),
- ('m', 'g', 'n', GeomFromText('POINT(28 22)')),
- ('b', 'z', 'h', GeomFromText('POINT(174 28)')),
- ('q', 'k', 'f', GeomFromText('POINT(233 73)')),
- ('w', 'w', 'a', GeomFromText('POINT(124 200)')),
- ('t', 'j', 'w', GeomFromText('POINT(252 101)')),
- ('d', 'r', 'd', GeomFromText('POINT(98 18)')),
- ('w', 'o', 'y', GeomFromText('POINT(165 31)')),
- ('y', 'h', 't', GeomFromText('POINT(14 220)')),
- ('d', 'p', 'u', GeomFromText('POINT(223 196)')),
- ('g', 'y', 'g', GeomFromText('POINT(207 96)')),
- ('x', 'm', 'n', GeomFromText('POINT(214 3)')),
- ('g', 'v', 'e', GeomFromText('POINT(140 205)')),
- ('g', 'm', 'm', GeomFromText('POINT(10 236)')),
- ('i', 'r', 'j', GeomFromText('POINT(137 228)')),
- ('w', 's', 'p', GeomFromText('POINT(115 6)')),
- ('o', 'n', 'k', GeomFromText('POINT(158 129)')),
- ('j', 'h', 'l', GeomFromText('POINT(129 72)')),
- ('f', 'x', 'l', GeomFromText('POINT(139 207)')),
- ('u', 'd', 'n', GeomFromText('POINT(125 109)')),
- ('b', 'a', 'z', GeomFromText('POINT(30 32)')),
- ('m', 'h', 'o', GeomFromText('POINT(251 251)')),
- ('f', 'r', 'd', GeomFromText('POINT(243 211)')),
- ('b', 'd', 'r', GeomFromText('POINT(232 80)')),
- ('g', 'k', 'v', GeomFromText('POINT(15 100)')),
- ('i', 'f', 'c', GeomFromText('POINT(109 66)')),
- ('r', 't', 'j', GeomFromText('POINT(178 6)')),
- ('y', 'n', 'f', GeomFromText('POINT(233 211)')),
- ('f', 'y', 'm', GeomFromText('POINT(99 16)')),
- ('z', 'q', 'l', GeomFromText('POINT(39 49)')),
- ('j', 'c', 'r', GeomFromText('POINT(75 187)')),
- ('c', 'y', 'y', GeomFromText('POINT(246 253)')),
- ('w', 'u', 'd', GeomFromText('POINT(56 190)')),
- ('n', 'q', 'm', GeomFromText('POINT(73 149)')),
- ('d', 'y', 'a', GeomFromText('POINT(134 6)')),
- ('z', 's', 'w', GeomFromText('POINT(216 225)')),
- ('d', 'u', 'k', GeomFromText('POINT(132 70)')),
- ('f', 'v', 't', GeomFromText('POINT(187 141)')),
- ('r', 'r', 'a', GeomFromText('POINT(152 39)')),
- ('y', 'p', 'o', GeomFromText('POINT(45 27)')),
- ('p', 'n', 'm', GeomFromText('POINT(228 148)')),
- ('e', 'g', 'e', GeomFromText('POINT(88 81)')),
- ('m', 'a', 'h', GeomFromText('POINT(35 29)')),
- ('m', 'h', 'f', GeomFromText('POINT(30 71)')),
- ('h', 'k', 'i', GeomFromText('POINT(244 78)')),
- ('z', 'v', 'd', GeomFromText('POINT(241 38)')),
- ('q', 'l', 'j', GeomFromText('POINT(13 71)')),
- ('s', 'p', 'g', GeomFromText('POINT(108 38)')),
- ('q', 's', 'j', GeomFromText('POINT(92 101)')),
- ('l', 'h', 'g', GeomFromText('POINT(120 78)')),
- ('w', 't', 'b', GeomFromText('POINT(193 109)')),
- ('b', 's', 's', GeomFromText('POINT(223 211)')),
- ('w', 'w', 'y', GeomFromText('POINT(122 42)')),
- ('q', 'c', 'c', GeomFromText('POINT(104 102)')),
- ('w', 'g', 'n', GeomFromText('POINT(213 120)')),
- ('p', 'q', 'a', GeomFromText('POINT(247 148)')),
- ('c', 'z', 'e', GeomFromText('POINT(18 106)')),
- ('z', 'u', 'n', GeomFromText('POINT(70 133)')),
- ('j', 'n', 'x', GeomFromText('POINT(232 13)')),
- ('e', 'h', 'f', GeomFromText('POINT(22 135)')),
- ('w', 'l', 'f', GeomFromText('POINT(9 180)')),
- ('a', 'v', 'q', GeomFromText('POINT(163 228)')),
- ('i', 'z', 'o', GeomFromText('POINT(180 100)')),
- ('e', 'c', 'l', GeomFromText('POINT(182 231)')),
- ('c', 'k', 'o', GeomFromText('POINT(19 60)')),
- ('q', 'f', 'p', GeomFromText('POINT(79 95)')),
- ('m', 'd', 'r', GeomFromText('POINT(3 127)')),
- ('m', 'e', 't', GeomFromText('POINT(136 154)')),
- ('w', 'w', 'w', GeomFromText('POINT(102 15)')),
- ('l', 'n', 'q', GeomFromText('POINT(71 196)')),
- ('p', 'k', 'c', GeomFromText('POINT(47 139)')),
- ('j', 'o', 'r', GeomFromText('POINT(177 128)')),
- ('j', 'q', 'a', GeomFromText('POINT(170 6)')),
- ('b', 'a', 'o', GeomFromText('POINT(63 211)')),
- ('g', 's', 'o', GeomFromText('POINT(144 251)')),
- ('w', 'u', 'w', GeomFromText('POINT(221 214)')),
- ('g', 'a', 'm', GeomFromText('POINT(14 102)')),
- ('u', 'q', 'z', GeomFromText('POINT(86 200)')),
- ('k', 'a', 'm', GeomFromText('POINT(144 222)')),
- ('j', 'u', 'r', GeomFromText('POINT(216 142)')),
- ('q', 'k', 'v', GeomFromText('POINT(121 236)')),
- ('p', 'o', 'r', GeomFromText('POINT(108 102)')),
- ('b', 'd', 'x', GeomFromText('POINT(127 198)')),
- ('k', 's', 'a', GeomFromText('POINT(2 150)')),
- ('f', 'm', 'f', GeomFromText('POINT(160 191)')),
- ('q', 'y', 'x', GeomFromText('POINT(98 111)')),
- ('o', 'f', 'm', GeomFromText('POINT(232 218)')),
- ('c', 'w', 'j', GeomFromText('POINT(156 165)')),
- ('s', 'q', 'v', GeomFromText('POINT(98 161)'));
-SET @@RAND_SEED1=692635050, @@RAND_SEED2=297339954;
-DELETE FROM t1 ORDER BY RAND() LIMIT 10;
-SET @@RAND_SEED1=159925977, @@RAND_SEED2=942570618;
-DELETE FROM t1 ORDER BY RAND() LIMIT 10;
-SET @@RAND_SEED1=328169745, @@RAND_SEED2=410451954;
-DELETE FROM t1 ORDER BY RAND() LIMIT 10;
-SET @@RAND_SEED1=178507359, @@RAND_SEED2=332493072;
-DELETE FROM t1 ORDER BY RAND() LIMIT 10;
-SET @@RAND_SEED1=1034033013, @@RAND_SEED2=558966507;
-DELETE FROM t1 ORDER BY RAND() LIMIT 10;
-UPDATE t1 set spatial_point=GeomFromText('POINT(230 9)') where c1 like 'y%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(95 35)') where c1 like 'j%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(93 99)') where c1 like 'a%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(19 81)') where c1 like 'r%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(20 177)') where c1 like 'h%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(221 193)') where c1 like 'u%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(195 205)') where c1 like 'd%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(15 213)') where c1 like 'u%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(214 63)') where c1 like 'n%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(243 171)') where c1 like 'c%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(198 82)') where c1 like 'y%';
-INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
- ('f', 'y', 'p', GeomFromText('POINT(109 235)')),
- ('b', 'e', 'v', GeomFromText('POINT(20 48)')),
- ('i', 'u', 'f', GeomFromText('POINT(15 55)')),
- ('o', 'r', 'z', GeomFromText('POINT(105 64)')),
- ('a', 'p', 'a', GeomFromText('POINT(142 236)')),
- ('g', 'i', 'k', GeomFromText('POINT(10 49)')),
- ('x', 'z', 'x', GeomFromText('POINT(192 200)')),
- ('c', 'v', 'r', GeomFromText('POINT(94 168)')),
- ('y', 'z', 'e', GeomFromText('POINT(141 51)')),
- ('h', 'm', 'd', GeomFromText('POINT(35 251)')),
- ('v', 'm', 'q', GeomFromText('POINT(44 90)')),
- ('j', 'l', 'z', GeomFromText('POINT(67 237)')),
- ('i', 'v', 'a', GeomFromText('POINT(75 14)')),
- ('b', 'q', 't', GeomFromText('POINT(153 33)')),
- ('e', 'm', 'a', GeomFromText('POINT(247 49)')),
- ('l', 'y', 'g', GeomFromText('POINT(56 203)')),
- ('v', 'o', 'r', GeomFromText('POINT(90 54)')),
- ('r', 'n', 'd', GeomFromText('POINT(135 83)')),
- ('j', 't', 'u', GeomFromText('POINT(174 239)')),
- ('u', 'n', 'g', GeomFromText('POINT(104 191)')),
- ('p', 'q', 'y', GeomFromText('POINT(63 171)')),
- ('o', 'q', 'p', GeomFromText('POINT(192 103)')),
- ('f', 'x', 'e', GeomFromText('POINT(244 30)')),
- ('n', 'x', 'c', GeomFromText('POINT(92 103)')),
- ('r', 'q', 'z', GeomFromText('POINT(166 20)')),
- ('s', 'a', 'j', GeomFromText('POINT(137 205)')),
- ('z', 't', 't', GeomFromText('POINT(99 134)')),
- ('o', 'm', 'j', GeomFromText('POINT(217 3)')),
- ('n', 'h', 'j', GeomFromText('POINT(211 17)')),
- ('v', 'v', 'a', GeomFromText('POINT(41 137)')),
- ('q', 'o', 'j', GeomFromText('POINT(5 92)')),
- ('z', 'y', 'e', GeomFromText('POINT(175 212)')),
- ('j', 'z', 'h', GeomFromText('POINT(224 194)')),
- ('a', 'g', 'm', GeomFromText('POINT(31 119)')),
- ('p', 'c', 'f', GeomFromText('POINT(17 221)')),
- ('t', 'h', 'k', GeomFromText('POINT(26 203)')),
- ('u', 'w', 'p', GeomFromText('POINT(47 185)')),
- ('z', 'a', 'c', GeomFromText('POINT(61 133)')),
- ('u', 'k', 'a', GeomFromText('POINT(210 115)')),
- ('k', 'f', 'h', GeomFromText('POINT(125 113)')),
- ('t', 'v', 'y', GeomFromText('POINT(12 239)')),
- ('u', 'v', 'd', GeomFromText('POINT(90 24)')),
- ('m', 'y', 'w', GeomFromText('POINT(25 243)')),
- ('d', 'n', 'g', GeomFromText('POINT(122 92)')),
- ('z', 'm', 'f', GeomFromText('POINT(235 110)')),
- ('q', 'd', 'f', GeomFromText('POINT(233 217)')),
- ('a', 'v', 'u', GeomFromText('POINT(69 59)')),
- ('x', 'k', 'p', GeomFromText('POINT(240 14)')),
- ('i', 'v', 'r', GeomFromText('POINT(154 42)')),
- ('w', 'h', 'l', GeomFromText('POINT(178 156)')),
- ('d', 'h', 'n', GeomFromText('POINT(65 157)')),
- ('c', 'k', 'z', GeomFromText('POINT(62 33)')),
- ('e', 'l', 'w', GeomFromText('POINT(162 1)')),
- ('r', 'f', 'i', GeomFromText('POINT(127 71)')),
- ('q', 'm', 'c', GeomFromText('POINT(63 118)')),
- ('c', 'h', 'u', GeomFromText('POINT(205 203)')),
- ('d', 't', 'p', GeomFromText('POINT(234 87)')),
- ('s', 'g', 'h', GeomFromText('POINT(149 34)')),
- ('o', 'b', 'q', GeomFromText('POINT(159 179)')),
- ('k', 'u', 'f', GeomFromText('POINT(202 254)')),
- ('u', 'f', 'g', GeomFromText('POINT(70 15)')),
- ('x', 's', 'b', GeomFromText('POINT(25 181)')),
- ('s', 'c', 'g', GeomFromText('POINT(252 17)')),
- ('a', 'c', 'f', GeomFromText('POINT(89 67)')),
- ('r', 'e', 'q', GeomFromText('POINT(55 54)')),
- ('f', 'i', 'k', GeomFromText('POINT(178 230)')),
- ('p', 'e', 'l', GeomFromText('POINT(198 28)')),
- ('w', 'o', 'd', GeomFromText('POINT(204 189)')),
- ('c', 'a', 'g', GeomFromText('POINT(230 178)')),
- ('r', 'o', 'e', GeomFromText('POINT(61 116)')),
- ('w', 'a', 'a', GeomFromText('POINT(178 237)')),
- ('v', 'd', 'e', GeomFromText('POINT(70 85)')),
- ('k', 'c', 'e', GeomFromText('POINT(147 118)')),
- ('d', 'q', 't', GeomFromText('POINT(218 77)')),
- ('k', 'g', 'f', GeomFromText('POINT(192 113)')),
- ('w', 'n', 'e', GeomFromText('POINT(92 124)')),
- ('r', 'm', 'q', GeomFromText('POINT(130 65)')),
- ('o', 'r', 'r', GeomFromText('POINT(174 233)')),
- ('k', 'n', 't', GeomFromText('POINT(175 147)')),
- ('q', 'm', 'r', GeomFromText('POINT(18 208)')),
- ('l', 'd', 'i', GeomFromText('POINT(13 104)')),
- ('w', 'o', 'y', GeomFromText('POINT(207 39)')),
- ('p', 'u', 'o', GeomFromText('POINT(114 31)')),
- ('y', 'a', 'p', GeomFromText('POINT(106 59)')),
- ('a', 'x', 'z', GeomFromText('POINT(17 57)')),
- ('v', 'h', 'x', GeomFromText('POINT(170 13)')),
- ('t', 's', 'u', GeomFromText('POINT(84 18)')),
- ('z', 'z', 'f', GeomFromText('POINT(250 197)')),
- ('l', 'z', 't', GeomFromText('POINT(59 80)')),
- ('j', 'g', 's', GeomFromText('POINT(54 26)')),
- ('g', 'v', 'm', GeomFromText('POINT(89 98)')),
- ('q', 'v', 'b', GeomFromText('POINT(39 240)')),
- ('x', 'k', 'v', GeomFromText('POINT(246 207)')),
- ('k', 'u', 'i', GeomFromText('POINT(105 111)')),
- ('w', 'z', 's', GeomFromText('POINT(235 8)')),
- ('d', 'd', 'd', GeomFromText('POINT(105 4)')),
- ('c', 'z', 'q', GeomFromText('POINT(13 140)')),
- ('m', 'k', 'i', GeomFromText('POINT(208 120)')),
- ('g', 'a', 'g', GeomFromText('POINT(9 182)')),
- ('z', 'j', 'r', GeomFromText('POINT(149 153)')),
- ('h', 'f', 'g', GeomFromText('POINT(81 236)')),
- ('m', 'e', 'q', GeomFromText('POINT(209 215)')),
- ('c', 'h', 'y', GeomFromText('POINT(235 70)')),
- ('i', 'e', 'g', GeomFromText('POINT(138 26)')),
- ('m', 't', 'u', GeomFromText('POINT(119 237)')),
- ('o', 'w', 's', GeomFromText('POINT(193 166)')),
- ('f', 'm', 'q', GeomFromText('POINT(85 96)')),
- ('x', 'l', 'x', GeomFromText('POINT(58 115)')),
- ('x', 'q', 'u', GeomFromText('POINT(108 210)')),
- ('b', 'h', 'i', GeomFromText('POINT(250 139)')),
- ('y', 'd', 'x', GeomFromText('POINT(199 135)')),
- ('w', 'h', 'p', GeomFromText('POINT(247 233)')),
- ('p', 'z', 't', GeomFromText('POINT(148 249)')),
- ('q', 'a', 'u', GeomFromText('POINT(174 78)')),
- ('v', 't', 'm', GeomFromText('POINT(70 228)')),
- ('t', 'n', 'f', GeomFromText('POINT(123 2)')),
- ('x', 't', 'b', GeomFromText('POINT(35 50)')),
- ('r', 'j', 'f', GeomFromText('POINT(200 51)')),
- ('s', 'q', 'o', GeomFromText('POINT(23 184)')),
- ('u', 'v', 'z', GeomFromText('POINT(7 113)')),
- ('v', 'u', 'l', GeomFromText('POINT(145 190)')),
- ('o', 'k', 'i', GeomFromText('POINT(161 122)')),
- ('l', 'y', 'e', GeomFromText('POINT(17 232)')),
- ('t', 'b', 'e', GeomFromText('POINT(120 50)')),
- ('e', 's', 'u', GeomFromText('POINT(254 1)')),
- ('d', 'd', 'u', GeomFromText('POINT(167 140)')),
- ('o', 'b', 'x', GeomFromText('POINT(186 237)')),
- ('m', 's', 's', GeomFromText('POINT(172 149)')),
- ('t', 'y', 'a', GeomFromText('POINT(149 85)')),
- ('x', 't', 'r', GeomFromText('POINT(10 165)')),
- ('g', 'c', 'e', GeomFromText('POINT(95 165)')),
- ('e', 'e', 'z', GeomFromText('POINT(98 65)')),
- ('f', 'v', 'i', GeomFromText('POINT(149 144)')),
- ('o', 'p', 'm', GeomFromText('POINT(233 67)')),
- ('t', 'u', 'b', GeomFromText('POINT(109 215)')),
- ('o', 'o', 'b', GeomFromText('POINT(130 48)')),
- ('e', 'm', 'h', GeomFromText('POINT(88 189)')),
- ('e', 'v', 'y', GeomFromText('POINT(55 29)')),
- ('e', 't', 'm', GeomFromText('POINT(129 55)')),
- ('p', 'p', 'i', GeomFromText('POINT(126 222)')),
- ('c', 'i', 'c', GeomFromText('POINT(19 158)')),
- ('c', 'b', 's', GeomFromText('POINT(13 19)')),
- ('u', 'y', 'a', GeomFromText('POINT(114 5)')),
- ('a', 'o', 'f', GeomFromText('POINT(227 232)')),
- ('t', 'c', 'z', GeomFromText('POINT(63 62)')),
- ('d', 'o', 'k', GeomFromText('POINT(48 228)')),
- ('x', 'c', 'e', GeomFromText('POINT(204 2)')),
- ('e', 'e', 'g', GeomFromText('POINT(125 43)')),
- ('o', 'r', 'f', GeomFromText('POINT(171 140)'));
-UPDATE t1 set spatial_point=GeomFromText('POINT(163 157)') where c1 like 'w%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(53 151)') where c1 like 'd%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(96 183)') where c1 like 'r%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(57 91)') where c1 like 'q%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(202 110)') where c1 like 'c%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(120 137)') where c1 like 'w%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(207 147)') where c1 like 'c%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(31 125)') where c1 like 'e%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(27 36)') where c1 like 'r%';
-INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
- ('b', 'c', 'e', GeomFromText('POINT(41 137)')),
- ('p', 'y', 'k', GeomFromText('POINT(50 22)')),
- ('s', 'c', 'h', GeomFromText('POINT(208 173)')),
- ('x', 'u', 'l', GeomFromText('POINT(199 175)')),
- ('s', 'r', 'h', GeomFromText('POINT(85 192)')),
- ('j', 'k', 'u', GeomFromText('POINT(18 25)')),
- ('p', 'w', 'h', GeomFromText('POINT(152 197)')),
- ('e', 'd', 'c', GeomFromText('POINT(229 3)')),
- ('o', 'x', 'k', GeomFromText('POINT(187 155)')),
- ('o', 'b', 'k', GeomFromText('POINT(208 150)')),
- ('d', 'a', 'j', GeomFromText('POINT(70 87)')),
- ('f', 'e', 'k', GeomFromText('POINT(156 96)')),
- ('u', 'y', 'p', GeomFromText('POINT(239 193)')),
- ('n', 'v', 'p', GeomFromText('POINT(223 98)')),
- ('z', 'j', 'r', GeomFromText('POINT(87 89)')),
- ('h', 'x', 'x', GeomFromText('POINT(92 0)')),
- ('r', 'v', 'r', GeomFromText('POINT(159 139)')),
- ('v', 'g', 'g', GeomFromText('POINT(16 229)')),
- ('z', 'k', 'u', GeomFromText('POINT(99 52)')),
- ('p', 'p', 'o', GeomFromText('POINT(105 125)')),
- ('w', 'h', 'y', GeomFromText('POINT(105 154)')),
- ('v', 'y', 'z', GeomFromText('POINT(134 238)')),
- ('x', 'o', 'o', GeomFromText('POINT(178 88)')),
- ('z', 'w', 'd', GeomFromText('POINT(123 60)')),
- ('q', 'f', 'u', GeomFromText('POINT(64 90)')),
- ('s', 'n', 't', GeomFromText('POINT(50 138)')),
- ('v', 'p', 't', GeomFromText('POINT(114 91)')),
- ('a', 'o', 'n', GeomFromText('POINT(78 43)')),
- ('k', 'u', 'd', GeomFromText('POINT(185 161)')),
- ('w', 'd', 'n', GeomFromText('POINT(25 92)')),
- ('k', 'w', 'a', GeomFromText('POINT(59 238)')),
- ('t', 'c', 'f', GeomFromText('POINT(65 87)')),
- ('g', 's', 'p', GeomFromText('POINT(238 126)')),
- ('d', 'n', 'y', GeomFromText('POINT(107 173)')),
- ('l', 'a', 'w', GeomFromText('POINT(125 152)')),
- ('m', 'd', 'j', GeomFromText('POINT(146 53)')),
- ('q', 'm', 'c', GeomFromText('POINT(217 187)')),
- ('i', 'r', 'r', GeomFromText('POINT(6 113)')),
- ('e', 'j', 'b', GeomFromText('POINT(37 83)')),
- ('w', 'w', 'h', GeomFromText('POINT(83 199)')),
- ('k', 'b', 's', GeomFromText('POINT(170 64)')),
- ('s', 'b', 'c', GeomFromText('POINT(163 130)')),
- ('c', 'h', 'a', GeomFromText('POINT(141 3)')),
- ('k', 'j', 'u', GeomFromText('POINT(143 76)')),
- ('r', 'h', 'o', GeomFromText('POINT(243 92)')),
- ('i', 'd', 'b', GeomFromText('POINT(205 13)')),
- ('r', 'y', 'q', GeomFromText('POINT(138 8)')),
- ('m', 'o', 'i', GeomFromText('POINT(36 45)')),
- ('v', 'g', 'm', GeomFromText('POINT(0 40)')),
- ('f', 'e', 'i', GeomFromText('POINT(76 6)')),
- ('c', 'q', 'q', GeomFromText('POINT(115 248)')),
- ('x', 'c', 'i', GeomFromText('POINT(29 74)')),
- ('l', 's', 't', GeomFromText('POINT(83 18)')),
- ('t', 't', 'a', GeomFromText('POINT(26 168)')),
- ('u', 'n', 'x', GeomFromText('POINT(200 110)')),
- ('j', 'b', 'd', GeomFromText('POINT(216 136)')),
- ('s', 'p', 'w', GeomFromText('POINT(38 156)')),
- ('f', 'b', 'v', GeomFromText('POINT(29 186)')),
- ('v', 'e', 'r', GeomFromText('POINT(149 40)')),
- ('v', 't', 'm', GeomFromText('POINT(184 24)')),
- ('y', 'g', 'a', GeomFromText('POINT(219 105)')),
- ('s', 'f', 'i', GeomFromText('POINT(114 130)')),
- ('e', 'q', 'h', GeomFromText('POINT(203 135)')),
- ('h', 'g', 'b', GeomFromText('POINT(9 208)')),
- ('o', 'l', 'r', GeomFromText('POINT(245 79)')),
- ('s', 's', 'v', GeomFromText('POINT(238 198)')),
- ('w', 'w', 'z', GeomFromText('POINT(209 232)')),
- ('v', 'd', 'n', GeomFromText('POINT(30 193)')),
- ('q', 'w', 'k', GeomFromText('POINT(133 18)')),
- ('o', 'h', 'o', GeomFromText('POINT(42 140)')),
- ('f', 'f', 'h', GeomFromText('POINT(145 1)')),
- ('u', 's', 'r', GeomFromText('POINT(70 62)')),
- ('x', 'n', 'q', GeomFromText('POINT(33 86)')),
- ('u', 'p', 'v', GeomFromText('POINT(232 220)')),
- ('z', 'e', 'a', GeomFromText('POINT(130 69)')),
- ('r', 'u', 'z', GeomFromText('POINT(243 241)')),
- ('b', 'n', 't', GeomFromText('POINT(120 12)')),
- ('u', 'f', 's', GeomFromText('POINT(190 212)')),
- ('a', 'd', 'q', GeomFromText('POINT(235 191)')),
- ('f', 'q', 'm', GeomFromText('POINT(176 2)')),
- ('n', 'c', 's', GeomFromText('POINT(218 163)')),
- ('e', 'm', 'h', GeomFromText('POINT(163 108)')),
- ('c', 'f', 'l', GeomFromText('POINT(220 115)')),
- ('c', 'v', 'q', GeomFromText('POINT(66 45)')),
- ('w', 'v', 'x', GeomFromText('POINT(251 220)')),
- ('f', 'w', 'z', GeomFromText('POINT(146 149)')),
- ('h', 'n', 'h', GeomFromText('POINT(148 128)')),
- ('y', 'k', 'v', GeomFromText('POINT(28 110)')),
- ('c', 'x', 'q', GeomFromText('POINT(13 13)')),
- ('e', 'd', 's', GeomFromText('POINT(91 190)')),
- ('c', 'w', 'c', GeomFromText('POINT(10 231)')),
- ('u', 'j', 'n', GeomFromText('POINT(250 21)')),
- ('w', 'n', 'x', GeomFromText('POINT(141 69)')),
- ('f', 'p', 'y', GeomFromText('POINT(228 246)')),
- ('d', 'q', 'f', GeomFromText('POINT(194 22)')),
- ('d', 'z', 'l', GeomFromText('POINT(233 181)')),
- ('c', 'a', 'q', GeomFromText('POINT(183 96)')),
- ('m', 'i', 'd', GeomFromText('POINT(117 226)')),
- ('z', 'y', 'y', GeomFromText('POINT(62 81)')),
- ('g', 'v', 'm', GeomFromText('POINT(66 158)'));
-SET @@RAND_SEED1=481064922, @@RAND_SEED2=438133497;
-DELETE FROM t1 ORDER BY RAND() LIMIT 10;
-SET @@RAND_SEED1=280535103, @@RAND_SEED2=444518646;
-DELETE FROM t1 ORDER BY RAND() LIMIT 10;
-SET @@RAND_SEED1=1072017234, @@RAND_SEED2=484203885;
-DELETE FROM t1 ORDER BY RAND() LIMIT 10;
-SET @@RAND_SEED1=358851897, @@RAND_SEED2=358495224;
-DELETE FROM t1 ORDER BY RAND() LIMIT 10;
-SET @@RAND_SEED1=509031459, @@RAND_SEED2=675962925;
-DELETE FROM t1 ORDER BY RAND() LIMIT 10;
-UPDATE t1 set spatial_point=GeomFromText('POINT(61 203)') where c1 like 'y%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(202 194)') where c1 like 'f%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(228 18)') where c1 like 'h%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(88 18)') where c1 like 'l%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(176 94)') where c1 like 'e%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(44 47)') where c1 like 'g%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(95 191)') where c1 like 'b%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(179 218)') where c1 like 'y%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(239 40)') where c1 like 'g%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(248 41)') where c1 like 'q%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(167 82)') where c1 like 't%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(13 104)') where c1 like 'u%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(139 84)') where c1 like 'a%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(145 108)') where c1 like 'p%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(147 57)') where c1 like 't%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(217 144)') where c1 like 'n%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(160 224)') where c1 like 'w%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(38 28)') where c1 like 'j%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(104 114)') where c1 like 'q%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(88 19)') where c1 like 'c%';
-INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
- ('f', 'x', 'p', GeomFromText('POINT(92 181)')),
- ('s', 'i', 'c', GeomFromText('POINT(49 60)')),
- ('c', 'c', 'i', GeomFromText('POINT(7 57)')),
- ('n', 'g', 'k', GeomFromText('POINT(252 105)')),
- ('g', 'b', 'm', GeomFromText('POINT(180 11)')),
- ('u', 'l', 'r', GeomFromText('POINT(32 90)')),
- ('c', 'x', 'e', GeomFromText('POINT(143 24)')),
- ('x', 'u', 'a', GeomFromText('POINT(123 92)')),
- ('s', 'b', 'h', GeomFromText('POINT(190 108)')),
- ('c', 'x', 'b', GeomFromText('POINT(104 100)')),
- ('i', 'd', 't', GeomFromText('POINT(214 104)')),
- ('r', 'w', 'g', GeomFromText('POINT(29 67)')),
- ('b', 'f', 'g', GeomFromText('POINT(149 46)')),
- ('r', 'r', 'd', GeomFromText('POINT(242 196)')),
- ('j', 'l', 'a', GeomFromText('POINT(90 196)')),
- ('e', 't', 'b', GeomFromText('POINT(190 64)')),
- ('l', 'x', 'w', GeomFromText('POINT(250 73)')),
- ('q', 'y', 'r', GeomFromText('POINT(120 182)')),
- ('s', 'j', 'a', GeomFromText('POINT(180 175)')),
- ('n', 'i', 'y', GeomFromText('POINT(124 136)')),
- ('s', 'x', 's', GeomFromText('POINT(176 209)')),
- ('u', 'f', 's', GeomFromText('POINT(215 173)')),
- ('m', 'j', 'x', GeomFromText('POINT(44 140)')),
- ('v', 'g', 'x', GeomFromText('POINT(177 233)')),
- ('u', 't', 'b', GeomFromText('POINT(136 197)')),
- ('f', 'g', 'b', GeomFromText('POINT(10 8)')),
- ('v', 'c', 'j', GeomFromText('POINT(13 81)')),
- ('d', 's', 'q', GeomFromText('POINT(200 100)')),
- ('a', 'p', 'j', GeomFromText('POINT(33 40)')),
- ('i', 'c', 'g', GeomFromText('POINT(168 204)')),
- ('k', 'h', 'i', GeomFromText('POINT(93 243)')),
- ('s', 'b', 's', GeomFromText('POINT(157 13)')),
- ('v', 'l', 'l', GeomFromText('POINT(103 6)')),
- ('r', 'b', 'k', GeomFromText('POINT(244 137)')),
- ('l', 'd', 'r', GeomFromText('POINT(162 254)')),
- ('q', 'b', 'z', GeomFromText('POINT(136 246)')),
- ('x', 'x', 'p', GeomFromText('POINT(120 37)')),
- ('m', 'e', 'z', GeomFromText('POINT(203 167)')),
- ('q', 'n', 'p', GeomFromText('POINT(94 119)')),
- ('b', 'g', 'u', GeomFromText('POINT(93 248)')),
- ('r', 'v', 'v', GeomFromText('POINT(53 88)')),
- ('y', 'a', 'i', GeomFromText('POINT(98 219)')),
- ('a', 's', 'g', GeomFromText('POINT(173 138)')),
- ('c', 'a', 't', GeomFromText('POINT(235 135)')),
- ('q', 'm', 'd', GeomFromText('POINT(224 208)')),
- ('e', 'p', 'k', GeomFromText('POINT(161 238)')),
- ('n', 'g', 'q', GeomFromText('POINT(35 204)')),
- ('t', 't', 'x', GeomFromText('POINT(230 178)')),
- ('w', 'f', 'a', GeomFromText('POINT(150 221)')),
- ('z', 'm', 'z', GeomFromText('POINT(119 42)')),
- ('l', 'j', 's', GeomFromText('POINT(97 96)')),
- ('f', 'z', 'x', GeomFromText('POINT(208 65)')),
- ('i', 'v', 'c', GeomFromText('POINT(145 79)')),
- ('l', 'f', 'k', GeomFromText('POINT(83 234)')),
- ('u', 'a', 's', GeomFromText('POINT(250 49)')),
- ('o', 'k', 'p', GeomFromText('POINT(46 50)')),
- ('d', 'e', 'z', GeomFromText('POINT(30 198)')),
- ('r', 'r', 'l', GeomFromText('POINT(78 189)')),
- ('y', 'l', 'f', GeomFromText('POINT(188 132)')),
- ('d', 'q', 'm', GeomFromText('POINT(247 107)')),
- ('p', 'j', 'n', GeomFromText('POINT(148 227)')),
- ('b', 'o', 'i', GeomFromText('POINT(172 25)')),
- ('e', 'v', 'd', GeomFromText('POINT(94 248)')),
- ('q', 'd', 'f', GeomFromText('POINT(15 29)')),
- ('w', 'b', 'b', GeomFromText('POINT(74 111)')),
- ('g', 'q', 'f', GeomFromText('POINT(107 215)')),
- ('o', 'h', 'r', GeomFromText('POINT(25 168)')),
- ('u', 't', 'w', GeomFromText('POINT(251 188)')),
- ('h', 's', 'w', GeomFromText('POINT(254 247)')),
- ('f', 'f', 'b', GeomFromText('POINT(166 103)'));
-SET @@RAND_SEED1=866613816, @@RAND_SEED2=92289615;
-INSERT INTO t1 (c2, c1, c3, spatial_point) VALUES
- ('l', 'c', 'l', GeomFromText('POINT(202 98)')),
- ('k', 'c', 'b', GeomFromText('POINT(46 206)')),
- ('r', 'y', 'm', GeomFromText('POINT(74 140)')),
- ('y', 'z', 'd', GeomFromText('POINT(200 160)')),
- ('s', 'y', 's', GeomFromText('POINT(156 205)')),
- ('u', 'v', 'p', GeomFromText('POINT(86 82)')),
- ('j', 's', 's', GeomFromText('POINT(91 233)')),
- ('x', 'j', 'f', GeomFromText('POINT(3 14)')),
- ('l', 'z', 'v', GeomFromText('POINT(123 156)')),
- ('h', 'i', 'o', GeomFromText('POINT(145 229)')),
- ('o', 'r', 'd', GeomFromText('POINT(15 22)')),
- ('f', 'x', 't', GeomFromText('POINT(21 60)')),
- ('t', 'g', 'h', GeomFromText('POINT(50 153)')),
- ('g', 'u', 'b', GeomFromText('POINT(82 85)')),
- ('v', 'a', 'p', GeomFromText('POINT(231 178)')),
- ('n', 'v', 'o', GeomFromText('POINT(183 25)')),
- ('j', 'n', 'm', GeomFromText('POINT(50 144)')),
- ('e', 'f', 'i', GeomFromText('POINT(46 16)')),
- ('d', 'w', 'a', GeomFromText('POINT(66 6)')),
- ('f', 'x', 'a', GeomFromText('POINT(107 197)')),
- ('m', 'o', 'a', GeomFromText('POINT(142 80)')),
- ('q', 'l', 'g', GeomFromText('POINT(251 23)')),
- ('c', 's', 's', GeomFromText('POINT(158 43)')),
- ('y', 'd', 'o', GeomFromText('POINT(196 228)')),
- ('d', 'p', 'l', GeomFromText('POINT(107 5)')),
- ('h', 'a', 'b', GeomFromText('POINT(183 166)')),
- ('m', 'w', 'p', GeomFromText('POINT(19 59)')),
- ('b', 'y', 'o', GeomFromText('POINT(178 30)')),
- ('x', 'w', 'i', GeomFromText('POINT(168 94)')),
- ('t', 'k', 'z', GeomFromText('POINT(171 5)')),
- ('r', 'm', 'a', GeomFromText('POINT(222 19)')),
- ('u', 'v', 'e', GeomFromText('POINT(224 80)')),
- ('q', 'r', 'k', GeomFromText('POINT(212 218)')),
- ('d', 'p', 'j', GeomFromText('POINT(169 7)')),
- ('d', 'r', 'v', GeomFromText('POINT(193 23)')),
- ('n', 'y', 'y', GeomFromText('POINT(130 178)')),
- ('m', 'z', 'r', GeomFromText('POINT(81 200)')),
- ('j', 'e', 'w', GeomFromText('POINT(145 239)')),
- ('v', 'h', 'x', GeomFromText('POINT(24 105)')),
- ('z', 'm', 'a', GeomFromText('POINT(175 129)')),
- ('b', 'c', 'v', GeomFromText('POINT(213 10)')),
- ('t', 't', 'u', GeomFromText('POINT(2 129)')),
- ('r', 's', 'v', GeomFromText('POINT(209 192)')),
- ('x', 'p', 'g', GeomFromText('POINT(43 63)')),
- ('t', 'e', 'u', GeomFromText('POINT(139 210)')),
- ('l', 'e', 't', GeomFromText('POINT(245 148)')),
- ('a', 'i', 'k', GeomFromText('POINT(167 195)')),
- ('m', 'o', 'h', GeomFromText('POINT(206 120)')),
- ('g', 'z', 's', GeomFromText('POINT(169 240)')),
- ('z', 'u', 's', GeomFromText('POINT(202 120)')),
- ('i', 'b', 'a', GeomFromText('POINT(216 18)')),
- ('w', 'y', 'g', GeomFromText('POINT(119 236)')),
- ('h', 'y', 'p', GeomFromText('POINT(161 24)'));
-UPDATE t1 set spatial_point=GeomFromText('POINT(33 100)') where c1 like 't%';
-UPDATE t1 set spatial_point=GeomFromText('POINT(41 46)') where c1 like 'f%';
-CHECK TABLE t1 EXTENDED;
-DROP TABLE t1;
-
-#
-# Bug #30286 spatial index cause corruption and server crash!
-#
-
-create table t1 (a geometry not null, spatial index(a));
-insert into t1 values (POINT(1.1517219314031e+164, 131072));
-insert into t1 values (POINT(9.1248812352444e+192, 2.9740338169556e+284));
-insert into t1 values (POINT(4.7783097267365e-299, -0));
-insert into t1 values (POINT(1.49166814624e-154, 2.0880974297595e-53));
-insert into t1 values (POINT(4.0917382598702e+149, 1.2024538023802e+111));
-insert into t1 values (POINT(2.0349165139404e+236, 2.9993936277913e-241));
-insert into t1 values (POINT(2.5243548967072e-29, 1.2024538023802e+111));
-insert into t1 values (POINT(0, 6.9835074892995e-251));
-insert into t1 values (POINT(2.0880974297595e-53, 3.1050361846014e+231));
-insert into t1 values (POINT(2.8728483499323e-188, 2.4600631144627e+260));
-insert into t1 values (POINT(3.0517578125e-05, 2.0349165139404e+236));
-insert into t1 values (POINT(1.1517219314031e+164, 1.1818212630766e-125));
-insert into t1 values (POINT(2.481040258324e-265, 5.7766220027675e-275));
-insert into t1 values (POINT(2.0880974297595e-53, 2.5243548967072e-29));
-insert into t1 values (POINT(5.7766220027675e-275, 9.9464647281957e+86));
-insert into t1 values (POINT(2.2181357552967e+130, 3.7857669957337e-270));
-insert into t1 values (POINT(4.5767114681874e-246, 3.6893488147419e+19));
-insert into t1 values (POINT(4.5767114681874e-246, 3.7537584144024e+255));
-insert into t1 values (POINT(3.7857669957337e-270, 1.8033161362863e-130));
-insert into t1 values (POINT(0, 5.8774717541114e-39));
-insert into t1 values (POINT(1.1517219314031e+164, 2.2761049594727e-159));
-insert into t1 values (POINT(6.243497100632e+144, 3.7857669957337e-270));
-insert into t1 values (POINT(3.7857669957337e-270, 2.6355494858076e-82));
-insert into t1 values (POINT(2.0349165139404e+236, 3.8518598887745e-34));
-insert into t1 values (POINT(4.6566128730774e-10, 2.0880974297595e-53));
-insert into t1 values (POINT(2.0880974297595e-53, 1.8827498946116e-183));
-insert into t1 values (POINT(1.8033161362863e-130, 9.1248812352444e+192));
-insert into t1 values (POINT(4.7783097267365e-299, 2.2761049594727e-159));
-insert into t1 values (POINT(1.94906280228e+289, 1.2338789709327e-178));
-drop table t1;
-
-# End of 4.1 tests
-
-#
-# bug #21790 (UNKNOWN ERROR on NULLs in RTree)
-#
-CREATE TABLE t1(foo GEOMETRY NOT NULL, SPATIAL INDEX(foo) );
---error 1048
-INSERT INTO t1(foo) VALUES (NULL);
---error 1416
-INSERT IGNORE INTO t1() VALUES ();
---error 1416
-INSERT INTO t1(foo) VALUES ('');
-DROP TABLE t1;
-
-#
-# Bug #23578: Corruption prevents Optimize table from working properly with a
-# spatial index
-#
-
-CREATE TABLE t1 (a INT AUTO_INCREMENT, b POINT NOT NULL, KEY (a), SPATIAL KEY (b));
-
-INSERT INTO t1 (b) VALUES (GeomFromText('POINT(1 2)'));
-INSERT INTO t1 (b) SELECT b FROM t1;
-INSERT INTO t1 (b) SELECT b FROM t1;
-INSERT INTO t1 (b) SELECT b FROM t1;
-INSERT INTO t1 (b) SELECT b FROM t1;
-INSERT INTO t1 (b) SELECT b FROM t1;
-
-OPTIMIZE TABLE t1;
-DROP TABLE t1;
-
-
-#
-# Bug #29070: Error in spatial index
-#
-
-CREATE TABLE t1 (a INT, b GEOMETRY NOT NULL, SPATIAL KEY b(b));
-INSERT INTO t1 VALUES (1, GEOMFROMTEXT('LINESTRING(1102218.456 1,2000000 2)'));
-INSERT INTO t1 VALUES (2, GEOMFROMTEXT('LINESTRING(1102218.456 1,2000000 2)'));
-
-# must return the same number as the next select
-SELECT COUNT(*) FROM t1 WHERE
- MBRINTERSECTS(b, GEOMFROMTEXT('LINESTRING(1 1,1102219 2)') );
-SELECT COUNT(*) FROM t1 IGNORE INDEX (b) WHERE
- MBRINTERSECTS(b, GEOMFROMTEXT('LINESTRING(1 1,1102219 2)') );
-
-DROP TABLE t1;
-
-
---echo #
---echo # Bug #48258: Assertion failed when using a spatial index
---echo #
-CREATE TABLE t1(a LINESTRING NOT NULL, SPATIAL KEY(a));
-INSERT INTO t1 VALUES
- (GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)')),
- (GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)'));
-EXPLAIN SELECT 1 FROM t1 WHERE a = GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
-SELECT 1 FROM t1 WHERE a = GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
-EXPLAIN SELECT 1 FROM t1 WHERE a < GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
-SELECT 1 FROM t1 WHERE a < GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
-EXPLAIN SELECT 1 FROM t1 WHERE a <= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
-SELECT 1 FROM t1 WHERE a <= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
-EXPLAIN SELECT 1 FROM t1 WHERE a > GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
-SELECT 1 FROM t1 WHERE a > GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
-EXPLAIN SELECT 1 FROM t1 WHERE a >= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
-SELECT 1 FROM t1 WHERE a >= GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)');
-DROP TABLE t1;
-
-
---echo #
---echo # Bug #51357: crash when using handler commands on spatial indexes
---echo #
-
-CREATE TABLE t1(a GEOMETRY NOT NULL,SPATIAL INDEX a(a));
-HANDLER t1 OPEN;
-HANDLER t1 READ a FIRST;
-HANDLER t1 READ a NEXT;
-HANDLER t1 READ a PREV;
-HANDLER t1 READ a LAST;
-HANDLER t1 CLOSE;
-
-# second crash fixed when the tree has changed since the last search.
-HANDLER t1 OPEN;
-HANDLER t1 READ a FIRST;
-INSERT INTO t1 VALUES (GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
---echo # should not crash
---disable_result_log
-HANDLER t1 READ a NEXT;
---enable_result_log
-HANDLER t1 CLOSE;
-
-DROP TABLE t1;
-
-
---echo End of 5.0 tests.
-
-
---echo #
---echo # Bug #57323/11764487: myisam corruption with insert ignore
---echo # and invalid spatial data
---echo #
-
-CREATE TABLE t1(a POINT NOT NULL, b GEOMETRY NOT NULL,
- SPATIAL KEY(a), SPATIAL KEY(b));
-INSERT INTO t1 VALUES(GEOMFROMTEXT("point (0 0)"), GEOMFROMTEXT("point (1 1)"));
---error ER_CANT_CREATE_GEOMETRY_OBJECT
-INSERT IGNORE INTO t1 SET a=GEOMFROMTEXT("point (-6 0)"), b=GEOMFROMTEXT("error");
---error ER_CANT_CREATE_GEOMETRY_OBJECT
-INSERT IGNORE INTO t1 SET a=GEOMFROMTEXT("point (-6 0)"), b=NULL;
-SELECT ASTEXT(a), ASTEXT(b) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1(a INT NOT NULL, b GEOMETRY NOT NULL,
- KEY(a), SPATIAL KEY(b));
-INSERT INTO t1 VALUES(0, GEOMFROMTEXT("point (1 1)"));
---error ER_CANT_CREATE_GEOMETRY_OBJECT
-INSERT IGNORE INTO t1 SET a=0, b=GEOMFROMTEXT("error");
---error ER_CANT_CREATE_GEOMETRY_OBJECT
-INSERT IGNORE INTO t1 SET a=1, b=NULL;
-SELECT a, ASTEXT(b) FROM t1;
-DROP TABLE t1;
-
---echo End of 5.1 tests
-
-#
-# MDEV-4521 MBRContains, MBRWithin no longer work with geometries of different type.
-#
-CREATE TABLE t1 (
- l LINESTRING NOT NULL,
- SPATIAL KEY(l)
-);
-
-INSERT INTO t1 VALUES(GeomFromText('LINESTRING(0 0, 1 1)'));
-INSERT INTO t1 VALUES(GeomFromText('LINESTRING(1 1, 2 2)'));
-INSERT INTO t1 VALUES(GeomFromText('LINESTRING(2 2, 3 3)'));
-
-SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
-SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
-
-SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
-SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
-
-DROP TABLE t1;
-
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-8239 Reverse spatial operations OP(const, field) do not get optimized
---echo #
-CREATE TABLE t1 (a GEOMETRY NOT NULL, SPATIAL KEY(a));
-INSERT INTO t1 VALUES (Point(1,2)),(Point(1,3));
-EXPLAIN SELECT * FROM t1 WHERE MBRINTERSECTS(a,Point(1,2));
-EXPLAIN SELECT * FROM t1 WHERE ST_INTERSECTS(a,Point(1,2));
-EXPLAIN SELECT * FROM t1 WHERE MBRINTERSECTS(Point(1,2),a);
-EXPLAIN SELECT * FROM t1 WHERE ST_INTERSECTS(Point(1,2),a);
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8610 "WHERE CONTAINS(indexed_geometry_column,1)" causes full table scan
---echo #
-CREATE TABLE t1 (a GEOMETRY NOT NULL, SPATIAL KEY(a));
-INSERT INTO t1 VALUES (Point(1,1)),(Point(2,2)),(Point(3,3));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-EXPLAIN SELECT * FROM t1 WHERE CONTAINS(a,1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-EXPLAIN SELECT * FROM t1 WHERE CONTAINS(a,1.0);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-EXPLAIN SELECT * FROM t1 WHERE CONTAINS(a,1e0);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-EXPLAIN SELECT * FROM t1 WHERE CONTAINS(a,TIME'00:00:00');
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-EXPLAIN SELECT * FROM t1 WHERE CONTAINS(a,DATE'2001-01-01');
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-EXPLAIN SELECT * FROM t1 WHERE CONTAINS(a,TIMESTAMP'2001-01-01 00:00:00');
-DROP TABLE t1;
-
-
---echo #
---echo # End of 10.1 tests
---echo #
diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test
deleted file mode 100644
index ca806778f0e..00000000000
--- a/mysql-test/t/gis.test
+++ /dev/null
@@ -1,2992 +0,0 @@
--- source include/have_geometry.inc
-
-
-#
-# Spatial objects
-#
-
-CREATE TABLE gis_point (fid INTEGER NOT NULL PRIMARY KEY, g POINT);
-CREATE TABLE gis_line (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING);
-CREATE TABLE gis_polygon (fid INTEGER NOT NULL PRIMARY KEY, g POLYGON);
-CREATE TABLE gis_multi_point (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOINT);
-CREATE TABLE gis_multi_line (fid INTEGER NOT NULL PRIMARY KEY, g MULTILINESTRING);
-CREATE TABLE gis_multi_polygon (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOLYGON);
-CREATE TABLE gis_geometrycollection (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRYCOLLECTION);
-CREATE TABLE gis_geometry (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRY);
-
-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;
-explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelope(g)) from gis_geometry;
-
-SELECT fid, X(g) FROM gis_point;
-SELECT fid, Y(g) FROM gis_point;
-explain extended select X(g),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;
-explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),NumPoints(g),AsText(PointN(g, 2)),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;
-explain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumInteriorRings(g),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;
-explain extended SELECT fid, NumGeometries(g) from gis_multi_point;
-
-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;
-explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
-
-SELECT g1.fid as first, g2.fid as second,
-Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
-Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
-Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
-FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
-explain extended SELECT g1.fid as first, g2.fid as second,
-Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
-Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
-Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
-FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
-
-DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
-
-#
-# Check that ALTER TABLE doesn't loose geometry type
-#
-CREATE TABLE t1 (
- gp point,
- ln linestring,
- pg polygon,
- mp multipoint,
- mln multilinestring,
- mpg multipolygon,
- gc geometrycollection,
- gm geometry
-);
-
-SHOW FIELDS FROM t1;
-ALTER TABLE t1 ADD fid INT NOT NULL;
-SHOW FIELDS FROM t1;
-DROP TABLE t1;
-
-SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
-explain extended SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
-explain extended SELECT AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))));
-SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
-explain extended SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
-#select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimple(Point(3, 6)),issimple(PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),issimple(GeometryFromText('POINT(1 4)')), issimple(AsWKB(GeometryFromText('POINT(1 4)')));
-explain extended select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimple(Point(3, 6));
-
-create table t1 (a geometry not null);
-insert into t1 values (GeomFromText('Point(1 2)'));
--- error 1416
-insert into t1 values ('Garbage');
--- error 1416
-insert IGNORE into t1 values ('Garbage');
-alter table t1 add spatial index(a);
-
-drop table t1;
-
-#
-# Bug #5219: problem with range optimizer
-#
-
-create table t1(a geometry not null, spatial index(a));
-insert into t1 values
-(GeomFromText('POINT(1 1)')), (GeomFromText('POINT(3 3)')),
-(GeomFromText('POINT(4 4)')), (GeomFromText('POINT(6 6)'));
-select AsText(a) from t1 where
- MBRContains(GeomFromText('Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'), a)
- or
- MBRContains(GeomFromText('Polygon((2 2, 2 5, 5 5, 5 2, 2 2))'), a);
-select AsText(a) from t1 where
- MBRContains(GeomFromText('Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'), a)
- and
- MBRContains(GeomFromText('Polygon((0 0, 0 7, 7 7, 7 0, 0 0))'), a);
-drop table t1;
-
-CREATE TABLE t1 (Coordinates POINT NOT NULL, SPATIAL INDEX(Coordinates));
-INSERT INTO t1 VALUES(GeomFromText('POINT(383293632 1754448)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(564952612 157516260)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(903994614 180726515)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(98128178 141127631)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(862547902 799334546)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(341989013 850270906)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(803302376 93039099)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(857439153 817431356)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(319757546 343162742)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(826341972 717484432)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(305066789 201736238)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(626068992 616241497)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(55789424 755830108)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(802874458 312435220)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(153795660 551723671)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(242207428 537089292)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(553478119 807160039)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(694605552 457472733)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(987886554 792733729)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(598600363 850434457)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(592068275 940589376)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(700705362 395370650)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(33628474 558144514)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(212802006 353386020)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(901307256 39143977)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(70870451 206374045)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(240880214 696939443)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(822615542 296669638)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(452769551 625489999)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(609104858 606565210)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(177213669 851312285)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(143654501 730691787)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(658472325 838260052)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(188164520 646358878)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(630993781 786764883)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(496793334 223062055)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(727354258 197498696)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(618432704 760982731)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(755643210 831234710)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(114368751 656950466)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(870378686 185239202)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(863324511 111258900)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(882178645 685940052)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(407928538 334948195)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(311430051 17033395)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(941513405 488643719)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(868345680 85167906)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(219335507 526818004)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(923427958 407500026)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(173176882 554421738)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(194264908 669970217)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(777483793 921619165)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(867468912 395916497)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(682601897 623112122)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(227151206 796970647)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(280062588 97529892)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(982209849 143387099)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(208788792 864388493)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(829327151 616717329)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(199336688 140757201)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(633750724 140850093)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(629400920 502096404)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(226017998 848736426)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(28914408 149445955)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(256236452 202091290)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(703867693 450501360)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(872061506 481351486)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(372120524 739530418)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(877267982 54722420)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(362642540 104419188)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(851693067 642705127)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(201949080 833902916)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(786092225 410737872)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(698291409 615419376)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(27455201 897628096)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(756176576 661205925)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(38478189 385577496)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(163302328 264496186)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(234313922 192216735)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(413942141 490550373)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(394308025 117809834)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(941051732 266369530)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(599161319 313172256)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(5899948 476429301)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(367894677 368542487)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(580848489 219587743)'));
-INSERT INTO t1 VALUES(GeomFromText('POINT(11247614 782797569)'));
-drop table t1;
-
-create table t1 select GeomFromWKB(POINT(1,3));
-show create table t1;
-drop table t1;
-
-CREATE TABLE `t1` (`object_id` bigint(20) unsigned NOT NULL default '0', `geo`
-geometry NOT NULL default '') ENGINE=MyISAM ;
-
-insert into t1 values ('85984',GeomFromText('MULTIPOLYGON(((-115.006363
-36.305435,-114.992394 36.305202,-114.991219 36.305975,-114.991163
-36.306845,-114.989432 36.309452,-114.978275 36.312642,-114.977363
-36.311978,-114.975327 36.312344,-114.96502 36.31597,-114.963364
-36.313629,-114.961723 36.313721,-114.956398 36.316057,-114.951882
-36.320979,-114.947073 36.323475,-114.945207 36.326451,-114.945207
-36.326451,-114.944132 36.326061,-114.94003 36.326588,-114.924017
-36.334484,-114.923281 36.334146,-114.92564 36.331504,-114.94072
-36.319282,-114.945348 36.314812,-114.948091 36.314762,-114.951755
-36.316211,-114.952446 36.313883,-114.952644 36.309488,-114.944725
-36.313083,-114.93706 36.32043,-114.932478 36.323497,-114.924556
-36.327708,-114.922608 36.329715,-114.92009 36.328695,-114.912105
-36.323566,-114.901647 36.317952,-114.897436 36.313968,-114.895344
-36.309573,-114.891699 36.304398,-114.890569 36.303551,-114.886356
-36.302702,-114.885141 36.301351,-114.885709 36.297391,-114.892499
-36.290893,-114.902142 36.288974,-114.904941 36.288838,-114.905308
-36.289845,-114.906325 36.290395,-114.909916 36.289549,-114.914527
-36.287535,-114.918797 36.284423,-114.922982 36.279731,-114.924113
-36.277282,-114.924057 36.275817,-114.927733 36.27053,-114.929354
-36.269029,-114.929354 36.269029,-114.950856 36.268715,-114.950768
-36.264324,-114.960206 36.264293,-114.960301 36.268943,-115.006662
-36.268929,-115.008583 36.265619,-115.00665 36.264247,-115.006659
-36.246873,-115.006659 36.246873,-115.006838 36.247697,-115.010764
-36.247774,-115.015609 36.25113,-115.015765 36.254505,-115.029517
-36.254619,-115.038573 36.249317,-115.038573 36.249317,-115.023403
-36.25841,-115.023873 36.258994,-115.031845 36.259829,-115.03183
-36.261053,-115.025561 36.261095,-115.036417 36.274632,-115.033729
-36.276041,-115.032217 36.274851,-115.029845 36.273959,-115.029934
-36.274966,-115.025763 36.274896,-115.025406 36.281044,-115.028731
-36.284471,-115.036497 36.290377,-115.042071 36.291039,-115.026759
-36.298478,-115.008995 36.301966,-115.006363 36.305435),(-115.079835
-36.244369,-115.079735 36.260186,-115.076435 36.262369,-115.069758
-36.265,-115.070235 36.268757,-115.064542 36.268655,-115.061843
-36.269857,-115.062676 36.270693,-115.06305 36.272344,-115.059051
-36.281023,-115.05918 36.283008,-115.060591 36.285246,-115.061913
-36.290022,-115.062499 36.306353,-115.062499 36.306353,-115.060918
-36.30642,-115.06112 36.289779,-115.05713 36.2825,-115.057314
-36.279446,-115.060779 36.274659,-115.061366 36.27209,-115.057858
-36.26557,-115.055805 36.262883,-115.054688 36.262874,-115.047335
-36.25037,-115.044234 36.24637,-115.052434 36.24047,-115.061734
-36.23507,-115.061934 36.22677,-115.061934 36.22677,-115.061491
-36.225267,-115.062024 36.218194,-115.060134 36.218278,-115.060133
-36.210771,-115.057833 36.210771,-115.057433 36.196271,-115.062233
-36.196271,-115.062233 36.190371,-115.062233 36.190371,-115.065533
-36.190371,-115.071333 36.188571,-115.098331 36.188275,-115.098331
-36.188275,-115.098435 36.237569,-115.097535 36.240369,-115.097535
-36.240369,-115.093235 36.240369,-115.089135 36.240469,-115.083135
-36.240569,-115.083135 36.240569,-115.079835
-36.244369)))')),('85998',GeomFromText('MULTIPOLYGON(((-115.333107
-36.264587,-115.333168 36.280638,-115.333168 36.280638,-115.32226
-36.280643,-115.322538 36.274311,-115.327222 36.274258,-115.32733
-36.263026,-115.330675 36.262984,-115.332132 36.264673,-115.333107
-36.264587),(-115.247239 36.247066,-115.247438 36.218267,-115.247438
-36.218267,-115.278525 36.219263,-115.278525 36.219263,-115.301545
-36.219559,-115.332748 36.219197,-115.332757 36.220041,-115.332757
-36.220041,-115.332895 36.233514,-115.349023 36.233479,-115.351489
-36.234475,-115.353681 36.237021,-115.357106 36.239789,-115.36519
-36.243331,-115.368156 36.243487,-115.367389 36.244902,-115.364553
-36.246014,-115.359219 36.24616,-115.356186 36.248025,-115.353347
-36.248004,-115.350813 36.249507,-115.339673 36.25387,-115.333069
-36.255018,-115.333069 36.255018,-115.333042 36.247767,-115.279039
-36.248666,-115.263639 36.247466,-115.263839 36.252766,-115.261439
-36.252666,-115.261439 36.247366,-115.247239 36.247066)))'));
-
-# Expected results are 115.2970604672862 and 36.23335610879993, but IA64 returns
-# slightly different values due to fused multiply-add instructions.
---replace_result 115.29706047613604 115.2970604672862 36.23335611157958 36.23335610879993
-select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
-t1 where object_id=85998;
-
-# Expected result is 36.34725218253213, but IA64 returns 36.34725217627852
-# due to fused multiply-add instructions.
---replace_result 36.34725217627852 36.34725218253213 -114.86854470090232 -114.86854472054372
-select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
-t1 where object_id=85984;
-
-drop table t1;
-
-create table t1 (fl geometry not null);
---error 1416
-insert into t1 values (1);
---error 1416
-insert into t1 values (1.11);
---error 1416
-insert into t1 values ("qwerty");
---error 1048
-insert into t1 values (pointfromtext('point(1,1)'));
-
-drop table t1;
-
-select (asWKT(geomfromwkb((0x000000000140240000000000004024000000000000))));
-select (asWKT(geomfromwkb((0x010100000000000000000024400000000000002440))));
-
---enable_metadata
-create table t1 (g GEOMETRY);
-select * from t1;
-select asbinary(g) from t1;
---disable_metadata
-drop table t1;
-
-create table t1 (a TEXT, b GEOMETRY NOT NULL, SPATIAL KEY(b));
-alter table t1 disable keys;
---error 1263
-load data infile '../../std_data/bad_gis_data.dat' into table t1;
-alter table t1 enable keys;
-drop table t1;
-
-#
-# Bug #26038: is null and bad data
-#
-
-create table t1 (a int, b blob);
-insert into t1 values (1, ''), (2, NULL), (3, '1');
-select * from t1;
-
---error ER_ILLEGAL_VALUE_FOR_TYPE
-select
- geometryfromtext(b) IS NULL, geometryfromwkb(b) IS NULL, astext(b) IS NULL,
- aswkb(b) IS NULL, geometrytype(b) IS NULL, centroid(b) IS NULL,
- envelope(b) IS NULL, startpoint(b) IS NULL, endpoint(b) IS NULL,
- exteriorring(b) IS NULL, pointn(b, 1) IS NULL, geometryn(b, 1) IS NULL,
- interiorringn(b, 1) IS NULL, multipoint(b) IS NULL, isempty(b) IS NULL,
- issimple(b) IS NULL, isclosed(b) IS NULL, dimension(b) IS NULL,
- numgeometries(b) IS NULL, numinteriorrings(b) IS NULL, numpoints(b) IS NULL,
- area(b) IS NULL, glength(b) IS NULL, srid(b) IS NULL, x(b) IS NULL,
- y(b) IS NULL
-from t1;
-
-select
- within(b, b) IS NULL, contains(b, b) IS NULL, overlaps(b, b) IS NULL,
- equals(b, b) IS NULL, disjoint(b, b) IS NULL, touches(b, b) IS NULL,
- intersects(b, b) IS NULL, crosses(b, b) IS NULL
-from t1;
-
---error ER_ILLEGAL_VALUE_FOR_TYPE
-select
- point(b, b) IS NULL, linestring(b) IS NULL, polygon(b) IS NULL, multipoint(b) IS NULL,
- multilinestring(b) IS NULL, multipolygon(b) IS NULL,
- geometrycollection(b) IS NULL
-from t1;
-
-drop table t1;
-
-#
-# Bug #27164: Crash when mixing InnoDB and MyISAM Geospatial tables
-#
-CREATE TABLE t1(a POINT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (NULL);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-#
-# Bug #30955 geomfromtext() crasher
-#
-CREATE TABLE `t1` ( `col9` set('a'), `col89` date);
-INSERT INTO `t1` VALUES ('','0000-00-00');
-select geomfromtext(col9,col89) as a from t1;
-DROP TABLE t1;
-
-#
-# Bug #31158 Spatial, Union, LONGBLOB vs BLOB bug (crops data)
-#
-
-CREATE TABLE t1 (
- geomdata polygon NOT NULL,
- SPATIAL KEY index_geom (geomdata)
-) ENGINE=MyISAM DEFAULT CHARSET=latin2 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED;
-
-CREATE TABLE t2 (
- geomdata polygon NOT NULL,
- SPATIAL KEY index_geom (geomdata)
-) ENGINE=MyISAM DEFAULT CHARSET=latin2 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED;
-
-CREATE TABLE t3
-select
- aswkb(ws.geomdata) AS geomdatawkb
- from
- t1 ws
-union
- select
- aswkb(ws.geomdata) AS geomdatawkb
- from
- t2 ws;
-
-describe t3;
-
-drop table t1;
-drop table t2;
-drop table t3;
-
-#
-# Bug #30284 spatial key corruption
-#
-
-create table t1(col1 geometry default null,col15 geometrycollection not
-null,spatial index(col15),index(col1(15)))engine=myisam;
-insert into t1 set col15 = GeomFromText('POINT(6 5)');
-insert into t1 set col15 = GeomFromText('POINT(6 5)');
-check table t1 extended;
-drop table t1;
-
---echo End of 4.1 tests
-
-#
-# Bug #12281 (Geometry: crash in trigger)
-#
-
-create table t1 (s1 geometry not null,s2 char(100));
-create trigger t1_bu before update on t1 for each row set new.s1 = null;
---error 1048
-insert into t1 values (null,null);
-drop table t1;
-
-#
-# Bug #10499 (function creation with GEOMETRY datatype)
-#
---disable_warnings
-drop procedure if exists fn3;
---enable_warnings
-create function fn3 () returns point deterministic return GeomFromText("point(1 1)");
-show create function fn3;
-select astext(fn3());
-drop function fn3;
-
-#
-# Bug #12267 (primary key over GIS)
-#
-create table t1(pt POINT);
-alter table t1 add primary key pti(pt);
-drop table t1;
-create table t1(pt GEOMETRY);
---error 1170
-alter table t1 add primary key pti(pt);
-alter table t1 add primary key pti(pt(20));
-drop table t1;
-
-
-create table t1 select GeomFromText('point(1 1)');
-desc t1;
-drop table t1;
-
-#
-# Bug #20691 (DEFAULT over NOT NULL field)
-#
-create table t1 (g geometry not null);
---error ER_CANT_CREATE_GEOMETRY_OBJECT
-insert into t1 values(default);
-drop table t1;
-
-#
-# Bug #27300: create view with geometry functions lost columns types
-#
-CREATE TABLE t1 (a GEOMETRY);
-CREATE VIEW v1 AS SELECT GeomFromwkb(ASBINARY(a)) FROM t1;
-CREATE VIEW v2 AS SELECT a FROM t1;
-DESCRIBE v1;
-DESCRIBE v2;
-
-DROP VIEW v1,v2;
-DROP TABLE t1;
-
-#
-# Bug#24563: MBROverlaps does not seem to function propertly
-# Bug#54888: MBROverlaps missing in 5.1?
-#
-
-# Test all MBR* functions and their non-MBR-prefixed aliases,
-# using shifted squares to verify the spatial relations.
-
-create table t1 (name VARCHAR(100), square GEOMETRY);
-
-INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
-
-INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
-INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
-
-INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
-INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
-INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
-
-INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
-INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
-INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
-
-INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
-INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
-INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
-
-INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
-INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
-INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
-
-SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
-SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
-SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
-SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
-SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
-SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
-SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
-
-SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
-SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
-SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
-SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersects FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
-SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
-SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
-SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
-
-# Overlaps needs a few more tests, with point and line dimensions
-
-SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
-SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
-SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
-SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
-SET @point1 = GeomFromText('POLYGON ((0 0))');
-SET @point2 = GeomFromText('POLYGON ((-2 0))');
-
-SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
-SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
-SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
-SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
-SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
-SELECT Overlaps(@horiz1, @point1) FROM DUAL;
-SELECT Overlaps(@horiz1, @point2) FROM DUAL;
-
-DROP TABLE t1;
-
-#
-# Bug#28763: Selecting geometry fields in UNION caused server crash.
-#
-create table t1(f1 geometry, f2 linestring, f3 linestring);
-select f1 from t1 union select f1 from t1;
-insert into t1 (f2,f3) values (GeomFromText('LINESTRING(1 1, 2 2)'),
- GeomFromText('LINESTRING(0 0,1 1,2 2)'));
-select AsText(f2),AsText(f3) from t1;
-select AsText(a) from (select f2 as a from t1 union select f3 from t1) t;
-create table t2 as select f2 as a from t1 union select f3 from t1;
-desc t2;
-select AsText(a) from t2;
-drop table t1, t2;
-
-#
-# Bug #29166: MYsql crash when query is run
-#
-
-# The test query itself is not logged : too large output.
-# The real test is the second query : see if the first hasn't crashed the
-# server
---disable_query_log
---disable_result_log
-SELECT AsText(GeometryFromText(CONCAT(
- 'MULTIPOLYGON(((',
- REPEAT ('-0.00000000001234567890123456789012 -0.123456789012345678,', 1000),
- '-0.00000000001234567890123456789012 -0.123456789012345678',
- ')))'
-))) AS a;
---enable_result_log
---enable_query_log
-SELECT 1;
-
--- source include/gis_keys.inc
-
-#
-# Bug #31155 gis types in union'd select cause crash
-#
-
-create table `t1` (`col002` point)engine=myisam;
-insert into t1 values (),(),();
-select min(`col002`) from t1 union select `col002` from t1;
-drop table t1;
-
---echo #
---echo # Bug #47780: crash when comparing GIS items from subquery
---echo #
-
-CREATE TABLE t1(a INT, b MULTIPOLYGON);
-INSERT INTO t1 VALUES
- (0,
- GEOMFROMTEXT(
- 'multipolygon(((1 2,3 4,5 6,7 8,9 8),(7 6,5 4,3 2,1 2,3 4)))'));
-
---echo # must not crash
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT 1 FROM t1 WHERE a <> (SELECT GEOMETRYCOLLECTIONFROMWKB(b) FROM t1);
-
-DROP TABLE t1;
-
---echo #
---echo # Bug #49250 : spatial btree index corruption and crash
---echo # Part one : spatial syntax check
---echo #
-
---error ER_PARSE_ERROR
-CREATE TABLE t1(col1 MULTIPOLYGON NOT NULL,
- SPATIAL INDEX USING BTREE (col1));
-CREATE TABLE t2(col1 MULTIPOLYGON NOT NULL);
---error ER_PARSE_ERROR
-CREATE SPATIAL INDEX USING BTREE ON t2(col);
---error ER_PARSE_ERROR
-ALTER TABLE t2 ADD SPATIAL INDEX USING BTREE (col1);
-
-DROP TABLE t2;
-
---echo End of 5.0 tests
-
-
-#
-# Bug #11335 View redefines column types
-#
-create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime);
-create view v1 as select * from t1;
-desc v1;
-drop view v1;
-drop table t1;
-
-#
-# Bug#44684: valgrind reports invalid reads in
-# Item_func_spatial_collection::val_str
-#
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT MultiPoint(12345,'');
-#SELECT MultiPoint(123451,'');
-#SELECT MultiPoint(1234512,'');
-#SELECT MultiPoint(12345123,'');
-
---error ER_ILLEGAL_VALUE_FOR_TYPE
-#SELECT MultiLineString(12345,'');
-#SELECT MultiLineString(123451,'');
-#SELECT MultiLineString(1234512,'');
-#SELECT MultiLineString(12345123,'');
-
---error ER_ILLEGAL_VALUE_FOR_TYPE
-#SELECT LineString(12345,'');
-#SELECT LineString(123451,'');
-#SELECT LineString(1234512,'');
-#SELECT LineString(12345123,'');
-
---error ER_ILLEGAL_VALUE_FOR_TYPE
-#SELECT Polygon(12345,'');
-#SELECT Polygon(123451,'');
-#SELECT Polygon(1234512,'');
-#SELECT Polygon(12345123,'');
-
-#
-# Bug55531 crash with conversions of geometry types / strings
-#
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT 1 FROM (SELECT GREATEST(1,GEOMETRYCOLLECTION('00000','00000')) b FROM DUAL) AS d WHERE (LINESTRING(d.b));
-
-
---echo #
---echo # BUG#51875: crash when loading data into geometry function polyfromwkb
---echo #
-SET @a=0x00000000030000000100000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440;
-SET @a=POLYFROMWKB(@a);
-SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440;
-SET @a=POLYFROMWKB(@a);
-
-
-#
-# Bug #57321 crashes and valgrind errors from spatial types
-#
-
-create table t1(a geometry NOT NULL)engine=myisam;
-insert into t1 values (geomfromtext("point(0 1)"));
-insert into t1 values (geomfromtext("point(1 0)"));
-select * from (select polygon(t1.a) as p from t1 order by t1.a) d;
-drop table t1;
-
-
---echo #
---echo # Test for bug #59888 "debug assertion when attempt to create spatial index
---echo # on char > 31 bytes".
---echo #
-create table t1(a char(32) not null) engine=myisam;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
---error ER_WRONG_ARGUMENTS
-create spatial index i on t1 (a);
-drop table t1;
-
-
-#
-# Bug#11767480 - SPATIAL INDEXES ON NON-SPATIAL COLUMNS CAUSE CRASHES.
-#
-CREATE TABLE t0 (a BINARY(32) NOT NULL);
---error ER_WRONG_ARGUMENTS
-CREATE SPATIAL INDEX i on t0 (a);
-INSERT INTO t0 VALUES (1);
-
---error ER_WRONG_ARGUMENTS
-CREATE TABLE t1(
- col0 BINARY NOT NULL,
- col2 TIMESTAMP,
- SPATIAL INDEX i1 (col0)
-) ENGINE=MyISAM;
-
-# Test other ways to add indices
-CREATE TABLE t1 (
- col0 BINARY NOT NULL,
- col2 TIMESTAMP
-) ENGINE=MyISAM;
-
---error ER_WRONG_ARGUMENTS
-CREATE SPATIAL INDEX idx0 ON t1(col0);
-
---error ER_WRONG_ARGUMENTS
-ALTER TABLE t1 ADD SPATIAL INDEX i1 (col0);
-
-CREATE TABLE t2 (
- col0 INTEGER NOT NULL,
- col1 POINT,
- col2 POINT
-);
-
---error ER_WRONG_ARGUMENTS
-CREATE SPATIAL INDEX idx0 ON t2 (col1, col2);
-
---error ER_WRONG_ARGUMENTS
-CREATE TABLE t3 (
- col0 INTEGER NOT NULL,
- col1 POINT,
- col2 LINESTRING,
- SPATIAL INDEX i1 (col1, col2)
-);
-
-# cleanup
-DROP TABLE t0, t1, t2;
-
-
---echo #
---echo # BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS
---echo #
-SELECT ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20)));
-
---echo #
---echo # BUG#12537203 - CRASH WHEN SUBSELECTING GLOBAL VARIABLES IN
---echo # GEOMETRY FUNCTION ARGUMENTS
---echo #
---replace_regex /non geometric .* value/non geometric '' value/
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT GEOMETRYCOLLECTION((SELECT @@OLD));
-
---echo #
---echo # MDEV-4252 geometry query crashes server
---echo #
-select astext(0x0100000000030000000100000000000010);
-select astext(st_centroid(0x0100000000030000000100000000000010));
-select astext(st_exteriorring(0x0100000000030000000100000000000010));
-select envelope(0x0100000000030000000100000000000010);
-select geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1);
-select geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1);
-
---echo #
---echo # MDEV-4296 Assertion `n_linear_rings > 0' fails in Gis_polygon::centroid_xy
---echo #
-
-SELECT Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) )));
-
---echo #
---echo # MDEV-4295 Server crashes in get_point on a query with Area, AsBinary, MultiPoint
---echo #
-SELECT Area(AsBinary(MultiPoint(Point(0,9), Point(0,1), Point(2,2))));
---echo End of 5.1 tests
-
-#bug 850775 ST_AREA does not work on GEOMETRYCOLLECTIONs in maria-5.3-gis
-select ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'));
-
-#bug 855336 ST_LENGTH does not work on GEOMETRYCOLLECTIONs
-select ST_LENGTH(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 100 30, 20 30), POINT(3 3), LINESTRING(20 20, 30 20))'));
-
-
-# Conformance tests
-#
-# C.3.3 Geometry types and functions
-#
-
---disable_warnings
-DROP DATABASE IF EXISTS gis_ogs;
---enable_warnings
-
-CREATE DATABASE gis_ogs;
-USE gis_ogs;
-
---echo #
---echo # C.3.3.1 Geometry types and functions schema construction
---echo #
-
-# TODO: WL#2377
-#CREATE TABLE spatial_ref_sys (
-#srid INTEGER NOT NULL PRIMARY KEY,
-#auth_name CHARACTER VARYING,
-#auth_srid INTEGER,
-#srtext CHARACTER VARYING(2048));
-
-CREATE TABLE lakes (
- fid INTEGER NOT NULL PRIMARY KEY,
- name CHARACTER VARYING(64),
- shore POLYGON);
-
-CREATE TABLE road_segments (
- fid INTEGER NOT NULL PRIMARY KEY,
- name CHARACTER VARYING(64),
- aliases CHARACTER VARYING(64),
- num_lanes INTEGER,
- centerline LINESTRING);
-
-CREATE TABLE divided_routes (
- fid INTEGER NOT NULL PRIMARY KEY,
- name CHARACTER VARYING(64),
- num_lanes INTEGER,
- centerlines MULTILINESTRING);
-
-CREATE TABLE forests (
- fid INTEGER NOT NULL PRIMARY KEY,
- name CHARACTER VARYING(64),
- boundary MULTIPOLYGON);
-
-CREATE TABLE bridges (
- fid INTEGER NOT NULL PRIMARY KEY,
- name CHARACTER VARYING(64),
- position POINT);
-
-CREATE TABLE streams (
- fid INTEGER NOT NULL PRIMARY KEY,
- name CHARACTER VARYING(64),
- centerline LINESTRING);
-
-CREATE TABLE buildings (
- fid INTEGER NOT NULL PRIMARY KEY,
- address CHARACTER VARYING(64),
- position POINT,
- footprint POLYGON);
-
-CREATE TABLE ponds (
- fid INTEGER NOT NULL PRIMARY KEY,
- name CHARACTER VARYING(64),
- type CHARACTER VARYING(64),
- shores MULTIPOLYGON);
-
-CREATE TABLE named_places (
- fid INTEGER NOT NULL PRIMARY KEY,
- name CHARACTER VARYING(64),
- boundary POLYGON);
-
-CREATE TABLE map_neatlines (
- fid INTEGER NOT NULL PRIMARY KEY,
- neatline POLYGON);
-
---echo #
---echo # C.3.3.2 Geometry types and functions schema data loading
---echo #
-
-# TODO: WL#2377
-#-- Spatial Reference System
-#INSERT INTO spatial_ref_sys VALUES
-#(101, 'POSC', 32214, 'PROJCS["UTM_ZONE_14N",
-#GEOGCS["World Geodetic System 72",
-#DATUM["WGS_72",
-#ELLIPSOID["NWL_10D", 6378135, 298.26]],
-#PRIMEM["Greenwich", 0],
-#UNIT["Meter", 1.0]],
-#PROJECTION["Transverse_Mercator"],
-#PARAMETER["False_Easting", 500000.0],
-#PARAMETER["False_Northing", 0.0],
-#PARAMETER["Central_Meridian", -99.0],
-#PARAMETER["Scale_Factor", 0.9996],
-#PARAMETER["Latitude_of_origin", 0.0],
-#UNIT["Meter", 1.0]]');
-
---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));
-
---echo #
---echo # C.3.3.3 Geometry types and functions schema test queries
---echo
-
-# TODO: WL#2377
-#--echo # Conformance Item T1
-#SELECT f_table_name
-#FROM geometry_columns;
-#
-#--echo # Conformance Item T2
-#SELECT f_geometry_column
-#FROM geometry_columns
-#WHERE f_table_name = 'streams';
-#
-#--echo # Conformance Item T3
-#SELECT coord_dimension
-#FROM geometry_columns
-#WHERE f_table_name = 'streams';
-#
-#--echo # Conformance Item T4
-#
-#SELECT srid
-#FROM geometry_columns
-#WHERE f_table_name = 'streams';
-#
-#--echo # Conformance Item T5
-#
-#SELECT srtext
-#FROM SPATIAL_REF_SYS
-#WHERE SRID = 101;
-#
-
-
---echo # Conformance Item T6
-# TODO: ST_Dimension() alias
-SELECT Dimension(shore)
-FROM lakes
-WHERE name = 'Blue Lake';
-
---echo # Conformance Item T7
-# TODO: ST_GeometryType() alias
-SELECT GeometryType(centerlines)
-FROM divided_routes
-WHERE name = 'Route 75';
-
---echo # Conformance Item T8
-# TODO: ST_AsText() alias
-SELECT AsText(boundary)
-FROM named_places
-WHERE name = 'Goose Island';
-
---echo # Conformance Item T9
-# TODO: ST_AsBinary(), ST_PolyFromWKB() aliases
-SELECT AsText(PolyFromWKB(AsBinary(boundary),101))
-FROM named_places
-WHERE name = 'Goose Island';
-
---echo # Conformance Item T10
-SELECT SRID(boundary)
-FROM named_places
-WHERE name = 'Goose Island';
-
---echo # Conformance Item T11
-SELECT IsEmpty(centerline)
-FROM road_segments
-WHERE name = 'Route 5'
-AND aliases = 'Main Street';
-
---echo # Conformance Item T12
-SELECT IsSimple(shore)
-FROM lakes
-WHERE name = 'Blue Lake';
-
---echo # Conformance Item T13
-SELECT AsText(ST_Boundary(boundary))
-FROM named_places
-WHERE name = 'Goose Island';
-
---echo # Conformance Item T14
-# FIXME: we get anticlockwise, GIS suggests clockwise
-SELECT AsText(Envelope(boundary))
-FROM named_places
-WHERE name = 'Goose Island';
-
---echo # Conformance Item T15
-# TODO: ST_X() alias
-SELECT X(position)
-FROM bridges
-WHERE name = 'Cam Bridge';
-
---echo # Conformance Item T16
-# TODO: ST_Y() alias
-SELECT Y(position)
-FROM bridges
-WHERE name = 'Cam Bridge';
-
---echo # Conformance Item T17
-# TODO: ST_StartPoint() alias
-SELECT AsText(StartPoint(centerline))
-FROM road_segments
-WHERE fid = 102;
-
---echo # Conformance Item T18
-SELECT AsText(EndPoint(centerline))
-FROM road_segments
-WHERE fid = 102;
-
-SELECT IsClosed(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary)))
-FROM named_places
-WHERE name = 'Goose Island';
-
---echo # Conformance Item T20
-SELECT IsRing(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary)))
-FROM named_places
-WHERE name = 'Goose Island';
-
---echo # Conformance Item T21
-SELECT GLength(centerline)
-FROM road_segments
-WHERE fid = 106;
-
---echo # Conformance Item T22
-SELECT NumPoints(centerline)
-FROM road_segments
-WHERE fid = 102;
-
---echo # Conformance Item T23
-SELECT AsText(PointN(centerline, 1))
-FROM road_segments
-WHERE fid = 102;
-
---echo # Conformance Item T24
-SELECT AsText(Centroid(boundary))
-FROM named_places
-WHERE name = 'Goose Island';
-
-SELECT ST_Contains(boundary, PointOnSurface(boundary))
-FROM named_places
-WHERE name = 'Goose Island';
-
---echo # Conformance Item T26
-SELECT Area(boundary)
-FROM named_places
-WHERE name = 'Goose Island';
-
---echo # Conformance Item T27
-SELECT AsText(ExteriorRing(shore))
-FROM lakes
-WHERE name = 'Blue Lake';
-
---echo # Conformance Item T28
-SELECT NumInteriorRings(shore)
-FROM lakes
-WHERE name = 'Blue Lake';
-
---echo # Conformance Item T29
-SELECT AsText(InteriorRingN(shore, 1))
-FROM lakes
-WHERE name = 'Blue Lake';
-
---echo # Conformance Item T30
-SELECT NumGeometries(centerlines)
-FROM divided_routes
-WHERE name = 'Route 75';
-
---echo # Conformance Item T31
-SELECT AsText(GeometryN(centerlines, 2))
-FROM divided_routes
-WHERE name = 'Route 75';
-
---echo # Conformance Item T32
-SELECT IsClosed(centerlines)
-FROM divided_routes
-WHERE name = 'Route 75';
-
---echo # Conformance Item T33
-SELECT GLength(centerlines)
-FROM divided_routes
-WHERE name = 'Route 75';
-
---echo # Conformance Item T34
-SELECT AsText(Centroid(shores))
-FROM ponds
-WHERE fid = 120;
-
-# TODO: WL#2377
---echo # Conformance Item T35
-SELECT Contains(shores, PointOnSurface(shores))
-FROM ponds
-WHERE fid = 120;
-
---echo # Conformance Item T36
-SELECT Area(shores)
-FROM ponds
-WHERE fid = 120;
-
---echo # Conformance Item T37
-SELECT ST_Equals(boundary,
-PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
-FROM named_places
-WHERE name = 'Goose Island';
-
---echo # Conformance Item T38
-SELECT ST_Disjoint(centerlines, boundary)
-FROM divided_routes, named_places
-WHERE divided_routes.name = 'Route 75'
-AND named_places.name = 'Ashton';
-
---echo # Conformance Item T39
-SELECT ST_Touches(centerline, shore)
-FROM streams, lakes
-WHERE streams.name = 'Cam Stream'
-AND lakes.name = 'Blue Lake';
-
---echo # Conformance Item T40
-SELECT ST_Within(footprint, boundary)
-FROM named_places, buildings
-WHERE named_places.name = 'Ashton'
-AND buildings.address = '215 Main Street';
-
---echo # Conformance Item T41
-SELECT ST_Overlaps(forests.boundary, named_places.boundary)
-FROM forests, named_places
-WHERE forests.name = 'Green Forest'
-AND named_places.name = 'Ashton';
-
---echo # Conformance Item T42
-SELECT Crosses(road_segments.centerline, divided_routes.centerlines)
-FROM road_segments, divided_routes
-WHERE road_segments.fid = 102
-AND divided_routes.name = 'Route 75';
-
---echo # Conformance Item T43
-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';
-
---echo # Conformance Item T44
-SELECT ST_Contains(forests.boundary, named_places.boundary)
-FROM forests, named_places
-WHERE forests.name = 'Green Forest'
-AND named_places.name = 'Ashton';
-
---echo # Conformance Item T45
-SELECT ST_Relate(forests.boundary, named_places.boundary, 'TTTTTTTTT')
-FROM forests, named_places
-WHERE forests.name = 'Green Forest'
-AND named_places.name = 'Ashton';
-
---echo # Conformance Item T46
-SELECT ST_Distance(position, boundary)
-FROM bridges, named_places
-WHERE bridges.name = 'Cam Bridge'
-AND named_places.name = 'Ashton';
-
---echo # Conformance Item T47
-SELECT AsText(ST_Intersection(centerline, shore))
-FROM streams, lakes
-WHERE streams.name = 'Cam Stream'
-AND lakes.name = 'Blue Lake';
-
---echo # Conformance Item T48
-SELECT AsText(ST_Difference(named_places.boundary, forests.boundary))
-FROM named_places, forests
-WHERE named_places.name = 'Ashton'
-AND forests.name = 'Green Forest';
-
-#--echo # Conformance Item T49
-SELECT AsText(ST_Union(shore, boundary))
-FROM lakes, named_places
-WHERE lakes.name = 'Blue Lake'
-AND named_places.name = 'Goose Island';
-
---echo # Conformance Item T50
-SELECT AsText(ST_SymDifference(shore, boundary))
-FROM lakes, named_places
-WHERE lakes.name = 'Blue Lake'
-AND named_places.name = 'Ashton';
-
---echo # Conformance Item T51
-SELECT count(*)
-FROM buildings, bridges
-WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
-
---echo # Conformance Item T52
-SELECT AsText(ConvexHull(shore))
-FROM lakes
-WHERE lakes.name = 'Blue Lake';
-
-DROP DATABASE gis_ogs;
-USE test;
-
---echo #
---echo # BUG #1043845 st_distance() results are incorrect depending on variable order
---echo #
-
-select st_distance(geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
- -95.9673057475387 36.1344478941074,
- -95.9673063519371 36.134484524621,
- -95.9673049102515 36.1343976584193)'),
- geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)')) ;
-select st_distance(geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)'),
- geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
- -95.9673057475387 36.1344478941074,
- -95.9673063519371 36.134484524621,
- -95.9673049102515 36.1343976584193) ')) ;
-
---echo #
---echo # MDEV-4310 geometry function equals hangs forever.
---echo #
-create table t1(a geometry not null)engine=myisam;
-insert into t1 values(geomfromtext("POINT(0 0)"));
-insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)"));
-insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)"));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-select equals(`a`,convert(`a` using utf8)) from `t1`;
-select equals(`a`,left(`a`,23)) from `t1`;
-drop table t1;
-
---echo #
---echo # MDEV-6883 ST_WITHIN crashes server if (0,0) is matched to POLYGON((0 0))
---echo #
-select st_within(GeomFromText('Polygon((0 0))'), Point(0,0));
-
---echo End of 5.3 tests
-
---echo #
---echo # Bug#11908153: CRASH AND/OR VALGRIND ERRORS IN FIELD_BLOB::GET_KEY_IMAGE
---echo #
-
-CREATE TABLE g1
-(a geometry NOT NULL, UNIQUE KEY i (a(151))) engine=myisam;
-
-INSERT INTO g1 VALUES (geomfromtext('point(1 1)'));
-INSERT INTO g1 VALUES (geomfromtext('point(1 2)'));
-
-FLUSH TABLES;
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT 1 FROM g1
-FORCE INDEX(i) WHERE a = date_sub(now(), interval 2808.4 year_month)
-;
-
-DROP TABLE g1;
-
---echo #
---echo # Bug#13013970 MORE CRASHES IN FIELD_BLOB::GET_KEY_IMAGE
---echo #
-
-CREATE TABLE g1(a TEXT NOT NULL, KEY(a(255)));
-
-INSERT INTO g1 VALUES ('a'),('a');
-SELECT 1 FROM g1 WHERE a >= ANY
-(SELECT 1 FROM g1 WHERE a = geomfromtext('') OR a) ;
-
-DROP TABLE g1;
-
---echo #
---echo # Bug#16451878 GEOMETRY QUERY CRASHES SERVER
---echo #
-
---echo # should not crash
-SELECT ASTEXT(0x0100000000030000000100000000000010);
-
---echo #should not crash
-SELECT ENVELOPE(0x0100000000030000000100000000000010);
-
---echo #should not crash
-SELECT
- GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffff0000, 1);
-
---echo #should not crash
-SELECT
- GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1);
-
---echo #
---echo # MDEV-3819 missing constraints for spatial column types
---echo #
-
-create table t1 (pt point);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-insert into t1 values(Geomfromtext('POLYGON((1 1, 2 2, 2 1, 1 1))'));
-drop table t1;
-
-#
-# MDEV-7516 Assertion `!cur_p->event' failed in Gcalc_scan_iterator::arrange_event(int, int)
-#
-SELECT st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100));
-
-#
-# MDEV-7779 View definition changes upon creation
-#
-CREATE VIEW v1 AS SELECT POINT(1,1) AS p;
-SHOW CREATE VIEW v1;
-SELECT ASTEXT(p) FROM v1;
-DROP VIEW v1;
-
-# --echo End of 5.5 tests
-
---echo #
---echo # Start of 10.0 tests
---echo #
-
---echo #
---echo # MDEV-12495 Conditional jump depends on uninitialised value for: SELECT NULL UNION geom_expression
---echo #
-SELECT AsText(g) FROM (SELECT NULL AS g UNION SELECT Point(1,1)) AS t1;
-
---echo #
---echo # MDEV-10306 Wrong results with combination of CONCAT, SUBSTR and CONVERT in subquery
---echo #
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='derived_merge=on';
-CREATE TABLE t1 (x INT, y INT);
-INSERT INTO t1 VALUES(0,0);
-SELECT LENGTH(t2) c2 FROM (SELECT ST_BUFFER(POINT(x,y), 0) t2 FROM t1) sub;
-SELECT LENGTH(CONCAT(t2,'-',t2)) c2 FROM (SELECT ST_BUFFER(POINT(x,y), 0) t2 FROM t1) sub;
-SELECT LENGTH(CONCAT(t2,'--',t2)) c2 FROM (SELECT ST_BUFFER(POINT(x,y), 0) t2 FROM t1) sub;
-DROP TABLE t1;
-SET optimizer_switch=@save_optimizer_switch;
-
-
---echo #
---echo # End 10.0 tests
---echo #
-
-SHOW CREATE TABLE information_schema.geometry_columns;
-SHOW CREATE TABLE information_schema.spatial_ref_sys;
-
-create table t1(g GEOMETRY, pt POINT);
-create table t2(g LINESTRING, pl POLYGON);
---sorted_result
-select * from information_schema.geometry_columns where f_table_schema='test';
-drop table t1, t2;
-
---echo 10.1 tests
-create table t1(g GEOMETRY(9,4) REF_SYSTEM_ID=101, pt POINT(8,2), pg GEOMETRY REF_SYSTEM_ID=102);
-SELECT SRID from information_schema.geometry_columns WHERE f_table_schema='test' and G_TABLE_NAME='t1';
-drop table t1;
-
--- echo # Expect an int(1) column to be created
-CREATE TABLE t1 AS SELECT CONTAINS(NULL, NULL);
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-7334 valgrind warning "unitialized bytes" in 10.1.
---echo #
-CREATE TABLE t1 (
- gp point,
- ln linestring,
- pg polygon,
- mp multipoint,
- mln multilinestring,
- mpg multipolygon,
- gc geometrycollection,
- gm geometry
-);
-ALTER TABLE t1 ADD fid INT NOT NULL;
-select SRID from information_schema.geometry_columns where F_TABLE_NAME='t1';
-drop table t1;
-
---echo #
---echo # MDEV-7510 GIS: IsRing returns false for a primitive triangle.
---echo #
-select ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,0 0)'));
-select ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,-10 -10, 0 -10, 0 0)'));
-
---echo #
---echo # MDEV-7514 GIS: PointOnSurface returns NULL instead of the point.
---echo #
-SELECT ST_GEOMETRYTYPE(ST_PointOnSurface(ST_PolyFromText('POLYGON((-70.916 42.1002,-70.9468 42.0946,-70.9754 42.0875,-70.9749 42.0879,-70.9759 42.0897,-70.916 42.1002))')));
-
---echo #
---echo # MDEV-7529 GIS: ST_Relate returns unexpected results for POINT relations
---echo #
-select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'T*F**FFF*') AS equals;
-select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'T*****FF*') AS contains;
-select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'T*F**F***') AS within;
-select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(1 1)'),'FF*FF****') as disjoint;
-select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'FF*FF****') as disjoint;
-
-
---echo #
---echo # MDEV-7528 GIS: Functions return NULL instead of specified -1 for NULL arguments.
---echo #
-
-select ST_IsRing(NULL);
-
---echo #
---echo # MDEV-8675 Different results of GIS functions on NULL vs NOT NULL columns
---echo #
-CREATE TABLE t1 (g1 GEOMETRY NOT NULL,g2 GEOMETRY NULL);
-CREATE TABLE t2 AS SELECT WITHIN(g1,g1) as w1,WITHIN(g2,g2) AS w2 FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t1,t2;
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
-#
-# Item_func_spatial_collection::print()
-#
-create view v1 as select AsWKT(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9))));
-show create view v1;
-select * from v1;
-drop view v1;
-
---echo #
---echo # MDEV-10134 Add full support for DEFAULT
---echo #
-
-CREATE TABLE t1 (a POINT, x DOUBLE DEFAULT x(a), y DOUBLE DEFAULT y(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (Point(1,2));
-SELECT x,y FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (g GEOMETRY, area DOUBLE DEFAULT ST_AREA(g));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (g) VALUES (GeomFromText('POLYGON((0 0,20 0,20 20,0 20,0 0))'));
-SELECT area FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (g GEOMETRY, length DOUBLE DEFAULT ST_LENGTH(g));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (g) VALUES (GeomFromText('LINESTRING(0 0,20 0,20 20,0 20,0 0)'));
-SELECT length FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (g POINT, distance DOUBLE DEFAULT ST_DISTANCE(g, POINT(0,0)));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (g) VALUES (Point(1,0));
-SELECT distance FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a TEXT, g GEOMETRY DEFAULT GeomFromText(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('point(1 1)');
-SELECT AsText(g) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (x INT, y INT, g GEOMETRY DEFAULT POINT(x,y));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (x,y) VALUES (10,20);
-SELECT AsText(g) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT PointN(a,2));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,2 2,3 3)'));
-SELECT AsText(b) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT StartPoint(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,2 2,3 3)'));
-SELECT AsText(b) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c GEOMETRY DEFAULT GeometryCollection(a,b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a,b) VALUES (Point(1,1), Point(2,2));
-SELECT AsText(c) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT GeomFromWKB(AsBinary(a),20));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (GeomFromText('POINT(1 1)', 10));
-SELECT AsText(a), SRID(a), AsText(b), SRID(b) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT BOUNDARY(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))'));
-SELECT AsText(b) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT BUFFER(a,10));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))'));
-SELECT GeometryType(b) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT CENTROID(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))'));
-SELECT AsText(b) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT ENVELOPE(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,4 4)'));
-SELECT AsText(b) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT PointOnSurface(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))'));
-SELECT GeometryType(b) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT Point(1,1), c GEOMETRY DEFAULT ST_UNION(a,b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (Point(0,0));
-SELECT AsText(c) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a GEOMETRY, b VARCHAR(20) DEFAULT GeometryType(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (Point(0, 0));
-SELECT b FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsSimple(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (Point(0, 0));
-SELECT b FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsEmpty(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (Point(0, 0));
-SELECT b FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsRing(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (GeomFromText('LineString(0 0,0 1,1 1,1 0,0 0)'));
-SELECT b FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsClosed(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (GeomFromText('LineString(0 0,0 1,1 1,1 0,0 0)'));
-SELECT b FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT Dimension(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (Buffer(Point(1,1),1));
-SELECT b FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT NumGeometries(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (ST_UNION(Point(1,1),Point(0,0)));
-SELECT b FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT NumInteriorRings(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))'));
-SELECT b FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT NumPoints(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (LineString(Point(1,1),Point(0,0)));
-SELECT b FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT SRID(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (GeomFromText('Point(1 1)', 100));
-SELECT b FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c INT DEFAULT MBRDisjoint(a,b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1));
-SELECT c FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c INT DEFAULT ST_Disjoint(a,b));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1));
-SELECT c FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c INT DEFAULT ST_Relate(a,b,'T*F**FFF*'));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1));
-SELECT c FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Start of 10.3 tests
---echo #
-
---echo #
---echo # MDEV-11478 Result data type aggregation for pluggable data types
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p2(query TEXT)
-BEGIN
- DECLARE errcount INT DEFAULT 0;
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
- BEGIN
- SET errcount = errcount+1;
- #SHOW WARNINGS;
- GET DIAGNOSTICS CONDITION 1 @p= MESSAGE_TEXT;
- SELECT @p AS `ERROR: `;
- END;
- SELECT query AS ``;
- EXECUTE IMMEDIATE query;
- IF errcount = 0
- THEN
- SHOW CREATE TABLE t2;
- DROP TABLE t2;
- END IF;
-END;
-$$
-CREATE PROCEDURE p1(query TEXT)
-BEGIN
- SELECT query AS `-------------------------------------`;
- EXECUTE IMMEDIATE query;
- CALL p2('CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1');
- CALL p2('CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1');
- CALL p2('CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1');
- CALL p2('CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1');
- CALL p2('CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1');
- DROP TABLE t1;
-END;
-$$
-DELIMITER ;$$
-
---disable_query_log
-CALL p1('CREATE TABLE t1 (a CHAR(10), b Point)');
-CALL p1('CREATE TABLE t1 (a VARCHAR(10), b Point)');
-CALL p1('CREATE TABLE t1 (a TINYTEXT, b Point)');
-CALL p1('CREATE TABLE t1 (a TEXT, b Point)');
-CALL p1('CREATE TABLE t1 (a MEDIUMTEXT, b Point)');
-CALL p1('CREATE TABLE t1 (a LONGTEXT, b Point)');
-
-CALL p1('CREATE TABLE t1 (a TINYINT, b Point)');
-CALL p1('CREATE TABLE t1 (a SMALLINT, b Point)');
-CALL p1('CREATE TABLE t1 (a MEDIUMINT, b Point)');
-CALL p1('CREATE TABLE t1 (a INT, b Point)');
-CALL p1('CREATE TABLE t1 (a BIGINT, b Point)');
-CALL p1('CREATE TABLE t1 (a FLOAT, b Point)');
-CALL p1('CREATE TABLE t1 (a DOUBLE, b Point)');
-CALL p1('CREATE TABLE t1 (a DECIMAL(10,2), b Point)');
-CALL p1('CREATE TABLE t1 (a BIT(8), b Point)');
-
-CALL p1('CREATE TABLE t1 (a TIME, b Point)');
-CALL p1('CREATE TABLE t1 (a DATE, b Point)');
-CALL p1('CREATE TABLE t1 (a DATETIME, b Point)');
-CALL p1('CREATE TABLE t1 (a TIMESTAMP, b Point)');
-CALL p1('CREATE TABLE t1 (a YEAR, b Point)');
-
---echo # This creates BLOB with hybrid functions, but fails on error with UNION (MDEV-11458)
-CALL p1('CREATE TABLE t1 (a ENUM(0x61), b Point)');
-CALL p1('CREATE TABLE t1 (a SET(0x61), b Point)');
---enable_query_log
-
-CREATE TABLE t1 AS SELECT COALESCE(NULL, Point(1,1));
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-CREATE TABLE t1 AS SELECT NULL UNION SELECT Point(1,1);
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-DROP PROCEDURE p1;
-DROP PROCEDURE p2;
-
-
---echo #
---echo # MDEV-11692 Comparison data type aggregation for pluggable data types
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p2(query TEXT)
-BEGIN
- DECLARE errcount INT DEFAULT 0;
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
- BEGIN
- SET errcount = errcount+1;
- GET DIAGNOSTICS CONDITION 1 @p= MESSAGE_TEXT;
- SELECT @p AS `ERROR: `;
- END;
- SELECT query AS ``;
- EXECUTE IMMEDIATE query;
-END;
-$$
-CREATE PROCEDURE p1(query TEXT)
-BEGIN
- SELECT query AS `-------------------------------------`;
- EXECUTE IMMEDIATE query;
- CALL p2('SELECT a=b FROM t1');
- CALL p2('SELECT b=a FROM t1');
- CALL p2('SELECT a BETWEEN b AND c FROM t1');
- CALL p2('SELECT a IN (b,c) FROM t1');
- CALL p2('SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1');
- CALL p2('SELECT a=POINT(1,1) FROM t1');
- CALL p2('SELECT POINT(1,1)=a FROM t1');
- CALL p2('SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1');
- CALL p2('SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1');
- CALL p2('SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1');
- DROP TABLE t1;
-END;
-$$
-DELIMITER ;$$
-
-CALL p1('CREATE TABLE t1 (a CHAR(10), b Point, c Point)');
-CALL p1('CREATE TABLE t1 (a VARCHAR(10), b Point, c Point)');
-CALL p1('CREATE TABLE t1 (a TINYTEXT, b Point, c Point)');
-CALL p1('CREATE TABLE t1 (a TEXT, b Point, c Point)');
-CALL p1('CREATE TABLE t1 (a MEDIUMTEXT, b Point, c Point)');
-CALL p1('CREATE TABLE t1 (a LONGTEXT, b Point, c Point)');
-CALL p1('CREATE TABLE t1 (a ENUM("a","b"), b Point, c Point)');
-
-CALL p1('CREATE TABLE t1 (a TINYINT, b Point, c Point)');
-CALL p1('CREATE TABLE t1 (a SMALLINT, b Point, c Point)');
-CALL p1('CREATE TABLE t1 (a MEDIUMINT, b Point, c Point)');
-CALL p1('CREATE TABLE t1 (a INT, b Point, c Point)');
-CALL p1('CREATE TABLE t1 (a BIGINT, b Point, c Point)');
-CALL p1('CREATE TABLE t1 (a FLOAT, b Point, c Point)');
-CALL p1('CREATE TABLE t1 (a DOUBLE, b Point, c Point)');
-CALL p1('CREATE TABLE t1 (a DECIMAL(10,2), b Point, c Point)');
-CALL p1('CREATE TABLE t1 (a BIT(8), b Point, c Point)');
-
-CALL p1('CREATE TABLE t1 (a TIME, b Point, c Point)');
-CALL p1('CREATE TABLE t1 (a DATE, b Point, c Point)');
-CALL p1('CREATE TABLE t1 (a DATETIME, b Point, c Point)');
-CALL p1('CREATE TABLE t1 (a TIMESTAMP, b Point, c Point)');
-CALL p1('CREATE TABLE t1 (a YEAR, b Point, c Point)');
-
-CALL p1('CREATE TABLE t1 (a Point, b Point, c Point)');
-
-
-DROP PROCEDURE p1;
-DROP PROCEDURE p2;
-
-
---echo #
---echo # MDEV-12506 Split Item_func_min_max::fix_length_and_dec() into methods in Type_handler
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p2(query TEXT)
-BEGIN
- DECLARE errcount INT DEFAULT 0;
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
- BEGIN
- SET errcount = errcount+1;
- #SHOW WARNINGS;
- GET DIAGNOSTICS CONDITION 1 @p= MESSAGE_TEXT;
- SELECT @p AS `ERROR: `;
- END;
- SELECT query AS ``;
- EXECUTE IMMEDIATE query;
- IF errcount = 0
- THEN
- SHOW CREATE TABLE t2;
- DROP TABLE t2;
- END IF;
-END;
-$$
-CREATE PROCEDURE p1(query TEXT)
-BEGIN
- SELECT query AS `-------------------------------------`;
- EXECUTE IMMEDIATE query;
- CALL p2('CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1');
- DROP TABLE t1;
-END;
-$$
-DELIMITER ;$$
-
---disable_query_log
-CALL p1('CREATE TABLE t1 (a CHAR(10), b Point)');
-CALL p1('CREATE TABLE t1 (a VARCHAR(10), b Point)');
-CALL p1('CREATE TABLE t1 (a TINYTEXT, b Point)');
-CALL p1('CREATE TABLE t1 (a TEXT, b Point)');
-CALL p1('CREATE TABLE t1 (a MEDIUMTEXT, b Point)');
-CALL p1('CREATE TABLE t1 (a LONGTEXT, b Point)');
-
-CALL p1('CREATE TABLE t1 (a TINYINT, b Point)');
-CALL p1('CREATE TABLE t1 (a SMALLINT, b Point)');
-CALL p1('CREATE TABLE t1 (a MEDIUMINT, b Point)');
-CALL p1('CREATE TABLE t1 (a INT, b Point)');
-CALL p1('CREATE TABLE t1 (a BIGINT, b Point)');
-CALL p1('CREATE TABLE t1 (a FLOAT, b Point)');
-CALL p1('CREATE TABLE t1 (a DOUBLE, b Point)');
-CALL p1('CREATE TABLE t1 (a DECIMAL(10,2), b Point)');
-CALL p1('CREATE TABLE t1 (a BIT(8), b Point)');
-
-CALL p1('CREATE TABLE t1 (a TIME, b Point)');
-CALL p1('CREATE TABLE t1 (a DATE, b Point)');
-CALL p1('CREATE TABLE t1 (a DATETIME, b Point)');
-CALL p1('CREATE TABLE t1 (a TIMESTAMP, b Point)');
-CALL p1('CREATE TABLE t1 (a YEAR, b Point)');
-
---echo # This LEAST(ENUM,GEOMETRY) creates BLOB, but fails on error with UNION (see MDEV-12503)
-CALL p1('CREATE TABLE t1 (a ENUM(0x61), b Point)');
-CALL p1('CREATE TABLE t1 (a SET(0x61), b Point)');
---enable_query_log
-
-CREATE TABLE t1 AS SELECT LEAST(NULL, Point(1,1));
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-DROP PROCEDURE p1;
-DROP PROCEDURE p2;
-
---echo #
---echo # MDEV-12001 Split Item_func_round::fix_length_and_dec to virtual methods in Type_handler
---echo #
-
-CREATE TABLE t1 (a GEOMETRY);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ROUND(a) FROM t1;
-DROP TABLE t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ROUND(POINT(1,1));
-
-
---echo #
---echo # MDEV-12199 Split Item_func_{abs|neg|int_val}::fix_length_and_dec() into methods in Type_handler
---echo #
-
-CREATE TABLE t1 (a GEOMETRY);
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT -a FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ABS(a) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CEILING(a) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT FLOOR(a) FROM t1;
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT -COALESCE(a) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ABS(COALESCE(a)) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CEILING(COALESCE(a)) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT FLOOR(COALESCE(a)) FROM t1;
-DROP TABLE t1;
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT -POINT(1,1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ABS(POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CEILING(POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT FLOOR(POINT(1,1));
-
-
---echo #
---echo # MDEV-12239 Add Type_handler::Item_sum_{sum|avg|variance}_fix_length_and_dec()
---echo #
-
-CREATE TABLE t1 (a GEOMETRY);
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT SUM(POINT(1,1)) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT SUM(a) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT SUM(COALESCE(a)) FROM t1;
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT AVG(POINT(1,1)) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT AVG(a) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT AVG(COALESCE(a)) FROM t1;
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT VARIANCE(POINT(1,1)) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT VARIANCE(a) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT VARIANCE(COALESCE(a)) FROM t1;
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT STDDEV(POINT(1,1)) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT STDDEV(a) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT STDDEV(COALESCE(a)) FROM t1;
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-12303 Add Type_handler::Item_xxx_fix_length_and_dec() for CAST classes
---echo #
-
-CREATE TABLE t1 (a GEOMETRY);
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CAST(POINT(1,1) AS SIGNED) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CAST(POINT(1,1) AS UNSIGNED) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CAST(POINT(1,1) AS DOUBLE) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CAST(POINT(1,1) AS DECIMAL(10,1)) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CAST(POINT(1,1) AS CHAR) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CAST(POINT(1,1) AS TIME) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CAST(POINT(1,1) AS DATE) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CAST(POINT(1,1) AS DATETIME) FROM t1;
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CAST(a AS SIGNED) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CAST(a AS UNSIGNED) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CAST(a AS DOUBLE) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CAST(a AS DECIMAL(10,1)) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CAST(a AS CHAR) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CAST(a AS TIME) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CAST(a AS DATE) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CAST(a AS DATETIME) FROM t1;
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CAST(COALESCE(a) AS SIGNED) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CAST(COALESCE(a) AS UNSIGNED) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CAST(COALESCE(a) AS DOUBLE) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CAST(COALESCE(a) AS DECIMAL(10,1)) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CAST(COALESCE(a) AS CHAR) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CAST(COALESCE(a) AS TIME) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CAST(COALESCE(a) AS DATE) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CAST(COALESCE(a) AS DATETIME) FROM t1;
-
-# CAST from GEOMETRY to BINARY is OK
-SELECT LENGTH(CAST(POINT(1,1) AS BINARY)) FROM t1;
-SELECT LENGTH(CAST(a AS BINARY)) FROM t1;
-SELECT LENGTH(CAST(COALESCE(a) AS BINARY)) FROM t1;
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-12238 Add Type_handler::Item_func_{plus|minus|mul|div|mod}_fix_length_and_dec()
---echo #
-
-CREATE TABLE t1 (a GEOMETRY);
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT POINT(1,1) + 1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT POINT(1,1) - 1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT POINT(1,1) * 1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT POINT(1,1) / 1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT POINT(1,1) MOD 1;
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT 1 + POINT(1,1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT 1 - POINT(1,1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT 1 * POINT(1,1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT 1 / POINT(1,1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT 1 MOD POINT(1,1);
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT a + 1 FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT a - 1 FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT a * 1 FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT a / 1 FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT a MOD 1 FROM t1;
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT 1 + a FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT 1 - a FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT 1 * a FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT 1 / a FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT 1 MOD a FROM t1;
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT COALESCE(a) + 1 FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT COALESCE(a) - 1 FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT COALESCE(a) * 1 FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT COALESCE(a) / 1 FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT COALESCE(a) MOD 1 FROM t1;
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT 1 + COALESCE(a) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT 1 - COALESCE(a) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT 1 * COALESCE(a) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT 1 / COALESCE(a) FROM t1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT 1 MOD COALESCE(a) FROM t1;
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-12514 Split Item_temporal_func::fix_length_and_dec()
---echo #
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT DATE_ADD(POINT(1,1), INTERVAL 10 DAY);
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT DATE_SUB(POINT(1,1), INTERVAL 10 DAY);
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT POINT(1,1) + INTERVAL 10 DAY;
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT POINT(1,1) - INTERVAL 10 DAY;
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT INTERVAL 10 DAY + POINT(1,1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT INTERVAL 10 DAY + POINT(1,1);
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT ADDTIME(POINT(1,1), '10:10:10');
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT ADDTIME('10:10:10', POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT ADDTIME(POINT(1,1), TIME'10:10:10');
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT ADDTIME(TIME'10:10:10', POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT ADDTIME(POINT(1,1), TIMESTAMP'2001-01-01 10:10:10');
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT ADDTIME(TIMESTAMP'2001-01-01 10:10:10', POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT STR_TO_DATE(POINT(1,1),'%M %d,%Y');
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT STR_TO_DATE('2001-01-01', POINT(1,1));
-
---echo #
---echo # MDEV-12665 Hybrid functions do not preserve geometry type
---echo #
-
-CREATE TABLE t1 AS SELECT
- Point(0,0) AS p0,
- COALESCE(Point(0,0)) AS p1,
- CASE WHEN 0 THEN Point(0,0) ELSE Point(1,1) END AS p2;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 AS SELECT LEAST(Point(0,0),Point(0,0)) AS p1;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (
- c_geometry GEOMETRY,
- c_point POINT,
- c_linestring LINESTRING,
- c_polygon POLYGON,
- c_multipoint MULTIPOINT,
- c_multilinestring MULTILINESTRING,
- c_multipolygon MULTIPOLYGON,
- c_geometrycollection GEOMETRYCOLLECTION
-);
-
-CREATE TABLE t2 AS SELECT
- COALESCE(NULL, c_geometry),
- COALESCE(NULL, c_point),
- COALESCE(NULL, c_linestring),
- COALESCE(NULL, c_polygon),
- COALESCE(NULL, c_multipoint),
- COALESCE(NULL, c_multilinestring),
- COALESCE(NULL, c_multipolygon),
- COALESCE(NULL, c_geometrycollection)
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE TABLE t2 AS SELECT
- COALESCE(c_geometry, NULL),
- COALESCE(c_point, NULL),
- COALESCE(c_linestring, NULL),
- COALESCE(c_polygon, NULL),
- COALESCE(c_multipoint, NULL),
- COALESCE(c_multilinestring, NULL),
- COALESCE(c_multipolygon, NULL),
- COALESCE(c_geometrycollection, NULL)
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE TABLE t2 AS SELECT
- COALESCE(c_geometry, c_geometry),
- COALESCE(c_point, c_point),
- COALESCE(c_linestring, c_linestring),
- COALESCE(c_polygon, c_polygon),
- COALESCE(c_multipoint, c_multipoint),
- COALESCE(c_multilinestring, c_multilinestring),
- COALESCE(c_multipolygon, c_multipolygon),
- COALESCE(c_geometrycollection, c_geometrycollection)
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-12560 Wrong data type for SELECT NULL UNION SELECT Point(1,1)
---echo #
-
-CREATE TABLE t1 AS SELECT NULL AS c1 UNION SELECT POINT(1,1);
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-DELIMITER $$;
-CREATE PROCEDURE p1(name TEXT)
-BEGIN
- EXECUTE IMMEDIATE CONCAT('CREATE TABLE t1 (a ', name, ')');
- CREATE TABLE t2 AS
- SELECT a AS a1, a AS a2, NULL AS a3 FROM t1 UNION
- SELECT a AS a1, NULL AS a2, a AS a3 FROM t1;
- SHOW CREATE TABLE t2;
- DROP TABLE t2;
- DROP TABLE t1;
-END;
-$$
-DELIMITER ;$$
-CALL p1('geometry');
-CALL p1('point');
-CALL p1('linestring');
-CALL p1('polygon');
-CALL p1('multipoint');
-CALL p1('multilinestring');
-CALL p1('multipolygon');
-CALL p1('geometrycollection');
-DROP PROCEDURE p1;
-
---echo #
---echo # MDEV-12798 Item_param does not preserve exact field type in EXECUTE IMMEDIATE 'CREATE TABLE AS SELECT ?' USING POINT(1,1)
---echo #
-EXECUTE IMMEDIATE 'CREATE TABLE t1 AS SELECT ?' USING POINT(1,1);
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-PREPARE stmt FROM 'CREATE OR REPLACE TABLE t1 AS SELECT ?';
-EXECUTE stmt USING POINT(1,1);
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
---echo #
-
---enable_metadata
---disable_ps_protocol
-SELECT
- ST_ISSIMPLE(POINT(1,1)),
- ST_ISRING(POINT(1,1)),
- ST_ISCLOSED(POINT(1,1)),
- ST_DIMENSION(POINT(1,1)),
- ST_NUMGEOMETRIES(POINT(1,1)),
- ST_NUMINTERIORRINGS(POINT(1,1)),
- ST_NUMPOINTS(POINT(1,1)),
- ST_SRID(POINT(1,1));
---enable_ps_protocol
---disable_metadata
-
-
---echo #
---echo # MDEV-12803 Improve function parameter data type control
---echo #
-
---echo #
---echo # Item_geometry_func_args_geometry
---echo #
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_CENTROID(1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_ENVELOPE(1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_BOUNDARY(1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_STARTPOINT(1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_POINTONSURFACE(1);
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_POINTN(1,1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_POINTN(LineString(Point(1,1)),Point(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_BUFFER(1, 1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_BUFFER(Point(1,1), Point(1,1));
-
-
-PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_ENVELOPE(?) AS g';
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-EXECUTE stmt USING 1;
-EXECUTE stmt USING POINT(1,1);
-SHOW CREATE TABLE t1;
-SELECT ST_ASTEXT(g) FROM t1;
-DROP TABLE t1;
-DEALLOCATE PREPARE stmt;
-
-PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_BUFFER(?,?) AS g';
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-EXECUTE stmt USING 1,1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-EXECUTE stmt USING POINT(1,1),POINT(1,1);
-EXECUTE stmt USING POINT(1,1),0;
-SHOW CREATE TABLE t1;
-SELECT ST_GEOMETRYTYPE(g) FROM t1;
-DROP TABLE t1;
-DEALLOCATE PREPARE stmt;
-
---echo #
---echo # Functions created GEOMETRY from non-GEOMETRY
---echo #
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_GEOMETRYFROMTEXT(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_GEOMETRYFROMTEXT(Point(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_GEOMETRYFROMTEXT(Point(1,1), 1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_GEOMETRYFROMTEXT('test', Point(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_GEOMETRYFROMWKB(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_GEOMETRYFROMWKB(1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_GEOMETRYFROMWKB(1, 1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_GEOMETRYFROMWKB(Point(1,1), Point(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_GEOMFROMGEOJSON(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_GEOMFROMGEOJSON(1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_GEOMFROMGEOJSON(1,1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_GEOMFROMGEOJSON(Point(1,1), Point(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT POINT(ROW(1,1),1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT POINT(POINT(1,1),1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT POINT(1,ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT POINT(1,POINT(1,1));
-
-
-PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_GEOMFROMTEXT(?,?) AS g';
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-EXECUTE stmt USING 1,1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-EXECUTE stmt USING POINT(1,1),POINT(1,1);
-EXECUTE stmt USING 'POINT(1 1)',1;
-SHOW CREATE TABLE t1;
-SELECT ST_ASTEXT(g), SRID(g) FROM t1;
-DROP TABLE t1;
-DEALLOCATE PREPARE stmt;
-
-
-
---echo # Item_func_spatial_collection
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT GEOMETRYCOLLECTION(ROW(1,1), POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT GEOMETRYCOLLECTION(POINT(1,1), ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT GEOMETRYCOLLECTION(1, POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT GEOMETRYCOLLECTION(POINT(1,1), 1);
-
---echo # Item_func_spatial_operation
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_UNION(ROW(1,1), POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_UNION(POINT(1,1), ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_UNION(1, POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_UNION(POINT(1,1), 1);
-
---echo # Item_binary_func_args_geometry
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_ASWKB(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_ASWKB(1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_ASWKB('test');
-
-
---echo # Item_real_func_args_geometry
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_X(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_X(1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_X('test');
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_Y(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_Y(1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_Y('test');
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_AREA(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_AREA(1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_AREA('test');
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_LENGTH(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_LENGTH(1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_LENGTH('test');
-
-
---echo # Item_real_func_geometry_args_geometry_geometry
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_DISTANCE(ROW(1,1), 1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_DISTANCE(1, 1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_DISTANCE('test', 1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_DISTANCE(POINT(1,1), ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_DISTANCE(POINT(1,1), 1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_DISTANCE(POINT(1,1), 'test');
-
-
---echo # Item_int_func_args_geometry
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_ISSIMPLE(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_ISSIMPLE(1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_ISSIMPLE('test');
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_ISRING(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_ISRING(1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_ISRING('test');
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_ISCLOSED(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_ISCLOSED(1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_ISCLOSED('test');
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_DIMENSION(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_DIMENSION(1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_DIMENSION('test');
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_NUMGEOMETRIES(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_NUMGEOMETRIES(1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_NUMGEOMETRIES('test');
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_NUMINTERIORRINGS(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_NUMINTERIORRINGS(1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_NUMINTERIORRINGS('test');
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_NUMPOINTS(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_NUMPOINTS(1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_NUMPOINTS('test');
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_SRID(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_SRID(1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_SRID('test');
-
-
---echo # Item_bool_func_args_geometry
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_ISEMPTY(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_ISEMPTY(1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_ISEMPTY('test');
-
---echo # Item_bool_func_geometry_args_geometry_geometry
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_RELATE(ROW(1,1), POINT(1,1), 'T*F**FFF*');
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_RELATE(POINT(1,1), ROW(1,1), 'T*F**FFF*');
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_RELATE(1, POINT(1,1), 'T*F**FFF*');
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_RELATE(POINT(1,1), 1, 'T*F**FFF*');
-SELECT ST_RELATE(Point(1,1),Point(1,1),'T*F**FFF*') AS equals;
-SELECT ST_RELATE(Point(1,1),Point(1,1),NULL);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_RELATE(Point(1,1),Point(1,1),ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_RELATE(Point(1,1),Point(1,1),1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_RELATE(Point(1,1),Point(1,1),1.0);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_RELATE(Point(1,1),Point(1,1),1e0);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_RELATE(Point(1,1),Point(1,1),TIME'10:10:10');
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_RELATE(Point(1,1),Point(1,1),DATE'2010-01-01');
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_RELATE(Point(1,1),Point(1,1),TIMESTAMP'2010-01-01 10:10:10');
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_RELATE(Point(1,1),Point(1,1),Point(1,1));
-
-
---echo # Item_str_ascii_func_args_geometry
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_ASTEXT(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_ASTEXT(1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_ASTEXT('test');
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_GEOMETRYTYPE(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_GEOMETRYTYPE(1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_GEOMETRYTYPE('test');
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_ASGEOJSON(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_ASGEOJSON(1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_ASGEOJSON('test');
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_ASGEOJSON(POINT(1,1), POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_ASGEOJSON(POINT(1,1), 1, POINT(1,1));
-
---echo # Item_func_spatial_rel
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_TOUCHES(ROW(1,1), POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_TOUCHES(POINT(1,1), ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_TOUCHES(1, POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_TOUCHES(POINT(1,1), 1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_TOUCHES('test', POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ST_TOUCHES(POINT(1,1), 'test');
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT MBRTOUCHES(ROW(1,1), POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT MBRTOUCHES(POINT(1,1), ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT MBRTOUCHES(1, POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT MBRTOUCHES(POINT(1,1), 1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT MBRTOUCHES('test', POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT MBRTOUCHES(POINT(1,1), 'test');
-
-
---echo #
---echo # MDEV-13964 Parameter data type control for Item_real_func
---echo #
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT EXP(POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT LN(POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT LOG2(POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT LOG10(POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT SQRT(POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ACOS(POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ASIN(POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT COS(POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT SIN(POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT TAN(POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT COT(POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT LOG(POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT LOG(POINT(1,1),POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT LOG(1, POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ATAN(POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ATAN(POINT(1,1),POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ATAN(1, POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT POW(POINT(1,1),POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT RAND(POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT RADIANS(POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT DEGREES(POINT(1,1));
-
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT EXP(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT LN(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT LOG2(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT LOG10(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT SQRT(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ACOS(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ASIN(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT COS(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT SIN(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT TAN(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT COT(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT LOG(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT LOG(ROW(1,1),ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT LOG(1, ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ATAN(ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ATAN(ROW(1,1),ROW(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ATAN(1, ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT POW(ROW(1,1),ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT RAND(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT RADIANS(ROW(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT DEGREES(ROW(1,1));
-
-
---echo #
---echo # MDEV-13965 Parameter data type control for Item_longlong_func
---echo #
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT POINT(1,1) | 1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT 1 | POINT(1,1);
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT POINT(1,1) & 1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT 1 & POINT(1,1);
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT POINT(1,1) << 1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT 1 << POINT(1,1);
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT POINT(1,1) >> 1;
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT 1 >> POINT(1,1);
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT ~POINT(1,1);
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT TO_SECONDS(POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT TIMESTAMPDIFF(SECOND,POINT(1,1), 1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT TIMESTAMPDIFF(SECOND,1, POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT INET_ATON(POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT LAST_INSERT_ID(POINT(1,1));
-
-
---echo #
---echo # MDEV-13966 Parameter data type control for Item_temporal_func
---echo #
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT FROM_DAYS(POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT MAKEDATE(POINT(1,1),1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT MAKEDATE(1, POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT LAST_DAY(POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT SEC_TO_TIME(POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT TIMEDIFF(POINT(1,1),1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT TIMEDIFF(1, POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT MAKETIME(POINT(1,1),1,1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT MAKETIME(1, POINT(1,1), 1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT MAKETIME(1, 1, POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT FROM_UNIXTIME(POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CONVERT_TZ(POINT(1,1),1,1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CONVERT_TZ(1, POINT(1,1), 1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT CONVERT_TZ(1, 1, POINT(1,1));
-
-
---echo #
---echo # MDEV-13967 Parameter data type control for Item_long_func
---echo #
-
-SELECT STRCMP(POINT(1,1),POINT(1,1));
-SELECT CHAR_LENGTH(POINT(1,1));
-SELECT OCTET_LENGTH(POINT(1,1));
-SELECT UNCOMPRESSED_LENGTH(POINT(1,1));
-SELECT COERCIBILITY(POINT(1,1));
-SELECT ASCII(POINT(1,1));
-SELECT CRC32(POINT(1,1));
-SELECT ORD(POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT SIGN(POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT LOCATE('a','a',POINT(1,1));
-
-SELECT LOCATE(POINT(1,1),POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT BIT_COUNT(POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT BENCHMARK(POINT(1,1),'');
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT SLEEP(POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT GET_LOCK('x', POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT PERIOD_ADD(POINT(1,1),1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT PERIOD_ADD(1,POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT PERIOD_DIFF(POINT(1,1),1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT PERIOD_DIFF(1,POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT TO_DAYS(POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT DAYOFMONTH(POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT DAYOFYEAR(POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT QUARTER(POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT YEAR(POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT YEARWEEK(POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT WEEK(POINT(1,1));
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT WEEK(POINT(1,1),1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT WEEK(1,POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT HOUR(POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT MINUTE(POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT SECOND(POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT MICROSECOND(POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT JSON_DEPTH(POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT JSON_LENGTH(POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT JSON_LENGTH('json', POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT JSON_LENGTH(POINT(1,1), POINT(1,1));
-
-SELECT REGEXP_INSTR(POINT(1,1),'');
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT REGEXP_INSTR('',POINT(1,1));
-
-SELECT FIND_IN_SET(POINT(1,1),'');
-SELECT FIND_IN_SET('',POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT RELEASE_LOCK(POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT IS_FREE_LOCK(POINT(1,1));
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT IS_USED_LOCK(POINT(1,1));
-
-
---echo #
---echo # End of 10.3 tests
---echo #
diff --git a/mysql-test/t/gis2.test b/mysql-test/t/gis2.test
deleted file mode 100644
index 9731e2a91d0..00000000000
--- a/mysql-test/t/gis2.test
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# MDEV-3934 Assertion `((keypart_map+1) & keypart_map) == 0' failed in _mi_pack_key with an index on a POINT column
-#
-
-CREATE TABLE t1 (
- id INT UNSIGNED NOT NULL AUTO_INCREMENT,
- point_data POINT NOT NULL,
- PRIMARY KEY (id),
- KEY idx_point_data(point_data)
-) ENGINE=MyISAM;
-INSERT t1 (point_data) VALUES
- (GeomFromText('Point(37.0248492 23.8512726)')),
- (GeomFromText('Point(38.0248492 23.8512726)'));
-SELECT id FROM t1
-WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)'));
-DROP TABLE t1;
-
-#
-# MDEV-13923 Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed upon altering table with geometry field
-#
---error ER_CANT_CREATE_GEOMETRY_OBJECT
-create table t1 (p point default "qwer");
---error ER_CANT_CREATE_GEOMETRY_OBJECT
-create table t1 (p point default 0);
---error ER_INVALID_DEFAULT
-create table t1 (p point not null default st_geometryfromtext('point 0)'));
-create table t1 (p point not null default st_geometryfromtext('point(0 0)'));
-insert into t1 values(default);
-select st_astext(p) from t1;
-drop table t1;
-
-create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1))));
-set timestamp=10;
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-insert into t1 values(default);
-drop table t1;
-SET timestamp=default;
-
-create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1))));
-set timestamp=10;
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-alter table t1 add column i int;
-drop table t1;
-SET timestamp=default;
-
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
deleted file mode 100644
index c945e818181..00000000000
--- a/mysql-test/t/grant.test
+++ /dev/null
@@ -1,2240 +0,0 @@
-# Test of GRANT commands
-
-# Grant tests not performed with embedded server
--- source include/not_embedded.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-set GLOBAL sql_mode="";
-set LOCAL sql_mode="";
-SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
-SET GLOBAL log_bin_trust_function_creators = 1;
-
-# Cleanup
---disable_warnings
-drop table if exists t1;
-drop database if exists mysqltest;
---enable_warnings
-
-connect (master,localhost,root,,);
-connection master;
-SET NAMES binary;
-
-#
-# Test that SSL options works properly
-#
-
-delete from mysql.user where user='mysqltest_1';
-delete from mysql.db where user='mysqltest_1';
-flush privileges;
-grant select on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA";
-show grants for mysqltest_1@localhost;
-grant delete on mysqltest.* to mysqltest_1@localhost;
-query_vertical select * from mysql.user where user="mysqltest_1";
-show grants for mysqltest_1@localhost;
-revoke delete on mysqltest.* from mysqltest_1@localhost;
-show grants for mysqltest_1@localhost;
-grant select on mysqltest.* to mysqltest_1@localhost require NONE;
-show grants for mysqltest_1@localhost;
-grant USAGE on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "testsubject" ISSUER "Monty Program Ab";
-show grants for mysqltest_1@localhost;
-revoke all privileges on mysqltest.* from mysqltest_1@localhost;
-show grants for mysqltest_1@localhost;
-delete from mysql.user where user='mysqltest_1';
-flush privileges;
-
-#
-# Test of GRANTS specifying user limits
-#
-delete from mysql.user where user='mysqltest_1';
-flush privileges;
-grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 10 max_statement_time 60;
-query_vertical select * from mysql.user where user="mysqltest_1";
-show grants for mysqltest_1@localhost;
-grant usage on *.* to mysqltest_1@localhost with max_updates_per_hour 20 max_connections_per_hour 30 max_statement_time 0;
-query_vertical select * from mysql.user where user="mysqltest_1";
-show grants for mysqltest_1@localhost;
-# This is just to double check that one won't ignore results of selects
-flush privileges;
-show grants for mysqltest_1@localhost;
-delete from mysql.user where user='mysqltest_1';
-flush privileges;
-
-#
-# Test that the new db privileges are stored/retrieved correctly
-#
-
-grant CREATE TEMPORARY TABLES, LOCK TABLES on mysqltest.* to mysqltest_1@localhost;
-show grants for mysqltest_1@localhost;
-flush privileges;
-show grants for mysqltest_1@localhost;
-revoke CREATE TEMPORARY TABLES on mysqltest.* from mysqltest_1@localhost;
-show grants for mysqltest_1@localhost;
-grant ALL PRIVILEGES on mysqltest.* to mysqltest_1@localhost with GRANT OPTION;
-flush privileges;
-show grants for mysqltest_1@localhost;
-revoke LOCK TABLES, ALTER on mysqltest.* from mysqltest_1@localhost;
-show grants for mysqltest_1@localhost;
-revoke all privileges on mysqltest.* from mysqltest_1@localhost;
-delete from mysql.user where user='mysqltest_1';
-flush privileges;
-grant usage on test.* to mysqltest_1@localhost with grant option;
-show grants for mysqltest_1@localhost;
-delete from mysql.user where user='mysqltest_1';
-delete from mysql.db where user='mysqltest_1';
-delete from mysql.tables_priv where user='mysqltest_1';
-delete from mysql.columns_priv where user='mysqltest_1';
-flush privileges;
---error ER_NONEXISTING_GRANT
-show grants for mysqltest_1@localhost;
-
-#
-# Test what happens when you have same table and colum level grants
-#
-
-create table t1 (a int);
-GRANT select,update,insert on t1 to mysqltest_1@localhost;
-GRANT select (a), update (a),insert(a), references(a) on t1 to mysqltest_1@localhost;
-show grants for mysqltest_1@localhost;
-select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1";
-REVOKE select (a), update on t1 from mysqltest_1@localhost;
-show grants for mysqltest_1@localhost;
-REVOKE select,update,insert,insert (a) on t1 from mysqltest_1@localhost;
-show grants for mysqltest_1@localhost;
-GRANT select,references on t1 to mysqltest_1@localhost;
-select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1";
-grant all on test.* to mysqltest_3@localhost with grant option;
-revoke all on test.* from mysqltest_3@localhost;
-show grants for mysqltest_3@localhost;
-revoke grant option on test.* from mysqltest_3@localhost;
-show grants for mysqltest_3@localhost;
-grant all on test.t1 to mysqltest_2@localhost with grant option;
-revoke all on test.t1 from mysqltest_2@localhost;
-show grants for mysqltest_2@localhost;
-revoke grant option on test.t1 from mysqltest_2@localhost;
-show grants for mysqltest_2@localhost;
-delete from mysql.user where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
-delete from mysql.db where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
-delete from mysql.tables_priv where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
-delete from mysql.columns_priv where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
-flush privileges;
-drop table t1;
-
-#
-# Test some error conditions
-#
---error ER_WRONG_USAGE
-GRANT FILE on mysqltest.* to mysqltest_1@localhost;
-select 1; # To test that the previous command didn't cause problems
-
-#
-# Bug#4898 User privileges depending on ORDER BY Settings of table db
-#
-insert into mysql.user (host, user) values ('localhost', 'test11');
-insert into mysql.db (host, db, user, select_priv) values
-('localhost', 'a%', 'test11', 'Y'), ('localhost', 'ab%', 'test11', 'Y');
-alter table mysql.db order by db asc;
-flush privileges;
-show grants for test11@localhost;
-alter table mysql.db order by db desc;
-flush privileges;
-show grants for test11@localhost;
-delete from mysql.user where user='test11';
-delete from mysql.db where user='test11';
-
-#
-# Bug#6123 GRANT USAGE inserts useless Db row
-#
-create database mysqltest1;
-grant usage on mysqltest1.* to test6123 identified by 'magic123';
-select host,db,user,select_priv,insert_priv from mysql.db where db="mysqltest1";
-delete from mysql.user where user='test6123';
-drop database mysqltest1;
-
-#
-# Test for 'drop user', 'revoke privileges, grant'
-#
-
-create table t1 (a int);
-grant ALL PRIVILEGES on *.* to drop_user2@localhost with GRANT OPTION;
-show grants for drop_user2@localhost;
-revoke all privileges, grant option from drop_user2@localhost;
-drop user drop_user2@localhost;
-
-grant ALL PRIVILEGES on *.* to drop_user@localhost with GRANT OPTION;
-grant ALL PRIVILEGES on test.* to drop_user@localhost with GRANT OPTION;
-grant select(a) on test.t1 to drop_user@localhost;
-show grants for drop_user@localhost;
-
-#
-# Bug#3086 SHOW GRANTS doesn't follow ANSI_QUOTES
-#
-set sql_mode=ansi_quotes;
-show grants for drop_user@localhost;
-set sql_mode=default;
-
-set sql_quote_show_create=0;
-show grants for drop_user@localhost;
-set sql_mode="ansi_quotes";
-show grants for drop_user@localhost;
-set sql_quote_show_create=1;
-show grants for drop_user@localhost;
-set sql_mode="";
-show grants for drop_user@localhost;
-
-revoke all privileges, grant option from drop_user@localhost;
-show grants for drop_user@localhost;
-drop user drop_user@localhost;
---error ER_REVOKE_GRANTS
-revoke all privileges, grant option from drop_user@localhost;
-
-grant select(a) on test.t1 to drop_user1@localhost;
-grant select on test.t1 to drop_user2@localhost;
-grant select on test.* to drop_user3@localhost;
-grant select on *.* to drop_user4@localhost;
-# Drop user now implicitly revokes all privileges.
-drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
-drop_user4@localhost;
---error ER_REVOKE_GRANTS
-revoke all privileges, grant option from drop_user1@localhost, drop_user2@localhost,
-drop_user3@localhost, drop_user4@localhost;
---error ER_CANNOT_USER
-drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
-drop_user4@localhost;
-drop table t1;
-grant usage on *.* to mysqltest_1@localhost identified by "password";
-grant select, update, insert on test.* to mysqltest_1@localhost;
-show grants for mysqltest_1@localhost;
-drop user mysqltest_1@localhost;
-
-#
-# Bug#3403 Wrong encoding in SHOW GRANTS output
-#
-SET NAMES koi8r;
-CREATE DATABASE ;
-USE ;
-CREATE TABLE ( INT);
-
-GRANT SELECT ON .* TO @localhost;
-SHOW GRANTS FOR @localhost;
-REVOKE SELECT ON .* FROM @localhost;
-
-GRANT SELECT ON . TO @localhost;
-SHOW GRANTS FOR @localhost;
-REVOKE SELECT ON . FROM @localhost;
-
-GRANT SELECT () ON . TO @localhost;
-SHOW GRANTS FOR @localhost;
-REVOKE SELECT () ON . FROM @localhost;
-
-# Revoke does not drop user. Leave a clean user table for the next tests.
-DROP USER @localhost;
-
-DROP DATABASE ;
-SET NAMES latin1;
-
-#
-# Bug#5831 REVOKE ALL PRIVILEGES, GRANT OPTION does not revoke everything
-#
-USE test;
-CREATE TABLE t1 (a int );
-CREATE TABLE t2 LIKE t1;
-CREATE TABLE t3 LIKE t1;
-CREATE TABLE t4 LIKE t1;
-CREATE TABLE t5 LIKE t1;
-CREATE TABLE t6 LIKE t1;
-CREATE TABLE t7 LIKE t1;
-CREATE TABLE t8 LIKE t1;
-CREATE TABLE t9 LIKE t1;
-CREATE TABLE t10 LIKE t1;
-CREATE DATABASE testdb1;
-CREATE DATABASE testdb2;
-CREATE DATABASE testdb3;
-CREATE DATABASE testdb4;
-CREATE DATABASE testdb5;
-CREATE DATABASE testdb6;
-CREATE DATABASE testdb7;
-CREATE DATABASE testdb8;
-CREATE DATABASE testdb9;
-CREATE DATABASE testdb10;
-GRANT ALL ON testdb1.* TO testuser@localhost;
-GRANT ALL ON testdb2.* TO testuser@localhost;
-GRANT ALL ON testdb3.* TO testuser@localhost;
-GRANT ALL ON testdb4.* TO testuser@localhost;
-GRANT ALL ON testdb5.* TO testuser@localhost;
-GRANT ALL ON testdb6.* TO testuser@localhost;
-GRANT ALL ON testdb7.* TO testuser@localhost;
-GRANT ALL ON testdb8.* TO testuser@localhost;
-GRANT ALL ON testdb9.* TO testuser@localhost;
-GRANT ALL ON testdb10.* TO testuser@localhost;
-GRANT SELECT ON test.t1 TO testuser@localhost;
-GRANT SELECT ON test.t2 TO testuser@localhost;
-GRANT SELECT ON test.t3 TO testuser@localhost;
-GRANT SELECT ON test.t4 TO testuser@localhost;
-GRANT SELECT ON test.t5 TO testuser@localhost;
-GRANT SELECT ON test.t6 TO testuser@localhost;
-GRANT SELECT ON test.t7 TO testuser@localhost;
-GRANT SELECT ON test.t8 TO testuser@localhost;
-GRANT SELECT ON test.t9 TO testuser@localhost;
-GRANT SELECT ON test.t10 TO testuser@localhost;
-GRANT SELECT (a) ON test.t1 TO testuser@localhost;
-GRANT SELECT (a) ON test.t2 TO testuser@localhost;
-GRANT SELECT (a) ON test.t3 TO testuser@localhost;
-GRANT SELECT (a) ON test.t4 TO testuser@localhost;
-GRANT SELECT (a) ON test.t5 TO testuser@localhost;
-GRANT SELECT (a) ON test.t6 TO testuser@localhost;
-GRANT SELECT (a) ON test.t7 TO testuser@localhost;
-GRANT SELECT (a) ON test.t8 TO testuser@localhost;
-GRANT SELECT (a) ON test.t9 TO testuser@localhost;
-GRANT SELECT (a) ON test.t10 TO testuser@localhost;
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM testuser@localhost;
-SHOW GRANTS FOR testuser@localhost;
-DROP USER testuser@localhost;
-DROP TABLE t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
-DROP DATABASE testdb1;
-DROP DATABASE testdb2;
-DROP DATABASE testdb3;
-DROP DATABASE testdb4;
-DROP DATABASE testdb5;
-DROP DATABASE testdb6;
-DROP DATABASE testdb7;
-DROP DATABASE testdb8;
-DROP DATABASE testdb9;
-DROP DATABASE testdb10;
-
-#
-# Bug#6932 a problem with 'revoke ALL PRIVILEGES'
-#
-
-create table t1(a int, b int, c int, d int);
-grant insert(b), insert(c), insert(d), insert(a) on t1 to grant_user@localhost;
-show grants for grant_user@localhost;
-select Host,Db,User,Table_name,Column_name,Column_priv from mysql.columns_priv order by Column_name;
-revoke ALL PRIVILEGES on t1 from grant_user@localhost;
-show grants for grant_user@localhost;
-select Host,Db,User,Table_name,Column_name,Column_priv from mysql.columns_priv;
-drop user grant_user@localhost;
-drop table t1;
-
-#
-# Bug#7391 Cross-database multi-table UPDATE security problem
-#
-create database mysqltest_1;
-create database mysqltest_2;
-create table mysqltest_1.t1 select 1 a, 2 q;
-create table mysqltest_1.t2 select 1 b, 2 r;
-create table mysqltest_2.t1 select 1 c, 2 s;
-create table mysqltest_2.t2 select 1 d, 2 t;
-
-# test the column privileges
-grant update (a) on mysqltest_1.t1 to mysqltest_3@localhost;
-grant select (b) on mysqltest_1.t2 to mysqltest_3@localhost;
-grant select (c) on mysqltest_2.t1 to mysqltest_3@localhost;
-grant update (d) on mysqltest_2.t2 to mysqltest_3@localhost;
-connect (conn1,localhost,mysqltest_3,,);
-connection conn1;
-SELECT * FROM INFORMATION_SCHEMA.COLUMN_PRIVILEGES
- WHERE GRANTEE = '''mysqltest_3''@''localhost'''
- ORDER BY TABLE_NAME,COLUMN_NAME,PRIVILEGE_TYPE;
-SELECT * FROM INFORMATION_SCHEMA.TABLE_PRIVILEGES
- WHERE GRANTEE = '''mysqltest_3''@''localhost'''
- ORDER BY TABLE_NAME,PRIVILEGE_TYPE;
-SELECT * from INFORMATION_SCHEMA.SCHEMA_PRIVILEGES
- WHERE GRANTEE = '''mysqltest_3''@''localhost'''
- ORDER BY TABLE_SCHEMA,PRIVILEGE_TYPE;
-SELECT * from INFORMATION_SCHEMA.USER_PRIVILEGES
- WHERE GRANTEE = '''mysqltest_3''@''localhost'''
- ORDER BY TABLE_CATALOG,PRIVILEGE_TYPE;
---error ER_COLUMNACCESS_DENIED_ERROR
-update mysqltest_1.t1, mysqltest_1.t2 set q=10 where b=1;
---error ER_COLUMNACCESS_DENIED_ERROR
-update mysqltest_1.t2, mysqltest_2.t2 set d=20 where d=1;
---error ER_TABLEACCESS_DENIED_ERROR
-update mysqltest_1.t1, mysqltest_2.t2 set d=20 where d=1;
---error ER_TABLEACCESS_DENIED_ERROR
-update mysqltest_2.t1, mysqltest_1.t2 set c=20 where b=1;
---error ER_COLUMNACCESS_DENIED_ERROR
-update mysqltest_2.t1, mysqltest_2.t2 set d=10 where s=2;
-# the following two should work
-update mysqltest_1.t1, mysqltest_2.t2 set a=10,d=10;
-update mysqltest_1.t1, mysqltest_2.t1 set a=20 where c=20;
-connection master;
-select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2;
-select t1.*,t2.* from mysqltest_2.t1,mysqltest_2.t2;
-revoke all on mysqltest_1.t1 from mysqltest_3@localhost;
-revoke all on mysqltest_1.t2 from mysqltest_3@localhost;
-revoke all on mysqltest_2.t1 from mysqltest_3@localhost;
-revoke all on mysqltest_2.t2 from mysqltest_3@localhost;
-
-# test the db/table level privileges
-grant all on mysqltest_2.* to mysqltest_3@localhost;
-grant select on *.* to mysqltest_3@localhost;
-# Next grant is needed to trigger bug#7391. Do not optimize!
-grant select on mysqltest_2.t1 to mysqltest_3@localhost;
-flush privileges;
-disconnect conn1;
-connect (conn2,localhost,mysqltest_3,,);
-connection conn2;
-use mysqltest_1;
-update mysqltest_2.t1, mysqltest_2.t2 set c=500,d=600;
-# the following failed before, should fail now.
---error ER_TABLEACCESS_DENIED_ERROR
-update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
-use mysqltest_2;
-# the following used to succeed, it must fail now.
---error ER_TABLEACCESS_DENIED_ERROR
-update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
---error ER_TABLEACCESS_DENIED_ERROR
-update mysqltest_2.t1, mysqltest_1.t2 set c=100,b=200;
---error ER_TABLEACCESS_DENIED_ERROR
-update mysqltest_1.t1, mysqltest_2.t2 set a=100,d=200;
-# lets see the result
-connection master;
-select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2;
-select t1.*,t2.* from mysqltest_2.t1,mysqltest_2.t2;
-
-delete from mysql.user where user='mysqltest_3';
-delete from mysql.db where user="mysqltest_3";
-delete from mysql.tables_priv where user="mysqltest_3";
-delete from mysql.columns_priv where user="mysqltest_3";
-flush privileges;
-drop database mysqltest_1;
-drop database mysqltest_2;
-disconnect conn2;
-
-#
-# just SHOW PRIVILEGES test
-#
-SHOW PRIVILEGES;
-
-#
-# Rights for renaming test (Bug#3270)
-#
-connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
-connection root;
---disable_warnings
-create database mysqltest;
---enable_warnings
-create table mysqltest.t1 (a int,b int,c int);
-grant all on mysqltest.t1 to mysqltest_1@localhost;
-connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK);
-connection user1;
--- error ER_TABLEACCESS_DENIED_ERROR
-alter table t1 rename t2;
-disconnect user1;
-connection root;
-revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
-delete from mysql.user where user=_binary'mysqltest_1';
-drop database mysqltest;
-connection default;
-disconnect root;
-
-#
-# check all new table privileges
-#
-CREATE USER dummy@localhost;
-CREATE DATABASE mysqltest;
-CREATE TABLE mysqltest.dummytable (dummyfield INT);
-CREATE VIEW mysqltest.dummyview AS SELECT dummyfield FROM mysqltest.dummytable;
-GRANT ALL PRIVILEGES ON mysqltest.dummytable TO dummy@localhost;
-GRANT ALL PRIVILEGES ON mysqltest.dummyview TO dummy@localhost;
-SHOW GRANTS FOR dummy@localhost;
-use INFORMATION_SCHEMA;
-SELECT TABLE_SCHEMA, TABLE_NAME, GROUP_CONCAT(PRIVILEGE_TYPE ORDER BY
-PRIVILEGE_TYPE SEPARATOR ', ') AS PRIVILEGES FROM TABLE_PRIVILEGES WHERE GRANTEE
-= '\'dummy\'@\'localhost\'' GROUP BY TABLE_SCHEMA, TABLE_NAME;
-FLUSH PRIVILEGES;
-SHOW GRANTS FOR dummy@localhost;
-SELECT TABLE_SCHEMA, TABLE_NAME, GROUP_CONCAT(PRIVILEGE_TYPE ORDER BY
-PRIVILEGE_TYPE SEPARATOR ', ') AS PRIVILEGES FROM TABLE_PRIVILEGES WHERE GRANTEE
-= '\'dummy\'@\'localhost\'' GROUP BY TABLE_SCHEMA, TABLE_NAME;
-SHOW FIELDS FROM mysql.tables_priv;
-use test;
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM dummy@localhost;
-DROP USER dummy@localhost;
-DROP DATABASE mysqltest;
-# check view only privileges
-CREATE USER dummy@localhost;
-CREATE DATABASE mysqltest;
-CREATE TABLE mysqltest.dummytable (dummyfield INT);
-CREATE VIEW mysqltest.dummyview AS SELECT dummyfield FROM mysqltest.dummytable;
-GRANT CREATE VIEW ON mysqltest.dummytable TO dummy@localhost;
-GRANT CREATE VIEW ON mysqltest.dummyview TO dummy@localhost;
-SHOW GRANTS FOR dummy@localhost;
-use INFORMATION_SCHEMA;
-SELECT TABLE_SCHEMA, TABLE_NAME, GROUP_CONCAT(PRIVILEGE_TYPE ORDER BY
-PRIVILEGE_TYPE SEPARATOR ', ') AS PRIVILEGES FROM TABLE_PRIVILEGES WHERE GRANTEE
-= '\'dummy\'@\'localhost\'' GROUP BY TABLE_SCHEMA, TABLE_NAME;
-FLUSH PRIVILEGES;
-SHOW GRANTS FOR dummy@localhost;
-SELECT TABLE_SCHEMA, TABLE_NAME, GROUP_CONCAT(PRIVILEGE_TYPE ORDER BY
-PRIVILEGE_TYPE SEPARATOR ', ') AS PRIVILEGES FROM TABLE_PRIVILEGES WHERE GRANTEE
-= '\'dummy\'@\'localhost\'' GROUP BY TABLE_SCHEMA, TABLE_NAME;
-use test;
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM dummy@localhost;
-DROP USER dummy@localhost;
-DROP DATABASE mysqltest;
-CREATE USER dummy@localhost;
-CREATE DATABASE mysqltest;
-CREATE TABLE mysqltest.dummytable (dummyfield INT);
-CREATE VIEW mysqltest.dummyview AS SELECT dummyfield FROM mysqltest.dummytable;
-GRANT SHOW VIEW ON mysqltest.dummytable TO dummy@localhost;
-GRANT SHOW VIEW ON mysqltest.dummyview TO dummy@localhost;
-SHOW GRANTS FOR dummy@localhost;
-use INFORMATION_SCHEMA;
-SELECT TABLE_SCHEMA, TABLE_NAME, GROUP_CONCAT(PRIVILEGE_TYPE ORDER BY
-PRIVILEGE_TYPE SEPARATOR ', ') AS PRIVILEGES FROM TABLE_PRIVILEGES WHERE GRANTEE
-= '\'dummy\'@\'localhost\'' GROUP BY TABLE_SCHEMA, TABLE_NAME;
-FLUSH PRIVILEGES;
-SHOW GRANTS FOR dummy@localhost;
-SELECT TABLE_SCHEMA, TABLE_NAME, GROUP_CONCAT(PRIVILEGE_TYPE ORDER BY
-PRIVILEGE_TYPE SEPARATOR ', ') AS PRIVILEGES FROM TABLE_PRIVILEGES WHERE GRANTEE
-= '\'dummy\'@\'localhost\'' GROUP BY TABLE_SCHEMA, TABLE_NAME;
-use test;
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM dummy@localhost;
-DROP USER dummy@localhost;
-DROP DATABASE mysqltest;
-#
-# Bug#11330 Entry in tables_priv with host = '' causes crash
-#
-connection default;
-use mysql;
-insert into tables_priv values ('','test_db','mysqltest_1','test_table','test_grantor',CURRENT_TIMESTAMP,'Select','Select');
-flush privileges;
-delete from tables_priv where host = '' and user = 'mysqltest_1';
-flush privileges;
-use test;
-
-#
-# Bug#10892 user variables not auto cast for comparisons
-# Check that we don't get illegal mix of collations
-#
-set @user123="non-existent";
-select * from mysql.db where user=@user123;
-
-set names koi8r;
-create database ;
-grant select on .* to root@localhost;
-select hex(Db) from mysql.db where Db='';
-show grants for root@localhost;
-flush privileges;
-show grants for root@localhost;
-drop database ;
-revoke all privileges on .* from root@localhost;
-show grants for root@localhost;
-set names latin1;
-
-#
-# Bug#15598 Server crashes in specific case during setting new password
-# - Caused by a user with host ''
-#
-create user mysqltest_7@;
-set password for mysqltest_7@ = password('systpass');
-show grants for mysqltest_7@;
-drop user mysqltest_7@;
---error ER_NONEXISTING_GRANT
-show grants for mysqltest_7@;
-
-#
-# Bug#14385 GRANT and mapping to correct user account problems
-#
-create database mysqltest;
-use mysqltest;
-create table t1(f1 int);
-GRANT DELETE ON mysqltest.t1 TO mysqltest1@'%';
-GRANT SELECT ON mysqltest.t1 TO mysqltest1@'192.%';
-show grants for mysqltest1@'192.%';
-show grants for mysqltest1@'%';
-delete from mysql.user where user='mysqltest1';
-delete from mysql.db where user='mysqltest1';
-delete from mysql.tables_priv where user='mysqltest1';
-flush privileges;
-drop database mysqltest;
-
-#
-# Bug#27515 DROP previlege is not required for RENAME TABLE
-#
-connection master;
-create database db27515;
-use db27515;
-create table t1 (a int);
-grant alter on db27515.t1 to user27515@localhost;
-grant insert, create on db27515.t2 to user27515@localhost;
-
-connect (conn27515, localhost, user27515, , db27515);
-connection conn27515;
---error ER_TABLEACCESS_DENIED_ERROR
-rename table t1 to t2;
-disconnect conn27515;
-
-connection master;
-revoke all privileges, grant option from user27515@localhost;
-drop user user27515@localhost;
-drop database db27515;
-
---echo End of 4.1 tests
-
-#
-# Bug#16297 In memory grant tables not flushed when users's hostname is ""
-#
-use test;
-create table t1 (a int);
-
-# Backup anonymous users and remove them. (They get in the way of
-# the one we test with here otherwise.)
-create table t2 as select * from mysql.user where user='';
-delete from mysql.user where user='';
-flush privileges;
-
-# Create some users with different hostnames
-create user mysqltest_8@'';
-create user mysqltest_8@host8;
-
-# Try to create them again
---error ER_CANNOT_USER
-create user mysqltest_8@'';
---error ER_CANNOT_USER
-create user mysqltest_8;
---error ER_CANNOT_USER
-create user mysqltest_8@host8;
-
-select user, QUOTE(host) from mysql.user where user="mysqltest_8";
-
---echo Schema privileges
-grant select on mysqltest.* to mysqltest_8@'';
-show grants for mysqltest_8@'';
-grant select on mysqltest.* to mysqltest_8@;
-show grants for mysqltest_8@;
-grant select on mysqltest.* to mysqltest_8;
-show grants for mysqltest_8;
-select * from information_schema.schema_privileges
-where grantee like "'mysqltest_8'%";
-connect (conn3,localhost,mysqltest_8,,);
-select * from t1;
-disconnect conn3;
-connection master;
-revoke select on mysqltest.* from mysqltest_8@'';
-show grants for mysqltest_8@'';
-show grants for mysqltest_8;
-select * from information_schema.schema_privileges
-where grantee like "'mysqltest_8'%";
-flush privileges;
-show grants for mysqltest_8@'';
-show grants for mysqltest_8@;
-grant select on mysqltest.* to mysqltest_8@'';
-flush privileges;
-show grants for mysqltest_8@;
-revoke select on mysqltest.* from mysqltest_8@'';
-flush privileges;
-
---echo Column privileges
-grant update (a) on t1 to mysqltest_8@'';
-grant update (a) on t1 to mysqltest_8;
-show grants for mysqltest_8@'';
-show grants for mysqltest_8;
-flush privileges;
-show grants for mysqltest_8@'';
-show grants for mysqltest_8;
-select * from information_schema.column_privileges;
-connect (conn4,localhost,mysqltest_8,,);
-select * from t1;
-disconnect conn4;
-connection master;
-revoke update (a) on t1 from mysqltest_8@'';
-show grants for mysqltest_8@'';
-show grants for mysqltest_8;
-select * from information_schema.column_privileges;
-flush privileges;
-show grants for mysqltest_8@'';
-show grants for mysqltest_8;
-
---echo Table privileges
-grant update on t1 to mysqltest_8@'';
-grant update on t1 to mysqltest_8;
-show grants for mysqltest_8@'';
-show grants for mysqltest_8;
-flush privileges;
-show grants for mysqltest_8@'';
-show grants for mysqltest_8;
-select * from information_schema.table_privileges;
-connect (conn5,localhost,mysqltest_8,,);
-select * from t1;
-disconnect conn5;
-connection master;
-revoke update on t1 from mysqltest_8@'';
-show grants for mysqltest_8@'';
-show grants for mysqltest_8;
-select * from information_schema.table_privileges;
-flush privileges;
-show grants for mysqltest_8@'';
-show grants for mysqltest_8;
-
---echo "DROP USER" should clear privileges
-grant all privileges on mysqltest.* to mysqltest_8@'';
-grant select on mysqltest.* to mysqltest_8@'';
-grant update on t1 to mysqltest_8@'';
-grant update (a) on t1 to mysqltest_8@'';
-grant all privileges on mysqltest.* to mysqltest_8;
-show grants for mysqltest_8@'';
-show grants for mysqltest_8;
-select * from information_schema.user_privileges
-where grantee like "'mysqltest_8'%";
-connect (conn5,localhost,mysqltest_8,,);
-select * from t1;
-disconnect conn5;
-connection master;
-flush privileges;
-show grants for mysqltest_8@'';
-show grants for mysqltest_8;
-drop user mysqltest_8@'';
---error ER_NONEXISTING_GRANT
-show grants for mysqltest_8@'';
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error ER_ACCESS_DENIED_ERROR
-connect (conn6,localhost,mysqltest_8,,);
-connection master;
---error ER_NONEXISTING_GRANT
-show grants for mysqltest_8;
-drop user mysqltest_8@host8;
---error ER_NONEXISTING_GRANT
-show grants for mysqltest_8@host8;
-
-# Restore the anonymous users.
-insert into mysql.user select * from t2;
-flush privileges;
-drop table t2;
-drop table t1;
-
-#
-# Bug#20214 Incorrect error when user calls SHOW CREATE VIEW on non
-# privileged view
-#
-
-connection master;
-
-CREATE DATABASE mysqltest3;
-USE mysqltest3;
-
-CREATE TABLE t_nn (c1 INT);
-CREATE VIEW v_nn AS SELECT * FROM t_nn;
-
-CREATE DATABASE mysqltest2;
-USE mysqltest2;
-
-CREATE TABLE t_nn (c1 INT);
-CREATE VIEW v_nn AS SELECT * FROM t_nn;
-CREATE VIEW v_yn AS SELECT * FROM t_nn;
-CREATE VIEW v_gy AS SELECT * FROM t_nn;
-CREATE VIEW v_ny AS SELECT * FROM t_nn;
-CREATE VIEW v_yy AS SELECT * FROM t_nn WHERE c1=55;
-
-GRANT SHOW VIEW ON mysqltest2.v_ny TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1';
-GRANT SELECT ON mysqltest2.v_yn TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1';
-GRANT SELECT ON mysqltest2.* TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1';
-GRANT SHOW VIEW,SELECT ON mysqltest2.v_yy TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1';
-
-connect (mysqltest_1, localhost, mysqltest_1, mysqltest_1,);
-
-# fail because of missing SHOW VIEW (have generic SELECT)
---error ER_TABLEACCESS_DENIED_ERROR
-SHOW CREATE VIEW mysqltest2.v_nn;
---error ER_TABLEACCESS_DENIED_ERROR
-SHOW CREATE TABLE mysqltest2.v_nn;
-
-# fail because of missing SHOW VIEW
---error ER_TABLEACCESS_DENIED_ERROR
-SHOW CREATE VIEW mysqltest2.v_yn;
---error ER_TABLEACCESS_DENIED_ERROR
-SHOW CREATE TABLE mysqltest2.v_yn;
-
-# succeed (despite of missing SELECT, having SHOW VIEW bails us out)
-SHOW CREATE TABLE mysqltest2.v_ny;
-
-# succeed (despite of missing SELECT, having SHOW VIEW bails us out)
-SHOW CREATE VIEW mysqltest2.v_ny;
-
-# fail because of missing (specific or generic) SELECT
---error ER_TABLEACCESS_DENIED_ERROR
-SHOW CREATE TABLE mysqltest3.t_nn;
-
-# fail because of missing (specific or generic) SELECT (not because it's not a view!)
---error ER_TABLEACCESS_DENIED_ERROR
-SHOW CREATE VIEW mysqltest3.t_nn;
-
-# fail because of missing missing (specific or generic) SELECT (and SHOW VIEW)
---error ER_TABLEACCESS_DENIED_ERROR
-SHOW CREATE VIEW mysqltest3.v_nn;
---error ER_TABLEACCESS_DENIED_ERROR
-SHOW CREATE TABLE mysqltest3.v_nn;
-
-# succeed thanks to generic SELECT
-SHOW CREATE TABLE mysqltest2.t_nn;
-
-# fail because it's not a view! (have generic SELECT though)
---error ER_WRONG_OBJECT
-SHOW CREATE VIEW mysqltest2.t_nn;
-
-# succeed, have SELECT and SHOW VIEW
-SHOW CREATE VIEW mysqltest2.v_yy;
-
-# succeed, have SELECT and SHOW VIEW
-SHOW CREATE TABLE mysqltest2.v_yy;
-
-# clean-up
-connection master;
-
-# succeed, we're root
-SHOW CREATE TABLE mysqltest2.v_nn;
-SHOW CREATE VIEW mysqltest2.v_nn;
-
-SHOW CREATE TABLE mysqltest2.t_nn;
-
-# fail because it's not a view!
---error ER_WRONG_OBJECT
-SHOW CREATE VIEW mysqltest2.t_nn;
-
-DROP VIEW mysqltest2.v_nn;
-DROP VIEW mysqltest2.v_yn;
-DROP VIEW mysqltest2.v_ny;
-DROP VIEW mysqltest2.v_yy;
-DROP TABLE mysqltest2.t_nn;
-DROP DATABASE mysqltest2;
-DROP VIEW mysqltest3.v_nn;
-DROP TABLE mysqltest3.t_nn;
-DROP DATABASE mysqltest3;
-disconnect mysqltest_1;
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'mysqltest_1'@'localhost';
-DROP USER 'mysqltest_1'@'localhost';
-
-# restore the original database
-USE test;
-connection default;
-disconnect master;
-
-
-#
-# Bug#10668 CREATE USER does not enforce username length limit
-#
---error ER_WRONG_STRING_LENGTH
-create user longer_than_80_456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789;
-
-#
-# Test for Bug#16899 Possible buffer overflow in handling of DEFINER-clause.
-#
-# These checks are intended to ensure that appropriate errors are risen when
-# illegal user name or hostname is specified in user-clause of GRANT/REVOKE
-# statements.
-#
-
-#
-# Bug#22369 Alter table rename combined with other alterations causes lost tables
-#
-CREATE DATABASE mysqltest1;
-CREATE TABLE mysqltest1.t1 (
- int_field INTEGER UNSIGNED NOT NULL,
- char_field CHAR(10),
- INDEX(`int_field`)
-);
-CREATE TABLE mysqltest1.t2 (int_field INT);
-
---echo "Now check that we require equivalent grants for "
---echo "RENAME TABLE and ALTER TABLE"
-CREATE USER mysqltest_1@localhost;
-GRANT SELECT ON mysqltest1.t1 TO mysqltest_1@localhost;
-
-connect (conn42,localhost,mysqltest_1,,mysqltest1);
-SELECT USER();
-SHOW GRANTS;
---error ER_TABLEACCESS_DENIED_ERROR
-RENAME TABLE t1 TO t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ALTER TABLE t1 RENAME TO t2;
---disconnect conn42
---connection default
-GRANT DROP ON mysqltest1.t1 TO mysqltest_1@localhost;
-
-connect (conn42,localhost,mysqltest_1,,mysqltest1);
---error ER_TABLEACCESS_DENIED_ERROR
-RENAME TABLE t1 TO t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ALTER TABLE t1 RENAME TO t2;
---disconnect conn42
---connection default
-GRANT ALTER ON mysqltest1.t1 TO mysqltest_1@localhost;
-
-connect (conn42,localhost,mysqltest_1,,mysqltest1);
-SHOW GRANTS;
---error ER_TABLEACCESS_DENIED_ERROR
-RENAME TABLE t1 TO t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ALTER TABLE t1 RENAME TO t2;
---disconnect conn42
---connection default
-GRANT INSERT, CREATE ON mysqltest1.t1 TO mysqltest_1@localhost;
-connect (conn42,localhost,mysqltest_1,,mysqltest1);
-SHOW GRANTS;
---error ER_TABLEACCESS_DENIED_ERROR
---disconnect conn42
---connection default
-GRANT INSERT, SELECT, CREATE, ALTER, DROP ON mysqltest1.t2 TO mysqltest_1@localhost;
-DROP TABLE mysqltest1.t2;
-
-connect (conn42,localhost,mysqltest_1,,mysqltest1);
-SHOW GRANTS;
-RENAME TABLE t1 TO t2;
-RENAME TABLE t2 TO t1;
-ALTER TABLE t1 RENAME TO t2;
-ALTER TABLE t2 RENAME TO t1;
---disconnect conn42
---connection default
-REVOKE DROP, INSERT ON mysqltest1.t1 FROM mysqltest_1@localhost;
-REVOKE DROP, INSERT ON mysqltest1.t2 FROM mysqltest_1@localhost;
-
-connect (conn42,localhost,mysqltest_1,,mysqltest1);
-SHOW GRANTS;
---error ER_TABLEACCESS_DENIED_ERROR
-RENAME TABLE t1 TO t2;
---error ER_TABLEACCESS_DENIED_ERROR
-ALTER TABLE t1 RENAME TO t2;
---disconnect conn42
---connection default
-
-DROP USER mysqltest_1@localhost;
-DROP DATABASE mysqltest1;
-USE test;
-
-# Working with database-level privileges.
-
---error ER_WRONG_STRING_LENGTH
-GRANT CREATE ON mysqltest.* TO longer_than_80_456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789@localhost;
-
---error ER_WRONG_STRING_LENGTH
-GRANT CREATE ON mysqltest.* TO some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
-
---error ER_WRONG_STRING_LENGTH
-REVOKE CREATE ON mysqltest.* FROM longer_than_80_456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789@localhost;
-
---error ER_WRONG_STRING_LENGTH
-REVOKE CREATE ON mysqltest.* FROM some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
-
-# Working with table-level privileges.
-
---error ER_WRONG_STRING_LENGTH
-GRANT CREATE ON t1 TO longer_than_80_456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789@localhost;
-
---error ER_WRONG_STRING_LENGTH
-GRANT CREATE ON t1 TO some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
-
---error ER_WRONG_STRING_LENGTH
-REVOKE CREATE ON t1 FROM longer_than_80_456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789@localhost;
-
---error ER_WRONG_STRING_LENGTH
-REVOKE CREATE ON t1 FROM some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
-
-# Working with routine-level privileges.
-
---error ER_WRONG_STRING_LENGTH
-GRANT EXECUTE ON PROCEDURE p1 TO longer_than_80_456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789@localhost;
-
---error ER_WRONG_STRING_LENGTH
-GRANT EXECUTE ON PROCEDURE p1 TO some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
-
---error ER_WRONG_STRING_LENGTH
-REVOKE EXECUTE ON PROCEDURE p1 FROM longer_than_80_456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789@localhost;
-
---error ER_WRONG_STRING_LENGTH
-REVOKE EXECUTE ON PROCEDURE t1 FROM some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
-
-
-#
-# Bug#23556 TRUNCATE TABLE still maps to DELETE
-#
-CREATE USER bug23556@localhost;
-CREATE DATABASE bug23556;
-GRANT SELECT ON bug23556.* TO bug23556@localhost;
-connect (bug23556,localhost,bug23556,,bug23556);
-
-connection default;
-USE bug23556;
-CREATE TABLE t1 (a INT PRIMARY KEY); INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
-GRANT DELETE ON t1 TO bug23556@localhost;
-
-connection bug23556;
-USE bug23556;
---error ER_TABLEACCESS_DENIED_ERROR
-TRUNCATE t1;
-
-connection default;
-USE bug23556;
-REVOKE DELETE ON t1 FROM bug23556@localhost;
-GRANT DROP ON t1 TO bug23556@localhost;
-
-connection bug23556;
-USE bug23556;
-TRUNCATE t1;
-
-connection default;
-USE bug23556;
-DROP TABLE t1;
-USE test;
-DROP DATABASE bug23556;
-DROP USER bug23556@localhost;
-connection default;
-disconnect bug23556;
-
-
-#
-# Bug#6774 Replication fails with Wrong usage of DB GRANT and GLOBAL PRIVILEGES
-#
-# Check if GRANT ... ON * ... fails when no database is selected
-connect (con1, localhost, root,,*NO-ONE*);
-connection con1;
---error ER_NO_DB_ERROR
-GRANT PROCESS ON * TO user@localhost;
-disconnect con1;
-connection default;
-
-
-#
-# Bug#9504 Stored procedures: execute privilege doesn't make 'use database'
-# okay.
-#
-
-# Prepare.
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest1;
-DROP DATABASE IF EXISTS mysqltest2;
-DROP DATABASE IF EXISTS mysqltest3;
-DROP DATABASE IF EXISTS mysqltest4;
---enable_warnings
-
-CREATE DATABASE mysqltest1;
-CREATE DATABASE mysqltest2;
-CREATE DATABASE mysqltest3;
-CREATE DATABASE mysqltest4;
-
-CREATE PROCEDURE mysqltest1.p_def() SQL SECURITY DEFINER
- SELECT 1;
-
-CREATE PROCEDURE mysqltest2.p_inv() SQL SECURITY INVOKER
- SELECT 1;
-
-CREATE FUNCTION mysqltest3.f_def() RETURNS INT SQL SECURITY DEFINER
- RETURN 1;
-
-CREATE FUNCTION mysqltest4.f_inv() RETURNS INT SQL SECURITY INVOKER
- RETURN 1;
-
-GRANT EXECUTE ON PROCEDURE mysqltest1.p_def TO mysqltest_1@localhost;
-GRANT EXECUTE ON PROCEDURE mysqltest2.p_inv TO mysqltest_1@localhost;
-GRANT EXECUTE ON FUNCTION mysqltest3.f_def TO mysqltest_1@localhost;
-GRANT EXECUTE ON FUNCTION mysqltest4.f_inv TO mysqltest_1@localhost;
-
-GRANT ALL PRIVILEGES ON test.* TO mysqltest_1@localhost;
-
-# Test.
-
---connect (bug9504_con1,localhost,mysqltest_1,,)
-
-# - Check that we can switch to the db;
-
-use mysqltest1;
-
-use mysqltest2;
-
-use mysqltest3;
-
-use mysqltest4;
-
-# - Check that we can call stored routines;
-
-use test;
-
-CALL mysqltest1.p_def();
-
-CALL mysqltest2.p_inv();
-
-SELECT mysqltest3.f_def();
-
-SELECT mysqltest4.f_inv();
-
-# Cleanup.
-
---connection default
---disconnect bug9504_con1
-
-DROP DATABASE mysqltest1;
-DROP DATABASE mysqltest2;
-DROP DATABASE mysqltest3;
-DROP DATABASE mysqltest4;
-
-DROP USER mysqltest_1@localhost;
-
-
-#
-# Bug#27337 Privileges are not restored properly.
-#
-# Actually, the patch for this bugs fixes two problems. So, here are two test
-# cases.
-
-# Test case 1: privileges are not restored properly after calling a stored
-# routine defined with SQL SECURITY INVOKER clause.
-
-# Prepare.
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest1;
-DROP DATABASE IF EXISTS mysqltest2;
---enable_warnings
-
-CREATE DATABASE mysqltest1;
-CREATE DATABASE mysqltest2;
-
-GRANT ALL PRIVILEGES ON mysqltest1.* TO mysqltest_1@localhost;
-GRANT SELECT ON mysqltest2.* TO mysqltest_1@localhost;
-
-CREATE PROCEDURE mysqltest1.p1() SQL SECURITY INVOKER
- SELECT 1;
-
-# Test.
-
---connect (bug27337_con1,localhost,mysqltest_1,,mysqltest2)
-
---error ER_TABLEACCESS_DENIED_ERROR
-CREATE TABLE t1(c INT);
-
-CALL mysqltest1.p1();
-
---error ER_TABLEACCESS_DENIED_ERROR
-CREATE TABLE t1(c INT);
-
---disconnect bug27337_con1
-
---connect (bug27337_con2,localhost,mysqltest_1,,mysqltest2)
-
---error ER_TABLEACCESS_DENIED_ERROR
-CREATE TABLE t1(c INT);
-
-SHOW TABLES;
-
-# Cleanup.
-
---connection default
---disconnect bug27337_con2
-
-DROP DATABASE mysqltest1;
-DROP DATABASE mysqltest2;
-
-DROP USER mysqltest_1@localhost;
-
-# Test case 2: privileges are not checked properly for prepared statements.
-
-# Prepare.
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest1;
-DROP DATABASE IF EXISTS mysqltest2;
---enable_warnings
-
-CREATE DATABASE mysqltest1;
-CREATE DATABASE mysqltest2;
-
-CREATE TABLE mysqltest1.t1(c INT);
-CREATE TABLE mysqltest2.t2(c INT);
-
-GRANT SELECT ON mysqltest1.t1 TO mysqltest_1@localhost;
-GRANT SELECT ON mysqltest2.t2 TO mysqltest_2@localhost;
-
-# Test.
-
---connect (bug27337_con1,localhost,mysqltest_1,,mysqltest1)
-
-SHOW TABLES FROM mysqltest1;
-
-PREPARE stmt1 FROM 'SHOW TABLES FROM mysqltest1';
-
-EXECUTE stmt1;
-
---connect (bug27337_con2,localhost,mysqltest_2,,mysqltest2)
-
-SHOW COLUMNS FROM mysqltest2.t2;
-
-PREPARE stmt2 FROM 'SHOW COLUMNS FROM mysqltest2.t2';
-
-EXECUTE stmt2;
-
---connection default
-
-REVOKE SELECT ON mysqltest1.t1 FROM mysqltest_1@localhost;
-REVOKE SELECT ON mysqltest2.t2 FROM mysqltest_2@localhost;
-
---connection bug27337_con1
-
---error ER_DBACCESS_DENIED_ERROR
-SHOW TABLES FROM mysqltest1;
-
---error ER_DBACCESS_DENIED_ERROR
-EXECUTE stmt1;
-
---connection bug27337_con2
-
---error ER_TABLEACCESS_DENIED_ERROR
-SHOW COLUMNS FROM mysqltest2.t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-EXECUTE stmt2;
-
-# Cleanup.
-
---connection default
-
---disconnect bug27337_con1
---disconnect bug27337_con2
-
-DROP DATABASE mysqltest1;
-DROP DATABASE mysqltest2;
-
-DROP USER mysqltest_1@localhost;
-DROP USER mysqltest_2@localhost;
-
-#
-# Bug#27878 Unchecked privileges on a view referring to a table from another
-# database.
-#
-USE test;
-CREATE TABLE t1 (f1 int, f2 int);
-INSERT INTO t1 VALUES(1,1), (2,2);
-CREATE DATABASE db27878;
-GRANT UPDATE(f1) ON t1 TO 'mysqltest_1'@'localhost';
-GRANT SELECT ON `test`.* TO 'mysqltest_1'@'localhost';
-GRANT ALL ON db27878.* TO 'mysqltest_1'@'localhost';
-USE db27878;
-CREATE SQL SECURITY INVOKER VIEW db27878.v1 AS SELECT * FROM test.t1;
-connect (user1,localhost,mysqltest_1,,test);
-connection user1;
-USE db27878;
---error 1356
-UPDATE v1 SET f2 = 4;
-SELECT * FROM test.t1;
-disconnect user1;
-connection default;
-REVOKE UPDATE (f1) ON `test`.`t1` FROM 'mysqltest_1'@'localhost';
-REVOKE SELECT ON `test`.* FROM 'mysqltest_1'@'localhost';
-REVOKE ALL ON db27878.* FROM 'mysqltest_1'@'localhost';
-DROP USER mysqltest_1@localhost;
-DROP DATABASE db27878;
-USE test;
-DROP TABLE t1;
-
---echo #
---echo # Bug#33275 Server crash when creating temporary table mysql.user
---echo #
-CREATE TEMPORARY TABLE mysql.user (id INT);
-FLUSH PRIVILEGES;
-DROP TABLE mysql.user;
-
-
-#
-# Bug#33201 Crash occurs when granting update privilege on one column of a view
-#
-drop table if exists test;
-drop function if exists test_function;
-drop view if exists v1;
-create table test (col1 varchar(30));
-delimiter |;
-create function test_function() returns varchar(30)
-begin
- declare tmp varchar(30);
- select col1 from test limit 1 into tmp;
- return '1';
-end|
-delimiter ;|
-create view v1 as select test.* from test where test.col1=test_function();
-grant update (col1) on v1 to 'greg'@'localhost';
-drop user 'greg'@'localhost';
-drop view v1;
-drop table test;
-drop function test_function;
-
-#
-# Bug#41456 SET PASSWORD hates CURRENT_USER()
-#
-SELECT CURRENT_USER();
-SET PASSWORD FOR CURRENT_USER() = PASSWORD("admin");
-SET PASSWORD FOR CURRENT_USER() = PASSWORD("");
-
-#
-# Bug#57952: privilege change is not taken into account by EXECUTE.
-#
-
---echo
---echo # Bug#57952
---echo
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest1;
-DROP DATABASE IF EXISTS mysqltest2;
---enable_warnings
-
-CREATE DATABASE mysqltest1;
-CREATE DATABASE mysqltest2;
-
-use mysqltest1;
-CREATE TABLE t1(a INT, b INT);
-INSERT INTO t1 VALUES (1, 1);
-
-CREATE TABLE t2(a INT);
-INSERT INTO t2 VALUES (2);
-
-CREATE TABLE mysqltest2.t3(a INT);
-INSERT INTO mysqltest2.t3 VALUES (4);
-
-CREATE USER testuser@localhost;
-GRANT CREATE ROUTINE, EXECUTE ON mysqltest1.* TO testuser@localhost;
-GRANT SELECT(b) ON t1 TO testuser@localhost;
-GRANT SELECT ON t2 TO testuser@localhost;
-GRANT SELECT ON mysqltest2.* TO testuser@localhost;
-
---connect (bug57952_con1,localhost,testuser,,mysqltest1)
-PREPARE s1 FROM 'SELECT b FROM t1';
-PREPARE s2 FROM 'SELECT a FROM t2';
-PREPARE s3 FROM 'SHOW TABLES FROM mysqltest2';
-
-CREATE PROCEDURE p1() SELECT b FROM t1;
-CREATE PROCEDURE p2() SELECT a FROM t2;
-CREATE PROCEDURE p3() SHOW TABLES FROM mysqltest2;
-
-CALL p1;
-CALL p2;
-CALL p3;
-
---connection default
-REVOKE SELECT ON t1 FROM testuser@localhost;
-GRANT SELECT(a) ON t1 TO testuser@localhost;
-REVOKE SELECT ON t2 FROM testuser@localhost;
-REVOKE SELECT ON mysqltest2.* FROM testuser@localhost;
-
---connection bug57952_con1
---echo # - Check column-level privileges...
---error ER_COLUMNACCESS_DENIED_ERROR
-EXECUTE s1;
-
---error ER_COLUMNACCESS_DENIED_ERROR
-SELECT b FROM t1;
-
---error ER_COLUMNACCESS_DENIED_ERROR
-EXECUTE s1;
-
---error ER_COLUMNACCESS_DENIED_ERROR
-CALL p1;
-
---echo # - Check table-level privileges...
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT a FROM t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-EXECUTE s2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-CALL p2;
-
---echo # - Check database-level privileges...
---error ER_DBACCESS_DENIED_ERROR
-SHOW TABLES FROM mysqltest2;
-
---error ER_DBACCESS_DENIED_ERROR
-EXECUTE s3;
-
---error ER_DBACCESS_DENIED_ERROR
-CALL p3;
-
---connection default
---disconnect bug57952_con1
-DROP DATABASE mysqltest1;
-DROP DATABASE mysqltest2;
-DROP USER testuser@localhost;
-use test;
---echo
-
-
---echo #
---echo # Test for bug #36544 "DROP USER does not remove stored function
---echo # privileges".
---echo #
-create database mysqltest1;
-create function mysqltest1.f1() returns int return 0;
-create procedure mysqltest1.p1() begin end;
---echo #
---echo # 1) Check that DROP USER properly removes privileges on both
---echo # stored procedures and functions.
---echo #
-create user mysqluser1@localhost;
-grant execute on function mysqltest1.f1 to mysqluser1@localhost;
-grant execute on procedure mysqltest1.p1 to mysqluser1@localhost;
-
---echo # Quick test that granted privileges are properly reflected
---echo # in privilege tables and in in-memory structures.
-show grants for mysqluser1@localhost;
-select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser1' and host='localhost';
---connect (bug36544_con1,localhost,mysqluser1,,)
-call mysqltest1.p1();
-select mysqltest1.f1();
-
---connection default
-drop user mysqluser1@localhost;
-
---echo #
---echo # Test that dropping of user is properly reflected in
---echo # both privilege tables and in in-memory structures.
---echo #
---connection bug36544_con1
---echo # The connection cold be alive but should not be able to
---echo # access to any of the stored routines.
---error ER_PROCACCESS_DENIED_ERROR
-call mysqltest1.p1();
---error ER_PROCACCESS_DENIED_ERROR
-select mysqltest1.f1();
---disconnect bug36544_con1
-
---connection default
---echo #
---echo # Now create user with the same name and check that he
---echo # has not inherited privileges.
-create user mysqluser1@localhost;
-show grants for mysqluser1@localhost;
-select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser1' and host='localhost';
---connect (bug36544_con2,localhost,mysqluser1,,)
---echo # Newly created user should not be able to access any of the routines.
---error ER_PROCACCESS_DENIED_ERROR
-call mysqltest1.p1();
---error ER_PROCACCESS_DENIED_ERROR
-select mysqltest1.f1();
---connection default
-
---echo #
---echo # 2) Check that RENAME USER properly updates privileges on both
---echo # stored procedures and functions.
---echo #
-grant execute on function mysqltest1.f1 to mysqluser1@localhost;
-grant execute on procedure mysqltest1.p1 to mysqluser1@localhost;
---echo #
---echo # Create one more user to make in-memory hashes non-trivial.
---echo # User names 'mysqluser11' and 'mysqluser10' were selected
---echo # to trigger bug discovered during code inspection.
-create user mysqluser11@localhost;
-grant execute on function mysqltest1.f1 to mysqluser11@localhost;
-grant execute on procedure mysqltest1.p1 to mysqluser11@localhost;
---echo # Also create a couple of tables to test for another bug
---echo # discovered during code inspection (again table names were
---echo # chosen especially to trigger the bug).
-create table mysqltest1.t11 (i int);
-create table mysqltest1.t22 (i int);
-grant select on mysqltest1.t22 to mysqluser1@localhost;
-grant select on mysqltest1.t11 to mysqluser1@localhost;
-
---echo # Quick test that granted privileges are properly reflected
---echo # in privilege tables and in in-memory structures.
-show grants for mysqluser1@localhost;
-select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser1' and host='localhost';
-select db, table_name, table_priv from mysql.tables_priv where user='mysqluser1' and host='localhost';
---connection bug36544_con2
-call mysqltest1.p1();
-select mysqltest1.f1();
-select * from mysqltest1.t11;
-select * from mysqltest1.t22;
-
---connection default
-rename user mysqluser1@localhost to mysqluser10@localhost;
-
---echo #
---echo # Test that there are no privileges left for mysqluser1.
---echo #
---connection bug36544_con2
---echo # The connection cold be alive but should not be able to
---echo # access to any of the stored routines or tables.
---error ER_PROCACCESS_DENIED_ERROR
-call mysqltest1.p1();
---error ER_PROCACCESS_DENIED_ERROR
-select mysqltest1.f1();
---error ER_TABLEACCESS_DENIED_ERROR
-select * from mysqltest1.t11;
---error ER_TABLEACCESS_DENIED_ERROR
-select * from mysqltest1.t22;
---disconnect bug36544_con2
-
---connection default
---echo #
---echo # Now create user with the old name and check that he
---echo # has not inherited privileges.
-create user mysqluser1@localhost;
-show grants for mysqluser1@localhost;
-select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser1' and host='localhost';
-select db, table_name, table_priv from mysql.tables_priv where user='mysqluser1' and host='localhost';
---connect (bug36544_con3,localhost,mysqluser1,,)
---echo # Newly created user should not be able to access to any of the
---echo # stored routines or tables.
---error ER_PROCACCESS_DENIED_ERROR
-call mysqltest1.p1();
---error ER_PROCACCESS_DENIED_ERROR
-select mysqltest1.f1();
---error ER_TABLEACCESS_DENIED_ERROR
-select * from mysqltest1.t11;
---error ER_TABLEACCESS_DENIED_ERROR
-select * from mysqltest1.t22;
---disconnect bug36544_con3
-
---connection default
---echo #
---echo # Now check that privileges became associated with a new user
---echo # name - mysqluser10.
---echo #
-show grants for mysqluser10@localhost;
-select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser10' and host='localhost';
-select db, table_name, table_priv from mysql.tables_priv where user='mysqluser10' and host='localhost';
---connect (bug36544_con4,localhost,mysqluser10,,)
-call mysqltest1.p1();
-select mysqltest1.f1();
-select * from mysqltest1.t11;
-select * from mysqltest1.t22;
---disconnect bug36544_con4
-
---connection default
---echo #
---echo # Clean-up.
-drop user mysqluser1@localhost;
-drop user mysqluser10@localhost;
-drop user mysqluser11@localhost;
-drop database mysqltest1;
-
-
---echo End of 5.0 tests
-
-#
-# Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte
-#
-set names utf8;
-grant select on test.* to юзер_юзер@localhost;
---exec $MYSQL --default-character-set=utf8 --user=юзер_юзер -e "select user()"
-revoke all on test.* from юзер_юзер@localhost;
-drop user юзер_юзер@localhost;
---error ER_WRONG_STRING_LENGTH
-grant select on test.* to очень_длинный_юзер890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890@localhost;
-set names default;
-
-#
-# Bug#20901 CREATE privilege is enough to insert into a table
-#
-
-create database mysqltest;
-use mysqltest;
-
-grant create on mysqltest.* to mysqltest@localhost;
-create table t1 (i INT);
-
-connect (user1,localhost,mysqltest,,mysqltest);
-connection user1;
-# show we don't have INSERT
---error ER_TABLEACCESS_DENIED_ERROR
-insert into t1 values (1);
-# show we have CREATE
-create table t2 (i INT);
-create table t4 (i INT);
-
-connection default;
-grant select, insert on mysqltest.t2 to mysqltest@localhost;
-grant insert on mysqltest.t4 to mysqltest@localhost;
-# to specify ACLs for non-existent objects, must explictly |CREATE
-grant create, insert on mysqltest.t5 to mysqltest@localhost;
-grant create, insert on mysqltest.t6 to mysqltest@localhost;
-flush privileges;
-
-connection user1;
-insert into t2 values (1);
-
-
-# CREATE IF NOT EXISTS...SELECT, t1 exists, no INSERT, must fail
---error ER_TABLEACCESS_DENIED_ERROR
-create table if not exists t1 select * from t2;
-
-# CREATE IF NOT EXISTS...SELECT, no t3 yet, no INSERT, must fail
---error ER_TABLEACCESS_DENIED_ERROR
-create table if not exists t3 select * from t2;
-
-# CREATE IF NOT EXISTS...SELECT, t4 exists, have INSERT, must succeed
-create table if not exists t4 select * from t2;
-
-# CREATE IF NOT EXISTS...SELECT, no t5 yet, have INSERT, must succeed
-create table if not exists t5 select * from t2;
-
-
-# CREATE...SELECT, no t6 yet, have INSERT, must succeed
-create table t6 select * from t2;
-
-# CREATE...SELECT, no t7 yet, no INSERT, must fail
---error ER_TABLEACCESS_DENIED_ERROR
-create table t7 select * from t2;
-
-# CREATE...SELECT, t4 exists, have INSERT, must still fail (exists)
---error 1050
-create table t4 select * from t2;
-
-# CREATE...SELECT, t1 exists, no INSERT, must fail
---error ER_TABLEACCESS_DENIED_ERROR
-create table t1 select * from t2;
-
-
-connection default;
-drop table t1,t2,t4,t5,t6;
-
-revoke create on mysqltest.* from mysqltest@localhost;
-revoke select, insert on mysqltest.t2 from mysqltest@localhost;
-revoke insert on mysqltest.t4 from mysqltest@localhost;
-revoke create, insert on mysqltest.t5 from mysqltest@localhost;
-revoke create, insert on mysqltest.t6 from mysqltest@localhost;
-drop user mysqltest@localhost;
-
-disconnect user1;
-drop database mysqltest;
-use test;
-
-
-#
-# Bug#16470 crash on grant if old grant tables
-#
---echo FLUSH PRIVILEGES without procs_priv table.
-RENAME TABLE mysql.procs_priv TO mysql.procs_gone;
-FLUSH PRIVILEGES;
---echo Assigning privileges without procs_priv table.
-CREATE DATABASE mysqltest1;
-CREATE PROCEDURE mysqltest1.test() SQL SECURITY DEFINER
- SELECT 1;
-CREATE FUNCTION mysqltest1.test() RETURNS INT RETURN 1;
---error ER_NO_SUCH_TABLE
-GRANT EXECUTE ON FUNCTION mysqltest1.test TO mysqltest_1@localhost;
-GRANT ALL PRIVILEGES ON test.* TO mysqltest_1@localhost;
-CALL mysqltest1.test();
-DROP DATABASE mysqltest1;
-RENAME TABLE mysql.procs_gone TO mysql.procs_priv;
-DROP USER mysqltest_1@localhost;
-FLUSH PRIVILEGES;
-
-
-#
-# Bug#33464 DROP FUNCTION caused a crash.
-#
-CREATE DATABASE dbbug33464;
-CREATE USER 'userbug33464'@'localhost';
-
-GRANT CREATE ROUTINE ON dbbug33464.* TO 'userbug33464'@'localhost';
-
---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
-connect (connbug33464, localhost, userbug33464, , dbbug33464);
---source suite/funcs_1/include/show_connection.inc
-
-delimiter //;
-CREATE PROCEDURE sp3(v1 char(20))
-BEGIN
- SELECT * from dbbug33464.t6 where t6.f2= 'xyz';
-END//
-delimiter ;//
-
-delimiter //;
-CREATE FUNCTION fn1() returns char(50) SQL SECURITY INVOKER
-BEGIN
- return 1;
-END//
-delimiter ;//
-
-delimiter //;
-CREATE FUNCTION fn2() returns char(50) SQL SECURITY DEFINER
-BEGIN
- return 2;
-END//
-delimiter ;//
-
-disconnect connbug33464;
-
-# cleanup
-connection default;
-USE dbbug33464;
---source suite/funcs_1/include/show_connection.inc
-
-SELECT fn1();
-SELECT fn2();
-
---error 0, ER_CANNOT_USER
-DROP USER 'userbug33464'@'localhost';
-
-DROP FUNCTION fn1;
-DROP FUNCTION fn2;
-DROP PROCEDURE sp3;
-
---error 0, ER_CANNOT_USER
-DROP USER 'userbug33464'@'localhost';
-
-USE test;
-DROP DATABASE dbbug33464;
-
-
-SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
-
-#
-# Bug#44658 Create procedure makes server crash when user does not have ALL privilege
-#
-CREATE USER user1;
-CREATE USER user2;
-GRANT CREATE ON db1.* TO 'user1'@'localhost';
-GRANT CREATE ROUTINE ON db1.* TO 'user1'@'localhost';
-GRANT CREATE ON db1.* TO 'user2'@'%';
-GRANT CREATE ROUTINE ON db1.* TO 'user2'@'%';
-FLUSH PRIVILEGES;
-SHOW GRANTS FOR 'user1'@'localhost';
-connect (con1,localhost,user1,,);
---echo ** Connect as user1 and create a procedure.
---echo ** The creation will imply implicitly assigned
---echo ** EXECUTE and ALTER ROUTINE privileges to
---echo ** the current user user1@localhost.
-SELECT @@GLOBAL.sql_mode;
-SELECT @@SESSION.sql_mode;
-CREATE DATABASE db1;
-DELIMITER ||;
-CREATE PROCEDURE db1.proc1(p1 INT)
- BEGIN
- SET @x = 0;
- REPEAT SET @x = @x + 1; UNTIL @x > p1 END REPEAT;
- END ;||
-DELIMITER ;||
-
-connect (con2,localhost,user2,,);
---echo ** Connect as user2 and create a procedure.
---echo ** Implicitly assignment of privileges will
---echo ** fail because the user2@localhost is an
---echo ** unknown user.
-DELIMITER ||;
-CREATE PROCEDURE db1.proc2(p1 INT)
- BEGIN
- SET @x = 0;
- REPEAT SET @x = @x + 1; UNTIL @x > p1 END REPEAT;
- END ;||
-DELIMITER ;||
-
-connection default;
-SHOW GRANTS FOR 'user1'@'localhost';
-SHOW GRANTS FOR 'user2';
-disconnect con1;
-disconnect con2;
-DROP PROCEDURE db1.proc1;
-DROP PROCEDURE db1.proc2;
-REVOKE ALL ON db1.* FROM 'user1'@'localhost';
-REVOKE ALL ON db1.* FROM 'user2'@'%';
-DROP USER 'user1';
-DROP USER 'user1'@'localhost';
-DROP USER 'user2';
-DROP DATABASE db1;
-
-
---echo #
---echo # Bug #25863 No database selected error, but documentation
---echo # says * for global allowed
---echo #
-
-connect(conn1,localhost,root,,*NO-ONE*);
-
---error ER_NO_DB_ERROR
-GRANT ALL ON * TO mysqltest_1;
-
-GRANT ALL ON *.* TO mysqltest_1;
-SHOW GRANTS FOR mysqltest_1;
-DROP USER mysqltest_1;
-
-USE test;
-
-GRANT ALL ON * TO mysqltest_1;
-SHOW GRANTS FOR mysqltest_1;
-DROP USER mysqltest_1;
-
-GRANT ALL ON *.* TO mysqltest_1;
-SHOW GRANTS FOR mysqltest_1;
-DROP USER mysqltest_1;
-
-connection default;
-disconnect conn1;
-
-
-#
-# Bug #53371: COM_FIELD_LIST can be abused to bypass table level grants.
-#
-
-CREATE DATABASE db1;
-CREATE DATABASE db2;
-GRANT SELECT ON db1.* to 'testbug'@localhost;
-USE db2;
-CREATE TABLE t1 (a INT);
-USE test;
-connect (con1,localhost,testbug,,db1);
---error ER_NO_SUCH_TABLE
-SELECT * FROM `../db2/tb2`;
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM `../db2`.tb2;
---error ER_WRONG_TABLE_NAME
-SELECT * FROM `#mysql50#/../db2/tb2`;
-connection default;
-disconnect con1;
-DROP USER 'testbug'@localhost;
-DROP TABLE db2.t1;
-DROP DATABASE db1;
-DROP DATABASE db2;
-
---echo #
---echo # Bug #36742
---echo #
-grant usage on Foo.* to myuser@Localhost identified by 'foo';
-grant select on Foo.* to myuser@localhost;
-select host,user from mysql.user where User='myuser';
-revoke select on Foo.* from myuser@localhost;
-delete from mysql.user where User='myuser';
-flush privileges;
-
---echo #########################################################################
---echo #
---echo # Bug#38347: ALTER ROUTINE privilege allows SHOW CREATE TABLE.
---echo #
---echo #########################################################################
-
---echo
---echo # --
---echo # -- Prepare the environment.
---echo # --
-
-DELETE FROM mysql.user WHERE User LIKE 'mysqltest_%';
-DELETE FROM mysql.db WHERE User LIKE 'mysqltest_%';
-DELETE FROM mysql.tables_priv WHERE User LIKE 'mysqltest_%';
-DELETE FROM mysql.columns_priv WHERE User LIKE 'mysqltest_%';
-FLUSH PRIVILEGES;
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest_db1;
---enable_warnings
-
-CREATE DATABASE mysqltest_db1;
-
-CREATE TABLE mysqltest_db1.t1(a INT);
-
---echo
---echo # --
---echo # -- Check that global privileges don't allow SHOW CREATE TABLE.
---echo # --
-
-GRANT EVENT ON mysqltest_db1.* TO mysqltest_u1@localhost;
-GRANT CREATE TEMPORARY TABLES ON mysqltest_db1.* TO mysqltest_u1@localhost;
-GRANT LOCK TABLES ON mysqltest_db1.* TO mysqltest_u1@localhost;
-GRANT ALTER ROUTINE ON mysqltest_db1.* TO mysqltest_u1@localhost;
-GRANT CREATE ROUTINE ON mysqltest_db1.* TO mysqltest_u1@localhost;
-GRANT EXECUTE ON mysqltest_db1.* TO mysqltest_u1@localhost;
-
-GRANT FILE ON *.* TO mysqltest_u1@localhost;
-GRANT CREATE USER ON *.* TO mysqltest_u1@localhost;
-GRANT PROCESS ON *.* TO mysqltest_u1@localhost;
-GRANT RELOAD ON *.* TO mysqltest_u1@localhost;
-GRANT REPLICATION CLIENT ON *.* TO mysqltest_u1@localhost;
-GRANT REPLICATION SLAVE ON *.* TO mysqltest_u1@localhost;
-GRANT SHOW DATABASES ON *.* TO mysqltest_u1@localhost;
-GRANT SHUTDOWN ON *.* TO mysqltest_u1@localhost;
-GRANT USAGE ON *.* TO mysqltest_u1@localhost;
-
---echo
-SHOW GRANTS FOR mysqltest_u1@localhost;
-
---connect (con1,localhost,mysqltest_u1,,mysqltest_db1)
---connection con1
-
---echo
---error ER_TABLEACCESS_DENIED_ERROR
-SHOW CREATE TABLE t1;
-
---connection default
-
---disconnect con1
-
---echo
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
-SHOW GRANTS FOR mysqltest_u1@localhost;
-
---echo
---echo # --
---echo # -- Check that global SELECT allows SHOW CREATE TABLE.
---echo # --
-
---echo
-GRANT SELECT ON mysqltest_db1.* TO mysqltest_u1@localhost;
-
---source include/bug38347.inc
-
---echo
---echo # --
---echo # -- Check that global INSERT allows SHOW CREATE TABLE.
---echo # --
-
---echo
-GRANT INSERT ON mysqltest_db1.* TO mysqltest_u1@localhost;
-
---source include/bug38347.inc
-
---echo
---echo # --
---echo # -- Check that global UPDATE allows SHOW CREATE TABLE.
---echo # --
-
---echo
-GRANT UPDATE ON mysqltest_db1.* TO mysqltest_u1@localhost;
-
---source include/bug38347.inc
-
---echo
---echo # --
---echo # -- Check that global DELETE allows SHOW CREATE TABLE.
---echo # --
-
---echo
-GRANT DELETE ON mysqltest_db1.* TO mysqltest_u1@localhost;
-
---source include/bug38347.inc
-
---echo
---echo # --
---echo # -- Check that global CREATE allows SHOW CREATE TABLE.
---echo # --
-
---echo
-GRANT CREATE ON mysqltest_db1.* TO mysqltest_u1@localhost;
-
---source include/bug38347.inc
-
---echo
---echo # --
---echo # -- Check that global DROP allows SHOW CREATE TABLE.
---echo # --
-
---echo
-GRANT DROP ON mysqltest_db1.* TO mysqltest_u1@localhost;
-
---source include/bug38347.inc
-
---echo
---echo # --
---echo # -- Check that global ALTER allows SHOW CREATE TABLE.
---echo # --
-
---echo
-GRANT ALTER ON mysqltest_db1.* TO mysqltest_u1@localhost;
-
---source include/bug38347.inc
-
---echo
---echo # --
---echo # -- Check that global INDEX allows SHOW CREATE TABLE.
---echo # --
-
---echo
-GRANT INDEX ON mysqltest_db1.* TO mysqltest_u1@localhost;
-
---source include/bug38347.inc
-
---echo
---echo # --
---echo # -- Check that global REFERENCES allows SHOW CREATE TABLE.
---echo # --
-
---echo
-GRANT REFERENCES ON mysqltest_db1.* TO mysqltest_u1@localhost;
-
---source include/bug38347.inc
-
---echo
---echo # --
---echo # -- Check that global GRANT OPTION allows SHOW CREATE TABLE.
---echo # --
-
---echo
-GRANT GRANT OPTION ON mysqltest_db1.* TO mysqltest_u1@localhost;
-
---source include/bug38347.inc
-
---echo
---echo # --
---echo # -- Check that global CREATE VIEW allows SHOW CREATE TABLE.
---echo # --
-
---echo
-GRANT CREATE VIEW ON mysqltest_db1.* TO mysqltest_u1@localhost;
-
---source include/bug38347.inc
-
---echo
---echo # --
---echo # -- Check that global SHOW VIEW allows SHOW CREATE TABLE.
---echo # --
-
---echo
-GRANT SHOW VIEW ON mysqltest_db1.* TO mysqltest_u1@localhost;
-
---source include/bug38347.inc
-
---echo
---echo # --
---echo # -- Check that table-level SELECT allows SHOW CREATE TABLE.
---echo # --
-
---echo
-GRANT SELECT ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
-
---source include/bug38347.inc
-
---echo
---echo # --
---echo # -- Check that table-level INSERT allows SHOW CREATE TABLE.
---echo # --
-
---echo
-GRANT INSERT ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
-
---source include/bug38347.inc
-
---echo
---echo # --
---echo # -- Check that table-level UPDATE allows SHOW CREATE TABLE.
---echo # --
-
---echo
-GRANT UPDATE ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
-
---source include/bug38347.inc
-
---echo
---echo # --
---echo # -- Check that table-level DELETE allows SHOW CREATE TABLE.
---echo # --
-
---echo
-GRANT DELETE ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
-
---source include/bug38347.inc
-
---echo
---echo # --
---echo # -- Check that table-level CREATE allows SHOW CREATE TABLE.
---echo # --
-
---echo
-GRANT CREATE ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
-
---source include/bug38347.inc
-
---echo
---echo # --
---echo # -- Check that table-level DROP allows SHOW CREATE TABLE.
---echo # --
-
---echo
-GRANT DROP ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
-
---source include/bug38347.inc
-
---echo
---echo # --
---echo # -- Check that table-level ALTER allows SHOW CREATE TABLE.
---echo # --
-
---echo
-GRANT ALTER ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
-
---source include/bug38347.inc
-
---echo
---echo # --
---echo # -- Check that table-level INDEX allows SHOW CREATE TABLE.
---echo # --
-
---echo
-GRANT INDEX ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
-
---source include/bug38347.inc
-
---echo
---echo # --
---echo # -- Check that table-level REFERENCES allows SHOW CREATE TABLE.
---echo # --
-
---echo
-GRANT REFERENCES ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
-
---source include/bug38347.inc
-
---echo
---echo # --
---echo # -- Check that table-level GRANT OPTION allows SHOW CREATE TABLE.
---echo # --
-
---echo
-GRANT GRANT OPTION ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
-
---source include/bug38347.inc
-
---echo
---echo # --
---echo # -- Check that table-level CREATE VIEW allows SHOW CREATE TABLE.
---echo # --
-
---echo
-GRANT CREATE VIEW ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
-
---source include/bug38347.inc
-
---echo
---echo # --
---echo # -- Check that table-level SHOW VIEW allows SHOW CREATE TABLE.
---echo # --
-
---echo
-GRANT SHOW VIEW ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
-
---source include/bug38347.inc
-
---echo
---echo # --
---echo # -- Cleanup.
---echo # --
-
---echo
-DROP DATABASE mysqltest_db1;
-
-DROP USER mysqltest_u1@localhost;
-
---echo
---echo # End of Bug#38347.
---echo
-
-
---echo #
---echo # BUG#11759114 - '51401: GRANT TREATS NONEXISTENT FUNCTIONS/PRIVILEGES
---echo # DIFFERENTLY'.
---echo #
---disable_warnings
-drop database if exists mysqltest_db1;
---enable_warnings
-create database mysqltest_db1;
-create user mysqltest_u1;
---echo # Both GRANT statements below should fail with the same error.
---error ER_SP_DOES_NOT_EXIST
-grant execute on function mysqltest_db1.f1 to mysqltest_u1;
---error ER_SP_DOES_NOT_EXIST
-grant execute on procedure mysqltest_db1.p1 to mysqltest_u1;
---echo # Let us show that GRANT behaviour for routines is consistent
---echo # with GRANT behaviour for tables. Attempt to grant privilege
---echo # on non-existent table also results in an error.
---error ER_NO_SUCH_TABLE
-grant select on mysqltest_db1.t1 to mysqltest_u1;
-show grants for mysqltest_u1;
-drop database mysqltest_db1;
-drop user mysqltest_u1;
-
-
---echo #
---echo # Bug#12766319 - 61865: RENAME USER DOES NOT WORK CORRECTLY -
---echo # REQUIRES FLUSH PRIVILEGES
---echo #
-
-CREATE USER foo@'127.0.0.1';
-GRANT ALL ON *.* TO foo@'127.0.0.1';
-
---echo # First attempt, should connect successfully
-connect (conn1, '127.0.0.1', foo,,test);
-SELECT user(), current_user();
-
---echo # Rename the user
-RENAME USER foo@'127.0.0.1' to foo@'127.0.0.0/255.0.0.0';
-
---echo # Second attempt, should connect successfully as its valid mask
---echo # This was failing without fix
-connect (conn2, '127.0.0.1', foo,,test);
-SELECT user(), current_user();
-
---echo # Rename the user back to original
-RENAME USER foo@'127.0.0.0/255.0.0.0' to foo@'127.0.0.1';
-
---echo # Third attempt, should connect successfully
-connect (conn3, '127.0.0.1', foo,,test);
-SELECT user(), current_user();
-
---echo # Clean-up
-connection default;
-disconnect conn1;
-disconnect conn2;
-disconnect conn3;
-DROP USER foo@'127.0.0.1';
-
---echo # End of Bug#12766319
-
-
---echo #
---echo # Bug#11756966 - 48958: STORED PROCEDURES CAN BE LEVERAGED TO BYPASS
---echo # DATABASE SECURITY
---echo #
-
---disable_warnings
-DROP DATABASE IF EXISTS secret;
-DROP DATABASE IF EXISTS no_such_db;
---enable_warnings
-
-CREATE DATABASE secret;
-GRANT USAGE ON *.* TO untrusted@localhost;
-
-connect (con1, localhost, untrusted);
-SHOW GRANTS;
-SHOW DATABASES;
-
---echo # Both statements below should fail with the same error.
---echo # They used to give different errors, thereby
---echo # hinting that the secret database exists.
---error ER_DBACCESS_DENIED_ERROR
-CREATE PROCEDURE no_such_db.foo() BEGIN END;
---error ER_DBACCESS_DENIED_ERROR
-CREATE PROCEDURE secret.peek_at_secret() BEGIN END;
-
---connection default
-disconnect con1;
-DROP USER untrusted@localhost;
-DROP DATABASE secret;
-
-set GLOBAL sql_mode=default;
-# Wait till we reached the initial number of concurrent sessions
---source include/wait_until_count_sessions.inc
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-10134 Add full support for DEFAULT
---echo #
-
-
-CREATE TABLE t1 (a VARCHAR(30) DEFAULT USER());
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES ();
-GRANT ALL PRIVILEGES ON test.* TO dummy@localhost IDENTIFIED BY 'pwd';
-connect (conn1,localhost,dummy,pwd,test);
-connection conn1;
-INSERT INTO t1 VALUES ();
-connection default;
-disconnect conn1;
-INSERT INTO t1 VALUES ();
-SELECT * FROM t1;
-DROP TABLE t1;
-DROP USER dummy@localhost;
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test
deleted file mode 100644
index 5e8a130feea..00000000000
--- a/mysql-test/t/grant2.test
+++ /dev/null
@@ -1,1019 +0,0 @@
-# Grant tests not performed with embedded server
--- source include/not_embedded.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-
-set GLOBAL sql_mode="";
-set LOCAL sql_mode="";
-SET NAMES binary;
-
-#
-# GRANT tests that require several connections
-# (usually it's GRANT, reconnect as another user, try something)
-#
-
-
-# prepare playground before tests
---disable_warnings
-drop database if exists mysqltest;
-drop database if exists mysqltest_1;
---enable_warnings
-delete from mysql.user where user like 'mysqltest\_%';
-delete from mysql.db where user like 'mysqltest\_%';
-delete from mysql.tables_priv where user like 'mysqltest\_%';
-delete from mysql.columns_priv where user like 'mysqltest\_%';
-flush privileges;
-
-
-grant all privileges on `my\_1`.* to mysqltest_1@localhost with grant option;
-grant create user on *.* to mysqltest_1@localhost;
-create user mysqltest_2@localhost;
-connect (user_a,localhost,mysqltest_1,,);
-connection user_a;
-grant select on `my\_1`.* to mysqltest_2@localhost;
---error ER_DBACCESS_DENIED_ERROR
-grant select on `my\_1`.* to mysqltest_2@localhost identified by 'pass';
-disconnect user_a;
-connection default;
-grant update on mysql.* to mysqltest_1@localhost;
-connect (user_b,localhost,mysqltest_1,,);
-connection user_b;
-grant select on `my\_1`.* to mysqltest_2@localhost identified by 'pass';
-grant select on `my\_1`.* to mysqltest_3@localhost;
-disconnect user_b;
-connection default;
-grant insert on mysql.* to mysqltest_1@localhost;
-connect (user_c,localhost,mysqltest_1,,);
-connection user_c;
-grant select on `my\_1`.* to mysqltest_3@localhost;
-grant select on `my\_1`.* to mysqltest_4@localhost identified by 'pass';
-disconnect user_c;
-connection default;
-delete from mysql.user where user like 'mysqltest\_%';
-delete from mysql.db where user like 'mysqltest\_%';
-delete from mysql.tables_priv where user like 'mysqltest\_%';
-delete from mysql.columns_priv where user like 'mysqltest\_%';
-flush privileges;
-
-#
-# wild_compare fun
-#
-
-grant all privileges on `my\_%`.* to mysqltest_1@localhost with grant option;
-grant create user on *.* to mysqltest_1@localhost;
-connect (user1,localhost,mysqltest_1,,);
-connection user1;
-select current_user();
-grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option;
---error ER_DBACCESS_DENIED_ERROR
-grant all privileges on `my_%`.* to mysqltest_3@localhost with grant option;
-
-#
-# NO_AUTO_CREATE_USER mode
-#
-set @@sql_mode='NO_AUTO_CREATE_USER';
-select @@sql_mode;
-#
-# GRANT without IDENTIFIED BY does not create new users
-#
---error ER_PASSWORD_NO_MATCH
-grant select on `my\_1`.* to mysqltest_4@localhost with grant option;
-grant select on `my\_1`.* to mysqltest_4@localhost identified by 'mypass'
-with grant option;
-disconnect user1;
-connection default;
-show grants for mysqltest_1@localhost;
-show grants for mysqltest_2@localhost;
---error ER_NONEXISTING_GRANT
-show grants for mysqltest_3@localhost;
-delete from mysql.user where user like 'mysqltest\_%';
-delete from mysql.db where user like 'mysqltest\_%';
-flush privileges;
-
-#
-# wild_compare part two - acl_cache
-#
-create database mysqltest_1;
-grant all privileges on `mysqltest\_1`.* to mysqltest_1@localhost with grant option;
-connect (user2,localhost,mysqltest_1,,);
-connection user2;
-select current_user();
-show databases;
---error ER_DBACCESS_DENIED_ERROR
-grant all privileges on `mysqltest_1`.* to mysqltest_1@localhost with grant option;
-disconnect user2;
-connection default;
-show grants for mysqltest_1@localhost;
-delete from mysql.user where user like 'mysqltest\_%';
-delete from mysql.db where user like 'mysqltest\_%';
-drop database mysqltest_1;
-flush privileges;
-
-#
-# Bug#6173 One can circumvent missing UPDATE privilege if he has SELECT and
-# INSERT privilege for table with primary key
-#
-create database mysqltest;
-grant INSERT, SELECT on mysqltest.* to mysqltest_1@localhost;
-flush privileges;
-use mysqltest;
-create table t1 (id int primary key, data varchar(255));
-
-connect (mrbad, localhost, mysqltest_1,,mysqltest);
-connection mrbad;
-show grants for current_user();
-insert into t1 values (1, 'I can''t change it!');
---error ER_TABLEACCESS_DENIED_ERROR
-update t1 set data='I can change it!' where id = 1;
-# This should not be allowed since it too require UPDATE privilege.
---error ER_TABLEACCESS_DENIED_ERROR
-insert into t1 values (1, 'XXX') on duplicate key update data= 'I can change it!';
-select * from t1;
-disconnect mrbad;
-
-connection default;
-drop table t1;
-delete from mysql.user where user like 'mysqltest\_%';
-delete from mysql.db where user like 'mysqltest\_%';
-flush privileges;
-#
-#
-create table t1 (a int, b int);
-grant select (a) on t1 to mysqltest_1@localhost with grant option;
-connect (mrugly, localhost, mysqltest_1,,mysqltest);
-connection mrugly;
---error ER_COLUMNACCESS_DENIED_ERROR
-grant select (a,b) on t1 to mysqltest_2@localhost;
---error ER_TABLEACCESS_DENIED_ERROR
-grant select on t1 to mysqltest_3@localhost;
-disconnect mrugly;
-
-connection default;
-drop table t1;
-delete from mysql.user where user like 'mysqltest\_%';
-delete from mysql.db where user like 'mysqltest\_%';
-delete from mysql.tables_priv where user like 'mysqltest\_%';
-delete from mysql.columns_priv where user like 'mysqltest\_%';
-flush privileges;
-
-drop database mysqltest;
-use test;
-
-
-#
-# Bug#15775 "drop user" command does not refresh acl_check_hosts
-#
-
-# Create some test users
-create user mysqltest_1@host1;
-create user mysqltest_2@host2;
-create user mysqltest_3@host3;
-create user mysqltest_4@host4;
-create user mysqltest_5@host5;
-create user mysqltest_6@host6;
-create user mysqltest_7@host7;
-flush privileges;
-
-# Drop one user
-drop user mysqltest_3@host3;
-
-# This connect failed before fix since the acl_check_hosts list was corrupted by the "drop user"
-connect (con8,127.0.0.1,root,,test,$MASTER_MYPORT,);
-disconnect con8;
-connection default;
-
-# Clean up - Drop all of the remaining users at once
-drop user mysqltest_1@host1, mysqltest_2@host2, mysqltest_4@host4,
- mysqltest_5@host5, mysqltest_6@host6, mysqltest_7@host7;
-
-# Check that it's still possible to connect
-connect (con9,127.0.0.1,root,,test,$MASTER_MYPORT,);
-disconnect con9;
-connection default;
-
-#
-# Bug#16180 Setting SQL_LOG_OFF without SUPER privilege is silently ignored
-#
-create database mysqltest_1;
-grant select, insert, update on `mysqltest\_1`.* to mysqltest_1@localhost;
-connect (con10,localhost,mysqltest_1,,);
-connection con10;
---error ER_SPECIFIC_ACCESS_DENIED_ERROR
-set sql_log_off = 1;
---error ER_SPECIFIC_ACCESS_DENIED_ERROR
-set sql_log_bin = 0;
-disconnect con10;
-connection default;
-delete from mysql.user where user like 'mysqltest\_1';
-delete from mysql.db where user like 'mysqltest\_1';
-drop database mysqltest_1;
-flush privileges;
-
-# End of 4.1 tests
-# Create and drop user
-#
-set sql_mode='maxdb';
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-create table t1(c1 int);
-create table t2(c1 int, c2 int);
-#
-# Three forms of CREATE USER
-create user 'mysqltest_1';
---error ER_CANNOT_USER
-create user 'mysqltest_1';
-create user 'mysqltest_2' identified by 'Mysqltest-2';
-create user 'mysqltest_3' identified by password 'fffffffffffffffffffffffffffffffffffffffff';
-grant select on *.* to 'mysqltest_2';
-grant insert on test.* to 'mysqltest_2';
-grant update on test.t1 to 'mysqltest_2';
-grant update (c2) on test.t2 to 'mysqltest_2';
-select host,user,password from mysql.user where user like 'mysqltest_%' order by host,user,password;
-select host,db,user from mysql.db where user like 'mysqltest_%' order by host,db,user;
-select host,db,user,table_name from mysql.tables_priv where user like 'mysqltest_%' order by host,db,user,table_name;
-select host,db,user,table_name,column_name from mysql.columns_priv where user like 'mysqltest_%' order by host,db,user,table_name,column_name;
-show grants for 'mysqltest_1';
-show grants for 'mysqltest_2';
-#
-# Drop
-drop user 'mysqltest_1';
-select host,user,password from mysql.user where user like 'mysqltest_%' order by host,user,password;
-select host,db,user from mysql.db where user like 'mysqltest_%' order by host,db,user;
-select host,db,user,table_name from mysql.tables_priv where user like 'mysqltest_%' order by host,db,user,table_name;
-select host,db,user,table_name,column_name from mysql.columns_priv where user like 'mysqltest_%' order by host,db,user,table_name,column_name;
---error ER_NONEXISTING_GRANT
-show grants for 'mysqltest_1';
-#
-# Rename
-rename user 'mysqltest_2' to 'mysqltest_1';
-select host,user,password from mysql.user where user like 'mysqltest_%' order by host,user,password;
-select host,db,user from mysql.db where user like 'mysqltest_%' order by host,db,user;
-select host,db,user,table_name from mysql.tables_priv where user like 'mysqltest_%' order by host,db,user,table_name;
-select host,db,user,table_name,column_name from mysql.columns_priv where user like 'mysqltest_%' order by host,db,user,table_name,column_name;
-show grants for 'mysqltest_1';
-drop user 'mysqltest_1', 'mysqltest_3';
---error ER_CANNOT_USER
-drop user 'mysqltest_1';
-#
-# Cleanup
-drop table t1, t2;
-#
-# Add a stray record
-insert into mysql.db set user='mysqltest_1', db='%', host='%';
-flush privileges;
---error ER_NONEXISTING_GRANT
-show grants for 'mysqltest_1';
---error ER_REVOKE_GRANTS
-revoke all privileges, grant option from 'mysqltest_1';
-drop user 'mysqltest_1';
-select host,db,user from mysql.db where user = 'mysqltest_1' order by host,db,user;
-#
-# Add a stray record
-insert into mysql.tables_priv set host='%', db='test', user='mysqltest_1', table_name='t1';
-flush privileges;
---error ER_NONEXISTING_GRANT
-show grants for 'mysqltest_1';
-drop user 'mysqltest_1';
-select host,db,user,table_name from mysql.tables_priv where user = 'mysqltest_1' order by host,db,user,table_name;
-#
-# Add a stray record
-insert into mysql.columns_priv set host='%', db='test', user='mysqltest_1', table_name='t1', column_name='c1';
-flush privileges;
---error ER_NONEXISTING_GRANT
-show grants for 'mysqltest_1';
-drop user 'mysqltest_1';
-select host,db,user,table_name,column_name from mysql.columns_priv where user = 'mysqltest_1' order by host,db,user,table_name,column_name;
-#
-# Handle multi user lists
-create user 'mysqltest_1', 'mysqltest_2', 'mysqltest_3';
-drop user 'mysqltest_1', 'mysqltest_2', 'mysqltest_3';
-create user 'mysqltest_1', 'mysqltest_2' identified by 'Mysqltest-2', 'mysqltest_3' identified by password 'fffffffffffffffffffffffffffffffffffffffff';
-rename user 'mysqltest_1' to 'mysqltest_1a', 'mysqltest_2' TO 'mysqltest_2a', 'mysqltest_3' TO 'mysqltest_3a';
---error ER_CANNOT_USER
-drop user 'mysqltest_1', 'mysqltest_2', 'mysqltest_3';
-drop user 'mysqltest_1a', 'mysqltest_2a', 'mysqltest_3a';
-#
-# Let one of multiple users fail
-create user 'mysqltest_1', 'mysqltest_2', 'mysqltest_3';
---error ER_CANNOT_USER
-create user 'mysqltest_1a', 'mysqltest_2', 'mysqltest_3a';
---error ER_CANNOT_USER
-rename user 'mysqltest_1a' to 'mysqltest_1b', 'mysqltest_2a' TO 'mysqltest_2b', 'mysqltest_3a' TO 'mysqltest_3b';
-drop user 'mysqltest_1', 'mysqltest_2', 'mysqltest_3';
---error ER_CANNOT_USER
-drop user 'mysqltest_1b', 'mysqltest_2b', 'mysqltest_3b';
-#
-# Obsolete syntax has been dropped
-create user 'mysqltest_2' identified by 'Mysqltest-2';
---error ER_PARSE_ERROR
-drop user 'mysqltest_2' identified by 'Mysqltest-2';
-drop user 'mysqltest_2';
-#
-# Strange user names
-create user '%@b'@'b';
-show grants for '%@b'@'b';
-grant select on mysql.* to '%@b'@'b';
-show grants for '%@b'@'b';
-rename user '%@b'@'b' to '%@a'@'a';
---error ER_NONEXISTING_GRANT
-show grants for '%@b'@'b';
-show grants for '%@a'@'a';
-drop user '%@a'@'a';
-#
-# CREATE USER privilege is enough
-#
-create user mysqltest_2@localhost;
-grant create user on *.* to mysqltest_2@localhost;
-connect (user3,localhost,mysqltest_2,,);
-connection user3;
---error ER_TABLEACCESS_DENIED_ERROR
-select host,user,password from mysql.user where user like 'mysqltest_%' order by host,user,password;
-create user mysqltest_A@'%';
-rename user mysqltest_A@'%' to mysqltest_B@'%';
-drop user mysqltest_B@'%';
-disconnect user3;
-connection default;
-drop user mysqltest_2@localhost;
-#
-# INSERT/UPDATE/DELETE is ok too
-create user mysqltest_3@localhost;
-grant INSERT,DELETE,UPDATE on mysql.* to mysqltest_3@localhost;
-connect (user4,localhost,mysqltest_3,,);
-connection user4;
-show grants;
---error ER_TABLEACCESS_DENIED_ERROR
-select host,user,password from mysql.user where user like 'mysqltest_%' order by host,user,password;
-insert into mysql.user set host='%', user='mysqltest_B';
-create user mysqltest_A@'%';
-rename user mysqltest_B@'%' to mysqltest_C@'%';
-drop user mysqltest_C@'%';
-drop user mysqltest_A@'%';
-disconnect user4;
-connection default;
-drop user mysqltest_3@localhost;
-#
-# Bug#3309 Test IP addresses with netmask
-set @@sql_mode='';
-create database mysqltest_1;
-create table mysqltest_1.t1 (i int);
-insert into mysqltest_1.t1 values (1),(2),(3);
-GRANT ALL ON mysqltest_1.t1 TO mysqltest_1@'127.0.0.0/255.0.0.0';
-connect (n1,127.0.0.1,mysqltest_1,,mysqltest_1,$MASTER_MYPORT,$MASTER_MYSOCK);
-connection n1;
-show grants for current_user();
-select * from t1;
-disconnect n1;
-connection default;
-REVOKE ALL ON mysqltest_1.t1 FROM mysqltest_1@'127.0.0.0/255.0.0.0';
-delete from mysql.user where user like 'mysqltest\_1';
-flush privileges;
-drop table mysqltest_1.t1;
-
-#
-# Bug#12302 Hostname resolution preventing password changes
-# 'SET PASSWORD = ...' didn't work if connecting hostname !=
-# hostname the current user is authenticated as. Note that a test for this
-# was also added to the test above.
-#
-grant all on mysqltest_1.* to mysqltest_1@'127.0.0.1';
-connect (b12302,127.0.0.1,mysqltest_1,,mysqltest_1,$MASTER_MYPORT,);
-connection b12302;
-select current_user();
-set password = password('changed');
-disconnect b12302;
-connection default;
-select host, length(password) from mysql.user where user like 'mysqltest\_1';
-revoke all on mysqltest_1.* from mysqltest_1@'127.0.0.1';
-delete from mysql.user where user like 'mysqltest\_1';
-flush privileges;
-grant all on mysqltest_1.* to mysqltest_1@'127.0.0.0/255.0.0.0';
-connect (b12302_2,127.0.0.1,mysqltest_1,,mysqltest_1,$MASTER_MYPORT,);
-connection b12302_2;
-select current_user();
-set password = password('changed');
-disconnect b12302_2;
-connection default;
-select host, length(password) from mysql.user where user like 'mysqltest\_1';
-revoke all on mysqltest_1.* from mysqltest_1@'127.0.0.0/255.0.0.0';
-delete from mysql.user where user like 'mysqltest\_1';
-flush privileges;
-drop database mysqltest_1;
-
---source include/add_anonymous_users.inc
-
-# But anonymous users can't change their password
-connect (n5,localhost,test,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
-connection n5;
---error ER_PASSWORD_ANONYMOUS_USER
-set password = password("changed");
-disconnect n5;
-connection default;
-
---source include/delete_anonymous_users.inc
-
-
-# Bug#12423 "Deadlock when doing FLUSH PRIVILEGES and GRANT in
-# multi-threaded environment". We should be able to execute FLUSH
-# PRIVILEGES and SET PASSWORD simultaneously with other account
-# management commands (such as GRANT and REVOKE) without causing
-# deadlocks. To achieve this we should ensure that all account
-# management commands take table and internal locks in the same order.
-connect (con2root,localhost,root,,);
-connect (con3root,localhost,root,,);
-# Check that we can execute FLUSH PRIVILEGES and GRANT simultaneously
-# This will check that locks are taken in proper order during both
-# user/db-level and table/column-level privileges reloading.
-connection default;
-lock table mysql.user write;
-connection con2root;
-send flush privileges;
-connection con3root;
-send grant all on *.* to 'mysqltest_1'@'localhost';
-connection default;
-unlock tables;
-connection con2root;
-reap;
-connection con3root;
-reap;
-# Check for simultaneous SET PASSWORD and REVOKE.
-connection default;
-lock table mysql.user write;
-connection con2root;
-send set password for 'mysqltest_1'@'localhost' = password('');
-connection con3root;
-send revoke all on *.* from 'mysqltest_1'@'localhost';
-connection default;
-unlock tables;
-connection con2root;
-reap;
-connection con3root;
-reap;
-connection default;
-# Clean-up
-drop user 'mysqltest_1'@'localhost';
-disconnect con2root;
-disconnect con3root;
-
-# End of 4.1 tests
-
-#
-# Bug#17279 user with no global privs and with create
-# priv in db can create databases
-#
-
-create database TESTDB;
-create table t2(a int);
-create temporary table t1 as select * from mysql.user;
-delete from mysql.user where host='localhost';
-INSERT INTO mysql.user (host, user, password) VALUES
-('%','mysqltest_1',password('password'));
-INSERT INTO mysql.db (host, db, user, select_priv) VALUES
-('%','TESTDB','mysqltest_1','Y');
-FLUSH PRIVILEGES;
-
-connect (con1,localhost,mysqltest_1,password,TESTDB);
-
-# The user mysqltest_1 should only be allowed access to
-# database TESTDB, not TEStdb
-# On system with "lowercase names" we get error "ER_DB_CREATE_EXISTS: Can't create db..."
---error ER_DBACCESS_DENIED_ERROR, ER_DB_CREATE_EXISTS
-create database TEStdb;
-
-# Clean-up
-connection default;
-disconnect con1;
-delete from mysql.user;
-delete from mysql.db where host='%' and user='mysqltest_1' and db='TESTDB';
-insert into mysql.user select * from t1;
-drop table t1, t2;
-drop database TESTDB;
-flush privileges;
-
-#
-# Bug#13310 incorrect user parsing by SP
-#
-
-SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
-SET GLOBAL log_bin_trust_function_creators = 1;
-
-GRANT ALL PRIVILEGES ON test.* TO `a@`@localhost;
-GRANT EXECUTE ON * TO `a@`@localhost;
-connect (bug13310,localhost,'a@',,test);
-connection bug13310;
-CREATE TABLE t2 (s1 INT);
-INSERT INTO t2 VALUES (1);
---disable_warnings
-DROP FUNCTION IF EXISTS f2;
---enable_warnings
-delimiter //;
-CREATE FUNCTION f2 () RETURNS INT
-BEGIN DECLARE v INT; SELECT s1 FROM t2 INTO v; RETURN v; END//
-delimiter ;//
-SELECT f2();
-
-DROP FUNCTION f2;
-DROP TABLE t2;
-disconnect bug13310;
-connection default;
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM `a@`@localhost;
-DROP USER `a@`@localhost;
-
-SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
-
-
-#
-# Bug#25578 CREATE TABLE LIKE does not require any privileges on source table
-#
---disable_warnings
-drop database if exists mysqltest_1;
-drop database if exists mysqltest_2;
---enable_warnings
---error 0,ER_CANNOT_USER
-drop user mysqltest_u1@localhost;
-
-create database mysqltest_1;
-create database mysqltest_2;
-grant all on mysqltest_1.* to mysqltest_u1@localhost;
-use mysqltest_2;
-create table t1 (i int);
-
-# Connect as user with all rights on mysqltest_1 but with no rights on mysqltest_2.
-connect (user1,localhost,mysqltest_u1,,mysqltest_1);
-connection user1;
-# As expected error is emitted
---error ER_TABLEACCESS_DENIED_ERROR
-show create table mysqltest_2.t1;
-# This should emit error as well
---error ER_TABLEACCESS_DENIED_ERROR
-create table t1 like mysqltest_2.t1;
-
-# Now let us check that SELECT privilege on the source is enough
-connection default;
-grant select on mysqltest_2.t1 to mysqltest_u1@localhost;
-connection user1;
-show create table mysqltest_2.t1;
-create table t1 like mysqltest_2.t1;
-
-# Clean-up
-connection default;
-disconnect user1;
-use test;
-drop database mysqltest_1;
-drop database mysqltest_2;
-drop user mysqltest_u1@localhost;
-
-
-#
-# Bug#18660 Can't grant any privileges on single table in database
-# with underscore char
-#
-grant all on `mysqltest\_%`.* to mysqltest_1@localhost with grant option;
-grant usage on *.* to mysqltest_2@localhost;
-connect (con18600_1,localhost,mysqltest_1,,);
-
-create database mysqltest_1;
-use mysqltest_1;
-create table t1 (f1 int);
-
-grant create on `mysqltest\_1`.* to mysqltest_2@localhost;
-grant select on mysqltest_1.t1 to mysqltest_2@localhost;
-connect (con3,localhost,mysqltest_2,,);
-connection con3;
---error ER_DBACCESS_DENIED_ERROR
-create database mysqltest_3;
-use mysqltest_1;
-create table t2(f1 int);
-select * from t1;
-connection default;
-drop database mysqltest_1;
-
-connection default;
-disconnect con3;
-disconnect con18600_1;
-revoke all privileges, grant option from mysqltest_1@localhost;
-revoke all privileges, grant option from mysqltest_2@localhost;
-drop user mysqltest_1@localhost;
-drop user mysqltest_2@localhost;
-
-
-#
-# Bug#30468 column level privileges not respected when joining tables
-#
-CREATE DATABASE db1;
-
-USE db1;
-CREATE TABLE t1 (a INT, b INT);
-INSERT INTO t1 VALUES (1,1),(2,2);
-
-CREATE TABLE t2 (b INT, c INT);
-INSERT INTO t2 VALUES (1,100),(2,200);
-
-GRANT SELECT ON t1 TO mysqltest1@localhost;
-GRANT SELECT (b) ON t2 TO mysqltest1@localhost;
-
-connect (conn1,localhost,mysqltest1,,);
-connection conn1;
-USE db1;
---error ER_COLUMNACCESS_DENIED_ERROR
-SELECT c FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM t2;
---error ER_COLUMNACCESS_DENIED_ERROR
-SELECT * FROM t1 JOIN t2 USING (b);
-
-connection default;
-disconnect conn1;
-USE test;
-DROP TABLE db1.t1, db1.t2;
-DROP USER mysqltest1@localhost;
-DROP DATABASE db1;
-
-
---echo End of 5.0 tests
-
-#
-# Bug #48319: Server crashes on "GRANT/REVOKE ... TO CURRENT_USER"
-#
-
-# work out who we are.
-USE mysql;
-SELECT LEFT(CURRENT_USER(),INSTR(CURRENT_USER(),'@')-1) INTO @u;
-SELECT MID(CURRENT_USER(),INSTR(CURRENT_USER(),'@')+1) INTO @h;
-SELECT password FROM user WHERE user=@u AND host=@h INTO @pwd;
-
-# show current privs.
-SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h;
-
-# toggle INSERT
-UPDATE user SET insert_priv='N' WHERE user=@u AND host=@h;
-SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h;
-
-# show that GRANT ... TO CURRENT_USER() no longer crashes
-GRANT INSERT ON *.* TO CURRENT_USER();
-SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h;
-UPDATE user SET insert_priv='N' WHERE user=@u AND host=@h;
-
-# show that GRANT ... TO CURRENT_USER() IDENTIFIED BY ... works now
-GRANT INSERT ON *.* TO CURRENT_USER() IDENTIFIED BY 'keksdose';
-SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h;
-
-UPDATE user SET password=@pwd WHERE user=@u AND host=@h;
-SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h;
-
-FLUSH PRIVILEGES;
-
-USE test;
-
---echo End of 5.1 tests
-
-
---echo
---echo # --
---echo # -- Bug#11746602: 27480 - Extend CREATE TEMPORARY TABLES privilege to
---echo # -- allow temp table operations
---echo # --
---echo # -- Bug#12771903: User with create temporary tables priv only has full
---echo # -- access to a regular table
---echo # --
---echo
-
---echo ############################################################################
---echo # Setup environment.
---echo ###########################################################################
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest_db1;
-DROP DATABASE IF EXISTS mysqltest_db2;
---enable_warnings
-
-CREATE DATABASE mysqltest_db1;
-CREATE DATABASE mysqltest_db2;
-
---echo # mysqltest_u1@localhost has CREATE_TMP_ACL, FILE_ACL and EXECUTE_ACL only
---echo # (EXECUTE_ACL is needed to call p0, and FILE_ACL is needed for SELECT
---echo # OUTFILE/LOAD DATA INFILE).
-GRANT FILE ON *.* TO mysqltest_u1@localhost;
-GRANT CREATE TEMPORARY TABLES, EXECUTE ON mysqltest_db1.* TO mysqltest_u1@localhost;
-
---echo # mysqltest_u2@localhost has all privileges but CREATE_TMP_ACL.
-GRANT ALL PRIVILEGES ON mysqltest_db1.* TO mysqltest_u2@localhost;
-REVOKE CREATE TEMPORARY TABLES ON mysqltest_db1.* FROM mysqltest_u2@localhost;
-
---echo # mysqltest_u3@localhost has CREATE_TMP_ACL & EXECUTE_ACL.
---echo # This user is required to check SUID-stored-routines.
-GRANT CREATE TEMPORARY TABLES ON mysqltest_db1.* TO mysqltest_u3@localhost;
-GRANT EXECUTE ON mysqltest_db1.* TO mysqltest_u3@localhost;
-
---echo # mysqltest_u4@localhost has only EXECUTE_ACL.
---echo # We need this user to check that once created temporary tables
---echo # are accessible by anyone.
-GRANT EXECUTE ON mysqltest_db1.* TO mysqltest_u4@localhost;
-
---echo # mysqltest_u5@localhost has CREATE_TMP_ACL and SELECT_ACL, UPDATE_ACL,
---echo # DELETE_ACL on mysqltest_db1; and only CREATE_TMP_ACL on mysqltest_db2.
---echo # By means of this user we check privileges required for merge tables.
-GRANT CREATE TEMPORARY TABLES ON mysqltest_db1.* TO mysqltest_u5@localhost;
-GRANT CREATE TEMPORARY TABLES ON mysqltest_db2.* TO mysqltest_u5@localhost;
-GRANT SELECT, UPDATE, DELETE ON mysqltest_db1.* TO mysqltest_u5@localhost;
-
---echo # Create stored routine to test how privilege checking is done for its
---echo # arguments.
-CREATE PROCEDURE mysqltest_db1.p0(i INT) SELECT i;
-
---echo # Create SUID-stored-routines.
-CREATE DEFINER = mysqltest_u3@localhost PROCEDURE mysqltest_db1.p1()
- CREATE TEMPORARY TABLE t4(x INT);
-
-CREATE DEFINER = mysqltest_u3@localhost PROCEDURE mysqltest_db1.p2()
- INSERT INTO t4 VALUES (1), (2), (3);
-
-CREATE DEFINER = mysqltest_u3@localhost PROCEDURE mysqltest_db1.p3()
- SELECT * FROM t4 ORDER BY x;
-
---echo # We need separate key cache to test CACHE INDEX and LOAD INDEX.
-SET GLOBAL keycache1.key_buffer_size = 128 * 1024;
-
-CREATE TABLE mysqltest_db2.t2_1(a INT);
-
---echo ###########################################################################
---echo # Check that CREATE_TMP_ACL is enough to issue almost any supported
---echo # SQL-statement against temporary tables (loosely follow order in
---echo # sql_command enum).
---echo ###########################################################################
-
---connect (con1,localhost,mysqltest_u1,,mysqltest_db1)
-
---echo #
---echo # Variants of CREATE TABLE.
---echo #
-CREATE TEMPORARY TABLE t1(a INT);
-CREATE TEMPORARY TABLE t2 LIKE t1;
-CREATE TEMPORARY TABLE t3(a INT, b INT, PRIMARY KEY (a));
-CREATE TEMPORARY TABLE t4 SELECT * FROM t1;
---echo # Check that we do *not* allow creation of MERGE table with underlying
---echo # temporary table without additional privileges.
-CREATE TEMPORARY TABLE t5(a INT) ENGINE = MyISAM;
---error ER_TABLEACCESS_DENIED_ERROR
-CREATE TEMPORARY TABLE t6(a INT) ENGINE = MERGE UNION = (t5);
---echo # Check that we allow creation of MERGE table with no underlying table
---echo # without additional privileges.
-CREATE TEMPORARY TABLE t6(a INT) ENGINE = MERGE UNION = ();
-
---echo #
---echo # SELECT.
---echo #
-INSERT INTO t1 VALUES (1), (2), (3);
-SELECT * FROM t1 ORDER BY a;
-
---echo #
---echo # CREATE/DROP INDEX.
---echo #
-CREATE INDEX idx1 ON t3(b);
-DROP INDEX idx1 ON t3;
-
---echo #
---echo # ALTER TABLE.
---echo #
-ALTER TABLE t4 ADD COLUMN b INT;
---echo # Check that we allow altering of MERGE table with no underlying
---echo # without additional privileges.
-ALTER TABLE t6 UNION = ();
---echo # Check that we do *not* allow altering of MERGE table with underlying
---echo # temporary table without additional privileges.
---error ER_TABLEACCESS_DENIED_ERROR
-ALTER TABLE t6 UNION = (t5);
-
---echo #
---echo # Simple INSERT and INSERT ... SELECT.
---echo #
-INSERT INTO t1 VALUES (4);
-INSERT INTO t2 SELECT a FROM t1;
-SELECT * FROM t1 ORDER BY a;
-SELECT * FROM t2 ORDER BY a;
-
---echo #
---echo # UPDATE and multi-UPDATE.
---echo #
-UPDATE t1 SET a = a * 10;
-UPDATE t1 SET a = 100 WHERE a = 10;
-UPDATE t1, t2 SET t1.a = 200 WHERE t1.a = t2.a * 10 AND t1.a = 20;
-SELECT * FROM t1 ORDER BY a;
-
---echo #
---echo # DELETE and multi-DELETE.
---echo #
-DELETE FROM t1 WHERE a = 100;
-DELETE t1 FROM t1, t2 WHERE t1.a = t2.a * 100 AND t1.a = 200;
-SELECT * FROM t1 ORDER BY a;
-
---echo #
---echo # TRUNCATE TABLE.
---echo #
-TRUNCATE TABLE t1;
-SELECT * FROM t1 ORDER BY a;
-
---echo #
---echo # SHOW COLUMNS/DESCRIBE and SHOW KEYS.
---echo #
-SHOW COLUMNS FROM t1;
-SHOW KEYS FROM t3;
-
---echo #
---echo # SHOW CREATE TABLE.
---echo #
-SHOW CREATE TABLE t1;
-
---echo #
---echo # LOAD DATA INFILE (also SELECT INTO OUTFILE).
---echo #
-INSERT INTO t1 VALUES (1), (2), (3);
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT a INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug27480.txt' FROM t1
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug27480.txt' INTO TABLE t1
---remove_file $MYSQLTEST_VARDIR/tmp/bug27480.txt
-SELECT * FROM t1 ORDER BY a;
-
---echo #
---echo # SET.
---echo #
-SET @a := (SELECT COUNT(*) FROM t1);
-SELECT @a;
-
---echo #
---echo # LOCK TABLES.
---echo #
-LOCK TABLES t1 READ;
-UNLOCK TABLES;
-
---echo #
---echo # CHECK/REPAIR/ANALYZE/OPTIMIZE and CHECKSUM.
---echo #
-ANALYZE TABLE t1;
-CHECK TABLE t1;
-OPTIMIZE TABLE t1;
-REPAIR TABLE t1;
-
---echo #
---echo # REPLACE and REPLACE ... SELECT.
---echo #
-INSERT INTO t3 VALUES (1, 111), (2, 222), (3, 333);
-REPLACE INTO t3 VALUES (1, 1111), (4, 444), (0, 001);
-REPLACE INTO t2 SELECT b FROM t3;
-SELECT * FROM t2 ORDER BY a;
-SELECT * FROM t3 ORDER BY a;
-
---echo #
---echo # CACHE and LOAD INDEX.
---echo #
-CACHE INDEX t3 IN keycache1;
-LOAD INDEX INTO CACHE t3;
-
---echo #
---echo # RENAME (doesn't work for temporary tables, thus should fail).
---echo #
---error ER_TABLEACCESS_DENIED_ERROR
-RENAME TABLE t3 TO t3_1;
-
---echo #
---echo # HANDLER OPEN/READ/CLOSE.
---echo #
-HANDLER t1 OPEN;
-HANDLER t1 READ NEXT;
-HANDLER t1 CLOSE;
-
---echo #
---echo # DO.
---echo #
-DO (SELECT COUNT(*) FROM t1);
-
---echo #
---echo # CHECKSUM TABLE.
---echo #
-DELETE FROM t1;
-CHECKSUM TABLE t1;
-
---echo #
---echo # CALL.
---echo #
-CALL p0((SELECT COUNT(*) FROM t1));
-
---echo #
---echo # PREPARE, EXECUTE and DEALLOCATE.
---echo #
-PREPARE stmt1 FROM 'SELECT * FROM t1 ORDER BY a';
-PREPARE stmt2 FROM 'SELECT * FROM t2 ORDER BY a';
-EXECUTE stmt1;
-EXECUTE stmt2;
-DEALLOCATE PREPARE stmt1;
-DEALLOCATE PREPARE stmt2;
-
---echo #
---echo # DROP TABLE and DROP TEMPORARY TABLE.
---echo #
-DROP TABLE t1;
-
-CREATE TEMPORARY TABLE t1(a INT);
-DROP TEMPORARY TABLE t1;
-
-
---echo ###########################################################################
---echo # - Check that even having all privileges but CREATE_TMP_ACL is not enough
---echo # to create temporary tables.
---echo # - Check that creation/working with temporary tables is possible via
---echo # SUID-stored-routines.
---echo # - Check that even outside of SUID context we can access temporary
---echo # table once it is created.
---echo ###########################################################################
-
---connect (con2,localhost,mysqltest_u2,,mysqltest_db1)
-
---error ER_DBACCESS_DENIED_ERROR
-CREATE TEMPORARY TABLE t2(a INT);
-
-CALL p1();
-
-CALL p2();
-
-CALL p3();
-
---echo # Check that once table is created it can be accessed even
---echo # outside of such a SUID context.
-INSERT INTO t4 VALUES (4);
-UPDATE t4 SET x = 10 WHERE x = 1;
-DELETE FROM t4 WHERE x < 3;
-SELECT * FROM t4 ORDER BY x;
-DROP TEMPORARY TABLE t4;
-
---echo ###########################################################################
---echo # - Check that once table is created it can be accessed from within any
---echo # context, even by user without any privileges on tables.
---echo ###########################################################################
-
---connect (con3,localhost,mysqltest_u4,,mysqltest_db1)
-
-CALL p1();
-INSERT INTO t4 VALUES (4);
-UPDATE t4 SET x = 10 WHERE x = 1;
-DELETE FROM t4 WHERE x < 3;
-SELECT * FROM t4 ORDER BY x;
-DROP TEMPORARY TABLE t4;
-
---echo ###########################################################################
---echo # Check special case for MERGE-tables:
---echo # - CREATE_TMP_ACL is required to create a temporary merge table;
---echo # - SELECT_ACL, UPDATE_ACL and DELETE_ACL are required to include
---echo # a temporary table into the underlying-table-list.
---echo ###########################################################################
-
---connect (con4,localhost,mysqltest_u5,,mysqltest_db1)
-
-CREATE TEMPORARY TABLE t7(a INT);
-CREATE TEMPORARY TABLE t8(a INT);
-CREATE TEMPORARY TABLE t9(a INT);
-CREATE TEMPORARY TABLE t10(a INT) ENGINE = MERGE UNION = (t7, t8);
-
-ALTER TABLE t10 UNION = (t9);
---error ER_TABLEACCESS_DENIED_ERROR
-ALTER TABLE t10 UNION = (mysqltest_db2.t2_1);
-
-CREATE TEMPORARY TABLE mysqltest_db2.t2_2(a INT) ENGINE = MERGE UNION = (t7, t8);
-
-ALTER TABLE mysqltest_db2.t2_2 UNION = (t9);
-ALTER TABLE mysqltest_db2.t2_2 UNION = ();
-
-DROP TEMPORARY TABLE mysqltest_db2.t2_2;
-DROP TEMPORARY TABLE t10;
-
-DROP TEMPORARY TABLE t7;
-DROP TEMPORARY TABLE t8;
-DROP TEMPORARY TABLE t9;
-
---echo ###########################################################################
---echo # That's all. Cleanup.
---echo ###########################################################################
-
---connection default
-
---echo # All remaining temporary tables are automatically dropped.
---disconnect con1
---disconnect con2
---disconnect con3
---disconnect con4
-
-SET GLOBAL keycache1.key_buffer_size = 0;
-DROP DATABASE mysqltest_db1;
-DROP DATABASE mysqltest_db2;
-DROP USER mysqltest_u1@localhost;
-DROP USER mysqltest_u2@localhost;
-DROP USER mysqltest_u3@localhost;
-DROP USER mysqltest_u4@localhost;
-DROP USER mysqltest_u5@localhost;
-
-
-set GLOBAL sql_mode=default;
-# Wait till we reached the initial number of concurrent sessions
---source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/grant3-master.opt b/mysql-test/t/grant3-master.opt
deleted file mode 100644
index 4b11f5902c1..00000000000
--- a/mysql-test/t/grant3-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---safe-user-create
diff --git a/mysql-test/t/grant3.test b/mysql-test/t/grant3.test
deleted file mode 100644
index 27f565916f7..00000000000
--- a/mysql-test/t/grant3.test
+++ /dev/null
@@ -1,213 +0,0 @@
-# Can't run with embedded server because we use GRANT
--- source include/not_embedded.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-set global sql_mode="";
-set local sql_mode="";
-
-# Test of GRANT commands
-
-SET NAMES binary;
-connect (master,localhost,root,,);
-connection master;
-
-# Cleanup
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-delete from mysql.user where user like 'mysqltest\_%';
-delete from mysql.db where user like 'mysqltest\_%';
-delete from mysql.tables_priv where user like 'mysqltest\_%';
-delete from mysql.columns_priv where user like 'mysqltest\_%';
-flush privileges;
-
-create user mysqltest_1@localhost;
-grant create user on *.* to mysqltest_1@localhost;
-grant select on `my\_1`.* to mysqltest_1@localhost with grant option;
-connect (user_a,localhost,mysqltest_1,,);
-connection user_a;
---error ER_CANT_CREATE_USER_WITH_GRANT
-grant select on `my\_1`.* to mysqltest_2@localhost;
-create user mysqltest_2@localhost;
-disconnect user_a;
-disconnect master;
-connection default;
-
-delete from mysql.user where user like 'mysqltest\_%';
-delete from mysql.db where user like 'mysqltest\_%';
-delete from mysql.tables_priv where user like 'mysqltest\_%';
-delete from mysql.columns_priv where user like 'mysqltest\_%';
-flush privileges;
-
-#
-# Bug#19828 Case sensitivity in Grant/Revoke
-#
-
-grant select on test.* to CUser@localhost;
-grant select on test.* to CUser@LOCALHOST;
-flush privileges;
-
-SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
-SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser' order by 1,2;
-
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'LOCALHOST';
-flush privileges;
-
-SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
-SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser' order by 1,2;
-
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'localhost';
-flush privileges;
-
-SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
-SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser' order by 1,2;
-
-DROP USER CUser@localhost;
---error ER_CANNOT_USER
-DROP USER CUser@LOCALHOST;
-
-#### table grants
-create table t1 (a int);
-grant select on test.t1 to CUser@localhost;
-grant select on test.t1 to CUser@LOCALHOST;
-flush privileges;
-
-SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
-SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
-
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'LOCALHOST';
-flush privileges;
-
-SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
-SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
-
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'localhost';
-flush privileges;
-
-SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
-SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
-
-DROP USER CUser@localhost;
---error ER_CANNOT_USER
-DROP USER CUser@LOCALHOST;
-
-### column grants
-
-grant select(a) on test.t1 to CUser@localhost;
-grant select(a) on test.t1 to CUser@LOCALHOST;
-flush privileges;
-
-SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
-SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
-
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'LOCALHOST';
-flush privileges;
-
-SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
-SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
-
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'localhost';
-flush privileges;
-
-SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2;
-SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2;
-
-DROP USER CUser@localhost;
---error ER_CANNOT_USER
-DROP USER CUser@LOCALHOST;
-
-drop table t1;
-
-# revoke on a specific DB only
-
-grant select on test.* to CUser2@localhost;
-grant select on test.* to CUser2@LOCALHOST;
-flush privileges;
-
-SELECT user, host FROM mysql.user where user = 'CUser2' order by 1,2;
-SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by 1,2;
-
-REVOKE SELECT ON test.* FROM 'CUser2'@'LOCALHOST';
-flush privileges;
-
-SELECT user, host FROM mysql.user where user = 'CUser2' order by 1,2;
-SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by 1,2;
-
---error ER_NONEXISTING_GRANT
-REVOKE SELECT ON test.* FROM 'CUser2'@'localhost';
-flush privileges;
-
-SELECT user, host FROM mysql.user where user = 'CUser2' order by 1,2;
-SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by 1,2;
-
-DROP USER CUser2@localhost;
---error ER_CANNOT_USER
-DROP USER CUser2@LOCALHOST;
-
-
-#
-# Bug#31194 Privilege ordering does not order properly for wildcard values
-#
-
-CREATE DATABASE mysqltest_1;
-CREATE TABLE mysqltest_1.t1 (a INT);
-CREATE USER 'mysqltest1'@'%';
-GRANT SELECT, UPDATE ON `mysqltest_1`.* TO 'mysqltest1'@'%';
-REVOKE SELECT ON `mysqltest_1`.* FROM 'mysqltest1'@'%';
-GRANT SELECT, UPDATE ON `mysqltest\_1`.* TO 'mysqltest1'@'%';
-FLUSH PRIVILEGES;
-
-connect (conn1,localhost,mysqltest1,,);
-connection conn1;
-SHOW GRANTS;
-SELECT * FROM mysqltest_1.t1;
-disconnect conn1;
-
-connection default;
-DROP USER 'mysqltest1'@'%';
-DROP DATABASE mysqltest_1;
-
---echo #
---echo # Bug#41597 - After rename of user, there are additional grants
---echo # when grants are reapplied.
---echo #
-
-CREATE DATABASE temp;
-CREATE TABLE temp.t1(a INT, b VARCHAR(10));
-INSERT INTO temp.t1 VALUES(1, 'name1');
-INSERT INTO temp.t1 VALUES(2, 'name2');
-INSERT INTO temp.t1 VALUES(3, 'name3');
-
-
-CREATE USER 'user1'@'%';
-RENAME USER 'user1'@'%' TO 'user2'@'%';
---echo # Show privileges after rename and BEFORE grant
-SHOW GRANTS FOR 'user2'@'%';
-GRANT SELECT (a), INSERT (b) ON `temp`.`t1` TO 'user2'@'%';
---echo # Show privileges after rename and grant
-SHOW GRANTS FOR 'user2'@'%';
-
---echo # Connect as the renamed user
-connect (conn1, localhost, user2,,);
-connection conn1;
-SHOW GRANTS;
-SELECT a FROM temp.t1;
---echo # Check for additional privileges by accessing a
---echo # non privileged column. We shouldn't be able to
---echo # access this column.
---error ER_COLUMNACCESS_DENIED_ERROR
-SELECT b FROM temp.t1;
-disconnect conn1;
-
-connection default;
-DROP USER 'user2'@'%';
-DROP DATABASE temp;
-
-set global sql_mode=default;
---echo End of 5.0 tests
-
-# Wait till we reached the initial number of concurrent sessions
---source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/grant4.test b/mysql-test/t/grant4.test
deleted file mode 100644
index 2715b7c7145..00000000000
--- a/mysql-test/t/grant4.test
+++ /dev/null
@@ -1,237 +0,0 @@
---source include/not_embedded.inc
-
-# Setup database, tables and user accounts
---disable_warnings
-drop database if exists mysqltest_db1;
---enable_warnings
-set GLOBAL sql_mode="";
-set LOCAL sql_mode="";
-create database mysqltest_db1;
-use mysqltest_db1;
-create table t_column_priv_only (a int, b int);
-create table t_select_priv like t_column_priv_only;
-create table t_no_priv like t_column_priv_only;
-grant all privileges on test.* to mysqltest_u1@localhost;
-grant insert (a) on mysqltest_db1.t_column_priv_only to mysqltest_u1@localhost;
-grant select on mysqltest_db1.t_select_priv to mysqltest_u1@localhost;
-
---echo ** Connect as restricted user mysqltest_u1.
---echo
-connect (con1,localhost,mysqltest_u1,,);
-connection con1;
-
-########################################################################
---echo ** Test column level privileges only. No SELECT privileges on the table.
---echo ** INSERT INTO ... VALUES ...
---echo ** Attempting to insert values to a table with only column privileges
---echo ** should work.
-insert into mysqltest_db1.t_column_priv_only (a) VALUES (1);
---echo
-
-#########################################################################
---echo ** SHOW COLUMNS
---echo ** Should succeed because we have privileges (any) on at least one of the columns.
-select column_name as 'Field',column_type as 'Type',is_nullable as 'Null',column_key as 'Key',column_default as 'Default',extra as 'Extra' from information_schema.columns where table_schema='mysqltest_db1' and table_name='t_column_priv_only';
-show columns from mysqltest_db1.t_column_priv_only;
-#########################################################################
---echo ** SHOW COLUMNS
---echo ** Should fail because there are no privileges on any column combination.
---error 1142
-show columns from mysqltest_db1.t_no_priv;
---echo ** However, select from I_S.COLUMNS will succeed but not show anything:
-select column_name as 'Field',column_type as 'Type',is_nullable as 'Null',column_key as 'Key',column_default as 'Default',extra as 'Extra' from information_schema.columns where table_schema='mysqltest_db1' and table_name='t_no_priv';
---echo
-#########################################################################
---echo ** CREATE TABLE ... LIKE ... require SELECT privleges and will fail.
---error 1142
-create table test.t_no_priv like mysqltest_db1.column_priv_only;
---echo
-#########################################################################
---echo ** Just to be sure... SELECT also fails.
---error 1142
-select * from mysqltest_db1.t_column_priv_only;
---echo
-#########################################################################
---echo ** SHOW CREATE TABLE ... require any privileges on all columns (the entire table).
---echo ** First we try and fail on a table with only one column privilege.
---error 1142
-show create table mysqltest_db1.t_column_priv_only;
---echo
-#########################################################################
---echo ** Now we do the same on a table with SELECT privileges.
---echo
-#########################################################################
---echo ** SHOW COLUMNS
---echo ** Success because we got some privileges on the table (SELECT_ACL)
-show columns from mysqltest_db1.t_select_priv;
---echo
-#########################################################################
---echo ** CREATE TABLE ... LIKE ... require SELECT privleges and will SUCCEED.
---disable_warnings
-drop table if exists test.t_duplicated;
---enable_warnings
-create table test.t_duplicated like mysqltest_db1.t_select_priv;
-drop table test.t_duplicated;
---echo
-#########################################################################
---echo ** SHOW CREATE TABLE will succeed because we have a privilege on all columns in the table (table-level privilege).
-show create table mysqltest_db1.t_select_priv;
---echo
-#########################################################################
---echo ** SHOW CREATE TABLE will fail if there is no grants at all:
---error 1142
-show create table mysqltest_db1.t_no_priv;
---echo
-
-connection default;
-
-#
-# SHOW INDEX
-#
-use mysqltest_db1;
-CREATE TABLE t5 (s1 INT);
-CREATE INDEX i ON t5 (s1);
-CREATE TABLE t6 (s1 INT, s2 INT);
-CREATE VIEW v5 AS SELECT * FROM t5;
-CREATE VIEW v6 AS SELECT * FROM t6;
-CREATE VIEW v2 AS SELECT * FROM t_select_priv;
-CREATE VIEW v3 AS SELECT * FROM t_select_priv;
-CREATE INDEX i ON t6 (s1);
-GRANT UPDATE (s2) ON t6 to mysqltest_u1@localhost;
-GRANT UPDATE (s2) ON v6 to mysqltest_u1@localhost;
-GRANT SHOW VIEW ON v2 to mysqltest_u1@localhost;
-GRANT SHOW VIEW, SELECT ON v3 to mysqltest_u1@localhost;
-
-connection con1;
-use mysqltest_db1;
---echo ** Connect as restricted user mysqltest_u1.
---echo ** SELECT FROM INFORMATION_SCHEMA.STATISTICS will succeed because any privileges will do (authentication is enough).
---echo ** but will return no rows
-SELECT * FROM INFORMATION_SCHEMA.STATISTICS WHERE table_name='t5';
-#
-# Bug27145 EXTRA_ACL trouble
-#
---echo ** SHOW INDEX FROM t5 will fail because we don't have any privileges on any column combination.
---error 1142
-SHOW INDEX FROM t5;
---echo ** SHOW INDEX FROM t6 will succeed because there exist a privilege on a column combination on t6.
-SHOW INDEX FROM t6;
-
-# CHECK TABLE
---echo ** CHECK TABLE requires any privilege on any column combination and should succeed for t6:
-CHECK TABLE t6;
---echo ** With no privileges access is naturally denied:
---error 1142
-CHECK TABLE t5;
-
-# CHECKSUM
---echo ** CHECKSUM TABLE requires SELECT privileges on the table. The following should fail:
---error 1142
-CHECKSUM TABLE t6;
---echo ** And this should work:
-CHECKSUM TABLE t_select_priv;
-
-# SHOW CREATE VIEW
---error 1142
-SHOW CREATE VIEW v5;
---error 1142
-SHOW CREATE VIEW v6;
---error 1142
-SHOW CREATE VIEW v2;
-SHOW CREATE VIEW v3;
-
-connection default;
-disconnect con1;
-drop database mysqltest_db1;
-drop user mysqltest_u1@localhost;
-
-
---echo #
---echo # Additional coverage for refactoring which is made as part
---echo # of fix for bug #27480 "Extend CREATE TEMPORARY TABLES privilege
---echo # to allow temp table operations".
---echo #
---echo # Check that for statements like CHECK/REPAIR and OPTIMIZE TABLE
---echo # privileges for all tables involved are checked before processing
---echo # any tables. Doing otherwise, i.e. checking privileges for table
---echo # right before processing it might result in lost results for tables
---echo # which were processed by the time when table for which privileges
---echo # are insufficient are discovered.
---echo #
-call mtr.add_suppression("Got an error from thread_id=.*ha_myisam.cc:");
-call mtr.add_suppression("MySQL thread id .*, query id .* localhost.*mysqltest_u1 Checking table");
---disable_warnings
-drop database if exists mysqltest_db1;
---enable_warnings
-let $MYSQLD_DATADIR = `SELECT @@datadir`;
-create database mysqltest_db1;
---echo # Create tables which we are going to CHECK/REPAIR.
-create table mysqltest_db1.t1 (a int, key(a)) engine=myisam;
-create table mysqltest_db1.t2 (b int);
-insert into mysqltest_db1.t1 values (1), (2);
-insert into mysqltest_db1.t2 values (1);
---echo # Create user which will try to do this.
-create user mysqltest_u1@localhost;
-grant insert, select on mysqltest_db1.t1 to mysqltest_u1@localhost;
-connect (con1,localhost,mysqltest_u1,,);
-connection default;
-
---echo # Corrupt t1 by replacing t1.MYI with a corrupt + unclosed one created
---echo # by doing: 'create table t1 (a int key(a))'
---echo # head -c1024 t1.MYI > corrupt_t1.MYI
-flush table mysqltest_db1.t1;
---remove_file $MYSQLD_DATADIR/mysqltest_db1/t1.MYI
---copy_file std_data/corrupt_t1.MYI $MYSQLD_DATADIR/mysqltest_db1/t1.MYI
-
-connection con1;
-check table mysqltest_db1.t1;
---echo # The below statement should fail before repairing t1.
---echo # Otherwise info about such repair will be missing from its result-set.
---error ER_TABLEACCESS_DENIED_ERROR
-repair table mysqltest_db1.t1, mysqltest_db1.t2;
---echo # The same is true for CHECK TABLE statement.
---error ER_TABLEACCESS_DENIED_ERROR
-check table mysqltest_db1.t1, mysqltest_db1.t2;
-check table mysqltest_db1.t1;
-repair table mysqltest_db1.t1;
-
---echo # Clean-up.
-disconnect con1;
---source include/wait_until_disconnected.inc
-connection default;
-drop database mysqltest_db1;
-drop user mysqltest_u1@localhost;
-
-create user foo1 identified by password '11111111111111111111111111111111111111111';
-create user foo2 identified by password '2222222222222222';
-create user foo3 identified via mysql_native_password using '11111111111111111111111111111111111111111';
-create user foo4 identified via mysql_old_password using '2222222222222222';
-
-grant select on test.* to foo5 identified by password '11111111111111111111111111111111111111111';
-grant select on test.* to foo6 identified by password '2222222222222222';
-grant select on test.* to foo7 identified via mysql_native_password using '11111111111111111111111111111111111111111';
-grant select on test.* to foo8 identified via mysql_old_password using '2222222222222222';
-
---sorted_result
-select user,password,plugin,authentication_string from mysql.user where user like 'foo%';
-
-drop user foo1;
-drop user foo2;
-drop user foo3;
-drop user foo4;
-drop user foo5;
-drop user foo6;
-drop user foo7;
-drop user foo8;
-
---error ER_PASSWD_LENGTH
-create user foo1 identified via mysql_native_password using '00';
---error ER_PASSWD_LENGTH
-create user foo2 identified via mysql_native_password using '2222222222222222';
---error ER_PASSWD_LENGTH
-create user foo3 identified via mysql_old_password using '00';
---error ER_PASSWD_LENGTH
-create user foo4 identified via mysql_old_password using '11111111111111111111111111111111111111111';
-
-
-set GLOBAL sql_mode=default;
diff --git a/mysql-test/t/grant5.test b/mysql-test/t/grant5.test
deleted file mode 100644
index 14f2fd65020..00000000000
--- a/mysql-test/t/grant5.test
+++ /dev/null
@@ -1,25 +0,0 @@
--- source include/not_embedded.inc
-
-#
-# MDEV-6625 SHOW GRANTS for current_user_name@wrong_host_name
-#
---error ER_NONEXISTING_GRANT
-SHOW GRANTS FOR root@invalid_host;
-
-#
-# MDEV-9580 SHOW GRANTS FOR <current_user> fails
-#
-create user test;
-create user foo;
-create role foo;
-grant foo to test;
---connect (conn_1, localhost, test,,)
-set role foo;
-show grants for test; # user
-show grants for foo; # role
---error ER_DBACCESS_DENIED_ERROR
-show grants for foo@'%'; # user
---connection default
-drop user test, foo;
-drop role foo;
-
diff --git a/mysql-test/t/grant_4332.test b/mysql-test/t/grant_4332.test
deleted file mode 100644
index 41e0b822f98..00000000000
--- a/mysql-test/t/grant_4332.test
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# MDEV-4332 Increase username length from 16 characters
-#
-# test that when ALTER-ing tables to have short usernames,
-# the server switches to short usernames internally too.
-#
-
---source include/not_embedded.inc
-set GLOBAL sql_mode="";
-set LOCAL sql_mode="";
-
-alter table mysql.user modify User char(16) binary not null default '';
-alter table mysql.db modify User char(16) binary not null default '';
-alter table mysql.tables_priv modify User char(16) binary not null default '';
-alter table mysql.columns_priv modify User char(16) binary not null default '';
-alter table mysql.procs_priv modify User char(16) binary not null default '';
-alter table mysql.proc modify definer char(77) collate utf8_bin not null default '';
-alter table mysql.event modify definer char(77) collate utf8_bin not null default '';
-flush privileges;
-
---enable_metadata
-select user();
---disable_metadata
-
---error ER_WRONG_STRING_LENGTH
-create user a17aaaaaaaaaaaaa0@localhost;
---error ER_WRONG_STRING_LENGTH
-grant usage on *.* to a17aaaaaaaaaaaaa0@lodalhost;
---error ER_WRONG_STRING_LENGTH
-drop user a17aaaaaaaaaaaaa0@lodalhost;
-
-alter table mysql.user modify User char(80) binary not null default '';
-alter table mysql.db modify User char(80) binary not null default '';
-alter table mysql.tables_priv modify User char(80) binary not null default '';
-alter table mysql.columns_priv modify User char(80) binary not null default '';
-alter table mysql.procs_priv modify User char(80) binary not null default '';
-alter table mysql.proc modify definer char(141) collate utf8_bin not null default '';
-alter table mysql.event modify definer char(141) collate utf8_bin not null default '';
-flush privileges;
-
---enable_metadata
-select user();
---disable_metadata
-
-set GLOBAL sql_mode=default;
diff --git a/mysql-test/t/grant_cache_no_prot.test b/mysql-test/t/grant_cache_no_prot.test
deleted file mode 100644
index 31209f343b9..00000000000
--- a/mysql-test/t/grant_cache_no_prot.test
+++ /dev/null
@@ -1,25 +0,0 @@
-#################### t/grant_cache_no_prot.test ###################
-#
-# Test grants with query cache to be run when mysqltest was started
-# without any "--<whatever>-protocol".
-#
-# Last update:
-# 2007-05-03 ML - Move t/grant_cache.test to include/grant_cache.inc
-# - Create this test as non "--<whatever>-protocol" variant.
-#
-
-# We cannot run on embedded server because we use multiple sessions.
---source include/not_embedded.inc
-
---source include/have_query_cache.inc
-
-# The file with expected results fits only to a run without
-# ps-protocol/sp-protocol/cursor-protocol/view-protocol.
-if (`SELECT $PS_PROTOCOL + $SP_PROTOCOL + $CURSOR_PROTOCOL
- + $VIEW_PROTOCOL > 0`)
-{
- --skip Need normal protocol
-}
-
-# The main testing script
---source include/grant_cache.inc
diff --git a/mysql-test/t/grant_cache_ps_prot.test b/mysql-test/t/grant_cache_ps_prot.test
deleted file mode 100644
index 27b3f23de3f..00000000000
--- a/mysql-test/t/grant_cache_ps_prot.test
+++ /dev/null
@@ -1,24 +0,0 @@
-#################### t/grant_cache_ps_prot.test ##################
-#
-# Test grants with query cache to be run when mysqltest was
-# started with the option "--ps-protocol".
-#
-# Last update:
-# 2007-05-03 ML - Move t/grant_cache.test to include/grant_cache.inc
-# - Create this test as "--ps-protocol" only variant.
-#
-
-# We cannot run on embedded server because we use multiple sessions.
---source include/not_embedded.inc
-
---source include/have_query_cache.inc
-
-# The file with expected results fits only to a run with "--ps-protocol".
-if (`SELECT $SP_PROTOCOL + $CURSOR_PROTOCOL + $VIEW_PROTOCOL > 0
- OR $PS_PROTOCOL = 0`)
-{
- --skip Need ps-protocol
-}
-
-# The main testing script
---source include/grant_cache.inc
diff --git a/mysql-test/t/grant_explain_non_select.test b/mysql-test/t/grant_explain_non_select.test
deleted file mode 100644
index 701586be325..00000000000
--- a/mysql-test/t/grant_explain_non_select.test
+++ /dev/null
@@ -1,263 +0,0 @@
-#
-# Privilege-specific tests for WL#4897: Add EXPLAIN INSERT/UPDATE/DELETE
-#
-
-# Grant tests not performed with embedded server
--- source include/not_embedded.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-set GLOBAL sql_mode="";
-set LOCAL sql_mode="";
-
-CREATE DATABASE privtest_db;
-
-CREATE TABLE privtest_db.t1 (a INT);
-CREATE TABLE privtest_db.t2 (a INT);
-INSERT INTO privtest_db.t2 VALUES (1), (2), (3);
-
-GRANT USAGE ON *.* TO 'privtest'@'localhost';
-GRANT SELECT ON privtest_db.t2 TO 'privtest'@'localhost';
-
-connect(con1,localhost,privtest,,);
-connection con1;
-
-USE privtest_db;
-
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO t1 VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
- INSERT INTO t1 VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN INSERT INTO t1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
- INSERT INTO t1 SELECT * FROM t2;
-
-connection default;
-GRANT INSERT ON privtest_db.t1 TO 'privtest'@'localhost';
-connection con1;
-
-EXPLAIN INSERT INTO t1 VALUES (10);
- INSERT INTO t1 VALUES (10);
-
-EXPLAIN INSERT INTO t1 SELECT * FROM t2;
- INSERT INTO t1 SELECT * FROM t2;
-
-
-connection default;
-REVOKE ALL PRIVILEGES ON privtest_db.t1 FROM 'privtest'@'localhost';
-connection con1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO t1 VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
- REPLACE INTO t1 VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO t1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
- REPLACE INTO t1 SELECT * FROM t2;
-
-connection default;
-GRANT INSERT ON privtest_db.t1 TO 'privtest'@'localhost';
-connection con1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO t1 VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
- REPLACE INTO t1 VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO t1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
- REPLACE INTO t1 SELECT * FROM t2;
-
-connection default;
-REVOKE INSERT ON privtest_db.t1 FROM 'privtest'@'localhost';
-GRANT DELETE ON privtest_db.t1 TO 'privtest'@'localhost';
-connection con1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO t1 VALUES (10);
---error ER_TABLEACCESS_DENIED_ERROR
- REPLACE INTO t1 VALUES (10);
-
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN REPLACE INTO t1 SELECT * FROM t2;
---error ER_TABLEACCESS_DENIED_ERROR
- REPLACE INTO t1 SELECT * FROM t2;
-
-connection default;
-GRANT INSERT, DELETE ON privtest_db.t1 TO 'privtest'@'localhost';
-connection con1;
-
-EXPLAIN REPLACE INTO t1 VALUES (10);
- REPLACE INTO t1 VALUES (10);
-
-EXPLAIN REPLACE INTO t1 SELECT * FROM t2;
- REPLACE INTO t1 SELECT * FROM t2;
-
-connection default;
-REVOKE ALL PRIVILEGES ON privtest_db.t1 FROM 'privtest'@'localhost';
-connection con1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE t1 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
- UPDATE t1 SET a = a + 1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
- UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
-
-connection default;
-GRANT UPDATE ON privtest_db.t1 TO 'privtest'@'localhost';
-connection con1;
-
---error ER_COLUMNACCESS_DENIED_ERROR
-EXPLAIN UPDATE t1 SET a = a + 1;
---error ER_COLUMNACCESS_DENIED_ERROR
- UPDATE t1 SET a = a + 1;
-
---error ER_COLUMNACCESS_DENIED_ERROR
-EXPLAIN UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
---error ER_COLUMNACCESS_DENIED_ERROR
- UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
-
-connection default;
-REVOKE UPDATE ON privtest_db.t1 FROM 'privtest'@'localhost';
-GRANT SELECT ON privtest_db.t1 TO 'privtest'@'localhost';
-connection con1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE t1 SET a = a + 1;
---error ER_TABLEACCESS_DENIED_ERROR
- UPDATE t1 SET a = a + 1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
- UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
-
-connection default;
-GRANT UPDATE, SELECT ON privtest_db.t1 TO 'privtest'@'localhost';
-connection con1;
-
-EXPLAIN UPDATE t1 SET a = a + 1;
- UPDATE t1 SET a = a + 1;
-
-EXPLAIN UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
- UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a;
-
-connection default;
-REVOKE ALL PRIVILEGES ON privtest_db.t1 FROM 'privtest'@'localhost';
-connection con1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM t1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
- DELETE FROM t1 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
- DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
-
-connection default;
-GRANT DELETE ON privtest_db.t1 TO 'privtest'@'localhost';
-connection con1;
-
---error ER_COLUMNACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM t1 WHERE a = 10;
---error ER_COLUMNACCESS_DENIED_ERROR
- DELETE FROM t1 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
- DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
-
-connection default;
-REVOKE ALL PRIVILEGES ON privtest_db.t1 FROM 'privtest'@'localhost';
-GRANT SELECT ON privtest_db.t1 TO 'privtest'@'localhost';
-connection con1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM t1 WHERE a = 10;
---error ER_TABLEACCESS_DENIED_ERROR
- DELETE FROM t1 WHERE a = 10;
-
---error ER_TABLEACCESS_DENIED_ERROR
-EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
---error ER_TABLEACCESS_DENIED_ERROR
- DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
-
-connection default;
-REVOKE ALL PRIVILEGES ON privtest_db.t1 FROM 'privtest'@'localhost';
-GRANT DELETE, SELECT ON privtest_db.t1 TO 'privtest'@'localhost';
-connection con1;
-
-EXPLAIN DELETE FROM t1 WHERE a = 10;
- DELETE FROM t1 WHERE a = 10;
-
-EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
- DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a;
-
-# Views
-
-connection default;
-REVOKE ALL PRIVILEGES ON privtest_db.t1 FROM 'privtest'@'localhost';
-CREATE VIEW privtest_db.v1 (a) AS SELECT a FROM privtest_db.t1;
-GRANT SELECT, INSERT, UPDATE, DELETE ON privtest_db.v1 TO 'privtest'@'localhost';
-connection con1;
-
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN SELECT * FROM v1;
- SELECT * FROM v1;
-
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v1 VALUES (10);
- INSERT INTO v1 VALUES (10);
-
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN INSERT INTO v1 SELECT * FROM t2;
- INSERT INTO v1 SELECT * FROM t2;
-
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v1 VALUES (10);
- REPLACE INTO v1 VALUES (10);
-
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN REPLACE INTO v1 SELECT * FROM t2;
- REPLACE INTO v1 SELECT * FROM t2;
-
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v1 SET a = a + 1;
- UPDATE v1 SET a = a + 1;
-
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
- UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a;
-
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v1 WHERE a = 10;
- DELETE FROM v1 WHERE a = 10;
-
---error ER_VIEW_NO_EXPLAIN
-EXPLAIN DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
- DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a;
-
-connection default;
-disconnect con1;
-
-DROP USER 'privtest'@localhost;
-USE test;
-DROP DATABASE privtest_db;
-
-set GLOBAL sql_mode=default;
-set LOCAL sql_mode=default;
-# Wait till we reached the initial number of concurrent sessions
---source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/grant_lowercase.opt b/mysql-test/t/grant_lowercase.opt
deleted file mode 100644
index 5b0a3d41b41..00000000000
--- a/mysql-test/t/grant_lowercase.opt
+++ /dev/null
@@ -1 +0,0 @@
---lower-case-table-names=1
diff --git a/mysql-test/t/grant_lowercase.test b/mysql-test/t/grant_lowercase.test
deleted file mode 100644
index e31a72b890e..00000000000
--- a/mysql-test/t/grant_lowercase.test
+++ /dev/null
@@ -1,30 +0,0 @@
-# test cases for strmov(tmp_db, db) -> strnmov replacement in sql_acl.cc
---source include/not_embedded.inc
-
-#
-# http://seclists.org/fulldisclosure/2012/Dec/4
-#
-set sql_mode="";
-# in acl_get(), check_grant_db(), mysql_grant()
-grant file on *.* to user1@localhost with grant option;
-grant select on `a%`.* to user1@localhost with grant option;
-connect (conn1,localhost,user1,,);
-connection conn1;
---error ER_WRONG_DB_NAME
-grant file on aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.* to 'user'@'%' identified by 'secret';
-connection default;
-disconnect conn1;
-drop user user1@localhost;
-
-# in acl_load()
-call mtr.add_suppression("Incorrect database name");
-alter table mysql.host modify Db varchar(200);
-alter table mysql.db modify User char(16) default "", modify Db varchar(200) default "";
-insert mysql.host set db=concat('=>', repeat(_utf8 'й', 200));
-insert mysql.db set db=concat('=>', repeat(_utf8 'й', 200));
-flush privileges; # shouldn't crash here
-delete from mysql.host where db like '=>%';
-delete from mysql.db where db like '=>%';
-alter table mysql.host modify Db char(64) default "";
-alter table mysql.db modify Db char(64) default "", modify User char(80) default "";
-flush privileges;
diff --git a/mysql-test/t/grant_lowercase_fs.test b/mysql-test/t/grant_lowercase_fs.test
deleted file mode 100644
index 92191829c58..00000000000
--- a/mysql-test/t/grant_lowercase_fs.test
+++ /dev/null
@@ -1,32 +0,0 @@
--- source include/have_case_insensitive_fs.inc
--- source include/not_embedded.inc
-
-
-#
-# Bug#41049 does syntax "grant" case insensitive?
-#
-create database db1;
-create user user_1@localhost;
-create user USER_1@localhost;
-GRANT CREATE ON db1.* to user_1@localhost;
-GRANT SELECT ON db1.* to USER_1@localhost;
-
-connect (con1,localhost,user_1,,db1);
-CREATE TABLE t1(f1 int);
---error 1142
-SELECT * FROM t1;
-connect (con2,localhost,USER_1,,db1);
-SELECT * FROM t1;
---error 1142
-CREATE TABLE t2(f1 int);
-
-connection default;
-disconnect con1;
-disconnect con2;
-
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM USER_1@localhost;
-DROP USER user_1@localhost;
-DROP USER USER_1@localhost;
-DROP DATABASE db1;
-use test;
diff --git a/mysql-test/t/greedy_optimizer.test b/mysql-test/t/greedy_optimizer.test
deleted file mode 100644
index dcd0587d76e..00000000000
--- a/mysql-test/t/greedy_optimizer.test
+++ /dev/null
@@ -1,391 +0,0 @@
-#
-# A simple test of the greedy query optimization algorithm and the switches that
-# control the optimizationprocess.
-#
-
-#
-# Schema
-#
---disable_warnings
-drop table if exists t1,t2,t3,t4,t5,t6,t7;
---enable_warnings
-
-set @save_join_cache_level=@@join_cache_level;
-set join_cache_level=1;
-
-create table t1 (
- c11 integer,c12 integer,c13 integer,c14 integer,c15 integer,c16 integer,
- primary key (c11)
-);
-create table t2 (
- c21 integer,c22 integer,c23 integer,c24 integer,c25 integer,c26 integer
-);
-create table t3 (
- c31 integer,c32 integer,c33 integer,c34 integer,c35 integer,c36 integer,
- primary key (c31)
-);
-create table t4 (
- c41 integer,c42 integer,c43 integer,c44 integer,c45 integer,c46 integer
-);
-create table t5 (
- c51 integer,c52 integer,c53 integer,c54 integer,c55 integer,c56 integer,
- primary key (c51)
-);
-create table t6 (
- c61 integer,c62 integer,c63 integer,c64 integer,c65 integer,c66 integer
-);
-create table t7 (
- c71 integer,c72 integer,c73 integer,c74 integer,c75 integer,c76 integer,
- primary key (c71)
-);
-
-#
-# Data
-# cardinality(Ti) = cardinality(T(i-1)) + 3
-#
-insert into t1 values (1,2,3,4,5,6);
-insert into t1 values (2,2,3,4,5,6);
-insert into t1 values (3,2,3,4,5,6);
-
-insert into t2 values (1,2,3,4,5,6);
-insert into t2 values (2,2,3,4,5,6);
-insert into t2 values (3,2,3,4,5,6);
-insert into t2 values (4,2,3,4,5,6);
-insert into t2 values (5,2,3,4,5,6);
-insert into t2 values (6,2,3,4,5,6);
-
-insert into t3 values (1,2,3,4,5,6);
-insert into t3 values (2,2,3,4,5,6);
-insert into t3 values (3,2,3,4,5,6);
-insert into t3 values (4,2,3,4,5,6);
-insert into t3 values (5,2,3,4,5,6);
-insert into t3 values (6,2,3,4,5,6);
-insert into t3 values (7,2,3,4,5,6);
-insert into t3 values (8,2,3,4,5,6);
-insert into t3 values (9,2,3,4,5,6);
-
-insert into t4 values (1,2,3,4,5,6);
-insert into t4 values (2,2,3,4,5,6);
-insert into t4 values (3,2,3,4,5,6);
-insert into t4 values (4,2,3,4,5,6);
-insert into t4 values (5,2,3,4,5,6);
-insert into t4 values (6,2,3,4,5,6);
-insert into t4 values (7,2,3,4,5,6);
-insert into t4 values (8,2,3,4,5,6);
-insert into t4 values (9,2,3,4,5,6);
-insert into t4 values (10,2,3,4,5,6);
-insert into t4 values (11,2,3,4,5,6);
-insert into t4 values (12,2,3,4,5,6);
-
-insert into t5 values (1,2,3,4,5,6);
-insert into t5 values (2,2,3,4,5,6);
-insert into t5 values (3,2,3,4,5,6);
-insert into t5 values (4,2,3,4,5,6);
-insert into t5 values (5,2,3,4,5,6);
-insert into t5 values (6,2,3,4,5,6);
-insert into t5 values (7,2,3,4,5,6);
-insert into t5 values (8,2,3,4,5,6);
-insert into t5 values (9,2,3,4,5,6);
-insert into t5 values (10,2,3,4,5,6);
-insert into t5 values (11,2,3,4,5,6);
-insert into t5 values (12,2,3,4,5,6);
-insert into t5 values (13,2,3,4,5,6);
-insert into t5 values (14,2,3,4,5,6);
-insert into t5 values (15,2,3,4,5,6);
-
-insert into t6 values (1,2,3,4,5,6);
-insert into t6 values (2,2,3,4,5,6);
-insert into t6 values (3,2,3,4,5,6);
-insert into t6 values (4,2,3,4,5,6);
-insert into t6 values (5,2,3,4,5,6);
-insert into t6 values (6,2,3,4,5,6);
-insert into t6 values (7,2,3,4,5,6);
-insert into t6 values (8,2,3,4,5,6);
-insert into t6 values (9,2,3,4,5,6);
-insert into t6 values (10,2,3,4,5,6);
-insert into t6 values (11,2,3,4,5,6);
-insert into t6 values (12,2,3,4,5,6);
-insert into t6 values (13,2,3,4,5,6);
-insert into t6 values (14,2,3,4,5,6);
-insert into t6 values (15,2,3,4,5,6);
-insert into t6 values (16,2,3,4,5,6);
-insert into t6 values (17,2,3,4,5,6);
-insert into t6 values (18,2,3,4,5,6);
-
-insert into t7 values (1,2,3,4,5,6);
-insert into t7 values (2,2,3,4,5,6);
-insert into t7 values (3,2,3,4,5,6);
-insert into t7 values (4,2,3,4,5,6);
-insert into t7 values (5,2,3,4,5,6);
-insert into t7 values (6,2,3,4,5,6);
-insert into t7 values (7,2,3,4,5,6);
-insert into t7 values (8,2,3,4,5,6);
-insert into t7 values (9,2,3,4,5,6);
-insert into t7 values (10,2,3,4,5,6);
-insert into t7 values (11,2,3,4,5,6);
-insert into t7 values (12,2,3,4,5,6);
-insert into t7 values (13,2,3,4,5,6);
-insert into t7 values (14,2,3,4,5,6);
-insert into t7 values (15,2,3,4,5,6);
-insert into t7 values (16,2,3,4,5,6);
-insert into t7 values (17,2,3,4,5,6);
-insert into t7 values (18,2,3,4,5,6);
-insert into t7 values (19,2,3,4,5,6);
-insert into t7 values (20,2,3,4,5,6);
-insert into t7 values (21,2,3,4,5,6);
-
-#
-# The actual test begins here
-#
-
-# Check the default values for the optimizer parameters
-
-select @@optimizer_search_depth;
-select @@optimizer_prune_level;
-
-# This value swithes back to the old implementation of 'find_best()'
-# set optimizer_search_depth=63; - old (independent of the optimizer_prune_level)
-#
-# These are the values for the parameters that control the greedy optimizer
-# (total 6 combinations - 3 for optimizer_search_depth, 2 for optimizer_prune_level):
-# 3:
-# set optimizer_search_depth=0; - automatic
-# set optimizer_search_depth=1; - min
-# set optimizer_search_depth=62; - max (default)
-# 2:
-# set optimizer_prune_level=0 - exhaustive;
-# set optimizer_prune_level=1 - heuristic; # default
-
-
-#
-# Compile several queries with all combinations of the query
-# optimizer parameters. Each test query has two variants, where
-# in the second variant the tables in the FROM clause are in
-# inverse order to the tables in the first variant.
-# Due to pre-sorting of tables before compilation, there should
-# be no difference in the plans for each two such query variants.
-#
-
-# First, for reference compile the test queries with the 'old' optimization
-# procedure 'find_best'. Notice that 'find_best' does not depend on the
-# choice of heuristic.
-
-set optimizer_search_depth=63;
-select @@optimizer_search_depth;
-
-# 6-table join, chain
-explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
-show status like 'Last_query_cost';
-explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
-show status like 'Last_query_cost';
-# 6-table join, star
-explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
-show status like 'Last_query_cost';
-explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
-show status like 'Last_query_cost';
-# 6-table join, clique
-explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
-show status like 'Last_query_cost';
-explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
-show status like 'Last_query_cost';
-
-
-# Test the new optimization procedures
-
-set optimizer_prune_level=0;
-select @@optimizer_prune_level;
-
-set optimizer_search_depth=0;
-select @@optimizer_search_depth;
-
-# 6-table join, chain
-explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
-show status like 'Last_query_cost';
-explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
-show status like 'Last_query_cost';
-# 6-table join, star
-explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
-show status like 'Last_query_cost';
-explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
-show status like 'Last_query_cost';
-# 6-table join, clique
-explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
-show status like 'Last_query_cost';
-explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
-show status like 'Last_query_cost';
-
-set optimizer_search_depth=1;
-select @@optimizer_search_depth;
-
-# 6-table join, chain
-explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
-show status like 'Last_query_cost';
-explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
-show status like 'Last_query_cost';
-# 6-table join, star
-explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
-show status like 'Last_query_cost';
-explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
-show status like 'Last_query_cost';
-# 6-table join, clique
-explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
-show status like 'Last_query_cost';
-explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
-show status like 'Last_query_cost';
-
-set optimizer_search_depth=62;
-select @@optimizer_search_depth;
-
-# 6-table join, chain
-explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
-show status like 'Last_query_cost';
-explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
-show status like 'Last_query_cost';
-# 6-table join, star
-explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
-show status like 'Last_query_cost';
-explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
-show status like 'Last_query_cost';
-# 6-table join, clique
-explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
-show status like 'Last_query_cost';
-explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
-show status like 'Last_query_cost';
-
-
-set optimizer_prune_level=1;
-select @@optimizer_prune_level;
-
-set optimizer_search_depth=0;
-select @@optimizer_search_depth;
-
-# 6-table join, chain
-explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
-show status like 'Last_query_cost';
-explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
-show status like 'Last_query_cost';
-# 6-table join, star
-explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
-show status like 'Last_query_cost';
-explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
-show status like 'Last_query_cost';
-# 6-table join, clique
-explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
-show status like 'Last_query_cost';
-explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
-show status like 'Last_query_cost';
-
-set optimizer_search_depth=1;
-select @@optimizer_search_depth;
-
-# 6-table join, chain
-explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
-show status like 'Last_query_cost';
-explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
-show status like 'Last_query_cost';
-# 6-table join, star
-explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
-show status like 'Last_query_cost';
-explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
-show status like 'Last_query_cost';
-# 6-table join, clique
-explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
-show status like 'Last_query_cost';
-explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
-show status like 'Last_query_cost';
-
-set optimizer_search_depth=62;
-select @@optimizer_search_depth;
-
-# 6-table join, chain
-explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
-show status like 'Last_query_cost';
-explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
-show status like 'Last_query_cost';
-# 6-table join, star
-explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
-show status like 'Last_query_cost';
-explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
-show status like 'Last_query_cost';
-# 6-table join, clique
-explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
-show status like 'Last_query_cost';
-explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
-show status like 'Last_query_cost';
-
-drop table t1,t2,t3,t4,t5,t6,t7;
-
-
-#
-# Bug # 38795: Automatic search depth and nested join's results in server
-# crash
-#
-
-CREATE TABLE t1 (a int, b int, d int, i int); INSERT INTO t1 VALUES (1,1,1,1);
-CREATE TABLE t2 (b int, c int, j int); INSERT INTO t2 VALUES (1,1,1);
-CREATE TABLE t2_1 (j int); INSERT INTO t2_1 VALUES (1);
-CREATE TABLE t3 (c int, f int); INSERT INTO t3 VALUES (1,1);
-CREATE TABLE t3_1 (f int); INSERT INTO t3_1 VALUES (1);
-CREATE TABLE t4 (d int, e int, k int); INSERT INTO t4 VALUES (1,1,1);
-CREATE TABLE t4_1 (k int); INSERT INTO t4_1 VALUES (1);
-CREATE TABLE t5 (g int, d int, h int, l int); INSERT INTO t5 VALUES (1,1,1,1);
-CREATE TABLE t5_1 (l int); INSERT INTO t5_1 VALUES (1);
-
-SET optimizer_search_depth = 3;
-
-SELECT 1
-FROM t1
-LEFT JOIN (
- t2 JOIN t3 ON t3.c = t2.c
-) ON t2.b = t1.b
-LEFT JOIN (
- t4 JOIN t5 ON t5.d = t4.d
-) ON t4.d = t1.d
-;
-
-SELECT 1
-FROM t1
-LEFT JOIN (
- t2 LEFT JOIN (t3 JOIN t3_1 ON t3.f = t3_1.f) ON t3.c = t2.c
-) ON t2.b = t1.b
-LEFT JOIN (
- t4 JOIN t5 ON t5.d = t4.d
-) ON t4.d = t1.d
-;
-
-SELECT 1
-FROM t1
-LEFT JOIN (
- (t2 JOIN t2_1 ON t2.j = t2_1.j) JOIN t3 ON t3.c = t2.c
-) ON t2.b = t1.b
-LEFT JOIN (
- t4 JOIN t5 ON t5.d = t4.d
-) ON t4.d = t1.d
-;
-
-SELECT 1
-FROM t1
-LEFT JOIN (
- t2 JOIN t3 ON t3.c = t2.c
-) ON t2.b = t1.b
-LEFT JOIN (
- (t4 JOIN t4_1 ON t4.k = t4_1.k) LEFT JOIN t5 ON t5.d = t4.d
-) ON t4.d = t1.d
-;
-
-SELECT 1
-FROM t1
-LEFT JOIN (
- t2 JOIN t3 ON t3.c = t2.c
-) ON t2.b = t1.b
-LEFT JOIN (
- t4 LEFT JOIN (t5 JOIN t5_1 ON t5.l = t5_1.l) ON t5.d = t4.d
-) ON t4.d = t1.d
-;
-
-SET optimizer_search_depth = DEFAULT;
-DROP TABLE t1,t2,t2_1,t3,t3_1,t4,t4_1,t5,t5_1;
-
---echo End of 5.0 tests
-
-set join_cache_level=@save_join_cache_level;
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
deleted file mode 100644
index 275939df5c5..00000000000
--- a/mysql-test/t/group_by.test
+++ /dev/null
@@ -1,1950 +0,0 @@
-# Initialise
---disable_warnings
-drop table if exists t1,t2,t3;
---enable_warnings
-
-#
-# Simple test without tables
-
--- error 1111
-SELECT 1 FROM (SELECT 1) as a GROUP BY SUM(1);
-
-#
-# Test of group (Failed for Lars Hoss <lh@pbm.de>)
-#
-
-CREATE TABLE t1 (
- spID int(10) unsigned,
- userID int(10) unsigned,
- score smallint(5) unsigned,
- lsg char(40),
- date date
-);
-
-INSERT INTO t1 VALUES (1,1,1,'','0000-00-00');
-INSERT INTO t1 VALUES (2,2,2,'','0000-00-00');
-INSERT INTO t1 VALUES (2,1,1,'','0000-00-00');
-INSERT INTO t1 VALUES (3,3,3,'','0000-00-00');
-
-CREATE TABLE t2 (
- userID int(10) unsigned NOT NULL auto_increment,
- niName char(15),
- passwd char(8),
- mail char(50),
- isAukt enum('N','Y') DEFAULT 'N',
- vName char(30),
- nName char(40),
- adr char(60),
- plz char(5),
- ort char(35),
- land char(20),
- PRIMARY KEY (userID)
-);
-
-INSERT INTO t2 VALUES (1,'name','pass','mail','Y','v','n','adr','1','1','1');
-INSERT INTO t2 VALUES (2,'name','pass','mail','Y','v','n','adr','1','1','1');
-INSERT INTO t2 VALUES (3,'name','pass','mail','Y','v','n','adr','1','1','1');
-INSERT INTO t2 VALUES (4,'name','pass','mail','Y','v','n','adr','1','1','1');
-INSERT INTO t2 VALUES (5,'name','pass','mail','Y','v','n','adr','1','1','1');
-
-SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID GROUP BY t2.userid;
-SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID GROUP BY t2.userid ORDER BY NULL;
-SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid;
-SELECT t2.userid, MIN(t1.score+0.0) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid;
-SELECT t2.userid, MIN(t1.score+0.0) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid ORDER BY NULL;
-EXPLAIN SELECT t2.userid, MIN(t1.score+0.0) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid ORDER BY NULL;
-drop table t1,t2;
-
-#
-# Bug in GROUP BY, by Nikki Chumakov <nikki@saddam.cityline.ru>
-#
-
-CREATE TABLE t1 (
- PID int(10) unsigned NOT NULL auto_increment,
- payDate date DEFAULT '0000-00-00' NOT NULL,
- recDate datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
- URID int(10) unsigned DEFAULT '0' NOT NULL,
- CRID int(10) unsigned DEFAULT '0' NOT NULL,
- amount int(10) unsigned DEFAULT '0' NOT NULL,
- operator int(10) unsigned,
- method enum('unknown','cash','dealer','check','card','lazy','delayed','test') DEFAULT 'unknown' NOT NULL,
- DIID int(10) unsigned,
- reason char(1) binary DEFAULT '' NOT NULL,
- code_id int(10) unsigned,
- qty mediumint(8) unsigned DEFAULT '0' NOT NULL,
- PRIMARY KEY (PID),
- KEY URID (URID),
- KEY reason (reason),
- KEY method (method),
- KEY payDate (payDate)
-);
-
-INSERT INTO t1 VALUES (1,'1970-01-01','1997-10-17 00:00:00',2529,1,21000,11886,'check',0,'F',16200,6);
-
---error 1056
-SELECT COUNT(P.URID),SUM(P.amount),P.method, MIN(PP.recdate+0) > 19980501000000 AS IsNew FROM t1 AS P JOIN t1 as PP WHERE P.URID = PP.URID GROUP BY method,IsNew;
-
-drop table t1;
-
-#
-# Problem with GROUP BY + ORDER BY when no match
-# Tested with locking
-#
-
-CREATE TABLE t1 (
- cid mediumint(9) NOT NULL auto_increment,
- firstname varchar(32) DEFAULT '' NOT NULL,
- surname varchar(32) DEFAULT '' NOT NULL,
- PRIMARY KEY (cid)
-);
-INSERT INTO t1 VALUES (1,'That','Guy');
-INSERT INTO t1 VALUES (2,'Another','Gent');
-
-CREATE TABLE t2 (
- call_id mediumint(8) NOT NULL auto_increment,
- contact_id mediumint(8) DEFAULT '0' NOT NULL,
- PRIMARY KEY (call_id),
- KEY contact_id (contact_id)
-);
-
-lock tables t1 read,t2 write;
-
-INSERT INTO t2 VALUES (10,2);
-INSERT INTO t2 VALUES (18,2);
-INSERT INTO t2 VALUES (62,2);
-INSERT INTO t2 VALUES (91,2);
-INSERT INTO t2 VALUES (92,2);
-
-SELECT cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid;
-SELECT cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid ORDER BY NULL;
-SELECT HIGH_PRIORITY cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid ORDER BY surname, firstname;
-
-drop table t2;
-unlock tables;
-drop table t1;
-
-#
-# Test of group by bug in bugzilla
-#
-
-CREATE TABLE t1 (
- bug_id mediumint(9) NOT NULL auto_increment,
- groupset bigint(20) DEFAULT '0' NOT NULL,
- assigned_to mediumint(9) DEFAULT '0' NOT NULL,
- bug_file_loc text,
- bug_severity enum('blocker','critical','major','normal','minor','trivial','enhancement') DEFAULT 'blocker' NOT NULL,
- bug_status enum('','NEW','ASSIGNED','REOPENED','RESOLVED','VERIFIED','CLOSED') DEFAULT 'NEW' NOT NULL,
- creation_ts datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
- delta_ts timestamp,
- short_desc mediumtext,
- long_desc mediumtext,
- op_sys enum('All','Windows 3.1','Windows 95','Windows 98','Windows NT','Windows 2000','Linux','other') DEFAULT 'All' NOT NULL,
- priority enum('P1','P2','P3','P4','P5') DEFAULT 'P1' NOT NULL,
- product varchar(64) DEFAULT '' NOT NULL,
- rep_platform enum('All','PC','VTD-8','Other'),
- reporter mediumint(9) DEFAULT '0' NOT NULL,
- version varchar(16) DEFAULT '' NOT NULL,
- component varchar(50) DEFAULT '' NOT NULL,
- resolution enum('','FIXED','INVALID','WONTFIX','LATER','REMIND','DUPLICATE','WORKSFORME') DEFAULT '' NOT NULL,
- target_milestone varchar(20) DEFAULT '' NOT NULL,
- qa_contact mediumint(9) DEFAULT '0' NOT NULL,
- status_whiteboard mediumtext NOT NULL,
- votes mediumint(9) DEFAULT '0' NOT NULL,
- PRIMARY KEY (bug_id),
- KEY assigned_to (assigned_to),
- KEY creation_ts (creation_ts),
- KEY delta_ts (delta_ts),
- KEY bug_severity (bug_severity),
- KEY bug_status (bug_status),
- KEY op_sys (op_sys),
- KEY priority (priority),
- KEY product (product),
- KEY reporter (reporter),
- KEY version (version),
- KEY component (component),
- KEY resolution (resolution),
- KEY target_milestone (target_milestone),
- KEY qa_contact (qa_contact),
- KEY votes (votes)
-);
-
-INSERT INTO t1 VALUES (1,0,0,'','normal','','2000-02-10 09:25:12',20000321114747,'','','Linux','P1','TestProduct','PC',3,'other','TestComponent','','M1',0,'',0);
-INSERT INTO t1 VALUES (9,0,0,'','enhancement','','2000-03-10 11:49:36',20000321114747,'','','All','P5','AAAAA','PC',3,'2.00 CD - Pre','BBBBBBBBBBBBB - conversion','','',0,'',0);
-INSERT INTO t1 VALUES (10,0,0,'','enhancement','','2000-03-10 18:10:16',20000321114747,'','','All','P4','AAAAA','PC',3,'2.00 CD - Pre','BBBBBBBBBBBBB - conversion','','',0,'',0);
-INSERT INTO t1 VALUES (7,0,0,'','critical','','2000-03-09 10:50:21',20000321114747,'','','All','P1','AAAAA','PC',3,'2.00 CD - Pre','BBBBBBBBBBBBB - generic','','',0,'',0);
-INSERT INTO t1 VALUES (6,0,0,'','normal','','2000-03-09 10:42:44',20000321114747,'','','All','P2','AAAAA','PC',3,'2.00 CD - Pre','kkkkkkkkkkk lllllllllll','','',0,'',0);
-INSERT INTO t1 VALUES (8,0,0,'','major','','2000-03-09 11:32:14',20000321114747,'','','All','P3','AAAAA','PC',3,'2.00 CD - Pre','kkkkkkkkkkk lllllllllll','','',0,'',0);
-INSERT INTO t1 VALUES (5,0,0,'','enhancement','','2000-03-09 10:38:59',20000321114747,'','','All','P5','CCC/CCCCCC','PC',5,'7.00','Administration','','',0,'',0);
-INSERT INTO t1 VALUES (4,0,0,'','normal','','2000-03-08 18:32:14',20000321114747,'','','other','P2','TestProduct','Other',3,'other','TestComponent2','','',0,'',0);
-INSERT INTO t1 VALUES (3,0,0,'','normal','','2000-03-08 18:30:52',20000321114747,'','','other','P2','TestProduct','Other',3,'other','TestComponent','','',0,'',0);
-INSERT INTO t1 VALUES (2,0,0,'','enhancement','','2000-03-08 18:24:51',20000321114747,'','','All','P2','TestProduct','Other',4,'other','TestComponent2','','',0,'',0);
-INSERT INTO t1 VALUES (11,0,0,'','blocker','','2000-03-13 09:43:41',20000321114747,'','','All','P2','CCC/CCCCCC','PC',5,'7.00','DDDDDDDDD','','',0,'',0);
-INSERT INTO t1 VALUES (12,0,0,'','normal','','2000-03-13 16:14:31',20000321114747,'','','All','P2','AAAAA','PC',3,'2.00 CD - Pre','kkkkkkkkkkk lllllllllll','','',0,'',0);
-INSERT INTO t1 VALUES (13,0,0,'','normal','','2000-03-15 16:20:44',20000321114747,'','','other','P2','TestProduct','Other',3,'other','TestComponent','','',0,'',0);
-INSERT INTO t1 VALUES (14,0,0,'','blocker','','2000-03-15 18:13:47',20000321114747,'','','All','P1','AAAAA','PC',3,'2.00 CD - Pre','BBBBBBBBBBBBB - generic','','',0,'',0);
-INSERT INTO t1 VALUES (15,0,0,'','minor','','2000-03-16 18:03:28',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','DDDDDDDDD','','',0,'',0);
-INSERT INTO t1 VALUES (16,0,0,'','normal','','2000-03-16 18:33:41',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','Administration','','',0,'',0);
-INSERT INTO t1 VALUES (17,0,0,'','normal','','2000-03-16 18:34:18',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','Administration','','',0,'',0);
-INSERT INTO t1 VALUES (18,0,0,'','normal','','2000-03-16 18:34:56',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','Administration','','',0,'',0);
-INSERT INTO t1 VALUES (19,0,0,'','enhancement','','2000-03-16 18:35:34',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','Administration','','',0,'',0);
-INSERT INTO t1 VALUES (20,0,0,'','enhancement','','2000-03-16 18:36:23',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','Administration','','',0,'',0);
-INSERT INTO t1 VALUES (21,0,0,'','enhancement','','2000-03-16 18:37:23',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','Administration','','',0,'',0);
-INSERT INTO t1 VALUES (22,0,0,'','enhancement','','2000-03-16 18:38:16',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','Administration','','',0,'',0);
-INSERT INTO t1 VALUES (23,0,0,'','normal','','2000-03-16 18:58:12',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','DDDDDDDDD','','',0,'',0);
-INSERT INTO t1 VALUES (24,0,0,'','normal','','2000-03-17 11:08:10',20000321114747,'','','All','P2','AAAAAAAA-AAA','PC',3,'2.8','Web Interface','','',0,'',0);
-INSERT INTO t1 VALUES (25,0,0,'','normal','','2000-03-17 11:10:45',20000321114747,'','','All','P2','AAAAAAAA-AAA','PC',3,'2.8','Web Interface','','',0,'',0);
-INSERT INTO t1 VALUES (26,0,0,'','normal','','2000-03-17 11:15:47',20000321114747,'','','All','P2','AAAAAAAA-AAA','PC',3,'2.8','Web Interface','','',0,'',0);
-INSERT INTO t1 VALUES (27,0,0,'','normal','','2000-03-17 17:45:41',20000321114747,'','','All','P2','CCC/CCCCCC','PC',5,'7.00','DDDDDDDDD','','',0,'',0);
-INSERT INTO t1 VALUES (28,0,0,'','normal','','2000-03-20 09:51:45',20000321114747,'','','Windows NT','P2','TestProduct','PC',8,'other','TestComponent','','',0,'',0);
-INSERT INTO t1 VALUES (29,0,0,'','normal','','2000-03-20 11:15:09',20000321114747,'','','All','P5','AAAAAAAA-AAA','PC',3,'2.8','Web Interface','','',0,'',0);
-CREATE TABLE t2 (
- value tinytext,
- program varchar(64),
- initialowner tinytext NOT NULL,
- initialqacontact tinytext NOT NULL,
- description mediumtext NOT NULL
-);
-
-INSERT INTO t2 VALUES ('TestComponent','TestProduct','id0001','','');
-INSERT INTO t2 VALUES ('BBBBBBBBBBBBB - conversion','AAAAA','id0001','','');
-INSERT INTO t2 VALUES ('BBBBBBBBBBBBB - generic','AAAAA','id0001','','');
-INSERT INTO t2 VALUES ('TestComponent2','TestProduct','id0001','','');
-INSERT INTO t2 VALUES ('BBBBBBBBBBBBB - eeeeeeeee','AAAAA','id0001','','');
-INSERT INTO t2 VALUES ('kkkkkkkkkkk lllllllllll','AAAAA','id0001','','');
-INSERT INTO t2 VALUES ('Test Procedures','AAAAA','id0001','','');
-INSERT INTO t2 VALUES ('Documentation','AAAAA','id0003','','');
-INSERT INTO t2 VALUES ('DDDDDDDDD','CCC/CCCCCC','id0002','','');
-INSERT INTO t2 VALUES ('Eeeeeeee Lite','CCC/CCCCCC','id0002','','');
-INSERT INTO t2 VALUES ('Eeeeeeee Full','CCC/CCCCCC','id0002','','');
-INSERT INTO t2 VALUES ('Administration','CCC/CCCCCC','id0002','','');
-INSERT INTO t2 VALUES ('Distribution','CCC/CCCCCC','id0002','','');
-INSERT INTO t2 VALUES ('Setup','CCC/CCCCCC','id0002','','');
-INSERT INTO t2 VALUES ('Unspecified','CCC/CCCCCC','id0002','','');
-INSERT INTO t2 VALUES ('Web Interface','AAAAAAAA-AAA','id0001','','');
-INSERT INTO t2 VALUES ('Host communication','AAAAA','id0001','','');
-select value,description,bug_id from t2 left join t1 on t2.program=t1.product and t2.value=t1.component where program="AAAAA";
-select value,description,COUNT(bug_id) from t2 left join t1 on t2.program=t1.product and t2.value=t1.component where program="AAAAA" group by value;
-select value,description,COUNT(bug_id) from t2 left join t1 on t2.program=t1.product and t2.value=t1.component where program="AAAAA" group by value having COUNT(bug_id) IN (0,2);
-
-drop table t1,t2;
-
-#
-# Problem with functions and group functions when no matching rows
-#
-
-create table t1 (foo int);
-insert into t1 values (1);
-select 1+1, "a",count(*) from t1 where foo in (2);
-insert into t1 values (1);
-select 1+1,"a",count(*) from t1 where foo in (2);
-drop table t1;
-
-#
-# Test GROUP BY DESC
-
-CREATE TABLE t1 (
- spID int(10) unsigned,
- userID int(10) unsigned,
- score smallint(5) unsigned,
- key (spid),
- key (score)
-);
-
-INSERT INTO t1 VALUES (1,1,1),(2,2,2),(2,1,1),(3,3,3),(4,3,3),(5,3,3),(6,3,3),(7,3,3);
-explain select userid,count(*) from t1 group by userid desc;
-explain select userid,count(*) from t1 group by userid desc order by null;
-select userid,count(*) from t1 group by userid desc;
-select userid,count(*) from t1 group by userid desc having (count(*)+1) IN (4,3);
-select userid,count(*) from t1 group by userid desc having 3 IN (1,COUNT(*));
-explain select spid,count(*) from t1 where spid between 1 and 2 group by spid desc;
-explain select spid,count(*) from t1 where spid between 1 and 2 group by spid;
-explain select spid,count(*) from t1 where spid between 1 and 2 group by spid order by null;
-select spid,count(*) from t1 where spid between 1 and 2 group by spid;
-select spid,count(*) from t1 where spid between 1 and 2 group by spid desc;
-explain extended select sql_big_result spid,sum(userid) from t1 group by spid desc;
-explain select sql_big_result spid,sum(userid) from t1 group by spid desc order by null;
-select sql_big_result spid,sum(userid) from t1 group by spid desc;
-explain select sql_big_result score,count(*) from t1 group by score desc;
-explain select sql_big_result score,count(*) from t1 group by score desc order by null;
-select sql_big_result score,count(*) from t1 group by score desc;
-drop table t1;
-
-# not purely group_by bug, but group_by is involved...
-
-create table t1 (a date default null, b date default null);
-insert t1 values ('1999-10-01','2000-01-10'), ('1997-01-01','1998-10-01');
-select a,min(b) c,count(distinct rand()) from t1 group by a having c<a + interval 1 day;
-drop table t1;
-
-# Compare with hash keys
-
-CREATE TABLE t1 (a char(1));
-INSERT INTO t1 VALUES ('A'),('B'),('A'),('B'),('A'),('B'),(NULL),('a'),('b'),(NULL),('A'),('B'),(NULL);
-SELECT a FROM t1 GROUP BY a;
-SELECT a,count(*) FROM t1 GROUP BY a;
-SELECT a FROM t1 GROUP BY binary a;
-SELECT a,count(*) FROM t1 GROUP BY binary a;
-SELECT binary a FROM t1 GROUP BY 1;
-SELECT binary a,count(*) FROM t1 GROUP BY 1;
-# Do the same tests with MyISAM temporary tables
-SET BIG_TABLES=1;
-SELECT a FROM t1 GROUP BY a;
-SELECT a,count(*) FROM t1 GROUP BY a;
-SELECT a FROM t1 GROUP BY binary a;
-SELECT a,count(*) FROM t1 GROUP BY binary a;
-SELECT binary a FROM t1 GROUP BY 1;
-SELECT binary a,count(*) FROM t1 GROUP BY 1;
-SET BIG_TABLES=0;
-drop table t1;
-
-#
-# Test of key >= 256 bytes
-#
-
-CREATE TABLE t1 (
- `a` char(193) default NULL,
- `b` char(63) default NULL
-);
-INSERT INTO t1 VALUES ('abc','def'),('hij','klm');
-SELECT CONCAT(a, b) FROM t1 GROUP BY 1;
-SELECT CONCAT(a, b),count(*) FROM t1 GROUP BY 1;
-SELECT CONCAT(a, b),count(distinct a) FROM t1 GROUP BY 1;
-SELECT 1 FROM t1 GROUP BY CONCAT(a, b);
-INSERT INTO t1 values ('hij','klm');
-SELECT CONCAT(a, b),count(*) FROM t1 GROUP BY 1;
-DROP TABLE t1;
-
-#
-# Test problem with ORDER BY on a SUM() column
-#
-
-create table t1 (One int unsigned, Two int unsigned, Three int unsigned, Four int unsigned);
-insert into t1 values (1,2,1,4),(1,2,2,4),(1,2,3,4),(1,2,4,4),(1,1,1,4),(1,1,2,4),(1,1,3,4),(1,1,4,4),(1,3,1,4),(1,3,2,4),(1,3,3,4),(1,3,4,4);
-select One, Two, sum(Four) from t1 group by One,Two;
-drop table t1;
-
-create table t1 (id integer primary key not null auto_increment, gender char(1));
-insert into t1 values (NULL, 'M'), (NULL, 'F'),(NULL, 'F'),(NULL, 'F'),(NULL, 'M');
-create table t2 (user_id integer not null, date date);
-insert into t2 values (1, '2002-06-09'),(2, '2002-06-09'),(1, '2002-06-09'),(3, '2002-06-09'),(4, '2002-06-09'),(4, '2002-06-09');
-select u.gender as gender, count(distinct u.id) as dist_count, (count(distinct u.id)/5*100) as percentage from t1 u, t2 l where l.user_id = u.id group by u.gender;
-select u.gender as gender, count(distinct u.id) as dist_count, (count(distinct u.id)/5*100) as percentage from t1 u, t2 l where l.user_id = u.id group by u.gender order by percentage;
-drop table t1,t2;
-
-#
-# The GROUP BY returned rows in wrong order in 3.23.51
-#
-
-CREATE TABLE t1 (ID1 int, ID2 int, ID int NOT NULL AUTO_INCREMENT,PRIMARY KEY(ID
-));
-insert into t1 values (1,244,NULL),(2,243,NULL),(134,223,NULL),(185,186,NULL);
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='outer_join_with_cache=off';
-select S.ID as xID, S.ID1 as xID1 from t1 as S left join t1 as yS on S.ID1 between yS.ID1 and yS.ID2;
-select S.ID as xID, S.ID1 as xID1, repeat('*',count(distinct yS.ID)) as Level from t1 as S left join t1 as yS on S.ID1 between yS.ID1 and yS.ID2 group by xID order by xID1;
-SET optimizer_switch=@save_optimizer_switch;
-drop table t1;
-
-#
-# Problem with MAX and LEFT JOIN
-#
-
-CREATE TABLE t1 (
- pid int(11) unsigned NOT NULL default '0',
- c1id int(11) unsigned default NULL,
- c2id int(11) unsigned default NULL,
- value int(11) unsigned NOT NULL default '0',
- UNIQUE KEY pid2 (pid,c1id,c2id),
- UNIQUE KEY pid (pid,value)
-) ENGINE=MyISAM;
-
-INSERT INTO t1 VALUES (1, 1, NULL, 1),(1, 2, NULL, 2),(1, NULL, 3, 3),(1, 4, NULL, 4),(1, 5, NULL, 5);
-
-CREATE TABLE t2 (
- id int(11) unsigned NOT NULL default '0',
- active enum('Yes','No') NOT NULL default 'Yes',
- PRIMARY KEY (id)
-) ENGINE=MyISAM;
-
-INSERT INTO t2 VALUES (1, 'Yes'),(2, 'No'),(4, 'Yes'),(5, 'No');
-
-CREATE TABLE t3 (
- id int(11) unsigned NOT NULL default '0',
- active enum('Yes','No') NOT NULL default 'Yes',
- PRIMARY KEY (id)
-);
-INSERT INTO t3 VALUES (3, 'Yes');
-
-select * from t1 AS m LEFT JOIN t2 AS c1 ON m.c1id =
-c1.id AND c1.active = 'Yes' LEFT JOIN t3 AS c2 ON m.c2id = c2.id AND
-c2.active = 'Yes' WHERE m.pid=1 AND (c1.id IS NOT NULL OR c2.id IS NOT NULL);
-select max(value) from t1 AS m LEFT JOIN t2 AS c1 ON
-m.c1id = c1.id AND c1.active = 'Yes' LEFT JOIN t3 AS c2 ON m.c2id =
-c2.id AND c2.active = 'Yes' WHERE m.pid=1 AND (c1.id IS NOT NULL OR c2.id IS
-NOT NULL);
-drop table t1,t2,t3;
-
-#
-# Test bug in GROUP BY on BLOB that is NULL or empty
-#
-
-create table t1 (a blob null);
-insert into t1 values (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(""),(""),(""),("b");
-select a,count(*) from t1 group by a;
-set big_tables=1;
-select a,count(*) from t1 group by a;
-drop table t1;
-set big_tables=0;
-
-#
-# Test of GROUP BY ... ORDER BY NULL optimization
-#
-
-create table t1 (a int not null, b int not null);
-insert into t1 values (1,1),(1,2),(3,1),(3,2),(2,2),(2,1);
-create table t2 (a int not null, b int not null, key(a));
-insert into t2 values (1,3),(3,1),(2,2),(1,1);
-select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b;
-select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b ORDER BY NULL;
-explain select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b;
-explain select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b ORDER BY NULL;
-drop table t1,t2;
-
-#
-# group function arguments in some functions
-#
-
-create table t1 (a int, b int);
-insert into t1 values (1, 4),(10, 40),(1, 4),(10, 43),(1, 4),(10, 41),(1, 4),(10, 43),(1, 4);
-select a, MAX(b), INTERVAL (MAX(b), 1,3,10,30,39,40,50,60,100,1000) from t1 group by a;
-select a, MAX(b), CASE MAX(b) when 4 then 4 when 43 then 43 else 0 end from t1 group by a;
-select a, MAX(b), FIELD(MAX(b), '43', '4', '5') from t1 group by a;
-select a, MAX(b), CONCAT_WS(MAX(b), '43', '4', '5') from t1 group by a;
-select a, MAX(b), ELT(MAX(b), 'a', 'b', 'c', 'd', 'e', 'f') from t1 group by a;
-select a, MAX(b), MAKE_SET(MAX(b), 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h') from t1 group by a;
-drop table t1;
-
-#
-# Problem with group by and alias
-#
-
-create table t1 (id int not null, qty int not null);
-insert into t1 values (1,2),(1,3),(2,4),(2,5);
-select id, sum(qty) as sqty, count(qty) as cqty from t1 group by id having sum(qty)>2 and cqty>1;
-select id, sum(qty) as sqty from t1 group by id having sqty>2 and count(qty)>1;
-select id, sum(qty) as sqty, count(qty) as cqty from t1 group by id having sqty>2 and cqty>1;
-select id, sum(qty) as sqty, count(qty) as cqty from t1 group by id having sum(qty)>2 and count(qty)>1;
-select count(*), case interval(qty,2,3,4,5,6,7,8) when -1 then NULL when 0 then "zero" when 1 then "one" when 2 then "two" end as category from t1 group by category;
-select count(*), interval(qty,2,3,4,5,6,7,8) as category from t1 group by category;
-drop table t1;
-#
-# Tests for bug #1355: 'Using filesort' is missing in EXPLAIN when ORDER BY
-# NULL is used.
-#
-CREATE TABLE t1 (
- userid int(10) unsigned,
- score smallint(5) unsigned,
- key (score)
-);
-INSERT INTO t1 VALUES (1,1),(2,2),(1,1),(3,3),(3,3),(3,3),(3,3),(3,3);
-# Here we select unordered GROUP BY into a temporary talbe,
-# and then sort it with filesort (GROUP BY in MySQL
-# implies sorted order of results)
-SELECT userid,count(*) FROM t1 GROUP BY userid DESC;
-EXPLAIN SELECT userid,count(*) FROM t1 GROUP BY userid DESC;
-DROP TABLE t1;
-CREATE TABLE t1 (
- i int(11) default NULL,
- j int(11) default NULL
-);
-INSERT INTO t1 VALUES (1,2),(2,3),(4,5),(3,5),(1,5),(23,5);
-SELECT i, COUNT(DISTINCT(i)) FROM t1 GROUP BY j ORDER BY NULL;
-explain SELECT i, COUNT(DISTINCT(i)) FROM t1 GROUP BY j ORDER BY NULL;
-DROP TABLE t1;
-
-#Test for BUG#6976: Aggregate functions have incorrect NULL-ness
-create table t1 (a int);
-insert into t1 values(null);
-select min(a) is null from t1;
-select min(a) is null or null from t1;
-select 1 and min(a) is null from t1;
-drop table t1;
-
-# Test for BUG#5400: GROUP_CONCAT returns everything twice.
-create table t1 ( col1 int, col2 int );
-insert into t1 values (1,1),(1,2),(1,3),(2,1),(2,2);
-select group_concat( distinct col1 ) as alias from t1
- group by col2 having alias like '%';
-
-drop table t1;
-
-#
-# Test BUG#8216 when referring in HAVING to n alias which is rand() function
-#
-
-create table t1 (a integer, b integer, c integer);
-insert into t1 (a,b) values (1,2),(1,3),(2,5);
-select a, 0.1*0+1 r2, sum(1) r1 from t1 where a = 1 group by a having r1>1 and r2=1;
-# rand(100)*10 will be < 2 only for the first row (of 6)
-select a, round(rand(100)*10) r2, sum(1) r1 from t1 where a = 1 group by a having r1>1 and r2<=2;
-select a, round(rand(100)*10) r2, sum(1) r1 from t1 group by a having r1>1 and r2<=2;
-select a,sum(b) from t1 where a=1 group by c;
-select a*sum(b) from t1 where a=1 group by c;
-select a*sum(b) as f1 from t1 where a=1 group by c having f1 <= 10;
-select a,a*sum(b) as f1 from t1 where a=1 group by c having a*sum(b)+0 <= 10;
-select sum(a)*sum(b) from t1 where a=1 group by c;
-select a,sum(b) from t1 where a=1 group by c having a=1;
-select a as d,sum(b) from t1 where a=1 group by c having d=1;
-select sum(a)*sum(b) as d from t1 where a=1 group by c having d > 0;
-drop table t1;
-
-# Test for BUG#9213 GROUP BY query on utf-8 key returns wrong results
-create table t1(a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(8),(9);
-create table t2 (
- a int,
- b varchar(200) NOT NULL,
- c varchar(50) NOT NULL,
- d varchar(100) NOT NULL,
- primary key (a,b(132),c,d),
- key a (a,b)
-) charset=utf8;
-
-insert into t2 select
- x3.a, -- 3
- concat('val-', x3.a + 3*x4.a), -- 12
- concat('val-', @a:=x3.a + 3*x4.a + 12*C.a), -- 120
- concat('val-', @a + 120*D.a)
-from t1 x3, t1 x4, t1 C, t1 D where x3.a < 3 and x4.a < 4 and D.a < 4;
-
-delete from t2 where a = 2 and b = 'val-2' order by a,b,c,d limit 30;
-
-explain select c from t2 where a = 2 and b = 'val-2' group by c;
-select c from t2 where a = 2 and b = 'val-2' group by c;
-drop table t1,t2;
-
-# Test for BUG#9298 "Wrong handling of int4 unsigned columns in GROUP functions"
-# (the actual problem was with protocol code, not GROUP BY)
-create table t1 (b int4 unsigned not null);
-insert into t1 values(3000000000);
-select * from t1;
-select min(b) from t1;
-drop table t1;
-
-#
-# Test for bug #11088: GROUP BY a BLOB column with COUNT(DISTINCT column1)
-#
-
-CREATE TABLE t1 (id int PRIMARY KEY, user_id int, hostname longtext);
-
-INSERT INTO t1 VALUES
- (1, 7, 'cache-dtc-af05.proxy.aol.com'),
- (2, 3, 'what.ever.com'),
- (3, 7, 'cache-dtc-af05.proxy.aol.com'),
- (4, 7, 'cache-dtc-af05.proxy.aol.com');
-
-SELECT hostname, COUNT(DISTINCT user_id) as no FROM t1
- WHERE hostname LIKE '%aol%'
- GROUP BY hostname;
-
-DROP TABLE t1;
-
-#
-# Test for bug #8614: GROUP BY 'const' with DISTINCT
-#
-
-CREATE TABLE t1 (a int, b int);
-INSERT INTO t1 VALUES (1,2), (1,3);
-SELECT a, b FROM t1 GROUP BY 'const';
-SELECT DISTINCT a, b FROM t1 GROUP BY 'const';
-
-DROP TABLE t1;
-
-#
-# Test for bug #11385: GROUP BY for datetime converted to decimals
-#
-
-CREATE TABLE t1 (id INT, dt DATETIME);
-INSERT INTO t1 VALUES ( 1, '2005-05-01 12:30:00' );
-INSERT INTO t1 VALUES ( 1, '2005-05-01 12:30:00' );
-INSERT INTO t1 VALUES ( 1, '2005-05-01 12:30:00' );
-INSERT INTO t1 VALUES ( 1, '2005-05-01 12:30:00' );
-SELECT dt DIV 1 AS f, id FROM t1 GROUP BY f;
-
-DROP TABLE t1;
-
-#
-# Test for bug #11295: GROUP BY a BLOB column with COUNT(DISTINCT column1)
-# when the BLOB column takes NULL values
-#
-
-CREATE TABLE t1 (id varchar(20) NOT NULL);
-INSERT INTO t1 VALUES ('trans1'), ('trans2');
-CREATE TABLE t2 (id varchar(20) NOT NULL, err_comment blob NOT NULL);
-INSERT INTO t2 VALUES ('trans1', 'a problem');
-SELECT COUNT(DISTINCT(t1.id)), LEFT(err_comment, 256) AS comment
- FROM t1 LEFT JOIN t2 ON t1.id=t2.id GROUP BY comment;
-
-DROP TABLE t1, t2;
-
-#
-# Bug #12266 GROUP BY expression on DATE column produces result with
-# reduced length
-#
-create table t1 (f1 date);
-insert into t1 values('2005-06-06');
-insert into t1 values('2005-06-06');
-select date(left(f1+0,8)) from t1 group by 1;
-drop table t1;
-
-#
-# Test for bug #11414: crash on Windows for a simple GROUP BY query
-#
-
-CREATE TABLE t1 (n int);
-INSERT INTO t1 VALUES (1);
-SELECT n+1 AS n FROM t1 GROUP BY n;
-DROP TABLE t1;
-
-#
-# BUG#12695: Item_func_isnull::update_used_tables
-# did not update const_item_cache
-#
-create table t1(f1 varchar(5) key);
-insert into t1 values (1),(2);
-select sql_buffer_result max(f1) is null from t1;
-select sql_buffer_result max(f1)+1 from t1;
-drop table t1;
-
-#
-# BUG#14019-4.1-opt
-#
-CREATE TABLE t1(a INT); INSERT INTO t1 VALUES (1),(2);
-
-SELECT a FROM t1 GROUP BY 'a';
-SELECT a FROM t1 GROUP BY "a";
-SELECT a FROM t1 GROUP BY `a`;
-
-set sql_mode=ANSI_QUOTES;
-SELECT a FROM t1 GROUP BY "a";
-SELECT a FROM t1 GROUP BY 'a';
-SELECT a FROM t1 GROUP BY `a`;
-set sql_mode='';
-
-SELECT a FROM t1 HAVING 'a' > 1;
-SELECT a FROM t1 HAVING "a" > 1;
-SELECT a FROM t1 HAVING `a` > 1;
-
-SELECT a FROM t1 ORDER BY 'a' DESC;
-SELECT a FROM t1 ORDER BY "a" DESC;
-SELECT a FROM t1 ORDER BY `a` DESC;
-DROP TABLE t1;
-
-#
-# Bug #29717 INSERT INTO SELECT inserts values even if SELECT statement itself
-# returns empty
-#
-CREATE TABLE t1 (
- f1 int(10) unsigned NOT NULL auto_increment primary key,
- f2 varchar(100) NOT NULL default ''
-);
-CREATE TABLE t2 (
- f1 varchar(10) NOT NULL default '',
- f2 char(3) NOT NULL default '',
- PRIMARY KEY (`f1`),
- KEY `k1` (`f2`,`f1`)
-);
-
-INSERT INTO t1 values(NULL, '');
-INSERT INTO `t2` VALUES ('486878','WDT'),('486910','WDT');
-SELECT SQL_BUFFER_RESULT avg(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
-SELECT avg(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
-DROP TABLE t1, t2;
-
-
-# End of 4.1 tests
-
-#
-# Bug#11211: Ambiguous column reference in GROUP BY.
-#
-
-create table t1 (c1 char(3), c2 char(3));
-create table t2 (c3 char(3), c4 char(3));
-insert into t1 values ('aaa', 'bb1'), ('aaa', 'bb2');
-insert into t2 values ('aaa', 'bb1'), ('aaa', 'bb2');
-
-# query with ambiguous column reference 'c2'
-select t1.c1 as c2 from t1, t2 where t1.c2 = t2.c4
-group by c2;
-show warnings;
-
-# this query has no ambiguity
-select t1.c1 as c2 from t1, t2 where t1.c2 = t2.c4
-group by t1.c1;
-
-show warnings;
-drop table t1, t2;
-
-#
-# Bug #20466: a view is mixing data when there's a trigger on the table
-#
-CREATE TABLE t1 (a tinyint(3), b varchar(255), PRIMARY KEY (a));
-
-INSERT INTO t1 VALUES (1,'-----'), (6,'Allemagne'), (17,'Autriche'),
- (25,'Belgique'), (54,'Danemark'), (62,'Espagne'), (68,'France');
-
-CREATE TABLE t2 (a tinyint(3), b tinyint(3), PRIMARY KEY (a), KEY b (b));
-
-INSERT INTO t2 VALUES (1,1), (2,1), (6,6), (18,17), (15,25), (16,25),
- (17,25), (10,54), (5,62),(3,68);
-
-CREATE VIEW v1 AS select t1.a, concat(t1.b,'') AS b, t1.b as real_b from t1;
-
-explain
-SELECT straight_join sql_no_cache v1.a, v1.b, v1.real_b from t2, v1
-where t2.b=v1.a GROUP BY t2.b;
-SELECT straight_join sql_no_cache v1.a, v1.b, v1.real_b from t2, v1
-where t2.b=v1.a GROUP BY t2.b;
-
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
-#
-# Bug#22781: SQL_BIG_RESULT fails to influence sort plan
-#
-CREATE TABLE t1 (a INT PRIMARY KEY, b INT, key (b));
-
-INSERT INTO t1 VALUES (1, 1);
-INSERT INTO t1 SELECT a + 1 , MOD(a + 1 , 20) FROM t1;
-INSERT INTO t1 SELECT a + 2 , MOD(a + 2 , 20) FROM t1;
-INSERT INTO t1 SELECT a + 4 , MOD(a + 4 , 20) FROM t1;
-INSERT INTO t1 SELECT a + 8 , MOD(a + 8 , 20) FROM t1;
-INSERT INTO t1 SELECT a + 16, MOD(a + 16, 20) FROM t1;
-INSERT INTO t1 SELECT a + 32, MOD(a + 32, 20) FROM t1;
-INSERT INTO t1 SELECT a + 64, MOD(a + 64, 20) FROM t1;
-
-SELECT MIN(b), MAX(b) from t1;
-
-EXPLAIN SELECT b, sum(1) FROM t1 GROUP BY b;
-EXPLAIN SELECT SQL_BIG_RESULT b, sum(1) FROM t1 GROUP BY b;
-SELECT b, sum(1) FROM t1 GROUP BY b;
-SELECT SQL_BIG_RESULT b, sum(1) FROM t1 GROUP BY b;
-DROP TABLE t1;
-
-#
-# Bug #23417: Too strict checks against GROUP BY in the ONLY_FULL_GROUP_BY mode
-#
-CREATE TABLE t1 (a INT PRIMARY KEY, b INT);
-INSERT INTO t1 VALUES (1,1),(2,1),(3,2),(4,2),(5,3),(6,3);
-
-SET SQL_MODE = 'ONLY_FULL_GROUP_BY';
-SELECT MAX(a)-MIN(a) FROM t1 GROUP BY b;
-SELECT CEILING(MIN(a)) FROM t1 GROUP BY b;
-SELECT CASE WHEN AVG(a)>=0 THEN 'Positive' ELSE 'Negative' END FROM t1
- GROUP BY b;
-SELECT a + 1 FROM t1 GROUP BY a;
---error ER_WRONG_FIELD_WITH_GROUP
-SELECT a + b FROM t1 GROUP BY b;
-SELECT (SELECT t1_outer.a FROM t1 AS t1_inner GROUP BY b LIMIT 1)
- FROM t1 AS t1_outer;
-SELECT 1 FROM t1 as t1_outer GROUP BY a
- HAVING (SELECT t1_outer.a FROM t1 AS t1_inner GROUP BY b LIMIT 1);
---error ER_WRONG_FIELD_WITH_GROUP
-SELECT (SELECT t1_outer.a FROM t1 AS t1_inner LIMIT 1)
- FROM t1 AS t1_outer GROUP BY t1_outer.b;
---error ER_BAD_FIELD_ERROR
-SELECT 1 FROM t1 as t1_outer GROUP BY a
- HAVING (SELECT t1_outer.b FROM t1 AS t1_inner LIMIT 1);
-SELECT (SELECT SUM(t1_inner.a) FROM t1 AS t1_inner LIMIT 1)
- FROM t1 AS t1_outer GROUP BY t1_outer.b;
-SELECT (SELECT SUM(t1_inner.a) FROM t1 AS t1_inner GROUP BY t1_inner.b LIMIT 1)
- FROM t1 AS t1_outer;
---error ER_WRONG_FIELD_WITH_GROUP
-SELECT (SELECT SUM(t1_outer.a) FROM t1 AS t1_inner LIMIT 1)
- FROM t1 AS t1_outer GROUP BY t1_outer.b;
-
-SELECT 1 FROM t1 as t1_outer
- WHERE (SELECT t1_outer.b FROM t1 AS t1_inner GROUP BY t1_inner.b LIMIT 1);
-
-SELECT b FROM t1 GROUP BY b HAVING CEILING(b) > 0;
-
-SELECT 1 FROM t1 GROUP BY b HAVING b = 2 OR b = 3 OR SUM(a) > 12;
-SELECT 1 FROM t1 GROUP BY b HAVING ROW (b,b) = ROW (1,1);
-
---error ER_BAD_FIELD_ERROR
-SELECT 1 FROM t1 GROUP BY b HAVING a = 2;
---error ER_INVALID_GROUP_FUNC_USE
-SELECT 1 FROM t1 GROUP BY SUM(b);
---error ER_WRONG_FIELD_WITH_GROUP
-SELECT b FROM t1 AS t1_outer GROUP BY a HAVING t1_outer.a IN
- (SELECT SUM(t1_inner.b)+t1_outer.b FROM t1 AS t1_inner GROUP BY t1_inner.a
- HAVING SUM(t1_inner.b)+t1_outer.b > 5);
-DROP TABLE t1;
-SET SQL_MODE = '';
-#
-# Bug#27874: Non-grouped columns are allowed by * in ONLY_FULL_GROUP_BY mode.
-#
-SET SQL_MODE = 'ONLY_FULL_GROUP_BY';
-create table t1(f1 int, f2 int);
---error 1055
-select * from t1 group by f1;
---error 1055
-select * from t1 group by f2;
-select * from t1 group by f1, f2;
---error 1055
-select t1.f1,t.* from t1, t1 t group by 1;
-drop table t1;
-SET SQL_MODE = '';
-
-#
-# Bug #32202: ORDER BY not working with GROUP BY
-#
-
-CREATE TABLE t1(
- id INT AUTO_INCREMENT PRIMARY KEY,
- c1 INT NOT NULL,
- c2 INT NOT NULL,
- UNIQUE KEY (c2,c1));
-
-INSERT INTO t1(c1,c2) VALUES (5,1), (4,1), (3,5), (2,3), (1,3);
-
-# Show that the test cases from the bug report pass
-SELECT * FROM t1 ORDER BY c1;
-SELECT * FROM t1 GROUP BY id ORDER BY c1;
-
-# Show that DESC is handled correctly
-SELECT * FROM t1 GROUP BY id ORDER BY id DESC;
-
-# Show that results are correctly ordered when ORDER BY fields
-# are a subset of GROUP BY ones
-SELECT * FROM t1 GROUP BY c2 ,c1, id ORDER BY c2, c1;
-SELECT * FROM t1 GROUP BY c2, c1, id ORDER BY c2 DESC, c1;
-SELECT * FROM t1 GROUP BY c2, c1, id ORDER BY c2 DESC, c1 DESC;
-
-# Show that results are correctly ordered when GROUP BY fields
-# are a subset of ORDER BY ones
-SELECT * FROM t1 GROUP BY c2 ORDER BY c2, c1;
-SELECT * FROM t1 GROUP BY c2 ORDER BY c2 DESC, c1;
-SELECT * FROM t1 GROUP BY c2 ORDER BY c2 DESC, c1 DESC;
-
-DROP TABLE t1;
-
-
---echo #
---echo # Bug#27219: Aggregate functions in ORDER BY.
---echo #
-SET @save_sql_mode=@@sql_mode;
-SET @@sql_mode='ONLY_FULL_GROUP_BY';
-
-CREATE TABLE t1 (a INT, b INT, c INT DEFAULT 0);
-INSERT INTO t1 (a, b) VALUES (3,3), (2,2), (3,3), (2,2), (3,3), (4,4);
-CREATE TABLE t2 SELECT * FROM t1;
-
-SELECT 1 FROM t1 ORDER BY COUNT(*);
-SELECT 1 FROM t1 ORDER BY COUNT(*) + 1;
---error 1140
-SELECT 1 FROM t1 ORDER BY COUNT(*) + a;
-SELECT 1 FROM t1 ORDER BY COUNT(*), 1;
---error 1140
-SELECT 1 FROM t1 ORDER BY COUNT(*), a;
-
-SELECT 1 FROM t1 ORDER BY SUM(a);
-SELECT 1 FROM t1 ORDER BY SUM(a + 1);
-SELECT 1 FROM t1 ORDER BY SUM(a) + 1;
---error 1140
-SELECT 1 FROM t1 ORDER BY SUM(a), b;
-
---error 1140
-SELECT a FROM t1 ORDER BY COUNT(b);
-
-SELECT t1.a FROM t1 ORDER BY (SELECT SUM(t2.a) FROM t2);
-
---error 1140
-SELECT t1.a FROM t1 ORDER BY (SELECT SUM(t2.a), t2.a FROM t2);
---error 1140
-SELECT t1.a FROM t1 ORDER BY (SELECT SUM(t2.a) FROM t2 ORDER BY t2.a);
---error 1140
-SELECT t1.a FROM t1 ORDER BY (SELECT t2.a FROM t2 ORDER BY SUM(t2.b) LIMIT 1);
-
---error 1140
-SELECT t1.a FROM t1
- WHERE t1.a = (SELECT t2.a FROM t2 ORDER BY SUM(t2.b) LIMIT 1);
---error 1140
-SELECT t1.a FROM t1 GROUP BY t1.a
- HAVING t1.a = (SELECT t2.a FROM t2 ORDER BY SUM(t2.a) LIMIT 1);
-
-SELECT t1.a FROM t1 GROUP BY t1.a
- HAVING t1.a IN (SELECT t2.a FROM t2 ORDER BY SUM(t1.b));
---error 1140
-SELECT t1.a FROM t1 GROUP BY t1.a
- HAVING t1.a IN (SELECT t2.a FROM t2 ORDER BY t2.a, SUM(t2.b));
---error 1140
-SELECT t1.a FROM t1 GROUP BY t1.a
- HAVING t1.a > ANY (SELECT t2.a FROM t2 ORDER BY t2.a, SUM(t2.b));
-
---error 1140
-SELECT t1.a FROM t1
- WHERE t1.a = (SELECT t2.a FROM t2 ORDER BY SUM(t1.b));
-
-SELECT 1 FROM t1 GROUP BY t1.a
- HAVING (SELECT AVG(SUM(t1.b) + 1) FROM t2 ORDER BY SUM(t2.a) LIMIT 1);
-SELECT 1 FROM t1 GROUP BY t1.a
- HAVING (SELECT AVG(SUM(t1.b) + t2.b) FROM t2 ORDER BY SUM(t2.a) LIMIT 1);
-SELECT 1 FROM t1 GROUP BY t1.a
- HAVING (SELECT AVG(t1.b + t2.b) FROM t2 ORDER BY SUM(t2.a) LIMIT 1);
-
---error 1140
-SELECT 1 FROM t1 GROUP BY t1.a
- HAVING (SELECT AVG(SUM(t1.b) + 1) FROM t2 ORDER BY t2.a LIMIT 1);
---error 1140
-SELECT 1 FROM t1 GROUP BY t1.a
- HAVING (SELECT AVG(SUM(t1.b) + t2.b) FROM t2 ORDER BY t2.a LIMIT 1);
---error 1140
-SELECT 1 FROM t1 GROUP BY t1.a
- HAVING (SELECT AVG(t1.b + t2.b) FROM t2 ORDER BY t2.a LIMIT 1);
-
-# Both SUMs are aggregated in the subquery, no mixture:
-SELECT t1.a FROM t1
- WHERE t1.a = (SELECT t2.a FROM t2 GROUP BY t2.a
- ORDER BY SUM(t2.b), SUM(t1.b) LIMIT 1);
-
-# SUM(t1.b) is aggregated in the subquery, no mixture:
-SELECT t1.a, SUM(t1.b) FROM t1
- WHERE t1.a = (SELECT SUM(t2.b) FROM t2 GROUP BY t2.a
- ORDER BY SUM(t2.b), SUM(t1.b) LIMIT 1)
- GROUP BY t1.a;
-
-# 2nd SUM(t1.b) is aggregated in the subquery, no mixture:
-SELECT t1.a, SUM(t1.b) FROM t1
- WHERE t1.a = (SELECT SUM(t2.b) FROM t2
- ORDER BY SUM(t2.b) + SUM(t1.b) LIMIT 1)
- GROUP BY t1.a;
-
-# SUM(t2.b + t1.a) is aggregated in the subquery, no mixture:
-SELECT t1.a, SUM(t1.b) FROM t1
- WHERE t1.a = (SELECT SUM(t2.b) FROM t2
- ORDER BY SUM(t2.b + t1.a) LIMIT 1)
- GROUP BY t1.a;
-
-SELECT t1.a FROM t1 GROUP BY t1.a
- HAVING (1, 1) = (SELECT SUM(t1.a), t1.a FROM t2 LIMIT 1);
-
-select avg (
- (select
- (select sum(outr.a + innr.a) from t1 as innr limit 1) as tt
- from t1 as outr order by outr.a limit 1))
-from t1 as most_outer;
-
---error 1140
-select avg (
- (select (
- (select sum(outr.a + innr.a) from t1 as innr limit 1)) as tt
- from t1 as outr order by count(outr.a) limit 1)) as tt
-from t1 as most_outer;
-
-select (select sum(outr.a + t1.a) from t1 limit 1) as tt from t1 as outr order by outr.a;
-
-SET sql_mode=@save_sql_mode;
-DROP TABLE t1, t2;
-
---echo #
---echo # BUG#38072: Wrong result: HAVING not observed in a query with aggregate
---echo #
-CREATE TABLE t1 (
- pk int(11) NOT NULL AUTO_INCREMENT,
- int_nokey int(11) NOT NULL,
- int_key int(11) NOT NULL,
- varchar_key varchar(1) NOT NULL,
- varchar_nokey varchar(1) NOT NULL,
- PRIMARY KEY (pk),
- KEY int_key (int_key),
- KEY varchar_key (varchar_key)
-);
-INSERT INTO t1 VALUES
-(1,5,5, 'h','h'),
-(2,1,1, '{','{'),
-(3,1,1, 'z','z'),
-(4,8,8, 'x','x'),
-(5,7,7, 'o','o'),
-(6,3,3, 'p','p'),
-(7,9,9, 'c','c'),
-(8,0,0, 'k','k'),
-(9,6,6, 't','t'),
-(10,0,0,'c','c');
-
-explain SELECT COUNT(varchar_key) AS X FROM t1 WHERE pk = 8 having 'foo'='bar';
-SELECT COUNT(varchar_key) AS X FROM t1 WHERE pk = 8 having 'foo'='bar';
-drop table t1;
-
---echo End of 5.0 tests
-# Bug #21174: Index degrades sort performance and
-# optimizer does not honor IGNORE INDEX.
-# a.k.a WL3527.
-#
-CREATE TABLE t1 (a INT, b INT,
- PRIMARY KEY (a),
- KEY i2(a,b));
-INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8);
-INSERT INTO t1 SELECT a + 8,b FROM t1;
-INSERT INTO t1 SELECT a + 16,b FROM t1;
-INSERT INTO t1 SELECT a + 32,b FROM t1;
-INSERT INTO t1 SELECT a + 64,b FROM t1;
-INSERT INTO t1 SELECT a + 128,b FROM t1 limit 16;
-ANALYZE TABLE t1;
-EXPLAIN SELECT a FROM t1 WHERE a < 2;
-EXPLAIN SELECT a FROM t1 WHERE a < 2 ORDER BY a;
-EXPLAIN SELECT a FROM t1 WHERE a < 2 GROUP BY a;
-EXPLAIN SELECT a FROM t1 IGNORE INDEX (PRIMARY,i2);
-EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR JOIN (PRIMARY,i2);
-
---echo #
---echo # For this explain, the query plan is weird: if we are using
---echo # the primary key for reasons other than doing grouping, can't
---echo # GROUP BY code take advantage of this? Well, currently it doesnt:
-EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (PRIMARY,i2) GROUP BY a;
---echo # Here's a proof it is really doing sorting:
-flush status;
---disable_result_log
-SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (PRIMARY,i2) GROUP BY a;
---enable_result_log
-show status like 'Sort_%';
---echo # Proof ends.
---echo #
-
---echo # For this explain, the query plan is weird: if we are using
---echo # the primary key for reasons other than doing sorting, can't
---echo # ORDER BY code take advantage of this? Well, currently it doesnt:
-EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY,i2) ORDER BY a;
---echo # Here's a proof it is really doing sorting:
-flush status;
---disable_result_log
-SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY,i2) ORDER BY a;
---enable_result_log
-show status like 'Sort_%';
---echo # Proof ends.
---echo #
-SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY,i2) ORDER BY a;
-EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY)
- IGNORE INDEX FOR GROUP BY (i2) GROUP BY a;
-EXPLAIN SELECT a FROM t1 IGNORE INDEX (PRIMARY) IGNORE INDEX FOR ORDER BY (i2);
-EXPLAIN SELECT a FROM t1 FORCE INDEX (i2);
-EXPLAIN SELECT a FROM t1 USE INDEX ();
-EXPLAIN SELECT a FROM t1 USE INDEX () USE INDEX (i2);
---error ER_WRONG_USAGE
-EXPLAIN SELECT a FROM t1
- FORCE INDEX (PRIMARY)
- IGNORE INDEX FOR GROUP BY (i2)
- IGNORE INDEX FOR ORDER BY (i2)
- USE INDEX (i2);
-EXPLAIN SELECT a FROM t1 USE INDEX (i2) USE INDEX ();
---error ER_PARSE_ERROR
-EXPLAIN SELECT a FROM t1 FORCE INDEX ();
---error ER_PARSE_ERROR
-EXPLAIN SELECT a FROM t1 IGNORE INDEX ();
-# disable the columns irrelevant to this test here. On some systems
-# without support for large files the rowid is shorter and its size affects
-# the cost calculations. This causes the optimizer to choose loose index
-# scan over normal index access.
---replace_column 4 # 7 # 9 # 10 #
-EXPLAIN SELECT a FROM t1 USE INDEX FOR JOIN (i2)
- USE INDEX FOR GROUP BY (i2) GROUP BY a;
-EXPLAIN SELECT a FROM t1 FORCE INDEX FOR JOIN (i2)
- FORCE INDEX FOR GROUP BY (i2) GROUP BY a;
-EXPLAIN SELECT a FROM t1 USE INDEX () IGNORE INDEX (i2);
-EXPLAIN SELECT a FROM t1 IGNORE INDEX (i2) USE INDEX ();
-
-EXPLAIN SELECT a FROM t1
- USE INDEX FOR GROUP BY (i2)
- USE INDEX FOR ORDER BY (i2)
- USE INDEX FOR JOIN (i2);
-
-EXPLAIN SELECT a FROM t1
- USE INDEX FOR JOIN (i2)
- USE INDEX FOR JOIN (i2)
- USE INDEX FOR JOIN (i2,i2);
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='semijoin_with_cache=off';
-EXPLAIN SELECT 1 FROM t1 WHERE a IN
- (SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2));
-SET optimizer_switch=@save_optimizer_switch;
-
-CREATE TABLE t2 (a INT, b INT, KEY(a));
-INSERT INTO t2 VALUES (1, 1), (2, 2), (3,3), (4,4);
-EXPLAIN SELECT a, SUM(b) FROM t2 GROUP BY a LIMIT 2;
-EXPLAIN SELECT a, SUM(b) FROM t2 IGNORE INDEX (a) GROUP BY a LIMIT 2;
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='semijoin_with_cache=off';
-EXPLAIN SELECT 1 FROM t2 WHERE a IN
- (SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2));
-SET optimizer_switch=@save_optimizer_switch;
-
-DROP TABLE t1, t2;
-
-#
-# Bug#30596: GROUP BY optimization gives wrong result order
-#
-CREATE TABLE t1(
- a INT,
- b INT NOT NULL,
- c INT NOT NULL,
- d INT,
- UNIQUE KEY (c,b)
-);
-
-INSERT INTO t1 VALUES (1,1,1,50), (1,2,3,40), (2,1,3,4);
-
-CREATE TABLE t2(
- a INT,
- b INT,
- UNIQUE KEY(a,b)
-);
-
-INSERT INTO t2 VALUES (NULL, NULL), (NULL, NULL), (NULL, 1), (1, NULL), (1, 1), (1,2);
-
-EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b,d;
-SELECT c,b,d FROM t1 GROUP BY c,b,d;
-EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b,d ORDER BY NULL;
-SELECT c,b,d FROM t1 GROUP BY c,b,d ORDER BY NULL;
-EXPLAIN SELECT c,b,d FROM t1 ORDER BY c,b,d;
-SELECT c,b,d FROM t1 ORDER BY c,b,d;
-
-EXPLAIN SELECT c,b,d FROM t1 GROUP BY c,b;
-SELECT c,b,d FROM t1 GROUP BY c,b;
-EXPLAIN SELECT c,b FROM t1 GROUP BY c,b;
-SELECT c,b FROM t1 GROUP BY c,b;
-
-EXPLAIN SELECT a,b from t2 ORDER BY a,b;
-SELECT a,b from t2 ORDER BY a,b;
-EXPLAIN SELECT a,b from t2 GROUP BY a,b;
-SELECT a,b from t2 GROUP BY a,b;
-EXPLAIN SELECT a from t2 GROUP BY a;
-SELECT a from t2 GROUP BY a;
-EXPLAIN SELECT b from t2 GROUP BY b;
-SELECT b from t2 GROUP BY b;
-
-DROP TABLE t1;
-DROP TABLE t2;
-
-#
-# Bug #31797: error while parsing subqueries -- WHERE is parsed as HAVING
-#
-CREATE TABLE t1 ( a INT, b INT );
-
-SELECT b c, (SELECT a FROM t1 WHERE b = c)
-FROM t1;
-
-SELECT b c, (SELECT a FROM t1 WHERE b = c)
-FROM t1
-HAVING b = 10;
-
---error ER_ILLEGAL_REFERENCE
-SELECT MAX(b) c, (SELECT a FROM t1 WHERE b = c)
-FROM t1
-HAVING b = 10;
-
-SET @old_sql_mode = @@sql_mode;
-SET @@sql_mode='ONLY_FULL_GROUP_BY';
-
-SELECT b c, (SELECT a FROM t1 WHERE b = c)
-FROM t1;
-
---error ER_NON_GROUPING_FIELD_USED
-SELECT b c, (SELECT a FROM t1 WHERE b = c)
-FROM t1
-HAVING b = 10;
-
---error ER_ILLEGAL_REFERENCE
-SELECT MAX(b) c, (SELECT a FROM t1 WHERE b = c)
-FROM t1
-HAVING b = 10;
-
-INSERT INTO t1 VALUES (1, 1);
-SELECT b c, (SELECT a FROM t1 WHERE b = c)
-FROM t1;
-
-INSERT INTO t1 VALUES (2, 1);
---error ER_SUBQUERY_NO_1_ROW
-SELECT b c, (SELECT a FROM t1 WHERE b = c)
-FROM t1;
-
-DROP TABLE t1;
-SET @@sql_mode = @old_sql_mode;
-
-
-#
-# Bug#42567 Invalid GROUP BY error
-#
-
-# Setup of the subtest
-SET @old_sql_mode = @@sql_mode;
-SET @@sql_mode='ONLY_FULL_GROUP_BY';
-
-CREATE TABLE t1(i INT);
-INSERT INTO t1 VALUES (1), (10);
-
-# The actual test
-SELECT COUNT(i) FROM t1;
-SELECT COUNT(i) FROM t1 WHERE i > 1;
-
-# Cleanup of subtest
-DROP TABLE t1;
-SET @@sql_mode = @old_sql_mode;
-
---echo #
---echo # Bug #45640: optimizer bug produces wrong results
---echo #
-
-CREATE TABLE t1 (a INT, b INT);
-INSERT INTO t1 VALUES (4, 40), (1, 10), (2, 20), (2, 20), (3, 30);
-
---echo # should return 4 ordered records:
-SELECT (SELECT t1.a) aa, COUNT(DISTINCT b) FROM t1 GROUP BY aa;
-
-SELECT (SELECT (SELECT t1.a)) aa, COUNT(DISTINCT b) FROM t1 GROUP BY aa;
-
-SELECT (SELECT t1.a) aa, COUNT(DISTINCT b) FROM t1 GROUP BY aa+0;
-
---echo # should return the same result in a reverse order:
-SELECT (SELECT t1.a) aa, COUNT(DISTINCT b) FROM t1 GROUP BY -aa;
-
---echo # execution plan should not use temporary table:
-EXPLAIN EXTENDED
-SELECT (SELECT t1.a) aa, COUNT(DISTINCT b) FROM t1 GROUP BY aa+0;
-
-EXPLAIN EXTENDED
-SELECT (SELECT t1.a) aa, COUNT(DISTINCT b) FROM t1 GROUP BY -aa;
-
---echo # should return only one record
-SELECT (SELECT tt.a FROM t1 tt LIMIT 1) aa, COUNT(DISTINCT b) FROM t1
- GROUP BY aa;
-
-CREATE TABLE t2 SELECT DISTINCT a FROM t1;
-
---echo # originally reported queries (1st two columns of next two query
---echo # results should be same):
-
-SELECT (SELECT t2.a FROM t2 WHERE t2.a = t1.a) aa, b, COUNT(DISTINCT b)
- FROM t1 GROUP BY aa, b;
-SELECT (SELECT t2.a FROM t2 WHERE t2.a = t1.a) aa, b, COUNT( b)
- FROM t1 GROUP BY aa, b;
-
---echo # ORDER BY for sure:
-
-SELECT (SELECT t2.a FROM t2 WHERE t2.a = t1.a) aa, b, COUNT(DISTINCT b)
- FROM t1 GROUP BY aa, b ORDER BY -aa, -b;
-SELECT (SELECT t2.a FROM t2 WHERE t2.a = t1.a) aa, b, COUNT( b)
- FROM t1 GROUP BY aa, b ORDER BY -aa, -b;
-
-DROP TABLE t1, t2;
-
-
---echo #
---echo # Bug#52051: Aggregate functions incorrectly returns NULL from outer
---echo # join query
---echo #
-CREATE TABLE t1 (a INT PRIMARY KEY);
-CREATE TABLE t2 (a INT PRIMARY KEY);
-INSERT INTO t2 VALUES (1), (2);
-EXPLAIN SELECT MIN(t2.a) FROM t2 LEFT JOIN t1 ON t2.a = t1.a;
-SELECT MIN(t2.a) FROM t2 LEFT JOIN t1 ON t2.a = t1.a;
-EXPLAIN SELECT MAX(t2.a) FROM t2 LEFT JOIN t1 ON t2.a = t1.a;
-SELECT MAX(t2.a) FROM t2 LEFT JOIN t1 ON t2.a = t1.a;
-DROP TABLE t1, t2;
-
-#
-# min() returns wrong value when used in expression when there is no matching
-# rows
-#
-
-CREATE TABLE t1 (a int(11) NOT NULL);
-INSERT INTO t1 VALUES (1),(2);
-CREATE TABLE t2 (
- key_col int(11) NOT NULL,
- KEY (key_col)
-);
-INSERT INTO t2 VALUES (1),(2);
-
-select min(t2.key_col) from t1,t2 where t1.a=1;
-select min(t2.key_col) from t1,t2 where t1.a > 1000;
-select min(t2.key_col)+1 from t1,t2 where t1.a> 1000;
-drop table t1,t2;
-
---echo #
---echo # Bug#55188: GROUP BY, GROUP_CONCAT and TEXT - inconsistent results
---echo #
-
-CREATE TABLE t1 (a text, b varchar(10));
-INSERT INTO t1 VALUES (repeat('1', 1300),'one'), (repeat('1', 1300),'two');
-
-query_vertical EXPLAIN
-SELECT SUBSTRING(a,1,10), LENGTH(a), GROUP_CONCAT(b) FROM t1 GROUP BY a;
-SELECT SUBSTRING(a,1,10), LENGTH(a), GROUP_CONCAT(b) FROM t1 GROUP BY a;
-query_vertical EXPLAIN
-SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a;
-SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a;
-DROP TABLE t1;
-
---echo #
---echo # Bug#57688 Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field
---echo #
-
-CREATE TABLE t1(f1 INT NOT NULL);
-INSERT INTO t1 VALUES (16777214),(0);
-
-SELECT COUNT(*) FROM t1 LEFT JOIN t1 t2
-ON 1 WHERE t2.f1 > 1 GROUP BY t2.f1;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug#59839: Aggregation followed by subquery yields wrong result
---echo #
-
-CREATE TABLE t1 (
- a INT,
- b INT,
- c INT,
- KEY (a, b)
-);
-
-INSERT INTO t1 VALUES
- ( 1, 1, 1 ),
- ( 1, 2, 2 ),
- ( 1, 3, 3 ),
- ( 1, 4, 6 ),
- ( 1, 5, 5 ),
- ( 1, 9, 13 ),
-
- ( 2, 1, 6 ),
- ( 2, 2, 7 ),
- ( 2, 3, 8 );
-
-EXPLAIN
-SELECT a, AVG(t1.b),
-(SELECT t11.c FROM t1 t11 WHERE t11.a = t1.a AND t11.b = AVG(t1.b)) AS t11c,
-(SELECT t12.c FROM t1 t12 WHERE t12.a = t1.a AND t12.b = AVG(t1.b)) AS t12c
-FROM t1 GROUP BY a;
-
-SELECT a, AVG(t1.b),
-(SELECT t11.c FROM t1 t11 WHERE t11.a = t1.a AND t11.b = AVG(t1.b)) AS t11c,
-(SELECT t12.c FROM t1 t12 WHERE t12.a = t1.a AND t12.b = AVG(t1.b)) AS t12c
-FROM t1 GROUP BY a;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug#11765254 (58200): Assertion failed: param.sort_length when grouping
---echo # by functions
---echo #
-
-SET BIG_TABLES=1;
-CREATE TABLE t1(a INT);
-INSERT INTO t1 VALUES (0),(0);
-SELECT 1 FROM t1 GROUP BY IF(`a`,'','');
-SELECT 1 FROM t1 GROUP BY TRIM(LEADING RAND() FROM '');
-SELECT 1 FROM t1 GROUP BY SUBSTRING('',SLEEP(0),'');
-SELECT 1 FROM t1 GROUP BY SUBSTRING(SYSDATE() FROM 'K' FOR 'jxW<');
-DROP TABLE t1;
-SET BIG_TABLES=0;
-
---echo #
---echo # MDEV-641 LP:1002108 - Wrong result (or crash) from a query with duplicated field in the group list and a limit clause
---echo # Bug#11761078: 53534: INCORRECT 'SELECT SQL_BIG_RESULT...'
---echo # WITH GROUP BY ON DUPLICATED FIELDS
---echo #
-
-CREATE TABLE t1(
- col1 int,
- UNIQUE INDEX idx (col1));
-
-INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),
- (11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
-
-let $query0=SELECT col1 AS field1, col1 AS field2
- FROM t1 GROUP BY field1, field2;
-
-# Needs to be range to exercise bug
---eval EXPLAIN $query0;
-FLUSH STATUS;
---eval $query0;
-SHOW SESSION STATUS LIKE 'Sort_scan%';
-
-let $query=SELECT SQL_BIG_RESULT col1 AS field1, col1 AS field2
- FROM t1 GROUP BY field1, field2;
-
-# Needs to be range to exercise bug
---eval EXPLAIN $query
-FLUSH STATUS;
---eval $query
-SHOW SESSION STATUS LIKE 'Sort_scan%';
-
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-SELECT SQL_BIG_RESULT col1 AS field1, col1 AS field2
-FROM v1
-GROUP BY field1, field2;
-
-SELECT SQL_BIG_RESULT tbl1.col1 AS field1, tbl2.col1 AS field2
-FROM t1 as tbl1, t1 as tbl2
-GROUP BY field1, field2
-LIMIT 3;
-
-explain
-select col1 f1, col1 f2 from t1 order by f2, f1;
-explain
-select col1 f1, col1 f2 from t1 order by f2, f1+0;
-select col1 f1, col1 f2 from t1 order by f2, f1+0;
-
-explain
-select col1 f1, col1 f2 from t1 group by f1;
-select col1 f1, col1 f2 from t1 group by f1;
-
-explain
-select col1 f1, col1 f2 from t1 group by f1, f2;
-select col1 f1, col1 f2 from t1 group by f1, f2;
-
-explain
-select col1 f1, col1 f2 from t1 group by f2 order by f2, f1;
-select col1 f1, col1 f2 from t1 group by f2 order by f2, f1;
-
-explain
-select col1 f1, col1 f2 from t1 group by f1, f2 order by f2, f1;
-select col1 f1, col1 f2 from t1 group by f1, f2 order by f2, f1;
-
-
-CREATE TABLE t2(
- col1 int,
- col2 int,
- UNIQUE INDEX idx (col1, col2));
-
-INSERT INTO t2(col1, col2) VALUES
- (1,20),(2,19),(3,18),(4,17),(5,16),(6,15),(7,14),(8,13),(9,12),(10,11),
- (11,10),(12,9),(13,8),(14,7),(15,6),(16,5),(17,4),(18,3),(19,2),(20,1);
-
-explain
-select col1 f1, col2 f2, col1 f3 from t2 group by f1;
-explain
-select SQL_BIG_RESULT col1 f1, col2 f2, col1 f3 from t2 group by f1;
-explain
-select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2;
-explain
-select col1 f1, col1 f2 from t2 group by f1, 1+1;
-
-explain
-select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2, f3+0;
-select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2, f3+0;
-
-explain
-select col1 f1, col2 f2, col1 f3 from t2 order by f1,f2;
-explain
-select col1 f1, col2 f2, col1 f3 from t2 order by f1, f2, f3+0;
-select col1 f1, col2 f2, col1 f3 from t2 order by f1, f2, f3+0;
-
-DROP VIEW v1;
-DROP TABLE t1, t2;
-
---echo # End of 5.1 tests
-
---echo #
---echo # LP bug#694450 Wrong result with non-standard GROUP BY + ORDER BY
---echo #
-SET SESSION SQL_MODE='ONLY_FULL_GROUP_BY';
-CREATE TABLE t1 (
-f1 int(11), f2 int(11), f3 datetime, f4 varchar(1), PRIMARY KEY (f1)) ;
-INSERT IGNORE INTO t1 VALUES ('1','9','2004-10-11 18:13','x'),('2','5','2004-03-07 14:02','g'),('3','1','2004-04-09 09:38','o'),('4','0','1900-01-01 00:00','g'),('5','1','2009-02-19 02:05','v');
-
-# This must return an error, but instead returns 1 row
-SELECT alias2.f3 AS field1 , alias2.f1 AS field2 FROM t1 AS alias1 JOIN t1 AS alias2 ON alias2.f1 = alias1.f2 AND alias2.f1 != alias1.f4 GROUP BY field1 , field2 ORDER BY alias1.f2 , field2;
-
-# This returns several rows
-SELECT alias2.f3 AS field1 , alias2.f1 AS field2 FROM t1 AS alias1 JOIN t1 AS alias2 ON alias2.f1 = alias1.f2 AND alias2.f1 != alias1.f4 GROUP BY field1 , field2 ;
-SET SESSION SQL_MODE=default;
-drop table t1;
-
---echo #
---echo # LP bug#967242 Wrong result (extra rows, not grouped) with JOIN, AND in ON condition, multi-part key, GROUP BY, OR in WHERE
---echo #
-
-CREATE TABLE t1 ( a VARCHAR(1) ) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('x');
-CREATE TABLE t2 ( b INT, c VARCHAR(1), KEY (c, b) ) ENGINE=MyISAM;
-INSERT INTO t2 VALUES
-(4, 'd'),(8, 'g'),(3, 'x'),(3, 'f'),
-(0, 'p'),(3, 'j'),(8, 'c');
-
-SELECT t2_1.b as zzz
-FROM t1 JOIN t2 AS t2_1 JOIN t2 AS t2_2
-ON (t2_2.b = t2_1.b ) AND (t2_2.c = t2_1.c )
-WHERE
-rand() + 1 > 0 OR
-a = t2_1.c
-GROUP BY zzz;
-
-SELECT t2_1.b as zzz
-FROM t1 JOIN t2 AS t2_1 JOIN t2 AS t2_2
-ON (t2_2.b = t2_1.b ) AND (t2_2.c = t2_1.c )
-WHERE
-1 > 0 OR
-a = t2_1.c
-GROUP BY zzz;
-
-SELECT t2_1.b as zzz
-FROM t1 JOIN t2 AS t2_1 JOIN t2 AS t2_2
-ON (t2_2.b = t2_1.b ) AND (t2_2.c = t2_1.c )
-WHERE
-t2_1.b + 1 > 0 OR
-a = t2_1.c
-GROUP BY zzz;
-
-SET @save_optimizer_switch967242=@@optimizer_switch;
-SET optimizer_switch = 'in_to_exists=on';
-
-SELECT t2_1.b
-FROM t1 JOIN t2 AS t2_1 JOIN t2 AS t2_2
- ON (t2_2.b = t2_1.b ) AND (t2_2.c = t2_1.c )
-WHERE
- ( SELECT COUNT(*) FROM t2 ) IS NOT NULL
- OR a = t2_1.c
-GROUP BY t2_1.b;
-SET optimizer_switch=@save_optimizer_switch967242;
-
-drop table t1, t2;
-
---echo #
---echo # Bug#12578908: SELECT SQL_BUFFER_RESULT OUTPUTS TOO MANY
---echo # ROWS WHEN GROUP IS OPTIMIZED AWAY
---echo #
-
-CREATE TABLE t1 (col1 int, col2 int) ;
-INSERT INTO t1 VALUES (10,1),(11,7);
-
-CREATE TABLE t2 (col1 int, col2 int) ;
-INSERT INTO t2 VALUES (10,8);
-
-let $q_body=t2.col2 FROM t2 JOIN t1 ON t1.col1 GROUP BY t2.col2;
-
---echo
---eval EXPLAIN SELECT SQL_BUFFER_RESULT $q_body
---eval SELECT SQL_BUFFER_RESULT $q_body
---echo
---eval EXPLAIN SELECT $q_body
---eval SELECT $q_body
-
---echo
-DROP TABLE t1,t2;
-
---echo #
---echo # BUG#12640437: USING SQL_BUFFER_RESULT RESULTS IN A
---echo # DIFFERENT QUERY OUTPUT
---echo #
-
-CREATE TABLE t1 (
- a int,
- b varchar(1),
- KEY (b,a)
-);
-INSERT INTO t1 VALUES (1,NULL),(0,'a'),(1,NULL),(0,'a');
-
-let $query=
- SELECT SQL_BUFFER_RESULT MIN(a), b FROM t1 WHERE t1.b = 'a' GROUP BY b;
-
---echo
---eval EXPLAIN $query
---echo
---eval $query
-
-let $query= SELECT MIN(a), b FROM t1 WHERE t1.b = 'a' GROUP BY b;
---echo
---eval EXPLAIN $query
---echo
---eval $query
-
---echo
-DROP TABLE t1;
-
-
-#
-# Bug#19880368 : GROUP_CONCAT CRASHES AFTER DUMP_LEAF_KEY
-#
-create table t1 (a int, b int);
-insert into t1 values (1,11), (1,12), (2,22),(2,23), (4,44),(4,45);
-create table t2 (c int, d int);
-insert into t2 values (1,11), (2,22), (4,44);
-select distinct a,sum(b), (select d from t2 where c=a order by max(b) limit 1) from t1 group by a order by max(b);
-drop table t1, t2;
-
---echo #
---echo # LP bug#993726 Wrong result from a query with ALL subquery predicate in WHERE
---echo #
-CREATE TABLE t1(a INT);
-INSERT INTO t1 VALUES (0);
-SELECT 1 FROM t1 WHERE 1 > ALL(SELECT 1 FROM t1 WHERE a!=0);
-SELECT max(1) FROM t1 WHERE a!=0;
-drop table t1;
-
---echo # End of 5.2 tests
-
---echo #
---echo # lp:872702: Crash in add_ref_to_table_cond() when grouping by a PK
---echo #
-CREATE TABLE t1 (a int, PRIMARY KEY (a)) ;
-INSERT INTO t1 VALUES (14),(15),(16),(17),(18),(19),(20);
-
-CREATE TABLE t2 (a int) ;
-
-SELECT a
-FROM t1
-WHERE a = (
- SELECT t2.a
- FROM t2
-) OR t1.a = 73
-GROUP BY 1;
-DROP TABLE t1, t2;
-
-#
-# MDEV-736 LP:1004615 - Unexpected warnings "Encountered illegal value '' when converting to DECIMAL" on a query with aggregate functions and GROUP BY
-#
-
-FLUSH STATUS; # this test case *must* use Aria temp tables
-
-CREATE TABLE t1 (f1 INT, f2 decimal(20,1), f3 blob);
-INSERT INTO t1 values(11,NULL,'blob'),(11,NULL,'blob');
-SELECT f3, MIN(f2) FROM t1 GROUP BY f1 LIMIT 1;
-DROP TABLE t1;
-
---echo the value below *must* be 1
-show status like 'Created_tmp_disk_tables';
-
---echo #
---echo # Bug #1002146: Unneeded filesort if usage of join buffer is not allowed
---echo # (bug mdev-645)
---echo #
-
-CREATE TABLE t1 (pk int PRIMARY KEY, a int, INDEX idx(a));
-INSERT INTO t1 VALUES (3,2), (2,3), (5,3), (6,4);
-
-CREATE TABLE t2 (pk int PRIMARY KEY, a int, INDEX idx(a));
-INSERT INTO t2 VALUES (9,0), (10,3), (6,4), (1,6), (3,100), (5,200);
-
-set join_cache_level=0;
-
-EXPLAIN
-SELECT t2.a FROM t2 STRAIGHT_JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6
- GROUP BY t2.a;
-SELECT t2.a FROM t2 STRAIGHT_JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6
- GROUP BY t2.a;
-
-set join_cache_level=default;
-
-set @save_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='outer_join_with_cache=off';
-
-EXPLAIN
-SELECT t2.a FROM t2 LEFT JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6
- GROUP BY t2.a;
-SELECT t2.a FROM t2 LEFT JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6
- GROUP BY t2.a;
-
-set optimizer_switch=@save_optimizer_switch;
-
-
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-5104 crash in Item_field::used_tables with broken order by
---echo #
-
---error ER_BAD_FIELD_ERROR
-(select 1 order by x(y)) order by 1;
-
---echo # End of 5.3 tests
-
---echo #
---echo # Bug#49771: Incorrect MIN (date) when minimum value is 0000-00-00
---echo #
-CREATE TABLE t1 (f1 int, f2 DATE);
-
-INSERT INTO t1 VALUES (1,'2004-04-19'), (1,'0000-00-00'), (1,'2004-04-18'),
-(2,'2004-05-19'), (2,'0001-01-01'), (3,'2004-04-10');
-
-SELECT MIN(f2),MAX(f2) FROM t1;
-SELECT f1,MIN(f2),MAX(f2) FROM t1 GROUP BY 1;
-
-DROP TABLE t1;
-
-CREATE TABLE t1 ( f1 int, f2 time);
-INSERT INTO t1 VALUES (1,'01:27:35'), (1,'06:11:01'), (2,'19:53:05'),
-(2,'21:44:25'), (3,'10:55:12'), (3,'05:45:11'), (4,'00:25:00');
-
-SELECT MIN(f2),MAX(f2) FROM t1;
-SELECT f1,MIN(f2),MAX(f2) FROM t1 GROUP BY 1;
-
-DROP TABLE t1;
---echo #End of test#49771
-
---echo #
---echo # Test of bug in GROUP_CONCAT with ROLLUP
---echo #
-
-CREATE TABLE t1 ( b VARCHAR(8) NOT NULL, a INT NOT NULL ) ENGINE=MyISAM;
-INSERT INTO t1 (a,b) VALUES (1,'c'),(2,'v');
-
-CREATE TABLE t2 ( c VARCHAR(8), d INT, KEY (c, d) ) ENGINE=MyISAM;
-INSERT INTO t2 VALUES ('v',6),('c',4),('v',3);
-
-SELECT b, GROUP_CONCAT( a, b ORDER BY a, b )
-FROM t1 JOIN t2 ON c = b GROUP BY b;
-
-SELECT b, GROUP_CONCAT( a, b ORDER BY a, b )
-FROM t1 JOIN t2 ON c = b GROUP BY b WITH ROLLUP;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-6129: Server crashes during UNION with ORDER BY field IS NULL
---echo #
-
-SET sql_mode='ONLY_FULL_GROUP_BY';
-SELECT 1 AS test UNION SELECT 2 AS test ORDER BY test IS NULL ASC;
-SET sql_mode='';
-
---echo #
---echo # MDEV-6484: Assertion `tab->ref.use_count' failed on query with joins, constant table, multi-part key
---echo #
-CREATE TABLE t1 (i1 INT, c1 VARCHAR(1)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (6,'b');
-
-CREATE TABLE t2 (pk2 INT, i2 INT, c2 VARCHAR(1), PRIMARY KEY(pk2), KEY(pk2,i2)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (1,2,'s'),(2,4,'r'),(3,8,'m'),(4,4,'b'),(5,4,'x'),(6,7,'g'),(7,4,'p');
-
-SELECT i2 FROM t1 AS t1a STRAIGHT_JOIN ( t2 INNER JOIN t1 AS t1b ON (t1b.c1 = c2) ) ON (t1b.i1 = pk2 )
-WHERE t1a.c1 = c2 GROUP BY i2;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-6855
---echo # MIN(*) with subqueries with IS NOT NULL in WHERE clause crashed.
---echo #
-
-CREATE TABLE t1 (i INT, c VARCHAR(3), KEY(c,i)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (7,'foo'),(0,'bar');
-
-CREATE TABLE t2 (j INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (0),(8),(1),(8),(9);
-
-SELECT MAX(i), c FROM t1
-WHERE c != 'qux' AND ( SELECT SUM(j) FROM t1, t2 ) IS NOT NULL GROUP BY c;
-drop table t1,t2;
-
---echo #
---echo # ONLY_FULL_GROUP_BY references
---echo #
-
-set @save_sql_mode = @@sql_mode;
-set sql_mode='ONLY_FULL_GROUP_BY';
-create table t1 (a int, b int);
-select a+b as x from t1 group by x having x > 1;
-select a as x from t1 group by x having x > 1;
-select a from t1 group by a having a > 1;
-drop table t1;
-set sql_mode= @save_sql_mode;
-
-#
-# MDEV-7826 Server crashes in Item_subselect::enumerate_field_refs_processor
-#
-create table t1 (f1 int);
-insert into t1 values (5),(9);
-create table t2 (f2 int);
-insert into t2 values (0),(6);
-create table t3 (f3 int);
-insert into t3 values (6),(3);
-create table t4 (f4 int);
-insert into t4 values (1),(0);
---error ER_ILLEGAL_REFERENCE
-select
-(select min(f1) from t1 where f1 in (select min(f4) from t2)) as field7,
-(select count(*) from t3 where f3 in (select max(f4) from t2 group by field7))
-from t4;
-drop table t1, t2, t3, t4;
-
-#
-# MDEV-13180 Unused left join causes server crash
-#
-create table t1 (i1 int);
-insert into t1 values (1);
-create table t2 (i int);
-insert into t2 values (2);
-select 1 from t1 left join t2 b on b.i = (select max(b.i) from t2);
-drop table t1, t2;
-
-
-#
-# MDEV-12489 The select stmt may fail due to "having clause is ambiguous" unexpected
-#
-create table t1 (c1 int, c2 int);
-create table t2 (c1 int, c2 int);
-select t1.c1 as c1, t2.c2 as c1 from t1, t2 where t1.c1 < 20 and t2.c2 > 5 group by t1.c1, t2.c2 having t1.c1 < 3;
-drop table t1, t2;
-
-#
-# MDEV-12350: Heap corruption, overrun buffer, ASAN errors, server crash in my_fill_8bit / filesort
-#
-
-SET @old_sort_buff_size = @@sort_buffer_size;
-SET @@sort_buffer_size=256*1024;
-CREATE TABLE t1 (c INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES
- (2011),(1977),(1982),(2027),(2023),(NULL),(NULL),(2004),(1974),(2032),
- (1993),(NULL),(1995),(2034),(NULL),(2009),(1900),(NULL),(2025),(1900),
- (2033),(1900),(2012),(NULL),(2009),(1992),(1974),(1974),(2012),(2028),
- (2007),(2012),(1900),(1983),(1900),(2010),(1987),(1994),(1981),(2032),
- (2010),(1989),(2014),(1900),(1900),(1976),(1978),(2007),(2030),(NULL),
- (2002),(1997),(1900),(NULL),(2000),(2027),(1975),(2026),(1975),(2026),
- (2029),(1977),(1900),(1900),(2031),(1993),(1986),(2012),(1979),(2013),
- (1994),(2014),(2025),(2006),(1971),(1974),(2021),(2011),(NULL),(1991),
- (2001),(1977),(2023),(2012),(1900),(1978),(1998),(NULL),(1988),(1999),
- (2017),(2008),(1976),(1900),(2005),(2030),(2023),(1900),(1978),(1990),
- (1978),(1987),(2030),(1900),(2034),(2006),(2015),(2001),(2019),(2024),
- (2030),(1989),(1997),(2007),(2023),(1994),(1971),(2011),(2011),(2015),
- (1984),(1978),(1979),(1989),(2008),(2030);
-
-SELECT ExtractValue('<a></a>','/a') AS f1, SPACE(c) AS f2 FROM t1 GROUP BY f1, f2 WITH ROLLUP;
-SET @@sort_buffer_size = @old_sort_buff_size;
-DROP TABLE t1;
-
-#
-# End of MariaDB 5.5 tests
-#
-
---echo #
---echo # Bug #58782
---echo # Missing rows with SELECT .. WHERE .. IN subquery
---echo # with full GROUP BY and no aggr
---echo #
-
-CREATE TABLE t1 (
- pk INT NOT NULL,
- col_int_nokey INT,
- PRIMARY KEY (pk)
-);
-
-INSERT INTO t1 VALUES (10,7);
-INSERT INTO t1 VALUES (11,1);
-INSERT INTO t1 VALUES (12,5);
-INSERT INTO t1 VALUES (13,3);
-
-## original query:
-
-SELECT pk AS field1, col_int_nokey AS field2
-FROM t1
-WHERE col_int_nokey > 0
-GROUP BY field1, field2;
-
-## store query results in a new table:
-
-CREATE TABLE where_subselect
- SELECT pk AS field1, col_int_nokey AS field2
- FROM t1
- WHERE col_int_nokey > 0
- GROUP BY field1, field2
-;
-
-## query the new table and compare to original using WHERE ... IN():
-
-SELECT *
-FROM where_subselect
-WHERE (field1, field2) IN (
- SELECT pk AS field1, col_int_nokey AS field2
- FROM t1
- WHERE col_int_nokey > 0
- GROUP BY field1, field2
-);
-
-DROP TABLE t1;
-DROP TABLE where_subselect;
-
---echo # End of Bug #58782
-
---echo #
---echo # MDEV-8988: Apparently valid SQL query gives wrong result (nested WHERE)
---echo #
-create table t0(a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1 (a int, b int, c int);
-insert into t1 select A.a + 10*B.a, A.a, A.a + 10*B.a from t0 A, t0 B;
-insert into t1 values (NULL, NULL, NULL);
-
-create table t2 (c int, col1 int, key(c));
-insert into t2 select t1.a, 100000 from t1;
-analyze table t2;
-
-explain
-select
- max(a)+ (select col1 from t2 where t2.c=t1.c)
-from t1
-group by t1.b;
-
-select
- max(a) + (select col1 from t2 where t2.c=t1.c)
-from t1
-group by t1.b;
-
-drop table t0,t1,t2;
-
---echo #
---echo # MDEV-9602 crash in st_key::actual_rec_per_key when group by constant
---echo #
-
-create table t1 (a date not null,unique (a)) engine=innodb;
-select distinct a from t1 group by 'a';
-insert into t1 values("2001-02-02"),("2001-02-03");
-select distinct a from t1 group by 'a';
-drop table t1;
-
---echo #
---echo # MDEV-10324: Server crash in get_sel_arg_for_keypart or Assertion `n < size()' failed in Mem_root_array
---echo #
-CREATE TABLE t1 (
- job_id int(10) unsigned NOT NULL AUTO_INCREMENT,
- job_cmd varbinary(60) NOT NULL DEFAULT '',
- job_namespace int(11) NOT NULL,
- job_title varbinary(255) NOT NULL,
- job_params blob NOT NULL,
- job_timestamp varbinary(14) DEFAULT NULL,
- job_random int(10) unsigned NOT NULL DEFAULT '0',
- job_token varbinary(32) NOT NULL DEFAULT '',
- job_token_timestamp varbinary(14) DEFAULT NULL,
- job_sha1 varbinary(32) NOT NULL DEFAULT '',
- job_attempts int(10) unsigned NOT NULL DEFAULT '0',
- PRIMARY KEY (job_id),
- KEY job_cmd (job_cmd,job_namespace,job_title,job_params(128)),
- KEY job_timestamp (job_timestamp),
- KEY job_sha1 (job_sha1),
- KEY job_cmd_token (job_cmd,job_token,job_random),
- KEY job_cmd_token_id (job_cmd,job_token,job_id)
-);
-
-INSERT INTO t1 VALUES
- (NULL, 'foo', 1, 'foo', 'foo', 'foo', 1, 'foo', 'foo', 'foo', 1),
- (NULL, 'bar', 2, 'bar', 'bar', 'bar', 2, 'bar', 'bar', 'bar', 2);
-
-SELECT DISTINCT job_cmd FROM t1 WHERE job_cmd IN ('foobar','null');
-drop table t1;
-
-CREATE TABLE t1 (f1 INT NOT NULL, f2 VARCHAR(3) NOT NULL, KEY(f1), KEY(f2, f1));
-INSERT INTO t1 VALUES (0,'foo'),(1,'bar');
-SELECT 1 IN ( SELECT COUNT( DISTINCT f2 ) FROM t1 WHERE f1 <= 4 );
-drop table t1;
-
---echo #
---echo # MDEV-10694 - SIGFPE and/or huge memory allocation in maria_create with distinct/group by/ rollup
---echo #
-create table t1 (a int,b int) ;
-insert into t1 values(-126,7),(1,1),(0,0),(-1,1),(351,65534);
-select distinct 1 from t1 group by a,b with rollup limit 1;
-drop table t1;
-
diff --git a/mysql-test/t/group_by_innodb.test b/mysql-test/t/group_by_innodb.test
deleted file mode 100644
index f7e035a1b54..00000000000
--- a/mysql-test/t/group_by_innodb.test
+++ /dev/null
@@ -1,168 +0,0 @@
-#
-# Test GROUP BY queries that utilize InnoDB extended keys
-#
-
---source include/have_innodb.inc
-
-set @save_ext_key_optimizer_switch=@@optimizer_switch;
-
---echo #
---echo # MDEV-3992 Server crash or valgrind errors in test_if_skip_sort_order/test_if_cheaper_ordering
---echo # on GROUP BY with indexes on InnoDB table
---echo #
-
-CREATE TABLE t1 (
- pk INT PRIMARY KEY,
- a VARCHAR(1) NOT NULL,
- KEY (pk)
-) ENGINE=InnoDB;
-
-set optimizer_switch='extended_keys=on';
-
-INSERT INTO t1 VALUES (1,'a'),(2,'b');
-
-EXPLAIN
-SELECT COUNT(*), pk field1, pk AS field2
-FROM t1 WHERE a = 'r' OR pk = 183
-GROUP BY field1, field2;
-
-SELECT COUNT(*), pk field1, pk AS field2
-FROM t1 WHERE a = 'r' OR pk = 183
-GROUP BY field1, field2;
-
-EXPLAIN
-SELECT COUNT(*), pk field1 FROM t1
-WHERE a = 'r' OR pk = 183 GROUP BY field1, field1;
-
-SELECT COUNT(*), pk field1 FROM t1
-WHERE a = 'r' OR pk = 183 GROUP BY field1, field1;
-
-drop table t1;
-
-set optimizer_switch=@save_ext_key_optimizer_switch;
-
---echo #
---echo # MDEV-4002 Server crash or valgrind errors in Item_func_group_concat::setup and Item_func_group_concat::add
---echo #
-
-CREATE TABLE t1 (
- pk INT NOT NULL PRIMARY KEY,
- d1 DOUBLE,
- d2 DOUBLE,
- i INT NOT NULL DEFAULT '0',
- KEY (i)
-) ENGINE=InnoDB;
-
-INSERT INTO t1 VALUES (1,1.0,1.1,1),(2,2.0,2.2,2);
-
-PREPARE stmt FROM "
-SELECT DISTINCT i, GROUP_CONCAT( d1, d2 ORDER BY d1, d2 )
-FROM t1 a1 NATURAL JOIN t1 a2 GROUP BY i WITH ROLLUP
-";
-
-EXECUTE stmt;
-EXECUTE stmt;
-
-DROP TABLE t1;
-
---echo End of 5.5 tests
-
---echo #
---echo # MDEV-5719: Wrong result with GROUP BY and LEFT OUTER JOIN
---echo #
-CREATE TABLE t1 (oidGroup INT, oid INT PRIMARY KEY)ENGINE=INNODB;
-INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4);
-
-CREATE TABLE t2 (oid INT PRIMARY KEY)ENGINE=INNODB;
-INSERT INTO t2 VALUES (3);
-
-# Returns a value
-SELECT a.oidGroup, a.oid, b.oid FROM t1 a LEFT JOIN t2 b ON
-a.oid=b.oid WHERE a.oidGroup=1;
-
-SELECT a.oidGroup, a.oid, b.oid FROM t1 a LEFT JOIN t2 b ON
-a.oid=b.oid WHERE a.oidGroup=1 GROUP BY a.oid;
-
-DROP TABLE t1, t2;
-
---echo #
---echo # MDEV-7193: Incorrect Query Result (MySQL Bug 68897) in MariaDB 10.0.14
---echo # (fixed by MDEV-5719)
---echo #
-
-CREATE TABLE `t1` (
- `param` int(11) NOT NULL,
- `idx` int(11) NOT NULL,
- `text` varchar(255) default NULL,
- PRIMARY KEY (`param`,`idx`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
-INSERT INTO `t1` (`param`, `idx`, `text`) VALUES
-(1, 0, 'select'),
-(1, 1, 'Kabel mit Stecker 5-polig'),
-(1, 2, 'Kabel ohne Stecker'),
-(2, 0, 'number'),
-(2, 1, '22'),
-(2, 2, '25');
-CREATE TABLE `t2` (
- `id` int PRIMARY KEY
-);
-
-INSERT INTO t2 VALUES (1),(2),(3),(4);
-SELECT t2.id AS id, T.text AS xtext,GROUP_CONCAT(T3.text) AS optionen
-FROM t2
-LEFT JOIN t1 AS T ON(T.param=t2.id AND T.idx=0 )
-LEFT JOIN t1 AS T3 ON(T3.param=t2.id AND T3.idx>0 )
-GROUP BY t2.id
-ORDER BY id ASC;
-
-SELECT t2.id AS id, T.text AS xtext,GROUP_CONCAT(T3.text) AS optionen
-FROM t2
-LEFT JOIN t1 AS T ON(T.param=t2.id AND T.idx=0 )
-LEFT JOIN t1 AS T3 ON(T3.param=t2.id AND T3.idx>0 )
-GROUP BY t2.id
-ORDER BY id DESC;
-
-DROP TABLE t1, t2;
-
---echo #
---echo # MDEV-11162: Assertion `num_records == m_idx_array.size()' failed in Filesort_buffer::alloc_sort_buffer(uint, uint)
---echo #
-
-CREATE TABLE t1 (i INT) ENGINE=InnoDB;
-SELECT ( SELECT DISTINCT GROUP_CONCAT(SLEEP(0)) FROM t1 GROUP BY i );
-SELECT i FROM t1 order by i LIMIT 1;
-DROP TABLE t1;
-
---echo # Port of testcase:
---echo #
---echo # Bug#20819199 ASSERTION FAILED IN TEST_IF_SKIP_SORT_ORDER
---echo #
-
-CREATE TABLE t0 ( a INT );
-INSERT INTO t0 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
-
-CREATE TABLE t1 (
- pk INT NOT NULL AUTO_INCREMENT,
- a INT,
- b INT,
- PRIMARY KEY (pk),
- KEY idx1 (a),
- KEY idx2 (b, a),
- KEY idx3 (a, b)
-) ENGINE = InnoDB;
-
-INSERT INTO t1 (a, b) SELECT t01.a, t02.a FROM t0 t01, t0 t02;
-
-ANALYZE TABLE t1;
-
-let $query=
-SELECT DISTINCT a, MAX(b) FROM t1 WHERE a >= 0 GROUP BY a,a;
-
-eval EXPLAIN $query;
-eval $query;
-
-DROP TABLE t0, t1;
-
---echo # End of tests
-
diff --git a/mysql-test/t/group_by_null.test b/mysql-test/t/group_by_null.test
deleted file mode 100644
index 93e965671dd..00000000000
--- a/mysql-test/t/group_by_null.test
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-# MDEV-5461 Assertion `length <= column->length' fails in write_block_record with functions in select list, GROUP BY, ORDER BY
-#
-create table t1 (a int);
-insert into t1 values (1),(2);
-select max('foo') from t1 group by value(a), extractvalue('bar','qux') order by "v";
-drop table t1;
diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test
deleted file mode 100644
index b0bc42d7f8c..00000000000
--- a/mysql-test/t/group_min_max.test
+++ /dev/null
@@ -1,1613 +0,0 @@
-#
-# Test file for WL#1724 (Min/Max Optimization for Queries with Group By Clause).
-# The queries in this file test query execution via QUICK_GROUP_MIN_MAX_SELECT.
-#
-
-#
-# TODO:
-# Add queries with:
-# - C != const
-# - C IS NOT NULL
-# - HAVING clause
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1 (
- a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(248) default ' '
-);
-
-insert into t1 (a1, a2, b, c, d) values
-('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
-('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
-('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
-('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
-('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
-('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
-('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
-('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
-('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
-('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
-('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
-('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
-('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
-('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
-('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
-('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4'),
-('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
-('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
-('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
-('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
-('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
-('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
-('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
-('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
-('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
-('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
-('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
-('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
-('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
-('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
-('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
-('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4');
-
-create index idx_t1_0 on t1 (a1);
-create index idx_t1_1 on t1 (a1,a2,b,c);
-create index idx_t1_2 on t1 (a1,a2,b);
-analyze table t1;
-
-# t2 is the same as t1, but with some NULLs in the MIN/MAX column, and
-# one more nullable attribute
-
---disable_warnings
-drop table if exists t2;
---enable_warnings
-
-create table t2 (
- a1 char(64), a2 char(64) not null, b char(16), c char(16), d char(16), dummy char(248) default ' '
-);
-insert into t2 select * from t1;
-# add few rows with NULL's in the MIN/MAX column
-insert into t2 (a1, a2, b, c, d) values
-('a','a',NULL,'a777','xyz'),('a','a',NULL,'a888','xyz'),('a','a',NULL,'a999','xyz'),
-('a','a','a',NULL,'xyz'),
-('a','a','b',NULL,'xyz'),
-('a','b','a',NULL,'xyz'),
-('c','a',NULL,'c777','xyz'),('c','a',NULL,'c888','xyz'),('c','a',NULL,'c999','xyz'),
-('d','b','b',NULL,'xyz'),
-('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),
-('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),
-('a','a',NULL,'a777','xyz'),('a','a',NULL,'a888','xyz'),('a','a',NULL,'a999','xyz'),
-('a','a','a',NULL,'xyz'),
-('a','a','b',NULL,'xyz'),
-('a','b','a',NULL,'xyz'),
-('c','a',NULL,'c777','xyz'),('c','a',NULL,'c888','xyz'),('c','a',NULL,'c999','xyz'),
-('d','b','b',NULL,'xyz'),
-('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),
-('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz');
-
-create index idx_t2_0 on t2 (a1);
-create index idx_t2_1 on t2 (a1,a2,b,c);
-create index idx_t2_2 on t2 (a1,a2,b);
-analyze table t2;
-
-# Table t3 is the same as t1, but with smaller column lenghts.
-# This allows to test different branches of the cost computation procedure
-# when the number of keys per block are less than the number of keys in the
-# sub-groups formed by predicates over non-group attributes.
-
---disable_warnings
-drop table if exists t3;
---enable_warnings
-
-create table t3 (
- a1 char(1), a2 char(1), b char(1), c char(4) not null, d char(3), dummy char(1) default ' '
-);
-
-insert into t3 (a1, a2, b, c, d) values
-('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
-('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
-('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
-('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
-('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
-('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
-('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
-('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
-('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
-('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
-('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
-('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4');
-insert into t3 (a1, a2, b, c, d) values
-('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
-('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
-('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
-('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
-('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
-('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
-('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
-('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
-('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
-('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
-('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
-('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4');
-insert into t3 (a1, a2, b, c, d) values
-('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
-('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
-('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
-('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
-('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
-('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
-('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
-('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
-('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
-('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
-('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
-('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4');
-insert into t3 (a1, a2, b, c, d) values
-('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
-('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
-('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
-('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
-('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
-('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
-('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
-('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
-('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
-('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
-('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
-('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4');
-
-create index idx_t3_0 on t3 (a1);
-create index idx_t3_1 on t3 (a1,a2,b,c);
-create index idx_t3_2 on t3 (a1,a2,b);
-analyze table t3;
-
-
-#
-# Queries without a WHERE clause. These queries do not use ranges.
-#
-
-# plans
-explain select a1, min(a2) from t1 group by a1;
-explain select a1, max(a2) from t1 group by a1;
-explain select a1, min(a2), max(a2) from t1 group by a1;
-explain select a1, a2, b, min(c), max(c) from t1 group by a1,a2,b;
-explain select a1,a2,b,max(c),min(c) from t1 group by a1,a2,b;
---replace_column 7 # 9 #
-explain select a1,a2,b,max(c),min(c) from t2 group by a1,a2,b;
-# Select fields in different order
-explain select min(a2), a1, max(a2), min(a2), a1 from t1 group by a1;
-explain select a1, b, min(c), a1, max(c), b, a2, max(c), max(c) from t1 group by a1, a2, b;
-explain select min(a2) from t1 group by a1;
-explain select a2, min(c), max(c) from t1 group by a1,a2,b;
-
-# queries
-select a1, min(a2) from t1 group by a1;
-select a1, max(a2) from t1 group by a1;
-select a1, min(a2), max(a2) from t1 group by a1;
-select a1, a2, b, min(c), max(c) from t1 group by a1,a2,b;
-select a1,a2,b,max(c),min(c) from t1 group by a1,a2,b;
-select a1,a2,b,max(c),min(c) from t2 group by a1,a2,b;
-# Select fields in different order
-select min(a2), a1, max(a2), min(a2), a1 from t1 group by a1;
-select a1, b, min(c), a1, max(c), b, a2, max(c), max(c) from t1 group by a1, a2, b;
-select min(a2) from t1 group by a1;
-select a2, min(c), max(c) from t1 group by a1,a2,b;
-
-#
-# Queries with a where clause
-#
-
-# A) Preds only over the group 'A' attributes
-# plans
-explain select a1,a2,b,min(c),max(c) from t1 where a1 < 'd' group by a1,a2,b;
-explain select a1,a2,b,min(c),max(c) from t1 where a1 >= 'b' group by a1,a2,b;
-explain select a1,a2,b, max(c) from t1 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;
-explain select a1, max(c) from t1 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;
-explain select a1,a2,b,min(c),max(c) from t1 where a1 >= 'c' or a2 < 'b' group by a1,a2,b;
-explain select a1,a2,b, max(c) from t1 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b;
-explain select a1,a2,b,min(c),max(c) from t1 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b;
-explain select a1,a2,b, max(c) from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') group by a1,a2,b;
-explain select a1,a2,b,min(c),max(c) from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') group by a1,a2,b;
-explain select a1,min(c),max(c) from t1 where a1 >= 'b' group by a1,a2,b;
-explain select a1, max(c) from t1 where a1 in ('a','b','d') group by a1,a2,b;
-
---replace_column 9 #
-explain select a1,a2,b, max(c) from t2 where a1 < 'd' group by a1,a2,b;
---replace_column 9 #
-explain select a1,a2,b,min(c),max(c) from t2 where a1 < 'd' group by a1,a2,b;
---replace_column 9 #
-explain select a1,a2,b,min(c),max(c) from t2 where a1 >= 'b' group by a1,a2,b;
---replace_column 9 #
-explain select a1,a2,b, max(c) from t2 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;
---replace_column 9 #
-explain select a1, max(c) from t2 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;
---replace_column 9 #
-explain select a1,a2,b,min(c),max(c) from t2 where a1 >= 'c' or a2 < 'b' group by a1,a2,b;
---replace_column 9 #
-explain select a1,a2,b, max(c) from t2 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b;
---replace_column 9 #
-explain select a1,a2,b,min(c),max(c) from t2 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b;
---replace_column 9 #
-explain select a1,a2,b, max(c) from t2 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') group by a1,a2,b;
---replace_column 9 #
-explain select a1,a2,b,min(c),max(c) from t2 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') group by a1,a2,b;
---replace_column 9 #
-explain select a1,min(c),max(c) from t2 where a1 >= 'b' group by a1,a2,b;
---replace_column 9 #
-explain select a1, max(c) from t2 where a1 in ('a','b','d') group by a1,a2,b;
-
-# queries
-select a1,a2,b,min(c),max(c) from t1 where a1 < 'd' group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t1 where a1 >= 'b' group by a1,a2,b;
-select a1,a2,b, max(c) from t1 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;
-select a1, max(c) from t1 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t1 where a1 >= 'c' or a2 < 'b' group by a1,a2,b;
-select a1,a2,b, max(c) from t1 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t1 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b;
-select a1,a2,b, max(c) from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') group by a1,a2,b;
-select a1,min(c),max(c) from t1 where a1 >= 'b' group by a1,a2,b;
-select a1, max(c) from t1 where a1 in ('a','b','d') group by a1,a2,b;
-
-select a1,a2,b, max(c) from t2 where a1 < 'd' group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t2 where a1 < 'd' group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t2 where a1 >= 'b' group by a1,a2,b;
-select a1,a2,b, max(c) from t2 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;
-select a1, max(c) from t2 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t2 where a1 >= 'c' or a2 < 'b' group by a1,a2,b;
-select a1,a2,b, max(c) from t2 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t2 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b;
-select a1,a2,b, max(c) from t2 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t2 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') group by a1,a2,b;
-select a1,min(c),max(c) from t2 where a1 >= 'b' group by a1,a2,b;
-select a1, max(c) from t2 where a1 in ('a','b','d') group by a1,a2,b;
-
-# B) Equalities only over the non-group 'B' attributes
-# plans
-explain select a1,a2,b,max(c),min(c) from t1 where (a2 = 'a') and (b = 'b') group by a1;
-explain select a1,max(c),min(c) from t1 where (a2 = 'a') and (b = 'b') group by a1;
-explain select a1,a2,b, max(c) from t1 where (b = 'b') group by a1,a2;
-explain select a1,a2,b,min(c),max(c) from t1 where (b = 'b') group by a1,a2;
-explain select a1,a2, max(c) from t1 where (b = 'b') group by a1,a2;
-
-explain select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') group by a1;
-explain select a1,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') group by a1;
-explain select a1,a2,b, max(c) from t2 where (b = 'b') group by a1,a2;
-explain select a1,a2,b,min(c),max(c) from t2 where (b = 'b') group by a1,a2;
-explain select a1,a2, max(c) from t2 where (b = 'b') group by a1,a2;
-
-# these queries test case 2) in TRP_GROUP_MIN_MAX::update_cost()
-explain select a1,a2,b,max(c),min(c) from t3 where (a2 = 'a') and (b = 'b') group by a1;
-explain select a1,max(c),min(c) from t3 where (a2 = 'a') and (b = 'b') group by a1;
-
-# queries
-select a1,a2,b,max(c),min(c) from t1 where (a2 = 'a') and (b = 'b') group by a1;
-select a1,max(c),min(c) from t1 where (a2 = 'a') and (b = 'b') group by a1;
-select a1,a2,b, max(c) from t1 where (b = 'b') group by a1,a2;
-select a1,a2,b,min(c),max(c) from t1 where (b = 'b') group by a1,a2;
-select a1,a2, max(c) from t1 where (b = 'b') group by a1,a2;
-
-select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') group by a1;
-select a1,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') group by a1;
-select a1,a2,b, max(c) from t2 where (b = 'b') group by a1,a2;
-select a1,a2,b,min(c),max(c) from t2 where (b = 'b') group by a1,a2;
-select a1,a2, max(c) from t2 where (b = 'b') group by a1,a2;
-
-# these queries test case 2) in TRP_GROUP_MIN_MAX::update_cost()
-select a1,a2,b,max(c),min(c) from t3 where (a2 = 'a') and (b = 'b') group by a1;
-select a1,max(c),min(c) from t3 where (a2 = 'a') and (b = 'b') group by a1;
-
-
-# IS NULL (makes sense for t2 only)
-# plans
-explain select a1,a2,b,min(c) from t2 where (a2 = 'a') and b is NULL group by a1;
-explain select a1,a2,b,max(c) from t2 where (a2 = 'a') and b is NULL group by a1;
-explain select a1,a2,b,min(c) from t2 where b is NULL group by a1,a2;
-explain select a1,a2,b,max(c) from t2 where b is NULL group by a1,a2;
-explain select a1,a2,b,min(c),max(c) from t2 where b is NULL group by a1,a2;
-explain select a1,a2,b,min(c),max(c) from t2 where b is NULL group by a1,a2;
-# queries
-select a1,a2,b,min(c) from t2 where (a2 = 'a') and b is NULL group by a1;
-select a1,a2,b,max(c) from t2 where (a2 = 'a') and b is NULL group by a1;
-select a1,a2,b,min(c) from t2 where b is NULL group by a1,a2;
-select a1,a2,b,max(c) from t2 where b is NULL group by a1,a2;
-select a1,a2,b,min(c),max(c) from t2 where b is NULL group by a1,a2;
-select a1,a2,b,min(c),max(c) from t2 where b is NULL group by a1,a2;
-
-# C) Range predicates for the MIN/MAX attribute
-# plans
---replace_column 9 #
-explain select a1,a2,b, max(c) from t1 where (c > 'b1') group by a1,a2,b;
-explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b1') group by a1,a2,b;
-explain select a1,a2,b, max(c) from t1 where (c > 'f123') group by a1,a2,b;
-explain select a1,a2,b,min(c),max(c) from t1 where (c > 'f123') group by a1,a2,b;
-explain select a1,a2,b, max(c) from t1 where (c < 'a0') group by a1,a2,b;
-explain select a1,a2,b,min(c),max(c) from t1 where (c < 'a0') group by a1,a2,b;
-explain select a1,a2,b, max(c) from t1 where (c < 'k321') group by a1,a2,b;
-explain select a1,a2,b,min(c),max(c) from t1 where (c < 'k321') group by a1,a2,b;
-explain select a1,a2,b, max(c) from t1 where (c < 'a0') or (c > 'b1') group by a1,a2,b;
-explain select a1,a2,b,min(c),max(c) from t1 where (c < 'a0') or (c > 'b1') group by a1,a2,b;
-explain select a1,a2,b, max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
-explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
-explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b111') and (c <= 'g112') group by a1,a2,b;
-explain select a1,a2,b,min(c),max(c) from t1 where (c < 'c5') or (c = 'g412') or (c = 'k421') group by a1,a2,b;
-explain select a1,a2,b,min(c),max(c) from t1 where ((c > 'b111') and (c <= 'g112')) or ((c > 'd000') and (c <= 'i110')) group by a1,a2,b;
-explain select a1,a2,b,min(c),max(c) from t1 where (c between 'b111' and 'g112') or (c between 'd000' and 'i110') group by a1,a2,b;
-
---replace_column 9 #
-explain select a1,a2,b, max(c) from t2 where (c > 'b1') group by a1,a2,b;
---replace_column 9 #
-explain select a1,a2,b,min(c),max(c) from t2 where (c > 'b1') group by a1,a2,b;
---replace_column 9 #
-explain select a1,a2,b, max(c) from t2 where (c > 'f123') group by a1,a2,b;
---replace_column 9 #
-explain select a1,a2,b,min(c),max(c) from t2 where (c > 'f123') group by a1,a2,b;
---replace_column 9 #
-explain select a1,a2,b, max(c) from t2 where (c < 'a0') group by a1,a2,b;
---replace_column 9 #
-explain select a1,a2,b,min(c),max(c) from t2 where (c < 'a0') group by a1,a2,b;
---replace_column 9 #
-explain select a1,a2,b, max(c) from t2 where (c < 'k321') group by a1,a2,b;
---replace_column 9 #
-explain select a1,a2,b,min(c),max(c) from t2 where (c < 'k321') group by a1,a2,b;
---replace_column 9 #
-explain select a1,a2,b, max(c) from t2 where (c < 'a0') or (c > 'b1') group by a1,a2,b;
---replace_column 9 #
-explain select a1,a2,b,min(c),max(c) from t2 where (c < 'a0') or (c > 'b1') group by a1,a2,b;
---replace_column 9 #
-explain select a1,a2,b, max(c) from t2 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
---replace_column 9 #
-explain select a1,a2,b,min(c),max(c) from t2 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
---replace_column 9 #
-explain select a1,a2,b,min(c),max(c) from t2 where (c > 'b111') and (c <= 'g112') group by a1,a2,b;
---replace_column 9 #
-explain select a1,a2,b,min(c),max(c) from t2 where (c < 'c5') or (c = 'g412') or (c = 'k421') group by a1,a2,b;
---replace_column 9 #
-explain select a1,a2,b,min(c),max(c) from t2 where ((c > 'b111') and (c <= 'g112')) or ((c > 'd000') and (c <= 'i110')) group by a1,a2,b;
-
-# queries
-select a1,a2,b, max(c) from t1 where (c > 'b1') group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t1 where (c > 'b1') group by a1,a2,b;
-select a1,a2,b, max(c) from t1 where (c > 'f123') group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t1 where (c > 'f123') group by a1,a2,b;
-select a1,a2,b, max(c) from t1 where (c < 'a0') group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t1 where (c < 'a0') group by a1,a2,b;
-select a1,a2,b, max(c) from t1 where (c < 'k321') group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t1 where (c < 'k321') group by a1,a2,b;
-select a1,a2,b, max(c) from t1 where (c < 'a0') or (c > 'b1') group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t1 where (c < 'a0') or (c > 'b1') group by a1,a2,b;
-select a1,a2,b, max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t1 where (c > 'b111') and (c <= 'g112') group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t1 where (c < 'c5') or (c = 'g412') or (c = 'k421') group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t1 where ((c > 'b111') and (c <= 'g112')) or ((c > 'd000') and (c <= 'i110')) group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t1 where (c between 'b111' and 'g112') or (c between 'd000' and 'i110') group by a1,a2,b;
-
-select a1,a2,b, max(c) from t2 where (c > 'b1') group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t2 where (c > 'b1') group by a1,a2,b;
-select a1,a2,b, max(c) from t2 where (c > 'f123') group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t2 where (c > 'f123') group by a1,a2,b;
-select a1,a2,b, max(c) from t2 where (c < 'a0') group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t2 where (c < 'a0') group by a1,a2,b;
-select a1,a2,b, max(c) from t2 where (c < 'k321') group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t2 where (c < 'k321') group by a1,a2,b;
-select a1,a2,b, max(c) from t2 where (c < 'a0') or (c > 'b1') group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t2 where (c < 'a0') or (c > 'b1') group by a1,a2,b;
-select a1,a2,b, max(c) from t2 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t2 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t2 where (c > 'b111') and (c <= 'g112') group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t2 where (c < 'c5') or (c = 'g412') or (c = 'k421') group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t2 where ((c > 'b111') and (c <= 'g112')) or ((c > 'd000') and (c <= 'i110')) group by a1,a2,b;
-
-# analyze the sub-select
-explain select a1,a2,b,min(c),max(c) from t1
-where exists ( select * from t2 where t2.c = t1.c )
-group by a1,a2,b;
-
-select a1,a2,b,min(c),max(c) from t1
-where exists ( select * from t2 where t2.c = t1.c )
-group by a1,a2,b;
-
-# the sub-select is unrelated to MIN/MAX
-explain select a1,a2,b,min(c),max(c) from t1
-where exists ( select * from t2 where t2.c > 'b1' )
-group by a1,a2,b;
-
-select a1,a2,b,min(c),max(c) from t1
-where exists ( select * from t2 where t2.c > 'b1' )
-group by a1,a2,b;
-
-# correlated subselect that doesn't reference the min/max argument
-explain select a1,a2,b,c,min(c), max(c) from t1
-where exists ( select * from t2 where t1.b > 'a' and t2.c > 'b1' )
-group by a1,a2,b;
-
-select a1,a2,b,c,min(c), max(c) from t1
-where exists ( select * from t2 where t1.b > 'a' and t2.c > 'b1' )
-group by a1,a2,b;
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='semijoin_with_cache=off';
-explain select a1,a2,b,c,min(c), max(c) from t1
-where exists ( select * from t2
- where t2.c in (select c from t3 where t3.c > t1.b) and
- t2.c > 'b1' )
-group by a1,a2,b;
-
-select a1,a2,b,c,min(c), max(c) from t1
-where exists ( select * from t2
- where t2.c in (select c from t3 where t3.c > t1.b) and
- t2.c > 'b1' )
-group by a1,a2,b;
-SET optimizer_switch=@save_optimizer_switch;
-
-# correlated subselect that references the min/max argument
-explain select a1,a2,b,c,min(c), max(c) from t1
-where exists ( select * from t2 where t1.c > 'a' and t2.c > 'b1' )
-group by a1,a2,b;
-
-select a1,a2,b,c,min(c), max(c) from t1
-where exists ( select * from t2 where t1.c > 'a' and t2.c > 'b1' )
-group by a1,a2,b;
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='semijoin_with_cache=off';
-explain select a1,a2,b,c,min(c), max(c) from t1
-where exists ( select * from t2
- where t2.c in (select c from t3 where t3.c > t1.c) and
- t2.c > 'b1' )
-group by a1,a2,b;
-
-select a1,a2,b,c,min(c), max(c) from t1
-where exists ( select * from t2
- where t2.c in (select c from t3 where t3.c > t1.c) and
- t2.c > 'b1' )
-group by a1,a2,b;
-SET optimizer_switch=@save_optimizer_switch;
-
-
-# A,B,C) Predicates referencing mixed classes of attributes
-# plans
-explain select a1,a2,b,min(c),max(c) from t1 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
-explain select a1,a2,b,min(c),max(c) from t1 where (a1 >= 'c' or a2 < 'b') and (c > 'b111') group by a1,a2,b;
-explain select a1,a2,b,min(c),max(c) from t1 where (a2 >= 'b') and (b = 'a') and (c > 'b111') group by a1,a2,b;
-explain select a1,a2,b,min(c) from t1 where ((a1 > 'a') or (a1 < '9')) and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c < 'h112') or (c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122')) group by a1,a2,b;
-explain select a1,a2,b,min(c) from t1 where ((a1 > 'a') or (a1 < '9')) and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122') or (c < 'h112') or (c = 'c111')) group by a1,a2,b;
-explain select a1,a2,b,min(c) from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
-explain select a1,a2,b,min(c) from t1 where (ord(a1) > 97) and (ord(a2) + ord(a1) > 194) and (b = 'c') group by a1,a2,b;
-
---replace_column 9 #
-explain select a1,a2,b,min(c),max(c) from t2 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
---replace_column 9 #
-explain select a1,a2,b,min(c),max(c) from t2 where (a1 >= 'c' or a2 < 'b') and (c > 'b111') group by a1,a2,b;
---replace_column 9 #
-explain select a1,a2,b,min(c),max(c) from t2 where (a2 >= 'b') and (b = 'a') and (c > 'b111') group by a1,a2,b;
---replace_column 9 #
-explain select a1,a2,b,min(c) from t2 where ((a1 > 'a') or (a1 < '9')) and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c < 'h112') or (c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122')) group by a1,a2,b;
---replace_column 9 #
-explain select a1,a2,b,min(c) from t2 where ((a1 > 'a') or (a1 < '9')) and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122') or (c < 'h112') or (c = 'c111')) group by a1,a2,b;
---replace_column 9 #
-explain select a1,a2,b,min(c) from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
-
-# queries
-select a1,a2,b,min(c),max(c) from t1 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t1 where (a1 >= 'c' or a2 < 'b') and (c > 'b111') group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t1 where (a2 >= 'b') and (b = 'a') and (c > 'b111') group by a1,a2,b;
-select a1,a2,b,min(c) from t1 where ((a1 > 'a') or (a1 < '9')) and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c < 'h112') or (c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122')) group by a1,a2,b;
-select a1,a2,b,min(c) from t1 where ((a1 > 'a') or (a1 < '9')) and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122') or (c < 'h112') or (c = 'c111')) group by a1,a2,b;
-select a1,a2,b,min(c) from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
-select a1,a2,b,min(c) from t1 where (ord(a1) > 97) and (ord(a2) + ord(a1) > 194) and (b = 'c') group by a1,a2,b;
-
-select a1,a2,b,min(c),max(c) from t2 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t2 where (a1 >= 'c' or a2 < 'b') and (c > 'b111') group by a1,a2,b;
-select a1,a2,b,min(c),max(c) from t2 where (a2 >= 'b') and (b = 'a') and (c > 'b111') group by a1,a2,b;
-select a1,a2,b,min(c) from t2 where ((a1 > 'a') or (a1 < '9')) and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c < 'h112') or (c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122')) group by a1,a2,b;
-select a1,a2,b,min(c) from t2 where ((a1 > 'a') or (a1 < '9')) and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122') or (c < 'h112') or (c = 'c111')) group by a1,a2,b;
-select a1,a2,b,min(c) from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
-
-
-#
-# GROUP BY queries without MIN/MAX
-#
-
-# plans
-explain select a1,a2,b from t1 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
-explain select a1,a2,b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
-explain select a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b;
-explain select a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
-
---replace_column 9 #
-explain select a1,a2,b from t2 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
---replace_column 9 #
-explain select a1,a2,b from t2 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
---replace_column 9 #
-explain select a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b;
---replace_column 9 #
-explain select a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
-
-# queries
-select a1,a2,b from t1 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
-select a1,a2,b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
-select a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b;
-select a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
-
-select a1,a2,b from t2 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
-select a1,a2,b from t2 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
-select a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b;
-select a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
-
-#
-# DISTINCT queries
-#
-
-# plans
-explain select distinct a1,a2,b from t1;
-explain select distinct a1,a2,b from t1 where (a2 >= 'b') and (b = 'a');
-explain extended select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
-explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
-explain select distinct b from t1 where (a2 >= 'b') and (b = 'a');
-
---replace_column 9 #
-explain select distinct a1,a2,b from t2;
---replace_column 9 #
-explain select distinct a1,a2,b from t2 where (a2 >= 'b') and (b = 'a');
-explain extended select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
---replace_column 9 #
-explain select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
-explain select distinct b from t2 where (a2 >= 'b') and (b = 'a');
-
-# queries
-select distinct a1,a2,b from t1;
-select distinct a1,a2,b from t1 where (a2 >= 'b') and (b = 'a');
-select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
-select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
-select distinct b from t1 where (a2 >= 'b') and (b = 'a');
-
-select distinct a1,a2,b from t2;
-select distinct a1,a2,b from t2 where (a2 >= 'b') and (b = 'a');
-select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
-select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
-select distinct b from t2 where (a2 >= 'b') and (b = 'a');
-
-# BUG #6303
-select distinct t_00.a1
-from t1 t_00
-where exists ( select * from t2 where a1 = t_00.a1 );
-
-# BUG #8532 - SELECT DISTINCT a, a causes server to crash
-select distinct a1,a1 from t1;
-select distinct a2,a1,a2,a1 from t1;
-select distinct t1.a1,t2.a1 from t1,t2;
-
-
-#
-# DISTINCT queries with GROUP-BY
-#
-
-# plans
-explain select distinct a1,a2,b from t1;
-explain select distinct a1,a2,b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
-explain select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b;
-explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
-explain select distinct b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
-
---replace_column 9 #
-explain select distinct a1,a2,b from t2;
---replace_column 9 #
-explain select distinct a1,a2,b from t2 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
---replace_column 9 #
-explain select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b;
---replace_column 9 #
-explain select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
---replace_column 9 #
-explain select distinct b from t2 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
-
-# queries
-select distinct a1,a2,b from t1;
-select distinct a1,a2,b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
-select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b;
-select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
-select distinct b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
-
-select distinct a1,a2,b from t2;
-select distinct a1,a2,b from t2 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
-select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b;
-select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
-select distinct b from t2 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
-
-
-#
-# COUNT (DISTINCT cols) queries
-#
-
-explain select count(distinct a1,a2,b) from t1 where (a2 >= 'b') and (b = 'a');
-explain select count(distinct a1,a2,b,c) from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
-explain extended select count(distinct a1,a2,b) from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
-explain select count(distinct b) from t1 where (a2 >= 'b') and (b = 'a');
-explain extended select 98 + count(distinct a1,a2,b) from t1 where (a1 > 'a') and (a2 > 'a');
-
-select count(distinct a1,a2,b) from t1 where (a2 >= 'b') and (b = 'a');
-select count(distinct a1,a2,b,c) from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
-select count(distinct a1,a2,b) from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
-select count(distinct b) from t1 where (a2 >= 'b') and (b = 'a');
-select 98 + count(distinct a1,a2,b) from t1 where (a1 > 'a') and (a2 > 'a');
-
-#
-# Queries with expressions in the select clause
-#
-
-explain select a1,a2,b, concat(min(c), max(c)) from t1 where a1 < 'd' group by a1,a2,b;
-explain select concat(a1,min(c)),b from t1 where a1 < 'd' group by a1,a2,b;
-explain select concat(a1,min(c)),b,max(c) from t1 where a1 < 'd' group by a1,a2,b;
-explain select concat(a1,a2),b,min(c),max(c) from t1 where a1 < 'd' group by a1,a2,b;
-explain select concat(ord(min(b)),ord(max(b))),min(b),max(b) from t1 group by a1,a2;
-
-select a1,a2,b, concat(min(c), max(c)) from t1 where a1 < 'd' group by a1,a2,b;
-select concat(a1,min(c)),b from t1 where a1 < 'd' group by a1,a2,b;
-select concat(a1,min(c)),b,max(c) from t1 where a1 < 'd' group by a1,a2,b;
-select concat(a1,a2),b,min(c),max(c) from t1 where a1 < 'd' group by a1,a2,b;
-select concat(ord(min(b)),ord(max(b))),min(b),max(b) from t1 group by a1,a2;
-
-
-#
-# Negative examples: queries that should NOT be treated as optimizable by
-# QUICK_GROUP_MIN_MAX_SELECT
-#
-
-# select a non-indexed attribute
-explain select a1,a2,b,d,min(c),max(c) from t1 group by a1,a2,b;
-
-explain select a1,a2,b,d from t1 group by a1,a2,b;
-
-# predicate that references an attribute that is after the MIN/MAX argument
-# in the index
-explain extended select a1,a2,min(b),max(b) from t1
-where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (c > 'a111') group by a1,a2;
-
-# predicate that references a non-indexed attribute
-explain extended select a1,a2,b,min(c),max(c) from t1
-where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (d > 'xy2') group by a1,a2,b;
-
-explain extended select a1,a2,b,c from t1
-where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (d > 'xy2') group by a1,a2,b,c;
-
-# non-equality predicate for a non-group select attribute
-explain select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') or (b < 'b') group by a1;
-explain extended select a1,a2,b from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (c > 'a111') group by a1,a2,b;
-
-# non-group field with an equality predicate that references a keypart after the
-# MIN/MAX argument
-explain select a1,a2,min(b),c from t2 where (a2 = 'a') and (c = 'a111') group by a1;
-select a1,a2,min(b),c from t2 where (a2 = 'a') and (c = 'a111') group by a1;
-
-# disjunction for a non-group select attribute
-explain select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') or (b = 'a') group by a1;
-
-# non-range predicate for the MIN/MAX attribute
-explain select a1,a2,b,min(c),max(c) from t2
-where (c > 'a000') and (c <= 'd999') and (c like '_8__') group by a1,a2,b;
-
-# not all attributes are indexed by one index
-explain select a1, a2, b, c, min(d), max(d) from t1 group by a1,a2,b,c;
-
-# other aggregate functions than MIN/MAX
-explain select a1,a2,count(a2) from t1 group by a1,a2,b;
-explain extended select a1,a2,count(a2) from t1 where (a1 > 'a') group by a1,a2,b;
-explain extended select sum(ord(a1)) from t1 where (a1 > 'a') group by a1,a2,b;
-
-#
-# MDEV-4120 UNIQUE indexes should not be considered for loose index scan
-#
-
-create table t4 as select distinct a1, a2, b, c from t1;
-alter table t4 add unique index idxt4 (a1, a2, b, c);
-
---echo # This is "superceded" by MDEV-7118, and Loose Index Scan is again an option:
-explain
-select a1, a2, b, min(c) from t4 group by a1, a2, b;
-select a1, a2, b, min(c) from t4 group by a1, a2, b;
-
-drop table t4;
-
-#
-# Bug #16710: select distinct doesn't return all it should
-#
-
-explain select distinct(a1) from t1 where ord(a2) = 98;
-select distinct(a1) from t1 where ord(a2) = 98;
-
-#
-# BUG#11044: DISTINCT or GROUP BY queries with equality predicates instead of MIN/MAX.
-#
-
-explain select a1 from t1 where a2 = 'b' group by a1;
-select a1 from t1 where a2 = 'b' group by a1;
-
-explain select distinct a1 from t1 where a2 = 'b';
-select distinct a1 from t1 where a2 = 'b';
-
-#
-# Bug #12672: primary key implcitly included in every innodb index
-#
-# Test case moved to group_min_max_innodb
-
-
-#
-# Bug #6142: a problem with the empty innodb table
-#
-# Test case moved to group_min_max_innodb
-
-
-#
-# Bug #9798: group by with rollup
-#
-# Test case moved to group_min_max_innodb
-
-
-#
-# Bug #13293 Wrongly used index results in endless loop.
-#
-# Test case moved to group_min_max_innodb
-
-
-drop table t1,t2,t3;
-
-#
-# Bug #14920 Ordering aggregated result sets with composite primary keys
-# corrupts resultset
-#
-create table t1 (c1 int not null,c2 int not null, primary key(c1,c2));
-insert into t1 (c1,c2) values
-(10,1),(10,2),(10,3),(20,4),(20,5),(20,6),(30,7),(30,8),(30,9);
-select distinct c1, c2 from t1 order by c2;
-select c1,min(c2) as c2 from t1 group by c1 order by c2;
-select c1,c2 from t1 group by c1,c2 order by c2;
-drop table t1;
-
-#
-# Bug #16203: Analysis for possible min/max optimization erroneously
-# returns impossible range
-#
-
-CREATE TABLE t1 (a varchar(5), b int(11), PRIMARY KEY (a,b));
-INSERT INTO t1 VALUES ('AA',1), ('AA',2), ('AA',3), ('BB',1), ('AA',4);
-OPTIMIZE TABLE t1;
-
-SELECT a FROM t1 WHERE a='AA' GROUP BY a;
-SELECT a FROM t1 WHERE a='BB' GROUP BY a;
-
-EXPLAIN SELECT a FROM t1 WHERE a='AA' GROUP BY a;
-EXPLAIN SELECT a FROM t1 WHERE a='BB' GROUP BY a;
-
-SELECT DISTINCT a FROM t1 WHERE a='BB';
-SELECT DISTINCT a FROM t1 WHERE a LIKE 'B%';
-SELECT a FROM t1 WHERE a LIKE 'B%' GROUP BY a;
-
-DROP TABLE t1;
-
-
-#
-# Bug #15102: select distinct returns empty result, select count
-# distinct > 0 (correct)
-#
-
-CREATE TABLE t1 (
- a int(11) NOT NULL DEFAULT '0',
- b varchar(16) COLLATE latin1_general_ci NOT NULL DEFAULT '',
- PRIMARY KEY (a,b)
- ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
-
-delimiter |;
-
-CREATE PROCEDURE a(x INT)
-BEGIN
- DECLARE rnd INT;
- DECLARE cnt INT;
-
- WHILE x > 0 DO
- SET rnd= x % 100;
- SET cnt = (SELECT COUNT(*) FROM t1 WHERE a = rnd);
- INSERT INTO t1(a,b) VALUES (rnd, CAST(cnt AS CHAR));
- SET x= x - 1;
- END WHILE;
-END|
-
-DELIMITER ;|
-
-CALL a(1000);
-
-SELECT a FROM t1 WHERE a=0;
-SELECT DISTINCT a FROM t1 WHERE a=0;
-SELECT COUNT(DISTINCT a) FROM t1 WHERE a=0;
-
-DROP TABLE t1;
-DROP PROCEDURE a;
-
-#
-# Bug #18068: SELECT DISTINCT
-#
-
-CREATE TABLE t1 (a varchar(64) NOT NULL default '', KEY(a));
-
-INSERT INTO t1 (a) VALUES
- (''), ('CENTRAL'), ('EASTERN'), ('GREATER LONDON'),
- ('NORTH CENTRAL'), ('NORTH EAST'), ('NORTH WEST'), ('SCOTLAND'),
- ('SOUTH EAST'), ('SOUTH WEST'), ('WESTERN');
-
-EXPLAIN SELECT DISTINCT a,a FROM t1 ORDER BY a;
-SELECT DISTINCT a,a FROM t1 ORDER BY a;
-
-DROP TABLE t1;
-
-#
-# Bug #21007: NATURAL JOIN (any JOIN (2 x NATURAL JOIN)) crashes the server
-#
-
-CREATE TABLE t1 (id1 INT, id2 INT);
-CREATE TABLE t2 (id2 INT, id3 INT, id5 INT);
-CREATE TABLE t3 (id3 INT, id4 INT);
-CREATE TABLE t4 (id4 INT);
-CREATE TABLE t5 (id5 INT, id6 INT);
-CREATE TABLE t6 (id6 INT);
-
-INSERT INTO t1 VALUES(1,1);
-INSERT INTO t2 VALUES(1,1,1);
-INSERT INTO t3 VALUES(1,1);
-INSERT INTO t4 VALUES(1);
-INSERT INTO t5 VALUES(1,1);
-INSERT INTO t6 VALUES(1);
-
-# original bug query
-SELECT * FROM
-t1
- NATURAL JOIN
-(t2 JOIN (t3 NATURAL JOIN t4, t5 NATURAL JOIN t6)
- ON (t3.id3 = t2.id3 AND t5.id5 = t2.id5));
-
-# inner join swapped
-SELECT * FROM
-t1
- NATURAL JOIN
-(((t3 NATURAL JOIN t4) join (t5 NATURAL JOIN t6) on t3.id4 = t5.id5) JOIN t2
- ON (t3.id3 = t2.id3 AND t5.id5 = t2.id5));
-
-# one join less, no ON cond
-SELECT * FROM t1 NATURAL JOIN ((t3 join (t5 NATURAL JOIN t6)) JOIN t2);
-
-# wrong error message: 'id2' - ambiguous column
-SELECT * FROM
-(t2 JOIN (t3 NATURAL JOIN t4, t5 NATURAL JOIN t6)
- ON (t3.id3 = t2.id3 AND t5.id5 = t2.id5))
- NATURAL JOIN
-t1;
-SELECT * FROM
-(t2 JOIN ((t3 NATURAL JOIN t4) join (t5 NATURAL JOIN t6)))
- NATURAL JOIN
-t1;
-
-DROP TABLE t1,t2,t3,t4,t5,t6;
-
-#
-# Bug#22342: No results returned for query using max and group by
-#
-CREATE TABLE t1 (a int, b int, KEY (a,b), KEY b (b));
-INSERT INTO t1 VALUES (1,1),(1,2),(1,0),(1,3);
-
-explain SELECT MAX(b), a FROM t1 WHERE b < 2 AND a = 1 GROUP BY a;
-SELECT MAX(b), a FROM t1 WHERE b < 2 AND a = 1 GROUP BY a;
-SELECT MIN(b), a FROM t1 WHERE b > 1 AND a = 1 GROUP BY a;
-CREATE TABLE t2 (a int, b int, c int, PRIMARY KEY (a,b,c));
-INSERT INTO t2 SELECT a,b,b FROM t1;
-explain SELECT MIN(c) FROM t2 WHERE b = 2 and a = 1 and c > 1 GROUP BY a;
-SELECT MIN(c) FROM t2 WHERE b = 2 and a = 1 and c > 1 GROUP BY a;
-
-DROP TABLE t1,t2;
-
-#
-# Bug#24156: Loose index scan not used with CREATE TABLE ...SELECT and similar statements
-#
-
-CREATE TABLE t1 (a INT, b INT, INDEX (a,b));
-INSERT INTO t1 (a, b) VALUES (1,1), (1,2), (1,3), (1,4), (1,5),
- (2,2), (2,3), (2,1), (3,1), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6);
-EXPLAIN SELECT max(b), a FROM t1 GROUP BY a;
-FLUSH STATUS;
-SELECT max(b), a FROM t1 GROUP BY a;
-SHOW STATUS LIKE 'handler_read__e%';
-EXPLAIN SELECT max(b), a FROM t1 GROUP BY a;
-FLUSH STATUS;
-CREATE TABLE t2 SELECT max(b), a FROM t1 GROUP BY a;
-SHOW STATUS LIKE 'handler_read__e%';
-FLUSH STATUS;
-SELECT * FROM (SELECT max(b), a FROM t1 GROUP BY a) b;
-SHOW STATUS LIKE 'handler_read__e%';
-FLUSH STATUS;
-(SELECT max(b), a FROM t1 GROUP BY a) UNION
- (SELECT max(b), a FROM t1 GROUP BY a);
-SHOW STATUS LIKE 'handler_read__e%';
-EXPLAIN (SELECT max(b), a FROM t1 GROUP BY a) UNION
- (SELECT max(b), a FROM t1 GROUP BY a);
-
-EXPLAIN SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x
- FROM t1 AS t1_outer;
-EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE EXISTS
- (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
-EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
- (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12;
-EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
- a IN (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
-EXPLAIN SELECT 1 FROM t1 AS t1_outer GROUP BY a HAVING
- a > (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
-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;
-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;
-
-CREATE TABLE t3 LIKE t1;
-FLUSH STATUS;
-INSERT INTO t3 SELECT a,MAX(b) FROM t1 GROUP BY a;
-SHOW STATUS LIKE 'handler_read__e%';
-DELETE FROM t3;
-FLUSH STATUS;
-INSERT INTO t3 SELECT 1, (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2)
- FROM t1 LIMIT 1;
-SHOW STATUS LIKE 'handler_read__e%';
-FLUSH STATUS;
-DELETE FROM t3 WHERE (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2) > 10000;
-SHOW STATUS LIKE 'handler_read__e%';
-FLUSH STATUS;
---error ER_SUBQUERY_NO_1_ROW
-DELETE FROM t3 WHERE (SELECT (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2) x
- FROM t1) > 10000;
-SHOW STATUS LIKE 'handler_read__e%';
-
-DROP TABLE t1,t2,t3;
-
-#
-# Bug#25602: queries with DISTINCT and SQL_BIG_RESULT hint
-# for which loose scan optimization is applied
-#
-
-CREATE TABLE t1 (a int, INDEX idx(a));
-INSERT INTO t1 VALUES
- (4), (2), (1), (2), (4), (2), (1), (4),
- (4), (2), (1), (2), (2), (4), (1), (4);
-
-EXPLAIN SELECT DISTINCT(a) FROM t1;
-SELECT DISTINCT(a) FROM t1;
-EXPLAIN SELECT SQL_BIG_RESULT DISTINCT(a) FROM t1;
-SELECT SQL_BIG_RESULT DISTINCT(a) FROM t1;
-
-DROP TABLE t1;
-
-#
-# Bug #32268: Indexed queries give bogus MIN and MAX results
-#
-
-CREATE TABLE t1 (a INT, b INT);
-INSERT INTO t1 (a, b) VALUES (1,1), (1,2), (1,3);
-INSERT INTO t1 SELECT a + 1, b FROM t1;
-INSERT INTO t1 SELECT a + 2, b FROM t1;
-
-EXPLAIN
-SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a DESC;
-SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a DESC;
-
-CREATE INDEX break_it ON t1 (a, b);
-
-EXPLAIN
-SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a;
-SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a;
-
-EXPLAIN
-SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a DESC;
-SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a DESC;
-
-EXPLAIN
-SELECT a, MIN(b), MAX(b), AVG(b) FROM t1 GROUP BY a ORDER BY a DESC;
-SELECT a, MIN(b), MAX(b), AVG(b) FROM t1 GROUP BY a ORDER BY a DESC;
-
-DROP TABLE t1;
-
-#
-# Bug#38195: Incorrect handling of aggregate functions when loose index scan is
-# used causes server crash.
-#
-create table t1 (a int, b int, key (a,b), key `index` (a,b)) engine=MyISAM;
-insert into t1 (a,b) values
-(0,0),(0,1),(0,2),(0,3),(0,4),(0,5),(0,6),
- (0,7),(0,8),(0,9),(0,10),(0,11),(0,12),(0,13),
-(1,0),(1,1),(1,2),(1,3),(1,4),(1,5),(1,6),
- (1,7),(1,8),(1,9),(1,10),(1,11),(1,12),(1,13),
-(2,0),(2,1),(2,2),(2,3),(2,4),(2,5),(2,6),
- (2,7),(2,8),(2,9),(2,10),(2,11),(2,12),(2,13),
-(3,0),(3,1),(3,2),(3,3),(3,4),(3,5),(3,6),
- (3,7),(3,8),(3,9),(3,10),(3,11),(3,12),(3,13);
-insert into t1 (a,b) select a, max(b)+1 from t1 where a = 0 group by a;
-select * from t1;
-explain extended select sql_buffer_result a, max(b)+1 from t1 where a = 0 group by a;
-drop table t1;
-
-
-#
-# Bug #41610: key_infix_len can be overwritten causing some group by queries
-# to return no rows
-#
-
-CREATE TABLE t1 (a int, b int, c int, d int,
- KEY foo (c,d,a,b), KEY bar (c,a,b,d));
-
-INSERT INTO t1 VALUES (1, 1, 1, 1), (1, 1, 1, 2), (1, 1, 1, 3), (1, 1, 1, 4);
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO t1 SELECT a,b,c+1,d FROM t1;
-
-#Should be non-empty
-EXPLAIN SELECT DISTINCT c FROM t1 WHERE d=4;
-SELECT DISTINCT c FROM t1 WHERE d=4;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug #45386: Wrong query result with MIN function in field list,
---echo # WHERE and GROUP BY clause
---echo #
-
-CREATE TABLE t (a INT, b INT, INDEX (a,b));
-INSERT INTO t VALUES (2,0), (2,0), (2,1), (2,1);
-INSERT INTO t SELECT * FROM t;
-INSERT INTO t SELECT * FROM t;
-
---echo # test MIN
---echo #should use range with index for group by
-EXPLAIN
-SELECT a, MIN(b) FROM t WHERE b <> 0 GROUP BY a;
---echo #should return 1 row
-SELECT a, MIN(b) FROM t WHERE b <> 0 GROUP BY a;
-
---echo # test MAX
---echo #should use range with index for group by
-EXPLAIN
-SELECT a, MAX(b) FROM t WHERE b <> 1 GROUP BY a;
---echo #should return 1 row
-SELECT a, MAX(b) FROM t WHERE b <> 1 GROUP BY a;
-
---echo # test 3 ranges and use the middle one
-INSERT INTO t SELECT a, 2 FROM t;
-
---echo #should use range with index for group by
-EXPLAIN
-SELECT a, MAX(b) FROM t WHERE b > 0 AND b < 2 GROUP BY a;
---echo #should return 1 row
-SELECT a, MAX(b) FROM t WHERE b > 0 AND b < 2 GROUP BY a;
-
-DROP TABLE t;
-
---echo #
---echo # Bug #48472: Loose index scan inappropriately chosen for some WHERE
---echo # conditions
---echo #
-
-CREATE TABLE t (a INT, b INT, INDEX (a,b));
-INSERT INTO t VALUES (2,0), (2,0), (2,1), (2,1);
-INSERT INTO t SELECT * FROM t;
-
-SELECT a, MAX(b) FROM t WHERE 0=b+0 GROUP BY a;
-
-DROP TABLE t;
-
---echo End of 5.0 tests
-
---echo #
---echo # Bug #46607: Assertion failed: (cond_type == Item::FUNC_ITEM) results in
---echo # server crash
---echo #
-
-CREATE TABLE t (a INT, b INT, INDEX (a,b));
-INSERT INTO t VALUES (2,0), (2,0), (2,1), (2,1);
-INSERT INTO t SELECT * FROM t;
-
-SELECT a, MAX(b) FROM t WHERE b GROUP BY a;
-
-DROP TABLE t;
-
-#
-# BUG#49902 - SELECT returns incorrect results
-#
-CREATE TABLE t1(a INT NOT NULL, b INT NOT NULL, KEY (b));
-INSERT INTO t1 VALUES(1,1),(2,1);
-ANALYZE TABLE t1;
-SELECT 1 AS c, b FROM t1 WHERE b IN (1,2) GROUP BY c, b;
-SELECT a FROM t1 WHERE b=1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#47762: Incorrect result from MIN() when WHERE tests NOT NULL column
---echo # for NULL
---echo #
-
---echo ## Test for NULLs allowed
-CREATE TABLE t1 ( a INT, KEY (a) );
-INSERT INTO t1 VALUES (1), (2), (3);
---source include/min_null_cond.inc
-INSERT INTO t1 VALUES (NULL), (NULL);
---source include/min_null_cond.inc
-DROP TABLE t1;
-
---echo ## Test for NOT NULLs
-CREATE TABLE t1 ( a INT NOT NULL PRIMARY KEY);
-INSERT INTO t1 VALUES (1), (2), (3);
---echo #
---echo # NULL-safe operator test disabled for non-NULL indexed columns.
---echo #
---echo # See bugs
---echo #
---echo # - Bug#52173: Reading NULL value from non-NULL index gives
---echo # wrong result in embedded server
---echo #
---echo # - Bug#52174: Sometimes wrong plan when reading a MAX value from
---echo # non-NULL index
---echo #
---let $skip_null_safe_test= 1
---source include/min_null_cond.inc
-DROP TABLE t1;
-
---echo #
---echo # Bug#53859: Valgrind: opt_sum_query(TABLE_LIST*, List<Item>&, Item*) at
---echo # opt_sum.cc:305
---echo #
-CREATE TABLE t1 ( a INT, KEY (a) );
-INSERT INTO t1 VALUES (1), (2), (3);
-
-SELECT MIN( a ) AS min_a
-FROM t1
-WHERE a > 1 AND a IS NULL
-ORDER BY min_a;
-
-DROP TABLE t1;
-
-#
-# MDEV-729 lp:998028 - Server crashes on normal shutdown in closefrm after executing a query from MyISAM table
-#
-create table t1 (a int, b varchar(1), key(b,a)) engine=myisam;
-insert t1 values (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'f'),(7,'g'),(8,'h'),(null,'i');
-select min(a), b from t1 where a=7 or b='z' group by b;
-flush tables;
-drop table t1;
-
---echo #
---echo # LP BUG#888456 Wrong result with DISTINCT , ANY , subquery_cache=off , NOT NULL
---echo #
-
-CREATE TABLE t1 ( a int NOT NULL) ;
-INSERT INTO t1 VALUES (28),(29),(9);
-
-CREATE TABLE t2 ( a int, KEY (a)) ;
-INSERT INTO t2 VALUES (1),(1),(1),(4),(4),(5),(5),(8),(8),(9);
-
-explain select (select t2.a from t2 where t2.a >= t1.a group by t2.a) from t1;
-select (select t2.a from t2 where t2.a >= t1.a group by t2.a) from t1;
-
-drop table t1, t2;
-
---echo #
---echo # LP BUG#900375 Wrong result with derived_merge=ON, DISTINCT or GROUP BY, EXISTS
---echo #
-
-CREATE TABLE t1 ( a INT, b INT, KEY (b) );
-INSERT INTO t1 VALUES
-(100,10),(101,11),(102,12),(103,13),(104,14),
-(105,15),(106,16),(107,17),(108,18),(109,19);
-
-EXPLAIN
-SELECT alias1.* FROM t1, (SELECT * FROM t1) AS alias1
-WHERE EXISTS ( SELECT DISTINCT b FROM t1 WHERE b <= alias1.a ) ;
-SELECT alias1.* FROM t1, (SELECT * FROM t1) AS alias1
-WHERE EXISTS ( SELECT DISTINCT b FROM t1 WHERE b <= alias1.a ) ;
-
-EXPLAIN
-SELECT alias1.* FROM t1, t1 AS alias1
-WHERE EXISTS ( SELECT DISTINCT b FROM t1 WHERE b <= alias1.a ) ;
-SELECT alias1.* FROM t1, t1 AS alias1
-WHERE EXISTS ( SELECT DISTINCT b FROM t1 WHERE b <= alias1.a ) ;
-
-drop table t1;
-
---echo End of 5.1 tests
-
---echo #
---echo # MDEV-765 lp:825075 - Wrong result with GROUP BY + multipart key + MIN/MAX loose scan
---echo #
-
-CREATE TABLE t1 (a varchar(1), b varchar(1), KEY (b,a));
-INSERT INTO t1 VALUES
-('0',NULL),('9',NULL),('8','c'),('4','d'),('7','d'),(NULL,'f'),
-('7','f'),('8','g'),(NULL,'j');
-
-explain
-SELECT max(a) , b FROM t1 WHERE a IS NULL OR b = 'z' GROUP BY b;
-SELECT max(a) , b FROM t1 WHERE a IS NULL OR b = 'z' GROUP BY b;
-
-explain
-SELECT b, min(a) FROM t1 WHERE a = '7' OR b = 'z' GROUP BY b;
-SELECT b, min(a) FROM t1 WHERE a = '7' OR b = 'z' GROUP BY b;
-
-explain
-SELECT b, min(a) FROM t1 WHERE (a = b OR b = 'd' OR b is NULL) GROUP BY b;
-SELECT b, min(a) FROM t1 WHERE (a = b OR b = 'd' OR b is NULL) GROUP BY b;
-
-explain
-SELECT b, min(a) FROM t1 WHERE a > ('0' = b) AND b = 'z' GROUP BY b;
-SELECT b, min(a) FROM t1 WHERE a > ('0' = b) AND b = 'z' GROUP BY b;
-
-explain
-SELECT b, min(a) FROM t1 WHERE a > '0' AND (b < (a = '7')) GROUP BY b;
-SELECT b, min(a) FROM t1 WHERE a > '0' AND (b < (a = '7')) GROUP BY b;
-
-explain
-SELECT b, min(a) FROM t1 WHERE (a > '0' AND (a > '1' OR b = 'd')) GROUP BY b;
-SELECT b, min(a) FROM t1 WHERE (a > '0' AND (a > '1' OR b = 'd')) GROUP BY b;
-
-drop table t1;
-
---echo #
---echo # MDEV-4140 Wrong result with GROUP BY + multipart key + MIN/MAX loose scan and a subquery
---echo #
-
-CREATE TABLE t1 (a int, b int, KEY (b, a)) ;
-INSERT INTO t1 VALUES (0,99),(9,99),(4,0),(7,0),(99,0),(7,0),(8,0),(99,0),(1,0);
-INSERT INTO t1 VALUES (0,99),(9,99),(4,0),(7,0),(99,0),(7,0),(8,0),(99,0),(1,0);
-CREATE TABLE t2 (c int) ;
-INSERT INTO t2 VALUES (0),(1);
-
-EXPLAIN
-SELECT MIN(a), b FROM t1 WHERE a > 0 GROUP BY b;
-SELECT MIN(a), b FROM t1 WHERE a > 0 GROUP BY b;
-EXPLAIN
-SELECT MIN(a), b FROM t1 WHERE a > ( SELECT c FROM t2 WHERE c = 0 ) GROUP BY b;
-SELECT MIN(a), b FROM t1 WHERE a > ( SELECT c FROM t2 WHERE c = 0 ) GROUP BY b;
-# this test is for 5.5 to ensure that the subquery is expensive
-EXPLAIN
-SELECT MIN(a), b FROM t1 WHERE a > ( SELECT min(c) FROM t2, t1 t1a, t1 t1b WHERE c = 0 ) GROUP BY b;
-SELECT MIN(a), b FROM t1 WHERE a > ( SELECT min(c) FROM t2, t1 t1a, t1 t1b WHERE c = 0 ) GROUP BY b;
-
-drop table t1, t2;
-
---echo End of 5.3 tests
-
---echo #
---echo # WL#3220 (Loose index scan for COUNT DISTINCT)
---echo #
-
-CREATE TABLE t1 (a INT, b INT, c INT, KEY (a,b));
-INSERT INTO t1 VALUES (1,1,1), (1,2,1), (1,3,1), (1,4,1);
-INSERT INTO t1 SELECT a, b + 4, 1 FROM t1;
-INSERT INTO t1 SELECT a + 1, b, 1 FROM t1;
-CREATE TABLE t2 (a INT, b INT, c INT, d INT, e INT, f INT, KEY (a,b,c));
-INSERT INTO t2 VALUES (1,1,1,1,1,1), (1,2,1,1,1,1), (1,3,1,1,1,1),
- (1,4,1,1,1,1);
-INSERT INTO t2 SELECT a, b + 4, c,d,e,f FROM t2;
-INSERT INTO t2 SELECT a + 1, b, c,d,e,f FROM t2;
-
-EXPLAIN SELECT COUNT(DISTINCT a) FROM t1;
-SELECT COUNT(DISTINCT a) FROM t1;
-
-EXPLAIN SELECT COUNT(DISTINCT a,b) FROM t1;
-SELECT COUNT(DISTINCT a,b) FROM t1;
-
-EXPLAIN SELECT COUNT(DISTINCT b,a) FROM t1;
-SELECT COUNT(DISTINCT b,a) FROM t1;
-
-EXPLAIN SELECT COUNT(DISTINCT b) FROM t1;
-SELECT COUNT(DISTINCT b) FROM t1;
-
-EXPLAIN SELECT COUNT(DISTINCT a) FROM t1 GROUP BY a;
-SELECT COUNT(DISTINCT a) FROM t1 GROUP BY a;
-
-EXPLAIN SELECT COUNT(DISTINCT b) FROM t1 GROUP BY a;
-SELECT COUNT(DISTINCT b) FROM t1 GROUP BY a;
-
-EXPLAIN SELECT COUNT(DISTINCT a) FROM t1 GROUP BY b;
-SELECT COUNT(DISTINCT a) FROM t1 GROUP BY b;
-
-EXPLAIN SELECT DISTINCT COUNT(DISTINCT a) FROM t1;
-SELECT DISTINCT COUNT(DISTINCT a) FROM t1;
-
-EXPLAIN SELECT COUNT(DISTINCT a, b + 0) FROM t1;
-SELECT COUNT(DISTINCT a, b + 0) FROM t1;
-
-EXPLAIN SELECT COUNT(DISTINCT a) FROM t1 HAVING COUNT(DISTINCT b) < 10;
-SELECT COUNT(DISTINCT a) FROM t1 HAVING COUNT(DISTINCT b) < 10;
-
-EXPLAIN SELECT COUNT(DISTINCT a) FROM t1 HAVING COUNT(DISTINCT c) < 10;
-SELECT COUNT(DISTINCT a) FROM t1 HAVING COUNT(DISTINCT c) < 10;
-
-EXPLAIN SELECT 1 FROM t1 HAVING COUNT(DISTINCT a) < 10;
-SELECT 1 FROM t1 HAVING COUNT(DISTINCT a) < 10;
-
-EXPLAIN SELECT 1 FROM t1 GROUP BY a HAVING COUNT(DISTINCT b) > 1;
-SELECT 1 FROM t1 GROUP BY a HAVING COUNT(DISTINCT b) > 1;
-
-EXPLAIN SELECT COUNT(DISTINCT t1_1.a) FROM t1 t1_1, t1 t1_2 GROUP BY t1_1.a;
-SELECT COUNT(DISTINCT t1_1.a) FROM t1 t1_1, t1 t1_2 GROUP BY t1_1.a;
-
-EXPLAIN SELECT COUNT(DISTINCT a), 12 FROM t1;
-SELECT COUNT(DISTINCT a), 12 FROM t1;
-
-EXPLAIN SELECT COUNT(DISTINCT a, b, c) FROM t2;
-SELECT COUNT(DISTINCT a, b, c) FROM t2;
-
-EXPLAIN SELECT COUNT(DISTINCT a), SUM(DISTINCT a), AVG(DISTINCT a) FROM t2;
-SELECT COUNT(DISTINCT a), SUM(DISTINCT a), AVG(DISTINCT a) FROM t2;
-
-EXPLAIN SELECT COUNT(DISTINCT a), SUM(DISTINCT a), AVG(DISTINCT f) FROM t2;
-SELECT COUNT(DISTINCT a), SUM(DISTINCT a), AVG(DISTINCT f) FROM t2;
-
-EXPLAIN SELECT COUNT(DISTINCT a, b), COUNT(DISTINCT b, a) FROM t2;
-SELECT COUNT(DISTINCT a, b), COUNT(DISTINCT b, a) FROM t2;
-
-EXPLAIN SELECT COUNT(DISTINCT a, b), COUNT(DISTINCT b, f) FROM t2;
-SELECT COUNT(DISTINCT a, b), COUNT(DISTINCT b, f) FROM t2;
-
-EXPLAIN SELECT COUNT(DISTINCT a, b), COUNT(DISTINCT b, d) FROM t2;
-SELECT COUNT(DISTINCT a, b), COUNT(DISTINCT b, d) FROM t2;
-
-EXPLAIN SELECT a, c, COUNT(DISTINCT c, a, b) FROM t2 GROUP BY a, b, c;
-SELECT a, c, COUNT(DISTINCT c, a, b) FROM t2 GROUP BY a, b, c;
-
-EXPLAIN SELECT COUNT(DISTINCT c, a, b) FROM t2
- WHERE a > 5 AND b BETWEEN 10 AND 20 GROUP BY a, b, c;
-SELECT COUNT(DISTINCT c, a, b) FROM t2
- WHERE a > 5 AND b BETWEEN 10 AND 20 GROUP BY a, b, c;
-
-EXPLAIN SELECT COUNT(DISTINCT b), SUM(DISTINCT b) FROM t2 WHERE a = 5
- GROUP BY b;
-SELECT COUNT(DISTINCT b), SUM(DISTINCT b) FROM t2 WHERE a = 5
- GROUP BY b;
-
-EXPLAIN SELECT a, COUNT(DISTINCT b), SUM(DISTINCT b) FROM t2 GROUP BY a;
-SELECT a, COUNT(DISTINCT b), SUM(DISTINCT b) FROM t2 GROUP BY a;
-
-EXPLAIN SELECT COUNT(DISTINCT b), SUM(DISTINCT b) FROM t2 GROUP BY a;
-SELECT COUNT(DISTINCT b), SUM(DISTINCT b) FROM t2 GROUP BY a;
-
-EXPLAIN SELECT COUNT(DISTINCT a, b) FROM t2 WHERE c = 13 AND d = 42;
-SELECT COUNT(DISTINCT a, b) FROM t2 WHERE c = 13 AND d = 42;
-
-EXPLAIN SELECT a, COUNT(DISTINCT a), SUM(DISTINCT a) FROM t2
- WHERE b = 13 AND c = 42 GROUP BY a;
-SELECT a, COUNT(DISTINCT a), SUM(DISTINCT a) FROM t2
- WHERE b = 13 AND c = 42 GROUP BY a;
-
-# This query could have been resolved using loose index scan since the second
-# part of count(..) is defined by a constant predicate
-EXPLAIN SELECT COUNT(DISTINCT a, b), SUM(DISTINCT a) FROM t2 WHERE b = 42;
-SELECT COUNT(DISTINCT a, b), SUM(DISTINCT a) FROM t2 WHERE b = 42;
-
-EXPLAIN SELECT SUM(DISTINCT a), MAX(b) FROM t2 GROUP BY a;
-SELECT SUM(DISTINCT a), MAX(b) FROM t2 GROUP BY a;
-
-EXPLAIN SELECT 42 * (a + c + COUNT(DISTINCT c, a, b)) FROM t2 GROUP BY a, b, c;
-SELECT 42 * (a + c + COUNT(DISTINCT c, a, b)) FROM t2 GROUP BY a, b, c;
-
-EXPLAIN SELECT (SUM(DISTINCT a) + MAX(b)) FROM t2 GROUP BY a;
-SELECT (SUM(DISTINCT a) + MAX(b)) FROM t2 GROUP BY a;
-
-DROP TABLE t1,t2;
-
---echo # end of WL#3220 tests
-
---echo #
---echo # Bug#50539: Wrong result when loose index scan is used for an aggregate
---echo # function with distinct
---echo #
-CREATE TABLE t1 (
- f1 int(11) NOT NULL DEFAULT '0',
- f2 char(1) NOT NULL DEFAULT '',
- KEY (f1,f2)
-) ;
-insert into t1 values(1,'A'),(1 , 'B'), (1, 'C'), (2, 'A'),
-(3, 'A'), (3, 'B'), (3, 'C'), (3, 'D');
-
-SELECT f1, COUNT(DISTINCT f2) FROM t1 GROUP BY f1;
-explain SELECT f1, COUNT(DISTINCT f2) FROM t1 GROUP BY f1;
-
-drop table t1;
---echo # End of test#50539.
-
---echo #
---echo # Bug#17217128 - BAD INTERACTION BETWEEN MIN/MAX AND
---echo # "HAVING SUM(DISTINCT)": WRONG RESULTS.
---echo #
-
-CREATE TABLE t (a INT, b INT, KEY(a,b));
-INSERT INTO t VALUES (1,1), (2,2), (3,3), (4,4), (1,0), (3,2), (4,5);
-ANALYZE TABLE t;
-
-SELECT a, SUM(DISTINCT a), MIN(b) FROM t GROUP BY a;
-EXPLAIN SELECT a, SUM(DISTINCT a), MIN(b) FROM t GROUP BY a;
-
-SELECT a, SUM(DISTINCT a), MAX(b) FROM t GROUP BY a;
-EXPLAIN SELECT a, SUM(DISTINCT a), MAX(b) FROM t GROUP BY a;
-
-SELECT a, MAX(b) FROM t GROUP BY a HAVING SUM(DISTINCT a);
-EXPLAIN SELECT a, MAX(b) FROM t GROUP BY a HAVING SUM(DISTINCT a);
-
-SELECT SUM(DISTINCT a), MIN(b), MAX(b) FROM t;
-EXPLAIN SELECT SUM(DISTINCT a), MIN(b), MAX(b) FROM t;
-
-SELECT a, SUM(DISTINCT a), MIN(b), MAX(b) FROM t GROUP BY a;
-EXPLAIN SELECT a, SUM(DISTINCT a), MIN(b), MAX(b) FROM t GROUP BY a;
-DROP TABLE t;
-
---echo #
---echo # MDEV-4219 A simple select query returns random data (upstream bug#68473)
---echo #
-
---disable_warnings
-drop table if exists faulty;
---enable_warnings
-
-# MySQL's test case
-
-CREATE TABLE faulty (
-a int(11) unsigned NOT NULL AUTO_INCREMENT,
-b int(11) unsigned NOT NULL,
-c datetime NOT NULL,
-PRIMARY KEY (a),
-UNIQUE KEY b_and_c (b,c)
-);
-
-INSERT INTO faulty (b, c) VALUES
-(1801, '2013-02-15 09:00:00'),
-(1802, '2013-02-28 09:00:00'),
-(1802, '2013-03-01 09:00:00'),
-(5, '1990-02-15 09:00:00'),
-(5, '2013-02-15 09:00:00'),
-(5, '2009-02-15 17:00:00');
-
-EXPLAIN
-SELECT DISTINCT b, c FROM faulty WHERE b='1802' ORDER BY c;
-SELECT DISTINCT b, c FROM faulty WHERE b='1802' ORDER BY c;
-
-drop table faulty;
-
-# MariaDB test case
-
-CREATE TABLE t1 (a INT, b INT);
-INSERT INTO t1 (a, b) VALUES (1,1), (1,2), (1,3);
-INSERT INTO t1 SELECT a + 1, b FROM t1;
-INSERT INTO t1 SELECT a + 2, b FROM t1;
-
-CREATE INDEX break_it ON t1 (a, b);
-
-EXPLAIN
-SELECT distinct a, b FROM t1 where a = '3' ORDER BY b;
-SELECT distinct a, b FROM t1 where a = '3' ORDER BY b;
-
-drop table t1;
-
---echo #
---echo # Start of 10.0 tests
---echo #
-
---echo #
---echo # MDEV-6991 GROUP_MIN_MAX optimization is erroneously applied in some cases
---echo #
-CREATE TABLE t1 (id INT NOT NULL, a VARCHAR(20)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,'2001-01-01');
-INSERT INTO t1 VALUES (1,'2001-01-02');
-INSERT INTO t1 VALUES (1,'2001-01-03');
-INSERT INTO t1 VALUES (1,' 2001-01-04');
-INSERT INTO t1 VALUES (2,'2001-01-01');
-INSERT INTO t1 VALUES (2,'2001-01-02');
-INSERT INTO t1 VALUES (2,'2001-01-03');
-INSERT INTO t1 VALUES (2,' 2001-01-04');
-INSERT INTO t1 VALUES (3,'2001-01-01');
-INSERT INTO t1 VALUES (3,'2001-01-02');
-INSERT INTO t1 VALUES (3,'2001-01-03');
-INSERT INTO t1 VALUES (3,' 2001-01-04');
-INSERT INTO t1 VALUES (4,'2001-01-01');
-INSERT INTO t1 VALUES (4,'2001-01-02');
-INSERT INTO t1 VALUES (4,'2001-01-03');
-INSERT INTO t1 VALUES (4,' 2001-01-04');
-SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=DATE'2001-01-04' GROUP BY id;
-ALTER TABLE t1 ADD KEY(id,a);
-SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=DATE'2001-01-04' GROUP BY id;
-DROP TABLE t1;
-
-
---echo #
---echo # End of 10.0 tests
---echo #
-
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-6990 GROUP_MIN_MAX optimization is not applied in some cases when it could
---echo #
-CREATE TABLE t1 (id INT NOT NULL, a DATE, KEY(id,a)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,'2001-01-01');
-INSERT INTO t1 VALUES (1,'2001-01-02');
-INSERT INTO t1 VALUES (1,'2001-01-03');
-INSERT INTO t1 VALUES (1,'2001-01-04');
-INSERT INTO t1 VALUES (2,'2001-01-01');
-INSERT INTO t1 VALUES (2,'2001-01-02');
-INSERT INTO t1 VALUES (2,'2001-01-03');
-INSERT INTO t1 VALUES (2,'2001-01-04');
-INSERT INTO t1 VALUES (3,'2001-01-01');
-INSERT INTO t1 VALUES (3,'2001-01-02');
-INSERT INTO t1 VALUES (3,'2001-01-03');
-INSERT INTO t1 VALUES (3,'2001-01-04');
-INSERT INTO t1 VALUES (4,'2001-01-01');
-INSERT INTO t1 VALUES (4,'2001-01-02');
-INSERT INTO t1 VALUES (4,'2001-01-03');
-INSERT INTO t1 VALUES (4,'2001-01-04');
-EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>='2001-01-04' GROUP BY id;
-EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=20010104.0 GROUP BY id;
-EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=20010104e0 GROUP BY id;
-SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>='2001-01-04' GROUP BY id;
-SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=20010104.0 GROUP BY id;
-SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=20010104e0 GROUP BY id;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8229 GROUP_MIN_MAX is erroneously applied for BETWEEN in some cases
---echo #
-SET NAMES latin1;
-CREATE TABLE t1 (id INT NOT NULL, a VARCHAR(20)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,'2001-01-01');
-INSERT INTO t1 VALUES (1,'2001-01-02');
-INSERT INTO t1 VALUES (1,'2001-01-03');
-INSERT INTO t1 VALUES (1,' 2001-01-04');
-INSERT INTO t1 VALUES (2,'2001-01-01');
-INSERT INTO t1 VALUES (2,'2001-01-02');
-INSERT INTO t1 VALUES (2,'2001-01-03');
-INSERT INTO t1 VALUES (2,' 2001-01-04');
-INSERT INTO t1 VALUES (3,'2001-01-01');
-INSERT INTO t1 VALUES (3,'2001-01-02');
-INSERT INTO t1 VALUES (3,'2001-01-03');
-INSERT INTO t1 VALUES (3,' 2001-01-04');
-INSERT INTO t1 VALUES (4,'2001-01-01');
-INSERT INTO t1 VALUES (4,'2001-01-02');
-INSERT INTO t1 VALUES (4,'2001-01-03');
-INSERT INTO t1 VALUES (4,' 2001-01-04');
-SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN ' 2001-01-04' AND '2001-01-05' GROUP BY id;
-SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN '2001-01-04' AND '2001-01-05' GROUP BY id;
-SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN DATE'2001-01-04' AND DATE'2001-01-05' GROUP BY id;
-SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN DATE'2001-01-04' AND '2001-01-05' GROUP BY id;
-SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN '2001-01-04' AND DATE'2001-01-05' GROUP BY id;
-ALTER TABLE t1 ADD KEY(id,a);
-SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN ' 2001-01-04' AND '2001-01-05' GROUP BY id;
-SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN '2001-01-04' AND '2001-01-05' GROUP BY id;
-SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN DATE'2001-01-04' AND DATE'2001-01-05' GROUP BY id;
-SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN DATE'2001-01-04' AND '2001-01-05' GROUP BY id;
-SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN '2001-01-04' AND DATE'2001-01-05' GROUP BY id;
-EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN ' 2001-01-04' AND '2001-01-05' GROUP BY id;
-EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN '2001-01-04' AND '2001-01-05' GROUP BY id;
-EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN DATE'2001-01-04' AND DATE'2001-01-05' GROUP BY id;
-EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN DATE'2001-01-04' AND '2001-01-05' GROUP BY id;
-EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN '2001-01-04' AND DATE'2001-01-05' GROUP BY id;
-DROP TABLE t1;
-
---echo #
---echo # MIN() optimization didn't work correctly with BETWEEN when using too
---echo # long strings.
---echo #
-
-create table t1 (a varchar(10), key (a)) engine=myisam;
-insert into t1 values("bar"),("Cafe");
-explain select min(a) from t1 where a between "a" and "Cafe2";
-explain select min(a) from t1 where a between "a" and "Cafeeeeeeeeeeeeeeeeeeeeeeeeee";
-explain select min(a) from t1 where a between "abbbbbbbbbbbbbbbbbbbb" and "Cafe2";
-drop table t1;
-
---echo #
---echo # End of 10.1 tests
---echo #
diff --git a/mysql-test/t/group_min_max_innodb.test b/mysql-test/t/group_min_max_innodb.test
deleted file mode 100644
index 91e0bd3279f..00000000000
--- a/mysql-test/t/group_min_max_innodb.test
+++ /dev/null
@@ -1,245 +0,0 @@
-#
-# Test file for WL#1724 (Min/Max Optimization for Queries with Group By Clause).
-# The queries in this file test query execution via QUICK_GROUP_MIN_MAX_SELECT
-# that depends on InnoDB
-#
-
---source include/have_innodb.inc
-
---disable_warnings
-drop view if exists v1;
-drop table if exists t1,t4;
---enable_warnings
-
-#
-# Bug #12672: primary key implcitly included in every innodb index
-#
-
---disable_warnings
-create table t4 (
- pk_col int auto_increment primary key, a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
-) engine=innodb;
---enable_warnings
-
-insert into t4 (a1, a2, b, c, d) values
-('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
-('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
-('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
-('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
-('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
-('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
-('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
-('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
-('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
-('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
-('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
-('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
-('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
-('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
-('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
-('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4'),
-('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
-('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
-('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
-('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
-('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
-('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
-('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
-('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
-('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
-('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
-('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
-('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
-('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
-('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
-('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
-('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4');
-
-create index idx12672_0 on t4 (a1);
-create index idx12672_1 on t4 (a1,a2,b,c);
-create index idx12672_2 on t4 (a1,a2,b);
-analyze table t4;
-
-select distinct a1 from t4 where pk_col not in (1,2,3,4);
-
-drop table t4;
-
-
-#
-# Bug #6142: a problem with the empty innodb table
-#
-
---disable_warnings
-create table t1 (
- a varchar(30), b varchar(30), primary key(a), key(b)
-) engine=innodb;
---enable_warnings
-select distinct a from t1;
-drop table t1;
-
-#
-# Bug #9798: group by with rollup
-#
-
---disable_warnings
-create table t1(a int, key(a)) engine=innodb;
---enable_warnings
-insert into t1 values(1);
-select a, count(a) from t1 group by a with rollup;
-drop table t1;
-
-
-#
-# Bug #13293 Wrongly used index results in endless loop.
-#
-create table t1 (f1 int, f2 char(1), primary key(f1,f2)) engine=innodb;
-insert into t1 values ( 1,"e"),(2,"a"),( 3,"c"),(4,"d");
-alter table t1 drop primary key, add primary key (f2, f1);
-explain select distinct f1 a, f1 b from t1;
-explain select distinct f1, f2 from t1;
-drop table t1;
-
-
-#
-# Bug #36632: Select distinct from a simple view on an InnoDB table
-# returns incorrect results
-#
-create table t1(pk int primary key) engine=innodb;
-create view v1 as select pk from t1 where pk < 20;
-
-insert into t1 values (1), (2), (3), (4);
-select distinct pk from v1;
-
-insert into t1 values (5), (6), (7);
-select distinct pk from v1;
-
-drop view v1;
-drop table t1;
-
---echo End of 5.1 tests
-
---echo #
---echo # Bug#12540545 61101: ASSERTION FAILURE IN THREAD 1256741184 IN
---echo # FILE /BUILDDIR/BUILD/BUILD/MYSQ
---echo #
-
-CREATE TABLE t1 (a CHAR(1), b CHAR(1), PRIMARY KEY (a,b)) ENGINE=InnoDB;
-INSERT INTO t1 VALUES ('a', 'b'), ('c', 'd');
-EXPLAIN SELECT COUNT(DISTINCT a) FROM t1 WHERE b = 'b';
-SELECT COUNT(DISTINCT a) FROM t1 WHERE b = 'b';
-DROP TABLE t1;
-
-CREATE TABLE t1 (a CHAR(1) NOT NULL, b CHAR(1) NOT NULL, UNIQUE KEY (a,b))
-ENGINE=InnoDB;
-INSERT INTO t1 VALUES ('a', 'b'), ('c', 'd');
-EXPLAIN SELECT COUNT(DISTINCT a) FROM t1 WHERE b = 'b';
-SELECT COUNT(DISTINCT a) FROM t1 WHERE b = 'b';
-DROP TABLE t1;
-
---echo End of 5.5 tests
-
---echo #
---echo # Bug#17909656 - WRONG RESULTS FOR A SIMPLE QUERY WITH GROUP BY
---echo #
-
-CREATE TABLE t0 (
- i1 INTEGER NOT NULL
-);
-
-INSERT INTO t0 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),
- (11),(12),(13),(14),(15),(16),(17),(18),(19),(20),
- (21),(22),(23),(24),(25),(26),(27),(28),(29),(30);
-
-CREATE TABLE t1 (
- c1 CHAR(1) NOT NULL,
- i1 INTEGER NOT NULL,
- i2 INTEGER NOT NULL,
- UNIQUE KEY k1 (c1,i2)
-) ENGINE=InnoDB;
-
-INSERT INTO t1 SELECT 'A',i1,i1 FROM t0;
-INSERT INTO t1 SELECT 'B',i1,i1 FROM t0;
-INSERT INTO t1 SELECT 'C',i1,i1 FROM t0;
-INSERT INTO t1 SELECT 'D',i1,i1 FROM t0;
-INSERT INTO t1 SELECT 'E',i1,i1 FROM t0;
-INSERT INTO t1 SELECT 'F',i1,i1 FROM t0;
-
-CREATE TABLE t2 (
- c1 CHAR(1) NOT NULL,
- i1 INTEGER NOT NULL,
- i2 INTEGER NOT NULL,
- UNIQUE KEY k2 (c1,i1,i2)
-) ENGINE=InnoDB;
-
-INSERT INTO t2 SELECT 'A',i1,i1 FROM t0;
-INSERT INTO t2 SELECT 'B',i1,i1 FROM t0;
-INSERT INTO t2 SELECT 'C',i1,i1 FROM t0;
-INSERT INTO t2 SELECT 'D',i1,i1 FROM t0;
-INSERT INTO t2 SELECT 'E',i1,i1 FROM t0;
-INSERT INTO t2 SELECT 'F',i1,i1 FROM t0;
-
--- disable_result_log
-ANALYZE TABLE t1;
-ANALYZE TABLE t2;
--- enable_result_log
-
-let query=
-SELECT c1, max(i2) FROM t1 WHERE (c1 = 'C' AND i2 = 17) OR ( c1 = 'F')
-GROUP BY c1;
-eval EXPLAIN $query;
-eval $query;
-
-let query=
-SELECT c1, max(i2) FROM t1 WHERE (c1 = 'C' OR ( c1 = 'F' AND i2 = 17))
-GROUP BY c1;
-eval EXPLAIN $query;
-eval $query;
-
-let query=
-SELECT c1, max(i2) FROM t1 WHERE (c1 = 'C' OR c1 = 'F' ) AND ( i2 = 17 )
-GROUP BY c1;
-eval EXPLAIN $query;
-eval $query;
-
-let query=
-SELECT c1, max(i2) FROM t1
-WHERE ((c1 = 'C' AND (i2 = 40 OR i2 = 30)) OR ( c1 = 'F' AND (i2 = 40 )))
-GROUP BY c1;
-eval EXPLAIN $query;
-eval $query;
-
-let query=
-SELECT c1, i1, max(i2) FROM t2
-WHERE (c1 = 'C' OR ( c1 = 'F' AND i1 < 35)) AND ( i2 = 17 )
-GROUP BY c1,i1;
-eval EXPLAIN $query;
-eval $query;
-
-let query=
-SELECT c1, i1, max(i2) FROM t2
-WHERE (((c1 = 'C' AND i1 < 40) OR ( c1 = 'F' AND i1 < 35)) AND ( i2 = 17 ))
-GROUP BY c1,i1;
-eval EXPLAIN $query;
-eval $query;
-
-let query=
-SELECT c1, i1, max(i2) FROM t2
-WHERE ((c1 = 'C' AND i1 < 40) OR ( c1 = 'F' AND i1 < 35) OR ( i2 = 17 ))
-GROUP BY c1,i1;
-eval EXPLAIN $query;
-eval $query;
-
-DROP TABLE t0,t1,t2;
-
---echo #
---echo # MDEV-MariaDB daemon leaks memory with specific query
---echo #
-
-CREATE TABLE t1 (`voter_id` int(11) unsigned NOT NULL,
- `language_id` int(11) unsigned NOT NULL DEFAULT '1'
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-CREATE TABLE t2 (`voter_id` int(10) unsigned NOT NULL DEFAULT '0',
- `serialized_c` mediumblob) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-insert into t2 values (1,repeat("a",1000)),(2,repeat("a",1000)),(3,repeat("b",1000)),(4,repeat("c",1000)),(4,repeat("b",1000));
-SELECT GROUP_CONCAT(t1.language_id SEPARATOR ',') AS `translation_resources`, `d`.`serialized_c` FROM t2 AS `d` LEFT JOIN t1 ON `d`.`voter_id` = t1.`voter_id` GROUP BY `d`.`voter_id` ORDER BY 10-d.voter_id+RAND()*0;
-drop table t1,t2;
diff --git a/mysql-test/t/handler_read_last.test b/mysql-test/t/handler_read_last.test
deleted file mode 100644
index 9104be78952..00000000000
--- a/mysql-test/t/handler_read_last.test
+++ /dev/null
@@ -1,25 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (a INT, INDEX (a));
-INSERT INTO t1 VALUES (),(),(),(),(),(),(),(),(),();
-
-FLUSH STATUS;
-SELECT a FROM t1 ORDER BY a LIMIT 1;
-SHOW STATUS LIKE 'HANDLER_READ%';
-
-FLUSH STATUS;
-SELECT a FROM t1 ORDER BY a DESC LIMIT 1;
-SHOW STATUS LIKE 'HANDLER_READ%';
-
-FLUSH STATUS;
-SELECT a FROM t1 ORDER BY a LIMIT 3;
-SHOW STATUS LIKE 'HANDLER_READ%';
-
-FLUSH STATUS;
-SELECT a FROM t1 ORDER BY a DESC LIMIT 3;
-SHOW STATUS LIKE 'HANDLER_READ%';
-
-DROP TABLE t1;
-
diff --git a/mysql-test/t/handlersocket.test b/mysql-test/t/handlersocket.test
deleted file mode 100644
index 10cb9728fb7..00000000000
--- a/mysql-test/t/handlersocket.test
+++ /dev/null
@@ -1,10 +0,0 @@
---source include/not_windows_embedded.inc
-
-if (`select length('$HANDLERSOCKET_SO') = 0`) {
- skip handlersocket plugin is not built;
-}
-
-install plugin handlersocket soname 'handlersocket.so';
---query_vertical select plugin_name, plugin_version, plugin_status, plugin_type, plugin_library, plugin_library_version, plugin_author, plugin_description, plugin_license, plugin_maturity, plugin_auth_version from information_schema.plugins where plugin_name = 'handlersocket'
-uninstall plugin handlersocket;
-
diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test
deleted file mode 100644
index c9231fef3be..00000000000
--- a/mysql-test/t/having.test
+++ /dev/null
@@ -1,875 +0,0 @@
-# test of problems with having (Reported by Mark Rogers)
-#
-
---disable_warnings
-drop table if exists t1,t2,t3;
---enable_warnings
-
-create table t1 (a int);
-select count(a) as b from t1 where a=0 having b > 0;
-insert into t1 values (null);
-select count(a) as b from t1 where a=0 having b > 0;
-select count(a) as b from t1 where a=0 having b >=0;
-explain extended select count(a) as b from t1 where a=0 having b >=0;
-drop table t1;
-
-#
-# Test of problem with HAVING and AVG()
-#
-
-CREATE TABLE t1 (
- raw_id int(10) NOT NULL default '0',
- chr_start int(10) NOT NULL default '0',
- chr_end int(10) NOT NULL default '0',
- raw_start int(10) NOT NULL default '0',
- raw_end int(10) NOT NULL default '0',
- raw_ori int(2) NOT NULL default '0'
-);
-
-INSERT INTO t1 VALUES (469713,1,164123,1,164123,1),(317330,164124,317193,101,153170,1),(469434,317194,375620,101,58527,1),(591816,375621,484273,1,108653,1),(591807,484274,534671,91,50488,1),(318885,534672,649362,101,114791,1),(318728,649363,775520,102,126259,1),(336829,775521,813997,101,38577,1),(317740,813998,953227,101,139330,1),(1,813998,953227,101,139330,1);
-
-CREATE TABLE t2 (
- id int(10) unsigned NOT NULL default '0',
- contig_id int(10) unsigned NOT NULL default '0',
- seq_start int(10) NOT NULL default '0',
- seq_end int(10) NOT NULL default '0',
- strand tinyint(2) NOT NULL default '0',
- KEY id (id)
-);
-INSERT INTO t2 VALUES (133195,469713,61327,61384,1),(133196,469713,64113,64387,1),(133197,1,1,1,0),(133197,1,1,1,-2);
-SELECT e.id,
- MIN( IF(sgp.raw_ori=1,
- (e.seq_start+sgp.chr_start-sgp.raw_start),
- (sgp.chr_start+sgp.raw_end-e.seq_end))) as start,
- MAX( IF(sgp.raw_ori=1,
- (e.seq_end+sgp.chr_start-sgp.raw_start),
- (sgp.chr_start+sgp.raw_end-e.seq_start))) as end,
- AVG(IF (sgp.raw_ori=1,e.strand,(-e.strand))) as chr_strand
-FROM t1 sgp,
- t2 e
-WHERE sgp.raw_id=e.contig_id
-GROUP BY e.id
-HAVING chr_strand= -1 and end >= 0
- AND start <= 999660;
-drop table t1,t2;
-
-#
-# Test problem with having and MAX() IS NOT NULL
-#
-
-CREATE TABLE t1 (Fld1 int(11) default NULL,Fld2 int(11) default NULL);
-INSERT INTO t1 VALUES (1,10),(1,20),(2,NULL),(2,NULL),(3,50);
-select Fld1, max(Fld2) as q from t1 group by Fld1 having q is not null;
-select Fld1, max(Fld2) from t1 group by Fld1 having max(Fld2) is not null;
-select Fld1, max(Fld2) from t1 group by Fld1 having avg(Fld2) is not null;
-select Fld1, max(Fld2) from t1 group by Fld1 having std(Fld2) is not null;
-select Fld1, max(Fld2) from t1 group by Fld1 having variance(Fld2) is not null;
-drop table t1;
-
-#
-# Test problem with count(distinct) in having
-#
-create table t1 (id int not null, qty int not null);
-insert into t1 values (1,2),(1,3),(2,4),(2,5);
-select id, sum(qty) as sqty from t1 group by id having sqty>2;
-select sum(qty) as sqty from t1 group by id having count(id) > 0;
-select sum(qty) as sqty from t1 group by id having count(distinct id) > 0;
-drop table t1;
-
-#
-# Test case for Bug #4358 Problem with HAVING clause that uses alias from the
-# select list and TEXT field
-#
-
-CREATE TABLE t1 (
- `id` bigint(20) NOT NULL default '0',
- `description` text
-) ENGINE=MyISAM;
-
-CREATE TABLE t2 (
- `id` bigint(20) NOT NULL default '0',
- `description` varchar(20)
-) ENGINE=MyISAM;
-
-INSERT INTO t1 VALUES (1, 'test');
-INSERT INTO t2 VALUES (1, 'test');
-
-CREATE TABLE t3 (
- `id` bigint(20) NOT NULL default '0',
- `order_id` bigint(20) NOT NULL default '0'
-) ENGINE=MyISAM;
-
-select
- a.id, a.description,
- count(b.id) as c
-from t1 a left join t3 b on a.id=b.order_id
-group by a.id, a.description
-having (a.description is not null) and (c=0);
-
-select
- a.*,
- count(b.id) as c
-from t2 a left join t3 b on a.id=b.order_id
-group by a.id, a.description
-having (a.description is not null) and (c=0);
-
-INSERT INTO t1 VALUES (2, 'test2');
-
-select
- a.id, a.description,
- count(b.id) as c
-from t1 a left join t3 b on a.id=b.order_id
-group by a.id, a.description
-having (a.description is not null) and (c=0);
-drop table t1,t2,t3;
-
-#
-# Bug #14274: HAVING clause containing only set function
-#
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (3), (4), (1), (3), (1);
-
-SELECT SUM(a) FROM t1 GROUP BY a HAVING SUM(a)>0;
-SELECT SUM(a) FROM t1 GROUP BY a HAVING SUM(a);
-
-DROP TABLE t1;
-
-#
-# Bug #14927: HAVING clause containing constant false conjunct
-#
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (1), (2), (1), (3), (2), (1);
-
-SELECT a FROM t1 GROUP BY a HAVING a > 1;
-SELECT a FROM t1 GROUP BY a HAVING 1 != 1 AND a > 1;
-SELECT 0 AS x, a FROM t1 GROUP BY x,a HAVING x=1 AND a > 1;
-
-EXPLAIN SELECT a FROM t1 GROUP BY a HAVING 1 != 1 AND a > 1;
-EXPLAIN SELECT 0 AS x, a FROM t1 GROUP BY x,a HAVING x=1 AND a > 1;
-
-DROP table t1;
-
-#
-# Bug #29911: HAVING clause depending on constant table and evaluated to false
-#
-
-CREATE TABLE t1 (a int PRIMARY KEY);
-CREATE TABLE t2 (b int PRIMARY KEY, a int);
-CREATE TABLE t3 (b int, flag int);
-
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (1,1), (2,1), (3,1);
-INSERT INTO t3(b,flag) VALUES (2, 1);
-
-SELECT t1.a
- FROM t1 INNER JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b
- GROUP BY t1.a, t2.b HAVING MAX(t3.flag)=0;
-
-SELECT DISTINCT t1.a, MAX(t3.flag)
- FROM t1 INNER JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b
- GROUP BY t1.a, t2.b HAVING MAX(t3.flag)=0;
-
-SELECT DISTINCT t1.a
- FROM t1 INNER JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b
- GROUP BY t1.a, t2.b HAVING MAX(t3.flag)=0;
-
-DROP TABLE t1,t2,t3;
-
-# End of 4.1 tests
-
-#
-# Tests for WL#1972 CORRECT EVALUATION OF COLUMN REFERENCES IN THE HAVING CLAUSE
-# Per the SAP VERI tests and WL#1972, MySQL must ensure that HAVING can
-# correctly evaluate column references from the GROUP BY clause, even if the
-# same references are not also found in the select list.
-#
-
-# set global sql_mode='ansi';
-# set session sql_mode='ansi';
-
-create table t1 (col1 int, col2 varchar(5), col_t1 int);
-create table t2 (col1 int, col2 varchar(5), col_t2 int);
-create table t3 (col1 int, col2 varchar(5), col_t3 int);
-
-insert into t1 values(10,'hello',10);
-insert into t1 values(20,'hello',20);
-insert into t1 values(30,'hello',30);
-insert into t1 values(10,'bye',10);
-insert into t1 values(10,'sam',10);
-insert into t1 values(10,'bob',10);
-
-insert into t2 select * from t1;
-insert into t3 select * from t1;
-
-select count(*) from t1 group by col1 having col1 = 10;
-select count(*) as count_col1 from t1 group by col1 having col1 = 10;
-select count(*) as count_col1 from t1 as tmp1 group by col1 having col1 = 10;
-select count(*) from t1 group by col2 having col2 = 'hello';
---error 1054
-select count(*) from t1 group by col2 having col1 = 10;
-select col1 as count_col1 from t1 as tmp1 group by col1 having col1 = 10;
-select col1 as count_col1 from t1 as tmp1 group by col1 having count_col1 = 10;
-select col1 as count_col1 from t1 as tmp1 group by count_col1 having col1 = 10;
-# ANSI: should return SQLSTATE 42000 Syntax error or access violation
-# MySQL: returns 10 - because of GROUP BY name resolution
-select col1 as count_col1 from t1 as tmp1 group by count_col1 having count_col1 = 10;
-# ANSI: should return SQLSTATE 42000 Syntax error or access violation
-# MySQL: returns 10 - because of GROUP BY name resolution
-select col1 as count_col1,col2 from t1 as tmp1 group by col1,col2 having col1 = 10;
-select col1 as count_col1,col2 from t1 as tmp1 group by col1,col2 having count_col1 = 10;
-select col1 as count_col1,col2 from t1 as tmp1 group by col1,col2 having col2 = 'hello';
-select col1 as count_col1,col2 as group_col2 from t1 as tmp1 group by col1,col2 having group_col2 = 'hello';
---error 1064
-select sum(col1) as co12 from t1 group by col2 having col2 10;
-select sum(col1) as co2, count(col2) as cc from t1 group by col1 having col1 =10;
---error 1054
-select t2.col2 from t2 group by t2.col1, t2.col2 having t1.col1 <= 10;
-
-
-#
-# queries with nested sub-queries
-#
-
-# the having column is resolved in the same query
-select t1.col1 from t1
-where t1.col2 in
- (select t2.col2 from t2
- group by t2.col1, t2.col2 having t2.col1 <= 10);
-
-select t1.col1 from t1
-where t1.col2 in
- (select t2.col2 from t2
- group by t2.col1, t2.col2
- having t2.col1 <=
- (select min(t3.col1) from t3));
-
-# the having column is resolved in the SELECT clause of the outer query -
-# works in ANSI
-select t1.col1 from t1
-where t1.col2 in
- (select t2.col2 from t2
- group by t2.col1, t2.col2 having t1.col1 <= 10);
-
-# the having column is resolved in the SELECT clause of the outer query -
-# error in ANSI, works with MySQL extension
-select t1.col1 as tmp_col from t1
-where t1.col2 in
- (select t2.col2 from t2
- group by t2.col1, t2.col2 having tmp_col <= 10);
-
-# the having column is resolved in the FROM clause of the outer query -
-# works in ANSI
-select t1.col1 from t1
-where t1.col2 in
- (select t2.col2 from t2
- group by t2.col1, t2.col2 having col_t1 <= 10);
-
-# Item_field must be resolved in the same way as Item_ref
-select sum(col1) from t1
-group by col_t1
-having (select col_t1 from t2 where col_t1 = col_t2 order by col_t2 limit 1);
-
-# nested queries with HAVING, inner having column resolved in outer FROM clause
-# the outer having column is not referenced in GROUP BY which results in an error
---error 1054
-select t1.col1 from t1
-where t1.col2 in
- (select t2.col2 from t2
- group by t2.col1, t2.col2 having col_t1 <= 10)
-having col_t1 <= 20;
-
-# both having columns are resolved in the GROUP clause of the outer query
-select t1.col1 from t1
-where t1.col2 in
- (select t2.col2 from t2
- group by t2.col1, t2.col2 having col_t1 <= 10)
-group by col_t1
-having col_t1 <= 20;
-
-#
-# nested HAVING clauses
-#
-
-# non-correlated subqueries
-select col_t1, sum(col1) from t1
-group by col_t1
-having col_t1 > 10 and
- exists (select sum(t2.col1) from t2
- group by t2.col2 having t2.col2 > 'b');
-
-# correlated subqueries - inner having column 't1.col2' resolves to
-# the outer FROM clause, which cannot be used because the outer query
-# is grouped
---error 1054
-select sum(col1) from t1
-group by col_t1
-having col_t1 in (select sum(t2.col1) from t2
- group by t2.col2, t2.col1 having t2.col1 = t1.col1);
-
-# correlated subqueries - inner having column 'col_t1' resolves to
-# the outer GROUP clause
-select sum(col1) from t1
-group by col_t1
-having col_t1 in (select sum(t2.col1) from t2
- group by t2.col2, t2.col1 having t2.col1 = col_t1);
-
-#
-# queries with joins and ambiguous column names
-#
---error 1052
-select t1.col1, t2.col1 from t1, t2 where t1.col1 = t2.col1
-group by t1.col1, t2.col1 having col1 = 2;
-
---error 1052
-select t1.col1*10+t2.col1 from t1,t2 where t1.col1=t2.col1
-group by t1.col1, t2.col1 having col1 = 2;
-
-drop table t1, t2, t3;
-
-# More queries to test ANSI compatibility
-create table t1 (s1 int);
-insert into t1 values (1),(2),(3);
-
-select count(*) from t1 group by s1 having s1 is null;
-
-# prepared statements prints warnings too early
---disable_ps_protocol
-select s1*0 as s1 from t1 group by s1 having s1 <> 0;
---enable_ps_protocol
-
-# ANSI requires: 3 rows
-# MySQL returns: 0 rows - because of GROUP BY name resolution
-
-select s1*0 from t1 group by s1 having s1 = 0;
-
-select s1 from t1 group by 1 having 1 = 0;
-
-select count(s1) from t1 group by s1 having count(1+1)=2;
-# ANSI requires: 3 rows
-# MySQL returns: 0 rows - because of GROUP BY name resolution
-
-select count(s1) from t1 group by s1 having s1*0=0;
-
--- error 1052
-select * from t1 a, t1 b group by a.s1 having s1 is null;
-# ANSI requires: 0 rows
-# MySQL returns:
-# "ERROR 1052 (23000): Column 's1' in having clause is ambiguous"
-# I think the column is ambiguous in ANSI too.
-# It is the same as:
-# select a.s1, b.s1 from t1 a, t1 b group by a.s1 having s1 is null;
-# currently we first check SELECT, thus s1 is ambiguous.
-
-drop table t1;
-
-create table t1 (s1 char character set latin1 collate latin1_german1_ci);
-insert ignore into t1 values ('ü'),('y');
-
-select s1,count(s1) from t1
-group by s1 collate latin1_swedish_ci having s1 = 'y';
-# ANSI requires: 1 row, with count(s1) = 2
-# MySQL returns: 1 row, with count(s1) = 1
-
-drop table t1;
-
-
-#
-# Bug #15917: unexpected complain for a name in having clause
-# when the server is run on Windows or with --lower-case-table-names=1
-#
-
---disable_warnings
-DROP SCHEMA IF EXISTS HU;
---enable_warnings
-CREATE SCHEMA HU ;
-USE HU ;
-
-CREATE TABLE STAFF
- (EMPNUM CHAR(3) NOT NULL UNIQUE,
- EMPNAME CHAR(20),
- GRADE DECIMAL(4),
- CITY CHAR(15));
-
-CREATE TABLE PROJ
- (PNUM CHAR(3) NOT NULL UNIQUE,
- PNAME CHAR(20),
- PTYPE CHAR(6),
- BUDGET DECIMAL(9),
- CITY CHAR(15));
-
-INSERT INTO STAFF VALUES ('E1','Alice',12,'Deale');
-INSERT INTO STAFF VALUES ('E2','Betty',10,'Vienna');
-INSERT INTO STAFF VALUES ('E3','Carmen',13,'Vienna');
-INSERT INTO STAFF VALUES ('E4','Don',12,'Deale');
-INSERT INTO STAFF VALUES ('E5','Ed',13,'Akron');
-
-INSERT INTO PROJ VALUES ('P1','MXSS','Design',10000,'Deale');
-INSERT INTO PROJ VALUES ('P2','CALM','Code',30000,'Vienna');
-INSERT INTO PROJ VALUES ('P3','SDP','Test',30000,'Tampa');
-INSERT INTO PROJ VALUES ('P4','SDP','Design',20000,'Deale');
-INSERT INTO PROJ VALUES ('P5','IRM','Test',10000,'Vienna');
-INSERT INTO PROJ VALUES ('P6','PAYR','Design',50000,'Deale');
-
-SELECT EMPNUM, GRADE*1000
- FROM HU.STAFF WHERE GRADE * 1000 >
- ANY (SELECT SUM(BUDGET) FROM HU.PROJ
- GROUP BY CITY, PTYPE
- HAVING HU.PROJ.CITY = HU.STAFF.CITY);
-
-DROP SCHEMA HU;
-USE test;
-#
-# Bug#18739: non-standard HAVING extension was allowed in strict ANSI sql mode.
-#
-create table t1(f1 int);
-select f1 from t1 having max(f1)=f1;
-select f1 from t1 group by f1 having max(f1)=f1;
-set session sql_mode='ONLY_FULL_GROUP_BY';
---error ER_NON_GROUPING_FIELD_USED
-select f1 from t1 having max(f1)=f1;
-select f1 from t1 group by f1 having max(f1)=f1;
-set session sql_mode='';
-drop table t1;
-
-
-#
-# Bug #38637: COUNT DISTINCT prevents NULL testing in HAVING clause
-#
-CREATE TABLE t1 ( a INT, b INT);
-INSERT INTO t1 VALUES (1, 1), (2,2), (3, NULL);
-SELECT b, COUNT(DISTINCT a) FROM t1 GROUP BY b HAVING b is NULL;
-DROP TABLE t1;
-
-
---echo #
---echo # Bug#50995 Having clause on subquery result produces incorrect results.
---echo #
-
-CREATE TABLE t1
-(
- id1 INT,
- id2 INT NOT NULL,
- INDEX id1(id2)
-);
-
-INSERT INTO t1 SET id1=1, id2=1;
-INSERT INTO t1 SET id1=2, id2=1;
-INSERT INTO t1 SET id1=3, id2=1;
-
-SELECT t1.id1,
-(SELECT 0 FROM DUAL
- WHERE t1.id1=t1.id1) AS amount FROM t1
-WHERE t1.id2 = 1
-HAVING amount > 0
-ORDER BY t1.id1;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug#48916 Server incorrectly processing HAVING clauses with an ORDER BY clause
---echo #
-CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT, f3 INT);
-INSERT INTO t1 VALUES (2,7,9), (4,7,9), (6,2,9), (17,0,9);
-
-SELECT table1.f1, table2.f2
-FROM t1 AS table1
-JOIN t1 AS table2 ON table1.f3 = table2.f3
-WHERE table2.f1 = 2
-GROUP BY table1.f1, table2.f2
-HAVING (table2.f2 = 8 AND table1.f1 >= 6);
-
-EXPLAIN EXTENDED
-SELECT table1.f1, table2.f2
-FROM t1 AS table1
-JOIN t1 AS table2 ON table1.f3 = table2.f3
-WHERE table2.f1 = 2
-GROUP BY table1.f1, table2.f2
-HAVING (table2.f2 = 8 AND table1.f1 >= 6);
-
-EXPLAIN EXTENDED
-SELECT table1.f1, table2.f2
-FROM t1 AS table1
-JOIN t1 AS table2 ON table1.f3 = table2.f3
-WHERE table2.f1 = 2
-GROUP BY table1.f1, table2.f2
-HAVING (table2.f2 = 8);
-
-DROP TABLE t1;
-
---echo #
---echo # Bug#52336 Segfault / crash in 5.1 copy_fields (param=0x9872980) at sql_select.cc:15355
---echo #
-CREATE TABLE t1(f1 INT, f2 INT);
-INSERT INTO t1 VALUES (10,8);
-CREATE TABLE t2 (f1 INT);
-INSERT INTO t2 VALUES (5);
-
-SELECT COUNT(f1) FROM t2
-HAVING (7, 9) IN (SELECT f1, MIN(f2) FROM t1);
-
-DROP TABLE t1, t2;
-
-CREATE TABLE t1 (f1 INT, f2 VARCHAR(1));
-INSERT INTO t1 VALUES (16,'f');
-INSERT INTO t1 VALUES (16,'f');
-CREATE TABLE t2 (f1 INT, f2 VARCHAR(1));
-INSERT INTO t2 VALUES (13,'f');
-INSERT INTO t2 VALUES (20,'f');
-CREATE TABLE t3 (f1 INT, f2 VARCHAR(1));
-INSERT INTO t3 VALUES (7,'f');
-
-SELECT t1.f2 FROM t1
-STRAIGHT_JOIN (t2 JOIN t3 ON t3.f2 = t2.f2 ) ON t3 .f2 = t2 .f2
-HAVING ('v', 'i') NOT IN (SELECT f2, MIN(f2) FROM t1)
-ORDER BY f2;
-
-DROP TABLES t1,t2,t3;
-
---echo #
---echo # Bug#52340 Segfault: read_cached_record (tab=0x94a2634) at sql_select.cc:14411
---echo #
-CREATE TABLE t1 (f1 INT, f2 VARCHAR(1));
-INSERT INTO t1 VALUES (16,'d');
-CREATE TABLE t2 (f1 INT, f2 VARCHAR(1));
-INSERT INTO t2 VALUES (13,'e');
-INSERT INTO t2 VALUES (20,'d');
-
-SELECT MAX(t2.f2) FROM t2 JOIN t1 ON t1.f2
-HAVING ('e' , 'd') IN
-(SELECT ts1.f2, ts2.f2 FROM t2 ts1 JOIN t2 ts2 ON ts1.f1)
-ORDER BY t1.f2;
-
-DROP TABLE t1,t2;
-
---echo End of 5.0 tests
-
---echo #
---echo # Bug#54416 MAX from JOIN with HAVING returning NULL with 5.1 and Empty set
---echo #
-
-CREATE TABLE t1 (f1 INT(11), f2 VARCHAR(1), PRIMARY KEY (f1));
-INSERT INTO t1 VALUES (1,'f');
-
-CREATE TABLE t2 (f1 INT(11), f2 VARCHAR(1));
-INSERT INTO t2 VALUES (2,'m');
-INSERT INTO t2 VALUES (3,'m');
-INSERT INTO t2 VALUES (11,NULL);
-INSERT INTO t2 VALUES (12,'k');
-
-SELECT MAX(t1.f1) field1
-FROM t1 JOIN t2 ON t2.f2 LIKE 'x'
-HAVING field1 < 7;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug#48916 Server incorrectly processing HAVING clauses with an ORDER BY clause
---echo #
-
-CREATE TABLE t1 (f1 INT, f2 INT);
-INSERT INTO t1 VALUES (1, 0), (2, 1), (3, 2);
-CREATE TABLE t2 (f1 INT, f2 INT);
-
-SELECT t1.f1
-FROM t1
-HAVING (3, 2) IN (SELECT f1, f2 FROM t2) AND t1.f1 >= 0
-ORDER BY t1.f1;
-
-SELECT t1.f1
-FROM t1
-HAVING (3, 2) IN (SELECT 4, 2) AND t1.f1 >= 0
-ORDER BY t1.f1;
-
-SELECT t1.f1
-FROM t1
-HAVING 2 IN (SELECT f2 FROM t2) AND t1.f1 >= 0
-ORDER BY t1.f1;
-
-DROP TABLE t1,t2;
-
---echo End of 5.1 tests
-
---echo #
---echo # LP bug:938518 HAVING does not reject the result of aggregation
---echo #
-CREATE TABLE t1 (pk INT PRIMARY KEY, a INT);
-INSERT INTO t1 VALUES (2,7), (4,7), (6,2), (17,0);
-SELECT MIN(t.pk) FROM t1, t1 as t WHERE t1.pk = 1;
-SELECT MIN(t.pk) FROM t1, t1 as t WHERE t1.pk = 1 HAVING MIN(t.pk) < 10;
-drop table t1;
-
---echo #
---echo # LP bug #791761: MAX over an empty join + HAVING
---echo #
-
-CREATE TABLE t1 (a int, b int , KEY (b)) ;
-INSERT INTO t1 VALUES (3,1);
-
-CREATE TABLE t2 (a int NOT NULL ) ;
-INSERT INTO t2 VALUES (29);
-
-SELECT MAX(t1.b) FROM t1,t2 WHERE t2.a > 0 HAVING MAX(t1.b) <> 6;
-SELECT MAX(t1.b) FROM t1,t2 WHERE t2.a > 0 HAVING MAX(t1.b) IS NULL;
-
-EXPLAIN
-SELECT MAX(t1.b) FROM t1,t2 WHERE t2.a < 0 HAVING MAX(t1.b) <> 6;
-SELECT MAX(t1.b) FROM t1,t2 WHERE t2.a < 0 HAVING MAX(t1.b) <> 6;
-
-CREATE TABLE t3 ( f3 int) ;
-INSERT INTO t3 VALUES (NULL);
-
-SELECT MAX(t1.b) AS f FROM t1 JOIN t2 ON t2.a != 0
- WHERE (SELECT f3 FROM t3) <> 0 HAVING f <> 6 ;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # LP bug:806955 HAVING not observed with aggregate +subquery
---echo #
-
-CREATE TABLE t1 (f3 int, f10 varchar(1), f11 int, KEY (f10) );
-INSERT INTO t1 VALUES (NULL,'a',0),(8,'b',0);
-
-CREATE TABLE t2 (f2 int);
-INSERT INTO t2 VALUES (7);
-
-CREATE TABLE t3 (f3 int);
-INSERT INTO t3 VALUES (0),(8);
-
-set @save_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='semijoin=off,materialization=off';
-
-SELECT MIN( t1.f10 ) AS field1
-FROM t1 , t2
-WHERE t2.f2 IN ( SELECT f3 FROM t3 )
-HAVING field1 < 's';
-
-explain extended
-SELECT MIN( t1.f10 ) AS field1
-FROM t1 , t2
-WHERE t2.f2 IN ( SELECT f3 FROM t3 )
-HAVING field1 < 's';
-
-set optimizer_switch=@save_optimizer_switch;
-
-drop table t1,t2,t3;
-
---echo End of 5.2 tests
-
---echo #
---echo # Bug mdev-6116: an equality in the conjunction of HAVING
---echo # and IN subquery in WHERE
---echo # (The bug is caused by the same problem as bug mdev-5927)
---echo #
-
-CREATE TABLE t1 (f_key varchar(1), f_nokey varchar(1), INDEX(f_key));
-INSERT INTO t1 VALUES ('v','v'),('s','s');
-
-CREATE TABLE t2 (f_int int, f_key varchar(1), INDEX(f_key));
-INSERT INTO t2 VALUES
-(4,'j'),(6,'v'),(3,'c'),(5,'m'),(3,'d'),(2,'d'),(2,'y'),
-(9,'t'),(3,'d'),(8,'s'),(1,'r'),(8,'m'),(8,'b'),(5,'x');
-
-SELECT t2.f_int FROM t1 INNER JOIN t2 ON (t2.f_key = t1.f_nokey)
-WHERE t1.f_nokey IN (
- SELECT t1.f_key FROM t1, t2 WHERE t1.f_key = t2.f_key
-) HAVING t2.f_int >= 0 AND t2.f_int != 0;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug mdev-5927: an equality in the conjunction of HAVING
---echo # and an equality in WHERE
---echo #
-
-CREATE TABLE t1 (pk int PRIMARY KEY, f int NOT NULL, INDEX(f));
-INSERT INTO t1 VALUES (1,0), (2,8);
-
-SELECT * FROM t1 WHERE f = 2 HAVING ( pk IN ( SELECT 9 ) AND f != 0 );
-
-DROP TABLE t1;
-
---echo End of 5.3 tests
-
---echo #
---echo # Bug MDEV-7301: Unknown column quoted with backticks in HAVING clause when using function.
---echo # Bug#16221433 MYSQL REJECTS QUERY DUE TO BAD RESOLUTION OF NAMES IN HAVING; VIEW UNREADABLE
---echo #
-
-CREATE TABLE `t1` (
- `id` int(11) NOT NULL,
- `title` varchar(45) DEFAULT NULL,
- PRIMARY KEY (`id`)
-) DEFAULT CHARSET=utf8;
-
-INSERT INTO `t1` VALUES ('1', 'Just for fun');
-INSERT INTO `t1` VALUES ('2', 'Wait until a sunhine');
-INSERT INTO `t1` VALUES ('3', 'Take a new turn');
-
-SELECT `id`, SHA1(`title`) AS `column_1`
-FROM `t1`
-HAVING `column_1` LIKE '8%';
-
---echo expected 1 row(s) returned
-
-SELECT `id`, SHA1(`title`) AS `column_1`
-FROM `t1`
-HAVING UPPER(column_1) LIKE '8%';
-
---echo expected -- 1 row(s) returned
-
-SELECT `id`, SHA1(`title`) AS `column_1`
-FROM `t1`
-HAVING UPPER(`column_1`) LIKE '8%';
-
---echo expected -- 1 row(s) returned not ER_BAD_FIELD_ERROR
-
-drop table t1;
-
---echo #
---echo # mdev-14368: grouping query with alias for aggregate function in HAVING
---echo # when sql_mode = 'ONLY_FULL_GROUP_BY'
-
-
-set @save_sql_mode= @@sql_mode;
-set sql_mode = 'ONLY_FULL_GROUP_BY';
-
-create table t1(a int);
-insert t1 values (4),(1),(2),(1), (3),(4);
-
-SELECT a, COUNT(a) as ct FROM t1 GROUP BY a HAVING ct>0;
-
-set sql_mode=@save_sql_mode;
-
-drop table t1;
-
---echo #
---echo # Bug mdev-5160: two-way join with HAVING over the second table
---echo #
-
-CREATE TABLE t1 (c1 varchar(6)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('s'), ('t'), ('a'), ('x');
-
-CREATE TABLE t2 (c2 varchar(6)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES ('a'), ('x');
-
-SELECT * FROM t1 JOIN t2 ON c1 = c2 HAVING c2 > 'a' ORDER BY c2 LIMIT 1;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-6736: Valgrind warnings 'Invalid read' in subselect_engine::calc_const_tables with SQ
---echo # in WHERE and HAVING, ORDER BY, materialization+semijoin
---echo #
-
-CREATE TABLE t1 (a INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (3),(8);
-
-CREATE TABLE t2 (b INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (2),(1);
-
-SELECT a FROM t1
-WHERE 9 IN ( SELECT MIN( a ) FROM t1 )
-HAVING a <> ( SELECT COUNT(*) FROM t2 )
-ORDER BY a;
-
-DROP TABLE t1,t2;
-
---echo End of 10.0 tests
-
---echo #
---echo # MDEV-10716: Assertion `real_type() != FIELD_ITEM' failed in
---echo # Item_ref::build_equal_items(THD*, COND_EQUAL*, bool, COND_EQUAL**)
---echo #
-CREATE TABLE t1 (i INT);
-INSERT INTO t1 VALUES (1),(2);
-SELECT i, COUNT(*) FROM t1 GROUP BY i HAVING i<>0 AND 1;
-SELECT i-1 A, COUNT(*) FROM t1 GROUP BY i HAVING A AND 1;
-CREATE VIEW v1 as select i, i-1 as A from t1;
-SELECT A, COUNT(*) FROM v1 GROUP BY i HAVING A AND 1;
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo End of 10.1 tests
-
---echo #
---echo # MDEV-14093: GROUP BY with HAVING over function + ORDER BY
---echo #
-
-CREATE TABLE _authors (
- id MEDIUMINT(8) UNSIGNED AUTO_INCREMENT,
- name VARCHAR(100),
- some_field MEDIUMINT(8) UNSIGNED,
- PRIMARY KEY (id),
- index(some_field)
-);
-
-CREATE TABLE _books (
- id MEDIUMINT(8) UNSIGNED AUTO_INCREMENT,
- title VARCHAR(100),
- PRIMARY KEY (id)
-);
-CREATE TABLE _books2authors (
- author_id MEDIUMINT(8) DEFAULT 0,
- book_id MEDIUMINT(8) DEFAULT 0,
- index(author_id),
- index(book_id)
-);
-
-INSERT INTO _authors (name, some_field) VALUES
-('author1', 1),('author2', 2),('author3', 3);
-
-INSERT INTO _books (title) VALUES
-('book1'),('book2'),('book3');
-
-INSERT INTO _books2authors (author_id, book_id) VALUES
-(2,1),(3,2),(3,3);
-
-SELECT A.id,
- GROUP_CONCAT(B.title ORDER BY B.title DESC SEPARATOR ',') AS books,
- some_field-1 AS having_field
-FROM _authors A
- LEFT JOIN _books2authors B2A FORCE INDEX(author_id)
- ON B2A.author_id = A.id
- LEFT JOIN
- _books B ON B.id = B2A.book_id
-GROUP BY A.id
-HAVING having_field < 1
-ORDER BY having_field ASC;
-
-DROP TABLE _authors, _books, _books2authors;
-
---echo #
---echo # Bug#17055185: WRONG RESULTS WHEN RUNNING A SELECT THAT INCLUDE
---echo # A HAVING BASED ON A FUNCTION.
---echo #
-
-# Generate series 1, 0, 1, 0....
-CREATE TABLE series (
- val INT(10) UNSIGNED NOT NULL
-);
-INSERT INTO series VALUES(1);
-
-DELIMITER |;
-CREATE FUNCTION next_seq_value() RETURNS INT
-BEGIN
- DECLARE next_val INT;
- SELECT val INTO next_val FROM series;
- UPDATE series SET val=mod(val + 1, 2);
- RETURN next_val;
-END;
-|
-DELIMITER ;|
-
-CREATE TABLE t1 (t INT, u INT, KEY(t));
-INSERT INTO t1 VALUES(10, 10), (11, 11), (12, 12), (12, 13),(14, 15), (15, 16),
- (16, 17), (17, 17);
-ANALYZE TABLE t1;
-SELECT t, next_seq_value() r FROM t1 FORCE INDEX(t)
- GROUP BY t HAVING r = 1 ORDER BY t1.u;
-
-DROP TABLE t1;
-DROP FUNCTION next_seq_value;
-DROP TABLE series;
diff --git a/mysql-test/t/help.test b/mysql-test/t/help.test
deleted file mode 100644
index 802f24f80a9..00000000000
--- a/mysql-test/t/help.test
+++ /dev/null
@@ -1,146 +0,0 @@
-# category: topic: keyword:
-#
-# impossible_category_1
-# impossible_function_1
-# impossible_function_5
-# impossible_function_2
-# impossible_function_1
-# impossible_category_2
-# impossible_function_3
-# impossible_function_6
-# impossible_function_4
-# impossible_function_6
-# impossible_category_3
-# impossible_function_7
-
-insert ignore into mysql.help_category(help_category_id,name)values(10001,'impossible_category_1');
-select @category1_id:= 10001;
-insert ignore into mysql.help_category(help_category_id,name)values(10002,'impossible_category_2');
-select @category2_id:= 10002;
-insert ignore into mysql.help_category(help_category_id,name,parent_category_id)values(10003,'impossible_category_3',@category2_id);
-select @category3_id:= 10003;
-
-insert ignore into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(10101,'impossible_function_1',@category1_id,'description of \n impossible_function1\n','example of \n impossible_function1');
-select @topic1_id:= 10101;
-insert ignore into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(10102,'impossible_function_2',@category1_id,'description of \n impossible_function2\n','example of \n impossible_function2');
-select @topic2_id:= 10102;
-insert ignore into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(10103,'impossible_function_3',@category2_id,'description of \n impossible_function3\n','example of \n impossible_function3');
-select @topic3_id:= 10103;
-insert ignore into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(10104,'impossible_function_4',@category2_id,'description of \n impossible_function4\n','example of \n impossible_function4');
-select @topic4_id:= 10104;
-insert ignore into mysql.help_topic(help_topic_id,name,help_category_id,description,example)values(10105,'impossible_function_7',@category3_id,'description of \n impossible_function5\n','example of \n impossible_function7');
-select @topic5_id:= 10105;
-
-insert into mysql.help_keyword(help_keyword_id,name)values(10201,'impossible_function_1');
-select @keyword1_id:= 10201;
-insert into mysql.help_keyword(help_keyword_id,name)values(10202,'impossible_function_5');
-select @keyword2_id:= 10202;
-insert into mysql.help_keyword(help_keyword_id,name)values(10203,'impossible_function_6');
-select @keyword3_id:= 10203;
-
-insert into mysql.help_relation(help_keyword_id,help_topic_id)values(@keyword1_id,@topic2_id);
-insert into mysql.help_relation(help_keyword_id,help_topic_id)values(@keyword2_id,@topic1_id);
-insert into mysql.help_relation(help_keyword_id,help_topic_id)values(@keyword3_id,@topic3_id);
-insert into mysql.help_relation(help_keyword_id,help_topic_id)values(@keyword3_id,@topic4_id);
-
-##############
-help 'function_of_my_dream';
-help '%possible_f%';
-help 'impossible_func%';
-help 'impossible_category%';
-help 'impossible_%';
-
-help '%function_1';
-help '%function_2';
-help '%function_3';
-help '%function_4';
-help '%function_5';
-help '%function_6';
-help '%function_7';
-
-help '%category_2';
-help 'impossible_function_1';
-help 'impossible_category_1';
-
---echo # MDEV-9524 Cannot load from mysql.event when sql_mode is set to PAD_CHAR_TO_FULL_LENGTH
-help 'impossible_function_1';
-SET sql_mode=PAD_CHAR_TO_FULL_LENGTH;
-help 'impossible_function_1';
-SET sql_mode=DEFAULT;
-##############
-
-set sql_mode="";
---disable_warnings
-alter table mysql.help_relation engine=innodb;
-alter table mysql.help_keyword engine=innodb;
-alter table mysql.help_topic engine=innodb;
-alter table mysql.help_category engine=innodb;
---enable_warnings
-set sql_mode=default;
-
-##############
-help 'function_of_my_dream';
-help '%possible_f%';
-help 'impossible_func%';
-help 'impossible_category%';
-help 'impossible_%';
-
-help '%function_1';
-help '%function_2';
-help '%function_3';
-help '%function_4';
-help '%function_5';
-help '%function_6';
-help '%function_7';
-
-help '%category_2';
-help 'impossible_function_1';
-help 'impossible_category_1';
-##############
-
-alter table mysql.help_relation engine=myisam;
-alter table mysql.help_keyword engine=myisam;
-alter table mysql.help_topic engine=myisam;
-alter table mysql.help_category engine=myisam;
-
-delete from mysql.help_topic where help_topic_id=@topic1_id;
-delete from mysql.help_topic where help_topic_id=@topic2_id;
-delete from mysql.help_topic where help_topic_id=@topic3_id;
-delete from mysql.help_topic where help_topic_id=@topic4_id;
-delete from mysql.help_topic where help_topic_id=@topic5_id;
-
-delete from mysql.help_category where help_category_id=@category3_id;
-delete from mysql.help_category where help_category_id=@category2_id;
-delete from mysql.help_category where help_category_id=@category1_id;
-
-delete from mysql.help_keyword where help_keyword_id=@keyword1_id;
-delete from mysql.help_keyword where help_keyword_id=@keyword2_id;
-delete from mysql.help_keyword where help_keyword_id=@keyword3_id;
-
-delete from mysql.help_relation where help_keyword_id=@keyword1_id and help_topic_id=@topic2_id;
-delete from mysql.help_relation where help_keyword_id=@keyword2_id and help_topic_id=@topic1_id;
-delete from mysql.help_relation where help_keyword_id=@keyword3_id and help_topic_id=@topic3_id;
-delete from mysql.help_relation where help_keyword_id=@keyword3_id and help_topic_id=@topic4_id;
-
---echo End of 4.1 tests.
-
-#
-# Test that we can use HELP even under LOCK TABLES. See bug#9953:
-# CONVERT_TZ requires mysql.time_zone_name to be locked.
-#
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (i INT);
-
-LOCK TABLES t1 WRITE;
-
-HELP no_such_topic;
-
-UNLOCK TABLES;
-
-DROP TABLE t1;
-
-
---echo End of 5.1 tests.
diff --git a/mysql-test/t/host_cache_size_functionality.test b/mysql-test/t/host_cache_size_functionality.test
deleted file mode 100644
index 5a7376cc5eb..00000000000
--- a/mysql-test/t/host_cache_size_functionality.test
+++ /dev/null
@@ -1,185 +0,0 @@
-###############################################################################
-# #
-# Variable Name: Host_Cache_Size #
-# Scope: Global #
-# Access Type: Dynamic #
-# Data Type: numeric #
-# #
-# #
-# Creation Date: 2012-08-31 #
-# Author : Tanjot Singh Uppal #
-# #
-# #
-# Description:Test Cases of Dynamic System Variable Host_Cache_Size #
-# that checks the behavior of this variable in the following ways #
-# * Value Check #
-# * Scope Check #
-# * Functionality Check #
-# * Accessability Check #
-# #
-# This test does not perform the crash recovery on this variable #
-# For crash recovery test on default change please run the ibtest #
-###############################################################################
-
--- source include/have_innodb.inc
--- source include/not_embedded.inc
--- source include/have_innodb_16k.inc
---disable_warnings
-echo '#________________________VAR_06_Host_Cache_Size__________________#'
-echo '##'
---echo '#---------------------WL6372_VAR_6_01----------------------#'
-####################################################################
-# Checking default value #
-####################################################################
-SELECT COUNT(@@GLOBAL.Host_Cache_Size);
---echo 1 Expected
-
-#set @Default_host_cache_size=(select if(if(@@global.max_connections<500,128+@@global.max_connections,128+@@global.max_connections+floor((@@global.max_connections-500)/20))>2000,2000,if(@@global.max_connections<500,128+@@global.max_connections,128+@@global.max_connections+floor((@@global.max_connections-500)/20))));
-set @Default_host_cache_size=279;
-
-select @@global.Host_Cache_Size=@Default_host_cache_size;
---echo 1 Expected
-
-
---echo '#---------------------WL6372_VAR_6_02----------------------#'
-#################################################################################
-# Checking the Default value post starting the server with other value #
-#################################################################################
---echo # Restart server with Host_Cache_Size 1
-
-let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
---exec echo "wait" > $restart_file
---shutdown_server 10
---source include/wait_until_disconnected.inc
--- exec echo "restart:--host_cache_size=1 " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--- enable_reconnect
--- source include/wait_until_connected_again.inc
-
---disable_warnings
-
-SELECT @@GLOBAL.Host_Cache_Size;
---echo 1 Expected
-
-#set @Default_host_cache_size=(select if(if(@@global.max_connections<500,128+@@global.max_connections,128+@@global.max_connections+floor((@@global.max_connections-500)/20))>2000,2000,if(@@global.max_connections<500,128+@@global.max_connections,128+@@global.max_connections+floor((@@global.max_connections-500)/20))));
-set @Default_host_cache_size=128;
-SET @@GLOBAL.Host_Cache_Size=DEFAULT;
-select @@global.Host_Cache_Size=@Default_host_cache_size;
---echo 1 Expected
-
-
---echo '#---------------------WL6372_VAR_6_03----------------------#'
-####################################################################
-# Checking Value can be set - Dynamic #
-####################################################################
---error ER_GLOBAL_VARIABLE
-SET @@local.Host_Cache_Size=1;
---echo Expected error 'Global variable'
-
---error ER_GLOBAL_VARIABLE
-SET @@session.Host_Cache_Size=1;
---echo Expected error 'Global variable'
-
-SET @@GLOBAL.Host_Cache_Size=1;
-SET @@GLOBAL.Host_Cache_Size=DEFAULT;
-
-SELECT COUNT(@@GLOBAL.Host_Cache_Size);
---echo 1 Expected
-
-select @@global.Host_Cache_Size=@Default_host_cache_size;
---echo 1 Expected
-
---echo '#---------------------WL6372_VAR_6_04----------------------#'
-#################################################################
-# Check if the value in GLOBAL Table matches value in variable #
-#################################################################
-SELECT @@GLOBAL.Host_Cache_Size = VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
-WHERE VARIABLE_NAME='Host_Cache_Size';
---echo 1 Expected
-
-SELECT COUNT(@@GLOBAL.Host_Cache_Size);
---echo 1 Expected
-
-SELECT COUNT(VARIABLE_VALUE)
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
-WHERE VARIABLE_NAME='Host_Cache_Size';
---echo 1 Expected
-
---echo '#---------------------WL6372_VAR_6_05----------------------#'
-################################################################################
-# Checking Variable Scope #
-################################################################################
-SELECT @@Host_Cache_Size = @@GLOBAL.Host_Cache_Size;
---echo 1 Expected
-
---Error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT COUNT(@@local.Host_Cache_Size);
---echo Expected error 'Variable is a GLOBAL variable'
-
---Error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT COUNT(@@SESSION.Host_Cache_Size);
---echo Expected error 'Variable is a GLOBAL variable'
-
-SELECT COUNT(@@GLOBAL.Host_Cache_Size);
---echo 1 Expected
-
---Error ER_BAD_FIELD_ERROR
-SELECT Host_Cache_Size = @@SESSION.Host_Cache_Size;
---echo Expected error 'Unknown column Host_Cache_Size in field list'
-
-#The below check has been commented out as the IP fetch is different in a P2P connection than BroadBand connection
-#--echo '#---------------------WL6372_VAR_6_06----------------------#'
-###############################################################################
-# Checking the Host cahce functionality #
-###############################################################################
-
-#SET @@GLOBAL.Host_Cache_Size=2;
-#--disable_warnings
-
-#--perl
-#my $ip=`ifconfig | egrep "inet addr|inet" | sed -e 's/^.*inet addr://' -e 's/^.*inet//'| sed 's/ .*\$//'|egrep -i "broadcast|bcast"|head -1|awk '{print $1}'`;
-#open (LOGFH, ">" . $ENV{'MYSQL_TMP_DIR'} . "/bind_ip");
-#print LOGFH "let \$bind_ip = $ip;\n";
-#close LOGFH;
-#EOF
-
-#--source $MYSQL_TMP_DIR/bind_ip
-#--remove_file $MYSQL_TMP_DIR/bind_ip
-
-#let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
-#--exec echo "wait" > $restart_file
-#--shutdown_server 10
-#--source include/wait_until_disconnected.inc
-#-- exec echo "restart:--bind-address=$bind_ip " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-#-- enable_reconnect
-#-- source include/wait_until_connected_again.inc
-
-#connection default;
-#--disable_warnings
-
-#create user binduser;
-#grant all on *.* to binduser;
-
-#select count(IP) from performance_schema.host_cache;
-#--echo 0 Expected
-
-#connect (con1,$bind_ip,binduser,,);
-#select count(IP) from performance_schema.host_cache;
-#--echo 1 Expected
-
-#disconnect con1;
-#connection default;
-
-#--disable_warnings
-
-# The below check is hashed until the BUG14689561# is fixed
-#
-#flush hosts;
-
-#connect (con2,$bind_ip,binduser,,);
-#select count(IP) from performance_schema.host_cache;
-#--echo 1 Expected
-
-#disconnect con2;
-
-SET @@GLOBAL.Host_Cache_Size=DEFAULT;
diff --git a/mysql-test/t/huge_frm-6224.test b/mysql-test/t/huge_frm-6224.test
deleted file mode 100644
index 418722a7b51..00000000000
--- a/mysql-test/t/huge_frm-6224.test
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# MDEV-6224 Incorrect information in file when *.frm is > 256K
-#
-# verify that huge frms are rejected during creation, not on opening
-#
---source include/have_partition.inc
-
-let $n=5646;
-let $a=create table t1 (a int) engine=myisam partition by hash(a) partitions $n (;
-dec $n;
-while ($n)
-{
- let $a=$a partition p01234567890123456789012345678901234567890123456789012345678$n,;
- dec $n;
-}
-
---disable_query_log
---error ER_TABLE_DEFINITION_TOO_BIG
-eval $a partition foo);
-
diff --git a/mysql-test/t/implicit_char_to_num_conversion.test b/mysql-test/t/implicit_char_to_num_conversion.test
deleted file mode 100644
index f3da83ff2c1..00000000000
--- a/mysql-test/t/implicit_char_to_num_conversion.test
+++ /dev/null
@@ -1,174 +0,0 @@
-########### implicit_char_to_num_conversion.test #######################
-# #
-# This test aims at using string/char literal in comparison operators #
-# without explicit type-cast. This is a bug test for Bug#11766521 #
-# - Incorrect result is returned if string/char literal is used with #
-# comparision operator and bit data type column. Test is extended to #
-# include numeric data type comparison with string/char literal #
-# #
-# #
-# Creation: #
-# 2011-05-10 vfisrekar Implement this test as part of Bug#11766521 #
-# #
-########################################################################
-
---disable_warnings
-DROP TABLE IF EXISTS t5;
---enable_warnings
-
-let $default_engine = `select @@SESSION.default_storage_engine`;
-
-# Bug#11766521 - BIT Datatype comparison in where clause return incorrect
-# result for '=' , '<=>' operators
---replace_result $default_engine <default_engine>
-eval CREATE TABLE t5(c1 BIT(2) PRIMARY KEY) ENGINE = $default_engine;
-INSERT INTO t5 VALUES (0), (1), (2);
-SELECT HEX(c1) FROM t5 ORDER BY c1;
-# Enable Following two select after Bug#11766521 fix
-# SELECT HEX(c1) FROM t5 WHERE c1 = '1' ORDER BY c1;
-# SELECT HEX(c1) FROM t5 WHERE c1 <=> '1' ORDER BY c1;
-SELECT HEX(c1) FROM t5 WHERE c1 = b'1' ORDER BY c1;
-SELECT HEX(c1) FROM t5 WHERE c1 <=> b'1' ORDER BY c1;
-SELECT HEX(c1) FROM t5 WHERE c1 != b'1' ORDER BY c1;
-SELECT HEX(c1) FROM t5 WHERE c1 >= '1' ORDER BY c1;
-SELECT HEX(c1) FROM t5 WHERE c1 <= '1' ORDER BY c1;
-SELECT HEX(c1) FROM t5 WHERE c1 < '1' ORDER BY c1;
-SELECT HEX(c1) FROM t5 WHERE c1 > '0' ORDER BY c1;
-DROP TABLE t5;
-
-# FLOAT Data-type
---replace_result $default_engine <default_engine>
-eval CREATE TABLE t5(c1 FLOAT(5,2) PRIMARY KEY) ENGINE = $default_engine;
-INSERT INTO t5 VALUES (95.95), (-10.10), (1), (0);
-SELECT c1 FROM t5 ORDER BY c1;
-# Compare with string literal
-# Following two queries does not return result may be due to Bug#11766521.
-# Enable them after Bug#11766521 fix.
-# SELECT c1 FROM t5 WHERE c1 = '10.10' ORDER BY c1;
-# SELECT c1 FROM t5 WHERE c2 <=> '11.11' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 >= '95' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 <= '10.10' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 != '1' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 < '1' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 > '0' ORDER BY c1;
-DROP TABLE t5;
-
-# TINYINT Datatype
---replace_result $default_engine <default_engine>
-eval CREATE TABLE t5(c1 TINYINT PRIMARY KEY) ENGINE = $default_engine;
-INSERT INTO t5 VALUES (95), (10),(11),(-8);
-SELECT c1 FROM t5 ORDER BY c1;
-# Compare with string literal
-SELECT c1 FROM t5 WHERE c1 = '10' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 <=> '10' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 >= '95' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 <= '11' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 != '-8' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 < '11' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 > '10' ORDER BY c1;
-DROP TABLE t5;
-
-# SMALLINT Datatype
---replace_result $default_engine <default_engine>
-eval CREATE TABLE t5(c1 SMALLINT PRIMARY KEY) ENGINE = $default_engine;
-INSERT INTO t5 VALUES (395), (-200), (100), (111);
-SELECT c1 FROM t5 ORDER BY c1;
-# Compare with string literal
-SELECT c1 FROM t5 WHERE c1 = '100' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 <=> '100' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 >= '395' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 <= '-200' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 != '100' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 < '111' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 > '111' ORDER BY c1;
-DROP TABLE t5;
-
-# MEDIUMINT Datatype
---replace_result $default_engine <default_engine>
-eval CREATE TABLE t5(c1 MEDIUMINT PRIMARY KEY) ENGINE = $default_engine;
-INSERT INTO t5 VALUES (-8388607), (311),(215),(88608);
-SELECT c1 FROM t5 ORDER BY c1;
-# Compare with string literal
-SELECT c1 FROM t5 WHERE c1 = '311' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 <=> '311' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 >= '215' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 <= '88608' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 != '-8388607' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 < '215' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 > '215' ORDER BY c1;
-DROP TABLE t5;
-
-# INT Datatype
---replace_result $default_engine <default_engine>
-eval CREATE TABLE t5(c1 INT PRIMARY KEY) ENGINE = $default_engine;
-INSERT INTO t5 VALUES (-2147483647), (1011),(15),(9388607);
-SELECT c1 FROM t5 ORDER BY c1;
-# Compare with string literal
-SELECT c1 FROM t5 WHERE c1 = '9388607' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 <=> '9388607' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 >= '15' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 <= '1011' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 != '-2147483647' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 < '15' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 > '15' ORDER BY c1;
-DROP TABLE t5;
-
-# BIGINT Data-type
---replace_result $default_engine <default_engine>
-eval CREATE TABLE t5(c1 BIGINT PRIMARY KEY) ENGINE = $default_engine;
-INSERT INTO t5 VALUES (-9223372036854775807), (12011),(500),(3372036854775808);
-SELECT c1 FROM t5 ORDER BY c1;
-# Compare with string literal
-SELECT c1 FROM t5 WHERE c1 = '-9223372036854775807' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 <=> '-9223372036854775807' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 >= '12011' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 <= '500' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 != '3372036854775808' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 < '12011' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 > '12011' ORDER BY c1;
-DROP TABLE t5;
-
-# DOUBLE Datatype
---replace_result $default_engine <default_engine>
-eval CREATE TABLE t5(c1 DOUBLE(5,2) PRIMARY KEY) ENGINE = $default_engine;
-INSERT INTO t5 VALUES (95.95), (11.11),(5),(-908.92);
-SELECT c1 FROM t5 ORDER BY c1;
-# Compare with string literal
-SELECT c1 FROM t5 WHERE c1 = '11.11' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 <=> '11.11' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 >= '5' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 <= '95.95' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 != '-908.92' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 < '95.95' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 > '-908.92' ORDER BY c1;
-DROP TABLE t5;
-
-# NUMERIC Datatype
---replace_result $default_engine <default_engine>
-eval CREATE TABLE t5(c1 NUMERIC(5,2) PRIMARY KEY) ENGINE = $default_engine;
-INSERT INTO t5 VALUES (95.95), (11.11),(5),(-908.92);
-SELECT c1 FROM t5 ORDER BY c1;
-# Compare with string literal
-SELECT c1 FROM t5 WHERE c1 = '11.11' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 <=> '11.11' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 >= '5' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 <= '95.95' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 != '-908.92' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 < '95.95' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 > '-908.92' ORDER BY c1;
-DROP TABLE t5;
-
-# DECIMAL Datatype
---replace_result $default_engine <default_engine>
-eval CREATE TABLE t5(c1 DECIMAL(5,2) PRIMARY KEY) ENGINE = $default_engine;
-INSERT INTO t5 VALUES (95.95), (11.11),(5),(-908.92);
-SELECT c1 FROM t5 ORDER BY c1;
-# Compare with string literal
-SELECT c1 FROM t5 WHERE c1 = '11.11' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 <=> '11.11' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 >= '5' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 <= '95.95' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 != '-908.92' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 < '95.95' ORDER BY c1;
-SELECT c1 FROM t5 WHERE c1 > '-908.92' ORDER BY c1;
-DROP TABLE t5;
diff --git a/mysql-test/t/implicit_commit-master.opt b/mysql-test/t/implicit_commit-master.opt
deleted file mode 100644
index 96f0ce3f36c..00000000000
--- a/mysql-test/t/implicit_commit-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---default-storage-engine=MyISAM
diff --git a/mysql-test/t/implicit_commit.test b/mysql-test/t/implicit_commit.test
deleted file mode 100644
index bcc43865395..00000000000
--- a/mysql-test/t/implicit_commit.test
+++ /dev/null
@@ -1,1169 +0,0 @@
-source include/have_innodb.inc;
-source include/not_embedded.inc;
-source include/have_profiling.inc;
-
-SET SQL_MODE="";
-
-SET GLOBAL EVENT_SCHEDULER = OFF;
-SET BINLOG_FORMAT = STATEMENT;
-
-LET $OLD_DB= `SELECT DATABASE()`;
-
-CREATE DATABASE db1;
-USE db1;
-CREATE TABLE t1 (a INT, KEY a(a)) ENGINE=INNODB;
-INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
-CREATE TABLE t3 (a INT) ENGINE=MyISAM;
-INSERT INTO t3 SELECT * FROM t1;
-CREATE TABLE trans (a INT) ENGINE=INNODB;
-
-DELIMITER |;
-
-CREATE PROCEDURE test_if_commit()
-BEGIN
- ROLLBACK;
- SELECT IF (COUNT(*) > 0, "YES", "NO") AS "IMPLICIT COMMIT" FROM trans;
- DELETE FROM trans;
- COMMIT;
-END|
-
-DELIMITER ;|
-
-SET AUTOCOMMIT = FALSE;
-
---echo #
---echo # SQLCOM_SELECT
---echo #
-
-let $statement=
- select 1 as res from t1 where (1) in (select * from t1);
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_CREATE_TABLE LIKE
---echo #
-
-let $statement=
- create table t2 like t1;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_CREATE
---echo #
-
-let $statement=
- show create table t2;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_DROP_TABLE
---echo #
-
-let $statement=
- drop table t2;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_CREATE_TABLE TEMPORARY
---echo #
-
-let $statement=
- create temporary table t2 as select * from t1;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_DROP_TABLE TEMPORARY
---echo #
-
-let $statement=
- drop temporary table t2;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_CREATE_TABLE
---echo #
-
-let $statement=
- create table t2 as select * from t1;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_UPDATE
---echo #
-
-let $statement=
- update t2 set a=a+1 where (1) in (select * from t1);
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_INSERT
---echo #
-
-let $statement=
- insert into t2 set a=((1) in (select * from t1));
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_INSERT_SELECT
---echo #
-
-let $statement=
- insert into t2 select * from t1;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_REPLACE
---echo #
-
-let $statement=
- replace t2 set a=((1) in (select * from t1));
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_REPLACE_SELECT
---echo #
-
-let $statement=
- replace t2 select * from t1;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_DELETE
---echo #
-
-let $statement=
- delete from t2 where (1) in (select * from t1);
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_DELETE_MULTI
---echo #
-
-let $statement=
- delete t2, t3 from t2, t3 where (1) in (select * from t1);
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_UPDATE_MULTI
---echo #
-
-select * from t2;
-let $statement=
- update t2, t3 set t3.a=t2.a, t2.a=null where (1) in (select * from t1);
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_LOAD
---echo #
-
-create table t4 (a varchar(100));
-
-let $statement=
- load data infile '../../std_data/words.dat' into table t4;
-source include/implicit_commit_helper.inc;
-
-drop table t4;
-
---echo #
---echo # SQLCOM_SHOW_DATABASES
---echo #
-
-let $statement=
- show databases where (1) in (select * from t1);
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_TABLES
---echo #
-
-let $statement=
- show tables where (1) in (select * from t1);
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_FIELDS
---echo #
-
-let $statement=
- show fields from t1 where (1) in (select * from t1);
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_KEYS
---echo #
-
-let $statement=
- show keys from t1 where (1) in (select * from t1);
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_VARIABLES
---echo #
-
-let $statement=
- show variables where (1) in (select * from t1);
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_STATUS
---echo #
-
-let $statement=
- show status where (1) in (select * from t1);
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_ENGINE_MUTEX
---echo #
-
-let $statement=
- show engine all mutex;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_PROCESSLIST
---echo #
-
-let $statement=
- show processlist;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_ENGINE_LOGS
---echo #
-
-let $statement=
- show engine all logs;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_ENGINE_STATUS
---echo #
-
-let $statement=
- show engine all status;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_CHARSETS
---echo #
-
-let $statement=
- show charset where (1) in (select * from t1);
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_COLLATIONS
---echo #
-
-let $statement=
- show collation where (1) in (select * from t1);
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_TABLE_STATUS
---echo #
-
-let $statement=
- show table status where (1) in (select * from t1);
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_TRIGGERS
---echo #
-
-let $statement=
- show triggers where (1) in (select * from t1);
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_OPEN_TABLES
---echo #
-
-let $statement=
- show open tables where (1) in (select * from t1);
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_STATUS_PROC
---echo #
-
-let $statement=
- show procedure status where (1) in (select * from t1);
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_STATUS_FUNC
---echo #
-
-let $statement=
- show function status where (1) in (select * from t1);
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SET_OPTION
---echo #
-
-let $statement=
- set @a=((1) in (select * from t1));
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_DO
---echo #
-
-let $statement=
- do ((1) in (select * from t1));
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_CALL
---echo #
-
-create procedure p1(a int) begin end;
-
-let $statement=
- call p1((1) in (select * from t1));
-source include/implicit_commit_helper.inc;
-
-drop procedure p1;
-
---echo #
---echo # SQLCOM_CREATE_VIEW
---echo #
-
-let $statement=
- create view v1 as select * from t1;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_ALTER_VIEW
---echo #
-
-let $statement=
- alter view v1 as select 2;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_DROP_VIEW
---echo #
-
-let $statement=
- drop view v1;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_CREATE_INDEX
---echo #
-
-let $statement=
- create index idx1 on t1(a);
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_DROP_INDEX
---echo #
-
-let $statement=
- drop index idx1 on t1;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_ALTER_TABLE
---echo #
-
-let $statement=
- alter table t1 add column b int;
-source include/implicit_commit_helper.inc;
-
-let $statement=
- alter table t1 change b c int;
-source include/implicit_commit_helper.inc;
-
-let $statement=
- alter table t1 drop column c;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_ALTER_TABLE TEMPORARY
---echo #
-
-create temporary table t4 (a int);
-
-let $statement=
- alter table t1 add column b int;
-source include/implicit_commit_helper.inc;
-
-let $statement=
- alter table t1 change b c int;
-source include/implicit_commit_helper.inc;
-
-let $statement=
- alter table t1 drop column c;
-source include/implicit_commit_helper.inc;
-
-drop table t4;
-
---echo #
---echo # SQLCOM_TRUNCATE
---echo #
-
-insert into t2 select * from t1;
-let $statement=
- truncate table t2;
-source include/implicit_commit_helper.inc;
-insert into t2 select * from t1;
-
---echo #
---echo # SQLCOM_TRUNCATE TEMPORARY
---echo #
-
-create temporary table t4 as select * from t1;
-let $statement=
- truncate table t4;
-source include/implicit_commit_helper.inc;
-drop temporary table t4;
-
---echo #
---echo # SQLCOM_SHOW_MASTER_STAT
---echo #
-
-let $statement=
- show master status;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_SLAVE_STAT
---echo #
-
-let $statement=
- show slave status;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_GRANT
---echo #
-
-let $statement=
- grant all on test.t1 to mysqltest_2@localhost with grant option;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_REVOKE
---echo #
-let $statement=
- revoke select on test.t1 from mysqltest_2@localhost;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_REVOKE_ALL
---echo #
-
-let $statement=
- revoke all on test.t1 from mysqltest_2@localhost;
-source include/implicit_commit_helper.inc;
-
-drop user mysqltest_2@localhost;
-
---echo #
---echo # SQLCOM_SHOW_GRANTS
---echo #
-
-let $statement=
- show grants;
-source include/implicit_commit_helper.inc;
-
-let $statement=
- show grants for current_user();
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_LOCK_TABLES
---echo #
-
-let $statement=
- lock tables t1 write, trans write;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_UNLOCK_TABLES
---echo #
-
-let $statement=
- unlock tables;
-source include/implicit_commit_helper.inc;
-
-#
-# Missing test for lock tables transactional.
-#
-
---echo #
---echo # SQLCOM_CREATE_DB
---echo #
-
-let $statement=
- create database db2;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_CHANGE_DB
---echo #
-
-create table db2.t1 (a int);
-insert into db2.t1 values (1);
-commit;
-
-let $statement=
- use db2;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_CREATE_DB
---echo #
-
-let $statement=
- show create database db2;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_ALTER_DB
---echo #
-
-#let $statement=
-# alter database db2 character set koi8r;
-#source include/implicit_commit_helper.inc;
-
-#let $statement=
-# alter database db2 collate cp1251_general_cs;
-#source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_ALTER_DB_UPGRADE
---echo #
-
-#let $statement=
-# alter database `#mysql50#db3` upgrade data directory name;
-#source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_DROP_DB
---echo #
-
-use db1;
-
-let $statement=
- drop database db2;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_REPAIR
---echo #
-
-let $statement=
- repair table t2;
-source include/implicit_commit_helper.inc;
-
-let $statement=
- repair table t2 use_frm;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_OPTIMIZE
---echo #
-
-let $statement=
- optimize table t1;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_CHECK
---echo #
-
-let $statement=
- check table t1;
-source include/implicit_commit_helper.inc;
-
-let $statement=
- check table t1 extended;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_ASSIGN_TO_KEYCACHE
---echo #
-
-set global keycache.key_buffer_size=128*1024;
-
-let $statement=
- cache index t3 in keycache;
-source include/implicit_commit_helper.inc;
-
-set global keycache.key_buffer_size=0;
-
---echo #
---echo # SQLCOM_PRELOAD_KEYS
---echo #
-
-let $statement=
- load index into cache t3;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_FLUSH
---echo #
-
-let $statement=
- flush local privileges;
-source include/implicit_commit_helper.inc;
-
-let $statement=
- flush privileges;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_KILL
---echo #
-
---echo #
---echo # SQLCOM_ANALYZE
---echo #
-
-let $statement=
- analyze table t1;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_ROLLBACK
---echo #
-
-let $statement=
- rollback;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_ROLLBACK_TO_SAVEPOINT
---echo #
-
-
---echo #
---echo # SQLCOM_COMMIT
---echo #
-
-let $statement=
- commit;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SAVEPOINT
---echo #
-
-let $statement=
- savepoint sp1;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_RELEASE_SAVEPOINT
---echo #
-
---echo #
---echo # SQLCOM_SLAVE_START
---echo #
-
---echo #
---echo # SQLCOM_SLAVE_STOP
---echo #
-
---echo #
---echo # SQLCOM_BEGIN
---echo #
-
-let $statement=
- begin;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_CHANGE_MASTER
---echo #
-
---echo #
---echo # SQLCOM_RENAME_TABLE
---echo #
-
-let $statement=
- rename table t3 to t4;
-source include/implicit_commit_helper.inc;
-
-let $statement=
- rename table t4 to t3;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_RESET
---echo #
-
-let $statement=
- reset query cache;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_PURGE
---echo #
-
---echo #
---echo # SQLCOM_PURGE_BEFORE
---echo #
-
---echo #
---echo # SQLCOM_SHOW_BINLOGS
---echo #
-
---echo #
---echo # SQLCOM_HA_OPEN
---echo #
-
-let $statement=
- handler t1 open as ha1;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_HA_READ
---echo #
-
-let $statement=
- handler ha1 read a first;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_HA_CLOSE
---echo #
-
-let $statement=
- handler ha1 close;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_SLAVE_HOSTS
---echo #
-
-let $statement=
- show slave hosts;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_BINLOG_EVENTS
---echo #
-
-let $statement=
- show binlog events;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_NEW_MASTER
---echo #
-
---echo #
---echo # SQLCOM_SHOW_WARNS
---echo #
-
-let $statement=
- show warnings;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_EMPTY_QUERY
---echo #
-
---echo #
---echo # SQLCOM_SHOW_ERRORS
---echo #
-
-let $statement=
- show errors;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_STORAGE_ENGINES
---echo #
-
-let $statement=
- show engines;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_PRIVILEGES
---echo #
-
-let $statement=
- show privileges;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_HELP
---echo #
-
-let $statement=
- help 'foo';
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_CREATE_USER
---echo #
-
-let $statement=
- create user trxusr1;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_RENAME_USER
---echo #
-
-let $statement=
- rename user 'trxusr1' to 'trxusr2';
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_DROP_USER
---echo #
-
-let $statement=
- drop user trxusr2;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_CHECKSUM
---echo #
-
-let $statement=
- checksum table t1;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_CREATE_PROCEDURE
---echo #
-
-let $statement=
- create procedure p1(a int) begin end;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_ALTER_PROCEDURE
---echo #
-
-let $statement=
- alter procedure p1 comment 'foobar';
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_CREATE_PROC
---echo #
-
-let $statement=
- show create procedure p1;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_STATUS_PROC
---echo #
-
-let $statement=
- show procedure status;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_PROC_CODE
---echo #
-
-#
-# Available only on servers with debugging support.
-#
-
---disable_abort_on_error
-let $statement=
- show procedure code p1;
-source include/implicit_commit_helper.inc;
---enable_abort_on_error
-
---echo #
---echo # SQLCOM_DROP_PROCEDURE
---echo #
-
-let $statement=
- drop procedure p1;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_CREATE_FUNCTION
---echo #
-
---echo #
---echo # SQLCOM_DROP_FUNCTION
---echo #
-
---echo #
---echo # SQLCOM_CREATE_SPFUNCTION
---echo #
-
-let $statement=
- create function f1() returns int return 69;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_ALTER_FUNCTION
---echo #
-
-let $statement=
- alter function f1 comment 'comment';
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_CREATE_FUNC
---echo #
-
-let $statement=
- show create function f1;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_STATUS_FUNC
---echo #
-
-let $statement=
- show function status like '%f%';
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_FUNC_CODE
---echo #
-
-#
-# Available only on servers with debugging support.
-#
-
---disable_abort_on_error
-let $statement=
- show function code f1;
-source include/implicit_commit_helper.inc;
---enable_abort_on_error
-
---echo #
---echo # SQLCOM_PREPARE
---echo #
-
-let $statement=
- prepare stmt1 from "insert into t1 values (5)";
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_EXECUTE
---echo #
-
-let $statement=
- execute stmt1;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_DEALLOCATE_PREPARE
---echo #
-
-let $statement=
- deallocate prepare stmt1;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_CREATE_TRIGGER
---echo #
-
-let $statement=
- create trigger trg1 before insert on t1 for each row set @a:=1;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_CREATE_TRIGGER
---echo #
-
-let $statement=
- show create trigger trg1;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_DROP_TRIGGER
---echo #
-
-let $statement=
- drop trigger trg1;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_XA_START
---echo #
-
---echo #
---echo # SQLCOM_XA_END
---echo #
-
---echo #
---echo # SQLCOM_XA_PREPARE
---echo #
-
---echo #
---echo # SQLCOM_XA_COMMIT
---echo #
-
---echo #
---echo # SQLCOM_XA_ROLLBACK
---echo #
-
---echo #
---echo # SQLCOM_XA_RECOVER
---echo #
-
---echo #
---echo # SQLCOM_ALTER_TABLESPACE
---echo #
-
---echo #
---echo # SQLCOM_INSTALL_PLUGIN
---echo #
-
---echo #
---echo # SQLCOM_SHOW_PLUGINS
---echo #
-
---echo #
---echo # SQLCOM_UNINSTALL_PLUGIN
---echo #
-
---echo #
---echo # SQLCOM_SHOW_AUTHORS
---echo #
-
-let $statement=
- show authors;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_BINLOG_BASE64_EVENT
---echo #
-
---echo #
---echo # SQLCOM_SHOW_CONTRIBUTORS
---echo #
-
-let $statement=
- show contributors;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_CREATE_SERVER
---echo #
-
---echo #
---echo # SQLCOM_ALTER_SERVER
---echo #
-
---echo #
---echo # SQLCOM_DROP_SERVER
---echo #
-
---echo #
---echo # SQLCOM_CREATE_EVENT
---echo #
-
-let $statement=
- create event ev1 on schedule every 1 second do insert into t1 values (6);
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_ALTER_EVENT
---echo #
-
-let $statement=
- alter event ev1 rename to ev2 disable;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_CREATE_EVENT
---echo #
-
-let $statement=
- show create event ev2;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_EVENTS
---echo #
-
-let $statement=
- show events;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_DROP_EVENT
---echo #
-
-let $statement=
- drop event ev2;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_BACKUP
---echo #
-
-#create database backup_db;
-#
-#let $statement=
-# backup database db1 to 'backup_db1.ba';
-#source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_ARCHIVE
---echo #
-
-#
-# --error ER_NOT_ALLOWED_COMMAND
-#
-#let $statement=
-# show backup 'backup_db1.ba';
-#source include/implicit_commit_helper.inc;
-#
-
---echo #
---echo # SQLCOM_RESTORE
---echo #
-
-#let $statement=
-# restore from 'backup_db1.ba';
-#source include/implicit_commit_helper.inc;
-
-#--remove_file $MYSQLTEST_VARDIR/master-data/backup_db1.ba
-#
-#drop database backup_db;
-
---echo #
---echo # SQLCOM_BACKUP_TEST
---echo #
-
-# BACKUP_TEST
-
---echo #
---echo # SQLCOM_SHOW_PROFILE
---echo #
-
-let $statement=
- show profile memory;
-source include/implicit_commit_helper.inc;
-
---echo #
---echo # SQLCOM_SHOW_PROFILES
---echo #
-
-let $statement=
- show profiles;
-source include/implicit_commit_helper.inc;
-
-DROP TABLE t1;
-DROP TABLE t2;
-DROP TABLE t3;
-eval USE $OLD_DB;
-DROP DATABASE db1;
-
---echo End of tests
diff --git a/mysql-test/t/in_datetime_241.test b/mysql-test/t/in_datetime_241.test
deleted file mode 100644
index f95a456f5e2..00000000000
--- a/mysql-test/t/in_datetime_241.test
+++ /dev/null
@@ -1,9 +0,0 @@
-#
-# MDEV-241 lp:992722 - Server crashes in get_datetime_value
-#
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-CREATE TABLE t1 ( a DATE );
-SELECT * FROM t1 WHERE ( SELECT a FROM t1 ) IN ('2012-04-25','2012-04-26');
-DROP TABLE t1;
diff --git a/mysql-test/t/index_intersect.test b/mysql-test/t/index_intersect.test
deleted file mode 100644
index 1be963cb9e5..00000000000
--- a/mysql-test/t/index_intersect.test
+++ /dev/null
@@ -1,461 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1,t2,t3,t4;
-DROP DATABASE IF EXISTS world;
---enable_warnings
-
-set names utf8;
-
-CREATE DATABASE world;
-
-use world;
-
---source include/world_schema.inc
-
---disable_query_log
---disable_result_log
---disable_warnings
---source include/world.inc
---enable_warnings
---enable_result_log
---enable_query_log
-
-SELECT COUNT(*) FROM Country;
-SELECT COUNT(*) FROM City;
-SELECT COUNT(*) FROM CountryLanguage;
-
-CREATE INDEX Name ON City(Name);
-
---disable_query_log
---disable_result_log
---disable_warnings
-ANALYZE TABLE City;
---enable_warnings
---enable_result_log
---enable_query_log
-
-SET SESSION optimizer_switch='index_merge_sort_intersection=on';
-
-SELECT COUNT(*) FROM City;
-
-# The output of the next 6 queries tells us about selectivities
-# of the conditions utilized in 4 queries following after them
-
-SELECT COUNT(*) FROM City WHERE Name LIKE 'C%';
-SELECT COUNT(*) FROM City WHERE Name LIKE 'M%';
-SELECT COUNT(*) FROM City WHERE Population > 1000000;
-SELECT COUNT(*) FROM City WHERE Population > 1500000;
-SELECT COUNT(*) FROM City WHERE Population > 300000;
-SELECT COUNT(*) FROM City WHERE Population > 7000000;
-
-# The pattern of the WHERE condition used in the following 4 queries is
-# range(key1) AND range(key2)
-# Varying values of the constants in the conjuncts of the condition
-# we can get either an index intersection retrieval over key1 and key2
-# or a range index scan for one of these indexes
-
---replace_column 9 #
-EXPLAIN
-SELECT * FROM City WHERE
- Name LIKE 'C%' AND Population > 1000000;
-
---replace_column 9 #
-EXPLAIN
-SELECT * FROM City WHERE
- Name LIKE 'M%' AND Population > 1500000;
-
---replace_column 9 #
-EXPLAIN
-SELECT * FROM City
- WHERE Name LIKE 'M%' AND Population > 300000;
-
---replace_column 9 #
-EXPLAIN
-SELECT * FROM City
- WHERE Name LIKE 'M%' AND Population > 7000000;
-
-
-# The following 8 queries check that
-# the previous 4 plans are valid and return
-# the correct results when executed
-
---sorted_result
-SELECT * FROM City USE INDEX ()
- WHERE Name LIKE 'C%' AND Population > 1000000;
---sorted_result
-SELECT * FROM City
- WHERE Name LIKE 'C%' AND Population > 1000000;
-
---sorted_result
-SELECT * FROM City USE INDEX ()
- WHERE Name LIKE 'M%' AND Population > 1500000;
---sorted_result
-SELECT * FROM City
- WHERE Name LIKE 'M%' AND Population > 1500000;
-
---sorted_result
-SELECT * FROM City USE INDEX ()
- WHERE Name LIKE 'M%' AND Population > 300000;
---sorted_result
-SELECT * FROM City
- WHERE Name LIKE 'M%' AND Population > 300000;
-
-
-SELECT * FROM City USE INDEX ()
- WHERE Name LIKE 'M%' AND Population > 7000000;
-
-SELECT * FROM City
- WHERE Name LIKE 'M%' AND Population > 7000000;
-
-
-# The output of the next 7 queries tells us about selectivities
-# of the conditions utilized in 3 queries following after them
-
-SELECT COUNT(*) FROM City WHERE Name BETWEEN 'M' AND 'N';
-SELECT COUNT(*) FROM City WHERE Name BETWEEN 'G' AND 'J';
-SELECT COUNT(*) FROM City WHERE Name BETWEEN 'G' AND 'K';
-SELECT COUNT(*) FROM City WHERE Population > 1000000;
-SELECT COUNT(*) FROM City WHERE Population > 500000;
-SELECT COUNT(*) FROM City WHERE Country LIKE 'C%';
-SELECT COUNT(*) FROM City WHERE Country LIKE 'B%';
-
-
-# The pattern of the WHERE condition used in the following 3 queries is
-# range(key1) AND range(key2) AND range(key3)
-# Varying values of the constants in the conjuncts of the condition
-# we can get index intersection over different pairs of keys:
-# over(key1,key2), over(key1,key3) and over(key2,key3)
-
-
---replace_column 9 #
-EXPLAIN
-SELECT * FROM City
- WHERE Name BETWEEN 'M' AND 'N' AND Population > 1000000 AND Country LIKE 'C%';
-
---replace_column 9 #
-EXPLAIN
-SELECT * FROM City
- WHERE Name BETWEEN 'G' AND 'J' AND Population > 1000000 AND Country LIKE 'B%';
-
---replace_column 7 # 9 #
---replace_result Population,Country,Name Population,Name,Country
-EXPLAIN
-SELECT * FROM City
- WHERE Name BETWEEN 'G' AND 'K' AND Population > 500000 AND Country LIKE 'C%';
-
-
-# The following 6 queries check that
-# the previous 3 plans are valid and return
-# the correct results when executed
-
-
-SELECT * FROM City USE INDEX ()
- WHERE Name BETWEEN 'M' AND 'N' AND Population > 1000000 AND Country LIKE 'C%';
-
-SELECT * FROM City
- WHERE Name BETWEEN 'M' AND 'N' AND Population > 1000000 AND Country LIKE 'C%';
-
-
-SELECT * FROM City USE INDEX ()
- WHERE Name BETWEEN 'G' AND 'J' AND Population > 1000000 AND Country LIKE 'B%';
-
---sorted_result
-SELECT * FROM City
- WHERE Name BETWEEN 'G' AND 'J' AND Population > 1000000 AND Country LIKE 'B%';
-
-
-SELECT * FROM City USE INDEX ()
- WHERE Name BETWEEN 'G' AND 'K' AND Population > 500000 AND Country LIKE 'C%';
-
---sorted_result
-SELECT * FROM City
- WHERE Name BETWEEN 'G' AND 'K' AND Population > 500000 AND Country LIKE 'C%';
-
-
-# The output of the next 12 queries tells us about selectivities
-# of the conditions utilized in 5 queries following after them
-
-SELECT COUNT(*) FROM City WHERE ID BETWEEN 501 AND 1000;
-SELECT COUNT(*) FROM City WHERE ID BETWEEN 1 AND 500;
-SELECT COUNT(*) FROM City WHERE ID BETWEEN 2001 AND 2500;
-SELECT COUNT(*) FROM City WHERE ID BETWEEN 3701 AND 4000;
-SELECT COUNT(*) FROM City WHERE Population > 700000;
-SELECT COUNT(*) FROM City WHERE Population > 1000000;
-SELECT COUNT(*) FROM City WHERE Population > 300000;
-SELECT COUNT(*) FROM City WHERE Population > 600000;
-SELECT COUNT(*) FROM City WHERE Country LIKE 'C%';
-SELECT COUNT(*) FROM City WHERE Country LIKE 'A%';
-SELECT COUNT(*) FROM City WHERE Country LIKE 'H%';
-SELECT COUNT(*) FROM City WHERE Country BETWEEN 'S' AND 'Z';
-
-
-# The pattern of the WHERE condition used in the following 5 queries is
-# range(key1) AND range(key2) AND range(key3)
-# with key1 happens to be a primary key (it matters only for InnoDB)
-# Varying values of the constants in the conjuncts of the condition
-# we can get index intersection either over all three keys, or over
-# different pairs, or a range scan over one of these keys.
-# Bear in mind that the condition (Country LIKE 'A%') is actually
-# equivalent to the condition (Country BETWEEN 'A' AND 'B') for the
-# tested instance the table City.
-
-
---replace_column 9 #
-EXPLAIN
-SELECT * FROM City
- WHERE ID BETWEEN 501 AND 1000 AND Population > 700000 AND Country LIKE 'C%';
-
---replace_column 9 #
-EXPLAIN
-SELECT * FROM City
- WHERE ID BETWEEN 1 AND 500 AND Population > 1000000 AND Country LIKE 'A%';
-
---replace_column 9 #
-EXPLAIN
-SELECT * FROM City
- WHERE ID BETWEEN 2001 AND 2500 AND Population > 300000 AND Country LIKE 'H%';
-
---replace_column 9 #
-EXPLAIN
-SELECT * FROM City
- WHERE ID BETWEEN 3701 AND 4000 AND Population > 1000000
- AND Country BETWEEN 'S' AND 'Z';
-
---replace_column 9 #
---replace_result PRIMARY,Country,Population PRIMARY,Population,Country 4,7,4 4,4,7
-EXPLAIN
-SELECT * FROM City
- WHERE ID BETWEEN 3001 AND 4000 AND Population > 600000
- AND Country BETWEEN 'S' AND 'Z' ;
-
-
-# The following 10 queries check that
-# the previous 5 plans are valid and return
-# the correct results when executed
-
-
-SELECT * FROM City USE INDEX ()
- WHERE ID BETWEEN 501 AND 1000 AND Population > 700000 AND Country LIKE 'C%';
-
-SELECT * FROM City
- WHERE ID BETWEEN 501 AND 1000 AND Population > 700000 AND Country LIKE 'C%';
-
---sorted_result
-SELECT * FROM City USE INDEX ()
- WHERE ID BETWEEN 1 AND 500 AND Population > 1000000 AND Country LIKE 'A%';
---sorted_result
-SELECT * FROM City
- WHERE ID BETWEEN 1 AND 500 AND Population > 1000000 AND Country LIKE 'A%';
-
-
-SELECT * FROM City USE INDEX ()
- WHERE ID BETWEEN 2001 AND 2500 AND Population > 300000 AND Country LIKE 'H%';
-
-SELECT * FROM City
- WHERE ID BETWEEN 2001 AND 2500 AND Population > 300000 AND Country LIKE 'H%';
-
---sorted_result
-SELECT * FROM City USE INDEX ()
- WHERE ID BETWEEN 3701 AND 4000 AND Population > 700000
- AND Country BETWEEN 'S' AND 'Z';
---sorted_result
-SELECT * FROM City
- WHERE ID BETWEEN 3701 AND 4000 AND Population > 700000
- AND Country BETWEEN 'S' AND 'Z';
-
---sorted_result
-SELECT * FROM City USE INDEX ()
- WHERE ID BETWEEN 3001 AND 4000 AND Population > 600000
- AND Country BETWEEN 'S' AND 'Z' ;
---sorted_result
-SELECT * FROM City
- WHERE ID BETWEEN 3001 AND 4000 AND Population > 600000
- AND Country BETWEEN 'S' AND 'Z' ;
-
-
-SET SESSION sort_buffer_size = 2048;
-
-
-# The following EXPLAIN command demonstrate that the execution plans
-# may be different if sort_buffer_size is set to a small value
-
-
---replace_column 9 #
-EXPLAIN
-SELECT * FROM City WHERE
- Name LIKE 'C%' AND Population > 1000000;
-
---replace_column 9 #
-EXPLAIN
-SELECT * FROM City WHERE
- Name LIKE 'M%' AND Population > 1500000;
-
-
---replace_column 9 #
-EXPLAIN
-SELECT * FROM City
- WHERE Name BETWEEN 'G' AND 'J' AND Population > 1000000 AND Country LIKE 'B%';
-
---replace_column 9 #
-EXPLAIN
-SELECT * FROM City
- WHERE Name BETWEEN 'G' AND 'J' AND Population > 500000 AND Country LIKE 'C%';
-
-
---replace_column 9 #
-EXPLAIN
-SELECT * FROM City
- WHERE ID BETWEEN 1 AND 500 AND Population > 1000000 AND Country LIKE 'A%';
-
---replace_column 9 #
---replace_result PRIMARY,Country,Population PRIMARY,Population,Country 4,7,4 4,4,7
-EXPLAIN
-SELECT * FROM City
- WHERE ID BETWEEN 3001 AND 4000 AND Population > 600000
- AND Country BETWEEN 'S' AND 'Z';
-
-
-#Yet the query themselves return the correct results in this case as well
-
---sorted_result
-SELECT * FROM City WHERE
- Name LIKE 'C%' AND Population > 1000000;
-
---sorted_result
-SELECT * FROM City WHERE
- Name LIKE 'M%' AND Population > 1500000;
-
---sorted_result
-SELECT * FROM City
- WHERE Name BETWEEN 'G' AND 'J' AND Population > 700000 AND Country LIKE 'B%';
-
---sorted_result
-SELECT * FROM City
- WHERE Name BETWEEN 'G' AND 'J' AND Population > 500000 AND Country LIKE 'C%';
-
-
-SELECT * FROM City
- WHERE ID BETWEEN 1 AND 500 AND Population > 1000000 AND Country LIKE 'A%';
---sorted_result
-SELECT * FROM City
- WHERE ID BETWEEN 3001 AND 4000 AND Population > 600000
- AND Country BETWEEN 'S' AND 'Z';
-
-
-SET SESSION sort_buffer_size = default;
-
-# Instead of the index on the column Country create two compound indexes
-# including this column as the first component
-
-DROP INDEX Country ON City;
-
-CREATE INDEX CountryID ON City(Country,ID);
-CREATE INDEX CountryName ON City(Country,Name);
-
---disable_query_log
---disable_result_log
---disable_warnings
-ANALYZE TABLE City;
---enable_warnings
---enable_result_log
---enable_query_log
-
-# Check that the first component of a compound index can be used for
-# index intersection, even in the cases when we have a ref access
-# for this component
-
---replace_column 9 #
-EXPLAIN
-SELECT * FROM City
- WHERE Country LIKE 'M%' AND Population > 1000000;
-
---replace_column 9 #
-EXPLAIN
-SELECT * FROM City
- WHERE Country='CHN' AND Population > 1500000;
-
---replace_column 9 #
-EXPLAIN
-SELECT * FROM City
- WHERE Country='CHN' AND Population > 1500000 AND Name LIKE 'C%';
-
-
-# Check that the previous 3 plans return the right results when executed
-
---sorted_result
-SELECT * FROM City USE INDEX ()
- WHERE Country LIKE 'M%' AND Population > 1000000;
---sorted_result
-SELECT * FROM City
- WHERE Country LIKE 'M%' AND Population > 1000000;
-
---sorted_result
-SELECT * FROM City USE INDEX ()
- WHERE Country='CHN' AND Population > 1500000;
---sorted_result
-SELECT * FROM City
- WHERE Country='CHN' AND Population > 1500000;
-
-
-SELECT * FROM City USE INDEX ()
- WHERE Country='CHN' AND Population > 1500000 AND Name LIKE 'C%';
-
---sorted_result
-SELECT * FROM City
- WHERE Country='CHN' AND Population > 1500000 AND Name LIKE 'C%';
-
-
-#
-# Bug #754521: wrong cost of index intersection leading
-# to the choice of a suboptimal execution plan
-#
-
---replace_column 9 #
-EXPLAIN
-SELECT * FROM City, Country
- WHERE City.Name LIKE 'C%' AND City.Population > 1000000 AND
- Country.Code=City.Country;
-
-DROP DATABASE world;
-
-use test;
-
-#
-# Bug #684086: crash with EXPLAIN in InnoDB for index intersection
-# of two indexes one of which is primary
-#
-
-CREATE TABLE t1 (
- f1 int,
- f4 varchar(32),
- f5 int,
- PRIMARY KEY (f1),
- KEY (f4)
-);
-
-INSERT INTO t1 VALUES
- (5,'H',1), (9,'g',0), (527,'i',0), (528,'y',1), (529,'S',6),
- (530,'m',7), (531,'b',2), (532,'N',1), (533,'V',NULL), (534,'l',1),
- (535,'M',0), (536,'w',1), (537,'j',5), (538,'l',0), (539,'n',2),
- (540,'m',2), (541,'r',2), (542,'l',2), (543,'h',3),(544,'o',0),
- (956,'h',0), (957,'g',0), (958,'W',5), (959,'s',3), (960,'w',0),
- (961,'q',0), (962,'e',NULL), (963,'u',7), (964,'q',1), (965,'N',NULL),
- (966,'e',0), (967,'t',3), (968,'e',6), (969,'f',NULL), (970,'j',0),
- (971,'s',3), (972,'I',0), (973,'h',4), (974,'g',1), (975,'s',0),
- (976,'r',3), (977,'x',1), (978,'v',8), (979,'j',NULL), (980,'z',7),
- (981,'t',9), (982,'j',5), (983,'u',NULL), (984,'g',6), (985,'w',1),
- (986,'h',1), (987,'v',0), (988,'v',0), (989,'c',2), (990,'b',7),
- (991,'z',0), (992,'M',1), (993,'u',2), (994,'r',2), (995,'b',4),
- (996,'A',2), (997,'u',0), (998,'a',0), (999,'j',2), (1,'I',2);
-
---replace_column 9 #
-EXPLAIN
-SELECT * FROM t1
-WHERE (f1 < 535 OR f1 > 985) AND ( f4='r' OR f4 LIKE 'a%' ) ;
-
---sorted_result
-SELECT * FROM t1
-WHERE (f1 < 535 OR f1 > 985) AND ( f4='r' OR f4 LIKE 'a%' ) ;
-
-DROP TABLE t1;
-
-SET SESSION optimizer_switch='index_merge_sort_intersection=on';
diff --git a/mysql-test/t/index_intersect_innodb.test b/mysql-test/t/index_intersect_innodb.test
deleted file mode 100644
index 22c0e807558..00000000000
--- a/mysql-test/t/index_intersect_innodb.test
+++ /dev/null
@@ -1,7 +0,0 @@
---source include/have_innodb.inc
-
-SET SESSION STORAGE_ENGINE='InnoDB';
-
---source t/index_intersect.test
-
-SET SESSION STORAGE_ENGINE=DEFAULT;
diff --git a/mysql-test/t/index_merge_innodb.test b/mysql-test/t/index_merge_innodb.test
deleted file mode 100644
index 53ce3114b49..00000000000
--- a/mysql-test/t/index_merge_innodb.test
+++ /dev/null
@@ -1,207 +0,0 @@
-# t/index_merge_innodb.test
-#
-# Index merge tests
-#
-# Last update:
-# 2006-08-07 ML test refactored (MySQL 5.1)
-# Main code of several index_merge tests
-# -> include/index_merge*.inc
-# wrapper t/index_merge_innodb.test sources now several
-# include/index_merge*.inc files
-#
-
-# Slow test, don't run during staging part
---source include/not_staging.inc
---source include/have_innodb.inc
-
-let $engine_type= InnoDB;
-# InnoDB does not support Merge tables (affects include/index_merge1.inc)
-let $merge_table_support= 0;
-
-set @optimizer_switch_save= @@optimizer_switch;
-set optimizer_switch='index_merge_sort_intersection=off';
-
-# The first two tests are disabled because of non deterministic explain output.
-# If include/index_merge1.inc can be enabled for InnoDB and all other
-# storage engines, please remove the subtest for Bug#21277 from
-# include/index_merge2.inc.
-# This test exists already in include/index_merge1.inc.
-# --source include/index_merge1.inc
-# --source include/index_merge_ror.inc
-#the next one is disabled in MySQL too: Bug#45727
---source include/index_merge2.inc
-
---source include/index_merge_2sweeps.inc
---source include/index_merge_ror_cpk.inc
-
---echo #
---echo # BUG#56862/640419: Wrong result with sort_union index merge when one
---echo # of the merged index scans is the primary key scan
---echo #
-
-CREATE TABLE t1 (
- pk int NOT NULL AUTO_INCREMENT PRIMARY KEY,
- a int,
- b int,
- INDEX idx(a))
-ENGINE=INNODB;
-
-INSERT INTO t1(a,b) VALUES
- (11, 1100), (2, 200), (1, 100), (14, 1400), (5, 500),
- (3, 300), (17, 1700), (4, 400), (12, 1200), (8, 800),
- (6, 600), (18, 1800), (9, 900), (10, 1000), (7, 700),
- (13, 1300), (15, 1500), (19, 1900), (16, 1600), (20, 2000);
-INSERT INTO t1(a,b) SELECT a+20, b+2000 FROM t1;
-INSERT INTO t1(a,b) SELECT a+40, b+4000 FROM t1;
-INSERT INTO t1(a,b) SELECT a+80, b+8000 FROM t1;
-INSERT INTO t1(a,b) SELECT a,b FROM t1;
-INSERT INTO t1(a,b) SELECT a,b FROM t1;
-INSERT INTO t1(a,b) SELECT a,b FROM t1;
-INSERT INTO t1(a,b) SELECT a,b FROM t1;
-INSERT INTO t1(a,b) SELECT a,b FROM t1;
-INSERT INTO t1(a,b) SELECT a,b FROM t1;
-INSERT INTO t1(a,b) SELECT a,b FROM t1;
-INSERT INTO t1(a,b) SELECT a,b FROM t1;
-INSERT INTO t1(a,b) SELECT a,b FROM t1;
-INSERT INTO t1(a,b) SELECT a,b FROM t1;
-INSERT INTO t1 VALUES (1000000, 0, 0);
-
-SET SESSION sort_buffer_size = 1024*36;
-set @tmp_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='derived_merge=off,derived_with_keys=off';
-
-# We have to use FORCE INDEX here as Innodb gives inconsistent estimates
-# which causes different query plans.
-EXPLAIN
-SELECT COUNT(*) FROM
- (SELECT * FROM t1 FORCE INDEX(primary,idx)
- WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
-SELECT COUNT(*) FROM
- (SELECT * FROM t1 FORCE INDEX(primary,idx)
- WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
-
---replace_column 9 #
-EXPLAIN
-SELECT COUNT(*) FROM
- (SELECT * FROM t1 IGNORE INDEX(idx)
- WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
-SELECT COUNT(*) FROM
- (SELECT * FROM t1 IGNORE INDEX(idx)
- WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t;
-
-DROP TABLE t1;
-set optimizer_switch=@tmp_optimizer_switch;
-
---echo #
---echo # Testcase Backport: BUG#48093: 6.0 Server not processing equivalent IN clauses properly
---echo # with Innodb tables
---echo #
-
-CREATE TABLE t1 (
- i int(11) DEFAULT NULL,
- v1 varchar(1) DEFAULT NULL,
- v2 varchar(20) DEFAULT NULL,
- KEY i (i),
- KEY v (v1,i)
-) ENGINE=innodb;
-
-INSERT INTO t1 VALUES (1,'f','no');
-INSERT INTO t1 VALUES (2,'u','yes-u');
-INSERT INTO t1 VALUES (2,'h','yes-h');
-INSERT INTO t1 VALUES (3,'d','no');
-
---echo
-SELECT v2
-FROM t1
-WHERE v1 IN ('f', 'd', 'h', 'u' ) AND i = 2;
-
---echo
---echo # Should not use index_merge
-EXPLAIN
-SELECT v2
-FROM t1
-WHERE v1 IN ('f', 'd', 'h', 'u' ) AND i = 2;
-
-DROP TABLE t1;
-
---echo #
---echo # BUG#1006164: Multi-table DELETE that uses innodb + index_merge/intersect may fail to delete rows
---echo #
-
-create table t0(a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1 (
- pk int auto_increment,
- zone_id int,
- modified tinyint,
- primary key(pk),
- key (zone_id),
- key (modified)
-) engine=innodb;
-
-insert into t1 (zone_id, modified) select 0,0 from t0 A, t0 B, t0 C, t0 D;
-update t1 set zone_id=487, modified=9 where pk=7259;
-update t1 set zone_id=487, modified=9 where pk=7260;
-update t1 set zone_id=830, modified=9 where pk=8434;
-update t1 set zone_id=830, modified=9 where pk=8435;
-update t1 set zone_id=830, modified=9 where pk=8436;
-update t1 set zone_id=830, modified=9 where pk=8437;
-
-select * from t1 where t1.zone_id=830 AND modified=9;
-begin;
-DELETE t1 FROM t1 WHERE t1.zone_id=830 AND modified=9;
-commit;
-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;
-
---echo #
---echo # MDEV-10927: Crash When Using sort_union Optimization
---echo #
-
-set @tmp_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='index_merge_sort_intersection=on';
-SET SESSION sort_buffer_size = 1024;
-
-create table t1 (
-pk int(11) NOT NULL AUTO_INCREMENT,
-col1 int(11) NOT NULL,
-col2 int(11) NOT NULL,
-col3 int(11) NOT NULL,
-key2 int(11) NOT NULL,
-col4 int(11) NOT NULL,
-key1 int(11) NOT NULL,
-PRIMARY KEY (pk),
-KEY key1 (key1),
-KEY key2 (key2)
-) ENGINE=InnoDB AUTO_INCREMENT=12860259 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;
-
-create table t2(a int);
-insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t3(a int);
-insert into t3 select A.a + B.a* 10 + C.a * 100 + D.a*1000 from t2 A, t2 B, t2 C, t2 D;
-
-insert into t1 (key1, key2, col1,col2,col3,col4)
-select a,a, a,a,a,a from t3;
-SELECT sum(col1) FROM t1 FORCE INDEX (key1,key2) WHERE (key1 between 10 and 8191+10) or (key2= 5);
-drop table t1,t2,t3;
-set optimizer_switch=@tmp_optimizer_switch;
diff --git a/mysql-test/t/index_merge_myisam.test b/mysql-test/t/index_merge_myisam.test
deleted file mode 100644
index d265007431e..00000000000
--- a/mysql-test/t/index_merge_myisam.test
+++ /dev/null
@@ -1,245 +0,0 @@
-# t/index_merge_myisam.test
-#
-# Index merge tests
-#
-# Last update:
-# 2006-08-07 ML test refactored (MySQL 5.1)
-# Main code of several index_merge tests
-# -> include/index_merge*.inc
-# wrapper t/index_merge_innodb.test sources now several
-# include/index_merge*.inc files
-#
-
-let $engine_type= MyISAM;
-# MyISAM supports Merge tables
-let $merge_table_support= 1;
-
-set @optimizer_switch_save= @@optimizer_switch;
-
-set optimizer_switch='index_merge_sort_intersection=off';
-
---source include/index_merge1.inc
---source include/index_merge_ror.inc
---source include/index_merge2.inc
---source include/index_merge_2sweeps.inc
---source include/index_merge_ror_cpk.inc
-
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t1 (a int, b int, c int, filler char(100),
- key(a), key(b), key(c));
-insert into t1 select
- A.a * B.a*10 + C.a*100,
- A.a * B.a*10 + C.a*100,
- A.a,
- 'filler'
-from t0 A, t0 B, t0 C;
-
---echo This should use union:
-explain select * from t1 where a=1 or b=1;
-
---echo This should use ALL:
-set optimizer_switch='default,index_merge=off';
-explain select * from t1 where a=1 or b=1;
-
---echo This should use sort-union:
-set optimizer_switch='default,index_merge_union=off';
-explain select * from t1 where a=1 or b=1;
-
---echo This will use sort-union:
-set optimizer_switch=default;
-explain select * from t1 where a<1 or b <1;
-
---echo This should use ALL:
-set optimizer_switch='default,index_merge_sort_union=off';
-explain select * from t1 where a<1 or b <1;
-
-
---echo This should use ALL:
-set optimizer_switch='default,index_merge=off';
-explain select * from t1 where a<1 or b <1;
-
---echo This will use sort-union:
-set optimizer_switch='default,index_merge_union=off';
-explain select * from t1 where a<1 or b <1;
-
-alter table t1 add d int, add key(d);
-update t1 set d=a;
-
---echo This will use sort_union:
-set optimizer_switch=default;
-explain select * from t1 where (a=3 or b in (1,2)) and (c=3 or d=4);
-
---echo And if we disable sort_union, union:
-set optimizer_switch='default,index_merge_sort_union=off';
-explain select * from t1 where (a=3 or b in (1,2)) and (c=3 or d=4);
-
-drop table t1;
-
-# Now test that intersection can be disabled
-create table t1 (
- a int, b int, c int,
- filler1 char(200), filler2 char(200),
- key(a),key(b),key(c)
-);
-
-insert into t1
-select A.a+10*B.a, A.a+10*B.a, A.a+10*B.a+100*C.a, 'foo', 'bar'
-from t0 A, t0 B, t0 C, t0 D where D.a<5;
-
---echo This should be intersect:
-set optimizer_switch=default;
-explain select * from t1 where a=10 and b=10;
-
---echo No intersect when index_merge is disabled:
-set optimizer_switch='default,index_merge=off';
-explain select * from t1 where a=10 and b=10;
-
---echo No intersect if it is disabled:
-set optimizer_switch='default,index_merge_sort_intersection=off,index_merge_intersection=off';
-explain select * from t1 where a=10 and b=10;
-
---echo Do intersect when union was disabled
-set optimizer_switch='default,index_merge_union=off';
-explain select * from t1 where a=10 and b=10;
-
---echo Do intersect when sort_union was disabled
-set optimizer_switch='default,index_merge_sort_union=off';
-explain select * from t1 where a=10 and b=10;
-
-# Now take union-of-intersection and see how we can disable parts of it
---echo This will use intersection inside a union:
-set optimizer_switch=default;
-explain select * from t1 where a=10 and b=10 or c=10;
-
---echo Should be only union left:
-set optimizer_switch='default,index_merge_intersection=off';
-explain select * from t1 where a=10 and b=10 or c=10;
-
---echo This will switch to sort-union (intersection will be gone, too,
---echo that's a known limitation:
-set optimizer_switch='default,index_merge_union=off';
-explain select * from t1 where a=10 and b=10 or c=10;
-
-set optimizer_switch=default;
-
-drop table t0, t1;
-
-
---echo #
---echo # BUG#834514 Assertion `!table || (!table->read_set || bitmap_is_set(...' with aggregates
---echo #
-CREATE TABLE t1 ( a int , b int, c int, KEY (b), PRIMARY KEY (a)) ;
-INSERT INTO t1 VALUES (1,4,0),(5,0,0),(6,7,0),(7,7,0),(8,1,0),(9,7,0),(10,1,0);
-
-CREATE TABLE t2 ( b int, c int, KEY (c,b)) ;
-INSERT INTO t2 VALUES (7,0),(1,0),(7,0),(1,0);
-
-CREATE TABLE t3 ( a int ) ;
-
-SELECT COUNT(DISTINCT t2.b), CONCAT(t1.c)
-FROM t1, t2
-WHERE (t2.c = t1.c)
-AND (
- t1.b IN ( 4 )
- OR t1.a = 137
- AND EXISTS ( SELECT a FROM t3 )
-)
-GROUP BY 2;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # MDEV-4556 Server crashes in SEL_ARG::rb_insert with index_merge+index_merge_sort_union, FORCE INDEX
---echo #
-CREATE TABLE t1 (
- pk int,
- code char(2),
- population_rate int,
- area_rate int,
- primary key (pk),
- index (code),
- key (population_rate),
- key (area_rate)
-);
-
-INSERT INTO t1 VALUES (1,'WI',20, 23), (2, 'WA', 13, 18);
-
-EXPLAIN
-SELECT * FROM t1 FORCE INDEX ( PRIMARY, population_rate, area_rate, code )
-WHERE pk = 1 OR population_rate = 1 OR ( area_rate IN ( 1,2 ) OR area_rate IS NULL )
-AND (population_rate = 25 OR area_rate BETWEEN 2 AND 25 OR code BETWEEN 'MA' AND 'TX');
-
-SELECT * FROM t1 FORCE INDEX ( PRIMARY, population_rate, area_rate, code )
-WHERE pk = 1 OR population_rate = 1 OR ( area_rate IN ( 1,2 ) OR area_rate IS NULL )
-AND (population_rate = 25 OR area_rate BETWEEN 2 AND 25 OR code BETWEEN 'MA' AND 'TX');
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-5069: Server crashes in SEL_ARG::increment_use_count with index_merge+index_merge_sort_union, FORCE INDEX
---echo #
-
-CREATE TABLE t1 (
- c1 varchar(64),
- i int,
- pk integer auto_increment,
- c2 varchar(64),
- index (c1),
- index (i),
- primary key (pk),
- key (c2)) ENGINE=myisam;
-
-ALTER TABLE t1 DISABLE KEYS;
-
-INSERT INTO t1 VALUES
-('West Virginia', 6121, NULL, 'California'),('Georgia', 60177, NULL, 'Arkansas'),
-('Delaware', 90, NULL, 'Oregon'),('Wyoming', 7, NULL, 'Missouri'),(
-'Delaware', 2, NULL, 'Utah'),('Wisconsin', 0, NULL, 'Iowa'),
-('Kansas', 0, NULL, 'Florida'),('Ohio', 34358, NULL, 'Colorado'),
-('Maine', 118, NULL, 'Texas'),('Mississippi', 0, NULL, 'Georgia'),
-('Tennessee', 4, NULL, 'N/A'),('Georgia', 0, NULL, 'New Hampshire'),
-('Wyoming', 2, NULL, 'N/A'),('Florida', 0, NULL, 'Arizona'),
-('Rhode Island', -24002, NULL, 'Michigan'),('Alabama', 142, NULL, 'Indiana'),
-('Colorado', 0, NULL, 'Louisiana'),('Michigan', 21194, NULL, 'Louisiana'),
-('Oklahoma', 31475, NULL, 'Alabama'),('Pennsylvania', 0, NULL, 'Oklahoma'),
-('Texas', 0, NULL, 'Texas'),('West Virginia', 5, NULL, 'Utah'),
-('Florida', 49653, NULL, 'Kentucky'),('Tennessee', 19075, NULL, 'Oregon'),
-('Maine', 3, NULL, 'Kansas, Kentucky, Iowa'),('Iowa', 1, NULL, 'South Dakota'),
-('Kansas', -4037, NULL, 'Virginia'),('Delaware', 22550, NULL, 'Utah'),
-('Illinois', 14634, NULL, 'South Carolina, Colorado'),
-('Kansas', 6, NULL, 'South Dakota'),('Delaware', 9, NULL, ''),
-('', 0, NULL, 'Utah, Delaware, Florida, Georgia, Nevada'),
-('Colorado', 8, NULL, 'Montana'),('Maryland', 2689, NULL, 'Hawaii'),
-('Florida', -12306, NULL, 'Delaware'),
-('Indiana', 38567, NULL, 'Iowa, Minnesota, Maine'),
-('Oklahoma', 9, NULL, 'Delaware, Kansas, Oregon, Nebraska, Maryland, Minnesota'),
-('Tennessee', 12460, NULL, NULL),('Kentucky', 0, NULL, 'Ohio'),
-('Nevada', 7, NULL, 'Vermont, Oregon, Oklahoma, Montana'),
-('Nebraska', 61966, NULL, 'Nevada'),('Alaska', 131, NULL, 'Louisiana, Maine'),
-('Wisconsin', 4, NULL, 'Nevada'),('South Carolina', 0, NULL, 'Washington'),
-('West Virginia', 51314, NULL, 'Ohio'),('Louisiana', 0, NULL, ''),
-('Pennsylvania', 0, NULL, 'Iowa, Idaho'),('Arkansas', 14010, NULL, 'Indiana'),
-('Wyoming', -15514, NULL, 'Maine'),('Georgia', 0, NULL, 'N/A'),
-('Kentucky', 1, NULL, 'Idaho'),('Wyoming', 60249, NULL, 'Indiana, Iowa'),
-('Pennsylvania', 69, NULL, 'W'),
-('New Mexico', 11480, NULL, 'Florida, Georgia, Hawaii'),
-('South Carolina', 9, NULL, 'Iowa'),('Virginia', 0, NULL, 'Connecticut'),
-('Mississippi', 19749, NULL, 'Rhode Island'),('Illinois', 5, NULL, 'Virginia'),
-('Texas', -1749, NULL, 'Tennessee'),('Arizona', 28, NULL, 'California'),
-('Florida', 62151, NULL, 'Kansas'),('California', 172, NULL, 'SC'),
-('New Jersey', 0, NULL, 'North Carolina'),('Wyoming', 4, NULL, 'I'),
-('Kansas', 10683, NULL, 'California'),('Arkansas', -14275, NULL, 'K'),
-('Arizona', 5, NULL, 'California, Delaware, Rhode Island, Maryland'),
-('Florida', 0, NULL, 'T'),('Alaska', 241, NULL, 'Virginia');
-
-ALTER TABLE t1 ENABLE KEYS;
-
-EXPLAIN
-SELECT * FROM t1 FORCE KEY (PRIMARY , i , c1 , c2)
-WHERE pk = 255 OR i = 22 OR (pk IN (1 , 136) AND c2 IN ('c' , 'w') AND (c1 NOT BETWEEN 'e' AND 'i' OR c2 > 'g')) OR pk != 1 ;
-
-DROP TABLE t1;
-
-set optimizer_switch= @optimizer_switch_save;
-
diff --git a/mysql-test/t/information_schema-big.test b/mysql-test/t/information_schema-big.test
deleted file mode 100644
index 9212348649e..00000000000
--- a/mysql-test/t/information_schema-big.test
+++ /dev/null
@@ -1,45 +0,0 @@
-# This test uses grants, which can't get tested for embedded server
--- source include/big_test.inc
--- source include/not_embedded.inc
--- source include/have_innodb.inc
-
-# check that CSV engine was compiled in, as the result of the test depends
-# on the presence of the log tables (which are CSV-based).
---source include/have_csv.inc
-
---echo #
---echo # Bug#18925: subqueries with MIN/MAX functions on INFORMATION_SCHEMA
---echo #
-
---sorted_result
-SELECT t.table_name, c1.column_name
- FROM information_schema.tables t
- INNER JOIN
- information_schema.columns c1
- ON t.table_schema = c1.table_schema AND
- t.table_name = c1.table_name
- WHERE t.table_schema = 'information_schema' AND
- c1.ordinal_position =
- ( SELECT COALESCE(MIN(c2.ordinal_position),1)
- FROM information_schema.columns c2
- WHERE c2.table_schema = t.table_schema AND
- c2.table_name = t.table_name AND
- c2.column_name LIKE '%SCHEMA%'
- )
- AND t.table_name NOT LIKE 'innodb%';
---sorted_result
-SELECT t.table_name, c1.column_name
- FROM information_schema.tables t
- INNER JOIN
- information_schema.columns c1
- ON t.table_schema = c1.table_schema AND
- t.table_name = c1.table_name
- WHERE t.table_schema = 'information_schema' AND
- c1.ordinal_position =
- ( SELECT COALESCE(MIN(c2.ordinal_position),1)
- FROM information_schema.columns c2
- WHERE c2.table_schema = 'information_schema' AND
- c2.table_name = t.table_name AND
- c2.column_name LIKE '%SCHEMA%'
- )
- AND t.table_name NOT LIKE 'innodb%';
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
deleted file mode 100644
index 1f72d0b6129..00000000000
--- a/mysql-test/t/information_schema.test
+++ /dev/null
@@ -1,1905 +0,0 @@
-# This test uses grants, which can't get tested for embedded server
--- source include/not_embedded.inc
-
-#Don't run this test when thread_pool active
---source include/not_threadpool.inc
-
-# check that CSV engine was compiled in, as the result of the test depends
-# on the presence of the log tables (which are CSV-based).
---source include/have_csv.inc
-
--- source include/have_innodb.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-set global sql_mode="";
-set local sql_mode="";
-
-# Test for information_schema.schemata &
-# show databases
-
---disable_warnings
-DROP TABLE IF EXISTS t0,t1,t2,t3,t4,t5;
-DROP VIEW IF EXISTS v1;
---enable_warnings
-
-
-show variables where variable_name like "skip_show_database";
-grant select, update, execute on test.* to mysqltest_2@localhost;
-grant select, update on test.* to mysqltest_1@localhost;
-create user mysqltest_3@localhost;
-create user mysqltest_3;
-
-
---sorted_result
-select * from information_schema.SCHEMATA where schema_name > 'm';
---sorted_result
-select schema_name from information_schema.schemata;
-show databases like 't%';
-show databases;
-show databases where `database` = 't%';
-
-# Test for information_schema.tables &
-# show tables
-
-create database mysqltest;
-create table mysqltest.t1(a int, b VARCHAR(30), KEY string_data (b));
-create table test.t2(a int);
-create table t3(a int, KEY a_data (a));
-create table mysqltest.t4(a int);
-create table t5 (id int auto_increment primary key);
-insert into t5 values (10);
-create view v1 (c) as
- SELECT table_name FROM information_schema.TABLES
- WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND
- table_name not like 'innodb_%' AND
- table_name not like 'xtradb_%';
---sorted_result
-select * from v1;
-
---sorted_result
-select c,table_name from v1
-inner join information_schema.TABLES v2 on (v1.c=v2.table_name)
-where v1.c like "t%";
-
---sorted_result
-select c,table_name from v1
-left join information_schema.TABLES v2 on (v1.c=v2.table_name)
-where v1.c like "t%";
-
---sorted_result
-select c, v2.table_name from v1
-right join information_schema.TABLES v2 on (v1.c=v2.table_name)
-where v1.c like "t%";
-
---sorted_result
-select table_name from information_schema.TABLES
-where table_schema = "mysqltest" and table_name like "t%";
-
-select * from information_schema.STATISTICS where TABLE_SCHEMA = "mysqltest";
-show keys from t3 where Key_name = "a_data";
-
-show tables like 't%';
---replace_column 8 # 12 # 13 # 19 #
-show table status;
-show full columns from t3 like "a%";
-show full columns from mysql.db like "Insert%";
-show full columns from v1;
-select * from information_schema.COLUMNS where table_name="t1"
-and column_name= "a";
-show columns from mysqltest.t1 where field like "%a%";
-
-create view mysqltest.v1 (c) as select a from mysqltest.t1;
-grant select (a) on mysqltest.t1 to mysqltest_2@localhost;
-grant select on mysqltest.v1 to mysqltest_3;
-connect (user3,localhost,mysqltest_2,,);
-connection user3;
-select table_name, column_name, privileges from information_schema.columns
-where table_schema = 'mysqltest' and table_name = 't1';
-show columns from mysqltest.t1;
-connect (user4,localhost,mysqltest_3,,mysqltest);
-connection user4;
-select table_name, column_name, privileges from information_schema.columns
-where table_schema = 'mysqltest' and table_name = 'v1';
---error ER_VIEW_NO_EXPLAIN
-explain select * from v1;
-connection default;
-disconnect user4;
-
-drop view v1, mysqltest.v1;
-drop tables mysqltest.t4, mysqltest.t1, t2, t3, t5;
-drop database mysqltest;
-
-# Test for information_schema.CHARACTER_SETS &
-# SHOW CHARACTER SET
-
-select * from information_schema.CHARACTER_SETS
-where CHARACTER_SET_NAME like 'latin1%';
-SHOW CHARACTER SET LIKE 'latin1%';
-SHOW CHARACTER SET WHERE charset like 'latin1%';
-
-# Test for information_schema.COLLATIONS &
-# SHOW COLLATION
-
---replace_column 5 #
-select * from information_schema.COLLATIONS
-where COLLATION_NAME like 'latin1%';
---replace_column 5 #
-SHOW COLLATION LIKE 'latin1%';
---replace_column 5 #
-SHOW COLLATION WHERE collation like 'latin1%';
-
-select * from information_schema.COLLATION_CHARACTER_SET_APPLICABILITY
-where COLLATION_NAME like 'latin1%';
-
-# Test for information_schema.ROUTINES &
-#
-
---disable_warnings
-drop procedure if exists sel2;
-drop function if exists sub1;
-drop function if exists sub2;
---enable_warnings
-
-create function sub1(i int) returns int
- return i+1;
-delimiter |;
-create procedure sel2()
-begin
- select * from t1;
- select * from t2;
-end|
-delimiter ;|
-
-#
-# Bug#7222 information_schema: errors in "routines"
-#
-select parameter_style, sql_data_access, dtd_identifier
-from information_schema.routines where routine_schema='test';
-
---replace_column 5 # 6 #
-show procedure status where db='test';
---replace_column 5 # 6 #
-show function status where db='test';
-select a.ROUTINE_NAME from information_schema.ROUTINES a,
-information_schema.SCHEMATA b where
-a.ROUTINE_SCHEMA = b.SCHEMA_NAME AND b.SCHEMA_NAME='test';
---replace_column 3 #
-explain select a.ROUTINE_NAME from information_schema.ROUTINES a,
-information_schema.SCHEMATA b where
-a.ROUTINE_SCHEMA = b.SCHEMA_NAME;
-
-select a.ROUTINE_NAME, b.name from information_schema.ROUTINES a,
-mysql.proc b where a.ROUTINE_NAME = convert(b.name using utf8) AND a.ROUTINE_SCHEMA='test' order by 1;
-select count(*) from information_schema.ROUTINES where routine_schema='test';
-
-create view v1 as select routine_schema, routine_name from information_schema.routines where routine_schema='test'
-order by routine_schema, routine_name;
-select * from v1;
-drop view v1;
-
-connect (user1,localhost,mysqltest_1,,);
-connection user1;
-select ROUTINE_NAME, ROUTINE_DEFINITION from information_schema.ROUTINES;
---error ER_SP_DOES_NOT_EXIST
-show create function sub1;
-connection user3;
-select ROUTINE_NAME, ROUTINE_DEFINITION from information_schema.ROUTINES;
-connection default;
-grant all privileges on test.* to mysqltest_1@localhost;
-connect (user2,localhost,mysqltest_1,,);
-connection user2;
-select ROUTINE_NAME, ROUTINE_DEFINITION from information_schema.ROUTINES;
-create function sub2(i int) returns int
- return i+1;
-select ROUTINE_NAME, ROUTINE_DEFINITION from information_schema.ROUTINES;
-show create procedure sel2;
-show create function sub1;
-show create function sub2;
---replace_column 5 # 6 #
-show function status like "sub2";
-connection default;
-disconnect user1;
-disconnect user3;
-drop function sub2;
-show create procedure sel2;
-
-#
-# Test for views
-#
-create view v0 (c) as select schema_name from information_schema.schemata;
---sorted_result
-select * from v0;
---replace_column 3 #
-explain select * from v0;
-create view v1 (c) as select table_name from information_schema.tables
-where table_name="v1";
-select * from v1;
-create view v2 (c) as select column_name from information_schema.columns
-where table_name="v2";
-select * from v2;
-create view v3 (c) as select CHARACTER_SET_NAME from information_schema.character_sets
-where CHARACTER_SET_NAME like "latin1%";
-select * from v3;
-create view v4 (c) as select COLLATION_NAME from information_schema.collations
-where COLLATION_NAME like "latin1%";
-select * from v4;
-show keys from v4;
---sorted_result
-select * from information_schema.views where TABLE_NAME like "v%";
-drop view v0, v1, v2, v3, v4;
-
-#
-# Test for privileges tables
-#
-create table t1 (a int);
-grant select,update,insert on t1 to mysqltest_1@localhost;
-grant select (a), update (a),insert(a), references(a) on t1 to mysqltest_1@localhost;
-grant all on test.* to mysqltest_1@localhost with grant option;
-select * from information_schema.USER_PRIVILEGES where grantee like '%mysqltest_1%';
-select * from information_schema.SCHEMA_PRIVILEGES where grantee like '%mysqltest_1%';
-select * from information_schema.TABLE_PRIVILEGES where grantee like '%mysqltest_1%';
-select * from information_schema.COLUMN_PRIVILEGES where grantee like '%mysqltest_1%';
-delete from mysql.user where user like 'mysqltest%';
-delete from mysql.db where user like 'mysqltest%';
-delete from mysql.tables_priv where user like 'mysqltest%';
-delete from mysql.columns_priv where user like 'mysqltest%';
-flush privileges;
-drop table t1;
-
-
-#
-# Test for KEY_COLUMN_USAGE & TABLE_CONSTRAINTS tables
-#
-
-create table t1 (a int null, primary key(a));
-alter table t1 add constraint constraint_1 unique (a);
-alter table t1 add constraint unique key_1(a);
-alter table t1 add constraint constraint_2 unique key_2(a);
-show create table t1;
-select * from information_schema.TABLE_CONSTRAINTS where
-TABLE_SCHEMA= "test";
-select * from information_schema.KEY_COLUMN_USAGE where
-TABLE_SCHEMA= "test";
-
-connection user2;
-select table_name from information_schema.TABLES where table_schema like "test%";
-select table_name,column_name from information_schema.COLUMNS where table_schema like "test%";
-select ROUTINE_NAME from information_schema.ROUTINES;
-disconnect user2;
-connection default;
-delete from mysql.user where user='mysqltest_1';
-drop table t1;
-drop procedure sel2;
-drop function sub1;
-
-create table t1(a int);
-create view v1 (c) as select a from t1 with check option;
-create view v2 (c) as select a from t1 WITH LOCAL CHECK OPTION;
-create view v3 (c) as select a from t1 WITH CASCADED CHECK OPTION;
---sorted_result
-select * from information_schema.views;
-grant select (a) on test.t1 to joe@localhost with grant option;
-select * from INFORMATION_SCHEMA.COLUMN_PRIVILEGES;
-select * from INFORMATION_SCHEMA.TABLE_PRIVILEGES;
-drop view v1, v2, v3;
-drop table t1;
-delete from mysql.user where user='joe';
-delete from mysql.db where user='joe';
-delete from mysql.tables_priv where user='joe';
-delete from mysql.columns_priv where user='joe';
-flush privileges;
-
-# QQ This results in NULLs instead of the version numbers when
-# QQ a LOCK TABLES is in effect when selecting from
-# QQ information_schema.tables.
-
---disable_parsing # until bug is fixed
-delimiter //;
-create procedure px5 ()
-begin
-declare v int;
-declare c cursor for select version from
-information_schema.tables where table_schema <> 'information_schema';
-open c;
-fetch c into v;
-select v;
-close c;
-end;//
-
-call px5()//
-call px5()//
-delimiter ;//
-select sql_mode from information_schema.ROUTINES;
-drop procedure px5;
---enable_parsing
-
-create table t1 (a int not null auto_increment,b int, primary key (a));
-insert into t1 values (1,1),(NULL,3),(NULL,4);
-select AUTO_INCREMENT from information_schema.tables where table_name = 't1';
-drop table t1;
-
-create table t1 (s1 int);
-insert into t1 values (0),(9),(0);
---sorted_result
-select s1 from t1 where s1 in (select version from
-information_schema.tables) union select version from
-information_schema.tables;
-drop table t1;
-
-SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets;
-set names latin2;
-SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets;
-set names latin1;
-
-create table t1 select * from information_schema.CHARACTER_SETS
-where CHARACTER_SET_NAME like "latin1";
-select * from t1;
-alter table t1 default character set utf8;
-show create table t1;
-drop table t1;
-
-create view v1 as select * from information_schema.TABLES;
-drop view v1;
-create table t1(a NUMERIC(5,3), b NUMERIC(5,1), c float(5,2),
- d NUMERIC(6,4), e float, f DECIMAL(6,3), g int(11), h DOUBLE(10,3),
- i DOUBLE);
-select COLUMN_NAME,COLUMN_TYPE, CHARACTER_MAXIMUM_LENGTH,
- CHARACTER_OCTET_LENGTH, NUMERIC_PRECISION, NUMERIC_SCALE
-from information_schema.columns where table_name= 't1';
-drop table t1;
-
-create table t115 as select table_name, column_name, column_type
-from information_schema.columns where table_name = 'proc';
-select * from t115;
-drop table t115;
-
-delimiter //;
-create procedure p108 () begin declare c cursor for select data_type
-from information_schema.columns; open c; open c; end;//
---error ER_SP_CURSOR_ALREADY_OPEN
-call p108()//
-delimiter ;//
-drop procedure p108;
-
-create view v1 as select A1.table_name from information_schema.TABLES A1
-where table_name= "user";
-select * from v1;
-drop view v1;
-
-create view vo as select 'a' union select 'a';
-show index from vo;
-select * from information_schema.TABLE_CONSTRAINTS where
-TABLE_NAME= "vo";
-select * from information_schema.KEY_COLUMN_USAGE where
-TABLE_NAME= "vo";
-drop view vo;
-
-select TABLE_NAME,TABLE_TYPE,ENGINE
-from information_schema.tables
-where table_schema='information_schema' limit 2;
---sorted_result
-show tables from information_schema like "T%";
-
---error ER_DBACCESS_DENIED_ERROR
-create database information_schema;
-use information_schema;
---sorted_result
-show full tables like "T%";
---error ER_DBACCESS_DENIED_ERROR
-create table t1(a int);
-use test;
-show tables;
-use information_schema;
---sorted_result
-show tables like "T%";
-
-#
-# Bug#7210 information_schema: can't access when table-name = reserved word
-#
-select table_name from tables where table_name='user';
-select column_name, privileges from columns
-where table_name='user' and column_name like '%o%';
-
-#
-# Bug#7212 information_schema: "Can't find file" errors if storage engine gone
-# Bug#7211 information_schema: crash if bad view
-#
-use test;
-create function sub1(i int) returns int
- return i+1;
-create table t1(f1 int);
-create view v2 (c) as select f1 from t1;
-create view v3 (c) as select sub1(1);
-create table t4(f1 int, KEY f1_key (f1));
-drop table t1;
-drop function sub1;
---sorted_result
-select table_name from information_schema.views
-where table_schema='test';
---sorted_result
-select table_name from information_schema.views
-where table_schema='test';
-select column_name from information_schema.columns
-where table_schema='test' and table_name='t4';
-select column_name from information_schema.columns
-where table_schema='test' and table_name='v2';
-select column_name from information_schema.columns
-where table_schema='test' and table_name='v3';
-select index_name from information_schema.statistics where table_schema='test';
-select constraint_name from information_schema.table_constraints
-where table_schema='test';
-show create view v2;
-show create table v3;
-drop view v2;
-drop view v3;
-drop table t4;
-
-#
-# Bug#7213 information_schema: redundant non-standard TABLE_NAMES table
-#
---error ER_UNKNOWN_TABLE
-select * from information_schema.table_names;
-
-#
-# Bug#2719 information_schema: errors in "columns"
-#
-select column_type from information_schema.columns
-where table_schema="information_schema" and table_name="COLUMNS" and
-(column_name="character_set_name" or column_name="collation_name");
-
-#
-# Bug#2718 information_schema: errors in "tables"
-#
-select TABLE_ROWS from information_schema.tables where
-table_schema="information_schema" and table_name="COLUMNS";
-select table_type from information_schema.tables
-where table_schema="mysql" and table_name="user";
-
-# test for 'show open tables ... where'
-show open tables where `table` like "user";
-# test for 'show status ... where'
-show status where variable_name like "%database%";
-# test for 'show variables ... where'
-show variables where variable_name like "skip_show_databas";
-
-#
-# Bug#7981 SHOW GLOBAL STATUS crashes server
-#
-# We don't actually care about the value, just that it doesn't crash.
---replace_column 2 #
-show global status like "Threads_running";
-
-#
-# Bug#7915 crash,JOIN VIEW, subquery,
-# SELECT .. FROM INFORMATION_SCHEMA.COLUMNS
-#
-create table t1(f1 int);
-create table t2(f2 int);
-create view v1 as select * from t1, t2;
-set @got_val= (select count(*) from information_schema.columns);
-drop view v1;
-drop table t1, t2;
-
-#
-# Bug#7476 crash on SELECT * FROM INFORMATION_SCHEMA.TABLES
-#
-use test;
-CREATE TABLE t_crashme ( f1 BIGINT);
-CREATE VIEW a1 (t_CRASHME) AS SELECT f1 FROM t_crashme GROUP BY f1;
-CREATE VIEW a2 AS SELECT t_CRASHME FROM a1;
-let $tab_count= 65;
---disable_query_log
-while ($tab_count)
-{
- EVAL CREATE TABLE t_$tab_count (f1 BIGINT);
- dec $tab_count ;
-}
---disable_result_log
-SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES;
---enable_result_log
-SELECT count(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test';
-let $tab_count= 65;
-while ($tab_count)
-{
- EVAL DROP TABLE t_$tab_count;
- dec $tab_count ;
-}
---enable_query_log
-drop view a2, a1;
-drop table t_crashme;
-
-#
-# Bug#7215 information_schema: columns are longtext instead of varchar
-# Bug#7217 information_schema: columns are varbinary() instead of timestamp
-#
-select table_schema,table_name, column_name from
-information_schema.columns
-where data_type = 'longtext' and table_schema != 'performance_schema'
-order by binary table_name, ordinal_position;
-select table_name, column_name, data_type from information_schema.columns
-where data_type = 'datetime' and table_name not like 'innodb_%'
-order by binary table_name, ordinal_position;
-
-#
-# Bug#8164 subquery with INFORMATION_SCHEMA.COLUMNS, 100 % CPU
-#
-SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES A
-WHERE NOT EXISTS
-(SELECT * FROM INFORMATION_SCHEMA.COLUMNS B
- WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA
- AND A.TABLE_NAME = B.TABLE_NAME);
-
-#
-# Bug#9344 INFORMATION_SCHEMA, wrong content, numeric columns
-#
-
-create table t1
-( x_bigint BIGINT,
- x_integer INTEGER,
- x_smallint SMALLINT,
- x_decimal DECIMAL(5,3),
- x_numeric NUMERIC(5,3),
- x_real REAL,
- x_float FLOAT,
- x_double_precision DOUBLE PRECISION );
-SELECT COLUMN_NAME, CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH
-FROM INFORMATION_SCHEMA.COLUMNS
-WHERE TABLE_NAME= 't1';
-drop table t1;
-
-#
-# Bug#10261 INFORMATION_SCHEMA.COLUMNS, incomplete result for non root user
-#
-
-grant select on test.* to mysqltest_4@localhost;
-connect (user10261,localhost,mysqltest_4,,);
-connection user10261;
---sorted_result
-SELECT TABLE_NAME, COLUMN_NAME, PRIVILEGES FROM INFORMATION_SCHEMA.COLUMNS
-where COLUMN_NAME='TABLE_NAME' and table_name not like 'innodb%';
-connection default;
-disconnect user10261;
-delete from mysql.user where user='mysqltest_4';
-delete from mysql.db where user='mysqltest_4';
-flush privileges;
-
-#
-# TRIGGERS table test
-#
-create table t1 (i int, j int);
-
-delimiter |;
-create trigger trg1 before insert on t1 for each row
-begin
- if new.j > 10 then
- set new.j := 10;
- end if;
-end|
-create trigger trg2 before update on t1 for each row
-begin
- if old.i % 2 = 0 then
- set new.j := -1;
- end if;
-end|
-create trigger trg3 after update on t1 for each row
-begin
- if new.j = -1 then
- set @fired:= "Yes";
- end if;
-end|
-delimiter ;|
---replace_column 6 #
-show triggers;
---replace_column 17 #
-select * from information_schema.triggers where trigger_schema in ('mysql', 'information_schema', 'test', 'mysqltest');
-
-drop trigger trg1;
-drop trigger trg2;
-drop trigger trg3;
-drop table t1;
-
-
-#
-# Bug#10964 Information Schema:Authorization check on privilege tables is improper
-#
-
-create database mysqltest;
-create table mysqltest.t1 (f1 int, f2 int);
-create table mysqltest.t2 (f1 int);
-grant select (f1) on mysqltest.t1 to user1@localhost;
-grant select on mysqltest.t2 to user2@localhost;
-grant select on mysqltest.* to user3@localhost;
-grant select on *.* to user4@localhost;
-
-connect (con1,localhost,user1,,mysqltest);
-connect (con2,localhost,user2,,mysqltest);
-connect (con3,localhost,user3,,mysqltest);
-connect (con4,localhost,user4,,);
-connection con1;
-select * from information_schema.column_privileges order by grantee;
-select * from information_schema.table_privileges order by grantee;
-select * from information_schema.schema_privileges order by grantee;
-select * from information_schema.user_privileges order by grantee;
-show grants;
-connection con2;
-select * from information_schema.column_privileges order by grantee;
-select * from information_schema.table_privileges order by grantee;
-select * from information_schema.schema_privileges order by grantee;
-select * from information_schema.user_privileges order by grantee;
-show grants;
-connection con3;
-select * from information_schema.column_privileges order by grantee;
-select * from information_schema.table_privileges order by grantee;
-select * from information_schema.schema_privileges order by grantee;
-select * from information_schema.user_privileges order by grantee;
-show grants;
-connection con4;
-select * from information_schema.column_privileges where grantee like '\'user%'
-order by grantee;
-select * from information_schema.table_privileges where grantee like '\'user%'
-order by grantee;
-select * from information_schema.schema_privileges where grantee like '\'user%'
-order by grantee;
-select * from information_schema.user_privileges where grantee like '\'user%'
-order by grantee;
-show grants;
-connection default;
-disconnect con1;
-disconnect con2;
-disconnect con3;
-disconnect con4;
-drop user user1@localhost, user2@localhost, user3@localhost, user4@localhost;
-use test;
-drop database mysqltest;
-
-#
-# Bug#11055 information_schema: routines.sql_data_access has wrong value
-#
---disable_warnings
-drop procedure if exists p1;
-drop procedure if exists p2;
---enable_warnings
-
-create procedure p1 () modifies sql data set @a = 5;
-create procedure p2 () set @a = 5;
-select sql_data_access from information_schema.routines
-where specific_name like 'p%';
-drop procedure p1;
-drop procedure p2;
-
-#
-# Bug#9434 SHOW CREATE DATABASE information_schema;
-#
-show create database information_schema;
-
-#
-# Bug#11057 information_schema: columns table has some questionable contents
-# Bug#12301 information_schema: NUMERIC_SCALE must be 0 for integer columns
-#
-create table t1(f1 LONGBLOB, f2 LONGTEXT);
-select column_name,data_type,CHARACTER_OCTET_LENGTH,
- CHARACTER_MAXIMUM_LENGTH
-from information_schema.columns
-where table_name='t1';
-drop table t1;
-create table t1(f1 tinyint, f2 SMALLINT, f3 mediumint, f4 int,
- f5 BIGINT, f6 BIT, f7 bit(64));
-select column_name, NUMERIC_PRECISION, NUMERIC_SCALE
-from information_schema.columns
-where table_name='t1';
-drop table t1;
-
-#
-# Bug#12127 triggers do not show in info_schema before they are used if set to the database
-#
-create table t1 (f1 integer);
-create trigger tr1 after insert on t1 for each row set @test_var=42;
-use information_schema;
-select trigger_schema, trigger_name from triggers where
-trigger_name='tr1';
-use test;
-drop table t1;
-
-#
-# Bug#12518 COLUMN_DEFAULT has wrong value if NOT NULL is set
-#
-create table t1 (a int not null, b int);
-use information_schema;
-select column_name, column_default from columns
- where table_schema='test' and table_name='t1';
-use test;
-show columns from t1;
-drop table t1;
-
-#
-# Bug#12636 SHOW TABLE STATUS with where condition containing a subquery
-# over information schema
-#
-
-CREATE TABLE t1 (a int);
-CREATE TABLE t2 (b int);
-
---replace_column 8 # 12 # 13 # 19 #
-SHOW TABLE STATUS FROM test
- WHERE name IN ( SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
- WHERE TABLE_SCHEMA='test' AND TABLE_TYPE='BASE TABLE');
-
-DROP TABLE t1,t2;
-
-#
-# Bug#12905 show fields from view behaving erratically with current database
-#
-create table t1(f1 int);
-create view v1 (c) as select f1 from t1;
-connect (con5,localhost,root,,*NO-ONE*);
-select database();
-show fields from test.v1;
-connection default;
-disconnect con5;
-drop view v1;
-drop table t1;
-
-#
-# Bug#9846 Inappropriate error displayed while dropping table from 'INFORMATION_SCHEMA'
-#
---error ER_PARSE_ERROR
-alter database information_schema;
---error ER_DBACCESS_DENIED_ERROR
-drop database information_schema;
---error ER_DBACCESS_DENIED_ERROR
-drop table information_schema.tables;
---error ER_DBACCESS_DENIED_ERROR
-alter table information_schema.tables;
-#
-# Bug#9683 INFORMATION_SCH: Creation of temporary table allowed in Information_schema DB
-#
-use information_schema;
---error ER_DBACCESS_DENIED_ERROR
-create temporary table schemata(f1 char(10));
-#
-# Bug#10708 SP's can use INFORMATION_SCHEMA as ROUTINE_SCHEMA
-#
-delimiter |;
---error ER_DBACCESS_DENIED_ERROR
-CREATE PROCEDURE p1 ()
-BEGIN
- SELECT 'foo' FROM DUAL;
-END |
-delimiter ;|
-select ROUTINE_NAME from routines where ROUTINE_SCHEMA='information_schema';
-#
-# Bug#10734 Grant of privileges other than 'select' and 'create view' should fail on schema
-#
---error ER_DBACCESS_DENIED_ERROR
-grant all on information_schema.* to 'user1'@'localhost';
---error ER_DBACCESS_DENIED_ERROR
-grant select on information_schema.* to 'user1'@'localhost';
-
-#
-# Bug#14089 FROM list subquery always fails when information_schema is current database
-#
-use test;
-create table t1(id int);
-insert into t1(id) values (1);
-select 1 from (select 1 from test.t1) a;
-use information_schema;
-select 1 from (select 1 from test.t1) a;
-use test;
-drop table t1;
-
-#
-# Bug#14476 `information_schema`.`TABLES`.`TABLE_TYPE` with empty value
-#
-create table t1 (f1 int(11));
-create view v1 as select * from t1;
-drop table t1;
-select table_type from information_schema.tables
-where table_name="v1";
-drop view v1;
-
-#
-# Bug#14387 SHOW COLUMNS doesn't work on temporary tables
-# Bug#15224 SHOW INDEX from temporary table doesn't work
-# Bug#12770 DESC cannot display the info. about temporary table
-#
-create temporary table t1(f1 int, index(f1));
-show columns from t1;
-describe t1;
-show indexes from t1;
-drop table t1;
-
-#
-# Bug#14271 I_S: columns has no size for (var)binary columns
-#
-create table t1(f1 binary(32), f2 varbinary(64));
-select character_maximum_length, character_octet_length
-from information_schema.columns where table_name='t1';
-drop table t1;
-
-#
-# Bug#15533 crash, information_schema, function, view
-#
-CREATE TABLE t1 (f1 BIGINT, f2 VARCHAR(20), f3 BIGINT);
-INSERT INTO t1 SET f1 = 1, f2 = 'Schoenenbourg', f3 = 1;
-
-CREATE FUNCTION func2() RETURNS BIGINT RETURN 1;
-
-delimiter //;
-CREATE FUNCTION func1() RETURNS BIGINT
-BEGIN
- RETURN ( SELECT COUNT(*) FROM INFORMATION_SCHEMA.VIEWS);
-END//
-delimiter ;//
-
-CREATE VIEW v1 AS SELECT 1 FROM t1
- WHERE f3 = (SELECT func2 ());
-SELECT func1();
-DROP TABLE t1;
-DROP VIEW v1;
-DROP FUNCTION func1;
-DROP FUNCTION func2;
-
-
-#
-# Bug#15307 GROUP_CONCAT() with ORDER BY returns empty set on information_schema
-#
-select column_type, group_concat(table_schema, '.', table_name), count(*) as num
-from information_schema.columns where
-table_schema='information_schema' and
-(column_type = 'varchar(7)' or column_type = 'varchar(20)'
- or column_type = 'varchar(27)')
-group by column_type order by num;
-
-#
-# Bug#19236 bad COLUMNS.CHARACTER_MAXIMUM_LENGHT and CHARACTER_OCTET_LENGTH
-#
-create table t1(f1 char(1) not null, f2 char(9) not null)
-default character set utf8;
-select CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH from
-information_schema.columns where table_schema='test' and table_name = 't1';
-drop table t1;
-
-#
-# Bug#18177 any access to INFORMATION_SCHEMA.ROUTINES crashes
-#
-use mysql;
-INSERT INTO `proc` VALUES ('test','','PROCEDURE','','SQL','CONTAINS_SQL',
-'NO','DEFINER','','','BEGIN\r\n \r\nEND','root@%','2006-03-02 18:40:03',
-'2006-03-02 18:40:03','','','utf8','utf8_general_ci','utf8_general_ci','n/a', 'NONE');
-select routine_name from information_schema.routines where ROUTINE_SCHEMA='test';
-delete from proc where name='';
-use test;
-
-#
-# Bug#16681 information_schema shows forbidden VIEW details
-#
-grant select on test.* to mysqltest_1@localhost;
-create table t1 (id int);
-create view v1 as select * from t1;
-create definer = mysqltest_1@localhost
-sql security definer view v2 as select 1;
-
-connect (con16681,localhost,mysqltest_1,,test);
-connection con16681;
-
-select * from information_schema.views
-where table_name='v1' or table_name='v2' order by table_name;
-connection default;
-disconnect con16681;
-drop view v1, v2;
-drop table t1;
-drop user mysqltest_1@localhost;
-
-#
-# Bug#19599 duplication of information_schema column value in a CONCAT expr with user var
-#
-set @a:= '.';
-create table t1(f1 char(5));
-create table t2(f1 char(5));
-select concat(@a, table_name), @a, table_name
-from information_schema.tables where table_schema = 'test' order by table_name;
-drop table t1,t2;
-
-
-#
-# Bug#20230 routine_definition is not null
-#
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
-DROP FUNCTION IF EXISTS f1;
---enable_warnings
-
-CREATE PROCEDURE p1() SET @a= 1;
-CREATE FUNCTION f1() RETURNS INT RETURN @a + 1;
-CREATE USER mysql_bug20230@localhost;
-GRANT EXECUTE ON PROCEDURE p1 TO mysql_bug20230@localhost;
-GRANT EXECUTE ON FUNCTION f1 TO mysql_bug20230@localhost;
-
-SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA='test';
-SHOW CREATE PROCEDURE p1;
-SHOW CREATE FUNCTION f1;
-
-connect (conn1, localhost, mysql_bug20230,,);
-
-SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA='test';
-SHOW CREATE PROCEDURE p1;
-SHOW CREATE FUNCTION f1;
-CALL p1();
-SELECT f1();
-
-disconnect conn1;
-connection default;
-
-DROP FUNCTION f1;
-DROP PROCEDURE p1;
-DROP USER mysql_bug20230@localhost;
-
-#
-# Bug#21231 query with a simple non-correlated subquery over
-# INFORMARTION_SCHEMA.TABLES
-#
-
-SELECT MAX(table_name) FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test') and table_name not like 'xtradb%';
-SELECT table_name from information_schema.tables
- WHERE table_name=(SELECT MAX(table_name)
- FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test') and table_name not like 'xtradb%');
-#
-# Bug #23037 Bug in field "Default" of query "SHOW COLUMNS FROM table"
-#
-# Note, MyISAM/InnoDB can't take more that 65532 chars, because the row
-# size is limited to 65535 bytes (BLOBs not counted)
-#
---disable_warnings
-DROP TABLE IF EXISTS bug23037;
-DROP FUNCTION IF EXISTS get_value;
---enable_warnings
---disable_query_log
-DELIMITER |;
-CREATE FUNCTION get_value()
- RETURNS TEXT
- DETERMINISTIC
-BEGIN
- DECLARE col1, col2, col3, col4, col6 CHAR(255);
- DECLARE default_val VARCHAR(65532);
- DECLARE done INT DEFAULT 0;
- DECLARE cur1 CURSOR FOR SELECT COLUMN_NAME, COLUMN_TYPE, IS_NULLABLE, COLUMN_KEY, COLUMN_DEFAULT, EXTRA FROM INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='bug23037';
- DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
- OPEN cur1;
- FETCH cur1 INTO col1, col2, col3, col4, default_val, col6;
- CLOSE cur1;
- RETURN default_val;
-end|
-DELIMITER ;|
-
-let $body=`SELECT REPEAT('A', 65532)`;
-eval CREATE TABLE bug23037(fld1 VARCHAR(65532) CHARACTER SET latin1 DEFAULT "$body");
---enable_query_log
-
-SELECT COLUMN_NAME, MD5(COLUMN_DEFAULT), LENGTH(COLUMN_DEFAULT) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='bug23037';
-
-SELECT MD5(get_value());
-
-SELECT COLUMN_NAME, MD5(COLUMN_DEFAULT), LENGTH(COLUMN_DEFAULT), COLUMN_DEFAULT=get_value() FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='bug23037';
-
-DROP TABLE bug23037;
-DROP FUNCTION get_value;
-
-#
-# Bug#22413 EXPLAIN SELECT FROM view with ORDER BY yield server crash
-#
-set @tmp_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='derived_merge=off,derived_with_keys=off';
-create view v1 as
-select table_schema as object_schema,
- table_name as object_name,
- table_type as object_type
-from information_schema.tables
-order by object_schema;
-explain select * from v1;
-explain select * from (select table_name from information_schema.tables) as a;
-set optimizer_switch=@tmp_optimizer_switch;
-drop view v1;
-
-#
-# Bug#23299 Some queries against INFORMATION_SCHEMA with subqueries fail
-#
-create table t1 (f1 int(11));
-create table t2 (f1 int(11), f2 int(11));
-
-select table_name from information_schema.tables
-where table_schema = 'test' and table_name not in
-(select table_name from information_schema.columns
- where table_schema = 'test' and column_name = 'f3')
-order by table_name;
-drop table t1,t2;
-
-
-#
-# Bug#28266 IS_UPDATABLE field on VIEWS table in I_S database is wrong
-#
-create table t1(f1 int);
-create view v1 as select f1+1 as a from t1;
-create table t2 (f1 int, f2 int);
-create view v2 as select f1+1 as a, f2 as b from t2;
-select table_name, is_updatable from information_schema.views order by table_name;
-#
-# Note: we can perform 'delete' for non updatable view.
-#
-delete from v1;
-drop view v1,v2;
-drop table t1,t2;
-
-#
-# Bug#25859 ALTER DATABASE works w/o parameters
-#
---error ER_PARSE_ERROR
-alter database;
---error ER_PARSE_ERROR
-alter database test;
-
-#
-# Bug#27629 Possible security flaw in INFORMATION_SCHEMA and SHOW statements
-#
-
-create database mysqltest;
-create table mysqltest.t1(a int, b int, c int);
-create trigger mysqltest.t1_ai after insert on mysqltest.t1
- for each row set @a = new.a + new.b + new.c;
-grant select(b) on mysqltest.t1 to mysqltest_1@localhost;
-
-select trigger_name from information_schema.triggers
-where event_object_table='t1';
---replace_column 6 #
-show triggers from mysqltest;
-
-connect (con27629,localhost,mysqltest_1,,mysqltest);
-show columns from t1;
-select column_name from information_schema.columns where table_name='t1';
-
---replace_column 6 #
-show triggers;
-select trigger_name from information_schema.triggers
-where event_object_table='t1';
-connection default;
-disconnect con27629;
-drop user mysqltest_1@localhost;
-drop database mysqltest;
-
-#
-# Bug#27747 database metadata doesn't return sufficient column default info
-#
-create table t1 (
- f1 varchar(50),
- f2 varchar(50) not null,
- f3 varchar(50) default '',
- f4 varchar(50) default NULL,
- f5 bigint not null,
- f6 bigint not null default 10,
- f7 datetime not null,
- f8 datetime default '2006-01-01'
-);
-select column_default from information_schema.columns where table_name= 't1';
-show columns from t1;
-drop table t1;
-
-#
-# Bug#30079 A check for "hidden" I_S tables is flawed
-#
---error ER_UNKNOWN_TABLE
-show fields from information_schema.table_names;
---error ER_UNKNOWN_TABLE
-show keys from information_schema.table_names;
-
-#
-# Bug#34529 Crash on complex Falcon I_S select after ALTER .. PARTITION BY
-#
-USE information_schema;
-SET max_heap_table_size = 16384;
-
-CREATE TABLE test.t1( a INT );
-
-# What we need to create here is a bit of a corner case:
-# We need a star query with information_schema tables, where the first
-# branch of the star join produces zero rows, so that reading of the
-# second branch never happens. At the same time we have to make sure
-# that data for at least the last table is swapped from MEMORY/HEAP to
-# MyISAM. This and only this triggers the bug.
-SELECT *
-FROM tables ta
-JOIN collations co ON ( co.collation_name = ta.table_catalog )
-JOIN character_sets cs ON ( cs.character_set_name = ta.table_catalog );
-
-DROP TABLE test.t1;
-SET max_heap_table_size = DEFAULT;
-USE test;
-
---echo End of 5.0 tests.
-
-#
-# Show engines
-#
-
-select * from information_schema.engines WHERE ENGINE="MyISAM";
-
-#
-# INFORMATION_SCHEMA.PROCESSLIST
-#
-
-grant select on *.* to user3148@localhost;
-connect (con3148,localhost,user3148,,test);
-connection con3148;
-select user,db from information_schema.processlist;
-connection default;
-disconnect con3148;
-drop user user3148@localhost;
-
-#
-# `time` and `time_ms` columns of INFORMATION_SCHEMA.PROCESSLIST.
-#
-connect (pslistcon,localhost,root,,test);
-let $ID= `select connection_id()`;
-SELECT 'other connection here' AS who;
-connection default;
-sleep 2;
---disable_query_log
-eval SET @tid=$ID;
---enable_query_log
-SELECT IF(`time` > 0, 'OK', `time`) AS time_low,
- IF(`time` < 1000, 'OK', `time`) AS time_high,
- IF(time_ms >= 1000, 'OK', time_ms) AS time_ms_low,
- IF(time_ms < 1000000, 'OK', time_ms) AS time_ms_high
- FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE ID=@tid;
-disconnect pslistcon;
-
-#
-# Bug#26174 Server Crash: INSERT ... SELECT ... FROM I_S.GLOBAL_STATUS
-# in Event (see also openssl_1.test)
-#
---disable_warnings
-DROP TABLE IF EXISTS server_status;
-DROP EVENT IF EXISTS event_status;
---enable_warnings
-
-SET GLOBAL event_scheduler=1;
-
-DELIMITER $$;
-
-CREATE EVENT event_status
- ON SCHEDULE AT NOW()
- ON COMPLETION NOT PRESERVE
- DO
-BEGIN
- CREATE TABLE server_status
- SELECT variable_name
- FROM information_schema.global_status
- WHERE variable_name LIKE 'ABORTED_CONNECTS' OR
- variable_name LIKE 'BINLOG_CACHE_DISK_USE';
-END$$
-
-DELIMITER ;$$
-
-let $wait_timeout= 300;
-let $wait_condition=select count(*) = 0 from information_schema.events where event_name='event_status';
---source include/wait_condition.inc
-
-SELECT variable_name FROM server_status;
-
-DROP TABLE server_status;
-SET GLOBAL event_scheduler=0;
-
-
-#
-# WL#3732 Information schema optimization
-#
-
-explain select table_name from information_schema.views where
-table_schema='test' and table_name='v1';
-
-explain select * from information_schema.tables;
-explain select * from information_schema.collations;
-
-explain select * from information_schema.tables where
-table_schema='test' and table_name= 't1';
-explain select table_name, table_type from information_schema.tables
-where table_schema='test';
-
-explain select b.table_name
-from information_schema.tables a, information_schema.columns b
-where a.table_name='t1' and a.table_schema='test' and b.table_name=a.table_name;
-
-#
-# Bug#30310 wrong result on SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE ..
-#
-SELECT * FROM INFORMATION_SCHEMA.SCHEMATA
-WHERE SCHEMA_NAME = 'mysqltest';
-
-SELECT * FROM INFORMATION_SCHEMA.SCHEMATA
-WHERE SCHEMA_NAME = '';
-
-SELECT * FROM INFORMATION_SCHEMA.SCHEMATA
-WHERE SCHEMA_NAME = 'test';
-
-select count(*) from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysql' AND TABLE_NAME='nonexisting';
-select count(*) from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysql' AND TABLE_NAME='';
-select count(*) from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='' AND TABLE_NAME='';
-select count(*) from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='' AND TABLE_NAME='nonexisting';
-
-#
-# Bug#30689 Wrong content in I_S.VIEWS.VIEW_DEFINITION if VIEW is based on I_S
-#
-CREATE VIEW v1
-AS SELECT *
-FROM information_schema.tables;
-SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS where TABLE_NAME = 'v1';
-DROP VIEW v1;
-
-#
-# Bug#30795 Query on INFORMATION_SCHEMA.SCHEMATA, wrong result
-#
-SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA
-WHERE SCHEMA_NAME ='information_schema';
-
-#
-# Bug#31381 Error in retrieving Data from INFORMATION_SCHEMA
-#
-SELECT TABLE_COLLATION FROM INFORMATION_SCHEMA.TABLES
-WHERE TABLE_SCHEMA='mysql' and TABLE_NAME= 'db';
-
-#
-# Bug#31633 Information schema = NULL queries crash the server
-#
-select * from information_schema.columns where table_schema = NULL;
-select * from `information_schema`.`COLUMNS` where `TABLE_NAME` = NULL;
-select * from `information_schema`.`KEY_COLUMN_USAGE` where `TABLE_SCHEMA` = NULL;
-select * from `information_schema`.`KEY_COLUMN_USAGE` where `TABLE_NAME` = NULL;
-select * from `information_schema`.`PARTITIONS` where `TABLE_SCHEMA` = NULL;
-select * from `information_schema`.`PARTITIONS` where `TABLE_NAME` = NULL;
-select * from `information_schema`.`REFERENTIAL_CONSTRAINTS` where `CONSTRAINT_SCHEMA` = NULL;
-select * from `information_schema`.`REFERENTIAL_CONSTRAINTS` where `TABLE_NAME` = NULL;
-select * from information_schema.schemata where schema_name = NULL;
-select * from `information_schema`.`STATISTICS` where `TABLE_SCHEMA` = NULL;
-select * from `information_schema`.`STATISTICS` where `TABLE_NAME` = NULL;
-select * from information_schema.tables where table_schema = NULL;
-select * from information_schema.tables where table_catalog = NULL;
-select * from information_schema.tables where table_name = NULL;
-select * from `information_schema`.`TABLE_CONSTRAINTS` where `TABLE_SCHEMA` = NULL;
-select * from `information_schema`.`TABLE_CONSTRAINTS` where `TABLE_NAME` = NULL;
-select * from `information_schema`.`TRIGGERS` where `EVENT_OBJECT_SCHEMA` = NULL;
-select * from `information_schema`.`TRIGGERS` where `EVENT_OBJECT_TABLE` = NULL;
-select * from `information_schema`.`VIEWS` where `TABLE_SCHEMA` = NULL;
-select * from `information_schema`.`VIEWS` where `TABLE_NAME` = NULL;
-
-#
-# Bug#31630 debug assert with explain extended select ... from i_s
-#
-explain extended select 1 from information_schema.tables;
-
-#
-# Bug#32775 problems with SHOW EVENTS and Information_Schema
-#
-use information_schema;
-show events;
-show events from information_schema;
-show events where Db= 'information_schema';
-use test;
-
---echo #
---echo # Bug#34166 Server crash in SHOW OPEN TABLES and prelocking
---echo #
---disable_warnings
-drop table if exists t1;
-drop function if exists f1;
---enable_warnings
-create table t1 (a int);
-delimiter |;
-create function f1() returns int
-begin
- insert into t1 (a) values (1);
- return 0;
-end|
-delimiter ;|
---disable_result_log
-show open tables where f1()=0;
-show open tables where f1()=0;
---enable_result_log
-drop table t1;
-drop function f1;
-
-#
-# Bug#34656 KILL a query = Assertion failed: m_status == DA_ERROR ||
-# m_status == DA_OK
-#
-connect (conn1, localhost, root,,);
-connection conn1;
-let $ID= `select connection_id()`;
-send select * from information_schema.tables where 1=sleep(100000);
-connection default;
-let $wait_timeout= 10;
-let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='User sleep' and
-info='select * from information_schema.tables where 1=sleep(100000)';
---source include/wait_condition.inc
-disable_query_log;
-eval kill $ID;
-enable_query_log;
-let $wait_timeout= 10;
-let $wait_condition=select count(*)=0 from information_schema.processlist
-where state='User sleep' and
-info='select * from information_schema.tables where 1=sleep(100000)';
---source include/wait_condition.inc
-connection conn1;
---error 2013,ER_CONNECTION_KILLED
-reap;
-connection default;
-disconnect conn1;
-
-connect (conn1, localhost, root,,);
-connection conn1;
-let $ID= `select connection_id()`;
-send select * from information_schema.columns where 1=sleep(100000);
-connection default;
-let $wait_timeout= 10;
-let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='User sleep' and
-info='select * from information_schema.columns where 1=sleep(100000)';
---source include/wait_condition.inc
-disable_query_log;
-eval kill $ID;
-enable_query_log;
-let $wait_timeout= 10;
-let $wait_condition=select count(*)=0 from information_schema.processlist
-where state='User sleep' and
-info='select * from information_schema.columns where 1=sleep(100000)';
---source include/wait_condition.inc
-connection conn1;
---error 2013,ER_CONNECTION_KILLED
-reap;
-connection default;
-disconnect conn1;
-
-
-#
-# Bug#38918 selecting from information_schema.columns is disproportionately slow
-#
-explain select count(*) from information_schema.tables;
-explain select count(*) from information_schema.columns;
-explain select count(*) from information_schema.views;
-
-#
-# Bug#39955 SELECT on INFORMATION_SCHEMA.GLOBAL_VARIABLES takes too long
-#
-set global init_connect="drop table if exists t1;drop table if exists t1;\
-drop table if exists t1;drop table if exists t1;\
-drop table if exists t1;drop table if exists t1;\
-drop table if exists t1;drop table if exists t1;\
-drop table if exists t1;drop table if exists t1;\
-drop table if exists t1;drop table if exists t1;\
-drop table if exists t1;drop table if exists t1;\
-drop table if exists t1;drop table if exists t1;\
-drop table if exists t1;drop table if exists t1;\
-drop table if exists t1;drop table if exists t1;\
-drop table if exists t1;drop table if exists t1;\
-drop table if exists t1;drop table if exists t1;\
-drop table if exists t1;drop table if exists t1;\
-drop table if exists t1;drop table if exists t1;\
-drop table if exists t1;drop table if exists t1;\
-drop table if exists t1;drop table if exists t1;\
-drop table if exists t1;drop table if exists t1;\
-drop table if exists t1;drop table if exists t1;\
-drop table if exists t1;drop table if exists t1;\
-drop table if exists t1;drop table if exists t1;\
-drop table if exists t1;drop table if exists t1;";
-select * from information_schema.global_variables where variable_name='init_connect';
---replace_regex /at row [123]/at row #/
-select * from information_schema.global_variables where variable_name like 'init%' order by variable_name;
-set global init_connect="";
-
-#
-# Bug#34517 SHOW GLOBAL STATUS does not work properly in embedded server.
-#
-
-create table t0 select * from information_schema.global_status where VARIABLE_NAME='COM_SELECT';
-SELECT 1;
-select a.VARIABLE_VALUE - b.VARIABLE_VALUE from t0 b, information_schema.global_status a
- where a.VARIABLE_NAME = b.VARIABLE_NAME;
-drop table t0;
-
-#
-# Bug#35275 INFORMATION_SCHEMA.TABLES.CREATE_OPTIONS omits KEY_BLOCK_SIZE
-#
-CREATE TABLE t1(a INT) KEY_BLOCK_SIZE=1;
-SELECT CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
-DROP TABLE t1;
-
-#
-# Bug #22047: Time in SHOW PROCESSLIST for SQL thread in replication seems
-# to become negative
-#
-# Note that at the time of writing, MariaDB differs in behaviour from MySQL on
-# the `time` column. In MySQL this changes depending on the setting of
-# @TIMESTAMP, which is contrary to the documented (and sensible) behaviour.
-# In MariaDB, the `time` column is independent of @TIMESTAMP.
-# (The rationale for this is to keep `time` and `time_ms` consistent;
-# @TIMESTAMP has no microsecond precision).
-#
-
-SET TIMESTAMP=@@TIMESTAMP + 10000000;
-SELECT 'NOT_OK' AS TEST_RESULT FROM INFORMATION_SCHEMA.PROCESSLIST WHERE time < 0;
-SET TIMESTAMP=DEFAULT;
-
-
---echo #
---echo # Bug #50276: Security flaw in INFORMATION_SCHEMA.TABLES
---echo #
-CREATE DATABASE db1;
-USE db1;
-CREATE TABLE t1 (id INT);
-CREATE USER nonpriv;
-USE test;
-
-connect (nonpriv_con, localhost, nonpriv,,);
-connection nonpriv_con;
---echo # connected as nonpriv
---echo # Should return 0
-SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
-USE INFORMATION_SCHEMA;
---echo # Should return 0
-SELECT COUNT(*) FROM TABLES WHERE TABLE_NAME='t1';
-
-connection default;
---echo # connected as root
-disconnect nonpriv_con;
-DROP USER nonpriv;
-DROP TABLE db1.t1;
-DROP DATABASE db1;
-
---echo
---echo Bug#54422 query with = 'variables'
---echo
-
-CREATE TABLE variables(f1 INT);
-SELECT COLUMN_DEFAULT, TABLE_NAME
-FROM INFORMATION_SCHEMA.COLUMNS
-WHERE INFORMATION_SCHEMA.COLUMNS.TABLE_NAME = 'variables';
-DROP TABLE variables;
-
---echo #
---echo # Bug #53814: NUMERIC_PRECISION for unsigned bigint field is 19,
---echo # should be 20
---echo #
-
-CREATE TABLE ubig (a BIGINT, b BIGINT UNSIGNED);
-
-SELECT TABLE_NAME, COLUMN_NAME, NUMERIC_PRECISION
- FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='ubig';
-
-INSERT INTO ubig VALUES (0xFFFFFFFFFFFFFFFF,0xFFFFFFFFFFFFFFFF);
-SELECT length(CAST(b AS CHAR)) FROM ubig;
-
-DROP TABLE ubig;
-
-#
-# Bug #13889741: HANDLE_FATAL_SIGNAL IN _DB_ENTER_ | HANDLE_FATAL_SIGNAL IN STRNLEN
-#
-select 1 from information_schema.tables where table_schema=repeat('a', 2000);
-grant usage on *.* to mysqltest_1@localhost;
-connect (con1, localhost, mysqltest_1,,);
-connection con1;
-select 1 from information_schema.tables where table_schema=repeat('a', 2000);
-connection default;
-disconnect con1;
-drop user mysqltest_1@localhost;
-
---echo End of 5.1 tests.
-
---echo #
---echo # Additional test for WL#3726 "DDL locking for all metadata objects"
---echo # To avoid possible deadlocks process of filling of I_S tables should
---echo # use high-priority metadata lock requests when opening tables.
---echo # Below we just test that we really use high-priority lock request
---echo # since reproducing a deadlock will require much more complex test.
---echo #
---disable_warnings
-drop tables if exists t1, t2, t3;
---enable_warnings
-create table t1 (i int);
-create table t2 (j int primary key auto_increment);
-connect (con3726_1,localhost,root,,test);
-connection con3726_1;
-lock table t2 read;
-connect (con3726_2,localhost,root,,test);
-connection con3726_2;
---echo # RENAME below will be blocked by 'lock table t2 read' above but
---echo # will add two pending requests for exclusive metadata locks.
---send rename table t2 to t3
-connection default;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info like "rename table t2 to t3";
---source include/wait_condition.inc
---echo # These statements should not be blocked by pending lock requests
-select table_name, column_name, data_type from information_schema.columns
- where table_schema = 'test' and table_name in ('t1', 't2') order by table_name, column_name;
-select table_name, auto_increment from information_schema.tables
- where table_schema = 'test' and table_name in ('t1', 't2') order by table_name;
-connection con3726_1;
-unlock tables;
-connection con3726_2;
---reap
-connection default;
-disconnect con3726_1;
-disconnect con3726_2;
-drop tables t1, t3;
-
-#
-# Bug#39270 I_S optimization algorithm does not work properly in some cases
-#
-EXPLAIN SELECT * FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE;
-EXPLAIN SELECT * FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME='t1';
-EXPLAIN SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS
- WHERE CONSTRAINT_SCHEMA='test';
-EXPLAIN SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS
- WHERE TABLE_NAME='t1' and TABLE_SCHEMA='test';
-EXPLAIN SELECT * FROM INFORMATION_SCHEMA.TRIGGERS
- WHERE EVENT_OBJECT_SCHEMA='test';
-
-#
-# Bug#24062 Incorrect error msg after execute DROP TABLE IF EXISTS on information_schema
-#
---error ER_DBACCESS_DENIED_ERROR
-create table information_schema.t1 (f1 INT);
---error ER_DBACCESS_DENIED_ERROR
-drop table information_schema.t1;
---error ER_DBACCESS_DENIED_ERROR
-drop temporary table if exists information_schema.t1;
---error ER_DBACCESS_DENIED_ERROR
-create temporary table information_schema.t1 (f1 INT);
---error ER_DBACCESS_DENIED_ERROR
-drop view information_schema.v1;
---error ER_DBACCESS_DENIED_ERROR
-create view information_schema.v1;
---error ER_DBACCESS_DENIED_ERROR
-create trigger mysql.trg1 after insert on information_schema.t1 for each row set @a=1;
---error 1109
-create table t1 select * from information_schema.t1;
-
-CREATE TABLE t1(f1 char(100));
---error ER_DBACCESS_DENIED_ERROR
-REPAIR TABLE t1, information_schema.tables;
-CHECKSUM TABLE t1, information_schema.tables;
---error ER_DBACCESS_DENIED_ERROR
-ANALYZE TABLE t1, information_schema.tables;
-CHECK TABLE t1, information_schema.tables;
---error ER_DBACCESS_DENIED_ERROR
-OPTIMIZE TABLE t1, information_schema.tables;
---error ER_DBACCESS_DENIED_ERROR
-RENAME TABLE v1 to v2, information_schema.tables to t2;
---error ER_DBACCESS_DENIED_ERROR
-DROP TABLE t1, information_schema.tables;
-
---error ER_DBACCESS_DENIED_ERROR
-LOCK TABLES t1 READ, information_schema.tables READ;
-DROP TABLE t1;
-
-
-#
-# Bug #43834 Assertion in Natural_join_column::db_name() on an I_S query
-#
-
-SELECT *
-FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
-LEFT JOIN INFORMATION_SCHEMA.COLUMNS
-USING (TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME)
-WHERE COLUMNS.TABLE_SCHEMA = 'test'
-AND COLUMNS.TABLE_NAME = 't1';
-
-
---echo #
---echo # A test case for Bug#56540 "Exception (crash) in sql_show.cc
---echo # during rqg_info_schema test on Windows"
---echo # Ensure that we never access memory of a closed table,
---echo # in particular, never access table->field[] array.
---echo # Before the fix, the below test case, produced
---echo # valgrind errors.
---echo #
-
---disable_warnings
-drop table if exists t1;
-drop view if exists v1;
---enable_warnings
-
-create table t1 (a int, b int);
-create view v1 as select t1.a, t1.b from t1;
-alter table t1 change b c int;
-lock table t1 read;
-connect(con1, localhost, root,,);
-connection con1;
-send flush tables;
-connection default;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table flush" and
- info = "flush tables";
---source include/wait_condition.inc
---vertical_results
-select * from information_schema.views;
---horizontal_results
-unlock tables;
-
---echo #
---echo # Cleanup.
---echo #
-
-connection con1;
---echo # Reaping 'flush tables'
-reap;
-disconnect con1;
---source include/wait_until_disconnected.inc
-connection default;
-drop table t1;
-drop view v1;
-
-
---echo #
---echo # Test for bug #12828477 - "MDL SUBSYSTEM CREATES BIG OVERHEAD FOR
---echo # CERTAIN QUERIES TO INFORMATION_SCHEMA".
---echo #
---echo # Check that metadata locks which are acquired during the process
---echo # of opening tables/.FRMs/.TRG files while filling I_S table are
---echo # not kept to the end of statement. Keeping the locks has caused
---echo # performance problems in cases when big number of tables (.FRMs
---echo # or .TRG files) were scanned as cost of new lock acquisition has
---echo # increased linearly.
---disable_warnings
-drop database if exists mysqltest;
---enable_warnings
-create database mysqltest;
-use mysqltest;
-create table t0 (i int);
-create table t1 (j int);
-create table t2 (k int);
-
---echo #
---echo # Test that we don't keep locks in case when we to fill
---echo # I_S table we perform full-blown table open.
---echo #
-
---echo # Acquire lock on 't2' so upcoming RENAME is
---echo # blocked.
-lock tables t2 read;
-
-connect (con12828477_1, localhost, root,,mysqltest);
---echo # The below RENAME should wait on 't2' while
---echo # keeping X lock on 't1'.
---send rename table t1 to t3, t2 to t1, t3 to t2
-
-connect (con12828477_2, localhost, root,,mysqltest);
---echo # Wait while the above RENAME is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "rename table t1 to t3, t2 to t1, t3 to t2";
---source include/wait_condition.inc
-
---echo # Issue query to I_S which will open 't0' and get
---echo # blocked on 't1' because of RENAME.
---send select table_name, auto_increment from information_schema.tables where table_schema='mysqltest' and table_name='t0' union select table_name, auto_increment from information_schema.tables where table_schema='mysqltest' and table_name<>'t0' order by table_name
-
-connect (con12828477_3, localhost, root,,mysqltest);
---echo # Wait while the above SELECT is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info like '%t0%union%t0%';
---source include/wait_condition.inc
-
---echo #
---echo # Check that it holds no lock on 't0' so it can be renamed.
-rename table t0 to t4;
-
-connection default;
---echo #
---echo # Unblock the first RENAME.
-unlock tables;
-
-connection con12828477_1;
---echo # Reap the first RENAME
---reap
-
-connection con12828477_2;
---echo # Reap SELECT to I_S.
---reap
-
-connection default;
-
---echo #
---echo # Now test that we don't keep locks in case when we to fill
---echo # I_S table we read .FRM or .TRG file only (this was the case
---echo # for which problem existed).
---echo #
-
-rename table t4 to t0;
---echo # Acquire lock on 't2' so upcoming RENAME is
---echo # blocked.
-lock tables t2 read;
-
-connection con12828477_1;
---echo # The below RENAME should wait on 't2' while
---echo # keeping X lock on 't1'.
---send rename table t1 to t3, t2 to t1, t3 to t2
-
-connection con12828477_2;
---echo # Wait while the above RENAME is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "rename table t1 to t3, t2 to t1, t3 to t2";
---source include/wait_condition.inc
-
---echo # Issue query to I_S which will open 't0' and get
---echo # blocked on 't1' because of RENAME.
---send select event_object_table, trigger_name from information_schema.triggers where event_object_schema='mysqltest'
-
-connection con12828477_3;
---echo # Wait while the above SELECT is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "select event_object_table, trigger_name from information_schema.triggers where event_object_schema='mysqltest'";
---source include/wait_condition.inc
-
---echo #
---echo # Check that it holds no lock on 't0' so it can be renamed.
-rename table t0 to t4;
-
-connection default;
---echo #
---echo # Unblock the first RENAME.
-unlock tables;
-
-connection con12828477_1;
---echo # Reap the first RENAME
---reap
-
-connection con12828477_2;
---echo # Reap SELECT to I_S.
---reap
-
-connection default;
-disconnect con12828477_1;
-disconnect con12828477_2;
-disconnect con12828477_3;
-
-
---echo #
---echo # MDEV-3818: Query against view over IS tables worse than equivalent query without view
---echo #
-
-create view v1 as select table_schema, table_name, column_name from information_schema.columns;
-
-explain extended
-select column_name from v1
-where (table_schema = "osm") and (table_name = "test");
-
-explain extended
-select information_schema.columns.column_name as column_name
-from information_schema.columns
-where (information_schema.columns.table_schema = 'osm') and (information_schema.columns.table_name = 'test');
-
-drop view v1;
-
---echo #
---echo # Clean-up.
-drop database mysqltest;
-
---echo #
---echo # Test for bug #16869534 - "QUERYING SUBSET OF COLUMNS DOESN'T USE TABLE
---echo # CACHE; OPENED_TABLES INCREASES"
---echo #
---disable_result_log
-SELECT * FROM INFORMATION_SCHEMA.TABLES;
---enable_result_log
-SELECT VARIABLE_VALUE INTO @val1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE
- VARIABLE_NAME LIKE 'Opened_tables';
---disable_result_log
-SELECT ENGINE FROM INFORMATION_SCHEMA.TABLES;
---enable_result_log
---echo # The below SELECT query should give same output as above SELECT query.
-SELECT VARIABLE_VALUE INTO @val2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE
- VARIABLE_NAME LIKE 'Opened_tables';
---echo # The below select should return '1'
-SELECT @val1 = @val2;
-
---echo #
---echo # End of 5.5 tests
---echo #
-
---echo #
---echo # MDEV-5723: mysqldump -uroot unusable for multi-database operations, checks all databases
---echo #
-
---disable_warnings
-drop database if exists db1;
---enable_warnings
-
-connect (con1,localhost,root,,);
-connection con1;
-
-create database db1;
-use db1;
-create table t1 (a int);
-create table t2 (a int);
-create table t3 (a int);
-
-create database mysqltest;
-use mysqltest;
-create table t1 (a int);
-create table t2 (a int);
-create table t3 (a int);
-
-flush tables;
-flush status;
-
-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 AND
- LOGFILE_GROUP_NAME IN (SELECT DISTINCT LOGFILE_GROUP_NAME
- FROM INFORMATION_SCHEMA.FILES
- WHERE
- FILE_TYPE = 'DATAFILE' AND
- TABLESPACE_NAME IN (SELECT DISTINCT TABLESPACE_NAME
- FROM INFORMATION_SCHEMA.PARTITIONS
- WHERE TABLE_SCHEMA IN ('db1')
- )
- )
-GROUP BY
- LOGFILE_GROUP_NAME, FILE_NAME, ENGINE
-ORDER BY
- LOGFILE_GROUP_NAME;
-
---echo # This must have Opened_tables=3, not 6.
-show status like 'Opened_tables';
-
-drop database mysqltest;
-drop database db1;
-
-connection default;
-disconnect con1;
-
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
-
-set global sql_mode=default;
-
-USE test;
-
---echo #
---echo # End of 10.0 tests
---echo #
-
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
-
---echo #
---echo # MDEV-13242 Wrong results for queries with row constructors and information_schema
---echo #
-
-CREATE TABLE tt1(c1 INT);
-CREATE TABLE tt2(c2 INT);
-SELECT count(*) FROM information_schema.columns WHERE table_schema='test' AND (table_name, column_name) IN (('tt1', 'c1'));
-SELECT count(*) FROM information_schema.columns WHERE table_schema='test' AND (table_name, column_name) IN (('tt2', 'c2'));
-SELECT count(*) FROM information_schema.columns WHERE table_schema='test' AND (table_name, column_name) IN (('tt1','c1'),('tt2', 'c2'));
-SELECT count(*) FROM information_schema.columns WHERE table_schema='test' AND (table_name, column_name) IN (SELECT 'tt1','c1' FROM dual UNION SELECT 'tt2', 'c2' FROM dual);
-SELECT count(*) FROM information_schema.columns WHERE table_schema='test' AND (table_name='tt1' AND column_name='c1') OR (table_name='tt2' AND column_name='c2');
-SELECT column_name FROM information_schema.columns WHERE (table_name, column_name) IN (('tt1','c1'),('tt2', 'c2')) ORDER BY column_name;
-DROP TABLE tt1, tt2;
diff --git a/mysql-test/t/information_schema2.test b/mysql-test/t/information_schema2.test
deleted file mode 100644
index d2fa3da2b5f..00000000000
--- a/mysql-test/t/information_schema2.test
+++ /dev/null
@@ -1,19 +0,0 @@
-
-#
-# MDEV-4029 SELECT on information_schema using a subquery locks up the information_schema table due to incorrect mutexes handling
-#
-select variable_name from information_schema.session_status where variable_name =
-(select variable_name from information_schema.session_status where variable_name = 'uptime');
-select variable_name from information_schema.session_variables where variable_name =
-(select variable_name from information_schema.session_variables where variable_name = 'basedir');
-
-#
-# MDEV-8796 Delete with sub query with information_schema.TABLES deletes too many rows
-#
-create table t1 (x int);
-create table t2 (x int);
-create table t3 (x int);
-create table t4 AS select table_name from information_schema.TABLES where table_schema = database() and table_type = 'BASE TABLE' ;
-delete from t4 where table_name not in (select table_name from information_schema.TABLES where table_schema = database() and table_type = 'BASE TABLE');
-select * from t4 order by table_name;
-drop table t1, t2, t3, t4;
diff --git a/mysql-test/t/information_schema_all_engines-master.opt b/mysql-test/t/information_schema_all_engines-master.opt
deleted file mode 100644
index 43411c5033a..00000000000
--- a/mysql-test/t/information_schema_all_engines-master.opt
+++ /dev/null
@@ -1,18 +0,0 @@
---loose-skip-safemalloc --loose-mutex-deadlock-detector=0
---loose-innodb-changed-pages
---loose-innodb-cmp
---loose-innodb-cmp-per-index
---loose-innodb-cmp-reset
---loose-innodb-cmpmem
---loose-innodb-cmpmem-reset
---loose-innodb-index-stats
---loose-innodb-lock-waits
---loose-innodb-sys-columns
---loose-innodb-sys-fields
---loose-innodb-sys-foreign
---loose-innodb-sys-foreign-cols
---loose-innodb-sys-tables
---loose-innodb-sys-tablestats
---loose-innodb-mutexes
---loose-innodb-tablespaces-encryption
---loose-innodb-tablespaces-scrubbing
diff --git a/mysql-test/t/information_schema_all_engines.test b/mysql-test/t/information_schema_all_engines.test
deleted file mode 100644
index f8d685d2560..00000000000
--- a/mysql-test/t/information_schema_all_engines.test
+++ /dev/null
@@ -1,87 +0,0 @@
-# This file contains tests moved from information_schema.test and
-# information_schema_db.test whose results depends on which engines are
-# available (since these engines inject tables into INFORMATION_SCHEMA).
-
---source include/not_embedded.inc
---source include/have_innodb.inc
---source include/have_perfschema.inc
---source include/not_staging.inc
-
-use INFORMATION_SCHEMA;
---replace_result Tables_in_INFORMATION_SCHEMA Tables_in_information_schema
---sorted_result
-show tables;
-
-#
-# Bug#18925: subqueries with MIN/MAX functions on INFORMATION_SCHEMA
-#
-
---sorted_result
-SELECT t.table_name, c1.column_name
- FROM information_schema.tables t
- INNER JOIN
- information_schema.columns c1
- ON t.table_schema = c1.table_schema AND
- t.table_name = c1.table_name
- WHERE t.table_schema = 'information_schema' AND
- c1.ordinal_position =
- ( SELECT COALESCE(MIN(c2.ordinal_position),1)
- FROM information_schema.columns c2
- WHERE c2.table_schema = t.table_schema AND
- c2.table_name = t.table_name AND
- c2.column_name LIKE '%SCHEMA%'
- ) order by t.table_name;
---sorted_result
-SELECT t.table_name, c1.column_name
- FROM information_schema.tables t
- INNER JOIN
- information_schema.columns c1
- ON t.table_schema = c1.table_schema AND
- t.table_name = c1.table_name
- WHERE t.table_schema = 'information_schema' AND
- c1.ordinal_position =
- ( SELECT COALESCE(MIN(c2.ordinal_position),1)
- FROM information_schema.columns c2
- WHERE c2.table_schema = 'information_schema' AND
- c2.table_name = t.table_name AND
- c2.column_name LIKE '%SCHEMA%'
- ) order by t.table_name;
-
-#
-# Bug#24630 Subselect query crashes mysqld
-#
-select 1 as "must be 1" from information_schema.tables where "ACCOUNTS"=
-(select cast(table_name as char) from information_schema.tables
- order by table_name limit 1) limit 1;
-
-select t.table_name, group_concat(t.table_schema, '.', t.table_name),
- count(*) as num1
-from information_schema.tables t
-inner join information_schema.columns c1
-on t.table_schema = c1.table_schema AND t.table_name = c1.table_name
-where t.table_schema = 'information_schema' and
- c1.ordinal_position =
- (select isnull(c2.column_type) -
- isnull(group_concat(c2.table_schema, '.', c2.table_name)) +
- count(*) as num
- from information_schema.columns c2 where
- c2.table_schema='information_schema' and
- (c2.column_type = 'varchar(7)' or c2.column_type = 'varchar(20)')
- group by c2.column_type order by num limit 1)
-group by t.table_name order by num1, t.table_name;
-
-#
-# Bug #19147: mysqlshow INFORMATION_SCHEMA does not work
-#
---sorted_result
---exec $MYSQL_SHOW information_schema
---sorted_result
---exec $MYSQL_SHOW INFORMATION_SCHEMA
---sorted_result
---exec $MYSQL_SHOW inf_rmation_schema
-
-#
-# Bug #9404 information_schema: Weird error messages
-# with SELECT SUM() ... GROUP BY queries
-#
-SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') GROUP BY TABLE_SCHEMA;
diff --git a/mysql-test/t/information_schema_chmod.test b/mysql-test/t/information_schema_chmod.test
deleted file mode 100644
index 39e2f680bb8..00000000000
--- a/mysql-test/t/information_schema_chmod.test
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Due to "Bug#18474 Unlistable directories yield no info from
-# information_schema, part2" this test can't be run on Window with our
-# current test framework. When "chmod -r" is done within cygwin the
-# MySQL Server can still read the directory.
-# Manual testing shows the functionalty to skip unlistable directories
-# works on windows
-#
---source include/not_windows.inc
-
-# This test uses chmod, can't be run with root permissions
--- source include/not_as_root.inc
-
-
-#
-# Bug #15851 Unlistable directories yield no info from information_schema
-#
-create database mysqltest;
-create table mysqltest.t1(a int);
-let $MYSQLD_DATADIR= `select @@datadir`;
-chmod 0000 $MYSQLD_DATADIR/mysqltest;
-select table_schema from information_schema.tables where table_schema='mysqltest';
-chmod 0777 $MYSQLD_DATADIR/mysqltest;
-drop database mysqltest;
diff --git a/mysql-test/t/information_schema_db.test b/mysql-test/t/information_schema_db.test
deleted file mode 100644
index 94908570969..00000000000
--- a/mysql-test/t/information_schema_db.test
+++ /dev/null
@@ -1,257 +0,0 @@
-# this test mostly test privilege control (what doesn't work
-# in the embedded server by default). So skip the test in embedded-server mode.
--- source include/not_embedded.inc
-
-#Don't run this test when thread_pool active
---source include/not_threadpool.inc
-
--- source include/testdb_only.inc
-
-set local sql_mode="";
-set global sql_mode="";
-
---disable_warnings
-drop table if exists t1,t2;
-drop view if exists v1,v2;
-drop function if exists f1;
-drop function if exists f2;
---enable_warnings
-
---replace_result 'Tables_in_INFORMATION_SCHEMA (T%)' 'Tables_in_information_schema (T%)'
---sorted_result
-show tables from INFORMATION_SCHEMA like 'T%';
-create database `inf%`;
-create database mbase;
-use `inf%`;
-show tables;
-
-#
-# Bug#18113 SELECT * FROM information_schema.xxx crashes server
-# Bug#17204 second CALL to procedure crashes Server
-# Crash happened when one selected data from one of INFORMATION_SCHEMA
-# tables and in order to build its contents server had to open view which
-# used stored function and table or view on which one had not global or
-# database-level privileges (e.g. had only table-level or had no
-# privileges at all).
-#
-grant all privileges on `inf%`.* to 'mysqltest_1'@'localhost';
-grant all privileges on `mbase`.* to 'mysqltest_1'@'localhost';
-create table t1 (f1 int);
-delimiter |;
-create function func1(curr_int int) returns int
-begin
- declare ret_val int;
- select max(f1) from t1 into ret_val;
- return ret_val;
-end|
-delimiter ;|
-create view v1 as select f1 from t1 where f1 = func1(f1);
-create function func2() returns int return 1;
-
-use mbase;
-delimiter |;
-create procedure p1 ()
-begin
-select table_name from information_schema.key_column_usage
-order by table_name;
-end|
-delimiter ;|
-
-create table t1
-(f1 int(10) unsigned not null,
- f2 varchar(100) not null,
- primary key (f1), unique key (f2));
-
-connect (user1,localhost,mysqltest_1,,);
-connection user1;
---disable_result_log
-select * from information_schema.tables;
-call mbase.p1();
-call mbase.p1();
-call mbase.p1();
---enable_result_log
-
-connection default;
-use `inf%`;
-drop user mysqltest_1@localhost;
-drop table t1;
-select table_name, table_type, table_comment from information_schema.tables
-where table_schema='inf%' and func2();
-select table_name, table_type, table_comment from information_schema.tables
-where table_schema='inf%' and func2();
-drop view v1;
-drop function func1;
-drop function func2;
-
-drop database `inf%`;
-drop procedure mbase.p1;
-drop database mbase;
-disconnect user1;
-
-#
-# Bug#18282 INFORMATION_SCHEMA.TABLES provides inconsistent info about invalid views
-#
-use test;
-create table t1 (i int);
-create function f1 () returns int return (select max(i) from t1);
-create view v1 as select f1();
-create table t2 (id int);
-create function f2 () returns int return (select max(i) from t2);
-create view v2 as select f2();
-drop table t2;
-select table_name, table_type, table_comment from information_schema.tables
-where table_schema='test' order by table_name;
-drop table t1;
-select table_name, table_type, table_comment from information_schema.tables
-where table_schema='test' order by table_name;
-drop function f1;
-drop function f2;
-drop view v1, v2;
-
-#
-# Bug#20543 select on information_schema strange warnings, view, different
-# schemas/users
-#
-#
-create database testdb_1;
-create user testdb_1@localhost;
-grant all on testdb_1.* to testdb_1@localhost with grant option;
-
-create user testdb_2@localhost;
-grant all on test.* to testdb_2@localhost with grant option;
-
-connect (testdb_1,localhost,testdb_1,,test);
-use testdb_1;
-create table t1 (f1 char(4));
-create view v1 as select f1 from t1;
-grant insert on v1 to testdb_2@localhost;
-
-create view v5 as select f1 from t1;
-grant select, show view on v5 to testdb_2@localhost;
-
---error ER_SPECIFIC_ACCESS_DENIED_ERROR
-create definer=`no_such_user`@`no_such_host` view v6 as select f1 from t1;
-
-connection default;
-use testdb_1;
-create view v6 as select f1 from t1;
-grant select, show view on v6 to testdb_2@localhost;
-
-create table t2 (f1 char(4));
-create definer=`no_such_user`@`no_such_host` view v7 as select * from t2;
-
-show fields from testdb_1.v6;
-show create view testdb_1.v6;
-
-show create view testdb_1.v7;
-show fields from testdb_1.v7;
-
-connection testdb_1;
-
-create table t3 (f1 char(4), f2 char(4));
-create view v3 as select f1,f2 from t3;
-grant insert(f1), insert(f2) on v3 to testdb_2@localhost;
-
-connect (testdb_2,localhost,testdb_2,,test);
-create view v2 as select f1 from testdb_1.v1;
-create view v4 as select f1,f2 from testdb_1.v3;
-
-show fields from testdb_1.v5;
-show create view testdb_1.v5;
-
-show fields from testdb_1.v6;
-show create view testdb_1.v6;
-
-connection testdb_1;
-show fields from testdb_1.v7;
-show create view testdb_1.v7;
-
-revoke insert(f1) on v3 from testdb_2@localhost;
-revoke select,show view on v5 from testdb_2@localhost;
-connection default;
-use testdb_1;
-revoke select,show view on v6 from testdb_2@localhost;
-connection testdb_2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-show fields from testdb_1.v5;
---error ER_TABLEACCESS_DENIED_ERROR
-show create view testdb_1.v5;
-
---error ER_TABLEACCESS_DENIED_ERROR
-show fields from testdb_1.v6;
---error ER_TABLEACCESS_DENIED_ERROR
-show create view testdb_1.v6;
-
---error ER_TABLEACCESS_DENIED_ERROR
-show fields from testdb_1.v7;
---error ER_TABLEACCESS_DENIED_ERROR
-show create view testdb_1.v7;
-
-show create view v4;
-#--error ER_VIEW_NO_EXPLAIN
-show fields from v4;
-
-show fields from v2;
-show fields from testdb_1.v1;
-show create view v2;
---error ER_TABLEACCESS_DENIED_ERROR
-show create view testdb_1.v1;
-
-select table_name from information_schema.columns a
-where a.table_name = 'v2';
-select view_definition from information_schema.views a
-where a.table_name = 'v2';
-select view_definition from information_schema.views a
-where a.table_name = 'testdb_1.v1';
-
---error ER_VIEW_INVALID
-select * from v2;
-
-connection default;
-use test;
-drop view testdb_1.v1, v2, testdb_1.v3, v4;
-drop database testdb_1;
-connection testdb_1;
-disconnect testdb_1;
---source include/wait_until_disconnected.inc
-connection testdb_2;
-disconnect testdb_2;
---source include/wait_until_disconnected.inc
-connection default;
-drop user testdb_1@localhost;
-drop user testdb_2@localhost;
-
-#
-# Bug#22763 Disrepancy between SHOW CREATE VIEW and I_S.VIEWS
-#
-create database testdb_1;
-create table testdb_1.t1 (a int);
-create view testdb_1.v1 as select * from testdb_1.t1;
-
-grant show view on testdb_1.* to mysqltest_1@localhost;
-grant select on testdb_1.v1 to mysqltest_1@localhost;
-
-connect (user1,localhost,mysqltest_1,,test);
-connection user1;
-select table_schema, table_name, view_definition from information_schema.views
-where table_name='v1';
-show create view testdb_1.v1;
-
-connection default;
-revoke select on testdb_1.v1 from mysqltest_1@localhost;
-connection user1;
-select table_schema, table_name, view_definition from information_schema.views
-where table_name='v1';
---error ER_TABLEACCESS_DENIED_ERROR
-show create view testdb_1.v1;
-
-connection default;
-drop user mysqltest_1@localhost;
-drop database testdb_1;
-connection user1;
-disconnect user1;
---source include/wait_until_disconnected.inc
-connection default;
-
-set global sql_mode=default;
diff --git a/mysql-test/t/information_schema_inno.test b/mysql-test/t/information_schema_inno.test
deleted file mode 100644
index 3cdbb8111d9..00000000000
--- a/mysql-test/t/information_schema_inno.test
+++ /dev/null
@@ -1,121 +0,0 @@
--- source include/testdb_only.inc
--- source include/have_innodb.inc
---disable_warnings
-DROP TABLE IF EXISTS t1,t2,t3;
---enable_warnings
-
-#
-# Test for KEY_COLUMN_USAGE & TABLE_CONSTRAINTS tables
-#
-
-CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
-CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id, id),
-FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE,
-FOREIGN KEY (t1_id) REFERENCES t1(id) ON UPDATE CASCADE) ENGINE=INNODB;
-
-CREATE TABLE t3 (id INT PRIMARY KEY, t2_id INT, INDEX par_ind (t2_id),
-FOREIGN KEY (id, t2_id) REFERENCES t2(t1_id, id) ON DELETE CASCADE) ENGINE=INNODB;
-
---sorted_result
-select * from information_schema.TABLE_CONSTRAINTS where
-TABLE_SCHEMA= "test";
---sorted_result
-select * from information_schema.KEY_COLUMN_USAGE where
-TABLE_SCHEMA= "test";
-
-drop table t3, t2, t1;
-
-#
-# Test for REFERENTIAL_CONSTRAINTS table
-#
-CREATE TABLE t1(a1 INT NOT NULL, a2 INT NOT NULL,
- PRIMARY KEY(a1, a2)) ENGINE=INNODB;
-CREATE TABLE t2(b1 INT, b2 INT, INDEX (b1, b2),
- CONSTRAINT A1
- FOREIGN KEY (b1, b2) REFERENCES t1(a1, a2)
- ON UPDATE CASCADE ON DELETE NO ACTION) ENGINE=INNODB;
-CREATE TABLE t3(b1 INT, b2 INT, INDEX t3_indx (b1, b2),
- CONSTRAINT A2
- FOREIGN KEY (b1, b2) REFERENCES t2(b1, b2)
- ON UPDATE SET NULL ON DELETE RESTRICT) ENGINE=INNODB;
-CREATE TABLE t4(b1 INT, b2 INT, UNIQUE KEY t4_ukey (b1, b2),
- CONSTRAINT A3
- FOREIGN KEY (b1, b2) REFERENCES t3(b1, b2)
- ON UPDATE NO ACTION ON DELETE SET NULL) ENGINE=INNODB;
-CREATE TABLE t5(b1 INT, b2 INT, INDEX (b1, b2),
- CONSTRAINT A4
- FOREIGN KEY (b1, b2) REFERENCES t4(b1, b2)
- ON UPDATE RESTRICT ON DELETE CASCADE) ENGINE=INNODB;
-
---sorted_result
-select a.CONSTRAINT_SCHEMA, b.TABLE_NAME, CONSTRAINT_TYPE,
- b.CONSTRAINT_NAME, UNIQUE_CONSTRAINT_SCHEMA, UNIQUE_CONSTRAINT_NAME,
- MATCH_OPTION, UPDATE_RULE, DELETE_RULE, b.REFERENCED_TABLE_NAME
-from information_schema.TABLE_CONSTRAINTS a,
- information_schema.REFERENTIAL_CONSTRAINTS b
-where a.CONSTRAINT_SCHEMA = 'test' and a.CONSTRAINT_SCHEMA = b.CONSTRAINT_SCHEMA and
-a.CONSTRAINT_NAME = b.CONSTRAINT_NAME;
-drop tables t5, t4, t3, t2, t1;
-
-#
-# Bug#25026 `information_schema.KEY_COLUMN_USAGE`.`REFERENCED_TABLE_NAME` returns garbage
-#
-create database `db-1`;
-use `db-1`;
-create table `t-2` (
- id int(10) unsigned not null auto_increment,
- primary key (id)
-) engine=innodb;
-
-create table `t-1` (
- id int(10) unsigned not null auto_increment,
- idtype int(10) unsigned not null,
- primary key (id),
- key fk_t1_1 (idtype),
- constraint fk_t1_1 foreign key (idtype) references `t-2` (id)
-) engine=innodb;
-use test;
-select referenced_table_schema, referenced_table_name
-from information_schema.key_column_usage
-where constraint_schema = 'db-1'
-order by referenced_table_schema, referenced_table_name;
-drop database `db-1`;
-
-#
-# Bug#35108 SELECT FROM REFERENTIAL_CONSTRAINTS crashes
-#
-create table t1(id int primary key) engine = Innodb;
-create table t2(pid int, foreign key (pid) references t1(id)) engine = Innodb;
-set foreign_key_checks = 0;
-drop table t1;
-select UNIQUE_CONSTRAINT_NAME
-from information_schema.referential_constraints
-where constraint_schema = schema();
-drop table t2;
-set foreign_key_checks = 1;
-
-
---echo #
---echo # Bug#55973 Assertion `thd->transaction.stmt.is_empty()'
---echo # on CREATE TABLE .. SELECT I_S.PART
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP VIEW IF EXISTS v1;
---enable_warnings
-
-CREATE VIEW v1 AS SELECT 1;
-# This used to case an assert.
-CREATE TABLE t1 engine = InnoDB AS
- SELECT * FROM information_schema.partitions
- WHERE table_schema= 'test' AND table_name= 'v1';
-
-DROP TABLE t1;
-DROP VIEW v1;
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval CREATE TABLE t1(i int) ENGINE=Innodb ROW_FORMAT=REDUNDANT DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp';
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-SELECT CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES where TABLE_NAME='t1';
-DROP TABLE t1;
diff --git a/mysql-test/t/information_schema_linux.test b/mysql-test/t/information_schema_linux.test
deleted file mode 100644
index 0e3170080c3..00000000000
--- a/mysql-test/t/information_schema_linux.test
+++ /dev/null
@@ -1,10 +0,0 @@
---source include/linux.inc
-
---echo #
---echo # MDEV-6756: map a linux pid (child pid) to a connection id shown in
---echo # the output of SHOW PROCESSLIST
---echo #
---connect (con1,localhost,root)
-SELECT max(tid) != min(tid) FROM information_schema.processlist;
---connection default
---disconnect con1
diff --git a/mysql-test/t/information_schema_parameters.test b/mysql-test/t/information_schema_parameters.test
deleted file mode 100644
index bf25a6757f0..00000000000
--- a/mysql-test/t/information_schema_parameters.test
+++ /dev/null
@@ -1,276 +0,0 @@
-#------------------------------------------------------------------------------
-# i_s_parameters.test
-# .test file for MySQL regression suite
-# Purpose: To test the presence, structure, and behavior
-# of INFORMATION_SCHEMA.PARAMETERS
-# Author: pcrews
-# Last modified: 2007-12-03
-#------------------------------------------------------------------------------
-
-###############################################################################
-# Testcase parameters.1: Verify INFORMATION_SCHEMA.PARAMETERS view has the
-# following structure:
-# SPECIFIC_CATALOG NULL
-# SPECIFIC_SCHEMA routine's database
-# SPECIFIC_NAME routine's name
-# ORDINAL_POSITION first stored routine parameter is 1,
-# always 0 for stored function RETURN
-# PARAMETER_MODE 'IN' or 'OUT' or 'INOUT'
-# PARAMETER_NAME the parameter's name
-# DATA_TYPE same as for COLUMNS
-# CHARACTER_MAXIMUM_LENGTH same as for COLUMNS
-# CHARACTER_OCTET_LENGTH same as for COLUMNS
-# CHARACTER_SET_NAME same as for COLUMNS
-# COLLATION_NAME same as for COLUMNS
-# NUMERIC_PRECISION same as for COLUMNS
-# NUMERIC_SCALE same as for COLUMNS
-# DTD_IDENTIFIER same as for PARAMETERS
-###############################################################################
--- echo # ========== parameters.1 ==========
-USE INFORMATION_SCHEMA;
---replace_result ENGINE=MyISAM "" ENGINE=MARIA "" ENGINE=Aria "" " PAGE_CHECKSUM=1" "" " PAGE_CHECKSUM=0" ""
-SHOW CREATE TABLE INFORMATION_SCHEMA.PARAMETERS;
-
-# embedded server does not display privileges
---replace_column 19 #
-query_vertical SELECT * FROM information_schema.columns
-WHERE table_schema = 'information_schema'
- AND table_name = 'parameters'
-ORDER BY ordinal_position;
-
-DESCRIBE INFORMATION_SCHEMA.PARAMETERS;
-
-###############################################################################
-# Testcase parameters.2: Unsuccessful stored procedure CREATE will not populate
-# I_S.PARAMETERS view
-###############################################################################
--- echo # ========== parameters.2 ==========
---disable_warnings
-DROP DATABASE IF EXISTS i_s_parameters_test;
---enable_warnings
-
-CREATE DATABASE i_s_parameters_test;
-USE i_s_parameters_test;
-
-# Missing closing ')' character at the end of 's char(20) in func declaration
---error ER_PARSE_ERROR
-CREATE FUNCTION test_func1 (s char(20) RETURNS CHAR(50)
-RETURN CONCAT('Hello', ,s,'!');
-SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
-WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' AND SPECIFIC_NAME = 'test_func1';
-
-###############################################################################
-# Testcase parameters.3: DROP FUNCTION - Verify DROP of a stored procedure
-# removes I_S.PARAMETERS data for that
-# function / procedure
-###############################################################################
--- echo # ========== parameters.3 ==========
---disable_warnings
-DROP DATABASE IF EXISTS i_s_parameters_test;
---enable_warnings
-
-CREATE DATABASE i_s_parameters_test;
-USE i_s_parameters_test;
-
-CREATE FUNCTION test_func1 (s char(20)) RETURNS CHAR(50)
-RETURN CONCAT('Hello, ',s,'!');
-SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
-WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' AND SPECIFIC_NAME = 'test_func1';
-DROP FUNCTION test_func1;
-SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
-WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' AND SPECIFIC_NAME = 'test_func1';
-
-###############################################################################
-# Testcase parameters.4: CREATE PROCEDURE - IN
-###############################################################################
--- echo # ========== parameters.4 ==========
---disable_warnings
-DROP DATABASE IF EXISTS i_s_parameters_test;
---enable_warnings
-
-CREATE DATABASE i_s_parameters_test;
-USE i_s_parameters_test;
-
-delimiter //;
-CREATE PROCEDURE testproc (OUT param1 INT)
- BEGIN
- SELECT 2+2 as param1;
- END;
-//
-delimiter ;//
-SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
-WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' AND SPECIFIC_NAME = 'testproc';
-
-
-###############################################################################
-# Testcase parameters.5: CREATE PROCEDURE - INOUT
-###############################################################################
--- echo # ========== parameters.5 ==========
---disable_warnings
-DROP DATABASE IF EXISTS i_s_parameters_test;
---enable_warnings
-
-CREATE DATABASE i_s_parameters_test;
-USE i_s_parameters_test;
-
-CREATE PROCEDURE test_proc(INOUT P INT) SET @x=P*2;
-SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
-WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' AND SPECIFIC_NAME = 'test_proc';
-
-###############################################################################
-# Testcase parameters.6: CREATE PROCEDURE - OUT
-###############################################################################
--- echo # ========== parameters.6 ==========
---disable_warnings
-DROP DATABASE IF EXISTS i_s_parameters_test;
---enable_warnings
-
-CREATE DATABASE i_s_parameters_test;
-USE i_s_parameters_test;
-
-CREATE PROCEDURE test_proc(OUT p VARCHAR(10)) SET P='test';
-SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
-WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' AND SPECIFIC_NAME = 'test_proc';
-
-###############################################################################
-# Testcase parameters.7: CREATE FUNCTION - ORDINAL POSITION
-# Verify proper behavior for several aspects here
-# 3 rows should be created -- 1 for each IN parameter
-# 1 for the RETURNS param
-# ORDINAL POSITION values should be 0 for RETURNS
-# 1 and 2 for IN parameters
-# PARAM NAME and MODE should = NULL for RETURNS parm
-###############################################################################
--- echo # ========== parameters.7 ==========
---disable_warnings
-DROP DATABASE IF EXISTS i_s_parameters_test;
---enable_warnings
-
-CREATE DATABASE i_s_parameters_test;
-USE i_s_parameters_test;
-
-CREATE FUNCTION test_func1 (s char(20), t char(20)) RETURNS CHAR(40)
-RETURN CONCAT(s,t);
-SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
-WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' AND SPECIFIC_NAME = 'test_func1';
-
-###############################################################################
-# Testcase parameters.8: CREATE FUNCTION - CHAR parameters
-# Verify CHAR related columns are populated for such a
-# parameter -- NUMERIC columns should be NULL
-###############################################################################
--- echo # ========== parameters.8 ==========
---disable_warnings
-DROP DATABASE IF EXISTS i_s_parameters_test;
---enable_warnings
-
-CREATE DATABASE i_s_parameters_test;
-USE i_s_parameters_test;
-
-CREATE FUNCTION test_func1 (s char(20)) RETURNS CHAR(50)
-RETURN CONCAT('Hello, ',s,'!');
-SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
-WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' AND SPECIFIC_NAME = 'test_func1';
-
-###############################################################################
-# Testcase parameters.9: CREATE FUNCTION - NUMERIC parameters
-# Verify NUMERIC related columns are populated for such
-# parameter -- CHAR columns should be NULL
-###############################################################################
--- echo # ========== parameters.9 ==========
---disable_warnings
-DROP DATABASE IF EXISTS i_s_parameters_test;
---enable_warnings
-
-CREATE DATABASE i_s_parameters_test;
-USE i_s_parameters_test;
-
-CREATE FUNCTION test_func2 (s int) RETURNS INT RETURN s*2;
-SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
-WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' AND SPECIFIC_NAME = 'test_func2';
-
-###############################################################################
-# Testcase parameters.10: CREATE FUNCTION - DATE
-# Verify NUMERIC and CHAR related columns are NULL
-###############################################################################
--- echo # ========== parameters.10 ==========
---disable_warnings
-DROP DATABASE IF EXISTS i_s_parameters_test;
---enable_warnings
-
-CREATE DATABASE i_s_parameters_test;
-USE i_s_parameters_test;
-
-CREATE FUNCTION test_func5 (s date) RETURNS TIMESTAMP
-RETURN CURRENT_TIMESTAMP;
-SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
-WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' AND SPECIFIC_NAME = 'test_func5';
-
-###############################################################################
-# Testcase parameters.11: ALTER FUNCTION
-# Quick check to ensure ALTER doesn't affect this view
-# Should have no effect -- comment visible in ROUTINES
-# tested in i_s_routines.test
-###############################################################################
--- echo # ========== parameters.11 ==========
---disable_warnings
-DROP DATABASE IF EXISTS i_s_parameters_test;
---enable_warnings
-
-CREATE DATABASE i_s_parameters_test;
-USE i_s_parameters_test;
-
-CREATE FUNCTION test_func5 (s date) RETURNS TIMESTAMP
-RETURN CURRENT_TIMESTAMP;
-SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
-WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' AND SPECIFIC_NAME = 'test_func5';
-ALTER FUNCTION test_func5 COMMENT 'new comment added';
-SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
-WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' AND SPECIFIC_NAME = 'test_func5';
-
-###############################################################################
-# Testcase parameters.12: MULTI-BYTE CHAR SETS
-# Verify that CHAR_MAX_LENGTH and CHAR_OCTET_LENGTH
-# differ as expected for multi-byte char sets
-# Normally both values are equal
-###############################################################################
--- echo # ========== parameters.12 ==========
---disable_warnings
-DROP DATABASE IF EXISTS i_s_parameters_test;
---enable_warnings
-
-CREATE DATABASE i_s_parameters_test CHARACTER SET utf8;
-USE i_s_parameters_test;
-
-CREATE FUNCTION test_func5 (s CHAR(20)) RETURNS VARCHAR(30)
-RETURN CONCAT('XYZ, ' ,s);
-SELECT * FROM INFORMATION_SCHEMA.PARAMETERS
-WHERE SPECIFIC_SCHEMA = 'i_s_parameters_test' AND SPECIFIC_NAME = 'test_func5';
-
-# Cleanup
-DROP DATABASE i_s_parameters_test;
-USE test;
-
-
---echo #
---echo # Start of 10.3 tests
---echo #
-
---echo #
---echo # MDEV-15416 Crash when reading I_S.PARAMETERS
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1(a0 TYPE OF t1.a,
- a1 TYPE OF test.t1.a,
- b0 ROW TYPE OF t1,
- b1 ROW TYPE OF test.t1,
- c ROW(a INT,b DOUBLE))
-BEGIN
-END;
-$$
-DELIMITER ;$$
---vertical_results
-SELECT *, '--------' FROM INFORMATION_SCHEMA.PARAMETERS WHERE SPECIFIC_NAME = 'p1';
---horizontal_results
-DROP PROCEDURE p1;
diff --git a/mysql-test/t/information_schema_part.test b/mysql-test/t/information_schema_part.test
deleted file mode 100644
index 62fba4f53d8..00000000000
--- a/mysql-test/t/information_schema_part.test
+++ /dev/null
@@ -1,140 +0,0 @@
-
--- source include/have_partition.inc
-
---disable_warnings
-drop table if exists t1,t2,t3,t4;
---enable_warnings
-
-create table t1 (a int not null,b int not null,c int not null, primary key(a,b))
-partition by list (b*a)
-(partition x1 values in (1) tablespace ts1,
- partition x2 values in (3, 11, 5, 7) tablespace ts2,
- partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
-
---replace_column 16 # 19 # 20 #
-select * from information_schema.partitions where table_schema="test"
-and table_name="t1";
-
-create table t2 (a int not null,b int not null,c int not null, primary key(a,b))
-partition by range (a)
-partitions 3
-(partition x1 values less than (5) tablespace ts1,
- partition x2 values less than (10) tablespace ts2,
- partition x3 values less than maxvalue tablespace ts3);
---replace_column 16 # 19 # 20 #
-select * from information_schema.partitions where table_schema="test"
-and table_name="t2";
-
-create table t3 (f1 date)
-partition by hash(month(f1))
-partitions 3;
---replace_column 16 # 19 # 20 #
-select * from information_schema.partitions where table_schema="test"
-and table_name="t3";
-
-create table t4 (f1 date, f2 int)
-partition by key(f1,f2)
-partitions 3;
---replace_column 16 # 19 # 20 #
-select * from information_schema.partitions where table_schema="test"
-and table_name="t4";
-
-drop table t1,t2,t3,t4;
-
-create table t1 (a int not null,b int not null,c int not null,primary key (a,b))
-partition by range (a)
-subpartition by hash (a+b)
-( partition x1 values less than (1)
- ( subpartition x11 tablespace t1,
- subpartition x12 tablespace t2),
- partition x2 values less than (5)
- ( subpartition x21 tablespace t1,
- subpartition x22 tablespace t2)
-);
-
-create table t2 (a int not null,b int not null,c int not null,primary key (a,b))
-partition by range (a)
-subpartition by key (a)
-( partition x1 values less than (1)
- ( subpartition x11 tablespace t1,
- subpartition x12 tablespace t2),
- partition x2 values less than (5)
- ( subpartition x21 tablespace t1,
- subpartition x22 tablespace t2)
-);
---replace_column 16 # 19 # 20 #
-select * from information_schema.partitions where table_schema="test" order by table_name, partition_name;
-drop table t1,t2;
-
-create table t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key (a,b))
-partition by range (a)
-subpartition by hash (a+b)
-( partition x1 values less than (1)
- ( subpartition x11 tablespace t1 nodegroup 0,
- subpartition x12 tablespace t2 nodegroup 1),
- partition x2 values less than (5)
-( subpartition x21 tablespace t1 nodegroup 0,
- subpartition x22 tablespace t2 nodegroup 1)
-);
-
---replace_column 16 # 19 # 20 #
-select * from information_schema.partitions where table_schema="test";
-show tables;
-drop table t1;
-
-create table t1(f1 int, f2 int);
---replace_column 16 # 19 # 20 #
-select * from information_schema.partitions where table_schema="test";
-drop table t1;
-
-create table t1 (f1 date)
-partition by linear hash(month(f1))
-partitions 3;
---replace_column 16 # 19 # 20 #
-select * from information_schema.partitions where table_schema="test"
-and table_name="t1";
-drop table t1;
-
-#
-# Bug 20161 Partitions: SUBPARTITION METHOD doesn't show LINEAR keyword
-#
-create table t1 (a int)
-PARTITION BY RANGE (a)
-SUBPARTITION BY LINEAR HASH (a)
-(PARTITION p0 VALUES LESS THAN (10));
-
-SHOW CREATE TABLE t1;
-select SUBPARTITION_METHOD FROM information_schema.partitions WHERE
-table_schema="test" AND table_name="t1";
-drop table t1;
-
-create table t1 (a int)
-PARTITION BY LIST (a)
-(PARTITION p0 VALUES IN
-(10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
- 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53));
-SHOW CREATE TABLE t1;
-SELECT PARTITION_DESCRIPTION FROM information_schema.partitions WHERE
-table_schema = "test" AND table_name = "t1";
-drop table t1;
-
-#
-# Bug#38909 CREATE_OPTIONS in information_schema produces wrong results
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (f1 int key) partition by key(f1) partitions 2;
-select create_options from information_schema.tables where table_schema="test";
-drop table t1;
-
---echo #
---echo # MDEV-11353 - Identical logical conditions
---echo #
-CREATE TABLE t1(a INT) CHECKSUM=1 SELECT 1;
-SELECT CHECKSUM FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
-DROP TABLE t1;
diff --git a/mysql-test/t/information_schema_routines.test b/mysql-test/t/information_schema_routines.test
deleted file mode 100644
index 190410c2b82..00000000000
--- a/mysql-test/t/information_schema_routines.test
+++ /dev/null
@@ -1,249 +0,0 @@
-#------------------------------------------------------------------------------
-# i_s_routines.test
-# .test file for MySQL regression suite
-# Purpose: To test the presence, structure, and behavior
-# of INFORMATION_SCHEMA.ROUTINES
-# Author: pcrews
-# Last modified: 2007-12-04
-#------------------------------------------------------------------------------
-
-################################################################################
-# Testcase routines.1: Ensure that the INFORMATION_SCHEMA.ROUTINES
-# table has the following columns, in the following order:
-#
-# SPECIFIC_NAME (shows the name of an accessible stored
-# procedure, or routine),
-# ROUTINE_CATALOG (always shows NULL),
-# ROUTINE_SCHEMA (shows the database, or schema, in which
-# the routine resides),
-# ROUTINE_NAME (shows the same stored procedure name),
-# ROUTINE_TYPE (shows whether the stored procedure is a
-# procedure or a function),
-# DATA_TYPE (new column as of 6.0)
-# CHARACTER_MAXIMUM_LENGTH (new column as of 6.0)
-# CHARACTER_OCTET_LENGTH (new column as of 6.0)
-# NUMERIC_PRECISION (new column as of 6.0)
-# NUMERIC_SCALE (new column as of 6.0)
-# CHARACTER_SET_NAME (new column as of 6.0)
-# COLLATION_NAME (new column as of 6.0)
-# DTD_IDENTIFIER (shows, for a function, the complete
-# data type definition of the value the function will
-# return; otherwise NULL),
-# ROUTINE_BODY (shows the language in which the stored
-# procedure is written; currently always SQL),
-# ROUTINE_DEFINITION (shows as much of the routine body as
-# is possible in the allotted space),
-# EXTERNAL_NAME (always shows NULL),
-# EXTERNAL_LANGUAGE (always shows NULL),
-# PARAMETER_STYLE (shows the routine's parameter style;
-# always SQL),
-# IS_DETERMINISTIC (shows whether the routine is
-# deterministic),
-# SQL_DATA_ACCESS (shows the routine's defined
-# sql-data-access clause value),
-# SQL_PATH (always shows NULL),
-# SECURITY_TYPE (shows whether the routine's defined
-# security_type is 'definer' or 'invoker'),
-# CREATED (shows the timestamp of the time the routine was
-# created),
-# LAST_ALTERED (shows the timestamp of the time the routine
-# was last altered),
-# SQL_MODE (shows the sql_mode setting at the time the
-# routine was created),
-# ROUTINE_COMMENT (shows the comment, if any, defined for
-# the routine; otherwise NULL),
-# DEFINER (shows the user who created the routine).
-################################################################################
-set sql_mode="";
-set sql_mode="";
--- echo # ========== routines.1 ==========
-USE INFORMATION_SCHEMA;
---replace_result ENGINE=MyISAM "" ENGINE=MARIA "" ENGINE=Aria "" " PAGE_CHECKSUM=1" "" " PAGE_CHECKSUM=0" ""
-SHOW CREATE TABLE INFORMATION_SCHEMA.ROUTINES;
-
-# embedded server does not display privileges
---replace_column 19 #
-query_vertical SELECT * FROM information_schema.columns
-WHERE table_schema = 'information_schema'
- AND table_name = 'routines'
-ORDER BY ordinal_position;
-
-DESCRIBE INFORMATION_SCHEMA.ROUTINES;
-
-###############################################################################
-# Testcase routines.2: Unsuccessful stored procedure CREATE will not populate
-# I_S.ROUTINES view
-###############################################################################
--- echo # ========== routines.2 ==========
---disable_warnings
-DROP DATABASE IF EXISTS i_s_routines_test;
---enable_warnings
-
-CREATE DATABASE i_s_routines_test;
-USE i_s_routines_test;
-
-# Missing closing ')' character at the end of 's char(20) in func declaration
---error ER_PARSE_ERROR
-CREATE FUNCTION test_func1 (s char(20) RETURNS CHAR(50)
-RETURN CONCAT('Hello', ,s,'!');
---replace_column 24 <created> 25 <modified>
-SELECT * FROM INFORMATION_SCHEMA.ROUTINES
-WHERE ROUTINE_SCHEMA = 'i_s_routines_test' AND ROUTINE_NAME = 'test_func1';
-
-###############################################################################
-# Testcase routines.3: DROP FUNCTION - Verify DROP of a stored procedure
-# removes I_S.PARAMETERS data for that
-# function / procedure
-###############################################################################
--- echo # ========== routines.3 ==========
---disable_warnings
-DROP DATABASE IF EXISTS i_s_routines_test;
---enable_warnings
-
-CREATE DATABASE i_s_routines_test;
-USE i_s_routines_test;
-
-CREATE FUNCTION test_func1 (s char(20)) RETURNS CHAR(50)
-RETURN CONCAT('Hello, ',s,'!');
---replace_column 24 <created> 25 <modified>
-SELECT * FROM INFORMATION_SCHEMA.ROUTINES
-WHERE ROUTINE_SCHEMA = 'i_s_routines_test' AND ROUTINE_NAME = 'test_func1';
-DROP FUNCTION test_func1;
---replace_column 24 <created> 25 <modified>
-SELECT * FROM INFORMATION_SCHEMA.ROUTINES
-WHERE ROUTINE_SCHEMA = 'i_s_routines_test' AND ROUTINE_NAME = 'test_func1';
-
-
-################################################################################
-# Testcase routines.4: Verify that the new columns from WL#2822 are NULL for a
-# stored procedure
-################################################################################
--- echo # ========== routines.4 ==========
---disable_warnings
-DROP DATABASE IF EXISTS i_s_routines_test;
---enable_warnings
-
-CREATE DATABASE i_s_routines_test;
-USE i_s_routines_test;
-
-delimiter //;
-CREATE PROCEDURE testproc (OUT param1 INT)
- BEGIN
- SELECT 2+2 as param1;
- END;
-//
-delimiter ;//
---replace_column 24 <created> 25 <modified>
-SELECT * FROM INFORMATION_SCHEMA.ROUTINES
-WHERE ROUTINE_SCHEMA = 'i_s_routines_test' AND ROUTINE_NAME = 'testproc';
-
-
-################################################################################
-# Testcase routines.5: Verify that the new columns from WL#2822 are populated
-# for a stored function, that the NUMERIC columns
-# are not populated when the function returns non-numeric
-# data, and that the CHARACTER columns are populated
-# for CHAR functions
-################################################################################
--- echo # ========== routines.5 ==========
---disable_warnings
-DROP DATABASE IF EXISTS i_s_routines_test;
---enable_warnings
-
-CREATE DATABASE i_s_routines_test;
-USE i_s_routines_test;
-
-CREATE FUNCTION test_func1 (s char(20)) RETURNS CHAR(50)
-RETURN CONCAT('Hello, ',s,'!');
---replace_column 24 <created> 25 <modified>
-SELECT * FROM INFORMATION_SCHEMA.ROUTINES
-WHERE ROUTINE_SCHEMA = 'i_s_routines_test' AND ROUTINE_NAME = 'test_func1';
-
-
-
-################################################################################
-# Testcase routines.6: Verify that the new columns from WL#2822 are populated
-# for a stored function, that the CHARACTER columns
-# are not populated when the function returns numeric
-# data, and that the NUMERIC columns are populated
-# for numeric functions
-################################################################################
--- echo # ========== routines.6 ==========
---disable_warnings
-DROP DATABASE IF EXISTS i_s_routines_test;
---enable_warnings
-
-CREATE DATABASE i_s_routines_test;
-USE i_s_routines_test;
-
-CREATE FUNCTION test_func2 (s int) RETURNS INT RETURN s*2;
---replace_column 24 <created> 25 <modified>
-SELECT * FROM INFORMATION_SCHEMA.ROUTINES
-WHERE ROUTINE_SCHEMA = 'i_s_routines_test' AND ROUTINE_NAME = 'test_func2';
-
-################################################################################
-# Testcase routines.7: Verify that the new columns from WL#2822 are populated
-# for a stored function, that the CHARACTER and NUMERIC
-# columns are not populated when the function returns date
-# or time data
-################################################################################
--- echo # ========== routines.7 ==========
---disable_warnings
-DROP DATABASE IF EXISTS i_s_routines_test;
---enable_warnings
-
-CREATE DATABASE i_s_routines_test;
-USE i_s_routines_test;
-
-CREATE FUNCTION test_func5 (s date) RETURNS TIMESTAMP
-RETURN CURRENT_TIMESTAMP;
---replace_column 24 <created> 25 <modified>
-SELECT * FROM INFORMATION_SCHEMA.ROUTINES
-WHERE ROUTINE_SCHEMA = 'i_s_routines_test' AND ROUTINE_NAME = 'test_func5';
-
-###############################################################################
-# Testcase routines.8: ALTER FUNCTION
-# Quick check to ensure ALTER properly updates
-# I_S.ROUTINES.COMMENT
-###############################################################################
--- echo # ========== routines.8 ==========
---disable_warnings
-DROP DATABASE IF EXISTS i_s_routines_test;
---enable_warnings
-
-CREATE DATABASE i_s_routines_test;
-USE i_s_routines_test;
-
-CREATE FUNCTION test_func5 (s date) RETURNS TIMESTAMP
-RETURN CURRENT_TIMESTAMP;
---replace_column 24 <created> 25 <modified>
-SELECT * FROM INFORMATION_SCHEMA.ROUTINES
-WHERE ROUTINE_SCHEMA = 'i_s_routines_test' AND ROUTINE_NAME = 'test_func5';
-ALTER FUNCTION test_func5 COMMENT 'new comment added';
---replace_column 24 <created> 25 <modified>
-SELECT * FROM INFORMATION_SCHEMA.ROUTINES
-WHERE ROUTINE_SCHEMA = 'i_s_routines_test' AND ROUTINE_NAME = 'test_func5';
-
-###############################################################################
-# Testcase routines.9: MULTI-BYTE CHAR SETS
-# Verify that CHAR_MAX_LENGTH and CHAR_OCTET_LENGTH
-# differ as expected for multi-byte char sets
-# Normally both values are equal
-###############################################################################
--- echo # ========== routines.9 ==========
---disable_warnings
-DROP DATABASE IF EXISTS i_s_routines_test;
---enable_warnings
-
-
-CREATE DATABASE i_s_routines_test CHARACTER SET utf8;
-USE i_s_routines_test;
-
-CREATE FUNCTION test_func5 (s CHAR(20)) RETURNS VARCHAR(30)
-RETURN CONCAT('XYZ, ' ,s);
---replace_column 24 <created> 25 <modified>
-SELECT * FROM INFORMATION_SCHEMA.ROUTINES
-WHERE ROUTINE_SCHEMA = 'i_s_routines_test' AND ROUTINE_NAME = 'test_func5';
-
-# final clean up
-DROP DATABASE i_s_routines_test;
diff --git a/mysql-test/t/information_schema_stats.test b/mysql-test/t/information_schema_stats.test
deleted file mode 100644
index c7f39894ce7..00000000000
--- a/mysql-test/t/information_schema_stats.test
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# MDEV-8633: information_schema.index_statistics doesn't delete item when drop table indexes or drop table;
-#
-set global userstat=1;
-create table just_a_test(id int,first_name varchar(10),last_name varchar(10),address varchar(100),phone bigint,email varchar(30), state varchar(30));
-insert into just_a_test values(1,'fa','la','china_a',11111111,'fa_la@163.com','California'),
-(2,'fb','lb','china_b',22222222,'fb_lb@163.com','Arizona'),
-(3,'fc','lc','china_c',33333333,'fc_lc@163.com','California'),
-(4,'fd','ld','china_d',44444444,'fd_ld@163.com','Utah'),
-(5,'fe','le','china_e',55555555,'fe_le@163.com','Arizona');
-alter table just_a_test add primary key (id);
-alter table just_a_test add key IND_just_a_test_first_name_last_name(first_name,last_name);
-alter table just_a_test add key IND_just_a_test_state(state);
-select count(*) from just_a_test where first_name='fc' and last_name='lc';
-select count(*) from just_a_test where state = 'California';
---sorted_result
-select * from information_schema.index_statistics where table_schema='test' and table_name='just_a_test';
-select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test';
-alter table just_a_test drop key IND_just_a_test_first_name_last_name;
-select * from information_schema.index_statistics where table_schema='test' and table_name='just_a_test';
-select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test';
-alter table just_a_test drop column state;
-select * from information_schema.index_statistics where table_schema='test' and table_name='just_a_test';
-select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test';
-drop table just_a_test;
-select * from information_schema.index_statistics where table_schema='test' and table_name='just_a_test';
-select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test';
-#
-# Test direct drop table
-#
-create table just_a_test(id int not null primary key,first_name varchar(10),last_name varchar(10),address varchar(100),phone bigint,email varchar(30), state varchar(30),key(first_name,last_name),key(state));
-insert into just_a_test values(1,'fa','la','china_a',11111111,'fa_la@163.com','California'),
-(2,'fb','lb','china_b',22222222,'fb_lb@163.com','Arizona'),
-(3,'fc','lc','china_c',33333333,'fc_lc@163.com','California'),
-(4,'fd','ld','china_d',44444444,'fd_ld@163.com','Utah'),
-(5,'fe','le','china_e',55555555,'fe_le@163.com','Arizona');
-select count(*) from just_a_test where first_name='fc' and last_name='lc';
-select count(*) from just_a_test where state = 'California';
-select count(*) from just_a_test where id between 2 and 4;
---sorted_result
-select * from information_schema.index_statistics where table_schema='test' and table_name='just_a_test';
-select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test';
-drop table just_a_test;
-select * from information_schema.index_statistics where table_schema='test' and table_name='just_a_test';
-select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test';
-set global userstat=0;
diff --git a/mysql-test/t/init_connect-master.opt b/mysql-test/t/init_connect-master.opt
deleted file mode 100644
index db17a49c058..00000000000
--- a/mysql-test/t/init_connect-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---init_connect="set @a='a\\0c'"
diff --git a/mysql-test/t/init_connect.test b/mysql-test/t/init_connect.test
deleted file mode 100644
index e96d02fe0d1..00000000000
--- a/mysql-test/t/init_connect.test
+++ /dev/null
@@ -1,262 +0,0 @@
-#
-# Test of init_connect variable
-#
-
-# should work with embedded server after mysqltest is fixed
---source include/not_embedded.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
---source include/add_anonymous_users.inc
-
-connect (con0,localhost,root,,);
-connection con0;
-select hex(@a);
-connect (con1,localhost,user_1,,);
-connection con1;
-select hex(@a);
-connection con0;
-set global init_connect="set @a=2;set @b=3";
-connect (con2,localhost,user_1,,);
-connection con2;
-select @a, @b;
-connection con0;
-set GLOBAL init_connect=DEFAULT;
-connect (con3,localhost,user_1,,);
-connection con3;
-select @a;
-connection con0;
-set global init_connect="drop table if exists t1; create table t1(a char(10));\
-insert into t1 values ('\0');insert into t1 values('abc')";
-connect (con4,localhost,user_1,,);
-connection con4;
-select hex(a) from t1;
-connection con0;
-set GLOBAL init_connect="adsfsdfsdfs";
-connect (con5,localhost,user_1,,);
-connection con5;
-# BUG#11755281/47032: ERROR 2006 / ERROR 2013 INSTEAD OF PROPER ERROR MESSAGE
-# We now throw a proper error message here:
---replace_regex /connection .* to/connection to/
---error ER_NEW_ABORTING_CONNECTION
-select @a;
-# We got disconnected after receiving the above error message; any further
-# requests should fail with a notice that no one's listening to us.
-# --error CR_SERVER_GONE_ERROR,CR_SERVER_LOST
---error 2013,2006
-select @a;
-connection con0;
-drop table t1;
-
-disconnect con1;
-disconnect con2;
-disconnect con3;
-disconnect con4;
-disconnect con5;
-
---source include/delete_anonymous_users.inc
-
---echo End of 4.1 tests
-#
-# Test 5.* features
-#
-
-create table t1 (x int);
-insert into t1 values (3), (5), (7);
-create table t2 (y int);
-
-create user mysqltest1@localhost;
-grant all privileges on test.* to mysqltest1@localhost;
-#
-# Create a simple procedure
-#
-set global init_connect="create procedure p1() select * from t1";
-connect (con1,localhost,mysqltest1,,);
-connection con1;
-call p1();
-drop procedure p1;
-
-connection con0;
-disconnect con1;
-#
-# Create a multi-result set procedure
-#
-set global init_connect="create procedure p1(x int)\
-begin\
- select count(*) from t1;\
- select * from t1;\
- set @x = x;
-end";
-connect (con1,localhost,mysqltest1,,);
-connection con1;
-call p1(42);
-select @x;
-
-connection con0;
-disconnect con1;
-#
-# Just call it - this will not generate any output
-#
-set global init_connect="call p1(4711)";
-connect (con1,localhost,mysqltest1,,);
-connection con1;
-select @x;
-
-connection con0;
-disconnect con1;
-#
-# Drop the procedure
-#
-set global init_connect="drop procedure if exists p1";
-connect (con1,localhost,mysqltest1,,);
-connection con1;
---error ER_SP_DOES_NOT_EXIST
-call p1();
-
-connection con0;
-disconnect con1;
-#
-# Execution of a more complex procedure
-#
-delimiter |;
-create procedure p1(out sum int)
-begin
- declare n int default 0;
- declare c cursor for select * from t1;
- declare exit handler for not found
- begin
- close c;
- set sum = n;
- end;
-
- open c;
- loop
- begin
- declare x int;
-
- fetch c into x;
- if x > 3 then
- set n = n + x;
- end if;
- end;
- end loop;
-end|
-delimiter ;|
-# Call the procedure with a cursor
-set global init_connect="call p1(@sum)";
-connect (con1,localhost,mysqltest1,,);
-connection con1;
-select @sum;
-
-connection con0;
-disconnect con1;
-drop procedure p1;
-#
-# Test Dynamic SQL
-#
-delimiter |;
-create procedure p1(tbl char(10), v int)
-begin
- set @s = concat('insert into ', tbl, ' values (?)');
- set @v = v;
- prepare stmt1 from @s;
- execute stmt1 using @v;
- deallocate prepare stmt1;
-end|
-delimiter ;|
-# Call the procedure with prepared statements
-set global init_connect="call p1('t1', 11)";
-connect (con1,localhost,mysqltest1,,);
-connection con1;
-select * from t1;
-
-connection con0;
-disconnect con1;
-drop procedure p1;
-#
-# Stored functions
-#
-delimiter |;
-create function f1() returns int
-begin
- declare n int;
-
- select count(*) into n from t1;
- return n;
-end|
-delimiter ;|
-# Invoke a function
-set global init_connect="set @x = f1()";
-connect (con1,localhost,mysqltest1,,);
-connection con1;
-select @x;
-
-connection con0;
-disconnect con1;
-#
-# Create a view
-#
-set global init_connect="create view v1 as select f1()";
-connect (con1,localhost,mysqltest1,,);
-connection con1;
-select * from v1;
-
-connection con0;
-disconnect con1;
-#
-# Drop the view
-#
-set global init_connect="drop view v1";
-connect (con1,localhost,mysqltest1,,);
-connection con1;
---error ER_NO_SUCH_TABLE
-select * from v1;
-
-connection con0;
-disconnect con1;
-drop function f1;
-
-# We can't test "create trigger", since this requires super privileges
-# in 5.0, but with super privileges, init_connect is not executed.
-# (However, this can be tested in 5.1)
-#
-#set global init_connect="create trigger trg1\
-# after insert on t2\
-# for each row\
-# insert into t1 values (new.y)";
-#connect (con1,localhost,mysqltest1,,);
-#connection con1;
-#insert into t2 values (2), (4);
-#select * from t1;
-#
-#connection con0;
-#disconnect con1;
-
-create trigger trg1
- after insert on t2
- for each row
- insert into t1 values (new.y);
-
-# Invoke trigger
-set global init_connect="insert into t2 values (13), (17), (19)";
-connect (con1,localhost,mysqltest1,,);
-connection con1;
-select * from t1;
-
-connection default;
-disconnect con0;
-disconnect con1;
-
-drop trigger trg1;
-# Set init connect back to the value provided in init_connect-master.opt
-# doesn't matter as server will be restarted
-set global init_connect="set @a='a\\0c'";
-
-revoke all privileges, grant option from mysqltest1@localhost;
-drop user mysqltest1@localhost;
-drop table t1, t2;
-
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
-
diff --git a/mysql-test/t/init_connection_query_cache-master.opt b/mysql-test/t/init_connection_query_cache-master.opt
deleted file mode 100644
index 7bef2af8d35..00000000000
--- a/mysql-test/t/init_connection_query_cache-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---init_connect="select * from test.t1 where 0"
diff --git a/mysql-test/t/init_connection_query_cache.test b/mysql-test/t/init_connection_query_cache.test
deleted file mode 100644
index 4d83304163e..00000000000
--- a/mysql-test/t/init_connection_query_cache.test
+++ /dev/null
@@ -1,26 +0,0 @@
--- source include/have_query_cache.inc
-
---echo #
---echo # MDEV-4520: Assertion `0' fails in Query_cache::end_of_result on
---echo # concurrent drop event and event execution
---echo #
-set GLOBAL query_cache_size=1355776;
-
-create user mysqltest1@localhost;
-grant SELECT on test.* to mysqltest1@localhost;
-
-create table t1 (a int);
-
-connect (con1,localhost,mysqltest1,,);
-connection con1;
---echo # This explain put here to be sure that init connection query
---echo # has 'Impossible WHERE'.
-explain extended select * from test.t1 where 0;
-connection default;
-disconnect con1;
-revoke all privileges, grant option from mysqltest1@localhost;
-drop user mysqltest1@localhost;
-
-drop table t1;
-
-set GLOBAL query_cache_size=default;
diff --git a/mysql-test/t/init_file.opt b/mysql-test/t/init_file.opt
deleted file mode 100644
index f6af01ee2c3..00000000000
--- a/mysql-test/t/init_file.opt
+++ /dev/null
@@ -1 +0,0 @@
---init-file=$MYSQL_TEST_DIR/std_data/init_file.dat --log-bin=mariadb-bin
diff --git a/mysql-test/t/init_file.test b/mysql-test/t/init_file.test
deleted file mode 100644
index 65e54db43ea..00000000000
--- a/mysql-test/t/init_file.test
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# This is a regression test for bug #2526 "--init-file crashes MySQL if it
-# contains a large select"
-#
-# See mysql-test/std_data/init_file.dat and
-# mysql-test/t/init_file-master.opt for the actual test
-#
-
-#
-# Bug#23240 --init-file statements with NOW() reports '1970-01-01 11:00:00'as the date time
-#
-INSERT INTO init_file.startup VALUES ( NOW() );
-SELECT * INTO @X FROM init_file.startup limit 0,1;
-SELECT * INTO @Y FROM init_file.startup limit 1,1;
-SELECT YEAR(@X)-YEAR(@Y);
-
---echo ok
---echo end of 4.1 tests
-#
-# Check 5.x features
-#
-# Expected:
-# 3, 5, 7, 11, 13
-select * from t1;
-# Expected:
-# 30, 3, 11, 13
-select * from t2;
-
-#
-# we don't drop tables (t1, t2) and databases (init_file)
-# created by init-file script, because they existed when before-test
-# check was run, and if they won't exist after the test, after-test check
-# will complain.
-# But it's safe to keep them, because mysqld will be restarted after the
-# test (--init-file option) and datadir will be reinitialized.
-#
-
diff --git a/mysql-test/t/init_file_longline_3816.opt b/mysql-test/t/init_file_longline_3816.opt
deleted file mode 100644
index 9ddb6fa8565..00000000000
--- a/mysql-test/t/init_file_longline_3816.opt
+++ /dev/null
@@ -1 +0,0 @@
---init-file=$MYSQL_TEST_DIR/std_data/init_file_longline_3816.sql
diff --git a/mysql-test/t/init_file_longline_3816.test b/mysql-test/t/init_file_longline_3816.test
deleted file mode 100644
index 5db2fcb0c73..00000000000
--- a/mysql-test/t/init_file_longline_3816.test
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-# MDEV-3816 init-file stops getting executed if a long enough line is encountered; on a debug version, assertion `! is_set() || can_overwrite_status' fails
-#
-select count(*) from t4;
-
diff --git a/mysql-test/t/init_file_set_password-7656.test b/mysql-test/t/init_file_set_password-7656.test
deleted file mode 100644
index ecee3924355..00000000000
--- a/mysql-test/t/init_file_set_password-7656.test
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# MDEV-7656 init_file option does not allow changing passwords
-#
---source include/not_embedded.inc
-
-create user foo@localhost;
-
-select user,host,password from mysql.user where user='foo';
-
---write_file $MYSQLTEST_VARDIR/init.file
-grant all on *.* to foo@localhost identified by 'test';
-EOF
-
---enable_reconnect
-
---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-
---shutdown_server 10
---source include/wait_until_disconnected.inc
-
---exec echo "restart:--init-file=$MYSQLTEST_VARDIR/init.file " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-
---source include/wait_until_connected_again.inc
-select user,host,password from mysql.user where user='foo';
-
-drop user foo@localhost;
diff --git a/mysql-test/t/innodb_bug878769.test b/mysql-test/t/innodb_bug878769.test
deleted file mode 100644
index 157c7827dde..00000000000
--- a/mysql-test/t/innodb_bug878769.test
+++ /dev/null
@@ -1,56 +0,0 @@
---source include/have_innodb.inc
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
---echo #
---echo # Bug #878769: valgrind complains when using join cache
---echo # to join an InnoDB table without primary key
---echo #
-
-CREATE TABLE t1 (
- col_int_key int(11), col_time_key time, col_varchar_key varchar(1),
- KEY (col_int_key), KEY (col_varchar_key,col_int_key)
-) ENGINE=InnoDB;
-INSERT IGNORE INTO t1 VALUES
- (7,'10:19:31','d'),(1,'14:40:36','r'),(7,'04:37:47','f'),(9,'19:34:06','y'),
- (2,'00:00:00','m'),(4,'00:13:25','q'),(0,'03:47:16',NULL),(4,'01:41:48','d'),
- (8,'00:00:00','g'),(NULL,'22:32:04','x'),(NULL,'16:44:14','f'),
- (0,'17:38:37','p'),(NULL,'08:46:48','j'),(8,'14:11:27','c');
-
-CREATE TABLE t2 (
- col_int_nokey int(11), col_int_key int(11),
- col_datetime_key datetime, col_datetime_nokey datetime,
- col_varchar_key varchar(1), col_varchar_nokey varchar(1),
- KEY (col_int_key), KEY (col_varchar_key,col_int_key)
-);
-INSERT IGNORE INTO t2 VALUES
- (150,62,'2008-01-03 10:33:32','2008-01-03 10:33:32','v','v'),
- (2,1,'2007-10-09 19:53:04','2007-10-09 19:53:04',NULL,NULL),
- (5,0,'2001-11-08 21:02:12','2001-11-08 21:02:12','x','x'),
- (3,7,'2003-04-01 00:00','2003-04-01 00:00','i','i'),
- (1,7,'1900-01-01 00:00','1900-01-01 00:00:00','e','e'),
- (NULL,7,'2005-04-04 01:21','2005-04-04 01:21','s','s'),
- (2,1,'1900-01-01 00:00','1900-01-01 00:00','j','j'),
- (8,0,'2004-04-28 21:44','2004-04-28 21:44','a','a'),
- (6,8,'2001-04-18 00:00','2001-04-18 00:00:00','y','y'),
- (8,1,'2008-12-18 19:39:55','2008-12-18 19:39:55',NULL,NULL),
- (3,1,'2000-08-01 12:19:39','2000-08-01 12:19:39','r','r'),
- (3,9,'2004-09-25 21:29:06','2004-09-25 21:29:06','v','v');
-
-set session optimizer_switch='mrr=on,mrr_sort_keys=on';
-set session join_cache_level=6;
-
-EXPLAIN
-SELECT t1.col_time_key, t1.col_varchar_key
- FROM t2 STRAIGHT_JOIN t1 ON t1.col_int_key = t2.col_int_key
-GROUP BY 1,2;
-SELECT t1.col_time_key, t1.col_varchar_key
- FROM t2 STRAIGHT_JOIN t1 ON t1.col_int_key = t2.col_int_key
-GROUP BY 1,2;
-
-set session optimizer_switch=default;
-set session join_cache_level=default;
-
-DROP TABLE t1,t2;
diff --git a/mysql-test/t/innodb_ext_key.test b/mysql-test/t/innodb_ext_key.test
deleted file mode 100644
index a721943e8bc..00000000000
--- a/mysql-test/t/innodb_ext_key.test
+++ /dev/null
@@ -1,823 +0,0 @@
---source include/have_innodb.inc
-
---disable_warnings
-DROP TABLE IF EXISTS t1,t2,t3,t4;
-DROP DATABASE IF EXISTS dbt3_s001;
---enable_warnings
-
-SET SESSION STORAGE_ENGINE='InnoDB';
-
-CREATE DATABASE dbt3_s001;
-
-use dbt3_s001;
-
---disable_query_log
---disable_result_log
---disable_warnings
---source include/dbt3_s001.inc
---enable_warnings
---enable_result_log
---enable_query_log
-
-set @save_ext_key_optimizer_switch=@@optimizer_switch;
-
-set optimizer_switch='extended_keys=off';
-explain
-select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01';
-flush status;
-select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01';
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=on';
-explain
-select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01';
-flush status;
-select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01';
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=off';
-explain
-select count(*) from lineitem
- where l_orderkey=130 and l_linenumber=2 and l_shipdate='1992-07-01';
-flush status;
-select count(*) from lineitem
- where l_orderkey=130 and l_linenumber=2 and l_shipdate='1992-07-01';
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=on';
-explain
-select count(*) from lineitem
- where l_orderkey=130 and l_linenumber=2 and l_shipdate='1992-07-01';
-flush status;
-select count(*) from lineitem
- where l_orderkey=130 and l_linenumber=2 and l_shipdate='1992-07-01';
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=off';
-explain
-select count(*) from lineitem
- where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000;
-flush status;
-select count(*) from lineitem
- where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000;
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=on';
-explain
-select count(*) from lineitem
- where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000;
-flush status;
-select count(*) from lineitem
- where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000;
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=off';
-explain
-select l_orderkey, l_linenumber from lineitem
- where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
-flush status;
-select l_orderkey, l_linenumber from lineitem
- where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=on';
-explain
-select l_orderkey, l_linenumber from lineitem
- where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
-flush status;
-select l_orderkey, l_linenumber from lineitem
- where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=off';
-explain
-select min(l_orderkey) from lineitem where l_shipdate='1992-07-01';
-flush status;
-select min(l_orderkey) from lineitem where l_shipdate='1992-07-01';
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=on';
-explain
-select min(l_orderkey) from lineitem where l_shipdate='1992-07-01';
-flush status;
-select min(l_orderkey) from lineitem where l_shipdate='1992-07-01';
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=off';
-explain
-select min(l_orderkey) from lineitem
- where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
-flush status;
-select min(l_orderkey) from lineitem
- where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=on';
-explain
-select min(l_orderkey) from lineitem
- where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
-flush status;
-select min(l_orderkey) from lineitem
- where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=off';
-explain
-select max(l_linenumber) from lineitem
- where l_shipdate='1992-07-01' and l_orderkey=130;
-flush status;
-select max(l_linenumber) from lineitem
- where l_shipdate='1992-07-01' and l_orderkey=130;
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=on';
-explain
-select max(l_linenumber) from lineitem
- where l_shipdate='1992-07-01' and l_orderkey=130;
-flush status;
-select max(l_linenumber) from lineitem
- where l_shipdate='1992-07-01' and l_orderkey=130;
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=off';
-explain
-select l_orderkey, l_linenumber
- from lineitem use index (i_l_shipdate, i_l_receiptdate)
- where l_shipdate='1992-07-01' and l_orderkey=130
- or l_receiptdate='1992-07-01' and l_orderkey=5603;
-flush status;
-select l_orderkey, l_linenumber
- from lineitem use index (i_l_shipdate, i_l_receiptdate)
- where l_shipdate='1992-07-01' and l_orderkey=130
- or l_receiptdate='1992-07-01' and l_orderkey=5603;
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=on';
-explain
-select l_orderkey, l_linenumber
- from lineitem use index (i_l_shipdate, i_l_receiptdate)
- where l_shipdate='1992-07-01' and l_orderkey=130
- or l_receiptdate='1992-07-01' and l_orderkey=5603;
-flush status;
-select l_orderkey, l_linenumber
- from lineitem use index (i_l_shipdate, i_l_receiptdate)
- where l_shipdate='1992-07-01' and l_orderkey=130
- or l_receiptdate='1992-07-01' and l_orderkey=5603;
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=off';
-explain
-select l_orderkey, l_linenumber
- from lineitem use index (i_l_shipdate, i_l_receiptdate)
- where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
- or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
-flush status;
-select l_orderkey, l_linenumber
- from lineitem use index (i_l_shipdate, i_l_receiptdate)
- where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
- or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=on';
-explain
-select l_orderkey, l_linenumber
- from lineitem use index (i_l_shipdate, i_l_receiptdate)
- where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
- or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
-flush status;
-select l_orderkey, l_linenumber
- from lineitem use index (i_l_shipdate, i_l_receiptdate)
- where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
- or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=off';
-explain
-select l_orderkey, l_linenumber from lineitem
- where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
- or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
-flush status;
-select l_orderkey, l_linenumber from lineitem
- where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
- or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=on';
-explain
-select l_orderkey, l_linenumber from lineitem
- where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
- or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
-flush status;
-select l_orderkey, l_linenumber from lineitem
- where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
- or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=off';
---replace_column 9 #
-explain
-select max(l_orderkey) from lineitem
- where l_partkey between 1 and 10 group by l_partkey;
-flush status;
-select max(l_orderkey) from lineitem
- where l_partkey between 1 and 10 group by l_partkey;
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=on';
---replace_column 9 #
-explain
-select max(l_orderkey) from lineitem
- where l_partkey between 1 and 10 group by l_partkey;
-flush status;
-select max(l_orderkey) from lineitem
- where l_partkey between 1 and 10 group by l_partkey;
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=off';
---replace_column 9 #
-explain
-select max(l_orderkey) from lineitem
- where l_suppkey in (1,4) group by l_suppkey;
-flush status;
-select max(l_orderkey) from lineitem
- where l_suppkey in (1,4) group by l_suppkey;
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=on';
---replace_column 9 #
-explain
-select max(l_orderkey) from lineitem
- where l_suppkey in (1,4) group by l_suppkey;
-flush status;
-select max(l_orderkey) from lineitem
- where l_suppkey in (1,4) group by l_suppkey;
-show status like 'handler_read%';
-
-create index i_p_retailprice on part(p_retailprice);
-
-set optimizer_switch='extended_keys=off';
---replace_column 9 #
-explain
-select o_orderkey, p_partkey
- from part use index (i_p_retailprice),
- lineitem use index (i_l_partkey), orders
- where p_retailprice > 1100 and o_orderdate='1997-01-01'
- and o_orderkey=l_orderkey and p_partkey=l_partkey;
-flush status;
-select o_orderkey, p_partkey
- from part use index (i_p_retailprice),
- lineitem use index (i_l_partkey), orders
- where p_retailprice > 1100 and o_orderdate='1997-01-01'
- and o_orderkey=l_orderkey and p_partkey=l_partkey;
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=on';
---replace_column 9 #
-explain
-select o_orderkey, p_partkey
- from part use index (i_p_retailprice),
- lineitem use index (i_l_partkey), orders
- where p_retailprice > 1100 and o_orderdate='1997-01-01'
- and o_orderkey=l_orderkey and p_partkey=l_partkey;
-flush status;
-select o_orderkey, p_partkey
- from part use index (i_p_retailprice),
- lineitem use index (i_l_partkey), orders
- where p_retailprice > 1100 and o_orderdate='1997-01-01'
- and o_orderkey=l_orderkey and p_partkey=l_partkey;
-show status like 'handler_read%';
-
---echo #
---echo # Bug mdev-3851: ref access used instead of expected eq_ref access
---echo # when extended_keys=on
---echo #
-
-create table t0 (a int);
-insert into t0 values (1), (2), (3), (4), (5);
-create index i_p_size on part(p_size);
-
-set optimizer_switch='extended_keys=on';
-
-explain
-select * from t0, part ignore index (primary)
- where p_partkey=t0.a and p_size=1;
-
-select * from t0, part ignore index (primary)
- where p_partkey=t0.a and p_size=1;
-
-drop table t0;
-drop index i_p_size on part;
-
-DROP DATABASE dbt3_s001;
-
-use test;
-
---echo #
---echo # LP Bug #914560: query containing IN subquery
---echo # + extended_keys = on
---echo #
-
-set @save_optimizer_switch=@@optimizer_switch;
-
-SET optimizer_switch='materialization=on,semijoin=on';
-SET optimizer_switch='extended_keys=on';
-
-CREATE TABLE t1 (a int, b int) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,1), (2,2);
-
-SELECT * FROM t1 WHERE 2 IN (SELECT MAX(s1.a) FROM t1 AS s1, t1 AS s2);
-EXPLAIN
-SELECT * FROM t1 WHERE 2 IN (SELECT MAX(s1.a) FROM t1 AS s1, t1 AS s2);
-
-DROP TABLE t1;
-
-set optimizer_switch=@save_optimizer_switch;
-
---echo #
---echo # LP Bug #915291: query using a materialized view
---echo # + extended_keys = on
---echo # (valgrinf complains fixed by the patch for bug #914560)
---echo #
-
-set @save_optimizer_switch=@@optimizer_switch;
-
-SET optimizer_switch = 'derived_with_keys=on';
-SET optimizer_switch = 'extended_keys=on';
-
-CREATE TABLE t1 (a varchar(1)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('j'), ('v');
-
-CREATE TABLE t2 (b varchar(1)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES ('j'), ('v');
-
-CREATE TABLE t3 (c varchar(1));
-INSERT INTO t2 VALUES ('m'), ('n');
-
-CREATE VIEW v
- AS SELECT DISTINCT * FROM t2 STRAIGHT_JOIN t3;
-
-SELECT * FROM t1, v WHERE a = b;
-
-DROP VIEW v;
-DROP TABLE t1,t2,t3;
-
-set optimizer_switch=@save_optimizer_switch;
-
---echo #
---echo # LP Bug #921167: query containing IN subquery
---echo # + extended_keys = on
---echo #
-
-CREATE TABLE t1 (
- a int NOT NULL, b varchar(1) NOT NULL, KEY(a), KEY(b,a)
-) ENGINE=MyISAM;
-INSERT INTO t1 VALUES
- (0,'j'), (8,'v'), (1,'c'), (8,'m'), (9,'d'),
- (24,'d'), (6,'y'), (1,'t'), (6,'d'), (2,'s');
-
-CREATE TABLE t2 (
- c int NOT NULL PRIMARY KEY
-) ENGINE=MyISAM;
-INSERT INTO t2 VALUES
- (10), (11), (12), (13), (14),
- (15), (16), (17), (18), (19), (24);
-
-set @save_optimizer_switch=@@optimizer_switch;
-
-SET optimizer_switch = 'extended_keys=off';
-EXPLAIN
-SELECT a FROM t1 AS t, t2
- WHERE c = a AND b IN (SELECT b FROM t1, t2 WHERE b = t.b);
-SELECT a FROM t1 AS t, t2
- WHERE c = a AND b IN (SELECT b FROM t1, t2 WHERE b = t.b);
-
-SET optimizer_switch = 'extended_keys=on';
-EXPLAIN
-SELECT a FROM t1 AS t, t2
- WHERE c = a AND b IN (SELECT b FROM t1, t2 WHERE b = t.b);
-SELECT a FROM t1 AS t, t2
- WHERE c = a AND b IN (SELECT b FROM t1, t2 WHERE b = t.b);
-
-set optimizer_switch=@save_optimizer_switch;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # LP Bug #923236: hash join + extended_keys = on
---echo #
-
-CREATE TABLE t1 (a int) ENGINE=MyISAM;
-
-CREATE TABLE t2 (b int) ENGINE=MyISAM;
-
-INSERT INTO t1 (a) VALUES (4), (6);
-INSERT INTO t2 (b) VALUES (0), (8);
-
-set @save_optimizer_switch=@@optimizer_switch;
-set @save_join_cache_level=@@join_cache_level;
-
-SET join_cache_level=3;
-SET optimizer_switch='join_cache_hashed=on';
-SET optimizer_switch='join_cache_bka=on';
-SET optimizer_switch='extended_keys=on';
-
-EXPLAIN
-SELECT * FROM t1, t2 WHERE b=a;
-SELECT * FROM t1, t2 WHERE b=a;
-
-set join_cache_level=@save_join_cache_level;
-set optimizer_switch=@save_optimizer_switch;
-
-DROP TABLE t1,t2;
-
-
---echo #
---echo # Bug mdev-3888: INSERT with UPDATE on duplicate keys
---echo # with extended_keys=on
---echo #
-
-CREATE TABLE t1 (
-c1 bigint(20) unsigned NOT NULL AUTO_INCREMENT,
-c2 bigint(20) unsigned NOT NULL,
-c3 bigint(20) unsigned NOT NULL,
-c4 varchar(128) DEFAULT NULL,
-PRIMARY KEY (c1),
-UNIQUE KEY uq (c2,c3),
-KEY c3 (c3),
-KEY c4 (c4)
-) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
-
-
-set @save_optimizer_switch=@@optimizer_switch;
-
-set session optimizer_switch='extended_keys=off';
-INSERT INTO t1 (c2, c3, c4) VALUES (58291525, 2580, 'foobar')
- ON DUPLICATE KEY UPDATE c4 = VALUES(c4);
-INSERT INTO t1 (c2, c3, c4) VALUES (58291525, 2580, 'foobar')
- ON DUPLICATE KEY UPDATE c4 = VALUES(c4);
-
-DELETE FROM t1;
-
-set session optimizer_switch='extended_keys=on';
-INSERT INTO t1 (c2, c3, c4) VALUES (58291525, 2580, 'foobar')
- ON DUPLICATE KEY UPDATE c4 = VALUES(c4);
-INSERT INTO t1 (c2, c3, c4) VALUES (58291525, 2580, 'foobar')
- ON DUPLICATE KEY UPDATE c4 = VALUES(c4);
-
-set optimizer_switch=@save_optimizer_switch;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug mdev-4220: using ref instead of eq_ref
---echo # with extended_keys=on
---echo # (performance regression introduced in the patch for mdev-3851)
---echo #
-
-set @save_optimizer_switch=@@optimizer_switch;
-
-create table t1 (a int not null) engine=innodb;
-
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t2 (
- pk int primary key, a int not null, b int, unique(a)
-)engine=innodb;
-
-insert into t2
-select
- A.a + 10 * B.a, A.a + 10 * B.a, A.a + 10 * B.a
-from t1 A, t1 B;
-
-set optimizer_switch='extended_keys=off';
-explain
-select * from t1, t2 where t2.a=t1.a and t2.b < 2;
-flush status;
-select * from t1, t2 where t2.a=t1.a and t2.b < 2;
-show status like 'handler_read%';
-
-set optimizer_switch='extended_keys=on';
-explain
-select * from t1, t2 where t2.a=t1.a and t2.b < 2;
-flush status;
-select * from t1, t2 where t2.a=t1.a and t2.b < 2;
-show status like 'handler_read%';
-
-drop table t1,t2;
-
-# this test case did not demonstrate any regression
-# it is added for better testing
-
-create table t1(a int) engine=myisam;
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t2(a int) engine=myisam;
-insert into t2 select A.a + 10*B.a + 100*C.a from t1 A, t1 B, t1 C;
-
-create table t3 (
- pk1 int not null, pk2 int not null, col1 int not null, col2 int not null)
-engine=innodb;
-insert into t3 select a,a,a,a from t2;
-alter table t3 add primary key (pk1, pk2);
-alter table t3 add key (col1, col2);
-analyze table t1,t3;
-
-set optimizer_switch='extended_keys=off';
---replace_column 9 #
-explain
-select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a;
---replace_column 9 #
-explain
-select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a and t3.pk1=t1.a;
-
-set optimizer_switch='extended_keys=on';
---replace_column 9 #
-explain
-select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a;
---replace_column 9 #
-explain
-select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a and t3.pk1=t1.a;
-
-drop table t1,t2,t3;
-
---echo #
---echo # Bug mdev-4340: performance regression with extended_keys=on
---echo #
-
-set @save_optimizer_switch=@@optimizer_switch;
-
-CREATE TABLE t1 (
- page_id int(8) unsigned NOT NULL AUTO_INCREMENT,
- page_namespace int(11) NOT NULL DEFAULT '0',
- page_title varbinary(255) NOT NULL DEFAULT '',
- page_restrictions tinyblob NOT NULL,
- page_counter bigint(20) unsigned NOT NULL DEFAULT '0',
- page_is_redirect tinyint(1) unsigned NOT NULL DEFAULT '0',
- page_is_new tinyint(1) unsigned NOT NULL DEFAULT '0',
- page_random double unsigned NOT NULL DEFAULT '0',
- page_touched varbinary(14) NOT NULL DEFAULT '',
- page_latest int(8) unsigned NOT NULL DEFAULT '0',
- page_len int(8) unsigned NOT NULL DEFAULT '0',
- PRIMARY KEY (page_id),
- UNIQUE KEY name_title (page_namespace,page_title),
- KEY page_random (page_random),
- KEY page_len (page_len),
- KEY page_redirect_namespace_len (page_is_redirect,page_namespace,page_len)
-) ENGINE=InnoDB AUTO_INCREMENT=38929100 DEFAULT CHARSET=binary;
-INSERT INTO t1 VALUES
-(38928077,0,'Sandbox','',0,0,0,0,'',0,0),(38928078,1,'Sandbox','',0,0,0,1,'',0,0),
-(38928079,2,'Sandbox','',0,0,0,2,'',0,0),(38928080,3,'Sandbox','',0,0,0,3,'',0,0),
-(38928081,4,'Sandbox','',0,0,0,4,'',0,0),(38928082,5,'Sandbox','',0,0,0,5,'',0,0);
-
-CREATE TABLE t2 (
- rev_id int(8) unsigned NOT NULL AUTO_INCREMENT,
- rev_page int(8) unsigned NOT NULL DEFAULT '0',
- rev_text_id int(8) unsigned NOT NULL DEFAULT '0',
- rev_comment varbinary(255) DEFAULT NULL,
- rev_user int(5) unsigned NOT NULL DEFAULT '0',
- rev_user_text varbinary(255) NOT NULL DEFAULT '',
- rev_timestamp varbinary(14) NOT NULL DEFAULT '',
- rev_minor_edit tinyint(1) unsigned NOT NULL DEFAULT '0',
- rev_deleted tinyint(1) unsigned NOT NULL DEFAULT '0',
- rev_len int(8) unsigned DEFAULT NULL,
- rev_parent_id int(8) unsigned DEFAULT NULL,
- rev_sha1 varbinary(32) NOT NULL DEFAULT '',
- PRIMARY KEY (rev_page,rev_id),
- UNIQUE KEY rev_id (rev_id),
- KEY rev_timestamp (rev_timestamp),
- KEY page_timestamp (rev_page,rev_timestamp),
- KEY user_timestamp (rev_user,rev_timestamp),
- KEY usertext_timestamp (rev_user_text,rev_timestamp,rev_user,rev_deleted,rev_minor_edit,rev_text_id,rev_comment)
-) ENGINE=InnoDB DEFAULT CHARSET=binary;
-INSERT INTO t2 VALUES
-(547116222,20,0,NULL,3,'','',0,0,NULL,NULL,''),(547117245,20,0,NULL,4,'','',0,0,NULL,NULL,''),
-(547118268,20,0,NULL,5,'','',0,0,NULL,NULL,''),(547114177,21,0,NULL,1,'','',0,0,NULL,NULL,''),
-(547115200,21,0,NULL,2,'','',0,0,NULL,NULL,''),(547116223,21,0,NULL,3,'','',0,0,NULL,NULL,''),
-(547117246,21,0,NULL,4,'','',0,0,NULL,NULL,''),(547118269,21,0,NULL,5,'','',0,0,NULL,NULL,''),
-(547114178,22,0,NULL,1,'','',0,0,NULL,NULL,''),(547115201,22,0,NULL,2,'','',0,0,NULL,NULL,''),
-(547116224,22,0,NULL,3,'','',0,0,NULL,NULL,''),(547117247,22,0,NULL,4,'','',0,0,NULL,NULL,''),
-(547116226,24,0,NULL,3,'','',0,0,NULL,NULL,''),(547117249,24,0,NULL,4,'','',0,0,NULL,NULL,''),
-(547118272,24,0,NULL,5,'','',0,0,NULL,NULL,''),(547114181,25,0,NULL,1,'','',0,0,NULL,NULL,''),
-(547115204,25,0,NULL,2,'','',0,0,NULL,NULL,''),(547116227,25,0,NULL,3,'','',0,0,NULL,NULL,''),
-(547116157,978,0,NULL,2,'','',0,0,NULL,NULL,''),(547117180,978,0,NULL,3,'','',0,0,NULL,NULL,''),
-(547118203,978,0,NULL,4,'','',0,0,NULL,NULL,''),(547119226,978,0,NULL,5,'','',0,0,NULL,NULL,''),
-(547115135,979,0,NULL,1,'','',0,0,NULL,NULL,''),(547116158,979,0,NULL,2,'','',0,0,NULL,NULL,''),
-(547116173,994,0,NULL,2,'','',0,0,NULL,NULL,''),(547117196,994,0,NULL,3,'','',0,0,NULL,NULL,''),
-(547118219,994,0,NULL,4,'','',0,0,NULL,NULL,''),(547119242,994,0,NULL,5,'','',0,0,NULL,NULL,''),
-(547115151,995,0,NULL,1,'','',0,0,NULL,NULL,''),(547116174,995,0,NULL,2,'','',0,0,NULL,NULL,''),
-(547117197,995,0,NULL,3,'','',0,0,NULL,NULL,''),(547118220,995,0,NULL,4,'','',0,0,NULL,NULL,''),
-(547118223,998,0,NULL,4,'','',0,0,NULL,NULL,''),(547119246,998,0,NULL,5,'','',0,0,NULL,NULL,''),
-(547115155,999,0,NULL,1,'','',0,0,NULL,NULL,''),(547116178,999,0,NULL,2,'','',0,0,NULL,NULL,''),
-(547117201,999,0,NULL,3,'','',0,0,NULL,NULL,''),(547118224,999,0,NULL,4,'','',0,0,NULL,NULL,''),
-(547119271,38928081,0,NULL,10,'','',0,0,NULL,NULL,''),(547119272,38928081,0,NULL,11,'','',0,0,NULL,NULL,''),
-(547119273,38928081,0,NULL,12,'','',0,0,NULL,NULL,''),(547119274,38928081,0,NULL,13,'','',0,0,NULL,NULL,''),
-(547119275,38928081,0,NULL,14,'','',0,0,NULL,NULL,''),(547119276,38928081,0,NULL,15,'','',0,0,NULL,NULL,''),
-(547119277,38928081,0,NULL,16,'','',0,0,NULL,NULL,''),(547119278,38928081,0,NULL,17,'','',0,0,NULL,NULL,''),
-(547119279,38928081,0,NULL,18,'','',0,0,NULL,NULL,''),(547119280,38928081,0,NULL,19,'','',0,0,NULL,NULL,'');
-
-CREATE TABLE t3 (
- old_id int(10) unsigned NOT NULL AUTO_INCREMENT,
- old_text mediumblob NOT NULL,
- old_flags tinyblob NOT NULL,
- PRIMARY KEY (old_id)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-INSERT INTO t3 VALUES
-(1,'text-0',''),(2,'text-1000',''),(3,'text-2000',''),(4,'text-3000',''),
-(5,'text-4000',''),(6,'text-5000',''),(7,'text-6000',''),(8,'text-7000',''),
-(9,'text-8000',''),(10,'text-9000',''),(11,'text-1',''),(12,'text-1001',''),
-(13,'text-2001',''),(14,'text-3001',''),(15,'text-4001',''),(16,'text-5001',''),
-(17,'text-6001',''),(18,'text-7001',''),(19,'text-8001',''),(20,'text-9001',''),
-(21,'text-2',''),(22,'text-1002',''),(23,'text-2002',''),(24,'text-3002',''),
-(25,'text-4002',''),(26,'text-5002',''),(27,'text-6002',''),(28,'text-7002',''),
-(29,'text-8002',''),(30,'text-9002',''),(31,'text-3',''),(32,'text-1003',''),
-(33,'text-2003',''),(34,'text-3003',''),(35,'text-4003',''),(36,'text-5003',''),
-(37,'text-6003',''),(38,'text-7003',''),(39,'text-8003',''),(40,'text-9003',''),
-(41,'text-4',''),(42,'text-1004',''),(43,'text-2004',''),(44,'text-3004',''),
-(45,'text-4004',''),(46,'text-5004',''),(47,'text-6004',''),(48,'text-7004',''),
-(49,'text-8004',''),(50,'text-9004',''),(51,'text-5',''),(52,'text-1005',''),
-(53,'text-2005',''),(54,'text-3005',''),(55,'text-4005',''),(56,'text-5005',''),
-(57,'text-6005',''),(58,'text-7005',''),(59,'text-8005',''),(60,'text-9005',''),
-(61,'text-6',''),(62,'text-1006',''),(63,'text-2006',''),(64,'text-3006',''),
-(65,'text-4006',''),(66,'text-5006',''),(67,'text-6006',''),(68,'text-7006',''),
-(69,'text-8006',''),(70,'text-9006',''),(71,'text-7',''),(72,'text-1007',''),
-(73,'text-2007',''),(74,'text-3007',''),(75,'text-4007',''),(76,'text-5007',''),
-(77,'text-6007',''),(78,'text-7007',''),(79,'text-8007',''),(80,'text-9007',''),
-(81,'text-8',''),(82,'text-1008',''),(83,'text-2008',''),(84,'text-3008',''),
-(85,'text-4008',''),(86,'text-5008',''),(87,'text-6008',''),(88,'text-7008',''),
-(89,'text-8008',''),(90,'text-9008',''),(91,'text-9',''),(92,'text-1009',''),
-(93,'text-2009',''),(94,'text-3009',''),(95,'text-4009',''),(96,'text-5009',''),
-(97,'text-6009',''),(98,'text-7009',''),(99,'text-8009',''),(100,'text-9009','');
-
-
-set optimizer_switch='extended_keys=off';
-EXPLAIN
-SELECT * FROM t1, t2 IGNORE INDEX (PRIMARY), t3
- WHERE page_id=rev_page AND rev_text_id=old_id AND page_namespace=4 AND page_title='Sandbox'
-ORDER BY rev_timestamp ASC LIMIT 10;
-
-set optimizer_switch='extended_keys=on';
-EXPLAIN
-SELECT * FROM t1, t2 IGNORE INDEX (PRIMARY), t3
- WHERE page_id=rev_page AND rev_text_id=old_id AND page_namespace=4 AND page_title='Sandbox'
-ORDER BY rev_timestamp ASC LIMIT 10;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # MDEV-5424 SELECT using ORDER BY DESC and LIMIT produces unexpected
---echo # results (InnoDB/XtraDB)
---echo #
-
-create table t1 (a bigint not null unique auto_increment, b varchar(10), primary key (a), key (b(2))) engine = myisam default character set utf8;
-create table t2 (a bigint not null unique auto_increment, b varchar(10), primary key (a), key (b(2))) engine = innodb default character set utf8;
-
-insert into t1 (b) values (null), (null), (null);
-insert into t2 (b) values (null), (null), (null);
-
-set optimizer_switch='extended_keys=on';
-explain select a from t1 where b is null order by a desc limit 2;
-select a from t1 where b is null order by a desc limit 2;
-explain select a from t2 where b is null order by a desc limit 2;
-select a from t2 where b is null order by a desc limit 2;
-set optimizer_switch='extended_keys=off';
-explain select a from t2 where b is null order by a desc limit 2;
-select a from t2 where b is null order by a desc limit 2;
-
-explain select a from t2 where b is null order by a desc;
-select a from t2 where b is null order by a desc;
-
-explain select a from t2 where b is null order by a desc,a,a;
-select a from t2 where b is null order by a desc,a,a;
-
-drop table t1, t2;
-
-set optimizer_switch=@save_optimizer_switch;
-
---echo #
---echo # MDEV-10325: Queries examines all rows of a tables when it should not
---echo #
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1 (
- pk int not null,
- col1 varchar(32),
- filler varchar(100),
- key idx1(col1(10)),
- primary key (pk)
-)engine=innodb;
-
-insert into t1
-select
- A.a + 10*B.a + 100*C.a,
- concat('1234567890-', 1000+ A.a + 10*B.a + 100*C.a),
- repeat('filler-data-', 4)
-from
- t0 A, t0 B, t0 C;
-
-let $q=explain select * from t1 where col1='1234567890-a';
-let $rows=query_get_value($q, rows, 1);
-if ($rows < 2)
-{
- --echo The EXPLAIN should not produce a query plan with type=ref, rows=1
- --die Fix for MDEV-10325 didnt work;
-}
-
-drop table t0,t1;
-
---echo #
---echo # MDEV-10360: Extended keys: index properties depend on index order
---echo #
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1 (
- index_id bigint(20) unsigned NOT NULL,
- index_class varchar(265) COLLATE latin1_general_ci DEFAULT NULL ,
- index_object_id int(10) unsigned NOT NULL DEFAULT '0' ,
- index_date_updated int(10) unsigned DEFAULT NULL ,
-
- PRIMARY KEY (index_id),
- KEY object (index_class(181),index_object_id),
- KEY index_date_updated (index_date_updated)
-) engine=innodb;
-
-create table t2 (
- index_id bigint(20) unsigned NOT NULL,
- index_class varchar(265) COLLATE latin1_general_ci DEFAULT NULL ,
- index_object_id int(10) unsigned NOT NULL DEFAULT '0' ,
- index_date_updated int(10) unsigned DEFAULT NULL ,
-
- PRIMARY KEY (index_id),
- KEY index_date_updated (index_date_updated),
- KEY object (index_class(181),index_object_id)
-) engine=innodb;
-
-insert into t1 select
- @a:=A.a + 10*B.a + 100*C.a,
- concat('val-', @a),
- 123456,
- A.a + 10*B.a
-from
- t0 A, t0 B, t0 C;
-
-insert into t2 select * from t1;
-
---echo # This must have the same query plan as the query below it:
---echo # type=range, key=index_date_updated, key_len=13
---replace_column 9 #
-explain
-select * from t1 force index(index_date_updated)
-where index_date_updated= 10 and index_id < 800;
-
---echo # This used to work from the start:
---replace_column 9 #
-explain
-select * from t2 force index(index_date_updated)
-where index_date_updated= 10 and index_id < 800;
-
-drop table t0,t1,t2;
-
-
---echo #
---echo # MDEV-11196: Error:Run-Time Check Failure #2 - Stack around the variable 'key_buff'
---echo # was corrupted, server crashes in opt_sum_query
-
-CREATE TABLE t1 (
- pk INT,
- f1 VARCHAR(3),
- f2 VARCHAR(1024),
- PRIMARY KEY (pk),
- KEY(f2)
-) ENGINE=InnoDB CHARSET utf8 ROW_FORMAT= DYNAMIC;
-
-INSERT INTO t1 VALUES (1,'foo','abc'),(2,'bar','def');
-SELECT MAX(t2.pk) FROM t1 t2 INNER JOIN t1 t3 ON t2.f1 = t3.f1 WHERE t2.pk <= 4;
-drop table t1;
-
-CREATE TABLE t1 (
- pk1 INT,
- pk2 INT,
- f1 VARCHAR(3),
- f2 VARCHAR(1021),
- PRIMARY KEY (pk1,pk2),
- KEY(f2)
-) ENGINE=InnoDB CHARSET utf8 ROW_FORMAT= DYNAMIC;
-
-INSERT INTO t1 VALUES (1,2,'2','abc'),(2,3,'3','def');
-explain format= json
-select * from t1 force index(f2) where pk1 <= 5 and pk2 <=5 and f2 = 'abc' and f1 <= '3';
-drop table t1;
-
-CREATE TABLE t1 (
-f2 INT,
-pk2 INT,
-f1 VARCHAR(3),
-pk1 VARCHAR(1000),
-PRIMARY KEY (pk1,pk2),
-KEY k1(pk1,f2)
-) ENGINE=InnoDB CHARSET utf8 ROW_FORMAT= DYNAMIC;
-INSERT INTO t1 VALUES (1,2,'2','abc'),(2,3,'3','def');
-explain format= json
-select * from t1 force index(k1) where f2 <= 5 and pk2 <=5 and pk1 = 'abc' and f1 <= '3';
-drop table t1;
diff --git a/mysql-test/t/innodb_group.test b/mysql-test/t/innodb_group.test
deleted file mode 100644
index 56c8d54003e..00000000000
--- a/mysql-test/t/innodb_group.test
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# Tests involving GROUP BY, aggregate functions and InnoDB
-#
-
-
---source include/have_innodb.inc
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-10556 Assertion `0' failed in virtual void Item_sum_field::set_result_field(Field*)
---echo #
-
-CREATE TABLE t1 (i INT) ENGINE=InnoDB;
-SELECT DISTINCT STDDEV(1) FROM t1 GROUP BY i ORDER BY BENCHMARK(0, BIT_XOR(i));
-DROP TABLE t1;
-
---echo #
---echo # End of 10.1 tests
---echo #
diff --git a/mysql-test/t/innodb_icp.test b/mysql-test/t/innodb_icp.test
deleted file mode 100644
index acb8238e01f..00000000000
--- a/mysql-test/t/innodb_icp.test
+++ /dev/null
@@ -1,78 +0,0 @@
-#
-# ICP/InnoDB tests (Index Condition Pushdown)
-#
-
---source include/have_innodb.inc
-
-set @save_storage_engine= @@storage_engine;
-set storage_engine=InnoDB;
-
-set @innodb_icp_tmp=@@optimizer_switch;
-set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
-
---source include/icp_tests.inc
-
---echo #
---echo # BUG#920132: Assert trx->n_active_thrs == 1 failed at que0que.c line 1050
---echo #
-CREATE TABLE t1 ( a INT )
- ENGINE=InnoDB;
-INSERT INTO t1 VALUES (7),(7);
-
-CREATE TABLE t2 ( b VARCHAR(1) );
-INSERT INTO t2 VALUES ('j'),('v');
-
-CREATE TABLE t3 (
- c INT, d VARCHAR(1), e VARCHAR(1),
- KEY (d,c)
-) ENGINE=InnoDB;
-INSERT INTO t3
- VALUES (6,'w','w'),
- (1,'v','v'),(7,'s','s'),(4,'l','l'),
- (7,'y','y'),(0,'c','c'),(2,'i','i'),
- (9,'h','h'),(4,'q','q'),(0,'a','a'),
- (9,'v','v'),(1,'u','u'),(3,'s','s'),
- (8,'z','z'),(1,'h','h'),(8,'p','p'),
- (6,'e','e'),(3,'i','i'),(6,'y','y');
-
-SELECT *
-FROM t1 INNER JOIN t2 INNER JOIN t3
- ON d = b
-WHERE
- NOT EXISTS ( SELECT * FROM t3 )
- OR a = c
-ORDER BY e;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # MDEV-5337: Wrong result in mariadb 5.5.32 with ORDER BY + LIMIT when index_condition_pushdown=on
---echo # MDEV-5512: Wrong result (WHERE clause ignored) with multiple clauses using Percona-XtraDB engine
---echo #
-
-create table t1(a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t2 (pk int primary key,
- key1 char(32),
- key2 char(32),
- key(key1),
- key(key2)
-) engine=innodb;
-
-insert into t2 select
- A.a+10*B.a+100*C.a,
- concat('rare-', A.a+10*B.a),
- concat('rare-', A.a+10*B.a)
-from
- t1 A, t1 B, t1 C;
-update t2 set key1='frequent-val' where pk between 100 and 350;
-select * from t2 ignore key(PRIMARY)
-where key1='frequent-val' and key2 between 'rare-400' and 'rare-450' order by pk limit 2;
-
-drop table t1, t2;
-
-
-set optimizer_switch=@innodb_icp_tmp;
-set storage_engine= @save_storage_engine;
-
diff --git a/mysql-test/t/innodb_ignore_builtin-master.opt b/mysql-test/t/innodb_ignore_builtin-master.opt
deleted file mode 100644
index f7289eed20e..00000000000
--- a/mysql-test/t/innodb_ignore_builtin-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---ignore_builtin_innodb
diff --git a/mysql-test/t/innodb_ignore_builtin.test b/mysql-test/t/innodb_ignore_builtin.test
deleted file mode 100644
index 66f7e47b703..00000000000
--- a/mysql-test/t/innodb_ignore_builtin.test
+++ /dev/null
@@ -1,6 +0,0 @@
-#
-# Bug #42610: Dynamic plugin broken in 5.1.31
-#
-show variables like 'ignore_builtin_innodb';
-select PLUGIN_NAME from information_schema.plugins
-where PLUGIN_NAME = "InnoDb" and PLUGIN_LIBRARY IS NULL;
diff --git a/mysql-test/t/innodb_load_xa.opt b/mysql-test/t/innodb_load_xa.opt
deleted file mode 100644
index 9e9ea9a1600..00000000000
--- a/mysql-test/t/innodb_load_xa.opt
+++ /dev/null
@@ -1 +0,0 @@
---ignore-builtin-innodb --loose-innodb
diff --git a/mysql-test/t/innodb_load_xa.test b/mysql-test/t/innodb_load_xa.test
deleted file mode 100644
index 65b74120e8e..00000000000
--- a/mysql-test/t/innodb_load_xa.test
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-# MDEV-6082 Assertion `0' fails in TC_LOG_DUMMY::log_and_order on DML after installing TokuDB at runtime on server with disabled InnoDB
-#
---source include/not_embedded.inc
-
-# this test needs exactly one (1) XA-capable engine running initially.
-# it's binlog "engine" in 10.0 but wsrep in here, because it cannot be disabled
---source include/have_wsrep.inc
-
-if (!$HA_INNODB_SO) {
- --skip Need InnoDB plugin
-}
-install plugin innodb soname 'ha_innodb';
-select engine,support,transactions,xa from information_schema.engines where engine='innodb';
-create table t1 (a int) engine=innodb;
-start transaction;
-insert t1 values (1);
-insert t1 values (2);
-commit;
-show status like 'Handler_prepare';
-drop table t1;
-uninstall plugin innodb;
-
---source include/restart_mysqld.inc
-
diff --git a/mysql-test/t/innodb_mrr_cpk.test b/mysql-test/t/innodb_mrr_cpk.test
deleted file mode 100644
index cb79c238f2b..00000000000
--- a/mysql-test/t/innodb_mrr_cpk.test
+++ /dev/null
@@ -1,229 +0,0 @@
-#
-# Tests for DS-MRR over clustered primary key. The only engine that supports
-# this is InnoDB/XtraDB.
-#
-# Basic idea about testing
-# - DS-MRR/CPK works only with BKA
-# - Should also test index condition pushdown
-# - Should also test whatever uses RANGE_SEQ_IF::skip_record() for filtering
-# - Also test access using prefix of primary key
-#
-# - Forget about cost model, BKA's multi_range_read_info() call passes 10 for
-# #rows, the call is there at all only for applicability check
-#
--- source include/have_innodb.inc
-
---disable_warnings
-drop table if exists t0,t1,t2,t3;
---enable_warnings
-
-set @innodb_mrr_cpk_tmp=@@optimizer_switch;
-set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
-
-set @save_join_cache_level=@@join_cache_level;
-set join_cache_level=6;
-
-set @save_storage_engine=@@storage_engine;
-set storage_engine=innodb;
-
-create table t0(a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t1(a char(8), b char(8), filler char(100), primary key(a));
-show create table t1;
-
-insert into t1 select
- concat('a-', 1000 + A.a + B.a*10 + C.a*100, '=A'),
- concat('b-', 1000 + A.a + B.a*10 + C.a*100, '=B'),
- 'filler'
-from t0 A, t0 B, t0 C;
-
-create table t2 (a char(8));
-insert into t2 values ('a-1010=A'), ('a-1030=A'), ('a-1020=A');
-
---echo This should use join buffer:
-explain select * from t1, t2 where t1.a=t2.a;
-
---echo This output must be sorted by value of t1.a:
-select * from t1, t2 where t1.a=t2.a;
-drop table t1, t2;
-
-# Try multi-column indexes
-create table t1(
- a char(8) character set utf8, b int, filler char(100),
- primary key(a,b)
-);
-
-insert into t1 select
- concat('a-', 1000 + A.a + B.a*10 + C.a*100, '=A'),
- 1000 + A.a + B.a*10 + C.a*100,
- 'filler'
-from t0 A, t0 B, t0 C;
-
-create table t2 (a char(8) character set utf8, b int);
-insert into t2 values ('a-1010=A', 1010), ('a-1030=A', 1030), ('a-1020=A', 1020);
-explain select * from t1, t2 where t1.a=t2.a and t1.b=t2.b;
-select * from t1, t2 where t1.a=t2.a and t1.b=t2.b;
-
-# Try with dataset that causes identical lookup keys:
-insert into t2 values ('a-1030=A', 1030), ('a-1020=A', 1020);
-explain select * from t1, t2 where t1.a=t2.a and t1.b=t2.b;
-select * from t1, t2 where t1.a=t2.a and t1.b=t2.b;
-
-drop table t1, t2;
-
-create table t1(
- a varchar(8) character set utf8, b int, filler char(100),
- primary key(a,b)
-);
-
-insert into t1 select
- concat('a-', 1000 + A.a + B.a*10 + C.a*100, '=A'),
- 1000 + A.a + B.a*10 + C.a*100,
- 'filler'
-from t0 A, t0 B, t0 C;
-
-create table t2 (a char(8) character set utf8, b int);
-insert into t2 values ('a-1010=A', 1010), ('a-1030=A', 1030), ('a-1020=A', 1020);
-explain select * from t1, t2 where t1.a=t2.a and t1.b=t2.b;
-select * from t1, t2 where t1.a=t2.a and t1.b=t2.b;
-
-#
-# Try scanning on a CPK prefix
-#
-explain select * from t1, t2 where t1.a=t2.a;
-select * from t1, t2 where t1.a=t2.a;
-drop table t1, t2;
-
-#
-# The above example is not very interesting, as CPK prefix has
-# only one match. Create a dataset where scan on CPK prefix
-# would produce multiple matches:
-#
-create table t1 (a int, b int, c int, filler char(100), primary key(a,b,c));
-insert into t1 select A.a, B.a, C.a, 'filler' from t0 A, t0 B, t0 C;
-
-insert into t1 values (11, 11, 11, 'filler');
-insert into t1 values (11, 11, 12, 'filler');
-insert into t1 values (11, 11, 13, 'filler');
-insert into t1 values (11, 22, 1234, 'filler');
-insert into t1 values (11, 33, 124, 'filler');
-insert into t1 values (11, 33, 125, 'filler');
-
-create table t2 (a int, b int);
-insert into t2 values (11,33), (11,22), (11,11);
-
-explain select * from t1, t2 where t1.a=t2.a and t1.b=t2.b;
-select * from t1, t2 where t1.a=t2.a and t1.b=t2.b;
-
-# Check a real resultset for comaprison:
-set join_cache_level=0;
-select * from t1, t2 where t1.a=t2.a and t1.b=t2.b;
-set join_cache_level=6;
-
-
-#
-# Check that Index Condition Pushdown (BKA) actually works:
-#
-explain select * from t1, t2 where t1.a=t2.a and t2.b + t1.b > 100;
-select * from t1, t2 where t1.a=t2.a and t2.b + t1.b > 100;
-
-set optimizer_switch='index_condition_pushdown=off';
-explain select * from t1, t2 where t1.a=t2.a and t2.b + t1.b > 100;
-select * from t1, t2 where t1.a=t2.a and t2.b + t1.b > 100;
-set optimizer_switch='index_condition_pushdown=on';
-
-drop table t1,t2;
-
-drop table t0;
-
---echo #
---echo # MDEV-6878: Use of uninitialized saved_primary_key in Mrr_ordered_index_reader::resume_read()
---echo #
-create table t0(a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1 (
- pk varchar(32) character set utf8 primary key,
- kp1 char(32) not null,
- col1 varchar(32),
- key (kp1)
-) engine=innodb;
-
-insert into t1
-select
- concat('pk-', 1000 +A.a),
- concat('kp1-', 1000 +A.a),
- concat('val-', 1000 +A.a)
-from test.t0 A ;
-
-create table t2 as select kp1 as a from t1;
-
-set join_cache_level=8;
-set optimizer_switch='mrr=on,mrr_sort_keys=on';
-explain
-select * from t2 straight_join t1 force index(kp1) where t1.kp1=t2.a;
-select * from t2 straight_join t1 force index(kp1) where t1.kp1=t2.a;
-
-drop table t0,t1,t2;
-
---echo #
---echo #
---echo # MDEV-3817: Wrong result with index_merge+index_merge_intersection, InnoDB table, join, AND and OR conditions
---echo #
-
-set @tmp_mdev3817=@@optimizer_switch;
-SET optimizer_switch='index_merge=on,index_merge_intersection=on';
-
-CREATE TABLE t1 (
- a INT PRIMARY KEY,
- b INT,
- c VARCHAR(1024) CHARACTER SET utf8,
- d INT,
- KEY (b)
-) ENGINE=InnoDB;
-
-INSERT INTO t1 VALUES
-(1, 9, 'one', 11), (2, 6, 'two', 12), (3, 2, 'three', 13), (4, 5, 'four', 14);
-
-CREATE TABLE t2 (e INT, g INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,9), (2,6) ;
-
-SELECT * FROM t1, t2 WHERE g = b AND ( a < 7 OR a > e );
-
-DROP TABLE t1, t2;
-set optimizer_switch=@tmp_mdev3817;
-
---echo #
---echo # MDEV-5037: Server crash on a JOIN on a derived table with join_cache_level > 2
---echo #
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-CREATE TABLE t1 (
- id char(8) CHARACTER SET utf8 NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-CREATE TABLE t2 (
- id char(8) CHARACTER SET utf8 DEFAULT NULL,
- url text CHARACTER SET utf8
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-insert into t1 select '03b2ca8c' from t0 A, t0 B limit 80;
-insert into t2 select '03b2ca8c','' from t0 A, t0 B, t0 C;
-
-set @tmp_mdev5037=@@join_cache_level;
-set join_cache_level=3;
-
---replace_column 9 #
-explain SELECT 1 FROM (SELECT url, id FROM t2 LIMIT 1 OFFSET 20) derived RIGHT JOIN t1 ON t1.id = derived.id;
-
-set join_cache_level= @tmp_mdev5037;
-drop table t0,t1,t2;
-
---echo #
---echo # This must be at the end:
---echo #
-
-set @@join_cache_level= @save_join_cache_level;
-set storage_engine=@save_storage_engine;
-set optimizer_switch=@innodb_mrr_cpk_tmp;
diff --git a/mysql-test/t/innodb_mysql_lock.test b/mysql-test/t/innodb_mysql_lock.test
deleted file mode 100644
index 24ace437c50..00000000000
--- a/mysql-test/t/innodb_mysql_lock.test
+++ /dev/null
@@ -1,256 +0,0 @@
--- source include/have_innodb.inc
-
-# Save the initial number of concurrent sessions.
---source include/count_sessions.inc
-
-set @old_innodb_lock_wait_timeout=@@global.innodb_lock_wait_timeout;
-set global innodb_lock_wait_timeout=300;
-set session innodb_lock_wait_timeout=300;
-
-call mtr.add_suppression("Deadlock found when trying to get lock; try restarting transaction");
-
---echo #
---echo # Bug #22876 Four-way deadlock
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-connect (con3,localhost,root,,);
-
-connection con1;
-set @@autocommit=0;
-CREATE TABLE t1(s1 INT UNIQUE) ENGINE=innodb;
-INSERT INTO t1 VALUES (1);
-
-connection con2;
-set @@autocommit=0;
-INSERT INTO t1 VALUES (2);
---send INSERT INTO t1 VALUES (1)
-
-connection con3;
-set @@autocommit=0;
---send DROP TABLE t1
-
-connection con1;
-let $wait_condition=
- SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE info = "INSERT INTO t1 VALUES (1)" and
- state = "update";
---source include/wait_condition.inc
-let $wait_condition=
- SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE info = "DROP TABLE t1" and
- state = "Waiting for table metadata lock";
---source include/wait_condition.inc
---echo # Connection 1 is now holding the lock.
---echo # Issuing insert from connection 1 while connection 2&3
---echo # is waiting for the lock should give a deadlock error.
---error ER_LOCK_DEADLOCK
-INSERT INTO t1 VALUES (2);
-
---echo # Cleanup
-connection con2;
---reap
-commit;
-set @@autocommit=1;
-connection con1;
-commit;
-set @@autocommit=1;
-connection con3;
---reap
-set @@autocommit=1;
-connection default;
-
-disconnect con1;
-disconnect con2;
-disconnect con3;
-
-
---echo #
---echo # Test for bug #37346 "innodb does not detect deadlock between update
---echo # and alter table".
---echo #
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (c1 int primary key, c2 int, c3 int) engine=InnoDB;
-insert into t1 values (1,1,0),(2,2,0),(3,3,0),(4,4,0),(5,5,0);
-begin;
---echo # Run statement which acquires X-lock on one of table's rows.
-update t1 set c3=c3+1 where c2=3;
-
---echo #
-connect (con37346,localhost,root,,test,,);
-connection con37346;
---echo # The below ALTER TABLE statement should wait till transaction
---echo # in connection 'default' is complete and then succeed.
---echo # It should not deadlock or fail with ER_LOCK_DEADLOCK error.
---echo # Sending:
---send alter table t1 add column c4 int;
-
---echo #
-connection default;
---echo # Wait until the above ALTER TABLE gets blocked because this
---echo # connection holds SW metadata lock on table to be altered.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "alter table t1 add column c4 int";
---source include/wait_condition.inc
-
---echo # The below statement should succeed. It should not
---echo # deadlock or end with ER_LOCK_DEADLOCK error.
-update t1 set c3=c3+1 where c2=4;
-
---echo # Unblock ALTER TABLE by committing transaction.
-commit;
-
---echo #
-connection con37346;
---echo # Reaping ALTER TABLE.
---reap
-
---echo #
-connection default;
-disconnect con37346;
-drop table t1;
-
---echo #
---echo # Bug#53798 OPTIMIZE TABLE breaks repeatable read
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (a INT) engine=innodb;
-INSERT INTO t1 VALUES (1), (2), (3);
-
-connect (con1, localhost, root);
-START TRANSACTION WITH CONSISTENT SNAPSHOT;
-SELECT * FROM t1;
-
-connection default;
---echo # This should block
---echo # Sending:
---send OPTIMIZE TABLE t1
-
-connection con1;
-let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for table metadata lock' AND info='OPTIMIZE TABLE t1';
---source include/wait_condition.inc
-SELECT * FROM t1;
-COMMIT;
-
-connection default;
---echo # Reaping OPTIMIZE TABLE t1
---reap
-disconnect con1;
-DROP TABLE t1;
-
-
---echo #
---echo # Bug#49891 View DDL breaks REPEATABLE READ
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v2;
---enable_warnings
-
-CREATE TABLE t1 ( f1 INTEGER ) ENGINE = innodb;
-CREATE TABLE t2 ( f1 INTEGER );
-CREATE VIEW v1 AS SELECT 1 FROM t1;
-
-connect (con2, localhost, root);
-connect (con3, localhost, root);
-
-connection con3;
-LOCK TABLE t1 WRITE;
-
-connection default;
-START TRANSACTION;
-# This should block due to t1 being locked.
---echo # Sending:
---send SELECT * FROM v1
-
-connection con2;
---echo # Waiting for 'SELECT * FROM v1' to sync in.
-let $wait_condition=
- SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for table metadata lock" AND info = "SELECT * FROM v1";
---source include/wait_condition.inc
-# This should block due to v1 being locked.
---echo # Sending:
---send ALTER VIEW v1 AS SELECT 2 FROM t2
-
-connection con3;
---echo # Waiting for 'ALTER VIEW v1 AS SELECT 2 FROM t2' to sync in.
-let $wait_condition=
- SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for table metadata lock" AND
- info = "ALTER VIEW v1 AS SELECT 2 FROM t2";
---source include/wait_condition.inc
-# Unlock t1 allowing SELECT * FROM v1 to proceed.
-UNLOCK TABLES;
-
-connection default;
---echo # Reaping: SELECT * FROM v1
---reap
-SELECT * FROM v1;
-COMMIT;
-
-connection con2;
---echo # Reaping: ALTER VIEW v1 AS SELECT 2 FROM t2
---reap
-
-connection default;
-DROP TABLE t1, t2;
-DROP VIEW v1;
-disconnect con2;
-disconnect con3;
-
-
---echo #
---echo # Bug#11815600 [ERROR] INNODB COULD NOT FIND INDEX PRIMARY
---echo # KEY NO 0 FOR TABLE IN ERROR LOG
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
---connect (con1,localhost,root)
-
-connection default;
-CREATE TABLE t1 (id INT PRIMARY KEY, value INT) ENGINE = InnoDB;
-INSERT INTO t1 VALUES (1, 12345);
-START TRANSACTION;
-SELECT * FROM t1;
-
---connection con1
-SET lock_wait_timeout=1;
-# Test with two timeouts, as the first version of this patch
-# only worked with one timeout.
---error ER_LOCK_WAIT_TIMEOUT
-ALTER TABLE t1 ADD INDEX idx(value);
---error ER_LOCK_WAIT_TIMEOUT
-ALTER TABLE t1 ADD INDEX idx(value);
-
---connection default
-SELECT * FROM t1;
-COMMIT;
-DROP TABLE t1;
-disconnect con1;
-
-
-# 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
-
-set global innodb_lock_wait_timeout=@old_innodb_lock_wait_timeout;
-
diff --git a/mysql-test/t/innodb_mysql_lock2.test b/mysql-test/t/innodb_mysql_lock2.test
deleted file mode 100644
index f319fe23568..00000000000
--- a/mysql-test/t/innodb_mysql_lock2.test
+++ /dev/null
@@ -1,868 +0,0 @@
-# This test covers behavior for InnoDB tables.
---source include/have_innodb.inc
-# This test requires statement/mixed mode binary logging.
-# Row-based mode puts weaker serializability requirements
-# so weaker locks are acquired for it.
-# Also in ROW mode LOCK_S row locks won't be acquired for DML
-# and test for bug#51263 won't trigger execution path on which
-# this bug was encountered.
---source include/have_binlog_format_mixed_or_statement.inc
-# Original test case for bug#51263 needs partitioning.
---source include/have_partition.inc
-# Save the initial number of concurrent sessions.
---source include/count_sessions.inc
-
---disable_query_log
-CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
---enable_query_log
-
---echo #
---echo # Test how do we handle locking in various cases when
---echo # we read data from InnoDB tables.
---echo #
---echo # In fact by performing this test we check two things:
---echo # 1) That SQL-layer correctly determine type of thr_lock.c
---echo # lock to be acquired/passed to InnoDB engine.
---echo # 2) That InnoDB engine correctly interprets this lock
---echo # type and takes necessary row locks or does not
---echo # take them if they are not necessary.
---echo #
-
---echo # This test makes sense only in REPEATABLE-READ mode as
---echo # in SERIALIZABLE mode all statements that read data take
---echo # shared lock on them to enforce its semantics.
-select @@session.tx_isolation;
-
---echo # Prepare playground by creating tables, views,
---echo # routines and triggers used in tests.
-connect (con1, localhost, root,,);
-connection default;
---disable_warnings
-drop table if exists t0, t1, t2, t3, t4, t5;
-drop view if exists v1, v2;
-drop procedure if exists p1;
-drop procedure if exists p2;
-drop function if exists f1;
-drop function if exists f2;
-drop function if exists f3;
-drop function if exists f4;
-drop function if exists f5;
-drop function if exists f6;
-drop function if exists f7;
-drop function if exists f8;
-drop function if exists f9;
-drop function if exists f10;
-drop function if exists f11;
-drop function if exists f12;
-drop function if exists f13;
-drop function if exists f14;
-drop function if exists f15;
---enable_warnings
-create table t1 (i int primary key) engine=innodb;
-insert into t1 values (1), (2), (3), (4), (5);
-create table t2 (j int primary key) engine=innodb;
-insert into t2 values (1), (2), (3), (4), (5);
-create table t3 (k int primary key) engine=innodb;
-insert into t3 values (1), (2), (3);
-create table t4 (l int primary key) engine=innodb;
-insert into t4 values (1);
-create table t5 (l int primary key) engine=innodb;
-insert into t5 values (1);
-create view v1 as select i from t1;
-create view v2 as select j from t2 where j in (select i from t1);
-create procedure p1(k int) insert into t2 values (k);
-delimiter |;
-create function f1() returns int
-begin
- declare j int;
- select i from t1 where i = 1 into j;
- return j;
-end|
-create function f2() returns int
-begin
- declare k int;
- select i from t1 where i = 1 into k;
- insert into t2 values (k + 5);
- return 0;
-end|
-create function f3() returns int
-begin
- return (select i from t1 where i = 3);
-end|
-create function f4() returns int
-begin
- if (select i from t1 where i = 3) then
- return 1;
- else
- return 0;
- end if;
-end|
-create function f5() returns int
-begin
- insert into t2 values ((select i from t1 where i = 1) + 5);
- return 0;
-end|
-create function f6() returns int
-begin
- declare k int;
- select i from v1 where i = 1 into k;
- return k;
-end|
-create function f7() returns int
-begin
- declare k int;
- select j from v2 where j = 1 into k;
- return k;
-end|
-create function f8() returns int
-begin
- declare k int;
- select i from v1 where i = 1 into k;
- insert into t2 values (k+5);
- return k;
-end|
-create function f9() returns int
-begin
- update v2 set j=j+10 where j=1;
- return 1;
-end|
-create function f10() returns int
-begin
- return f1();
-end|
-create function f11() returns int
-begin
- declare k int;
- set k= f1();
- insert into t2 values (k+5);
- return k;
-end|
-create function f12(p int) returns int
-begin
- insert into t2 values (p);
- return p;
-end|
-create function f13(p int) returns int
-begin
- return p;
-end|
-create procedure p2(inout p int)
-begin
- select i from t1 where i = 1 into p;
-end|
-create function f14() returns int
-begin
- declare k int;
- call p2(k);
- insert into t2 values (k+5);
- return k;
-end|
-create function f15() returns int
-begin
- declare k int;
- call p2(k);
- return k;
-end|
-create trigger t4_bi before insert on t4 for each row
-begin
- declare k int;
- select i from t1 where i=1 into k;
- set new.l= k+1;
-end|
-create trigger t4_bu before update on t4 for each row
-begin
- if (select i from t1 where i=1) then
- set new.l= 2;
- end if;
-end|
-create trigger t4_bd before delete on t4 for each row
-begin
- if !(select i from v1 where i=1) then
- signal sqlstate '45000';
- end if;
-end|
-create trigger t5_bi before insert on t5 for each row
-begin
- set new.l= f1()+1;
-end|
-create trigger t5_bu before update on t5 for each row
-begin
- declare j int;
- call p2(j);
- set new.l= j + 1;
-end|
-delimiter ;|
-
---echo #
---echo # Set common variables to be used by scripts called below.
---echo #
-let $con_aux= con1;
-let $table= t1;
-
-
---echo #
---echo # 1. Statements that read tables and do not use subqueries.
---echo #
-
---echo #
---echo # 1.1 Simple SELECT statement.
---echo #
---echo # No locks are necessary as this statement won't be written
---echo # to the binary log and InnoDB supports snapshots.
-let $statement= select * from t1;
---source include/check_no_row_lock.inc
-
---echo #
---echo # 1.2 Multi-UPDATE statement.
---echo #
---echo # Has to take shared locks on rows in the table being read as this
---echo # statement will be written to the binary log and therefore should
---echo # be serialized with concurrent statements.
-let $statement= update t2, t1 set j= j - 1 where i = j;
-let $wait_statement= $statement;
---source include/check_shared_row_lock.inc
-
---echo #
---echo # 1.3 Multi-DELETE statement.
---echo #
---echo # The above is true for this statement as well.
-let $statement= delete t2 from t1, t2 where i = j;
-let $wait_statement= $statement;
---source include/check_shared_row_lock.inc
-
---echo #
---echo # 1.4 DESCRIBE statement.
---echo #
---echo # This statement does not really read data from the
---echo # target table and thus does not take any lock on it.
---echo # We check this for completeness of coverage.
-let $statement= describe t1;
---source include/check_no_row_lock.inc
-
---echo #
---echo # 1.5 SHOW statements.
---echo #
---echo # The above is true for SHOW statements as well.
-let $statement= show create table t1;
---source include/check_no_row_lock.inc
-let $statement= show keys from t1;
---source include/check_no_row_lock.inc
-
-
---echo #
---echo # 2. Statements which read tables through subqueries.
---echo #
-
---echo #
---echo # 2.1 CALL with a subquery.
---echo #
---echo # A strong lock is not necessary as this statement is not
---echo # written to the binary log as a whole (it is written
---echo # statement-by-statement) and thanks to MVCC we can always get
---echo # versions of rows prior to the update that has locked them.
---echo # But in practice InnoDB does locking reads for all statements
---echo # other than SELECT (unless it is a READ-COMITTED mode or
---echo # innodb_locks_unsafe_for_binlog is ON).
-let $statement= call p1((select i + 5 from t1 where i = 1));
-let $wait_statement= $statement;
---source include/check_shared_row_lock.inc
-
---echo #
---echo # 2.2 CREATE TABLE with a subquery.
---echo #
---echo # Has to take shared locks on rows in the table being read as
---echo # this statement is written to the binary log and therefore
---echo # should be serialized with concurrent statements.
-let $statement= create table t0 engine=innodb select * from t1;
-let $wait_statement= $statement;
---source include/check_shared_row_lock.inc
-drop table t0;
-let $statement= create table t0 engine=innodb select j from t2 where j in (select i from t1);
-let $wait_statement= $statement;
---source include/check_shared_row_lock.inc
-drop table t0;
-
---echo #
---echo # 2.3 DELETE with a subquery.
---echo #
---echo # The above is true for this statement as well.
-let $statement= delete from t2 where j in (select i from t1);
-let $wait_statement= $statement;
---source include/check_shared_row_lock.inc
-
---echo #
---echo # 2.4 MULTI-DELETE with a subquery.
---echo #
---echo # Same is true for this statement as well.
-let $statement= delete t2 from t3, t2 where k = j and j in (select i from t1);
-let $wait_statement= $statement;
---source include/check_shared_row_lock.inc
-
---echo #
---echo # 2.5 DO with a subquery.
---echo #
---echo # In theory should not take row locks as it is not logged.
---echo # In practice InnoDB takes shared row locks.
-let $statement= do (select i from t1 where i = 1);
-let $wait_statement= $statement;
---source include/check_shared_row_lock.inc
-
---echo #
---echo # 2.6 INSERT with a subquery.
---echo #
---echo # Has to take shared locks on rows in the table being read as
---echo # this statement is written to the binary log and therefore
---echo # should be serialized with concurrent statements.
-let $statement= insert into t2 select i+5 from t1;
-let $wait_statement= $statement;
---source include/check_shared_row_lock.inc
-let $statement= insert into t2 values ((select i+5 from t1 where i = 4));
-let $wait_statement= $statement;
---source include/check_shared_row_lock.inc
-
---echo #
---echo # 2.7 LOAD DATA with a subquery.
---echo #
---echo # The above is true for this statement as well.
-let $statement= load data infile '../../std_data/rpl_loaddata.dat' into table t2 (@a, @b) set j= @b + (select i from t1 where i = 1);
-let $wait_statement= $statement;
---source include/check_shared_row_lock.inc
-
---echo #
---echo # 2.8 REPLACE with a subquery.
---echo #
---echo # Same is true for this statement as well.
-let $statement= replace into t2 select i+5 from t1;
-let $wait_statement= $statement;
---source include/check_shared_row_lock.inc
-let $statement= replace into t2 values ((select i+5 from t1 where i = 4));
-let $wait_statement= $statement;
---source include/check_shared_row_lock.inc
-
---echo #
---echo # 2.9 SELECT with a subquery.
---echo #
---echo # Locks are not necessary as this statement is not written
---echo # to the binary log and thanks to MVCC we can always get
---echo # versions of rows prior to the update that has locked them.
---echo #
---echo # Also serves as a test case for bug #46947 "Embedded SELECT
---echo # without FOR UPDATE is causing a lock".
-let $statement= select * from t2 where j in (select i from t1);
---source include/check_no_row_lock.inc
-
---echo #
---echo # 2.10 SET with a subquery.
---echo #
---echo # In theory should not require locking as it is not written
---echo # to the binary log. In practice InnoDB acquires shared row
---echo # locks.
-let $statement= set @a:= (select i from t1 where i = 1);
-let $wait_statement= $statement;
---source include/check_shared_row_lock.inc
-
---echo #
---echo # 2.11 SHOW with a subquery.
---echo #
---echo # Similarly to the previous case, in theory should not require locking
---echo # as it is not written to the binary log. In practice InnoDB
---echo # acquires shared row locks.
-let $statement= show tables from test where Tables_in_test = 't2' and (select i from t1 where i = 1);
-let $wait_statement= $statement;
---source include/check_shared_row_lock.inc
-let $statement= show columns from t2 where (select i from t1 where i = 1);
-let $wait_statement= $statement;
---source include/check_shared_row_lock.inc
-
---echo #
---echo # 2.12 UPDATE with a subquery.
---echo #
---echo # Has to take shared locks on rows in the table being read as
---echo # this statement is written to the binary log and therefore
---echo # should be serialized with concurrent statements.
-let $statement= update t2 set j= j-10 where j in (select i from t1);
-let $wait_statement= $statement;
---source include/check_shared_row_lock.inc
-
---echo #
---echo # 2.13 MULTI-UPDATE with a subquery.
---echo #
---echo # Same is true for this statement as well.
-let $statement= update t2, t3 set j= j -10 where j=k and j in (select i from t1);
-let $wait_statement= $statement;
---source include/check_shared_row_lock.inc
-
-
---echo #
---echo # 3. Statements which read tables through a view.
---echo #
-
---echo #
---echo # 3.1 SELECT statement which uses some table through a view.
---echo #
---echo # Since this statement is not written to the binary log
---echo # and old version of rows are accessible thanks to MVCC,
---echo # no locking is necessary.
-let $statement= select * from v1;
---source include/check_no_row_lock.inc
-let $statement= select * from v2;
---source include/check_no_row_lock.inc
-let $statement= select * from t2 where j in (select i from v1);
---source include/check_no_row_lock.inc
-let $statement= select * from t3 where k in (select j from v2);
---source include/check_no_row_lock.inc
-
---echo #
---echo # 3.2 Statements which modify a table and use views.
---echo #
---echo # Since such statements are going to be written to the binary
---echo # log they need to be serialized against concurrent statements
---echo # and therefore should take shared row locks on data read.
-let $statement= update t2 set j= j-10 where j in (select i from v1);
-let $wait_statement= $statement;
---source include/check_shared_row_lock.inc
-let $statement= update t3 set k= k-10 where k in (select j from v2);
-let $wait_statement= $statement;
---source include/check_shared_row_lock.inc
-let $statement= update t2, v1 set j= j-10 where j = i;
-let $wait_statement= $statement;
---source include/check_shared_row_lock.inc
-let $statement= update v2 set j= j-10 where j = 3;
-let $wait_statement= $statement;
---source include/check_shared_row_lock.inc
-
-
---echo #
---echo # 4. Statements which read tables through stored functions.
---echo #
-
---echo #
---echo # 4.1 SELECT/SET with a stored function which does not
---echo # modify data and uses SELECT in its turn.
---echo #
---echo # There is no need to take row locks on the table
---echo # being selected from in SF as the call to such function
---echo # won't get into the binary log.
---echo #
---echo # However in practice innodb takes strong lock on tables
---echo # being selected from within SF, when SF is called from
---echo # non SELECT statements like 'set' statement below.
-let $statement= select f1();
-let $wait_statement= select i from t1 where i = 1 into j;
---source include/check_no_row_lock.inc
-let $statement= set @a:= f1();
-let $wait_statement= select i from t1 where i = 1 into j;
---source include/check_shared_row_lock.inc
-
---echo #
---echo # 4.2 INSERT (or other statement which modifies data) with
---echo # a stored function which does not modify data and uses
---echo # SELECT.
---echo #
---echo # Since such statement is written to the binary log it should
---echo # be serialized with concurrent statements affecting the data
---echo # it uses. Therefore it should take row locks on the data
---echo # it reads.
-let $statement= insert into t2 values (f1() + 5);
-let $wait_statement= select i from t1 where i = 1 into j;
---source include/check_shared_row_lock.inc
-
---echo #
---echo # 4.3 SELECT/SET with a stored function which
---echo # reads and modifies data.
---echo #
---echo # Since a call to such function is written to the binary log,
---echo # it should be serialized with concurrent statements affecting
---echo # the data it uses. Hence, row locks on the data read
---echo # should be taken.
-let $statement= select f2();
-let $wait_statement= select i from t1 where i = 1 into k;
---source include/check_shared_row_lock.inc
-let $statement= set @a:= f2();
-let $wait_statement= select i from t1 where i = 1 into k;
---source include/check_shared_row_lock.inc
-
---echo #
---echo # 4.4. SELECT/SET with a stored function which does not
---echo # modify data and reads a table through subselect
---echo # in a control construct.
---echo #
---echo # Call to this function won't get to the
---echo # binary log and thus no locking is needed.
---echo #
---echo # However in practice innodb takes strong lock on tables
---echo # being selected from within SF, when SF is called from
---echo # non SELECT statements like 'set' statement below.
-let $statement= select f3();
-let $wait_statement= $statement;
---source include/check_no_row_lock.inc
-let $statement= set @a:= f3();
-let $wait_statement= $statement;
---source include/check_shared_row_lock.inc
-let $statement= select f4();
-let $wait_statement= $statement;
---source include/check_no_row_lock.inc
-let $statement= set @a:= f4();
-let $wait_statement= $statement;
---source include/check_shared_row_lock.inc
-
---echo #
---echo # 4.5. INSERT (or other statement which modifies data) with
---echo # a stored function which does not modify data and reads
---echo # the table through a subselect in one of its control
---echo # constructs.
---echo #
---echo # Since such statement is written to the binary log it should
---echo # be serialized with concurrent statements affecting data it
---echo # uses. Therefore it should take row locks on the data
---echo # it reads.
-let $statement= insert into t2 values (f3() + 5);
-let $wait_statement= $statement;
---source include/check_shared_row_lock.inc
-let $statement= insert into t2 values (f4() + 6);
-let $wait_statement= $statement;
---source include/check_shared_row_lock.inc
-
---echo #
---echo # 4.6 SELECT/SET which uses a stored function with
---echo # DML which reads a table via a subquery.
---echo #
---echo # Since call to such function is written to the binary log
---echo # it should be serialized with concurrent statements.
---echo # Hence reads should take row locks.
-let $statement= select f5();
-let $wait_statement= insert into t2 values ((select i from t1 where i = 1) + 5);
---source include/check_shared_row_lock.inc
-let $statement= set @a:= f5();
-let $wait_statement= insert into t2 values ((select i from t1 where i = 1) + 5);
---source include/check_shared_row_lock.inc
-
---echo #
---echo # 4.7 SELECT/SET which uses a stored function which
---echo # doesn't modify data and reads tables through
---echo # a view.
---echo #
---echo # Calls to such functions won't get into
---echo # the binary log and thus don't need row locks.
---echo #
---echo # However in practice innodb takes strong lock on tables
---echo # being selected from within SF, when SF is called from
---echo # non SELECT statements like 'set' statement below.
-let $statement= select f6();
-let $wait_statement= select i from v1 where i = 1 into k;
---source include/check_no_row_lock.inc
-let $statement= set @a:= f6();
-let $wait_statement= select i from v1 where i = 1 into k;
---source include/check_shared_row_lock.inc
-let $statement= select f7();
-let $wait_statement= select j from v2 where j = 1 into k;
---source include/check_no_row_lock.inc
-let $statement= set @a:= f7();
-let $wait_statement= select j from v2 where j = 1 into k;
---source include/check_shared_row_lock.inc
-
---echo #
---echo # 4.8 INSERT which uses stored function which
---echo # doesn't modify data and reads a table
---echo # through a view.
---echo #
---echo # Since such statement is written to the binary log and
---echo # should be serialized with concurrent statements affecting
---echo # the data it uses. Therefore it should take row locks on
---echo # the rows it reads.
-let $statement= insert into t3 values (f6() + 5);
-let $wait_statement= select i from v1 where i = 1 into k;
---source include/check_shared_row_lock.inc
-let $statement= insert into t3 values (f7() + 5);
-let $wait_statement= select j from v2 where j = 1 into k;
---source include/check_shared_row_lock.inc
-
-
---echo #
---echo # 4.9 SELECT which uses a stored function which
---echo # modifies data and reads tables through a view.
---echo #
---echo # Since a call to such function is written to the binary log
---echo # it should be serialized with concurrent statements.
---echo # Hence, reads should take row locks.
-let $statement= select f8();
-let $wait_statement= select i from v1 where i = 1 into k;
---source include/check_shared_row_lock.inc
-let $statement= select f9();
-let $wait_statement= update v2 set j=j+10 where j=1;
---source include/check_shared_row_lock.inc
-
---echo #
---echo # 4.10 SELECT which uses stored function which doesn't modify
---echo # data and reads a table indirectly, by calling another
---echo # function.
---echo #
---echo # Calls to such functions won't get into the binary
---echo # log and thus don't need to acquire row locks.
-let $statement= select f10();
-let $wait_statement= select i from t1 where i = 1 into j;
---source include/check_no_row_lock.inc
-
---echo #
---echo # 4.11 INSERT which uses a stored function which doesn't modify
---echo # data and reads a table indirectly, by calling another
---echo # function.
---echo #
---echo # Since such statement is written to the binary log, it should
---echo # be serialized with concurrent statements affecting the data it
---echo # uses. Therefore it should take row locks on data it reads.
-let $statement= insert into t2 values (f10() + 5);
-let $wait_statement= select i from t1 where i = 1 into j;
---source include/check_shared_row_lock.inc
-
---echo #
---echo # 4.12 SELECT which uses a stored function which modifies
---echo # data and reads a table indirectly, by calling another
---echo # function.
---echo #
---echo # Since a call to such function is written to the binary log
---echo # it should be serialized from concurrent statements.
---echo # Hence, reads should take row locks.
-let $statement= select f11();
-let $wait_statement= select i from t1 where i = 1 into j;
---source include/check_shared_row_lock.inc
-
---echo #
---echo # 4.13 SELECT that reads a table through a subquery passed
---echo # as a parameter to a stored function which modifies
---echo # data.
---echo #
---echo # Even though a call to this function is written to the
---echo # binary log, values of its parameters are written as literals.
---echo # So there is no need to acquire row locks on rows used in
---echo # the subquery.
-let $statement= select f12((select i+10 from t1 where i=1));
---source include/check_no_row_lock.inc
-
---echo #
---echo # 4.14 INSERT that reads a table via a subquery passed
---echo # as a parameter to a stored function which doesn't
---echo # modify data.
---echo #
---echo # Since this statement is written to the binary log it should
---echo # be serialized with concurrent statements affecting the data it
---echo # uses. Therefore it should take row locks on the data it reads.
-let $statement= insert into t2 values (f13((select i+10 from t1 where i=1)));
-let $wait_statement= $statement;
---source include/check_shared_row_lock.inc
-
-
---echo #
---echo # 5. Statements that read tables through stored procedures.
---echo #
-
---echo #
---echo # 5.1 CALL statement which reads a table via SELECT.
---echo #
---echo # Since neither this statement nor its components are
---echo # written to the binary log, there is no need to take
---echo # row locks on the data it reads.
-let $statement= call p2(@a);
---source include/check_no_row_lock.inc
-
---echo #
---echo # 5.2 Function that modifies data and uses CALL,
---echo # which reads a table through SELECT.
---echo #
---echo # Since a call to such function is written to the binary
---echo # log, it should be serialized with concurrent statements.
---echo # Hence, in this case reads should take row locks on data.
-let $statement= select f14();
-let $wait_statement= select i from t1 where i = 1 into p;
---source include/check_shared_row_lock.inc
-
---echo #
---echo # 5.3 SELECT that calls a function that doesn't modify data and
---echo # uses a CALL statement that reads a table via SELECT.
---echo #
---echo # Calls to such functions won't get into the binary
---echo # log and thus don't need to acquire row locks.
-let $statement= select f15();
-let $wait_statement= select i from t1 where i = 1 into p;
---source include/check_no_row_lock.inc
-
---echo #
---echo # 5.4 INSERT which calls function which doesn't modify data and
---echo # uses CALL statement which reads table through SELECT.
---echo #
---echo # Since such statement is written to the binary log it should
---echo # be serialized with concurrent statements affecting data it
---echo # uses. Therefore it should take row locks on data it reads.
-let $statement= insert into t2 values (f15()+5);
-let $wait_statement= select i from t1 where i = 1 into p;
---source include/check_shared_row_lock.inc
-
-
---echo #
---echo # 6. Statements that use triggers.
---echo #
-
---echo #
---echo # 6.1 Statement invoking a trigger that reads table via SELECT.
---echo #
---echo # Since this statement is written to the binary log it should
---echo # be serialized with concurrent statements affecting the data
---echo # it uses. Therefore, it should take row locks on the data
---echo # it reads.
-let $statement= insert into t4 values (2);
-let $wait_statement= select i from t1 where i=1 into k;
---source include/check_shared_row_lock.inc
-
---echo #
---echo # 6.2 Statement invoking a trigger that reads table through
---echo # a subquery in a control construct.
---echo #
---echo # The above is true for this statement as well.
-let $statement= update t4 set l= 2 where l = 1;
-let $wait_statement= $statement;
---source include/check_shared_row_lock.inc
-
---echo #
---echo # 6.3 Statement invoking a trigger that reads a table through
---echo # a view.
---echo #
---echo # And for this statement.
-let $statement= delete from t4 where l = 1;
-let $wait_statement= $statement;
---source include/check_shared_row_lock.inc
-
---echo #
---echo # 6.4 Statement invoking a trigger that reads a table through
---echo # a stored function.
---echo #
---echo # And for this statement.
-let $statement= insert into t5 values (2);
-let $wait_statement= select i from t1 where i = 1 into j;
---source include/check_shared_row_lock.inc
-
---echo #
---echo # 6.5 Statement invoking a trigger that reads a table through
---echo # stored procedure.
---echo #
---echo # And for this statement.
-let $statement= update t5 set l= 2 where l = 1;
-let $wait_statement= select i from t1 where i = 1 into p;
---source include/check_shared_row_lock.inc
-
---echo # Clean-up.
-drop function f1;
-drop function f2;
-drop function f3;
-drop function f4;
-drop function f5;
-drop function f6;
-drop function f7;
-drop function f8;
-drop function f9;
-drop function f10;
-drop function f11;
-drop function f12;
-drop function f13;
-drop function f14;
-drop function f15;
-drop view v1, v2;
-drop procedure p1;
-drop procedure p2;
-drop table t1, t2, t3, t4, t5;
-disconnect con1;
-
-
---echo #
---echo # Test for bug#51263 "Deadlock between transactional SELECT
---echo # and ALTER TABLE ... REBUILD PARTITION".
---echo #
-connect (con1,localhost,root,,test,,);
-connection default;
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-create table t1 (i int auto_increment not null primary key) engine=innodb;
-create table t2 (i int) engine=innodb;
-insert into t1 values (1), (2), (3), (4), (5);
-
-begin;
---echo # Acquire SR metadata lock on t1 and LOCK_S row-locks on its rows.
-insert into t2 select count(*) from t1;
-
-connection con1;
---echo # Sending:
---send alter table t1 add column j int
-
-connection default;
---echo # Wait until ALTER is blocked because it tries to upgrade SNW
---echo # metadata lock to X lock.
---echo # It should not be blocked during copying data to new version of
---echo # table as it acquires LOCK_S locks on rows of old version, which
---echo # are compatible with locks acquired by connection 'con1'.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "alter table t1 add column j int";
---source include/wait_condition.inc
-
---echo # The below statement will deadlock because it will try to acquire
---echo # SW lock on t1, which will conflict with ALTER's SNW lock. And
---echo # ALTER will be waiting for this connection to release its SR lock.
---echo # This deadlock should be detected by an MDL subsystem and this
---echo # statement should be aborted with an appropriate error.
---error ER_LOCK_DEADLOCK
-insert into t1 values (6);
---echo # Unblock ALTER TABLE.
-commit;
-
-connection con1;
---echo # Reaping ALTER TABLE.
---reap
-
-connection default;
-
---echo #
---echo # Now test for scenario in which bug was reported originally.
---echo #
-drop tables t1, t2;
-create table t1 (i int auto_increment not null primary key) engine=innodb
- partition by hash (i) partitions 4;
-create table t2 (i int) engine=innodb;
-insert into t1 values (1), (2), (3), (4), (5);
-
-begin;
---echo # Acquire SR metadata lock on t1.
-select * from t1;
-
-connection con1;
---echo # Sending:
---send alter table t1 rebuild partition p0
-
-connection default;
---echo # Wait until ALTER is blocked because of active SR lock.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "alter table t1 rebuild partition p0";
---source include/wait_condition.inc
-
---echo # The below statement should succeed as transaction
---echo # has SR metadata lock on t1 and only going to read
---echo # rows from it.
-insert into t2 select count(*) from t1;
---echo # Unblock ALTER TABLE.
-commit;
-
-connection con1;
---echo # Reaping ALTER TABLE.
---reap
-
-connection default;
-disconnect con1;
---echo # Clean-up.
-drop tables 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
diff --git a/mysql-test/t/innodb_mysql_sync.test b/mysql-test/t/innodb_mysql_sync.test
deleted file mode 100644
index 66935f811d7..00000000000
--- a/mysql-test/t/innodb_mysql_sync.test
+++ /dev/null
@@ -1,750 +0,0 @@
-#
-# Test file for InnoDB tests that require the debug sync facility
-#
---source include/have_innodb.inc
---source include/have_partition.inc
---source include/have_debug.inc
---source include/have_debug_sync.inc
-# Save the initial number of concurrent sessions.
---source include/count_sessions.inc
-
-
---echo #
---echo # Bug 42074 concurrent optimize table and
---echo # alter table = Assertion failed: thd->is_error()
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
---echo # Create InnoDB table
-CREATE TABLE t1 (id INT) engine=innodb;
-connect (con2, localhost, root);
-
---echo # Start optimizing table
-connection default;
-SET DEBUG_SYNC='ha_admin_try_alter SIGNAL optimize_started WAIT_FOR table_altered';
---send OPTIMIZE TABLE t1
-
---echo # Change table to engine=memory
-connection con2;
-SET DEBUG_SYNC='now WAIT_FOR optimize_started';
-ALTER TABLE t1 engine=memory;
-SET DEBUG_SYNC='now SIGNAL table_altered';
-
---echo # Complete optimization
-connection default;
---reap
-
-disconnect con2;
-DROP TABLE t1;
-SET DEBUG_SYNC='RESET';
-
-
---echo #
---echo # Bug#47459 Assertion in Diagnostics_area::set_eof_status on
---echo # OPTIMIZE TABLE
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-connect (con1, localhost, root);
-connection default;
-
-CREATE TABLE t1(a INT) ENGINE= InnoDB;
-
-connection con1;
-SET DEBUG_SYNC= "ha_admin_open_ltable SIGNAL opening WAIT_FOR dropped";
---echo # Sending:
---send OPTIMIZE TABLE t1
-
-connection default;
-SET DEBUG_SYNC= "now WAIT_FOR opening";
-DROP TABLE t1;
-SET DEBUG_SYNC= "now SIGNAL dropped";
-
-connection con1;
---echo # Reaping: OPTIMIZE TABLE t1
---reap
-
-connection default;
-disconnect con1;
-SET DEBUG_SYNC= "RESET";
-
-
---echo #
---echo # Bug#53757 assert in mysql_truncate_by_delete
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-CREATE TABLE t1(a INT) Engine=InnoDB;
-CREATE TABLE t2(id INT);
-INSERT INTO t1 VALUES (1), (2);
-
-connect (con1, localhost, root);
-INSERT INTO t2 VALUES(connection_id());
-SET DEBUG_SYNC= "open_and_process_table SIGNAL opening WAIT_FOR killed";
---echo # Sending: (not reaped since connection is killed later)
---send TRUNCATE t1
-
-connection default;
-SET DEBUG_SYNC= "now WAIT_FOR opening";
-SELECT ((@id := id) - id) FROM t2;
-KILL @id;
-SET DEBUG_SYNC= "now SIGNAL killed";
-DROP TABLE t1, t2;
-disconnect con1;
---source include/wait_until_count_sessions.inc
-SET DEBUG_SYNC= "RESET";
-
-
---echo #
---echo # Bug#58933 Assertion `thd- >is_error()' fails on shutdown with ongoing
---echo # OPTIMIZE TABLE
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (a INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1), (2);
-
-connect (con1,localhost,root);
-let $ID= `SELECT connection_id()`;
-SET DEBUG_SYNC= 'ha_admin_open_ltable SIGNAL waiting WAIT_FOR killed';
---echo # Sending:
---send OPTIMIZE TABLE t1
-
-connection default;
-SET DEBUG_SYNC= 'now WAIT_FOR waiting';
---replace_result $ID ID
-eval KILL QUERY $ID;
-SET DEBUG_SYNC= 'now SIGNAL killed';
-
-connection con1;
---echo # Reaping: OPTIMIZE TABLE t1
---reap
-
-connection default;
-DROP TABLE t1;
-SET DEBUG_SYNC= 'RESET';
-disconnect con1;
-
-
---echo #
---echo # Bug#42230 during add index, cannot do queries on storage engines
---echo # that implement add_index
---echo #
-
---disable_warnings
-DROP DATABASE IF EXISTS db1;
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-connect(con1,localhost,root);
-connect(con2,localhost,root);
-
---echo # Test 1: Secondary index, should not block reads (original test case).
-
-connection default;
-CREATE DATABASE db1;
-CREATE TABLE db1.t1(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, value INT) engine=innodb;
-INSERT INTO db1.t1(value) VALUES (1), (2);
-SET DEBUG_SYNC= "alter_table_inplace_after_lock_downgrade SIGNAL manage WAIT_FOR query";
---echo # Sending:
---send ALTER TABLE db1.t1 ADD INDEX(value)
-
-connection con1;
-SET DEBUG_SYNC= "now WAIT_FOR manage";
-# Neither of these two statements should be blocked
-USE db1;
-SELECT * FROM t1;
-SET DEBUG_SYNC= "now SIGNAL query";
-
-connection default;
---echo # Reaping: ALTER TABLE db1.t1 ADD INDEX(value)
---reap
-DROP DATABASE db1;
-
---echo # Test 2: Primary index (implicit), should block writes.
-
-CREATE TABLE t1(a INT NOT NULL, b INT NOT NULL) engine=innodb;
-SET DEBUG_SYNC= "alter_table_inplace_after_lock_downgrade SIGNAL manage WAIT_FOR query";
---echo # Sending:
---send ALTER TABLE t1 ADD UNIQUE INDEX(a), LOCK=SHARED
-
-connection con1;
-SET DEBUG_SYNC= "now WAIT_FOR manage";
-USE test;
-SELECT * FROM t1;
---echo # Sending:
---send UPDATE t1 SET a=NULL
-
-connection con2;
---echo # Waiting for SELECT to be blocked by the metadata lock on t1
-let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist
- WHERE state= 'Waiting for table metadata lock'
- AND info='UPDATE t1 SET a=NULL';
---source include/wait_condition.inc
-SET DEBUG_SYNC= "now SIGNAL query";
-
-connection default;
---echo # Reaping: ALTER TABLE t1 ADD UNIQUE INDEX(a)
---reap
-
-connection con1;
---echo # Reaping: UPDATE t1 SET a=NULL
---reap
-
---echo # Test 3: Primary index (explicit), should block writes.
-
-connection default;
-ALTER TABLE t1 DROP INDEX a;
-SET DEBUG_SYNC= "alter_table_inplace_after_lock_downgrade SIGNAL manage WAIT_FOR query";
---echo # Sending:
---send ALTER TABLE t1 ADD PRIMARY KEY (a), LOCK=SHARED
-
-connection con1;
-SET DEBUG_SYNC= "now WAIT_FOR manage";
-SELECT * FROM t1;
---echo # Sending:
---send UPDATE t1 SET a=NULL
-
-connection con2;
---echo # Waiting for SELECT to be blocked by the metadata lock on t1
-let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist
- WHERE state= 'Waiting for table metadata lock'
- AND info='UPDATE t1 SET a=NULL';
---source include/wait_condition.inc
-SET DEBUG_SYNC= "now SIGNAL query";
-
-connection default;
---echo # Reaping: ALTER TABLE t1 ADD PRIMARY KEY (a)
---reap
-
-connection con1;
---echo # Reaping: UPDATE t1 SET a=NULL
---reap
-
---echo # Test 4: Secondary unique index, should not block reads.
-
-connection default;
-SET DEBUG_SYNC= "alter_table_inplace_after_lock_downgrade SIGNAL manage WAIT_FOR query";
---echo # Sending:
---send ALTER TABLE t1 ADD UNIQUE (b)
-
-connection con1;
-SET DEBUG_SYNC= "now WAIT_FOR manage";
-SELECT * FROM t1;
-SET DEBUG_SYNC= "now SIGNAL query";
-
-connection default;
---echo # Reaping: ALTER TABLE t1 ADD UNIQUE (b)
---reap
-
-disconnect con1;
-disconnect con2;
-SET DEBUG_SYNC= "RESET";
-DROP TABLE t1;
-
-
---echo #
---echo # Bug#11853126 RE-ENABLE CONCURRENT READS WHILE CREATING SECONDARY INDEX
---echo # IN INNODB
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1(a INT NOT NULL, b INT NOT NULL) engine=innodb;
-INSERT INTO t1 VALUES (1, 12345), (2, 23456);
-
---connect (con1,localhost,root)
-SET SESSION debug_dbug= "+d,alter_table_rollback_new_index";
---error ER_UNKNOWN_ERROR
-ALTER TABLE t1 ADD PRIMARY KEY(a);
-SELECT * FROM t1;
-
---connection default
-SELECT * FROM t1;
-DROP TABLE t1;
-disconnect con1;
-
-
---echo #
---echo # Bug#13417754 ASSERT IN ROW_DROP_DATABASE_FOR_MYSQL DURING DROP SCHEMA
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP DATABASE IF EXISTS db1;
---enable_warnings
-
-CREATE TABLE t1(a int) engine=InnoDB;
-CREATE DATABASE db1;
-
-connect(con1, localhost, root);
-connect(con2, localhost, root);
-
-connection con1;
-SET DEBUG_SYNC= 'after_innobase_rename_table SIGNAL locked WAIT_FOR continue';
---echo # Sending:
---send ALTER TABLE t1 RENAME db1.t1
-
-connection con2;
-SET DEBUG_SYNC= 'now WAIT_FOR locked';
---echo # DROP DATABASE db1 should now be blocked by ALTER TABLE
---echo # Sending:
---send DROP DATABASE db1
-
-connection default;
---echo # Check that DROP DATABASE is blocked by IX lock on db1
-let $wait_condition=
- SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for schema metadata lock" and
- info = "DROP DATABASE db1";
---source include/wait_condition.inc
---echo # Resume ALTER TABLE
-SET DEBUG_SYNC= 'now SIGNAL continue';
-
-connection con1;
---echo # Reaping: ALTER TABLE t1 RENAME db1.t1;
---reap
-
-connection con2;
---echo # Reaping: DROP DATABASE db1
---reap
-
-connection default;
-SET DEBUG_SYNC= 'RESET';
-disconnect con1;
-disconnect con2;
-
-
---echo #
---echo # WL#5534 Online ALTER, Phase 1
---echo #
-
---echo # Multi thread tests.
---echo # See alter_table.test for single thread tests.
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1(a INT PRIMARY KEY, b INT) engine=InnoDB;
-INSERT INTO t1 VALUES (1,1), (2,2);
-SET DEBUG_SYNC= 'RESET';
-connect (con1, localhost, root);
-SET SESSION lock_wait_timeout= 1;
-
---echo #
---echo # 1: In-place + writes blocked.
---echo #
-
---connection default
-SET DEBUG_SYNC= 'alter_opened_table SIGNAL opened WAIT_FOR continue1';
-SET DEBUG_SYNC= 'alter_table_inplace_after_lock_upgrade SIGNAL upgraded WAIT_FOR continue2';
-SET DEBUG_SYNC= 'alter_table_inplace_before_commit SIGNAL beforecommit WAIT_FOR continue3';
-SET DEBUG_SYNC= 'alter_table_before_main_binlog SIGNAL binlog WAIT_FOR continue4';
---echo # Sending:
---send ALTER TABLE t1 ADD INDEX i1(b), ALGORITHM= INPLACE, LOCK= SHARED
-
---connection con1
-SET DEBUG_SYNC= 'now WAIT_FOR opened';
---echo # At this point, neither reads nor writes should be blocked.
-SELECT * FROM t1;
-INSERT INTO t1 VALUES (3,3);
-
-SET DEBUG_SYNC= 'now SIGNAL continue1';
-SET DEBUG_SYNC= 'now WAIT_FOR upgraded';
---echo # Now both reads and writes should be blocked
---error ER_LOCK_WAIT_TIMEOUT
-SELECT * FROM t1;
---error ER_LOCK_WAIT_TIMEOUT
-INSERT INTO t1 VALUES (4,4);
-
-SET DEBUG_SYNC= 'now SIGNAL continue2';
-SET DEBUG_SYNC= 'now WAIT_FOR beforecommit';
---echo # Still both reads and writes should be blocked.
---error ER_LOCK_WAIT_TIMEOUT
-SELECT * FROM t1;
---error ER_LOCK_WAIT_TIMEOUT
-INSERT INTO t1 VALUES (5,5);
-
-SET DEBUG_SYNC= 'now SIGNAL continue3';
-SET DEBUG_SYNC= 'now WAIT_FOR binlog';
---echo # Same here.
---error ER_LOCK_WAIT_TIMEOUT
-SELECT * FROM t1;
---error ER_LOCK_WAIT_TIMEOUT
-INSERT INTO t1 VALUES (6,6);
-
-SET DEBUG_SYNC= 'now SIGNAL continue4';
---connection default
---echo # Reaping ALTER TABLE ...
---reap
-SET DEBUG_SYNC= 'RESET';
-DELETE FROM t1 WHERE a= 3;
-
---echo #
---echo # 2: Copy + writes blocked.
---echo #
-
-SET DEBUG_SYNC= 'alter_opened_table SIGNAL opened WAIT_FOR continue1';
-SET DEBUG_SYNC= 'alter_table_copy_after_lock_upgrade SIGNAL upgraded WAIT_FOR continue2';
-SET DEBUG_SYNC= 'alter_table_before_main_binlog SIGNAL binlog WAIT_FOR continue3';
---echo # Sending:
---send ALTER TABLE t1 ADD INDEX i2(b), ALGORITHM= COPY, LOCK= SHARED
-
---connection con1
-SET DEBUG_SYNC= 'now WAIT_FOR opened';
---echo # At this point, neither reads nor writes should be blocked.
-SELECT * FROM t1;
-INSERT INTO t1 VALUES (3,3);
-
-SET DEBUG_SYNC= 'now SIGNAL continue1';
-SET DEBUG_SYNC= 'now WAIT_FOR upgraded';
---echo # Now writes should be blocked, reads still allowed.
-SELECT * FROM t1;
---error ER_LOCK_WAIT_TIMEOUT
-INSERT INTO t1 VALUES (4,4);
-
-SET DEBUG_SYNC= 'now SIGNAL continue2';
-SET DEBUG_SYNC= 'now WAIT_FOR binlog';
---echo # Now both reads and writes should be blocked.
---error ER_LOCK_WAIT_TIMEOUT
-SELECT * FROM t1 limit 1;
---error ER_LOCK_WAIT_TIMEOUT
-INSERT INTO t1 VALUES (5,5);
-
-SET DEBUG_SYNC= 'now SIGNAL continue3';
---connection default
---echo # Reaping ALTER TABLE ...
---reap
-SET DEBUG_SYNC= 'RESET';
-DELETE FROM t1 WHERE a= 3;
-
---echo #
---echo # 3: In-place + writes allowed.
---echo #
-
---echo # TODO: Enable this test once WL#5526 is pushed
---disable_parsing
-
---connection default
-SET DEBUG_SYNC= 'alter_opened_table SIGNAL opened WAIT_FOR continue1';
-SET DEBUG_SYNC= 'alter_table_inplace_after_lock_upgrade SIGNAL upgraded WAIT_FOR continue2';
-SET DEBUG_SYNC= 'alter_table_inplace_after_lock_downgrade SIGNAL downgraded WAIT_FOR continue3';
-SET DEBUG_SYNC= 'alter_table_inplace_before_commit SIGNAL beforecommit WAIT_FOR continue4';
-SET DEBUG_SYNC= 'alter_table_before_main_binlog SIGNAL binlog WAIT_FOR continue5';
---echo # Sending:
---send ALTER TABLE t1 ADD INDEX i3(b), ALGORITHM= INPLACE, LOCK= NONE
-
---connection con1
-SET DEBUG_SYNC= 'now WAIT_FOR opened';
---echo # At this point, neither reads nor writes should be blocked.
-SELECT * FROM t1;
-INSERT INTO t1 VALUES (3,3);
-
-SET DEBUG_SYNC= 'now SIGNAL continue1';
-SET DEBUG_SYNC= 'now WAIT_FOR upgraded';
---echo # Now writes should be blocked, reads still allowed.
-SELECT * FROM t1;
---error ER_LOCK_WAIT_TIMEOUT
-INSERT INTO t1 VALUES (4,4);
-
-SET DEBUG_SYNC= 'now SIGNAL continue2';
-SET DEBUG_SYNC= 'now WAIT_FOR downgraded';
---echo # Now writes should be allowed again.
-SELECT * FROM t1;
-INSERT INTO t1 VALUES (5,5);
-
-SET DEBUG_SYNC= 'now SIGNAL continue3';
-SET DEBUG_SYNC= 'now WAIT_FOR beforecommit';
---echo # Now both reads and writes should be blocked.
---error ER_LOCK_WAIT_TIMEOUT
-SELECT * FROM t1;
---error ER_LOCK_WAIT_TIMEOUT
-INSERT INTO t1 VALUES (6,6);
-
-SET DEBUG_SYNC= 'now SIGNAL continue4';
-SET DEBUG_SYNC= 'now WAIT_FOR binlog';
---echo # Same here.
---error ER_LOCK_WAIT_TIMEOUT
-SELECT * FROM t1;
---error ER_LOCK_WAIT_TIMEOUT
-INSERT INTO t1 VALUES (7,7);
-
-SET DEBUG_SYNC= 'now SIGNAL continue5';
---connection default
---echo # Reaping ALTER TABLE ...
---reap
-SET DEBUG_SYNC= 'RESET';
-DELETE FROM t1 WHERE a= 3 OR a= 4;
-
---echo # TODO: Enable this test once WL#5526 is pushed
---enable_parsing
-
---echo #
---echo # 4: In-place + reads and writes blocked.
---echo #
-
---connection default
-SET DEBUG_SYNC= 'alter_opened_table SIGNAL opened WAIT_FOR continue1';
-SET DEBUG_SYNC= 'alter_table_inplace_after_lock_upgrade SIGNAL upgraded WAIT_FOR continue2';
-SET DEBUG_SYNC= 'alter_table_inplace_before_commit SIGNAL beforecommit WAIT_FOR continue3';
-SET DEBUG_SYNC= 'alter_table_before_main_binlog SIGNAL binlog WAIT_FOR continue4';
---echo # Sending:
---send ALTER TABLE t1 ADD INDEX i4(b), ALGORITHM= INPLACE, LOCK= EXCLUSIVE
-
---connection con1
-SET DEBUG_SYNC= 'now WAIT_FOR opened';
---echo # At this point, neither reads nor writes should be blocked.
-SELECT * FROM t1;
-INSERT INTO t1 VALUES (3,3);
-
-SET DEBUG_SYNC= 'now SIGNAL continue1';
-SET DEBUG_SYNC= 'now WAIT_FOR upgraded';
---echo # Now both reads and writes should be blocked.
---error ER_LOCK_WAIT_TIMEOUT
-SELECT * FROM t1;
---error ER_LOCK_WAIT_TIMEOUT
-INSERT INTO t1 VALUES (4,4);
-
-SET DEBUG_SYNC= 'now SIGNAL continue2';
-SET DEBUG_SYNC= 'now WAIT_FOR beforecommit';
---echo # Same here.
---error ER_LOCK_WAIT_TIMEOUT
-SELECT * FROM t1;
---error ER_LOCK_WAIT_TIMEOUT
-INSERT INTO t1 VALUES (5,5);
-
-SET DEBUG_SYNC= 'now SIGNAL continue3';
-SET DEBUG_SYNC= 'now WAIT_FOR binlog';
---echo # Same here.
---error ER_LOCK_WAIT_TIMEOUT
-SELECT * FROM t1;
---error ER_LOCK_WAIT_TIMEOUT
-INSERT INTO t1 VALUES (6,6);
-
-SET DEBUG_SYNC= 'now SIGNAL continue4';
---connection default
---echo # Reaping ALTER TABLE ...
---reap
-SET DEBUG_SYNC= 'RESET';
-
---connection default
---disconnect con1
-DROP TABLE t1;
-SET DEBUG_SYNC= 'RESET';
-
-
---echo #
---echo #BUG#13975225:ONLINE OPTIMIZE TABLE FOR INNODB TABLES
---echo #
-
-SET DEBUG_SYNC= 'alter_table_inplace_after_lock_downgrade SIGNAL downgraded WAIT_FOR continue';
-connect(con1,localhost,root,,);
-
---echo #Setting up INNODB table.
-CREATE TABLE t1(fld1 INT, fld2 INT, fld3 INT) ENGINE= INNODB;
-INSERT INTO t1 VALUES (155, 45, 55);
-
---echo #Concurrent INSERT, UPDATE, SELECT and DELETE is supported
---echo #during OPTIMIZE TABLE operation for INNODB tables.
---connection default
---echo #OPTIMIZE TABLE operation.
---send OPTIMIZE TABLE t1
-
---connection con1
-SET DEBUG_SYNC= 'now WAIT_FOR downgraded';
---echo # With the patch, concurrent DML operation succeeds.
-INSERT INTO t1 VALUES (10, 11, 12);
-UPDATE t1 SET fld1= 20 WHERE fld1= 155;
-DELETE FROM t1 WHERE fld1= 20;
-SELECT * from t1;
-SET DEBUG_SYNC= 'now SIGNAL continue';
-
---connection default
---reap
-DROP TABLE t1;
-SET DEBUG_SYNC= 'RESET';
-
---echo #Concurrent INSERT, UPDATE, SELECT and DELETE is supported
---echo #during OPTIMIZE TABLE operation for Partitioned table.
-
-SET DEBUG_SYNC= 'alter_table_inplace_after_lock_downgrade SIGNAL downgraded WAIT_FOR continue';
---echo #Setup PARTITIONED table.
-CREATE TABLE t1(fld1 INT) ENGINE= INNODB PARTITION BY HASH(fld1) PARTITIONS 4;
-INSERT INTO t1 VALUES(10);
-
---echo #OPTIMIZE TABLE operation.
---send OPTIMIZE TABLE t1
-
---connection con1
-SET DEBUG_SYNC= 'now WAIT_FOR downgraded';
---echo # With the patch, concurrent DML operation succeeds.
-INSERT INTO t1 VALUES (30);
-UPDATE t1 SET fld1= 20 WHERE fld1= 10;
-DELETE FROM t1 WHERE fld1= 20;
-SELECT * from t1;
-SET DEBUG_SYNC= 'now SIGNAL continue';
-
---connection default
---reap
-DROP TABLE t1;
-SET DEBUG_SYNC= 'RESET';
-
---echo #ALTER TABLE FORCE and ALTER TABLE ENGINE uses online rebuild
---echo #of the table.
-
-CREATE TABLE t1(fld1 INT, fld2 INT) ENGINE=INNODB;
-INSERT INTO t1 VALUES(10, 20);
-
---enable_info
-ALTER TABLE t1 FORCE;
-ALTER TABLE t1 ENGINE=INNODB;
-
---echo #ALTER TABLE FORCE, ALTER TABLE ENGINE and OPTIMIZE TABLE uses
---echo #table copy when the old_alter_table enabled.
-SET SESSION old_alter_table= TRUE;
-ALTER TABLE t1 FORCE;
-ALTER TABLE t1 ENGINE= INNODB;
-
-SET DEBUG_SYNC= 'alter_table_copy_after_lock_upgrade SIGNAL upgraded';
---echo #OPTIMIZE TABLE operation using table copy.
---send OPTIMIZE TABLE t1
-
---connection con1
-SET DEBUG_SYNC= 'now WAIT_FOR upgraded';
-INSERT INTO t1 VALUES(10, 20);
-
---connection default
---reap
-SET DEBUG_SYNC= 'RESET';
-SET SESSION old_alter_table= FALSE;
-
---echo #ALTER TABLE FORCE and ALTER TABLE ENGINE uses table copy
---echo #when ALGORITHM COPY is used.
-ALTER TABLE t1 FORCE, ALGORITHM= COPY;
-ALTER TABLE t1 ENGINE= INNODB, ALGORITHM= COPY;
---disable_info
-
-#cleanup
-DROP TABLE t1;
-
---echo #OPTIMIZE TABLE on a table with FULLTEXT index uses
---echo #ALTER TABLE FORCE using COPY algorithm here. This
---echo #test case ensures the COPY table debug sync point is hit.
-
-SET DEBUG_SYNC= 'alter_table_copy_after_lock_upgrade SIGNAL upgraded';
-
---echo #Setup a table with FULLTEXT index.
---connection default
-CREATE TABLE t1(fld1 CHAR(10), FULLTEXT(fld1)) ENGINE= INNODB;
-INSERT INTO t1 VALUES("String1");
-
---echo #OPTIMIZE TABLE operation.
---send OPTIMIZE TABLE t1
-
---connection con1
-SET DEBUG_SYNC= 'now WAIT_FOR upgraded';
-INSERT INTO t1 VALUES("String2");
-
---connection default
---reap
-SET DEBUG_SYNC= 'RESET';
-DROP TABLE t1;
-
---echo #Test which demonstrates that ALTER TABLE, OPTIMIZE PARTITION
---echo #takes OPTIMIZE TABLE code path, hence does an online rebuild
---echo #of the table with the patch.
-
---connection default
-SET DEBUG_SYNC= 'alter_table_inplace_after_lock_downgrade SIGNAL downgraded WAIT_FOR continue';
---echo #Setup PARTITIONED table.
-CREATE TABLE t1(fld1 INT) ENGINE= INNODB PARTITION BY HASH(fld1) PARTITIONS 4;
-INSERT INTO t1 VALUES(10);
-
---echo #OPTIMIZE ALL PARTITIONS operation.
---send ALTER TABLE t1 OPTIMIZE PARTITION ALL
-
---connection con1
-SET DEBUG_SYNC= 'now WAIT_FOR downgraded';
---echo # With the patch, concurrent DML operation succeeds.
-INSERT INTO t1 VALUES (30);
-UPDATE t1 SET fld1= 20 WHERE fld1= 10;
-DELETE FROM t1 WHERE fld1= 20;
-SELECT * from t1;
-SET DEBUG_SYNC= 'now SIGNAL continue';
-
---connection default
---reap
-SET DEBUG_SYNC= 'RESET';
-
---echo #OPTIMIZE PER PARTITION operation.
-SET DEBUG_SYNC= 'alter_table_inplace_after_lock_downgrade SIGNAL downgraded WAIT_FOR continue';
---send ALTER TABLE t1 OPTIMIZE PARTITION p0
-
---connection con1
-SET DEBUG_SYNC= 'now WAIT_FOR downgraded';
---echo # With the patch, concurrent DML operation succeeds.
-INSERT INTO t1 VALUES (30);
-UPDATE t1 SET fld1= 20 WHERE fld1= 10;
-DELETE FROM t1 WHERE fld1= 20;
-SELECT * from t1;
-SET DEBUG_SYNC= 'now SIGNAL continue';
-
---connection default
---reap
-SET DEBUG_SYNC= 'RESET';
-
---echo # Test case for Bug#11938817 (ALTER BEHAVIOR DIFFERENT THEN DOCUMENTED).
---enable_info
---echo # This should not do anything
-ALTER TABLE t1;
---disable_info
-
-#Note that sync point is activated in the online rebuild code path.
-SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL rebuild';
-
---echo # Check that we rebuild the table
---send ALTER TABLE t1 engine=innodb
-
---connection con1
-SET DEBUG_SYNC= 'now WAIT_FOR rebuild';
-
---connection default
---reap
-
-SET DEBUG_SYNC= 'RESET';
-
-SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL rebuild';
-
---echo # Check that we rebuild the table
---send ALTER TABLE t1 FORCE
-
---connection con1
-SET DEBUG_SYNC= 'now WAIT_FOR rebuild';
-
---connection default
---reap
-
---disconnect con1
-
-SET DEBUG_SYNC= 'RESET';
-DROP TABLE t1;
-
-
-# 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
diff --git a/mysql-test/t/innodb_utf8.test b/mysql-test/t/innodb_utf8.test
deleted file mode 100644
index e52019588b0..00000000000
--- a/mysql-test/t/innodb_utf8.test
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Tests for innodb that requires not default character sets
-#
-
---source include/have_innodb.inc
-let collation=utf8_unicode_ci;
---source include/have_collation.inc
-
-# Setup
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-#
-# Bug #26835: table corruption after delete+insert
-#
-
-CREATE TABLE t1 (a VARCHAR(5) COLLATE utf8_unicode_ci PRIMARY KEY)
-ENGINE=InnoDB;
-INSERT INTO t1 VALUES (0xEFBCA4EFBCA4EFBCA4);
-DELETE FROM t1;
-INSERT INTO t1 VALUES ('DDD');
-SELECT * FROM t1;
-DROP TABLE t1;
diff --git a/mysql-test/t/insert.test b/mysql-test/t/insert.test
deleted file mode 100644
index d57e9051e3f..00000000000
--- a/mysql-test/t/insert.test
+++ /dev/null
@@ -1,614 +0,0 @@
-#
-# Test of refering to old values
-#
-
---disable_warnings
-drop table if exists t1,t2,t3;
---enable_warnings
-
-create table t1 (a int not null);
-insert into t1 values (1);
-insert into t1 values (a+2);
-insert into t1 values (a+3),(a+4);
-insert into t1 values (5),(a+6);
-select * from t1;
-drop table t1;
-
-#
-# Test of duplicate key values with packed keys
-#
-
-create table t1 (id int not null auto_increment primary key, username varchar(32) not null, unique (username));
-insert into t1 values (0,"mysql");
-insert into t1 values (0,"mysql ab");
-insert into t1 values (0,"mysql a");
-insert into t1 values (0,"r1manic");
-insert into t1 values (0,"r1man");
-drop table t1;
-
-#
-# Test insert syntax
-#
-
-create table t1 (a int not null auto_increment, primary key (a), t timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c char(10) default "hello", i int);
-insert into t1 values (default,default,default,default), (default,default,default,default), (4,0,"a",5),(default,default,default,default);
-select a,t>0,c,i from t1;
-truncate table t1;
-insert into t1 set a=default,t=default,c=default;
-insert into t1 set a=default,t=default,c=default,i=default;
-insert into t1 set a=4,t=0,c="a",i=5;
-insert into t1 set a=5,t=0,c="a",i=null;
-insert into t1 set a=default,t=default,c=default,i=default;
-select a,t>0,c,i from t1;
-drop table t1;
-
-#
-# Test problem with bulk insert and auto_increment on second part keys
-#
-
-create table t1 (sid char(20), id int(2) NOT NULL auto_increment, key(sid, id));
-insert into t1 values ('skr',NULL),('skr',NULL),('test',NULL);
-select * from t1;
-insert into t1 values ('rts',NULL),('rts',NULL),('test',NULL);
-select * from t1;
-drop table t1;
-
-#
-#Test of behaviour with INSERT VALUES (NULL)
-#
-
-create table t1 (id int NOT NULL DEFAULT 8);
--- error 1048
-insert into t1 values(NULL);
-insert into t1 values (1), (NULL), (2);
-select * from t1;
-drop table t1;
-
-#
-# Test if insert ... select distinct
-#
-
-create table t1 (email varchar(50));
-insert into t1 values ('sasha@mysql.com'),('monty@mysql.com'),('foo@hotmail.com'),('foo@aol.com'),('bar@aol.com');
-create table t2(id int not null auto_increment primary key, t2 varchar(50), unique(t2));
-insert delayed into t2 (t2) select distinct substring(email, locate('@', email)+1) from t1;
-select * from t2;
-drop table t1,t2;
-
-#
-# Test of mysqld crash with fully qualified column names
-#
-
---disable_warnings
-drop database if exists mysqltest;
---enable_warnings
-create database mysqltest;
-use mysqltest;
-create table t1 (c int);
-insert into mysqltest.t1 set mysqltest.t1.c = '1';
-drop database mysqltest;
-use test;
-
-#
-# Test of wrong values for float data (bug #2082)
-#
-
-# PS gives sligthly different numbers for max-float/max-double
---disable_ps_protocol
-create table t1(number int auto_increment primary key, original_value varchar(50), f_double double, f_float float, f_double_7_2 double(7,2), f_float_4_3 float (4,3), f_double_u double unsigned, f_float_u float unsigned, f_double_15_1_u double(15,1) unsigned, f_float_3_1_u float (3,1) unsigned);
-
-set @value= "aa";
-insert ignore into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
---query_vertical select * from t1 where number =last_insert_id()
-
-set @value= "1aa";
-insert ignore into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
---query_vertical select * from t1 where number =last_insert_id()
-
-set @value= "aa1";
-insert ignore into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
---query_vertical select * from t1 where number =last_insert_id()
-
-set @value= "1e+1111111111a";
-insert ignore into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
---query_vertical select * from t1 where number =last_insert_id()
-
-set @value= "-1e+1111111111a";
-insert ignore into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
---query_vertical select * from t1 where number =last_insert_id()
-
---error 1367
-set @value= 1e+1111111111;
---error 1367
-set @value= -1e+1111111111;
-
-
-set @value= 1e+111;
-insert ignore into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
---query_vertical select * from t1 where number =last_insert_id()
-
-set @value= -1e+111;
-insert ignore into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
---query_vertical select * from t1 where number =last_insert_id()
-
-set @value= 1;
-insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
---query_vertical select * from t1 where number =last_insert_id()
-
-set @value= -1;
-insert ignore into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
---query_vertical select * from t1 where number =last_insert_id()
-
-drop table t1;
---enable_ps_protocol
-
-# End of 4.1 tests
-
-#
-# Test automatic result buffering with INSERT INTO t1 ... SELECT ... FROM t1
-#
-
-create table t1(id1 int not null auto_increment primary key, t char(12));
-create table t2(id2 int not null, t char(12));
-create table t3(id3 int not null, t char(12), index(id3));
---disable_query_log
-begin;
-let $1 = 100;
-while ($1)
- {
- let $2 = 5;
- eval insert into t1(t) values ('$1');
- while ($2)
- {
- eval insert into t2(id2,t) values ($1,'$2');
- let $3 = 10;
- while ($3)
- {
- eval insert into t3(id3,t) values ($1,'$2');
- dec $3;
- }
- dec $2;
- }
- dec $1;
- }
-commit;
---enable_query_log
-
-select count(*) from t2;
-insert into t2 select t1.* from t1, t2 t, t3 where t1.id1 = t.id2 and t.id2 = t3.id3;
-select count(*) from t2;
-drop table t1,t2,t3;
-
-#
-# Test different cases of duplicate fields
-#
-
-create table t1 (a int, b int);
-insert into t1 (a,b) values (a,b);
-insert into t1 SET a=1, b=a+1;
-insert into t1 (a,b) select 1,2;
-INSERT INTO t1 ( a ) SELECT 0 ON DUPLICATE KEY UPDATE a = a + VALUES (a);
-prepare stmt1 from ' replace into t1 (a,a) select 100, ''hundred'' ';
---error 1110
-execute stmt1;
---error 1110
-insert into t1 (a,b,b) values (1,1,1);
---error 1136
-insert into t1 (a,a) values (1,1,1);
---error 1110
-insert into t1 (a,a) values (1,1);
---error 1110
-insert into t1 SET a=1,b=2,a=1;
---error 1110
-insert into t1 (b,b) select 1,2;
---error 1110
-INSERT INTO t1 (b,b) SELECT 0,0 ON DUPLICATE KEY UPDATE a = a + VALUES (a);
-drop table t1;
-
-#
-# Test for values returned by ROW_COUNT() function
-# (and thus for values returned by mysql_affected_rows())
-# for various forms of INSERT
-#
-create table t1 (id int primary key, data int);
-insert into t1 values (1, 1), (2, 2), (3, 3);
-select row_count();
-insert ignore into t1 values (1, 1);
-select row_count();
-# Reports that 2 rows are affected (1 deleted + 1 inserted)
-replace into t1 values (1, 11);
-select row_count();
-replace into t1 values (4, 4);
-select row_count();
-# Reports that 2 rows are affected. This conforms to documentation.
-# (Useful for differentiating inserts from updates).
-insert into t1 values (2, 2) on duplicate key update data= data + 10;
-select row_count();
-insert into t1 values (5, 5) on duplicate key update data= data + 10;
-select row_count();
-drop table t1;
-
-#
-# Bug#25123: ON DUPLICATE KEY clause allows fields not from the insert table
-#
-create table t1 (f1 int unique, f2 int);
-create table t2 (f3 int, f4 int);
-create view v1 as select * from t1, t2 where f1= f3;
-insert into t1 values (1,11), (2,22);
-insert into t2 values (1,12), (2,24);
---error 1393
-insert into v1 (f1) values (3) on duplicate key update f3= f3 + 10;
---error 1393
-insert into v1 (f1) values (3) on duplicate key update f1= f3 + 10;
-select * from t1;
---error 1393
-insert into v1 (f1) values (3) on duplicate key update f1= f3 + 10;
-select * from t1;
-drop view v1;
-drop table t1,t2;
-
-# Test of INSERT IGNORE and re-using auto_increment values
-create table t1 (id int primary key auto_increment, data int, unique(data));
-insert ignore into t1 values(NULL,100),(NULL,110),(NULL,120);
-insert ignore into t1 values(NULL,10),(NULL,20),(NULL,110),(NULL,120),(NULL,100),(NULL,90);
-insert ignore into t1 values(NULL,130),(NULL,140),(500,110),(550,120),(450,100),(NULL,150);
-select * from t1 order by id;
-
-drop table t1;
-
-#
-# BUG#21483: Server abort or deadlock on INSERT DELAYED with another
-# implicit insert
-#
-# The solution is to downgrade INSERT DELAYED to normal INSERT if the
-# statement uses functions and access tables or triggers, or is called
-# from a function or a trigger.
-#
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP FUNCTION IF EXISTS f1;
-DROP FUNCTION IF EXISTS f2;
---enable_warnings
-
-CREATE TABLE t1 (i INT);
-delimiter |;
-CREATE FUNCTION f1() RETURNS INT
-BEGIN
- INSERT INTO t1 VALUES (1);
- RETURN 1;
-END |
-CREATE FUNCTION f2() RETURNS INT
-BEGIN
- INSERT DELAYED INTO t1 VALUES (2);
- RETURN 1;
-END |
-delimiter ;|
-
-SELECT f1();
-SELECT f2();
-INSERT INTO t1 VALUES (3);
-INSERT DELAYED INTO t1 VALUES (4);
-
---error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
-INSERT INTO t1 VALUES (f1());
-
---error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
-INSERT DELAYED INTO t1 VALUES (f1());
-
---error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
-INSERT INTO t1 VALUES (f2());
-
---error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
-INSERT DELAYED INTO t1 VALUES (f2());
-
-CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
- INSERT INTO t1 VALUES (NEW.i);
-
---error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
-INSERT INTO t1 VALUES (1);
-
---error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
-INSERT DELAYED INTO t1 VALUES (1);
-
-SELECT * FROM t1;
-
-DROP FUNCTION f2;
-DROP FUNCTION f1;
-DROP TABLE t1;
-
-#
-# BUG#20497: Trigger with INSERT DELAYED causes Error 1165
-#
-# Fixed by the patch for Bug#21483
-#
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-CREATE TABLE t1 (i INT);
-CREATE TABLE t2 (i INT);
-
-CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
- INSERT DELAYED INTO t2 VALUES (NEW.i);
-
-CREATE TRIGGER t1_bu BEFORE UPDATE ON t1 FOR EACH ROW
- INSERT DELAYED INTO t2 VALUES (NEW.i);
-
-CREATE TRIGGER t1_bd BEFORE DELETE ON t1 FOR EACH ROW
- INSERT DELAYED INTO t2 VALUES (OLD.i);
-
-INSERT INTO t1 VALUES (1);
-INSERT DELAYED INTO t1 VALUES (2);
-SELECT * FROM t1;
-UPDATE t1 SET i = 3 WHERE i = 1;
-SELECT * FROM t1;
-DELETE FROM t1 WHERE i = 3;
-SELECT * FROM t1;
-SELECT * FROM t2;
-
-DROP TABLE t1, t2;
-
-#
-# BUG#21714: Wrong NEW.value and server abort on INSERT DELAYED to a
-# table with a trigger
-#
-# Fixed by the patch for Bug#21483
-#
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-CREATE TABLE t1 (i INT);
-CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
- SET @a= NEW.i;
-
-SET @a= 0;
-INSERT DELAYED INTO t1 VALUES (1);
-SELECT @a;
-INSERT DELAYED INTO t1 VALUES (2);
-SELECT @a;
-
-DROP TABLE t1;
-
-CREATE TABLE t1 (i INT);
-CREATE TABLE t2 (i INT);
-
-CREATE TRIGGER t1_ai AFTER INSERT ON t1 FOR EACH ROW
- INSERT INTO t2 VALUES (NEW.i);
-
-CREATE TRIGGER t1_au AFTER UPDATE ON t1 FOR EACH ROW
- INSERT DELAYED INTO t2 VALUES (NEW.i);
-
-CREATE TRIGGER t1_ad AFTER DELETE ON t1 FOR EACH ROW
- INSERT DELAYED INTO t2 VALUES (OLD.i);
-
-INSERT DELAYED INTO t1 VALUES (1);
-SELECT * FROM t1;
-UPDATE t1 SET i = 2 WHERE i = 1;
-SELECT * FROM t1;
-DELETE FROM t1 WHERE i = 2;
-SELECT * FROM t1;
-SELECT * FROM t2;
-
-DROP TABLE t1, t2;
-
-#
-# Bug #26788: mysqld (debug) aborts when inserting specific numbers into char
-# fields
-#
-
-CREATE TABLE t1 (
- a char(20) NOT NULL,
- b char(7) DEFAULT NULL,
- c char(4) DEFAULT NULL
-);
-
-INSERT INTO t1(a,b,c) VALUES (9.999999e+0, 9.999999e+0, 9.999e+0);
-INSERT IGNORE INTO t1(a,b,c) VALUES (1.225e-05, 1.225e-05, 1.225e-05);
-INSERT INTO t1(a,b) VALUES (1.225e-04, 1.225e-04);
-INSERT INTO t1(a,b) VALUES (1.225e-01, 1.225e-01);
-INSERT INTO t1(a,b) VALUES (1.225877e-01, 1.225877e-01);
-INSERT INTO t1(a,b) VALUES (1.225e+01, 1.225e+01);
-INSERT INTO t1(a,b,c) VALUES (1.225e+01, 1.225e+01, 1.225e+01);
-INSERT INTO t1(a,b) VALUES (1.225e+05, 1.225e+05);
-INSERT INTO t1(a,b) VALUES (1.225e+10, 1.225e+10);
-INSERT INTO t1(a,b) VALUES (1.225e+15, 1.225e+15);
-INSERT INTO t1(a,b) VALUES (5000000e+0, 5000000e+0);
-INSERT INTO t1(a,b) VALUES (1.25e+78, 1.25e+78);
-INSERT INTO t1(a,b) VALUES (1.25e-94, 1.25e-94);
-INSERT INTO t1(a,b) VALUES (1.25e+203, 1.25e+203);
-INSERT INTO t1(a,b) VALUES (1.25e-175, 1.25e-175);
-INSERT INTO t1(a,c) VALUES (1.225e+0, 1.225e+0);
-INSERT INTO t1(a,c) VALUES (1.37e+0, 1.37e+0);
-INSERT INTO t1(a,c) VALUES (-1.37e+0, -1.37e+0);
-INSERT IGNORE INTO t1(a,c) VALUES (1.87e-3, 1.87e-3);
-INSERT INTO t1(a,c) VALUES (-1.87e-2, -1.87e-2);
-INSERT INTO t1(a,c) VALUES (5000e+0, 5000e+0);
-INSERT INTO t1(a,c) VALUES (-5000e+0, -5000e+0);
-SELECT * FROM t1;
-
-DROP TABLE t1;
-
-CREATE TABLE t1 (
- a char(20) NOT NULL,
- b char(7) DEFAULT NULL,
- c char(5)
-);
-
-
-INSERT INTO t1(a,b,c) VALUES (9.999999e+0, 9.999999e+0, 9.999e+0);
-INSERT INTO t1(a,b,c) VALUES (1.225e-05, 1.225e-05, 1.225e-05);
-INSERT INTO t1(a,b) VALUES (1.225e-04, 1.225e-04);
-INSERT INTO t1(a,b) VALUES (1.225e-01, 1.225e-01);
-INSERT INTO t1(a,b) VALUES (1.225877e-01, 1.225877e-01);
-INSERT INTO t1(a,b) VALUES (1.225e+01, 1.225e+01);
-INSERT INTO t1(a,b,c) VALUES (1.225e+01, 1.225e+01, 1.225e+01);
-INSERT INTO t1(a,b) VALUES (1.225e+05, 1.225e+05);
-INSERT INTO t1(a,b) VALUES (1.225e+10, 1.225e+10);
-INSERT INTO t1(a,b) VALUES (1.225e+15, 1.225e+15);
-INSERT INTO t1(a,b) VALUES (5000000e+0, 5000000e+0);
-INSERT INTO t1(a,b) VALUES (1.25e+78, 1.25e+78);
-INSERT INTO t1(a,b) VALUES (1.25e-94, 1.25e-94);
-INSERT INTO t1(a,b) VALUES (1.25e+203, 1.25e+203);
-INSERT INTO t1(a,b) VALUES (1.25e-175, 1.25e-175);
-INSERT INTO t1(a,c) VALUES (1.225e+0, 1.225e+0);
-INSERT INTO t1(a,c) VALUES (1.37e+0, 1.37e+0);
-INSERT INTO t1(a,c) VALUES (-1.37e+0, -1.37e+0);
-INSERT INTO t1(a,c) VALUES (1.87e-3, 1.87e-3);
-INSERT INTO t1(a,c) VALUES (-1.87e-2, -1.87e-2);
-INSERT INTO t1(a,c) VALUES (5000e+0, 5000e+0);
-INSERT INTO t1(a,c) VALUES (-5000e+0, -5000e+0);
-
-SELECT * FROM t1;
-
-DROP TABLE t1;
-
-#
-# Bug #31152: assertion in Field_str::store(double)
-#
-
-CREATE TABLE t (a CHAR(10),b INT);
-INSERT INTO t VALUES (),(),();
-INSERT INTO t(a) SELECT rand() FROM t;
-DROP TABLE t;
-
-#
-# Bug #30453: String not cast to int correctly
-#
-
-CREATE TABLE t1 (c1 INT NOT NULL);
-INSERT INTO t1 VALUES(4188.32999999999992724042385816574096679687500),
-('4188.32999999999992724042385816574096679687500'), (4188);
-SELECT * FROM t1;
-
-CREATE TABLE t2 (c1 BIGINT);
-INSERT INTO t2 VALUES('15449237462.0000000000');
-SELECT * FROM t2;
-
-DROP TABLE t1, t2;
-
-#
-# Bug#43833 Simple INSERT crashes the server
-#
-CREATE TABLE t1(f1 FLOAT);
-INSERT INTO t1 VALUES (1.23);
-CREATE TABLE t2(f1 CHAR(1));
-INSERT INTO t2 SELECT f1 FROM t1;
-DROP TABLE t1, t2;
-
---echo End of 5.0 tests.
-
---echo #
---echo # Bug#34898 "mysql_info() reports 0 warnings while
---echo # mysql_warning_count() reports 1"
---echo # Check that the number of warnings reported by
---echo # mysql_info() is correct.
---echo #
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1 (data varchar(4) not null);
-
-set sql_mode='error_for_division_by_zero';
---echo #
---echo # Demonstrate that the number of warnings matches
---echo # the information in mysql_info().
---echo #
---enable_info
-insert t1 (data) values ('letter'), (1/0);
---disable_ps_protocol
-update t1 set data='envelope' where 1/0 or 1;
---enable_ps_protocol
-insert t1 (data) values (default), (1/0), ('dead beef');
---disable_info
-
-set sql_mode=default;
-drop table t1;
-
---echo #
---echo # End of 5.4 tests
---echo #
-
---echo #
---echo # Bug#54106 assert in Protocol::end_statement,
---echo # INSERT IGNORE ... SELECT ... UNION SELECT ...
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (a INT);
-
---error ER_FIELD_SPECIFIED_TWICE
-INSERT INTO t1 (a, a) VALUES (1, 1);
-# Verify that ER_FIELD_SPECIFIED_TWICE is not ignorable
---error ER_FIELD_SPECIFIED_TWICE
-INSERT IGNORE t1 (a, a) VALUES (1, 1);
-
---error ER_FIELD_SPECIFIED_TWICE
-INSERT IGNORE t1 (a, a) SELECT 1,1;
-# Used to cause an assert
---error ER_FIELD_SPECIFIED_TWICE
-INSERT IGNORE t1 (a, a) SELECT 1,1 UNION SELECT 2,2;
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-5168: Ensure that we can disable duplicate key warnings
---echo # from INSERT IGNORE
---echo #
-
-create table t1 (f1 int unique, f2 int unique);
-insert into t1 values (1,12);
-insert into t1 values (2,13);
---error ER_DUP_ENTRY
-insert into t1 values (1,12);
-insert ignore into t1 values (1,12);
-set @@old_mode="NO_DUP_KEY_WARNINGS_WITH_IGNORE";
-insert ignore into t1 values (1,12);
-insert ignore into t1 values (1,12) on duplicate key update f2=13;
-set @@old_mode="";
-insert ignore into t1 values (1,12);
-DROP TABLE t1;
-
---echo #
---echo # MDEV-13290 Assertion Assertion `!is_set() || (m_status == DA_OK_BULK
---echo # && is_bulk_op())' or `! is_set()' failed
---echo #
-
-SET @save_mode= @@sql_mode;
-SET sql_mode= 'STRICT_ALL_TABLES';
-CREATE TABLE t1 (f1 INT DEFAULT 0, f2 INT);
-CREATE ALGORITHM = MERGE VIEW v1 AS SELECT f1, f2 FROM t1 WHERE f1 = 'x' WITH CHECK OPTION;
---error ER_TRUNCATED_WRONG_VALUE
-REPLACE INTO v1 SET f2 = 1;
-SELECT * from t1;
-drop view v1;
-CREATE ALGORITHM = MERGE VIEW v1 AS SELECT f1, f2 FROM t1 WHERE f1 = cast('' as decimal) WITH CHECK OPTION;
---error ER_TRUNCATED_WRONG_VALUE
-REPLACE INTO v1 SET f2 = 1;
-SELECT * from t1;
-drop view v1;
-SELECT 0,0 INTO OUTFILE 't1.txt';
-CREATE ALGORITHM = MERGE VIEW v1 AS SELECT f1, f2 FROM t1 WHERE f1 = 'x' WITH CHECK OPTION;
---error ER_TRUNCATED_WRONG_VALUE
-LOAD DATA INFILE 't1.txt' INTO TABLE v1;
-SELECT * from t1;
-let $MYSQLD_DATADIR= `select @@datadir`;
-remove_file $MYSQLD_DATADIR/test/t1.txt;
-drop view v1;
-drop table t1;
-SET @@sql_mode= @save_mode;
-
-#
-# MDEV-13861 Assertion `0' failed in Protocol::end_statement
-#
-CREATE TABLE t1 (f INT);
-CREATE VIEW v1 AS SELECT * FROM t1 WHERE f <=> 'foo' WITH CHECK OPTION;
---error ER_TRUNCATED_WRONG_VALUE
-REPLACE INTO v1 SET f = NULL;
-DROP VIEW v1;
-DROP TABLE t1;
diff --git a/mysql-test/t/insert_innodb.test b/mysql-test/t/insert_innodb.test
deleted file mode 100644
index 68b6ca4e315..00000000000
--- a/mysql-test/t/insert_innodb.test
+++ /dev/null
@@ -1,64 +0,0 @@
---source include/have_innodb.inc
-
-#
-# MDEV-8979 IGNORE does not ignore the error 1452
-#
-
---echo #
---echo # BUG#22037930: INSERT IGNORE FAILS TO IGNORE
---echo # FOREIGN KEY CONSTRAINT
-
---echo # Setup.
-CREATE TABLE t1 (fld1 INT PRIMARY KEY) ENGINE=INNODB;
-CREATE TABLE t2 (fld2 INT, FOREIGN KEY (fld2) REFERENCES t1 (fld1))
-ENGINE=INNODB;
-INSERT INTO t1 VALUES(0);
-INSERT INTO t2 VALUES(0);
-
---echo # Without fix, an error is reported.
-INSERT IGNORE INTO t2 VALUES(1);
-UPDATE IGNORE t2 SET fld2=20 WHERE fld2=0;
-UPDATE IGNORE t1 SET fld1=20 WHERE fld1=0;
-
---echo # Test for multi update.
-UPDATE IGNORE t1, t2 SET t2.fld2= t2.fld2 + 3;
-UPDATE IGNORE t1, t2 SET t1.fld1= t1.fld1 + 3;
-
---echo # Reports an error since IGNORE is not used.
---error ER_NO_REFERENCED_ROW_2
-INSERT INTO t2 VALUES(1);
-
---error ER_NO_REFERENCED_ROW_2
-UPDATE t2 SET fld2=20 WHERE fld2=0;
-
---error ER_ROW_IS_REFERENCED_2
-UPDATE t1 SET fld1=20 WHERE fld1=0;
-
---error ER_NO_REFERENCED_ROW_2
-UPDATE t1, t2 SET t2.fld2= t2.fld2 + 3;
-
---error ER_ROW_IS_REFERENCED_2
-UPDATE t1, t2 SET t1.fld1= t1.fld1 + 3;
-
-DROP TABLE t2, t1;
-
---echo #
---echo # BUG#22037930: INSERT IGNORE FAILS TO IGNORE FOREIGN
---echo # KEY CONSTRAINT
-
-CREATE TABLE t1 (fld1 INT PRIMARY KEY) ENGINE= INNODB;
-
-CREATE TABLE t2 (fld1 VARCHAR(10), fld2 INT NOT NULL,
-CONSTRAINT fk FOREIGN KEY (fld2) REFERENCES t1(fld1)) ENGINE= INNODB;
-
---echo # Without patch, reports incorrect error.
---error ER_NO_REFERENCED_ROW_2
-INSERT INTO t2 VALUES('abc', 2) ON DUPLICATE KEY UPDATE fld1= 'def';
---error ER_NO_REFERENCED_ROW_2
-REPLACE INTO t2 VALUES('abc', 2);
-
---enable_warnings
-INSERT IGNORE INTO t2 VALUES('abc', 2) ON DUPLICATE KEY UPDATE fld1= 'def';
---disable_warnings
-
-DROP TABLE t2, t1;
diff --git a/mysql-test/t/insert_notembedded.test b/mysql-test/t/insert_notembedded.test
deleted file mode 100644
index 2769aee8d8a..00000000000
--- a/mysql-test/t/insert_notembedded.test
+++ /dev/null
@@ -1,160 +0,0 @@
--- source include/not_embedded.inc
-
-set local sql_mode="";
-set global sql_mode="";
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-# Test for INSERT DELAYED INTO a <view>
-# BUG#13683: INSERT DELAYED into a view creates an infinite loop
-#
-
-create table t1 (n int);
-create view v1 as select * from t1;
---error 1347
-insert delayed into v1 values (1);
-drop table t1;
-drop view v1;
-
-#
-# Bug #20989: View '(null).(null)' references invalid table(s)... on
-# SQL SECURITY INVOKER
-#
-# this is really the fact that REPLACE ... SELECT required additional
-# INSERT privs (on tables that are part of a view) over the related
-# REPLACE, SELECT
-#
-
-CREATE DATABASE meow;
-
-connect (root,localhost,root,,meow);
-connection root;
-
-CREATE TABLE table_target ( mexs_id CHAR(8), messzeit TIMESTAMP, PRIMARY KEY (mexs_id));
-CREATE TABLE table_target2 ( mexs_id CHAR(8), messzeit TIMESTAMP, PRIMARY KEY (mexs_id));
-CREATE TABLE table_target3 ( mexs_id CHAR(8), messzeit TIMESTAMP, PRIMARY KEY (mexs_id));
-CREATE VIEW view_target2 AS SELECT mexs_id,messzeit FROM table_target2;
-CREATE SQL SECURITY INVOKER VIEW view_target3 AS SELECT mexs_id,messzeit FROM table_target3;
-
-CREATE TABLE table_stations ( mexs_id VARCHAR(8), icao VARCHAR(4), country CHAR(2), PRIMARY KEY (mexs_id), UNIQUE KEY icao (icao), KEY country (country), CONSTRAINT stations_ibfk_8 FOREIGN KEY (country) REFERENCES countries (country) ON UPDATE CASCADE);
-INSERT INTO table_stations VALUES ('87654321','XXXX','YY');
-
-CREATE TABLE table_countries ( country CHAR(2), iso_short_en VARCHAR(64), PRIMARY KEY (country));
-INSERT INTO table_countries VALUES ('YY','Entenhausen');
-
-CREATE ALGORITHM=MERGE SQL SECURITY INVOKER VIEW view_stations AS select table_stations.mexs_id AS mexs_id, table_stations.icao AS icao, table_stations.country AS landescode from (table_stations join table_countries on((table_stations.country = table_countries.country)));
-
-CREATE TABLE table_source ( id varchar(4), datetime TIMESTAMP, PRIMARY KEY (id));
-INSERT INTO table_source VALUES ('XXXX','2006-07-12 07:50:00');
-
-GRANT SELECT ON table_source TO user20989@localhost;
-GRANT SELECT ON table_countries TO user20989@localhost;
-GRANT SELECT ON table_stations TO user20989@localhost;
-GRANT SELECT ON view_stations TO user20989@localhost;
-GRANT SELECT ON table_target TO user20989@localhost;
-GRANT SELECT ON table_target2 TO user20989@localhost;
-GRANT INSERT,DELETE,SELECT ON view_target3 TO user20989@localhost;
-
-connect (user20989,localhost,user20989,,meow);
-connection user20989;
-
---error 1142
-REPLACE INTO table_target
-SELECT stations.mexs_id AS mexs_id, datetime AS messzeit
-FROM table_source
-INNER JOIN view_stations AS stations
-ON table_source.id = stations.icao
-LEFT JOIN table_target AS old
-USING (mexs_id);
-
---error 1142
-REPLACE INTO view_target2
-SELECT stations.mexs_id AS mexs_id, datetime AS messzeit
-FROM table_source
-INNER JOIN view_stations AS stations
-ON table_source.id = stations.icao
-LEFT JOIN view_target2 AS old
-USING (mexs_id);
-
---error 1356
-REPLACE INTO view_target3
-SELECT stations.mexs_id AS mexs_id, datetime AS messzeit
-FROM table_source
-INNER JOIN view_stations AS stations
-ON table_source.id = stations.icao
-LEFT JOIN view_target3 AS old
-USING (mexs_id);
-
-connection root;
-disconnect user20989;
-
-GRANT INSERT,DELETE ON table_target TO user20989@localhost;
-GRANT INSERT,DELETE,SELECT ON view_target2 TO user20989@localhost;
-GRANT INSERT,DELETE,SELECT ON table_target3 TO user20989@localhost;
-
-connect (user20989,localhost,user20989,,meow);
-connection user20989;
-
-REPLACE INTO table_target
-SELECT stations.mexs_id AS mexs_id, datetime AS messzeit
-FROM table_source
-INNER JOIN view_stations AS stations
-ON table_source.id = stations.icao
-LEFT JOIN table_target AS old
-USING (mexs_id);
-
---error 1142
-REPLACE INTO table_target2 VALUES ('00X45Y78','2006-07-12 07:50:00');
-REPLACE INTO view_target2 VALUES ('12X45Y78','2006-07-12 07:50:00');
-
-SELECT stations.mexs_id AS mexs_id, datetime AS messzeit
-FROM table_source
-INNER JOIN view_stations AS stations
-ON table_source.id = stations.icao
-LEFT JOIN view_target2 AS old
-USING (mexs_id);
-
-REPLACE INTO view_target2
-SELECT stations.mexs_id AS mexs_id, datetime AS messzeit
-FROM table_source
-INNER JOIN view_stations AS stations
-ON table_source.id = stations.icao
-LEFT JOIN view_target2 AS old
-USING (mexs_id);
-
-REPLACE INTO view_target3
-SELECT stations.mexs_id AS mexs_id, datetime AS messzeit
-FROM table_source
-INNER JOIN view_stations AS stations
-ON table_source.id = stations.icao
-LEFT JOIN view_target3 AS old
-USING (mexs_id);
-
-connection root;
-disconnect user20989;
-
-SELECT * FROM table_target;
-SELECT * FROM view_target2;
-SELECT * FROM view_target3;
-
-DROP VIEW view_stations;
-DROP TABLE table_source;
-DROP TABLE table_countries;
-DROP TABLE table_stations;
-DROP TABLE table_target;
-DROP TABLE table_target2;
-DROP TABLE table_target3;
-DROP VIEW view_target2;
-DROP VIEW view_target3;
-DROP USER user20989@localhost;
-
-disconnect root;
-
-connection default;
-
-DROP DATABASE meow;
-
-set local sql_mode=default;
-set global sql_mode=default;
diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test
deleted file mode 100644
index fda89f18d99..00000000000
--- a/mysql-test/t/insert_select.test
+++ /dev/null
@@ -1,427 +0,0 @@
-#
-# Problem with INSERT ... SELECT
-#
-
---disable_warnings
-drop table if exists t1,t2,t3;
---enable_warnings
-
-create table t1 (bandID MEDIUMINT UNSIGNED NOT NULL PRIMARY KEY, payoutID SMALLINT UNSIGNED NOT NULL);
-insert into t1 (bandID,payoutID) VALUES (1,6),(2,6),(3,4),(4,9),(5,10),(6,1),(7,12),(8,12);
-create table t2 (payoutID SMALLINT UNSIGNED NOT NULL PRIMARY KEY);
-insert into t2 (payoutID) SELECT DISTINCT payoutID FROM t1;
---error ER_DUP_ENTRY
-insert into t2 (payoutID) SELECT payoutID+10 FROM t1;
-insert ignore into t2 (payoutID) SELECT payoutID+10 FROM t1;
-select * from t2;
-drop table t1,t2;
-
-#
-# bug in bulk insert optimization
-# test case by Fournier Jocelyn <joc@presence-pc.com>
-#
-
-CREATE TABLE `t1` (
- `numeropost` bigint(20) unsigned NOT NULL default '0',
- `icone` tinyint(4) unsigned NOT NULL default '0',
- `numreponse` bigint(20) unsigned NOT NULL auto_increment,
- `contenu` text NOT NULL,
- `pseudo` varchar(50) NOT NULL default '',
- `date` datetime NOT NULL default '0000-00-00 00:00:00',
- `ip` bigint(11) NOT NULL default '0',
- `signature` tinyint(1) unsigned NOT NULL default '0',
- PRIMARY KEY (`numeropost`,`numreponse`)
- ,KEY `ip` (`ip`),
- KEY `date` (`date`),
- KEY `pseudo` (`pseudo`),
- KEY `numreponse` (`numreponse`)
-) ENGINE=MyISAM;
-
-CREATE TABLE `t2` (
- `numeropost` bigint(20) unsigned NOT NULL default '0',
- `icone` tinyint(4) unsigned NOT NULL default '0',
- `numreponse` bigint(20) unsigned NOT NULL auto_increment,
- `contenu` text NOT NULL,
- `pseudo` varchar(50) NOT NULL default '',
- `date` datetime NOT NULL default '0000-00-00 00:00:00',
- `ip` bigint(11) NOT NULL default '0',
- `signature` tinyint(1) unsigned NOT NULL default '0',
- PRIMARY KEY (`numeropost`,`numreponse`),
- KEY `ip` (`ip`),
- KEY `date` (`date`),
- KEY `pseudo` (`pseudo`),
- KEY `numreponse` (`numreponse`)
-) ENGINE=MyISAM;
-
-INSERT INTO t2
-(numeropost,icone,numreponse,contenu,pseudo,date,ip,signature) VALUES
-(9,1,56,'test','joce','2001-07-25 13:50:53'
-,3649052399,0);
-
-
-INSERT INTO t1 (numeropost,icone,contenu,pseudo,date,signature,ip)
-SELECT 1618,icone,contenu,pseudo,date,signature,ip FROM t2
-WHERE numeropost=9 ORDER BY numreponse ASC;
-
-show variables like '%bulk%';
-
-INSERT INTO t1 (numeropost,icone,contenu,pseudo,date,signature,ip)
-SELECT 1718,icone,contenu,pseudo,date,signature,ip FROM t2
-WHERE numeropost=9 ORDER BY numreponse ASC;
-
-DROP TABLE t1,t2;
-
-#
-# Test of insert ... select from same table
-#
-
-create table t1 (a int not null);
-create table t2 (a int not null);
-insert into t1 values (1);
-insert into t1 values (a+2);
-insert into t1 values (a+3);
-insert into t1 values (4),(a+5);
-insert into t1 select * from t1;
-select * from t1;
-insert into t1 select * from t1 as t2;
-select * from t1;
-insert into t2 select * from t1 as t2;
-select * from t1;
-insert into t1 select t2.a from t1,t2;
-select * from t1;
---error 1066
-insert into t1 select * from t1,t1;
-drop table t1,t2;
-
-#
-# test replace ... select
-#
-
-create table t1 (a int not null primary key, b char(10));
-create table t2 (a int not null, b char(10));
-insert into t1 values (1,"t1:1"),(3,"t1:3");
-insert into t2 values (2,"t2:2"), (3,"t2:3");
---error ER_DUP_ENTRY
-insert into t1 select * from t2;
-select * from t1;
-# REPLACE .. SELECT is not yet supported by PS
-replace into t1 select * from t2;
---sorted_result
-select * from t1;
-drop table t1,t2;
-
-#
-# Test that caused uninitialized memory access in auto_increment_key update
-#
-
-CREATE TABLE t1 ( USID INTEGER UNSIGNED, ServerID TINYINT UNSIGNED, State ENUM ('unknown', 'Access-Granted', 'Session-Active', 'Session-Closed' ) NOT NULL DEFAULT 'unknown', SessionID CHAR(32), User CHAR(32) NOT NULL DEFAULT '<UNKNOWN>', NASAddr INTEGER UNSIGNED, NASPort INTEGER UNSIGNED, NASPortType INTEGER UNSIGNED, ConnectSpeed INTEGER UNSIGNED, CarrierType CHAR(32), CallingStationID CHAR(32), CalledStationID CHAR(32), AssignedAddr INTEGER UNSIGNED, SessionTime INTEGER UNSIGNED, PacketsIn INTEGER UNSIGNED, OctetsIn INTEGER UNSIGNED, PacketsOut INTEGER UNSIGNED, OctetsOut INTEGER UNSIGNED, TerminateCause INTEGER UNSIGNED, UnauthTime TINYINT UNSIGNED, AccessRequestTime DATETIME, AcctStartTime DATETIME, AcctLastTime DATETIME, LastModification TIMESTAMP NOT NULL);
-CREATE TABLE t2 ( USID INTEGER UNSIGNED AUTO_INCREMENT, ServerID TINYINT UNSIGNED, State ENUM ('unknown', 'Access-Granted', 'Session-Active', 'Session-Closed' ) NOT NULL DEFAULT 'unknown', SessionID CHAR(32), User TEXT NOT NULL, NASAddr INTEGER UNSIGNED, NASPort INTEGER UNSIGNED, NASPortType INTEGER UNSIGNED, ConnectSpeed INTEGER UNSIGNED, CarrierType CHAR(32), CallingStationID CHAR(32), CalledStationID CHAR(32), AssignedAddr INTEGER UNSIGNED, SessionTime INTEGER UNSIGNED, PacketsIn INTEGER UNSIGNED, OctetsIn INTEGER UNSIGNED, PacketsOut INTEGER UNSIGNED, OctetsOut INTEGER UNSIGNED, TerminateCause INTEGER UNSIGNED, UnauthTime TINYINT UNSIGNED, AccessRequestTime DATETIME, AcctStartTime DATETIME, AcctLastTime DATETIME, LastModification TIMESTAMP NOT NULL, INDEX(USID,ServerID,NASAddr,SessionID), INDEX(AssignedAddr));
-INSERT INTO t1 VALUES (39,42,'Access-Granted','46','491721000045',2130706433,17690,NULL,NULL,'Localnet','491721000045','49172200000',754974766,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2003-07-18 00:11:21',NULL,NULL,20030718001121);
-INSERT INTO t2 SELECT USID, ServerID, State, SessionID, User, NASAddr, NASPort, NASPortType, ConnectSpeed, CarrierType, CallingStationID, CalledStationID, AssignedAddr, SessionTime, PacketsIn, OctetsIn, PacketsOut, OctetsOut, TerminateCause, UnauthTime, AccessRequestTime, AcctStartTime, AcctLastTime, LastModification from t1 LIMIT 1;
-drop table t1,t2;
-
-#
-# Another problem from Bug #2012
-#
-
-CREATE TABLE t1(
- Month date NOT NULL,
- Type tinyint(3) unsigned NOT NULL auto_increment,
- Field int(10) unsigned NOT NULL,
- Count int(10) unsigned NOT NULL,
- UNIQUE KEY Month (Month,Type,Field)
-);
-
-insert into t1 Values
-(20030901, 1, 1, 100),
-(20030901, 1, 2, 100),
-(20030901, 2, 1, 100),
-(20030901, 2, 2, 100),
-(20030901, 3, 1, 100);
-
-select * from t1;
-
-Select null, Field, Count From t1 Where Month=20030901 and Type=2;
-
-create table t2(No int not null, Field int not null, Count int not null);
-
-insert ignore into t2 Select null, Field, Count From t1 Where Month=20030901 and Type=2;
-
-select * from t2;
-
-drop table t1, t2;
-
-#
-# BUG#6034 - Error code 124: Wrong medium type
-#
-CREATE TABLE t1 (
- ID int(11) NOT NULL auto_increment,
- NO int(11) NOT NULL default '0',
- SEQ int(11) NOT NULL default '0',
- PRIMARY KEY (ID),
- KEY t1$NO (SEQ,NO)
-) ENGINE=MyISAM;
-INSERT INTO t1 (SEQ, NO) SELECT "1" AS SEQ, IF(MAX(NO) IS NULL, 0, MAX(NO)) + 1 AS NO FROM t1 WHERE (SEQ = 1);
-select SQL_BUFFER_RESULT * from t1 WHERE (SEQ = 1);
-drop table t1;
-
-#
-# Bug#10886 - Have to restore default values after update ON DUPLICATE KEY
-#
-create table t1 (f1 int);
-create table t2 (ff1 int unique, ff2 int default 1);
-insert into t1 values (1),(1),(2);
-insert into t2(ff1) select f1 from t1 on duplicate key update ff2=ff2+1;
-select * from t2;
-drop table t1, t2;
-#
-# BUGS #9728 - 'Decreased functionality in "on duplicate key update"'
-# #8147 - 'a column proclaimed ambigous in INSERT ... SELECT .. ON
-# DUPLICATE'
-#
-create table t1 (a int unique);
-create table t2 (a int, b int);
-create table t3 (c int, d int);
-insert into t1 values (1),(2);
-insert into t2 values (1,2);
-insert into t3 values (1,6),(3,7);
-select * from t1;
-insert into t1 select a from t2 on duplicate key update a= t1.a + t2.b;
-select * from t1;
-insert into t1 select a+1 from t2 on duplicate key update t1.a= t1.a + t2.b+1;
-select * from t1;
-insert into t1 select t3.c from t3 on duplicate key update a= a + t3.d;
-select * from t1;
-insert into t1 select t2.a from t2 group by t2.a on duplicate key update a= a + 10;
-
-#Some error cases
---error 1052
-insert into t1 select t2.a from t2 on duplicate key update a= a + t2.b;
---error 1054
-insert into t1 select t2.a from t2 on duplicate key update t2.a= a + t2.b;
---error 1054
-insert into t1 select t2.a from t2 group by t2.a on duplicate key update a= t1.a + t2.b;
-drop table t1,t2,t3;
-
-#
-# Bug #12695 Item_func_isnull::update_used_tables() did not update
-# const_item_cache
-create table t1(f1 varchar(5) key);
-insert into t1(f1) select if(max(f1) is null, '2000',max(f1)+1) from t1;
-insert into t1(f1) select if(max(f1) is null, '2000',max(f1)+1) from t1;
-insert into t1(f1) select if(max(f1) is null, '2000',max(f1)+1) from t1;
-select * from t1;
-drop table t1;
-
-#
-# Bug #13392 values() fails with 'ambiguous' or returns NULL
-# with ON DUPLICATE and SELECT
-create table t1(x int, y int);
-create table t2(x int, z int);
-insert into t1(x,y) select x,z from t2 on duplicate key update x=values(x);
---error 1054
-insert into t1(x,y) select x,z from t2 on duplicate key update x=values(z);
---error 1054
-insert into t1(x,y) select x,z from t2 on duplicate key update x=values(t2.x);
-drop table t1,t2;
-
-#
-# Bug #9676: INSERT INTO x SELECT .. FROM x LIMIT 1; slows down with big
-# tables
-#
-
-#Note: not an exsaustive test : just a check of the code path.
-CREATE TABLE t1 (a int PRIMARY KEY);
-INSERT INTO t1 values (1), (2);
-
-flush status;
-INSERT INTO t1 SELECT a + 2 FROM t1 LIMIT 1;
-show status like 'Handler_read%';
-
-DROP TABLE t1;
-
-#
-# Bug #29717 INSERT INTO SELECT inserts values even if SELECT statement itself returns empty
-#
-
-CREATE TABLE t1 (
- f1 int(10) unsigned NOT NULL auto_increment PRIMARY KEY,
- f2 varchar(100) NOT NULL default ''
-);
-CREATE TABLE t2 (
- f1 varchar(10) NOT NULL default '',
- f2 char(3) NOT NULL default '',
- PRIMARY KEY (`f1`),
- KEY `k1` (`f2`, `f1`)
-);
-
-INSERT INTO t1 values(NULL, '');
-INSERT INTO `t2` VALUES ('486878','WDT'),('486910','WDT');
-SELECT COUNT(*) FROM t1;
-
-SELECT min(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
-
-INSERT INTO t1 (f2)
- SELECT min(t2.f1) FROM t1, t2 where t2.f2 = 'SIR' GROUP BY t1.f1;
-
-SELECT COUNT(*) FROM t1;
-SELECT * FROM t1;
-DROP TABLE t1, t2;
-
-# End of 4.1 tests
-
-#
-# Bug #18080: INSERT ... SELECT ... JOIN results in ambiguous field list error
-#
-CREATE TABLE t1 (x int, y int);
-CREATE TABLE t2 (z int, y int);
-CREATE TABLE t3 (a int, b int);
-INSERT INTO t3 (SELECT x, y FROM t1 JOIN t2 USING (y) WHERE z = 1);
-DROP TABLE IF EXISTS t1,t2,t3;
-
-#
-# Bug #21774: Column count doesn't match value count at row x
-#
-CREATE DATABASE bug21774_1;
-CREATE DATABASE bug21774_2;
-
-CREATE TABLE bug21774_1.t1(id VARCHAR(10) NOT NULL,label VARCHAR(255));
-CREATE TABLE bug21774_2.t1(id VARCHAR(10) NOT NULL,label VARCHAR(255));
-CREATE TABLE bug21774_1.t2(id VARCHAR(10) NOT NULL,label VARCHAR(255));
-
-INSERT INTO bug21774_2.t1 SELECT t1.* FROM bug21774_1.t1;
-
-use bug21774_1;
-INSERT INTO bug21774_2.t1 SELECT t1.* FROM t1;
-
-DROP DATABASE bug21774_1;
-DROP DATABASE bug21774_2;
-USE test;
-
-#
-# Bug#19978: INSERT .. ON DUPLICATE erroneously reports some records were
-# updated.
-#
-create table t1(f1 int primary key, f2 int);
---enable_info
-insert into t1 values (1,1);
-insert into t1 values (1,1) on duplicate key update f2=1;
-insert into t1 values (1,1) on duplicate key update f2=2;
---disable_info
-select * from t1;
-drop table t1;
-
-#
-# Bug#16630: wrong result, when INSERT t1 SELECT ... FROM t1 ON DUPLICATE
-#
-CREATE TABLE t1 (f1 INT, f2 INT );
-CREATE TABLE t2 (f1 INT PRIMARY KEY, f2 INT);
-INSERT INTO t1 VALUES (1,1),(2,2),(10,10);
-INSERT INTO t2 (f1, f2) SELECT f1, f2 FROM t1;
-INSERT INTO t2 (f1, f2)
- SELECT f1, f1 FROM t2 src WHERE f1 < 2
- ON DUPLICATE KEY UPDATE f1 = 100 + src.f1;
- --sorted_result
-SELECT * FROM t2;
-DROP TABLE t1, t2;
-
-#
-# Bug#44306: Assertion fail on duplicate key error in 'INSERT ... SELECT'
-# statements
-#
-SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
-CREATE TABLE t1 ( a INT KEY, b INT );
-INSERT INTO t1 VALUES ( 0, 1 );
---error ER_DUP_ENTRY
-INSERT INTO t1 ( b ) SELECT MAX( b ) FROM t1 WHERE b = 2;
-DROP TABLE t1;
-SET sql_mode = DEFAULT;
-
-#
-# Bug #26207: inserts don't work with shortened index
-#
-SET SQL_MODE='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
-
-CREATE TABLE t1 (c VARCHAR(30), INDEX ix_c (c(10)));
-CREATE TABLE t2 (d VARCHAR(10));
-INSERT INTO t1 (c) VALUES ('7_chars'), ('13_characters');
-
-EXPLAIN
- SELECT (SELECT SUM(LENGTH(c)) FROM t1 WHERE c='13_characters') FROM t1;
-
-SELECT (SELECT SUM(LENGTH(c)) FROM t1 WHERE c='13_characters') FROM t1;
-
-INSERT INTO t2 (d)
- SELECT (SELECT SUM(LENGTH(c)) FROM t1 WHERE c='13_characters') FROM t1;
-
-INSERT INTO t2 (d)
- SELECT (SELECT SUM(LENGTH(c)) FROM t1 WHERE c='7_chars') FROM t1;
-
-INSERT INTO t2 (d)
- SELECT (SELECT SUM(LENGTH(c)) FROM t1 WHERE c IN (SELECT t1.c FROM t1))
- FROM t1;
-
-SELECT * FROM t2;
-DROP TABLE t1,t2;
-
-#
-# Bug #29095: incorrect pushing of LIMIT into the temporary
-# table ignoring ORDER BY clause
-#
-
-CREATE TABLE t1 (
- id INT AUTO_INCREMENT PRIMARY KEY,
- prev_id INT,
- join_id INT DEFAULT 0);
-
-INSERT INTO t1 (prev_id) VALUES (NULL), (1), (2);
-SELECT * FROM t1;
-
-CREATE TABLE t2 (join_id INT);
-INSERT INTO t2 (join_id) VALUES (0);
-
-INSERT INTO t1 (prev_id) SELECT id
- FROM t2 LEFT JOIN t1 ON t1.join_id = t2.join_id
- ORDER BY id DESC LIMIT 1;
-SELECT * FROM t1;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug#30384: Having SQL_BUFFER_RESULT option in the
---echo # CREATE .. KEY(..) .. SELECT led to creating corrupted index.
---echo #
-create table t1(f1 int);
-insert into t1 values(1),(2),(3);
-create table t2 (key(f1)) engine=myisam select sql_buffer_result f1 from t1;
-check table t2 extended;
-drop table t1,t2;
-
---echo End of 5.0 tests
-
-# The following is not relevant for MariaDB as we are using Maria for
-# tmp tables.
-
---echo ##################################################################
---echo #
---echo # Bug #46075: Assertion failed: 0, file .\protocol.cc, line 416
---echo #
-
-CREATE TABLE t1(a INT);
-# To force MyISAM temp. table in the following INSERT ... SELECT.
-SET max_heap_table_size = 16384;
-# To overflow the temp. table.
-SET @old_myisam_data_pointer_size = @@myisam_data_pointer_size;
-SET GLOBAL myisam_data_pointer_size = 2;
-
-INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
-
-call mtr.add_suppression("mysqld.*: The table '.*#sql.*' is full");
---error 0,ER_RECORD_FILE_FULL,ER_RECORD_FILE_FULL
-INSERT IGNORE INTO t1 SELECT t1.a FROM t1,t1 t2,t1 t3,t1 t4,t1 t5,t1 t6,t1 t7;
-
-# Cleanup
-SET GLOBAL myisam_data_pointer_size = @old_myisam_data_pointer_size;
-DROP TABLE t1;
-
---echo End of 5.1 tests
diff --git a/mysql-test/t/insert_update.test b/mysql-test/t/insert_update.test
deleted file mode 100644
index 06e16be84d7..00000000000
--- a/mysql-test/t/insert_update.test
+++ /dev/null
@@ -1,313 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-CREATE TABLE t1 (a INT, b INT, c INT, UNIQUE (A), UNIQUE(B));
-INSERT t1 VALUES (1,2,10), (3,4,20);
-INSERT t1 VALUES (5,6,30) ON DUPLICATE KEY UPDATE c=c+100;
-SELECT * FROM t1;
-INSERT t1 VALUES (5,7,40) ON DUPLICATE KEY UPDATE c=c+100;
-SELECT * FROM t1;
-INSERT t1 VALUES (8,4,50) ON DUPLICATE KEY UPDATE c=c+1000;
-SELECT * FROM t1;
-INSERT t1 VALUES (1,4,60) ON DUPLICATE KEY UPDATE c=c+10000;
-SELECT * FROM t1;
--- error ER_DUP_ENTRY
-INSERT t1 VALUES (1,9,70) ON DUPLICATE KEY UPDATE c=c+100000, b=4;
-SELECT * FROM t1;
-TRUNCATE TABLE t1;
-INSERT t1 VALUES (1,2,10), (3,4,20);
-INSERT t1 VALUES (5,6,30), (7,4,40), (8,9,60) ON DUPLICATE KEY UPDATE c=c+100;
-SELECT * FROM t1;
-INSERT t1 SET a=5 ON DUPLICATE KEY UPDATE b=0;
-SELECT * FROM t1;
-INSERT t1 VALUES (2,1,11), (7,4,40) ON DUPLICATE KEY UPDATE c=c+VALUES(a);
-SELECT *, VALUE(a) FROM t1;
-explain extended SELECT *, VALUE(a) FROM t1;
-explain extended select * from t1 where value(a);
-DROP TABLE t1;
-
-#
-# test for Bug #2709 "Affected Rows for ON DUPL.KEY undocumented,
-# perhaps illogical"
-#
-create table t1(a int primary key, b int);
-insert into t1 values(1,1),(2,2),(3,3),(4,4),(5,5);
-select * from t1;
-
---enable_info
-insert into t1 values(4,14),(5,15),(6,16),(7,17),(8,18)
- on duplicate key update b=b+10;
---disable_info
-
-select * from t1;
-
-enable_info;
-replace into t1 values(5,25),(6,26),(7,27),(8,28),(9,29);
-disable_info;
-
-select * from t1;
-drop table t1;
-
-# WorkLog #2274 - enable INSERT .. SELECT .. UPDATE syntax
-# Same tests as beginning of this test except that insert source
-# is a result from a select statement
-#
-CREATE TABLE t1 (a INT, b INT, c INT, UNIQUE (A), UNIQUE(B));
-INSERT t1 VALUES (1,2,10), (3,4,20);
-INSERT t1 SELECT 5,6,30 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100;
-SELECT * FROM t1;
-INSERT t1 SELECT 5,7,40 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100;
-SELECT * FROM t1;
-INSERT t1 SELECT 8,4,50 FROM DUAL ON DUPLICATE KEY UPDATE c=c+1000;
-SELECT * FROM t1;
-INSERT t1 SELECT 1,4,60 FROM DUAL ON DUPLICATE KEY UPDATE c=c+10000;
-SELECT * FROM t1;
--- error ER_DUP_ENTRY
-INSERT t1 SELECT 1,9,70 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100000, b=4;
-SELECT * FROM t1;
-TRUNCATE TABLE t1;
-INSERT t1 VALUES (1,2,10), (3,4,20);
-CREATE TABLE t2 (a INT, b INT, c INT, d INT);
-# column names deliberately clash with columns in t1 (Bug#8147)
-INSERT t2 VALUES (5,6,30,1), (7,4,40,1), (8,9,60,1);
-INSERT t2 VALUES (2,1,11,2), (7,4,40,2);
-INSERT t1 SELECT a,b,c FROM t2 WHERE d=1 ON DUPLICATE KEY UPDATE c=t1.c+100;
-SELECT * FROM t1;
-INSERT t1 SET a=5 ON DUPLICATE KEY UPDATE b=0;
-SELECT * FROM t1;
---error ER_NON_UNIQ_ERROR
-INSERT t1 SELECT a,b,c FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=c+VALUES(a);
-INSERT t1 SELECT a,b,c FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=t1.c+VALUES(t1.a);
-SELECT *, VALUE(a) FROM t1;
-DROP TABLE t1;
-DROP TABLE t2;
-
-#
-# Bug#9725 - "disapearing query/hang" and "unknown error" with "on duplicate key update"
-# INSERT INGORE...UPDATE gives bad error or breaks protocol.
-#
-create table t1 (a int not null unique) engine=myisam;
-insert into t1 values (1),(2);
-insert ignore into t1 select 1 on duplicate key update a=2;
-select * from t1;
-insert ignore into t1 select a from t1 as t2 on duplicate key update a=t1.a+1 ;
-select * from t1;
-insert into t1 select 1 on duplicate key update a=2;
-select * from t1;
---error ER_NON_UNIQ_ERROR
-insert into t1 select a from t1 on duplicate key update a=a+1 ;
---error ER_NON_UNIQ_ERROR
-insert ignore into t1 select a from t1 on duplicate key update a=t1.a+1 ;
-drop table t1;
-
-#
-# Bug#10109 - INSERT .. SELECT ... ON DUPLICATE KEY UPDATE fails
-# Bogus "Duplicate columns" error message
-#
-
-CREATE TABLE t1 (
- a BIGINT(20) NOT NULL DEFAULT 0,
- PRIMARY KEY (a)
-) ENGINE=MyISAM;
-
-INSERT INTO t1 ( a ) SELECT 0 ON DUPLICATE KEY UPDATE a = a + VALUES (a) ;
-
-DROP TABLE t1;
-
-#
-# Bug#21555: incorrect behavior with INSERT ... ON DUPL KEY UPDATE and VALUES
-#
-
-
-# End of 4.1 tests
-CREATE TABLE t1
-(
- a BIGINT UNSIGNED,
- b BIGINT UNSIGNED,
- PRIMARY KEY (a)
-);
-
-INSERT INTO t1 VALUES (45, 1) ON DUPLICATE KEY UPDATE b =
- IF(VALUES(b) > t1.b, VALUES(b), t1.b);
-SELECT * FROM t1;
-INSERT INTO t1 VALUES (45, 2) ON DUPLICATE KEY UPDATE b =
- IF(VALUES(b) > t1.b, VALUES(b), t1.b);
-SELECT * FROM t1;
-INSERT INTO t1 VALUES (45, 1) ON DUPLICATE KEY UPDATE b =
- IF(VALUES(b) > t1.b, VALUES(b), t1.b);
-SELECT * FROM t1;
-
-DROP TABLE t1;
-
-#
-# Bug#25831: Deficiencies in INSERT ... SELECT ... field name resolving.
-#
-CREATE TABLE t1 (i INT PRIMARY KEY, j INT);
---error ER_BAD_FIELD_ERROR
-INSERT INTO t1 SELECT 1, j;
-DROP TABLE t1;
-
-CREATE TABLE t1 (i INT PRIMARY KEY, j INT);
-CREATE TABLE t2 (a INT, b INT);
-CREATE TABLE t3 (a INT, c INT);
-INSERT INTO t1 SELECT 1, a FROM t2 NATURAL JOIN t3
- ON DUPLICATE KEY UPDATE j= a;
-DROP TABLE t1,t2,t3;
-
-CREATE TABLE t1 (i INT PRIMARY KEY, j INT);
-CREATE TABLE t2 (a INT);
-INSERT INTO t1 VALUES (1, 1);
-INSERT INTO t2 VALUES (1), (3);
---error ER_BAD_FIELD_ERROR
-INSERT INTO t1 SELECT 1, COUNT(*) FROM t2 ON DUPLICATE KEY UPDATE j= a;
-DROP TABLE t1,t2;
-
-#
-# Bug #26261: Missing default value isn't noticed in
-# insert ... on duplicate key update
-#
-SET SQL_MODE = 'TRADITIONAL';
-
-CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL);
-INSERT INTO t1 VALUES (1,1);
-
---error ER_NO_DEFAULT_FOR_FIELD
-INSERT INTO t1 (a) VALUES (1);
-
---error ER_NO_DEFAULT_FOR_FIELD
-INSERT INTO t1 (a) VALUES (1) ON DUPLICATE KEY UPDATE a = b;
-
-# this one is ok
-INSERT INTO t1 (a) VALUES (1) ON DUPLICATE KEY UPDATE b = a;
-
-# arguably the statement below should fail
-INSERT INTO t1 (a) VALUES (1) ON DUPLICATE KEY UPDATE b = b;
-
-SELECT * FROM t1;
-
-DROP TABLE t1;
-
-#
-# Bug#27033: 0 as LAST_INSERT_ID() after INSERT .. ON DUPLICATE if rows were
-# touched but not actually changed.
-#
-CREATE TABLE t1 (f1 INT AUTO_INCREMENT PRIMARY KEY,
- f2 VARCHAR(5) NOT NULL UNIQUE);
-INSERT t1 (f2) VALUES ('test') ON DUPLICATE KEY UPDATE f1 = LAST_INSERT_ID(f1);
-SELECT LAST_INSERT_ID();
-INSERT t1 (f2) VALUES ('test') ON DUPLICATE KEY UPDATE f1 = LAST_INSERT_ID(f1);
-SELECT LAST_INSERT_ID();
-DROP TABLE t1;
-
-#
-# Bug#23233: 0 as LAST_INSERT_ID() after INSERT .. ON DUPLICATE in the
-# NO_AUTO_VALUE_ON_ZERO mode.
-#
-SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO';
-CREATE TABLE `t1` (
- `id` int(11) PRIMARY KEY auto_increment,
- `f1` varchar(10) NOT NULL UNIQUE
-);
-INSERT IGNORE INTO t1 (f1) VALUES ("test1")
- ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
-INSERT IGNORE INTO t1 (f1) VALUES ("test1")
- ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
-SELECT LAST_INSERT_ID();
-SELECT * FROM t1;
-INSERT IGNORE INTO t1 (f1) VALUES ("test2")
- ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
-SELECT * FROM t1;
-INSERT IGNORE INTO t1 (f1) VALUES ("test2")
- ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
-SELECT LAST_INSERT_ID();
-SELECT * FROM t1;
-INSERT IGNORE INTO t1 (f1) VALUES ("test3")
- ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
-SELECT LAST_INSERT_ID();
-SELECT * FROM t1;
-DROP TABLE t1;
-CREATE TABLE `t1` (
- `id` int(11) PRIMARY KEY auto_increment,
- `f1` varchar(10) NOT NULL UNIQUE
-);
-INSERT IGNORE INTO t1 (f1) VALUES ("test1")
- ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
-SELECT LAST_INSERT_ID();
-SELECT * FROM t1;
-INSERT IGNORE INTO t1 (f1) VALUES ("test1"),("test4")
- ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id);
-SELECT LAST_INSERT_ID();
-SELECT * FROM t1;
-DROP TABLE t1;
-CREATE TABLE `t1` (
- `id` int(11) PRIMARY KEY auto_increment,
- `f1` varchar(10) NOT NULL UNIQUE,
- tim1 timestamp default '2003-01-01 00:00:00' on update current_timestamp
-);
-INSERT INTO t1 (f1) VALUES ("test1");
-SELECT id, f1 FROM t1;
-REPLACE INTO t1 VALUES (0,"test1",null);
-SELECT id, f1 FROM t1;
-DROP TABLE t1;
-SET SQL_MODE='';
-
-#
-# Bug#27954: multi-row INSERT ... ON DUPLICATE with duplicated
-# row at the first place into table with AUTO_INCREMENT and
-# additional UNIQUE key.
-#
-CREATE TABLE t1 (
- id INT AUTO_INCREMENT PRIMARY KEY,
- c1 CHAR(1) UNIQUE KEY,
- cnt INT DEFAULT 1
-);
-INSERT INTO t1 (c1) VALUES ('A'), ('B'), ('C');
-SELECT * FROM t1;
-INSERT INTO t1 (c1) VALUES ('A'), ('X'), ('Y'), ('Z')
- ON DUPLICATE KEY UPDATE cnt=cnt+1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-#
-# Bug#28000: INSERT IGNORE ... SELECT ... ON DUPLICATE
-# with erroneous UPDATE: NOT NULL field with NULL value.
-#
-CREATE TABLE t1 (
- id INT AUTO_INCREMENT PRIMARY KEY,
- c1 INT NOT NULL,
- cnt INT DEFAULT 1
-);
-INSERT INTO t1 (id,c1) VALUES (1,10);
-SELECT * FROM t1;
-CREATE TABLE t2 (id INT, c1 INT);
-INSERT INTO t2 VALUES (1,NULL), (2,2);
---error ER_BAD_NULL_ERROR
-INSERT INTO t1 (id,c1) SELECT 1,NULL
- ON DUPLICATE KEY UPDATE c1=NULL;
-SELECT * FROM t1;
-INSERT IGNORE INTO t1 (id,c1) SELECT 1,NULL
- ON DUPLICATE KEY UPDATE c1=NULL, cnt=cnt+1;
-SELECT * FROM t1;
-INSERT IGNORE INTO t1 (id,c1) SELECT * FROM t2
- ON DUPLICATE KEY UPDATE c1=NULL, cnt=cnt+1;
-SELECT * FROM t1;
-
-DROP TABLE t1;
-DROP TABLE t2;
-
-#
-# Bug#28904: INSERT .. ON DUPLICATE was silently updating rows when it
-# shouldn't.
-#
-create table t1(f1 int primary key,
- f2 timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP);
-insert into t1(f1) values(1);
---replace_column 1 #
-select @stamp1:=f2 from t1;
---sleep 2
-insert into t1(f1) values(1) on duplicate key update f1=1;
---replace_column 1 #
-select @stamp2:=f2 from t1;
-select if( @stamp1 = @stamp2, "correct", "wrong");
-drop table t1;
diff --git a/mysql-test/t/insert_update_autoinc-7150.test b/mysql-test/t/insert_update_autoinc-7150.test
deleted file mode 100644
index 1229898b4aa..00000000000
--- a/mysql-test/t/insert_update_autoinc-7150.test
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# MDEV-7150 Wrong auto increment values on INSERT .. ON DUPLICATE KEY UPDATE when the inserted columns include NULL in an auto-increment column
-#
-create table t1 (a int(10) auto_increment primary key, b int(11));
-insert t1 values (null,1);
-insert t1 values (null,2), (1,-1), (null,3) on duplicate key update b=values(b);
-select * from t1;
-drop table t1;
diff --git a/mysql-test/t/intersect.test b/mysql-test/t/intersect.test
deleted file mode 100644
index d9d420c786b..00000000000
--- a/mysql-test/t/intersect.test
+++ /dev/null
@@ -1,285 +0,0 @@
-create table t1 (a int, b int);
-create table t2 (c int, d int);
-insert into t1 values (1,1),(2,2);
-insert into t2 values (2,2),(3,3);
-
-(select a,b from t1) intersect (select c,d from t2);
-
-drop tables t1,t2;
-
-
-create table t1 (a int, b int) engine=MyISAM;
-create table t2 (c int, d int) engine=MyISAM;
-create table t3 (e int, f int) engine=MyISAM;
-insert into t1 values (1,1),(2,2),(3,3);
-insert into t2 values (2,2),(3,3),(4,4);
-insert into t3 values (1,1),(2,2),(5,5);
-
-(select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3);
-EXPLAIN (select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3);
-EXPLAIN extended (select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3);
-EXPLAIN extended select * from ((select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3)) a;
-EXPLAIN format=json (select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3);
---replace_regex /"r_total_time_ms": [0-9e\.\-+]*,/"r_total_time_ms": "REPLACED",/
-ANALYZE format=json (select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3);
---replace_regex /"r_total_time_ms": [0-9e\.\-+]*,/"r_total_time_ms": "REPLACED",/
-ANALYZE format=json select * from ((select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3)) a;
-select * from ((select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3)) a;
-
-prepare stmt from "(select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3);";
-execute stmt;
-execute stmt;
-
-prepare stmt from "select * from ((select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3)) a";
-execute stmt;
-execute stmt;
-
-(select a,b from t1) intersect (select c,e from t2,t3);
-EXPLAIN (select a,b from t1) intersect (select c,e from t2,t3);
-EXPLAIN extended (select a,b from t1) intersect (select c,e from t2,t3);
-EXPLAIN extended select * from ((select a,b from t1) intersect (select c,e from t2,t3)) a;
-EXPLAIN format=json (select a,b from t1) intersect (select c,e from t2,t3);
---replace_regex /"r_total_time_ms": [0-9e\.\-+]*,/"r_total_time_ms": "REPLACED",/
-ANALYZE format=json (select a,b from t1) intersect (select c,e from t2,t3);
---replace_regex /"r_total_time_ms": [0-9e\.\-+]*,/"r_total_time_ms": "REPLACED",/
-ANALYZE format=json select * from ((select a,b from t1) intersect (select c,e from t2,t3)) a;
-select * from ((select a,b from t1) intersect (select c,e from t2,t3)) a;
-
-prepare stmt from "(select a,b from t1) intersect (select c,e from t2,t3);";
-execute stmt;
-execute stmt;
-
-prepare stmt from "select * from ((select a,b from t1) intersect (select c,e from t2,t3)) a";
-execute stmt;
-execute stmt;
-
-
-drop tables t1,t2,t3;
-
-
-select 1 as a from dual intersect select 1 from dual;
-(select 1 from dual) intersect (select 1 from dual);
---error ER_WRONG_USAGE
-(select 1 from dual into @v) intersect (select 1 from dual);
---error ER_PARSE_ERROR
-select 1 from dual ORDER BY 1 intersect select 1 from dual;
-
-select 1 as a from dual union all select 1 from dual;
---error ER_WRONG_USAGE
-select 1 from dual intersect all select 1 from dual;
-
-
-
-create table t1 (a int, b blob, a1 int, b1 blob);
-create table t2 (c int, d blob, c1 int, d1 blob);
-insert into t1 values (1,"ddd", 1, "sdfrrwwww"),(2, "fgh", 2, "dffggtt");
-insert into t2 values (2, "fgh", 2, "dffggtt"),(3, "ffggddd", 3, "dfgg");
-
-(select a,b,b1 from t1) intersect (select c,d,d1 from t2);
-
-drop tables t1,t2;
-
-create table t1 (a int, b blob) engine=MyISAM;
-create table t2 (c int, d blob) engine=MyISAM;
-create table t3 (e int, f blob) engine=MyISAM;
-insert into t1 values (1,1),(2,2),(3,3);
-insert into t2 values (2,2),(3,3),(4,4);
-insert into t3 values (1,1),(2,2),(5,5);
-
-(select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3);
-select * from ((select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3)) a;
-
-prepare stmt from "(select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3);";
-execute stmt;
-execute stmt;
-
-prepare stmt from "select * from ((select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3)) a";
-execute stmt;
-execute stmt;
-
-# make sure that blob is used
-create table t4 (select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3);
-show create table t4;
-
-drop tables t1,t2,t3,t4;
-
-create table t1 (a int, b blob) engine=MyISAM;
-create table t2 (c int, d blob) engine=MyISAM;
-create table t3 (e int, f blob) engine=MyISAM;
-insert into t1 values (1,1),(2,2),(3,3);
-insert into t2 values (2,2),(3,3);
-insert into t3 values (1,1),(2,2),(3,3);
-
-
---sorted_result
-(select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3) union (select 4,4);
---sorted_result
-(select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3) union (select 4,4) except (select 2,2);
-
-drop tables t1,t2,t3;
-
-create table t1 (a int, b int);
-create table t2 (c int, d int);
-create table t3 (e int, f int);
-insert into t1 values (1,1),(2,2),(3,3);
-insert into t2 values (2,2),(3,3);
-insert into t3 values (1,1),(2,2),(3,3);
-
---sorted_result
-(select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3) union (select 4,4);
---sorted_result
-(select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3) union (select 4,4) except (select 2,2);
-
-drop tables t1,t2,t3;
-
-
---echo #
---echo # INTERSECT precedence
---echo #
-create table t1 (a int, b blob) engine=MyISAM;
-create table t2 (c int, d blob) engine=MyISAM;
-create table t3 (e int, f blob) engine=MyISAM;
-insert into t1 values (5,5),(6,6);
-insert into t2 values (2,2),(3,3);
-insert into t3 values (1,1),(3,3);
-
---sorted_result
-(select a,b from t1) union (select c,d from t2) intersect (select e,f from t3) union (select 4,4);
-explain extended
-(select a,b from t1) union (select c,d from t2) intersect (select e,f from t3) union (select 4,4);
-
-# test result of linear mix operation
---sorted_result
-(select e,f from t3) intersect (select c,d from t2) union (select a,b from t1) union (select 4,4);
-explain extended
-(select e,f from t3) intersect (select c,d from t2) union (select a,b from t1) union (select 4,4);
-
---sorted_result
-(/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`) union /* select#3 */ select `__3`.`c` AS `c`,`__3`.`d` AS `d` from ((/* select#2 */ select `test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2`) intersect (/* select#4 */ select `test`.`t3`.`e` AS `e`,`test`.`t3`.`f` AS `f` from `test`.`t3`)) `__3` union (/* select#5 */ select 4 AS `4`,4 AS `4`);
-
---sorted_result
-prepare stmt from "(select a,b from t1) union (select c,d from t2) intersect (select e,f from t3) union (select 4,4)";
-execute stmt;
-execute stmt;
-
-create view v1 as (select a,b from t1) union (select c,d from t2) intersect (select e,f from t3) union (select 4,4);
-
---sorted_result
-select b,a,b+1 from v1;
---sorted_result
-select b,a,b+1 from v1 where a > 3;
-
-create procedure p1()
- select * from v1;
---sorted_result
-call p1();
---sorted_result
-call p1();
-drop procedure p1;
-
-create procedure p1()
- (select a,b from t1) union (select c,d from t2) intersect (select e,f from t3) union (select 4,4);
---sorted_result
-call p1();
---sorted_result
-call p1();
-drop procedure p1;
-
-show create view v1;
-
-drop view v1;
-drop tables t1,t2,t3;
-
---echo #
---echo # MDEV-14346:incorrect result of intersect with ANY/ALL/IN subquery
---echo #
-CREATE TABLE t (i INT);
-INSERT INTO t VALUES (1),(2);
-SELECT * FROM t WHERE i != ANY ( SELECT 6 INTERSECT SELECT 3 );
-
-select i from t where
- exists ((select 6 as r from dual having t.i <> 6)
- intersect
- (select 3 from dual having t.i <> 3));
-
-drop table t;
-
-
---echo #
---echo # MDEV-13749: Server crashes in _ma_unique_hash /
---echo # JOIN_CACHE::generate_full_extensions on INTERSECT
---echo #
-
-CREATE TABLE t1 (a varchar(32)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES
-('Jakarta'),('Lisbon'),('Honolulu'),('Lusaka'),('Barcelona'),('Taipei'),
-('Brussels'),('Orlando'),('Osaka'),('Quito'),('Lima'),('Tunis'),
-('Unalaska'),('Rotterdam'),('Zagreb'),('Ufa'),('Ryazan'),('Xiamen'),
-('London'),('Izmir'),('Samara'),('Bern'),('Zhengzhou'),('Vladivostok'),
-('Yangon'),('Victoria'),('Warsaw'),('Luanda'),('Leon'),('Bangkok'),
-('Wellington'),('Zibo'),('Qiqihar'),('Delhi'),('Hamburg'),('Ottawa'),
-('Vaduz');
-
-CREATE TABLE t2 (b varchar(32)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES
-('Gaza'),('Jeddah'),('Beirut'),('Incheon'),('Tbilisi'),('Izmir'),
-('Quito'),('Riga'),('Freetown'),('Zagreb'),('Caracas'),('Orlando'),
-('Kingston'),('Turin'),('Xinyang'),('Osaka'),('Albany'),('Geneva'),
-('Omsk'),('Kazan'),('Quezon'),('Indore'),('Odessa'),('Xiamen'),
-('Winnipeg'),('Yakutsk'),('Nairobi'),('Ufa'),('Helsinki'),('Vilnius'),
-('Aden'),('Liverpool'),('Honolulu'),('Frankfurt'),('Glasgow'),
-('Vienna'),('Jackson'),('Jakarta'),('Sydney'),('Oslo'),('Novgorod'),
-('Norilsk'),('Izhevsk'),('Istanbul'),('Nice');
-
-CREATE TABLE t3 (c varchar(32)) ENGINE=MyISAM;
-INSERT INTO t3 VALUES
-('Nicosia'),('Istanbul'),('Richmond'),('Stockholm'),('Dublin'),
-('Wichita'),('Warsaw'),('Glasgow'),('Winnipeg'),('Irkutsk'),('Quito'),
-('Xiamen'),('Berlin'),('Rome'),('Denver'),('Dallas'),('Kabul'),
-('Prague'),('Izhevsk'),('Tirana'),('Sofia'),('Detroit'),('Sorbonne');
-
-select count(*) from (
- SELECT * FROM t1 LEFT OUTER JOIN t2 LEFT OUTER JOIN t3 ON b < c ON a > b
- INTERSECT
- SELECT * FROM t1 LEFT OUTER JOIN t2 LEFT OUTER JOIN t3 ON b < c ON a > b
-) a;
-
-drop table t1,t2,t3;
-
-CREATE TABLE t1 (a varchar(32) not null) ENGINE=MyISAM;
-INSERT INTO t1 VALUES
-('Jakarta'),('Lisbon'),('Honolulu'),('Lusaka'),('Barcelona'),('Taipei'),
-('Brussels'),('Orlando'),('Osaka'),('Quito'),('Lima'),('Tunis'),
-('Unalaska'),('Rotterdam'),('Zagreb'),('Ufa'),('Ryazan'),('Xiamen'),
-('London'),('Izmir'),('Samara'),('Bern'),('Zhengzhou'),('Vladivostok'),
-('Yangon'),('Victoria'),('Warsaw'),('Luanda'),('Leon'),('Bangkok'),
-('Wellington'),('Zibo'),('Qiqihar'),('Delhi'),('Hamburg'),('Ottawa'),
-('Vaduz');
-
-CREATE TABLE t2 (b varchar(32) not null) ENGINE=MyISAM;
-INSERT INTO t2 VALUES
-('Gaza'),('Jeddah'),('Beirut'),('Incheon'),('Tbilisi'),('Izmir'),
-('Quito'),('Riga'),('Freetown'),('Zagreb'),('Caracas'),('Orlando'),
-('Kingston'),('Turin'),('Xinyang'),('Osaka'),('Albany'),('Geneva'),
-('Omsk'),('Kazan'),('Quezon'),('Indore'),('Odessa'),('Xiamen'),
-('Winnipeg'),('Yakutsk'),('Nairobi'),('Ufa'),('Helsinki'),('Vilnius'),
-('Aden'),('Liverpool'),('Honolulu'),('Frankfurt'),('Glasgow'),
-('Vienna'),('Jackson'),('Jakarta'),('Sydney'),('Oslo'),('Novgorod'),
-('Norilsk'),('Izhevsk'),('Istanbul'),('Nice');
-
-CREATE TABLE t3 (c varchar(32) not null) ENGINE=MyISAM;
-INSERT INTO t3 VALUES
-('Nicosia'),('Istanbul'),('Richmond'),('Stockholm'),('Dublin'),
-('Wichita'),('Warsaw'),('Glasgow'),('Winnipeg'),('Irkutsk'),('Quito'),
-('Xiamen'),('Berlin'),('Rome'),('Denver'),('Dallas'),('Kabul'),
-('Prague'),('Izhevsk'),('Tirana'),('Sofia'),('Detroit'),('Sorbonne');
-
-select count(*) from (
- SELECT * FROM t1 LEFT OUTER JOIN t2 LEFT OUTER JOIN t3 ON b < c ON a > b
- INTERSECT
- SELECT * FROM t1 LEFT OUTER JOIN t2 LEFT OUTER JOIN t3 ON b < c ON a > b
-) a;
-
-drop table t1,t2,t3;
-
---echo # End of 10.3 tests
diff --git a/mysql-test/t/invisible_binlog.test b/mysql-test/t/invisible_binlog.test
deleted file mode 100644
index 654afcc39c3..00000000000
--- a/mysql-test/t/invisible_binlog.test
+++ /dev/null
@@ -1,32 +0,0 @@
---source include/master-slave.inc
-
---connection master
-create table t1(a int , b int invisible);
-insert into t1 values(1);
-insert into t1(a,b) values(2,2);
-select a,b from t1;
-desc t1;
-
-create table t2(a int , b int invisible default 5);
-insert into t2 values(1);
-insert into t2(a,b) values(2,2);
-select a,b from t2;
-desc t2;
-
-
---sync_slave_with_master
-select * from t1;
-select a,b from t1;
-desc t1;
-show create table t1;
-
-select * from t2;
-select a,b from t2;
-desc t2;
-show create table t2;
-
-
---connection master
-drop table t1,t2;
-
---source include/rpl_end.inc
diff --git a/mysql-test/t/invisible_field.test b/mysql-test/t/invisible_field.test
deleted file mode 100644
index 884abb1238d..00000000000
--- a/mysql-test/t/invisible_field.test
+++ /dev/null
@@ -1,240 +0,0 @@
-FLUSH STATUS;
-create table t1(abc int primary key, xyz int invisible);
-SHOW STATUS LIKE 'Feature_invisible_columns';
-desc t1;
-show create table t1;
-select TABLE_CATALOG,TABLE_SCHEMA,TABLE_NAME,COLUMN_NAME,EXTRA from INFORMATION_SCHEMA.COLUMNS where TABLE_SCHEMA='test' and TABLE_NAME='t1';
-drop table t1;
---error ER_TABLE_MUST_HAVE_COLUMNS
-create table t1(a1 int invisible);
---error ER_PARSE_ERROR
-create table t1(a1 blob,invisible(a1));
---error ER_INVISIBLE_NOT_NULL_WITHOUT_DEFAULT
-create table t1(a1 int primary key invisible ,a2 int unique invisible , a3 blob,a4 int not null invisible unique);
---error ER_TABLE_MUST_HAVE_COLUMNS
-create table t1(abc int not null invisible);
---echo MDEV-14849 CREATE + ALTER with user-invisible columns produce invalid table definition
-create or replace table t1 (pk int auto_increment primary key invisible, i int);
---error ER_INVISIBLE_NOT_NULL_WITHOUT_DEFAULT
-alter table t1 modify pk int invisible;
-drop table t1;
-create table t1(a int invisible, b int);
-#should automatically add null
-insert into t1 values(1);
-insert into t1(a) values(2);
-insert into t1(b) values(3);
-insert into t1(a,b) values(5,5);
-select * from t1;
-select a,b from t1;
-delete from t1;
-insert into t1 values(1),(2),(3),(4);
-select * from t1;
-select a from t1;
-drop table t1;
-
---echo #more complex case of invisible
-create table t1(a int , b int invisible , c int invisible auto_increment unique, d blob , e int unique, f int);
-desc t1;
-insert into t1 values(1,'d blob',1,1),(1,'d blob',11,1),(1,'d blob',2,1),(1,'d blob',3,1),(1,'d blob',41,1);
-select * from t1;
-select a,b,c,d,e,f from t1;
-drop table t1;
-
---echo #more complex case of invisible with sql_mode=NO_AUTO_VALUE_ON_ZERO
-set sql_mode='NO_AUTO_VALUE_ON_ZERO';
-create table t1(a int , b int invisible , c int invisible auto_increment unique, d blob , e int unique, f int);
-desc t1;
-insert into t1 values(1,'d blob',1,1),(1,'d blob',11,1),(1,'d blob',2,1),(1,'d blob',3,1),(1,'d blob',41,1);
-select * from t1;
-select a,b,c,d,e,f from t1;
-drop table t1;
-set sql_mode='';
-
---error ER_PARSE_ERROR
-create table sdsdsd(a int , b int, invisible(a,b));
-create table t1(a int,abc int as (a mod 3) virtual invisible);
-desc t1;
---error ER_WRONG_VALUE_COUNT_ON_ROW
-insert into t1 values(1,default);
-insert into t1 values(1),(22),(233);
-select * from t1;
-select a,abc from t1;
-drop table t1;
-create table t1(abc int primary key invisible auto_increment, a int);
-desc t1;
-show create table t1;
-insert into t1 values(1);
-insert into t1 values(2);
-insert into t1 values(3);
-select * from t1;
-select abc,a from t1;
-delete from t1;
-insert into t1 values(1),(2),(3),(4),(6);
-select abc,a from t1;
-drop table t1;
-create table t1(abc int);
---error ER_TABLE_MUST_HAVE_COLUMNS
-alter table t1 change abc ss int invisible;
-alter table t1 add column xyz int;
-alter table t1 modify column abc int ;
-desc t1;
---error ER_WRONG_VALUE_COUNT_ON_ROW
-insert into t1 values(22);
-alter table t1 modify column abc int invisible;
-desc t1;
-insert into t1 values(12);
-drop table t1;
---echo #some test on copy table structure with table data;
---echo #table with invisible fields and unique keys;
-create table t1(a int , b int invisible , c int invisible auto_increment unique, d blob , e int unique, f int);
-desc t1;
-insert into t1 values(1,'d blob',1,1),(1,'d blob',11,1),(1,'d blob',2,1),(1,'d blob',3,1),(1,'d blob',41,1);
-select * from t1;
-select a,b,c,d,e,f from t1;
---echo #this won't copy invisible fields and keys;
-create table t2 as select * from t1;
-desc t2;
-select * from t2;
---error ER_BAD_FIELD_ERROR
-select a,b,c,d,e,f from t2;
-drop table t2;
---echo #now this will copy invisible fields
-create table t2 as select a,b,c,d,e,f from t1;
-desc t2;
-select * from t2;
-select a,b,c,d,e,f from t2;
-drop table t2,t1;
---echo #some test related to copy of data from one table to another;
-create table t1(a int , b int invisible , c int invisible auto_increment unique, d blob , e int unique, f int);
-insert into t1 values(1,'d blob',1,1),(1,'d blob',11,1),(1,'d blob',2,1),(1,'d blob',3,1),(1,'d blob',41,1);
-select a,b,c,d,e,f from t1;
-create table t2(a int , b int invisible , c int invisible , d blob , e int unique, f int);
-insert into t2 select * from t1;
-select a,b,c,d,e,f from t2;
-truncate t2;
-insert into t2 (a,b,c,d,e,f) select a,b,c,d,e,f from t1;
-select a,b,c,d,e,f from t2;
-truncate t2;
-drop table t1,t2;
---echo #some test related to creating view on table with invisible column;
-create table t1(a int , b int invisible , c int invisible auto_increment unique, d blob , e int unique, f int);
-insert into t1 values(1,'d blob',1,1),(1,'d blob',11,1),(1,'d blob',2,1),(1,'d blob',3,1),(1,'d blob',41,1);
-create view v as select * from t1;
-desc v;
-select * from v;
---echo #v does not have invisible column;
---error ER_BAD_FIELD_ERROR
-select a,b,c,d,e,f from v;
-insert into v values(1,21,32,4);
-select * from v;
---error ER_BAD_FIELD_ERROR
-insert into v(a,b,c,d,e,f) values(1,12,3,4,5,6);
-drop view v;
-create view v as select a,b,c,d,e,f from t1;
-desc v;
-select * from v;
---echo #v does have invisible column but they aren't invisible anymore.
-select a,b,c,d,e,f from v;
-insert into v values(1,26,33,4,45,66);
-select a,b,c,d,e,f from v;
-insert into v(a,b,c,d,e,f) values(1,32,31,41,5,6);
-select a,b,c,d,e,f from v;
-drop view v;
-drop table t1;
---echo #now invisible column in where and some join query
-create table t1 (a int unique , b int invisible unique, c int unique invisible);
-insert into t1(a,b,c) values(1,1,1);
-insert into t1(a,b,c) values(2,2,2);
-insert into t1(a,b,c) values(3,3,3);
-insert into t1(a,b,c) values(4,4,4);
-insert into t1(a,b,c) values(21,21,26);
-insert into t1(a,b,c) values(31,31,35);
-insert into t1(a,b,c) values(41,41,45);
-insert into t1(a,b,c) values(22,22,24);
-insert into t1(a,b,c) values(32,32,33);
-insert into t1(a,b,c) values(42,42,43);
-explain select * from t1 where b=3;
-select * from t1 where b=3;
-explain select * from t1 where c=3;
-select * from t1 where c=3;
-create table t2 as select a,b,c from t1;
-desc t2;
-explain select * from t1,t2 where t1.b = t2.c and t1.c = t2.b;
-select * from t1,t2 where t1.b = t2.c and t1.c = t2.b;
-drop table t1,t2;
---echo #Unhide invisible columns
-create table t1 (a int primary key, b int invisible, c int invisible unique);
-show create table t1;
-desc t1;
-alter table t1 modify column b int;
-desc t1;
-alter table t1 change column c d int;
-desc t1;
-drop table t1;
-SHOW STATUS LIKE 'Feature_invisible_columns';
---echo #invisible is non reserved
-create table t1(a int unique , invisible int invisible, c int );
-desc t1;
-alter table t1 change column invisible hid int invisible;
-desc t1;
-drop table t1;
-##Internal temp table
-CREATE TABLE t1 (b int);
-INSERT t1 values(1);
-INSERT t1 values(2);
-INSERT t1 values(3);
-INSERT t1 values(4);
-INSERT t1 values(5);
-CREATE TABLE t2 (a int invisible) SELECT * FROM t1;
-select * from t2 order by b;
-select a,b from t2 order by b;
-CREATE TABLE t3 (b int, a int invisible) SELECT * FROM t1;
-select * from t3 order by b;
-select a,b from t3 order by b;
---error ER_TABLE_MUST_HAVE_COLUMNS
-CREATE TABLE t4 (b int invisible) SELECT * FROM t1;
---error ER_TABLE_MUST_HAVE_COLUMNS
-CREATE TABLE t5 (a int invisible) SELECT b as a FROM t1;
-drop table t1,t2,t3;
-
-create table t1 (a int , b int invisible default 3, c int , d int invisible default 6);
-DELIMITER //;
-CREATE PROCEDURE
-insert_t1(a int, b int)
-MODIFIES SQL DATA
-insert into t1 values(a,b);
-//
-DELIMITER ;//
-call insert_t1(1,1);
-call insert_t1(2,2);
-select * from t1 order by a;
-select a,b,c,d from t1 order by a;
-DROP PROCEDURE insert_t1;
-delete from t1;
-prepare insert_1 from "insert into t1 values(@a,@c)";
-prepare insert_2 from "insert into t1(a,b,c) values(@a,@b,@c)";
-set @a=1, @c=1;
-execute insert_1;
-set @a=2,@b=2, @c=2;
-execute insert_2;
-select a,b,c,d from t1 order by a;
-drop table t1;
-#MDEV-15085 Non constant default getting Null values
-create table t1(a int default 5 invisible, b int);
-create table t2(a int default (b+11) invisible, b int);
-insert into t1 values(1);
-select a,b from t1;
-insert into t2 values(1);
-select a,b from t2;
-drop table t1,t2;
-
-#
-# natural join and using
-#
-create table t1 (a int invisible, b int, c int);
-create table t2 (a int, b int, d int);
-insert t1 (a,b,c) values (0,2,3), (10, 20, 30);
-insert t2 (a,b,d) values (1,2,4), (10, 30, 40);
-select * from t1 join t2 using (a);
-select * from t1 natural join t2;
-drop table t1, t2;
diff --git a/mysql-test/t/invisible_field_debug.test b/mysql-test/t/invisible_field_debug.test
deleted file mode 100644
index 8674620e055..00000000000
--- a/mysql-test/t/invisible_field_debug.test
+++ /dev/null
@@ -1,272 +0,0 @@
---source include/have_debug.inc
-##TEST for invisible coloumn level 2
-set @old_debug= @@debug_dbug;
-create table t_tmp(a int, b int);
-set debug_dbug= "+d,test_pseudo_invisible";
-create table t1(a int);
-set debug_dbug=@old_debug;
-insert into t1 values(1);
-desc t1;
-show create table t1;
-select a , invisible from t1;
-##field should not be resolved in fill_record
---error ER_BAD_FIELD_ERROR
-insert into t1(a, invisible) values(99,99);
---error ER_BAD_FIELD_ERROR
-insert into t1(invisible) values(99);
-insert into t_tmp select a, invisible from t1;
---error ER_WRONG_VALUE_COUNT_ON_ROW
-insert into t1 select * from t_tmp;
---error ER_BAD_FIELD_ERROR
-insert into t1(a,invisible) select * from t_tmp;
-
-select a , invisible from t1;
-insert into t1 values (5), (invisible+1);
-select a , invisible from t1;
-delete from t1 where a > 1;
-
-##Update
-update t1 set a = invisible where a=1;
-select a , invisible from t1;
-update t1 set a = (select invisible+100 from t1 limit 1) where a=(select a from t1 limit 1);
-select a , invisible from t1;
-
---error ER_BAD_FIELD_ERROR
-update t1 set invisible = 23 where a=(select a from t1 limit 1);
---error ER_BAD_FIELD_ERROR
-update t1 set invisible = 101 where a=(select a from t1 limit 1);
---error ER_BAD_FIELD_ERROR
-update t1 set invisible = (select invisible+100 from t1 limit 1) where a=(select invisible from t1 limit 1);
-select a , invisible from t1;
-##if changed then error
-set @a=12;
---error ER_BAD_FIELD_ERROR
-update t1 set invisible = (select @a from dual) where a=(select a from t1 limit 1);
-select a , invisible from t1;
---error ER_BAD_FIELD_ERROR
-update t1 set invisible = (select invisible+100 from t1 limit 1) where a=(select a from t1 limit 1);
-select a , invisible from t1;
-
-##set
-set @a=(select invisible from t1 limit 1);
-select @a from dual;
---error ER_BAD_FIELD_ERROR
-alter table t1 add constraint a check (invisible > 2);
-set debug_dbug= "+d,test_pseudo_invisible";
---error ER_BAD_FIELD_ERROR
-create table t2(a int, b int as (invisible +2) virtual);
-create table t2(a int , b int);
-insert into t2 values(2,2);
-insert into t2 select a, invisible from t1;
-set debug_dbug=@old_debug;
-select * from t1;
-select invisible ,a from t1;
-drop table t1,t2,t_tmp;
-
-##TEST for invisible coloumn level 3
-
-set debug_dbug= "+d,test_completely_invisible";
-create table t1(a int);
-set debug_dbug=@old_debug;
-
-desc t1;
-show create table t1;
-insert into t1 values(1);
-select * from t1;
-
---error ER_BAD_FIELD_ERROR
-select invisible ,a from t1;
-
-set debug_dbug= "+d,test_completely_invisible";
-select invisible ,a from t1;
-set debug_dbug=@old_debug;
-
-create table t2 (invisible int);
---error ER_BAD_FIELD_ERROR
-select * from t1 join t2 using (invisible);
---error ER_BAD_FIELD_ERROR
-select * from t2 join t1 using (invisible);
-
-insert t2 values (8),(9);
-select * from t1 natural join t2;
-select * from t2 natural join t1;
-
-drop table t1, t2;
-
-##TEST for Alter table for invisibleness level 2
-
-set debug_dbug= "+d,test_pseudo_invisible";
-create table t1(a int);
-set debug_dbug=@old_debug;
-
-desc t1;
-insert into t1 values(1);
-select * from t1;
-select invisible ,a from t1;
-
-## Alter should not be possible
-
---error ER_BAD_FIELD_ERROR
-ALTER table t1 change invisible b int;
-select * from t1;
-select invisible ,a from t1;
-
---error ER_BAD_FIELD_ERROR
-ALTER table t1 modify invisible char;
-select * from t1;
-select invisible ,a from t1;
-
---error ER_CANT_DROP_FIELD_OR_KEY
-ALTER table t1 drop invisible;
-select * from t1;
-select invisible ,a from t1;
-
---error ER_DUP_FIELDNAME
-ALTER table t1 add invisible int;
-select * from t1;
-select invisible ,a from t1;
-
-ALTER table t1 add invisible2 int default 2;
-select * from t1;
-select invisible ,a from t1;
-
---error ER_BAD_FIELD_ERROR
-create trigger trg before insert on t1 for each row set new.invisible=1;
-create trigger trg before insert on t1 for each row set @a:=new.invisible;
-
-drop table t1;
-
-##TEST for Alter table for invisibleness level 3
-
-set debug_dbug= "+d,test_completely_invisible";
-create table t1(a int);
-
-set debug_dbug=@old_debug;
---error ER_BAD_FIELD_ERROR
-create trigger trg before insert on t1 for each row set new.invisible=1;
---error ER_BAD_FIELD_ERROR
-create trigger trg before insert on t1 for each row set @a:=new.invisible;
-set debug_dbug= "+d,test_completely_invisible";
-
-desc t1;
-insert into t1 values(1);
-select * from t1;
-select invisible ,a from t1;
-
-## Alter should not be possible
-
---error ER_BAD_FIELD_ERROR
-ALTER table t1 change invisible b int;
-select * from t1;
-select invisible ,a from t1;
-
---error ER_BAD_FIELD_ERROR
-ALTER table t1 modify invisible char;
-select * from t1;
-select invisible ,a from t1;
-
---error ER_CANT_DROP_FIELD_OR_KEY
-ALTER table t1 drop invisible;
-select * from t1;
-select invisible ,a from t1;
-
-ALTER table t1 add invisible int;
-select * from t1;
-select invisible1, invisible ,a from t1;
-
-ALTER table t1 add hid int default 2;
-select * from t1;
-select invisible ,a from t1;
-
-drop table t1;
-set debug_dbug=@old_debug;
-
-## Test Index on USER_DEFINED_INVISIBLE
-
-Create table t1( a int default(99) invisible, b int);
-insert into t1 values(1);
-insert into t1 values(2);
-insert into t1 values(3);
-insert into t1 values(4);
-select * from t1 order by b;
-alter table t1 add index(a);
-alter table t1 add index(a,b);
-show index from t1;
-drop table t1;
-
-## Test Index on PSEUDO_invisible_INVISIBLE
-
-set debug_dbug= "+d,test_pseudo_invisible";
-Create table t1( a int default(99) invisible, b int);
-
---error ER_KEY_COLUMN_DOES_NOT_EXITS
-Create table t2( a int default(99) invisible, b int, unique(invisible));
-
-set debug_dbug=@old_debug;
-insert into t1 values(1);
-insert into t1 values(2);
-insert into t1 values(3);
-insert into t1 values(4);
-select * from t1 order by b;
-select invisible, a, b from t1 order by b;
---error ER_KEY_COLUMN_DOES_NOT_EXITS
-alter table t1 add index(invisible);
---error ER_KEY_COLUMN_DOES_NOT_EXITS
-alter table t1 add index(b,invisible);
-show index from t1;
-drop table t1;
-
-## Test Index on COMPLETELY_INVISIBLE
-
-set debug_dbug= "+d,test_completely_invisible";
-Create table t1( a int default(99) invisible, b int);
-
---error ER_KEY_COLUMN_DOES_NOT_EXITS
-Create table t2( a int default(99) invisible, b int, unique(invisible));
-insert into t1 values(1);
-insert into t1 values(2);
-insert into t1 values(3);
-insert into t1 values(4);
-select * from t1 order by b;
-select invisible, a, b from t1 order by b;
-set debug_dbug=@old_debug;
-
---error ER_KEY_COLUMN_DOES_NOT_EXITS
-alter table t1 add index(invisible);
---error ER_KEY_COLUMN_DOES_NOT_EXITS
-alter table t1 add index(b,invisible);
-show index from t1;
-drop table t1;
-## Sytem Generated index on invisible column
-set debug_dbug= "+d,test_completely_invisible,test_invisible_index";
-## index name will be invisible
-Create table t1( a int default(99) , b int,c int, index(b));
-set debug_dbug=@old_debug;
-Show index from t1;
-select * from INFORMATION_SCHEMA.STATISTICS where TABLE_SCHEMA ='test' and table_name='t1';
-show create table t1;
-insert into t1 values(1,1,1);
-insert into t1 values(2,2,2);
-insert into t1 values(3,3,3);
-insert into t1 values(4,4,4);
-set debug_dbug= "+d,test_completely_invisible,test_invisible_index";
-select invisible, a ,b from t1 order by b;
-explain select * from t1 where invisible =9;
-alter table t1 add x int default 3;
-select invisible, a ,b from t1;
-set debug_dbug=@old_debug;
-Show index from t1;
-## Sytem Generated Index modification
---error ER_KEY_COLUMN_DOES_NOT_EXITS
-create index a1 on t1(invisible);
-set debug_dbug= "+d,test_completely_invisible,test_invisible_index";
-## index does not exist for user
---error ER_CANT_DROP_FIELD_OR_KEY
-drop index invisible on t1;
-explain select * from t1 where invisible =9;
-## index name will be changed
-create index invisible on t1(c);
-explain select * from t1 where invisible =9;
-show indexes in t1;
-drop table t1;
-set @old_debug= @@debug_dbug;
diff --git a/mysql-test/t/ipv4_and_ipv6.opt b/mysql-test/t/ipv4_and_ipv6.opt
deleted file mode 100644
index a22a7b100c8..00000000000
--- a/mysql-test/t/ipv4_and_ipv6.opt
+++ /dev/null
@@ -1 +0,0 @@
---skip-name-resolve --bind-address=*
diff --git a/mysql-test/t/ipv4_and_ipv6.test b/mysql-test/t/ipv4_and_ipv6.test
deleted file mode 100644
index 19ab4a253cc..00000000000
--- a/mysql-test/t/ipv4_and_ipv6.test
+++ /dev/null
@@ -1,13 +0,0 @@
---source include/check_ipv6.inc
---source include/not_embedded.inc
-
-echo =============Test of '::1' ========================================;
-let $IPv6= ::1;
---source include/ipv6_clients.inc
---source include/ipv6.inc
-
-echo =============Test of '127.0.0.1' (IPv4) ===========================;
-let $IPv6= 127.0.0.1;
---source include/ipv6_clients.inc
---source include/ipv6.inc
-
diff --git a/mysql-test/t/ipv4_as_ipv6-master.opt b/mysql-test/t/ipv4_as_ipv6-master.opt
deleted file mode 100644
index f55a8e9209d..00000000000
--- a/mysql-test/t/ipv4_as_ipv6-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---skip-name-resolve --bind-address=0.0.0.0
diff --git a/mysql-test/t/ipv4_as_ipv6.test b/mysql-test/t/ipv4_as_ipv6.test
deleted file mode 100644
index 2a3ab6647ff..00000000000
--- a/mysql-test/t/ipv4_as_ipv6.test
+++ /dev/null
@@ -1,60 +0,0 @@
-# Test of ipv4 (127.0.0.1) in ipv6 format
-# Options: --skip-name-resolve, --bind-address=0.0.0.0 (see corresponding opt file).
-#
---source include/have_ipv4_mapped.inc
-# Can't be tested with embedded server
---source include/not_embedded.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-echo =============Test of '127.0.0.1' (IPv4) ===========================;
-let $IPv6= 127.0.0.1;
---source include/ipv6_clients.inc
---source include/ipv6.inc
-
-echo =============Test of '0:0:0:0:0:FFFF:127.0.0.1' ===================;
-let $IPv6= 0:0:0:0:0:FFFF:127.0.0.1;
---source include/ipv6_clients.inc
---source include/ipv6.inc
-
-echo =============Test of '0000:0000:0000:0000:0000:FFFF:127.0.0.1' ====;
-let $IPv6= 0000:0000:0000:0000:0000:FFFF:127.0.0.1;
---source include/ipv6_clients.inc
---source include/ipv6.inc
-
-echo =============Test of '0:0000:0000:0:0000:FFFF:127.0.0.1' ====;
-let $IPv6= 0:0000:0000:0:0000:FFFF:127.0.0.1;
---source include/ipv6_clients.inc
---source include/ipv6.inc
-
-echo =============Test of '0::0000:FFFF:127.0.0.1' ====;
-let $IPv6= 0::0000:FFFF:127.0.0.1;
---source include/ipv6_clients.inc
---source include/ipv6.inc
-
-echo =============Test of '0:0:0:0:0:FFFF:127.0.0.1/96' ================;
-let $IPv6= 0:0:0:0:0:FFFF:127.0.0.1/96;
-#--source include/ipv6_clients.inc
-#--source include/ipv6.inc
-
-echo =============Test of '::FFFF:127.0.0.1' ===========================;
-let $IPv6= ::FFFF:127.0.0.1;
---source include/ipv6_clients.inc
---source include/ipv6.inc
-
-echo =============Test of '::FFFF:127.0.0.1/96' ========================;
-let $IPv6= ::FFFF:127.0.0.1/96;
-#--source include/ipv6_clients.inc
-#--source include/ipv6.inc
-
-echo =============Test of '::1' ========================;
-let $IPv6= ::1;
---echo connect (con1, $IPv6, root, , test, MASTER_MYPORT,);
---disable_query_log
---error 2002,2006
-connect (con1, $IPv6, root, , test, $MASTER_MYPORT,);
---enable_query_log
-
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/ipv6-master.opt b/mysql-test/t/ipv6-master.opt
deleted file mode 100644
index d705811808c..00000000000
--- a/mysql-test/t/ipv6-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---skip-name-resolve --bind-address=::
diff --git a/mysql-test/t/ipv6.test b/mysql-test/t/ipv6.test
deleted file mode 100644
index 24ab09b7083..00000000000
--- a/mysql-test/t/ipv6.test
+++ /dev/null
@@ -1,32 +0,0 @@
-# Test of ipv6 format
-# Options: --skip-name-resolve, --bind-address=:: (see corresponding opt file).
-#
---source include/check_ipv6.inc
-# Can't be tested with embedded server
---source include/not_embedded.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-echo =============Test of '::1' ========================================;
-let $IPv6= ::1;
---source include/ipv6_clients.inc
---source include/ipv6.inc
-
-echo =============Test of '::1/128' ====================================;
-let $IPv6= ::1/128;
-#--source include/ipv6_clients.inc
-#--source include/ipv6.inc
-
-echo =============Test of '0000:0000:0000:0000:0000:0000:0000:0001' ====;
-let $IPv6= 0000:0000:0000:0000:0000:0000:0000:0001;
---source include/ipv6_clients.inc
---source include/ipv6.inc
-
-echo =============Test of '0:0:0:0:0:0:0:1' ============================;
-let $IPv6= 0:0:0:0:0:0:0:1;
---source include/ipv6_clients.inc
---source include/ipv6.inc
-
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test
deleted file mode 100644
index e07a3665920..00000000000
--- a/mysql-test/t/join.test
+++ /dev/null
@@ -1,1202 +0,0 @@
-#
-# Initialization
---disable_warnings
-drop table if exists t1,t2,t3;
-drop view if exists v1,v2;
---enable_warnings
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='outer_join_with_cache=off';
-
-#
-# Test different join syntaxes
-#
-
-CREATE TABLE t1 (S1 INT);
-CREATE TABLE t2 (S1 INT);
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (2);
-SELECT * FROM t1 JOIN t2;
-SELECT * FROM t1 INNER JOIN t2;
-SELECT * from t1 JOIN t2 USING (S1);
-SELECT * FROM t1 INNER JOIN t2 USING (S1);
-SELECT * from t1 CROSS JOIN t2;
-SELECT * from t1 LEFT JOIN t2 USING(S1);
-SELECT * from t1 LEFT JOIN t2 ON(t2.S1=2);
-SELECT * from t1 RIGHT JOIN t2 USING(S1);
-SELECT * from t1 RIGHT JOIN t2 ON(t1.S1=1);
-drop table t1,t2;
-
-#
-# This failed for lia Perminov
-#
-
-create table t1 (id int primary key);
-create table t2 (id int);
-insert into t1 values (75);
-insert into t1 values (79);
-insert into t1 values (78);
-insert into t1 values (77);
-replace into t1 values (76);
-replace into t1 values (76);
-insert into t1 values (104);
-insert into t1 values (103);
-insert into t1 values (102);
-insert into t1 values (101);
-insert into t1 values (105);
-insert into t1 values (106);
-insert into t1 values (107);
-
-insert into t2 values (107),(75),(1000);
-
-select t1.id, t2.id from t1, t2 where t2.id = t1.id;
-select t1.id, count(t2.id) from t1,t2 where t2.id = t1.id group by t1.id;
-select t1.id, count(t2.id) from t1,t2 where t2.id = t1.id group by t2.id;
-
-#
-# Test problems with impossible ON or WHERE
-#
-select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0 where t2.id=75 and t1.id is null;
-explain select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0 where t2.id=75 and t1.id is null;
-explain select t1.id, t2.id from t1, t2 where t2.id = t1.id and t1.id <0 and t1.id > 0;
-drop table t1,t2;
-
-#
-# problem with join
-#
-
-CREATE TABLE t1 (
- id int(11) NOT NULL auto_increment,
- token varchar(100) DEFAULT '' NOT NULL,
- count int(11) DEFAULT '0' NOT NULL,
- qty int(11),
- phone char(1) DEFAULT '' NOT NULL,
- timestamp datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
- PRIMARY KEY (id),
- KEY token (token(15)),
- KEY timestamp (timestamp),
- UNIQUE token_2 (token(75),count,phone)
-);
-
-INSERT INTO t1 VALUES (21,'e45703b64de71482360de8fec94c3ade',3,7800,'n','1999-12-23 17:22:21');
-INSERT INTO t1 VALUES (22,'e45703b64de71482360de8fec94c3ade',4,5000,'y','1999-12-23 17:22:21');
-INSERT INTO t1 VALUES (18,'346d1cb63c89285b2351f0ca4de40eda',3,13200,'b','1999-12-23 11:58:04');
-INSERT INTO t1 VALUES (17,'ca6ddeb689e1b48a04146b1b5b6f936a',4,15000,'b','1999-12-23 11:36:53');
-INSERT INTO t1 VALUES (16,'ca6ddeb689e1b48a04146b1b5b6f936a',3,13200,'b','1999-12-23 11:36:53');
-INSERT INTO t1 VALUES (26,'a71250b7ed780f6ef3185bfffe027983',5,1500,'b','1999-12-27 09:44:24');
-INSERT INTO t1 VALUES (24,'4d75906f3c37ecff478a1eb56637aa09',3,5400,'y','1999-12-23 17:29:12');
-INSERT INTO t1 VALUES (25,'4d75906f3c37ecff478a1eb56637aa09',4,6500,'y','1999-12-23 17:29:12');
-INSERT INTO t1 VALUES (27,'a71250b7ed780f6ef3185bfffe027983',3,6200,'b','1999-12-27 09:44:24');
-INSERT INTO t1 VALUES (28,'a71250b7ed780f6ef3185bfffe027983',3,5400,'y','1999-12-27 09:44:36');
-INSERT INTO t1 VALUES (29,'a71250b7ed780f6ef3185bfffe027983',4,17700,'b','1999-12-27 09:45:05');
-
-CREATE TABLE t2 (
- id int(11) NOT NULL auto_increment,
- category int(11) DEFAULT '0' NOT NULL,
- county int(11) DEFAULT '0' NOT NULL,
- state int(11) DEFAULT '0' NOT NULL,
- phones int(11) DEFAULT '0' NOT NULL,
- nophones int(11) DEFAULT '0' NOT NULL,
- PRIMARY KEY (id),
- KEY category (category,county,state)
-);
-INSERT INTO t2 VALUES (3,2,11,12,5400,7800);
-INSERT INTO t2 VALUES (4,2,25,12,6500,11200);
-INSERT INTO t2 VALUES (5,1,37,6,10000,12000);
-select a.id, b.category as catid, b.state as stateid, b.county as countyid from t1 a, t2 b ignore index (primary) where (a.token ='a71250b7ed780f6ef3185bfffe027983') and (a.count = b.id);
-select a.id, b.category as catid, b.state as stateid, b.county as
-countyid from t1 a, t2 b where (a.token =
-'a71250b7ed780f6ef3185bfffe027983') and (a.count = b.id) order by a.id;
-
-drop table t1, t2;
-
-#
-# Test of join of many tables.
-
-create table t1 (a int primary key);
-insert into t1 values(1),(2);
-select t1.a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a);
---replace_result "31 tables" "XX tables" "61 tables" "XX tables"
---error 1116
-select t1.a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a) left join t1 as t32 using (a) left join t1 as t33 using (a) left join t1 as t34 using (a) left join t1 as t35 using (a) left join t1 as t36 using (a) left join t1 as t37 using (a) left join t1 as t38 using (a) left join t1 as t39 using (a) left join t1 as t40 using (a) left join t1 as t41 using (a) left join t1 as t42 using (a) left join t1 as t43 using (a) left join t1 as t44 using (a) left join t1 as t45 using (a) left join t1 as t46 using (a) left join t1 as t47 using (a) left join t1 as t48 using (a) left join t1 as t49 using (a) left join t1 as t50 using (a) left join t1 as t51 using (a) left join t1 as t52 using (a) left join t1 as t53 using (a) left join t1 as t54 using (a) left join t1 as t55 using (a) left join t1 as t56 using (a) left join t1 as t57 using (a) left join t1 as t58 using (a) left join t1 as t59 using (a) left join t1 as t60 using (a) left join t1 as t61 using (a) left join t1 as t62 using (a) left join t1 as t63 using (a) left join t1 as t64 using (a) left join t1 as t65 using (a);
-select a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a);
---replace_result "31 tables" "XX tables" "61 tables" "XX tables"
---error 1116
-select a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a) left join t1 as t32 using (a) left join t1 as t33 using (a) left join t1 as t34 using (a) left join t1 as t35 using (a) left join t1 as t36 using (a) left join t1 as t37 using (a) left join t1 as t38 using (a) left join t1 as t39 using (a) left join t1 as t40 using (a) left join t1 as t41 using (a) left join t1 as t42 using (a) left join t1 as t43 using (a) left join t1 as t44 using (a) left join t1 as t45 using (a) left join t1 as t46 using (a) left join t1 as t47 using (a) left join t1 as t48 using (a) left join t1 as t49 using (a) left join t1 as t50 using (a) left join t1 as t51 using (a) left join t1 as t52 using (a) left join t1 as t53 using (a) left join t1 as t54 using (a) left join t1 as t55 using (a) left join t1 as t56 using (a) left join t1 as t57 using (a) left join t1 as t58 using (a) left join t1 as t59 using (a) left join t1 as t60 using (a) left join t1 as t61 using (a) left join t1 as t62 using (a) left join t1 as t63 using (a) left join t1 as t64 using (a) left join t1 as t65 using (a);
-drop table t1;
-
-#
-# Simple join test. This failed in 3.23.42, there should have been
-# no matches, still three matches were found.
-#
-
-CREATE TABLE t1 (
- a int(11) NOT NULL,
- b int(11) NOT NULL,
- PRIMARY KEY (a,b)
-) ENGINE=MyISAM;
-
-INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(2,3);
-
-CREATE TABLE t2 (
- a int(11) default NULL
-) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (2),(3);
-SELECT t1.a,t2.a,b FROM t1,t2 WHERE t1.a=t2.a AND (t1.a=1 OR t1.a=2) AND b>=1 AND b<=3;
-DROP TABLE t1, t2;
-
-#
-# TEST LEFT JOIN with DATE columns
-#
-
-CREATE TABLE t1 (d DATE NOT NULL);
-CREATE TABLE t2 (d DATE NOT NULL);
-INSERT INTO t1 (d) VALUES ('2001-08-01'),('0000-00-00');
-SELECT * FROM t1 LEFT JOIN t2 USING (d) WHERE t2.d IS NULL;
-SELECT * FROM t1 LEFT JOIN t2 USING (d) WHERE d IS NULL;
-SELECT * from t1 WHERE t1.d IS NULL;
-SELECT * FROM t1 WHERE 1/0 IS NULL;
-DROP TABLE t1,t2;
-
-#
-# Problem with reference from const tables
-#
-CREATE TABLE t1 (
- Document_ID varchar(50) NOT NULL default '',
- Contractor_ID varchar(6) NOT NULL default '',
- Language_ID char(3) NOT NULL default '',
- Expiration_Date datetime default NULL,
- Publishing_Date datetime default NULL,
- Title text,
- Column_ID varchar(50) NOT NULL default '',
- PRIMARY KEY (Language_ID,Document_ID,Contractor_ID)
-);
-
-INSERT INTO t1 VALUES ('xep80','1','ger','2001-12-31 20:00:00','2001-11-12 10:58:00','Kartenbestellung - jetzt auch online','anle'),('','999998','',NULL,NULL,NULL,'');
-
-CREATE TABLE t2 (
- Contractor_ID char(6) NOT NULL default '',
- Language_ID char(3) NOT NULL default '',
- Document_ID char(50) NOT NULL default '',
- CanRead char(1) default NULL,
- Customer_ID int(11) NOT NULL default '0',
- PRIMARY KEY (Contractor_ID,Language_ID,Document_ID,Customer_ID)
-);
-
-INSERT INTO t2 VALUES ('5','ger','xep80','1',999999),('1','ger','xep80','1',999999);
-CREATE TABLE t3 (
- Language_ID char(3) NOT NULL default '',
- Column_ID char(50) NOT NULL default '',
- Contractor_ID char(6) NOT NULL default '',
- CanRead char(1) default NULL,
- Active char(1) default NULL,
- PRIMARY KEY (Language_ID,Column_ID,Contractor_ID)
-);
-INSERT INTO t3 VALUES ('ger','home','1','1','1'),('ger','Test','1','0','0'),('ger','derclu','1','0','0'),('ger','clubne','1','0','0'),('ger','philos','1','0','0'),('ger','clubko','1','0','0'),('ger','clubim','1','1','1'),('ger','progra','1','0','0'),('ger','progvo','1','0','0'),('ger','progsp','1','0','0'),('ger','progau','1','0','0'),('ger','progku','1','0','0'),('ger','progss','1','0','0'),('ger','nachl','1','0','0'),('ger','mitgli','1','0','0'),('ger','mitsu','1','0','0'),('ger','mitbus','1','0','0'),('ger','ergmar','1','1','1'),('ger','home','4','1','1'),('ger','derclu','4','1','1'),('ger','clubne','4','0','0'),('ger','philos','4','1','1'),('ger','clubko','4','1','1'),('ger','clubim','4','1','1'),('ger','progra','4','1','1'),('ger','progvo','4','1','1'),('ger','progsp','4','1','1'),('ger','progau','4','0','0'),('ger','progku','4','1','1'),('ger','progss','4','1','1'),('ger','nachl','4','1','1'),('ger','mitgli','4','0','0'),('ger','mitsu','4','0','0'),('ger','mitbus','4','0','0'),('ger','ergmar','4','1','1'),('ger','progra2','1','0','0'),('ger','archiv','4','1','1'),('ger','anmeld','4','1','1'),('ger','thema','4','1','1'),('ger','edito','4','1','1'),('ger','madis','4','1','1'),('ger','enma','4','1','1'),('ger','madis','1','1','1'),('ger','enma','1','1','1'),('ger','vorsch','4','0','0'),('ger','veranst','4','0','0'),('ger','anle','4','1','1'),('ger','redak','4','1','1'),('ger','nele','4','1','1'),('ger','aukt','4','1','1'),('ger','callcenter','4','1','1'),('ger','anle','1','0','0');
-delete from t1 where Contractor_ID='999998';
-insert into t1 (Contractor_ID) Values ('999998');
-SELECT DISTINCT COUNT(t1.Title) FROM t1,
-t2, t3 WHERE
-t1.Document_ID='xep80' AND t1.Contractor_ID='1' AND
-t1.Language_ID='ger' AND '2001-12-21 23:14:24' >=
-Publishing_Date AND '2001-12-21 23:14:24' <= Expiration_Date AND
-t1.Document_ID = t2.Document_ID AND
-t1.Language_ID = t2.Language_ID AND
-t1.Contractor_ID = t2.Contractor_ID AND (
-t2.Customer_ID = '4' OR
-t2.Customer_ID = '999999' OR
-t2.Customer_ID = '1' )AND t2.CanRead
-= '1' AND t1.Column_ID=t3.Column_ID AND
-t1.Language_ID=t3.Language_ID AND (
-t3.Contractor_ID = '4' OR
-t3.Contractor_ID = '999999' OR
-t3.Contractor_ID = '1') AND
-t3.CanRead='1' AND t3.Active='1';
-SELECT DISTINCT COUNT(t1.Title) FROM t1,
-t2, t3 WHERE
-t1.Document_ID='xep80' AND t1.Contractor_ID='1' AND
-t1.Language_ID='ger' AND '2001-12-21 23:14:24' >=
-Publishing_Date AND '2001-12-21 23:14:24' <= Expiration_Date AND
-t1.Document_ID = t2.Document_ID AND
-t1.Language_ID = t2.Language_ID AND
-t1.Contractor_ID = t2.Contractor_ID AND (
-t2.Customer_ID = '4' OR
-t2.Customer_ID = '999999' OR
-t2.Customer_ID = '1' )AND t2.CanRead
-= '1' AND t1.Column_ID=t3.Column_ID AND
-t1.Language_ID=t3.Language_ID AND (
-t3.Contractor_ID = '4' OR
-t3.Contractor_ID = '999999' OR
-t3.Contractor_ID = '1') AND
-t3.CanRead='1' AND t3.Active='1';
-drop table t1,t2,t3;
-
-#
-# Bug when doing full join and NULL fields.
-#
-
-CREATE TABLE t1 (
- t1_id int(11) default NULL,
- t2_id int(11) default NULL,
- type enum('Cost','Percent') default NULL,
- cost_unit enum('Cost','Unit') default NULL,
- min_value double default NULL,
- max_value double default NULL,
- t3_id int(11) default NULL,
- item_id int(11) default NULL
-) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (12,5,'Percent','Cost',-1,0,-1,-1),(14,4,'Percent','Cost',-1,0,-1,-1),(18,5,'Percent','Cost',-1,0,-1,-1),(19,4,'Percent','Cost',-1,0,-1,-1),(20,5,'Percent','Cost',100,-1,22,291),(21,5,'Percent','Cost',100,-1,18,291),(22,1,'Percent','Cost',100,-1,6,291),(23,1,'Percent','Cost',100,-1,21,291),(24,1,'Percent','Cost',100,-1,9,291),(25,1,'Percent','Cost',100,-1,4,291),(26,1,'Percent','Cost',100,-1,20,291),(27,4,'Percent','Cost',100,-1,7,202),(28,1,'Percent','Cost',50,-1,-1,137),(29,2,'Percent','Cost',100,-1,4,354),(30,2,'Percent','Cost',100,-1,9,137),(93,2,'Cost','Cost',-1,10000000,-1,-1);
-CREATE TABLE t2 (
- id int(10) unsigned NOT NULL auto_increment,
- name varchar(255) default NULL,
- PRIMARY KEY (id)
-) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (1,'s1'),(2,'s2'),(3,'s3'),(4,'s4'),(5,'s5');
-select t1.*, t2.* from t1, t2 where t2.id=t1.t2_id limit 2;
-drop table t1,t2;
-
-#
-# Bug in range optimiser with MAYBE_KEY
-#
-
-CREATE TABLE t1 (
- siteid varchar(25) NOT NULL default '',
- emp_id varchar(30) NOT NULL default '',
- rate_code varchar(10) default NULL,
- UNIQUE KEY site_emp (siteid,emp_id),
- KEY siteid (siteid)
-) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('rivercats','psmith','cust'), ('rivercats','KWalker','cust');
-CREATE TABLE t2 (
- siteid varchar(25) NOT NULL default '',
- rate_code varchar(10) NOT NULL default '',
- base_rate float NOT NULL default '0',
- PRIMARY KEY (siteid,rate_code),
- FULLTEXT KEY rate_code (rate_code)
-) ENGINE=MyISAM;
-INSERT INTO t2 VALUES ('rivercats','cust',20);
-SELECT emp.rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE emp.emp_id = 'psmith' AND lr.siteid = 'rivercats';
-SELECT emp.rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE lr.siteid = 'rivercats' AND emp.emp_id = 'psmith';
-SELECT rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE emp.emp_id = 'psmith' AND siteid = 'rivercats';
-SELECT rate_code, lr.base_rate FROM t1 AS emp LEFT JOIN t2 AS lr USING (siteid, rate_code) WHERE siteid = 'rivercats' AND emp.emp_id = 'psmith';
-drop table t1,t2;
-
-#
-# Problem with internal list handling when reducing WHERE
-#
-
-CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, Value1 VARCHAR(255));
-CREATE TABLE t2 (ID INTEGER NOT NULL PRIMARY KEY, Value2 VARCHAR(255));
-INSERT INTO t1 VALUES (1, 'A');
-INSERT INTO t2 VALUES (1, 'B');
-
-SELECT * FROM t1 NATURAL JOIN t2 WHERE 1 AND (Value1 = 'A' AND Value2 <> 'B');
-SELECT * FROM t1 NATURAL JOIN t2 WHERE 1 AND Value1 = 'A' AND Value2 <> 'B';
-SELECT * FROM t1 NATURAL JOIN t2 WHERE (Value1 = 'A' AND Value2 <> 'B') AND 1;
-drop table t1,t2;
-
-#
-# dummy natural join (no common columns) Bug #4807
-#
-
-CREATE TABLE t1 (a int);
-CREATE TABLE t2 (b int);
-CREATE TABLE t3 (c int);
-SELECT * FROM t1 NATURAL JOIN t2 NATURAL JOIN t3;
-DROP TABLE t1, t2, t3;
-
-#
-# Test combination of join methods
-#
-
-create table t1 (i int);
-create table t2 (i int);
-create table t3 (i int);
-insert into t1 values(1),(2);
-insert into t2 values(2),(3);
-insert into t3 values (2),(4);
-
-select * from t1 natural left join t2;
-select * from t1 left join t2 on (t1.i=t2.i);
-select * from t1 natural left join t2 natural left join t3;
-select * from t1 left join t2 on (t1.i=t2.i) left join t3 on (t2.i=t3.i);
-
-select * from t3 natural right join t2;
-select * from t3 right join t2 on (t3.i=t2.i);
-select * from t3 natural right join t2 natural right join t1;
-select * from t3 right join t2 on (t3.i=t2.i) right join t1 on (t2.i=t1.i);
-
-select * from t1,t2 natural left join t3 order by t1.i,t2.i,t3.i;
-select * from t1,t2 left join t3 on (t2.i=t3.i) order by t1.i,t2.i,t3.i;
-select t1.i,t2.i,t3.i from t2 natural left join t3,t1 order by t1.i,t2.i,t3.i;
-select t1.i,t2.i,t3.i from t2 left join t3 on (t2.i=t3.i),t1 order by t1.i,t2.i,t3.i;
-
-select * from t1,t2 natural right join t3 order by t1.i,t2.i,t3.i;
-select * from t1,t2 right join t3 on (t2.i=t3.i) order by t1.i,t2.i,t3.i;
-select t1.i,t2.i,t3.i from t2 natural right join t3,t1 order by t1.i,t2.i,t3.i;
-select t1.i,t2.i,t3.i from t2 right join t3 on (t2.i=t3.i),t1 order by t1.i,t2.i,t3.i;
-drop table t1,t2,t3;
-
-#
-# Bug #27531: Query performance degredation in 4.1.22 and greater
-#
-CREATE TABLE t1 (a int, b int default 0, c int default 1);
-
-INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8);
-INSERT INTO t1 (a) SELECT a + 8 FROM t1;
-INSERT INTO t1 (a) SELECT a + 16 FROM t1;
-
-CREATE TABLE t2 (a int, d int, e int default 0);
-
-INSERT INTO t2 (a, d) VALUES (1,1),(2,2),(3,3),(4,4);
-INSERT INTO t2 (a, d) SELECT a+4, a+4 FROM t2;
-INSERT INTO t2 (a, d) SELECT a+8, a+8 FROM t2;
-
-# should use join cache
-EXPLAIN
-SELECT STRAIGHT_JOIN t2.e FROM t1,t2 WHERE t2.d=1 AND t1.b=t2.e
- ORDER BY t1.b, t1.c;
-SELECT STRAIGHT_JOIN t2.e FROM t1,t2 WHERE t2.d=1 AND t1.b=t2.e
- ORDER BY t1.b, t1.c;
-
-DROP TABLE t1,t2;
-
-# End of 4.1 tests
-
-#
-# Tests for WL#2486 Natural/using join according to SQL:2003.
-#
-# NOTICE:
-# - The tests are designed so that all statements, except MySQL
-# extensions run on any SQL server. Please do no change.
-# - Tests marked with TODO will be submitted as bugs.
-#
-
-create table t1 (c int, b int);
-create table t2 (a int, b int);
-create table t3 (b int, c int);
-create table t4 (y int, c int);
-create table t5 (y int, z int);
-create table t6 (a int, c int);
-
-insert into t1 values (10,1);
-insert into t1 values (3 ,1);
-insert into t1 values (3 ,2);
-insert into t2 values (2, 1);
-insert into t3 values (1, 3);
-insert into t3 values (1,10);
-insert into t4 values (11,3);
-insert into t4 values (2, 3);
-insert into t5 values (11,4);
-insert into t6 values (2, 3);
-
-# Views with simple natural join.
-create algorithm=merge view v1a as
-select * from t1 natural join t2;
-# as above, but column names are cross-renamed: a->c, c->b, b->a
-create algorithm=merge view v1b(a,b,c) as
-select * from t1 natural join t2;
-# as above, but column names are aliased: a->c, c->b, b->a
-create algorithm=merge view v1c as
-select b as a, c as b, a as c from t1 natural join t2;
-# as above, but column names are cross-renamed, and aliased
-# a->c->b, c->b->a, b->a->c
-create algorithm=merge view v1d(b, a, c) as
-select a as c, c as b, b as a from t1 natural join t2;
-
-# Views with JOIN ... ON
-create algorithm=merge view v2a as
-select t1.c, t1.b, t2.a from t1 join (t2 join t4 on b + 1 = y) on t1.c = t4.c;
-create algorithm=merge view v2b as
-select t1.c as b, t1.b as a, t2.a as c
-from t1 join (t2 join t4 on b + 1 = y) on t1.c = t4.c;
-
-# Views with bigger natural join
-create algorithm=merge view v3a as
-select * from t1 natural join t2 natural join t3;
-create algorithm=merge view v3b as
-select * from t1 natural join (t2 natural join t3);
-
-# View over views with mixed natural join and join ... on
-create algorithm=merge view v4 as
-select * from v2a natural join v3a;
-
-# Nested natural/using joins.
-select * from (t1 natural join t2) natural join (t3 natural join t4);
-select * from (t1 natural join t2) natural left join (t3 natural join t4);
-select * from (t3 natural join t4) natural right join (t1 natural join t2);
-select * from (t1 natural left join t2) natural left join (t3 natural left join t4);
-select * from (t4 natural right join t3) natural right join (t2 natural right join t1);
-select * from t1 natural join t2 natural join t3 natural join t4;
-select * from ((t1 natural join t2) natural join t3) natural join t4;
-select * from t1 natural join (t2 natural join (t3 natural join t4));
-# BUG#15355: this query fails in 'prepared statements' mode
-# select * from ((t3 natural join (t1 natural join t2)) natural join t4) natural join t5;
-# select * from ((t3 natural left join (t1 natural left join t2)) natural left join t4) natural left join t5;
-select * from t5 natural right join (t4 natural right join ((t2 natural right join t1) natural right join t3));
-select * from (t1 natural join t2), (t3 natural join t4);
-# MySQL extension - nested comma ',' operator instead of cross join.
-select * from t5 natural join ((t1 natural join t2), (t3 natural join t4));
-select * from ((t1 natural join t2), (t3 natural join t4)) natural join t5;
-select * from t5 natural join ((t1 natural join t2) cross join (t3 natural join t4));
-select * from ((t1 natural join t2) cross join (t3 natural join t4)) natural join t5;
-
-select * from (t1 join t2 using (b)) join (t3 join t4 using (c)) using (c);
-select * from (t1 join t2 using (b)) natural join (t3 join t4 using (c));
-
-
-# Other clauses refer to NJ columns.
-select a,b,c from (t1 natural join t2) natural join (t3 natural join t4)
-where b + 1 = y or b + 10 = y group by b,c,a having min(b) < max(y) order by a;
-select * from (t1 natural join t2) natural left join (t3 natural join t4)
-where b + 1 = y or b + 10 = y group by b,c,a,y having min(b) < max(y) order by a, y;
-select * from (t3 natural join t4) natural right join (t1 natural join t2)
-where b + 1 = y or b + 10 = y group by b,c,a,y having min(b) < max(y) order by a, y;
-
-# Qualified column references to NJ columns.
-select * from t1 natural join t2 where t1.c > t2.a;
-select * from t1 natural join t2 where t1.b > t2.b;
-select * from t1 natural left join (t4 natural join t5) where t5.z is not NULL;
-
-# Nested 'join ... on' - name resolution of ON conditions
-select * from t1 join (t2 join t4 on b + 1 = y) on t1.c = t4.c;
-select * from (t2 join t4 on b + 1 = y) join t1 on t1.c = t4.c;
-select * from t1 natural join (t2 join t4 on b + 1 = y);
-select * from (t1 cross join t2) join (t3 cross join t4) on (a < y and t2.b < t3.c);
-
-# MySQL extension - 'join ... on' over nested comma operator
-select * from (t1, t2) join (t3, t4) on (a < y and t2.b < t3.c);
-select * from (t1 natural join t2) join (t3 natural join t4) on a = y;
-select * from ((t3 join (t1 join t2 on c > a) on t3.b < t2.a) join t4 on y > t1.c) join t5 on z = t1.b + 3;
-
-# MySQL extension - refererence qualified coalesced columns
-select * from t1 natural join t2 where t1.b > 0;
-select * from t1 natural join (t4 natural join t5) where t4.y > 7;
-select * from (t4 natural join t5) natural join t1 where t4.y > 7;
-select * from t1 natural left join (t4 natural join t5) where t4.y > 7;
-select * from (t4 natural join t5) natural right join t1 where t4.y > 7;
-select * from (t1 natural join t2) join (t3 natural join t4) on t1.b = t3.b;
-
-# MySQL extension - select qualified columns of NJ columns
-select t1.*, t2.* from t1 natural join t2;
-select t1.*, t2.*, t3.*, t4.* from (t1 natural join t2) natural join (t3 natural join t4);
-
-# Queries over subselects in the FROM clause
-select * from (select * from t1 natural join t2) as t12
- natural join
- (select * from t3 natural join t4) as t34;
-select * from (select * from t1 natural join t2) as t12
- natural left join
- (select * from t3 natural join t4) as t34;
-select * from (select * from t3 natural join t4) as t34
- natural right join
- (select * from t1 natural join t2) as t12;
-
-# Queries over views
-select * from v1a;
-select * from v1b;
-select * from v1c;
-select * from v1d;
-select * from v2a;
-select * from v2b;
-select * from v3a;
-select * from v3b;
-select * from v4;
-select * from v1a natural join v2a;
-select v2a.* from v1a natural join v2a;
-select * from v1b join v2a on v1b.b = v2a.c;
-select * from v1c join v2a on v1c.b = v2a.c;
-select * from v1d join v2a on v1d.a = v2a.c;
-select * from v1a join (t3 natural join t4) on a = y;
-
-# TODO: add tests with correlated subqueries for natural join/join on.
-# related to BUG#15269
-
-
-#--------------------------------------------------------------------
-# Negative tests (tests for errors)
-#--------------------------------------------------------------------
-# works in Oracle - bug
--- error 1052
-select * from t1 natural join (t3 cross join t4);
-# works in Oracle - bug
--- error 1052
-select * from (t3 cross join t4) natural join t1;
--- error 1052
-select * from t1 join (t2, t3) using (b);
--- error 1052
-select * from ((t1 natural join t2), (t3 natural join t4)) natural join t6;
--- error 1052
-select * from ((t1 natural join t2), (t3 natural join t4)) natural join t6;
--- error 1052
-select * from t6 natural join ((t1 natural join t2), (t3 natural join t4));
--- error 1052
-select * from (t1 join t2 on t1.b=t2.b) natural join (t3 natural join t4);
--- error 1052
-select * from (t3 natural join t4) natural join (t1 join t2 on t1.b=t2.b);
-# this one is OK, the next equivalent one is incorrect (bug in Oracle)
--- error 1052
-select * from (t3 join (t4 natural join t5) on (b < z))
- natural join
- (t1 natural join t2);
--- error 1052
-select * from (t1 natural join t2) natural join (t3 join (t4 natural join t5) on (b < z));
-
--- error 1054
-select t1.b from v1a;
--- error 1054
-select * from v1a join v1b on t1.b = t2.b;
-
-#
-# Bug #17523 natural join and information_schema
-#
-# Omit columns.PRIVILIGES as it may vary with embedded server.
-# Omit columns.ORDINAL_POSITION and statistics.CARDINALITY as it may vary with hostname='localhost'.
-select
- statistics.TABLE_NAME, statistics.COLUMN_NAME, statistics.TABLE_CATALOG, statistics.TABLE_SCHEMA, statistics.NON_UNIQUE, statistics.INDEX_SCHEMA, statistics.INDEX_NAME, statistics.SEQ_IN_INDEX, statistics.COLLATION, statistics.SUB_PART, statistics.PACKED, statistics.NULLABLE, statistics.INDEX_TYPE, statistics.COMMENT,
- columns.TABLE_CATALOG, columns.TABLE_SCHEMA, columns.COLUMN_DEFAULT, columns.IS_NULLABLE, columns.DATA_TYPE, columns.CHARACTER_MAXIMUM_LENGTH, columns.CHARACTER_OCTET_LENGTH, columns.NUMERIC_PRECISION, columns.NUMERIC_SCALE, columns.CHARACTER_SET_NAME, columns.COLLATION_NAME, columns.COLUMN_TYPE, columns.COLUMN_KEY, columns.EXTRA, columns.COLUMN_COMMENT
- from information_schema.statistics join information_schema.columns using(table_name,column_name) where table_name='user';
-
-drop table t1;
-drop table t2;
-drop table t3;
-drop table t4;
-drop table t5;
-drop table t6;
-
-drop view v1a;
-drop view v1b;
-drop view v1c;
-drop view v1d;
-drop view v2a;
-drop view v2b;
-drop view v3a;
-drop view v3b;
-drop view v4;
-
-#
-# BUG#15229 - columns of nested joins that are not natural joins incorrectly
-# materialized
-#
-create table t1 (a1 int, a2 int);
-create table t2 (a1 int, b int);
-create table t3 (c1 int, c2 int);
-create table t4 (c2 int);
-
-insert into t1 values (1,1);
-insert into t2 values (1,1);
-insert into t3 values (1,1);
-insert into t4 values (1);
-
-select * from t1 join t2 using (a1) join t3 on b=c1 join t4 using (c2);
-select * from t3 join (t1 join t2 using (a1)) on b=c1 join t4 using (c2);
-select a2 from t1 join t2 using (a1) join t3 on b=c1 join t4 using (c2);
-select a2 from t3 join (t1 join t2 using (a1)) on b=c1 join t4 using (c2);
-select a2 from ((t1 join t2 using (a1)) join t3 on b=c1) join t4 using (c2);
-select a2 from ((t1 natural join t2) join t3 on b=c1) natural join t4;
-
-drop table t1,t2,t3,t4;
-
-#
-# BUG#15355: Common natural join column not resolved in prepared statement nested query
-#
-create table t1 (c int, b int);
-create table t2 (a int, b int);
-create table t3 (b int, c int);
-create table t4 (y int, c int);
-create table t5 (y int, z int);
-
-insert into t1 values (3,2);
-insert into t2 values (1,2);
-insert into t3 values (2,3);
-insert into t4 values (1,3);
-insert into t5 values (1,4);
-
-# this fails
-prepare stmt1 from "select * from ((t3 natural join (t1 natural join t2))
-natural join t4) natural join t5";
-execute stmt1;
-
-# this works
-select * from ((t3 natural join (t1 natural join t2)) natural join t4)
- natural join t5;
-drop table t1, t2, t3, t4, t5;
-
-# End of tests for WL#2486 - natural/using join
-
-#
-# BUG#25106: A USING clause in combination with a VIEW results in column
-# aliases ignored
-#
-CREATE TABLE t1 (ID INTEGER, Name VARCHAR(50));
-CREATE TABLE t2 (Test_ID INTEGER);
-CREATE VIEW v1 (Test_ID, Description) AS SELECT ID, Name FROM t1;
-
-CREATE TABLE tv1 SELECT Description AS Name FROM v1 JOIN t2
- USING (Test_ID);
-DESCRIBE tv1;
-CREATE TABLE tv2 SELECT Description AS Name FROM v1 JOIN t2
- ON v1.Test_ID = t2.Test_ID;
-DESCRIBE tv2;
-
-DROP VIEW v1;
-DROP TABLE t1,t2,tv1,tv2;
-
-
-# BUG#27939: Early NULLs filtering doesn't work for eq_ref access
-create table t1 (a int, b int);
-insert into t1 values
- (NULL, 1),
- (NULL, 2),
- (NULL, 3),
- (NULL, 4);
-
-create table t2 (a int not null, primary key(a));
-insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t3 (a int not null, primary key(a));
-insert into t3 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-flush status;
-select * from t1, t2, t3 where t3.a=t1.a and t2.a=t1.b;
-explain select * from t1, t2, t3 where t3.a=t1.a and t2.a=t1.b;
---echo We expect rnd_next=5, and read_key must be 0 because of short-cutting:
-show status like 'Handler_read%';
-drop table t1, t2, t3;
-
-#
-# BUG#14940: Make E(#rows) from "range" access be re-used by range optimizer
-#
-create table t1 (a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t2 (a int, b int, filler char(100), key(a), key(b));
-create table t3 (a int, b int, filler char(100), key(a), key(b));
-
-insert into t2
- select @a:= A.a + 10*(B.a + 10*C.a), @a, 'filler' from t1 A, t1 B, t1 C;
-insert into t3 select * from t2 where a < 800;
-
-# The order of tables must be t2,t3:
-explain select * from t2,t3 where t2.a < 200 and t2.b=t3.b;
-
-drop table t1, t2, t3;
-
-# BUG#14940 {Wrong query plan is chosen because of odd results of
-# prev_record_reads() function }
-create table t1 (a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t2 (a int, b int, primary key(a));
-insert into t2 select @v:=A.a+10*B.a, @v from t1 A, t1 B;
-
-explain select * from t1;
-show status like '%cost%';
-select 'The cost of accessing t1 (dont care if it changes' '^';
-
-select 'vv: Following query must use ALL(t1), eq_ref(A), eq_ref(B): vv' Z;
-
-explain select * from t1, t2 A, t2 B where A.a = t1.a and B.a=A.b;
-show status like '%cost%';
-select '^^: The above should be ~= 20 + cost(select * from t1). Value less than 20 is an error' Z;
-
-
-
-drop table t1, t2;
-
-#
-# Bug #31094: Forcing index-based sort doesn't work anymore if joins are
-# done
-#
-
-CREATE TABLE t1 (a INT PRIMARY KEY, b INT);
-CREATE TABLE t2 (c INT PRIMARY KEY, d INT);
-
-INSERT INTO t1 VALUES(1,NULL),(2,NULL),(3,NULL),(4,NULL);
-INSERT INTO t1 SELECT a + 4, b FROM t1;
-INSERT INTO t1 SELECT a + 8, b FROM t1;
-INSERT INTO t1 SELECT a + 16, b FROM t1;
-INSERT INTO t1 SELECT a + 32, b FROM t1;
-INSERT INTO t1 SELECT a + 64, b FROM t1;
-INSERT INTO t2 SELECT a, b FROM t1;
-
-#expect indexed ORDER BY
-EXPLAIN SELECT * FROM t1 JOIN t2 ON b=c ORDER BY a LIMIT 2;
-EXPLAIN SELECT * FROM t1 JOIN t2 ON a=c ORDER BY a LIMIT 2;
-SELECT * FROM t1 JOIN t2 ON b=c ORDER BY a LIMIT 2;
-SELECT * FROM t1 JOIN t2 ON a=c ORDER BY a LIMIT 2;
-
-#expect filesort
-EXPLAIN SELECT * FROM t1 JOIN t2 ON b=c ORDER BY a;
-EXPLAIN SELECT * FROM t1 JOIN t2 ON a=c ORDER BY a;
-SELECT * FROM t1 JOIN t2 ON b=c ORDER BY a;
-SELECT * FROM t1 JOIN t2 ON a=c ORDER BY a;
-
-DROP TABLE IF EXISTS t1,t2;
-
-
---echo #
---echo # Bug #42116: Mysql crash on specific query
---echo #
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (a INT);
-CREATE TABLE t3 (a INT, INDEX (a));
-CREATE TABLE t4 (a INT);
-CREATE TABLE t5 (a INT);
-CREATE TABLE t6 (a INT);
-
-INSERT INTO t1 VALUES (1), (1), (1);
-
-INSERT INTO t2 VALUES
-(2), (2), (2), (2), (2), (2), (2), (2), (2), (2);
-
-INSERT INTO t3 VALUES
-(3), (3), (3), (3), (3), (3), (3), (3), (3), (3);
-
-EXPLAIN
-SELECT *
-FROM
- t1 JOIN t2 ON t1.a = t2.a
- LEFT JOIN
- (
- (
- t3 LEFT JOIN t4 ON t3.a = t4.a
- )
- LEFT JOIN
- (
- t5 LEFT JOIN t6 ON t5.a = t6.a
- )
- ON t4.a = t5.a
- )
- ON t1.a = t3.a;
-
-SELECT *
-FROM
- t1 JOIN t2 ON t1.a = t2.a
- LEFT JOIN
- (
- (
- t3 LEFT JOIN t4 ON t3.a = t4.a
- )
- LEFT JOIN
- (
- t5 LEFT JOIN t6 ON t5.a = t6.a
- )
- ON t4.a = t5.a
- )
- ON t1.a = t3.a;
-
-DROP TABLE t1,t2,t3,t4,t5,t6;
-
---echo #
---echo # Bug#48483: crash in get_best_combination()
---echo #
-
-CREATE TABLE t1(f1 INT);
-INSERT INTO t1 VALUES (1),(2);
-CREATE VIEW v1 AS SELECT 1 FROM t1 LEFT JOIN t1 AS t2 on 1=1;
-EXPLAIN EXTENDED
-SELECT 1 FROM v1 right join v1 AS v2 ON RAND();
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#52177 crash with explain, row comparison, join, text field
---echo #
-CREATE TABLE t1 (a TINYINT, b TEXT, KEY (a));
-INSERT INTO t1 VALUES (0,''),(0,'');
-FLUSH TABLES;
-EXPLAIN SELECT 1 FROM t1 LEFT JOIN t1 a ON 1
-WHERE ROW(t1.a, 1111.11) = ROW(1111.11, 1111.11) AND
-ROW(t1.b, 1111.11) <=> ROW('','');
-DROP TABLE t1;
-
---echo #
---echo # Bug #50335: Assertion `!(order->used & map)' in eq_ref_table
---echo #
-
-CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY (a,b));
-INSERT INTO t1 VALUES (0,0), (1,1);
-
-SELECT * FROM t1 STRAIGHT_JOIN t1 t2 ON t1.a=t2.a AND t1.a=t2.b ORDER BY t2.a, t1.a;
-
-DROP TABLE t1;
-
---echo End of 5.0 tests.
-
-
-#
-# Bug#47150 Assertion in Field_long::val_int() on MERGE + TRIGGER + multi-table UPDATE
-#
-CREATE TABLE t1 (f1 int);
-
-CREATE TABLE t2 (f1 int);
-INSERT INTO t2 VALUES (1);
-CREATE VIEW v1 AS SELECT * FROM t2;
-
-PREPARE stmt FROM 'UPDATE t2 AS A NATURAL JOIN v1 B SET B.f1 = 1';
-EXECUTE stmt;
-EXECUTE stmt;
-
-DEALLOCATE PREPARE stmt;
-
-DROP VIEW v1;
-DROP TABLE t1, t2;
-
-#
-# Bug#45195 valgrind warnings about uninitialized values in store_record_in_cache()
-#
-CREATE TABLE t1(a CHAR(9),b INT,KEY(b),KEY(a)) ENGINE=MYISAM;
-CREATE TABLE t2(a CHAR(9),b INT,KEY(b),KEY(a)) ENGINE=MYISAM;
-INSERT INTO t1 VALUES ('1',null),(null,null);
-INSERT INTO t2 VALUES ('1',null),(null,null);
-CREATE TABLE mm1(a CHAR(9),b INT,KEY(b),KEY(a))
-ENGINE=MERGE UNION=(t1,t2);
-SELECT t1.a FROM mm1,t1;
-DROP TABLE t1, t2, mm1;
-
-#--echo #
-#--echo # Bug #55568: user variable assignments crash server when used within
-#--echo # query
-#--echo #
-#
-#
-# This test case is invalidated because of fix of bug 55531
-# The reason is that {1} is not a valid geometric collection.
-#
-#CREATE TABLE t1 (a INT);
-
-#INSERT INTO t1 VALUES (0), (1);
-
-#let $i=2;
-#while ($i)
-#{
-# SELECT MULTIPOINT(
-# 1,
-# (
-# SELECT MULTIPOINT(
-# MULTIPOINT(
-# 1,
-# (SELECT COUNT(*) FROM (SELECT 1 FROM t1 GROUP BY a,a) d)
-# )
-# ) FROM t1
-# )
-# ) != COUNT(*) q FROM t1 GROUP BY a;
-# dec $i;
-#}
-#
-#DROP TABLE t1;
-
---echo #
---echo # Bug #54468: crash after item's print() function when ordering/grouping
---echo # by subquery
---echo #
-
-CREATE TABLE t1(a INT, b INT);
-INSERT INTO t1 VALUES (), ();
-
-SELECT 1 FROM t1
-GROUP BY
-GREATEST(t1.a,
- (SELECT 1 FROM
- (SELECT t1.b FROM t1,t1 t2
- ORDER BY t1.a, t1.a LIMIT 1) AS d)
- );
-
-DROP TABLE t1;
-
---echo #
---echo # Bug #53544: Server hangs during JOIN query in stored procedure called
---echo # twice in a row
---echo #
-
-CREATE TABLE t1(c INT);
-
-INSERT INTO t1 VALUES (1), (2);
-
-PREPARE stmt FROM "SELECT t2.c AS f1 FROM t1 LEFT JOIN
- t1 t2 ON t1.c=t2.c RIGHT JOIN
- t1 t3 ON t1.c=t3.c
- GROUP BY f1;";
-
-EXECUTE stmt;
-EXECUTE stmt;
-
-DEALLOCATE PREPARE stmt;
-DROP TABLE t1;
-
---echo #
---echo # Bug LP:798597: Incorrect "Duplicate entry" error with views and
---echo # GROUP BY
---echo #
-
-CREATE TABLE t1 ( f1 int NOT NULL , f2 int NOT NULL ) ;
-INSERT INTO t1 VALUES (214,0),(6,6);
-CREATE TABLE t2 ( f2 int) ;
-INSERT INTO t2 VALUES (88),(88);
-CREATE ALGORITHM=MERGE VIEW v1 AS SELECT t1.f1, t2.f2 FROM (t2 LEFT JOIN t1 ON (t2.f2 <> t1.f1)) WHERE (t1.f2 <= 0) ;
-CREATE ALGORITHM=MERGE VIEW v2 AS SELECT t1.f1, t2.f2 FROM (t2 LEFT JOIN t1 ON (t2.f2 <> t1.f1)) WHERE (t1.f2 <= 0 or t1.f2 is null) ;
-SELECT f1 , MIN(f2) FROM v1 GROUP BY f1;
-SELECT f1 , MIN(f2) FROM v2 GROUP BY f1;
-drop table t1,t2;
-drop view v1,v2;
-
---echo #
---echo # BUG#47217 Lost optimization caused slowdown & wrong result.
---echo #
-CREATE TABLE t1 (pk INT, v VARCHAR(2), PRIMARY KEY(pk));
-CREATE INDEX ix1 ON t1(v);
-CREATE TABLE t2 (pk INT, v VARCHAR(2), PRIMARY KEY(pk));
-CREATE INDEX ix2 ON t2(v);
-INSERT INTO t1 VALUES (1,'a'),(2,NULL);
-INSERT INTO t2 VALUES (1,NULL);
-EXPLAIN SELECT * FROM t1 JOIN t2 ON t1.v = t2.v ORDER BY 1;
-EXPLAIN SELECT * FROM t1 JOIN t2 ON t1.v = t2.v;
-INSERT INTO t1 VALUES (3,'b'),(4,NULL),(5,'c'),(6,'cc'),(7,'d'),
- (8,'dd'),(9,'e'),(10,'ee');
-INSERT INTO t2 VALUES (2,NULL);
-FLUSH STATUS;
-SELECT * FROM t1 JOIN t2 ON t1.v = t2.v WHERE t2.v IS NULL ORDER BY 1;
-SHOW STATUS LIKE 'Handler_read_%';
-DROP TABLE t1, t2;
-
---echo End of 5.1 tests
-
---echo #
---echo # Bug #43368: STRAIGHT_JOIN DOESN'T WORK FOR NESTED JOINS
---echo #
-
-create table t1(c1 int primary key, c2 char(10)) engine=myisam;
-create table t2(c1 int primary key, c2 char(10), ref_t1 int) engine=myisam;
-create table t3(c1 int primary key, c2 char(10), ref_t1 int) engine=myisam;
-create table t4(c1 int primary key, c2 char(10), ref_t1 int) engine=myisam;
-insert into t1 values(1,'a');
-insert into t2 values(1,'a', 1);
-insert into t3 values(1,'a', 1);
-insert into t3 values(2,'b',2);
-insert into t4 values(1,'a', 1);
-insert into t4 values(2,'a', 2);
-insert into t4 values(3,'a', 3);
-insert into t4 values(4,'a', 4);
-insert into t1 values(2,'b');
-insert into t1 values(3,'c');
-
-EXPLAIN
-SELECT *
-FROM t4 JOIN
- (t1 JOIN t3 ON t3.ref_t1=t1.c1 JOIN t2 ON t2.ref_t1=t1.c1)
- ON t4.ref_t1=t1.c1;
-
-EXPLAIN
-SELECT STRAIGHT_JOIN *
-FROM t4 JOIN
- (t1 JOIN t3 ON t3.ref_t1=t1.c1 JOIN t2 ON t2.ref_t1=t1.c1)
- ON t4.ref_t1=t1.c1;
-
-EXPLAIN
-SELECT *
-FROM t4 STRAIGHT_JOIN
- (t1 JOIN t3 ON t3.ref_t1=t1.c1 JOIN t2 ON t2.ref_t1=t1.c1)
- ON t4.ref_t1=t1.c1;
-
-drop table t1,t2,t3,t4;
---echo End of 5.2 tests
-
---echo #
---echo # BUG#724275: Crash in JOIN::optimize in maria-5.3
---echo #
-
-create table t1 (a int);
-insert into t1 values (1),(2);
-insert into t1 select * from t1;
-
-create table t2 (a int, b int, key(a,b));
-insert into t2 values (1,1),(1,2),(1,3),(1,4),(2,5),(2,6),(2,7),(2,8),(2,9);
-insert into t2 select * from t2;
-insert into t2 select * from t2;
-insert into t2 select * from t2;
-
-create table t3 (a int, b int, key(a));
-insert into t3 values (1,1),(2,2);
-select * from
- t3 straight_join t1 straight_join t2 force index(a)
-where t2.a=1 and t2.b=t1.a and t1.a=t3.b and t3.a=1;
-
-drop table t1,t2,t3;
-
---echo #
---echo # BUG#729067/730466: unexpected 'Range checked for each record'
---echo # for queries with OR in WHERE clause
---echo #
-
-CREATE TABLE t1 (f1 int, f2 int) ;
-INSERT INTO t1 VALUES (4,0),(5,1);
-
-CREATE TABLE t2 (f1 int, f2 int, KEY (f2)) ;
-INSERT INTO t2 VALUES (5,7), (8,9);
-
-EXPLAIN
-SELECT * FROM t1 STRAIGHT_JOIN t2 ON t2.f1 = t1.f1
- WHERE t1.f1<>0 OR t1.f2<>0 AND t1.f1 = t2.f2;
-SELECT * FROM t1 STRAIGHT_JOIN t2 ON t2.f1 = t1.f1
- WHERE t1.f1<>0 OR t1.f2<>0 AND t1.f1 = t2.f2;
-
-DROP TABLE t1,t2;
-
-CREATE TABLE t1(f1 int PRIMARY KEY, f2 int) ;
-INSERT INTO t1 VALUES (9,4), (10,9);
-
-CREATE TABLE t2(f1 int PRIMARY KEY, f2 int) ;
-INSERT INTO t2 VALUES (9,4), (10,9);
-
-EXPLAIN
-SELECT STRAIGHT_JOIN * FROM t1 JOIN t2 ON t2.f2 = t1.f1
- WHERE t1.f1 IN (SELECT f1 FROM t1) AND t1.f1 = t2.f1 OR t1.f1 = 9;
-SELECT STRAIGHT_JOIN * FROM t1 JOIN t2 ON t2.f2 = t1.f1
- WHERE t1.f1 IN (SELECT f1 FROM t1) AND t1.f1 = t2.f1 OR t1.f1 = 9;
-
-DROP TABLE t1,t2;
-
-#
-# Item_equal used cmp_item::get_comparator() incorrectly
-#
-create table t1 (i time key);
-insert into t1 values ('1:1:1'), ('2:2:2');
-create table t2 (i time);
-insert into t2 values ('1:1:1');
-select t2.i from t1 left join t2 on t2.i = t1.i where t1.i = '1:1:1';
-drop table t1,t2;
-
---echo #
---echo # BUG#954900: unexpected empty set due to an invalid build of key ref
---echo #
-
-CREATE TABLE t1 (dog_id int(10), birthday date, PRIMARY KEY (dog_id,birthday));
-INSERT INTO t1 VALUES (5918,'2004-07-22');
-
-CREATE TABLE t2 (dog_id int(10) unsigned, t_id char(1), birthday date, a_id int(10),
-PRIMARY KEY (dog_id,t_id,birthday,a_id));
-INSERT INTO t2 VALUES
-(5918,'N','2004-07-22',5216551), (5918,'N','2004-07-22',5223640),
-(5918,'N','2004-07-22',5389491), (5918,'N','2004-07-22',5749434),
-(5918,'N','2004-07-22',5992424), (5922,'N','2005-06-30',5076957),
-(5924,'N','2000-08-11',20264), (5924,'N','2000-08-11',64251),
-(5924,'N','2000-08-11',74748), (5924,'N','2000-08-11',87590),
-(5924,'N','2000-08-11',104695), (5924,'N','2000-08-11',133136),
-(5924,'N','2000-08-11',5027806), (5924,'N','2000-08-11',5076957),
-(5924,'N','2000-08-11',5166821), (5924,'N','2000-08-11',5181896),
-(5924,'N','2000-08-11',5217908), (5924,'N','2000-08-11',5220812),
-(5924,'N','2000-08-11',5226473), (5924,'N','2000-08-11',5339111),
-(5925,'N','2005-02-10',19227), (5925,'N','2005-02-10',74529),
-(5925,'N','2005-02-10',74748), (5927,'N','2005-08-18',20264),
-(5927,'N','2005-08-18',58364), (5929,'N','2005-01-19',58364),
-(5935,'N','2006-03-10',19227), (5935,'N','2006-03-10',64251),
-(5935,'N','2006-03-10',5222400), (5935,'N','2006-03-10',5226473),
-(5936,'N','2004-10-29',5015032), (5937,'N','2002-04-05',11237),
-(5937,'N','2002-04-05',23911), (5937,'N','2002-04-05',112133),
-(5937,'N','2002-04-05',169721), (5937,'N','2002-04-05',170650),
-(5937,'N','2002-04-05',5014494), (5937,'N','2002-04-05',5166009),
-(5937,'N','2002-04-05',5181871), (5937,'N','2002-04-05',5213380),
-(5937,'N','2002-04-05',5214875), (5937,'N','2002-04-05',5895062),
-(5938,'N','2006-03-24',11237), (5938,'N','2006-03-24',19227),
-(5938,'N','2006-03-24',23911), (5938,'N','2006-03-24',58364),
-(5938,'N','2006-03-24',64251), (5938,'N','2006-03-24',111716),
-(5938,'N','2006-03-24',112702), (5938,'N','2006-03-24',133136),
-(5938,'N','2006-03-24',168718), (5938,'N','2006-03-24',5137136),
-(5938,'N','2006-03-24',5161519), (5938,'N','2006-03-24',5168120),
-(5938,'N','2006-03-24',5219034), (6234,'N','2006-06-02',103058),
-(6234,'N','2006-06-02',5146844), (6235,'N','2006-06-01',12900),
-(6235,'N','2006-06-01',20264), (6235,'N','2006-06-01',64251),
-(6235,'N','2006-06-01',75160), (6235,'N','2006-06-01',5014494),
-(6235,'N','2006-06-01',5181638), (6236,'N','2006-06-06',112595),
-(6236,'N','2006-06-06',5219601), (6236,'N','2006-06-06',5808374);
-
-CREATE TABLE t3 (dog_id int(10) unsigned);
-INSERT INTO t3 VALUES (5918);
-
-CREATE TABLE t4 (dog_id int(10), t_id char(1), birthday date, KEY (t_id));
-INSERT INTO t4 VALUES (5918,'N','2004-07-22'), (5919,'N','2004-07-20');
-
-CREATE TABLE t5 (dog_id int(10) unsigned, UNIQUE KEY (dog_id));
-INSERT INTO t5 VALUES (5918);
-
-SET @tmp_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='index_condition_pushdown=off';
-
-EXPLAIN
-SELECT * FROM t5 DU, t1 D, t4 DT, t2 DSA, t3 DSAR
-WHERE DU.dog_id=D.dog_id AND D.dog_id=DT.dog_id AND D.birthday=DT.birthday AND
- DT.t_id=DSA.t_id AND DT.birthday=DSA.birthday AND DSA.dog_id=DSAR.dog_id;
-SELECT * FROM t5 DU, t1 D, t4 DT, t2 DSA, t3 DSAR
-WHERE DU.dog_id=D.dog_id AND D.dog_id=DT.dog_id AND D.birthday=DT.birthday AND
- DT.t_id=DSA.t_id AND DT.birthday=DSA.birthday AND DSA.dog_id=DSAR.dog_id;
-
-SET optimizer_switch=@tmp_optimizer_switch;
-
-DROP TABLE t1,t2,t3,t4,t5;
-
---echo #
---echo # MDEV-4752: Segfault during parsing of illegal query
---echo #
---error ER_PARSE_ERROR
-SELECT * FROM t5 JOIN (t1 JOIN t2 UNION SELECT * FROM t3 JOIN t4);
-
---echo #
---echo # MDEV-4959: join of const table with NULL fields
---echo #
-
-CREATE TABLE t1 (i1 int) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (NULL);
-CREATE TABLE t2 (i2 int, a int, b int) ENGINE=MyISAM;
-CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2;
-INSERT INTO t2 VALUES (NULL,1,2),(NULL,2,3);
-
-SELECT * FROM t1 JOIN v2 ON i1 = i2 WHERE a < b;
-EXPLAIN EXTENDED
-SELECT * FROM t1 JOIN v2 ON i1 = i2 WHERE a < b;
-
-DROP VIEW v2;
-DROP TABLE t1,t2;
-
-SET optimizer_switch=@save_optimizer_switch;
-
---echo #
---echo # Bug #35268: Parser can't handle STRAIGHT_JOIN with USING
---echo #
-
-CREATE TABLE t1 (a int);
-
-INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8);
-
-CREATE TABLE t2 (a int);
-
-INSERT INTO t2 (a) VALUES (1),(2),(3),(4);
-
-EXPLAIN
-SELECT t1.a FROM t1 NATURAL INNER JOIN t2 ORDER BY t1.a;
-SELECT t1.a FROM t1 NATURAL INNER JOIN t2 ORDER BY t1.a;
-
-EXPLAIN
-SELECT t1.a FROM t1 STRAIGHT_JOIN t2 USING(a) ORDER BY t1.a;
-SELECT t1.a FROM t1 STRAIGHT_JOIN t2 USING(a) ORDER BY t1.a;
-
-EXPLAIN
-SELECT t1.a FROM t1 NATURAL STRAIGHT_JOIN t2 ORDER BY t1.a;
-SELECT t1.a FROM t1 NATURAL STRAIGHT_JOIN t2 ORDER BY t1.a;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-5635: join of a const table with non-const tables
---echo #
-
-CREATE TABLE t1 (a varchar(3) NOT NULL) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('foo');
-
-CREATE TABLE t2 (b varchar(3), c varchar(3), INDEX(b)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES ('bar', 'bar'),( 'qux', 'qux');
-
-SELECT STRAIGHT_JOIN * FROM t1, t2 AS t2_1, t2 AS t2_2
- WHERE t2_2.c = t2_1.c AND t2_2.b = t2_1.b AND ( a IS NULL OR t2_1.c = a );
-
-DROP TABLE t1,t2;
diff --git a/mysql-test/t/join_cache.test b/mysql-test/t/join_cache.test
deleted file mode 100644
index b775725903c..00000000000
--- a/mysql-test/t/join_cache.test
+++ /dev/null
@@ -1,3962 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11;
-DROP DATABASE IF EXISTS world;
---enable_warnings
-
-set @save_optimizer_switch=@@optimizer_switch;
-set @@optimizer_switch='optimize_join_buffer_size=on';
-set optimizer_switch='semijoin=on,firstmatch=on,loosescan=on';
-set @@optimizer_switch='semijoin_with_cache=on';
-set @@optimizer_switch='outer_join_with_cache=on';
-set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
-
-set @local_join_cache_test_optimizer_switch_default=@@optimizer_switch;
-set names utf8;
-
-CREATE DATABASE world;
-
-use world;
-
---source include/world_schema1.inc
-
---disable_query_log
---disable_result_log
---disable_warnings
---source include/world.inc
---enable_warnings
---enable_result_log
---enable_query_log
-
-SELECT COUNT(*) FROM Country;
-SELECT COUNT(*) FROM City;
-SELECT COUNT(*) FROM CountryLanguage;
-
-show variables like 'join_buffer_size';
-
-set join_cache_level=1;
-
-show variables like 'join_cache_level';
-
-EXPLAIN
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-EXPLAIN
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-set join_cache_level=2;
-show variables like 'join_cache_level';
-
-EXPLAIN
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-EXPLAIN
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-set join_cache_level=3;
-show variables like 'join_cache_level';
-
-EXPLAIN
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-EXPLAIN
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-
-set join_cache_level=4;
-show variables like 'join_cache_level';
-
-EXPLAIN
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-EXPLAIN
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-
-SELECT Country.Name, Country.Population, City.Name, City.Population
- FROM Country LEFT JOIN City
- ON City.Country=Country.Code AND City.Population > 5000000
- WHERE Country.Name LIKE 'C%' AND Country.Population > 10000000;
-
-SELECT Country.Name, Country.Population, City.Name, City.Population
- FROM Country LEFT JOIN City
- ON City.Country=Country.Code AND
- (City.Population > 5000000 OR City.Name LIKE 'Za%')
- WHERE Country.Name LIKE 'C%' AND Country.Population > 10000000;
-
-CREATE INDEX City_Population ON City(Population);
-CREATE INDEX City_Name ON City(Name);
-
---disable_result_log
-ANALYZE TABLE City;
---enable_result_log
-
-EXPLAIN
-SELECT Country.Name, Country.Population, City.Name, City.Population
- FROM Country LEFT JOIN City
- ON City.Country=Country.Code AND City.Population > 5000000
- WHERE Country.Name LIKE 'C%' AND Country.Population > 10000000;
-
-SELECT Country.Name, Country.Population, City.Name, City.Population
- FROM Country LEFT JOIN City
- ON City.Country=Country.Code AND City.Population > 5000000
- WHERE Country.Name LIKE 'C%' AND Country.Population > 10000000;
-
-EXPLAIN
-SELECT Country.Name, Country.Population, City.Name, City.Population
- FROM Country LEFT JOIN City
- ON City.Country=Country.Code AND
- (City.Population > 5000000 OR City.Name LIKE 'Za%')
- WHERE Country.Name LIKE 'C%' AND Country.Population > 10000000;
-
-SELECT Country.Name, Country.Population, City.Name, City.Population
- FROM Country LEFT JOIN City
- ON City.Country=Country.Code AND
- (City.Population > 5000000 OR City.Name LIKE 'Za%')
- WHERE Country.Name LIKE 'C%' AND Country.Population > 10000000;
-
-DROP INDEX City_Population ON City;
-DROP INDEX City_Name ON City;
-
-set join_cache_level=1;
-
-set join_buffer_size=256;
-show variables like 'join_buffer_size';
-
-show variables like 'join_cache_level';
-
-EXPLAIN
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-EXPLAIN
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-set join_cache_level=2;
-show variables like 'join_cache_level';
-
-EXPLAIN
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-EXPLAIN
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-set join_cache_level=3;
-show variables like 'join_cache_level';
-
-EXPLAIN
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-EXPLAIN
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-set join_cache_level=4;
-show variables like 'join_cache_level';
-
-EXPLAIN
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-EXPLAIN
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-set join_cache_level=default;
-set join_buffer_size=default;
-
-show variables like 'join_buffer_size';
-show variables like 'join_cache_level';
-
-DROP DATABASE world;
-
-
-CREATE DATABASE world;
-
-use world;
-
---source include/world_schema.inc
-
---disable_query_log
---disable_result_log
---disable_warnings
---source include/world.inc
---enable_warnings
---enable_result_log
---enable_query_log
-
-show variables like 'join_buffer_size';
-set join_cache_level=3;
-show variables like 'join_cache_level';
-
-EXPLAIN
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-EXPLAIN
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-EXPLAIN
-SELECT Name FROM City
- WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
- City.Population > 100000;
-
-SELECT Name FROM City
- WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
- City.Population > 100000;
-
-EXPLAIN
-SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage)
- FROM Country LEFT JOIN CountryLanguage ON
- (CountryLanguage.Country=Country.Code AND Language='English')
- WHERE
- Country.Population > 10000000;
-
-SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage)
- FROM Country LEFT JOIN CountryLanguage ON
- (CountryLanguage.Country=Country.Code AND Language='English')
- WHERE
- Country.Population > 10000000;
-
-show variables like 'join_buffer_size';
-set join_cache_level=4;
-show variables like 'join_cache_level';
-
-EXPLAIN
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-EXPLAIN
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-EXPLAIN
-SELECT Name FROM City
- WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
- City.Population > 100000;
-
-SELECT Name FROM City
- WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
- City.Population > 100000;
-
-EXPLAIN
-SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage)
- FROM Country LEFT JOIN CountryLanguage ON
- (CountryLanguage.Country=Country.Code AND Language='English')
- WHERE
- Country.Population > 10000000;
-
-SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage)
- FROM Country LEFT JOIN CountryLanguage ON
- (CountryLanguage.Country=Country.Code AND Language='English')
- WHERE
- Country.Population > 10000000;
-
-
---replace_column 9 #
-EXPLAIN
-SELECT Country.Name, Country.Population, City.Name, City.Population
- FROM Country LEFT JOIN City
- ON City.Country=Country.Code AND City.Population > 5000000
- WHERE Country.Name LIKE 'C%' AND Country.Population > 10000000;
-
-SELECT Country.Name, Country.Population, City.Name, City.Population
- FROM Country LEFT JOIN City
- ON City.Country=Country.Code AND City.Population > 5000000
- WHERE Country.Name LIKE 'C%' AND Country.Population > 10000000;
-
-CREATE INDEX City_Name ON City(Name);
-
-EXPLAIN
-SELECT Country.Name, Country.Population, City.Name, City.Population
- FROM Country LEFT JOIN City
- ON City.Country=Country.Code AND
- (City.Population > 5000000 OR City.Name LIKE 'Za%')
- WHERE Country.Name LIKE 'C%' AND Country.Population > 10000000;
-
-SELECT Country.Name, Country.Population, City.Name, City.Population
- FROM Country LEFT JOIN City
- ON City.Country=Country.Code AND
- (City.Population > 5000000 OR City.Name LIKE 'Za%')
- WHERE Country.Name LIKE 'C%' AND Country.Population > 10000000;
-
-DROP INDEX City_Name ON City;
-
-show variables like 'join_buffer_size';
-set join_cache_level=5;
-show variables like 'join_cache_level';
-
-EXPLAIN
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-EXPLAIN
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-EXPLAIN
-SELECT Name FROM City
- WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
- City.Population > 100000;
-
-SELECT Name FROM City
- WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
- City.Population > 100000;
-
-EXPLAIN
-SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage)
- FROM Country LEFT JOIN CountryLanguage ON
- (CountryLanguage.Country=Country.Code AND Language='English')
- WHERE
- Country.Population > 10000000;
-
-SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage)
- FROM Country LEFT JOIN CountryLanguage ON
- (CountryLanguage.Country=Country.Code AND Language='English')
- WHERE
- Country.Population > 10000000;
-
-set join_cache_level=6;
-show variables like 'join_cache_level';
-
-EXPLAIN
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-EXPLAIN
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-EXPLAIN
-SELECT Name FROM City
- WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
- City.Population > 100000;
-
-SELECT Name FROM City
- WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
- City.Population > 100000;
-
-EXPLAIN
-SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage)
- FROM Country LEFT JOIN CountryLanguage ON
- (CountryLanguage.Country=Country.Code AND Language='English')
- WHERE
- Country.Population > 10000000;
-
-SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage)
- FROM Country LEFT JOIN CountryLanguage ON
- (CountryLanguage.Country=Country.Code AND Language='English')
- WHERE
- Country.Population > 10000000;
-
-set join_cache_level=7;
-show variables like 'join_cache_level';
-
-EXPLAIN
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-EXPLAIN
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-EXPLAIN
-SELECT Name FROM City
- WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
- City.Population > 100000;
-
-SELECT Name FROM City
- WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
- City.Population > 100000;
-
-EXPLAIN
-SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage)
- FROM Country LEFT JOIN CountryLanguage ON
- (CountryLanguage.Country=Country.Code AND Language='English')
- WHERE
- Country.Population > 10000000;
-
-SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage)
- FROM Country LEFT JOIN CountryLanguage ON
- (CountryLanguage.Country=Country.Code AND Language='English')
- WHERE
- Country.Population > 10000000;
-
-set join_cache_level=8;
-show variables like 'join_cache_level';
-
-EXPLAIN
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-EXPLAIN
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-EXPLAIN
-SELECT Name FROM City
- WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
- City.Population > 100000;
-
-SELECT Name FROM City
- WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
- City.Population > 100000;
-
-EXPLAIN
-SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage)
- FROM Country LEFT JOIN CountryLanguage ON
- (CountryLanguage.Country=Country.Code AND Language='English')
- WHERE
- Country.Population > 10000000;
-
-SELECT Country.Name, IF(ISNULL(CountryLanguage.Country), NULL, CountryLanguage.Percentage)
- FROM Country LEFT JOIN CountryLanguage ON
- (CountryLanguage.Country=Country.Code AND Language='English')
- WHERE
- Country.Population > 10000000;
-
-set join_buffer_size=256;
-show variables like 'join_buffer_size';
-
-set join_cache_level=3;
-show variables like 'join_cache_level';
-
-EXPLAIN
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-EXPLAIN
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-EXPLAIN
-SELECT Name FROM City
- WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
- City.Population > 100000;
-
-SELECT Name FROM City
- WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
- City.Population > 100000;
-
-set join_cache_level=4;
-show variables like 'join_cache_level';
-
-EXPLAIN
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-EXPLAIN
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-EXPLAIN
-SELECT Name FROM City
- WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
- City.Population > 100000;
-
-SELECT Name FROM City
- WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
- City.Population > 100000;
-
-set join_cache_level=5;
-show variables like 'join_cache_level';
-
-EXPLAIN
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-EXPLAIN
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-EXPLAIN
-SELECT Name FROM City
- WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
- City.Population > 100000;
-
-SELECT Name FROM City
- WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
- City.Population > 100000;
-
-set join_cache_level=6;
-show variables like 'join_cache_level';
-
-EXPLAIN
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-EXPLAIN
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-EXPLAIN
-SELECT Name FROM City
- WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
- City.Population > 100000;
-
-SELECT Name FROM City
- WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
- City.Population > 100000;
-
-set join_cache_level=7;
-show variables like 'join_cache_level';
-
-EXPLAIN
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-EXPLAIN
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-EXPLAIN
-SELECT Name FROM City
- WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
- City.Population > 100000;
-
-SELECT Name FROM City
- WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
- City.Population > 100000;
-
-set join_cache_level=8;
-show variables like 'join_cache_level';
-
-EXPLAIN
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-EXPLAIN
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-SELECT City.Name, Country.Name, CountryLanguage.Language
- FROM City,Country,CountryLanguage
- WHERE City.Country=Country.Code AND
- CountryLanguage.Country=Country.Code AND
- City.Name LIKE 'L%' AND Country.Population > 3000000 AND
- CountryLanguage.Percentage > 50 AND
- LENGTH(Language) < LENGTH(City.Name) - 2;
-
-EXPLAIN
-SELECT Name FROM City
- WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
- City.Population > 100000;
-
-SELECT Name FROM City
- WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND
- City.Population > 100000;
-
-set join_cache_level=default;
-set join_buffer_size=default;
-
-show variables like 'join_buffer_size';
-show variables like 'join_cache_level';
-
-set join_cache_level=1;
-
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND City.Population > 3000000;
-
-set join_cache_level=8;
-set join_buffer_size=384;
-
---replace_column 9 #
-EXPLAIN
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND City.Population > 3000000;
-
---sorted_result
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND City.Population > 3000000;
-
-set join_buffer_size=default;
-
-set join_cache_level=6;
-
-ALTER TABLE Country MODIFY Name varchar(52) NOT NULL default '';
-
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-ALTER TABLE Country MODIFY Name varchar(300) NOT NULL default '';
-
-SELECT City.Name, Country.Name FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-ALTER TABLE Country ADD COLUMN PopulationBar text;
-UPDATE Country
- SET PopulationBar=REPEAT('x', CAST(Population/100000 AS unsigned int));
-
-SELECT City.Name, Country.Name, Country.PopulationBar FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-set join_buffer_size=256;
-
-SELECT City.Name, Country.Name, Country.PopulationBar FROM City,Country
- WHERE City.Country=Country.Code AND
- Country.Name LIKE 'L%' AND City.Population > 100000;
-
-set join_cache_level=default;
-set join_buffer_size=default;
-
-DROP DATABASE world;
-
-use test;
-
-#
-# Bug #35685: assertion abort when initializing a BKA cache
-#
-
-CREATE TABLE t1(
- affiliatetometaid int NOT NULL default '0',
- uniquekey int NOT NULL default '0',
- metaid int NOT NULL default '0',
- affiliateid int NOT NULL default '0',
- xml text,
- isactive char(1) NOT NULL default 'Y',
- PRIMARY KEY (affiliatetometaid)
-);
-CREATE UNIQUE INDEX t1_uniquekey ON t1(uniquekey);
-CREATE INDEX t1_affiliateid ON t1(affiliateid);
-CREATE INDEX t1_metaid on t1 (metaid);
-INSERT INTO t1 VALUES
- (1616, 1571693233, 1391, 2, NULL, 'Y'), (1943, 1993216749, 1726, 2, NULL, 'Y');
-
-CREATE TABLE t2(
- metaid int NOT NULL default '0',
- name varchar(80) NOT NULL default '',
- dateadded timestamp NOT NULL ,
- xml text,
- status int default NULL,
- origin int default NULL,
- gid int NOT NULL default '1',
- formattypeid int default NULL,
- PRIMARY KEY (metaid)
-);
-CREATE INDEX t2_status ON t2(status);
-CREATE INDEX t2_gid ON t2(gid);
-CREATE INDEX t2_formattypeid ON t2(formattypeid);
-INSERT INTO t2 VALUES
- (1391, "I Just Died", "2003-10-02 10:07:37", "", 1, NULL, 3, NULL),
- (1726, "Me, Myself & I", "2003-12-05 11:24:36", " ", 1, NULL, 3, NULL);
-
-CREATE TABLE t3(
- mediaid int NOT NULL ,
- metaid int NOT NULL default '0',
- formatid int NOT NULL default '0',
- status int default NULL,
- path varchar(100) NOT NULL default '',
- datemodified timestamp NOT NULL ,
- resourcetype int NOT NULL default '1',
- parameters text,
- signature int default NULL,
- quality int NOT NULL default '255',
- PRIMARY KEY (mediaid)
-);
-CREATE INDEX t3_metaid ON t3(metaid);
-CREATE INDEX t3_formatid ON t3(formatid);
-CREATE INDEX t3_status ON t3(status);
-CREATE INDEX t3_metaidformatid ON t3(metaid,formatid);
-CREATE INDEX t3_signature ON t3(signature);
-CREATE INDEX t3_quality ON t3(quality);
-INSERT INTO t3 VALUES
- (6, 4, 8, 0, "010101_anastacia_spmidi.mid", "2004-03-16 13:40:00", 1, NULL, NULL, 255),
- (3343, 3, 8, 1, "010102_4VN4bsPwnxRQUJW5Zp1RhG2IL9vvl_8.mid", "2004-03-16 13:40:00", 1, NULL, NULL, 255);
-
-CREATE TABLE t4(
- formatid int NOT NULL ,
- name varchar(60) NOT NULL default '',
- formatclassid int NOT NULL default '0',
- mime varchar(60) default NULL,
- extension varchar(10) default NULL,
- priority int NOT NULL default '0',
- canaddtocapability char(1) NOT NULL default 'Y',
- PRIMARY KEY (formatid)
-);
-CREATE INDEX t4_formatclassid ON t4(formatclassid);
-CREATE INDEX t4_formats_idx ON t4(canaddtocapability);
-INSERT INTO t4 VALUES
- (19, "XHTML", 11, "text/html", "xhtml", 10, 'Y'),
- (54, "AMR (wide band)", 13, "audio/amr-wb", "awb", 0, 'Y');
-
-CREATE TABLE t5(
- formatclassid int NOT NULL ,
- name varchar(60) NOT NULL default '',
- priority int NOT NULL default '0',
- formattypeid int NOT NULL default '0',
- PRIMARY KEY (formatclassid)
-);
-CREATE INDEX t5_formattypeid on t5(formattypeid);
-INSERT INTO t5 VALUES
- (11, "Info", 0, 4), (13, "Digital Audio", 0, 2);
-
-CREATE TABLE t6(
- formattypeid int NOT NULL ,
- name varchar(60) NOT NULL default '',
- priority int default NULL,
- PRIMARY KEY (formattypeid)
-);
-INSERT INTO t6 VALUES
- (2, "Ringtones", 0);
-
-CREATE TABLE t7(
- metaid int NOT NULL default '0',
- artistid int NOT NULL default '0',
- PRIMARY KEY (metaid,artistid)
-);
-INSERT INTO t7 VALUES
- (4, 5), (3, 4);
-
-CREATE TABLE t8(
- artistid int NOT NULL ,
- name varchar(80) NOT NULL default '',
- PRIMARY KEY (artistid)
-);
-INSERT INTO t8 VALUES
- (5, "Anastacia"), (4, "John Mayer");
-
-CREATE TABLE t9(
- subgenreid int NOT NULL default '0',
- metaid int NOT NULL default '0',
- PRIMARY KEY (subgenreid,metaid)
-) ;
-CREATE INDEX t9_subgenreid ON t9(subgenreid);
-CREATE INDEX t9_metaid ON t9(metaid);
-INSERT INTO t9 VALUES
- (138, 4), (31, 3);
-
-CREATE TABLE t10(
- subgenreid int NOT NULL ,
- genreid int NOT NULL default '0',
- name varchar(80) NOT NULL default '',
- PRIMARY KEY (subgenreid)
-) ;
-CREATE INDEX t10_genreid ON t10(genreid);
-INSERT INTO t10 VALUES
- (138, 19, ''), (31, 3, '');
-
-CREATE TABLE t11(
- genreid int NOT NULL default '0',
- name char(80) NOT NULL default '',
- priority int NOT NULL default '0',
- masterclip char(1) default NULL,
- PRIMARY KEY (genreid)
-) ;
-CREATE INDEX t11_masterclip ON t11( masterclip);
-INSERT INTO t11 VALUES
- (19, "Pop & Dance", 95, 'Y'), (3, "Rock & Alternative", 100, 'Y');
-
-set join_cache_level=6;
-
-EXPLAIN
-SELECT t1.uniquekey, t1.xml AS affiliateXml,
- t8.name AS artistName, t8.artistid,
- t11.name AS genreName, t11.genreid, t11.priority AS genrePriority,
- t10.subgenreid, t10.name AS subgenreName,
- t2.name AS metaName, t2.metaid, t2.xml AS metaXml,
- t4.priority + t5.priority + t6.priority AS overallPriority,
- t3.path AS path, t3.mediaid,
- t4.formatid, t4.name AS formatName,
- t5.formatclassid, t5.name AS formatclassName,
- t6.formattypeid, t6.name AS formattypeName
-FROM t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11
-WHERE t7.metaid = t2.metaid AND t7.artistid = t8.artistid AND
- t9.metaid = t2.metaid AND t9.subgenreid = t10.subgenreid AND
- t10.genreid = t11.genreid AND t3.metaid = t2.metaid AND
- t3.formatid = t4.formatid AND t4.formatclassid = t5.formatclassid AND
- t4.canaddtocapability = 'Y' AND t5.formattypeid = t6.formattypeid AND
- t6.formattypeid IN (2) AND (t3.formatid IN (31, 8, 76)) AND
- t1.metaid = t2.metaid AND t1.affiliateid = '2';
-
-SELECT t1.uniquekey, t1.xml AS affiliateXml,
- t8.name AS artistName, t8.artistid,
- t11.name AS genreName, t11.genreid, t11.priority AS genrePriority,
- t10.subgenreid, t10.name AS subgenreName,
- t2.name AS metaName, t2.metaid, t2.xml AS metaXml,
- t4.priority + t5.priority + t6.priority AS overallPriority,
- t3.path AS path, t3.mediaid,
- t4.formatid, t4.name AS formatName,
- t5.formatclassid, t5.name AS formatclassName,
- t6.formattypeid, t6.name AS formattypeName
-FROM t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11
-WHERE t7.metaid = t2.metaid AND t7.artistid = t8.artistid AND
- t9.metaid = t2.metaid AND t9.subgenreid = t10.subgenreid AND
- t10.genreid = t11.genreid AND t3.metaid = t2.metaid AND
- t3.formatid = t4.formatid AND t4.formatclassid = t5.formatclassid AND
- t4.canaddtocapability = 'Y' AND t5.formattypeid = t6.formattypeid AND
- t6.formattypeid IN (2) AND (t3.formatid IN (31, 8, 76)) AND
- t1.metaid = t2.metaid AND t1.affiliateid = '2';
-
-DROP TABLE t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11;
-
-#
-# Bug #37131: 3-way join query with BKA used with a small buffer and
-# only for the third table
-#
-
-CREATE TABLE t1 (a1 int, filler1 char(64) default ' ' );
-CREATE TABLE t2 (
- a2 int, b2 int, filler2 char(64) default ' ',
- PRIMARY KEY idx(a2,b2,filler2)
-) ;
-CREATE TABLE t3 (b3 int, c3 int, INDEX idx(b3));
-
-INSERT INTO t1(a1) VALUES
- (4), (7), (1), (9), (8), (5), (3), (6), (2);
-INSERT INTO t2(a2,b2) VALUES
- (1,30), (3,40), (2,61), (6,73), (8,92), (9,27), (4,18), (5,84), (7,56),
- (4,14), (6,76), (8,98), (7,55), (1,39), (2,68), (3,45), (9,21), (5,81),
- (5,88), (2,65), (6,74), (9,23), (1,37), (3,44), (4,17), (8,99), (7,51),
- (9,28), (7,52), (1,33), (4,13), (5,87), (3,43), (8,91), (2,62), (6,79),
- (3,49), (8,93), (7,34), (5,82), (6,78), (2,63), (1,32), (9,22), (4,11);
-INSERT INTO t3 VALUES
- (30,302), (92,923), (18,187), (45,459), (30,309),
- (39,393), (68,685), (45,458), (21,210), (81,817),
- (40,405), (61,618), (73,738), (92,929), (27,275),
- (18,188), (84,846), (56,564), (14,144), (76,763),
- (98,982), (55,551), (17,174), (99,998), (51,513),
- (28,282), (52,527), (33,336), (13,138), (87,878),
- (43,431), (91,916), (62,624), (79,797), (49,494),
- (93,933), (34,347), (82,829), (78,780), (63,634),
- (32,329), (22,228), (11,114), (74,749), (23,236);
-
-set join_cache_level=1;
-
-EXPLAIN
-SELECT a1<>a2, a1, a2, b2, b3, c3,
- SUBSTR(filler1,1,1) AS s1, SUBSTR(filler2,1,1) AS s2
-FROM t1,t2,t3 WHERE a1=a2 AND b2=b3 AND MOD(c3,10)>7;
-
-SELECT a1<>a2, a1, a2, b2, b3, c3,
- SUBSTR(filler1,1,1) AS s1, SUBSTR(filler2,1,1) AS s2
-FROM t1,t2,t3 WHERE a1=a2 AND b2=b3 AND MOD(c3,10)>7;
-
-set join_cache_level=5;
-set join_buffer_size=512;
-
-EXPLAIN
-SELECT a1<>a2, a1, a2, b2, b3, c3,
- SUBSTR(filler1,1,1) AS s1, SUBSTR(filler2,1,1) AS s2
-FROM t1,t2,t3 WHERE a1=a2 AND b2=b3 AND MOD(c3,10)>7;
-
-SELECT a1<>a2, a1, a2, b2, b3, c3,
- SUBSTR(filler1,1,1) AS s1, SUBSTR(filler2,1,1) AS s2
-FROM t1,t2,t3 WHERE a1=a2 AND b2=b3 AND MOD(c3,10)>7;
-
-DROP TABLE t1,t2,t3;
-
-#
-# Bug #37690: crash with a tiny buffer when using BKA_JOIN_CACHE_UNIQUE
-#
-
-CREATE TABLE t1 (a int, b int, INDEX idx(b));
-CREATE TABLE t2 (a int, b int, INDEX idx(a));
-INSERT INTO t1 VALUES (5,30), (3,20), (7,40), (2,10), (8,30), (1,10), (4,20);
-INSERT INTO t2 VALUES (7,10), (1,20), (2,20), (8,20), (8,10), (1,20);
-INSERT INTO t2 VALUES (1,10), (4,20), (3,20), (7,20), (7,10), (1,20);
-INSERT INTO t2 VALUES (17,10), (11,20), (12,20), (18,20), (18,10), (11,20);
-INSERT INTO t2 VALUES (11,10), (14,20), (13,20), (17,20), (17,10), (11,20);
-
-set join_buffer_size=32;
-set join_cache_level=8;
-
-EXPLAIN SELECT * FROM t1,t2 WHERE t1.a=t2.a AND t1.b >= 30;
---sorted_result
-SELECT * FROM t1,t2 WHERE t1.a=t2.a AND t1.b >= 30;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug #40134: outer join with not exists optimization and join buffer
---echo #
-
-set join_cache_level=default;
-set join_buffer_size=default;
-
-CREATE TABLE t1 (a int NOT NULL);
-INSERT INTO t1 VALUES (2), (4), (3), (5), (1);
-CREATE TABLE t2 (a int NOT NULL, b int NOT NULL, INDEX i_a(a));
-INSERT INTO t2 VALUES (4,10), (2,10), (2,30), (2,20), (4,20);
-INSERT INTO t2 VALUES (14,10), (12,10), (15,30), (12,20), (14,20);
-
-EXPLAIN
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.a WHERE t2.b IS NULL;
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.a WHERE t2.b IS NULL;
-
-SET join_cache_level=6;
-EXPLAIN
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.a WHERE t2.b IS NULL;
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.a WHERE t2.b IS NULL;
-
-DROP TABLE t1, t2;
-
-set join_cache_level=default;
-set join_buffer_size=default;
-
---echo #
---echo # BUG#40136: Group by is ignored when join buffer is used for an outer join
---echo #
-create table t1(a int PRIMARY KEY, b int);
-insert into t1 values
- (5, 10), (2, 70), (7, 80), (6, 20), (1, 50), (9, 40), (8, 30), (3, 60);
-create table t2 (p int, a int, INDEX i_a(a));
-insert into t2 values
- (103, 7), (109, 3), (102, 3), (108, 1), (106, 3),
- (107, 7), (105, 1), (101, 3), (100, 7), (110, 1);
-set @save_join_cache_level=@@join_cache_level;
-set join_cache_level=6;
---echo The following must not show "using join cache":
-explain
-select t1.a, count(t2.p) as count
- from t1 left join t2 on t1.a=t2.a and t2.p % 2 = 1 group by t1.a;
-select t1.a, count(t2.p) as count
- from t1 left join t2 on t1.a=t2.a and t2.p % 2 = 1 group by t1.a;
-set join_cache_level=@save_join_cache_level;
-drop table t1, t2;
-
---echo #
---echo # BUG#40268: Nested outer join with not null-rejecting where condition
---echo # over an inner table which is not the last in the nest
---echo #
-
-CREATE TABLE t2 (a int, b int, c int);
-CREATE TABLE t3 (a int, b int, c int);
-CREATE TABLE t4 (a int, b int, c int);
-
-INSERT INTO t2 VALUES (3,3,0), (4,2,0), (5,3,0);
-INSERT INTO t3 VALUES (1,2,0), (2,2,0);
-INSERT INTO t4 VALUES (3,2,0), (4,2,0);
-
-set join_cache_level=6;
-
-SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
- FROM t2 LEFT JOIN (t3, t4) ON t2.b=t4.b
- WHERE t3.a+2<t2.a OR t3.c IS NULL;
-
-set join_cache_level=default;
-DROP TABLE t2, t3, t4;
-
---echo #
---echo # Bug #40192: outer join with where clause when using BNL
---echo #
-
-create table t1 (a int, b int);
-insert into t1 values (2, 20), (3, 30), (1, 10);
-create table t2 (a int, c int);
-insert into t2 values (1, 101), (3, 102), (1, 100);
-
-set join_cache_level=6;
-
-select * from t1 left join t2 on t1.a=t2.a;
-explain select * from t1 left join t2 on t1.a=t2.a where t2.c=102 or t2.c is null;
-select * from t1 left join t2 on t1.a=t2.a where t2.c=102 or t2.c is null;
-
-set join_cache_level=default;
-drop table t1, t2;
-
---echo #
---echo # Bug #40317: outer join with with constant on expression equal to FALSE
---echo #
-
-create table t1 (a int);
-insert into t1 values (30), (40), (20);
-create table t2 (b int);
-insert into t2 values (200), (100);
-
-set join_cache_level=6;
-
-select * from t1 left join t2 on (1=0);
-explain select * from t1 left join t2 on (1=0) where a=40;
-select * from t1 left join t2 on (1=0) where a=40;
-
-set join_cache_level=0;
-explain select * from t1 left join t2 on (1=0);
-
-set join_cache_level=default;
-drop table t1, t2;
-
---echo #
---echo # Bug #41204: small buffer with big rec_per_key for ref access
---echo #
-
-CREATE TABLE t1 (a int);
-
-INSERT INTO t1 VALUES (0);
-INSERT INTO t1(a) SELECT a FROM t1;
-INSERT INTO t1(a) SELECT a FROM t1;
-INSERT INTO t1(a) SELECT a FROM t1;
-INSERT INTO t1(a) SELECT a FROM t1;
-INSERT INTO t1(a) SELECT a FROM t1;
-INSERT INTO t1(a) SELECT a FROM t1;
-INSERT INTO t1(a) SELECT a FROM t1;
-INSERT INTO t1(a) SELECT a FROM t1;
-INSERT INTO t1(a) SELECT a FROM t1;
-INSERT INTO t1(a) SELECT a FROM t1;
-INSERT INTO t1(a) SELECT a FROM t1;
-INSERT INTO t1 VALUES (20000), (10000);
-
-CREATE TABLE t2 (pk int AUTO_INCREMENT PRIMARY KEY, b int, c int, INDEX idx(b));
-INSERT INTO t2(b,c) VALUES (10000, 3), (20000, 7), (20000, 1), (10000, 9), (20000, 5);
-INSERT INTO t2(b,c) SELECT b,c FROM t2;
-INSERT INTO t2(b,c) SELECT b,c FROM t2;
-INSERT INTO t2(b,c) SELECT b,c FROM t2;
-INSERT INTO t2(b,c) SELECT b,c FROM t2;
-INSERT INTO t2(b,c) SELECT b,c FROM t2;
-INSERT INTO t2(b,c) SELECT b,c FROM t2;
-INSERT INTO t2(b,c) SELECT b,c FROM t2;
-INSERT INTO t2(b,c) SELECT b,c FROM t2;
-
---disable_result_log
-ANALYZE TABLE t1,t2;
---enable_result_log
-
-set join_cache_level=6;
-set join_buffer_size=1024;
-
-EXPLAIN SELECT AVG(c) FROM t1,t2 WHERE t1.a=t2.b;
-SELECT AVG(c) FROM t1,t2 WHERE t1.a=t2.b;
-
-set join_buffer_size=default;
-set join_cache_level=default;
-
-DROP TABLE t1, t2;
-
---echo #
---echo # Bug #41894: big join buffer of level 7 used to join records
---echo # with null values in place of varchar strings
---echo #
-
-CREATE TABLE t1 (a int NOT NULL AUTO_INCREMENT PRIMARY KEY,
- b varchar(127) DEFAULT NULL);
-
-INSERT INTO t1(a) VALUES (1);
-INSERT INTO t1(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t1;
-
-CREATE TABLE t2 (a int NOT NULL PRIMARY KEY, b varchar(127) DEFAULT NULL);
-INSERT INTO t2 SELECT * FROM t1;
-
-CREATE TABLE t3 (a int NOT NULL PRIMARY KEY, b varchar(127) DEFAULT NULL);
-INSERT INTO t3 SELECT * FROM t1;
-
-set join_cache_level=7;
-set join_buffer_size=1024*1024;
-
-EXPLAIN
-SELECT COUNT(*) FROM t1,t2,t3
- WHERE t1.a=t2.a AND t2.a=t3.a AND
- t1.b IS NULL AND t2.b IS NULL AND t3.b IS NULL;
-
-SELECT COUNT(*) FROM t1,t2,t3
- WHERE t1.a=t2.a AND t2.a=t3.a AND
- t1.b IS NULL AND t2.b IS NULL AND t3.b IS NULL;
-
-set join_buffer_size=default;
-set join_cache_level=default;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # Bug #42020: join buffer is used for outer join with fields of
---echo # several outer tables in join buffer
---echo #
-
-CREATE TABLE t1 (
- a bigint NOT NULL,
- PRIMARY KEY (a)
-);
-INSERT INTO t1 VALUES
- (2), (1);
-
-CREATE TABLE t2 (
- a bigint NOT NULL,
- b bigint NOT NULL,
- PRIMARY KEY (a,b)
-);
-INSERT INTO t2 VALUES
- (2,30), (2,40), (2,50), (2,60), (2,70), (2,80),
- (1,10), (1, 20), (1,30), (1,40), (1,50);
-
-CREATE TABLE t3 (
- pk bigint NOT NULL AUTO_INCREMENT,
- a bigint NOT NULL,
- b bigint NOT NULL,
- val bigint DEFAULT '0',
- PRIMARY KEY (pk),
- KEY idx (a,b)
-);
-INSERT INTO t3(a,b) VALUES
- (2,30), (2,40), (2,50), (2,60), (2,70), (2,80),
- (4,30), (4,40), (4,50), (4,60), (4,70), (4,80),
- (5,30), (5,40), (5,50), (5,60), (5,70), (5,80),
- (7,30), (7,40), (7,50), (7,60), (7,70), (7,80);
-
-set join_cache_level=0;
-
-SELECT t1.a, t2.a, t3.a, t2.b, t3.b, t3.val
- FROM (t1,t2) LEFT JOIN t3 ON (t1.a=t3.a AND t2.b=t3.b)
- WHERE t1.a=t2.a;
-
-set join_cache_level=6;
-set join_buffer_size=256;
-
-EXPLAIN
-SELECT t1.a, t2.a, t3.a, t2.b, t3.b, t3.val
- FROM (t1,t2) LEFT JOIN t3 ON (t1.a=t3.a AND t2.b=t3.b)
- WHERE t1.a=t2.a;
---sorted_result
-SELECT t1.a, t2.a, t3.a, t2.b, t3.b, t3.val
- FROM (t1,t2) LEFT JOIN t3 ON (t1.a=t3.a AND t2.b=t3.b)
- WHERE t1.a=t2.a;
-
-DROP INDEX idx ON t3;
-set join_cache_level=2;
-
-EXPLAIN
-SELECT t1.a, t2.a, t3.a, t2.b, t3.b, t3.val
- FROM (t1,t2) LEFT JOIN t3 ON (t1.a=t3.a AND t2.b=t3.b)
- WHERE t1.a=t2.a;
-
---sorted_result
-SELECT t1.a, t2.a, t3.a, t2.b, t3.b, t3.val
- FROM (t1,t2) LEFT JOIN t3 ON (t1.a=t3.a AND t2.b=t3.b)
- WHERE t1.a=t2.a;
-
-set join_buffer_size=default;
-set join_cache_level=default;
-
-DROP TABLE t1,t2,t3;
-
-#
-# WL#4424 Full index condition pushdown with batched key access join
-#
-create table t1(f1 int, f2 int);
-insert into t1 values (1,1),(2,2),(3,3);
-create table t2(f1 int not null, f2 int not null, f3 char(200), key(f1,f2));
-insert into t2 values (1,1, 'qwerty'),(1,2, 'qwerty'),(1,3, 'qwerty');
-insert into t2 values (2,1, 'qwerty'),(2,2, 'qwerty'),(2,3, 'qwerty'),
- (2,4, 'qwerty'),(2,5, 'qwerty');
-insert into t2 values (3,1, 'qwerty'),(3,4, 'qwerty');
-insert into t2 values (4,1, 'qwerty'),(4,2, 'qwerty'),(4,3, 'qwerty'),
- (4,4, 'qwerty');
-insert into t2 values (1,1, 'qwerty'),(1,2, 'qwerty'),(1,3, 'qwerty');
-insert into t2 values (2,1, 'qwerty'),(2,2, 'qwerty'),(2,3, 'qwerty'),
- (2,4, 'qwerty'),(2,5, 'qwerty');
-insert into t2 values (3,1, 'qwerty'),(3,4, 'qwerty');
-insert into t2 values (4,1, 'qwerty'),(4,2, 'qwerty'),(4,3, 'qwerty'),
- (4,4, 'qwerty');
-
-flush status;
-set join_cache_level=5;
-select t2.f1, t2.f2, t2.f3 from t1,t2
-where t1.f1=t2.f1 and t2.f2 between t1.f1 and t1.f2 and t2.f2 + 1 >= t1.f1 + 1;
-
-explain select t2.f1, t2.f2, t2.f3 from t1,t2
-where t1.f1=t2.f1 and t2.f2 between t1.f1 and t2.f2;
-show status like "Handler_icp%";
-
-set join_cache_level=6;
-select t2.f1, t2.f2, t2.f3 from t1,t2
-where t1.f1=t2.f1 and t2.f2 between t1.f1 and t1.f2 and t2.f2 + 1 >= t1.f1 + 1;
-
-explain select t2.f1, t2.f2, t2.f3 from t1,t2
-where t1.f1=t2.f1 and t2.f2 between t1.f1 and t2.f2;
-show status like "Handler_icp%";
-
-set join_cache_level=7;
-select t2.f1, t2.f2, t2.f3 from t1,t2
-where t1.f1=t2.f1 and t2.f2 between t1.f1 and t1.f2 and t2.f2 + 1 >= t1.f1 + 1;
-
-explain select t2.f1, t2.f2, t2.f3 from t1,t2
-where t1.f1=t2.f1 and t2.f2 between t1.f1 and t2.f2;
-show status like "Handler_icp%";
-
-set join_cache_level=8;
-select t2.f1, t2.f2, t2.f3 from t1,t2
-where t1.f1=t2.f1 and t2.f2 between t1.f1 and t1.f2 and t2.f2 + 1 >= t1.f1 + 1;
-
-explain select t2.f1, t2.f2, t2.f3 from t1,t2
-where t1.f1=t2.f1 and t2.f2 between t1.f1 and t2.f2;
-show status like "Handler_icp%";
-
-drop table t1,t2;
-set join_cache_level=default;
-
---echo #
---echo # Bug #42955: join with GROUP BY/ORDER BY and when BKA is enabled
---echo #
-
-create table t1 (d int, id1 int, index idx1 (d, id1));
-insert into t1 values
- (3, 20), (2, 40), (3, 10), (1, 10), (3, 20), (1, 40), (2, 30), (3, 30);
-
-create table t2 (id1 int, id2 int, index idx2 (id1));
-insert into t2 values
- (20, 100), (30, 400), (20, 400), (30, 200), (10, 300), (10, 200), (40, 100),
- (40, 200), (30, 300), (10, 400), (20, 200), (20, 300);
-insert into t2 values
- (21, 10), (31, 400), (21, 400), (31, 200), (11, 300), (11, 200), (41, 100),
- (41, 200), (31, 300), (11, 400), (21, 200), (21, 300);
-
-set join_cache_level=6;
-
-explain
-select t1.id1, sum(t2.id2) from t1 join t2 on t1.id1=t2.id1
- where t1.d=3 group by t1.id1;
-
-select t1.id1, sum(t2.id2) from t1 join t2 on t1.id1=t2.id1
- where t1.d=3 group by t1.id1;
-
-explain
-select t1.id1 from t1 join t2 on t1.id1=t2.id1
- where t1.d=3 and t2.id2 > 200 order by t1.id1;
-
-select t1.id1 from t1 join t2 on t1.id1=t2.id1
- where t1.d=3 and t2.id2 > 200 order by t1.id1;
-
-set join_cache_level=default;
-
-drop table t1,t2;
-
---echo #
---echo # Bug #44019: star-like multi-join query executed join_cache_level=6
---echo #
-
-create table t1 (a int, b int, c int, d int);
-create table t2 (b int, e varchar(16), index idx(b));
-create table t3 (d int, f varchar(16), index idx(d));
-create table t4 (c int, g varchar(16), index idx(c));
-
-insert into t1 values
- (5, 50, 500, 5000), (3, 30, 300, 3000), (9, 90, 900, 9000),
- (2, 20, 200, 2000), (4, 40, 400, 4000), (8, 80, 800, 800),
- (7, 70, 700, 7000);
-insert into t2 values
- (30, 'bbb'), (10, 'b'), (70, 'bbbbbbb'), (60, 'bbbbbb'),
- (31, 'bbb'), (11, 'b'), (71, 'bbbbbbb'), (61, 'bbbbbb'),
- (32, 'bbb'), (12, 'b'), (72, 'bbbbbbb'), (62, 'bbbbbb');
-insert into t2 values
- (130, 'bbb'), (110, 'b'), (170, 'bbbbbbb'), (160, 'bbbbbb'),
- (131, 'bbb'), (111, 'b'), (171, 'bbbbbbb'), (161, 'bbbbbb'),
- (132, 'bbb'), (112, 'b'), (172, 'bbbbbbb'), (162, 'bbbbbb');
-insert into t3 values
- (4000, 'dddd'), (3000, 'ddd'), (1000, 'd'), (8000, 'dddddddd'),
- (4001, 'dddd'), (3001, 'ddd'), (1001, 'd'), (8001, 'dddddddd'),
- (4002, 'dddd'), (3002, 'ddd'), (1002, 'd'), (8002, 'dddddddd');
-insert into t3 values
- (14000, 'dddd'), (13000, 'ddd'), (11000, 'd'), (18000, 'dddddddd'),
- (14001, 'dddd'), (13001, 'ddd'), (11001, 'd'), (18001, 'dddddddd'),
- (4002, 'dddd'), (3002, 'ddd'), (1002, 'd'), (8002, 'dddddddd');
-insert into t4 values
- (200, 'cc'), (600, 'cccccc'), (300, 'ccc'), (500, 'ccccc'),
- (201, 'cc'), (601, 'cccccc'), (301, 'ccc'), (501, 'ccccc'),
- (202, 'cc'), (602, 'cccccc'), (302, 'ccc'), (502, 'ccccc');
-insert into t4 values
- (1200, 'cc'), (1600, 'cccccc'), (1300, 'ccc'), (1500, 'ccccc'),
- (1201, 'cc'), (1601, 'cccccc'), (1301, 'ccc'), (1501, 'ccccc'),
- (1202, 'cc'), (1602, 'cccccc'), (1302, 'ccc'), (1502, 'ccccc');
-
---disable_result_log
---disable_warnings
-analyze table t2,t3,t4;
---enable_warnings
---enable_result_log
-
-set join_cache_level=1;
-explain
-select t1.a, t1.b, t1.c, t1.d, t2.e, t3.f, t4.g from t1,t2,t3,t4
- where t2.b=t1.b and t3.d=t1.d and t4.c=t1.c;
-
-select t1.a, t1.b, t1.c, t1.d, t2.e, t3.f, t4.g from t1,t2,t3,t4
- where t2.b=t1.b and t3.d=t1.d and t4.c=t1.c;
-
-set join_cache_level=6;
-explain
-select t1.a, t1.b, t1.c, t1.d, t2.e, t3.f, t4.g from t1,t2,t3,t4
- where t2.b=t1.b and t3.d=t1.d and t4.c=t1.c;
-
-select t1.a, t1.b, t1.c, t1.d, t2.e, t3.f, t4.g from t1,t2,t3,t4
- where t2.b=t1.b and t3.d=t1.d and t4.c=t1.c;
-
-set join_cache_level=default;
-
-drop table t1,t2,t3,t4;
-
---echo #
---echo # Bug #44250: Corruption of linked join buffers when using BKA
---echo #
-
-CREATE TABLE t1 (
- id1 bigint(20) DEFAULT NULL,
- id2 bigint(20) DEFAULT NULL,
- id3 bigint(20) DEFAULT NULL,
- num1 bigint(20) DEFAULT NULL,
- num2 int(11) DEFAULT NULL,
- num3 bigint(20) DEFAULT NULL
-);
-
-CREATE TABLE t2 (
- id3 bigint(20) NOT NULL DEFAULT '0',
- id4 bigint(20) DEFAULT NULL,
- enum1 enum('Enabled','Disabled','Paused') DEFAULT NULL,
- PRIMARY KEY (id3)
-);
-
-CREATE TABLE t3 (
- id4 bigint(20) NOT NULL DEFAULT '0',
- text1 text,
- PRIMARY KEY (id4)
-);
-
-CREATE TABLE t4 (
- id2 bigint(20) NOT NULL DEFAULT '0',
- dummy int(11) DEFAULT '0',
- PRIMARY KEY (id2)
-);
-
-CREATE TABLE t5 (
- id1 bigint(20) NOT NULL DEFAULT '0',
- id2 bigint(20) NOT NULL DEFAULT '0',
- enum2 enum('Active','Deleted','Paused') DEFAULT NULL,
- PRIMARY KEY (id1,id2)
-);
-
---disable_query_log
---disable_result_log
---disable_warnings
-
-INSERT INTO t1 VALUES
-(228172702,72485641,2667134182,10,1,14),(228172702,94266195,2667134182,134,0,134),
-(228172702,94266195,2667134182,15,0,15),(228172702,94266195,2667134182,2,0,3),
-(228172702,818095880,2667134182,1,1,1),(228172702,1004959639,2667134182,3,0,3),
-(228172702,1297484422,2667134182,1,2,1),(228172702,1730911800,2667134182,11,0,28),
-(228172702,1730911800,2667134182,4,0,4),(228172702,2182755982,2667134182,5,0,15),
-(228172702,2182755982,2667134182,1,0,1),(228172702,2968841184,2667134182,1,0,1),
-(228172702,4765525626,2667134182,2,0,3),(228172702,4765525626,2667134182,29,0,38),
-(228172702,4765525626,2667134182,7,0,7),(228172702,4765525626,2667134182,7,0,8),
-(228172702,5330573302,2667134182,1,0,1),(228512602,191149872,935692942,3,0,17),
-(228512602,259118753,935692942,13,7,13),(228512602,259118753,935692942,83,33,83),
-(228512602,585705465,935692942,1,0,1),(228512602,585716775,935692942,1,0,1),
-(228512602,585716775,935692942,6,6,6),(228512602,585716775,935692942,1,1,1),
-(228512602,1105371172,935692942,2,0,3),(228512602,1105371172,935692942,7,2,7),
-(228512602,1314223462,935692942,1,0,1),(228512602,1314223642,935692942,1,1,1),
-(228512602,1411060522,935692942,1,0,1),(228512602,1467398182,935692942,1,0,1),
-(228512602,1467398182,935692942,3,0,4),(228512602,1467398242,935692942,10,0,41),
-(228512602,1467398242,935692942,28,0,40),(228512602,1467398242,935692942,0,0,0),
-(228512602,1467398242,935692942,29,2,33),(228512602,1734178942,935692942,1,0,1),
-(228512602,1734179122,935692942,1,0,4),(228512602,1734179122,935692942,3,0,6),
-(228512602,1953612870,935692942,1,0,1),(228512602,2271510562,935692942,1,1,1),
-(228512602,2271525022,935692942,0,0,0),(228512602,3058831402,935692942,1,1,1),
-(228512602,3723638842,935692942,1,1,1),(228512602,3723638842,935692942,4,3,4),
-(228512602,3723836602,935692942,1,1,1),(228512602,3723836842,935692942,1,1,1),
-(228512602,3723836962,935692942,1,1,1),(228512602,3723988102,935692942,11,4,11),
-(228512602,3723989182,935692942,8,3,8),(228512602,5920283002,935692942,1,0,1),
-(228512602,5920314232,935692942,1,0,1),(228512602,191149872,1241589892,0,0,0),
-(228512602,191149872,1241589892,2,0,4),(228512602,191149872,1241589892,0,0,0),
-(228512602,259118753,1241589892,8,4,8),(228512602,259118753,1241589892,70,33,70),
-(228512602,259118753,1241589892,1,1,1),(228512602,585716775,1241589892,8,7,8),
-(228512602,1105371172,1241589892,1,0,1),(228512602,1105371172,1241589892,9,0,9),
-(228512602,1314223462,1241589892,1,0,1),(228512602,1411060522,1241589892,1,1,1),
-(228512602,1467398182,1241589892,1,0,1),(228512602,1467398182,1241589892,4,1,4),
-(228512602,1467398182,1241589892,1,0,1),(228512602,1467398242,1241589892,10,0,28),
-(228512602,1467398242,1241589892,37,1,78),(228512602,1467398242,1241589892,28,9,30),
-(228512602,1467398242,1241589892,5,0,6),(228512602,1734179122,1241589892,3,1,18),
-(228512602,1734179122,1241589892,1,1,1),(228512602,1734179122,1241589892,2,0,3),
-(228512602,1953611430,1241589892,1,1,1),(228512602,1953611430,1241589892,1,1,1),
-(228512602,1953612870,1241589892,1,0,1),(228512602,2026844250,1241589892,1,0,1),
-(228512602,2271510562,1241589892,1,1,1),(228512602,2271525022,1241589892,1,0,1),
-(228512602,2941612417,1241589892,1,0,1),(228512602,3723988102,1241589892,1,0,1);
-INSERT INTO t1 VALUES
-(228512602,3723988102,1241589892,11,4,11),(228512602,3723989002,1241589892,1,0,1),
-(228512602,3752960902,1241589892,2,2,4),(228808822,17304242,935693782,6,0,17),
-(228808822,17304242,935693782,28,1,50),(228808822,17304242,935693782,29,3,61),
-(228808822,17304242,935693782,6,0,13),(228808822,30931012,935693782,21,0,60),
-(228808822,30931012,935693782,5,0,13),(228808822,37254452,935693782,3,0,3),
-(228808822,42726891,935693782,1,0,4),(228808822,42726891,935693782,3,0,6),
-(228808822,76261151,935693782,8,0,18),(228808822,88240139,935693782,1,0,1),
-(228808822,88240139,935693782,3,0,3),(228808822,94730895,935693782,2,0,4),
-(228808822,179737402,935693782,10,0,13),(228808822,179737402,935693782,7,0,8),
-(228808822,179737402,935693782,3,0,4),(228808822,271288782,935693782,1,0,6),
-(228808822,304690943,935693782,5,2,10),(228808822,304691183,935693782,4,0,16),
-(228808822,568994960,935693782,1,0,1),(228808822,631705925,935693782,1,0,1),
-(228808822,631745165,935693782,1,0,1),(228808822,631749605,935693782,1,0,4),
-(228808822,1057787002,935693782,1,0,1),(228808822,1057787002,935693782,2,1,4),
-(228808822,1057787002,935693782,12,1,20),(228808822,1057788022,935693782,2,0,40),
-(228808822,1057788022,935693782,2,1,3),(228808822,1057788022,935693782,9,2,16),
-(228808822,1335646822,935693782,3,1,6),(228808822,1335646882,935693782,1,0,3),
-(228808822,1335646882,935693782,1,0,3),(228808822,1335646942,935693782,7,2,15),
-(228808822,5510586183,935693782,1,1,1),(228808822,17304242,2482416112,11,0,28),
-(228808822,17304242,2482416112,34,0,62),(228808822,17304242,2482416112,43,2,89),
-(228808822,17304242,2482416112,9,0,19),(228808822,30931012,2482416112,32,2,84),
-(228808822,30931012,2482416112,6,0,14),(228808822,30931012,2482416112,2,0,9),
-(228808822,37254452,2482416112,1,1,1),(228808822,42726891,2482416112,2,0,10),
-(228808822,76261151,2482416112,11,0,26),(228808822,88240139,2482416112,3,0,3),
-(228808822,88240139,2482416112,1,0,1),(228808822,88240139,2482416112,3,0,4),
-(228808822,94730895,2482416112,1,0,3),(228808822,125469602,2482416112,0,0,0),
-(228808822,179737402,2482416112,4,0,10),(228808822,179737402,2482416112,8,1,9),
-(228808822,179737402,2482416112,7,1,9),(228808822,179737402,2482416112,1,0,1),
-(228808822,271288782,2482416112,2,0,14),(228808822,304690943,2482416112,3,0,6),
-(228808822,304691183,2482416112,1,0,4),(228808822,555689643,2482416112,2,1,8),
-(228808822,555689643,2482416112,1,0,4),(228808822,631705925,2482416112,1,0,1),
-(228808822,631712555,2482416112,1,0,1),(228808822,631745165,2482416112,1,0,1),
-(228808822,710348755,2482416112,1,0,1),(228808822,753718113,2482416112,1,0,1),
-(228808822,1057787002,2482416112,1,0,4),(228808822,1057787002,2482416112,1,0,1),
-(228808822,1057787002,2482416112,4,1,7),(228808822,1057788022,2482416112,7,0,12),
-(228808822,1057788022,2482416112,3,0,37),(228808822,1057788022,2482416112,0,0,0),
-(228808822,1057788022,2482416112,12,0,15),(228808822,1335646822,2482416112,14,1,28),
-(228808822,1335646882,2482416112,1,1,3),(228808822,1335646942,2482416112,5,1,9),
-(228808822,1335646942,2482416112,1,0,1),(230941762,16069490,2691187582,0,0,0),
-(230941762,16705991,2691187582,16,0,30),(230941762,16705991,2691187582,12,3,12);
-INSERT INTO t1 VALUES
-(230941762,16705991,2691187582,1,0,1),(230941762,27714032,2691187582,6,0,16),
-(230941762,27714032,2691187582,1,0,1),(230941762,27714032,2691187582,9,0,14),
-(230941762,28676710,2691187582,3,1,4),(230941762,370319272,2691187582,7,0,7),
-(230941762,1409814802,2691187582,1,0,3),(230941762,1409814982,2691187582,1,0,1),
-(230941762,1409814982,2691187582,1,1,1),(230941762,2069703256,2691187582,1,0,3),
-(230941762,16705991,2691187672,8,1,20),(230941762,16705991,2691187672,11,6,11),
-(230941762,16705991,2691187672,1,0,1),(230941762,27714032,2691187672,5,0,20),
-(230941762,27714032,2691187672,1,0,10),(230941762,27714032,2691187672,12,2,17),
-(230941762,28676710,2691187672,1,0,1),(230941762,142889951,2691187672,2,0,10),
-(230941762,172526592,2691187672,1,1,1),(230941762,293109282,2691187672,1,0,1),
-(230941762,370319272,2691187672,10,0,10),(230941762,1409814802,2691187672,1,0,3),
-(230941762,1409814922,2691187672,1,0,1),(230941762,1409814982,2691187672,1,0,1),
-(230941762,16069490,2694472582,1,1,1),(230941762,16069490,2694472582,1,1,1),
-(230941762,16705991,2694472582,15,0,45),(230941762,16705991,2694472582,13,2,15),
-(230941762,27714032,2694472582,9,0,34),(230941762,27714032,2694472582,2,0,4),
-(230941762,27714032,2694472582,10,2,14),(230941762,28676710,2694472582,4,0,12),
-(230941762,28676710,2694472582,1,0,1),(230941762,172526592,2694472582,1,0,4),
-(230941762,293109282,2694472582,1,0,1),(230941762,370319272,2694472582,6,0,6),
-(230941762,1409814802,2694472582,1,0,3),(230941762,1409814862,2694472582,1,0,4),
-(230941762,1409814982,2694472582,1,0,1),(230941762,2680867980,2694472582,1,0,3),
-(230942122,25451690,935695702,1,0,9),(230942122,31549341,935695702,2,0,18),
-(230942122,31549341,935695702,2,0,4),(230942122,38900150,935695702,4,0,29),
-(230942122,38900150,935695702,4,1,13),(230942122,906919252,935695702,39,0,271),
-(230942122,906919252,935695702,20,0,83),(230942122,906919252,935695702,2,1,9),
-(230942122,1409816782,935695702,3,0,18),(230942122,1409816842,935695702,1,0,7),
-(230942122,1409816842,935695702,1,0,3),(230942122,1409816902,935695702,1,0,6),
-(230942122,2145075862,935695702,4,1,4),(230942122,25451690,935695822,2,0,16),
-(230942122,38900150,935695822,3,0,26),(230942122,38900150,935695822,1,0,3),
-(230942122,906919252,935695822,24,0,176),(230942122,906919252,935695822,20,0,74),
-(230942122,906919252,935695822,1,0,3),(230942122,1409816782,935695822,2,0,21),
-(230942122,1409816782,935695822,2,0,21),(230942122,1409816842,935695822,1,0,3),
-(230942122,1409816902,935695822,1,0,7),(231112162,1413675742,935696902,1,0,1),
-(231112162,1413675742,935696962,0,0,0),(231112162,1413675742,935696962,4,2,4),
-(231112162,1413675922,935696962,1,0,1),(231112162,1413675922,935696962,1,0,1),
-(231112162,1413675742,1248588922,1,0,1),(231112162,1413675922,1248588922,3,0,3),
-(233937022,12641121,935697562,2,0,13),(233937022,12653871,935697562,1,0,1),
-(233937022,12693551,935697562,1,0,1),(233937022,12910461,935697562,2,0,6),
-(233937022,12910461,935697562,26,0,65),(233937022,12910461,935697562,44,8,45),
-(233937022,12910481,935697562,12,0,19),(233937022,12910481,935697562,7,2,9),
-(233937022,12910481,935697562,1,0,1),(233937022,12910511,935697562,8,0,8);
-INSERT INTO t1 VALUES
-(233937022,12910511,935697562,20,6,22),(233937022,30879781,935697562,34,0,34),
-(233937022,30879781,935697562,3,0,4),(233937022,30879781,935697562,1,0,1),
-(233937022,45631730,935697562,8,0,39),(233937022,54079090,935697562,12,0,12),
-(233937022,54079090,935697562,7,0,11),(233937022,54079090,935697562,14,0,16),
-(233937022,94431735,935697562,6,0,31),(233937022,96876131,935697562,3,0,4),
-(233937022,105436492,935697562,4,0,4),(233937022,128981555,935697562,3,0,3),
-(233937022,145211004,935697562,1,0,1),(233937022,146382622,935697562,1,0,1),
-(233937022,175678702,935697562,1,0,4),(233937022,298998998,935697562,1,0,1),
-(233937022,335995773,935697562,3,0,3),(233937022,335995773,935697562,2,0,3),
-(233937022,347447636,935697562,0,0,0),(233937022,459295955,935697562,3,0,3),
-(233937022,459376625,935697562,1,0,1),(233937022,495877773,935697562,1,0,1),
-(233937022,497008702,935697562,1,0,3),(233937022,561944105,935697562,1,0,1),
-(233937022,561944105,935697562,1,0,1),(233937022,586535965,935697562,3,0,3),
-(233937022,631549775,935697562,1,0,7),(233937022,647138479,935697562,1,0,1),
-(233937022,655870453,935697562,4,0,7),(233937022,694832725,935697562,1,0,1),
-(233937022,864475057,935697562,1,0,1),(233937022,1010757503,935697562,1,0,4),
-(233937022,1010847736,935697562,2,0,9),(233937022,1287437116,935697562,2,0,4),
-(233937022,1337693056,935697562,1,0,1),(233937022,1569279742,935697562,1,1,1),
-(233937022,1569280102,935697562,2,0,7),(233937022,1569280882,935697562,2,1,3),
-(233937022,1569281062,935697562,1,0,1),(233937022,1569281962,935697562,1,0,3),
-(233937022,2823580588,935697562,2,0,8),(233937022,2823580588,935697562,3,1,10),
-(233937022,2842066134,935697562,1,0,1),(233937022,2904542181,935697562,1,0,1),
-(233937022,3058483627,935697562,1,0,1),(233937022,4507287318,935697562,1,0,1),
-(233937022,5283489892,935697562,1,0,1),(233937022,11890554322,935697562,16,0,16),
-(233937022,11890756102,935697562,3,1,3),(233937022,12641121,953996482,1,0,7),
-(233937022,12641851,953996482,1,0,1),(233937022,12641851,953996482,1,0,1),
-(233937022,12910461,953996482,4,0,14),(233937022,12910461,953996482,20,2,23),
-(233937022,12910461,953996482,43,5,43),(233937022,12910461,953996482,1,0,1),
-(233937022,12910481,953996482,17,2,30),(233937022,12910511,953996482,7,1,8),
-(233937022,12910511,953996482,23,5,23),(233937022,14913951,953996482,2,0,3),
-(233937022,21835210,953996482,1,1,1),(233937022,26481052,953996482,1,1,1),
-(233937022,26481052,953996482,1,0,1),(233937022,30879781,953996482,2,0,3),
-(233937022,30879781,953996482,22,0,22),(233937022,35617681,953996482,1,0,1),
-(233937022,45631730,953996482,3,0,11),(233937022,54079090,953996482,13,0,13),
-(233937022,54079090,953996482,11,0,16),(233937022,54079090,953996482,29,0,34),
-(233937022,94431735,953996482,3,0,9),(233937022,96876131,953996482,3,0,4),
-(233937022,105436492,953996482,1,0,1),(233937022,105437952,953996482,3,1,3),
-(233937022,123639716,953996482,1,0,6),(233937022,145211004,953996482,2,0,3),
-(233937022,145211004,953996482,2,1,3),(233937022,146382622,953996482,1,0,1),
-(233937022,146382622,953996482,1,0,1),(233937022,155454324,953996482,1,0,1);
-INSERT INTO t1 VALUES
-(233937022,298998998,953996482,1,1,1),(233937022,335995773,953996482,1,0,1),
-(233937022,335995773,953996482,7,2,9),(233937022,459295955,953996482,2,0,4),
-(233937022,561944105,953996482,1,0,1),(233937022,655870453,953996482,5,0,9),
-(233937022,694832725,953996482,1,0,1),(233937022,694832725,953996482,1,0,1),
-(233937022,864475057,953996482,4,1,4),(233937022,897886118,953996482,1,0,1),
-(233937022,897886118,953996482,1,0,3),(233937022,1005147016,953996482,1,0,1),
-(233937022,1010757503,953996482,1,0,1),(233937022,1082217873,953996482,1,0,1),
-(233937022,1286925326,953996482,1,0,1),(233937022,1337693056,953996482,4,0,4),
-(233937022,1407236408,953996482,2,0,3),(233937022,1569280102,953996482,1,0,6),
-(233937022,1569280222,953996482,1,0,1),(233937022,1569281062,953996482,1,0,1),
-(233937022,1569284362,953996482,1,0,3),(233937022,2823580588,953996482,1,0,3),
-(233937022,2904542181,953996482,3,0,7),(233937022,4371581485,953996482,1,0,1),
-(233937022,5283491332,953996482,1,0,1),(233937022,7300486013,953996482,1,1,1),
-(233937022,11890554322,953996482,16,0,16),(233937022,11890754392,953996482,1,0,1),
-(233937022,11890754392,953996482,0,0,0);
-
-INSERT INTO t2 VALUES
-(2667134182,2567095402,'Enabled'),(935692942,826927822,'Enabled'),
-(1241589892,1130891152,'Enabled'),(935693782,826928662,'Enabled'),
-(2482416112,2381969632,'Enabled'),(2691187582,2591198842,'Enabled'),
-(2691187672,2591198932,'Enabled'),(2694472582,2594492212,'Paused'),
-(935695702,826930582,'Enabled'),(935695822,826930702,'Enabled'),
-(935696902,826931782,'Enabled'),(935696962,826931842,'Enabled'),
-(1248588922,1137805582,'Enabled'),(935697562,826932442,'Paused'),
-(953996482,845181202,'Enabled'),(2702549092,2602579882,'Enabled'),
-(2702549182,2602579972,'Enabled'),(2702550712,2602581502,'Enabled'),
-(1125312412,1015179502,'Enabled'),(2708245462,2608290202,'Enabled'),
-(2708247262,2608292002,'Enabled'),(935699242,826934122,'Enabled'),
-(1125312502,1015179592,'Enabled'),(1125312592,1015179682,'Enabled'),
-(2711450452,2611502302,'Enabled'),(2711452252,2611504102,'Enabled'),
-(935699902,826934782,'Enabled'),(935700262,826935142,'Enabled'),
-(1215381442,1104677032,'Enabled'),(2503848082,2403457762,'Enabled'),
-(935701762,826936642,'Enabled'),(935701822,826936702,'Enabled'),
-(1468810282,1355227402,'Enabled'),(935702842,826937722,'Enabled'),
-(1125312682,1015179772,'Enabled'),(2713816102,2613869392,'Enabled'),
-(2688452032,2588455012,'Enabled'),(2688452212,2588455192,'Enabled'),
-(2701527412,2601556942,'Enabled'),(1623918712,1510242412,'Enabled'),
-(2701521922,2601551452,'Enabled'),(2701527772,2601557302,'Enabled');
-
-INSERT INTO `t3` VALUES
-(2567095402,'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'),
-(826927822,'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB'),(1130891152,'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB'),
-(826928662,'CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC'),
-(2381969632,'CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC'),
-(2591198842,'DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD'),
-(2591198932,'EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE'),
-(2594492212,'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'),
-(826930582,'GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG'),
-(826930702,'GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG'),
-(826931782,'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB'),
-(826931842,'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB'),
-(1137805582,'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB');
-
-INSERT INTO t4 VALUES
-(12618121,0),(12641121,0),(12641851,0),(12653871,0),(12665801,0),(12666811,0),
-(12693551,0),(12910461,0),(12910481,0),(12910511,0),(14787251,0),(14913941,0),
-(14913951,0),(16069490,0),(16705901,0),(16705991,0),(17291062,0),(17304242,0),
-(20737411,0),(21524370,0),(21835210,0),(25300361,0),(25451690,0),(25728842,0),
-(26481052,0),(27714032,0),(28676710,0),(30879781,0),(30931012,0),(31549341,0),
-(35617681,0),(37254452,0),(38619430,0),(38895490,0),(38900150,0),(39798990,0),
-(42726891,0),(42867050,0),(43439030,0),(45631730,0),(47171711,0),(49539832,0),
-(54079090,0),(60442241,0),(65320501,0),(72485641,0),(76261151,0),(87949714,0),
-(88240139,0),(94266195,0),(94431735,0),(94730895,0),(96876131,0);
-
-INSERT INTO t5 VALUES
-(228172702,72485641,'Active'),(228172702,94266195,'Active'),
-(228172702,818095880,'Active'),(228172702,1004959639,'Active'),
-(228172702,1297484242,'Active'),(228172702,1297484422,'Active'),
-(228172702,1730911800,'Active'),(228172702,1808277389,'Active'),
-(228172702,2182755982,'Active'),(228172702,2968841184,'Active'),
-(228172702,3015116542,'Active'),(228172702,3752383170,'Active'),
-(228172702,4765525626,'Active'),(228172702,5330573302,'Active'),
-(228512602,191149872,'Active'),(228512602,259118753,'Active'),
-(228512602,585705465,'Active'),(228512602,585716775,'Active'),
-(228512602,1105371172,'Active'),(228512602,1314223462,'Active'),
-(228512602,1314223642,'Active'),(228512602,1411060522,'Active'),
-(228512602,1467398182,'Active'),(228512602,1467398242,'Active'),
-(228512602,1734178942,'Active'),(228512602,1734179122,'Active'),
-(228512602,1953612870,'Active'),(228512602,2271510562,'Active'),
-(228512602,2271525022,'Active'),(228512602,2941612417,'Active'),
-(228512602,3058831402,'Active'),(228512602,3723638842,'Active'),
-(228512602,3723836602,'Active'),(228512602,3723836842,'Active'),
-(228512602,3723836962,'Active'),(228512602,3723988102,'Active'),
-(228512602,3723989182,'Active'),(228512602,5920283002,'Active'),
-(228512602,5920314232,'Active'),(228512602,585717615,'Active'),
-(228512602,1953611430,'Active'),(228512602,2026844250,'Active'),
-(228512602,3058831462,'Active'),(228512602,3723836902,'Active'),
-(228512602,3723989002,'Active'),(228512602,3752960902,'Active'),
-(228808822,17304242,'Active'),(228808822,30931012,'Active'),
-(228808822,37254452,'Active'),(228808822,42726891,'Active'),
-(228808822,76261151,'Active'),(228808822,88240139,'Active'),
-(228808822,94730895,'Active'),(228808822,125469622,'Active'),
-(228808822,179737402,'Active'),(228808822,271288782,'Active'),
-(228808822,304690943,'Active'),(228808822,304691183,'Active'),
-(228808822,496123368,'Active'),(228808822,555689643,'Active'),
-(228808822,568994960,'Active'),(228808822,631705925,'Active'),
-(228808822,631745165,'Active'),(228808822,631749605,'Active'),
-(228808822,1057787002,'Active'),(228808822,1057788022,'Active'),
-(228808822,1335646822,'Active'),(228808822,1335646882,'Active'),
-(228808822,1335646942,'Active'),(228808822,1612792238,'Active'),
-(228808822,5510586183,'Active'),(228808822,47171711,'Active'),
-(228808822,125469602,'Active'),(228808822,631712555,'Active'),
-(228808822,710348755,'Active'),(228808822,753718113,'Active'),
-(230941762,16069490,'Active'),(230941762,16705991,'Active'),
-(230941762,27714032,'Active'),(230941762,28676710,'Active');
-INSERT INTO t5 VALUES
-(230941762,370319272,'Active'),(230941762,1409814802,'Active'),
-(230941762,1409814982,'Active'),(230941762,2069703256,'Active'),
-(230941762,142889951,'Active'),(230941762,172526592,'Active'),
-(230941762,293109282,'Active'),(230941762,1409814922,'Active'),
-(230941762,1409814862,'Active'),(230941762,2680867980,'Active'),
-(230942122,25451690,'Active'),(230942122,31549341,'Active'),
-(230942122,38900150,'Active'),(230942122,464554745,'Active'),
-(230942122,906919252,'Active'),(230942122,1409816782,'Active'),
-(230942122,1409816842,'Active'),(230942122,1409816902,'Active'),
-(230942122,2145075862,'Active'),(231112162,1413675742,'Active'),
-(231112162,1413675922,'Active'),(231112162,1413675562,'Active'),
-(231112162,1413675802,'Active'),(233937022,12641121,'Active'),
-(233937022,12653871,'Active'),(233937022,12693551,'Active'),
-(233937022,12910461,'Active'),(233937022,12910481,'Active'),
-(233937022,12910511,'Active'),(233937022,14913941,'Active'),
-(233937022,30879781,'Active'),(233937022,45631730,'Active'),
-(233937022,54079090,'Active'),(233937022,65320501,'Active'),
-(233937022,94431735,'Active'),(233937022,96876131,'Active'),
-(233937022,105436492,'Active'),(233937022,105437952,'Active'),
-(233937022,128981555,'Active'),(233937022,145211004,'Active'),
-(233937022,146382622,'Active'),(233937022,148832422,'Active'),
-(233937022,175678702,'Active'),(233937022,260507673,'Active'),
-(233937022,298998998,'Active'),(233937022,335995773,'Active'),
-(233937022,347447636,'Active'),(233937022,459295955,'Active'),
-(233937022,459376625,'Active'),(233937022,495877773,'Active'),
-(233937022,497008702,'Active'),(233937022,561944105,'Active'),
-(233937022,586535965,'Active'),(233937022,631549775,'Active'),
-(233937022,647138479,'Active'),(233937022,655870453,'Active'),
-(233937022,694832725,'Active'),(233937022,835712045,'Active'),
-(233937022,864475057,'Active'),(233937022,864484777,'Active'),
-(233937022,1010757503,'Active'),(233937022,1010847736,'Active'),
-(233937022,1091554836,'Active'),(233937022,1287437116,'Active'),
-(233937022,1337693056,'Active'),(233937022,1569279742,'Active'),
-(233937022,1569280102,'Active'),(233937022,1569280222,'Active'),
-(233937022,1569280582,'Active'),(233937022,1569280882,'Active'),
-(233937022,1569281062,'Active'),(233937022,1569281962,'Active'),
-(233937022,1569284362,'Active'),(233937022,1743317015,'Active'),
-(233937022,2698799002,'Active'),(233937022,2698800742,'Active'),
-(233937022,2823580588,'Active'),(233937022,2842066134,'Active'),
-(233937022,2904542181,'Active'),(233937022,3058483627,'Active');
-INSERT INTO t5 VALUES
-(233937022,4507287318,'Active'),(233937022,5283489892,'Active'),
-(233937022,11890554322,'Active'),(233937022,11890756102,'Active'),
-(233937022,12641851,'Active'),(233937022,14913951,'Active'),
-(233937022,21835210,'Active'),(233937022,26481052,'Active'),
-(233937022,35617681,'Active'),(233937022,123639716,'Active'),
-(233937022,155454324,'Active'),(233937022,299001668,'Active'),
-(233937022,897886118,'Active'),(233937022,1005147016,'Active'),
-(233937022,1082217873,'Active'),(233937022,1286925326,'Active'),
-(233937022,1407236408,'Active'),(233937022,4371581485,'Active'),
-(233937022,5283491332,'Active'),(233937022,7300486013,'Active'),
-(233937022,11890754392,'Active');
-
---enable_warnings
---enable_result_log
---enable_query_log
-
-set join_cache_level=8;
-set join_buffer_size=2048;
-
-EXPLAIN
-SELECT STRAIGHT_JOIN t1.id1, t1.num3, t3.text1, t3.id4, t2.id3, t4.dummy
- FROM t1 JOIN t2 JOIN t3 JOIN t4 JOIN t5
- WHERE t1.id1=t5.id1 AND t1.id2=t5.id2 and t4.id2=t1.id2 AND
- t5.enum2='Active' AND t3.id4=t2.id4 AND t2.id3=t1.id3 AND t3.text1<'D';
-
-SELECT STRAIGHT_JOIN t1.id1, t1.num3, t3.text1, t3.id4, t2.id3, t4.dummy
- FROM t1 JOIN t2 JOIN t3 JOIN t4 JOIN t5
- WHERE t1.id1=t5.id1 AND t1.id2=t5.id2 and t4.id2=t1.id2 AND
- t5.enum2='Active' AND t3.id4=t2.id4 AND t2.id3=t1.id3 AND t3.text1<'D';
-
-set join_buffer_size=default;
-set join_cache_level=default;
-
-DROP TABLE t1,t2,t3,t4,t5;
-
---echo #
---echo # Bug#45267: Incomplete check caused wrong result.
---echo #
-CREATE TABLE t1 (
- `pk` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY
-);
-CREATE TABLE t3 (
- `pk` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY
-);
-INSERT INTO t3 VALUES
-(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),
-(16),(17),(18),(19),(20);
-CREATE TABLE t2 (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `int_nokey` int(11) NOT NULL,
- `time_key` time NOT NULL,
- PRIMARY KEY (`pk`),
- KEY `time_key` (`time_key`)
-);
-INSERT INTO t2 VALUES (10,9,'22:36:46'),(11,0,'08:46:46');
-
-SELECT DISTINCT t1.`pk`
-FROM t1 RIGHT JOIN t2 STRAIGHT_JOIN t3 ON t2.`int_nokey` ON t2.`time_key`
-GROUP BY 1;
-
-DROP TABLE IF EXISTS t1, t2, t3;
-
---echo #
---echo # Bug #46328: Use of aggregate function without GROUP BY clause
---echo # returns many rows (vs. one )
---echo #
-
-CREATE TABLE t1 (
- int_key int(11) NOT NULL,
- KEY int_key (int_key)
-);
-
-INSERT INTO t1 VALUES
-(0),(2),(2),(2),(3),(4),(5),(5),(6),(6),(8),(8),(9),(9);
-
-CREATE TABLE t2 (
- int_key int(11) NOT NULL,
- KEY int_key (int_key)
-);
-
-INSERT INTO t2 VALUES (2),(3);
-
---echo
-
---echo # The query shall return 1 record with a max value 9 and one of the
---echo # int_key values inserted above (undefined which one). A changed
---echo # execution plan may change the value in the second column
-SELECT MAX(t1.int_key), t1.int_key
-FROM t1 STRAIGHT_JOIN t2
-ORDER BY t1.int_key;
-
---echo
-
-explain
-SELECT MAX(t1.int_key), t1.int_key
-FROM t1 STRAIGHT_JOIN t2
-ORDER BY t1.int_key;
-
---echo
-
-DROP TABLE t1,t2;
-
-SET join_cache_level=default;
-
---echo #
---echo # Regression test for
---echo # Bug#46733 - NULL value not returned for aggregate on empty result
---echo # set w/ semijoin on
---echo #
-
-CREATE TABLE t1 (
- i int(11) NOT NULL,
- v varchar(1) DEFAULT NULL,
- PRIMARY KEY (i)
-);
-
-INSERT INTO t1 VALUES (10,'a'),(11,'b'),(12,'c'),(13,'d');
-
-CREATE TABLE t2 (
- i int(11) NOT NULL,
- v varchar(1) DEFAULT NULL,
- PRIMARY KEY (i)
-);
-
-INSERT INTO t2 VALUES (1,'x'),(2,'y');
-
---echo
-
-SELECT MAX(t1.i)
-FROM t1 JOIN t2 ON t2.v
-ORDER BY t2.v;
-
---echo
-
-EXPLAIN
-SELECT MAX(t1.i)
-FROM t1 JOIN t2 ON t2.v
-ORDER BY t2.v;
-
---echo
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug #45092: join buffer contains two blob columns one of which is
---echo # used in the key employed to access the joined table
---echo #
-
-CREATE TABLE t1 (c1 int, c2 int, key (c2));
-INSERT INTO t1 VALUES (1,1);
-INSERT INTO t1 VALUES (2,2);
-
-CREATE TABLE t2 (c1 text, c2 text);
-INSERT INTO t2 VALUES('tt', 'uu');
-INSERT INTO t2 VALUES('zzzz', 'xxxxxxxxx');
-
---disable_result_log
-ANALYZE TABLE t1,t2;
---enable_result_log
-
-set join_cache_level=6;
-
-SELECT t1.*, t2.*, LENGTH(t2.c1), LENGTH(t2.c2) FROM t1,t2
- WHERE t1.c2=LENGTH(t2.c2) and t1.c1=LENGTH(t2.c1);
-
-set join_cache_level=default;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug #51092: linked join buffer is used for a 3-way cross join query
---echo # that selects only records of the first table
---echo #
-
-create table t1 (a int, b int);
-insert into t1 values (1,1),(2,2);
-create table t2 (a int, b int);
-insert into t2 values (1,1),(2,2);
-create table t3 (a int, b int);
-insert into t3 values (1,1),(2,2);
-
-set join_cache_level=1;
-
-explain select t1.* from t1,t2,t3;
-select t1.* from t1,t2,t3;
-
-set join_cache_level=2;
-
-explain select t1.* from t1,t2,t3;
-select t1.* from t1,t2,t3;
-
-set join_cache_level=default;
-
-drop table t1,t2,t3;
-
---echo #
---echo # Bug #52394: using join buffer for 3 table join with ref access
---echo # LP #623209: and no references to the columns of the middle table
---echo #
-
-
-set join_cache_level=6;
-
-CREATE TABLE t1 (a int(11), b varchar(1));
-INSERT INTO t1 VALUES (6,'r'),(27,'o');
-
-CREATE TABLE t2(a int);
-INSERT INTO t2 VALUES(1),(2),(3),(4),(5);
-
-CREATE TABLE t3 (a int(11) primary key, b varchar(1));
-INSERT INTO t3 VALUES
-(14,'d'),(15,'z'),(16,'e'),(17,'h'),(18,'b'),(19,'s'),(20,'e'),
-(21,'j'),(22,'e'),(23,'f'),(24,'v'),(25,'x'),(26,'m'),(27,'o');
-
-EXPLAIN
-SELECT t3.a FROM t1,t2,t3 WHERE t1.a = t3.a AND t1.b = t3.b;
-SELECT t3.a FROM t1,t2,t3 WHERE t1.a = t3.a AND t1.b = t3.b;
-
-DROP TABLE t1,t2,t3;
-
-set join_cache_level=default;
-
---echo #
---echo # Bug #51084: Batched key access crashes for SELECT with
---echo # derived table and LEFT JOIN
---echo #
-
-CREATE TABLE t1 (
- carrier int,
- id int PRIMARY KEY
-);
-INSERT INTO t1 VALUES (1,11),(1,12),(2,13);
-
-CREATE TABLE t2 (
- scan_date int,
- package_id int
-);
-INSERT INTO t2 VALUES (2008,21),(2008,22);
-
-CREATE TABLE t3 (
- carrier int PRIMARY KEY,
- id int
-);
-INSERT INTO t3 VALUES (1,31);
-
-CREATE TABLE t4 (
- carrier_id int,
- INDEX carrier_id(carrier_id)
-);
-INSERT INTO t4 VALUES (31),(32);
-
-SET join_cache_level=8;
-
-SELECT COUNT(*)
- FROM (t2 JOIN t1) LEFT JOIN (t3 JOIN t4 ON t3.id = t4.carrier_id)
- ON t3.carrier = t1.carrier;
-
-EXPLAIN
-SELECT COUNT(*)
- FROM (t2 JOIN t1) LEFT JOIN (t3 JOIN t4 ON t3.id = t4.carrier_id)
- ON t3.carrier = t1.carrier;
-
-SET join_cache_level=default;
-
-DROP TABLE t1,t2,t3,t4;
-
---echo #
---echo # Bug #52636: allowing JOINs on NULL values w/ join_cache_level = 5-8
---echo #
-
-CREATE TABLE t1 (b int);
-INSERT INTO t1 VALUES (NULL),(3);
-
-CREATE TABLE t2 (a int, b int, KEY (b));
-INSERT INTO t2 VALUES
- (100,NULL),(150,200),(50,150),(250,350),(180,210),(100,150),
- (101,NULL),(151,200),(51,150),(251,350),(181,210),(101,150);
-
-set join_cache_level = 5;
-explain SELECT t2.a FROM t1 LEFT JOIN t2 ON t2.b = t1.b;
---sorted_result
-SELECT t2.a FROM t1 LEFT JOIN t2 ON t2.b = t1.b;
-
-set join_cache_level = 8;
-explain SELECT t2.a FROM t1 LEFT JOIN t2 ON t2.b = t1.b;
---sorted_result
-SELECT t2.a FROM t1 LEFT JOIN t2 ON t2.b = t1.b;
-
-# test crash when no key is worth collecting by BKA for t2's ref
-delete from t1;
-INSERT INTO t1 VALUES (NULL),(NULL);
-set join_cache_level = 5;
-explain SELECT t2.a FROM t1 LEFT JOIN t2 ON t2.b = t1.b;
---sorted_result
-SELECT t2.a FROM t1 LEFT JOIN t2 ON t2.b = t1.b;
-
-DROP TABLE t1,t2;
-
-# test varchar keys
-CREATE TABLE t1 (b varchar(100));
-INSERT INTO t1 VALUES (NULL),("some varchar");
-
-CREATE TABLE t2 (a int, b varchar(100), KEY (b));
-INSERT INTO t2 VALUES (100,NULL),(150,"varchar"),(200,NULL),(250,"long long varchar");
-INSERT INTO t2 VALUES (100,NULL),(150,"long varchar"),(200,"varchar"),(250,"long long long varchar");
-
-set join_cache_level = 5;
-explain SELECT t2.a FROM t1 LEFT JOIN t2 ON t2.b = t1.b;
---sorted_result
-SELECT t2.a FROM t1 LEFT JOIN t2 ON t2.b = t1.b;
-
-set join_cache_level = 8;
-explain SELECT t2.a FROM t1 LEFT JOIN t2 ON t2.b = t1.b;
---sorted_result
-SELECT t2.a FROM t1 LEFT JOIN t2 ON t2.b = t1.b;
-
-set join_cache_level = default;
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug #54359: Extra rows with join_cache_level=7,8 and two joins
---echo # and multi-column index"
---echo #
-
-CREATE TABLE t1 (
- pk int NOT NULL,
- a int DEFAULT NULL,
- b varchar(16) DEFAULT NULL,
- c varchar(16) DEFAULT NULL,
- INDEX idx (b,a))
-;
-
-INSERT INTO t1 VALUES (4,9,'k','k');
-INSERT INTO t1 VALUES (12,5,'k','k');
-
-set join_cache_level = 8;
-
-EXPLAIN
-SELECT t.a FROM t1 t, t1 s FORCE INDEX(idx)
- WHERE s.pk AND s.a >= t.pk AND s.b = t.c;
-
-SELECT t.a FROM t1 t, t1 s FORCE INDEX(idx)
- WHERE s.pk AND s.a >= t.pk AND s.b = t.c;
-
-set join_cache_level = default;
-DROP TABLE t1;
-
---echo #
---echo # Bug #54235: Extra rows with join_cache_level=6,8 and two LEFT JOINs
---echo #
-
-CREATE TABLE t1 (a int);
-CREATE TABLE t2 (a int);
-CREATE TABLE t3 (a int);
-CREATE TABLE t4 (a int);
-
-INSERT INTO t1 VALUES (null), (2), (null), (1);
-
-set join_cache_level = 6;
-EXPLAIN
-SELECT t1.a
- FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON t2.a) ON 0
- WHERE t1.a OR t3.a;
-SELECT t1.a
- FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON t2.a) ON 0
- WHERE t1.a OR t3.a;
-
-EXPLAIN
-SELECT t1.a
- FROM t1 LEFT JOIN (t2 LEFT JOIN (t3 LEFT JOIN t4 ON 1) ON t2.a) ON 0
- WHERE t1.a OR t4.a;
-SELECT t1.a
- FROM t1 LEFT JOIN (t2 LEFT JOIN (t3 LEFT JOIN t4 ON 1) ON t2.a) ON 0
- WHERE t1.a OR t4.a;
-
-set join_cache_level = default;
-DROP TABLE t1,t2,t3,t4;
-
---echo #
---echo # Bug #663840: Memory overwrite causing crash with hash join
---echo #
-
-SET SESSION join_cache_level=3;
-SET SESSION join_buffer_size=100;
-
-CREATE TABLE t3 (
- i int NOT NULL,
- j int NOT NULL,
- d date NOT NULL,
- t time NOT NULL,
- v varchar(1) NOT NULL,
- u varchar(1) NOT NULL,
- INDEX idx (v)
-) COLLATE=latin1_bin;
-
-INSERT INTO t3 VALUES
- (3,8,'2008-12-04','00:00:00','v','v'), (3,8,'2009-03-28','00:00:00','f','f'),
- (3,5,'1900-01-01','00:55:47','v','v'), (2,8,'2009-10-02','00:00:00','s','s'),
- (1,8,'1900-01-01','20:51:59','a','a'), (0,6,'2008-06-04','09:47:27','p','p'),
- (8,7,'2009-01-13','21:58:29','z','z'), (5,2,'1900-01-01','22:45:53','a','a'),
- (9,5,'2008-01-28','14:06:48','h','h'), (5,7,'2004-09-18','22:17:16','h','h'),
- (4,2,'2006-10-14','14:59:37','v','v'), (2,9,'1900-01-01','23:37:40','v','v'),
- (33,142,'2000-11-28','14:14:01','b','b'), (5,3,'2008-04-04','02:54:19','y','y'),
- (1,0,'2002-07-13','06:34:26','v','v'), (9,3,'2003-01-03','18:07:38','m','m'),
- (1,5,'2006-04-02','13:55:23','z','z'), (3,9,'2006-10-19','20:32:28','n','n'),
- (8,1,'2005-06-08','11:57:44','d','d'), (231,107,'2006-12-26','03:10:35','a','a');
-INSERT INTO t3 VALUES
- (103,108,'2008-12-04','00:00:00','a','v'), (103,108,'2009-03-28','00:00:00','b','f'),
- (103,105,'1900-01-01','00:55:47','c','v'), (102,108,'2009-10-02','00:00:00','d','s'),
- (100,108,'1900-01-01','20:51:59','e','a'), (100,106,'2008-06-04','09:47:27','f','p'),
- (108,107,'2009-01-13','21:58:29','g','z'), (105,102,'1900-01-01','22:45:53','h','a'),
- (109,105,'2008-01-28','14:06:48','i','h'), (105,107,'2004-09-18','22:17:16','j','h'),
- (104,102,'2006-10-14','14:59:37','k','v'), (102,109,'1900-01-01','23:37:40','l','v'),
- (1033,1142,'2000-11-28','14:14:01','m','b'), (105,103,'2008-04-04','02:54:19','n','y'),
- (100,100,'2002-07-13','06:34:26','o','v'), (109,103,'2003-01-03','18:07:38','p','m'),
- (100,105,'2006-04-02','13:55:23','q','z'), (103,109,'2006-10-19','20:32:28','s','n'),
- (108,100,'2005-06-08','11:57:44','t','d'), (1231,1107,'2006-12-26','03:10:35','v','a');
-
-CREATE TABLE t1 SELECT * FROM t3;
-DELETE FROM t1 WHERE i > 8;
-CREATE TABLE t2 SELECT * FROM t3;
-DELETE FROM t2 WHERE j > 10;
-
-EXPLAIN
-SELECT t1.i, t1.d, t1.v, t2.i, t2.d, t2.t, t2.v FROM t1,t2,t3
- WHERE t3.u <='a' AND t2.j < 5 AND t3.v = t2.u;
-
---sorted_result
-SELECT t1.i, t1.d, t1.v, t2.i, t2.d, t2.t, t2.v FROM t1,t2,t3
- WHERE t3.u <='a' AND t2.j < 5 AND t3.v = t2.u;
-
-DROP TABLE t1,t2,t3;
-
-SET SESSION join_cache_level=DEFAULT;
-SET SESSION join_buffer_size=DEFAULT;
-
-
---echo #
---echo # Bug #664508: 'Simple' GROUP BY + ORDER BY
---echo # when join buffers are used
---echo #
-
-CREATE TABLE t1 (
- pk int NOT NULL, i int NOT NULL, v varchar(1) NOT NULL,
- PRIMARY KEY (pk), INDEX idx1(i), INDEX idx2 (v,i)
-) COLLATE latin1_bin;
-INSERT INTO t1 VALUES
- (10,8,'v'), (11,8,'f'), (13,8,'s'), (14,8,'a'),
- (15,6,'p'), (16,7,'z'), (17,2,'a'), (18,5,'h'), (19,7,'h'),
- (25,3,'m'), (26,5,'a'), (27,9,'n'), (28,1,'d'), (29,107,'a');
-INSERT INTO t1 VALUES
- (110,8,'x'), (111,8,'y'), (112,5,'v'), (113,8,'z'), (114,8,'i'),
- (115,6,'j'), (116,7,'t'), (117,2,'b'), (118,5,'j'), (119,7,'w'),
- (125,3,'q'), (126,5,'o'), (127,9,'n'), (128,1,'e'), (129,107,'c');
-INSERT INTO t1 VALUES
- (210,8,'b'), (211,8,'c'), (212,5,'d'), (213,8,'e'), (214,8,'g'),
- (215,6,'f'), (216,7,'h'), (217,2,'i'), (218,5,'j'), (219,7,'k'),
- (225,3,'l'), (226,5,'m'), (227,9,'n'), (228,1,'o'), (229,107,'p');
-
-CREATE TABLE t2 (
- pk int NOT NULL, i int NOT NULL, v varchar(1) NOT NULL,
- PRIMARY KEY (pk), INDEX idx1(i), INDEX idx2(v,i)
-) COLLATE latin1_bin;
-INSERT INTO t2 VALUES
- (10,8,'v'), (11,8,'f'), (12,5,'v'), (13,8,'s'), (14,8,'a'),
- (15,6,'p'), (16,7,'z'), (17,2,'a'), (18,5,'h'), (19,7,'h'),
- (20,2,'v'), (21,9,'v'), (22,142,'b'), (23,3,'y'), (24,0,'v'),
- (25,3,'m'), (26,5,'b'), (27,9,'n'), (28,1,'d'), (29,107,'a');
-
-CREATE TABLE t3 (
- pk int NOT NULL, i int NOT NULL, v varchar(1) NOT NULL,
- PRIMARY KEY (pk), INDEX idx1(i), INDEX idx2(v,i)
-) COLLATE latin1_bin;
-INSERT INTO t3 VALUES
- (1,9,'x'), (2,5,'g'), (3,1,'o'), (4,0,'g'), (5,1,'v'),
- (6,190,'m'), (7,6,'x'), (8,3,'c'), (9,4,'z'), (10,3,'i'),
- (11,186,'x'), (12,1,'g'), (13,8,'q'), (14,226,'m'), (15,133,'p'),
- (16,6,'e'), (17,3,'t'), (18,8,'j'), (19,5,'h'), (20,7,'w');
-
-SET SESSION join_cache_level=1;
-EXPLAIN
-SELECT t2.v FROM t1, t2, t3
-WHERE t3.v <> t2.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
- GROUP BY t2.v ORDER BY t1.pk,t2.v;
-SELECT t2.v FROM t1, t2, t3
-WHERE t3.v <> t2.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
- GROUP BY t2.v ORDER BY t1.pk,t2.v;
-
-# MDEV-8189 field<>const and const<>field are not symmetric
-# Do the same EXPLAIN and SELECT
-# for "t2.v <> t3.v" instead of "t3.v <> t2.v"
-
-EXPLAIN
-SELECT t2.v FROM t1, t2, t3
-WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
- GROUP BY t2.v ORDER BY t1.pk,t2.v;
-SELECT t2.v FROM t1, t2, t3
-WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
- GROUP BY t2.v ORDER BY t1.pk,t2.v;
-
-SET SESSION join_cache_level=6;
-EXPLAIN
-SELECT t2.v FROM t1, t2, t3
-WHERE t3.v <> t2.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
- GROUP BY t2.v ORDER BY t1.pk,t2.v;
-SELECT t2.v FROM t1, t2, t3
-WHERE t3.v <> t2.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
- GROUP BY t2.v ORDER BY t1.pk,t2.v;
-
-# MDEV-8189 field<>const and const<>field are not symmetric
-# Do the same EXPLAIN and SELECT
-# for "t2.v <> t3.v" instead of "t3.v <> t2.v"
-EXPLAIN
-SELECT t2.v FROM t1, t2, t3
-WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
- GROUP BY t2.v ORDER BY t1.pk,t2.v;
-SELECT t2.v FROM t1, t2, t3
-WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
- GROUP BY t2.v ORDER BY t1.pk,t2.v;
-
-SET SESSION join_cache_level=4;
-EXPLAIN
-SELECT t2.v FROM t1, t2, t3
-WHERE t3.v <> t2.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
- GROUP BY t2.v ORDER BY t1.pk,t2.v;
-SELECT t2.v FROM t1, t2, t3
-WHERE t3.v <> t2.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
- GROUP BY t2.v ORDER BY t1.pk,t2.v;
-
-# MDEV-8189 field<>const and const<>field are not symmetric
-# Do the same EXPLAIN and SELECT
-# for "t2.v <> t3.v" instead of "t3.v <> t2.v"
-EXPLAIN
-SELECT t2.v FROM t1, t2, t3
-WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
- GROUP BY t2.v ORDER BY t1.pk,t2.v;
-SELECT t2.v FROM t1, t2, t3
-WHERE t2.v <> t3.v AND t3.pk = t2.i AND t1.v = t3.v AND t1.pk*2<100
- GROUP BY t2.v ORDER BY t1.pk,t2.v;
-
-DROP TABLE t1,t2,t3;
-
-SET SESSION join_cache_level=DEFAULT;
-
---echo #
---echo # Bug #668290: hash join with non-binary collations
---echo #
-
-CREATE TABLE t1 (
- i int DEFAULT NULL,
- cl varchar(10) CHARACTER SET latin1 DEFAULT NULL,
- cu varchar(10) CHARACTER SET utf8 DEFAULT NULL,
- INDEX cl (cl),
- INDEX cu (cu)
-);
-INSERT INTO t1 VALUES
- (650903552,'cmxffkpsel','z'), (535298048,'tvtjrcmxff','y'),
- (1626865664,'when','for'), (39649280,'rcvljitvtj','ercvljitvt'),
- (792068096,'ttercvljit','jttercvlji');
-INSERT INTO t1 SELECT * FROM t1;
-
-CREATE TABLE t2 (
- cu varchar(10) CHARACTER SET utf8 DEFAULT NULL,
- i int DEFAULT NULL,
- cl varchar(10) CHARACTER SET latin1 DEFAULT NULL,
- INDEX cu (cu),
- INDEX cl (cl)
-);
-INSERT INTO t2 VALUES
- ('g',7,'like'), ('fujttercvl',6,'y'),
- ('s',2,'e'), ('didn\'t',0,'v'),
- ('gvdrodpedk',8,'chogvdrodp'), ('jichogvdro',7,'will');
-
-EXPLAIN
-SELECT t2.i FROM t1,t2 WHERE t1.cu = t2.cl ;
-SELECT t2.i FROM t1,t2 WHERE t1.cu = t2.cl ;
-
-SET SESSION join_cache_level = 4;
-
-EXPLAIN
-SELECT t2.i FROM t1,t2 WHERE t1.cu = t2.cl ;
-SELECT t2.i FROM t1,t2 WHERE t1.cu = t2.cl ;
-
-SET SESSION join_cache_level = DEFAULT;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug #669382: hash join using a ref with constant key parts
---echo #
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES
- (9), (11), (7), (8), (4), (1), (12), (3), (5);
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO t1 SELECT * FROM t1;
-
-CREATE TABLE t2 (a int, b int, c int, INDEX idx (a,b));
-INSERT INTO t2 VALUES
- (8, 80, 800), (1, 10, 100), (1, 11, 101), (3, 30, 300),
- (1, 12, 102), (8, 81, 801), (7, 70, 700), (12, 120, 1200),
- (8, 82, 802), (1, 13, 103), (1, 14, 104), (3, 31, 301),
- (1, 15, 105), (8, 83, 803), (7, 71, 701);
-
-SET SESSION join_cache_level = 4;
-SET SESSION join_buffer_size = 256;
-
-EXPLAIN
-SELECT t1.a, t2.c FROM t1,t2 WHERE t1.a=t2.a AND t2.b=99;
-SELECT t1.a, t2.c FROM t1,t2 WHERE t1.a=t2.a AND t2.b=99;
-
-SET SESSION join_cache_level = DEFAULT;
-SET SESSION join_buffer_size = DEFAULT;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug #671901: hash join using a ref to a varchar field
---echo #
-
-CREATE TABLE t1 (
- v varchar(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL,
- i int DEFAULT NULL
-);
-INSERT INTO t1 VALUES
- ('k',8), ('abcdefjh',-575340544), ('f',77), ('because', 2), ('f',-517472256),
- ('abcdefjhj',5), ('z',7);
-
-CREATE TABLE t2 (
- v varchar(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL,
- i int DEFAULT NULL,
- INDEX idx (v)
-);
-INSERT INTO t2 VALUES
- ('did',5), ('was',-1631322112), ('are',3), ('abcdefjhjk',3),
- ('abcdefjhjk',4), ('tell',-824573952), ('t',0),('v',-1711013888),
- ('abcdefjhjk',1015414784), ('or',4), ('now',0), ('abcdefjhjk',-32702464),
- ('abcdefjhjk',4), ('time',1078394880), ('f',4), ('m',-1845559296),
- ('ff', 5), ('abcdefjhjk',-1074397184);
-INSERT INTO t2 VALUES
- ('dig',5), ('were',-1631322112), ('is',3), ('abcdefjhjl',3),
- ('abcdefjh',4), ('told',-824573952), ('tt',0),('vv',-1711013888),
- ('abcdefjhjj',1015414784), ('and',4), ('here',0), ('abcdefjhjm',-32702464),
- ('abcdefjhji',4), ('space',1078394880), ('fs',4), ('mn',-1845559296),
- ('fq', 5), ('abcdefjhjp',-1074397184);
-
-EXPLAIN
-SELECT t1.v,t2.i FROM t1,t2 WHERE t2.v = t1.v;
-SELECT t1.v,t2.i FROM t1,t2 WHERE t2.v = t1.v;
-EXPLAIN
-SELECT t1.v,t2.i FROM t1,t2 WHERE t2.v = concat(t1.v, t1.v);
-SELECT t1.v,t2.i FROM t1,t2 WHERE t2.v = concat(t1.v, t1.v);
-
-SET SESSION join_cache_level = 4;
-EXPLAIN
-SELECT t1.v,t2.i FROM t1,t2 WHERE t2.v = t1.v;
-SELECT t1.v,t2.i FROM t1,t2 WHERE t2.v = t1.v;
-EXPLAIN
-SELECT t1.v,t2.i FROM t1,t2 WHERE t2.v = concat(t1.v, t1.v);
-SELECT t1.v,t2.i FROM t1,t2 WHERE t2.v = concat(t1.v, t1.v);
-
-SET SESSION join_cache_level = DEFAULT;
-
-DROP TABLE t1,t2;
-
-#--echo #
---echo # Bug #672497: 3 way join with tiny incremental join buffer with
---echo # and a ref access from the first table
---echo #
-
-CREATE TABLE t1 (
- pk int PRIMARY KEY,
- v varchar(10) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL,
- INDEX idx (v)
-);
-INSERT INTO t1 VALUES
- (1,'abcdefjhjk'), (2,'i'),(3,'abcdefjhjk'), (4,'well'), (5,'abcdefjhjk'),
- (6,'abcdefjhjk'), (7,'that');
-
-CREATE TABLE t2 (
- pk int PRIMARY KEY,
- i int DEFAULT NULL,
- v varchar(1000) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL,
- INDEX idx (v)
-);
-INSERT INTO t2 VALUES
- (1,6,'yes'), (2,NULL,'will'), (3,NULL,'o'), (4,NULL,'k'), (5,NULL,'she'),
- (6,-1450835968,'abcdefjhjkl'), (7,-975831040,'abcdefjhjkl'), (8,NULL,'z'),
- (10,-343932928,'t'),
- (11,6,'yes'), (12,NULL,'will'), (13,NULL,'o'), (14,NULL,'k'), (15,NULL,'she'),
- (16,-1450835968,'abcdefjhjkl'), (17,-975831040,'abcdefjhjkl'), (18,NULL,'z'),
- (19,-343932928,'t');
-INSERT INTO t2 VALUES
- (101,6,'yes'), (102,NULL,'will'), (103,NULL,'o'), (104,NULL,'k'), (105,NULL,'she'),
- (106,-1450835968,'abcdefjhjkl'), (107,-975831040,'abcdefjhjkl'), (108,NULL,'z'),
- (100,-343932928,'t'),
- (111,6,'yes'), (112,NULL,'will'), (113,NULL,'o'), (114,NULL,'k'), (115,NULL,'she'),
- (116,-1450835968,'abcdefjhjkl'), (117,-975831040,'abcdefjhjkl'), (118,NULL,'z'),
- (119,-343932928,'t');
-
-CREATE TABLE t3 (
- pk int NOT NULL PRIMARY KEY,
- i int,
- v varchar(1024) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
- INDEX idx (v(333))
-);
-INSERT INTO t3 VALUES
-(1,7,'abcdefjhjkl'),(2,6,'y'), (3,NULL,'to'),(4,7,'n'),(5,7,'look'), (6,NULL,'all'),
-(7,1443168256,'c'), (8,1427046400,'right'),
-(11,7,'abcdefjhjkl'), (12,6,'y'), (13,NULL,'to'), (14,7,'n'), (15,7,'look'),
-(16,NULL,'all'), (17,1443168256,'c'), (18,1427046400,'right'),
-(21,7,'abcdefjhjkl'), (22,6,'y'), (23,NULL,'to'), (24,7,'n'), (25,7,'look'),
-(26,NULL,'all'), (27,1443168256,'c'), (28,1427046400,'right'),
-(31,7,'abcdefjhjkl'), (32,6,'y'), (33,NULL,'to'), (34,7,'n'), (35,7,'look'),
-(36,NULL,'all'), (37,1443168256,'c'), (38,1427046400,'right');
-INSERT INTO t3 VALUES
-(101,7,'abcdefjhjkl'),(102,6,'y'), (103,NULL,'to'),(104,7,'n'),(105,7,'look'),
-(106,NULL,'all'), (107,1443168256,'c'), (108,1427046400,'right'),
-(111,7,'abcdefjhjkl'), (112,6,'y'), (113,NULL,'to'), (114,7,'n'), (115,7,'look'),
-(116,NULL,'all'), (117,1443168256,'c'), (118,1427046400,'right'),
-(121,7,'abcdefjhjkl'), (122,6,'y'), (123,NULL,'to'), (124,7,'n'), (125,7,'look'),
-(126,NULL,'all'), (127,1443168256,'c'), (128,1427046400,'right'),
-(131,7,'abcdefjhjkl'), (132,6,'y'), (133,NULL,'to'), (134,7,'n'), (135,7,'look'),
-(136,NULL,'all'), (137,1443168256,'c'), (138,1427046400,'right');
-
-SET SESSION join_buffer_size = 256;
-
-SET SESSION join_cache_level = 4;
-EXPLAIN
-SELECT t3.i FROM t1,t2,t3
- WHERE t1.v = t2.v AND t3.v = t1.v AND t2.i <> 0;
-SELECT t3.i FROM t1,t2,t3
- WHERE t1.v = t2.v AND t3.v = t1.v AND t2.i <> 0;
-
-SET SESSION join_cache_level = DEFAULT;
-SET SESSION join_buffer_size = DEFAULT;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # Bug #672551: hash join over a long varchar field
---echo #
-
-CREATE TABLE t1 (
- pk int PRIMARY KEY,
- a varchar(512) CHARSET latin1 COLLATE latin1_bin DEFAULT NULL,
- INDEX idx (a)
-);
-INSERT INTO t1 VALUES (2, 'aa'), (5, 'ccccccc'), (3, 'bb');
-
-CREATE TABLE t2(
- pk int PRIMARY KEY,
- a varchar(512) CHARSET latin1 COLLATE latin1_bin DEFAULT NULL,
- INDEX idx (a)
-);
-INSERT INTO t2 VALUES
- (10, 'a'), (20, 'c'), (30, 'aa'), (4, 'bb'),
- (11, 'a'), (21, 'c'), (31, 'aa'), (41, 'cc'),
- (12, 'a'), (22, 'c'), (32, 'bb'), (42, 'aa');
-INSERT INTO t2 VALUES
- (110, 'a'), (120, 'c'), (130, 'aa'), (14, 'bb'),
- (111, 'a'), (121, 'c'), (131, 'aa'), (141, 'cc'),
- (112, 'a'), (122, 'c'), (132, 'bb'), (142, 'aa');
-
-SELECT * FROM t1,t2 WHERE t2.a=t1.a;
-
-SET SESSION join_cache_level = 4;
-EXPLAIN
-SELECT * FROM t1,t2 WHERE t2.a=t1.a;
-SELECT * FROM t1,t2 WHERE t2.a=t1.a;
-
-SET SESSION join_cache_level = DEFAULT;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug #674431: nested outer join when join_cache_level is set to 7
---echo #
-
-CREATE TABLE t1 (a int, b varchar(32)) ;
-INSERT INTO t1 VALUES (5,'h'), (NULL,'j');
-CREATE TABLE t2 (a int, b varchar(32), c int) ;
-INSERT INTO t2 VALUES (5,'h',100), (NULL,'j',200);
-CREATE TABLE t3 (a int, b varchar(32), INDEX idx(b));
-INSERT INTO t3 VALUES (77,'h'), (88,'g');
-
-SET SESSION optimizer_switch = 'outer_join_with_cache=on';
-SET SESSION join_cache_level = 7;
-SELECT t3.a
- FROM t1 LEFT JOIN
- (t2 LEFT OUTER JOIN t3 ON t2.b = t3.b) ON t2.a = t1.b
- WHERE t3.a BETWEEN 3 AND 11 OR t1.a <= t2.c;
-
-SET SESSION optimizer_switch = 'outer_join_with_cache=off';
-SET SESSION join_cache_level = DEFAULT;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # Bug #52540: nested outer join when join_cache_level is set to 3
---echo #
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (2);
-CREATE TABLE t2 (a varchar(10));
-INSERT INTO t2 VALUES ('f'),('x');
-CREATE TABLE t3 (pk int(11) PRIMARY KEY);
-INSERT INTO t3 VALUES (2);
-CREATE TABLE t4 (a varchar(10));
-
-SET SESSION optimizer_switch = 'outer_join_with_cache=on';
-SET SESSION join_cache_level = 3;
-
-SELECT *
- FROM t2 LEFT JOIN
- ((t1 JOIN t3 ON t1.a = t3.pk) LEFT JOIN t4 ON 1) ON 1;
-
-SET SESSION optimizer_switch = 'outer_join_with_cache=off';
-SET SESSION join_cache_level = DEFAULT;
-
-DROP TABLE t1,t2,t3,t4;
-
---echo #
---echo # Bug #674423: outer join with ON expression over only outer tables
---echo #
-
-CREATE TABLE t1 (a int) ;
-INSERT INTO t1 VALUES ('9');
-
-CREATE TABLE t2 (pk int, a int) ;
-INSERT INTO t2 VALUES ('9',NULL), ('1',NULL);
-
-SET SESSION optimizer_switch = 'outer_join_with_cache=on';
-
-SET SESSION join_cache_level = 0;
-EXPLAIN
-SELECT * FROM t2 LEFT JOIN t1 ON t2.a <> 0 WHERE t1.a <> 0 OR t2.pk < 9;
-SELECT * FROM t2 LEFT JOIN t1 ON t2.a <> 0 WHERE t1.a <>0 OR t2.pk < 9;
-
-SET SESSION join_cache_level = 1;
-EXPLAIN
-SELECT * FROM t2 LEFT JOIN t1 ON t2.a <> 0 WHERE t1.a <> 0 OR t2.pk < 9;
-SELECT * FROM t2 LEFT JOIN t1 ON t2.a <> 0 WHERE t1.a <> 0 OR t2.pk < 9;
-
-SET SESSION optimizer_switch = 'outer_join_with_cache=off';
-SET SESSION join_cache_level = DEFAULT;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug #675095: nested outer join using join buffer
---echo #
-
-CREATE TABLE t1 (pk int, a1 int) ;
-INSERT IGNORE INTO t1 VALUES (2,NULL), (8,0);
-
-CREATE TABLE t2 (pk int, a2 int, c2 int, d2 int) ;
-INSERT IGNORE INTO t2 VALUES (9,0,0,2), (1,0,0,7);
-
-CREATE TABLE t3 (pk int, a3 int, c3 int, d3 int) ;
-INSERT IGNORE INTO t3 VALUES (9,0,0,2), (1,0,0,7);
-
-CREATE TABLE t4 (pk int, a4 int, INDEX idx(a4)) ;
-INSERT IGNORE INTO t4 VALUES (2,NULL), (8,0);
-INSERT IGNORE INTO t4 VALUES (12,10), (18,20);
-INSERT IGNORE INTO t4 VALUES (22,11), (28,21);
-INSERT IGNORE INTO t4 VALUES (32,12), (38,22);
-
-CREATE TABLE t5 (pk int, a5 int) ;
-INSERT IGNORE INTO t5 VALUES (2,0), (8,0);
-
-
-SET SESSION optimizer_switch = 'outer_join_with_cache=on';
-
-SET SESSION join_cache_level = 0;
-
-EXPLAIN EXTENDED
-SELECT *
- FROM ((t1 LEFT JOIN (t2 JOIN t3 ON t2.c2 = t3.a3) ON t1.pk = t2.d2)
- LEFT JOIN t4 ON t1.a1 = t4.a4) LEFT JOIN t5 ON t3.a3 = t5.a5;
-SELECT *
- FROM ((t1 LEFT JOIN (t2 JOIN t3 ON t2.c2 = t3.a3) ON t1.pk = t2.d2)
- LEFT JOIN t4 ON t1.a1 = t4.a4) LEFT JOIN t5 ON t3.a3 = t5.a5;
-
-SET SESSION join_cache_level = 2;
-
-EXPLAIN EXTENDED
-SELECT *
- FROM ((t1 LEFT JOIN (t2 JOIN t3 ON t2.c2 = t3.a3) ON t1.pk = t2.d2)
- LEFT JOIN t4 ON t1.a1 = t4.a4) LEFT JOIN t5 ON t3.a3 = t5.a5;
-SELECT *
- FROM ((t1 LEFT JOIN (t2 JOIN t3 ON t2.c2 = t3.a3) ON t1.pk = t2.d2)
- LEFT JOIN t4 ON t1.a1 = t4.a4) LEFT JOIN t5 ON t3.a3 = t5.a5;
-
-SET SESSION join_cache_level = 1;
-
-EXPLAIN EXTENDED
-SELECT *
- FROM ((t1 LEFT JOIN (t2 JOIN t3 ON t2.c2 = t3.a3) ON t1.pk = t2.d2)
- LEFT JOIN t4 ON t1.a1 = t4.a4) LEFT JOIN t5 ON t3.a3 = t5.a5;
-SELECT *
- FROM ((t1 LEFT JOIN (t2 JOIN t3 ON t2.c2 = t3.a3) ON t1.pk = t2.d2)
- LEFT JOIN t4 ON t1.a1 = t4.a4) LEFT JOIN t5 ON t3.a3 = t5.a5;
-
-SET SESSION optimizer_switch = 'outer_join_with_cache=off';
-SET SESSION join_cache_level = DEFAULT;
-
-DROP TABLE t1,t2,t3,t4,t5;
-
---echo #
---echo # Bug #675516: nested outer join with 3 tables in the nest
---echo # using BNL + BNLH
---echo #
-
-CREATE TABLE t1 (a1 int, b1 int, c1 int) ;
-INSERT INTO t1 VALUES (7,8,0), (6,4,0);
-
-CREATE TABLE t2 (a2 int) ;
-INSERT INTO t2 VALUES (5);
-
-CREATE TABLE t3 (a3 int, b3 int, c3 int, PRIMARY KEY (b3)) ;
-INSERT INTO t3 VALUES (2,5,0);
-
-CREATE TABLE t4 (a4 int, b4 int, c4 int) ;
-INSERT INTO t4 VALUES (7,8,0);
-
-SET SESSION optimizer_switch = 'outer_join_with_cache=on';
-
-SET SESSION join_cache_level = 4;
-EXPLAIN
-SELECT * FROM
- t1 LEFT JOIN
- ((t2 JOIN t3 ON t2.a2 = t3.b3) JOIN t4 ON t4.b4 <> 0) ON t1.c1 = t3.c3
- WHERE t3.a3 IS NULL;
-SELECT * FROM
- t1 LEFT JOIN
- ((t2 JOIN t3 ON t2.a2 = t3.b3) JOIN t4 ON t4.b4 <> 0) ON t1.c1 = t3.c3
- WHERE t3.a3 IS NULL;
-
-SET SESSION join_cache_level = 0;
-EXPLAIN
-SELECT * FROM
- t1 LEFT JOIN
- ((t2 JOIN t3 ON t2.a2 = t3.b3) JOIN t4 ON t4.b4 <> 0) ON t1.c1 = t3.c3
- WHERE t3.a3 IS NULL;
-SELECT * FROM
- t1 LEFT JOIN
- ((t2 JOIN t3 ON t2.a2 = t3.b3) JOIN t4 ON t4.b4 <> 0) ON t1.c1 = t3.c3
- WHERE t3.a3 IS NULL;
-
-SET SESSION optimizer_switch = 'outer_join_with_cache=off';
-SET SESSION join_cache_level = DEFAULT;
-
-DROP TABLE t1,t2,t3,t4;
-
---echo #
---echo # Bug #660963: nested outer join with join_cache_level set to 5
---echo #
-
-CREATE TABLE t1 (a1 int) ;
-INSERT INTO t1 VALUES (0),(0);
-
-CREATE TABLE t2 (a2 int, b2 int, PRIMARY KEY (a2)) ;
-INSERT INTO t2 VALUES (2,1);
-
-CREATE TABLE t3 (a3 int, b3 int, PRIMARY KEY (a3)) ;
-INSERT INTO t3 VALUES (2,1);
-
-SET SESSION optimizer_switch = 'outer_join_with_cache=on';
-
-SET SESSION join_cache_level = 6;
-EXPLAIN
-SELECT * FROM t1 LEFT JOIN t2 JOIN t3 ON t3.a3 = t2.a2 ON t3.b3 <> 0;
-SELECT * FROM t1 LEFT JOIN t2 JOIN t3 ON t3.a3 = t2.a2 ON t3.b3 <> 0;
-
-SET SESSION join_cache_level = 5;
-EXPLAIN
-SELECT * FROM t1 LEFT JOIN t2 JOIN t3 ON t3.a3 = t2.a2 ON t3.b3 <> 0;
-SELECT * FROM t1 LEFT JOIN t2 JOIN t3 ON t3.a3 = t2.a2 ON t3.b3 <> 0;
-
-SET SESSION optimizer_switch = 'outer_join_with_cache=off';
-SET SESSION join_cache_level = DEFAULT;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # Bug #675922: incremental buffer for BKA with access from previous
---echo # buffers from non-nullable columns whose values may be null
---echo #
-
-CREATE TABLE t1 (a1 varchar(32)) ;
-INSERT INTO t1 VALUES ('s'),('k');
-
-CREATE TABLE t2 (a2 int PRIMARY KEY, b2 varchar(32)) ;
-INSERT INTO t2 VALUES (7,'s');
-
-CREATE TABLE t3 (a3 int PRIMARY KEY, b3 varchar(32)) ;
-INSERT INTO t3 VALUES (7,'s');
-
-CREATE TABLE t4 (a4 int) ;
-INSERT INTO t4 VALUES (9);
-
-CREATE TABLE t5(a5 int PRIMARY KEY, b5 int) ;
-INSERT INTO t5 VALUES (7,0);
-
-SET SESSION optimizer_switch = 'outer_join_with_cache=on';
-
-SET SESSION join_cache_level = 0;
-EXPLAIN
-SELECT t4.a4, t5.b5
- FROM ((t1 LEFT JOIN (t2 JOIN t3 ON t2.a2 = t3.a3) ON t2.b2 = t1.a1)
- LEFT JOIN t4 ON t4.a4 <> 0) LEFT JOIN t5 ON t5.a5 = t2.a2;
-SELECT t4.a4, t5.b5
- FROM ((t1 LEFT JOIN (t2 JOIN t3 ON t2.a2 = t3.a3) ON t2.b2 = t1.a1)
- LEFT JOIN t4 ON t4.a4 <> 0) LEFT JOIN t5 ON t5.a5 = t2.a2;
-
-SET SESSION join_cache_level = 6;
-EXPLAIN
-SELECT t4.a4, t5.b5
- FROM ((t1 LEFT JOIN (t2 JOIN t3 ON t2.a2 = t3.a3) ON t2.b2 = t1.a1)
- LEFT JOIN t4 ON t4.a4 <> 0) LEFT JOIN t5 ON t5.a5 = t2.a2;
-SELECT t4.a4, t5.b5
- FROM ((t1 LEFT JOIN (t2 JOIN t3 ON t2.a2 = t3.a3) ON t2.b2 = t1.a1)
- LEFT JOIN t4 ON t4.a4 <> 0) LEFT JOIN t5 ON t5.a5 = t2.a2;
-
-SET SESSION optimizer_switch = 'outer_join_with_cache=off';
-SET SESSION join_cache_level = DEFAULT;
-
-DROP TABLE t1,t2,t3,t4,t5;
-
---echo #
---echo # Bug #670380: hash join for non-binary collation
---echo #
-
-
-CREATE TABLE t1 (pk int PRIMARY KEY, a varchar(32));
-CREATE TABLE t2 (pk int PRIMARY KEY, a varchar(32), INDEX idx(a));
-INSERT INTO t1 VALUES
- (10,'AAA'), (20,'BBBB'), (30,'Cc'), (40,'DD'), (50,'ee');
-INSERT INTO t2 VALUES
- (1,'Bbbb'), (2,'BBB'), (3,'bbbb'), (4,'AaA'), (5,'CC'),
- (6,'cC'), (7,'CCC'), (8,'AAA'), (9,'bBbB'), (10,'aaaa'),
- (11,'a'), (12,'dd'), (13,'EE'), (14,'ee'), (15,'D'),
- (101,'Bbbb'), (102,'BBB'), (103,'bbbb'), (104,'AaA'), (105,'CC'),
- (106,'cC'), (107,'CCC'), (108,'AAA'), (109,'bBbB'), (110,'aaaa'),
- (111,'a'), (112,'dd'), (113,'EE'), (114,'ee'), (115,'D');
-
-SET SESSION join_cache_level = 4;
-
-EXPLAIN
-SELECT * FROM t1,t2 WHERE t1.a=t2.a;
-SELECT * FROM t1,t2 WHERE t1.a=t2.a;
-
-SET SESSION join_cache_level = DEFAULT;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug #694092: incorrect detection of index only pushdown conditions
---echo #
-
-CREATE TABLE t1 (
- f1 varchar(10), f3 int(11), PRIMARY KEY (f3)
-);
-INSERT INTO t1 VALUES ('y',1),('or',5);
-
-CREATE TABLE t2 (
- f3 int(11), f2 varchar(1024), f4 varchar(10), PRIMARY KEY (f3)
-);
-INSERT INTO t2 VALUES (6,'RPOYT','y'),(10,'JINQE','m');
-
-SET SESSION join_cache_level = 1;
-
-SET SESSION optimizer_switch = 'index_condition_pushdown=off';
-EXPLAIN
-SELECT * FROM t1,t2
- WHERE t1.f1 = t2.f4 AND (t1.f3 = 1 AND t2.f3 = 4 OR t1.f3 = 2 AND t2.f3 = 6);
-SELECT * FROM t1,t2
- WHERE t1.f1 = t2.f4 AND (t1.f3 = 1 AND t2.f3 = 4 OR t1.f3 = 2 AND t2.f3 = 6);
-
-SET SESSION optimizer_switch = 'index_condition_pushdown=on';
-EXPLAIN
-SELECT * FROM t1,t2
- WHERE t1.f1 = t2.f4 AND (t1.f3 = 1 AND t2.f3 = 4 OR t1.f3 = 2 AND t2.f3 = 6);
-SELECT * FROM t1,t2
- WHERE t1.f1 = t2.f4 AND (t1.f3 = 1 AND t2.f3 = 4 OR t1.f3 = 2 AND t2.f3 = 6);
-
-SET SESSION join_cache_level = DEFAULT;
-SET SESSION optimizer_switch = @local_join_cache_test_optimizer_switch_default;
-
-DROP TABLE t1,t2;
-
-# The same cause of the problem but no join buffer is used (see bug #695442)
-
-CREATE TABLE t1 (f1 int, f2 varchar(10), KEY (f1), KEY (f2)) ;
-INSERT INTO t1 VALUES
- (4,'e'), (891879424,'l'), (-243400704,'ectlyqupbk'), (1851981824,'of'),
- (-1495203840,'you'), (4,'no'), (-1436942336,'c'), (891420672,'DQQYO'),
- (608698368,'qergldqmec'), (1,'x');
-
-CREATE TABLE t2 (f3 varchar(64), KEY (f3));
-INSERT INTO t2 VALUES
- ('d'), ('UALLN'), ('d'), ('z'), ('r'), ('YVAKV'), ('d'), ('TNGZK'), ('e'),
- ('xucupaxdyythsgiw'), ('why'), ('ttugkxucupaxdyyt'), ('l'), ('LHTKN'),
- ('d'), ('o'), ('v'), ('KGLCJ'), ('your');
-
-
-SET SESSION optimizer_switch='index_merge_sort_intersection=off';
-
-SET SESSION optimizer_switch = 'index_condition_pushdown=off';
-EXPLAIN SELECT * FROM t1,t2
- WHERE t2.f3 = t1.f2 AND t1.f1 IN (9, 0, 100) ORDER BY t1.f2 LIMIT 1;
-SELECT * FROM t1,t2
- WHERE t2.f3 = t1.f2 AND t1.f1 IN (9, 0 ,100) ORDER BY t1.f2 LIMIT 1;
-SET SESSION optimizer_switch = @local_join_cache_test_optimizer_switch_default;
-
-SET SESSION optimizer_switch = 'index_condition_pushdown=on';
-EXPLAIN SELECT * FROM t1,t2
- WHERE t2.f3 = t1.f2 AND t1.f1 IN (9, 0 ,100) ORDER BY t1.f2 LIMIT 1;
-SELECT * FROM t1,t2
- WHERE t2.f3 = t1.f2 AND t1.f1 IN (9, 0 ,100) ORDER BY t1.f2 LIMIT 1;
-
-SET SESSION optimizer_switch = @local_join_cache_test_optimizer_switch_default;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug #694443: hash join using IS NULL the an equi-join condition
---echo #
-
-CREATE TABLE t1 (a int PRIMARY KEY);
-INSERT INTO t1 VALUES
- (7), (4), (9), (1), (3), (8), (2);
-
-CREATE TABLE t2 (a int, b int, INDEX idx (a));
-INSERT INTO t2 VALUES
- (NULL,10), (4,80), (7,70), (6,11), (7,90), (NULL,40),
- (4,77), (4,50), (NULL,41), (7,99), (7,88), (8,12),
- (1,21), (4,90), (7,91), (8,22), (6,92), (NULL,42),
- (2,78), (2,51), (1,43), (5,97), (5,89);
-
-SET SESSION join_cache_level = 1;
-EXPLAIN
-SELECT * FROM t1,t2 WHERE t1.a < 3 and t2.a IS NULL;
-SELECT * FROM t1,t2 WHERE t1.a < 3 and t2.a IS NULL;
-
-SET SESSION join_cache_level = 4;
-EXPLAIN
-SELECT * FROM t1,t2 WHERE t1.a < 3 and t2.a IS NULL;
-SELECT * FROM t1,t2 WHERE t1.a < 3 and t2.a IS NULL;
-
-
-SET SESSION join_cache_level = DEFAULT;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug #697557: hash join on a varchar field
---echo #
-
-CREATE TABLE t1 ( f1 varchar(10) , f2 int(11) , KEY (f1));
-INSERT INTO t1 VALUES ('r',1), ('m',2);
-
-CREATE TABLE t2 ( f1 varchar(10) , f2 int(11) , KEY (f1));
-INSERT INTO t2 VALUES
- ('hgtofubn',1), ('GDOXZ',91), ('n',2), ('fggxgalh',88),
- ('hgtofu',1), ('GDO',101), ('n',3), ('fggxga',55),
- ('hgtofu',3), ('GDO',33), ('nn',3), ('fggxgarrr',77),
- ('jgtofu',3), ('JDO',33), ('mn',3), ('jggxgarrr',77),
- ('igtofu',3), ('IDO',33), ('ln',3), ('iggxgarrr',77);
-
-
-SET SESSION join_cache_level=3;
-
-EXPLAIN
-SELECT * FROM t1,t2 WHERE t2.f1 = t1.f1;
-SELECT * FROM t1,t2 WHERE t2.f1 = t1.f1;
-
-SET SESSION join_cache_level = DEFAULT;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug #707827: hash join on varchar column with NULLs
---echo #
-
-CREATE TABLE t1 (v varchar(1));
-INSERT INTO t1 VALUES ('o'), ('u');
-
-CREATE TABLE t2 (a int, v varchar(1), INDEX idx (v)) ;
-INSERT INTO t2 VALUES
- (8,NULL), (10,'b'), (5,'k'), (4,NULL),
- (1,NULL), (11,'u'), (7,NULL), (2,'d'),
- (18,'u'), (11,'b'), (15,'k'), (12,'d'),
- (18,'x'), (11,'y'), (15,'l'), (12,'e');
-
-SET SESSION join_buffer_size = 256;
-
-SET SESSION join_cache_level = 4;
-EXPLAIN
-SELECT a FROM t1,t2 WHERE t2.v = t1.v ;
-SELECT a FROM t1,t2 WHERE t2.v = t1.v ;
-
-SET SESSION join_cache_level = 1;
-EXPLAIN
-SELECT a FROM t1,t2 WHERE t2.v = t1.v ;
-SELECT a FROM t1,t2 WHERE t2.v = t1.v ;
-
-SET SESSION join_cache_level = DEFAULT;
-SET SESSION join_buffer_size = DEFAULT;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug #802860: crash on join cache + derived + duplicate_weedout
---echo #
-
-SET SESSION optimizer_switch=
- 'semijoin=on,materialization=off,firstmatch=off,loosescan=off,derived_with_keys=on';
-
-CREATE TABLE t1 (a int) ;
-INSERT IGNORE INTO t1 VALUES (0), (1), (0);
-
-CREATE TABLE t2 (a int) ;
-INSERT IGNORE INTO t2 VALUES (0), (3), (0), (2);
-
-SET SESSION join_cache_level = 0;
-
-EXPLAIN
-SELECT * FROM (SELECT DISTINCT * FROM t1) t
- WHERE t.a IN (SELECT t2.a FROM t2);
-SELECT * FROM (SELECT DISTINCT * FROM t1) t
- WHERE t.a IN (SELECT t2.a FROM t2);
-
-SET SESSION join_cache_level = 1;
-
-EXPLAIN
-SELECT * FROM (SELECT DISTINCT * FROM t1) t
- WHERE t.a IN (SELECT t2.a FROM t2);
-SELECT * FROM (SELECT DISTINCT * FROM t1) t
- WHERE t.a IN (SELECT t2.a FROM t2);
-
-SET SESSION join_cache_level = DEFAULT;
-
-DROP TABLE t1, t2;
-
---echo #
---echo # Bug #887479: join_cache_level=3 + semijoin=on
---echo #
-
-CREATE TABLE t1 (a int, b int);
-INSERT INTO t1 VALUES (3914,17), (3710,5), (3888,20);
-
-CREATE TABLE t2 (c int, KEY (c));
-INSERT INTO t2 VALUES (27), (17), (33), (20), (3), (7), (18), (2);
-
-SET @tmp887479_optimizer_switch=@@optimizer_switch;
-SET SESSION optimizer_switch='semijoin=on';
-SET SESSION optimizer_switch='semijoin_with_cache=on';
-
-SET SESSION join_cache_level=1;
-EXPLAIN
-SELECT * FROM t1 WHERE (t1.b) IN (SELECT c FROM t2);
-SELECT * FROM t1 WHERE (t1.b) IN (SELECT c FROM t2);
-
-SET SESSION join_cache_level=3;
-EXPLAIN
-SELECT * FROM t1 WHERE (t1.b) IN (SELECT c FROM t2);
-SELECT * FROM t1 WHERE (t1.b) IN (SELECT c FROM t2);
-
-SET SESSION join_cache_level = DEFAULT;
-SET optimizer_switch=@tmp887479_optimizer_switch;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug #899777: join_cache_level=4 + semijoin=on
---echo #
-
-CREATE TABLE t1 (a int, b int, c int, UNIQUE INDEX idx (a));
-INSERT INTO t1 VALUES (1,8,6), (2,2,8);
-CREATE TABLE t2 (a int, b int, c int, UNIQUE INDEX idx (a));
-INSERT INTO t2 VALUES (1,8,6), (2,2,8);
-CREATE TABLE t3 (a int, b int, c int, UNIQUE INDEX idx (a));
-INSERT INTO t3 VALUES (1,8,6), (2,2,8);
-CREATE TABLE t4 (a int, b int, c int, UNIQUE INDEX idx (a));
-INSERT INTO t4 VALUES (1,8,6), (2,2,8);
-
-SET @tmp_optimizer_switch=@@optimizer_switch;
-SET SESSION optimizer_switch='semijoin=on';
-SET SESSION optimizer_switch='semijoin_with_cache=on';
-
-SET SESSION join_cache_level=1;
-EXPLAIN
-SELECT t1.* FROM t1,t2
- WHERE (t1.b,t2.b) IN (SELECT t3.b,t4.b FROM t3,t4 WHERE t4.c=t3.b)
- AND t1.a = 1;
-SELECT t1.* FROM t1,t2
- WHERE (t1.b,t2.b) IN (SELECT t3.b,t4.b FROM t3,t4 WHERE t4.c=t3.b)
- AND t1.a = 1;
-
-SET SESSION join_cache_level=4;
-EXPLAIN
-SELECT t1.* FROM t1,t2
- WHERE (t1.b,t2.b) IN (SELECT t3.b,t4.b FROM t3,t4 WHERE t4.c=t3.b)
- AND t1.a = 1;
-SELECT t1.* FROM t1,t2
- WHERE (t1.b,t2.b) IN (SELECT t3.b,t4.b FROM t3,t4 WHERE t4.c=t3.b)
- AND t1.a = 1;
-
-SET SESSION join_cache_level = DEFAULT;
-SET optimizer_switch=@tmp_optimizer_switch;
-
-DROP TABLE t1,t2,t3,t4;
-
---echo #
---echo # Bug #899509: an attempt to use hash join with join_cache_level=0
---echo #
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (8), (7);
-CREATE TABLE t2 (a int);
-INSERT INTO t2 VALUES (8), (7);
-CREATE TABLE t3 (a int);
-INSERT INTO t3 VALUES (8), (7);
-
-SET @tmp_optimizer_switch=@@optimizer_switch;
-set optimizer_switch=default;
-set @@optimizer_switch='semijoin_with_cache=off';
-set @@optimizer_switch='outer_join_with_cache=off';
-SET optimizer_switch='derived_merge=off,derived_with_keys=off';
-SET join_cache_level=0;
-
-EXPLAIN
-SELECT * FROM (SELECT t1.* FROM t1, t2) t WHERE t.a IN (SELECT * FROM t3);
-SELECT * FROM (SELECT t1.* FROM t1, t2) t WHERE t.a IN (SELECT * FROM t3);
-
-SELECT * FROM ( SELECT ta.* FROM t1 AS ta, t1 ) tb WHERE a IN ( SELECT * FROM t1 );
-
-SET SESSION join_cache_level = DEFAULT;
-SET optimizer_switch=@tmp_optimizer_switch;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # Bug #900469: semijoin + BNLH + ORDER BY
---echo #
-
-CREATE TABLE t1 (a int, b int);
-INSERT INTO t1 VALUES (8,10);
-
-CREATE TABLE t2 (c int, d int);
-INSERT INTO t2 VALUES (8,10);
-INSERT INTO t2 VALUES (9,11);
-
-CREATE TABLE t3 (c int, d int);
-INSERT INTO t3 VALUES (8,10);
-INSERT INTO t3 VALUES (9,11);
-
-SET @tmp_optimizer_switch=@@optimizer_switch;
-set @@optimizer_switch='semijoin_with_cache=on';
-
-SET join_cache_level=1;
-EXPLAIN
-SELECT * FROM t1,t2 WHERE b IN (SELECT d FROM t3 WHERE c <= t2.c) ORDER BY a,d;
-SELECT * FROM t1,t2 WHERE b IN (SELECT d FROM t3 WHERE c <= t2.c) ORDER BY a,d;
-
-SET join_cache_level=3;
-EXPLAIN
-SELECT * FROM t1,t2 WHERE b IN (SELECT d FROM t3 WHERE c <= t2.c);
-SELECT * FROM t1,t2 WHERE b IN (SELECT d FROM t3 WHERE c <= t2.c);
-
-SET join_cache_level=3;
-EXPLAIN
-SELECT * FROM t1,t2 WHERE b IN (SELECT d FROM t3 WHERE c <= t2.c) ORDER BY a,d;
-SELECT * FROM t1,t2 WHERE b IN (SELECT d FROM t3 WHERE c <= t2.c) ORDER BY a,d;
-
-SET SESSION join_cache_level = DEFAULT;
-SET optimizer_switch=@tmp_optimizer_switch;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # Bug #901478: semijoin + ORDER BY + join_cache_level=4|6
---echo #
-
-CREATE TABLE t1 (a char(1));
-INSERT INTO t1 VALUES ('x');
-CREATE TABLE t2 (a int, b int, c int, KEY(a), KEY(b), KEY(c));
-INSERT INTO t2 VALUES
- (9,1,0), (7,2,8), (2,3,5), (4,2,9), (8,3,8), (3,4,1), (5,5,4);
-CREATE TABLE t3 (a CHAR(1));
-INSERT INTO t3 VALUES ('x');
-CREATE TABLE t4 (a int, b int, c int, KEY(b), KEY(c));
-INSERT INTO t4 VALUES
- (9,1,0), (7,2,8), (2,3,5), (4,2,9), (8,3,8), (3,4,1), (5,5,4);
-INSERT INTO t4 VALUES
- (19,11,10), (17,12,18), (12,13,15), (14,12,19),
- (18,13,18), (13,14,11), (15,15,14);
-
-SET @tmp_optimizer_switch=@@optimizer_switch;
-SET @@optimizer_switch='semijoin=on';
-SET @@optimizer_switch='firstmatch=off';
-SET @@optimizer_switch='mrr=off';
-SET @@optimizer_switch='semijoin_with_cache=off';
-
-set join_cache_level=1;
-EXPLAIN
-SELECT * FROM t1,t2
- WHERE t2.c IN (SELECT c FROM t3,t4 WHERE t4.a < 10) AND
- t2.a BETWEEN 4 and 5
- ORDER BY t2.b;
-SELECT * FROM t1,t2
- WHERE t2.c IN (SELECT c FROM t3,t4 WHERE t4.a < 10) AND
- t2.a BETWEEN 4 and 5
- ORDER BY t2.b;
-
-set join_cache_level=4;
-EXPLAIN
-SELECT * FROM t1,t2
- WHERE t2.c IN (SELECT c FROM t3,t4 WHERE t4.a < 10) AND
- t2.a BETWEEN 4 and 5
- ORDER BY t2.b;
-SELECT * FROM t1,t2
- WHERE t2.c IN (SELECT c FROM t3,t4 WHERE t4.a < 10) AND
- t2.a BETWEEN 4 and 5
- ORDER BY t2.b;
-
-SET @@optimizer_switch='semijoin_with_cache=on';
-set join_cache_level=6;
-EXPLAIN
-SELECT * FROM t1,t2
- WHERE t2.c IN (SELECT c FROM t3,t4 WHERE t4.a < 10) AND
- t2.a BETWEEN 4 and 5
- ORDER BY t2.b;
-SELECT * FROM t1,t2
- WHERE t2.c IN (SELECT c FROM t3,t4 WHERE t4.a < 10) AND
- t2.a BETWEEN 4 and 5
- ORDER BY t2.b;
-
-SET join_cache_level = DEFAULT;
-SET optimizer_switch=@tmp_optimizer_switch;
-
-DROP TABLE t1,t2,t3,t4;
-
---echo #
---echo # Bug#53305 Duplicate weedout + join buffer (join cache --level=7,8)
---echo #
-
-create table t1 (uid int, fid int, index(uid));
-insert into t1 values
- (1,1), (1,2), (1,3), (1,4),
- (2,5), (2,6), (2,7), (2,8),
- (3,1), (3,2), (3,9);
-
-create table t2 (uid int primary key, name varchar(128), index(name));
-insert into t2 values
- (1, "A"), (2, "B"), (3, "C"), (4, "D"), (5, "E"),
- (6, "F"), (7, "G"), (8, "H"), (9, "I");
-
-create table t3 (uid int, fid int, index(uid));
-insert into t3 values
- (1,1), (1,2), (1,3),(1,4),
- (2,5), (2,6), (2,7), (2,8),
- (3,1), (3,2), (3,9);
-
-set @tmp_optimizer_switch=@@optimizer_switch;
-set @@optimizer_switch='semijoin=on';
-set optimizer_switch='materialization=off';
-set optimizer_switch='loosescan=off,firstmatch=off';
-set optimizer_switch='mrr_sort_keys=off';
-set join_cache_level=7;
-
-create table t4 (uid int primary key, name varchar(128), index(name));
-insert into t4 values
- (1, "A"), (2, "B"), (3, "C"), (4, "D"), (5, "E"),
- (6, "F"), (7, "G"), (8, "H"), (9, "I");
-
-explain select name from t2, t1
- where t1.uid in (select t4.uid from t4, t3 where t3.uid=1 and t4.uid=t3.fid)
- and t2.uid=t1.fid;
-
---sorted_result
-select name from t2, t1
- where t1.uid in (select t4.uid from t4, t3 where t3.uid=1 and t4.uid=t3.fid)
- and t2.uid=t1.fid;
-
-set join_cache_level = default;
-set optimizer_switch=@tmp_optimizer_switch;
-
-drop table t1,t2,t3,t4;
-
---echo #
---echo # Bug#50358 - semijoin execution of subquery with outerjoin
---echo # emplying join buffer
---echo #
-
-CREATE TABLE t1 (i int);
-CREATE TABLE t2 (i int);
-CREATE TABLE t3 (i int);
-INSERT INTO t1 VALUES (1), (2);
-INSERT INTO t2 VALUES (6);
-INSERT INTO t3 VALUES (1), (2);
-
-set @tmp_optimizer_switch=@@optimizer_switch;
-set @@optimizer_switch='semijoin=on';
-set optimizer_switch='materialization=on';
-
-set join_cache_level=0;
-EXPLAIN
-SELECT * FROM t1 WHERE t1.i IN
- (SELECT t3.i FROM t3 LEFT JOIN t2 ON t2.i=t3.i);
-SELECT * FROM t1 WHERE t1.i IN
- (SELECT t3.i FROM t3 LEFT JOIN t2 ON t2.i=t3.i);
-
-set join_cache_level=2;
-EXPLAIN
-SELECT * FROM t1 WHERE t1.i IN
- (SELECT t3.i FROM t3 LEFT JOIN t2 ON t2.i=t3.i);
-SELECT * FROM t1 WHERE t1.i IN
- (SELECT t3.i FROM t3 LEFT JOIN t2 ON t2.i=t3.i);
-
-set join_cache_level = default;
-set optimizer_switch=@tmp_optimizer_switch;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # Bug #12546542: missing row with semijoin=off + join cache
---echo # (LP bug #922971)
---echo #
-
-CREATE TABLE t1 (a varchar(1024));
-INSERT INTO t1 VALUES ('v'), ('we');
-CREATE TABLE t2 (
- a varchar(1024) CHARACTER SET utf8 DEFAULT NULL, b int, c int
-);
-INSERT INTO t2 VALUES ('we',4,NULL), ('v',1305673728,6);
-CREATE TABLE t3 (b int, c int);
-INSERT INTO t3 VALUES (4,4);
-
-set @tmp_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='semijoin=off';
-set optimizer_switch='materialization=off';
-
-set join_cache_level=0;
-EXPLAIN
-SELECT * FROM t1
- WHERE a IN (SELECT t2.a FROM t2 LEFT JOIN t3 ON t2.b = t3.b
- WHERE t2.c < 10 OR t3.c > 1);
-
-SELECT * FROM t1
- WHERE a IN (SELECT t2.a FROM t2 LEFT JOIN t3 ON t2.b = t3.b
- WHERE t2.c < 10 OR t3.c > 1);
-
-set join_cache_level=2;
-EXPLAIN
-SELECT * FROM t1
- WHERE a IN (SELECT t2.a FROM t2 LEFT JOIN t3 ON t2.b = t3.b
- WHERE t2.c < 10 OR t3.c > 1);
-SELECT * FROM t1
- WHERE a IN (SELECT t2.a FROM t2 LEFT JOIN t3 ON t2.b = t3.b
- WHERE t2.c < 10 OR t3.c > 1);
-
-set join_cache_level = default;
-set optimizer_switch=@tmp_optimizer_switch;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # lp:925985 LEFT JOIN with optimize_join_buffer_size=off +
---echo # join_buffer_size > join_buffer_space_limit
---echo #
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (5), (3);
-
-CREATE TABLE t2 (a int, b int);
-INSERT INTO t2 VALUES
- (3,30), (1,10), (7,70), (2,20),
- (3,31), (1,11), (7,71), (2,21),
- (3,32), (1,12), (7,72), (2,22);
-
-CREATE TABLE t3 (b int, c int);
-INSERT INTO t3 VALUES (32, 302), (42,400), (30,300);
-
-set @tmp_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='optimize_join_buffer_size=off';
-set join_buffer_space_limit=4096;
-set join_buffer_size=4096*2;
-set join_cache_level=2;
-set optimizer_switch='outer_join_with_cache=on';
-
-EXPLAIN
-SELECT * FROM t1, t2 LEFT JOIN t3 ON t2.b=t3.b WHERE t1.a=t2.a;
-SELECT * FROM t1, t2 LEFT JOIN t3 ON t2.b=t3.b WHERE t1.a=t2.a;
-
-set join_buffer_space_limit=default;
-set join_buffer_size=default;
-set join_cache_level=default;
-set optimizer_switch=@tmp_optimizer_switch;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # Bug #1058071: LEFT JOIN using blobs
---echo # (MDEV-564) when join buffer size is small
---echo #
-
-CREATE TABLE t1 (
- col269 decimal(31,10) unsigned DEFAULT NULL,
- col280 geometry DEFAULT NULL,
- col281 tinyint(1) DEFAULT NULL,
- col282 time NOT NULL,
- col284 datetime DEFAULT NULL,
- col286 date DEFAULT NULL,
- col287 datetime DEFAULT NULL,
- col288 decimal(30,29) DEFAULT NULL,
- col291 time DEFAULT NULL,
- col292 time DEFAULT NULL
-) ENGINE=Aria;
-
-INSERT INTO t1 VALUES
-(0.0,PointFromText('POINT(9 0)'),0,'11:24:05','2013-04-14 21:30:28',NULL,'2011-12-20 06:00:34',9.9,'13:04:39',NULL),
-(0.0,NULL,127,'05:43:12','2012-09-05 06:15:27','2027-01-01','2011-10-29 10:48:29',0.0,'06:24:05','11:33:37'),
-(0.0,NULL,127,'12:54:41','2013-01-12 11:32:58','2011-11-03','2013-01-03 02:00:34',00,'11:54:15','20:19:15'),
-(0.0,PointFromText('POINT(9 0)'),0,'19:48:07','2012-07-16 15:45:25','2012-03-25','2013-09-07 17:21:52',0.5,'17:36:54','21:24:19'),
-(0.0,PointFromText('POINT(9 0)'),0,'03:43:48','2012-09-28 00:00:00','2012-06-26','2011-11-16 05:01:09',00,'01:25:42','19:30:06'),
-(0.0,LineStringFromText('LINESTRING(0 0,9 9,0 0,9 0,0 0)'),127,'11:33:21','2012-03-31 10:29:22','2012-10-10','2012-04-21 19:21:06',NULL,'05:13:22','09:48:34'),
-(NULL,PointFromText('POINT(9 0)'),127,'00:00:00','0000-00-00','2012-04-04 21:26:12','2013-03-04',0.0,'12:54:30',NULL),
-(NULL,PointFromText('POINT(9 0)'),1,'00:00:00','2013-05-01 22:37:49','2013-06-26','2012-09-22 17:31:03',0.0,'08:09:57','11:15:36');
-
-CREATE TABLE t2 (b int) ENGINE=Aria;
-INSERT INTO t2 VALUES (NULL);
-CREATE TABLE t3 (c int) ENGINE=Aria;
-INSERT INTO t3 VALUES (NULL);
-
-set @tmp_optimizer_switch=@@optimizer_switch;
-set optimizer_switch = 'outer_join_with_cache=on,join_cache_incremental=on';
-set join_buffer_size=128;
-
-EXPLAIN
-SELECT 1 AS c FROM t1 NATURAL LEFT JOIN t2 LEFT OUTER JOIN t3 ON 1
- GROUP BY elt(t1.col282,1,t1.col280);
-
-SELECT 1 AS c FROM t1 NATURAL LEFT JOIN t2 LEFT OUTER JOIN t3 ON 1
- GROUP BY elt(t1.col282,1,t1.col280);
-
-set join_buffer_size=default;
-set optimizer_switch=@tmp_optimizer_switch;
-
-DROP table t1,t2,t3;
-set join_buffer_size= default;
-set @@optimizer_switch=@save_optimizer_switch;
-
-
---echo #
---echo # MDEV-5293: outer join, join buffering, and order by - invalid query plan
---echo #
-create table t0 (a int primary key) engine=myisam;
-insert into t0 values (1);
-
-create table t1(a int) engine=myisam;
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-alter table t1 add b int;
-
-create table t2 like t1;
-insert into t2 select * from t1;
---echo #The following must use "Using temporary; Using filesort" and not just "Using filesort":
-explain select * from t0,t1 left join t2 on t1.b=t2.b order by t0.a, t1.a;
-
-drop table t0,t1,t2;
-
---echo # MDEV-6292: huge performance degradation for a sequence
---echo # of LEFT JOIN operations when using join buffer
---echo #
-
---source include/have_innodb.inc
-
-CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- col1 varchar(255) NOT NULL DEFAULT '',
- PRIMARY KEY (id)
-) ENGINE=INNODB;
-
-CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- parent_id smallint(3) NOT NULL DEFAULT '0',
- col2 varchar(25) NOT NULL DEFAULT '',
- PRIMARY KEY (id)
-) ENGINE=INNODB;
-
-set join_buffer_size=8192;
-
-set join_cache_level=0;
-
-set @init_time:=now();
-SELECT t.*
-FROM
- t1 t
- LEFT JOIN t2 c1 ON c1.parent_id = t.id AND c1.col2 = "val"
- LEFT JOIN t2 c2 ON c2.parent_id = t.id AND c2.col2 = "val"
- LEFT JOIN t2 c3 ON c3.parent_id = t.id AND c3.col2 = "val"
- LEFT JOIN t2 c4 ON c4.parent_id = t.id AND c4.col2 = "val"
- LEFT JOIN t2 c5 ON c5.parent_id = t.id AND c5.col2 = "val"
- LEFT JOIN t2 c6 ON c6.parent_id = t.id AND c6.col2 = "val"
- LEFT JOIN t2 c7 ON c7.parent_id = t.id AND c7.col2 = "val"
- LEFT JOIN t2 c8 ON c8.parent_id = t.id AND c8.col2 = "val"
- LEFT JOIN t2 c9 ON c9.parent_id = t.id AND c9.col2 = "val"
- LEFT JOIN t2 c10 ON c10.parent_id = t.id AND c10.col2 = "val"
- LEFT JOIN t2 c11 ON c11.parent_id = t.id AND c11.col2 = "val"
- LEFT JOIN t2 c12 ON c12.parent_id = t.id AND c12.col2 = "val"
- LEFT JOIN t2 c13 ON c13.parent_id = t.id AND c13.col2 = "val"
- LEFT JOIN t2 c14 ON c14.parent_id = t.id AND c14.col2 = "val"
- LEFT JOIN t2 c15 ON c15.parent_id = t.id AND c15.col2 = "val"
- LEFT JOIN t2 c16 ON c16.parent_id = t.id AND c16.col2 = "val"
- LEFT JOIN t2 c17 ON c17.parent_id = t.id AND c17.col2 = "val"
- LEFT JOIN t2 c18 ON c18.parent_id = t.id AND c18.col2 = "val"
- LEFT JOIN t2 c19 ON c19.parent_id = t.id AND c19.col2 = "val"
- LEFT JOIN t2 c20 ON c20.parent_id = t.id AND c20.col2 = "val"
- LEFT JOIN t2 c21 ON c21.parent_id = t.id AND c21.col2 = "val"
- LEFT JOIN t2 c22 ON c22.parent_id = t.id AND c22.col2 = "val"
- LEFT JOIN t2 c23 ON c23.parent_id = t.id AND c23.col2 = "val"
- LEFT JOIN t2 c24 ON c24.parent_id = t.id AND c24.col2 = "val"
- LEFT JOIN t2 c25 ON c25.parent_id = t.id AND c25.col2 = "val"
- LEFT JOIN t2 c26 ON c26.parent_id = t.id AND c26.col2 = "val"
- LEFT JOIN t2 c27 ON c27.parent_id = t.id AND c27.col2 = "val"
-ORDER BY
- col1;
-select timestampdiff(second, @init_time, now()) <= 5;
-
-set join_cache_level=2;
-
-set @init_time:=now();
-SELECT t.*
-FROM
- t1 t
- LEFT JOIN t2 c1 ON c1.parent_id = t.id AND c1.col2 = "val"
- LEFT JOIN t2 c2 ON c2.parent_id = t.id AND c2.col2 = "val"
- LEFT JOIN t2 c3 ON c3.parent_id = t.id AND c3.col2 = "val"
- LEFT JOIN t2 c4 ON c4.parent_id = t.id AND c4.col2 = "val"
- LEFT JOIN t2 c5 ON c5.parent_id = t.id AND c5.col2 = "val"
- LEFT JOIN t2 c6 ON c6.parent_id = t.id AND c6.col2 = "val"
- LEFT JOIN t2 c7 ON c7.parent_id = t.id AND c7.col2 = "val"
- LEFT JOIN t2 c8 ON c8.parent_id = t.id AND c8.col2 = "val"
- LEFT JOIN t2 c9 ON c9.parent_id = t.id AND c9.col2 = "val"
- LEFT JOIN t2 c10 ON c10.parent_id = t.id AND c10.col2 = "val"
- LEFT JOIN t2 c11 ON c11.parent_id = t.id AND c11.col2 = "val"
- LEFT JOIN t2 c12 ON c12.parent_id = t.id AND c12.col2 = "val"
- LEFT JOIN t2 c13 ON c13.parent_id = t.id AND c13.col2 = "val"
- LEFT JOIN t2 c14 ON c14.parent_id = t.id AND c14.col2 = "val"
- LEFT JOIN t2 c15 ON c15.parent_id = t.id AND c15.col2 = "val"
- LEFT JOIN t2 c16 ON c16.parent_id = t.id AND c16.col2 = "val"
- LEFT JOIN t2 c17 ON c17.parent_id = t.id AND c17.col2 = "val"
- LEFT JOIN t2 c18 ON c18.parent_id = t.id AND c18.col2 = "val"
- LEFT JOIN t2 c19 ON c19.parent_id = t.id AND c19.col2 = "val"
- LEFT JOIN t2 c20 ON c20.parent_id = t.id AND c20.col2 = "val"
- LEFT JOIN t2 c21 ON c21.parent_id = t.id AND c21.col2 = "val"
- LEFT JOIN t2 c22 ON c22.parent_id = t.id AND c22.col2 = "val"
- LEFT JOIN t2 c23 ON c23.parent_id = t.id AND c23.col2 = "val"
- LEFT JOIN t2 c24 ON c24.parent_id = t.id AND c24.col2 = "val"
- LEFT JOIN t2 c25 ON c25.parent_id = t.id AND c25.col2 = "val"
- LEFT JOIN t2 c26 ON c26.parent_id = t.id AND c26.col2 = "val"
- LEFT JOIN t2 c27 ON c27.parent_id = t.id AND c27.col2 = "val"
-ORDER BY
- col1;
-select timestampdiff(second, @init_time, now()) <= 5;
-
-EXPLAIN
-SELECT t.*
-FROM
- t1 t
- LEFT JOIN t2 c1 ON c1.parent_id = t.id AND c1.col2 = "val"
- LEFT JOIN t2 c2 ON c2.parent_id = t.id AND c2.col2 = "val"
- LEFT JOIN t2 c3 ON c3.parent_id = t.id AND c3.col2 = "val"
- LEFT JOIN t2 c4 ON c4.parent_id = t.id AND c4.col2 = "val"
- LEFT JOIN t2 c5 ON c5.parent_id = t.id AND c5.col2 = "val"
- LEFT JOIN t2 c6 ON c6.parent_id = t.id AND c6.col2 = "val"
- LEFT JOIN t2 c7 ON c7.parent_id = t.id AND c7.col2 = "val"
- LEFT JOIN t2 c8 ON c8.parent_id = t.id AND c8.col2 = "val"
- LEFT JOIN t2 c9 ON c9.parent_id = t.id AND c9.col2 = "val"
- LEFT JOIN t2 c10 ON c10.parent_id = t.id AND c10.col2 = "val"
- LEFT JOIN t2 c11 ON c11.parent_id = t.id AND c11.col2 = "val"
- LEFT JOIN t2 c12 ON c12.parent_id = t.id AND c12.col2 = "val"
- LEFT JOIN t2 c13 ON c13.parent_id = t.id AND c13.col2 = "val"
- LEFT JOIN t2 c14 ON c14.parent_id = t.id AND c14.col2 = "val"
- LEFT JOIN t2 c15 ON c15.parent_id = t.id AND c15.col2 = "val"
- LEFT JOIN t2 c16 ON c16.parent_id = t.id AND c16.col2 = "val"
- LEFT JOIN t2 c17 ON c17.parent_id = t.id AND c17.col2 = "val"
- LEFT JOIN t2 c18 ON c18.parent_id = t.id AND c18.col2 = "val"
- LEFT JOIN t2 c19 ON c19.parent_id = t.id AND c19.col2 = "val"
- LEFT JOIN t2 c20 ON c20.parent_id = t.id AND c20.col2 = "val"
- LEFT JOIN t2 c21 ON c21.parent_id = t.id AND c21.col2 = "val"
- LEFT JOIN t2 c22 ON c22.parent_id = t.id AND c22.col2 = "val"
- LEFT JOIN t2 c23 ON c23.parent_id = t.id AND c23.col2 = "val"
- LEFT JOIN t2 c24 ON c24.parent_id = t.id AND c24.col2 = "val"
- LEFT JOIN t2 c25 ON c25.parent_id = t.id AND c25.col2 = "val"
- LEFT JOIN t2 c26 ON c26.parent_id = t.id AND c26.col2 = "val"
- LEFT JOIN t2 c27 ON c27.parent_id = t.id AND c27.col2 = "val"
-ORDER BY
- col1;
-
-set join_buffer_size=default;
-set join_cache_level = default;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-14960: BNLH used for materialized semi-join
---echo #
-
-CREATE TABLE t1 (i1 int);
-CREATE TABLE t2 (e1 int);
-CREATE TABLE t4 (e1 int);
-CREATE TABLE t5 (e1 int);
-
-INSERT INTO t1 VALUES
- (1),(2),(3),(4),(5),(6),(7),(8);
-INSERT INTO t1 SELECT i1+8 FROM t1;
-INSERT INTO t1 SELECT i1+16 FROM t1;
-INSERT INTO t1 SELECT i1+32 FROM t1;
-INSERT INTO t1 SELECT i1+64 FROM t1;
-INSERT INTO t2 SELECT * FROM t1;
-INSERT INTO t4 SELECT * FROM t1;
-INSERT INTO t5 SELECT * FROM t1;
-
-set @save_optimizer_switch= @@optimizer_switch;
-SET join_cache_level = 6;
-SET join_buffer_size=4096;
-SET join_buffer_space_limit=4096;
-SET optimizer_switch = 'join_cache_hashed=on,optimize_join_buffer_size=on';
-
-let $q=
-SELECT * FROM t1
-WHERE
- i1 < 10 AND
- i1 IN
- (SELECT i1 FROM
- (SELECT (t4.e1) i1 FROM t4
- LEFT JOIN t5 ON t4.e1 = t5.e1
- LEFT JOIN (SELECT e1 FROM t2 ) AS d ON t4.e1 = d.e1) a);
-
-eval EXPLAIN $q;
-eval $q;
-
-SET join_cache_level = default;
-SET join_buffer_size = default;
-SET join_buffer_space_limit= default;
-set optimizer_switch=@save_optimizer_switch;
-
-DROP TABLE t1,t4,t5,t2;
-
---echo #
---echo # MDEV-5123 Remove duplicated conditions pushed both to join_tab->select_cond and join_tab->cache_select->cond for blocked joins.
---echo #
-
-set join_cache_level=default;
-set expensive_subquery_limit=0;
-
-create table t1 (c1 int);
-create table t2 (c2 int);
-create table t3 (c3 int);
-
-insert into t1 values (1), (2);
-insert into t2 values (1), (2);
-insert into t3 values (2);
-
-explain
-select count(*) from t1 straight_join t2
-where c1 = c2-0 and c2 <= (select max(c3) from t3 where c3 = 2 and @counter:=@counter+1);
-
-set @counter=0;
-
-select count(*) from t1 straight_join t2
-where c1 = c2-0 and c2 <= (select max(c3) from t3 where c3 = 2 and @counter:=@counter+1);
-
-select @counter;
-
-explain
-select count(*) from t1 straight_join t2
-where c1 = c2-0 and
- c2 <= (select max(c3) from t3 where c3 = 2 and @counter:=@counter+1) and
- c2 / 2 = 1;
-
-set @counter=0;
-
-select count(*) from t1 straight_join t2
-where c1 = c2-0 and
- c2 <= (select max(c3) from t3 where c3 = 2 and @counter:=@counter+1) and
- c2 / 2 = 1;
-
-select @counter;
-
-drop table t1,t2,t3;
-set expensive_subquery_limit=default;
-
---echo #
---echo # MDEV-6071: EXPLAIN chooses to use join buffer while execution turns it down
---echo #
-
-create table t1 (a int);
-insert into t1 values
-(7), (9), (1), (4), (2), (3), (5), (8), (11), (6), (10);
-
-explain select count(*) from t1, t1 t2 where t1.a=t2.a;
-
-set join_buffer_space_limit=1024*8;
-select @@join_buffer_space_limit;
-select @@join_buffer_size;
-
-explain select count(*) from t1, t1 t2 where t1.a=t2.a;
-
-set join_buffer_space_limit=default;
-
-drop table t1;
-
---echo #
---echo # MDEV-6687: Assertion `0' failed in Protocol::end_statement on query
---echo #
-SET join_cache_level = 3;
---echo # The following should have
---echo # - table order PROFILING,user,
---echo # - table user accessed with hash_ALL:
-explain
-SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.user WHERE password_expired = PAGE_FAULTS_MINOR;
-
-set join_cache_level=default;
-
-#
-# MDEV-12580 Wrong query result in join when using an index (Version > "10.2.3")
-#
-create table t1 (c1 date not null, key (c1)) engine=innodb;
-insert t1 values ('2017-12-27');
-create table t2 (pk int, f1 int, f2 int);
-insert t2 values (4,1,1), (6,1,1);
-set join_buffer_size = 222222208;
-select f2 from t2,t1 where f2 = 0;
-drop table t1, t2;
-set join_buffer_size = default;
-
-# The following command must be the last one the file
-# this must be the last command in the file
-set @@optimizer_switch=@save_optimizer_switch;
diff --git a/mysql-test/t/join_crash.test b/mysql-test/t/join_crash.test
deleted file mode 100644
index 2ec96dc2c28..00000000000
--- a/mysql-test/t/join_crash.test
+++ /dev/null
@@ -1,121 +0,0 @@
-#
-# This test gave a core dump
-#
-
---disable_warnings
-DROP TABLE IF EXISTS t1,t2,t3,t4;
---enable_warnings
-
-CREATE TABLE t1 (
- project_id int(11) NOT NULL auto_increment,
- project_row_lock int(11) NOT NULL default '0',
- project_name varchar(80) NOT NULL default '',
- client_ptr int(11) NOT NULL default '0',
- project_contact_ptr int(11) default NULL,
- client_contact_ptr int(11) default NULL,
- billing_contact_ptr int(11) default NULL,
- comments mediumtext,
- PRIMARY KEY (project_id),
- UNIQUE KEY project (client_ptr,project_name)
-) ENGINE=MyISAM PACK_KEYS=1;
-
-INSERT INTO t1 VALUES (1,0,'Rejected Time',1,NULL,NULL,NULL,NULL);
-INSERT INTO t1 VALUES (209,0,'MDGRAD Proposal/Investigation',97,NULL,NULL,NULL,'');
-INSERT INTO t1 VALUES (208,0,'Font 9 Design',84,NULL,NULL,NULL,'');
-INSERT INTO t1 VALUES (207,0,'Web Based Order Processing',95,NULL,NULL,NULL,'');
-INSERT INTO t1 VALUES (205,0,'Mac Screen Saver',95,NULL,NULL,NULL,'');
-INSERT INTO t1 VALUES (206,0,'Web Site',96,NULL,NULL,NULL,'');
-INSERT INTO t1 VALUES (204,0,'Magnafire Glue',94,NULL,NULL,NULL,'');
-INSERT INTO t1 VALUES (203,0,'Print Bid',93,NULL,NULL,NULL,'');
-INSERT INTO t1 VALUES (202,0,'EPOC Port',92,NULL,NULL,NULL,'');
-INSERT INTO t1 VALUES (201,0,'TravelMate',88,NULL,NULL,NULL,'');
-
-CREATE TABLE t2 (
- period_id int(11) NOT NULL auto_increment,
- period_type enum('user_table','client_table','role_table','member_table','project_table') default NULL,
- period_key int(11) default NULL,
- start_date datetime default NULL,
- end_date datetime default NULL,
- work_load int(11) default NULL,
- PRIMARY KEY (period_id),
- KEY period_index (period_type,period_key),
- KEY date_index (start_date,end_date)
-) ENGINE=MyISAM PACK_KEYS=1;
-
-INSERT INTO t2 VALUES (1,'user_table',98,'2000-01-01 00:00:00',NULL,NULL);
-INSERT INTO t2 VALUES (2,'user_table',99,'2000-01-01 00:00:00',NULL,NULL);
-INSERT INTO t2 VALUES (3,'user_table',100,'2000-01-01 00:00:00',NULL,NULL);
-INSERT INTO t2 VALUES (49,'project_table',148,'2000-01-01 00:00:00',NULL,NULL);
-INSERT INTO t2 VALUES (50,'client_table',68,'2000-01-01 00:00:00',NULL,NULL);
-INSERT INTO t2 VALUES (51,'project_table',149,'2000-01-01 00:00:00',NULL,NULL);
-INSERT INTO t2 VALUES (52,'project_table',150,'2000-01-01 00:00:00',NULL,NULL);
-INSERT INTO t2 VALUES (53,'client_table',69,'2000-01-01 00:00:00',NULL,NULL);
-INSERT INTO t2 VALUES (54,'project_table',151,'2000-01-01 00:00:00',NULL,NULL);
-INSERT INTO t2 VALUES (55,'client_table',70,'2000-01-01 00:00:00',NULL,NULL);
-INSERT INTO t2 VALUES (155,'role_table',1,'2000-01-01 00:00:00',NULL,NULL);
-INSERT INTO t2 VALUES (156,'role_table',2,'2000-01-01 00:00:00',NULL,NULL);
-INSERT INTO t2 VALUES (160,'member_table',1,'2000-01-01 00:00:00',NULL,1);
-INSERT INTO t2 VALUES (161,'member_table',2,'2000-01-01 00:00:00',NULL,1);
-INSERT INTO t2 VALUES (162,'member_table',3,'2000-01-01 00:00:00',NULL,1);
-
-CREATE TABLE t3 (
- budget_id int(11) NOT NULL auto_increment,
- project_ptr int(11) NOT NULL default '0',
- po_number varchar(20) NOT NULL default '',
- status enum('open','closed') default NULL,
- date_received datetime default NULL,
- amount_received float(10,2) default NULL,
- adjustment float(10,2) default NULL,
- PRIMARY KEY (budget_id),
- UNIQUE KEY po (project_ptr,po_number)
-) ENGINE=MyISAM PACK_KEYS=1;
-
-CREATE TABLE t4 (
- client_id int(11) NOT NULL auto_increment,
- client_row_lock int(11) NOT NULL default '0',
- client_name varchar(80) NOT NULL default '',
- contact_ptr int(11) default NULL,
- comments mediumtext,
- PRIMARY KEY (client_id),
- UNIQUE KEY client_name (client_name)
-) ENGINE=MyISAM PACK_KEYS=1;
-
-INSERT INTO t4 VALUES (1,0,'CPS',NULL,NULL);
-
-#
-# The query that fails...
-#
-select distinct
- t1.project_id as project_id,
- t1.project_name as project_name,
- t1.client_ptr as client_ptr,
- t1.comments as comments,
- sum( t3.amount_received ) + sum( t3.adjustment ) as total_budget
-from
- t2 as client_period ,
- t2 as project_period,
- t3 left join t1 on (t3.project_ptr = t1.project_id and
- t3.date_received <= '2001-03-22 14:15:09')
- left join t4 on t4.client_id = t1.client_ptr
- where
- 1
- and ( client_period.period_type = 'client_table'
- and client_period.period_key = t4.client_id
- and ( client_period.start_date <= '2001-03-22 14:15:09' or isnull( client_period.start_date ))
- and ( client_period.end_date > '2001-03-21 14:15:09' or isnull( client_period.end_date ))
- )
- and ( project_period.period_type = 'project_table'
- and project_period.period_key = t1.project_id
- and ( project_period.start_date <= '2001-03-22 14:15:09' or isnull( project_period.start_date ))
- and ( project_period.end_date > '2001-03-21 14:15:09' or isnull( project_period.end_date )) )
- group by
- client_id,
- project_id ,
- client_period.period_id ,
- project_period.period_id
- order by
- client_name asc,
- project_name asc;
-DROP TABLE t1,t2,t3,t4;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/join_nested.test b/mysql-test/t/join_nested.test
deleted file mode 100644
index e60b7827f75..00000000000
--- a/mysql-test/t/join_nested.test
+++ /dev/null
@@ -1,1382 +0,0 @@
-
---disable_warnings
-DROP TABLE IF EXISTS t0,t1,t2,t3,t4,t5,t6,t7,t8,t9;
---enable_warnings
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch=ifnull(@optimizer_switch_for_join_nested_test,'outer_join_with_cache=off');
-if (`select @join_cache_level_for_join_nested_test is null`)
-{
- set join_cache_level=1;
-}
-if (`select @join_cache_level_for_join_nested_test is not null`)
-{
- set join_cache_level=@join_cache_level_for_join_nested_test;
-}
-
-
-CREATE TABLE t0 (a int, b int, c int);
-CREATE TABLE t1 (a int, b int, c int);
-CREATE TABLE t2 (a int, b int, c int);
-CREATE TABLE t3 (a int, b int, c int);
-CREATE TABLE t4 (a int, b int, c int);
-CREATE TABLE t5 (a int, b int, c int);
-CREATE TABLE t6 (a int, b int, c int);
-CREATE TABLE t7 (a int, b int, c int);
-CREATE TABLE t8 (a int, b int, c int);
-CREATE TABLE t9 (a int, b int, c int);
-
-INSERT INTO t0 VALUES (1,1,0), (1,2,0), (2,2,0);
-INSERT INTO t1 VALUES (1,3,0), (2,2,0), (3,2,0);
-INSERT INTO t2 VALUES (3,3,0), (4,2,0), (5,3,0);
-INSERT INTO t3 VALUES (1,2,0), (2,2,0);
-INSERT INTO t4 VALUES (3,2,0), (4,2,0);
-INSERT INTO t5 VALUES (3,1,0), (2,2,0), (3,3,0);
-INSERT INTO t6 VALUES (3,2,0), (6,2,0), (6,1,0);
-INSERT INTO t7 VALUES (1,1,0), (2,2,0);
-INSERT INTO t8 VALUES (0,2,0), (1,2,0);
-INSERT INTO t9 VALUES (1,1,0), (1,2,0), (3,3,0);
-
-
-SELECT t2.a,t2.b
- FROM t2;
-
-SELECT t3.a,t3.b
- FROM t3;
-
-SELECT t4.a,t4.b
- FROM t4;
-
-SELECT t3.a,t3.b,t4.a,t4.b
- FROM t3,t4;
-
-SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
- FROM t2
- LEFT JOIN
- (t3, t4)
- ON t2.b=t4.b;
-
-SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
- FROM t2
- LEFT JOIN
- (t3, t4)
- ON t3.a=1 AND t2.b=t4.b;
-
-EXPLAIN EXTENDED
-SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
- FROM t2
- LEFT JOIN
- (t3, t4)
- ON t2.b=t4.b
- WHERE t3.a=1 OR t3.c IS NULL;
-
-SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
- FROM t2
- LEFT JOIN
- (t3, t4)
- ON t2.b=t4.b
- WHERE t3.a=1 OR t3.c IS NULL;
-
-SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
- FROM t2
- LEFT JOIN
- (t3, t4)
- ON t2.b=t4.b
- WHERE t3.a>1 OR t3.c IS NULL;
-
-SELECT t5.a,t5.b
- FROM t5;
-
-SELECT t3.a,t3.b,t4.a,t4.b,t5.a,t5.b
- FROM t3,t4,t5;
-
-SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,t5.a,t5.b
- FROM t2
- LEFT JOIN
- (t3, t4, t5)
- ON t2.b=t4.b;
-
-EXPLAIN EXTENDED
-SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,t5.a,t5.b
- FROM t2
- LEFT JOIN
- (t3, t4, t5)
- ON t2.b=t4.b
- WHERE t3.a>1 OR t3.c IS NULL;
-
-SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,t5.a,t5.b
- FROM t2
- LEFT JOIN
- (t3, t4, t5)
- ON t2.b=t4.b
- WHERE t3.a>1 OR t3.c IS NULL;
-
-EXPLAIN EXTENDED
-SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,t5.a,t5.b
- FROM t2
- LEFT JOIN
- (t3, t4, t5)
- ON t2.b=t4.b
- WHERE (t3.a>1 OR t3.c IS NULL) AND
- (t5.a<3 OR t5.c IS NULL);
-
-SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,t5.a,t5.b
- FROM t2
- LEFT JOIN
- (t3, t4, t5)
- ON t2.b=t4.b
- WHERE (t3.a>1 OR t3.c IS NULL) AND
- (t5.a<3 OR t5.c IS NULL);
-
-SELECT t6.a,t6.b
- FROM t6;
-
-SELECT t7.a,t7.b
- FROM t7;
-
-SELECT t6.a,t6.b,t7.a,t7.b
- FROM t6,t7;
-
-SELECT t8.a,t8.b
- FROM t8;
-
-EXPLAIN EXTENDED
-SELECT t6.a,t6.b,t7.a,t7.b,t8.a,t8.b
- FROM (t6, t7)
- LEFT JOIN
- t8
- ON t7.b=t8.b AND t6.b < 10;
-
-SELECT t6.a,t6.b,t7.a,t7.b,t8.a,t8.b
- FROM (t6, t7)
- LEFT JOIN
- t8
- ON t7.b=t8.b AND t6.b < 10;
-
-SELECT t5.a,t5.b
- FROM t5;
-
-SELECT t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b
- FROM t5
- LEFT JOIN
- (
- (t6, t7)
- LEFT JOIN
- t8
- ON t7.b=t8.b AND t6.b < 10
- )
- ON t6.b >= 2 AND t5.b=t7.b;
-
-SELECT t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b
- FROM t5
- LEFT JOIN
- (
- (t6, t7)
- LEFT JOIN
- t8
- ON t7.b=t8.b AND t6.b < 10
- )
- ON t6.b >= 2 AND t5.b=t7.b AND
- (t8.a < 1 OR t8.c IS NULL);
-
-SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
- FROM t2
- LEFT JOIN
- (t3, t4)
- ON t3.a=1 AND t2.b=t4.b;
-
-SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
- t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b
- FROM t2
- LEFT JOIN
- (t3, t4)
- ON t3.a=1 AND t2.b=t4.b,
- t5
- LEFT JOIN
- (
- (t6, t7)
- LEFT JOIN
- t8
- ON t7.b=t8.b AND t6.b < 10
- )
- ON t6.b >= 2 AND t5.b=t7.b;
-
-SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
- t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b
- FROM t2
- LEFT JOIN
- (t3, t4)
- ON t3.a=1 AND t2.b=t4.b,
- t5
- LEFT JOIN
- (
- (t6, t7)
- LEFT JOIN
- t8
- ON t7.b=t8.b AND t6.b < 10
- )
- ON t6.b >= 2 AND t5.b=t7.b
- WHERE t2.a > 3 AND
- (t6.a < 6 OR t6.c IS NULL);
-
-SELECT t1.a,t1.b
- FROM t1;
-
-SELECT t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
- t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b
- FROM t1
- LEFT JOIN
- (
- t2
- LEFT JOIN
- (t3, t4)
- ON t3.a=1 AND t2.b=t4.b,
- t5
- LEFT JOIN
- (
- (t6, t7)
- LEFT JOIN
- t8
- ON t7.b=t8.b AND t6.b < 10
- )
- ON t6.b >= 2 AND t5.b=t7.b
- )
- ON (t3.b=2 OR t3.c IS NULL) AND (t6.b=2 OR t6.c IS NULL) AND
- (t1.b=t5.b OR t3.c IS NULL OR t6.c IS NULL or t8.c IS NULL) AND
- (t1.a != 2);
-
-SELECT t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
- t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b
- FROM t1
- LEFT JOIN
- (
- t2
- LEFT JOIN
- (t3, t4)
- ON t3.a=1 AND t2.b=t4.b,
- t5
- LEFT JOIN
- (
- (t6, t7)
- LEFT JOIN
- t8
- ON t7.b=t8.b AND t6.b < 10
- )
- ON t6.b >= 2 AND t5.b=t7.b
- )
- ON (t3.b=2 OR t3.c IS NULL) AND (t6.b=2 OR t6.c IS NULL) AND
- (t1.b=t5.b OR t3.c IS NULL OR t6.c IS NULL or t8.c IS NULL) AND
- (t1.a != 2)
- WHERE (t2.a >= 4 OR t2.c IS NULL);
-
-SELECT t0.a,t0.b
- FROM t0;
-
-EXPLAIN EXTENDED
-SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
- t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b
- FROM t0,t1
- LEFT JOIN
- (
- t2
- LEFT JOIN
- (t3, t4)
- ON t3.a=1 AND t2.b=t4.b,
- t5
- LEFT JOIN
- (
- (t6, t7)
- LEFT JOIN
- t8
- ON t7.b=t8.b AND t6.b < 10
- )
- ON t6.b >= 2 AND t5.b=t7.b
- )
- ON (t3.b=2 OR t3.c IS NULL) AND (t6.b=2 OR t6.c IS NULL) AND
- (t1.b=t5.b OR t3.c IS NULL OR t6.c IS NULL or t8.c IS NULL) AND
- (t1.a != 2)
- WHERE t0.a=1 AND
- t0.b=t1.b AND
- (t2.a >= 4 OR t2.c IS NULL);
-
-SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
- t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b
- FROM t0,t1
- LEFT JOIN
- (
- t2
- LEFT JOIN
- (t3, t4)
- ON t3.a=1 AND t2.b=t4.b,
- t5
- LEFT JOIN
- (
- (t6, t7)
- LEFT JOIN
- t8
- ON t7.b=t8.b AND t6.b < 10
- )
- ON t6.b >= 2 AND t5.b=t7.b
- )
- ON (t3.b=2 OR t3.c IS NULL) AND (t6.b=2 OR t6.c IS NULL) AND
- (t1.b=t5.b OR t3.c IS NULL OR t6.c IS NULL or t8.c IS NULL) AND
- (t1.a != 2)
- WHERE t0.a=1 AND
- t0.b=t1.b AND
- (t2.a >= 4 OR t2.c IS NULL);
-
-EXPLAIN EXTENDED
-SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
- t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
- FROM t0,t1
- LEFT JOIN
- (
- t2
- LEFT JOIN
- (t3, t4)
- ON t3.a=1 AND t2.b=t4.b,
- t5
- LEFT JOIN
- (
- (t6, t7)
- LEFT JOIN
- t8
- ON t7.b=t8.b AND t6.b < 10
- )
- ON t6.b >= 2 AND t5.b=t7.b
- )
- ON (t3.b=2 OR t3.c IS NULL) AND (t6.b=2 OR t6.c IS NULL) AND
- (t1.b=t5.b OR t3.c IS NULL OR t6.c IS NULL or t8.c IS NULL) AND
- (t1.a != 2),
- t9
- WHERE t0.a=1 AND
- t0.b=t1.b AND
- (t2.a >= 4 OR t2.c IS NULL) AND
- (t3.a < 5 OR t3.c IS NULL) AND
- (t3.b=t4.b OR t3.c IS NULL OR t4.c IS NULL) AND
- (t5.a >=2 OR t5.c IS NULL) AND
- (t6.a >=4 OR t6.c IS NULL) AND
- (t7.a <= 2 OR t7.c IS NULL) AND
- (t8.a < 1 OR t8.c IS NULL) AND
- (t8.b=t9.b OR t8.c IS NULL) AND
- (t9.a=1);
-
-SELECT t9.a,t9.b
- FROM t9;
-
-SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
- t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
- FROM t0,t1
- LEFT JOIN
- (
- t2
- LEFT JOIN
- (t3, t4)
- ON t3.a=1 AND t2.b=t4.b,
- t5
- LEFT JOIN
- (
- (t6, t7)
- LEFT JOIN
- t8
- ON t7.b=t8.b AND t6.b < 10
- )
- ON t6.b >= 2 AND t5.b=t7.b
- )
- ON (t3.b=2 OR t3.c IS NULL) AND (t6.b=2 OR t6.c IS NULL) AND
- (t1.b=t5.b OR t3.c IS NULL OR t6.c IS NULL or t8.c IS NULL) AND
- (t1.a != 2),
- t9
- WHERE t0.a=1 AND
- t0.b=t1.b AND
- (t2.a >= 4 OR t2.c IS NULL) AND
- (t3.a < 5 OR t3.c IS NULL) AND
- (t3.b=t4.b OR t3.c IS NULL OR t4.c IS NULL) AND
- (t5.a >=2 OR t5.c IS NULL) AND
- (t6.a >=4 OR t6.c IS NULL) AND
- (t7.a <= 2 OR t7.c IS NULL) AND
- (t8.a < 1 OR t8.c IS NULL) AND
- (t8.b=t9.b OR t8.c IS NULL) AND
- (t9.a=1);
-
-SELECT t1.a,t1.b
- FROM t1;
-
-SELECT t2.a,t2.b
- FROM t2;
-
-SELECT t3.a,t3.b
- FROM t3;
-
-SELECT t2.a,t2.b,t3.a,t3.b
- FROM t2
- LEFT JOIN
- t3
- ON t2.b=t3.b;
-
-SELECT t1.a,t1.b,t2.a,t2.b,t3.a,t3.b
- FROM t1, t2
- LEFT JOIN
- t3
- ON t2.b=t3.b
- WHERE t1.a <= 2;
-
-SELECT t1.a,t1.b,t2.a,t2.b,t3.a,t3.b
- FROM t1, t3
- RIGHT JOIN
- t2
- ON t2.b=t3.b
- WHERE t1.a <= 2;
-
-SELECT t3.a,t3.b,t4.a,t4.b
- FROM t3,t4;
-
-SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
- FROM t2
- LEFT JOIN
- (t3, t4)
- ON t3.a=1 AND t2.b=t4.b;
-
-SELECT t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
- FROM t1, t2
- LEFT JOIN
- (t3, t4)
- ON t3.a=1 AND t2.b=t4.b
- WHERE t1.a <= 2;
-
-SELECT t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
- FROM t1, (t3, t4)
- RIGHT JOIN
- t2
- ON t3.a=1 AND t2.b=t4.b
- WHERE t1.a <= 2;
-
-SELECT t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
- FROM t1, (t3, t4)
- RIGHT JOIN
- t2
- ON t3.a=1 AND t2.b=t4.b
- WHERE t1.a <= 2;
-
-EXPLAIN EXTENDED
-SELECT t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
- FROM t1, (t3, t4)
- RIGHT JOIN
- t2
- ON t3.a=1 AND t2.b=t4.b
- WHERE t1.a <= 2;
-
-INSERT INTO t2 VALUES (-1,9,0), (-3,10,0), (-2,8,0), (-4,11,0), (-5,15,0);
-CREATE INDEX idx_b ON t2(b);
-
-EXPLAIN EXTENDED
-SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
- FROM (t3,t4)
- LEFT JOIN
- (t1,t2)
- ON t3.a=1 AND t3.b=t2.b AND t2.b=t4.b AND t2.a>0;
-SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
- FROM (t3,t4)
- LEFT JOIN
- (t1,t2)
- ON t3.a=1 AND t3.b=t2.b AND t2.b=t4.b AND t2.a>0;
-
-EXPLAIN EXTENDED
-SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
- t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
- FROM t0,t1
- LEFT JOIN
- (
- t2
- LEFT JOIN
- (t3, t4)
- ON t3.a=1 AND t2.b=t4.b AND t2.a>0,
- t5
- LEFT JOIN
- (
- (t6, t7)
- LEFT JOIN
- t8
- ON t7.b=t8.b AND t6.b < 10
- )
- ON t6.b >= 2 AND t5.b=t7.b
- )
- ON (t3.b=2 OR t3.c IS NULL) AND (t6.b=2 OR t6.c IS NULL) AND
- (t1.b=t5.b OR t3.c IS NULL OR t6.c IS NULL or t8.c IS NULL) AND
- (t1.a != 2),
- t9
- WHERE t0.a=1 AND
- t0.b=t1.b AND
- (t2.a >= 4 OR t2.c IS NULL) AND
- (t3.a < 5 OR t3.c IS NULL) AND
- (t3.b=t4.b OR t3.c IS NULL OR t4.c IS NULL) AND
- (t5.a >=2 OR t5.c IS NULL) AND
- (t6.a >=4 OR t6.c IS NULL) AND
- (t7.a <= 2 OR t7.c IS NULL) AND
- (t8.a < 1 OR t8.c IS NULL) AND
- (t8.b=t9.b OR t8.c IS NULL) AND
- (t9.a=1);
-
-INSERT INTO t4 VALUES (-3,12,0), (-4,13,0), (-1,11,0), (-3,11,0), (-5,15,0);
-INSERT INTO t5 VALUES (-3,11,0), (-2,12,0), (-3,13,0), (-4,12,0);
-CREATE INDEX idx_b ON t4(b);
-CREATE INDEX idx_b ON t5(b);
-
-EXPLAIN EXTENDED
-SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
- t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
- FROM t0,t1
- LEFT JOIN
- (
- t2
- LEFT JOIN
- (t3, t4)
- ON t3.a=1 AND t2.b=t4.b AND t2.a>0 AND t4.a>0,
- t5
- LEFT JOIN
- (
- (t6, t7)
- LEFT JOIN
- t8
- ON t7.b=t8.b AND t6.b < 10
- )
- ON t6.b >= 2 AND t5.b=t7.b AND t5.a>0
- )
- ON (t3.b=2 OR t3.c IS NULL) AND (t6.b=2 OR t6.c IS NULL) AND
- (t1.b=t5.b OR t3.c IS NULL OR t6.c IS NULL or t8.c IS NULL) AND
- (t1.a != 2),
- t9
- WHERE t0.a=1 AND
- t0.b=t1.b AND
- (t2.a >= 4 OR t2.c IS NULL) AND
- (t3.a < 5 OR t3.c IS NULL) AND
- (t3.b=t4.b OR t3.c IS NULL OR t4.c IS NULL) AND
- (t5.a >=2 OR t5.c IS NULL) AND
- (t6.a >=4 OR t6.c IS NULL) AND
- (t7.a <= 2 OR t7.c IS NULL) AND
- (t8.a < 1 OR t8.c IS NULL) AND
- (t8.b=t9.b OR t8.c IS NULL) AND
- (t9.a=1);
-
-INSERT INTO t8 VALUES (-3,12,0), (-1,14,0), (-5,15,0), (-1,11,0), (-4,13,0);
-CREATE INDEX idx_b ON t8(b);
-
-EXPLAIN EXTENDED
-SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
- t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
- FROM t0,t1
- LEFT JOIN
- (
- t2
- LEFT JOIN
- (t3, t4)
- ON t3.a=1 AND t2.b=t4.b AND t2.a>0 AND t4.a>0,
- t5
- LEFT JOIN
- (
- (t6, t7)
- LEFT JOIN
- t8
- ON t7.b=t8.b AND t6.b < 10 AND t8.a>=0
- )
- ON t6.b >= 2 AND t5.b=t7.b AND t5.a>0
- )
- ON (t3.b=2 OR t3.c IS NULL) AND (t6.b=2 OR t6.c IS NULL) AND
- (t1.b=t5.b OR t3.c IS NULL OR t6.c IS NULL or t8.c IS NULL) AND
- (t1.a != 2),
- t9
- WHERE t0.a=1 AND
- t0.b=t1.b AND
- (t2.a >= 4 OR t2.c IS NULL) AND
- (t3.a < 5 OR t3.c IS NULL) AND
- (t3.b=t4.b OR t3.c IS NULL OR t4.c IS NULL) AND
- (t5.a >=2 OR t5.c IS NULL) AND
- (t6.a >=4 OR t6.c IS NULL) AND
- (t7.a <= 2 OR t7.c IS NULL) AND
- (t8.a < 1 OR t8.c IS NULL) AND
- (t8.b=t9.b OR t8.c IS NULL) AND
- (t9.a=1);
-
-INSERT INTO t1 VALUES (-1,133,0), (-2,12,0), (-3,11,0), (-5,15,0);
-CREATE INDEX idx_b ON t1(b);
-CREATE INDEX idx_a ON t0(a);
-
-EXPLAIN EXTENDED
-SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
- t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
- FROM t0,t1
- LEFT JOIN
- (
- t2
- LEFT JOIN
- (t3, t4)
- ON t3.a=1 AND t2.b=t4.b,
- t5
- LEFT JOIN
- (
- (t6, t7)
- LEFT JOIN
- t8
- ON t7.b=t8.b AND t6.b < 10
- )
- ON t6.b >= 2 AND t5.b=t7.b
- )
- ON (t3.b=2 OR t3.c IS NULL) AND (t6.b=2 OR t6.c IS NULL) AND
- (t1.b=t5.b OR t3.c IS NULL OR t6.c IS NULL or t8.c IS NULL) AND
- (t1.a != 2) AND t1.a>0,
- t9
- WHERE t0.a=1 AND
- t0.b=t1.b AND
- (t2.a >= 4 OR t2.c IS NULL) AND
- (t3.a < 5 OR t3.c IS NULL) AND
- (t3.b=t4.b OR t3.c IS NULL OR t4.c IS NULL) AND
- (t5.a >=2 OR t5.c IS NULL) AND
- (t6.a >=4 OR t6.c IS NULL) AND
- (t7.a <= 2 OR t7.c IS NULL) AND
- (t8.a < 1 OR t8.c IS NULL) AND
- (t8.b=t9.b OR t8.c IS NULL) AND
- (t9.a=1);
-
-SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
- t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
- FROM t0,t1
- LEFT JOIN
- (
- t2
- LEFT JOIN
- (t3, t4)
- ON t3.a=1 AND t2.b=t4.b,
- t5
- LEFT JOIN
- (
- (t6, t7)
- LEFT JOIN
- t8
- ON t7.b=t8.b AND t6.b < 10
- )
- ON t6.b >= 2 AND t5.b=t7.b
- )
- ON (t3.b=2 OR t3.c IS NULL) AND (t6.b=2 OR t6.c IS NULL) AND
- (t1.b=t5.b OR t3.c IS NULL OR t6.c IS NULL or t8.c IS NULL) AND
- (t1.a != 2) AND t1.a>0,
- t9
- WHERE t0.a=1 AND
- t0.b=t1.b AND
- (t2.a >= 4 OR t2.c IS NULL) AND
- (t3.a < 5 OR t3.c IS NULL) AND
- (t3.b=t4.b OR t3.c IS NULL OR t4.c IS NULL) AND
- (t5.a >=2 OR t5.c IS NULL) AND
- (t6.a >=4 OR t6.c IS NULL) AND
- (t7.a <= 2 OR t7.c IS NULL) AND
- (t8.a < 1 OR t8.c IS NULL) AND
- (t8.b=t9.b OR t8.c IS NULL) AND
- (t9.a=1);
-
-SELECT t2.a,t2.b
- FROM t2;
-
-SELECT t3.a,t3.b
- FROM t3;
-
-SELECT t2.a,t2.b,t3.a,t3.b
- FROM t2 LEFT JOIN t3 ON t2.b=t3.b
- WHERE t2.a = 4 OR (t2.a > 4 AND t3.a IS NULL);
-
-SELECT t2.a,t2.b,t3.a,t3.b
- FROM t2 LEFT JOIN (t3) ON t2.b=t3.b
- WHERE t2.a = 4 OR (t2.a > 4 AND t3.a IS NULL);
-
-ALTER TABLE t3
- CHANGE COLUMN a a1 int,
- CHANGE COLUMN c c1 int;
-
-SELECT t2.a,t2.b,t3.a1,t3.b
- FROM t2 LEFT JOIN t3 ON t2.b=t3.b
- WHERE t2.a = 4 OR (t2.a > 4 AND t3.a1 IS NULL);
-
-SELECT t2.a,t2.b,t3.a1,t3.b
- FROM t2 NATURAL LEFT JOIN t3
- WHERE t2.a = 4 OR (t2.a > 4 AND t3.a1 IS NULL);
-
-DROP TABLE t0,t1,t2,t3,t4,t5,t6,t7,t8,t9;
-
-CREATE TABLE t1 (a int);
-CREATE TABLE t2 (a int);
-CREATE TABLE t3 (a int);
-
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (2);
-INSERT INTO t3 VALUES (2);
-INSERT INTO t1 VALUES (2);
-
-#check proper syntax for nested outer joins
-
-SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON t2.a=t3.a) ON t1.a=t3.a;
-
-#must be equivalent to:
-
-SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON t2.a=t3.a ON t1.a=t3.a;
-
-#check that everything is al right when all tables contain not more than 1 row
-#(bug #4922)
-
-DELETE FROM t1 WHERE a=2;
-SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON t2.a=t3.a ON t1.a=t3.a;
-DELETE FROM t2;
-SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON t2.a=t3.a ON t1.a=t3.a;
-
-DROP TABLE t1,t2,t3;
-
-#on expression for a nested outer join does not depend on the outer table
-#bug #4976
-
-CREATE TABLE t1(a int, key (a));
-CREATE TABLE t2(b int, key (b));
-CREATE TABLE t3(c int, key (c));
-
-INSERT INTO t1 VALUES (NULL), (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
-(10), (11), (12), (13), (14), (15), (16), (17), (18), (19);
-
-INSERT INTO t2 VALUES (NULL), (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
-(10), (11), (12), (13), (14), (15), (16), (17), (18), (19);
-
-INSERT INTO t3 VALUES (0), (1), (2), (3), (4), (5);
-
-EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON c < 3 and b = c;
-EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c;
-SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c;
-
-DELETE FROM t3;
-EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c;
-SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c;
-
-DROP TABLE t1,t2,t3;
-
-#
-# Test for bug #11284: empty table in a nested left join
-#
-
-CREATE TABLE t1 (c11 int);
-CREATE TABLE t2 (c21 int);
-CREATE TABLE t3 (c31 int);
-
-INSERT INTO t1 VALUES (4), (5);
-
-SELECT * FROM t1 LEFT JOIN t2 ON c11=c21;
-EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON c11=c21;
-
-SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON c21=c31) ON c11=c21;
-EXPLAIN SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON c21=c31) ON c11=c21;
-
-DROP TABLE t1,t2,t3;
-
-#
-# Bug #12154: creation of temp table for a query with nested outer join
-#
-
-CREATE TABLE t1 (goods int(12) NOT NULL, price varchar(128) NOT NULL);
-INSERT INTO t1 VALUES (23, 2340), (26, 9900);
-
-CREATE TABLE t2 (goods int(12), name varchar(50), shop char(2));
-INSERT INTO t2 VALUES (23, 'as300', 'fr'), (26, 'as600', 'fr');
-
-create table t3 (groupid int(12) NOT NULL, goodsid int(12) NOT NULL);
-INSERT INTO t3 VALUES (3,23), (6,26);
-
-CREATE TABLE t4 (groupid int(12));
-INSERT INTO t4 VALUES (1), (2), (3), (4), (5), (6);
-
-SELECT * FROM
-(SELECT DISTINCT gl.groupid, gp.price
- FROM t4 gl
- LEFT JOIN
- (t3 g INNER JOIN t2 p ON g.goodsid = p.goods
- INNER JOIN t1 gp ON p.goods = gp.goods)
- ON gl.groupid = g.groupid and p.shop = 'fr') t;
-
-CREATE VIEW v1 AS
-SELECT g.groupid groupid, p.goods goods,
- p.name name, p.shop shop,
- gp.price price
- FROM t3 g INNER JOIN t2 p ON g.goodsid = p.goods
- INNER JOIN t1 gp on p.goods = gp.goods;
-
-CREATE VIEW v2 AS
-SELECT DISTINCT g.groupid, fr.price
- FROM t4 g
- LEFT JOIN
- v1 fr on g.groupid = fr.groupid and fr.shop = 'fr';
-
-SELECT * FROM v2;
-
-SELECT * FROM
-(SELECT DISTINCT g.groupid, fr.price
- FROM t4 g
- LEFT JOIN
- v1 fr on g.groupid = fr.groupid and fr.shop = 'fr') t;
-
-DROP VIEW v1,v2;
-DROP TABLE t1,t2,t3,t4;
-
-#
-# Bug #13545: problem with NATURAL/USING joins.
-#
-
-CREATE TABLE t1(a int);
-CREATE TABLE t2(b int);
-CREATE TABLE t3(c int, d int);
-CREATE TABLE t4(d int);
-CREATE TABLE t5(e int, f int);
-CREATE TABLE t6(f int);
-CREATE VIEW v1 AS
- SELECT e FROM t5 JOIN t6 ON t5.e=t6.f;
-CREATE VIEW v2 AS
- SELECT e FROM t5 NATURAL JOIN t6;
-
-SELECT t1.a FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c JOIN t4 USING(d);
---error 1054
-SELECT t1.x FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c JOIN t4 USING(d);
-SELECT t1.a FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c NATURAL JOIN t4;
---error 1054
-SELECT t1.x FROM t1 JOIN t2 ON a=b JOIN t3 ON a=c NATURAL JOIN t4;
-SELECT v1.e FROM v1 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
---error 1054
-SELECT v1.x FROM v1 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
-SELECT v2.e FROM v2 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
---error 1054
-SELECT v2.x FROM v2 JOIN t2 ON e=b JOIN t3 ON e=c JOIN t4 USING(d);
-
-DROP VIEW v1, v2;
-DROP TABLE t1, t2, t3, t4, t5, t6;
-
-#
-# BUG#13126 -test case from bug report
-#
-create table t1 (id1 int(11) not null);
-insert into t1 values (1),(2);
-
-create table t2 (id2 int(11) not null);
-insert into t2 values (1),(2),(3),(4);
-
-create table t3 (id3 char(16) not null);
-insert into t3 values ('100');
-
-create table t4 (id2 int(11) not null, id3 char(16));
-
-create table t5 (id1 int(11) not null, key (id1));
-insert into t5 values (1),(2),(1);
-
-create view v1 as
- select t4.id3 from t4 join t2 on t4.id2 = t2.id2;
-
-select t1.id1 from t1 inner join (t3 left join v1 on t3.id3 = v1.id3);
-
-drop view v1;
-drop table t1, t2, t3, t4, t5;
-
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3);
-create table t1(a int);
-insert into t1 select A.a + 10*(B.a) from t0 A, t0 B;
-
-create table t2 (a int, b int);
-insert into t2 values (1,1), (2,2), (3,3);
-
-create table t3(a int, b int, filler char(200), key(a));
-insert into t3 select a,a,'filler' from t1;
-insert into t3 select a,a,'filler' from t1;
-
-create table t4 like t3;
-insert into t4 select * from t3;
-insert into t4 select * from t3;
-
-create table t5 like t4;
-insert into t5 select * from t4;
-insert into t5 select * from t4;
-
-create table t6 like t5;
-insert into t6 select * from t5;
-insert into t6 select * from t5;
-
-create table t7 like t6;
-insert into t7 select * from t6;
-insert into t7 select * from t6;
-
---replace_column 9 X
-explain select * from t4 join
- t2 left join (t3 join t5 on t5.a=t3.b) on t3.a=t2.b where t4.a<=>t3.b;
-
---replace_column 9 X
-explain select * from (t4 join t6 on t6.a=t4.b) right join t3 on t4.a=t3.b
- join t2 left join (t5 join t7 on t7.a=t5.b) on t5.a=t2.b where t3.a<=>t2.b;
-
---replace_column 9 X
-explain select * from t2 left join
- (t3 left join (t4 join t6 on t6.a=t4.b) on t4.a=t3.b
- join t5 on t5.a=t3.b) on t3.a=t2.b;
-
-drop table t0, t1, t2, t3, t4, t5, t6, t7;
-
-# BUG#16393
-create table t1 (a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t2 (a int, filler char(100), key(a));
-insert into t2 select A.a + 10*B.a, '' from t1 A, t1 B;
-create table t3 like t2;
-insert into t3 select * from t2;
-
-explain select * from t1 left join
- (t2 left join t3 on (t2.a = t3.a))
- on (t1.a = t2.a);
-drop table t1, t2, t3;
-
-#
-# Bug #16260: single row table in the inner nest of an outer join
-#
-
-CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, type varchar(10));
-CREATE TABLE t2 (pid int NOT NULL PRIMARY KEY, type varchar(10));
-CREATE TABLE t3 (cid int NOT NULL PRIMARY KEY,
- id int NOT NULL,
- pid int NOT NULL);
-
-INSERT INTO t1 VALUES (1, 'A'), (3, 'C');
-INSERT INTO t2 VALUES (1, 'A'), (3, 'C');
-INSERT INTO t3 VALUES (1, 1, 1), (3, 3, 3);
-
-SELECT * FROM t1 p LEFT JOIN (t3 JOIN t1)
- ON (t1.id=t3.id AND t1.type='B' AND p.id=t3.id)
- LEFT JOIN t2 ON (t3.pid=t2.pid)
- WHERE p.id=1;
-
-CREATE VIEW v1 AS
- SELECT t3.* FROM t3 JOIN t1 ON t1.id=t3.id AND t1.type='B';
-
-SELECT * FROM t1 p LEFT JOIN v1 ON p.id=v1.id
- LEFT JOIN t2 ON v1.pid=t2.pid
- WHERE p.id=1;
-
-DROP VIEW v1;
-DROP TABLE t1,t2,t3;
-
-
-#
-# Test for bug #18279: crash when on conditions are moved out of a nested join
-# to the on conditions for the nest
-
-CREATE TABLE t1 (id1 int PRIMARY KEY, id2 int);
-CREATE TABLE t2 (id1 int PRIMARY KEY, id2 int);
-CREATE TABLE t3 (id1 int PRIMARY KEY, id2 int);
-CREATE TABLE t4 (id1 int PRIMARY KEY, id2 int);
-CREATE TABLE t5 (id1 int PRIMARY KEY, id2 int);
-
-SELECT t1.id1 AS id, t5.id1 AS ngroupbynsa
- FROM t1 INNER JOIN t2 ON t2.id2 = t1.id1
- LEFT OUTER JOIN
- (t3 INNER JOIN t4 ON t4.id1 = t3.id2 INNER JOIN t5 ON t4.id2 = t5.id1)
- ON t3.id2 IS NOT NULL
- WHERE t1.id1=2;
-
-PREPARE stmt FROM
-"SELECT t1.id1 AS id, t5.id1 AS ngroupbynsa
- FROM t1 INNER JOIN t2 ON t2.id2 = t1.id1
- LEFT OUTER JOIN
- (t3 INNER JOIN t4 ON t4.id1 = t3.id2 INNER JOIN t5 ON t4.id2 = t5.id1)
- ON t3.id2 IS NOT NULL
- WHERE t1.id1=2";
-
-EXECUTE stmt;
-EXECUTE stmt;
-EXECUTE stmt;
-EXECUTE stmt;
-
-INSERT INTO t1 VALUES (1,1), (2,1), (3,2);
-INSERT INTO t2 VALUES (2,1), (3,2), (4,3);
-INSERT INTO t3 VALUES (1,1), (3,2), (2,NULL);
-INSERT INTO t4 VALUES (1,1), (2,1), (3,3);
-INSERT INTO t5 VALUES (1,1), (2,2), (3,3), (4,3);
-
-EXECUTE stmt;
-EXECUTE stmt;
-EXECUTE stmt;
-EXECUTE stmt;
-
-SELECT t1.id1 AS id, t5.id1 AS ngroupbynsa
- FROM t1 INNER JOIN t2 ON t2.id2 = t1.id1
- LEFT OUTER JOIN
- (t3 INNER JOIN t4 ON t4.id1 = t3.id2 INNER JOIN t5 ON t4.id2 = t5.id1)
- ON t3.id2 IS NOT NULL
- WHERE t1.id1=2;
-
-DROP TABLE t1,t2,t3,t4,t5;
-
-#
-# Test for bug #24345: crash with nested left outer join when outer table is substituted
-# for a row that happens to have a null value for the join attribute.
-#
-
-CREATE TABLE t1 (
- id int NOT NULL PRIMARY KEY,
- ct int DEFAULT NULL,
- pc int DEFAULT NULL,
- INDEX idx_ct (ct),
- INDEX idx_pc (pc)
-);
-INSERT INTO t1 VALUES
- (1,NULL,NULL),(2,NULL,NULL),(3,NULL,NULL),(4,NULL,NULL),(5,NULL,NULL);
-
-CREATE TABLE t2 (
- id int NOT NULL PRIMARY KEY,
- sr int NOT NULL,
- nm varchar(255) NOT NULL,
- INDEX idx_sr (sr)
-);
-INSERT INTO t2 VALUES
- (2441905,4308,'LesAbymes'),(2441906,4308,'Anse-Bertrand');
-
-CREATE TABLE t3 (
- id int NOT NULL PRIMARY KEY,
- ct int NOT NULL,
- ln int NOT NULL,
- INDEX idx_ct (ct),
- INDEX idx_ln (ln)
-);
-
-CREATE TABLE t4 (
- id int NOT NULL PRIMARY KEY,
- nm varchar(255) NOT NULL
-);
-
-INSERT INTO t4 VALUES (4308,'Guadeloupe'),(4309,'Martinique');
-
-SELECT t1.*
- FROM t1 LEFT JOIN
- (t2 LEFT JOIN t3 ON t3.ct=t2.id AND t3.ln='5') ON t1.ct=t2.id
- WHERE t1.id='5';
-
-SELECT t1.*, t4.nm
- FROM t1 LEFT JOIN
- (t2 LEFT JOIN t3 ON t3.ct=t2.id AND t3.ln='5') ON t1.ct=t2.id
- LEFT JOIN t4 ON t2.sr=t4.id
- WHERE t1.id='5';
-
-DROP TABLE t1,t2,t3,t4;
-
-#
-# BUG#25575: ERROR 1052 (Column in from clause is ambiguous) with sub-join
-#
-CREATE TABLE t1 (a INT, b INT);
-CREATE TABLE t2 (a INT);
-CREATE TABLE t3 (a INT, c INT);
-CREATE TABLE t4 (a INT, c INT);
-CREATE TABLE t5 (a INT, c INT);
-
-SELECT b FROM t1 JOIN (t2 LEFT JOIN t3 USING (a) LEFT JOIN t4 USING (a)
-LEFT JOIN t5 USING (a)) USING (a);
-
---error ER_NON_UNIQ_ERROR
-SELECT c FROM t1 JOIN (t2 LEFT JOIN t3 USING (a) LEFT JOIN t4 USING (a)
-LEFT JOIN t5 USING (a)) USING (a);
-
-SELECT b FROM t1 JOIN (t2 JOIN t3 USING (a) JOIN t4 USING (a)
-JOIN t5 USING (a)) USING (a);
-
---error ER_NON_UNIQ_ERROR
-SELECT c FROM t1 JOIN (t2 JOIN t3 USING (a) JOIN t4 USING (a)
-JOIN t5 USING (a)) USING (a);
-
-DROP TABLE t1,t2,t3,t4,t5;
-CREATE TABLE t1 (a INT, b INT);
-CREATE TABLE t2 (a INT, b INT);
-CREATE TABLE t3 (a INT, b INT);
-
-INSERT INTO t1 VALUES (1,1);
-INSERT INTO t2 VALUES (1,1);
-INSERT INTO t3 VALUES (1,1);
-
---error ER_NON_UNIQ_ERROR
-SELECT * FROM t1 JOIN (t2 JOIN t3 USING (b)) USING (a);
-
-DROP TABLE t1,t2,t3;
-
-#
-# BUG#29604: inner nest of left join interleaves with outer tables
-#
-
-CREATE TABLE t1 (
- carrier char(2) default NULL,
- id int NOT NULL auto_increment PRIMARY KEY
-);
-INSERT INTO t1 VALUES
- ('CO',235371754),('CO',235376554),('CO',235376884),('CO',235377874),
- ('CO',231060394),('CO',231059224),('CO',231059314),('CO',231060484),
- ('CO',231060274),('CO',231060124),('CO',231060244),('CO',231058594),
- ('CO',231058924),('CO',231058504),('CO',231059344),('CO',231060424),
- ('CO',231059554),('CO',231060304),('CO',231059644),('CO',231059464),
- ('CO',231059764),('CO',231058294),('CO',231058624),('CO',231058864),
- ('CO',231059374),('CO',231059584),('CO',231059734),('CO',231059014),
- ('CO',231059854),('CO',231059494),('CO',231059794),('CO',231058534),
- ('CO',231058324),('CO',231058684),('CO',231059524),('CO',231059974);
-
-CREATE TABLE t2 (
- scan_date date default NULL,
- package_id int default NULL,
- INDEX scan_date(scan_date),
- INDEX package_id(package_id)
-);
-INSERT INTO t2 VALUES
- ('2008-12-29',231062944),('2008-12-29',231065764),('2008-12-29',231066124),
- ('2008-12-29',231060094),('2008-12-29',231061054),('2008-12-29',231065644),
- ('2008-12-29',231064384),('2008-12-29',231064444),('2008-12-29',231073774),
- ('2008-12-29',231058594),('2008-12-29',231059374),('2008-12-29',231066004),
- ('2008-12-29',231068494),('2008-12-29',231070174),('2008-12-29',231071884),
- ('2008-12-29',231063274),('2008-12-29',231063754),('2008-12-29',231064144),
- ('2008-12-29',231069424),('2008-12-29',231073714),('2008-12-29',231058414),
- ('2008-12-29',231060994),('2008-12-29',231069154),('2008-12-29',231068614),
- ('2008-12-29',231071464),('2008-12-29',231074014),('2008-12-29',231059614),
- ('2008-12-29',231059074),('2008-12-29',231059464),('2008-12-29',231069094),
- ('2008-12-29',231067294),('2008-12-29',231070144),('2008-12-29',231073804),
- ('2008-12-29',231072634),('2008-12-29',231058294),('2008-12-29',231065344),
- ('2008-12-29',231066094),('2008-12-29',231069034),('2008-12-29',231058594),
- ('2008-12-29',231059854),('2008-12-29',231059884),('2008-12-29',231059914),
- ('2008-12-29',231063664),('2008-12-29',231063814),('2008-12-29',231063904);
-
-CREATE TABLE t3 (
- package_id int default NULL,
- INDEX package_id(package_id)
-);
-INSERT INTO t3 VALUES
- (231058294),(231058324),(231058354),(231058384),(231058414),(231058444),
- (231058474),(231058504),(231058534),(231058564),(231058594),(231058624),
- (231058684),(231058744),(231058804),(231058864),(231058924),(231058954),
- (231059014),(231059074),(231059104),(231059134),(231059164),(231059194),
- (231059224),(231059254),(231059284),(231059314),(231059344),(231059374),
- (231059404),(231059434),(231059464),(231059494),(231059524),(231059554),
- (231059584),(231059614),(231059644),(231059674),(231059704),(231059734),
- (231059764),(231059794),(231059824),(231059854),(231059884),(231059914),
- (231059944),(231059974),(231060004),(231060034),(231060064),(231060094),
- (231060124),(231060154),(231060184),(231060214),(231060244),(231060274),
- (231060304),(231060334),(231060364),(231060394),(231060424),(231060454),
- (231060484),(231060514),(231060544),(231060574),(231060604),(231060634),
- (231060664),(231060694),(231060724),(231060754),(231060784),(231060814),
- (231060844),(231060874),(231060904),(231060934),(231060964),(231060994),
- (231061024),(231061054),(231061084),(231061144),(231061174),(231061204),
- (231061234),(231061294),(231061354),(231061384),(231061414),(231061474),
- (231061564),(231061594),(231061624),(231061684),(231061714),(231061774),
- (231061804),(231061894),(231061984),(231062074),(231062134),(231062224),
- (231062254),(231062314),(231062374),(231062434),(231062494),(231062554),
- (231062584),(231062614),(231062644),(231062704),(231062734),(231062794),
- (231062854),(231062884),(231062944),(231063004),(231063034),(231063064),
- (231063124),(231063154),(231063184),(231063214),(231063274),(231063334),
- (231063394),(231063424),(231063454),(231063514),(231063574),(231063664);
-
-CREATE TABLE t4 (
- carrier char(2) NOT NULL default '' PRIMARY KEY,
- id int(11) default NULL,
- INDEX id(id)
-);
-INSERT INTO t4 VALUES
- ('99',6),('SK',456),('UA',486),('AI',1081),('OS',1111),('VS',1510);
-
-CREATE TABLE t5 (
- carrier_id int default NULL,
- INDEX carrier_id(carrier_id)
-);
-INSERT INTO t5 VALUES
- (6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),
- (6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),
- (6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),
- (6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),
- (6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),
- (6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(456),(456),(456),
- (456),(456),(456),(456),(456),(456),(456),(456),(456),(456),(456),(456),
- (456),(486),(1081),(1111),(1111),(1111),(1111),(1510);
-
-SELECT COUNT(*)
- FROM((t2 JOIN t1 ON t2.package_id = t1.id)
- JOIN t3 ON t3.package_id = t1.id);
-
-EXPLAIN
-SELECT COUNT(*)
- FROM ((t2 JOIN t1 ON t2.package_id = t1.id)
- JOIN t3 ON t3.package_id = t1.id)
- LEFT JOIN
- (t5 JOIN t4 ON t5.carrier_id = t4.id)
- ON t4.carrier = t1.carrier;
-SELECT COUNT(*)
- FROM ((t2 JOIN t1 ON t2.package_id = t1.id)
- JOIN t3 ON t3.package_id = t1.id)
- LEFT JOIN
- (t5 JOIN t4 ON t5.carrier_id = t4.id)
- ON t4.carrier = t1.carrier;
-
-DROP TABLE t1,t2,t3,t4,t5;
-
-#
-# BUG#49322: Nested left joins + not-exist optimization
-#
-
-CREATE TABLE t1 (
- pk int NOT NULL AUTO_INCREMENT PRIMARY KEY,
- a int DEFAULT NULL,
- KEY idx(a)
-);
-CREATE TABLE t2 (
- pk int NOT NULL AUTO_INCREMENT PRIMARY KEY,
- a int DEFAULT NULL,
- KEY idx(a)
-);
-CREATE TABLE t3 (
- pk int NOT NULL AUTO_INCREMENT PRIMARY KEY,
- a int DEFAULT NULL,
- KEY idx(a)
-);
-
-INSERT INTO t1 VALUES
- (1,2), (2,7), (3,5), (4,7), (5,5), (6,NULL), (7,NULL), (8,9);
-INSERT INTO t2 VALUES
- (1,NULL), (4,2), (5,2), (3,4), (2,8);
-INSERT INTO t3 VALUES
- (1,9), (2,2), (3,5), (4,2), (5,7), (6,0), (7,5);
-
-SELECT t1.pk, t1.a, t2.pk, t2.a,t3.pk, t3.a
- FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON t3.a=t2.a) ON t2.a=t1.a;
-
-SELECT t1.pk, t1.a, t2.pk, t2.a,t3.pk, t3.a
- FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON t3.a=t2.a) ON t2.a=t1.a
- WHERE t2.pk IS NULL;
-
-SELECT t1.pk, t1.a, t2.pk, t2.a,t3.pk, t3.a
- FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON t3.a=t2.a) ON t2.a=t1.a
- WHERE t3.pk IS NULL;
-
-DROP TABLE t1, t2, t3;
-
-
-#
-# LP BUG#817360: Nested left joins + not-exist optimization
-#
-
-CREATE TABLE t1 (a int NOT NULL );
-INSERT INTO t1 VALUES (9), (9);
-
-CREATE TABLE t2 (a int NOT NULL );
-INSERT INTO t2 VALUES (9);
-
-CREATE TABLE t3 (a int NOT NULL, b int);
-INSERT INTO t3 VALUES (19,9);
-
-CREATE TABLE t4 (b int) ;
-
-SELECT * FROM t1 LEFT JOIN
- ((t2 LEFT JOIN t3 ON t2.a=t3.b) LEFT JOIN t4 ON t3.a=t4.b)
- ON t1.a=t2.a;
-SELECT * FROM t1 LEFT JOIN
- ((t2 LEFT JOIN t3 ON t2.a=t3.b) LEFT JOIN t4 ON t3.a=t4.b)
- ON t1.a=t2.a
- WHERE t3.a IS NULL;
-EXPLAIN EXTENDED
-SELECT * FROM t1 LEFT JOIN
- ((t2 LEFT JOIN t3 ON t2.a=t3.b) LEFT JOIN t4 ON t3.a=t4.b)
- ON t1.a=t2.a
- WHERE t3.a IS NULL;
-
-DROP TABLE t1,t2,t3,t4;
-
-SET optimizer_switch=@save_optimizer_switch;
-
---echo End of 5.0 tests
-
---echo #
---echo # MDEV-621: LP:693329 - Assertion `!is_interleave_error' failed on low optimizer_search_depth
---echo #
-set @tmp_mdev621= @@optimizer_search_depth;
-SET SESSION optimizer_search_depth = 4;
-
-CREATE TABLE t1 (f1 int,f2 int,f3 int,f4 int) ;
-INSERT IGNORE INTO t1 VALUES (0,0,2,0),(NULL,0,2,0);
-CREATE TABLE t2 (f1 int) ;
-CREATE TABLE t3 (f3 int,PRIMARY KEY (f3)) ;
-CREATE TABLE t4 (f5 int) ;
-CREATE TABLE t5 (f2 int) ;
-
-SELECT alias2.f4 FROM t1 AS alias1
-LEFT JOIN t1 AS alias2
- LEFT JOIN t2 AS alias3
- LEFT JOIN t3 AS alias4 ON alias3.f1 = alias4.f3
- ON alias2.f1
-LEFT JOIN t4 AS alias5
- JOIN t5 ON alias5.f5
-ON alias2.f3 ON alias1.f2;
-DROP TABLE t1,t2,t3,t4,t5;
-
---echo #
---echo # MDEV-7992: Nested left joins + 'not exists' optimization
---echo #
-
-CREATE TABLE t1(
- K1 INT PRIMARY KEY,
- Name VARCHAR(15)
-);
-
-INSERT INTO t1 VALUES
- (1,'T1Row1'), (2,'T1Row2');
-
-
-CREATE TABLE t2(
- K2 INT PRIMARY KEY,
- K1r INT,
- rowTimestamp DATETIME,
- Event VARCHAR(15)
-);
-
-INSERT INTO t2 VALUES
- (1, 1, '2015-04-13 10:42:11' ,'T1Row1Event1'),
- (2, 1, '2015-04-13 10:42:12' ,'T1Row1Event2'),
- (3, 1, '2015-04-13 10:42:12' ,'T1Row1Event3');
-
-let $q1=
-SELECT t1a.*, t2a.*,
- t2i.K2 AS K2B, t2i.K1r AS K1rB,
- t2i.rowTimestamp AS rowTimestampB, t2i.Event AS EventB
-FROM
- t1 t1a JOIN t2 t2a ON t2a.K1r = t1a.K1
- LEFT JOIN
- ( t1 t1i LEFT JOIN t2 t2i ON t2i.K1r = t1i.K1)
- ON (t1i.K1 = 1) AND
- (((t2i.K1r = t1a.K1 AND t2i.rowTimestamp > t2a.rowTimestamp ) OR
- (t2i.rowTimestamp = t2a.rowTimestamp AND t2i.K2 > t2a.K2))
- OR (t2i.K2 IS NULL))
-WHERE
-t2a.K1r = 1 AND t2i.K2 IS NULL;
-
-eval $q1;
-eval EXPLAIN EXTENDED $q1;
-
-CREATE VIEW v1 AS
- SELECT t2i.*
- FROM t1 as t1i LEFT JOIN t2 as t2i ON t2i.K1r = t1i.K1
- WHERE t1i.K1 = 1 ;
-
-let $q2=
-SELECT
- t1a.*, t2a.*, t2b.K2 as K2B, t2b.K1r as K1rB,
- t2b.rowTimestamp as rowTimestampB, t2b.Event as EventB
-FROM
- t1 as t1a JOIN t2 as t2a ON t2a.K1r = t1a.K1
- LEFT JOIN
- v1 as t2b
- ON ((t2b.K1r = t1a.K1 AND t2b.rowTimestamp > t2a.rowTimestamp) OR
- (t2b.rowTimestamp = t2a.rowTimestamp AND t2b.K2 > t2a.K2))
- OR (t2b.K2 IS NULL)
-WHERE
- t1a.K1 = 1 AND
- t2b.K2 IS NULL;
-
-eval $q2;
-eval EXPLAIN EXTENDED $q2;
-
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
-set optimizer_search_depth= @tmp_mdev621;
diff --git a/mysql-test/t/join_nested_jcl6.test b/mysql-test/t/join_nested_jcl6.test
deleted file mode 100644
index 0e8646bceda..00000000000
--- a/mysql-test/t/join_nested_jcl6.test
+++ /dev/null
@@ -1,111 +0,0 @@
-#
-# Run join_nested.test with BKA enabled
-#
-
-set @save_optimizer_switch_jcl6=@@optimizer_switch;
-set @@optimizer_switch='optimize_join_buffer_size=on';
-set @@optimizer_switch='semijoin_with_cache=on';
-set @@optimizer_switch='outer_join_with_cache=on';
-set @@optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
-
-set join_cache_level=6;
-show variables like 'join_cache_level';
-
-set @optimizer_switch_for_join_nested_test=@@optimizer_switch;
-set @join_cache_level_for_join_nested_test=@@join_cache_level;
-
---source t/join_nested.test
-
-#
-# BUG#35835: queries with nested outer joins with BKA enabled
-#
-
-CREATE TABLE t5 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b));
-CREATE TABLE t6 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b));
-CREATE TABLE t7 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b));
-CREATE TABLE t8 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b));
-
-INSERT INTO t5 VALUES (1,1,0), (2,2,0), (3,3,0);
-INSERT INTO t6 VALUES (1,2,0), (3,2,0), (6,1,0);
-INSERT INTO t7 VALUES (1,1,0), (2,2,0);
-INSERT INTO t8 VALUES (0,2,0), (1,2,0);
-INSERT INTO t6 VALUES (-1,12,0), (-3,13,0), (-6,11,0), (-4,14,0);
-INSERT INTO t7 VALUES (-1,11,0), (-2,12,0), (-3,13,0), (-4,14,0), (-5,15,0);
-INSERT INTO t8 VALUES (-3,13,0), (-1,12,0), (-2,14,0), (-5,15,0), (-4,16,0);
-
-EXPLAIN
-SELECT t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b
- FROM t5
- LEFT JOIN
- (
- (t6, t7)
- LEFT JOIN
- t8
- ON t7.b=t8.b AND t6.b < 10
- )
- ON t6.b >= 2 AND t5.b=t7.b AND
- (t8.a > 0 OR t8.c IS NULL) AND t6.a>0 AND t7.a>0;
-
-SELECT t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b
- FROM t5
- LEFT JOIN
- (
- (t6, t7)
- LEFT JOIN
- t8
- ON t7.b=t8.b AND t6.b < 10
- )
- ON t6.b >= 2 AND t5.b=t7.b AND
- (t8.a > 0 OR t8.c IS NULL) AND t6.a>0 AND t7.a>0;
-
-DELETE FROM t5;
-DELETE FROM t6;
-DELETE FROM t7;
-DELETE FROM t8;
-
-INSERT INTO t5 VALUES (1,3,0), (3,2,0);
-INSERT INTO t6 VALUES (3,3,0);
-INSERT INTO t7 VALUES (1,2,0);
-INSERT INTO t8 VALUES (1,1,0);
-
-EXPLAIN
-SELECT t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b
- FROM t5 LEFT JOIN
- (t6 LEFT JOIN t7 ON t7.a=1, t8)
- ON (t5.b=t8.b);
-
-SELECT t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b
- FROM t5 LEFT JOIN
- (t6 LEFT JOIN t7 ON t7.a=1, t8)
- ON (t5.b=t8.b);
-
-EXPLAIN
-SELECT t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b
- FROM t5 LEFT JOIN
- (t6 LEFT JOIN t7 ON t7.b=2, t8)
- ON (t5.b=t8.b);
-
-SELECT t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b
- FROM t5 LEFT JOIN
- (t6 LEFT JOIN t7 ON t7.b=2, t8)
- ON (t5.b=t8.b);
-
-EXPLAIN
-SELECT t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b
- FROM t5 LEFT JOIN
- (t8, t6 LEFT JOIN t7 ON t7.a=1)
- ON (t5.b=t8.b);
-
-SELECT t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b
- FROM t5 LEFT JOIN
- (t8, t6 LEFT JOIN t7 ON t7.a=1)
- ON (t5.b=t8.b);
-
-DROP TABLE t5,t6,t7,t8;
-
-set join_cache_level=default;
-show variables like 'join_cache_level';
-
-set @@optimizer_switch=@save_optimizer_switch_jcl6;
-set @optimizer_switch_for_join_nested_test=NULL;
-set @join_cache_level_for_join_nested_test=NULL;
diff --git a/mysql-test/t/join_optimizer.test b/mysql-test/t/join_optimizer.test
deleted file mode 100644
index 3afe82113b9..00000000000
--- a/mysql-test/t/join_optimizer.test
+++ /dev/null
@@ -1,45 +0,0 @@
---disable_warnings
-drop table if exists t0,t1,t2,t3;
---enable_warnings
-
---echo #
---echo # BUG#38049 incorrect rows estimations with references from preceding table
---echo #
-
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1 (a varchar(32));
-insert into t1 values ('owner'),('requester'),('admincc'),('cc');
-
-CREATE TABLE t2 (
- id int(11) NOT NULL,
- type varchar(32) default NULL,
- PRIMARY KEY (id)
-);
-insert into t2 values (1,'owner'), (2,'admincc');
-
-
-CREATE TABLE t3 (
- id int(11) NOT NULL,
- domain varchar(32) default NULL,
- type varchar(32) default NULL,
- PRIMARY KEY (id)
-);
-
-set @domain='system';
-set @pk=0;
-INSERT INTO t3 select @pk:=@pk+1, 'system', t1.a from t1;
-INSERT INTO t3 select @pk:=@pk+1, 'queue', t1.a from t1, t0 where t0.a<3;
-INSERT INTO t3 select @pk:=@pk+1, 'ticket', t1.a from t1, t0 A, t0 B, t0 C;
-
-CREATE INDEX groups_d ON t3(domain);
-CREATE INDEX groups_t ON t3(type);
-CREATE INDEX groups_td ON t3(type, domain);
-CREATE INDEX groups_dt ON t3(domain, type);
---echo For table g this must use ref(groups_dt) and #rows should be around 15 and not 335:
-explain
-SELECT STRAIGHT_JOIN g.id FROM t2 a, t3 g USE INDEX(groups_dt)
-WHERE g.domain = 'queue' AND g.type = a.type;
-
-drop table t0,t1,t2,t3;
diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test
deleted file mode 100644
index 34b0551a32e..00000000000
--- a/mysql-test/t/join_outer.test
+++ /dev/null
@@ -1,1997 +0,0 @@
---source include/long_test.inc
-
-#
-# test of left outer join
-#
-
---disable_warnings
-drop table if exists t0,t1,t2,t3,t4,t5;
---enable_warnings
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch=ifnull(@optimizer_switch_for_join_outer_test,'outer_join_with_cache=off');
-if (`select @join_cache_level_for_join_outer_test is null`)
-{
- set join_cache_level=1;
-}
-if (`select @join_cache_level_for_join_outer_test is not null`)
-{
- set join_cache_level=@join_cache_level_for_join_outer_test;
-}
-
-CREATE TABLE t1 (
- grp int(11) default NULL,
- a bigint(20) unsigned default NULL,
- c char(10) NOT NULL default ''
-) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,1,'a'),(2,2,'b'),(2,3,'c'),(3,4,'E'),(3,5,'C'),(3,6,'D'),(NULL,NULL,'');
-create table t2 (id int, a bigint unsigned not null, c char(10), d int, primary key (a));
-insert into t2 values (1,1,"a",1),(3,4,"A",4),(3,5,"B",5),(3,6,"C",6),(4,7,"D",7);
-
-select t1.*,t2.* from t1 JOIN t2 where t1.a=t2.a;
-select t1.*,t2.* from t1 left join t2 on (t1.a=t2.a) order by t1.grp,t1.a,t2.c;
-select t1.*,t2.* from { oj t2 left outer join t1 on (t1.a=t2.a) };
-select t1.*,t2.* from t1 as t0,{ oj t2 left outer join t1 on (t1.a=t2.a) } WHERE t0.a=2;
---sorted_result
-select t1.*,t2.* from t1 left join t2 using (a);
-select t1.*,t2.* from t1 left join t2 using (a) where t1.a=t2.a;
-select t1.*,t2.* from t1 left join t2 using (a,c);
---sorted_result
-select t1.*,t2.* from t1 left join t2 using (c);
-select t1.*,t2.* from t1 natural left outer join t2;
-
-select t1.*,t2.* from t1 left join t2 on (t1.a=t2.a) where t2.id=3;
-select t1.*,t2.* from t1 left join t2 on (t1.a=t2.a) where t2.id is null;
-
-explain select t1.*,t2.* from t1,t2 where t1.a=t2.a and isnull(t2.a)=1;
-explain select t1.*,t2.* from t1 left join t2 on t1.a=t2.a where isnull(t2.a)=1;
-
---sorted_result
-select t1.*,t2.*,t3.a from t1 left join t2 on (t1.a=t2.a) left join t1 as t3 on (t2.a=t3.a);
-
-# The next query should rearange the left joins to get this to work
---error 1054
-explain select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t1.a=t3.a);
---error 1054
-select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t1.a=t3.a);
-
-# The next query should give an error in MySQL
---error 1054
-select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t2.a=t3.a);
-
-# Test of inner join
-select t1.*,t2.* from t1 inner join t2 using (a);
-select t1.*,t2.* from t1 inner join t2 on (t1.a=t2.a);
-select t1.*,t2.* from t1 natural join t2;
-
-drop table t1,t2;
-
-#
-# Test of left join bug
-#
-
-CREATE TABLE t1 (
- usr_id INT unsigned NOT NULL,
- uniq_id INT unsigned NOT NULL AUTO_INCREMENT,
- start_num INT unsigned NOT NULL DEFAULT 1,
- increment INT unsigned NOT NULL DEFAULT 1,
- PRIMARY KEY (uniq_id),
- INDEX usr_uniq_idx (usr_id, uniq_id),
- INDEX uniq_usr_idx (uniq_id, usr_id)
-);
-CREATE TABLE t2 (
- id INT unsigned NOT NULL DEFAULT 0,
- usr2_id INT unsigned NOT NULL DEFAULT 0,
- max INT unsigned NOT NULL DEFAULT 0,
- c_amount INT unsigned NOT NULL DEFAULT 0,
- d_max INT unsigned NOT NULL DEFAULT 0,
- d_num INT unsigned NOT NULL DEFAULT 0,
- orig_time INT unsigned NOT NULL DEFAULT 0,
- c_time INT unsigned NOT NULL DEFAULT 0,
- active ENUM ("no","yes") NOT NULL,
- PRIMARY KEY (id,usr2_id),
- INDEX id_idx (id),
- INDEX usr2_idx (usr2_id)
-);
-INSERT INTO t1 VALUES (3,NULL,0,50),(3,NULL,0,200),(3,NULL,0,25),(3,NULL,0,84676),(3,NULL,0,235),(3,NULL,0,10),(3,NULL,0,3098),(3,NULL,0,2947),(3,NULL,0,8987),(3,NULL,0,8347654),(3,NULL,0,20398),(3,NULL,0,8976),(3,NULL,0,500),(3,NULL,0,198);
-
-#1st select shows that one record is returned with null entries for the right
-#table, when selecting on an id that does not exist in the right table t2
-SELECT t1.usr_id,t1.uniq_id,t1.increment,
-t2.usr2_id,t2.c_amount,t2.max
-FROM t1
-LEFT JOIN t2 ON t2.id = t1.uniq_id
-WHERE t1.uniq_id = 4
-ORDER BY t2.c_amount;
-
-# The same with RIGHT JOIN
-SELECT t1.usr_id,t1.uniq_id,t1.increment,
-t2.usr2_id,t2.c_amount,t2.max
-FROM t2
-RIGHT JOIN t1 ON t2.id = t1.uniq_id
-WHERE t1.uniq_id = 4
-ORDER BY t2.c_amount;
-
-INSERT INTO t2 VALUES (2,3,3000,6000,0,0,746584,837484,'yes');
---error ER_DUP_ENTRY
-INSERT INTO t2 VALUES (2,3,3000,6000,0,0,746584,837484,'yes');
-INSERT INTO t2 VALUES (7,3,1000,2000,0,0,746294,937484,'yes');
-
-#3rd select should show that one record is returned with null entries for the
-# right table, when selecting on an id that does not exist in the right table
-# t2 but this select returns an empty set!!!!
-SELECT t1.usr_id,t1.uniq_id,t1.increment,t2.usr2_id,t2.c_amount,t2.max FROM t1 LEFT JOIN t2 ON t2.id = t1.uniq_id WHERE t1.uniq_id = 4 ORDER BY t2.c_amount;
-SELECT t1.usr_id,t1.uniq_id,t1.increment,t2.usr2_id,t2.c_amount,t2.max FROM t1 LEFT JOIN t2 ON t2.id = t1.uniq_id WHERE t1.uniq_id = 4 GROUP BY t2.c_amount;
-# Removing the ORDER BY works:
-SELECT t1.usr_id,t1.uniq_id,t1.increment,t2.usr2_id,t2.c_amount,t2.max FROM t1 LEFT JOIN t2 ON t2.id = t1.uniq_id WHERE t1.uniq_id = 4;
-
-drop table t1,t2;
-
-#
-# Test of LEFT JOIN with const tables (failed for frankie@etsetb.upc.es)
-#
-
-CREATE TABLE t1 (
- cod_asig int(11) DEFAULT '0' NOT NULL,
- desc_larga_cat varchar(80) DEFAULT '' NOT NULL,
- desc_larga_cas varchar(80) DEFAULT '' NOT NULL,
- desc_corta_cat varchar(40) DEFAULT '' NOT NULL,
- desc_corta_cas varchar(40) DEFAULT '' NOT NULL,
- cred_total double(3,1) DEFAULT '0.0' NOT NULL,
- pre_requisit int(11),
- co_requisit int(11),
- preco_requisit int(11),
- PRIMARY KEY (cod_asig)
-);
-
-INSERT INTO t1 VALUES (10360,'asdfggfg','Introduccion a los Ordenadores I','asdfggfg','Introduccio Ordinadors I',6.0,NULL,NULL,NULL);
-INSERT INTO t1 VALUES (10361,'Components i Circuits Electronics I','Componentes y Circuitos Electronicos I','Components i Circuits Electronics I','Comp. i Circ. Electr. I',6.0,NULL,NULL,NULL);
-INSERT INTO t1 VALUES (10362,'Laboratori d`Ordinadors','Laboratorio de Ordenadores','Laboratori d`Ordinadors','Laboratori Ordinadors',4.5,NULL,NULL,NULL);
-INSERT INTO t1 VALUES (10363,'Tecniques de Comunicacio Oral i Escrita','Tecnicas de Comunicacion Oral y Escrita','Tecniques de Comunicacio Oral i Escrita','Tec. Com. Oral i Escrita',4.5,NULL,NULL,NULL);
-INSERT INTO t1 VALUES (11403,'Projecte Fi de Carrera','Proyecto Fin de Carrera','Projecte Fi de Carrera','PFC',9.0,NULL,NULL,NULL);
-INSERT INTO t1 VALUES (11404,'+lgebra lineal','Algebra lineal','+lgebra lineal','+lgebra lineal',15.0,NULL,NULL,NULL);
-INSERT INTO t1 VALUES (11405,'+lgebra lineal','Algebra lineal','+lgebra lineal','+lgebra lineal',18.0,NULL,NULL,NULL);
-INSERT INTO t1 VALUES (11406,'Calcul Infinitesimal','Cßlculo Infinitesimal','Calcul Infinitesimal','Calcul Infinitesimal',15.0,NULL,NULL,NULL);
-
-CREATE TABLE t2 (
- idAssignatura int(11) DEFAULT '0' NOT NULL,
- Grup int(11) DEFAULT '0' NOT NULL,
- Places smallint(6) DEFAULT '0' NOT NULL,
- PlacesOcupades int(11) DEFAULT '0',
- PRIMARY KEY (idAssignatura,Grup)
-);
-
-
-INSERT INTO t2 VALUES (10360,12,333,0);
-INSERT INTO t2 VALUES (10361,30,2,0);
-INSERT INTO t2 VALUES (10361,40,3,0);
-INSERT INTO t2 VALUES (10360,45,10,0);
-INSERT INTO t2 VALUES (10362,10,12,0);
-INSERT INTO t2 VALUES (10360,55,2,0);
-INSERT INTO t2 VALUES (10360,70,0,0);
-INSERT INTO t2 VALUES (10360,565656,0,0);
-INSERT INTO t2 VALUES (10360,32767,7,0);
-INSERT INTO t2 VALUES (10360,33,8,0);
-INSERT INTO t2 VALUES (10360,7887,85,0);
-INSERT INTO t2 VALUES (11405,88,8,0);
-INSERT INTO t2 VALUES (10360,0,55,0);
-INSERT INTO t2 VALUES (10360,99,0,0);
-INSERT INTO t2 VALUES (11411,30,10,0);
-INSERT INTO t2 VALUES (11404,0,0,0);
-INSERT INTO t2 VALUES (10362,11,111,0);
-INSERT INTO t2 VALUES (10363,33,333,0);
-INSERT INTO t2 VALUES (11412,55,0,0);
-INSERT INTO t2 VALUES (50003,66,6,0);
-INSERT INTO t2 VALUES (11403,5,0,0);
-INSERT INTO t2 VALUES (11406,11,11,0);
-INSERT INTO t2 VALUES (11410,11410,131,0);
-INSERT INTO t2 VALUES (11416,11416,32767,0);
-INSERT INTO t2 VALUES (11409,0,0,0);
-
-CREATE TABLE t3 (
- id int(11) NOT NULL auto_increment,
- dni_pasaporte char(16) DEFAULT '' NOT NULL,
- idPla int(11) DEFAULT '0' NOT NULL,
- cod_asig int(11) DEFAULT '0' NOT NULL,
- any smallint(6) DEFAULT '0' NOT NULL,
- quatrimestre smallint(6) DEFAULT '0' NOT NULL,
- estat char(1) DEFAULT 'M' NOT NULL,
- PRIMARY KEY (id),
- UNIQUE dni_pasaporte (dni_pasaporte,idPla),
- UNIQUE dni_pasaporte_2 (dni_pasaporte,idPla,cod_asig,any,quatrimestre)
-);
-
-INSERT INTO t3 VALUES (1,'11111111',1,10362,98,1,'M');
-
-CREATE TABLE t4 (
- id int(11) NOT NULL auto_increment,
- papa int(11) DEFAULT '0' NOT NULL,
- fill int(11) DEFAULT '0' NOT NULL,
- idPla int(11) DEFAULT '0' NOT NULL,
- PRIMARY KEY (id),
- KEY papa (idPla,papa),
- UNIQUE papa_2 (idPla,papa,fill)
-);
-
-INSERT INTO t4 VALUES (1,-1,10360,1);
-INSERT INTO t4 VALUES (2,-1,10361,1);
-INSERT INTO t4 VALUES (3,-1,10362,1);
-
---sorted_result
-SELECT DISTINCT fill,desc_larga_cat,cred_total,Grup,Places,PlacesOcupades FROM t4 LEFT JOIN t3 ON t3.cod_asig=fill AND estat='S' AND dni_pasaporte='11111111' AND t3.idPla=1 , t2,t1 WHERE fill=t1.cod_asig AND Places>PlacesOcupades AND fill=idAssignatura AND t4.idPla=1 AND papa=-1;
-
-SELECT DISTINCT fill,t3.idPla FROM t4 LEFT JOIN t3 ON t3.cod_asig=t4.fill AND t3.estat='S' AND t3.dni_pasaporte='1234' AND t3.idPla=1 ;
-
-INSERT INTO t3 VALUES (3,'1234',1,10360,98,1,'S');
-SELECT DISTINCT fill,t3.idPla FROM t4 LEFT JOIN t3 ON t3.cod_asig=t4.fill AND t3.estat='S' AND t3.dni_pasaporte='1234' AND t3.idPla=1 ;
-
-drop table t1,t2,t3,test.t4;
-
-#
-# Test of IS NULL on AUTO_INCREMENT with LEFT JOIN
-#
-
-CREATE TABLE t1 (
- id smallint(5) unsigned NOT NULL auto_increment,
- name char(60) DEFAULT '' NOT NULL,
- PRIMARY KEY (id)
-);
-INSERT INTO t1 VALUES (1,'Antonio Paz');
-INSERT INTO t1 VALUES (2,'Lilliana Angelovska');
-INSERT INTO t1 VALUES (3,'Thimble Smith');
-
-CREATE TABLE t2 (
- id smallint(5) unsigned NOT NULL auto_increment,
- owner smallint(5) unsigned DEFAULT '0' NOT NULL,
- name char(60),
- PRIMARY KEY (id)
-);
-INSERT INTO t2 VALUES (1,1,'El Gato');
-INSERT INTO t2 VALUES (2,1,'Perrito');
-INSERT INTO t2 VALUES (3,3,'Happy');
-
---sorted_result
-select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner);
-select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner) where t2.id is null;
-explain select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner) where t2.id is null;
-explain select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner) where t2.name is null;
-select count(*) from t1 left join t2 on (t1.id = t2.owner);
-
---sorted_result
-select t1.name, t2.name, t2.id from t2 right join t1 on (t1.id = t2.owner);
-select t1.name, t2.name, t2.id from t2 right join t1 on (t1.id = t2.owner) where t2.id is null;
-explain select t1.name, t2.name, t2.id from t2 right join t1 on (t1.id = t2.owner) where t2.id is null;
-explain select t1.name, t2.name, t2.id from t2 right join t1 on (t1.id = t2.owner) where t2.name is null;
-select count(*) from t2 right join t1 on (t1.id = t2.owner);
-
---sorted_result
-select t1.name, t2.name, t2.id,t3.id from t2 right join t1 on (t1.id = t2.owner) left join t1 as t3 on t3.id=t2.owner;
---sorted_result
-select t1.name, t2.name, t2.id,t3.id from t1 right join t2 on (t1.id = t2.owner) right join t1 as t3 on t3.id=t2.owner;
---sorted_result
-select t1.name, t2.name, t2.id, t2.owner, t3.id from t1 left join t2 on (t1.id = t2.owner) right join t1 as t3 on t3.id=t2.owner;
-
-drop table t1,t2;
-
-create table t1 (id int not null, str char(10), index(str));
-insert into t1 values (1, null), (2, null), (3, "foo"), (4, "bar");
-select * from t1 where str is not null order by id;
-select * from t1 where str is null;
-drop table t1;
-
-#
-# Test wrong LEFT JOIN query
-#
-
-CREATE TABLE t1 (
- t1_id bigint(21) NOT NULL auto_increment,
- PRIMARY KEY (t1_id)
-);
-CREATE TABLE t2 (
- t2_id bigint(21) NOT NULL auto_increment,
- PRIMARY KEY (t2_id)
-);
-CREATE TABLE t3 (
- t3_id bigint(21) NOT NULL auto_increment,
- PRIMARY KEY (t3_id)
-);
-CREATE TABLE t4 (
- seq_0_id bigint(21) DEFAULT '0' NOT NULL,
- seq_1_id bigint(21) DEFAULT '0' NOT NULL,
- KEY seq_0_id (seq_0_id),
- KEY seq_1_id (seq_1_id)
-);
-CREATE TABLE t5 (
- seq_0_id bigint(21) DEFAULT '0' NOT NULL,
- seq_1_id bigint(21) DEFAULT '0' NOT NULL,
- KEY seq_1_id (seq_1_id),
- KEY seq_0_id (seq_0_id)
-);
-
-insert into t1 values (1);
-insert into t2 values (1);
-insert into t3 values (1);
-insert into t4 values (1,1);
-insert into t5 values (1,1);
-
---error 1054
-explain select * from t3 left join t4 on t4.seq_1_id = t2.t2_id left join t1 on t1.t1_id = t4.seq_0_id left join t5 on t5.seq_0_id = t1.t1_id left join t2 on t2.t2_id = t5.seq_1_id where t3.t3_id = 23;
-
-drop table t1,t2,t3,t4,t5;
-
-#
-# Another LEFT JOIN problem
-# (The problem was that the result changed when we added ORDER BY)
-#
-
-create table t1 (n int, m int, o int, key(n));
-create table t2 (n int not null, m int, o int, primary key(n));
-insert into t1 values (1, 2, 11), (1, 2, 7), (2, 2, 8), (1,2,9),(1,3,9);
-insert into t2 values (1, 2, 3),(2, 2, 8), (4,3,9),(3,2,10);
-select t1.*, t2.* from t1 left join t2 on t1.n = t2.n and
-t1.m = t2.m where t1.n = 1;
---sorted_result
-select t1.*, t2.* from t1 left join t2 on t1.n = t2.n and
-t1.m = t2.m where t1.n = 1 order by t1.o;
-drop table t1,t2;
-
-# Test bug with NATURAL join:
-
-CREATE TABLE t1 (id1 INT NOT NULL PRIMARY KEY, dat1 CHAR(1), id2 INT);
-INSERT INTO t1 VALUES (1,'a',1);
-INSERT INTO t1 VALUES (2,'b',1);
-INSERT INTO t1 VALUES (3,'c',2);
-
-CREATE TABLE t2 (id2 INT NOT NULL PRIMARY KEY, dat2 CHAR(1));
-INSERT INTO t2 VALUES (1,'x');
-INSERT INTO t2 VALUES (2,'y');
-INSERT INTO t2 VALUES (3,'z');
-
-SELECT t2.id2 FROM t2 LEFT OUTER JOIN t1 ON t1.id2 = t2.id2 WHERE id1 IS NULL;
-SELECT t2.id2 FROM t2 NATURAL LEFT OUTER JOIN t1 WHERE id1 IS NULL;
-
-drop table t1,t2;
-
-create table t1 ( color varchar(20), name varchar(20) );
-insert into t1 values ( 'red', 'apple' );
-insert into t1 values ( 'yellow', 'banana' );
-insert into t1 values ( 'green', 'lime' );
-insert into t1 values ( 'black', 'grape' );
-insert into t1 values ( 'blue', 'blueberry' );
-create table t2 ( count int, color varchar(20) );
-insert into t2 values (10, 'green');
-insert into t2 values (5, 'black');
-insert into t2 values (15, 'white');
-insert into t2 values (7, 'green');
-select * from t1;
-select * from t2;
-select * from t2 natural join t1;
-select t2.count, t1.name from t2 natural join t1;
-select t2.count, t1.name from t2 inner join t1 using (color);
-drop table t1;
-drop table t2;
-
-#
-# Test of LEFT JOIN + GROUP FUNCTIONS within functions:
-#
-
-CREATE TABLE t1 (
- pcode varchar(8) DEFAULT '' NOT NULL
-);
-INSERT INTO t1 VALUES ('kvw2000'),('kvw2001'),('kvw3000'),('kvw3001'),('kvw3002'),('kvw3500'),('kvw3501'),('kvw3502'),('kvw3800'),('kvw3801'),('kvw3802'),('kvw3900'),('kvw3901'),('kvw3902'),('kvw4000'),('kvw4001'),('kvw4002'),('kvw4200'),('kvw4500'),('kvw5000'),('kvw5001'),('kvw5500'),('kvw5510'),('kvw5600'),('kvw5601'),('kvw6000'),('klw1000'),('klw1020'),('klw1500'),('klw2000'),('klw2001'),('klw2002'),('kld2000'),('klw2500'),('kmw1000'),('kmw1500'),('kmw2000'),('kmw2001'),('kmw2100'),('kmw3000'),('kmw3200');
-CREATE TABLE t2 (
- pcode varchar(8) DEFAULT '' NOT NULL,
- KEY pcode (pcode)
-);
-INSERT INTO t2 VALUES ('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw2000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3000'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw3500'),('kvw6000'),('kvw6000'),('kld2000');
-
-SELECT t1.pcode, IF(ISNULL(t2.pcode), 0, COUNT(*)) AS count FROM t1
-LEFT JOIN t2 ON t1.pcode = t2.pcode GROUP BY t1.pcode;
-SELECT SQL_BIG_RESULT t1.pcode, IF(ISNULL(t2.pcode), 0, COUNT(*)) AS count FROM t1 LEFT JOIN t2 ON t1.pcode = t2.pcode GROUP BY t1.pcode;
-drop table t1,t2;
-
-#
-# Another left join problem
-#
-
-CREATE TABLE t1 (
- id int(11),
- pid int(11),
- rep_del tinyint(4),
- KEY id (id),
- KEY pid (pid)
-);
-INSERT INTO t1 VALUES (1,NULL,NULL);
-INSERT INTO t1 VALUES (2,1,NULL);
-select * from t1 LEFT JOIN t1 t2 ON (t1.id=t2.pid) AND t2.rep_del IS NULL;
-create index rep_del ON t1(rep_del);
-select * from t1 LEFT JOIN t1 t2 ON (t1.id=t2.pid) AND t2.rep_del IS NULL;
-drop table t1;
-
-CREATE TABLE t1 (
- id int(11) DEFAULT '0' NOT NULL,
- name tinytext DEFAULT '' NOT NULL,
- UNIQUE id (id)
-);
-INSERT INTO t1 VALUES (1,'yes'),(2,'no');
-CREATE TABLE t2 (
- id int(11) DEFAULT '0' NOT NULL,
- idx int(11) DEFAULT '0' NOT NULL,
- UNIQUE id (id,idx)
-);
-INSERT INTO t2 VALUES (1,1);
-explain SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL;
-SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL;
-drop table t1,t2;
-
-#
-# Test problem with using key_column= constant in ON and WHERE
-#
-create table t1 (bug_id mediumint, reporter mediumint);
-create table t2 (bug_id mediumint, who mediumint, index(who));
-insert into t2 values (1,1),(1,2);
-insert into t1 values (1,1),(2,1);
-SELECT * FROM t1 LEFT JOIN t2 ON (t1.bug_id = t2.bug_id AND t2.who = 2) WHERE (t1.reporter = 2 OR t2.who = 2);
-drop table t1,t2;
-
-#
-# Test problem with LEFT JOIN
-
-create table t1 (fooID smallint unsigned auto_increment, primary key (fooID));
-create table t2 (fooID smallint unsigned not null, barID smallint unsigned not null, primary key (fooID,barID));
-insert into t1 (fooID) values (10),(20),(30);
-insert into t2 values (10,1),(20,2),(30,3);
-explain select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30;
-select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30;
---sorted_result
-select * from t2 left join t1 ignore index(primary) on t1.fooID = t2.fooID and t1.fooID = 30;
-drop table t1,t2;
-
-create table t1 (i int);
-create table t2 (i int);
-create table t3 (i int);
-insert into t1 values(1),(2);
-insert into t2 values(2),(3);
-insert into t3 values(2),(4);
---sorted_result
-select * from t1 natural left join t2 natural left join t3;
-select * from t1 natural left join t2 where (t2.i is not null)=0;
---sorted_result
-select * from t1 natural left join t2 where (t2.i is not null) is not null;
-select * from t1 natural left join t2 where (i is not null)=0;
---sorted_result
-select * from t1 natural left join t2 where (i is not null) is not null;
-drop table t1,t2,t3;
-
-#
-# Test of USING
-#
-create table t1 (f1 integer,f2 integer,f3 integer);
-create table t2 (f2 integer,f4 integer);
-create table t3 (f3 integer,f5 integer);
-select * from t1
- left outer join t2 using (f2)
- left outer join t3 using (f3);
-drop table t1,t2,t3;
-
-create table t1 (a1 int, a2 int);
-create table t2 (b1 int not null, b2 int);
-create table t3 (c1 int, c2 int);
-
-insert into t1 values (1,2), (2,2), (3,2);
-insert into t2 values (1,3), (2,3);
-insert into t3 values (2,4), (3,4);
-
-select * from t1 left join t2 on b1 = a1 left join t3 on c1 = a1 and b1 is null;
-explain select * from t1 left join t2 on b1 = a1 left join t3 on c1 = a1 and b1 is null;
-
-drop table t1, t2, t3;
-
-# Test for BUG#8711 '<=>' was considered to be a NULL-rejecting predicate.
-create table t1 (
- a int(11),
- b char(10),
- key (a)
-);
-insert into t1 (a) values (1),(2),(3),(4);
-create table t2 (a int);
-
-select * from t1 left join t2 on t1.a=t2.a where not (t2.a <=> t1.a);
-select * from t1 left join t2 on t1.a=t2.a having not (t2.a <=> t1.a);
-drop table t1,t2;
-
-# Test for BUG#5088
-
-create table t1 (
- match_id tinyint(3) unsigned not null auto_increment,
- home tinyint(3) unsigned default '0',
- unique key match_id (match_id),
- key match_id_2 (match_id)
-);
-
-insert into t1 values("1", "2");
-
-create table t2 (
- player_id tinyint(3) unsigned default '0',
- match_1_h tinyint(3) unsigned default '0',
- key player_id (player_id)
-);
-
-insert into t2 values("1", "5");
-insert into t2 values("2", "9");
-insert into t2 values("3", "3");
-insert into t2 values("4", "7");
-insert into t2 values("5", "6");
-insert into t2 values("6", "8");
-insert into t2 values("7", "4");
-insert into t2 values("8", "12");
-insert into t2 values("9", "11");
-insert into t2 values("10", "10");
-
-explain select s.*, '*', m.*, (s.match_1_h - m.home) UUX from
- (t2 s left join t1 m on m.match_id = 1)
- order by m.match_id desc;
-
-explain select s.*, '*', m.*, (s.match_1_h - m.home) UUX from
- (t2 s left join t1 m on m.match_id = 1)
- order by UUX desc;
-
-select s.*, '*', m.*, (s.match_1_h - m.home) UUX from
- (t2 s left join t1 m on m.match_id = 1)
- order by UUX desc;
-
-explain select s.*, '*', m.*, (s.match_1_h - m.home) UUX from
- t2 s straight_join t1 m where m.match_id = 1
- order by UUX desc;
-
-select s.*, '*', m.*, (s.match_1_h - m.home) UUX from
- t2 s straight_join t1 m where m.match_id = 1
- order by UUX desc;
-
-drop table t1, t2;
-
-# Tests for bugs #6307 and 6460
-
-create table t1 (a int, b int, unique index idx (a, b));
-create table t2 (a int, b int, c int, unique index idx (a, b));
-
-insert into t1 values (1, 10), (1,11), (2,10), (2,11);
-insert into t2 values (1,10,3);
-
-select t1.a, t1.b, t2.c from t1 left join t2
- on t1.a=t2.a and t1.b=t2.b and t2.c=3
- where t1.a=1 and t2.c is null;
-
-drop table t1, t2;
-
-CREATE TABLE t1 (
- ts_id bigint(20) default NULL,
- inst_id tinyint(4) default NULL,
- flag_name varchar(64) default NULL,
- flag_value text,
- UNIQUE KEY ts_id (ts_id,inst_id,flag_name)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-
-CREATE TABLE t2 (
- ts_id bigint(20) default NULL,
- inst_id tinyint(4) default NULL,
- flag_name varchar(64) default NULL,
- flag_value text,
- UNIQUE KEY ts_id (ts_id,inst_id,flag_name)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-
-INSERT INTO t1 VALUES
- (111056548820001, 0, 'flag1', NULL),
- (111056548820001, 0, 'flag2', NULL),
- (2, 0, 'other_flag', NULL);
-
-INSERT INTO t2 VALUES
- (111056548820001, 3, 'flag1', 'sss');
-
-SELECT t1.flag_name,t2.flag_value
- FROM t1 LEFT JOIN t2
- ON (t1.ts_id = t2.ts_id AND t1.flag_name = t2.flag_name AND
- t2.inst_id = 3)
- WHERE t1.inst_id = 0 AND t1.ts_id=111056548820001 AND
- t2.flag_value IS NULL;
-
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (
- id int(11) unsigned NOT NULL auto_increment,
- text_id int(10) unsigned default NULL,
- PRIMARY KEY (id)
-);
-
-INSERT INTO t1 VALUES("1", "0");
-INSERT INTO t1 VALUES("2", "10");
-
-CREATE TABLE t2 (
- text_id char(3) NOT NULL default '',
- language_id char(3) NOT NULL default '',
- text_data text,
- PRIMARY KEY (text_id,language_id)
-);
-
-INSERT INTO t2 VALUES("0", "EN", "0-EN");
-INSERT INTO t2 VALUES("0", "SV", "0-SV");
-INSERT INTO t2 VALUES("10", "EN", "10-EN");
-INSERT INTO t2 VALUES("10", "SV", "10-SV");
-SELECT t1.id, t1.text_id, t2.text_data
- FROM t1 LEFT JOIN t2
- ON t1.text_id = t2.text_id
- AND t2.language_id = 'SV'
- WHERE (t1.id LIKE '%' OR t2.text_data LIKE '%');
-
-DROP TABLE t1, t2;
-
-# Test for bug #5896
-
-CREATE TABLE t0 (a0 int PRIMARY KEY);
-CREATE TABLE t1 (a1 int PRIMARY KEY);
-CREATE TABLE t2 (a2 int);
-CREATE TABLE t3 (a3 int);
-INSERT INTO t0 VALUES (1);
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (1), (2);
-INSERT INTO t3 VALUES (1), (2);
-
-SELECT * FROM t1 LEFT JOIN t2 ON a1=0;
-EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON a1=0;
-SELECT * FROM t1 LEFT JOIN (t2,t3) ON a1=0;
-EXPLAIN SELECT * FROM t1 LEFT JOIN (t2,t3) ON a1=0;
-SELECT * FROM t0, t1 LEFT JOIN (t2,t3) ON a1=0 WHERE a0=a1;
-EXPLAIN SELECT * FROM t0, t1 LEFT JOIN (t2,t3) ON a1=0 WHERE a0=a1;
-
-INSERT INTO t0 VALUES (0);
-INSERT INTO t1 VALUES (0);
-SELECT * FROM t0, t1 LEFT JOIN (t2,t3) ON a1=5 WHERE a0=a1 AND a0=1;
-EXPLAIN SELECT * FROM t0, t1 LEFT JOIN (t2,t3) ON a1=5 WHERE a0=a1 AND a0=1;
-
-# Test for BUG#4480
-drop table t1,t2;
-create table t1 (a int, b int);
-insert into t1 values (1,1),(2,2),(3,3);
-create table t2 (a int, b int);
-insert into t2 values (1,1), (2,2);
-
-select * from t2 right join t1 on t2.a=t1.a;
-select straight_join * from t2 right join t1 on t2.a=t1.a;
-
-DROP TABLE t0,t1,t2,t3;
-
-#
-# Test for bug #9017: left join mistakingly converted to inner join
-#
-
-CREATE TABLE t1 (a int PRIMARY KEY, b int);
-CREATE TABLE t2 (a int PRIMARY KEY, b int);
-
-INSERT INTO t1 VALUES (1,1), (2,1), (3,1), (4,2);
-INSERT INTO t2 VALUES (1,2), (2,2);
-
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.a;
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.a WHERE t1.b=1;
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.a
- WHERE t1.b=1 XOR (NOT ISNULL(t2.a) AND t2.b=1);
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.a WHERE not(0+(t1.a=30 and t2.b=1));
-
-DROP TABLE t1,t2;
-
-# Bug #8681: Bad warning message when group_concat() exceeds max length
-set group_concat_max_len=5;
-create table t1 (a int, b varchar(20));
-create table t2 (a int, c varchar(20));
-insert into t1 values (1,"aaaaaaaaaa"),(2,"bbbbbbbbbb");
-insert into t2 values (1,"cccccccccc"),(2,"dddddddddd");
-select group_concat(t1.b,t2.c) from t1 left join t2 using(a) group by t1.a;
-select group_concat(t1.b,t2.c) from t1 inner join t2 using(a) group by t1.a;
-select group_concat(t1.b,t2.c) from t1 left join t2 using(a) group by a;
-select group_concat(t1.b,t2.c) from t1 inner join t2 using(a) group by a;
-drop table t1, t2;
-set group_concat_max_len=default;
-
-# End of 4.1 tests
-
-#
-# BUG#10162 - ON is merged with WHERE, left join is convered to a regular join
-#
-create table t1 (gid smallint(5) unsigned not null, x int(11) not null, y int(11) not null, art int(11) not null, primary key (gid,x,y));
-insert t1 values (1, -5, -8, 2), (1, 2, 2, 1), (1, 1, 1, 1);
-create table t2 (gid smallint(5) unsigned not null, x int(11) not null, y int(11) not null, id int(11) not null, primary key (gid,id,x,y), key id (id));
-insert t2 values (1, -5, -8, 1), (1, 1, 1, 1), (1, 2, 2, 1);
-create table t3 ( set_id smallint(5) unsigned not null, id tinyint(4) unsigned not null, name char(12) not null, primary key (id,set_id));
-insert t3 values (0, 1, 'a'), (1, 1, 'b'), (0, 2, 'c'), (1, 2, 'd'), (1, 3, 'e'), (1, 4, 'f'), (1, 5, 'g'), (1, 6, 'h');
-explain select name from t1 left join t2 on t1.x = t2.x and t1.y = t2.y
-left join t3 on t1.art = t3.id where t2.id =1 and t2.x = -5 and t2.y =-8
-and t1.gid =1 and t2.gid =1 and t3.set_id =1;
-drop tables t1,t2,t3;
-
-#
-# Test for bug #9938: invalid conversion from outer join to inner join
-# for queries containing indirect reference in WHERE clause
-#
-
-CREATE TABLE t1 (EMPNUM INT, GRP INT);
-INSERT INTO t1 VALUES (0, 10);
-INSERT INTO t1 VALUES (2, 30);
-
-CREATE TABLE t2 (EMPNUM INT, NAME CHAR(5));
-INSERT INTO t2 VALUES (0, 'KERI');
-INSERT INTO t2 VALUES (9, 'BARRY');
-
-CREATE VIEW v1 AS
-SELECT COALESCE(t2.EMPNUM,t1.EMPNUM) AS EMPNUM, NAME, GRP
- FROM t2 LEFT OUTER JOIN t1 ON t2.EMPNUM=t1.EMPNUM;
-
-SELECT * FROM v1;
-SELECT * FROM v1 WHERE EMPNUM < 10;
-
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
-#
-# Test for bug #11285: false Item_equal on expression in outer join
-#
-
-CREATE TABLE t1 (c11 int);
-CREATE TABLE t2 (c21 int);
-INSERT INTO t1 VALUES (30), (40), (50);
-INSERT INTO t2 VALUES (300), (400), (500);
-SELECT * FROM t1 LEFT JOIN t2 ON (c11=c21 AND c21=30) WHERE c11=40;
-DROP TABLE t1, t2;
-#
-# Test for bugs
-# #12101: erroneously applied outer join elimination in case of WHERE NOT BETWEEN
-# #12102: erroneously missing outer join elimination in case of WHERE IN/IF
-#
-
-CREATE TABLE t1 (a int PRIMARY KEY, b int);
-CREATE TABLE t2 (a int PRIMARY KEY, b int);
-
-INSERT INTO t1 VALUES (1,2), (2,1), (3,2), (4,3), (5,6), (6,5), (7,8), (8,7), (9,10);
-INSERT INTO t2 VALUES (3,0), (4,1), (6,4), (7,5);
-
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE t2.b <= t1.a AND t1.a <= t1.b;
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE t1.a BETWEEN t2.b AND t1.b;
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE NOT(t1.a NOT BETWEEN t2.b AND t1.b);
-
---sorted_result
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE t2.b > t1.a OR t1.a > t1.b;
---sorted_result
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE t1.a NOT BETWEEN t2.b AND t1.b;
---sorted_result
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE NOT(t1.a BETWEEN t2.b AND t1.b);
-
---sorted_result
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE t1.a = t2.a OR t2.b > t1.a OR t1.a > t1.b;
---sorted_result
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE NOT(t1.a != t2.a AND t1.a BETWEEN t2.b AND t1.b);
-
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE t1.a = t2.a AND (t2.b > t1.a OR t1.a > t1.b);
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE NOT(t1.a != t2.a OR t1.a BETWEEN t2.b AND t1.b);
-
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE t1.a = t2.a OR t1.a = t2.b;
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE t1.a IN(t2.a, t2.b);
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE NOT(t1.a NOT IN(t2.a, t2.b));
-
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE t1.a != t1.b AND t1.a != t2.b;
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE t1.a NOT IN(t1.b, t2.b);
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE NOT(t1.a IN(t1.b, t2.b));
-
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE t2.a != t2.b OR (t1.a != t2.a AND t1.a != t2.b);
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE NOT(t2.a = t2.b AND t1.a IN(t2.a, t2.b));
-
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE t2.a != t2.b AND t1.a != t1.b AND t1.a != t2.b;
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE NOT(t2.a = t2.b OR t1.a IN(t1.b, t2.b));
-
-EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE t1.a = t2.a OR t1.a = t2.b;
-EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE t1.a IN(t2.a, t2.b);
-EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE t1.a > IF(t1.a = t2.b-2, t2.b, t2.b-1);
-
-DROP TABLE t1,t2;
-
-#
-# Test for bug #17164: ORed FALSE blocked conversion of outer join into join
-#
-
-# Test case moved to join_outer_innodb
-
-#
-# Bug 19396: LEFT OUTER JOIN over views in curly braces
-#
---disable_warnings
-DROP VIEW IF EXISTS v1,v2;
-DROP TABLE IF EXISTS t1,t2;
---enable_warnings
-
-CREATE TABLE t1 (a int);
-CREATE table t2 (b int);
-INSERT INTO t1 VALUES (1), (2), (3), (4), (1), (1), (3);
-INSERT INTO t2 VALUES (2), (3);
-
-CREATE VIEW v1 AS SELECT a FROM t1 JOIN t2 ON t1.a=t2.b;
-CREATE VIEW v2 AS SELECT b FROM t2 JOIN t1 ON t2.b=t1.a;
-
-SELECT v1.a, v2. b
- FROM v1 LEFT OUTER JOIN v2 ON (v1.a=v2.b) AND (v1.a >= 3)
- GROUP BY v1.a;
-SELECT v1.a, v2. b
- FROM { OJ v1 LEFT OUTER JOIN v2 ON (v1.a=v2.b) AND (v1.a >= 3) }
- GROUP BY v1.a;
-
-DROP VIEW v1,v2;
-DROP TABLE t1,t2;
-
-#
-# Bug 19816: LEFT OUTER JOIN with constant ORed predicates in WHERE clause
-#
-
-CREATE TABLE t1 (a int);
-CREATE TABLE t2 (b int);
-INSERT INTO t1 VALUES (1), (2), (3), (4);
-INSERT INTO t2 VALUES (2), (3);
-
---sorted_result
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.b WHERE (1=1);
-
---sorted_result
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.b WHERE (1 OR 1);
---sorted_result
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.b WHERE (0 OR 1);
---sorted_result
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.b WHERE (1=1 OR 2=2);
---sorted_result
-SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.b WHERE (1=1 OR 1=0);
-
-DROP TABLE t1,t2;
-
-#
-# Bug 26017: LEFT OUTER JOIN over two constant tables and
-# a case-insensitive comparison predicate field=const
-#
-
-CREATE TABLE t1 (
- f1 varchar(16) collate latin1_swedish_ci PRIMARY KEY,
- f2 varchar(16) collate latin1_swedish_ci
-);
-CREATE TABLE t2 (
- f1 varchar(16) collate latin1_swedish_ci PRIMARY KEY,
- f3 varchar(16) collate latin1_swedish_ci
-);
-
-INSERT INTO t1 VALUES ('bla','blah');
-INSERT INTO t2 VALUES ('bla','sheep');
-
-SELECT * FROM t1 JOIN t2 USING(f1) WHERE f1='Bla';
-SELECT * FROM t1 LEFT JOIN t2 USING(f1) WHERE f1='bla';
-SELECT * FROM t1 LEFT JOIN t2 USING(f1) WHERE f1='Bla';
-
-DROP TABLE t1,t2;
-
-#
-# Bug 28188: 'not exists' optimization for outer joins
-#
-
-CREATE TABLE t1 (id int PRIMARY KEY, a varchar(8));
-CREATE TABLE t2 (id int NOT NULL, b int NOT NULL, INDEX idx(id));
-INSERT INTO t1 VALUES
- (1,'aaaaaaa'), (5,'eeeeeee'), (4,'ddddddd'), (2,'bbbbbbb'), (3,'ccccccc');
-INSERT INTO t2 VALUES
- (3,10), (2,20), (5,30), (3,20), (5,10), (3,40), (3,30), (2,10), (2,40);
-
-EXPLAIN
-SELECT t1.id, a FROM t1 LEFT JOIN t2 ON t1.id=t2.id WHERE t2.b IS NULL;
-
-flush status;
-SELECT t1.id, a FROM t1 LEFT JOIN t2 ON t1.id=t2.id WHERE t2.b IS NULL;
-show status like 'Handler_read%';
-
-DROP TABLE t1,t2;
-
-#
-# Bug 28571: outer join with false on condition over constant tables
-#
-
-CREATE TABLE t1 (c int PRIMARY KEY, e int NOT NULL);
-INSERT INTO t1 VALUES (1,0), (2,1);
-CREATE TABLE t2 (d int PRIMARY KEY);
-INSERT INTO t2 VALUES (1), (2), (3);
-
-EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d IS NULL;
-SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d IS NULL;
-SELECT * FROM t1 LEFT JOIN t2 ON e<>0 WHERE c=1 AND d<=>NULL;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug#47650: using group by with rollup without indexes returns incorrect
---echo # results with where
---echo #
-CREATE TABLE t1 ( a INT );
-INSERT INTO t1 VALUES (1);
-
-CREATE TABLE t2 ( a INT, b INT );
-INSERT INTO t2 VALUES (1, 1),(1, 2),(1, 3),(2, 4),(2, 5);
-
-EXPLAIN
-SELECT t1.a, COUNT( t2.b ), SUM( t2.b ), MAX( t2.b )
-FROM t1 LEFT JOIN t2 USING( a )
-GROUP BY t1.a WITH ROLLUP;
-
-SELECT t1.a, COUNT( t2.b ), SUM( t2.b ), MAX( t2.b )
-FROM t1 LEFT JOIN t2 USING( a )
-GROUP BY t1.a WITH ROLLUP;
-
-EXPLAIN
-SELECT t1.a, COUNT( t2.b ), SUM( t2.b ), MAX( t2.b )
-FROM t1 JOIN t2 USING( a )
-GROUP BY t1.a WITH ROLLUP;
-
-SELECT t1.a, COUNT( t2.b ), SUM( t2.b ), MAX( t2.b )
-FROM t1 JOIN t2 USING( a )
-GROUP BY t1.a WITH ROLLUP;
-
-DROP TABLE t1, t2;
-
---echo #
---echo # Bug#51598 Inconsistent behaviour with a COALESCE statement inside an IN comparison
---echo #
-CREATE TABLE t1(f1 INT, f2 INT, f3 INT);
-INSERT INTO t1 VALUES (1, NULL, 3);
-CREATE TABLE t2(f1 INT, f2 INT);
-INSERT INTO t2 VALUES (2, 1);
-
-EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN t2 ON t1.f2 = t2.f2
-WHERE (COALESCE(t1.f1, t2.f1), f3) IN ((1, 3), (2, 2));
-
-SELECT * FROM t1 LEFT JOIN t2 ON t1.f2 = t2.f2
-WHERE (COALESCE(t1.f1, t2.f1), f3) IN ((1, 3), (2, 2));
-
-DROP TABLE t1, t2;
-
---echo #
---echo # Bug#52357: Assertion failed: join->best_read in greedy_search
---echo # optimizer_search_depth=0
---echo #
-CREATE TABLE t1( a INT );
-
-INSERT INTO t1 VALUES (1),(2);
-SET optimizer_search_depth = 0;
-
---echo # Should not core dump on query preparation
-EXPLAIN
-SELECT 1
-FROM t1 tt3 LEFT OUTER JOIN t1 tt4 ON 1
- LEFT OUTER JOIN t1 tt5 ON 1
- LEFT OUTER JOIN t1 tt6 ON 1
- LEFT OUTER JOIN t1 tt7 ON 1
- LEFT OUTER JOIN t1 tt8 ON 1
- RIGHT OUTER JOIN t1 tt2 ON 1
- RIGHT OUTER JOIN t1 tt1 ON 1
- STRAIGHT_JOIN t1 tt9 ON 1;
-
-SET optimizer_search_depth = DEFAULT;
-DROP TABLE t1;
-
---echo #
---echo # Bug#46091 STRAIGHT_JOIN + RIGHT JOIN returns different result
---echo #
-CREATE TABLE t1 (f1 INT NOT NULL);
-INSERT INTO t1 VALUES (9),(0);
-
-CREATE TABLE t2 (f1 INT NOT NULL);
-INSERT INTO t2 VALUES
-(5),(3),(0),(3),(1),(0),(1),(7),(1),(0),(0),(8),(4),(9),(0),(2),(0),(8),(5),(1);
-
-SELECT STRAIGHT_JOIN COUNT(*) FROM t1 TA1
-RIGHT JOIN t2 TA2 JOIN t2 TA3 ON TA2.f1 ON TA3.f1;
-
-EXPLAIN SELECT STRAIGHT_JOIN COUNT(*) FROM t1 TA1
-RIGHT JOIN t2 TA2 JOIN t2 TA3 ON TA2.f1 ON TA3.f1;
-
-DROP TABLE t1, t2;
-
---echo #
---echo # Bug#48971 Segfault in add_found_match_trig_cond () at sql_select.cc:5990
---echo #
-CREATE TABLE t1(f1 INT, PRIMARY KEY (f1));
-INSERT INTO t1 VALUES (1),(2);
-
-EXPLAIN EXTENDED SELECT STRAIGHT_JOIN jt1.f1 FROM t1 AS jt1
- LEFT JOIN t1 AS jt2
- RIGHT JOIN t1 AS jt3
- JOIN t1 AS jt4 ON 1
- LEFT JOIN t1 AS jt5 ON 1
- ON 1
- RIGHT JOIN t1 AS jt6 ON jt6.f1
- ON 1;
-
-EXPLAIN EXTENDED SELECT STRAIGHT_JOIN jt1.f1 FROM t1 AS jt1
- RIGHT JOIN t1 AS jt2
- RIGHT JOIN t1 AS jt3
- JOIN t1 AS jt4 ON 1
- LEFT JOIN t1 AS jt5 ON 1
- ON 1
- RIGHT JOIN t1 AS jt6 ON jt6.f1
- ON 1;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug#57688 Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field
---echo #
-
-CREATE TABLE t1 (f1 INT NOT NULL, PRIMARY KEY (f1));
-CREATE TABLE t2 (f1 INT NOT NULL, f2 INT NOT NULL, PRIMARY KEY (f1, f2));
-
-INSERT INTO t1 VALUES (4);
-INSERT INTO t2 VALUES (3, 3);
-INSERT INTO t2 VALUES (7, 7);
-
-EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1
-WHERE t1.f1 = 4
-GROUP BY t2.f1, t2.f2;
-
-SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1
-WHERE t1.f1 = 4
-GROUP BY t2.f1, t2.f2;
-
-EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1
-WHERE t1.f1 = 4 AND t2.f1 IS NOT NULL AND t2.f2 IS NOT NULL
-GROUP BY t2.f1, t2.f2;
-
-SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1
-WHERE t1.f1 = 4 AND t2.f1 IS NOT NULL AND t2.f2 IS NOT NULL
-GROUP BY t2.f1, t2.f2;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug#57034 incorrect OUTER JOIN result when joined on unique key
---echo #
-
-CREATE TABLE t1 (pk INT PRIMARY KEY,
- col_int INT,
- col_int_unique INT UNIQUE KEY);
-INSERT INTO t1 VALUES (1,NULL,2), (2,0,0);
-
-CREATE TABLE t2 (pk INT PRIMARY KEY,
- col_int INT,
- col_int_unique INT UNIQUE KEY);
-INSERT INTO t2 VALUES (1,0,1), (2,0,2);
-
-EXPLAIN
-SELECT * FROM t1 LEFT JOIN t2
- ON t1.col_int_unique = t2.col_int_unique AND t1.col_int = t2.col_int
- WHERE t1.pk=1;
-
-SELECT * FROM t1 LEFT JOIN t2
- ON t1.col_int_unique = t2.col_int_unique AND t1.col_int = t2.col_int
- WHERE t1.pk=1;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug#48046 Server incorrectly processing JOINs on NULL values
---echo #
-
-# bug#48046 is a duplicate of bug#57034
-
-CREATE TABLE `BB` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `time_key` time DEFAULT NULL,
- `varchar_key` varchar(1) DEFAULT NULL,
- `varchar_nokey` varchar(1) DEFAULT NULL,
- PRIMARY KEY (`pk`),
- KEY `time_key` (`time_key`),
- KEY `varchar_key` (`varchar_key`)
-) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
-
-INSERT INTO `BB` VALUES (10,'18:27:58',NULL,NULL);
-
-SELECT table1.time_key AS field1, table2.pk
-FROM BB table1 LEFT JOIN BB table2
- ON table2.varchar_nokey = table1.varchar_key
- HAVING field1;
-
-DROP TABLE BB;
-
---echo #
---echo # Bug#49600 Server incorrectly processing RIGHT JOIN with
---echo # constant WHERE clause and no index
---echo #
-
-# bug#49600 is a duplicate of bug#57034
-
-CREATE TABLE `BB` (
- `col_datetime_key` datetime DEFAULT NULL,
- `col_varchar_key` varchar(1) DEFAULT NULL,
- `col_varchar_nokey` varchar(1) DEFAULT NULL,
- KEY `col_datetime_key` (`col_datetime_key`),
- KEY `col_varchar_key` (`col_varchar_key`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-
-INSERT INTO `BB` VALUES ('1900-01-01 00:00:00',NULL,NULL);
-
-SELECT table1.col_datetime_key
-FROM BB table1 RIGHT JOIN BB table2
- ON table2 .col_varchar_nokey = table1.col_varchar_key
- WHERE 7;
-
-# Disable keys, and we get incorrect result for the same query
-ALTER TABLE BB DISABLE KEYS;
-
-SELECT table1.col_datetime_key
-FROM BB table1 RIGHT JOIN BB table2
- ON table2 .col_varchar_nokey = table1.col_varchar_key
- WHERE 7;
-
-DROP TABLE BB;
-
-
---echo #
---echo # Bug#58490: Incorrect result in multi level OUTER JOIN
---echo # in combination with IS NULL
---echo #
-
-CREATE TABLE t1 (i INT NOT NULL);
-INSERT INTO t1 VALUES (0), (2),(3),(4);
-CREATE TABLE t2 (i INT NOT NULL);
-INSERT INTO t2 VALUES (0),(1), (3),(4);
-CREATE TABLE t3 (i INT NOT NULL);
-INSERT INTO t3 VALUES (0),(1),(2), (4);
-CREATE TABLE t4 (i INT NOT NULL);
-INSERT INTO t4 VALUES (0),(1),(2),(3) ;
-
---sorted_result
-SELECT * FROM
- t1 LEFT JOIN
- ( t2 LEFT JOIN
- ( t3 LEFT JOIN
- t4
- ON t4.i = t3.i
- )
- ON t3.i = t2.i
- )
- ON t2.i = t1.i
- ;
-
---sorted_result
-SELECT * FROM
- t1 LEFT JOIN
- ( t2 LEFT JOIN
- ( t3 LEFT JOIN
- t4
- ON t4.i = t3.i
- )
- ON t3.i = t2.i
- )
- ON t2.i = t1.i
- WHERE t4.i IS NULL;
-
-
-# Most simplified testcase to reproduce the bug.
-# (Has to be at least a two level nested outer join)
---sorted_result
-SELECT * FROM
- t1 LEFT JOIN
- ( ( t2 LEFT JOIN
- t3
- ON t3.i = t2.i
- )
- )
- ON t2.i = t1.i
- WHERE t3.i IS NULL;
-
-
-# Extended testing:
-# We then add some equi-join inside the query above:
-# (There Used to be some problems here with first
-# proposed patch for this bug)
---sorted_result
-SELECT * FROM
- t1 LEFT JOIN
- ( ( t2 LEFT JOIN
- t3
- ON t3.i = t2.i
- )
- JOIN t4
- ON t4.i=t2.i
- )
- ON t2.i = t1.i
- WHERE t3.i IS NULL;
-
---sorted_result
-SELECT * FROM
- t1 LEFT JOIN
- ( ( t2 LEFT JOIN
- t3
- ON t3.i = t2.i
- )
- JOIN (t4 AS t4a JOIN t4 AS t4b ON t4a.i=t4b.i)
- ON t4a.i=t2.i
- )
- ON t2.i = t1.i
- WHERE t3.i IS NULL;
-
---sorted_result
-SELECT * FROM
- t1 LEFT JOIN
- ( ( t2 LEFT JOIN
- t3
- ON t3.i = t2.i
- )
- JOIN (t4 AS t4a, t4 AS t4b)
- ON t4a.i=t2.i
- )
- ON t2.i = t1.i
- WHERE t3.i IS NULL;
-
-
-DROP TABLE t1,t2,t3,t4;
-
-## Bug#49322 & bug#58490 are duplicates. However, we include testcases
-## for both.
---echo #
---echo # Bug#49322(Duplicate): Server is adding extra NULL row
---echo # on processing a WHERE clause
---echo #
-
-CREATE TABLE h (pk INT NOT NULL, col_int_key INT);
-INSERT INTO h VALUES (1,NULL),(4,2),(5,2),(3,4),(2,8);
-
-CREATE TABLE m (pk INT NOT NULL, col_int_key INT);
-INSERT INTO m VALUES (1,2),(2,7),(3,5),(4,7),(5,5),(6,NULL),(7,NULL),(8,9);
-CREATE TABLE k (pk INT NOT NULL, col_int_key INT);
-INSERT INTO k VALUES (1,9),(2,2),(3,5),(4,2),(5,7),(6,0),(7,5);
-
-# Baseline query wo/ 'WHERE ... IS NULL' - was correct
---sorted_result
-SELECT TABLE1.pk FROM k TABLE1
-RIGHT JOIN h TABLE2 ON TABLE1.col_int_key=TABLE2.col_int_key
-RIGHT JOIN m TABLE4 ON TABLE2.col_int_key=TABLE4.col_int_key;
-
-# Adding 'WHERE ... IS NULL' -> incorrect result
-SELECT TABLE1.pk FROM k TABLE1
-RIGHT JOIN h TABLE2 ON TABLE1.col_int_key=TABLE2.col_int_key
-RIGHT JOIN m TABLE4 ON TABLE2.col_int_key=TABLE4.col_int_key
-WHERE TABLE1.pk IS NULL;
-
-DROP TABLE h,m,k;
-
---echo
---echo # BUG#12567331 - INFINITE LOOP WHEN RESOLVING AN ALIASED COLUMN
---echo # USED IN GROUP BY
---echo
-CREATE TABLE t1 (
- col_varchar_1024_latin1_key varchar(1024),
- col_varchar_10_latin1 varchar(10),
- col_int int(11),
- pk int(11)
-);
-CREATE TABLE t2 (
- col_int_key int(11),
- col_int int(11),
- pk int(11)
-);
-
-PREPARE prep_stmt_9846 FROM '
-SELECT alias1.pk AS field1 FROM
-t1 AS alias1
-LEFT JOIN
-(
- t2 AS alias2
- RIGHT JOIN
- (
- t2 AS alias3
- JOIN t1 AS alias4
- ON 1
- )
- ON 1
-)
-ON 1
-GROUP BY field1';
-execute prep_stmt_9846;
-execute prep_stmt_9846;
-drop table t1,t2;
-
---echo #
---echo # Bug #11765810 58813: SERVER THREAD HANGS WHEN JOIN + WHERE + GROUP BY
---echo # IS EXECUTED TWICE FROM P
---echo #
-CREATE TABLE t1 ( a INT ) ENGINE = MYISAM;
-INSERT INTO t1 VALUES (1);
-PREPARE prep_stmt FROM '
- SELECT 1 AS f FROM t1
- LEFT JOIN t1 t2
- RIGHT JOIN t1 t3
- JOIN t1 t4
- ON 1
- ON 1
- ON 1
- GROUP BY f';
-EXECUTE prep_stmt;
-EXECUTE prep_stmt;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug#49600: outer join of two single-row tables with joining attributes
---echo # evaluated to nulls
-
-create table t1 (a int, b int);
-create table t2 (a int, b int);
-insert into t1 values (1, NULL);
-insert into t2 values (2, NULL);
-
-select * from t1 left join t2 on t1.b=t2.b;
-
-select * from t1 left join t2 on t1.b=t2.b where 1=1;
-
-drop table t1,t2;
-
---echo #
---echo # Bug#53161: outer join in the derived table is erroneously converted
---echo # into an inner join for a query with a group by clause
---echo #
-
-create table t1 (pk int not null primary key, a int not null);
-create table t2 like t1;
-create table t3 like t1;
-create table t4 (pk int not null primary key);
-insert into t1 values (1000, 1), (1001, 1);
-insert into t2 values (2000, 2), (2001, 2);
-insert into t3 values (3000, 3), (3001, 2);
-insert into t4 values (4000), (4001);
-
-explain extended
-select t2.pk,
- (select t3.pk+if(isnull(t4.pk),0,t4.pk)
- from t3 left join t4 on t4.pk=t3.pk
- where t3.pk=t2.pk+1000 limit 1 ) as t
- from t1,t2
- where t2.pk=t1.pk+1000 and t1.pk>1000
- group by t2.pk;
-
-select t2.pk,
- (select t3.pk+if(isnull(t4.pk),0,t4.pk)
- from t3 left join t4 on t4.pk=t3.pk
- where t3.pk=t2.pk+1000 limit 1 ) as t
- from t1,t2
- where t2.pk=t1.pk+1000 and t1.pk>1000
- group by t2.pk;
-
-drop table t1,t2,t3,t4;
-
---echo #
---echo # Bug#57024: Poor performance when conjunctive condition over the outer
---echo # table is used in the on condition of an outer join
---echo #
-
-create table t1 (a int);
-insert into t1 values (NULL), (NULL), (NULL), (NULL);
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 values (4), (2), (1), (3);
-
-create table t2 like t1;
-insert into t2 select if(t1.a is null, 10, t1.a) from t1;
-
-create table t3 (a int, b int, index idx(a));
-insert into t3 values (1, 100), (3, 301), (4, 402), (1, 102), (1, 101);
-insert into t3 values (11, 100), (33, 301), (44, 402), (11, 102), (11, 101);
-insert into t3 values (22, 100), (53, 301), (64, 402), (22, 102), (22, 101);
-
-analyze table t1,t2,t3;
-
-flush status;
-select sum(t3.b) from t1 left join t3 on t3.a=t1.a and t1.a is not null;
-show status like "handler_read%";
-flush status;
-select sum(t3.b) from t2 left join t3 on t3.a=t2.a and t2.a <> 10;
-show status like "handler_read%";
-
-drop table t1,t2,t3;
-
---echo #
---echo # Bug#57688 Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field
---echo #
-
-CREATE TABLE t1 (f1 INT NOT NULL, PRIMARY KEY (f1));
-CREATE TABLE t2 (f1 INT NOT NULL, f2 INT NOT NULL, PRIMARY KEY (f1, f2));
-
-INSERT INTO t1 VALUES (4);
-INSERT INTO t2 VALUES (3, 3);
-INSERT INTO t2 VALUES (7, 7);
-
-EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1
-WHERE t1.f1 = 4
-GROUP BY t2.f1, t2.f2;
-
-SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1
-WHERE t1.f1 = 4
-GROUP BY t2.f1, t2.f2;
-
-EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1
-WHERE t1.f1 = 4 AND t2.f1 IS NOT NULL AND t2.f2 IS NOT NULL
-GROUP BY t2.f1, t2.f2;
-
-SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1
-WHERE t1.f1 = 4 AND t2.f1 IS NOT NULL AND t2.f2 IS NOT NULL
-GROUP BY t2.f1, t2.f2;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug#13068506 - QUERY WITH GROUP BY ON NON-AGGR COLUMN RETURNS
---echo # WRONG RESULT
---echo #
-
-CREATE TABLE t1 (i1 int);
-INSERT INTO t1 VALUES (100), (101);
-
-CREATE TABLE t2 (i2 int, i3 int);
-INSERT INTO t2 VALUES (20,1),(10,2);
-
-CREATE TABLE t3 (i4 int(11));
-INSERT INTO t3 VALUES (1),(2);
-
-let $query= SELECT (
- SELECT MAX( t2.i2 )
- FROM t3 RIGHT JOIN t2 ON ( t2.i3 = 2 )
- WHERE t2.i3 <> t1.i1
-) AS field1
-FROM t1;
-
---echo
---eval $query;
---echo
---eval $query GROUP BY field1;
-
---echo
-drop table t1,t2,t3;
-
---echo # End of test for Bug#13068506
-
---echo End of 5.1 tests
-
---echo #
---echo # LP BUG#994392: Wrong result with RIGHT/LEFT JOIN and ALL subquery
---echo # predicate in WHERE condition.
---echo #
-
-CREATE TABLE t1(a INT);
-INSERT INTO t1 VALUES(9);
-CREATE TABLE t2(b INT);
-INSERT INTO t2 VALUES(8);
-CREATE TABLE t3(c INT);
-INSERT INTO t3 VALUES(3);
-SELECT * FROM t2 RIGHT JOIN t3 ON(c = b) WHERE b < ALL(SELECT a FROM t1 WHERE a <= 7);
-SELECT * FROM t3 LEFT JOIN t2 ON(c = b) WHERE b < ALL(SELECT a FROM t1 WHERE a <= 7);
-SELECT * FROM t2 RIGHT JOIN t3 ON(c = b) WHERE b not in (SELECT a FROM t1 WHERE a <= 7);
-SELECT * FROM t3 LEFT JOIN t2 ON(c = b) WHERE b not in (SELECT a FROM t1 WHERE a <= 7);
-drop table t1,t2,t3;
-
---echo End of 5.2 tests
-
---echo #
---echo # LP bug #813447: LEFT JOIN with single-row inner table and
---echo # a subquery in ON expression
---echo #
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (0);
-
-CREATE TABLE t2 (a int);
-INSERT INTO t2 VALUES (0);
-
-CREATE TABLE t3 (a int);
-INSERT INTO t3 VALUES (0), (0);
-
-SELECT t2.a FROM t1 LEFT JOIN t2 ON (6) IN (SELECT a FROM t3);
-EXPLAIN EXTENDED
-SELECT t2.a FROM t1 LEFT JOIN t2 ON (6) IN (SELECT a FROM t3);
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # LP bug #817384 Wrong result with outer join + subquery in ON
---echo # clause +unique key
---echo #
-
-CREATE TABLE t1 ( c int NOT NULL , b char(1) NOT NULL ) ;
-INSERT INTO t1 VALUES (1,'b');
-
-CREATE TABLE t2 ( a int NOT NULL , b char(1) NOT NULL , PRIMARY KEY (a)) ;
-INSERT INTO t2 VALUES (1,'a');
-
-create table t3 (c1 char(1), c2 char(2));
-insert into t3 values ('c','d');
-insert into t3 values ('c','d');
-
-
-EXPLAIN SELECT t2.b
-FROM t1 LEFT JOIN t2 ON t1.c = t2.a AND ( t2.b , t1.b ) IN (SELECT * from t3);
-SELECT t2.b
-FROM t1 LEFT JOIN t2 ON t1.c = t2.a AND ( t2.b , t1.b ) IN (SELECT * from t3);
-
-EXPLAIN SELECT t2.b
-FROM t1 LEFT JOIN t2 ON (t2.b) IN (SELECT c2 from t3) AND t2.a = 1;
-SELECT t2.b
-FROM t1 LEFT JOIN t2 ON (t2.b) IN (SELECT c2 from t3) AND t2.a = 1;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # lp:825035 second execution of PS with outer join
---echo #
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (1),(2),(3),(4);
-
-CREATE TABLE t2 (a int);
-
-PREPARE stmt FROM
-"SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a";
-
-EXECUTE stmt;
-EXECUTE stmt;
-
-DEALLOCATE PREPARE stmt;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # lp:838633 second execution of PS with outer join
---echo # converted to inner join
---echo #
-
-CREATE TABLE t1 ( b int NOT NULL ) ;
-INSERT INTO t1 VALUES (9),(10);
-
-CREATE TABLE t2 ( b int NOT NULL, PRIMARY KEY (b)) ;
-INSERT INTO t2 VALUES
- (75),(76),(77),(78),(79),(80),(81),(82),(83),(84),(85),(86),(87),(88),(89),
- (10), (90),(91),(92),(93),(94),(95),(96),(97),(98),(99),(100);
-
-CREATE TABLE t3 ( a int, b int NOT NULL , PRIMARY KEY (b)) ;
-INSERT INTO t3 VALUES
- (0,6),(0,7),(0,8),(2,9),(0,10),(2,21),(0,22),(2,23),(2,24),(2,25);
-
-SET SESSION join_cache_level=4;
-
-EXPLAIN EXTENDED
-SELECT * FROM (t2 LEFT JOIN t1 ON t1.b = t2.b) JOIN t3 ON t1.b = t3.b;
-
-PREPARE stmt FROM
-'SELECT * FROM (t2 LEFT JOIN t1 ON t1.b = t2.b) JOIN t3 ON t1.b = t3.b';
-
-EXECUTE stmt;
-EXECUTE stmt;
-
-DEALLOCATE PREPARE stmt;
-
-SET SESSION join_cache_level=default;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # LP bug #943543: LEFT JOIN converted to JOIN with
---echo # ORed IS NULL(primary key) in WHERE clause
---echo #
-
-CREATE TABLE t1 (
- a int, b int NOT NULL, pk int NOT NULL,
- PRIMARY KEY (pk), INDEX idx(b)
-);
-INSERT INTO t1 VALUES
- (NULL,1,1), (6,2,2), (5,3,3), (NULL,4,4),
- (1,9,6), (8,5,7), (NULL,8,8), (8,1,5);
-
-CREATE TABLE t2 (pk int PRIMARY KEY);
-INSERT INTO t2 VALUES (3), (8), (5);
-
-EXPLAIN EXTENDED
-SELECT t1.pk FROM t2 JOIN t1 ON t2.pk = t1.a
- WHERE t1.b BETWEEN 5 AND 6 AND t1.pk IS NULL OR t1.pk = 5
-ORDER BY t1.pk;
-SELECT t1.pk FROM t2 JOIN t1 ON t2.pk = t1.a
- WHERE t1.b BETWEEN 5 AND 6 AND t1.pk IS NULL OR t1.pk = 5
-ORDER BY t1.pk;
-
-EXPLAIN EXTENDED
-SELECT t1.pk FROM t2 LEFT JOIN t1 ON t2.pk = t1.a
- WHERE t1.b BETWEEN 5 AND 6 AND t1.pk IS NULL OR t1.pk = 5
-ORDER BY t1.pk;
-SELECT t1.pk FROM t2 LEFT JOIN t1 ON t2.pk = t1.a
- WHERE t1.b BETWEEN 5 AND 6 AND t1.pk IS NULL OR t1.pk = 5
-ORDER BY t1.pk;
-
-DROP TABLE t2;
-
-CREATE TABLE t2 (c int, d int, KEY (c));
-INSERT INTO t2 VALUES
- (3,30), (8,88), (5,50), (8,81),
- (4,40), (9,90), (7,70), (9,90),
- (13,130), (18,188), (15,150), (18,181),
- (14,140), (19,190), (17,170), (19,190);
-
-INSERT INTO t1 VALUES (8,5,9);
-
-EXPLAIN EXTENDED
-SELECT t1.b, t2.c, t2.d FROM t2 JOIN t1 ON t2.c = t1.a
- WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5
-ORDER BY t1.b;
-SELECT t1.b, t2.c, t2.d FROM t2 JOIN t1 ON t2.c = t1.a
- WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5
-ORDER BY t1.b;
-
-EXPLAIN EXTENDED
-SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a
- WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5
-ORDER BY t1.b;
-SELECT t1.b, t2.c, t2.d FROM t2 LEFT JOIN t1 ON t2.c = t1.a
- WHERE t1.pk BETWEEN 5 AND 6 AND t1.b IS NULL OR t1.b = 5
-ORDER BY t1.b;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug mdev-4336: LEFT JOIN with disjunctive
---echo # <non-nullable datetime field> IS NULL in WHERE
---echo # causes a hang and eventual crash
---echo #
-
-CREATE TABLE t1 (
- id int(11) NOT NULL,
- modified datetime NOT NULL,
- PRIMARY KEY (id)
-);
-
-SELECT a.* FROM t1 a LEFT JOIN t1 b ON a.id = b.id
- WHERE a.modified > b.modified or b.modified IS NULL;
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-4817: Optimizer fails to optimize expression of the form 'FOO' IS NULL
---echo #
-create table t0 (a int not null);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-alter table t0 add person_id varchar(255) not null;
-create table t1 (pk int not null primary key);
-insert into t1 select A.a + 10*B.a from t0 A, t0 B;
-
-explain select * from t1 left join t0 on t0.a=t1.pk where t0.person_id='fooo' or 'xyz' IS NULL;
-explain select * from t1 left join t0 on t0.a=t1.pk where t0.person_id='fooo';
-explain select * from t1 left join t0 on t0.a=t1.pk where t0.person_id='fooo' or t0.person_id='bar';
-
-drop table t0, t1;
-
---echo #
---echo # MDEV-4836: Wrong result on <not null date column> IS NULL (old documented hack stopped working)
---echo # (this is a regression after fix for MDEV-4817)
---echo #
-CREATE TABLE t1 (id INT, d DATE NOT NULL);
-INSERT INTO t1 VALUES (1,'0000-00-00'),(2,'0000-00-00');
-CREATE TABLE t2 (i INT);
-SELECT * FROM t1 LEFT JOIN t2 ON (id=i) WHERE NULL OR d IS NULL;
-DROP TABLE t1,t2;
-
-
-CREATE TABLE t1 (i1 INT, d1 DATE NOT NULL);
-INSERT INTO t1 VALUES (1,'2012-12-21'),(2,'0000-00-00');
-
-CREATE TABLE t2 (i2 INT, j2 INT);
-INSERT INTO t2 VALUES (1,10),(2,20);
-
-SELECT * FROM t1 LEFT JOIN t2 ON i1 = j2 WHERE d1 IS NULL AND 1 OR i1 = i2;
-DROP TABLE t1,t2;
-
---echo # Another testcase
-CREATE TABLE t1 (i1 INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (NULL);
-
-CREATE TABLE t2 (i2 INT, a INT, b INT) ENGINE=MyISAM;
-CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2;
-
-INSERT INTO t2 VALUES (NULL,1,2),(NULL,2,3);
-SELECT * FROM t1 LEFT JOIN v2 ON i1 = i2 WHERE a < b;
-SELECT * FROM t1 LEFT JOIN t2 ON i1 = i2 WHERE a < b;
-
-drop view v2;
-drop table t1,t2;
-
---echo #
---echo # Bug mdev-4942: LEFT JOIN with conjunctive
---echo # <non-nullable datetime field> IS NULL in WHERE
---echo # causes an assert failure
---echo #
-
-CREATE TABLE t1 ( i1 int, d1 date );
-INSERT INTO t1 VALUES (1,'2001-06-26'), (2,'2000-11-16');
-
-CREATE TABLE t2 ( i2 int, d2 date NOT NULL );
-INSERT INTO t2 VALUES (3,'2000-03-06'), (4,'2007-09-25');
-
-SELECT * FROM t1 LEFT JOIN t2 ON i1 = i2 WHERE d1 IS NULL AND d2 IS NULL;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug mdev-4952: LEFT JOIN with disjunctive
---echo # <non-nullable datetime field> IS NULL in WHERE
---echo # causes an assert failure
---echo #
-
-CREATE TABLE t1 (a1 int, b1 int NOT NULL) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1, 10), (2, 11);
-
-CREATE TABLE t2 (dt datetime NOT NULL, a2 int, b2 int) ENGINE=MyISAM;
-INSERT INTO t2 VALUES
-('2006-10-08 09:34:54', 1, 100), ('2001-01-19 01:04:43', 2, 200);
-
-SELECT * FROM t1 LEFT JOIN t2 ON a1 = a2
- WHERE ( dt IS NULL OR FALSE ) AND b2 IS NULL;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug mdev-4962: nested outer join with
---echo # <non-nullable datetime field> IS NULL in WHERE
---echo # causes an assert failure
---echo #
-
-CREATE TABLE t1 (i1 int) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE TABLE t2 (i2 int) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (10),(20);
-
-CREATE TABLE t3 (i3 int, d3 datetime NOT NULL) ENGINE=MyISAM;
-INSERT INTO t3 VALUES (8,'2008-12-04 17:53:42'),(9,'2012-12-21 12:12:12');
-
-SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON i2 = i3 ON i1 = i3
- WHERE d3 IS NULL;
-EXPLAIN EXTENDED
-SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON i2 = i3 ON i1 = i3
- WHERE d3 IS NULL;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # Bug mdev-6705: wrong on expression after constant row substitution
---echo # that triggers a simplification of WHERE condition
---echo #
-
-CREATE TABLE t1 (a int, b int) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (10,8);
-
-CREATE TABLE t2 (c int) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (8),(9);
-
-CREATE TABLE t3 (d int) ENGINE=MyISAM;
-INSERT INTO t3 VALUES (3),(8);
-
-EXPLAIN EXTENDED
-SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a
- WHERE b IN (1,2,3) OR b = d;
-
-SELECT * FROM t1 INNER JOIN t2 ON c = b LEFT JOIN t3 ON d = a
- WHERE b IN (1,2,3) OR b = d;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # MDEV-6634: Wrong estimates for ref(const) and key IS NULL predicate
---echo #
-create table t1(a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t2 (a int, b int, c int, key(b), key(c));
-
-insert into t2 select
- @a:=A.a + 10*B.a+100*C.a,
- IF(@a<900, NULL, @a),
- IF(@a<500, NULL, @a)
-from t1 A, t1 B, t1 C;
-
-delete from t1 where a=0;
-
---echo # Check that there are different #rows of NULLs for b and c, both !=10:
-explain select * from t2 force index (b) where b is null;
-explain select * from t2 force index (c) where c is null;
-
-explain select * from t1 left join t2 on t2.b is null;
-explain select * from t1 left join t2 on t2.c is null;
-
-drop table t1,t2;
-
---echo #
---echo # MDEV-10006: optimizer doesn't convert outer join to inner on views with WHERE clause
---echo #
-
-CREATE TABLE t1(i1 int primary key, v1 int, key(v1));
-INSERT INTO t1 VALUES (1, 1);
-INSERT INTO t1 VALUES (2, 2);
-INSERT INTO t1 VALUES (3, 3);
-INSERT INTO t1 VALUES (4, 4);
-INSERT INTO t1 VALUES (5, 3);
-INSERT INTO t1 VALUES (6, 6);
-INSERT INTO t1 VALUES (7, 7);
-INSERT INTO t1 VALUES (8, 8);
-INSERT INTO t1 VALUES (9, 9);
-
-CREATE TABLE t2(i2 int primary key, v2 int, key(v2));
-INSERT INTO t2 VALUES (1, 1);
-INSERT INTO t2 VALUES (2, 2);
-INSERT INTO t2 VALUES (3, 3);
-INSERT INTO t2 VALUES (4, 4);
-INSERT INTO t2 VALUES (5, 3);
-INSERT INTO t2 VALUES (6, 6);
-INSERT INTO t2 VALUES (7, 7);
-INSERT INTO t2 VALUES (8, 8);
-INSERT INTO t2 VALUES (9, 9);
-
-CREATE TABLE t3(i3 int primary key, v3 int, key(v3));
-INSERT INTO t3 VALUES (2, 2);
-INSERT INTO t3 VALUES (4, 4);
-INSERT INTO t3 VALUES (6, 6);
-INSERT INTO t3 VALUES (8, 8);
-
---echo # This should have a join order of t3,t1,t2 (or t3,t2,t1, the idea is that t3 is the first one)
-EXPLAIN EXTENDED
-SELECT * FROM
- (SELECT t1.i1 as i1, t1.v1 as v1,
- t2.i2 as i2, t2.v2 as v2,
- t3.i3 as i3, t3.v3 as v3
- FROM t1 JOIN t2 on t1.i1 = t2.i2
- LEFT JOIN t3 on t2.i2 = t3.i3
- ) as w1
-WHERE v3 = 4;
-
---echo # This should have the same join order like the query above:
-EXPLAIN EXTENDED
-SELECT * FROM
- (SELECT t1.i1 as i1, t1.v1 as v1,
- t2.i2 as i2, t2.v2 as v2,
- t3.i3 as i3, t3.v3 as v3
- FROM t1 JOIN t2 on t1.i1 = t2.i2
- LEFT JOIN t3 on t2.i2 = t3.i3
- WHERE t1.i1 = t2.i2
- AND 1 = 1
- ) as w2
-WHERE v3 = 4;
-
-drop table t1,t2,t3;
-
---echo #
---echo # MDEV-11958: LEFT JOIN with stored routine produces incorrect result
---echo #
-
-CREATE TABLE t (x INT);
-INSERT INTO t VALUES(1),(NULL);
-CREATE FUNCTION f (val INT, ret INT) RETURNS INT DETERMINISTIC RETURN IFNULL(val, ret);
-
-SELECT t1.x, t2.x, IFNULL(t2.x,0), f(t2.x,0)
- FROM t t1 LEFT JOIN t t2
- ON t1.x = t2.x
- WHERE IFNULL(t2.x,0)=0;
-explain extended
-SELECT t1.x, t2.x, IFNULL(t2.x,0), f(t2.x,0)
- FROM t t1 LEFT JOIN t t2
- ON t1.x = t2.x
- WHERE IFNULL(t2.x,0)=0;
-SELECT t1.x, t2.x, IFNULL(t2.x,0), f(t2.x,0)
- FROM t t1 LEFT JOIN t t2
- ON t1.x = t2.x
- WHERE f(t2.x,0)=0;
-explain extended
-SELECT t1.x, t2.x, IFNULL(t2.x,0), f(t2.x,0)
- FROM t t1 LEFT JOIN t t2
- ON t1.x = t2.x
- WHERE f(t2.x,0)=0;
-
-drop function f;
-drop table t;
-CREATE TABLE t1 (
- col1 DECIMAL(33,5) NULL DEFAULT NULL,
- col2 DECIMAL(33,5) NULL DEFAULT NULL
-);
-
-CREATE TABLE t2 (
- col1 DECIMAL(33,5) NULL DEFAULT NULL,
- col2 DECIMAL(33,5) NULL DEFAULT NULL,
- col3 DECIMAL(33,5) NULL DEFAULT NULL
-);
-
-INSERT INTO t1 VALUES (2, 1.1), (2, 2.1);
-INSERT INTO t2 VALUES (3, 3.1, 4), (1, 1, NULL);
-
-DELIMITER |;
-
-CREATE FUNCTION f1 ( p_num DECIMAL(45,15), p_return DECIMAL(45,15))
-RETURNS decimal(33,5)
-LANGUAGE SQL
-DETERMINISTIC
-CONTAINS SQL
-SQL SECURITY INVOKER
-BEGIN
- IF p_num IS NULL THEN
- RETURN p_return;
- ELSE
- RETURN p_num;
- END IF;
-END |
-
-DELIMITER ;|
-
-let $q1=
-SELECT t1.col1, t2.col1, t2.col3
-FROM t1 LEFT OUTER JOIN t2 ON t1.col1 = t2.col2
-WHERE IFNULL(t2.col3,0) = 0;
-
-eval $q1;
-eval EXPLAIN EXTENDED $q1;
-
-let $q2=
-SELECT t1.col1, t2.col1, t2.col3
-FROM t1 LEFT OUTER JOIN t2 ON t1.col1 = t2.col2
-WHERE f1(t2.col3,0) = 0;
-eval $q2;
-eval EXPLAIN EXTENDED $q2;
-
-DROP FUNCTION f1;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-10397: Server crashes in key_copy with join_cache_level > 2 and join on BIT fields
---echo #
-
-CREATE TABLE t1 (b1 BIT NOT NULL);
-INSERT INTO t1 VALUES (0),(1);
-
-CREATE TABLE t2 (b2 BIT NOT NULL);
-INSERT INTO t2 VALUES (0),(1);
-
-set @save_join_cache_level= @@join_cache_level;
-SET @@join_cache_level = 3;
-SELECT t1.b1+'0' , t2.b2 + '0' FROM t1 LEFT JOIN t2 ON b1 = b2;
-DROP TABLE t1, t2;
-set @join_cache_level= @save_join_cache_level;
-
---echo #
---echo # MDEV-14779: using left join causes incorrect results with materialization and derived tables
---echo #
-
-create table t1(id int);
-insert into t1 values (1),(2);
-create table t2(sid int, id int);
-insert into t2 values (1,1),(2,2);
-
-select * from t1 t
- left join (select * from t2 where sid in (select max(sid) from t2 where 0=1 group by id)) r
- on t.id=r.id ;
-drop table t1, t2;
-
---echo # end of 5.5 tests
-
-SET optimizer_switch=@save_optimizer_switch;
diff --git a/mysql-test/t/join_outer_innodb.test b/mysql-test/t/join_outer_innodb.test
deleted file mode 100644
index fe08689c80b..00000000000
--- a/mysql-test/t/join_outer_innodb.test
+++ /dev/null
@@ -1,375 +0,0 @@
-#
-# test of left outer join for tests that depends on innodb
-#
-
---source include/have_innodb.inc
-
-#
-# Test for bug #17164: ORed FALSE blocked conversion of outer join into join
-#
-
-CREATE TABLE t1 (id int(11) NOT NULL PRIMARY KEY, name varchar(20),
- INDEX (name)) ENGINE=InnoDB;
-CREATE TABLE t2 (id int(11) NOT NULL PRIMARY KEY, fkey int(11),
- FOREIGN KEY (fkey) REFERENCES t2(id)) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,'A1'),(2,'A2'),(3,'B');
-INSERT INTO t2 VALUES (1,1),(2,2),(3,2),(4,3),(5,3);
-
-EXPLAIN
-SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
- WHERE t1.name LIKE 'A%';
-
-EXPLAIN
-SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
- WHERE t1.name LIKE 'A%' OR FALSE;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # BUG#58456: Assertion 0 in QUICK_INDEX_MERGE_SELECT::need_sorted_output
---echo # in opt_range.h
---echo #
-
-CREATE TABLE t1 (
- col_int INT,
- col_int_key INT,
- pk INT NOT NULL,
- PRIMARY KEY (pk),
- KEY col_int_key (col_int_key)
-) ENGINE=InnoDB;
-
-INSERT INTO t1 VALUES (NULL,1,1), (6,2,2), (5,3,3), (NULL,4,4);
-INSERT INTO t1 VALUES (1,NULL,6), (8,5,7), (NULL,8,8), (8,NULL,5);
-
-CREATE TABLE t2 (
- pk INT PRIMARY KEY
-) ENGINE=InnoDB;
-
-let $query=
-SELECT t1.pk
-FROM t2 LEFT JOIN t1 ON t2.pk = t1.col_int
-WHERE t1.col_int_key BETWEEN 5 AND 6
- AND t1.pk IS NULL OR t1.pk IN (5)
-ORDER BY pk;
-
---echo
---eval EXPLAIN $query
---echo
---eval $query
---echo
-
-DROP TABLE t1,t2;
-
---echo # End BUG#58456
-
-#
-# Bug #848652: crash with RIGHT JOIN and GROUP BY
-#
-
-CREATE TABLE t1(a int, b int, KEY (a), PRIMARY KEY (b)) ENGINE=InnoDB;
-
-CREATE TABLE t2 (b int, PRIMARY KEY (b));
-INSERT INTO t2 VALUES (4),(9);
-
-SELECT STRAIGHT_JOIN t1.a FROM t1 RIGHT JOIN t2 ON t1.b = t2.b
- WHERE (t1.b NOT BETWEEN 1 AND 7 OR t1.a IS NULL AND t1.b = t2.b) AND t2.b = 4
-GROUP BY 1;
-
-DROP TABLE t1,t2;
-
---echo #
---echo Bug #59487: WRONG RESULT WITH STRAIGHT_JOIN AND RIGHT JOIN
---echo #
-
-CREATE TABLE t1 (
- pk int(11) NOT NULL,
- col_varchar_10_latin1_key varchar(10) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-INSERT INTO t1 VALUES (1,'1');
-CREATE TABLE t2 (
- pk int(11) NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-INSERT INTO t2 VALUES (1);
-CREATE TABLE t3 (
- pk int(11) NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-INSERT INTO t3 VALUES (1);
-CREATE TABLE t4 (
- pk int(11) NOT NULL,
- col_int int(11) DEFAULT NULL,
- col_int_key int(11) DEFAULT NULL,
- col_varchar_10_latin1_key varchar(10) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-INSERT INTO t4 VALUES (1,1,1,'1');
-CREATE TABLE t5 (
- col_int int(11) DEFAULT NULL,
- col_varchar_10_utf8_key varchar(10) CHARACTER SET utf8 DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-INSERT INTO t5 VALUES (1,'1');
-CREATE TABLE t6 (
- col_int_key int(11) DEFAULT NULL,
- col_varchar_10_latin1_key varchar(10) DEFAULT NULL,
- pk int(11) NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-INSERT INTO t6 VALUES (1,'1',1);
-
-# EXPLAIN of query above (t2 is before t5 in plan)
-
-let $rest_of_query=t6a.pk, t2.pk
-FROM t6 AS t6a
- LEFT JOIN
- (
- t2
- RIGHT JOIN
- (
- (t1 LEFT JOIN (t4 JOIN t3 ON t4.col_int) ON t4.col_int_key = t1.pk)
- LEFT JOIN
- (t5 JOIN t6 AS t6b
- ON t5.col_varchar_10_utf8_key = t6b.col_varchar_10_latin1_key)
- ON t1.pk = t5.col_int
- )
- ON t4.col_varchar_10_latin1_key = t1.col_varchar_10_latin1_key
- AND t5.col_varchar_10_utf8_key = 0
- )
- ON t6a.pk IS TRUE
-WHERE t6b.col_int_key IS TRUE;
-
-eval SELECT STRAIGHT_JOIN $rest_of_query;
-eval EXPLAIN SELECT STRAIGHT_JOIN $rest_of_query;
-
-# right result (same query, just remove STRAIGHT_JOIN):
-
-eval SELECT $rest_of_query;
-eval EXPLAIN SELECT $rest_of_query;
-
-drop table t1,t2,t3,t4,t5,t6;
-
---echo #
---echo Bug mdev-4318: view over a complex query with outer joins
---echo #
-
-CREATE TABLE t1 (
- a1 int NOT NULL, a2 int NOT NULL, a3 int DEFAULT NULL, a4 tinyint NOT NULL,
- a5 int NOT NULL, a6 tinyint NOT NULL, a7 tinyint(4) DEFAULT NULL,
- a8 smallint(6) DEFAULT NULL, a9 smallint(6) DEFAULT NULL, a10 tinyint NOT NULL,
- PRIMARY KEY (a1), KEY a2 (a2), KEY a3 (a3), KEY a4 (a4), KEY a6 (a6),
- KEY a5 (a5), KEY a7 (a7), KEY a8 (a8), KEY a9 (a9)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-INSERT IGNORE INTO t1 VALUES
- (3360,5684,2219,1,316832,1,0,NULL,NULL,NULL),
- (3362,2754,597,2,316844,1,0,NULL,NULL,NULL),
- (3363,369,NULL,1,317295,1,0,NULL,NULL,NULL);
-
-CREATE TABLE t2 (
- b1 int NOT NULL, b2 int NOT NULL, PRIMARY KEY (b1,b2), KEY b2 (b2)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
-CREATE TABLE t3 (
- c1 int NOT NULL, PRIMARY KEY (c1)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-INSERT INTO t3 VALUES
- (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),
- (1000),(1001),(1002),(1003),(9999);
-
-CREATE TABLE t4 (
- d1 int NOT NULL, PRIMARY KEY (d1)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-INSERT INTO t4 VALUES (5674),(5676),(5680),(5684),(5685);
-
-CREATE TABLE t5 (
- e1 int NOT NULL, e2 varchar(64) NOT NULL, PRIMARY KEY (e1)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-INSERT INTO t5 VALUES
- (5684,'51a5de7a9f56314e082094d78f58be082c3cf0c1'),
- (5685,'754dc8292cb9f5eb9ade126fe7e961c62412a349'),
- (5686,'75eeb33f1c819bac21f6d023b4c5b24185eeda5c');
-
-CREATE TABLE t6 (
- f1 int NOT NULL, PRIMARY KEY (f1)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-INSERT INTO t6 VALUES (5542),(5620),(5686);
-
-CREATE TABLE t7 (
- g1 tinyint NOT NULL DEFAULT '0', g2 varchar(20) NOT NULL, PRIMARY KEY (g1)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-INSERT INTO t7 VALUES
- (1,'60feec2b20ed19f55ad0'),(3,'9ddb18bff7fcbd1e3133'),
- (5,'a05599df9222bb160d11'),(7,'e31bae372f7d01df0589'),
- (9,'8f8372dd7fc8eb46c8a3'),(11,'f8d0e28529e990a09309');
-
-CREATE TABLE t8 (
- h1 tinyint NOT NULL, h2 varchar(128) DEFAULT NULL, PRIMARY KEY (h1)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-INSERT INTO t8 VALUES (1,'b'),(2,'c'),(3,'d'),(4,'e');
-
-CREATE TABLE t9 (
- i1 tinyint NOT NULL, i2 varchar(7) NOT NULL, i3 varchar(128) NOT NULL,
- PRIMARY KEY (i1,i2), KEY i2 (i2), KEY i3 (i3)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-INSERT INTO t9 VALUES
- (2,'a','07630d223c7e5f7b1feb19b3caafb0833fd028eb'),
- (3,'b','1ca53dcc50b68af86f4b1b4676dbed917b543c30'),
- (1,'b','2c01ac36c1ce9a7de66be89f85d8aa5f0052e2e8'),
- (4,'a','496c486b3a9edc439477fef7d34cbefdebba86df'),
- (3,'a','98bf72d8d467201058a5f69bd7709bfc74a8637e'),
- (2,'b','9a45425f6160fb59d7f8a02c721498d4ce945302'),
- (4,'b','9c9a7300f3e708f8e430f9f3376d966f5951f583'),
- (1,'a','c0af3f076b905f31cbb51af304b9c7ad539e0861');
-
-CREATE TABLE t10 (
- j1 tinyint NOT NULL, j2 varchar(20) NOT NULL, PRIMARY KEY (j1)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-INSERT INTO t10 VALUES (1,'b'),(2,'c'),(3,'d');
-
-CREATE TABLE t11 (
- k1 int NOT NULL, k2 datetime DEFAULT NULL, k3 int DEFAULT NULL,
- k4 int DEFAULT NULL, PRIMARY KEY (k1), KEY k3 (k3), KEY k4 (k4)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-INSERT INTO t11 VALUES
- (317422,'2013-03-18 11:43:03',1,NULL),(317423,'2013-03-18 11:43:11',1,NULL),
- (317424,'2013-03-18 11:52:01',1,1),(317425,'2013-03-18 11:52:01',1,1),
- (317426,'2013-03-18 11:56:38',1,1),(317427,'2013-03-18 12:18:25',1,NULL),
- (317428,'2013-03-18 12:46:28',1,NULL),(317429,'2013-03-18 12:46:28',1,NULL),
- (317430,'2013-03-18 12:46:28',1,NULL),(317431,'2013-03-18 12:46:28',1,NULL),
- (317432,'2013-03-18 12:46:28',1,NULL),(317433,'2013-03-18 12:46:28',1,NULL),
- (317434,'2013-03-18 12:46:28',1,NULL),(317435,'2013-03-18 12:46:28',1,NULL),
- (317436,'2013-03-18 12:46:28',1,NULL),(317437,'2013-03-18 12:46:28',1,NULL),
- (317438,'2013-03-18 12:46:28',1,NULL),(317439,'2013-03-18 12:46:28',1,NULL),
- (317440,'2013-03-18 12:55:20',1,NULL),(317441,'2013-03-18 12:58:29',1,NULL),
- (317442,'2013-03-18 13:06:02',1,NULL),(317443,'2013-03-18 15:23:18',21,NULL);
-
-CREATE TABLE t12 (
- l1 int NOT NULL, l2 varchar(64) NOT NULL, PRIMARY KEY (l1)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-INSERT INTO t12 VALUES
- (552,'59a498252ef59f96fbdc13a414abe244d8e8bc30'),
- (554,'c6025c7cb2d9dfb1be7ce4a61f35b45bb9e61ba3'),
- (555,'b245bcc672082bb6d10794b2b4ac972dd14b1cf5');
-
-CREATE TABLE t13 (
- m1 int NOT NULL, m2 int NOT NULL, m3 int NOT NULL,
- PRIMARY KEY (m1,m2,m3), KEY m3 (m3), KEY m2 (m2)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-INSERT INTO t13 VALUES (3324,43,4),(3332,263,1),(3348,27,3);
-
-CREATE TABLE t14 (
- n1 smallint NOT NULL, n2 varchar(64) NOT NULL, PRIMARY KEY (n1)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-INSERT INTO t14 VALUES
- (21,'685bf7ca576af964c7cff564d5e4473b81499b8b'),
- (23,'b8e42dab1ab952406b3accfb47089c61478138a8'),
- (25,'3fea441e411db8c70bf039b50c8f18f59515be53'),
- (27,'998aecc30fd0e0b8a1cac6590e5eccc2d7822223');
-
-CREATE TABLE t15 (
- o1 smallint NOT NULL, PRIMARY KEY (o1)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-INSERT INTO t15 VALUES (1),(3);
-
-CREATE TABLE t16 (
- p1 smallint NOT NULL, p2 varchar(7) NOT NULL, p3 varchar(64) NOT NULL,
- PRIMARY KEY (p1,p2)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-INSERT INTO t16 VALUES
- (1,'a','66bdbb389456f3ae97206da115a7b397c31400e8'),
- (1,'b','66bdbb389456f3ae97206da115a7b397c31400e8'),
- (3,'a','386c10e454278c6e27feb16258089166422f79b4'),
- (3,'b','386c10e454278c6e27feb16258089166422f79b4');
-
-let $Q=
-select t3.c1,t5.e2,t1.a1,t14.n2,t16.p3,t10.j2,t7.g2,t11.k2,l3.l2,
- t9.i3,t12.l2 AS l_l2,l2.l2 AS l2_l2,l4.l1 AS l4_l1,t6.f1
-from
-(
- (
- (
- (
- (
- (
- (
- (
- (
- (
- (
- (
- (
- (
- (
- (
- (
- (
- (
- t1
- left join t2 on t1.a1 = t2.b1
- )
- left join t3 on t2.b2 = t3.c1
- )
- left join t4 on t1.a2 = t4.d1
- )
- left join t5 on t4.d1 = t5.e1
- )
- left join t6 on t1.a3 = t6.f1
- )
- left join t5 e2 on t6.f1 = e2.e1
- )
- join t7 on t1.a7 = t7.g1
- )
- join t8 on t1.a4 = t8.h1
- )
- join t9 on t8.h1 = t9.i1
- )
- join t10 on t1.a6 = t10.j1
- )
- join t11 on t1.a5 = t11.k1
- )
- left join t12 on t11.k3 = t12.l1
- )
- left join t12 l2 on t11.k4 = l2.l1
- )
- left join t13 on t1.a1 = t13.m1 and t13.m3 = 4
- )
- left join t12 l4 on l4.l1 = t13.m2
- )
- left join t13 m2 on t1.a1 = m2.m1 and m2.m3 = 3
- )
- left join t12 l3 on l3.l1 = m2.m2
- )
- left join t14 on t1.a8 = t14.n1
- )
- left join t15 on t1.a9 = t15.o1
-)
-left join t16 on t15.o1 = t16.p1
-where t1.a10 = 1;
-
-eval create view v1 as $Q;
-
-eval explain $Q;
-
-explain select * from v1;
-
-drop view v1;
-
-drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16;
-
-
---echo #
---echo # MDEV-4270: crash in fix_semijoin_strategies_for_picked_join_order
---echo #
-drop table if exists t1,t2,t3;
-create table t2(a int,unique key (a)) engine=innodb;
-create table t3(b int) engine=innodb;
-create table t1(a int,b int)engine=innodb;
-
-set @mdev4270_opl= @@optimizer_prune_level;
-set @mdev4270_osd= @@optimizer_search_depth;
-set optimizer_prune_level=0;
-set optimizer_search_depth=2;
-
-select 1 from t1 join t2 a
-natural left join t2 b
-natural right outer join t3;
-
-drop table t1,t2,t3;
-set optimizer_prune_level=@mdev4270_opl;
-set optimizer_search_depth=@mdev4270_osd;
-
diff --git a/mysql-test/t/join_outer_jcl6.test b/mysql-test/t/join_outer_jcl6.test
deleted file mode 100644
index e34cc615216..00000000000
--- a/mysql-test/t/join_outer_jcl6.test
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Run join_outer.test with BKA enabled
-#
-
-set @save_optimizer_switch_jcl6=@@optimizer_switch;
-set @@optimizer_switch='optimize_join_buffer_size=on';
-set @@optimizer_switch='semijoin_with_cache=on';
-set @@optimizer_switch='outer_join_with_cache=on';
-set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
-
-set join_cache_level=6;
-show variables like 'join_cache_level';
-
-set @optimizer_switch_for_join_outer_test=@@optimizer_switch;
-set @join_cache_level_for_join_outer_test=@@join_cache_level;
-
---source t/join_outer.test
-
-set join_cache_level=default;
-show variables like 'join_cache_level';
-
-set @@optimizer_switch=@save_optimizer_switch_jcl6;
-set @optimizer_switch_for_join_outer_test=NULL;
-set @join_cache_level_for_join_outer_test=NULL;
diff --git a/mysql-test/t/key.test b/mysql-test/t/key.test
deleted file mode 100644
index 0695dc2eecb..00000000000
--- a/mysql-test/t/key.test
+++ /dev/null
@@ -1,583 +0,0 @@
---disable_warnings
-drop table if exists t1,t2,t3;
---enable_warnings
-SET SQL_WARNINGS=1;
-
-#
-# This failed for Elizabeth Mattijsen
-#
-
-CREATE TABLE t1 (
- ID CHAR(32) NOT NULL,
- name CHAR(32) NOT NULL,
- value CHAR(255),
- INDEX indexIDname (ID(8),name(8))
-) ;
-
-INSERT INTO t1 VALUES
-('keyword','indexdir','/export/home/local/www/database/indexes/keyword');
-INSERT INTO t1 VALUES ('keyword','urlprefix','text/ /text');
-INSERT INTO t1 VALUES ('keyword','urlmap','/text/ /');
-INSERT INTO t1 VALUES ('keyword','attr','personal employee company');
-INSERT INTO t1 VALUES
-('emailgids','indexdir','/export/home/local/www/database/indexes/emailgids');
-INSERT INTO t1 VALUES ('emailgids','urlprefix','text/ /text');
-INSERT INTO t1 VALUES ('emailgids','urlmap','/text/ /');
-INSERT INTO t1 VALUES ('emailgids','attr','personal employee company');
-
-SELECT value FROM t1 WHERE ID='emailgids' AND name='attr';
-
-drop table t1;
-
-#
-# Problem with many key parts and many or
-#
-
-CREATE TABLE t1 (
- price int(5) DEFAULT '0' NOT NULL,
- area varchar(40) DEFAULT '' NOT NULL,
- type varchar(40) DEFAULT '' NOT NULL,
- transityes enum('Y','N') DEFAULT 'Y' NOT NULL,
- shopsyes enum('Y','N') DEFAULT 'Y' NOT NULL,
- schoolsyes enum('Y','N') DEFAULT 'Y' NOT NULL,
- petsyes enum('Y','N') DEFAULT 'Y' NOT NULL,
- KEY price (price,area,type,transityes,shopsyes,schoolsyes,petsyes)
-);
-
-INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','N','N','N','N');
-INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','N','N','N','N');
-INSERT IGNORE INTO t1 VALUES (900,'Vancouver','Shared/Roomate','','','','');
-INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','Y','Y','Y','Y');
-INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','Y','Y','Y','Y');
-INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','Y','Y','Y','Y');
-INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','Y','Y','Y','Y');
-INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','Y','Y','Y','Y');
-
- SELECT * FROM t1 WHERE area='Vancouver' and transityes='y' and schoolsyes='y' and ( ((type='1 Bedroom' or type='Studio/Bach') and (price<=500)) or ((type='2 Bedroom') and (price<=550)) or ((type='Shared/Roomate') and (price<=300)) or ((type='Room and Board') and (price<=500)) ) and price <= 400;
-
-drop table t1;
-
-#
-# No longer a problem with primary key
-#
-
-CREATE TABLE t1 (program enum('signup','unique','sliding') not null, type enum('basic','sliding','signup'), sites set('mt'), PRIMARY KEY (program));
-# This no longer give an error for wrong primary key
-ALTER TABLE t1 modify program enum('signup','unique','sliding');
-drop table t1;
-
-#
-# Test of compressed decimal index.
-#
-
-CREATE TABLE t1 (
- name varchar(50) DEFAULT '' NOT NULL,
- author varchar(50) DEFAULT '' NOT NULL,
- category decimal(10,0) DEFAULT '0' NOT NULL,
- email varchar(50),
- password varchar(50),
- proxy varchar(50),
- bitmap varchar(20),
- msg varchar(255),
- urlscol varchar(127),
- urlhttp varchar(127),
- timeout decimal(10,0),
- nbcnx decimal(10,0),
- creation decimal(10,0),
- livinguntil decimal(10,0),
- lang decimal(10,0),
- type decimal(10,0),
- subcat decimal(10,0),
- subtype decimal(10,0),
- reg char(1),
- scs varchar(255),
- capacity decimal(10,0),
- userISP varchar(50),
- CCident varchar(50) DEFAULT '' NOT NULL,
- PRIMARY KEY (name,author,category)
-);
-INSERT INTO t1 VALUES
-('patnom','patauteur',0,'p.favre@cryo-networks.fr',NULL,NULL,'#p2sndnq6ae5g1u6t','essai salut','scol://195.242.78.119:patauteur.patnom',NULL,NULL,NULL,950036174,-882087474,NULL,3,0,3,'1','Pub/patnom/futur_divers.scs',NULL,'pat','CC1');
-INSERT INTO t1 VALUES
-('LeNomDeMonSite','Marc',0,'m.barilley@cryo-networks.fr',NULL,NULL,NULL,NULL,'scol://195.242.78.119:Marc.LeNomDeMonSite',NULL,NULL,NULL,950560434,-881563214,NULL,3,0,3,'1','Pub/LeNomDeMonSite/domus_hibere.scs',NULL,'Marq','CC1');
-select * from t1 where name='patnom' and author='patauteur' and category=0;
-drop table t1;
-
-#
-# Problem with search on partial index
-#
-
-create table t1
-(
- name_id int not null auto_increment,
- name blob,
- INDEX name_idx (name(5)),
- primary key (name_id)
-);
-
-INSERT t1 VALUES(NULL,'/');
-INSERT t1 VALUES(NULL,'[T,U]_axpby');
-SELECT * FROM t1 WHERE name='[T,U]_axpy';
-SELECT * FROM t1 WHERE name='[T,U]_axpby';
-create table t2
-(
- name_id int not null auto_increment,
- name char(255) binary,
- INDEX name_idx (name(5)),
- primary key (name_id)
-);
-INSERT t2 select * from t1;
-SELECT * FROM t2 WHERE name='[T,U]_axpy';
-SELECT * FROM t2 WHERE name='[T,U]_axpby';
-# Test possible problems with warnings in CREATE ... SELECT
-CREATE TABLE t3 SELECT * FROM t2 WHERE name='[T,U]_axpby';
-SELECT * FROM t2 WHERE name='[T,U]_axpby';
-
-drop table t1,t2,t3;
-
-#
-# Test bug with long primary key
-#
-
-create table t1
-(
- SEQNO numeric(12 ) not null,
- MOTYPEID numeric(12 ) not null,
- MOINSTANCEID numeric(12 ) not null,
- ATTRID numeric(12 ) not null,
- VALUE varchar(120) not null,
- primary key (SEQNO, MOTYPEID, MOINSTANCEID, ATTRID, VALUE )
-);
-INSERT INTO t1 VALUES (1, 1, 1, 1, 'a');
-INSERT INTO t1 VALUES (1, 1, 1, 1, 'b');
---error ER_DUP_ENTRY
-INSERT INTO t1 VALUES (1, 1, 1, 1, 'a');
-drop table t1;
-
-#
-# Test with blob + tinyint key
-# (Failed for Greg Valure)
-#
-
-CREATE TABLE t1 (
- a tinytext NOT NULL,
- b tinyint(3) unsigned NOT NULL default '0',
- PRIMARY KEY (a(32),b)
-) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('a',1),('a',2);
-SELECT * FROM t1 WHERE a='a' AND b=2;
-SELECT * FROM t1 WHERE a='a' AND b in (2);
-SELECT * FROM t1 WHERE a='a' AND b in (1,2);
-drop table t1;
-
-#
-# Test of create key order
-#
-
-create table t1 (a int not null unique, b int unique, c int, d int not null primary key, key(c), e int not null unique);
-show keys from t1;
-drop table t1;
-
-#
-# Problem with UNIQUE() with NULL parts and auto increment
-#
-
-CREATE TABLE t1 (c CHAR(10) NOT NULL,i INT NOT NULL AUTO_INCREMENT,
-UNIQUE (c,i));
-INSERT IGNORE INTO t1 (c) VALUES (NULL),(NULL);
-SELECT * FROM t1;
-INSERT INTO t1 (c) VALUES ('a'),('a');
-SELECT * FROM t1;
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (c CHAR(10) NULL, i INT NOT NULL AUTO_INCREMENT,
-UNIQUE (c,i));
-INSERT INTO t1 (c) VALUES (NULL),(NULL);
-SELECT * FROM t1;
-INSERT INTO t1 (c) VALUES ('a'),('a');
-SELECT * FROM t1;
-drop table t1;
-
-#
-# longer keys
-#
-create table t1 (i int, a char(200), b text, unique (a), unique (b(300))) charset utf8;
-insert ignore t1 values (1, repeat('a',210), repeat('b', 310));
-insert ignore t1 values (2, repeat(0xD0B1,215), repeat(0xD0B1, 310));
-select i, length(a), length(b), char_length(a), char_length(b) from t1;
-select i from t1 where a=repeat(_utf8 'a',200);
-select i from t1 where a=repeat(_utf8 0xD0B1,200);
-select i from t1 where b=repeat(_utf8 'b',310);
-drop table t1;
-
-#
-# Test of key read with primary key (Bug #3497)
-#
-
-CREATE TABLE t1 (id int unsigned auto_increment, name char(50), primary key (id)) engine=myisam;
-insert into t1 (name) values ('a'), ('b'),('c'),('d'),('e'),('f'),('g');
-explain select 1 from t1 where id =2;
-explain select 1 from t1 where id =2 or id=3;
-explain select name from t1 where id =2;
-ALTER TABLE t1 DROP PRIMARY KEY, ADD INDEX (id);
-explain select 1 from t1 where id =2;
-drop table t1;
-
-#
-# Test of problem with key read (Bug #3666)
-#
-
-CREATE TABLE t1 (numeropost mediumint(8) unsigned NOT NULL default '0', numreponse int(10) unsigned NOT NULL auto_increment, PRIMARY KEY (numeropost,numreponse), UNIQUE KEY numreponse (numreponse));
-INSERT INTO t1 (numeropost,numreponse) VALUES ('1','1'),('1','2'),('2','3'),('2','4');
-SELECT numeropost FROM t1 WHERE numreponse='1';
-EXPLAIN SELECT numeropost FROM t1 WHERE numreponse='1';
-FLUSH TABLES;
-SELECT numeropost FROM t1 WHERE numreponse='1';
-drop table t1;
-
-#
-# UNIQUE prefix keys and multi-byte charsets
-#
-
-create table t1 (c varchar(30) character set utf8, t text character set utf8, unique (c(2)), unique (t(3))) engine=myisam;
-show create table t1;
-insert t1 values ('cccc', 'tttt'),
- (0xD0B1212223D0B1D0B1D0B1D0B1D0B1, 0xD0B1D0B1212223D0B1D0B1D0B1D0B1),
- (0xD0B1222123D0B1D0B1D0B1D0B1D0B1, 0xD0B1D0B1222123D0B1D0B1D0B1D0B1);
---error ER_DUP_ENTRY
-insert t1 (c) values ('cc22');
---error ER_DUP_ENTRY
-insert t1 (t) values ('ttt22');
---error ER_DUP_ENTRY
-insert t1 (c) values (0xD0B1212322D0B1D0B1D0B1D0B1D0B1);
---error ER_DUP_ENTRY
-insert t1 (t) values (0xD0B1D0B1212322D0B1D0B1D0B1D0B1);
-select c from t1 where c='cccc';
-select t from t1 where t='tttt';
-select c from t1 where c=0xD0B1212223D0B1D0B1D0B1D0B1D0B1;
-select t from t1 where t=0xD0B1D0B1212223D0B1D0B1D0B1D0B1;
-drop table t1;
-
-#
-# BUG#6151 - myisam index corruption
-#
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (
- c1 int,
- c2 varbinary(240),
- UNIQUE KEY (c1),
- KEY (c2)
-) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,'\Z\Z\Z\Z');
-INSERT INTO t1 VALUES (2,'\Z\Z\Z\Z\Z\Z');
-INSERT INTO t1 VALUES (3,'\Z\Z\Z\Z');
-select c1 from t1 where c2='\Z\Z\Z\Z';
-DELETE FROM t1 WHERE (c1 = 1);
-check table t1;
-select c1 from t1 where c2='\Z\Z\Z\Z';
-DELETE FROM t1 WHERE (c1 = 3);
-check table t1;
-select c1 from t1 where c2='\Z\Z\Z\Z';
-
-#
-# test delete of keys in a different order
-#
-truncate table t1;
-insert into t1 values(1,"aaaa"),(2,"aaab"),(3,"aaac"),(4,"aaccc");
-delete from t1 where c1=3;
-delete from t1 where c1=1;
-delete from t1 where c1=4;
-check table t1;
-
-drop table t1;
-
-#
-# Bug 6166: index prefix length of 0 not rejected
-#
-# this test should fail in 5.0
-# to fix it, remove #ifdef in
-# file sql_yacc.yy(key_part)
-# create dedicated error code for this and
-# and change my_printf_error() to my_error
-
---error 1391
-create table t1 (c char(10), index (c(0)));
-
-#
-# Bug #6126: Duplicate columns in keys should fail
-# Bug #6252: (dup)
-#
---error 1060
-create table t1 (c char(10), index (c,c));
---error 1060
-create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1));
---error 1060
-create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2));
---error 1060
-create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1));
-create table t1 (c1 char(10), c2 char(10));
---error 1060
-alter table t1 add key (c1,c1);
---error 1060
-alter table t1 add key (c2,c1,c1);
---error 1060
-alter table t1 add key (c1,c2,c1);
---error 1060
-alter table t1 add key (c1,c1,c2);
-drop table t1;
-
-#
-# Bug#11228: DESC shows arbitrary column as "PRI"
-#
-create table t1 (
- i1 INT NOT NULL,
- i2 INT NOT NULL,
- UNIQUE i1idx (i1),
- UNIQUE i2idx (i2));
-desc t1;
-show create table t1;
-drop table t1;
-
-#
-# Bug#12565 - ERROR 1034 when running simple UPDATE or DELETE
-# on large MyISAM table
-#
-create table t1 (
- c1 int,
- c2 varchar(20) not null,
- primary key (c1),
- key (c2(10))
-) engine=myisam;
-insert into t1 values (1,'');
-insert into t1 values (2,' \t\tTest String');
-insert into t1 values (3,' \n\tTest String');
-update t1 set c2 = 'New Test String' where c1 = 1;
-select * from t1;
-drop table t1;
-
-#
-# If we use a partial field for a key that is actually the length of the
-# field, and we extend the field, we end up with a key that includes the
-# whole new length of the field.
-#
-create table t1 (a varchar(10), b varchar(10), key(a(10),b(10)));
-show create table t1;
-alter table t1 modify b varchar(20);
-show create table t1;
-alter table t1 modify a varchar(20);
-show create table t1;
-drop table t1;
-
-#
-# Bug #11227: Incorrectly reporting 'MUL' vs. 'UNI' on varchar
-#
-create table t1 (a int not null primary key, b varchar(20) not null unique);
-desc t1;
-drop table t1;
-create table t1 (a int not null primary key, b int not null unique);
-desc t1;
-drop table t1;
-create table t1 (a int not null primary key, b varchar(20) not null, unique (b(10)));
-desc t1;
-drop table t1;
-create table t1 (a int not null primary key, b varchar(20) not null, c varchar(20) not null, unique(b(10),c(10)));
-desc t1;
-drop table t1;
-
-# End of 4.1 tests
-
-#
-# WL#1563 - Modify MySQL to support on-line CREATE/DROP INDEX
-# To test if this really works, you need to run with --debug
-# and check the trace file.
-#
-# Create a table with named and unnamed indexes.
-create table t1 (
- c1 int,
- c2 char(12),
- c3 varchar(123),
- c4 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- index (c1),
- index i1 (c1),
- index i2 (c2),
- index i3 (c3),
- unique i4 (c4),
- index i5 (c1, c2, c3, c4),
- primary key (c2, c3),
- index (c2, c4));
-show create table t1;
-# Some simple tests.
-alter table t1 drop index c1;
-alter table t1 add index (c1);
-# This creates index 'c1_2'.
-alter table t1 add index (c1);
-alter table t1 drop index i3;
-alter table t1 add index i3 (c3);
-# Two indexes at the same time.
-alter table t1 drop index i2, drop index i4;
-alter table t1 add index i2 (c2), add index i4 (c4);
-# Three indexes, one of them reversely.
-alter table t1 drop index i2, drop index i4, add index i6 (c2, c4);
-alter table t1 add index i2 (c2), add index i4 (c4), drop index i6;
-# include an unique index.
-alter table t1 drop index i2, drop index i4, add unique i4 (c4);
-alter table t1 add index i2 (c2), drop index i4, add index i4 (c4);
-# Modify an index by changing its definition.
-alter table t1 drop index c2, add index (c2(4),c3(7));
-# Change nothing. The new key definition is the same as the old one.
-alter table t1 drop index c2, add index (c2(4),c3(7));
-# Test primary key handling.
-alter table t1 add primary key (c1, c2), drop primary key;
-alter table t1 drop primary key;
-# Drop is checked first. Primary key must exist.
---error 1091
-alter table t1 add primary key (c1, c2), drop primary key;
-show create table t1;
-# Insert non-unique values.
-insert into t1 values(1, 'a', 'a', NULL);
-insert into t1 values(1, 'b', 'b', NULL);
-# Drop some indexes for new adds.
-alter table t1 drop index i3, drop index i2, drop index i1;
-# Add indexes, one is unique on non-unique values.
---error ER_DUP_ENTRY
-alter table t1 add index i3 (c3), add index i2 (c2), add unique index i1 (c1);
-drop table t1;
-
-
-#
-# Bug #20604: Test for disabled keys with aggregate functions and FORCE INDEX.
-#
-
-CREATE TABLE t1( a TINYINT, KEY(a) ) ENGINE=MyISAM;
-INSERT INTO t1 VALUES( 1 );
-ALTER TABLE t1 DISABLE KEYS;
-EXPLAIN SELECT MAX(a) FROM t1 FORCE INDEX(a);
-
-drop table t1;
-
-#
-# Bug #24778: Innodb: No result when using ORDER BY
-#
-CREATE TABLE t1 (
- a INTEGER auto_increment PRIMARY KEY,
- b INTEGER NOT NULL,
- c INTEGER NOT NULL,
- d CHAR(64)
-);
-
-CREATE TABLE t2 (
- a INTEGER auto_increment PRIMARY KEY,
- b INTEGER NOT NULL,
- c SMALLINT NOT NULL,
- d DATETIME NOT NULL,
- e SMALLINT NOT NULL,
- f INTEGER NOT NULL,
- g INTEGER NOT NULL,
- h SMALLINT NOT NULL,
- i INTEGER NOT NULL,
- j INTEGER NOT NULL,
- UNIQUE INDEX (b),
- INDEX (b, d, e, f, g, h, i, j, c),
- INDEX (c)
-);
-
-INSERT INTO t2 VALUES
- (NULL, 1, 254, '1000-01-01 00:00:00', 257, 0, 0, 0, 0, 0),
- (NULL, 2, 1, '2004-11-30 12:00:00', 1, 0, 0, 0, 0, 0),
- (NULL, 3, 1, '2004-11-30 12:00:00', 1, 0, 0, 2, -21600, 0),
- (NULL, 4, 1, '2004-11-30 12:00:00', 1, 0, 0, 2, -10800, 0),
- (NULL, 5, 1, '2004-11-30 12:00:00', 1, 0, 0, 5, -10800, 0),
- (NULL, 6, 1, '2004-11-30 12:00:00', 102, 0, 0, 0, 0, 0),
- (NULL, 7, 1, '2004-11-30 12:00:00', 105, 2, 0, 0, 0, 0),
- (NULL, 8, 1, '2004-11-30 12:00:00', 105, 10, 0, 0, 0, 0);
-
-INSERT INTO t1 (b, c, d) VALUES
- (3388000, -553000, NULL),
- (3388000, -553000, NULL);
-
-SELECT *
-FROM t2 c JOIN t1 pa ON c.b = pa.a
-WHERE c.c = 1
-ORDER BY c.b, c.d
-;
-
-DROP TABLE t1, t2;
-
-#
-# Bug #31137: Assertion failed: primary_key_no == -1 || primary_key_no == 0
-#
-create table t1(a int not null, key aa(a),
- b char(10) not null, unique key bb(b(1)),
- c char(4) not null, unique key cc(c));
-desc t1;
-show create table t1;
-drop table t1;
-create table t1(a int not null, key aa(a),
- b char(10) not null, unique key bb(b(1)),
- c char(4) not null);
-desc t1;
-alter table t1 add unique key cc(c);
-desc t1;
-show create table t1;
-drop table t1;
-
---echo End of 5.0 tests
-
-#
-# Bug #31148: bool close_thread_table(THD*, TABLE**): Assertion
-# `table->key_read == 0' failed.
-#
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (a INT PRIMARY KEY AUTO_INCREMENT);
-
-INSERT INTO t1 VALUES (), (), ();
-
-SELECT 1 AS c1
-FROM t1
-ORDER BY (
- SELECT 1 AS c2
- FROM t1
- GROUP BY GREATEST(LAST_INSERT_ID(), t1.a) ASC
- LIMIT 1);
-
-DROP TABLE t1;
-
-
-#
-# Bug #31974: Wrong EXPLAIN output
-#
-
-CREATE TABLE t1 (a INT, b INT, INDEX (a,b));
-INSERT INTO t1 (a, b)
- VALUES
- (1,1), (1,2), (1,3), (1,4), (1,5),
- (2,2), (2,3), (2,1), (3,1), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6);
-EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
- (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12;
-SELECT 1 as RES FROM t1 AS t1_outer WHERE
- (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug#18144: Cost with FORCE/USE index seems incorrect in some cases.
---echo #
---echo # We are interested in showing that the cost for the last plan is higher
---echo # than for the preceding two plans.
---echo #
-CREATE TABLE t1( a INT, b INT, KEY( a ) );
-INSERT INTO t1 values (1, 2), (1, 3), (2, 3), (2, 4), (3, 4), (3, 5);
-
-EXPLAIN SELECT a, SUM( b ) FROM t1 GROUP BY a;
-SHOW STATUS LIKE 'Last_query_cost';
-
-EXPLAIN SELECT a, SUM( b ) FROM t1 USE INDEX( a ) GROUP BY a;
-SHOW STATUS LIKE 'Last_query_cost';
-
-EXPLAIN SELECT a, SUM( b ) FROM t1 FORCE INDEX( a ) GROUP BY a;
-SHOW STATUS LIKE 'Last_query_cost';
-
-DROP TABLE t1;
diff --git a/mysql-test/t/key_cache-master.opt b/mysql-test/t/key_cache-master.opt
deleted file mode 100644
index 66e19c18a8a..00000000000
--- a/mysql-test/t/key_cache-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---key_buffer_size=2M --small.key_buffer_size=256K --small.key_buffer_size=128K
diff --git a/mysql-test/t/key_cache.test b/mysql-test/t/key_cache.test
deleted file mode 100644
index d28e7c23a4c..00000000000
--- a/mysql-test/t/key_cache.test
+++ /dev/null
@@ -1,540 +0,0 @@
-#
-# Test of multiple key caches, simple and segmented
-#
---disable_warnings
-drop table if exists t1, t2, t3;
---enable_warnings
-
-SET @save_key_buffer_size=@@key_buffer_size;
-SET @save_key_cache_block_size=@@key_cache_block_size;
-SET @save_key_cache_segments=@@key_cache_segments;
-SET @save_key_cache_file_hash_size=@@key_cache_file_hash_size;
-
-SELECT @@key_buffer_size, @@small.key_buffer_size;
-
-# Change default key cache size
-SET @@global.key_buffer_size=16*1024*1024;
-SET @@global.default.key_buffer_size=16*1024*1024;
-SET @@global.default.key_buffer_size=16*1024*1024;
-
-SET @@global.small.key_buffer_size=1*1024*1024;
-SET @@global.medium.key_buffer_size=4*1024*1024;
-# Drop buffer
-SET @@global.medium.key_buffer_size=0;
-# Test double drop
-SET @@global.medium.key_buffer_size=0;
-
-# Print key buffer with different syntaxes
-SHOW VARIABLES like "key_buffer_size";
-SELECT @@key_buffer_size;
-SELECT @@global.key_buffer_size;
-SELECT @@global.default.key_buffer_size;
-SELECT @@global.default.`key_buffer_size`;
-SELECT @@global.`default`.`key_buffer_size`;
-SELECT @@`default`.key_buffer_size;
-
-SELECT @@small.key_buffer_size;
-SELECT @@medium.key_buffer_size;
-
-SET @@global.key_buffer_size=@save_key_buffer_size;
-
-#
-# Errors
-#
-
---error 1064
-SELECT @@default.key_buffer_size;
---error 1272
-SELECT @@skr.storage_engine="test";
-
-select @@keycache1.key_cache_block_size;
-select @@keycache1.key_buffer_size;
-set global keycache1.key_cache_block_size=2048;
-select @@keycache1.key_buffer_size;
-select @@keycache1.key_cache_block_size;
-set global keycache1.key_buffer_size=1*1024*1024;
-select @@keycache1.key_buffer_size;
-select @@keycache1.key_cache_block_size;
-set global keycache2.key_buffer_size=4*1024*1024;
-select @@keycache2.key_buffer_size;
-select @@keycache2.key_cache_block_size;
-set global keycache1.key_buffer_size=0;
-select @@keycache1.key_buffer_size;
-select @@keycache1.key_cache_block_size;
-select @@key_buffer_size;
-select @@key_cache_block_size;
-select @@key_cache_file_hash_size;
-
-set global keycache1.key_buffer_size=1024*1024;
-
-let org_key_blocks_unused=`select unused_blocks as unused from information_schema.key_caches where key_cache_name="default"`;
---disable_query_log
-eval set @org_key_blocks_unused=$org_key_blocks_unused;
---enable_query_log
-
-create table t1 (p int primary key, a char(10)) delay_key_write=1;
-create table t2 (p int primary key, i int, a char(10), key k1(i), key k2(a));
-
-select @org_key_blocks_unused-unused_blocks as key_blocks_unused, used_blocks as key_blocks_used from information_schema.key_caches where key_cache_name="default";
-
-insert into t1 values (1, 'qqqq'), (11, 'yyyy');
-insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'),
- (3, 1, 'yyyy'), (4, 3, 'zzzz');
-select * from t1;
-select * from t2;
-
-update t1 set p=2 where p=1;
-update t2 set i=2 where i=1;
-
-select @org_key_blocks_unused-unused_blocks as key_blocks_unused, used_blocks as key_blocks_used from information_schema.key_caches where key_cache_name="default";
-
-cache index t1 key (`primary`) in keycache1;
-
-explain select p from t1;
-select p from t1;
-explain select i from t2;
-select i from t2;
-explain select count(*) from t1, t2 where t1.p = t2.i;
-select count(*) from t1, t2 where t1.p = t2.i;
-
-cache index t2 in keycache1;
-update t2 set p=p+1000, i=2 where a='qqqq';
-cache index t2 in keycache2;
-insert into t2 values (2000, 3, 'yyyy');
-cache index t2 in keycache1;
-update t2 set p=3000 where a='zzzz';
-select * from t2;
-explain select p from t2;
-select p from t2;
-explain select i from t2;
-select i from t2;
-explain select a from t2;
-select a from t2;
-
-# Test some error conditions
---error 1284
-cache index t1 in unknown_key_cache;
-cache index t1 key (unknown_key) in keycache1;
-
-select @@keycache2.key_buffer_size;
-select @@keycache2.key_cache_block_size;
-set global keycache2.key_buffer_size=0;
-select @@keycache2.key_buffer_size;
-select @@keycache2.key_cache_block_size;
-set global keycache2.key_buffer_size=1024*1024;
-select @@keycache2.key_buffer_size;
-
-update t2 set p=4000 where a='zzzz';
-update t1 set p=p+1;
-
-set global keycache1.key_buffer_size=0;
-select * from t2;
-select p from t2;
-explain select i from t2;
-select i from t2;
-explain select a from t2;
-select a from t2;
-
-select * from t1;
-select p from t1;
-
-# Use the 'small' key cache
-create table t3 (like t1);
-cache index t3 in small;
-insert into t3 select * from t1;
-cache index t3 in keycache2;
-cache index t1,t2 in default;
-drop table t1,t2,t3;
-
-select @org_key_blocks_unused-unused_blocks as key_blocks_unused, used_blocks as key_blocks_used from information_schema.key_caches where key_cache_name="default";
-
-create table t1 (a int primary key);
-cache index t1 in keycache2;
-insert t1 values (1),(2),(3),(4),(5),(6),(7),(8);
-# delete keycache2, t1 is reassigned to default
-set global keycache2.key_buffer_size=0;
-select * from t1;
-drop table t1;
-
-# Test to set up a too small size for a key cache (bug #2064)
-set global keycache3.key_buffer_size=100;
-set global keycache3.key_buffer_size=0;
-
-# Test case for bug 6447
-
-create table t1 (mytext text, FULLTEXT (mytext));
-insert t1 values ('aaabbb');
-
-check table t1;
-set @my_key_cache_block_size= @@global.key_cache_block_size;
-set GLOBAL key_cache_block_size=2048;
-check table t1;
-drop table t1;
-# Restore the changed variable value
-set global key_cache_block_size= @my_key_cache_block_size;
-
-#
-# Bug #19079: corrupted index when key_cache_block_size is not multiple of
-# myisam_block_size
-
-CREATE TABLE t1(a int NOT NULL AUTO_INCREMENT PRIMARY KEY);
-SET @my_key_cache_block_size= @@global.key_cache_block_size;
-SET GLOBAL key_cache_block_size=1536;
-INSERT INTO t1 VALUES (1);
-SELECT @@key_cache_block_size;
-CHECK TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1(a int NOT NULL AUTO_INCREMENT PRIMARY KEY, b int);
-CREATE TABLE t2(a int NOT NULL AUTO_INCREMENT PRIMARY KEY, b int);
-SET GLOBAL key_cache_block_size=1536;
-INSERT INTO t1 VALUES (1,0);
-INSERT INTO t2(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t2;
-INSERT INTO t2(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t2;
-INSERT INTO t2(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t2;
-INSERT INTO t2(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t2;
-INSERT INTO t2(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t2;
-INSERT INTO t2(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t2;
-INSERT INTO t2(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t2;
-INSERT INTO t2(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t2;
-INSERT INTO t2(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t2;
-SELECT COUNT(*) FROM t1;
-SELECT @@key_cache_block_size;
-CHECK TABLE t1;
-DROP TABLE t1,t2;
-# Restore changed variables
-set global key_cache_block_size= @my_key_cache_block_size;
-
-#
-# Bug#10473 - Can't set 'key_buffer_size' system variable to ZERO
-# (One cannot drop the default key cache.)
-#
---error ER_WARN_CANT_DROP_DEFAULT_KEYCACHE
-set @@global.key_buffer_size=0;
-select @@global.key_buffer_size;
-
-#
-# Bug#28478 - Improper key_cache_block_size corrupts MyISAM tables
-#
-SET @bug28478_key_cache_block_size= @@global.key_cache_block_size;
-SET GLOBAL key_cache_block_size= 1536;
-CREATE TABLE t1 (
- id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
- c1 CHAR(150),
- c2 CHAR(150),
- c3 CHAR(150),
- KEY(c1, c2, c3)
- ) ENGINE= MyISAM;
-INSERT INTO t1 (c1, c2, c3) VALUES
- ('a', 'b', 'c'), ('b', 'c', 'd'), ('c', 'd', 'e'), ('d', 'e', 'f'),
- ('e', 'f', 'g'), ('f', 'g', 'h'), ('g', 'h', 'i'), ('h', 'i', 'j'),
- ('i', 'j', 'k'), ('j', 'k', 'l'), ('k', 'l', 'm'), ('l', 'm', 'n'),
- ('m', 'n', 'o'), ('n', 'o', 'p'), ('o', 'p', 'q'), ('p', 'q', 'r'),
- ('q', 'r', 's'), ('r', 's', 't'), ('s', 't', 'u'), ('t', 'u', 'v'),
- ('u', 'v', 'w'), ('v', 'w', 'x'), ('w', 'x', 'y'), ('x', 'y', 'z');
-INSERT INTO t1 (c1, c2, c3) SELECT c1, c2, c3 from t1;
-INSERT INTO t1 (c1, c2, c3) SELECT c1, c2, c3 from t1;
-INSERT INTO t1 (c1, c2, c3) SELECT c1, c2, c3 from t1;
-CHECK TABLE t1;
-SHOW VARIABLES LIKE 'key_cache_block_size';
-SET GLOBAL key_cache_block_size= @bug28478_key_cache_block_size;
-DROP TABLE t1;
-
-# End of 4.1 tests
-
---echo #
---echo # Bug#12361113: crash when load index into cache
---echo #
-
---echo # Note that this creates an empty disabled key cache!
-SET GLOBAL key_cache_none.key_cache_block_size = 1024;
-CREATE TABLE t1 (a INT, b INTEGER NOT NULL, KEY (b) ) ENGINE = MYISAM;
-INSERT INTO t1 VALUES (1, 1);
---error ER_UNKNOWN_KEY_CACHE
-CACHE INDEX t1 in key_cache_none;
---echo # The bug crashed the server at LOAD INDEX below. Now it will succeed
---echo # since the default cache is used due to CACHE INDEX failed for
---echo # key_cache_none.
-LOAD INDEX INTO CACHE t1;
-DROP TABLE t1;
-
-# End of 5.1 tests
-
-#
-# Test cases for segmented key caches
-#
-
-# Test usage of the KEY_CACHE table from information schema
-# for a simple key cache
-
-set global key_buffer_size=@save_key_buffer_size;
-set global key_cache_block_size=@save_key_cache_block_size;
-select @@key_buffer_size;
-select @@key_cache_block_size;
-select @@key_cache_segments;
-
-create table t1 (
- p int not null auto_increment primary key,
- a char(10));
-create table t2 (
- p int not null auto_increment primary key,
- i int, a char(10), key k1(i), key k2(a));
-
-select @@key_cache_segments;
---replace_column 7 #
-select * from information_schema.key_caches where segment_number is null;
-
-insert into t1 values (1, 'qqqq'), (2, 'yyyy');
-insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'),
- (3, 1, 'yyyy'), (4, 3, 'zzzz');
-select * from t1;
-select * from t2;
-update t1 set p=3 where p=1;
-update t2 set i=2 where i=1;
-
-select * from information_schema.session_status where variable_name like 'key_%' and variable_name != 'Key_blocks_unused';
-select variable_value into @key_blocks_unused from information_schema.session_status where variable_name = 'Key_blocks_unused';
---replace_column 7 #
-select * from information_schema.key_caches where segment_number is null;
-
-delete from t2 where a='zzzz';
---replace_column 7 #
-select * from information_schema.key_caches where segment_number is null;
-
-delete from t1;
-delete from t2;
---replace_column 7 #
-select * from information_schema.key_caches where segment_number is null;
-
-# For the key cache with 2 segments execute the same sequence of
-# statements as for the simple cache above.
-# The statistical information on the number of i/o requests and
-# the number of is expected to be the same.
-
-set global key_cache_segments=2;
-select @@key_cache_segments;
---replace_column 7 #
-select * from information_schema.key_caches where segment_number is null;
-
-insert into t1 values (1, 'qqqq'), (2, 'yyyy');
-insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'),
- (3, 1, 'yyyy'), (4, 3, 'zzzz');
-select * from t1;
-select * from t2;
-update t1 set p=3 where p=1;
-update t2 set i=2 where i=1;
-
-
-select * from information_schema.session_status where variable_name like 'key_%' and variable_name != 'Key_blocks_unused';
-select variable_value < @key_blocks_unused from information_schema.session_status where variable_name = 'Key_blocks_unused';
---replace_column 7 #
-select * from information_schema.key_caches where segment_number is null;
-
-delete from t1;
-delete from t2;
---replace_column 7 #
-select * from information_schema.key_caches where segment_number is null;
-
-# Check that we can work with one segment with the same results
-
-set global key_cache_segments=1;
-select @@key_cache_segments;
---replace_column 7 #
-select * from information_schema.key_caches where segment_number is null;
-
-insert into t1 values (1, 'qqqq'), (2, 'yyyy');
-insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'),
- (3, 1, 'yyyy'), (4, 3, 'zzzz');
-select * from t1;
-select * from t2;
-update t1 set p=3 where p=1;
-update t2 set i=2 where i=1;
-
-select * from information_schema.session_status where variable_name like 'key_%' and variable_name != 'Key_blocks_unused';
-select variable_value = @key_blocks_unused from information_schema.session_status where variable_name = 'Key_blocks_unused';
---replace_column 7 #
-select * from information_schema.key_caches where segment_number is null;
-
-delete from t1;
-delete from t2;
---replace_column 7 #
-select * from information_schema.key_caches where segment_number is null;
-
-flush tables; flush status;
---replace_column 7 #
-select * from information_schema.key_caches where segment_number is null;
-
-# Switch back to 2 segments
-
-set global key_buffer_size=32*1024;
-set global key_cache_file_hash_size=128;
-select @@key_buffer_size;
-set global key_cache_segments=2;
-select @@key_cache_segments;
---replace_column 7 #
-select * from information_schema.key_caches where segment_number is null;
-
-insert into t1 values (1, 'qqqq'), (2, 'yyyy');
-insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'),
- (3, 1, 'yyyy'), (4, 3, 'zzzz');
-select * from t1;
-select * from t2;
-update t1 set p=3 where p=1;
-update t2 set i=2 where i=1;
-
---replace_column 7 #
-select * from information_schema.key_caches where segment_number is null;
-
-# Add more rows to tables t1 and t2
-
-insert into t1(a) select a from t1;
-insert into t1(a) select a from t1;
-insert into t1(a) select a from t1;
-insert into t1(a) select a from t1;
-insert into t1(a) select a from t1;
-insert into t1(a) select a from t1;
-insert into t1(a) select a from t1;
-insert into t1(a) select a from t1;
-
-insert into t2(i,a) select i,a from t2;
-insert into t2(i,a) select i,a from t2;
-insert into t2(i,a) select i,a from t2;
-insert into t2(i,a) select i,a from t2;
-insert into t2(i,a) select i,a from t2;
-insert into t2(i,a) select i,a from t2;
-insert into t2(i,a) select i,a from t2;
-insert into t2(i,a) select i,a from t2;
-
---replace_column 6 # 7 # 10 #
-select * from information_schema.key_caches where segment_number is null;
-
-select * from t1 where p between 1010 and 1020 ;
-select * from t2 where p between 1010 and 1020 ;
---replace_column 6 # 7 # 10 #
-select * from information_schema.key_caches where segment_number is null;
-
-flush tables; flush status;
-update t1 set a='zzzz' where a='qqqq';
-update t2 set i=1 where i=2;
---replace_column 6 # 7 #
-select * from information_schema.key_caches where segment_number is null;
-
-# Now test how we can work with 7 segments
-
-set global keycache1.key_buffer_size=256*1024;
-select @@keycache1.key_buffer_size;
-set global keycache1.key_cache_segments=7;
-select @@keycache1.key_cache_segments;
-
---replace_column 6 # 7 #
-select * from information_schema.key_caches where segment_number is null;
---replace_column 7 #
-select * from information_schema.key_caches where key_cache_name like "key%"
- and segment_number is null;
-
-cache index t1 key (`primary`) in keycache1;
-
-explain select p from t1 where p between 1010 and 1020;
-select p from t1 where p between 1010 and 1020;
-explain select i from t2 where p between 1010 and 1020;
-select i from t2 where p between 1010 and 1020;
-explain select count(*) from t1, t2 where t1.p = t2.i;
-select count(*) from t1, t2 where t1.p = t2.i;
-
---replace_column 6 # 7 #
-select * from information_schema.key_caches where segment_number is null;
---replace_column 7 #
-select * from information_schema.key_caches where key_cache_name like "key%"
- and segment_number is null;
-
-cache index t2 in keycache1;
-update t2 set p=p+3000, i=2 where a='qqqq';
---replace_column 7 #
-select * from information_schema.key_caches where key_cache_name like "key%"
- and segment_number is null;
-
-set global keycache2.key_buffer_size=1024*1024;
-cache index t2 in keycache2;
-insert into t2 values (2000, 3, 'yyyy');
---replace_column 7 #
-select * from information_schema.key_caches where key_cache_name like "keycache2"
- and segment_number is null;
---replace_column 7 #
-select * from information_schema.key_caches where key_cache_name like "key%"
- and segment_number is null;
-
-cache index t2 in keycache1;
-update t2 set p=p+5000 where a='zzzz';
-select * from t2 where p between 1010 and 1020;
-explain select p from t2 where p between 1010 and 1020;
-select p from t2 where p between 1010 and 1020;
-explain select i from t2 where a='yyyy' and i=3;
-select i from t2 where a='yyyy' and i=3;
-explain select a from t2 where a='yyyy' and i=3;
-select a from t2 where a='yyyy' and i=3 ;
---replace_column 6 # 7 #
-select * from information_schema.key_caches where segment_number is null;
-
-set global keycache1.key_cache_block_size=2*1024;
-insert into t2 values (7000, 3, 'yyyy');
---replace_column 6 # 7 #
-select * from information_schema.key_caches where segment_number is null;
-
-set global keycache1.key_cache_block_size=8*1024;
---replace_column 6 # 7 #
-select * from information_schema.key_caches where segment_number is null;
-insert into t2 values (8000, 3, 'yyyy');
---replace_column 6 # 7 #
-select * from information_schema.key_caches where segment_number is null;
-
-set global keycache1.key_buffer_size=64*1024;
---replace_column 6 # 7 #
-select * from information_schema.key_caches where segment_number is null;
-
-set global keycache1.key_cache_block_size=2*1024;
---replace_column 6 # 7 #
-select * from information_schema.key_caches where segment_number is null;
-
-set global keycache1.key_cache_block_size=8*1024;
---replace_column 6 # 7 #
-select * from information_schema.key_caches where segment_number is null;
-
-set global keycache1.key_buffer_size=0;
---replace_column 6 # 7 #
-select * from information_schema.key_caches where segment_number is null;
-
-set global keycache1.key_cache_block_size=8*1024;
---replace_column 6 # 7 #
-select * from information_schema.key_caches where segment_number is null;
-
-set global keycache1.key_buffer_size=0;
---replace_column 6 # 7 #
-select * from information_schema.key_caches where segment_number is null;
-
-set global keycache1.key_buffer_size=128*1024;
---replace_column 6 # 7 #
-select * from information_schema.key_caches where segment_number is null;
-
-set global keycache1.key_cache_block_size=1024;
---replace_column 6 # 7 #
-select * from information_schema.key_caches where segment_number is null;
-
-drop table t1,t2;
-
-set global keycache1.key_buffer_size=0;
-set global keycache2.key_buffer_size=0;
-
-set global key_buffer_size=@save_key_buffer_size;
-set global key_cache_segments=@save_key_cache_segments;
-set global key_cache_file_hash_size=@save_key_cache_file_hash_size;
-
-# End of 5.2 tests
diff --git a/mysql-test/t/key_diff.test b/mysql-test/t/key_diff.test
deleted file mode 100644
index b490c613c61..00000000000
--- a/mysql-test/t/key_diff.test
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Check on condition on different length keys.
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-CREATE TABLE t1 (
- a char(5) NOT NULL,
- b char(4) NOT NULL,
- KEY (a),
- KEY (b)
-);
-
-INSERT INTO t1 VALUES ('A','B'),('b','A'),('C','c'),('D','E'),('a','a');
-
-select * from t1,t1 as t2;
-explain select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B;
-#select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B;
-select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B order by binary t1.a,t2.a;
-select * from t1 where a='a';
-drop table t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/key_primary.test b/mysql-test/t/key_primary.test
deleted file mode 100644
index 1ca2059b871..00000000000
--- a/mysql-test/t/key_primary.test
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# test of primary key conversions
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1 (t1 char(3) primary key);
-insert into t1 values("ABC");
-insert into t1 values("ABA");
-insert into t1 values("AB%");
-select * from t1 where t1="ABC";
-select * from t1 where t1="ABCD";
-select * from t1 where t1 like "a_\%";
-describe select * from t1 where t1="ABC";
-describe select * from t1 where t1="ABCD";
-drop table t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/keyread.test b/mysql-test/t/keyread.test
deleted file mode 100644
index d9d3002d392..00000000000
--- a/mysql-test/t/keyread.test
+++ /dev/null
@@ -1,10 +0,0 @@
---source include/have_innodb.inc
-
-#
-# MDEV-12293 Assertion `table->no_keyread || !table->covering_keys.is_set(tab->index) || table->file->keyread == tab->index' failed
-#
-create table t1 (f1 int not null, f2 int, f3 int, primary key (f1,f2), key(f2,f3)) engine=innodb;
-create view v1 as select * from t1 where f2 = 1;
-select distinct f1 from v1;
-drop view v1;
-drop table t1;
diff --git a/mysql-test/t/keywords.test b/mysql-test/t/keywords.test
deleted file mode 100644
index 4ac8f56afc5..00000000000
--- a/mysql-test/t/keywords.test
+++ /dev/null
@@ -1,261 +0,0 @@
-#
-# Test keywords as fields
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1 (time time, date date, timestamp timestamp,
-quarter int, week int, year int, timestampadd int, timestampdiff int);
-insert into t1 values ("12:22:22","97:02:03","1997-01-02",1,2,3,4,5);
-select * from t1;
-select t1.time+0,t1.date+0,t1.timestamp+0,concat(date," ",time),
- t1.quarter+t1.week, t1.year+timestampadd, timestampdiff from t1;
-drop table t1;
-create table events(binlog int);
-insert into events values(1);
-select events.binlog from events;
-drop table events;
-
-# End of 4.1 tests
-
-#
-# Bug#19939 "AUTHORS is not a keyword"
-#
-delimiter |;
-create procedure p1()
-begin
- declare n int default 2;
- authors: while n > 0 do
- set n = n -1;
- end while authors;
-end|
-create procedure p2()
-begin
- declare n int default 2;
- contributors: while n > 0 do
- set n = n -1;
- end while contributors;
-end|
-delimiter ;|
-drop procedure p1;
-drop procedure p2;
-
-# End of 5.1 tests
-
-#
-# Bug#12204 - CONNECTION should not be a reserved word
-#
-
-create table t1 (connection int, b int);
-delimiter |;
-create procedure p1()
-begin
- declare connection int;
- select max(t1.connection) into connection from t1;
- select concat("max=",connection) 'p1';
-end|
-delimiter ;|
-insert into t1 (connection) values (1);
-call p1();
-drop procedure p1;
-drop table t1;
-
-# End of 5.0 tests
-
-#
-# BUG#57899: Certain reserved words should not be reserved
-#
-
-#
-# We are looking for SYNTAX ERRORS here, so no need to
-# log the queries
-#
-
-CREATE TABLE slow (slow INT, general INT, master_heartbeat_period INT, ignore_server_ids INT);
-INSERT INTO slow(slow, general, master_heartbeat_period, ignore_server_ids) VALUES (1,2,3,4), (5,6,7,8);
-INSERT INTO slow(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7);
-INSERT INTO slow(slow, general) VALUES (1,2), (5,6);
-INSERT INTO slow(slow) VALUES (1), (5);
-SELECT slow, general, master_heartbeat_period, ignore_server_ids FROM slow ORDER BY slow;
-SELECT slow, general, master_heartbeat_period FROM slow ORDER BY slow;
-SELECT slow, master_heartbeat_period FROM slow ORDER BY slow;
-SELECT slow FROM slow ORDER BY slow;
-DROP TABLE slow;
-CREATE TABLE general (slow INT, general INT, master_heartbeat_period INT, ignore_server_ids INT);
-INSERT INTO general(slow, general, master_heartbeat_period, ignore_server_ids) VALUES (1,2,3,4), (5,6,7,8);
-INSERT INTO general(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7);
-INSERT INTO general(slow, general) VALUES (1,2), (5,6);
-INSERT INTO general(slow) VALUES (1), (5);
-SELECT slow, general, master_heartbeat_period, ignore_server_ids FROM general ORDER BY slow;
-SELECT slow, general, master_heartbeat_period FROM general ORDER BY slow;
-SELECT slow, master_heartbeat_period FROM general ORDER BY slow;
-SELECT slow FROM general ORDER BY slow;
-DROP TABLE general;
-CREATE TABLE master_heartbeat_period (slow INT, general INT, master_heartbeat_period INT, ignore_server_ids INT);
-INSERT INTO master_heartbeat_period(slow, general, master_heartbeat_period, ignore_server_ids) VALUES (1,2,3,4), (5,6,7,8);
-INSERT INTO master_heartbeat_period(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7);
-INSERT INTO master_heartbeat_period(slow, general) VALUES (1,2), (5,6);
-INSERT INTO master_heartbeat_period(slow) VALUES (1), (5);
-SELECT slow, general, master_heartbeat_period, ignore_server_ids FROM master_heartbeat_period ORDER BY slow;
-SELECT slow, general, master_heartbeat_period FROM master_heartbeat_period ORDER BY slow;
-SELECT slow, master_heartbeat_period FROM master_heartbeat_period ORDER BY slow;
-SELECT slow FROM master_heartbeat_period ORDER BY slow;
-DROP TABLE master_heartbeat_period;
-CREATE TABLE ignore_server_ids (slow INT, general INT, master_heartbeat_period INT, ignore_server_ids INT);
-INSERT INTO ignore_server_ids(slow, general, master_heartbeat_period, ignore_server_ids) VALUES (1,2,3,4), (5,6,7,8);
-INSERT INTO ignore_server_ids(slow, general, master_heartbeat_period) VALUES (1,2,3), (5,6,7);
-INSERT INTO ignore_server_ids(slow, general) VALUES (1,2), (5,6);
-INSERT INTO ignore_server_ids(slow) VALUES (1), (5);
-SELECT slow, general, master_heartbeat_period, ignore_server_ids FROM ignore_server_ids ORDER BY slow;
-SELECT slow, general, master_heartbeat_period FROM ignore_server_ids ORDER BY slow;
-SELECT slow, master_heartbeat_period FROM ignore_server_ids ORDER BY slow;
-SELECT slow FROM ignore_server_ids ORDER BY slow;
-DROP TABLE ignore_server_ids;
-
-CREATE TABLE t1 (slow INT, general INT, ignore_server_ids INT, master_heartbeat_period INT);
-INSERT INTO t1 VALUES (1,2,3,4);
-DELIMITER |;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE slow INT;
- DECLARE general INT;
- DECLARE ignore_server_ids INT;
- DECLARE master_heartbeat_period INT;
-
- SELECT max(t1.slow) INTO slow FROM t1;
- SELECT max(t1.general) INTO general FROM t1;
- SELECT max(t1.ignore_server_ids) INTO ignore_server_ids FROM t1;
- SELECT max(t1.master_heartbeat_period) INTO master_heartbeat_period FROM t1;
-
- SELECT slow, general, ignore_server_ids, master_heartbeat_period;
-END|
-
-CREATE PROCEDURE p2()
-BEGIN
-
- DECLARE n INT DEFAULT 2;
- general: WHILE n > 0 DO
- SET n = n -1;
- END WHILE general;
-
- SET n = 2;
- slow: WHILE n > 0 DO
- SET n = n -1;
- END WHILE slow;
-
- SET n = 2;
- ignore_server_ids: WHILE n > 0 DO
- SET n = n -1;
- END WHILE ignore_server_ids;
-
- SET n = 2;
- master_heartbeat_period: WHILE n > 0 DO
- SET n = n -1;
- END WHILE master_heartbeat_period;
-
-END|
-DELIMITER ;|
-CALL p1();
-call p2();
-DROP PROCEDURE p1;
-DROP PROCEDURE p2;
-DROP TABLE t1;
-
-#
-# OPTION is not anymore a keyword
-#
-
-create table option (option int not null);
-drop table option;
---error 1193
-set option=1;
---error ER_PARSE_ERROR
-set option option=1;
-
---echo #
---echo # MDEV-9979 Keywords UNBOUNDED, PRECEDING, FOLLOWING, TIES, OTHERS should be non-reserved
---echo #
-CREATE TABLE EXCLUDE (EXCLUDE INT);
-SELECT EXCLUDE FROM EXCLUDE;
-SELECT EXCLUDE EXCLUDE FROM EXCLUDE;
-SELECT EXCLUDE AS EXCLUDE FROM EXCLUDE;
-DROP TABLE EXCLUDE;
-
-CREATE TABLE UNBOUNDED (UNBOUNDED INT);
-SELECT UNBOUNDED FROM UNBOUNDED;
-SELECT UNBOUNDED UNBOUNDEX FROM UNBOUNDED;
-SELECT UNBOUNDED AS UNBOUNDEX FROM UNBOUNDED;
-DROP TABLE UNBOUNDED;
-
-CREATE TABLE PRECEDING (PRECEDING INT);
-SELECT PRECEDING FROM PRECEDING;
-SELECT PRECEDING PRECEDING FROM PRECEDING;
-SELECT PRECEDING AS PRECEDING FROM PRECEDING;
-DROP TABLE PRECEDING;
-
-CREATE TABLE FOLLOWING (FOLLOWING INT);
-SELECT FOLLOWING FROM FOLLOWING;
-SELECT FOLLOWING FOLLOWING FROM FOLLOWING;
-SELECT FOLLOWING AS FOLLOWING FROM FOLLOWING;
-DROP TABLE FOLLOWING;
-
-CREATE TABLE TIES (TIES INT);
-SELECT TIES FROM TIES;
-SELECT TIES TIES FROM TIES;
-SELECT TIES AS TIES FROM TIES;
-DROP TABLE TIES;
-
-CREATE TABLE OTHERS (OTHERS INT);
-SELECT OTHERS FROM OTHERS;
-SELECT OTHERS OTHERS FROM OTHERS;
-SELECT OTHERS AS OTHERS FROM OTHERS;
-DROP TABLE OTHERS;
-
-
---echo #
---echo # MDEV-10585 EXECUTE IMMEDIATE statement
---echo #
-
-CREATE TABLE immediate (immediate int);
-DROP TABLE immediate;
-
---echo #
---echo # MDEV-10142 Pluggable parser
---echo # Testing keywords that were added into lex.h for Oracle compatibility
---echo # that are not reserved keywords in MariaDB
---echo #
-
-CREATE TABLE clob (clob int);
-DROP TABLE clob;
-
-CREATE TABLE elsif (elsif INT);
-DROP TABLE elsif;
-
-CREATE TABLE exception (exception INT);
-DROP TABLE exception;
-
-CREATE TABLE raw (raw int);
-DROP TABLE raw;
-
-CREATE TABLE varchar2 (varchar2 int);
-DROP TABLE varchar2;
-
-CREATE TABLE decode (decode int);
-DROP TABLE decode;
-
-CREATE TABLE rowcount (rowcount int);
-DROP TABLE rowcount;
-
-CREATE TABLE isopen (isopen int);
-DROP TABLE isopen;
-
-CREATE TABLE notfound (notfound int);
-DROP TABLE notfound;
-
-CREATE TABLE raise (raise int);
-DROP TABLE raise;
-
-CREATE TABLE reuse (reuse int);
-DROP TABLE reuse;
diff --git a/mysql-test/t/kill-2-master.opt b/mysql-test/t/kill-2-master.opt
deleted file mode 100644
index ab6ca1731f5..00000000000
--- a/mysql-test/t/kill-2-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---skip-name-resolve
diff --git a/mysql-test/t/kill-2.test b/mysql-test/t/kill-2.test
deleted file mode 100644
index 0c1177722b4..00000000000
--- a/mysql-test/t/kill-2.test
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# Test KILL and KILL QUERY statements.
-#
-# Killing a connection in an embedded server does not work like in a normal
-# server, if it is waiting for a new statement. In an embedded server, the
-# connection does not read() from a socket, but returns control to the
-# application. 'mysqltest' does not handle the kill request.
-#
-
--- source include/not_embedded.inc
--- source include/not_threadpool.inc
-
---echo #
---echo # MDEV-6896 kill user command cause MariaDB crash!
---echo #
-
-create user foo@'127.0.0.1';
-
---connect (con1,127.0.0.1,foo,,)
-
---connection default
-select user from information_schema.processlist;
-kill user foo@'127.0.0.1';
-
-let $wait_condition=
- select count(*) = 0 from information_schema.processlist
- where user = "foo";
---source include/wait_condition.inc
-drop user foo@'127.0.0.1';
diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test
deleted file mode 100644
index b6000ffced1..00000000000
--- a/mysql-test/t/kill.test
+++ /dev/null
@@ -1,644 +0,0 @@
-#
-# Test KILL and KILL QUERY statements.
-#
-# Killing a connection in an embedded server does not work like in a normal
-# server, if it is waiting for a new statement. In an embedded server, the
-# connection does not read() from a socket, but returns control to the
-# application. 'mysqltest' does not handle the kill request.
-#
-
--- source include/not_embedded.inc
--- source include/have_debug_sync.inc
--- source include/not_threadpool.inc
-set local sql_mode="";
-set global sql_mode="";
-
---disable_warnings
-SET DEBUG_SYNC = 'RESET';
-DROP TABLE IF EXISTS t1, t2, t3;
-DROP FUNCTION IF EXISTS MY_KILL;
---enable_warnings
-
-delimiter |;
-# Helper function used to repeatedly kill a session.
-CREATE FUNCTION MY_KILL(tid INT) RETURNS INT
-BEGIN
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
- KILL tid;
- RETURN (SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE ID = tid);
-END|
-delimiter ;|
-
-connect (con1, localhost, root,,);
-connect (con2, localhost, root,,);
-
-# Save id of con1
-connection con1;
---disable_reconnect
-let $ID= `SELECT @id := CONNECTION_ID()`;
-connection con2;
-let $ignore= `SELECT @id := $ID`;
-connection con1;
-# Signal when this connection is terminating.
-SET DEBUG_SYNC= 'thread_end SIGNAL con1_end';
-# See if we can kill read().
-# Run into read() immediately after hitting 'before_do_command_net_read'.
-SET DEBUG_SYNC= 'before_do_command_net_read SIGNAL con1_read';
-
-# Kill con1
-connection con2;
-SET DEBUG_SYNC='now WAIT_FOR con1_read';
-# At this point we have no way to figure out, when con1 is blocked in
-# reading from the socket. Sending KILL to early would not terminate
-# con1. So we repeat KILL until con1 terminates.
-let $wait_condition= SELECT MY_KILL(@id);
---source include/wait_condition.inc
-# If KILL missed the read(), sync point wait will time out.
-SET DEBUG_SYNC= 'now WAIT_FOR con1_end';
-SET DEBUG_SYNC = 'RESET';
-
-connection con1;
---error 1053,2006,2013
-SELECT 1;
-
---enable_reconnect
-# this should work, and we should have a new connection_id()
-SELECT 1;
-let $ignore= `SELECT @id := $ID`;
-SELECT @id != CONNECTION_ID();
-
-#make sure the server is still alive
-connection con2;
-SELECT 4;
-connection default;
-
---error ER_SUBQUERIES_NOT_SUPPORTED
-KILL (SELECT COUNT(*) FROM mysql.user);
-
-connection con1;
-let $ID= `SELECT @id := CONNECTION_ID()`;
-connection con2;
-let $ignore= `SELECT @id := $ID`;
-connection con1;
-disable_reconnect;
-# Signal when this connection is terminating.
-SET DEBUG_SYNC= 'thread_end SIGNAL con1_end';
-# See if we can kill the sync point itself.
-# Wait in 'before_do_command_net_read' until killed.
-# It doesn't wait for a signal 'kill' but for to be killed.
-# The signal name doesn't matter here.
-SET DEBUG_SYNC= 'before_do_command_net_read SIGNAL con1_read WAIT_FOR kill';
-connection con2;
-SET DEBUG_SYNC= 'now WAIT_FOR con1_read';
-# Repeat KILL until con1 terminates.
-let $wait_condition= SELECT MY_KILL(@id);
---source include/wait_condition.inc
-SET DEBUG_SYNC= 'now WAIT_FOR con1_end';
-SET DEBUG_SYNC = 'RESET';
-
-connection con1;
---error 1053,2006,2013
-SELECT 1;
-enable_reconnect;
-SELECT 1;
-let $ignore= `SELECT @id := $ID`;
-SELECT @id != CONNECTION_ID();
-connection con2;
-SELECT 4;
-connection default;
-
-#
-# BUG#14851: killing long running subquery processed via a temporary table.
-#
-
-CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT);
-CREATE TABLE t2 (id INT UNSIGNED NOT NULL);
-
-INSERT INTO t1 VALUES
-(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0),
-(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0),
-(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0),
-(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0);
-INSERT t1 SELECT 0 FROM t1 AS a1, t1 AS a2 LIMIT 4032;
-
-INSERT INTO t2 SELECT id FROM t1;
-
-connection con1;
-let $ID= `SELECT @id := CONNECTION_ID()`;
-connection con2;
-let $ignore= `SELECT @id := $ID`;
-
-connection con1;
-SET DEBUG_SYNC= 'thread_end SIGNAL con1_end';
-SET DEBUG_SYNC= 'before_acos_function SIGNAL in_sync';
-# This is a very long running query. If this test start failing,
-# it may be necessary to change to an even longer query.
-send SELECT id FROM t1 WHERE id IN
- (SELECT DISTINCT a.id FROM t2 a, t2 b, t2 c, t2 d
- GROUP BY ACOS(1/a.id), b.id, c.id, d.id
- HAVING a.id BETWEEN 10 AND 20);
-
-connection con2;
-SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
-KILL @id;
-SET DEBUG_SYNC= 'now WAIT_FOR con1_end';
-
-connection con1;
---error 1317,1053,2006,2013
-reap;
-SELECT 1;
-
-connection default;
-SET DEBUG_SYNC = 'RESET';
-DROP TABLE t1, t2;
-
-#
-# Test of blocking of sending ERROR after OK or EOF
-#
-connection con1;
-let $ID= `SELECT @id := CONNECTION_ID()`;
-connection con2;
-let $ignore= `SELECT @id := $ID`;
-connection con1;
-SET DEBUG_SYNC= 'before_acos_function SIGNAL in_sync WAIT_FOR kill';
-send SELECT ACOS(0);
-connection con2;
-SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
-KILL QUERY @id;
-connection con1;
-reap;
-SELECT 1;
-SELECT @id = CONNECTION_ID();
-connection default;
-SET DEBUG_SYNC = 'RESET';
-
-#
-# Bug#27563: Stored functions and triggers wasn't throwing an error when killed.
-#
-CREATE TABLE t1 (f1 INT);
-delimiter |;
-CREATE FUNCTION bug27563() RETURNS INT(11)
-DETERMINISTIC
-BEGIN
- DECLARE CONTINUE HANDLER FOR SQLSTATE '70100' SET @a:= 'killed';
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception';
- SET DEBUG_SYNC= 'now SIGNAL in_sync WAIT_FOR kill';
- RETURN 1;
-END|
-delimiter ;|
-# Test stored functions
-# Test INSERT
-connection con1;
-let $ID= `SELECT @id := CONNECTION_ID()`;
-connection con2;
-let $ignore= `SELECT @id := $ID`;
-connection con1;
-send INSERT INTO t1 VALUES (bug27563());
-connection con2;
-SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
-KILL QUERY @id;
-connection con1;
---error 1317
-reap;
-SELECT * FROM t1;
-connection default;
-SET DEBUG_SYNC = 'RESET';
-
-# Test UPDATE
-INSERT INTO t1 VALUES(0);
-connection con1;
-send UPDATE t1 SET f1= bug27563();
-connection con2;
-SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
-KILL QUERY @id;
-connection con1;
---error 1317
-reap;
-SELECT * FROM t1;
-connection default;
-SET DEBUG_SYNC = 'RESET';
-
-# Test DELETE
-INSERT INTO t1 VALUES(1);
-connection con1;
-send DELETE FROM t1 WHERE bug27563() IS NULL;
-connection con2;
-SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
-KILL QUERY @id;
-connection con1;
---error 1317
-reap;
-SELECT * FROM t1;
-connection default;
-SET DEBUG_SYNC = 'RESET';
-
-# Test SELECT
-connection con1;
-send SELECT * FROM t1 WHERE f1= bug27563();
-connection con2;
-SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
-KILL QUERY @id;
-connection con1;
---error 1317
-reap;
-SELECT * FROM t1;
-connection default;
-SET DEBUG_SYNC = 'RESET';
-DROP FUNCTION bug27563;
-
-# Test TRIGGERS
-CREATE TABLE t2 (f2 INT);
-delimiter |;
-CREATE TRIGGER trg27563 BEFORE INSERT ON t1 FOR EACH ROW
-BEGIN
- DECLARE CONTINUE HANDLER FOR SQLSTATE '70100' SET @a:= 'killed';
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception';
- INSERT INTO t2 VALUES(0);
- SET DEBUG_SYNC= 'now SIGNAL in_sync WAIT_FOR kill';
- INSERT INTO t2 VALUES(1);
-END|
-delimiter ;|
-connection con1;
-send INSERT INTO t1 VALUES(2),(3);
-connection con2;
-SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
-KILL QUERY @id;
-connection con1;
---error 1317
-reap;
-SELECT * FROM t1;
-SELECT * FROM t2;
-connection default;
-SET DEBUG_SYNC = 'RESET';
-DROP TABLE t1, t2;
-
-#
-# Bug#28598: mysqld crash when killing a long-running explain query.
-#
-connection con1;
-let $ID= `SELECT @id := CONNECTION_ID()`;
-connection con2;
-let $ignore= `SELECT @id := $ID`;
-connection con1;
---disable_query_log
-let $tab_count= 40;
-
---disable_query_log
-begin;
-let $i= $tab_count;
-while ($i)
-{
- eval CREATE TABLE t$i (a$i INT, KEY(a$i));
- eval INSERT INTO t$i VALUES (1),(2),(3),(4),(5),(6),(7);
- dec $i ;
-}
-
-commit;
---enable_query_log
-
-SET SESSION optimizer_search_depth=0;
-
-let $i=$tab_count;
-while ($i)
-{
- let $a= a$i;
- let $t= t$i;
- dec $i;
- if ($i)
- {
- let $comma=,;
- let $from=$comma$t$from;
- let $where=a$i=$a $and $where;
- }
- if (!$i)
- {
- let $from=FROM $t$from;
- let $where=WHERE $where;
- }
- let $and=AND;
-}
-
---enable_query_log
-SET DEBUG_SYNC= 'before_join_optimize SIGNAL in_sync';
-eval PREPARE stmt FROM 'EXPLAIN SELECT * $from $where';
-send EXECUTE stmt;
-
-connection con2;
-SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
-KILL QUERY @id;
-connection con1;
---error 1317
-reap;
---disable_query_log
-let $i= $tab_count;
-while ($i)
-{
- eval DROP TABLE t$i;
- dec $i ;
-}
---enable_query_log
-connection default;
-SET DEBUG_SYNC = 'RESET';
-
---echo #
---echo # Bug#19723: kill of active connection yields different error code
---echo # depending on platform.
---echo #
-
---connection con1
-let $ID= `SELECT @id := CONNECTION_ID()`;
-SET DEBUG_SYNC= 'thread_end SIGNAL con1_end';
---disable_reconnect
---error ER_CONNECTION_KILLED
-KILL @id;
-
-connection con2;
-SET DEBUG_SYNC= 'now WAIT_FOR con1_end';
-connection con1;
---echo # ER_SERVER_SHUTDOWN, CR_SERVER_GONE_ERROR, CR_SERVER_LOST,
---echo # depending on the timing of close of the connection socket
---error 1053,2006,2013
-SELECT 1;
---enable_reconnect
-SELECT 1;
-let $ignore= `SELECT @id := $ID`;
-SELECT @id != CONNECTION_ID();
-connection default;
-SET DEBUG_SYNC = 'RESET';
-
---echo #
---echo # Additional test for WL#3726 "DDL locking for all metadata objects"
---echo # Check that DDL and DML statements waiting for metadata locks can
---echo # be killed. Note that we don't cover all situations here since it
---echo # can be tricky to write test case for some of them (e.g. REPAIR or
---echo # ALTER and other statements under LOCK TABLES).
---echo #
---disable_warnings
-drop tables if exists t1, t2, t3;
---enable_warnings
-
-create table t1 (i int primary key);
-connect (blocker, localhost, root, , );
-connect (dml, localhost, root, , );
-connect (ddl, localhost, root, , );
-
---echo # Test for RENAME TABLE
-connection blocker;
-lock table t1 read;
-connection ddl;
-let $ID= `select connection_id()`;
---send rename table t1 to t2
-connection default;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "rename table t1 to t2";
---source include/wait_condition.inc
---replace_result $ID ID
-eval kill query $ID;
-connection ddl;
---error ER_QUERY_INTERRUPTED
---reap
-
---echo # Test for DROP TABLE
---send drop table t1
-connection default;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "drop table t1";
---source include/wait_condition.inc
---replace_result $ID ID
-eval kill query $ID;
-connection ddl;
---error ER_QUERY_INTERRUPTED
---reap
-
---echo # Test for CREATE TRIGGER
---send create trigger t1_bi before insert on t1 for each row set @a:=1
-connection default;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "create trigger t1_bi before insert on t1 for each row set @a:=1";
---source include/wait_condition.inc
---replace_result $ID ID
-eval kill query $ID;
-connection ddl;
---error ER_QUERY_INTERRUPTED
---reap
-
---echo #
---echo # Tests for various kinds of ALTER TABLE
---echo #
---echo # Full-blown ALTER which should copy table
---send alter table t1 add column j int
-connection default;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "alter table t1 add column j int";
---source include/wait_condition.inc
---replace_result $ID ID
-eval kill query $ID;
-connection ddl;
---error ER_QUERY_INTERRUPTED
---reap
-
---echo # Two kinds of simple ALTER
---send alter table t1 rename to t2
-connection default;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "alter table t1 rename to t2";
---source include/wait_condition.inc
---replace_result $ID ID
-eval kill query $ID;
-connection ddl;
---error ER_QUERY_INTERRUPTED
---reap
---send alter table t1 disable keys
-connection default;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "alter table t1 disable keys";
---source include/wait_condition.inc
---replace_result $ID ID
-eval kill query $ID;
-connection ddl;
---error ER_QUERY_INTERRUPTED
---reap
---echo # Fast ALTER
---send alter table t1 alter column i set default 100
-connection default;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "alter table t1 alter column i set default 100";
---source include/wait_condition.inc
---replace_result $ID ID
-eval kill query $ID;
-connection ddl;
---error ER_QUERY_INTERRUPTED
---reap
---echo # Special case which is triggered only for MERGE tables.
-connection blocker;
-unlock tables;
-create table t2 (i int primary key) engine=merge union=(t1);
-lock tables t2 read;
-connection ddl;
---send alter table t2 alter column i set default 100
-connection default;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "alter table t2 alter column i set default 100";
---source include/wait_condition.inc
---replace_result $ID ID
-eval kill query $ID;
-connection ddl;
---error ER_QUERY_INTERRUPTED
---reap
-
---echo # Test for DML waiting for meta-data lock
-connection blocker;
-unlock tables;
-lock tables t1 read;
-connection ddl;
-# Let us add pending exclusive metadata lock on t2
---send truncate table t1
-connection dml;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "truncate table t1";
---source include/wait_condition.inc
-let $ID2= `select connection_id()`;
---send insert into t1 values (1)
-connection default;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "insert into t1 values (1)";
---source include/wait_condition.inc
---replace_result $ID2 ID2
-eval kill query $ID2;
-connection dml;
---error ER_QUERY_INTERRUPTED
---reap
-connection blocker;
-unlock tables;
-connection ddl;
---reap
-
---echo # Test for DML waiting for tables to be flushed
-connection blocker;
-lock tables t1 read;
-connection ddl;
---echo # Let us mark locked table t1 as old
---send flush tables
-connection dml;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table flush" and
- info = "flush tables";
---source include/wait_condition.inc
---send select * from t1
-connection default;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table flush" and
- info = "select * from t1";
---source include/wait_condition.inc
---replace_result $ID2 ID2
-eval kill query $ID2;
-connection dml;
---error ER_QUERY_INTERRUPTED
---reap
-connection blocker;
-unlock tables;
-connection ddl;
---reap
-
---echo # Cleanup.
-connection default;
-drop table t1;
-drop table t2;
-
-###########################################################################
-
---echo #
---echo # Test kill USER
---echo #
-grant ALL on test.* to test@localhost;
-grant ALL on test.* to test2@localhost;
-connect (con3, localhost, test,,);
-connect (con4, localhost, test2,,);
-connection default;
---enable_info
-kill hard query user test2@nohost;
-kill soft query user test@localhost;
-kill hard query user test@localhost;
-kill soft connection user test2;
-kill hard connection user test@localhost;
---disable_info
-revoke all privileges on test.* from test@localhost;
-revoke all privileges on test.* from test2@localhost;
-drop user test@localhost;
-drop user test2@localhost;
-
-connection con3;
---error 2013,2006
-select 1;
-connection con4;
---error 2013,2006
-select 1;
-connection default;
-
---echo #
---echo # MDEV-4911 - add KILL query id, and add query id information to
---echo # processlist
---echo #
-send SELECT SLEEP(1000);
-connection con1;
-let $wait_condition= SELECT @id:=QUERY_ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO='SELECT SLEEP(1000)';
-source include/wait_condition.inc;
-KILL QUERY ID @id;
-connection default;
-reap;
-
---error ER_NO_SUCH_QUERY
-KILL QUERY ID 0;
-
---echo #
---echo # MDEV-5096 - Wrong error message on attempt to kill somebody else's
---echo # query ID
---echo #
-CREATE USER u1@localhost;
-send SELECT SLEEP(1000);
-
-connection con1;
-let $wait_condition= SELECT @id:=QUERY_ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO='SELECT SLEEP(1000)';
-source include/wait_condition.inc;
-let $id= `SELECT @id`;
-
-connect(con5, localhost, u1,,);
---replace_result $id ID
---error ER_KILL_QUERY_DENIED_ERROR
-eval KILL QUERY ID $id;
-
-connection con1;
-KILL QUERY ID @id;
-
-connection default;
-reap;
-disconnect con5;
-DROP USER u1@localhost;
-
-
-SET DEBUG_SYNC = 'RESET';
-DROP FUNCTION MY_KILL;
-
-set global sql_mode=default;
diff --git a/mysql-test/t/kill_processlist-6619.test b/mysql-test/t/kill_processlist-6619.test
deleted file mode 100644
index d984924f9db..00000000000
--- a/mysql-test/t/kill_processlist-6619.test
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# MDEV-6619 SHOW PROCESSLIST returns empty result set after KILL QUERY
-#
---source include/not_embedded.inc
---source include/have_debug_sync.inc
-
---connect (con1,localhost,root,,)
---let $con_id = `SELECT CONNECTION_ID()`
---replace_column 1 # 3 # 6 # 7 #
-SHOW PROCESSLIST;
-SET DEBUG_SYNC='before_execute_sql_command SIGNAL ready WAIT_FOR go';
-send SHOW PROCESSLIST;
---connection default
-# We must wait for the SHOW PROCESSLIST query to have started before sending
-# the kill. Otherwise, the KILL may be lost since it is reset at the start of
-# query execution.
-SET DEBUG_SYNC='now WAIT_FOR ready';
---replace_result $con_id con_id
-eval KILL QUERY $con_id;
-SET DEBUG_SYNC='now SIGNAL go';
---connection con1
---error ER_QUERY_INTERRUPTED
-reap;
-SET DEBUG_SYNC='reset';
-
-# Wait until default connection has reset query string
-let $wait_condition=
- SELECT COUNT(*) = 1 from information_schema.processlist
- WHERE info is NULL;
---source include/wait_condition.inc
-
---replace_column 1 # 3 # 6 # 7 #
-SHOW PROCESSLIST;
diff --git a/mysql-test/t/kill_query-6728.test b/mysql-test/t/kill_query-6728.test
deleted file mode 100644
index a04c51a88dc..00000000000
--- a/mysql-test/t/kill_query-6728.test
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# MDEV-6728 KILL QUERY executed on an idle connection can interrupt the next query
-#
---connect (con1,localhost,root,,)
-let $id=`select connection_id()`;
-
---connection default
---replace_result $id id
-eval kill query $id;
-
---connection con1
-select count(*) > 0 from mysql.user;
-
diff --git a/mysql-test/t/last_value.test b/mysql-test/t/last_value.test
deleted file mode 100644
index 41cfdb5482d..00000000000
--- a/mysql-test/t/last_value.test
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# Tests for the LAST_VALUE function
-#
-
---disable_warnings
-drop table if exists t1;
-drop database if exists mysqltest;
---enable_warnings
-
-# CREATE TABLE `queue` (
-# `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
-# `priority` int(11) DEFAULT NULL,
-# `state` int(11) DEFAULT NULL,
-# `pid` int(10) unsigned DEFAULT NULL,
-# `dat` varbinary(200) DEFAULT NULL,
-# PRIMARY KEY (`id`)
-# )
-
-CREATE TABLE t1 (a INT, b INT, c INT, d INT);
-INSERT INTO t1 VALUES (1,3,0,NULL),(2,2,0,NULL),(3,4,0,NULL),(4,2,0,NULL);
-SELECT * FROM t1;
-UPDATE t1 SET c=LAST_VALUE(@last_a:=a,@last_b:=b,@last_c:=c,1), d=4211 WHERE c=0 ORDER BY b DESC LIMIT 1;
-SELECT @last_a, @last_b, @last_c;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-#
-# Test with different types
-#
-# PS protocol gives slightly different metadata for the length
---enable_metadata
---disable_ps_protocol
-SELECT LAST_VALUE(@last_a:=1,@last_b:=1);
-select @last_b;
---enable_ps_protocol
-SELECT LAST_VALUE(@last_a:=1,@last_b:=1.0);
-select @last_b;
-SELECT LAST_VALUE(@last_a:=1,@last_b:="hello");
-select @last_b;
-SELECT date(LAST_VALUE(@last_a:=1,@last_b:="2001-02-03"));
-select @last_b;
-SELECT LAST_VALUE(@last_a:=1,@last_b:="2001-02-03",NULL);
-select @last_b;
---disable_metadata
---error ER_PARSE_ERROR
-SELECT LAST_VALUE();
diff --git a/mysql-test/t/limit.test b/mysql-test/t/limit.test
deleted file mode 100644
index 4dbe13096d4..00000000000
--- a/mysql-test/t/limit.test
+++ /dev/null
@@ -1,117 +0,0 @@
-#
-# Test of update and delete with limit
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1 (a int not null default 0 primary key, b int not null default 0);
-insert into t1 () values (); # Testing default values
-insert into t1 values (1,1),(2,1),(3,1);
-update t1 set a=4 where b=1 limit 1;
-select * from t1;
-update t1 set b=2 where b=1 limit 2;
-select * from t1;
-update t1 set b=4 where b=1;
-select * from t1;
-delete from t1 where b=2 limit 1;
-select * from t1;
-delete from t1 limit 1;
-select * from t1;
-drop table t1;
-
-create table t1 (i int);
-insert into t1 (i) values(1),(1),(1);
-delete from t1 limit 1;
-update t1 set i=2 limit 1;
-delete from t1 limit 0;
-update t1 set i=3 limit 0;
-select * from t1;
-drop table t1;
-
-# LIMIT 0
-
-select 0 limit 0;
-
-#
-# Test with DELETE, ORDER BY and limit (bug #1024)
-#
-
-CREATE TABLE t1(id int auto_increment primary key, id2 int, index(id2));
-INSERT INTO t1 (id2) values (0),(0),(0);
-DELETE FROM t1 WHERE id=1;
-INSERT INTO t1 SET id2=0;
-SELECT * FROM t1;
-DELETE FROM t1 WHERE id2 = 0 ORDER BY id LIMIT 1;
-# should have deleted WHERE id=2
-SELECT * FROM t1;
-DELETE FROM t1 WHERE id2 = 0 ORDER BY id desc LIMIT 1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-#
-# Bug#8023 - limit on UNION with from DUAL, causes syntax error
-#
-create table t1 (a integer);
-insert into t1 values (1);
-# both queries must return one row
-select 1 as a from t1 union all select 1 from dual limit 1;
-(select 1 as a from t1) union all (select 1 from dual) limit 1;
-drop table t1;
-
-#
-# Bug #21787: COUNT(*) + ORDER BY + LIMIT returns wrong result
-#
-create table t1 (a int);
-insert into t1 values (1),(2),(3),(4),(5),(6),(7);
-explain select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
-select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
-explain select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
-select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
-drop table t1;
-# End of 4.1 tests
-
-#
-# Bug #28464: a string argument to 'limit ?' PS
-#
-
-prepare s from "select 1 limit ?";
-set @a='qwe';
-execute s using @a;
-set @a=-1;
---error ER_WRONG_ARGUMENTS
-execute s using @a;
-prepare s from "select 1 limit 1, ?";
---error ER_WRONG_ARGUMENTS
-execute s using @a;
-prepare s from "select 1 limit ?, ?";
---error ER_WRONG_ARGUMENTS
-execute s using @a, @a;
-set @a=14632475938453979136;
-execute s using @a, @a;
-set @a=-14632475938453979136;
---error ER_WRONG_ARGUMENTS
-execute s using @a, @a;
-
---echo End of 5.0 tests
-
-#
-# Bug#37075: offset of limit clause might be truncated to 0 on 32-bits server w/o big tables
-#
-
-select 1 as a limit 4294967296,10;
-
-#
-# Test for LIMIT X OFFSET Y
-#
-
-CREATE TABLE t1 (a int PRIMARY KEY auto_increment);
-INSERT INTO t1 VALUES (),(),(),(),(),(),(),(),(),();
-INSERT INTO t1 VALUES (),(),(),(),(),(),(),(),(),();
-SELECT a FROM t1 ORDER BY a LIMIT 10 OFFSET 1;
-SELECT a FROM t1 ORDER BY a LIMIT 10 OFFSET 10;
-SELECT a FROM t1 ORDER BY a LIMIT 2 OFFSET 14;
-DROP TABLE t1;
-
---echo End of 5.1 tests
diff --git a/mysql-test/t/limit_rows_examined.test b/mysql-test/t/limit_rows_examined.test
deleted file mode 100644
index 815394aec5c..00000000000
--- a/mysql-test/t/limit_rows_examined.test
+++ /dev/null
@@ -1,578 +0,0 @@
-#
-# Tests for LIMIT ROWS EXAMINED, MDEV-28
-#
-
-call mtr.add_suppression("Sort aborted.*");
-
-set @save_join_cache_level = @@join_cache_level;
-
-create table t1 (c1 char(2));
-create table t2 (c2 char(2));
-
-insert into t1 values ('bb'), ('cc'), ('aa'), ('dd');
-insert into t2 values ('bb'), ('cc'), ('dd'), ('ff');
-
-create table t1i (c1 char(2) key);
-create table t2i (c2 char(2) key);
-
-insert into t1i values ('bb'), ('cc'), ('aa'), ('dd');
-insert into t2i values ('bb'), ('cc'), ('dd'), ('ff');
-
---echo =========================================================================
---echo Simple joins
---echo =========================================================================
-
---echo Simple nested loops join without blocking
-set @@join_cache_level=0;
-explain
-select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 2;
-select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 2;
-
-explain
-select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 4;
-select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 4;
-
---echo Blocked nested loops join, empty result set because of blocking
-set @@join_cache_level=1;
-explain
-select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 6;
-select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 6;
-
-explain
-select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 6;
-select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 6;
-
-set @@join_cache_level=6;
-explain
-select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 3;
-select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 3;
-
-explain
-select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 6;
-select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 6;
-
---echo Mix LIMIT ROWS EXAMINED with LIMIT
-set @@join_cache_level=0;
-explain
-select * from t1, t2 where c1 < c2 LIMIT 1 ROWS EXAMINED 4;
-select * from t1, t2 where c1 < c2 LIMIT 1 ROWS EXAMINED 4;
-
-explain
-select * from t1, t2 where c1 < c2 LIMIT 1,1 ROWS EXAMINED 4;
-select * from t1, t2 where c1 < c2 LIMIT 1,1 ROWS EXAMINED 4;
-
---echo Empty table optimized away during constant optimization
-create table t0 (c0 int);
-explain
-select * from t0 LIMIT ROWS EXAMINED 0;
-explain
-select * from t0 LIMIT ROWS EXAMINED 1;
-select * from t0 LIMIT ROWS EXAMINED 1;
-drop table t0;
-
-create table t0 (c0 char(2) primary key);
-insert into t0 values ('bb'), ('cc'), ('aa');
-
-explain
-select * from t0 where c0 = 'bb' LIMIT ROWS EXAMINED 0;
-select * from t0 where c0 = 'bb' LIMIT ROWS EXAMINED 0;
-
-explain
-select * from t0, t1 where c0 = 'bb' and c1 > c0 LIMIT ROWS EXAMINED 0;
-select * from t0, t1 where c0 = 'bb' and c1 > c0 LIMIT ROWS EXAMINED 0;
-
-set @@join_cache_level = @save_join_cache_level;
-drop table t0;
-
---echo =========================================================================
---echo LIMIT ROWS EXAMINED with parameter argument
---echo =========================================================================
-
-set @@join_cache_level=0;
-set @l = 2;
-
---echo Prepared statement parameter
-
-prepare st1 from "select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED ?";
-execute st1 using @l;
-deallocate prepare st1;
-
---echo User variable (not supported for LIMIT in MariaDB 5.3/MySQL 5.1)
---error 1064
-select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED @l;
-
---echo Stored procedure parameter
-delimiter |;
-create procedure test_limit_rows(l int)
-begin
- select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED l;
-end|
-
-delimiter ;|
-
-call test_limit_rows(3);
-
-drop procedure test_limit_rows;
-
-set @@join_cache_level = @save_join_cache_level;
-
---echo =========================================================================
---echo UNIONs (with several LIMIT ROWS EXAMINED clauses)
---echo =========================================================================
-(select * from t1, t2 where c1 = c2)
-UNION
-(select * from t1, t2 where c1 < c2) LIMIT ROWS EXAMINED 6;
-
-(select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 0)
-UNION
-(select * from t1, t2 where c1 < c2 LIMIT ROWS EXAMINED 6);
-
---error ER_PARSE_ERROR
-select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 0
-UNION
-select * from t1, t2 where c1 < c2 LIMIT ROWS EXAMINED 6;
-
-(select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 0)
-UNION
-(select * from t1, t2 where c1 < c2 LIMIT ROWS EXAMINED 0)
-LIMIT ROWS EXAMINED 6;
-
-(select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 0)
-UNION
-(select * from t1, t2 where c1 < c2 LIMIT ROWS EXAMINED 0)
-LIMIT 1 ROWS EXAMINED 6;
-
-(select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 0)
-UNION
-(select * from t1, t2 where c1 < c2 LIMIT ROWS EXAMINED 0)
-LIMIT 2 ROWS EXAMINED 10;
-
-
---echo =========================================================================
---echo Subqueries (with several LIMIT ROWS EXAMINED clauses)
---echo =========================================================================
-
---echo Subqueries, semi-join
-explain
-select * from t1
-where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 11);
-select * from t1
-where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 11);
-
-explain
-select * from t1
-where c1 IN (select * from t2 where c2 > ' ')
-LIMIT ROWS EXAMINED 11;
-select * from t1
-where c1 IN (select * from t2 where c2 > ' ')
-LIMIT ROWS EXAMINED 11;
-
-explain
-select * from t1
-where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 0)
-LIMIT ROWS EXAMINED 11;
-select * from t1
-where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 0)
-LIMIT ROWS EXAMINED 11;
-
-explain
-select * from t1i
-where c1 IN (select * from t2i where c2 > ' ')
-LIMIT ROWS EXAMINED 6;
-select * from t1i
-where c1 IN (select * from t2i where c2 > ' ')
-LIMIT ROWS EXAMINED 6;
-
---echo Subqueries with IN-TO-EXISTS
-set @@optimizer_switch='semijoin=off,in_to_exists=on,materialization=off';
-
-explain
-select * from t1
-where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 4);
-select * from t1
-where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 4);
-
-explain
-select * from t1
-where c1 IN (select * from t2 where c2 > ' ')
-LIMIT ROWS EXAMINED 4;
-select * from t1
-where c1 IN (select * from t2 where c2 > ' ')
-LIMIT ROWS EXAMINED 4;
-
-explain
-select * from t1
-where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 0)
-LIMIT ROWS EXAMINED 4;
-select * from t1
-where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 0)
-LIMIT ROWS EXAMINED 4;
-
-explain
-select * from t1i
-where c1 IN (select * from t2i where c2 > ' ')
-LIMIT ROWS EXAMINED 9;
-select * from t1i
-where c1 IN (select * from t2i where c2 > ' ')
-LIMIT ROWS EXAMINED 9;
-
---echo Same as above, without subquery cache
-set @@optimizer_switch='subquery_cache=off';
-select * from t1
-where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 2);
-
-select * from t1
-where c1 IN (select * from t2 where c2 > ' ')
-LIMIT ROWS EXAMINED 2;
-
-select * from t1
-where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 0)
-LIMIT ROWS EXAMINED 2;
-
-select * from t1i
-where c1 IN (select * from t2i where c2 > ' ')
-LIMIT ROWS EXAMINED 5;
-
---echo Subqueries with materialization
-set @@optimizer_switch='semijoin=off,in_to_exists=off,materialization=on,subquery_cache=on';
-
-explain
-select * from t1
-where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 13);
-select * from t1
-where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 13);
-
-explain
-select * from t1
-where c1 IN (select * from t2 where c2 > ' ') LIMIT ROWS EXAMINED 13;
-select * from t1
-where c1 IN (select * from t2 where c2 > ' ') LIMIT ROWS EXAMINED 13;
-
-explain
-select * from t1
-where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 0)
-LIMIT ROWS EXAMINED 13;
-select * from t1
-where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 0)
-LIMIT ROWS EXAMINED 13;
-
-explain
-select * from t1i
-where c1 IN (select * from t2i where c2 > ' ') LIMIT ROWS EXAMINED 17;
-select * from t1i
-where c1 IN (select * from t2i where c2 > ' ') LIMIT ROWS EXAMINED 17;
-
-set @@optimizer_switch='default';
-
---echo =========================================================================
---echo Views and derived tables
---echo =========================================================================
-
---error 1235
-create view v1 as
-select * from t1 where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 13);
-
-create view v1 as
-select * from t1 where c1 IN (select * from t2 where c2 > ' ');
-
-select * from v1;
-select * from v1 LIMIT ROWS EXAMINED 17;
-select * from v1 LIMIT ROWS EXAMINED 16;
-select * from v1 LIMIT ROWS EXAMINED 11;
-
-drop view v1;
-
-explain
-select *
-from (select * from t1
- where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 0)) as tmp
-LIMIT ROWS EXAMINED 11;
-select *
-from (select * from t1
- where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 0)) as tmp
-LIMIT ROWS EXAMINED 11;
-
---echo =========================================================================
---echo Aggregation
---echo =========================================================================
-create table t3 (c1 char(2), c2 int);
-
-insert into t3 values
-('aa', 1), ('aa', 2),
-('bb', 3), ('bb', 4), ('bb', 5);
-
-explain
-select c1, sum(c2) from t3 group by c1;
-select c1, sum(c2) from t3 group by c1;
-
-explain
-select c1, sum(c2) from t3 group by c1 LIMIT ROWS EXAMINED 0;
-select c1, sum(c2) from t3 group by c1 LIMIT ROWS EXAMINED 0;
-select c1, sum(c2) from t3 group by c1 LIMIT ROWS EXAMINED 1;
-select c1, sum(c2) from t3 group by c1 LIMIT ROWS EXAMINED 20;
-select c1, sum(c2) from t3 group by c1 LIMIT ROWS EXAMINED 21;
-
-create table t3i (c1 char(2), c2 int);
-create index it3i on t3i(c1);
-create index it3j on t3i(c2,c1);
-
-insert into t3i values
-('aa', 1), ('aa', 2),
-('bb', 3), ('bb', 4), ('bb', 5);
-
-explain
-select c1, sum(c2) from t3i group by c1 LIMIT ROWS EXAMINED 0;
-select c1, sum(c2) from t3i group by c1 LIMIT ROWS EXAMINED 0;
-select c1, sum(c2) from t3i group by c1 LIMIT ROWS EXAMINED 1;
-select c1, sum(c2) from t3i group by c1 LIMIT ROWS EXAMINED 20;
-select c1, sum(c2) from t3i group by c1 LIMIT ROWS EXAMINED 21;
-
---echo Aggregation without grouping
-
-explain
-select min(c2) from t3 LIMIT ROWS EXAMINED 5;
-select min(c2) from t3 LIMIT ROWS EXAMINED 5;
-select max(c2) from t3 LIMIT ROWS EXAMINED 6;
-select max(c2) from t3 LIMIT ROWS EXAMINED 0;
-
-explain
-select max(c2) from t3 where c2 > 10 LIMIT ROWS EXAMINED 5;
-select max(c2) from t3 where c2 > 10 LIMIT ROWS EXAMINED 5;
-select max(c2) from t3 where c2 > 10 LIMIT ROWS EXAMINED 6;
-select max(c2) from t3 where c2 > 10 LIMIT ROWS EXAMINED 0;
-
-explain
-select count(c2) from t3 LIMIT ROWS EXAMINED 5;
-select count(c2) from t3 LIMIT ROWS EXAMINED 5;
-select count(c2) from t3 LIMIT ROWS EXAMINED 6;
-select count(c2) from t3 LIMIT ROWS EXAMINED 0;
-
-explain
-select count(c2) from t3 where c2 > 10 LIMIT ROWS EXAMINED 5;
-select count(c2) from t3 where c2 > 10 LIMIT ROWS EXAMINED 5;
-select count(c2) from t3 where c2 > 10 LIMIT ROWS EXAMINED 6;
-
-explain
-select sum(c2) from t3 LIMIT ROWS EXAMINED 5;
-select sum(c2) from t3 LIMIT ROWS EXAMINED 5;
-select sum(c2) from t3 LIMIT ROWS EXAMINED 6;
-
---echo The query result is found during optimization, LIMIT ROWS EXAMINED has no effect.
-explain
-select max(c1) from t3i LIMIT ROWS EXAMINED 0;
-select max(c1) from t3i LIMIT ROWS EXAMINED 0;
-
-create table t3_empty like t3;
-explain
-select max(c1) from t3_empty LIMIT ROWS EXAMINED 0;
-select max(c1) from t3_empty LIMIT ROWS EXAMINED 0;
-drop table t3_empty;
-
---echo =========================================================================
---echo Sorting
---echo =========================================================================
-
-explain
-select c1, c2 from t3 order by c2, c1 LIMIT ROWS EXAMINED 2;
---error 1028
-select c1, c2 from t3 order by c2, c1 LIMIT ROWS EXAMINED 2;
-
-explain
-select c1, c2 from t3i order by c2, c1 LIMIT ROWS EXAMINED 2;
-select c1, c2 from t3i order by c2, c1 LIMIT ROWS EXAMINED 2;
-
-explain
-select c1, c2 from t3i order by c2, c1 desc LIMIT ROWS EXAMINED 2;
---error 1028
-select c1, c2 from t3i order by c2, c1 desc LIMIT ROWS EXAMINED 2;
-
-drop table t3,t3i;
-
---echo =========================================================================
---echo INSERT/DELETE/UPDATE
---echo =========================================================================
-
---echo INSERT ... SELECT
-CREATE TABLE t4 (a int);
-INSERT INTO t4 values (1), (2);
-INSERT IGNORE INTO t4 SELECT a + 2 FROM t4 LIMIT ROWS EXAMINED 0;
-select * from t4;
-INSERT INTO t4 SELECT a + 2 FROM t4 LIMIT ROWS EXAMINED 6;
-select * from t4;
-drop table t4;
-
---echo DELETE - LIMIT ROWS EXAMINED not supported
-CREATE TABLE t4 (a int);
-INSERT INTO t4 values (1), (2);
---error 1064
-DELETE FROM t4 WHERE t4.a > 0 LIMIT ROWS EXAMINED 0;
---error 1064
-DELETE FROM t4 WHERE t4.a > 0 LIMIT 0 ROWS EXAMINED 0;
-drop table t4;
-
---echo UPDATE - LIMIT ROWS EXAMINED not supported
-CREATE TABLE t4 (a int);
-INSERT INTO t4 values (1), (2);
---error 1064
-update t4 set a=a+10 LIMIT ROWS EXAMINED 0;
---error 1064
-update t4 set a=a+10 LIMIT 0 ROWS EXAMINED 0;
-drop table t4;
-
-drop table t1,t2,t1i,t2i;
-
-
---echo =========================================================================
---echo Test cases for bugs
---echo =========================================================================
-
---echo
---echo MDEV-115
---echo
-
-SET @@optimizer_switch='in_to_exists=on,outer_join_with_cache=on';
-
-CREATE TABLE t1 ( a VARCHAR(3) ) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('USA'),('CAN');
-
-CREATE TABLE t2 ( b INT );
-INSERT INTO t2 VALUES (3899),(3914),(3888);
-
-CREATE TABLE t3 ( c VARCHAR(33), d INT );
-INSERT INTO t3 VALUES ('USASpanish',8),('USATagalog',0),('USAVietnamese',0);
-
-EXPLAIN
-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;
-
-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;
-
-EXPLAIN
-SELECT DISTINCT a FROM t1, t2 HAVING a > ' ' LIMIT ROWS EXAMINED 14;
-SELECT DISTINCT a FROM t1, t2 HAVING a > ' ' LIMIT ROWS EXAMINED 14;
-
-SELECT DISTINCT a FROM t1, t2 HAVING a > ' ' LIMIT ROWS EXAMINED 15;
-SELECT DISTINCT a FROM t1, t2 HAVING a > ' ' LIMIT ROWS EXAMINED 16;
-
-drop table t1,t2,t3;
-
-set @@optimizer_switch='default';
-
---echo
---echo MDEV-153
---echo
-
-CREATE TABLE t1 ( a TIME, b DATETIME, KEY(a), KEY(b) ) ENGINE=MyISAM;
-INSERT INTO t1 VALUES
- ('21:22:34.025509', '2002-02-13 17:30:06.013935'),
- ('10:50:38.059966', '2008-09-27 00:34:58.026613'),
- ('00:21:38.058143', '2007-05-28 00:00:00');
-
-CREATE TABLE t2 ( c INT, d TIME, e DATETIME, f VARCHAR(1), KEY(c) ) ENGINE=MyISAM;
-INSERT INTO t2 VALUES
- (0, '11:03:22.062907', '2007-06-02 11:16:01.053212', 'a'),
- (0, '08:14:05.001407', '1900-01-01 00:00:00', 'm'),
- (5, '19:03:16.024974', '1900-01-01 00:00:00', 'f'),
- (1, '07:23:34.034234', '2000-11-26 05:01:11.054228', 'z'),
- (6, '12:29:32.019411', '2006-02-13 00:00:00', 'f'),
- (6, '06:07:10.010496', '2007-06-08 04:35:26.020373', 'a'),
- (7, '22:55:09.020772', '2005-04-27 00:00:00', 'i');
-
-EXPLAIN
-SELECT a AS field1, alias2.d AS field2, alias2.f AS field3, alias2.e AS field4, b AS field5
-FROM t1, t2 AS alias2, t2 AS alias3
-WHERE alias3.c IN ( SELECT 1 UNION SELECT 6 )
-GROUP BY field1, field2, field3, field4, field5
-LIMIT ROWS EXAMINED 120;
-
-FLUSH STATUS;
-SELECT a AS field1, alias2.d AS field2, alias2.f AS field3, alias2.e AS field4, b AS field5
-FROM t1, t2 AS alias2, t2 AS alias3
-WHERE alias3.c IN ( SELECT 1 UNION SELECT 6 )
-GROUP BY field1, field2, field3, field4, field5
-LIMIT ROWS EXAMINED 120;
-SHOW STATUS LIKE 'Handler_read%';
-SHOW STATUS LIKE 'Handler_tmp%';
-
-FLUSH STATUS;
-SELECT a AS field1, alias2.d AS field2, alias2.f AS field3, alias2.e AS field4, b AS field5
-FROM t1, t2 AS alias2, t2 AS alias3
-WHERE alias3.c IN ( SELECT 1 UNION SELECT 6 )
-GROUP BY field1, field2, field3, field4, field5
-LIMIT ROWS EXAMINED 124;
-SHOW STATUS LIKE 'Handler_read%';
-SHOW STATUS LIKE 'Handler_tmp%';
-
-drop table t1, t2;
-
---echo
---echo MDEV-161 LIMIT_ROWS EXAMINED: query with the limit and NOT EXISTS, without GROUP BY or aggregate,
---echo returns rows, while the same query without the limit returns empty set
---echo
-
-CREATE TABLE t1 ( a INT, b INT );
-INSERT INTO t1 VALUES (3911,17),(3847,33),(3857,26);
-
-CREATE TABLE t2 ( c VARCHAR(16) );
-INSERT INTO t2 VALUES ('English'),('French'),('German');
-
-CREATE TABLE t3 ( d INT, e VARCHAR(32) );
-INSERT INTO t3 VALUES (3813,'United States'),(3814,'United States');
-
-SELECT * FROM t1 AS alias1, t2 AS alias2
-WHERE NOT EXISTS (
- SELECT * FROM t1 LEFT OUTER JOIN t3
- ON (d = a)
- WHERE b <= alias1.b OR e != alias2.c
-);
-
-SELECT * FROM t1 AS alias1, t2 AS alias2
-WHERE NOT EXISTS (
- SELECT * FROM t1 LEFT OUTER JOIN t3
- ON (d = a)
- WHERE b <= alias1.b OR e != alias2.c
-) LIMIT ROWS EXAMINED 20;
-
-drop table t1, t2, t3;
-
---echo
---echo MDEV-174: LIMIT ROWS EXAMINED: Assertion `0' failed in net_end_statement(THD*)
---echo with subquery in SELECT, constant table, aggregate function
---echo
-
-CREATE TABLE t1 ( a INT );
-CREATE TABLE t2 ( b INT, c INT, KEY(c) );
-INSERT INTO t2 VALUES
- (5, 0),(3, 4),(6, 1),
- (5, 8),(4, 9),(8, 1);
-
-SELECT (SELECT MAX(c) FROM t1, t2)
-FROM t2
-WHERE c = (SELECT MAX(b) FROM t2)
-LIMIT ROWS EXAMINED 3;
-
-drop table t1, t2;
-
---echo
---echo MDEV-178: LIMIT ROWS EXAMINED: Assertion `0' failed in net_end_statement(THD*) on the
---echo 2nd PS execution, with DISTINCT, FROM subquery or view in SELECT, JOIN in nested subquery
---echo
-
-CREATE TABLE t1 ( a INT );
-INSERT INTO t1 VALUES (2),(3),(150);
-CREATE TABLE t2 ( b INT );
-INSERT INTO t2 VALUES (2),(17),(3),(6);
-
-CREATE VIEW v AS
-SELECT DISTINCT * FROM t1 WHERE a > (SELECT COUNT(*) FROM t1, t2 WHERE a = b);
-
-PREPARE ps FROM 'SELECT * FROM v LIMIT ROWS EXAMINED 21';
-
-EXECUTE ps;
-EXECUTE ps;
-
-drop view v;
-drop table t1, t2;
diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test
deleted file mode 100644
index a283e64d473..00000000000
--- a/mysql-test/t/loaddata.test
+++ /dev/null
@@ -1,718 +0,0 @@
-#
-# Some simple test of load data
-#
-
--- source include/have_ucs2.inc
-
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-
-create table t1 (a date, b date, c date not null, d date);
-load data infile '../../std_data/loaddata1.dat' ignore into table t1 fields terminated by ',';
-load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
-SELECT * from t1;
-truncate table t1;
-
-load data infile '../../std_data/loaddata1.dat' ignore into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
-SELECT * from t1;
-drop table t1;
-
-create table t1 (a text, b text);
-load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
-select concat('|',a,'|'), concat('|',b,'|') from t1;
-drop table t1;
-
-create table t1 (a int, b char(10));
-load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
-select * from t1;
-truncate table t1;
-load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
-
-# The empty line last comes from the end line field in the file
-select * from t1;
-drop table t1;
-
-#
-# Bug #12053 LOAD DATA INFILE ignores NO_AUTO_VALUE_ON_ZERO setting
-#
-SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
-create table t1(id integer not null auto_increment primary key);
-insert into t1 values(0);
-disable_query_log;
-eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1' from t1;
-delete from t1;
-eval load data infile '$MYSQLTEST_VARDIR/tmp/t1' into table t1;
-enable_query_log;
-select * from t1;
-remove_file $MYSQLTEST_VARDIR/tmp/t1;
-
-disable_query_log;
-eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1'
-FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n'
-FROM t1;
-delete from t1;
-eval load data infile '$MYSQLTEST_VARDIR/tmp/t1' into table t1
-FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n';
-enable_query_log;
-select * from t1;
-remove_file $MYSQLTEST_VARDIR/tmp/t1;
-SET @@SQL_MODE=@OLD_SQL_MODE;
-drop table t1;
-
-#
-# Bug #11203: LOAD DATA does not accept same characters for ESCAPED and
-# ENCLOSED
-#
-create table t1 (a varchar(20), b varchar(20));
-load data infile '../../std_data/loaddata_dq.dat' into table t1 fields terminated by ',' enclosed by '"' escaped by '"' (a,b);
-select * from t1;
-drop table t1;
-
-#
-# Bug #29294 SELECT INTO OUTFILE/LOAD DATA INFILE with special
-# characters in the FIELDS ENCLOSED BY clause
-#
-
-CREATE TABLE t1 (
- id INT AUTO_INCREMENT PRIMARY KEY,
- c1 VARCHAR(255)
-);
-
-CREATE TABLE t2 (
- id INT,
- c2 VARCHAR(255)
-);
-
-INSERT INTO t1 (c1) VALUES
- ('r'), ('rr'), ('rrr'), ('rrrr'),
- ('.r'), ('.rr'), ('.rrr'), ('.rrrr'),
- ('r.'), ('rr.'), ('rrr.'), ('rrrr.'),
- ('.r.'), ('.rr.'), ('.rrr.'), ('.rrrr.');
-SELECT * FROM t1;
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY 'r' FROM t1;
-cat_file $MYSQLTEST_VARDIR/tmp/t1;
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/t1' INTO TABLE t2 FIELDS ENCLOSED BY 'r';
-SELECT t1.id, c1, c2 FROM t1 LEFT JOIN t2 ON t1.id=t2.id WHERE c1 != c2;
-SELECT t1.id, c1, c2 FROM t1 RIGHT JOIN t2 ON t1.id=t2.id WHERE c1 != c2;
-
-remove_file $MYSQLTEST_VARDIR/tmp/t1;
-DROP TABLE t1,t2;
-
-# End of 4.1 tests
-
-#
-# Let us test extended LOAD DATA features
-#
-create table t1 (a int default 100, b int, c varchar(60));
-# we can do something like this
-load data infile '../../std_data/rpl_loaddata.dat' into table t1 (a, @b) set b=@b+10, c=concat("b=",@b);
-select * from t1;
-truncate table t1;
-# we can use filled fields in expressions
-# we also assigning NULL value to field with non-NULL default here
-load data infile '../../std_data/rpl_loaddata.dat' into table t1 (a, @b) set c= if(a is null,"oops",a);
-select * from t1;
-truncate table t1;
-# we even can use variables in set clause, and missed columns will be set
-# with default values
-set @c:=123;
-load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@a, b) set c= if(@a is null,@c,b);
-select * from t1;
-# let us test side-effect of such load
-load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@a, @b);
-select * from t1;
-select @a, @b;
-truncate table t1;
-# Reading of all columns with set
-load data infile '../../std_data/rpl_loaddata.dat' ignore into table t1 set c=b;
-select * from t1;
-truncate table t1;
-# now going to test fixed field-row file format
-load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c="Wow";
-select * from t1;
-truncate table t1;
-# this also should work
-load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c=concat(a,"+",b,"+",@c,"+",b,"+",if(c is null,"NIL",c));
-select * from t1;
-# and this should bark
---error 1409
-load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, @b);
-
-# Now let us test LOAD DATA with subselect
-create table t2 (num int primary key, str varchar(10));
-insert into t2 values (10,'Ten'), (15,'Fifteen');
-truncate table t1;
-load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@dummy,@n) set a= @n, c= (select str from t2 where num=@n);
-select * from t1;
-
-#
-# Bug#18628 mysql-test-run: security problem
-#
-# It should not be possible to load from a file outside of vardir
-
---error 1238
-set @@secure_file_priv= 0;
-
-# Test "load data"
-truncate table t1;
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---error ER_OPTION_PREVENTS_STATEMENT, ER_TEXTFILE_NOT_READABLE
-eval load data infile '$MYSQL_TEST_DIR/t/loaddata.test' into table t1;
-select * from t1;
-
-# Test "load_file" returns NULL
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
-eval select load_file("$MYSQL_TEST_DIR/t/loaddata.test");
-
-# cleanup
-drop table t1, t2;
-
-#
-# Bug#27586: Wrong autoinc value assigned by LOAD DATA in the
-# NO_AUTO_VALUE_ON_ZERO mode
-#
-create table t1(f1 int);
-insert into t1 values(1),(null);
-create table t2(f2 int auto_increment primary key);
-disable_query_log;
-eval select * into outfile '$MYSQLTEST_VARDIR/tmp/t1' from t1;
-SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
-eval load data infile '$MYSQLTEST_VARDIR/tmp/t1' into table t2;
-enable_query_log;
-select * from t2;
-remove_file $MYSQLTEST_VARDIR/tmp/t1;
-SET @@SQL_MODE=@OLD_SQL_MODE;
-drop table t1,t2;
-
-#
-# Bug#27670: LOAD DATA does not set CURRENT_TIMESTAMP default value for a
-# TIMESTAMP field when no value has been provided.
-#
-create table t1(f1 int, f2 timestamp not null default current_timestamp);
-create table t2(f1 int);
-insert into t2 values(1),(2);
-disable_query_log;
-eval select * into outfile '$MYSQLTEST_VARDIR/tmp/t2' from t2;
-eval load data infile '$MYSQLTEST_VARDIR/tmp/t2' ignore into table t1;
-enable_query_log;
-select f1 from t1 where f2 <> '0000-00-00 00:00:00' order by f1;
-remove_file $MYSQLTEST_VARDIR/tmp/t2;
-delete from t1;
-disable_query_log;
-eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t2'
-FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n'
-FROM t2;
-eval load data infile '$MYSQLTEST_VARDIR/tmp/t2' ignore into table t1
-FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n';
-enable_query_log;
-select f1 from t1 where f2 <> '0000-00-00 00:00:00' order by f1;
-remove_file $MYSQLTEST_VARDIR/tmp/t2;
-drop table t1,t2;
-
-#
-# Bug#29442: SELECT INTO OUTFILE FIELDS ENCLOSED BY digit, minus sign etc
-# corrupts non-string fields containing this character.
-#
-
-CREATE TABLE t1 (c1 INT, c2 TIMESTAMP, c3 REAL, c4 DOUBLE);
-
-INSERT INTO t1 (c1, c2, c3, c4) VALUES (10, '1970-02-01 01:02:03', 1.1E-100, 1.1E+100);
-SELECT * FROM t1;
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY '-' FROM t1;
-cat_file $MYSQLTEST_VARDIR/tmp/t1;
-echo EOF;
-
-TRUNCATE t1;
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/t1' INTO TABLE t1 FIELDS ENCLOSED BY '-';
-SELECT * FROM t1;
-
-remove_file $MYSQLTEST_VARDIR/tmp/t1;
-DROP TABLE t1;
-
-###########################################################################
-
---echo
---echo # --
---echo # -- Bug#35469: server crash with LOAD DATA INFILE to a VIEW.
---echo # --
-
---echo
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP VIEW IF EXISTS v1;
-DROP VIEW IF EXISTS v2;
-DROP VIEW IF EXISTS v3;
---enable_warnings
-
---echo
-CREATE TABLE t1(c1 INT, c2 VARCHAR(255));
-
---echo
-CREATE VIEW v1 AS SELECT * FROM t1;
-CREATE VIEW v2 AS SELECT 1 + 2 AS c0, c1, c2 FROM t1;
-CREATE VIEW v3 AS SELECT 1 AS d1, 2 AS d2;
-
---echo
-LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v1
- FIELDS ESCAPED BY '\\'
- TERMINATED BY ','
- ENCLOSED BY '"'
- LINES TERMINATED BY '\n' (c1, c2);
-
---echo
-SELECT * FROM t1;
-
---echo
-SELECT * FROM v1;
-
---echo
-DELETE FROM t1;
-
---echo
-LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v2
- FIELDS ESCAPED BY '\\'
- TERMINATED BY ','
- ENCLOSED BY '"'
- LINES TERMINATED BY '\n' (c1, c2);
-
---echo
-SELECT * FROM t1;
-
---echo
-SELECT * FROM v2;
-
---echo
-DELETE FROM t1;
-
---echo
---error ER_NONUPDATEABLE_COLUMN
-LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v2
- FIELDS ESCAPED BY '\\'
- TERMINATED BY ','
- ENCLOSED BY '"'
- LINES TERMINATED BY '\n' (c0, c2);
-
---echo
---error ER_NON_UPDATABLE_TABLE
-LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v3
- FIELDS ESCAPED BY '\\'
- TERMINATED BY ','
- ENCLOSED BY '"'
- LINES TERMINATED BY '\n' (d1, d2);
-
---echo
-DROP TABLE t1;
-DROP VIEW v1;
-DROP VIEW v2;
-DROP VIEW v3;
-
---echo
---echo # -- End of Bug#35469.
-
-
-
-###########################################################################
-
-#
-# Bug#37114: sql_mode NO_BACKSLASH_ESCAPES does not work properly with
-# LOAD DATA INFILE
-#
-
-# - For each plain "SELECT id,...", the 1st pair ("before" SELECT...OUTFILE,
-# LOAD...INFILE) and the 2nd pair of lines ("after") in the result should
-# look the same, otherwise we broke the dumpe/restore cycle!
-#
-# - the \r is always { '\\', 'r' } in memory, but on-disk format changes
-#
-# - the \t is { '\t' } or { '\\', 't' } in memory depending on whether \
-# is magic (that is, NO_BACKSLASH_ESCAPES is not set) at INSERT-time.
-# on-disk format varies.
-#
-# - while INFILE/OUTFILE behaviour changes according to NO_BACKSLASH_ESCAPES,
-# we can override these defaults using ESCAPED BY '...'
-# 1: NO_BACKSLASH_ESCAPES default, \ on-disk: \,t,x,\r
-# 2: NO_BACKSLASH_ESCAPES override, \\ on-disk: \,\,t,x,\,\,r
-# 3: !NO_BACKSLASH_ESCAPES default, \\ on-disk: tab,\,\,r
-# 3: !NO_BACKSLASH_ESCAPES override, \ on-disk: tab,\,r
-
---echo Bug#37114
-
-SET SESSION character_set_client=latin1;
-SET SESSION character_set_server=latin1;
-SET SESSION character_set_connection=latin1;
-SET @OLD_SQL_MODE=@@SESSION.SQL_MODE;
-
-# 0. test LOAD DATA INFILE first; if that works, all issues in
-# SELECT INTO OUTFILE / LOAD DATA INFILE cycles below are
-# arguably in the saving.
-
---echo test LOAD DATA INFILE
-
---let $file=$MYSQLTEST_VARDIR/tmp/bug37114.txt
---let $file2=$MYSQLTEST_VARDIR/tmp/bug37114_out.txt
-
-SET sql_mode = '';
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT '1 \\\\aa\n' INTO DUMPFILE '$file'
-
-CREATE TABLE t1 (id INT, val1 CHAR(3)) ENGINE=MyISAM;
-
-SET sql_mode = 'NO_BACKSLASH_ESCAPES';
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval LOAD DATA INFILE '$file' REPLACE INTO TABLE t1 FIELDS TERMINATED BY ' '
-SELECT * FROM t1;
-
-# show we can write this with OUTFILE, forcing the parameters for now
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT * INTO OUTFILE '$file2' FIELDS ESCAPED BY '' TERMINATED BY ' ' FROM t1
---diff_files $file $file2
---remove_file $file2
-
-# now show the OUTFILE defaults are correct with NO_BACKSLASH_ESCAPES
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT * INTO OUTFILE '$file2' FIELDS TERMINATED BY ' ' FROM t1
---diff_files $file $file2
---remove_file $file2
-
-INSERT INTO t1 (id, val1) VALUES (1, '\aa');
-SELECT * FROM t1;
-
-SET sql_mode='';
-INSERT INTO t1 (id, val1) VALUES (1, '\aa');
-SELECT * FROM t1;
-
-DROP TABLE t1;
-
---remove_file $file
-
-
-
---echo test SELECT INTO OUTFILE
-
-CREATE TABLE t1 (id INT PRIMARY KEY, val1 CHAR(4));
-CREATE TABLE t2 LIKE t1;
-
-# 1. with NO_BACKSLASH_ESCAPES on
-
-SET sql_mode = '';
-INSERT INTO t1 (id, val1) VALUES (5, '\ttab');
-INSERT INTO t1 (id, val1) VALUES (4, '\\r');
-SET sql_mode = 'NO_BACKSLASH_ESCAPES';
-INSERT INTO t1 (id, val1) VALUES (3, '\tx');
-
---echo 1.1 NO_BACKSLASH_ESCAPES, use defaults for ESCAPED BY
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT * INTO OUTFILE '$file' FIELDS TERMINATED BY ' ' FROM t1 ORDER BY id
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval LOAD DATA INFILE '$file' INTO TABLE t2 FIELDS TERMINATED BY ' '
-
-SELECT 'before' AS t, id, val1, hex(val1) FROM t1 UNION
- SELECT 'after' AS t, id, val1, hex(val1) FROM t2 ORDER BY id,t DESC;
-
-TRUNCATE t2;
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval SELECT LOAD_FILE("$file");
---remove_file $file
-
-
-
---echo 1.2 NO_BACKSLASH_ESCAPES, override defaults for ESCAPED BY
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT * INTO OUTFILE '$file' FIELDS ESCAPED BY '\' TERMINATED BY ' ' FROM t1 ORDER BY id
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval LOAD DATA INFILE '$file' INTO TABLE t2 FIELDS ESCAPED BY '\' TERMINATED BY ' '
-
-SELECT 'before' AS t, id, val1, hex(val1) FROM t1 UNION
- SELECT 'after' AS t, id, val1, hex(val1) FROM t2 ORDER BY id,t DESC;
-
-TRUNCATE t2;
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval SELECT LOAD_FILE("$file");
---remove_file $file
-
-
-
-# 2. with NO_BACKSLASH_ESCAPES off
-
-SET sql_mode = '';
-
---echo 2.1 !NO_BACKSLASH_ESCAPES, use defaults for ESCAPED BY
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT * INTO OUTFILE '$file' FIELDS TERMINATED BY ' ' FROM t1 ORDER BY id
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval LOAD DATA INFILE '$file' INTO TABLE t2 FIELDS TERMINATED BY ' '
-
-SELECT 'before' AS t, id, val1, hex(val1) FROM t1 UNION
- SELECT 'after' AS t, id, val1, hex(val1) FROM t2 ORDER BY id,t DESC;
-
-TRUNCATE t2;
-
-SET sql_mode = 'NO_BACKSLASH_ESCAPES';
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval SELECT LOAD_FILE("$file");
---remove_file $file
-
-SET sql_mode = '';
-
-
-
---echo 2.2 !NO_BACKSLASH_ESCAPES, override defaults for ESCAPED BY
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT * INTO OUTFILE '$file' FIELDS ESCAPED BY '' TERMINATED BY ' ' FROM t1 ORDER BY id
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval LOAD DATA INFILE '$file' INTO TABLE t2 FIELDS ESCAPED BY '' TERMINATED BY ' '
-
-SELECT 'before' AS t, id, val1, hex(val1) FROM t1 UNION
- SELECT 'after' AS t, id, val1, hex(val1) FROM t2 ORDER BY id,t DESC;
-
-TRUNCATE t2;
-
-SET sql_mode = 'NO_BACKSLASH_ESCAPES';
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval SELECT LOAD_FILE("$file");
---remove_file $file
-
-# clean up
-set session sql_mode=@OLD_SQL_MODE;
-DROP TABLE t1,t2;
-
-
---echo #
---echo # Bug #51893: crash with certain characters given to load_file
---echo # function on windows
---echo #
-
-select load_file(0x0A9FB76C661B409C4BEC88098C5DD71B1072F9691F2E827D7EC8F092B299868A3CE196C04F0FB18CAB4E1557EB72331D812379DE7A75CA21C32E7C722C59E5CC33EF262EF04187B0F0EE756FA984DF2EAD37B1E4ADB064C3C5038F2E3B2D661B1C1150AAEB5425512E14D7506166D92D4533872E662F4B2D1428AAB5CCA72E75AA2EF325E196A5A02E2E8278873C64375845994B0F39BE2FF7B478332A7B0AA5E48877C47B6F513E997848AF8CCB8A899F3393AB35333CF0871E36698193862D486B4B9078B70C0A0A507B8A250F3F876F5A067632D5E65193E4445A1EC3A2C9B4C6F07AC334F0F62BC33357CB502E9B1C19D2398B6972AEC2EF21630F8C9134C4F7DD662D8AD7BDC9E19C46720F334B66C22D4BF32ED275144E20E7669FFCF6FC143667C9F02A577F32960FA9F2371BE1FA90E49CBC69C01531F140556854D588DD0E55E1307D78CA38E975CD999F9AEA604266329EE62BFB5ADDA67F549E211ECFBA906C60063696352ABB82AA782D25B17E872EA587871F450446DB1BAE0123D20404A8F2D2698B371002E986C8FCB969A99FF0E150A2709E2ED7633D02ADA87D5B3C9487D27B2BD9D21E2EC3215DCC3CDCD884371281B95A2E9987AAF82EB499C058D9C3E7DC1B66635F60DB121C72F929622DD47B6B2E69F59FF2AE6B63CC2EC60FFBA20EA50569DBAB5DAEFAEB4F03966C9637AB55662EDD28439155A82D053A5299448EDB2E7BEB0F62889E2F84E6C7F34B3212C9AAC32D521D5AB8480993F1906D5450FAB342A0FA6ED223E178BAC036B81E15783604C32A961EA1EF20BE2EBB93D34ED37BC03142B7583303E4557E48551E4BD7CBDDEA146D5485A5D212C35189F0BD6497E66912D2780A59A53B532E12C0A5ED1EC0445D96E8F2DD825221CFE4A65A87AA21DC8750481B9849DD81694C3357A0ED9B78D608D8EDDE28FAFBEC17844DE5709F41E121838DB55639D77E32A259A416D7013B2EB1259FDE1B498CBB9CAEE1D601DF3C915EA91C69B44E6B72062F5F4B3C73F06F2D5AD185E1692E2E0A01E7DD5133693681C52EE13B2BE42D03BDCF48E4E133CF06662339B778E1C3034F9939A433E157449172F7969ACCE1F5D2F65A4E09E4A5D5611EBEDDDBDB0C0C0A);
-
-
---echo End of 5.0 tests
-
-
-
-#
-# Bug#12448 LOAD DATA / SELECT INTO OUTFILE
-# doesn't work with multibyte path name
-#
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (1);
-SET NAMES latin1;
-SET character_set_filesystem=filename;
-select @@character_set_filesystem;
-SELECT * INTO OUTFILE 't-1' FROM t1;
-DELETE FROM t1;
-LOAD DATA INFILE 't-1' INTO TABLE t1;
-SELECT * FROM t1;
-DELETE FROM t1;
-SET character_set_filesystem=latin1;
-select @@character_set_filesystem;
-LOAD DATA INFILE 't@002d1' INTO TABLE t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-let $MYSQLD_DATADIR= `select @@datadir`;
-remove_file $MYSQLD_DATADIR/test/t@002d1;
-SET character_set_filesystem=default;
-select @@character_set_filesystem;
-
-
---echo #
---echo # Bug #51850: crash/memory overlap when using load data infile and set
---echo # col equal to itself!
---echo #
-
-CREATE TABLE t1(col0 LONGBLOB);
-SELECT 'test' INTO OUTFILE 't1.txt';
-LOAD DATA INFILE 't1.txt' IGNORE INTO TABLE t1 SET col0=col0;
-SELECT * FROM t1;
-
-DROP TABLE t1;
-let $MYSQLD_DATADIR= `select @@datadir`;
-remove_file $MYSQLD_DATADIR/test/t1.txt;
-
-
---echo #
---echo # Bug #52512 : Assertion `! is_set()' in
---echo # Diagnostics_area::set_ok_status on LOAD DATA
---echo #
-
-connect (con1,localhost,root,,test);
-
-CREATE TABLE t1 (id INT NOT NULL);
---send LOAD DATA LOCAL INFILE 'tb.txt' INTO TABLE t1
-# please keep this is a spearate test file : it's important to have no
-# commands after this one
-
-connection default;
-dirty_close con1;
-
-connect (con1,localhost,root,,test);
-DROP TABLE t1;
-connection default;
-disconnect con1;
-
-#############################################################################
-# The below protion is moved to ctype_ucs.test #
-#############################################################################
-#--echo #
-#--echo # Bug #51876 : crash/memory underrun when loading data with ucs2
-#--echo # and reverse() function
-#--echo #
-
-#--echo # Problem # 1 (original report): wrong parsing of ucs2 data
-#SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
-#CREATE TABLE t1(a INT);
-#LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
-#(@b) SET a=REVERSE(@b);
-#--echo # should return 2 zeroes (as the value is truncated)
-#SELECT * FROM t1;
-
-#DROP TABLE t1;
-#let $MYSQLD_DATADIR= `select @@datadir`;
-#remove_file $MYSQLD_DATADIR/test/tmpp.txt;
-
-
-#--echo # Problem # 2 : if you write and read ucs2 data to a file they're lost
-#SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
-#CREATE TABLE t1(a INT);
-#LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
-#(@b) SET a=REVERSE(@b);
-#--echo # should return 0 and 1 (10 reversed)
-#SELECT * FROM t1;
-
-#DROP TABLE t1;
-#let $MYSQLD_DATADIR= `select @@datadir`;
-#remove_file $MYSQLD_DATADIR/test/tmpp2.txt;
-######################################################################################
-
-
---echo #
---echo # Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U
---echo #
-
-CREATE TABLE t1(f1 INT);
-EVAL SELECT 0xE1BB30 INTO OUTFILE 't1.dat';
---disable_warnings
-LOAD DATA INFILE 't1.dat' IGNORE INTO TABLE t1 CHARACTER SET utf8;
---enable_warnings
-
-DROP TABLE t1;
-let $MYSQLD_DATADIR= `select @@datadir`;
-remove_file $MYSQLD_DATADIR/test/t1.dat;
-
---echo #
---echo # Bug#11765141 - 58072: LOAD DATA INFILE: LEAKS IO CACHE MEMORY
---echo # WHEN ERROR OCCURS
---echo #
-
---let $file=$MYSQLTEST_VARDIR/tmp/bug11735141.txt
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT '1\n' INTO DUMPFILE '$file'
-
-create table t1(a point);
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---error ER_CANT_CREATE_GEOMETRY_OBJECT
---eval LOAD DATA INFILE '$file' INTO TABLE t1
-drop table t1;
-
---echo End of 5.1 tests
-
---echo #
---echo # Bug#11759519 INFINITE HANG WITH 100% CPU USAGE WITH LOAD DATA LOCAL AND IMPORT ERRORS
---echo #
-SET @old_mode= @@sql_mode;
-CREATE TABLE t1 (fld1 INT);
---copy_file $EXE_MYSQL $MYSQLTEST_VARDIR/mysql
-
-SET sql_mode='strict_all_tables';
-
---echo # Without fix, load data hangs forever.
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,1000
-eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/mysql' REPLACE INTO TABLE t1
- FIELDS TERMINATED BY 't' LINES TERMINATED BY '';
-
-SET @@sql_mode= @old_mode;
-
---remove_file $MYSQLTEST_VARDIR/mysql
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-11079 Regression: LOAD DATA INFILE lost BLOB support using utf8 load files
---echo #
-
-CREATE TABLE t1 (a mediumblob NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
-LOAD DATA INFILE '../../std_data/loaddata/mdev-11079.txt' INTO TABLE t1 CHARSET utf8 FIELDS TERMINATED BY ';' ENCLOSED BY '"' ESCAPED BY '\\' LINES TERMINATED BY '\n';
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-11631 LOAD DATA INFILE fails to load data with an escape character followed by a multi-byte character
---echo #
-
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8);
-LOAD DATA INFILE '../../std_data/loaddata/mdev-11631.txt' INTO TABLE t1 CHARACTER SET utf8;
-SELECT HEX(a) FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-15497 Wrong empty value in a GEOMETRY column on LOAD DATA
---echo #
-
-SET sql_mode='';
-
-CREATE TABLE t1 (a CHAR(1), b CHAR(1) NOT NULL);
-LOAD DATA INFILE '../../std_data/loaddata/mdev-15497.txt' INTO TABLE t1;
-SELECT * FROM t1;
-TRUNCATE TABLE t1;
-LOAD DATA INFILE '../../std_data/loaddata/mdev-15497.txt' INTO TABLE t1 FIELDS TERMINATED BY '';
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
-CREATE TABLE t1 (a CHAR(1), b CHAR(1));
-LOAD DATA INFILE '../../std_data/loaddata/mdev-15497.txt' INTO TABLE t1;
-SELECT * FROM t1;
-TRUNCATE TABLE t1;
-LOAD DATA INFILE '../../std_data/loaddata/mdev-15497.txt' INTO TABLE t1 FIELDS TERMINATED BY '';
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-15597 Add class Load_data_outvar and avoid using Item::STRING_ITEM for Item_user_var_as_out_param detection
---echo #
-
-SET sql_mode=NO_AUTO_VALUE_ON_ZERO;
-CREATE TABLE t1 (id integer not null auto_increment primary key);
-LOAD DATA INFILE '../../std_data/loaddata/nl.txt' INTO TABLE t1 FIELDS TERMINATED BY '';
-SELECT * FROM t1;
-DROP TABLE t1;
-
-SET sql_mode='';
-CREATE TABLE t1 (id integer not null auto_increment primary key);
-LOAD DATA INFILE '../../std_data/loaddata/nl.txt' INTO TABLE t1 FIELDS TERMINATED BY '';
-SELECT * FROM t1;
-DROP TABLE t1;
diff --git a/mysql-test/t/loaddata_autocom_innodb.test b/mysql-test/t/loaddata_autocom_innodb.test
deleted file mode 100644
index d7f152cb286..00000000000
--- a/mysql-test/t/loaddata_autocom_innodb.test
+++ /dev/null
@@ -1,4 +0,0 @@
---source include/have_innodb.inc
-let $engine_type= InnoDB;
-
---source include/loaddata_autocom.inc
diff --git a/mysql-test/t/loadxml.test b/mysql-test/t/loadxml.test
deleted file mode 100644
index 623deea6ec6..00000000000
--- a/mysql-test/t/loadxml.test
+++ /dev/null
@@ -1,164 +0,0 @@
-#
-# Tests for "LOAD XML" - a contributed patch from Erik Wetterberg.
-#
-
-# Running the $MYSQL_DUMP tool against an embedded server does not work.
---source include/not_embedded.inc
-
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-
-create table t1 (a int, b varchar(64));
-
-
---echo -- Load a static XML file
-load xml infile '../../std_data/loadxml.dat' into table t1
-rows identified by '<row>';
-select * from t1 order by a;
-delete from t1;
-
-
---echo -- Load a static XML file with 'IGNORE num ROWS'
-load xml infile '../../std_data/loadxml.dat' into table t1
-rows identified by '<row>' ignore 4 rows;
-select * from t1 order by a;
-
-
---echo -- Check 'mysqldump --xml' + 'LOAD XML' round trip
---exec $MYSQL_DUMP --xml test t1 > "$MYSQLTEST_VARDIR/tmp/loadxml-dump.xml" 2>&1
-delete from t1;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval load xml infile '$MYSQLTEST_VARDIR/tmp/loadxml-dump.xml' into table t1 rows identified by '<row>';
-select * from t1 order by a;
-
---echo --Check that default row tag is '<row>
-delete from t1;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval load xml infile '$MYSQLTEST_VARDIR/tmp/loadxml-dump.xml' into table t1;
-select * from t1 order by a;
-
---echo -- Check that 'xml' is not a keyword
-select 1 as xml;
-
-
-#
-# Bug #42520 killing load .. infile Assertion failed: ! is_set(), file .\sql_error.cc, line 8
-#
-
---disable_query_log
-delete from t1;
-insert into t1 values (1, '12345678900987654321'), (2, 'asdfghjkl;asdfghjkl;');
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
---exec $MYSQL_DUMP --xml test t1 > "$MYSQLTEST_VARDIR/tmp/loadxml-dump.xml" 2>&1
---enable_query_log
-
-connect (addconroot, localhost, root,,);
-connection addconroot;
-create table t2(fl text);
---let $PSEUDO_THREAD_ID=`select @@pseudo_thread_id `
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---send_eval LOAD XML LOCAL INFILE "$MYSQLTEST_VARDIR/tmp/loadxml-dump.xml" INTO TABLE t2 ROWS IDENTIFIED BY '<person>';
-
-sleep 3;
-
-
-connection default;
-
---disable_query_log
---eval kill $PSEUDO_THREAD_ID
-connection addconroot;
-# Read response from connection to avoid packets out-of-order when disconnecting
-# Note, that connection can already be dead due to previously issued kill
---error 0,2013
---reap
-disconnect addconroot;
-connection default;
---enable_query_log
-#
-# Clean up
-#
-remove_file $MYSQLTEST_VARDIR/tmp/loadxml-dump.xml;
-drop table t1;
-drop table t2;
-
-#
-# Bug #36750 LOAD XML doesn't understand new line (feed) characters in multi line text fields
-#
-
-create table t1 (
- id int(11) not null,
- text text,
- primary key (id)
-) engine=MyISAM default charset=latin1;
-load xml infile '../../std_data/loadxml2.dat' into table t1;
-select * from t1;
-drop table t1;
-
---echo #
---echo # Bug#51571 load xml infile causes server crash
---echo #
-CREATE TABLE t1 (a text, b text);
-LOAD XML INFILE '../../std_data/loadxml.dat' INTO TABLE t1
-ROWS IDENTIFIED BY '<row>' (a,@b) SET b=concat('!',@b);
-SELECT * FROM t1 ORDER BY a;
-DROP TABLE t1;
-
-
---echo #
---echo # Bug#16171518 LOAD XML DOES NOT HANDLE EMPTY ELEMENTS
---echo #
-CREATE TABLE t1 (col1 VARCHAR(3), col2 VARCHAR(3), col3 VARCHAR(3), col4 VARCHAR(4));
-LOAD XML INFILE '../../std_data/bug16171518_1.dat' INTO TABLE t1;
-SELECT * FROM t1 ORDER BY col1, col2, col3, col4;
-DROP TABLE t1;
-
-CREATE TABLE t1 (col1 VARCHAR(3), col2 VARCHAR(3), col3 INTEGER);
-LOAD XML INFILE '../../std_data/bug16171518_2.dat' INTO TABLE t1;
-SELECT * FROM t1 ORDER BY col1, col2, col3;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-12696 Crash with LOAD XML and non-updatable VIEW column
---echo #
-
-CREATE TABLE t1 (c1 TEXT);
-CREATE VIEW v1 AS SELECT CONCAT(c1,'') AS c1, NULL AS c2 FROM t1;
---error ER_NONUPDATEABLE_COLUMN
-LOAD XML INFILE '../../std_data/loaddata/mdev12696.xml' INTO TABLE v1 (c1);
---error ER_NONUPDATEABLE_COLUMN
-LOAD XML INFILE '../../std_data/loaddata/mdev12696.xml' INTO TABLE v1 (c2);
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-14628 Wrong autoinc value assigned by LOAD XML in the NO_AUTO_VALUE_ON_ZERO mode
---echo #
-
-SET sql_mode=NO_AUTO_VALUE_ON_ZERO;
-CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT);
-LOAD XML INFILE '../../std_data/loaddata/mdev14628a.xml' INTO TABLE t1 ROWS IDENTIFIED BY '<row>';
-SELECT * FROM t1 ORDER BY b;
-DROP TABLE t1;
-SET sql_mode=DEFAULT;
-
-SET sql_mode='';
-CREATE TABLE t1 (id INT, g GEOMETRY NOT NULL);
---error ER_WARN_NULL_TO_NOTNULL
-LOAD XML INFILE '../../std_data/loaddata/mdev14628b.xml' INTO TABLE t1 ROWS IDENTIFIED BY '<row>';
-SELECT * FROM t1;
-DROP TABLE t1;
-SET sql_mode=DEFAULT;
diff --git a/mysql-test/t/locale.test b/mysql-test/t/locale.test
deleted file mode 100644
index a9a507bc387..00000000000
--- a/mysql-test/t/locale.test
+++ /dev/null
@@ -1,183 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
---echo Start of 5.4 tests
-
---echo #
---echo # WL#4642 Greek locale for DAYNAME, MONTHNAME, DATE_FORMAT
---echo #
-
-SET NAMES utf8;
-
-SET @@lc_time_names=109;
-SELECT @@lc_time_names;
-
-CREATE TABLE t1 (a DATE);
-INSERT INTO t1 VALUES
-('2006-01-01'),('2006-01-02'),('2006-01-03'),
-('2006-01-04'),('2006-01-05'),('2006-01-06'),('2006-01-07');
-SELECT a, date_format(a,'%a') as abday, dayname(a) as day FROM t1 ORDER BY a;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DATE);
-INSERT INTO t1 VALUES
-('2006-01-01'),('2006-02-01'),('2006-03-01'),
-('2006-04-01'),('2006-05-01'),('2006-06-01'),
-('2006-07-01'),('2006-08-01'),('2006-09-01'),
-('2006-10-01'),('2006-11-01'),('2006-12-01');
-SELECT a, date_format(a,'%b') as abmon, monthname(a) as mon FROM t1 ORDER BY a;
-
-SELECT format(123456.789, 3, 'el_GR');
-DROP TABLE t1;
-
---echo #
---echo # Bug#46633 Obsolete Serbian locale name
---echo #
-SET lc_messages=sr_YU;
-SHOW VARIABLES LIKE 'lc_messages';
-SET lc_messages=sr_RS;
-SHOW VARIABLES LIKE 'lc_messages';
-SET lc_time_names=sr_RS;
-SELECT format(123456.789, 3, 'sr_RS');
-
---echo #
---echo # Bug#43207 wrong LC_TIME names for romanian locale
---echo #
-SET NAMES utf8;
-SET lc_time_names=ro_RO;
-SELECT DATE_FORMAT('2001-01-01', '%w %a %W');
-SELECT DATE_FORMAT('2001-01-02', '%w %a %W');
-SELECT DATE_FORMAT('2001-01-03', '%w %a %W');
-SELECT DATE_FORMAT('2001-01-04', '%w %a %W');
-SELECT DATE_FORMAT('2001-01-05', '%w %a %W');
-SELECT DATE_FORMAT('2001-01-06', '%w %a %W');
-SELECT DATE_FORMAT('2001-01-07', '%w %a %W');
---echo End of 5.4 tests
-
-#
-# MDEV-9928 LC_TIME_NAMES=de_AT; unusual name for february
-#
-SET NAMES utf8;
-SET lc_time_names=de_AT;
-SELECT monthname('2001-01-01');
-SELECT monthname('2001-02-01');
-SELECT monthname('2001-03-01');
-
---echo #
---echo # MDEV-10052 Illegal mix of collations with DAYNAME(date_field)<>varchar_field
---echo #
-SET NAMES utf8;
-CREATE TABLE t1 (c VARCHAR(8) CHARACTER SET latin1, d DATE);
-INSERT INTO t1 VALUES ('test',now());
-SET lc_time_names=ru_RU;
---error ER_CANT_AGGREGATE_2COLLATIONS
-SELECT c FROM t1 WHERE DAYNAME(d)<>c;
---error ER_CANT_AGGREGATE_2COLLATIONS
-SELECT c FROM t1 WHERE MONTHNAME(d)<>c;
-SET lc_time_names=en_US;
-SELECT c FROM t1 WHERE DAYNAME(d)<>c;
-SELECT c FROM t1 WHERE MONTHNAME(d)<>c;
-SET NAMES latin1;
-SELECT c FROM t1 WHERE DAYNAME(d)<>c;
-SELECT c FROM t1 WHERE MONTHNAME(d)<>c;
-DROP TABLE t1;
-
---echo #
---echo # Start of 5.6 tests
---echo #
-
---echo #
---echo # WL#5303 Romansh locale for DAYNAME, MONTHNAME, DATE_FORMAT
---echo #
-
-SET NAMES utf8;
-SET @old_50915_lc_time_names := @@lc_time_names;
-SET lc_time_names=en_US;
-SELECT DATE_FORMAT('2001-01-01', '%w %a %W');
-SELECT DATE_FORMAT('2001-03-01', '%c %b %M');
-SET lc_time_names=rm_CH;
-SELECT DATE_FORMAT('2001-01-01', '%w %a %W');
-SELECT DATE_FORMAT('2001-01-02', '%w %a %W');
-SELECT DATE_FORMAT('2001-01-03', '%w %a %W');
-SELECT DATE_FORMAT('2001-01-04', '%w %a %W');
-SELECT DATE_FORMAT('2001-01-05', '%w %a %W');
-SELECT DATE_FORMAT('2001-01-06', '%w %a %W');
-SELECT DATE_FORMAT('2001-01-07', '%w %a %W');
-SELECT DATE_FORMAT('2001-01-01', '%c %b %M');
-SELECT DATE_FORMAT('2001-02-01', '%c %b %M');
-SELECT DATE_FORMAT('2001-03-01', '%c %b %M');
-SELECT DATE_FORMAT('2001-04-01', '%c %b %M');
-SELECT DATE_FORMAT('2001-05-01', '%c %b %M');
-SELECT DATE_FORMAT('2001-06-01', '%c %b %M');
-SELECT DATE_FORMAT('2001-07-01', '%c %b %M');
-SELECT DATE_FORMAT('2001-08-01', '%c %b %M');
-SELECT DATE_FORMAT('2001-09-01', '%c %b %M');
-SELECT DATE_FORMAT('2001-10-01', '%c %b %M');
-SELECT DATE_FORMAT('2001-11-01', '%c %b %M');
-SELECT DATE_FORMAT('2001-12-01', '%c %b %M');
-SET lc_time_names=de_CH;
-SELECT DATE_FORMAT('2001-01-06', '%w %a %W');
-SELECT DATE_FORMAT('2001-09-01', '%c %b %M');
-
-# Checking AM/PM
-SELECT DATE_FORMAT('2010-03-23 11:00:00','%h %p');
-SELECT DATE_FORMAT('2010-03-23 13:00:00','%h %p');
-
-# Checking numeric format
-SELECT format(123456789,2,'rm_CH');
-
-# Checking that error messages point to en_US.
-SET lc_messages=rm_CH;
---error ER_NO_SUCH_TABLE
-SELECT * FROM non_existent;
-
-SET lc_time_names=@old_50915_lc_time_names;
-
---echo #
---echo # End of 10.0 tests
---echo #
-
---echo #
---echo # End of 10.1 tests
---echo #
-
-# Item::print
-create view v1 as select
- date_format('2001-10-02', '%c %b %M') as a,
- date_format('2001-10-02', '%c %b %M', 'ru_RU') as a1,
- format(123456789,2) as b,
- format(123456789,2,'rm_CH') as b1;
-select * from v1;
-show create view v1;
-drop view v1;
-
---echo #
---echo # End of 10.2 tests
---echo #
-
-#
-# MDEV-11553 Can't restore a PERSISTENT column that uses DATE_FORMAT()
-#
-# 3-argument syntax for DATE_FORMAT()
-select date_format('2001-01-01', '%w %a %W', 'ro_RO');
-select date_format('2001-01-03', '%w %a %W', 'ro_RO');
-select date_format('2001-01-05', '%w %a %W', 'ro_RO');
-select date_format('2001-01-07', '%w %a %W', 'ro_RO');
-select date_format('2001-01-01', '%w %a %W', 'de_AT');
-select date_format('2001-02-01', '%w %a %W', 'de_AT');
-select date_format('2001-03-01', '%w %a %W', 'de_AT');
-select date_format('2001-01-01', '%w %a %W', 'en_US');
-select date_format('2001-03-01', '%c %b %M', 'en_US');
-select date_format('2001-01-01', '%w %a %W', 'rm_CH');
-select date_format('2001-01-03', '%w %a %W', 'rm_CH');
-select date_format('2001-01-05', '%w %a %W', 'rm_CH');
-select date_format('2001-01-07', '%w %a %W', 'rm_CH');
-select date_format('2001-02-01', '%c %b %M', 'rm_CH');
-select date_format('2001-04-01', '%c %b %M', 'rm_CH');
-select date_format('2001-06-01', '%c %b %M', 'rm_CH');
-select date_format('2001-08-01', '%c %b %M', 'rm_CH');
-select date_format('2001-10-01', '%c %b %M', 'rm_CH');
-select date_format('2001-12-01', '%c %b %M', 'rm_CH');
-select date_format('2001-01-06', '%w %a %W', 'de_CH');
-select date_format('2001-09-01', '%c %b %M', 'de_CH');
diff --git a/mysql-test/t/lock.test b/mysql-test/t/lock.test
deleted file mode 100644
index 2e164de9b93..00000000000
--- a/mysql-test/t/lock.test
+++ /dev/null
@@ -1,600 +0,0 @@
-#
-# Testing of table locking
-#
-
---source include/have_partition.inc
-
-# Save the initial number of concurrent sessions.
---source include/count_sessions.inc
-
---disable_warnings
-drop table if exists t1,t2,t3;
---enable_warnings
-CREATE TABLE t1 ( `id` int(11) NOT NULL default '0', `id2` int(11) NOT NULL default '0', `id3` int(11) NOT NULL default '0', `dummy1` char(30) default NULL, PRIMARY KEY (`id`,`id2`), KEY `index_id3` (`id3`)) ENGINE=MyISAM;
-insert into t1 (id,id2) values (1,1),(1,2),(1,3);
-LOCK TABLE t1 WRITE;
-select dummy1,count(distinct id) from t1 group by dummy1;
-update t1 set id=-1 where id=1;
-LOCK TABLE t1 READ;
---error 1099
-update t1 set id=1 where id=1;
---error 1100
-create table t2 SELECT * from t1;
-create temporary table t2 SELECT * from t1;
-drop table if exists t2;
-unlock tables;
-create table t2 SELECT * from t1;
-LOCK TABLE t1 WRITE,t2 write;
-insert into t2 SELECT * from t1;
-update t1 set id=1 where id=-1;
-drop table t1,t2;
-
-
-#
-# Check bug with INSERT ... SELECT with lock tables
-#
-
-CREATE TABLE t1 (
- index1 smallint(6) default NULL,
- nr smallint(6) default NULL,
- KEY index1(index1)
-) ENGINE=MyISAM;
-
-CREATE TABLE t2 (
- nr smallint(6) default NULL,
- name varchar(20) default NULL
-) ENGINE=MyISAM;
-
-INSERT INTO t2 VALUES (1,'item1');
-INSERT INTO t2 VALUES (2,'item2');
-
-# problem begins here!
-lock tables t1 write, t2 read;
-insert into t1 select 1,nr from t2 where name='item1';
-insert into t1 select 2,nr from t2 where name='item2';
-unlock tables;
-check table t1;
-
-# Check error message
-lock tables t1 write;
-check table t2;
---error 1100
-insert into t1 select index1,nr from t1;
-unlock tables;
-lock tables t1 write, t1 as t1_alias read;
-insert into t1 select index1,nr from t1 as t1_alias;
---error ER_TABLE_NOT_LOCKED
-drop table t1,t2;
-unlock tables;
-drop table t1,t2;
-
-#
-# BUG#5390 - problems with merge tables
-# Supplement test for the after-fix optimization
-# Check that a dropped table is correctly removed from a lock.
-create table t1 (c1 int);
-create table t2 (c1 int);
-create table t3 (c1 int);
-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.
-create table t1 (c1 int);
-create table t2 (c1 int);
-create table t3 (c1 int);
-lock tables t1 write, t2 write, t3 write, t1 as t4 read;
-alter table t2 add column c2 int;
-drop table t1, t2, t3;
-
-# Bug7241 - Invalid response when DELETE .. USING and LOCK TABLES used.
-#
-create table t1 ( a int(11) not null auto_increment, primary key(a));
-create table t2 ( a int(11) not null auto_increment, primary key(a));
-lock tables t1 write, t2 read;
-delete from t1 using t1,t2 where t1.a=t2.a;
-delete t1 from t1,t2 where t1.a=t2.a;
---error 1099
-delete from t2 using t1,t2 where t1.a=t2.a;
---error 1099
-delete t2 from t1,t2 where t1.a=t2.a;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-drop table t1,t2;
-unlock tables;
-drop table t2,t1;
-
---echo End of 4.1 tests.
-
-
-#
-# Bug#18884 "lock table + global read lock = crash"
-# The bug is not repeatable, just add the test case.
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a int);
-lock table t1 write;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-flush tables with read lock;
-unlock tables;
-drop table t1;
-
-
-#
-# Test LOCK TABLE on system tables. See bug#9953: CONVERT_TZ requires
-# mysql.time_zone_name to be locked.
-#
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (i INT);
-
-LOCK TABLES mysql.time_zone READ, mysql.proc READ, t1 READ;
-UNLOCK TABLES;
-
-LOCK TABLES mysql.time_zone READ, mysql.proc READ, t1 WRITE;
-UNLOCK TABLES;
-
-LOCK TABLES mysql.time_zone READ, mysql.proc READ;
-UNLOCK TABLES;
-
-LOCK TABLES mysql.time_zone WRITE, mysql.proc WRITE;
-UNLOCK TABLES;
-
-# If at least one system table is locked for WRITE, then all other
-# tables should be system tables locked also for WRITE.
---error ER_WRONG_LOCK_OF_SYSTEM_TABLE
-LOCK TABLES mysql.time_zone READ, mysql.proc WRITE, t1 READ;
-
---error ER_WRONG_LOCK_OF_SYSTEM_TABLE
-LOCK TABLES mysql.time_zone WRITE, mysql.proc WRITE, t1 READ;
-
---error ER_WRONG_LOCK_OF_SYSTEM_TABLE
-LOCK TABLES mysql.time_zone WRITE, mysql.proc WRITE, t1 WRITE;
-
---error ER_WRONG_LOCK_OF_SYSTEM_TABLE
-LOCK TABLES mysql.time_zone READ, mysql.proc WRITE;
-
-DROP TABLE t1;
-
---echo
---echo Bug#5719 impossible to lock VIEW
---echo
---echo Just covering existing behaviour with tests.
---echo Consistency has not been found here.
---echo
---disable_warnings
-drop view if exists v_bug5719;
-drop table if exists t1, t2, t3;
---enable_warnings
-create table t1 (a int);
-create temporary table t2 (a int);
-create table t3 (a int);
-create view v_bug5719 as select 1;
-lock table v_bug5719 write;
---error ER_TABLE_NOT_LOCKED
-select * from t1;
---echo
---echo Allowed to select from a temporary talbe under LOCK TABLES
---echo
-select * from t2;
---error ER_TABLE_NOT_LOCKED
-select * from t3;
-select * from v_bug5719;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-drop view v_bug5719;
---echo
---echo sic: did not left LOCK TABLES mode automatically
---echo
---error ER_TABLE_NOT_LOCKED
-select * from t1;
-unlock tables;
-create or replace view v_bug5719 as select * from t1;
-lock tables v_bug5719 write;
-select * from v_bug5719;
---echo
---echo Allowed to use an underlying table under LOCK TABLES <view>
---echo
-select * from t1;
---echo
---echo Allowed to select from a temporary table under LOCK TABLES
---echo
-select * from t2;
---error ER_TABLE_NOT_LOCKED
-select * from t3;
---echo Dropping of implicitly locked table is disallowed.
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-drop table t1;
-unlock tables;
---echo Now let us also lock table explicitly and drop it.
-lock tables t1 write, v_bug5719 write;
-drop table t1;
---echo
---echo sic: left LOCK TABLES mode
---echo
-select * from t3;
---error ER_VIEW_INVALID
-select * from v_bug5719;
-unlock tables;
-drop view v_bug5719;
---echo
---echo When limitation to use temporary tables in views is removed, please
---echo add a test that shows what happens under LOCK TABLES when a view
---echo references a temporary table, is locked, and the underlying table
---echo is dropped.
---echo
---error ER_VIEW_SELECT_TMPTABLE
-create view v_bug5719 as select * from t2;
---echo
---echo Cleanup.
---echo
-drop table t2, t3;
-
---echo #
---echo # Bug#39843 DELETE requires write access to table in subquery in where clause
---echo #
---disable_warnings
-DROP TABLE IF EXISTS t1,t2;
---enable_warnings
-CREATE TABLE t1 (
-table1_rowid SMALLINT NOT NULL
-);
-CREATE TABLE t2 (
-table2_rowid SMALLINT NOT NULL
-);
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (1);
-LOCK TABLES t1 WRITE, t2 READ;
---echo # Sub-select should not try to aquire a write lock.
-DELETE FROM t1
-WHERE EXISTS
-(
-SELECT 'x'
-FROM t2
-WHERE t1.table1_rowid = t2.table2_rowid
-) ;
---echo # While implementing the patch we didn't break old behavior;
---echo # The following sub-select should still requires a write lock:
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-SELECT * FROM t1 WHERE 1 IN (SELECT * FROM t2 FOR UPDATE);
-UNLOCK TABLES;
-DROP TABLE t1,t2;
-
---echo End of 5.1 tests.
-
---echo #
---echo # Ensure that FLUSH TABLES doesn't substitute a base locked table
---echo # with a temporary one.
---echo #
-
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-create table t1 (a int);
-create table t2 (a int);
-lock table t1 write, t2 write;
-create temporary table t1 (a int);
-flush table t1;
-drop temporary table t1;
-select * from t1;
-unlock tables;
-drop table t1, t2;
-
---echo #
---echo # Ensure that REPAIR .. USE_FRM works under LOCK TABLES.
---echo #
-
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-create table t1 (a int);
-create table t2 (a int);
-lock table t1 write, t2 write;
-repair table t1 use_frm;
-repair table t1 use_frm;
-select * from t1;
-select * from t2;
-repair table t2 use_frm;
-repair table t2 use_frm;
-select * from t1;
-unlock tables;
-drop table t1, t2;
-
---echo #
---echo # Ensure that mi_copy_status is called for two instances
---echo # of the same table when it is reopened after a flush.
---echo #
---disable_warnings
-drop table if exists t1;
-drop view if exists v1;
---enable_warnings
-create table t1 (c1 int);
-create view v1 as select * from t1;
-lock tables t1 write, v1 write;
-flush table t1;
-insert into t1 values (33);
-flush table t1;
-select * from t1;
-unlock tables;
-drop table t1;
-drop view v1;
-
---echo #
---echo # WL#4284: Transactional DDL locking
---echo #
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a int);
-connect(con1,localhost,root,,);
-set autocommit= 0;
-insert into t1 values (1);
-lock table t1 write;
---echo # Ensure that metadata locks will be released if there is an open
---echo # transaction (autocommit=off) in conjunction with lock tables.
-disconnect con1;
-connection default;
-drop table t1;
-
---echo # Same problem but now for BEGIN
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a int);
-connect(con1,localhost,root,,);
-begin;
-insert into t1 values (1);
---echo # Ensure that metadata locks held by the transaction are released.
-disconnect con1;
-connection default;
-drop table t1;
-
-
---echo #
---echo # Coverage for situations when we try to execute DDL on tables
---echo # which are locked by LOCK TABLES only implicitly.
---echo #
---disable_warnings
-drop tables if exists t1, t2;
-drop view if exists v1;
-drop function if exists f1;
---enable_warnings
-create table t1 (i int);
-create table t2 (j int);
---echo #
---echo # Try to perform DDL on table which is locked through view.
-create view v1 as select * from t2;
-lock tables t1 write, v1 write;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-flush table t2;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-drop table t2;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-alter table t2 add column k int;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-create trigger t2_bi before insert on t2 for each row set @a:=1;
---echo # Repair produces error as part of its result set.
-repair table t2;
-unlock tables;
-drop view v1;
---echo #
---echo # Now, try DDL on table which is locked through routine.
-delimiter |;
-create function f1 () returns int
-begin
- insert into t2 values (1);
- return 0;
-end|
-delimiter ;|
-create view v1 as select f1() from t1;
-lock tables v1 read;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-flush table t2;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-drop table t2;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-alter table t2 add column k int;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-create trigger t2_bi before insert on t2 for each row set @a:=1;
---echo # Repair produces error as part of its result set.
-repair table t2;
-unlock tables;
-drop view v1;
-drop function f1;
---echo #
---echo # Finally, try DDL on table which is locked thanks to trigger.
-create trigger t1_ai after insert on t1 for each row insert into t2 values (1);
-lock tables t1 write;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-flush table t2;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-drop table t2;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-alter table t2 add column k int;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-create trigger t2_bi before insert on t2 for each row set @a:=1;
---echo # Repair produces error as part of its result set.
-repair table t2;
-unlock tables;
-drop trigger t1_ai;
-drop tables t1, t2;
-
-
---echo #
---echo # Bug#45035 " Altering table under LOCK TABLES results in
---echo # "Error 1213 Deadlock found..."
---echo #
---echo # When reopening tables under LOCK TABLES after ALTER TABLE,
---echo # 6.0 used to be taking thr_lock locks one by one, and
---echo # that would lead to a lock conflict.
---echo # Check that taking all locks at once works.
---echo #
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (i int);
-lock tables t1 write, t1 as a read, t1 as b read;
-alter table t1 add column j int;
-unlock tables;
-drop table t1;
-create temporary table t1 (i int);
-lock tables t1 write, t1 as a read, t1 as b read;
-alter table t1 add column j int;
-unlock tables;
-drop table t1;
---echo #
---echo # Separate case for partitioned tables is important
---echo # because each partition has an own thr_lock object.
---echo #
-create table t1 (i int) partition by list (i)
- (partition p0 values in (1),
- partition p1 values in (2,3),
- partition p2 values in (4,5));
-lock tables t1 write, t1 as a read, t1 as b read;
-alter table t1 add column j int;
-unlock tables;
-drop table t1;
-
-
---echo #
---echo # Bug #43272 HANDLER SQL command does not work under LOCK TABLES
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (a INT);
-LOCK TABLE t1 WRITE;
-
---echo # HANDLER commands are not allowed in LOCK TABLES mode
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-HANDLER t1 OPEN;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-HANDLER t1 READ FIRST;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-HANDLER t1 CLOSE;
-
-UNLOCK TABLES;
-DROP TABLE t1;
-
-
---echo #
---echo # Bug#45066 FLUSH TABLES WITH READ LOCK deadlocks against
---echo # LOCK TABLE
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1(a INT);
-
-LOCK TABLE t1 READ;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-FLUSH TABLES;
-
-LOCK TABLE t1 WRITE;
-FLUSH TABLES;
-
---echo #
---echo # If you allow the next combination, you reintroduce bug Bug#45066
---echo #
-LOCK TABLE t1 READ;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-FLUSH TABLES WITH READ LOCK;
-
-LOCK TABLE t1 WRITE;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-FLUSH TABLES WITH READ LOCK;
-
-UNLOCK TABLES;
-DROP TABLE t1;
-
-
---echo #
---echo # Simplified test for bug #48538 "Assertion in thr_lock() on LOAD DATA
---echo # CONCURRENT INFILE".
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (f1 INT, f2 INT) ENGINE = MEMORY;
-CREATE TRIGGER t1_ai AFTER INSERT ON t1 FOR EACH ROW
- UPDATE LOW_PRIORITY t1 SET f2 = 7;
-
---echo # Statement below should fail with ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
---echo # error instead of failing on assertion in table-level locking subsystem.
---error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
-INSERT INTO t1(f1) VALUES(0);
-
-DROP TABLE t1;
-
-
---echo #
---echo # Bug#43685 Lock table affects other non-related tables
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-connect (con2, localhost, root);
-CREATE TABLE t1 (id INT);
-CREATE TABLE t2 (id INT);
-
-connection default;
-LOCK TABLE t1 WRITE;
-ANALYZE TABLE t1;
-
-connection con2;
-LOCK TABLE t2 WRITE;
---echo # This used to hang until the first connection
---echo # unlocked t1.
-FLUSH TABLE t2;
-
-UNLOCK TABLES;
-
-connection default;
-UNLOCK TABLES;
-DROP TABLE t1, t2;
-disconnect con2;
-
-
---echo #
---echo # End of 6.0 tests.
---echo #
-
-# 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
-#
-# Test concurrent lock and read locks
-# This gave a warning:
-# Warning at 'read lock with old write lock' for lock: 5:
-# Found lock of type 8 that is write and read locked. Read_no_write_count: 1
-#
-create table t1 (a int) engine=myisam;
-lock tables t1 write concurrent, t1 as t2 read;
-connect (con1,localhost,root,,);
-connection con1;
-lock tables t1 read local;
-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;
diff --git a/mysql-test/t/lock_multi.test b/mysql-test/t/lock_multi.test
deleted file mode 100644
index 51cc4a50233..00000000000
--- a/mysql-test/t/lock_multi.test
+++ /dev/null
@@ -1,1059 +0,0 @@
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
---disable_warnings
-drop table if exists t1,t2;
-drop DATABASE if exists mysqltest_1;
---enable_warnings
-
-# Test to see if select will get the lock ahead of low priority update
-
-connect (locker,localhost,root,,);
-connect (locker2,localhost,root,,);
-connect (reader,localhost,root,,);
-connect (writer,localhost,root,,);
-
-connection locker;
-create table t1(n int);
-insert into t1 values (1);
-connection locker2;
-select get_lock("mysqltest_lock", 100);
-connection locker;
-send
-update t1 set n = 2 and get_lock('mysqltest_lock', 100);
-connection writer;
-# Wait till above update gets blocked on a user lock.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "User lock" and info = "update t1 set n = 2 and get_lock('mysqltest_lock', 100)";
---source include/wait_condition.inc
-send
-update low_priority t1 set n = 4;
-connection reader;
-# Sleep a bit till the update of connection writer is in work and hangs
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table level lock" and
- info = "update low_priority t1 set n = 4";
---source include/wait_condition.inc
-send
-select n from t1;
-connection locker2;
-# Sleep a bit till the select of connection reader is in work and hangs
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table level lock" and
- info = "select n from t1";
---source include/wait_condition.inc
-select release_lock("mysqltest_lock");
-connection locker;
-reap;
-select release_lock("mysqltest_lock");
-connection writer;
-reap;
-connection reader;
-reap;
-drop table t1;
-
-connection locker;
-create table t1(n int);
-insert into t1 values (1),(2);
-connection locker2;
-select get_lock("mysqltest_lock", 100);
-connection locker;
-send
-select n from t1 where get_lock('mysqltest_lock', 100);
-connection writer;
-# Wait till above select gets blocked on a user lock.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "User lock" and info = "select n from t1 where get_lock('mysqltest_lock', 100)";
---source include/wait_condition.inc
-send
-update low_priority t1 set n = 4;
-connection reader;
-# Sleep a bit till the update of connection writer is in work and hangs
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table level lock" and
- info = "update low_priority t1 set n = 4";
---source include/wait_condition.inc
-select n from t1;
-connection locker2;
-select release_lock("mysqltest_lock");
-connection locker;
-reap;
-select release_lock("mysqltest_lock");
-connection writer;
-reap;
-drop table t1;
-
-#
-# Test problem when using locks with multi-updates
-# It should not block when multi-update is reading on a read-locked table
-#
-
-connection locker;
-create table t1 (a int, b int);
-create table t2 (c int, d int);
-insert into t1 values(1,1);
-insert into t1 values(2,2);
-insert into t2 values(1,2);
-lock table t1 read;
-connection writer;
-update t1,t2 set c=a where b=d;
-connection reader;
-select c from t2;
-connection locker;
-unlock tables;
-drop table t1;
-drop table t2;
-
-#
-# Test problem when using locks on many tables and dropping a table that
-# is to-be-locked by another thread
-#
-#
-connection locker;
-create table t1 (a int);
-create table t2 (a int);
-lock table t1 write, t2 write;
-connection reader;
-send
-insert t1 select * from t2;
-connection locker;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "insert t1 select * from t2";
---source include/wait_condition.inc
-drop table t2;
-unlock tables;
-connection reader;
---error ER_NO_SUCH_TABLE
-reap;
-connection locker;
-drop table t1;
-
-#
-# Same test as above, but with the dropped table locked twice
-#
-
-connection locker;
-create table t1 (a int);
-create table t2 (a int);
-lock table t1 write, t2 write, t1 as t1_2 write, t2 as t2_2 write;
-connection reader;
-send
-insert t1 select * from t2;
-connection locker;
-# Sleep a bit till the insert of connection reader is in work and hangs
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "insert t1 select * from t2";
---source include/wait_condition.inc
-drop table t2;
-unlock tables;
-connection reader;
---error ER_NO_SUCH_TABLE
-reap;
-connection locker;
-drop table t1;
-
-
---echo End of 4.1 tests
-
-#
-# Bug#9998 MySQL client hangs on USE "database"
-#
-create table t1(a int);
-lock tables t1 write;
-connection reader;
-show columns from t1;
-connection locker;
-unlock tables;
-drop table t1;
-
-#
-# Bug#16986 Deadlock condition with MyISAM tables
-#
-
-# Need a matching user in mysql.user for multi-table select
---source include/add_anonymous_users.inc
-
-connection locker;
-USE mysql;
-LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE;
-FLUSH TABLES;
-#
-connection reader;
-USE mysql;
-# Note: This must be a multi-table select, otherwise the deadlock will not occur
-send
-SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1;
-#
-connection locker;
-# Sleep a bit till the select of connection reader is in work and hangs
-let $wait_condition=
- SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for table metadata lock" AND info =
- "SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1";
---source include/wait_condition.inc
-# Make test case independent from earlier grants.
---replace_result "Table is already up to date" "OK"
-OPTIMIZE TABLES columns_priv, db, host, user;
-UNLOCK TABLES;
-#
-connection reader;
-reap;
-USE test;
-#
-connection locker;
-use test;
-#
-connection default;
-#
-# Test if CREATE TABLE with LOCK TABLE deadlocks.
-#
-connection writer;
-CREATE TABLE t1 (c1 int);
-LOCK TABLE t1 WRITE;
-#
-# This waits until t1 is unlocked.
-connection locker;
-send
-FLUSH TABLES WITH READ LOCK;
-#
-connection writer;
-# Sleep a bit till the flush of connection locker is in work and hangs
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
- info = "FLUSH TABLES WITH READ LOCK";
---source include/wait_condition.inc
-# This must not block.
---error ER_TABLE_NOT_LOCKED
-CREATE TABLE t2 (c1 int);
-UNLOCK TABLES;
-#
-# This awakes now.
-connection locker;
-reap;
-UNLOCK TABLES;
-#
-connection default;
-DROP TABLE t1;
-#
-# Test if CREATE TABLE SELECT with LOCK TABLE deadlocks.
-#
-connection writer;
-CREATE TABLE t1 (c1 int);
-LOCK TABLE t1 WRITE;
-#
-# This waits until t1 is unlocked.
-connection locker;
-send
-FLUSH TABLES WITH READ LOCK;
-#
-# This must not block.
-connection writer;
-# Sleep a bit till the flush of connection locker is in work and hangs
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
- info = "FLUSH TABLES WITH READ LOCK";
---source include/wait_condition.inc
---error ER_TABLE_NOT_LOCKED
-CREATE TABLE t2 AS SELECT * FROM t1;
-UNLOCK TABLES;
-#
-# This awakes now.
-connection locker;
-reap;
-UNLOCK TABLES;
-#
-connection default;
-DROP TABLE t1;
-
---source include/delete_anonymous_users.inc
-
-#
-# Bug#19815 CREATE/RENAME/DROP DATABASE can deadlock on a global read lock
-#
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-#
-connection con1;
-CREATE DATABASE mysqltest_1;
-FLUSH TABLES WITH READ LOCK;
-#
-# With bug in place: acquire LOCK_mysql_create_table and
-# wait in wait_if_global_read_lock().
-connection con2;
-send
-DROP DATABASE mysqltest_1;
-#
-# With bug in place: try to acquire LOCK_mysql_create_table...
-# When fixed: Reject dropping db because of the read lock.
-connection con1;
-# Wait a bit so that the session con2 is in state
-# "Waiting for global read lock"
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock"
- and info = "DROP DATABASE mysqltest_1";
---source include/wait_condition.inc
---error ER_CANT_UPDATE_WITH_READLOCK
-DROP DATABASE mysqltest_1;
-UNLOCK TABLES;
-#
-connection con2;
-reap;
-#
-connection default;
-disconnect con1;
-disconnect con2;
-# This must have been dropped by connection 2 already,
-# which waited until the global read lock was released.
---error ER_DB_DROP_EXISTS
-DROP DATABASE mysqltest_1;
-
-#
-# Bug#17264 MySQL Server freeze
-#
-connection locker;
-# Disable warnings to allow test to run also without InnoDB
-set sql_mode="";
---disable_warnings
-create table t1 (f1 int(12) unsigned not null auto_increment, primary key(f1)) engine=innodb;
---enable_warnings
-set sql_mode=default;
-lock tables t1 write;
-connection writer;
-send
-alter table t1 auto_increment=0;
-connection reader;
-# Wait till connection writer is blocked
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "alter table t1 auto_increment=0";
---source include/wait_condition.inc
-send
-alter table t1 auto_increment=0;
-connection locker;
-# Wait till connection reader is blocked
-let $wait_condition=
- select count(*) = 2 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "alter table t1 auto_increment=0";
---source include/wait_condition.inc
-unlock tables;
-connection writer;
-reap;
-connection reader;
-reap;
-connection locker;
-drop table t1;
-
-#
-# Bug#43230: SELECT ... FOR UPDATE can hang with FLUSH TABLES WITH READ LOCK indefinitely
-#
-
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-connect (con3,localhost,root,,);
-connect (con4,localhost,root,,);
-connect (con5,localhost,root,,);
-
-create table t1 (a int);
-create table t2 like t1;
-
-connection con1;
-lock tables t1 write;
-connection con2;
-send flush tables with read lock;
-connection con5;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
- info = "flush tables with read lock";
---source include/wait_condition.inc
---echo # global read lock is taken
-connection con3;
-send select * from t2 for update;
-connection con5;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
- info = "select * from t2 for update";
---source include/wait_condition.inc
---echo # waiting for release of read lock
-connection con4;
---echo # would hang and later cause a deadlock
-flush tables t2;
-connection con1;
---echo # clean up
-unlock tables;
-connection con2;
---reap
-unlock tables;
-connection con3;
---reap
-connection default;
-disconnect con5;
-disconnect con4;
-disconnect con3;
-disconnect con2;
-disconnect con1;
-
-drop table t1,t2;
-
---echo #
---echo # Lightweight version:
---echo # Ensure that the wait for a GRL is done before opening tables.
---echo #
-
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-
-create table t1 (a int);
-create table t2 like t1;
-
---echo #
---echo # UPDATE
---echo #
-
-connection default;
-flush tables with read lock;
-connection con1;
-send update t2 set a = 1;
-connection default;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
- info = "update t2 set a = 1";
---source include/wait_condition.inc
---echo # statement is waiting for release of read lock
-connection con2;
-flush table t2;
-connection default;
-unlock tables;
-connection con1;
---reap
-
---echo #
---echo # LOCK TABLES .. WRITE
---echo #
-
-connection default;
-flush tables with read lock;
-connection con1;
-send lock tables t2 write;
-connection default;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
- info = "lock tables t2 write";
---source include/wait_condition.inc
---echo # statement is waiting for release of read lock
-connection con2;
-flush table t2;
-connection default;
-unlock tables;
-connection con1;
---reap
-unlock tables;
-
-connection default;
-disconnect con2;
-disconnect con1;
-
-drop table t1,t2;
-
-
---echo End of 5.0 tests
-
-
-#
-# Bug#21281 Pending write lock is incorrectly removed when its
-# statement being KILLed
-#
-create table t1 (i int);
-connection locker;
-lock table t1 read;
-connection writer;
-send
-update t1 set i= 10;
-connection reader;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table level lock" and
- info = "update t1 set i= 10";
---source include/wait_condition.inc
-send
-select * from t1;
-connection default;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table level lock" and
- info = "select * from t1";
---source include/wait_condition.inc
-let $ID= `select id from information_schema.processlist
- where state = "Waiting for table level lock" and
- info = "update t1 set i= 10"`;
---replace_result $ID ID
-eval kill query $ID;
-connection reader;
---reap
-connection writer;
---error ER_QUERY_INTERRUPTED
---reap
-connection locker;
-unlock tables;
-connection default;
-drop table t1;
-
-# Disconnect sessions used in many subtests above
-disconnect locker;
-disconnect locker2;
-disconnect reader;
-disconnect writer;
-
-
-#
-# Bug#32395 Alter table under a impending global read lock causes a server crash
-#
-
-#
-# Test ALTER TABLE under LOCK TABLES and FLUSH TABLES WITH READ LOCK
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (i int);
-connect (flush,localhost,root,,test,,);
-connection default;
-lock tables t1 write;
-connection flush;
---send flush tables with read lock;
-connection default;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
- info = "flush tables with read lock";
---source include/wait_condition.inc
-alter table t1 add column j int;
-connect (insert,localhost,root,,test,,);
-connection insert;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
- info = "flush tables with read lock";
---source include/wait_condition.inc
---send insert into t1 values (1,2);
-connection default;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
- info = "insert into t1 values (1,2)";
---source include/wait_condition.inc
-unlock tables;
-connection flush;
---reap
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock" and
- info = "insert into t1 values (1,2)";
---source include/wait_condition.inc
-select * from t1;
-unlock tables;
-connection insert;
---reap
-connection default;
-let $wait_condition=
- select count(*) = 1 from t1;
---source include/wait_condition.inc
-select * from t1;
-drop table t1;
-disconnect flush;
-disconnect insert;
-
-#
-# Test that FLUSH TABLES under LOCK TABLES protects write locked tables
-# from a impending FLUSH TABLES WITH READ LOCK
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (i int);
-connect (flush,localhost,root,,test,,);
-connection default;
-lock tables t1 write;
-connection flush;
---send flush tables with read lock;
-connection default;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock";
---source include/wait_condition.inc
-flush tables;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock";
---source include/wait_condition.inc
-unlock tables;
-connection flush;
---reap
-connection default;
-disconnect flush;
-drop table t1;
-
-#
-# Bug#30331 Table_locks_waited shows inaccurate values
-#
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-create table t1 (a int);
-flush status;
-lock tables t1 read;
-let $tlwa= `show status like 'Table_locks_waited'`;
-connect (waiter,localhost,root,,);
-connection waiter;
-send insert into t1 values(1);
-connection default;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table level lock" and
- info = "insert into t1 values(1)";
---source include/wait_condition.inc
-let $tlwb= `show status like 'Table_locks_waited'`;
-unlock tables;
-connection waiter;
---reap
-connection default;
-drop table t1;
-disconnect waiter;
---disable_query_log
-eval SET @tlwa= SUBSTRING_INDEX('$tlwa', ' ', -1);
-eval SET @tlwb= SUBSTRING_INDEX('$tlwb', ' ', -1);
---enable_query_log
-select @tlwa < @tlwb;
-
---echo End of 5.1 tests
-
-#
-# Test that DROP TABLES does not wait for a impending FLUSH TABLES
-# WITH READ LOCK
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (i int);
-connect (flush,localhost,root,,test,,);
-connection default;
-lock tables t1 write;
-connection flush;
---send flush tables with read lock;
-connection default;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock";
---source include/wait_condition.inc
-flush tables;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock";
---source include/wait_condition.inc
-drop table t1;
-connection flush;
---reap
-connection default;
-disconnect flush;
-
-
---echo #
---echo # Test for bug #46272 "MySQL 5.4.4, new MDL: unnecessary deadlock".
---echo #
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (c1 int primary key, c2 int, c3 int);
-insert into t1 values (1,1,0),(2,2,0),(3,3,0),(4,4,0),(5,5,0);
-begin;
-update t1 set c3=c3+1 where c2=3;
-
-connect (con46272,localhost,root,,test,,);
-connection con46272;
---echo # The below ALTER TABLE statement should wait till transaction
---echo # in connection 'default' is complete and then succeed.
---echo # It should not deadlock or fail with ER_LOCK_DEADLOCK error.
---echo # Sending:
---send alter table t1 add column c4 int;
-
-connection default;
---echo # Wait until the above ALTER TABLE gets blocked because this
---echo # connection holds SW metadata lock on table to be altered.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "alter table t1 add column c4 int";
---source include/wait_condition.inc
-
---echo # The below statement should succeed. It should not
---echo # deadlock or end with ER_LOCK_DEADLOCK error.
-update t1 set c3=c3+1 where c2=4;
-
---echo # Unblock ALTER TABLE by committing transaction.
-commit;
-
-connection con46272;
---echo # Reaping ALTER TABLE.
---reap
-
-connection default;
-disconnect con46272;
-drop table t1;
-
-
---echo #
---echo # Bug#47249 assert in MDL_global_lock::is_lock_type_compatible
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP VIEW IF EXISTS v1;
---enable_warnings
-
---echo #
---echo # Test 1: LOCK TABLES v1 WRITE, t1 READ;
---echo #
---echo # Thanks to the fact that we no longer allow DDL on tables
---echo # which are locked for write implicitly, the exact scenario
---echo # in which assert was failing is no longer repeatable.
-
-CREATE TABLE t1 ( f1 integer );
-CREATE VIEW v1 AS SELECT f1 FROM t1 ;
-
-LOCK TABLES v1 WRITE, t1 READ;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-FLUSH TABLE t1;
-UNLOCK TABLES;
-
-# Cleanup
-DROP TABLE t1;
-DROP VIEW v1;
-
---echo #
---echo # Test 2: LOCK TABLES t1 WRITE, v1 READ;
---echo #
-
-CREATE TABLE t1 ( f1 integer );
-CREATE VIEW v1 AS SELECT f1 FROM t1 ;
-
-connect (con2,localhost,root);
-LOCK TABLES t1 WRITE, v1 READ;
-FLUSH TABLE t1;
-disconnect con2;
---source include/wait_until_disconnected.inc
-
-connection default;
-LOCK TABLES t1 WRITE;
-FLUSH TABLE t1; # Assertion happened here
-
-# Cleanup
-DROP TABLE t1;
-DROP VIEW v1;
-
-
---echo #
---echo # Test for bug #50913 "Deadlock between open_and_lock_tables_derived
---echo # and MDL". Also see additional coverage in mdl_sync.test.
---echo #
---disable_warnings
-drop table if exists t1;
-drop view if exists v1;
---enable_warnings
-connect (con50913,localhost,root);
-connection default;
-create table t1 (i int);
-create view v1 as select i from t1;
-begin;
-select * from t1;
-
-connection con50913;
---echo # Sending:
---send alter table t1 add column j int
-
-connection default;
---echo # Wait until ALTER TABLE gets blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "alter table t1 add column j int";
---source include/wait_condition.inc
---echo # The below statement should try to acquire SW lock on 't1'
---echo # and therefore should get ER_LOCK_DEADLOCK error. Before
---echo # bug fix it acquired SR lock and hung on thr_lock.c lock.
---error ER_LOCK_DEADLOCK
-delete a from t1 as a where i = 1;
---echo # Unblock ALTER TABLE.
-commit;
-
-connection con50913;
---echo # Reaping ALTER TABLE;
---reap
-
-connection default;
-begin;
-select * from v1;
-
-connection con50913;
---echo # Sending:
---send alter table t1 drop column j
-
-connection default;
---echo # Wait until ALTER TABLE gets blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "alter table t1 drop column j";
---source include/wait_condition.inc
---echo # The below statement should try to acquire SW lock on 't1'
---echo # and therefore should get ER_LOCK_DEADLOCK error. Before
---echo # bug fix it acquired SR lock and hung on thr_lock.c lock.
---error ER_LOCK_DEADLOCK
-insert into v1 values (1);
---echo # Unblock ALTER TABLE.
-commit;
-
-connection con50913;
---echo # Reaping ALTER TABLE;
---reap
-
-connection default;
-disconnect con50913;
-drop view v1;
-drop table t1;
-
-
---echo #
---echo # Bug#45225 Locking: hang if drop table with no timeout
---echo #
---echo # These tests also provide function coverage for the
---echo # lock_wait_timeout server variable.
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (id int);
-
-connect(con2, localhost, root,,);
-SET SESSION lock_wait_timeout= 1;
-
---echo #
---echo # Test 1: acquire exclusive lock
---echo #
-
-connection default;
-START TRANSACTION;
-INSERT INTO t1 VALUES (1);
-
-connection con2;
---error ER_LOCK_WAIT_TIMEOUT
-DROP TABLE t1;
-
-connection default;
-COMMIT;
-
---echo #
---echo # Test 2: upgrade shared lock
---echo #
-
-connection default;
-START TRANSACTION;
-SELECT * FROM t1;
-
-connection con2;
---error ER_LOCK_WAIT_TIMEOUT
-ALTER TABLE t1 RENAME TO t2;
-
-connection default;
-COMMIT;
-
---echo #
---echo # Test 3: acquire shared lock
---echo #
-
-connection default;
-LOCK TABLE t1 WRITE;
-
-connection con2;
---error ER_LOCK_WAIT_TIMEOUT
-INSERT INTO t1(id) VALUES (2);
-
-connection default;
-UNLOCK TABLES;
-
---echo #
---echo # Test 4: table level locks
---echo #
-
-connection default;
-LOCK TABLE t1 READ;
-
-connection con2;
---error ER_LOCK_WAIT_TIMEOUT
-INSERT INTO t1(id) VALUES(4);
-
-connection default;
-UNLOCK TABLES;
-
---echo #
---echo # Test 5: Waiting on Table Definition Cache (TDC)
---echo #
-
-connect(con3, localhost, root);
-
-connection default;
-LOCK TABLE t1 READ;
-
-connection con3;
---echo # Sending:
---send FLUSH TABLES
-
-connection con2;
-let $wait_condition=
- SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for table flush" AND info = "FLUSH TABLES";
---source include/wait_condition.inc
---error ER_LOCK_WAIT_TIMEOUT
-SELECT * FROM t1;
-
-connection default;
-UNLOCK TABLES;
-
-connection con3;
---echo # Reaping: FLUSH TABLES
---reap
-
---echo #
---echo # Test 6: Timeouts in I_S queries
---echo #
-
-connection default;
-CREATE TABLE t2 (id INT);
-LOCK TABLE t2 WRITE;
-
-connection con3;
---echo # Sending:
---send DROP TABLE t1, t2
-
-connection con2;
-let $wait_condition=
- SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for table metadata lock" AND
- info = "DROP TABLE t1, t2";
---source include/wait_condition.inc
-# Note: This query causes two timeouts.
-# 1: try_acquire_high_prio_shared_mdl_lock on t1
-# 2: recover_from_failed_open on t1
-SELECT table_name, table_comment FROM information_schema.tables
- WHERE table_schema= 'test' AND table_name= 't1';
-
-connection default;
-UNLOCK TABLES;
-
-connection con3;
---echo # Reaping: DROP TABLE t1, t2
---reap
-
-connection default;
---echo # Cleanup
-disconnect con2;
-disconnect con3;
-
-
---echo #
---echo # Test for bug #51134 "Crash in MDL_lock::destroy on a concurrent
---echo # DDL workload".
---echo #
---disable_warnings
-drop tables if exists t1, t2, t3;
---enable_warnings
-connect (con1, localhost, root, , );
-connect (con2, localhost, root, , );
-connection default;
-create table t3 (i int);
-
-connection con1;
---echo # Lock 't3' so upcoming RENAME is blocked.
-lock table t3 read;
-
-connection con2;
---echo # Remember ID for this connection.
-let $ID= `select connection_id()`;
---echo # Start statement which will try to acquire two instances
---echo # of X metadata lock on the same object.
---echo # Sending:
---send rename tables t1 to t2, t2 to t3;
-
-connection default;
---echo # Wait until RENAME TABLE is blocked on table 't3'.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "rename tables t1 to t2, t2 to t3";
---source include/wait_condition.inc
---echo # Kill RENAME TABLE.
---replace_result $ID ID
-eval kill query $ID;
-
-connection con2;
---echo # RENAME TABLE should be aborted but should not crash.
---error ER_QUERY_INTERRUPTED
---reap
-
-connection con1;
-unlock tables;
-
-connection default;
-disconnect con1;
-disconnect con2;
-drop table t3;
-
-
---echo #
---echo # Test for the bug where upgradable metadata locks was acquired
---echo # even if the table to altered was temporary.
---echo # Bug found while working on the related bug #51240.
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (id INT);
-LOCK TABLE t1 WRITE;
-
-connect (con1, localhost, root);
-CREATE TEMPORARY TABLE t1 (id INT);
-# This alter should not block and timeout.
-ALTER TABLE t1 ADD COLUMN j INT;
-
-connection default;
-disconnect con1;
-UNLOCK TABLES;
-DROP TABLE t1;
-
-
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/lock_multi_bug38499.test b/mysql-test/t/lock_multi_bug38499.test
deleted file mode 100644
index b812984e516..00000000000
--- a/mysql-test/t/lock_multi_bug38499.test
+++ /dev/null
@@ -1,228 +0,0 @@
-# Bug38499 flush tables and multitable table update with derived table cause crash
-# MySQL >= 5.0
-#
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-SET @odl_sync_frm = @@global.sync_frm;
-SET @@global.sync_frm = OFF;
-
-connect (locker,localhost,root,,);
-connect (writer,localhost,root,,);
-
---connection default
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-CREATE TABLE t1( a INT, b INT );
-CREATE TABLE t2( a INT, b INT );
-INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4);
-INSERT INTO t2 VALUES (1, 1), (2, 2), (3, 3), (4, 4);
-
---echo # 1. test regular tables
---echo # 1.1. test altering of columns that multiupdate doesn't use
---echo # 1.1.1. normal mode
-
---disable_query_log
-let $i = 100;
-while ($i) {
---dec $i
-
---connection writer
- send UPDATE t1, (SELECT 1 FROM t2 t1i) d SET a = 0 WHERE 1=0;
-
---connection locker
- ALTER TABLE t1 ADD COLUMN (c INT);
- ALTER TABLE t1 DROP COLUMN c;
-
---connection writer
---reap
-}
-
---echo # 1.1.2. PS mode
-
---connection writer
-PREPARE stmt FROM 'UPDATE t1, (SELECT 1 FROM t2 t1i) d SET a = 0 WHERE 1=0';
-
-let $i = 100;
-while ($i) {
---dec $i
-
---connection writer
---send EXECUTE stmt
-
---connection locker
- ALTER TABLE t1 ADD COLUMN (c INT);
- ALTER TABLE t1 DROP COLUMN c;
-
---connection writer
---reap
-}
---enable_query_log
-
---echo # 1.2. test altering of columns that multiupdate uses
---echo # 1.2.1. normal mode
-
---connection default
-
---disable_query_log
-let $i = 100;
-while ($i) {
- dec $i;
-
---connection locker
---error 0,ER_DUP_FIELDNAME
- ALTER TABLE t1 ADD COLUMN a int(11) unsigned default NULL;
- UPDATE t1 SET a=b;
-
---connection writer
---send UPDATE t1, (SELECT 1 FROM t2 t1i) d SET a = 0 WHERE 1=0;
-
---connection locker
---error 0,ER_CANT_DROP_FIELD_OR_KEY
- ALTER TABLE t1 DROP COLUMN a;
-
---connection writer
---error 0,ER_BAD_FIELD_ERROR # unknown column error
---reap
-}
---enable_query_log
-
---echo # 1.2.2. PS mode
-
---disable_query_log
-let $i = 100;
-while ($i) {
- dec $i;
-
---connection locker
---error 0,ER_DUP_FIELDNAME
- ALTER TABLE t1 ADD COLUMN a INT;
- UPDATE t1 SET a=b;
-
---connection writer
- PREPARE stmt FROM 'UPDATE t1, (SELECT 1 FROM t2 t1i) d SET a = 0 WHERE 1=0';
---send EXECUTE stmt
-
---connection locker
---error 0,ER_CANT_DROP_FIELD_OR_KEY
- ALTER TABLE t1 DROP COLUMN a;
-
---connection writer
---error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list'
---reap
-}
---enable_query_log
---connection default
-ALTER TABLE t1 ADD COLUMN a INT;
-
---echo # 2. test UNIONs
---echo # 2.1. test altering of columns that multiupdate doesn't use
---echo # 2.1.1. normal mode
-
---disable_query_log
-let $i = 100;
-while ($i) {
---dec $i
-
---connection writer
- send UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0;
-
---connection locker
- ALTER TABLE t1 ADD COLUMN (c INT);
- ALTER TABLE t1 DROP COLUMN c;
-
---connection writer
---reap
-}
-
---echo # 2.1.2. PS mode
-
---connection writer
-PREPARE stmt FROM 'UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0';
-
-let $i = 100;
-while ($i) {
---dec $i
-
---connection writer
---send EXECUTE stmt
-
---connection locker
- ALTER TABLE t1 ADD COLUMN (c INT);
- ALTER TABLE t1 DROP COLUMN c;
-
---connection writer
---reap
-}
---enable_query_log
-
---echo # 2.2. test altering of columns that multiupdate uses
---echo # 2.2.1. normal mode
-
---connection default
-
---disable_query_log
-let $i = 100;
-while ($i) {
- dec $i;
-
---connection locker
---error 0,ER_DUP_FIELDNAME
- ALTER TABLE t1 ADD COLUMN a int(11) unsigned default NULL;
- UPDATE t1 SET a=b;
-
---connection writer
---send UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0;
-
---connection locker
---error 0,ER_CANT_DROP_FIELD_OR_KEY
- ALTER TABLE t1 DROP COLUMN a;
-
---connection writer
---error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list'
---reap
-}
---enable_query_log
-
---echo # 2.2.2. PS mode
-
---disable_query_log
-let $i = 100;
-while ($i) {
- dec $i;
-
---connection locker
---error 0,ER_DUP_FIELDNAME
- ALTER TABLE t1 ADD COLUMN a INT;
- UPDATE t1 SET a=b;
-
---connection writer
- PREPARE stmt FROM 'UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0';
---send EXECUTE stmt
-
---connection locker
---error 0,ER_CANT_DROP_FIELD_OR_KEY
- ALTER TABLE t1 DROP COLUMN a;
-
---connection writer
---error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list'
---reap
-}
---enable_query_log
---connection default
-DROP TABLE t1,t2;
-
-
-# Close connections
---disconnect locker
---disconnect writer
-
-SET @@global.sync_frm = @odl_sync_frm;
-
-# End of 5.0 tests
-
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
-
diff --git a/mysql-test/t/lock_multi_bug38691.test b/mysql-test/t/lock_multi_bug38691.test
deleted file mode 100644
index 881a0d8e502..00000000000
--- a/mysql-test/t/lock_multi_bug38691.test
+++ /dev/null
@@ -1,146 +0,0 @@
-#
-# Bug#38691 segfault/abort in ``UPDATE ...JOIN'' while
-# ``FLUSH TABLES WITH READ LOCK''
-# MySQL >= 5.0
-#
-
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-SET @odl_sync_frm = @@global.sync_frm;
-SET @@global.sync_frm = OFF;
-
-# Test to see if select will get the lock ahead of low priority update
-
-connect (locker,localhost,root,,);
-connect (writer,localhost,root,,);
-
---connection default
---disable_warnings
-DROP TABLE IF EXISTS t1,t2,t3;
---enable_warnings
-
-CREATE TABLE t1 (
- a int(11) unsigned default NULL,
- b varchar(255) default NULL,
- UNIQUE KEY a (a),
- KEY b (b)
-);
-
-INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3);
-CREATE TABLE t2 SELECT * FROM t1;
-CREATE TABLE t3 SELECT * FROM t1;
-
---echo # test altering of columns that multiupdate doesn't use
-
---echo # normal mode
-
---disable_query_log
-let $i = 100;
-while ($i) {
---dec $i
-
---connection writer
- send UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a)
- SET a = NULL WHERE t1.b <> t2.b;
-
---connection locker
- ALTER TABLE t2 ADD COLUMN (c INT);
- ALTER TABLE t2 DROP COLUMN c;
-
---connection writer
---reap
-}
-
---echo # PS mode
-
---connection writer
-PREPARE stmt FROM 'UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a)
- SET a = NULL WHERE t1.b <> t2.b';
-
-let $i = 100;
-while ($i) {
---dec $i
-
---connection writer
---send EXECUTE stmt
-
---connection locker
- ALTER TABLE t2 ADD COLUMN (c INT);
- ALTER TABLE t2 DROP COLUMN c;
-
---connection writer
---reap
-}
---enable_query_log
-
-
---echo # test altering of columns that multiupdate uses
-
---echo # normal mode
-
---connection default
-
---disable_query_log
-let $i = 100;
-while ($i) {
- dec $i;
-
---connection locker
---error 0,ER_DUP_FIELDNAME
- ALTER TABLE t2 ADD COLUMN a int(11) unsigned default NULL;
- UPDATE t2 SET a=b;
-
---connection writer
---send UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a) SET a = NULL WHERE t1.b <> t2.b
-
---connection locker
---error 0,ER_CANT_DROP_FIELD_OR_KEY
- ALTER TABLE t2 DROP COLUMN a;
-
---connection writer
---error 0,ER_BAD_FIELD_ERROR
---reap
-}
---enable_query_log
-
---echo # PS mode
-
---disable_query_log
-let $i = 100;
-while ($i) {
- dec $i;
-
---connection locker
---error 0,ER_DUP_FIELDNAME
- ALTER TABLE t2 ADD COLUMN a int(11) unsigned default NULL;
- UPDATE t2 SET a=b;
-
---connection writer
- PREPARE stmt FROM 'UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a) SET a = NULL WHERE t1.b <> t2.b';
---send EXECUTE stmt
-
---connection locker
---error 0,ER_CANT_DROP_FIELD_OR_KEY
- ALTER TABLE t2 DROP COLUMN a;
-
---connection writer
---error 0,ER_BAD_FIELD_ERROR
---reap
-
-}
---enable_query_log
---connection default
-DROP TABLE t1, t2, t3;
-
-
-# Close connections
---disconnect locker
---disconnect writer
-
-SET @@global.sync_frm = @odl_sync_frm;
-
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
-
diff --git a/mysql-test/t/lock_sync-master.opt b/mysql-test/t/lock_sync-master.opt
deleted file mode 100644
index a6700b8d18e..00000000000
--- a/mysql-test/t/lock_sync-master.opt
+++ /dev/null
@@ -1,2 +0,0 @@
---default-storage-engine=MyISAM
---innodb-defragment=0
diff --git a/mysql-test/t/lock_sync.test b/mysql-test/t/lock_sync.test
deleted file mode 100644
index af8435f7fbb..00000000000
--- a/mysql-test/t/lock_sync.test
+++ /dev/null
@@ -1,1099 +0,0 @@
-#
-# Locking related tests which use DEBUG_SYNC facility.
-#
---source include/have_debug_sync.inc
-# We need InnoDB to be able use TL_WRITE_ALLOW_WRITE type of locks in our tests.
---source include/have_innodb.inc
-# This test requires statement/mixed mode binary logging.
-# Row-based mode puts weaker serializability requirements
-# so weaker locks are acquired for it.
---source include/have_binlog_format_mixed_or_statement.inc
-# Until bug#41971 'Thread state on embedded server is always "Writing to net"'
-# is fixed this test can't be run on embedded version of server.
---source include/not_embedded.inc
-
-# Save the initial number of concurrent sessions.
---source include/count_sessions.inc
-
-
---echo #
---echo # Test how we handle locking in various cases when
---echo # we read data from MyISAM tables.
---echo #
---echo # In this test we mostly check that the SQL-layer correctly
---echo # determines the type of thr_lock.c lock for a table being
---echo # read.
---echo # I.e. that it disallows concurrent inserts when the statement
---echo # is going to be written to the binary log and therefore
---echo # should be serialized, and allows concurrent inserts when
---echo # such serialization is not necessary (e.g. when
---echo # the statement is not written to binary log).
---echo #
-
---echo # Force concurrent inserts to be performed even if the table
---echo # has gaps. This allows to simplify clean up in scripts
---echo # used below (instead of backing up table being inserted
---echo # into and then restoring it from backup at the end of the
---echo # script we can simply delete rows which were inserted).
-set @old_concurrent_insert= @@global.concurrent_insert;
-set @@global.concurrent_insert= 2;
-select @@global.concurrent_insert;
-
---echo # Prepare playground by creating tables, views,
---echo # routines and triggers used in tests.
-connect (con1, localhost, root,,);
-connect (con2, localhost, root,,);
-connection default;
---disable_warnings
-drop table if exists t0, t1, t2, t3, t4, t5;
-drop view if exists v1, v2;
-drop procedure if exists p1;
-drop procedure if exists p2;
-drop procedure if exists p3;
-drop function if exists f1;
-drop function if exists f2;
-drop function if exists f3;
-drop function if exists f4;
-drop function if exists f5;
-drop function if exists f6;
-drop function if exists f7;
-drop function if exists f8;
-drop function if exists f9;
-drop function if exists f10;
-drop function if exists f11;
-drop function if exists f12;
-drop function if exists f13;
-drop function if exists f14;
-drop function if exists f15;
-drop function if exists f16;
-drop function if exists f17;
---enable_warnings
-create table t1 (i int primary key);
-insert into t1 values (1), (2), (3), (4), (5);
-create table t2 (j int primary key);
-insert into t2 values (1), (2), (3), (4), (5);
-create table t3 (k int primary key);
-insert into t3 values (1), (2), (3);
-create table t4 (l int primary key);
-insert into t4 values (1);
-create table t5 (l int primary key);
-insert into t5 values (1);
-create view v1 as select i from t1;
-create view v2 as select j from t2 where j in (select i from t1);
-create procedure p1(k int) insert into t2 values (k);
-delimiter |;
-create function f1() returns int
-begin
- declare j int;
- select i from t1 where i = 1 into j;
- return j;
-end|
-create function f2() returns int
-begin
- declare k int;
- select i from t1 where i = 1 into k;
- insert into t2 values (k + 5);
- return 0;
-end|
-create function f3() returns int
-begin
- return (select i from t1 where i = 3);
-end|
-create function f4() returns int
-begin
- if (select i from t1 where i = 3) then
- return 1;
- else
- return 0;
- end if;
-end|
-create function f5() returns int
-begin
- insert into t2 values ((select i from t1 where i = 1) + 5);
- return 0;
-end|
-create function f6() returns int
-begin
- declare k int;
- select i from v1 where i = 1 into k;
- return k;
-end|
-create function f7() returns int
-begin
- declare k int;
- select j from v2 where j = 1 into k;
- return k;
-end|
-create function f8() returns int
-begin
- declare k int;
- select i from v1 where i = 1 into k;
- insert into t2 values (k+5);
- return k;
-end|
-create function f9() returns int
-begin
- update v2 set j=j+10 where j=1;
- return 1;
-end|
-create function f10() returns int
-begin
- return f1();
-end|
-create function f11() returns int
-begin
- declare k int;
- set k= f1();
- insert into t2 values (k+5);
- return k;
-end|
-create function f12(p int) returns int
-begin
- insert into t2 values (p);
- return p;
-end|
-create function f13(p int) returns int
-begin
- return p;
-end|
-create procedure p2(inout p int)
-begin
- select i from t1 where i = 1 into p;
-end|
-create function f14() returns int
-begin
- declare k int;
- call p2(k);
- insert into t2 values (k+5);
- return k;
-end|
-create function f15() returns int
-begin
- declare k int;
- call p2(k);
- return k;
-end|
-create function f16() returns int
-begin
- create temporary table if not exists temp1 (a int);
- insert into temp1 select * from t1;
- drop temporary table temp1;
- return 1;
-end|
-create function f17() returns int
-begin
- declare j int;
- select i from t1 where i = 1 into j;
- call p3;
- return 1;
-end|
-create procedure p3()
-begin
- create temporary table if not exists temp1 (a int);
- insert into temp1 select * from t1;
- drop temporary table temp1;
-end|
-create trigger t4_bi before insert on t4 for each row
-begin
- declare k int;
- select i from t1 where i=1 into k;
- set new.l= k+1;
-end|
-create trigger t4_bu before update on t4 for each row
-begin
- if (select i from t1 where i=1) then
- set new.l= 2;
- end if;
-end|
-create trigger t4_bd before delete on t4 for each row
-begin
- if !(select i from v1 where i=1) then
- signal sqlstate '45000';
- end if;
-end|
-create trigger t5_bi before insert on t5 for each row
-begin
- set new.l= f1()+1;
-end|
-create trigger t5_bu before update on t5 for each row
-begin
- declare j int;
- call p2(j);
- set new.l= j + 1;
-end|
-delimiter ;|
-
---echo #
---echo # Set common variables to be used by the scripts
---echo # called below.
---echo #
-let $con_aux1= con1;
-let $con_aux2= con2;
-let $table= t1;
-
-connection con1;
---echo # Cache all functions used in the tests below so statements
---echo # calling them won't need to open and lock mysql.proc table
---echo # and we can assume that each statement locks its tables
---echo # once during its execution.
---disable_result_log
-show create procedure p1;
-show create procedure p2;
-show create procedure p3;
-show create function f1;
-show create function f2;
-show create function f3;
-show create function f4;
-show create function f5;
-show create function f6;
-show create function f7;
-show create function f8;
-show create function f9;
-show create function f10;
-show create function f11;
-show create function f12;
-show create function f13;
-show create function f14;
-show create function f15;
-show create function f16;
-show create function f17;
---enable_result_log
-connection default;
-
---echo #
---echo # 1. Statements that read tables and do not use subqueries.
---echo #
-
---echo #
---echo # 1.1 Simple SELECT statement.
---echo #
---echo # No locks are necessary as this statement won't be written
---echo # to the binary log and thanks to how MyISAM works SELECT
---echo # will see version of the table prior to concurrent insert.
-let $statement= select * from t1;
-let $restore_table= ;
---source include/check_concurrent_insert.inc
-
---echo #
---echo # 1.2 Multi-UPDATE statement.
---echo #
---echo # Has to take shared locks on rows in the table being read as this
---echo # statement will be written to the binary log and therefore should
---echo # be serialized with concurrent statements.
-let $statement= update t2, t1 set j= j - 1 where i = j;
-let $restore_table= t2;
---source include/check_no_concurrent_insert.inc
-
---echo #
---echo # 1.3 Multi-DELETE statement.
---echo #
---echo # The above is true for this statement as well.
-let $statement= delete t2 from t1, t2 where i = j;
-let $restore_table= t2;
---source include/check_no_concurrent_insert.inc
-
---echo #
---echo # 1.4 DESCRIBE statement.
---echo #
---echo # This statement does not really read data from the
---echo # target table and thus does not take any lock on it.
---echo # We check this for completeness of coverage.
-lock table t1 write;
-connection con1;
---echo # This statement should not be blocked.
---disable_result_log
-describe t1;
---enable_result_log
-connection default;
-unlock tables;
-
---echo #
---echo # 1.5 SHOW statements.
---echo #
---echo # The above is true for SHOW statements as well.
-lock table t1 write;
-connection con1;
---echo # These statements should not be blocked.
-# The below test for SHOW CREATE TABLE is disabled until bug 52593
-# "SHOW CREATE TABLE is blocked if table is locked for write by another
-# connection" is fixed.
---disable_parsing
-show create table t1;
---enable_parsing
---disable_result_log
-show keys from t1;
---enable_result_log
-connection default;
-unlock tables;
-
-
---echo #
---echo # 2. Statements which read tables through subqueries.
---echo #
-
---echo #
---echo # 2.1 CALL with a subquery.
---echo #
---echo # A strong lock is not necessary as this statement is not
---echo # written to the binary log as a whole (it is written
---echo # statement-by-statement).
-let $statement= call p1((select i + 5 from t1 where i = 1));
-let $restore_table= t2;
---source include/check_concurrent_insert.inc
-
---echo #
---echo # 2.2 CREATE TABLE with a subquery.
---echo #
---echo # Has to take a strong lock on the table being read as
---echo # this statement is written to the binary log and therefore
---echo # should be serialized with concurrent statements.
-let $statement= create table t0 select * from t1;
-let $restore_table= ;
---source include/check_no_concurrent_insert.inc
-drop table t0;
-let $statement= create table t0 select j from t2 where j in (select i from t1);
-let $restore_table= ;
---source include/check_no_concurrent_insert.inc
-drop table t0;
-
---echo #
---echo # 2.3 DELETE with a subquery.
---echo #
---echo # The above is true for this statement as well.
-let $statement= delete from t2 where j in (select i from t1);
-let $restore_table= t2;
---source include/check_no_concurrent_insert.inc
-
---echo #
---echo # 2.4 MULTI-DELETE with a subquery.
---echo #
---echo # Same is true for this statement as well.
-let $statement= delete t2 from t3, t2 where k = j and j in (select i from t1);
-let $restore_table= t2;
---source include/check_no_concurrent_insert.inc
-
-
---echo #
---echo # 2.5 DO with a subquery.
---echo #
---echo # A strong lock is not necessary as it is not logged.
-let $statement= do (select i from t1 where i = 1);
-let $restore_table= ;
---source include/check_concurrent_insert.inc
-
---echo #
---echo # 2.6 INSERT with a subquery.
---echo #
---echo # Has to take a strong lock on the table being read as
---echo # this statement is written to the binary log and therefore
---echo # should be serialized with concurrent inserts.
-let $statement= insert into t2 select i+5 from t1;
-let $restore_table= t2;
---source include/check_no_concurrent_insert.inc
-let $statement= insert into t2 values ((select i+5 from t1 where i = 4));
-let $restore_table= t2;
---source include/check_no_concurrent_insert.inc
-
---echo #
---echo # 2.7 LOAD DATA with a subquery.
---echo #
---echo # The above is true for this statement as well.
-let $statement= load data infile '../../std_data/rpl_loaddata.dat' into table t2 (@a, @b) set j= @b + (select i from t1 where i = 1);
-let $restore_table= t2;
---source include/check_no_concurrent_insert.inc
-
---echo #
---echo # 2.8 REPLACE with a subquery.
---echo #
---echo # Same is true for this statement as well.
-
---echo # Suppress warnings for REPLACE ... SELECT
---disable_query_log
-call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
---enable_query_log
-
-let $statement= replace into t2 select i+5 from t1;
-let $restore_table= t2;
---source include/check_no_concurrent_insert.inc
-let $statement= replace into t2 values ((select i+5 from t1 where i = 4));
-let $restore_table= t2;
---source include/check_no_concurrent_insert.inc
-
---echo #
---echo # 2.9 SELECT with a subquery.
---echo #
---echo # Strong locks are not necessary as this statement is not written
---echo # to the binary log and thanks to how MyISAM works this statement
---echo # sees a version of the table prior to the concurrent insert.
-let $statement= select * from t2 where j in (select i from t1);
-let $restore_table= ;
---source include/check_concurrent_insert.inc
-
---echo #
---echo # 2.10 SET with a subquery.
---echo #
---echo # The same is true for this statement as well.
-let $statement= set @a:= (select i from t1 where i = 1);
-let $restore_table= ;
---source include/check_concurrent_insert.inc
-
---echo #
---echo # 2.11 SHOW with a subquery.
---echo #
---echo # And for this statement too.
-let $statement= show tables from test where Tables_in_test = 't2' and (select i from t1 where i = 1);
-let $restore_table= ;
---source include/check_concurrent_insert.inc
-let $statement= show columns from t2 where (select i from t1 where i = 1);
-let $restore_table= ;
---source include/check_concurrent_insert.inc
-
---echo #
---echo # 2.12 UPDATE with a subquery.
---echo #
---echo # Has to take a strong lock on the table being read as
---echo # this statement is written to the binary log and therefore
---echo # should be serialized with concurrent inserts.
-let $statement= update t2 set j= j-10 where j in (select i from t1);
-let $restore_table= t2;
---source include/check_no_concurrent_insert.inc
-
---echo #
---echo # 2.13 MULTI-UPDATE with a subquery.
---echo #
---echo # Same is true for this statement as well.
-let $statement= update t2, t3 set j= j -10 where j=k and j in (select i from t1);
-let $restore_table= t2;
---source include/check_no_concurrent_insert.inc
-
-
---echo #
---echo # 3. Statements which read tables through a view.
---echo #
-
---echo #
---echo # 3.1 SELECT statement which uses some table through a view.
---echo #
---echo # Since this statement is not written to the binary log and
---echo # an old version of the table is accessible thanks to how MyISAM
---echo # handles concurrent insert, no locking is necessary.
-let $statement= select * from v1;
-let $restore_table= ;
---source include/check_concurrent_insert.inc
-let $statement= select * from v2;
-let $restore_table= ;
---source include/check_concurrent_insert.inc
-let $statement= select * from t2 where j in (select i from v1);
-let $restore_table= ;
---source include/check_concurrent_insert.inc
-let $statement= select * from t3 where k in (select j from v2);
-let $restore_table= ;
---source include/check_concurrent_insert.inc
-
---echo #
---echo # 3.2 Statements which modify a table and use views.
---echo #
---echo # Since such statements are going to be written to the binary
---echo # log they need to be serialized against concurrent statements
---echo # and therefore should take strong locks on the data read.
-let $statement= update t2 set j= j-10 where j in (select i from v1);
-let $restore_table= t2;
---source include/check_no_concurrent_insert.inc
-let $statement= update t3 set k= k-10 where k in (select j from v2);
-let $restore_table= t2;
---source include/check_no_concurrent_insert.inc
-let $statement= update t2, v1 set j= j-10 where j = i;
-let $restore_table= t2;
---source include/check_no_concurrent_insert.inc
-let $statement= update v2 set j= j-10 where j = 3;
-let $restore_table= t2;
---source include/check_no_concurrent_insert.inc
-
-
---echo #
---echo # 4. Statements which read tables through stored functions.
---echo #
-
---echo #
---echo # 4.1 SELECT/SET with a stored function which does not
---echo # modify data and uses SELECT in its turn.
---echo #
---echo # There is no need to take strong locks on the table
---echo # being selected from in SF as the call to such function
---echo # won't get into the binary log.
-let $statement= select f1();
-let $restore_table= ;
---source include/check_concurrent_insert.inc
-let $statement= set @a:= f1();
-let $restore_table= ;
---source include/check_concurrent_insert.inc
-
---echo #
---echo # 4.2 INSERT (or other statement which modifies data) with
---echo # a stored function which does not modify data and uses
---echo # SELECT.
---echo #
---echo # Since such statement is written to the binary log it should
---echo # be serialized with concurrent statements affecting the data
---echo # it uses. Therefore it should take strong lock on the data
---echo # it reads.
-let $statement= insert into t2 values (f1() + 5);
-let $restore_table= t2;
---source include/check_no_concurrent_insert.inc
-
---echo #
---echo # 4.3 SELECT/SET with a stored function which
---echo # reads and modifies data.
---echo #
---echo # Since a call to such function is written to the binary log,
---echo # it should be serialized with concurrent statements affecting
---echo # the data it uses. Hence, a strong lock on the data read
---echo # should be taken.
-let $statement= select f2();
-let $restore_table= t2;
---source include/check_no_concurrent_insert.inc
-let $statement= set @a:= f2();
-let $restore_table= t2;
---source include/check_no_concurrent_insert.inc
-
---echo #
---echo # 4.4. SELECT/SET with a stored function which does not
---echo # modify data and reads a table through subselect
---echo # in a control construct.
---echo #
---echo # Call to this function won't get to the
---echo # binary log and thus no strong lock is needed.
-let $statement= select f3();
-let $restore_table= ;
---source include/check_concurrent_insert.inc
-let $statement= set @a:= f3();
-let $restore_table= ;
---source include/check_concurrent_insert.inc
-let $statement= select f4();
-let $restore_table= ;
---source include/check_concurrent_insert.inc
-let $statement= set @a:= f4();
-let $restore_table= ;
---source include/check_concurrent_insert.inc
-
---echo #
---echo # 4.5. INSERT (or other statement which modifies data) with
---echo # a stored function which does not modify data and reads
---echo # the table through a subselect in one of its control
---echo # constructs.
---echo #
---echo # Since such statement is written to the binary log it should
---echo # be serialized with concurrent statements affecting data it
---echo # uses. Therefore it should take a strong lock on the data
---echo # it reads.
-let $statement= insert into t2 values (f3() + 5);
-let $restore_table= t2;
---source include/check_no_concurrent_insert.inc
-let $statement= insert into t2 values (f4() + 6);
-let $restore_table= t2;
---source include/check_no_concurrent_insert.inc
-
---echo #
---echo # 4.6 SELECT/SET which uses a stored function with
---echo # DML which reads a table via a subquery.
---echo #
---echo # Since call to such function is written to the binary log
---echo # it should be serialized with concurrent statements.
---echo # Hence reads should take a strong lock.
-let $statement= select f5();
-let $restore_table= t2;
---source include/check_no_concurrent_insert.inc
-let $statement= set @a:= f5();
-let $restore_table= t2;
---source include/check_no_concurrent_insert.inc
-
---echo #
---echo # 4.7 SELECT/SET which uses a stored function which
---echo # doesn't modify data and reads tables through
---echo # a view.
---echo #
---echo # Calls to such functions won't get into
---echo # the binary log and thus don't need strong
---echo # locks.
-let $statement= select f6();
-let $restore_table= t2;
---source include/check_concurrent_insert.inc
-let $statement= set @a:= f6();
-let $restore_table= t2;
---source include/check_concurrent_insert.inc
-let $statement= select f7();
-let $restore_table= t2;
---source include/check_concurrent_insert.inc
-let $statement= set @a:= f7();
-let $restore_table= t2;
---source include/check_concurrent_insert.inc
-
---echo #
---echo # 4.8 INSERT which uses stored function which
---echo # doesn't modify data and reads a table
---echo # through a view.
---echo #
---echo # Since such statement is written to the binary log and
---echo # should be serialized with concurrent statements affecting
---echo # the data it uses. Therefore it should take a strong lock on
---echo # the table it reads.
-let $statement= insert into t3 values (f6() + 5);
-let $restore_table= t3;
---source include/check_no_concurrent_insert.inc
-let $statement= insert into t3 values (f7() + 5);
-let $restore_table= t3;
---source include/check_no_concurrent_insert.inc
-
-
---echo #
---echo # 4.9 SELECT which uses a stored function which
---echo # modifies data and reads tables through a view.
---echo #
---echo # Since a call to such function is written to the binary log
---echo # it should be serialized with concurrent statements.
---echo # Hence, reads should take strong locks.
-let $statement= select f8();
-let $restore_table= t2;
---source include/check_no_concurrent_insert.inc
-let $statement= select f9();
-let $restore_table= t2;
---source include/check_no_concurrent_insert.inc
-
---echo #
---echo # 4.10 SELECT which uses a stored function which doesn't modify
---echo # data and reads a table indirectly, by calling another
---echo # function.
---echo #
---echo # Calls to such functions won't get into the binary
---echo # log and thus don't need to acquire strong locks.
-let $statement= select f10();
-let $restore_table= ;
---source include/check_concurrent_insert.inc
-
---echo #
---echo # 4.11 INSERT which uses a stored function which doesn't modify
---echo # data and reads a table indirectly, by calling another
---echo # function.
---echo #
---echo # Since such statement is written to the binary log, it should
---echo # be serialized with concurrent statements affecting the data it
---echo # uses. Therefore it should take strong locks on data it reads.
-let $statement= insert into t2 values (f10() + 5);
-let $restore_table= t2;
---source include/check_no_concurrent_insert.inc
-
---echo #
---echo # 4.12 SELECT which uses a stored function which modifies
---echo # data and reads a table indirectly, by calling another
---echo # function.
---echo #
---echo # Since a call to such function is written to the binary log
---echo # it should be serialized from concurrent statements.
---echo # Hence, read should take a strong lock.
-let $statement= select f11();
-let $restore_table= t2;
---source include/check_no_concurrent_insert.inc
-
---echo #
---echo # 4.13 SELECT that reads a table through a subquery passed
---echo # as a parameter to a stored function which modifies
---echo # data.
---echo #
---echo # Even though a call to this function is written to the
---echo # binary log, values of its parameters are written as literals.
---echo # So there is no need to acquire strong locks for tables used in
---echo # the subquery.
-let $statement= select f12((select i+10 from t1 where i=1));
-let $restore_table= t2;
---source include/check_concurrent_insert.inc
-
---echo #
---echo # 4.14 INSERT that reads a table via a subquery passed
---echo # as a parameter to a stored function which doesn't
---echo # modify data.
---echo #
---echo # Since this statement is written to the binary log it should
---echo # be serialized with concurrent statements affecting the data it
---echo # uses. Therefore it should take strong locks on the data it reads.
-let $statement= insert into t2 values (f13((select i+10 from t1 where i=1)));
-let $restore_table= t2;
---source include/check_no_concurrent_insert.inc
-
---echo #
---echo # 4.15 SELECT/SET with a stored function which
---echo # inserts data into a temporary table using
---echo # SELECT on t1.
---echo #
---echo # Since this statement is written to the binary log it should
---echo # be serialized with concurrent statements affecting the data it
---echo # uses. Therefore it should take strong locks on the data it reads.
-let $statement= select f16();
-let $restore_table= ;
---source include/check_no_concurrent_insert.inc
-let $statement= set @a:= f16();
-let $restore_table= ;
---source include/check_no_concurrent_insert.inc
-
---echo #
---echo # 4.16 SELECT/SET with a stored function which call procedure
---echo # which inserts data into a temporary table using
---echo # SELECT on t1.
---echo #
---echo # Since this statement is written to the binary log it should
---echo # be serialized with concurrent statements affecting the data it
---echo # uses. Therefore it should take strong locks on the data it reads.
-let $statement= select f17();
-let $restore_table= ;
---source include/check_no_concurrent_insert.inc
-let $statement= set @a:= f17();
-let $restore_table= ;
---source include/check_no_concurrent_insert.inc
-
-
---echo #
---echo # 5. Statements that read tables through stored procedures.
---echo #
-
---echo #
---echo # 5.1 CALL statement which reads a table via SELECT.
---echo #
---echo # Since neither this statement nor its components are
---echo # written to the binary log, there is no need to take
---echo # strong locks on the data it reads.
-let $statement= call p2(@a);
-let $restore_table= ;
---source include/check_concurrent_insert.inc
-
---echo #
---echo # 5.2 Function that modifies data and uses CALL,
---echo # which reads a table through SELECT.
---echo #
---echo # Since a call to such function is written to the binary
---echo # log, it should be serialized with concurrent statements.
---echo # Hence, in this case reads should take strong locks on data.
-let $statement= select f14();
-let $restore_table= t2;
---source include/check_no_concurrent_insert.inc
-
---echo #
---echo # 5.3 SELECT that calls a function that doesn't modify data and
---echo # uses a CALL statement that reads a table via SELECT.
---echo #
---echo # Calls to such functions won't get into the binary
---echo # log and thus don't need to acquire strong locks.
-let $statement= select f15();
-let $restore_table= ;
---source include/check_concurrent_insert.inc
-
---echo #
---echo # 5.4 INSERT which calls function which doesn't modify data and
---echo # uses CALL statement which reads table through SELECT.
---echo #
---echo # Since such statement is written to the binary log it should
---echo # be serialized with concurrent statements affecting data it
---echo # uses. Therefore it should take strong locks on data it reads.
-let $statement= insert into t2 values (f15()+5);
-let $restore_table= t2;
---source include/check_no_concurrent_insert.inc
-
-
---echo #
---echo # 6. Statements that use triggers.
---echo #
-
---echo #
---echo # 6.1 Statement invoking a trigger that reads table via SELECT.
---echo #
---echo # Since this statement is written to the binary log it should
---echo # be serialized with concurrent statements affecting the data
---echo # it uses. Therefore, it should take strong locks on the data
---echo # it reads.
-let $statement= insert into t4 values (2);
-let $restore_table= t4;
---source include/check_no_concurrent_insert.inc
-
---echo #
---echo # 6.2 Statement invoking a trigger that reads table through
---echo # a subquery in a control construct.
---echo #
---echo # The above is true for this statement as well.
-let $statement= update t4 set l= 2 where l = 1;
-let $restore_table= t4;
---source include/check_no_concurrent_insert.inc
-
---echo #
---echo # 6.3 Statement invoking a trigger that reads a table through
---echo # a view.
---echo #
---echo # And for this statement.
-let $statement= delete from t4 where l = 1;
-let $restore_table= t4;
---source include/check_no_concurrent_insert.inc
-
---echo #
---echo # 6.4 Statement invoking a trigger that reads a table through
---echo # a stored function.
---echo #
---echo # And for this statement.
-let $statement= insert into t5 values (2);
-let $restore_table= t5;
---source include/check_no_concurrent_insert.inc
-
---echo #
---echo # 6.5 Statement invoking a trigger that reads a table through
---echo # stored procedure.
---echo #
---echo # And for this statement.
-let $statement= update t5 set l= 2 where l = 1;
-let $restore_table= t5;
---source include/check_no_concurrent_insert.inc
-
---echo # Clean-up.
-drop function f1;
-drop function f2;
-drop function f3;
-drop function f4;
-drop function f5;
-drop function f6;
-drop function f7;
-drop function f8;
-drop function f9;
-drop function f10;
-drop function f11;
-drop function f12;
-drop function f13;
-drop function f14;
-drop function f15;
-drop function f16;
-drop function f17;
-drop view v1, v2;
-drop procedure p1;
-drop procedure p2;
-drop procedure p3;
-drop table t1, t2, t3, t4, t5;
-
-disconnect con1;
-disconnect con2;
-
-set @@global.concurrent_insert= @old_concurrent_insert;
-
-
---echo #
---echo # Bug#50821 Deadlock between LOCK TABLES and ALTER TABLE
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-CREATE TABLE t1(id INT);
-CREATE TABLE t2(id INT);
-
-connect (con2, localhost, root);
-START TRANSACTION;
-SELECT * FROM t1;
-
-connection default;
---echo # Sending:
---send ALTER TABLE t1 ADD COLUMN j INT
-
-connection con2;
-let $wait_condition=
- SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for table metadata lock"
- AND info = "ALTER TABLE t1 ADD COLUMN j INT";
---source include/wait_condition.inc
-
---echo # This used to cause a deadlock.
-INSERT INTO t2 SELECT * FROM t1;
-
-COMMIT;
-
-connection default;
---echo # Reaping ALTER TABLE t1 ADD COLUMN j INT
---reap
-
-DROP TABLE t1, t2;
-disconnect con2;
-
-
---echo #
---echo # Bug#51391 Deadlock involving events during rqg_info_schema test
---echo #
-
-CREATE EVENT e1 ON SCHEDULE EVERY 5 HOUR DO SELECT 1;
-CREATE EVENT e2 ON SCHEDULE EVERY 5 HOUR DO SELECT 2;
-
-connect(con1, localhost, root);
-SET DEBUG_SYNC="before_lock_tables_takes_lock SIGNAL drop WAIT_FOR query";
---echo # Sending:
---send DROP EVENT e1;
-
-connection default;
-SET DEBUG_SYNC="now WAIT_FOR drop";
-SELECT name FROM mysql.event, INFORMATION_SCHEMA.GLOBAL_VARIABLES
- WHERE definer = VARIABLE_VALUE;
-SET DEBUG_SYNC="now SIGNAL query";
-
-connection con1;
---echo # Reaping: DROP EVENT t1
---reap
-disconnect con1;
---source include/wait_until_disconnected.inc
-
-connection default;
-DROP EVENT e2;
-SET DEBUG_SYNC="RESET";
-
-
---echo #
---echo # Bug#57130 crash in Item_field::print during SHOW CREATE TABLE or VIEW
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP VIEW IF EXISTS v1;
-DROP FUNCTION IF EXISTS f1;
---enable_warnings
-
-CREATE TABLE t1(a INT);
-CREATE FUNCTION f1() RETURNS INTEGER RETURN 1;
-CREATE VIEW v1 AS SELECT * FROM t1 WHERE f1() = 1;
-DROP FUNCTION f1;
-connect(con2, localhost, root);
-
-connect (con1, localhost, root);
-# Need to trigger this sync point at least twice in order to
-# get valgrind test failures without the patch
-SET DEBUG_SYNC= 'open_tables_after_open_and_process_table SIGNAL opened WAIT_FOR dropped EXECUTE 2';
---echo # Sending:
---send SHOW CREATE VIEW v1
-
-connection con2;
-SET DEBUG_SYNC= 'now WAIT_FOR opened';
-SET DEBUG_SYNC= 'now SIGNAL dropped';
-SET DEBUG_SYNC= 'now WAIT_FOR opened';
---echo # Sending:
---send FLUSH TABLES
-
-connection default;
---echo # Waiting for FLUSH TABLES to be blocked.
-let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state= 'Waiting for table flush' AND info= 'FLUSH TABLES';
---source include/wait_condition.inc
-SET DEBUG_SYNC= 'now SIGNAL dropped';
-
-connection con1;
---echo # Reaping: SHOW CREATE VIEW v1
---reap
-
-connection con2;
---echo # Reaping: FLUSH TABLES
---reap
-
-connection default;
-SET DEBUG_SYNC= 'RESET';
-DROP VIEW v1;
-DROP TABLE t1;
-disconnect con1;
-disconnect con2;
-
-
---echo #
---echo # Bug#28587 SELECT is blocked by INSERT waiting on read lock, even with low_priority_updates
---echo #
-set low_priority_updates=1;
---disable_warnings
-drop table if exists t1;
-drop table if exists t2;
---enable_warnings
-set debug_sync='RESET';
-create table t1 (a int, b int, unique key t1$a (a));
-create table t2 (j int, k int);
-set debug_sync='after_lock_tables_takes_lock SIGNAL parked WAIT_FOR go';
---echo # Sending:
---send insert into t2 select * from t1;
-connect (update,localhost,root,,);
-connection update;
-set debug_sync='now WAIT_FOR parked';
-set low_priority_updates=1;
-show variables like 'low_priority_updates';
-let $ID= `select connection_id()`;
---send insert into t1 values (1, 2) ON DUPLICATE KEY UPDATE b = 2;
-connect (select,localhost,root,,);
-# we must wait till the insert opens and locks the table
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table level lock" and id = $ID;
---source include/wait_condition.inc
-select * from t1;
-set debug_sync='now SIGNAL go';
-connection default;
-disconnect update;
-disconnect select;
---echo # Reaping INSERT SELECT
---reap
-drop tables t1, t2;
-set low_priority_updates=default;
-set debug_sync='RESET';
-
-
---echo #
---echo # Additional test coverage for LOCK TABLES ... READ LOCAL
---echo # for InnoDB tables.
---echo #
---echo # Check that we correctly handle deadlocks which can occur
---echo # during metadata lock upgrade which happens when one tries
---echo # to use LOCK TABLES ... READ LOCAL for InnoDB tables.
-
---enable_connect_log
-CREATE TABLE t1 (i INT) ENGINE=InnoDB;
-CREATE TABLE t2 (j INT) ENGINE=InnoDB;
-
---echo # Execute LOCK TABLE READ LOCK which will pause after acquiring
---echo # SR metadata lock and before upgrading it to SRO lock.
-SET DEBUG_SYNC="after_open_table_mdl_shared SIGNAL locked WAIT_FOR go";
---echo # Sending:
---send LOCK TABLE t1 READ LOCAL
-
-connect (con1, localhost, root);
-SET DEBUG_SYNC="now WAIT_FOR locked";
---echo # Execute RENAME TABLE which will try to acquire X lock.
---echo # Sending:
---send RENAME TABLE t1 TO t3, t2 TO t1, t3 TO t2
-
-connect (con2, localhost, root);
---echo # Wait until RENAME TABLE is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "RENAME TABLE t1 TO t3, t2 TO t1, t3 TO t2";
---source include/wait_condition.inc
---echo # Resume LOCK TABLE statement. It should try to
---echo # upgrade SR lock to SRO lock which will create
---echo # deadlock due to presence of pending X lock.
---echo # Deadlock should be detected and LOCK TABLES should
---echo # release its MDL and retry opening of tables.
-SET DEBUG_SYNC="now SIGNAL go";
-
-connection con1;
---echo # RENAME TABLE should be able to complete. Reap it.
---reap
-
-connection default;
---echo # Reap LOCK TABLES.
---reap
---echo # Check that we see new version of table.
-SELECT * FROM t1;
-UNLOCK TABLES;
-
---echo # Clean-up.
-SET DEBUG_SYNC="RESET";
-disconnect con1;
-disconnect con2;
-DROP TABLES t1, t2;
---disable_connect_log
-
-# 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
diff --git a/mysql-test/t/lock_tables_lost_commit-master.opt b/mysql-test/t/lock_tables_lost_commit-master.opt
deleted file mode 100644
index 51ccb915ef0..00000000000
--- a/mysql-test/t/lock_tables_lost_commit-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---binlog-ignore-db=test
diff --git a/mysql-test/t/lock_tables_lost_commit.test b/mysql-test/t/lock_tables_lost_commit.test
deleted file mode 100644
index 754c8f3c378..00000000000
--- a/mysql-test/t/lock_tables_lost_commit.test
+++ /dev/null
@@ -1,33 +0,0 @@
-# Test for Bug#578 mysqlimport -l silently fails when binlog-ignore-db is set
-
---source include/have_innodb.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-
-connection con1;
---disable_warnings
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1(a INT) ENGINE=innodb;
---enable_warnings
-LOCK TABLES t1 WRITE;
-INSERT INTO t1 VALUES(10);
-disconnect con1;
-
-connection con2;
-# The bug was that, because of the LOCK TABLES, the handler "forgot" to commit,
-# and the other commit when we write to the binlog was not done because of
-# binlog-ignore-db
-SELECT * FROM t1;
-DROP TABLE t1;
-
-connection default;
-disconnect con2;
-
-# End of 4.1 tests
-
-# Wait till we reached the initial number of concurrent sessions
---source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/locked_temporary-5955.test b/mysql-test/t/locked_temporary-5955.test
deleted file mode 100644
index 1ade63f4913..00000000000
--- a/mysql-test/t/locked_temporary-5955.test
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-# MDEV-5955 Server crashes in handler::ha_external_lock or assertion `m_lock_type == 2' fails in handler::ha_close on disconnect with a locked temporary table
-#
-
---source include/have_innodb.inc
---connect (con1,localhost,root,,)
-CREATE TEMPORARY TABLE tmp (i INT) ENGINE=InnoDB;
-LOCK TABLES tmp AS p WRITE;
---disconnect con1
-
diff --git a/mysql-test/t/log_errchk.test b/mysql-test/t/log_errchk.test
deleted file mode 100644
index 2808458e9f1..00000000000
--- a/mysql-test/t/log_errchk.test
+++ /dev/null
@@ -1,65 +0,0 @@
-#
---source include/not_windows.inc
---source include/not_embedded.inc
-
-#
-# Bug#14757009 : WHEN THE GENERAL_LOG IS A SOCKET AND THE READER GOES AWAY,
-# MYSQL QUITS WORKING.
-#
-# MDEV-6870 Not possible to use FIFO file as a general_log file
-#
-
---let $gen_log_file= $MYSQLTEST_VARDIR/tmp/general_log.fifo
---let $slow_query_log_file= $MYSQLTEST_VARDIR/tmp/slow_log.fifo
---let GREP_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err
-
---exec mkfifo $gen_log_file
---exec mkfifo $slow_query_log_file
-
---echo # Case 1: Setting fifo file to general_log_file and slow_query_log_file
---echo # system variable.
-# Setting fifo file to general log reports an error because the other end is closed
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---error ER_WRONG_VALUE_FOR_VAR
---eval SET GLOBAL general_log_file="$gen_log_file";
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---error ER_WRONG_VALUE_FOR_VAR
---eval SET GLOBAL slow_query_log_file="$slow_query_log_file";
-
---echo # Case 2: Starting server with fifo file as general log file
---echo # and slow query log file.
-# Restart server with fifo file as general log file.
---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server 60
---source include/wait_until_disconnected.inc
---enable_reconnect
-# Write file to make mysql-test-run.pl start up the server again
---exec echo "restart: --general-log-file=$gen_log_file --slow-query-log-file=$slow_query_log_file" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---source include/wait_until_connected_again.inc
-
-# Error 6 is reported, because the other end is closed
-call mtr.add_suppression("Could not use .* for logging \\(error 6\\)");
-call mtr.add_suppression("File '.*' not found \\(Errcode: 6 ");
---perl
- my $file= $ENV{'GREP_FILE'};
- my $pattern= "for logging \\(error 6\\)\\. Turning logging off for the whole duration";
- open(FILE, "$file") or die("Unable to open $file: $!\n");
- my $count = 0;
- while (<FILE>) {
- if ($_ =~ m/$pattern/) {
- $count++;
- break;
- }
- }
- if ($count >= 2){
- print "Setting fifo file as general log file and slow query log failed.\n";
- } else {
- print "test failed.\n";
- }
- close(FILE);
-EOF
-
-# Cleanup
---remove_file $gen_log_file
---remove_file $slow_query_log_file
diff --git a/mysql-test/t/log_slow.test b/mysql-test/t/log_slow.test
deleted file mode 100644
index 56e35bd5a20..00000000000
--- a/mysql-test/t/log_slow.test
+++ /dev/null
@@ -1,60 +0,0 @@
-#
-# Testing of slow log query options
-#
-
-select @@log_slow_filter;
-select @@log_slow_rate_limit;
-select @@log_slow_verbosity;
-show variables like "log_slow%";
-set @org_slow_query_log= @@global.slow_query_log;
-
-# Some simple test to set log_slow_filter
-set @@log_slow_filter= "filesort,filesort_on_disk,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk,admin";
-select @@log_slow_filter;
-set @@log_slow_filter="admin,admin";
-select @@log_slow_filter;
-set @@log_slow_filter=7;
-select @@log_slow_filter;
-
-# Test of wrong values
---error 1231
-set @@log_slow_filter= "filesort,impossible,impossible2,admin";
---error 1231
-set @@log_slow_filter= "filesort, admin";
---error 1231
-set @@log_slow_filter= 1<<31;
-select @@log_slow_filter;
-
-# Some simple test to set log_slow_verbosity
-set @@log_slow_verbosity= "query_plan,innodb";
-select @@log_slow_verbosity;
-set @@log_slow_verbosity=1;
-select @@log_slow_verbosity;
-
-#
-# Check which fields are in slow_log table
-#
-
-show fields from mysql.slow_log;
-
-#
-# Check flush command
-#
-
-flush slow logs;
-
-# MDEV-4206 (empty filter should be no filter)
-set long_query_time=0.1;
-set log_slow_filter='';
-set global slow_query_log=1;
-set global log_output='TABLE';
-select sleep(0.5);
-select count(*) FROM mysql.slow_log;
-
-# Reset used variables
-set @@long_query_time=default;
-set global slow_query_log= @org_slow_query_log;
-set @@log_slow_filter=default;
-set @@log_slow_verbosity=default;
-set global log_output= default;
-truncate mysql.slow_log;
diff --git a/mysql-test/t/log_state-master.opt b/mysql-test/t/log_state-master.opt
deleted file mode 100644
index 858bf269a7d..00000000000
--- a/mysql-test/t/log_state-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---log-output=TABLE,FILE --general-log=0 --slow-query-log=0
diff --git a/mysql-test/t/log_state.test b/mysql-test/t/log_state.test
deleted file mode 100644
index 5a08b8015f0..00000000000
--- a/mysql-test/t/log_state.test
+++ /dev/null
@@ -1,342 +0,0 @@
-### t/log_state.test ###
-#
-
---source include/not_embedded.inc
---source include/have_csv.inc
-
-call mtr.add_suppression("options .* --log_slow_queries is not set");
-
-# Several subtests modify global variables. Save the initial values only here,
-# but reset to the initial values per subtest.
-SET @old_general_log= @@global.general_log;
-SET @old_general_log_file= @@global.general_log_file;
-SET @old_slow_query_log= @@global.slow_query_log;
-SET @old_slow_query_log_file= @@global.slow_query_log_file;
-
-
---disable_ps_protocol
-
-set global general_log= OFF;
-truncate table mysql.general_log;
-truncate table mysql.slow_log;
-show global variables
-where Variable_name = 'general_log' or Variable_name = 'slow_query_log';
-flush logs;
-set global general_log= ON;
-create table t1(f1 int);
---replace_column 1 TIMESTAMP 2 USER_HOST 3 #
-select * from mysql.general_log;
-set global general_log= OFF;
-drop table t1;
---replace_column 1 TIMESTAMP 2 USER_HOST 3 #
-select * from mysql.general_log;
-set global general_log= ON;
-flush logs;
-show global variables
-where Variable_name = 'general_log' or Variable_name = 'slow_query_log';
-
-connect (con1,localhost,root,,);
-connection con1;
-# Please increase @long_query_time if the corresponding selects show an
-# additional unexpected entry like
-# start_time ... sql_text
-# TIMESTAMP ... set session long_query_time=...
-# (Bug#40377 sporadic pushbuild failure in log_state: result mismatch)
---replace_result 2 <long_query_time>
-set @long_query_time = 2;
-set session long_query_time = @long_query_time;
-select sleep(@long_query_time + 1);
---replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME 12 THREAD_ID
-select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%';
-connection default;
-
-set global slow_query_log= ON;
-set local slow_query_log= ON;
-connection con1;
-set session long_query_time = @long_query_time;
-select sleep(@long_query_time + 1);
---replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME 12 THREAD_ID
-select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%';
-set local slow_query_log= ON;
-select sleep(@long_query_time + 2);
---replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME 12 THREAD_ID
-select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%';
-
-connection default;
-show global variables
-where Variable_name = 'general_log' or Variable_name = 'slow_query_log';
-
-set global general_log= ON;
-set global general_log= OFF;
-set global general_log= OFF;
-set global slow_query_log= ON;
-set global slow_query_log= OFF;
-set global slow_query_log= OFF;
-set local slow_query_log= ON;
-
-set global general_log= ON;
-truncate table mysql.general_log;
-create table t1(f1 int);
-drop table t1;
---replace_column 1 TIMESTAMP 2 USER_HOST 3 #
-select * from mysql.general_log;
-set global general_log= OFF;
-truncate table mysql.general_log;
---replace_column 1 TIMESTAMP 2 USER_HOST 3 #
-select * from mysql.general_log;
-set global general_log= ON;
-show global variables
-where Variable_name = 'general_log' or Variable_name = 'slow_query_log';
-
---replace_column 2 #
-show variables like 'general_log_file';
---replace_column 2 #
-show variables like 'slow_query_log_file';
-show variables like 'log_output';
-
-# Can't set general_log_file to a non existing file
---error ER_WRONG_VALUE_FOR_VAR
-set global general_log_file='/not existing path/log.master';
-
-# Can't set general_log_file to a directory
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---error ER_WRONG_VALUE_FOR_VAR
-eval set global general_log_file='$MYSQLTEST_VARDIR';
-
-# Can't set general_log_file to empty string
---error ER_WRONG_VALUE_FOR_VAR
-set global general_log_file='';
-
---replace_column 2 #
-show variables like 'general_log_file';
-set global general_log= OFF;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval set global general_log_file='$MYSQLTEST_VARDIR/tmp/log.master';
-set global general_log= ON;
-create table t1(f1 int);
-drop table t1;
-set global general_log= OFF;
-set global general_log_file=default;
-set global general_log= ON;
-create table t1(f1 int);
-drop table t1;
---replace_column 2 #
-show variables like 'general_log_file';
---replace_column 2 #
-show variables like 'slow_query_log_file';
-
-set global general_log= default;
-set global slow_query_log= default;
-set global general_log_file= default;
-set global slow_query_log_file= default;
-show variables like 'general_log';
-show variables like 'slow_query_log';
-show global variables like 'slow_query_log';
-set global general_log=ON;
-set global log_output=default;
-show variables like 'log_output';
-set global general_log=OFF;
-set global log_output=FILE;
-truncate table mysql.general_log;
-show variables like 'log_output';
-set global general_log=ON;
-create table t1(f1 int);
---replace_column 1 TIMESTAMP 2 USER_HOST 3 #
-select * from mysql.general_log;
-set global general_log=OFF;
-set global log_output="FILE,TABLE";
-show variables like 'log_output';
-set global general_log=ON;
-drop table t1;
---replace_column 1 TIMESTAMP 2 USER_HOST 3 #
-select * from mysql.general_log;
-
-# Reset to initial values
-SET @@global.general_log = @old_general_log;
-SET @@global.general_log_file = @old_general_log_file;
-SET @@global.slow_query_log = @old_slow_query_log;
-SET @@global.slow_query_log_file = @old_slow_query_log_file;
-
-###########################################################################
-
-#
-# Bug#29129 (Resetting general_log while the GLOBAL READ LOCK is set causes
-# a deadlock)
-#
-
-# Test ON->OFF transition under a GLOBAL READ LOCK
-SET GLOBAL general_log = ON;
-SET GLOBAL slow_query_log = ON;
-
-FLUSH TABLES WITH READ LOCK;
-
-SET GLOBAL general_log = OFF;
-SET GLOBAL slow_query_log = OFF;
-
-UNLOCK TABLES;
-
-# Test OFF->ON transition under a GLOBAL READ LOCK
-FLUSH TABLES WITH READ LOCK;
-
-SET GLOBAL general_log = ON;
-SET GLOBAL slow_query_log = ON;
-
-UNLOCK TABLES;
-
-# Test ON->OFF transition under a GLOBAL READ_ONLY
-SET GLOBAL READ_ONLY = ON;
-
-SET GLOBAL general_log = OFF;
-SET GLOBAL slow_query_log = OFF;
-
-SET GLOBAL READ_ONLY = OFF;
-
-# Test OFF->ON transition under a GLOBAL READ_ONLY
-SET GLOBAL READ_ONLY = ON;
-
-SET GLOBAL general_log = ON;
-SET GLOBAL slow_query_log = ON;
-
-SET GLOBAL READ_ONLY = OFF;
-
-# Reset to initial values
-SET GLOBAL general_log = @old_general_log;
-SET GLOBAL slow_query_log = @old_slow_query_log;
-
-
-###########################################################################
-
-#
-# Bug#31604: server crash when setting slow_query_log_file/general_log_file
-#
-
---error ER_WRONG_VALUE_FOR_VAR
-SET GLOBAL general_log_file= CONCAT('/not existing path/log.maste', 'r');
---error ER_WRONG_VALUE_FOR_VAR
-SET GLOBAL general_log_file= NULL;
---error ER_WRONG_VALUE_FOR_VAR
-SET GLOBAL slow_query_log_file= CONCAT('/not existing path/log.maste', 'r');
---error ER_WRONG_VALUE_FOR_VAR
-SET GLOBAL slow_query_log_file= NULL;
-
-# Reset to initial values in case a setting above was successful.
-SET GLOBAL general_log_file= @old_general_log_file;
-SET GLOBAL slow_query_log_file= @old_slow_query_log_file;
-
-###########################################################################
-
---echo
---echo # --
---echo # -- Bug#32748: Inconsistent handling of assignments to
---echo # -- general_log_file/slow_query_log_file.
---echo # --
-
---echo
-SET GLOBAL general_log_file = 'bug32748.query.log';
-SET GLOBAL slow_query_log_file = 'bug32748.slow.log';
-
---echo
-SHOW VARIABLES LIKE '%log_file';
-
-# Reset to initial values
---echo
-SET GLOBAL general_log_file = @old_general_log_file;
-SET GLOBAL slow_query_log_file = @old_slow_query_log_file;
-
---echo
---echo # -- End of Bug#32748.
-
-
-###########################################################################
-
---echo #
---echo # Bug #49756 Rows_examined is always 0 in the slow query log
---echo # for update statements
---echo #
-
-SET @old_log_output = @@global.log_output;
-SET GLOBAL log_output = "TABLE";
-SET GLOBAL slow_query_log = ON;
-SET GLOBAL long_query_time = 0.001;
-
-# clear slow_log of any residual slow queries
-TRUNCATE TABLE mysql.slow_log;
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (b INT, PRIMARY KEY (b));
-INSERT INTO t2 VALUES (3),(4);
-
-connect (con2,localhost,root,,);
-INSERT INTO t1 VALUES (1+sleep(.02)),(2);
-INSERT INTO t1 SELECT b+sleep(.02) from t2;
-UPDATE t1 SET a=a+sleep(.02) WHERE a>2;
-UPDATE t1 SET a=a+sleep(.02) ORDER BY a DESC;
-UPDATE t2 set b=b+sleep(.02) limit 1;
-UPDATE t1 SET a=a+sleep(.02) WHERE a in (SELECT b from t2);
-DELETE FROM t1 WHERE a=a+sleep(.02) ORDER BY a LIMIT 2;
-
-SELECT rows_examined,sql_text FROM mysql.slow_log;
-disconnect con2;
-connection default;
-DROP TABLE t1,t2;
-TRUNCATE TABLE mysql.slow_log;
-
---echo # end of bug#49756
-
-
---echo End of 5.1 tests
-
-
-###########################################################################
-
---echo
---echo # --
---echo # -- Bug#38124: "general_log_file" variable silently unset when
---echo # -- using expression
---echo # --
-
-# Store away the special DEFAULT value so we
-# can compare it later, then try to set the
-# general_log_file using different functions
-# and expressions.
-
-SET GLOBAL general_log_file = DEFAULT;
-SELECT @@general_log_file INTO @my_glf;
-
-SET GLOBAL general_log_file = 'BUG38124.LOG';
-SELECT @@general_log_file;
-
-SET GLOBAL general_log_file = concat('BUG38124-2.LOG');
-SELECT @@general_log_file;
-
-SET GLOBAL general_log_file = substr('BUG38124-2.LOG',3,6);
-SELECT @@general_log_file;
-
-SET GLOBAL general_log_file = DEFAULT;
-SELECT @@general_log_file = @my_glf;
-
-
-## Reset to initial values
-SET GLOBAL general_log_file = @old_general_log_file;
-
-
---enable_ps_protocol
-
-#
-# Cleanup
-#
-# Disconnect must be done last to avoid delayed 'Quit' message in general log
-disconnect con1;
-# set back the saved default values
-connection default;
-
-# Reset global system variables to initial values if forgotten somewhere above.
-SET GLOBAL long_query_time = DEFAULT;
-SET GLOBAL log_output = @old_log_output;
-SET global general_log = @old_general_log;
-SET global general_log_file = @old_general_log_file;
-SET global slow_query_log = @old_slow_query_log;
-SET global slow_query_log_file = @old_slow_query_log_file;
-
-# Remove the log file that was created in the "default location"
-# i.e var/run
---remove_file $MYSQLTEST_VARDIR/tmp/log.master
diff --git a/mysql-test/t/log_state_bug33693-master.opt b/mysql-test/t/log_state_bug33693-master.opt
deleted file mode 100644
index fa3cf2ef78f..00000000000
--- a/mysql-test/t/log_state_bug33693-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---pid-file=$MYSQLTEST_VARDIR/run/mysqld.1.pid --general-log --general-log-file=
diff --git a/mysql-test/t/log_state_bug33693.test b/mysql-test/t/log_state_bug33693.test
deleted file mode 100644
index d67b28fc3e9..00000000000
--- a/mysql-test/t/log_state_bug33693.test
+++ /dev/null
@@ -1,18 +0,0 @@
-### t/log_state_bug33693.test
-#
-# Regression test for bug #33693
-# "general log name and location depend on PID
-# file, not on predefined values"
-#
-# The server is started with a hard-coded
-# PID file in the $MYSQLTEST_VARDIR/run
-# directory, and an unspecified general log
-# file name.
-#
-# The correct result should show the log file to
-# rest in the database directory. Unfixed, the
-# log file will be in the same directory as the
-# PID.
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT INSTR(@@general_log_file, '$MYSQLTEST_VARDIR/run');
diff --git a/mysql-test/t/log_tables-big-master.opt b/mysql-test/t/log_tables-big-master.opt
deleted file mode 100644
index 0cdf12d284b..00000000000
--- a/mysql-test/t/log_tables-big-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---slow-query-log --general-log --general-log-file="" --slow-query-log-file=""
diff --git a/mysql-test/t/log_tables-big.test b/mysql-test/t/log_tables-big.test
deleted file mode 100644
index fa8810ecd3b..00000000000
--- a/mysql-test/t/log_tables-big.test
+++ /dev/null
@@ -1,40 +0,0 @@
-# this test needs multithreaded mysqltest
--- source include/not_embedded.inc
-
-# Test sleeps for long times
---source include/big_test.inc
-
-# check that CSV engine was compiled in
---source include/have_csv.inc
-
-set @log_output.saved = @@global.log_output;
-set @@global.log_output = 'TABLE';
-
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-
-#
-# Bug #27638: slow logging to CSV table inserts bad query_time and lock_time values
-#
-connection con1;
-set session long_query_time=10;
-select get_lock('bug27638', 1);
-connection con2;
-set session long_query_time=1;
-select get_lock('bug27638', 2);
-select if (query_time >= '00:00:01', 'OK', concat('WRONG: ',query_time)) as qt, sql_text from mysql.slow_log
- where sql_text = 'select get_lock(\'bug27638\', 2)';
-select get_lock('bug27638', 60);
-select if (query_time >= '00:00:59', 'OK', concat('WRONG: ',query_time)) as qt, sql_text from mysql.slow_log
- where sql_text = 'select get_lock(\'bug27638\', 60)';
-select get_lock('bug27638', 101);
-select if (query_time >= '00:01:40', 'OK', concat('WRONG: ',query_time)) as qt, sql_text from mysql.slow_log
- where sql_text = 'select get_lock(\'bug27638\', 101)';
-connection con1;
-select release_lock('bug27638');
-connection default;
-
-disconnect con1;
-disconnect con2;
-
-set @@global.log_output = @log_output.saved;
diff --git a/mysql-test/t/log_tables-master.opt b/mysql-test/t/log_tables-master.opt
deleted file mode 100644
index 4c25518cefe..00000000000
--- a/mysql-test/t/log_tables-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---log-output=table,file --slow-query-log --general-log
diff --git a/mysql-test/t/log_tables.test b/mysql-test/t/log_tables.test
deleted file mode 100644
index a4158ba6a24..00000000000
--- a/mysql-test/t/log_tables.test
+++ /dev/null
@@ -1,1064 +0,0 @@
-# this test needs multithreaded mysqltest
--- source include/not_embedded.inc
-#
-# Basic log tables test
-#
-# check that CSV engine was compiled in
---source include/have_csv.inc
-
-SET SQL_MODE="";
-SET @old_general_log_state = @@global.general_log;
-SET @old_log_output= @@global.log_output;
-SET @old_slow_query_log= @@global.slow_query_log;
-SET @old_general_log= @@global.general_log;
-SET @old_long_query_time= @@session.long_query_time;
-
---disable_ps_protocol
-use mysql;
-
-# Capture initial settings of system variables
-# so that we can revert to old state after manipulation for testing
-# NOTE: PLEASE USE THESE VALUES TO 'RESET' SYSTEM VARIABLES
-# Capturing old values within the tests results in loss of values
-# due to people not paying attention to previous tests' changes, captures
-# or improper cleanup
-SET @saved_long_query_time = @@long_query_time;
-SET @saved_log_output = @@log_output;
-SET @saved_general_log = @@GLOBAL.general_log;
-SET @saved_slow_query_log = @@GLOBAL.slow_query_log;
-
-SELECT @saved_long_query_time, @saved_log_output, @saved_general_log, @saved_slow_query_log;
-
-
-
-#
-# Check that log tables work and we can do basic selects. This also
-# tests truncate, which works in a special mode with the log tables
-#
-
-truncate table general_log;
---replace_column 1 TIMESTAMP 2 USER_HOST 3 THREAD_ID
-select * from general_log;
-truncate table slow_log;
---replace_column 1 TIMESTAMP 2 USER_HOST
-select * from slow_log;
-
-#
-# We want to check that a record newly written to a log table shows up for
-# the query: since log tables use concurrent insert machinery and log tables
-# are always locked by artificial THD, this feature requires additional
-# check in ha_tina::write_row. This simple test should prove that the
-# log table flag in the table handler is triggered and working.
-#
-
-truncate table general_log;
---replace_column 1 TIMESTAMP 2 USER_HOST 3 THREAD_ID
-select * from general_log where argument like '%general_log%';
-
-
-#
-# Check some basic queries interfering with the log tables.
-# In our test we'll use a tbale with verbose comments to the short
-# command type names, used in the tables
-#
-
-create table join_test (verbose_comment varchar (80), command_type varchar(64));
-
-insert into join_test values ("User performed a usual SQL query", "Query");
-insert into join_test values ("New DB connection was registered", "Connect");
-insert into join_test values ("Get the table info", "Field List");
-
---replace_column 2 USER_HOST
-select verbose_comment, user_host, argument
- from mysql.general_log join join_test
- on (mysql.general_log.command_type = join_test.command_type);
-
-drop table join_test;
-
-#
-# check that flush of the log table work fine
-#
-
-flush logs;
-
-#
-# check locking of the log tables
-#
-
---error ER_CANT_LOCK_LOG_TABLE
-lock tables mysql.general_log WRITE;
-
---error ER_CANT_LOCK_LOG_TABLE
-lock tables mysql.slow_log WRITE;
-
-#
-# This attemts to get TL_READ_NO_INSERT lock, which is incompatible with
-# TL_WRITE_CONCURRENT_INSERT. This should fail. We issue this error as log
-# tables are always opened and locked by the logger.
-#
-
---error ER_CANT_LOCK_LOG_TABLE
-lock tables mysql.general_log READ;
-
---error ER_CANT_LOCK_LOG_TABLE
-lock tables mysql.slow_log READ;
-
-#
-# This call should result in TL_READ lock on the log table.
-# This is not ok and should fail.
-#
-
---error ER_CANT_LOCK_LOG_TABLE
-lock tables mysql.slow_log READ LOCAL, mysql.general_log READ LOCAL;
-
-# Misc locking tests
-
-show create table mysql.general_log;
-show fields from mysql.general_log;
-
-show create table mysql.slow_log;
-show fields from mysql.slow_log;
-
-#
-# check that FLUSH LOGS does not flush the log tables
-#
-
-flush logs;
-flush tables;
-
-SET GLOBAL GENERAL_LOG=ON;
-SET GLOBAL SLOW_QUERY_LOG=ON;
-
-show open tables;
-flush logs;
-show open tables;
-
-#
-# check that FLUSH TABLES does flush the log tables
-#
-
-flush tables;
-# Since the flush is logged, mysql.general_log will be in the cache
-show open tables;
-
-SET GLOBAL GENERAL_LOG=OFF;
-SET GLOBAL SLOW_QUERY_LOG=OFF;
-
-flush tables;
-# Here the table cache is empty
-show open tables;
-
-SET GLOBAL GENERAL_LOG=ON;
-SET GLOBAL SLOW_QUERY_LOG=ON;
-
-#
-# Bug#23924 general_log truncates queries with character set introducers.
-#
-truncate table mysql.general_log;
-set names binary;
-select _koi8r'' as test;
---replace_column 1 TIMESTAMP 2 USER_HOST 3 THREAD_ID
-select * from mysql.general_log;
-set names utf8;
-
-#
-# Bug #16905 Log tables: unicode statements are logged incorrectly
-#
-
-truncate table mysql.general_log;
-set names utf8;
-create table bug16905 (s char(15) character set utf8 default 'пусто');
-insert into bug16905 values ('новое');
---replace_column 1 TIMESTAMP 2 USER_HOST 3 THREAD_ID
-select * from mysql.general_log;
-drop table bug16905;
-
-#
-# Bug #17600: Invalid data logged into mysql.slow_log
-#
-
-truncate table mysql.slow_log;
-set session long_query_time=1;
-select sleep(2);
---replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME 12 THREAD_ID
-select * from mysql.slow_log;
-set @@session.long_query_time = @saved_long_query_time;
-
-#
-# Bug #18559 log tables cannot change engine, and gets deadlocked when
-# dropping w/ log on
-#
-
-# check that appropriate error messages are given when one attempts to alter
-# or drop a log tables, while corresponding logs are enabled
---error ER_BAD_LOG_STATEMENT
-alter table mysql.general_log engine=myisam;
---error ER_BAD_LOG_STATEMENT
-alter table mysql.slow_log engine=myisam;
-
---error ER_BAD_LOG_STATEMENT
-drop table mysql.general_log;
---error ER_BAD_LOG_STATEMENT
-drop table mysql.slow_log;
-
-# check that one can alter log tables to MyISAM
-set global general_log='OFF';
-
-# cannot convert another log table
---error ER_BAD_LOG_STATEMENT
-alter table mysql.slow_log engine=myisam;
-
-# alter both tables
-set global slow_query_log='OFF';
-# check that both tables use CSV engine
-show create table mysql.general_log;
-show create table mysql.slow_log;
-
-alter table mysql.general_log engine=myisam;
-alter table mysql.slow_log engine=myisam;
-
-# check that the tables were converted
-show create table mysql.general_log;
-show create table mysql.slow_log;
-
-# enable log tables and chek that new tables indeed work
-set global general_log='ON';
-set global slow_query_log='ON';
-
---replace_column 1 TIMESTAMP 2 USER_HOST 3 THREAD_ID
-select * from mysql.general_log;
-
-# check that flush of myisam-based log tables work fine
-flush logs;
-
-# check locking of myisam-based log tables
-
---error ER_CANT_LOCK_LOG_TABLE
-lock tables mysql.general_log WRITE;
-
---error ER_CANT_LOCK_LOG_TABLE
-lock tables mysql.slow_log WRITE;
-
-#
-# This attemts to get TL_READ_NO_INSERT lock, which is incompatible with
-# TL_WRITE_CONCURRENT_INSERT. This should fail. We issue this error as log
-# tables are always opened and locked by the logger.
-#
-
---error ER_CANT_LOCK_LOG_TABLE
-lock tables mysql.general_log READ;
-
---error ER_CANT_LOCK_LOG_TABLE
-lock tables mysql.slow_log READ;
-
-# check that we can drop them
-set global general_log='OFF';
-set global slow_query_log='OFF';
-
-# check that alter table doesn't work for other engines
-set @save_storage_engine= @@session.storage_engine;
-set storage_engine= MEMORY;
-# After fixing bug#35765 the error behaivor changed:
-# If compiled in/enabled ER_UNSUPORTED_LOG_ENGINE
-# If not (i.e. not existant) it will show a warning
-# and use the current one.
-alter table mysql.slow_log engine=NonExistentEngine;
---error ER_UNSUPORTED_LOG_ENGINE
-alter table mysql.slow_log engine=memory;
-#--error ER_UNSUPORTED_LOG_ENGINE
-#alter table mysql.slow_log engine=innodb;
-#--error ER_UNSUPORTED_LOG_ENGINE
-#alter table mysql.slow_log engine=archive;
-#--error ER_UNSUPORTED_LOG_ENGINE
-#alter table mysql.slow_log engine=blackhole;
-set storage_engine= @save_storage_engine;
-
-drop table mysql.slow_log;
-drop table mysql.general_log;
-
-# check that table share cleanup is performed correctly (double drop)
-
---error ER_BAD_TABLE_ERROR
-drop table mysql.general_log;
---error ER_BAD_TABLE_ERROR
-drop table mysql.slow_log;
-
-# recreate tables and enable logs
-
-use mysql;
-
-CREATE TABLE `general_log` (
- `event_time` TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP
- ON UPDATE CURRENT_TIMESTAMP,
- `user_host` mediumtext NOT NULL,
- `thread_id` BIGINT(21) UNSIGNED 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';
-
-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,
- `thread_id` BIGINT(21) UNSIGNED NOT NULL,
- `rows_affected` int(11) NOT NULL
-) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log';
-
-set global general_log='ON';
-set global slow_query_log='ON';
-use test;
-
-#
-# Bug #20139 Infinite loop after "FLUSH" and "LOCK tabX, general_log"
-#
-
-flush tables with read lock;
-unlock tables;
-use mysql;
---error ER_CANT_LOCK_LOG_TABLE
-lock tables general_log read local, help_category read local;
-unlock tables;
-
-#
-# Bug #17544 Cannot do atomic log rotate and
-# Bug #21785 Server crashes after rename of the log table
-#
-
-SET SESSION long_query_time = 1000;
---disable_warnings
-drop table if exists mysql.renamed_general_log;
-drop table if exists mysql.renamed_slow_log;
-drop table if exists mysql.general_log_new;
-drop table if exists mysql.slow_log_new;
---enable_warnings
-
-use mysql;
-# Should result in error
---error ER_CANT_RENAME_LOG_TABLE
-RENAME TABLE general_log TO renamed_general_log;
---error ER_CANT_RENAME_LOG_TABLE
-RENAME TABLE slow_log TO renamed_slow_log;
-
-#check rotate logs
-truncate table general_log;
---replace_column 1 TIMESTAMP 2 USER_HOST 3 THREAD_ID
-select * from general_log;
-
-truncate table slow_log;
---replace_column 1 TIMESTAMP 2 USER_HOST
-select * from slow_log;
-
-create table general_log_new like general_log;
-rename table general_log TO renamed_general_log, general_log_new TO general_log;
-
-create table slow_log_new like slow_log;
-rename table slow_log TO renamed_slow_log, slow_log_new TO slow_log;
-
-# check that rename checks more then first table in the list
---error ER_CANT_RENAME_LOG_TABLE
-rename table general_log TO general_log_new, renamed_general_log TO general_log, slow_log to renamed_slow_log;
-
-# now check the content of tables
---replace_column 1 TIMESTAMP 2 USER_HOST 3 THREAD_ID
-select * from general_log;
---replace_column 1 TIMESTAMP 2 USER_HOST 3 THREAD_ID
-select * from renamed_general_log;
-
-# the content of the slow log is empty, but we will try a select anyway
---replace_column 1 TIMESTAMP 2 USER_HOST
-select * from slow_log;
---replace_column 1 TIMESTAMP 2 USER_HOST
-select * from renamed_slow_log;
-
-# check that we can do whatever we want with disabled log
-set global general_log='OFF';
-RENAME TABLE general_log TO general_log2;
-
-set global slow_query_log='OFF';
-RENAME TABLE slow_log TO slow_log2;
-
-# this should fail
---error ER_NO_SUCH_TABLE
-set global general_log='ON';
---error ER_NO_SUCH_TABLE
-set global slow_query_log='ON';
-
-RENAME TABLE general_log2 TO general_log;
-RENAME TABLE slow_log2 TO slow_log;
-SET SESSION long_query_time = @saved_long_query_time;
-
-# this should work
-set global general_log='ON';
-set global slow_query_log='ON';
-# now check flush logs
-flush logs;
-flush logs;
-drop table renamed_general_log, renamed_slow_log;
-use test;
-
-#
-# Bug#27858 (Failing to log to a log table doesn't log anything to error log)
-#
-# This test works as expected, it's a negative test.
-# The message "[ERROR] Failed to write to mysql.general_log"
-# is printed to master.err when writing to the table mysql.general_log
-# failed.
-# However, this message is picked up by mysql-test-run.pl,
-# and reported as a test failure, which is a false negative.
-# There is no current way to *selectively* filter out these expected error conditions
-# (see mysql-test/lib/mtr_report.pl, mtr_report_stats()).
-# Instead of filtering all occurences of "Failed to write to
-# mysql.general_log", which could hide bugs when the error is not expected,
-# this test case is commented instead.
-# TODO: improve filtering of expected errors in master.err in
-# mysql-test-run.pl (based on the test name ?), and uncomment this test.
-
-# --disable_warnings
-# drop table if exists mysql.bad_general_log;
-# drop table if exists mysql.bad_slow_log;
-# drop table if exists mysql.general_log_hide;
-# drop table if exists mysql.slow_log_hide;
-# --enable_warnings
-#
-# create table mysql.bad_general_log (a int) engine= CSV;
-# create table mysql.bad_slow_log (a int) engine= CSV;
-#
-# # Rename does not perform checks on the table structure,
-# # exploiting this to force a failure to log
-# rename table mysql.general_log to mysql.general_log_hide, mysql.bad_general_log TO mysql.general_log;
-# rename table mysql.slow_log to mysql.slow_log_hide, mysql.bad_slow_log TO mysql.slow_log;
-#
-# # The following message should be printed in master.log:
-# # [ERROR] Failed to write to mysql.general_log
-# # TODO: See how verifying this could be automated
-#
-# flush tables;
-# select "logging this should fail";
-#
-# # Restore the log tables
-#
-# rename table mysql.general_log to mysql.bad_general_log, mysql.general_log_hide TO mysql.general_log;
-# rename table mysql.slow_log to mysql.bad_slow_log, mysql.slow_log_hide TO mysql.slow_log;
-#
-# flush tables;
-#
-# drop table mysql.bad_general_log;
-# drop table mysql.bad_slow_log;
-
-#
-# Bug #21966 Strange warnings on repair of the log tables
-#
-
-use mysql;
-# check that no warning occurs on repair of the log tables
-repair table general_log;
-repair table slow_log;
-# check that no warning occurs on "create like" for the log tables
-create table general_log_new like general_log;
-create table slow_log_new like slow_log;
-show tables like "%log%";
-drop table slow_log_new, general_log_new;
-use test;
-
-#
-# Bug#27857 (Log tables supplies the wrong value for generating
-# AUTO_INCREMENT numbers)
-#
-
-SET GLOBAL LOG_OUTPUT = 'TABLE';
-
-## test the general log
-
-SET GLOBAL general_log = 0;
-FLUSH LOGS;
-
-TRUNCATE TABLE mysql.general_log;
-ALTER TABLE mysql.general_log ENGINE = MyISAM;
-ALTER TABLE mysql.general_log
- ADD COLUMN seq BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY;
-
-SET GLOBAL general_log = 1;
-FLUSH LOGS;
-
---replace_column 1 EVENT_TIME 2 USER_HOST 3 THREAD_ID 4 SERVER_ID
-SELECT * FROM mysql.general_log;
---replace_column 1 EVENT_TIME 2 USER_HOST 3 THREAD_ID 4 SERVER_ID
-SELECT * FROM mysql.general_log;
-SELECT "My own query 1";
-SELECT "My own query 2";
---replace_column 1 EVENT_TIME 2 USER_HOST 3 THREAD_ID 4 SERVER_ID
-SELECT * FROM mysql.general_log;
-
-SET GLOBAL general_log = 0;
-FLUSH LOGS;
-
-ALTER TABLE mysql.general_log DROP COLUMN seq;
-ALTER TABLE mysql.general_log ENGINE = CSV;
-
-## test the slow query log
-
-SET GLOBAL slow_query_log = 0;
-FLUSH LOGS;
-
-TRUNCATE TABLE mysql.slow_log;
-ALTER TABLE mysql.slow_log ENGINE = MyISAM;
-
-ALTER TABLE mysql.slow_log
- ADD COLUMN seq BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY;
-
-SET SESSION long_query_time = 1;
-SET GLOBAL slow_query_log = 1;
-FLUSH LOGS;
-
-## FLUSH LOGS above might be slow, so the following is
-## logged as either seq 1-4 or seq 2-5
-SELECT "My own slow query", sleep(2);
-SELECT "My own slow query", sleep(2);
-SELECT "My own slow query", sleep(2);
-SELECT "My own slow query", sleep(2);
-
-## So we look for seq 2-4
---replace_column 1 START_TIME 2 USER_HOST 3 QUERY_TIME
-SELECT * FROM mysql.slow_log WHERE seq >= 2 LIMIT 3;
-
-SET GLOBAL slow_query_log = 0;
-SET SESSION long_query_time =@saved_long_query_time;
-FLUSH LOGS;
-
-ALTER TABLE mysql.slow_log DROP COLUMN seq;
-ALTER TABLE mysql.slow_log ENGINE = CSV;
-
-SET GLOBAL general_log = @old_general_log;
-SET GLOBAL slow_query_log = @old_slow_query_log;
-
-#
-# Bug#25422 (Hang with log tables)
-#
-
---disable_warnings
-drop procedure if exists proc25422_truncate_slow;
-drop procedure if exists proc25422_truncate_general;
-drop procedure if exists proc25422_alter_slow;
-drop procedure if exists proc25422_alter_general;
---enable_warnings
-
-delimiter //;
-
-use test//
-create procedure proc25422_truncate_slow (loops int)
-begin
- declare v1 int default 0;
- declare continue handler for sqlexception /* errors from truncate */
- begin end;
- while v1 < loops do
- truncate mysql.slow_log;
- set v1 = v1 + 1;
- end while;
-end//
-
-create procedure proc25422_truncate_general (loops int)
-begin
- declare v1 int default 0;
- declare continue handler for sqlexception /* errors from truncate */
- begin end;
- while v1 < loops do
- truncate mysql.general_log;
- set v1 = v1 + 1;
- end while;
-end//
-
-create procedure proc25422_alter_slow (loops int)
-begin
- declare v1 int default 0;
- declare ER_BAD_LOG_STATEMENT condition for 1575;
- declare continue handler for ER_BAD_LOG_STATEMENT begin end;
-
- while v1 < loops do
- set @old_log_state = @@global.slow_query_log;
- set global slow_query_log = 'OFF';
- alter table mysql.slow_log engine = CSV;
- set global slow_query_log = @old_log_state;
- set v1 = v1 + 1;
- end while;
-end//
-
-create procedure proc25422_alter_general (loops int)
-begin
- declare v1 int default 0;
- declare ER_BAD_LOG_STATEMENT condition for 1575;
- declare continue handler for ER_BAD_LOG_STATEMENT begin end;
-
- while v1 < loops do
- set @old_log_state = @@global.general_log;
- set global general_log = 'OFF';
- alter table mysql.general_log engine = CSV;
- set global general_log = @old_log_state;
- set v1 = v1 + 1;
- end while;
-end//
-
-delimiter ;//
-
-set @iterations=100;
-
---echo "Serial test (proc25422_truncate_slow)"
-call proc25422_truncate_slow(@iterations);
---echo "Serial test (proc25422_truncate_general)"
-call proc25422_truncate_general(@iterations);
---echo "Serial test (proc25422_alter_slow)"
-call proc25422_alter_slow(@iterations);
---echo "Serial test (proc25422_alter_general)"
-call proc25422_alter_general(@iterations);
-
---echo "Parallel test"
-
-# ER_BAD_LOG_STATEMENT errors will occur,
-# since concurrent threads do SET GLOBAL general_log= ...
-# This is silenced by handlers and will not affect the test
-
-connect (addconroot1, localhost, root,,);
-connect (addconroot2, localhost, root,,);
-connect (addconroot3, localhost, root,,);
-connect (addconroot4, localhost, root,,);
-connect (addconroot5, localhost, root,,);
-connect (addconroot6, localhost, root,,);
-connect (addconroot7, localhost, root,,);
-connect (addconroot8, localhost, root,,);
-
-connection addconroot1;
-send call proc25422_truncate_slow(@iterations);
-connection addconroot2;
-send call proc25422_truncate_slow(@iterations);
-
-connection addconroot3;
-send call proc25422_truncate_general(@iterations);
-connection addconroot4;
-send call proc25422_truncate_general(@iterations);
-
-connection addconroot5;
-send call proc25422_alter_slow(@iterations);
-connection addconroot6;
-send call proc25422_alter_slow(@iterations);
-
-connection addconroot7;
-send call proc25422_alter_general(@iterations);
-connection addconroot8;
-send call proc25422_alter_general(@iterations);
-
-connection addconroot1;
-reap;
-connection addconroot2;
-reap;
-connection addconroot3;
-reap;
-connection addconroot4;
-reap;
-connection addconroot5;
-reap;
-connection addconroot6;
-reap;
-connection addconroot7;
-reap;
-connection addconroot8;
-reap;
-
-connection default;
-
-disconnect addconroot1;
-disconnect addconroot2;
-disconnect addconroot3;
-disconnect addconroot4;
-disconnect addconroot5;
-disconnect addconroot6;
-disconnect addconroot7;
-disconnect addconroot8;
-
-drop procedure proc25422_truncate_slow;
-drop procedure proc25422_truncate_general;
-drop procedure proc25422_alter_slow;
-drop procedure proc25422_alter_general;
-
---enable_ps_protocol
-
-
-#
-# Bug#23044 (Warnings on flush of a log table)
-#
-
-FLUSH TABLE mysql.general_log;
-show warnings;
-
-FLUSH TABLE mysql.slow_log;
-show warnings;
-
-#
-# Bug#17876 (Truncating mysql.slow_log in a SP after using cursor locks the
-# thread)
-#
-
---disable_warnings
-DROP TABLE IF EXISTS `db_17876.slow_log_data`;
-DROP TABLE IF EXISTS `db_17876.general_log_data`;
-DROP PROCEDURE IF EXISTS `db_17876.archiveSlowLog`;
-DROP PROCEDURE IF EXISTS `db_17876.archiveGeneralLog`;
-DROP DATABASE IF EXISTS `db_17876`;
---enable_warnings
-
-CREATE DATABASE db_17876;
-
-CREATE TABLE `db_17876.slow_log_data` (
- `start_time` timestamp(6) default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
- `user_host` mediumtext ,
- `query_time` time(6) ,
- `lock_time` time(6) ,
- `rows_sent` int(11) ,
- `rows_examined` int(11) ,
- `db` varchar(512) default NULL,
- `last_insert_id` int(11) default NULL,
- `insert_id` int(11) default NULL,
- `server_id` int(11) default NULL,
- `sql_text` mediumtext,
- `thread_id` bigint(21) unsigned default NULL,
- `rows_affected` int(11) default NULL
-);
-
-CREATE TABLE `db_17876.general_log_data` (
- `event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- `user_host` mediumtext,
- `thread_id` int(11) DEFAULT NULL,
- `server_id` int(11) DEFAULT NULL,
- `command_type` varchar(64) DEFAULT NULL,
- `argument` mediumtext
-);
-
-DELIMITER //;
-
-CREATE procedure `db_17876.archiveSlowLog`()
-BEGIN
- DECLARE start_time, query_time, lock_time CHAR(28);
- DECLARE user_host MEDIUMTEXT;
- DECLARE rows_set, rows_examined, last_insert_id, insert_id, server_id, rows_affected INT;
- DECLARE thread_id BIGINT UNSIGNED;
- DECLARE dbname MEDIUMTEXT;
- DECLARE sql_text BLOB;
- DECLARE done INT DEFAULT 0;
- DECLARE ER_SP_FETCH_NO_DATA CONDITION for 1329;
-
- DECLARE cur1 CURSOR FOR SELECT * FROM mysql.slow_log;
-
- OPEN cur1;
-
- REPEAT
- BEGIN
- BEGIN
- DECLARE CONTINUE HANDLER FOR ER_SP_FETCH_NO_DATA SET done = 1;
-
- FETCH cur1 INTO
- start_time, user_host, query_time, lock_time,
- rows_set, rows_examined, dbname, last_insert_id,
- insert_id, server_id, sql_text, thread_id, rows_affected;
- END;
-
- IF NOT done THEN
- BEGIN
- INSERT INTO
- `db_17876.slow_log_data`
- VALUES(start_time, user_host, query_time, lock_time, rows_set, rows_examined,
- dbname, last_insert_id, insert_id, server_id, sql_text, thread_id,
- rows_affected);
- END;
- END IF;
- END;
- UNTIL done END REPEAT;
-
- CLOSE cur1;
- TRUNCATE mysql.slow_log;
-END //
-
-CREATE procedure `db_17876.archiveGeneralLog`()
-BEGIN
- DECLARE event_time CHAR(28);
- DECLARE user_host, argument MEDIUMTEXT;
- DECLARE thread_id, server_id INT;
- DECLARE sql_text BLOB;
- DECLARE done INT DEFAULT 0;
- DECLARE command_type VARCHAR(64);
- DECLARE ER_SP_FETCH_NO_DATA CONDITION for 1329;
-
- DECLARE cur1 CURSOR FOR SELECT * FROM mysql.general_log;
-
- OPEN cur1;
-
- REPEAT
- BEGIN
- BEGIN
- DECLARE CONTINUE HANDLER FOR ER_SP_FETCH_NO_DATA SET done = 1;
-
- FETCH cur1 INTO
- event_time, user_host, thread_id, server_id,
- command_type, argument;
- END;
-
- IF NOT done THEN
- BEGIN
- INSERT INTO
- `db_17876.general_log_data`
- VALUES(event_time, user_host, thread_id, server_id,
- command_type, argument);
- END;
- END IF;
- END;
- UNTIL done END REPEAT;
-
- CLOSE cur1;
- TRUNCATE mysql.general_log;
-END //
-
-DELIMITER ;//
-
-SET GLOBAL general_log = ON;
-SET GLOBAL slow_query_log = ON;
-
-select "put something into general_log";
-select "... and something more ...";
-
-call `db_17876.archiveSlowLog`();
-call `db_17876.archiveGeneralLog`();
-
-SET GLOBAL general_log = OFF;
-SET GLOBAL slow_query_log = OFF;
-
-call `db_17876.archiveSlowLog`();
-call `db_17876.archiveGeneralLog`();
-
-DROP TABLE `db_17876.slow_log_data`;
-DROP TABLE `db_17876.general_log_data`;
-DROP PROCEDURE IF EXISTS `db_17876.archiveSlowLog`;
-DROP PROCEDURE IF EXISTS `db_17876.archiveGeneralLog`;
-DROP DATABASE IF EXISTS `db_17876`;
-
-SET GLOBAL general_log = @old_general_log;
-SET GLOBAL slow_query_log = @old_slow_query_log;
-
-#
-# Bug#21557 entries in the general query log truncated at 1000 characters.
-#
-
-select CONNECTION_ID() into @thread_id;
-truncate table mysql.general_log;
-set global general_log = on;
---disable_result_log
-set @lparam = "000 001 002 003 004 005 006 007 008 009"
- "010 011 012 013 014 015 016 017 018 019"
- "020 021 022 023 024 025 026 027 028 029"
- "030 031 032 033 034 035 036 037 038 039"
- "040 041 042 043 044 045 046 047 048 049"
- "050 051 052 053 054 055 056 057 058 059"
- "060 061 062 063 064 065 066 067 068 069"
- "070 071 072 073 074 075 076 077 078 079"
- "080 081 082 083 084 085 086 087 088 089"
- "090 091 092 093 094 095 096 097 098 099"
- "100 101 102 103 104 105 106 107 108 109"
- "110 111 112 113 114 115 116 117 118 119"
- "120 121 122 123 124 125 126 127 128 129"
- "130 131 132 133 134 135 136 137 138 139"
- "140 141 142 143 144 145 146 147 148 149"
- "150 151 152 153 154 155 156 157 158 159"
- "160 161 162 163 164 165 166 167 168 169"
- "170 171 172 173 174 175 176 177 178 179"
- "180 181 182 183 184 185 186 187 188 189"
- "190 191 192 193 194 195 196 197 198 199"
- "200 201 202 203 204 205 206 207 208 209"
- "210 211 212 213 214 215 216 217 218 219"
- "220 221 222 223 224 225 226 227 228 229"
- "230 231 232 233 234 235 236 237 238 239"
- "240 241 242 243 244 245 246 247 248 249"
- "250 251 252 253 254 255 256 257 258 259"
- "260 261 262 263 264 265 266 267 268 269"
- "270 271 272 273 274 275 276 277 278 279"
- "280 281 282 283 284 285 286 287 288 289"
- "290 291 292 293 294 295 296 297 298 299"
- "300 301 302 303 304 305 306 307 308 309"
- "310 311 312 313 314 315 316 317 318 319"
- "320 321 322 323 324 325 326 327 328 329"
- "330 331 332 333 334 335 336 337 338 339"
- "340 341 342 343 344 345 346 347 348 349"
- "350 351 352 353 354 355 356 357 358 359"
- "360 361 362 363 364 365 366 367 368 369"
- "370 371 372 373 374 375 376 377 378 379"
- "380 381 382 383 384 385 386 387 388 389"
- "390 391 392 393 394 395 396 397 398 399"
- "400 401 402 403 404 405 406 407 408 409"
- "410 411 412 413 414 415 416 417 418 419"
- "420 421 422 423 424 425 426 427 428 429"
- "430 431 432 433 434 435 436 437 438 439"
- "440 441 442 443 444 445 446 447 448 449"
- "450 451 452 453 454 455 456 457 458 459"
- "460 461 462 463 464 465 466 467 468 469"
- "470 471 472 473 474 475 476 477 478 479"
- "480 481 482 483 484 485 486 487 488 489"
- "490 491 492 493 494 495 496 497 498 499"
- "500 501 502 503 504 505 506 507 508 509"
- "510 511 512 513 514 515 516 517 518 519"
- "520 521 522 523 524 525 526 527 528 529"
- "530 531 532 533 534 535 536 537 538 539"
- "540 541 542 543 544 545 546 547 548 549"
- "550 551 552 553 554 555 556 557 558 559"
- "560 561 562 563 564 565 566 567 568 569"
- "570 571 572 573 574 575 576 577 578 579"
- "580 581 582 583 584 585 586 587 588 589"
- "590 591 592 593 594 595 596 597 598 599"
- "600 601 602 603 604 605 606 607 608 609"
- "610 611 612 613 614 615 616 617 618 619"
- "620 621 622 623 624 625 626 627 628 629"
- "630 631 632 633 634 635 636 637 638 639"
- "640 641 642 643 644 645 646 647 648 649"
- "650 651 652 653 654 655 656 657 658 659"
- "660 661 662 663 664 665 666 667 668 669"
- "670 671 672 673 674 675 676 677 678 679"
- "680 681 682 683 684 685 686 687 688 689"
- "690 691 692 693 694 695 696 697 698 699"
- "700 701 702 703 704 705 706 707 708 709"
- "710 711 712 713 714 715 716 717 718 719"
- "720 721 722 723 724 725 726 727 728 729"
- "730 731 732 733 734 735 736 737 738 739"
- "740 741 742 743 744 745 746 747 748 749"
- "750 751 752 753 754 755 756 757 758 759"
- "760 761 762 763 764 765 766 767 768 769"
- "770 771 772 773 774 775 776 777 778 779"
- "780 781 782 783 784 785 786 787 788 789"
- "790 791 792 793 794 795 796 797 798 799"
- "800 801 802 803 804 805 806 807 808 809"
- "810 811 812 813 814 815 816 817 818 819"
- "820 821 822 823 824 825 826 827 828 829"
- "830 831 832 833 834 835 836 837 838 839"
- "840 841 842 843 844 845 846 847 848 849"
- "850 851 852 853 854 855 856 857 858 859"
- "860 861 862 863 864 865 866 867 868 869"
- "870 871 872 873 874 875 876 877 878 879"
- "880 881 882 883 884 885 886 887 888 889"
- "890 891 892 893 894 895 896 897 898 899"
- "900 901 902 903 904 905 906 907 908 909"
- "910 911 912 913 914 915 916 917 918 919"
- "920 921 922 923 924 925 926 927 928 929"
- "930 931 932 933 934 935 936 937 938 939"
- "940 941 942 943 944 945 946 947 948 949"
- "950 951 952 953 954 955 956 957 958 959"
- "960 961 962 963 964 965 966 967 968 969"
- "970 971 972 973 974 975 976 977 978 979"
- "980 981 982 983 984 985 986 987 988 989"
- "990 991 992 993 994 995 996 997 998 999";
---enable_result_log
-prepare long_query from "select ? as long_query";
---disable_result_log
-execute long_query using @lparam;
---enable_result_log
-set global general_log = off;
-select command_type, argument from mysql.general_log where thread_id = @thread_id;
-deallocate prepare long_query;
-set global general_log = @old_general_log;
-
-#
-# Bug#34306: Can't make copy of log tables when server binary log is enabled
-#
-
---disable_warnings
-DROP TABLE IF EXISTS log_count;
-DROP TABLE IF EXISTS slow_log_copy;
-DROP TABLE IF EXISTS general_log_copy;
---enable_warnings
-
-CREATE TABLE log_count (count BIGINT(21));
-
-SET GLOBAL general_log = ON;
-SET GLOBAL slow_query_log = ON;
-
-CREATE TABLE slow_log_copy SELECT * FROM mysql.slow_log;
-INSERT INTO slow_log_copy SELECT * FROM mysql.slow_log;
-INSERT INTO log_count (count) VALUES ((SELECT count(*) FROM mysql.slow_log));
-DROP TABLE slow_log_copy;
-
-CREATE TABLE general_log_copy SELECT * FROM mysql.general_log;
-INSERT INTO general_log_copy SELECT * FROM mysql.general_log;
-INSERT INTO log_count (count) VALUES ((SELECT count(*) FROM mysql.general_log));
-DROP TABLE general_log_copy;
-
-SET GLOBAL general_log = OFF;
-SET GLOBAL slow_query_log = OFF;
-
-CREATE TABLE slow_log_copy SELECT * FROM mysql.slow_log;
-INSERT INTO slow_log_copy SELECT * FROM mysql.slow_log;
-INSERT INTO log_count (count) VALUES ((SELECT count(*) FROM mysql.slow_log));
-DROP TABLE slow_log_copy;
-
-CREATE TABLE general_log_copy SELECT * FROM mysql.general_log;
-INSERT INTO general_log_copy SELECT * FROM mysql.general_log;
-INSERT INTO log_count (count) VALUES ((SELECT count(*) FROM mysql.general_log));
-DROP TABLE general_log_copy;
-
-SET GLOBAL general_log = @saved_general_log;
-SET GLOBAL slow_query_log = @saved_slow_query_log;
-
-DROP TABLE log_count;
-
-#
-# Bug #31700: thd->examined_row_count not incremented for 'const' type queries
-#
-
-SET SESSION long_query_time = 0;
-SET GLOBAL slow_query_log = ON;
-FLUSH LOGS;
-TRUNCATE TABLE mysql.slow_log;
-
-# Let there be three columns, unique, non-unique, and non-indexed:
-CREATE TABLE t1 (f1 SERIAL,f2 INT, f3 INT, PRIMARY KEY(f1), KEY(f2));
-INSERT INTO t1 VALUES (1,1,1);
-INSERT INTO t1 VALUES (2,2,2);
-INSERT INTO t1 VALUES (3,3,3);
-INSERT INTO t1 VALUES (4,4,4);
-
-SELECT SQL_NO_CACHE 'Bug#31700 - SCAN',f1,f2,f3,SLEEP(1.1) FROM t1 WHERE f3=4;
-SELECT SQL_NO_CACHE 'Bug#31700 - KEY', f1,f2,f3,SLEEP(1.1) FROM t1 WHERE f2=3;
-SELECT SQL_NO_CACHE 'Bug#31700 - PK', f1,f2,f3,SLEEP(1.1) FROM t1 WHERE f1=2;
-
---replace_column 1 TIMESTAMP
-SELECT start_time, rows_examined, rows_sent, sql_text FROM mysql.slow_log WHERE sql_text LIKE '%Bug#31700%' ORDER BY start_time;
-
-DROP TABLE t1;
-
-TRUNCATE TABLE mysql.slow_log;
-
-#
-# Bug #47924 main.log_tables times out sporadically
-#
-
-use mysql;
-# Should result in error
---disable_warnings
-drop table if exists renamed_general_log;
-drop table if exists renamed_slow_log;
---enable_warnings
---error ER_CANT_RENAME_LOG_TABLE
-RENAME TABLE general_log TO renamed_general_log;
---error ER_CANT_RENAME_LOG_TABLE
-RENAME TABLE slow_log TO renamed_slow_log;
-
-use test;
-flush tables with read lock;
-unlock tables;
-
-SET @@session.long_query_time= @old_long_query_time;
-
-SET @@global.log_output= @old_log_output;
-SET @@global.slow_query_log= @old_slow_query_log;
-SET @@global.general_log= @old_general_log;
diff --git a/mysql-test/t/log_tables_debug.test b/mysql-test/t/log_tables_debug.test
deleted file mode 100644
index 971c11d458f..00000000000
--- a/mysql-test/t/log_tables_debug.test
+++ /dev/null
@@ -1,95 +0,0 @@
-### t/log_tables_debug.test
-#
-# Log-related tests requiring a debug-build server.
-#
-
-# extra clean-up required due to Bug#38124, set to 1 when behavior has
-# changed (see explanation in log_state.test)
-let $fixed_bug38124 = 0;
-
---source include/not_embedded.inc
---source include/have_debug.inc
-
-# Several subtests modify global variables. Save the initial values only here,
-# but reset to the initial values per subtest.
-SET @old_general_log= @@global.general_log;
-SET @old_general_log_file= @@global.general_log_file;
-SET @old_slow_query_log= @@global.slow_query_log;
-SET @old_slow_query_log_file= @@global.slow_query_log_file;
-
-
---echo #
---echo # Bug#45387 Information about statement id for prepared
---echo # statements missed from general log
---echo #
-
-let MYSQLD_DATADIR= `SELECT @@datadir`;
-
-# set logging to our specific bug log to control the entries added
-SET @@global.general_log = ON;
-SET @@global.general_log_file = 'bug45387_general.log';
-
-# turn on output of timestamps on all log file entries
-SET SESSION debug_dbug='+d,reset_log_last_time';
-
-let CONN_ID= `SELECT CONNECTION_ID()`;
-FLUSH LOGS;
-
-# reset log settings
-SET @@global.general_log = @old_general_log;
-SET @@global.general_log_file = @old_general_log_file;
-SET SESSION debug_dbug='-d';
-
-perl;
- # get the relevant info from the surrounding perl invocation
- $datadir= $ENV{'MYSQLD_DATADIR'};
- $conn_id= $ENV{'CONN_ID'};
-
- # loop through the log file looking for the stmt querying for conn id
- open(FILE, "$datadir/bug45387_general.log") or
- die("Unable to read log file $datadir/bug45387_general.log: $!\n");
- while(<FILE>) {
- if (/\d{6}\s+\d+:\d+:\d+[ \t]+(\d+)[ \t]+Query[ \t]+SELECT CONNECTION_ID/) {
- $found= $1;
- break;
- }
- }
-
- # print the result
- if ($found == $conn_id) {
- print "Bug#45387: ID match.\n";
- } else {
- print "Bug#45387: Expected ID '$conn_id', found '$found' in log file.\n";
- print "Contents of log file:\n";
- seek(FILE, 0, 0);
- while($line= <FILE>) {
- print $line;
- }
- }
-
- close(FILE);
-EOF
-
---remove_file $MYSQLD_DATADIR/bug45387_general.log
-
---echo End of 5.1 tests
-
-
---echo #
---echo # Cleanup
---echo #
-
-# Reset global system variables to initial values if forgotten somewhere above.
-SET global general_log = @old_general_log;
-SET global general_log_file = @old_general_log_file;
-SET global slow_query_log = @old_slow_query_log;
-SET global slow_query_log_file = @old_slow_query_log_file;
-if(!$fixed_bug38124)
-{
- --disable_query_log
- let $my_var = `SELECT @old_general_log_file`;
- eval SET @@global.general_log_file = '$my_var';
- let $my_var = `SELECT @old_slow_query_log_file`;
- eval SET @@global.slow_query_log_file = '$my_var';
- --enable_query_log
-}
diff --git a/mysql-test/t/log_tables_upgrade.test b/mysql-test/t/log_tables_upgrade.test
deleted file mode 100644
index 36802fb38ad..00000000000
--- a/mysql-test/t/log_tables_upgrade.test
+++ /dev/null
@@ -1,28 +0,0 @@
---source include/have_csv.inc
---source include/have_innodb.inc
---source include/mysql_upgrade_preparation.inc
-
---echo #
---echo # Bug#49823: mysql_upgrade fatal error due to general_log / slow_low CSV NULL
---echo #
-
-USE test;
-
-let $MYSQLD_DATADIR= `SELECT @@datadir`;
-copy_file std_data/bug49823.frm $MYSQLD_DATADIR/test/bug49823.frm;
-copy_file std_data/bug49823.CSM $MYSQLD_DATADIR/test/bug49823.CSM;
-copy_file std_data/bug49823.CSV $MYSQLD_DATADIR/test/bug49823.CSV;
-
-SET @saved_general_log = @@GLOBAL.general_log;
-SET GLOBAL general_log = OFF;
-USE mysql;
-FLUSH TABLES;
-REPAIR TABLE test.bug49823;
-RENAME TABLE general_log TO renamed_general_log;
-RENAME TABLE test.bug49823 TO general_log;
---exec $MYSQL_UPGRADE --force 2>&1
-DROP TABLE general_log;
-RENAME TABLE renamed_general_log TO general_log;
-SET GLOBAL general_log = @saved_general_log;
-remove_file $MYSQLD_DATADIR/mysql_upgrade_info;
-USE test;
diff --git a/mysql-test/t/long_tmpdir-master.opt b/mysql-test/t/long_tmpdir-master.opt
deleted file mode 100644
index 398abfc4632..00000000000
--- a/mysql-test/t/long_tmpdir-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---tmpdir=$MYSQLTEST_VARDIR/tmp/long_temporary_directory_path_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
diff --git a/mysql-test/t/long_tmpdir-master.sh b/mysql-test/t/long_tmpdir-master.sh
deleted file mode 100644
index 318955fbcca..00000000000
--- a/mysql-test/t/long_tmpdir-master.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-d="$MYSQLTEST_VARDIR/tmp/long_temporary_directory_path_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789"
-test -d "$d" || mkdir "$d"
-rm -f "$d"/*
diff --git a/mysql-test/t/long_tmpdir.test b/mysql-test/t/long_tmpdir.test
deleted file mode 100644
index cf0bed29918..00000000000
--- a/mysql-test/t/long_tmpdir.test
+++ /dev/null
@@ -1,9 +0,0 @@
-#
-# Bug #29015: Stack overflow in processing temporary table name when tmpdir path
-# is long
-#
-
-create view v1 as select table_name from information_schema.tables;
-drop view v1;
-
---echo End of 5.0 tests
diff --git a/mysql-test/t/lowercase_fs_off.test b/mysql-test/t/lowercase_fs_off.test
deleted file mode 100644
index b8a9795db9a..00000000000
--- a/mysql-test/t/lowercase_fs_off.test
+++ /dev/null
@@ -1,116 +0,0 @@
-#
-# Specific tests for case sensitive file systems
-# i.e. lower_case_filesystem=OFF
-#
--- source include/have_case_sensitive_file_system.inc
--- source include/not_embedded.inc
-
-set GLOBAL sql_mode="";
-set LOCAL sql_mode="";
-connect (master,localhost,root,,);
-connection master;
-create database d1;
-grant all on d1.* to 'sample'@'localhost' identified by 'password';
-flush privileges;
-
-connect (sample,localhost,sample,password,d1);
-connection sample;
-select database();
---error ER_DBACCESS_DENIED_ERROR
-create database d2;
---error ER_DBACCESS_DENIED_ERROR
-create database D1;
-disconnect sample;
---source include/wait_until_disconnected.inc
-
-connection master;
-drop user 'sample'@'localhost';
-drop database if exists d1;
-disconnect master;
---source include/wait_until_disconnected.inc
-connection default;
-
-# End of 4.1 tests
-
-#
-# Bug#41049 does syntax "grant" case insensitive?
-#
-CREATE DATABASE d1;
-USE d1;
-CREATE TABLE T1(f1 INT);
-CREATE TABLE t1(f1 INT);
-GRANT SELECT ON T1 to user_1@localhost;
-
-connect (con1,localhost,user_1,,d1);
---error ER_TABLEACCESS_DENIED_ERROR
-select * from t1;
-select * from T1;
-connection default;
-GRANT SELECT ON t1 to user_1@localhost;
-connection con1;
-select * from information_schema.table_privileges;
-connection default;
-disconnect con1;
-
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
-DROP USER user_1@localhost;
-DROP DATABASE d1;
-USE test;
-
-CREATE DATABASE db1;
-USE db1;
-CREATE PROCEDURE p1() BEGIN END;
-CREATE FUNCTION f1(i INT) RETURNS INT RETURN i+1;
-
-GRANT USAGE ON db1.* to user_1@localhost;
-GRANT EXECUTE ON PROCEDURE db1.P1 to user_1@localhost;
-GRANT EXECUTE ON FUNCTION db1.f1 to user_1@localhost;
-GRANT UPDATE ON db1.* to USER_1@localhost;
-
-connect (con1,localhost,user_1,,db1);
-call p1();
-call P1();
-select f1(1);
-connect (con2,localhost,USER_1,,db1);
---error ER_PROCACCESS_DENIED_ERROR
-call p1();
---error ER_PROCACCESS_DENIED_ERROR
-call P1();
---error ER_PROCACCESS_DENIED_ERROR
-select f1(1);
-
-connection default;
-disconnect con1;
-disconnect con2;
-
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM USER_1@localhost;
-DROP FUNCTION f1;
-DROP PROCEDURE p1;
-DROP USER user_1@localhost;
-DROP USER USER_1@localhost;
-DROP DATABASE db1;
-use test;
-
-# End of 5.0 tests
-
-
---echo #
---echo # Extra test coverage for Bug#56595 RENAME TABLE causes assert on OS X
---echo #
-
-CREATE TABLE t1(a INT);
-CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a= 1;
-RENAME TABLE t1 TO T1;
-ALTER TABLE T1 RENAME t1;
-DROP TABLE t1;
-
-#
-# MDEV-9014 SHOW TRIGGERS not case sensitive
-#
-create table t1 (a int);
-create trigger t1_bi before insert on t1 for each row set new.a= 1;
-show triggers like '%T1%';
-drop table t1;
-
-set GLOBAL sql_mode=default;
diff --git a/mysql-test/t/lowercase_fs_on.test b/mysql-test/t/lowercase_fs_on.test
deleted file mode 100644
index 1d306826e27..00000000000
--- a/mysql-test/t/lowercase_fs_on.test
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# Specific tests for case-insensitive file systems
-# i.e. lower_case_filesystem=ON
-#
--- source include/have_case_insensitive_file_system.inc
-# Embedded server does not support restarting.
---source include/not_embedded.inc
-
---echo #
---echo # Bug#20198490 : LOWER_CASE_TABLE_NAMES=0 ON WINDOWS LEADS TO PROBLEMS
---echo #
-
-let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err;
-
---error 0,1
---remove_file $SEARCH_FILE
-
-#Shutdown the server
---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server
---source include/wait_until_disconnected.inc
-
-#Start the server with --lower_case_table_names=0 in Windows.
---enable_reconnect
---error 1
---exec $MYSQLD_CMD --lower_case_table_names=0 > $SEARCH_FILE 2>&1
-
-#Search for the error messege in the server error log.
-let SEARCH_PATTERN= \[ERROR\] The server option \'lower_case_table_names\' is configured to use case sensitive table names;
---source include/search_pattern_in_file.inc
-
-#Restart the server
---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---source include/wait_until_connected_again.inc
-
-#Cleanup
---error 0,1
---remove_file $SEARCH_FILE
diff --git a/mysql-test/t/lowercase_mixed_tmpdir-master.opt b/mysql-test/t/lowercase_mixed_tmpdir-master.opt
deleted file mode 100644
index 3d21ea72f6b..00000000000
--- a/mysql-test/t/lowercase_mixed_tmpdir-master.opt
+++ /dev/null
@@ -1,2 +0,0 @@
---lower-case-table-names=1
---tmpdir=$MYSQLTEST_VARDIR/tmp/MixedCase
diff --git a/mysql-test/t/lowercase_mixed_tmpdir-master.sh b/mysql-test/t/lowercase_mixed_tmpdir-master.sh
deleted file mode 100644
index 95c26e3aa02..00000000000
--- a/mysql-test/t/lowercase_mixed_tmpdir-master.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-# This test requires a non-lowercase tmpdir directory on a case-sensitive
-# filesystem.
-
-d="$MYSQLTEST_VARDIR/tmp/MixedCase"
-test -d "$d" || mkdir "$d"
-rm -f "$d"/*
diff --git a/mysql-test/t/lowercase_mixed_tmpdir.test b/mysql-test/t/lowercase_mixed_tmpdir.test
deleted file mode 100644
index 6bd3a6f2acc..00000000000
--- a/mysql-test/t/lowercase_mixed_tmpdir.test
+++ /dev/null
@@ -1,12 +0,0 @@
---source include/have_case_sensitive_file_system.inc
---source include/have_lowercase1.inc
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1 (id int) engine=myisam;
-insert into t1 values (1);
-create temporary table t2 select * from t1;
-drop temporary table t2;
-drop table t1;
diff --git a/mysql-test/t/lowercase_mixed_tmpdir_innodb-master.opt b/mysql-test/t/lowercase_mixed_tmpdir_innodb-master.opt
deleted file mode 100644
index 272f91d629c..00000000000
--- a/mysql-test/t/lowercase_mixed_tmpdir_innodb-master.opt
+++ /dev/null
@@ -1,2 +0,0 @@
---lower-case-table-names=2
---tmpdir=$MYSQLTEST_VARDIR/tmp/MixedCase
diff --git a/mysql-test/t/lowercase_mixed_tmpdir_innodb-master.sh b/mysql-test/t/lowercase_mixed_tmpdir_innodb-master.sh
deleted file mode 100644
index 95c26e3aa02..00000000000
--- a/mysql-test/t/lowercase_mixed_tmpdir_innodb-master.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-# This test requires a non-lowercase tmpdir directory on a case-sensitive
-# filesystem.
-
-d="$MYSQLTEST_VARDIR/tmp/MixedCase"
-test -d "$d" || mkdir "$d"
-rm -f "$d"/*
diff --git a/mysql-test/t/lowercase_mixed_tmpdir_innodb.test b/mysql-test/t/lowercase_mixed_tmpdir_innodb.test
deleted file mode 100644
index e3b9b7b2a32..00000000000
--- a/mysql-test/t/lowercase_mixed_tmpdir_innodb.test
+++ /dev/null
@@ -1,12 +0,0 @@
---source include/have_lowercase2.inc
---source include/have_innodb.inc
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1 (id int) engine=InnoDB;
-insert into t1 values (1);
-create temporary table t2 engine=InnoDB select * from t1;
-drop temporary table t2;
-drop table t1;
diff --git a/mysql-test/t/lowercase_table-master.opt b/mysql-test/t/lowercase_table-master.opt
deleted file mode 100644
index c718e2feb1b..00000000000
--- a/mysql-test/t/lowercase_table-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---lower_case_table_names
diff --git a/mysql-test/t/lowercase_table.test b/mysql-test/t/lowercase_table.test
deleted file mode 100644
index c339105aae4..00000000000
--- a/mysql-test/t/lowercase_table.test
+++ /dev/null
@@ -1,120 +0,0 @@
-#
-# Test of --lower-case-table-names
-#
-
---disable_warnings
-drop table if exists t1,t2,t3,t4;
-# Clear up from other tests (to ensure that SHOW TABLES below is right)
-drop table if exists t0,t5,t6,t7,t8,t9;
-drop database if exists mysqltest;
-drop view if exists v0, v1, v2, v3, v4;
---enable_warnings
-
-create table T1 (id int primary key, Word varchar(40) not null, Index(Word));
-create table t4 (id int primary key, Word varchar(40) not null);
-INSERT INTO T1 VALUES (1, 'a'), (2, 'b'), (3, 'c');
-INSERT INTO T4 VALUES(1,'match');
-SELECT * FROM t1;
-SELECT T1.id from T1 LIMIT 1;
-SELECT T2.id from t1 as T2 LIMIT 1;
-SELECT * from t1 left join t4 on (test.t1.id= TEST.t4.id) where TEST.t1.id >= test.t4.id;
-# This gave an error in 4.0, but it's fixed in 4.1
-SELECT T2.id from t1 as t2 LIMIT 1;
-RENAME TABLE T1 TO T2;
-ALTER TABLE T2 ADD new_col int not null;
-ALTER TABLE T2 RENAME T3;
-show tables like 't_';
-drop table t3,t4;
-#
-# Test alias
-#
-create table t1 (a int);
-select count(*) from T1;
-select count(*) from t1;
-select count(T1.a) from t1;
-select count(bags.a) from t1 as Bags;
-drop table t1;
-
-#
-# Test all caps database name
-#
-create database mysqltest;
-use MYSQLTEST;
-create table t1 (a int);
-select T1.a from MYSQLTEST.T1;
-select t1.a from MYSQLTEST.T1;
-select mysqltest.t1.* from MYSQLTEST.t1;
-select MYSQLTEST.t1.* from MYSQLTEST.t1;
-select MYSQLTEST.T1.* from MYSQLTEST.T1;
-select MYSQLTEST.T1.* from T1;
-alter table t1 rename to T1;
-select MYSQLTEST.t1.* from MYSQLTEST.t1;
-drop database mysqltest;
-use test;
-
-#
-# multiupdate/delete & --lower-case-table-names
-#
-create table t1 (a int);
-create table t2 (a int);
-delete p1.*,P2.* from t1 as p1, t2 as p2 where p1.a=P2.a;
-delete P1.*,p2.* from t1 as P1, t2 as P2 where P1.a=p2.a;
-update t1 as p1, t2 as p2 SET p1.a=1,P2.a=1 where p1.a=P2.a;
-update t1 as P1, t2 as P2 SET P1.a=1,p2.a=1 where P1.a=p2.a;
-drop table t1,t2;
-
-#
-# aliases case insensitive
-#
-create table t1 (a int);
-create table t2 (a int);
--- error 1066
-select * from t1 c, t2 C;
--- error 1066
-select C.a, c.a from t1 c, t2 C;
-drop table t1, t2;
-
-#
-# Bug #9761: CREATE TABLE ... LIKE ... not handled correctly when
-# lower_case_table_names is set
-
-create table t1 (a int);
-create table t2 like T1;
-drop table t1, t2;
-
-show tables;
-
-# End of 4.1 tests
-
-
-#
-# Bug#20404: SHOW CREATE TABLE fails with Turkish I
-#
-set names utf8;
---disable_warnings
-drop table if exists İ,İİ;
---enable_warnings
-create table İ (s1 int);
-show create table İ;
-show tables;
-drop table İ;
-create table İİ (s1 int);
-show create table İİ;
-show tables;
-drop table İİ;
-set names latin1;
-
---echo End of 5.0 tests
-
-#
-# Bug#21317: SHOW CREATE DATABASE does not obey to lower_case_table_names
-#
-create database mysql_TEST character set latin2;
-create table mysql_TEST.T1 (a int);
-show create database mysql_TEST;
-show create table mysql_TEST.T1;
-show databases like "mysql%";
-show databases like "mysql_TE%";
-drop database mysql_TEST;
-
---echo End of 10.0 tests
diff --git a/mysql-test/t/lowercase_table2.test b/mysql-test/t/lowercase_table2.test
deleted file mode 100644
index ec495ac4708..00000000000
--- a/mysql-test/t/lowercase_table2.test
+++ /dev/null
@@ -1,290 +0,0 @@
-#
-# Test of --lower-case-table-names=2
-# (User has case insensitive file system and wants to preserve case of
-# table names)
-#
---source include/have_innodb.inc
---require r/lowercase2.require
-disable_query_log;
-show variables like "lower_case_table_names";
-enable_query_log;
-
---disable_warnings
-DROP TABLE IF EXISTS t1,t2,t3,t2aA,t1Aa;
-DROP DATABASE IF EXISTS `TEST_$1`;
-DROP DATABASE IF EXISTS `test_$1`;
-DROP DATABASE IF EXISTS mysqltest_LC2;
---enable_warnings
-
-CREATE TABLE T1 (a int) ENGINE=MyISAM;
-INSERT INTO T1 VALUES (1);
-SHOW TABLES LIKE "T1";
-SHOW TABLES LIKE "t1";
-SHOW CREATE TABLE T1;
-RENAME TABLE T1 TO T2;
-SHOW TABLES LIKE "T2";
-SELECT * FROM t2;
-RENAME TABLE T2 TO t3;
-SHOW TABLES LIKE "T3";
-RENAME TABLE T3 TO T1;
-SHOW TABLES LIKE "T1";
-ALTER TABLE T1 add b int;
-SHOW TABLES LIKE "T1";
-ALTER TABLE T1 RENAME T2;
-SHOW TABLES LIKE "T2";
-
-LOCK TABLE T2 WRITE;
-ALTER TABLE T2 drop b;
-SHOW TABLES LIKE "T2";
-UNLOCK TABLES;
-RENAME TABLE T2 TO T1;
-SHOW TABLES LIKE "T1";
-SELECT * from T1;
-DROP TABLE T1;
-
-#
-# Test database level
-#
-
-CREATE DATABASE `TEST_$1`;
-SHOW DATABASES LIKE "TEST%";
-DROP DATABASE `test_$1`;
-
-#
-# Test of innodb tables with lower_case_table_names=2
-#
-
-CREATE TABLE T1 (a int) engine=innodb;
-INSERT INTO T1 VALUES (1);
-SHOW TABLES LIKE "T1";
-SHOW TABLES LIKE "t1";
-SHOW CREATE TABLE T1;
-RENAME TABLE T1 TO T2;
-SHOW TABLES LIKE "T2";
-SELECT * FROM t2;
-RENAME TABLE T2 TO t3;
-SHOW TABLES LIKE "T3";
-RENAME TABLE T3 TO T1;
-SHOW TABLES LIKE "T1";
-ALTER TABLE T1 add b int;
-SHOW TABLES LIKE "T1";
-ALTER TABLE T1 RENAME T2;
-SHOW TABLES LIKE "T2";
-
-LOCK TABLE T2 WRITE;
-ALTER TABLE T2 drop b;
-SHOW TABLES LIKE "T2";
-UNLOCK TABLES;
-RENAME TABLE T2 TO T1;
-SHOW TABLES LIKE "T1";
-SELECT * from T1;
-DROP TABLE T1;
-
-create database mysqltest_UPPERCASE;
-CREATE TABLE mysqltest_UPPERCASE.T1 (a int) engine=innodb;
-CREATE TABLE mysqltest_uppercase.t2 (a int) engine=innodb;
-CREATE TABLE mysqltest_UPPERCASE.t3 (a int) engine=innodb;
-drop table mysqltest_UPPERCASE.T1;
-drop table mysqltest_UPPERCASE.T2;
-drop table mysqltest_uppercase.t3;
-drop database mysqltest_UPPERCASE;
-
-#
-# Test problem with temporary tables (Bug #2858)
-#
-
-create table T1 (EVENT_ID int auto_increment primary key, LOCATION char(20));
-insert into T1 values (NULL,"Mic-4"),(NULL,"Mic-5"),(NULL,"Mic-6");
-SELECT LOCATION FROM T1 WHERE EVENT_ID=2 UNION ALL SELECT LOCATION FROM T1 WHERE EVENT_ID=3;
-SELECT LOCATION FROM T1 WHERE EVENT_ID=2 UNION ALL SELECT LOCATION FROM T1 WHERE EVENT_ID=3;
-SELECT LOCATION FROM T1 WHERE EVENT_ID=2 UNION ALL SELECT LOCATION FROM T1 WHERE EVENT_ID=3;
-drop table T1;
-
-#
-# Test name conversion with ALTER TABLE / CREATE INDEX (Bug #3109)
-#
-
-create table T1 (A int);
-alter table T1 add index (A);
-show tables like 'T1%';
-alter table t1 add index (A);
-show tables like 't1%';
-drop table t1;
-
-#
-# Bug #7261: Alter table loses temp table
-#
-
-create temporary table T1(a int(11), b varchar(8));
-insert into T1 values (1, 'abc');
-select * from T1;
-alter table T1 add index (a);
-select * from T1;
-drop table T1;
-
-#
-# Bug #8355: Tables not dropped from table cache on drop db
-#
-create database mysqltest_LC2;
-use mysqltest_LC2;
-create table myUC (i int);
-show tables;
-insert into myUC values (1),(2),(3);
-select * from myUC;
-use test;
-drop database mysqltest_LC2;
-create database mysqltest_LC2;
-use mysqltest_LC2;
-create table myUC (i int);
-select * from myUC;
-use test;
-drop database mysqltest_LC2;
-
-#
-# Bug #9500: Problem with WHERE clause
-#
-create table t2aA (col1 int);
-create table t1Aa (col1 int);
-select t1Aa.col1 from t1aA,t2Aa where t1Aa.col1 = t2aA.col1;
-drop table t2aA, t1Aa;
-
-# End of 4.1 tests
-
-#
-# Bug#17661 information_schema.SCHEMATA returns uppercase with lower_case_table_names = 1
-#
-create database mysqltest_LC2;
-use mysqltest_LC2;
-create table myUC (i int);
-select TABLE_SCHEMA,TABLE_NAME FROM information_schema.TABLES
-where TABLE_SCHEMA ='mysqltest_LC2';
-use test;
-drop database mysqltest_LC2;
-
-
---echo #
---echo # Bug #11758687: 50924: object names not resolved correctly
---echo # on lctn2 systems
---echo #
-
-CREATE DATABASE BUP_XPFM_COMPAT_DB2;
-
-CREATE TABLE BUP_XPFM_COMPAT_DB2.TABLE2 (c13 INT) DEFAULT CHARSET latin1;
-CREATE TABLE BUP_XPFM_COMPAT_DB2.table1 (c13 INT) DEFAULT CHARSET latin1;
-CREATE TABLE bup_xpfm_compat_db2.table3 (c13 INT) DEFAULT CHARSET latin1;
-
-delimiter |;
-#
-CREATE TRIGGER BUP_XPFM_COMPAT_DB2.trigger1 AFTER INSERT
- ON BUP_XPFM_COMPAT_DB2.table1 FOR EACH ROW
- update BUP_XPFM_COMPAT_DB2.table1 set c13=12;
-|
-CREATE TRIGGER BUP_XPFM_COMPAT_DB2.TRIGGER2 AFTER INSERT
- ON BUP_XPFM_COMPAT_DB2.TABLE2 FOR EACH ROW
- update BUP_XPFM_COMPAT_DB2.table1 set c13=12;
-|
-CREATE TRIGGER BUP_XPFM_COMPAT_DB2.TrigGer3 AFTER INSERT
- ON BUP_XPFM_COMPAT_DB2.TaBle3 FOR EACH ROW
- update BUP_XPFM_COMPAT_DB2.table1 set c13=12;
-|
-delimiter ;|
-
-SELECT trigger_schema, trigger_name, event_object_table FROM
-INFORMATION_SCHEMA.TRIGGERS
- WHERE trigger_schema COLLATE utf8_bin = 'BUP_XPFM_COMPAT_DB2'
- ORDER BY trigger_schema, trigger_name;
-
-DROP DATABASE BUP_XPFM_COMPAT_DB2;
-
---echo # End of 5.1 tests
-
-
---echo #
---echo # Test for bug #44738 "fill_schema_table_from_frm() opens tables without
---echo # lowercasing table name". Due to not properly normalizing table names
---echo # in lower_case_table_names modes in this function queries to I_S which
---echo # were executed through it left entries with incorrect key in table
---echo # definition cache. As result further queries to I_S that used this
---echo # function produced stale results in cases when table definition was
---echo # changed by a DDL statement. Also combination of this issue and a
---echo # similar problem in CREATE TABLE (it also has peeked into table
---echo # definition cache using non-normalized key) led to spurious
---echo # ER_TABLE_EXISTS_ERROR errors when one tried to create table with the
---echo # same name as a previously existing but dropped table.
---echo #
---disable_warnings
-drop database if exists mysqltest_UPPERCASE;
-drop table if exists t_bug44738_UPPERCASE;
---enable_warnings
-create database mysqltest_UPPERCASE;
-use mysqltest_UPPERCASE;
-select database();
-create table t_bug44738_UPPERCASE (i int) comment='Old comment';
-create table t_bug44738_lowercase (i int) comment='Old comment';
-create table t_bug44738_UPPERCASE2 (i int) comment='Old comment';
-create table t_bug44738_lowercase2 (i int) comment='Old comment';
-select table_schema, table_name, table_comment from information_schema.tables
- where table_schema like 'mysqltest_%' and table_name like 't_bug44738_%'
- order by table_name;
-alter table t_bug44738_UPPERCASE comment='New comment';
-alter table t_bug44738_lowercase comment='New comment';
-alter table mysqltest_uppercase.t_bug44738_UPPERCASE2 comment='New comment';
-alter table mysqltest_UPPERCASE.t_bug44738_lowercase2 comment='New comment';
---echo # There should be no stale entries in TDC for our tables after the
---echo # above ALTER TABLE statements so new version of comments should be
---echo # returned by the below query to I_S.
-select table_schema, table_name, table_comment from information_schema.tables
- where table_schema like 'mysqltest_%' and table_name like 't_bug44738_%'
- order by table_name;
-drop database mysqltest_UPPERCASE;
-use test;
-
---echo # Let us check that the original test case which led to discovery
---echo # of this problem also works.
-create table t_bug44738_UPPERCASE (i int);
-select table_schema, table_name, table_comment from information_schema.tables
- where table_schema = 'test' and table_name like 't_bug44738_%';
-drop table t_bug44738_UPPERCASE;
---echo # After the above DROP TABLE there are no entries in TDC which correspond
---echo # to our table and therefore the below statement should succeed.
-create table t_bug44738_UPPERCASE (i int);
-drop table t_bug44738_UPPERCASE;
-
---echo # Finally, let us check that another issue which was exposed by
---echo # the original test case is solved. I.e. that the table is not
---echo # created if there is an entry for it in TDC even though it was
---echo # removed from disk.
-create table t_bug44738_UPPERCASE (i int) engine = myisam;
---echo # Load table definition in TDC.
-select table_schema, table_name, table_comment from information_schema.tables
- where table_schema = 'test' and table_name like 't_bug44738_%';
---echo # Simulate manual removal of the table.
-let $MYSQLD_DATADIR= `select @@datadir`;
---remove_file $MYSQLD_DATADIR/test/t_bug44738_UPPERCASE.frm
---remove_file $MYSQLD_DATADIR/test/t_bug44738_UPPERCASE.MYD
---remove_file $MYSQLD_DATADIR/test/t_bug44738_UPPERCASE.MYI
---echo # Check that still there is an entry for table in TDC.
-show open tables like 't_bug44738_%';
---echo # So attempt to create table with the same name should fail.
---error ER_TABLE_EXISTS_ERROR
-create table t_bug44738_UPPERCASE (i int);
---echo # And should succeed after FLUSH TABLES.
-flush tables;
-create table t_bug44738_UPPERCASE (i int);
-drop table t_bug44738_UPPERCASE;
-
---echo #
---echo # Bug #21317 SHOW CREATE DATABASE does not obey to
---echo # lower_case_table_names
---echo #
-
-create database mysql_TEST;
-create table mysql_TEST.T1(a int);
-show databases like 'mysql%';
-show databases like 'mysql_T%';
-show databases like 'mysql_t%';
-show create database mysql_test;
-show create database mysql_TEST;
-show create table mysql_TEST.T1;
-show create table mysql_test.t1;
-drop database mysql_TEST;
diff --git a/mysql-test/t/lowercase_table4-master.opt b/mysql-test/t/lowercase_table4-master.opt
deleted file mode 100644
index ac4d3211e89..00000000000
--- a/mysql-test/t/lowercase_table4-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---lower-case-table-names=2
diff --git a/mysql-test/t/lowercase_table4.test b/mysql-test/t/lowercase_table4.test
deleted file mode 100644
index 981c8a14564..00000000000
--- a/mysql-test/t/lowercase_table4.test
+++ /dev/null
@@ -1,111 +0,0 @@
---source include/have_case_insensitive_file_system.inc
---source include/have_innodb.inc
-
---echo #
---echo # Bug#46941 crash with lower_case_table_names=2 and
---echo # foreign data dictionary confusion
---echo #
-
-CREATE DATABASE XY;
-USE XY;
-set @old_table_open_cache=@@table_open_cache;
-set global table_open_cache = 512;
-
-#
-# Logs are disabled, since the number of creates tables
-# and subsequent select statements may vary between
-# versions
-#
---disable_query_log
---disable_result_log
-
-let $tcs = `SELECT @@table_open_cache + 1`;
-
-let $i = $tcs;
-
-while ($i)
-{
- eval CREATE TABLE XY.T_$i (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL, d INT,
- primary key(a, b), unique(b)) ENGINE=InnoDB;
- dec $i;
-}
-
-eval ALTER TABLE XY.T_$tcs ADD INDEX I1 (c, b),
- ADD CONSTRAINT C1 FOREIGN KEY (c, b) REFERENCES XY.T_1 (a, b);
-
-eval ALTER TABLE XY.T_$tcs ADD INDEX I2 (b),
- ADD CONSTRAINT C2 FOREIGN KEY (b) REFERENCES XY.T_1(a);
-
-let $i = $tcs;
-while ($i)
-{
- eval SELECT * FROM XY.T_$i LIMIT 1;
- dec $i;
-}
-
-DROP DATABASE XY;
-CREATE DATABASE XY;
-USE XY;
-eval CREATE TABLE XY.T_$tcs (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL, d INT,
- PRIMARY KEY(a, b), UNIQUE(b)) ENGINE=InnoDB;
-#
-# The bug causes this SELECT to err
-eval SELECT * FROM XY.T_$tcs LIMIT 1;
-
---enable_query_log
---enable_result_log
-set global table_open_cache = @old_table_open_cache;
-DROP DATABASE XY;
-USE TEST;
-
---echo #
---echo # Bug55222 Mysqldump table names case bug in REFERENCES clause
---echo # InnoDB did not handle lower_case_table_names=2 for
---echo # foreign_table_names and referenced_table_names.
---echo #
-
-SHOW VARIABLES LIKE 'lower_case_table_names';
-
---disable_warnings
-DROP TABLE IF EXISTS `Table2`;
-DROP TABLE IF EXISTS `Table1`;
---disable_warnings
-
-CREATE TABLE `Table1`(c1 INT PRIMARY KEY) ENGINE=InnoDB;
-CREATE TABLE `Table2`(c1 INT PRIMARY KEY, c2 INT) ENGINE=InnoDB;
-ALTER TABLE `Table2` ADD CONSTRAINT fk1 FOREIGN KEY(c2) REFERENCES `Table1`(c1);
-query_vertical SHOW CREATE TABLE `Table2`;
-query_vertical SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS WHERE CONSTRAINT_SCHEMA='test';
-DROP TABLE `Table2`;
-DROP TABLE `Table1`;
-
---disable_warnings
-DROP TABLE IF EXISTS Product_Order;
-DROP TABLE IF EXISTS Product;
-DROP TABLE IF EXISTS Customer;
---enable_warnings
-
-CREATE TABLE Product (Category INT NOT NULL, Id INT NOT NULL,
- Price DECIMAL, PRIMARY KEY(Category, Id)) ENGINE=InnoDB;
-CREATE TABLE Customer (Id INT NOT NULL, PRIMARY KEY (Id)) ENGINE=InnoDB;
-CREATE TABLE Product_Order (No INT NOT NULL AUTO_INCREMENT,
- Product_Category INT NOT NULL,
- Product_Id INT NOT NULL,
- Customer_Id INT NOT NULL,
- PRIMARY KEY(No),
- INDEX (Product_Category, Product_Id),
- FOREIGN KEY (Product_Category, Product_Id)
- REFERENCES Product(Category, Id) ON UPDATE CASCADE ON DELETE RESTRICT,
- INDEX (Customer_Id),
- FOREIGN KEY (Customer_Id)
- REFERENCES Customer(Id)
- ) ENGINE=INNODB;
-
-query_vertical SHOW CREATE TABLE Product_Order;
-query_vertical SHOW CREATE TABLE Product;
-query_vertical SHOW CREATE TABLE Customer;
-query_vertical SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS WHERE CONSTRAINT_SCHEMA='test';
-DROP TABLE Product_Order;
-DROP TABLE Product;
-DROP TABLE Customer;
-
diff --git a/mysql-test/t/lowercase_table5.test b/mysql-test/t/lowercase_table5.test
deleted file mode 100644
index dfdfafcb3da..00000000000
--- a/mysql-test/t/lowercase_table5.test
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# Tests that requires lower_case_table_names to be 0
-# (Normal case on Unix)
-#
---source include/have_lowercase0.inc
---source include/have_case_sensitive_file_system.inc
-
-#
-# Check caching of database options
-#
-
-CREATE DATABASE mysql_TEST CHARACTER SET utf8;
-SHOW CREATE DATABASE mysql_TEST;
-CREATE DATABASE mysql_test CHARACTER SET latin2;
-SHOW CREATE DATABASE mysql_test;
-SHOW CREATE DATABASE mysql_TEST;
-DROP DATABASE mysql_test;
-DROP DATABASE mysql_TEST;
-
-# End of 10.0 tests
diff --git a/mysql-test/t/lowercase_table_grant-master.opt b/mysql-test/t/lowercase_table_grant-master.opt
deleted file mode 100644
index c718e2feb1b..00000000000
--- a/mysql-test/t/lowercase_table_grant-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---lower_case_table_names
diff --git a/mysql-test/t/lowercase_table_grant.test b/mysql-test/t/lowercase_table_grant.test
deleted file mode 100644
index 2f98f570e29..00000000000
--- a/mysql-test/t/lowercase_table_grant.test
+++ /dev/null
@@ -1,31 +0,0 @@
-# Don't test with embedded server
--- source include/not_embedded.inc
-
-# Test of grants when lower_case_table_names is on
-use mysql;
-set sql_mode="";
-
-# mixed-case database name for testing
-create database MYSQLtest;
-
-# check that database name gets forced to lowercase
-grant all on MySQLtest.* to mysqltest_1@localhost;
-show grants for mysqltest_1@localhost;
-
-# now force it to mixed case, but see that it is lowercased in the acl cache
-select * from db where user = 'mysqltest_1';
-update db set db = 'MYSQLtest' where db = 'mysqltest' and user = 'mysqltest_1' and host = 'localhost';
-flush privileges;
-show grants for mysqltest_1@localhost;
-select * from db where user = 'mysqltest_1';
-
-# clear out the user we created
-#
-# can't use REVOKE because of the mixed-case database name
-delete from db where db = 'MYSQLtest' and user = 'mysqltest_1' and host = 'localhost';
-flush privileges;
-drop user mysqltest_1@localhost;
-
-drop database MYSQLtest;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/lowercase_table_qcache-master.opt b/mysql-test/t/lowercase_table_qcache-master.opt
deleted file mode 100644
index c718e2feb1b..00000000000
--- a/mysql-test/t/lowercase_table_qcache-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---lower_case_table_names
diff --git a/mysql-test/t/lowercase_table_qcache.test b/mysql-test/t/lowercase_table_qcache.test
deleted file mode 100644
index ab05755bec1..00000000000
--- a/mysql-test/t/lowercase_table_qcache.test
+++ /dev/null
@@ -1,34 +0,0 @@
--- source include/have_query_cache.inc
-#
-# Test of query cache with --lower-case-table-names
-#
-set GLOBAL query_cache_size=1355776;
-set GLOBAL query_cache_type=ON;
-set LOCAL query_cache_type=ON;
-
---disable_warnings
-drop database if exists MySQLtesT;
---enable_warnings
-
-create database MySQLtesT;
-create table MySQLtesT.t1 (a int);
-select * from MySQLtesT.t1;
-show status like "Qcache_queries_in_cache";
-drop database mysqltest;
-show status like "Qcache_queries_in_cache";
-
-use MySQL;
-disable_result_log;
-select * from db;
-enable_result_log;
-show status like "Qcache_queries_in_cache";
-use test;
-disable_result_log;
-select * from MySQL.db;
-enable_result_log;
-show status like "Qcache_queries_in_cache";
-
-set GLOBAL query_cache_size=default;
-set GLOBAL query_cache_type=default;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/lowercase_utf8-master.opt b/mysql-test/t/lowercase_utf8-master.opt
deleted file mode 100644
index 1b70aa33023..00000000000
--- a/mysql-test/t/lowercase_utf8-master.opt
+++ /dev/null
@@ -1,4 +0,0 @@
---lower-case-table-names=1 --character-set-server=utf8
-
-
-
diff --git a/mysql-test/t/lowercase_utf8.test b/mysql-test/t/lowercase_utf8.test
deleted file mode 100644
index 01b154598fd..00000000000
--- a/mysql-test/t/lowercase_utf8.test
+++ /dev/null
@@ -1,9 +0,0 @@
-#
-# Bug#25830 SHOW TABLE STATUS behaves differently depending on table name
-#
-set names utf8;
-create table `Ö` (id int);
-show tables from test like 'Ö';
-show tables from test like 'ö';
-drop table `Ö`;
-
diff --git a/mysql-test/t/lowercase_view-master.opt b/mysql-test/t/lowercase_view-master.opt
deleted file mode 100644
index 62ab6dad1e0..00000000000
--- a/mysql-test/t/lowercase_view-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---lower_case_table_names=1
diff --git a/mysql-test/t/lowercase_view.test b/mysql-test/t/lowercase_view.test
deleted file mode 100644
index cdd0256d639..00000000000
--- a/mysql-test/t/lowercase_view.test
+++ /dev/null
@@ -1,110 +0,0 @@
---disable_warnings
-drop table if exists t1Aa,t2Aa,v1Aa,v2Aa;
-drop view if exists t1Aa,t2Aa,v1Aa,v2Aa;
-drop database if exists MySQLTest;
---enable_warnings
-
-#
-# different cases in VIEW
-#
-create database MySQLTest;
-use MySQLTest;
-create table TaB (Field int);
-create view ViE as select * from TAb;
-show create table VIe;
-drop database MySQLTest;
-use test;
-
-#
-# test of updating and fetching from the same table check
-#
-create table t1Aa (col1 int);
-create table t2aA (col1 int);
-create view v1Aa as select * from t1aA;
-create view v2aA as select * from v1aA;
-create view v3Aa as select v2Aa.col1 from v2aA,t2Aa where v2Aa.col1 = t2aA.col1;
--- error 1443
-insert into v2Aa values ((select max(col1) from v1aA));
--- error 1443
-insert into t1aA values ((select max(col1) from v1Aa));
--- error 1443
-insert into v2aA values ((select max(col1) from v1aA));
--- error 1443
-insert into v2Aa values ((select max(col1) from t1Aa));
--- error 1093
-insert into t1aA values ((select max(col1) from t1Aa));
--- error 1443
-insert into v2aA values ((select max(col1) from t1aA));
--- error 1093
-insert into v2Aa values ((select max(col1) from v2aA));
--- error 1443
-insert into t1Aa values ((select max(col1) from v2Aa));
--- error 1093
-insert into v2aA values ((select max(col1) from v2Aa));
--- error 1443
-insert into v3Aa (col1) values ((select max(col1) from v1Aa));
--- error 1443
-insert into v3aA (col1) values ((select max(col1) from t1aA));
--- error 1443
-insert into v3Aa (col1) values ((select max(col1) from v2aA));
-drop view v3aA,v2Aa,v1aA;
-drop table t1Aa,t2Aa;
-
-#
-# aliases in VIEWs
-#
-create table t1Aa (col1 int);
-create view v1Aa as select col1 from t1Aa as AaA;
-show create view v1AA;
-drop view v1AA;
-select Aaa.col1 from t1Aa as AaA;
-create view v1Aa as select Aaa.col1 from t1Aa as AaA;
-drop view v1AA;
-create view v1Aa as select AaA.col1 from t1Aa as AaA;
-show create view v1AA;
-drop view v1AA;
-drop table t1Aa;
-
-
-#
-# Bug #31562: HAVING and lower case
-#
-
-CREATE TABLE t1 (a int, b int);
-
-select X.a from t1 AS X group by X.b having (X.a = 1);
-select X.a from t1 AS X group by X.b having (x.a = 1);
-select X.a from t1 AS X group by X.b having (x.b = 1);
-
-CREATE OR REPLACE VIEW v1 AS
-select X.a from t1 AS X group by X.b having (X.a = 1);
-
-SHOW CREATE VIEW v1;
-
-SELECT * FROM v1;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-
---echo End of 5.0 tests.
-
-
---echo #
---echo # Bug #53095: SELECT column_name FROM INFORMATION_SCHEMA.STATISTICS
---echo # returns nothing
---echo #
-
-CREATE TABLE `ttt` (
- `f1` char(3) NOT NULL,
- PRIMARY KEY (`f1`)
-) ENGINE=myisam DEFAULT CHARSET=latin1;
-
-SELECT count(COLUMN_NAME) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME =
-'TTT';
-SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 'TTT';
-
-DROP TABLE `ttt`;
-
-
---echo End of 5.0 tests.
diff --git a/mysql-test/t/max_statement_time.test b/mysql-test/t/max_statement_time.test
deleted file mode 100644
index 0882daff139..00000000000
--- a/mysql-test/t/max_statement_time.test
+++ /dev/null
@@ -1,228 +0,0 @@
-#
-# Test behavior of MAX_STATEMENT_TIME.
-# We can't do this under valgrind as valgrind interferes with thread scheduling
-#
-
---source include/not_embedded.inc
---source include/have_innodb.inc
---source include/not_valgrind.inc
-
---echo
---echo # Test the MAX_STATEMENT_TIME option.
---echo
-
-SET @@MAX_STATEMENT_TIME=2;
-select @@max_statement_time;
-SELECT SLEEP(1);
-SELECT SLEEP(3);
-SET @@MAX_STATEMENT_TIME=0;
-SELECT SLEEP(1);
-SHOW STATUS LIKE "max_statement_time_exceeded";
-
-CREATE TABLE t1 (a INT, b VARCHAR(300)) engine=myisam;
-
-INSERT INTO t1 VALUES (1, 'string');
-
---disable_result_log
---disable_query_log
-
-SET @@MAX_STATEMENT_TIME=2;
-
-SET @@MAX_STATEMENT_TIME=0.1;
-WHILE (! $mysql_errno)
-{
- SET @@MAX_STATEMENT_TIME=0;
- INSERT INTO t1 SELECT * FROM t1;
- SET @@MAX_STATEMENT_TIME=0.1;
- --error 0,ER_STATEMENT_TIMEOUT
- SELECT COUNT(*) FROM t1 WHERE b LIKE '%z%';
-}
-SET @@MAX_STATEMENT_TIME=0;
-
---enable_query_log
---enable_result_log
-
-eval SELECT $mysql_errno;
-
---echo
---echo # Test the MAX_STATEMENT_TIME option with SF (should have no effect).
---echo
-
-DELIMITER |;
-
-CREATE PROCEDURE p1()
-BEGIN
- declare tmp int;
- SET @@MAX_STATEMENT_TIME=0.0001;
- SELECT COUNT(*) INTO tmp FROM t1 WHERE b LIKE '%z%';
- SET @@MAX_STATEMENT_TIME=0;
-END|
-
-CREATE PROCEDURE p2()
-BEGIN
- SET @@MAX_STATEMENT_TIME=5;
-END|
-
-DELIMITER ;|
-
-SELECT @@MAX_STATEMENT_TIME;
-CALL p1();
-CALL p2();
-SELECT @@MAX_STATEMENT_TIME;
-SET @@MAX_STATEMENT_TIME=0;
-
-DROP PROCEDURE p1;
-DROP PROCEDURE p2;
-DROP TABLE t1;
-
---echo
---echo # MAX_STATEMENT_TIME account resource
---echo
-
-set statement sql_mode="" for
-GRANT USAGE ON *.* TO user1@localhost WITH MAX_STATEMENT_TIME 1.005;
-
---echo # con1
-connect(con1,localhost,user1,,test,,);
-SELECT @@max_statement_time;
-disconnect con1;
-
---echo # restart and reconnect
-connection default;
-source include/restart_mysqld.inc;
-
-set @global.userstat=1;
-connect(con1,localhost,user1,,test,,);
-SELECT @@global.max_statement_time,@@session.max_statement_time;
-select sleep(100);
-SHOW STATUS LIKE "max_statement_time_exceeded";
-disconnect con1;
-
-connection default;
-show grants for user1@localhost;
---disable_parsing
-select max_user_timeouts from information_schema.user_statistics where user="user1";
---enable_parsing
-
-set @global.userstat=0;
-DROP USER user1@localhost;
-
---echo
---echo # MAX_STATEMENT_TIME status variables.
---echo
-
-flush status;
-
-SET @@max_statement_time=0;
-SELECT CONVERT(VARIABLE_VALUE, UNSIGNED) INTO @time_exceeded
- FROM INFORMATION_SCHEMA.GLOBAL_STATUS
- WHERE VARIABLE_NAME = 'max_statement_time_exceeded';
-
-SET @@max_statement_time=0.5;
-SELECT SLEEP(2);
-SHOW STATUS LIKE '%timeout%';
-SET @@max_statement_time=0;
-
---echo # Ensure that the counters for:
---echo # - statements that exceeded their maximum execution time
---echo # are incremented.
-
-SELECT 1 AS STATUS FROM INFORMATION_SCHEMA.GLOBAL_STATUS
- WHERE VARIABLE_NAME = 'max_statement_time_exceeded'
- AND CONVERT(VARIABLE_VALUE, UNSIGNED) > @time_exceeded;
-
---echo
---echo # Check that the appropriate error status is set.
---echo
-
-CREATE TABLE t1 (a INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1);
-
-START TRANSACTION;
-SELECT * FROM t1 FOR UPDATE;
-
-connect (con1,localhost,root,,test,,);
-SET @@SESSION.max_statement_time = 0.5;
---error ER_STATEMENT_TIMEOUT
-UPDATE t1 SET a = 2;
-SHOW WARNINGS;
-disconnect con1;
-
-connection default;
-ROLLBACK;
-DROP TABLE t1;
-
---echo
---echo # Test interaction with lock waits.
---echo
-
-CREATE TABLE t1 (a INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1);
-
-connect (con1,localhost,root,,test,,);
-SET @@SESSION.max_statement_time= 0.5;
-
-connection default;
-LOCK TABLES t1 WRITE;
-
-connection con1;
-SELECT @@SESSION.max_statement_time;
---error ER_STATEMENT_TIMEOUT
-LOCK TABLES t1 READ;
-
-connection default;
-UNLOCK TABLES;
-BEGIN;
-SELECT * FROM t1;
-
-connection con1;
---error ER_STATEMENT_TIMEOUT
-ALTER TABLE t1 ADD COLUMN b INT;
-
-connection default;
-ROLLBACK;
-SELECT GET_LOCK('lock', 1);
-
-connection con1;
-SELECT GET_LOCK('lock', 1);
-
-disconnect con1;
-connection default;
-SELECT RELEASE_LOCK('lock');
-DROP TABLE t1;
-
---echo #
---echo # MDEV-7011:MAX_STATEMENT_TIME has no effect in a procedure after
---echo # a previous successful statement
---echo #
-create table t1 (i int);
-insert into t1 values (1),(2),(3),(4);
-insert into t1 select a.* from t1 a, t1 b, t1 c, t1 d, t1 e, t1 f, t1 g;
-delimiter |;
-create procedure pr()
- begin
- select 1;
- select sql_no_cache * from t1 where i > 5;
- select sql_no_cache * from t1 where i > 5;
- select sleep(2);
- end |
-delimiter ;|
-set max_statement_time = 0.001;
---error ER_STATEMENT_TIMEOUT
-call pr();
-set max_statement_time = 0;
-drop procedure pr;
-delimiter |;
-create procedure pr()
- begin
- select sql_no_cache * from t1 where i > 5;
- select sql_no_cache * from t1 where i > 5;
- select sleep(2);
- end |
-delimiter ;|
-set max_statement_time = 0.001;
---error ER_STATEMENT_TIMEOUT
-call pr();
-set max_statement_time = 0;
-drop procedure pr;
-drop table t1;
diff --git a/mysql-test/t/mdev-504.test b/mysql-test/t/mdev-504.test
deleted file mode 100644
index 551c21c37d0..00000000000
--- a/mysql-test/t/mdev-504.test
+++ /dev/null
@@ -1,80 +0,0 @@
---source include/not_valgrind.inc
---source include/no_protocol.inc
-
-SET GLOBAL net_write_timeout = 900;
-
-CREATE TABLE A (
- pk INTEGER AUTO_INCREMENT PRIMARY KEY,
- fdate DATE
-) ENGINE=MyISAM;
-
---delimiter |
-
-CREATE PROCEDURE p_analyze()
-BEGIN
- DECLARE attempts INTEGER DEFAULT 100;
- wl_loop: WHILE attempts > 0 DO
- ANALYZE TABLE A;
- SET attempts = attempts - 1;
- END WHILE wl_loop;
-END |
-
-CREATE FUNCTION rnd3() RETURNS INT
-BEGIN
- RETURN ROUND(3 * RAND() + 0.5);
-END |
-
---delimiter ;
-
-SET GLOBAL use_stat_tables = PREFERABLY;
-
---let $trial = 100
-
---disable_query_log
---disable_result_log
---disable_warnings
-while ($trial)
-{
-
- --connect (con1,localhost,root,,)
- --send CALL p_analyze()
-
- --connect (con2,localhost,root,,)
- --send CALL p_analyze()
-
- --let $run = 100
-
- while ($run)
- {
- --connect (con3,localhost,root,,)
-
- let $query = `SELECT CASE rnd3()
- WHEN 1 THEN 'INSERT INTO A (pk) VALUES (NULL)'
- WHEN 2 THEN 'DELETE FROM A LIMIT 1'
- ELSE 'UPDATE IGNORE A SET fdate = 2 LIMIT 1' END`;
- --eval $query
- --disconnect con3
- --dec $run
- }
-
- --connection con2
- --reap
- --disconnect con2
- --connection con1
- --reap
- --disconnect con1
-
- --dec $trial
-}
-
---enable_query_log
---enable_result_log
---enable_warnings
-
-# Cleanup
---connection default
-DROP TABLE A;
-DROP PROCEDURE p_analyze;
-DROP FUNCTION rnd3;
-SET GLOBAL use_stat_tables = DEFAULT;
-SET GLOBAL net_write_timeout = DEFAULT;
diff --git a/mysql-test/t/mdev13607.test b/mysql-test/t/mdev13607.test
deleted file mode 100644
index 45fdb0a74d4..00000000000
--- a/mysql-test/t/mdev13607.test
+++ /dev/null
@@ -1,60 +0,0 @@
---echo #
---echo # Bug mdev-13607: overflow of current_record_count
---echo #
-
---source include/have_innodb.inc
-
-CREATE TABLE t1 (id INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES
-(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),
-(11),(12),(13),(14),(15),(16),(17),(18),(19),(20),
-(21),(22),(23),(24),(25),(26),(27),(28),(29),(30),
-(31),(32),(33),(34),(35),(36),(37),(38),(39),(40),
-(41),(42),(43),(44),(45),(46),(47),(48),(49),(50);
-
-CREATE TABLE t2 (id INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1),(2);
-
-CREATE TABLE t3 (id INT) ENGINE=InnoDB;
-INSERT INTO t3 VALUES (1),(2);
-
-ANALYZE TABLE t1, t2, t3;
-
-let $q=
-SELECT * FROM
-(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_1
-INNER JOIN
-(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_2
-INNER JOIN
-(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_3
-INNER JOIN
-(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_4
-INNER JOIN
-(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_5
-INNER JOIN
-(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_6
-INNER JOIN
-(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_7
-INNER JOIN
-(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_8
-INNER JOIN
-(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_9
-INNER JOIN
-(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_10
-INNER JOIN
-(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_11
-INNER JOIN
-(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_12
-INNER JOIN
-(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_13
-INNER JOIN
-(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_14
-INNER JOIN
-(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_15
-INNER JOIN
-(SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_16
-;
-
-eval explain $q;
-
-DROP TABLE t1,t2,t3;
diff --git a/mysql-test/t/mdev316.test b/mysql-test/t/mdev316.test
deleted file mode 100644
index 5843b06a60e..00000000000
--- a/mysql-test/t/mdev316.test
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# 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
deleted file mode 100644
index 92e403b6513..00000000000
--- a/mysql-test/t/mdev375.test
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# MDEV-375 Server crashes in THD::print_aborted_warning with log_warnings > 3
-#
---source include/not_embedded.inc
-
-SET GLOBAL log_warnings=4;
-SET GLOBAL max_connections=2;
-
---connect (con1,localhost,root,,)
-SELECT 1;
---connect (con2,localhost,root,,)
-SELECT 2;
---disable_query_log
---error ER_CON_COUNT_ERROR
---connect (con3,localhost,root,,)
---enable_query_log
-
---connection default
-SELECT 0;
-show status like "Threads_connected";
-
-SET GLOBAL log_warnings=default;
-SET GLOBAL max_connections=default;
diff --git a/mysql-test/t/mdev6830.test b/mysql-test/t/mdev6830.test
deleted file mode 100644
index 3898d5bbef6..00000000000
--- a/mysql-test/t/mdev6830.test
+++ /dev/null
@@ -1,63 +0,0 @@
-#
-# MDEV-6830 Server crashes in best_access_path after a sequence of SELECTs invollving a temptable view
-#
---source include/have_debug.inc
-
-set @@debug_dbug= 'd,opt';
-
-CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=MyISAM;
-
-CREATE TABLE t2 (
- f1 DATE,
- f2 VARCHAR(1024),
- f3 VARCHAR(10),
- f4 DATE,
- f5 VARCHAR(10),
- f6 VARCHAR(10),
- f7 VARCHAR(10),
- f8 DATETIME,
- f9 INT,
- f10 VARCHAR(1024),
- f11 VARCHAR(1024),
- f12 INT,
- f13 VARCHAR(1024)
-) ENGINE=MyISAM;
-
-CREATE OR REPLACE VIEW v2 AS SELECT * FROM t2;
-
-CREATE TABLE t3 (
- f1 VARCHAR(1024),
- f2 VARCHAR(1024),
- f3 DATETIME,
- f4 VARCHAR(10),
- f5 INT,
- f6 VARCHAR(10),
- f7 VARCHAR(1024),
- f8 VARCHAR(10),
- f9 INT,
- f10 DATE,
- f11 INT,
- f12 VARCHAR(1024),
- f13 VARCHAR(10),
- f14 DATE,
- f15 DATETIME
-) ENGINE=MyISAM;
-
-CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v3 AS SELECT * FROM t3;
-
-INSERT INTO t3 VALUES
- ('FOO','foo','2000-08-04 00:00:00','one',1,'1','FOO','foo',1,'2004-05-09',1,'one','one','2001-12-07','2001-10-17 08:25:04'),
- ('BAR','bar','2001-01-01 04:52:37','two',2,'2','BAR','bar',2,'2008-01-01',2,'two','two','2006-06-19','2002-01-01 08:22:49');
-
-CREATE TABLE t4 (f1 VARCHAR(10), f2 INT) ENGINE=MyISAM;
-
-SELECT * FROM t1;
-
---error ER_BAD_FIELD_ERROR
-SELECT non_existing FROM v2;
-
-SELECT * FROM t1, v3, t4 WHERE v3.f1 = t4.f1 AND t4.f2 = 6 AND t1.pk = v3.f5;
-
-drop table t1,t2,t3,t4;
-drop view v2,v3;
-
diff --git a/mysql-test/t/mdev_14586.test b/mysql-test/t/mdev_14586.test
deleted file mode 100644
index 8b3d3780151..00000000000
--- a/mysql-test/t/mdev_14586.test
+++ /dev/null
@@ -1,27 +0,0 @@
-create table t1(a bit(1), b int auto_increment ,id int, index(a,b));
-insert into t1 values(1,null,1);
-insert into t1 values(1,null,2);
-insert into t1 values(0,null,3);
-insert into t1 values(0,null,4);
-select a+0, b as auto_increment , id from t1 order by id;
-drop table t1;
-create table t1(a int auto_increment, b bit(5) ,id int, index (b,a));
-insert into t1 values(null,b'1',1);
-insert into t1 values(null,b'1',2);
-insert into t1 values(null,b'11',3);
-insert into t1 values(null,b'11',4);
-select a as auto_increment, b+0, id from t1 order by id;
-drop table t1;
-create table t1(a bit(1), b int auto_increment , c bit(1) , d bit(1), id int,index(a,c,b,d));
-insert into t1 values(1,null,1,1,1);
-insert into t1 values(1,null,1,1,2);
-insert into t1 values(0,null,1,1,3);
-insert into t1 values(1,null,0,1,4);
-select a+0, b as auto_increment, c+0, d+0, id from t1 order by id;
-drop table t1;
-CREATE TABLE t1 (b BIT(1), pk INTEGER AUTO_INCREMENT PRIMARY KEY);
-ALTER TABLE t1 ADD INDEX(b,pk);
-INSERT INTO t1 VALUES (1,b'1');
-ALTER TABLE t1 DROP PRIMARY KEY;
-select b+0, pk as auto_increment from t1;
-DROP TABLE t1;
diff --git a/mysql-test/t/mdl.test b/mysql-test/t/mdl.test
deleted file mode 100644
index b90c74a8f7f..00000000000
--- a/mysql-test/t/mdl.test
+++ /dev/null
@@ -1,19 +0,0 @@
---source include/have_metadata_lock_info.inc
---source include/have_innodb.inc
-
---echo #
---echo # MDEV-12882 - Assertion `mdl_ticket->m_type == MDL_SHARED_UPGRADABLE ||
---echo # mdl_ticket->m_type == MDL_SHARED_NO_WRITE ||
---echo # mdl_ticket->m_type == MDL_SHARED_NO_READ_WRITE ||
---echo # mdl_ticket->m_type == MDL_SHARED_READ'
---echo # failed in MDL_context::upgrade_shared_lock
---echo #
-
-CREATE TABLE t1(a INT) ENGINE=InnoDB;
-LOCK TABLES t1 WRITE CONCURRENT, t1 AS t2 READ;
-SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
-UNLOCK TABLES;
-LOCK TABLES t1 AS t2 READ, t1 WRITE CONCURRENT;
-SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
-UNLOCK TABLES;
-DROP TABLE t1;
diff --git a/mysql-test/t/mdl_sync-master.opt b/mysql-test/t/mdl_sync-master.opt
deleted file mode 100644
index 96f0ce3f36c..00000000000
--- a/mysql-test/t/mdl_sync-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---default-storage-engine=MyISAM
diff --git a/mysql-test/t/mdl_sync.test b/mysql-test/t/mdl_sync.test
deleted file mode 100644
index fbecd6bf547..00000000000
--- a/mysql-test/t/mdl_sync.test
+++ /dev/null
@@ -1,4104 +0,0 @@
-#
-# We need the Debug Sync Facility.
-#
---source include/have_debug_sync.inc
-
-# We need InnoDB tables for some of the tests.
---source include/have_innodb.inc
-
-# Save the initial number of concurrent sessions.
---source include/count_sessions.inc
-
-
-# Clean up resources used in this test case.
---disable_warnings
-SET DEBUG_SYNC= 'RESET';
---enable_warnings
-
-#
-# Test the case of when a exclusive lock request waits for a
-# shared lock being upgraded to a exclusive lock.
-#
-
-connect (con1,localhost,root,,test,,);
-connect (con2,localhost,root,,test,,);
-connect (con3,localhost,root,,test,,);
-
-connection default;
-
---disable_warnings
-drop table if exists t1,t2,t3;
---enable_warnings
-
-create table t1 (i int);
-create table t2 (i int);
-
---echo connection: default
-lock tables t2 read;
-
-connection con1;
---echo connection: con1
-set debug_sync='mdl_upgrade_lock SIGNAL parked WAIT_FOR go';
---send alter table t1 rename t3
-
-connection default;
---echo connection: default
-set debug_sync= 'now WAIT_FOR parked';
-
-connection con2;
---echo connection: con2
-set debug_sync='mdl_acquire_lock_wait SIGNAL go';
---send drop table t1,t2
-
-connection con1;
---echo connection: con1
---reap
-
-connection default;
---echo connection: default
-unlock tables;
-
-connection con2;
---echo connection: con2
---error ER_BAD_TABLE_ERROR
---reap
-
-connection default;
-drop table t3;
-
-disconnect con1;
-disconnect con2;
-disconnect con3;
-
-# Clean up resources used in this test case.
---disable_warnings
-SET DEBUG_SYNC= 'RESET';
---enable_warnings
-
-
---echo #
---echo # Basic test coverage for type-of-operation aware metadata locks.
---echo #
---disable_warnings
-drop table if exists t1, t2, t3;
---enable_warnings
-connect(mdl_con1,localhost,root,,);
-connect(mdl_con2,localhost,root,,);
-connect(mdl_con3,localhost,root,,);
-connection default;
-set debug_sync= 'RESET';
-create table t1 (c1 int);
-
---echo #
---echo # A) First let us check compatibility rules between differend kinds of
---echo # type-of-operation aware metadata locks.
---echo # Of course, these rules are already covered by the tests scattered
---echo # across the test suite. But it still makes sense to have one place
---echo # which covers all of them.
---echo #
-
---echo # 1) Acquire S (simple shared) lock on the table (by using HANDLER):
---echo #
-handler t1 open;
---echo #
-connection mdl_con1;
---echo # Check that S, SH, SR and SW locks are compatible with it.
-handler t1 open t;
-handler t close;
-select column_name from information_schema.columns where
- table_schema='test' and table_name='t1';
-select count(*) from t1;
-insert into t1 values (1), (1);
---echo # Check that SU lock is compatible with it. To do this use ALTER TABLE
---echo # which will fail when constructing .frm and thus obtaining SU metadata
---echo # lock.
---error ER_KEY_COLUMN_DOES_NOT_EXITS
-alter table t1 add index (not_exist);
---echo # Check that SNW lock is compatible with it. To do this use ALTER TABLE
---echo # which will fail during copying the table and thus obtaining SNW metadata
---echo # lock.
---error ER_DUP_ENTRY
-alter table t1 add primary key (c1);
---echo # Check that X lock is incompatible with S lock.
---echo # Sending:
---send rename table t1 to t2;
---echo #
-connection mdl_con2;
---echo # Check that the above RENAME is blocked because of S lock.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "rename table t1 to t2";
---source include/wait_condition.inc
---echo #
-connection default;
---echo # Unblock RENAME TABLE.
-handler t1 close;
---echo #
-connection mdl_con1;
---echo # Reaping RENAME TABLE.
---reap
---echo # Restore the original state of the things.
-rename table t2 to t1;
---echo #
-connection default;
-handler t1 open;
---echo #
-connection mdl_con1;
---echo # Check that upgrade from SNW to X is blocked by presence of S lock.
---echo # Sending:
---send alter table t1 add column c2 int;
---echo #
-connection mdl_con2;
---echo # Check that the above ALTER TABLE is blocked because of S lock.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "alter table t1 add column c2 int";
---source include/wait_condition.inc
---echo #
-connection default;
---echo # Unblock ALTER TABLE.
-handler t1 close;
---echo #
-connection mdl_con1;
---echo # Reaping ALTER TABLE.
---reap
---echo # Restore the original state of the things.
-alter table t1 drop column c2;
---echo #
-connection default;
---echo #
---echo # 2) Acquire SH (shared high-priority) lock on the table.
---echo # We have to involve DEBUG_SYNC facility for this as usually
---echo # such kind of locks are short-lived.
---echo #
-set debug_sync= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR finish';
---echo # Sending:
---send select table_name, table_type, auto_increment, table_comment from information_schema.tables where table_schema='test' and table_name='t1';
---echo #
-connection mdl_con1;
-set debug_sync= 'now WAIT_FOR locked';
---echo # Check that S, SH, SR and SW locks are compatible with it.
-handler t1 open;
-handler t1 close;
-select column_name from information_schema.columns where
- table_schema='test' and table_name='t1';
-select count(*) from t1;
-insert into t1 values (1);
---echo # Check that SU lock is compatible with it. To do this use ALTER TABLE
---echo # which will fail when constructing .frm and thus obtaining SU metadata
---echo # lock.
---error ER_KEY_COLUMN_DOES_NOT_EXITS
-alter table t1 add index (not_exist);
---echo # Check that SNW lock is compatible with it. To do this use ALTER TABLE
---echo # which will fail during copying the table and thus obtaining SNW metadata
---echo # lock.
---error ER_DUP_ENTRY
-alter table t1 add primary key (c1);
---echo # Check that SNRW lock is compatible with SH lock.
-lock table t1 write;
-delete from t1 limit 1;
-unlock tables;
---echo # Check that X lock is incompatible with SH lock.
---echo # Sending:
---send rename table t1 to t2;
---echo #
-connection mdl_con2;
---echo # Check that the above RENAME is blocked because of SH lock.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "rename table t1 to t2";
---source include/wait_condition.inc
---echo # Unblock RENAME TABLE.
-set debug_sync= 'now SIGNAL finish';
---echo #
-connection default;
---echo # Reaping SELECT ... FROM I_S.
---reap
---echo #
-connection mdl_con1;
---echo # Reaping RENAME TABLE.
---reap
---echo # Restore the original state of the things.
-rename table t2 to t1;
---echo #
-connection default;
-set debug_sync= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR finish';
---echo # Sending:
---send select table_name, table_type, auto_increment, table_comment from information_schema.tables where table_schema='test' and table_name='t1';
---echo #
-connection mdl_con1;
-set debug_sync= 'now WAIT_FOR locked';
---echo # Check that upgrade from SNW to X is blocked by presence of SH lock.
---echo # Sending:
---send alter table t1 add column c2 int;
---echo #
-connection mdl_con2;
---echo # Check that the above ALTER TABLE is blocked because of SH lock.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "alter table t1 add column c2 int";
---source include/wait_condition.inc
---echo # Unblock RENAME TABLE.
-set debug_sync= 'now SIGNAL finish';
---echo #
-connection default;
---echo # Reaping SELECT ... FROM I_S.
---reap
---echo #
-connection mdl_con1;
---echo # Reaping ALTER TABLE.
---reap
---echo # Restore the original state of the things.
-alter table t1 drop column c2;
---echo #
-connection default;
-set debug_sync= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR finish';
---send select table_name, table_type, auto_increment, table_comment from information_schema.tables where table_schema='test' and table_name='t1';
---echo #
-connection mdl_con1;
-set debug_sync= 'now WAIT_FOR locked';
---echo # Check that upgrade from SNRW to X is blocked by presence of S lock.
-lock table t1 write;
---echo # Sending:
---send alter table t1 add column c2 int;
---echo #
-connection mdl_con2;
---echo # Check that the above upgrade of SNRW to X in ALTER TABLE is blocked
---echo # because of S lock.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "alter table t1 add column c2 int";
---source include/wait_condition.inc
---echo # Unblock RENAME TABLE.
-set debug_sync= 'now SIGNAL finish';
---echo #
-connection default;
---echo # Reaping SELECT ... FROM I_S.
---reap
---echo #
-connection mdl_con1;
---echo # Reaping ALTER TABLE.
---reap
---echo # Restore the original state of the things.
-alter table t1 drop column c2;
-unlock tables;
---echo #
-connection default;
---echo #
---echo #
---echo # 3) Acquire SR lock on the table.
---echo #
---echo #
-begin;
-select count(*) from t1;
---echo #
-connection mdl_con1;
---echo # Check that S, SH, SR and SW locks are compatible with it.
-handler t1 open;
-handler t1 close;
-select column_name from information_schema.columns where
- table_schema='test' and table_name='t1';
-select count(*) from t1;
-insert into t1 values (1);
---echo # Check that SU lock is compatible with it. To do this use ALTER TABLE
---echo # which will fail when constructing .frm and thus obtaining SU metadata
---echo # lock.
---error ER_KEY_COLUMN_DOES_NOT_EXITS
-alter table t1 add index (not_exist);
---echo # Check that SNW lock is compatible with it. To do this use ALTER TABLE
---echo # which will fail during copying the table and thus obtaining SNW metadata
---echo # lock.
---error ER_DUP_ENTRY
-alter table t1 add primary key (c1);
---echo # Check that SNRW lock is not compatible with SR lock.
---echo # Sending:
---send lock table t1 write;
---echo #
-connection default;
---echo # Check that the above LOCK TABLES is blocked because of SR lock.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "lock table t1 write";
---source include/wait_condition.inc
---echo # Unblock LOCK TABLES.
-commit;
---echo #
-connection mdl_con1;
---echo # Reaping LOCK TABLES.
---reap
-delete from t1 limit 1;
-unlock tables;
---echo #
-connection default;
-begin;
-select count(*) from t1;
---echo #
-connection mdl_con1;
---echo # Check that X lock is incompatible with SR lock.
---echo # Sending:
---send rename table t1 to t2;
---echo #
-connection mdl_con2;
---echo # Check that the above RENAME is blocked because of SR lock.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "rename table t1 to t2";
---source include/wait_condition.inc
---echo #
-connection default;
---echo # Unblock RENAME TABLE.
-commit;
---echo #
-connection mdl_con1;
---echo # Reaping RENAME TABLE.
---reap
---echo # Restore the original state of the things.
-rename table t2 to t1;
---echo #
-connection default;
-begin;
-select count(*) from t1;
---echo #
-connection mdl_con1;
---echo # Check that upgrade from SNW to X is blocked by presence of SR lock.
---echo # Sending:
---send alter table t1 add column c2 int;
---echo #
-connection mdl_con2;
---echo # Check that the above ALTER TABLE is blocked because of SR lock.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "alter table t1 add column c2 int";
---source include/wait_condition.inc
---echo #
-connection default;
---echo # Unblock ALTER TABLE.
-commit;
---echo #
-connection mdl_con1;
---echo # Reaping ALTER TABLE.
---reap
---echo # Restore the original state of the things.
-alter table t1 drop column c2;
---echo #
---echo # There is no need to check that upgrade from SNRW to X is blocked
---echo # by presence of SR lock because SNRW is incompatible with SR anyway.
---echo #
---echo #
-connection default;
---echo #
---echo #
---echo # 4) Acquire SW lock on the table.
---echo #
---echo #
-begin;
-insert into t1 values (1);
---echo #
-connection mdl_con1;
---echo # Check that S, SH, SR and SW locks are compatible with it.
-handler t1 open;
-handler t1 close;
-select column_name from information_schema.columns where
- table_schema='test' and table_name='t1';
---echo # Disable result log to make test robust against
---echo # effects of concurrent insert.
---disable_result_log
-select * from t1;
---enable_result_log
-insert into t1 values (1);
---echo # Check that SU lock is compatible with it. To do this use ALTER TABLE
---echo # which will fail when constructing .frm and thus obtaining SU metadata
---echo # lock.
---error ER_KEY_COLUMN_DOES_NOT_EXITS
-alter table t1 add index (not_exist);
---echo # Check that SNW lock is not compatible with SW lock.
---echo # Again we use ALTER TABLE which fails during copying
---echo # the table to avoid upgrade of SNW -> X.
---echo # Sending:
---send alter table t1 add primary key (c1);
---echo #
-connection default;
---echo # Check that the above ALTER TABLE is blocked because of SW lock.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "alter table t1 add primary key (c1)";
---source include/wait_condition.inc
---echo # Unblock ALTER TABLE.
-commit;
---echo #
-connection mdl_con1;
---echo # Reaping ALTER TABLE.
---error ER_DUP_ENTRY
---reap
---echo #
-connection default;
-begin;
-insert into t1 values (1);
---echo #
-connection mdl_con1;
---echo # Check that SNRW lock is not compatible with SW lock.
---echo # Sending:
---send lock table t1 write;
---echo #
-connection default;
---echo # Check that the above LOCK TABLES is blocked because of SW lock.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "lock table t1 write";
---source include/wait_condition.inc
---echo # Unblock LOCK TABLES.
-commit;
---echo #
-connection mdl_con1;
---echo # Reaping LOCK TABLES.
---reap
-delete from t1 limit 2;
-unlock tables;
---echo #
-connection default;
-begin;
-insert into t1 values (1);
---echo #
-connection mdl_con1;
---echo # Check that X lock is incompatible with SW lock.
---echo # Sending:
---send rename table t1 to t2;
---echo #
-connection mdl_con2;
---echo # Check that the above RENAME is blocked because of SW lock.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "rename table t1 to t2";
---source include/wait_condition.inc
---echo #
-connection default;
---echo # Unblock RENAME TABLE.
-commit;
---echo #
-connection mdl_con1;
---echo # Reaping RENAME TABLE.
---reap
---echo # Restore the original state of the things.
-rename table t2 to t1;
---echo #
---echo # There is no need to check that upgrade from SNW/SNRW to X is
---echo # blocked by presence of SW lock because SNW/SNRW is incompatible
---echo # with SW anyway.
---echo #
---echo #
-connection default;
---echo #
---echo #
---echo # 5) Acquire SU lock on the table. We have to use DEBUG_SYNC for
---echo # this, to prevent SU from being immediately upgraded to X.
---echo #
-set debug_sync= 'alter_opened_table SIGNAL locked WAIT_FOR finish';
---echo # Sending:
---send alter table t1 add primary key (c1);
---echo #
-connection mdl_con1;
-set debug_sync= 'now WAIT_FOR locked';
---echo # Check that S, SH, SR and SW locks are compatible with it.
-handler t1 open;
-handler t1 close;
-select column_name from information_schema.columns where
- table_schema='test' and table_name='t1';
-select count(*) from t1;
-delete from t1 limit 1;
---echo # Check that SU lock is incompatible with SU lock.
---echo # Sending:
---send alter table t1 add primary key (c1);
---echo #
-connection mdl_con2;
---echo # Check that the above ALTER is blocked because of SU lock.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "alter table t1 add primary key (c1)";
---source include/wait_condition.inc
---echo # Unblock ALTERs.
-set debug_sync= 'now SIGNAL finish';
---echo #
-connection default;
---echo # Reaping first ALTER TABLE.
---error ER_DUP_ENTRY
---reap
---echo #
-connection mdl_con1;
---echo # Reaping another ALTER TABLE.
---error ER_DUP_ENTRY
---reap
---echo #
-connection default;
-set debug_sync= 'alter_opened_table SIGNAL locked WAIT_FOR finish';
---echo # Sending:
---send alter table t1 add primary key (c1);
---echo #
-connection mdl_con1;
-set debug_sync= 'now WAIT_FOR locked';
---echo # Check that SNRW lock is incompatible with SU lock.
---echo # Sending:
---send lock table t1 write;
---echo #
-connection mdl_con2;
---echo # Check that the above LOCK TABLES is blocked because of SU lock.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "lock table t1 write";
---source include/wait_condition.inc
---echo # Unblock ALTER and thus LOCK TABLES.
-set debug_sync= 'now SIGNAL finish';
---echo #
-connection default;
---echo # Reaping ALTER TABLE.
---error ER_DUP_ENTRY
---reap
---echo #
-connection mdl_con1;
---echo # Reaping LOCK TABLES
---reap
-insert into t1 values (1);
-unlock tables;
---echo #
-connection default;
-set debug_sync= 'alter_opened_table SIGNAL locked WAIT_FOR finish';
---echo # Sending:
---send alter table t1 add primary key (c1);
---echo #
-connection mdl_con1;
-set debug_sync= 'now WAIT_FOR locked';
---echo # Check that X lock is incompatible with SU lock.
---echo # Sending:
---send rename table t1 to t2;
---echo #
-connection mdl_con2;
---echo # Check that the above RENAME is blocked because of SU lock.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "rename table t1 to t2";
---source include/wait_condition.inc
---echo # Unblock ALTER and thus RENAME TABLE.
-set debug_sync= 'now SIGNAL finish';
---echo #
-connection default;
---echo # Now we have ALTER TABLE with SU->SNW and RENAME TABLE with pending
---echo # X-lock. In this case ALTER TABLE should be chosen as victim.
---echo # Reaping ALTER TABLE.
---error ER_LOCK_DEADLOCK
---reap
---echo #
-connection mdl_con1;
---echo # Reaping RENAME TABLE
---reap
---echo # Revert back to original state of things.
-rename table t2 to t1;
---echo #
---echo # There is no need to check that upgrade from SNW/SNRW to X is
---echo # blocked by presence of another SU lock because SNW/SNRW is
---echo # incompatible with SU anyway.
---echo #
-connection default;
---echo #
---echo #
---echo # 6) Acquire SNW lock on the table. We have to use DEBUG_SYNC for
---echo # this, to prevent SNW from being immediately upgraded to X.
---echo #
-set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL locked WAIT_FOR finish';
---echo # Sending:
---send alter table t1 add primary key (c1), lock=shared, algorithm=copy;
---echo #
-connection mdl_con1;
-set debug_sync= 'now WAIT_FOR locked';
---echo # Check that S, SH and SR locks are compatible with it.
-handler t1 open;
-handler t1 close;
-select column_name from information_schema.columns where
- table_schema='test' and table_name='t1';
-select count(*) from t1;
---echo # Check that SW lock is incompatible with SNW lock.
---echo # Sending:
---send delete from t1 limit 2;
---echo #
-connection mdl_con2;
---echo # Check that the above DELETE is blocked because of SNW lock.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "delete from t1 limit 2";
---source include/wait_condition.inc
---echo # Unblock ALTER and thus DELETE.
-set debug_sync= 'now SIGNAL finish';
---echo #
-connection default;
---echo # Reaping ALTER TABLE.
---error ER_DUP_ENTRY
---reap
---echo #
-connection mdl_con1;
---echo # Reaping DELETE.
---reap
---echo #
-connection default;
-set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL locked WAIT_FOR finish';
---echo # Sending:
---send alter table t1 add primary key (c1), lock=shared, algorithm=copy;
---echo #
-connection mdl_con1;
-set debug_sync= 'now WAIT_FOR locked';
---echo # Check that SU lock is incompatible with SNW lock.
---echo # Sending:
---send alter table t1 add primary key (c1);
---echo #
-connection mdl_con2;
---echo # Check that the above ALTER is blocked because of SNW lock.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "alter table t1 add primary key (c1)";
---source include/wait_condition.inc
---echo # Unblock ALTERs.
-set debug_sync= 'now SIGNAL finish';
---echo #
-connection default;
---echo # Reaping first ALTER TABLE.
---error ER_DUP_ENTRY
---reap
---echo #
-connection mdl_con1;
---echo # Reaping another ALTER TABLE.
---error ER_DUP_ENTRY
---reap
---echo #
---echo # Note that we can't easily check SNW vs SNW locks since
---echo # SNW is only used by ALTER TABLE after upgrading from SU
---echo # and SU is also incompatible with SNW.
---echo #
-connection default;
-set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL locked WAIT_FOR finish';
---echo # Sending:
---send alter table t1 add primary key (c1), lock=shared, algorithm=copy;
---echo #
-connection mdl_con1;
-set debug_sync= 'now WAIT_FOR locked';
---echo # Check that SNRW lock is incompatible with SNW lock.
---echo # Sending:
---send lock table t1 write;
---echo #
-connection mdl_con2;
---echo # Check that the above LOCK TABLES is blocked because of SNW lock.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "lock table t1 write";
---source include/wait_condition.inc
---echo # Unblock ALTER and thus LOCK TABLES.
-set debug_sync= 'now SIGNAL finish';
---echo #
-connection default;
---echo # Reaping ALTER TABLE.
---error ER_DUP_ENTRY
---reap
---echo #
-connection mdl_con1;
---echo # Reaping LOCK TABLES
---reap
-insert into t1 values (1);
-unlock tables;
---echo #
-connection default;
-set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL locked WAIT_FOR finish';
---echo # Sending:
---send alter table t1 add primary key (c1), algorithm=copy, lock=shared;
---echo #
-connection mdl_con1;
-set debug_sync= 'now WAIT_FOR locked';
---echo # Check that X lock is incompatible with SNW lock.
---echo # Sending:
---send rename table t1 to t2;
---echo #
-connection mdl_con2;
---echo # Check that the above RENAME is blocked because of SNW lock.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "rename table t1 to t2";
---source include/wait_condition.inc
---echo # Unblock ALTER and thus RENAME TABLE.
-set debug_sync= 'now SIGNAL finish';
---echo #
-connection default;
---echo # Reaping ALTER TABLE.
---error ER_DUP_ENTRY
---reap
---echo #
-connection mdl_con1;
---echo # Reaping RENAME TABLE
---reap
---echo # Revert back to original state of things.
-rename table t2 to t1;
---echo #
---echo # There is no need to check that upgrade from SNW/SNRW to X is
---echo # blocked by presence of another SNW lock because SNW/SNRW is
---echo # incompatible with SNW anyway.
---echo #
-connection default;
---echo #
---echo #
---echo # 7) Acquire SNRW lock on the table.
---echo #
---echo #
-lock table t1 write;
---echo #
-connection mdl_con1;
---echo # Check that S and SH locks are compatible with it.
-select column_name from information_schema.columns where
- table_schema='test' and table_name='t1';
---echo # Check that SR lock is incompatible with SNRW lock.
---echo # Sending:
---send select count(*) from t1;
---echo #
-connection default;
---echo # Check that the above SELECT is blocked because of SNRW lock.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "select count(*) from t1";
---source include/wait_condition.inc
---echo # Unblock SELECT.
-unlock tables;
---echo #
-connection mdl_con1;
---echo # Reaping SELECT.
---reap
---echo #
-connection default;
-lock table t1 write;
---echo #
-connection mdl_con1;
---echo # Check that SW lock is incompatible with SNRW lock.
---echo # Sending:
---send delete from t1 limit 1;
---echo #
-connection default;
---echo # Check that the above DELETE is blocked because of SNRW lock.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "delete from t1 limit 1";
---source include/wait_condition.inc
---echo # Unblock DELETE.
-unlock tables;
---echo #
-connection mdl_con1;
---echo # Reaping DELETE.
---reap
---echo #
-connection default;
-lock table t1 write;
---echo #
-connection mdl_con1;
---echo # Check that SU lock is incompatible with SNRW lock.
---echo # Sending:
---send alter table t1 add primary key (c1);
---echo #
-connection default;
---echo # Check that the above ALTER is blocked because of SNRW lock.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "alter table t1 add primary key (c1)";
---source include/wait_condition.inc
---echo # Unblock ALTER.
-unlock tables;
---echo #
-connection mdl_con1;
---echo # Reaping ALTER TABLE.
---error ER_DUP_ENTRY
---reap
---echo #
---echo # Note that we can't easily check SNW vs SNRW locks since
---echo # SNW is only used by ALTER TABLE after upgrading from SU
---echo # and SU is also incompatible with SNRW.
---echo #
-connection default;
-lock table t1 write;
---echo #
-connection mdl_con1;
---echo # Check that SNRW lock is incompatible with SNRW lock.
---echo # Sending:
---send lock table t1 write;
---echo #
-connection default;
---echo # Check that the above LOCK TABLES is blocked because of SNRW lock.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "lock table t1 write";
---source include/wait_condition.inc
---echo # Unblock waiting LOCK TABLES.
-unlock tables;
---echo #
-connection mdl_con1;
---echo # Reaping LOCK TABLES
---reap
-insert into t1 values (1);
-unlock tables;
---echo #
-connection default;
-lock table t1 write;
---echo #
-connection mdl_con1;
---echo # Check that X lock is incompatible with SNRW lock.
---echo # Sending:
---send rename table t1 to t2;
---echo #
-connection default;
---echo # Check that the above RENAME is blocked because of SNRW lock.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "rename table t1 to t2";
---source include/wait_condition.inc
---echo # Unblock RENAME TABLE
-unlock tables;
---echo #
-connection mdl_con1;
---echo # Reaping RENAME TABLE
---reap
---echo # Revert back to original state of things.
-rename table t2 to t1;
---echo #
---echo # There is no need to check that upgrade from SNW/SNRW to X is
---echo # blocked by presence of another SNRW lock because SNW/SNRW is
---echo # incompatible with SNRW anyway.
---echo #
-connection default;
---echo #
---echo #
---echo # 8) Now do the same round of tests for X lock. We use additional
---echo # table to get long-lived lock of this type.
---echo #
-create table t2 (c1 int);
---echo #
-connection mdl_con2;
---echo # Take a lock on t2, so RENAME TABLE t1 TO t2 will get blocked
---echo # after acquiring X lock on t1.
-lock tables t2 read;
---echo #
-connection default;
---echo # Sending:
---send rename table t1 to t2;
---echo #
-connection mdl_con1;
---echo # Check that RENAME has acquired X lock on t1 and is waiting for t2.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "rename table t1 to t2";
---source include/wait_condition.inc
---echo # Check that S lock in incompatible with X lock.
---echo # Sending:
---send handler t1 open;
---echo #
-connection mdl_con2;
---echo # Check that the above HANDLER statement is blocked because of X lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "handler t1 open";
---source include/wait_condition.inc
---echo # Unblock RENAME TABLE
-unlock tables;
---echo #
-connection default;
---echo # Reaping RENAME TABLE.
---error ER_TABLE_EXISTS_ERROR
---reap
---echo #
-connection mdl_con1;
---echo # Reaping HANDLER.
---reap
-handler t1 close;
---echo #
-connection mdl_con2;
---echo # Prepare for blocking RENAME TABLE.
-lock tables t2 read;
---echo #
-connection default;
---echo # Sending:
---send rename table t1 to t2;
---echo #
-connection mdl_con1;
---echo # Check that RENAME has acquired X lock on t1 and is waiting for t2.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "rename table t1 to t2";
---source include/wait_condition.inc
---echo # Check that SH lock in incompatible with X lock.
---echo # Sending:
---send select column_name from information_schema.columns where table_schema='test' and table_name='t1';
---echo #
-connection mdl_con2;
---echo # Check that the above SELECT ... FROM I_S ... statement is blocked
---echo # because of X lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info like "select column_name from information_schema.columns%";
---source include/wait_condition.inc
---echo # Unblock RENAME TABLE
-unlock tables;
---echo #
-connection default;
---echo # Reaping RENAME TABLE.
---error ER_TABLE_EXISTS_ERROR
---reap
---echo #
-connection mdl_con1;
---echo # Reaping SELECT ... FROM I_S.
---reap
---echo #
-connection mdl_con2;
---echo # Prepare for blocking RENAME TABLE.
-lock tables t2 read;
---echo #
-connection default;
---echo # Sending:
---send rename table t1 to t2;
---echo #
-connection mdl_con1;
---echo # Check that RENAME has acquired X lock on t1 and is waiting for t2.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "rename table t1 to t2";
---source include/wait_condition.inc
---echo # Check that SR lock in incompatible with X lock.
---echo # Sending:
---send select count(*) from t1;
---echo #
-connection mdl_con2;
---echo # Check that the above SELECT statement is blocked
---echo # because of X lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "select count(*) from t1";
---source include/wait_condition.inc
---echo # Unblock RENAME TABLE
-unlock tables;
---echo #
-connection default;
---echo # Reaping RENAME TABLE.
---error ER_TABLE_EXISTS_ERROR
---reap
---echo #
-connection mdl_con1;
---echo # Reaping SELECT.
---reap
---echo #
-connection mdl_con2;
---echo # Prepare for blocking RENAME TABLE.
-lock tables t2 read;
---echo #
-connection default;
---echo # Sending:
---send rename table t1 to t2;
---echo #
-connection mdl_con1;
---echo # Check that RENAME has acquired X lock on t1 and is waiting for t2.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "rename table t1 to t2";
---source include/wait_condition.inc
---echo # Check that SW lock in incompatible with X lock.
---echo # Sending:
---send delete from t1 limit 1;
---echo #
-connection mdl_con2;
---echo # Check that the above DELETE statement is blocked
---echo # because of X lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "delete from t1 limit 1";
---source include/wait_condition.inc
---echo # Unblock RENAME TABLE
-unlock tables;
---echo #
-connection default;
---echo # Reaping RENAME TABLE.
---error ER_TABLE_EXISTS_ERROR
---reap
---echo #
-connection mdl_con1;
---echo # Reaping DELETE.
---reap
---echo #
-connection mdl_con2;
---echo # Prepare for blocking RENAME TABLE.
-lock tables t2 read;
---echo #
-connection default;
---echo # Sending:
---send rename table t1 to t2;
---echo #
-connection mdl_con1;
---echo # Check that RENAME has acquired X lock on t1 and is waiting for t2.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "rename table t1 to t2";
---source include/wait_condition.inc
---echo # Check that SU lock is incompatible with X lock.
---echo # Sending:
---send alter table t1 add primary key (c1);
---echo #
-connection mdl_con2;
---echo # Check that the above ALTER statement is blocked
---echo # because of X lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "alter table t1 add primary key (c1)";
---source include/wait_condition.inc
---echo # Unblock RENAME TABLE
-unlock tables;
---echo #
-connection default;
---echo # Reaping RENAME TABLE
---error ER_TABLE_EXISTS_ERROR
---reap
---echo #
-connection mdl_con1;
---echo # Reaping ALTER.
---error ER_DUP_ENTRY
---reap
---echo #
---echo # Note that we can't easily check SNW vs X locks since
---echo # SNW is only used by ALTER TABLE after upgrading from SU
---echo # and SU is also incompatible with X.
---echo #
-connection mdl_con2;
---echo # Prepare for blocking RENAME TABLE.
-lock tables t2 read;
---echo #
-connection default;
---echo # Sending:
---send rename table t1 to t2;
---echo #
-connection mdl_con1;
---echo # Check that RENAME has acquired X lock on t1 and is waiting for t2.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "rename table t1 to t2";
---source include/wait_condition.inc
---echo # Check that SNRW lock is incompatible with X lock.
---echo # Sending:
---send lock table t1 write;
---echo #
-connection mdl_con2;
---echo # Check that the above LOCK TABLE statement is blocked
---echo # because of X lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "lock table t1 write";
---source include/wait_condition.inc
---echo # Unblock RENAME TABLE
-unlock tables;
---echo #
-connection default;
---echo # Reaping RENAME TABLE
---error ER_TABLE_EXISTS_ERROR
---reap
---echo #
-connection mdl_con1;
---echo # Reaping LOCK TABLE.
---reap
-unlock tables;
---echo #
-connection mdl_con2;
---echo # Prepare for blocking RENAME TABLE.
-lock tables t2 read;
---echo #
-connection default;
---echo # Sending:
---send rename table t1 to t2;
---echo #
-connection mdl_con1;
---echo # Check that RENAME has acquired X lock on t1 and is waiting for t2.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "rename table t1 to t2";
---source include/wait_condition.inc
---echo # Check that X lock is incompatible with X lock.
---echo # Sending:
---send rename table t1 to t3;
---echo #
-connection mdl_con2;
---echo # Check that the above RENAME statement is blocked
---echo # because of X lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "rename table t1 to t3";
---source include/wait_condition.inc
---echo # Unblock RENAME TABLE
-unlock tables;
---echo #
-connection default;
---echo # Reaping RENAME TABLE
---error ER_TABLE_EXISTS_ERROR
---reap
---echo #
-connection mdl_con1;
---echo # Reaping RENAME.
---reap
-rename table t3 to t1;
-
---echo #
---echo # B) Now let us test compatibility in cases when both locks
---echo # are pending. I.e. let us test rules for priorities between
---echo # different types of metadata locks.
---echo #
---echo # Note: No tests for pending SU lock as this lock requires
---echo # even stronger active or pending lock.
---echo #
-
---echo #
-connection mdl_con2;
---echo #
---echo # 1) Check compatibility for pending SNW lock.
---echo #
---echo # Acquire SW lock in order to create pending SNW lock later.
-begin;
-insert into t1 values (1);
---echo #
-connection default;
---echo # Add pending SNW lock.
---echo # Sending:
---send alter table t1 add primary key (c1);
---echo #
-connection mdl_con1;
---echo # Check that ALTER TABLE is waiting with pending SNW lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "alter table t1 add primary key (c1)";
---source include/wait_condition.inc
---echo # Check that S, SH and SR locks are compatible with pending SNW
-handler t1 open t;
-handler t close;
-select column_name from information_schema.columns where
- table_schema='test' and table_name='t1';
-select count(*) from t1;
---echo # Check that SW is incompatible with pending SNW
---echo # Sending:
---send delete from t1 limit 1;
---echo #
-connection mdl_con2;
---echo # Check that the above DELETE is blocked because of pending SNW lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "delete from t1 limit 1";
---source include/wait_condition.inc
---echo # Unblock ALTER TABLE.
-commit;
---echo #
-connection default;
---echo # Reaping ALTER.
---error ER_DUP_ENTRY
---reap
---echo #
-connection mdl_con1;
---echo # Reaping DELETE.
---reap
---echo #
---echo # We can't do similar check for SNW, SNRW and X locks because
---echo # they will also be blocked by active SW lock.
---echo #
---echo #
-connection mdl_con2;
---echo #
---echo # 2) Check compatibility for pending SNRW lock.
---echo #
---echo # Acquire SR lock in order to create pending SNRW lock.
-begin;
-select count(*) from t1;
---echo #
-connection default;
---echo # Add pending SNRW lock.
---echo # Sending:
---send lock table t1 write;
---echo #
-connection mdl_con1;
---echo # Check that LOCK TABLE is waiting with pending SNRW lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "lock table t1 write";
---source include/wait_condition.inc
---echo # Check that S and SH locks are compatible with pending SNRW
-select column_name from information_schema.columns where
- table_schema='test' and table_name='t1';
---echo # Check that SR is incompatible with pending SNRW
---echo # Sending:
---send select count(*) from t1;
---echo #
-connection mdl_con2;
---echo # Check that the above SELECT is blocked because of pending SNRW lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "select count(*) from t1";
---source include/wait_condition.inc
---echo # Unblock LOCK TABLE.
-commit;
---echo #
-connection default;
---echo # Reaping LOCK TABLE.
---reap
-unlock tables;
---echo #
-connection mdl_con1;
---echo # Reaping SELECT.
---reap
---echo # Restore pending SNRW lock.
---echo #
-connection mdl_con2;
-begin;
-select count(*) from t1;
---echo #
-connection default;
---echo # Sending:
---send lock table t1 write;
---echo #
-connection mdl_con1;
---echo # Check that LOCK TABLE is waiting with pending SNRW lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "lock table t1 write";
---source include/wait_condition.inc
---echo # Check that SW is incompatible with pending SNRW
---echo # Sending:
---send insert into t1 values (1);
---echo #
-connection mdl_con2;
---echo # Check that the above INSERT is blocked because of pending SNRW lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "insert into t1 values (1)";
---source include/wait_condition.inc
---echo # Unblock LOCK TABLE.
-commit;
---echo #
-connection default;
---echo # Reaping LOCK TABLE.
---reap
-unlock tables;
---echo #
-connection mdl_con1;
---echo # Reaping INSERT.
---reap
---echo # Restore pending SNRW lock.
---echo #
-connection mdl_con2;
-begin;
-select count(*) from t1;
---echo #
-connection default;
---echo # Sending:
---send lock table t1 write;
---echo #
-connection mdl_con1;
---echo # Check that LOCK TABLE is waiting with pending SNRW lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "lock table t1 write";
---source include/wait_condition.inc
---echo # Check that SNW is compatible with pending SNRW
---echo # So ALTER TABLE statements are not starved by LOCK TABLEs.
---error ER_DUP_ENTRY
-alter table t1 add primary key (c1);
---echo #
-connection mdl_con2;
---echo # Unblock LOCK TABLE.
-commit;
---echo #
-connection default;
---echo # Reaping LOCK TABLE.
---reap
-unlock tables;
---echo #
---echo # We can't do similar check for SNRW and X locks because
---echo # they will also be blocked by active SR lock.
---echo #
---echo #
-connection mdl_con2;
---echo #
---echo # 3) Check compatibility for pending X lock.
---echo #
---echo # Acquire SR lock in order to create pending X lock.
-begin;
-select count(*) from t1;
---echo #
-connection default;
---echo # Add pending X lock.
---echo # Sending:
---send rename table t1 to t2;
---echo #
-connection mdl_con1;
---echo # Check that RENAME TABLE is waiting with pending X lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "rename table t1 to t2";
---source include/wait_condition.inc
---echo # Check that SH locks are compatible with pending X
-select column_name from information_schema.columns where
- table_schema='test' and table_name='t1';
---echo # Check that S is incompatible with pending X
---echo # Sending:
---send handler t1 open;
---echo #
-connection mdl_con2;
---echo # Check that the above HANDLER OPEN is blocked because of pending X lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "handler t1 open";
---source include/wait_condition.inc
---echo # Unblock RENAME TABLE.
-commit;
---echo #
-connection default;
---echo # Reaping RENAME TABLE.
---error ER_TABLE_EXISTS_ERROR
---reap
---echo #
-connection mdl_con1;
---echo # Reaping HANDLER t1 OPEN.
---reap
-handler t1 close;
---echo # Restore pending X lock.
---echo #
-connection mdl_con2;
-begin;
-select count(*) from t1;
---echo #
-connection default;
---echo # Add pending X lock.
---echo # Sending:
---send rename table t1 to t2;
---echo #
-connection mdl_con1;
---echo # Check that RENAME TABLE is waiting with pending X lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "rename table t1 to t2";
---source include/wait_condition.inc
---echo # Check that SR is incompatible with pending X
---echo # Sending:
---send select count(*) from t1;
---echo #
-connection mdl_con2;
---echo # Check that the above SELECT is blocked because of pending X lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "select count(*) from t1";
---source include/wait_condition.inc
---echo # Unblock RENAME TABLE.
-commit;
---echo #
-connection default;
---echo # Reaping RENAME TABLE.
---error ER_TABLE_EXISTS_ERROR
---reap
---echo #
-connection mdl_con1;
---echo # Reaping SELECT.
---reap
---echo # Restore pending X lock.
---echo #
-connection mdl_con2;
-begin;
-select count(*) from t1;
---echo #
-connection default;
---echo # Add pending X lock.
---echo # Sending:
---send rename table t1 to t2;
---echo #
-connection mdl_con1;
---echo # Check that RENAME TABLE is waiting with pending X lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "rename table t1 to t2";
---source include/wait_condition.inc
---echo # Check that SW is incompatible with pending X
---echo # Sending:
---send delete from t1 limit 1;
---echo #
-connection mdl_con2;
---echo # Check that the above DELETE is blocked because of pending X lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "delete from t1 limit 1";
---source include/wait_condition.inc
---echo # Unblock RENAME TABLE.
-commit;
---echo #
-connection default;
---echo # Reaping RENAME TABLE.
---error ER_TABLE_EXISTS_ERROR
---reap
---echo #
-connection mdl_con1;
---echo # Reaping DELETE.
---reap
---echo # Restore pending X lock.
---echo #
-connection mdl_con2;
-begin;
-select count(*) from t1;
---echo #
-connection default;
---echo # Add pending X lock.
---echo # Sending:
---send rename table t1 to t2;
---echo #
-connection mdl_con1;
---echo # Check that RENAME TABLE is waiting with pending X lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "rename table t1 to t2";
---source include/wait_condition.inc
---echo # Check that SNW is incompatible with pending X
---echo # Sending:
---send alter table t1 add primary key (c1);
---echo #
-connection mdl_con2;
---echo # Check that the above ALTER TABLE is blocked because of pending X lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "alter table t1 add primary key (c1)";
---source include/wait_condition.inc
---echo # Unblock RENAME TABLE.
-commit;
---echo #
-connection default;
---echo # Reaping RENAME TABLE.
---error ER_TABLE_EXISTS_ERROR
---reap
---echo #
-connection mdl_con1;
---echo # Reaping ALTER TABLE.
---error ER_DUP_ENTRY
---reap
---echo # Restore pending X lock.
---echo #
-connection mdl_con2;
-handler t1 open;
---echo #
-connection default;
---echo # Add pending X lock.
---echo # Sending:
---send rename table t1 to t2;
---echo #
-connection mdl_con1;
---echo # Check that RENAME TABLE is waiting with pending X lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "rename table t1 to t2";
---source include/wait_condition.inc
---echo # Check that SNRW is incompatible with pending X
---echo # Sending:
---send lock table t1 write;
---echo #
-connection mdl_con3;
---echo # Check that the above LOCK TABLES is blocked because of pending X lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "lock table t1 write";
---source include/wait_condition.inc
---echo #
-connection mdl_con2;
---echo # Unblock RENAME TABLE.
-handler t1 close;
---echo #
-connection default;
---echo # Reaping RENAME TABLE.
---error ER_TABLE_EXISTS_ERROR
---reap
---echo #
-connection mdl_con1;
---echo # Reaping LOCK TABLES.
---reap
-unlock tables;
---echo #
-connection default;
-
---echo #
---echo #
---echo # C) Now let us test how type-of-operation locks are handled in
---echo # transactional context. Obviously we are mostly interested
---echo # in conflicting types of locks.
---echo #
---echo # Note: No tests for active/pending SU lock since
---echo # ALTER TABLE is in its own transaction.
---echo #
-
---echo #
---echo # 1) Let us check how various locks used within transactional
---echo # context interact with active/pending SNW lock.
---echo #
---echo # We start with case when we are acquiring lock on the table
---echo # which was not used in the transaction before.
-begin;
-select count(*) from t1;
---echo #
-connection mdl_con1;
---echo # Create an active SNW lock on t2.
---echo # We have to use DEBUG_SYNC facility as otherwise SNW lock
---echo # will be immediately released (or upgraded to X lock).
-insert into t2 values (1), (1);
-set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL locked WAIT_FOR finish';
---echo # Sending:
---send alter table t2 add primary key (c1), algorithm=copy, lock=shared;
---echo #
-connection default;
-set debug_sync= 'now WAIT_FOR locked';
---echo # SR lock should be acquired without any waiting.
-select count(*) from t2;
-commit;
---echo # Now let us check that we will wait in case of SW lock.
-begin;
-select count(*) from t1;
---echo # Sending:
---send insert into t2 values (1);
---echo #
-connection mdl_con2;
---echo # Check that the above INSERT is blocked.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "insert into t2 values (1)";
---source include/wait_condition.inc
---echo # Unblock ALTER TABLE and thus INSERT.
-set debug_sync= 'now SIGNAL finish';
---echo #
-connection mdl_con1;
---echo # Reap ALTER TABLE.
---error ER_DUP_ENTRY
---reap
---echo #
-connection default;
---echo # Reap INSERT.
---reap
-commit;
---echo #
---echo # Now let us see what happens when we are acquiring lock on the table
---echo # which is already used in transaction.
---echo #
---echo # *) First, case when transaction which has SR lock on the table also
---echo # locked in SNW mode acquires yet another SR lock and then tries
---echo # to acquire SW lock.
-begin;
-select count(*) from t1;
---echo #
-connection mdl_con1;
---echo # Create an active SNW lock on t1.
-set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL locked WAIT_FOR finish';
---echo # Sending:
---send alter table t1 add primary key (c1), algorithm=copy, lock=shared;
---echo #
-connection default;
-set debug_sync= 'now WAIT_FOR locked';
---echo # We should still be able to get SR lock without waiting.
-select count(*) from t1;
---echo # Since the above ALTER TABLE is not upgrading SNW lock to X by waiting
---echo # for SW lock we won't create deadlock.
---echo # So the below INSERT should not end-up with ER_LOCK_DEADLOCK error.
---echo # Sending:
---send insert into t1 values (1);
---echo #
-connection mdl_con2;
---echo # Check that the above INSERT is blocked.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "insert into t1 values (1)";
---source include/wait_condition.inc
---echo # Unblock ALTER TABLE and thus INSERT.
-set debug_sync= 'now SIGNAL finish';
---echo #
-connection mdl_con1;
---echo # Reap ALTER TABLE.
---error ER_DUP_ENTRY
---reap
---echo #
-connection default;
---echo # Reap INSERT.
---reap
-commit;
---echo #
---echo # **) Now test in which transaction that has SW lock on the table
---echo # against which there is pending SNW lock acquires SR and SW
---echo # locks on this table.
---echo #
-begin;
-insert into t1 values (1);
---echo #
-connection mdl_con1;
---echo # Create pending SNW lock on t1.
---echo # Sending:
---send alter table t1 add primary key (c1);
---echo #
-connection default;
---echo # Wait until ALTER TABLE starts waiting for SNW lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "alter table t1 add primary key (c1)";
---source include/wait_condition.inc
---echo # We should still be able to get both SW and SR locks without waiting.
-select count(*) from t1;
-delete from t1 limit 1;
---echo # Unblock ALTER TABLE.
-commit;
---echo #
-connection mdl_con1;
---echo # Reap ALTER TABLE.
---error ER_DUP_ENTRY
---reap
---echo #
-connection default;
---echo #
---echo # 2) Now similar tests for active SNW lock which is being upgraded
---echo # to X lock.
---echo #
---echo # Again we start with case when we are acquiring lock on the
---echo # table which was not used in the transaction before.
-begin;
-select count(*) from t1;
---echo #
-connection mdl_con2;
---echo # Start transaction which will prevent SNW -> X upgrade from
---echo # completing immediately.
-begin;
-select count(*) from t2;
---echo #
-connection mdl_con1;
---echo # Create SNW lock pending upgrade to X on t2.
---echo # Sending:
---send alter table t2 add column c2 int;
---echo #
-connection default;
---echo # Wait until ALTER TABLE starts waiting X lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "alter table t2 add column c2 int";
---source include/wait_condition.inc
---echo # Check that attempt to acquire SR lock on t2 causes waiting.
---echo # Sending:
---send select count(*) from t2;
---echo #
-connection mdl_con2;
---echo # Check that the above SELECT is blocked.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "select count(*) from t2";
---source include/wait_condition.inc
---echo # Unblock ALTER TABLE.
-commit;
---echo #
-connection mdl_con1;
---echo # Reap ALTER TABLE.
---reap
---echo #
-connection default;
---echo # Reap SELECT.
---reap
-commit;
---echo # Do similar check for SW lock.
-begin;
-select count(*) from t1;
---echo #
-connection mdl_con2;
---echo # Start transaction which will prevent SNW -> X upgrade from
---echo # completing immediately.
-begin;
-select count(*) from t2;
---echo #
-connection mdl_con1;
---echo # Create SNW lock pending upgrade to X on t2.
---echo # Sending:
---send alter table t2 drop column c2;
---echo #
-connection default;
---echo # Wait until ALTER TABLE starts waiting X lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "alter table t2 drop column c2";
---source include/wait_condition.inc
---echo # Check that attempt to acquire SW lock on t2 causes waiting.
---echo # Sending:
---send insert into t2 values (1);
---echo #
-connection mdl_con2;
---echo # Check that the above INSERT is blocked.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "insert into t2 values (1)";
---source include/wait_condition.inc
---echo # Unblock ALTER TABLE.
-commit;
---echo #
-connection mdl_con1;
---echo # Reap ALTER TABLE.
---reap
---echo #
-connection default;
---echo # Reap INSERT.
---reap
-commit;
---echo #
---echo # Test for the case in which we are acquiring lock on the table
---echo # which is already used in transaction.
---echo #
-begin;
-select count(*) from t1;
---echo #
-connection mdl_con1;
---echo # Create SNW lock pending upgrade to X.
---echo # Sending:
---send alter table t1 add column c2 int;
---echo #
-connection default;
---echo # Wait until ALTER TABLE starts waiting X lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "alter table t1 add column c2 int";
---source include/wait_condition.inc
---echo # Check that transaction is still able to acquire SR lock.
-select count(*) from t1;
---echo # Waiting trying to acquire SW lock will cause deadlock and
---echo # therefore should cause an error.
---error ER_LOCK_DEADLOCK
-delete from t1 limit 1;
---echo # Unblock ALTER TABLE.
-commit;
---echo #
-connection mdl_con1;
---echo # Reap ALTER TABLE.
---reap
---echo #
-connection default;
---echo #
---echo # 3) Check how various locks used within transactional context
---echo # interact with active/pending SNRW lock.
---echo #
---echo # Once again we start with case when we are acquiring lock on
---echo # the table which was not used in the transaction before.
-begin;
-select count(*) from t1;
---echo #
-connection mdl_con1;
-lock table t2 write;
---echo #
-connection default;
---echo # Attempt to acquire SR should be blocked. It should
---echo # not cause errors as it does not creates deadlock.
---echo # Sending:
---send select count(*) from t2;
---echo #
-connection mdl_con1;
---echo # Check that the above SELECT is blocked
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "select count(*) from t2";
---source include/wait_condition.inc
---echo # Unblock SELECT.
-unlock tables;
---echo #
-connection default;
---echo # Reap SELECT.
---reap
-commit;
---echo # Repeat the same test for SW lock.
-begin;
-select count(*) from t1;
---echo #
-connection mdl_con1;
-lock table t2 write;
---echo #
-connection default;
---echo # Again attempt to acquire SW should be blocked and should
---echo # not cause any errors.
---echo # Sending:
---send delete from t2 limit 1;
---echo #
-connection mdl_con1;
---echo # Check that the above DELETE is blocked
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "delete from t2 limit 1";
---source include/wait_condition.inc
---echo # Unblock DELETE.
-unlock tables;
---echo #
-connection default;
---echo # Reap DELETE.
---reap
-commit;
---echo #
---echo # Now coverage for the case in which we are acquiring lock on
---echo # the table which is already used in transaction and against
---echo # which there is a pending SNRW lock request.
---echo #
---echo # *) Let us start with case when transaction has only a SR lock.
---echo #
-begin;
-select count(*) from t1;
---echo #
-connection mdl_con1;
---echo # Sending:
---send lock table t1 write;
---echo #
-connection default;
---echo # Wait until LOCK TABLE is blocked creating pending request for X lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "lock table t1 write";
---source include/wait_condition.inc
---echo # Check that another instance of SR lock is granted without waiting.
-select count(*) from t1;
---echo # Attempt to wait for SW lock will lead to deadlock, thus
---echo # the below statement should end with ER_LOCK_DEADLOCK error.
---error ER_LOCK_DEADLOCK
-delete from t1 limit 1;
---echo # Unblock LOCK TABLES.
-commit;
---echo #
-connection mdl_con1;
---echo # Reap LOCK TABLES.
---reap
-unlock tables;
---echo #
-connection default;
---echo #
---echo # **) Now case when transaction has a SW lock.
---echo #
-begin;
-delete from t1 limit 1;
---echo #
-connection mdl_con1;
---echo # Sending:
---send lock table t1 write;
---echo #
-connection default;
---echo # Wait until LOCK TABLE is blocked creating pending request for X lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "lock table t1 write";
---source include/wait_condition.inc
---echo # Check that both SR and SW locks are granted without waiting
---echo # and errors.
-select count(*) from t1;
-insert into t1 values (1, 1);
---echo # Unblock LOCK TABLES.
-commit;
---echo #
-connection mdl_con1;
---echo # Reap LOCK TABLES.
---reap
-unlock tables;
---echo #
-connection default;
---echo #
---echo # 4) Check how various locks used within transactional context
---echo # interact with active/pending X lock.
---echo #
---echo # As usual we start with case when we are acquiring lock on
---echo # the table which was not used in the transaction before.
-begin;
-select count(*) from t1;
---echo #
-connection mdl_con2;
---echo # Start transaction which will prevent X lock from going away
---echo # immediately.
-begin;
-select count(*) from t2;
---echo #
-connection mdl_con1;
---echo # Create pending X lock on t2.
---echo # Sending:
---send rename table t2 to t3;
---echo #
-connection default;
---echo # Wait until RENAME TABLE starts waiting with pending X lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "rename table t2 to t3";
---source include/wait_condition.inc
---echo # Check that attempt to acquire SR lock on t2 causes waiting.
---echo # Sending:
---send select count(*) from t2;
---echo #
-connection mdl_con2;
---echo # Check that the above SELECT is blocked.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "select count(*) from t2";
---source include/wait_condition.inc
---echo # Unblock RENAME TABLE.
-commit;
---echo #
-connection mdl_con1;
---echo # Reap RENAME TABLE.
---reap
---echo #
-connection default;
---echo # Reap SELECT.
---error ER_NO_SUCH_TABLE
---reap
-commit;
-rename table t3 to t2;
---echo # The same test for SW lock.
-begin;
-select count(*) from t1;
---echo #
-connection mdl_con2;
---echo # Start transaction which will prevent X lock from going away
---echo # immediately.
-begin;
-select count(*) from t2;
---echo #
-connection mdl_con1;
---echo # Create pending X lock on t2.
---echo # Sending:
---send rename table t2 to t3;
---echo #
-connection default;
---echo # Wait until RENAME TABLE starts waiting with pending X lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "rename table t2 to t3";
---source include/wait_condition.inc
---echo # Check that attempt to acquire SW lock on t2 causes waiting.
---echo # Sending:
---send delete from t2 limit 1;
---echo #
-connection mdl_con2;
---echo # Check that the above DELETE is blocked.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "delete from t2 limit 1";
---source include/wait_condition.inc
---echo # Unblock RENAME TABLE.
-commit;
---echo #
-connection mdl_con1;
---echo # Reap RENAME TABLE.
---reap
---echo #
-connection default;
---echo # Reap DELETE.
---error ER_NO_SUCH_TABLE
---reap
-commit;
-rename table t3 to t2;
---echo #
---echo # Coverage for the case in which we are acquiring lock on
---echo # the table which is already used in transaction and against
---echo # which there is a pending X lock request.
---echo #
---echo # *) The first case is when transaction has only a SR lock.
---echo #
-begin;
-select count(*) from t1;
---echo #
-connection mdl_con1;
---echo # Sending:
---send rename table t1 to t2;
---echo #
-connection default;
---echo # Wait until RENAME TABLE is blocked creating pending request for X lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "rename table t1 to t2";
---source include/wait_condition.inc
---echo # Check that another instance of SR lock is granted without waiting.
-select count(*) from t1;
---echo # Attempt to wait for SW lock will lead to deadlock, thus
---echo # the below statement should end with ER_LOCK_DEADLOCK error.
---error ER_LOCK_DEADLOCK
-delete from t1 limit 1;
---echo # Unblock RENAME TABLE.
-commit;
---echo #
-connection mdl_con1;
---echo # Reap RENAME TABLE.
---error ER_TABLE_EXISTS_ERROR
---reap
---echo #
-connection default;
---echo #
---echo # **) The second case is when transaction has a SW lock.
---echo #
-begin;
-delete from t1 limit 1;
---echo #
-connection mdl_con1;
---echo # Sending:
---send rename table t1 to t2;
---echo #
-connection default;
---echo # Wait until RENAME TABLE is blocked creating pending request for X lock.
-let $wait_condition=
-select count(*) = 1 from information_schema.processlist
-where state = "Waiting for table metadata lock" and
- info = "rename table t1 to t2";
---source include/wait_condition.inc
---echo # Check that both SR and SW locks are granted without waiting
---echo # and errors.
-select count(*) from t1;
-insert into t1 values (1, 1);
---echo # Unblock RENAME TABLE.
-commit;
---echo #
-connection mdl_con1;
---echo # Reap RENAME TABLE.
---error ER_TABLE_EXISTS_ERROR
---reap
---echo #
-connection default;
-
---echo # Clean-up.
-disconnect mdl_con1;
-disconnect mdl_con2;
-disconnect mdl_con3;
-set debug_sync= 'RESET';
-drop table t1, t2;
-
---echo #
---echo # Test coverage for basic deadlock detection in metadata
---echo # locking subsystem.
---echo #
---disable_warnings
-drop tables if exists t0, t1, t2, t3, t4, t5;
---enable_warnings
-set debug_sync= 'RESET';
-
-connect(deadlock_con1,localhost,root,,);
-connect(deadlock_con2,localhost,root,,);
-connect(deadlock_con3,localhost,root,,);
-connection default;
-create table t1 (i int);
-create table t2 (j int);
-create table t3 (k int);
-create table t4 (k int);
-
---echo #
---echo # Test for the case in which no deadlock occurs.
---echo #
-
---echo #
-connection deadlock_con1;
-begin;
-insert into t1 values (1);
-
---echo #
-connection deadlock_con2;
-begin;
-insert into t2 values (1);
-
---echo #
-connection default;
---echo # Send:
---send rename table t2 to t0, t3 to t2, t0 to t3;
-
---echo #
-connection deadlock_con1;
---echo # Wait until the above RENAME TABLE is blocked because it has to wait
---echo # for 'deadlock_con2' which holds shared metadata lock on 't2'.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "rename table t2 to t0, t3 to t2, t0 to t3";
---source include/wait_condition.inc
---echo # The below statement should wait for exclusive metadata lock
---echo # on 't2' to go away and should not produce ER_LOCK_DEADLOCK
---echo # as no deadlock is possible in this situation.
---echo # Send:
---send select * from t2;
-
---echo #
-connection deadlock_con2;
---echo # Wait until the above SELECT * FROM t2 is starts waiting
---echo # for an exclusive metadata lock to go away.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "select * from t2";
---source include/wait_condition.inc
---echo #
---echo # Unblock RENAME TABLE by releasing shared metadata lock on t2.
-commit;
-
---echo #
-connection default;
---echo # Reap RENAME TABLE.
---reap
-
---echo #
-connection deadlock_con1;
---echo # Reap SELECT.
---reap
-
---echo #
-connection default;
---echo #
---echo # Let us check that in the process of waiting for conflicting lock
---echo # on table 't2' to go away transaction in connection 'deadlock_con1'
---echo # has not released metadata lock on table 't1'.
---echo # Send:
---send rename table t1 to t0, t3 to t1, t0 to t3;
-
---echo #
-connection deadlock_con1;
---echo # Wait until the above RENAME TABLE is blocked because it has to wait
---echo # for 'deadlock_con1' which should still hold shared metadata lock on
---echo # table 't1'.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "rename table t1 to t0, t3 to t1, t0 to t3";
---source include/wait_condition.inc
---echo # Commit transaction to unblock RENAME TABLE.
-commit;
-
---echo #
-connection default;
---echo # Reap RENAME TABLE.
---reap
-
---echo #
---echo # Test for case when deadlock occurs and should be detected immediately.
---echo #
-
---echo #
-connection deadlock_con1;
-begin;
-insert into t2 values (2);
-
---echo #
-connection default;
---echo # Send:
---send rename table t2 to t0, t1 to t2, t0 to t1;
-
---echo #
-connection deadlock_con1;
---echo # Wait until the above RENAME TABLE is blocked because it has to wait
---echo # for 'deadlock_con1' which holds shared metadata lock on 't2'.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "rename table t2 to t0, t1 to t2, t0 to t1";
---source include/wait_condition.inc
---echo #
---echo # The below statement should not wait as doing so will cause deadlock.
---echo # Instead it should fail and emit ER_LOCK_DEADLOCK statement and
---echo # transaction should be rolled back.
---error ER_LOCK_DEADLOCK
-select * from t1;
-
---echo #
-connection default;
---echo # Reap RENAME TABLE.
---reap
-
---echo #
---echo # Test for the case in which deadlock also occurs but not immediately.
---echo #
-
---echo #
-connection deadlock_con1;
-begin;
-insert into t2 values (1);
-
---echo #
-connection default;
-lock table t1 write;
-
---echo #
-connection deadlock_con1;
---echo # The below SELECT statement should wait for metadata lock
---echo # on table 't1' and should not produce ER_LOCK_DEADLOCK
---echo # immediately as no deadlock is possible at the moment.
---send select * from t1;
-
---echo #
-connection deadlock_con2;
---echo # Wait until the above SELECT * FROM t1 is starts waiting
---echo # for an UNRW metadata lock to go away.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and info = "select * from t1";
---source include/wait_condition.inc
-
---echo # Send RENAME TABLE statement that will deadlock with the
---echo # SELECT statement and thus should abort the latter.
---send rename table t1 to t0, t2 to t1, t0 to t2;
-
---echo #
-connection default;
---echo # Wait till above RENAME TABLE is blocked while holding
---echo # pending X lock on t1.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "rename table t1 to t0, t2 to t1, t0 to t2";
---source include/wait_condition.inc
---echo # Allow the above RENAME TABLE to acquire lock on t1 and
---echo # create pending lock on t2 thus creating deadlock.
-unlock tables;
-
---echo #
-connection deadlock_con1;
---echo # Since the latest RENAME TABLE entered in deadlock with SELECT
---echo # statement the latter should be aborted and emit ER_LOCK_DEADLOCK
---echo # error and transaction should be rolled back.
---echo # Reap SELECT * FROM t1.
---error ER_LOCK_DEADLOCK
---reap
-
---echo #
-connection deadlock_con2;
---echo # Reap RENAME TABLE ... .
---reap;
-
---echo #
-connection default;
-
-drop tables t1, t2, t3, t4;
-
---echo #
---echo # Now, test case which shows that deadlock detection empiric
---echo # also takes into account requests for metadata lock upgrade.
---echo #
-create table t1 (i int);
-insert into t1 values (1);
---echo # Avoid race which occurs when SELECT in 'deadlock_con1' connection
---echo # accesses table before the above INSERT unlocks the table and thus
---echo # its result becomes visible to other connections.
-select * from t1;
-
---echo #
-connection deadlock_con1;
-begin;
-select * from t1;
-
---echo #
-connection default;
---echo # Send:
---send alter table t1 add column j int, rename to t2;
-
---echo #
-connection deadlock_con1;
---echo # Wait until the above ALTER TABLE ... RENAME acquires exclusive
---echo # metadata lock on 't2' and starts waiting for connection
---echo # 'deadlock_con1' which holds shared lock on 't1'.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "alter table t1 add column j int, rename to t2";
---source include/wait_condition.inc
-
---echo # The below statement should not wait as it will cause deadlock.
---echo # An appropriate error should be reported instead and transaction
---echo # should be rolled back.
---error ER_LOCK_DEADLOCK
-select * from t2;
-
---echo #
-connection default;
---echo # Reap ALTER TABLE ... RENAME.
---reap
-
-drop table t2;
-
---echo #
---echo # Test that in situation when MDL subsystem detects a deadlock
---echo # but it turns out that it can be resolved by backing-off locks
---echo # acquired by one of participating transactions (which is
---echo # possible when one of transactions consists only of currently
---echo # executed statement, e.g. in autocommit mode) no error is
---echo # reported.
---echo #
-create table t1 (i int);
-create table t2 (j int);
---echo # Ensure that the below SELECT stops once it has acquired metadata
---echo # lock on table 't2'.
-set debug_sync= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR finish';
---echo # Sending:
---send select * from t2, t1
-
---echo #
-connection deadlock_con1;
---echo # Wait till SELECT acquires MDL on 't2' and starts waiting for signal.
-set debug_sync= 'now WAIT_FOR locked';
---echo # Sending:
---send lock tables t1 write, t2 write
-
---echo #
-connection deadlock_con2;
---echo # Wait until LOCK TABLES acquires SNRW lock on 't1' and is blocked
---echo # while trying to acquire SNRW lock on 't1'.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "lock tables t1 write, t2 write";
---source include/wait_condition.inc
---echo # Resume SELECT execution, this should eventually unblock LOCK TABLES.
-set debug_sync= 'now SIGNAL finish';
-
---echo #
-connection deadlock_con1;
---echo # Reaping LOCK TABLES.
---reap
-unlock tables;
-
---echo #
-connection default;
---echo # Reaping SELECT. It succeed and not report ER_LOCK_DEADLOCK error.
---reap
-
-drop tables t1, t2;
-
---echo #
---echo # Test coverage for situation in which a race has happened
---echo # during deadlock detection process which led to unwarranted
---echo # ER_LOCK_DEADLOCK error.
---echo #
-create table t1 (i int);
-
---echo # Ensure that ALTER waits once it has acquired SNW lock.
-set debug_sync='alter_table_copy_after_lock_upgrade SIGNAL parked1 WAIT_FOR go1';
---echo # Sending:
---send alter table t1 add column j int
-
---echo #
-connection deadlock_con1;
---echo # Wait till ALTER acquires SNW lock and stops.
-set debug_sync='now WAIT_FOR parked1';
---echo # Ensure that INSERT is paused once it detects that there is
---echo # a conflicting metadata lock so it has to wait, but before
---echo # deadlock detection is run.
-set debug_sync='mdl_acquire_lock_wait SIGNAL parked2 WAIT_FOR go2';
---echo # Sending:
---send insert into t1 values ()
-
---echo #
-connection deadlock_con2;
---echo # Wait till INSERT is paused.
-set debug_sync='now WAIT_FOR parked2';
---echo # Resume ALTER execution. Eventually it will release its
---echo # metadata lock and INSERT's request for SW lock will be
---echo # satisified.
-set debug_sync='now SIGNAL go1';
-
---echo #
-connection default;
---echo # Reaping ALTER TABLE.
---reap
---echo # Add a new request for SNW lock to waiting graph.
---echo # Sending:
---send alter table t1 drop column j
-
---echo #
-connection deadlock_con2;
---echo # Wait until ALTER is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "alter table t1 drop column j";
---source include/wait_condition.inc
---echo # Resume INSERT so it can start deadlock detection.
---echo #
---echo # At this point there is a discrepancy between the fact that INSERT's
---echo # SW lock is already satisfied, but INSERT's connection is still
---echo # marked as waiting for it. Looking for a loop in waiters graph
---echo # without additional checks has detected a deadlock (INSERT waits
---echo # for SW lock; which is not granted because of pending SNW lock from
---echo # ALTER; which waits for active SW lock from INSERT). Since requests
---echo # for SW and SNW locks have same weight ALTER was selected as a victim
---echo # and ended with ER_LOCK_DEADLOCK error.
-set debug_sync='now SIGNAL go2';
-
---echo #
-connection deadlock_con1;
---echo # Reaping INSERT.
---reap
-
---echo #
-connection default;
---echo # Reaping ALTER. It should succeed and not produce ER_LOCK_DEADLOCK.
---reap
-
-drop table t1;
-
---echo #
---echo # Now, test for a situation in which deadlock involves waiting not
---echo # only in MDL subsystem but also for TDC. Such deadlocks should be
---echo # successfully detected. If possible, they should be resolved without
---echo # resorting to ER_LOCK_DEADLOCK error.
---echo #
-create table t1(i int);
-create table t2(j int);
-
---echo #
---echo # First, let us check how we handle a simple scenario involving
---echo # waits in MDL and TDC.
---echo #
-set debug_sync= 'RESET';
-
-connection deadlock_con1;
---echo # Start a statement, which will acquire SR metadata lock on t1, open it
---echo # and then stop, before trying to acquire SW lock on t2 and opening it.
-set debug_sync='open_tables_after_open_and_process_table SIGNAL parked WAIT_FOR go';
---echo # Sending:
---send select * from t1 where i in (select j from t2 for update)
-
-connection deadlock_con2;
---echo # Wait till the above SELECT stops.
-set debug_sync='now WAIT_FOR parked';
---echo # The below FLUSH TABLES WITH READ LOCK should acquire
---echo # SNW locks on t1 and t2 and wait till SELECT closes t1.
---echo # Sending:
-send flush tables t1, t2 with read lock;
-
-connection deadlock_con3;
---echo # Wait until FLUSH TABLES WITH t1, t2 READ LOCK starts waiting
---echo # for SELECT to close t1.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table flush" and
- info = "flush tables t1, t2 with read lock";
---source include/wait_condition.inc
-
---echo # Resume SELECT, so it tries to acquire SW lock on t1 and blocks,
---echo # creating a deadlock. This deadlock should be detected and resolved
---echo # by backing-off SELECT. As a result FTWRL should be able to finish.
-set debug_sync='now SIGNAL go';
-
-connection deadlock_con2;
---echo # Reap FLUSH TABLES WITH READ LOCK.
-reap;
-unlock tables;
-
-connection deadlock_con1;
---echo # Reap SELECT.
-reap;
-
---echo #
---echo # The same scenario with a slightly different order of events
---echo # which emphasizes that setting correct deadlock detector weights
---echo # for flush waits is important.
---echo #
-set debug_sync= 'RESET';
-
-connection deadlock_con2;
-set debug_sync='flush_tables_with_read_lock_after_acquire_locks SIGNAL parked WAIT_FOR go';
-
---echo # The below FLUSH TABLES WITH READ LOCK should acquire
---echo # SNW locks on t1 and t2 and wait on debug sync point.
---echo # Sending:
-send flush tables t1, t2 with read lock;
-
-connection deadlock_con1;
---echo # Wait till FLUSH TABLE WITH READ LOCK stops.
-set debug_sync='now WAIT_FOR parked';
-
---echo # Start statement which will acquire SR metadata lock on t1, open
---echo # it and then will block while trying to acquire SW lock on t2.
---echo # Sending:
-send select * from t1 where i in (select j from t2 for update);
-
-connection deadlock_con3;
---echo # Wait till the above SELECT blocks.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "select * from t1 where i in (select j from t2 for update)";
---source include/wait_condition.inc
-
---echo # Resume FLUSH TABLES, so it tries to flush t1, thus creating
---echo # a deadlock. This deadlock should be detected and resolved by
---echo # backing-off SELECT. As a result FTWRL should be able to finish.
-set debug_sync='now SIGNAL go';
-
-connection deadlock_con2;
---echo # Reap FLUSH TABLES WITH READ LOCK.
-reap;
-unlock tables;
-
-connection deadlock_con1;
---echo # Reap SELECT.
-reap;
-
---echo #
---echo # Now a more complex scenario involving two connections
---echo # waiting for MDL and one for TDC.
---echo #
-set debug_sync= 'RESET';
-
-connection deadlock_con1;
---echo # Start a statement which will acquire SR metadata lock on t2, open it
---echo # and then stop, before trying to acquire SR on t1 and opening it.
-set debug_sync='open_tables_after_open_and_process_table SIGNAL parked WAIT_FOR go';
---echo # Sending:
-send select * from t2, t1;
-
-connection deadlock_con2;
---echo # Wait till the above SELECT stops.
-set debug_sync='now WAIT_FOR parked';
---echo # The below FLUSH TABLES WITH READ LOCK should acquire
---echo # SNW locks on t2 and wait till SELECT closes t2.
---echo # Sending:
-send flush tables t2 with read lock;
-
-connection deadlock_con3;
---echo # Wait until FLUSH TABLES WITH READ LOCK starts waiting
---echo # for SELECT to close t2.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table flush" and
- info = "flush tables t2 with read lock";
---source include/wait_condition.inc
-
---echo # The below DROP TABLES should acquire X lock on t1 and start
---echo # waiting for X lock on t2.
---echo # Sending:
-send drop tables t1, t2;
-
-connection default;
---echo # Wait until DROP TABLES starts waiting for X lock on t2.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "drop tables t1, t2";
---source include/wait_condition.inc
-
---echo # Resume SELECT, so it tries to acquire SR lock on t1 and blocks,
---echo # creating a deadlock. This deadlock should be detected and resolved
---echo # by backing-off SELECT. As a result, FTWRL should be able to finish.
-set debug_sync='now SIGNAL go';
-
-connection deadlock_con2;
---echo # Reap FLUSH TABLES WITH READ LOCK.
-reap;
---echo # Unblock DROP TABLES.
-unlock tables;
-
-connection deadlock_con3;
---echo # Reap DROP TABLES.
-reap;
-
-connection deadlock_con1;
---echo # Reap SELECT. It should emit error about missing table.
---error ER_NO_SUCH_TABLE
-reap;
-
-connection default;
-
-set debug_sync= 'RESET';
-
-disconnect deadlock_con1;
-disconnect deadlock_con2;
-disconnect deadlock_con3;
-
-
---echo #
---echo # Test for a scenario in which FLUSH TABLES <list> WITH READ LOCK
---echo # used to erroneously release metadata locks.
---echo #
-connect(con1,localhost,root,,);
-connect(con2,localhost,root,,);
-connection default;
---disable_warnings
-drop tables if exists t1, t2;
---enable_warnings
-set debug_sync= 'RESET';
-create table t1(i int);
-create table t2(j int);
-
-connection con2;
-set debug_sync='open_tables_after_open_and_process_table SIGNAL parked WAIT_FOR go';
-
---echo # The below FLUSH TABLES <list> WITH READ LOCK should acquire
---echo # SNW locks on t1 and t2, open table t1 and block on the debug
---echo # sync point.
---echo # Sending:
-send flush tables t1, t2 with read lock;
-
-connection con1;
---echo # Wait till FLUSH TABLES <list> WITH READ LOCK stops.
-set debug_sync='now WAIT_FOR parked';
-
---echo # Start a statement which will flush all tables and thus
---echo # invalidate table t1 open by FLUSH TABLES <list> WITH READ LOCK.
---echo # Sending:
-send flush tables;
-
-connection default;
---echo # Wait till the above FLUSH TABLES blocks.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table flush" and
- info = "flush tables";
---source include/wait_condition.inc
-
---echo # Resume FLUSH TABLES <list> WITH READ LOCK, so it tries to open t2
---echo # discovers that its t1 is obsolete and tries to reopen all tables.
---echo # Such reopen should not cause releasing of SNW metadata locks
---echo # which would result in assertion failures.
-set debug_sync='now SIGNAL go';
-
-connection con2;
---echo # Reap FLUSH TABLES <list> WITH READ LOCK.
-reap;
-unlock tables;
-
-connection con1;
---echo # Reap FLUSH TABLES.
-reap;
-
---echo # Clean-up.
-connection default;
-drop tables t1, t2;
-set debug_sync= 'RESET';
-disconnect con1;
-disconnect con2;
-
-
---echo #
---echo # Test for bug #46748 "Assertion in MDL_context::wait_for_locks()
---echo # on INSERT + CREATE TRIGGER".
---echo #
---disable_warnings
-drop tables if exists t1, t2, t3, t4, t5;
---enable_warnings
---echo # Let us simulate scenario in which we open some tables from extended
---echo # part of prelocking set but then encounter conflicting metadata lock,
---echo # so have to back-off and wait for it to go away.
-connect (con1root,localhost,root,,test,,);
-connect (con2root,localhost,root,,test,,);
-connection default;
-create table t1 (i int);
-create table t2 (j int);
-create table t3 (k int);
-create table t4 (l int);
-create trigger t1_bi before insert on t1 for each row
- insert into t2 values (new.i);
-create trigger t2_bi before insert on t2 for each row
- insert into t3 values (new.j);
---echo #
-connection con1root;
-lock tables t4 read;
---echo #
-connection con2root;
---echo # Send :
---send rename table t3 to t5, t4 to t3;
---echo #
-connection default;
---echo # Wait until the above RENAME TABLE adds pending requests for exclusive
---echo # metadata lock on its tables and blocks due to 't4' being used by LOCK
---echo # TABLES.
-let $wait_condition= select count(*)= 1 from information_schema.processlist
- where state= 'Waiting for table metadata lock' and
- info='rename table t3 to t5, t4 to t3';
---source include/wait_condition.inc
---echo # Send :
---send insert into t1 values (1);
---echo #
-connection con1root;
---echo # Wait until INSERT statement waits due to encountering pending
---echo # exclusive metadata lock on 't3'.
-let $wait_condition= select count(*)= 1 from information_schema.processlist
- where state= 'Waiting for table metadata lock' and
- info='insert into t1 values (1)';
---source include/wait_condition.inc
-unlock tables;
---echo #
-connection con2root;
---echo # Reap RENAME TABLE.
---reap
---echo #
-connection default;
---echo # Reap INSERT.
---reap
---echo # Clean-up.
-disconnect con1root;
-disconnect con2root;
-drop tables t1, t2, t3, t5;
-
-
---echo #
---echo # Bug#42546 - Backup: RESTORE fails, thinking it finds an existing table
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-set @save_log_output=@@global.log_output;
-set global log_output=file;
-
-connect(con2, localhost, root,,);
-
---echo #
---echo # Test 1: CREATE TABLE
---echo #
-
-connection con2;
---echo # Start insert on the not-yet existing table
---echo # Wait after taking the MDL lock
-SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR finish';
---send INSERT INTO t1 VALUES(1,"def")
-
-connection default;
-SET DEBUG_SYNC= 'now WAIT_FOR locked';
---echo # Now INSERT has a MDL on the non-existent table t1.
-
---echo #
---echo # Continue the INSERT once CREATE waits for exclusive lock
-SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL finish';
---echo # Try to create that table.
---send CREATE TABLE t1 (c1 INT, c2 VARCHAR(100), KEY(c1))
-
---echo # Insert fails
-connection con2;
---error ER_NO_SUCH_TABLE
---reap
-
-connection default;
---reap;
-SET DEBUG_SYNC= 'RESET';
-SHOW TABLES;
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
---echo #
---echo # Test 2: CREATE TABLE LIKE
---echo #
-
-CREATE TABLE t2 (c1 INT, c2 VARCHAR(100), KEY(c1));
-
-connection con2;
---echo # Start insert on the not-yet existing table
---echo # Wait after taking the MDL
-SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL locked WAIT_FOR finish';
---send INSERT INTO t1 VALUES(1,"def")
-
-connection default;
-SET DEBUG_SYNC= 'now WAIT_FOR locked';
---echo # Now INSERT has a MDL on the non-existent table t1.
-
---echo #
---echo # Continue the INSERT once CREATE waits for exclusive lock
-SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL finish';
---echo # Try to create that table.
---send CREATE TABLE t1 LIKE t2
-
---echo # Insert fails
-connection con2;
---error ER_NO_SUCH_TABLE
---reap
-
-connection default;
---reap
-SET DEBUG_SYNC= 'RESET';
-SHOW TABLES;
-
-DROP TABLE t2;
-disconnect con2;
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-set global log_output=@save_log_output;
-
-
---echo #
---echo # Bug #46044 "MDL deadlock on LOCK TABLE + CREATE TABLE HIGH_PRIORITY
---echo # FOR UPDATE"
---echo #
---disable_warnings
-drop tables if exists t1, t2;
---enable_warnings
-connect (con46044, localhost, root,,);
-connect (con46044_2, localhost, root,,);
-connect (con46044_3, localhost, root,,);
-connection default;
-create table t1 (i int);
-insert into t1 values(1);
-
---echo # Let us check that we won't deadlock if during filling
---echo # of I_S table we encounter conflicting metadata lock
---echo # which owner is in its turn waiting for our connection.
-lock tables t1 read;
-
-connection con46044_2;
---echo # Sending:
---send update t1 set i = 2
-
-connection con46044;
-
---echo # Waiting until UPDATE t1 SET ... is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table level lock" and
- info = "update t1 set i = 2";
---source include/wait_condition.inc
-
---echo # Sending:
---send create table t2 select * from t1;
-
-connection default;
---echo # Waiting until CREATE TABLE ... SELECT ... is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table level lock" and
- info = "create table t2 select * from t1";
---source include/wait_condition.inc
-
---echo # First let us check that SHOW FIELDS/DESCRIBE doesn't
---echo # gets blocked and emits and error.
---error ER_WARN_I_S_SKIPPED_TABLE
-show fields from t2;
-
---echo # Now test for I_S query which reads only .FRMs.
---echo #
---echo # Query below should only emit a warning.
-select column_name from information_schema.columns
- where table_schema='test' and table_name='t2';
-
---echo # Finally, test for I_S query which does full-blown table open.
---echo #
---echo # Query below should not be blocked. Warning message should be
---echo # stored in the 'table_comment' column.
-select table_name, table_type, auto_increment, table_comment
- from information_schema.tables where table_schema='test' and table_name='t2';
-
-connection default;
-unlock tables;
-
-connection con46044;
---echo # Reaping CREATE TABLE ... SELECT ... .
---reap
-drop table t2;
-
-connection con46044_2;
---echo # Reaping UPDATE t1 statement
---reap
-
---echo #
---echo # Let us also check that queries to I_S wait for conflicting metadata
---echo # locks to go away instead of skipping table with a warning in cases
---echo # when deadlock is not possible. This is a nice thing from compatibility
---echo # and ease of use points of view.
---echo #
---echo # We check same three queries to I_S in this new situation.
-
-connection con46044_2;
-lock tables t1 read;
-
-connection con46044_3;
---echo # Sending:
-send update t1 set i = 3;
-
-connection con46044;
-
---echo # Waiting until UPDATE t1 SET ... is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table level lock" and
- info = "update t1 set i = 3";
---source include/wait_condition.inc
-
---echo # Sending:
---send create table t2 select * from t1;
-
-connection default;
---echo # Waiting until CREATE TABLE ... SELECT ... is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table level lock" and
- info = "create table t2 select * from t1";
---source include/wait_condition.inc
-
---echo # Let us check that SHOW FIELDS/DESCRIBE gets blocked.
---echo # Sending:
---send show fields from t2;
-
-connection con46044_2;
---echo # Wait until SHOW FIELDS gets blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "show fields from t2";
---source include/wait_condition.inc
-
-unlock tables;
-
-connection con46044;
---echo # Reaping CREATE TABLE ... SELECT ... .
---reap
-
-connection default;
---echo # Reaping SHOW FIELDS ...
---reap
-drop table t2;
-
-connection con46044_3;
---echo # Reaping UPDATE t1 statement
---reap
-
-connection con46044_2;
-lock tables t1 read;
-
-connection con46044_3;
---echo # Sending:
---send update t1 set i = 4
-
-connection con46044;
-
---echo # Waiting until UPDATE t1 SET ... is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table level lock" and
- info = "update t1 set i = 4";
---source include/wait_condition.inc
-
---echo # Sending:
---send create table t2 select * from t1;
-
-connection default;
---echo # Waiting until CREATE TABLE ... SELECT ... is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table level lock" and
- info = "create table t2 select * from t1";
---source include/wait_condition.inc
-
---echo # Check that I_S query which reads only .FRMs gets blocked.
---echo # Sending:
---send select column_name from information_schema.columns where table_schema='test' and table_name='t2';
-
-connection con46044_2;
---echo # Wait until SELECT COLUMN_NAME FROM I_S.COLUMNS gets blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info like "select column_name from information_schema.columns%";
---source include/wait_condition.inc
-
-unlock tables;
-
-connection con46044;
---echo # Reaping CREATE TABLE ... SELECT ... .
---reap
-
-connection default;
---echo # Reaping SELECT COLUMN_NAME FROM I_S.COLUMNS
---reap
-drop table t2;
-
-connection con46044_3;
---echo # Reaping UPDATE t1 statement
---reap
-
-connection con46044_2;
-lock tables t1 read;
-
-connection con46044_3;
---echo # Sending:
---send update t1 set i = 5
-
-connection con46044;
-
---echo # Waiting until UPDATE t1 SET ... is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table level lock" and
- info = "update t1 set i = 5";
---source include/wait_condition.inc
-
---echo # Sending:
---send create table t2 select * from t1;
-
-connection default;
---echo # Waiting until CREATE TABLE ... SELECT ... is blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table level lock" and
- info = "create table t2 select * from t1";
---source include/wait_condition.inc
-
---echo # Finally, check that I_S query which does full-blown table open
---echo # also gets blocked.
---echo # Sending:
---send select table_name, table_type, auto_increment, table_comment from information_schema.tables where table_schema='test' and table_name='t2';
-
-connection con46044_2;
---echo # Wait until SELECT ... FROM I_S.TABLES gets blocked.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info like "select table_name, table_type, auto_increment, table_comment from information_schema.tables%";
---source include/wait_condition.inc
-
-unlock tables;
-
-connection con46044;
---echo # Reaping CREATE TABLE ... SELECT ... .
---reap
-
-connection default;
---echo # Reaping SELECT ... FROM I_S.TABLES
---reap
-drop table t2;
-
-connection con46044_3;
---echo # Reaping UPDATE t1 statement
---reap
-
-connection default;
---echo # Clean-up.
-disconnect con46044;
-disconnect con46044_2;
-disconnect con46044_3;
-drop table t1;
-
-
---echo #
---echo # Test for bug #46273 "MySQL 5.4.4 new MDL: Bug#989 is not fully fixed
---echo # in case of ALTER".
---echo #
---disable_warnings
-drop table if exists t1;
---enable_warnings
-set debug_sync= 'RESET';
-connect (con46273,localhost,root,,test,,);
-connection default;
-create table t1 (c1 int primary key, c2 int, c3 int);
-insert into t1 values (1,1,0),(2,2,0),(3,3,0),(4,4,0),(5,5,0);
-
-begin;
-select * from t1 where c2 = 3;
-
---echo #
-connection con46273;
-set debug_sync='alter_table_copy_after_lock_upgrade SIGNAL alter_table_locked WAIT_FOR alter_go';
---send alter table t1 add column e int, rename to t2;
-
---echo #
-connection default;
-set debug_sync='now WAIT_FOR alter_table_locked';
-set debug_sync='mdl_acquire_lock_wait SIGNAL alter_go';
---echo # The below statement should get ER_LOCK_DEADLOCK error
---echo # (i.e. it should not allow ALTER to proceed, and then
---echo # fail due to 't1' changing its name to 't2').
---error ER_LOCK_DEADLOCK
-update t1 set c3=c3+1 where c2 = 3;
-
---echo #
-connection con46273;
---echo # Reap ALTER TABLE.
---reap
-
---echo #
-connection default;
-disconnect con46273;
---echo # Clean-up.
-set debug_sync= 'RESET';
-drop table t2;
-
-
---echo #
---echo # Test for bug #46673 "Deadlock between FLUSH TABLES WITH READ LOCK
---echo # and DML".
---echo #
---disable_warnings
-drop tables if exists t1;
---enable_warnings
-connect (con46673, localhost, root,,);
-connection default;
-create table t1 (i int);
-
-connection con46673;
-begin;
-insert into t1 values (1);
-
-connection default;
---echo # Statement below should not get blocked. And if after some
---echo # changes to code it is there should not be a deadlock between
---echo # it and transaction from connection 'con46673'.
-flush tables with read lock;
-unlock tables;
-
-connection con46673;
-delete from t1 where i = 1;
-commit;
-
-connection default;
---echo # Clean-up
-disconnect con46673;
-drop table t1;
-
-
---echo #
---echo # Bug#48210 FLUSH TABLES WITH READ LOCK deadlocks
---echo # against concurrent CREATE PROCEDURE
---echo #
-
-connect (con2, localhost, root);
-
---echo # Test 1: CREATE PROCEDURE
-
-connection default;
---echo # Start CREATE PROCEDURE and open mysql.proc
-SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL table_opened WAIT_FOR grlwait';
---send CREATE PROCEDURE p1() SELECT 1
-
-connection con2;
-SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
---echo # Check that FLUSH must wait to get the GRL
---echo # and let CREATE PROCEDURE continue
-SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait';
---send FLUSH TABLES WITH READ LOCK
-
-connection default;
---reap
-
-connection con2;
---reap
-UNLOCK TABLES;
-
-connection default;
-SET DEBUG_SYNC= 'RESET';
-
---echo # Test 2: DROP PROCEDURE
-
-connection default;
---echo # Start DROP PROCEDURE and open tables
-SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL table_opened WAIT_FOR grlwait';
---send DROP PROCEDURE p1
-
-connection con2;
-SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
---echo # Check that FLUSH must wait to get the GRL
---echo # and let DROP PROCEDURE continue
-SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait';
---send FLUSH TABLES WITH READ LOCK
-
-connection default;
---echo # Once FLUSH TABLES WITH READ LOCK starts waiting
---echo # DROP PROCEDURE will be waked up and will drop
---echo # procedure. Global read lock will be granted after
---echo # this statement ends.
---echo #
---echo # Reaping DROP PROCEDURE.
---reap
-
-connection con2;
---echo # Reaping FTWRL.
---reap
-UNLOCK TABLES;
-
-connection default;
-SET DEBUG_SYNC= 'RESET';
-
-disconnect con2;
-
-
---echo #
---echo # Bug#50786 Assertion `thd->mdl_context.trans_sentinel() == __null'
---echo # failed in open_ltable()
---echo #
-
---echo # Supress warnings written to the log file
-call mtr.add_suppression("Wait on a lock was aborted due to a pending exclusive lock");
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-connect (con1,localhost,root);
-connect (con2,localhost,root);
-connect (con3,localhost,root);
-connection default;
-
-CREATE TABLE t1 (i INT);
-CREATE TABLE t2 (i INT);
-
-SET @old_general_log= @@global.general_log;
-SET @@global.general_log= 1;
-
-SET @old_log_output= @@global.log_output;
-SET @@global.log_output= 'TABLE';
-
-SET @old_sql_log_off= @@session.sql_log_off;
-SET @@session.sql_log_off= 1;
-
---echo # connection: con1
-connection con1;
-HANDLER t1 OPEN;
-
---echo # connection: con3
-connection con3;
-SET @@session.sql_log_off= 1;
-
---echo # connection: con2
-connection con2;
-SET DEBUG_SYNC= 'thr_multi_lock_after_thr_lock SIGNAL parked WAIT_FOR go';
-
-# The below statement will block on the debug sync point
-# after it gets write lock on mysql.general_log table.
---echo # Sending:
---send SELECT 1
-
---echo # connection: con3
-connection con3;
-SET DEBUG_SYNC= 'now WAIT_FOR parked';
-
---echo # connection: con1
-connection con1;
-# This statement will block in open_ltable() when
-# trying to write into mysql.general_log.
---echo # Sending:
---send SELECT 1
-
---echo # connection: con3
-connection con3;
-let $wait_condition=
- SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for table level lock" and info = "SELECT 1";
---source include/wait_condition.inc
-# The ALTER below will try to abort the statement in connection con1,
-# since the latter waits on a table-level lock while having a HANDLER
-# open. This will cause mysql_lock_tables() in con1 fail which before
-# triggered the assert.
-ALTER TABLE t1 ADD COLUMN j INT;
-
---echo # connection: default
-connection default;
-SET DEBUG_SYNC= 'now SIGNAL go';
-
---echo # connection: con1
-connection con1;
---echo # Reaping SELECT 1
---reap
-HANDLER t1 CLOSE;
-
---echo # connection: con2
-connection con2;
---echo # Reaping SELECT 1
---reap
-
---echo # connection: default
-connection default;
-DROP TABLE t1, t2;
-SET DEBUG_SYNC= 'RESET';
-disconnect con1;
-disconnect con2;
-disconnect con3;
-SET @@global.general_log= @old_general_log;
-SET @@global.log_output= @old_log_output;
-SET @@session.sql_log_off= @old_sql_log_off;
-
-
---echo #
---echo # Additional coverage for bug #50913 "Deadlock between
---echo # open_and_lock_tables_derived and MDL". The main test
---echo # case is in lock_multi.test
---echo #
---disable_warnings
-drop table if exists t1;
---enable_warnings
-set debug_sync= 'RESET';
-connect (con50913_1,localhost,root);
-connect (con50913_2,localhost,root);
-connection default;
-create table t1 (i int) engine=InnoDB;
-
-connection con50913_1;
-set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL parked WAIT_FOR go';
---echo # Sending:
---send alter table t1 add column j int, ALGORITHM=COPY
-
-connection default;
---echo # Wait until ALTER TABLE gets blocked on a sync point after
---echo # acquiring thr_lock.c lock.
-set debug_sync= 'now WAIT_FOR parked';
---echo # The below statement should wait on MDL lock and not deadlock on
---echo # thr_lock.c lock.
---echo # Sending:
---send truncate table t1
-
-connection con50913_2;
---echo # Wait until TRUNCATE TABLE is blocked on MDL lock.
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "truncate table t1";
---source include/wait_condition.inc
---echo # Unblock ALTER TABLE.
-set debug_sync= 'now SIGNAL go';
-
-connection con50913_1;
---echo # Reaping ALTER TABLE.
---reap
-
-connection default;
---echo # Reaping TRUNCATE TABLE.
---reap
-disconnect con50913_1;
-disconnect con50913_2;
-set debug_sync= 'RESET';
-drop table t1;
-
-
---echo #
---echo # Test for bug #50998 "Deadlock in MDL code during test
---echo # rqg_mdl_stability".
---echo # Also provides coverage for the case when addition of
---echo # waiting statement adds several loops in the waiters
---echo # graph and therefore several searches for deadlock
---echo # should be performed.
---disable_warnings
-drop table if exists t1;
---enable_warnings
-set debug_sync= 'RESET';
-connect (con1,localhost,root);
-connect (con2,localhost,root);
-connect (con3,localhost,root);
-connection default;
-create table t1 (i int);
-
-connection con1;
-begin;
-select * from t1;
-
-connection con2;
-begin;
-select * from t1;
-
-connection default;
---echo # Start ALTER TABLE which will acquire SNW lock and
---echo # table lock and get blocked on sync point.
-set debug_sync= 'alter_table_copy_after_lock_upgrade SIGNAL parked WAIT_FOR go';
---echo # Sending:
---send alter table t1 add column j int
-
-connection con1;
---echo # Wait until ALTER TABLE gets blocked on a sync point.
-set debug_sync= 'now WAIT_FOR parked';
---echo # Sending:
---send insert into t1 values (1)
-
-connection con2;
---echo # Sending:
---send insert into t1 values (1)
-
-connection con3;
---echo # Wait until both 'con1' and 'con2' are blocked trying to acquire
---echo # SW lock on the table.
-let $wait_condition=
- select count(*) = 2 from information_schema.processlist
- where state = "Waiting for table metadata lock" and
- info = "insert into t1 values (1)";
---source include/wait_condition.inc
---echo # Unblock ALTER TABLE. Since it will try to upgrade SNW to X lock
---echo # deadlock with two loops in waiting graph will occur. Both loops
---echo # should be found and DML statements in both 'con1' and 'con2'
---echo # should be aborted with ER_LOCK_DEADLOCK errors.
-set debug_sync= 'now SIGNAL go';
-
-connection con1;
---echo # Reaping INSERT. It should end with ER_LOCK_DEADLOCK error and
---echo # not wait indefinitely (as it happened before the bugfix).
---error ER_LOCK_DEADLOCK
---reap
-commit;
-
-connection con2;
---echo # Reaping INSERT.
---error ER_LOCK_DEADLOCK
---reap
-commit;
-
-connection default;
---echo # Reap ALTER TABLE.
---reap
-
-disconnect con1;
-disconnect con2;
-disconnect con3;
-connection default;
-set debug_sync= 'RESET';
-drop table t1;
-
---echo #
---echo # Bug#42643: InnoDB does not support replication of TRUNCATE TABLE
---echo #
---echo # Ensure that a acquired lock is not given up due to a conflict.
---echo #
-
-connect (con1,localhost,root,,test,,);
-connect (con2,localhost,root,,test,,);
-connect (con3,localhost,root,,test,,);
-
-connection default;
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (a INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1),(2),(3);
-
-connection con1;
-LOCK TABLES t1 WRITE;
-SET debug_sync='upgrade_lock_for_truncate SIGNAL parked_truncate WAIT_FOR go_truncate';
-send TRUNCATE TABLE t1;
-
-connection default;
-SET debug_sync='now WAIT_FOR parked_truncate';
-
-connection con2;
-SET debug_sync='after_open_table_ignore_flush SIGNAL parked_show WAIT_FOR go_show';
-send SHOW FIELDS FROM t1;
-
-connection default;
-SET debug_sync='now WAIT_FOR parked_show';
-
-connection con3;
-SET debug_sync='after_flush_unlock SIGNAL parked_flush WAIT_FOR go_flush';
-send FLUSH TABLES t1;
-
-connection default;
-SET debug_sync='now WAIT_FOR parked_flush';
-SET debug_sync='now SIGNAL go_truncate';
---echo # Ensure that truncate waits for a exclusive lock
-let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for table metadata lock' AND info='TRUNCATE TABLE t1';
---source include/wait_condition.inc
-SET debug_sync= 'now SIGNAL go_show';
-
-connection con1;
---echo # Reaping...
-reap;
-UNLOCK TABLES;
-
-connection con2;
---echo # Reaping...
-reap;
-
-connection default;
-SET debug_sync= 'now SIGNAL go_flush';
-
-connection con3;
---echo # Reaping...
-reap;
-
-disconnect con1;
-disconnect con2;
-disconnect con3;
-
-connection default;
-SET debug_sync= 'RESET';
-DROP TABLE t1;
-
-
---echo #
---echo # Bug#52856 concurrent show columns or show full columns causes a crash!!!
---echo #
-CREATE TABLE t1(a CHAR(255));
-
-connect(con1, localhost, root);
-SET DEBUG_SYNC= "get_schema_column SIGNAL waiting WAIT_FOR completed";
---send SHOW FULL COLUMNS FROM t1
-
-connection default;
-SET DEBUG_SYNC= "now WAIT_FOR waiting";
---replace_column 8 #
-SHOW FULL COLUMNS FROM t1;
-SET DEBUG_SYNC= "now SIGNAL completed";
---replace_column 8 #
-connection con1;
---reap
-connection default;
-DROP TABLE t1;
-disconnect con1;
-
-
---echo #
---echo # Tests for schema-scope locks
---echo #
-
---disable_warnings
-DROP DATABASE IF EXISTS db1;
-DROP DATABASE IF EXISTS db2;
---enable_warnings
-
-connect (con2, localhost, root);
-connect (con3, localhost, root);
-
---echo # Test 1:
---echo # CREATE DATABASE blocks database DDL on the same database, but
---echo # not database DDL on different databases. Tests X vs X lock.
---echo #
-
-connection default;
-SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
---echo # Sending:
---send CREATE DATABASE db1
-
-connection con2;
-SET DEBUG_SYNC= 'now WAIT_FOR locked';
---echo # Sending:
-# This should block.
---send CREATE DATABASE db1
-
-connection con3;
-let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for schema metadata lock' AND info='CREATE DATABASE db1';
---source include/wait_condition.inc
-# This should not block.
-CREATE DATABASE db2;
-ALTER DATABASE db2 DEFAULT CHARACTER SET utf8;
-DROP DATABASE db2;
-SET DEBUG_SYNC= 'now SIGNAL blocked';
-
-connection default;
---echo # Reaping: CREATE DATABASE db1
---reap
-
-connection con2;
---echo # Reaping: CREATE DATABASE db1
---error ER_DB_CREATE_EXISTS
---reap
-
---echo # Test 2:
---echo # ALTER DATABASE blocks database DDL on the same database, but
---echo # not database DDL on different databases. Tests X vs X lock.
---echo #
-
-connection default;
-SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
---echo # Sending:
---send ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
-
-connection con2;
-SET DEBUG_SYNC= 'now WAIT_FOR locked';
---echo # Sending:
-# This should block.
---send ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
-
-connection con3;
-let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for schema metadata lock'
- AND info='ALTER DATABASE db1 DEFAULT CHARACTER SET utf8';
---source include/wait_condition.inc
-# This should not block.
-CREATE DATABASE db2;
-ALTER DATABASE db2 DEFAULT CHARACTER SET utf8;
-DROP DATABASE db2;
-SET DEBUG_SYNC= 'now SIGNAL blocked';
-
-connection default;
---echo # Reaping: ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
---reap
-
-connection con2;
---echo # Reaping: ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
---reap
-
-connection default;
-SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
---echo # Sending:
---send ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
-
-connection con2;
-SET DEBUG_SYNC= 'now WAIT_FOR locked';
---echo # Sending:
-# This should also block.
---send DROP DATABASE db1
-
-connection con3;
-let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for schema metadata lock' AND info='DROP DATABASE db1';
---source include/wait_condition.inc
-SET DEBUG_SYNC= 'now SIGNAL blocked';
-
-connection default;
---echo # Reaping: ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
---reap
-
-connection con2;
---echo # Reaping: DROP DATABASE db1
---reap
-# Recreate the database
-CREATE DATABASE db1;
-
---echo # Test 3:
---echo # Two ALTER..UPGRADE of the same database are mutually exclusive, but
---echo # two ALTER..UPGRADE of different databases are not. Tests X vs X lock.
---echo #
-
-let $MYSQLD_DATADIR= `select @@datadir`;
-# Manually make a 5.0 database from the template
---mkdir $MYSQLD_DATADIR/a-b-c
---copy_file $MYSQLD_DATADIR/db1/db.opt $MYSQLD_DATADIR/a-b-c/db.opt
---mkdir $MYSQLD_DATADIR/a-b-c-d
---copy_file $MYSQLD_DATADIR/db1/db.opt $MYSQLD_DATADIR/a-b-c-d/db.opt
-
-connection default;
-SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
---echo # Sending:
---send ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME
-
-connection con2;
-SET DEBUG_SYNC= 'now WAIT_FOR locked';
---echo # Sending:
-# This should block.
---send ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME
-
-connection con3;
-let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for schema metadata lock'
- AND info='ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME';
---source include/wait_condition.inc
-# This should not block.
-ALTER DATABASE `#mysql50#a-b-c-d` UPGRADE DATA DIRECTORY NAME;
-SET DEBUG_SYNC= 'now SIGNAL blocked';
-
-connection default;
---echo # Reaping: ALTER DATABASE '#mysql50#a-b-c' UPGRADE DATA DIRECTORY NAME
---reap
-
-connection con2;
---echo # Reaping: ALTER DATABASE '#mysql50#a-b-c' UPGRADE DATA DIRECTORY NAME
---error ER_BAD_DB_ERROR
---reap
-DROP DATABASE `a-b-c`;
-DROP DATABASE `a-b-c-d`;
-
---echo # Test 4:
---echo # DROP DATABASE blocks database DDL on the same database, but
---echo # not database DDL on different databases. Tests X vs X lock.
---echo #
-
-connection default;
-SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
---echo # Sending:
---send DROP DATABASE db1
-
-connection con2;
-SET DEBUG_SYNC= 'now WAIT_FOR locked';
---echo # Sending:
-# This should block.
---send DROP DATABASE db1
-
-connection con3;
-let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for schema metadata lock' AND info='DROP DATABASE db1';
---source include/wait_condition.inc
-# This should not block.
-CREATE DATABASE db2;
-ALTER DATABASE db2 DEFAULT CHARACTER SET utf8;
-DROP DATABASE db2;
-SET DEBUG_SYNC= 'now SIGNAL blocked';
-
-connection default;
---echo # Reaping: DROP DATABASE db1
---reap
-
-connection con2;
---echo # Reaping: DROP DATABASE db1
---error ER_DB_DROP_EXISTS
---reap
-
-connection default;
-CREATE DATABASE db1;
-SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
---echo # Sending:
---send DROP DATABASE db1
-
-connection con2;
-SET DEBUG_SYNC= 'now WAIT_FOR locked';
---echo # Sending:
-# This should also block.
---send ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
-
-connection con3;
-let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for schema metadata lock'
- AND info='ALTER DATABASE db1 DEFAULT CHARACTER SET utf8';
---source include/wait_condition.inc
-SET DEBUG_SYNC= 'now SIGNAL blocked';
-
-connection default;
---echo # Reaping: DROP DATABASE db1
---reap
-
-connection con2;
---echo # Reaping: ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
-# Error 1 is from ALTER DATABASE when the database does not exist.
-# Listing the error twice to prevent result diffences based on filename.
---error 1,1
---reap
-
-
---echo # Test 5:
---echo # Locked database name prevents CREATE of tables in that database.
---echo # Tests X vs IX lock.
---echo #
-
-connection default;
-CREATE DATABASE db1;
-SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
---echo # Sending:
---send DROP DATABASE db1
-
-connection con2;
-SET DEBUG_SYNC= 'now WAIT_FOR locked';
---echo # Sending:
-# This should block.
---send CREATE TABLE db1.t1 (a INT)
-
-connection con3;
-let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for schema metadata lock' AND
- info='CREATE TABLE db1.t1 (a INT)';
---source include/wait_condition.inc
-SET DEBUG_SYNC= 'now SIGNAL blocked';
-
-connection default;
---echo # Reaping: DROP DATABASE db1
---reap
-
-connection con2;
---echo # Reaping: CREATE TABLE db1.t1 (a INT)
---error ER_BAD_DB_ERROR
---reap
-
---echo # Test 6:
---echo # Locked database name prevents RENAME of tables to/from that database.
---echo # Tests X vs IX lock.
---echo #
-
-connection default;
-CREATE DATABASE db1;
-CREATE TABLE db1.t1 (a INT);
-SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
---echo # Sending:
---send DROP DATABASE db1
-
-connection con2;
-SET DEBUG_SYNC= 'now WAIT_FOR locked';
---echo # Sending:
-# This should block.
---send RENAME TABLE db1.t1 TO test.t1
-
-connection con3;
-let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for schema metadata lock' AND
- info='RENAME TABLE db1.t1 TO test.t1';
---source include/wait_condition.inc
-SET DEBUG_SYNC= 'now SIGNAL blocked';
-
-connection default;
---echo # Reaping: DROP DATABASE db1
---reap
-
-connection con2;
---echo # Reaping: RENAME TABLE db1.t1 TO test.t1
---error ER_NO_SUCH_TABLE
---reap
-
-connection default;
-CREATE DATABASE db1;
-CREATE TABLE test.t2 (a INT);
-SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
---echo # Sending:
---send DROP DATABASE db1
-
-connection con2;
-SET DEBUG_SYNC= 'now WAIT_FOR locked';
---echo # Sending:
-# This should block.
---send RENAME TABLE test.t2 TO db1.t2
-
-connection con3;
-let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for schema metadata lock' AND
- info='RENAME TABLE test.t2 TO db1.t2';
---source include/wait_condition.inc
-SET DEBUG_SYNC= 'now SIGNAL blocked';
-
-connection default;
---echo # Reaping: DROP DATABASE db1
---reap
-
-connection con2;
---echo # Reaping: RENAME TABLE test.t2 TO db1.t2
-# Error 7 is from RENAME TABLE where the target database does not exist.
-# Listing the error twice to prevent result diffences based on filename.
---error 7, 7
---reap
-DROP TABLE test.t2;
-
-
---echo # Test 7:
---echo # Locked database name prevents DROP of tables in that database.
---echo # Tests X vs IX lock.
---echo #
-
-connection default;
-CREATE DATABASE db1;
-CREATE TABLE db1.t1 (a INT);
-SET DEBUG_SYNC= 'after_wait_locked_schema_name SIGNAL locked WAIT_FOR blocked';
---echo # Sending:
---send DROP DATABASE db1
-
-connection con2;
-SET DEBUG_SYNC= 'now WAIT_FOR locked';
---echo # Sending:
-# This should block.
---send DROP TABLE db1.t1
-
-connection con3;
-let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for schema metadata lock' AND info='DROP TABLE db1.t1';
---source include/wait_condition.inc
-SET DEBUG_SYNC= 'now SIGNAL blocked';
-
-connection default;
---echo # Reaping: DROP DATABASE db1
---reap
-
-connection con2;
---echo # Reaping: DROP TABLE db1.t1
---error ER_BAD_TABLE_ERROR
---reap
-
-connection default;
-disconnect con2;
-disconnect con3;
-SET DEBUG_SYNC= 'RESET';
-
---echo #
---echo # End of tests for schema-scope locks
---echo #
-
---echo #
---echo # Tests of granted global S lock (FLUSH TABLE WITH READ LOCK)
---echo #
-
-CREATE DATABASE db1;
-CREATE TABLE db1.t1(a INT);
-connect(con2, localhost, root);
-connect(con3, localhost, root);
-
-connection default;
-FLUSH TABLE WITH READ LOCK;
-
-connection con2;
-# IX global lock should block
---send CREATE TABLE db1.t2(a INT)
-
-connection default;
-let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for global read lock'
- AND info='CREATE TABLE db1.t2(a INT)';
---source include/wait_condition.inc
-UNLOCK TABLES;
-
-connection con2;
---echo # Reaping CREATE TABLE db1.t2(a INT)
---reap
-
-connection default;
-FLUSH TABLE WITH READ LOCK;
-
-connection con2;
-# X global lock should block
---send ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
-
-connection default;
-let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for global read lock'
- AND info='ALTER DATABASE db1 DEFAULT CHARACTER SET utf8';
---source include/wait_condition.inc
-UNLOCK TABLES;
-
-connection con2;
---echo # Reaping ALTER DATABASE db1 DEFAULT CHARACTER SET utf8
---reap
-
-connection default;
-FLUSH TABLE WITH READ LOCK;
-
-connection con2;
-# S global lock should not block
-FLUSH TABLE WITH READ LOCK;
-UNLOCK TABLES;
-
-connection default;
-UNLOCK TABLES;
-DROP DATABASE db1;
-disconnect con2;
-disconnect con3;
-
-
---echo #
---echo # Bug#56292 Deadlock with ALTER TABLE and MERGE tables
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2, m1;
---enable_warnings
-
-CREATE TABLE t1(a INT) engine=MyISAM;
-CREATE TABLE t2(a INT) engine=MyISAM;
-CREATE TABLE m1(a INT) engine=MERGE UNION=(t1, t2);
-
-INSERT INTO t1 VALUES (1), (2);
-INSERT INTO t2 VALUES (3), (4);
-
-connect(con1, localhost, root);
-connect(con2, localhost, root);
-connect(con3, localhost, root);
-
-connection con1;
---echo # We need EXECUTE 2 since ALTER TABLE does SU => SNW => X and we want
---echo # to stop at the second upgrade.
-SET DEBUG_SYNC= 'mdl_upgrade_lock SIGNAL upgrade WAIT_FOR continue EXECUTE 2';
---echo # Sending:
---send ALTER TABLE m1 engine=MERGE UNION=(t2, t1)
-
-connection con2;
---echo # Waiting for ALTER TABLE to try lock upgrade
-SET DEBUG_SYNC= 'now WAIT_FOR upgrade';
-SET DEBUG_SYNC= 'now SIGNAL continue';
-SET DEBUG_SYNC= 'now WAIT_FOR upgrade';
---echo # Sending:
---send DELETE FROM t2 WHERE a = 3
-
-connection con3;
---echo # Check that DELETE is waiting on a metadata lock and not a table lock.
-let $wait_condition=
- SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for table metadata lock" AND
- info = "DELETE FROM t2 WHERE a = 3";
---source include/wait_condition.inc
---echo # Now that DELETE blocks on a metadata lock, we should be able to do
---echo # SELECT * FROM m1 here. SELECT used to be blocked by a DELETE table
---echo # lock request.
---send SELECT * FROM m1 WHERE a < 3
-
-connection default;
---echo # Resuming ALTER TABLE
-SET DEBUG_SYNC= 'now SIGNAL continue';
-
-connection con1;
---echo # Reaping: ALTER TABLE m1 engine=MERGE UNION=(t2, t1)
---reap
-connection con2;
---echo # Reaping: DELETE FROM t2 WHERE a = 3
---reap
-connection con3;
---echo # Reaping: SELECT * FROM m1 WHERE a < 3
---reap
-connection default;
-DROP TABLE m1, t1, t2;
-SET DEBUG_SYNC= 'RESET';
-disconnect con1;
-disconnect con2;
-disconnect con3;
-
-
---echo #
---echo # MDEV-12620 - set lock_wait_timeout = 1;flush tables with read lock;
---echo # lock not released after timeout
---echo #
-CREATE TABLE t1(a INT) ENGINE=InnoDB;
-SET debug_sync='open_tables_after_open_and_process_table SIGNAL ready WAIT_FOR go';
-send SELECT * FROM t1;
-
-connect (con1,localhost,root,,);
-SET debug_sync='now WAIT_FOR ready';
-# lock_wait_timeout should be 0 in 10.3, so that we don't have to wait at all
-SET lock_wait_timeout=1;
---error ER_LOCK_WAIT_TIMEOUT
-FLUSH TABLES WITH READ LOCK;
-SET debug_sync='now SIGNAL go';
-
-connection default;
-reap;
-SET debug_sync='RESET';
-DROP TABLE t1;
-
-disconnect con1;
-
-
-# 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
diff --git a/mysql-test/t/merge-big.test b/mysql-test/t/merge-big.test
deleted file mode 100644
index 9bd2cab2c8a..00000000000
--- a/mysql-test/t/merge-big.test
+++ /dev/null
@@ -1,78 +0,0 @@
-#
-# Test of MERGE tables with multisession and many waits.
-#
-# This test takes rather long time so let us run it only in --big-test mode
---source include/big_test.inc
-# We use some debug-only features in this test
---source include/have_debug.inc
-# We use INFORMATION_SCHEMA.PROCESSLIST in this test
---source include/not_embedded.inc
-
---disable_warnings
-drop table if exists t1,t2,t3,t4,t5,t6;
---enable_warnings
-
---echo #
---echo # Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE
---echo # corrupts a MERGE table
---echo # Problem #3
---echo #
-# Two FLUSH TABLES within a LOCK TABLES segment could invalidate the lock.
-# This did *not* require a MERGE table.
-#
-# To increase reproducibility it was necessary to enter a sleep of 2
-# seconds at the end of wait_for_tables() after unlock of LOCK_open. In
-# 5.0 and 5.1 the sleep must be inserted in open_and_lock_tables() after
-# open_tables() instead. wait_for_tables() is not used in this case. The
-# problem was that FLUSH TABLES releases LOCK_open while having unlocked
-# and closed all tables. When this happened while a thread was in the
-# loop in mysql_lock_tables() right after wait_for_tables()
-# (open_tables()) and before retrying to lock, the thread got the lock.
-# And it did not notice that the table needed a refresh after the
-# [re-]open. So it executed its statement on the table.
-#
-# The first FLUSH TABLES kicked the INSERT out of thr_multi_lock() and
-# let it wait in wait_for_tables() (open_table()). The second FLUSH
-# TABLES must happen while the INSERT was on its way from
-# wait_for_tables() (open_table()) to the next call of thr_multi_lock().
-# This needed to be supported by a sleep to make it repeatable.
-#
-CREATE TABLE t1 (c1 INT) ENGINE= MyISAM;
-LOCK TABLE t1 WRITE;
-#SELECT NOW();
- connect (con1,localhost,root,,);
- let $con1_id= `SELECT CONNECTION_ID()`;
- SET @orig_debug=@@debug;
- SET GLOBAL debug_dbug="+d,sleep_open_and_lock_after_open";
- send INSERT INTO t1 VALUES (1);
-connection default;
---echo # Let INSERT go into thr_multi_lock().
-#--sleep 8
-#SELECT ID,STATE,INFO FROM INFORMATION_SCHEMA.PROCESSLIST;
-let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE ID = $con1_id AND STATE = 'Waiting for table metadata lock';
---source include/wait_condition.inc
-#SELECT NOW();
---echo # Kick INSERT out of thr_multi_lock().
-FLUSH TABLES;
-#SELECT NOW();
---echo # Let INSERT go through open_tables() where it sleeps.
-#--sleep 8
-#SELECT ID,STATE,INFO FROM INFORMATION_SCHEMA.PROCESSLIST;
-let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE ID = $con1_id AND STATE = 'Waiting for table metadata lock';
---source include/wait_condition.inc
-#SELECT NOW();
---echo # Unlock and close table and wait for con1 to close too.
-FLUSH TABLES;
-#SELECT NOW();
---echo # This should give no result.
-SELECT * FROM t1;
-#SELECT NOW();
-UNLOCK TABLES;
- connection con1;
- reap;
- SET GLOBAL debug_dbug=@orig_debug;
- disconnect con1;
-connection default;
-DROP TABLE t1;
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test
deleted file mode 100644
index edc4a364ad9..00000000000
--- a/mysql-test/t/merge.test
+++ /dev/null
@@ -1,2916 +0,0 @@
-#
-# Test of MERGE TABLES
-#
-
-# Save the initial number of concurrent sessions.
---source include/count_sessions.inc
-
-# MERGE tables require MyISAM tables
-let $default=`select @@global.storage_engine`;
-set global storage_engine=myisam;
-set session storage_engine=myisam;
-
-# Clean up resources used in this test case.
---disable_warnings
-drop table if exists t1,t2,t3,t4,t5,t6;
-drop database if exists mysqltest;
---enable_warnings
-
-let $MYSQLD_DATADIR= `select @@datadir`;
-
-create table t1 (a int not null primary key auto_increment, message char(20));
-create table t2 (a int not null primary key auto_increment, message char(20));
-INSERT INTO t1 (message) VALUES ("Testing"),("table"),("t1");
-INSERT INTO t2 (message) VALUES ("Testing"),("table"),("t2");
-create table t3 (a int not null, b char(20), key(a)) engine=MERGE UNION=(t1,t2);
-select * from t3;
-select * from t3 order by a desc;
-drop table t3;
-insert into t1 select NULL,message from t2;
-insert into t2 select NULL,message from t1;
-insert into t1 select NULL,message from t2;
-insert into t2 select NULL,message from t1;
-insert into t1 select NULL,message from t2;
-insert into t2 select NULL,message from t1;
-insert into t1 select NULL,message from t2;
-insert into t2 select NULL,message from t1;
-insert into t1 select NULL,message from t2;
-insert into t2 select NULL,message from t1;
-insert into t1 select NULL,message from t2;
-create table t3 (a int not null, b char(20), key(a)) engine=MERGE UNION=(test.t1,test.t2);
-explain select * from t3 where a < 10;
-explain select * from t3 where a > 10 and a < 20;
-select * from t3 where a = 10;
-select * from t3 where a < 10;
-select * from t3 where a > 10 and a < 20;
-explain select a from t3 order by a desc limit 10;
-select a from t3 order by a desc limit 10;
-select a from t3 order by a desc limit 300,10;
-delete from t3 where a=3;
-select * from t3 where a < 10;
-delete from t3 where a >= 6 and a <= 8;
-select * from t3 where a < 10;
-update t3 set a=3 where a=9;
-select * from t3 where a < 10;
-update t3 set a=6 where a=7;
-select * from t3 where a < 10;
-show create table t3;
-
-# The following should give errors
-create table t4 (a int not null, b char(10), key(a)) engine=MERGE UNION=(t1,t2);
---error 1168
-select * from t4;
---error 1168
-alter table t4 add column c int;
-flush tables;
---error 1168
-select * from t4;
-
-#
-# Test tables in different databases
-#
-create database mysqltest;
-create table mysqltest.t6 (a int not null primary key auto_increment, message char(20));
-create table t5 (a int not null, b char(20), key(a)) engine=MERGE UNION=(test.t1,mysqltest.t6);
-show create table t5;
-alter table t5 engine=myisam;
-drop table t5, mysqltest.t6;
-drop database mysqltest;
-
-# Because of windows, it's important that we drop the merge tables first!
-drop table t4,t3,t1,t2;
-
-create table t1 (c char(10)) engine=myisam;
-create table t2 (c char(10)) engine=myisam;
-create table t3 (c char(10)) union=(t1,t2) engine=merge;
-insert into t1 (c) values ('test1');
-insert into t1 (c) values ('test1');
-insert into t1 (c) values ('test1');
-insert into t2 (c) values ('test2');
-insert into t2 (c) values ('test2');
-insert into t2 (c) values ('test2');
-select * from t3;
-select * from t3;
-delete from t3 where 1=1;
-select * from t3;
-select * from t1;
-drop table t3,t2,t1;
-
-#
-# Test 2
-#
-
-CREATE TABLE t1 (incr int not null, othr int not null, primary key(incr));
-CREATE TABLE t2 (incr int not null, othr int not null, primary key(incr));
-CREATE TABLE t3 (incr int not null, othr int not null, primary key(incr))
-ENGINE=MERGE UNION=(t1,t2);
-
-SELECT * from t3;
-
-INSERT INTO t1 VALUES ( 1,10),( 3,53),( 5,21),( 7,12),( 9,17);
-INSERT INTO t2 VALUES ( 2,24),( 4,33),( 6,41),( 8,26),( 0,32);
-INSERT INTO t1 VALUES (11,20),(13,43),(15,11),(17,22),(19,37);
-INSERT INTO t2 VALUES (12,25),(14,31),(16,42),(18,27),(10,30);
-
-SELECT * from t3 where incr in (1,2,3,4) order by othr;
-alter table t3 UNION=(t1);
-select count(*) from t3;
-alter table t3 UNION=(t1,t2);
-select count(*) from t3;
-alter table t3 ENGINE=MYISAM;
-select count(*) from t3;
-
-# Test that ALTER TABLE rembers the old UNION
-
-drop table t3;
-CREATE TABLE t3 (incr int not null, othr int not null, primary key(incr))
-ENGINE=MERGE UNION=(t1,t2);
-show create table t3;
-alter table t3 drop primary key;
-show create table t3;
-
-drop table t3,t2,t1;
-
-#
-# Test table without unions
-#
-create table t1 (a int not null, key(a)) engine=merge;
-select * from t1;
-drop table t1;
-
-#
-# Bug in flush tables combined with MERGE tables
-#
-
-create table t1 (a int not null, b int not null, key(a,b));
-create table t2 (a int not null, b int not null, key(a,b));
-create table t3 (a int not null, b int not null, key(a,b)) ENGINE=MERGE UNION=(t1,t2);
-insert into t1 values (1,2),(2,1),(0,0),(4,4),(5,5),(6,6);
-insert into t2 values (1,1),(2,2),(0,0),(4,4),(5,5),(6,6);
-flush tables;
-select * from t3 where a=1 order by b limit 2;
-drop table t3,t1,t2;
-
-#
-# [phi] testing INSERT_METHOD stuff
-#
-
-# first testing of common stuff with new parameters
-create table t1 (a int not null, b int not null auto_increment, primary key(a,b));
-create table t2 (a int not null, b int not null auto_increment, primary key(a,b));
-create table t3 (a int not null, b int not null, key(a,b)) UNION=(t1,t2) INSERT_METHOD=NO;
-create table t4 (a int not null, b int not null, key(a,b)) ENGINE=MERGE UNION=(t1,t2) INSERT_METHOD=NO;
-create table t5 (a int not null, b int not null auto_increment, primary key(a,b)) ENGINE=MERGE UNION=(t1,t2) INSERT_METHOD=FIRST;
-create table t6 (a int not null, b int not null auto_increment, primary key(a,b)) ENGINE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST;
-show create table t3;
-show create table t4;
-show create table t5;
-show create table t6;
-insert into t1 values (1,NULL),(1,NULL),(1,NULL),(1,NULL);
-insert into t2 values (2,NULL),(2,NULL),(2,NULL),(2,NULL);
-select * from t3 order by b,a limit 3;
-select * from t4 order by b,a limit 3;
-select * from t5 order by b,a limit 3,3;
-select * from t6 order by b,a limit 6,3;
-# now testing inserts and where the data gets written
-insert into t5 values (5,1),(5,2);
-insert into t6 values (6,1),(6,2);
-select * from t1 order by a,b;
-select * from t2 order by a,b;
-select * from t4 order by a,b;
-# preperation for next test
-insert into t3 values (3,1),(3,2),(3,3),(3,4);
-select * from t3 order by a,b;
-# now testing whether options are kept by alter table
-alter table t4 UNION=(t1,t2,t3);
-show create table t4;
-select * from t4 order by a,b;
-# testing switching off insert method and inserts again
-alter table t4 INSERT_METHOD=FIRST;
-show create table t4;
-insert into t4 values (4,1),(4,2);
-select * from t1 order by a,b;
-select * from t2 order by a,b;
-select * from t3 order by a,b;
-select * from t4 order by a,b;
-select * from t5 order by a,b;
-# auto_increment
-select 1;
-insert into t5 values (1,NULL),(5,NULL);
-insert into t6 values (2,NULL),(6,NULL);
-select * from t1 order by a,b;
-select * from t2 order by a,b;
-select * from t5 order by a,b;
-select * from t6 order by a,b;
-insert into t1 values (99,NULL);
-select * from t4 where a+0 > 90;
-# bug#4008 - cannot determine a unique key that caused "dupl. key error"
---error ER_DUP_ENTRY
-insert t5 values (1,1);
---error ER_DUP_ENTRY
-insert t6 values (2,1);
-insert t5 values (1,1) on duplicate key update b=b+10;
-insert t6 values (2,1) on duplicate key update b=b+20;
-select * from t5 where a < 3;
-drop table t6, t5, t4, t3, t2, t1;
-
-CREATE TABLE t1 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,1), (2,1);
-CREATE TABLE t2 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (1,2), (2,2);
-CREATE TABLE t3 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', KEY a (a,b)) ENGINE=MRG_MyISAM UNION=(t1,t2);
-select max(b) from t3 where a = 2;
-select max(b) from t1 where a = 2;
-drop table t3,t1,t2;
-
-#
-# temporary merge tables
-#
-create table t1 (a int not null);
-create table t2 (a int not null);
-insert into t1 values (1);
-insert into t2 values (2);
-create temporary table t3 (a int not null) ENGINE=MERGE UNION=(t1,t2);
-select * from t3;
-create temporary table t4 (a int not null);
-create temporary table t5 (a int not null);
-insert into t4 values (1);
-insert into t5 values (2);
-create temporary table t6 (a int not null) ENGINE=MERGE UNION=(t4,t5);
-select * from t6;
-drop table t6, t3, t1, t2, t4, t5;
-#
-# Bug#19627 - temporary merge table locking
-# MERGE table and its children must match in temporary type.
-# Forbid temporary merge on non-temporary children: shown above.
-# Forbid non-temporary merge on temporary children:
-create temporary table t1 (a int not null);
-create temporary table t2 (a int not null);
-insert into t1 values (1);
-insert into t2 values (2);
-create table t3 (a int not null) ENGINE=MERGE UNION=(t1,t2);
---error ER_WRONG_MRG_TABLE
-select * from t3;
-drop table t3, t2, t1;
-# Forbid children mismatch in temporary:
-create table t1 (a int not null);
-create temporary table t2 (a int not null);
-insert into t1 values (1);
-insert into t2 values (2);
-create table t3 (a int not null) ENGINE=MERGE UNION=(t1,t2);
---error ER_WRONG_MRG_TABLE
-select * from t3;
-drop table t3;
-create temporary table t3 (a int not null) ENGINE=MERGE UNION=(t1,t2);
-select * from t3;
-drop table t3, t2, t1;
---echo # CREATE...SELECT is not implemented for MERGE tables.
-CREATE TEMPORARY TABLE t1 (c1 INT NOT NULL);
-CREATE TEMPORARY TABLE t2 (c1 INT NOT NULL);
-CREATE TABLE t3 (c1 INT NOT NULL);
-INSERT INTO t3 VALUES (3), (33);
-LOCK TABLES t3 READ;
---error ER_WRONG_OBJECT
-CREATE TEMPORARY TABLE t4 (c1 INT NOT NULL) ENGINE=MERGE UNION=(t1,t2)
- INSERT_METHOD=LAST SELECT * FROM t3;
---error ER_TABLE_NOT_LOCKED
-SELECT * FROM t4;
-UNLOCK TABLES;
-CREATE TEMPORARY TABLE t4 (c1 INT NOT NULL) ENGINE=MERGE UNION=(t1,t2)
- INSERT_METHOD=LAST;
-INSERT INTO t4 SELECT * FROM t3;
---echo # Alter temporary MERGE table.
-ALTER TABLE t4 UNION=(t1);
-LOCK TABLES t4 WRITE;
---echo # Alter temporary MERGE table under LOCk tables.
-ALTER TABLE t4 UNION=(t1,t2);
-UNLOCK TABLES;
---echo # MERGE table and function.
-CREATE FUNCTION f1 () RETURNS INT RETURN (SELECT max(c1) FROM t3);
-SELECT * FROM t4 WHERE c1 < f1();
-DROP FUNCTION f1;
-DROP TABLE t4, t3, t2, t1;
-
-#
-# testing merge::records_in_range and optimizer
-#
-
-CREATE TABLE t1 (
- fileset_id tinyint(3) unsigned NOT NULL default '0',
- file_code varchar(32) NOT NULL default '',
- fileset_root_id tinyint(3) unsigned NOT NULL default '0',
- PRIMARY KEY (fileset_id,file_code),
- KEY files (fileset_id,fileset_root_id)
-) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (2, '0000000111', 1), (2, '0000000112', 1), (2, '0000000113', 1),
-(2, '0000000114', 1), (2, '0000000115', 1), (2, '0000000116', 1), (2, '0000000117', 1),
-(2, '0000000118', 1), (2, '0000000119', 1), (2, '0000000120', 1);
-CREATE TABLE t2 (
- fileset_id tinyint(3) unsigned NOT NULL default '0',
- file_code varchar(32) NOT NULL default '',
- fileset_root_id tinyint(3) unsigned NOT NULL default '0',
- PRIMARY KEY (fileset_id,file_code),
- KEY files (fileset_id,fileset_root_id)
-) ENGINE=MRG_MyISAM UNION=(t1);
-
-EXPLAIN SELECT * FROM t2 IGNORE INDEX (files) WHERE fileset_id = 2
-AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1;
-EXPLAIN SELECT * FROM t2 WHERE fileset_id = 2
-AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1;
-EXPLAIN SELECT * FROM t1 WHERE fileset_id = 2
-AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1;
-EXPLAIN SELECT * FROM t2 WHERE fileset_id = 2
-AND file_code = '0000000115' LIMIT 1;
-DROP TABLE t2, t1;
-
-#
-# Test of ORDER BY DESC on key (Bug #515)
-#
-
-create table t1 (x int, y int, index xy(x, y));
-create table t2 (x int, y int, index xy(x, y));
-create table t3 (x int, y int, index xy(x, y)) engine=merge union=(t1,t2);
-insert into t1 values(1, 2);
-insert into t2 values(1, 3);
-select * from t3 where x = 1 and y < 5 order by y;
-# Bug is that followng query returns empty set while it must be same as above
-select * from t3 where x = 1 and y < 5 order by y desc;
-drop table t1,t2,t3;
-
-#
-# Bug#5232: CREATE TABLE ... SELECT
-#
-
-create table t1 (a int);
-create table t2 (a int);
-insert into t1 values (0);
-insert into t2 values (1);
---error ER_WRONG_OBJECT
-create table t3 engine=merge union=(t1, t2) select * from t1;
---error ER_WRONG_OBJECT
-create table t3 engine=merge union=(t1, t2) select * from t2;
---error ER_WRONG_OBJECT
-create table t3 engine=merge union=(t1, t2) select (select max(a) from t2);
-drop table t1, t2;
-
-#
-# Bug#9112 - Merge table with composite index producing invalid results with some queries
-# This test case will fail only without the bugfix and some
-# non-deterministic circumstances. It depends on properly initialized
-# "un-initialized" memory. At the time it happens with a standard
-# non-debug build. But there is no guarantee that this will be always so.
-#
-create table t1 (
- a double(14,4),
- b varchar(10),
- index (a,b)
-) engine=merge union=(t2,t3);
-
-create table t2 (
- a double(14,4),
- b varchar(10),
- index (a,b)
-) engine=myisam;
-
-create table t3 (
- a double(14,4),
- b varchar(10),
- index (a,b)
-) engine=myisam;
-
-insert into t2 values ( null, '');
-insert into t2 values ( 9999999999.999, '');
-insert into t3 select * from t2;
-select min(a), max(a) from t1;
-flush tables;
-select min(a), max(a) from t1;
-drop table t1, t2, t3;
-# BUG#6699 : no sorting on 'ref' retrieval
-create table t1 (a int,b int,c int, index (a,b,c));
-create table t2 (a int,b int,c int, index (a,b,c));
-create table t3 (a int,b int,c int, index (a,b,c))
- engine=merge union=(t1 ,t2);
-insert into t1 (a,b,c) values (1,1,0),(1,2,0);
-insert into t2 (a,b,c) values (1,1,1),(1,2,1);
-
-explain select a,b,c from t3 force index (a) where a=1 order by a,b,c;
-select a,b,c from t3 force index (a) where a=1 order by a,b,c;
-
-# this actually wasn't affected:
-explain select a,b,c from t3 force index (a) where a=1 order by a desc, b desc, c desc;
-select a,b,c from t3 force index (a) where a=1 order by a desc, b desc, c desc;
-
-# BUG#7377 SHOW index on MERGE table crashes debug server
-show index from t3;
-
-drop table t1, t2, t3;
-
-#
-# Bug#10400 - Improperly-defined MERGE table crashes with INSERT ... ON DUPLICATE KEY UPDATE
-#
-CREATE TABLE t1 ( a INT AUTO_INCREMENT PRIMARY KEY, b VARCHAR(10), UNIQUE (b) )
- ENGINE=MyISAM;
-CREATE TABLE t2 ( a INT AUTO_INCREMENT, b VARCHAR(10), INDEX (a), INDEX (b) )
- ENGINE=MERGE UNION (t1) INSERT_METHOD=FIRST;
-INSERT INTO t2 (b) VALUES (1) ON DUPLICATE KEY UPDATE b=2;
-INSERT INTO t2 (b) VALUES (1) ON DUPLICATE KEY UPDATE b=3;
-SELECT b FROM t2;
-DROP TABLE t1, t2;
-
-
-#
-# BUG#5390 - problems with merge tables
-# Problem #1: INSERT...SELECT
-#
-#drop table if exists t1, t2, t3;
-create table t1(a int);
-create table t2(a int);
-insert into t1 values (1);
-insert into t2 values (2);
-create table t3 (a int) engine=merge union=(t1, t2) insert_method=first;
-select * from t3;
-#
-insert t2 select * from t2;
-select * from t2;
-#
-insert t3 select * from t1;
-select * from t3;
-#
-insert t1 select * from t3;
-select * from t1;
-select * from t2;
-select * from t3;
-check table t1, t2;
-drop table t1, t2, t3;
-
-#
-# BUG#21617 - crash when selecting from merge table with inconsistent
-# indexes
-#
-CREATE TABLE t1(a INT);
-INSERT INTO t1 VALUES(2),(1);
-CREATE TABLE t2(a INT, KEY(a)) ENGINE=MERGE UNION=(t1);
---error 1168
-SELECT * FROM t2 WHERE a=2;
-DROP TABLE t1, t2;
-
-#
-# BUG#10974 - No error message if merge table based on union of innodb,
-# memory
-#
-CREATE TABLE t1(a INT) ENGINE=MEMORY;
-CREATE TABLE t2(a INT) ENGINE=MERGE UNION=(t1);
---error 1168
-SELECT * FROM t2;
-DROP TABLE t1, t2;
-CREATE TABLE t2(a INT) ENGINE=MERGE UNION=(t3);
---error ER_WRONG_MRG_TABLE
-SELECT * FROM t2;
-DROP TABLE t2;
-
-#
-# Underlying table definition conformance tests.
-#
-CREATE TABLE t1(a INT, b TEXT);
-CREATE TABLE tm1(a TEXT, b INT) ENGINE=MERGE UNION=(t1);
---error 1168
-SELECT * FROM tm1;
-DROP TABLE t1, tm1;
-
-CREATE TABLE t1(a SMALLINT, b SMALLINT);
-CREATE TABLE tm1(a INT) ENGINE=MERGE UNION=(t1);
---error 1168
-SELECT * FROM tm1;
-DROP TABLE t1, tm1;
-
-CREATE TABLE t1(a SMALLINT, b SMALLINT, KEY(a, b));
-CREATE TABLE tm1(a SMALLINT, b SMALLINT, KEY(a)) ENGINE=MERGE UNION=(t1);
---error 1168
-SELECT * FROM tm1;
-DROP TABLE t1, tm1;
-
-CREATE TABLE t1(a SMALLINT, b SMALLINT, KEY(b));
-CREATE TABLE tm1(a SMALLINT, b SMALLINT, KEY(a)) ENGINE=MERGE UNION=(t1);
---error 1168
-SELECT * FROM tm1;
-DROP TABLE t1, tm1;
-
-
-# BUG#26881 - Large MERGE tables report incorrect specification when no
-# differences in tables
-#
-CREATE TABLE t1(c1 VARCHAR(1));
-CREATE TABLE m1 LIKE t1;
-ALTER TABLE m1 ENGINE=MERGE UNION=(t1);
-SELECT * FROM m1;
-DROP TABLE t1, m1;
-
-CREATE TABLE t1(c1 VARCHAR(4), c2 TINYINT, c3 TINYINT, c4 TINYINT,
- c5 TINYINT, c6 TINYINT, c7 TINYINT, c8 TINYINT, c9 TINYINT);
-CREATE TABLE m1 LIKE t1;
-ALTER TABLE m1 ENGINE=MERGE UNION=(t1);
-SELECT * FROM m1;
-DROP TABLE t1, m1;
-
-#
-# BUG#24342 - Incorrect results with query over MERGE table
-#
-CREATE TABLE t1 (a VARCHAR(255) CHARACTER SET latin1 COLLATE latin1_german2_ci,
- b INT, INDEX(a,b));
-CREATE TABLE t2 LIKE t1;
-CREATE TABLE t3 LIKE t1;
-ALTER TABLE t3 ENGINE=MERGE UNION=(t1,t2);
-INSERT INTO t1 VALUES ('ss',1);
-INSERT INTO t2 VALUES ('ss',2),(0xDF,2);
-SELECT COUNT(*) FROM t3 WHERE a=0xDF AND b=2;
-DROP TABLE t1,t2,t3;
-
-# End of 4.1 tests
-
-#
-# BUG#19648 - Merge table does not work with bit types
-#
-create table t1 (b bit(1));
-create table t2 (b bit(1));
-create table tm (b bit(1)) engine = merge union = (t1,t2);
-select * from tm;
-drop table tm, t1, t2;
-
-#
-# Bug #17766: The server accepts to create MERGE tables which cannot work
-#
-create table t1 (a int) insert_method = last engine = merge;
---error ER_OPEN_AS_READONLY
-insert into t1 values (1);
-create table t2 (a int) engine = myisam;
-alter table t1 union (t2);
-insert into t1 values (1);
-alter table t1 insert_method = no;
---error ER_OPEN_AS_READONLY
-insert into t1 values (1);
-drop table t2;
-drop table t1;
-
-#
-# BUG#26976 - Missing table in merge not noted in related error msg + SHOW
-# CREATE TABLE fails
-#
-CREATE TABLE tm1(a INT) ENGINE=MERGE UNION=(t1, t2);
---error ER_WRONG_MRG_TABLE
-SELECT * FROM tm1;
-CHECK TABLE tm1;
-CREATE TABLE t1(a INT);
---error ER_WRONG_MRG_TABLE
-SELECT * FROM tm1;
-CHECK TABLE tm1;
-CREATE TABLE t2(a BLOB);
---error ER_WRONG_MRG_TABLE
-SELECT * FROM tm1;
-CHECK TABLE tm1;
-ALTER TABLE t2 MODIFY a INT;
-SELECT * FROM tm1;
-CHECK TABLE tm1;
-DROP TABLE tm1, t1, t2;
-
-#
-# Bug#15522 - create ... select and with merge tables
-#
-# This was fixed together with Bug#20662 (Infinite loop in CREATE TABLE
-# IF NOT EXISTS ... SELECT with locked tables).
-# The new behavior for MERGE tables is consistent with the
-# CREATE TABLE SELECT behavior for ordinary tables.
-#
-CREATE TABLE t1(c1 INT);
-CREATE TABLE t2 (c1 INT) ENGINE=MERGE UNION=(t1) INSERT_METHOD=FIRST;
-# After WL#5370, it just generates a warning that the table already exists
-CREATE TABLE IF NOT EXISTS t1 SELECT * FROM t2;
-DROP TABLE t1, t2;
-
-#
-# Bug #28837: MyISAM storage engine error (134) doing delete with self-join
-#
-
-CREATE TABLE t1 (id INT NOT NULL, ref INT NOT NULL, INDEX (id)) ENGINE=MyISAM;
-CREATE TABLE t2 LIKE t1;
-
-INSERT INTO t2 (id, ref) VALUES (1,3), (2,1), (3,2), (4,5), (4,4);
-INSERT INTO t1 SELECT * FROM t2;
-INSERT INTO t1 SELECT * FROM t2;
-
-CREATE TABLE t3 (id INT NOT NULL, ref INT NOT NULL, INDEX (id)) ENGINE=MERGE
- UNION(t1);
-
-SELECT * FROM t3 AS a INNER JOIN t3 AS b USING (id) WHERE a.ref < b.ref;
-SELECT * FROM t3;
-DELETE FROM a USING t3 AS a INNER JOIN t3 AS b USING (id) WHERE a.ref < b.ref;
-SELECT * FROM t3;
-
-DROP TABLE t1, t2, t3;
-
-#
-# BUG#28248 - mysqldump results with MERGE ... UNION=() cannot be executed
-#
-CREATE TABLE t1(a INT);
-CREATE TABLE m1(a INT) ENGINE=MERGE;
-SHOW CREATE TABLE m1;
-DROP TABLE m1;
-CREATE TABLE m1(a INT) ENGINE=MERGE UNION=();
-SHOW CREATE TABLE m1;
-ALTER TABLE m1 UNION=(t1);
-ALTER TABLE m1 UNION=();
-SHOW CREATE TABLE m1;
-DROP TABLE t1, m1;
-
-#
-# BUG#32047 - 'Spurious' errors while opening MERGE tables
-#
-CREATE TABLE t1(a INT);
-CREATE TABLE t2(a VARCHAR(10));
-CREATE TABLE m1(a INT) ENGINE=MERGE UNION=(t1, t2);
-CREATE TABLE m2(a INT) ENGINE=MERGE UNION=(t1);
-SELECT * FROM t1;
---error ER_WRONG_MRG_TABLE
-SELECT * FROM m1;
-SELECT * FROM m2;
-DROP TABLE t1, t2, m1, m2;
-
---echo End of 5.0 tests
-
-
-#
-# Bug #8306: TRUNCATE leads to index corruption
-#
-create table t1 (c1 int, index(c1));
-create table t2 (c1 int, index(c1)) engine=merge union=(t1);
-insert into t1 values (1);
-# Close all tables.
-flush tables;
-# Open t2 and (implicitly) t1.
-select * from t2;
-# Truncate after flush works (unless another threads reopens t2 in between).
-flush tables;
-truncate table t1;
-insert into t1 values (1);
-# Close all tables.
-flush tables;
-# Open t2 and (implicitly) t1.
-select * from t2;
-# Truncate t1, which was not recognized as open without the bugfix.
-# After fix for Bug#8306 and before fix for Bug#26379,
-# it should fail with a table-in-use error message, otherwise succeed.
-truncate table t1;
-# The insert used to fail on the crashed table.
-insert into t1 values (1);
-drop table t1,t2;
---echo #
---echo # Extra tests for TRUNCATE.
---echo #
---echo # Truncate MERGE table.
-CREATE TABLE t1 (c1 INT, INDEX(c1));
-CREATE TABLE t2 (c1 INT, INDEX(c1));
-CREATE TABLE t3 (c1 INT, INDEX(c1)) ENGINE=MRG_MYISAM UNION=(t1,t2);
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (2);
-SELECT * FROM t3;
-TRUNCATE TABLE t3;
-SELECT * FROM t3;
---echo #
---echo # Truncate child table.
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (2);
-TRUNCATE TABLE t1;
-SELECT * FROM t3;
---echo #
---echo # Truncate MERGE table under locked tables.
-LOCK TABLE t1 WRITE, t2 WRITE, t3 WRITE;
-INSERT INTO t1 VALUES (1);
-TRUNCATE TABLE t3;
-SELECT * FROM t3;
-UNLOCK TABLES;
-SELECT * FROM t1;
-SELECT * FROM t2;
---echo #
---echo # Truncate child table under locked tables.
-LOCK TABLE t1 WRITE, t2 WRITE, t3 WRITE;
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (2);
-TRUNCATE TABLE t1;
-SELECT * FROM t3;
-UNLOCK TABLES;
-DROP TABLE t1, t2, t3;
---echo #
---echo # Truncate temporary MERGE table.
-CREATE TEMPORARY TABLE t1 (c1 INT, INDEX(c1));
-CREATE TEMPORARY TABLE t2 (c1 INT, INDEX(c1));
-CREATE TEMPORARY TABLE t3 (c1 INT, INDEX(c1)) ENGINE=MRG_MYISAM UNION=(t1,t2);
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (2);
-SELECT * FROM t3;
-TRUNCATE TABLE t3;
-SELECT * FROM t3;
---echo #
---echo # Truncate temporary child table.
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (2);
-TRUNCATE TABLE t1;
-SELECT * FROM t3;
---echo #
---echo # Truncate temporary MERGE table under locked tables.
-INSERT INTO t1 VALUES (1);
-CREATE TABLE t4 (c1 INT, INDEX(c1));
-LOCK TABLE t4 WRITE;
-TRUNCATE TABLE t3;
-SELECT * FROM t3;
-SELECT * FROM t1;
-SELECT * FROM t2;
---echo #
---echo # Truncate temporary child table under locked tables.
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (2);
-TRUNCATE TABLE t1;
-SELECT * FROM t3;
-SELECT * FROM t1;
-SELECT * FROM t2;
-UNLOCK TABLES;
-DROP TABLE t1, t2, t3, t4;
-
-#
-# Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table
-# Preparation
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-connection default;
-#
-# Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table
-# Problem #1
-# A thread trying to lock a MERGE table performed busy waiting while
-# REPAIR TABLE or a similar table administration task was ongoing on one or
-# more of its MyISAM tables.
-# To allow for observability it was necessary to enter a multi-second sleep
-# in mysql_admin_table() after remove_table_from_cache(), which comes after
-# mysql_abort_lock(). The sleep faked a long running operation. One could
-# watch a high CPU load during the sleep time.
-# The problem was that mysql_abort_lock() upgrades the write lock to
-# TL_WRITE_ONLY. This lock type persisted until the final unlock at the end
-# of the administration task. The effect of TL_WRITE_ONLY is to reject any
-# attempt to lock the table. The trying thread must close the table and wait
-# until it is no longer used. Unfortunately there is no way to detect that
-# one of the MyISAM tables of a MERGE table is in use. When trying to lock
-# the MERGE table, all MyISAM tables are locked. If one fails on
-# TL_WRITE_ONLY, all locks are aborted and wait_for_tables() is entered.
-# But this doesn't see the MERGE table as used, so it seems appropriate to
-# retry a lock...
-#
-CREATE TABLE t1 (c1 INT) ENGINE= MyISAM;
-CREATE TABLE t2 (c1 INT) ENGINE= MRG_MYISAM UNION= (t1) INSERT_METHOD= LAST;
-send REPAIR TABLE t1;
- connection con1;
- sleep 1; # let repair run into its sleep
- INSERT INTO t2 VALUES (1);
-connection default;
-reap;
-DROP TABLE t1, t2;
-#
-# Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table
-# Problem #2
-# A thread trying to lock a MERGE table performed busy waiting until all
-# threads that did REPAIR TABLE or similar table administration tasks on
-# one or more of its MyISAM tables in LOCK TABLES segments did
-# UNLOCK TABLES.
-# The difference against problem #1 is that the busy waiting took place
-# *after* the administration task. It was terminated by UNLOCK TABLES only.
-#
-# This is the same test case as for
-# Bug#26867 - LOCK TABLES REPAIR + merge table result in memory/cpu hogging
-#
-#
-CREATE TABLE t1 (c1 INT) ENGINE= MyISAM;
-CREATE TABLE t2 (c1 INT) ENGINE= MRG_MYISAM UNION= (t1) INSERT_METHOD= LAST;
-LOCK TABLE t1 WRITE;
- connection con1;
- send INSERT INTO t2 VALUES (1);
-connection default;
-sleep 1; # Let INSERT go into thr_multi_lock().
-REPAIR TABLE t1;
-sleep 2; # con1 performs busy waiting during this sleep.
-UNLOCK TABLES;
- connection con1;
- reap;
-connection default;
-DROP TABLE t1, t2;
-#
-# Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table
-# Problem #3
-# Two FLUSH TABLES within a LOCK TABLES segment could invalidate the lock.
-# This did *not* require a MERGE table.
-# To increase reproducibility it was necessary to enter a sleep of 2 seconds
-# at the end of wait_for_tables() after unlock of LOCK_open. In 5.0 and 5.1
-# the sleep must be inserted in open_and_lock_tables() after open_tables()
-# instead. wait_for_tables() is not used in this case.
-# The problem was that FLUSH TABLES releases LOCK_open while having unlocked
-# and closed all tables. When this happened while a thread was in the loop in
-# mysql_lock_tables() right after wait_for_tables() and before retrying to
-# lock, the thread got the lock. (Translate to similar code places in 5.0
-# and 5.1). And it did not notice that the table needed a refresh. So it
-# executed its statement on the table.
-# The first FLUSH TABLES kicked the INSERT out of thr_multi_lock() and let
-# it wait in wait_for_tables(). (open_table() in 5.0 and 5.1). The second
-# FLUSH TABLES must happen while the INSERT was on its way from
-# wait_for_tables() to the next call of thr_multi_lock(). This needed to be
-# supported by a sleep to make it repeatable.
-#
-CREATE TABLE t1 (c1 INT) ENGINE= MyISAM;
-LOCK TABLE t1 WRITE;
- connection con1;
- send INSERT INTO t1 VALUES (1);
-connection default;
-sleep 1; # Let INSERT go into thr_multi_lock().
-FLUSH TABLES;
-sleep 1; # Let INSERT go through wait_for_tables() where it sleeps.
-FLUSH TABLES;
-# This should give no result. But it will with sleep(2) at the right place.
-SELECT * FROM t1;
-UNLOCK TABLES;
- connection con1;
- reap;
-connection default;
-DROP TABLE t1;
-#
-# Bug#26379 - Combination of FLUSH TABLE and REPAIR TABLE corrupts a MERGE table
-# Cleanup
-disconnect con1;
-disconnect con2;
-#
---echo #
---echo # Extra tests for Bug#26379 - Combination of FLUSH TABLE and
---echo # REPAIR TABLE corrupts a MERGE table
-#
---echo #
---echo # CREATE ... SELECT is disabled for MERGE tables.
---echo #
-CREATE TABLE t1(c1 INT);
-INSERT INTO t1 VALUES (1);
-CREATE TABLE t2 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1) INSERT_METHOD=LAST;
---error ER_OPEN_AS_READONLY
-CREATE TABLE t3 ENGINE=MRG_MYISAM INSERT_METHOD=LAST SELECT * FROM t2;
---error ER_NO_SUCH_TABLE
-SHOW CREATE TABLE t3;
---error ER_WRONG_OBJECT
-CREATE TABLE t3 ENGINE=MRG_MYISAM UNION=(t1) INSERT_METHOD=LAST
- SELECT * FROM t2;
---error ER_NO_SUCH_TABLE
-SHOW CREATE TABLE t3;
-DROP TABLE t1, t2;
-#
---echo #
---echo # Bug#37371 "CREATE TABLE LIKE merge loses UNION parameter"
---echo # Demonstrate that this is no longer the case.
---echo #
---echo # 1. Create like.
-CREATE TABLE t1 (c1 INT);
-CREATE TABLE t2 (c1 INT);
-CREATE TABLE t3 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1,t2)
- INSERT_METHOD=LAST;
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (2);
-INSERT INTO t3 VALUES (3);
-CREATE TABLE t4 LIKE t3;
-SHOW CREATE TABLE t4;
-INSERT INTO t4 VALUES (4);
-DROP TABLE t4;
---echo #
---echo # 1. Create like with locked tables.
-LOCK TABLES t3 WRITE, t2 WRITE, t1 WRITE;
---error ER_TABLE_NOT_LOCKED
-CREATE TABLE t4 LIKE t3;
---error ER_TABLE_NOT_LOCKED
-SHOW CREATE TABLE t4;
---error ER_TABLE_NOT_LOCKED
-INSERT INTO t4 VALUES (4);
---echo # Temporary tables can be created in spite of LOCK TABLES.
---echo # If the temporary MERGE table uses the locked children only,
---echo # it can even be used.
-CREATE TEMPORARY TABLE t4 LIKE t3;
-SHOW CREATE TABLE t4;
-INSERT INTO t4 VALUES (4);
-UNLOCK TABLES;
-INSERT INTO t4 VALUES (4);
-DROP TABLE t4;
-#
---echo #
---echo # Rename child.
---echo #
---echo # 1. Normal rename of non-MERGE table.
-CREATE TABLE t4 (c1 INT);
-INSERT INTO t4 VALUES (4);
-SELECT * FROM t4 ORDER BY c1;
-RENAME TABLE t4 TO t5;
-SELECT * FROM t5 ORDER BY c1;
-RENAME TABLE t5 TO t4;
-SELECT * FROM t4 ORDER BY c1;
-DROP TABLE t4;
---echo #
---echo # 2. Normal rename.
-SELECT * FROM t3 ORDER BY c1;
-RENAME TABLE t2 TO t5;
---error ER_WRONG_MRG_TABLE
-SELECT * FROM t3 ORDER BY c1;
-RENAME TABLE t5 TO t2;
-SELECT * FROM t3 ORDER BY c1;
---echo #
---echo # 3. Normal rename with locked tables.
-LOCK TABLES t1 WRITE, t2 WRITE, t3 WRITE;
-SELECT * FROM t3 ORDER BY c1;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-RENAME TABLE t2 TO t5;
-SELECT * FROM t3 ORDER BY c1;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-RENAME TABLE t5 TO t2;
-SELECT * FROM t3 ORDER BY c1;
-UNLOCK TABLES;
---echo #
---echo # 4. Alter table rename.
-ALTER TABLE t2 RENAME TO t5;
---error ER_WRONG_MRG_TABLE
-SELECT * FROM t3 ORDER BY c1;
-ALTER TABLE t5 RENAME TO t2;
-SELECT * FROM t3 ORDER BY c1;
---echo #
---echo # 5. Alter table rename with locked tables.
-LOCK TABLES t1 WRITE, t2 WRITE, t3 WRITE;
-ALTER TABLE t2 RENAME TO t5;
---error ER_TABLE_NOT_LOCKED
-SELECT * FROM t3 ORDER BY c1;
---error ER_TABLE_NOT_LOCKED
-ALTER TABLE t5 RENAME TO t2;
-UNLOCK TABLES;
-ALTER TABLE t5 RENAME TO t2;
-SELECT * FROM t3 ORDER BY c1;
-#
---echo #
---echo # Rename parent.
---echo #
---echo # 1. Normal rename with locked tables.
-LOCK TABLES t1 WRITE, t2 WRITE, t3 WRITE;
-SELECT * FROM t3 ORDER BY c1;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-RENAME TABLE t3 TO t5;
-SELECT * FROM t3 ORDER BY c1;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-RENAME TABLE t5 TO t3;
-SELECT * FROM t3 ORDER BY c1;
---echo #
---echo # 5. Alter table rename with locked tables.
-ALTER TABLE t3 RENAME TO t5;
---error ER_TABLE_NOT_LOCKED
-SELECT * FROM t5 ORDER BY c1;
---error ER_TABLE_NOT_LOCKED
-ALTER TABLE t5 RENAME TO t3;
-UNLOCK TABLES;
-ALTER TABLE t5 RENAME TO t3;
-SELECT * FROM t3 ORDER BY c1;
-DROP TABLE t1, t2, t3;
-#
---echo #
---echo # Drop locked tables.
---echo #
---echo # 1. Drop parent.
-CREATE TABLE t1 (c1 INT, INDEX(c1));
-CREATE TABLE t2 (c1 INT, INDEX(c1)) ENGINE=MRG_MYISAM UNION=(t1)
- INSERT_METHOD=LAST;
-LOCK TABLES t1 WRITE, t2 WRITE;
-INSERT INTO t1 VALUES (1);
-DROP TABLE t2;
---error ER_TABLE_NOT_LOCKED
-SELECT * FROM t2;
-SELECT * FROM t1;
-UNLOCK TABLES;
---echo # 2. Drop child.
-CREATE TABLE t2 (c1 INT, INDEX(c1)) ENGINE=MRG_MYISAM UNION=(t1)
- INSERT_METHOD=LAST;
-LOCK TABLES t1 WRITE, t2 WRITE;
-INSERT INTO t1 VALUES (1);
-DROP TABLE t1;
---error ER_TABLE_NOT_LOCKED
-SELECT * FROM t2;
---error ER_TABLE_NOT_LOCKED
-SELECT * FROM t1;
-UNLOCK TABLES;
-DROP TABLE t2;
-#
---echo #
---echo # ALTER TABLE. Change child list.
---echo #
-CREATE TABLE t1 (c1 INT, INDEX(c1));
-CREATE TABLE t2 (c1 INT, INDEX(c1));
-CREATE TABLE t3 (c1 INT, INDEX(c1));
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (2);
-INSERT INTO t3 VALUES (3);
-CREATE TABLE t4 (c1 INT, INDEX(c1)) ENGINE=MRG_MYISAM UNION=(t3,t2)
- INSERT_METHOD=LAST;
---echo # Shrink child list.
-ALTER TABLE t4 UNION=(t3);
-SHOW CREATE TABLE t4;
-SELECT * FROM t4 ORDER BY c1;
---echo # Extend child list.
-ALTER TABLE t4 UNION=(t3,t2);
-SHOW CREATE TABLE t4;
-SELECT * FROM t4 ORDER BY c1;
-#
---echo #
---echo # ALTER TABLE under LOCK TABLES. Change child list.
---echo #
-LOCK TABLES t4 WRITE, t3 WRITE, t2 WRITE;
---echo # Shrink child list.
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-ALTER TABLE t4 UNION=(t3);
---echo # Extend child list within locked tables.
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-ALTER TABLE t4 UNION=(t3,t2);
---echo # Extend child list beyond locked tables.
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-ALTER TABLE t4 UNION=(t3,t2,t1);
-SHOW CREATE TABLE t4;
-SELECT * FROM t4 ORDER BY c1;
-UNLOCK TABLES;
-DROP TABLE t4;
-#
---echo #
---echo # ALTER TABLE under LOCK TABLES. Grave change, table re-creation.
---echo #
-CREATE TABLE t4 (c1 INT, INDEX(c1)) ENGINE=MRG_MYISAM UNION=(t1,t2,t3)
- INSERT_METHOD=LAST;
---echo # Lock parent first and then children.
-LOCK TABLES t4 WRITE, t3 WRITE, t2 WRITE, t1 WRITE;
-ALTER TABLE t4 DROP INDEX c1, ADD UNIQUE INDEX (c1);
-SELECT * FROM t4 ORDER BY c1;
-ALTER TABLE t2 DROP INDEX c1, ADD UNIQUE INDEX (c1);
-SELECT * FROM t4 ORDER BY c1;
-UNLOCK TABLES;
---echo # Lock children first and then parent.
-LOCK TABLES t1 WRITE, t2 WRITE, t3 WRITE, t4 WRITE;
-ALTER TABLE t4 DROP INDEX c1, ADD UNIQUE INDEX (c1);
-SELECT * FROM t4 ORDER BY c1;
-ALTER TABLE t2 DROP INDEX c1, ADD UNIQUE INDEX (c1);
-SELECT * FROM t4 ORDER BY c1;
-UNLOCK TABLES;
---echo # Lock parent between children.
-LOCK TABLES t3 WRITE, t2 WRITE, t4 WRITE, t1 WRITE;
-ALTER TABLE t4 DROP INDEX c1, ADD UNIQUE INDEX (c1);
-SELECT * FROM t4 ORDER BY c1;
-ALTER TABLE t2 DROP INDEX c1, ADD UNIQUE INDEX (c1);
-SELECT * FROM t4 ORDER BY c1;
-UNLOCK TABLES;
-DROP TABLE t1, t2, t3, t4;
-#
---echo #
---echo # ALTER TABLE under LOCK TABLES. Simple change, no re-creation.
---echo #
-CREATE TABLE t1 (c1 INT);
-CREATE TABLE t2 (c1 INT);
-CREATE TABLE t3 (c1 INT);
-CREATE TABLE t4 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1,t2,t3)
- INSERT_METHOD=LAST;
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (2);
-INSERT INTO t3 VALUES (3);
---echo # Lock parent first and then children.
-LOCK TABLES t4 WRITE, t3 WRITE, t2 WRITE, t1 WRITE;
-ALTER TABLE t4 ALTER COLUMN c1 SET DEFAULT 44;
-SELECT * FROM t4 ORDER BY c1;
-ALTER TABLE t2 ALTER COLUMN c1 SET DEFAULT 22;
-SELECT * FROM t4 ORDER BY c1;
-UNLOCK TABLES;
---echo # Lock children first and then parent.
-LOCK TABLES t1 WRITE, t2 WRITE, t3 WRITE, t4 WRITE;
-ALTER TABLE t4 ALTER COLUMN c1 SET DEFAULT 44;
-SELECT * FROM t4 ORDER BY c1;
-ALTER TABLE t2 ALTER COLUMN c1 SET DEFAULT 22;
-SELECT * FROM t4 ORDER BY c1;
-UNLOCK TABLES;
---echo # Lock parent between children.
-LOCK TABLES t3 WRITE, t2 WRITE, t4 WRITE, t1 WRITE;
-ALTER TABLE t4 ALTER COLUMN c1 SET DEFAULT 44;
-SELECT * FROM t4 ORDER BY c1;
-ALTER TABLE t2 ALTER COLUMN c1 SET DEFAULT 22;
-SELECT * FROM t4 ORDER BY c1;
-UNLOCK TABLES;
-#
---echo #
---echo # FLUSH TABLE under LOCK TABLES.
---echo #
---echo # Lock parent first and then children.
-LOCK TABLES t4 WRITE, t3 WRITE, t2 WRITE, t1 WRITE;
-FLUSH TABLE t4;
-SELECT * FROM t4 ORDER BY c1;
-FLUSH TABLE t2;
-SELECT * FROM t4 ORDER BY c1;
-FLUSH TABLES;
-SELECT * FROM t4 ORDER BY c1;
-UNLOCK TABLES;
---echo # Lock children first and then parent.
-LOCK TABLES t1 WRITE, t2 WRITE, t3 WRITE, t4 WRITE;
-FLUSH TABLE t4;
-SELECT * FROM t4 ORDER BY c1;
-FLUSH TABLE t2;
-SELECT * FROM t4 ORDER BY c1;
-FLUSH TABLES;
-SELECT * FROM t4 ORDER BY c1;
-UNLOCK TABLES;
---echo # Lock parent between children.
-LOCK TABLES t3 WRITE, t2 WRITE, t4 WRITE, t1 WRITE;
-FLUSH TABLE t4;
-SELECT * FROM t4 ORDER BY c1;
-FLUSH TABLE t2;
-SELECT * FROM t4 ORDER BY c1;
-FLUSH TABLES;
-SELECT * FROM t4 ORDER BY c1;
-UNLOCK TABLES;
-#
---echo #
---echo # Triggers
---echo #
---echo # Trigger on parent
-DELETE FROM t4 WHERE c1 = 4;
-CREATE TRIGGER t4_ai1 AFTER INSERT ON t4 FOR EACH ROW SET @a=1;
-SET @a=0;
-INSERT INTO t4 VALUES (4);
-SELECT @a;
-SELECT * FROM t4 ORDER BY c1;
-DROP TRIGGER t4_ai1;
-CHECK TABLE t3;
---echo # Trigger on parent under LOCK TABLES
-LOCK TABLES t3 WRITE, t2 WRITE, t4 WRITE, t1 WRITE;
-CREATE TRIGGER t4_ai2 AFTER INSERT ON t4 FOR EACH ROW SET @a=1;
-SET @a=0;
-INSERT INTO t4 VALUES (4);
-SELECT @a;
-SELECT * FROM t4 ORDER BY c1;
-DROP TRIGGER t4_ai2;
-UNLOCK TABLES;
-CHECK TABLE t3;
---echo #
---echo # Trigger on child
-DELETE FROM t4 WHERE c1 = 4;
-CREATE TRIGGER t3_ai3 AFTER INSERT ON t3 FOR EACH ROW SET @a=1;
-SET @a=0;
-INSERT INTO t4 VALUES (4);
-SELECT @a;
-INSERT INTO t3 VALUES (33);
-SELECT @a;
-SELECT * FROM t4 ORDER BY c1;
-DROP TRIGGER t3_ai3;
-CHECK TABLE t3;
---echo # Trigger on child under LOCK TABLES
-LOCK TABLES t3 WRITE, t2 WRITE, t4 WRITE, t1 WRITE;
-CREATE TRIGGER t3_ai4 AFTER INSERT ON t3 FOR EACH ROW SET @a=1;
-SET @a=0;
-INSERT INTO t4 VALUES (4);
-SELECT @a;
-INSERT INTO t3 VALUES (33);
-SELECT @a;
-SELECT * FROM t4 ORDER BY c1;
-DELETE FROM t4 WHERE c1 = 33;
-DROP TRIGGER t3_ai4;
-UNLOCK TABLES;
-CHECK TABLE t3;
---echo #
---echo # Trigger with table use on child
-DELETE FROM t4 WHERE c1 = 4;
-CREATE TRIGGER t3_ai5 AFTER INSERT ON t3 FOR EACH ROW INSERT INTO t2 VALUES(22);
-SELECT COUNT(*) FROM t2;
-INSERT INTO t4 VALUES (4);
-SELECT * FROM t4 ORDER BY c1;
-INSERT INTO t3 VALUES (33);
-SELECT * FROM t4 ORDER BY c1;
-DELETE FROM t4 WHERE c1 = 22;
-DELETE FROM t4 WHERE c1 = 33;
-DROP TRIGGER t3_ai5;
-UNLOCK TABLES;
-CHECK TABLE t2,t3;
---echo # Trigger with table use on child under LOCK TABLES
-LOCK TABLES t3 WRITE, t2 WRITE, t4 WRITE, t1 WRITE;
-CREATE TRIGGER t3_ai6 AFTER INSERT ON t3 FOR EACH ROW INSERT INTO t2 VALUES(22);
-INSERT INTO t4 VALUES (4);
-SELECT * FROM t4 ORDER BY c1;
-INSERT INTO t3 VALUES (33);
-SELECT * FROM t4 ORDER BY c1;
-DROP TRIGGER t3_ai6;
-UNLOCK TABLES;
-check table t2,t3,t4;
-DELETE FROM t4 WHERE c1 = 22;
-DELETE FROM t4 WHERE c1 = 33;
---echo # Trigger with table use on child under different LOCK TABLES
-DELETE FROM t4 WHERE c1 = 4;
-LOCK TABLES t4 WRITE,t3 WRITE, t2 WRITE, t1 WRITE;
-CREATE TRIGGER t3_ai7 AFTER INSERT ON t3 FOR EACH ROW INSERT INTO t2 VALUES(22);
-INSERT INTO t4 VALUES (4);
-SELECT * FROM t4 ORDER BY c1;
-INSERT INTO t3 VALUES (33);
-SELECT * FROM t4 ORDER BY c1;
-DROP TRIGGER t3_ai7;
-UNLOCK TABLES;
-check table t2,t3,t4;
-DELETE FROM t4 WHERE c1 = 22;
-DELETE FROM t4 WHERE c1 = 33;
-#
---echo #
---echo # Repair
---echo #
-REPAIR TABLE t4;
-REPAIR TABLE t2;
-SELECT * FROM t4 ORDER BY c1;
-LOCK TABLES t3 WRITE, t2 WRITE, t4 WRITE, t1 WRITE;
-REPAIR TABLE t4;
-REPAIR TABLE t2;
-SELECT * FROM t4 ORDER BY c1;
-UNLOCK TABLES;
-#
---echo #
---echo # Optimize
---echo #
-OPTIMIZE TABLE t4;
-OPTIMIZE TABLE t2;
-SELECT * FROM t4 ORDER BY c1;
-LOCK TABLES t3 WRITE, t2 WRITE, t4 WRITE, t1 WRITE;
-OPTIMIZE TABLE t4;
-OPTIMIZE TABLE t2;
-SELECT * FROM t4 ORDER BY c1;
-UNLOCK TABLES;
-#
---echo #
---echo # Checksum
---echo #
-CHECKSUM TABLE t4;
-CHECKSUM TABLE t2;
-SELECT * FROM t4 ORDER BY c1;
-LOCK TABLES t3 WRITE, t2 WRITE, t4 WRITE, t1 WRITE;
-CHECKSUM TABLE t4;
-CHECKSUM TABLE t2;
-SELECT * FROM t4 ORDER BY c1;
-UNLOCK TABLES;
-#
---echo #
---echo # Insert delayed
---echo #
-# See also Bug#26464 - insert delayed + update + merge = corruption
-# Succeeds in embedded server - is converted to normal insert
-# Fails in normal server, ps-protocol - not supported by engine
-# Fails in normal server, normal protocol - not a base table
---error 0, ER_DELAYED_NOT_SUPPORTED, ER_WRONG_OBJECT
-INSERT DELAYED INTO t4 VALUES(44);
-# Get rid of row in embedded server
-DELETE FROM t4 WHERE c1 = 44;
-INSERT DELAYED INTO t3 VALUES(33);
- let $wait_cmd= SHOW STATUS LIKE 'Not_flushed_delayed_rows';
- let $run= query_get_value($wait_cmd, Value, 1);
- while ($run)
- {
- let $run= query_get_value($wait_cmd, Value, 1);
- }
-SELECT * FROM t4 ORDER BY c1;
-LOCK TABLES t3 WRITE, t2 WRITE, t4 WRITE, t1 WRITE;
---error ER_DELAYED_INSERT_TABLE_LOCKED, ER_DELAYED_NOT_SUPPORTED
-INSERT DELAYED INTO t4 VALUES(444);
---error ER_DELAYED_INSERT_TABLE_LOCKED, ER_DELAYED_NOT_SUPPORTED
-INSERT DELAYED INTO t3 VALUES(333);
-SELECT * FROM t4 ORDER BY c1;
-UNLOCK TABLES;
-DROP TABLE t1, t2, t3, t4;
-#
---echo #
---echo # Recursive inclusion of merge tables in their union clauses.
---echo #
-CREATE TABLE t1 (c1 INT, INDEX(c1));
-CREATE TABLE t2 (c1 INT, INDEX(c1)) ENGINE=MRG_MYISAM UNION=(t1)
- INSERT_METHOD=LAST;
-CREATE TABLE t3 (c1 INT, INDEX(c1)) ENGINE=MRG_MYISAM UNION=(t2,t1)
- INSERT_METHOD=LAST;
-ALTER TABLE t2 UNION=(t3,t1);
---error ER_ADMIN_WRONG_MRG_TABLE
-SELECT * FROM t2;
-DROP TABLE t1, t2, t3;
-
-
-#
-# Bug#25038 - Waiting TRUNCATE
-# Truncate failed with error message when table was in use by MERGE.
-#
-# Show that truncate of child table after use of parent table works.
-CREATE TABLE t1 (c1 INT) ENGINE= MyISAM;
-CREATE TABLE t2 (c1 INT) ENGINE= MyISAM;
-CREATE TABLE t3 (c1 INT) ENGINE= MRG_MYISAM UNION= (t1, t2);
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (2);
-SELECT * FROM t3;
-TRUNCATE TABLE t1;
-SELECT * FROM t3;
-DROP TABLE t1, t2, t3;
-#
-# Show that truncate of child table waits while parent table is used.
-# (test partly borrowed from count_distinct3.)
-CREATE TABLE t1 (id INTEGER, grp TINYINT, id_rev INTEGER);
-SET @rnd_max= 2147483647;
-let $1 = 10;
---disable_query_log
-begin;
-while ($1)
-{
- SET @rnd= RAND();
- SET @id = CAST(@rnd * @rnd_max AS UNSIGNED);
- SET @id_rev= @rnd_max - @id;
- SET @grp= CAST(127.0 * @rnd AS UNSIGNED);
- INSERT INTO t1 (id, grp, id_rev) VALUES (@id, @grp, @id_rev);
- dec $1;
-}
-commit;
---enable_query_log
-set @@read_buffer_size=2*1024*1024;
-CREATE TABLE t2 SELECT * FROM t1;
-INSERT INTO t1 (id, grp, id_rev) SELECT id, grp, id_rev FROM t2;
-INSERT INTO t2 (id, grp, id_rev) SELECT id, grp, id_rev FROM t1;
-INSERT INTO t1 (id, grp, id_rev) SELECT id, grp, id_rev FROM t2;
-INSERT INTO t2 (id, grp, id_rev) SELECT id, grp, id_rev FROM t1;
-INSERT INTO t1 (id, grp, id_rev) SELECT id, grp, id_rev FROM t2;
-CREATE TABLE t3 (id INTEGER, grp TINYINT, id_rev INTEGER)
- ENGINE= MRG_MYISAM UNION= (t1, t2);
-SELECT COUNT(*) FROM t1;
-SELECT COUNT(*) FROM t2;
-SELECT COUNT(*) FROM t3;
-connect (con1,localhost,root,,);
- # As t3 contains random numbers, results are different from test to test.
- # That's okay, because we test only that select doesn't yield an
- # error. Note, that --disable_result_log doesn't suppress error output.
- --disable_result_log
- send SELECT COUNT(DISTINCT a1.id) FROM t3 AS a1, t3 AS a2
- WHERE a1.id = a2.id GROUP BY a2.grp;
-connection default;
-sleep 1;
-TRUNCATE TABLE t1;
- connection con1;
- reap;
- --enable_result_log
- disconnect con1;
-connection default;
-SELECT COUNT(*) FROM t1;
-SELECT COUNT(*) FROM t2;
-SELECT COUNT(*) FROM t3;
-DROP TABLE t1, t2, t3;
-
-#
-# Bug#25700 - merge base tables get corrupted by optimize/analyze/repair table
-#
-# Using FLUSH TABLES before REPAIR.
-CREATE TABLE t1 (c1 INT) ENGINE=MyISAM;
-CREATE TABLE t2 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1) INSERT_METHOD=LAST;
-INSERT INTO t2 VALUES (1);
-SELECT * FROM t2;
-LOCK TABLES t2 WRITE, t1 WRITE;
-FLUSH TABLES;
-REPAIR TABLE t1;
-CHECK TABLE t1;
-REPAIR TABLE t1;
-UNLOCK TABLES;
-CHECK TABLE t1 EXTENDED;
-#
-# Not using FLUSH TABLES before REPAIR.
-LOCK TABLES t2 WRITE, t1 WRITE;
-REPAIR TABLE t1;
-CHECK TABLE t1;
-REPAIR TABLE t1;
-UNLOCK TABLES;
-CHECK TABLE t1 EXTENDED;
-DROP TABLE t1, t2;
-
-#
-# Bug#26377 - Deadlock with MERGE and FLUSH TABLE
-#
-CREATE TABLE t1 ( a INT ) ENGINE=MyISAM;
-CREATE TABLE m1 ( a INT ) ENGINE=MRG_MYISAM UNION=(t1);
-# Lock t1 first. This did always work.
-LOCK TABLES t1 WRITE, m1 WRITE;
-FLUSH TABLE t1;
-UNLOCK TABLES;
-DROP TABLE m1, t1;
-#
-CREATE TABLE t1 ( a INT ) ENGINE=MyISAM;
-CREATE TABLE m1 ( a INT ) ENGINE=MRG_MYISAM UNION=(t1);
-# Lock m1 first. This did deadlock.
-LOCK TABLES m1 WRITE, t1 WRITE;
-FLUSH TABLE t1;
-UNLOCK TABLES;
-DROP TABLE m1, t1;
-
-#
-# Bug#27660 - Falcon: merge table possible
-#
-# Normal MyISAM MERGE operation.
-CREATE TABLE t1 (c1 INT, c2 INT) ENGINE= MyISAM;
-CREATE TABLE t2 (c1 INT, c2 INT) ENGINE= MyISAM;
-CREATE TABLE t3 (c1 INT, c2 INT) ENGINE= MRG_MYISAM UNION(t1, t2);
-INSERT INTO t1 VALUES (1, 1);
-INSERT INTO t2 VALUES (2, 2);
-SELECT * FROM t3;
-# Try an unsupported engine.
-ALTER TABLE t1 ENGINE= MEMORY;
-INSERT INTO t1 VALUES (0, 0);
-# Before fixing, this succeeded, but (0, 0) was missing.
---error 1168
-SELECT * FROM t3;
-DROP TABLE t1, t2, t3;
-
-#
-# Bug#30275 - Merge tables: flush tables or unlock tables causes server to crash
-#
-CREATE TABLE t1 (c1 INT, KEY(c1));
-CREATE TABLE t2 (c1 INT, KEY(c1)) ENGINE=MRG_MYISAM UNION=(t1)
- INSERT_METHOD=FIRST;
-LOCK TABLE t1 WRITE, t2 WRITE;
-FLUSH TABLES t2, t1;
-OPTIMIZE TABLE t1;
-FLUSH TABLES t1;
-UNLOCK TABLES;
-#
-FLUSH TABLES;
-INSERT INTO t1 VALUES (1);
-LOCK TABLE t1 WRITE, t2 WRITE;
-FLUSH TABLES t2, t1;
-OPTIMIZE TABLE t1;
-FLUSH TABLES t1;
-UNLOCK TABLES;
-DROP TABLE t1, t2;
-
-#
-# Test derived from test program for
-# Bug#30273 - merge tables: Can't lock file (errno: 155)
-#
-CREATE TABLE t1 (ID INT) ENGINE=MYISAM;
-CREATE TABLE m1 (ID INT) ENGINE=MRG_MYISAM UNION=(t1) INSERT_METHOD=FIRST;
-INSERT INTO t1 VALUES ();
-INSERT INTO m1 VALUES ();
-LOCK TABLE t1 WRITE, m1 WRITE;
-FLUSH TABLES m1, t1;
-OPTIMIZE TABLE t1;
-FLUSH TABLES m1, t1;
-UNLOCK TABLES;
-DROP TABLE t1, m1;
-
-#
-# Bug#35068 - Assertion fails when reading from i_s.tables
-# and there is incorrect merge table
-#
-CREATE TABLE tm1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1) INSERT_METHOD=FIRST;
-SELECT table_schema, table_name, table_type, engine, version, row_format, table_comment FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' and TABLE_NAME='tm1';
-
-DROP TABLE tm1;
-
-#
-# Bug#36006 - Optimizer does table scan for select count(*)
-#
-CREATE TABLE t1(C1 INT, C2 INT, KEY C1(C1), KEY C2(C2)) ENGINE=MYISAM;
-CREATE TABLE t2(C1 INT, C2 INT, KEY C1(C1), KEY C2(C2)) ENGINE=MYISAM;
-CREATE TABLE t3(C1 INT, C2 INT, KEY C1(C1), KEY C2(C2)) ENGINE=MYISAM;
-CREATE TABLE t4(C1 INT, C2 INT, KEY C1(C1), KEY C2(C2))
- ENGINE=MRG_MYISAM UNION=(t1, t2, t3);
-INSERT INTO t1 VALUES (1,1), (1,2),(1,3), (1,4);
-INSERT INTO t2 VALUES (2,1), (2,2),(2,3), (2,4);
-INSERT INTO t3 VALUES (3,1), (3,2),(3,3), (3,4);
-EXPLAIN SELECT COUNT(*) FROM t1;
-EXPLAIN SELECT COUNT(*) FROM t4;
-DROP TABLE t1, t2, t3, t4;
-
-#
-# BUG#39185 - Cardinality for merge tables calculated incorrectly.
-#
-CREATE TABLE t1(a INT, KEY(a));
-INSERT INTO t1 VALUES(0),(1),(2),(3),(4);
-ANALYZE TABLE t1;
-CREATE TABLE m1(a INT, KEY(a)) ENGINE=MERGE UNION=(t1);
-SELECT CARDINALITY FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_SCHEMA='test' AND TABLE_NAME='m1';
-SELECT CARDINALITY FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_SCHEMA='test' AND TABLE_NAME='m1';
-SELECT CARDINALITY FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_SCHEMA='test' AND TABLE_NAME='m1';
-SELECT CARDINALITY FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_SCHEMA='test' AND TABLE_NAME='m1';
-DROP TABLE t1, m1;
-
---echo #
---echo # Bug #40675 MySQL 5.1 crash with index merge algorithm and Merge tables
---echo #
-
---echo # create MYISAM table t1 and insert values into it
-CREATE TABLE t1(a INT);
-INSERT INTO t1 VALUES(1);
-
---echo # create MYISAM table t2 and insert values into it
-CREATE TABLE t2(a INT, b INT, dummy CHAR(16) DEFAULT '', KEY(a), KEY(b));
-INSERT INTO t2(a,b) VALUES
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
-(1,2);
-
---echo # Create the merge table t3
-CREATE TABLE t3(a INT, b INT, dummy CHAR(16) DEFAULT '', KEY(a), KEY(b))
-ENGINE=MERGE UNION=(t2) INSERT_METHOD=FIRST;
-
---echo # Lock tables t1 and t3 for write
-LOCK TABLES t1 WRITE, t3 WRITE;
-
---echo # Insert values into the merge table t3
-INSERT INTO t3(a,b) VALUES(1,2);
-
---echo # select from the join of t2 and t3 (The merge table)
-SELECT t3.a FROM t1,t3 WHERE t3.b=2 AND t3.a=1;
-
---echo # Unlock the tables
-UNLOCK TABLES;
-
---echo # drop the created tables
-DROP TABLE t1, t2, t3;
-
-#
-# Bug #41305 server crashes when inserting duplicate row into a merge table
-#
---echo # insert duplicate value in child table while merge table doesn't have key
-create table t1 (
- col1 int(10),
- primary key (col1)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-
-CREATE TABLE m1 (
- col1 int(10) NOT NULL
-) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(t1);
-
-insert into m1 (col1) values (1);
---error ER_DUP_KEY
-insert into m1 (col1) values (1);
-
-drop table m1, t1;
-
---echo #
---echo # Bug#45800 crash when replacing into a merge table and there is a duplicate
---echo #
-
---echo # Replace duplicate value in child table when merge table doesn't have key
-CREATE TABLE t1 (c1 INT PRIMARY KEY) ENGINE=MyISAM;
-CREATE TABLE m1 (c1 INT NOT NULL) ENGINE=MRG_MyISAM INSERT_METHOD=LAST UNION=(t1);
-INSERT INTO m1 VALUES (666);
-SELECT * FROM m1;
---echo # insert the duplicate value into the merge table
-REPLACE INTO m1 VALUES (666);
-SELECT * FROM m1;
-DROP TABLE m1, t1;
-
---echo # Insert... on duplicate key update (with duplicate values in the table)
-CREATE TABLE t1 (c1 INT PRIMARY KEY) ENGINE=MyISAM;
-CREATE TABLE m1 (c1 INT NOT NULL) ENGINE=MRG_MyISAM INSERT_METHOD=LAST UNION=(t1);
-INSERT INTO m1 VALUES (666);
-SELECT * FROM m1;
---echo # insert the duplicate value into the merge table
-INSERT INTO m1 VALUES (666) ON DUPLICATE KEY UPDATE c1=c1+1;
-SELECT * FROM m1;
-DROP TABLE m1, t1;
-
---echo # Insert duplicate value on MERGE table, where, MERGE has a key but MyISAM has more keys
-CREATE TABLE t1 (c1 INT, c2 INT, UNIQUE (c1), UNIQUE (c2));
-CREATE TABLE m1 (c1 INT, c2 INT, UNIQUE (c1)) ENGINE=MRG_MyISAM INSERT_METHOD=LAST UNION=(t1);
-INSERT INTO m1 VALUES (1,2);
---echo # insert the duplicate value into the merge table
---error ER_DUP_KEY
-INSERT INTO m1 VALUES (3,2);
-DROP TABLE m1,t1;
-
---echo # Try to define MERGE and MyISAM with keys on different columns
-CREATE TABLE t1 (c1 INT, c2 INT, UNIQUE (c1));
-CREATE TABLE m1 (c1 INT, c2 INT, UNIQUE (c2)) ENGINE=MRG_MyISAM INSERT_METHOD=LAST UNION=(t1);
---echo # Try accessing the merge table for inserts (error occurs)
---error ER_WRONG_MRG_TABLE
-INSERT INTO m1 VALUES (1,2);
---error ER_WRONG_MRG_TABLE
-INSERT INTO m1 VALUES (1,4);
-DROP TABLE m1,t1;
-
-#
-#Bug #44040 MySQL allows creating a MERGE table upon VIEWs but crashes
-#when using it
-#
-
-CREATE TABLE t1 (
- col1 INT(10)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-
-CREATE VIEW v1 as SELECT * FROM t1;
-CREATE TABLE m1 (
- col1 INT(10)
-)ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(v1);
-
---echo #Select should detect that the child table is a view and fail.
---error ER_WRONG_MRG_TABLE
-SELECT * FROM m1;
-
-DROP VIEW v1;
-DROP TABLE m1, t1;
-
---echo #
---echo # Bug #45796: invalid memory reads and writes when altering merge and
---echo # base tables
---echo #
-
-CREATE TABLE t1(c1 INT) ENGINE=MyISAM;
-CREATE TABLE m1(c1 INT) ENGINE=MERGE UNION=(t1);
-ALTER TABLE m1 ADD INDEX idx_c1(c1);
-# Open the MERGE table and allocate buffers based on children's definition.
---error ER_WRONG_MRG_TABLE
-SELECT * FROM m1;
-# Change the child table definition.
-ALTER TABLE t1 ADD INDEX idx_c1(c1);
-# Check that old buffers are not reused
-SELECT * FROM m1;
-
-DROP TABLE m1;
-DROP TABLE t1;
-
---echo #
---echo # Bug45781 infinite hang/crash in "opening tables" after handler tries to
---echo # open merge table
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS m1,t1;
---enable_warnings
-
-CREATE TABLE t1(a int)engine=myisam;
-CREATE TABLE t2(a int)engine=myisam;
-CREATE TABLE t3(a int)engine=myisam;
-CREATE TABLE t4(a int)engine=myisam;
-CREATE TABLE t5(a int)engine=myisam;
-CREATE TABLE t6(a int)engine=myisam;
-CREATE TABLE t7(a int)engine=myisam;
-CREATE TABLE m1(a int)engine=merge union=(t1,t2,t3,t4,t5,t6,t7);
-SELECT 1 FROM m1;
---error ER_ILLEGAL_HA
-HANDLER m1 OPEN;
-DROP TABLE m1,t1,t2,t3,t4,t5,t6,t7;
---error ER_NO_SUCH_TABLE
-SELECT 1 FROM m1; # Should not hang!
-
---echo #
---echo # Bug #46614: Assertion in show_create_trigger()
---echo #
-CREATE TABLE t1(a int);
-CREATE TABLE t2(a int);
-CREATE TABLE t3(a int) ENGINE = MERGE UNION(t1, t2);
-CREATE TRIGGER tr1 AFTER INSERT ON t3 FOR EACH ROW CALL foo();
---replace_column 7 #
-SHOW CREATE TRIGGER tr1;
-DROP TRIGGER tr1;
-DROP TABLE t1, t2, t3;
-
---echo #
---echo # BUG#48265 - MRG_MYISAM problem (works in 5.0.85, does't work in 5.1.40)
---echo #
-CREATE DATABASE `test/1`;
-
-CREATE TABLE `test/1`.`t/1`(a INT);
-CREATE TABLE m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`);
-SELECT * FROM m1;
-SHOW CREATE TABLE m1;
-DROP TABLE m1;
-
-CREATE TABLE `test/1`.m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`);
-SELECT * FROM `test/1`.m1;
-SHOW CREATE TABLE `test/1`.m1;
-DROP TABLE `test/1`.m1;
-DROP TABLE `test/1`.`t/1`;
-
-CREATE TEMPORARY TABLE `test/1`.`t/1`(a INT);
-CREATE TEMPORARY TABLE m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`);
-SELECT * FROM m1;
-SHOW CREATE TABLE m1;
-DROP TABLE m1;
-
-CREATE TEMPORARY TABLE `test/1`.m1(a INT) ENGINE=MERGE UNION=(`test/1`.`t/1`);
-SELECT * FROM `test/1`.m1;
-SHOW CREATE TABLE `test/1`.m1;
-DROP TABLE `test/1`.m1;
-DROP TABLE `test/1`.`t/1`;
-
-DROP DATABASE `test/1`;
-
-# Test compatibility. Use '@' instead of '/' (was not allowed in 5.0)
-
-CREATE TABLE `t@1`(a INT);
-copy_file std_data/bug48265.frm $MYSQLD_DATADIR/test/m1.frm;
-write_file $MYSQLD_DATADIR/test/m1.MRG;
-t@1
-EOF
-SELECT * FROM m1;
-SHOW CREATE TABLE m1;
-DROP TABLE `t@1`;
-
-CREATE DATABASE `test@1`;
-CREATE TABLE `test@1`.`t@1`(a INT);
-FLUSH TABLE m1;
-remove_file $MYSQLD_DATADIR/test/m1.MRG;
-write_file $MYSQLD_DATADIR/test/m1.MRG;
-./test@1/t@1
-EOF
-SELECT * FROM m1;
-SHOW CREATE TABLE m1;
-DROP TABLE m1;
-DROP TABLE `test@1`.`t@1`;
-DROP DATABASE `test@1`;
-
---echo #
---echo # Bug#51494c rash with join, explain and 'sounds like' operator
---echo #
-
-CREATE TABLE t1 (a INT) ENGINE=MYISAM;
-INSERT INTO t1 VALUES(1);
-
-CREATE TABLE t2 (b INT NOT NULL,c INT,d INT,e BLOB NOT NULL,
-KEY idx0 (d, c)) ENGINE=MERGE;
-
-EXPLAIN SELECT * FROM t1 NATURAL RIGHT JOIN
-t2 WHERE b SOUNDS LIKE e AND d = 1;
-
-DROP TABLE t2, t1;
-
---echo #
---echo # Bug#46339 - crash on REPAIR TABLE merge table USE_FRM
---echo #
---disable_warnings
-DROP TABLE IF EXISTS m1, t1;
---enable_warnings
-#
-# Test derived from a proposal of Shane Bester.
-#
-CREATE TABLE t1 (c1 INT) ENGINE=MYISAM;
-CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1) INSERT_METHOD=LAST;
-#
-# REPAIR ... USE_FRM with LOCK TABLES.
-#
-LOCK TABLE m1 READ;
-REPAIR TABLE m1 USE_FRM;
-UNLOCK TABLES;
-#
-# REPAIR ... USE_FRM without LOCK TABLES.
-#
-# This statement crashed the server (Bug#46339).
-#
-REPAIR TABLE m1 USE_FRM;
-#
-DROP TABLE m1,t1;
-#
-# Test derived from a proposal of Matthias Leich.
-#
-# Base table is missing.
-#
-CREATE TABLE m1 (f1 BIGINT) ENGINE=MRG_MyISAM UNION(t1);
-#
-# This statement crashed the server (Bug#46339).
-#
-REPAIR TABLE m1 USE_FRM;
-#
-# Create base table.
-#
-CREATE TABLE t1 (f1 BIGINT) ENGINE = MyISAM;
-#
-# This statement crashed the server (Bug#46339).
-#
-REPAIR TABLE m1 USE_FRM;
-#
-# Normal repair as reference.
-#
-REPAIR TABLE m1;
-#
-# Cleanup.
-#
-DROP TABLE m1, t1;
-#
-# Same with temporary tables.
-#
-# Base table is missing.
-#
-CREATE TEMPORARY TABLE m1 (f1 BIGINT) ENGINE=MRG_MyISAM UNION(t1);
-#
-# This statement crashed the server (Bug#46339).
-#
-REPAIR TABLE m1 USE_FRM;
-#
-# Create base table.
-#
-CREATE TEMPORARY TABLE t1 (f1 BIGINT) ENGINE=MyISAM;
-#
-# This statement crashed the server (Bug#46339).
-#
-REPAIR TABLE m1 USE_FRM;
-#
-# Normal repair as reference.
-#
-REPAIR TABLE m1;
-#
-# Cleanup.
-#
-DROP TABLE m1, t1;
-
-#
-# MDEV-5266 MySQL:57657 - Temporary MERGE table with temporary underlying is broken by ALTER
-#
-create temporary table t1_temp(i int);
-create temporary table tm_temp_temp (i int) engine=merge union=(t1_temp) insert_method=last;
-alter table tm_temp_temp insert_method=first;
-check table tm_temp_temp;
-drop temporary table t1_temp, tm_temp_temp;
-
---echo End of 5.1 tests
-
---echo #
---echo # MDEV-4277: Crash inside mi_killed_in_mariadb() with myisammrg
---echo #
-create table t1 (a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t2 ( i int ) engine=myisam;
-insert into t2 values (1),(2);
-
-create table t3 (a int, b int, filler char(100), key(a), key(b)) engine=myisam;
-create table t4 like t3;
-insert into t3
- select A.a+10*B.a+100*C.a,
- A.a+10*B.a+100*C.a,
- 'filler-data-FILLER-DATA-qqq'
- from t1 A, t1 B, t1 C where C.a < 5;
-insert into t4
- select A.a+10*B.a+100*C.a,
- A.a+10*B.a+100*C.a,
- 'filler-data-FILLER-DATA-qqq'
- from t1 A, t1 B, t1 C where C.a >= 5;
-
-create table t5 like t3;
-alter table t5 engine=merge;
-alter table t5 union(t3, t4);
-
-update t5 set b=999, a=999 where b>950;
-
-explain
-select * from t2, t5 where t5.a=999 and t5.b=999;
-select * from t2, t5 where t5.a=999 and t5.b=999;
-
-drop table t5;
-drop table t1,t2,t3,t4;
-
---echo End of 5.3 tests
-
-#
-# BUG#35274 - merge table doesn't need any base tables, gives error 124 when
-# key accessed
-#
-CREATE TABLE t1(a INT, KEY(a)) ENGINE=merge;
-SELECT MAX(a) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # An additional test case for Bug#27430 Crash in subquery code
---echo # when in PS and table DDL changed after PREPARE
---echo #
---echo # Test merge table with too many merge children.
---echo #
---disable_warnings
-drop table if exists t_parent;
---enable_warnings
-set @save_table_open_cache=@@global.table_open_cache;
---echo #
---echo # Set @@global.table_open_cache to minimum
---echo #
-set @@global.table_open_cache=400;
-select @@table_open_cache;
-set @a=null;
-let $1 = `select @@table_open_cache;`;
---echo #
---echo # Create 400 merge children
---echo #
---disable_query_log
-while ($1)
-{
---disable_warnings
- eval drop table if exists t$1;
---enable_warnings
- eval create table t$1 (a int) engine=myisam;
- eval set @a=ifnull(concat(@a, ", ", "t$1"), "t$1");
- dec $1;
-}
---enable_query_log
-set @a=concat("create table t_parent (a int) union(", @a,
- ") insert_method=first engine=mrg_myisam");
-prepare stmt from @a;
-execute stmt;
-prepare stmt from "select * from t_parent";
---error ER_NEED_REPREPARE
-execute stmt;
---error ER_NEED_REPREPARE
-execute stmt;
---error ER_NEED_REPREPARE
-execute stmt;
-deallocate prepare stmt;
---echo #
---echo # Create merge parent
---echo #
-
---echo #
---echo # Cleanup
---echo #
-let $1 = `select @@table_open_cache;`;
---disable_query_log
-while ($1)
-{
- eval drop table t$1;
- dec $1;
-}
---enable_query_log
-drop table t_parent;
-set @@global.table_open_cache=@save_table_open_cache;
-
-#
-# WL#4144 - Lock MERGE engine children
-#
-# Test DATA/INDEX DIRECTORY
-#
---disable_warnings
-DROP DATABASE IF EXISTS mysql_test1;
---enable_warnings
-CREATE DATABASE mysql_test1;
---disable_query_log
-# data/index directory don't work in HAVE_purify builds. Disable
-# build-dependent warnings.
---disable_warnings
---echo CREATE TABLE t1 ... DATA DIRECTORY=... INDEX DIRECTORY=...
-eval CREATE TABLE t1 (c1 INT)
- DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp'
- INDEX DIRECTORY='$MYSQLTEST_VARDIR/tmp';
---echo CREATE TABLE mysql_test1.t2 ... DATA DIRECTORY=... INDEX DIRECTORY=...
-eval CREATE TABLE mysql_test1.t2 (c1 INT)
- DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp'
- INDEX DIRECTORY='$MYSQLTEST_VARDIR/tmp';
---enable_query_log
---enable_warnings
-CREATE TABLE m1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1,mysql_test1.t2)
- INSERT_METHOD=LAST;
-INSERT INTO t1 VALUES (1);
-INSERT INTO mysql_test1.t2 VALUES (2);
-SELECT * FROM m1;
-#--copy_file $MYSQLTEST_DATADIR/test/m1.MRG /tmp/mysql-test-m1.MRG
-DROP TABLE t1, mysql_test1.t2, m1;
-DROP DATABASE mysql_test1;
-#
-# Review detected Crash #1. Detaching main tables while in sub statement.
-#
-CREATE TABLE t1 (c1 INT);
-CREATE TABLE t2 (c1 INT);
-INSERT INTO t1 (c1) VALUES (1);
-CREATE TABLE tm1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1,t2) INSERT_METHOD=FIRST;
-CREATE TABLE t3 (c1 INT);
-INSERT INTO t3 (c1) VALUES (1);
-CREATE FUNCTION f1() RETURNS INT RETURN (SELECT MAX(c1) FROM t3);
-CREATE VIEW v1 AS SELECT foo.c1 c1, f1() c2, bar.c1 c3, f1() c4
- FROM tm1 foo, tm1 bar, t3;
-SELECT * FROM v1;
-DROP FUNCTION f1;
-DROP VIEW v1;
-DROP TABLE tm1, t1, t2, t3;
-#
-# Review detected Crash #2. Trying to attach temporary table twice.
-#
-CREATE TEMPORARY TABLE t1 (c1 INT);
-CREATE TEMPORARY TABLE t2 (c1 INT);
-CREATE TEMPORARY TABLE tm1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1,t2)
- INSERT_METHOD=FIRST;
-CREATE FUNCTION f1() RETURNS INT RETURN (SELECT MAX(c1) FROM tm1);
-INSERT INTO tm1 (c1) VALUES (1);
-SELECT f1() FROM (SELECT 1) AS c1;
-DROP FUNCTION f1;
-DROP TABLE tm1, t1, t2;
-#
-# Review suggested test. DDL in a stored function.
-#
-DELIMITER |;
-CREATE FUNCTION f1() RETURNS INT
-BEGIN
- CREATE TEMPORARY TABLE t1 (c1 INT);
- CREATE TEMPORARY TABLE t2 (c1 INT);
- CREATE TEMPORARY TABLE tm1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1,t2);
- INSERT INTO t1 (c1) VALUES (1);
- RETURN (SELECT MAX(c1) FROM tm1);
-END|
-DELIMITER ;|
-SELECT f1() FROM (SELECT 1 UNION SELECT 1) c1;
-DROP FUNCTION f1;
-DROP TABLE tm1, t1, t2;
-#
-# Base table. No LOCK TABLES, no functions/triggers.
-#
-CREATE TABLE t1 (c1 INT) ENGINE=MyISAM;
-CREATE TABLE tm1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1) INSERT_METHOD=LAST;
-INSERT INTO tm1 VALUES (1);
-SELECT * FROM tm1;
-DROP TABLE tm1, t1;
-#
-# Base table. No LOCK TABLES, sub-statement that is run inside a function.
-#
-DELIMITER |;
-CREATE FUNCTION f1() RETURNS INT
-BEGIN
- INSERT INTO tm1 VALUES (1);
- RETURN (SELECT MAX(c1) FROM tm1);
-END|
-DELIMITER ;|
-CREATE TABLE t1 (c1 INT) ENGINE=MyISAM;
-CREATE TABLE tm1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1) INSERT_METHOD=LAST;
-SELECT f1();
-DROP FUNCTION f1;
-DROP TABLE tm1, t1;
-#
-# Base table. LOCK TABLES, no functions/triggers.
-#
-CREATE TABLE t1 (c1 INT) ENGINE=MyISAM;
-CREATE TABLE tm1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1) INSERT_METHOD=LAST;
-LOCK TABLE tm1 WRITE;
-INSERT INTO tm1 VALUES (1);
-SELECT * FROM tm1;
-UNLOCK TABLES;
-DROP TABLE tm1, t1;
-#
-# Base table. LOCK TABLES, sub-statement that is run inside a function.
-#
-DELIMITER |;
-CREATE FUNCTION f1() RETURNS INT
-BEGIN
- INSERT INTO tm1 VALUES (1);
- RETURN (SELECT MAX(c1) FROM tm1);
-END|
-DELIMITER ;|
-CREATE TABLE t1 (c1 INT) ENGINE=MyISAM;
-CREATE TABLE tm1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1) INSERT_METHOD=LAST;
-LOCK TABLE tm1 WRITE;
-SELECT f1();
-UNLOCK TABLES;
-DROP FUNCTION f1;
-DROP TABLE tm1, t1;
-#
-# Base table. LOCK TABLES statement that locks a table that has a trigger
-# that inserts into a merge table, so an attempt is made to lock tables
-# of a sub-statement.
-#
-CREATE TABLE t1 (c1 INT) ENGINE=MyISAM;
-CREATE TABLE t2 (c1 INT) ENGINE=MyISAM;
-CREATE TABLE tm1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1) INSERT_METHOD=LAST;
-CREATE TRIGGER t2_ai AFTER INSERT ON t2
- FOR EACH ROW INSERT INTO tm1 VALUES(11);
-LOCK TABLE t2 WRITE;
-INSERT INTO t2 VALUES (2);
-SELECT * FROM tm1;
-SELECT * FROM t2;
-UNLOCK TABLES;
-DROP TRIGGER t2_ai;
-DROP TABLE tm1, t1, t2;
-#
-# Temporary. No LOCK TABLES, no functions/triggers.
-#
-CREATE TEMPORARY TABLE t1 (c1 INT) ENGINE=MyISAM;
-CREATE TEMPORARY TABLE tm1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1)
- INSERT_METHOD=LAST;
-INSERT INTO tm1 VALUES (1);
-SELECT * FROM tm1;
-DROP TABLE tm1, t1;
-#
-# Temporary. No LOCK TABLES, sub-statement that is run inside a function.
-#
-DELIMITER |;
-CREATE FUNCTION f1() RETURNS INT
-BEGIN
- INSERT INTO tm1 VALUES (1);
- RETURN (SELECT MAX(c1) FROM tm1);
-END|
-DELIMITER ;|
-CREATE TEMPORARY TABLE t1 (c1 INT) ENGINE=MyISAM;
-CREATE TEMPORARY TABLE tm1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1)
- INSERT_METHOD=LAST;
-SELECT f1();
-DROP FUNCTION f1;
-DROP TABLE tm1, t1;
-#
-# Temporary. LOCK TABLES, no functions/triggers.
-#
-CREATE TEMPORARY TABLE t1 (c1 INT) ENGINE=MyISAM;
-CREATE TEMPORARY TABLE tm1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1)
- INSERT_METHOD=LAST;
-CREATE TABLE t9 (c1 INT) ENGINE=MyISAM;
-LOCK TABLE t9 WRITE;
-INSERT INTO tm1 VALUES (1);
-SELECT * FROM tm1;
-UNLOCK TABLES;
-DROP TABLE tm1, t1, t9;
-#
-# Temporary. LOCK TABLES, sub-statement that is run inside a function.
-#
-DELIMITER |;
-CREATE FUNCTION f1() RETURNS INT
-BEGIN
- INSERT INTO tm1 VALUES (1);
- RETURN (SELECT MAX(c1) FROM tm1);
-END|
-DELIMITER ;|
-CREATE TEMPORARY TABLE t1 (c1 INT) ENGINE=MyISAM;
-CREATE TEMPORARY TABLE tm1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1)
- INSERT_METHOD=LAST;
-CREATE TABLE t9 (c1 INT) ENGINE=MyISAM;
-LOCK TABLE t9 WRITE;
-SELECT f1();
-UNLOCK TABLES;
-DROP FUNCTION f1;
-DROP TABLE tm1, t1, t9;
-#
-# Temporary. LOCK TABLES statement that locks a table that has a trigger
-# that inserts into a merge table, so an attempt is made to lock tables
-# of a sub-statement.
-#
-CREATE TEMPORARY TABLE t1 (c1 INT) ENGINE=MyISAM;
-CREATE TEMPORARY TABLE tm1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1)
- INSERT_METHOD=LAST;
-CREATE TABLE t2 (c1 INT) ENGINE=MyISAM;
-CREATE TRIGGER t2_ai AFTER INSERT ON t2
- FOR EACH ROW INSERT INTO tm1 VALUES(11);
-LOCK TABLE t2 WRITE;
-INSERT INTO t2 VALUES (2);
-SELECT * FROM tm1;
-SELECT * FROM t2;
-UNLOCK TABLES;
-DROP TRIGGER t2_ai;
-DROP TABLE tm1, t1, t2;
---echo #
---echo # Don't allow an update of a MERGE child in a trigger
---echo # if the table's already being modified by the main
---echo # statement.
---echo #
-CREATE TABLE t1 (c1 INT) ENGINE=MyISAM;
-CREATE TABLE tm1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1)
- INSERT_METHOD=LAST;
-CREATE TRIGGER tm1_ai AFTER INSERT ON tm1
- FOR EACH ROW INSERT INTO t1 VALUES(11);
-LOCK TABLE tm1 WRITE, t1 WRITE;
---error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
-INSERT INTO tm1 VALUES (1);
-SELECT * FROM tm1;
-UNLOCK TABLES;
-LOCK TABLE t1 WRITE, tm1 WRITE;
---error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
-INSERT INTO tm1 VALUES (1);
-SELECT * FROM tm1;
-UNLOCK TABLES;
-DROP TRIGGER tm1_ai;
-DROP TABLE tm1, t1;
-
---echo #
---echo # Don't select MERGE child when trying to get a prelocked table.
---echo #
---echo # Due to a limitation demonstrated by the previous test
---echo # we can no longer use a write-locked prelocked table.
---echo # The test is kept for historical purposes.
---echo #
-CREATE TABLE t1 (c1 INT) ENGINE=MyISAM;
-CREATE TABLE tm1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1)
- INSERT_METHOD=LAST;
-CREATE TRIGGER tm1_ai AFTER INSERT ON tm1
- FOR EACH ROW SELECT max(c1) FROM t1 INTO @var;
-LOCK TABLE tm1 WRITE, t1 WRITE;
-INSERT INTO tm1 VALUES (1);
-SELECT * FROM tm1;
-UNLOCK TABLES;
-LOCK TABLE t1 WRITE, tm1 WRITE;
-INSERT INTO tm1 VALUES (1);
-SELECT * FROM tm1;
-UNLOCK TABLES;
-DROP TRIGGER tm1_ai;
-DROP TABLE tm1, t1;
-
-# Don't resurrect chopped off prelocked tables.
-# The problem is not visible by test results; only by debugging.
-#
-CREATE TABLE t1 (c1 INT) ENGINE=MyISAM;
-CREATE TABLE t2 (c1 INT) ENGINE=MyISAM;
-CREATE TABLE t3 (c1 INT) ENGINE=MyISAM;
-CREATE TABLE t4 (c1 INT) ENGINE=MyISAM;
-CREATE TABLE t5 (c1 INT) ENGINE=MyISAM;
-CREATE TABLE tm1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1,t2,t3,t4,t5)
- INSERT_METHOD=LAST;
-CREATE TRIGGER t2_au AFTER UPDATE ON t2
- FOR EACH ROW SELECT MAX(c1) FROM t1 INTO @var;
-CREATE FUNCTION f1() RETURNS INT
- RETURN (SELECT MAX(c1) FROM t4);
-LOCK TABLE tm1 WRITE, t1 WRITE, t2 WRITE, t3 WRITE, t4 WRITE, t5 WRITE;
-INSERT INTO t1 VALUES(1);
-INSERT INTO t2 VALUES(2);
-INSERT INTO t3 VALUES(3);
-INSERT INTO t4 VALUES(4);
-INSERT INTO t5 VALUES(5);
- connect (con1,localhost,root,,);
- send UPDATE t2, tm1 SET t2.c1=f1();
-connection default;
-# Force reopen in other thread.
-#sleep 1;
-FLUSH TABLES;
-#sleep 1;
-FLUSH TABLES;
-#sleep 1;
-UNLOCK TABLES;
- connection con1;
- reap;
- disconnect con1;
-connection default;
-SELECT * FROM tm1;
-DROP TRIGGER t2_au;
-DROP FUNCTION f1;
-DROP TABLE tm1, t1, t2, t3, t4, t5;
-
---echo #
---echo # Bug#47633 - assert in ha_myisammrg::info during OPTIMIZE
---echo #
-CREATE TEMPORARY TABLE t1 (c1 INT);
-ALTER TABLE t1 ENGINE=MERGE UNION(t_not_exists,t1);
-OPTIMIZE TABLE t1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#36171 - CREATE TEMPORARY TABLE and MERGE engine
---echo # More tests with TEMPORARY MERGE table and permanent children.
---echo # First without locked tables.
---echo #
---disable_warnings
-DROP TABLE IF EXISTS t1, t2, t3, t4, m1, m2;
---enable_warnings
-#
---echo #
-CREATE TABLE t1 (c1 INT, c2 INT) ENGINE=MyISAM;
-CREATE TABLE t2 (c1 INT, c2 INT) ENGINE=MyISAM;
-CREATE TEMPORARY TABLE m1 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
- INSERT_METHOD=LAST;
-SHOW CREATE TABLE t1;
-SHOW CREATE TABLE m1;
-SELECT * FROM m1;
-INSERT INTO t1 VALUES (111, 121);
-INSERT INTO m1 VALUES (211, 221);
-SELECT * FROM m1;
-SELECT * FROM t1;
-SELECT * FROM t2;
-#
---echo #
-ALTER TABLE m1 RENAME m2;
-SHOW CREATE TABLE m2;
-SELECT * FROM m2;
-#
---echo #
-CREATE TEMPORARY TABLE m1 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
- INSERT_METHOD=LAST;
---error ER_TABLE_EXISTS_ERROR
-ALTER TABLE m2 RENAME m1;
-DROP TABLE m1;
-ALTER TABLE m2 RENAME m1;
-SHOW CREATE TABLE m1;
-SELECT * FROM m1;
-#
---echo #
-ALTER TABLE m1 ADD COLUMN c3 INT;
---error ER_WRONG_MRG_TABLE
-INSERT INTO m1 VALUES (212, 222, 232);
---error ER_WRONG_MRG_TABLE
-SELECT * FROM m1;
-ALTER TABLE t1 ADD COLUMN c3 INT;
-ALTER TABLE t2 ADD COLUMN c3 INT;
-INSERT INTO m1 VALUES (212, 222, 232);
-SELECT * FROM m1;
-#
---echo #
-ALTER TABLE m1 DROP COLUMN c3;
---error ER_WRONG_MRG_TABLE
-INSERT INTO m1 VALUES (213, 223);
---error ER_WRONG_MRG_TABLE
-SELECT * FROM m1;
-ALTER TABLE t1 DROP COLUMN c3;
-ALTER TABLE t2 DROP COLUMN c3;
-INSERT INTO m1 VALUES (213, 223);
-SELECT * FROM m1;
-#
---echo #
-CREATE TABLE t3 (c1 INT, c2 INT) ENGINE=MyISAM;
-ALTER TABLE m1 UNION=(t1,t2,t3);
-INSERT INTO m1 VALUES (311, 321);
-SELECT * FROM m1;
-SELECT * FROM t1;
-SELECT * FROM t2;
-SELECT * FROM t3;
-#
---echo #
-CREATE TEMPORARY TABLE t4 (c1 INT, c2 INT) ENGINE=MyISAM;
-ALTER TABLE m1 UNION=(t1,t2,t3,t4);
-INSERT INTO m1 VALUES (411, 421);
-SELECT * FROM m1;
-SELECT * FROM t1;
-SELECT * FROM t2;
-SELECT * FROM t3;
-SELECT * FROM t4;
-#
---echo #
-ALTER TABLE m1 ENGINE=MyISAM;
-SHOW CREATE TABLE m1;
-INSERT INTO m1 VALUES (511, 521);
-SELECT * FROM m1;
-#
---echo #
-ALTER TABLE m1 ENGINE=MRG_MyISAM UNION=(t1,t2)
- INSERT_METHOD=LAST;
-SELECT * FROM m1;
-SELECT * FROM t1;
-SELECT * FROM t2;
-#
---echo #
-CREATE TEMPORARY TABLE t1 (c1 INT, c2 INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (611, 621);
-SELECT * FROM m1;
-DROP TABLE t1;
-SELECT * FROM m1;
-#
-#
---echo #
---echo #
-SHOW CREATE TABLE m1;
-#
---echo #
-CREATE TABLE m2 SELECT * FROM m1;
-SHOW CREATE TABLE m2;
-SELECT * FROM m2;
-DROP TABLE m2;
-#
---echo #
-CREATE TEMPORARY TABLE m2 SELECT * FROM m1;
-SHOW CREATE TABLE m2;
-SELECT * FROM m2;
-DROP TABLE m2;
-#
---echo #
-CREATE TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
- INSERT_METHOD=LAST;
---error ER_WRONG_MRG_TABLE
-SELECT * FROM m2;
-DROP TABLE m2;
-#
---echo #
---error ER_WRONG_OBJECT
-CREATE TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
- INSERT_METHOD=LAST SELECT * FROM m1;
-#
---echo #
---error ER_WRONG_OBJECT
-CREATE TEMPORARY TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
- INSERT_METHOD=LAST SELECT * FROM m1;
-#
---echo #
-CREATE TABLE m2 LIKE m1;
-SHOW CREATE TABLE m2;
-SELECT * FROM m2;
-INSERT INTO m2 SELECT * FROM m1;
-SELECT * FROM m2;
-DROP TABLE m2;
-#
---echo #
-CREATE TEMPORARY TABLE m2 LIKE m1;
-SHOW CREATE TABLE m2;
-SELECT * FROM m2;
-INSERT INTO m2 SELECT * FROM m1;
-SELECT * FROM m2;
-DROP TABLE m2;
-#
---echo #
-CREATE TEMPORARY TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
- INSERT_METHOD=LAST;
-INSERT INTO m2 SELECT * FROM m1;
-SELECT * FROM m2;
-#
-#
---echo #
---echo #
-LOCK TABLE m1 WRITE, m2 WRITE;
-SELECT * FROM m1,m2 WHERE m1.c1=m2.c1;
-UNLOCK TABLES;
-#
-DROP TABLE t1, t2, t3, t4, m1, m2;
-#
-#
-#
---echo #
---echo # Bug#36171 - CREATE TEMPORARY TABLE and MERGE engine
---echo # More tests with TEMPORARY MERGE table and permanent children.
---echo # (continued) Now the same with locked table.
---echo #
-CREATE TABLE t1 (c1 INT, c2 INT) ENGINE=MyISAM;
-CREATE TABLE t2 (c1 INT, c2 INT) ENGINE=MyISAM;
-CREATE TEMPORARY TABLE m1 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
- INSERT_METHOD=LAST;
-SHOW CREATE TABLE t1;
-SHOW CREATE TABLE m1;
-SELECT * FROM m1;
-INSERT INTO t1 VALUES (111, 121);
-INSERT INTO m1 VALUES (211, 221);
-SELECT * FROM m1;
-SELECT * FROM t1;
-SELECT * FROM t2;
-#
---echo #
-LOCK TABLE m1 WRITE, t1 WRITE, t2 WRITE;
-#
---echo #
-ALTER TABLE m1 RENAME m2;
-SHOW CREATE TABLE m2;
-SELECT * FROM m2;
-#
---echo #
-CREATE TEMPORARY TABLE m1 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
- INSERT_METHOD=LAST;
---error ER_TABLE_EXISTS_ERROR
-ALTER TABLE m2 RENAME m1;
-DROP TABLE m1;
-ALTER TABLE m2 RENAME m1;
-SHOW CREATE TABLE m1;
-SELECT * FROM m1;
-#
---echo #
-ALTER TABLE m1 ADD COLUMN c3 INT;
---error ER_WRONG_MRG_TABLE
-INSERT INTO m1 VALUES (212, 222, 232);
---error ER_WRONG_MRG_TABLE
-SELECT * FROM m1;
-ALTER TABLE t1 ADD COLUMN c3 INT;
-ALTER TABLE t2 ADD COLUMN c3 INT;
-INSERT INTO m1 VALUES (212, 222, 232);
-SELECT * FROM m1;
-#
---echo #
-ALTER TABLE m1 DROP COLUMN c3;
---error ER_WRONG_MRG_TABLE
-INSERT INTO m1 VALUES (213, 223);
---error ER_WRONG_MRG_TABLE
-SELECT * FROM m1;
-ALTER TABLE t1 DROP COLUMN c3;
-ALTER TABLE t2 DROP COLUMN c3;
-INSERT INTO m1 VALUES (213, 223);
-SELECT * FROM m1;
-#
---echo #
-UNLOCK TABLES;
-CREATE TABLE t3 (c1 INT, c2 INT) ENGINE=MyISAM;
-ALTER TABLE m1 UNION=(t1,t2,t3);
-LOCK TABLE m1 WRITE;
-INSERT INTO m1 VALUES (311, 321);
-SELECT * FROM m1;
-SELECT * FROM t1;
-SELECT * FROM t2;
-SELECT * FROM t3;
-#
---echo #
-CREATE TEMPORARY TABLE t4 (c1 INT, c2 INT) ENGINE=MyISAM;
-ALTER TABLE m1 UNION=(t1,t2,t3,t4);
-INSERT INTO m1 VALUES (411, 421);
-SELECT * FROM m1;
-SELECT * FROM t1;
-SELECT * FROM t2;
-SELECT * FROM t3;
-SELECT * FROM t4;
-#
---echo #
-ALTER TABLE m1 ENGINE=MyISAM;
-SHOW CREATE TABLE m1;
-INSERT INTO m1 VALUES (511, 521);
-SELECT * FROM m1;
-#
---echo #
-ALTER TABLE m1 ENGINE=MRG_MyISAM UNION=(t1,t2)
- INSERT_METHOD=LAST;
-SELECT * FROM m1;
-SELECT * FROM t1;
-SELECT * FROM t2;
-#
---echo #
-CREATE TEMPORARY TABLE t1 (c1 INT, c2 INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (611, 621);
-SELECT * FROM m1;
-DROP TABLE t1;
-SELECT * FROM m1;
-#
-#
---echo #
---echo #
-SHOW CREATE TABLE m1;
---error ER_TABLE_NOT_LOCKED
-CREATE TABLE m2 SELECT * FROM m1;
-#
---echo #
-CREATE TEMPORARY TABLE m2 SELECT * FROM m1;
-SHOW CREATE TABLE m2;
-SELECT * FROM m2;
-DROP TABLE m2;
-#
---echo #
-CREATE TEMPORARY TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
- INSERT_METHOD=LAST;
-SELECT * FROM m2;
-LOCK TABLE m1 WRITE, m2 WRITE;
-UNLOCK TABLES;
-DROP TABLE m2;
-LOCK TABLE m1 WRITE;
-#
---echo #
---echo # ER_TABLE_NOT_LOCKED is returned in ps-protocol
---error ER_WRONG_OBJECT, ER_TABLE_NOT_LOCKED
-CREATE TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
- INSERT_METHOD=LAST SELECT * FROM m1;
-#
---echo #
---error ER_WRONG_OBJECT
-CREATE TEMPORARY TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
- INSERT_METHOD=LAST SELECT * FROM m1;
-#
---echo #
-CREATE TEMPORARY TABLE m2 LIKE m1;
-SHOW CREATE TABLE m2;
-LOCK TABLE m1 WRITE, m2 WRITE;
-SHOW CREATE TABLE m2;
-SELECT * FROM m2;
-INSERT INTO m2 SELECT * FROM m1;
-SELECT * FROM m2;
-DROP TABLE m2;
-#
---echo #
-CREATE TEMPORARY TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
- INSERT_METHOD=LAST;
-LOCK TABLE m1 WRITE, m2 WRITE;
-INSERT INTO m2 SELECT * FROM m1;
-SELECT * FROM m2;
-#
---echo #
-UNLOCK TABLES;
-DROP TABLE t1, t2, t3, t4, m1, m2;
-
---echo #
---echo # Bug47098 assert in MDL_context::destroy on HANDLER
---echo # <damaged merge table> OPEN
---echo #
---echo # Test that merge tables are closed correctly when opened using
---echo # HANDLER ... OPEN.
---echo # The general case.
---disable_warnings
-DROP TABLE IF EXISTS t1, t2, t3;
---enable_warnings
-connect (con1,localhost,root,,);
-CREATE TABLE t1 (c1 int);
-CREATE TABLE t2 (c1 int);
-CREATE TABLE t3 (c1 int) ENGINE = MERGE UNION (t1,t2);
-START TRANSACTION;
---error ER_ILLEGAL_HA
-HANDLER t3 OPEN;
-DROP TABLE t1, t2, t3;
-connection default;
---echo # all mdl_tickets must have been released.
-disconnect con1;
---echo # The bug-specific case.
-connect (con1,localhost,root,,);
-CREATE TABLE t1 (c1 int);
-CREATE TABLE t2 (c1 int);
-CREATE TABLE t3 (c1 int) ENGINE = MERGE UNION (t1,t2);
-DROP TABLE t2;
-START TRANSACTION;
---error ER_WRONG_MRG_TABLE
-HANDLER t3 OPEN;
-DROP TABLE t1, t3;
-connection default;
---echo # all mdl_tickets must have been released.
-disconnect con1;
-
---echo #
---echo # A test case for Bug#47648 main.merge fails sporadically
---echo #
---echo # Make sure we correctly maintain lex->query_tables_last_own.
---echo #
-create table t1 (c1 int not null);
-create table t2 (c1 int not null);
-create table t3 (c1 int not null);
-
-create function f1 () returns int return (select max(c1) from t3);
-
-create table t4 (c1 int not null) engine=merge union=(t1,t2) insert_method=last ;
-
-select * from t4 where c1 < f1();
-prepare stmt from "select * from t4 where c1 < f1()";
-execute stmt;
-execute stmt;
-execute stmt;
-drop function f1;
---error ER_SP_DOES_NOT_EXIST
-execute stmt;
---error ER_SP_DOES_NOT_EXIST
-execute stmt;
-drop table t4, t3, t2, t1;
-
-
---echo #
---echo # Bug#51240 ALTER TABLE of a locked MERGE table fails
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS m1, t1;
---enable_warnings
-
-CREATE TABLE t1 (c1 INT);
-CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1);
-LOCK TABLE m1 WRITE;
-# This used to cause an error.
-ALTER TABLE m1 ADD INDEX (c1);
-
-UNLOCK TABLES;
-DROP TABLE m1, t1;
-
---echo #
---echo # Locking the merge table won't implicitly lock children.
---echo #
-CREATE TABLE t1 (c1 INT);
-CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1);
-LOCK TABLE m1 WRITE;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-ALTER TABLE t1 ADD INDEX (c1);
-LOCK TABLE m1 WRITE, t1 WRITE;
-ALTER TABLE t1 ADD INDEX (c1);
-UNLOCK TABLES;
-DROP TABLE m1, t1;
-
---echo #
---echo # Test for bug #37371 "CREATE TABLE LIKE merge loses UNION parameter"
---echo #
---disable_warnings
-drop tables if exists t1, m1, m2;
---enable_warnings
-create table t1 (i int) engine=myisam;
-create table m1 (i int) engine=mrg_myisam union=(t1) insert_method=first;
-create table m2 like m1;
---echo # Table definitions should match
-show create table m1;
-show create table m2;
-drop tables m1, m2, t1;
-
---echo #
---echo # Test case for Bug#54811 "Assert in mysql_lock_have_duplicate()"
---echo # Check that unique_table() works correctly for merge tables.
---echo #
---disable_warnings
-drop table if exists t1, t2, t3, m1, m2;
---enable_warnings
-create table t1 (a int);
-create table t2 (a int);
-create table t3 (b int);
-create view v1 as select * from t3,t1;
-create table m1 (a int) engine=merge union (t1, t2) insert_method=last;
-create table m2 (a int) engine=merge union (t1, t2) insert_method=first;
-create temporary table tmp (b int);
-insert into tmp (b) values (1);
-
-insert into t1 (a) values (1);
-insert into t3 (b) values (1);
---error ER_UPDATE_TABLE_USED
-insert into m1 (a) values ((select max(a) from m1));
---error ER_UPDATE_TABLE_USED
-insert into m1 (a) values ((select max(a) from m2));
---error ER_UPDATE_TABLE_USED
-insert into m1 (a) values ((select max(a) from t1));
---error ER_UPDATE_TABLE_USED
-insert into m1 (a) values ((select max(a) from t2));
-
---error ER_UPDATE_TABLE_USED
-insert into m1 (a) values ((select max(a) from t3, m1));
---error ER_UPDATE_TABLE_USED
-insert into m1 (a) values ((select max(a) from t3, m2));
---error ER_UPDATE_TABLE_USED
-insert into m1 (a) values ((select max(a) from t3, t1));
---error ER_UPDATE_TABLE_USED
-insert into m1 (a) values ((select max(a) from t3, t2));
-
---error ER_UPDATE_TABLE_USED
-insert into m1 (a) values ((select max(a) from tmp, m1));
---error ER_UPDATE_TABLE_USED
-insert into m1 (a) values ((select max(a) from tmp, m2));
---error ER_UPDATE_TABLE_USED
-insert into m1 (a) values ((select max(a) from tmp, t1));
---error ER_UPDATE_TABLE_USED
-insert into m1 (a) values ((select max(a) from tmp, t2));
-
---error ER_VIEW_PREVENT_UPDATE
-insert into m1 (a) values ((select max(a) from v1));
---error ER_VIEW_PREVENT_UPDATE
-insert into m1 (a) values ((select max(a) from tmp, v1));
-
-
-drop view v1;
-drop temporary table tmp;
-drop table t1, t2, t3, m1, m2;
-
-
---echo #
---echo # Bug#56494 Segfault in upgrade_shared_lock_to_exclusive() for
---echo # REPAIR of merge table
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2, t_not_exists;
---enable_warnings
-
-CREATE TABLE t1(a INT);
-ALTER TABLE t1 engine= MERGE UNION (t_not_exists);
-# This caused the segfault
-ANALYZE TABLE t1;
-CHECK TABLE t1;
-CHECKSUM TABLE t1;
-OPTIMIZE TABLE t1;
-REPAIR TABLE t1;
-
-# This caused an assert
-REPAIR TABLE t1 USE_FRM;
-
-DROP TABLE t1;
-CREATE TABLE t1(a INT);
-CREATE TABLE t2(a INT) engine= MERGE UNION (t1);
-# This caused an assert
-REPAIR TABLE t2 USE_FRM;
-
-DROP TABLE t1, t2;
-
-
---echo #
---echo # Bug#57002 Assert in upgrade_shared_lock_to_exclusive()
---echo # for ALTER TABLE + MERGE tables
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1, m1;
---enable_warnings
-
-CREATE TABLE t1(a INT) engine=myisam;
-CREATE TABLE m1(a INT) engine=merge UNION(t1);
-LOCK TABLES t1 READ, m1 WRITE;
-
-# This caused an assert
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-ALTER TABLE t1 engine=myisam;
-
-UNLOCK TABLES;
-DROP TABLE m1, t1;
-
-
---echo #
---echo # Test for bug #11754210 - "45777: CHECK TABLE DOESN'T SHOW ALL
---echo # PROBLEMS FOR MERGE TABLE COMPLIANCE IN 5.1"
---echo #
---disable_warnings
-drop tables if exists t1, t2, t3, t4, m1;
---enable_warnings
-create table t1(id int) engine=myisam;
-create view t3 as select 1 as id;
-create table t4(id int) engine=memory;
-create table m1(id int) engine=merge union=(t1,t2,t3,t4);
---error ER_WRONG_MRG_TABLE
-select * from m1;
---echo # The below CHECK and REPAIR TABLE statements should
---echo # report all problems with underlying tables:
---echo # - absence of 't2',
---echo # - missing base table for 't3',
---echo # - wrong engine of 't4'.
-check table m1;
-repair table m1;
---echo # Clean-up.
-drop tables m1, t1, t4;
-drop view t3;
-
-
---echo #
---echo # MDEV-10424 - Assertion `ticket == __null' failed in
---echo # MDL_request::set_type
---echo #
-CREATE TABLE t1 (f1 INT) ENGINE=MyISAM;
-CREATE TABLE tmerge (f1 INT) ENGINE=MERGE UNION=(t1);
-PREPARE stmt FROM "ANALYZE TABLE tmerge, t1";
-EXECUTE stmt;
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-DROP TABLE t1, tmerge;
-
-
---echo End of 5.5 tests
-
-
---echo #
---echo # Additional coverage for refactoring which is made as part
---echo # of fix for bug #27480 "Extend CREATE TEMPORARY TABLES privilege
---echo # to allow temp table operations".
---echo #
---echo # Check that prelocking works correctly for various variants of
---echo # merge tables.
---disable_warnings
-drop table if exists t1, t2, m1;
-drop function if exists f1;
---enable_warnings
-create table t1 (j int);
-insert into t1 values (1);
-create function f1() returns int return (select count(*) from m1);
-create temporary table t2 (a int) engine=myisam;
-insert into t2 values (1);
-create temporary table m1 (a int) engine=merge union=(t2);
-select f1() from t1;
-drop tables t2, m1;
-create table t2 (a int) engine=myisam;
-insert into t2 values (1);
-create table m1 (a int) engine=merge union=(t2);
-select f1() from t1;
-drop table m1;
-create temporary table m1 (a int) engine=merge union=(t2);
-select f1() from t1;
-drop tables t1, t2, m1;
-drop function f1;
---echo #
---echo # Check that REPAIR/CHECK and CHECKSUM statements work correctly
---echo # for various variants of merge tables.
-create table t1 (a int) engine=myisam;
-insert into t1 values (1);
-create table m1 (a int) engine=merge union=(t1);
-check table m1;
-repair table m1;
-checksum table m1;
-drop tables t1, m1;
-create temporary table t1 (a int) engine=myisam;
-insert into t1 values (1);
-create temporary table m1 (a int) engine=merge union=(t1);
-check table m1;
-repair table m1;
-checksum table m1;
-drop tables t1, m1;
-create table t1 (a int) engine=myisam;
-insert into t1 values (1);
-create temporary table m1 (a int) engine=merge union=(t1);
-check table m1;
-repair table m1;
-checksum table m1;
-drop tables t1, m1;
-
-# Check effect of Bug#27480-preliminary patch:
-# a merge-table with non-existing children, opened from a prelocked list.
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS m1;
-DROP TRIGGER IF EXISTS trg1;
-DROP TABLE IF EXISTS q1;
-DROP TABLE IF EXISTS q2;
---enable_warnings
-
-CREATE TABLE t1(a INT);
-CREATE TABLE m1(a INT) ENGINE = MERGE UNION (q1, q2);
-
-CREATE TRIGGER trg1 BEFORE DELETE ON t1
-FOR EACH ROW
- INSERT INTO m1 VALUES (1);
-
---error ER_WRONG_MRG_TABLE
-DELETE FROM t1;
-
-DROP TRIGGER trg1;
-DROP TABLE t1;
-DROP TABLE m1;
-
---disable_result_log
---disable_query_log
-eval set global storage_engine=$default;
---enable_result_log
---enable_query_log
-
-# 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
diff --git a/mysql-test/t/merge_debug.test b/mysql-test/t/merge_debug.test
deleted file mode 100644
index 3c617cfc545..00000000000
--- a/mysql-test/t/merge_debug.test
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# Test failures with MERGE
-#
-
---source include/have_debug.inc
-
-set @default_storage_engine= @@global.storage_engine;
-set global storage_engine=myisam;
-set session storage_engine=myisam;
-
-call mtr.add_suppression("Index for table .*crashed' is corrupt; try to repair it");
-
---disable_warnings
-drop table if exists crashed,t2,t3,t4;
---enable_warnings
-
-SET @orig_debug=@@debug;
-
-#
-# Check that MariaDB handles reopen that fails without crashing
-#
-CREATE TABLE crashed (c1 INT);
-CREATE TABLE t2 (c1 INT);
-CREATE TABLE t3 (c1 INT);
-CREATE TABLE t4 (c1 INT) ENGINE=MRG_MYISAM UNION=(crashed,t2,t3) INSERT_METHOD=LAST;
-INSERT INTO crashed VALUES (10);
-INSERT INTO t2 VALUES (20);
-INSERT INTO t3 VALUES (30);
-
-LOCK TABLES t3 WRITE, t2 WRITE, t4 WRITE, crashed WRITE;
-SET GLOBAL debug_dbug="+d,myisam_pretend_crashed_table_on_open";
---disable_warnings
-CREATE TRIGGER t1_ai AFTER INSERT ON crashed FOR EACH ROW INSERT INTO t2 VALUES(29);
---enable_warnings
-SET GLOBAL debug_dbug=@orig_debug;
---error ER_TABLE_NOT_LOCKED
-INSERT INTO t4 VALUES (39);
---error ER_TABLE_NOT_LOCKED
-INSERT INTO crashed VALUES (11);
-INSERT INTO t2 VALUES (21);
-INSERT INTO t3 VALUES (31);
-UNLOCK TABLES;
-DROP TRIGGER t1_ai;
-DROP TABLE t4,crashed,t2,t3;
-
-set global storage_engine=@default_storage_engine;
diff --git a/mysql-test/t/merge_innodb.test b/mysql-test/t/merge_innodb.test
deleted file mode 100644
index 9f87f241d00..00000000000
--- a/mysql-test/t/merge_innodb.test
+++ /dev/null
@@ -1,72 +0,0 @@
-# t/merge_innodb.test
-#
-# Tests with MERGE tables over InnoDB tables
-#
-
---source include/have_innodb.inc
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2, t3, t4, t5;
---enable_warnings
-
-#
-# Bug#30491 - MERGE doesn't report error when one table is Innodb
-#
-CREATE TABLE t1 (c1 varchar(100)) ENGINE=MyISAM;
-CREATE TABLE t2 (c1 varchar(100)) ENGINE=MyISAM;
-CREATE TABLE t3 (c1 varchar(100)) ENGINE=InnoDB;
-INSERT INTO t1 VALUES ('Ann'), ('Alice');
-INSERT INTO t2 VALUES ('Bob'), ('Brian');
-INSERT INTO t3 VALUES ('Chris'), ('Charlie');
-CREATE TABLE t4 (c1 varchar(100)) ENGINE=MRG_MYISAM UNION=(t1,t2)
- INSERT_METHOD=LAST;
-CREATE TABLE t5 (c1 varchar(100)) ENGINE=MRG_MYISAM UNION=(t1,t3)
- INSERT_METHOD=LAST;
---error ER_WRONG_MRG_TABLE
-SELECT * FROM t5;
-SELECT * FROM t4;
-ALTER TABLE t2 ENGINE=InnoDB;
---error ER_WRONG_MRG_TABLE
-SELECT * FROM t4;
-DELETE FROM t2 LIMIT 1;
---error ER_WRONG_MRG_TABLE
-SELECT * FROM t4;
---error ER_WRONG_MRG_TABLE
-INSERT INTO t4 VALUES ('Beware');
---error ER_WRONG_MRG_TABLE
-SELECT * FROM t4;
-SELECT * FROM t2;
-SELECT * FROM t1;
-DROP TABLE t1, t2, t3, t4, t5;
-
-#
-# Bug#20691429 temporary merge over view under lock tables
-#
-create table t1 (c1 varchar(100));
-create table t2 (c1 varchar(100));
-create view t3 as select * from t1;
-insert into t1 values ('ann'), ('alice');
-insert into t2 values ('bob'), ('brian');
-create temporary table t4 (c1 varchar(100)) engine=MERGE union=(t2, t1);
-create temporary table t5 (c1 varchar(100)) engine=MERGE union=(t3, t1);
---error ER_WRONG_MRG_TABLE
-select * from t5;
-lock tables t1 read, t2 read, t3 read, t4 read;
---error ER_WRONG_MRG_TABLE
-select * from t5;
-select * from t4;
-unlock tables;
-drop table t2;
-create view t2 as select * from t1;
---error ER_WRONG_MRG_TABLE
-select * from t4;
-lock tables t1 read, t2 read, t3 read;
---error ER_WRONG_MRG_TABLE
-select * from t4;
---error ER_WRONG_MRG_TABLE
-select * from t4;
---error ER_WRONG_MRG_TABLE
-select * from t4;
-unlock tables;
-drop view t2, t3;
-drop table t1;
diff --git a/mysql-test/t/merge_mmap-master.opt b/mysql-test/t/merge_mmap-master.opt
deleted file mode 100644
index 9606fb57187..00000000000
--- a/mysql-test/t/merge_mmap-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---myisam-use-mmap
diff --git a/mysql-test/t/merge_mmap.test b/mysql-test/t/merge_mmap.test
deleted file mode 100644
index c97b029754d..00000000000
--- a/mysql-test/t/merge_mmap.test
+++ /dev/null
@@ -1,151 +0,0 @@
-#
-# Test of MERGE TABLES with MyISAM memory mapping enabled (--myisam-use-mmap)
-#
-
-# MERGE tables require MyISAM tables
---let $default=`SELECT @@global.storage_engine`
-SET GLOBAL storage_engine = MyISAM;
-SET SESSION storage_engine = MyISAM;
-
-# Clean up resources used in this test case.
---disable_warnings
-DROP TABLE IF EXISTS t1, t2, m1, m2;
---enable_warnings
-
-####################
-## No locked tables.
-####################
-#
-# INSERT-SELECT with no TEMPORARY table.
-#
-CREATE TABLE t1 (c1 INT);
-CREATE TABLE t2 (c1 INT);
-CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
- INSERT_METHOD=LAST;
-CREATE TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
- INSERT_METHOD=LAST;
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (2), (3), (4);
-INSERT INTO m2 SELECT * FROM m1;
-SELECT * FROM m2;
-SELECT * FROM t2;
-DROP TABLE m2, m1, t2, t1;
-#
-# INSERT-SELECT with TEMPORARY select table.
-#
-CREATE TABLE t1 (c1 INT);
-CREATE TABLE t2 (c1 INT);
-CREATE TEMPORARY TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
- INSERT_METHOD=LAST;
-CREATE TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
- INSERT_METHOD=LAST;
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (2), (3), (4);
-INSERT INTO m2 SELECT * FROM m1;
-SELECT * FROM m2;
-DROP TABLE m2, m1, t2, t1;
-#
-# INSERT-SELECT with TEMPORARY insert table.
-#
-CREATE TABLE t1 (c1 INT);
-CREATE TABLE t2 (c1 INT);
-CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
- INSERT_METHOD=LAST;
-CREATE TEMPORARY TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
- INSERT_METHOD=LAST;
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (2), (3), (4);
-INSERT INTO m2 SELECT * FROM m1;
-SELECT * FROM m2;
-DROP TABLE m2, m1, t2, t1;
-#
-# INSERT-SELECT with TEMPORARY both tables.
-#
-CREATE TABLE t1 (c1 INT);
-CREATE TABLE t2 (c1 INT);
-CREATE TEMPORARY TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
- INSERT_METHOD=LAST;
-CREATE TEMPORARY TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
- INSERT_METHOD=LAST;
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (2), (3), (4);
-INSERT INTO m2 SELECT * FROM m1;
-SELECT * FROM m2;
-DROP TABLE m2, m1, t2, t1;
-
-####################
-## With LOCK TABLES.
-####################
-#
-# INSERT-SELECT with no TEMPORARY table.
-#
-CREATE TABLE t1 (c1 INT);
-CREATE TABLE t2 (c1 INT);
-CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
- INSERT_METHOD=LAST;
-CREATE TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
- INSERT_METHOD=LAST;
-LOCK TABLE m1 WRITE, m2 WRITE;
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (2), (3), (4);
-INSERT INTO m2 SELECT * FROM m1;
-SELECT * FROM m2;
-SELECT * FROM t2;
-UNLOCK TABLES;
-DROP TABLE m2, m1, t2, t1;
-#
-# INSERT-SELECT with TEMPORARY select table.
-#
-CREATE TABLE t1 (c1 INT);
-CREATE TABLE t2 (c1 INT);
-CREATE TEMPORARY TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
- INSERT_METHOD=LAST;
-CREATE TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
- INSERT_METHOD=LAST;
-LOCK TABLE m1 WRITE, m2 WRITE;
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (2), (3), (4);
-INSERT INTO m2 SELECT * FROM m1;
-SELECT * FROM m2;
-UNLOCK TABLES;
-DROP TABLE m2, m1, t2, t1;
-#
-# INSERT-SELECT with TEMPORARY insert table.
-#
-CREATE TABLE t1 (c1 INT);
-CREATE TABLE t2 (c1 INT);
-CREATE TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
- INSERT_METHOD=LAST;
-CREATE TEMPORARY TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
- INSERT_METHOD=LAST;
-LOCK TABLE m1 WRITE, m2 WRITE;
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (2), (3), (4);
-INSERT INTO m2 SELECT * FROM m1;
-SELECT * FROM m2;
-UNLOCK TABLES;
-DROP TABLE m2, m1, t2, t1;
-#
-# INSERT-SELECT with TEMPORARY both tables.
-#
-CREATE TABLE t1 (c1 INT);
-CREATE TABLE t2 (c1 INT);
-CREATE TEMPORARY TABLE m1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
- INSERT_METHOD=LAST;
-CREATE TEMPORARY TABLE m2 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2)
- INSERT_METHOD=LAST;
-LOCK TABLE m1 WRITE, m2 WRITE;
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (2), (3), (4);
-INSERT INTO m2 SELECT * FROM m1;
-SELECT * FROM m2;
-UNLOCK TABLES;
-DROP TABLE m2, m1, t2, t1;
-
---echo End of 6.0 tests
-
---disable_result_log
---disable_query_log
-eval SET GLOBAL storage_engine = $default;
---enable_result_log
---enable_query_log
diff --git a/mysql-test/t/metadata.test b/mysql-test/t/metadata.test
deleted file mode 100644
index 96189a9750a..00000000000
--- a/mysql-test/t/metadata.test
+++ /dev/null
@@ -1,485 +0,0 @@
-#
-# Test metadata
-#
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
---enable_metadata
-# PS protocol gives slightly different metadata
---disable_ps_protocol
-
-#
-# First some simple tests
-#
-
-select 1, 1.0, -1, "hello", NULL;
-SELECT
- 1 AS c1,
- 11 AS c2,
- 111 AS c3,
- 1111 AS c4,
- 11111 AS c5,
- 111111 AS c6,
- 1111111 AS c7,
- 11111111 AS c8,
- 111111111 AS c9,
- 1111111111 AS c10,
- 11111111111 AS c11,
- 111111111111 AS c12,
- 1111111111111 AS c13,
- 11111111111111 AS c14,
- 111111111111111 AS c15,
- 1111111111111111 AS c16,
- 11111111111111111 AS c17,
- 111111111111111111 AS c18,
- 1111111111111111111 AS c19,
- 11111111111111111111 AS c20,
- 111111111111111111111 AS c21;
-
-SELECT
- -1 AS c1,
- -11 AS c2,
- -111 AS c3,
- -1111 AS c4,
- -11111 AS c5,
- -111111 AS c6,
- -1111111 AS c7,
- -11111111 AS c8,
- -111111111 AS c9,
- -1111111111 AS c10,
- -11111111111 AS c11,
- -111111111111 AS c12,
- -1111111111111 AS c13,
- -11111111111111 AS c14,
- -111111111111111 AS c15,
- -1111111111111111 AS c16,
- -11111111111111111 AS c17,
- -111111111111111111 AS c18,
- -1111111111111111111 AS c19,
- -11111111111111111111 AS c20,
- -111111111111111111111 AS c21;
-
-create table t1 (a tinyint, b smallint, c mediumint, d int, e bigint, f float(3,2), g double(4,3), h decimal(5,4), i year, j date, k timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, l datetime, m enum('a','b'), n set('a','b'), o char(10));
-select * from t1;
-select a b, b c from t1 as t2;
-drop table t1;
-
-#
-# Test metadata from ORDER BY (Bug #2654)
-#
-
-CREATE TABLE t1 (id tinyint(3) default NULL, data varchar(255) default NULL);
-INSERT INTO t1 VALUES (1,'male'),(2,'female');
-CREATE TABLE t2 (id tinyint(3) unsigned default NULL, data char(3) default '0');
-INSERT INTO t2 VALUES (1,'yes'),(2,'no');
-
-select t1.id, t1.data, t2.data from t1, t2 where t1.id = t2.id;
-select t1.id, t1.data, t2.data from t1, t2 where t1.id = t2.id order by t1.id;
-select t1.id from t1 union select t2.id from t2;
-drop table t1,t2;
-
-#
-# variables union and derived tables metadata test
-#
-create table t1 ( a int, b varchar(30), primary key(a));
-insert into t1 values (1,'one');
-insert into t1 values (2,'two');
-set @arg00=1 ;
-select @arg00 FROM t1 where a=1 union distinct select 1 FROM t1 where a=1;
-select * from (select @arg00) aaa;
-select 1 union select 1;
-select * from (select 1 union select 1) aaa;
-drop table t1;
-
---disable_metadata
-
-#
-# Bug #11688: Bad mysql_info() results in multi-results
-#
---enable_info
-delimiter //;
-create table t1 (i int);
-insert into t1 values (1),(2),(3);
-select * from t1 where i = 2;
-drop table t1;//
-delimiter ;//
---disable_info
-
-#
-# Bug #20191: getTableName gives wrong or inconsistent result when using VIEWs
-#
---enable_metadata
-create table t1 (id int(10));
-insert into t1 values (1);
-CREATE VIEW v1 AS select t1.id as id from t1;
-CREATE VIEW v2 AS select t1.id as renamed from t1;
-CREATE VIEW v3 AS select t1.id + 12 as renamed from t1;
-select * from v1 group by id limit 1;
-select * from v1 group by id limit 0;
-select * from v1 where id=1000 group by id;
-select * from v1 where id=1 group by id;
-select * from v2 where renamed=1 group by renamed;
-select * from v3 where renamed=1 group by renamed;
-drop table t1;
-drop view v1,v2,v3;
---disable_metadata
-
-# End of 4.1 tests
-
-#
-# Bug #28492: subselect returns LONG in >5.0.24a and LONGLONG in <=5.0.24a
-#
---enable_metadata
-select a.* from (select 2147483648 as v_large) a;
-select a.* from (select 214748364 as v_small) a;
---disable_metadata
-
-#
-# Bug #28898: table alias and database name of VIEW columns is empty in the
-# metadata of # SELECT statement where join is executed via temporary table.
-#
-
-CREATE TABLE t1 (c1 CHAR(1));
-CREATE TABLE t2 (c2 CHAR(1));
-CREATE VIEW v1 AS SELECT t1.c1 FROM t1;
-CREATE VIEW v2 AS SELECT t2.c2 FROM t2;
-INSERT INTO t1 VALUES ('1'), ('2'), ('3');
-INSERT INTO t2 VALUES ('1'), ('2'), ('3'), ('2');
-
---enable_metadata
-SELECT v1.c1 FROM v1 JOIN t2 ON c1=c2 ORDER BY 1;
-SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2;
-SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2 GROUP BY v1.c1;
-SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2 GROUP BY v1.c1 ORDER BY v2.c2;
---disable_metadata
-
-DROP VIEW v1,v2;
-DROP TABLE t1,t2;
-
-#
-# Bug #39283: Date returned as VARBINARY to client for queries
-# with COALESCE and JOIN
-#
-
-CREATE TABLE t1 (i INT, d DATE);
-INSERT INTO t1 VALUES (1, '2008-01-01'), (2, '2008-01-02'), (3, '2008-01-03');
-
---enable_metadata
---sorted_result
-SELECT COALESCE(d, d), IFNULL(d, d), IF(i, d, d),
- CASE i WHEN i THEN d ELSE d END, GREATEST(d, d), LEAST(d, d)
- FROM t1 ORDER BY RAND(); # force filesort
---disable_metadata
-
-DROP TABLE t1;
-
---echo #
---echo # Bug#41788 mysql_fetch_field returns org_table == table by a view
---echo #
-
-CREATE TABLE t1 (f1 INT);
-CREATE VIEW v1 AS SELECT f1 FROM t1;
---enable_metadata
-SELECT f1 FROM v1 va;
---disable_metadata
-
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo End of 5.0 tests
-
-# Verify that column metadata is correct for all possible data types.
-# Originally about BUG#42980 "Client doesn't set NUM_FLAG for DECIMAL"
-
-create table t1(
-# numeric types
-bool_col bool,
-boolean_col boolean,
-bit_col bit(5),
-tiny tinyint,
-tiny_uns tinyint unsigned,
-small smallint,
-small_uns smallint unsigned,
-medium mediumint,
-medium_uns mediumint unsigned,
-int_col int,
-int_col_uns int unsigned,
-big bigint,
-big_uns bigint unsigned,
-decimal_col decimal(10,5),
-# synonyms of DECIMAL
-numeric_col numeric(10),
-fixed_col fixed(10),
-dec_col dec(10),
-decimal_col_uns decimal(10,5) unsigned,
-fcol float,
-fcol_uns float unsigned,
-dcol double,
-double_precision_col double precision,
-dcol_uns double unsigned,
-# date/time types
-date_col date,
-time_col time,
-timestamp_col timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
-year_col year,
-datetime_col datetime,
-# string types
-char_col char(5),
-varchar_col varchar(10),
-binary_col binary(10),
-varbinary_col varbinary(10),
-tinyblob_col tinyblob,
-blob_col blob,
-mediumblob_col mediumblob,
-longblob_col longblob,
-text_col text,
-mediumtext_col mediumtext,
-longtext_col longtext,
-enum_col enum("A","B","C"),
-set_col set("F","E","D")
-);
-
---enable_metadata
-select * from t1;
---disable_metadata
-
-drop table t1;
-
-#
-# lp:740173 5.1-micro reports incorrect Length metadata for TIME expressions
-#
---enable_metadata
-select cast('01:01:01' as time), cast('01:01:01' as time(2));
---disable_metadata
-
-
---echo #
---echo # MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
---echo #
-
---enable_metadata
-SELECT
- STRCMP('a','b'),
- OCTET_LENGTH('a'),
- CHAR_LENGTH('a'),
- COERCIBILITY('a'),
- ASCII('a'),
- ORD('a'),
- CRC32('a'),
- UNCOMPRESSED_LENGTH(COMPRESS('a'));
-
-SELECT
- INTERVAL(2,1,2,3),
- REGEXP_INSTR('a','a'),
- LOCATE('a','a'),
- FIND_IN_SET('b','a,b,c,d'),
- FIELD('a','a','b');
-
-SELECT
- SIGN(1),
- BIT_COUNT(1);
-
-
-SELECT
- BENCHMARK(0,0),
- SLEEP(0);
-
-SELECT
- GET_LOCK('metadata',0),
- IS_FREE_LOCK('metadata'),
- RELEASE_LOCK('metadata');
-
-# Metadata the following functions is not deterministic
-#SELECT CONNECTION_ID();
-#SELECT IS_FREE_LOCK('metadata');
-#SELECT UUID_SHORT();
-
-
-SELECT
- PERIOD_ADD(200801,2),
- PERIOD_DIFF(200802,200703),
- TO_DAYS('2007-10-07'),
- DAYOFMONTH('2007-02-03'),
- DAYOFWEEK('2007-02-03'),
- TO_SECONDS('2013-06-13');
-
-SELECT
- YEAR('2001-02-03 04:05:06.000007'),
- DAY('2001-02-03 04:05:06.000007'),
- HOUR('2001-02-03 04:05:06.000007'),
- MINUTE('2001-02-03 04:05:06.000007'),
- SECOND('2001-02-03 04:05:06.000007'),
- MICROSECOND('2001-02-03 04:05:06.000007');
-
-SELECT
- WEEK('2001-02-03 04:05:06.000007'),
- QUARTER('2001-02-03 04:05:06.000007'),
- YEARWEEK('2001-02-03 04:05:06.000007');
-
---disable_metadata
-
---enable_metadata
-SELECT BIT_LENGTH(10);
-SELECT 1|2, 1&2, 1<<2, 1>>2, ~0, 1^2;
-SELECT LAST_INSERT_ID();
-SELECT ROW_COUNT(), FOUND_ROWS();
-SELECT TIMESTAMPDIFF(MONTH,'2003-02-01','2003-05-01');
---disable_metadata
-
-
---echo #
---echo # MDEV-12856 Wrong result set metadata for DIV
---echo #
-
---enable_metadata
-SELECT
- 2 DIV 1 AS d0l,
- 222222222 DIV 1 AS d09,
- 2222222222 DIV 1 AS d10;
---disable_metadata
-
-
---echo #
---echo # MDEV-12862 Data type of @a:=1e0 depends on the session character set
---echo #
---enable_metadata
-SET NAMES utf8;
-CREATE TABLE t1 AS SELECT @:=1e0;
-SELECT * FROM t1;
-DROP TABLE t1;
-SET NAMES latin1;
-CREATE TABLE t1 AS SELECT @:=1e0;
-SELECT * FROM t1;
-DROP TABLE t1;
---disable_metadata
-
---echo #
---echo # MDEV-12869 Wrong metadata for integer additive and multiplicative operators
---echo #
-
---enable_metadata
-SELECT
- 1+1,
- 11+1,
- 111+1,
- 1111+1,
- 11111+1,
- 111111+1,
- 1111111+1,
- 11111111+1,
- 111111111+1 LIMIT 0;
-
-SELECT
- 1-1,
- 11-1,
- 111-1,
- 1111-1,
- 11111-1,
- 111111-1,
- 1111111-1,
- 11111111-1,
- 111111111-1 LIMIT 0;
-
-SELECT
- 1*1,
- 11*1,
- 111*1,
- 1111*1,
- 11111*1,
- 111111*1,
- 1111111*1,
- 11111111*1,
- 111111111*1 LIMIT 0;
-
-SELECT
- 1 MOD 1,
- 11 MOD 1,
- 111 MOD 1,
- 1111 MOD 1,
- 11111 MOD 1,
- 111111 MOD 1,
- 1111111 MOD 1,
- 11111111 MOD 1,
- 111111111 MOD 1,
- 1111111111 MOD 1,
- 11111111111 MOD 1 LIMIT 0;
-
-SELECT
- -(1),
- -(11),
- -(111),
- -(1111),
- -(11111),
- -(111111),
- -(1111111),
- -(11111111),
- -(111111111) LIMIT 0;
-
-SELECT
- ABS(1),
- ABS(11),
- ABS(111),
- ABS(1111),
- ABS(11111),
- ABS(111111),
- ABS(1111111),
- ABS(11111111),
- ABS(111111111),
- ABS(1111111111) LIMIT 0;
-
-SELECT
- CEILING(1),
- CEILING(11),
- CEILING(111),
- CEILING(1111),
- CEILING(11111),
- CEILING(111111),
- CEILING(1111111),
- CEILING(11111111),
- CEILING(111111111),
- CEILING(1111111111) LIMIT 0;
-
-SELECT
- FLOOR(1),
- FLOOR(11),
- FLOOR(111),
- FLOOR(1111),
- FLOOR(11111),
- FLOOR(111111),
- FLOOR(1111111),
- FLOOR(11111111),
- FLOOR(111111111),
- FLOOR(1111111111) LIMIT 0;
-
-SELECT
- ROUND(1),
- ROUND(11),
- ROUND(111),
- ROUND(1111),
- ROUND(11111),
- ROUND(111111),
- ROUND(1111111),
- ROUND(11111111),
- ROUND(111111111),
- ROUND(1111111111) LIMIT 0;
-
---disable_metadata
-
---echo #
---echo # MDEV-12546 Wrong metadata or data type for string user variables
---echo #
-SET @a='test';
---enable_metadata
-SELECT @a;
---disable_metadata
-CREATE TABLE t1 AS SELECT @a;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
---enable_metadata
-SELECT @b1:=10, @b2:=@b2:=111111111111;
---disable_metadata
-CREATE TABLE t1 AS SELECT @b1:=10, @b2:=111111111111;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
diff --git a/mysql-test/t/mix2_myisam.test b/mysql-test/t/mix2_myisam.test
deleted file mode 100644
index 97195130967..00000000000
--- a/mysql-test/t/mix2_myisam.test
+++ /dev/null
@@ -1,29 +0,0 @@
-# t/mix2_myisam.test
-#
-# Last update: 2006-07-26 ML create this test as derivate from innodb.test
-#
-
-# Generated by an ALTER TABLE in include/mix2.inc
-call mtr.add_suppression("Can't find record in .*");
-
-let $engine_type= MyISAM;
-let $other_engine_type= MEMORY;
-# There are unfortunately only MyISAM and MEMORY all time available
-# Therefore use here MEMORY again.
-let $other_engine_type1= MEMORY;
-let $other_non_trans_engine_type= MEMORY;
-let $other_non_live_chks_engine_type= MEMORY;
-# Therefore use here MyISAM again.
-let $other_live_chks_engine_type= MyISAM;
-# MyISAM does not support transactions
-let $test_transactions= 0;
-# MyISAM does not support FOREIGN KEYFOREIGN KEYs
-let $test_foreign_keys= 0;
-# MyISAM supports fulltext queries
-let $fulltext_query_unsupported= 0;
-# MyISAM internal autoincrement values are updated during updates
-let $no_autoinc_update= 0;
-# MyISAM supports keys on spatial data types
-let $no_spatial_key= 0;
-
--- source include/mix2.inc
diff --git a/mysql-test/t/mix2_myisam_ucs2.test b/mysql-test/t/mix2_myisam_ucs2.test
deleted file mode 100644
index fe22fa50238..00000000000
--- a/mysql-test/t/mix2_myisam_ucs2.test
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Tests which require ucs2 character set
-#
-
--- source include/have_ucs2.inc
-
-let $engine_type= MyISAM;
-let $other_engine_type= MEMORY;
-# There are unfortunately only MyISAM and MEMORY all time available
-# Therefore use here MEMORY again.
-let $other_engine_type1= MEMORY;
-let $other_non_trans_engine_type= MEMORY;
-let $other_non_live_chks_engine_type= MEMORY;
-# Therefore use here MyISAM again.
-let $other_live_chks_engine_type= MyISAM;
-# MyISAM does not support transactions
-let $test_transactions= 0;
-# MyISAM does not support FOREIGN KEYFOREIGN KEYs
-let $test_foreign_keys= 0;
-# MyISAM supports fulltext queries
-let $fulltext_query_unsupported= 0;
-# MyISAM internal autoincrement values are updated during updates
-let $no_autoinc_update= 0;
-# MyISAM supports keys on spatial data types
-let $no_spatial_key= 0;
-
--- source include/mix2_ucs2.inc
diff --git a/mysql-test/t/mrr_derived_crash_4610.test b/mysql-test/t/mrr_derived_crash_4610.test
deleted file mode 100644
index 88882b57cf7..00000000000
--- a/mysql-test/t/mrr_derived_crash_4610.test
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# MDEV-4610 SQL query crashes MariaDB with derived_with_keys
-#
---source include/have_innodb.inc
-create table t1 (f1 char(4) primary key) engine=innodb charset=utf8 ;
-insert into t1 values ('aaaa');
-create table t2 (f2 text, f3 char(4) not null) engine=innodb charset=utf8 ;
-create table t3 (id int not null) engine=innodb charset=utf8 ;
-create table t4 (val int not null) engine=innodb charset=utf8;
-explain select 1 from
- (select f2, f3, val, count(id) from t4 join t2 left join t3 on 0) top
- join t1 on f1 = f3 where f3 = 'aaaa' order by val;
-select 1 from
- (select f2, f3, val, count(id) from t4 join t2 left join t3 on 0) top
- join t1 on f1 = f3 where f3 = 'aaaa' order by val;
-drop table t1, t2, t3, t4;
diff --git a/mysql-test/t/mrr_icp_extra.test b/mysql-test/t/mrr_icp_extra.test
deleted file mode 100644
index 75ddc85b984..00000000000
--- a/mysql-test/t/mrr_icp_extra.test
+++ /dev/null
@@ -1,242 +0,0 @@
-
-# Generated by an ALTER TABLE in include/varchar.inc
-call mtr.add_suppression("Can't find record in .*");
-
-set @mrr_icp_extra_tmp=@@optimizer_switch;
-set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
-SET NAMES latin1;
-CREATE TABLE t1
-(s1 char(10) COLLATE latin1_german1_ci,
- s2 char(10) COLLATE latin1_swedish_ci,
- KEY(s1),
- KEY(s2));
-
-INSERT INTO t1 VALUES ('a','a');
-INSERT INTO t1 VALUES ('b','b');
-INSERT INTO t1 VALUES ('c','c');
-INSERT INTO t1 VALUES ('d','d');
-INSERT INTO t1 VALUES ('e','e');
-INSERT INTO t1 VALUES ('f','f');
-INSERT INTO t1 VALUES ('g','g');
-INSERT INTO t1 VALUES ('h','h');
-INSERT INTO t1 VALUES ('i','i');
-INSERT INTO t1 VALUES ('j','j');
-
-EXPLAIN SELECT * FROM t1 WHERE s1='a';
-EXPLAIN SELECT * FROM t1 WHERE s2='a';
-EXPLAIN SELECT * FROM t1 WHERE s1='a' COLLATE latin1_german1_ci;
-EXPLAIN SELECT * FROM t1 WHERE s2='a' COLLATE latin1_german1_ci;
-
-EXPLAIN SELECT * FROM t1 WHERE s1 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci;
-EXPLAIN SELECT * FROM t1 WHERE s2 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci;
-
-EXPLAIN SELECT * FROM t1 WHERE s1 IN ('a','b' COLLATE latin1_german1_ci);
-EXPLAIN SELECT * FROM t1 WHERE s2 IN ('a','b' COLLATE latin1_german1_ci);
-
-EXPLAIN SELECT * FROM t1 WHERE s1 LIKE 'a' COLLATE latin1_german1_ci;
-EXPLAIN SELECT * FROM t1 WHERE s2 LIKE 'a' COLLATE latin1_german1_ci;
-
-DROP TABLE t1;
-
---echo #
---echo #
-
-CREATE TABLE t2 (a varchar(32), b int(11), c float, d double,
-UNIQUE KEY a (a,b,c), KEY b (b), KEY c (c));
-CREATE TABLE t1 (a varchar(32), b char(3), UNIQUE KEY a (a,b), KEY b (b));
-CREATE TABLE t3 (a varchar(32), b char(3), UNIQUE KEY a (a,b));
-INSERT INTO t3 SELECT * FROM t1;
-EXPLAIN
-SELECT d FROM t1, t2
-WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
-ORDER BY t2.c LIMIT 1;
-SELECT d FROM t1, t2
-WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
-ORDER BY t2.c LIMIT 1;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo #
-create table t1(a int, b int, index(b));
-insert into t1 values (2, 1), (1, 1), (4, NULL), (3, NULL), (6, 2), (5, 2);
-insert into t1 values (2, 11), (1, 11), (4, 14), (3, 14), (6, 12), (5, 12);
-explain select * from t1 where b=1 or b is null order by a;
-select * from t1 where b=1 or b is null order by a;
-explain select * from t1 where b=2 or b is null order by a;
-select * from t1 where b=2 or b is null order by a;
-drop table t1;
-
---echo #
---echo #
-CREATE TABLE t1 (
-FieldKey varchar(36) NOT NULL default '',
-LongVal bigint(20) default NULL,
-StringVal mediumtext,
-KEY FieldKey (FieldKey),
-KEY LongField (FieldKey,LongVal),
-KEY StringField (FieldKey,StringVal(32))
-);
-INSERT INTO t1 VALUES ('0',3,'0'),('0',2,'1'),('0',1,'2'),('1',2,'1'),('1',1,'3'), ('1',0,'2'),('2',3,'0'),('2',2,'1'),('2',1,'2'),('2',3,'0'),('2',2,'1'),('2',1,'2'),('3',2,'1'),('3',1,'2'),('3','3','3');
-EXPLAIN SELECT * FROM t1 IGNORE INDEX (LongField, StringField) WHERE FieldKey > '2' ORDER BY LongVal;
-EXPLAIN SELECT * FROM t1 IGNORE INDEX (FieldKey, LongField) WHERE FieldKey > '2' ORDER BY LongVal;
-SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY LongVal;
-DROP TABLE t1;
---echo #
---echo #
-CREATE TABLE t1 (a int not null, b int, c int, key(b), key(c), key(a,b), key(c,a));
-INSERT into t1 values (0, null, 0), (0, null, 1), (0, null, 2), (0, null,3), (1,1,4);
-create table t2 (a int not null, b int, c int, key(b), key(c), key(a));
-INSERT into t2 values (1,1,1), (2,2,2);
-optimize table t1;
-explain select * from t1 force index (a) where a=0 or a=2;
-select * from t1 force index (a) where a=0 or a=2;
-drop table t1;
---echo #
---echo #
-create table t1
-(
- pk1 int not null,
- pk2 int not null,
-
- key1 int not null,
- key2 int not null,
-
- pktail1ok int not null,
- pktail2ok int not null,
- pktail3bad int not null,
- pktail4bad int not null,
- pktail5bad int not null,
-
- pk2copy int not null,
- badkey int not null,
-
- filler1 char (200),
- filler2 char (200),
- key (key1),
- key (key2),
-
- /* keys with tails from CPK members */
- key (pktail1ok, pk1),
- key (pktail2ok, pk1, pk2),
- key (pktail3bad, pk2, pk1),
- key (pktail4bad, pk1, pk2copy),
- key (pktail5bad, pk1, pk2, pk2copy),
-
- primary key (pk1, pk2)
-);
-
---disable_query_log
-set autocommit=0;
-let $1=10000;
-while ($1)
-{
- eval insert into t1 values ($1 div 10,$1 mod 100, $1/100,$1/100, $1/100,$1/100,$1/100,$1/100,$1/100, $1 mod 100, $1/1000,'filler-data-$1','filler2');
- dec $1;
-}
-set autocommit=1;
---enable_query_log
-explain select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
-select * from t1 where pk1 = 1 and pk2 < 80 and key1=0;
-drop table t1;
-
---echo #
---echo #
-CREATE TABLE t1 (
-f1 int,
-f4 varchar(32),
-f5 int,
-PRIMARY KEY (f1),
-KEY (f4)
-);
-INSERT INTO t1 VALUES
-(5,'H',1), (9,'g',0), (527,'i',0), (528,'y',1), (529,'S',6),
-(530,'m',7), (531,'b',2), (532,'N',1), (533,'V',NULL), (534,'l',1),
-(535,'M',0), (536,'w',1), (537,'j',5), (538,'l',0), (539,'n',2),
-(540,'m',2), (541,'r',2), (542,'l',2), (543,'h',3),(544,'o',0),
-(956,'h',0), (957,'g',0), (958,'W',5), (959,'s',3), (960,'w',0),
-(961,'q',0), (962,'e',NULL), (963,'u',7), (964,'q',1), (965,'N',NULL),
-(966,'e',0), (967,'t',3), (968,'e',6), (969,'f',NULL), (970,'j',0),
-(971,'s',3), (972,'I',0), (973,'h',4), (974,'g',1), (975,'s',0),
-(976,'r',3), (977,'x',1), (978,'v',8), (979,'j',NULL), (980,'z',7),
-(981,'t',9), (982,'j',5), (983,'u',NULL), (984,'g',6), (985,'w',1),
-(986,'h',1), (987,'v',0), (988,'v',0), (989,'c',2), (990,'b',7),
-(991,'z',0), (992,'M',1), (993,'u',2), (994,'r',2), (995,'b',4),
-(996,'A',2), (997,'u',0), (998,'a',0), (999,'j',2), (1,'I',2);
-EXPLAIN
-SELECT * FROM t1
-WHERE (f1 < 535 OR f1 > 985) AND ( f4='r' OR f4 LIKE 'a%' ) ;
-SELECT * FROM t1
-WHERE (f1 < 535 OR f1 > 985) AND ( f4='r' OR f4 LIKE 'a%' ) ;
-drop table t1;
-
---echo #
---echo #
---source include/varchar.inc
-
---echo #
---echo #
---disable_warnings
-drop database if exists world;
---enable_warnings
-CREATE DATABASE world;
-
-use world;
-
---source include/world_schema.inc
-
---disable_query_log
---disable_result_log
---disable_warnings
---source include/world.inc
---enable_warnings
---enable_result_log
---enable_query_log
-
-SELECT * FROM City
-WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F'))
-AND (Population > 101000 AND Population < 102000);
-
---replace_column 9 #
-explain
-SELECT * FROM City
-WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F'))
-AND (Population > 101000 AND Population < 102000);
-
---replace_column 9 #
-explain
-SELECT * FROM City
-WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR
-(Name BETWEEN 'P' AND 'Pb' AND (Population > 101000 AND Population < 110000));
-
-SELECT * FROM City
-WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR
-(Name BETWEEN 'P' AND 'Pb' AND (Population > 101000 AND Population < 110000));
-
-SELECT * FROM City
-WHERE Name LIKE 'M%' AND Population > 7000000;
-
---replace_column 9 #
-explain
-SELECT * FROM City
-WHERE Name LIKE 'M%' AND Population > 7000000;
-
---replace_column 6 # 7 # 9 #
-explain
-SELECT * FROM City
-WHERE Name BETWEEN 'G' AND 'K' AND Population > 500000 AND Country LIKE 'C%';
-SELECT * FROM City
-WHERE Name BETWEEN 'G' AND 'K' AND Population > 500000 AND Country LIKE 'C%';
-
---replace_column 6 # 7 # 9 #
-explain
-SELECT * FROM City
-WHERE Name BETWEEN 'G' AND 'J' AND Population > 500000 AND Country LIKE 'C%';
-SELECT * FROM City
-WHERE Name BETWEEN 'G' AND 'J' AND Population > 500000 AND Country LIKE 'C%';
-
-drop database world;
-use test;
-
-set @mrr_icp_extra_tmp=@@optimizer_switch;
-
diff --git a/mysql-test/t/multi_statement-master.opt b/mysql-test/t/multi_statement-master.opt
deleted file mode 100644
index c735cf4c21b..00000000000
--- a/mysql-test/t/multi_statement-master.opt
+++ /dev/null
@@ -1,3 +0,0 @@
---slow-query-log
---slow-query-log-file=slow.log
---log-queries-not-using-indexes
diff --git a/mysql-test/t/multi_statement.test b/mysql-test/t/multi_statement.test
deleted file mode 100644
index 785aa749f5e..00000000000
--- a/mysql-test/t/multi_statement.test
+++ /dev/null
@@ -1,37 +0,0 @@
-# PS doesn't support multi-statements
---disable_ps_protocol
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-select 1;
-delimiter ||||;
-select 2;
-select 3;
-select 4||||
-delimiter 'abcd'||||
-select 5;
-select 6;
-select 50, 'abc';'abcd'
-select "abcd'";'abcd'select "'abcd";'abcd'
-select 5'abcd'
-delimiter ;'abcd'
-select 'finish';
-
-# Bug #8475: Make sure every statement that is a slow query in
-# a multi-statement query gets logged as a slow query.
-flush status;
-delimiter ||||;
-create table t1 (i int);
-insert into t1 values (1);
-select * from t1 where i = 1;
-insert into t1 values (2),(3),(4);
-select * from t1 where i = 2;
-select * from t1 where i = 3||||
-show status like 'Slow_queries'||||
-drop table t1||||
-
-delimiter ;||||
-
-# End of 4.1 tests
diff --git a/mysql-test/t/multi_update-master.opt b/mysql-test/t/multi_update-master.opt
deleted file mode 100644
index da78f987af3..00000000000
--- a/mysql-test/t/multi_update-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---tmp_table_size=1024
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test
deleted file mode 100644
index 5feebe87a5a..00000000000
--- a/mysql-test/t/multi_update.test
+++ /dev/null
@@ -1,916 +0,0 @@
-#
-# Test of update statement that uses many tables.
-#
-
-create table t1(id1 int not null auto_increment primary key, t char(12));
-create table t2(id2 int not null, t char(12));
-create table t3(id3 int not null, t char(12), index(id3));
---disable_query_log
-begin;
-let $1 = 100;
-while ($1)
- {
- let $2 = 5;
- eval insert into t1(t) values ('$1');
- while ($2)
- {
- eval insert into t2(id2,t) values ($1,'$2');
- let $3 = 10;
- while ($3)
- {
- eval insert into t3(id3,t) values ($1,'$2');
- dec $3;
- }
- dec $2;
- }
- dec $1;
- }
-commit;
---enable_query_log
-
-select count(*) from t1 where id1 > 95;
-select count(*) from t2 where id2 > 95;
-select count(*) from t3 where id3 > 95;
-
-update t1,t2,t3 set t1.t="aaa", t2.t="bbb", t3.t="cc" where t1.id1 = t2.id2 and t2.id2 = t3.id3 and t1.id1 > 90;
-select count(*) from t1 where t = "aaa";
-select count(*) from t1 where id1 > 90;
-select count(*) from t2 where t = "bbb";
-select count(*) from t2 where id2 > 90;
-select count(*) from t3 where t = "cc";
-select count(*) from t3 where id3 > 90;
-delete t1.*, t2.*, t3.* from t1,t2,t3 where t1.id1 = t2.id2 and t2.id2 = t3.id3 and t1.id1 > 95;
-
-check table t1, t2, t3;
-
-select count(*) from t1 where id1 > 95;
-select count(*) from t2 where id2 > 95;
-select count(*) from t3 where id3 > 95;
-
-delete t1, t2, t3 from t1,t2,t3 where t1.id1 = t2.id2 and t2.id2 = t3.id3 and t1.id1 > 5;
-select count(*) from t1 where id1 > 5;
-select count(*) from t2 where id2 > 5;
-select count(*) from t3 where id3 > 5;
-
-delete from t1, t2, t3 using t1,t2,t3 where t1.id1 = t2.id2 and t2.id2 = t3.id3 and t1.id1 > 0;
-
-# These queries will force a scan of the table
-select count(*) from t1 where id1;
-select count(*) from t2 where id2;
-select count(*) from t3 where id3;
-drop table t1,t2,t3;
-
-create table t1(id1 int not null primary key, t varchar(100)) pack_keys = 1;
-create table t2(id2 int not null, t varchar(100), index(id2)) pack_keys = 1;
---disable_query_log
-begin;
-let $1 = 1000;
-while ($1)
- {
- let $2 = 5;
- eval insert into t1 values ($1,'aaaaaaaaaaaaaaaaaaaa');
- while ($2)
- {
- eval insert into t2(id2,t) values ($1,'bbbbbbbbbbbbbbbbb');
- dec $2;
- }
- dec $1;
- }
-commit;
---enable_query_log
-delete t1 from t1,t2 where t1.id1 = t2.id2 and t1.id1 > 500;
-drop table t1,t2;
-
-CREATE TABLE t1 (
- id int(11) NOT NULL default '0',
- name varchar(10) default NULL,
- PRIMARY KEY (id)
-) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,'aaa'),(2,'aaa'),(3,'aaa');
-CREATE TABLE t2 (
- id int(11) NOT NULL default '0',
- name varchar(10) default NULL,
- PRIMARY KEY (id)
-) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (2,'bbb'),(3,'bbb'),(4,'bbb');
-CREATE TABLE t3 (
- id int(11) NOT NULL default '0',
- mydate datetime default NULL,
- PRIMARY KEY (id)
-) ENGINE=MyISAM;
-INSERT INTO t3 VALUES (1,'2002-02-04 00:00:00'),(3,'2002-05-12 00:00:00'),(5,'2002-05-12 00:00:00'),(6,'2002-06-22
-00:00:00'),(7,'2002-07-22 00:00:00');
-delete t1,t2,t3 from t1,t2,t3 where to_days(now())-to_days(t3.mydate)>=30 and t3.id=t1.id and t3.id=t2.id;
-select * from t3;
-DROP TABLE t1,t2,t3;
-
-CREATE TABLE IF NOT EXISTS `t1` (
- `id` int(11) NOT NULL auto_increment,
- `tst` text,
- `tst1` text,
- PRIMARY KEY (`id`)
-) ENGINE=MyISAM;
-
-CREATE TABLE IF NOT EXISTS `t2` (
- `ID` int(11) NOT NULL auto_increment,
- `ParId` int(11) default NULL,
- `tst` text,
- `tst1` text,
- PRIMARY KEY (`ID`),
- KEY `IX_ParId_t2` (`ParId`),
- FOREIGN KEY (`ParId`) REFERENCES `t1` (`id`)
-) ENGINE=MyISAM;
-
-INSERT INTO t1(tst,tst1) VALUES("MySQL","MySQL AB"), ("MSSQL","Microsoft"), ("ORACLE","ORACLE");
-
-INSERT INTO t2(ParId) VALUES(1), (2), (3);
-
-select * from t2;
-
---disable_warnings ONCE
-UPDATE t2, t1 SET t2.tst = t1.tst, t2.tst1 = t1.tst1 WHERE t2.ParId = t1.Id;
-
-select * from t2;
-drop table t1, t2 ;
-
-create table t1 (n numeric(10));
-create table t2 (n numeric(10));
-insert into t2 values (1),(2),(4),(8),(16),(32);
-select * from t2 left outer join t1 using (n);
-delete t1,t2 from t2 left outer join t1 using (n);
-select * from t2 left outer join t1 using (n);
-drop table t1,t2 ;
-
-#
-# Test with locking
-#
-
-create table t1 (n int(10) not null primary key, d int(10));
-create table t2 (n int(10) not null primary key, d int(10));
-insert into t1 values(1,1);
-insert into t2 values(1,10),(2,20);
-LOCK TABLES t1 write, t2 read;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-DELETE t1.*, t2.* FROM t1,t2 where t1.n=t2.n;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
-UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n;
-unlock tables;
-LOCK TABLES t1 write, t2 write;
-UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n;
-select * from t1;
-DELETE t1.*, t2.* FROM t1,t2 where t1.n=t2.n;
-select * from t1;
-select * from t2;
-unlock tables;
-drop table t1,t2;
-
-#
-# Test safe updates and timestamps
-#
-set sql_safe_updates=1;
-create table t1 (n int(10), d int(10));
-create table t2 (n int(10), d int(10));
-insert into t1 values(1,1);
-insert into t2 values(1,10),(2,20);
---error ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
-UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n;
-set sql_safe_updates=0;
-drop table t1,t2;
-set timestamp=1038401397;
-create table t1 (n int(10) not null primary key, d int(10), t timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
-create table t2 (n int(10) not null primary key, d int(10), t timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
-insert into t1 values(1,1,NULL);
-insert into t2 values(1,10,NULL),(2,20,NULL);
-set timestamp=1038000000;
-UPDATE t1,t2 SET t1.d=t2.d WHERE t1.n=t2.n;
-select n,d,unix_timestamp(t) from t1;
-select n,d,unix_timestamp(t) from t2;
---error ER_PARSE_ERROR
-UPDATE t1,t2 SET 1=2 WHERE t1.n=t2.n;
-drop table t1,t2;
-set timestamp=0;
-set sql_safe_updates=0;
-create table t1 (n int(10) not null primary key, d int(10));
-create table t2 (n int(10) not null primary key, d int(10));
-insert into t1 values(1,1), (3,3);
-insert into t2 values(1,10),(2,20);
-UPDATE t2 left outer join t1 on t1.n=t2.n SET t1.d=t2.d;
-select * from t1;
-select * from t2;
-drop table t1,t2;
-create table t1 (n int(10), d int(10));
-create table t2 (n int(10), d int(10));
-insert into t1 values(1,1),(1,2);
-insert into t2 values(1,10),(2,20);
-UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
-select * from t1;
-select * from t2;
-drop table t1,t2;
-create table t1 (n int(10), d int(10));
-create table t2 (n int(10), d int(10));
-insert into t1 values(1,1),(3,2);
-insert into t2 values(1,10),(1,20);
-UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
-select * from t1;
-select * from t2;
-UPDATE t1 a ,t2 b SET a.d=b.d,b.d=30 WHERE a.n=b.n;
-select * from t1;
-select * from t2;
-DELETE a, b FROM t1 a,t2 b where a.n=b.n;
-select * from t1;
-select * from t2;
-drop table t1,t2;
-
-CREATE TABLE t1 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,'jedan'),(2,'dva'),(3,'tri'),(4,'xxxxxxxxxx'),(5,'a'),(10,''),(11,''),(12,''),(13,'');
-CREATE TABLE t2 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (1,'jedan'),(2,'dva'),(3,'tri'),(4,'xxxxxxxxxx'),(5,'a');
-CREATE TABLE t3 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) ENGINE=MyISAM;
-INSERT INTO t3 VALUES (1,'jedan'),(2,'dva');
-update t1,t2 set t1.naziv="aaaa" where t1.broj=t2.broj;
-update t1,t2,t3 set t1.naziv="bbbb", t2.naziv="aaaa" where t1.broj=t2.broj and t2.broj=t3.broj;
-drop table t1,t2,t3;
-
-#
-# Test multi update with different join methods
-#
-
-CREATE TABLE t1 (a int not null primary key, b int not null, key (b));
-CREATE TABLE t2 (a int not null primary key, b int not null, key (b));
-INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
-INSERT INTO t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
-
-# Full join, without key
-update t1,t2 set t1.a=t1.a+100;
-select * from t1;
-
-# unique key
-update t1,t2 set t1.a=t1.a+100 where t1.a=101;
-select * from t1;
-
-# ref key
-update t1,t2 set t1.b=t1.b+10 where t1.b=2;
-select * from t1;
-
-# Range key (in t1)
-update t1,t2 set t1.b=t1.b+2,t2.b=t1.b+10 where t1.b between 3 and 5 and t2.a=t1.a-100;
-select * from t1;
-select * from t2;
-
-# test for non-updating table which is also used in sub-select
-
-update t1,t2 set t1.b=t2.b, t1.a=t2.a where t1.a=t2.a and not exists (select * from t2 where t2.a > 10);
-
-drop table t1,t2;
-CREATE TABLE t3 ( KEY1 varchar(50) NOT NULL default '', PARAM_CORR_DISTANCE_RUSH double default NULL, PARAM_CORR_DISTANCE_GEM double default NULL, PARAM_AVG_TARE double default NULL, PARAM_AVG_NB_DAYS double default NULL, PARAM_DEFAULT_PROP_GEM_SRVC varchar(50) default NULL, PARAM_DEFAULT_PROP_GEM_NO_ETIK varchar(50) default NULL, PARAM_SCENARIO_COSTS varchar(50) default NULL, PARAM_DEFAULT_WAGON_COST double default NULL, tmp int(11) default NULL, PRIMARY KEY (KEY1)) ENGINE=MyISAM;
-INSERT INTO t3 VALUES ('A',1,1,22,3.2,'R','R','BASE2',0.24,NULL);
-create table t1 (A varchar(1));
-insert into t1 values ("A") ,("B"),("C"),("D");
-create table t2(Z varchar(15));
-insert into t2(Z) select concat(a.a,b.a,c.a,d.a) from t1 as a, t1 as b, t1 as c, t1 as d;
-update t2,t3 set Z =param_scenario_costs;
-drop table t1,t2,t3;
-create table t1 (a int, b int);
-create table t2 (a int, b int);
-insert into t1 values (1,1),(2,1),(3,1);
-insert into t2 values (1,1), (3,1);
-update t1 left join t2 on t1.a=t2.a set t1.b=2, t2.b=2 where t1.b=1 and t2.b=1 or t2.a is NULL;
-select t1.a, t1.b,t2.a, t2.b from t1 left join t2 on t1.a=t2.a where t1.b=1 and t2.b=1 or t2.a is NULL;
-drop table t1,t2;
-
-#
-# Test reuse of same table
-#
-
-create table t1 (a int not null auto_increment primary key, b int not null);
-insert into t1 (b) values (1),(2),(3),(4);
---disable_warnings ONCE
-update t1, t1 as t2 set t1.b=t2.b+1 where t1.a=t2.a;
-select * from t1;
-drop table t1;
-
-# Test multi-update and multi-delete with impossible where
-
-create table t1(id1 smallint(5), field char(5));
-create table t2(id2 smallint(5), field char(5));
-
-insert into t1 values (1, 'a'), (2, 'aa');
-insert into t2 values (1, 'b'), (2, 'bb');
-
-select * from t1;
-select * from t2;
-
-update t2 inner join t1 on t1.id1=t2.id2
- set t2.field=t1.field
- where 0=1;
-update t2, t1 set t2.field=t1.field
- where t1.id1=t2.id2 and 0=1;
-
-delete t1, t2 from t2 inner join t1 on t1.id1=t2.id2
- where 0=1;
-delete t1, t2 from t2,t1
- where t1.id1=t2.id2 and 0=1;
-
-drop table t1,t2;
-
-#
-# Test alias (this is not correct in 4.0)
-#
-
-CREATE TABLE t1 ( a int );
-CREATE TABLE t2 ( a int );
-DELETE t1 FROM t1, t2 AS t3;
-DELETE t4 FROM t1, t1 AS t4;
-DELETE t3 FROM t1 AS t3, t1 AS t4;
---error ER_UNKNOWN_TABLE
-DELETE t1 FROM t1 AS t3, t2 AS t4;
-INSERT INTO t1 values (1),(2);
-INSERT INTO t2 values (1),(2);
-DELETE t1 FROM t1 AS t2, t2 AS t1 where t1.a=t2.a and t1.a=1;
-SELECT * from t1;
-SELECT * from t2;
-DELETE t2 FROM t1 AS t2, t2 AS t1 where t1.a=t2.a and t1.a=2;
-SELECT * from t1;
-SELECT * from t2;
-DROP TABLE t1,t2;
-
-#
-# Test update with const tables
-#
-create table `t1` (`p_id` int(10) unsigned NOT NULL auto_increment, `p_code` varchar(20) NOT NULL default '', `p_active` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`p_id`) );
-create table `t2` (`c2_id` int(10) unsigned NULL auto_increment, `c2_p_id` int(10) unsigned NOT NULL default '0', `c2_note` text NOT NULL, `c2_active` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`c2_id`), KEY `c2_p_id` (`c2_p_id`) );
-insert into t1 values (0,'A01-Comp',1);
-insert into t1 values (0,'B01-Comp',1);
-insert into t2 values (0,1,'A Note',1);
---disable_warnings ONCE
-update t1 left join t2 on p_id = c2_p_id set c2_note = 'asdf-1' where p_id = 2;
-select * from t1;
-select * from t2;
-drop table t1, t2;
-
-#
-# privilege check for multiupdate with other tables
-#
-
-connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
-connection root;
-create database mysqltest;
-create table mysqltest.t1 (a int, b int, primary key (a));
-create table mysqltest.t2 (a int, b int, primary key (a));
-create table mysqltest.t3 (a int, b int, primary key (a));
-create user mysqltest_1@localhost;
-grant select on mysqltest.* to mysqltest_1@localhost;
-grant update on mysqltest.t1 to mysqltest_1@localhost;
-connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK);
-connection user1;
-update t1, t2 set t1.b=1 where t1.a=t2.a;
-update t1, t2 set t1.b=(select t3.b from t3 where t1.a=t3.a) where t1.a=t2.a;
-connection root;
-revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
-revoke all privileges on mysqltest.* from mysqltest_1@localhost;
-delete from mysql.user where user=_binary'mysqltest_1';
-flush privileges;
-drop database mysqltest;
-connection default;
-disconnect user1;
-disconnect root;
-
-#
-# multi delete wrong table check
-#
-create table t1 (a int, primary key (a));
-create table t2 (a int, primary key (a));
-create table t3 (a int, primary key (a));
--- error ER_UNKNOWN_TABLE
-delete t1,t3 from t1,t2 where t1.a=t2.a and t2.a=(select t3.a from t3 where t1.a=t3.a);
-drop table t1, t2, t3;
-
-#
-# multi* unique updating table check
-#
-create table t1 (col1 int);
-create table t2 (col1 int);
-update t1,t2 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1;
--- error ER_UPDATE_TABLE_USED
-delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2.col1;
-drop table t1,t2;
-
-#
-# Bug#19225 unchecked error leads to server crash
-#
-create table t1(a int);
-create table t2(a int);
---error ER_UPDATE_TABLE_USED
-delete from t1,t2 using t1,t2 where t1.a=(select a from t1);
-drop table t1, t2;
-# End of 4.1 tests
-
-#
-# Test alter table and a concurrent multi update
-# (Before we have introduced data-lock-aware metadata locks
-# this test case forced update to reopen tables).
-#
-
-create table t1 (a int, b int);
-insert into t1 values (1, 2), (2, 3), (3, 4);
-create table t2 (a int);
-insert into t2 values (10), (20), (30);
-create view v1 as select a as b, a/10 as a from t2;
-
-connect (locker,localhost,root,,test);
-connection locker;
-lock table t1 write;
-
-connect (changer,localhost,root,,test);
-connection changer;
-send alter table t1 add column c int default 100 after a;
-
-connect (updater,localhost,root,,test);
-connection updater;
-# Wait till "alter table t1 ..." of session changer is in work.
-# = There is one session waiting.
-let $wait_condition= select count(*)= 1 from information_schema.processlist
- where state= 'Waiting for table metadata lock';
---source include/wait_condition.inc
-send update t1, v1 set t1.b=t1.a+t1.b+v1.b where t1.a=v1.a;
-
-connection locker;
-# Wait till
-# - "alter table t1 ..." of session changer and
-# - "update t1, v1 ..." of session updater
-# are in work.
-# = There are two session waiting.
-let $wait_condition= select count(*)= 2 from information_schema.processlist
- where state= 'Waiting for table metadata lock';
---source include/wait_condition.inc
-unlock tables;
-
-connection changer;
-reap;
-
-connection updater;
-reap;
-select * from t1;
-select * from t2;
-drop view v1;
-drop table t1, t2;
-
-connection default;
-disconnect locker;
-disconnect changer;
-disconnect updater;
-
-#
-# Test multi updates and deletes using primary key and without.
-#
-create table t1 (i1 int, i2 int, i3 int);
-create table t2 (id int, c1 varchar(20), c2 varchar(20));
-insert into t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2);
-insert into t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test");
-select * from t1 order by i1;
-select * from t2;
-update t1,t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id;
-select * from t1 order by i1;
-select * from t2 order by id;
-delete t1.*,t2.* from t1,t2 where t1.i2=t2.id;
-select * from t1 order by i1;
-select * from t2 order by id;
-drop table t1, t2;
-create table t1 (i1 int auto_increment not null, i2 int, i3 int, primary key (i1));
-create table t2 (id int auto_increment not null, c1 varchar(20), c2 varchar(20), primary key(id));
-insert into t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2);
-insert into t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test");
-select * from t1 order by i1;
-select * from t2 order by id;
-update t1,t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id;
-select * from t1 order by i1;
-select * from t2 order by id;
-delete t1.*,t2.* from t1,t2 where t1.i2=t2.id;
-select * from t1 order by i1;
-select * from t2 order by id;
-drop table t1, t2;
-
---echo #
---echo # Bug#49534: multitable IGNORE update with sql_safe_updates error
---echo # causes debug assertion
---echo #
-CREATE TABLE t1( a INT, KEY( a ) );
-INSERT INTO t1 VALUES (1), (2), (3);
-SET SESSION sql_safe_updates = 1;
---echo # Must not cause failed assertion
---error ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
-UPDATE IGNORE t1, t1 t1a SET t1.a = 1 WHERE t1a.a = 1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#54543: update ignore with incorrect subquery leads to assertion
---echo # failure: inited==INDEX
---echo #
-SET SESSION sql_safe_updates = 0;
-CREATE TABLE t1 ( a INT );
-INSERT INTO t1 VALUES (1), (2);
-
-CREATE TABLE t2 ( a INT );
-INSERT INTO t2 VALUES (1), (2);
-
-CREATE TABLE t3 ( a INT );
-INSERT INTO t3 VALUES (1), (2);
-
---echo # Should not crash
-UPDATE IGNORE
- ( SELECT ( SELECT COUNT(*) FROM t1 GROUP BY a, @v ) a FROM t2 ) x, t3
-SET t3.a = 0;
-
-DROP TABLE t1, t2, t3;
-SET SESSION sql_safe_updates = DEFAULT;
-
---echo #
---echo # Bug#52157 various crashes and assertions with multi-table update, stored function
---echo #
-
-CREATE FUNCTION f1 () RETURNS BLOB RETURN 1;
-CREATE TABLE t1 (f1 DATE);
-INSERT INTO t1 VALUES('2001-01-01');
-UPDATE IGNORE (SELECT 1 FROM t1 WHERE f1 = (SELECT f1() FROM t1)) x, t1 SET f1 = 1;
-CREATE view v1 as SELECT f1() FROM t1;
-UPDATE IGNORE (SELECT 1 FROM t1 WHERE f1 = (select * from v1)) x, t1 SET f1 = 1;
-DROP VIEW v1;
-DROP FUNCTION f1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-4123: Incorrect results after multi-table update or
---echo # assertion `!table || (!table->read_set ||
---echo # bitmap_is_set(table->read_set, field_index))' failure
---echo #
-
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (
- id int(10) unsigned NOT NULL,
- level tinyint(3) unsigned NOT NULL,
- PRIMARY KEY (id)
-);
-INSERT INTO t1 VALUES (2519583,1);
-
-DROP TABLE IF EXISTS t2;
-CREATE TABLE t2 (
- club_id int(11) NOT NULL DEFAULT '0',
- profile_id int(11) NOT NULL DEFAULT '0',
- member_level_id int(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (profile_id,club_id)
-);
-INSERT INTO t2 VALUES (2,2519583,12);
-
-DROP TABLE IF EXISTS t3;
-CREATE TABLE t3 (
- member_level_id int(11) unsigned NOT NULL DEFAULT '0',
- map_level int(11) unsigned NOT NULL DEFAULT '0',
- map_status int(11) unsigned NOT NULL DEFAULT '0',
- PRIMARY KEY (member_level_id)
-);
-INSERT INTO t3 VALUES (12,12,1);
-
-CREATE
- VIEW v1 AS
- select club_id,profile_id,
- map_level AS member_level_id,map_status AS member_status
- from (t2 tc join t3 map
- on(((tc.member_level_id = map.member_level_id) and
- (club_id = 2))));
-
-select level, count(*) as cnt from t1 group by level;
-UPDATE t1 c LEFT JOIN v1 t ON (c.id = t.profile_id AND t.club_id = 2)
- SET c.level = IF (t.member_status IS NULL, 1, IF (t.member_status = 1, 2,3));
-select level, count(*) as cnt from t1 group by level;
-drop view v1;
-drop table t1,t2,t3;
-
---echo end of tests
-
---echo #
---echo # BUG#57373: Multi update+InnoDB reports ER_KEY_NOT_FOUND if a
---echo # table is updated twice
---echo #
-
-# Results differ between storage engines.
-# See multi_update_innodb.test for the InnoDB variant of this test
-CREATE TABLE t1(
- pk INT,
- a INT,
- PRIMARY KEY (pk)
-) ENGINE=MyISAM;
-
-INSERT INTO t1 VALUES (0,0);
-UPDATE t1 AS A, t1 AS B SET A.pk = 1, B.a = 2;
---echo
---echo # Should be (1,2)
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # BUG#11882110: UPDATE REPORTS ER_KEY_NOT_FOUND IF TABLE IS
---echo # UPDATED TWICE
---echo #
-
-# Results differ between storage engines. This test is to verify that
-# the bugfix did NOT change behavior for MyISAM.
-# See multi_update_innodb.test for the InnoDB variant of this test
-CREATE TABLE t1 (
- col_int_key int,
- pk int,
- col_int int,
- key(col_int_key),
- primary key (pk)
-) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,2,3);
-
---echo
-CREATE TABLE t2 (
- col_int_key int,
- pk_1 int,
- pk_2 int,
- col_int int,
- key(col_int_key),
- primary key (pk_1,pk_2)
-) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (1,2,3,4);
-
---echo
-UPDATE t1 AS A NATURAL JOIN t1 B SET A.pk=5,B.pk=7;
-
---echo
-SELECT * FROM t1;
-
---echo
-UPDATE t2 AS A NATURAL JOIN t2 B SET A.pk_1=5,B.pk_1=7;
---echo
-UPDATE t2 AS A NATURAL JOIN t2 B SET A.pk_2=10,B.pk_2=11;
-
---echo
-SELECT * FROM t2;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-6139: UPDATE w/ join against MRG_MyISAM table with read-only
---echo # sub-table fails
---echo # MDEV-6193: Problems with multi-table updates that JOIN against
---echo # read-only table
---echo #
-
-CREATE TABLE t1 (
- id int(10) unsigned,
- a int(11)
-) ENGINE=MyISAM;
-
-CREATE TABLE t3 (
- id int(10) unsigned,
- b int(11)
-) ENGINE=MyISAM;
-
-CREATE TABLE t2 (
- id int(10) unsigned,
- b int(11)
-) ENGINE=MRG_MyISAM UNION=(t3);
-
-FLUSH TABLES;
-
-let $MYSQLD_DATADIR= `select @@datadir`;
---disable_result_log
---exec $MYISAMPACK -f $MYSQLD_DATADIR/test/t3
---exec $MYISAMCHK -rq $MYSQLD_DATADIR/test/t3
---enable_result_log
-
-update t1 join t2 using (id) set t1.a=t2.b;
-create view v2 as select * from t2;
-update t1 join v2 using (id) set t1.a=0;
-create view v1 as select * from t3;
-update t1 join v1 using (id) set t1.a=0;
-update t1 join INFORMATION_SCHEMA.CHARACTER_SETS on (id=MAXLEN) set t1.a=0;
-create view v3 as select t2.id, t3.b from t2 join t3 using(id);
-update t1 join v3 using (id) set t1.a=0;
-drop view v1, v2, v3;
-drop table t2, t3, t1;
-
---echo #
---echo # MDEV-7613: MariaDB 5.5.40 server crash on update table left join
---echo # with a view
---echo #
-
-CREATE TABLE `t1` (
- `f1` varchar(6) COLLATE latin1_general_ci DEFAULT NULL,
- `f2` varchar(6) COLLATE latin1_general_ci DEFAULT NULL,
- `f3` varchar(7) COLLATE latin1_general_ci DEFAULT NULL,
- `f4` varchar(15) COLLATE latin1_general_ci DEFAULT NULL,
- `f5` datetime DEFAULT NULL,
- `f6` varchar(2) COLLATE latin1_general_ci DEFAULT NULL,
- `f7` varchar(2) COLLATE latin1_general_ci DEFAULT NULL,
- `ff1` int(1) DEFAULT NULL,
- `ff2` int(1) DEFAULT NULL,
- `ff3` int(1) DEFAULT NULL,
- `ff4` int(1) DEFAULT NULL,
- `ff5` int(1) DEFAULT NULL,
- `ff6` int(1) DEFAULT NULL,
- `ff7` int(1) DEFAULT NULL,
- `ff8` int(2) DEFAULT NULL,
- `ff9` int(1) DEFAULT NULL,
- `ff10` int(1) DEFAULT NULL,
- `ff11` int(1) DEFAULT NULL,
- `ff12` int(1) DEFAULT NULL,
- `ff13` int(1) DEFAULT NULL,
- `ff14` int(1) DEFAULT NULL,
- `ff15` int(1) DEFAULT NULL,
- `f8` varchar(70) COLLATE latin1_general_ci DEFAULT NULL,
- `f9` varchar(20) COLLATE latin1_general_ci DEFAULT NULL,
- `f10` varchar(50) COLLATE latin1_general_ci NOT NULL,
- `f11` varchar(50) COLLATE latin1_general_ci DEFAULT NULL,
- `f12` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
- `f13` text COLLATE latin1_general_ci,
- `f14` time DEFAULT NULL,
- `f15` varchar(30) COLLATE latin1_general_ci DEFAULT NULL,
- `fg1` int(11) DEFAULT NULL,
- `fg2` int(11) DEFAULT NULL,
- `fg3` int(11) DEFAULT NULL,
- `fg4` int(11) DEFAULT NULL,
- `fg5` int(11) DEFAULT NULL,
- `fg6` int(11) DEFAULT NULL,
- `fg7` int(11) DEFAULT NULL,
- `fg9` int(11) DEFAULT NULL,
- `fg10` int(11) DEFAULT NULL,
- `fg11` int(11) DEFAULT NULL,
- `fg12` int(11) DEFAULT NULL,
- `fg13` int(11) DEFAULT NULL,
- `fg14` int(11) DEFAULT NULL,
- `fg15` int(11) DEFAULT NULL,
- `f16` double DEFAULT NULL,
- `f17` double DEFAULT NULL,
- `f18` int(11) DEFAULT NULL,
- `f19` int(11) DEFAULT NULL,
- `f20` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
- `f21` int(11) DEFAULT NULL,
- `f22` int(11) DEFAULT NULL,
- `f23` int(11) DEFAULT NULL,
- `f24` double DEFAULT NULL,
- `f25` int(11) DEFAULT NULL,
- `f26` double DEFAULT NULL,
- `f27` int(11) DEFAULT NULL,
- `f28` int(11) DEFAULT NULL,
- `f29` double DEFAULT NULL,
- `f30` int(11) DEFAULT NULL,
- `f31` double DEFAULT NULL,
- `PZ` double DEFAULT NULL,
- `f32` varchar(50) COLLATE latin1_general_ci DEFAULT NULL,
- `f33` varchar(50) COLLATE latin1_general_ci DEFAULT NULL,
- `f34` varchar(50) COLLATE latin1_general_ci DEFAULT NULL,
- `f35` varchar(30) COLLATE latin1_general_ci DEFAULT NULL,
- `f36` varchar(20) COLLATE latin1_general_ci DEFAULT NULL,
- `f37` varchar(50) COLLATE latin1_general_ci DEFAULT NULL,
- `f20_2` varchar(20) COLLATE latin1_general_ci DEFAULT NULL,
- `f38` varchar(30) COLLATE latin1_general_ci DEFAULT NULL COMMENT 'Email = E-Mail / Whitemail = Brief',
- `insert_ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (`f10`),
- KEY `f5_f12` (`f5`,`f12`),
- KEY `f5_f20` (`f5`,`f20`),
- KEY `f5_f33` (`f5`,`f33`)
-) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci ROW_FORMAT=COMPACT;
-
-INSERT INTO `t1` VALUES ('2011/2','201105','2011/19','gstfbnfr','2011-05-06
-00:00:00','gg','Ag',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,'','','','','','','21:56:28','',0,0,0,0,0,0,0,0,0,0,0,0,0,0,NULL,NULL,0,0,'Dffgult',1,0,0,NULL,0,NULL,0,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'ggggil',NULL),('2008/4','200812','2008/50','hgckbgfx','2008-12-08
-00:00:00','gg','Ag',2,NULL,2,1,1,1,1,24,1,NULL,1,1,1,2,0,'gusschlifßlich
-zugg
-gflffonifrfn','88.77.79.214','10001614','fg-gtgggggdgtfn','fg-gtgggggdgtfn','birgit.tfrpfllf@gggx.df','11:55:21',NULL,1,0,1,1,1,1,1,1,0,1,1,1,0,0,NULL,NULL,0,4,'ffrtrgg',1,6,10,1.66666666666667,4,1,10,14,1.4,1,NULL,NULL,'out',NULL,NULL,'49','ggobilcogg','k.A.',NULL,'ggggil',NULL),('2008/4','200812','2008/51','hgckbgfx','2008-12-15
-00:00:00','gg','Ag',4,5,5,4,5,5,5,NULL,4,5,1,1,1,4,0,'gusschlifßlich zugg
-gflffonifrfn','79.197.185.64','10001686','fg-gtgggggdgtfn','fg-gtgggggdgtfn','kgtjg@swfftys.df','09:28:42',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,11,4.71428571428571,16,1.2,12,49,4.08111111111111,1,NULL,NULL,'out',NULL,NULL,'49','ggobilcogg','k.A.',NULL,'ggggil',NULL),('2008/4','200812','2008/50','nufchti','2008-12-08
-00:00:00','gg','Ag',4,1,1,5,5,5,5,12,4,5,1,1,2,1,0,'gusschlifßlich zugg
-gflffonifrfn','89.54.151.216','10001700','fg-gtgggggdgtfn','fg-gtgggggdgtfn','H_K2006@frffnft.df','16:41:45',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,10,4.28571428571429,11,2.6,12,41,1.58111111111111,1,NULL,NULL,'ffrtrgg
-Bgckofficf 5','vb5','Nufchtfr,
-Iris','49','ggobilcogg','grfurt','Intfrn','ggggil',NULL),('2008/4','200812','2008/50','junghdro','2008-12-11
-00:00:00','Do','Ag',2,2,5,5,4,4,2,72,2,5,2,2,1,1,0,'gusschlifßlich zugg
-gflffonifrfn','84.61.20.216','10001849','fg-ggriff','fg-ggriff','schofnf-glftfr@grcor.df','20:18:05',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,24,1.42857142857141,12,2.4,12,16,1,1,NULL,NULL,'ffrtrgg
-Bgckofficf 5','vb5','Junghfinrich,
-Dorothfg','49','ggobilcogg','grfurt','Intfrn','ggggil',NULL),('2008/4','200812','2008/50','fbflktj','2008-12-08
-00:00:00','gg','Ag',4,2,2,5,1,1,1,24,NULL,NULL,NULL,NULL,NULL,0,0,'Kgggfrg
-bzw. DigiCggg
-Funktion','217.84.62.6','10001888','fg-Kündigungfn','fg-Kündigungfn','f.frofschkf@gggx.df','21:05:59',NULL,1,1,1,1,1,1,1,0,0,0,0,0,0,0,NULL,NULL,0,0,'ffrtrgg',1,7,16,2.28571428571429,0,NULL,7,16,2.28571428571429,0,NULL,NULL,'out',NULL,'gbfl,
-Kgtjg','49','ggobilcogg','k.A.','gxtfrn','ggggil',NULL),('2008/4','200812','2008/50','gltggggri','2008-12-09
-00:00:00','Di','Ag',4,1,1,4,2,1,2,16,1,2,2,2,2,2,0,'gusschlifßlich zugg
-gflffonifrfn','81.171.157.211','10001988','fg-gtgggggdgtfn','fg-gtgggggdgtfn','bistfr@nftcolognf.df','11:07:54',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,21,1,11,2.2,12,12,2.66666666666667,1,NULL,NULL,'out',NULL,NULL,'49','ggobilcogg','k.A.','gxtfrn','ggggil',NULL),('2008/4','200812','2008/50','ggufllfsg','2008-12-09
-00:00:00','Di','Ag',2,2,2,2,1,1,2,12,2,2,2,1,1,2,0,'ggobilfs
-Intfrnft','62.154.142.186','10002097','fg-gtgggggdgtfn','fg-gtgggggdgtfn','norbfrtwfdlich@fgggil.df','09:42:11',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,12,1.71428571428571,8,1.6,12,20,1.66666666666667,1,NULL,NULL,'ffrtrgg
-Bgckofficf 1','vb1','Mufllfr,
-ggbinf','49','ggobilcogg','grfurt','Intfrn','ggggil',NULL),('2008/4','200812','2008/50','wggnfg','2008-12-09
-00:00:00','Di','Ag',5,5,5,5,5,5,5,12,5,5,5,5,5,5,0,'gls grsgtz für
-Ffstnftz','85.180.141.246','10002127','fg-Kündigungfn','fg-Kündigungfn','rfinhgrt.gdolph@yghoo.df','17:44:11',NULL,1,1,1,1,1,1,1,1,1,1,1,1,0,0,NULL,NULL,0,5,'ffrtrgg',1,7,15,5,25,5,12,60,5,1,NULL,NULL,'ffrtrgg
-Bgckofficf 1','vb1','Wggnfr,
-Annftt','49','ggobilcogg','grfurt','Intfrn','ggggil',NULL),('2008/4','200812','2008/50','schubrbf','2008-12-10
-00:00:00','Mi','Ag',1,2,NULL,2,1,2,1,24,NULL,NULL,NULL,NULL,NULL,0,0,'Kgggfrg
-bzw. DigiCggg
-Funktion','91.40.98.242','10002160','fg-gtgggggdgtfn','fg-gtgggggdgtfn','olgf.lifb@gggx.nft','18:18:25',NULL,1,1,0,1,1,1,1,0,0,0,0,0,0,0,NULL,NULL,0,0,'ffrtrgg',1,6,11,1.81111111111111,0,NULL,6,11,1.81111111111111,0,NULL,NULL,'out',NULL,NULL,'49','ggobilcogg','k.A.','gxtfrn','ggggil',NULL);
-
-CREATE TABLE `t2` (
- `ft1` datetime DEFAULT NULL,
- `ft2` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- `ft3` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- `ft4` varchar(255) COLLATE latin1_general_ci NOT NULL DEFAULT '',
- `ft5` varchar(255) COLLATE latin1_general_ci NOT NULL DEFAULT '',
- `ft6` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
- `ft6_2` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
- `ft7` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
- `ft8` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
- `ft9` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
- `ft10` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
- PRIMARY KEY (`ft4`,`ft5`)
-) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
-
-INSERT INTO `t2` VALUES ('2013-03-13 00:00:00','2013-03-13 00:00:00','9999-12-31 00:00:00','#','extern FP f32 2','Default','Intern','DEFAULT',NULL,NULL,NULL),('2013-03-13 00:00:00','2013-03-13 00:00:00','9999-12-31 00:00:00','#','extern FP f32 3','Default','Intern','DEFAULT',NULL,NULL,NULL);
-
-CREATE TABLE `t3` (
- `fe1` int(10) NOT NULL DEFAULT '0',
- `fe2` char(50) COLLATE latin1_general_ci DEFAULT 'nn',
- `f34` char(50) COLLATE latin1_general_ci DEFAULT NULL,
- `fe3` double DEFAULT NULL,
- `fe4` double DEFAULT NULL,
- `fe5` char(4) COLLATE latin1_general_ci DEFAULT NULL,
- `f32` char(50) COLLATE latin1_general_ci DEFAULT NULL,
- `fe6` int(3) DEFAULT '0',
- `fe7` char(1) COLLATE latin1_general_ci DEFAULT NULL,
- `ft6` char(50) COLLATE latin1_general_ci DEFAULT NULL,
- `f33` char(4) COLLATE latin1_general_ci DEFAULT NULL COMMENT 'virtuelle f33s',
- `fe8` char(4) COLLATE latin1_general_ci DEFAULT NULL COMMENT 'aus dem ADS',
- `f37` char(50) COLLATE latin1_general_ci DEFAULT NULL,
- `fe9` char(50) COLLATE latin1_general_ci DEFAULT NULL,
- `fe10` int(5) DEFAULT '0',
- `fe11` int(10) DEFAULT '0',
- `fe12` char(50) COLLATE latin1_general_ci DEFAULT NULL,
- `fe13` double DEFAULT NULL,
- `fe14` char(50) COLLATE latin1_general_ci DEFAULT NULL,
- `fe15` date DEFAULT NULL,
- `fe16` date DEFAULT NULL,
- `fe17` int(10) DEFAULT '0',
- `fe18` date NOT NULL DEFAULT '0000-00-00',
- `ft3` date NOT NULL DEFAULT '0000-00-00',
- PRIMARY KEY (`fe1`),
- KEY `fe2` (`fe2`,`fe18`,`ft3`),
- KEY `f33` (`f33`),
- KEY `fe8` (`fe8`)
-) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci ROW_FORMAT=COMPACT COMMENT='CustomerService und Outsourcer Userinformationen';
-
-INSERT INTO `t3` VALUES (1,'aabggn','gab, glgna',0,NULL,NULL,'gxtgrn D gnd g
-gggsbgrg',0,NULL,'gxtgrn','dsa','dsa','gggsbgrg','0',91611,0,'0',0,'agsggschigdgn','2014-08-11','2014-09-05',0,'2011-01-01','2014-08-11'),(4,'aabigr','gab,
-Iggr',0,NULL,NULL,'gxtgrn D gnd g
-gggsbgrg',0,NULL,'gxtgrn','dsa','dsa','gggsbgrg','0',0,0,'0',0,'agsggschigdgn','2014-08-11','2014-09-05',0,'2012-10-01','2014-08-11'),(7,'abgcrist','gbg,
-ghristggna',15182,1,'ja','ggshilfg gxtgrn 1',1,NULL,'gg
-galgs','ag1','ag1','grfgrt','0',11941,0,'0',0,'agsggschigdgn','2014-01-11',NULL,11802051,'1900-01-01','2010-06-10'),(8,'abgcrist','gbg,
-ghristggna',15182,1,'ja','Zgntralg gftgr galgs Bgtrgggng 1',1,NULL,'gg
-galgs','sb1','sb1','grfgrt','0',11941,0,'0',0,'agsggschigdgn','2014-01-11',NULL,11802051,'2010-07-01','2012-08-11'),(9,'abgcrist','gbg,
-ghristggna',15182,1,'ja','galgs Inbggnd 2',1,NULL,'gg
-galgs','si2','si2','grfgrt','0',11941,0,'0',0,'agsggschigdgn','2014-01-11',NULL,11802051,'2012-09-01','2014-01-11'),(10,'abgcgr','gbg,
-ggrnglgg',14962,1,NULL,'galgs Ogtbggnd 1',1,NULL,'gg
-galgs','sg1','sg1','grfgrt','0',12401,0,'abgcrn',1,NULL,NULL,NULL,11800647,'1900-01-01','2010-11-10'),(11,'abgcgr','gbg,
-ggrnglgg',14962,1,NULL,'galgs Ogtbggnd 1',1,NULL,'gg
-galgs','sg1','sg1','grfgrt','0',12401,0,'abgcrn',1,NULL,NULL,NULL,11800647,'2010-12-01','2011-08-11'),(12,'abgcgr','gbg,
-ggrnglgg',14962,1,NULL,'galgs Ogtbggnd 2',1,NULL,'gg
-galgs','sg2','sg2','grfgrt','0',12401,0,'abgcrn',1,NULL,NULL,NULL,11800647,'2011-09-01','2012-01-11'),(13,'abgcgr','gbg,
-ggrnglgg',14962,0.75,NULL,'galgs Ogtbggnd 2',1,NULL,'gg
-galgs','sg2','sg2','grfgrt','0',12401,0,'abgcrn',1,NULL,NULL,'2011-09-11',11800647,'2012-02-01','2011-08-11'),(14,'rgghrsgr','gbg,
-gigrid',14781,1,'ja','Fgrdgrgngsmanaggmgnt 1',1,NULL,'gg
-Zahlgng','fm1','fm1','grfgrt','0',12141,0,'0',1,NULL,NULL,NULL,11010781,'1900-01-01','2012-08-11');
-
-CREATE ALGORITHM=MERGE
-DEFINER=`root`@`localhost` SQL SECURITY DEFINER
-VIEW `v1` AS select `t1a`.`ft1` AS `ft1`,`t1a`.`ft2` AS `ft2`,`t1a`.`ft3` AS `ft3`,`t1a`.`ft4` AS `ft4`,`t1a`.`ft5` AS `ft5`,`t1a`.`ft6` AS `ft6`,`t1a`.`ft6_2` AS `ft6_2`,`t1a`.`ft7` AS `ft7`,`t1a`.`ft8` AS `ft8`,`t1a`.`ft9` AS `ft9`,`t1a`.`ft10` AS `ft10` from `t2` `t1a` where (if((`t1a`.`ft10` = 'virtuell'),0,1) = 1);
-
-CREATE ALGORITHM=UNDEFINED
-DEFINER=`root`@`localhost` SQL SECURITY DEFINER
-VIEW `v2` AS select distinct `t1b`.`fe2` AS `fe2`,min(`t1b`.`fe18`) AS `fe18`,max(`t1b`.`ft3`) AS `ft3` from `t3` `t1b` where ((`t1b`.`fe2` <> '') and (curdate() >= `t1b`.`fe18`)) group by `t1b`.`fe2`;
-
-CREATE ALGORITHM=UNDEFINED
-DEFINER=`root`@`localhost` SQL SECURITY DEFINER
-VIEW `v3` AS select `t1c`.`fe2` AS `fe2`,`t1c`.`f34` AS `f34`,`t1c`.`f33` AS `f33`,`t1c`.`f32` AS `f32`,`t1c`.`f37` AS `f37`,`t1c`.`fe10` AS `fe10`,if((`tov`.`ft6` in ('klarmobil','callmobile')),`tov`.`ft9`,`tov`.`ft6`) AS `ft6_1`,`tov`.`ft6_2` AS `ft6_2`,`ua`.`fe18` AS `fe18`,`ua`.`ft3` AS `ft3` from ((`t3` `t1c` left join `v2` `ua` on((`t1c`.`fe2` = `ua`.`fe2`))) left join `v1` `tov` on((`t1c`.`fe8` = `tov`.`ft4`))) where (`t1c`.`ft3` = `ua`.`ft3`) group by `t1c`.`fe2`,`t1c`.`f34`,`t1c`.`f33`,`t1c`.`f32` order by `t1c`.`f34`;
-
-UPDATE t1 t1 left join v3 t2 on t1.f4 = t2.fe2 SET t1.f20 = t2.ft6_1, t1.f32 = t2.f32, t1.f33 = t2.f33, t1.f37 = t2.f37 WHERE f5 >= '2015-02-01';
-
---echo #MDEV-8018: main.multi_update fails with --ps-protocol
-prepare stmt1 from "UPDATE t1 t1 left join v3 t2 on t1.f4 = t2.fe2 SET t1.f20 = t2.ft6_1, t1.f32 = t2.f32, t1.f33 = t2.f33, t1.f37 = t2.f37 WHERE f5 >= '2015-02-01'";
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-
-drop view v3,v2,v1;
-drop table t1,t2,t3;
---echo end of 5.5 tests
-
-#
-# MDEV-13911 Support ORDER BY and LIMIT in multi-table update
-#
-
-create table t1 (c1 int, c3 int);
-insert t1(c3) values (1), (2), (3), (4), (5), (6), (7), (8);
-create table t2 select * from t1;
-update t1, t2 set t1.c1=t2.c3 where t1.c3=t2.c3 order by t1.c3 limit 3;
-select * from t1;
-update t1 set c1=NULL;
-update t1, t2 set t1.c1=t2.c3 where t1.c3=t2.c3 order by t1.c3 desc limit 2;
-select * from t1;
-drop table t1, t2;
diff --git a/mysql-test/t/multi_update2-master.opt b/mysql-test/t/multi_update2-master.opt
deleted file mode 100644
index da78f987af3..00000000000
--- a/mysql-test/t/multi_update2-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---tmp_table_size=1024
diff --git a/mysql-test/t/multi_update2.test b/mysql-test/t/multi_update2.test
deleted file mode 100644
index a0f17fabec4..00000000000
--- a/mysql-test/t/multi_update2.test
+++ /dev/null
@@ -1,78 +0,0 @@
---source include/long_test.inc
-
-#
-# Test of update statement that uses many tables.
-#
-
-#
-# If we are running with
-# - Valgrind -> $VALGRIND_TEST <> 0
-# - debug tracing -> @@session.debug LIKE '%trace%'
-# the resource consumption (storage space needed, runtime) will be extreme.
-# Therefore we require that the option "--big-test" is also set.
-#
-
-let $need_big= 0;
---disable_query_log
---error 0,ER_UNKNOWN_SYSTEM_VARIABLE
-SET @aux = @@session.debug;
-if (!$mysql_errno)
-{
- # We have returncode 0 = the server system variable @@session.debug exists.
- # But we only need "--big-test" in case of tracing.
- if (`SELECT @@session.debug LIKE '%trace%'`)
- {
- let $need_big= 1;
- }
-}
---enable_query_log
-if ($VALGRIND_TEST)
-{
- # We are running with Valgrind
- inc $need_big;
-}
-if (`SELECT '$BIG_TEST' = '' AND $need_big = 1`)
-{
- --skip Need "--big-test" when running with the option "--debug" or "--valgrind"
-}
-
-#
-# Bug#1820 Rows not deleted from second table on multi-table delete
-#
-
---disable_warnings
-DROP TABLE IF EXISTS t1,t2;
---enable_warnings
-
-CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL) ;
---echo # The protocolling of many inserts into t1 is suppressed.
---disable_query_log
-INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4);
-let $1=19;
-set @d=4;
-begin;
-while ($1)
-{
- eval INSERT INTO t1 SELECT a+@d,b+@d FROM t1;
- eval SET @d=@d*2;
- dec $1;
-}
-commit;
---enable_query_log
-ALTER TABLE t1 ADD INDEX i1(a);
-DELETE FROM t1 WHERE a > 2000000;
-CREATE TABLE t2 LIKE t1;
-INSERT INTO t2 SELECT * FROM t1;
-
-SELECT 't2 rows before small delete', COUNT(*) FROM t1;
-DELETE t1,t2 FROM t1,t2 WHERE t1.b=t2.a AND t1.a < 2;
-SELECT 't2 rows after small delete', COUNT(*) FROM t2;
-SELECT 't1 rows after small delete', COUNT(*) FROM t1;
-
-## Try deleting many rows
-
-DELETE t1,t2 FROM t1,t2 WHERE t1.b=t2.a AND t1.a < 100*1000;
-SELECT 't2 rows after big delete', COUNT(*) FROM t2;
-SELECT 't1 rows after big delete', COUNT(*) FROM t1;
-
-DROP TABLE t1,t2;
diff --git a/mysql-test/t/multi_update_binlog.test b/mysql-test/t/multi_update_binlog.test
deleted file mode 100644
index 16155aa1af3..00000000000
--- a/mysql-test/t/multi_update_binlog.test
+++ /dev/null
@@ -1,82 +0,0 @@
-#
-# Test of update statement that uses many tables.
-#
-
-source include/have_log_bin.inc;
-
-CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
-
-#
-# Bug#27716 multi-update did partially and has not binlogged
-#
-
-CREATE TABLE `t1` (
- `a` int(11) NOT NULL auto_increment,
- `b` int(11) default NULL,
- PRIMARY KEY (`a`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
-
-CREATE TABLE `t2` (
- `a` int(11) NOT NULL auto_increment,
- `b` int(11) default NULL,
- PRIMARY KEY (`a`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
-
-# as the test is about to see erroed queries in binlog
-set @sav_binlog_format= @@session.binlog_format;
-set @@session.binlog_format= mixed;
-
-
-# A. testing multi_update::send_error() effective update
-insert into t1 values (1,1),(2,2);
-insert into t2 values (1,1),(4,4);
-reset master;
---error ER_DUP_ENTRY
-UPDATE t2,t1 SET t2.a=t1.a+2;
-# check
-select * from t2 /* must be (3,1), (4,4) */;
-source include/show_binlog_events.inc;
-
-# B. testing multi_update::send_error() ineffective update
-# (as there is a policy described at mysql_update() still go to binlog)
-delete from t1;
-delete from t2;
-insert into t1 values (1,2),(3,4),(4,4);
-insert into t2 values (1,2),(3,4),(4,4);
-reset master;
---error ER_DUP_ENTRY
-UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
-source include/show_binlog_events.inc;
-
-# cleanup
-drop table t1, t2;
-set @@session.binlog_format= @sav_binlog_format;
-
-#
-# Bug#29136 erred multi-delete on trans table does not rollback
-#
-
-# prepare
-CREATE TABLE t1 (a int, PRIMARY KEY (a));
-CREATE TABLE t2 (a int, PRIMARY KEY (a));
-CREATE TABLE t3 (a int, PRIMARY KEY (a)) ENGINE=MyISAM;
-create trigger trg_del_t3 before delete on t3 for each row insert into t1 values (1);
-
-insert into t2 values (1),(2);
-insert into t3 values (1),(2);
-reset master;
-
-# exec cases B, A - see innodb.test
-
-# B. send_eof() and send_error() afterward
-
---error ER_DUP_ENTRY
-delete t3.* from t2,t3 where t2.a=t3.a;
-
-# check
-select count(*) from t1 /* must be 1 */;
-select count(*) from t3 /* must be 1 */;
-
-# cleanup
-drop table t1, t2, t3;
-
diff --git a/mysql-test/t/multi_update_innodb.test b/mysql-test/t/multi_update_innodb.test
deleted file mode 100644
index f5f8f91edb8..00000000000
--- a/mysql-test/t/multi_update_innodb.test
+++ /dev/null
@@ -1,175 +0,0 @@
---source include/have_innodb.inc
-
---echo #
---echo # BUG#57373: Multi update+InnoDB reports ER_KEY_NOT_FOUND if a
---echo # table is updated twice
---echo #
-
-# Results differ between storage engines.
-# See multi_update.test for the MyISAM variant of this test
-CREATE TABLE t1(
- pk INT,
- a INT,
- b INT,
- PRIMARY KEY (pk)
-) ENGINE=InnoDB;
-
-INSERT INTO t1 VALUES (0,0,0);
---error ER_MULTI_UPDATE_KEY_CONFLICT
-UPDATE t1 AS A, t1 AS B SET A.pk = 1, B.a = 2;
-SELECT * FROM t1;
-
-CREATE VIEW v1 AS SELECT * FROM t1;
---error ER_MULTI_UPDATE_KEY_CONFLICT
-UPDATE v1 AS A, t1 AS B SET A.pk = 1, B.a = 2;
-SELECT * FROM t1;
-
-UPDATE t1 AS A, t1 AS B SET A.a = 1, B.b = 2;
---echo # Should be (0,1,2)
-SELECT * FROM t1;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo #
---echo # BUG#11882110: UPDATE REPORTS ER_KEY_NOT_FOUND IF TABLE IS
---echo # UPDATED TWICE
---echo #
-
-# Results differ between storage engines.
-# See multi_update.test for the MyISAM variant of this test
-CREATE TABLE t1 (
- col_int_key int,
- pk int,
- col_int int,
- key(col_int_key),
- primary key (pk)
-) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1,2,3);
-
---echo
-CREATE TABLE t2 (
- col_int_key int,
- pk_1 int,
- pk_2 int,
- col_int int,
- key(col_int_key),
- primary key (pk_1,pk_2)
-) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,2,3,4);
-
---echo
---error ER_MULTI_UPDATE_KEY_CONFLICT
-UPDATE t1 AS A NATURAL JOIN t1 B SET A.pk=5,B.pk=7;
---echo
-SELECT * FROM t1;
-
---echo
---error ER_MULTI_UPDATE_KEY_CONFLICT
-UPDATE t2 AS A NATURAL JOIN t2 B SET A.pk_1=5,B.pk_1=7;
---echo
---error ER_MULTI_UPDATE_KEY_CONFLICT
-UPDATE t2 AS A NATURAL JOIN t2 B SET A.pk_2=10,B.pk_2=11;
-
---echo
-SELECT * FROM t2;
-
-DROP TABLE t1,t2;
-
---echo
---echo # Bug mdev-5970
---echo # Bug#13256831 - ERROR 1032 (HY000): CAN'T FIND RECORD
---echo
-
-CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT) ENGINE=InnoDB;
-CREATE TABLE t2 (f1 INT PRIMARY KEY, f2 INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (5, 7);
-INSERT INTO t2 VALUES (6, 97);
-
-CREATE ALGORITHM = MERGE VIEW v1 AS
-SELECT a2.f1 AS f1, a2.f2 AS f2
-FROM t1 AS a1 JOIN t2 AS a2 ON a1.f2 > a2.f1
-WITH LOCAL CHECK OPTION;
-
-SELECT * FROM v1;
-UPDATE v1 SET f1 = 1;
-SELECT * FROM v1;
-
-DROP TABLE t1, t2;
-DROP VIEW v1;
-
---echo #
---echo # MDEV-5973: MySQL Bug#11757486:49539: NON-DESCRIPTIVE ERR (ERROR 0
---echo # FROM STORAGE ENGINE) WITH MULTI-TABLE UPDATE
---echo #
-
-CREATE TABLE table_11757486 (field1 tinyint) ENGINE=INNODB;
-INSERT INTO table_11757486 VALUES (0),(0);
-SET SESSION SQL_MODE='STRICT_ALL_TABLES';
-UPDATE IGNORE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1;
-UPDATE IGNORE table_11757486 SET field1=128;
-
---error ER_WARN_DATA_OUT_OF_RANGE
-UPDATE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1;
---error ER_WARN_DATA_OUT_OF_RANGE
-UPDATE table_11757486 SET field1=128;
-
-SET SESSION SQL_MODE='';
-UPDATE IGNORE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1;
-UPDATE IGNORE table_11757486 SET field1=128;
-
-DROP TABLE table_11757486;
-
-SET SESSION SQL_MODE=default;
-
-# Test for Bug#5837 delete with outer join and const tables
-create table t1 (
- aclid bigint not null primary key,
- status tinyint(1) not null
-) engine = innodb;
-
-create table t2 (
- refid bigint not null primary key,
- aclid bigint, index idx_acl(aclid)
-) engine = innodb;
-insert into t2 values(1,null);
-delete t2, t1 from t2 left join t1 on (t2.aclid=t1.aclid) where t2.refid='1';
-drop table t1, t2;
-
-#
-# Test for Bug#1980.
-#
-create table t1 ( c char(8) not null ) engine=innodb;
-
-insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
-insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
-
-alter table t1 add b char(8) not null;
-alter table t1 add a char(8) not null;
-alter table t1 add primary key (a,b,c);
-update t1 set a=c, b=c;
-
-create table t2 like t1;
-insert into t2 select * from t1;
-
-delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
-
-drop table t1,t2;
-
-create table t1 ( c char(8) not null ) engine=innodb;
-
-insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
-insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
-
-alter table t1 add b char(8) not null;
-alter table t1 add a char(8) not null;
-alter table t1 add primary key (a,b,c);
-update t1 set a=c, b=c;
-
-create table t2 like t1;
-insert into t2 select * from t1;
-
-delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
-
-drop table t1,t2;
-
diff --git a/mysql-test/t/multi_update_tiny_hash-master.opt b/mysql-test/t/multi_update_tiny_hash-master.opt
deleted file mode 100644
index 2fa4c2b903d..00000000000
--- a/mysql-test/t/multi_update_tiny_hash-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---max_heap_table_size=16384
diff --git a/mysql-test/t/multi_update_tiny_hash.test b/mysql-test/t/multi_update_tiny_hash.test
deleted file mode 100644
index 10d469fb076..00000000000
--- a/mysql-test/t/multi_update_tiny_hash.test
+++ /dev/null
@@ -1,61 +0,0 @@
-#
-# Test of update statement that uses many tables,
-# --max_heap_table_size=1
-#
-
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-
---echo #
---echo # Bug #36676: multiupdate using LEFT JOIN updates only
---echo # first row or fails with an error:
---echo # ERROR 1022 (23000): Can't write; duplicate key in table ''
---echo #
-
---echo
-
---echo #
---echo # Multiupdate creates MyISAM temporary table without MEMORY table
---echo #
-
-CREATE TABLE t1 (ID INT);
-CREATE TABLE t2 (ID INT,
- s1 TEXT, s2 TEXT, s3 VARCHAR(10), s4 TEXT, s5 VARCHAR(10));
-
-INSERT INTO t1 VALUES (1),(2);
-INSERT INTO t2 VALUES (1,'test', 'test', 'test', 'test', 'test'),
- (2,'test', 'test', 'test', 'test', 'test');
-
-SELECT * FROM t1 LEFT JOIN t2 USING(ID);
-UPDATE t1 LEFT JOIN t2 USING(ID) SET s1 = 'changed';
-UPDATE t1 JOIN t2 USING(ID) SET s2 = 'changed';
-UPDATE t1 LEFT JOIN t2 USING(ID) SET s3 = 'changed';
-UPDATE t1 LEFT JOIN t2 USING(ID) SET s4 = 'changed', s5 = 'changed';
-SELECT * FROM t1 LEFT JOIN t2 USING(ID);
-
-DROP TABLE t1, t2;
-
---echo #
---echo # Multiupdate creates temporary MyISAM table from MEMORY table
---echo #
-
-CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
-CREATE TABLE t2 (id INT, s1 CHAR(255));
-
-# insert [1..64] into table `t1`
-INSERT INTO t1 VALUES (0), (0), (0), (0), (0), (0), (0), (0);
-INSERT INTO t1 (SELECT 0 FROM t1);
-INSERT INTO t1 (SELECT 0 FROM t1);
-INSERT INTO t1 (SELECT 0 FROM t1);
-
-INSERT INTO t2 (SELECT ID, 'a' FROM t1);
-
-UPDATE t1 LEFT JOIN t2 USING(id) SET s1 = 'b';
-
-SELECT DISTINCT s1 FROM t1 LEFT JOIN t2 USING(id);
-
-DROP TABLE t1, t2;
-
-
---echo # End of 5.0 tests
diff --git a/mysql-test/t/myisam-big.test b/mysql-test/t/myisam-big.test
deleted file mode 100644
index 2fec2450ecd..00000000000
--- a/mysql-test/t/myisam-big.test
+++ /dev/null
@@ -1,64 +0,0 @@
-#
-# Test bugs in the MyISAM code that require more space/time
---source include/big_test.inc
-
-# Initialise
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-#
-# BUG#925377:
-# Querying myisam table metadata while 'alter table..enable keys' is
-# running may corrupt the table
-#
-create table t1 (id int, sometext varchar(100)) engine=myisam;
-insert into t1 values (1, "hello"),(2, "hello2"),(4, "hello3"),(4, "hello4");
-create table t2 like t1;
-insert into t1 select * from t1;
-insert into t2 select * from t1;
-insert into t1 select * from t1;
-insert into t2 select * from t1;
-insert into t1 select * from t1;
-insert into t2 select * from t1;
-insert into t1 select * from t1;
-insert into t2 select * from t1;
-insert into t1 select * from t1;
-insert into t2 select * from t1;
-insert into t1 select * from t1;
-insert into t2 select * from t1;
-insert into t1 select * from t1;
-insert into t2 select * from t1;
-insert into t1 select * from t1;
-insert into t2 select * from t1;
-insert into t1 select * from t1;
-insert into t2 select * from t1;
-insert into t1 select * from t1;
-insert into t2 select * from t1;
-insert into t1 select * from t1;
-insert into t2 select * from t1;
-insert into t1 select * from t1;
-insert into t2 select * from t1;
-insert into t1 select * from t1;
-insert into t2 select * from t1;
-insert into t1 select * from t1;
-insert into t2 select * from t1;
-insert into t1 select * from t1;
-select count(*) from t1;
-connect (con2,localhost,root,,);
-connection con2;
-alter table t1 add index (id), add index(sometext), add index(sometext,id);
-alter table t1 disable keys;
-send alter table t1 enable keys;
-connection default;
---sleep 1
---disable_query_log
---disable_result_log
-show table status like 't1';
---enable_query_log
---enable_result_log
-connection con2;
-reap;
-disconnect con2;
-connection default;
-drop table t1,t2;
diff --git a/mysql-test/t/myisam-blob-master.opt b/mysql-test/t/myisam-blob-master.opt
deleted file mode 100644
index ededac33ec7..00000000000
--- a/mysql-test/t/myisam-blob-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---max-allowed-packet=24M --loose-skip-innodb --key-buffer-size=1M
diff --git a/mysql-test/t/myisam-blob.test b/mysql-test/t/myisam-blob.test
deleted file mode 100644
index 23de8d54ee7..00000000000
--- a/mysql-test/t/myisam-blob.test
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-# Test bugs in the MyISAM code with blobs
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-# Bug #2159 (Problem with update of blob to > 16M)
-
-CREATE TABLE t1 (data LONGBLOB) ENGINE=myisam;
-INSERT INTO t1 (data) VALUES (NULL);
-UPDATE t1 set data=repeat('a',18*1024*1024);
-select length(data) from t1;
-delete from t1 where left(data,1)='a';
-check table t1;
-truncate table t1;
-INSERT INTO t1 (data) VALUES (repeat('a',1*1024*1024));
-INSERT INTO t1 (data) VALUES (repeat('b',16*1024*1024-1024));
-delete from t1 where left(data,1)='b';
-check table t1;
-
-# now we have two blocks in the table, first is a 1M record and second is
-# a 16M delete block.
-
-UPDATE t1 set data=repeat('c',17*1024*1024);
-check table t1;
-delete from t1 where left(data,1)='c';
-check table t1;
-
-INSERT INTO t1 set data=repeat('a',18*1024*1024);
-select length(data) from t1;
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-alter table t1 modify data blob;
-select length(data) from t1;
-drop table t1;
-
-CREATE TABLE t1 (data BLOB) ENGINE=myisam;
-INSERT INTO t1 (data) VALUES (NULL);
-UPDATE IGNORE t1 set data=repeat('a',18*1024*1024);
-select length(data) from t1;
-drop table t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/myisam-master.opt b/mysql-test/t/myisam-master.opt
deleted file mode 100644
index c5f16ccfd5b..00000000000
--- a/mysql-test/t/myisam-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---myisam-recover-options=off
diff --git a/mysql-test/t/myisam-optimize.test b/mysql-test/t/myisam-optimize.test
deleted file mode 100644
index 7c1fe4ec1c8..00000000000
--- a/mysql-test/t/myisam-optimize.test
+++ /dev/null
@@ -1,58 +0,0 @@
---echo #
---echo # MDEV-8475 stale .TMM file causes Aria engine to stop serving the table
---echo #
-create table t1 (pk int primary key, i int) engine=MyISAM;
-insert into t1 values (1,1),(2,2);
---let $datadir=`SELECT @@datadir`
-
---write_file $datadir/test/t1.TMM
-EOF
-
---connect (con1,localhost,root,,)
-SHOW CREATE TABLE t1;
-OPTIMIZE TABLE t1;
---disconnect con1
-
---connect (con1,localhost,root,,)
-SHOW CREATE TABLE t1;
-OPTIMIZE TABLE t1;
---disconnect con1
-
---connect (con1,localhost,root,,)
-SHOW CREATE TABLE t1;
-OPTIMIZE TABLE t1;
---disconnect con1
-
-# Cleanup
---connection default
-DROP TABLE t1;
-
-#
-# Test also Aria
-#
-
-create table t1 (pk int primary key, i int) engine=aria;
-insert into t1 values (1,1),(2,2);
---let $datadir=`SELECT @@datadir`
-
---write_file $datadir/test/t1.TMM
-EOF
-
---connect (con1,localhost,root,,)
-SHOW CREATE TABLE t1;
-OPTIMIZE TABLE t1;
---disconnect con1
-
---connect (con1,localhost,root,,)
-SHOW CREATE TABLE t1;
-OPTIMIZE TABLE t1;
---disconnect con1
-
---connect (con1,localhost,root,,)
-SHOW CREATE TABLE t1;
-OPTIMIZE TABLE t1;
---disconnect con1
-
-# Cleanup
---connection default
-DROP TABLE t1;
diff --git a/mysql-test/t/myisam-system.test b/mysql-test/t/myisam-system.test
deleted file mode 100644
index cece33bb00b..00000000000
--- a/mysql-test/t/myisam-system.test
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# Test how DROP TABLE works if the index or data file doesn't exists
-
-# Initialise
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-create table t1 (a int) engine=myisam;
-let $MYSQLD_DATADIR= `select @@datadir`;
---remove_file $MYSQLD_DATADIR/test/t1.MYI
---replace_result $MYSQLD_DATADIR ./
-drop table if exists t1;
-create table t1 (a int) engine=myisam;
---remove_file $MYSQLD_DATADIR/test/t1.MYI
---replace_result $MYSQLD_DATADIR ./
---error ER_FILE_NOT_FOUND
-select * from t1;
---replace_result $MYSQLD_DATADIR ./
-drop table t1;
-create table t1 (a int) engine=myisam;
---remove_file $MYSQLD_DATADIR/test/t1.MYD
---replace_result $MYSQLD_DATADIR ./
---error 29
-select * from t1;
---replace_result $MYSQLD_DATADIR ./
-drop table t1;
---error ER_BAD_TABLE_ERROR
-drop table t1;
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
deleted file mode 100644
index 24f3ff783c9..00000000000
--- a/mysql-test/t/myisam.test
+++ /dev/null
@@ -1,1801 +0,0 @@
-#
-# Test bugs in the MyISAM code
-#
-
-call mtr.add_suppression("Can't find record in '.*'");
-call mtr.add_suppression("Table 't1' is marked as crashed and should be repaired");
-
-# Initialise
---disable_warnings
-drop table if exists t1,t2,t3;
---enable_warnings
-SET SQL_WARNINGS=1;
-
-#
-# Test problem with CHECK TABLE;
-#
-
-CREATE TABLE t1 (
- STRING_DATA char(255) default NULL,
- KEY string_data (STRING_DATA)
-) ENGINE=MyISAM;
-
-INSERT INTO t1 VALUES ('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA');
-INSERT INTO t1 VALUES ('DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD');
-INSERT INTO t1 VALUES ('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF');
-INSERT INTO t1 VALUES ('FGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG');
-INSERT INTO t1 VALUES ('HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH');
-INSERT INTO t1 VALUES ('WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW');
-CHECK TABLE t1;
-drop table t1;
-
-#
-# Test problem with rows that are 65517-65520 bytes long
-#
-
-create table t1 (a tinyint not null auto_increment, b blob not null, primary key (a));
-
-let $1=100;
---disable_query_log
-begin;
---disable_warnings
-SET SQL_WARNINGS=0;
-while ($1)
-{
- eval insert ignore into t1 (b) values(repeat(char(65+$1),65550-$1));
- dec $1;
-}
-commit;
-SET SQL_WARNINGS=1;
---enable_warnings
---enable_query_log
-check table t1;
-repair table t1;
-delete from t1 where (a & 1);
-check table t1;
-repair table t1;
-check table t1;
-drop table t1;
-
-#
-# Test bug: Two optimize in a row reset index cardinality
-#
-
-create table t1 (a int not null auto_increment, b int not null, primary key (a), index(b));
-insert into t1 (b) values (1),(2),(2),(2),(2);
-optimize table t1;
-show index from t1;
-optimize table t1;
-show index from t1;
-drop table t1;
-
-#
-# Test of how ORDER BY works when doing it on the whole table
-#
-
-create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=myisam;
-insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
-explain select * from t1 order by a;
-explain select * from t1 order by b;
-explain select * from t1 order by c;
-explain select a from t1 order by a;
-explain select b from t1 order by b;
-explain select a,b from t1 order by b;
-explain select a,b from t1;
-explain select a,b,c from t1;
-drop table t1;
-
-#
-# Test of OPTIMIZE of locked and modified tables
-#
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1), (2), (3);
-LOCK TABLES t1 WRITE;
-INSERT INTO t1 VALUES (1), (2), (3);
-OPTIMIZE TABLE t1;
-DROP TABLE t1;
-
-#
-# Test of optimize, when only mi_sort_index (but not mi_repair*) is done
-# in ha_myisam::repair, and index size is changed (decreased).
-#
-
-create table t1 ( t1 char(255), key(t1(250)));
-insert t1 values ('137513751375137513751375137513751375137569516951695169516951695169516951695169');
-insert t1 values ('178417841784178417841784178417841784178403420342034203420342034203420342034203');
-insert t1 values ('213872387238723872387238723872387238723867376737673767376737673767376737673767');
-insert t1 values ('242624262426242624262426242624262426242607890789078907890789078907890789078907');
-insert t1 values ('256025602560256025602560256025602560256011701170117011701170117011701170117011');
-insert t1 values ('276027602760276027602760276027602760276001610161016101610161016101610161016101');
-insert t1 values ('281528152815281528152815281528152815281564956495649564956495649564956495649564');
-insert t1 values ('292129212921292129212921292129212921292102100210021002100210021002100210021002');
-insert t1 values ('380638063806380638063806380638063806380634483448344834483448344834483448344834');
-insert t1 values ('411641164116411641164116411641164116411616301630163016301630163016301630163016');
-insert t1 values ('420842084208420842084208420842084208420899889988998899889988998899889988998899');
-insert t1 values ('438443844384438443844384438443844384438482448244824482448244824482448244824482');
-insert t1 values ('443244324432443244324432443244324432443239613961396139613961396139613961396139');
-insert t1 values ('485448544854485448544854485448544854485477847784778477847784778477847784778477');
-insert t1 values ('494549454945494549454945494549454945494555275527552755275527552755275527552755');
-insert t1 values ('538647864786478647864786478647864786478688918891889188918891889188918891889188');
-insert t1 values ('565556555655565556555655565556555655565554845484548454845484548454845484548454');
-insert t1 values ('607860786078607860786078607860786078607856665666566656665666566656665666566656');
-insert t1 values ('640164016401640164016401640164016401640141274127412741274127412741274127412741');
-insert t1 values ('719471947194719471947194719471947194719478717871787178717871787178717871787178');
-insert t1 values ('742574257425742574257425742574257425742549604960496049604960496049604960496049');
-insert t1 values ('887088708870887088708870887088708870887035963596359635963596359635963596359635');
-insert t1 values ('917791779177917791779177917791779177917773857385738573857385738573857385738573');
-insert t1 values ('933293329332933293329332933293329332933278987898789878987898789878987898789878');
-insert t1 values ('963896389638963896389638963896389638963877807780778077807780778077807780778077');
-delete from t1 where t1>'2';
-insert t1 values ('70'), ('84'), ('60'), ('20'), ('76'), ('89'), ('49'), ('50'),
-('88'), ('61'), ('42'), ('98'), ('39'), ('30'), ('25'), ('66'), ('61'), ('48'),
-('80'), ('84'), ('98'), ('19'), ('91'), ('42'), ('47');
-optimize table t1;
-check table t1;
-drop table t1;
-
-#
-# test of myisam with huge number of packed fields
-#
-
-create table t1 (i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8
-int, i9 int, i10 int, i11 int, i12 int, i13 int, i14 int, i15 int, i16 int, i17
-int, i18 int, i19 int, i20 int, i21 int, i22 int, i23 int, i24 int, i25 int,
-i26 int, i27 int, i28 int, i29 int, i30 int, i31 int, i32 int, i33 int, i34
-int, i35 int, i36 int, i37 int, i38 int, i39 int, i40 int, i41 int, i42 int,
-i43 int, i44 int, i45 int, i46 int, i47 int, i48 int, i49 int, i50 int, i51
-int, i52 int, i53 int, i54 int, i55 int, i56 int, i57 int, i58 int, i59 int,
-i60 int, i61 int, i62 int, i63 int, i64 int, i65 int, i66 int, i67 int, i68
-int, i69 int, i70 int, i71 int, i72 int, i73 int, i74 int, i75 int, i76 int,
-i77 int, i78 int, i79 int, i80 int, i81 int, i82 int, i83 int, i84 int, i85
-int, i86 int, i87 int, i88 int, i89 int, i90 int, i91 int, i92 int, i93 int,
-i94 int, i95 int, i96 int, i97 int, i98 int, i99 int, i100 int, i101 int, i102
-int, i103 int, i104 int, i105 int, i106 int, i107 int, i108 int, i109 int, i110
-int, i111 int, i112 int, i113 int, i114 int, i115 int, i116 int, i117 int, i118
-int, i119 int, i120 int, i121 int, i122 int, i123 int, i124 int, i125 int, i126
-int, i127 int, i128 int, i129 int, i130 int, i131 int, i132 int, i133 int, i134
-int, i135 int, i136 int, i137 int, i138 int, i139 int, i140 int, i141 int, i142
-int, i143 int, i144 int, i145 int, i146 int, i147 int, i148 int, i149 int, i150
-int, i151 int, i152 int, i153 int, i154 int, i155 int, i156 int, i157 int, i158
-int, i159 int, i160 int, i161 int, i162 int, i163 int, i164 int, i165 int, i166
-int, i167 int, i168 int, i169 int, i170 int, i171 int, i172 int, i173 int, i174
-int, i175 int, i176 int, i177 int, i178 int, i179 int, i180 int, i181 int, i182
-int, i183 int, i184 int, i185 int, i186 int, i187 int, i188 int, i189 int, i190
-int, i191 int, i192 int, i193 int, i194 int, i195 int, i196 int, i197 int, i198
-int, i199 int, i200 int, i201 int, i202 int, i203 int, i204 int, i205 int, i206
-int, i207 int, i208 int, i209 int, i210 int, i211 int, i212 int, i213 int, i214
-int, i215 int, i216 int, i217 int, i218 int, i219 int, i220 int, i221 int, i222
-int, i223 int, i224 int, i225 int, i226 int, i227 int, i228 int, i229 int, i230
-int, i231 int, i232 int, i233 int, i234 int, i235 int, i236 int, i237 int, i238
-int, i239 int, i240 int, i241 int, i242 int, i243 int, i244 int, i245 int, i246
-int, i247 int, i248 int, i249 int, i250 int, i251 int, i252 int, i253 int, i254
-int, i255 int, i256 int, i257 int, i258 int, i259 int, i260 int, i261 int, i262
-int, i263 int, i264 int, i265 int, i266 int, i267 int, i268 int, i269 int, i270
-int, i271 int, i272 int, i273 int, i274 int, i275 int, i276 int, i277 int, i278
-int, i279 int, i280 int, i281 int, i282 int, i283 int, i284 int, i285 int, i286
-int, i287 int, i288 int, i289 int, i290 int, i291 int, i292 int, i293 int, i294
-int, i295 int, i296 int, i297 int, i298 int, i299 int, i300 int, i301 int, i302
-int, i303 int, i304 int, i305 int, i306 int, i307 int, i308 int, i309 int, i310
-int, i311 int, i312 int, i313 int, i314 int, i315 int, i316 int, i317 int, i318
-int, i319 int, i320 int, i321 int, i322 int, i323 int, i324 int, i325 int, i326
-int, i327 int, i328 int, i329 int, i330 int, i331 int, i332 int, i333 int, i334
-int, i335 int, i336 int, i337 int, i338 int, i339 int, i340 int, i341 int, i342
-int, i343 int, i344 int, i345 int, i346 int, i347 int, i348 int, i349 int, i350
-int, i351 int, i352 int, i353 int, i354 int, i355 int, i356 int, i357 int, i358
-int, i359 int, i360 int, i361 int, i362 int, i363 int, i364 int, i365 int, i366
-int, i367 int, i368 int, i369 int, i370 int, i371 int, i372 int, i373 int, i374
-int, i375 int, i376 int, i377 int, i378 int, i379 int, i380 int, i381 int, i382
-int, i383 int, i384 int, i385 int, i386 int, i387 int, i388 int, i389 int, i390
-int, i391 int, i392 int, i393 int, i394 int, i395 int, i396 int, i397 int, i398
-int, i399 int, i400 int, i401 int, i402 int, i403 int, i404 int, i405 int, i406
-int, i407 int, i408 int, i409 int, i410 int, i411 int, i412 int, i413 int, i414
-int, i415 int, i416 int, i417 int, i418 int, i419 int, i420 int, i421 int, i422
-int, i423 int, i424 int, i425 int, i426 int, i427 int, i428 int, i429 int, i430
-int, i431 int, i432 int, i433 int, i434 int, i435 int, i436 int, i437 int, i438
-int, i439 int, i440 int, i441 int, i442 int, i443 int, i444 int, i445 int, i446
-int, i447 int, i448 int, i449 int, i450 int, i451 int, i452 int, i453 int, i454
-int, i455 int, i456 int, i457 int, i458 int, i459 int, i460 int, i461 int, i462
-int, i463 int, i464 int, i465 int, i466 int, i467 int, i468 int, i469 int, i470
-int, i471 int, i472 int, i473 int, i474 int, i475 int, i476 int, i477 int, i478
-int, i479 int, i480 int, i481 int, i482 int, i483 int, i484 int, i485 int, i486
-int, i487 int, i488 int, i489 int, i490 int, i491 int, i492 int, i493 int, i494
-int, i495 int, i496 int, i497 int, i498 int, i499 int, i500 int, i501 int, i502
-int, i503 int, i504 int, i505 int, i506 int, i507 int, i508 int, i509 int, i510
-int, i511 int, i512 int, i513 int, i514 int, i515 int, i516 int, i517 int, i518
-int, i519 int, i520 int, i521 int, i522 int, i523 int, i524 int, i525 int, i526
-int, i527 int, i528 int, i529 int, i530 int, i531 int, i532 int, i533 int, i534
-int, i535 int, i536 int, i537 int, i538 int, i539 int, i540 int, i541 int, i542
-int, i543 int, i544 int, i545 int, i546 int, i547 int, i548 int, i549 int, i550
-int, i551 int, i552 int, i553 int, i554 int, i555 int, i556 int, i557 int, i558
-int, i559 int, i560 int, i561 int, i562 int, i563 int, i564 int, i565 int, i566
-int, i567 int, i568 int, i569 int, i570 int, i571 int, i572 int, i573 int, i574
-int, i575 int, i576 int, i577 int, i578 int, i579 int, i580 int, i581 int, i582
-int, i583 int, i584 int, i585 int, i586 int, i587 int, i588 int, i589 int, i590
-int, i591 int, i592 int, i593 int, i594 int, i595 int, i596 int, i597 int, i598
-int, i599 int, i600 int, i601 int, i602 int, i603 int, i604 int, i605 int, i606
-int, i607 int, i608 int, i609 int, i610 int, i611 int, i612 int, i613 int, i614
-int, i615 int, i616 int, i617 int, i618 int, i619 int, i620 int, i621 int, i622
-int, i623 int, i624 int, i625 int, i626 int, i627 int, i628 int, i629 int, i630
-int, i631 int, i632 int, i633 int, i634 int, i635 int, i636 int, i637 int, i638
-int, i639 int, i640 int, i641 int, i642 int, i643 int, i644 int, i645 int, i646
-int, i647 int, i648 int, i649 int, i650 int, i651 int, i652 int, i653 int, i654
-int, i655 int, i656 int, i657 int, i658 int, i659 int, i660 int, i661 int, i662
-int, i663 int, i664 int, i665 int, i666 int, i667 int, i668 int, i669 int, i670
-int, i671 int, i672 int, i673 int, i674 int, i675 int, i676 int, i677 int, i678
-int, i679 int, i680 int, i681 int, i682 int, i683 int, i684 int, i685 int, i686
-int, i687 int, i688 int, i689 int, i690 int, i691 int, i692 int, i693 int, i694
-int, i695 int, i696 int, i697 int, i698 int, i699 int, i700 int, i701 int, i702
-int, i703 int, i704 int, i705 int, i706 int, i707 int, i708 int, i709 int, i710
-int, i711 int, i712 int, i713 int, i714 int, i715 int, i716 int, i717 int, i718
-int, i719 int, i720 int, i721 int, i722 int, i723 int, i724 int, i725 int, i726
-int, i727 int, i728 int, i729 int, i730 int, i731 int, i732 int, i733 int, i734
-int, i735 int, i736 int, i737 int, i738 int, i739 int, i740 int, i741 int, i742
-int, i743 int, i744 int, i745 int, i746 int, i747 int, i748 int, i749 int, i750
-int, i751 int, i752 int, i753 int, i754 int, i755 int, i756 int, i757 int, i758
-int, i759 int, i760 int, i761 int, i762 int, i763 int, i764 int, i765 int, i766
-int, i767 int, i768 int, i769 int, i770 int, i771 int, i772 int, i773 int, i774
-int, i775 int, i776 int, i777 int, i778 int, i779 int, i780 int, i781 int, i782
-int, i783 int, i784 int, i785 int, i786 int, i787 int, i788 int, i789 int, i790
-int, i791 int, i792 int, i793 int, i794 int, i795 int, i796 int, i797 int, i798
-int, i799 int, i800 int, i801 int, i802 int, i803 int, i804 int, i805 int, i806
-int, i807 int, i808 int, i809 int, i810 int, i811 int, i812 int, i813 int, i814
-int, i815 int, i816 int, i817 int, i818 int, i819 int, i820 int, i821 int, i822
-int, i823 int, i824 int, i825 int, i826 int, i827 int, i828 int, i829 int, i830
-int, i831 int, i832 int, i833 int, i834 int, i835 int, i836 int, i837 int, i838
-int, i839 int, i840 int, i841 int, i842 int, i843 int, i844 int, i845 int, i846
-int, i847 int, i848 int, i849 int, i850 int, i851 int, i852 int, i853 int, i854
-int, i855 int, i856 int, i857 int, i858 int, i859 int, i860 int, i861 int, i862
-int, i863 int, i864 int, i865 int, i866 int, i867 int, i868 int, i869 int, i870
-int, i871 int, i872 int, i873 int, i874 int, i875 int, i876 int, i877 int, i878
-int, i879 int, i880 int, i881 int, i882 int, i883 int, i884 int, i885 int, i886
-int, i887 int, i888 int, i889 int, i890 int, i891 int, i892 int, i893 int, i894
-int, i895 int, i896 int, i897 int, i898 int, i899 int, i900 int, i901 int, i902
-int, i903 int, i904 int, i905 int, i906 int, i907 int, i908 int, i909 int, i910
-int, i911 int, i912 int, i913 int, i914 int, i915 int, i916 int, i917 int, i918
-int, i919 int, i920 int, i921 int, i922 int, i923 int, i924 int, i925 int, i926
-int, i927 int, i928 int, i929 int, i930 int, i931 int, i932 int, i933 int, i934
-int, i935 int, i936 int, i937 int, i938 int, i939 int, i940 int, i941 int, i942
-int, i943 int, i944 int, i945 int, i946 int, i947 int, i948 int, i949 int, i950
-int, i951 int, i952 int, i953 int, i954 int, i955 int, i956 int, i957 int, i958
-int, i959 int, i960 int, i961 int, i962 int, i963 int, i964 int, i965 int, i966
-int, i967 int, i968 int, i969 int, i970 int, i971 int, i972 int, i973 int, i974
-int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982
-int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990
-int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998
-int, i999 int, i1000 int, b blob) row_format=dynamic;
-insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, "Sergei");
-update t1 set b=repeat('a',256);
-update t1 set i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0;
-check table t1;
-delete from t1 where i8=1;
-select i1,i2 from t1;
-check table t1;
-drop table t1;
-
-#
-# Test of REPAIR that once failed
-#
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-CREATE TABLE `t1` (
- `post_id` mediumint(8) unsigned NOT NULL auto_increment,
- `topic_id` mediumint(8) unsigned NOT NULL default '0',
- `post_time` datetime NOT NULL default '0000-00-00 00:00:00',
- `post_text` text NOT NULL,
- `icon_url` varchar(10) NOT NULL default '',
- `sign` tinyint(1) unsigned NOT NULL default '0',
- `post_edit` varchar(150) NOT NULL default '',
- `poster_login` varchar(35) NOT NULL default '',
- `ip` varchar(15) NOT NULL default '',
- PRIMARY KEY (`post_id`),
- KEY `post_time` (`post_time`),
- KEY `ip` (`ip`),
- KEY `poster_login` (`poster_login`),
- KEY `topic_id` (`topic_id`),
- FULLTEXT KEY `post_text` (`post_text`)
-) ENGINE=MyISAM;
-
-INSERT IGNORE INTO t1 (post_text) VALUES ('ceci est un test'),('ceci est un test'),('ceci est un test'),('ceci est un test'),('ceci est un test');
-
-REPAIR TABLE t1;
-CHECK TABLE t1;
-drop table t1;
-
-#
-# Test of creating table with too long key
-#
-
---error 1071
-CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255), d varchar(255), e varchar(255), KEY t1 (a, b, c, d, e));
-CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255), d varchar(255), e varchar(255));
---error 1071
-ALTER TABLE t1 ADD INDEX t1 (a, b, c, d, e);
-DROP TABLE t1;
-
-#
-# Test of cardinality of keys with NULL
-#
-
-CREATE TABLE t1 (a int not null, b int, c int, key(b), key(c), key(a,b), key(c,a));
-INSERT into t1 values (0,null,0), (0,null,1), (0,null,2), (0,null,3), (1,1,4);
-create table t2 (a int not null, b int, c int, key(b), key(c), key(a));
-INSERT into t2 values (1,1,1), (2,2,2);
-optimize table t1;
-show index from t1;
-explain select * from t1,t2 where t1.a=t2.a;
-explain select * from t1,t2 force index(a) where t1.a=t2.a;
-explain select * from t1 force index(a),t2 force index(a) where t1.a=t2.a;
-INSERT into t1 values (2,4,5), (7,8,4), (8,3,1), (9,7,2), (5,5,9);
-optimize table t1;
-show index from t1;
-explain select * from t1,t2 where t1.b=t2.b;
-delete from t1 where t1.a>1;
-optimize table t1;
-show index from t1;
-explain select * from t1,t2 force index(c) where t1.a=t2.a;
-explain select * from t1 where a=0 or a=2;
-explain select * from t1 force index (a) where a=0 or a=2;
-explain select * from t1 where c=1;
-explain select * from t1 use index() where c=1;
-drop table t1,t2;
-
-#
-# Test bug when updating a split dynamic row where keys are not changed
-#
-
-create table t1 (a int not null auto_increment primary key, b varchar(255));
-insert into t1 (b) values (repeat('a',100)),(repeat('b',100)),(repeat('c',100));
-update t1 set b=repeat(left(b,1),200) where a=1;
-delete from t1 where (a & 1)= 0;
-update t1 set b=repeat('e',200) where a=1;
-flush tables;
-check table t1;
-
-#
-# check updating with keys
-#
-
---disable_query_log
-begin;
-let $1 = 100;
-while ($1)
-{
- eval insert into t1 (b) values (repeat(char(($1 & 32)+65), $1));
- dec $1;
-}
-commit;
---enable_query_log
-update t1 set b=repeat(left(b,1),255) where a between 1 and 5;
-update t1 set b=repeat(left(b,1),10) where a between 32 and 43;
-update t1 set b=repeat(left(b,1),2) where a between 64 and 66;
-update t1 set b=repeat(left(b,1),65) where a between 67 and 70;
-check table t1;
-insert into t1 (b) values (repeat('z',100));
-update t1 set b="test" where left(b,1) > 'n';
-check table t1;
-drop table t1;
-
-#
-# two bugs in myisam-space-stripping feature
-#
-create table t1 ( a text not null, key a (a(20)));
-insert into t1 values ('aaa '),('aaa'),('aa');
-check table t1;
-repair table t1;
-select concat(a,'.') from t1 where a='aaa';
-select concat(a,'.') from t1 where binary a='aaa';
-update t1 set a='bbb' where a='aaa';
-select concat(a,'.') from t1;
-drop table t1;
-
-#
-# Third bug in the same code (BUG#2295)
-#
-
-create table t1(a text not null, b text not null, c text not null, index (a(10),b(10),c(10)));
-insert into t1 values('807780', '477', '165');
-insert into t1 values('807780', '477', '162');
-insert into t1 values('807780', '472', '162');
-select * from t1 where a='807780' and b='477' and c='165';
-drop table t1;
-
-#
-# space-stripping in _mi_prefix_search: BUG#5284
-#
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (a varchar(150) NOT NULL, KEY (a));
-INSERT t1 VALUES ("can \tcan");
-INSERT t1 VALUES ("can can");
-INSERT t1 VALUES ("can");
-SELECT * FROM t1;
-CHECK TABLE t1;
-DROP TABLE t1;
-
-#
-# Verify blob handling
-#
-create table t1 (a blob);
-insert into t1 values('a '),('a');
-select concat(a,'.') from t1 where a='a';
-select concat(a,'.') from t1 where a='a ';
-alter table t1 add key(a(2));
-select concat(a,'.') from t1 where a='a';
-select concat(a,'.') from t1 where a='a ';
-drop table t1;
-
-#
-# Test text and unique
-#
-create table t1 (a int not null auto_increment primary key, b text not null, unique b (b(20)));
-insert into t1 (b) values ('a'),('b'),('c');
-select concat(b,'.') from t1;
-update t1 set b='b ' where a=2;
---error ER_DUP_ENTRY
-update t1 set b='b ' where a > 1;
---error ER_DUP_ENTRY
-insert into t1 (b) values ('b');
-select * from t1;
-delete from t1 where b='b';
-select a,concat(b,'.') from t1;
-drop table t1;
-
-#
-# Test keys with 0 segments. (Bug #3203)
-#
-create table t1 (a int not null);
-create table t2 (a int not null, primary key (a));
-insert into t1 values (1);
-insert into t2 values (1),(2);
-select sql_big_result distinct t1.a from t1,t2 order by t2.a;
-select distinct t1.a from t1,t2 order by t2.a;
-select sql_big_result distinct t1.a from t1,t2;
-explain select sql_big_result distinct t1.a from t1,t2 order by t2.a;
-explain select distinct t1.a from t1,t2 order by t2.a;
-drop table t1,t2;
-
-#
-# Bug#14616 - Freshly imported table returns error 124 when using LIMIT
-#
-create table t1 (
- c1 varchar(32),
- key (c1)
-) engine=myisam;
-alter table t1 disable keys;
-insert into t1 values ('a'), ('b');
-select c1 from t1 order by c1 limit 1;
-drop table t1;
-
-#
-# Bug #14400 Join could miss concurrently inserted row
-#
-# Partial key.
-create table t1 (a int not null, primary key(a));
-create table t2 (a int not null, b int not null, primary key(a,b));
-insert into t1 values (1),(2),(3),(4),(5),(6);
-insert into t2 values (1,1),(2,1);
-lock tables t1 read local, t2 read local;
-select straight_join * from t1,t2 force index (primary) where t1.a=t2.a;
-connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
-insert into t2 values(2,0);
-disconnect root;
-connection default;
-select straight_join * from t1,t2 force index (primary) where t1.a=t2.a;
-unlock tables;
-drop table t1,t2;
-#
-# Full key.
-CREATE TABLE t1 (c1 varchar(250) NOT NULL);
-CREATE TABLE t2 (c1 varchar(250) NOT NULL, PRIMARY KEY (c1));
-INSERT INTO t1 VALUES ('test000001'), ('test000002'), ('test000003');
-INSERT INTO t2 VALUES ('test000002'), ('test000003'), ('test000004');
-LOCK TABLES t1 READ LOCAL, t2 READ LOCAL;
-SELECT t1.c1 AS t1c1, t2.c1 AS t2c1 FROM t1, t2
- WHERE t1.c1 = t2.c1 HAVING t1c1 != t2c1;
-connect (con1,localhost,root,,);
-connection con1;
-INSERT INTO t2 VALUES ('test000001'), ('test000005');
-disconnect con1;
-connection default;
-SELECT t1.c1 AS t1c1, t2.c1 AS t2c1 FROM t1, t2
- WHERE t1.c1 = t2.c1 HAVING t1c1 != t2c1;
-UNLOCK TABLES;
-DROP TABLE t1,t2;
-
-# End of 4.0 tests
-
-#
-# Test RTREE index
-#
---error 1235, 1289
-CREATE TABLE t1 (`a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', UNIQUE KEY `a` USING RTREE (`a`,`b`)) ENGINE=MyISAM;
-# INSERT INTO t1 VALUES (1,1),(1,1);
-# DELETE FROM rt WHERE a<1;
-# DROP TABLE IF EXISTS t1;
-
-create table t1 (a int, b varchar(200), c text not null) checksum=1;
-create table t2 (a int, b varchar(200), c text not null) checksum=0;
-insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
-insert t2 select * from t1;
-checksum table t1, t2, t3 quick;
-checksum table t1, t2, t3;
-checksum table t1, t2, t3 extended;
-alter table t1 add d int default 30, add e bigint default 300000, add f decimal(30) default 442;
-checksum table t1;
-#show table status;
-drop table t1,t2;
-
-create table t1 (a int, key (a));
-show keys from t1;
-alter table t1 disable keys;
-show keys from t1;
-create table t2 (a int);
-let $i=1000;
-set @@rand_seed1=31415926,@@rand_seed2=2718281828;
---disable_query_log
-begin;
-while ($i)
-{
- dec $i;
- insert t2 values (rand()*100000);
-}
-commit;
---enable_query_log
-insert t1 select * from t2;
-show keys from t1;
-alter table t1 enable keys;
-show keys from t1;
-alter table t1 engine=heap;
-alter table t1 disable keys;
-show keys from t1;
-drop table t1,t2;
-
-#
-# index search for NULL in blob. Bug #4816
-#
-create table t1 ( a tinytext, b char(1), index idx (a(1),b) );
-insert into t1 values (null,''), (null,'');
-explain select count(*) from t1 where a is null;
-select count(*) from t1 where a is null;
-drop table t1;
-
-#
-# bug9188 - Corruption Can't open file: 'table.MYI' (errno: 145)
-#
-create table t1 (c1 int, c2 varchar(4) not null default '',
- key(c2(3))) default charset=utf8;
-insert into t1 values (1,'A'), (2, 'B'), (3, 'A');
-update t1 set c2='A B' where c1=2;
-check table t1;
-drop table t1;
-
-
-#
-# Bug#12296 - CHECKSUM TABLE reports 0 for the table
-# This happened if the first record was marked as deleted.
-#
-create table t1 (c1 int);
-insert into t1 values (1),(2),(3),(4);
-checksum table t1;
-delete from t1 where c1 = 1;
-create table t2 as select * from t1;
-# The following returns 0 with the bug in place.
-checksum table t1;
-# The above should give the same number as the following.
-checksum table t2;
-drop table t1, t2;
-
-#
-# BUG#12232: New myisam_stats_method variable.
-#
-
-show variables like 'myisam_stats_method';
-
-create table t1 (a int, key(a));
-insert into t1 values (0),(1),(2),(3),(4);
-insert into t1 select NULL from t1;
-
-# default: NULLs considered inequal
-analyze table t1;
-show index from t1;
-insert into t1 values (11);
-delete from t1 where a=11;
-check table t1;
-show index from t1;
-
-# Set nulls to be equal:
-set myisam_stats_method=nulls_equal;
-show variables like 'myisam_stats_method';
-insert into t1 values (11);
-delete from t1 where a=11;
-
-analyze table t1;
-show index from t1;
-
-insert into t1 values (11);
-delete from t1 where a=11;
-
-check table t1;
-show index from t1;
-
-# Set nulls back to be equal
-set myisam_stats_method=DEFAULT;
-show variables like 'myisam_stats_method';
-insert into t1 values (11);
-delete from t1 where a=11;
-
-analyze table t1;
-show index from t1;
-
-insert into t1 values (11);
-delete from t1 where a=11;
-
-check table t1;
-show index from t1;
-
-drop table t1;
-
-# WL#2609, CSC#XXXX: MyISAM
-set myisam_stats_method=nulls_ignored;
-show variables like 'myisam_stats_method';
-
-create table t1 (
- a char(3), b char(4), c char(5), d char(6),
- key(a,b,c,d)
-);
-insert into t1 values ('bcd','def1', NULL, 'zz');
-insert into t1 values ('bcd','def2', NULL, 'zz');
-insert into t1 values ('bce','def1', 'yuu', NULL);
-insert into t1 values ('bce','def2', NULL, 'quux');
-analyze table t1;
-show index from t1;
-delete from t1;
-analyze table t1;
-show index from t1;
-
-set myisam_stats_method=DEFAULT;
-drop table t1;
-
-# BUG#13814 - key value packed incorrectly for TINYBLOBs
-
-create table t1(
- cip INT NOT NULL,
- time TIME NOT NULL,
- score INT NOT NULL DEFAULT 0,
- bob TINYBLOB
-);
-
-insert into t1 (cip, time) VALUES (1, '00:01'), (2, '00:02'), (3,'00:03');
-insert into t1 (cip, bob, time) VALUES (4, 'a', '00:04'), (5, 'b', '00:05'),
- (6, 'c', '00:06');
-select * from t1 where bob is null and cip=1;
-create index bug on t1 (bob(22), cip, time);
-select * from t1 where bob is null and cip=1;
-drop table t1;
-
-#
-# Bug#14980 - COUNT(*) incorrect on MyISAM table with certain INDEX
-#
-create table t1 (
- id1 int not null auto_increment,
- id2 int not null default '0',
- t text not null,
- primary key (id1),
- key x (id2, t(32))
-) engine=myisam;
-insert into t1 (id2, t) values
-(10, 'abc'), (10, 'abc'), (10, 'abc'),
-(20, 'abc'), (20, 'abc'), (20, 'def'),
-(10, 'abc'), (10, 'abc');
-select count(*) from t1 where id2 = 10;
-select count(id1) from t1 where id2 = 10;
-drop table t1;
-
-#
-# BUG##20357 - Got error 124 from storage engine using MIN and MAX functions
-# in queries
-#
-CREATE TABLE t1(a TINYINT, KEY(a)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES(1);
-SELECT MAX(a) FROM t1 IGNORE INDEX(a);
-ALTER TABLE t1 DISABLE KEYS;
-SELECT MAX(a) FROM t1;
-SELECT MAX(a) FROM t1 IGNORE INDEX(a);
-DROP TABLE t1;
-
-#
-# BUG#18036 - update of table joined to self reports table as crashed
-#
-CREATE TABLE t1(a CHAR(9), b VARCHAR(7)) ENGINE=MyISAM;
-INSERT INTO t1(a) VALUES('xxxxxxxxx'),('xxxxxxxxx');
-UPDATE t1 AS ta1,t1 AS ta2 SET ta1.b='aaaaaa',ta2.b='bbbbbb';
-SELECT * FROM t1;
-DROP TABLE t1;
-
-#
-# Bug#8283 - OPTIMIZE TABLE causes data loss
-#
-SET @@myisam_repair_threads=2;
-SHOW VARIABLES LIKE 'myisam_repair%';
-#
-# Test OPTIMIZE. This creates a new data file.
-CREATE TABLE t1 (
- `_id` int(11) NOT NULL default '0',
- `url` text,
- `email` text,
- `description` text,
- `loverlap` int(11) default NULL,
- `roverlap` int(11) default NULL,
- `lneighbor_id` int(11) default NULL,
- `rneighbor_id` int(11) default NULL,
- `length_` int(11) default NULL,
- `sequence` mediumtext,
- `name` text,
- `_obj_class` text NOT NULL,
- PRIMARY KEY (`_id`),
- UNIQUE KEY `sequence_name_index` (`name`(50)),
- KEY (`length_`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-#
-INSERT INTO t1 VALUES
- (1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample1',''),
- (2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample2',''),
- (3,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample3',''),
- (4,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample4',''),
- (5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample5',''),
- (6,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample6',''),
- (7,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample7',''),
- (8,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample8',''),
- (9,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample9','');
-#
-SELECT _id FROM t1;
-DELETE FROM t1 WHERE _id < 8;
-SELECT table_name, engine, version, row_format, Table_rows, Data_free, create_options, table_comment FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' and TABLE_NAME='t1';
-CHECK TABLE t1 EXTENDED;
-OPTIMIZE TABLE t1;
-CHECK TABLE t1 EXTENDED;
-SELECT table_name, engine, version, row_format, Table_rows, Data_free, create_options, table_comment FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' and TABLE_NAME='t1';
-SELECT _id FROM t1;
-DROP TABLE t1;
-#
-# Test REPAIR QUICK. This retains the old data file.
-CREATE TABLE t1 (
- `_id` int(11) NOT NULL default '0',
- `url` text,
- `email` text,
- `description` text,
- `loverlap` int(11) default NULL,
- `roverlap` int(11) default NULL,
- `lneighbor_id` int(11) default NULL,
- `rneighbor_id` int(11) default NULL,
- `length_` int(11) default NULL,
- `sequence` mediumtext,
- `name` text,
- `_obj_class` text NOT NULL,
- PRIMARY KEY (`_id`),
- UNIQUE KEY `sequence_name_index` (`name`(50)),
- KEY (`length_`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-#
-INSERT INTO t1 VALUES
- (1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample1',''),
- (2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample2',''),
- (3,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample3',''),
- (4,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample4',''),
- (5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample5',''),
- (6,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample6',''),
- (7,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample7',''),
- (8,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample8',''),
- (9,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'sample9','');
-#
-SELECT _id FROM t1;
-DELETE FROM t1 WHERE _id < 8;
-SELECT table_name, engine, version, row_format, Table_rows, Data_free, create_options, table_comment FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' and TABLE_NAME='t1';
-CHECK TABLE t1 EXTENDED;
-REPAIR TABLE t1 QUICK;
-CHECK TABLE t1 EXTENDED;
-SELECT table_name, engine, version, row_format, Table_rows, Data_free, create_options, table_comment FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' and TABLE_NAME='t1';
-SELECT _id FROM t1;
-DROP TABLE t1;
-#
-SET @@myisam_repair_threads=1;
-SHOW VARIABLES LIKE 'myisam_repair%';
-
-#
-# BUG#21310 - Trees in SQL causing a "crashed" table with MyISAM storage
-# engine
-#
-
-# A simplified test case that reflect crashed table issue.
-CREATE TABLE t1(a VARCHAR(16));
-INSERT INTO t1 VALUES('aaaaaaaa'),(NULL);
-UPDATE t1 AS ta1, t1 AS ta2 SET ta1.a='aaaaaaaaaaaaaaaa';
-SELECT * FROM t1;
-DROP TABLE t1;
-
-# A test case that reflect wrong result set.
-CREATE TABLE t1(a INT);
-INSERT INTO t1 VALUES(1),(2);
-UPDATE t1,t1 AS t2 SET t1.a=t1.a+2 WHERE t1.a=t2.a-1;
-SELECT * FROM t1 ORDER BY a;
-DROP TABLE t1;
-
-#
-# Bug#24607 - MyISAM pointer size determined incorrectly
-#
-CREATE TABLE t1 (c1 TEXT) AVG_ROW_LENGTH=70100 MAX_ROWS=4100100100;
-SELECT table_name, engine, version, row_format, max_data_length, max_index_length, create_options, table_comment FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' and TABLE_NAME='t1';
-DROP TABLE t1;
-
-#
-# Bug#26231 - select count(*) on myisam table returns wrong value
-# when index is used
-#
-CREATE TABLE t1 (c1 TEXT NOT NULL, KEY c1 (c1(10))) ENGINE=MyISAM;
-# Fill at least two key blocks. "Tab, A" must be in both blocks.
-INSERT INTO t1 VALUES
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)), (CHAR(9,65)),
- (''), (''), (''), (''),
- (' B'), (' B'), (' B'), (' B');
-SELECT DISTINCT COUNT(*) FROM t1 WHERE c1 = '';
-SELECT DISTINCT length(c1), c1 FROM t1 WHERE c1 = '';
-SELECT DISTINCT COUNT(*) FROM t1 IGNORE INDEX (c1) WHERE c1 = '';
-SELECT DISTINCT length(c1), c1 FROM t1 IGNORE INDEX (c1) WHERE c1 = '';
-SELECT DISTINCT length(c1), c1 FROM t1 ORDER BY c1;
-DROP TABLE t1;
-
---echo End of 4.1 tests
-
-
-# Test varchar
-#
-
-let $default=`select @@storage_engine`;
-set storage_engine=MyISAM;
-source include/varchar.inc;
-
-#
-# Some errors/warnings on create
-#
-
-create table t1 (v varchar(65530), key(v));
-drop table if exists t1;
-set statement sql_mode = 'NO_ENGINE_SUBSTITUTION' for
-create table t1 (v varchar(65536));
-show create table t1;
-drop table t1;
-set statement sql_mode = 'NO_ENGINE_SUBSTITUTION' for
-create table t1 (v varchar(65530) character set utf8);
-show create table t1;
-drop table t1;
-
-# MyISAM specific varchar tests
-set statement sql_mode='' for
-create table t1 (v varchar(65535));
-show create table t1;
-drop table t1;
-
-eval set storage_engine=$default;
-
-#
-# Test concurrent insert
-# First with static record length
-#
-set @save_concurrent_insert=@@concurrent_insert;
-set global concurrent_insert=1;
-create table t1 (a int);
-insert into t1 values (1),(2),(3),(4),(5);
-lock table t1 read local;
-connect (con1,localhost,root,,);
-connection con1;
-# Insert in table without hole
-insert into t1 values(6),(7);
-connection default;
-unlock tables;
-delete from t1 where a>=3 and a<=4;
-lock table t1 read local;
-connection con1;
-set global concurrent_insert=2;
-# Insert in table with hole -> Should insert at end
-insert into t1 values (8),(9);
-connection default;
-unlock tables;
-# Insert into hole
-insert into t1 values (10),(11),(12);
-select * from t1;
-check table t1;
-drop table t1;
-disconnect con1;
-
-# Same test with dynamic record length
-create table t1 (a int, b varchar(30) default "hello");
-insert into t1 (a) values (1),(2),(3),(4),(5);
-lock table t1 read local;
-connect (con1,localhost,root,,);
-connection con1;
-# Insert in table without hole
-insert into t1 (a) values(6),(7);
-connection default;
-unlock tables;
-delete from t1 where a>=3 and a<=4;
-lock table t1 read local;
-connection con1;
-set global concurrent_insert=2;
-# Insert in table with hole -> Should insert at end
-insert into t1 (a) values (8),(9);
-connection default;
-unlock tables;
-# Insert into hole
-insert into t1 (a) values (10),(11),(12);
-select a from t1;
-check table t1;
-drop table t1;
-disconnect con1;
-set global concurrent_insert=@save_concurrent_insert;
-
-
-# BUG#9622 - ANALYZE TABLE and ALTER TABLE .. ENABLE INDEX produce
-# different statistics on the same table with NULL values.
-create table t1 (a int, key(a));
-
-insert into t1 values (1),(2),(3),(4),(NULL),(NULL),(NULL),(NULL);
-analyze table t1;
-show keys from t1;
-
-alter table t1 disable keys;
-alter table t1 enable keys;
-show keys from t1;
-
-drop table t1;
-
-
-#
-# Bug#10056 - PACK_KEYS option take values greater than 1 while creating table
-#
-create table t1 (c1 int) engine=myisam pack_keys=0;
-create table t2 (c1 int) engine=myisam pack_keys=1;
-create table t3 (c1 int) engine=myisam pack_keys=default;
---error 1064
-create table t4 (c1 int) engine=myisam pack_keys=2;
-drop table t1, t2, t3;
-
-
-#
-# Bug#28476: force index on a disabled myisam index gives error 124
-#
-CREATE TABLE t1(a INT, b INT, KEY inx (a), UNIQUE KEY uinx (b)) ENGINE=MyISAM;
-INSERT INTO t1(a,b) VALUES (1,1),(2,2),(3,3),(4,4),(5,5);
-SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1;
-ALTER TABLE t1 DISABLE KEYS;
-SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1;
-SELECT a FROM t1 USE INDEX (inx) WHERE a=1;
-SELECT b FROM t1 FORCE INDEX (uinx) WHERE b=1;
-SELECT b FROM t1 USE INDEX (uinx) WHERE b=1;
-SELECT a FROM t1 FORCE INDEX (inx,uinx) WHERE a=1;
-ALTER TABLE t1 ENABLE KEYS;
-SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1;
-DROP TABLE t1;
-
-#
-# Bug#4692 - DISABLE/ENABLE KEYS waste a space
-#
-CREATE TABLE t1 (c1 INT, c2 INT, UNIQUE INDEX (c1), INDEX (c2)) ENGINE=MYISAM;
---replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 # 19 #
-SHOW TABLE STATUS LIKE 't1';
-INSERT INTO t1 VALUES (1,1);
---replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 # 19 #
-SHOW TABLE STATUS LIKE 't1';
-ALTER TABLE t1 DISABLE KEYS;
---replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 # 19 #
-SHOW TABLE STATUS LIKE 't1';
-ALTER TABLE t1 ENABLE KEYS;
---replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 # 19 #
-SHOW TABLE STATUS LIKE 't1';
-ALTER TABLE t1 DISABLE KEYS;
---replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 # 19 #
-SHOW TABLE STATUS LIKE 't1';
-ALTER TABLE t1 ENABLE KEYS;
---replace_column 6 # 7 # 8 # 10 # 11 # 12 # 13 # 14 # 15 # 16 # 19 #
-SHOW TABLE STATUS LIKE 't1';
-#--exec ls -log var/master-data/test/t1.MYI
-#--exec myisamchk -dvv var/master-data/test/t1.MYI
-#--exec myisamchk -iev var/master-data/test/t1.MYI
---echo # Enable keys with parallel repair
-SET @@myisam_repair_threads=2;
-ALTER TABLE t1 DISABLE KEYS;
-ALTER TABLE t1 ENABLE KEYS;
-SET @@myisam_repair_threads=1;
-CHECK TABLE t1 EXTENDED;
-DROP TABLE t1;
-
-#
-# Bug#28837: MyISAM storage engine error (134) doing delete with self-join
-#
-
-CREATE TABLE t1 (id int NOT NULL, ref int NOT NULL, INDEX (id)) ENGINE=MyISAM;
-CREATE TABLE t2 LIKE t1;
-
-INSERT INTO t2 (id, ref) VALUES (1,3), (2,1), (3,2), (4,5), (4,4);
-INSERT INTO t1 SELECT * FROM t2;
-
-SELECT * FROM t1 AS a INNER JOIN t1 AS b USING (id) WHERE a.ref < b.ref;
-SELECT * FROM t1;
-DELETE FROM a USING t1 AS a INNER JOIN t1 AS b USING (id) WHERE a.ref < b.ref;
-SELECT * FROM t1;
-
-DROP TABLE t1, t2;
-
-
-#
-# Bug#37310: 'on update CURRENT_TIMESTAMP' option crashes the table
-#
-CREATE TABLE t1 (a INT) ENGINE=MyISAM CHECKSUM=1 ROW_FORMAT=DYNAMIC;
-INSERT INTO t1 VALUES (0);
-UPDATE t1 SET a=1;
-SELECT a FROM t1;
-CHECK TABLE t1;
-INSERT INTO t1 VALUES (0), (5), (4), (2);
-UPDATE t1 SET a=2;
-SELECT a FROM t1;
-CHECK TABLE t1;
-DROP TABLE t1;
-
-
---echo #
---echo # Bug #49465: valgrind warnings and incorrect live checksum...
---echo #
-CREATE TABLE t1(
-a VARCHAR(1), b VARCHAR(1), c VARCHAR(1),
-f VARCHAR(1), g VARCHAR(1), h VARCHAR(1),
-i VARCHAR(1), j VARCHAR(1), k VARCHAR(1)) CHECKSUM=1;
-INSERT INTO t1 VALUES('', '', '', '', '', '', '', '', '');
-CHECKSUM TABLE t1 QUICK;
-CHECKSUM TABLE t1 EXTENDED;
-DROP TABLE t1;
-
-
---echo #
---echo # BUG#48438 - crash with error in unioned query against merge table and view...
---echo #
-SET GLOBAL table_open_cache=3;
-CREATE TABLE t1(a INT);
-SELECT 1 FROM t1 AS a1, t1 AS a2, t1 AS a3, t1 AS a4 FOR UPDATE;
-SELECT TABLE_ROWS, DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES
- WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
-DROP TABLE t1;
-SET GLOBAL table_open_cache=DEFAULT;
-
---echo End of 5.0 tests
-
-
-#
-# Test of key_block_size
-#
-
-create table t1 (a int not null, key `a` (a) key_block_size=1024);
-show create table t1;
-drop table t1;
-
-create table t1 (a int not null, key `a` (a) key_block_size=2048);
-show create table t1;
-drop table t1;
-
-create table t1 (a varchar(2048), key `a` (a));
-show create table t1;
-drop table t1;
-
-create table t1 (a varchar(2048), key `a` (a) key_block_size=1024);
-show create table t1;
-drop table t1;
-
-create table t1 (a int not null, b varchar(2048), key (a), key(b)) key_block_size=1024;
-show create table t1;
-alter table t1 key_block_size=2048;
-show create table t1;
-alter table t1 add c int, add key (c);
-show create table t1;
-alter table t1 key_block_size=0;
-alter table t1 add d int, add key (d);
-show create table t1;
-drop table t1;
-
-create table t1 (a int not null, b varchar(2048), key (a), key(b)) key_block_size=8192;
-show create table t1;
-drop table t1;
-
-create table t1 (a int not null, b varchar(512), key (a), key(b));
-show create table t1;
-alter table t1 key_block_size=2048;
-show create table t1;
-alter table t1 add c int, add key (c);
-show create table t1;
-alter table t1 key_block_size=4096;
-show create table t1;
-alter table t1 key_block_size=0;
-show create table t1;
-alter table t1 add d int, add key (d);
-show create table t1;
-alter table t1 key_block_size=8192;
-show create table t1;
-drop table t1;
-
-create table t1 (a int not null, b varchar(2048), key (a) key_block_size=1024, key(b)) key_block_size=8192;
-show create table t1;
-drop table t1;
-
-create table t1 (a int not null, b int, key (a) key_block_size=1024, key(b) key_block_size=8192) key_block_size=16384;
-show create table t1;
-drop table t1;
-
-# Test limits and errors of key_block_size
-
-create table t1 (a int not null, key `a` (a) key_block_size=512);
-show create table t1;
-drop table t1;
-
-create table t1 (a varchar(2048), key `a` (a) key_block_size=1000000000000000000);
-show create table t1;
-drop table t1;
-
-create table t1 (a int not null, key `a` (a) key_block_size=1025);
-show create table t1;
-drop table t1;
-
---error 1064
-create table t1 (a int not null, key key_block_size=1024 (a));
---error 1064
-create table t1 (a int not null, key `a` key_block_size=1024 (a));
-
-#
-# Bug#22119 - Changing MI_KEY_BLOCK_LENGTH makes a wrong myisamchk
-#
-CREATE TABLE t1 (
- c1 INT,
- c2 VARCHAR(300),
- KEY (c1) KEY_BLOCK_SIZE 1024,
- KEY (c2) KEY_BLOCK_SIZE 8192
- );
-INSERT INTO t1 VALUES (10, REPEAT('a', CEIL(RAND(10) * 300))),
- (11, REPEAT('b', CEIL(RAND() * 300))),
- (12, REPEAT('c', CEIL(RAND() * 300))),
- (13, REPEAT('d', CEIL(RAND() * 300))),
- (14, REPEAT('e', CEIL(RAND() * 300))),
- (15, REPEAT('f', CEIL(RAND() * 300))),
- (16, REPEAT('g', CEIL(RAND() * 300))),
- (17, REPEAT('h', CEIL(RAND() * 300))),
- (18, REPEAT('i', CEIL(RAND() * 300))),
- (19, REPEAT('j', CEIL(RAND() * 300))),
- (20, REPEAT('k', CEIL(RAND() * 300))),
- (21, REPEAT('l', CEIL(RAND() * 300))),
- (22, REPEAT('m', CEIL(RAND() * 300))),
- (23, REPEAT('n', CEIL(RAND() * 300))),
- (24, REPEAT('o', CEIL(RAND() * 300))),
- (25, REPEAT('p', CEIL(RAND() * 300))),
- (26, REPEAT('q', CEIL(RAND() * 300))),
- (27, REPEAT('r', CEIL(RAND() * 300))),
- (28, REPEAT('s', CEIL(RAND() * 300))),
- (29, REPEAT('t', CEIL(RAND() * 300))),
- (30, REPEAT('u', CEIL(RAND() * 300))),
- (31, REPEAT('v', CEIL(RAND() * 300))),
- (32, REPEAT('w', CEIL(RAND() * 300))),
- (33, REPEAT('x', CEIL(RAND() * 300))),
- (34, REPEAT('y', CEIL(RAND() * 300))),
- (35, REPEAT('z', CEIL(RAND() * 300)));
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO t1 SELECT * FROM t1;
-CHECK TABLE t1;
-REPAIR TABLE t1;
-DELETE FROM t1 WHERE c1 >= 10;
-CHECK TABLE t1;
-DROP TABLE t1;
-
-#
-# Bug#33222 - myisam-table drops rows when column is added
-# and a char-field > 128 exists
-#
-# Test #1 - CHECK TABLE sees wrong record, REPAR TABLE deletes it.
-# Using a CHAR column that can have > 127 characters.
-# Using a VARCHAR to create a table with dynamic row format.
-CREATE TABLE t1 (
- c1 CHAR(130),
- c2 VARCHAR(1)
-) ENGINE=MyISAM;
-INSERT INTO t1 VALUES(REPEAT("a",128), 'b');
-SELECT COUNT(*) FROM t1;
-CHECK TABLE t1;
-REPAIR TABLE t1;
-SELECT COUNT(*) FROM t1;
-CHECK TABLE t1;
-DROP TABLE t1;
-#
-# Test #2 - same as test #1, but using EXTENDED.
-# Using a CHAR column that can have > 127 characters.
-# Using a VARCHAR to create a table with dynamic row format.
-CREATE TABLE t1 (
- c1 CHAR(130),
- c2 VARCHAR(1)
-) ENGINE=MyISAM;
-INSERT INTO t1 VALUES(REPEAT("a",128), 'b');
-SELECT COUNT(*) FROM t1;
-CHECK TABLE t1 EXTENDED;
-REPAIR TABLE t1 EXTENDED;
-SELECT COUNT(*) FROM t1;
-CHECK TABLE t1 EXTENDED;
-DROP TABLE t1;
-#
-# Test #3 - same as test #1, but using OPTIMIZE TABLE.
-# Using a CHAR column that can have > 127 characters.
-# Using a VARCHAR to create a table with dynamic row format.
-CREATE TABLE t1 (
- c1 CHAR(130),
- c2 VARCHAR(1)
-) ENGINE=MyISAM;
-INSERT INTO t1 VALUES(REPEAT("a",128), 'b');
-# Insert more rows and delete one in the middle to force optimize.
-INSERT INTO t1 VALUES('b', 'b');
-INSERT INTO t1 VALUES('c', 'b');
-DELETE FROM t1 WHERE c1='b';
-SELECT COUNT(*) FROM t1;
-OPTIMIZE TABLE t1;
-SELECT COUNT(*) FROM t1;
-DROP TABLE t1;
-#
-# Test #4 - ALTER TABLE deletes rows.
-# Using a CHAR column that can have > 127 characters.
-# Using a VARCHAR to create a table with dynamic row format.
-# Using an index which can be disabled during bulk insert.
-CREATE TABLE t1 (
- c1 CHAR(130),
- c2 VARCHAR(1),
- KEY (c1)
-) ENGINE=MyISAM;
-#
-# Insert 100 rows. This turns bulk insert on during the copy phase of
-# ALTER TABLE. Bulk insert disables keys before the insert and re-enables
-# them by repair after the insert.
---disable_query_log
-let $count= 100;
---echo # Insert $count rows. Query log disabled.
-begin;
-while ($count)
-{
- INSERT INTO t1 VALUES ('a', 'b');
- dec $count;
-}
-commit;
---enable_query_log
-#
-# Change most of the rows into long character values with > 127 characters.
-UPDATE t1 SET c1=REPEAT("a",128) LIMIT 90;
-SELECT COUNT(*) FROM t1;
-ALTER TABLE t1 ENGINE=MyISAM;
-#
-# With bug present, this shows that all long rows are gone.
-SELECT COUNT(*) FROM t1;
-CHECK TABLE t1;
-CHECK TABLE t1 EXTENDED;
-DROP TABLE t1;
-#
-# Test #5 - same as test #1 but UTF-8.
-# Using a CHAR column that can have > 127 characters.
-# Using a VARCHAR to create a table with dynamic row format.
-CREATE TABLE t1 (
- c1 CHAR(50),
- c2 VARCHAR(1)
-) ENGINE=MyISAM DEFAULT CHARSET UTF8;
-# Using Tamil Letter A, Unicode U+0B85
-INSERT INTO t1 VALUES(REPEAT(_utf8 x'e0ae85',43), 'b');
-SELECT COUNT(*) FROM t1;
-CHECK TABLE t1;
-REPAIR TABLE t1;
-SELECT COUNT(*) FROM t1;
-CHECK TABLE t1;
-DROP TABLE t1;
-#
-# Test #6 - same as test #2, but UTF-8.
-# Using a CHAR column that can have > 127 characters.
-# Using a VARCHAR to create a table with dynamic row format.
-CREATE TABLE t1 (
- c1 CHAR(50),
- c2 VARCHAR(1)
-) ENGINE=MyISAM DEFAULT CHARSET UTF8;
-# Using Tamil Letter A, Unicode U+0B85
-INSERT INTO t1 VALUES(REPEAT(_utf8 x'e0ae85',43), 'b');
-SELECT COUNT(*) FROM t1;
-CHECK TABLE t1 EXTENDED;
-REPAIR TABLE t1 EXTENDED;
-SELECT COUNT(*) FROM t1;
-CHECK TABLE t1 EXTENDED;
-DROP TABLE t1;
-#
-# Test #7 - same as test #3, but UTF-8.
-# Using a CHAR column that can have > 127 characters.
-# Using a VARCHAR to create a table with dynamic row format.
-CREATE TABLE t1 (
- c1 CHAR(50),
- c2 VARCHAR(1)
-) ENGINE=MyISAM DEFAULT CHARSET UTF8;
-# Using Tamil Letter A, Unicode U+0B85
-INSERT INTO t1 VALUES(REPEAT(_utf8 x'e0ae85',43), 'b');
-# Insert more rows and delete one in the middle to force optimize.
-INSERT INTO t1 VALUES('b', 'b');
-INSERT INTO t1 VALUES('c', 'b');
-DELETE FROM t1 WHERE c1='b';
-SELECT COUNT(*) FROM t1;
-OPTIMIZE TABLE t1;
-SELECT COUNT(*) FROM t1;
-DROP TABLE t1;
-#
-# Test #8 - same as test #4, but UTF-8.
-# Using a CHAR column that can have > 42 UTF-8 characters.
-# Using a VARCHAR to create a table with dynamic row format.
-# Using an index which can be disabled during bulk insert.
-CREATE TABLE t1 (
- c1 CHAR(50),
- c2 VARCHAR(1),
- KEY (c1)
-) ENGINE=MyISAM DEFAULT CHARSET UTF8;
-#
-# Insert 100 rows. This turns bulk insert on during the copy phase of
-# ALTER TABLE. Bulk insert disables keys before the insert and re-enables
-# them by repair after the insert.
---disable_query_log
-let $count= 100;
---echo # Insert $count rows. Query log disabled.
-begin;
-while ($count)
-{
- INSERT INTO t1 VALUES ('a', 'b');
- dec $count;
-}
-commit;
---enable_query_log
-#
-# Change most of the rows into long character values with > 42 characters.
-# Using Tamil Letter A, Unicode U+0B85
-UPDATE t1 SET c1=REPEAT(_utf8 x'e0ae85',43) LIMIT 90;
-SELECT COUNT(*) FROM t1;
-ALTER TABLE t1 ENGINE=MyISAM;
-#
-# With bug present, this shows that all long rows are gone.
-SELECT COUNT(*) FROM t1;
-CHECK TABLE t1;
-CHECK TABLE t1 EXTENDED;
-DROP TABLE t1;
-
-#
-# Bug#29182 - MyISAMCHK reports wrong character set
-#
-CREATE TABLE t1 (
- c1 VARCHAR(10) NOT NULL,
- c2 CHAR(10) DEFAULT NULL,
- c3 VARCHAR(10) NOT NULL,
- KEY (c1),
- KEY (c2)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;
-let $MYSQLD_DATADIR= `select @@datadir`;
---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
---exec $MYISAMCHK -d $MYSQLD_DATADIR/test/t1
-DROP TABLE t1;
-
-#
-# Test warnings with transactional=1 with MyISAM
-# MariaDB: Note that the table will still have 'TRANSACTIONAL=1' attribute.
-# That's the intended behavior atm.
-#
-create table t1 (n int not null, c char(1)) transactional=1;
-show create table t1;
-drop table t1;
-
-#
-# Test of BUG#35570 CHECKSUM TABLE unreliable if LINESTRING field
-# (same content / differen checksum)
-#
-
-CREATE TABLE t1 (line LINESTRING NOT NULL) engine=myisam;
-INSERT INTO t1 VALUES (GeomFromText("LINESTRING(0 0)"));
-checksum table t1;
-CREATE TABLE t2 (line LINESTRING NOT NULL) engine=myisam;
-INSERT INTO t2 VALUES (GeomFromText("LINESTRING(0 0)"));
-checksum table t2;
-CREATE TABLE t3 select * from t1;
-checksum table t3;
-drop table t1,t2,t3;
-
-#
-# Test number of supported key parts (32 is max)
-#
-
-create table t1 (a1 int,a2 int,a3 int,a4 int,a5 int,a6 int,a7 int,a8 int,a9 int,a10 int,a11 int,a12 int,a13 int,a14 int,a15 int,a16 int,a17 int,a18 int,a19 int,a20 int,a21 int,a22 int,a23 int,a24 int,a25 int,a26 int,a27 int,a28 int,a29 int,a30 int,a31 int,a32 int,
-key(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32)) engine=myisam;
-drop table t1;
-
---error 1070
-create table t1 (a1 int,a2 int,a3 int,a4 int,a5 int,a6 int,a7 int,a8 int,a9 int,a10 int,a11 int,a12 int,a13 int,a14 int,a15 int,a16 int,a17 int,a18 int,a19 int,a20 int,a21 int,a22 int,a23 int,a24 int,a25 int,a26 int,a27 int,a28 int,a29 int,a30 int,a31 int,a32 int, a33 int,
-key(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33)) engine=myisam;
-
-#
-# Bug#43737: Select query return bad result
-#
-CREATE TABLE t1 (
- c INT,
- d bit(1),
- e INT,
- f VARCHAR(1),
- g BIT(1),
- h BIT(1),
- KEY (h, d, e, g)
-);
-INSERT INTO t1 VALUES
- ( 3, 1, 1, 'a', 0, 0 ),
- ( 3, 1, 5, 'a', 0, 0 ),
- ( 10, 1, 2, 'a', 0, 1 ),
- ( 10, 1, 3, 'a', 0, 1 ),
- ( 10, 1, 4, 'a', 0, 1 );
-
-SELECT f FROM t1 WHERE d = 1 AND e = 2 AND g = 0 AND h = 1;
-
-SELECT h+0, d + 0, e, g + 0 FROM t1;
-
-DROP TABLE t1;
-
-#
-# BUG#47073 - valgrind errs, corruption,failed repair of partition,
-# low myisam_sort_buffer_size
-#
-CREATE TABLE t1(a INT, b CHAR(10), KEY(a), KEY(b));
-INSERT INTO t1 VALUES(1,'0'),(2,'0'),(3,'0'),(4,'0'),(5,'0'),
- (6,'0'),(7,'0');
-INSERT INTO t1 SELECT a+10,b FROM t1;
-INSERT INTO t1 SELECT a+20,b FROM t1;
-INSERT INTO t1 SELECT a+40,b FROM t1;
-INSERT INTO t1 SELECT a+80,b FROM t1;
-INSERT INTO t1 SELECT a+160,b FROM t1;
-INSERT INTO t1 SELECT a+320,b FROM t1;
-INSERT INTO t1 SELECT a+640,b FROM t1;
-INSERT INTO t1 SELECT a+1280,b FROM t1;
-INSERT INTO t1 SELECT a+2560,b FROM t1;
-INSERT INTO t1 SELECT a+5120,b FROM t1;
-SET myisam_sort_buffer_size=4;
---replace_regex /Current myisam_sort_buffer_size.*/X/
-REPAIR TABLE t1;
-
-SET myisam_repair_threads=2;
-# May report different values depending on threads activity.
---disable_result_log
-REPAIR TABLE t1;
---enable_result_log
-SET myisam_repair_threads=@@global.myisam_repair_threads;
-SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
-CHECK TABLE t1;
-DROP TABLE t1;
-
-
---echo #
---echo # BUG#49628 - corrupt table after legal SQL, LONGTEXT column
---echo #
-CREATE TABLE t1(a INT, b LONGTEXT, UNIQUE(a));
-REPLACE INTO t1 VALUES
-(1, REPEAT('a', 129015)),(1, NULL),
-(2, NULL),(3, NULL),(4, NULL),(5, NULL),(6, NULL),(7, NULL),
-(1, REPEAT('b', 129016)),(1, NULL),
-(1, REPEAT('c', 129015)),(1, REPEAT('d', 129015));
-CHECK TABLE t1;
-DROP TABLE t1;
-
-
---echo #
---echo # Bug#51304: checksum table gives different results
---echo # for same data when using bit fields
---echo #
-CREATE TABLE t1(a INT, b BIT(1));
-INSERT INTO t1 VALUES(1, 0), (2, 1);
-CREATE TABLE t2 SELECT * FROM t1;
-FLUSH TABLES;
---copy_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_DATADIR/test/t3.frm
---copy_file $MYSQLD_DATADIR/test/t1.MYD $MYSQLD_DATADIR/test/t3.MYD
---copy_file $MYSQLD_DATADIR/test/t1.MYI $MYSQLD_DATADIR/test/t3.MYI
-CHECKSUM TABLE t1 EXTENDED;
-CHECKSUM TABLE t2 EXTENDED;
-CHECKSUM TABLE t3 EXTENDED;
-DROP TABLE t1, t2, t3;
-
---echo #
---echo # BUG#51307 - widespread corruption with partitions and insert...select
---echo #
-CREATE TABLE t1(a CHAR(255), KEY(a));
-SELECT * FROM t1, t1 AS a1;
-SET myisam_sort_buffer_size=4;
---replace_regex /Current myisam_sort_buffer_size.*/X/
-INSERT INTO t1 VALUES
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0');
-SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
-INSERT INTO t1 VALUES('1');
-SELECT * FROM t1, t1 AS a1 WHERE t1.a=1 AND a1.a=1;
-DROP TABLE t1;
-
---echo #
---echo # BUG#47444 - --myisam_repair_threads>1can result in all index
---echo # cardinalities=1
---echo #
-SET myisam_repair_threads=2;
-SET myisam_sort_buffer_size=4096;
-CREATE TABLE t1(a CHAR(255), KEY(a), KEY(a), KEY(a));
-INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(0),(1),(2),(3);
-REPAIR TABLE t1;
-SELECT CARDINALITY FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
-DROP TABLE t1;
-SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
-SET myisam_repair_threads=@@global.myisam_repair_threads;
-
---echo #
---echo # BUG#11757032 - 49030: OPTIMIZE TABLE BREAKS MYISAM TABLE WHEN
---echo # USING MYISAM_USE_MMAP ON WINDOWS
---echo #
-SET GLOBAL myisam_use_mmap=1;
-CREATE TABLE t1(a INT);
-INSERT INTO t1 VALUES(1),(2);
-DELETE FROM t1 WHERE a=1;
-FLUSH TABLE t1;
-LOCK TABLE t1 WRITE;
-OPTIMIZE TABLE t1;
-INSERT INTO t1 VALUES(3);
-UNLOCK TABLES;
-SELECT * FROM t1;
-CHECK TABLE t1;
-DROP TABLE t1;
-SET GLOBAL myisam_use_mmap=default;
-
---echo #
---echo # BUG 11756869 - 48848: MYISAMCHK DOING SORT RECOVER IN CERTAIN
---echo # CASES RESETS DATA POINTER TO SMAL
---echo #
-CREATE TABLE t1(a INT, KEY(a));
-ALTER TABLE t1 DISABLE KEYS;
-let $MYSQLD_DATADIR= `select @@datadir`;
-SET @before:= (SELECT MAX_DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test');
-FLUSH TABLES;
---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
---exec $MYISAMCHK -sn $MYSQLD_DATADIR/test/t1
-SET @after:= (SELECT MAX_DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test');
-SELECT @before=@after;
-DROP TABLE t1;
---echo End of 5.1 tests
-
---echo #
---echo # Bug#51327 MyISAM table is automatically repaired on ALTER
---echo # even if myisam-recover is OFF
---echo #
-
-call mtr.add_suppression("Got an error from thread_id=.*ha_myisam.cc:");
-call mtr.add_suppression("MySQL thread id .*, query id .* localhost.*root Checking table");
-call mtr.add_suppression(" '\..test.t1'");
-
-let $MYSQLD_DATADIR = `SELECT @@datadir`;
---echo # Test that we can exchange a crashed partition with a table
-SELECT @@global.myisam_recover_options;
-CREATE TABLE t1 (a INT, KEY (a)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1), (2);
-FLUSH TABLES;
-
---echo # replacing t.MYI with a corrupt + unclosed one created by doing:
---echo # 'create table t1 (a int key(a))' head -c1024 t1.MYI > corrupt_t1.MYI
---remove_file $MYSQLD_DATADIR/test/t1.MYI
---copy_file std_data/corrupt_t1.MYI $MYSQLD_DATADIR/test/t1.MYI
-
-CHECK TABLE t1;
---echo # Alter table should report error and not auto-repair the table.
-# Remove the path to t1 to prevent platform differences
---replace_regex /'[^']+'/'t1'/
---error 145
-ALTER TABLE t1 ENGINE = MyISAM;
-CHECK TABLE t1;
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-3870 - Valgrind warnings on OPTIMIZE MyISAM or Aria TABLE with
---echo # disabled keys
---echo #
-CREATE TABLE t1 (a INT, KEY(a)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (4),(3),(1),(0);
-ALTER TABLE t1 DISABLE KEYS;
-OPTIMIZE TABLE t1;
-DROP TABLE t1;
-
-#
-# Check FLUSH FOR EXPORT
-#
-
-CREATE TABLE t1(a INT, b CHAR(10), KEY(a), KEY(b)) engine=myisam;
-INSERT INTO t1 VALUES(1,'0'),(2,'0'),(3,'0'),(4,'0'),(5,'0'),
- (6,'0'),(7,'0');
-flush tables test.t1 for export;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-insert into t1 values (8,'0');
-unlock tables;
-drop table t1;
-
-#
-# Check some variables
-#
-show variables like 'myisam_block_size';
-select @@global.myisam_block_size;
diff --git a/mysql-test/t/myisam_crash_before_flush_keys-master.opt b/mysql-test/t/myisam_crash_before_flush_keys-master.opt
deleted file mode 100644
index 425fda95086..00000000000
--- a/mysql-test/t/myisam_crash_before_flush_keys-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---skip-stack-trace --skip-core-file
diff --git a/mysql-test/t/myisam_crash_before_flush_keys.test b/mysql-test/t/myisam_crash_before_flush_keys.test
deleted file mode 100644
index 8df81f73ec0..00000000000
--- a/mysql-test/t/myisam_crash_before_flush_keys.test
+++ /dev/null
@@ -1,47 +0,0 @@
---echo #
---echo # BUG#41330 - Myisam table open count set to zero before index blocks are written.
---echo #
---source include/not_embedded.inc
---echo # Don't test this under valgrind, memory leaks will occur
---source include/not_valgrind.inc
-
---echo # Binary must be compiled with debug for crash to occur
---source include/have_debug.inc
-
-call mtr.add_suppression("Got an error from thread_id=.*ha_myisam.cc:");
-call mtr.add_suppression("MySQL thread id .*, query id .* localhost.*root Checking table");
-flush tables;
-# Avoid CrashReporter popup on Mac
---source include/not_crashrep.inc
-
-let $MYSQLD_DATADIR= `select @@datadir`;
-SET GLOBAL delay_key_write=ALL;
-CREATE TABLE t1(a INT,
- b INT,
- PRIMARY KEY(a , b),
- KEY(b)) ENGINE=MyISAM DELAY_KEY_WRITE = 1;
-INSERT INTO t1 VALUES (1,2),(2,3),(3,4),(4,5),(5,6);
-
---echo # Setup the mysqld to crash at certain point
-SET SESSION debug_dbug="d,crash_before_flush_keys";
-
---echo # Write file to make mysql-test-run.pl expect crash
---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-
---echo # Run the crashing query
---error 2013
-FLUSH TABLE t1;
-
---echo # Write file to make mysql-test-run.pl start the server
---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-
---echo # Turn on reconnect
---enable_reconnect
-
---echo # Call script that will poll the server waiting for
---echo # it to be back online again
---source include/wait_until_connected_again.inc
-
-# Must report that the table wasn't closed properly
-CHECK TABLE t1;
-DROP TABLE t1;
diff --git a/mysql-test/t/myisam_debug.test b/mysql-test/t/myisam_debug.test
deleted file mode 100644
index 465ecd70895..00000000000
--- a/mysql-test/t/myisam_debug.test
+++ /dev/null
@@ -1,72 +0,0 @@
---source include/have_debug.inc
-
-# We disable this test in embedded mode because of BUG#43733
---source include/not_embedded.inc
-
---echo #
---echo # BUG#40827 - Killing insert-select to MyISAM can cause table corruption
---echo #
-
-CONNECT (insertConn, localhost, root,,);
-
-CREATE TABLE `t1` (
-`id` BIGINT(20) ,
-`id1` BIGINT(20) AUTO_INCREMENT,
- KEY(id1), KEY(id)
-) ENGINE=MyISAM;
-
-CREATE TABLE `t2` (
-`id` BIGINT(20) ,
-`id1` BIGINT(20) AUTO_INCREMENT,
- KEY (id1), KEY(id)
-) ENGINE=MyISAM;
-
-INSERT INTO t2 (id) VALUES (123);
-
-let $i = 10;
---disable_query_log
-begin;
-while ($i)
-{
- INSERT INTO t2 (id) SELECT id FROM t2;
- dec $i;
-}
-commit;
---enable_query_log
-
-CONNECTION insertConn;
-SET SESSION debug_dbug='+d,wait_in_enable_indexes';
---echo # Send insert data
-SEND INSERT INTO t1(id) SELECT id FROM t2;
-
-CONNECTION default;
---echo # Wait for insert data to reach the debug point
-
-let $wait_condition=
- SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE STATE = "wait_in_enable_indexes" AND
- INFO = "INSERT INTO t1(id) SELECT id FROM t2";
---source include/wait_condition.inc
-
-SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE STATE = 'wait_in_enable_indexes' AND
-INFO = "INSERT INTO t1(id) SELECT id FROM t2"
-INTO @thread_id;
-
-KILL QUERY @thread_id;
-CHECK TABLE t1;
-DROP TABLE t1,t2;
-DISCONNECT insertConn;
-
-#
-# MDEV-12761 Error return from external_lock make the server crash
-#
-call mtr.add_suppression("Index for table '.*test.t1\\.MYI' is corrupt; try to repair it");
-create table t1 (a int, index(a));
-lock tables t1 write;
-insert t1 values (1),(2),(1);
-set @old_dbug=@@debug_dbug;
-set debug_dbug='+d,mi_lock_database_failure';
-unlock tables;
-set debug_dbug=@old_dbug;
-drop table t1;
diff --git a/mysql-test/t/myisam_enable_keys-10506.test b/mysql-test/t/myisam_enable_keys-10506.test
deleted file mode 100644
index 33eb973c402..00000000000
--- a/mysql-test/t/myisam_enable_keys-10506.test
+++ /dev/null
@@ -1,120 +0,0 @@
-#
-# MDEV-10506 Protocol::end_statement(): Assertion `0' failed upon ALTER TABLE
-#
-
-call mtr.add_suppression("Can't find record in '.*'");
-
-CREATE TABLE t1 (
- pk INT AUTO_INCREMENT,
- i INT,
- d DATE,
- dt DATETIME,
- v VARCHAR(1),
- PRIMARY KEY (pk),
- KEY (dt)
-) ENGINE=MyISAM;
-INSERT INTO t1 (i, d, dt, v) VALUES
- (9, '2005-07-23', '2004-05-13 01:01:39', 't'),
- (2, '2009-11-01', '2003-12-24 07:39:29', 'h'),
- (6, NULL, '2008-07-03 05:32:22', 'l'),
- (6, '2007-07-16', '2008-08-28 18:46:11', 'j'),
- (5, NULL, '2001-07-12 21:27:00', 'h'),
- (3, '2007-07-22', '1900-01-01 00:00:00', 'p'),
- (2, '2000-11-21', '2007-05-25 11:58:54', 'g'),
- (6, '1900-01-01', '2009-06-03 17:11:10', 'i'),
- (2, '2008-02-10', '2001-06-15 16:20:07', 'p'),
- (3, '2009-06-04', '1900-01-01 00:00:00', 'h'),
- (9, '2007-04-25', '1900-01-01 00:00:00', 'e'),
- (9, '2006-03-02', '1900-01-01 00:00:00', 'e'),
- (1, '1900-01-01', '2002-11-08 09:33:27', 'u'),
- (7, '2008-07-13', '2007-08-07 17:35:52', 'j'),
- (0, '2004-11-12', '2006-05-01 00:00:00', 'e'),
- (0, '1900-01-01', '2003-05-01 00:00:00', 'z'),
- (1, '2009-09-02', '2007-02-12 09:30:49', 'w'),
- (0, '2004-11-06', '1900-01-01 00:00:00', 't'),
- (4, '2003-01-06', '2002-07-03 02:51:11', 'i'),
- (6, '2006-01-14', '2008-02-26 04:57:32', 'i'),
- (0, '2002-01-19', '2009-02-12 00:00:00', 'i'),
- (8, '2007-02-12', '1900-01-01 00:00:00', 'b'),
- (4, '1900-01-01', '2001-05-16 05:28:40', 'm'),
- (2, '2005-07-16', NULL, 'j'),
- (1, '2004-09-04', '2001-01-24 21:45:18', 'v'),
- (3, '2009-07-01', NULL, NULL),
- (2, '2009-07-21', '2002-07-24 00:00:00', 'h'),
- (4, NULL, '2001-11-03 12:22:30', 'q'),
- (1, '2002-06-22', '2008-06-17 03:17:59', 'f'),
- (7, '2005-06-23', '2005-12-24 00:00:00', 'p'),
- (6, '2001-05-20', '2008-10-23 00:00:00', NULL),
- (3, '2001-10-01', '2000-10-12 16:32:35', 'o'),
- (3, '2001-01-07', '2005-09-11 10:09:54', 'w'),
- (6, '2007-11-02', '2009-09-10 01:44:18', 'l'),
- (6, NULL, NULL, 'i'),
- (9, NULL, '2002-05-18 15:21:55', 'd'),
- (4, '2008-12-21', '2004-10-15 10:09:54', 'j'),
- (6, '2003-10-05', '2009-07-13 03:51:02', 'e'),
- (2, '2001-03-03', '1900-01-01 00:00:00', 'e'),
- (2, '2007-04-04', '2001-11-08 21:14:52', 'q'),
- (5, NULL, '2006-12-02 00:00:00', 'm'),
- (0, '2009-01-04', '1900-01-01 00:00:00', NULL),
- (8, '2008-04-03', '2005-01-01 11:55:18', 'q'),
- (8, NULL, '2005-02-28 03:44:02', 'w'),
- (0, '2003-08-22', NULL, 'c'),
- (9, '1900-01-01', NULL, 'y'),
- (NULL, NULL, '2006-08-25 16:28:09', 'g'),
- (5, '2004-07-04', '2002-08-11 00:00:00', 'z'),
- (1, '1900-01-01', '2007-07-22 21:19:18', 'm'),
- (2, '2007-02-04', '2006-02-10 18:41:38', 't'),
- (2, '1900-01-01', '2009-02-16 14:58:58', 'd'),
- (7, '2001-03-14', '2007-08-14 00:00:00', 'h'),
- (0, NULL, '1900-01-01 00:00:00', NULL),
- (1, '2008-10-05', NULL, 'f'),
- (6, '2001-11-25', '2008-12-03 06:59:23', 'l'),
- (NULL, '2003-01-27', '2008-10-04 00:00:00', 'g'),
- (8, '2008-08-08', '2009-07-07 07:00:21', 'v'),
- (8, '2006-07-03', '2001-04-15 00:00:00', NULL),
- (5, '2002-11-21', '2007-07-08 04:01:58', 'm'),
- (5, '2006-04-08', '2007-09-23 00:01:35', 'i'),
- (5, '2001-05-06', '2008-05-15 00:00:00', 'h'),
- (7, '1900-01-01', '1900-01-01 00:00:00', 'u'),
- (30, '2007-04-16', '2004-03-05 23:35:38', 'o'),
- (NULL, '1900-01-01', '2007-08-25 01:32:47', 'z'),
- (6, '2004-12-03', '1900-01-01 00:00:00', 'o'),
- (8, '2001-06-23', '1900-01-01 00:00:00', 'f'),
- (NULL, '2008-12-15', '2001-05-19 08:28:28', 'a'),
- (9, '2000-02-15', '2009-09-03 06:07:22', 'd'),
- (2, '2001-08-05', '2006-10-08 07:17:27', 'k'),
- (5, '2004-01-17', '2003-09-06 20:36:01', 'd'),
- (4, '2003-10-01', '2001-02-05 18:10:49', 'u'),
- (4, '2003-07-28', '2001-01-07 16:11:37', 'h'),
- (0, '1900-01-01', '2008-08-01 05:26:38', 'w'),
- (9, '1900-01-01', '2001-05-08 00:00:00', 't'),
- (1, '2000-04-17', '2008-07-10 21:26:28', 'i'),
- (8, '2002-01-05', '2006-08-06 20:56:35', 'k'),
- (9, '2001-04-10', '2003-02-17 00:00:00', 'z'),
- (0, '2009-12-04', NULL, 'h'),
- (7, NULL, '2004-10-27 00:29:57', 'h'),
- (2, '2006-03-07', '2008-03-04 06:14:13', 'b'),
- (0, '2001-10-15', '2001-03-17 00:00:00', 'm'),
- (5, '1900-01-01', '2009-02-21 11:35:50', 'i'),
- (4, NULL, '1900-01-01 00:00:00', 'w'),
- (5, '2009-04-05', '1900-01-01 00:00:00', 'm'),
- (6, '2001-03-19', '2001-04-12 00:00:00', 'q'),
- (NULL, '2009-12-08', '2001-12-04 20:21:01', 'k'),
- (2, '2005-02-09', '2001-05-27 08:41:01', 'l'),
- (9, '2004-05-25', '2004-09-18 00:00:00', 'c'),
- (3, '2005-01-17', '2002-09-12 11:18:48', 'd'),
- (0, '2003-08-28', '1900-01-01 00:00:00', 'k'),
- (6, '2006-10-11', '2003-10-28 03:31:02', 'a'),
- (5, '1900-01-01', '2001-08-22 10:20:09', 'p'),
- (8, '1900-01-01', '2008-04-24 00:00:00', 'o'),
- (4, '2005-08-18', '2006-11-10 10:08:49', 'e'),
- (NULL, '2007-03-12', '2007-10-16 00:00:00', 'n'),
- (1, '2000-11-18', '2009-05-27 12:25:07', 't'),
- (4, '2001-03-03', NULL, 'u'),
- (3, '2003-09-11', '2001-09-10 18:10:10', 'f'),
- (4, '2007-06-17', '1900-01-01 00:00:00', 't'),
- (NULL, '2008-09-11', '2004-06-07 23:17:09', 'k');
-ALTER TABLE t1 ADD UNIQUE KEY ind1 (pk, d, i, v);
---error ER_DUP_ENTRY
-ALTER TABLE t1 ADD UNIQUE KEY ind2 (d, v);
-DROP TABLE t1;
diff --git a/mysql-test/t/myisam_explain_non_select_all.test b/mysql-test/t/myisam_explain_non_select_all.test
deleted file mode 100644
index ccd4ebd6297..00000000000
--- a/mysql-test/t/myisam_explain_non_select_all.test
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# Run explain_non_select.inc on MyISAM with all of the so-called 6.0 features.
-#
-
-#--source include/have_semijoin.inc
-#--source include/have_materialization.inc
-#--source include/have_firstmatch.inc
-#--source include/have_loosescan.inc
-#--source include/have_index_condition_pushdown.inc
-#--source include/have_mrr.inc
-
-#set optimizer_switch='semijoin=on,materialization=on,firstmatch=on,loosescan=on,index_condition_pushdown=on,mrr=on,mrr_cost_based=off';
-
-set @save_storage_engine= @@session.default_storage_engine;
-set session default_storage_engine = MyISAM;
---let $json = 0
---let $validation = 0
---source include/explain_non_select.inc
-set default_storage_engine= @save_storage_engine;
-
-set optimizer_switch=default;
diff --git a/mysql-test/t/myisam_icp.test b/mysql-test/t/myisam_icp.test
deleted file mode 100644
index 508c282b1dc..00000000000
--- a/mysql-test/t/myisam_icp.test
+++ /dev/null
@@ -1,286 +0,0 @@
-#
-# ICP/MyISAM tests (Index Condition Pushdown)
-#
-
-set @myisam_icp_tmp=@@optimizer_switch;
-set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
-
---source include/icp_tests.inc
-
---disable_warnings
-drop table if exists t0, t1, t1i, t1m;
---enable_warnings
-
-#
-# BUG#711565 Index Condition Pushdown can make a thread hold MyISAM locks as well as be unKILLable for long time
-# This is not a ready mysqltest testcase but rather a set of queries that
-# allow to check the bug[fix] manually. Making this testcase automatic is
-# difficult because
-# - big tables are involved
-# - it's difficult to have automatic checks of whether the query could be
-# KILLed that would reliably work on fast/slow buildslaves, etc.
-
---disable_parsing
-
- create table t0 (a int);
- insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
- create table t1 (
- kp1 int, kp2 int,
- filler char(100),
- col int,
- key(kp1, kp2)
- );
-
- set myisam_sort_buffer_size=32*1000*1000;
- insert into t1
- select
- 1000 + A.a + 10*B.a + 100*C.a + 1000*D.a + 10000 * F.a,
- 1,
- 'filler-data filler-data filler-data filler-data filler-data',
- 1
- from
- t0 A, t0 B, t0 C, t0 D, t0 E, t0 F, t0 G
- ;
-
- insert into t1 values (990, 100, 'a record to test index_next checks',100);
-
- update t1 set kp2=10 where kp1 between 20000+100 and 28000;
-
- update t1 set kp1=20000 where kp1 between 20000 and 28000;
-
- insert into t1 values (20000, 100, 'last-20K-record',1);
-
- create table t1i like t1;
- alter table t1i engine=innodb;
- insert into t1i select * from t1;
-
- create table t1m like t1;
- alter table t1m engine=maria;
- insert into t1m select * from t1;
-
-#
-# XtraDB has one check for all kinds of ranges.
-#
- explain
- select * from t1i
- where
- kp1 < 8000 and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- kp2 +1 > 10;
-
-
-#
-# MyISAM, check range access + mi_rnext():
-# (will return HA_ERR_END_OF_FILE)
- explain
- select * from t1
- where
- kp1 < 10000 and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- kp2 +1 > 10;
-
-
-#
-# MyISAM, check range access + mi_rkey():
-# (will return HA_ERR_END_OF_FILE)
- explain
- select * from t1
- where
- kp1 >= 999 and kp1 < 10000 and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- kp2 +1 > 10;
-
-
-
-#
-# MyISAM, check mi_rnext_same:
-#
-
- explain
- select * from t1
- where
- kp1 = 20000 and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- kp2 +1 < 10;
-
-
-#
-# MyISAM, check mi_rprev:
-#
-
- explain
- select * from t1
- where
- kp1 = 20000 and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- kp2 +1 > 20
- order by kp1, kp2 desc;
-
-
-
-#
-# Maria, check range access + maria_rkey():
-#
- explain
- select * from t1m
- where
- kp1 >= 999 and kp1 < 10000 and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- kp2 +1 > 10;
-
-
-
-#
-# Maria, check range access + maria_rnext():
-#
- explain
- select * from t1m
- where
- kp1 < 10000 and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- kp2 +1 > 10;
-
-
-#
-# Maria, check maria_rnext_same:
-#
-
- explain
- select * from t1m
- where
- kp1 = 20000 and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- kp2 +1 > 100;
-
-#
-# Maria, check maria_rprev:
-#
-
- explain
- select * from t1m
- where
- kp1 = 20000 and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- concat(repeat('foo-bar-', 100000), kp2) like '%bar-1%' and
- kp2 +1 > 20
- order by kp1, kp2 desc;
-
-drop table t0, t1, t1i, t1m;
-
---enable_parsing
-
---echo #
---echo # BUG#826935 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed
---echo #
-CREATE TABLE t1 ( a int, b varchar(1024), c int, KEY (c), KEY (c,a)) ;
-INSERT INTO t1 VALUES
- (NULL,'x','-678428672'),
- (NULL,'ok',NULL),
- (796262400,'byluovkgwoukfxedyeffsedajyqkyhpaqqpozn', NULL),
- (7,'STQUF',146014208),
- (955711488,'WWVOR','-1515388928');
-SELECT b FROM t1 WHERE a != 1 AND c IS NULL ORDER BY 1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#870046: ICP for a GROUP BY query
---echo #
-
-CREATE TABLE t1 (a int, b varchar(1), c varchar(1), INDEX idx(b));
-INSERT INTO t1 VALUES (2,'x','x'), (5,'x','y');
-
-SET SESSION optimizer_switch='index_condition_pushdown=off';
-EXPLAIN
-SELECT a, MIN(c) FROM t1 WHERE b = 'x' AND c > 'x' GROUP BY a;
-SELECT a, MIN(c) FROM t1 WHERE b = 'x' AND c > 'x' GROUP BY a;
-SET SESSION optimizer_switch='index_condition_pushdown=on';
-EXPLAIN
-SELECT a, MIN(c) FROM t1 WHERE b = 'x' AND c > 'x' GROUP BY a;
-SELECT a, MIN(c) FROM t1 WHERE b = 'x' AND c > 'x' GROUP BY a;
-
-DROP TABLE t1;
-
---echo #
---echo # BUG#887026: Wrong result with ICP, outer join, subquery in maria-5.3-icp
---echo #
-
-CREATE TABLE t1 (c varchar(1));
-INSERT INTO t1 VALUES ('c'), ('c');
-
-CREATE TABLE t2 (c varchar(1), b int);
-INSERT INTO t2 VALUES ('d', NULL),('d', NULL);
-
-CREATE TABLE t3 (c varchar(1));
-INSERT INTO t3 VALUES ('c');
-INSERT INTO t3 VALUES ('c');
-
-CREATE TABLE t4 ( b int, c varchar(1), KEY (b));
-INSERT INTO t4 VALUES (7,'c');
-INSERT INTO t4 VALUES (7,'c');
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='outer_join_with_cache=off';
-
---echo # Must be t1,t2,t3,t4, with t4 having Full-scan-on-NULL but not Using index condition
-explain
-SELECT * FROM t1 LEFT JOIN t2 ON t1.c=t2.b
-WHERE
- t2.b NOT IN (SELECT t4.b FROM t3 STRAIGHT_JOIN t4 WHERE t4.b <= 2 AND t4.c = t3.c);
-
-SELECT * FROM t1 LEFT JOIN t2 ON t1.c=t2.b
-WHERE
- t2.b NOT IN (SELECT t4.b FROM t3 STRAIGHT_JOIN t4 WHERE t4.b <= 2 AND t4.c = t3.c);
-
-SET optimizer_switch=@save_optimizer_switch;
-
-DROP TABLE t1,t2,t3,t4;
-
---echo #
---echo # BUG#1000051: Query with simple join and ORDER BY takes thousands times longer when run with ICP
---echo #
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1 (a int, col int, filler char(100), key(a, col));
-insert into t1 select A.a + 10*B.a, 1234, 'filler' from t0 A, t0 B, t0 C;
-
-set @tmp_10000051= @@optimizer_switch;
-set optimizer_switch='mrr=off';
---echo # Must not use ICP:
-explain select * from t1 where a between 5 and 8 order by a desc, col desc;
-set optimizer_switch= @tmp_10000051;
-
---echo # Must not use ICP:
-explain select * from t1 where a=3 and col > 500 order by a desc, col desc;
-
-drop table t0, t1;
-
-set optimizer_switch=@myisam_icp_tmp;
-
diff --git a/mysql-test/t/myisam_icp_notembedded.test b/mysql-test/t/myisam_icp_notembedded.test
deleted file mode 100644
index 139a9edf648..00000000000
--- a/mysql-test/t/myisam_icp_notembedded.test
+++ /dev/null
@@ -1,139 +0,0 @@
--- source include/not_embedded.inc
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-set @myisam_icp_notembedded_tmp=@@optimizer_switch;
-set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
-
---echo #
---echo # BUG#933412: Server crashes in _mi_put_key_in_record on KILL QUERY with ICP, STRAIGHT_JOIN
---echo #
-CREATE TABLE t1 (
- b INT,
- c VARCHAR(1) NOT NULL,
- d DATETIME,
- KEY (c, b)
-) ENGINE=MyISAM;
---echo # INSERT some data
---disable_query_log
-INSERT INTO t1 ( b, d, c ) VALUES
-(4,'2005-01-08 00:00:00','f'),
-(1,'2004-05-20 10:45:51','c'),(2,'2006-08-11 21:33:49','e'),
-(5,'2003-05-19 00:20:40','a'),(3,'2005-01-03 06:18:39','a'),
-(7,'2008-11-25 18:18:14','b'),(6,'2008-11-09 15:53:46','b'),
-(9,'2003-03-01 03:40:36','c'),(8,'2003-09-25 23:14:09','d'),
-(0,'2007-01-17 09:18:31','f'),(9,'2008-09-08 09:52:24','c'),
-(2,'2008-03-10 00:00:00','a'),(0,'2003-03-14 09:31:07','c'),
-(4,'2005-04-25 00:00:00','h'),(6,'2001-08-01 05:55:55','e'),
-(3,'2005-04-09 01:22:48','f'),(7,'2009-11-12 13:27:22','r'),
-(0,'2009-03-28 05:05:28','h'),(15,'2005-05-16 04:35:41','f'),
-(7,'2006-03-26 05:19:58','c'),(9,'2002-10-06 02:17:00','g'),
-(4,'2007-01-28 03:28:20','b'),(1,'2009-04-22 10:16:40','c'),
-(2,'2003-01-01 19:39:00','f'),(0,'2008-05-03 19:16:29','t'),
-(2,'2005-01-28 00:00:00','j'),(8,'2004-01-10 00:00:00','w'),
-(8,'2000-06-13 21:56:37','a'),(5,'2001-03-21 19:24:49','o'),
-(99,'2003-12-20 21:29:06','f'),(0,'1900-01-01 00:00:00','w'),
-(7,'2000-12-19 00:00:00','c'),(0,'2000-03-03 06:10:19','l'),
-(3,'2000-08-11 00:00:00','q'),(0,'2007-05-25 03:46:41','e'),
-(241,'2005-05-17 00:00:00','j'),(4,'2005-11-02 00:44:06','r'),
-(43,'2001-07-11 00:00:00','a'),(1,'2008-12-01 18:30:27','z'),
-(4,'2004-10-25 00:00:00','i'),(5,'2000-04-08 12:12:01','c'),
-(0,'1900-01-01 00:00:00','f'),(9,'2002-05-13 22:47:02','p'),
-(1,'2008-10-09 15:39:40','d'),(3,'2004-06-24 00:00:00','d'),
-(0,'2008-03-06 00:00:00','r'),(9,'2007-04-16 18:40:03','i'),
-(3,'2008-03-16 19:49:37','t'),(7,'2003-07-15 08:11:21','d'),
-(8,'2005-02-11 00:04:53','r'),(0,'2002-09-21 00:00:00','y'),
-(3,'2004-11-03 00:37:21','z'),(6,'2007-10-18 00:00:00','e'),
-(6,'2007-01-21 10:42:56','o'),(5,'2000-03-26 21:21:04','b'),
-(9,'2001-03-15 08:08:21','e'),(1,'2001-10-16 12:56:59','a'),
-(6,'2004-05-01 23:45:55','o'),(4,'2000-03-04 00:00:00','f'),
-(9,'2002-12-03 16:48:28','e'),(8,'2003-01-09 00:36:07','m'),
-(1,'2006-06-22 04:32:41','s'),(8,'2008-09-20 05:01:48','q'),
-(4,'2006-06-02 22:15:31','g'),(2,'2002-05-14 07:07:42','e'),
-(7,'2005-06-05 01:30:42','r'),(127,'2004-05-11 01:56:48','a'),
-(210,'2003-11-05 00:41:34','z'),(5,'1900-01-01 00:00:00','h'),
-(1,'2006-04-16 00:00:00','f'),(7,'2000-12-17 00:00:00','x'),
-(8,'2009-05-09 20:43:07','b'),(175,'2008-11-26 16:33:09','p'),
-(0,'2002-05-09 21:18:44','v'),(8,'2002-06-01 11:32:25','k'),
-(1,'2008-11-09 23:56:00','a'),(0,'2008-01-08 10:18:46','c'),
-(2,'2005-04-16 00:00:00','o'),(5,'2002-08-25 00:00:00','b'),
-(64,'2005-12-05 21:51:52','b'),(4,'2005-08-10 00:00:00','i'),
-(6,'2006-03-23 00:00:00','d'),(9,'2007-01-27 00:00:00','i'),
-(8,'2008-08-16 00:00:00','a'),(7,'2003-01-16 12:13:18','k'),
-(0,'2003-06-22 00:00:00','v'),(5,'2008-06-20 05:43:56','u'),
-(8,'2004-09-23 18:57:17','e'),(1,'2000-12-26 00:00:00','y'),
-(4,'2009-06-01 13:00:28','e'),(1,'2009-11-18 06:28:48','m'),
-(0,'2004-06-12 10:01:10','e'),(2,'2005-10-16 01:48:55','e'),
-(5,'2001-12-23 09:50:21','l'),(6,'1900-01-01 00:00:00','a'),
-(1,'2001-10-28 00:00:00','d'),(1,'2008-07-12 23:30:19','s'),
-(0,'2002-10-11 16:51:16','r'),(4,'2007-09-18 06:27:10','x'),
-(1,'2007-02-21 12:28:14','e'),(6,'2001-09-16 00:00:00','f'),
-(0,'2007-09-20 02:25:45','c'),(0,'2006-08-07 03:25:56','j'),
-(8,'2006-12-04 20:20:32','t'),(7,'2007-09-05 10:13:10','i'),
-(9,'2006-04-12 17:59:57','t'),(2,'2009-04-28 00:06:09','b'),
-(8,'2000-01-07 00:00:00','b'),(7,'2000-03-25 10:04:41','k'),
-(4,'2000-07-10 00:44:55','w'),(9,'2007-09-22 14:26:26','j'),
-(9,'2003-09-11 22:41:17','a'),(0,'2004-06-07 13:52:32','c'),
-(8,'2008-10-09 00:00:00','p'),(1,'2007-04-01 00:00:00','c'),
-(9,'2000-12-05 00:00:00','i'),(3,'1900-01-01 00:00:00','a'),
-(3,'2005-12-24 21:50:54','e'),(8,'2009-07-21 19:34:55','n'),
-(9,'2005-11-13 17:57:56','d'),(7,'2004-10-07 06:41:39','l'),
-(1,'2004-11-20 08:05:08','u'),(3,'2005-05-25 00:00:00','r'),
-(1,'2006-09-02 14:16:41','u'),(8,'2006-01-07 00:00:00','a'),
-(9,'2003-04-05 00:54:20','w'),(2,'2003-12-22 00:00:00','a'),
-(9,'2006-04-16 17:31:40','e'),(6,'2005-02-10 14:22:46','e'),
-(7,'2004-04-27 05:54:52','p'),(1,'2005-12-07 00:00:00','t'),
-(5,'2004-04-03 20:56:28','d'),(4,'2000-09-07 05:17:16','h'),
-(2,'2004-08-04 16:10:42','i'),(1,'2007-03-04 00:00:00','b'),
-(9,'1900-01-01 00:00:00','d'),(1,'2000-05-12 23:02:50','m'),
-(2,'1900-01-01 00:00:00','l'),(1,'1900-01-01 00:00:00','k'),
-(4,'2000-07-14 01:25:18','d'),(5,'2009-08-21 00:00:00','w'),
-(6,'2009-05-25 13:33:54','f'),(7,'2006-06-13 00:00:00','e'),
-(8,'1900-01-01 00:00:00','a'),(6,'2004-02-24 00:00:00','j'),
-(0,'2003-05-21 07:03:46','k'),(9,'1900-01-01 00:00:00','e'),
-(2,'1900-01-01 00:00:00','y'),(2,'2000-12-22 00:00:00','e'),
-(3,'2003-09-26 00:00:00','f'),(2,'2001-01-13 08:20:19','h'),
-(9,'2008-09-23 20:03:28','n'),(5,'2007-03-20 02:41:38','s'),
-(1,'2009-02-14 10:27:18','a'),(0,'2001-08-10 17:44:05','s'),
-(3,'2008-01-20 12:49:54','v'),(1,'2001-05-05 09:09:59','r');
---enable_query_log
-CREATE TABLE t2 ( a INT ) ENGINE=MyISAM;
-INSERT INTO t2 VALUES
- (7),(3),(7),(3);
-
-# 'con2' will be the connection that will run all the KILLable statements
---connect (con2,127.0.0.1,root,,test)
-
---let $run = 300
---let $con_id = `SELECT CONNECTION_ID()`
-
---echo # Now run a number of ICP queries while trying to kill them
---disable_query_log
---disable_result_log
-while ($run)
-{
- --send
- SELECT * FROM t1 AS alias1 STRAIGHT_JOIN t1 AS alias2
- ON alias2.c = alias1.c
- WHERE alias2.b >= 9;
-
- --connect (con1,127.0.0.1,root,,test)
- --eval KILL QUERY $con_id
- --disconnect con1
-
- --dec $run
-
- --connection con2
- --error 0,ER_QUERY_INTERRUPTED
- --reap
-}
---enable_result_log
---enable_query_log
---disconnect con2
---connection default
-DROP TABLE t1,t2;
-
-set optimizer_switch=@myisam_icp_notembedded_tmp;
-
diff --git a/mysql-test/t/myisam_mrr.test b/mysql-test/t/myisam_mrr.test
deleted file mode 100644
index b15fdf60ce7..00000000000
--- a/mysql-test/t/myisam_mrr.test
+++ /dev/null
@@ -1,326 +0,0 @@
-#
-# MRR/MyISAM tests.
-#
-
---disable_warnings
-drop table if exists t0, t1, t2, t3;
---enable_warnings
-
-set @myisam_mrr_tmp=@@optimizer_switch;
-set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
-set @mrr_buffer_size_save= @@mrr_buffer_size;
-set mrr_buffer_size=79;
-
--- source include/mrr_tests.inc
-
-set @@mrr_buffer_size= @mrr_buffer_size_save;
-
-#
-# BUG#30622: Incorrect query results for MRR + filesort
-#
-CREATE TABLE t1 (
- ID int(10) unsigned NOT NULL AUTO_INCREMENT,
- col1 int(10) unsigned DEFAULT NULL,
- key1 int(10) unsigned NOT NULL DEFAULT '0',
- key2 int(10) unsigned DEFAULT NULL,
- text1 text,
- text2 text,
- col2 smallint(6) DEFAULT '100',
- col3 enum('headers','bodyandsubject') NOT NULL DEFAULT 'bodyandsubject',
- col4 tinyint(3) unsigned NOT NULL DEFAULT '0',
- PRIMARY KEY (ID),
- KEY (key1),
- KEY (key2)
-) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
-
-INSERT INTO t1 VALUES
-(1,NULL,1130,NULL,'Hello',NULL,100,'bodyandsubject',0),
-(2,NULL,1130,NULL,'bye',NULL,100,'bodyandsubject',0),
-(3,NULL,1130,NULL,'red',NULL,100,'bodyandsubject',0),
-(4,NULL,1130,NULL,'yellow',NULL,100,'bodyandsubject',0),
-(5,NULL,1130,NULL,'blue',NULL,100,'bodyandsubject',0);
-
-select * FROM t1 WHERE key1=1130 AND col1 IS NULL ORDER BY text1;
-
-drop table t1;
-
-
---echo
---echo BUG#37851: Crash in test_if_skip_sort_order tab->select is zero
---echo
-CREATE TABLE t1 (
- pk int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (pk)
-);
-INSERT INTO t1 VALUES (1);
-
-CREATE TABLE t2 (
- pk int(11) NOT NULL AUTO_INCREMENT,
- int_key int(11) DEFAULT NULL,
- PRIMARY KEY (pk),
- KEY int_key (int_key)
-);
-INSERT INTO t2 VALUES (1,1),(2,6),(3,0);
-
-EXPLAIN EXTENDED
-SELECT MIN(t1.pk)
-FROM t1 WHERE EXISTS (
- SELECT t2.pk
- FROM t2
- WHERE t2.int_key IS NULL
- GROUP BY t2.pk
-);
-
-DROP TABLE t1, t2;
-
--- echo #
--- echo # BUG#42048 Discrepancy between MyISAM and Maria's ICP implementation
--- echo #
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t1 (a int, b char(20), filler char(200), key(a,b(10)));
-insert into t1 select A.a + 10*(B.a + 10*C.a), 'bbb','filler' from t0 A, t0 B, t0 C;
-update t1 set b=repeat(char(65+a), 20) where a < 25;
-
---echo This must show range + using index condition:
-explain select * from t1 where a < 10 and b = repeat(char(65+a), 20);
-select * from t1 where a < 10 and b = repeat(char(65+a), 20);
-drop table t0,t1;
-
--- echo #
--- echo # BUG#41136: ORDER BY + range access: EXPLAIN shows "Using MRR" while MRR is actually not used
--- echo #
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t1 (a int, b int, key(a));
-insert into t1 select A.a + 10 *(B.a + 10*C.a), A.a + 10 *(B.a + 10*C.a) from t0 A, t0 B, t0 C;
--- echo This mustn't show "Using MRR":
-explain select * from t1 where a < 20 order by a;
-drop table t0, t1;
-
--- echo #
--- echo # Part of MWL#67: DS-MRR backport: add an @@optimizer_switch flag for
--- echo # index_condition pushdown:
--- echo # - engine_condition_pushdown does not affect ICP
-
-
-# Check that optimizer_switch is present
-select @@optimizer_switch like '%index_condition_pushdown=on%';
-
-# Check if it affects ICP
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t1 (a int, b int, key(a));
-insert into t1 select A.a + 10 *(B.a + 10*C.a), A.a + 10 *(B.a + 10*C.a) from t0 A, t0 B, t0 C;
-
--- echo A query that will use ICP:
-explain select * from t1 where a < 20;
-
-set @save_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='index_condition_pushdown=off';
-explain select * from t1 where a < 20;
-
-set optimizer_switch='index_condition_pushdown=on';
-explain select * from t1 where a < 20;
-
-set optimizer_switch=@save_optimizer_switch;
-
-
---echo #
---echo # BUG#629684: Unreachable code in multi_range_read.cc in maria-5.3-dsmrr-cpk
---echo #
-
-delete from t0 where a > 2;
-insert into t0 values (NULL),(NULL);
-insert into t1 values (NULL, 1234), (NULL, 5678);
-
-set @save_join_cache_level=@@join_cache_level;
-set @@join_cache_level=6;
-explain
-select * from t0, t1 where t0.a<=>t1.a;
-select * from t0, t1 where t0.a<=>t1.a;
-
-set @@join_cache_level=@save_join_cache_level;
-drop table t0, t1;
-
---echo #
---echo # BUG#625841: Assertion `!table || (!table->read_set || bitmap_is_set
---echo # (table->read_set, field_index))' on REPLACE ... SELECT with MRR
---echo #
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1 (
- key1 varchar(10),
- col1 char(255), col2 char(255),
- col3 char(244), col4 char(255),
- key(key1)
-);
-create table t2 like t1;
-
-insert into t1
-select
- 1000+A.a+100*B.a + 10*C.a,
- 'col1val', 'col2val',
- 'col3val', 'col4val'
-from t0 A, t0 B, t0 C;
-
-REPLACE INTO t2(col2,col3,col4)
-SELECT col2,col3,col4
-FROM t1
-WHERE `key1` LIKE CONCAT( LEFT( '1' , 7 ) , '%' )
-ORDER BY col1 LIMIT 7;
-drop table t0, t1, t2;
-
---echo #
---echo # BUG#670417: Diverging results in maria-5.3-mwl128-dsmrr-cpk with join buffer (incremental, BKA join)
---echo #
-
-set @save_join_cache_level = @@join_cache_level;
-set join_cache_level = 6;
-set @save_join_buffer_size=@@join_buffer_size;
---disable_warnings
-set join_buffer_size = 136;
---enable_warnings
-
-CREATE TABLE t1 (
- pk int(11) NOT NULL AUTO_INCREMENT,
- col_int_key int(11) NOT NULL,
- col_varchar_key varchar(1) NOT NULL,
- col_varchar_nokey varchar(1) NOT NULL,
- PRIMARY KEY (pk),
- KEY col_varchar_key (col_varchar_key,col_int_key)
-);
-INSERT INTO t1 VALUES
- (10,8,'v','v'),(11,8,'f','f'), (12,5,'v','v'),
- (13,8,'s','s'),(14,8,'a','a'),(15,6,'p','p'),
- (16,7,'z','z'),(17,2,'a','a'),(18,5,'h','h'),
- (19,7,'h','h'),(20,2,'v','v'),(21,9,'v','v'),
- (22,142,'b','b'),(23,3,'y','y'),(24,0,'v','v'),
- (25,3,'m','m'),(26,5,'z','z'),(27,9,'n','n'),
- (28,1,'d','d'),(29,107,'a','a');
-INSERT INTO t1 VALUES
- (110,8,'v','v'),(111,8,'f','f'), (112,5,'v','v'),
- (113,8,'s','s'),(114,8,'a','a'),(115,6,'p','p'),
- (116,7,'z','z'),(117,2,'a','a'),(118,5,'h','h'),
- (119,7,'h','h'),(120,2,'v','v'),(121,9,'v','v'),
- (122,142,'b','b'),(123,3,'y','y'),(124,0,'v','v'),
- (125,3,'m','m'),(126,5,'z','z'),(127,9,'n','n'),
- (128,1,'d','d'),(129,107,'a','a');
-
-SELECT COUNT(*)
-FROM
- t1 AS table2, t1 AS table3
-where
- table3.col_varchar_key = table2.col_varchar_key AND
- table3.col_varchar_key = table2.col_varchar_nokey AND
- table3.pk<>0;
-
-EXPLAIN SELECT COUNT(*)
-FROM
- t1 AS table2, t1 AS table3
-where
- table3.col_varchar_key = table2.col_varchar_key AND
- table3.col_varchar_key = table2.col_varchar_nokey AND
- table3.pk<>0;
-
-set join_cache_level= @save_join_cache_level;
-set join_buffer_size= @save_join_buffer_size;
-drop table t1;
-
-
---echo #
---echo # BUG#730133: Wrong result with jkl = 7, BKA, ICP in maria-5.3 + compound index
---echo #
-set @tmp_730133_jcl= @@join_cache_level;
-set join_cache_level = 7;
-
-set @tmp_730133_os= @@optimizer_switch;
-set optimizer_switch= 'join_cache_hashed=off,join_cache_bka=on,index_condition_pushdown=on,optimize_join_buffer_size=on';
-
-CREATE TABLE t1 (f1 int, f2 int, f3 int, f4 int, f5 int, KEY (f4,f3));
-INSERT IGNORE INTO t1 VALUES ('2','9','5','0','0'),('4','7','0','0','0'),
- ('6','97','190','0','0'),('7','3','6','0','0'),('11','101','186','0','0'),
- ('14','194','226','0','0'),('15','148','133','0','0'),
- ('16','9','6','0','0'),('17','9','3','0','0'),('18','1','8','0','0'),
- ('19','1','5','0','0'),('20','5','7','0','0');
-
-explain
-SELECT COUNT(alias2.f2)
-FROM
- t1 STRAIGHT_JOIN
- t1 AS alias3 STRAIGHT_JOIN
- t1 AS alias2 FORCE KEY (f4)
-WHERE
- alias2.f4=alias3.f5 AND
- alias2.f3 > alias3.f1;
-
-SELECT COUNT(alias2.f2)
-FROM
- t1 STRAIGHT_JOIN
- t1 AS alias3 STRAIGHT_JOIN
- t1 AS alias2 FORCE KEY (f4)
-WHERE
- alias2.f4=alias3.f5 AND
- alias2.f3 > alias3.f1;
-
-set @@join_cache_level= @tmp_730133_jcl;
-set @@optimizer_switch= @tmp_730133_os;
-drop table t1;
-
---echo #
---echo # Test of MRR handler counters
---echo #
-flush status;
-show status like 'Handler_mrr%';
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t1 (a int, b int, filler char(200), key(a));
-insert into t1
-select A.a+10*B.a+100*C.a+1000*D.a, 123,'filler' from t0 A, t0 B, t0 C, t0 D;
-
-explain select sum(b) from t1 where a < 10;
---echo # This should show one MRR scan and no re-fills:
-flush status;
-select sum(b) from t1 where a < 10;
-show status like 'handler_mrr%';
-
-set @mrr_buffer_size_save= @@mrr_buffer_size;
---disable_warnings
-set mrr_buffer_size=128;
---enable_warnings
-
-explain select sum(b) from t1 where a < 1600;
---echo # This should show one MRR scan and one extra rowid sort:
-flush status;
-select sum(b) from t1 where a < 1600;
-show status like 'handler_mrr%';
-set @@mrr_buffer_size= @mrr_buffer_size_save;
-
---echo #Now, let's check BKA:
-set @join_cache_level_save= @@join_cache_level;
-set @join_buffer_size_save= @@join_buffer_size;
-set join_cache_level=6;
-
-explain select sum(t1.b) from t0,t1 where t0.a=t1.a;
-flush status;
-select sum(t1.b) from t0,t1 where t0.a=t1.a;
-show status like 'handler_mrr%';
-
---disable_warnings
-set join_buffer_size=10;
---enable_warnings
-explain select sum(t1.b) from t0,t1 where t0.a=t1.a;
-flush status;
-select sum(t1.b) from t0,t1 where t0.a=t1.a;
-# the values below depend on sizeof(void*)
---replace_result 1 ok 2 ok 3 ok
-show status like 'handler_mrr%';
-
-set join_cache_level= @join_cache_level_save;
-set join_buffer_size= @join_buffer_size_save;
-
-drop table t0, t1;
-
-## This must be last line in the file:
-set optimizer_switch= @myisam_mrr_tmp;
diff --git a/mysql-test/t/myisam_optimize.test b/mysql-test/t/myisam_optimize.test
deleted file mode 100644
index 5e133aea853..00000000000
--- a/mysql-test/t/myisam_optimize.test
+++ /dev/null
@@ -1,65 +0,0 @@
-#
-# test OPTIMIZE and a concurrent SELECT of a MyISAM table
-#
-source include/have_debug_sync.inc;
-
-call mtr.add_suppression(" marked as crashed and should be repaired");
-
-create table t1 (a int auto_increment primary key, b text);
-insert t1 (b) select repeat("A", 100);
-insert t1 (b) select repeat("B", 200) from t1;
-insert t1 (b) select repeat("C", 300) from t1;
-
-delete from t1 where a < 3;
-explain select a, left(b,10) from t1 order by a;
-select left(b,10), a from t1 order by a;
-
-set debug_sync='myisam_before_repair_by_sort wait_for go';
-send optimize table t1;
-
-connect (con1,localhost,root,,);
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state like "%myisam_before_repair_by_sort%";
---source include/wait_condition.inc
-
-send select a, left(b,10) from t1 order by a;
-
-connect (con2,localhost,root,,);
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table metadata lock";
---source include/wait_condition.inc
-
-set debug_sync='now signal go';
-
-connection default;
-reap;
-
-connection con1;
-reap;
-
-disconnect con1;
-disconnect con2;
-connection default;
-
-drop table t1;
-set debug_sync='reset';
-
---echo # End of 5.5 tests
-
-#
-# MDEV-11539 test_if_reopen: Assertion `strcmp(share->unique_file_name,filename) || share->last_version' failed upon select from I_S
-#
-CREATE TABLE t1 (i INT) ENGINE=MyISAM;
-INSERT t1 VALUES (1);
-LOCK TABLE t1 WRITE;
-OPTIMIZE TABLE t1;
---disable_result_log
-SELECT * FROM INFORMATION_SCHEMA.TABLES;
---enable_result_log
-SELECT * FROM t1;
-UNLOCK TABLES;
-DROP TABLE t1;
-
---echo # End of 10.0 tests
diff --git a/mysql-test/t/myisam_recover-master.opt b/mysql-test/t/myisam_recover-master.opt
deleted file mode 100644
index fca5ea079e3..00000000000
--- a/mysql-test/t/myisam_recover-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---myisam-recover-options=force
diff --git a/mysql-test/t/myisam_recover.test b/mysql-test/t/myisam_recover.test
deleted file mode 100644
index 86a4d16d0f9..00000000000
--- a/mysql-test/t/myisam_recover.test
+++ /dev/null
@@ -1,173 +0,0 @@
---source include/count_sessions.inc
-
-call mtr.add_suppression("Table 't1' is marked as crashed and should be repaired");
-
---echo #
---echo # Tests for corrupted MyISAM tables and MyISAMMRG tables with corrupted
---echo # children..
---echo #
---echo # Run with --myisam-recover=force option.
---echo #
---echo # Preparation: we need to make sure that the merge parent
---echo # is never left in the table cache when closed, since this may
---echo # have effect on merge children.
---echo # For that, we set the table cache to minimal size and populate it
---echo # in a concurrent connection.
-connect(con1,localhost,root,,test,,);
-connection con1;
---echo #
---echo # Minimal values.
---echo #
-
-call mtr.add_suppression("Got an error from thread_id=.*ha_myisam.cc:");
-call mtr.add_suppression("MySQL thread id .*, query id .* localhost.*root Checking table");
-call mtr.add_suppression(" '\..test.t1'");
-
-set global table_open_cache=256;
-set global table_definition_cache=400;
---disable_warnings
-drop procedure if exists p_create;
---enable_warnings
-delimiter |;
-create procedure p_create()
-begin
- declare i int default 1;
- set @lock_table_stmt="lock table ";
- set @drop_table_stmt="drop table ";
- while i < @@global.table_definition_cache + 1 do
- set @table_name=concat("t_", i);
- set @opt_comma=if(i=1, "", ", ");
- set @lock_table_stmt=concat(@lock_table_stmt, @opt_comma,
- @table_name, " read");
- set @drop_table_stmt=concat(@drop_table_stmt, @opt_comma, @table_name);
- set @create_table_stmt=concat("create table if not exists ",
- @table_name, " (a int)");
- prepare stmt from @create_table_stmt;
- execute stmt;
- deallocate prepare stmt;
- set i= i+1;
- end while;
-end|
-delimiter ;|
-call p_create();
-drop procedure p_create;
---disable_query_log
-let $lock=`select @lock_table_stmt`;
-eval $lock;
---enable_query_log
-connection default;
---echo #
---echo # We have to disable the ps-protocol, to avoid
---echo # "Prepared statement needs to be re-prepared" errors
---echo # -- table def versions change all the time with full table cache.
---echo #
---disable_ps_protocol
---disable_warnings
-drop table if exists t1, t1_mrg, t1_copy;
---enable_warnings
-let $MYSQLD_DATADIR=`select @@datadir`;
---echo #
---echo # Prepare a MERGE engine table, that refers to a corrupted
---echo # child.
---echo #
-create table t1 (a int, key(a)) engine=myisam;
-create table t1_mrg (a int) union (t1) engine=merge;
---echo #
---echo # Create a table with a corrupted index file:
---echo # save an old index file, insert more rows,
---echo # overwrite the new index file with the old one.
---echo #
-insert into t1 (a) values (1), (2), (3);
-flush table t1;
---copy_file $MYSQLD_DATADIR/test/t1.MYI $MYSQLD_DATADIR/test/t1_copy.MYI
-insert into t1 (a) values (4), (5), (6);
-flush table t1;
---remove_file $MYSQLD_DATADIR/test/t1.MYI
---copy_file $MYSQLD_DATADIR/test/t1_copy.MYI $MYSQLD_DATADIR/test/t1.MYI
---remove_file $MYSQLD_DATADIR/test/t1_copy.MYI
---echo # check table is needed to mark the table as crashed.
-check table t1;
---echo #
---echo # At this point we have a merge table t1_mrg pointing to t1,
---echo # and t1 is corrupted, and will be auto-repaired at open.
---echo # Check that this doesn't lead to memory corruption.
---echo #
---replace_regex /'.*[\/\\]/'/
-select * from t1_mrg;
---echo #
---echo # Cleanup
---echo #
-drop table t1, t1_mrg;
-connection con1;
-unlock tables;
-prepare stmt from @drop_table_stmt;
-execute stmt;
-deallocate prepare stmt;
-set @@global.table_definition_cache=default;
-set @@global.table_open_cache=default;
-disconnect con1;
-connection default;
---enable_ps_protocol
-
---echo #
---echo # 18075170 - sql node restart required to avoid deadlock after
---echo # restore
---echo #
---echo # Check that auto-repair for MyISAM tables can now happen in the
---echo # middle of transaction, without aborting it.
---enable_prepare_warnings
-
-connection default;
-
-create table t1 (a int, key(a)) engine=myisam;
-create table t2 (a int);
-insert into t2 values (1);
-
---echo # Create a table with a corrupted index file:
---echo # save an old index file, insert more rows,
---echo # overwrite the new index file with the old one.
-insert into t1 (a) values (1);
-flush table t1;
---copy_file $MYSQLD_DATADIR/test/t1.MYI $MYSQLD_DATADIR/test/t1_copy.MYI
-insert into t1 (a) values (4);
-flush table t1;
---remove_file $MYSQLD_DATADIR/test/t1.MYI
---copy_file $MYSQLD_DATADIR/test/t1_copy.MYI $MYSQLD_DATADIR/test/t1.MYI
---remove_file $MYSQLD_DATADIR/test/t1_copy.MYI
-
---echo # Check table is needed to mark the table as crashed.
-check table t1;
-
---echo # At this point we have a corrupt t1
-set autocommit = 0;
-select * from t2;
---echo # Without fix select from t1 will break the transaction. After the fix
---echo # transaction should be active and should hold lock on table t2. Alter
---echo # table from con2 will wait only if the transaction is not broken.
---replace_regex /'.*[\/\\]/'/
-select * from t1;
-
-connect(con2, localhost, root);
---SEND ALTER TABLE t2 ADD val INT
-
-connection default;
---echo # With fix we should have alter table waiting for t2 lock here.
-let $wait_condition=
- SELECT count(*) = 1 FROM information_schema.processlist WHERE state
- LIKE "Waiting%" AND info = "ALTER TABLE t2 ADD val INT";
-
---source include/wait_condition.inc
-ROLLBACK;
-SET autocommit = 1;
-
-connection con2;
---REAP
-
-connection default;
-disconnect con2;
-
---echo # Cleanup
-drop table t1, t2;
-
-# Wait till all disconnects are completed
--- source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/myisampack.test b/mysql-test/t/myisampack.test
deleted file mode 100644
index 1f97a28e6fd..00000000000
--- a/mysql-test/t/myisampack.test
+++ /dev/null
@@ -1,328 +0,0 @@
--- disable_warnings
-DROP TABLE IF EXISTS t1,t2,t3;
--- enable_warnings
-#
-# BUG#31277 - myisamchk --unpack corrupts a table
-#
-CREATE TABLE t1(c1 DOUBLE, c2 DOUBLE, c3 DOUBLE, c4 DOUBLE, c5 DOUBLE,
- c6 DOUBLE, c7 DOUBLE, c8 DOUBLE, c9 DOUBLE, a INT PRIMARY KEY);
-INSERT INTO t1 VALUES
-(-3.31168791059336e-06,-3.19054655887874e-06,-1.06528081684847e-05,-1.227278240089e-06,-1.66718069164799e-06,-2.59038972510885e-06,-2.83145227805303e-06,-4.09678491270648e-07,-2.22610091291797e-06,6),
-(0.0030743000272545,2.53222044316438e-05,2.78674650061845e-05,1.95914465544536e-05,1.7347572525984e-05,1.87513810069614e-05,1.69882826885005e-05,2.44449336987598e-05,1.89914629921774e-05,9),
-(2.85229319423495e-05,3.05970988282259e-05,3.77161100113133e-05,2.3055238978766e-05,2.08241267364615e-05,2.28009504270553e-05,2.12070165658947e-05,2.84350091565409e-05,2.3366822910704e-05,3),
-(0,0,0,0,0,0,0,0,0,12),
-(3.24544577570754e-05,3.44619021870993e-05,4.37561613201124e-05,2.57556808726748e-05,2.3195354640561e-05,2.58532400758869e-05,2.34934241667179e-05,3.1621640063232e-05,2.58229982746189e-05,19),
-(2.53222044316438e-05,0.00445071933455582,2.97447268116016e-05,2.12379514059868e-05,1.86777776502663e-05,2.0170058676712e-05,1.8946030385445e-05,2.66040037173511e-05,2.09161899668946e-05,20),
-(3.03462382611645e-05,3.26517930083994e-05,3.5242025468662e-05,2.53219745106391e-05,2.24384532945004e-05,2.4052346047657e-05,2.23865572957053e-05,3.1634313969082e-05,2.48285463481801e-05,21),
-(1.95914465544536e-05,2.12379514059868e-05,2.27808649037128e-05,0.000341724375366877,1.4512761275113e-05,1.56475828693953e-05,1.44372366441415e-05,2.07952121981765e-05,1.61488256935919e-05,28),
-(1.7347572525984e-05,1.86777776502663e-05,2.04116907052727e-05,1.4512761275113e-05,0.000432162526082388,1.38116514014465e-05,1.2712914948904e-05,1.82503165178506e-05,1.43043075345922e-05,30),
-(1.68339762136661e-05,1.77836497166611e-05,2.36328309295222e-05,1.30183423732016e-05,1.18674654241553e-05,1.32467273128652e-05,1.24581739117775e-05,1.55624190959406e-05,1.33010638508213e-05,31),
-(1.89643062824415e-05,2.06997140070717e-05,2.29045490159364e-05,1.57918175731019e-05,1.39864987449492e-05,1.50580274578455e-05,1.45908734129609e-05,1.95329296993327e-05,1.5814709481221e-05,32),
-(1.69882826885005e-05,1.8946030385445e-05,2.00820439721439e-05,1.44372366441415e-05,1.2712914948904e-05,1.35209686474184e-05,0.00261563314789896,1.78285095864627e-05,1.46699314500019e-05,34),
-(2.0278186540684e-05,2.18923409729654e-05,2.39981539939738e-05,1.71774589459438e-05,1.54654355357383e-05,1.62731485707636e-05,1.49253140625051e-05,2.18229800160297e-05,1.71923561673718e-05,35),
-(2.44449336987598e-05,2.66040037173511e-05,2.84860148925308e-05,2.07952121981765e-05,1.82503165178506e-05,1.97667730441441e-05,1.78285095864627e-05,0.00166478601822712,2.0299952103232e-05,36),
-(1.89914629921774e-05,2.09161899668946e-05,2.26026841007872e-05,1.61488256935919e-05,1.43043075345922e-05,1.52609063290127e-05,1.46699314500019e-05,2.0299952103232e-05,0.00306670170971682,39),
-(0,0,0,0,0,0,0,0,0,41),
-(0,0,0,0,0,0,0,0,0,17),
-(0,0,0,0,0,0,0,0,0,18),
-(2.51880677333017e-05,2.63051795435778e-05,2.79874748974906e-05,2.02888886670845e-05,1.8178636318197e-05,1.91308527003585e-05,1.83260023644133e-05,2.4422300558171e-05,1.96411467520551e-05,44),
-(2.22402118719591e-05,2.37546284320705e-05,2.58463051055541e-05,1.83391609130854e-05,1.6300720519646e-05,1.74559091886791e-05,1.63733785575587e-05,2.26616253279828e-05,1.79541237435621e-05,45),
-(3.01092775359837e-05,3.23865212934412e-05,4.09444584045994e-05,0,2.15470966302776e-05,2.39082636344032e-05,2.28296706429177e-05,2.9007671511595e-05,2.44201138973326e-05,46);
-FLUSH TABLES;
-let $MYSQLD_DATADIR= `select @@datadir`;
---exec $MYISAMPACK -s $MYSQLD_DATADIR/test/t1
---exec $MYISAMCHK -srq $MYSQLD_DATADIR/test/t1
---exec $MYISAMCHK -s --unpack $MYSQLD_DATADIR/test/t1
-CHECK TABLE t1 EXTENDED;
-DROP TABLE t1;
-
-#
-# Bug#40949 Debug version of MySQL server crashes when run OPTIMIZE on compressed table.
-# expanded with testcase for
-# BUG#41574 - REPAIR TABLE: crashes for compressed tables
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1(f1 int, f2 char(255));
-insert into t1 values(1, 'foo'), (2, 'bar');
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-flush tables;
-let $MYSQLD_DATADIR= `select @@datadir`;
---exec $MYISAMPACK $MYSQLD_DATADIR/test/t1
-optimize table t1;
-repair table t1;
-drop table t1;
-
---echo #
---echo # BUG#41541 - Valgrind warnings on packed MyISAM table
---echo #
-CREATE TABLE t1(f1 VARCHAR(200), f2 TEXT);
-INSERT INTO t1 VALUES ('foo', 'foo1'), ('bar', 'bar1');
-let $i=9;
---disable_query_log
-begin;
-while ($i)
-{
- INSERT INTO t1 SELECT * FROM t1;
- dec $i;
-}
-commit;
---enable_query_log
-FLUSH TABLE t1;
---echo # Compress the table using MYISAMPACK tool
-let $MYSQLD_DATADIR= `select @@datadir`;
---exec $MYISAMPACK $MYSQLD_DATADIR/test/t1
-SELECT COUNT(*) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Bug #43973 - backup_myisam.test fails on 6.0-bugteam
---echo #
-CREATE DATABASE mysql_db1;
-CREATE TABLE mysql_db1.t1 (c1 VARCHAR(5), c2 int);
-CREATE INDEX i1 ON mysql_db1.t1 (c1, c2);
-INSERT INTO mysql_db1.t1 VALUES ('A',1);
-INSERT INTO mysql_db1.t1 SELECT * FROM mysql_db1.t1;
-INSERT INTO mysql_db1.t1 SELECT * FROM mysql_db1.t1;
-INSERT INTO mysql_db1.t1 SELECT * FROM mysql_db1.t1;
-INSERT INTO mysql_db1.t1 SELECT * FROM mysql_db1.t1;
-INSERT INTO mysql_db1.t1 SELECT * FROM mysql_db1.t1;
-INSERT INTO mysql_db1.t1 SELECT * FROM mysql_db1.t1;
-INSERT INTO mysql_db1.t1 SELECT * FROM mysql_db1.t1;
-FLUSH TABLE mysql_db1.t1;
-#
---echo # Compress the table using MYISAMPACK tool
-let $MYSQLD_DATADIR= `select @@datadir`;
---exec $MYISAMPACK -s $MYSQLD_DATADIR/mysql_db1/t1
---echo # Run MYISAMCHK tool on the compressed table
---exec $MYISAMCHK -srq $MYSQLD_DATADIR/mysql_db1/t1
-SELECT COUNT(*) FROM mysql_db1.t1 WHERE c2 < 5;
-#
-# Bug#36573 myisampack --join does not create destination table .frm file
-#
-#############################################################################
-# Testcase myisampack.1: Positive test for myisampack --join
-# To test myisampack --join operation creates .frm file
-# If it creates .frm file, we will be able to access from mysql
-# server
-#############################################################################
---echo # ===== myisampack.1 =====
-CREATE TABLE t1(a INT);
-INSERT INTO t1 VALUES(20);
-
-let $i=9;
---disable_query_log
-while ($i)
-{
- INSERT INTO t1 SELECT a from t1;
- dec $i;
-}
---enable_query_log
-
-CREATE TABLE t2(a INT);
-INSERT INTO t2 VALUES(40);
-
-let $i=9;
---disable_query_log
-while ($i)
-{
- INSERT INTO t2 SELECT a from t2;
- dec $i;
-}
---enable_query_log
-
-FLUSH TABLE t1,t2;
---exec $MYISAMPACK --join=$MYSQLD_DATADIR/test/t3 $MYSQLD_DATADIR/test/t1 $MYSQLD_DATADIR/test/t2 2>&1
-
---echo #If the myisampack --join operation is successful, we have table t3(.frm)
---echo #so we should be able to query about the table from server.
-SELECT COUNT(a) FROM t3;
-
-#############################################################################
-# Testcase myisampack.2: 2nd Positive test for myisampack --join
-# Test myisampack join operation with an existing destination frm file.
-# It should finish the join operation successfully
-#############################################################################
---echo # ===== myisampack.2 =====
-FLUSH TABLE t3;
---remove_file $MYSQLD_DATADIR/test/t3.MYI
---remove_file $MYSQLD_DATADIR/test/t3.MYD
---exec $MYISAMPACK --join=$MYSQLD_DATADIR/test/t3 $MYSQLD_DATADIR/test/t1 $MYSQLD_DATADIR/test/t2 2>&1
---echo #Tests the myisampack join operation with an existing destination .frm file,
---echo #the command should return correct exit status(0) and
---echo #we should be able to query the table.
-
-SELECT COUNT(a) FROM t3;
-
-#############################################################################
-# Testcase myisampack.3: 3rd Positive test for myisampack --join
-# Test myisampack join operation without frm file for first table and second
-# table. It should finish the join operation successfully
-#############################################################################
---echo # ===== myisampack.3 =====
---copy_file $MYSQLD_DATADIR/test/t1.frm $MYSQLTEST_VARDIR/tmp/bug36573.t1.frm
---copy_file $MYSQLD_DATADIR/test/t2.frm $MYSQLTEST_VARDIR/tmp/bug36573.t2.frm
---remove_file $MYSQLD_DATADIR/test/t1.frm
---remove_file $MYSQLD_DATADIR/test/t2.frm
-
-DROP TABLE t3;
---exec $MYISAMPACK --join=$MYSQLD_DATADIR/test/t3 $MYSQLD_DATADIR/test/t1 $MYSQLD_DATADIR/test/t2 2>&1
---echo #Tests the myisampack join operation without frm file for the first and second table
---echo #No frm file is generated in this and we shouldn't be able to access the newly
---echo #created table
-
---error ER_NO_SUCH_TABLE
-SELECT COUNT(a) FROM t3;
-
---copy_file $MYSQLTEST_VARDIR/tmp/bug36573.t1.frm $MYSQLD_DATADIR/test/t1.frm
---copy_file $MYSQLTEST_VARDIR/tmp/bug36573.t2.frm $MYSQLD_DATADIR/test/t2.frm
---copy_file $MYSQLTEST_VARDIR/tmp/bug36573.t1.frm $MYSQLD_DATADIR/test/t3.frm
---remove_file $MYSQLTEST_VARDIR/tmp/bug36573.t1.frm
---remove_file $MYSQLTEST_VARDIR/tmp/bug36573.t2.frm
-
-#############################################################################
-# Testcase myisampack.4: Negative test for myisampack --join
-# Test myisampack join operation with an existing .MYI,.MDI,.frm files
-# the test should fail
-#############################################################################
---echo # ===== myisampack.4 =====
---echo #Tests the myisampack join operation with an existing destination .frm,.MYI,.MDI
---echo #the command should fail with exit status 2
-#
-# Note: Use of regular expressions in this file is for output printed in result file
-# The main purpose of this regular expression is to supress the filenames for
-# error messages produced so that we can create a generic result file
-#
-#1. /.*myisampack(\.exe)?: Can't create\/write to file .*\(/myisampack: Can't create\/write to file (/
-# Replace everything before "myisampack" or "myisampack.exe" and followed by
-# ": Can't create\/write to file " until the first open paranthesis , with
-# "myisampack: Can't create\/write to file ("
-#
-#2. /Aborted: .*is/Aborted: file is/
-# Replace everything after starting with "Aborted: " until ending with "is" with
-# "Aborted: file is/
-#
---replace_regex /.*myisampack(\.exe)?: Can't create\/write to file .*\(/myisampack: Can't create\/write to file (/ /Aborted: .*is/Aborted: file is/
---error 2
---exec $MYISAMPACK --join=$MYSQLD_DATADIR/test/t3 $MYSQLD_DATADIR/test/t1 $MYSQLD_DATADIR/test/t2 2>&1
-
-DROP TABLE t1,t2,t3;
-
-DROP TABLE mysql_db1.t1;
-DROP DATABASE mysql_db1;
-
---echo #
---echo # BUG#11761180 - 53646: MYISAMPACK CORRUPTS TABLES WITH FULLTEXT INDEXES
---echo #
-CREATE TABLE t1(a CHAR(4), FULLTEXT(a));
-INSERT INTO t1 VALUES('aaaa'),('bbbb'),('cccc');
-FLUSH TABLE t1;
---exec $MYISAMPACK -sf $MYSQLD_DATADIR/test/t1
---exec $MYISAMCHK -srq $MYSQLD_DATADIR/test/t1
-CHECK TABLE t1;
-SELECT * FROM t1 WHERE MATCH(a) AGAINST('aaaa' IN BOOLEAN MODE);
-SELECT * FROM t1 WHERE MATCH(a) AGAINST('aaaa');
-DROP TABLE t1;
-
---echo # Test table with key_reflength > rec_reflength
-CREATE TABLE t1(a CHAR(30), FULLTEXT(a));
---disable_query_log
---echo # Populating a table, so it's index file exceeds 65K
-let $1=1700;
-while ($1)
-{
- eval INSERT INTO t1 VALUES('$1aaaaaaaaaaaaaaaaaaaaaaaaaa');
- dec $1;
-}
-
---echo # Populating a table, so index file has second level fulltext tree
-let $1=60;
-while ($1)
-{
- eval INSERT INTO t1 VALUES('aaaa'),('aaaa'),('aaaa'),('aaaa'),('aaaa');
- dec $1;
-}
---enable_query_log
-
-FLUSH TABLE t1;
---echo # Compressing table
---exec $MYISAMPACK -sf $MYSQLD_DATADIR/test/t1
---echo # Fixing index (repair by sort)
---exec $MYISAMCHK -srnq $MYSQLD_DATADIR/test/t1
-CHECK TABLE t1;
-FLUSH TABLE t1;
---echo # Fixing index (repair with keycache)
---exec $MYISAMCHK -soq $MYSQLD_DATADIR/test/t1
-CHECK TABLE t1;
-DROP TABLE t1;
-
-#
-# MDEV-6245 Certain compressed tables with myisampack are corrupted by
-# "CHECK TABLE"
-#
-# Issue was that checksum failed for tables with NULL and VARCHAR fields
-#
-
-create table `t1` (`id` varchar(15) DEFAULT NULL) ENGINE=MyISAM ROW_FORMAT=FIXED;
-insert into t1 values ('aaa'),('bbb'),('ccc'),('ddd'),('eee');
-insert into t1 (select * from t1);
-insert into t1 (select * from t1);
-insert into t1 (select * from t1);
-insert into t1 (select * from t1);
-checksum table t1;
-insert into t1 values(NULL);
-checksum table t1;
-flush table t1;
---exec $MYISAMPACK -sf $MYSQLD_DATADIR/test/t1
---exec $MYISAMCHK -srnq $MYSQLD_DATADIR/test/t1
-check table t1;
-checksum table t1;
-alter table t1 checksum=1 row_format=fixed;
-checksum table t1;
-flush table t1;
---exec $MYISAMPACK -sf $MYSQLD_DATADIR/test/t1
---exec $MYISAMCHK -srnq $MYSQLD_DATADIR/test/t1
-check table t1;
-checksum table t1;
-
-# Testing with row_format=dynamic
-
-alter table t1 row_format=dynamic checksum=0;
-checksum table t1;
-flush table t1;
---exec $MYISAMPACK -sf $MYSQLD_DATADIR/test/t1
---exec $MYISAMCHK -srnq $MYSQLD_DATADIR/test/t1
-check table t1;
-checksum table t1;
-alter table t1 checksum=1 row_format=dynamic;
-checksum table t1;
-flush table t1;
---exec $MYISAMPACK -sf $MYSQLD_DATADIR/test/t1
---exec $MYISAMCHK -srnq $MYSQLD_DATADIR/test/t1
-check table t1;
-checksum table t1;
-drop table t1;
-
---echo #
---echo # BUG#11751736: DROP DATABASE STATEMENT SHOULD REMOVE .OLD SUFFIX FROM
---echo # DATABASE DIRECTORY
---echo #
-CREATE DATABASE db1;
-CREATE TABLE db1.t1(c1 INT) ENGINE=MyISAM;
-## Added -f to force pack db in any case regardless the size of database
-## being packed
-let $MYSQLD_DATADIR = `SELECT @@datadir`;
---exec $MYISAMPACK -b -f $MYSQLD_DATADIR/db1/t1
-DROP DATABASE db1;
diff --git a/mysql-test/t/mysql-bug41486.test b/mysql-test/t/mysql-bug41486.test
deleted file mode 100644
index e7b0acc1935..00000000000
--- a/mysql-test/t/mysql-bug41486.test
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-# Bug#41486 extra character appears in BLOB for every ~40Mb after
-# mysqldump/import
-#
-# This test consumes a significant amount of resources.
-# Therefore it should be kept separated from other tests.
-# Otherwise we might suffer from problems like
-# Bug#43801 mysql.test takes too long, fails due to expired timeout
-# on debx86-b in PB
-#
-
--- source include/not_embedded.inc
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-# Have to change the global variable as the session variable is
-# read-only.
-SET @old_max_allowed_packet= @@global.max_allowed_packet;
-# 2 MB blob length + some space for the rest of INSERT query
-SET @@global.max_allowed_packet = 2 * 1024 * 1024 + 1024;
-
-# Create a new connection since the global max_allowed_packet
-# has no effect for the current connection
-connect (con1, localhost, root,,);
-
-CREATE TABLE t1(data LONGBLOB);
-INSERT INTO t1 SELECT REPEAT('1', 2*1024*1024);
-# The following is to remove the race between end of insert and start of MYSQL_DUMP:
-SELECT COUNT(*) FROM t1;
-let $outfile= $MYSQLTEST_VARDIR/tmp/bug41486.sql;
---error 0,1
-remove_file $outfile;
---exec $MYSQL_DUMP test t1 > $outfile
-SET @old_general_log = @@global.general_log;
-SET @@global.general_log = 0;
-# Check that the mysql client does not insert extra newlines when loading
-# strings longer than client's max_allowed_packet
---exec $MYSQL --max_allowed_packet=1M test < $outfile 2>&1
-SET @@global.general_log = @old_general_log;
-SELECT LENGTH(data) FROM t1;
-
-DROP TABLE t1;
-
-# Cleanup
-disconnect con1;
---source include/wait_until_disconnected.inc
-remove_file $outfile;
-connection default;
-SET @@global.max_allowed_packet = @old_max_allowed_packet;
diff --git a/mysql-test/t/mysql-bug45236.test b/mysql-test/t/mysql-bug45236.test
deleted file mode 100644
index efc10ed19ea..00000000000
--- a/mysql-test/t/mysql-bug45236.test
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# Bug #45236: large blob inserts from mysqldump fail, possible memory issue ?
-#
-# This test consumes a significant amount of resources.
-# Therefore it should be kept separated from other tests.
-# Otherwise we might suffer from problems like
-# Bug#43801 mysql.test takes too long, fails due to expired timeout
-# on debx86-b in PB
-#
-
--- source include/not_embedded.inc
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-# Have to change the global variable as the session variable is
-# read-only.
-SET @old_max_allowed_packet= @@global.max_allowed_packet;
-# ~1 MB blob length + some space for the rest of INSERT query
-SET @@global.max_allowed_packet = 1024 * 1024 + 1024;
-
-# Create a new connection since the global max_allowed_packet
-# has no effect onr the current one
-connect (con1, localhost, root,,);
-
-CREATE TABLE t1(data LONGBLOB);
-INSERT INTO t1 SELECT CONCAT(REPEAT('1', 1024*1024 - 27),
- "\'\r dummydb dummyhost");
-
-let $outfile= $MYSQLTEST_VARDIR/tmp/bug41486.sql;
---error 0,1
-remove_file $outfile;
---exec $MYSQL_DUMP --compact -t test t1 > $outfile
-# Check that the mysql client does not interpret the "\r" sequence as a command
---exec $MYSQL --max_allowed_packet=1M test < $outfile 2>&1
-
-DROP TABLE t1;
-
-# Cleanup
-disconnect con1;
---source include/wait_until_disconnected.inc
-remove_file $outfile;
-connection default;
-SET @@global.max_allowed_packet = @old_max_allowed_packet;
diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test
deleted file mode 100644
index 300695612fd..00000000000
--- a/mysql-test/t/mysql.test
+++ /dev/null
@@ -1,677 +0,0 @@
--- source include/have_working_dns.inc
-# This test should work in embedded server after we fix mysqltest
--- source include/not_embedded.inc
-#
-# Testing the MySQL command line client(mysql)
-#
-set GLOBAL sql_mode="";
-set LOCAL sql_mode="";
-
---disable_warnings
-drop table if exists t1,t2,t3;
---enable_warnings
-
-#
-# Test the "delimiter" functionality
-# Bug#9879
-#
-create table t1(a int);
-insert into t1 values(1);
-
-# Test delimiters
---exec $MYSQL test 2>&1 < "./t/mysql_delimiter.sql"
-
---disable_query_log
-# Test delimiter : supplied on the command line
-select "Test delimiter : from command line" as "_";
---exec $MYSQL test --delimiter=":" -e "select * from t1:"
-# Test delimiter :; supplied on the command line
-select "Test delimiter :; from command line" as "_";
---exec $MYSQL test --delimiter=":;" -e "select * from t1:;"
-# Test 'go' command (vertical output) \G
-select "Test 'go' command(vertical output) \G" as "_";
---exec $MYSQL test -e "select * from t1\G"
-# Test 'go' command \g
-select "Test 'go' command \g" as "_";
---exec $MYSQL test -e "select * from t1\g"
---enable_query_log
-drop table t1;
-
-#
-# BUG9998 - MySQL client hangs on USE "database"
-#
-create table t1(a int);
-lock tables t1 write;
---exec $MYSQL -e "use test; select database();"
-unlock tables;
-drop table t1;
-
-#
-# Bug#16859 -- NULLs in columns must not truncate data as if a C-language "string".
-#
---exec $MYSQL -t test -e "create table t1 (col1 binary(4), col2 varchar(10), col3 int); insert into t1 values ('a', 'b', 123421),('a ', '0123456789', 4), ('abcd', '', 4); select concat('>',col1,'<'), col2, col3 from t1; drop table t1;" 2>&1
-
-#
-# Bug#17939 Wrong table format when using UTF8 strings
-#
---exec $MYSQL --default-character-set=utf8 --table -e "SELECT 'John Doe' as '__tañgè Ñãmé'" 2>&1
---exec $MYSQL --default-character-set=utf8 --table -e "SELECT '__tañgè Ñãmé' as 'John Doe'" 2>&1
-
-#
-# Bug#18265 -- mysql client: No longer right-justifies numeric columns
-#
---exec $MYSQL -t --default-character-set utf8 test -e "create table t1 (i int, j int, k char(25) charset utf8); insert into t1 (i) values (1); insert into t1 (k) values ('<----------------------->'); insert into t1 (k) values ('<-----'); insert into t1 (k) values ('Τη γλώσσα'); insert into t1 (k) values ('ᛖᚴ ᚷᛖᛏ'); select * from t1; DROP TABLE t1;"
-
-#
-# "DESCRIBE" commands may return strange NULLness flags.
-#
---exec $MYSQL --default-character-set utf8 test -e "create table t1 (i int, j int not null, k int); insert into t1 values (null, 1, null); select * from t1; describe t1; drop table t1;"
---exec $MYSQL -t --default-character-set utf8 test -e "create table t1 (i int, j int not null, k int); insert into t1 values (null, 1, null); select * from t1; describe t1; drop table t1;"
-
-#
-# Bug#19564: mysql displays NULL instead of space
-#
---exec $MYSQL test -e "create table b19564 (i int, s1 char(1)); insert into b19564 values (1, 'x'); insert into b19564 values (2, NULL); insert into b19564 values (3, ' '); select * from b19564 order by i; drop table b19564;"
---exec $MYSQL -t test -e "create table b19564 (i int, s1 char(1)); insert into b19564 values (1, 'x'); insert into b19564 values (2, NULL); insert into b19564 values (3, ' '); select * from b19564 order by i; drop table b19564;"
-
-#
-# Bug#21618: NULL shown as empty string in client
-#
---exec $MYSQL test -e "select unhex('zz');"
---exec $MYSQL -t test -e "select unhex('zz');"
-
-# Bug#19265 describe command does not work from mysql prompt
-#
-
-create table t1(a int, b varchar(255), c int);
---exec $MYSQL test -e "desc t1"
---exec $MYSQL test -e "desc t1\g"
-drop table t1;
-
---disable_parsing
-#
-# Bug#21042 mysql client segfaults on importing a mysqldump export
-#
---error 1
---exec $MYSQL test -e "connect verylongdatabasenamethatshouldblowthe256byteslongbufferincom_connectfunctionxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxendcccccccdxxxxxxxxxxxxxxxxxkskskskskkskskskskskskskskskskkskskskskkskskskskskskskskskend" 2>&1
---enable_parsing
-
-
-#
-# Bug #20432: mysql client interprets commands in comments
-#
-
---let $file = $MYSQLTEST_VARDIR/tmp/bug20432.sql
-
-# if the client sees the 'use' within the comment, we haven't fixed
---exec echo "/*" > $file
---exec echo "use" >> $file
---exec echo "*/" >> $file
---exec $MYSQL < $file 2>&1
-
-# SQL can have embedded comments => workie
---exec echo "select /*" > $file
---exec echo "use" >> $file
---exec echo "*/ 1" >> $file
---exec $MYSQL < $file 2>&1
-
-# client commands on the other hand must be at BOL => error
---exec echo "/*" > $file
---exec echo "xxx" >> $file
---exec echo "*/ use" >> $file
---error 1
---exec $MYSQL < $file 2>&1
-
-# client comment recognized, but parameter missing => error
---exec echo "use" > $file
---exec $MYSQL < $file 2>&1
-
-# Test exceutable comments
---exec echo "SELECT 1 /*! +1 */;" > $file
---exec echo "SELECT 1 /*M! +1 */;" >> $file
---exec echo "SELECT 1 /*!00000 +1 */;" >> $file
---exec echo "SELECT 1 /*M!00000 +1 */" >> $file
---exec $MYSQL < $file 2>&1
-
---remove_file $file
-
-#
-# Bug #20328: mysql client interprets commands in comments
-#
---let $file1 = $MYSQLTEST_VARDIR/tmp/bug20328_1.result
---let $file2 = $MYSQLTEST_VARDIR/tmp/bug20328_2.result
---exec $MYSQL -e "help" > $file1
---exec $MYSQL -e "help " > $file2
---diff_files $file1 $file2
---remove_file $file1
---remove_file $file2
-
-#
-# Bug #19216: Client crashes on long SELECT
-#
-# Create large SELECT
-# - 3400 * 20 makes 68000 columns that is more than the
-# max number that can fit in a 16 bit number.
-
---perl
-open(FILE,">","$ENV{'MYSQLTEST_VARDIR'}/tmp/b19216.tmp") or die;
-print FILE "select\n";
-print FILE "'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a',\n" x 3400;
-print FILE "'b';\n";
-close FILE;
-EOF
-
---disable_query_log
---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/b19216.tmp >/dev/null
---enable_query_log
-
---remove_file $MYSQLTEST_VARDIR/tmp/b19216.tmp
-
-#
-# Bug #20103: Escaping with backslash does not work
-#
---let $file = $MYSQLTEST_VARDIR/tmp/bug20103.sql
---exec echo "SET SQL_MODE = 'NO_BACKSLASH_ESCAPES';" > $file
---exec echo "SELECT '\';" >> $file
---exec $MYSQL < $file 2>&1
-
---exec echo "SET SQL_MODE = '';" > $file
---exec echo "SELECT '\';';" >> $file
---exec $MYSQL < $file 2>&1
---remove_file $file
-
-#
-# Bug#17583: mysql drops connection when stdout is not writable
-#
-create table t17583 (a int);
-insert into t17583 (a) values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-insert into t17583 select a from t17583;
-insert into t17583 select a from t17583;
-insert into t17583 select a from t17583;
-insert into t17583 select a from t17583;
-insert into t17583 select a from t17583;
-insert into t17583 select a from t17583;
-insert into t17583 select a from t17583;
-# Close to the minimal data needed to exercise bug.
-select count(*) from t17583;
---exec echo "select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; " |$MYSQL test >&-
-drop table t17583;
-
-#
-# Bug#20984: Reproducible MySQL client segmentation fault
-# + additional tests for the "com_connect" function in mysql
-#
-#
---echo Test connect without db- or host-name => reconnect
---exec $MYSQL test -e "\r" 2>&1
---exec $MYSQL test -e "connect" 2>&1
-
---echo Test connect with dbname only => new dbname, old hostname
---exec $MYSQL test -e "\r test" 2>&1
---exec $MYSQL test -e "connect test" 2>&1
---exec $MYSQL test -e "\rtest" 2>&1
---error 1
---exec $MYSQL test -e "connecttest" 2>&1
-
---echo Test connect with _invalid_ dbname only => new invalid dbname, old hostname
---error 1
---exec $MYSQL test -e "\r invalid" 2>&1
---error 1
---exec $MYSQL test -e "connect invalid" 2>&1
-
---echo Test connect with dbname + hostname
---exec $MYSQL test -e "\r test localhost" 2>&1
---exec $MYSQL test -e "connect test localhost" 2>&1
-
---echo Test connect with dbname + _invalid_ hostname
-# Mask the errno of the error message
---replace_regex /\([0-9|-]*\)/(errno)/
---error 1
---exec $MYSQL test -e "\r test invalid_hostname" 2>&1
---replace_regex /\([0-9|-]*\)/(errno)/
---error 1
---exec $MYSQL test -e "connect test invalid_hostname" 2>&1
-
---echo The commands reported in the bug report
---replace_regex /\([0-9|-]*\)/(errno)/
---error 1
---exec $MYSQL test -e "\r\r\n\r\n cyril\ has\ found\ a\ bug\ :)XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" 2>&1
-
-#--replace_regex /\([0-9|-]*\)/(errno)/
-#--error 1
-#--exec echo '\r\r\n\r\n cyril\ has\ found\ a\ bug\ :)XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' | $MYSQL 2>&1
-
---echo Too long dbname
---error 1
---exec $MYSQL test -e "\r test_really_long_dbnamexxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx localhost" 2>&1
-
---echo Too long hostname
---replace_regex /\([0-9|-]*\)/(errno)/
---error 1
---exec $MYSQL test -e "\r test cyrils_superlonghostnameXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" 2>&1
-
-
-#
-# Bug #21412: mysql cmdline client allows backslash(es)
-# as delimiter but can't recognize them
-#
-
-# This should work just fine...
---write_file $MYSQLTEST_VARDIR/tmp/bug21412.sql
-DELIMITER /
-SELECT 1/
-EOF
---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1
-remove_file $MYSQLTEST_VARDIR/tmp/bug21412.sql;
-
-# This should give an error...
---write_file $MYSQLTEST_VARDIR/tmp/bug21412.sql
-DELIMITER \
-EOF
---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1
-remove_file $MYSQLTEST_VARDIR/tmp/bug21412.sql;
-
-# As should this...
---write_file $MYSQLTEST_VARDIR/tmp/bug21412.sql
-DELIMITER \\
-EOF
---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1
-remove_file $MYSQLTEST_VARDIR/tmp/bug21412.sql;
-
-#
-# Some coverage of not normally used parts
-#
-
---disable_query_log
---exec $MYSQL test -e "show status" 2>&1 > /dev/null
---exec $MYSQL --help 2>&1 > /dev/null
---exec $MYSQL --version 2>&1 > /dev/null
---enable_query_log
-
-#
-# bug #26851: Mysql Client --pager Buffer Overflow
-#
-
-# allow error 7(invalid argument) since --pager does not always exist in mysql
---error 0,7
---exec $MYSQL --pager="540bytelengthstringxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -e "select 1" > /dev/null 2>&1
---exec $MYSQL --character-sets-dir="540bytelengthstringxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -e "select 1" 2>&1
-
-#
-# bug #30164: Using client side macro inside server side comments generates broken queries
-#
---exec $MYSQL test -e "/*! \C latin1 */ select 1;"
-
-#
-# Bug#29323 mysql client only accetps ANSI encoded files
-#
---write_file $MYSQLTEST_VARDIR/tmp/bug29323.sql
-select "This is a file starting with UTF8 BOM 0xEFBBBF";
-EOF
---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug29323.sql 2>&1
-remove_file $MYSQLTEST_VARDIR/tmp/bug29323.sql;
-
-#
-# Bug #33812: mysql client incorrectly parsing DELIMITER
-#
-# The space and ; after delimiter are important
---exec $MYSQL -e "select 1 delimiter ;"
-
-#
-# Bug #38158: mysql client regression, can't read dump files
-#
---write_file $MYSQLTEST_VARDIR/tmp/bug38158.sql
--- Testing
---
-delimiter ||
-select 2 ||
-EOF
---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug38158.sql 2>&1
---exec $MYSQL -c < $MYSQLTEST_VARDIR/tmp/bug38158.sql 2>&1
-remove_file $MYSQLTEST_VARDIR/tmp/bug38158.sql;
-
-#
-# Bug #41437: Value stored in 'case' lacks charset, causees segfault
-#
---exec $MYSQL -e "select @z:='1',@z=database()"
-
-
-#
-# Bug #31060: MySQL CLI parser bug 2
-#
-
---write_file $MYSQLTEST_VARDIR/tmp/bug31060.sql
-;DELIMITER DELIMITER
-;
-SELECT 1DELIMITER
-DELIMITER ;
-SELECT 1;
-EOF
-
---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug31060.sql 2>&1
-
-remove_file $MYSQLTEST_VARDIR/tmp/bug31060.sql;
-
-#
-# Bug #39101: client -i (--ignore-spaces) option does not seem to work
-#
---exec $MYSQL -i -e "SELECT COUNT (*)"
---exec $MYSQL --ignore-spaces -e "SELECT COUNT (*)"
---exec $MYSQL -b -i -e "SELECT COUNT (*)"
-
-#
-# Bug#37268 'binary' character set makes CLI-internal commands case sensitive
-#
---replace_regex /\([0-9|-]*\)/(errno)/
---error 1
---exec $MYSQL --default-character-set=binary test -e "CONNECT test invalid_hostname" 2>&1
---exec $MYSQL --default-character-set=binary test -e "DELIMITER //" 2>&1
-
---echo End of 5.0 tests
-
-#
-# Bug #29903: The CMake build method does not produce the embedded library.
-#
---disable_query_log
---exec $MYSQL --server-arg=no-defaults test -e "quit"
---enable_query_log
-
-#
-# Bug#26780: patch to add auto vertical output option to the cli.
-#
-# Make this wide enough that it will wrap almost everywhere.
---exec $MYSQL test --auto-vertical-output --table -e "SELECT 1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0;"
-# Too short to wrap.
---exec $MYSQL test --auto-vertical-output --table -e "SELECT 1;"
-
-#
-# Bug #25146: Some warnings/errors not shown when using --show-warnings
-#
-
-# This one should succeed with no warnings
---exec $MYSQL --show-warnings test -e "create table t1 (id int)"
-
-# This should succeed, with warnings about conversion from nonexistent engine
---exec $MYSQL --show-warnings test -e "create table t2 (id int) engine=nonexistent"
-
-# This should fail, with warnings as well
---error 1
---exec $MYSQL --show-warnings test -e "create table t2 (id int) engine=nonexistent2"
-
-drop tables t1, t2;
-
-#
-# mysql client with 'init-command' option
-#
---exec $MYSQL --init-command="SET lc_messages=ru_RU" -e "SHOW VARIABLES LIKE 'lc_messages';"
-
-#
-# Bug #27884: mysql --html does not quote HTML special characters in output
-#
---write_file $MYSQLTEST_VARDIR/tmp/bug27884.sql
-SELECT '< & >' AS `<`;
-EOF
---exec $MYSQL --html test < $MYSQLTEST_VARDIR/tmp/bug27884.sql
-
-remove_file $MYSQLTEST_VARDIR/tmp/bug27884.sql;
-
-
-#
-# Bug #28203: mysql client + null byte
-#
-create table t1 (a char(5));
-insert into t1 values ('\0b\0');
---exec $MYSQL test -e "select a from t1"
---exec $MYSQL -r test -e "select a from t1"
---exec $MYSQL -s test -e "select a from t1"
---exec $MYSQL --table test -e "select a from t1"
---exec $MYSQL --vertical test -e "select a from t1"
---exec $MYSQL --html test -e "select a from t1"
---exec $MYSQL --xml test -e "select a from t1"
-drop table t1;
-
---echo
---echo Bug #47147: mysql client option --skip-column-names does not apply to vertical output
---echo
---exec $MYSQL --skip-column-names --vertical test -e "select 1 as a"
-
-#
-# Bug#57450: mysql client enter in an infinite loop if the standard input is a directory
-#
---error 1
---exec $MYSQL < .
-
---echo
-
---echo #
---echo # Bug #54899: --one-database option cannot handle DROP/CREATE DATABASE
---echo # commands.
---echo #
---write_file $MYSQLTEST_VARDIR/tmp/bug54899.sql
-DROP DATABASE connected_db;
-CREATE DATABASE connected_db;
-USE connected_db;
-CREATE TABLE `table_in_connected_db`(a INT);
-EOF
-
-CREATE DATABASE connected_db;
---exec $MYSQL --one-database connected_db < $MYSQLTEST_VARDIR/tmp/bug54899.sql
-USE connected_db;
-SHOW TABLES;
-DROP DATABASE connected_db;
---remove_file $MYSQLTEST_VARDIR/tmp/bug54899.sql
-
---echo
-
---echo #
---echo # Testing --one-database option
---echo #
---write_file $MYSQLTEST_VARDIR/tmp/one_db.sql
-CREATE TABLE t1 (i INT);
-CREATE TABLE test.t1 (i INT);
-USE test;
-# Following statements should be filtered.
-CREATE TABLE connected_db.t2 (i INT);
-CREATE TABLE t2 (i INT);
-EOF
-
-CREATE DATABASE connected_db;
---exec $MYSQL --one-database connected_db < $MYSQLTEST_VARDIR/tmp/one_db.sql
-SHOW TABLES IN connected_db;
-SHOW TABLES IN test;
-USE test;
-DROP TABLE t1;
-DROP DATABASE connected_db;
---remove_file $MYSQLTEST_VARDIR/tmp/one_db.sql
-
---echo
---write_file $MYSQLTEST_VARDIR/tmp/one_db.sql
-CREATE DATABASE test1;
-USE test1;
-USE test1;
-# Following statements should be filtered.
-CREATE TABLE connected_db.t1 (i INT);
-EOF
-
---exec $MYSQL --one-database test < $MYSQLTEST_VARDIR/tmp/one_db.sql
-SHOW TABLES IN test;
-SHOW TABLES IN test1;
-DROP DATABASE test1;
---remove_file $MYSQLTEST_VARDIR/tmp/one_db.sql
-
---echo
-
---echo #
---echo # Checking --one-database option followed by the execution of
---echo # connect command.
---echo #
---write_file $MYSQLTEST_VARDIR/tmp/one_db.sql
-CREATE TABLE t1 (i INT);
-CREATE TABLE test.t1 (i INT);
-CONNECT test;
-CREATE TABLE connected_db.t2 (i INT);
-CREATE TABLE t2 (i INT);
-USE connected_db;
-# Following statements should be filtered.
-CREATE TABLE connected_db.t3 (i INT);
-CREATE TABLE t3 (i INT);
-EOF
-
-CREATE DATABASE connected_db;
---exec $MYSQL --one-database connected_db < $MYSQLTEST_VARDIR/tmp/one_db.sql
-SHOW TABLES IN connected_db;
-SHOW TABLES IN test;
-DROP TABLE test.t1;
-DROP TABLE test.t2;
-DROP DATABASE connected_db;
---remove_file $MYSQLTEST_VARDIR/tmp/one_db.sql
-
---echo
-
---echo #
---echo # Checking --one-database option with no database specified
---echo # at command-line.
---echo #
---write_file $MYSQLTEST_VARDIR/tmp/one_db.sql
-# All following statements should be filtered.
-CREATE TABLE t1 (i INT);
-CREATE TABLE test.t1 (i INT);
-USE test;
-CREATE TABLE test.t2 (i INT);
-CREATE TABLE t2 (i INT);
-EOF
-
---exec $MYSQL --one-database < $MYSQLTEST_VARDIR/tmp/one_db.sql
-SHOW TABLES IN test;
---remove_file $MYSQLTEST_VARDIR/tmp/one_db.sql
-
---echo
-
---echo #
---echo # Checking --one-database option with non_existent_db
---echo # specified with USE command
---echo #
-
-# CASE 1 : When 'connected_db' database exists and passed at commandline.
---write_file $MYSQLTEST_VARDIR/tmp/one_db_1.sql
-CREATE TABLE `table_in_connected_db`(i INT);
-USE non_existent_db;
-# Following statement should be filtered out.
-CREATE TABLE `table_in_non_existent_db`(i INT);
-EOF
-
-# CASE 2 : When 'connected_db' database exists but dropped and recreated in
-# load file.
---write_file $MYSQLTEST_VARDIR/tmp/one_db_2.sql
-DROP DATABASE connected_db;
-CREATE DATABASE connected_db;
-USE non_existent_db;
-# Following statements should be filtered out.
-CREATE TABLE `table_in_non_existent_db`(i INT);
-USE connected_db;
-# Following statements should not be filtered out.
-CREATE TABLE `table_in_connected_db`(i INT);
-EOF
-
-CREATE DATABASE connected_db;
---exec $MYSQL --one-database connected_db < $MYSQLTEST_VARDIR/tmp/one_db_1.sql
-SHOW TABLES IN connected_db;
---echo
---exec $MYSQL --one-database connected_db < $MYSQLTEST_VARDIR/tmp/one_db_2.sql
-SHOW TABLES IN connected_db;
-DROP DATABASE connected_db;
-
---remove_file $MYSQLTEST_VARDIR/tmp/one_db_1.sql
---remove_file $MYSQLTEST_VARDIR/tmp/one_db_2.sql
-
-#
-# USE and names with backticks
-#
---write_file $MYSQLTEST_VARDIR/tmp/backticks.sql
-\u aa`bb``cc
-SELECT DATABASE();
-USE test
-SELECT DATABASE();
-USE aa`bb``cc
-SELECT DATABASE();
-USE test
-SELECT DATABASE();
-USE `aa``bb````cc`
-SELECT DATABASE();
-EOF
-create database `aa``bb````cc`;
---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/backticks.sql
-drop database `aa``bb````cc`;
-
-#
-# MySQL Bug#13639125 DELIMITER STRIPS THE NEXT NEW LINE IN A SQL STATEMENT
-#
---write_file $MYSQLTEST_VARDIR/tmp/13639125.sql
-select ">>
-delimiter
-<<" as a;
-EOF
---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/13639125.sql
-
-#
-# --skip-column-names and alignment
-#
---exec $MYSQL -t -N -e "SELECT 'a' union select 'aaaaaaaaaaaaaaaaa'"
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-6572 "USE dbname" with a bad sequence erroneously connects to a wrong database
---echo #
-
---echo #
---echo # End of 10.1 tests
---echo #
-
---error 1
---exec $MYSQL --default-character-set=utf8 -e "select 1" "test😁 " 2>&1
---error 1
---exec $MYSQL --default-character-set=binary -e "select 1" "test😁 " 2>&1
---write_file $MYSQLTEST_VARDIR/tmp/mdev-6572.sql
-SET NAMES utf8;
-USE test😁 ;
-EOF
---error 1
---exec $MYSQL --default-character-set=utf8 < $MYSQLTEST_VARDIR/tmp/mdev-6572.sql 2>&1
---remove_file $MYSQLTEST_VARDIR/tmp/mdev-6572.sql
-
-set GLOBAL sql_mode=default;
---echo
---echo End of tests
-
-#
-# MDEV-13187 incorrect backslash parsing in clients
-#
-create table `a1\``b1` (a int);
-show tables;
-insert `a1\``b1` values (1),(2);
-show create table `a1\``b1`;
---exec $MYSQL_DUMP --compact test
---exec $MYSQL_DUMP test > $MYSQLTEST_VARDIR/tmp/bug.sql
-insert `a1\``b1` values (4),(5);
---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug.sql
-show create table `a1\``b1`;
-select * from `a1\``b1`;
-drop table `a1\``b1`;
-
-# same with ansi_quotes
-set sql_mode=ansi_quotes;
-create table "a1\""b1" (a int);
-show tables;
-insert "a1\""b1" values (1),(2);
-show create table "a1\""b1";
---exec $MYSQL_DUMP --compact --compatible=postgres test
---exec $MYSQL_DUMP --compatible=postgres test > $MYSQLTEST_VARDIR/tmp/bug.sql
-insert "a1\""b1" values (4),(5);
---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug.sql
-show create table "a1\""b1";
-select * from "a1\""b1";
-drop table "a1\""b1";
-set sql_mode=default;
diff --git a/mysql-test/t/mysql5613mysql.test b/mysql-test/t/mysql5613mysql.test
deleted file mode 100644
index c4baf6ca166..00000000000
--- a/mysql-test/t/mysql5613mysql.test
+++ /dev/null
@@ -1,120 +0,0 @@
-let $MYSQLD_DATADIR= `select @@datadir`;
-
---echo #
---echo # MDEV-4819 Upgrade from MySQL 5.6 does not work
---echo # Testing that we can open system tables created in MySQL-5.6 (5.6.13)
---echo #
-
-
---copy_file std_data/mysql5613mysql/columns_priv.frm $MYSQLD_DATADIR/test/columns_priv.frm
---copy_file std_data/mysql5613mysql/columns_priv.MYD $MYSQLD_DATADIR/test/columns_priv.MYD
---copy_file std_data/mysql5613mysql/columns_priv.MYI $MYSQLD_DATADIR/test/columns_priv.MYI
-SHOW CREATE TABLE columns_priv;
-SELECT * FROM columns_priv LIMIT 0;
-DROP TABLE columns_priv;
-
---copy_file std_data/mysql5613mysql/db.frm $MYSQLD_DATADIR/test/db.frm
---copy_file std_data/mysql5613mysql/db.MYD $MYSQLD_DATADIR/test/db.MYD
---copy_file std_data/mysql5613mysql/db.MYI $MYSQLD_DATADIR/test/db.MYI
-SHOW CREATE TABLE db;
-SELECT * FROM db LIMIT 0;
-DROP TABLE db;
-
-
---copy_file std_data/mysql5613mysql/event.frm $MYSQLD_DATADIR/test/event.frm
---copy_file std_data/mysql5613mysql/event.MYD $MYSQLD_DATADIR/test/event.MYD
---copy_file std_data/mysql5613mysql/event.MYI $MYSQLD_DATADIR/test/event.MYI
-SHOW CREATE TABLE event;
-SELECT * FROM event LIMIT 0;
-DROP TABLE event;
-
---copy_file std_data/mysql5613mysql/func.frm $MYSQLD_DATADIR/test/func.frm
---copy_file std_data/mysql5613mysql/func.MYD $MYSQLD_DATADIR/test/func.MYD
---copy_file std_data/mysql5613mysql/func.MYI $MYSQLD_DATADIR/test/func.MYI
-SHOW CREATE TABLE func;
-SELECT * FROM func LIMIT 0;
-DROP TABLE func;
-
---copy_file std_data/mysql5613mysql/plugin.frm $MYSQLD_DATADIR/test/plugin.frm
---copy_file std_data/mysql5613mysql/plugin.MYD $MYSQLD_DATADIR/test/plugin.MYD
---copy_file std_data/mysql5613mysql/plugin.MYI $MYSQLD_DATADIR/test/plugin.MYI
-SHOW CREATE TABLE plugin;
-SELECT * FROM plugin LIMIT 0;
-DROP TABLE plugin;
-
---copy_file std_data/mysql5613mysql/proc.frm $MYSQLD_DATADIR/test/proc.frm
---copy_file std_data/mysql5613mysql/proc.MYD $MYSQLD_DATADIR/test/proc.MYD
---copy_file std_data/mysql5613mysql/proc.MYI $MYSQLD_DATADIR/test/proc.MYI
-SHOW CREATE TABLE proc;
-SELECT * FROM proc LIMIT 0;
-DROP TABLE proc;
-
---copy_file std_data/mysql5613mysql/procs_priv.frm $MYSQLD_DATADIR/test/procs_priv.frm
---copy_file std_data/mysql5613mysql/procs_priv.MYD $MYSQLD_DATADIR/test/procs_priv.MYD
---copy_file std_data/mysql5613mysql/procs_priv.MYI $MYSQLD_DATADIR/test/procs_priv.MYI
-SHOW CREATE TABLE procs_priv;
-SELECT * FROM procs_priv LIMIT 0;
-DROP TABLE procs_priv;
-
---copy_file std_data/mysql5613mysql/proxies_priv.frm $MYSQLD_DATADIR/test/proxies_priv.frm
---copy_file std_data/mysql5613mysql/proxies_priv.MYD $MYSQLD_DATADIR/test/proxies_priv.MYD
---copy_file std_data/mysql5613mysql/proxies_priv.MYI $MYSQLD_DATADIR/test/proxies_priv.MYI
-SHOW CREATE TABLE proxies_priv;
-SELECT * FROM proxies_priv LIMIT 0;
-DROP TABLE proxies_priv;
-
---copy_file std_data/mysql5613mysql/servers.frm $MYSQLD_DATADIR/test/servers.frm
---copy_file std_data/mysql5613mysql/servers.MYD $MYSQLD_DATADIR/test/servers.MYD
---copy_file std_data/mysql5613mysql/servers.MYI $MYSQLD_DATADIR/test/servers.MYI
-SHOW CREATE TABLE servers;
-SELECT * FROM servers LIMIT 0;
-DROP TABLE servers;
-
---copy_file std_data/mysql5613mysql/tables_priv.frm $MYSQLD_DATADIR/test/tables_priv.frm
---copy_file std_data/mysql5613mysql/tables_priv.MYD $MYSQLD_DATADIR/test/tables_priv.MYD
---copy_file std_data/mysql5613mysql/tables_priv.MYI $MYSQLD_DATADIR/test/tables_priv.MYI
-SHOW CREATE TABLE tables_priv;
-SELECT * FROM tables_priv LIMIT 0;
-DROP TABLE tables_priv;
-
---copy_file std_data/mysql5613mysql/time_zone_leap_second.frm $MYSQLD_DATADIR/test/time_zone_leap_second.frm
---copy_file std_data/mysql5613mysql/time_zone_leap_second.MYD $MYSQLD_DATADIR/test/time_zone_leap_second.MYD
---copy_file std_data/mysql5613mysql/time_zone_leap_second.MYI $MYSQLD_DATADIR/test/time_zone_leap_second.MYI
-SHOW CREATE TABLE time_zone_leap_second;
-SELECT * FROM time_zone_leap_second LIMIT 0;
-DROP TABLE time_zone_leap_second;
-
---copy_file std_data/mysql5613mysql/time_zone.frm $MYSQLD_DATADIR/test/time_zone.frm
---copy_file std_data/mysql5613mysql/time_zone.MYD $MYSQLD_DATADIR/test/time_zone.MYD
---copy_file std_data/mysql5613mysql/time_zone.MYI $MYSQLD_DATADIR/test/time_zone.MYI
-SHOW CREATE TABLE time_zone;
-SELECT * FROM time_zone LIMIT 0;
-DROP TABLE time_zone;
-
---copy_file std_data/mysql5613mysql/time_zone_name.frm $MYSQLD_DATADIR/test/time_zone_name.frm
---copy_file std_data/mysql5613mysql/time_zone_name.MYD $MYSQLD_DATADIR/test/time_zone_name.MYD
---copy_file std_data/mysql5613mysql/time_zone_name.MYI $MYSQLD_DATADIR/test/time_zone_name.MYI
-SHOW CREATE TABLE time_zone_name;
-SELECT * FROM time_zone_name LIMIT 0;
-DROP TABLE time_zone_name;
-
---copy_file std_data/mysql5613mysql/time_zone_transition.frm $MYSQLD_DATADIR/test/time_zone_transition.frm
---copy_file std_data/mysql5613mysql/time_zone_transition.MYD $MYSQLD_DATADIR/test/time_zone_transition.MYD
---copy_file std_data/mysql5613mysql/time_zone_transition.MYI $MYSQLD_DATADIR/test/time_zone_transition.MYI
-SHOW CREATE TABLE time_zone_transition;
-SELECT * FROM time_zone_transition LIMIT 0;
-DROP TABLE time_zone_transition;
-
---copy_file std_data/mysql5613mysql/time_zone_transition_type.frm $MYSQLD_DATADIR/test/time_zone_transition_type.frm
---copy_file std_data/mysql5613mysql/time_zone_transition_type.MYD $MYSQLD_DATADIR/test/time_zone_transition_type.MYD
---copy_file std_data/mysql5613mysql/time_zone_transition_type.MYI $MYSQLD_DATADIR/test/time_zone_transition_type.MYI
-SHOW CREATE TABLE time_zone_transition_type;
-SELECT * FROM time_zone_transition_type LIMIT 0;
-DROP TABLE time_zone_transition_type;
-
---copy_file std_data/mysql5613mysql/user.frm $MYSQLD_DATADIR/test/user.frm
---copy_file std_data/mysql5613mysql/user.MYD $MYSQLD_DATADIR/test/user.MYD
---copy_file std_data/mysql5613mysql/user.MYI $MYSQLD_DATADIR/test/user.MYI
-SHOW CREATE TABLE user;
-SELECT * FROM user LIMIT 0;
-DROP TABLE user;
diff --git a/mysql-test/t/mysql57_virtual.test b/mysql-test/t/mysql57_virtual.test
deleted file mode 100644
index 3ebdd894b79..00000000000
--- a/mysql-test/t/mysql57_virtual.test
+++ /dev/null
@@ -1,29 +0,0 @@
-let $MYSQLD_DATADIR= `select @@datadir`;
-
---echo #
---echo # Test that we can use tables created in MySQL 5.7
---echo #
-
---copy_file std_data/mysql57_virtual.frm $MYSQLD_DATADIR/test/mysql57_virtual.frm
---copy_file std_data/mysql57_virtual.MYD $MYSQLD_DATADIR/test/mysql57_virtual.MYD
---copy_file std_data/mysql57_virtual.MYI $MYSQLD_DATADIR/test/mysql57_virtual.MYI
-
-SHOW CREATE TABLE mysql57_virtual;
-insert into mysql57_virtual (a) values (1),(2);
-select * from mysql57_virtual;
-
-# We can't do online changes, as the MariaDB storage is incompatible with MySQL
---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
-alter online table mysql57_virtual comment "I am now a MariaDB table";
-
-alter table mysql57_virtual comment "I am now a MariaDB table";
-SHOW CREATE TABLE mysql57_virtual;
-DROP TABLE mysql57_virtual;
-
---echo #
---echo # Check MySQL 5.7 syntax
---echo #
-
-create table t1 (a int, b int generated always as (a+1) STORED, c int generated always as (a+2) VIRTUAL);
-show create table t1;
-drop table t1;
diff --git a/mysql-test/t/mysql_binary_mode.test b/mysql-test/t/mysql_binary_mode.test
deleted file mode 100644
index d454bfb7624..00000000000
--- a/mysql-test/t/mysql_binary_mode.test
+++ /dev/null
@@ -1,169 +0,0 @@
-source include/have_binlog_format_mixed_or_statement.inc;
-RESET MASTER;
-
---echo # Bug#33048 Not able to recover binary/blob data correctly using mysqlbinlog
---echo # --------------------------------------------------------------------------
---echo # The test verify that 0x00 and 0x0D0A sequence can be handled correctly by
---echo # mysql
---echo
-
-# zero => 0x00, newline => 0x0D0A, A => 0x41, B => 0x42
-
-# 0x410D0A42 => 'A\r\nB'
-let $table_name_right= `SELECT 0x410D0A42`;
-
-# 0x410A42 => 'A\nB'
-let $table_name_wrong= `SELECT 0x410A42`;
-
-# 0x410042 => 'A\0B'
-let $char0= `SELECT 0x410042`;
-
-eval CREATE TABLE `$table_name_right` (c1 CHAR(100));
-
---echo # It is a faked statement. ASCII 0 is in the original statement, it would
---echo # make the test result to become a binary file which was difficult to get
---echo # the diff result if the original query was logged in the result.
---echo INSERT INTO `A\r\nB` VALUES("A\0B");
---echo
---disable_query_log
-eval INSERT INTO `$table_name_right` VALUES("$char0");
---enable_query_log
-
-let $char0= $table_name_right;
-eval INSERT INTO `$table_name_right` VALUES("$char0");
-
-eval SELECT HEX(c1) FROM `$table_name_right`;
-
---echo
-let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
-FLUSH LOGS;
-eval DROP TABLE `$table_name_right`;
-
---echo
-let $MYSQLD_DATADIR= `SELECT @@datadir`;
---exec $MYSQL_BINLOG $MYSQLD_DATADIR/$binlog_file > $MYSQLTEST_VARDIR/tmp/my.sql
-RESET MASTER;
-
---echo # '--exec mysql ...' without --binary-mode option
---echo # It creates the table with a wrong table name and generates an error.
---echo # (error output was suppressed to make the test case platform agnostic)
-
-## disabling result log because the error message has the
-## table name in the output which is one byte different ('\r')
-## on unixes and windows.
---disable_result_log
---error 1
---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/my.sql 2>&1
---enable_result_log
-
---echo
---echo # It is not in binary_mode, so table name '0x410D0A42' can be translated to
---echo # '0x410A42' by mysql depending on the OS - Windows or Unix-like.
---replace_result $table_name_wrong TABLE_NAME_MASKED $table_name_right TABLE_NAME_MASKED
-if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) IN ('Win32', 'Win64', 'Windows')`)
-{
- eval DROP TABLE `$table_name_right`;
-}
-
-if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) NOT IN ('Win32', 'Win64', 'Windows')`)
-{
- eval DROP TABLE `$table_name_wrong`;
-}
-
---echo
---echo # In binary_mode, table name '0x410D0A42' and string '0x410042' can be
---echo # handled correctly.
-RESET MASTER;
---exec $MYSQL --binary-mode test < $MYSQLTEST_VARDIR/tmp/my.sql
-eval SELECT HEX(c1) FROM `$table_name_right`;
-
---echo
-eval DROP TABLE `$table_name_right`;
-
-#
-# BUG#12794048 - MAIN.MYSQL_BINARY_MODE FAILS ON WINDOWS RELEASE BUILD
-#
-RESET MASTER;
-
-#
-# This test case tests if the table names and their values
-# are handled properly. For that we check
-#
-
-# 0x610D0A62 => 'a\r\nb'
-let $tbl= `SELECT 0x610D0A62`;
-
---disable_result_log
---disable_query_log
-
---let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
-
-#### case #1: mysqltest
-#### CREATE table and insert value through regular mysqltest session
-
---eval CREATE TABLE `$tbl` (c1 CHAR(100))
---eval INSERT INTO `$tbl` VALUES ("$tbl")
-
---let $table_name=`SELECT table_name FROM information_schema.tables WHERE table_schema='test'`
---let $tbl0= `SELECT HEX(table_name) FROM information_schema.tables WHERE table_schema='test'`
---let $val0= `SELECT HEX(c1) FROM `$table_name` LIMIT 1`
-
-FLUSH LOGS;
-
---eval DROP TABLE `$table_name`;
-
-#### case #2: mysql --binlog-mode=0
-#### Replay through regular mysql client non-interactive mode
-
---let $MYSQLD_DATADIR= `SELECT @@datadir`
---let $prefix=`SELECT UUID()`
---let $binlog_uuid_filename= $MYSQLTEST_VARDIR/tmp/$prefix-bin.log
---copy_file $MYSQLD_DATADIR/$binlog_file $binlog_uuid_filename
-RESET MASTER;
-
---exec $MYSQL_BINLOG $binlog_uuid_filename | $MYSQL
-
---let $table_name=`SELECT table_name FROM information_schema.tables WHERE table_schema='test'`
---let $tbl1= `SELECT hex(table_name) FROM information_schema.tables WHERE table_schema='test'`
---let $val1= `SELECT HEX(c1) FROM `$table_name` LIMIT 1`
-
---eval DROP TABLE `$table_name`;
-
-#### case #3: mysql --binlog-mode=1
-#### Replay through regular mysql client non-interactive mode and with binary mode set
-
-RESET MASTER;
---exec $MYSQL_BINLOG $binlog_uuid_filename | $MYSQL --binary-mode
-
---let $table_name=`SELECT table_name FROM information_schema.tables WHERE table_schema='test'`
---let $tbl2= `SELECT hex(table_name) FROM information_schema.tables WHERE table_schema='test'`
---let $val2= `SELECT HEX(c1) FROM `$table_name` LIMIT 1`
-
---eval DROP TABLE `$table_name`;
-
---enable_result_log
---disable_query_log
-
-##### OUTCOME
-
---let $assert_text= Table and contents created through mysqltest match 0x610D0A62.
---let $assert_cond= "$tbl0" = "610D0A62" AND "$val0" = "610D0A62"
---source include/assert.inc
-
---let $assert_text= Table and contents created while replaying binary log without --binary-mode set match 0x61(0D)0A62.
-if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) IN ('Win32', 'Win64', 'Windows')`)
-{
- --let $assert_cond= "$tbl1" = "610D0A62" AND "$val1" = "610D0A62"
-}
-if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) NOT IN ('Win32', 'Win64', 'Windows')`)
-{
- --let $assert_cond= "$tbl1" = "610A62" AND "$val1" = "610A62"
-}
---source include/assert.inc
-
---let $assert_text= Table and contents created while replaying binary log with --binary-mode set match 0x610D0A62.
---let $assert_cond= "$tbl2" = "610D0A62" AND "$val2" = "610D0A62"
---source include/assert.inc
-
-RESET MASTER;
---remove_file $binlog_uuid_filename
diff --git a/mysql-test/t/mysql_client_test-master.opt b/mysql-test/t/mysql_client_test-master.opt
deleted file mode 100644
index 8d49abf6a10..00000000000
--- a/mysql-test/t/mysql_client_test-master.opt
+++ /dev/null
@@ -1,5 +0,0 @@
---general-log
---general-log-file=$MYSQLTEST_VARDIR/log/master.log
---log-output=FILE,TABLE
---max-allowed-packet=32000000
---proxy-protocol-networks=*
diff --git a/mysql-test/t/mysql_client_test.test b/mysql-test/t/mysql_client_test.test
deleted file mode 100644
index 260473aa0d0..00000000000
--- a/mysql-test/t/mysql_client_test.test
+++ /dev/null
@@ -1,33 +0,0 @@
-# This test should work in embedded server after we fix mysqltest
--- source include/not_embedded.inc
-# need to have the dynamic loading turned on for the client plugin tests
---source include/have_plugin_auth.inc
-
-SET @old_general_log= @@global.general_log;
-SET @old_slow_query_log= @@global.slow_query_log;
-
-call mtr.add_suppression(" Error reading file './client_test_db/test_frm_bug.frm'");
-call mtr.add_suppression(" IP address .* could not be resolved");
-
-# We run with different binaries for normal and --embedded-server
-#
-# If this test fails with "command "$MYSQL_CLIENT_TEST" failed",
-# you should either run mysql_client_test separartely against a running
-# server or run mysql-test-run --debug mysql_client_test and check
-# var/log/mysql_client_test.trace
-
---exec echo "$MYSQL_CLIENT_TEST" > $MYSQLTEST_VARDIR/log/mysql_client_test.out.log 2>&1
---exec $MYSQL_CLIENT_TEST --getopt-ll-test=25600M >> $MYSQLTEST_VARDIR/log/mysql_client_test.out.log 2>&1
-
-# End of 4.1 tests
-echo ok;
-
---echo
---echo # cat MYSQL_TMP_DIR/test_wl4435.out.log
---echo # ------------------------------------
---cat_file $MYSQL_TMP_DIR/test_wl4435.out.log
---echo # ------------------------------------
---echo
-
-SET @@global.general_log= @old_general_log;
-SET @@global.slow_query_log= @old_slow_query_log;
diff --git a/mysql-test/t/mysql_client_test_comp-master.opt b/mysql-test/t/mysql_client_test_comp-master.opt
deleted file mode 100644
index 6c4a5e4c782..00000000000
--- a/mysql-test/t/mysql_client_test_comp-master.opt
+++ /dev/null
@@ -1,3 +0,0 @@
---loose-enable-performance-schema
---max-allowed-packet=32000000
---proxy-protocol-networks=::1/32,127.0.0.0/8,localhost
diff --git a/mysql-test/t/mysql_client_test_comp.test b/mysql-test/t/mysql_client_test_comp.test
deleted file mode 100644
index 13a9d4944a4..00000000000
--- a/mysql-test/t/mysql_client_test_comp.test
+++ /dev/null
@@ -1,20 +0,0 @@
-# run mysql_client_test with performance schema
-
-# No need to run this with embedded server
--- source include/not_embedded.inc
-
-# need to have the dynamic loading turned on for the client plugin tests
---source include/have_plugin_auth.inc
-
-SET @old_slow_query_log= @@global.slow_query_log;
-
-call mtr.add_suppression(" Error reading file './client_test_db/test_frm_bug.frm'");
-call mtr.add_suppression(" IP address .* could not be resolved");
---exec echo "$MYSQL_CLIENT_TEST" > $MYSQLTEST_VARDIR/log/mysql_client_test_comp.out.log 2>&1
---exec $MYSQL_CLIENT_TEST --getopt-ll-test=25600M >> $MYSQLTEST_VARDIR/log/mysql_client_test_comp.out.log 2>&1
-
-# End of test
-echo ok;
-
-# Restore state changed by mysql_test_run
-SET @@global.slow_query_log= @old_slow_query_log;
diff --git a/mysql-test/t/mysql_client_test_nonblock-master.opt b/mysql-test/t/mysql_client_test_nonblock-master.opt
deleted file mode 100644
index a39d0089562..00000000000
--- a/mysql-test/t/mysql_client_test_nonblock-master.opt
+++ /dev/null
@@ -1,3 +0,0 @@
---general-log --general-log-file=$MYSQLTEST_VARDIR/log/master.log --log-output=FILE,TABLE
---max-allowed-packet=32000000
---proxy-protocol-networks=::1,::ffff:127.0.0.1/97,localhost
diff --git a/mysql-test/t/mysql_client_test_nonblock.test b/mysql-test/t/mysql_client_test_nonblock.test
deleted file mode 100644
index 31de14e4178..00000000000
--- a/mysql-test/t/mysql_client_test_nonblock.test
+++ /dev/null
@@ -1,25 +0,0 @@
-# This runs the mysql_client_test using the non-blocking API.
-
-# The non-blocking API is not supported in the embedded server.
--- source include/not_embedded.inc
-
-SET @old_general_log= @@global.general_log;
-SET @old_slow_query_log= @@global.slow_query_log;
-call mtr.add_suppression(" Error reading file './client_test_db/test_frm_bug.frm'");
-call mtr.add_suppression(" IP address .* could not be resolved");
-
-# We run with different binaries for normal and --embedded-server
-#
-# If this test fails with "command "$MYSQL_CLIENT_TEST" failed",
-# you should either run mysql_client_test separartely against a running
-# server or run mysql-test-run --debug mysql_client_test and check
-# var/log/mysql_client_test.trace
-
---exec echo "$MYSQL_CLIENT_TEST --non-blocking-api" > $MYSQLTEST_VARDIR/log/mysql_client_test.out.log 2>&1
---exec $MYSQL_CLIENT_TEST --non-blocking-api --getopt-ll-test=25600M >> $MYSQLTEST_VARDIR/log/mysql_client_test.out.log 2>&1
-
-# End of 4.1 tests
-echo ok;
-
-SET @@global.general_log= @old_general_log;
-SET @@global.slow_query_log= @old_slow_query_log;
diff --git a/mysql-test/t/mysql_comments.sql b/mysql-test/t/mysql_comments.sql
deleted file mode 100644
index 2497c35e465..00000000000
--- a/mysql-test/t/mysql_comments.sql
+++ /dev/null
@@ -1,218 +0,0 @@
-##============================================================================
-## Notes
-##============================================================================
-
-# Test case for Bug#11230
-
-# The point of this test is to make sure that '#', '-- ' and '/* ... */'
-# comments, as well as empty lines, are sent from the client to the server.
-# This is to ensure better error reporting, and to keep comments in the code
-# for stored procedures / functions / triggers (Bug#11230).
-# As a result, be careful when editing comments in this script, they do
-# matter.
-#
-# Also, note that this is a script for **mysql**, not mysqltest.
-# This is critical, as the mysqltest client interprets comments differently.
-
-##============================================================================
-## Setup
-##============================================================================
-
-## See mysql_comments.test for initial cleanup
-
-# Test tables
-#
-# t1 is reused throughout the file, and dropped at the end.
-#
-drop table if exists t1;
-create table t1 (
- id char(16) not null default '',
- data int not null
-);
-
-##============================================================================
-## Comments outside statements
-##============================================================================
-
-# Ignored 1a
--- Ignored 1b
-/*
- Ignored 1c
-*/
-
-select 1;
-
-##============================================================================
-## Comments inside statements
-##============================================================================
-
-select # comment 1a
-# comment 2a
--- comment 2b
-/*
- comment 2c
-*/
-2
-; # not strictly inside, but on same line
-# ignored
-
-##============================================================================
-## Comments inside functions
-##============================================================================
-
-drop function if exists foofct ;
-
-create function foofct (x char(20))
-returns char(20)
-/* not inside the body yet */
-return
--- comment 1a
-# comment 1b
-/* comment 1c */
-x; # after body, on same line
-
-select foofct("call 1");
-
-show create function foofct;
-drop function foofct;
-
-delimiter |
-
-create function foofct(x char(20))
-returns char(20)
-begin
- -- comment 1a
- # comment 1b
- /*
- comment 1c
- */
-
- -- empty line below
-
- -- empty line above
- return x;
-end|
-
-delimiter ;
-
-select foofct("call 2");
-
-show create function foofct;
-drop function foofct;
-
-##============================================================================
-## Comments inside stored procedures
-##============================================================================
-
-# Empty statement
-drop procedure if exists empty;
-create procedure empty()
-begin
-end;
-
-call empty();
-show create procedure empty;
-drop procedure empty;
-
-drop procedure if exists foosp;
-
-## These comments are before the create, and will be lost
-# Comment 1a
--- Comment 1b
-/*
- Comment 1c
- */
-create procedure foosp()
-/* Comment not quiet in the body yet */
- insert into test.t1
-## These comments are part of the procedure body, and should be kept.
-# Comment 2a
--- Comment 2b
-/* Comment 2c */
- -- empty line below
-
- -- empty line above
- values ("foo", 42); # comment 3, still part of the body
-## After the ';', therefore not part of the body
-# comment 4a
--- Comment 4b
-/*
- Comment 4c
- */
-
-call foosp();
-select * from t1;
-delete from t1;
-show create procedure foosp;
-drop procedure foosp;
-
-drop procedure if exists nicesp;
-
-delimiter |
-
-create procedure nicesp(a int)
-begin
- -- declare some variables here
- declare b int;
- declare c float;
-
- -- do more stuff here
- -- commented nicely and so on
-
- -- famous last words ...
-end|
-
-delimiter ;
-
-show create procedure nicesp;
-drop procedure nicesp;
-
-##============================================================================
-## Comments inside triggers
-##============================================================================
-
-drop trigger if exists t1_empty;
-
-create trigger t1_empty after delete on t1
-for each row
-begin
-end;
-
-show create trigger t1_empty;
-
-drop trigger if exists t1_bi;
-
-delimiter |
-
-create trigger t1_bi before insert on t1
-for each row
-begin
-# comment 1a
--- comment 1b
-/*
- comment 1c
-*/
- -- declare some variables here
- declare b int;
- declare c float;
-
- -- do more stuff here
- -- commented nicely and so on
-
- -- famous last words ...
- set NEW.data := 12;
-end|
-
-delimiter ;
-
-show create trigger t1_bi;
-
-# also make sure the trigger still works
-insert into t1(id) value ("trig");
-select * from t1;
-
-##============================================================================
-## Cleanup
-##============================================================================
-
-drop table t1;
diff --git a/mysql-test/t/mysql_comments.test b/mysql-test/t/mysql_comments.test
deleted file mode 100644
index fb0e5f94950..00000000000
--- a/mysql-test/t/mysql_comments.test
+++ /dev/null
@@ -1,43 +0,0 @@
-# This test should work in embedded server after we fix mysqltest
--- source include/not_embedded.inc
-###################### mysql_comments.test #############################
-# #
-# Testing of comments handling by the command line client (mysql) #
-# #
-# Creation: #
-# 2007-10-29 akopytov Implemented this test as a part of fixes for #
-# bug #26215 and bug #11230 #
-# #
-########################################################################
-
-set global sql_mode="";
-
-#
-# Bug #11230: Keeping comments when storing stored procedures
-#
-
-# See the content of mysql_comments.sql
-# Set the test database to a known state before running the tests.
---disable_warnings
-drop table if exists t1;
-drop function if exists foofct;
-drop procedure if exists empty;
-drop procedure if exists foosp;
-drop procedure if exists nicesp;
-drop trigger if exists t1_empty;
-drop trigger if exists t1_bi;
---enable_warnings
-
-# Test without comments
---echo "Pass 1 : --disable-comments"
---replace_regex /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.[0-9]{2})*/--TIME--/
---exec $MYSQL --disable-comments test 2>&1 < "./t/mysql_comments.sql"
-
-# Test with comments
---echo "Pass 2 : --enable-comments"
---replace_regex /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.[0-9]{2})*/--TIME--/
---exec $MYSQL --enable-comments test 2>&1 < "./t/mysql_comments.sql"
-
-
-set global sql_mode=default;
---echo End of 5.0 tests
diff --git a/mysql-test/t/mysql_cp932.test b/mysql-test/t/mysql_cp932.test
deleted file mode 100644
index 60a129c3805..00000000000
--- a/mysql-test/t/mysql_cp932.test
+++ /dev/null
@@ -1,22 +0,0 @@
-# This test should work in embedded server after we fix mysqltest
--- source include/not_embedded.inc
-
-#
-# Tests from mysql.test which require the cp932 character set
-#
--- source include/have_cp932.inc
-
-#
-# BUG#16217 - MySQL client misinterprets multi-byte char as escape `\'
-#
-
-# new command \C or charset
---exec $MYSQL --default-character-set=utf8 test -e "\C cp932 \g"
---exec $MYSQL --default-character-set=cp932 test -e "charset utf8;"
-
-# its usage to switch internally in mysql to requested charset
---exec $MYSQL --default-character-set=utf8 test -e "charset cp932; select '\'; create table t1 (c_cp932 TEXT CHARACTER SET cp932); insert into t1 values('\'); select * from t1; drop table t1;"
---exec $MYSQL --default-character-set=utf8 test -e "charset cp932; select '\'"
---exec $MYSQL --default-character-set=utf8 test -e "/*charset cp932 */; set character_set_client= cp932; select '\'"
---exec $MYSQL --default-character-set=utf8 test -e "/*!\C cp932 */; set character_set_client= cp932; select '\'"
-
diff --git a/mysql-test/t/mysql_delimiter.sql b/mysql-test/t/mysql_delimiter.sql
deleted file mode 100644
index 533ac2ce093..00000000000
--- a/mysql-test/t/mysql_delimiter.sql
+++ /dev/null
@@ -1,68 +0,0 @@
-
-# Test default delimiter ;
-select "Test default delimiter ;" as " ";
-select * from t1;
-
-# Test delimiter without argument
-select "Test delimiter without arg" as " ";
-# Nothing should be displayed, error is returned
-delimiter
-delimiter ; # Reset delimiter
-
-# Test delimiter :
-select "Test delimiter :" as " ";
-delimiter :
-select * from t1:
-delimiter ; # Reset delimiter
-
-# Test delimiter ':'
-select "Test delimiter :" as " ";
-delimiter ':'
-select * from t1:
-delimiter ; # Reset delimiter
-
-# Test delimiter :;
-select "Test delimiter :;" as " ";
-delimiter :;
-select * from t1 :;
-delimiter ; # Reset delimiter
-
-## Test delimiter //
-select "Test delimiter //" as " ";
-delimiter //
-select * from t1//
-delimiter ; # Reset delimiter
-
-# Test delimiter 'MySQL'
-select "Test delimiter MySQL" as " ";
-delimiter 'MySQL'
-select * from t1MySQL
-delimiter ; # Reset delimiter
-
-# Test delimiter 'delimiter'(should be allowed according to the code)
-select "Test delimiter delimiter" as " ";
-delimiter delimiter
-select * from t1 delimiter
-delimiter ; # Reset delimiter
-
-#
-# Bug #11523: \d works differently than delimiter
-#
-source t/mysql_delimiter_source.sql
-delimiter ; # Reset delimiter
-
-#
-# Bug #19799: delimiter command not working correctly when sourcing a sql file
-# with Windows style line endings.
-#
-source t/mysql_delimiter_19799.sql
-use test//
-show tables//
-delimiter ; # Reset delimiter
-
-#
-# Bug #36244: MySQL CLI doesn't recognize standalone -- as comment
-# before DELIMITER statement
-#
---
-DELIMITER ;
diff --git a/mysql-test/t/mysql_delimiter_19799.sql b/mysql-test/t/mysql_delimiter_19799.sql
deleted file mode 100644
index 2a3d4378492..00000000000
--- a/mysql-test/t/mysql_delimiter_19799.sql
+++ /dev/null
@@ -1 +0,0 @@
-delimiter //
diff --git a/mysql-test/t/mysql_delimiter_source.sql b/mysql-test/t/mysql_delimiter_source.sql
deleted file mode 100644
index f645091f3d4..00000000000
--- a/mysql-test/t/mysql_delimiter_source.sql
+++ /dev/null
@@ -1,8 +0,0 @@
-delimiter //
-create table t2 (a int) //
-delimiter ;
-\d //
-create table t3 (a int) //
-\d ;
-show tables;
-drop table t2, t3;
diff --git a/mysql-test/t/mysql_embedded.test b/mysql-test/t/mysql_embedded.test
deleted file mode 100644
index 30959b83017..00000000000
--- a/mysql-test/t/mysql_embedded.test
+++ /dev/null
@@ -1,12 +0,0 @@
---echo #
---echo # Bug#12561297 : LIBMYSQLD/EXAMPLE/MYSQL_EMBEDDED IS ABORTING.
---echo #
-
---source include/is_embedded.inc
-
-# Test case require mysql_embedded to be present
-if(!$MYSQL_EMBEDDED)
-{
- --skip Test requires mysql_embedded executable
-}
---exec $MYSQL_EMBEDDED -e 'select 1'
diff --git a/mysql-test/t/mysql_locale_posix.test b/mysql-test/t/mysql_locale_posix.test
deleted file mode 100644
index c047b7b1ae9..00000000000
--- a/mysql-test/t/mysql_locale_posix.test
+++ /dev/null
@@ -1,205 +0,0 @@
---source include/not_windows.inc
---source include/have_case_sensitive_file_system.inc
-
-
-#
-# Note, please keep this file UTF-8 compatible.
-# After editing, make sure that
-# "file mysql_locale_posix.test"
-# says
-# "UTF-8 Unicode text"
-# or
-# "UTF-8 Unicode English text"
-#
-
-
-#
-# Check if we're running on a POSIX-locale machine
-#
-
---disable_query_log
---exec locale -a > $MYSQLTEST_VARDIR/tmp/locale_a.output 2>/dev/null || true
-SET @file=REPLACE(LOAD_FILE('../../tmp/locale_a.output'), '-', '');
-#
-# Note, file content must be case sensitive.
-# Some platforms are case sensitive regarding to locale name.
-# For example, on HP-UX
-# LANG=cs_CZ.iso88592 - works fine
-# LANG=cs_CZ.ISO88592 - does not work
-#
---remove_file $MYSQLTEST_VARDIR/tmp/locale_a.output
-
-if (`SELECT (IFNULL(@file,'') NOT LIKE '%\nde_DE.iso88591\n%')`)
-{
- Skip Need POSIX locale de_DE.iso88591;
-}
-
-if (`SELECT (IFNULL(@file,'') NOT LIKE '%\nru_RU.koi8r\n%')`)
-{
- Skip Need POSIX locale ru_RU.koi8r;
-}
-
-if (`SELECT (IFNULL(@file,'') NOT LIKE '%\ncs_CZ.iso88592\n%')`)
-{
- Skip Need POSIX locale cs_CZ.iso88592;
-}
-
-if (`SELECT (IFNULL(@file,'') NOT LIKE '%\nen_US.utf8\n%')`)
-{
- Skip Need POSIX locale en_US.utf8;
-}
---enable_query_log
-
-
-
-SET NAMES utf8;
-
---disable_warnings
-DROP DATABASE IF EXISTS `ó`;
-DROP DATABASE IF EXISTS `Ăł`;
-DROP DATABASE IF EXISTS `цЁ`;
-DROP DATABASE IF EXISTS `ó`;
---enable_warnings
-
-#
-# Test some of the OS-to-MySQL character set mappings
-#
-
-
-# {"ANSI_X3.4-1968", "ascii", my_cs_exact},
-# {"ansi1251", "cp1251", my_cs_exact},
-# {"armscii8", "armscii8", my_cs_exact},
-# {"ASCII", "ascii", my_cs_exact},
-# {"Big5", "big5", my_cs_exact},
-# {"cp1251", "cp1251", my_cs_exact},
-# {"cp1255", "cp1255", my_cs_exact},
-# {"CP866", "cp866", my_cs_exact},
-# {"eucCN", "gb2312", my_cs_exact},
-# {"eucJP", "ujis", my_cs_exact},
-# {"eucKR", "euckr", my_cs_exact},
-#
-# {"gb18030", "gb18030", my_cs_exact},
-#
-# {"gb2312", "gb2312", my_cs_exact},
-# {"gbk", "gbk", my_cs_exact},
-# {"georgianps", "geostd8", my_cs_exact},
-# {"IBM-1252", "cp1252", my_cs_exact},
-#
-# {"iso88591", "latin1", my_cs_approx},
-# {"ISO_8859-1", "latin1", my_cs_approx},
-# {"ISO8859-1", "latin1", my_cs_approx},
-# {"ISO-8859-1", "latin1", my_cs_approx},
-
-
-#
-# _utf8 0xC3B3 = LATIN SMALL LETTER O WITH ACUTE
-# _latin1 0xC3 = LATIN CAPITAL LETTER A WITH TILDE
-# _latin1 0xB3 = SUPERSCRIPT THREE
-#
---echo
---echo iso88591
---exec LC_ALL=fi_FI.iso88591 $MYSQL --default-character-set=auto test -e "SELECT @@character_set_client"
---exec LC_ALL=fi_FI.iso88591 $MYSQLADMIN -uroot -S $MASTER_MYSOCK -P $MASTER_MYPORT --default-character-set=auto create ó
---exec LC_ALL=fi_FI.iso88591 $MYSQL_SHOW --default-character-set=auto ó
---exec LC_ALL=fi_FI.iso88591 $MYSQL_CHECK --default-character-set=auto "ó"
-
-
-# {"iso885913", "latin7", my_cs_exact},
-# {"ISO_8859-13", "latin7", my_cs_exact},
-# {"ISO8859-13", "latin7", my_cs_exact},
-# {"ISO-8859-13", "latin7", my_cs_exact},
-#
-# {"iso885915", "latin9", my_cs_exact},
-# {"ISO_8859-15", "latin9", my_cs_exact},
-# {"ISO8859-15", "latin9", my_cs_exact},
-# {"ISO-8859-15", "latin9", my_cs_exact},
-#
-# {"iso88592", "latin2", my_cs_exact},
-# {"ISO_8859-2", "latin2", my_cs_exact},
-# {"ISO8859-2", "latin2", my_cs_exact},
-# {"ISO-8859-2", "latin2", my_cs_exact},
-#
-
-
-#
-# _utf8 0xC3B3 = LATIN SMALL LETTER O WITH ACUTE
-# _latin2 0xC3 = LATIN CAPITAL LETTER A WITH BREVE
-# _latin2 0xB3 = LATIN SMALL LETTER L WITH STROKE
-#
---echo
---echo iso88592
---exec LC_ALL=cs_CZ.iso88592 $MYSQL --character-sets-dir=$MYSQL_SHAREDIR/charsets --default-character-set=auto test -e "SELECT @@character_set_client"
---exec LC_ALL=cs_CZ.iso88592 $MYSQLADMIN --character-sets-dir=$MYSQL_SHAREDIR/charsets -uroot -S $MASTER_MYSOCK -P $MASTER_MYPORT --default-character-set=auto create ó
---exec LC_ALL=cs_CZ.iso88592 $MYSQL_SHOW --character-sets-dir=$MYSQL_SHAREDIR/charsets --default-character-set=auto ó
---exec LC_ALL=cs_CZ.iso88592 $MYSQL_CHECK --character-sets-dir=$MYSQL_SHAREDIR/charsets--default-character-set=auto "ó"
-
-
-# {"iso88597", "greek", my_cs_exact},
-# {"ISO_8859-7", "greek", my_cs_exact},
-# {"ISO8859-7", "greek", my_cs_exact},
-# {"ISO-8859-7", "greek", my_cs_exact},
-#
-# {"iso88598", "hebrew", my_cs_exact},
-# {"ISO_8859-8", "hebrew", my_cs_exact},
-# {"ISO8859-8", "hebrew", my_cs_exact},
-# {"ISO-8859-8", "hebrew", my_cs_exact},
-#
-# {"iso88599", "latin5", my_cs_exact},
-# {"ISO_8859-9", "latin5", my_cs_exact},
-# {"ISO8859-9", "latin5", my_cs_exact},
-# {"ISO-8859-9", "latin5", my_cs_exact},
-#
-# {"koi8r", "koi8r", my_cs_exact},
-# {"KOI8-R", "koi8r", my_cs_exact},
-# {"koi8u", "koi8u", my_cs_exact},
-# {"KOI8-U", "koi8u", my_cs_exact},
-#
-
-#
-# _utf8 0xC3B3 = LATIN SMALL LETTER O WITH ACUTE
-# _koi8r 0xC3 = CYRILLIC SMALL LETTER TSE
-# _koi8r 0xB3 = CYRILLIC CAPITAL LETTER IO
-#
-
---echo
---echo koi8r
---exec LC_ALL=ru_RU.koi8r $MYSQL --character-sets-dir=$MYSQL_SHAREDIR/charsets --default-character-set=auto test -e "SELECT @@character_set_client"
---exec LC_ALL=ru_RU.koi8r $MYSQLADMIN --character-sets-dir=$MYSQL_SHAREDIR/charsets -uroot -S $MASTER_MYSOCK -P $MASTER_MYPORT --default-character-set=auto create ó
---exec LC_ALL=ru_RU.koi8r $MYSQL_SHOW --character-sets-dir=$MYSQL_SHAREDIR/charsets --default-character-set=auto ó
---exec LC_ALL=ru_RU.koi8r $MYSQL_CHECK --character-sets-dir=$MYSQL_SHAREDIR/charsets --default-character-set=auto "ó"
-
-
-# {"Shift_JIS", "sjis", my_cs_exact},
-# {"SJIS", "sjis", my_cs_exact},
-#
-# {"tis620", "tis620", my_cs_exact},
-#
-# {"ujis", "ujis", my_cs_exact},
-#
-# {"US-ASCII", "ascii", my_cs_exact},
-#
-# {"utf8", "utf8", my_cs_exact},
-# {"utf-8", "utf8", my_cs_exact},
-
---echo
---echo utf8
---exec LC_ALL=en_US.utf8 $MYSQL --default-character-set=auto test -e "SELECT @@character_set_client"
---exec LC_ALL=en_US.utf8 $MYSQLADMIN -uroot -S $MASTER_MYSOCK -P $MASTER_MYPORT --default-character-set=auto create ó
---exec LC_ALL=en_US.utf8 $MYSQL_SHOW --default-character-set=auto ó
---exec LC_ALL=en_US.utf8 $MYSQL_SHOW --default-character-set=auto "ó"
---exec LC_ALL=en_US.utf8 $MYSQL_SHOW --default-character-set=auto "Ăł"
---exec LC_ALL=en_US.utf8 $MYSQL_SHOW --default-character-set=auto "цЁ"
---exec LC_ALL=en_US.utf8 $MYSQL_CHECK --default-character-set=auto ó
---exec LC_ALL=en_US.utf8 $MYSQL_CHECK --default-character-set=auto "ó"
---exec LC_ALL=en_US.utf8 $MYSQL_CHECK --default-character-set=auto "Ăł"
---exec LC_ALL=en_US.utf8 $MYSQL_CHECK --default-character-set=auto "цЁ"
-
-SHOW DATABASES LIKE 'ó';
-SHOW DATABASES LIKE 'Ăł';
-SHOW DATABASES LIKE 'цЁ';
-SHOW DATABASES LIKE 'ó';
-
-DROP DATABASE `ó`;
-DROP DATABASE `Ăł`;
-DROP DATABASE `цЁ`;
-DROP DATABASE `ó`;
diff --git a/mysql-test/t/mysql_not_windows.test b/mysql-test/t/mysql_not_windows.test
deleted file mode 100644
index 591de74cbbf..00000000000
--- a/mysql-test/t/mysql_not_windows.test
+++ /dev/null
@@ -1,24 +0,0 @@
--- source include/not_windows.inc
-# This test should work in embedded server after we fix mysqltest
--- source include/not_embedded.inc
-#
-# Testing the MySQL command line client(mysql)
-#
-
-#
-# Bug #54466 client 5.5 built from source lacks "pager" support
-#
---echo Bug #54466 client 5.5 built from source lacks "pager" support
---exec $MYSQL --pager test -e "select 1 as a"
-
---echo
---echo End of tests
-
-# Multi-line exec
-exec $MYSQL \
- test -e "select 1";
-exec $MYSQL test -e "select
- 2";
-let $query = select 3
- as X;
-exec $MYSQL test -e "$query";
diff --git a/mysql-test/t/mysql_protocols.test b/mysql-test/t/mysql_protocols.test
deleted file mode 100644
index 5eba780420c..00000000000
--- a/mysql-test/t/mysql_protocols.test
+++ /dev/null
@@ -1,15 +0,0 @@
-# Embedded server doesn't support external clients
---source include/not_embedded.inc
-# Windows does not have SOCKET, but will try to create a PIPE as well as MEMORY
---source include/not_windows.inc
-
-# test for Bug #4998 "--protocol doesn't reject bad values"
-
---exec echo "select ' ok' as '<default>'" | $MYSQL
---exec echo "select ' ok' as 'TCP'" | $MYSQL --protocol=TCP
---exec echo "select ' ok' as 'SOCKET'" | $MYSQL --protocol=SOCKET
---exec echo "select ' ok' as 'PIPE'" | $MYSQL --protocol=PIPE 2>&1 || true
---exec echo "select ' ok' as 'MEMORY'" | $MYSQL --protocol=MEMORY 2>&1 || true
---exec echo "select ' ok' as 'NullS'" | $MYSQL --protocol=NullS 2>&1 || true
-
-# End of 4.1 tests
diff --git a/mysql-test/t/mysql_tzinfo_to_sql_symlink.test b/mysql-test/t/mysql_tzinfo_to_sql_symlink.test
deleted file mode 100644
index 8ca82b87e30..00000000000
--- a/mysql-test/t/mysql_tzinfo_to_sql_symlink.test
+++ /dev/null
@@ -1,50 +0,0 @@
---source include/have_symlink.inc
---source include/not_windows.inc
-
---echo #
---echo # MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above
---echo #
-
---exec mkdir $MYSQLTEST_VARDIR/zoneinfo
---exec ln -s $MYSQLTEST_VARDIR/zoneinfo $MYSQLTEST_VARDIR/zoneinfo/posix
---copy_file std_data/zoneinfo/GMT $MYSQLTEST_VARDIR/zoneinfo/GMT
---copy_file std_data/words.dat $MYSQLTEST_VARDIR/zoneinfo/garbage
---copy_file std_data/words.dat $MYSQLTEST_VARDIR/zoneinfo/ignored.tab
-
---echo # Verbose run
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $MYSQL_TZINFO_TO_SQL --verbose $MYSQLTEST_VARDIR/zoneinfo 2>&1
-
---echo # Silent run
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo 2>&1
-
---echo #
---echo # Testing with explicit timezonefile
---echo #
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo/GMT XXX 2>&1
-
---echo #
---echo # Testing --leap
---echo #
-
---exec $MYSQL_TZINFO_TO_SQL --leap $MYSQLTEST_VARDIR/zoneinfo/GMT 2>&1
-
-#
-# Cleanup
-#
-
---exec rm -rf $MYSQLTEST_VARDIR/zoneinfo
-
---echo #
---echo # MDEV-6236 - [PATCH] mysql_tzinfo_to_sql may produce invalid SQL
---echo #
---exec mkdir $MYSQLTEST_VARDIR/zoneinfo
---copy_file std_data/zoneinfo/GMT $MYSQLTEST_VARDIR/zoneinfo/Factory
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo 2>&1
-
---exec rm -rf $MYSQLTEST_VARDIR/zoneinfo
diff --git a/mysql-test/t/mysql_upgrade-6984.opt b/mysql-test/t/mysql_upgrade-6984.opt
deleted file mode 100644
index 97669d95260..00000000000
--- a/mysql-test/t/mysql_upgrade-6984.opt
+++ /dev/null
@@ -1 +0,0 @@
---skip-grant-tables --group-concat-max-len=1023
diff --git a/mysql-test/t/mysql_upgrade-6984.test b/mysql-test/t/mysql_upgrade-6984.test
deleted file mode 100644
index 9bbfbeb3f87..00000000000
--- a/mysql-test/t/mysql_upgrade-6984.test
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# MDEV-6984 Can't migrate from MySQL 5.6.21 to MariaDB 10
-#
---source include/not_embedded.inc
-
-#
-# When 'root' account is password protected and MYSQL_UPGRADE doesn't
-# know the password (meaning, MYSQL_UPGRADE is run automatically
-# on upgrade), MYSQLD has to be started with --skip-grant-tables.
-#
-# In this setup MYSQL_UPGRADE cannot continue after issuing FLUSH PRIVILEGES
-#
-
-update mysql.user set password=password("foo") where user='root';
-
---exec $MYSQL_UPGRADE
-
-connect(con1,localhost,root,foo,,,);
-
-update mysql.user set password='' where user='root';
-flush privileges;
-# Load event table
-set global event_scheduler=OFF;
diff --git a/mysql-test/t/mysql_upgrade.test b/mysql-test/t/mysql_upgrade.test
deleted file mode 100644
index 0171fe6c7ba..00000000000
--- a/mysql-test/t/mysql_upgrade.test
+++ /dev/null
@@ -1,243 +0,0 @@
--- source include/mysql_upgrade_preparation.inc
--- source include/have_working_dns.inc
--- source include/have_innodb.inc
--- source include/have_partition.inc
-
-set sql_mode="";
-
-#
-# Basic test that we can run mysql_upgrde and that it finds the
-# expected binaries it uses.
-#
---echo Run mysql_upgrade once
---exec $MYSQL_UPGRADE --force 2>&1
-
-# It should have created a file in the MySQL Servers datadir
-let $MYSQLD_DATADIR= `select @@datadir`;
-file_exists $MYSQLD_DATADIR/mysql_upgrade_info;
-
---echo Run it again - should say already completed
---replace_result $MYSQL_SERVER_VERSION VERSION
---exec $MYSQL_UPGRADE 2>&1
-
-# It should have created a file in the MySQL Servers datadir
-file_exists $MYSQLD_DATADIR/mysql_upgrade_info;
-
---echo Force should run it regardless of whether it has been run before
---exec $MYSQL_UPGRADE --force 2>&1
-
-# It should have created a file in the MySQL Servers datadir
-file_exists $MYSQLD_DATADIR/mysql_upgrade_info;
-
-
-#
-# Bug #25452 mysql_upgrade access denied.
-#
-
-# Password protect a root account and run mysql_upgrade
-
-CREATE USER mysqltest1@'%' IDENTIFIED by 'sakila';
-GRANT ALL ON *.* TO mysqltest1@'%';
---echo Run mysql_upgrade with password protected account
---exec $MYSQL_UPGRADE --force --user=mysqltest1 --password=sakila 2>&1
-
-DROP USER mysqltest1@'%';
-
-#
-# check that we get proper error messages if wrong user
-
---error 1
---exec $MYSQL_UPGRADE --force --user=mysqltest1 --password=sakila 2>&1
-
-#
-# Bug #26639 mysql_upgrade exits successfully even if external command failed
-#
-
---echo Run mysql_upgrade with a non existing server socket
---replace_result $MYSQLTEST_VARDIR var
---replace_regex /.*mysqlcheck.*: Got/mysqlcheck: Got/ /\([0-9|-]*\)/(errno)/
---error 1
-# NC: Added --skip-version-check, as the version check would fail when
-# mysql_upgrade tries to get the server version.
---exec $MYSQL_UPGRADE --verbose --force --host=not_existing_host --skip-version-check 2>&1
-
-#
-# Bug #28401 mysql_upgrade Failed with STRICT_ALL_TABLES, ANSI_QUOTES and NO_ZERO_DATE
-#
-
-# The SQL commands used by mysql_upgrade are written to be run
-# with sql_mode set to '' - thus the scripts should change sql_mode
-# for the session to make sure the SQL is legal.
-
-# Test by setting sql_mode before running mysql_upgrade
-set GLOBAL sql_mode='STRICT_ALL_TABLES,ANSI_QUOTES,NO_ZERO_DATE';
---exec $MYSQL_UPGRADE --force 2>&1
-eval set GLOBAL sql_mode=default;
-
---echo #
---echo # Bug #41569 mysql_upgrade (ver 5.1) add 3 fields to mysql.proc table
---echo # but does not set values.
---echo #
-
-# Create a stored procedure and set the fields in question to null.
-# When running mysql_upgrade, a warning should be written.
-
-CREATE PROCEDURE testproc() BEGIN END;
-UPDATE mysql.proc SET character_set_client = NULL WHERE name LIKE 'testproc';
-UPDATE mysql.proc SET collation_connection = NULL WHERE name LIKE 'testproc';
-UPDATE mysql.proc SET db_collation = NULL WHERE name LIKE 'testproc';
---exec $MYSQL_UPGRADE --force 2> $MYSQLTEST_VARDIR/tmp/41569.txt
-CALL testproc();
-DROP PROCEDURE testproc;
---cat_file $MYSQLTEST_VARDIR/tmp/41569.txt
---remove_file $MYSQLTEST_VARDIR/tmp/41569.txt
-
-
---echo #
---echo # Bug #53613: mysql_upgrade incorrectly revokes
---echo # TRIGGER privilege on given table
---echo #
-
-GRANT USAGE ON *.* TO 'user3'@'%';
-GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%';
---echo Run mysql_upgrade with all privileges on a user
---exec $MYSQL_UPGRADE --force 2>&1
-SHOW GRANTS FOR 'user3'@'%';
-
-DROP USER 'user3'@'%';
-
---echo End of 5.1 tests
-
-
-#
-# Test the --upgrade-system-tables option
-#
---replace_result $MYSQLTEST_VARDIR var
---exec $MYSQL_UPGRADE --force --upgrade-system-tables
-
---echo #
---echo # Bug#11827359 60223: MYSQL_UPGRADE PROBLEM WITH OPTION
---echo # SKIP-WRITE-BINLOG
---echo #
-
-let $MYSQLD_DATADIR= `select @@datadir`;
-
---echo # Droping the previously created mysql_upgrade_info file..
---remove_file $MYSQLD_DATADIR/mysql_upgrade_info
-
---echo # Running mysql_upgrade with --skip-write-binlog..
---replace_result $MYSQLTEST_VARDIR var
---exec $MYSQL_UPGRADE --skip-write-binlog
-
-# mysql_upgrade must have created mysql_upgrade_info file,
-# so the following command should never fail.
---remove_file $MYSQLD_DATADIR/mysql_upgrade_info
-
---echo #
---echo # Bug #21489398: MYSQL_UPGRADE: FATAL ERROR: UPGRADE FAILED - IMPROVE ERROR
---echo #
-
---echo Run mysql_upgrade with unauthorized access
---error 1
---exec $MYSQL_UPGRADE --skip-verbose --user=root --password=wrong_password 2>&1
-
---echo #
---echo # MDEV-4332 Increase username length from 16 characters
---echo # MDEV-6068, MDEV-6178 mysql_upgrade breaks databases with long user names
---echo #
-
-connection default;
-GRANT SELECT ON mysql.* TO very_long_user_name_number_1;
-GRANT SELECT ON mysql.* TO very_long_user_name_number_2;
-GRANT ALL ON *.* TO even_longer_user_name_number_3_to_test_the_grantor_and_definer_field_length@localhost WITH GRANT OPTION;
---change_user even_longer_user_name_number_3_to_test_the_grantor_and_definer_field_length
-
-GRANT INSERT ON mysql.user TO very_long_user_name_number_1;
-GRANT INSERT ON mysql.user TO very_long_user_name_number_2;
-GRANT UPDATE (User) ON mysql.db TO very_long_user_name_number_1;
-GRANT UPDATE (User) ON mysql.db TO very_long_user_name_number_2;
-
-CREATE PROCEDURE test.pr() BEGIN END;
-
---change_user root
-
---replace_result $MYSQLTEST_VARDIR var
---exec $MYSQL_UPGRADE --force 2>&1
-
-SELECT definer FROM mysql.proc WHERE db = 'test' AND name = 'pr';
-SELECT grantor FROM mysql.tables_priv WHERE db = 'mysql' AND table_name = 'user';
-DROP USER very_long_user_name_number_1, very_long_user_name_number_2, even_longer_user_name_number_3_to_test_the_grantor_and_definer_field_length@localhost;
-DROP PROCEDURE test.pr;
-
-#
-# MDEV-13274 mysql_upgrade fails if dbname+tablename+partioname > 64 chars
-#
-use test;
-call mtr.add_suppression('Column last_update in table `mysql`.`innodb_table_stats` is INT NOT NULL but should be');
-alter table mysql.innodb_table_stats modify last_update int not null;
-
-create table extralongname_extralongname_extralongname_extralongname_ext (
- id int(10) unsigned not null,
- created_date date not null,
- created timestamp not null,
- primary key (created,id,created_date)
-) engine=innodb stats_persistent=1 default charset=latin1
- partition by range (year(created_date))
- subpartition by hash (month(created_date))
- subpartitions 2 (
- partition p2007 values less than (2008),
- partition p2008 values less than (2009)
- );
---exec $MYSQL_UPGRADE --skip-verbose --force 2>&1
-select length(table_name) from mysql.innodb_table_stats;
-drop table extralongname_extralongname_extralongname_extralongname_ext;
-
---echo End of 10.0 tests
-
-set sql_mode=default;
-
-#
-# Enforce storage engine option should not effect mysql_upgrade
-#
---echo # Droping the previously created mysql_upgrade_info file..
---remove_file $MYSQLD_DATADIR/mysql_upgrade_info
-
-create table test.t1(a int) engine=MyISAM;
---echo # Trying to enforce InnoDB for all tables
-SET GLOBAL enforce_storage_engine=InnoDB;
-
---replace_result $MYSQLTEST_VARDIR var
---exec $MYSQL_UPGRADE --force 2>&1
-
---echo # Should return 2
-SELECT count(*) FROM information_schema.tables where ENGINE="InnoDB";
-SHOW CREATE TABLE test.t1;
-DROP TABLE test.t1;
-# mysql_upgrade must have created mysql_upgrade_info file,
-# so the following command should never fail.
---remove_file $MYSQLD_DATADIR/mysql_upgrade_info
-SET GLOBAL enforce_storage_engine=NULL;
-
---echo End of 10.1 tests
-
---echo Start of 10.3 tests
-
---echo #
---echo # Ensure that mysql_upgrade correctly sets truncate_versioning_priv
---echo # on upgrade from 10.2
---echo #
-
-flush privileges;
-CREATE USER 'user3'@'%';
-GRANT USAGE ON *.* TO 'user3'@'%';
-GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%';
-alter table mysql.user drop column Delete_history_priv;
-alter table mysql.db drop column Delete_history_priv;
---source include/restart_mysqld.inc
---echo Run mysql_upgrade with all privileges on a user
---exec $MYSQL_UPGRADE --force --silent 2>&1
---remove_file $MYSQLD_DATADIR/mysql_upgrade_info
-flush privileges;
-SHOW GRANTS FOR 'user3'@'%';
-DROP USER 'user3'@'%';
-update mysql.db set Delete_history_priv='Y' where db like 'test%';
diff --git a/mysql-test/t/mysql_upgrade_no_innodb.test b/mysql-test/t/mysql_upgrade_no_innodb.test
deleted file mode 100644
index 8813a450450..00000000000
--- a/mysql-test/t/mysql_upgrade_no_innodb.test
+++ /dev/null
@@ -1,6 +0,0 @@
---source include/mysql_upgrade_preparation.inc
-
---exec $MYSQL_UPGRADE --force --upgrade-system-tables 2>&1
-
-let $MYSQLD_DATADIR= `select @@datadir`;
---remove_file $MYSQLD_DATADIR/mysql_upgrade_info
diff --git a/mysql-test/t/mysql_upgrade_noengine.test b/mysql-test/t/mysql_upgrade_noengine.test
deleted file mode 100644
index 1d65e7ffa1c..00000000000
--- a/mysql-test/t/mysql_upgrade_noengine.test
+++ /dev/null
@@ -1,62 +0,0 @@
-#
-# MDEV-11942 BLACKHOLE is no longer active in 10.1 by default, mysql_upgrade not handling the situation
-#
-source include/have_innodb.inc;
-source include/not_embedded.inc;
-
-if (!$HA_BLACKHOLE_SO) {
- skip Need blackhole plugin;
-}
-if (!$HA_ARCHIVE_SO) {
- skip Need Archive plugin;
-}
-
-let $datadir= `select @@datadir`;
-
-install soname 'ha_blackhole';
-install soname 'ha_archive';
-
-vertical_results;
-create table t1 (a int) engine=blackhole;
-create table t2 (a int) engine=archive;
-select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t1';
-select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t2';
-
-flush tables;
-uninstall plugin blackhole;
-uninstall plugin archive;
-select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t1';
-select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t2';
-
-# upgrade from 10.1 - engines aren't enabled
-exec $MYSQL_UPGRADE 2>&1;
-select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t1';
-select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t2';
-
-# pretend it's an upgrade from 10.0
-alter table mysql.user drop column default_role, drop column max_statement_time;
-
-# but mysql_upgrade_info tells otherwise
-remove_file $datadir/mysql_upgrade_info;
-write_file $datadir/mysql_upgrade_info;
-10.1.10-MariaDB
-EOF
-
-# still upgrade from 10.1
-exec $MYSQL_UPGRADE 2>&1;
-select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t1';
-select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t2';
-
-alter table mysql.user drop column default_role, drop column max_statement_time;
-remove_file $datadir/mysql_upgrade_info;
-
-# upgrade from 10.0 - engines are enabled
-exec $MYSQL_UPGRADE 2>&1;
-select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t1';
-select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t2';
-
-drop table t1, t2;
-
-remove_file $datadir/mysql_upgrade_info;
-uninstall plugin blackhole;
-uninstall plugin archive;
diff --git a/mysql-test/t/mysql_upgrade_ssl.test b/mysql-test/t/mysql_upgrade_ssl.test
deleted file mode 100644
index daf5fad3df7..00000000000
--- a/mysql-test/t/mysql_upgrade_ssl.test
+++ /dev/null
@@ -1,12 +0,0 @@
-# mysql_upgrade tests requiring SSL support
-
--- source include/have_ssl_communication.inc
--- source include/mysql_upgrade_preparation.inc
--- source include/have_innodb.inc
-
---echo #
---echo # Bug#55672 mysql_upgrade dies with internal error
---echo #
---exec $MYSQL_UPGRADE --skip-verbose --skip-silent --ssl --force 2>&1
---let $datadir= `select @@datadir`
---remove_file $datadir/mysql_upgrade_info
diff --git a/mysql-test/t/mysql_upgrade_view.test b/mysql-test/t/mysql_upgrade_view.test
deleted file mode 100644
index 6a496858d22..00000000000
--- a/mysql-test/t/mysql_upgrade_view.test
+++ /dev/null
@@ -1,188 +0,0 @@
--- source include/have_log_bin.inc
-
-set sql_log_bin=0;
---disable_warnings
-drop table if exists t1,v1,v2,v3,v4,v1badcheck;
-drop view if exists t1,v1,v2,v3,v4,v1badcheck;
---enable_warnings
-
-create table t1(a int);
-create table kv(k varchar(30) NOT NULL PRIMARY KEY,v varchar(50));
-create view v1 as select 1;
-
-repair table t1 quick;
-repair table t1 extended;
-repair table t1 use_frm;
---error ER_PARSE_ERROR
-repair table t1 from mysql;
-
---error ER_PARSE_ERROR
-repair view v1 quick;
---error ER_PARSE_ERROR
-repair view v1 extended;
---error ER_PARSE_ERROR
-repair view v1 use_frm;
-repair view v1 from mysql;
-
---error ER_PARSE_ERROR
-check view v1 quick;
---error ER_PARSE_ERROR
-check view v1 fast;
---error ER_PARSE_ERROR
-check view v1 medium;
---error ER_PARSE_ERROR
-check view v1 extended;
---error ER_PARSE_ERROR
-check view v1 changed;
-check view v1 for upgrade;
-
-drop view v1;
-
-let $MYSQLD_DATADIR= `select @@datadir`;
-
---copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v1.frm $MYSQLD_DATADIR/test/v1.frm
---copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v1badcheck.frm $MYSQLD_DATADIR/test/v1badcheck.frm
---copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v2.frm $MYSQLD_DATADIR/test/v2.frm
---copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v3.frm $MYSQLD_DATADIR/test/v3.frm
-
-flush tables;
-
-check view v1;
-check view v1badcheck;
-check view v2;
-check view v3;
-
-check view v1 for upgrade;
-check view v1badcheck for upgrade;
-check view v2 for upgrade;
-check view v3 for upgrade;
-
---replace_result $MYSQLTEST_VARDIR var
---exec $MYSQL_UPGRADE --force 2>&1
-
-# "Phase 1/4: Fixing views" expected (without from_mysql)
-
-show create view v1;
-show create view v2;
-show create view v3;
-
-# Now force a mariadb version to be added
-
-set sql_log_bin=1;
-REPAIR VIEW v1,v2;
-REPAIR VIEW v1badcheck;
-REPAIR NO_WRITE_TO_BINLOG VIEW v3;
-set sql_log_bin=0;
-
---source include/show_binlog_events.inc
-
---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
-eval LOAD DATA INFILE '$MYSQLD_DATADIR/test/v1.frm' REPLACE INTO TABLE kv FIELDS TERMINATED BY '=';
-SELECT k,v from kv where k in ('md5','algorithm');
-SELECT k from kv where k ='mariadb-version';
-truncate table kv;
-
---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
-eval LOAD DATA INFILE '$MYSQLD_DATADIR/test/v2.frm' REPLACE INTO TABLE kv FIELDS TERMINATED BY '=';
-SELECT k,v from kv where k in ('md5','algorithm');
-SELECT k from kv where k ='mariadb-version';
-truncate table kv;
-
---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
-eval LOAD DATA INFILE '$MYSQLD_DATADIR/test/v3.frm' REPLACE INTO TABLE kv FIELDS TERMINATED BY '=';
-SELECT k,v from kv where k in ('md5','algorithm');
-SELECT k from kv where k ='mariadb-version';
-truncate table kv;
-
---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
-eval LOAD DATA INFILE '$MYSQLD_DATADIR/test/v1badcheck.frm' REPLACE INTO TABLE kv FIELDS TERMINATED BY '=';
-SELECT k,v from kv where k in ('md5','algorithm');
-SELECT k from kv where k ='mariadb-version';
-truncate table kv;
-
---disable_warnings
-drop view if exists v1,v2,v3,v1badcheck;
---enable_warnings
-
-# Make it look like a MySQL directory now
-
-rename table mysql.event to mysql.ev_bk;
---copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/event.MYI $MYSQLD_DATADIR/mysql/event.MYI
---copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/event.MYD $MYSQLD_DATADIR/mysql/event.MYD
---copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/event.frm $MYSQLD_DATADIR/mysql/event.frm
-
---copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v1.frm $MYSQLD_DATADIR/test/v1.frm
---copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v2.frm $MYSQLD_DATADIR/test/v2.frm
---copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v3.frm $MYSQLD_DATADIR/test/v3.frm
-
-flush tables;
-
-create algorithm=temptable view v4 as select a from t1;
-show create view v1;
-show create view v2;
-show create view v3;
-show create view v4;
-
-# here we test the fixing views from mysql to occur
---replace_result $MYSQLTEST_VARDIR var
---exec $MYSQL_UPGRADE --force 2>&1
-
-flush tables;
-show create view v1;
-show create view v2;
-show create view v3;
-show create view v4;
-
---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
-eval LOAD DATA INFILE '$MYSQLD_DATADIR/test/v1.frm' REPLACE INTO TABLE kv FIELDS TERMINATED BY '=';
-SELECT k,v from kv where k in ('md5','algorithm');
-SELECT k from kv where k ='mariadb-version';
-truncate table kv;
-
---disable_warnings
-drop view if exists v1,v2,v3;
---enable_warnings
-
-# back to mariadb default
-drop table mysql.event;
-rename table mysql.ev_bk to mysql.event;
-
---copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v1.frm $MYSQLD_DATADIR/test/v1.frm
---copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v2.frm $MYSQLD_DATADIR/test/v2.frm
---copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v3.frm $MYSQLD_DATADIR/test/v3.frm
-
-# check of binlog and mixing tables (with table specific options) and views
---exec $MYSQL_CHECK --repair --write-binlog --process-tables --use-frm --process-views=UPGRADE_FROM_MYSQL test 2>&1
-
---source include/show_binlog_events.inc
-
-drop table if exists kv;
-drop view v1,v2,v3,v4;
-
-#
-# MDEV-9453 mysql_upgrade.exe error when mysql is migrated to mariadb
-# (mysql_upgrade.exe --upgrade-system-tables fails on fixing views)
-#
-
-# Make it look like a MySQL directory again
-
-rename table mysql.event to mysql.ev_bk;
---copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/event.MYI $MYSQLD_DATADIR/mysql/event.MYI
---copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/event.MYD $MYSQLD_DATADIR/mysql/event.MYD
---copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/event.frm $MYSQLD_DATADIR/mysql/event.frm
-
---copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v1.frm $MYSQLD_DATADIR/test/v1.frm
---copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v2.frm $MYSQLD_DATADIR/test/v2.frm
---copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v3.frm $MYSQLD_DATADIR/test/v3.frm
-
-flush tables;
-
---replace_result $MYSQLTEST_VARDIR var
---exec $MYSQL_UPGRADE --force --upgrade-system-tables 2>&1
-
-# back to mariadb default
-drop table mysql.event;
-rename table mysql.ev_bk to mysql.event;
-remove_file $MYSQLD_DATADIR/mysql_upgrade_info;
-drop view v1,v2,v3;
-drop table t1;
diff --git a/mysql-test/t/mysqladmin.test b/mysql-test/t/mysqladmin.test
deleted file mode 100644
index 2580db88456..00000000000
--- a/mysql-test/t/mysqladmin.test
+++ /dev/null
@@ -1,53 +0,0 @@
-# Embedded server doesn't support external clients
---source include/not_embedded.inc
-#
-# Test "mysqladmin ping"
-#
-
---exec $MYSQLADMIN --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1
-
-
-#
-# Bug#10608 mysqladmin breaks on "database" variable in my.cnf
-#
-
---replace_regex /.*mysqladmin.*: unknown/mysqladmin: unknown/
---error 7
---exec $MYSQLADMIN --database=db1 --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1
-
-# When mysqladmin finds "loose-database" it shall print
-# a warning and continue
---replace_regex /Warning: .*mysqladmin.*: unknown/Warning: mysqladmin: unknown/
---exec $MYSQLADMIN --loose-database=db2 --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping 2>&1
-
---echo #
---echo # Bug#58221 : mysqladmin --sleep=x --count=x keeps looping
---echo #
-
---echo # Executing mysqladmin with --sleep=1 and --count=2.
---exec $MYSQLADMIN -u root -S $MASTER_MYSOCK -P $MASTER_MYPORT --sleep=1 --count=2 ping > $MYSQLTEST_VARDIR/tmp/mysqladmin.tmp
---echo # Done.
---echo # Displaying the output :
---cat_file $MYSQLTEST_VARDIR/tmp/mysqladmin.tmp
-
---remove_file $MYSQLTEST_VARDIR/tmp/mysqladmin.tmp
-
---echo #
---echo # BUG#11766184 - 59234: cmdline clients crash --defaults-extra-file
---echo # with no .cnf or .ini extension.
---echo #
-
---echo # Creating an empty file 'cnf_file'
---write_file $MYSQLTEST_VARDIR/tmp/cnf_file
-EOF
-
---echo # Using --defaults-extra-file option with 'cnf_file'.
---exec $MYSQLADMIN --defaults-extra-file=$MYSQLTEST_VARDIR/tmp/cnf_file -uroot -S $MASTER_MYSOCK -P $MASTER_MYPORT ping 2>&1
-
---remove_file $MYSQLTEST_VARDIR/tmp/cnf_file
-
-#
-# MDEV-7883 Segmentation failure when running mysqladmin -u root -p
-#
---error 1
---exec $MYSQLADMIN -u root -p 2>&1 > /dev/null
diff --git a/mysql-test/t/mysqlbinlog-innodb.test b/mysql-test/t/mysqlbinlog-innodb.test
deleted file mode 100644
index c8bf8095705..00000000000
--- a/mysql-test/t/mysqlbinlog-innodb.test
+++ /dev/null
@@ -1,30 +0,0 @@
--- source include/have_binlog_format_statement.inc
--- source include/have_log_bin.inc
--- source include/have_innodb.inc
-#
-# MBug#702303: Spurious `use` statements in output from mysqlbinlog --rewrite-db="a->b"
-#
-let $MYSQLD_DATADIR= `select @@datadir`;
-SET TIMESTAMP=1000000000;
-CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb;
-CREATE DATABASE test2;
-
-RESET MASTER;
-USE test2;
-BEGIN;
-USE test;
-INSERT INTO t1 VALUES (1);
-USE test2;
-COMMIT;
-BEGIN;
-USE test;
-INSERT INTO t1 VALUES (2);
-USE test2;
-COMMIT;
-USE test;
-SELECT * FROM t1 ORDER BY a;
-FLUSH LOGS;
---exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 --short-form
---exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 --short-form --rewrite-db="test->foo" --rewrite-db="test2->bar"
-DROP DATABASE test2;
-DROP TABLE t1;
diff --git a/mysql-test/t/mysqlbinlog-master.opt b/mysql-test/t/mysqlbinlog-master.opt
deleted file mode 100644
index ac1a87c73b3..00000000000
--- a/mysql-test/t/mysqlbinlog-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---max-binlog-size=4096
diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
deleted file mode 100644
index 6988b2a8e9b..00000000000
--- a/mysql-test/t/mysqlbinlog.test
+++ /dev/null
@@ -1,597 +0,0 @@
-# We are using .opt file since we need small binlog size
-# TODO: Need to look at making a row based version once the new row based client is completed. [jbm]
--- source include/have_binlog_format_statement.inc
-
--- source include/have_log_bin.inc
--- source include/binlog_start_pos.inc
-
---disable_query_log
-CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
---enable_query_log
-
-# Deletes all the binary logs
-reset master;
-
-# we need this for getting fixed timestamps inside of this test
-set timestamp=1000000000;
-
---disable_warnings
-drop table if exists t1,t2,t3,t4,t5,t03,t04;
---enable_warnings
-
-create table t1 (word varchar(20));
-create table t2 (id int auto_increment not null primary key);
-
-# simple test for simple statement and various events
-insert into t1 values ("abirvalg");
-insert into t2 values ();
-# Should be uncommented in 4.1
-# set @a:=1
-# insert into t2 values (@a);
-
-# test for load data and load data distributed among the several
-# files (we need to fill up first binlog)
-load data infile '../../std_data/words3.dat' into table t1;
-load data infile '../../std_data/words3.dat' into table t1;
-load data infile '../../std_data/words3.dat' into table t1;
-load data infile '../../std_data/words3.dat' into table t1;
-load data infile '../../std_data/words3.dat' into table t1;
-# simple query to show more in second binlog
---let $binlog_start_pos=query_get_value(SHOW MASTER STATUS, Position, 1)
-insert into t1 values ("Alas");
-
-### Starting master-bin.000003
-flush logs;
-
-# delimiters are for easier debugging in future
---disable_query_log
-select "--- Local --" as "";
---enable_query_log
-
-#
-# We should use --short-form everywhere because in other case output will
-# be time dependend. Better than nothing.
-#
-let $MYSQLD_DATADIR= `select @@datadir`;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000001
-
-# this should not fail but shouldn't produce any working statements
---disable_query_log
-select "--- Broken LOAD DATA --" as "";
---enable_query_log
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000002 2> /dev/null
-
-# this should show almost nothing
---disable_query_log
-select "--- --database --" as "";
---enable_query_log
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --database=nottest $MYSQLD_DATADIR/master-bin.000001 2> /dev/null
-
-# this test for start-position option
---disable_query_log
-select "--- --start-position --" as "";
---enable_query_log
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --start-position=$binlog_start_pos $MYSQLD_DATADIR/master-bin.000002
-
-# These are tests for remote binlog.
-# They should return the same as previous test.
-
---disable_query_log
-select "--- Remote --" as "";
---enable_query_log
-
-# This is broken now
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
-
-# This is broken too
---disable_query_log
-select "--- Broken LOAD DATA --" as "";
---enable_query_log
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 2> /dev/null
-
-# And this too ! (altough it is documented)
---disable_query_log
-select "--- --database --" as "";
---enable_query_log
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --database=nottest master-bin.000001 2> /dev/null
-
-# Strangely but this works
---disable_query_log
-select "--- --start-position --" as "";
---enable_query_log
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --start-position=$binlog_start_pos --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
-
-# Bug#7853 mysqlbinlog does not accept input from stdin
---disable_query_log
-select "--- reading stdin --" as "";
---enable_query_log
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
---exec $MYSQL_BINLOG --short-form - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001
-
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
-# postion is constant to correspond to an event in pre-recorded binlog
---let $binlog_start_pos=79
---exec $MYSQL_BINLOG --short-form --start-position=$binlog_start_pos - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001
-drop table t1,t2;
-
-#
-# Bug#14157 utf8 encoding in binlog without set character_set_client
-#
-### Starting master-bin.000004
-flush logs;
-
---write_file $MYSQLTEST_VARDIR/tmp/bug14157.sql
-create table if not exists t5 (a int);
-set names latin1;
-create temporary table `` (a int);
-insert into `` values (1);
-insert into t5 select * from ``
-EOF
---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug14157.sql
---remove_file $MYSQLTEST_VARDIR/tmp/bug14157.sql
-
-# resulted binlog, parly consisting of multi-byte utf8 chars,
-# must be digestable for both client and server. In 4.1 the client
-# should use default-character-set same as the server.
-
-### Starting master-bin.000005
-flush logs;
-# Due to BUG#18337 that wrongly suppresses the BINLOG EVENTS when
-# --short-form is used, the "insert into t5 select * from ``"
-# which is unsafe and thus written to the binary log in the row
-# format is not executed. This makes the assertion select * from t5
-# /* must be (1),(1) */; to fail. To temporary fix the bug, we
-# removed the option --short-form.
-#--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000004 | $MYSQL
---exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000004 | $MYSQL
-select * from t5 /* must be (1),(1) */;
-drop table t5;
-
-#
-# Bug#22645 LC_TIME_NAMES: Statement not replicated
-# Check that a dump created by mysqlbinlog reproduces
-# lc_time_names dependent values correctly
-#
-
-### Starting master-bin.000006
-flush logs;
-create table t5 (c1 int, c2 varchar(128) character set latin1 not null);
-insert into t5 values (1, date_format('2001-01-01','%W'));
-set lc_time_names=de_DE;
-insert into t5 values (2, date_format('2001-01-01','%W'));
-set lc_time_names=en_US;
-insert into t5 values (3, date_format('2001-01-01','%W'));
-select * from t5 order by c1;
-
-### Starting master-bin.000007
-flush logs;
-
-drop table t5;
---exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000006 | $MYSQL
-select * from t5 order by c1;
-drop table t5;
-
-#
-# Bug#20396 Bin Log does not get DELIMETER cmd - Recover StoredProc fails
-#
---disable_warnings
-drop procedure if exists p1;
---enable_warnings
-
-### Starting master-bin.000008
-flush logs;
-
-delimiter //;
-create procedure p1()
-begin
-select 1;
-end;
-//
-delimiter ;//
-
-### Starting master-bin.000009
-flush logs;
-
-call p1();
-drop procedure p1;
---error ER_SP_DOES_NOT_EXIST
-call p1();
---replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
---exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000008
---exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000008 | $MYSQL
-call p1();
-drop procedure p1;
-
-#
-# Some coverage of not normally used parts
-#
---disable_query_log
---exec $MYSQL_BINLOG --version 2>&1 > /dev/null
---exec $MYSQL_BINLOG --help 2>&1 > /dev/null
---enable_query_log
-
-#
-# Bug#15126 character_set_database is not replicated
-# (LOAD DATA INFILE need it)
-#
-
-### Starting master-bin.000010
-flush logs;
-
-create table t1 (a varchar(64) character set utf8);
-load data infile '../../std_data/loaddata6.dat' into table t1;
-set character_set_database=koi8r;
-load data infile '../../std_data/loaddata6.dat' into table t1;
-set character_set_database=latin1;
-load data infile '../../std_data/loaddata6.dat' into table t1;
-load data infile '../../std_data/loaddata6.dat' into table t1;
-set character_set_database=koi8r;
-load data infile '../../std_data/loaddata6.dat' into table t1;
-set character_set_database=latin1;
-load data infile '../../std_data/loaddata6.dat' into table t1;
-load data infile '../../std_data/loaddata6.dat' into table t1 character set koi8r;
-select hex(a) from t1;
-drop table t1;
-
-### Starting master-bin.000011
-flush logs;
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---replace_regex /SQL_LOAD_MB-[0-9a-f]+-[0-9a-f]+/SQL_LOAD_MB-#-#/
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000010
-
-#
-# Bug#28293 missed '#' sign in the hex dump when the dump length
-# is divisible by 16.
-#
-
-CREATE TABLE t1 (c1 CHAR(10));
-# we need this for getting fixed timestamps inside of this test
-### Starting master-bin.000012
-FLUSH LOGS;
-
-INSERT INTO t1 VALUES ('0123456789');
-
-### Starting master-bin.000013
-FLUSH LOGS;
-
-DROP TABLE t1;
-
-# We create a table named "patch", and load the output into it.
-# By using LIKE, we can easily see if the output is missing the '#'
-# character, as described in the bug.
-
---disable_query_log
-CREATE TABLE patch (a BLOB);
---exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000012 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat
-### Starting master-bin.000014
-eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat'
- INTO TABLE patch FIELDS TERMINATED BY '';
---remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat
---enable_query_log
-
---echo We expect this value to be 2 (one for the INSERT, one for COMMIT).
---echo The bug being tested was that 'Query' lines were not preceded by '#'
---echo If the line is in the table, it had to have been preceded by a '#'
---echo
-SELECT COUNT(*) AS `BUG#28293_expect_2` FROM patch WHERE a LIKE '#%Query%';
-DROP TABLE patch;
-
-#
-# Bug#29928 incorrect connection_id() restoring from mysqlbinlog out
-#
-### Starting master-bin.000015
-FLUSH LOGS;
-
-CREATE TABLE t1(a INT);
-INSERT INTO t1 VALUES(connection_id());
-let $a= `SELECT a FROM t1`;
-
-### Starting master-bin.000016
-FLUSH LOGS;
-
-let $outfile= $MYSQLTEST_VARDIR/tmp/bug29928.sql;
---exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000015 > $outfile
-DROP TABLE t1;
-connect (con1, localhost, root, , test);
-connection con1;
---exec $MYSQL test < $outfile
---remove_file $outfile
-let $b= `SELECT a FROM t1`;
-disconnect con1;
-connection default;
-let $c= `SELECT $a=$b`;
---echo $c
-DROP TABLE t1;
-
-echo shell> mysqlbinlog std_data/corrupt-relay-bin.000624 > var/tmp/bug31793.sql;
-error 1;
-exec $MYSQL_BINLOG $MYSQL_TEST_DIR/std_data/corrupt-relay-bin.000624 > $MYSQLTEST_VARDIR/tmp/bug31793.sql;
---remove_file $MYSQLTEST_VARDIR/tmp/bug31793.sql
-
-#
-# Test --disable-force-if-open and --force-if-open
-#
-### Starting master-bin.000017
-FLUSH LOGS;
-
---error 1
---exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000017 >/dev/null 2>/dev/null
---exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000017 >/dev/null 2>/dev/null
-
---echo Bug#31611 Security risk with BINLOG statement
-
-SET BINLOG_FORMAT=ROW;
-CREATE DATABASE mysqltest1;
-CREATE USER untrusted@localhost;
-GRANT SELECT ON mysqltest1.* TO untrusted@localhost;
-
-SHOW GRANTS FOR untrusted@localhost;
-USE mysqltest1;
-CREATE TABLE t1 (a INT, b CHAR(64));
-
-### Starting master-bin.000018
-flush logs;
-
-INSERT INTO t1 VALUES (1,USER());
-
-### Starting master-bin.000019
-flush logs;
-echo mysqlbinlog var/log/master-bin.000018 > var/tmp/bug31611.sql;
-exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000018 > $MYSQLTEST_VARDIR/tmp/bug31611.sql;
-connect (unsecure,localhost,untrusted,,mysqltest1);
-echo mysql mysqltest1 -uuntrusted < var/tmp/bug31611.sql;
-error 1;
-exec $MYSQL mysqltest1 -uuntrusted < $MYSQLTEST_VARDIR/tmp/bug31611.sql;
---remove_file $MYSQLTEST_VARDIR/tmp/bug31611.sql
-connection unsecure;
-error ER_TABLEACCESS_DENIED_ERROR;
-INSERT INTO t1 VALUES (1,USER());
-
-SELECT * FROM t1;
-connection default;
-DROP DATABASE mysqltest1;
-DROP USER untrusted@localhost;
-
---echo Bug#32580 mysqlbinlog cannot read binlog event with user variables
-
-# Testing that various kinds of events can be read and restored properly.
-
-connection default;
-USE test;
-SET BINLOG_FORMAT = STATEMENT;
-
-### Starting master-bin.000020
-FLUSH LOGS;
-
-CREATE TABLE t1 (a_real FLOAT, an_int INT, a_decimal DECIMAL(5,2), a_string CHAR(32));
-SET @a_real = rand(20) * 1000;
-SET @an_int = 1000;
-SET @a_decimal = CAST(rand(19) * 999 AS DECIMAL(5,2));
-SET @a_string = 'Just a test';
-INSERT INTO t1 VALUES (@a_real, @an_int, @a_decimal, @a_string);
-
-### Starting master-bin.000021
-FLUSH LOGS;
-
-query_vertical SELECT * FROM t1;
-DROP TABLE t1;
-
-echo >> mysqlbinlog var/log/master-bin.000020 > var/tmp/bug32580.sql;
-exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000020 > $MYSQLTEST_VARDIR/tmp/bug32580.sql;
-echo >> mysql test < var/tmp/bug32580.sql;
-exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug32580.sql;
-remove_file $MYSQLTEST_VARDIR/tmp/bug32580.sql;
-
-query_vertical SELECT * FROM t1;
-DROP TABLE t1;
-
-#
-# Bug#37313 BINLOG Contains Incorrect server id
-#
-
-let $binlog_file= $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog;
-let $save_server_id= `SELECT @@global.server_id`;
-let $s_id_max= `SELECT (1 << 32) - 1`;
-eval SET @@global.server_id= $s_id_max;
-
-RESET MASTER;
-FLUSH LOGS;
-
---exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $binlog_file
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval SELECT
-(@a:=LOAD_FILE("$binlog_file"))
-IS NOT NULL;
-let $s_id_unsigned= `SELECT @a LIKE "%server id $s_id_max%" /* must return 1 */`;
-echo *** Unsigned server_id $s_id_max is found: $s_id_unsigned ***;
-
-eval SET @@global.server_id= $save_server_id;
---remove_file $binlog_file
-
-#
-# Bug #41943: mysqlbinlog.exe crashes if --hexdump option is used
-#
-
-RESET MASTER;
-FLUSH LOGS;
-
-# We do not need the results, just make sure that mysqlbinlog does not crash
---exec $MYSQL_BINLOG --hexdump --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 >/dev/null
-
-#
-# #46998
-# This test verifies if the 'BEGIN', 'COMMIT' and 'ROLLBACK' are output
-# in regardless of database filtering
-#
-
-RESET MASTER;
-FLUSH LOGS;
-
-# The following three test cases were wrtten into binlog_transaction.000001
-# Test case1: Test if the 'BEGIN' and 'COMMIT' are output for the 'test' database
-# in transaction1 base on innodb engine tables
-# use test;
-# create table t1(a int) engine= innodb;
-# use mysql;
-# create table t2(a int) engine= innodb;
-# Transaction1 begin
-# begin;
-# use test;
-# insert into t1 (a) values (1);
-# use mysql;
-# insert into t2 (a) values (1);
-# commit;
-# Transaction1 end
-
-# Test case2: Test if the 'BEGIN' and 'ROLLBACK' are output for the 'test' database
-# in transaction2 base on innodb and myisam engine tables
-# use test;
-# create table t3(a int) engine= innodb;
-# use mysql;
-# create table t4(a int) engine= myisam;
-# Transaction2 begin
-# begin;
-# use test;
-# insert into t3 (a) values (2);
-# use mysql;
-# insert into t4 (a) values (2);
-# rollback;
-# Transaction2 end
-
---echo #
---echo # Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified exists
---exec $MYSQL_BINLOG --database=test --short-form $MYSQLTEST_VARDIR/std_data/binlog_transaction.000001
---echo #
---echo # Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified does not exist
---exec $MYSQL_BINLOG --database=not_exist --short-form $MYSQLTEST_VARDIR/std_data/binlog_transaction.000001
-
---echo #
---echo # Test if the 'SAVEPOINT', 'ROLLBACK TO' are output if the database specified exists
---exec $MYSQL_BINLOG --database=db1 --short-form $MYSQLTEST_VARDIR/std_data/binlog_savepoint.000001
---echo #
---echo # Test if the 'SAVEPOINT', 'ROLLBACK TO' are output if the database specified does not exist
---exec $MYSQL_BINLOG --database=not_exist --short-form $MYSQLTEST_VARDIR/std_data/binlog_savepoint.000001
-
---echo End of 5.0 tests
-
---echo End of 5.1 tests
-
-#
-# BUG#38468 Memory leak detected when using mysqlbinlog utility;
-#
-disable_query_log;
-RESET MASTER;
-CREATE TABLE t1 SELECT 1;
-FLUSH LOGS;
-DROP TABLE t1;
-enable_query_log;
-
-# Write an empty file for comparison
-write_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn.empty;
-EOF
-
-# Before fix of BUG#38468, this would generate some warnings
---exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 >/dev/null 2> $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn
-
-# Make sure the command above does not generate any error or warnings
-diff_files $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn.empty;
-
-# Cleanup for this part of test
-remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn.empty;
-remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn;
-
-#
-# WL#5625: Deprecate mysqlbinlog options --base64-output=always and --base64-output
-#
---echo # Expect deprecation warning.
---exec $MYSQL_BINLOG --base64-output=always std_data/master-bin.000001 > /dev/null 2> $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn
---cat_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn
-
---echo # Expect deprecation warning again.
---exec $MYSQL_BINLOG --base64-output std_data/master-bin.000001 > /dev/null 2> $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn
---cat_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn
-
-# Clean up this part of the test.
---remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn
-
-# BUG#50914
-# This test verifies if the approach of the mysqlbinlog prints
-# "use $database" statements to its output stream will cause
-# "No Database Selected" error when dropping and recreating
-# that database.
-#
-RESET MASTER;
-CREATE DATABASE test1;
-USE test1;
-CREATE TABLE t1(id int);
-DROP DATABASE test1;
-CREATE DATABASE test1;
-USE test1;
-CREATE TABLE t1(id int);
-DROP TABLE t1;
-DROP DATABASE test1;
-let $master_binlog= query_get_value(SHOW MASTER STATUS, File, 1);
-FLUSH LOGS;
---source include/wait_for_binlog_checkpoint.inc
-
-let $MYSQLD_DATADIR= `SELECT @@datadir`;
-exec $MYSQL_BINLOG $MYSQLD_DATADIR/$master_binlog | $MYSQL test 2>&1;
-
-let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
-source include/show_binlog_events.inc;
-
-#
-# BUG#11766427 BUG#59530: Filter by server id in mysqlbinlog fails
-# This test checks that the format description log event is not
-# filtered out by the --server-id option.
-#
-RESET MASTER;
-USE test;
-CREATE TABLE t1 (a INT);
---let $old_server_id= `SELECT @@GLOBAL.SERVER_ID`
-SET GLOBAL SERVER_ID = 2;
-DROP TABLE t1;
---let $master_binlog= query_get_value(SHOW MASTER STATUS, File, 1)
-FLUSH LOGS;
-# The following should only create t1, not drop it.
---exec $MYSQL_BINLOG --server-id=1 $MYSQLD_DATADIR/$master_binlog | $MYSQL
-SHOW TABLES IN test;
-# The following should only drop t1, not create it.
---exec $MYSQL_BINLOG --server-id=2 $MYSQLD_DATADIR/$master_binlog | $MYSQL
-SHOW TABLES IN test;
-eval SET GLOBAL SERVER_ID = $old_server_id;
-
---echo #
---echo # MDEV-4645: Incorrect reads of frozen binlog events;
---echo # FDE corrupted in relay log
---echo #
---let TZ=GMT
---exec $MYSQL_BINLOG --hexdump std_data/mdev-4645-binlog_checksum.binlog
---exec $MYSQL_BINLOG --hexdump std_data/mdev-4645-binlog_group_id.binlog
---exec $MYSQL_BINLOG --hexdump std_data/mdev-4645-binlog_group_id_checksum.binlog
---exec $MYSQL_BINLOG --hexdump std_data/mdev-4645-binlog_none.binlog
-
-#
-# MDEV-12372 mysqlbinlog --version output is the same on 10.x as on 5.5.x, and contains not only version
-#
-replace_regex /.*mysqlbinlog(\.exe)? Ver .* for .* at [-_a-zA-Z0-9]+/mysqlbinlog Ver VER for OS at ARCH/;
-exec $MYSQL_BINLOG --version;
diff --git a/mysql-test/t/mysqlbinlog_raw_mode.test b/mysql-test/t/mysqlbinlog_raw_mode.test
deleted file mode 100644
index 26fb31516f6..00000000000
--- a/mysql-test/t/mysqlbinlog_raw_mode.test
+++ /dev/null
@@ -1,387 +0,0 @@
---source include/have_log_bin.inc
-reset master;
-
-# we need this for getting fixed timestamps inside of this test
-set timestamp=1000000000;
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-CREATE TABLE t1 (c01 BIT);
-INSERT INTO t1 VALUES (0);
-INSERT INTO t1 VALUES (1);
-DROP TABLE t1;
-
-CREATE TABLE t1 (c01 BIT(7));
-INSERT INTO t1 VALUES (1);
-INSERT INTO t1 VALUES (2);
-INSERT INTO t1 VALUES (4);
-INSERT INTO t1 VALUES (8);
-INSERT INTO t1 VALUES (16);
-INSERT INTO t1 VALUES (32);
-INSERT INTO t1 VALUES (64);
-INSERT INTO t1 VALUES (127);
-DELETE FROM t1 WHERE c01=127;
-UPDATE t1 SET c01=15 WHERE c01=16;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a BIT(20), b CHAR(2));
-INSERT INTO t1 VALUES (b'00010010010010001001', 'ab');
-DROP TABLE t1;
-
-CREATE TABLE t1 (c02 BIT(64));
-INSERT INTO t1 VALUES (1);
-INSERT INTO t1 VALUES (2);
-INSERT INTO t1 VALUES (128);
-INSERT INTO t1 VALUES (b'1111111111111111111111111111111111111111111111111111111111111111');
-DROP TABLE t1;
-
-
-CREATE TABLE t1 (c03 TINYINT);
-INSERT INTO t1 VALUES (1),(2),(3);
-INSERT INTO t1 VALUES (-128);
-UPDATE t1 SET c03=2 WHERE c03=1;
-DELETE FROM t1 WHERE c03=-128;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c04 TINYINT UNSIGNED);
-INSERT INTO t1 VALUES (128), (255);
-UPDATE t1 SET c04=2 WHERE c04=1;
-DELETE FROM t1 WHERE c04=255;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c06 BOOL);
-INSERT INTO t1 VALUES (TRUE);
-DELETE FROM t1 WHERE c06=TRUE;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c07 SMALLINT);
-INSERT INTO t1 VALUES (1234);
-DELETE FROM t1 WHERE c07=1234;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c08 SMALLINT UNSIGNED);
-INSERT INTO t1 VALUES (32768), (65535);
-UPDATE t1 SET c08=2 WHERE c08=32768;
-DELETE FROM t1 WHERE c08=65535;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c10 MEDIUMINT);
-INSERT INTO t1 VALUES (12345);
-DELETE FROM t1 WHERE c10=12345;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c11 MEDIUMINT UNSIGNED);
-INSERT INTO t1 VALUES (8388608), (16777215);
-UPDATE t1 SET c11=2 WHERE c11=8388608;
-DELETE FROM t1 WHERE c11=16777215;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c13 INT);
-INSERT INTO t1 VALUES (123456);
-DELETE FROM t1 WHERE c13=123456;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c14 INT UNSIGNED);
-INSERT INTO t1 VALUES (2147483648), (4294967295);
-UPDATE t1 SET c14=2 WHERE c14=2147483648;
-DELETE FROM t1 WHERE c14=4294967295;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c16 BIGINT);
-INSERT INTO t1 VALUES (1234567890);
-DELETE FROM t1 WHERE c16=1234567890;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c17 BIGINT UNSIGNED);
-INSERT INTO t1 VALUES (9223372036854775808), (18446744073709551615);
-UPDATE t1 SET c17=2 WHERE c17=9223372036854775808;
-DELETE FROM t1 WHERE c17=18446744073709551615;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c19 FLOAT);
-INSERT INTO t1 VALUES (123.2234);
-DELETE FROM t1 WHERE c19>123;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c22 DOUBLE);
-INSERT INTO t1 VALUES (123434.22344545);
-DELETE FROM t1 WHERE c22>123434;
-DROP TABLE t1;
-
-#
-
-CREATE TABLE t1 (c25 DECIMAL(10,5));
-INSERT INTO t1 VALUES (124.45);
-INSERT INTO t1 VALUES (-543.21);
-DELETE FROM t1 WHERE c25=124.45;
-DROP TABLE t1;
-
-#
-
-CREATE TABLE t1 (c28 DATE);
-INSERT INTO t1 VALUES ('2001-02-03');
-DELETE FROM t1 WHERE c28='2001-02-03';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c29 DATETIME);
-INSERT INTO t1 VALUES ('2001-02-03 10:20:30');
-DELETE FROM t1 WHERE c29='2001-02-03 10:20:30';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c30 TIMESTAMP);
-INSERT INTO t1 VALUES ('2001-02-03 10:20:30');
-DELETE FROM t1 WHERE c30='2001-02-03 10:20:30';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c31 TIME);
-INSERT INTO t1 VALUES ('11:22:33');
-DELETE FROM t1 WHERE c31='11:22:33';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c32 YEAR);
-INSERT INTO t1 VALUES ('2001');
-DELETE FROM t1 WHERE c32=2001;
-DROP TABLE t1;
-
-#
-
-CREATE TABLE t1 (c33 CHAR);
-INSERT INTO t1 VALUES ('a');
-DELETE FROM t1 WHERE c33='a';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c34 CHAR(0));
-INSERT INTO t1 VALUES ('');
-DELETE FROM t1 WHERE c34='';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c35 CHAR(1));
-INSERT INTO t1 VALUES ('b');
-DELETE FROM t1 WHERE c35='b';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c36 CHAR(255));
-INSERT INTO t1 VALUES (repeat('c',255));
-DELETE FROM t1 WHERE c36>'c';
-DROP TABLE t1;
-
-#
-
-CREATE TABLE t1 (c37 NATIONAL CHAR);
-INSERT INTO t1 VALUES ('a');
-DELETE FROM t1 WHERE c37='a';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c38 NATIONAL CHAR(0));
-INSERT INTO t1 VALUES ('');
-DELETE FROM t1 WHERE c38='';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c39 NATIONAL CHAR(1));
-INSERT INTO t1 VALUES ('a');
-DELETE FROM t1 WHERE c39='a';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c40 NATIONAL CHAR(255));
-INSERT INTO t1 VALUES (repeat('a', 255));
-INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 255));
-DELETE FROM t1 WHERE c40>'a';
-DROP TABLE t1;
-
-#
-
-CREATE TABLE t1 (c45 VARCHAR(0));
-INSERT INTO t1 VALUES ('');
-DELETE FROM t1 WHERE c45='';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c46 VARCHAR(1));
-INSERT INTO t1 VALUES ('a');
-DELETE FROM t1 WHERE c46='a';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c47 VARCHAR(255));
-INSERT INTO t1 VALUES (repeat('a',255));
-DELETE FROM t1 WHERE c47>'a';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c48 VARCHAR(261));
-INSERT INTO t1 VALUES (repeat('a',261));
-DELETE FROM t1 WHERE c48>'a';
-DROP TABLE t1;
-
-#
-
-CREATE TABLE t1 (c49 NATIONAL VARCHAR(0));
-INSERT INTO t1 VALUES ('');
-DELETE FROM t1 WHERE c49='';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c50 NATIONAL VARCHAR(1));
-INSERT INTO t1 VALUES ('a');
-DELETE FROM t1 WHERE c50='a';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c51 NATIONAL VARCHAR(255));
-INSERT INTO t1 VALUES (repeat('a',255));
-INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 255));
-DELETE FROM t1 WHERE c51>'a';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c52 NATIONAL VARCHAR(261));
-INSERT INTO t1 VALUES (repeat('a',261));
-INSERT INTO t1 VALUES (repeat(_latin1 0xDF, 261));
-DELETE FROM t1 WHERE c52>'a';
-DROP TABLE t1;
-
-#
-
-CREATE TABLE t1 (c57 BINARY);
-INSERT INTO t1 VALUES (0x00);
-INSERT INTO t1 VALUES (0x02);
-INSERT INTO t1 VALUES ('a');
-DELETE FROM t1 WHERE c57='a';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c58 BINARY(0));
-INSERT INTO t1 VALUES ('');
-DELETE FROM t1 WHERE c58='';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c59 BINARY(1));
-INSERT INTO t1 VALUES (0x00);
-INSERT INTO t1 VALUES (0x02);
-INSERT INTO t1 VALUES ('a');
-DELETE FROM t1 WHERE c59='a';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c60 BINARY(255));
-INSERT INTO t1 VALUES (0x00);
-INSERT INTO t1 VALUES (0x02);
-INSERT INTO t1 VALUES (repeat('a\0',120));
-DELETE FROM t1 WHERE c60<0x02;
-DROP TABLE t1;
-
-#
-
-CREATE TABLE t1 (c61 VARBINARY(0));
-INSERT INTO t1 VALUES ('');
-DELETE FROM t1 WHERE c61='';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c62 VARBINARY(1));
-INSERT INTO t1 VALUES (0x00);
-INSERT INTO t1 VALUES (0x02);
-INSERT INTO t1 VALUES ('a');
-DELETE FROM t1 WHERE c62=0x02;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c63 VARBINARY(255));
-INSERT INTO t1 VALUES (0x00);
-INSERT INTO t1 VALUES (0x02);
-INSERT INTO t1 VALUES (repeat('a\0',120));
-DELETE FROM t1 WHERE c63=0x02;
-DROP TABLE t1;
-
-#
-flush logs;
-
-CREATE TABLE t1 (c65 TINYBLOB);
-INSERT INTO t1 VALUES ('tinyblob1');
-DELETE FROM t1 WHERE c65='tinyblob1';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c68 BLOB);
-INSERT INTO t1 VALUES ('blob1');
-DELETE FROM t1 WHERE c68='blob1';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c71 MEDIUMBLOB);
-INSERT INTO t1 VALUES ('mediumblob1');
-DELETE FROM t1 WHERE c71='mediumblob1';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c74 LONGBLOB);
-INSERT INTO t1 VALUES ('longblob1');
-DELETE FROM t1 WHERE c74='longblob1';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c66 TINYTEXT);
-INSERT INTO t1 VALUES ('tinytext1');
-DELETE FROM t1 WHERE c66='tinytext1';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c69 TEXT);
-INSERT INTO t1 VALUES ('text1');
-DELETE FROM t1 WHERE c69='text1';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c72 MEDIUMTEXT);
-INSERT INTO t1 VALUES ('mediumtext1');
-DELETE FROM t1 WHERE c72='mediumtext1';
-DROP TABLE t1;
-
-CREATE TABLE t1 (c75 LONGTEXT);
-INSERT INTO t1 VALUES ('longtext1');
-DELETE FROM t1 WHERE c75='longtext1';
-DROP TABLE t1;
-
-#
-
-CREATE TABLE t1 (c77 ENUM('a','b','c'));
-INSERT INTO t1 VALUES ('b');
-DELETE FROM t1 WHERE c77='b';
-DROP TABLE t1;
-
-#
-
-CREATE TABLE t1 (c78 SET('a','b','c','d','e','f'));
-INSERT INTO t1 VALUES ('a,b');
-INSERT INTO t1 VALUES ('a,c');
-INSERT INTO t1 VALUES ('b,c');
-INSERT INTO t1 VALUES ('a,b,c');
-INSERT INTO t1 VALUES ('a,b,c,d');
-INSERT INTO t1 VALUES ('a,b,c,d,e');
-INSERT INTO t1 VALUES ('a,b,c,d,e,f');
-DELETE FROM t1 WHERE c78='a,b';
-DROP TABLE t1;
-
-#
-# Check multi-table update
-#
-CREATE TABLE t1 (a int NOT NULL DEFAULT 0, b int NOT NULL DEFAULT 0);
-CREATE TABLE t2 (a int NOT NULL DEFAULT 0, b int NOT NULL DEFAULT 0);
-INSERT INTO t1 SET a=1;
-INSERT INTO t1 SET b=1;
-INSERT INTO t2 SET a=1;
-INSERT INTO t2 SET b=1;
-UPDATE t1, t2 SET t1.a=10, t2.a=20;
-DROP TABLE t1,t2;
-
-flush logs;
-
-let $MYSQLD_DATADIR= `select @@datadir`;
-
-# Test reading one file in raw mode
---exec $MYSQL_BINLOG --raw --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --result-file=$MYSQLTEST_VARDIR/tmp/ master-bin.000001
---diff_files $MYSQLTEST_VARDIR/tmp/master-bin.000001 $MYSQLD_DATADIR/master-bin.000001
---remove_file $MYSQLTEST_VARDIR/tmp/master-bin.000001
-
-# Test reading all files in raw mode
-# Don't test the end file since this is still open with mysqld so will be different
---exec $MYSQL_BINLOG --raw --read-from-remote-server --to-last-log --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --result-file=$MYSQLTEST_VARDIR/tmp/ master-bin.000001
---diff_files $MYSQLTEST_VARDIR/tmp/master-bin.000001 $MYSQLD_DATADIR/master-bin.000001
---diff_files $MYSQLTEST_VARDIR/tmp/master-bin.000002 $MYSQLD_DATADIR/master-bin.000002
-
---remove_file $MYSQLTEST_VARDIR/tmp/master-bin.000001
---remove_file $MYSQLTEST_VARDIR/tmp/master-bin.000002
---remove_file $MYSQLTEST_VARDIR/tmp/master-bin.000003
-
-
-# Test output to different filename
---exec $MYSQL_BINLOG --raw --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --result-file=$MYSQLTEST_VARDIR/tmp/server1- master-bin.000001
---diff_files $MYSQLTEST_VARDIR/tmp/server1-master-bin.000001 $MYSQLD_DATADIR/master-bin.000001
---remove_file $MYSQLTEST_VARDIR/tmp/server1-master-bin.000001
-
---echo End of tests
diff --git a/mysql-test/t/mysqlbinlog_row_big.test b/mysql-test/t/mysqlbinlog_row_big.test
deleted file mode 100644
index 229cc8a31fc..00000000000
--- a/mysql-test/t/mysqlbinlog_row_big.test
+++ /dev/null
@@ -1,148 +0,0 @@
-# mysqlbinlog_big.test
-#
-# Show that mysqlbinlog can handle big rows.
-#
-
-#
-# The *huge* output of mysqlbinlog will be redirected to
-# $MYSQLTEST_VARDIR/$mysqlbinlog_output
-#
---let $mysqlbinlog_output= tmp/mysqlbinlog_big_1.out
-
-#--source include/have_myisam.inc
---let $engine_type= MyISAM
-
-#
-# This test case is insensitive to the binlog format
-# because we don't display the output of mysqlbinlog.
-#
-#--source include/have_binlog_format_row.inc
-
---source include/have_log_bin.inc
-
-# This is a big test.
---source include/big_test.inc
-
---echo #
---echo # Preparatory cleanup.
---echo #
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
---echo #
---echo # We need a fixed timestamp to avoid varying results.
---echo #
-SET timestamp=1000000000;
-
---echo #
---echo # We need big packets.
---echo #
---echo # Capture initial value to reset at the end of the test
-# use let $<var> = query_get_value as FLUSH statements
-# in the test will set @<var> values to NULL
-let $orig_max_allowed_packet =
-query_get_value(SELECT @@global.max_allowed_packet, @@global.max_allowed_packet, 1);
-
---echo # Now adjust max_allowed_packet
-SET @@global.max_allowed_packet= 1024*1024*1024;
-
---echo max_allowed_packet is a global variable.
---echo In order for the preceding change in max_allowed_packets' value
---echo to be seen and used, we must start a new connection.
---echo The change does not take effect with the current one.
---echo For simplicity, we just disconnect / reconnect connection default here.
-disconnect default;
-connect (default, localhost,root,,);
-
---echo #
---echo # Delete all existing binary logs.
---echo #
-RESET MASTER;
-
---echo #
---echo # Create a test table.
---echo #
-eval CREATE TABLE t1 (
- c1 LONGTEXT
- ) ENGINE=$engine_type DEFAULT CHARSET latin1;
-
---echo #
---echo # Show how many rows are affected by each statement.
---echo #
---enable_info
-
---echo #
---echo # Insert some big rows.
---echo #
-
---echo 64MB
-INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 4194304));
-
---echo 32MB
-INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 2097152));
-
---echo 4MB
-INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 262144));
-
---echo 512KB
-INSERT INTO t1 VALUES (REPEAT('ManyMegaByteBlck', 32768));
-
---echo #
---echo # Show what we have in the table.
---echo # Do not display the column value itself, just its length.
---echo #
---sorted_result
-query_vertical SELECT LENGTH(c1) FROM t1;
-
---echo #
---echo # Grow the rows by updating.
---echo #
-UPDATE t1 SET c1 = CONCAT(c1, c1);
-
---echo #
---echo # Show what we have in the table.
---echo # Do not display the column value itself, just its length.
---echo #
---sorted_result
-query_vertical SELECT LENGTH(c1) FROM t1;
-
---echo #
---echo # Delete the rows.
---echo #
-DELETE FROM t1 WHERE c1 >= 'ManyMegaByteBlck';
-
---echo #
---echo # Hide how many rows are affected by each statement.
---echo #
---disable_info
-
---echo #
---echo # Flush all log buffers to the log file.
---echo #
-FLUSH LOGS;
-
---echo #
---echo # Call mysqlbinlog to display the log file contents.
---echo # NOTE: The output of mysqlbinlog is redirected to
---echo # \$MYSQLTEST_VARDIR/$mysqlbinlog_output
---echo # If you want to examine it, disable remove_file
---echo # at the bottom of the test script.
---echo #
-let $MYSQLD_DATADIR= `select @@datadir`;
---replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
---replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/
---exec $MYSQL_BINLOG -v -v $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/$mysqlbinlog_output
-
---echo #
---echo # Cleanup.
---echo #
---echo # reset variable value to pass testcase checks
-eval SET @@global.max_allowed_packet = $orig_max_allowed_packet;
-DROP TABLE t1;
-
---echo remove_file \$MYSQLTEST_VARDIR/$mysqlbinlog_output
-#
-# NOTE: If you want to see the *huge* mysqlbinlog output, disable next line:
-#
---remove_file $MYSQLTEST_VARDIR/$mysqlbinlog_output
diff --git a/mysql-test/t/mysqlbinlog_row_compressed.test b/mysql-test/t/mysqlbinlog_row_compressed.test
deleted file mode 100644
index 1a7ce093986..00000000000
--- a/mysql-test/t/mysqlbinlog_row_compressed.test
+++ /dev/null
@@ -1,68 +0,0 @@
-#
-# Test for compressed row event
-#
-
---source include/have_log_bin.inc
---source include/have_binlog_format_row.inc
-
-#
-#
-# mysqlbinlog: compressed row event
-#
-#
-
-SET GLOBAL log_bin_compress=on;
-SET GLOBAL log_bin_compress_min_len=10;
-CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1));
-CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1));
-INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "");
-INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL);
-INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A");
-INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A");
-INSERT INTO t2 SELECT * FROM t1;
-UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL;
-DELETE FROM t1;
-DELETE FROM t2;
-
---let $binlog = query_get_value(SHOW MASTER STATUS, File, 1)
---let $datadir = `SELECT @@datadir`
-
-FLUSH BINARY LOGS;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---replace_regex /\d{6} *\d*:\d\d:\d\d/<date>/ /Start:.*at startup/Start: xxx/ /SET TIMESTAMP=\d*/SET TIMESTAMP=X/ /exec_time=\d*/exec_time=x/ /mapped to number \d*/mapped to number num/ /CRC32 0x[0-9a-f]+/CRC32 XXX/
---exec $MYSQL_BINLOG --verbose --verbose --base64-output=DECODE-ROWS $datadir/$binlog
-
---echo
---echo Test mysqlbinlog | mysql type point-in-time recovery with compressed events.
---echo
-
-FLUSH BINARY LOGS;
---let $binlog_file = query_get_value(SHOW MASTER STATUS, File, 1)
-CREATE TABLE t3 (a INT PRIMARY KEY, b INT, c VARCHAR(100));
-INSERT INTO t3 VALUES (0, 10, "hello");
-BEGIN;
-INSERT INTO t3 VALUES (1, 10, "cat"), (2, 10, "mouse"), (3, 10, "dog");
-INSERT INTO t3 VALUES (4, 10, "goodbye");
-COMMIT;
-UPDATE t3 SET b=b+100 where a<>1;
-DELETE FROM t3 WHERE a=2;
-SET @old_image=@@binlog_row_image;
-SET binlog_row_image=minimal;
-INSERT INTO t3 VALUES (5, 20, "red"), (6, 30, "green"), (7, 40, "blue");
-INSERT INTO t3 VALUES (8, 20, "rigel");
-UPDATE t3 SET c = concat("colour of ", c) WHERE a > 5;
-UPDATE t3 SET b=b*2 WHERE a IN (5,6,7);
-DELETE FROM t3 WHERE a=6;
-SET binlog_row_image=@old_image;
-SELECT * FROM t3 ORDER BY a;
-FLUSH LOGS;
-DROP TABLE t3;
-
---let $MYSQLD_DATADIR= `select @@datadir`
---exec $MYSQL_BINLOG $MYSQLD_DATADIR/$binlog_file | $MYSQL
-
-SELECT * FROM t3 ORDER BY a;
-
-DROP TABLE t1,t2,t3;
-SET GLOBAL log_bin_compress=off;
-SET GLOBAL log_bin_compress_min_len=256;
diff --git a/mysql-test/t/mysqlbinlog_row_minimal.opt b/mysql-test/t/mysqlbinlog_row_minimal.opt
deleted file mode 100644
index 0e90a53dd3a..00000000000
--- a/mysql-test/t/mysqlbinlog_row_minimal.opt
+++ /dev/null
@@ -1 +0,0 @@
---binlog-row-image=minimal
diff --git a/mysql-test/t/mysqlbinlog_row_minimal.test b/mysql-test/t/mysqlbinlog_row_minimal.test
deleted file mode 100644
index 7909f75e9a1..00000000000
--- a/mysql-test/t/mysqlbinlog_row_minimal.test
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# Test for minimal row format
-#
-
---source include/have_log_bin.inc
---source include/have_binlog_format_row.inc
-
-#
-# MDEV-8426
-# mysqlbinlog: "Corrupted replication event was detected. Not printing the
-# value" with binlog-row-image=minimal
-#
-
-CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1));
-CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1));
-INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "");
-INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL);
-INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A");
-INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A");
-INSERT INTO t2 SELECT * FROM t1;
-UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL;
-DELETE FROM t1;
-DELETE FROM t2;
-
---let $binlog = query_get_value(SHOW MASTER STATUS, File, 1)
---let $datadir = `SELECT @@datadir`
-
-FLUSH BINARY LOGS;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---replace_regex /\d{6} *\d*:\d\d:\d\d/<date>/ /Start:.*at startup/Start: xxx/ /SET TIMESTAMP=\d*/SET TIMESTAMP=X/ /exec_time=\d*/exec_time=x/ /mapped to number \d*/mapped to number num/ /CRC32 0x[0-9a-f]+/CRC32 XXX/
---exec $MYSQL_BINLOG --verbose --verbose --base64-output=DECODE-ROWS $datadir/$binlog
-
-DROP TABLE t1,t2;
diff --git a/mysql-test/t/mysqlbinlog_stmt_compressed.test b/mysql-test/t/mysqlbinlog_stmt_compressed.test
deleted file mode 100644
index c4331ddf229..00000000000
--- a/mysql-test/t/mysqlbinlog_stmt_compressed.test
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-# Test for compressed query event
-#
-
---source include/have_log_bin.inc
---source include/have_binlog_format_statement.inc
-
-#
-#
-# mysqlbinlog: compressed query event
-#
-#
-
-SET GLOBAL log_bin_compress=on;
-SET GLOBAL log_bin_compress_min_len=10;
-CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1));
-CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1));
-INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "");
-INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL);
-INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A");
-INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A");
-INSERT INTO t2 SELECT * FROM t1;
-UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL;
-DELETE FROM t1;
-DELETE FROM t2;
-
---let $binlog = query_get_value(SHOW MASTER STATUS, File, 1)
---let $datadir = `SELECT @@datadir`
-
-FLUSH BINARY LOGS;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---replace_regex /\d{6} *\d*:\d\d:\d\d/<date>/ /Start:.*at startup/Start: xxx/ /SET TIMESTAMP=\d*/SET TIMESTAMP=X/ /exec_time=\d*/exec_time=x/ /mapped to number \d*/mapped to number num/ /CRC32 0x[0-9a-f]+/CRC32 XXX/
---exec $MYSQL_BINLOG --verbose --verbose --base64-output=DECODE-ROWS $datadir/$binlog
-
---echo
---echo Test mysqlbinlog | mysql type point-in-time recovery with compressed events.
---echo
-
-FLUSH BINARY LOGS;
---let $binlog_file = query_get_value(SHOW MASTER STATUS, File, 1)
-CREATE TABLE t3 (a INT PRIMARY KEY, b INT, c VARCHAR(100));
-INSERT INTO t3 VALUES (0, 10, "hello");
-BEGIN;
-INSERT INTO t3 VALUES (1, 10, "cat"), (2, 10, "mouse"), (3, 10, "dog");
-INSERT INTO t3 VALUES (4, 10, "goodbye");
-COMMIT;
-DELETE FROM t3 WHERE a=2;
-SELECT * FROM t3 ORDER BY a;
-FLUSH LOGS;
-DROP TABLE t3;
-
---let $MYSQLD_DATADIR= `select @@datadir`
---exec $MYSQL_BINLOG $MYSQLD_DATADIR/$binlog_file | $MYSQL
-
-SELECT * FROM t3 ORDER BY a;
-
-DROP TABLE t1,t2,t3;
-SET GLOBAL log_bin_compress=off;
-SET GLOBAL log_bin_compress_min_len=256;
diff --git a/mysql-test/t/mysqlcheck.test b/mysql-test/t/mysqlcheck.test
deleted file mode 100644
index 779ea8d13d4..00000000000
--- a/mysql-test/t/mysqlcheck.test
+++ /dev/null
@@ -1,409 +0,0 @@
-call mtr.add_suppression("Invalid .old.. table or database name");
-
-# Embedded server doesn't support external clients
---source include/not_embedded.inc
-
---source include/have_innodb.inc
-
-# check that CSV engine was compiled in, as the result of the test
-# depends on the presence of the log tables (which are CSV-based).
---source include/have_csv.inc
-let $MYSQLD_DATADIR= `select @@datadir`;
-
-#
-# Clean up after previous tests
-#
-
---disable_warnings
-DROP TABLE IF EXISTS t1, `t``1`, `t 1`, test.`t.1`, v1;
-drop view if exists t1, `t``1`, `t 1`, test.`t.1`, v1;
-drop database if exists client_test_db;
-# Repair any tables in mysql, sometimes the slow_log is marked as crashed
-# after server has been killed
---exec $MYSQL_CHECK --repair --databases mysql > /dev/null 2>&1
---enable_warnings
-
-#
-# Bug #13783 mysqlcheck tries to optimize and analyze information_schema
-#
---replace_result 'Table is already up to date' OK
---exec $MYSQL_CHECK --all-databases --analyze
---exec $MYSQL_CHECK --all-databases --optimize
---replace_result 'Table is already up to date' OK
---exec $MYSQL_CHECK --analyze --databases test information_schema mysql
---exec $MYSQL_CHECK --optimize --databases test information_schema mysql
---exec $MYSQL_CHECK --analyze information_schema schemata
---exec $MYSQL_CHECK --optimize information_schema schemata
-
-#
-# Bug #16502: mysqlcheck tries to check views
-#
-create table t1 (a int) engine=myisam;
-create view v1 as select * from t1;
---replace_result 'Table is already up to date' OK
---exec $MYSQL_CHECK --analyze --databases test
---exec $MYSQL_CHECK --optimize --databases test
---replace_result 'Table is already up to date' OK
---exec $MYSQL_CHECK --all-in-1 --analyze --databases test
---exec $MYSQL_CHECK --all-in-1 --optimize --databases test
-drop view v1;
-drop table t1;
-
-#
-# Bug #30654: mysqlcheck fails during upgrade of tables whose names include backticks
-#
-create table `t``1`(a int) engine=myisam;
-create table `t 1`(a int) engine=myisam;
---replace_result 'Table is already up to date' OK
---exec $MYSQL_CHECK --databases test
-drop table `t``1`, `t 1`;
-
-#
-# Bug#25347: mysqlcheck -A -r doesn't repair table marked as crashed
-#
-create database d_bug25347;
-use d_bug25347;
-create table t_bug25347 (a int) engine=myisam;
-create view v_bug25347 as select * from t_bug25347;
-insert into t_bug25347 values (1),(2),(3);
-flush tables;
---echo removing and creating
---remove_file $MYSQLD_DATADIR/d_bug25347/t_bug25347.MYI
---write_file $MYSQLD_DATADIR/d_bug25347/t_bug25347.MYI
-EOF
---exec $MYSQL_CHECK --repair --databases d_bug25347
---error 130
-insert into t_bug25347 values (4),(5),(6);
---exec $MYSQL_CHECK --repair --use-frm --databases d_bug25347
-insert into t_bug25347 values (7),(8),(9);
-select * from t_bug25347;
-select * from v_bug25347;
-drop view v_bug25347;
-drop table t_bug25347;
-drop database d_bug25347;
-use test;
-
-#
-# Bug#39541 CHECK TABLE on information_schema myisam tables produces error
-#
-create view v1 as select * from information_schema.routines;
-check table v1, information_schema.routines;
-drop view v1;
-
-#
-# Bug#37527: mysqlcheck fails to report entire database
-# when frm file corruption
-#
-call mtr.add_suppression("Error reading file './test/t1.frm'");
-CREATE TABLE t1(a INT) engine=myisam;
-CREATE TABLE t2(a INT) engine=myisam;
-# backup then null t1.frm
---copy_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_DATADIR/test/t1.frm.bak
---remove_file $MYSQLD_DATADIR/test/t1.frm
---write_file $MYSQLD_DATADIR/test/t1.frm
-EOF
---exec $MYSQL_CHECK test
-# restore t1.frm
---remove_file $MYSQLD_DATADIR/test/t1.frm
---copy_file $MYSQLD_DATADIR/test/t1.frm.bak $MYSQLD_DATADIR/test/t1.frm
---remove_file $MYSQLD_DATADIR/test/t1.frm.bak
-DROP TABLE t1, t2;
-
-
---echo End of 5.0 tests
-
-
-#
-# Bug #30679: 5.1 name encoding not performed for views during upgrade
-#
-create table t1(a int) engine=myisam;
-create view v1 as select * from t1;
-show tables;
---copy_file $MYSQLD_DATADIR/test/v1.frm $MYSQLD_DATADIR/test/v-1.frm
-show tables;
---exec $MYSQL_CHECK --check-upgrade --databases test
---exec $MYSQL_CHECK --fix-table-names --databases test
-show tables;
-drop view v1, `v-1`;
-drop table t1;
-
-
-#
-# Bug #33094: Error in upgrading from 5.0 to 5.1 when table contains triggers
-# Bug #41385: Crash when attempting to repair a #mysql50# upgraded table with
-# triggers
-#
-SET NAMES utf8;
-CREATE TABLE `#mysql50#@` (a INT) engine=myisam;
-SHOW TABLES;
-SET NAMES DEFAULT;
---echo mysqlcheck --fix-table-names --databases test
---exec $MYSQL_CHECK --fix-table-names --databases test
-SET NAMES utf8;
-SHOW TABLES;
-DROP TABLE `@`;
-
-CREATE TABLE `я` (a INT) engine=myisam;
-SET NAMES DEFAULT;
-call mtr.add_suppression("@003f.frm' \\(errno: 22\\)");
---echo mysqlcheck --default-character-set="latin1" --databases test
-# Error returned depends on platform, replace it with "Table doesn't exist"
-call mtr.add_suppression("Can't find file: '..test.@003f.frm'");
---replace_result "Can't find file: './test/@003f.frm' (errno: 22)" "Table doesn't exist" "Table 'test.?' doesn't exist" "Table doesn't exist"
---exec $MYSQL_CHECK --default-character-set="latin1" --databases test
---echo mysqlcheck --default-character-set="utf8" --databases test
---exec $MYSQL_CHECK --default-character-set="utf8" --databases test
-SET NAMES utf8;
-DROP TABLE `я`;
-SET NAMES DEFAULT;
-
-CREATE DATABASE `#mysql50#a@b`;
-USE `#mysql50#a@b`;
-CREATE TABLE `#mysql50#c@d` (a INT) engine=myisam;
-CREATE TABLE t1 (a INT) engine=myisam;
-
-# Create 5.0 like triggers
---write_file $MYSQLD_DATADIR/a@b/c@d.TRG
-TYPE=TRIGGERS
-triggers='CREATE DEFINER=`root`@`localhost` TRIGGER tr1 BEFORE INSERT ON `c@d` FOR EACH ROW SET NEW.a = 10 * NEW.a'
-sql_modes=0
-definers='root@localhost'
-EOF
---write_file $MYSQLD_DATADIR/a@b/tr1.TRN
-TYPE=TRIGGERNAME
-trigger_table=c@d
-EOF
---write_file $MYSQLD_DATADIR/a@b/t1.TRG
-TYPE=TRIGGERS
-triggers='CREATE DEFINER=`root`@`localhost` TRIGGER tr2 BEFORE INSERT ON `a@b`.t1 FOR EACH ROW SET NEW.a = 100 * NEW.a'
-sql_modes=0
-definers='root@localhost'
-EOF
---write_file $MYSQLD_DATADIR/a@b/tr2.TRN
-TYPE=TRIGGERNAME
-trigger_table=t1
-EOF
-
-SELECT * FROM INFORMATION_SCHEMA.TRIGGERS
- WHERE TRIGGER_SCHEMA="#mysql50#a@b" ORDER BY trigger_name;
-
---echo mysqlcheck --fix-db-names --fix-table-names --all-databases
---exec $MYSQL_CHECK --default-character-set=utf8 --fix-db-names --fix-table-names --all-databases
-
-USE `a@b`;
-SELECT * FROM INFORMATION_SCHEMA.TRIGGERS
- WHERE TRIGGER_SCHEMA="a@b" ORDER BY trigger_name;
-
-INSERT INTO `c@d` VALUES (2), (1);
-SELECT * FROM `c@d`;
-INSERT INTO t1 VALUES (3), (5);
-SELECT * FROM t1;
-
-DROP DATABASE `a@b`;
-
-USE test;
-
---echo #
---echo # Bug #31821: --all-in-1 and --fix-table-names don't work together
---echo #
-
---disable_warnings
-drop table if exists `#mysql50#t1-1`;
---enable_warnings
-
-create table `#mysql50#t1-1` (a int) engine=myisam;
---exec $MYSQL_CHECK --all-in-1 --fix-table-names --databases test
-show tables like 't1-1';
-drop table `t1-1`;
-
-create table `#mysql50#t1-1` (a int) engine=myisam;
---exec $MYSQL_CHECK --all-in-1 --fix-table-names test "#mysql50#t1-1"
-show tables like 't1-1';
-drop table `t1-1`;
-
---echo End of 5.1 tests
-
-
---echo #
---echo # Bug #35269: mysqlcheck behaves different depending on order of parameters
---echo #
-
---error 13
---exec $MYSQL_CHECK -a --fix-table-names test "#mysql50#t1-1"
---error 1
---exec $MYSQL_CHECK -aoc test "#mysql50#t1-1"
-
-
---echo #
---echo # Bug#11755431 47205: MAP 'REPAIR TABLE' TO RECREATE +ANALYZE FOR
---echo # ENGINES NOT SUPPORTING NATIVE
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS bug47205;
---enable_warnings
-
---echo #
---echo # Test 1: Check that ALTER TABLE ... rebuilds the table
-
-CREATE TABLE bug47205(a VARCHAR(20) PRIMARY KEY)
- DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci engine=innodb;
-
-INSERT INTO bug47205 VALUES ("foobar");
-FLUSH TABLE bug47205;
-
---echo # Replace the FRM with a 5.0 FRM that will require upgrade
---remove_file $MYSQLD_DATADIR/test/bug47205.frm
---copy_file std_data/bug47205.frm $MYSQLD_DATADIR/test/bug47205.frm
-
---echo # Should indicate that ALTER TABLE ... FORCE is needed
-CHECK TABLE bug47205 FOR UPGRADE;
-
---echo # ALTER TABLE ... FORCE should rebuild the table
-ALTER TABLE bug47205 FORCE;
-
---echo # Table should now be ok
-CHECK TABLE bug47205 FOR UPGRADE;
-
-DROP TABLE bug47205;
-
---echo #
---echo # Test 2: InnoDB - REPAIR not supported
-
-CREATE TABLE bug47205(a VARCHAR(20) PRIMARY KEY)
- DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci engine=innodb;
-
-FLUSH TABLE bug47205;
-
---echo # Replace the FRM with a 5.0 FRM that will require upgrade
---remove_file $MYSQLD_DATADIR/test/bug47205.frm
---copy_file std_data/bug47205.frm $MYSQLD_DATADIR/test/bug47205.frm
-
---echo # Should indicate that ALTER TABLE .. FORCE is needed
-CHECK TABLE bug47205 FOR UPGRADE;
-
---echo # Running mysqlcheck to check and upgrade
---exec $MYSQL_CHECK --check-upgrade --auto-repair test
-
---echo # Table should now be ok
-CHECK TABLE bug47205 FOR UPGRADE;
-
-DROP TABLE bug47205;
-
---echo #
---echo # Test 3: MyISAM - REPAIR supported
-
---echo # Use an old FRM that will require upgrade
---copy_file std_data/bug36055.frm $MYSQLD_DATADIR/test/bug47205.frm
---copy_file std_data/bug36055.MYD $MYSQLD_DATADIR/test/bug47205.MYD
---copy_file std_data/bug36055.MYI $MYSQLD_DATADIR/test/bug47205.MYI
-
---echo # Should indicate that REPAIR TABLE is needed
-CHECK TABLE bug47205 FOR UPGRADE;
-
---echo # Running mysqlcheck to check and upgrade
---exec $MYSQL_CHECK --check-upgrade --auto-repair test
-
---echo # Table should now be ok
-CHECK TABLE bug47205 FOR UPGRADE;
-
-DROP TABLE bug47205;
-
-
---echo #
---echo #MDEV-6128:[PATCH] mysqlcheck wrongly escapes '.' in table names
---echo #
-create table `t.1` (id int);
-create view `v.1` as select 1;
-
---echo mysqlcheck test t.1
---exec $MYSQL_CHECK test t.1
---echo mysqlcheck --all-in-1 test t.1
---exec $MYSQL_CHECK --all-in-1 test t.1
---echo mysqlcheck --all-in-1 --databases --process-views test
---exec $MYSQL_CHECK --all-in-1 --databases --process-views test
-
-create table `t.2`(a varchar(20) primary key) default character set utf8 collate utf8_general_ci engine=innodb;
-flush table `t.2`;
---remove_file $MYSQLD_DATADIR/test/t@002e2.frm
---copy_file std_data/bug47205.frm $MYSQLD_DATADIR/test/t@002e2.frm
-
---copy_file std_data/bug36055.frm $MYSQLD_DATADIR/test/t@002e3.frm
---copy_file std_data/bug36055.MYD $MYSQLD_DATADIR/test/t@002e3.MYD
---copy_file std_data/bug36055.MYI $MYSQLD_DATADIR/test/t@002e3.MYI
-
---echo mysqlcheck --check-upgrade --auto-repair test
---exec $MYSQL_CHECK --check-upgrade --auto-repair test
-
-check table `t.1`, `t.2`, `t.3`;
-check table `t.1`, `t.2`, `t.3` for upgrade;
-drop view `v.1`;
-drop table test.`t.1`, `t.2`, `t.3`;
-
---echo #
---echo # MDEV-8123 mysqlcheck: new --process-views option conflicts with --quick, --extended and such
---echo #
-create view v1 as select 1;
---echo mysqlcheck --process-views test
---exec $MYSQL_CHECK --process-views test
---echo mysqlcheck --process-views --extended test
---exec $MYSQL_CHECK --process-views --extended test
---echo mysqlcheck --process-views --fast test
---exec $MYSQL_CHECK --process-views --fast test
---echo mysqlcheck --process-views --quick test
---exec $MYSQL_CHECK --process-views --quick test
---echo mysqlcheck --process-views --check-only-changed test
---exec $MYSQL_CHECK --process-views --check-only-changed test
---echo mysqlcheck --process-views --medium-check test
---exec $MYSQL_CHECK --process-views --medium-check test
---echo mysqlcheck --process-views --check-upgrade test
---exec $MYSQL_CHECK --process-views --check-upgrade test
-drop view v1;
-
-
---echo #
---echo # MDEV-8124 mysqlcheck: --auto-repair runs REPAIR TABLE instead of REPAIR VIEW on views
---echo #
-create table t1(a int);
---copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v1.frm $MYSQLD_DATADIR/test/v1.frm
---echo mysqlcheck --process-views --check-upgrade --auto-repair test
---exec $MYSQL_CHECK --process-views --check-upgrade --auto-repair test
-drop view v1;
-drop table t1;
-
-create table `#mysql50#t1``1` (a int) engine=myisam;
---exec $MYSQL_CHECK --fix-table-names --databases test
-show tables;
-drop table `t1``1`;
-
-#
-# MDEV-9440 mysqlcheck -A --auto-repair selects wrong database when trying to repair broken table
-#
-call mtr.add_suppression("ha_myisam");
-call mtr.add_suppression("Checking table");
-create database mysqltest1;
-create table mysqltest1.t1 (a int) engine=myisam;
-create table t2 (a int);
-
-let $datadir= `select @@datadir`;
-remove_file $datadir/mysqltest1/t1.MYD;
-write_file $datadir/mysqltest1/t1.MYD;
-foo
-EOF
-
-check table mysqltest1.t1;
-
---exec $MYSQL_CHECK -A --auto-repair --fast
-
-drop table t2;
-drop database mysqltest1;
-
---echo #
---echo #MDEV-7384 [PATCH] add PERSISENT FOR ALL option to mysqlanalyze/mysqlcheck
---echo #
-create table t1(a int);
-insert into t1 (a) values (1), (2), (3);
-select * from mysql.column_stats;
---exec $MYSQL_CHECK --analyze test t1 --persistent
-select * from mysql.column_stats where db_name = 'test' and table_name = 't1';
-drop table t1;
diff --git a/mysql-test/t/mysqld--defaults-file.test b/mysql-test/t/mysqld--defaults-file.test
deleted file mode 100644
index 3bfe0aa891f..00000000000
--- a/mysql-test/t/mysqld--defaults-file.test
+++ /dev/null
@@ -1,31 +0,0 @@
-# BUG#58455
-# Starting mysqld with defaults file without extension cause
-# segmentation fault
-
-source include/not_embedded.inc;
-source include/not_windows.inc;
-
-# All these tests refer to configuration files that do not exist
-
---error 1
-exec $MYSQLD --defaults-file=/path/with/no/extension --print-defaults 2>&1;
-
---error 1
-exec $MYSQLD --defaults-file=/path/with.ext --print-defaults 2>&1;
-
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---error 1
-exec $MYSQLD --defaults-file=relative/path/with.ext --print-defaults 2>&1;
-
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---error 1
-exec $MYSQLD --defaults-file=relative/path/without/extension --print-defaults 2>&1;
-
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---error 1
-exec $MYSQLD --defaults-file=with.ext --print-defaults 2>&1;
-
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---error 1
-exec $MYSQLD --defaults-file=no_extension --print-defaults 2>&1;
-
diff --git a/mysql-test/t/mysqld--help.test b/mysql-test/t/mysqld--help.test
deleted file mode 100644
index 27d3286685b..00000000000
--- a/mysql-test/t/mysqld--help.test
+++ /dev/null
@@ -1,69 +0,0 @@
-#
-# mysqld --help
-#
---source include/not_embedded.inc
---source include/have_perfschema.inc
---source include/have_profiling.inc
---source include/platform.inc
-
-#
-# force lower-case-table-names=1 (linux/macosx have different defaults)
-# force symbolic-links=0 (valgrind build has a different default)
-#
-
-exec $MYSQLD_BOOTSTRAP_CMD --symbolic-links=0 --lower-case-table-names=1 --help --verbose > $MYSQL_TMP_DIR/mysqld--help.txt 2>&1;
-
-# The inline perl code below will copy $MYSQL_TMP_DIR/mysqld--help.txt
-# to output, but filter away some variable stuff (e.g. paths).
-
-perl;
- # Variables which we don't want to display in the result file since
- # their paths may vary:
- @skipvars=qw/basedir open-files-limit general-log-file log plugin-dir plugin-maturity
- log-slow-queries pid-file slow-query-log-file log-basename
- datadir slave-load-tmpdir tmpdir socket thread-pool-size
- large-files-support lower-case-file-system system-time-zone
- collation-server character-set-server log-tc-size version.*/;
-
- # Plugins which may or may not be there:
- @plugins=qw/innodb archive blackhole federated partition
- feedback debug temp-pool ssl des-key-file xtradb sequence
- thread-concurrency super-large-pages mutex-deadlock-detector
- connect null-audit aria oqgraph sphinx thread-handling
- test-sql-discovery query-cache-info in-predicate-conversion-threshold
- query-response-time metadata-lock-info locales unix-socket
- wsrep file-key-management cracklib-password-check user-variables/;
-
- # And substitute the content some environment variables with their
- # names:
- @env=qw/MYSQLTEST_VARDIR MYSQL_TEST_DIR MYSQL_CHARSETSDIR MYSQL_SHAREDIR/;
-
- $re1=join('|', @skipvars, @plugins);
- $re2=join('|', @plugins);
- $skip=0;
- open(F, '<', "$ENV{MYSQL_TMP_DIR}/mysqld--help.txt") or die;
- print "Windows bug: happens when a new line is exactly at the right offset.\n";
- while (<F>) {
- next if 1../The following groups are read/;
- # formatting, skip line consisting entirely of dashes and blanks
- next if /^[\- ]+\s?$/;
- next if /Value \(after reading options\)/; # skip table header
- next if /^($re1) /;
- next if /^($re2)-/;
- $skip=0 if /^ -/ or /^$/;
- $skip=1 if / --($re2)\b/;
- y!\\!/!;
- s/[ ]+/ /; # squeeze spaces to remove table formatting
- # fixes for 32-bit
- s/\b4294967295\b/18446744073709551615/;
- s/\b2146435072\b/9223372036853727232/;
- s/\b196608\b/262144/;
- s/\b4294963200\b/18446744073709547520/;
- foreach $var (@env) { s/\Q$ENV{$var}\E/$var/ }
- next if /use --skip-(use-)?symbolic-links to disable/; # for valgrind, again
- next if $skip;
- print;
- }
- close F;
-EOF
-
diff --git a/mysql-test/t/mysqld_help_crash-9183.test b/mysql-test/t/mysqld_help_crash-9183.test
deleted file mode 100644
index ff7df32e1d6..00000000000
--- a/mysql-test/t/mysqld_help_crash-9183.test
+++ /dev/null
@@ -1,9 +0,0 @@
-#
-# MDEV-9183 MariaDB 10.1 crash on `mysqld --verbose --help`
-#
-
-rename table mysql.plugin to test.plugin;
-flush tables;
---exec $MYSQLD_CMD --help --verbose >/dev/null 2>&1
-rename table test.plugin to mysql.plugin;
-
diff --git a/mysql-test/t/mysqld_option_err.test b/mysql-test/t/mysqld_option_err.test
deleted file mode 100644
index 0c38eba7ca9..00000000000
--- a/mysql-test/t/mysqld_option_err.test
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-# Test error checks on mysqld command line option parsing.
-#
-# Call mysqld with different invalid options, and check that it fails in each case.
-#
-# This means that a test failure results in mysqld starting up, which is only
-# caught when the test case times out. This is not ideal, but I did not find an
-# easy way to have the server shut down after a successful startup.
-#
-
---source include/not_embedded.inc
-
-# mysqld refuses to run as root normally.
--- source include/not_as_root.inc
-
-# We have not run (and do not need) bootstrap of the server. We just
-# give it a dummy data directory (for log files etc).
-
-mkdir $MYSQLTEST_VARDIR/tmp/mysqld_option_err;
-
-
---echo Test that unknown option is not silently ignored.
---error 2
---exec $MYSQLD_BOOTSTRAP_CMD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables --nonexistentoption >$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
-
-
---echo Test bad binlog format.
---error 1
---exec $MYSQLD_BOOTSTRAP_CMD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables --log-bin --binlog-format=badformat >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
-
-
---echo Test bad default storage engine.
---error 1
---exec $MYSQLD_BOOTSTRAP_CMD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables --default-storage-engine=nonexistentengine >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
-
-
---echo Test non-numeric value passed to number option.
---error 1
---exec $MYSQLD_BOOTSTRAP_CMD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables --min-examined-row-limit=notanumber >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
-
-
-# Test for MBug#423035: error in parsing enum value for plugin
-# variable in mysqld command-line option.
-# See also Bug#32034.
---echo Test that bad value for plugin enum option is rejected correctly.
---error 7
---exec $MYSQLD_BOOTSTRAP_CMD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables --plugin-dir=$MYSQLTEST_VARDIR/plugins --plugin-load=example=ha_example.so --plugin-example-enum-var=noexist >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
-
-#
-# Test that an wrong option with --help --verbose gives an error
-#
-
---echo Test that --help --verbose works
---exec $MYSQLD_BOOTSTRAP_CMD --help --verbose >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
---echo Test that --not-known-option --help --verbose gives error
---error 2
---exec $MYSQLD_BOOTSTRAP_CMD --not-known-option --help --verbose >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
-
---echo Done.
diff --git a/mysql-test/t/mysqldump-compat.opt b/mysql-test/t/mysqldump-compat.opt
deleted file mode 100644
index ac3d0509f2c..00000000000
--- a/mysql-test/t/mysqldump-compat.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-debug-dbug=d,4x_server_emul
diff --git a/mysql-test/t/mysqldump-compat.test b/mysql-test/t/mysqldump-compat.test
deleted file mode 100644
index 9a830b16f26..00000000000
--- a/mysql-test/t/mysqldump-compat.test
+++ /dev/null
@@ -1,17 +0,0 @@
-# Embedded server doesn't support external clients
---source include/not_embedded.inc
-
-#
-# Bug #30126: semicolon before closing */ in /*!... CREATE DATABASE ;*/
-#
-
---let $file = $MYSQLTEST_VARDIR/tmp/bug30126.sql
-
-CREATE DATABASE mysqldump_30126;
-USE mysqldump_30126;
-CREATE TABLE t1 (c1 int);
---exec $MYSQL_DUMP --add-drop-database mysqldump_30126 > $file
---exec $MYSQL mysqldump_30126 < $file
-DROP DATABASE mysqldump_30126;
-
---remove_file $file
diff --git a/mysql-test/t/mysqldump-max-master.opt b/mysql-test/t/mysqldump-max-master.opt
deleted file mode 100644
index 96f0ce3f36c..00000000000
--- a/mysql-test/t/mysqldump-max-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---default-storage-engine=MyISAM
diff --git a/mysql-test/t/mysqldump-max.test b/mysql-test/t/mysqldump-max.test
deleted file mode 100644
index c0596f27e4f..00000000000
--- a/mysql-test/t/mysqldump-max.test
+++ /dev/null
@@ -1,1203 +0,0 @@
-# Embedded server doesn't support external clients
---source include/not_embedded.inc
---source include/have_innodb.inc
---source include/have_archive.inc
---source include/have_log_bin.inc
-
---disable_warnings
-drop table if exists t1, t2, t3, t4, t5, t6;
---enable_warnings
-
-create table t1 (id int(8), name varchar(32));
-create table t2 (id int(8), name varchar(32)) ENGINE="MyISAM";
-create table t3 (id int(8), name varchar(32)) ENGINE="MEMORY";
-create table t4 (id int(8), name varchar(32)) ENGINE="HEAP";
-create table t5 (id int(8), name varchar(32)) ENGINE="ARCHIVE";
-create table t6 (id int(8), name varchar(32)) ENGINE="InnoDB";
-
-insert into t1 values (1, 'first value');
-insert into t1 values (2, 'first value');
-insert into t1 values (3, 'first value');
-insert into t1 values (4, 'first value');
-insert into t1 values (5, 'first value');
-
-insert into t2 values (1, 'first value');
-insert into t2 values (2, 'first value');
-insert into t2 values (3, 'first value');
-insert into t2 values (4, 'first value');
-insert into t2 values (5, 'first value');
-
-insert into t3 values (1, 'first value');
-insert into t3 values (2, 'first value');
-insert into t3 values (3, 'first value');
-insert into t3 values (4, 'first value');
-insert into t3 values (5, 'first value');
-
-insert into t4 values (1, 'first value');
-insert into t4 values (2, 'first value');
-insert into t4 values (3, 'first value');
-insert into t4 values (4, 'first value');
-insert into t4 values (5, 'first value');
-
-insert into t5 values (1, 'first value');
-insert into t5 values (2, 'first value');
-insert into t5 values (3, 'first value');
-insert into t5 values (4, 'first value');
-insert into t5 values (5, 'first value');
-
-insert into t6 values (1, 'first value');
-insert into t6 values (2, 'first value');
-insert into t6 values (3, 'first value');
-insert into t6 values (4, 'first value');
-insert into t6 values (5, 'first value');
-
-select * from t1;
-select * from t2;
-select * from t3;
-select * from t4;
-select * from t5;
-select * from t6;
-
---exec $MYSQL_DUMP --skip-comments --delayed-insert --insert-ignore --databases test
---exec $MYSQL_DUMP --skip-comments --delayed-insert --databases test
-
-drop table t1;
-drop table t2;
-drop table t3;
-drop table t4;
-drop table t5;
-drop table t6;
-
-
-#
-# Bug#31434 - mysqldump dumps view as table
-#
-
-# Show that mysqldump's stand-in tables for views are always of MyISAM
-# type to avoid Inno's column-number limits (~1000 columns) etc.
-# Here because it needs Inno-engine.
-
-SELECT @@global.storage_engine INTO @old_engine;
-SET GLOBAL storage_engine=InnoDB;
-
---disable_query_log
-CREATE TABLE `t1` (
- `col_0` tinyint(1) default NULL,
- `col_1` tinyint(1) default NULL,
- `col_2` tinyint(1) default NULL,
- `col_3` tinyint(1) default NULL,
- `col_4` tinyint(1) default NULL,
- `col_5` tinyint(1) default NULL,
- `col_6` tinyint(1) default NULL,
- `col_7` tinyint(1) default NULL,
- `col_8` tinyint(1) default NULL,
- `col_9` tinyint(1) default NULL,
- `col_10` tinyint(1) default NULL,
- `col_11` tinyint(1) default NULL,
- `col_12` tinyint(1) default NULL,
- `col_13` tinyint(1) default NULL,
- `col_14` tinyint(1) default NULL,
- `col_15` tinyint(1) default NULL,
- `col_16` tinyint(1) default NULL,
- `col_17` tinyint(1) default NULL,
- `col_18` tinyint(1) default NULL,
- `col_19` tinyint(1) default NULL,
- `col_20` tinyint(1) default NULL,
- `col_21` tinyint(1) default NULL,
- `col_22` tinyint(1) default NULL,
- `col_23` tinyint(1) default NULL,
- `col_24` tinyint(1) default NULL,
- `col_25` tinyint(1) default NULL,
- `col_26` tinyint(1) default NULL,
- `col_27` tinyint(1) default NULL,
- `col_28` tinyint(1) default NULL,
- `col_29` tinyint(1) default NULL,
- `col_30` tinyint(1) default NULL,
- `col_31` tinyint(1) default NULL,
- `col_32` tinyint(1) default NULL,
- `col_33` tinyint(1) default NULL,
- `col_34` tinyint(1) default NULL,
- `col_35` tinyint(1) default NULL,
- `col_36` tinyint(1) default NULL,
- `col_37` tinyint(1) default NULL,
- `col_38` tinyint(1) default NULL,
- `col_39` tinyint(1) default NULL,
- `col_40` tinyint(1) default NULL,
- `col_41` tinyint(1) default NULL,
- `col_42` tinyint(1) default NULL,
- `col_43` tinyint(1) default NULL,
- `col_44` tinyint(1) default NULL,
- `col_45` tinyint(1) default NULL,
- `col_46` tinyint(1) default NULL,
- `col_47` tinyint(1) default NULL,
- `col_48` tinyint(1) default NULL,
- `col_49` tinyint(1) default NULL,
- `col_50` tinyint(1) default NULL,
- `col_51` tinyint(1) default NULL,
- `col_52` tinyint(1) default NULL,
- `col_53` tinyint(1) default NULL,
- `col_54` tinyint(1) default NULL,
- `col_55` tinyint(1) default NULL,
- `col_56` tinyint(1) default NULL,
- `col_57` tinyint(1) default NULL,
- `col_58` tinyint(1) default NULL,
- `col_59` tinyint(1) default NULL,
- `col_60` tinyint(1) default NULL,
- `col_61` tinyint(1) default NULL,
- `col_62` tinyint(1) default NULL,
- `col_63` tinyint(1) default NULL,
- `col_64` tinyint(1) default NULL,
- `col_65` tinyint(1) default NULL,
- `col_66` tinyint(1) default NULL,
- `col_67` tinyint(1) default NULL,
- `col_68` tinyint(1) default NULL,
- `col_69` tinyint(1) default NULL,
- `col_70` tinyint(1) default NULL,
- `col_71` tinyint(1) default NULL,
- `col_72` tinyint(1) default NULL,
- `col_73` tinyint(1) default NULL,
- `col_74` tinyint(1) default NULL,
- `col_75` tinyint(1) default NULL,
- `col_76` tinyint(1) default NULL,
- `col_77` tinyint(1) default NULL,
- `col_78` tinyint(1) default NULL,
- `col_79` tinyint(1) default NULL,
- `col_80` tinyint(1) default NULL,
- `col_81` tinyint(1) default NULL,
- `col_82` tinyint(1) default NULL,
- `col_83` tinyint(1) default NULL,
- `col_84` tinyint(1) default NULL,
- `col_85` tinyint(1) default NULL,
- `col_86` tinyint(1) default NULL,
- `col_87` tinyint(1) default NULL,
- `col_88` tinyint(1) default NULL,
- `col_89` tinyint(1) default NULL,
- `col_90` tinyint(1) default NULL,
- `col_91` tinyint(1) default NULL,
- `col_92` tinyint(1) default NULL,
- `col_93` tinyint(1) default NULL,
- `col_94` tinyint(1) default NULL,
- `col_95` tinyint(1) default NULL,
- `col_96` tinyint(1) default NULL,
- `col_97` tinyint(1) default NULL,
- `col_98` tinyint(1) default NULL,
- `col_99` tinyint(1) default NULL,
- `col_100` tinyint(1) default NULL,
- `col_101` tinyint(1) default NULL,
- `col_102` tinyint(1) default NULL,
- `col_103` tinyint(1) default NULL,
- `col_104` tinyint(1) default NULL,
- `col_105` tinyint(1) default NULL,
- `col_106` tinyint(1) default NULL,
- `col_107` tinyint(1) default NULL,
- `col_108` tinyint(1) default NULL,
- `col_109` tinyint(1) default NULL,
- `col_110` tinyint(1) default NULL,
- `col_111` tinyint(1) default NULL,
- `col_112` tinyint(1) default NULL,
- `col_113` tinyint(1) default NULL,
- `col_114` tinyint(1) default NULL,
- `col_115` tinyint(1) default NULL,
- `col_116` tinyint(1) default NULL,
- `col_117` tinyint(1) default NULL,
- `col_118` tinyint(1) default NULL,
- `col_119` tinyint(1) default NULL,
- `col_120` tinyint(1) default NULL,
- `col_121` tinyint(1) default NULL,
- `col_122` tinyint(1) default NULL,
- `col_123` tinyint(1) default NULL,
- `col_124` tinyint(1) default NULL,
- `col_125` tinyint(1) default NULL,
- `col_126` tinyint(1) default NULL,
- `col_127` tinyint(1) default NULL,
- `col_128` tinyint(1) default NULL,
- `col_129` tinyint(1) default NULL,
- `col_130` tinyint(1) default NULL,
- `col_131` tinyint(1) default NULL,
- `col_132` tinyint(1) default NULL,
- `col_133` tinyint(1) default NULL,
- `col_134` tinyint(1) default NULL,
- `col_135` tinyint(1) default NULL,
- `col_136` tinyint(1) default NULL,
- `col_137` tinyint(1) default NULL,
- `col_138` tinyint(1) default NULL,
- `col_139` tinyint(1) default NULL,
- `col_140` tinyint(1) default NULL,
- `col_141` tinyint(1) default NULL,
- `col_142` tinyint(1) default NULL,
- `col_143` tinyint(1) default NULL,
- `col_144` tinyint(1) default NULL,
- `col_145` tinyint(1) default NULL,
- `col_146` tinyint(1) default NULL,
- `col_147` tinyint(1) default NULL,
- `col_148` tinyint(1) default NULL,
- `col_149` tinyint(1) default NULL,
- `col_150` tinyint(1) default NULL,
- `col_151` tinyint(1) default NULL,
- `col_152` tinyint(1) default NULL,
- `col_153` tinyint(1) default NULL,
- `col_154` tinyint(1) default NULL,
- `col_155` tinyint(1) default NULL,
- `col_156` tinyint(1) default NULL,
- `col_157` tinyint(1) default NULL,
- `col_158` tinyint(1) default NULL,
- `col_159` tinyint(1) default NULL,
- `col_160` tinyint(1) default NULL,
- `col_161` tinyint(1) default NULL,
- `col_162` tinyint(1) default NULL,
- `col_163` tinyint(1) default NULL,
- `col_164` tinyint(1) default NULL,
- `col_165` tinyint(1) default NULL,
- `col_166` tinyint(1) default NULL,
- `col_167` tinyint(1) default NULL,
- `col_168` tinyint(1) default NULL,
- `col_169` tinyint(1) default NULL,
- `col_170` tinyint(1) default NULL,
- `col_171` tinyint(1) default NULL,
- `col_172` tinyint(1) default NULL,
- `col_173` tinyint(1) default NULL,
- `col_174` tinyint(1) default NULL,
- `col_175` tinyint(1) default NULL,
- `col_176` tinyint(1) default NULL,
- `col_177` tinyint(1) default NULL,
- `col_178` tinyint(1) default NULL,
- `col_179` tinyint(1) default NULL,
- `col_180` tinyint(1) default NULL,
- `col_181` tinyint(1) default NULL,
- `col_182` tinyint(1) default NULL,
- `col_183` tinyint(1) default NULL,
- `col_184` tinyint(1) default NULL,
- `col_185` tinyint(1) default NULL,
- `col_186` tinyint(1) default NULL,
- `col_187` tinyint(1) default NULL,
- `col_188` tinyint(1) default NULL,
- `col_189` tinyint(1) default NULL,
- `col_190` tinyint(1) default NULL,
- `col_191` tinyint(1) default NULL,
- `col_192` tinyint(1) default NULL,
- `col_193` tinyint(1) default NULL,
- `col_194` tinyint(1) default NULL,
- `col_195` tinyint(1) default NULL,
- `col_196` tinyint(1) default NULL,
- `col_197` tinyint(1) default NULL,
- `col_198` tinyint(1) default NULL,
- `col_199` tinyint(1) default NULL,
- `col_200` tinyint(1) default NULL,
- `col_201` tinyint(1) default NULL,
- `col_202` tinyint(1) default NULL,
- `col_203` tinyint(1) default NULL,
- `col_204` tinyint(1) default NULL,
- `col_205` tinyint(1) default NULL,
- `col_206` tinyint(1) default NULL,
- `col_207` tinyint(1) default NULL,
- `col_208` tinyint(1) default NULL,
- `col_209` tinyint(1) default NULL,
- `col_210` tinyint(1) default NULL,
- `col_211` tinyint(1) default NULL,
- `col_212` tinyint(1) default NULL,
- `col_213` tinyint(1) default NULL,
- `col_214` tinyint(1) default NULL,
- `col_215` tinyint(1) default NULL,
- `col_216` tinyint(1) default NULL,
- `col_217` tinyint(1) default NULL,
- `col_218` tinyint(1) default NULL,
- `col_219` tinyint(1) default NULL,
- `col_220` tinyint(1) default NULL,
- `col_221` tinyint(1) default NULL,
- `col_222` tinyint(1) default NULL,
- `col_223` tinyint(1) default NULL,
- `col_224` tinyint(1) default NULL,
- `col_225` tinyint(1) default NULL,
- `col_226` tinyint(1) default NULL,
- `col_227` tinyint(1) default NULL,
- `col_228` tinyint(1) default NULL,
- `col_229` tinyint(1) default NULL,
- `col_230` tinyint(1) default NULL,
- `col_231` tinyint(1) default NULL,
- `col_232` tinyint(1) default NULL,
- `col_233` tinyint(1) default NULL,
- `col_234` tinyint(1) default NULL,
- `col_235` tinyint(1) default NULL,
- `col_236` tinyint(1) default NULL,
- `col_237` tinyint(1) default NULL,
- `col_238` tinyint(1) default NULL,
- `col_239` tinyint(1) default NULL,
- `col_240` tinyint(1) default NULL,
- `col_241` tinyint(1) default NULL,
- `col_242` tinyint(1) default NULL,
- `col_243` tinyint(1) default NULL,
- `col_244` tinyint(1) default NULL,
- `col_245` tinyint(1) default NULL,
- `col_246` tinyint(1) default NULL,
- `col_247` tinyint(1) default NULL,
- `col_248` tinyint(1) default NULL,
- `col_249` tinyint(1) default NULL,
- `col_250` tinyint(1) default NULL,
- `col_251` tinyint(1) default NULL,
- `col_252` tinyint(1) default NULL,
- `col_253` tinyint(1) default NULL,
- `col_254` tinyint(1) default NULL,
- `col_255` tinyint(1) default NULL,
- `col_256` tinyint(1) default NULL,
- `col_257` tinyint(1) default NULL,
- `col_258` tinyint(1) default NULL,
- `col_259` tinyint(1) default NULL,
- `col_260` tinyint(1) default NULL,
- `col_261` tinyint(1) default NULL,
- `col_262` tinyint(1) default NULL,
- `col_263` tinyint(1) default NULL,
- `col_264` tinyint(1) default NULL,
- `col_265` tinyint(1) default NULL,
- `col_266` tinyint(1) default NULL,
- `col_267` tinyint(1) default NULL,
- `col_268` tinyint(1) default NULL,
- `col_269` tinyint(1) default NULL,
- `col_270` tinyint(1) default NULL,
- `col_271` tinyint(1) default NULL,
- `col_272` tinyint(1) default NULL,
- `col_273` tinyint(1) default NULL,
- `col_274` tinyint(1) default NULL,
- `col_275` tinyint(1) default NULL,
- `col_276` tinyint(1) default NULL,
- `col_277` tinyint(1) default NULL,
- `col_278` tinyint(1) default NULL,
- `col_279` tinyint(1) default NULL,
- `col_280` tinyint(1) default NULL,
- `col_281` tinyint(1) default NULL,
- `col_282` tinyint(1) default NULL,
- `col_283` tinyint(1) default NULL,
- `col_284` tinyint(1) default NULL,
- `col_285` tinyint(1) default NULL,
- `col_286` tinyint(1) default NULL,
- `col_287` tinyint(1) default NULL,
- `col_288` tinyint(1) default NULL,
- `col_289` tinyint(1) default NULL,
- `col_290` tinyint(1) default NULL,
- `col_291` tinyint(1) default NULL,
- `col_292` tinyint(1) default NULL,
- `col_293` tinyint(1) default NULL,
- `col_294` tinyint(1) default NULL,
- `col_295` tinyint(1) default NULL,
- `col_296` tinyint(1) default NULL,
- `col_297` tinyint(1) default NULL,
- `col_298` tinyint(1) default NULL,
- `col_299` tinyint(1) default NULL,
- `col_300` tinyint(1) default NULL,
- `col_301` tinyint(1) default NULL,
- `col_302` tinyint(1) default NULL,
- `col_303` tinyint(1) default NULL,
- `col_304` tinyint(1) default NULL,
- `col_305` tinyint(1) default NULL,
- `col_306` tinyint(1) default NULL,
- `col_307` tinyint(1) default NULL,
- `col_308` tinyint(1) default NULL,
- `col_309` tinyint(1) default NULL,
- `col_310` tinyint(1) default NULL,
- `col_311` tinyint(1) default NULL,
- `col_312` tinyint(1) default NULL,
- `col_313` tinyint(1) default NULL,
- `col_314` tinyint(1) default NULL,
- `col_315` tinyint(1) default NULL,
- `col_316` tinyint(1) default NULL,
- `col_317` tinyint(1) default NULL,
- `col_318` tinyint(1) default NULL,
- `col_319` tinyint(1) default NULL,
- `col_320` tinyint(1) default NULL,
- `col_321` tinyint(1) default NULL,
- `col_322` tinyint(1) default NULL,
- `col_323` tinyint(1) default NULL,
- `col_324` tinyint(1) default NULL,
- `col_325` tinyint(1) default NULL,
- `col_326` tinyint(1) default NULL,
- `col_327` tinyint(1) default NULL,
- `col_328` tinyint(1) default NULL,
- `col_329` tinyint(1) default NULL,
- `col_330` tinyint(1) default NULL,
- `col_331` tinyint(1) default NULL,
- `col_332` tinyint(1) default NULL,
- `col_333` tinyint(1) default NULL,
- `col_334` tinyint(1) default NULL,
- `col_335` tinyint(1) default NULL,
- `col_336` tinyint(1) default NULL,
- `col_337` tinyint(1) default NULL,
- `col_338` tinyint(1) default NULL,
- `col_339` tinyint(1) default NULL,
- `col_340` tinyint(1) default NULL,
- `col_341` tinyint(1) default NULL,
- `col_342` tinyint(1) default NULL,
- `col_343` tinyint(1) default NULL,
- `col_344` tinyint(1) default NULL,
- `col_345` tinyint(1) default NULL,
- `col_346` tinyint(1) default NULL,
- `col_347` tinyint(1) default NULL,
- `col_348` tinyint(1) default NULL,
- `col_349` tinyint(1) default NULL,
- `col_350` tinyint(1) default NULL,
- `col_351` tinyint(1) default NULL,
- `col_352` tinyint(1) default NULL,
- `col_353` tinyint(1) default NULL,
- `col_354` tinyint(1) default NULL,
- `col_355` tinyint(1) default NULL,
- `col_356` tinyint(1) default NULL,
- `col_357` tinyint(1) default NULL,
- `col_358` tinyint(1) default NULL,
- `col_359` tinyint(1) default NULL,
- `col_360` tinyint(1) default NULL,
- `col_361` tinyint(1) default NULL,
- `col_362` tinyint(1) default NULL,
- `col_363` tinyint(1) default NULL,
- `col_364` tinyint(1) default NULL,
- `col_365` tinyint(1) default NULL,
- `col_366` tinyint(1) default NULL,
- `col_367` tinyint(1) default NULL,
- `col_368` tinyint(1) default NULL,
- `col_369` tinyint(1) default NULL,
- `col_370` tinyint(1) default NULL,
- `col_371` tinyint(1) default NULL,
- `col_372` tinyint(1) default NULL,
- `col_373` tinyint(1) default NULL,
- `col_374` tinyint(1) default NULL,
- `col_375` tinyint(1) default NULL,
- `col_376` tinyint(1) default NULL,
- `col_377` tinyint(1) default NULL,
- `col_378` tinyint(1) default NULL,
- `col_379` tinyint(1) default NULL,
- `col_380` tinyint(1) default NULL,
- `col_381` tinyint(1) default NULL,
- `col_382` tinyint(1) default NULL,
- `col_383` tinyint(1) default NULL,
- `col_384` tinyint(1) default NULL,
- `col_385` tinyint(1) default NULL,
- `col_386` tinyint(1) default NULL,
- `col_387` tinyint(1) default NULL,
- `col_388` tinyint(1) default NULL,
- `col_389` tinyint(1) default NULL,
- `col_390` tinyint(1) default NULL,
- `col_391` tinyint(1) default NULL,
- `col_392` tinyint(1) default NULL,
- `col_393` tinyint(1) default NULL,
- `col_394` tinyint(1) default NULL,
- `col_395` tinyint(1) default NULL,
- `col_396` tinyint(1) default NULL,
- `col_397` tinyint(1) default NULL,
- `col_398` tinyint(1) default NULL,
- `col_399` tinyint(1) default NULL,
- `col_400` tinyint(1) default NULL,
- `col_401` tinyint(1) default NULL,
- `col_402` tinyint(1) default NULL,
- `col_403` tinyint(1) default NULL,
- `col_404` tinyint(1) default NULL,
- `col_405` tinyint(1) default NULL,
- `col_406` tinyint(1) default NULL,
- `col_407` tinyint(1) default NULL,
- `col_408` tinyint(1) default NULL,
- `col_409` tinyint(1) default NULL,
- `col_410` tinyint(1) default NULL,
- `col_411` tinyint(1) default NULL,
- `col_412` tinyint(1) default NULL,
- `col_413` tinyint(1) default NULL,
- `col_414` tinyint(1) default NULL,
- `col_415` tinyint(1) default NULL,
- `col_416` tinyint(1) default NULL,
- `col_417` tinyint(1) default NULL,
- `col_418` tinyint(1) default NULL,
- `col_419` tinyint(1) default NULL,
- `col_420` tinyint(1) default NULL,
- `col_421` tinyint(1) default NULL,
- `col_422` tinyint(1) default NULL,
- `col_423` tinyint(1) default NULL,
- `col_424` tinyint(1) default NULL,
- `col_425` tinyint(1) default NULL,
- `col_426` tinyint(1) default NULL,
- `col_427` tinyint(1) default NULL,
- `col_428` tinyint(1) default NULL,
- `col_429` tinyint(1) default NULL,
- `col_430` tinyint(1) default NULL,
- `col_431` tinyint(1) default NULL,
- `col_432` tinyint(1) default NULL,
- `col_433` tinyint(1) default NULL,
- `col_434` tinyint(1) default NULL,
- `col_435` tinyint(1) default NULL,
- `col_436` tinyint(1) default NULL,
- `col_437` tinyint(1) default NULL,
- `col_438` tinyint(1) default NULL,
- `col_439` tinyint(1) default NULL,
- `col_440` tinyint(1) default NULL,
- `col_441` tinyint(1) default NULL,
- `col_442` tinyint(1) default NULL,
- `col_443` tinyint(1) default NULL,
- `col_444` tinyint(1) default NULL,
- `col_445` tinyint(1) default NULL,
- `col_446` tinyint(1) default NULL,
- `col_447` tinyint(1) default NULL,
- `col_448` tinyint(1) default NULL,
- `col_449` tinyint(1) default NULL,
- `col_450` tinyint(1) default NULL,
- `col_451` tinyint(1) default NULL,
- `col_452` tinyint(1) default NULL,
- `col_453` tinyint(1) default NULL,
- `col_454` tinyint(1) default NULL,
- `col_455` tinyint(1) default NULL,
- `col_456` tinyint(1) default NULL,
- `col_457` tinyint(1) default NULL,
- `col_458` tinyint(1) default NULL,
- `col_459` tinyint(1) default NULL,
- `col_460` tinyint(1) default NULL,
- `col_461` tinyint(1) default NULL,
- `col_462` tinyint(1) default NULL,
- `col_463` tinyint(1) default NULL,
- `col_464` tinyint(1) default NULL,
- `col_465` tinyint(1) default NULL,
- `col_466` tinyint(1) default NULL,
- `col_467` tinyint(1) default NULL,
- `col_468` tinyint(1) default NULL,
- `col_469` tinyint(1) default NULL,
- `col_470` tinyint(1) default NULL,
- `col_471` tinyint(1) default NULL,
- `col_472` tinyint(1) default NULL,
- `col_473` tinyint(1) default NULL,
- `col_474` tinyint(1) default NULL,
- `col_475` tinyint(1) default NULL,
- `col_476` tinyint(1) default NULL,
- `col_477` tinyint(1) default NULL,
- `col_478` tinyint(1) default NULL,
- `col_479` tinyint(1) default NULL,
- `col_480` tinyint(1) default NULL,
- `col_481` tinyint(1) default NULL,
- `col_482` tinyint(1) default NULL,
- `col_483` tinyint(1) default NULL,
- `col_484` tinyint(1) default NULL,
- `col_485` tinyint(1) default NULL,
- `col_486` tinyint(1) default NULL,
- `col_487` tinyint(1) default NULL,
- `col_488` tinyint(1) default NULL,
- `col_489` tinyint(1) default NULL,
- `col_490` tinyint(1) default NULL,
- `col_491` tinyint(1) default NULL,
- `col_492` tinyint(1) default NULL,
- `col_493` tinyint(1) default NULL,
- `col_494` tinyint(1) default NULL,
- `col_495` tinyint(1) default NULL,
- `col_496` tinyint(1) default NULL,
- `col_497` tinyint(1) default NULL,
- `col_498` tinyint(1) default NULL,
- `col_499` tinyint(1) default NULL,
- `col_500` tinyint(1) default NULL,
- `col_501` tinyint(1) default NULL,
- `col_502` tinyint(1) default NULL,
- `col_503` tinyint(1) default NULL,
- `col_504` tinyint(1) default NULL,
- `col_505` tinyint(1) default NULL,
- `col_506` tinyint(1) default NULL,
- `col_507` tinyint(1) default NULL,
- `col_508` tinyint(1) default NULL,
- `col_509` tinyint(1) default NULL,
- `col_510` tinyint(1) default NULL,
- `col_511` tinyint(1) default NULL,
- `col_512` tinyint(1) default NULL,
- `col_513` tinyint(1) default NULL,
- `col_514` tinyint(1) default NULL,
- `col_515` tinyint(1) default NULL,
- `col_516` tinyint(1) default NULL,
- `col_517` tinyint(1) default NULL,
- `col_518` tinyint(1) default NULL,
- `col_519` tinyint(1) default NULL,
- `col_520` tinyint(1) default NULL,
- `col_521` tinyint(1) default NULL,
- `col_522` tinyint(1) default NULL,
- `col_523` tinyint(1) default NULL,
- `col_524` tinyint(1) default NULL,
- `col_525` tinyint(1) default NULL,
- `col_526` tinyint(1) default NULL,
- `col_527` tinyint(1) default NULL,
- `col_528` tinyint(1) default NULL,
- `col_529` tinyint(1) default NULL,
- `col_530` tinyint(1) default NULL,
- `col_531` tinyint(1) default NULL,
- `col_532` tinyint(1) default NULL,
- `col_533` tinyint(1) default NULL,
- `col_534` tinyint(1) default NULL,
- `col_535` tinyint(1) default NULL,
- `col_536` tinyint(1) default NULL,
- `col_537` tinyint(1) default NULL,
- `col_538` tinyint(1) default NULL,
- `col_539` tinyint(1) default NULL,
- `col_540` tinyint(1) default NULL,
- `col_541` tinyint(1) default NULL,
- `col_542` tinyint(1) default NULL,
- `col_543` tinyint(1) default NULL,
- `col_544` tinyint(1) default NULL,
- `col_545` tinyint(1) default NULL,
- `col_546` tinyint(1) default NULL,
- `col_547` tinyint(1) default NULL,
- `col_548` tinyint(1) default NULL,
- `col_549` tinyint(1) default NULL,
- `col_550` tinyint(1) default NULL,
- `col_551` tinyint(1) default NULL,
- `col_552` tinyint(1) default NULL,
- `col_553` tinyint(1) default NULL,
- `col_554` tinyint(1) default NULL,
- `col_555` tinyint(1) default NULL,
- `col_556` tinyint(1) default NULL,
- `col_557` tinyint(1) default NULL,
- `col_558` tinyint(1) default NULL,
- `col_559` tinyint(1) default NULL,
- `col_560` tinyint(1) default NULL,
- `col_561` tinyint(1) default NULL,
- `col_562` tinyint(1) default NULL,
- `col_563` tinyint(1) default NULL,
- `col_564` tinyint(1) default NULL,
- `col_565` tinyint(1) default NULL,
- `col_566` tinyint(1) default NULL,
- `col_567` tinyint(1) default NULL,
- `col_568` tinyint(1) default NULL,
- `col_569` tinyint(1) default NULL,
- `col_570` tinyint(1) default NULL,
- `col_571` tinyint(1) default NULL,
- `col_572` tinyint(1) default NULL,
- `col_573` tinyint(1) default NULL,
- `col_574` tinyint(1) default NULL,
- `col_575` tinyint(1) default NULL,
- `col_576` tinyint(1) default NULL,
- `col_577` tinyint(1) default NULL,
- `col_578` tinyint(1) default NULL,
- `col_579` tinyint(1) default NULL,
- `col_580` tinyint(1) default NULL,
- `col_581` tinyint(1) default NULL,
- `col_582` tinyint(1) default NULL,
- `col_583` tinyint(1) default NULL,
- `col_584` tinyint(1) default NULL,
- `col_585` tinyint(1) default NULL,
- `col_586` tinyint(1) default NULL,
- `col_587` tinyint(1) default NULL,
- `col_588` tinyint(1) default NULL,
- `col_589` tinyint(1) default NULL,
- `col_590` tinyint(1) default NULL,
- `col_591` tinyint(1) default NULL,
- `col_592` tinyint(1) default NULL,
- `col_593` tinyint(1) default NULL,
- `col_594` tinyint(1) default NULL,
- `col_595` tinyint(1) default NULL,
- `col_596` tinyint(1) default NULL,
- `col_597` tinyint(1) default NULL,
- `col_598` tinyint(1) default NULL,
- `col_599` tinyint(1) default NULL,
- `col_600` tinyint(1) default NULL,
- `col_601` tinyint(1) default NULL,
- `col_602` tinyint(1) default NULL,
- `col_603` tinyint(1) default NULL,
- `col_604` tinyint(1) default NULL,
- `col_605` tinyint(1) default NULL,
- `col_606` tinyint(1) default NULL,
- `col_607` tinyint(1) default NULL,
- `col_608` tinyint(1) default NULL,
- `col_609` tinyint(1) default NULL,
- `col_610` tinyint(1) default NULL,
- `col_611` tinyint(1) default NULL,
- `col_612` tinyint(1) default NULL,
- `col_613` tinyint(1) default NULL,
- `col_614` tinyint(1) default NULL,
- `col_615` tinyint(1) default NULL,
- `col_616` tinyint(1) default NULL,
- `col_617` tinyint(1) default NULL,
- `col_618` tinyint(1) default NULL,
- `col_619` tinyint(1) default NULL,
- `col_620` tinyint(1) default NULL,
- `col_621` tinyint(1) default NULL,
- `col_622` tinyint(1) default NULL,
- `col_623` tinyint(1) default NULL,
- `col_624` tinyint(1) default NULL,
- `col_625` tinyint(1) default NULL,
- `col_626` tinyint(1) default NULL,
- `col_627` tinyint(1) default NULL,
- `col_628` tinyint(1) default NULL,
- `col_629` tinyint(1) default NULL,
- `col_630` tinyint(1) default NULL,
- `col_631` tinyint(1) default NULL,
- `col_632` tinyint(1) default NULL,
- `col_633` tinyint(1) default NULL,
- `col_634` tinyint(1) default NULL,
- `col_635` tinyint(1) default NULL,
- `col_636` tinyint(1) default NULL,
- `col_637` tinyint(1) default NULL,
- `col_638` tinyint(1) default NULL,
- `col_639` tinyint(1) default NULL,
- `col_640` tinyint(1) default NULL,
- `col_641` tinyint(1) default NULL,
- `col_642` tinyint(1) default NULL,
- `col_643` tinyint(1) default NULL,
- `col_644` tinyint(1) default NULL,
- `col_645` tinyint(1) default NULL,
- `col_646` tinyint(1) default NULL,
- `col_647` tinyint(1) default NULL,
- `col_648` tinyint(1) default NULL,
- `col_649` tinyint(1) default NULL,
- `col_650` tinyint(1) default NULL,
- `col_651` tinyint(1) default NULL,
- `col_652` tinyint(1) default NULL,
- `col_653` tinyint(1) default NULL,
- `col_654` tinyint(1) default NULL,
- `col_655` tinyint(1) default NULL,
- `col_656` tinyint(1) default NULL,
- `col_657` tinyint(1) default NULL,
- `col_658` tinyint(1) default NULL,
- `col_659` tinyint(1) default NULL,
- `col_660` tinyint(1) default NULL,
- `col_661` tinyint(1) default NULL,
- `col_662` tinyint(1) default NULL,
- `col_663` tinyint(1) default NULL,
- `col_664` tinyint(1) default NULL,
- `col_665` tinyint(1) default NULL,
- `col_666` tinyint(1) default NULL,
- `col_667` tinyint(1) default NULL,
- `col_668` tinyint(1) default NULL,
- `col_669` tinyint(1) default NULL,
- `col_670` tinyint(1) default NULL,
- `col_671` tinyint(1) default NULL,
- `col_672` tinyint(1) default NULL,
- `col_673` tinyint(1) default NULL,
- `col_674` tinyint(1) default NULL,
- `col_675` tinyint(1) default NULL,
- `col_676` tinyint(1) default NULL,
- `col_677` tinyint(1) default NULL,
- `col_678` tinyint(1) default NULL,
- `col_679` tinyint(1) default NULL,
- `col_680` tinyint(1) default NULL,
- `col_681` tinyint(1) default NULL,
- `col_682` tinyint(1) default NULL,
- `col_683` tinyint(1) default NULL,
- `col_684` tinyint(1) default NULL,
- `col_685` tinyint(1) default NULL,
- `col_686` tinyint(1) default NULL,
- `col_687` tinyint(1) default NULL,
- `col_688` tinyint(1) default NULL,
- `col_689` tinyint(1) default NULL,
- `col_690` tinyint(1) default NULL,
- `col_691` tinyint(1) default NULL,
- `col_692` tinyint(1) default NULL,
- `col_693` tinyint(1) default NULL,
- `col_694` tinyint(1) default NULL,
- `col_695` tinyint(1) default NULL,
- `col_696` tinyint(1) default NULL,
- `col_697` tinyint(1) default NULL,
- `col_698` tinyint(1) default NULL,
- `col_699` tinyint(1) default NULL,
- `col_700` tinyint(1) default NULL,
- `col_701` tinyint(1) default NULL,
- `col_702` tinyint(1) default NULL,
- `col_703` tinyint(1) default NULL,
- `col_704` tinyint(1) default NULL,
- `col_705` tinyint(1) default NULL,
- `col_706` tinyint(1) default NULL,
- `col_707` tinyint(1) default NULL,
- `col_708` tinyint(1) default NULL,
- `col_709` tinyint(1) default NULL,
- `col_710` tinyint(1) default NULL,
- `col_711` tinyint(1) default NULL,
- `col_712` tinyint(1) default NULL,
- `col_713` tinyint(1) default NULL,
- `col_714` tinyint(1) default NULL,
- `col_715` tinyint(1) default NULL,
- `col_716` tinyint(1) default NULL,
- `col_717` tinyint(1) default NULL,
- `col_718` tinyint(1) default NULL,
- `col_719` tinyint(1) default NULL,
- `col_720` tinyint(1) default NULL,
- `col_721` tinyint(1) default NULL,
- `col_722` tinyint(1) default NULL,
- `col_723` tinyint(1) default NULL,
- `col_724` tinyint(1) default NULL,
- `col_725` tinyint(1) default NULL,
- `col_726` tinyint(1) default NULL,
- `col_727` tinyint(1) default NULL,
- `col_728` tinyint(1) default NULL,
- `col_729` tinyint(1) default NULL,
- `col_730` tinyint(1) default NULL,
- `col_731` tinyint(1) default NULL,
- `col_732` tinyint(1) default NULL,
- `col_733` tinyint(1) default NULL,
- `col_734` tinyint(1) default NULL,
- `col_735` tinyint(1) default NULL,
- `col_736` tinyint(1) default NULL,
- `col_737` tinyint(1) default NULL,
- `col_738` tinyint(1) default NULL,
- `col_739` tinyint(1) default NULL,
- `col_740` tinyint(1) default NULL,
- `col_741` tinyint(1) default NULL,
- `col_742` tinyint(1) default NULL,
- `col_743` tinyint(1) default NULL,
- `col_744` tinyint(1) default NULL,
- `col_745` tinyint(1) default NULL,
- `col_746` tinyint(1) default NULL,
- `col_747` tinyint(1) default NULL,
- `col_748` tinyint(1) default NULL,
- `col_749` tinyint(1) default NULL,
- `col_750` tinyint(1) default NULL,
- `col_751` tinyint(1) default NULL,
- `col_752` tinyint(1) default NULL,
- `col_753` tinyint(1) default NULL,
- `col_754` tinyint(1) default NULL,
- `col_755` tinyint(1) default NULL,
- `col_756` tinyint(1) default NULL,
- `col_757` tinyint(1) default NULL,
- `col_758` tinyint(1) default NULL,
- `col_759` tinyint(1) default NULL,
- `col_760` tinyint(1) default NULL,
- `col_761` tinyint(1) default NULL,
- `col_762` tinyint(1) default NULL,
- `col_763` tinyint(1) default NULL,
- `col_764` tinyint(1) default NULL,
- `col_765` tinyint(1) default NULL,
- `col_766` tinyint(1) default NULL,
- `col_767` tinyint(1) default NULL,
- `col_768` tinyint(1) default NULL,
- `col_769` tinyint(1) default NULL,
- `col_770` tinyint(1) default NULL,
- `col_771` tinyint(1) default NULL,
- `col_772` tinyint(1) default NULL,
- `col_773` tinyint(1) default NULL,
- `col_774` tinyint(1) default NULL,
- `col_775` tinyint(1) default NULL,
- `col_776` tinyint(1) default NULL,
- `col_777` tinyint(1) default NULL,
- `col_778` tinyint(1) default NULL,
- `col_779` tinyint(1) default NULL,
- `col_780` tinyint(1) default NULL,
- `col_781` tinyint(1) default NULL,
- `col_782` tinyint(1) default NULL,
- `col_783` tinyint(1) default NULL,
- `col_784` tinyint(1) default NULL,
- `col_785` tinyint(1) default NULL,
- `col_786` tinyint(1) default NULL,
- `col_787` tinyint(1) default NULL,
- `col_788` tinyint(1) default NULL,
- `col_789` tinyint(1) default NULL,
- `col_790` tinyint(1) default NULL,
- `col_791` tinyint(1) default NULL,
- `col_792` tinyint(1) default NULL,
- `col_793` tinyint(1) default NULL,
- `col_794` tinyint(1) default NULL,
- `col_795` tinyint(1) default NULL,
- `col_796` tinyint(1) default NULL,
- `col_797` tinyint(1) default NULL,
- `col_798` tinyint(1) default NULL,
- `col_799` tinyint(1) default NULL,
- `col_800` tinyint(1) default NULL,
- `col_801` tinyint(1) default NULL,
- `col_802` tinyint(1) default NULL,
- `col_803` tinyint(1) default NULL,
- `col_804` tinyint(1) default NULL,
- `col_805` tinyint(1) default NULL,
- `col_806` tinyint(1) default NULL,
- `col_807` tinyint(1) default NULL,
- `col_808` tinyint(1) default NULL,
- `col_809` tinyint(1) default NULL,
- `col_810` tinyint(1) default NULL,
- `col_811` tinyint(1) default NULL,
- `col_812` tinyint(1) default NULL,
- `col_813` tinyint(1) default NULL,
- `col_814` tinyint(1) default NULL,
- `col_815` tinyint(1) default NULL,
- `col_816` tinyint(1) default NULL,
- `col_817` tinyint(1) default NULL,
- `col_818` tinyint(1) default NULL,
- `col_819` tinyint(1) default NULL,
- `col_820` tinyint(1) default NULL,
- `col_821` tinyint(1) default NULL,
- `col_822` tinyint(1) default NULL,
- `col_823` tinyint(1) default NULL,
- `col_824` tinyint(1) default NULL,
- `col_825` tinyint(1) default NULL,
- `col_826` tinyint(1) default NULL,
- `col_827` tinyint(1) default NULL,
- `col_828` tinyint(1) default NULL,
- `col_829` tinyint(1) default NULL,
- `col_830` tinyint(1) default NULL,
- `col_831` tinyint(1) default NULL,
- `col_832` tinyint(1) default NULL,
- `col_833` tinyint(1) default NULL,
- `col_834` tinyint(1) default NULL,
- `col_835` tinyint(1) default NULL,
- `col_836` tinyint(1) default NULL,
- `col_837` tinyint(1) default NULL,
- `col_838` tinyint(1) default NULL,
- `col_839` tinyint(1) default NULL,
- `col_840` tinyint(1) default NULL,
- `col_841` tinyint(1) default NULL,
- `col_842` tinyint(1) default NULL,
- `col_843` tinyint(1) default NULL,
- `col_844` tinyint(1) default NULL,
- `col_845` tinyint(1) default NULL,
- `col_846` tinyint(1) default NULL,
- `col_847` tinyint(1) default NULL,
- `col_848` tinyint(1) default NULL,
- `col_849` tinyint(1) default NULL,
- `col_850` tinyint(1) default NULL,
- `col_851` tinyint(1) default NULL,
- `col_852` tinyint(1) default NULL,
- `col_853` tinyint(1) default NULL,
- `col_854` tinyint(1) default NULL,
- `col_855` tinyint(1) default NULL,
- `col_856` tinyint(1) default NULL,
- `col_857` tinyint(1) default NULL,
- `col_858` tinyint(1) default NULL,
- `col_859` tinyint(1) default NULL,
- `col_860` tinyint(1) default NULL,
- `col_861` tinyint(1) default NULL,
- `col_862` tinyint(1) default NULL,
- `col_863` tinyint(1) default NULL,
- `col_864` tinyint(1) default NULL,
- `col_865` tinyint(1) default NULL,
- `col_866` tinyint(1) default NULL,
- `col_867` tinyint(1) default NULL,
- `col_868` tinyint(1) default NULL,
- `col_869` tinyint(1) default NULL,
- `col_870` tinyint(1) default NULL,
- `col_871` tinyint(1) default NULL,
- `col_872` tinyint(1) default NULL,
- `col_873` tinyint(1) default NULL,
- `col_874` tinyint(1) default NULL,
- `col_875` tinyint(1) default NULL,
- `col_876` tinyint(1) default NULL,
- `col_877` tinyint(1) default NULL,
- `col_878` tinyint(1) default NULL,
- `col_879` tinyint(1) default NULL,
- `col_880` tinyint(1) default NULL,
- `col_881` tinyint(1) default NULL,
- `col_882` tinyint(1) default NULL,
- `col_883` tinyint(1) default NULL,
- `col_884` tinyint(1) default NULL,
- `col_885` tinyint(1) default NULL,
- `col_886` tinyint(1) default NULL,
- `col_887` tinyint(1) default NULL,
- `col_888` tinyint(1) default NULL,
- `col_889` tinyint(1) default NULL,
- `col_890` tinyint(1) default NULL,
- `col_891` tinyint(1) default NULL,
- `col_892` tinyint(1) default NULL,
- `col_893` tinyint(1) default NULL,
- `col_894` tinyint(1) default NULL,
- `col_895` tinyint(1) default NULL,
- `col_896` tinyint(1) default NULL,
- `col_897` tinyint(1) default NULL,
- `col_898` tinyint(1) default NULL,
- `col_899` tinyint(1) default NULL,
- `col_900` tinyint(1) default NULL,
- `col_901` tinyint(1) default NULL,
- `col_902` tinyint(1) default NULL,
- `col_903` tinyint(1) default NULL,
- `col_904` tinyint(1) default NULL,
- `col_905` tinyint(1) default NULL,
- `col_906` tinyint(1) default NULL,
- `col_907` tinyint(1) default NULL,
- `col_908` tinyint(1) default NULL,
- `col_909` tinyint(1) default NULL,
- `col_910` tinyint(1) default NULL,
- `col_911` tinyint(1) default NULL,
- `col_912` tinyint(1) default NULL,
- `col_913` tinyint(1) default NULL,
- `col_914` tinyint(1) default NULL,
- `col_915` tinyint(1) default NULL,
- `col_916` tinyint(1) default NULL,
- `col_917` tinyint(1) default NULL,
- `col_918` tinyint(1) default NULL,
- `col_919` tinyint(1) default NULL,
- `col_920` tinyint(1) default NULL,
- `col_921` tinyint(1) default NULL,
- `col_922` tinyint(1) default NULL,
- `col_923` tinyint(1) default NULL,
- `col_924` tinyint(1) default NULL,
- `col_925` tinyint(1) default NULL,
- `col_926` tinyint(1) default NULL,
- `col_927` tinyint(1) default NULL,
- `col_928` tinyint(1) default NULL,
- `col_929` tinyint(1) default NULL,
- `col_930` tinyint(1) default NULL,
- `col_931` tinyint(1) default NULL,
- `col_932` tinyint(1) default NULL,
- `col_933` tinyint(1) default NULL,
- `col_934` tinyint(1) default NULL,
- `col_935` tinyint(1) default NULL,
- `col_936` tinyint(1) default NULL,
- `col_937` tinyint(1) default NULL,
- `col_938` tinyint(1) default NULL,
- `col_939` tinyint(1) default NULL,
- `col_940` tinyint(1) default NULL,
- `col_941` tinyint(1) default NULL,
- `col_942` tinyint(1) default NULL,
- `col_943` tinyint(1) default NULL,
- `col_944` tinyint(1) default NULL,
- `col_945` tinyint(1) default NULL,
- `col_946` tinyint(1) default NULL,
- `col_947` tinyint(1) default NULL,
- `col_948` tinyint(1) default NULL,
- `col_949` tinyint(1) default NULL,
- `col_950` tinyint(1) default NULL,
- `col_951` tinyint(1) default NULL,
- `col_952` tinyint(1) default NULL,
- `col_953` tinyint(1) default NULL,
- `col_954` tinyint(1) default NULL,
- `col_955` tinyint(1) default NULL,
- `col_956` tinyint(1) default NULL,
- `col_957` tinyint(1) default NULL,
- `col_958` tinyint(1) default NULL,
- `col_959` tinyint(1) default NULL,
- `col_960` tinyint(1) default NULL,
- `col_961` tinyint(1) default NULL,
- `col_962` tinyint(1) default NULL,
- `col_963` tinyint(1) default NULL,
- `col_964` tinyint(1) default NULL,
- `col_965` tinyint(1) default NULL,
- `col_966` tinyint(1) default NULL,
- `col_967` tinyint(1) default NULL,
- `col_968` tinyint(1) default NULL,
- `col_969` tinyint(1) default NULL,
- `col_970` tinyint(1) default NULL,
- `col_971` tinyint(1) default NULL,
- `col_972` tinyint(1) default NULL,
- `col_973` tinyint(1) default NULL,
- `col_974` tinyint(1) default NULL,
- `col_975` tinyint(1) default NULL,
- `col_976` tinyint(1) default NULL,
- `col_977` tinyint(1) default NULL,
- `col_978` tinyint(1) default NULL,
- `col_979` tinyint(1) default NULL,
- `col_980` tinyint(1) default NULL,
- `col_981` tinyint(1) default NULL,
- `col_982` tinyint(1) default NULL,
- `col_983` tinyint(1) default NULL,
- `col_984` tinyint(1) default NULL,
- `col_985` tinyint(1) default NULL,
- `col_986` tinyint(1) default NULL,
- `col_987` tinyint(1) default NULL,
- `col_988` tinyint(1) default NULL,
- `col_989` tinyint(1) default NULL,
- `col_990` tinyint(1) default NULL,
- `col_991` tinyint(1) default NULL,
- `col_992` tinyint(1) default NULL,
- `col_993` tinyint(1) default NULL,
- `col_994` tinyint(1) default NULL,
- `col_995` tinyint(1) default NULL,
- `col_996` tinyint(1) default NULL,
- `col_997` tinyint(1) default NULL,
- `col_998` tinyint(1) default NULL,
- `col_999` tinyint(1) default NULL,
- `col_1000` tinyint(1) default NULL,
- `col_1001` tinyint(1) default NULL,
- `col_1002` tinyint(1) default NULL,
- `col_1003` tinyint(1) default NULL,
- `col_1004` tinyint(1) default NULL,
- `col_1005` tinyint(1) default NULL,
- `col_1006` tinyint(1) default NULL,
- `col_1007` tinyint(1) default NULL,
- `col_1008` tinyint(1) default NULL,
- `col_1009` tinyint(1) default NULL,
- `col_1010` tinyint(1) default NULL,
- `col_1011` tinyint(1) default NULL,
- `col_1012` tinyint(1) default NULL,
- `col_1013` tinyint(1) default NULL,
- `col_1014` tinyint(1) default NULL,
- `col_1015` tinyint(1) default NULL,
- `col_1016` tinyint(1) default NULL,
- `col_1017` tinyint(1) default NULL,
- `col_1018` tinyint(1) default NULL,
- `col_1019` tinyint(1) default NULL,
- `col_1020` tinyint(1) default NULL,
- `col_1021` tinyint(1) default NULL,
- `col_1022` tinyint(1) default NULL,
- `col_1023` tinyint(1) default NULL,
- `col_1024` tinyint(1) default NULL,
- `col_1025` tinyint(1) default NULL
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
---enable_query_log
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-INSERT INTO t1 VALUES();
-SELECT COUNT(*) FROM v1;
-
---exec $MYSQL_DUMP --allow-keywords --single-transaction --quick --verbose test --result-file $MYSQLTEST_VARDIR/tmp/bug31434.sql
---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug31434.sql
---remove_file $MYSQLTEST_VARDIR/tmp/bug31434.sql
-
-SELECT COUNT(*) FROM v1;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-SET GLOBAL storage_engine=@old_engine;
-
-# Test fully non-locking mysqldump with consistent binlog position (MWL#136).
-
-connect(c1,127.0.0.1,root,,test,$MASTER_MYPORT,);
-connect(c2,127.0.0.1,root,,test,$MASTER_MYPORT,);
-connect(c3,127.0.0.1,root,,test,$MASTER_MYPORT,);
-
-connection default;
-SET binlog_format= mixed;
-RESET MASTER;
-CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1),(2);
-CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,0), (2,0);
-SELECT GET_LOCK("block_queries_1", 120);
-
-connection c3;
-SELECT GET_LOCK("block_queries_2", 120);
-
-# Start two queries that will be running on the tables during mysqldump
-connection c1;
-SET @c= 0;
-send SELECT IF(@c<1, @c:=@c+1, GET_LOCK("block_queries_1", 120)) FROM t1 ORDER BY a;
-
-connection c2;
-SET binlog_format="row";
-SET @d= 10;
-send UPDATE t2 SET b=IF(@d<=10, @d:=@d+1, GET_LOCK("block_queries_2", 120)) ORDER BY a;
-
-connection default;
---echo # Make sure other queries are running (and waiting).
-let $wait_condition=
- SELECT COUNT(*) FROM information_schema.processlist
- WHERE state = "User lock" AND info LIKE 'SELECT%block_queries_1%';
---source include/wait_condition.inc
-let $wait_condition=
- SELECT COUNT(*) FROM information_schema.processlist
- WHERE state = "User lock" AND info LIKE 'UPDATE%block_queries_2%';
---source include/wait_condition.inc
-
---exec $MYSQL_DUMP --master-data=2 --single-transaction test t1 t2 > $MYSQLTEST_VARDIR/tmp/mwl136.sql
-
-SELECT RELEASE_LOCK("block_queries_1");
-
-connection c3;
-SELECT RELEASE_LOCK("block_queries_2");
-
-connection c1;
-reap;
-
-connection c2;
-reap;
-
-connection default;
-SELECT * FROM t2 ORDER BY a;
-DROP TABLE t1;
-DROP TABLE t2;
---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mwl136.sql
-
-let $binlog_limit= 7, 3;
-source include/show_binlog_events.inc;
-source include/binlog_start_pos.inc;
-let _BINLOG_START_POS= $binlog_start_pos;
---perl
-my $f= "$ENV{MYSQLTEST_VARDIR}/tmp/mwl136.sql";
-my $pos=$ENV{_BINLOG_START_POS} + 739;
-open F, '<', $f or die "Failed to open $f: $!\n";
-while (<F>) {
- s/$pos/<pos>/;
- print if /CHANGE MASTER TO/;
-}
-EOF
-SELECT * FROM t1 ORDER BY a;
-SELECT * FROM t2 ORDER BY a;
-
-DROP TABLE t1,t2;
diff --git a/mysql-test/t/mysqldump-nl.test b/mysql-test/t/mysqldump-nl.test
deleted file mode 100644
index 4513fb2c637..00000000000
--- a/mysql-test/t/mysqldump-nl.test
+++ /dev/null
@@ -1,58 +0,0 @@
-#
-# New lines in identifiers
-#
-
-# embedded server doesn't support external clients
---source include/not_embedded.inc
-# cmd.exe doesn't like new lines on the command line
---source include/not_windows.inc
-
-create database `mysqltest1
-1tsetlqsym`;
-use `mysqltest1
-1tsetlqsym`;
-
-create table `t1
-1t` (`foobar
-raboof` int);
-create view `v1
-1v` as select * from `t1
-1t`;
-
-create procedure sp() select * from `v1
-1v`;
-
-flush tables;
-use test;
-
-exec $MYSQL_DUMP --compact --comment --routines --add-drop-database --databases 'mysqltest1
-1tsetlqsym';
-
-exec $MYSQL_DUMP --compact --comment --routines --add-drop-database --databases 'mysqltest1
-1tsetlqsym' | $MYSQL;
-
-show tables from `mysqltest1
-1tsetlqsym`;
-
-drop database `mysqltest1
-1tsetlqsym`;
-
-create database `test```;
-create database `test\``
-\! ls
-#`;
-
-show databases like 'test%';
-
-exec $MYSQL_DUMP --compact --comment --add-drop-database --databases 'test`' 'test\`
-\! ls
-#';
-
-exec $MYSQL_DUMP --compact --comment --add-drop-database --databases 'test`' 'test\`
-\! ls
-#' | $MYSQL;
-
-drop database `test```;
-drop database `test\``
-\! ls
-#`;
diff --git a/mysql-test/t/mysqldump-no-binlog-master.opt b/mysql-test/t/mysqldump-no-binlog-master.opt
deleted file mode 100644
index 789275fa25e..00000000000
--- a/mysql-test/t/mysqldump-no-binlog-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---skip-log-bin
diff --git a/mysql-test/t/mysqldump-no-binlog.test b/mysql-test/t/mysqldump-no-binlog.test
deleted file mode 100644
index 5f934bc440f..00000000000
--- a/mysql-test/t/mysqldump-no-binlog.test
+++ /dev/null
@@ -1,7 +0,0 @@
-# Embedded server doesn't support external clients
---source include/not_embedded.inc
-
---replace_regex /MASTER_LOG_POS=[0-9]+/XX/
---replace_result mysqldump.exe mysqldump
---error 2
---exec $MYSQL_DUMP --compact --master-data=2 test 2>&1
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
deleted file mode 100644
index 6dde5aa7bc6..00000000000
--- a/mysql-test/t/mysqldump.test
+++ /dev/null
@@ -1,2691 +0,0 @@
-call mtr.add_suppression("@003f.frm' \\(errno: 22\\)");
-#select * from mysql.user;
-#checksum table mysql.user;
-# Embedded server doesn't support external clients
---source include/not_embedded.inc
-
-# Binlog is required
---source include/have_log_bin.inc
-
-# utf8 is required
-let collation=utf8_unicode_ci;
---source include/have_collation.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-# There are tables in 'mysql' database of type innodb
---source include/have_innodb.inc
-
-disable_query_log;
-call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
-enable_query_log;
-
---echo # Bug#37938 Test "mysqldump" lacks various insert statements
---echo # Turn off concurrent inserts to avoid random errors
---echo # NOTE: We reset the variable back to saved value at the end of test
-SET @OLD_CONCURRENT_INSERT = @@GLOBAL.CONCURRENT_INSERT;
-SET @@GLOBAL.CONCURRENT_INSERT = 0;
-
-
---disable_warnings
-DROP TABLE IF EXISTS t1, `"t"1`, t1aa, t2, t2aa, t3;
-drop database if exists mysqldump_test_db;
-drop database if exists db1;
-drop database if exists db2;
-drop view if exists v1, v2, v3;
---enable_warnings
-
-# XML output
-
-CREATE TABLE t1(a INT, KEY (a)) KEY_BLOCK_SIZE=1024;
-INSERT INTO t1 VALUES (1), (2);
---exec $MYSQL_DUMP --skip-create-options --skip-comments -X test t1
-DROP TABLE t1;
-
---echo #
---echo # Bug#2005 Long decimal comparison bug.
---echo #
-
-CREATE TABLE t1 (a decimal(64, 20));
-INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
-("0987654321098765432109876543210987654321");
---exec $MYSQL_DUMP --compact test t1
-DROP TABLE t1;
-
---echo #
---echo # Bug#2055 mysqldump should replace "-inf" numeric field values with "NULL"
---echo #
-
-CREATE TABLE t1 (a double);
-INSERT IGNORE INTO t1 VALUES ('-9e999999');
---exec $MYSQL_DUMP --compact test t1
-DROP TABLE t1;
-
---echo #
---echo # Bug#3361 mysqldump quotes DECIMAL values inconsistently
---echo #
-
-CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT);
-
-# check at first how mysql work with quoted decimal
-
-INSERT INTO t1 VALUES (1.2345, 2.3456);
-INSERT INTO t1 VALUES ('1.2345', 2.3456);
-INSERT INTO t1 VALUES ("1.2345", 2.3456);
-
-SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ANSI_QUOTES';
-INSERT INTO t1 VALUES (1.2345, 2.3456);
-INSERT INTO t1 VALUES ('1.2345', 2.3456);
---error ER_BAD_FIELD_ERROR
-INSERT INTO t1 VALUES ("1.2345", 2.3456);
-SET SQL_MODE=@OLD_SQL_MODE;
-
-# check how mysqldump make quoting
---exec $MYSQL_DUMP --compact test t1
---exec $MYSQL_DUMP --compact --skip-create-options test t1
---exec $MYSQL_DUMP --skip-create-options --skip-comments test t1
---exec $MYSQL_DUMP --skip-opt --extended-insert --skip-comments test t1
-DROP TABLE t1;
-
-CREATE TABLE t1(a int, b text, c varchar(3));
-INSERT INTO t1 VALUES (1, "test", "tes"), (2, "TEST", "TES");
---exec $MYSQL_DUMP --skip-create-options --compact -X test t1
-DROP TABLE t1;
-
---echo #
---echo # Bug#1707 mysqldump -X does't quote field and table names
---echo #
-
-CREATE TABLE t1 (`a"b"` char(2));
-INSERT INTO t1 VALUES ("1\""), ("\"2");
---exec $MYSQL_DUMP --compact --skip-create-options -X test t1
-DROP TABLE t1;
-
---echo #
---echo # Bug#1994 mysqldump does not correctly dump UCS2 data
---echo # Bug#4261 mysqldump 10.7 (mysql 4.1.2) --skip-extended-insert drops NULL from inserts
---echo #
-
-CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r;
-INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'), (NULL);
---exec $MYSQL_DUMP --skip-comments --skip-extended-insert test t1
-DROP TABLE t1;
-
---echo #
---echo # Bug#2634 mysqldump in --compatible=mysql4
---echo #
-
-CREATE TABLE t1 (a int) ENGINE=MYISAM;
-INSERT INTO t1 VALUES (1), (2);
---exec $MYSQL_DUMP --skip-comments --compatible=mysql40 test t1
---exec $MYSQL_DUMP --skip-comments --compatible=mysql323 test t1
-DROP TABLE t1;
-
---echo #
---echo # Bug#2592 mysqldump doesn't quote "tricky" names correctly
---echo #
-
-create table ```a` (i int);
---exec $MYSQL_DUMP --compact test
-drop table ```a`;
-
---echo #
---echo # Bug#2591 mysqldump quotes names inconsistently
---echo #
-
-create table t1(a int);
---exec $MYSQL_DUMP --comments=0 test
---exec $MYSQL_DUMP --comments=0 --compatible=ansi test
-set global sql_mode='ANSI_QUOTES';
---exec $MYSQL_DUMP --comments=0 test
---exec $MYSQL_DUMP --comments=0 --compatible=ansi test
-set global sql_mode=default;
-drop table t1;
-
---echo #
---echo # Bug#2705 mysqldump --tab extra output
---echo #
-
-create table t1(a int);
-insert into t1 values (1),(2),(3);
---exec $MYSQL_DUMP --skip-comments --tab=$MYSQLTEST_VARDIR/tmp/ test
---cat_file $MYSQLTEST_VARDIR/tmp/t1.sql
---cat_file $MYSQLTEST_VARDIR/tmp/t1.txt
---remove_file $MYSQLTEST_VARDIR/tmp/t1.sql
---remove_file $MYSQLTEST_VARDIR/tmp/t1.txt
---exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ test
---remove_file $MYSQLTEST_VARDIR/tmp/t1.sql
---remove_file $MYSQLTEST_VARDIR/tmp/t1.txt
-drop table t1;
-
---echo #
---echo # Bug#6101 create database problem
---echo #
-
---exec $MYSQL_DUMP --skip-comments --databases test
-
-create database mysqldump_test_db character set latin2 collate latin2_bin;
---exec $MYSQL_DUMP --skip-comments --databases mysqldump_test_db
-drop database mysqldump_test_db;
-
---echo #
---echo # Bug#7020 mysqldump --compatible=mysql40 should set --skip-set-charset --default-char...
---echo # Check that we don't dump in UTF8 in compatible mode by default,
---echo # but use the default compiled values, or the values given in
---echo # --default-character-set=xxx. However, we should dump in UTF8
---echo # if it is explicitly set.
-
-CREATE TABLE t1 (a CHAR(10));
-INSERT INTO t1 VALUES (_latin1 '');
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --skip-comments test t1
-
---echo #
---echo # Bug#8063 make test mysqldump [ fail ]
---echo # We cannot test this command because its output depends
---echo # on --default-character-set incompiled into "mysqldump" program.
---echo # If the future we can move this command into a separate test with
---echo # checking that "mysqldump" is compiled with "latin1"
---echo #
-
-#--exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --skip-comments --compatible=mysql323 test t1
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --skip-comments --compatible=mysql323 --default-character-set=cp850 test t1
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --skip-comments --default-character-set=cp850 --compatible=mysql323 test t1
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --skip-comments --default-character-set=utf8 --compatible=mysql323 test t1
-DROP TABLE t1;
-
---echo #
---echo # WL#2319 Exclude Tables from dump
---echo #
-
-CREATE TABLE t1 (a int);
-CREATE TABLE t2 (a int);
-INSERT INTO t1 VALUES (1),(2),(3);
-INSERT INTO t2 VALUES (4),(5),(6);
---exec $MYSQL_DUMP --skip-comments --ignore-table=test.t1 test
-DROP TABLE t1;
-DROP TABLE t2;
-
---echo #
---echo # Bug#8830 mysqldump --skip-extended-insert causes --hex-blob to dump wrong values
---echo #
-
-CREATE TABLE t1 (`b` blob);
-INSERT INTO `t1` VALUES (0x602010000280100005E71A);
---exec $MYSQL_DUMP --skip-extended-insert --hex-blob test --skip-comments t1
-DROP TABLE t1;
-
---echo #
---echo # Test for --insert-ignore
---echo #
-
-CREATE TABLE t1 (a INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(2),(3);
-INSERT INTO t1 VALUES (4),(5),(6);
---exec $MYSQL_DUMP --skip-comments --insert-ignore test t1
---exec $MYSQL_DUMP --skip-comments --insert-ignore --delayed-insert test t1
-DROP TABLE t1;
-
---echo #
---echo # Bug#10286 mysqldump -c crashes on table that has many fields with long
---echo # names
---echo #
-create table t1 (
- F_c4ca4238a0b923820dcc509a6f75849b int,
- F_c81e728d9d4c2f636f067f89cc14862c int,
- F_eccbc87e4b5ce2fe28308fd9f2a7baf3 int,
- F_a87ff679a2f3e71d9181a67b7542122c int,
- F_e4da3b7fbbce2345d7772b0674a318d5 int,
- F_1679091c5a880faf6fb5e6087eb1b2dc int,
- F_8f14e45fceea167a5a36dedd4bea2543 int,
- F_c9f0f895fb98ab9159f51fd0297e236d int,
- F_45c48cce2e2d7fbdea1afc51c7c6ad26 int,
- F_d3d9446802a44259755d38e6d163e820 int,
- F_6512bd43d9caa6e02c990b0a82652dca int,
- F_c20ad4d76fe97759aa27a0c99bff6710 int,
- F_c51ce410c124a10e0db5e4b97fc2af39 int,
- F_aab3238922bcc25a6f606eb525ffdc56 int,
- F_9bf31c7ff062936a96d3c8bd1f8f2ff3 int,
- F_c74d97b01eae257e44aa9d5bade97baf int,
- F_70efdf2ec9b086079795c442636b55fb int,
- F_6f4922f45568161a8cdf4ad2299f6d23 int,
- F_1f0e3dad99908345f7439f8ffabdffc4 int,
- F_98f13708210194c475687be6106a3b84 int,
- F_3c59dc048e8850243be8079a5c74d079 int,
- F_b6d767d2f8ed5d21a44b0e5886680cb9 int,
- F_37693cfc748049e45d87b8c7d8b9aacd int,
- F_1ff1de774005f8da13f42943881c655f int,
- F_8e296a067a37563370ded05f5a3bf3ec int,
- F_4e732ced3463d06de0ca9a15b6153677 int,
- F_02e74f10e0327ad868d138f2b4fdd6f0 int,
- F_33e75ff09dd601bbe69f351039152189 int,
- F_6ea9ab1baa0efb9e19094440c317e21b int,
- F_34173cb38f07f89ddbebc2ac9128303f int,
- F_c16a5320fa475530d9583c34fd356ef5 int,
- F_6364d3f0f495b6ab9dcf8d3b5c6e0b01 int,
- F_182be0c5cdcd5072bb1864cdee4d3d6e int,
- F_e369853df766fa44e1ed0ff613f563bd int,
- F_1c383cd30b7c298ab50293adfecb7b18 int,
- F_19ca14e7ea6328a42e0eb13d585e4c22 int,
- F_a5bfc9e07964f8dddeb95fc584cd965d int,
- F_a5771bce93e200c36f7cd9dfd0e5deaa int,
- F_d67d8ab4f4c10bf22aa353e27879133c int,
- F_d645920e395fedad7bbbed0eca3fe2e0 int,
- F_3416a75f4cea9109507cacd8e2f2aefc int,
- F_a1d0c6e83f027327d8461063f4ac58a6 int,
- F_17e62166fc8586dfa4d1bc0e1742c08b int,
- F_f7177163c833dff4b38fc8d2872f1ec6 int,
- F_6c8349cc7260ae62e3b1396831a8398f int,
- F_d9d4f495e875a2e075a1a4a6e1b9770f int,
- F_67c6a1e7ce56d3d6fa748ab6d9af3fd7 int,
- F_642e92efb79421734881b53e1e1b18b6 int,
- F_f457c545a9ded88f18ecee47145a72c0 int,
- F_c0c7c76d30bd3dcaefc96f40275bdc0a int,
- F_2838023a778dfaecdc212708f721b788 int,
- F_9a1158154dfa42caddbd0694a4e9bdc8 int,
- F_d82c8d1619ad8176d665453cfb2e55f0 int,
- F_a684eceee76fc522773286a895bc8436 int,
- F_b53b3a3d6ab90ce0268229151c9bde11 int,
- F_9f61408e3afb633e50cdf1b20de6f466 int,
- F_72b32a1f754ba1c09b3695e0cb6cde7f int,
- F_66f041e16a60928b05a7e228a89c3799 int,
- F_093f65e080a295f8076b1c5722a46aa2 int,
- F_072b030ba126b2f4b2374f342be9ed44 int,
- F_7f39f8317fbdb1988ef4c628eba02591 int,
- F_44f683a84163b3523afe57c2e008bc8c int,
- F_03afdbd66e7929b125f8597834fa83a4 int,
- F_ea5d2f1c4608232e07d3aa3d998e5135 int,
- F_fc490ca45c00b1249bbe3554a4fdf6fb int,
- F_3295c76acbf4caaed33c36b1b5fc2cb1 int,
- F_735b90b4568125ed6c3f678819b6e058 int,
- F_a3f390d88e4c41f2747bfa2f1b5f87db int,
- F_14bfa6bb14875e45bba028a21ed38046 int,
- F_7cbbc409ec990f19c78c75bd1e06f215 int,
- F_e2c420d928d4bf8ce0ff2ec19b371514 int,
- F_32bb90e8976aab5298d5da10fe66f21d int,
- F_d2ddea18f00665ce8623e36bd4e3c7c5 int,
- F_ad61ab143223efbc24c7d2583be69251 int,
- F_d09bf41544a3365a46c9077ebb5e35c3 int,
- F_fbd7939d674997cdb4692d34de8633c4 int,
- F_28dd2c7955ce926456240b2ff0100bde int,
- F_35f4a8d465e6e1edc05f3d8ab658c551 int,
- F_d1fe173d08e959397adf34b1d77e88d7 int,
- F_f033ab37c30201f73f142449d037028d int,
- F_43ec517d68b6edd3015b3edc9a11367b int,
- F_9778d5d219c5080b9a6a17bef029331c int,
- F_fe9fc289c3ff0af142b6d3bead98a923 int,
- F_68d30a9594728bc39aa24be94b319d21 int,
- F_3ef815416f775098fe977004015c6193 int,
- F_93db85ed909c13838ff95ccfa94cebd9 int,
- F_c7e1249ffc03eb9ded908c236bd1996d int,
- F_2a38a4a9316c49e5a833517c45d31070 int,
- F_7647966b7343c29048673252e490f736 int,
- F_8613985ec49eb8f757ae6439e879bb2a int,
- F_54229abfcfa5649e7003b83dd4755294 int,
- F_92cc227532d17e56e07902b254dfad10 int,
- F_98dce83da57b0395e163467c9dae521b int,
- F_f4b9ec30ad9f68f89b29639786cb62ef int,
- F_812b4ba287f5ee0bc9d43bbf5bbe87fb int,
- F_26657d5ff9020d2abefe558796b99584 int,
- F_e2ef524fbf3d9fe611d5a8e90fefdc9c int,
- F_ed3d2c21991e3bef5e069713af9fa6ca int,
- F_ac627ab1ccbdb62ec96e702f07f6425b int,
- F_f899139df5e1059396431415e770c6dd int,
- F_38b3eff8baf56627478ec76a704e9b52 int,
- F_ec8956637a99787bd197eacd77acce5e int,
- F_6974ce5ac660610b44d9b9fed0ff9548 int,
- F_c9e1074f5b3f9fc8ea15d152add07294 int,
- F_65b9eea6e1cc6bb9f0cd2a47751a186f int,
- F_f0935e4cd5920aa6c7c996a5ee53a70f int,
- F_a97da629b098b75c294dffdc3e463904 int,
- F_a3c65c2974270fd093ee8a9bf8ae7d0b int,
- F_2723d092b63885e0d7c260cc007e8b9d int,
- F_5f93f983524def3dca464469d2cf9f3e int,
- F_698d51a19d8a121ce581499d7b701668 int,
- F_7f6ffaa6bb0b408017b62254211691b5 int,
- F_73278a4a86960eeb576a8fd4c9ec6997 int,
- F_5fd0b37cd7dbbb00f97ba6ce92bf5add int,
- F_2b44928ae11fb9384c4cf38708677c48 int,
- F_c45147dee729311ef5b5c3003946c48f int,
- F_eb160de1de89d9058fcb0b968dbbbd68 int,
- F_5ef059938ba799aaa845e1c2e8a762bd int,
- F_07e1cd7dca89a1678042477183b7ac3f int,
- F_da4fb5c6e93e74d3df8527599fa62642 int,
- F_4c56ff4ce4aaf9573aa5dff913df997a int,
- F_a0a080f42e6f13b3a2df133f073095dd int,
- F_202cb962ac59075b964b07152d234b70 int,
- F_c8ffe9a587b126f152ed3d89a146b445 int,
- F_3def184ad8f4755ff269862ea77393dd int,
- F_069059b7ef840f0c74a814ec9237b6ec int,
- F_ec5decca5ed3d6b8079e2e7e7bacc9f2 int,
- F_76dc611d6ebaafc66cc0879c71b5db5c int,
- F_d1f491a404d6854880943e5c3cd9ca25 int,
- F_9b8619251a19057cff70779273e95aa6 int,
- F_1afa34a7f984eeabdbb0a7d494132ee5 int,
- F_65ded5353c5ee48d0b7d48c591b8f430 int,
- F_9fc3d7152ba9336a670e36d0ed79bc43 int,
- F_02522a2b2726fb0a03bb19f2d8d9524d int,
- F_7f1de29e6da19d22b51c68001e7e0e54 int,
- F_42a0e188f5033bc65bf8d78622277c4e int,
- F_3988c7f88ebcb58c6ce932b957b6f332 int,
- F_013d407166ec4fa56eb1e1f8cbe183b9 int,
- F_e00da03b685a0dd18fb6a08af0923de0 int,
- F_1385974ed5904a438616ff7bdb3f7439 int,
- F_0f28b5d49b3020afeecd95b4009adf4c int,
- F_a8baa56554f96369ab93e4f3bb068c22 int,
- F_903ce9225fca3e988c2af215d4e544d3 int,
- F_0a09c8844ba8f0936c20bd791130d6b6 int,
- F_2b24d495052a8ce66358eb576b8912c8 int,
- F_a5e00132373a7031000fd987a3c9f87b int,
- F_8d5e957f297893487bd98fa830fa6413 int,
- F_47d1e990583c9c67424d369f3414728e int,
- F_f2217062e9a397a1dca429e7d70bc6ca int,
- F_7ef605fc8dba5425d6965fbd4c8fbe1f int,
- F_a8f15eda80c50adb0e71943adc8015cf int,
- F_37a749d808e46495a8da1e5352d03cae int,
- F_b3e3e393c77e35a4a3f3cbd1e429b5dc int,
- F_1d7f7abc18fcb43975065399b0d1e48e int,
- F_2a79ea27c279e471f4d180b08d62b00a int,
- F_1c9ac0159c94d8d0cbedc973445af2da int,
- F_6c4b761a28b734fe93831e3fb400ce87 int,
- F_06409663226af2f3114485aa4e0a23b4 int,
- F_140f6969d5213fd0ece03148e62e461e int,
- F_b73ce398c39f506af761d2277d853a92 int,
- F_bd4c9ab730f5513206b999ec0d90d1fb int,
- F_82aa4b0af34c2313a562076992e50aa3 int,
- F_0777d5c17d4066b82ab86dff8a46af6f int,
- F_fa7cdfad1a5aaf8370ebeda47a1ff1c3 int,
- F_9766527f2b5d3e95d4a733fcfb77bd7e int,
- F_7e7757b1e12abcb736ab9a754ffb617a int,
- F_5878a7ab84fb43402106c575658472fa int,
- F_006f52e9102a8d3be2fe5614f42ba989 int,
- F_3636638817772e42b59d74cff571fbb3 int,
- F_149e9677a5989fd342ae44213df68868 int,
- F_a4a042cf4fd6bfb47701cbc8a1653ada int,
- F_1ff8a7b5dc7a7d1f0ed65aaa29c04b1e int,
- F_f7e6c85504ce6e82442c770f7c8606f0 int,
- F_bf8229696f7a3bb4700cfddef19fa23f int,
- F_82161242827b703e6acf9c726942a1e4 int,
- F_38af86134b65d0f10fe33d30dd76442e int,
- F_96da2f590cd7246bbde0051047b0d6f7 int,
- F_8f85517967795eeef66c225f7883bdcb int,
- F_8f53295a73878494e9bc8dd6c3c7104f int,
- F_045117b0e0a11a242b9765e79cbf113f int,
- F_fc221309746013ac554571fbd180e1c8 int,
- F_4c5bde74a8f110656874902f07378009 int,
- F_cedebb6e872f539bef8c3f919874e9d7 int,
- F_6cdd60ea0045eb7a6ec44c54d29ed402 int,
- F_eecca5b6365d9607ee5a9d336962c534 int,
- F_9872ed9fc22fc182d371c3e9ed316094 int,
- F_31fefc0e570cb3860f2a6d4b38c6490d int,
- F_9dcb88e0137649590b755372b040afad int,
- F_a2557a7b2e94197ff767970b67041697 int,
- F_cfecdb276f634854f3ef915e2e980c31 int,
- F_0aa1883c6411f7873cb83dacb17b0afc int,
- F_58a2fc6ed39fd083f55d4182bf88826d int,
- F_bd686fd640be98efaae0091fa301e613 int,
- F_a597e50502f5ff68e3e25b9114205d4a int,
- F_0336dcbab05b9d5ad24f4333c7658a0e int,
- F_084b6fbb10729ed4da8c3d3f5a3ae7c9 int,
- F_85d8ce590ad8981ca2c8286f79f59954 int,
- F_0e65972dce68dad4d52d063967f0a705 int,
- F_84d9ee44e457ddef7f2c4f25dc8fa865 int,
- F_3644a684f98ea8fe223c713b77189a77 int,
- F_757b505cfd34c64c85ca5b5690ee5293 int,
- F_854d6fae5ee42911677c739ee1734486 int,
- F_e2c0be24560d78c5e599c2a9c9d0bbd2 int,
- F_274ad4786c3abca69fa097b85867d9a4 int,
- F_eae27d77ca20db309e056e3d2dcd7d69 int,
- F_7eabe3a1649ffa2b3ff8c02ebfd5659f int,
- F_69adc1e107f7f7d035d7baf04342e1ca int,
- F_091d584fced301b442654dd8c23b3fc9 int,
- F_b1d10e7bafa4421218a51b1e1f1b0ba2 int,
- F_6f3ef77ac0e3619e98159e9b6febf557 int,
- F_eb163727917cbba1eea208541a643e74 int,
- F_1534b76d325a8f591b52d302e7181331 int,
- F_979d472a84804b9f647bc185a877a8b5 int,
- F_ca46c1b9512a7a8315fa3c5a946e8265 int,
- F_3b8a614226a953a8cd9526fca6fe9ba5 int,
- F_45fbc6d3e05ebd93369ce542e8f2322d int,
- F_63dc7ed1010d3c3b8269faf0ba7491d4 int,
- F_e96ed478dab8595a7dbda4cbcbee168f int,
- F_c0e190d8267e36708f955d7ab048990d int,
- F_ec8ce6abb3e952a85b8551ba726a1227 int,
- F_060ad92489947d410d897474079c1477 int,
- F_bcbe3365e6ac95ea2c0343a2395834dd int,
- F_115f89503138416a242f40fb7d7f338e int,
- F_13fe9d84310e77f13a6d184dbf1232f3 int,
- F_d1c38a09acc34845c6be3a127a5aacaf int,
- F_9cfdf10e8fc047a44b08ed031e1f0ed1 int,
- F_705f2172834666788607efbfca35afb3 int,
- F_74db120f0a8e5646ef5a30154e9f6deb int,
- F_57aeee35c98205091e18d1140e9f38cf int,
- F_6da9003b743b65f4c0ccd295cc484e57 int,
- F_9b04d152845ec0a378394003c96da594 int,
- F_be83ab3ecd0db773eb2dc1b0a17836a1 int,
- F_e165421110ba03099a1c0393373c5b43 int,
- F_289dff07669d7a23de0ef88d2f7129e7 int,
- F_577ef1154f3240ad5b9b413aa7346a1e int,
- F_01161aaa0b6d1345dd8fe4e481144d84 int,
- F_539fd53b59e3bb12d203f45a912eeaf2 int,
- F_ac1dd209cbcc5e5d1c6e28598e8cbbe8 int,
- F_555d6702c950ecb729a966504af0a635 int,
- F_335f5352088d7d9bf74191e006d8e24c int,
- F_f340f1b1f65b6df5b5e3f94d95b11daf int,
- F_e4a6222cdb5b34375400904f03d8e6a5 int,
- F_cb70ab375662576bd1ac5aaf16b3fca4 int,
- F_9188905e74c28e489b44e954ec0b9bca int,
- F_0266e33d3f546cb5436a10798e657d97 int,
- F_38db3aed920cf82ab059bfccbd02be6a int,
- F_3cec07e9ba5f5bb252d13f5f431e4bbb int,
- F_621bf66ddb7c962aa0d22ac97d69b793 int,
- F_077e29b11be80ab57e1a2ecabb7da330 int,
- F_6c9882bbac1c7093bd25041881277658 int,
- F_19f3cd308f1455b3fa09a282e0d496f4 int,
- F_03c6b06952c750899bb03d998e631860 int,
- F_c24cd76e1ce41366a4bbe8a49b02a028 int,
- F_c52f1bd66cc19d05628bd8bf27af3ad6 int,
- F_fe131d7f5a6b38b23cc967316c13dae2 int,
- F_f718499c1c8cef6730f9fd03c8125cab int,
- F_d96409bf894217686ba124d7356686c9 int,
- F_502e4a16930e414107ee22b6198c578f int,
- F_cfa0860e83a4c3a763a7e62d825349f7 int,
- F_a4f23670e1833f3fdb077ca70bbd5d66 int,
- F_b1a59b315fc9a3002ce38bbe070ec3f5 int,
- F_36660e59856b4de58a219bcf4e27eba3 int,
- F_8c19f571e251e61cb8dd3612f26d5ecf int,
- F_d6baf65e0b240ce177cf70da146c8dc8 int,
- F_e56954b4f6347e897f954495eab16a88 int,
- F_f7664060cc52bc6f3d620bcedc94a4b6 int,
- F_eda80a3d5b344bc40f3bc04f65b7a357 int,
- F_8f121ce07d74717e0b1f21d122e04521 int,
- F_06138bc5af6023646ede0e1f7c1eac75 int,
- F_39059724f73a9969845dfe4146c5660e int,
- F_7f100b7b36092fb9b06dfb4fac360931 int,
- F_7a614fd06c325499f1680b9896beedeb int,
- F_4734ba6f3de83d861c3176a6273cac6d int,
- F_d947bf06a885db0d477d707121934ff8 int,
- F_63923f49e5241343aa7acb6a06a751e7 int,
- F_db8e1af0cb3aca1ae2d0018624204529 int,
- F_20f07591c6fcb220ffe637cda29bb3f6 int,
- F_07cdfd23373b17c6b337251c22b7ea57 int,
- F_d395771085aab05244a4fb8fd91bf4ee int,
- F_92c8c96e4c37100777c7190b76d28233 int,
- F_e3796ae838835da0b6f6ea37bcf8bcb7 int,
- F_6a9aeddfc689c1d0e3b9ccc3ab651bc5 int,
- F_0f49c89d1e7298bb9930789c8ed59d48 int,
- F_46ba9f2a6976570b0353203ec4474217 int,
- F_0e01938fc48a2cfb5f2217fbfb00722d int,
- F_16a5cdae362b8d27a1d8f8c7b78b4330 int,
- F_918317b57931b6b7a7d29490fe5ec9f9 int,
- F_48aedb8880cab8c45637abc7493ecddd int,
- F_839ab46820b524afda05122893c2fe8e int,
- F_f90f2aca5c640289d0a29417bcb63a37 int,
- F_9c838d2e45b2ad1094d42f4ef36764f6 int,
- F_1700002963a49da13542e0726b7bb758 int,
- F_53c3bce66e43be4f209556518c2fcb54 int,
- F_6883966fd8f918a4aa29be29d2c386fb int,
- F_49182f81e6a13cf5eaa496d51fea6406 int,
- F_d296c101daa88a51f6ca8cfc1ac79b50 int,
- F_9fd81843ad7f202f26c1a174c7357585 int,
- F_26e359e83860db1d11b6acca57d8ea88 int,
- F_ef0d3930a7b6c95bd2b32ed45989c61f int,
- F_94f6d7e04a4d452035300f18b984988c int,
- F_34ed066df378efacc9b924ec161e7639 int,
- F_577bcc914f9e55d5e4e4f82f9f00e7d4 int,
- F_11b9842e0a271ff252c1903e7132cd68 int,
- F_37bc2f75bf1bcfe8450a1a41c200364c int,
- F_496e05e1aea0a9c4655800e8a7b9ea28 int,
- F_b2eb7349035754953b57a32e2841bda5 int,
- F_8e98d81f8217304975ccb23337bb5761 int,
- F_a8c88a0055f636e4a163a5e3d16adab7 int,
- F_eddea82ad2755b24c4e168c5fc2ebd40 int,
- F_06eb61b839a0cefee4967c67ccb099dc int,
- F_9dfcd5e558dfa04aaf37f137a1d9d3e5 int,
- F_950a4152c2b4aa3ad78bdd6b366cc179 int,
- F_158f3069a435b314a80bdcb024f8e422 int,
- F_758874998f5bd0c393da094e1967a72b int,
- F_ad13a2a07ca4b7642959dc0c4c740ab6 int,
- F_3fe94a002317b5f9259f82690aeea4cd int,
- F_5b8add2a5d98b1a652ea7fd72d942dac int,
- F_432aca3a1e345e339f35a30c8f65edce int,
- F_8d3bba7425e7c98c50f52ca1b52d3735 int,
- F_320722549d1751cf3f247855f937b982 int,
- F_caf1a3dfb505ffed0d024130f58c5cfa int,
- F_5737c6ec2e0716f3d8a7a5c4e0de0d9a int,
- F_bc6dc48b743dc5d013b1abaebd2faed2 int,
- F_f2fc990265c712c49d51a18a32b39f0c int,
- F_89f0fd5c927d466d6ec9a21b9ac34ffa int,
- F_a666587afda6e89aec274a3657558a27 int,
- F_b83aac23b9528732c23cc7352950e880 int,
- F_cd00692c3bfe59267d5ecfac5310286c int,
- F_6faa8040da20ef399b63a72d0e4ab575 int,
- F_fe73f687e5bc5280214e0486b273a5f9 int);
-insert into t1 (F_8d3bba7425e7c98c50f52ca1b52d3735) values (1);
---exec $MYSQL_DUMP --skip-comments -c test
-drop table t1;
-
---echo #
---echo # Test for --add-drop-database
---echo #
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (1),(2),(3);
---exec $MYSQL_DUMP --add-drop-database --skip-comments --databases test
-DROP TABLE t1;
-
---echo #
---echo # Bug#9558 mysqldump --no-data db t1 t2 format still dumps data
---echo #
-
-CREATE DATABASE mysqldump_test_db;
-USE mysqldump_test_db;
-CREATE TABLE t1 ( a INT );
-CREATE TABLE t2 ( a INT );
-INSERT INTO t1 VALUES (1), (2);
-INSERT INTO t2 VALUES (1), (2);
---exec $MYSQL_DUMP --skip-comments --no-data mysqldump_test_db
---exec $MYSQL_DUMP --skip-comments --no-data mysqldump_test_db t1 t2
---exec $MYSQL_DUMP --skip-comments --skip-create-options --xml --no-data mysqldump_test_db
---exec $MYSQL_DUMP --skip-comments --skip-create-options --xml --no-data mysqldump_test_db t1 t2
-DROP TABLE t1, t2;
-DROP DATABASE mysqldump_test_db;
-
---echo #
---echo # Testing with tables and databases that don't exists
---echo # or contains illegal characters
---echo # (Bug#9358 mysqldump crashes if tablename starts with \)
---echo #
-create database mysqldump_test_db;
-use mysqldump_test_db;
-create table t1(a varchar(30) primary key, b int not null);
-create table t2(a varchar(30) primary key, b int not null);
-create table t3(a varchar(30) primary key, b int not null);
-
---disable_query_log
-select '------ Testing with illegal table names ------' as test_sequence ;
---enable_query_log
---replace_result mysqldump.exe mysqldump
---error 6
---exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\d-2-1.sql" 2>&1
-
---replace_result mysqldump.exe mysqldump
---error 6
---exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\t1" 2>&1
-
---replace_result mysqldump.exe mysqldump
---error 6
---exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\\t1" 2>&1
-
---replace_result mysqldump.exe mysqldump
---error 6
---exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\\\\t1" 2>&1
-
---replace_result mysqldump.exe mysqldump
---error 6
---exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "t\1" 2>&1
-
---replace_result mysqldump.exe mysqldump
---error 6
---exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "t\\1" 2>&1
-
---replace_result mysqldump.exe mysqldump
---error 6
---exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "t/1" 2>&1
-
---replace_result mysqldump.exe mysqldump
---error 6
---exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "T_1" 2>&1
-
---replace_result mysqldump.exe mysqldump
---error 6
---exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "T%1" 2>&1
-
---replace_result mysqldump.exe mysqldump
---error 6
---exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "T'1" 2>&1
-
---replace_result mysqldump.exe mysqldump
---error 6
---exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "T_1" 2>&1
-
---replace_result mysqldump.exe mysqldump
---error 6
---exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "T_" 2>&1
-
---disable_query_log
-select '------ Testing with illegal database names ------' as test_sequence ;
---enable_query_log
---replace_result mysqldump.exe mysqldump
---error 2
---exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_d 2>&1
-
---replace_result mysqldump.exe mysqldump
---error 2
---exec $MYSQL_DUMP --compact --skip-comments "mysqld\ump_test_db" 2>&1
-
-drop table t1, t2, t3;
-drop database mysqldump_test_db;
-use test;
-
-
---echo #
---echo # Bug#9657 mysqldump xml ( -x ) does not format NULL fields correctly
---echo #
-
-create table t1 (a int(10));
-create table t2 (pk int primary key auto_increment,
-a int(10), b varchar(30), c datetime, d blob, e text);
-insert into t1 values (NULL), (10), (20);
-insert into t2 (a, b) values (NULL, NULL),(10, NULL),(NULL, "twenty"),(30, "thirty");
---exec $MYSQL_DUMP --skip-comments --xml --no-create-info test
-
-# Test if UNIQUE_CHECK is done correctly
---exec $MYSQL_DUMP --skip-comments --no-create-info test
---exec $MYSQL_DUMP --skip-comments test
-drop table t1, t2;
-
-
---echo #
---echo # Bug#12123 mysqldump --tab results in text file which can't be imported
---echo #
-
-create table t1 (a text character set utf8, b text character set latin1);
-insert t1 values (0x4F736E616272C3BC636B, 0x4BF66C6E);
-select * from t1;
---exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ test
---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/t1.sql
---exec $MYSQL_IMPORT test $MYSQLTEST_VARDIR/tmp/t1.txt
-select * from t1;
-
-drop table t1;
-
-
---echo #
---echo # Bug#15328 Segmentation fault occurred if my.cnf is invalid for escape sequence
---echo #
-
---exec $MYSQL_MY_PRINT_DEFAULTS --config-file=$MYSQL_TEST_DIR/std_data/bug15328.cnf mysqldump
-
---echo #
---echo # Bug#19025 mysqldump doesn't correctly dump "auto_increment = [int]"
---echo #
-
-create table `t1` (
- t1_name varchar(255) default null,
- t1_id int(10) unsigned not null auto_increment,
- key (t1_name),
- primary key (t1_id)
-) auto_increment = 1000 default charset=latin1;
-
-insert into t1 (t1_name) values('bla');
-insert into t1 (t1_name) values('bla');
-insert into t1 (t1_name) values('bla');
-
-select * from t1;
-
-show create table `t1`;
-
---exec $MYSQL_DUMP --skip-comments test t1 > $MYSQLTEST_VARDIR/tmp/bug19025.sql
-DROP TABLE `t1`;
-
---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug19025.sql
-
-select * from t1;
-
-show create table `t1`;
-
-drop table `t1`;
---remove_file $MYSQLTEST_VARDIR/tmp/bug19025.sql
-
-
---echo #
---echo # Bug#18536 wrong table order
---echo #
-
-create table t1(a int);
-create table t2(a int);
-create table t3(a int);
---replace_result mysqldump.exe mysqldump
---error 6
---exec $MYSQL_DUMP --skip-comments --force --no-data test t3 t1 non_existing t2
-drop table t1, t2, t3;
-
-
---echo #
---echo # Bug#21288 mysqldump segmentation fault when using --where
---echo #
-
-create table t1 (a int);
---replace_result mysqldump.exe mysqldump
---error 2
---exec $MYSQL_DUMP --skip-comments --force test t1 --where="xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" 2>&1
-drop table t1;
-
-
---echo #
---echo # Bug#13926 --order-by-primary fails if PKEY contains quote character
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS `t1`;
-CREATE TABLE `t1` (
- `a b` INT,
- `c"d` INT,
- `e``f` INT,
- PRIMARY KEY (`a b`, `c"d`, `e``f`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-insert into t1 values (0815, 4711, 2006);
-
---exec $MYSQL_DUMP --skip-comments --compatible=ansi --order-by-primary test t1
---exec $MYSQL_DUMP --skip-comments --order-by-primary test t1
-DROP TABLE `t1`;
---enable_warnings
-
---echo End of 4.1 tests
-
-
---echo #
---echo # Bug#10213 mysqldump crashes when dumping VIEWs(on MacOS X)
---echo #
-
-create database db1;
-use db1;
-
-CREATE TABLE t2 (
- a varchar(30) default NULL,
- KEY a (a(5))
-);
-
-INSERT INTO t2 VALUES ('alfred');
-INSERT INTO t2 VALUES ('angie');
-INSERT INTO t2 VALUES ('bingo');
-INSERT INTO t2 VALUES ('waffle');
-INSERT INTO t2 VALUES ('lemon');
-create view v2 as select * from t2 where a like 'a%' with check option;
---exec $MYSQL_DUMP --skip-comments db1
-drop table t2;
-drop view v2;
-drop database db1;
-use test;
-
-
---echo #
---echo # Bug#10713 mysqldump includes database in create view and referenced tables
---echo #
-
-# create table and views in db2
-create database db2;
-use db2;
-create table t1 (a int);
-create table t2 (a int, b varchar(10), primary key(a));
-insert into t2 values (1, "on"), (2, "off"), (10, "pol"), (12, "meg");
-insert into t1 values (289), (298), (234), (456), (789);
-create view v1 as select * from t2;
-create view v2 as select * from t1;
-
-# dump tables and view from db2
---exec $MYSQL_DUMP db2 > $MYSQLTEST_VARDIR/tmp/bug10713.sql
-
-# drop the db, tables and views
-drop table t1, t2;
-drop view v1, v2;
-drop database db2;
-use test;
-
-# create db1 and reload dump
-create database db1;
-use db1;
---exec $MYSQL db1 < $MYSQLTEST_VARDIR/tmp/bug10713.sql
-
-# check that all tables and views could be created
-show tables;
-select * from t2 order by a;
-
-drop table t1, t2;
-drop database db1;
-use test;
---remove_file $MYSQLTEST_VARDIR/tmp/bug10713.sql
-
-#
-# dump of view
-#
-
-create table t1(a int);
-create view v1 as select * from t1;
---exec $MYSQL_DUMP --skip-comments test
-drop view v1;
-drop table t1;
-
-
---echo #
---echo # Bug#10213 mysqldump crashes when dumping VIEWs(on MacOS X)
---echo #
-
-create database mysqldump_test_db;
-use mysqldump_test_db;
-
-CREATE TABLE t2 (
- a varchar(30) default NULL,
- KEY a (a(5))
-);
-
-INSERT INTO t2 VALUES ('alfred');
-INSERT INTO t2 VALUES ('angie');
-INSERT INTO t2 VALUES ('bingo');
-INSERT INTO t2 VALUES ('waffle');
-INSERT INTO t2 VALUES ('lemon');
-create view v2 as select * from t2 where a like 'a%' with check option;
---exec $MYSQL_DUMP --skip-comments mysqldump_test_db
-drop table t2;
-drop view v2;
-drop database mysqldump_test_db;
-use test;
-
---echo #
---echo # Bug#9756 mysql client failing on dumps containing certain \ sequences
---echo #
-
-CREATE TABLE t1 (a char(10));
-INSERT INTO t1 VALUES ('\'');
---exec $MYSQL_DUMP --skip-comments test t1
-DROP TABLE t1;
-
---echo #
---echo # Bug#10927 mysqldump: Can't reload dump with view that consist of other view
---echo #
-
-create table t1(a int, b int, c varchar(30));
-
-insert into t1 values(1, 2, "one"), (2, 4, "two"), (3, 6, "three");
-
-create view v3 as
-select * from t1;
-
-create view v1 as
-select * from v3 where b in (1, 2, 3, 4, 5, 6, 7);
-
-create view v2 as
-select v3.a from v3, v1 where v1.a=v3.a and v3.b=3 limit 1;
-
---exec $MYSQL_DUMP --skip-comments test
-
-drop view v1, v2, v3;
-drop table t1;
-
---echo #
---echo # Test for dumping triggers
---echo #
-
-CREATE TABLE t1 (a int, b bigint default NULL);
-CREATE TABLE t2 (a int);
-delimiter |;
-create trigger trg1 before insert on t1 for each row
-begin
- if new.a > 10 then
- set new.a := 10;
- set new.a := 11;
- end if;
-end|
-create trigger trg2 before update on t1 for each row begin
- if old.a % 2 = 0 then set new.b := 12; end if;
-end|
-set sql_mode="traditional"|
-create trigger trg3 after update on t1 for each row
-begin
- if new.a = -1 then
- set @fired:= "Yes";
- end if;
-end|
-create trigger trg4 before insert on t2 for each row
-begin
- if new.a > 10 then
- set @fired:= "No";
- end if;
-end|
-set sql_mode=default|
-delimiter ;|
---replace_column 6 '0000-00-00 00:00:00'
-show triggers like "t1";
-INSERT INTO t1 (a) VALUES (1),(2),(3),(22);
-update t1 set a = 4 where a=3;
-# Triggers should be dumped by default
---exec $MYSQL_DUMP --skip-comments --databases test
-# Skip dumping triggers
---exec $MYSQL_DUMP --skip-comments --databases --skip-triggers test
-# Dump and reload...
---exec $MYSQL_DUMP --skip-comments --databases test > $MYSQLTEST_VARDIR/tmp/mysqldump.sql
-drop table t1;
---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqldump.sql
-# Check that tables have been reloaded
-show tables;
---replace_column 6 #
-show triggers;
-DROP TABLE t1, t2;
-
---echo #
---echo # Bug#9136 my_print_defaults changed behaviour between 4.1.7 and 4.1.10a
---echo # Bug#12917 The --defaults-extra-file option is ignored by the 5.0 client binaries
---echo # (Problems with --defaults-extra-file option)
---echo #
-
---write_file $MYSQLTEST_VARDIR/tmp/tmp.cnf
-[mysqltest1]
-port=1234
-EOF
---exec $MYSQL_MY_PRINT_DEFAULTS -c $MYSQLTEST_VARDIR/tmp/tmp.cnf mysqltest1
---exec $MYSQL_MY_PRINT_DEFAULTS -e $MYSQLTEST_VARDIR/tmp/tmp.cnf mysqltest1 mysqltest1
---remove_file $MYSQLTEST_VARDIR/tmp/tmp.cnf
-
---echo #
---echo # Test of fix to Bug#12597 mysqldump dumps triggers wrongly
---echo #
-
-DROP TABLE IF EXISTS `test1`;
-CREATE TABLE `test1` (
- `a1` int(11) default NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-
-DROP TABLE IF EXISTS `test2`;
-CREATE TABLE `test2` (
- `a2` int(11) default NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-
-DELIMITER //;
-CREATE TRIGGER `testref` BEFORE INSERT ON `test1` FOR EACH ROW BEGIN
-INSERT INTO test2 SET a2 = NEW.a1; END //
-DELIMITER ;//
-
-INSERT INTO `test1` VALUES (1);
-SELECT * FROM `test2`;
-
-# dump
---exec $MYSQL_DUMP --skip-comments --databases test > $MYSQLTEST_VARDIR/tmp/mysqldump.sql
-
-#DROP TRIGGER testref;
-#DROP TABLE test1;
-#DROP TABLE test2;
-# restore
---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqldump.sql
---replace_column 6 #
-SHOW TRIGGERS;
-SELECT * FROM `test1`;
-SELECT * FROM `test2`;
-
-DROP TRIGGER testref;
-DROP TABLE test1;
-DROP TABLE test2;
---remove_file $MYSQLTEST_VARDIR/tmp/mysqldump.sql
-
-
---echo #
---echo # Bug#9056 mysqldump does not dump routines
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP FUNCTION IF EXISTS bug9056_func1;
-DROP FUNCTION IF EXISTS bug9056_func2;
-DROP PROCEDURE IF EXISTS bug9056_proc1;
-DROP PROCEDURE IF EXISTS bug9056_proc2;
-DROP PROCEDURE IF EXISTS `a'b`;
---enable_warnings
-
-CREATE TABLE t1 (id int);
-INSERT INTO t1 VALUES(1), (2), (3), (4), (5);
-
-DELIMITER //;
-CREATE FUNCTION `bug9056_func1`(a INT, b INT) RETURNS int(11) RETURN a+b //
-CREATE PROCEDURE `bug9056_proc1`(IN a INT, IN b INT, OUT c INT)
-BEGIN SELECT a+b INTO c; end //
-
-create function bug9056_func2(f1 char binary) returns char
-begin
- set f1= concat( 'hello', f1 );
- return f1;
-end //
-
-CREATE PROCEDURE bug9056_proc2(OUT a INT)
-BEGIN
- select sum(id) from t1 into a;
-END //
-
-DELIMITER ;//
-
-set sql_mode='ansi';
-create procedure `a'b` () select 1; # to fix syntax highlighting :')
-set sql_mode='';
-
-# Dump the DB and ROUTINES
---exec $MYSQL_DUMP --skip-comments --routines --databases test
-
-# ok, now blow it all away
-DROP FUNCTION bug9056_func1;
-DROP FUNCTION bug9056_func2;
-DROP PROCEDURE bug9056_proc1;
-DROP PROCEDURE bug9056_proc2;
-DROP PROCEDURE `a'b`;
-drop table t1;
-
-
---echo #
---echo # Bug#13052 mysqldump timestamp reloads broken
---echo #
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1 (`d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, unique (`d`));
-set time_zone='+00:00';
-insert into t1 values ('2003-10-25 22:00:00'),('2003-10-25 23:00:00');
-# results should show two different time values
-select * from t1;
-set time_zone='Europe/Moscow';
-# results should show two same time values, despite unique
-select * from t1;
-set global time_zone='Europe/Moscow';
---exec $MYSQL_DUMP --skip-comments --databases test
---exec $MYSQL_DUMP --skip-tz-utc --skip-comments --databases test
-drop table t1;
-set global time_zone=default;
-set time_zone=default;
-
---echo #
---echo # Test of fix to Bug#13146 ansi quotes break loading of triggers
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS `t1 test`;
-DROP TABLE IF EXISTS `t2 test`;
---enable_warnings
-
-CREATE TABLE `t1 test` (
- `a1` int(11) default NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-
-CREATE TABLE `t2 test` (
- `a2` int(11) default NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-
-DELIMITER //;
-CREATE TRIGGER `test trig` BEFORE INSERT ON `t1 test` FOR EACH ROW BEGIN
-INSERT INTO `t2 test` SET a2 = NEW.a1; END //
-DELIMITER ;//
-
-INSERT INTO `t1 test` VALUES (1);
-INSERT INTO `t1 test` VALUES (2);
-INSERT INTO `t1 test` VALUES (3);
-SELECT * FROM `t2 test`;
-# dump with compatible=ansi. Everything except triggers should be double
-# quoted
---exec $MYSQL_DUMP --skip-comments --compatible=ansi --triggers test
-
-DROP TRIGGER `test trig`;
-DROP TABLE `t1 test`;
-DROP TABLE `t2 test`;
-
---echo #
---echo # Bug#12838 mysqldump -x with views exits with error
---echo #
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a int, b varchar(32), c varchar(32));
-insert into t1 values (1, 'first value', 'xxxx');
-insert into t1 values (2, 'second value', 'tttt');
-insert into t1 values (3, 'third value', 'vvv vvv');
-
-create view v1 as select * from t1;
-create view v0 as select * from v1;
-create view v2 as select * from v0;
-
-select * from v2;
---exec $MYSQL_DUMP -x --skip-comments --databases test
-
-drop view v2;
-drop view v0;
-drop view v1;
-drop table t1;
-
---echo #
---echo # Bug#14554 mysqldump does not separate words "ROW" and "BEGIN"
---echo # for tables with trigger created in the IGNORE_SPACE sql mode.
---echo #
-
-SET @old_sql_mode = @@SQL_MODE;
-SET SQL_MODE = IGNORE_SPACE;
-
-CREATE TABLE t1 (a INT);
-DELIMITER |;
-CREATE TRIGGER tr1 BEFORE INSERT ON t1
- FOR EACH ROW
- BEGIN
- SET new.a = 0;
- END|
-DELIMITER ;|
-
-SET SQL_MODE = @old_sql_mode;
-
---exec $MYSQL_DUMP --skip-comments --databases test
-
-DROP TRIGGER tr1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#13318 Bad result with empty field and --hex-blob
---echo #
-
-create table t1 (a binary(1), b blob);
-insert into t1 values ('','');
---exec $MYSQL_DUMP --skip-comments --skip-extended-insert --hex-blob test t1
---exec $MYSQL_DUMP --skip-comments --hex-blob test t1
-drop table t1;
-
---echo #
---echo # Bug#14871 Invalid view dump output
---echo #
-
-create table t1 (a int);
-insert into t1 values (289), (298), (234), (456), (789);
-create definer = CURRENT_USER view v1 as select * from t1;
-create SQL SECURITY INVOKER view v2 as select * from t1;
-create view v3 as select * from t1 with local check option;
-create algorithm=merge view v4 as select * from t1 with cascaded check option;
-create algorithm =temptable view v5 as select * from t1;
-
-# dump tables and views
---exec $MYSQL_DUMP test > $MYSQLTEST_VARDIR/tmp/bug14871.sql
-
-# drop the db, tables and views
-drop table t1;
-drop view v1, v2, v3, v4, v5;
-
-# Reload dump
---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug14871.sql
-
-# check that all tables and views could be created
-show tables;
-select * from v3 order by a;
-
-drop table t1;
-drop view v1, v2, v3, v4, v5;
---remove_file $MYSQLTEST_VARDIR/tmp/bug14871.sql
-
-
---echo #
---echo # Bug#16878 dump of trigger
---echo #
-
-create table t1 (a int, created datetime);
-create table t2 (b int, created datetime);
-create trigger tr1 before insert on t1 for each row set
-new.created=now();
-delimiter |;
-create trigger tr2 after insert on t1
-for each row
-begin
- insert into t2 set b=new.a and created=new.created;
-end|
-delimiter ;|
-
-# dump table and trigger
---exec $MYSQL_DUMP test > $MYSQLTEST_VARDIR/tmp/bug16878.sql
-drop trigger tr1;
-drop trigger tr2;
-drop table t1, t2;
-
-# reload dump
---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug16878.sql
---replace_column 6 #
-show triggers;
-drop trigger tr1;
-drop trigger tr2;
-drop table t1, t2;
---remove_file $MYSQLTEST_VARDIR/tmp/bug16878.sql
-
-
---echo #
---echo # Bug#18462 mysqldump does not dump view structures correctly
---echo #
-
-create table t (qty int, price int);
-insert into t values(3, 50);
-insert into t values(5, 51);
-create view v1 as select qty, price, qty*price as value from t;
-create view v2 as select qty from v1;
---echo mysqldump {
---exec $MYSQL_DUMP --compact -F --tab $MYSQLTEST_VARDIR/tmp test
---cat_file $MYSQLTEST_VARDIR/tmp/v1.sql
---echo } mysqldump {
---cat_file $MYSQLTEST_VARDIR/tmp/v2.sql
---echo } mysqldump
-drop view v1;
-drop view v2;
-drop table t;
---remove_file $MYSQLTEST_VARDIR/tmp/v1.sql
---remove_file $MYSQLTEST_VARDIR/tmp/v2.sql
---remove_file $MYSQLTEST_VARDIR/tmp/t.sql
---remove_file $MYSQLTEST_VARDIR/tmp/t.txt
-
-
---echo #
---echo # Bug#14857 Reading dump files with single statement stored routines fails.
---echo # fixed by patch for Bug#16878
---echo #
-
-DELIMITER |;
-/*!50003 CREATE FUNCTION `f`() RETURNS bigint(20)
-return 42 */|
-/*!50003 CREATE PROCEDURE `p`()
-select 42 */|
-DELIMITER ;|
-show create function f;
-show create procedure p;
-drop function f;
-drop procedure p;
-
---echo #
---echo # Bug#17371 Unable to dump a schema with invalid views
---echo #
-
-create table t1 ( id serial );
-create view v1 as select * from t1;
-drop table t1;
-# mysqldump gets 1356 from server, but gives us 2
---echo mysqldump {
---replace_result mysqldump.exe mysqldump
---error 2
---exec $MYSQL_DUMP --force -N --compact --skip-comments test
---echo } mysqldump
-drop view v1;
-
-
---echo # Bug#17201 Spurious 'DROP DATABASE' in output,
---echo # also confusion between tables and views.
---echo # Example code from Markus Popp
-
-create database mysqldump_test_db;
-use mysqldump_test_db;
-create table t1 (id int);
-create view v1 as select * from t1;
-insert into t1 values (1232131);
-insert into t1 values (4711);
-insert into t1 values (3231);
-insert into t1 values (0815);
---exec $MYSQL_DUMP --skip-comments --add-drop-database --databases mysqldump_test_db
-drop view v1;
-drop table t1;
-drop database mysqldump_test_db;
-
-
---echo #
---echo # Bug#21014 Segmentation fault of mysqldump on view
---echo #
-
-create database mysqldump_tables;
-use mysqldump_tables;
-create table basetable ( id serial, tag varchar(64) );
-
-create database mysqldump_views;
-use mysqldump_views;
-create view nasishnasifu as select mysqldump_tables.basetable.id from mysqldump_tables.basetable;
-
---exec $MYSQL_DUMP --skip-comments --compact --databases mysqldump_tables mysqldump_views
-
-drop view nasishnasifu;
-drop database mysqldump_views;
-drop table mysqldump_tables.basetable;
-drop database mysqldump_tables;
-
---echo #
---echo # Bug#20221 Dumping of multiple databases containing view(s) yields maleformed dumps
---echo #
-
-create database mysqldump_dba;
-use mysqldump_dba;
-create table t1 (f1 int, f2 int);
-insert into t1 values (1,1);
-create view v1 as select f1, f2 from t1;
-
-create database mysqldump_dbb;
-use mysqldump_dbb;
-create table t1 (f1 int, f2 int);
-insert into t1 values (2,2);
-create view v1 as select f1, f2 from t1;
-
---exec $MYSQL_DUMP --skip-comments --add-drop-database --databases mysqldump_dba mysqldump_dbb > $MYSQLTEST_VARDIR/tmp/bug20221_backup
-
-drop view v1;
-drop table t1;
-drop database mysqldump_dbb;
-use mysqldump_dba;
-drop view v1;
-drop table t1;
-drop database mysqldump_dba;
-
---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20221_backup
-
-select * from mysqldump_dba.v1;
-select * from mysqldump_dbb.v1;
-
-use mysqldump_dba;
-drop view v1;
-drop table t1;
-drop database mysqldump_dba;
-use mysqldump_dbb;
-drop view v1;
-drop table t1;
-drop database mysqldump_dbb;
---remove_file $MYSQLTEST_VARDIR/tmp/bug20221_backup
-use test;
-
---echo #
---echo # Bug#21215 mysqldump creating incomplete backups without warning
---echo #
-
-# Create user without sufficient privs to perform the requested operation
-create user mysqltest_1@localhost;
-create table t1(a int, b varchar(34));
-
-# To get consistent output, reset the master, starts over from first log
-reset master;
-
-# Execute mysqldump, will fail on FLUSH TABLES
---replace_result mysqldump.exe mysqldump
---error 2
---exec $MYSQL_DUMP --compact --master-data -u mysqltest_1 test 2>&1
-
-# Execute mysqldump, will fail on FLUSH TABLES
-# use --force, should no affect behaviour
---replace_result mysqldump.exe mysqldump
---error 2
---exec $MYSQL_DUMP --compact --force --master-data -u mysqltest_1 test 2>&1
-
-# Add RELOAD grants
-grant RELOAD on *.* to mysqltest_1@localhost;
-
-# Execute mysqldump, will fail on SHOW MASTER STATUS
---replace_result mysqldump.exe mysqldump
---error 2
---exec $MYSQL_DUMP --compact --master-data -u mysqltest_1 test 2>&1
-
-# Execute mysqldump, will fail on SHOW MASTER STATUS.
-# use --force, should not alter behaviour
---replace_result mysqldump.exe mysqldump
---error 2
---exec $MYSQL_DUMP --compact --force --master-data -u mysqltest_1 test 2>&1
-
-# Add REPLICATION CLIENT grants
-grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
-
-# Execute mysqldump, should now succeed
---disable_result_log
---exec $MYSQL_DUMP --compact --master-data -u mysqltest_1 test 2>&1
---enable_result_log
-
-# Clean up
-drop table t1;
-drop user mysqltest_1@localhost;
-
-
---echo #
---echo # Bug#21424 mysqldump failing to export/import views
---echo #
-
-# Do as root
-connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
-connection root;
-create database mysqldump_myDB;
-use mysqldump_myDB;
-create user myDB_User@localhost;
-grant create, create view, select, insert on mysqldump_myDB.* to myDB_User@localhost;
-create table t1 (c1 int);
-insert into t1 values (3);
-
-# Do as a user
-connect (user1,localhost,myDB_User,,mysqldump_myDB,$MASTER_MYPORT,$MASTER_MYSOCK);
-connection user1;
-use mysqldump_myDB;
-create table u1 (f1 int);
-insert into u1 values (4);
-create view v1 (c1) as select * from t1;
-
-# Backup should not fail for Bug#21527. Flush priviliges test begins.
---exec $MYSQL_DUMP --skip-comments --add-drop-table --flush-privileges --ignore-table=mysql.general_log --ignore-table=mysql.slow_log --ignore-table=mysql.transaction_registry --databases mysqldump_myDB mysql > $MYSQLTEST_VARDIR/tmp/bug21527.sql
-
-# Clean up
-connection root;
-use mysqldump_myDB;
-drop view v1;
-drop table t1;
-drop table u1;
-revoke all privileges on mysqldump_myDB.* from myDB_User@localhost;
-drop user myDB_User@localhost;
-drop database mysqldump_myDB;
-flush privileges;
-
-
---echo # Bug#21424 continues from here.
---echo # Restore. Flush Privileges test ends.
---echo #
-
---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21527.sql
-
-# Do as a user
-connection user1;
-use mysqldump_myDB;
-
-# Ultimate test for correct data.
-select * from mysqldump_myDB.v1;
-select * from mysqldump_myDB.u1;
-
-# Final cleanup.
-connection root;
-disconnect user1;
-use mysqldump_myDB;
-drop view v1;
-drop table t1;
-drop table u1;
-revoke all privileges on mysqldump_myDB.* from myDB_User@localhost;
-drop user myDB_User@localhost;
-drop database mysqldump_myDB;
-connection default;
-disconnect root;
---remove_file $MYSQLTEST_VARDIR/tmp/bug21527.sql
-use test;
-
---echo #
---echo # Bug #21527 mysqldump incorrectly tries to LOCK TABLES on the
---echo # information_schema database.
---echo #
---echo # Bug #33762: mysqldump can not dump INFORMATION_SCHEMA
---echo #
---exec $MYSQL_DUMP --compact --opt -d information_schema TABLES
-
---echo #
---echo # Bug#19745 mysqldump --xml produces invalid xml
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (f1 int(10), data MEDIUMBLOB);
-INSERT INTO t1 VALUES(1,0xff00fef0);
-
---exec $MYSQL_DUMP --xml --hex-blob --skip-create-options test t1
-
-DROP TABLE t1;
-
-
---echo #
---echo # Bug#26346 stack + buffer overrun in mysqldump
---echo #
-
-CREATE TABLE t1(a int);
-INSERT INTO t1 VALUES (1), (2);
-
-# too long a file path causes an error
---replace_result mysqldump.exe mysqldump
---error 1
---exec $MYSQL_DUMP --tab=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test 2>&1
-
---exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ --fields-terminated-by=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test
---replace_result mysqldump.exe mysqldump
---error 2
---exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ --fields-enclosed-by=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test
---replace_result mysqldump.exe mysqldump
---error 2
---exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ --fields-optionally-enclosed-by=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test
---replace_result mysqldump.exe mysqldump
---error 2
---exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ --fields-escaped-by=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test
---exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ --lines-terminated-by=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test
-
---remove_file $MYSQLTEST_VARDIR/tmp/t1.sql
---remove_file $MYSQLTEST_VARDIR/tmp/t1.txt
-
-DROP TABLE t1;
-
-#
-# Bug #25993 crashes with a merge table and -c
-#
-
-CREATE TABLE t2 (a INT) ENGINE=MyISAM;
-CREATE TABLE t3 (a INT) ENGINE=MyISAM;
-CREATE TABLE t1 (a INT) ENGINE=merge UNION=(t2, t3);
---exec $MYSQL_DUMP --skip-comments -c test
-DROP TABLE t1, t2, t3;
-
-
---echo #
---echo # Bug#23491 MySQLDump prefix function call in a view by database name
---echo #
-
-# Setup
-create database bug23491_original;
-create database bug23491_restore;
-use bug23491_original;
-create table t1 (c1 int);
-create view v1 as select * from t1;
-create procedure p1() select 1;
-create function f1() returns int return 1;
-create view v2 as select f1();
-create function f2() returns int return f1();
-create view v3 as select bug23491_original.f1();
-
-# Backup.
---exec $MYSQL_DUMP --skip-comments -uroot --opt --routines bug23491_original > $MYSQLTEST_VARDIR/tmp/bug23491_backup.sql
-
-# Restore.
---exec $MYSQL bug23491_restore < $MYSQLTEST_VARDIR/tmp/bug23491_backup.sql
-
-# Verify
-use bug23491_restore;
-show create view bug23491_restore.v2;
-show create view bug23491_restore.v3;
-
-# Cleanup
-drop database bug23491_original;
-drop database bug23491_restore;
-use test;
---remove_file $MYSQLTEST_VARDIR/tmp/bug23491_backup.sql
-
-
-
---echo #
---echo # Bug#27293 mysqldump crashes when dumping routines
---echo # defined by a different user
---echo #
---echo # Bug#22761 mysqldump reports no errors when using
---echo # --routines without mysql.proc privileges
---echo #
-
-create database mysqldump_test_db;
-
-grant all privileges on mysqldump_test_db.* to user1;
-grant all privileges on mysqldump_test_db.* to user2;
-
-connect (user27293,localhost,user1,,mysqldump_test_db,$MASTER_MYPORT,$MASTER_MYSOCK);
-connection user27293;
-
-create procedure mysqldump_test_db.sp1() select 'hello';
-
---replace_result mysqldump.exe mysqldump
---error 2
---exec $MYSQL_DUMP -f --compact --user=user2 --password= -h 127.0.0.1 -P $MASTER_MYPORT --routines mysqldump_test_db
-
---exec $MYSQL_DUMP -f --compact --user=user1 --password= -h 127.0.0.1 -P $MASTER_MYPORT --routines mysqldump_test_db
-
-drop procedure sp1;
-
-connection default;
-disconnect user27293;
-drop user user1;
-drop user user2;
-
-drop database mysqldump_test_db;
-
---echo #
---echo # Bug#28522 buffer overrun by '\0' byte using --hex-blob.
---echo #
-
-CREATE TABLE t1 (c1 INT, c2 LONGBLOB);
-INSERT INTO t1 SET c1=11, c2=REPEAT('q',509);
---exec $MYSQL_DUMP --skip-create-options --compact --hex-blob test t1
-DROP TABLE t1;
-
---echo #
---echo # Bug#28524 mysqldump --skip-add-drop-table is not
---echo # compatible with views
---echo #
-
-CREATE VIEW v1 AS SELECT 1;
---exec $MYSQL_DUMP --skip-add-drop-table test > $MYSQLTEST_VARDIR/tmp/bug28524.sql
-DROP VIEW v1;
-
---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug28524.sql
-SELECT * FROM v1;
-DROP VIEW v1;
---remove_file $MYSQLTEST_VARDIR/tmp/bug28524.sql
-
-
---echo #
---echo # Bug#29788 mysqldump discards the NO_AUTO_VALUE_ON_ZERO value of
---echo # the SQL_MODE variable after the dumping of triggers.
---echo #
-
-CREATE TABLE t1 (c1 INT);
-CREATE TRIGGER t1bd BEFORE DELETE ON t1 FOR EACH ROW BEGIN END;
-
-CREATE TABLE t2 (c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
-
-SET @TMP_SQL_MODE = @@SQL_MODE;
-SET SQL_MODE = 'NO_AUTO_VALUE_ON_ZERO';
-INSERT INTO t2 VALUES (0), (1), (2);
-SET SQL_MODE = @TMP_SQL_MODE;
-SELECT * FROM t2;
-
---exec $MYSQL_DUMP --routines test >$MYSQLTEST_VARDIR/tmp/bug29788.sql
---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug29788.sql
-SELECT * FROM t2;
-
-DROP TABLE t1,t2;
---remove_file $MYSQLTEST_VARDIR/tmp/bug29788.sql
-
-
---echo #
---echo # Bug#29815 new option for suppressing last line of mysqldump:
---echo # "Dump completed on"
---echo #
-
---echo # --skip-dump-date:
---replace_regex /-- [^D][^u][^m][^p].*// /\/\*!.*//
---exec $MYSQL_DUMP --skip-dump-date test
-
---echo # --dump-date:
---replace_regex /-- [^D][^u][^m][^p].*// /\/\*!.*// / on [0-9 :-]+/ on DATE/
---exec $MYSQL_DUMP --dump-date test
-
---echo # --dump-date (default):
---replace_regex /-- [^D][^u][^m][^p].*// /\/\*!.*// / on [0-9 :-]+/ on DATE/
---exec $MYSQL_DUMP test
-
---echo #
---echo # Bug #42635: mysqldump includes views that were excluded using
---echo # the --ignore-table option
---echo #
-
-create database db42635;
-use db42635;
-create table t1 (id int);
-create view db42635.v1 (c) as select * from db42635.t1;
-create view db42635.v2 (c) as select * from db42635.t1;
---exec $MYSQL_DUMP --skip-comments --ignore-table=db42635.v1 db42635
-use test;
-drop database db42635;
-
---echo #
---echo # Bug#33550 mysqldump 4.0 compatibility broken
---echo #
-
-SET NAMES utf8;
-CREATE TABLE `straße` ( f1 INT );
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --skip-comments --default-character-set=utf8 --compatible=mysql323 test
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --skip-comments --default-character-set=latin1 --compatible=mysql323 test
-DROP TABLE `straße`;
-
-CREATE TABLE `כדשגכחךלדגכחשךדגחכךלדגכ` ( f1 INT );
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --skip-comments --default-character-set=utf8 --compatible=mysql323 test
---replace_result mysqldump.exe mysqldump
---error 2
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --skip-comments --default-character-set=latin1 --compatible=mysql323 test
-DROP TABLE `כדשגכחךלדגכחשךדגחכךלדגכ`;
-SET NAMES latin1;
-
---echo #
---echo # End of 5.0 tests
---echo #
-
-# Check new --replace option
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-CREATE TABLE t1(a int, b int);
-INSERT INTO t1 VALUES (1,1);
-INSERT INTO t1 VALUES (2,3);
-INSERT INTO t1 VALUES (3,4), (4,5);
---exec $MYSQL_DUMP --replace --skip-comments test t1
-DROP TABLE t1;
-
-#
-# Added for use-thread option
-#
-
-create table t1 (a text , b text);
-create table t2 (a text , b text);
-insert t1 values ("Duck, Duck", "goose");
-insert t1 values ("Duck, Duck", "pidgeon");
-insert t2 values ("We the people", "in order to perform");
-insert t2 values ("a more perfect", "union");
-select * from t1;
-select * from t2;
---exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ test
---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/t1.sql
---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/t2.sql
-# The first load tests the pausing code
---exec $MYSQL_IMPORT --use-threads=1 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt
-# Now we test with multiple threads!
---exec $MYSQL_IMPORT --silent --use-threads=5 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt
-select * from t1;
-select * from t2;
-# Now we test with multiple threads, but less threads than files.
-create table words(a varchar(255));
-create table words2(b varchar(255));
---exec $MYSQL_IMPORT --silent --use-threads=2 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt $MYSQLTEST_VARDIR/std_data/words.dat $MYSQLTEST_VARDIR/std_data/words2.dat
-select * from t1;
-select * from t2;
-select * from words;
-select * from words2;
-
-# Drop table "words" and run with threads, should fail
-drop table words;
---replace_regex /.*mysqlimport(\.exe)*/mysqlimport/
---replace_result mysqldump.exe mysqldump
---error 1
---exec $MYSQL_IMPORT --silent --use-threads=2 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt $MYSQLTEST_VARDIR/std_data/words.dat $MYSQLTEST_VARDIR/std_data/words2.dat
-
-drop table t1;
-drop table t2;
-
-drop table words2;
-
---echo #
---echo # Bug#16853 mysqldump doesn't show events
---echo #
-
-create database first;
-use first;
-set time_zone = 'UTC';
-
-## prove one works (with spaces and tabs on the end)
-create event ee1 on schedule at '2035-12-31 20:01:23' do set @a=5;
-show events;
-show create event ee1;
---exec $MYSQL_DUMP --events first > $MYSQLTEST_VARDIR/tmp/bug16853-1.sql
-drop database first;
-
-create database second;
-use second;
---exec $MYSQL second < $MYSQLTEST_VARDIR/tmp/bug16853-1.sql
-show events;
-show create event ee1;
---remove_file $MYSQLTEST_VARDIR/tmp/bug16853-1.sql
-
-## prove three works (with spaces and tabs on the end)
-# start with one from the previous restore
-create event ee2 on schedule at '2018-12-31 21:01:23' do set @a=5;
-create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5;
-show events;
---exec $MYSQL_DUMP --events second > $MYSQLTEST_VARDIR/tmp/bug16853-2.sql
-drop database second;
-
-create database third;
-use third;
---exec $MYSQL third < $MYSQLTEST_VARDIR/tmp/bug16853-2.sql
-show events;
-drop database third;
---remove_file $MYSQLTEST_VARDIR/tmp/bug16853-2.sql
-
-# revert back to normal settings
-set time_zone = 'SYSTEM';
-use test;
-
---echo #
---echo # Bug#17201 Spurious 'DROP DATABASE' in output,
---echo # also confusion between tables and views.
---echo # Example code from Markus Popp
---echo #
-
-create database mysqldump_test_db;
-use mysqldump_test_db;
-create table t1 (id int);
-create view v1 as select * from t1;
-insert into t1 values (1232131);
-insert into t1 values (4711);
-insert into t1 values (3231);
-insert into t1 values (0815);
---exec $MYSQL_DUMP --skip-comments --add-drop-database --databases mysqldump_test_db
-drop view v1;
-drop table t1;
-drop database mysqldump_test_db;
-
-#
-# Bug#26121 mysqldump includes LOCK TABLES general_log WRITE
-#
---exec $MYSQL_DUMP --all-databases > $MYSQLTEST_VARDIR/tmp/bug26121.sql
---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug26121.sql
---remove_file $MYSQLTEST_VARDIR/tmp/bug26121.sql
-
-###########################################################################
-
---echo #
---echo # Bug#30027 mysqldump does not dump views properly.
---echo #
-
---echo
---echo # Cleanup.
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqldump_test_db;
---enable_warnings
-
---echo
---echo # Create objects.
-
-CREATE DATABASE mysqldump_test_db;
-
-set names koi8r;
-
-CREATE VIEW mysqldump_test_db.v2 AS SELECT 1 AS 1;
-CREATE VIEW mysqldump_test_db.v1 AS SELECT 1 FROM mysqldump_test_db.v2;
-
-set names latin1;
-
---echo
---echo # Dump mysqldump_test_db to bug30027.sql.
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --default-character-set=latin1 --databases mysqldump_test_db > $MYSQLTEST_VARDIR/tmp/bug30027.sql
-
---echo
---echo # Drop mysqldump_test_db.
-
-DROP DATABASE mysqldump_test_db;
-
---echo
---echo # Restore mysqldump_test_db from bug30027.sql.
-
---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug30027.sql
-
---echo
---echo # Check the view.
-
-set names utf8;
-
-SHOW CREATE VIEW mysqldump_test_db.v1;
-SHOW CREATE VIEW mysqldump_test_db.v2;
-
-set names latin1;
-
---echo
---echo # Cleanup.
-
-DROP DATABASE mysqldump_test_db;
---remove_file $MYSQLTEST_VARDIR/tmp/bug30027.sql
-
-###########################################################################
-
---echo #
---echo # Bug#29938 wrong behavior of mysqldump --skip-events
---echo # with --all-databases
---echo #
-
-TRUNCATE mysql.event;
-
-USE test;
-CREATE event e29938 ON SCHEDULE AT '2035-12-31 20:01:23' DO SET @bug29938=29938;
-SHOW EVENTS;
---exec $MYSQL_DUMP --skip-events --all-databases > $MYSQLTEST_VARDIR/tmp/bug29938.sql
-
-TRUNCATE mysql.event;
---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug29938.sql
-SHOW EVENTS;
---remove_file $MYSQLTEST_VARDIR/tmp/bug29938.sql
-
-
---echo #
---echo # Bug#31113 mysqldump 5.1 can't handle a dash ("-") in database names
---echo #
-create database `test-database`;
-use `test-database`;
-create table test (a int);
---exec $MYSQL_DUMP --compact --opt --quote-names test-database
-drop database `test-database`;
-use test;
-
-###########################################################################
-
---echo
---echo # -----------------------------------------------------------------
---echo # -- Bug#30217 Views: changes in metadata behaviour between 5.0 and 5.1.
---echo # -----------------------------------------------------------------
---echo
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqldump_test_db;
---enable_warnings
-
-CREATE DATABASE mysqldump_test_db;
-use mysqldump_test_db;
-
---echo
-
-CREATE VIEW v1(x, y) AS SELECT 'a', 'a';
-
---echo
-
-SELECT view_definition
-FROM INFORMATION_SCHEMA.VIEWS
-WHERE table_schema = 'mysqldump_test_db' AND table_name = 'v1';
-
---echo
-
---echo ---> Dumping mysqldump_test_db to bug30217.sql
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --databases mysqldump_test_db > $MYSQLTEST_VARDIR/tmp/bug30217.sql
-
---echo
-
-DROP DATABASE mysqldump_test_db;
-use test;
-
---echo
-
---echo ---> Restoring mysqldump_test_db...
---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug30217.sql
-
---echo
-
-SELECT view_definition
-FROM INFORMATION_SCHEMA.VIEWS
-WHERE table_schema = 'mysqldump_test_db' AND table_name = 'v1';
-
---echo
-
-DROP DATABASE mysqldump_test_db;
---remove_file $MYSQLTEST_VARDIR/tmp/bug30217.sql
-
---echo
---echo # -- End of test case for Bug#32538.
---echo
-
---echo #
---echo # Bug#37377 Incorrect DROP TABLE statement in dump of a VIEW using --tab
---echo #
-
-create table t1 (a int);
-create view v1 as select a from t1;
-
---exec $MYSQL_DUMP --skip-comments --tab=$MYSQLTEST_VARDIR/tmp/ test t1 v1
-
-drop view v1;
-drop table t1;
-
---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/t1.sql
---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/v1.sql
-
-drop view v1;
-drop table t1;
-
---remove_file $MYSQLTEST_VARDIR/tmp/t1.sql
---remove_file $MYSQLTEST_VARDIR/tmp/t1.txt
---remove_file $MYSQLTEST_VARDIR/tmp/v1.sql
-
-
---echo #
---echo # Bug#28071 mysqlimport does not quote or escape table name
---echo #
-
---disable_warnings
-drop table if exists `load`;
---enable_warnings
-create table `load` (a varchar(255));
-
---copy_file std_data/words.dat $MYSQLTEST_VARDIR/tmp/load.txt
-# LOAD DATA requires the file to be world-readable. This may not be true
-# automatically, depending on how the build directory was created.
---chmod 0644 $MYSQLTEST_VARDIR/tmp/load.txt
-
---exec $MYSQL_IMPORT --ignore test $MYSQLTEST_VARDIR/tmp/load.txt
-
-select count(*) from `load`;
-
---remove_file $MYSQLTEST_VARDIR/tmp/load.txt
-
-drop table `load`;
-
-# We reset concurrent_inserts value to whatever it was at the start of the
-# test This line must be executed _after_ all test cases.
-SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT;
-
-
-###########################################################################
-
---echo
---echo Bug #34861 - mysqldump with --tab gives weird output for triggers.
---echo
-
-CREATE TABLE t1 (f1 INT);
-CREATE TRIGGER tr1 BEFORE UPDATE ON t1 FOR EACH ROW SET @f1 = 1;
-CREATE PROCEDURE pr1 () SELECT "Meow";
-CREATE EVENT ev1 ON SCHEDULE AT '2030-01-01 00:00:00' DO SELECT "Meow";
-
---echo
---replace_column 6 #
-SHOW TRIGGERS;
-SHOW EVENTS;
-SELECT name,body FROM mysql.proc WHERE NAME = 'pr1';
-
---echo
---echo dump table; if anything goes to stdout, it ends up here: ---------------
---exec $MYSQL_DUMP --compact --routines --triggers --events --result-file=$MYSQLTEST_VARDIR/tmp/test_34861.sql --tab=$MYSQLTEST_VARDIR/tmp/ test
-
---echo
---echo drop everything
-DROP EVENT ev1;
-DROP TRIGGER tr1;
-DROP TABLE t1;
-DROP PROCEDURE pr1;
-
---echo
---echo reload table; this should restore table and trigger
---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/t1.sql
---replace_column 6 #
-SHOW TRIGGERS;
-SHOW EVENTS;
-SELECT name,body FROM mysql.proc WHERE NAME = 'pr1';
-
---echo
---echo reload db; this should restore routines and events
---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/test_34861.sql
---replace_column 6 #
-SHOW TRIGGERS;
-SHOW EVENTS;
-SELECT name,body FROM mysql.proc WHERE NAME = 'pr1';
-
---echo
---echo cleanup
---remove_file $MYSQLTEST_VARDIR/tmp/t1.txt
---remove_file $MYSQLTEST_VARDIR/tmp/t1.sql
---remove_file $MYSQLTEST_VARDIR/tmp/test_34861.sql
---disable_warnings
-DROP EVENT IF EXISTS ev1;
-DROP PROCEDURE IF EXISTS pr1;
-DROP TRIGGER IF EXISTS tr1;
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-###########################################################################
-
---echo #
---echo # Bug #30946: mysqldump silently ignores --default-character-set
---echo # when used with --tab
---echo #
---echo # Also see outfile_loaddata.test
---echo #
-
-SET NAMES utf8;
-CREATE TABLE t1 (a INT, b CHAR(10) CHARSET koi8r, c CHAR(10) CHARSET latin1);
-CREATE TABLE t2 LIKE t1;
-INSERT INTO t1 VALUES (1, 'ABC-АБВ', 'DEF-ÂÃÄ'), (2, NULL, NULL);
-
---let $file=$MYSQLTEST_VARDIR/tmp/t1.txt
-
-
---echo # error on multi-character ENCLOSED/ESCAPED BY
-
---replace_result mysqldump.exe mysqldump
---error 2
---exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ --fields-enclosed-by='12345' test t1
---remove_file $file
-
---replace_result mysqldump.exe mysqldump
---error 2
---exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ --fields-escaped-by='12345' test t1
---remove_file $file
-
---echo # default '--default-charset' (binary):
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --tab=$MYSQLTEST_VARDIR/tmp/ test t1
---echo ##################################################
---cat_file $file
---echo ##################################################
-TRUNCATE t2;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary
---remove_file $file
-SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
-
-
---echo # utf8:
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --default-character-set=utf8 --tab=$MYSQLTEST_VARDIR/tmp/ test t1
---echo ##################################################
---cat_file $file
---echo ##################################################
-TRUNCATE t2;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET utf8
---remove_file $file
-SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
-
-
---echo # latin1 (data corruption is expected):
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --default-character-set=latin1 --tab=$MYSQLTEST_VARDIR/tmp/ test t1
---echo ##################################################
---cat_file $file
---echo ##################################################
-TRUNCATE t2;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET latin1
---remove_file $file
-SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
-
-
---echo # koi8r (data corruption is expected):
-
---exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --default-character-set=koi8r --tab=$MYSQLTEST_VARDIR/tmp/ test t1
---echo ##################################################
---cat_file $file
---echo ##################################################
-TRUNCATE t2;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET koi8r
---remove_file $file
-SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
-
-
-SET NAMES default;
-
-DROP TABLE t1, t2;
-###########################################################################
-
---echo #
---echo # Bug #53088: mysqldump with -T & --default-character-set set
---echo # truncates text/blob to 766 chars
---echo #
---echo # Also see outfile_loaddata.test
---echo #
-
-CREATE TABLE t1 (a BLOB) CHARSET latin1;
-CREATE TABLE t2 LIKE t1;
-
-let $table= t1;
-let $dir= $MYSQLTEST_VARDIR/tmp;
-let $file= $dir/$table.txt;
-let $length= 800;
-
---eval INSERT INTO t1 VALUES (REPEAT('.', $length))
-
---exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --default-character-set=latin1 --tab=$dir/ test $table
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-
---eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET latin1
---remove_file $file
-
---echo # should be $length
-SELECT LENGTH(a) FROM t2;
-
-DROP TABLE t1, t2;
-
-###########################################################################
-
---echo #
---echo # Bug #13618 : mysqldump --xml ommit comment on table field
---echo #
-
-CREATE TABLE `comment_table` (i INT COMMENT 'FIELD COMMENT') COMMENT = 'TABLE COMMENT';
---exec $MYSQL_DUMP --compact --skip-create-options --xml test
-DROP TABLE `comment_table`;
-
---echo #
---echo # BUG#11766310 : 59398: MYSQLDUMP 5.1 CAN'T HANDLE A DASH ("-") IN
---echo # DATABASE NAMES IN ALTER DATABASE
---echo #
-
-CREATE DATABASE `test-database`;
-USE `test-database`;
-CREATE TABLE `test` (`c1` VARCHAR(10)) ENGINE=MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-
-DELIMITER |;
-CREATE TRIGGER `trig` BEFORE INSERT ON `test` FOR EACH ROW BEGIN
-END |
-DELIMITER ;|
-
-ALTER DATABASE `test-database` CHARACTER SET latin1 COLLATE latin1_swedish_ci;
-ALTER DATABASE `test-database` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
-
---exec $MYSQL_DUMP --quote-names --compact test-database
-
-DROP DATABASE `test-database`;
-# Switching back to test database.
-USE test;
-
---echo #
---echo # BUG#11760384 : 52792: mysqldump in XML mode does not dump routines.
---echo #
-CREATE DATABASE BUG52792;
-USE BUG52792;
-CREATE TABLE t1 (c1 INT, c2 VARCHAR(20));
-CREATE TABLE t2 (c1 INT);
-INSERT INTO t1 VALUES (1, 'aaa'), (2, 'bbb'), (3, 'ccc');
-INSERT INTO t2 VALUES (1),(2),(3);
-
---echo # Stored Procedures.
-
-DELIMITER //;
-CREATE PROCEDURE simpleproc1 (OUT param1 INT)
-BEGIN
- SELECT COUNT(*) INTO param1 FROM t1;
-END//
-DELIMITER ;//
-
-DELIMITER //;
-CREATE PROCEDURE simpleproc2 (OUT param1 INT)
-BEGIN
- SELECT COUNT(*) INTO param1 FROM t2;
-END//
-DELIMITER ;//
-
---echo # Events.
-
-CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE BUG52792;
-CREATE EVENT e2 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE BUG52792;
-
---echo # Functions.
-
-CREATE FUNCTION `hello1` (s CHAR(20))
- RETURNS CHAR(50) DETERMINISTIC
-RETURN CONCAT('Hello, ' ,s ,'!');
-
-CREATE FUNCTION `hello2` (s CHAR(20))
- RETURNS CHAR(50) DETERMINISTIC
-RETURN CONCAT(']]>, ' , s ,'!');
-
---echo # Triggers.
-
-DELIMITER |;
-CREATE TRIGGER trig1 BEFORE INSERT ON t2
- FOR EACH ROW BEGIN
- INSERT INTO t2 VALUES(1);
-END;
-|
-DELIMITER ;|
-
-DELIMITER |;
-CREATE TRIGGER trig2 AFTER INSERT ON t2
- FOR EACH ROW BEGIN
- INSERT INTO t2 VALUES(1, ']]>');
- INSERT INTO t2 VALUES(2, '<![CDATA]]>');
- INSERT INTO t2 VALUES(3, '<![CDATA[');
- INSERT INTO t2 VALUES(4, '< > & \ " _');
-END;
-|
-DELIMITER ;|
-
---echo # Views
-
-CREATE VIEW v1 AS SELECT * FROM t1;
-CREATE VIEW v2 AS SELECT * FROM t2;
---echo
---echo # Dumping BUG52792 database in xml format.
---echo
---echo # Running 'replace_regex on timestamp'
---replace_regex /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.[0-9]{2})*/--TIME--/
---exec $MYSQL_DUMP --user=root --compact -R -E --triggers -X BUG52792
---echo
---echo # Dumping BUG52792 database in xml format with comments.
---echo
---echo # Running 'replace_regex on timestamp'
---replace_regex /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.[0-9]{2})*/--TIME--/
---exec $MYSQL_DUMP --comments --user=root -R -E --triggers -X BUG52792
-
---echo
---echo # Test to check 'Insufficient privileges' error.
---echo
-
-GRANT ALL PRIVILEGES ON BUG52792.* TO user1;
-
-connect (conn_1, localhost, user1, , BUG52792, $MASTER_MYPORT, $MASTER_MYSOCK);
-connection conn_1;
-
---echo # Running 'replace_regex on timestamp'
---replace_regex /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.[0-9]{2})*/--TIME--/
-
---replace_result mysqldump.exe mysqldump
---error 2
---exec $MYSQL_DUMP --user=user1 -R -E --triggers -X BUG52792
-
-connection default;
-disconnect conn_1;
-
-DROP USER user1;
-DROP DATABASE BUG52792;
---echo # UTF-8
-CREATE DATABASE BUG52792;
-USE BUG52792;
-SET NAMES utf8;
-CREATE FUNCTION `straße` ( c1 CHAR(20))
- RETURNS CHAR(50) DETERMINISTIC
-RETURN CONCAT(']]>, ', s, '!');
-
---exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=utf8 --compatible=mysql323 -R -X BUG52792
-
-DROP DATABASE BUG52792;
-
-USE test;
-
---echo #
---echo # End of 5.1 tests
---echo #
-
---echo #
---echo # Verify that two modes can be given in --compatible;
---echo # and are reflected in SET SQL_MODE in the mysqldump output.
---echo # Also verify that a prefix of the mode's name is enough.
---echo #
-CREATE TABLE t1 (a INT);
-# no_t = no_table_options; no_f = no_field_options
---exec $MYSQL_DUMP --compatible=no_t,no_f --skip-comments test
-DROP TABLE t1;
-
---echo #
---echo # Bug#12809202 61854: MYSQLDUMP --SINGLE-TRANSACTION --FLUSH-LOG BREAKS
---echo # CONSISTENCY
---echo #
-
---disable_warnings
-DROP DATABASE IF EXISTS b12809202_db;
---enable_warnings
-
-CREATE DATABASE b12809202_db;
-CREATE TABLE b12809202_db.t1 (c1 INT);
-CREATE TABLE b12809202_db.t2 (c1 INT);
-
-INSERT INTO b12809202_db.t1 VALUES (1), (2), (3);
-INSERT INTO b12809202_db.t2 VALUES (1), (2), (3);
-
---echo # Starting mysqldump with --single-transaction & --flush-logs options..
---echo # Note : In the following dump the transaction
---echo # should start only after the logs are
---echo # flushed, as 'flush logs' causes implicit
---echo # commit starting 5.5.
---echo
---echo #### Dump starts here ####
-# We only need to check the --verbose output to verify that "start transaction"
-# happens after "logs flushed". We redirect normal output, as otherwise the
-# mixing of normal (stdout) and --verbose (stderr) output will happen in random
-# order depending on stdio internal buffer size.
---replace_regex /-- Server version.*// /-- MySQL dump .*// /-- Dump completed on .*/-- Dump completed/
---exec $MYSQL_DUMP --verbose --single-transaction --flush-logs b12809202_db 2>&1 > $MYSQLTEST_VARDIR/tmp/bug61854.sql
---echo
---echo #### Dump ends here ####
-
-# Cleanup
-DROP TABLE b12809202_db.t1;
-DROP TABLE b12809202_db.t2;
-DROP DATABASE b12809202_db;
-
---echo #
---echo # Delete all existing binary logs.
---echo #
-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 # MDEV-5481 mysqldump fails to dump geometry types properly
-
-create table t1 (g GEOMETRY) CHARSET koi8r;
-create table t2 (g GEOMETRY) CHARSET koi8r;
-insert into t1 values (point(1,1)), (point(2,2));
---exec $MYSQL_DUMP --hex-blob --character-sets-dir=$MYSQL_SHAREDIR/charsets --tab=$MYSQLTEST_VARDIR/tmp/ test t1
---echo ##################################################
---cat_file $file
---echo ##################################################
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET koi8r
---remove_file $file
-select astext(g) from t2;
-drop table t1, t2;
-
---echo #
---echo # End of 5.1 tests
---echo #
-
---echo #
---echo # Bug #20772273 : MYSQLIMPORT --USE-THREADS DOESN'T USE MULTIPLE THREADS
---echo #
-
-CREATE DATABASE db_20772273;
-USE db_20772273;
-CREATE TABLE t1(a INT);
-INSERT INTO t1 VALUES (1), (2);
-CREATE TABLE t2(a INT);
-INSERT INTO t2 VALUES (3), (4);
-
-SELECT * FROM t1;
-SELECT * FROM t2;
-
---exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ db_20772273
---exec $MYSQL db_20772273 < $MYSQLTEST_VARDIR/tmp/t1.sql
---exec $MYSQL db_20772273 < $MYSQLTEST_VARDIR/tmp/t2.sql
-
-# Test mysqlimport with multiple threads
---exec $MYSQL_IMPORT --silent --use-threads=2 db_20772273 $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt
-
-SELECT * FROM t1;
-SELECT * FROM t2;
-
-#Cleanup
-DROP TABLE t1;
-DROP TABLE t2;
-DROP DATABASE db_20772273;
-USE test;
-
---echo #
---echo # Bug #25717383: MYSQLDUMP MAY EXECUTE ANY ARBITRARY QUERY
---echo #
-
-
-CREATE DATABASE bug25717383;
-use bug25717383;
-
-CREATE TABLE `tab
-one` (a int);
-CREATE VIEW `view
-one` as SELECT * FROM `tab
-one`;
-
-CREATE PROCEDURE `proc
-one`() SELECT * from `tab
-one`;
-
-CREATE TEMPORARY TABLE `temp
-one` (id INT);
-
-CREATE TRIGGER `trig
-one` BEFORE INSERT ON `tab
-one` FOR EACH ROW SET NEW.a = 1;
-
-CREATE EVENT `event
-one` ON SCHEDULE AT '2030-01-01 00:00:00' DO SET @a=5;
-
-SHOW TABLES FROM bug25717383;
---replace_column 6 #
-SHOW TRIGGERS FROM bug25717383;
---replace_column 6 #
-SHOW EVENTS FROM bug25717383;
-
-SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES
- WHERE ROUTINE_SCHEMA='bug25717383' AND ROUTINE_TYPE= 'PROCEDURE'
- ORDER BY ROUTINE_NAME;
-
---exec $MYSQL_DUMP --triggers --events --routines --add-drop-database --databases bug25717383 > $MYSQLTEST_VARDIR/tmp/bug25717383.sql
-
-SHOW TABLES FROM bug25717383;
---replace_column 6 #
-SHOW TRIGGERS FROM bug25717383;
---replace_column 6 #
-SHOW EVENTS FROM bug25717383;
-
-SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES
- WHERE ROUTINE_SCHEMA='bug25717383' AND ROUTINE_TYPE= 'PROCEDURE'
- ORDER BY ROUTINE_NAME;
-
-DROP DATABASE bug25717383;
-
-#
-# MDEV-6091 mysqldump goes in a loop and segfaults if --dump-slave is specified and it cannot connect to the server
-#
---error 2
---exec $MYSQL_DUMP -hunknownhost --dump-slave nulldb
-
-#
-# MDEV-6056 [PATCH] mysqldump writes usage to stdout even when not explicitly requested
-#
---replace_result mysqldump.exe mysqldump
---error 1
---exec $MYSQL_DUMP --user=foo 2>&1 > $MYSQLTEST_VARDIR/tmp/bug6056.out
---exec $MYSQL_DUMP --help > $MYSQLTEST_VARDIR/tmp/bug6056.out
-
---echo #
---echo # MDEV-9001 - [PATCH] Fix DB name quoting in mysqldump --routine
---echo #
-CREATE DATABASE `a\"'``b`;
-USE `a\"'``b`;
-CREATE PROCEDURE p1() BEGIN END;
-ALTER DATABASE `a\"'``b` COLLATE utf8_general_ci;
---let shell_ready_db_name="a\\\\\\"'`b"
-if (`select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows") = 0`)
-{
- --let shell_ready_db_name=a\\\\\\"\\'\\`b
-}
---exec $MYSQL_DUMP --routines --compact $shell_ready_db_name
-DROP DATABASE `a\"'``b`;
-
-#"
-use test;
-
---echo #
---echo # Test mysqldump with --disable-query-logs
---echo #
-
-create table t1 (a int);
-insert into t1 values (1);
-
---exec $MYSQL_DUMP --hex-blob --character-sets-dir=$MYSQL_SHAREDIR/charsets --tab=$MYSQLTEST_VARDIR/tmp/ test t1
---exec $MYSQL_DUMP --disable-log-queries --skip-comments test t1 >$MYSQLTEST_VARDIR/tmp/mysqldump-test.out
-drop table t1;
-
---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqldump-test.out
-select * from t1;
-drop table t1;
---remove_file $MYSQLTEST_VARDIR/tmp/mysqldump-test.out
-#select * from mysql.user;
-#checksum table mysql.user;
-
---echo #
---echo # MDEV-9124 mysqldump does not dump data if table name is same as view earlier on
---echo #
-
-CREATE DATABASE db1 CHARSET=utf8;
-CREATE DATABASE db2 CHARSET=utf8;
-USE db2;
-CREATE TABLE nonunique_table_name (i1 serial) ENGINE=MEMORY;
-INSERT INTO nonunique_table_name VALUES (1),(2);
-CREATE TABLE nonunique_table_view_name (i2 int) ENGINE=InnoDB;
-INSERT INTO nonunique_table_view_name VALUES (3),(4);
-use db1;
-CREATE TABLE basetable (id smallint) ENGINE=MyISAM;
-CREATE TABLE nonunique_table_name (i3 smallint) ENGINE=MERGE UNION (basetable) INSERT_METHOD=LAST;
-INSERT INTO nonunique_table_name VALUES (5),(6);
-CREATE VIEW nonunique_table_view_name AS SELECT 1;
-
---echo
---echo ##################################################
---echo # --compact --databases db1 db2
---exec $MYSQL_DUMP --compact --databases db1 db2
---echo
---echo ##################################################
---echo # --compact db2
---echo
---exec $MYSQL_DUMP --compact db2
---echo
---echo ##################################################
---echo # --compact --delayed-insert --no-data-med=0 --databases db2 db1
---exec $MYSQL_DUMP --compact --delayed-insert --no-data-med=0 --databases db2 db1
---echo
-
-DROP DATABASE db1;
-DROP DATABASE db2;
-
-#"
-# MDEV-11505 wrong databasename in mysqldump comment
-#
-let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/bug11505.sql;
-let SEARCH_PATTERN=Database: mysql;
-exec $MYSQL_DUMP mysql func > $SEARCH_FILE;
-source include/search_pattern_in_file.inc;
-
---echo #
---echo # Test for --add-drop-trigger
---echo #
-use test;
-CREATE TABLE t1 (a int, b int);
-CREATE TRIGGER tt1_t1 BEFORE INSERT ON t1 FOR EACH ROW
- SET NEW.b=NEW.a + 10;
-
-INSERT INTO t1 (a) VALUES (1),(2),(3);
---exec $MYSQL_DUMP --triggers --no-data --no-create-info --add-drop-trigger --skip-comments --databases test
-DROP TABLE t1;
---echo #
---echo # Test for Invisible columns
---echo #
-create database d;
-use d;
-
---echo # Invisble field table
-create table t1(a int , b int invisible);
-insert into t1 values(1);
-insert into t1(a,b) values(1,2);
-
---echo # not invisible field table --complete-insert wont be used
-create table t2(a int , b int);
-insert into t2(a,b) values(1,2);
-insert into t2(a,b) values(1,2);
-
---echo # Invisble field table
-create table t3(invisible int , `a b c & $!@#$%^&*( )` int invisible default 4, `ds=~!@ \# $% ^ & * ( ) _ - = +` int invisible default 5);
-insert into t3 values(1);
-insert into t3 values(5);
-insert into t3 values(2);
-insert into t3(`invisible`, `a b c & $!@#$%^&*( )`, `ds=~!@ \# $% ^ & * ( ) _ - = +` ) values(1,2,3);
-CREATE TABLE t4(ËÏÌÏÎËÁ1 INT);
-insert into t4 values(1);
---exec $MYSQL_DUMP --compact d
-
---echo #Check side effect on --complete insert
---exec $MYSQL_DUMP --compact --complete-insert d
---echo #Check xml
---exec $MYSQL_DUMP --skip-create-options --skip-comments -X d
-
-#import data
---exec $MYSQL_DUMP --skip-comments d > $MYSQLTEST_VARDIR/tmp/invisible_dump.sql
-DROP table t1,t2,t3;
-
---exec $MYSQL d < $MYSQLTEST_VARDIR/tmp/invisible_dump.sql
-
-select * from t1;
-select a,b from t1;
-select * from t2;
-select * from t3;
-desc t3;
-drop database d;
diff --git a/mysql-test/t/mysqldump_restore.test b/mysql-test/t/mysqldump_restore.test
deleted file mode 100644
index 835ee3ee9e9..00000000000
--- a/mysql-test/t/mysqldump_restore.test
+++ /dev/null
@@ -1,111 +0,0 @@
-###############################################################################
-# mysqldump_restore.test
-#
-# Purpose: Tests if mysqldump output can be used to successfully restore
-# tables and data.
-# We CREATE a table, mysqldump it to a file, ALTER the original
-# table's name, recreate the table from the mysqldump file, then
-# utilize include/diff_tables to compare the original and recreated
-# tables.
-#
-# We use several examples from mysqldump.test here and include
-# the relevant bug numbers and headers from that test.
-#
-# NOTE: This test is not currently complete and offers only basic
-# cases of mysqldump output being restored.
-# Also, does NOT work with -X (xml) output!
-#
-# Author: pcrews
-# Created: 2009-05-21
-# Last Change:
-# Change date:
-###############################################################################
-
-# Embedded server doesn't support external clients
---source include/not_embedded.inc
---source include/have_log_bin.inc
-
---echo # Set concurrent_insert = 0 to prevent random errors
---echo # will reset to original value at the end of the test
-SET @old_concurrent_insert = @@global.concurrent_insert;
-SET @@global.concurrent_insert = 0;
-
-# Define mysqldumpfile here. It is used to capture mysqldump output
-# in order to test the output's ability to restore an exact copy of the table
-let $mysqldumpfile = $MYSQLTEST_VARDIR/tmp/mysqldumpfile.sql;
-
---echo # Pre-test cleanup
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
---echo # Begin tests
---echo #
---echo # Bug#2005 Long decimal comparison bug.
---echo #
-CREATE TABLE t1 (a DECIMAL(64, 20));
-INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
-("0987654321098765432109876543210987654321");
---exec $MYSQL_DUMP --compact test t1 > $mysqldumpfile
-let $table_name = test.t1;
---source include/mysqldump.inc
-
---echo #
---echo # Bug#3361 mysqldump quotes DECIMAL values inconsistently
---echo #
-CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT);
-# Check at first how mysql work with quoted decimal
-INSERT INTO t1 VALUES (1.2345, 2.3456);
-INSERT INTO t1 VALUES ('1.2345', 2.3456);
-INSERT INTO t1 VALUES ("1.2345", 2.3456);
-SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ANSI_QUOTES';
-INSERT INTO t1 VALUES (1.2345, 2.3456);
-INSERT INTO t1 VALUES ('1.2345', 2.3456);
---error ER_BAD_FIELD_ERROR
-INSERT INTO t1 VALUES ("1.2345", 2.3456);
-SET SQL_MODE=@OLD_SQL_MODE;
-
-# check how mysqldump make quoting
---exec $MYSQL_DUMP --compact test t1 > $mysqldumpfile
-let $table_name = test.t1;
---source include/mysqldump.inc
-
---echo #
---echo # Bug#1994 mysqldump does not correctly dump UCS2 data
---echo # Bug#4261 mysqldump 10.7 (mysql 4.1.2) --skip-extended-insert drops NULL from inserts
---echo #
-CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r;
-INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'), (NULL);
---exec $MYSQL_DUMP --skip-comments --skip-extended-insert test t1 > $mysqldumpfile
-let $table_name = test.t1;
---source include/mysqldump.inc
-
---echo #
---echo # WL#2319 Exclude Tables from dump
---echo #
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (a INT);
-INSERT INTO t1 VALUES (1),(2),(3);
-INSERT INTO t2 VALUES (4),(5),(6);
---exec $MYSQL_DUMP --skip-comments --ignore-table=test.t1 test > $mysqldumpfile
-let $table_name = test.t2;
---source include/mysqldump.inc
-DROP TABLE t1;
-
---echo #
---echo # Bug#8830 mysqldump --skip-extended-insert causes --hex-blob to dump wrong values
---echo #
-CREATE TABLE t1 (`b` blob);
-INSERT INTO `t1` VALUES (0x602010000280100005E71A);
---exec $MYSQL_DUMP --skip-extended-insert --hex-blob test --skip-comments t1 > $mysqldumpfile
-let $table_name = test.t1;
---source include/mysqldump.inc
-
---echo # End tests
-
---echo # Cleanup
---echo # Reset concurrent_insert to its original value
-SET @@global.concurrent_insert = @old_concurrent_insert;
---echo # remove mysqldumpfile
---error 0,1
---remove_file $mysqldumpfile
diff --git a/mysql-test/t/mysqlhotcopy_myisam.test b/mysql-test/t/mysqlhotcopy_myisam.test
deleted file mode 100644
index adf26e42245..00000000000
--- a/mysql-test/t/mysqlhotcopy_myisam.test
+++ /dev/null
@@ -1,7 +0,0 @@
-# Test of mysqlhotcopy (perl script)
-# Author: Horst Hunger
-# Created: 2010-05-10
-
-let $engine= MyISAM;
---source include/mysqlhotcopy.inc
---exit
diff --git a/mysql-test/t/mysqlshow.test b/mysql-test/t/mysqlshow.test
deleted file mode 100644
index 8c60b64a5f1..00000000000
--- a/mysql-test/t/mysqlshow.test
+++ /dev/null
@@ -1,42 +0,0 @@
-# Can't run test of external client with embedded server
--- source include/not_embedded.inc
-# Don't test when thread_pool active
---source include/not_threadpool.inc
-
---disable_warnings
-DROP TABLE IF EXISTS t1,t2,test1,test2;
---enable_warnings
-
-#
-## Bug #5036 mysqlshow is missing a column
-#
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (1),(2),(3);
-CREATE TABLE t2 (a int, b int);
-show tables;
-select "--------------------" as "";
---exec $MYSQL_SHOW test
-select "---- -v ------------" as "";
---exec $MYSQL_SHOW test -v
-select "---- -v -v ---------" as "";
---exec $MYSQL_SHOW test -v -v
-select "----- -t -----------" as "";
---exec $MYSQL_SHOW test -t
-select "---- -v -t ---------" as "";
---exec $MYSQL_SHOW test -v -t
-select "---- -v -v -t ------" as "";
---exec $MYSQL_SHOW test -v -v -t
-DROP TABLE t1, t2;
-
---echo End of 5.0 tests
-
-# because of lp:1066512 this test shows xtradb I_S plugins, even when
-# xtradb is supposed to be disabled
-
-#
-# Bug #19147: mysqlshow INFORMATION_SCHEMA does not work
-#
-#--exec $MYSQL_SHOW information_schema
-#--exec $MYSQL_SHOW INFORMATION_SCHEMA
-#--exec $MYSQL_SHOW inf_rmation_schema
-
diff --git a/mysql-test/t/mysqlslap.opt b/mysql-test/t/mysqlslap.opt
deleted file mode 100644
index 632f5b4c069..00000000000
--- a/mysql-test/t/mysqlslap.opt
+++ /dev/null
@@ -1 +0,0 @@
---sql_mode='NO_ENGINE_SUBSTITUTION'
diff --git a/mysql-test/t/mysqlslap.test b/mysql-test/t/mysqlslap.test
deleted file mode 100644
index c49c4ab3d7d..00000000000
--- a/mysql-test/t/mysqlslap.test
+++ /dev/null
@@ -1,82 +0,0 @@
-# Can't run test of external client with embedded server
---source include/not_embedded.inc
-
---exec $MYSQL_SLAP --silent --concurrency=5 --iterations=20 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql
-
---exec $MYSQL_SLAP --silent --concurrency=5 --iterations=20 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql
-
---exec $MYSQL_SLAP --only-print --iterations=20 --query="select * from t1" --create="CREATE TABLE t1 (id int, name varchar(64)); INSERT INTO t1 VALUES (1, 'This is a test')" --delimiter=";"
---exec $MYSQL_SLAP --silent --concurrency=5 --iterations=20 --query="select * from t1" --create="CREATE TABLE t1 (id int, name varchar(64)); INSERT INTO t1 VALUES (1, 'This is a test')" --delimiter=";"
-
---exec $MYSQL_SLAP --only-print --delimiter=";" --query="select * from t1;select * from t2" --create="CREATE TABLE t1 (id int, name varchar(64)); create table t2(foo1 varchar(32), foo2 varchar(32)); INSERT INTO t1 VALUES (1, 'This is a test'); insert into t2 values ('test', 'test2')" --engine="heap,myisam"
-
---exec $MYSQL_SLAP --silent --concurrency=5 --iterations=20 --delimiter=";" --query="select * from t1;select * from t2" --create="CREATE TABLE t1 (id int, name varchar(64)); create table t2(foo1 varchar(32), foo2 varchar(32)); INSERT INTO t1 VALUES (1, 'This is a test'); insert into t2 values ('test', 'test2')"
-
---exec $MYSQL_SLAP --silent --concurrency=5 --iterations=20 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --create-schema=test_env
-
---exec $MYSQL_SLAP --silent --concurrency=5 --iterations=20 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --create-schema=test_env --auto-generate-sql-add-autoincrement
-
---exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-add-autoincrement
-
---exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-add-autoincrement --auto-generate-sql-load-type=update
-
---exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-add-autoincrement --auto-generate-sql-load-type=read
-
---exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-add-autoincrement --auto-generate-sql-load-type=write
-
---exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-add-autoincrement --auto-generate-sql-load-type=mixed
-
---exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-guid-primary --auto-generate-sql-load-type=update
-
---exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-guid-primary --auto-generate-sql-load-type=update --auto-generate-sql-execute-number=5
-
---exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-guid-primary --auto-generate-sql-load-type=key --auto-generate-sql-execute-number=5
-
---exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-guid-primary --auto-generate-sql-load-type=key --auto-generate-sql-execute-number=5 --auto-generate-sql-secondary-indexes=3
-
---exec $MYSQL_SLAP --only-print --delimiter=";" --query="select * from t1;select * from t2" --create="CREATE TABLE t1 (id int, name varchar(64)); create table t2(foo1 varchar(32), foo2 varchar(32)); INSERT INTO t1 VALUES (1, 'This is a test'); insert into t2 values ('test', 'test2')" --engine="heap,myisam" --post-query="SHOW TABLES" --pre-query="SHOW TABLES";
-
- --exec $MYSQL_SLAP --only-print --delimiter=";" --query="select * from t1;select * from t2" --create="CREATE TABLE t1 (id int, name varchar(64)); create table t2(foo1 varchar(32), foo2 varchar(32)); INSERT INTO t1 VALUES (1, 'This is a test'); insert into t2 values ('test', 'test2')" --engine="heap,myisam" --post-query="SHOW TABLES" --pre-query="SHOW TABLES" --number-of-queries=6 --commit=1
-
---exec $MYSQL_SLAP --silent --concurrency=5 --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-add-autoincrement --auto-generate-sql-load-type=write --detach=2
-
---echo #
---echo # Bug #29985: mysqlslap -- improper handling of resultsets in SPROCs
---echo #
-
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
---enable_warnings
-CREATE PROCEDURE p1() SELECT 1;
-
---exec $MYSQL_SLAP --create-schema=test --delimiter=";" --query="CALL p1; SELECT 1;" --silent 2>&1
-
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Bug #11765157 - 58090: mysqlslap drops schema specified in
---echo # create_schema if auto-generate-sql also set.
---echo #
-
---exec $MYSQL_SLAP --silent --create-schema=bug58090 --concurrency=5 --iterations=20 --auto-generate-sql
---echo # 'bug58090' database should not be present.
-SHOW DATABASES;
---exec $MYSQL_SLAP --silent --create-schema=bug58090 --no-drop --auto-generate-sql
---echo # 'bug58090' database should be present.
-SHOW DATABASES;
-DROP DATABASE bug58090;
-
---echo #
---echo # Bug #11766072 - 59107: MYSQLSLAP CRASHES IF STARTED WITH NO ARGUMENTS ON WINDOWS
---echo #
-
---replace_regex /queries: [0-9]+.[0-9]+/queries: TIME/
---exec $MYSQL_SLAP
-
---echo #
---echo # MDEV-4684 - Enhancement request: --init-command support for mysqlslap
---echo #
-
---exec $MYSQL_SLAP --create-schema=test --init-command="CREATE TABLE t1(a INT)" --silent --concurrency=1 --iterations=1
-DROP TABLE t1;
diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test
deleted file mode 100644
index d6c68ecf3c2..00000000000
--- a/mysql-test/t/mysqltest.test
+++ /dev/null
@@ -1,2964 +0,0 @@
-# ----------------------------------------------------------------------------
-# $mysql_errno contains the return code of the last command
-# sent to the server.
-# ----------------------------------------------------------------------------
-# get $mysql_errno before the first statement
-# $mysql_errno should be -1
-# get $mysql_errname as well
-
-echo $mysql_errno before test;
-echo $mysql_errname before test;
-
--- source include/have_log_bin.inc
-
-# This test should work in embedded server after mysqltest is fixed
--- source include/not_embedded.inc
-
-# This test uses chmod, can't be run with root permissions
--- source include/not_as_root.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-# Some tests below connect/disconnect rapidly in a loop. This causes a race
-# where mysqld may not have time to register the previous disconnects before
-# new connects, and eventually we run out of connections. So we need to
-# increase the maximum.
-let $saved_max_connections = `SELECT @@global.max_connections`;
-SET GLOBAL max_connections = 1000;
-
-
-# ============================================================================
-#
-# Test of mysqltest itself
-#
-# There are three rules that determines what belong to each command
-# 1. A normal command is delimited by the <delimiter> which by default is
-# set to ';'
-#
-# ex: | select *
-# | from t1;
-# |
-# Command: "select * from t1"
-#
-# 2. Special case is a line that starts with "--", this is a comment
-# ended when the new line character is reached. But the first word
-# in the comment may contain a valid command, which then will be
-# executed. This can be useful when sending commands that
-# contains <delimiter>
-#
-# 3. Special case is also a line that starts with '#' which is treated
-# as a comment and will be ended by new line character
-#
-# ============================================================================
-
-# ----------------------------------------------------------------------------
-# Positive case(statement)
-# ----------------------------------------------------------------------------
-
-select otto from (select 1 as otto) as t1;
-# expectation = response
---error 0
-select otto from (select 1 as otto) as t1;
-
-# ----------------------------------------------------------------------------
-# Negative case(statement):
-# The derived table t1 does not contain a column named 'friedrich' .
-# --> ERROR 42S22: Unknown column 'friedrich' in 'field list and
-# --> 1054: Unknown column 'friedrich' in 'field list'
-# ----------------------------------------------------------------------------
-
-# expectation <> response
-#--error 0
-#select friedrich from (select 1 as otto) as t1
---error 1
---exec echo "select friedrich from (select 1 as otto) as t1;" | $MYSQL_TEST 2>&1
-
-# expectation = response
---error ER_BAD_FIELD_ERROR
-
-select friedrich from (select 1 as otto) as t1;
-
-# The following unmasked unsuccessful statement must give
-# 1. mysqltest gives a 'failed'
-# 2. does not produce a r/<test case>.reject file !!!
-# PLEASE uncomment it and check its effect
-#select friedrich from (select 1 as otto) as t1;
-
-
-# ----------------------------------------------------------------------------
-# Tests for the new feature - SQLSTATE error code matching
-# Positive case(statement)
-# ----------------------------------------------------------------------------
-
-# This syntax not allowed anymore, use --error S00000, see below
-# expectation = response
-#!S00000 select otto from (select 1 as otto) as t1;
-
---error S00000
-select otto from (select 1 as otto) as t1;
-
-# expectation <> response
-#!S42S22 select otto from (select 1 as otto) as t1;
-#--error S42S22
-#select otto from (select 1 as otto) as t1;
---error 1
---exec echo "error S42S22; select otto from (select 1 as otto) as t1;" | $MYSQL_TEST 2>&1
-
-# expecting a SQL-state for a command that can't give one should fail
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---error 1
---exec echo "disable_warnings ; error S00000; remove_file $MYSQLTEST_VARDIR/tmp/test_nonexistent.tmp;" | $MYSQL_TEST 2>&1
-
-
-# ----------------------------------------------------------------------------
-# Negative case(statement)
-# ----------------------------------------------------------------------------
-
-# This syntax not allowed anymore, use --error S42S22, see below
-# expectation = response
-#!S42S22 select friedrich from (select 1 as otto) as t1;
---error S42S22
-select friedrich from (select 1 as otto) as t1;
-
-# expectation !=response
-#!S00000 select friedrich from (select 1 as otto) as t1;
-#--error S00000
-#select friedrich from (select 1 as otto) as t1;
---error 1
---exec echo "error S00000; select friedrich from (select 1 as otto) as t1;" | $MYSQL_TEST 2>&1
-
-# ----------------------------------------------------------------------------
-# test cases for $mysql_errno
-#
-# $mysql_errno is a builtin variable of mysqltest and contains the return code
-# of the last command sent to the server.
-#
-# The following test cases often initialize $mysql_errno to 1064 by
-# a command with wrong syntax.
-# Example: --error 1064 To prevent the abort after the error.
-# garbage ;
-# ----------------------------------------------------------------------------
-
-# ----------------------------------------------------------------------------
-# check mysql_errno = 0 after successful statement
-# ----------------------------------------------------------------------------
-select otto from (select 1 as otto) as t1;
-echo $mysql_errname;
-eval select $mysql_errno as "after_successful_stmt_errno" ;
-
-#----------------------------------------------------------------------------
-# check mysql_errno = 1064 after statement with wrong syntax
-# ----------------------------------------------------------------------------
---error ER_PARSE_ERROR
-
-garbage ;
-echo $mysql_errname;
-eval select $mysql_errno as "after_wrong_syntax_errno" ;
-
-# ----------------------------------------------------------------------------
-# check if let $my_var= 'abc' ; affects $mysql_errno
-# ----------------------------------------------------------------------------
---error ER_PARSE_ERROR
-
-garbage ;
-let $my_var= 'abc' ;
-echo $mysql_errname;
-eval select $mysql_errno as "after_let_var_equal_value" ;
-
-# ----------------------------------------------------------------------------
-# check if set @my_var= 'abc' ; affects $mysql_errno
-# ----------------------------------------------------------------------------
---error ER_PARSE_ERROR
-
-garbage ;
-set @my_var= 'abc' ;
-echo $mysql_errname;
-eval select $mysql_errno as "after_set_var_equal_value" ;
-
-# ----------------------------------------------------------------------------
-# check if the setting of --disable-warnings itself affects $mysql_errno
-# (May be --<whatever> modifies $mysql_errno.)
-# ----------------------------------------------------------------------------
---error ER_PARSE_ERROR
-
-garbage ;
---disable_warnings
-echo $mysql_errname;
-eval select $mysql_errno as "after_disable_warnings_command" ;
-
-# ----------------------------------------------------------------------------
-# check if --disable-warnings + command with warning affects the errno
-# stored within $mysql_errno
-# (May be disabled warnings affect $mysql_errno.)
-# ----------------------------------------------------------------------------
-drop table if exists t1 ;
---error ER_PARSE_ERROR
-
-garbage ;
-drop table if exists t1 ;
-echo $mysql_errname;
-eval select $mysql_errno as "after_disable_warnings" ;
---enable_warnings
-
-# ----------------------------------------------------------------------------
-# check if masked errors affect $mysql_errno
-# ----------------------------------------------------------------------------
---error ER_PARSE_ERROR
-
-garbage ;
---error ER_NO_SUCH_TABLE
-
-select 3 from t1 ;
-echo $mysql_errname;
-eval select $mysql_errno as "after_minus_masked" ;
---error ER_PARSE_ERROR
-
-garbage ;
---error ER_NO_SUCH_TABLE
-
-select 3 from t1 ;
-echo $mysql_errname;
-eval select $mysql_errno as "after_!_masked" ;
-
-# ----------------------------------------------------------------------------
-# Will manipulations of $mysql_errno be possible and visible ?
-# ----------------------------------------------------------------------------
---error ER_PARSE_ERROR
-
-garbage ;
-let $mysql_errno= -1;
-eval select $mysql_errno as "after_let_errno_equal_value" ;
-
-# ----------------------------------------------------------------------------
-# How affect actions on prepared statements $mysql_errno ?
-# ----------------------------------------------------------------------------
-# failing prepare
---error ER_PARSE_ERROR
-
-garbage ;
---error ER_NO_SUCH_TABLE
-
-prepare stmt from "select 3 from t1" ;
-echo $mysql_errname;
-eval select $mysql_errno as "after_failing_prepare" ;
-create table t1 ( f1 char(10));
-
-# successful prepare
---error ER_PARSE_ERROR
-
-garbage ;
-prepare stmt from "select 3 from t1" ;
-echo $mysql_errname;
-eval select $mysql_errno as "after_successful_prepare" ;
-
-# successful execute
---error ER_PARSE_ERROR
-
-garbage ;
-execute stmt;
-echo $mysql_errname;
-eval select $mysql_errno as "after_successful_execute" ;
-
-# failing execute (table has been dropped)
-drop table t1;
---error ER_PARSE_ERROR
-
-garbage ;
---error ER_NO_SUCH_TABLE
-
-execute stmt;
-echo $mysql_errname;
-eval select $mysql_errno as "after_failing_execute" ;
-
-# failing execute (unknown statement)
---error ER_PARSE_ERROR
-
-garbage ;
---error ER_UNKNOWN_STMT_HANDLER
-
-execute __stmt_;
-echo $mysql_errname;
-eval select $mysql_errno as "after_failing_execute" ;
-
-# successful deallocate
---error ER_PARSE_ERROR
-
-garbage ;
-deallocate prepare stmt;
-echo $mysql_errname;
-eval select $mysql_errno as "after_successful_deallocate" ;
-
-# failing deallocate ( statement handle does not exist )
---error ER_PARSE_ERROR
-
-garbage ;
---error ER_UNKNOWN_STMT_HANDLER
-
-deallocate prepare __stmt_;
-echo $mysql_errname;
-eval select $mysql_errno as "after_failing_deallocate" ;
-
-
-# ----------------------------------------------------------------------------
-# test cases for "--disable_abort_on_error"
-#
-# "--disable_abort_on_error" switches off the abort of mysqltest
-# after "unmasked" failing statements.
-#
-# The default is "--enable_abort_on_error".
-#
-# "Maskings" are
-# --error <error number> and --error <error number>
-# in the line before the failing statement.
-#
-# There are some additional test cases for $mysql_errno
-# because "--disable_abort_on_error" enables a new situation.
-# Example: "unmasked" statement fails + analysis of $mysql_errno
-# ----------------------------------------------------------------------------
-
-# ----------------------------------------------------------------------------
-# Switch off the abort on error and check the effect on $mysql_errno
-# ----------------------------------------------------------------------------
---error ER_PARSE_ERROR
-
-garbage ;
---disable_abort_on_error
-echo $mysql_errname;
-eval select $mysql_errno as "after_--disable_abort_on_error" ;
-
-# ----------------------------------------------------------------------------
-# "unmasked" failing statement should not cause an abort
-# ----------------------------------------------------------------------------
-select 3 from t1 ;
-
-# ----------------------------------------------------------------------------
-# masked failing statements
-# ----------------------------------------------------------------------------
-# expected error = response
---error ER_NO_SUCH_TABLE
-
-select 3 from t1 ;
---error ER_NO_SUCH_TABLE
-
-select 3 from t1 ;
-echo $mysql_errname;
-eval select $mysql_errno as "after_!errno_masked_error" ;
-# expected error <> response
-# --error 1000
-# select 3 from t1 ;
-# --error 1000
-# select 3 from t1 ;
---error 1
---exec echo "disable_abort_on_error; error 1000; select 3 from t1; error 1000; select 3 from t1;" | $MYSQL_TEST 2>&1
-
-# ----------------------------------------------------------------------------
-# Check some non-query statements that would fail
-# ----------------------------------------------------------------------------
---exec illegal_command
---cat_file does_not_exist
---perl
- exit(2);
-EOF
-
-# ----------------------------------------------------------------------------
-# Check backtick and query_get_value, result should be empty
-# ----------------------------------------------------------------------------
-let $empty= `garbage`;
-echo $empty is empty;
-let $empty= query_get_value(nonsense, blabla, 1);
-echo $empty is empty;
-
-# ----------------------------------------------------------------------------
-# Switch the abort on error on and check the effect on $mysql_errno
-# ----------------------------------------------------------------------------
---error ER_PARSE_ERROR
-
-garbage ;
---enable_abort_on_error
-echo $mysql_errname;
-eval select $mysql_errno as "after_--enable_abort_on_error" ;
-
-# ----------------------------------------------------------------------------
-# masked failing statements
-# ----------------------------------------------------------------------------
-# expected error = response
---error ER_NO_SUCH_TABLE
-
-select 3 from t1 ;
-
-# ----------------------------------------------------------------------------
-# check that the old default behaviour is not changed
-# Please remove the '#' to get the abort on error
-# ----------------------------------------------------------------------------
-#--error 1064
-#select 3 from t1 ;
-#
-#select 3 from t1 ;
-
---error 1
---exec echo "disable_abort_on_error; enable_abort_on_error; error 1064; select 3 from t1; select 3 from t1;" | $MYSQL_TEST 2>&1
-
-# ----------------------------------------------------------------------------
-# Test --enable and --disable with ONCE
-# ----------------------------------------------------------------------------
-
---disable_abort_on_error ONCE
-garbage;
---disable_abort_on_error ONCE
---remove_file $MYSQLTEST_VARDIR/DoesNotExist
-
---disable_result_log
-select 2;
---enable_result_log ONCE
-select 3;
-select 5;
---enable_result_log
-
-# ----------------------------------------------------------------------------
-# Test cumulative ONCE
-# ----------------------------------------------------------------------------
-
---disable_abort_on_error ONCE
---disable_query_log ONCE
-select 3 from t1;
-select 7;
-
---error 1
---exec echo "--disable_info OCNE" | $MYSQL_TEST 2>&1
-
-connect (con1,localhost,root,,);
-connection default;
-disconnect con1;
-
-# ----------------------------------------------------------------------------
-# Test ONCE can be combined with --error or modifiers like lowercase
-# ----------------------------------------------------------------------------
-
---disable_result_log ONCE
---error ER_NO_SUCH_TABLE
-select 5 from t1;
-
---disable_query_log ONCE
---lowercase_result
-select "CASE" as "LOWER";
-
---sorted_result
---disable_query_log ONCE
-select "xyz" as name union select "abc" as name order by name desc;
-
-# ----------------------------------------------------------------------------
-# Test --error with backtick operator or query_get_value
-# ----------------------------------------------------------------------------
-
---error 0,ER_NO_SUCH_TABLE
-let $empty= `SELECT foo from bar`;
-echo $empty is empty;
-
---error 0,ER_BAD_FIELD_ERROR
-let $empty= query_get_value(SELECT bar as foo, baz, 1);
-echo $empty is empty;
-
---error 0,ER_NO_SUCH_TABLE
-if (!`SELECT foo from bar`) {
- echo "Yes it's empty";
-}
-
-# ----------------------------------------------------------------------------
-# Test comments
-# ----------------------------------------------------------------------------
-
-# This is a comment
-# This is a ; comment
-# This is a -- comment
-# -- This is also a comment
-# -- # This is also a comment
-# -- This is also a ; comment
-
-# ----------------------------------------------------------------------------
-# Test comments with embedded command
-# ----------------------------------------------------------------------------
-
---echo hello
--- echo hello
--- echo ;;;;;;;;
-
---echo # MySQL: -- The
-
-# ----------------------------------------------------------------------------
-# Test detect end of line "junk"
-# Most likely caused by a missing delimiter
-# ----------------------------------------------------------------------------
-
-# Too many parameters to function
---error 1
---exec echo "sleep 5 6;" | $MYSQL_TEST 2>&1
-
-# Too many parameters to function
---error 1
---exec echo "--sleep 5 6" | $MYSQL_TEST 2>&1
-
-#
-# Missing delimiter
-# The comment will be "sucked into" the sleep command since
-# delimiter is missing until after "show status"
---write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
-sleep 4
-# A comment
-show status;
-EOF
---error 1
---exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
-remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
-
-#
-# Missing delimiter until eof
-# The comment will be "sucked into" the sleep command since
-# delimiter is missing
---write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
-sleep 7
-# Another comment
-EOF
---error 1
---exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
-remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
-
-#
-# Missing delimiter until "disable_query_log"
-#
---write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
-disconnect default
-
-#
-# comment
-# comment 3
-disable_query_log;
-EOF
---error 1
---exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
-remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
-
-#
-# Missing delimiter until "disable_query_log"
-#
---write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
-disconnect default
-
-#
-# comment
-
-# comment 3
-disable_query_log;
-EOF
---error 1
---exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
-remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
-
-#
-# Missing delimiter until eof
-#
---write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
-disconnect default
-
-#
-# comment
-# comment2
-
-# comment 3
---disable_query_log
-EOF
---error 1
---exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
-remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
-
-#
-# Missing delimiter until eof
-#
---write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
-disconnect default # comment
-# comment part2
-
-# comment 3
---disable_query_log
-EOF
---error 1
---exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
-
-remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
-
-#
-# Extra delimiter
-#
---error 1
---exec echo "--sleep 4;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "--disable_query_log;" | $MYSQL_TEST 2>&1
-
-#
-# Extra text after ``
-#
-# Cannot use exec echo here as ` may or may not need to be escaped
---write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
-let $x= `select 1` BOO ;
-EOF
---error 1
---exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
-remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
---write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
---let $x= `select 1`;
-EOF
---error 1
---exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
-remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
---write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
-# Missing ; in next line should be detected and cause failure
-let $x= `select 1`
-let $x= 2;
-echo $x;
-EOF
---error 1
---exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
-remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
-
-
-# Allow trailing # comment
---sleep 1 # Wait for insert delayed to be executed.
---sleep 1 # Wait for insert delayed to be executed.
-
-# ----------------------------------------------------------------------------
-# Test error
-# ----------------------------------------------------------------------------
-
-# Missing argument
---error 1
---exec echo "error;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "--error" | $MYSQL_TEST 2>&1
-
-# First char must be uppercase 'S' or 'E' or [0-9]
---error 1
---exec echo "--error s99999" | $MYSQL_TEST 2>&1
---error 1
---exec echo "--error e99999" | $MYSQL_TEST 2>&1
---error 1
---exec echo "--error 9eeeee" | $MYSQL_TEST 2>&1
---error 1
---exec echo "--error 1sssss" | $MYSQL_TEST 2>&1
-
-# First char 'S' but too long
---error 1
---exec echo "--error S999999" | $MYSQL_TEST 2>&1
-
-# First char 'S' but lowercase char found
---error 1
---exec echo "--error S99a99" | $MYSQL_TEST 2>&1
-
-# First char 'S' but too short
---error 1
---exec echo "--error S9999" | $MYSQL_TEST 2>&1
-
-# First char 'E' but not found in error array
---error 1
---exec echo "--error E9999" | $MYSQL_TEST 2>&1
-
-# First char [0-9] but contains chars
---error 1
---exec echo "--error 999e9" | $MYSQL_TEST 2>&1
---error 1
---exec echo "--error 9b" | $MYSQL_TEST 2>&1
-
-# Multiple errorcodes separated by ','
---error 1,1,1,1
-#--error 9,ER_PARSE_ERROR
-#--error ER_PARSE_ERROR
-#--error 9,ER_PARSE_ERROR,9,ER_PARSE_ERROR
-#--error 9, ER_PARSE_ERROR, 9, ER_PARSE_ERROR
-#--error 9,S00000,9,ER_PARSE_ERROR
-#--error 9,S00000,9,ER_PARSE_ERROR,ER_PARSE_ERROR,ER_PARSE_ERROR,9,10,11,12
---error 9,S00000,9
---error 9,S00000,9,9,10,11,12
---error 9 ,10
---error 9 , 10
---error 9 , 10
---error 9 , 10
-
-# Too many errorcodes specified
---error 1
---exec echo "--error 1,2,3,4,5,6,7,8,9,10,11" | $MYSQL_TEST 2>&1
-
-
-# ----------------------------------------------------------------------------
-# Test echo command
-# ----------------------------------------------------------------------------
-
-echo MySQL;
-echo "MySQL";
-echo MySQL: The world''s most popular open source database;
-echo "MySQL: The world's most popular open source database";
-
-echo MySQL: The world''s
- most popular open
- source database;
-
-echo # MySQL: The world''s
-# most popular open
-# source database;
-
-echo - MySQL: The world''s
-- most popular open
-- source database;
-
-echo - MySQL: The world''s
--- most popular
--- open source database;
-
-echo # MySQL: The
---world''s
-# most popular
--- open
-- source database;
-
-echo "MySQL: The world's most popular; open source database";
-echo "MySQL: The world's most popular ; open source database";
-echo "MySQL: The world's most popular ;open source database";
-echo echo message echo message;
-
-
-echo ;
-
-# Illegal use of echo
-
-#--error 1
-#--exec echo "echo \$;" | $MYSQL_TEST 2>&1
-
-
-# ----------------------------------------------------------------------------
-# Test exec command
-# ----------------------------------------------------------------------------
-
-# Illegal use of exec
---error 1
---exec echo "--exec " | $MYSQL_TEST 2>&1
-
-# ----------------------------------------------------------------------------
-# Test let command
-# ----------------------------------------------------------------------------
-
-let $message=MySQL;
-echo $message;
-
-let $message="MySQL";
-echo $message;
-
-let $message= MySQL: The
- world''s most
- popular open
- source database;
-echo $message;
-
-let $message= # MySQL: The
-# world''s most
-# popular open
-# source database;
-echo $message;
-
-let $message= -- MySQL: The
--- world''s most
--- popular
--- open source database;
-echo $message;
-
-let $message= # MySQL: The
-- world''s most
--- popular open
-# source database;
-echo $message;
-
-echo '$message';
-echo "$message";
-
-let $1=hej;
-echo $1;
-
-let $1 =hej ;
-echo $1;
-
-let $1 = hej;
-echo $1;
-
-let $1=1;
-let $2=$1;
-echo $2;
-let $5=$6;
-echo $5;
-echo $6;
-
-let $where=a long variable content;
-echo $where;
-
-let $where2= $where;
-echo $where2;
-
-let $where3=a long $where variable content;
-echo $where3;
-
-let $where3=a long \\\$where variable content;
-echo $where3;
-
-let $novar1= $novar2;
-echo $novar1;
-
-let $cat=na;
-let $cat=ba$cat$cat;
-echo banana = $cat;
-
-# ba\$cat\$cat should have been sufficient.
-# ba\\\$cat\\\$cat -> ba\$cat\$cat -> ba$cat$cat -> banana
-# Magnus' upcoming patch will fix the missing second interpretation.
-let $cat=ba\\\$cat\\\$cat;
-echo Not a banana: $cat;
-
-# Bug #55413 would cause this to fail
-let $escape= with\`some\"escaped\'quotes;
-echo $escape;
-
---let $escape= with\`some\"escaped\'quotes
-echo $escape;
-
-# This only works with "--let" syntax
---let $tick= single'tick`backtick
-echo $tick;
-
-# Test illegal uses of let
-
---error 1
---exec echo "let ;" | $MYSQL_TEST 2>&1
-
---error 1
---exec echo "let \$=hi;" | $MYSQL_TEST 2>&1
-
---error 1
---exec echo "let \$1 hi;" | $MYSQL_TEST 2>&1
-
---error 1
---exec echo "let \$m hi;" | $MYSQL_TEST 2>&1
-
---error 1
---exec echo "let \$hi;" | $MYSQL_TEST 2>&1
-
---error 1
---exec echo "let \$ hi;" | $MYSQL_TEST 2>&1
-
---error 1
---exec echo "let =hi;" | $MYSQL_TEST 2>&1
-
---error 1
---exec echo "let hi;" | $MYSQL_TEST 2>&1
-
-# More advanced test for Bug#17280
-let $success= 1;
---echo # Execute: --echo # <whatever> success: \$success
---echo # <whatever> success: $success
---echo # Execute: echo # <whatever> success: \$success ;
-echo # <whatever> success: $success ;
-
---echo # The next two variants work fine and expand the content of \$success
---echo # Execute: --echo \$success
---echo $success
---echo # Execute: echo \$success ;
-echo $success ;
-
-
-# ----------------------------------------------------------------------------
-# Test to assign let from variable
-# let $<var_name>=$<var_name>;
-# ----------------------------------------------------------------------------
-
---echo # Check if let \$B = \$A is an assignment per value.
-
-# Basic preparations:
---echo let \$A = initial value of A;
-let $A = initial value of A;
-# --echo # Content of \$A is: $A
---echo let \$B = initial value of B;
-let $B = initial value of B;
-# --echo # Content of \$B is: $B
-
-# Assign $B to $A:
---echo let \$B = \$A
-let $A = $B;
---echo # Content of \$A is: $A
-
-# Changes of $B must NOT affect $A and Changes of $A must NOT affect $B !
---echo let \$A = changed value of A;
-let $A = changed value of A;
---echo # Content of \$B is: $B
-
---echo let \$B = changed value of B;
-let $B = changed value of B;
---echo # Content of \$A is: $A
-
-# ----------------------------------------------------------------------------
-# Test let from query with $variable
-# let $<var_name>=`<query with $variable>`;
-# ----------------------------------------------------------------------------
-
-let $var1=content of variable 1;
-let $var2= `select "$var1"`;
-let $var3= `select concat("$var1", " ", "$var2")`;
-echo var2: $var2;
-echo var3: $var3;
-if (`select length("$var3") > 0`)
-{
- echo length of var3 is longer than 0;
-}
-
-# ----------------------------------------------------------------------------
-# Test to assign let from query
-# let $<var_name>=`<query>`;
-# ----------------------------------------------------------------------------
-echo var1;
-let $var1= `select "hi" as "Col", 1 as "Column1", "hi there" as Col3`;
-echo $var1;
-
-echo var2;
-let $var2= `select 2 as "Column num 2"`;
-echo $var2;
-
-echo var2 again;
-let $var2= `select 2 as "Column num 2"`;
-echo $var2;
-
-echo var3 two columns with same name;
-let $var3= `select 1 as "Col", 2 as "Col", 3 as "var3"`;
-echo $var3;
-
-echo var4 from query that returns NULL;
-let $var4= `select NULL`;
-
-echo var5 from query that returns no row;
-let $var5= `SHOW VARIABLES LIKE "nonexisting_variable"`;
-
-echo failing query in let;
---write_file $MYSQLTEST_VARDIR/tmp/let.sql
-let $var2= `failing query`;
-echo $var2;
-EOF
-
-create table t1 (a varchar(100));
-insert into t1 values ('`select 42`');
-let $a= `select * from t1`;
-# This should output `select 42`, not evaluate it again to 42
-echo $a;
-insert into t1 values ('$dollar');
-# These should also output the string without evaluating it.
-let $a= query_get_value(select * from t1 order by a, a, 1);
-echo $a;
-let $a= query_get_value(select * from t1 order by a, a, 2);
-echo $a;
-drop table t1;
-
---error 1
---exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/let.sql 2>&1
-
-remove_file $MYSQLTEST_VARDIR/tmp/let.sql;
-
-
-# ----------------------------------------------------------------------------
-# Test source command
-# ----------------------------------------------------------------------------
-
-# Test illegal uses of source
-
---error 1
---exec echo "source ;" | $MYSQL_TEST 2>&1
-
-# Fix win paths
---replace_result \\ /
-# Source a nonexisting file
---error 1
---exec echo "source non_existingFile;" | $MYSQL_TEST 2>&1
-
-# Too many source
---exec echo "source $MYSQLTEST_VARDIR/tmp/recursive.sql;" > $MYSQLTEST_VARDIR/tmp/recursive.sql
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---error 1
---exec echo "source $MYSQLTEST_VARDIR/tmp/recursive.sql;" | $MYSQL_TEST 2>&1
-remove_file $MYSQLTEST_VARDIR/tmp/recursive.sql;
-
-# Source a file with error
---exec echo "garbage ;" > $MYSQLTEST_VARDIR/tmp/error.sql
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---error 1
---exec echo "source $MYSQLTEST_VARDIR/tmp/error.sql;" | $MYSQL_TEST 2>&1
-
-remove_file $MYSQLTEST_VARDIR/tmp/error.sql;
-
-# Test execution of source in a while loop
---write_file $MYSQLTEST_VARDIR/tmp/sourced.inc
-echo here is the sourced script;
-EOF
---disable_query_log
-let $outer= 2; # Number of outer loops
-while ($outer)
-{
- eval SELECT '$outer = outer loop variable after while' AS "";
-
- --source $MYSQLTEST_VARDIR/tmp/sourced.inc
-
- eval SELECT '$outer = outer loop variable before dec' AS "";
- dec $outer;
- eval SELECT '$outer = outer loop variable after dec' AS "";
-}
-
-# Test source in an if in a while which is false on 1st iteration
-# Also test --error and --disable_abort_on_error in same context
-let $outer= 2; # Number of outer loops
-let $ifval= 0; # false 1st time
-while ($outer)
-{
- echo outer=$outer ifval=$ifval;
-
- if ($ifval) {
- --source $MYSQLTEST_VARDIR/tmp/sourced.inc
- --error ER_NO_SUCH_TABLE
- SELECT * from nowhere;
- --disable_abort_on_error ONCE
-# Statement giving a different error, to make sure we don't mask it
- SELECT * FROM nowhere else;
- }
- dec $outer;
- inc $ifval;
-}
-
-
-# Test execution of source in a while loop
---disable_abort_on_error
-# Sourcing of a file within while loop, sourced file will
-# source other file
-let $num= 9;
-while ($num)
-{
- SELECT 'In loop' AS "";
- --source $MYSQLTEST_VARDIR/tmp/sourced.inc
- dec $num;
-}
---enable_abort_on_error
---enable_query_log
-
-# Test source $variable/<filename>
---source $MYSQLTEST_VARDIR/tmp/sourced.inc
-
---remove_file $MYSQLTEST_VARDIR/tmp/sourced.inc
-
---write_file $MYSQLTEST_VARDIR/tmp/sourced.inc
-echo "hello";
-EOF
-
-let $x= sourced;
-source $MYSQLTEST_VARDIR/tmp/$x.inc;
-
-let $x= $MYSQLTEST_VARDIR;
-source $x/tmp/sourced.inc;
-
---remove_file $MYSQLTEST_VARDIR/tmp/sourced.inc
-
-
-# ----------------------------------------------------------------------------
-# Test sleep command
-# ----------------------------------------------------------------------------
-
-sleep 0.5;
-sleep 1;
-real_sleep 1;
-
-# Parameter from variable, legal and illegal
-let $sleep_var= 0.1;
-sleep $sleep_var;
-let $sleep_var= 1;
---real_sleep $sleep_var
-
---write_file $MYSQL_TMP_DIR/sleep.inc
-let $sleep_var= xyz;
---sleep $sleep_var
-EOF
---error 1
---exec $MYSQL_TEST < $MYSQL_TMP_DIR/sleep.inc 2>&1
---remove_file $MYSQL_TMP_DIR/sleep.inc
-
---write_file $MYSQL_TMP_DIR/sleep.inc
-let $sleep_var= xyz;
-real_sleep $sleep_var;
-EOF
---error 1
---exec $MYSQL_TEST < $MYSQL_TMP_DIR/sleep.inc 2>&1
---remove_file $MYSQL_TMP_DIR/sleep.inc
-
-# Missing parameter
---error 1
---exec echo "sleep ;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "real_sleep ;" | $MYSQL_TEST 2>&1
-
-# Illegal parameter
---error 1
---exec echo "sleep abc;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "real_sleep abc;" | $MYSQL_TEST 2>&1
-
-# ----------------------------------------------------------------------------
-# Test inc
-# ----------------------------------------------------------------------------
-let $i= 0;
-inc $i;
-echo $i;
-let $i=100;
-inc $i;
-echo $i;
-let $i= -100;
-inc $i;
-echo $i;
-
---error 1
---exec echo "inc;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "inc i;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "inc \$i;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "let \$i=100; inc \$i 1000; echo \$i;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "let \$i=text; inc \$i; echo \$i;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "let \$i=10cc; inc \$i; echo \$i;" | $MYSQL_TEST 2>&1
-
-inc $i; inc $i; inc $i; --echo $i
-echo $i;
-
-
-# ----------------------------------------------------------------------------
-# Test dec
-# ----------------------------------------------------------------------------
-
-let $d= 0;
-dec $d;
-echo $d;
-let $d=100;
-dec $d;
-echo $d;
-
---error 1
---exec echo "dec;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "dec i;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "dec \$i;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "let \$i=100; dec \$i 1000; echo \$i;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "let \$i=text; dec \$i; echo \$i;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "let \$i=10cc; dec \$i; echo \$i;" | $MYSQL_TEST 2>&1
-
-
-# ----------------------------------------------------------------------------
-# Test system
-# ----------------------------------------------------------------------------
-#system ls > /dev/null;
-system echo "hej" > /dev/null;
-#--system ls > /dev/null
---system echo "hej" > /dev/null;
-
---error 1
---exec echo "system;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "system $NONEXISTSINFVAREABLI;" | $MYSQL_TEST 2>&1
-
---disable_abort_on_error ONCE
-system NonExistsinfComamdn 2> /dev/null;
-
-
-# ----------------------------------------------------------------------------
-# Test delimiter
-# ----------------------------------------------------------------------------
-
-delimiter stop;
-echo teststop
-delimiter ;stop
-echo test2;
---delimiter stop
-echo test3stop
---delimiter ;
-echo test4;
-
-# ----------------------------------------------------------------------------
-# Test that delimiter within if() works in in various combinations
-# ----------------------------------------------------------------------------
-
-if (0)
-{
- delimiter ||;
- echo false-inner||
- if (0)
- {
- delimiter *||
- echo false-innerer*
- delimiter ||*
- }
- echo false-inner again||
-}
-echo outer;
-if (1)
-{
- delimiter /;
- echo true-inner/
- if (0)
- {
- delimiter %/
- echo true-innerer%
- }
- echo true-inner again/
-}
-echo true-outer/
-delimiter ;/
-
-
-# ----------------------------------------------------------------------------
-# Test if
-# ----------------------------------------------------------------------------
-
-let $counter=10;
-if ($counter)
-{
- echo Counter is greater than 0, (counter=10);
-}
-if (!$counter)
-{
- echo Counter is not 0, (counter=10);
-}
-if (! $counter)
-{
- let $counter=5;
-}
-echo Counter should still be 10, is $counter;
-let $counter=0;
-if($counter)
-{
- echo Counter is greater than 0, (counter=0);
-}
-if (!$counter)
-{
- echo Counter is not 0, (counter=0);
-}
-if (! $counter)
-{
- echo Not space var works;
-}
-
-# ----------------------------------------------------------------------------
-# Test if with some non-numerics
-# ----------------------------------------------------------------------------
-
-let $counter=alpha;
-if ($counter)
-{
- echo Counter is true, (counter=alpha);
-}
-let $counter= ;
-if ($counter)
-{
- echo oops, space is true;
-}
-let $counter=-0;
-if ($counter)
-{
- echo oops, -0 is true;
-}
-# This is no longer allowed, as a precaution against mistyped conditionals
-# if (beta)
-# {
-# echo Beta is true;
-# }
-let $counter=gamma;
-while ($counter)
-{
- echo while with string, only once;
- let $counter=000;
-}
-
-# ----------------------------------------------------------------------------
-# Test if with compare conditions
-# ----------------------------------------------------------------------------
-
-let $ifvar= 5;
-let $ifvar2= 6;
-
-if ($ifvar < 7)
-{
- echo 5<7;
-}
-if ($ifvar< 7)
-{
- echo 5<7 again;
-}
-if ($ifvar<7)
-{
- echo 5<7 still;
-}
-if ($ifvar < $ifvar2)
-{
- echo 5<6;
-}
-if ($ifvar <= 4)
-{
- echo 5<=4;
-}
-if ($ifvar >= 5)
-{
- echo 5>=5;
-}
-if ($ifvar>=5)
-{
- echo 5>=5 again;
-}
-if ($ifvar > 3)
-{
- echo 5>3;
-}
-if ($ifvar == 4)
-{
- echo 5==4;
-}
-if ($ifvar == 5)
-{
- echo 5==5;
-}
-if ($ifvar != 8)
-{
- echo 5!=8;
-}
-# Any number should compare unequal to any string
-if ($ifvar != five)
-{
- echo 5!=five;
-}
-if ($ifvar == `SELECT 3+2`)
-{
- echo 5==3+2;
-}
-if ($ifvar == 5)
-{
- echo 5 == 5;
-}
-let $ifvar= hello;
-if ($ifvar == hello there)
-{
- echo hello == hello there;
-}
-if ($ifvar == hello)
-{
- echo hello == hello;
-}
-if ($ifvar == hell)
-{
- echo hello == hell;
-}
-if ($ifvar == hello)
-{
- echo hello == hello;
-}
-if ($ifvar != goodbye)
-{
- echo hello != goodbye;
-}
-let $ifvar= 'quoted';
-if ($ifvar == ''quoted'')
-{
- echo 'quoted' == ''quoted'';
-}
-let $ifvar= two words;
-if ($ifvar == two words)
-{
- echo two words;
-}
-if ($ifvar == 'two words')
-{
- echo 'two words';
-}
-if ($ifvar == "two words")
-{
- echo "two words";
-}
-if ($ifvar == `SELECT 'two words'`)
-{
- echo two words are two words;
-}
-if (42)
-{
- echo right answer;
-}
-if (0)
-{
- echo wrong answer;
-}
-# Non-empty string treated as 'true'
-if (`SELECT 'something'`)
-{
- echo anything goes;
-}
-# Make sure 0 and string compare right
-let $ifvar= 0;
-if ($ifvar == string)
-{
- echo 0 == string;
-}
-if ($ifvar != string)
-{
- echo 0 != string;
-}
---write_file $MYSQL_TMP_DIR/mysqltest.sql
-let $var= 5;
-if ($var >= four)
-{
- echo 5>=four;
-}
-EOF
---error 1
---exec $MYSQL_TEST < $MYSQL_TMP_DIR/mysqltest.sql 2>&1
-remove_file $MYSQL_TMP_DIR/mysqltest.sql;
-
---write_file $MYSQL_TMP_DIR/mysqltest.sql
-let $var= 5;
-if ($var ~= 6)
-{
- echo 5~=6;
-}
-EOF
---error 1
---exec $MYSQL_TEST < $MYSQL_TMP_DIR/mysqltest.sql 2>&1
-remove_file $MYSQL_TMP_DIR/mysqltest.sql;
-
---write_file $MYSQL_TMP_DIR/mysqltest.sql
-let $var= text;
-if (var == text)
-{
- echo Oops I forgot the $;
-}
-EOF
---error 1
---exec $MYSQL_TEST < $MYSQL_TMP_DIR/mysqltest.sql 2>&1
-remove_file $MYSQL_TMP_DIR/mysqltest.sql;
-
---error 1
---exec echo "if (\$var ==) {" | $MYSQL_TEST 2>&1
---error 1
---exec echo "if (\$var > ) {" | $MYSQL_TEST 2>&1
-
-# ----------------------------------------------------------------------------
-# Test while with compare conditions
-# ----------------------------------------------------------------------------
-
-let $counter= 2;
-
-while ($counter < 5)
-{
- echo counter is $counter;
- inc $counter;
-}
-let $ifvar=;
-while ($ifvar != stop)
-{
- if ($counter >= 7)
- {
- let $ifvar= stop;
- }
- echo counter is $counter;
- inc $counter;
-}
-
-# ----------------------------------------------------------------------------
-# Test while, { and }
-# ----------------------------------------------------------------------------
-
-let $i=1;
-while ($i)
-{
- echo $i;
- dec $i;
-}
-# One liner
-#let $i=1;while ($i){echo $i;dec $i;}
-
-let $i=0;
-while (!$i)
-{
- echo Testing while with not;
- inc $i;
-}
-
-# Exceed max nesting level
---write_file $MYSQLTEST_VARDIR/tmp/mysqltest_while.inc
-let $1 = 10;
-while ($1)
-{
-while ($1)
-{
-while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- while ($1)
-{
- echo $1;
- dec $1;
-}
-}
-}
-}
-}
-}
-}
-}
-}
-}
-}
-}
-}
-}
-}
-}
-}
-}
-}
-}
-}
-}
-}
-}
-}
-}
-}
-}
-}
-}
-}
-}
-}
-}
-}
-}
-EOF
-# Fix win path
---replace_result \\ / $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---error 1
---exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest_while.inc;" | $MYSQL_TEST 2>&1
---remove_file $MYSQLTEST_VARDIR/tmp/mysqltest_while.inc
---error 1
---exec echo "while \$i;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "while (\$i;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "let \$i=1; while (\$i) dec \$i;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "};" | $MYSQL_TEST 2>&1
---error 1
---exec echo "end;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "{;" | $MYSQL_TEST 2>&1
-
---write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
-while (0)
-echo hej;
-EOF
---error 1
---exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
-remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
-
---write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
-while (0)
-{echo hej;
-EOF
---error 1
---exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
-remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
-
---write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
-while (0){
- echo hej;
-EOF
---error 1
---exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
-
-remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
-
-# ----------------------------------------------------------------------------
-# Test error messages returned from comments starting with a command
-# ----------------------------------------------------------------------------
---error 1
---exec echo "--if the other server is down" | $MYSQL_TEST 2>&1
-
---error 1
---exec echo "-- end when ..." | $MYSQL_TEST 2>&1
-
-# ----------------------------------------------------------------------------
-# Test replace
-# ----------------------------------------------------------------------------
---replace_result a b
-select "a" as col1, "c" as col2;
-
---replace_result a b c d
-select "a" as col1, "c" as col2;
-
---error 1
---exec echo "--replace_result a" | $MYSQL_TEST 2>&1
---error 1
---exec echo "--replace_result a;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "replace_result a;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "replace_result a ;" | $MYSQL_TEST 2>&1
---exec echo "replace_result a b; echo OK; exit;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "--replace_result a b c" | $MYSQL_TEST 2>&1
---error 1
---exec echo "replace_result a b c ;" | $MYSQL_TEST 2>&1
-
-
---replace_column 1 b
-select "a" as col1, "c" as col2;
-
---replace_column 1 b 2 d
-select "a" as col1, "c" as col2;
-
---error 1
---exec echo "--replace_column a" | $MYSQL_TEST 2>&1
-
---error 1
---exec echo "--replace_column 1" | $MYSQL_TEST 2>&1
-
---error 1
---exec echo "--replace_column a b" | $MYSQL_TEST 2>&1
---error 1
---exec echo "--replace_column a 1" | $MYSQL_TEST 2>&1
---error 1
---exec echo "--replace_column 1 b c " | $MYSQL_TEST 2>&1
-
-let $long_rep= 1234567890123456789012345678901234567890;
-let $long_rep= $long_rep,$long_rep;
-let $long_rep= $long_rep,$long_rep;
-let $long_rep= $long_rep,$long_rep;
-let $long_rep= $long_rep,$long_rep;
-let $long_rep= $long_rep,$long_rep;
-
-# This tests from strings > 1024 (here 1311)
-
---replace_result $long_rep LONG_STRING
-eval select "$long_rep" as x;
-
-# Test replace within ``
-
---replace_result cat dog
---let $animal= `select "cat" as pet`
---echo $animal
-
-# ----------------------------------------------------------------------------
-# Test sync_with_master
-# ----------------------------------------------------------------------------
---error 1
---exec echo "sync_with_master 10!;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "sync_with_master a;" | $MYSQL_TEST 2>&1
-
-# ----------------------------------------------------------------------------
-# Test connect
-# ----------------------------------------------------------------------------
-
---error 1
---exec echo "connect;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "connect ();" | $MYSQL_TEST 2>&1
---error 1
---exec echo "connect (con2);" | $MYSQL_TEST 2>&1
---error 1
---exec echo "connect (con2,);" | $MYSQL_TEST 2>&1
---error 1
---exec echo "connect (con2,localhost,root,,illegal_db);" | $MYSQL_TEST 2>&1
---error 1
---exec echo "connect (con1,localhost,root,,,illegal_port,);" | $MYSQL_TEST 2>&1
---error 1
---exec echo "connect (con1,localhost,root,,,,,SMTP POP);" | $MYSQL_TEST 2>&1
-
-# Repeat connect/disconnect
---write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
-let $i=200;
-disable_connect_log;
-while ($i)
-{
- connect (test_con1,localhost,root,,);
- disconnect test_con1;
- dec $i;
-}
-enable_connect_log;
-echo 200 connects succeeded;
-EOF
---exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql;" | $MYSQL_TEST 2>&1
-remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
-
-# Select disconnected connection
---write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
-connect (test_con1,localhost,root,,);
-disconnect test_con1;
-connection test_con1;
-EOF
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---error 1
---exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql;" | $MYSQL_TEST 2>&1
-remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
-
-# Connection name already used
---write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
-connect (test_con1,localhost,root,,);
-connect (test_con1,localhost,root,,);
-EOF
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---error 1
---exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql;" | $MYSQL_TEST 2>&1
-
-remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
-
-# connect when "disable_abort_on_error" caused "connection not found"
---disable_abort_on_error
-connect (con1,localhost,root,,);
-connection default;
-connection con1;
-disconnect con1;
---enable_abort_on_error
-
-# Test connect without a database
-connect (con2,localhost,root,,*NO-ONE*);
---error ER_NO_DB_ERROR
-show tables;
-disconnect con2;
-connection default;
-
-# Test enable_connect_log
-connect (con1,localhost,root,,);
-connection default;
-connection con1;
---disable_query_log
-# These should not be logged
-connect (con2,localhost,root,,*NO-ONE*);
-connection con2;
-disconnect con2;
-connection con1;
---enable_query_log
-disconnect con1;
-connection default;
-
-# ----------------------------------------------------------------------------
-# Test mysqltest arguments
-# ----------------------------------------------------------------------------
-
-# -x <file_name>, use the file specified after -x as the test file
---exec $MYSQL_TEST < $MYSQL_TEST_DIR/include/mysqltest-x.inc
---exec $MYSQL_TEST -x $MYSQL_TEST_DIR/include/mysqltest-x.inc
---exec $MYSQL_TEST --test_file=$MYSQL_TEST_DIR/include/mysqltest-x.inc
-# Fix Win paths
---replace_result \\ /
---error 1
---exec $MYSQL_TEST -x non_existing_file.inc 2>&1
-
-
-# ----------------------------------------------------------------------------
-# TODO Test queries, especially their errormessages... so it's easy to debug
-# new scripts and diagnose errors
-# ----------------------------------------------------------------------------
-
-# ----------------------------------------------------------------------------
-# Test Bug#12386
-# ----------------------------------------------------------------------------
-let $num= 2;
-while ($num)
-{
- --error ER_PARSE_ERROR
-
- failing_statement;
-
- dec $num;
-}
-
-SELECT 1 as a;
-
-
-#
-# Bug#10251 Identifiers containing quotes not handled correctly
-#
-select 1 as `a'b`, 2 as `a"b`;
-
-# Test escaping of quotes
-select 'aaa\\','aa''a',"aa""a";
-
-#
-# Check of include/show_msg.inc and include/show_msg80.inc
-#
-
-# The message contains in most cases a string with the default character set
-let $message= Here comes a message;
---source include/show_msg.inc
-
-# The message could also contain a string with character set utf8
-let $message= `SELECT USER()`;
---source include/show_msg.inc
-
-# The message contains more then 80 characters on multiple lines
-# and is kept between double quotes.
-let $message=
-"Here comes a very very long message that
- - is longer then 80 characters and
- - consists of several lines";
---source include/show_msg80.inc
-
-# The message contains more then 80 characters on multiple lines
-# and uses the auxiliary character "." at the beginning of the message lines.
-let $message= . Here comes a very very long message that
- . - is longer then 80 characters and
- . - consists of several lines;
---source include/show_msg80.inc
-
-#
-# Test --enable_parsing / disable_parsing
-#
---disable_query_log
---disable_parsing
-# The following will not enable query logging
---enable_query_log
-select "this will not be executed";
---enable_parsing
-select "this will be executed";
---enable_query_log
-
-#
-# Test zero length result file. Should not pass
-#
---exec echo '' > $MYSQLTEST_VARDIR/tmp/zero_length_file.result
---exec echo "echo ok;" > $MYSQLTEST_VARDIR/tmp/query.sql
---error 1
---exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/query.sql -R $MYSQLTEST_VARDIR/tmp/zero_length_file.result > /dev/null 2>&1
-
-remove_file $MYSQLTEST_VARDIR/tmp/zero_length_file.result;
---disable_warnings
---error 0,1
-remove_file $MYSQLTEST_VARDIR/tmp/zero_length_file.reject;
---error 0,1
-remove_file $MYSQLTEST_VARDIR/tmp/zero_length_file.log;
---enable_warnings
-
-#
-# Test that a test file that does not generate any output fails.
-#
---exec echo "let \$i= 1;" > $MYSQLTEST_VARDIR/tmp/query.sql
---error 1
---exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/query.sql 2>&1
-
-remove_file $MYSQLTEST_VARDIR/tmp/query.sql;
-
-#
-# Test that mysqltest fails when there are no queries executed
-# but a result file exists
-# NOTE! This will never happen as long as it's not allowed to have
-# test files that produce no output
-#--exec echo "something" > $MYSQLTEST_VARDIR/tmp/result_file.result
-#--exec echo "let \$i= 1;" > $MYSQLTEST_VARDIR/tmp/query.sql
-#--error 1
-#--exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/query.sql -R $MYSQLTEST_VARDIR/tmp/result_file.result 2>&1
-
-#
-# Bug#11731 mysqltest in multi-statement queries ignores errors in
-# non-1st queries
-#
-
-echo Failing multi statement query;
-# PS does not support multi statement
---exec echo "--disable_ps_protocol" > $MYSQLTEST_VARDIR/tmp/bug11731.sql
---exec echo "delimiter ||||;" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
---exec echo "create table t1 (a int primary key);" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
---exec echo "insert into t1 values (1);" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
---exec echo "select 'select-me';" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
---exec echo "insertz 'error query'||||" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
---exec echo "delimiter ;||||" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
-
---error 1
---exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/bug11731.sql 2>&1
-drop table t1;
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---error 1
---exec $MYSQL_TEST --record -x $MYSQLTEST_VARDIR/tmp/bug11731.sql -R $MYSQLTEST_VARDIR/tmp/bug11731.out 2>&1
-# The .out file should be non existent
---error 1
---file_exists $MYSQLTEST_VARDIR/tmp/bug11731.out
-drop table t1;
-
-
-echo Multi statement using expected error;
-# PS does not support multi statement
---exec echo "--disable_ps_protocol" > $MYSQLTEST_VARDIR/tmp/bug11731.sql
---exec echo "delimiter ||||;" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
---exec echo "--error 1064" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
---exec echo "create table t1 (a int primary key);" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
---exec echo "insert into t1 values (1);" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
---exec echo "select 'select-me';" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
---exec echo "insertz "error query"||||" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
---exec echo "delimiter ;||||" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
---exec echo "exit;" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
-
-# These two should work since the error is expected
---exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/bug11731.sql 2>&1
-drop table t1;
-
---exec $MYSQL_TEST --record -x $MYSQLTEST_VARDIR/tmp/bug11731.sql -R $MYSQLTEST_VARDIR/tmp/bug11731.out 2>&1
-# The .out file should exist
---file_exists $MYSQLTEST_VARDIR/tmp/bug11731.out
-drop table t1;
-remove_file $MYSQLTEST_VARDIR/tmp/bug11731.out;
-remove_file $MYSQLTEST_VARDIR/log/bug11731.log;
-remove_file $MYSQLTEST_VARDIR/tmp/bug11731.sql;
-
-#
-# Bug#19890 mysqltest "query" command is broken
-#
-
-# It should be possible to use the command "query" to force mysqltest to
-# send the command to the server although it's a builtin mysqltest command.
---error ER_PARSE_ERROR
-
-query sleep;
-
---error ER_PARSE_ERROR
-
---query sleep
-
-# Just an empty query command
---error ER_EMPTY_QUERY
-
-query ;
-
-# test for replace_regex
---replace_regex /at/b/
-select "at" as col1, "c" as col2;
-
---replace_regex /at/b/i
-select "at" as col1, "AT" as col2, "c" as col3;
-
---replace_regex /a/b/ /ct/d/
-select "a" as col1, "ct" as col2;
-
---replace_regex /(strawberry)/raspberry and \1/ /blueberry/blackberry/ /potato/tomato/
-select "strawberry","blueberry","potato";
-
---error 1
---exec echo "--replace_regex a" | $MYSQL_TEST 2>&1
---error 1
---exec echo "--replace_regex a;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "replace_regex a;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "replace_regex a ;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "replace_regex a b; echo OK;" | $MYSQL_TEST 2>&1
---error 1
---exec echo "--replace_regex /a b c" | $MYSQL_TEST 2>&1
---error 1
---exec echo "replace_regex /a /b c ;" | $MYSQL_TEST 2>&1
-
-# REQUIREMENT
-# replace_regex should replace substitutions from left to right in output
-
-create table t1 (a int, b int);
-insert into t1 values (1,3);
-insert into t1 values (2,4);
---replace_regex /A/C/ /B/D/i /3/2/ /2/1/
-select * from t1;
-drop table t1;
-
-# Test usage with ``
-
---replace_regex /x/y/
---let $result= `select "x" as col`
---echo $result
-
-# Test usage with a variable as pattern list
-
---disable_query_log
---let $patt= /a /b / /less/more/
---replace_regex $patt
-select "a is a and less is more" as txt;
---replace_regex $patt /and /or /
-select "a is a and less is more" as txt2;
---let $patt=
---replace_regex $patt
-select "a is a and less is more" as txt3;
---enable_query_log
-
-#
-# different delimiters
-#
---replace_regex (a)[b] /c/d/ <e>{f}i {g\/\}}/h/
-select 'ABCDEF abcdef g/}' as txt;
-
-#-------------------------------------------------------------------------
-# BUG #11754855 : Passing variable to --error
-#-------------------------------------------------------------------------
-create table t2 ( a char(10));
-let $errno1=0;
-let $errno2=ER_PARSE_ERROR;
-let $errno3=ER_NO_SUCH_TABLE;
---error $errno2
-garbage;
-
---error $errno2,$errno3
-garbage;
-
---error $errno2,ER_NO_SUCH_TABLE
-garbage;
-
---error ER_NO_SUCH_TABLE,$errno2
-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;
-
-
-# ----------------------------------------------------------------------------
-# Tests of send
-# ----------------------------------------------------------------------------
-
-create table t1 ( f1 char(10));
-insert into t1 values ("Abcd");
-
-# 1. Basic test
-
-send select * from t1;
-reap;
-
-# 2. Test with error
-
---send select * from t2;
---error ER_NO_SUCH_TABLE
---reap
-
-# 3. test send of next stmt
-
---send
-select * from t1;
---reap
-
-# 4. Non-query stmt betwen send and reap allowed
-
---send select * from t1;
---sleep 0.05
---echo Result coming up
---reap
-
-# 5. Test of send_eval
-
---let $my_stmt= select * from t1;
---send_eval $my_stmt
---reap
-
-# 6. Test that mysqltest does not allow query stmt between send and reap
-# Untestable directly as it causes mysqltest to fail
-
---write_file $MYSQLTEST_VARDIR/tmp/mysqltest.in
---send select * from t1;
-select 1;
---reap
-EOF
---error 1
-# Must filter unpredictable extra warning from output
---exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.in > $MYSQL_TMP_DIR/mysqltest.out 2>&1
---perl
- my $dir= $ENV{'MYSQL_TMP_DIR'};
- open (FILE, "$dir/mysqltest.out");
- while (<FILE>) {
- print unless /Note: net_clear/; # This shows up on rare occations
- }
-EOF
-remove_file $MYSQL_TMP_DIR/mysqltest.out;
-remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.in;
-
-drop table t1;
-
-# ----------------------------------------------------------------------------
-# test for remove_file
-# ----------------------------------------------------------------------------
-
---disable_warnings
---error 1
---exec echo "remove_file ;" | $MYSQL_TEST 2>&1
-
---error 1
-remove_file $MYSQLTEST_VARDIR/non_existing_file;
---enable_warnings
-
-# ----------------------------------------------------------------------------
-# test for remove_files_wildcard
-# ----------------------------------------------------------------------------
-
---error 1
---exec echo "remove_files_wildcard ;" | $MYSQL_TEST 2>&1
-
---error 1
-remove_files_wildcard $MYSQLTEST_VARDIR/non_existing_dir;
-
---error 1
-remove_files_wildcard $MYSQLTEST_VARDIR/non_existing_dir non_existing_file;
-
-# ----------------------------------------------------------------------------
-# test for write_file
-# ----------------------------------------------------------------------------
---error 1
---exec echo "write_file ;" | $MYSQL_TEST 2>&1
-
---error 1
---exec echo "write_file $MYSQLTEST_VARDIR/filename ;" | $MYSQL_TEST 2>&1
-
-# Comment out this test as it confuses cmd.exe with unmatched "
-#--error 1
-#--exec echo "write_file filename \";" | $MYSQL_TEST 2>&1
-
-write_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
-Content for test_file1
-EOF
-file_exists $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
-cat_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
-remove_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
-
-write_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp END_DELIMITER;
-Content for test_file1 contains EOF
-END_DELIMITER
-file_exists $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
-
-# write to already existing file
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---error 1
---exec echo "write_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;" | $MYSQL_TEST 2>&1
-
-remove_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
-
-# ----------------------------------------------------------------------------
-# test for append_file
-# ----------------------------------------------------------------------------
-
-write_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
-Content for test_file1
-EOF
-file_exists $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
-
-append_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
-Appended text
-EOF
-file_exists $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
-
-remove_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
-append_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
-Appended text on nonexisting file
-EOF
-
-remove_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
-
-# Test append_file within while
-let $outer= 2; # Number of outer loops
-while ($outer)
-{
- append_file $MYSQLTEST_VARDIR/tmp/app_while.tmp;
-These lines should be repeated,
-if things work as expected
-EOF
- dec $outer;
-}
-
-cat_file $MYSQLTEST_VARDIR/tmp/app_while.tmp;
-remove_file $MYSQLTEST_VARDIR/tmp/app_while.tmp;
-
-# ----------------------------------------------------------------------------
-# test for cat_file
-# ----------------------------------------------------------------------------
-
---write_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp
-Some data
-for cat_file command
-of mysqltest
-EOF
-cat_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
-remove_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
-
---replace_regex /my_errno=[0-9]*/(my_errno)/
---error 1
---exec echo "cat_file non_existing_file;" | $MYSQL_TEST 2>&1
-
-# ----------------------------------------------------------------------------
-# test for diff_files
-# ----------------------------------------------------------------------------
-
---write_file $MYSQLTEST_VARDIR/tmp/diff1.tmp
-Some data
-for diff_file command
-of mysqltest
-EOF
-
---write_file $MYSQLTEST_VARDIR/tmp/diff2.tmp
-Some data
-for diff_file command
-of mysqltest
-EOF
-
---write_file $MYSQLTEST_VARDIR/tmp/diff3.tmp
-Some other data
-for diff_file command
-of mysqltest
-EOF
-
---write_file $MYSQLTEST_VARDIR/tmp/diff4.tmp
-Some data
-for diff_file command
-of musqltest
-EOF
-
-# Compare equal files
---diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff2.tmp
---diff_files $MYSQLTEST_VARDIR/tmp/diff2.tmp $MYSQLTEST_VARDIR/tmp/diff1.tmp
-
-# Compare files that differ in size
---error 2
---diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff3.tmp
---error 2
---diff_files $MYSQLTEST_VARDIR/tmp/diff3.tmp $MYSQLTEST_VARDIR/tmp/diff1.tmp
-
-# Compare files that differ only in content
---error 1
---diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff4.tmp
---error 1
---diff_files $MYSQLTEST_VARDIR/tmp/diff4.tmp $MYSQLTEST_VARDIR/tmp/diff1.tmp
-
-# Compare equal files, again...
---diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff2.tmp
-
---remove_file $MYSQLTEST_VARDIR/tmp/diff1.tmp
---remove_file $MYSQLTEST_VARDIR/tmp/diff2.tmp
---remove_file $MYSQLTEST_VARDIR/tmp/diff3.tmp
---remove_file $MYSQLTEST_VARDIR/tmp/diff4.tmp
-
-
-# ----------------------------------------------------------------------------
-# test for file_exist
-# ----------------------------------------------------------------------------
---error 1
---exec echo "file_exists ;" | $MYSQL_TEST 2>&1
-
---disable_warnings
---error 0,1
-remove_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
---enable_warnings
---error 1
-file_exists $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
-write_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
-Content for test_file1
-EOF
-file_exists $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
-remove_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
---error 1
-file_exists $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
-
-
-# ----------------------------------------------------------------------------
-# test for copy_file
-# ----------------------------------------------------------------------------
---write_file $MYSQLTEST_VARDIR/tmp/file1.tmp
-file1
-EOF
-
-copy_file $MYSQLTEST_VARDIR/tmp/file1.tmp $MYSQLTEST_VARDIR/tmp/file2.tmp;
-file_exists $MYSQLTEST_VARDIR/tmp/file2.tmp;
-remove_file $MYSQLTEST_VARDIR/tmp/file1.tmp;
-remove_file $MYSQLTEST_VARDIR/tmp/file2.tmp;
-
---error 1
---exec echo "copy_file ;" | $MYSQL_TEST 2>&1
-
---error 1
---exec echo "copy_file from_file;" | $MYSQL_TEST 2>&1
-
-
-# ----------------------------------------------------------------------------
-# test for move_file
-# ----------------------------------------------------------------------------
-
-# - Check that if source file does not exist, nothing will be created.
-
---disable_warnings
---error 1
-file_exists $MYSQLTEST_VARDIR/tmp/file1.tmp;
---error 1
-file_exists $MYSQLTEST_VARDIR/tmp/file2.tmp;
---error 1
-move_file $MYSQLTEST_VARDIR/tmp/file1.tmp $MYSQLTEST_VARDIR/tmp/file2.tmp;
---error 1
-file_exists $MYSQLTEST_VARDIR/tmp/file1.tmp;
---error 1
-file_exists $MYSQLTEST_VARDIR/tmp/file2.tmp;
---enable_warnings
-
-# - Check that if source file exists, everything works properly.
-
---write_file $MYSQLTEST_VARDIR/tmp/file1.tmp
-file1
-EOF
-
-move_file $MYSQLTEST_VARDIR/tmp/file1.tmp $MYSQLTEST_VARDIR/tmp/file2.tmp;
---error 1
-file_exists $MYSQLTEST_VARDIR/tmp/file1.tmp;
-file_exists $MYSQLTEST_VARDIR/tmp/file2.tmp;
-
-# - Check that if destination file exists, everything works properly.
-# (file2.tmp exists from the previous check; file1.tmp needs to be created)
-
---write_file $MYSQLTEST_VARDIR/tmp/file1.tmp
-file1
-EOF
-
-move_file $MYSQLTEST_VARDIR/tmp/file1.tmp $MYSQLTEST_VARDIR/tmp/file2.tmp;
---error 1
-file_exists $MYSQLTEST_VARDIR/tmp/file1.tmp;
-file_exists $MYSQLTEST_VARDIR/tmp/file2.tmp;
-remove_file $MYSQLTEST_VARDIR/tmp/file2.tmp;
-
-# - Check usage.
-
---error 1
---exec echo "move_file ;" | $MYSQL_TEST 2>&1
-
---error 1
---exec echo "move_file from_file;" | $MYSQL_TEST 2>&1
-
-# ----------------------------------------------------------------------------
-# test for chmod
-# ----------------------------------------------------------------------------
---write_file $MYSQLTEST_VARDIR/tmp/file1.tmp
-file1
-EOF
-
-chmod 0000 $MYSQLTEST_VARDIR/tmp/file1.tmp;
-# The below write fails, but --error is not implemented
-# for write_file
-#--write_file $MYSQLTEST_VARDIR/tmp/file1.tmp
-#test should fail
-#EOF
-
-chmod 0777 $MYSQLTEST_VARDIR/tmp/file1.tmp;
-remove_file $MYSQLTEST_VARDIR/tmp/file1.tmp;
---write_file $MYSQLTEST_VARDIR/tmp/file1.tmp
-test2
-EOF
-
-remove_file $MYSQLTEST_VARDIR/tmp/file1.tmp;
-
---error 1
---exec echo "chmod ;" | $MYSQL_TEST 2>&1
-
---error 1
---exec echo "chmod 0 $MYSQLTEST_VARDIR/from_file;" | $MYSQL_TEST 2>&1
-
---error 1
---exec echo "chmod 08 $MYSQLTEST_VARDIR/from_file;" | $MYSQL_TEST 2>&1
-
---error 1
---exec echo "chmod $MYSQLTEST_VARDIR/from_file;" | $MYSQL_TEST 2>&1
-
---error 1
---exec echo "chmod ABZD $MYSQLTEST_VARDIR/from_file;" | $MYSQL_TEST 2>&1
-
---error 1
---exec echo "chmod 06789 $MYSQLTEST_VARDIR/from_file;" | $MYSQL_TEST 2>&1
-
-
-# ----------------------------------------------------------------------------
-# test for perl
-# ----------------------------------------------------------------------------
---perl
-print "hello\n";
-EOF
-
---perl EOF
-print "hello\n";
-EOF
-
---perl DELIMITER
-print "hello\n";
-DELIMITER
-
---error 1
---exec echo "perl TOO_LONG_DELIMITER ;" | $MYSQL_TEST 2>&1
-
-perl;
-print "hello\n";
-EOF
-
-perl;
- # Print "hello"
- print "hello\n";
-EOF
-
-# Test perl within while, also with if being false first iteration
-let $outer= 3;
-let $ifval= 0;
-while ($outer) {
- if ($ifval) {
- perl UNTIL;
- my $val= 5;
- print "val is $val\n";
-UNTIL
- }
- inc $ifval;
- dec $outer;
-}
-
-# ----------------------------------------------------------------------------
-# test for die
-# ----------------------------------------------------------------------------
-
---error 1
---exec echo "die test of die;" | $MYSQL_TEST 2>&1
-
-
-# ----------------------------------------------------------------------------
-# test for exit
-# ----------------------------------------------------------------------------
-
---exec echo "echo Some output; exit; echo Not this;" | $MYSQL_TEST 2>&1
-
-# ----------------------------------------------------------------------------
-# test for sorted_result
-# ----------------------------------------------------------------------------
-
-create table t1( a int, b char(255), c timestamp);
-insert into t1 values(1, 'Line 1', '2007-04-05'), (2, "Part 2", '2007-04-05');
-insert into t1 values(1, 'Line 1', '2007-04-05'), (2, "Part 3", '2007-04-05');
-select * from t1;
---sorted_result
-select * from t1;
-# Should not be sorted
-select * from t1;
-disable_result_log;
-sorted_result;
-select * from t1;
-enable_result_log;
---sorted_result
-select '';
-sorted_result;
-select "h";
---sorted_result
-select "he";
---sorted_result
-select "hep";
---sorted_result
-select "hepp";
-
-drop table t1;
-
-# 1. Assignment of result set sorting
-sorted_result;
- SELECT 2 as "my_col"
-UNION
-SELECT 1;
-#
---sorted_result
-SELECT 2 as "my_col" UNION SELECT 1;
---sorted_result
-SELECT 2 as "my_col"
-UNION
-SELECT 1;
-
-# 2. Ensure that the table header will be not sorted into the result
---sorted_result
-SELECT '2' as "3"
-UNION
-SELECT '1';
-
-# 3. Ensure that an empty result set does not cause problems
-CREATE TABLE t1( a CHAR);
---sorted_result
-SELECT * FROM t1;
-DROP TABLE t1;
-
-# 4. Ensure that NULL values within the result set do not cause problems
-SELECT NULL as "my_col1",2 AS "my_col2"
-UNION
-SELECT NULL,1;
---sorted_result
-SELECT NULL as "my_col1",2 AS "my_col2"
-UNION
-SELECT NULL,1;
-#
-SELECT 2 as "my_col1",NULL AS "my_col2"
-UNION
-SELECT 1,NULL;
---sorted_result
-SELECT 2 as "my_col1",NULL AS "my_col2"
-UNION
-SELECT 1,NULL;
-
-# 5. "sorted_result" changes nothing when applied to a non query statement.
-sorted_result;
- SET @a = 17;
-#
-# 6. Show that "sorted_result;" before the "SET @a = 17;" above does not affect
-# the now following query.
-SELECT 2 as "my_col"
-UNION
-SELECT 1;
-
-# 7. Ensure that "sorted_result" in combination with $variables works
-let $my_stmt=SELECT 2 as "my_col"
-UNION
-SELECT 1;
---sorted_result
-eval $my_stmt;
-
-# 8. Ensure that "sorted_result " does not change the semantics of
-# "--error ...." or the protocol output after such an expected failure
---sorted_result
---error ER_NO_SUCH_TABLE
-
-SELECT '2' as "my_col1",2 as "my_col2"
-UNION
-SELECT '1',1 from t2;
-
-# 9. Ensure that several result formatting options including "sorted_result"
-# - have all an effect
-# - "--sorted_result" does not need to be direct before the statement
-# - Row sorting is applied after modification of the column content
---sorted_result
---replace_column 1 #
-SELECT '1' as "my_col1",2 as "my_col2"
-UNION
-SELECT '2',1;
-
-# 10. Ensure that at least 1024 rows within a result set do not cause problems
-#
-CREATE TABLE t1 (f1 INT);
-INSERT INTO t1 SET f1 = 1024;
-INSERT INTO t1 SELECT f1 - 1 FROM t1;
-INSERT INTO t1 SELECT f1 - 2 FROM t1;
-INSERT INTO t1 SELECT f1 - 4 FROM t1;
-INSERT INTO t1 SELECT f1 - 8 FROM t1;
-INSERT INTO t1 SELECT f1 - 16 FROM t1;
-INSERT INTO t1 SELECT f1 - 32 FROM t1;
-INSERT INTO t1 SELECT f1 - 64 FROM t1;
-INSERT INTO t1 SELECT f1 - 128 FROM t1;
-INSERT INTO t1 SELECT f1 - 256 FROM t1;
-INSERT INTO t1 SELECT f1 - 512 FROM t1;
---disable_result_log ONCE
---sorted_result
-SELECT * FROM t1;
-DROP TABLE t1;
-
-# ----------------------------------------------------------------------------
-# test for lowercase_result
-# ----------------------------------------------------------------------------
-
-# 1. Basic test
---lowercase_result
-SELECT "500g BLBRSYLTETY" AS "WILL BE lower cased";
-
-# 2. test that it does not apply to next statement
-SELECT "UPPER" AS "WILL NOT BE lower cased";
-
-# 3. test that it does not affect non-SQL or the following statement
---lowercase_result
---echo UP
-SELECT 0 as "UP AGAIN";
-
-# 4. test that it works with eval and variables
-let $lower_stmt=SELECT "ABCdef" AS "uvwXYZ";
---lowercase_result
-eval $lower_stmt;
-
-# 5. test that it works in combination with sort
-sorted_result;
-lowercase_result;
-SELECT "Xyz" AS Name UNION SELECT "Abc" as Name ORDER BY Name DESC;
-
-# 6. Test combination with replace, and that lower casing is done first
---lowercase_result
---replace_result old new
-SELECT 1 as "SOME OLD TEXT";
-
-# 7. Test missing lower casing of "unknown" characters
---character_set utf8
---lowercase_result
-SELECT 0 as "WILL NOT lower case ";
---character_set latin1
-
-# ----------------------------------------------------------------------------
-# Some coverage tests
-# ----------------------------------------------------------------------------
-
---disable_query_log
---exec $MYSQL_TEST --help 2>&1 > /dev/null
---exec $MYSQL_TEST --version 2>&1 > /dev/null
---enable_query_log
---disable_abort_on_error ONCE
---error 1
---exec $MYSQL_TEST a b c 2>&1 > /dev/null
-
-# ----------------------------------------------------------------------------
-# test for query_get_value
-# ----------------------------------------------------------------------------
-
-CREATE TABLE t1(
- a int, b varchar(255), c datetime
-);
-SHOW COLUMNS FROM t1;
-
-#------------ Positive tests ------------
-# 1. constant parameters
-# value is simple string without spaces
-let $value= query_get_value(SHOW COLUMNS FROM t1, Type, 1);
---echo statement=SHOW COLUMNS FROM t1 row_number=1, column_name="Type", Value=$value
-let $value= query_get_value("SHOW COLUMNS FROM t1", Type, 1);
---echo statement="SHOW COLUMNS FROM t1" row_number=1, column_name="Type", Value=$value
-#
-# 2. $variables as parameters
-# value IS NULL
-let $my_show= SHOW COLUMNS FROM t1;
-let $column_name= Default;
-let $row_number= 1;
-let $value= query_get_value($my_show, $column_name, $row_number);
---echo statement=$my_show row_number=$row_number, column_name=$column_name, Value=$value
-#
-# 3. result set of a SELECT (not recommended, because projection and
-# selection could be done much better by pure SELECT functionality)
-# value is string with space in the middle
-let $value= query_get_value(SELECT 'A B' AS "MyColumn", MyColumn, 1);
---echo value= ->$value<-
-#
-# 4. column name with space
-let $value= query_get_value(SELECT 1 AS "My Column", My Column, 1);
---echo value= $value
-#
-# 4.1 Query containing , protected by quotes, quotes also on column
-let $value= query_get_value('SELECT 1 as a, 2 as b', "b", 1);
---echo value= $value
-#
-#------------ Negative tests ------------
-# 5. Incomplete statement including missing parameters
-# 5.1 incomplete statement
---error 1
---exec echo "let \$value= query_get_value(SHOW;" | $MYSQL_TEST 2>&1
-# 5.2 missing query
---error 1
---exec echo "let \$value= query_get_value;" | $MYSQL_TEST 2>&1
-# 5.3 missing column name
---error 1
---exec echo "let \$value= query_get_value(SHOW COLUMNS FROM t1);" | $MYSQL_TEST 2>&1
-# 5.4 missing row number
---error 1
---exec echo "let \$value= query_get_value(SHOW COLUMNS FROM t1, Field);" | $MYSQL_TEST 2>&1
-#
-# 6. Somehow "wrong" value of parameters
-# 6.1 row parameter
-# 6.1.1 non sense number 0
-let $value= initialized;
-let $value= query_get_value(SHOW COLUMNS FROM t1, Field, 0);
---echo value= $value
-# 6.1.2 after the last row
-let $value= initialized;
-let $value= query_get_value(SHOW COLUMNS FROM t1, Field, 10);
---echo value= $value
-# 6.1.3 invalid row number
---error 1
---exec echo "let \$value= query_get_value(SHOW COLUMNS FROM t1, Field, notnumber);" | $MYSQL_TEST 2>&1
-# 6.2 column name parameter, name of not existing column
---error 1
---exec echo "let \$value= query_get_value(SHOW COLUMNS FROM t1, column_not_exists, 1);" | $MYSQL_TEST 2>&1
-# 6.3. statement which never gives a result set
---error 1
---exec echo "let \$value= query_get_value(SET @A = 1, Field, 1);" | $MYSQL_TEST 2>&1
-# 6.4. statement contains a ","
-# Note: There is no need to improve this, because we need query_get_value
-# for SHOW commands only.
---error 1
---exec echo "let \$value= query_get_value(SELECT 1 AS "A", 1 AS "B", 1);" | $MYSQL_TEST 2>&1
-#
-# 7. empty result set
-let $value= initialized;
-let $value= query_get_value(SELECT a FROM t1, a, 1);
---echo value= $value
-#
-# 9. failing statement
---error 1
---exec echo "let \$value= query_get_value(SHOW COLNS FROM t1, Field, 1);" | $MYSQL_TEST 2>&1
-#
-# 10. Artificial example how to process a complete SHOW result set:
-let $show_statement= SHOW COLUMNS FROM t1;
-let $rowno= 1;
-let $run=1;
-let $count= 0;
---echo
---echo Field Type Null Key Default Extra
-while ($run)
-{
- let $Field= query_get_value($show_statement, Field, $rowno);
- if ($Field == No such row)
- {
- let $run= 0;
- }
- if ($Field != No such row)
- {
- let $Type= query_get_value($show_statement, Type, $rowno);
- let $Null= query_get_value($show_statement, Null, $rowno);
- if ($Null == YES)
- {
- inc $count;
- }
- let $Key= query_get_value($show_statement, Key, $rowno);
- let $Default= query_get_value($show_statement, Default, $rowno);
- let $Extra= query_get_value($show_statement, Extra, $rowno);
- --echo $Field $Type $Null ->$Key<- $Default $Extra
- inc $rowno;
- }
-}
---echo
---echo Number of columns with Default NULL: $count
---echo
-eval $show_statement;
-
-drop table t1;
-
-# ----------------------------------------------------------------------------
-# Test change_user command
-# ----------------------------------------------------------------------------
-
---error 1
---exec echo "--change_user root,,inexistent" | $MYSQL_TEST 2>&1
-
---error 1
---exec echo "--change_user inexistent,,test" | $MYSQL_TEST 2>&1
-
---error 1
---exec echo "--change_user root,inexistent,test" | $MYSQL_TEST 2>&1
-
---change_user
---change_user root
---change_user root,,
---change_user root,,test
-
-# ----------------------------------------------------------------------------
-# Test mkdir and rmdir command
-# ----------------------------------------------------------------------------
-
-mkdir $MYSQLTEST_VARDIR/tmp/testdir;
-rmdir $MYSQLTEST_VARDIR/tmp/testdir;
-
-# Directory already exist
-mkdir $MYSQLTEST_VARDIR/tmp/testdir;
---error 1
-mkdir $MYSQLTEST_VARDIR/tmp/testdir;
-
-# Remove dir with file inside
-write_file $MYSQLTEST_VARDIR/tmp/testdir/file1.txt;
-hello
-EOF
-
-# Verify that --replace_result also work on list_files
---replace_result file REPLACED_FILE
-list_files $MYSQLTEST_VARDIR/tmp/testdir;
-# list_files gets the directory list before creating the new file
-list_files_write_file $MYSQLTEST_VARDIR/tmp/testdir/file2.txt $MYSQLTEST_VARDIR/tmp/testdir *;
-list_files_append_file $MYSQLTEST_VARDIR/tmp/testdir/file2.txt $MYSQLTEST_VARDIR/tmp/testdir *2*;
-list_files_write_file $MYSQLTEST_VARDIR/tmp/testdir/file2.txt $MYSQLTEST_VARDIR/tmp/testdir file?.txt;
-list_files_append_file $MYSQLTEST_VARDIR/tmp/testdir/file3.txt $MYSQLTEST_VARDIR/tmp/testdir file*.txt;
-diff_files $MYSQLTEST_VARDIR/tmp/testdir/file2.txt $MYSQLTEST_VARDIR/tmp/testdir/file3.txt;
-
-cat_file $MYSQLTEST_VARDIR/tmp/testdir/file3.txt;
-
-list_files_write_file $MYSQLTEST_VARDIR/tmp/testdir/file11.txt $MYSQLTEST_VARDIR/tmp/testdir file?.txt;
-remove_files_wildcard $MYSQLTEST_VARDIR/tmp/testdir file?.txt;
-list_files_write_file $MYSQLTEST_VARDIR/tmp/testdir/dir-list.txt $MYSQLTEST_VARDIR/tmp/testdir file*.txt;
-cat_file $MYSQLTEST_VARDIR/tmp/testdir/dir-list.txt;
-remove_files_wildcard $MYSQLTEST_VARDIR/tmp/testdir file*.txt;
-list_files $MYSQLTEST_VARDIR/tmp/testdir;
-remove_files_wildcard $MYSQLTEST_VARDIR/tmp/testdir;
-list_files $MYSQLTEST_VARDIR/tmp/testdir;
-rmdir $MYSQLTEST_VARDIR/tmp/testdir;
-
-#
-# Bug#36041 mysql-test-run doesn't seem to string match 100% effectively
-# on Windows
-#
-
---replace_result c:\\a.txt z
-SELECT 'c:\\a.txt' AS col;
-
-# ----------------------------------------------------------------------------
-# Test that -- is not allowed as comment, only as mysqltest builtin command
-# ----------------------------------------------------------------------------
-
-# valid
-select 1;
---query select 1
---query -- a comment for the server
-
-# Not valid, "select" is not a mysqltest command
---error 1
---exec echo "--select 1;" | $MYSQL_TEST 2>&1
-
-
-# ----------------------------------------------------------------------------
-# BUG#35701 please allow test language variables in connection and sync_slave_with_master
-# Test that "connection $variable" works and that $CURRENT_CONNECTION has the right value.
-# ----------------------------------------------------------------------------
-
-connect (con1,localhost,root,,);
---echo $CURRENT_CONNECTION
-connect (con2,localhost,root,,);
---echo $CURRENT_CONNECTION
-
-connection default;
---echo $CURRENT_CONNECTION
-
-connection con1;
---echo $CURRENT_CONNECTION
-
-connection con2;
---echo $CURRENT_CONNECTION
-
-let $x= con1;
-let $y= con2;
-
-connection $x;
---echo $CURRENT_CONNECTION
-
-connection $y;
---echo $CURRENT_CONNECTION
-
-# Disconnect the not selected connection
-disconnect $x;
---echo $CURRENT_CONNECTION
-
-# Disconnect the selected connection
-disconnect $y;
---echo $CURRENT_CONNECTION
-connection default;
-
-#
-# MDEV-13187 incorrect backslash parsing in clients
-#
-set sql_mode=no_backslash_escapes;
-select "foo\""bar";
-set sql_mode=default;
-
---echo End of tests
-
-# Wait till we reached the initial number of concurrent sessions
---source include/wait_until_count_sessions.inc
-
---disable_query_log
---eval SET GLOBAL max_connections = $saved_max_connections
---enable_query_log
diff --git a/mysql-test/t/mysqltest_256.test b/mysql-test/t/mysqltest_256.test
deleted file mode 100644
index fd9447cd2d8..00000000000
--- a/mysql-test/t/mysqltest_256.test
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# 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/mysqltest_cont_on_error.test b/mysql-test/t/mysqltest_cont_on_error.test
deleted file mode 100644
index c6eeca9b5c3..00000000000
--- a/mysql-test/t/mysqltest_cont_on_error.test
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# mysqltest --continue-on-error
-#
-
--- source include/not_embedded.inc
-
-#
-# with or without --continue-on-error the failing test should return an error
-# but with --continue-on-error, the failing line does not abort the test
-#
-
---error 1
---exec echo "select error; select 1;" | $MYSQL_TEST 2>&1
-
---exec echo "SELECT ERROR; SELECT 2;" | $MYSQL_TEST --continue-on-error 2>&1
-
diff --git a/mysql-test/t/mysqltest_ps.test b/mysql-test/t/mysqltest_ps.test
deleted file mode 100644
index c5a332f691f..00000000000
--- a/mysql-test/t/mysqltest_ps.test
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# Test mysqltest in --ps-protocol mode.
-#
-
-if (`SELECT $PS_PROTOCOL = 0`)
-{
- --skip Need ps-protocol
-}
-
-#
-# Test the --enable_prepare_warnings command.
-# Test default value (off), enabling, and disabling.
-#
-
---enable_warnings
-
-select 1 + "2 a";
-create table t (a int primary key, b blob default '');
-# This statement gives warning both during prepare and execute.
-# So gives double warnings when --enable_prepare_warnings.
-select a, (2*a) AS a from t group by a;
-drop table t;
-
---enable_prepare_warnings
-select 1 + "2 a";
-create table t (a int primary key, b blob default '');
-select a, (2*a) AS a from t group by a;
-drop table t;
-
---disable_prepare_warnings
-select 1 + "2 a";
-create table t (a int primary key, b blob default '');
-select a, (2*a) AS a from t group by a;
-drop table t;
diff --git a/mysql-test/t/named_pipe-master.opt b/mysql-test/t/named_pipe-master.opt
deleted file mode 100644
index e534ae1eae5..00000000000
--- a/mysql-test/t/named_pipe-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-enable-named-pipe
diff --git a/mysql-test/t/named_pipe.test b/mysql-test/t/named_pipe.test
deleted file mode 100644
index 8503907b808..00000000000
--- a/mysql-test/t/named_pipe.test
+++ /dev/null
@@ -1,32 +0,0 @@
-# We currently only have named pipe support on windows, so
-# in order to optimize things we skip this test on all
-# other platforms
---source include/windows.inc
-# Named pipe does not support the non-blocking API.
---disable_non_blocking_api
-
-# thread pool causes different results
--- source include/not_threadpool.inc
-
-# Only run this test if named pipe is avaliable
-let $nmp= query_get_value("SHOW VARIABLES LIKE 'named_pipe'", Value, 1);
-if ($nmp != ON){
- skip No named pipe support;
-}
-
-# Connect using named pipe for testing
-connect(pipe_con,localhost,root,,,,,PIPE);
-
-# Source select test case
--- source include/common-tests.inc
-
-connection default;
-disconnect pipe_con;
-
-# MDEV-10383 : check that other server cannot 'bind' on the same pipe
-let $MYSQLD_DATADIR= `select @@datadir`;
---error 1
---exec $MYSQLD_CMD --enable-named-pipe --skip-networking --log-error=second-mysqld.err
-let SEARCH_FILE=$MYSQLD_DATADIR/second-mysqld.err;
-let SEARCH_PATTERN=\[ERROR\] Create named pipe failed;
-source include/search_pattern_in_file.inc;
diff --git a/mysql-test/t/negation_elimination.test b/mysql-test/t/negation_elimination.test
deleted file mode 100644
index 312be8ccdb4..00000000000
--- a/mysql-test/t/negation_elimination.test
+++ /dev/null
@@ -1,103 +0,0 @@
-#
-# Test negation elimination
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1 (a int, key (a));
-insert into t1 values (NULL), (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
-(10), (11), (12), (13), (14), (15), (16), (17), (18), (19);
-
-explain select * from t1 where not(not(a));
-select * from t1 where not(not(a));
-explain select * from t1 where not(not(not(a > 10)));
-select * from t1 where not(not(not(a > 10)));
-explain select * from t1 where not(not(not(a < 5) and not(a > 10)));
-select * from t1 where not(not(not(a < 5) and not(a > 10)));
-explain select * from t1 where not(a = 10);
-select * from t1 where not(a = 10);
-explain select * from t1 where not(a != 10);
-select * from t1 where not(a != 1);
-explain select * from t1 where not(a < 10);
-select * from t1 where not(a < 10);
-explain select * from t1 where not(a >= 10);
-select * from t1 where not(a >= 10);
-explain select * from t1 where not(a > 10);
-select * from t1 where not(a > 10);
-explain select * from t1 where not(a <= 10);
-select * from t1 where not(a <= 10);
-explain select * from t1 where not(a is null);
-select * from t1 where not(a is null);
-explain select * from t1 where not(a is not null);
-select * from t1 where not(a is not null);
-explain select * from t1 where not(a < 5 or a > 15);
-select * from t1 where not(a < 5 or a > 15);
-explain select * from t1 where not(a < 15 and a > 5);
-select * from t1 where not(a < 15 and a > 5);
-
-explain select * from t1 where a = 2 or not(a < 10);
-select * from t1 where a = 2 or not(a < 10);
-explain select * from t1 where a > 5 and not(a > 10);
-select * from t1 where a > 5 and not(a > 10);
-explain select * from t1 where a > 5 xor a < 10;
-select * from t1 where a > 5 xor a < 10;
-
-explain select * from t1 where a = 2 or not(a < 5 or a > 15);
-select * from t1 where a = 2 or not(a < 5 or a > 15);
-explain select * from t1 where a = 7 or not(a < 15 and a > 5);
-select * from t1 where a = 7 or not(a < 15 and a > 5);
-
-explain select * from t1 where NULL or not(a < 15 and a > 5);
-select * from t1 where NULL or not(a < 15 and a > 5);
-explain select * from t1 where not(NULL and a > 5);
-select * from t1 where not(NULL and a > 5);
-explain select * from t1 where not(NULL or a);
-select * from t1 where not(NULL or a);
-explain select * from t1 where not(NULL and a);
-select * from t1 where not(NULL and a);
-
-explain select * from t1 where not((a < 5 or a < 10) and (not(a > 16) or a > 17));
-select * from t1 where not((a < 5 or a < 10) and (not(a > 16) or a > 17));
-explain select * from t1 where not((a < 5 and a < 10) and (not(a > 16) or a > 17));
-select * from t1 where not((a < 5 and a < 10) and (not(a > 16) or a > 17));
-explain select * from t1 where ((a between 5 and 15) and (not(a like 10)));
-select * from t1 where ((a between 5 and 15) and (not(a like 10)));
-
---echo # XOR (Note: XOR is negated by negating one of the operands)
-
---echo # Should return 6,7
-SELECT * FROM t1 WHERE ((a > 5) XOR (a > 7));
-
---echo # Should return 0..5,8..19
-SELECT * FROM t1 WHERE ((NOT (a > 5)) XOR (a > 7));
-SELECT * FROM t1 WHERE ((a > 5) XOR (NOT (a > 7)));
-SELECT * FROM t1 WHERE NOT ((a > 5) XOR (a > 7));
-
---echo # Should return 6,7
-SELECT * FROM t1 WHERE NOT ((NOT (a > 5)) XOR (a > 7));
-SELECT * FROM t1 WHERE NOT ((a > 5) XOR (NOT (a > 7)));
-
---echo # Should return 0..5,8..19
-SELECT * FROM t1 WHERE NOT ((NOT (a > 5)) XOR (NOT (a > 7)));
-
---echo # Should have empty result
-SELECT * FROM t1 WHERE (NULL XOR (a > 7));
-SELECT * FROM t1 WHERE NOT (NULL XOR (a > 7));
-
---echo # Should be simplified to "...WHERE (a XOR a)
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE NOT ((NOT a) XOR (a));
-
---echo # Should be simplified to "...WHERE (a XOR a)
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE NOT (a XOR (NOT a));
-
---echo # End XOR
-
-delete from t1 where a > 3;
-select a, not(not(a)) from t1;
-explain extended select a, not(not(a)), not(a <= 2 and not(a)), not(a not like "1"), not (a not in (1,2)), not(a != 2) from t1 where not(not(a)) having not(not(a));
-
-drop table t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/no-threads-master.opt b/mysql-test/t/no-threads-master.opt
deleted file mode 100644
index 33e3e97bc0e..00000000000
--- a/mysql-test/t/no-threads-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---thread-handling=no-threads
diff --git a/mysql-test/t/no-threads.test b/mysql-test/t/no-threads.test
deleted file mode 100644
index a2936abf784..00000000000
--- a/mysql-test/t/no-threads.test
+++ /dev/null
@@ -1,17 +0,0 @@
---source include/one_thread_per_connection.inc
-#
-# Test the --thread-handler=no-threads option
-#
-select 1+1;
-select 1+2;
-SHOW GLOBAL VARIABLES LIKE 'thread_handling';
-
-#
-# Bug #30651 Problems with thread_handling system variable
-#
-
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-select @@session.thread_handling;
-
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-set GLOBAL thread_handling='one-thread';
diff --git a/mysql-test/t/no_binlog.test b/mysql-test/t/no_binlog.test
deleted file mode 100644
index fa9c87079de..00000000000
--- a/mysql-test/t/no_binlog.test
+++ /dev/null
@@ -1,6 +0,0 @@
--- source include/not_embedded.inc
-
-# BUG#50780: 'show binary logs' debug assertion when binary logging is disabled
-
--- error ER_NO_BINARY_LOGGING
-SHOW BINARY LOGS;
diff --git a/mysql-test/t/no_password_column-mdev-11170.test b/mysql-test/t/no_password_column-mdev-11170.test
deleted file mode 100644
index 2cc4ba82ee8..00000000000
--- a/mysql-test/t/no_password_column-mdev-11170.test
+++ /dev/null
@@ -1,95 +0,0 @@
---source include/not_embedded.inc
---echo #
---echo # MDEV-11170: MariaDB 10.2 cannot start on MySQL 5.7 datadir:
---echo # Fatal error: mysql.user table is damaged or in
---echo # unsupported 3.20 format
---echo #
-
-
-create table backup_user like mysql.user;
-insert into backup_user select * from mysql.user;
-
---echo #
---echo # Original mysql.user table
---echo #
-describe mysql.user;
-
---echo #
---echo # Drop the password column.
---echo #
-alter table mysql.user drop column password;
-flush privileges;
-
---echo #
---echo # Create users without the password column present.
---echo #
-create user foo;
-create user goo identified by "foo";
-select OLD_PASSWORD("ioo");
-create user ioo identified with "mysql_old_password" as "7a8f886d28473e85";
-
---echo #
---echo # Check if users have grants loaded correctly.
---echo #
-show grants for foo;
-show grants for goo;
-show grants for ioo;
-
-select user, host, select_priv, plugin, authentication_string from mysql.user
-where user like "%oo"
-order by user;
-
---echo #
---echo # Test setting password.
---echo #
-SET PASSWORD FOR foo=PASSWORD("bar");
-
-show grants for foo;
-show grants for goo;
-show grants for ioo;
-
-select user, host, select_priv, plugin, authentication_string from mysql.user
-where user like "%oo"
-order by user;
-
---echo #
---echo # Test flush privileges without password column.
---echo #
-flush privileges;
-show grants for foo;
-show grants for goo;
-show grants for ioo;
-
---echo #
---echo # Test granting of privileges.
---echo #
-grant select on *.* to foo;
-grant select on *.* to goo;
-grant select on *.* to ioo;
-show grants for foo;
-show grants for goo;
-show grants for ioo;
-
---echo #
---echo # Check to see if grants are stable on flush.
---echo #
-flush privileges;
-show grants for foo;
-show grants for goo;
-show grants for ioo;
-
---echo #
---echo # Check internal table representation.
---echo #
-select user, host, select_priv, plugin, authentication_string from mysql.user
-where user like "%oo"
-order by user;
-
-
---echo #
---echo # Reset to final original state.
---echo #
-drop table mysql.user;
-rename table backup_user to mysql.user;
-
-flush privileges;
diff --git a/mysql-test/t/non_blocking_api.test b/mysql-test/t/non_blocking_api.test
deleted file mode 100644
index b6b43427a76..00000000000
--- a/mysql-test/t/non_blocking_api.test
+++ /dev/null
@@ -1,22 +0,0 @@
-# Test mixing the use of blocking and non-blocking API in a single connection.
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
---enable_non_blocking_api
-connect (con_nonblock,localhost,root,,test);
---disable_non_blocking_api
-connect (con_normal,localhost,root,,test);
-
-connection con_nonblock;
-CREATE TABLE t1 (a INT PRIMARY KEY);
---enable_non_blocking_api
-INSERT INTO t1 VALUES (1);
---disable_non_blocking_api
-SELECT * FROM t1;
---enable_non_blocking_api
-SELECT * FROM t1;
-
-connection con_normal;
-DROP TABLE t1;
diff --git a/mysql-test/t/not_embedded_server.test b/mysql-test/t/not_embedded_server.test
deleted file mode 100644
index b2cbdba6850..00000000000
--- a/mysql-test/t/not_embedded_server.test
+++ /dev/null
@@ -1,208 +0,0 @@
-#
-# Here we collect tests that doesn't work with the embedded server
-#
-
--- source include/not_embedded.inc
-
-# End of 4.1 tests
-
-call mtr.add_suppression("Can't open and lock privilege tables: Table 'user' was not locked with LOCK TABLES");
-
-#
-# Bug#43835: SHOW VARIABLES does not include 0 for slave_skip_errors
-#
-
-SHOW VARIABLES like 'slave_skip_errors';
-
---echo #
---echo # Bug#58026: massive recursion and crash in regular expression handling
---echo #
-
---error ER_STACK_OVERRUN_NEED_MORE,ER_REGEXP_ERROR
-SELECT '1' RLIKE RPAD('1', 10000, '(');
-
-
-# End of 5.1 tests
-
---echo #
---echo # WL#4284: Transactional DDL locking
---echo #
---echo # FLUSH PRIVILEGES should not implicitly unlock locked tables.
---echo #
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-CREATE TABLE t1 (c1 INT);
-LOCK TABLES t1 READ;
---error ER_TABLE_NOT_LOCKED
-FLUSH PRIVILEGES;
-UNLOCK TABLES;
-DROP TABLE t1;
-
---echo #
---echo # Bug#54812: assert in Diagnostics_area::set_ok_status during EXPLAIN
---echo #
-
-CREATE USER nopriv_user@localhost;
-
-connection default;
-
---disable_warnings
-DROP TABLE IF EXISTS t1,t2,t3;
-DROP FUNCTION IF EXISTS f;
---enable_warnings
-
-CREATE TABLE t1 (key1 INT PRIMARY KEY);
-CREATE TABLE t2 (key2 INT);
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE FUNCTION f() RETURNS INT RETURN 1;
-
-GRANT FILE ON *.* TO 'nopriv_user'@'localhost';
-
-FLUSH PRIVILEGES;
-
-connect (con1,localhost,nopriv_user,,);
-connection con1;
-
-let outfile=$MYSQLTEST_VARDIR/tmp/mytest;
---error 0,1
---remove_file $outfile
---replace_result $outfile <outfile>
---error ER_PROCACCESS_DENIED_ERROR
-eval SELECT MAX(key1) FROM t1 WHERE f() < 1 INTO OUTFILE '$outfile';
-# A removal of the outfile is necessary, at least today (2010-12-07), because
-# the outfile is created even if the SELECT statement fails.
-# If the server is improved in the future this may not happen.
-# ==> Do not fail if the outfile does not exist.
---error 0,1
---remove_file $outfile
-
---error ER_PROCACCESS_DENIED_ERROR
-INSERT INTO t2 SELECT MAX(key1) FROM t1 WHERE f() < 1;
-
---error ER_PROCACCESS_DENIED_ERROR
-SELECT MAX(key1) INTO @dummy FROM t1 WHERE f() < 1;
-
---error ER_PROCACCESS_DENIED_ERROR
-CREATE TABLE t3 (i INT) AS SELECT MAX(key1) FROM t1 WHERE f() < 1;
-
-disconnect con1;
---source include/wait_until_disconnected.inc
-
-connection default;
-
-DROP TABLE t1,t2;
-DROP FUNCTION f;
-DROP USER nopriv_user@localhost;
-
---echo #
---echo # End Bug#54812
---echo #
-
-
---echo
---echo #
---echo # Test for Bug#12601974 - STORED PROCEDURE SQL_MODE=NO_BACKSLASH_ESCAPES
---echo # IGNORED AND BREAKS REPLICATION
---echo #
-
-SET @org_mode=@@sql_mode;
-
-SET @@sql_mode='';
-
---echo # USER NAME CONTAINING BACKSLASH IN CREATE USER OPERATION
-CREATE USER 'user\'s_12601974'@'localhost';
---error ER_CANNOT_USER
-CREATE USER 'user\'s_12601974'@'localhost';
-DROP USER 'user\'s_12601974'@'localhost';
-
-CREATE USER 'user\"s_12601974'@'localhost';
---error ER_CANNOT_USER
-CREATE USER 'user\"s_12601974'@'localhost';
-DROP USER 'user\"s_12601974'@'localhost';
-
-CREATE USER 'user\bs_12601974'@'localhost';
---error ER_CANNOT_USER
-CREATE USER 'user\bs_12601974'@'localhost';
-DROP USER 'user\bs_12601974'@'localhost';
-
-CREATE USER 'user\ns_12601974'@'localhost';
---error ER_CANNOT_USER
-CREATE USER 'user\ns_12601974'@'localhost';
-DROP USER 'user\ns_12601974'@'localhost';
-
-CREATE USER 'user\rs_12601974'@'localhost';
---error ER_CANNOT_USER
-CREATE USER 'user\rs_12601974'@'localhost';
-DROP USER 'user\rs_12601974'@'localhost';
-
-CREATE USER 'user\ts_12601974'@'localhost';
---error ER_CANNOT_USER
-CREATE USER 'user\ts_12601974'@'localhost';
-DROP USER 'user\ts_12601974'@'localhost';
-
-CREATE USER 'user\\s_12601974'@'localhost';
---error ER_CANNOT_USER
-CREATE USER 'user\\s_12601974'@'localhost';
-DROP USER 'user\\s_12601974'@'localhost';
-
-CREATE USER 'user\%s_12601974'@'localhost';
---error ER_CANNOT_USER
-CREATE USER 'user\%s_12601974'@'localhost';
-DROP USER 'user\%s_12601974'@'localhost';
-
-CREATE USER 'user\_s_12601974'@'localhost';
---error ER_CANNOT_USER
-CREATE USER 'user\_s_12601974'@'localhost';
-DROP USER 'user\_s_12601974'@'localhost';
---echo
---echo # END OF CASE - USER NAME CONTAINING BACKSLASH IN CREATE USER OPERATION
-
-SET @@sql_mode='NO_BACKSLASH_ESCAPES';
---echo # USER NAME CONTAINING BACKSLASH IN DROP USER OPERATION
-CREATE USER 'user\"s_12601974'@'localhost';
---error ER_CANNOT_USER
-CREATE USER 'user\"s_12601974'@'localhost';
-DROP USER 'user\"s_12601974'@'localhost';
-
-CREATE USER 'user\bs_12601974'@'localhost';
---error ER_CANNOT_USER
-CREATE USER 'user\bs_12601974'@'localhost';
-DROP USER 'user\bs_12601974'@'localhost';
-
-CREATE USER 'user\ns_12601974'@'localhost';
---error ER_CANNOT_USER
-CREATE USER 'user\ns_12601974'@'localhost';
-DROP USER 'user\ns_12601974'@'localhost';
-
-CREATE USER 'user\rs_12601974'@'localhost';
---error ER_CANNOT_USER
-CREATE USER 'user\rs_12601974'@'localhost';
-DROP USER 'user\rs_12601974'@'localhost';
-
-CREATE USER 'user\ts_12601974'@'localhost';
---error ER_CANNOT_USER
-CREATE USER 'user\ts_12601974'@'localhost';
-DROP USER 'user\ts_12601974'@'localhost';
-
-CREATE USER 'user\\s_12601974'@'localhost';
---error ER_CANNOT_USER
-CREATE USER 'user\\s_12601974'@'localhost';
-DROP USER 'user\\s_12601974'@'localhost';
-
-CREATE USER 'user\%s_12601974'@'localhost';
---error ER_CANNOT_USER
-CREATE USER 'user\%s_12601974'@'localhost';
-DROP USER 'user\%s_12601974'@'localhost';
-
-CREATE USER 'user\_s_12601974'@'localhost';
---error ER_CANNOT_USER
-CREATE USER 'user\_s_12601974'@'localhost';
-DROP USER 'user\_s_12601974'@'localhost';
---echo
---echo # END OF CASE - USER NAME CONTAINING BACKSLASH IN CREATE USER OPERATION
-SET @@sql_mode= @org_mode;
-
---echo
---echo #End of Test for Bug#12601974
diff --git a/mysql-test/t/not_partition.test b/mysql-test/t/not_partition.test
deleted file mode 100644
index dd52e4b97e6..00000000000
--- a/mysql-test/t/not_partition.test
+++ /dev/null
@@ -1,100 +0,0 @@
---disable_abort_on_error
-# Run this test only when mysqld doesn't have partitioning (not compiled with)
-# the statements are not expected to work, just check that we
-# can't crash the server
-if (`SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME = 'partition'`)
-{
- --skip Test requires no partitioning
-}
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-let $MYSQLD_DATADIR= `SELECT @@datadir`;
-
-#
-# Bug#39893: Crash if select on a partitioned table,
-# when partitioning is disabled
-FLUSH TABLES;
---copy_file $MYSQLTEST_VARDIR/std_data/parts/t1.frm $MYSQLD_DATADIR/test/t1.frm
-SELECT * FROM t1;
-TRUNCATE TABLE t1;
-ANALYZE TABLE t1;
-CHECK TABLE t1;
-OPTIMIZE TABLE t1;
-REPAIR TABLE t1;
-ALTER TABLE t1 REPAIR PARTITION ALL;
-ALTER TABLE t1 CHECK PARTITION ALL;
-ALTER TABLE t1 OPTIMIZE PARTITION ALL;
-ALTER TABLE t1 ANALYZE PARTITION ALL;
-ALTER TABLE t1 REBUILD PARTITION ALL;
-ALTER TABLE t1 TRUNCATE PARTITION ALL;
-ALTER TABLE t1 ENGINE Memory;
-ALTER TABLE t1 ADD (new INT);
-DROP TABLE t1;
-
---error ER_FEATURE_DISABLED
-CREATE TABLE t1 (
- firstname VARCHAR(25) NOT NULL,
- lastname VARCHAR(25) NOT NULL,
- username VARCHAR(16) NOT NULL,
- email VARCHAR(35),
- joined DATE NOT NULL
-)
-PARTITION BY KEY(joined)
-PARTITIONS 6;
-
---error ER_FEATURE_DISABLED
-ALTER TABLE t1 PARTITION BY KEY(joined) PARTITIONS 2;
-
---error ER_BAD_TABLE_ERROR
-drop table t1;
-
---error ER_FEATURE_DISABLED
-CREATE TABLE t1 (
- firstname VARCHAR(25) NOT NULL,
- lastname VARCHAR(25) NOT NULL,
- username VARCHAR(16) NOT NULL,
- email VARCHAR(35),
- joined DATE NOT NULL
-)
-PARTITION BY RANGE( YEAR(joined) ) (
- PARTITION p0 VALUES LESS THAN (1960),
- PARTITION p1 VALUES LESS THAN (1970),
- PARTITION p2 VALUES LESS THAN (1980),
- PARTITION p3 VALUES LESS THAN (1990),
- PARTITION p4 VALUES LESS THAN MAXVALUE
-);
---error ER_BAD_TABLE_ERROR
-drop table t1;
-
---error ER_FEATURE_DISABLED
-CREATE TABLE t1 (id INT, purchased DATE)
- PARTITION BY RANGE( YEAR(purchased) )
- SUBPARTITION BY HASH( TO_DAYS(purchased) )
- SUBPARTITIONS 2 (
- PARTITION p0 VALUES LESS THAN (1990),
- PARTITION p1 VALUES LESS THAN (2000),
- PARTITION p2 VALUES LESS THAN MAXVALUE
- );
---error ER_BAD_TABLE_ERROR
-drop table t1;
-
-# Create a table without partitions to test "EXPLAIN PARTITIONS"
-create table t1 (a varchar(10) charset latin1 collate latin1_bin);
-insert into t1 values (''),(' '),('a'),('a '),('a ');
-explain partitions select * from t1 where a='a ' OR a='a';
-drop table t1;
---echo #
---echo # bug#11760213-52599: ALTER TABLE REMOVE PARTITIONING ON NON-PARTITIONED
---echo # TABLE CORRUPTS MYISAM
---disable_warnings
-DROP TABLE if exists `t1`;
---enable_warnings
-CREATE TABLE `t1`(`a` INT)ENGINE=myisam;
-ALTER TABLE `t1` ADD COLUMN `b` INT;
-CREATE UNIQUE INDEX `i1` ON `t1`(`b`);
-CREATE UNIQUE INDEX `i2` ON `t1`(`a`);
-ALTER TABLE `t1` ADD PRIMARY KEY (`a`);
-ALTER TABLE `t1` REMOVE PARTITIONING;
-CHECK TABLE `t1` EXTENDED;
-DROP TABLE t1;
diff --git a/mysql-test/t/null.test b/mysql-test/t/null.test
deleted file mode 100644
index 403790356ce..00000000000
--- a/mysql-test/t/null.test
+++ /dev/null
@@ -1,1181 +0,0 @@
-# Initialise
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-
-#
-# Testing of NULL in a lot of different places
-#
-
-select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnull(null,1),ifnull(null,"TRUE"),ifnull("TRUE","ERROR"),1/0 is null,1 is not null;
-explain extended select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnull(null,1),ifnull(null,"TRUE"),ifnull("TRUE","ERROR"),1/0 is null,1 is not null;
-select 1 | NULL,1 & NULL,1+NULL,1-NULL;
-select NULL=NULL,NULL<>NULL,IFNULL(NULL,1.1)+0,IFNULL(NULL,1) | 0;
-select strcmp("a",NULL),(1<NULL)+0.0,NULL regexp "a",null like "a%","a%" like null;
-select concat("a",NULL),replace(NULL,"a","b"),replace("string","i",NULL),replace("string",NULL,"i"),insert("abc",1,1,NULL),left(NULL,1);
-select repeat("a",0),repeat("ab",5+5),repeat("ab",-1),reverse(NULL);
-select field(NULL,"a","b","c");
-select 2 between null and 1,2 between 3 AND NULL,NULL between 1 and 2,2 between NULL and 3, 2 between 1 AND null;
-explain extended select 2 between null and 1,2 between 3 AND NULL,NULL between 1 and 2,2 between NULL and 3, 2 between 1 AND null;
-SELECT NULL AND NULL, 1 AND NULL, NULL AND 1, NULL OR NULL, 0 OR NULL, NULL OR 0;
-SELECT (NULL OR NULL) IS NULL;
-select NULL AND 0, 0 and NULL;
-select inet_ntoa(null),inet_aton(null),inet_aton("122.256"),inet_aton("122.226."),inet_aton("");
-explain extended select inet_ntoa(null),inet_aton(null),inet_aton("122.256"),inet_aton("122.226."),inet_aton("");
-select not null is true, not null or true, not null and false, not null <=> null;
-
-create table t1 (x int);
-insert into t1 values (null);
-select * from t1 where x != 0;
-drop table t1;
-
-#
-# Test problem med index on NULL columns and testing with =NULL;
-#
-
-CREATE TABLE t1 (
- indexed_field int default NULL,
- KEY indexed_field (indexed_field)
-);
-INSERT INTO t1 VALUES (NULL),(NULL);
-SELECT * FROM t1 WHERE indexed_field=NULL;
-SELECT * FROM t1 WHERE indexed_field IS NULL;
-SELECT * FROM t1 WHERE indexed_field<=>NULL;
-DROP TABLE t1;
-
-#
-# Testing of IFNULL
-#
-create table t1 (a int, b int) engine=myisam;
-insert into t1 values(20,null);
-select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
-t2.b=t3.a;
-select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
-t2.b=t3.a order by 1;
-insert into t1 values(10,null);
-select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
-t2.b=t3.a order by 1;
-drop table t1;
-
-#
-# Test inserting and updating with NULL
-#
-CREATE TABLE t1 (a varchar(16) NOT NULL default '', b smallint(6) NOT NULL default 0, c datetime NOT NULL default '0000-00-00 00:00:00', d smallint(6) NOT NULL default 0);
-INSERT IGNORE INTO t1 SET a = "", d= "2003-01-14 03:54:55";
-UPDATE IGNORE t1 SET d=1/NULL;
-UPDATE IGNORE t1 SET d=NULL;
---error 1048
-INSERT INTO t1 (a) values (null);
---error 1048
-INSERT INTO t1 (a) values (1/null);
-INSERT IGNORE INTO t1 (a) values (null),(null);
---error 1048
-INSERT INTO t1 (b) values (null);
---error 1048
-INSERT INTO t1 (b) values (1/null);
-INSERT IGNORE INTO t1 (b) values (null),(null);
---error 1048
-INSERT INTO t1 (c) values (null);
---error 1048
-INSERT INTO t1 (c) values (1/null);
-INSERT IGNORE INTO t1 (c) values (null),(null);
---error 1048
-INSERT INTO t1 (d) values (null);
---error 1048
-INSERT INTO t1 (d) values (1/null);
-INSERT IGNORE INTO t1 (d) values (null),(null);
-select * from t1;
-drop table t1;
-
-#
-# Test to check elimination of IS NULL predicate for a non-nullable attribute
-# (bug #1990)
-#
-create table t1 (a int not null, b int not null, index idx(a));
-insert into t1 values
- (1,1), (2,2), (3,3), (4,4), (5,5), (6,6),
- (7,7), (8,8), (9,9), (10,10), (11,11), (12,12);
-explain select * from t1 where a between 2 and 3;
-explain select * from t1 where a between 2 and 3 or b is null;
-drop table t1;
-select cast(NULL as signed);
-
-#
-# IS NULL is unable to use index in range if column is declared not null
-# (Bug #4256)
-#
-create table t1(i int, key(i));
-insert into t1 values(1);
-insert into t1 select i*2 from t1;
-insert into t1 select i*2 from t1;
-insert into t1 select i*2 from t1;
-insert into t1 select i*2 from t1;
-insert into t1 select i*2 from t1;
-insert into t1 select i*2 from t1;
-insert into t1 select i*2 from t1;
-insert into t1 select i*2 from t1;
-insert into t1 select i*2 from t1;
-insert into t1 values(null);
-explain select * from t1 where i=2 or i is null;
-select count(*) from t1 where i=2 or i is null;
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-alter table t1 change i i int not null;
-explain select * from t1 where i=2 or i is null;
-select count(*) from t1 where i=2 or i is null;
-drop table t1;
-
-#
-# NULL has its own type BINARY(0) by default.
-# But NULL should be weaker than a constant
-# when mixing charsets/collations
-#
-set names latin2;
-# Check that result type is taken from a non-null string
-create table t1 select
- null as c00,
- if(1, null, 'string') as c01,
- if(0, null, 'string') as c02,
- ifnull(null, 'string') as c03,
- ifnull('string', null) as c04,
- case when 0 then null else 'string' end as c05,
- case when 1 then null else 'string' end as c06,
- coalesce(null, 'string') as c07,
- coalesce('string', null) as c08,
- least('string',null) as c09,
- least(null, 'string') as c10,
- greatest('string',null) as c11,
- greatest(null, 'string') as c12,
- nullif('string', null) as c13,
- nullif(null, 'string') as c14,
- trim('string' from null) as c15,
- trim(null from 'string') as c16,
- substring_index('string', null, 1) as c17,
- substring_index(null, 'string', 1) as c18,
- elt(1, null, 'string') as c19,
- elt(1, 'string', null) as c20,
- concat('string', null) as c21,
- concat(null, 'string') as c22,
- concat_ws('sep', 'string', null) as c23,
- concat_ws('sep', null, 'string') as c24,
- concat_ws(null, 'string', 'string') as c25,
- make_set(3, 'string', null) as c26,
- make_set(3, null, 'string') as c27,
- export_set(3, null, 'off', 'sep') as c29,
- export_set(3, 'on', null, 'sep') as c30,
- export_set(3, 'on', 'off', null) as c31,
- replace(null, 'from', 'to') as c32,
- replace('str', null, 'to') as c33,
- replace('str', 'from', null) as c34,
- insert('str', 1, 2, null) as c35,
- insert(null, 1, 2, 'str') as c36,
- lpad('str', 10, null) as c37,
- rpad(null, 10, 'str') as c38;
-
-show create table t1;
-drop table t1;
-
-#
-# Check that comparison is done according to
-# non-null string collation, i.e. case insensitively,
-# rather than according to NULL's collation, i.e. case sensitively
-#
-# in field
-select
- case 'str' when 'STR' then 'str' when null then 'null' end as c01,
- case 'str' when null then 'null' when 'STR' then 'str' end as c02,
- field(null, 'str1', 'str2') as c03,
- field('str1','STR1', null) as c04,
- field('str1', null, 'STR1') as c05,
- 'string' in ('STRING', null) as c08,
- 'string' in (null, 'STRING') as c09;
-
-# Restore charset to the default value.
-set names latin1;
-
-#
-# Bug#19145: mysqld crashes if you set the default value of an enum field to NULL
-#
-create table bug19145a (e enum('a','b','c') default 'b' , s set('x', 'y', 'z') default 'y' ) engine=MyISAM;
-create table bug19145b (e enum('a','b','c') default null, s set('x', 'y', 'z') default null) engine=MyISAM;
-
-create table bug19145c (e enum('a','b','c') not null default 'b' , s set('x', 'y', 'z') not null default 'y' ) engine=MyISAM;
-
-# Invalid default value for 's'
---error 1067
-create table bug19145setnotnulldefaultnull (e enum('a','b','c') default null, s set('x', 'y', 'z') not null default null) engine=MyISAM;
-
-# Invalid default value for 'e'
---error 1067
-create table bug19145enumnotnulldefaultnull (e enum('a','b','c') not null default null, s set('x', 'y', 'z') default null) engine=MyISAM;
-
-alter table bug19145a alter column e set default null;
-alter table bug19145a alter column s set default null;
-alter table bug19145a add column (i int);
-
-alter table bug19145b alter column e set default null;
-alter table bug19145b alter column s set default null;
-alter table bug19145b add column (i int);
-
-# Invalid default value for 'e'
---error 1067
-alter table bug19145c alter column e set default null;
-
-# Invalid default value for 's'
---error 1067
-alter table bug19145c alter column s set default null;
-alter table bug19145c add column (i int);
-
-show create table bug19145a;
-show create table bug19145b;
-show create table bug19145c;
-
-drop table bug19145a;
-drop table bug19145b;
-drop table bug19145c;
-
---echo # End of 4.1 tests
-
---echo #
---echo # Bug #31471: decimal_bin_size: Assertion `scale >= 0 &&
---echo # precision > 0 && scale <= precision'
---echo #
-
-CREATE TABLE t1 (a DECIMAL (1, 0) ZEROFILL, b DECIMAL (1, 0) ZEROFILL);
-INSERT INTO t1 (a, b) VALUES (0, 0);
-
-CREATE TABLE t2 SELECT IFNULL(a, b) FROM t1;
-DESCRIBE t2;
-DROP TABLE t2;
-
-CREATE TABLE t2 SELECT IFNULL(a, NULL) FROM t1;
-DESCRIBE t2;
-DROP TABLE t2;
-
-CREATE TABLE t2 SELECT IFNULL(NULL, b) FROM t1;
-DESCRIBE t2;
-
-DROP TABLE t1, t2;
-
---echo # End of 5.0 tests
-
---echo #
---echo # MDEV-4895 Valgrind warnings (Conditional jump or move depends on uninitialised value) in Field_datetime::get_date on GREATEST(..) IS NULL
---echo #
-
-CREATE TABLE t1 (dt DATETIME NOT NULL);
-INSERT INTO t1 VALUES (NOW()),(NOW());
-
-EXPLAIN
-SELECT * FROM t1 WHERE concat( dt, '2012-12-21 12:12:12' ) IS NULL;
-SELECT * FROM t1 WHERE concat( dt, '2012-12-21 12:12:12' ) IS NULL;
-
-DROP TABLE t1;
-CREATE TABLE t1 (dt INT NOT NULL);
-INSERT INTO t1 VALUES (1),(2);
-EXPLAIN
-SELECT * FROM t1 WHERE concat( dt, '1' ) IS NULL;
-SELECT * FROM t1 WHERE concat( dt, '1' ) IS NULL;
-
-DROP TABLE t1;
-CREATE TABLE t1 (dt INT NOT NULL);
-INSERT INTO t1 VALUES (1),(2);
-
-EXPLAIN
-SELECT * FROM t1 WHERE NOT (concat( dt, '1' ) IS NOT NULL);
-SELECT * FROM t1 WHERE NOT (concat( dt, '1' ) IS NOT NULL);
-
-DROP TABLE t1;
-
---echo #
---echo # Bug mdev-5132: crash when exeicuting a join query
---echo # with IS NULL and IS NOT NULL in where
---echo #
-
-CREATE TABLE t1 (a DATE, b INT, c INT, KEY(a), KEY(b), KEY(c)) ENGINE=MyISAM;
-CREATE TABLE t2 (d DATE) ENGINE=MyISAM;
-
-SELECT * FROM t1,t2 WHERE 1 IS NOT NULL AND t1.b IS NULL;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Start of 10.0 tests
---echo #
-
---echo #
---echo # MDEV-7001 Bad result for NOT NOT STRCMP('a','b') and NOT NOT NULLIF(2,3)
---echo #
-SELECT NOT NOT NULLIF(2,3);
-
---echo #
---echo # End of 10.0 tests
---echo #
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-7146 NULLIF returns unexpected result with a YEAR field
---echo #
-CREATE TABLE t1 (a YEAR(2));
-INSERT INTO t1 VALUES (0);
-SELECT a,NULLIF(a,2000),NULLIF(2000,a) FROM t1;
-SELECT a,NULLIF(a,2001),NULLIF(2001,a) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-7005 NULLIF does not work as documented
---echo #
-
-CREATE TABLE t1 (a TIME);
-CREATE TABLE t2 AS SELECT a,NULLIF(a,a), CASE WHEN a=a THEN NULL ELSE a END FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t1,t2;
-
---error ER_CANT_AGGREGATE_2COLLATIONS
-SELECT NULLIF(_latin1'a' COLLATE latin1_general_ci, _latin1'a' COLLATE latin1_bin);
-
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-CREATE TABLE t1 AS SELECT
- NULLIF(1,1),
- NULLIF(1,1.0),
- NULLIF(1,1e0),
- NULLIF(1,'2001-01-01'),
- NULLIF(1,TIME'00:00:00');
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-CREATE TABLE t1 AS SELECT
- NULLIF(1.0,1),
- NULLIF(1.0,1.0),
- NULLIF(1.0,1e0),
- NULLIF(1.0,'2001-01-01'),
- NULLIF(1.0,TIME'00:00:00');
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-CREATE TABLE t1 AS SELECT
- NULLIF(1e0,1),
- NULLIF(1e0,1.0),
- NULLIF(1e0,1e0),
- NULLIF(1e0,'2001-01-01'),
- NULLIF(1e0,TIME'00:00:00');
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 AS SELECT
- NULLIF('1',1),
- NULLIF('1',1.0),
- NULLIF('1',1e0),
- NULLIF('1','2001-01-01'),
- NULLIF('1',TIME'00:00:00');
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-CREATE TABLE t1 AS SELECT
- NULLIF(TIMESTAMP'2001-01-01 00:00:00',1),
- NULLIF(TIMESTAMP'2001-01-01 00:00:00',1.0),
- NULLIF(TIMESTAMP'2001-01-01 00:00:00',1e0),
- NULLIF(TIMESTAMP'2001-01-01 00:00:00','2001-01-01'),
- NULLIF(TIMESTAMP'2001-01-01 00:00:00',TIME'00:00:00');
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-CREATE TABLE t1 AS SELECT
- NULLIF(DATE'2001-01-01',1),
- NULLIF(DATE'2001-01-01',1.0),
- NULLIF(DATE'2001-01-01',1e0),
- NULLIF(DATE'2001-01-01','2001-01-01'),
- NULLIF(DATE'2001-01-01',TIME'00:00:00');
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 AS SELECT
- NULLIF(TIME'00:00:01',1),
- NULLIF(TIME'00:00:01',1.0),
- NULLIF(TIME'00:00:01',1e0),
- NULLIF(TIME'00:00:01','00:00:00'),
- NULLIF(TIME'00:00:01',DATE'2001-01-01');
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1
-(
- c_tinyint TINYINT,
- c_smallint SMALLINT,
- c_int INT,
- c_bigint BIGINT,
- c_float FLOAT,
- c_double DOUBLE,
- c_decimal103 DECIMAL(10,3),
- c_varchar10 VARCHAR(10),
- c_tinytext TINYTEXT,
- c_text TEXT,
- c_mediumtext MEDIUMTEXT,
- c_longtext LONGTEXT,
- c_tinyblob TINYBLOB,
- c_blob BLOB,
- c_mediumblob MEDIUMBLOB,
- c_longblob LONGBLOB,
- c_enum ENUM('one','two','tree'),
- c_datetime3 DATETIME(3),
- c_timestamp3 TIMESTAMP(3),
- c_date DATE,
- c_time TIME
-);
-
---echo #
---echo # Checking that the return type depends only on args[0], even when compared to a super type
---echo #
-
-CREATE TABLE t2 AS SELECT
- NULLIF(c_tinyint, 1),
- NULLIF(c_tinyint, c_smallint),
- NULLIF(c_tinyint, c_tinyint),
- NULLIF(c_tinyint, c_int),
- NULLIF(c_tinyint, c_bigint),
- NULLIF(c_tinyint, c_float),
- NULLIF(c_tinyint, c_double),
- NULLIF(c_tinyint, c_decimal103),
- NULLIF(c_tinyint, c_varchar10),
- NULLIF(c_tinyint, c_text),
- NULLIF(c_tinyint, c_blob),
- NULLIF(c_tinyint, c_enum),
- NULLIF(c_tinyint, c_datetime3),
- NULLIF(c_tinyint, c_timestamp3),
- NULLIF(c_tinyint, c_date),
- NULLIF(c_tinyint, c_time)
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE TABLE t2 AS SELECT
- NULLIF(c_smallint, 1),
- NULLIF(c_smallint, c_smallint),
- NULLIF(c_smallint, c_tinyint),
- NULLIF(c_smallint, c_int),
- NULLIF(c_smallint, c_bigint),
- NULLIF(c_smallint, c_float),
- NULLIF(c_smallint, c_double),
- NULLIF(c_smallint, c_decimal103),
- NULLIF(c_smallint, c_varchar10),
- NULLIF(c_smallint, c_text),
- NULLIF(c_smallint, c_blob),
- NULLIF(c_smallint, c_enum),
- NULLIF(c_smallint, c_datetime3),
- NULLIF(c_smallint, c_timestamp3),
- NULLIF(c_smallint, c_date),
- NULLIF(c_smallint, c_time)
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE TABLE t2 AS SELECT
- NULLIF(c_int, 1),
- NULLIF(c_int, c_smallint),
- NULLIF(c_int, c_tinyint),
- NULLIF(c_int, c_int),
- NULLIF(c_int, c_bigint),
- NULLIF(c_int, c_float),
- NULLIF(c_int, c_double),
- NULLIF(c_int, c_decimal103),
- NULLIF(c_int, c_varchar10),
- NULLIF(c_int, c_text),
- NULLIF(c_int, c_blob),
- NULLIF(c_int, c_enum),
- NULLIF(c_int, c_datetime3),
- NULLIF(c_int, c_timestamp3),
- NULLIF(c_int, c_date),
- NULLIF(c_int, c_time)
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE TABLE t2 AS SELECT
- NULLIF(c_bigint, 1),
- NULLIF(c_bigint, c_smallint),
- NULLIF(c_bigint, c_tinyint),
- NULLIF(c_bigint, c_int),
- NULLIF(c_bigint, c_bigint),
- NULLIF(c_bigint, c_float),
- NULLIF(c_bigint, c_double),
- NULLIF(c_bigint, c_decimal103),
- NULLIF(c_bigint, c_varchar10),
- NULLIF(c_bigint, c_text),
- NULLIF(c_bigint, c_blob),
- NULLIF(c_bigint, c_enum),
- NULLIF(c_bigint, c_datetime3),
- NULLIF(c_bigint, c_timestamp3),
- NULLIF(c_bigint, c_date),
- NULLIF(c_bigint, c_time)
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-# QQ: this should probably create a FLOAT column instead of a DOUBLE column
-CREATE TABLE t2 AS SELECT
- NULLIF(c_float, 1),
- NULLIF(c_float, c_smallint),
- NULLIF(c_float, c_tinyint),
- NULLIF(c_float, c_int),
- NULLIF(c_float, c_bigint),
- NULLIF(c_float, c_float),
- NULLIF(c_float, c_double),
- NULLIF(c_float, c_decimal103),
- NULLIF(c_float, c_varchar10),
- NULLIF(c_float, c_text),
- NULLIF(c_float, c_blob),
- NULLIF(c_float, c_enum),
- NULLIF(c_float, c_datetime3),
- NULLIF(c_float, c_timestamp3),
- NULLIF(c_float, c_date),
- NULLIF(c_float, c_time)
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE TABLE t2 AS SELECT
- NULLIF(c_double, 1),
- NULLIF(c_double, c_smallint),
- NULLIF(c_double, c_tinyint),
- NULLIF(c_double, c_int),
- NULLIF(c_double, c_bigint),
- NULLIF(c_double, c_float),
- NULLIF(c_double, c_double),
- NULLIF(c_double, c_decimal103),
- NULLIF(c_double, c_varchar10),
- NULLIF(c_double, c_text),
- NULLIF(c_double, c_blob),
- NULLIF(c_double, c_enum),
- NULLIF(c_double, c_datetime3),
- NULLIF(c_double, c_timestamp3),
- NULLIF(c_double, c_date),
- NULLIF(c_double, c_time)
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE TABLE t2 AS SELECT
- NULLIF(c_decimal103, 1),
- NULLIF(c_decimal103, c_smallint),
- NULLIF(c_decimal103, c_tinyint),
- NULLIF(c_decimal103, c_int),
- NULLIF(c_decimal103, c_bigint),
- NULLIF(c_decimal103, c_float),
- NULLIF(c_decimal103, c_double),
- NULLIF(c_decimal103, c_decimal103),
- NULLIF(c_decimal103, c_varchar10),
- NULLIF(c_decimal103, c_text),
- NULLIF(c_decimal103, c_blob),
- NULLIF(c_decimal103, c_enum),
- NULLIF(c_decimal103, c_datetime3),
- NULLIF(c_decimal103, c_timestamp3),
- NULLIF(c_decimal103, c_date),
- NULLIF(c_decimal103, c_time)
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE TABLE t2 AS SELECT
- NULLIF(c_varchar10, 1),
- NULLIF(c_varchar10, c_smallint),
- NULLIF(c_varchar10, c_tinyint),
- NULLIF(c_varchar10, c_int),
- NULLIF(c_varchar10, c_bigint),
- NULLIF(c_varchar10, c_float),
- NULLIF(c_varchar10, c_double),
- NULLIF(c_varchar10, c_decimal103),
- NULLIF(c_varchar10, c_varchar10),
- NULLIF(c_varchar10, c_text),
- NULLIF(c_varchar10, c_blob),
- NULLIF(c_varchar10, c_enum),
- NULLIF(c_varchar10, c_datetime3),
- NULLIF(c_varchar10, c_timestamp3),
- NULLIF(c_varchar10, c_date),
- NULLIF(c_varchar10, c_time)
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE TABLE t2 AS SELECT
- NULLIF(c_tinytext, 1),
- NULLIF(c_tinytext, c_smallint),
- NULLIF(c_tinytext, c_tinyint),
- NULLIF(c_tinytext, c_int),
- NULLIF(c_tinytext, c_bigint),
- NULLIF(c_tinytext, c_float),
- NULLIF(c_tinytext, c_double),
- NULLIF(c_tinytext, c_decimal103),
- NULLIF(c_tinytext, c_varchar10),
- NULLIF(c_tinytext, c_text),
- NULLIF(c_tinytext, c_blob),
- NULLIF(c_tinytext, c_enum),
- NULLIF(c_tinytext, c_datetime3),
- NULLIF(c_tinytext, c_timestamp3),
- NULLIF(c_tinytext, c_date),
- NULLIF(c_tinytext, c_time)
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE TABLE t2 AS SELECT
- NULLIF(c_text, 1),
- NULLIF(c_text, c_smallint),
- NULLIF(c_text, c_tinyint),
- NULLIF(c_text, c_int),
- NULLIF(c_text, c_bigint),
- NULLIF(c_text, c_float),
- NULLIF(c_text, c_double),
- NULLIF(c_text, c_decimal103),
- NULLIF(c_text, c_varchar10),
- NULLIF(c_text, c_text),
- NULLIF(c_text, c_blob),
- NULLIF(c_text, c_enum),
- NULLIF(c_text, c_datetime3),
- NULLIF(c_text, c_timestamp3),
- NULLIF(c_text, c_date),
- NULLIF(c_text, c_time)
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE TABLE t2 AS SELECT
- NULLIF(c_mediumtext, 1),
- NULLIF(c_mediumtext, c_smallint),
- NULLIF(c_mediumtext, c_tinyint),
- NULLIF(c_mediumtext, c_int),
- NULLIF(c_mediumtext, c_bigint),
- NULLIF(c_mediumtext, c_float),
- NULLIF(c_mediumtext, c_double),
- NULLIF(c_mediumtext, c_decimal103),
- NULLIF(c_mediumtext, c_varchar10),
- NULLIF(c_mediumtext, c_text),
- NULLIF(c_mediumtext, c_blob),
- NULLIF(c_mediumtext, c_enum),
- NULLIF(c_mediumtext, c_datetime3),
- NULLIF(c_mediumtext, c_timestamp3),
- NULLIF(c_mediumtext, c_date),
- NULLIF(c_mediumtext, c_time)
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE TABLE t2 AS SELECT
- NULLIF(c_longtext, 1),
- NULLIF(c_longtext, c_smallint),
- NULLIF(c_longtext, c_tinyint),
- NULLIF(c_longtext, c_int),
- NULLIF(c_longtext, c_bigint),
- NULLIF(c_longtext, c_float),
- NULLIF(c_longtext, c_double),
- NULLIF(c_longtext, c_decimal103),
- NULLIF(c_longtext, c_varchar10),
- NULLIF(c_longtext, c_text),
- NULLIF(c_longtext, c_blob),
- NULLIF(c_longtext, c_enum),
- NULLIF(c_longtext, c_datetime3),
- NULLIF(c_longtext, c_timestamp3),
- NULLIF(c_longtext, c_date),
- NULLIF(c_longtext, c_time)
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-
-CREATE TABLE t2 AS SELECT
- NULLIF(c_tinyblob, 1),
- NULLIF(c_tinyblob, c_smallint),
- NULLIF(c_tinyblob, c_tinyint),
- NULLIF(c_tinyblob, c_int),
- NULLIF(c_tinyblob, c_bigint),
- NULLIF(c_tinyblob, c_float),
- NULLIF(c_tinyblob, c_double),
- NULLIF(c_tinyblob, c_decimal103),
- NULLIF(c_tinyblob, c_varchar10),
- NULLIF(c_tinyblob, c_text),
- NULLIF(c_tinyblob, c_blob),
- NULLIF(c_tinyblob, c_enum),
- NULLIF(c_tinyblob, c_datetime3),
- NULLIF(c_tinyblob, c_timestamp3),
- NULLIF(c_tinyblob, c_date),
- NULLIF(c_tinyblob, c_time)
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE TABLE t2 AS SELECT
- NULLIF(c_blob, 1),
- NULLIF(c_blob, c_smallint),
- NULLIF(c_blob, c_tinyint),
- NULLIF(c_blob, c_int),
- NULLIF(c_blob, c_bigint),
- NULLIF(c_blob, c_float),
- NULLIF(c_blob, c_double),
- NULLIF(c_blob, c_decimal103),
- NULLIF(c_blob, c_varchar10),
- NULLIF(c_blob, c_text),
- NULLIF(c_blob, c_blob),
- NULLIF(c_blob, c_enum),
- NULLIF(c_blob, c_datetime3),
- NULLIF(c_blob, c_timestamp3),
- NULLIF(c_blob, c_date),
- NULLIF(c_blob, c_time)
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE TABLE t2 AS SELECT
- NULLIF(c_mediumblob, 1),
- NULLIF(c_mediumblob, c_smallint),
- NULLIF(c_mediumblob, c_tinyint),
- NULLIF(c_mediumblob, c_int),
- NULLIF(c_mediumblob, c_bigint),
- NULLIF(c_mediumblob, c_float),
- NULLIF(c_mediumblob, c_double),
- NULLIF(c_mediumblob, c_decimal103),
- NULLIF(c_mediumblob, c_varchar10),
- NULLIF(c_mediumblob, c_text),
- NULLIF(c_mediumblob, c_blob),
- NULLIF(c_mediumblob, c_enum),
- NULLIF(c_mediumblob, c_datetime3),
- NULLIF(c_mediumblob, c_timestamp3),
- NULLIF(c_mediumblob, c_date),
- NULLIF(c_mediumblob, c_time)
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE TABLE t2 AS SELECT
- NULLIF(c_longblob, 1),
- NULLIF(c_longblob, c_smallint),
- NULLIF(c_longblob, c_tinyint),
- NULLIF(c_longblob, c_int),
- NULLIF(c_longblob, c_bigint),
- NULLIF(c_longblob, c_float),
- NULLIF(c_longblob, c_double),
- NULLIF(c_longblob, c_decimal103),
- NULLIF(c_longblob, c_varchar10),
- NULLIF(c_longblob, c_text),
- NULLIF(c_longblob, c_blob),
- NULLIF(c_longblob, c_enum),
- NULLIF(c_longblob, c_datetime3),
- NULLIF(c_longblob, c_timestamp3),
- NULLIF(c_longblob, c_date),
- NULLIF(c_longblob, c_time)
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-
-# QQ: this should probably create a ENUM column instead of VARCHAR(4)
-CREATE TABLE t2 AS SELECT
- NULLIF(c_enum, 1),
- NULLIF(c_enum, c_smallint),
- NULLIF(c_enum, c_tinyint),
- NULLIF(c_enum, c_int),
- NULLIF(c_enum, c_bigint),
- NULLIF(c_enum, c_float),
- NULLIF(c_enum, c_double),
- NULLIF(c_enum, c_decimal103),
- NULLIF(c_enum, c_varchar10),
- NULLIF(c_enum, c_text),
- NULLIF(c_enum, c_blob),
- NULLIF(c_enum, c_enum),
- NULLIF(c_enum, c_datetime3),
- NULLIF(c_enum, c_timestamp3),
- NULLIF(c_enum, c_date),
- NULLIF(c_enum, c_time)
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE TABLE t2 AS SELECT
- NULLIF(c_datetime3, 1),
- NULLIF(c_datetime3, c_smallint),
- NULLIF(c_datetime3, c_tinyint),
- NULLIF(c_datetime3, c_int),
- NULLIF(c_datetime3, c_bigint),
- NULLIF(c_datetime3, c_float),
- NULLIF(c_datetime3, c_double),
- NULLIF(c_datetime3, c_decimal103),
- NULLIF(c_datetime3, c_varchar10),
- NULLIF(c_datetime3, c_text),
- NULLIF(c_datetime3, c_blob),
- NULLIF(c_datetime3, c_enum),
- NULLIF(c_datetime3, c_datetime3),
- NULLIF(c_datetime3, c_timestamp3),
- NULLIF(c_datetime3, c_date),
- NULLIF(c_datetime3, c_time)
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE TABLE t2 AS SELECT
- NULLIF(c_timestamp3, 1),
- NULLIF(c_timestamp3, c_smallint),
- NULLIF(c_timestamp3, c_tinyint),
- NULLIF(c_timestamp3, c_int),
- NULLIF(c_timestamp3, c_bigint),
- NULLIF(c_timestamp3, c_float),
- NULLIF(c_timestamp3, c_double),
- NULLIF(c_timestamp3, c_decimal103),
- NULLIF(c_timestamp3, c_varchar10),
- NULLIF(c_timestamp3, c_text),
- NULLIF(c_timestamp3, c_blob),
- NULLIF(c_timestamp3, c_enum),
- NULLIF(c_timestamp3, c_datetime3),
- NULLIF(c_timestamp3, c_timestamp3),
- NULLIF(c_timestamp3, c_date),
- NULLIF(c_timestamp3, c_time)
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE TABLE t2 AS SELECT
- NULLIF(c_date, 1),
- NULLIF(c_date, c_smallint),
- NULLIF(c_date, c_tinyint),
- NULLIF(c_date, c_int),
- NULLIF(c_date, c_bigint),
- NULLIF(c_date, c_float),
- NULLIF(c_date, c_double),
- NULLIF(c_date, c_decimal103),
- NULLIF(c_date, c_varchar10),
- NULLIF(c_date, c_text),
- NULLIF(c_date, c_blob),
- NULLIF(c_date, c_enum),
- NULLIF(c_date, c_datetime3),
- NULLIF(c_date, c_timestamp3),
- NULLIF(c_date, c_date),
- NULLIF(c_date, c_time)
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE TABLE t2 AS SELECT
- NULLIF(c_time, 1),
- NULLIF(c_time, c_smallint),
- NULLIF(c_time, c_tinyint),
- NULLIF(c_time, c_int),
- NULLIF(c_time, c_bigint),
- NULLIF(c_time, c_float),
- NULLIF(c_time, c_double),
- NULLIF(c_time, c_decimal103),
- NULLIF(c_time, c_varchar10),
- NULLIF(c_time, c_text),
- NULLIF(c_time, c_blob),
- NULLIF(c_time, c_enum),
- NULLIF(c_time, c_datetime3),
- NULLIF(c_time, c_timestamp3),
- NULLIF(c_time, c_date),
- NULLIF(c_time, c_time)
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
---echo #
---echo # Checking that the return type depends only on args[0], even if compared to a field
---echo #
-
-CREATE TABLE t2 AS SELECT
- NULLIF(1, 1),
- NULLIF(1, c_smallint),
- NULLIF(1, c_tinyint),
- NULLIF(1, c_int),
- NULLIF(1, c_bigint),
- NULLIF(1, c_float),
- NULLIF(1, c_double),
- NULLIF(1, c_decimal103),
- NULLIF(1, c_varchar10),
- NULLIF(1, c_text),
- NULLIF(1, c_blob),
- NULLIF(1, c_enum),
- NULLIF(1, c_datetime3),
- NULLIF(1, c_timestamp3),
- NULLIF(1, c_date),
- NULLIF(1, c_time)
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE TABLE t2 AS SELECT
- NULLIF(1.0, 1),
- NULLIF(1.0, c_smallint),
- NULLIF(1.0, c_tinyint),
- NULLIF(1.0, c_int),
- NULLIF(1.0, c_bigint),
- NULLIF(1.0, c_float),
- NULLIF(1.0, c_double),
- NULLIF(1.0, c_decimal103),
- NULLIF(1.0, c_varchar10),
- NULLIF(1.0, c_text),
- NULLIF(1.0, c_blob),
- NULLIF(1.0, c_enum),
- NULLIF(1.0, c_datetime3),
- NULLIF(1.0, c_timestamp3),
- NULLIF(1.0, c_date),
- NULLIF(1.0, c_time)
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE TABLE t2 AS SELECT
- NULLIF(1e0, 1),
- NULLIF(1e0, c_smallint),
- NULLIF(1e0, c_tinyint),
- NULLIF(1e0, c_int),
- NULLIF(1e0, c_bigint),
- NULLIF(1e0, c_float),
- NULLIF(1e0, c_double),
- NULLIF(1e0, c_decimal103),
- NULLIF(1e0, c_varchar10),
- NULLIF(1e0, c_text),
- NULLIF(1e0, c_blob),
- NULLIF(1e0, c_enum),
- NULLIF(1e0, c_datetime3),
- NULLIF(1e0, c_timestamp3),
- NULLIF(1e0, c_date),
- NULLIF(1e0, c_time)
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE TABLE t2 AS SELECT
- NULLIF('1', 1),
- NULLIF('1', c_smallint),
- NULLIF('1', c_tinyint),
- NULLIF('1', c_int),
- NULLIF('1', c_bigint),
- NULLIF('1', c_float),
- NULLIF('1', c_double),
- NULLIF('1', c_decimal103),
- NULLIF('1', c_varchar10),
- NULLIF('1', c_text),
- NULLIF('1', c_blob),
- NULLIF('1', c_enum),
- NULLIF('1', c_datetime3),
- NULLIF('1', c_timestamp3),
- NULLIF('1', c_date),
- NULLIF('1', c_time)
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE TABLE t2 AS SELECT
- NULLIF(TIME'10:10:10', 1),
- NULLIF(TIME'10:10:10', c_smallint),
- NULLIF(TIME'10:10:10', c_tinyint),
- NULLIF(TIME'10:10:10', c_int),
- NULLIF(TIME'10:10:10', c_bigint),
- NULLIF(TIME'10:10:10', c_float),
- NULLIF(TIME'10:10:10', c_double),
- NULLIF(TIME'10:10:10', c_decimal103),
- NULLIF(TIME'10:10:10', c_varchar10),
- NULLIF(TIME'10:10:10', c_text),
- NULLIF(TIME'10:10:10', c_blob),
- NULLIF(TIME'10:10:10', c_enum),
- NULLIF(TIME'10:10:10', c_datetime3),
- NULLIF(TIME'10:10:10', c_timestamp3),
- NULLIF(TIME'10:10:10', c_date),
- NULLIF(TIME'10:10:10', c_time)
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-7759 NULLIF(x,y) is not equal to CASE WHEN x=y THEN NULL ELSE x END
---echo #
-CREATE TABLE t1 (a YEAR);
-INSERT INTO t1 VALUES (2010),(2020);
-SELECT * FROM t1 WHERE a=2010 AND NULLIF(10.1,a) IS NULL;
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND NULLIF(10.1,a) IS NULL;
-SELECT * FROM t1 WHERE a=2010 AND CASE WHEN 10.1=a THEN NULL ELSE 10.1 END IS NULL;
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND CASE WHEN 10.1=a THEN NULL ELSE 10.1 END IS NULL;
-DROP TABLE t1;
-
---echo # Two warnings expected
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-CREATE TABLE t1 AS SELECT
- NULLIF(TIMESTAMP'2001-01-01 00:00:00',1) AS a,
- CASE WHEN TIMESTAMP'2001-01-01 00:00:00'=1 THEN NULL
- ELSE TIMESTAMP'2001-01-01 00:00:00'
- END AS b;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8785 Wrong results for EXPLAIN EXTENDED...WHERE NULLIF(latin1_col, _utf8'a' COLLATE utf8_bin) IS NOT NULL
---echo #
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
-INSERT INTO t1 VALUES ('a'),('A');
-SELECT a, NULLIF(a,_utf8'a' COLLATE utf8_bin) IS NULL FROM t1;
-SELECT CHARSET(NULLIF(a,_utf8'a' COLLATE utf8_bin)) FROM t1;
-EXPLAIN EXTENDED SELECT NULLIF(a,_utf8'a' COLLATE utf8_bin) IS NULL AS expr FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-8740 Wrong result for SELECT..WHERE year_field=10 AND NULLIF(year_field,2011.1)='2011'
---echo #
-CREATE TABLE t1 (a YEAR);
-INSERT INTO t1 VALUES (2010),(2011);
-SELECT a=10 AND NULLIF(a,2011.1)='2011' AS cond FROM t1;
-SELECT * FROM t1 WHERE a=10;
-SELECT * FROM t1 WHERE NULLIF(a,2011.1)='2011';
-SELECT * FROM t1 WHERE a=10 AND NULLIF(a,2011.1)='2011';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE a=10 AND NULLIF(a,2011.1)='2011';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE a=10 AND NULLIF(a,2011.1)=CONCAT('2011',RAND());
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-8754 Wrong result for SELECT..WHERE year_field=2020 AND NULLIF(year_field,2010)='2020'
---echo #
-CREATE TABLE t1 (a YEAR);
-INSERT INTO t1 VALUES (2010),(2020);
-SELECT * FROM t1 WHERE a=2020;
-SELECT * FROM t1 WHERE NULLIF(a,2010)='2020';
-SELECT * FROM t1 WHERE a=2020 AND NULLIF(a,2010)='2020';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE a=2020 AND NULLIF(a,2010)='2020';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE a=2020 AND NULLIF(a,2010)=CONCAT('2020',RAND());
-DROP TABLE t1;
-
---echo #
---echo # MDEV-9181 (NULLIF(count(table.col)), 0) gives wrong result on 10.1.x
---echo #
-CREATE TABLE t1 (c1 varchar(50) DEFAULT NULL);
-INSERT INTO t1 (c1) VALUES ('hello'), ('hello\r\n'), ('hello'),('hello');
-SELECT NULLIF(COUNT(c1),0) FROM t1;
-SELECT CASE WHEN COUNT(c1)=0 THEN NULL ELSE COUNT(c1) END FROM t1;
-SELECT NULLIF(COUNT(c1)+0,0) AS c1,NULLIF(CAST(COUNT(c1) AS SIGNED),0) AS c2,NULLIF(CONCAT(COUNT(c1)),0) AS c3 FROM t1;
-SELECT NULLIF(COUNT(DISTINCT c1),0) FROM t1;
-SELECT CASE WHEN COUNT(DISTINCT c1)=0 THEN NULL ELSE COUNT(DISTINCT c1) END FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (
- id INT NOT NULL,
- c1 INT DEFAULT NULL
-);
-INSERT INTO t1 VALUES (1,1),(1,2),(2,3),(2,4);
-SELECT NULLIF(COUNT(c1),0) AS c1,NULLIF(COUNT(c1)+0,0) AS c1_wrapped,CASE WHEN COUNT(c1) IS NULL THEN 0 ELSE COUNT(c1) END AS c1_case FROM t1 GROUP BY id;
-DROP TABLE t1;
-
-# Testing with side effects
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1),(2),(3);
-SET @a=0;
-SELECT NULLIF(LAST_VALUE(@a:=@a+1,a),0) FROM t1;
-SELECT @a;
-SET @a=0;
-SELECT NULLIF(AVG(a),0), NULLIF(AVG(LAST_VALUE(@a:=@a+1,a)),0) FROM t1;
-SELECT @a;
-
-# There should not be cache in here:
-
-EXPLAIN EXTENDED SELECT NULLIF(a,0) FROM t1;
-
-# But there should be a cache in here:
-EXPLAIN EXTENDED SELECT NULLIF(AVG(a),0) FROM t1;
-
-DROP TABLE t1;
-
-#
-# MDEV-9576 syntax error on view with nullif and count
-#
-create table t1 (col1 varchar(50));
-create view v1 AS select nullif(count(distinct col1),0) from t1;
-show create view v1;
-drop view v1;
-drop table t1;
-
-#
-# MDEV-9637 select nullif(count(col1),0) gives wrong result if in a view
-#
-create table t1 (col1 varchar(50) default null);
-insert into t1 (col1) values ('hello'), ('hello'), ('hello');
-create view v1 as select nullif(count(col1),0) from t1;
-select * from v1;
-select nullif(count(col1),0) from t1;
-drop view v1;
-drop table t1;
-
-#
-# MDEV-9644 Assertion `args[0] == args[2] || thd->stmt_arena->is_stmt_execute()' failed in Item_func_nullif::fix_length_and_dec()
-#
-select nullif((select 1), (select 2));
-create table t1 (f int);
-insert into t1 values (1),(2);
-select nullif( not f, 1 ) from t1;
-drop table t1;
-
-#
-# MDEV-9641 Assertion `args[0] == args[2] || _current_thd()->lex->context_analysis_only' failed in Item_func_nullif::print(String*, enum_query_type)
-#
-set names utf8;
-create table t1 (f1 varchar(10));
-insert into t1 values ('2015-12-31');
---error ER_DATA_OUT_OF_RANGE
-select power( timestamp( nullif( '2002-09-08', f1 ) ), 24 ) from t1;
-drop table t1;
-
-#
-# MDEV-9682 Assertion `0' failed in Item_cache_row::illegal_method_call on 2nd execution of PS with NULLIF
-#
-CREATE TABLE t1 (f1 INT);
-INSERT INTO t1 VALUES (1),(2);
-PREPARE stmt FROM "SELECT * FROM t1 WHERE NULLIF( ( 1, 2 ) IN ( SELECT 3, 4 ), 1 )";
-EXECUTE stmt;
-EXECUTE stmt;
-DROP TABLE t1;
-
-#
-# MDEV-9683 Server crashes in Item::basic_const_item on numerous nested NULLIFs
-#
-CREATE TABLE t1 (i INT);
-INSERT INTO t1 VALUES (1),(2);
-SELECT * FROM t1 WHERE NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(i = ROUND(0), 14), 13), 12), 11), 10), 9), 8), 7), 6), 5), 4), 3), 2), 1);
-DROP TABLE t1;
-
---echo #
---echo # MDEV-10347 mysqld got signal 11
---echo #
-
-CREATE TABLE t1 (f1 VARCHAR(10), f2 VARCHAR(40));
-CREATE TABLE t2 (f3 VARCHAR(20));
-PREPARE stmt FROM "
- SELECT (
- SELECT IFNULL(f3,4) FROM t2
- WHERE IFNULL(NULLIF(f1,''),1)
- ) AS sq
- FROM t1
- GROUP BY f2
-";
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-DROP TABLE t2,t1;
-
---echo #
---echo # MDEV-10236 Where expression with NOT function gives incorrect result
---echo #
-CREATE TABLE t1 (c1 INT);
-INSERT INTO t1 VALUES (1),(2),(3);
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE ((c1 IS NOT NULL) >= (NOT TRUE)) IS NOT NULL;
-SELECT * FROM t1 WHERE ((c1 IS NOT NULL) >= (NOT TRUE)) IS NOT NULL;
-DROP TABLE t1;
-
-
---echo #
---echo # End of 10.1 tests
---echo #
diff --git a/mysql-test/t/null_key.test b/mysql-test/t/null_key.test
deleted file mode 100644
index c3ebc6f5b94..00000000000
--- a/mysql-test/t/null_key.test
+++ /dev/null
@@ -1,278 +0,0 @@
-#
-# Check null keys
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-create table t1 (a int, b int not null,unique key (a,b),index(b)) engine=myisam;
-insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6);
-explain select * from t1 where a is null;
-explain select * from t1 where a is null and b = 2;
-explain select * from t1 where a is null and b = 7;
-explain select * from t1 where a=2 and b = 2;
-explain select * from t1 where a<=>b limit 2;
-explain select * from t1 where (a is null or a > 0 and a < 3) and b < 5 limit 3;
-explain select * from t1 where (a is null or a = 7) and b=7;
-explain select * from t1 where (a is null or a = 7) and b=7 order by a;
-explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2;
-explain select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
-explain select * from t1 where a > 1 and a < 3 limit 1;
-explain select * from t1 where a > 8 and a < 9;
-select * from t1 where a is null;
-select * from t1 where a is null and b = 7;
-select * from t1 where a<=>b limit 2;
-select * from t1 where (a is null or a > 0 and a < 3) and b < 5 limit 3;
-select * from t1 where (a is null or a > 0 and a < 3) and b > 7 limit 3;
-select * from t1 where (a is null or a = 7) and b=7;
-select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
-select * from t1 where a > 1 and a < 3 limit 1;
-select * from t1 where a > 8 and a < 9;
-create table t2 like t1;
-insert into t2 select * from t1;
-alter table t1 modify b blob not null, add c int not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10));
-explain select * from t1 where a is null and b = 2;
-explain select * from t1 where a is null and b = 2 and c=0;
-explain select * from t1 where a is null and b = 7 and c=0;
-explain select * from t1 where a=2 and b = 2;
-explain select * from t1 where a<=>b limit 2;
-explain select * from t1 where (a is null or a > 0 and a < 3) and b < 5 and c=0 limit 3;
-explain select * from t1 where (a is null or a = 7) and b=7 and c=0;
-explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2;
-explain select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
-explain select * from t1 where a > 1 and a < 3 limit 1;
-explain select * from t1 where a is null and b=7 or a > 1 and a < 3 limit 1;
-explain select * from t1 where a > 8 and a < 9;
-explain select * from t1 where b like "6%";
-select * from t1 where a is null;
-select * from t1 where a is null and b = 7 and c=0;
-select * from t1 where a<=>b limit 2;
-select * from t1 where (a is null or a > 0 and a < 3) and b < 5 limit 3;
-select * from t1 where (a is null or a > 0 and a < 3) and b > 7 limit 3;
-select * from t1 where (a is null or a = 7) and b=7 and c=0;
-select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
-select * from t1 where b like "6%";
-
-#
-# Test ref_or_null optimization
-#
-drop table t1;
-rename table t2 to t1;
-alter table t1 modify b int null;
-insert into t1 values (7,null), (8,null), (8,7);
-explain select * from t1 where a = 7 and (b=7 or b is null);
-select * from t1 where a = 7 and (b=7 or b is null);
-explain select * from t1 where (a = 7 or a is null) and (b=7 or b is null);
-select * from t1 where (a = 7 or a is null) and (b=7 or b is null);
-explain select * from t1 where (a = 7 or a is null) and (a = 7 or a is null);
-select * from t1 where (a = 7 or a is null) and (a = 7 or a is null);
-create table t2 (a int);
-insert into t2 values (7),(8);
-explain select * from t2 straight_join t1 where t1.a=t2.a and b is null;
-drop index b on t1;
-explain select * from t2,t1 where t1.a=t2.a and b is null;
-select * from t2,t1 where t1.a=t2.a and b is null;
-explain select * from t2,t1 where t1.a=t2.a and (b= 7 or b is null);
-select * from t2,t1 where t1.a=t2.a and (b= 7 or b is null);
-explain select * from t2,t1 where (t1.a=t2.a or t1.a is null) and b= 7;
-select * from t2,t1 where (t1.a=t2.a or t1.a is null) and b= 7;
-explain select * from t2,t1 where (t1.a=t2.a or t1.a is null) and (b= 7 or b is null);
-select * from t2,t1 where (t1.a=t2.a or t1.a is null) and (b= 7 or b is null);
-insert into t2 values (null),(6);
-delete from t1 where a=8;
-explain select * from t2,t1 where t1.a=t2.a or t1.a is null;
-explain select * from t2,t1 where t1.a<=>t2.a or (t1.a is null and t1.b <> 9);
-select * from t2,t1 where t1.a<=>t2.a or (t1.a is null and t1.b <> 9);
-drop table t1,t2;
-
-#
-# The following failed for Matt Loschert
-#
-
-CREATE TABLE t1 (
- id int(10) unsigned NOT NULL auto_increment,
- uniq_id int(10) unsigned default NULL,
- PRIMARY KEY (id),
- UNIQUE KEY idx1 (uniq_id)
-) ENGINE=MyISAM;
-
-CREATE TABLE t2 (
- id int(10) unsigned NOT NULL auto_increment,
- uniq_id int(10) unsigned default NULL,
- PRIMARY KEY (id)
-) ENGINE=MyISAM;
-
-INSERT INTO t1 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL);
-INSERT INTO t2 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL);
-
-#
-# Check IS NULL optimization
-#
-explain select id from t1 where uniq_id is null;
-explain select id from t1 where uniq_id =1;
-#
-# Check updates
-#
-UPDATE t1 SET id=id+100 where uniq_id is null;
-UPDATE t2 SET id=id+100 where uniq_id is null;
-select id from t1 where uniq_id is null;
-select id from t2 where uniq_id is null;
-#
-# Delete all records from each table where the uniq_id field is null
-#
-DELETE FROM t1 WHERE uniq_id IS NULL;
-DELETE FROM t2 WHERE uniq_id IS NULL;
-#
-# Select what is left -- notice the difference
-#
-SELECT * FROM t1 ORDER BY uniq_id, id;
-SELECT * FROM t2 ORDER BY uniq_id, id;
-DROP table t1,t2;
-
-#
-# This crashed MySQL 3.23.47
-#
-
-CREATE TABLE `t1` (
- `order_id` char(32) NOT NULL default '',
- `product_id` char(32) NOT NULL default '',
- `product_type` int(11) NOT NULL default '0',
- PRIMARY KEY (`order_id`,`product_id`,`product_type`)
-) ENGINE=MyISAM;
-CREATE TABLE `t2` (
- `order_id` char(32) NOT NULL default '',
- `product_id` char(32) NOT NULL default '',
- `product_type` int(11) NOT NULL default '0',
- PRIMARY KEY (`order_id`,`product_id`,`product_type`)
-) ENGINE=MyISAM;
-INSERT INTO t1 (order_id, product_id, product_type) VALUES
-('3d7ce39b5d4b3e3d22aaafe9b633de51',1206029, 3),
-('3d7ce39b5d4b3e3d22aaafe9b633de51',5880836, 3),
-('9d9aad7764b5b2c53004348ef8d34500',2315652, 3);
-INSERT INTO t2 (order_id, product_id, product_type) VALUES
-('9d9aad7764b5b2c53004348ef8d34500',2315652, 3);
-
-select t1.* from t1
-left join t2 using(order_id, product_id, product_type)
-where t2.order_id=NULL;
-select t1.* from t1
-left join t2 using(order_id, product_id, product_type)
-where t2.order_id is NULL;
-drop table t1,t2;
-
-#
-# The last select returned wrong results in 3.23.52
-#
-
-create table t1 (id int);
-insert into t1 values (null), (0);
-create table t2 (id int);
-insert into t2 values (null);
-select * from t1, t2 where t1.id = t2.id;
-alter table t1 add key id (id);
-select * from t1, t2 where t1.id = t2.id;
-drop table t1,t2;
-
-#
-# Check bug when doing <=> NULL on an indexed null field
-#
-
-create table t1 (
- id integer,
- id2 integer not null,
- index (id),
- index (id2)
-);
-insert ignore into t1 values(null,null),(1,1);
-select * from t1;
-select * from t1 where id <=> null;
-select * from t1 where id <=> null or id > 0;
-select * from t1 where id is null or id > 0;
-select * from t1 where id2 <=> null or id2 > 0;
-select * from t1 where id2 is null or id2 > 0;
-delete from t1 where id <=> NULL;
-select * from t1;
-drop table t1;
-
-#
-# Test for bug #12144: optimizations for key access with null keys
-# used for outer joins
-#
-
-CREATE TABLE t1 (a int);
-CREATE TABLE t2 (a int, b int, INDEX idx(a));
-CREATE TABLE t3 (b int, INDEX idx(b));
-CREATE TABLE t4 (b int, INDEX idx(b));
-INSERT INTO t1 VALUES (1), (2), (3), (4);
-INSERT INTO t2 VALUES (1, 1), (3, 1);
-INSERT INTO t3 VALUES
- (NULL), (NULL), (NULL), (NULL), (NULL),
- (NULL), (NULL), (NULL), (NULL), (NULL);
-INSERT INTO t4 SELECT * FROM t3;
-INSERT INTO t3 SELECT * FROM t4;
-INSERT INTO t4 SELECT * FROM t3;
-INSERT INTO t3 SELECT * FROM t4;
-INSERT INTO t4 SELECT * FROM t3;
-INSERT INTO t3 SELECT * FROM t4;
-INSERT INTO t4 SELECT * FROM t3;
-INSERT INTO t3 SELECT * FROM t4;
-INSERT INTO t4 SELECT * FROM t3;
-INSERT INTO t3 SELECT * FROM t4;
-INSERT INTO t4 SELECT * FROM t3;
-INSERT INTO t3 SELECT * FROM t4;
-INSERT INTO t4 SELECT * FROM t3;
-INSERT INTO t3 SELECT * FROM t4;
-INSERT INTO t4 SELECT * FROM t3;
-INSERT INTO t3 SELECT * FROM t4;
-INSERT INTO t3 VALUES (2), (3);
-
-ANALYZE table t1, t2, t3;
-
-SELECT COUNT(*) FROM t3;
-
-EXPLAIN SELECT SQL_CALC_FOUND_ROWS * FROM t1 LEFT JOIN t2 ON t1.a=t2.a
- LEFT JOIN t3 ON t2.b=t3.b;
-FLUSH STATUS ;
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 LEFT JOIN t2 ON t1.a=t2.a
- LEFT JOIN t3 ON t2.b=t3.b;
-SELECT FOUND_ROWS();
-SHOW STATUS LIKE "handler_read%";
-
-DROP TABLE t1,t2,t3,t4;
-# End of 4.1 tests
-
-#
-# BUG#34945 "ref_or_null queries that are null_rejecting and have a null value crash mysql"
-#
-CREATE TABLE t1 (
- a int(11) default NULL,
- b int(11) default NULL,
- KEY a (a,b)
-);
-INSERT INTO t1 VALUES (0,10),(0,11),(0,12);
-
-CREATE TABLE t2 (
- a int(11) default NULL,
- b int(11) default NULL,
- KEY a (a)
-);
-INSERT INTO t2 VALUES (3,NULL),(3,11),(3,12);
-
-SELECT * FROM t2 inner join t1 WHERE ( t1.a = 0 OR t1.a IS NULL) AND t2.a = 3 AND t2.b = t1.b;
-
-drop table t1, t2;
--- echo End of 5.0 tests
-
---echo #
---echo # BUG#727667 Wrong result with OR + NOT NULL in maria-5.3
---echo #
-
-CREATE TABLE t1 (
- f3 int(11),
- f10 varchar(1),
- KEY (f3)
-);
-INSERT INTO t1 VALUES ('9','k'),(NULL,'r');
-SELECT * FROM t1 WHERE (f3 = 83) OR (f10 = 'z' AND f3 IS NULL);
-DROP TABLE t1;
-
diff --git a/mysql-test/t/odbc.test b/mysql-test/t/odbc.test
deleted file mode 100644
index f1d60e15bc8..00000000000
--- a/mysql-test/t/odbc.test
+++ /dev/null
@@ -1,38 +0,0 @@
-# Initialise
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-set @@session.sql_auto_is_null=1;
-
-#
-# Test some ODBC compatibility
-#
-
-select {fn length("hello")}, { date "1997-10-20" };
-
-#
-# Test retreiving row with last insert_id value.
-#
-
-create table t1 (a int not null auto_increment,b int not null,primary key (a,b));
-insert into t1 SET A=NULL,B=1;
-insert into t1 SET a=null,b=2;
-select * from t1 where a is null and b=2;
-select * from t1 where a is null;
-explain select * from t1 where b is null;
-drop table t1;
-
-#
-# Bug #14553: NULL in WHERE resets LAST_INSERT_ID
-#
-CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY);
-INSERT INTO t1 VALUES (NULL);
-SELECT sql_no_cache a, last_insert_id() FROM t1 WHERE a IS NULL;
-SELECT sql_no_cache a, last_insert_id() FROM t1 WHERE a IS NULL;
-SELECT sql_no_cache a, last_insert_id() FROM t1;
-DROP TABLE t1;
-
-# End of 4.1 tests
-
-set @@session.sql_auto_is_null=default;
diff --git a/mysql-test/t/olap.test b/mysql-test/t/olap.test
deleted file mode 100644
index 3da08581a87..00000000000
--- a/mysql-test/t/olap.test
+++ /dev/null
@@ -1,449 +0,0 @@
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-set @sav_dpi= @@div_precision_increment;
-set div_precision_increment= 5;
-show variables like 'div_precision_increment';
-
-create table t1 (product varchar(32), country_id int not null, year int, profit int);
-insert into t1 values ( 'Computer', 2,2000, 1200),
-( 'TV', 1, 1999, 150),
-( 'Calculator', 1, 1999,50),
-( 'Computer', 1, 1999,1500),
-( 'Computer', 1, 2000,1500),
-( 'TV', 1, 2000, 150),
-( 'TV', 2, 2000, 100),
-( 'TV', 2, 2000, 100),
-( 'Calculator', 1, 2000,75),
-( 'Calculator', 2, 2000,75),
-( 'TV', 1, 1999, 100),
-( 'Computer', 1, 1999,1200),
-( 'Computer', 2, 2000,1500),
-( 'Calculator', 2, 2000,75),
-( 'Phone', 3, 2003,10)
-;
-
-create table t2 (country_id int primary key, country char(20) not null);
-insert into t2 values (1, 'USA'),(2,'India'), (3,'Finland');
-
-# First simple rollups, with just grand total
-select product, sum(profit) from t1 group by product;
-select product, sum(profit) from t1 group by product with rollup;
-select product, sum(profit) from t1 group by 1 with rollup;
-select product, sum(profit),avg(profit) from t1 group by product with rollup;
-
-# Sub totals
-select product, country_id , year, sum(profit) from t1 group by product, country_id, year;
-select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup;
-explain extended select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup;
-select product, country_id , sum(profit) from t1 group by product desc, country_id with rollup;
-
-# limit
-select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup limit 5;
-select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup limit 3,3;
-
-select product, country_id, count(*), count(distinct year) from t1 group by product, country_id;
-select product, country_id, count(*), count(distinct year) from t1 group by product, country_id with rollup;
-
-# Test of having
-select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup having country_id = 1;
-select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup having sum(profit) > 200;
-select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup having sum(profit) > 7000;
-
-# Functions
-select concat(product,':',country_id) as 'prod', concat(":",year,":") as 'year',1+1, sum(profit)/count(*) from t1 group by 1,2 with rollup;
-select product, sum(profit)/count(*) from t1 group by product with rollup;
-select left(product,4) as prod, sum(profit)/count(*) from t1 group by prod with rollup;
-select concat(product,':',country_id), 1+1, sum(profit)/count(*) from t1 group by concat(product,':',country_id) with rollup;
-
-# Joins
-select product, country , year, sum(profit) from t1,t2 where t1.country_id=t2.country_id group by product, country, year with rollup;
-
-# Derived tables and sub selects
-select product, `sum` from (select product, sum(profit) as 'sum' from t1 group by product with rollup) as tmp where product is null;
-select product from t1 where exists (select product, country_id , sum(profit) from t1 as t2 where t1.product=t2.product group by product, country_id with rollup having sum(profit) > 6000);
-
-# The following doesn't return the expected answer, but this is a limitation
-# in the implementation so we should just document it
-select product, country_id , year, sum(profit) from t1 group by product, country_id, year having country_id is NULL;
-select concat(':',product,':'), sum(profit),avg(profit) from t1 group by product with rollup;
-
-# Error handling
-
-# Cube is not yet implemented
---error 1235
-select product, country_id , year, sum(profit) from t1 group by product, country_id, year with cube;
---error 1235
-explain select product, country_id , year, sum(profit) from t1 group by product, country_id, year with cube;
---error 1235
-select product, country_id , year, sum(profit) from t1 group by product, country_id, year with cube union all select product, country_id , year, sum(profit) from t1 group by product, country_id, year with rollup;
-
-drop table t1,t2;
-
-#
-# Test bug with const tables
-#
-
-CREATE TABLE t1 (i int);
-INSERT INTO t1 VALUES(100);
-CREATE TABLE t2 (i int);
-INSERT INTO t2 VALUES (100),(200);
-SELECT i, COUNT(*) FROM t1 GROUP BY i WITH ROLLUP;
-SELECT t1.i, t2.i, COUNT(*) FROM t1,t2 GROUP BY t1.i,t2.i WITH ROLLUP;
-drop table t1,t2;
-
-#bug #4767: ROLLUP with LEFT JOIN
-
-CREATE TABLE user_day(
- user_id INT NOT NULL,
- date DATE NOT NULL,
- UNIQUE INDEX user_date (user_id, date)
-);
-
-INSERT INTO user_day VALUES
- (1, '2004-06-06' ),
- (1, '2004-06-07' ),
- (2, '2004-06-06' );
-
-SELECT
- d.date AS day,
- COUNT(d.user_id) as sample,
- COUNT(next_day.user_id) AS not_cancelled
- FROM user_day d
- LEFT JOIN user_day next_day
- ON next_day.user_id=d.user_id AND
- next_day.date= DATE_ADD( d.date, interval 1 day )
- GROUP BY day;
-
-SELECT
- d.date AS day,
- COUNT(d.user_id) as sample,
- COUNT(next_day.user_id) AS not_cancelled
- FROM user_day d
- LEFT JOIN user_day next_day
- ON next_day.user_id=d.user_id AND
- next_day.date= DATE_ADD( d.date, interval 1 day )
- GROUP BY day
- WITH ROLLUP;
-
-DROP TABLE user_day;
-
-#
-# Tests for bugs #8616, #8615: distinct sum with rollup
-#
-
-CREATE TABLE t1 (a int, b int);
-
-INSERT INTO t1 VALUES
- (1,4),
- (2,2), (2,2),
- (4,1), (4,1), (4,1), (4,1),
- (2,1), (2,1);
-
-SELECT SUM(b) FROM t1 GROUP BY a WITH ROLLUP;
-SELECT DISTINCT SUM(b) FROM t1 GROUP BY a WITH ROLLUP;
-
-SELECT SUM(b), COUNT(DISTINCT b) FROM t1 GROUP BY a WITH ROLLUP;
-SELECT DISTINCT SUM(b), COUNT(DISTINCT b) FROM t1 GROUP BY a WITH ROLLUP;
-
-SELECT SUM(b), COUNT(*) FROM t1 GROUP BY a WITH ROLLUP;
-SELECT DISTINCT SUM(b), COUNT(*) FROM t1 GROUP BY a WITH ROLLUP;
-
-SELECT SUM(b), COUNT(DISTINCT b), COUNT(*) FROM t1 GROUP BY a WITH ROLLUP;
-SELECT DISTINCT SUM(b), COUNT(DISTINCT b), COUNT(*) FROM t1
- GROUP BY a WITH ROLLUP;
-
-SELECT a, sum(b) FROM t1 GROUP BY a,b WITH ROLLUP;
-SELECT DISTINCT a, sum(b) FROM t1 GROUP BY a,b WITH ROLLUP;
-
-SELECT b, a, sum(b) FROM t1 GROUP BY a,b WITH ROLLUP;
-SELECT DISTINCT b,a, sum(b) FROM t1 GROUP BY a,b WITH ROLLUP;
-
-ALTER TABLE t1 ADD COLUMN c INT;
-SELECT a,b,sum(c) FROM t1 GROUP BY a,b,c WITH ROLLUP;
-SELECT distinct a,b,sum(c) FROM t1 GROUP BY a,b,c WITH ROLLUP;
-
-DROP TABLE t1;
-
-#
-# Tests for bugs #8617: SQL_CACL_FOUND_ROWS with rollup and limit
-#
-
-CREATE TABLE t1 (a int, b int);
-
-INSERT INTO t1 VALUES
- (1,4),
- (2,2), (2,2),
- (4,1), (4,1), (4,1), (4,1),
- (2,1), (2,1);
-
-SELECT a, SUM(b) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1;
-SELECT SQL_CALC_FOUND_ROWS a, SUM(b) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1;
-
-DROP TABLE t1;
-
-#
-# Tests for bug #9681: ROLLUP in subquery for derived table wiht
-# a group by field declared as NOT NULL
-#
-
-CREATE TABLE t1 (a int(11) NOT NULL);
-INSERT INTO t1 VALUES (1),(2);
-
-SELECT a, SUM(a) m FROM t1 GROUP BY a WITH ROLLUP;
-SELECT * FROM ( SELECT a, SUM(a) m FROM t1 GROUP BY a WITH ROLLUP ) t2;
-
-DROP TABLE t1;
-set div_precision_increment= @sav_dpi;
-
-#
-# Tests for bug #7914: ROLLUP over expressions on temporary table
-#
-
-CREATE TABLE t1 (a int(11));
-INSERT INTO t1 VALUES (1),(2);
-
-SELECT a, SUM(a), SUM(a)+1 FROM (SELECT a FROM t1 UNION select 2) d
- GROUP BY a;
-SELECT a, SUM(a), SUM(a)+1 FROM (SELECT a FROM t1 UNION select 2) d
- GROUP BY a WITH ROLLUP;
-
-SELECT a, SUM(a), SUM(a)+1 FROM (SELECT 1 a UNION select 2) d
- GROUP BY a;
-SELECT a, SUM(a), SUM(a)+1 FROM (SELECT 1 a UNION select 2) d
- GROUP BY a WITH ROLLUP;
-
-SELECT a, SUM(a), SUM(a)+1, CONCAT(SUM(a),'x'), SUM(a)+SUM(a), SUM(a)
- FROM (SELECT 1 a, 2 b UNION SELECT 2,3 UNION SELECT 5,6 ) d
- GROUP BY a WITH ROLLUP;
-
-DROP TABLE t1;
-
-#
-# Tests for bug #7894: ROLLUP over expressions on group by attributes
-#
-
-CREATE TABLE t1 (a int(11));
-INSERT INTO t1 VALUES (1),(2);
-
-SELECT a, a+1, SUM(a) FROM t1 GROUP BY a WITH ROLLUP;
-SELECT a+1 FROM t1 GROUP BY a WITH ROLLUP;
-SELECT a+SUM(a) FROM t1 GROUP BY a WITH ROLLUP;
-SELECT a, a+1 as b FROM t1 GROUP BY a WITH ROLLUP HAVING b > 2;
-SELECT a, a+1 as b FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NULL;
-SELECT a, a+1 as b FROM t1 GROUP BY a WITH ROLLUP HAVING b IS NULL;
-SELECT IFNULL(a, 'TEST') FROM t1 GROUP BY a WITH ROLLUP;
-
-CREATE TABLE t2 (a int, b int);
-INSERT INTO t2 VALUES
- (1,4),
- (2,2), (2,2),
- (4,1), (4,1), (4,1), (4,1),
- (2,1), (2,1);
-
-SELECT a,b,SUM(b) FROM t2 GROUP BY a,b WITH ROLLUP;
-SELECT a,b,SUM(b), a+b as c FROM t2
- GROUP BY a,b WITH ROLLUP HAVING c IS NULL;
-SELECT IFNULL(a, 'TEST'), COALESCE(b, 'TEST') FROM t2
- GROUP BY a, b WITH ROLLUP;
-
-DROP TABLE t1,t2;
-
-#
-# Test for bug #11543: ROLLUP query with a repeated column in GROUP BY
-#
-
-CREATE TABLE t1 (a INT(10) NOT NULL, b INT(10) NOT NULL);
-INSERT INTO t1 VALUES (1, 1);
-INSERT INTO t1 VALUES (1, 2);
-
-SELECT a, b, a AS c, COUNT(*) AS count FROM t1 GROUP BY a, b, c WITH ROLLUP;
-
-DROP TABLE t1;
-
-# Bug #12885(1): derived table specified by a subquery with
-# ROLLUP over expressions on not nullable group by attributes
-#
-
-CREATE TABLE t1 (a int(11) NOT NULL);
-INSERT INTO t1 VALUES (1),(2);
-
-SELECT * FROM (SELECT a, a + 1, COUNT(*) FROM t1 GROUP BY a WITH ROLLUP) t;
-SELECT * FROM (SELECT a, LENGTH(a), COUNT(*) FROM t1 GROUP BY a WITH ROLLUP) t;
-
-DROP TABLE t1;
-
-#
-# Bug #12887 Distinct is not always applied after rollup
-#
-create table t1 ( a varchar(9), b int );
-insert into t1 values('a',1),(null,2);
-select a, max(b) from t1 group by a with rollup;
-select distinct a, max(b) from t1 group by a with rollup;
-drop table t1;
-
-#
-# Bug #20825: rollup puts non-equal values together
-#
-create table t1 (a varchar(22) not null , b int);
-insert into t1 values ("2006-07-01 21:30", 1), ("2006-07-01 23:30", 10);
-select left(a,10), a, sum(b) from t1 group by 1,2 with rollup;
-select left(a,10) x, a, sum(b) from t1 group by x,a with rollup;
-drop table t1;
-
-#
-# Bug #24856: ROLLUP by const item in a query with DISTINCT
-#
-
-CREATE TABLE t1 (a int, b int);
-INSERT INTO t1
- VALUES (2,10),(3,30),(2,40),(1,10),(2,30),(1,20),(2,10);
-
-SELECT a, SUM(b) FROM t1 GROUP BY a WITH ROLLUP;
-SELECT DISTINCT a, SUM(b) FROM t1 GROUP BY a WITH ROLLUP;
-SELECT a, b, COUNT(*) FROM t1 GROUP BY a,b WITH ROLLUP;
-SELECT DISTINCT a, b, COUNT(*) FROM t1 GROUP BY a,b WITH ROLLUP;
-
-SELECT 'x', a, SUM(b) FROM t1 GROUP BY 1,2 WITH ROLLUP;
-SELECT DISTINCT 'x', a, SUM(b) FROM t1 GROUP BY 1,2 WITH ROLLUP;
-SELECT DISTINCT 'x', a, SUM(b) FROM t1 GROUP BY 1,2 WITH ROLLUP;
-
-DROP TABLE t1;
-
-# End of 4.1 tests
-
-#
-# Tests for bug #11639: ROLLUP over view executed through filesort
-#
-
-CREATE TABLE t1(id int, type char(1));
-INSERT INTO t1 VALUES
- (1,"A"),(2,"C"),(3,"A"),(4,"A"),(5,"B"),
- (6,"B"),(7,"A"),(8,"C"),(9,"A"),(10,"C");
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-SELECT type FROM t1 GROUP BY type WITH ROLLUP;
-SELECT type FROM v1 GROUP BY type WITH ROLLUP;
-EXPLAIN SELECT type FROM v1 GROUP BY type WITH ROLLUP;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-#
-# Bug #12885(2): view specified by a subquery with
-# ROLLUP over expressions on not nullable group by attributes
-#
-
-CREATE TABLE t1 (a int(11) NOT NULL);
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE VIEW v1 AS
- SELECT a, LENGTH(a), COUNT(*) FROM t1 GROUP BY a WITH ROLLUP;
-
-DESC v1;
-SELECT * FROM v1;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-#
-# Bug #26830: derived table with ROLLUP
-#
-
-CREATE TABLE t1 (a int, KEY (a));
-INSERT INTO t1 VALUES (3), (1), (4), (1), (3), (1), (1);
-
-SELECT * FROM (SELECT a, SUM(a) FROM t1 GROUP BY a WITH ROLLUP) as t;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug#31095: Unexpected NULL constant caused server crash.
---echo #
-create table t1(a int);
-insert into t1 values (1),(2),(3);
-select count(a) from t1 group by null with rollup;
-drop table t1;
---echo ##############################################################
-
-#
-# Bug #32558: group by null-returning expression with rollup causes crash
-#
-CREATE TABLE t1(a INT);
-INSERT INTO t1 VALUES(0);
-SELECT 1 FROM t1 GROUP BY (DATE(NULL)) WITH ROLLUP;
-DROP TABLE t1;
-
---echo #
---echo # Bug #48131: crash group by with rollup, distinct,
---echo # filesort, with temporary tables
---echo #
-
-CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY);
-INSERT INTO t1 VALUES (1), (2);
-CREATE TABLE t2 (b INT);
-INSERT INTO t2 VALUES (100);
-
-SELECT a, b FROM t1, t2 GROUP BY a, b WITH ROLLUP;
-SELECT DISTINCT b FROM t1, t2 GROUP BY a, b WITH ROLLUP;
-
-DROP TABLE t1, t2;
-
---echo #
---echo # Bug #48475: DISTINCT is ignored with GROUP BY WITH ROLLUP
---echo # and only const tables
-
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (b INT);
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (1);
-
-SELECT DISTINCT b FROM t1, t2 GROUP BY a, b WITH ROLLUP;
-
-DROP TABLE t1, t2;
-
---echo End of 5.0 tests
-
---echo #
---echo # Start of 10.3 tests
---echo #
-
---echo #
---echo # MDEV-12886 Different default for INT and BIGINT column in a VIEW for a SELECT with ROLLUP
---echo #
-
-CREATE TABLE t1 (a int(11) NOT NULL);
-INSERT INTO t1 VALUES (1),(2);
-CREATE OR REPLACE VIEW v1 AS SELECT a, LENGTH(a), COUNT(*) FROM t1 GROUP BY a WITH ROLLUP;
-DESCRIBE v1;
-DROP VIEW v1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a bigint(11) NOT NULL);
-INSERT INTO t1 VALUES (1),(2);
-CREATE OR REPLACE VIEW v1 AS SELECT a, LENGTH(a), COUNT(*) FROM t1 GROUP BY a WITH ROLLUP;
-DESCRIBE v1;
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-9410 VIEW over a ROLLUP query reports too large columns
---echo #
-
-CREATE TABLE t1 (a int(10) NOT NULL, b int(20) NOT NULL);
-INSERT INTO t1 VALUES (1,1),(2,2);
-
-CREATE VIEW v1 AS SELECT a,b FROM t1;
-DESC v1;
-DROP VIEW v1;
-
-CREATE VIEW v1 AS SELECT a, b FROM t1 GROUP BY a,b;
-DESC v1;
-DROP VIEW v1;
-
-CREATE VIEW v1 AS SELECT a, b FROM t1 GROUP BY a,b WITH ROLLUP;
-DESC v1;
-DROP VIEW v1;
-
-DROP TABLE t1;
diff --git a/mysql-test/t/old-mode-master.opt b/mysql-test/t/old-mode-master.opt
deleted file mode 100644
index 840ee0dedcf..00000000000
--- a/mysql-test/t/old-mode-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---old=1
diff --git a/mysql-test/t/old-mode.test b/mysql-test/t/old-mode.test
deleted file mode 100644
index d7e8ce8ee55..00000000000
--- a/mysql-test/t/old-mode.test
+++ /dev/null
@@ -1,121 +0,0 @@
-#
-# Test 'old' mode
-#
-
-# Initialise
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-create table t1 (a int, b varchar(200), c text not null) checksum=1;
-create table t2 (a int, b varchar(200), c text not null) checksum=0;
-insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
-insert t2 select * from t1;
-checksum table t1, t2;
-checksum table t1, t2 quick;
-checksum table t1, t2 extended;
-drop table t1,t2;
-
-#
-# Test that SHOW PROCESSLIST doesn't have the Progress column
-#
-
---replace_column 1 <Id> 3 <Host> 6 <Time> 7 <State>
-# Embedded server is hardcoded to show "Writing to net" as STATE.
---replace_result "Writing to net" "NULL"
---replace_regex /localhost[:0-9]*/localhost/
-SHOW PROCESSLIST;
-
---echo #
---echo # MDEV-5372 Make "CAST(time_expr AS DATETIME)" compatible with the SQL Standard)
---echo #
-set @@old_mode=zero_date_time_cast;
-SELECT CAST(TIME'-10:30:30' AS DATETIME);
-SELECT CAST(TIME'10:20:30' AS DATETIME);
-SELECT CAST(TIME'830:20:30' AS DATETIME);
-CREATE TABLE t1 (a DATETIME);
-INSERT IGNORE INTO t1 VALUES (TIME'-10:20:30');
-INSERT INTO t1 VALUES (TIME'10:20:30');
-INSERT INTO t1 VALUES (TIME'830:20:30');
-SELECT * FROM t1;
-DROP TABLE t1;
-CREATE TABLE t1 (a TIMESTAMP);
-INSERT IGNORE INTO t1 VALUES (TIME'-10:20:30');
-INSERT IGNORE INTO t1 VALUES (TIME'10:20:30');
-INSERT IGNORE INTO t1 VALUES (TIME'830:20:30');
-SELECT * FROM t1;
-DROP TABLE t1;
-CREATE TABLE t1 (a TIME);
-INSERT INTO t1 VALUES (TIME'-10:20:30');
-INSERT INTO t1 VALUES (TIME'10:20:30');
-INSERT INTO t1 VALUES (TIME'830:20:30');
-SELECT a, CAST(a AS DATETIME), TO_DAYS(a) FROM t1;
-DROP TABLE t1;
-# Note, it was actually a bug that TO_DAYS('830:20:30') returned NULL
-# for a column, while 3 for an expression. We won't fix this,
-# it's "old_mode" anyway.
-SELECT TO_DAYS(TIME'-10:20:30');
-SELECT TO_DAYS(TIME'10:20:30');
-SELECT TO_DAYS(TIME'830:20:30');
-
-# This is to cover Item_temporal_hybrid_func::fix_temporal_type in old_mode:
-CREATE TABLE t1 (a DATETIME, b TIME);
-INSERT INTO t1 VALUES (NULL, '00:20:12');
-INSERT INTO t1 VALUES (NULL, '-00:20:12');
-SELECT IF(1,ADDDATE(IFNULL(a,b),0),1) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-6649 Different warnings for TIME and TIME(N) when @@old_mode=zero_date_time_cast
---echo #
-SET @@global.mysql56_temporal_format=true;
-SET @@old_mode=zero_date_time_cast;
-CREATE TABLE t1 (a TIME,b TIME(1));
-INSERT INTO t1 VALUES (TIME'830:20:30',TIME'830:20:30');
-SELECT TO_DAYS(a), TO_DAYS(b) FROM t1;
-DROP TABLE t1;
-
-SET @@global.mysql56_temporal_format=false;
-SET @@old_mode=zero_date_time_cast;
-CREATE TABLE t1 (a TIME,b TIME(1));
-INSERT INTO t1 VALUES (TIME'830:20:30',TIME'830:20:30');
-SELECT TO_DAYS(a), TO_DAYS(b) FROM t1;
-DROP TABLE t1;
-SET @@global.mysql56_temporal_format=DEFAULT;
-
-#
-# MDEV-12672 Replicated TIMESTAMP fields given wrong value near DST change
-#
-
-# Copy_field
-set time_zone='Europe/Moscow';
-set global mysql56_temporal_format=false;
-create table t1 (a timestamp);
-set timestamp=1288477526;
-insert t1 values (null);
-insert t1 values ();
-set timestamp=1288481126;
-insert t1 values (null);
-insert t1 values ();
-select a, unix_timestamp(a) from t1;
-set global mysql56_temporal_format=true;
-select a, unix_timestamp(a) from t1;
-alter table t1 modify a timestamp;
-select a, unix_timestamp(a) from t1;
-drop table t1;
-
-# field_conv_incompatible()
-set global mysql56_temporal_format=false;
-create table t1 (a timestamp);
-set timestamp=1288477526;
-insert t1 values (null);
-set timestamp=1288481126;
-insert t1 values (null);
-select a, unix_timestamp(a) from t1;
-set global mysql56_temporal_format=true;
-select a, unix_timestamp(a) from t1;
-create table t2 (a timestamp);
-insert t2 select a from t1;
-select a, unix_timestamp(a) from t2;
-drop table t1, t2;
-set time_zone=DEFAULT;
diff --git a/mysql-test/t/openssl_1.test b/mysql-test/t/openssl_1.test
deleted file mode 100644
index a3db700f787..00000000000
--- a/mysql-test/t/openssl_1.test
+++ /dev/null
@@ -1,268 +0,0 @@
-# Tests for SSL connections, only run if mysqld is compiled
-# with support for SSL.
-
--- source include/have_ssl_communication.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-set local sql_mode="";
-set global sql_mode="";
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1(f1 int);
-insert into t1 values (5);
-
-grant select on test.* to ssl_user1@localhost require SSL;
-grant select on test.* to ssl_user2@localhost require cipher "AES256-SHA";
-grant select on test.* to ssl_user3@localhost require cipher "AES256-SHA" AND SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client";
-grant select on test.* to ssl_user4@localhost require cipher "AES256-SHA" AND SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client" ISSUER "/CN=cacert/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB";
-grant select on test.* to ssl_user5@localhost require cipher "AES256-SHA" AND SUBJECT "xxx";
-flush privileges;
-
-connect (con1,localhost,ssl_user1,,,,,SSL-CIPHER=AES256-SHA);
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error ER_ACCESS_DENIED_ERROR
-connect (con2,localhost,ssl_user2,,,,,SSL-CIPHER=AES128-SHA);
-connect (con2,localhost,ssl_user2,,,,,SSL-CIPHER=AES256-SHA);
-connect (con3,localhost,ssl_user3,,,,,SSL-CIPHER=AES256-SHA);
-connect (con4,localhost,ssl_user4,,,,,SSL-CIPHER=AES256-SHA);
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error ER_ACCESS_DENIED_ERROR
-connect (con5,localhost,ssl_user5,,,,,SSL-CIPHER=AES256-SHA);
-
-connection con1;
-# Check ssl turned on
-SHOW STATUS LIKE 'Ssl_cipher';
-select * from t1;
---error ER_TABLEACCESS_DENIED_ERROR
-delete from t1;
-
-connection con2;
-# Check ssl turned on
-SHOW STATUS LIKE 'Ssl_cipher';
-select * from t1;
---error ER_TABLEACCESS_DENIED_ERROR
-delete from t1;
-
-connection con3;
-# Check ssl turned on
-SHOW STATUS LIKE 'Ssl_cipher';
-select * from t1;
---error ER_TABLEACCESS_DENIED_ERROR
-delete from t1;
-
-connection con4;
-# Check ssl turned on
-SHOW STATUS LIKE 'Ssl_cipher';
-select * from t1;
---error ER_TABLEACCESS_DENIED_ERROR
-delete from t1;
-
-connection default;
-disconnect con1;
-disconnect con2;
-disconnect con3;
-disconnect con4;
-drop user ssl_user1@localhost, ssl_user2@localhost,
-ssl_user3@localhost, ssl_user4@localhost, ssl_user5@localhost;
-
-drop table t1;
-
-# End of 4.1 tests
-
-#
-# Test that we can't open connection to server if we are using
-# a different cacert
-#
---exec echo "this query should not execute;" > $MYSQLTEST_VARDIR/tmp/test.sql
-# Handle that openssl gives different error messages from YaSSL.
---replace_regex /2026 SSL connection error.*/2026 SSL connection error: xxxx/
---error 1
---exec $MYSQL_TEST --ssl-ca=$MYSQL_TEST_DIR/std_data/untrusted-cacert.pem --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
---echo
-
-#
-# Test that we can't open connection to server if we are using
-# a blank ca
-#
---replace_regex /2026 SSL connection error.*/2026 SSL connection error: xxxx/
---error 1
---exec $MYSQL_TEST --ssl-ca= --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
---echo
-
-#
-# Test that we can't open connection to server if we are using
-# a nonexistent ca file
-#
---replace_regex /2026 SSL connection error.*/2026 SSL connection error: xxxx/
---error 1
---exec $MYSQL_TEST --ssl-ca=nonexisting_file.pem --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
---echo
-
-#
-# Test that we can't open connection to server if we are using
-# a blank client-key
-#
---replace_regex /2026 SSL connection error.*/2026 SSL connection error: xxxx/
---error 1
---exec $MYSQL_TEST --ssl-key= --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
---echo
-
-#
-# Test that we can't open connection to server if we are using
-# a blank client-cert
-#
---replace_regex /2026 SSL connection error.*/2026 SSL connection error: xxxx/
---error 1
---exec $MYSQL_TEST --ssl-cert= --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
---echo
-
-#
-# Bug#21611 Slave can't connect when master-ssl-cipher specified
-# - Apparently selecting a cipher doesn't work at all
-# - Use a cipher that both yaSSL and OpenSSL supports
-#
---exec echo "SHOW STATUS LIKE 'Ssl_cipher'; exit;" > $MYSQLTEST_VARDIR/tmp/test.sql
---exec $MYSQL_TEST --ssl-cipher=AES256-SHA < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
-
-#
-# Bug#25309 SSL connections without CA certificate broken since MySQL 5.0.23
-#
-# Test that we can open encrypted connection to server without
-# verification of servers certificate by setting both ca certificate
-# and ca path to NULL
-#
---exec $MYSQL --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'" 2>&1
---echo End of 5.0 tests
-
-#
-# Bug#26174 Server Crash: INSERT ... SELECT ... FROM I_S.GLOBAL_STATUS in
-# Event (see also information_schema.test for the other part of test for
-# this bug).
-#
---disable_warnings
-DROP TABLE IF EXISTS thread_status;
-DROP EVENT IF EXISTS event_status;
---enable_warnings
-
-SET GLOBAL event_scheduler=1;
-
-DELIMITER $$;
-
-CREATE EVENT event_status
- ON SCHEDULE AT NOW()
- ON COMPLETION NOT PRESERVE
- DO
-BEGIN
- CREATE TABLE thread_status
- SELECT variable_name, variable_value
- FROM information_schema.session_status
- WHERE variable_name LIKE 'SSL_ACCEPTS' OR
- variable_name LIKE 'SSL_CALLBACK_CACHE_HITS';
-END$$
-
-DELIMITER ;$$
-
-let $wait_condition=select count(*) = 0 from information_schema.events where event_name='event_status';
---source include/wait_condition.inc
-
-# The actual value doesn't matter and can vary based on test ordering and on ssl library.
---replace_column 2 #
-SELECT variable_name, variable_value FROM thread_status;
-
-DROP TABLE thread_status;
-SET GLOBAL event_scheduler=0;
-
-#
-# Test to connect using a list of ciphers
-#
---exec echo "SHOW STATUS LIKE 'Ssl_cipher'; exit;" > $MYSQLTEST_VARDIR/tmp/test.sql
---exec $MYSQL_TEST --ssl-cipher=UNKNOWN-CIPHER:AES128-SHA < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
-
-
-# Test to connect using a specifi cipher
-#
---exec echo "SHOW STATUS LIKE 'Ssl_cipher'; exit;" > $MYSQLTEST_VARDIR/tmp/test.sql
---exec $MYSQL_TEST --ssl-cipher=AES128-SHA < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
-
-# Test to connect using an unknown cipher
-#
---exec echo "SHOW STATUS LIKE 'Ssl_cipher'; exit" > $MYSQLTEST_VARDIR/tmp/test.sql
---replace_regex /2026 SSL connection error.*/2026 SSL connection error: xxxx/
---error 1
---exec $MYSQL_TEST --ssl-cipher=UNKNOWN-CIPHER < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
-
-#
-# Bug#27669 mysqldump: SSL connection error when trying to connect
-#
-
-CREATE TABLE t1(a int);
-INSERT INTO t1 VALUES (1), (2);
-
-# Run mysqldump
---exec $MYSQL_DUMP --skip-create-options --skip-comments --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test t1
-
---exec $MYSQL_DUMP --skip-create-options --skip-comments --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test
-
---exec $MYSQL_DUMP --skip-create-options --skip-comments --ssl --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test
-
-# With wrong parameters
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR mysqldump.exe mysqldump
---replace_regex /\"SSL connection error.*/SSL connection error: xxxx/
---error 2
---exec $MYSQL_DUMP --skip-create-options --skip-comments --ssl --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test 2>&1
---echo
-DROP TABLE t1;
---remove_file $MYSQLTEST_VARDIR/tmp/test.sql
-
-#
-# Bug#39172 Asking for DH+non-RSA key with server set to use other key caused
-# YaSSL to crash the server.
-#
-
-# Common ciphers to openssl and yassl
---exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=AES256-SHA
---exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=AES128-SHA
---disable_query_log
---disable_result_log
-
-# Below here caused crashes. ################
---error 1,0
---exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl-cipher';" --ssl-cipher=NOT----EXIST
-# These probably exist but the server's keys can't be used to accept these kinds of connections.
---error 1,0
---exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl-cipher';" --ssl-cipher=AES128-RMD
-
-# If this gives a result, then the bug is fixed.
---enable_result_log
---enable_query_log
-select 'is still running; no cipher request crashed the server' as result from dual;
-
-#
-# Bug#42158: leak: SSL_get_peer_certificate() doesn't have matching X509_free()
-#
-
-GRANT SELECT ON test.* TO bug42158@localhost REQUIRE X509;
-FLUSH PRIVILEGES;
-connect(con1,localhost,bug42158,,,,,SSL);
-SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
-disconnect con1;
-connection default;
-DROP USER bug42158@localhost;
-
-set global sql_mode=default;
---echo End of 5.1 tests
-
-#
-# MDEV-9605 mysqlbinlog does not accept ssl-ca option as expected.
-#
-
---replace_regex /SSL connection error:.*/SSL connection error/
---error 1
---exec $MYSQL_BINLOG --read-from-remote-server --ssl-ca --user=root --host=localhost nobinlog.111111 2>&1
-
-# Wait till we reached the initial number of concurrent sessions
---source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/openssl_6975.combinations b/mysql-test/t/openssl_6975.combinations
deleted file mode 100644
index 17517b7d552..00000000000
--- a/mysql-test/t/openssl_6975.combinations
+++ /dev/null
@@ -1,6 +0,0 @@
-[tlsv12]
-loose-ssl-cipher=TLSv1.2
-
-[tlsv10]
-loose-ssl-cipher=SSLv3
-
diff --git a/mysql-test/t/openssl_6975.test b/mysql-test/t/openssl_6975.test
deleted file mode 100644
index 6a82d013fb6..00000000000
--- a/mysql-test/t/openssl_6975.test
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-# MDEV-6975 Implement TLS protocol
-#
-# test SSLv3 and TLSv1.2 ciphers when OpenSSL is restricted to SSLv3 or TLSv1.2
-#
-source include/have_ssl_communication.inc;
-source include/require_openssl_client.inc;
-
-# this is OpenSSL test.
-
-create user ssl_sslv3@localhost;
-# grant select on test.* to ssl_sslv3@localhost require cipher "AES128-SHA";
-grant select on test.* to ssl_sslv3@localhost require cipher "AES128-SHA";
-create user ssl_tls12@localhost;
-grant select on test.* to ssl_tls12@localhost require cipher "AES128-SHA256";
-
-let $mysql=$MYSQL --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SHOW STATUS LIKE 'ssl_Cipher'" 2>&1;
-
-disable_abort_on_error;
-echo TLS1.2 ciphers: user is ok with any cipher;
-exec $mysql --ssl-cipher=AES128-SHA256;
---replace_result DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-GCM-SHA384 ECDHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-GCM-SHA384
-exec $mysql --ssl-cipher=TLSv1.2;
-echo TLS1.2 ciphers: user requires SSLv3 cipher AES128-SHA;
-exec $mysql --user ssl_sslv3 --ssl-cipher=AES128-SHA256;
-exec $mysql --user ssl_sslv3 --ssl-cipher=TLSv1.2;
-echo TLS1.2 ciphers: user requires TLSv1.2 cipher AES128-SHA256;
-exec $mysql --user ssl_tls12 --ssl-cipher=AES128-SHA256;
-exec $mysql --user ssl_tls12 --ssl-cipher=TLSv1.2;
-
-echo SSLv3 ciphers: user is ok with any cipher;
-exec $mysql --ssl-cipher=AES256-SHA;
-exec $mysql --ssl-cipher=SSLv3;
-echo SSLv3 ciphers: user requires SSLv3 cipher AES128-SHA;
-exec $mysql --user ssl_sslv3 --ssl-cipher=AES128-SHA;
-exec $mysql --user ssl_sslv3 --ssl-cipher=SSLv3;
-echo SSLv3 ciphers: user requires TLSv1.2 cipher AES128-SHA256;
-exec $mysql --user ssl_tls12 --ssl-cipher=AES128-SHA;
-exec $mysql --user ssl_tls12 --ssl-cipher=SSLv3;
-
-drop user ssl_sslv3@localhost;
-drop user ssl_tls12@localhost;
-
diff --git a/mysql-test/t/opt_tvc.test b/mysql-test/t/opt_tvc.test
deleted file mode 100644
index d5c9a5cbd3d..00000000000
--- a/mysql-test/t/opt_tvc.test
+++ /dev/null
@@ -1,362 +0,0 @@
-#
-# MDEV-12176 Transform [NOT] IN predicate with long list of values INTO [NOT] IN subquery
-#
-source include/have_debug.inc;
-
-create table t1 (a int, b int);
-
-insert into t1
-values (1,2), (4,6), (9,7),
- (1,1), (2,5), (7,8);
-
-create table t2 (a int, b int, c int);
-
-insert into t2
-values (1,2,3), (5,1,2), (4,3,7),
- (8,9,0), (10,7,1), (5,5,1);
-
-create table t3 (a int, b varchar(16), index idx(a));
-insert into t3 values
- (1, "abc"), (3, "egh"), (8, "axxx"), (10, "abc"),
- (2, "ccw"), (8, "wqqe"), (7, "au"), (9, "waa"),
- (3, "rass"), (9, "ert"), (9, "lok"), (8, "aww"),
- (1, "todd"), (3, "rew"), (8, "aww"), (3, "sw"),
- (11, "llk"), (7, "rbw"), (1, "sm"), (2, "jyp"),
- (4, "yq"), (5, "pled"), (12, "ligin"), (12, "toww"),
- (6, "mxm"), (15, "wanone"), (9, "sunqq"), (2, "abe");
-
---echo # optimization is not used
-
-let $query= select * from t1 where a in (1,2);
-eval $query;
-eval explain extended $query;
-
---echo # set minimum number of values in VALUEs list when optimization works to 2
-
-set @@in_predicate_conversion_threshold= 2;
-
---echo # single IN-predicate in WHERE-part
-
-let $query= select * from t1 where a in (1,2);
-
-let $optimized_query=
-select * from t1
-where a in
- (
- select *
- from (values (1),(2)) as tvc_0
- );
-
-eval $query;
-eval $optimized_query;
-eval explain extended $query;
-eval explain extended $optimized_query;
-
---echo # AND-condition with IN-predicates in WHERE-part
-
-let $query=
-select * from t1
-where a in (1,2) and
- b in (1,5);
-
-let $optimized_query=
-select * from t1
-where a in
-(
- select *
- from (values (1),(2)) as tvc_0
-)
-and b in
-(
- select *
- from (values (1),(5)) as tvc_1
-);
-
-eval $query;
-eval $optimized_query;
-eval explain extended $query;
-eval explain extended $optimized_query;
-
---echo # subquery with IN-predicate
-
-let $query=
-select * from t1
-where a in
-(
- select a
- from t2 where b in (3,4)
-);
-
-let $optimized_query=
-select * from t1
-where a in
-(
- select a from t2
- where b in
- (
- select *
- from (values (3),(4)) as tvc_0
- )
-);
-
-eval $query;
-eval $optimized_query;
-eval explain extended $query;
-eval explain extended $optimized_query;
-
---echo # derived table with IN-predicate
-
-let $query=
-select * from
-(
- select *
- from t1
- where a in (1,2)
-) as dr_table;
-
-let $optimized_query=
-select * from
-(
- select *
- from t1
- where a in
- (
- select *
- from (values (1),(2))
- as tvc_0
- )
-) as dr_table;
-
-eval $query;
-eval $optimized_query;
-eval explain extended $query;
-eval explain extended $optimized_query;
-
---echo # non-recursive CTE with IN-predicate
-
-let $cte_query=
-with tvc_0 as
-(
- select *
- from t1
- where a in (1,2)
-)
-select * from tvc_0;
-
-eval $cte_query;
-eval $optimized_query;
-eval explain extended $cte_query;
-eval explain extended $optimized_query;
-
---echo # VIEW with IN-predicate
-
-create view v1 as
- select *
- from t1
- where a in (1,2);
-
-create view v2 as
- select *
- from t1
- where a in
- (
- select *
- from (values (1),(2))
- as tvc_0
- )
-;
-
-let $query= select * from v1;
-let $optimized_query= select * from v2;
-
-eval $query;
-eval $optimized_query;
-eval explain extended $query;
-eval explain extended $optimized_query;
-
-drop view v1,v2;
-
---echo # subselect defined by derived table with IN-predicate
-
-let $query=
-select * from t1
-where a in
-(
- select 1
- from
- (
- select *
- from t1
- where a in (1,2)
- )
- as dr_table
-);
-
-let $optimized_query=
-select * from t1
-where a in
-(
- select 1
- from
- (
- select *
- from t1
- where a in
- (
- select *
- from (values (1),(2))
- as tvc_0
- )
- )
- as dr_table
-);
-
-eval $query;
-eval $optimized_query;
-eval explain extended $query;
-eval explain extended $optimized_query;
-
---echo # derived table with IN-predicate and group by
-
-let $query=
-select * from
-(
- select max(a),b
- from t1
- where b in (3,5)
- group by b
-) as dr_table;
-
-let $optimized_query=
-select * from
-(
- select max(a),b
- from t1
- where b in
- (
- select *
- from (values (3),(5))
- as tvc_0
- )
- group by b
-) as dr_table;
-
-eval $query;
-eval $optimized_query;
-eval explain extended $query;
-eval explain extended $optimized_query;
-
---echo # prepare statement
-
-prepare stmt from "select * from t1 where a in (1,2)";
-execute stmt;
-execute stmt;
-deallocate prepare stmt;
-
---echo # use inside out access from tvc rows
-
-let $query= select * from t3 where a in (1,4,10);
-set @@in_predicate_conversion_threshold= default;
-eval $query;
-eval explain extended $query;
-set @@in_predicate_conversion_threshold= 2;
-eval $query;
-eval explain extended $query;
-
---echo # use vectors in IN predeicate
-
-set @@in_predicate_conversion_threshold= 4;
-
-let $query=
-select * from t1 where (a,b) in ((1,2),(3,4));
-
-eval $query;
-eval explain extended $query;
-set @@in_predicate_conversion_threshold= 2;
-
---echo # trasformation works for the one IN predicate and doesn't work for the other
-
-set @@in_predicate_conversion_threshold= 5;
-
-let $query=
-select * from t2
-where (a,b) in ((1,2),(8,9)) and
- (a,c) in ((1,3),(8,0),(5,1));
-
-eval $query;
-eval explain extended $query;
-set @@in_predicate_conversion_threshold= 2;
-
---echo #
---echo # mdev-14281: conversion of NOT IN predicate into subquery predicate
---echo #
-
-let $query=
-select * from t1
-where (a,b) not in ((1,2),(8,9), (5,1));
-let $optimized_query=
-select * from t1
-where (a,b) not in (select * from (values (1,2),(8,9), (5,1)) as tvc_0);
-
-eval $query;
-eval $optimized_query;
-eval explain extended $query;
-eval explain extended $optimized_query;
-
-let $query=
-select * from t1
-where b < 7 and (a,b) not in ((1,2),(8,9), (5,1));
-eval $query;
-eval explain extended $query;
-
-let $query=
-select * from t2
-where (a,c) not in ((1,2),(8,9), (5,1));
-eval $query;
-eval explain extended $query;
-
-drop table t1, t2, t3;
-
-set @@in_predicate_conversion_threshold= default;
-
---echo #
---echo # MDEV-14947: conversion of TVC with only NULL values
---echo #
-
-CREATE TABLE t1 (i INT);
-INSERT INTO t1 VALUES (3), (2), (7);
-
-let $q=
-SELECT * FROM t1 WHERE i IN (NULL, NULL, NULL, NULL, NULL);
-
-eval $q;
-eval EXPLAIN EXTENDED $q;
-
-SET in_predicate_conversion_threshold= 5;
-
-eval $q;
-eval EXPLAIN EXTENDED $q;
-
-SET in_predicate_conversion_threshold= default;
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-14835: conversion of TVC with BIGINT or YEAR values
---echo #
-
-SET @@in_predicate_conversion_threshold= 2;
-
-CREATE TABLE t1 (a BIGINT);
-CREATE TABLE t2 (y YEAR);
-
-INSERT INTO t1 VALUES (1), (2), (3);
-INSERT INTO t2 VALUES (2009), (2010), (2011);
-
-SELECT * FROM t1 WHERE a IN ('1','5','3');
-
-SELECT * FROM t2 WHERE y IN ('2009','2011');
-
-DROP TABLE t1,t2;
-
-SET @@in_predicate_conversion_threshold= default;
diff --git a/mysql-test/t/order_by-mdev-10122.test b/mysql-test/t/order_by-mdev-10122.test
deleted file mode 100644
index 2520e6487ac..00000000000
--- a/mysql-test/t/order_by-mdev-10122.test
+++ /dev/null
@@ -1,39 +0,0 @@
---echo #
---echo # MariaDB does not support group functions in some contexts where MySQL does
---echo #
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (10),(20),(30);
-
---echo # All these queries must pass, not returning "Invalid use of group function".
-(SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a));
-(SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a)) LIMIT 1;
-(SELECT a FROM t1 GROUP BY a ORDER BY a,GROUP_CONCAT(a));
-(SELECT a FROM t1 GROUP BY a ORDER BY a,GROUP_CONCAT(a)) LIMIT 1;
-
-(SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a)) ORDER BY a;
-(SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a)) ORDER BY a LIMIT 1;
-(SELECT a FROM t1 GROUP BY a ORDER BY a,GROUP_CONCAT(a)) ORDER BY a;
-(SELECT a FROM t1 GROUP BY a ORDER BY a,GROUP_CONCAT(a)) ORDER BY a LIMIT 1;
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a));
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a)) LIMIT 1;
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a)) ORDER BY a;
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a)) ORDER BY a LIMIT 1;
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY a,GROUP_CONCAT(a));
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY a,GROUP_CONCAT(a)) LIMIT 1;
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY a,GROUP_CONCAT(a)) ORDER BY a;
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY a,GROUP_CONCAT(a)) ORDER BY a LIMIT 1;
-
-(SELECT a FROM t1 GROUP BY a ORDER BY MAX(a)) ORDER BY a;
-(SELECT a FROM t1 GROUP BY a ORDER BY MAX(a)) ORDER BY a LIMIT 1;
-(SELECT a FROM t1 GROUP BY a ORDER BY a,MAX(a)) ORDER BY a;
-(SELECT a FROM t1 GROUP BY a ORDER BY a,MAX(a)) ORDER BY a LIMIT 1;
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY MAX(a));
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY MAX(a)) LIMIT 1;
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY MAX(a)) ORDER BY a;
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY MAX(a)) ORDER BY a LIMIT 1;
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY a,MAX(a));
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY a,MAX(a)) LIMIT 1;
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY a,MAX(a)) ORDER BY a;
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY a,MAX(a)) ORDER BY a LIMIT 1;
-
-drop table t1;
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test
deleted file mode 100644
index b047a31c863..00000000000
--- a/mysql-test/t/order_by.test
+++ /dev/null
@@ -1,2189 +0,0 @@
-#
-# Testing ORDER BY
-#
-
-call mtr.add_suppression("Sort aborted.*");
-
---disable_warnings
-drop table if exists t1,t2,t3;
---enable_warnings
-
-call mtr.add_suppression("Out of sort memory; increase server sort buffer size");
-
-#
-# Test old ORDER BY bug
-#
-
-CREATE TABLE t1 (
- id int(6) DEFAULT '0' NOT NULL,
- idservice int(5),
- clee char(20) NOT NULL,
- flag char(1),
- KEY id (id),
- PRIMARY KEY (clee)
-);
-
-
-INSERT INTO t1 VALUES (2,4,'6067169d','Y');
-INSERT INTO t1 VALUES (2,5,'606716d1','Y');
-INSERT INTO t1 VALUES (2,1,'606717c1','Y');
-INSERT INTO t1 VALUES (3,1,'6067178d','Y');
-INSERT INTO t1 VALUES (2,6,'60671515','Y');
-INSERT INTO t1 VALUES (2,7,'60671569','Y');
-INSERT INTO t1 VALUES (2,3,'dd','Y');
-
-CREATE TABLE t2 (
- id int(6) NOT NULL auto_increment,
- description varchar(40) NOT NULL,
- idform varchar(40),
- ordre int(6) unsigned DEFAULT '0' NOT NULL,
- image varchar(60),
- PRIMARY KEY (id),
- KEY id (id,ordre)
-);
-
-#
-# Dumping data for table 't2'
-#
-
-INSERT INTO t2 VALUES (1,'Emettre un appel d''offres','en_construction.html',10,'emettre.gif');
-INSERT INTO t2 VALUES (2,'Emettre des soumissions','en_construction.html',20,'emettre.gif');
-INSERT INTO t2 VALUES (7,'Liste des t2','t2_liste_form.phtml',51060,'link.gif');
-INSERT INTO t2 VALUES (8,'Consulter les soumissions','consulter_soumissions.phtml',200,'link.gif');
-INSERT INTO t2 VALUES (9,'Ajouter un type de materiel','typeMateriel_ajoute_form.phtml',51000,'link.gif');
-INSERT INTO t2 VALUES (10,'Lister/modifier un type de materiel','typeMateriel_liste_form.phtml',51010,'link.gif');
-INSERT INTO t2 VALUES (3,'Créer une fiche de client','clients_ajoute_form.phtml',40000,'link.gif');
-INSERT INTO t2 VALUES (4,'Modifier des clients','en_construction.html',40010,'link.gif');
-INSERT INTO t2 VALUES (5,'Effacer des clients','en_construction.html',40020,'link.gif');
-INSERT INTO t2 VALUES (6,'Ajouter un service','t2_ajoute_form.phtml',51050,'link.gif');
-
-
-select t1.id,t1.idservice,t2.ordre,t2.description from t1, t2 where t1.id = 2 and t1.idservice = t2.id order by t2.ordre;
-
-drop table t1,t2;
-
-#
-# Test of ORDER BY on concat() result
-#
-
-create table t1 (first char(10),last char(10));
-insert into t1 values ("Michael","Widenius");
-insert into t1 values ("Allan","Larsson");
-insert into t1 values ("David","Axmark");
-select concat(first," ",last) as name from t1 order by name;
-select concat(last," ",first) as name from t1 order by name;
-drop table t1;
-
-#
-# bug in distinct + order by
-#
-
-create table t1 (i int);
-insert into t1 values(1),(2),(1),(2),(1),(2),(3);
-select distinct i from t1;
-select distinct i from t1 order by rand(5);
-select distinct i from t1 order by i desc;
-select distinct i from t1 order by 1-i;
-select distinct i from t1 order by mod(i,2),i;
-drop table t1;
-
-#
-# bug#3681
-#
-
-create table t1 ( pk int primary key, name varchar(255) not null, number varchar(255) not null);
-insert into t1 values (1, 'Gamma', '123'), (2, 'Gamma Ext', '123a'), (3, 'Alpha', '001'), (4, 'Beta', '200c');
-select distinct t1.name as 'Building Name',t1.number as 'Building Number' from t1 order by t1.name asc;
-drop table t1;
-
-
-#
-# Order by on first index part
-#
-
-create table t1 (id int not null,col1 int not null,col2 int not null,index(col1));
-insert into t1 values(1,2,2),(2,2,1),(3,1,2),(4,1,1),(5,1,4),(6,2,3),(7,3,1),(8,2,4);
-select * from t1 order by col1,col2;
-select col1 from t1 order by id;
-select col1 as id from t1 order by id;
-select concat(col1) as id from t1 order by id;
-drop table t1;
-
-#
-# Test of order by on field()
-#
-
-CREATE TABLE t1 (id int auto_increment primary key,aika varchar(40),aikakentta timestamp);
-insert into t1 (aika) values ('Keskiviikko');
-insert into t1 (aika) values ('Tiistai');
-insert into t1 (aika) values ('Maanantai');
-insert into t1 (aika) values ('Sunnuntai');
-
-SELECT FIELD(SUBSTRING(t1.aika,1,2),'Ma','Ti','Ke','To','Pe','La','Su') AS test FROM t1 ORDER by test;
-drop table t1;
-
-#
-# Test of ORDER BY on IF
-#
-
-CREATE TABLE t1
-(
- a int unsigned NOT NULL,
- b int unsigned NOT NULL,
- c int unsigned NOT NULL,
- UNIQUE(a),
- INDEX(b),
- INDEX(c)
-);
-
-CREATE TABLE t2
-(
- c int unsigned NOT NULL,
- i int unsigned NOT NULL,
- INDEX(c)
-);
-
-CREATE TABLE t3
-(
- c int unsigned NOT NULL,
- v varchar(64),
- INDEX(c)
-);
-
-INSERT INTO t1 VALUES (1,1,1);
-INSERT INTO t1 VALUES (2,1,2);
-INSERT INTO t1 VALUES (3,2,1);
-INSERT INTO t1 VALUES (4,2,2);
-INSERT INTO t2 VALUES (1,50);
-INSERT INTO t2 VALUES (2,25);
-INSERT INTO t3 VALUES (1,'123 Park Place');
-INSERT INTO t3 VALUES (2,'453 Boardwalk');
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='outer_join_with_cache=off';
-
-SELECT a,b,if(b = 1,i,if(b = 2,v,''))
-FROM t1
-LEFT JOIN t2 USING(c)
-LEFT JOIN t3 ON t3.c = t1.c;
-
-SELECT a,b,if(b = 1,i,if(b = 2,v,''))
-FROM t1
-LEFT JOIN t2 ON t1.c = t2.c
-LEFT JOIN t3 ON t3.c = t1.c;
-
-SELECT a,b,if(b = 1,i,if(b = 2,v,''))
-FROM t1
-LEFT JOIN t2 USING(c)
-LEFT JOIN t3 ON t3.c = t1.c
-ORDER BY a;
-
-SELECT a,b,if(b = 1,i,if(b = 2,v,''))
-FROM t1
-LEFT JOIN t2 ON t1.c = t2.c
-LEFT JOIN t3 ON t3.c = t1.c
-ORDER BY a;
-
-SET optimizer_switch=@save_optimizer_switch;
-
-drop table t1,t2,t3;
-
-#
-# Test of ORDER BY (Bug found by Dean Edmonds)
-#
-
-create table t1 (ID int not null primary key, TransactionID int not null);
-insert into t1 (ID, TransactionID) values (1, 87), (2, 89), (3, 92), (4, 94), (5, 486), (6, 490), (7, 753), (9, 828), (10, 832), (11, 834), (12, 840);
-create table t2 (ID int not null primary key, GroupID int not null);
- insert into t2 (ID, GroupID) values (87, 87), (89, 89), (92, 92), (94, 94), (486, 486), (490, 490),(753, 753), (828, 828), (832, 832), (834, 834), (840, 840);
-create table t3 (ID int not null primary key, DateOfAction date not null);
-insert into t3 (ID, DateOfAction) values (87, '1999-07-19'), (89, '1999-07-19'), (92, '1999-07-19'), (94, '1999-07-19'), (486, '1999-07-18'), (490, '2000-03-27'), (753, '2000-03-28'), (828, '1999-07-27'), (832, '1999-07-27'),(834, '1999-07-27'), (840, '1999-07-27');
-select t3.DateOfAction, t1.TransactionID from t1 join t2 join t3 where t2.ID = t1.TransactionID and t3.ID = t2.GroupID order by t3.DateOfAction, t1.TransactionID;
-select t3.DateOfAction, t1.TransactionID from t1 join t2 join t3 where t2.ID = t1.TransactionID and t3.ID = t2.GroupID order by t1.TransactionID,t3.DateOfAction;
-drop table t1,t2,t3;
-
-#bug reported by Wouter de Jong
-
-CREATE TABLE t1 (
- member_id int(11) NOT NULL auto_increment,
- inschrijf_datum varchar(20) NOT NULL default '',
- lastchange_datum varchar(20) NOT NULL default '',
- nickname varchar(20) NOT NULL default '',
- password varchar(8) NOT NULL default '',
- voornaam varchar(30) NOT NULL default '',
- tussenvoegsels varchar(10) NOT NULL default '',
- achternaam varchar(50) NOT NULL default '',
- straat varchar(100) NOT NULL default '',
- postcode varchar(10) NOT NULL default '',
- wijk varchar(40) NOT NULL default '',
- plaats varchar(50) NOT NULL default '',
- telefoon varchar(10) NOT NULL default '',
- geboortedatum date NOT NULL default '0000-00-00',
- geslacht varchar(5) NOT NULL default '',
- email varchar(80) NOT NULL default '',
- uin varchar(15) NOT NULL default '',
- homepage varchar(100) NOT NULL default '',
- internet varchar(15) NOT NULL default '',
- scherk varchar(30) NOT NULL default '',
- favo_boek varchar(50) NOT NULL default '',
- favo_tijdschrift varchar(50) NOT NULL default '',
- favo_tv varchar(50) NOT NULL default '',
- favo_eten varchar(50) NOT NULL default '',
- favo_muziek varchar(30) NOT NULL default '',
- info text NOT NULL default '',
- ipnr varchar(30) NOT NULL default '',
- PRIMARY KEY (member_id)
-) ENGINE=MyISAM PACK_KEYS=1;
-
-insert into t1 (member_id) values (1),(2),(3);
-select member_id, nickname, voornaam FROM t1
-ORDER by lastchange_datum DESC LIMIT 2;
-drop table t1;
-
-#
-# Test optimization of ORDER BY DESC
-#
-
-create table t1 (a int not null, b int, c varchar(10), key (a, b, c));
-insert into t1 values (1, NULL, NULL), (1, NULL, 'b'), (1, 1, NULL), (1, 1, 'b'), (1, 1, 'b'), (2, 1, 'a'), (2, 1, 'b'), (2, 2, 'a'), (2, 2, 'b'), (2, 3, 'c'),(1,3,'b');
-
-explain select * from t1 where (a = 1 and b is null and c = 'b') or (a > 2) order by a desc;
-select * from t1 where (a = 1 and b is null and c = 'b') or (a > 2) order by a desc;
-explain select * from t1 where a >= 1 and a < 3 order by a desc;
-select * from t1 where a >= 1 and a < 3 order by a desc;
-explain select * from t1 where a = 1 order by a desc, b desc;
-select * from t1 where a = 1 order by a desc, b desc;
-explain select * from t1 where a = 1 and b is null order by a desc, b desc;
-select * from t1 where a = 1 and b is null order by a desc, b desc;
-explain select * from t1 where a >= 1 and a < 3 and b >0 order by a desc,b desc;
-explain select * from t1 where a = 2 and b >0 order by a desc,b desc;
-explain select * from t1 where a = 2 and b is null order by a desc,b desc;
-explain select * from t1 where a = 2 and (b is null or b > 0) order by a
-desc,b desc;
-explain select * from t1 where a = 2 and b > 0 order by a desc,b desc;
-explain select * from t1 where a = 2 and b < 2 order by a desc,b desc;
-explain select * from t1 where a = 1 order by b desc;
-explain select * from t1 where a = 2 and b > 0 order by a desc,b desc,b,a;
-explain select * from t1 where a = 2 and b < 2 order by a desc,a,b desc,a,b;
-
-select * from t1 where a = 1 order by b desc;
-#
-# Test things when we don't have NULL keys
-#
-
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-alter table t1 modify b int not null, modify c varchar(10) not null;
-explain select * from t1 order by a, b, c;
-select * from t1 order by a, b, c;
-explain select * from t1 order by a desc, b desc, c desc;
-select * from t1 order by a desc, b desc, c desc;
-# test multiple ranges, NO_MAX_RANGE and EQ_RANGE
-explain select * from t1 where (a = 1 and b = 1 and c = 'b') or (a > 2) order by a desc;
-select * from t1 where (a = 1 and b = 1 and c = 'b') or (a > 2) order by a desc;
-# test NEAR_MAX, NO_MIN_RANGE
-explain select * from t1 where a < 2 and b <= 1 order by a desc, b desc;
-select * from t1 where a < 2 and b <= 1 order by a desc, b desc;
-select count(*) from t1 where a < 5 and b > 0;
-select * from t1 where a < 5 and b > 0 order by a desc,b desc;
-# test HA_READ_AFTER_KEY (at the end of the file), NEAR_MIN
-explain select * from t1 where a between 1 and 3 and b <= 1 order by a desc, b desc;
-select * from t1 where a between 1 and 3 and b <= 1 order by a desc, b desc;
-# test HA_READ_AFTER_KEY (in the middle of the file)
-explain select * from t1 where a between 0 and 1 order by a desc, b desc;
-select * from t1 where a between 0 and 1 order by a desc, b desc;
-drop table t1;
-
-
-CREATE TABLE t1 (
- gid int(10) unsigned NOT NULL auto_increment,
- cid smallint(5) unsigned NOT NULL default '0',
- PRIMARY KEY (gid),
- KEY component_id (cid)
-) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (103853,108),(103867,108),(103962,108),(104505,108),(104619,108),(104620,108);
-ALTER TABLE t1 add skr int(10) not null;
-
-CREATE TABLE t2 (
- gid int(10) unsigned NOT NULL default '0',
- uid smallint(5) unsigned NOT NULL default '1',
- sid tinyint(3) unsigned NOT NULL default '1',
- PRIMARY KEY (gid),
- KEY uid (uid),
- KEY status_id (sid)
-) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (103853,250,5),(103867,27,5),(103962,27,5),(104505,117,5),(104619,75,5),(104620,15,5);
-
-CREATE TABLE t3 (
- uid smallint(6) NOT NULL auto_increment,
- PRIMARY KEY (uid)
-) ENGINE=MyISAM;
-INSERT INTO t3 VALUES (1),(15),(27),(75),(117),(250);
-ALTER TABLE t3 add skr int(10) not null;
-
-select t1.gid, t2.sid, t3.uid from t2, t1, t3 where t2.gid = t1.gid and t2.uid = t3.uid order by t3.uid, t1.gid;
-select t1.gid, t2.sid, t3.uid from t3, t2, t1 where t2.gid = t1.gid and t2.uid = t3.uid order by t3.uid, t1.gid;
-
-# The following ORDER BY can be optimimized
-EXPLAIN select t1.gid, t2.sid, t3.uid from t3, t2, t1 where t2.gid = t1.gid and t2.uid = t3.uid order by t1.gid, t3.uid;
-EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.gid = t3.uid order by t1.gid,t3.skr;
-
-# The following ORDER BY can't be optimimized
-EXPLAIN SELECT t1.gid, t2.sid, t3.uid from t2, t1, t3 where t2.gid = t1.gid and t2.uid = t3.uid order by t3.uid, t1.gid;
-EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.gid = t3.uid order by t3.skr,t1.gid;
-EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.skr = t3.uid order by t1.gid,t3.skr;
-drop table t1,t2,t3;
-
-#
-# Test of bug when doing an ORDER BY with const items
-#
-
-CREATE TABLE t1 (
- `titre` char(80) NOT NULL default '',
- `numeropost` mediumint(8) unsigned NOT NULL auto_increment,
- `date` datetime NOT NULL default '0000-00-00 00:00:00',
- `auteur` char(35) NOT NULL default '',
- `icone` tinyint(2) unsigned NOT NULL default '0',
- `lastauteur` char(35) NOT NULL default '',
- `nbrep` smallint(6) unsigned NOT NULL default '0',
- `dest` char(35) NOT NULL default '',
- `lu` tinyint(1) unsigned NOT NULL default '0',
- `vue` mediumint(8) unsigned NOT NULL default '0',
- `ludest` tinyint(1) unsigned NOT NULL default '0',
- `ouvert` tinyint(1) unsigned NOT NULL default '1',
- PRIMARY KEY (`numeropost`),
- KEY `date` (`date`),
- KEY `dest` (`dest`,`ludest`),
- KEY `auteur` (`auteur`,`lu`),
- KEY `auteur_2` (`auteur`,`date`),
- KEY `dest_2` (`dest`,`date`)
-) CHECKSUM=1;
-
-CREATE TABLE t2 (
- `numeropost` mediumint(8) unsigned NOT NULL default '0',
- `pseudo` char(35) NOT NULL default '',
- PRIMARY KEY (`numeropost`,`pseudo`),
- KEY `pseudo` (`pseudo`)
-);
-
-INSERT INTO t1 (titre,auteur,dest) VALUES ('test','joce','bug');
-INSERT INTO t2 (numeropost,pseudo) VALUES (1,'joce'),(1,'bug');
-SELECT titre,t1.numeropost,auteur,icone,nbrep,0,date,vue,ouvert,lastauteur,dest FROM t2 LEFT JOIN t1 USING(numeropost) WHERE t2.pseudo='joce' ORDER BY date DESC LIMIT 0,30;
-SELECT titre,numeropost,auteur,icone,nbrep,0,date,vue,ouvert,lastauteur,dest FROM t2 LEFT JOIN t1 USING(numeropost) WHERE t2.pseudo='joce' ORDER BY date DESC LIMIT 0,30;
-SELECT titre,t1.numeropost,auteur,icone,nbrep,'0',date,vue,ouvert,lastauteur,dest FROM t2 LEFT JOIN t1 USING(numeropost) WHERE t2.pseudo='joce' ORDER BY date DESC LIMIT 0,30;
-SELECT titre,numeropost,auteur,icone,nbrep,'0',date,vue,ouvert,lastauteur,dest FROM t2 LEFT JOIN t1 USING(numeropost) WHERE t2.pseudo='joce' ORDER BY date DESC LIMIT 0,30;
-drop table t1,t2;
-
-#
-# Test order by with NULL values
-#
-CREATE TABLE t1 (a int, b int);
-INSERT INTO t1 VALUES (1, 2);
-INSERT INTO t1 VALUES (3, 4);
-INSERT INTO t1 VALUES (5, NULL);
-SELECT * FROM t1 ORDER BY b;
-SELECT * FROM t1 ORDER BY b DESC;
-SELECT * FROM t1 ORDER BY (a + b);
-SELECT * FROM t1 ORDER BY (a + b) DESC;
-DROP TABLE t1;
-
-#
-# Test of FORCE INDEX ... ORDER BY
-#
-
-create table t1(id int not null auto_increment primary key, t char(12));
---disable_query_log
-begin;
-let $1 = 1000;
-while ($1)
- {
- eval insert into t1(t) values ('$1');
- dec $1;
- }
-commit;
---enable_query_log
-explain select id,t from t1 order by id;
-explain select id,t from t1 force index (primary) order by id;
-drop table t1;
-
-#
-# Test of test_if_subkey() function
-#
-CREATE TABLE t1 (
- FieldKey varchar(36) NOT NULL default '',
- LongVal bigint(20) default NULL,
- StringVal mediumtext,
- KEY FieldKey (FieldKey),
- KEY LongField (FieldKey,LongVal),
- KEY StringField (FieldKey,StringVal(32))
-);
-INSERT INTO t1 VALUES ('0',3,'0'),('0',2,'1'),('0',1,'2'),('1',2,'1'),('1',1,'3'), ('1',0,'2'),('2',3,'0'),('2',2,'1'),('2',1,'2'),('2',3,'0'),('2',2,'1'),('2',1,'2'),('3',2,'1'),('3',1,'2'),('3','3','3');
-EXPLAIN SELECT * FROM t1 WHERE FieldKey = '1' ORDER BY LongVal;
-SELECT * FROM t1 WHERE FieldKey = '1' ORDER BY LongVal;
---echo DS-MRR: use two IGNORE INDEX queries, otherwise we get cost races, because
---echo DS-MRR: records_in_range/read_time return the same numbers for all three indexes
-EXPLAIN SELECT * FROM t1 IGNORE INDEX (LongField, StringField) WHERE FieldKey > '2' ORDER BY LongVal;
-EXPLAIN SELECT * FROM t1 IGNORE INDEX (FieldKey, LongField) WHERE FieldKey > '2' ORDER BY LongVal;
-
-SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY LongVal;
-EXPLAIN SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY FieldKey, LongVal;
-SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY FieldKey, LongVal;
-DROP TABLE t1;
-#
-# Bug #1945 - Crashing bug with bad User Variables in UPDATE ... ORDER BY ...
-#
-CREATE TABLE t1 (a INT, b INT);
-SET @id=0;
-UPDATE t1 SET a=0 ORDER BY (a=@id), b;
-DROP TABLE t1;
-
-#
-# Bug when doing an order by on a 1 byte string (Bug #2147)
-#
-
-CREATE TABLE t1 ( id smallint(6) unsigned NOT NULL default '0', menu tinyint(4) NOT NULL default '0', KEY id (id), KEY menu (menu)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (11384, 2),(11392, 2);
-SELECT id FROM t1 WHERE id <11984 AND menu =2 ORDER BY id DESC LIMIT 1 ;
-drop table t1;
-
-#
-# REF_OR_NULL optimization + filesort (bug #2419)
-#
-
-create table t1(a int, b int, index(b));
-insert into t1 values (2, 1), (1, 1), (4, NULL), (3, NULL), (6, 2), (5, 2);
-insert into t1 values (12, 11), (11, 11), (14, 3), (13, 5), (16, 12), (15, 12);
-explain select * from t1 where b=1 or b is null order by a;
-select * from t1 where b=1 or b is null order by a;
-explain select * from t1 where b=2 or b is null order by a;
-select * from t1 where b=2 or b is null order by a;
-drop table t1;
-
-#
-# Bug #3155 - Strange results with index (x, y) ... WHERE ... ORDER BY pk
-#
-
-create table t1 (a int not null auto_increment, b int not null, c int not null, d int not null,
-key(a,b,d), key(c,b,a));
-create table t2 like t1;
-insert into t1 values (NULL, 1, 2, 0), (NULL, 2, 1, 1), (NULL, 3, 4, 2), (NULL, 4, 3, 3);
-insert into t2 select null, b, c, d from t1;
-insert into t1 select null, b, c, d from t2;
-insert into t2 select null, b, c, d from t1;
-insert into t1 select null, b, c, d from t2;
-insert into t2 select null, b, c, d from t1;
-insert into t1 select null, b, c, d from t2;
-insert into t2 select null, b, c, d from t1;
-insert into t1 select null, b, c, d from t2;
-insert into t2 select null, b, c, d from t1;
-insert into t1 select null, b, c, d from t2;
-optimize table t1;
-set @row=10;
-insert into t1 select 1, b, c + (@row:=@row - 1) * 10, d - @row from t2 limit 10;
-select * from t1 where a=1 and b in (1) order by c, b, a;
-select * from t1 where a=1 and b in (1);
-drop table t1, t2;
-
-#
-# Bug #4302
-# Ambiguos order by when renamed column is identical to another in result.
-# Should not fail and prefer column from t1 for sorting.
-#
-create table t1 (col1 int, col int);
-create table t2 (col2 int, col int);
-insert into t1 values (1,1),(2,2),(3,3);
-insert into t2 values (1,3),(2,2),(3,1);
-select t1.* , t2.col as t2_col from t1 left join t2 on (t1.col1=t2.col2)
- order by col;
-
-#
-# Let us also test various ambiguos and potentially ambiguos cases
-# related to aliases
-#
---error 1052
-select col1 as col, col from t1 order by col;
---error 1052
-select t1.col as c1, t2.col as c2 from t1, t2 where t1.col1=t2.col2
- order by col;
---error 1052
-select t1.col as c1, t2.col as c2 from t1, t2 where t1.col1=t2.col2
- order by col;
---error 1052
-select col1 from t1, t2 where t1.col1=t2.col2 order by col;
---error 1052
-select t1.col as t1_col, t2.col2 from t1, t2 where t1.col1=t2.col2
- order by col;
-
-select t1.col as t1_col, t2.col from t1, t2 where t1.col1=t2.col2
- order by col;
-select col2 as c, col as c from t2 order by col;
-select col2 as col, col as col2 from t2 order by col;
-select t2.col2, t2.col, t2.col from t2 order by col;
-
-select t2.col2 as col from t2 order by t2.col;
-select t2.col2 as col, t2.col from t2 order by t2.col;
-select t2.col2, t2.col, t2.col from t2 order by t2.col;
-
-drop table t1, t2;
-
-#
-# Bug #5428: a problem with small max_sort_length value
-#
-
-create table t1 (a char(25));
-insert into t1 set a = repeat('x', 20);
-insert into t1 set a = concat(repeat('x', 19), 'z');
-insert into t1 set a = concat(repeat('x', 19), 'ab');
-insert into t1 set a = concat(repeat('x', 19), 'aa');
-set max_sort_length=20;
-select a from t1 order by a;
-drop table t1;
-
-#
-# Bug #7331
-#
-
-create table t1 (
- `sid` decimal(8,0) default null,
- `wnid` varchar(11) not null default '',
- key `wnid14` (`wnid`(4)),
- key `wnid` (`wnid`)
-) engine=myisam default charset=latin1;
-
-insert into t1 (`sid`, `wnid`) values
-('10100','01019000000'),('37986','01019000000'),('37987','01019010000'),
-('39560','01019090000'),('37989','01019000000'),('37990','01019011000'),
-('37991','01019011000'),('37992','01019019000'),('37993','01019030000'),
-('37994','01019090000'),('475','02070000000'),('25253','02071100000'),
-('25255','02071100000'),('25256','02071110000'),('25258','02071130000'),
-('25259','02071190000'),('25260','02071200000'),('25261','02071210000'),
-('25262','02071290000'),('25263','02071300000'),('25264','02071310000'),
-('25265','02071310000'),('25266','02071320000'),('25267','02071320000'),
-('25269','02071330000'),('25270','02071340000'),('25271','02071350000'),
-('25272','02071360000'),('25273','02071370000'),('25281','02071391000'),
-('25282','02071391000'),('25283','02071399000'),('25284','02071400000'),
-('25285','02071410000'),('25286','02071410000'),('25287','02071420000'),
-('25288','02071420000'),('25291','02071430000'),('25290','02071440000'),
-('25292','02071450000'),('25293','02071460000'),('25294','02071470000'),
-('25295','02071491000'),('25296','02071491000'),('25297','02071499000');
-
-explain select * from t1 where wnid like '0101%' order by wnid;
-
-select * from t1 where wnid like '0101%' order by wnid;
-
-drop table t1;
-
-#
-# Bug #7672 - a wrong result for a select query in braces followed by order by
-#
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (2), (1), (1), (2), (1);
-SELECT a FROM t1 ORDER BY a;
-(SELECT a FROM t1) ORDER BY a;
-DROP TABLE t1;
-
-#
-# Bug #18767: global ORDER BY applied to a SELECT with ORDER BY either was
-# ignored or 'concatened' to the latter.
-
-CREATE TABLE t1 (a int, b int);
-INSERT INTO t1 VALUES (1,30), (2,20), (1,10), (2,30), (1,20), (2,10);
-
-(SELECT b,a FROM t1 ORDER BY a,b) ORDER BY b,a;
-(SELECT b FROM t1 ORDER BY b DESC) ORDER BY b ASC;
-(SELECT b,a FROM t1 ORDER BY b,a) ORDER BY a,b;
-(SELECT b,a FROM t1 ORDER by b,a LIMIT 3) ORDER by a,b;
-
-DROP TABLE t1;
-
-#
-# Bug #22457: Column alias in ORDER BY works, but not if in an expression
-#
-
-CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1),(2);
-SELECT a + 1 AS num FROM t1 ORDER BY 30 - num;
-SELECT CONCAT('test', a) AS str FROM t1 ORDER BY UPPER(str);
-SELECT a + 1 AS num FROM t1 GROUP BY 30 - num;
-SELECT a + 1 AS num FROM t1 HAVING 30 - num;
---error 1054
-SELECT a + 1 AS num, num + 1 FROM t1;
-SELECT a + 1 AS num, (select num + 2 FROM t1 LIMIT 1) FROM t1;
---error 1054
-SELECT a.a + 1 AS num FROM t1 a JOIN t1 b ON num = b.a;
-DROP TABLE t1;
-
-#
-# Bug#25126: Reference to non-existant column in UPDATE...ORDER BY...
-# crashes server
-#
-CREATE TABLE bug25126 (
- val int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY
-);
---error 1054
-UPDATE bug25126 SET MissingCol = MissingCol;
---error 1054
-UPDATE bug25126 SET val = val ORDER BY MissingCol;
-UPDATE bug25126 SET val = val ORDER BY val;
-UPDATE bug25126 SET val = 1 ORDER BY val;
---error 1054
-UPDATE bug25126 SET val = 1 ORDER BY MissingCol;
---error 1054
-UPDATE bug25126 SET val = 1 ORDER BY val, MissingCol;
---error 1054
-UPDATE bug25126 SET val = MissingCol ORDER BY MissingCol;
---error 1054
-UPDATE bug25126 SET MissingCol = 1 ORDER BY val, MissingCol;
---error 1054
-UPDATE bug25126 SET MissingCol = 1 ORDER BY MissingCol;
---error 1054
-UPDATE bug25126 SET MissingCol = val ORDER BY MissingCol;
---error 1054
-UPDATE bug25126 SET MissingCol = MissingCol ORDER BY MissingCol;
-DROP TABLE bug25126;
-
-#
-# Bug #25427: crash when order by expression contains a name
-# that cannot be resolved unambiguously
-#
-
-CREATE TABLE t1 (a int);
-
-SELECT p.a AS val, q.a AS val1 FROM t1 p, t1 q ORDER BY val > 1;
---error 1052
-SELECT p.a AS val, q.a AS val FROM t1 p, t1 q ORDER BY val;
---error 1052
-SELECT p.a AS val, q.a AS val FROM t1 p, t1 q ORDER BY val > 1;
-
-DROP TABLE t1;
-
-#
-# Bug #27532: ORDER/GROUP BY expressions with IN/BETWEEN and NOT IN/BETWEEN
-#
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (3), (2), (4), (1);
-
-SELECT a, IF(a IN (2,3), a, a+10) FROM t1
- ORDER BY IF(a IN (2,3), a, a+10);
-SELECT a, IF(a NOT IN (2,3), a, a+10) FROM t1
- ORDER BY IF(a NOT IN (2,3), a, a+10);
-SELECT a, IF(a IN (2,3), a, a+10) FROM t1
- ORDER BY IF(a NOT IN (2,3), a, a+10);
-
-SELECT a, IF(a BETWEEN 2 AND 3, a, a+10) FROM t1
- ORDER BY IF(a BETWEEN 2 AND 3, a, a+10);
-SELECT a, IF(a NOT BETWEEN 2 AND 3, a, a+10) FROM t1
- ORDER BY IF(a NOT BETWEEN 2 AND 3, a, a+10);
-SELECT a, IF(a BETWEEN 2 AND 3, a, a+10) FROM t1
- ORDER BY IF(a NOT BETWEEN 2 AND 3, a, a+10);
-
-SELECT IF(a IN (1,2), a, '') as x1, IF(a NOT IN (1,2), a, '') as x2
- FROM t1 GROUP BY x1, x2;
-SELECT IF(a IN (1,2), a, '') as x1, IF(a NOT IN (1,2), a, '') as x2
- FROM t1 GROUP BY x1, IF(a NOT IN (1,2), a, '');
-
-# The remaining queries are for better coverage
-SELECT a, a IN (1,2) FROM t1 ORDER BY a IN (1,2);
-SELECT a FROM t1 ORDER BY a IN (1,2);
-SELECT a+10 FROM t1 ORDER BY a IN (1,2);
-SELECT a, IF(a IN (1,2), a, a+10) FROM t1
- ORDER BY IF(a IN (3,4), a, a+10);
-DROP TABLE t1;
-
-# End of 4.1
-create table t1 (a int not null, b int not null, c int not null);
-insert t1 values (1,1,1),(1,1,2),(1,2,1);
-select a, b from t1 group by a, b order by sum(c);
-drop table t1;
-
-#
-# Bug#21302: Result not properly sorted when using an ORDER BY on a second
-# table in a join
-#
-CREATE TABLE t1 (a int, b int, PRIMARY KEY (a));
-INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
-
-explain SELECT t1.b as a, t2.b as c FROM
- t1 LEFT JOIN t1 t2 ON (t1.a = t2.a AND t2.a = 2)
-ORDER BY c;
-SELECT t2.b as c FROM
- t1 LEFT JOIN t1 t2 ON (t1.a = t2.a AND t2.a = 2)
-ORDER BY c;
-
-# check that it still removes sort of const table
-explain SELECT t1.b as a, t2.b as c FROM
- t1 JOIN t1 t2 ON (t1.a = t2.a AND t2.a = 2)
-ORDER BY c;
-
-CREATE TABLE t2 LIKE t1;
-INSERT INTO t2 SELECT * from t1;
-CREATE TABLE t3 LIKE t1;
-INSERT INTO t3 SELECT * from t1;
-CREATE TABLE t4 LIKE t1;
-INSERT INTO t4 SELECT * from t1;
-INSERT INTO t1 values (0,0),(4,4);
-
-SELECT t2.b FROM t1 LEFT JOIN (t2, t3 LEFT JOIN t4 ON t3.a=t4.a)
-ON (t1.a=t2.a AND t1.b=t3.b) order by t2.b;
-
-DROP TABLE t1,t2,t3,t4;
-
-#
-# Bug#25376: Incomplete setup of ORDER BY clause results in a wrong result.
-#
-create table t1 (a int, b int, c int);
-insert into t1 values (1,2,3), (9,8,3), (19,4,3), (1,4,9);
-select a,(sum(b)/sum(c)) as ratio from t1 group by a order by sum(b)/sum(c) asc;
-drop table t1;
-
-#
-# Bug#26672: Incorrect SEC_TO_TIME() casting in ORDER BY
-#
-CREATE TABLE t1 (a INT UNSIGNED NOT NULL, b TIME);
-INSERT INTO t1 (a) VALUES (100000), (0), (100), (1000000),(10000), (1000), (10);
-UPDATE t1 SET b = SEC_TO_TIME(a);
-
-# Correct ORDER
-SELECT a, b FROM t1 ORDER BY b DESC;
-
-# must be ordered as the above
-SELECT a, b FROM t1 ORDER BY SEC_TO_TIME(a) DESC;
-
-DROP TABLE t1;
-
-#
-# BUG#16590: Optimized does not do right "const" table pre-read
-#
-CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a), UNIQUE KEY b (b));
-INSERT INTO t1 VALUES (1,1),(2,2);
-
-CREATE TABLE t2 (a INT, b INT, KEY a (a,b));
-INSERT INTO t2 VALUES (1,1),(1,2),(2,1),(2,2);
-
-EXPLAIN SELECT 1 FROM t1,t2 WHERE t1.b=2 AND t1.a=t2.a ORDER BY t2.b;
-
-DROP TABLE t1,t2;
-
-# End of 5.0
-
-#
-# Bug #28404: query with ORDER BY and ref access
-#
-
-CREATE TABLE t1(
- id int auto_increment PRIMARY KEY, c2 int, c3 int, INDEX k2(c2), INDEX k3(c3));
-
-INSERT INTO t1 (c2,c3) VALUES
- (31,34),(35,38),(34,31),(32,35),(31,39),
- (11,14),(15,18),(14,11),(12,15),(11,19);
-
-INSERT INTO t1 (c2,c3) SELECT c2,c3 FROM t1;
-INSERT INTO t1 (c2,c3) SELECT c2,c3 FROM t1;
-INSERT INTO t1 (c2,c3) SELECT c2,c3 FROM t1;
-INSERT INTO t1 (c2,c3) SELECT c2,c3 FROM t1;
-INSERT INTO t1 (c2,c3) SELECT c2,c3 FROM t1;
-INSERT INTO t1 (c2,c3) SELECT c2,c3 FROM t1;
-INSERT INTO t1 (c2,c3) SELECT c2,c3 FROM t1;
-INSERT INTO t1 (c2,c3) SELECT c2,c3 FROM t1;
-INSERT INTO t1 (c2,c3) SELECT c2,c3 FROM t1;
-INSERT INTO t1 (c2,c3) SELECT c2,c3 FROM t1;
-INSERT INTO t1 (c2,c3) SELECT c2,c3 FROM t1;
-INSERT INTO t1 (c2,c3) SELECT c2,c3 FROM t1;
-UPDATE t1 SET c2=20 WHERE id%100 = 0;
-SELECT COUNT(*) FROM t1;
-
-CREATE TABLE t2 LIKE t1;
-INSERT INTO t2 SELECT * FROM t1 ORDER BY id;
-
-EXPLAIN SELECT id,c3 FROM t2 WHERE c2=11 ORDER BY c3 LIMIT 20;
-EXPLAIN SELECT id,c3 FROM t2 WHERE c2=11 ORDER BY c3 LIMIT 4000;
-EXPLAIN SELECT id,c3 FROM t2 WHERE c2 BETWEEN 10 AND 12 ORDER BY c3 LIMIT 20;
-EXPLAIN SELECT id,c3 FROM t2 WHERE c2 BETWEEN 20 AND 30 ORDER BY c3 LIMIT 4000;
-
-SELECT id,c3 FROM t2 WHERE c2=11 ORDER BY c3 LIMIT 20;
-
-DROP TABLE t1,t2;
-
-#
-# Bug #30665: Inconsistent optimization of IGNORE INDEX FOR {ORDER BY|GROUP BY}
-#
-CREATE TABLE t1 (
- a INT,
- b INT,
- PRIMARY KEY (a),
- KEY ab(a, b)
-);
-INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4);
-INSERT INTO t1 SELECT a + 4, b + 4 FROM t1;
-INSERT INTO t1 SELECT a + 8, b + 8 FROM t1;
-INSERT INTO t1 SELECT a +16, b +16 FROM t1;
-INSERT INTO t1 SELECT a +32, b +32 FROM t1;
-INSERT INTO t1 SELECT a +64, b +64 FROM t1;
-
-EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (a, ab) GROUP BY a;
-
---disable_query_log
---let $q = `show status like 'Created_tmp_tables';`
-eval set @tmp_tables_before =
- CAST(REPLACE('$q', 'Created_tmp_tables', '') AS UNSIGNED);
---enable_query_log
-
-SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (a, ab) GROUP BY a;
-
-# this query creates one temporary table in itself, which we are not
-# interested in.
-
---disable_query_log
---let $q = `show status like 'Created_tmp_tables';`
-eval set @tmp_tables_after =
- CAST(REPLACE('$q', 'Created_tmp_tables', '') AS UNSIGNED);
---enable_query_log
-
-SELECT @tmp_tables_after = @tmp_tables_before ;
-
-EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (a, ab) ORDER BY a;
-
---disable_query_log
---let $q = `show status like 'Created_tmp_tables';`
-eval set @tmp_tables_before =
- CAST(REPLACE('$q', 'Created_tmp_tables', '') AS UNSIGNED);
---enable_query_log
-
-SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (a, ab) ORDER BY a;
-
---disable_query_log
---let $q = `show status like 'Created_tmp_tables';`
-eval set @tmp_tables_after =
- CAST(REPLACE('$q', 'Created_tmp_tables', '') AS UNSIGNED);
---enable_query_log
-
-SELECT @tmp_tables_after = @tmp_tables_before;
-
-DROP TABLE t1;
---echo #
---echo # Bug#31590: Wrong error message on sort buffer being too small.
---echo #
-create table t1(a int, b tinytext);
-insert into t1 values (1,2),(3,2);
-set session sort_buffer_size= 1000;
-set session max_sort_length= 2180;
-CALL mtr.add_suppression("Out of sort memory");
---error ER_OUT_OF_SORTMEMORY
-select * from t1 order by b;
-drop table t1;
-set session sort_buffer_size= 30000;
-
---echo #
---echo # Bug #39844: Query Crash Mysql Server 5.0.67
---echo #
-
-CREATE TABLE t1 (a INT PRIMARY KEY);
-CREATE TABLE t2 (a INT PRIMARY KEY, b INT);
-CREATE TABLE t3 (c INT);
-
-INSERT INTO t1 (a) VALUES (1), (2);
-INSERT INTO t2 (a,b) VALUES (1,2), (2,3);
-INSERT INTO t3 (c) VALUES (1), (2);
-
-SELECT
- (SELECT t1.a FROM t1, t2 WHERE t1.a = t2.b AND t2.a = t3.c ORDER BY t1.a)
- FROM t3;
-
-DROP TABLE t1, t2, t3;
-
-
---echo #
---echo # Bug #42760: Select doesn't return desired results when we have null
---echo # values
---echo #
-
-CREATE TABLE t1 (
- a INT,
- c INT,
- UNIQUE KEY a_c (a,c),
- KEY (a));
-
-INSERT INTO t1 VALUES (1, 10), (2, NULL);
-
---echo # Must use ref-or-null on the a_c index
-EXPLAIN
-SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c;
---echo # Must return 1 row
-SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c;
-
-# part 2 of the problem : DESC test cases
---echo # Must use ref-or-null on the a_c index
---replace_column 1 x 2 x 3 x 6 x 7 x 8 x 9 x 10 x
-EXPLAIN
-SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c DESC;
---echo # Must return 1 row
-SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c DESC;
-
-
-DROP TABLE t1;
-
-
---echo End of 5.0 tests
-
-
-#
-# Bug #35206: select query result different if the key is indexed or not
-#
-
-CREATE TABLE t2 (a varchar(32), b int(11), c float, d double,
- UNIQUE KEY a (a,b,c), KEY b (b), KEY c (c));
-
-CREATE TABLE t1 (a varchar(32), b char(3), UNIQUE KEY a (a,b), KEY b (b));
-CREATE TABLE t3 (a varchar(32), b char(3), UNIQUE KEY a (a,b));
-
---disable_query_log
-INSERT INTO t1 (a, b) VALUES
-('domestic', 'CH'), ('domestic', 'LI'), ('plfcz1', 'FR'), ('all', 'AD'),
-('all', 'AE'), ('all', 'AF'), ('all', 'AG'), ('all', 'AI'), ('all', 'AL'),
-('all', 'AM'), ('all', 'AN'), ('all', 'AO'), ('all', 'AP'), ('all', 'AQ'),
-('all', 'AR'), ('all', 'AS'), ('all', 'AT'), ('all', 'AU'), ('all', 'AW'),
-('all', 'AZ'), ('all', 'BA'), ('all', 'BB'), ('all', 'BD'), ('all', 'BE'),
-('all', 'BF'), ('all', 'BG'), ('all', 'BH'), ('all', 'BI'), ('all', 'BJ'),
-('all', 'BM'), ('all', 'BN'), ('all', 'BO'), ('all', 'BR'), ('all', 'BS'),
-('all', 'BT'), ('all', 'BV'), ('all', 'BW'), ('all', 'BY'), ('all', 'BZ'),
-('all', 'CA'), ('all', 'CC'), ('all', 'CD'), ('all', 'CF'), ('all', 'CG'),
-('all', 'CH'), ('all', 'CI'), ('all', 'CK'), ('all', 'CL'), ('all', 'CM'),
-('all', 'CN'), ('all', 'CO'), ('all', 'CR'), ('all', 'CU'), ('all', 'CV'),
-('all', 'CX'), ('all', 'CY'), ('all', 'CZ'), ('all', 'DE'), ('all', 'DJ'),
-('all', 'DK'), ('all', 'DM'), ('all', 'DO'), ('all', 'DZ'), ('all', 'EC'),
-('all', 'EE'), ('all', 'EG'), ('all', 'EH'), ('all', 'EI'), ('all', 'ER'),
-('all', 'ES'), ('all', 'ET'), ('all', 'FI'), ('all', 'FJ'), ('all', 'FK'),
-('all', 'FM'), ('all', 'FO'), ('all', 'FR'), ('all', 'FX'), ('all', 'GA'),
-('all', 'GB'), ('all', 'GD'), ('all', 'GE'), ('all', 'GF'), ('all', 'GH'),
-('all', 'GI'), ('all', 'GL'), ('all', 'GM'), ('all', 'GN'), ('all', 'GP'),
-('all', 'GQ'), ('all', 'GR'), ('all', 'GS'), ('all', 'GT'), ('all', 'GU'),
-('all', 'GW'), ('all', 'GY'), ('all', 'HK'), ('all', 'HM'), ('all', 'HN'),
-( 'all', 'HR'), ( 'all', 'HT'), ( 'all', 'HU'), ( 'all', 'ID'), ( 'all', 'IE'),
-( 'all', 'IL'), ( 'all', 'IN'), ( 'all', 'IO'), ( 'all', 'IQ'), ( 'all', 'IR'),
-( 'all', 'IS'), ( 'all', 'IT'), ( 'all', 'JM'), ( 'all', 'JO'), ( 'all', 'JP'),
-( 'all', 'KE'), ( 'all', 'KG'), ( 'all', 'KH'), ( 'all', 'KI'), ( 'all', 'KM'),
-( 'all', 'KN'), ( 'all', 'KP'), ( 'all', 'KR'), ( 'all', 'KW'), ( 'all', 'KY'),
-( 'all', 'KZ'), ( 'all', 'LA'), ( 'all', 'LB'), ( 'all', 'LC'), ( 'all', 'LI'),
-( 'all', 'LK'), ( 'all', 'LR'), ( 'all', 'LS'), ( 'all', 'LT'), ( 'all', 'LU'),
-( 'all', 'LV'), ( 'all', 'LY'), ( 'all', 'MA'), ( 'all', 'MC'), ( 'all', 'MD'),
-( 'all', 'ME'), ( 'all', 'MG'), ( 'all', 'MH'), ( 'all', 'MK'), ( 'all', 'ML'),
-( 'all', 'MM'), ( 'all', 'MN'), ( 'all', 'MO'), ( 'all', 'MP'), ( 'all', 'MQ'),
-( 'all', 'MR'), ( 'all', 'MS'), ( 'all', 'MT'), ( 'all', 'MU'), ( 'all', 'MV'),
-( 'all', 'MW'), ( 'all', 'MX'), ( 'all', 'MY'), ( 'all', 'MZ'), ( 'all', 'NA'),
-( 'all', 'NC'), ( 'all', 'NE'), ( 'all', 'NF'), ( 'all', 'NG'), ( 'all', 'NI'),
-( 'all', 'NL'), ( 'all', 'NO'), ( 'all', 'NP'), ( 'all', 'NR'), ( 'all', 'NU'),
-( 'all', 'NV'), ( 'all', 'NZ'), ( 'all', 'OM'), ( 'all', 'PA'), ( 'all', 'PE'),
-( 'all', 'PF'), ( 'all', 'PG'), ( 'all', 'PH'), ( 'all', 'PK'), ( 'all', 'PL'),
-( 'all', 'PM'), ( 'all', 'PN'), ( 'all', 'PR'), ( 'all', 'PS'), ( 'all', 'PT'),
-( 'all', 'PW'), ( 'all', 'PY'), ( 'all', 'QA'), ( 'all', 'RE'), ( 'all', 'RO'),
-( 'all', 'RU'), ( 'all', 'RW'), ( 'all', 'SA'), ( 'all', 'SB'), ( 'all', 'SC'),
-( 'all', 'SD'), ( 'all', 'SE'), ( 'all', 'SG'), ( 'all', 'SH'), ( 'all', 'SI'),
-( 'all', 'SJ'), ( 'all', 'SK'), ( 'all', 'SL'), ( 'all', 'SM'), ( 'all', 'SN'),
-( 'all', 'SO'), ( 'all', 'SR'), ( 'all', 'ST'), ( 'all', 'SV'), ( 'all', 'SY'),
-( 'all', 'SZ'), ( 'all', 'TA'), ( 'all', 'TC'), ( 'all', 'TD'), ( 'all', 'TF'),
-( 'all', 'TG'), ( 'all', 'TH'), ( 'all', 'TJ'), ( 'all', 'TK'), ( 'all', 'TM'),
-( 'all', 'TN'), ( 'all', 'TO'), ( 'all', 'TP'), ( 'all', 'TR'), ( 'all', 'TT'),
-( 'all', 'TV'), ( 'all', 'TW'), ( 'all', 'TZ'), ( 'all', 'UA'), ( 'all', 'UG'),
-( 'all', 'UM'), ( 'all', 'US'), ( 'all', 'UY'), ( 'all', 'UZ'), ( 'all', 'VA'),
-( 'all', 'VC'), ( 'all', 'VE'), ( 'all', 'VG'), ( 'all', 'VI'), ( 'all', 'VN'),
-( 'all', 'VU'), ( 'all', 'WF'), ( 'all', 'WS'), ( 'plfcz1', 'FI'),
-( 'all', 'XE'), ( 'all', 'XS'), ( 'all', 'XU'), ( 'plfcz1', 'XE'),
-( 'all', 'YE'), ( 'all', 'YT'), ( 'all', 'YU'), ( 'all', 'ZA'), ( 'all', 'ZM'),
-( 'all', 'ZR'), ( 'all', 'ZW'), ( 'foreign', 'AD'), ( 'foreign', 'AE'),
-( 'foreign', 'AF'), ( 'foreign', 'AG'), ( 'foreign', 'AI'),
-( 'foreign', 'AL'), ( 'foreign', 'AM'), ( 'foreign', 'AN'), ( 'foreign', 'AO'),
-( 'foreign', 'AP'), ( 'foreign', 'AQ'), ( 'foreign', 'AR'), ( 'foreign', 'AS'),
-( 'foreign', 'AT'), ( 'foreign', 'AU'), ( 'foreign', 'AW'), ( 'foreign', 'AZ'),
-( 'foreign', 'BA'), ( 'foreign', 'BB'), ( 'foreign', 'BD'), ( 'foreign', 'BE'),
-( 'foreign', 'BF'), ( 'foreign', 'BG'), ( 'foreign', 'BH'), ( 'foreign', 'BI'),
-( 'foreign', 'BJ'), ( 'foreign', 'BM'), ( 'foreign', 'BN'), ( 'foreign', 'BO'),
-( 'foreign', 'BR'), ( 'foreign', 'BS'), ( 'foreign', 'BT'), ( 'foreign', 'BV'),
-( 'foreign', 'BW'), ( 'foreign', 'BY'), ( 'foreign', 'BZ'), ( 'foreign', 'CA'),
-( 'foreign', 'CC'), ( 'foreign', 'CD'), ( 'foreign', 'CF'), ( 'foreign', 'CG'),
-( 'foreign', 'CI'), ( 'foreign', 'CK'), ( 'foreign', 'CL'), ( 'foreign', 'CM'),
-( 'foreign', 'CN'), ( 'foreign', 'CO'), ( 'foreign', 'CR'), ( 'foreign', 'CU'),
-( 'foreign', 'CV'), ( 'foreign', 'CX'), ( 'foreign', 'CY'), ( 'foreign', 'CZ'),
-( 'foreign', 'DE'), ( 'foreign', 'DJ'), ( 'foreign', 'DK'), ( 'foreign', 'DM'),
-( 'foreign', 'DO'), ( 'foreign', 'DZ'), ( 'foreign', 'EC'), ( 'foreign', 'EE'),
-( 'foreign', 'EG'), ( 'foreign', 'EH'), ( 'foreign', 'EI'), ( 'foreign', 'ER'),
-( 'foreign', 'ES'), ( 'foreign', 'ET'), ( 'foreign', 'FI'), ( 'foreign', 'FJ'),
-( 'foreign', 'FK'), ( 'foreign', 'FM'), ( 'foreign', 'FO'), ( 'foreign', 'FR'),
-( 'foreign', 'FX'), ( 'foreign', 'GA'), ( 'foreign', 'GB'), ( 'foreign', 'GD'),
-( 'foreign', 'GE'), ( 'foreign', 'GF'), ( 'foreign', 'GH'), ( 'foreign', 'GI'),
-( 'foreign', 'GL'), ( 'foreign', 'GM'), ( 'foreign', 'GN'), ( 'foreign', 'GP'),
-( 'foreign', 'GQ'), ( 'foreign', 'GR'), ( 'foreign', 'GS'), ( 'foreign', 'GT'),
-( 'foreign', 'GU'), ( 'foreign', 'GW'), ( 'foreign', 'GY'), ( 'foreign', 'HK'),
-( 'foreign', 'HM'), ( 'foreign', 'HN'), ( 'foreign', 'HR'), ( 'foreign', 'HT'),
-( 'foreign', 'HU'), ( 'foreign', 'ID'), ( 'foreign', 'IE'), ( 'foreign', 'IL'),
-( 'foreign', 'IN'), ( 'foreign', 'IO'), ( 'foreign', 'IQ'), ( 'foreign', 'IR'),
-( 'foreign', 'IS'), ( 'foreign', 'IT'), ( 'foreign', 'JM'), ( 'foreign', 'JO'),
-( 'foreign', 'JP'), ( 'foreign', 'KE'), ( 'foreign', 'KG'), ( 'foreign', 'KH'),
-( 'foreign', 'KI'), ( 'foreign', 'KM'), ( 'foreign', 'KN'), ( 'foreign', 'KP'),
-( 'foreign', 'KR'), ( 'foreign', 'KW'), ( 'foreign', 'KY'), ( 'foreign', 'KZ'),
-( 'foreign', 'LA'), ( 'foreign', 'LB'), ( 'foreign', 'LC'), ( 'foreign', 'LK'),
-( 'foreign', 'LR'), ( 'foreign', 'LS'), ( 'foreign', 'LT'), ( 'foreign', 'LU'),
-( 'foreign', 'LV'), ( 'foreign', 'LY'), ( 'foreign', 'MA'), ( 'foreign', 'MC'),
-( 'foreign', 'MD'), ( 'foreign', 'ME'), ( 'foreign', 'MG'), ( 'foreign', 'MH'),
-( 'foreign', 'MK'), ( 'foreign', 'ML'), ( 'foreign', 'MM'), ( 'foreign', 'MN'),
-( 'foreign', 'MO'), ( 'foreign', 'MP'), ( 'foreign', 'MQ'), ( 'foreign', 'MR'),
-( 'foreign', 'MS'), ( 'foreign', 'MT'), ( 'foreign', 'MU'), ( 'foreign', 'MV'),
-( 'foreign', 'MW'), ( 'foreign', 'MX'), ( 'foreign', 'MY'), ( 'foreign', 'MZ'),
-( 'foreign', 'NA'), ( 'foreign', 'NC'), ( 'foreign', 'NE'), ( 'foreign', 'NF'),
-( 'foreign', 'NG'), ( 'foreign', 'NI'), ( 'foreign', 'NL'), ( 'foreign', 'NO'),
-( 'foreign', 'NP'), ( 'foreign', 'NR'), ( 'foreign', 'NU'), ( 'foreign', 'NV'),
-( 'foreign', 'NZ'), ( 'foreign', 'OM'), ( 'foreign', 'PA'), ( 'foreign', 'PE'),
-( 'foreign', 'PF'), ( 'foreign', 'PG'), ( 'foreign', 'PH'), ( 'foreign', 'PK'),
-( 'foreign', 'PL'), ( 'foreign', 'PM'), ( 'foreign', 'PN'), ( 'foreign', 'PR'),
-( 'foreign', 'PS'), ( 'foreign', 'PT'), ( 'foreign', 'PW'), ( 'foreign', 'PY'),
-( 'foreign', 'QA'), ( 'foreign', 'RE'), ( 'foreign', 'RO'), ( 'foreign', 'RU'),
-( 'foreign', 'RW'), ( 'foreign', 'SA'), ( 'foreign', 'SB'), ( 'foreign', 'SC'),
-( 'foreign', 'SD'), ( 'foreign', 'SE'), ( 'foreign', 'SG'), ( 'foreign', 'SH'),
-( 'foreign', 'SI'), ( 'foreign', 'SJ'), ( 'foreign', 'SK'), ( 'foreign', 'SL'),
-( 'foreign', 'SM'), ( 'foreign', 'SN'), ( 'foreign', 'SO'), ( 'foreign', 'SR'),
-( 'foreign', 'ST'), ( 'foreign', 'SV'), ( 'foreign', 'SY'), ( 'foreign', 'SZ'),
-( 'foreign', 'TA'), ( 'foreign', 'TC'), ( 'foreign', 'TD'), ( 'foreign', 'TF'),
-( 'foreign', 'TG'), ( 'foreign', 'TH'), ( 'foreign', 'TJ'), ( 'foreign', 'TK'),
-( 'foreign', 'TM'), ( 'foreign', 'TN'), ( 'foreign', 'TO'), ( 'foreign', 'TP'),
-( 'foreign', 'TR'), ( 'foreign', 'TT'), ( 'foreign', 'TV'), ( 'foreign', 'TW'),
-( 'foreign', 'TZ'), ( 'foreign', 'UA'), ( 'foreign', 'UG'), ( 'foreign', 'UM'),
-( 'foreign', 'US'), ( 'foreign', 'UY'), ( 'foreign', 'UZ'), ( 'foreign', 'VA'),
-( 'foreign', 'VC'), ( 'foreign', 'VE'), ( 'foreign', 'VG'), ( 'foreign', 'VI'),
-( 'foreign', 'VN'), ( 'foreign', 'VU'), ( 'foreign', 'WF'), ( 'foreign', 'WS'),
-( 'plfcz1', 'DK'), ( 'foreign', 'XE'), ( 'foreign', 'XS'), ( 'foreign', 'XU'),
-( 'plfcz1', 'BE'), ( 'foreign', 'YE'), ( 'foreign', 'YT'), ( 'foreign', 'YU'),
-( 'foreign', 'ZA'), ( 'foreign', 'ZM'), ( 'foreign', 'ZR'), ( 'foreign', 'ZW'),
-( 'plfcz1', 'DE'), ( 'plfcz1', 'GI'), ( 'plfcz1', 'GR'), ( 'plfcz1', 'IS'),
-( 'plfcz1', 'EI'), ( 'plfcz1', 'IT'), ( 'plfcz1', 'LU'), ( 'plfcz1', 'NL'),
-( 'plfcz1', 'NO'), ( 'plfcz1', 'ES'), ( 'plfcz1', 'SE'), ( 'plfcz1', 'AL'),
-( 'plfcz1', 'AD'), ( 'plfcz1', 'BY'), ( 'plfcz1', 'BA'), ( 'plfcz1', 'BG'),
-( 'plfcz1', 'EE'), ( 'plfcz1', 'FO'), ( 'plfcz1', 'GL'), ( 'plfcz1', 'GB'),
-( 'plfcz1', 'HR'), ( 'plfcz1', 'LV'), ( 'plfcz1', 'LT'), ( 'plfcz1', 'MT'),
-( 'plfcz1', 'MK'), ( 'plfcz1', 'MD'), ( 'plfcz1', 'MC'), ( 'plfcz1', 'AT'),
-( 'plfcz1', 'PL'), ( 'plfcz1', 'PT'), ( 'plfcz1', 'RO'), ( 'plfcz1', 'RU'),
-( 'plfcz1', 'SM'), ( 'plfcz1', 'XS'), ( 'plfcz1', 'SK'), ( 'plfcz1', 'SI'),
-( 'plfcz1', 'CZ'), ( 'plfcz1', 'TR'), ( 'plfcz1', 'UA'), ( 'plfcz1', 'HU'),
-( 'plfcz1', 'VA'), ( 'plfcz1', 'CY'), ( 'plfcz2', 'AF'), ( 'plfcz2', 'DZ'),
-( 'plfcz2', 'AS'), ( 'plfcz2', 'AO'), ( 'plfcz2', 'AI'), ( 'plfcz2', 'AQ'),
-( 'plfcz2', 'AG'), ( 'plfcz2', 'AR'), ( 'plfcz2', 'AM'), ( 'plfcz2', 'AW'),
-( 'plfcz2', 'AU'), ( 'plfcz2', 'AZ'), ( 'plfcz2', 'AP'), ( 'plfcz2', 'BS'),
-( 'plfcz2', 'BH'), ( 'plfcz2', 'BD'), ( 'plfcz2', 'BB'), ( 'plfcz2', 'BZ'),
-( 'plfcz2', 'BJ'), ( 'plfcz2', 'BM'), ( 'plfcz2', 'BT'), ( 'plfcz2', 'BO'),
-( 'plfcz2', 'BW'), ( 'plfcz2', 'BV'), ( 'plfcz2', 'BR'), ( 'plfcz2', 'IO'),
-( 'plfcz2', 'VG'), ( 'plfcz2', 'BN'), ( 'plfcz2', 'BF'), ( 'plfcz2', 'BI'),
-( 'plfcz2', 'KH'), ( 'plfcz2', 'CM'), ( 'plfcz2', 'CA'), ( 'plfcz2', 'CV'),
-( 'plfcz2', 'KY'), ( 'plfcz2', 'CF'), ( 'plfcz2', 'TD'), ( 'plfcz2', 'CL'),
-( 'plfcz2', 'CN'), ( 'plfcz2', 'CX'), ( 'plfcz2', 'CC'), ( 'plfcz2', 'CO'),
-( 'plfcz2', 'KM'), ( 'plfcz2', 'CG'), ( 'plfcz2', 'CD'), ( 'plfcz2', 'CK'),
-( 'plfcz2', 'CR'), ( 'plfcz2', 'CI'), ( 'plfcz2', 'CU'), ( 'plfcz2', 'DJ'),
-( 'plfcz2', 'DM'), ( 'plfcz2', 'DO'), ( 'plfcz2', 'TP'), ( 'plfcz2', 'EC'),
-( 'plfcz2', 'EG'), ( 'plfcz2', 'SV'), ( 'plfcz2', 'GQ'), ( 'plfcz2', 'ER'),
-( 'plfcz2', 'ET'), ( 'plfcz2', 'FK'), ( 'plfcz2', 'FJ'), ( 'plfcz2', 'FX'),
-( 'plfcz2', 'GF'), ( 'plfcz2', 'PF'), ( 'plfcz2', 'TA'), ( 'plfcz2', 'TF'),
-( 'plfcz2', 'GA'), ( 'plfcz2', 'GM'), ( 'plfcz2', 'GE'), ( 'plfcz2', 'GH'),
-( 'plfcz2', 'GD'), ( 'plfcz2', 'GP'), ( 'plfcz2', 'GU'), ( 'plfcz2', 'GT'),
-( 'plfcz2', 'GN'), ( 'plfcz2', 'GW'), ( 'plfcz2', 'GY'), ( 'plfcz2', 'HT'),
-( 'plfcz2', 'HM'), ( 'plfcz2', 'HN'), ( 'plfcz2', 'HK'), ( 'plfcz2', 'IN'),
-( 'plfcz2', 'ID'), ( 'plfcz2', 'IR'), ( 'plfcz2', 'IQ'), ( 'plfcz2', 'IE'),
-( 'plfcz2', 'IL'), ( 'plfcz2', 'JM'), ( 'plfcz2', 'JP'), ( 'plfcz2', 'JO'),
-( 'plfcz2', 'KZ'), ( 'plfcz2', 'KE'), ( 'plfcz2', 'KI'), ( 'plfcz2', 'KP'),
-( 'plfcz2', 'KW'), ( 'plfcz2', 'KG'), ( 'plfcz2', 'LA'), ( 'plfcz2', 'LB'),
-( 'plfcz2', 'LS'), ( 'plfcz2', 'LR'), ( 'plfcz2', 'LY'), ( 'plfcz2', 'MO'),
-( 'plfcz2', 'MG'), ( 'plfcz2', 'ME'), ( 'plfcz2', 'MW'), ( 'plfcz2', 'MY'),
-( 'plfcz2', 'MV'), ( 'plfcz2', 'ML'), ( 'plfcz2', 'MH'), ( 'plfcz2', 'MQ'),
-( 'plfcz2', 'MR'), ( 'plfcz2', 'MU'), ( 'plfcz2', 'YT'), ( 'plfcz2', 'MX'),
-( 'plfcz2', 'FM'), ( 'plfcz2', 'MN'), ( 'plfcz2', 'MS'), ( 'plfcz2', 'MA'),
-( 'plfcz2', 'MZ'), ( 'plfcz2', 'MM'), ( 'plfcz2', 'NA'), ( 'plfcz2', 'NR'),
-( 'plfcz2', 'NP'), ( 'plfcz2', 'AN'), ( 'plfcz2', 'NC'), ( 'plfcz2', 'NZ'),
-( 'plfcz2', 'NI'), ( 'plfcz2', 'NE'), ( 'plfcz2', 'NG'), ( 'plfcz2', 'NU'),
-( 'plfcz2', 'NF'), ( 'plfcz2', 'MP'), ( 'plfcz2', 'OM'), ( 'plfcz2', 'PK'),
-( 'plfcz2', 'PW'), ( 'plfcz2', 'PS'), ( 'plfcz2', 'PA'), ( 'plfcz2', 'PG'),
-( 'plfcz2', 'PY'), ( 'plfcz2', 'PE'), ( 'plfcz2', 'PH'), ( 'plfcz2', 'PN'),
-( 'plfcz2', 'PR'), ( 'plfcz2', 'QA'), ( 'plfcz2', 'RE'), ( 'plfcz2', 'RW'),
-( 'plfcz2', 'KN'), ( 'plfcz2', 'ST'), ( 'plfcz2', 'SA'), ( 'plfcz2', 'SN'),
-( 'plfcz2', 'SC'), ( 'plfcz2', 'SL'), ( 'plfcz2', 'SG'), ( 'plfcz2', 'SB'),
-( 'plfcz2', 'SO'), ( 'plfcz2', 'ZA'), ( 'plfcz2', 'GS'), ( 'plfcz2', 'KR'),
-( 'plfcz2', 'LK'), ( 'plfcz2', 'NV'), ( 'plfcz2', 'SH'), ( 'plfcz2', 'LC'),
-( 'plfcz2', 'PM'), ( 'plfcz2', 'VC'), ( 'plfcz2', 'SD'), ( 'plfcz2', 'SR'),
-( 'plfcz2', 'SJ'), ( 'plfcz2', 'SZ'), ( 'plfcz2', 'SY'), ( 'plfcz2', 'TW'),
-( 'plfcz2', 'TJ'), ( 'plfcz2', 'TZ'), ( 'plfcz2', 'TH'), ( 'plfcz2', 'TG'),
-( 'plfcz2', 'TK'), ( 'plfcz2', 'TO'), ( 'plfcz2', 'TT'), ( 'plfcz2', 'XU'),
-( 'plfcz2', 'TN'), ( 'plfcz2', 'TM'), ( 'plfcz2', 'TC'), ( 'plfcz2', 'TV'),
-( 'plfcz2', 'UG'), ( 'plfcz2', 'AE'), ( 'plfcz2', 'US'), ( 'plfcz2', 'UM'),
-( 'plfcz2', 'UY'), ( 'plfcz2', 'UZ'), ( 'plfcz2', 'VU'), ( 'plfcz2', 'VE'),
-( 'plfcz2', 'VN'), ( 'plfcz2', 'VI'), ( 'plfcz2', 'WF'), ( 'plfcz2', 'EH'),
-( 'plfcz2', 'WS'), ( 'plfcz2', 'YE'), ( 'plfcz2', 'YU'), ( 'plfcz2', 'ZR'),
-( 'plfcz2', 'ZM'), ( 'plfcz2', 'ZW'), ( 'ppfcz1', 'AT'), ( 'ppfcz1', 'BE'),
-( 'ppfcz1', 'DE'), ( 'ppfcz1', 'FR'), ( 'ppfcz1', 'FX'), ( 'ppfcz1', 'IT'),
-( 'ppfcz1', 'LU'), ( 'ppfcz1', 'MC'), ( 'ppfcz1', 'NL'), ( 'ppfcz1', 'SM'),
-( 'ppfcz1', 'VA'), ( 'ppfcz1', 'XE'), ( 'ppfcz2', 'AD'), ( 'ppfcz2', 'AL'),
-( 'ppfcz2', 'BA'), ( 'ppfcz2', 'BG'), ( 'ppfcz2', 'BY'), ( 'ppfcz2', 'CY'),
-( 'ppfcz2', 'CZ'), ( 'ppfcz2', 'DK'), ( 'ppfcz2', 'EE'), ( 'ppfcz2', 'EI'),
-( 'ppfcz2', 'ES'), ( 'ppfcz2', 'FI'), ( 'ppfcz2', 'FO'), ( 'ppfcz2', 'GB'),
-( 'ppfcz2', 'GI'), ( 'ppfcz2', 'GL'), ( 'ppfcz2', 'GR'), ( 'ppfcz2', 'HR'),
-( 'ppfcz2', 'HU'), ( 'ppfcz2', 'IE'), ( 'ppfcz2', 'IS'), ( 'ppfcz2', 'LT'),
-( 'ppfcz2', 'LV'), ( 'ppfcz2', 'MD'), ( 'ppfcz2', 'MK'), ( 'ppfcz2', 'MT'),
-( 'ppfcz2', 'NO'), ( 'ppfcz2', 'PL'), ( 'ppfcz2', 'PT'), ( 'ppfcz2', 'RO'),
-( 'ppfcz2', 'RU'), ( 'ppfcz2', 'SE'), ( 'ppfcz2', 'SI'), ( 'ppfcz2', 'SK'),
-( 'ppfcz2', 'TR'), ( 'ppfcz2', 'UA'), ( 'ppfcz2', 'XS'), ( 'ppfcz2', 'YU'),
-( 'ppfcz3', 'CA'), ( 'ppfcz3', 'DZ'), ( 'ppfcz3', 'EG'), ( 'ppfcz3', 'IL'),
-( 'ppfcz3', 'JO'), ( 'ppfcz3', 'LB'), ( 'ppfcz3', 'LY'), ( 'ppfcz3', 'MA'),
-( 'ppfcz3', 'MX'), ( 'ppfcz3', 'PM'), ( 'ppfcz3', 'SY'), ( 'ppfcz3', 'TN'),
-( 'ppfcz3', 'US'), ( 'ppfcz4', 'AE'), ( 'ppfcz4', 'AF'), ( 'ppfcz4', 'AM'),
-( 'ppfcz4', 'AO'), ( 'ppfcz4', 'AZ'), ( 'ppfcz4', 'BD'), ( 'ppfcz4', 'BF'),
-( 'ppfcz4', 'BH'), ( 'ppfcz4', 'BI'), ( 'ppfcz4', 'BJ'), ( 'ppfcz4', 'BT'),
-( 'ppfcz4', 'BV'), ( 'ppfcz4', 'BW'), ( 'ppfcz4', 'CF'), ( 'ppfcz4', 'CG'),
-( 'ppfcz4', 'CI'), ( 'ppfcz4', 'CM'), ( 'ppfcz4', 'CN'), ( 'ppfcz4', 'DJ'),
-( 'ppfcz4', 'DO'), ( 'ppfcz4', 'ER'), ( 'ppfcz4', 'ET'), ( 'ppfcz4', 'GA'),
-( 'ppfcz4', 'GE'), ( 'ppfcz4', 'GH'), ( 'ppfcz4', 'GM'), ( 'ppfcz4', 'GN'),
-( 'ppfcz4', 'GQ'), ( 'ppfcz4', 'GW'), ( 'ppfcz4', 'HK'), ( 'ppfcz4', 'IN'),
-( 'ppfcz4', 'IQ'), ( 'ppfcz4', 'IR'), ( 'ppfcz4', 'JP'), ( 'ppfcz4', 'KE'),
-( 'ppfcz4', 'KG'), ( 'ppfcz4', 'KH'), ( 'ppfcz4', 'KP'), ( 'ppfcz4', 'KW'),
-( 'ppfcz4', 'KZ'), ( 'ppfcz4', 'LA'), ( 'ppfcz4', 'LK'), ( 'ppfcz4', 'LR'),
-( 'ppfcz4', 'LS'), ( 'ppfcz4', 'MG'), ( 'ppfcz4', 'ML'), ( 'ppfcz4', 'MM'),
-( 'ppfcz4', 'MN'), ( 'ppfcz4', 'MO'), ( 'ppfcz4', 'MR'), ( 'ppfcz4', 'MU'),
-( 'ppfcz4', 'MV'), ( 'ppfcz4', 'MW'), ( 'ppfcz4', 'MY'), ( 'ppfcz4', 'MZ'),
-( 'ppfcz4', 'NA'), ( 'ppfcz4', 'NE'), ( 'ppfcz4', 'NG'), ( 'ppfcz4', 'NP'),
-( 'ppfcz4', 'OM'), ( 'ppfcz4', 'PK'), ( 'ppfcz4', 'QA'), ( 'ppfcz4', 'RE'),
-( 'ppfcz4', 'RW'), ( 'ppfcz4', 'SA'), ( 'ppfcz4', 'SC'), ( 'ppfcz4', 'SD'),
-( 'ppfcz4', 'SG'), ( 'ppfcz4', 'SH'), ( 'ppfcz4', 'SL'), ( 'ppfcz4', 'SN'),
-( 'ppfcz4', 'SO'), ( 'ppfcz4', 'SZ'), ( 'ppfcz4', 'TD'), ( 'ppfcz4', 'TG'),
-( 'ppfcz4', 'TH'), ( 'ppfcz4', 'TJ'), ( 'ppfcz4', 'TM'), ( 'ppfcz4', 'TW'),
-( 'ppfcz4', 'TZ'), ( 'ppfcz4', 'UG'), ( 'ppfcz4', 'UZ'), ( 'ppfcz4', 'VN'),
-( 'ppfcz4', 'XU'), ( 'ppfcz4', 'YT'), ( 'ppfcz4', 'ZA'), ( 'ppfcz4', 'ZW'),
-( 'ppfcz5', 'AG'), ( 'ppfcz5', 'AI'), ( 'ppfcz5', 'AN'), ( 'ppfcz5', 'AP'),
-( 'ppfcz5', 'AQ'), ( 'ppfcz5', 'AR'), ( 'ppfcz5', 'AS'), ( 'ppfcz5', 'AU'),
-( 'ppfcz5', 'AW'), ( 'ppfcz5', 'BB'), ( 'ppfcz5', 'BM'), ( 'ppfcz5', 'BN'),
-( 'ppfcz5', 'BO'), ( 'ppfcz5', 'BR'), ( 'ppfcz5', 'BS'), ( 'ppfcz5', 'BZ'),
-( 'ppfcz5', 'CC'), ( 'ppfcz5', 'CD'), ( 'ppfcz5', 'CK'), ( 'ppfcz5', 'CL'),
-( 'ppfcz5', 'CO'), ( 'ppfcz5', 'CR'), ( 'ppfcz5', 'CU'), ( 'ppfcz5', 'CV'),
-( 'ppfcz5', 'CX'), ( 'ppfcz5', 'DM'), ( 'ppfcz5', 'EC'), ( 'ppfcz5', 'EH'),
-( 'ppfcz5', 'FJ'), ( 'ppfcz5', 'FK'), ( 'ppfcz5', 'FM'), ( 'ppfcz5', 'GD'),
-( 'ppfcz5', 'GF'), ( 'ppfcz5', 'GP'), ( 'ppfcz5', 'GS'), ( 'ppfcz5', 'GT'),
-( 'ppfcz5', 'GU'), ( 'ppfcz5', 'GY'), ( 'ppfcz5', 'HM'), ( 'ppfcz5', 'HN'),
-( 'ppfcz5', 'HT'), ( 'ppfcz5', 'ID'), ( 'ppfcz5', 'IO'), ( 'ppfcz5', 'JM'),
-( 'ppfcz5', 'KI'), ( 'ppfcz5', 'KM'), ( 'ppfcz5', 'KN'), ( 'ppfcz5', 'KR'),
-( 'ppfcz5', 'KY'), ( 'ppfcz5', 'LC'), ( 'ppfcz5', 'ME'), ( 'ppfcz5', 'MH'),
-( 'ppfcz5', 'MP'), ( 'ppfcz5', 'MQ'), ( 'ppfcz5', 'MS'), ( 'ppfcz5', 'NC'),
-( 'ppfcz5', 'NF'), ( 'ppfcz5', 'NI'), ( 'ppfcz5', 'NR'), ( 'ppfcz5', 'NU'),
-( 'ppfcz5', 'NZ'), ( 'ppfcz5', 'PA'), ( 'ppfcz5', 'PE'), ( 'ppfcz5', 'PF'),
-( 'ppfcz5', 'PG'), ( 'ppfcz5', 'PH'), ( 'ppfcz5', 'PN'), ( 'ppfcz5', 'PR'),
-( 'ppfcz5', 'PS'), ( 'ppfcz5', 'PW'), ( 'ppfcz5', 'PY'), ( 'ppfcz5', 'SB'),
-( 'ppfcz5', 'SJ'), ( 'ppfcz5', 'SR'), ( 'ppfcz5', 'ST'), ( 'ppfcz5', 'SV'),
-( 'ppfcz5', 'TA'), ( 'ppfcz5', 'TC'), ( 'ppfcz5', 'TF'), ( 'ppfcz5', 'TK'),
-( 'ppfcz5', 'TO'), ( 'ppfcz5', 'TP'), ( 'ppfcz5', 'TT'), ( 'ppfcz5', 'TV'),
-( 'ppfcz5', 'UM'), ( 'ppfcz5', 'UY'), ( 'ppfcz5', 'VC'), ( 'ppfcz5', 'VE'),
-( 'ppfcz5', 'VG'), ( 'ppfcz5', 'VI'), ( 'ppfcz5', 'VU'), ( 'ppfcz5', 'WF'),
-( 'ppfcz5', 'WS'), ( 'ppfcz5', 'YE'), ( 'ppfcz5', 'ZM'), ( 'ppfcz5', 'ZR');
-
-INSERT INTO t2 (a, b, c, d) VALUES
-('domestic', 26, 0.25, 4.7), ('domestic', 27, 0.25, 6),
-('domestic', 19, 2, 6.3), ('domestic', 19, 5, 7.77),
-('domestic', 19, 10, 10.3), ('domestic', 19, 20, 14.83),
-('domestic', 19, 30, 20.88), ('domestic', 20, 2, 7.3),
-('domestic', 20, 5, 8.77), ('domestic', 20, 10, 11.3),
-('domestic', 20, 20, 15.83), ('domestic', 20, 30, 21.88),
-('domestic', 23, 2, 18.8), ('domestic', 23, 5, 20.8),
-('domestic', 23, 10, 24.8), ('domestic', 23, 20, 27.8),
-('domestic', 23, 30, 30.8), ('domestic', 24, 2, 21.1405),
-('domestic', 24, 5, 22.3705), ('domestic', 24, 10, 25.0905),
-('domestic', 24, 20, 29.7705), ('domestic', 24, 30, 35.9605),
-('domestic', 17, 2, 7.2), ('domestic', 17, 5, 8.43),
-('domestic', 17, 10, 11.15), ('domestic', 17, 20, 15.83),
-('domestic', 17, 30, 22.02), ('domestic', 18, 2, 8.2),
-('domestic', 18, 5, 9.43), ('domestic', 18, 10, 12.15),
-('domestic', 18, 20, 16.83), ('domestic', 18, 30, 23.02),
-('domestic', 28, 2, 17), ('domestic', 28, 5, 19),
-('domestic', 28, 10, 22), ('domestic', 28, 20, 28),
-('domestic', 28, 30, 35), ('domestic', 29, 30, 29.5),
-('foreign', 25, 200, 0), ('domestic', 3, 100, 59),
-('foreign', 10, 30, 0), ('foreign', 22, 0, 0),
-('foreign', 11, 30, 0), ('foreign', 12, 30, 0),
-('all', 1, 10000, 0), ('all', 2, 10000, 0),
-('domestic', 9, 10000, 0), ('domestic', 4, 500, 0),
-('domestic', 5, 500, 0), ('domestic', 6, 500, 0),
-('domestic', 7, 500, 0), ('domestic', 8, 500, 0),
-('domestic', 21, 3.9, 10.8), ('domestic', 21, 4.9, 12.2),
-('domestic', 21, 9.9, 15.3), ('domestic', 21, 19.9, 20.6),
-('domestic', 21, 30, 28.1), ('plfcz1', 16, 0.5, 19),
-('plfcz2', 16, 0.5, 25), ( 'ppfcz2', 15, 16, 76.5),
-( 'ppfcz2', 15, 15, 75.5), ( 'ppfcz2', 15, 14, 73.5),
-( 'ppfcz2', 15, 13, 71.5), ( 'ppfcz2', 15, 12, 69.5),
-( 'ppfcz2', 15, 11, 67.5), ( 'ppfcz2', 15, 10, 65.5),
-( 'ppfcz2', 15, 9, 62.5), ( 'ppfcz2', 15, 8, 59.5),
-( 'ppfcz2', 15, 7, 56.5), ( 'ppfcz2', 15, 6, 53.5),
-( 'ppfcz2', 15, 5, 50.5), ( 'ppfcz2', 15, 4, 46.5),
-( 'ppfcz2', 15, 3, 42.5), ( 'ppfcz2', 15, 2, 38.5),
-('ppfcz1', 15, 2, 33.5), ('ppfcz1', 15, 3, 36.5),
-('ppfcz1', 15, 4, 39.5), ('ppfcz1', 15, 5, 41.5),
-('ppfcz1', 15, 6, 42.5), ('ppfcz1', 15, 7, 43.5),
-('ppfcz1', 15, 8, 44.5), ('ppfcz1', 15, 9, 45.5),
-('ppfcz1', 15, 10, 46.5), ('ppfcz1', 15, 11, 47.5),
-( 'ppfcz1', 15, 12, 48.5), ( 'ppfcz1', 15, 13, 49.5), ( 'ppfcz1', 15, 14, 50.5),
-( 'ppfcz1', 15, 15, 51.5), ( 'ppfcz1', 15, 16, 52.5), ( 'ppfcz1', 15, 17, 53.5),
-( 'ppfcz1', 15, 18, 54.5), ( 'ppfcz1', 15, 19, 55.5), ( 'ppfcz1', 15, 20, 56.5),
-( 'ppfcz1', 15, 21, 57.5), ( 'ppfcz1', 15, 22, 58.5), ( 'ppfcz1', 15, 23, 59.5),
-( 'ppfcz1', 15, 24, 60.5), ( 'ppfcz1', 15, 25, 61.5), ( 'ppfcz1', 15, 26, 62.5),
-( 'ppfcz1', 15, 27, 63.5), ( 'ppfcz1', 15, 28, 64.5), ( 'ppfcz1', 15, 29, 65.5),
-( 'ppfcz1', 15, 30, 66.5), ( 'ppfcz2', 15, 17, 77.5), ( 'ppfcz2', 15, 18, 78.5),
-( 'ppfcz2', 15, 19, 79.5), ( 'ppfcz2', 15, 20, 80.5), ( 'ppfcz2', 15, 21, 81.5),
-( 'ppfcz2', 15, 22, 82.5), ( 'ppfcz2', 15, 23, 83.5), ( 'ppfcz2', 15, 24, 84.5),
-( 'ppfcz2', 15, 25, 85.5), ( 'ppfcz2', 15, 26, 86.5), ( 'ppfcz2', 15, 27, 87.5),
-( 'ppfcz2', 15, 28, 88.5), ( 'ppfcz2', 15, 29, 89.5), ( 'ppfcz2', 15, 30, 90.5),
-( 'ppfcz3', 15, 2, 39.5), ( 'ppfcz3', 15, 3, 45.5), ( 'ppfcz3', 15, 4, 51.5),
-( 'ppfcz3', 15, 5, 57.5), ( 'ppfcz3', 15, 6, 63.5), ( 'ppfcz3', 15, 7, 69.5),
-( 'ppfcz3', 15, 8, 75.5), ( 'ppfcz3', 15, 9, 81.5), ( 'ppfcz3', 15, 10, 87.5),
-( 'ppfcz3', 15, 11, 93.5), ( 'ppfcz3', 15, 12, 99.5), ( 'ppfcz3', 15, 13, 105.5),
-( 'ppfcz3', 15, 14, 111.5), ( 'ppfcz3', 15, 15, 117.5), ( 'ppfcz3', 15, 16, 122.5),
-( 'ppfcz3', 15, 17, 127.5), ( 'ppfcz3', 15, 18, 132.5), ( 'ppfcz3', 15, 19, 137.5),
-( 'ppfcz3', 15, 20, 142.5), ( 'ppfcz3', 15, 21, 146.5), ( 'ppfcz3', 15, 22, 150.5),
-( 'ppfcz3', 15, 23, 154.5), ( 'ppfcz3', 15, 24, 158.5), ( 'ppfcz3', 15, 25, 162.5),
-( 'ppfcz3', 15, 26, 166.5), ( 'ppfcz3', 15, 27, 170.5), ( 'ppfcz3', 15, 28, 174.5),
-( 'ppfcz3', 15, 29, 178.5), ( 'ppfcz3', 15, 30, 182.5), ( 'ppfcz4', 15, 2, 44.5),
-( 'ppfcz4', 15, 3, 51.5), ( 'ppfcz4', 15, 4, 58.5), ( 'ppfcz4', 15, 5, 65.5),
-( 'ppfcz4', 15, 6, 72.5), ( 'ppfcz4', 15, 7, 79.5), ( 'ppfcz4', 15, 8, 86.5),
-( 'ppfcz4', 15, 9, 93.5), ( 'ppfcz4', 15, 10, 100.5), ( 'ppfcz4', 15, 11, 105.5),
-( 'ppfcz4', 15, 12, 110.5), ( 'ppfcz4', 15, 13, 115.5), ( 'ppfcz4', 15, 14, 120.5),
-( 'ppfcz4', 15, 15, 125.5), ( 'ppfcz4', 15, 16, 130.5), ( 'ppfcz4', 15, 17, 135.5),
-( 'ppfcz4', 15, 18, 140.5), ( 'ppfcz4', 15, 19, 145.5), ( 'ppfcz4', 15, 20, 150.5),
-( 'ppfcz4', 15, 21, 154.5), ( 'ppfcz4', 15, 22, 158.5), ( 'ppfcz4', 15, 23, 162.5),
-( 'ppfcz4', 15, 24, 166.5), ( 'ppfcz4', 15, 25, 170.5), ( 'ppfcz4', 15, 26, 174.5),
-( 'ppfcz4', 15, 27, 178.5), ( 'ppfcz4', 15, 28, 182.5), ( 'ppfcz4', 15, 29, 186.5),
-( 'ppfcz4', 15, 30, 190.5), ( 'ppfcz5', 15, 2, 48.5), ( 'ppfcz5', 15, 3, 56.5),
-( 'ppfcz5', 15, 4, 64.5), ( 'ppfcz5', 15, 5, 72.5), ( 'ppfcz5', 15, 6, 80.5),
-( 'ppfcz5', 15, 7, 88.5), ( 'ppfcz5', 15, 8, 96.5), ( 'ppfcz5', 15, 9, 104.5),
-( 'ppfcz5', 15, 10, 112.5), ( 'ppfcz5', 15, 11, 119.5), ( 'ppfcz5', 15, 12, 126.5),
-( 'ppfcz5', 15, 13, 133.5), ( 'ppfcz5', 15, 14, 140.5), ( 'ppfcz5', 15, 15, 147.5),
-( 'ppfcz5', 15, 16, 153.5), ( 'ppfcz5', 15, 17, 161.5), ( 'ppfcz5', 15, 18, 167.5),
-( 'ppfcz5', 15, 19, 173.5), ( 'ppfcz5', 15, 20, 179.5), ( 'ppfcz5', 15, 21, 185.5),
-( 'ppfcz5', 15, 22, 191.5), ( 'ppfcz5', 15, 23, 197.5), ( 'ppfcz5', 15, 24, 203.5),
-( 'ppfcz5', 15, 25, 207.5), ( 'ppfcz5', 15, 26, 212.5), ( 'ppfcz5', 15, 27, 217.5),
-( 'ppfcz5', 15, 28, 222.5), ( 'ppfcz5', 15, 29, 227.5), ( 'ppfcz5', 15, 30, 232.5),
-( 'ppfcz1', 14, 2, 37.5), ( 'ppfcz1', 14, 3, 41.5), ( 'ppfcz1', 14, 4, 45.5),
-( 'ppfcz1', 14, 5, 48.5), ( 'ppfcz1', 14, 6, 52.5), ( 'ppfcz1', 14, 7, 55.5),
-( 'ppfcz1', 14, 8, 57.5), ( 'ppfcz1', 14, 9, 59.5), ( 'ppfcz1', 14, 10, 61.5),
-( 'ppfcz1', 14, 11, 62.5), ( 'ppfcz1', 14, 12, 63.5), ( 'ppfcz1', 14, 13, 64.5),
-( 'ppfcz1', 14, 14, 65.5), ( 'ppfcz1', 14, 15, 66.5), ( 'ppfcz1', 14, 16, 67.5),
-( 'ppfcz1', 14, 17, 68.5), ( 'ppfcz1', 14, 18, 69.5), ( 'ppfcz1', 14, 19, 70.5),
-( 'ppfcz1', 14, 20, 71.5), ( 'ppfcz1', 14, 21, 72.5), ( 'ppfcz1', 14, 22, 73.5),
-( 'ppfcz1', 14, 23, 74.5), ( 'ppfcz1', 14, 24, 75.5), ( 'ppfcz1', 14, 25, 76.5),
-( 'ppfcz1', 14, 26, 77.5), ( 'ppfcz1', 14, 27, 78.5), ( 'ppfcz1', 14, 28, 79.5),
-( 'ppfcz1', 14, 29, 80.5), ( 'ppfcz1', 14, 30, 81.5), ( 'ppfcz2', 14, 2, 43.5),
-( 'ppfcz2', 14, 3, 48.5), ( 'ppfcz2', 14, 4, 53.5), ( 'ppfcz2', 14, 5, 57.5),
-( 'ppfcz2', 14, 6, 61.5), ( 'ppfcz2', 14, 7, 65.5), ( 'ppfcz2', 14, 8, 69.5),
-( 'ppfcz2', 14, 9, 73.5), ( 'ppfcz2', 14, 10, 77.5), ( 'ppfcz2', 14, 11, 80.5),
-( 'ppfcz2', 14, 12, 83.5), ( 'ppfcz2', 14, 13, 86.5), ( 'ppfcz2', 14, 14, 89.5),
-( 'ppfcz2', 14, 15, 92.5), ( 'ppfcz2', 14, 16, 94.5), ( 'ppfcz2', 14, 17, 96.5),
-( 'ppfcz2', 14, 18, 98.5), ( 'ppfcz2', 14, 19, 99.5), ( 'ppfcz2', 14, 20, 100.5),
-( 'ppfcz2', 14, 21, 101.5), ( 'ppfcz2', 14, 22, 102.5), ( 'ppfcz2', 14, 23, 103.5),
-( 'ppfcz2', 14, 24, 104.5), ( 'ppfcz2', 14, 25, 105.5), ( 'ppfcz2', 14, 26, 106.5),
-( 'ppfcz2', 14, 27, 107.5), ( 'ppfcz2', 14, 28, 108.5), ( 'ppfcz2', 14, 29, 109.5),
-( 'ppfcz2', 14, 30, 110.5), ( 'ppfcz3', 14, 2, 47.5), ( 'ppfcz3', 14, 3, 56.5),
-( 'ppfcz3', 14, 4, 67.5), ( 'ppfcz3', 14, 5, 78.5), ( 'ppfcz3', 14, 6, 87.5),
-( 'ppfcz3', 14, 7, 96.5), ( 'ppfcz3', 14, 8, 105.5), ( 'ppfcz3', 14, 9, 114.5),
-( 'ppfcz3', 14, 10, 123.5), ( 'ppfcz3', 14, 11, 131.5), ( 'ppfcz3', 14, 12, 139.5),
-( 'ppfcz3', 14, 13, 147.5), ( 'ppfcz3', 14, 14, 155.5), ( 'ppfcz3', 14, 15, 163.5),
-( 'ppfcz3', 14, 16, 171.5), ( 'ppfcz3', 14, 17, 179.5), ( 'ppfcz3', 14, 18, 187.5),
-( 'ppfcz3', 14, 19, 195.5), ( 'ppfcz3', 14, 20, 203.5), ( 'ppfcz3', 14, 21, 210.5),
-( 'ppfcz3', 14, 22, 217.5), ( 'ppfcz3', 14, 23, 224.5), ( 'ppfcz3', 14, 24, 231.5),
-( 'ppfcz3', 14, 25, 238.5), ( 'ppfcz3', 14, 26, 245.5), ( 'ppfcz3', 14, 27, 252.5),
-( 'ppfcz3', 14, 28, 259.5), ( 'ppfcz3', 14, 29, 266.5), ( 'ppfcz3', 14, 30, 273.5),
-( 'ppfcz4', 14, 2, 54.5), ( 'ppfcz4', 14, 3, 68.5), ( 'ppfcz4', 14, 4, 81.5),
-( 'ppfcz4', 14, 5, 95.5), ( 'ppfcz4', 14, 6, 108.5), ( 'ppfcz4', 14, 7, 121.5),
-( 'ppfcz4', 14, 8, 134.5), ( 'ppfcz4', 14, 9, 147.5), ( 'ppfcz4', 14, 10, 160.5),
-( 'ppfcz4', 14, 11, 168.5), ( 'ppfcz4', 14, 12, 178.5), ( 'ppfcz4', 14, 13, 188.5),
-( 'ppfcz4', 14, 14, 198.5), ( 'ppfcz4', 14, 15, 208.5), ( 'ppfcz4', 14, 16, 216.5),
-( 'ppfcz4', 14, 17, 224.5), ( 'ppfcz4', 14, 18, 232.5), ( 'ppfcz4', 14, 19, 240.5),
-( 'ppfcz4', 14, 20, 248.5), ( 'ppfcz4', 14, 21, 256.5), ( 'ppfcz4', 14, 22, 264.5),
-( 'ppfcz4', 14, 23, 272.5), ( 'ppfcz4', 14, 24, 280.5), ( 'ppfcz4', 14, 25, 288.5),
-( 'ppfcz4', 14, 26, 296.5), ( 'ppfcz4', 14, 27, 304.5), ( 'ppfcz4', 14, 28, 312.5),
-( 'ppfcz4', 14, 29, 320.5), ( 'ppfcz4', 14, 30, 328.5), ( 'ppfcz5', 14, 2, 66.5),
-( 'ppfcz5', 14, 3, 84.5), ( 'ppfcz5', 14, 4, 102.5), ( 'ppfcz5', 14, 5, 120.5),
-( 'ppfcz5', 14, 6, 137.5), ( 'ppfcz5', 14, 7, 154.5), ( 'ppfcz5', 14, 8, 171.5),
-( 'ppfcz5', 14, 9, 188.5), ( 'ppfcz5', 14, 10, 205.5), ( 'ppfcz5', 14, 11, 220.5),
-( 'ppfcz5', 14, 12, 235.5), ( 'ppfcz5', 14, 13, 250.5), ( 'ppfcz5', 14, 14, 265.5),
-( 'ppfcz5', 14, 15, 280.5), ( 'ppfcz5', 14, 16, 295.5), ( 'ppfcz5', 14, 17, 310.5),
-( 'ppfcz5', 14, 18, 325.5), ( 'ppfcz5', 14, 19, 340.5), ( 'ppfcz5', 14, 20, 355.5),
-( 'ppfcz5', 14, 21, 368.5), ( 'ppfcz5', 14, 22, 381.5), ( 'ppfcz5', 14, 23, 394.5),
-( 'ppfcz5', 14, 24, 407.5), ( 'ppfcz5', 14, 25, 420.5), ( 'ppfcz5', 14, 26, 433.5),
-( 'ppfcz5', 14, 27, 446.5), ( 'ppfcz5', 14, 28, 459.5), ( 'ppfcz5', 14, 29, 472.5),
-( 'ppfcz5', 14, 30, 485.5), ( 'ppfcz1', 30, 0.5, 56.5), ( 'ppfcz1', 30, 1, 63.5),
-( 'ppfcz1', 30, 1.5, 69.5), ( 'ppfcz1', 30, 2, 75.5), ( 'ppfcz1', 30, 2.5, 80.5),
-( 'ppfcz1', 30, 3, 86.5), ( 'ppfcz1', 30, 3.5, 92.5), ( 'ppfcz1', 30, 4, 99.5),
-( 'ppfcz1', 30, 4.5, 105.5), ( 'ppfcz1', 30, 5, 111.5), ( 'ppfcz1', 30, 6, 118.5),
-( 'ppfcz1', 30, 7, 126.5), ( 'ppfcz1', 30, 8, 133.5), ( 'ppfcz1', 30, 9, 141.5),
-( 'ppfcz1', 30, 10, 148.5), ( 'ppfcz1', 30, 11, 156.5), ( 'ppfcz1', 30, 12, 163.5),
-( 'ppfcz1', 30, 13, 171.5), ( 'ppfcz1', 30, 14, 178.5), ( 'ppfcz1', 30, 15, 186.5),
-( 'ppfcz1', 30, 16, 193.5), ( 'ppfcz1', 30, 17, 201.5), ( 'ppfcz1', 30, 18, 209.5),
-( 'ppfcz1', 30, 19, 216.5), ( 'ppfcz1', 30, 20, 224.5), ( 'ppfcz1', 30, 21, 231.5),
-( 'ppfcz1', 30, 22, 239.5), ( 'ppfcz1', 30, 23, 246.5), ( 'ppfcz1', 30, 24, 254.5),
-( 'ppfcz1', 30, 25, 261.5), ( 'ppfcz1', 30, 26, 269.5), ( 'ppfcz1', 30, 27, 276.5),
-( 'ppfcz1', 30, 28, 284.5), ( 'ppfcz1', 30, 29, 291.5), ( 'ppfcz1', 30, 30, 299.5),
-( 'ppfcz2', 30, 0.5, 61.5), ( 'ppfcz2', 30, 1, 65.5), ( 'ppfcz2', 30, 1.5, 75.5),
-( 'ppfcz2', 30, 2, 80.5), ( 'ppfcz2', 30, 2.5, 86.5), ( 'ppfcz2', 30, 3, 99.5),
-( 'ppfcz2', 30, 3.5, 109.5), ( 'ppfcz2', 30, 4, 113.5), ( 'ppfcz2', 30, 4.5, 121.5),
-( 'ppfcz2', 30, 5, 129.5), ( 'ppfcz2', 30, 6, 139.5), ( 'ppfcz2', 30, 7, 149.5),
-( 'ppfcz2', 30, 8, 159.5), ( 'ppfcz2', 30, 9, 169.5), ( 'ppfcz2', 30, 10, 180.5),
-( 'ppfcz2', 30, 11, 189.5), ( 'ppfcz2', 30, 12, 199.5), ( 'ppfcz2', 30, 13, 210.5),
-( 'ppfcz2', 30, 14, 219.5), ( 'ppfcz2', 30, 15, 229.5), ( 'ppfcz2', 30, 16, 240.5),
-( 'ppfcz2', 30, 17, 249.5), ( 'ppfcz2', 30, 18, 259.5), ( 'ppfcz2', 30, 19, 270.5),
-( 'ppfcz2', 30, 20, 280.5), ( 'ppfcz2', 30, 21, 289.5), ( 'ppfcz2', 30, 22, 300.5),
-( 'ppfcz2', 30, 23, 310.5), ( 'ppfcz2', 30, 24, 320.5), ( 'ppfcz2', 30, 25, 330.5),
-( 'ppfcz2', 30, 26, 340.5), ( 'ppfcz2', 30, 27, 350.5), ( 'ppfcz2', 30, 28, 360.5),
-( 'ppfcz2', 30, 29, 370.5), ( 'ppfcz2', 30, 30, 381.5), ( 'ppfcz3', 30, 0.5, 74.5),
-( 'ppfcz3', 30, 1, 83.5), ( 'ppfcz3', 30, 1.5, 90.5), ( 'ppfcz3', 30, 2, 99.5),
-( 'ppfcz3', 30, 2.5, 107.5), ( 'ppfcz3', 30, 3, 114.5), ( 'ppfcz3', 30, 3.5, 122.5),
-( 'ppfcz3', 30, 4, 130.5), ( 'ppfcz3', 30, 4.5, 140.5), ( 'ppfcz3', 30, 5, 147.5),
-( 'ppfcz3', 30, 6, 162.5), ( 'ppfcz3', 30, 7, 174.5), ( 'ppfcz3', 30, 8, 188.5),
-( 'ppfcz3', 30, 9, 201.5), ( 'ppfcz3', 30, 10, 213.5), ( 'ppfcz3', 30, 11, 227.5),
-( 'ppfcz3', 30, 12, 240.5), ( 'ppfcz3', 30, 13, 252.5), ( 'ppfcz3', 30, 14, 266.5),
-( 'ppfcz3', 30, 15, 278.5), ( 'ppfcz3', 30, 16, 290.5), ( 'ppfcz3', 30, 17, 304.5),
-( 'ppfcz3', 30, 18, 317.5), ( 'ppfcz3', 30, 19, 330.5), ( 'ppfcz3', 30, 20, 343.5),
-( 'ppfcz3', 30, 21, 354.5), ( 'ppfcz3', 30, 22, 363.5), ( 'ppfcz3', 30, 23, 375.5),
-( 'ppfcz3', 30, 24, 385.5), ( 'ppfcz3', 30, 25, 396.5), ( 'ppfcz3', 30, 26, 405.5),
-( 'ppfcz3', 30, 27, 417.5), ( 'ppfcz3', 30, 28, 428.5), ( 'ppfcz3', 30, 29, 438.5),
-( 'ppfcz3', 30, 30, 448.5), ( 'ppfcz4', 30, 0.5, 90.5), ( 'ppfcz4', 30, 1, 104.5),
-( 'ppfcz4', 30, 1.5, 118.5), ( 'ppfcz4', 30, 2, 134.5), ( 'ppfcz4', 30, 2.5, 146.5),
-( 'ppfcz4', 30, 3, 163.5), ( 'ppfcz4', 30, 3.5, 179.5), ( 'ppfcz4', 30, 4, 195.5),
-( 'ppfcz4', 30, 4.5, 211.5), ( 'ppfcz4', 30, 5, 232.5), ( 'ppfcz4', 30, 6, 257.5),
-( 'ppfcz4', 30, 7, 278.5), ( 'ppfcz4', 30, 8, 300.5), ( 'ppfcz4', 30, 9, 321.5),
-( 'ppfcz4', 30, 10, 343.5), ( 'ppfcz4', 30, 11, 364.5), ( 'ppfcz4', 30, 12, 386.5),
-( 'ppfcz4', 30, 13, 407.5), ( 'ppfcz4', 30, 14, 429.5), ( 'ppfcz4', 30, 15, 450.5),
-( 'ppfcz4', 30, 16, 472.5), ( 'ppfcz4', 30, 17, 493.5), ( 'ppfcz4', 30, 18, 515.5),
-( 'ppfcz4', 30, 19, 536.5), ( 'ppfcz4', 30, 20, 558.5), ( 'ppfcz4', 30, 21, 579.5),
-( 'ppfcz4', 30, 22, 601.5), ( 'ppfcz4', 30, 23, 622.5), ( 'ppfcz4', 30, 24, 644.5),
-( 'ppfcz4', 30, 25, 665.5), ( 'ppfcz4', 30, 26, 687.5), ( 'ppfcz4', 30, 27, 708.5),
-( 'ppfcz4', 30, 28, 730.5), ( 'ppfcz4', 30, 29, 751.5), ( 'ppfcz4', 30, 30, 773.5),
-( 'ppfcz5', 30, 0.5, 97.5), ( 'ppfcz5', 30, 1, 114.5), ( 'ppfcz5', 30, 1.5, 131.5),
-( 'ppfcz5', 30, 2, 148.5), ( 'ppfcz5', 30, 2.5, 165.5), ( 'ppfcz5', 30, 3, 183.5),
-( 'ppfcz5', 30, 3.5, 200.5), ( 'ppfcz5', 30, 4, 221.5), ( 'ppfcz5', 30, 4.5, 243.5),
-( 'ppfcz5', 30, 5, 264.5), ( 'ppfcz5', 30, 6, 289.5), ( 'ppfcz5', 30, 7, 313.5),
-( 'ppfcz5', 30, 8, 336.5), ( 'ppfcz5', 30, 9, 360.5), ( 'ppfcz5', 30, 10, 384.5),
-( 'ppfcz5', 30, 11, 407.5), ( 'ppfcz5', 30, 12, 431.5), ( 'ppfcz5', 30, 13, 455.5),
-( 'ppfcz5', 30, 14, 478.5), ( 'ppfcz5', 30, 15, 502.5), ( 'ppfcz5', 30, 16, 526.5),
-( 'ppfcz5', 30, 17, 549.5), ( 'ppfcz5', 30, 18, 573.5), ( 'ppfcz5', 30, 19, 597.5),
-( 'ppfcz5', 30, 20, 620.5), ( 'ppfcz5', 30, 21, 644.5), ( 'ppfcz5', 30, 22, 668.5),
-( 'ppfcz5', 30, 23, 691.5), ( 'ppfcz5', 30, 24, 715.5), ( 'ppfcz5', 30, 25, 738.5),
-( 'ppfcz5', 30, 26, 762.5), ( 'ppfcz5', 30, 27, 786.5), ( 'ppfcz5', 30, 28, 809.5),
-( 'ppfcz5', 30, 29, 833.5), ( 'ppfcz5', 30, 30, 857.5), ( 'foreign', 13, 30, 0),
-( 'all', 32, 10000, 23.2342007434944);
-
---enable_query_log
-
-INSERT INTO t3 SELECT * FROM t1;
-
-EXPLAIN
-SELECT d FROM t1, t2
-WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
-ORDER BY t2.c LIMIT 1;
-SELECT d FROM t1, t2
-WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
-ORDER BY t2.c LIMIT 1;
-
-EXPLAIN
-SELECT d FROM t3 AS t1, t2 AS t2
-WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
-ORDER BY t2.c LIMIT 1;
-SELECT d FROM t3 AS t1, t2 AS t2
-WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
-ORDER BY t2.c LIMIT 1;
-
-SELECT t1.*,t2.* FROM t1, t2
-WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
-ORDER BY t2.c LIMIT 5;
-
-SELECT t1.*, t2.* FROM t3 AS t1, t2 AS t2
-WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
-ORDER BY t2.c LIMIT 5;
-
-DROP TABLE t1,t2,t3;
-
-
---echo #
---echo # WL#1393 - Optimizing filesort with small limit
---echo #
-
-CREATE TABLE t1(f0 int auto_increment primary key, f1 int, f2 varchar(200));
-INSERT INTO t1(f1, f2) VALUES
-(0,"0"),(1,"1"),(2,"2"),(3,"3"),(4,"4"),(5,"5"),
-(6,"6"),(7,"7"),(8,"8"),(9,"9"),(10,"10"),
-(11,"11"),(12,"12"),(13,"13"),(14,"14"),(15,"15"),
-(16,"16"),(17,"17"),(18,"18"),(19,"19"),(20,"20"),
-(21,"21"),(22,"22"),(23,"23"),(24,"24"),(25,"25"),
-(26,"26"),(27,"27"),(28,"28"),(29,"29"),(30,"30"),
-(31,"31"),(32,"32"),(33,"33"),(34,"34"),(35,"35"),
-(36,"36"),(37,"37"),(38,"38"),(39,"39"),(40,"40"),
-(41,"41"),(42,"42"),(43,"43"),(44,"44"),(45,"45"),
-(46,"46"),(47,"47"),(48,"48"),(49,"49"),(50,"50"),
-(51,"51"),(52,"52"),(53,"53"),(54,"54"),(55,"55"),
-(56,"56"),(57,"57"),(58,"58"),(59,"59"),(60,"60"),
-(61,"61"),(62,"62"),(63,"63"),(64,"64"),(65,"65"),
-(66,"66"),(67,"67"),(68,"68"),(69,"69"),(70,"70"),
-(71,"71"),(72,"72"),(73,"73"),(74,"74"),(75,"75"),
-(76,"76"),(77,"77"),(78,"78"),(79,"79"),(80,"80"),
-(81,"81"),(82,"82"),(83,"83"),(84,"84"),(85,"85"),
-(86,"86"),(87,"87"),(88,"88"),(89,"89"),(90,"90"),
-(91,"91"),(92,"92"),(93,"93"),(94,"94"),(95,"95"),
-(96,"96"),(97,"97"),(98,"98"),(99,"99");
-
-################
-## Test sort when source data fits in memory
-
-SELECT * FROM t1 ORDER BY f1 ASC, f0 LIMIT 100;
-SELECT * FROM t1 ORDER BY f1 ASC, f0 LIMIT 30;
-SELECT * FROM t1 ORDER BY f1 ASC, f0 LIMIT 0;
-SELECT * FROM t1 ORDER BY f2 DESC, f0 LIMIT 30;
-SELECT * FROM t1 ORDER BY f2 DESC, f0 LIMIT 0;
-SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 20;
-SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 0;
-SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 10 OFFSET 10;
-SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 0 OFFSET 10;
-
-################
-## Test sort when source data does not fit in memory
-set sort_buffer_size= 32768;
-CREATE TEMPORARY TABLE tmp (f1 int, f2 varchar(20));
-INSERT INTO tmp SELECT f1, f2 FROM t1;
-INSERT INTO t1(f1, f2) SELECT * FROM tmp;
-INSERT INTO tmp SELECT f1, f2 FROM t1;
-INSERT INTO t1(f1, f2) SELECT * FROM tmp;
-
-SELECT * FROM t1 ORDER BY f1 ASC, f0 LIMIT 30;
-SELECT * FROM t1 ORDER BY f1 ASC, f0 LIMIT 0;
-SELECT * FROM t1 ORDER BY f2 DESC, f0 LIMIT 30;
-SELECT * FROM t1 ORDER BY f2 DESC, f0 LIMIT 0;
-SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 20;
-SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 0;
-SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 10 OFFSET 10;
-SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 0 OFFSET 10;
-
-################
-## Test with SQL_CALC_FOUND_ROWS
-set sort_buffer_size= 32768;
-SELECT SQL_CALC_FOUND_ROWS * FROM t1
-ORDER BY f1, f0 LIMIT 30;
-SELECT FOUND_ROWS();
-
-SELECT SQL_CALC_FOUND_ROWS * FROM t1
-ORDER BY f1, f0 LIMIT 0;
-SELECT FOUND_ROWS();
-
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE f1>10
-ORDER BY f2, f0 LIMIT 20;
-SELECT FOUND_ROWS();
-
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE f1>10
-ORDER BY f2, f0 LIMIT 0;
-SELECT FOUND_ROWS();
-
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE f1>10
-ORDER BY f2, f0 LIMIT 10 OFFSET 10;
-SELECT FOUND_ROWS();
-
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE f1>10
-ORDER BY f2, f0 LIMIT 0 OFFSET 10;
-SELECT FOUND_ROWS();
-
-################
-## Test sorting with join
-## These are re-written to use PQ during execution.
-set sort_buffer_size= 327680;
-
-SELECT * FROM t1 JOIN tmp on t1.f2=tmp.f2
-ORDER BY tmp.f1, f0 LIMIT 30;
-
-SELECT * FROM t1 JOIN tmp on t1.f2=tmp.f2
-ORDER BY tmp.f1, f0 LIMIT 30 OFFSET 30;
-
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 JOIN tmp on t1.f2=tmp.f2
-ORDER BY tmp.f1, f0 LIMIT 30 OFFSET 30;
-SELECT FOUND_ROWS();
-
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 JOIN tmp on t1.f2=tmp.f2
-WHERE t1.f2>20
-ORDER BY tmp.f1, f0 LIMIT 30 OFFSET 30;
-SELECT FOUND_ROWS();
-
-################
-## Test views
-CREATE VIEW v1 as SELECT * FROM t1 ORDER BY f1, f0 LIMIT 30;
-SELECT * FROM v1;
-drop view v1;
-
-CREATE VIEW v1 as SELECT * FROM t1 ORDER BY f1, f0 LIMIT 100;
-SELECT * FROM v1 ORDER BY f2, f0 LIMIT 30;
-
-CREATE VIEW v2 as SELECT * FROM t1 ORDER BY f2, f0 LIMIT 100;
-SELECT * FROM v1 JOIN v2 on v1.f1=v2.f1 ORDER BY v1.f2,v1.f0,v2.f0
-LIMIT 30;
-
-################
-## Test group & having
-SELECT floor(f1/10) f3, count(f2) FROM t1
-GROUP BY 1 ORDER BY 2,1 LIMIT 5;
-
-SELECT floor(f1/10) f3, count(f2) FROM t1
-GROUP BY 1 ORDER BY 2,1 LIMIT 0;
-
-################
-## Test SP
-delimiter |;
-CREATE PROCEDURE wl1393_sp_test()
-BEGIN
-SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 30;
-SELECT * FROM t1 WHERE f1>10 ORDER BY f2, f0 LIMIT 15 OFFSET 15;
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE f1>10
-ORDER BY f2, f0 LIMIT 15 OFFSET 15;
-SELECT FOUND_ROWS();
-SELECT * FROM v1 ORDER BY f2, f0 LIMIT 30;
-END|
-CALL wl1393_sp_test()|
-DROP PROCEDURE wl1393_sp_test|
-delimiter ;|
-
-################
-## Test with subqueries
-SELECT d1.f1, d1.f2 FROM t1
-LEFT JOIN (SELECT * FROM t1 ORDER BY f1 LIMIT 30) d1 on t1.f1=d1.f1
-ORDER BY d1.f2 DESC LIMIT 30;
-
-SELECT * FROM t1 WHERE f1 = (SELECT f1 FROM t1 ORDER BY 1 LIMIT 1);
-
---error ER_SUBQUERY_NO_1_ROW
-SELECT * FROM t1 WHERE f1 = (SELECT f1 FROM t1 ORDER BY 1 LIMIT 2);
-
-DROP TABLE t1, tmp;
-DROP VIEW v1, v2;
-
---echo # end of WL#1393 - Optimizing filesort with small limit
-
---echo #
---echo # Bug #58761
---echo # Crash in Field::is_null in field.h on subquery in WHERE clause
---echo #
-
-CREATE TABLE t1 (
- pk INT NOT NULL AUTO_INCREMENT,
- col_int_key INT DEFAULT NULL,
- col_varchar_key VARCHAR(1) DEFAULT NULL,
- PRIMARY KEY (pk),
- KEY col_varchar_key (col_varchar_key,col_int_key)
-);
-
-INSERT INTO t1 VALUES (27,7,'x');
-INSERT INTO t1 VALUES (28,6,'m');
-INSERT INTO t1 VALUES (29,4,'c');
-
-CREATE TABLE where_subselect
- SELECT DISTINCT `pk` AS field1 , `pk` AS field2
- FROM t1 AS alias1
- WHERE alias1 . `col_int_key` > 229
- OR alias1 . `col_varchar_key` IS NOT NULL
- GROUP BY field1, field2
-;
-
-SELECT *
-FROM where_subselect
-WHERE (field1, field2) IN (
- SELECT DISTINCT `pk` AS field1 , `pk` AS field2
- FROM t1 AS alias1
- WHERE alias1 . `col_int_key` > 229
- OR alias1 . `col_varchar_key` IS NOT NULL
- GROUP BY field1, field2
-);
-
-DROP TABLE t1;
-DROP TABLE where_subselect;
-
---echo # End of Bug #58761
-
-##
-# Bug#35844: Covering index for ref access not compatible with ORDER BY list
-#
-
-CREATE TABLE t1 (
- id1 INT NULL,
- id2 INT NOT NULL,
- junk INT NOT NULL,
- PRIMARY KEY (id1, id2, junk),
- INDEX id2_j_id1 (id2, junk, id1)
-);
-
-INSERT INTO t1 VALUES (1, 1, 1), (2, 1, 2), (3, 1, 3), (4, 1, 4);
-INSERT INTO t1 VALUES (5, 2, 1), (6, 2, 2), (7, 2, 3), (8, 2, 4);
-INSERT INTO t1 VALUES (9, 3, 1), (10, 3, 2), (11, 3, 3), (12, 3, 4);
-INSERT INTO t1 VALUES (13, 4, 1), (14, 4, 2), (15, 4, 3), (16, 4, 4);
-INSERT INTO t1 VALUES (17, 5, 1), (18, 5, 2), (19, 5, 3), (20, 5, 4);
-INSERT INTO t1 VALUES (21, 6, 1), (22, 6, 2), (23, 6, 3), (24, 6, 4);
-INSERT INTO t1 VALUES (25, 7, 1), (26, 7, 2), (27, 7, 3), (28, 7, 4);
-INSERT INTO t1 VALUES (29, 8, 1), (30, 8, 2), (31, 8, 3), (32, 8, 4);
-INSERT INTO t1 VALUES (33, 9, 1), (34, 9, 2), (35, 9, 3), (36, 9, 4);
-
-EXPLAIN SELECT id1 FROM t1 WHERE id2 = 4 ORDER BY id1;
-
-SELECT id1 FROM t1 WHERE id2 = 4 ORDER BY id1;
-
-DROP TABLE t1;
-
-
-
-#
-# Bug#46454: MySQL wrong index optimisation leads to incorrect result & crashes
-#
-CREATE TABLE t1 (
- a INT,
- b INT NOT NULL,
- c char(100),
- KEY (b, c),
- KEY (b, a, c)
-)
-DEFAULT CHARSET = utf8;
-
-INSERT INTO t1 VALUES
-(1, 1, 1),
-(2, 2, 2),
-(3, 3, 3),
-(4, 4, 4),
-(5, 5, 5),
-(6, 6, 6),
-(7, 7, 7),
-(8, 8, 8),
-(9, 9, 9);
-
-INSERT INTO t1 SELECT a + 10, b, c FROM t1;
-INSERT INTO t1 SELECT a + 20, b, c FROM t1;
-INSERT INTO t1 SELECT a + 40, b, c FROM t1;
-INSERT INTO t1 SELECT a + 80, b, c FROM t1;
-INSERT INTO t1 SELECT a + 160, b, c FROM t1;
-INSERT INTO t1 SELECT a + 320, b, c FROM t1;
-INSERT INTO t1 SELECT a + 640, b, c FROM t1;
-INSERT INTO t1 SELECT a + 1280, b, c FROM t1 LIMIT 80;
-
-EXPLAIN
-SELECT a FROM t1 WHERE b = 1 ORDER BY c DESC LIMIT 9;
-SELECT a FROM t1 WHERE b = 1 ORDER BY c DESC LIMIT 9;
-
-EXPLAIN
-SELECT DISTINCT a FROM t1 WHERE b = 1 ORDER BY c DESC LIMIT 0, 9;
-SELECT DISTINCT a FROM t1 WHERE b = 1 ORDER BY c DESC LIMIT 0, 9;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug #43029: FORCE INDEX FOR ORDER BY is ignored when join buffering
---echo # is used
---echo #
-
-CREATE TABLE t1 (a INT, b INT, KEY (a));
-
-INSERT INTO t1 VALUES (0, NULL), (1, NULL), (2, NULL), (3, NULL);
-INSERT INTO t1 SELECT a+4, b FROM t1;
-INSERT INTO t1 SELECT a+8, b FROM t1;
-
-CREATE TABLE t2 (a INT, b INT);
-
-INSERT INTO t2 VALUES (0,NULL), (1,NULL), (2,NULL), (3,NULL), (4,NULL);
-INSERT INTO t2 SELECT a+4, b FROM t2;
-
---echo # shouldn't have "using filesort"
-EXPLAIN
-SELECT * FROM t1 FORCE INDEX FOR ORDER BY (a), t2 WHERE t1.a < 2 ORDER BY t1.a;
-
---echo # should have "using filesort"
-EXPLAIN
-SELECT * FROM t1 USE INDEX FOR ORDER BY (a), t2 WHERE t1.a < 2 ORDER BY t1.a;
-
---echo # should have "using filesort"
-EXPLAIN
-SELECT * FROM t1 FORCE INDEX FOR JOIN (a), t2 WHERE t1.a < 2 ORDER BY t1.a;
-
-DROP TABLE t1, t2;
-
---echo #
---echo # Bug #50394: Regression in EXPLAIN with index scan, LIMIT, GROUP BY and
---echo # ORDER BY computed col
---echo #
-CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL, KEY( a, b ) );
-
-INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
-INSERT INTO t1 SELECT a + 5, b + 5 FROM t1;
-
-CREATE TABLE t2( a INT PRIMARY KEY, b INT );
-
-INSERT INTO t2 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
-INSERT INTO t2 SELECT a + 5, b + 5 FROM t2;
-
-EXPLAIN
-SELECT count(*) AS c, t1.a
-FROM t1 JOIN t2 ON t1.b = t2.a
-WHERE t2.b = 1
-GROUP BY t1.a
-ORDER by c
-LIMIT 2;
-
-DROP TABLE t1, t2;
-
---echo #
---echo # Bug #707848: WHERE condition with OR + ORDER BY + field substitution
---echo #
-
-CREATE TABLE t1 (a int PRIMARY KEY);
-INSERT INTO t1 VALUES
- (9), (7), (11), (15), (2), (4), (1), (5), (14), (54), (3), (8);
-
-EXPLAIN EXTENDED
-SELECT * FROM t1 r JOIN t1 s ON r.a = s.a
- WHERE s.a IN (2,9) OR s.a < 100 AND s.a != 0
- ORDER BY 1 LIMIT 10;
-
-SELECT * FROM t1 r JOIN t1 s ON r.a = s.a
- WHERE s.a IN (2,9) OR s.a < 100 AND s.a != 0
- ORDER BY 1 LIMIT 10;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug #59110: Memory leak of QUICK_SELECT_I allocated memory
---echo # and
---echo # Bug #59308: Incorrect result for
---echo SELECT DISTINCT <col>... ORDER BY <col> DESC
---echo
---echo # Use Valgrind to detect #59110!
---echo #
-
-CREATE TABLE t1 (a INT,KEY (a));
-INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
-
-EXPLAIN SELECT DISTINCT a,1 FROM t1 WHERE a <> 1 ORDER BY a DESC;
-SELECT DISTINCT a,1 FROM t1 WHERE a <> 1 ORDER BY a DESC;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug#11765255 58201:
---echo # VALGRIND/CRASH WHEN ORDERING BY MULTIPLE AGGREGATE FUNCTIONS
---echo #
-
-select 1 order by max(1) + min(1);
-
---echo End of 5.1 tests
-
---echo #
---echo # Bug #38745: MySQL 5.1 optimizer uses filesort for ORDER BY
---echo # when it should use index
---echo #
-
-CREATE TABLE t1 (i1 integer NOT NULL PRIMARY KEY);
-CREATE TABLE t2 (i2 integer NOT NULL PRIMARY KEY);
-CREATE TABLE t3 (i3 integer);
-
-INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11), (12);
-INSERT INTO t2 SELECT * FROM t1;
-
-EXPLAIN EXTENDED
-SELECT t1.*, t2.* FROM t1 JOIN t2 ON t1.i1 = t2.i2
- LEFT JOIN t3 ON t2.i2 = t3.i3
- ORDER BY t1.i1 LIMIT 5;
-
-SELECT t1.*, t2.* FROM t1 JOIN t2 ON t1.i1 = t2.i2
- LEFT JOIN t3 ON t2.i2 = t3.i3
- ORDER BY t1.i1 LIMIT 5;
-
-DROP TABLE t1, t2, t3;
-
---echo #
---echo # Fix of LP BUG#793589 Wrong result with double ORDER BY
---echo #
-CREATE TABLE t1 ( b int) ;
-INSERT INTO t1 VALUES (8),(9);
-
-CREATE TABLE t2 ( a int, b int, PRIMARY KEY (a)) ;
-INSERT INTO t2 VALUES (6,7),(7,7),(8,1),(9,7),(10,1),(11,5),(12,2),(13,0),(14,1),(15,8),(16,1),(17,1),(18,9),(19,1),(20,5);
-
-SELECT t2.b AS field1 FROM t1, t2 WHERE t1.b = t2.a GROUP BY field1 ORDER BY t1.b, field1;
-SELECT t2.b, t1.b FROM t1, t2 WHERE t1.b = t2.a GROUP BY t2.b ORDER BY t1.b, t2.b;
-SELECT t2.b,t1.b FROM t1, t2 WHERE t1.b = t2.a GROUP BY t2.b ORDER BY t1.b;
-SELECT t2.b FROM t1, t2 WHERE t1.b = t2.a GROUP BY t2.b ORDER BY t1.b;
-
---echo # field1 removed from ORDER BY
-explain extended
-SELECT t2.b AS field1 FROM t1, t2 WHERE t1.b = t2.a GROUP BY field1 ORDER BY t1.b, field1;
-explain extended
-SELECT t2.b, t1.b FROM t1, t2 WHERE t1.b = t2.a GROUP BY t2.b ORDER BY t1.b, t2.b;
-explain extended
-SELECT t2.b,t1.b FROM t1, t2 WHERE t1.b = t2.a GROUP BY t2.b ORDER BY t1.b;
-explain extended
-SELECT t2.b FROM t1, t2 WHERE t1.b = t2.a GROUP BY t2.b ORDER BY t1.b;
-
-
-drop table t1,t2;
-
---echo End of 5.2 tests
-
---echo #
---echo # Bug mdev-449: ORDER BY with small sort_buffer_size
---echo #
-
-CREATE TABLE t1(f0 int auto_increment primary key, f1 int, f2 varchar(200));
-INSERT INTO t1(f1, f2) VALUES
-(0,"0"),(1,"1"),(2,"2"),(3,"3"),(4,"4"),(5,"5"),
-(6,"6"),(7,"7"),(8,"8"),(9,"9"),(10,"10"),
-(11,"11"),(12,"12"),(13,"13"),(14,"14"),(15,"15"),
-(16,"16"),(17,"17"),(18,"18"),(19,"19"),(20,"20"),
-(21,"21"),(22,"22"),(23,"23"),(24,"24"),(25,"25"),
-(26,"26"),(27,"27"),(28,"28"),(29,"29"),(30,"30"),
-(31,"31"),(32,"32"),(33,"33"),(34,"34"),(35,"35"),
-(36,"36"),(37,"37"),(38,"38"),(39,"39"),(40,"40"),
-(41,"41"),(42,"42"),(43,"43"),(44,"44"),(45,"45"),
-(46,"46"),(47,"47"),(48,"48"),(49,"49"),(50,"50"),
-(51,"51"),(52,"52"),(53,"53"),(54,"54"),(55,"55"),
-(56,"56"),(57,"57"),(58,"58"),(59,"59"),(60,"60"),
-(61,"61"),(62,"62"),(63,"63"),(64,"64"),(65,"65"),
-(66,"66"),(67,"67"),(68,"68"),(69,"69"),(70,"70"),
-(71,"71"),(72,"72"),(73,"73"),(74,"74"),(75,"75"),
-(76,"76"),(77,"77"),(78,"78"),(79,"79"),(80,"80"),
-(81,"81"),(82,"82"),(83,"83"),(84,"84"),(85,"85"),
-(86,"86"),(87,"87"),(88,"88"),(89,"89"),(90,"90"),
-(91,"91"),(92,"92"),(93,"93"),(94,"94"),(95,"95"),
-(96,"96"),(97,"97"),(98,"98"),(99,"99");
-
-set @save_sort_buffer_size= @@sort_buffer_size;
-set sort_buffer_size= 2000;
-
-SELECT * FROM t1 ORDER BY f1 DESC, f0;
-
-set sort_buffer_size= @save_sort_buffer_size;
-
-DROP TABLE t1;
-
---echo End of 5.3 tests
-
---echo #
---echo # Bug 54599: discarded fast range scan for query with
---echo # GROUP BY + ORDER BY + LIMIT
---echo #
-
-create table t0 (a int);
-insert into t0 values (0), (1), (2), (3), (4), (5), (6), (7), (8), (9);
-
-create table t1 (a int, b int, index idx1(a,b), index idx2(b,a));
-insert into t1
- select 1000*s4.a+100*s3.a+10*s2.a + s1.a, 1000*s4.a+100*s3.a+10*s2.a+s1.a
- from t0 s1, t0 s2, t0 s3, t0 s4;
---disable_result_log
-analyze table t1;
---enable_result_log
-
-explain
-select b, count(*) num_cnt from t1
- where a > 9750 group by b order by num_cnt;
-flush status;
---disable_result_log
-select b, count(*) num_cnt from t1
- where a > 9750 group by b order by num_cnt;
---enable_result_log
-show status like '%Handler_read%';
-
-explain
-select b, count(*) num_cnt from t1
- where a > 9750 group by b order by num_cnt limit 1;
-flush status;
---disable_result_log
-select b, count(*) num_cnt from t1
- where a > 9750 group by b order by num_cnt limit 1;
---enable_result_log
-show status like '%Handler_read%';
-
-drop table t0, t1;
-
---echo #
---echo # LP bug #1002508 : the number of expected rows to be examined is off
---echo # (bug #13528826)
---echo #
-
-CREATE TABLE t1(a int PRIMARY KEY, b int) ENGINE=myisam;
-INSERT INTO t1 VALUES
- (5, 10), (2, 70), (7, 80), (6, 20), (1, 50), (9, 40), (8, 30), (3, 60);
-CREATE TABLE t2 (p int, a int, INDEX i_a(a)) ENGINE=myisam;
-INSERT INTO t2 VALUES
- (103, 7), (109, 3), (102, 3), (108, 1), (106, 3),
- (107, 7), (105, 1), (101, 3), (100, 7), (110, 1);
-
-EXPLAIN
-SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.a=t2.a ORDER BY t1.a;
-
-EXPLAIN
-SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.a=t2.a ORDER BY t1.a LIMIT 8;
-
-EXPLAIN
-SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.a=t2.a ORDER BY t1.a LIMIT 100;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-4974 memory leak in 5.5.32-MariaDB-1~wheezy-log
---echo #
-set sort_buffer_size=default;
-set max_sort_length=default;
-create table t1(a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t2 (b int,
- col1 varchar(255),
- col2 varchar(255)
- ) character set utf8;
-
-insert into t2 select
- A.a+10*B.a,
- concat('wow-wow-col1-value-', A.a+10*B.a+100*C.a),
- concat('wow-wow-col2-value-', A.a+10*B.a+100*C.a)
-from
- t1 A, t1 B, t1 C where C.a < 8;
-
-create table t3 as
-select distinct A.col1 as XX, B.col1 as YY
-from
- t2 A, t2 B
-where A.b = B.b
-order by A.col2, B.col2 limit 10, 1000000;
-
-drop table t1,t2,t3;
-
---echo #
---echo # mdev-10705 : long order by list that can be skipped
---echo #
-
-SELECT 1
-UNION
-( SELECT 2
- ORDER BY NULL, @a0 := 3, @a1 := 3, @a2 := 3, @a3 := 3, @a4 := 3,
- @a5 := 3, @a6 := 3, @a7 := 3, @a8 := 3, @a9 := 3, @a10 := 3 );
-
-
---echo #
---echo # mdev-6706: semi-join with duplicate weedout + ORDER BY
---echo #
-
-CREATE TABLE t1 (f1 VARCHAR(3)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('foo');
-
-CREATE TABLE t2 (f2 VARCHAR(3)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES ('bar'),('baz');
-
-CREATE TABLE t3
-(i3_key INT, f3_key VARCHAR(3), f3 VARCHAR(3), KEY(f3_key,i3_key))
- ENGINE=MyISAM;
-INSERT INTO t3 VALUES (0,'qux','qux'),(8,'bar','bar');
-
-let $q1=
-SELECT CONCAT( f1, f2 ) AS field FROM t1, t2
-WHERE f1 = ANY ( SELECT f1
- FROM t1
- LEFT JOIN ( t3 AS t3a, t3 AS t3b )
- ON ( t3b.f3_key = t3a.f3 )
- WHERE t3a.f3 < f1 OR t3b.f3 != f1 );
-let $q2=
-SELECT CONCAT( f1, f2 ) AS field FROM t1, t2
-WHERE f1 = ANY ( SELECT f1
- FROM t1
- LEFT JOIN ( t3 AS t3a, t3 AS t3b )
- ON ( t3b.f3_key = t3a.f3 )
- WHERE t3a.f3 < f1 OR t3b.f3 != f1 )
-ORDER BY field;
-
-eval $q1;
-eval $q2;
-eval EXPLAIN EXTENDED $q2;
-
-DROP TABLE t1,t2,t3;
-
---echo End of 5.5 tests
-
---echo #
---echo # MDEV-5884: EXPLAIN UPDATE ... ORDER BY LIMIT shows wrong #rows
---echo #
-create table t2(a int);
-insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t1 (key1 int, col1 int, key(key1));
-insert into t1
-select A.a + 10 * B.a + 100 * C.a, 1234 from t2 A, t2 B, t2 C;
---echo # Should show rows=2, not rows=100
-explain update t1 set key1=key1+1 where key1 between 10 and 110 order by key1 limit 2;
-drop table t1,t2;
-
---echo #
---echo # MDEV-465: Optimizer : wrong index choice, leading to strong performances issues
---echo #
-CREATE TABLE t1 (
- id1 int(10) unsigned NOT NULL auto_increment,
- id2 tinyint(3) unsigned NOT NULL default '0',
- id3 tinyint(3) unsigned NOT NULL default '0',
- id4 int(10) unsigned NOT NULL default '0',
- date timestamp NOT NULL default CURRENT_TIMESTAMP,
- PRIMARY KEY (id1),
- KEY id_234_date (id2,id3,id4,date),
- KEY id_23_date (id2,id3,date)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-
---echo # t1 has "bad" index declaration order..
-
-CREATE TABLE t2 (
- id1 int(10) unsigned NOT NULL auto_increment,
- id2 tinyint(3) unsigned NOT NULL default '0',
- id3 tinyint(3) unsigned NOT NULL default '0',
- id4 int(10) unsigned NOT NULL default '0',
- date timestamp NOT NULL default CURRENT_TIMESTAMP,
- PRIMARY KEY (id1),
- KEY id_23_date (id2,id3,date),
- KEY id_234_date (id2,id3,id4,date)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
---echo # t2 has a "good" index declaration order
-
-INSERT INTO t1 (id2,id3,id4) VALUES (1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,0,1),(1,2,1),(1,3,1);
-INSERT INTO t2 (id2,id3,id4) VALUES (1,1,1),(1,1,1),(1,1,1),(1,1,1),(1,0,1),(1,2,1),(1,3,1);
-
---echo # The following two must both use id_23_date and no "using filesort":
-EXPLAIN SELECT id1 FROM t1 WHERE id2=1 AND id3=1 ORDER BY date DESC LIMIT 0,4;
---echo # See above query
-EXPLAIN SELECT id1 FROM t2 WHERE id2=1 AND id3=1 ORDER BY date DESC LIMIT 0,4;
-
-drop table t1,t2;
-
---echo #
---echo # MDEV-8989: ORDER BY optimizer ignores equality propagation
---echo #
-set @tmp_8989=@@optimizer_switch;
-set optimizer_switch='orderby_uses_equalities=on';
-create table t0(a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1(a int);
-insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
-
-create table t2 (
- pk int primary key,
- a int, b int,
- filler char(200),
- key(a)
-);
-insert into t2 select a, 1000-a, 1000-a, repeat('abc-',50) from t1 where a<200 limit 200;
-
-create table t3 (
- pk int primary key,
- a int, b int,
- filler char(200),
- key(a)
-);
-insert into t3 select a, 1000-a, 1000-a, repeat('abc-',50) from t1;
-insert into t3 select a+1000, 1000+a, 1000+a, repeat('abc-',50) from t1;
-
---echo # The optimizer produces an order of 't2,t3' for this join
---echo #
---echo # Case #1 (from the bug report):
---echo # Q1 can take advantage of t2.a to resolve ORDER BY limit w/o sorting
-explain
-select t2.pk,t2.a,t2.b,t3.pk,t3.a,t3.b
-from t2, t3 where t2.a=t3.a order by t2.a limit 5;
-
---echo #
---echo # This is Q2 which used to have "Using temporary; using filesort" but
---echo # has the same query plan as Q1:
---echo #
-explain
-select t2.pk,t2.a,t2.b,t3.pk,t3.a,t3.b
-from t2, t3 where t2.a=t3.a order by t3.a limit 5;
-
-select t2.pk,t2.a,t2.b,t3.pk,t3.a,t3.b
-from t2, t3 where t2.a=t3.a order by t2.a limit 5;
-
-select t2.pk,t2.a,t2.b,t3.pk,t3.a,t3.b
-from t2, t3 where t2.a=t3.a order by t3.a limit 5;
-
-
---echo #
---echo # Case #2: here, only "Using temporary" is removed. "Using filesort" remains.
---echo #
-explain
-select t2.pk,t2.a,t2.b,t3.pk,t3.a,t3.b
-from t2, t3 where t2.a=t3.a order by t2.a limit 25;
-
-explain
-select t2.pk,t2.a,t2.b,t3.pk,t3.a,t3.b
-from t2, t3 where t2.a=t3.a order by t3.a limit 25;
-
-
-select t2.pk,t2.a,t2.b,t3.pk,t3.a,t3.b
-from t2, t3 where t2.a=t3.a order by t2.a limit 25;
-
-
-select t2.pk,t2.a,t2.b,t3.pk,t3.a,t3.b
-from t2, t3 where t2.a=t3.a order by t3.a limit 25;
-
---echo #
---echo # Case #3: single table access (the code that decides whether we need
---echo # "Using temporary" is not invoked)
---echo #
-explain select * from t3 where b=a order by a limit 10;
-
---echo # This must not use filesort. The query plan should be like the query above:
-explain select * from t3 where b=a order by b limit 10;
-drop table t0,t1,t2,t3;
-
-set @@optimizer_switch=@tmp_8989;
-
-set optimizer_switch='orderby_uses_equalities=on';
-
-
---echo #
---echo # MDEV-10880: Assertions `keypart_map' or
---echo # `prebuilt->search_tuple->n_fields > 0' fail on DISTINCT and
---echo # GROUP BY constant
---echo #
-
-CREATE TABLE t1 (pk INT PRIMARY KEY);
-INSERT INTO t1 VALUES (1),(2),(3);
-SELECT DISTINCT pk FROM t1 GROUP BY 'foo';
-SELECT DISTINCT pk FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-13994: Bad join results with orderby_uses_equalities=on
---echo #
-
-CREATE TABLE books (
- id int(16) NOT NULL AUTO_INCREMENT,
- library_id int(16) NOT NULL DEFAULT 0,
- wings_id int(12) NOT NULL DEFAULT 0,
- scheduled_for_removal int(1) DEFAULT 0,
- PRIMARY KEY (id),
- KEY library_idx (library_id)
-) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
-
-INSERT INTO books VALUES (32625,8663,707,0),(32624,8663,505,1);
-
-CREATE TABLE wings (
- id int(11) NOT NULL AUTO_INCREMENT,
- department_id int(11) DEFAULT NULL,
- PRIMARY KEY (id)
-) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
-
-INSERT INTO wings VALUES (505,11745),(707,11768);
-
-let $q=
-SELECT wings.id as wing_id, wings.department_id FROM wings
- WHERE wings.id IN ( SELECT books.wings_id FROM books
- WHERE books.library_id = 8663 AND
- books.scheduled_for_removal=0 )
-ORDER BY wings.id;
-
-SET @save_optimizer_switch=@@optimizer_switch;
-
-SET optimizer_switch='orderby_uses_equalities=off';
-eval $q;
-
-SET optimizer_switch='orderby_uses_equalities=on';
-eval $q;
-eval explain extended $q;
-
-set optimizer_switch= @save_optimizer_switch;
-
-DROP TABLE books, wings;
diff --git a/mysql-test/t/order_by_innodb.test b/mysql-test/t/order_by_innodb.test
deleted file mode 100644
index 0debb777749..00000000000
--- a/mysql-test/t/order_by_innodb.test
+++ /dev/null
@@ -1,110 +0,0 @@
-#
-# ORDER BY handling (e.g. filesort) tests that require innodb
-#
--- source include/have_innodb.inc
-
---disable_warnings
-drop table if exists t0,t1,t2,t3;
---enable_warnings
-
---echo #
---echo # MDEV-6434: Wrong result (extra rows) with ORDER BY, multiple-column index, InnoDB
---echo #
-
-CREATE TABLE t1 (a INT, b INT, c INT, d TEXT, KEY idx(a,b,c)) ENGINE=InnoDB;
-
-INSERT INTO t1 (a,c) VALUES
-(8, 9),(8, 10),(13, 15),(16, 17),(16, 18),(16, 19),(20, 21),
-(20, 22),(20, 24),(20, 25),(20, 26),(20, 27),(20, 28);
-
-SELECT * FROM t1 WHERE a = 8 AND (b = 1 OR b IS NULL) ORDER BY c;
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-9457: Poor query plan chosen for ORDER BY query by a recent 10.1
---echo #
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1 (
- pk int primary key,
- key1 int,
- key2 int,
- col1 char(255),
- key(key1),
- key(key2)
-) engine=innodb;
-
-set @a=-1;
-insert into t1
-select
- @a:=@a+1,
- @a,
- @a,
- repeat('abcd', 63)
-from t0 A, t0 B, t0 C, t0 D;
-
---echo # The following must NOT use 'index' on PK.
---echo # It should use index_merge(key1,key2) + filesort
---replace_column 9 #
-explain
-select *
-from t1
-where key1<3 or key2<3
-order by pk;
-
---replace_column 9 #
-explain
-select *
-from t1
-where key1<3 or key2<3;
-
-drop table t0, t1;
-
---echo #
---echo # MDEV-14071: wrong results with orderby_uses_equalities=on
---echo # (duplicate of MDEV-13994)
---echo #
-
-CREATE TABLE t1 (i int, j int, z int,PRIMARY KEY (i,j), KEY (z)) ENGINE=InnoDB;
-CREATE TABLE t2 (i int, j int, PRIMARY KEY (i,j)) ENGINE=InnoDB;
-CREATE TABLE t3 (j int, n varchar(5), PRIMARY KEY (j)) ENGINE=InnoDB;
-
-INSERT INTO t1 VALUES
- (127,0,1),(188,0,1),(206,0,1),(218,0,1),(292,0,1),(338,0,1),(375,0,1),
- (381,0,1),(409,0,1),(466,0,1),(469,0,1),(498,0,1),(656,0,1);
-INSERT INTO t1 VALUES
- (77,4,0),(86,7,0),(96,6,0),(96,7,0),(99,9,0),(99,10,0),(99,11,0),(104,4,0),
- (106,5,0),(148,6,0),(177,6,0),(181,5,0),(188,8,0),(218,8,0),(253,7,0),
- (268,4,0),(338,4,0),(409,7,0),(466,8,0),(469,8,0),(498,8,0),(656,8,0);
-
-INSERT INTO t2 VALUES
- (127,7),(188,8),(188,9),(206,6),(218,8),(218,9),(292,7),(338,4),(338,5),
- (375,6),(381,5),(409,7),(409,8),(466,8),(466,9),(469,8),(469,9),(498,8),
- (498,9),(656,8),(656,9);
-INSERT INTO t3 VALUES
- (4,'four'),(5,'five'),(6,'six'),(7,'seven'),(8,'eight'),(9,'nine');
-
-let $q1=
-SELECT i,n
-FROM t1 INNER JOIN t2 USING (i,j) LEFT JOIN t3 USING (j)
-WHERE i IN (SELECT i FROM t1 WHERE z=1) AND z=0 ORDER BY i;
-let $q2=
-SELECT i,n
-FROM t1 x INNER JOIN t2 USING (i,j) LEFT JOIN t3 USING (j)
-WHERE EXISTS (SELECT * FROM t1 WHERE i=x.i AND z=1) AND z=0 ORDER BY i;
-
-SET @save_optimizer_switch=@@optimizer_switch;
-
-SET optimizer_switch='orderby_uses_equalities=off';
-eval $q1;
-eval $q2;
-
-SET optimizer_switch='orderby_uses_equalities=on';
-eval $q1;
-eval $q2;
-
-set optimizer_switch= @save_optimizer_switch;
-
-DROP TABLE t1,t2,t3;
diff --git a/mysql-test/t/order_by_optimizer.test b/mysql-test/t/order_by_optimizer.test
deleted file mode 100644
index a4c134afec9..00000000000
--- a/mysql-test/t/order_by_optimizer.test
+++ /dev/null
@@ -1,34 +0,0 @@
---disable_warnings
-drop table if exists t0,t1,t2,t3;
-
---enable_warnings
---echo #
---echo # MDEV-7885: EXPLAIN shows wrong info for ORDER BY query
---echo #
-create table t0(a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t1(a int);
-insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
-
-create table t2 (key1 int, col1 int, key(key1));
-insert into t2 select a,a from t0;
-insert into t2 select 15,15 from t1;
-alter table t2 add key2 int, add key(key2);
---echo # This must show "Using filesort":
-explain
-select * from t2 ignore index for order by (key1) where col1<0 order by key1 limit 10;
-
-drop table t0, t1, t2;
-
---echo #
---echo # MDEV-8857: [Upstream too] EXPLAIN incorrectly shows Distinct for tables using join buffer
---echo #
-create table t0(a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1 (a int, filler char(200), key(a));
-insert into t1 select A.a + B.a* 10, 'AAAAAAAAAAAAAAAAAAAA' from t0 A, t0 B where B.a in (0,1);
-explain select distinct A.a from t0 A, t1 B where A.a+B.a> 0;
-
-drop table t0, t1;
-
diff --git a/mysql-test/t/order_by_optimizer_innodb.test b/mysql-test/t/order_by_optimizer_innodb.test
deleted file mode 100644
index 90430d11549..00000000000
--- a/mysql-test/t/order_by_optimizer_innodb.test
+++ /dev/null
@@ -1,98 +0,0 @@
---source include/have_innodb.inc
-
---disable_warnings
-drop table if exists t0,t1,t2,t3;
---enable_warnings
-
---echo #
---echo # MDEV-6402: Optimizer doesn't choose best execution plan when composite key is used
---echo #
-create table t0(a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1(a int);
-insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
-
-CREATE TABLE t2 (
- pk1 int(11) NOT NULL,
- pk2 int(11) NOT NULL,
- fd5 bigint(20) DEFAULT NULL,
- filler1 char(200),
- filler2 char(200),
- PRIMARY KEY (pk1,pk2),
- UNIQUE KEY ux_pk1_fd5 (pk1,fd5)
- ) ENGINE=InnoDB;
-
-insert into t2
-select
- round(log(2,t1.a+1)),
- t1.a,
- t1.a,
- REPEAT('filler-data-', 10),
- REPEAT('filler-data-', 10)
-from
- t1;
-
-select pk1, count(*) from t2 group by pk1;
-
---echo # The following should use range(ux_pk1_fd5), two key parts (key_len=5+8=13)
-EXPLAIN SELECT * FROM t2 USE INDEX(ux_pk1_fd5) WHERE pk1=9 AND fd5 < 500 ORDER BY fd5 DESC LIMIT 10;
---echo # This also must use range, not ref. key_len must be 13
-EXPLAIN SELECT * FROM t2 WHERE pk1=9 AND fd5 < 500 ORDER BY fd5 DESC LIMIT 10;
-
-drop table t0,t1, t2;
-
---echo #
---echo # MDEV-6814: Server crashes in calculate_key_len on query with ORDER BY
---echo #
-CREATE TABLE t1 (f1 INT, f2 INT, f3 INT, KEY(f2),KEY(f2,f1)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,5,0),(2,6,0);
-SELECT * FROM t1 WHERE f1 < 3 AND f2 IS NULL ORDER BY f1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-6796: Unable to skip filesort when using implicit extended key
---echo #
-
-CREATE TABLE t1 (
- pk1 int(11) NOT NULL,
- pk2 varchar(64) NOT NULL,
- col1 varchar(16) DEFAULT NULL,
- PRIMARY KEY (pk1,pk2),
- KEY key1 (pk1,col1)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
-CREATE TABLE t2 (
- pk1 int(11) NOT NULL,
- pk2 varchar(64) NOT NULL,
- col1 varchar(16) DEFAULT NULL,
- PRIMARY KEY (pk1,pk2),
- KEY key1 (pk1,col1,pk2)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
-INSERT INTO `t1` VALUES
-(12321321,'a8f5f167f44f4964e6c998dee827110c','video'),
-(12321321,'d77a17a3659ffa60c54e0ea17b6c6d16','video'),
-(12321321,'wwafdsafdsafads','video'),
-(12321321,'696aa249f0738e8181957dd57c2d7d0b','video-2014-09-23'),
-(12321321,'802f9f29584b486f356693e3aa4ef0af','video=sdsd'),
-(12321321,'2f94543ff74aab82e9a058b4e8316d75','video=sdsdsds'),
-(12321321,'c1316b9df0d203fd1b9035308de52a0a','video=sdsdsdsdsd');
-
-insert into t2 select * from t1;
-
---echo # this must not use filesort:
-explain SELECT pk2
-FROM t1 USE INDEX(key1)
-WHERE pk1 = 123
-AND col1 = 'video'
-ORDER BY pk2 DESC LIMIT 21;
-
---echo # this must not use filesort, either:
-explain SELECT pk2
-FROM t2 USE INDEX(key1)
-WHERE pk1 = 123 AND col1 = 'video'
-ORDER BY pk2 DESC LIMIT 21;
-
-drop table t1, t2;
-
diff --git a/mysql-test/t/order_by_sortkey.test b/mysql-test/t/order_by_sortkey.test
deleted file mode 100644
index 43de028496e..00000000000
--- a/mysql-test/t/order_by_sortkey.test
+++ /dev/null
@@ -1,64 +0,0 @@
-#
-# WL#1393 - ORDER BY with LIMIT tests
-#
-# A big test in a separate file, so that we can run the original
-# order_by test with --debug without timeout.
-#
-# All the sort keys fit in memory, but the addon fields do not.
-#
-CREATE TABLE t1(
- f0 int auto_increment PRIMARY KEY,
- f1 int,
- f2 varchar(200)
-);
-
-INSERT INTO t1(f1, f2) VALUES
-(0,"0"),(1,"1"),(2,"2"),(3,"3"),(4,"4"),(5,"5"),
-(6,"6"),(7,"7"),(8,"8"),(9,"9"),(10,"10"),
-(11,"11"),(12,"12"),(13,"13"),(14,"14"),(15,"15"),
-(16,"16"),(17,"17"),(18,"18"),(19,"19"),(20,"20"),
-(21,"21"),(22,"22"),(23,"23"),(24,"24"),(25,"25"),
-(26,"26"),(27,"27"),(28,"28"),(29,"29"),(30,"30"),
-(31,"31"),(32,"32"),(33,"33"),(34,"34"),(35,"35"),
-(36,"36"),(37,"37"),(38,"38"),(39,"39"),(40,"40"),
-(41,"41"),(42,"42"),(43,"43"),(44,"44"),(45,"45"),
-(46,"46"),(47,"47"),(48,"48"),(49,"49"),(50,"50"),
-(51,"51"),(52,"52"),(53,"53"),(54,"54"),(55,"55"),
-(56,"56"),(57,"57"),(58,"58"),(59,"59"),(60,"60"),
-(61,"61"),(62,"62"),(63,"63"),(64,"64"),(65,"65"),
-(66,"66"),(67,"67"),(68,"68"),(69,"69"),(70,"70"),
-(71,"71"),(72,"72"),(73,"73"),(74,"74"),(75,"75"),
-(76,"76"),(77,"77"),(78,"78"),(79,"79"),(80,"80"),
-(81,"81"),(82,"82"),(83,"83"),(84,"84"),(85,"85"),
-(86,"86"),(87,"87"),(88,"88"),(89,"89"),(90,"90"),
-(91,"91"),(92,"92"),(93,"93"),(94,"94"),(95,"95"),
-(96,"96"),(97,"97"),(98,"98"),(99,"99");
-
-CREATE TEMPORARY TABLE tmp (f1 int, f2 varchar(20));
-INSERT INTO tmp SELECT f1,f2 FROM t1;
-INSERT INTO t1(f1,f2) SELECT * FROM tmp;
-INSERT INTO tmp SELECT f1,f2 FROM t1;
-INSERT INTO t1(f1,f2) SELECT * FROM tmp;
-INSERT INTO t1(f1,f2) SELECT * FROM tmp;
-INSERT INTO tmp SELECT f1,f2 FROM t1;
-INSERT INTO t1(f1,f2) SELECT * FROM tmp;
-INSERT INTO tmp SELECT f1,f2 FROM t1;
-INSERT INTO t1(f1,f2) SELECT * FROM tmp;
-INSERT INTO tmp SELECT f1,f2 FROM t1;
-INSERT INTO t1(f1,f2) SELECT * FROM tmp;
-INSERT INTO tmp SELECT f1,f2 FROM t1;
-INSERT INTO t1(f1,f2) SELECT * FROM tmp;
-INSERT INTO tmp SELECT f1,f2 FROM t1;
-INSERT INTO t1(f1,f2) SELECT * FROM tmp;
-
-# Test when only sortkeys fits to memory
-set sort_buffer_size= 32768;
-
-FLUSH STATUS;
-SHOW SESSION STATUS LIKE 'Sort%';
-
-SELECT * FROM t1 ORDER BY f2 LIMIT 100;
-
-SHOW SESSION STATUS LIKE 'Sort%';
-
-DROP TABLE t1, tmp;
diff --git a/mysql-test/t/order_by_zerolength-4285.test b/mysql-test/t/order_by_zerolength-4285.test
deleted file mode 100644
index 079ce8da71e..00000000000
--- a/mysql-test/t/order_by_zerolength-4285.test
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-# MDEV-4285 Server crashes in ptr_compare on NOW and CAST in ORDER BY
-#
-create table t1 (pk int primary key);
-insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
-
-# In strict mode the query produces result in a different order
-# (not ordered implicitly by PK and indeterministic), so we force sorting.
-# However, sorting also affects warnings, so we'll check them separately.
---disable_warnings
---sorted_result
-select * from t1 order by now(), cast(pk as char(0));
---enable_warnings
-show warnings;
-drop table t1;
diff --git a/mysql-test/t/order_fill_sortbuf.test b/mysql-test/t/order_fill_sortbuf.test
deleted file mode 100644
index 33c09e34b91..00000000000
--- a/mysql-test/t/order_fill_sortbuf.test
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# This test does a create-select with ORDER BY, where there is so many
-# rows MySQL needs to use a merge during the sort phase.
-#
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-set @@sort_buffer_size=32804;
-
-CREATE TABLE `t1` (
- `id` int(11) NOT NULL default '0',
- `id2` int(11) NOT NULL default '0',
- `id3` int(11) NOT NULL default '0');
-let $1=4000;
---disable_query_log
-begin;
-while ($1)
- {
- eval insert into t1 (id,id2,id3) values ($1,$1,$1);
- dec $1;
- }
-commit;
---enable_query_log
-create table t2 select id2 from t1 order by id3;
-select count(*) from t2;
-drop table t1,t2;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/outfile.test b/mysql-test/t/outfile.test
deleted file mode 100644
index 9f2fc22da99..00000000000
--- a/mysql-test/t/outfile.test
+++ /dev/null
@@ -1,141 +0,0 @@
-disable_query_log;
--- source include/test_outfile.inc
-# Server are started in "var/master-data", so "../../tmp" will be "var/tmp"
-eval set @tmpdir="../../tmp";
-enable_query_log;
--- source include/have_outfile.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-
-#
-# test of into outfile|dumpfile
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1 (`a` blob);
-insert into t1 values("hello world"),("Hello mars"),(NULL);
-disable_query_log;
-eval select * into outfile "../../tmp/outfile-test.1" from t1;
-enable_query_log;
-select load_file(concat(@tmpdir,"/outfile-test.1"));
-disable_query_log;
-eval select * into dumpfile "../../tmp/outfile-test.2" from t1 limit 1;
-enable_query_log;
-select load_file(concat(@tmpdir,"/outfile-test.2"));
-disable_query_log;
-eval select * into dumpfile "../../tmp/outfile-test.3" from t1 where a is null;
-enable_query_log;
-select load_file(concat(@tmpdir,"/outfile-test.3"));
-
-# the following should give errors
-
-disable_query_log;
---error ER_FILE_EXISTS_ERROR
-eval select * into outfile "../../tmp/outfile-test.1" from t1;
-
---error ER_FILE_EXISTS_ERROR
-eval select * into dumpfile "../../tmp/outfile-test.2" from t1;
-
---error ER_FILE_EXISTS_ERROR
-eval select * into dumpfile "../../tmp/outfile-test.3" from t1;
-enable_query_log;
-select load_file(concat(@tmpdir,"/outfile-test.not-exist"));
---remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.1
---remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.2
---remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.3
-drop table t1;
-
-# Bug#8191 SELECT INTO OUTFILE insists on FROM clause
-disable_query_log;
-eval select 1 into outfile "../../tmp/outfile-test.4";
-enable_query_log;
-select load_file(concat(@tmpdir,"/outfile-test.4"));
---remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4
-
-#
-# Bug#5382 'explain select into outfile' crashes the server
-#
-
-CREATE TABLE t1 (a INT);
-EXPLAIN
- SELECT *
- INTO OUTFILE '/tmp/t1.txt'
- FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
- FROM t1;
-DROP TABLE t1;
-
-# End of 4.1 tests
-
-#
-# Bug#13202 SELECT * INTO OUTFILE ... FROM information_schema.schemata now fails
-#
-disable_query_log;
-eval SELECT * INTO OUTFILE "../../tmp/outfile-test.4"
-FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
-FROM information_schema.schemata LIMIT 0, 5;
-# enable_query_log;
---remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4
-
-use information_schema;
-# disable_query_log;
-eval SELECT * INTO OUTFILE "../../tmp/outfile-test.4"
-FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
-FROM schemata LIMIT 0, 5;
-enable_query_log;
---remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4
-use test;
-
-#
-# Bug#18628 mysql-test-run: security problem
-#
-# It should not be possible to write to a file outside of vardir
-create table t1(a int);
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---error ER_OPTION_PREVENTS_STATEMENT
-eval select * into outfile "$MYSQL_TEST_DIR/outfile-test1" from t1;
-drop table t1;
-
-#
-# Bug#28181 Access denied to 'information_schema when
-# select into out file (regression)
-#
-create database mysqltest;
-create user user_1@localhost;
-grant all on mysqltest.* to user_1@localhost;
-connect (con28181_1,localhost,user_1,,mysqltest);
-
---error ER_ACCESS_DENIED_ERROR
-eval select schema_name
-into outfile "../../tmp/outfile-test.4"
-fields terminated by ',' optionally enclosed by '"'
- lines terminated by '\n'
-from information_schema.schemata
-where schema_name like 'mysqltest';
-
-connection default;
-disconnect con28181_1;
-grant file on *.* to user_1@localhost;
-
-connect (con28181_2,localhost,user_1,,mysqltest);
-eval select schema_name
-into outfile "../../tmp/outfile-test.4"
-fields terminated by ',' optionally enclosed by '"'
- lines terminated by '\n'
-from information_schema.schemata
-where schema_name like 'mysqltest';
-
-connection default;
-disconnect con28181_2;
---remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4
-use test;
-revoke all privileges on *.* from user_1@localhost;
-drop user user_1@localhost;
-drop database mysqltest;
-
-# Wait till we reached the initial number of concurrent sessions
---source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/outfile_loaddata.test b/mysql-test/t/outfile_loaddata.test
deleted file mode 100644
index 745c75cb4de..00000000000
--- a/mysql-test/t/outfile_loaddata.test
+++ /dev/null
@@ -1,294 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
---echo #
---echo # Bug#31663 FIELDS TERMINATED BY special character
---echo #
-
-CREATE TABLE t1 (i1 int, i2 int, c1 VARCHAR(256), c2 VARCHAR(256));
-INSERT INTO t1 VALUES (101, 202, '-r-', '=raker=');
-
---let $fields=*
---let $clauses=FIELDS TERMINATED BY 'raker'
---echo # $clauses, warning:
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt')
---eval CREATE TABLE t2 SELECT $fields FROM t1
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 $clauses
---eval SELECT $fields FROM t2
---remove_file $MYSQLTEST_VARDIR/tmp/bug31663.txt
-DROP TABLE t2;
-
---let $fields=i1, i2
---let $clauses=FIELDS TERMINATED BY 'r'
---echo # Only numeric fields, $clauses, no warnings:
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt')
---eval CREATE TABLE t2 SELECT $fields FROM t1
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 $clauses
---eval SELECT $fields FROM t2
---remove_file $MYSQLTEST_VARDIR/tmp/bug31663.txt
-DROP TABLE t2;
-
---let $fields=*
---let $clauses=FIELDS TERMINATED BY '0'
---echo # $clauses, warning:
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt')
---eval CREATE TABLE t2 SELECT $fields FROM t1
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 $clauses
---eval SELECT $fields FROM t2
---remove_file $MYSQLTEST_VARDIR/tmp/bug31663.txt
-DROP TABLE t2;
-
---let $fields=*
---let $clauses=FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0'
---echo # $clauses, warning:
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt')
---eval CREATE TABLE t2 SELECT $fields FROM t1
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 $clauses
---eval SELECT $fields FROM t2
---remove_file $MYSQLTEST_VARDIR/tmp/bug31663.txt
-DROP TABLE t2;
-
---let $fields=c1, c2
---let $clauses=FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0'
---echo # Only string fields, $clauses, no warnings:
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt')
---eval CREATE TABLE t2 SELECT $fields FROM t1
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 $clauses
---eval SELECT $fields FROM t2
---remove_file $MYSQLTEST_VARDIR/tmp/bug31663.txt
-DROP TABLE t2;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug#32533: SELECT INTO OUTFILE never escapes multibyte character
---echo #
-
-CREATE TABLE t1 (c1 VARCHAR(256));
-INSERT INTO t1 VALUES (0xC3);
-SELECT HEX(c1) FROM t1;
-
---let $file=$MYSQLTEST_VARDIR/tmp/bug32533.txt
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT * INTO OUTFILE '$file' FIELDS ENCLOSED BY 0xC3 FROM t1
-TRUNCATE t1;
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT HEX(LOAD_FILE('$file'))
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval LOAD DATA INFILE '$file' INTO TABLE t1 FIELDS ENCLOSED BY 0xC3
-SELECT HEX(c1) FROM t1;
-
---remove_file $file
-DROP TABLE t1;
-
---echo # End of 5.0 tests.
-
-###########################################################################
-
---echo #
---echo # Bug #30946: mysqldump silently ignores --default-character-set
---echo # when used with --tab
---echo #
---echo # Also see mysqldump.test
---echo #
-
-SET NAMES utf8;
-CREATE TABLE t1 (a INT, b CHAR(10) CHARSET koi8r, c CHAR(10) CHARSET latin1);
-CREATE TABLE t2 LIKE t1;
-INSERT INTO t1 VALUES (1, 'ABC-АБВ', 'DEF-ÂÃÄ'), (2, NULL, NULL);
-
---let $file=$MYSQLTEST_VARDIR/tmp/t1.txt
-
-
---echo # Error on multi-character ENCLOSED/ESCAPED BY
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---error 1083
---eval SELECT * FROM t1 INTO OUTFILE '$file' FIELDS ENCLOSED BY '12345'
---remove_file $file
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---error 1083
---eval SELECT * FROM t1 INTO OUTFILE '$file' FIELDS ESCAPED BY '12345'
---remove_file $file
-
-
---echo # "Not implemented" warning on multibyte ENCLOSED/ESCAPED BY character,
---echo # LOAD DATA rises error or has unpredictable result -- to be fixed later
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT * FROM t1 INTO OUTFILE '$file' FIELDS ENCLOSED BY 'ъ'
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---error 1083 # backward compatibility
---eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary FIELDS ENCLOSED BY 'ъ'
---remove_file $file
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT * FROM t1 INTO OUTFILE '$file' FIELDS ESCAPED BY 'ъ'
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---error 1083 # backward compatibility
---eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary FIELDS ESCAPED BY 'ъ'
---remove_file $file
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT * FROM t1 INTO OUTFILE '$file' FIELDS TERMINATED BY 'ъ'
---echo ##################################################
---cat_file $file
---echo ##################################################
-TRUNCATE t2;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary FIELDS TERMINATED BY 'ъ'
---remove_file $file
-SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
-SELECT * FROM t1;
-SELECT * FROM t2;
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT * FROM t1 INTO OUTFILE '$file' LINES STARTING BY 'ъ'
---echo ##################################################
---cat_file $file
---echo ##################################################
-TRUNCATE t2;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary LINES STARTING BY 'ъ'
---remove_file $file
-SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT * FROM t1 INTO OUTFILE '$file' LINES TERMINATED BY 'ъ'
---echo ##################################################
---cat_file $file
---echo ##################################################
-TRUNCATE t2;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary LINES TERMINATED BY 'ъ'
---remove_file $file
-SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
-SELECT * FROM t1;
-SELECT * FROM t2;
-
---echo # Default (binary) charset:
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT * INTO OUTFILE '$file' FROM t1
---echo ##################################################
---cat_file $file
---echo ##################################################
-TRUNCATE t2;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary
---remove_file $file
-SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
-
-
---echo # latin1 charset (INTO OUTFILE warning is expected):
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT * INTO OUTFILE '$file' CHARACTER SET latin1 FROM t1
---echo ##################################################
---cat_file $file
---echo ##################################################
-TRUNCATE t2;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET latin1
---remove_file $file
-SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
-
-
---echo # KOI8-R charset (INTO OUTFILE warning is expected):
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT * INTO OUTFILE '$file' CHARACTER SET koi8r FROM t1
---echo ##################################################
---cat_file $file
---echo ##################################################
-TRUNCATE t2;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET koi8r
---remove_file $file
-SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
-
-
---echo # UTF-8 charset:
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT * INTO OUTFILE '$file' CHARACTER SET utf8 FROM t1
---echo ##################################################
---cat_file $file
---echo ##################################################
-TRUNCATE t2;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET utf8
---remove_file $file
-SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
-
-
-SET NAMES default;
-
-DROP TABLE t1, t2;
-###########################################################################
-
---echo #
---echo # Bug #53088: mysqldump with -T & --default-character-set set
---echo # truncates text/blob to 766 chars
---echo #
---echo # Also see mysqldump.test
---echo #
-
-CREATE TABLE t1 (a BLOB) CHARSET latin1;
-CREATE TABLE t2 LIKE t1;
-
-let $file= '$MYSQLTEST_VARDIR/tmp/bug53088.txt';
-let $length= 800;
-
---eval INSERT INTO t1 VALUES (REPEAT('.', $length))
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT * INTO OUTFILE $file CHARACTER SET latin1 FROM t1
-
---echo # should be greater than $length
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval SELECT LENGTH(LOAD_FILE($file))
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval LOAD DATA INFILE $file INTO TABLE t2
-
---remove_file $MYSQLTEST_VARDIR/tmp/bug53088.txt
-
---echo # should be $length
-SELECT LENGTH(a) FROM t2;
-
-DROP TABLE t1, t2;
-
-
-###########################################################################
---echo # End of 5.1 tests.
diff --git a/mysql-test/t/overflow.test b/mysql-test/t/overflow.test
deleted file mode 100644
index 774c43be658..00000000000
--- a/mysql-test/t/overflow.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-connect (con1,localhost,root,,);
-connection con1;
---error ER_PARSE_ERROR,ER_WRONG_DB_NAME,ER_WRONG_NAME_FOR_INDEX
-drop database AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA;
-connection default;
-disconnect con1;
-
-# End of 4.1 tests
-
-# Wait till we reached the initial number of concurrent sessions
---source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/packet.test b/mysql-test/t/packet.test
deleted file mode 100644
index 7e08a0f6c3f..00000000000
--- a/mysql-test/t/packet.test
+++ /dev/null
@@ -1,56 +0,0 @@
-# Embedded server doesn't support external clients
---source include/not_embedded.inc
-# Windows fails because it disconnects on too-large packets instead of just
-# swallowing them and returning an error
---source include/not_windows.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-
-#
-# Check protocol handling
-#
-
-set @max_allowed_packet=@@global.max_allowed_packet;
-set @net_buffer_length=@@global.net_buffer_length;
-
-
-# setting values below minimum threshold of 1024 will cause truncating
-set global max_allowed_packet=100;
-set global net_buffer_length=100;
-
-# is not yet in effect
-SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
-select repeat('a',2000);
-
-#
-# Connection 1 should get error for too big packets
-#
-connect (con1,localhost,root,,);
-connection con1;
-select @@net_buffer_length, @@max_allowed_packet;
---error ER_NET_PACKET_TOO_LARGE
-SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
-connection default;
-disconnect con1;
-
-#
-# Reset to default values and reconnect
-#
-set global max_allowed_packet=default;
-set global net_buffer_length=default;
-connect (con2,localhost,root,,);
-connection con2;
-SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
-select length(repeat('a',2000));
-connection default;
-disconnect con2;
-
-set global max_allowed_packet=@max_allowed_packet;
-set global net_buffer_length=@net_buffer_length;
-
-# End of 4.1 tests
-
-# Wait till we reached the initial number of concurrent sessions
---source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/parser.test b/mysql-test/t/parser.test
deleted file mode 100644
index 1f176c6afc5..00000000000
--- a/mysql-test/t/parser.test
+++ /dev/null
@@ -1,1381 +0,0 @@
-#
-# This file contains tests covering the parser
-#
-
-#=============================================================================
-# LEXICAL PARSER (lex)
-#=============================================================================
-
-#
-# Maintainer: these tests are for the lexical parser, so every character,
-# even whitespace or comments, is significant here.
-#
-
-SET @save_sql_mode=@@sql_mode;
-
-#
-# Documenting the current behavior, to detect incompatible changes.
-# In each cases:
-# - no error is the correct result
-# - an error is the expected result with the current implementation,
-# and is a limitation.
-
-set SQL_MODE='';
-
-create table ADDDATE(a int);
-drop table ADDDATE;
-create table ADDDATE (a int);
-drop table ADDDATE;
-
---error ER_PARSE_ERROR
-create table BIT_AND(a int);
-create table BIT_AND (a int);
-drop table BIT_AND;
-
---error ER_PARSE_ERROR
-create table BIT_OR(a int);
-create table BIT_OR (a int);
-drop table BIT_OR;
-
---error ER_PARSE_ERROR
-create table BIT_XOR(a int);
-create table BIT_XOR (a int);
-drop table BIT_XOR;
-
---error ER_PARSE_ERROR
-create table CAST(a int);
-create table CAST (a int);
-drop table CAST;
-
---error ER_PARSE_ERROR
-create table COUNT(a int);
-create table COUNT (a int);
-drop table COUNT;
-
---error ER_PARSE_ERROR
-create table CURDATE(a int);
-create table CURDATE (a int);
-drop table CURDATE;
-
---error ER_PARSE_ERROR
-create table CURTIME(a int);
-create table CURTIME (a int);
-drop table CURTIME;
-
---error ER_PARSE_ERROR
-create table DATE_ADD(a int);
-create table DATE_ADD (a int);
-drop table DATE_ADD;
-
---error ER_PARSE_ERROR
-create table DATE_SUB(a int);
-create table DATE_SUB (a int);
-drop table DATE_SUB;
-
---error ER_PARSE_ERROR
-create table EXTRACT(a int);
-create table EXTRACT (a int);
-drop table EXTRACT;
-
---error ER_PARSE_ERROR
-create table GROUP_CONCAT(a int);
-create table GROUP_CONCAT (a int);
-drop table GROUP_CONCAT;
-
-# Limitation removed in 5.1
-create table GROUP_UNIQUE_USERS(a int);
-drop table GROUP_UNIQUE_USERS;
-create table GROUP_UNIQUE_USERS (a int);
-drop table GROUP_UNIQUE_USERS;
-
---error ER_PARSE_ERROR
-create table MAX(a int);
-create table MAX (a int);
-drop table MAX;
-
---error ER_PARSE_ERROR
-create table MID(a int);
-create table MID (a int);
-drop table MID;
-
---error ER_PARSE_ERROR
-create table MIN(a int);
-create table MIN (a int);
-drop table MIN;
-
---error ER_PARSE_ERROR
-create table NOW(a int);
-create table NOW (a int);
-drop table NOW;
-
---error ER_PARSE_ERROR
-create table POSITION(a int);
-create table POSITION (a int);
-drop table POSITION;
-
-create table SESSION_USER(a int);
-drop table SESSION_USER;
-create table SESSION_USER (a int);
-drop table SESSION_USER;
-
---error ER_PARSE_ERROR
-create table STD(a int);
-create table STD (a int);
-drop table STD;
-
---error ER_PARSE_ERROR
-create table STDDEV(a int);
-create table STDDEV (a int);
-drop table STDDEV;
-
---error ER_PARSE_ERROR
-create table STDDEV_POP(a int);
-create table STDDEV_POP (a int);
-drop table STDDEV_POP;
-
---error ER_PARSE_ERROR
-create table STDDEV_SAMP(a int);
-create table STDDEV_SAMP (a int);
-drop table STDDEV_SAMP;
-
-create table SUBDATE(a int);
-drop table SUBDATE;
-create table SUBDATE (a int);
-drop table SUBDATE;
-
---error ER_PARSE_ERROR
-create table SUBSTR(a int);
-create table SUBSTR (a int);
-drop table SUBSTR;
-
---error ER_PARSE_ERROR
-create table SUBSTRING(a int);
-create table SUBSTRING (a int);
-drop table SUBSTRING;
-
---error ER_PARSE_ERROR
-create table SUM(a int);
-create table SUM (a int);
-drop table SUM;
-
---error ER_PARSE_ERROR
-create table SYSDATE(a int);
-create table SYSDATE (a int);
-drop table SYSDATE;
-
-create table SYSTEM_USER(a int);
-drop table SYSTEM_USER;
-create table SYSTEM_USER (a int);
-drop table SYSTEM_USER;
-
---error ER_PARSE_ERROR
-create table TRIM(a int);
-create table TRIM (a int);
-drop table TRIM;
-
-# Limitation removed in 5.1
-create table UNIQUE_USERS(a int);
-drop table UNIQUE_USERS;
-create table UNIQUE_USERS (a int);
-drop table UNIQUE_USERS;
-
---error ER_PARSE_ERROR
-create table VARIANCE(a int);
-create table VARIANCE (a int);
-drop table VARIANCE;
-
---error ER_PARSE_ERROR
-create table VAR_POP(a int);
-create table VAR_POP (a int);
-drop table VAR_POP;
-
---error ER_PARSE_ERROR
-create table VAR_SAMP(a int);
-create table VAR_SAMP (a int);
-drop table VAR_SAMP;
-
-set SQL_MODE='IGNORE_SPACE';
-
-create table ADDDATE(a int);
-drop table ADDDATE;
-create table ADDDATE (a int);
-drop table ADDDATE;
-
---error ER_PARSE_ERROR
-create table BIT_AND(a int);
---error ER_PARSE_ERROR
-create table BIT_AND (a int);
-
---error ER_PARSE_ERROR
-create table BIT_OR(a int);
---error ER_PARSE_ERROR
-create table BIT_OR (a int);
-
---error ER_PARSE_ERROR
-create table BIT_XOR(a int);
---error ER_PARSE_ERROR
-create table BIT_XOR (a int);
-
---error ER_PARSE_ERROR
-create table CAST(a int);
---error ER_PARSE_ERROR
-create table CAST (a int);
-
---error ER_PARSE_ERROR
-create table COUNT(a int);
---error ER_PARSE_ERROR
-create table COUNT (a int);
-
---error ER_PARSE_ERROR
-create table CURDATE(a int);
---error ER_PARSE_ERROR
-create table CURDATE (a int);
-
---error ER_PARSE_ERROR
-create table CURTIME(a int);
---error ER_PARSE_ERROR
-create table CURTIME (a int);
-
---error ER_PARSE_ERROR
-create table DATE_ADD(a int);
---error ER_PARSE_ERROR
-create table DATE_ADD (a int);
-
---error ER_PARSE_ERROR
-create table DATE_SUB(a int);
---error ER_PARSE_ERROR
-create table DATE_SUB (a int);
-
---error ER_PARSE_ERROR
-create table EXTRACT(a int);
---error ER_PARSE_ERROR
-create table EXTRACT (a int);
-
---error ER_PARSE_ERROR
-create table GROUP_CONCAT(a int);
---error ER_PARSE_ERROR
-create table GROUP_CONCAT (a int);
-
-# Limitation removed in 5.1
-create table GROUP_UNIQUE_USERS(a int);
-drop table GROUP_UNIQUE_USERS;
-create table GROUP_UNIQUE_USERS (a int);
-drop table GROUP_UNIQUE_USERS;
-
---error ER_PARSE_ERROR
-create table MAX(a int);
---error ER_PARSE_ERROR
-create table MAX (a int);
-
---error ER_PARSE_ERROR
-create table MID(a int);
---error ER_PARSE_ERROR
-create table MID (a int);
-
---error ER_PARSE_ERROR
-create table MIN(a int);
---error ER_PARSE_ERROR
-create table MIN (a int);
-
---error ER_PARSE_ERROR
-create table NOW(a int);
---error ER_PARSE_ERROR
-create table NOW (a int);
-
---error ER_PARSE_ERROR
-create table POSITION(a int);
---error ER_PARSE_ERROR
-create table POSITION (a int);
-
-create table SESSION_USER(a int);
-drop table SESSION_USER;
-create table SESSION_USER (a int);
-drop table SESSION_USER;
-
---error ER_PARSE_ERROR
-create table STD(a int);
---error ER_PARSE_ERROR
-create table STD (a int);
-
---error ER_PARSE_ERROR
-create table STDDEV(a int);
---error ER_PARSE_ERROR
-create table STDDEV (a int);
-
---error ER_PARSE_ERROR
-create table STDDEV_POP(a int);
---error ER_PARSE_ERROR
-create table STDDEV_POP (a int);
-
---error ER_PARSE_ERROR
-create table STDDEV_SAMP(a int);
---error ER_PARSE_ERROR
-create table STDDEV_SAMP (a int);
-
-create table SUBDATE(a int);
-drop table SUBDATE;
-create table SUBDATE (a int);
-drop table SUBDATE;
-
---error ER_PARSE_ERROR
-create table SUBSTR(a int);
---error ER_PARSE_ERROR
-create table SUBSTR (a int);
-
---error ER_PARSE_ERROR
-create table SUBSTRING(a int);
---error ER_PARSE_ERROR
-create table SUBSTRING (a int);
-
---error ER_PARSE_ERROR
-create table SUM(a int);
---error ER_PARSE_ERROR
-create table SUM (a int);
-
---error ER_PARSE_ERROR
-create table SYSDATE(a int);
---error ER_PARSE_ERROR
-create table SYSDATE (a int);
-
-create table SYSTEM_USER(a int);
-drop table SYSTEM_USER;
-create table SYSTEM_USER (a int);
-drop table SYSTEM_USER;
-
---error ER_PARSE_ERROR
-create table TRIM(a int);
---error ER_PARSE_ERROR
-create table TRIM (a int);
-
-# Limitation removed in 5.1
-create table UNIQUE_USERS(a int);
-drop table UNIQUE_USERS;
-create table UNIQUE_USERS (a int);
-drop table UNIQUE_USERS;
-
---error ER_PARSE_ERROR
-create table VARIANCE(a int);
---error ER_PARSE_ERROR
-create table VARIANCE (a int);
-
---error ER_PARSE_ERROR
-create table VAR_POP(a int);
---error ER_PARSE_ERROR
-create table VAR_POP (a int);
-
---error ER_PARSE_ERROR
-create table VAR_SAMP(a int);
---error ER_PARSE_ERROR
-create table VAR_SAMP (a int);
-
-#
-# Bug#25930 (CREATE TABLE x SELECT ... parses columns wrong when ran with
-# ANSI_QUOTES mode)
-#
-
---disable_warnings
-DROP TABLE IF EXISTS table_25930_a;
-DROP TABLE IF EXISTS table_25930_b;
---enable_warnings
-
-SET SQL_MODE = 'ANSI_QUOTES';
-CREATE TABLE table_25930_a ( "blah" INT );
-CREATE TABLE table_25930_b SELECT "blah" - 1 FROM table_25930_a;
-
-# The lexer used to chop the first <">,
-# not marking the start of the token "blah" correctly.
-desc table_25930_b;
-
-DROP TABLE table_25930_a;
-DROP TABLE table_25930_b;
-
-
-SET @@sql_mode=@save_sql_mode;
-
-#
-# Bug#26030 (Parsing fails for stored routine w/multi-statement execution
-# enabled)
-#
-
---disable_warnings
-DROP PROCEDURE IF EXISTS p26030;
---enable_warnings
-
-delimiter $$;
-
-select "non terminated"$$
-select "terminated";$$
-select "non terminated, space" $$
-select "terminated, space"; $$
-select "non terminated, comment" /* comment */$$
-select "terminated, comment"; /* comment */$$
-
-# Multi queries can not be used in --ps-protocol test mode
---disable_ps_protocol
-
-select "stmt 1";select "stmt 2 non terminated"$$
-select "stmt 1";select "stmt 2 terminated";$$
-select "stmt 1";select "stmt 2 non terminated, space" $$
-select "stmt 1";select "stmt 2 terminated, space"; $$
-select "stmt 1";select "stmt 2 non terminated, comment" /* comment */$$
-select "stmt 1";select "stmt 2 terminated, comment"; /* comment */$$
-
-select "stmt 1"; select "space, stmt 2"$$
-select "stmt 1";/* comment */select "comment, stmt 2"$$
-
-DROP PROCEDURE IF EXISTS p26030; CREATE PROCEDURE p26030() BEGIN SELECT 1; END; CALL p26030()
-$$
-
-DROP PROCEDURE IF EXISTS p26030; CREATE PROCEDURE p26030() SELECT 1; CALL p26030()
-$$
-
---enable_ps_protocol
-
-delimiter ;$$
-DROP PROCEDURE p26030;
-
-#=============================================================================
-# SYNTACTIC PARSER (bison)
-#=============================================================================
-
-#
-#
-# Bug#21114 (Foreign key creation fails to table with name format)
-#
-
-# Test coverage with edge conditions
-
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select pi(3.14);
-
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select tan();
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select tan(1, 2);
-
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select makedate(1);
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select makedate(1, 2, 3);
-
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select maketime();
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select maketime(1);
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select maketime(1, 2);
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select maketime(1, 2, 3, 4);
-
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select atan();
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select atan2(1, 2, 3);
-
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select concat();
-select concat("foo");
-
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select concat_ws();
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select concat_ws("foo");
-
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select encrypt();
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select encrypt(1, 2, 3);
-
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select des_encrypt("p1", "p2", "not expected");
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select des_decrypt("p1", "p2", "not expected");
-
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select elt();
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select elt(1);
-
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select export_set();
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select export_set("p1");
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select export_set("p1", "p2");
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select export_set("p1", "p2", "p3", "p4", "p5", "p6");
-
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select field();
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select field("p1");
-
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select from_unixtime();
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select from_unixtime(1, 2, 3);
-
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select unix_timestamp(1, 2);
-
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select greatest();
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select greatest(12);
-
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select last_insert_id(1, 2);
-
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select least();
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select least(12);
-
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select locate();
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select locate(1);
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select locate(1, 2, 3, 4);
-
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select log();
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select log(1, 2, 3);
-
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select make_set();
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select make_set(1);
-
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select master_pos_wait();
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select master_pos_wait(1);
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select master_pos_wait(1, 2, 3, 4, 5);
-
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select rand(1, 2, 3);
-
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select round(1, 2, 3);
-
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select yearweek();
--- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select yearweek(1, 2, 3);
-
-#
-# Bug#24736: UDF functions parsed as Stored Functions
-#
-
-# Verify that the syntax for calling UDF : foo(expr AS param, ...)
-# can not be used when calling native functions
-
-# Native function with 1 argument
-
-select abs(3);
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select abs(3 AS three);
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select abs(3 three);
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select abs(3 AS "three");
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select abs(3 "three");
-
-# Native function with 2 arguments
-
-set @bar="bar";
-set @foobar="foobar";
-
-select instr("foobar", "bar");
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select instr("foobar" AS p1, "bar");
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select instr("foobar" p1, "bar");
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select instr("foobar" AS "p1", "bar");
-## String concatenation, valid syntax
-select instr("foobar" "p1", "bar");
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select instr(@foobar "p1", "bar");
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select instr("foobar", "bar" AS p2);
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select instr("foobar", "bar" p2);
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select instr("foobar", "bar" AS "p2");
-## String concatenation, valid syntax
-select instr("foobar", "bar" "p2");
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select instr("foobar", @bar "p2");
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select instr("foobar" AS p1, "bar" AS p2);
-
-# Native function with 3 arguments
-
-select conv(255, 10, 16);
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select conv(255 AS p1, 10, 16);
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select conv(255 p1, 10, 16);
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select conv(255 AS "p1", 10, 16);
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select conv(255 "p1", 10, 16);
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select conv(255, 10 AS p2, 16);
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select conv(255, 10 p2, 16);
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select conv(255, 10 AS "p2", 16);
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select conv(255, 10 "p2", 16);
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select conv(255, 10, 16 AS p3);
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select conv(255, 10, 16 p3);
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select conv(255, 10, 16 AS "p3");
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select conv(255, 10, 16 "p3");
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select conv(255 AS p1, 10 AS p2, 16 AS p3);
-
-# Native function with a variable number of arguments
-
-# Bug in libm.so on Solaris:
-# atan(10) from 32-bit version returns 1.4711276743037347
-# atan(10) from 64-bit version returns 1.4711276743037345
---replace_result 1.4711276743037345 1.4711276743037347
-select atan(10);
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select atan(10 AS p1);
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select atan(10 p1);
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select atan(10 AS "p1");
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select atan(10 "p1");
-
-select atan(10, 20);
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select atan(10 AS p1, 20);
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select atan(10 p1, 20);
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select atan(10 AS "p1", 20);
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select atan(10 "p1", 20);
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select atan(10, 20 AS p2);
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select atan(10, 20 p2);
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select atan(10, 20 AS "p2");
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select atan(10, 20 "p2");
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select atan(10 AS p1, 20 AS p2);
-
-#
-# Bug#22312 Syntax error in expression with INTERVAL()
-#
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-SELECT STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE;
-SELECT STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL (INTERVAL(1,2,3) + 1) MINUTE;
-SELECT "1997-12-31 23:59:59" + INTERVAL 1 SECOND;
-SELECT 1 + INTERVAL(1,0,1,2) + 1;
-SELECT INTERVAL(1^1,0,1,2) + 1;
-SELECT INTERVAL(1,0+1,2,3) * 5.5;
-SELECT INTERVAL(3,3,1+3,4+4) / 0.5;
-SELECT (INTERVAL(1,0,1,2) + 5) * 7 + INTERVAL(1,0,1,2) / 2;
-SELECT INTERVAL(1,0,1,2) + 1, 5 * INTERVAL(1,0,1,2);
-SELECT INTERVAL(0,(1*5)/2) + INTERVAL(5,4,3);
-
---disable_warnings
-SELECT 1^1 + INTERVAL 1+1 SECOND & 1 + INTERVAL 1+1 SECOND;
-SELECT 1%2 - INTERVAL 1^1 SECOND | 1%2 - INTERVAL 1^1 SECOND;
---enable_warnings
-
-CREATE TABLE t1 (a INT, b DATETIME);
-INSERT INTO t1 VALUES (INTERVAL(3,2,1) + 1, "1997-12-31 23:59:59" + INTERVAL 1 SECOND);
-SELECT * FROM t1 WHERE a = INTERVAL(3,2,1) + 1;
-DROP TABLE t1;
-
-#
-# Bug#28317 Left Outer Join with {oj outer-join}
-#
-
---disable_warnings
-DROP TABLE IF EXISTS t1,t2,t3;
---enable_warnings
-CREATE TABLE t1 (a1 INT, a2 INT, a3 INT, a4 DATETIME);
-CREATE TABLE t2 LIKE t1;
-CREATE TABLE t3 LIKE t1;
-SELECT t1.* FROM t1 AS t0, { OJ t2 INNER JOIN t1 ON (t1.a1=t2.a1) } WHERE t0.a3=2;
-SELECT t1.*,t2.* FROM { OJ ((t1 INNER JOIN t2 ON (t1.a1=t2.a2)) LEFT OUTER JOIN t3 ON t3.a3=t2.a1)};
-SELECT t1.*,t2.* FROM { OJ ((t1 LEFT OUTER JOIN t2 ON t1.a3=t2.a2) INNER JOIN t3 ON (t3.a1=t2.a2))};
-SELECT t1.*,t2.* FROM { OJ (t1 LEFT OUTER JOIN t2 ON t1.a1=t2.a2) CROSS JOIN t3 ON (t3.a2=t2.a3)};
-SELECT * FROM {oj t1 LEFT OUTER JOIN t2 ON t1.a1=t2.a3} WHERE t1.a2 > 10;
-SELECT {fn CONCAT(a1,a2)} FROM t1;
-UPDATE t3 SET a4={d '1789-07-14'} WHERE a1=0;
-SELECT a1, a4 FROM t2 WHERE a4 LIKE {fn UCASE('1789-07-14')};
-DROP TABLE t1, t2, t3;
-
---echo #
---echo # End of 5.1 tests
---echo #
-
---echo #
---echo # Bug#17075846 : unquoted file names for variable values are
---echo # accepted but parsed incorrectly
---echo #
---error ER_WRONG_TYPE_FOR_VAR
-SET default_storage_engine=a.myisam;
---error ER_WRONG_TYPE_FOR_VAR
-SET default_storage_engine = .a.MyISAM;
---error ER_WRONG_TYPE_FOR_VAR
-SET default_storage_engine = a.b.MyISAM;
---error ER_WRONG_TYPE_FOR_VAR
-SET default_storage_engine = `a`.MyISAM;
---error ER_WRONG_TYPE_FOR_VAR
-SET default_storage_engine = `a`.`MyISAM`;
---error ER_UNKNOWN_STORAGE_ENGINE
-set default_storage_engine = "a.MYISAM";
---error ER_UNKNOWN_STORAGE_ENGINE
-set default_storage_engine = 'a.MYISAM';
---error ER_UNKNOWN_STORAGE_ENGINE
-set default_storage_engine = `a.MYISAM`;
-CREATE TABLE t1 (s VARCHAR(100));
---ERROR ER_BAD_FIELD_ERROR
-CREATE TRIGGER trigger1 BEFORE INSERT ON t1 FOR EACH ROW
-SET default_storage_engine = NEW.INNODB;
-DROP TABLE t1;
-
-#
-# MDEV-8328 Evaluation of two "!" operators depends on space in beetween
-#
---error ER_PARSE_ERROR
-select 0==0;
-select 1=!0, 1 = ! 0;
-select !!0, ! ! 0;
-select 2>!0, 2 > ! 0;
-select 0<=!0, 0 <= !0;
-select 1<<!0, 1 << !0;
-select 0<!0, 0 < ! 0;
-
---echo #
---echo # MDEV-11171 Assertion `m_cpp_buf <= ptr && ptr <= m_cpp_buf + m_buf_length' failed in Lex_input_stream::body_utf8_append(const char*, const char*)
---echo #
-CREATE TABLE t1 (id INT);
---error ER_PARSE_ERROR
-CREATE TRIGGER tr AFTER DELETE ON t1 FOR EACH ROW SET @a = 1\;
---error ER_PARSE_ERROR
-PREPARE stmt FROM 'CREATE TRIGGER tr AFTER DELETE ON t1 FOR EACH ROW SET @a = 1\\';
-DROP TABLE t1;
-
-#
-# start of 10.1 tests
-#
-
---echo #
---echo # MDEV-7792 - SQL Parsing Error - UNION AND ORDER BY WITH JOIN
---echo #
-CREATE TABLE t1(a INT);
-SELECT * FROM t1 JOIN ((SELECT 1 AS b) UNION ALL (SELECT 2 AS b) ORDER BY b DESC) s1 WHERE a=1;
-DROP TABLE t1;
-
-
---echo #
---echo # Test of collective fix for three parser bugs:
---echo #
---echo # Bug #17727401, Bug #17426017, Bug #17473479:
---echo # The server accepts wrong syntax and then fails in different ways
---echo #
-
-CREATE TABLE t1 (i INT);
-
---echo # bug #17426017
---error ER_PARSE_ERROR
-SELECT (SELECT EXISTS(SELECT * LIMIT 1 ORDER BY VALUES (c00)));
-
---echo # bug#17473479
-CREATE TABLE a(a int);
-CREATE TABLE b(a int);
---error ER_PARSE_ERROR
-DELETE FROM b ORDER BY(SELECT 1 FROM a ORDER BY a ORDER BY a);
-DROP TABLE a, b;
-
---echo # bug #17727401
---error ER_PARSE_ERROR
-SELECT '' IN (SELECT '1' c FROM t1 ORDER BY '' ORDER BY '') FROM t1;
-
---echo # regression & coverage tests
-
---echo # uniform syntax for FROM DUAL clause:
-
-SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
- FOR UPDATE;
-
---error ER_ORDER_WITH_PROC
-SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
- PROCEDURE ANALYSE() FOR UPDATE;
-
-SELECT 1 FROM
- (SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
- FOR UPDATE) a;
-
---error ER_PARSE_ERROR
-SELECT 1 FROM
- (SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
- PROCEDURE ANALYSE() FOR UPDATE) a;
-
-SELECT 1 FROM t1
- WHERE EXISTS(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
- FOR UPDATE);
-
---error ER_PARSE_ERROR
-SELECT 1 FROM t1
- WHERE EXISTS(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
- PROCEDURE ANALYSE() FOR UPDATE);
-
-SELECT 1 FROM t1
-UNION
-SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
- FOR UPDATE;
-
---error ER_PARSE_ERROR
-SELECT 1 FROM t1
-UNION
-SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
- PROCEDURE ANALYSE() FOR UPDATE;
-
---error ER_PARSE_ERROR
-SELECT 1 FROM DUAL PROCEDURE ANALYSE()
-UNION
-SELECT 1 FROM t1;
-
-(SELECT 1 FROM t1)
-UNION
-(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
- FOR UPDATE);
-
---error ER_PARSE_ERROR
-(SELECT 1 FROM t1)
-UNION
-(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
- PROCEDURE ANALYSE() FOR UPDATE);
-
---echo # "FOR UPDATE" tests
-
-SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1;
-SELECT 1 FROM t1 FOR UPDATE UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1;
-SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 FOR UPDATE;
-
-
---echo # "INTO" clause tests
-
-SELECT 1 FROM t1 INTO @var17727401;
-SELECT 1 FROM DUAL INTO @var17727401;
-SELECT 1 INTO @var17727401;
-
-SELECT 1 INTO @var17727401 FROM t1;
-SELECT 1 INTO @var17727401 FROM DUAL;
-
---error ER_PARSE_ERROR
-SELECT 1 INTO @var17727401_1 FROM t1 INTO @var17727401_2;
-
---error ER_PARSE_ERROR
-SELECT 1 INTO @var17727401_1 FROM DUAL
- INTO @var17727401_2;
-
-SELECT 1 INTO @var17727401 FROM t1 WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 LIMIT 1;
-SELECT 1 FROM t1 WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 LIMIT 1 INTO @var17727401;
-
---error ER_PARSE_ERROR
-SELECT 1 FROM t1 WHERE 1 INTO @var17727401 GROUP BY 1 HAVING 1 ORDER BY 1 LIMIT 1;
-
---error ER_PARSE_ERROR
-SELECT 1 INTO @var17727401_1
- FROM t1 WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 LIMIT 1
- INTO @var17727401_2;
-
---error ER_PARSE_ERROR
-SELECT (SELECT 1 FROM t1 INTO @var17727401);
---error ER_PARSE_ERROR
-SELECT 1 FROM (SELECT 1 FROM t1 INTO @var17727401) a;
---error ER_PARSE_ERROR
-SELECT EXISTS(SELECT 1 FROM t1 INTO @var17727401);
-
---error ER_PARSE_ERROR
-SELECT 1 FROM t1 INTO @var17727401 UNION SELECT 1 FROM t1 INTO t1;
---error ER_WRONG_USAGE
-(SELECT 1 FROM t1 INTO @var17727401) UNION (SELECT 1 FROM t1 INTO t1);
-
-SELECT 1 FROM t1 UNION SELECT 1 FROM t1 INTO @var17727401;
-
---error ER_PARSE_ERROR
-SELECT 1 INTO @var17727401 FROM t1 PROCEDURE ANALYSE();
-
---error ER_PARSE_ERROR
-SELECT 1 FROM t1 PROCEDURE ANALYSE() INTO @var17727401;
-
---echo # ORDER and LIMIT clause combinations
-
-# Limited support for (SELECT ...) ORDER/LIMIT:
-
-(SELECT 1 FROM t1 ORDER BY 1) ORDER BY 1;
-(SELECT 1 FROM t1 LIMIT 1) LIMIT 1;
-
---error ER_PARSE_ERROR
-((SELECT 1 FROM t1 ORDER BY 1) ORDER BY 1) ORDER BY 1;
---error ER_PARSE_ERROR
-((SELECT 1 FROM t1 LIMIT 1) LIMIT 1) LIMIT 1;
-
-(SELECT 1 FROM t1 ORDER BY 1) LIMIT 1;
-(SELECT 1 FROM t1 LIMIT 1) ORDER BY 1;
-
---error ER_PARSE_ERROR
-((SELECT 1 FROM t1 ORDER BY 1) LIMIT 1) ORDER BY 1);
---error ER_PARSE_ERROR
-((SELECT 1 FROM t1 LIMIT 1) ORDER BY 1) LIMIT 1);
-
-# ORDER/LIMIT and UNION:
-
-let $q=SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1;
-eval $q;
-eval SELECT ($q);
-eval SELECT 1 FROM ($q) a;
-
-let $q=SELECT 1 FROM t1 UNION SELECT 1 FROM t1 LIMIT 1;
-eval $q;
-eval SELECT ($q);
-eval SELECT 1 FROM ($q) a;
-
-let $q=SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1;
-eval $q;
-eval SELECT ($q);
-eval SELECT 1 FROM ($q) a;
-
-let $q=SELECT 1 FROM t1 UNION SELECT 1 FROM t1 LIMIT 1 ORDER BY 1;
---error ER_PARSE_ERROR
-eval $q;
---error ER_PARSE_ERROR
-eval SELECT ($q);
---error ER_PARSE_ERROR
-eval SELECT 1 FROM ($q) a;
-
-let $q=SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1;
---error ER_PARSE_ERROR
-eval $q;
---error ER_PARSE_ERROR
-eval SELECT ($q);
---error ER_PARSE_ERROR
-eval SELECT 1 FROM ($q) a;
-
-let $q=SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1;
---error ER_PARSE_ERROR
-eval $q;
---error ER_PARSE_ERROR
-eval SELECT ($q);
---error ER_PARSE_ERROR
-eval SELECT 1 FROM ($q) a;
-
-let $q=SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 UNION SELECT 1 FROM t1;
---error ER_PARSE_ERROR
-eval $q;
---error ER_PARSE_ERROR
-eval SELECT ($q);
---error ER_PARSE_ERROR
-eval SELECT 1 FROM ($q) a;
-
-let $q=SELECT 1 FROM t1 LIMIT 1 ORDER BY 1 UNION SELECT 1 FROM t1;
---error ER_PARSE_ERROR
-eval $q;
---error ER_PARSE_ERROR
-eval SELECT ($q);
---error ER_PARSE_ERROR
-eval SELECT 1 FROM ($q) a;
-
-let $q=SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 ORDER BY 1;
---error ER_PARSE_ERROR
-eval $q;
---error ER_PARSE_ERROR
-eval SELECT ($q);
---error ER_PARSE_ERROR
-eval SELECT 1 FROM ($q) a;
-
-let $q=SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 LIMIT 1;
---error ER_PARSE_ERROR
-eval $q;
---error ER_PARSE_ERROR
-eval SELECT ($q);
---error ER_PARSE_ERROR
-eval SELECT 1 FROM ($q) a;
-
-let $q=SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 ORDER BY 1;
---error ER_PARSE_ERROR
-eval $q;
---error ER_PARSE_ERROR
-eval SELECT ($q);
---error ER_PARSE_ERROR
-eval SELECT 1 FROM ($q) a;
-
-let $q=SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 LIMIT 1;
---error ER_PARSE_ERROR
-eval $q;
---error ER_PARSE_ERROR
-eval SELECT ($q);
---error ER_PARSE_ERROR
-eval SELECT 1 FROM ($q) a;
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8380: Subquery parse error
---echo #
-CREATE TABLE t1 ( a INT);
-INSERT INTO t1 VALUES ( 2 );
-SELECT *
-FROM ( (SELECT a FROM t1 ORDER BY a) UNION (SELECT 1 as b ORDER BY b ) ) AS a1
-WHERE a1.a = 1 OR a1.a = 2;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-10080 Derived tables allow double LIMIT clause
---echo #
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1),(2),(3);
---error ER_PARSE_ERROR
-SELECT * FROM (SELECT * FROM t1 LIMIT 1 LIMIT 2) t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-10109 Disallow syntactically INSERT .. SELECT .. {ORDER BY ..| LIMIT ..} .. UNION ..
---echo #
-
---error ER_PARSE_ERROR
-INSERT INTO t1 SELECT 1 ORDER BY 1 UNION SELECT 2;
---error ER_PARSE_ERROR
-INSERT INTO t1 SELECT 1 LIMIT 1 UNION SELECT 2;
---error ER_PARSE_ERROR
-CREATE TABLE t1 AS SELECT 1 ORDER BY 1 UNION SELECT 2;
---error ER_PARSE_ERROR
-CREATE TABLE t1 AS SELECT 1 LIMIT 1 UNION SELECT 2;
-
-
---echo #
---echo # MDEV-8909 union parser cleanup
---echo #
-
---echo # UNION with a non-parenthesized term
---echo # The following two queries return a wrong result
---echo # This will change when MDEV-10120 is fixed
---echo # For now, we're testing the parser.
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (10),(20),(30);
-SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a);
-SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a ORDER BY a);
-DROP TABLE t1;
-
---echo # UNION with a parenthesed term
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (10),(20),(30);
-
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a ORDER BY a) LIMIT 2);
-
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a));
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a)) LIMIT 1;
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a)) ORDER BY a;
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a)) ORDER BY a LIMIT 1;
-DROP TABLE t1;
-
---echo # UNION with a parenthesized term with ROLLUP
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (10),(20),(30);
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP);
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP) LIMIT 1;
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP) ORDER BY a LIMIT 1;
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP LIMIT 2);
-
-
---error ER_WRONG_USAGE
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY a);
---error ER_WRONG_USAGE
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a));
---error ER_WRONG_USAGE
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a ORDER BY a));
-DROP TABLE t1;
-
---echo # UNION with a non-parethesized term with ROLLUP
-
---echo # This will change after: MDEV-10120 Wrong result of UNION .. ORDER BY GROUP_CONCAT()
---echo # Currently we're testing the parser only
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (10),(20),(30);
-SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a);
-SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a ORDER BY a);
-SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a ORDER BY a) LIMIT 1;
-DROP TABLE t1;
-
---echo # Derived table with ROLLUP
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (10),(20),(30);
-
-SELECT * FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1;
-SELECT * FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 LIMIT 1;
-SELECT * FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 ORDER BY a;
-SELECT * FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 ORDER BY a LIMIT 1;
-SELECT * FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 ORDER BY a DESC LIMIT 1;
-
-SELECT a, GROUP_CONCAT(a) FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 ORDER BY GROUP_CONCAT(a);
-SELECT a, GROUP_CONCAT(a) FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 ORDER BY GROUP_CONCAT(a ORDER BY a);
-SELECT a, GROUP_CONCAT(a) FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 ORDER BY GROUP_CONCAT(a) LIMIT 1;
-SELECT a, GROUP_CONCAT(a) FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 ORDER BY GROUP_CONCAT(a ORDER BY a) LIMIT 1;
-
-SELECT a, GROUP_CONCAT(a) FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 GROUP BY a ORDER BY GROUP_CONCAT(a);
-SELECT a, GROUP_CONCAT(a) FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 GROUP BY a ORDER BY GROUP_CONCAT(a ORDER BY a);
-SELECT a, GROUP_CONCAT(a) FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 GROUP BY a ORDER BY GROUP_CONCAT(a) DESC;
-SELECT a, GROUP_CONCAT(a) FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 GROUP BY a ORDER BY GROUP_CONCAT(a ORDER BY a) DESC;
-
-SELECT a, GROUP_CONCAT(a) FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 GROUP BY a ORDER BY GROUP_CONCAT(a) LIMIT 1;
-SELECT a, GROUP_CONCAT(a) FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 GROUP BY a ORDER BY GROUP_CONCAT(a ORDER BY a) LIMIT 1;
-SELECT a, GROUP_CONCAT(a) FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 GROUP BY a ORDER BY GROUP_CONCAT(a) DESC LIMIT 1;
-SELECT a, GROUP_CONCAT(a) FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 GROUP BY a ORDER BY GROUP_CONCAT(a ORDER BY a) DESC LIMIT 1;
-
---error ER_WRONG_USAGE
-SELECT * FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY a) t1;
---error ER_WRONG_USAGE
-SELECT * FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY a LIMIT 1) t1;
---error ER_WRONG_USAGE
-SELECT * FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a)) t1;
---error ER_WRONG_USAGE
-SELECT * FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a ORDER BY a)) t1;
-
-DROP TABLE t1;
-
---echo # Subquery, one row, ROLLUP
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (10);
-SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NULL);
-SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NOT NULL);
-SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1);
-SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1);
-SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1);
-SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NULL) FROM t1;
-SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NOT NULL) FROM t1;
-SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1;
-SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1;
-SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1;
-
---error ER_SUBQUERY_NO_1_ROW
-SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP);
---error ER_SUBQUERY_NO_1_ROW
-SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP);
---error ER_SUBQUERY_NO_1_ROW
-SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP) FROM t1;
---error ER_SUBQUERY_NO_1_ROW
-SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP) FROM t1;
-
---error ER_WRONG_USAGE
-SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY a);
---error ER_WRONG_USAGE
-SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY a LIMIT 1);
---error ER_WRONG_USAGE
-SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a));
---error ER_WRONG_USAGE
-SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP ORDER BY a LIMIT 1) AS a;
---error ER_WRONG_USAGE
-SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY a) FROM t1;
---error ER_WRONG_USAGE
-SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY a LIMIT 1) FROM t1;
---error ER_WRONG_USAGE
-SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a)) FROM t1;
---error ER_WRONG_USAGE
-SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP ORDER BY a LIMIT 1) AS a FROM t1;
-
-DROP TABLE t1;
-
---echo # Subquery, multiple rows, ROLLUP
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (10),(20),(30);
-SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1);
-SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1);
-SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1);
-SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1;
-SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1;
-SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1;
-
---error ER_SUBQUERY_NO_1_ROW
-SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP);
---error ER_SUBQUERY_NO_1_ROW
-SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP);
---error ER_SUBQUERY_NO_1_ROW
-SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP) FROM t1;
---error ER_SUBQUERY_NO_1_ROW
-SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP) FROM t1;
-
---error ER_WRONG_USAGE
-SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY a);
---error ER_WRONG_USAGE
-SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY a LIMIT 1);
---error ER_WRONG_USAGE
-SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a));
---error ER_WRONG_USAGE
-SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP ORDER BY a LIMIT 1) AS a;
-
---error ER_WRONG_USAGE
-SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY a) FROM t1;
---error ER_WRONG_USAGE
-SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY a LIMIT 1) FROM t1;
---error ER_WRONG_USAGE
-SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a)) FROM t1;
---error ER_WRONG_USAGE
-SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP ORDER BY a LIMIT 1) AS a FROM t1;
-
-DROP TABLE t1;
-
-
---echo
---echo MDEV-10101 Wrong error message of SELECT 1 UNION (SELECT 1 FROM t1 GROUP BY 1 WITH ROLLUP)
---echo
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (10),(20),(30);
-
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP);
-(SELECT a FROM t1 GROUP BY a WITH ROLLUP) UNION SELECT 1;
-SELECT a FROM t1 GROUP BY a WITH ROLLUP UNION SELECT 1;
-
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP) LIMIT 1;
-(SELECT a FROM t1 GROUP BY a WITH ROLLUP) UNION SELECT 1 LIMIT 1;
-SELECT a FROM t1 GROUP BY a WITH ROLLUP UNION SELECT 1 LIMIT 1;
-
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP) ORDER BY a LIMIT 1;
-(SELECT a FROM t1 GROUP BY a WITH ROLLUP) UNION SELECT 1 ORDER BY a LIMIT 1;
-SELECT a FROM t1 GROUP BY a WITH ROLLUP UNION SELECT 1 ORDER BY a LIMIT 1;
-
-SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP LIMIT 2);
-(SELECT a FROM t1 GROUP BY a WITH ROLLUP LIMIT 2) UNION SELECT 1;
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-10779 Failing assertion lex->proc_list.elements == 0 or syntax error on PROCEDURE ANALYSE in UNION
---echo #
-
-CREATE TABLE t1 (i INT);
---error ER_WRONG_USAGE
-(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10))
-UNION
-(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10));
-
---error ER_WRONG_USAGE
-(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10))
-UNION
-SELECT * FROM t1 PROCEDURE ANALYSE(10, 10);
-
---error ER_WRONG_USAGE
-(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10))
-UNION
-(SELECT 1);
-
---error ER_WRONG_USAGE
-(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10))
-UNION
-SELECT 1;
-
---error ER_PARSE_ERROR
-SELECT * FROM t1 PROCEDURE ANALYSE(10, 10)
-UNION
-(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10));
-
---error ER_PARSE_ERROR
-SELECT * FROM t1 PROCEDURE ANALYSE(10, 10)
-UNION
-SELECT * FROM t1 PROCEDURE ANALYSE(10, 10);
-
---error ER_PARSE_ERROR
-SELECT * FROM t1 PROCEDURE ANALYSE(10, 10)
-UNION
-(SELECT 1);
-
---error ER_PARSE_ERROR
-SELECT * FROM t1 PROCEDURE ANALYSE(10, 10)
-UNION
-SELECT 1;
-
-DROP TABLE t1;
-
-#
-# MDEV-11582 InnoDB: Failing assertion: !((field)->vcol_info && !(field)->stored_in_db())
-#
---error ER_PARSE_ERROR
-create table t1 (a serial null);
---error ER_PARSE_ERROR
-create table t1 (a serial auto_increment);
---error ER_PARSE_ERROR
-create table t1 (a serial serial default value);
---error ER_PARSE_ERROR
-create table t1 (a serial collate binary);
---error ER_PARSE_ERROR
-create table t1 (i int, vc serial as (i));
---error ER_PARSE_ERROR
-create function fs() returns serial return 1;
-
-create table t1 ( id serial );
-show create table t1;
-drop table t1;
-
---echo #
---echo # MDEV-10343 Providing compatibility for basic SQL data types
---echo #
-CREATE TABLE clob (clob int);
-DROP TABLE clob;
-
-CREATE TABLE raw (raw int);
-DROP TABLE raw;
-
-CREATE TABLE varchar2 (varchar2 int);
-DROP TABLE varchar2;
-
-
---echo #
---echo # MDEV-15620 Crash when using "SET @@NEW.a=expr" inside a trigger
---echo #
-
-CREATE TABLE t1 (a INT);
---error ER_UNKNOWN_STRUCTURED_VARIABLE
-CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET @@NEW.a=0;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-15664 sql_mode=ORACLE: Make TRIM return NULL instead of empty string
---echo #
-
-CREATE TABLE trim_oracle (trim_oracle int);
-DROP TABLE trim_oracle;
-
---echo #
---echo # MDEV-15615 Unexpected syntax error instead of "Unknown system variable" inside an SP
---echo #
-
-DELIMITER $$;
---error ER_UNKNOWN_SYSTEM_VARIABLE
-BEGIN NOT ATOMIC
- DECLARE a INT;
- SET GLOBAL a=10;
-END;
-$$
-DELIMITER ;$$
diff --git a/mysql-test/t/parser_bug21114_innodb.test b/mysql-test/t/parser_bug21114_innodb.test
deleted file mode 100644
index 969eea2da40..00000000000
--- a/mysql-test/t/parser_bug21114_innodb.test
+++ /dev/null
@@ -1,422 +0,0 @@
--- source include/have_innodb.inc
-
-let $engine_type=InnoDb;
-
-#
-# Bug#21114 (Foreign key creation fails to table with name format)
-#
-
-# Testing with the full log for only a few functions,
-# including FORMAT for witch the bug was reported.
-
-let $verbose=1;
-
-let $FCT=abs;
--- source include/parser_bug21114.inc
-let $FCT=field;
--- source include/parser_bug21114.inc
-let $FCT=format;
--- source include/parser_bug21114.inc
-
-# Ignoring the result of SHOW CREATE (this generates too much noise)
-# Tests will fail if the create table statement can not be parsed
-
-let verbose=0;
-
-let $FCT=acos;
--- source include/parser_bug21114.inc
-let $FCT=adddate;
--- source include/parser_bug21114.inc
-let $FCT=addtime;
--- source include/parser_bug21114.inc
-let $FCT=aes_decrypt;
--- source include/parser_bug21114.inc
-let $FCT=aes_encrypt;
--- source include/parser_bug21114.inc
-let $FCT=area;
--- source include/parser_bug21114.inc
-let $FCT=asbinary;
--- source include/parser_bug21114.inc
-let $FCT=asin;
--- source include/parser_bug21114.inc
-let $FCT=astext;
--- source include/parser_bug21114.inc
-let $FCT=aswkb;
--- source include/parser_bug21114.inc
-let $FCT=aswkt;
--- source include/parser_bug21114.inc
-let $FCT=atan;
--- source include/parser_bug21114.inc
-let $FCT=atan2;
--- source include/parser_bug21114.inc
-let $FCT=benchmark;
--- source include/parser_bug21114.inc
-let $FCT=bin;
--- source include/parser_bug21114.inc
-let $FCT=bit_count;
--- source include/parser_bug21114.inc
-let $FCT=bit_length;
--- source include/parser_bug21114.inc
-let $FCT=ceil;
--- source include/parser_bug21114.inc
-let $FCT=ceiling;
--- source include/parser_bug21114.inc
-let $FCT=centroid;
--- source include/parser_bug21114.inc
-let $FCT=character_length;
--- source include/parser_bug21114.inc
-let $FCT=char_length;
--- source include/parser_bug21114.inc
-let $FCT=coercibility;
--- source include/parser_bug21114.inc
-let $FCT=compress;
--- source include/parser_bug21114.inc
-let $FCT=concat;
--- source include/parser_bug21114.inc
-let $FCT=concat_ws;
--- source include/parser_bug21114.inc
-let $FCT=connection_id;
--- source include/parser_bug21114.inc
-let $FCT=conv;
--- source include/parser_bug21114.inc
-let $FCT=convert_tz;
--- source include/parser_bug21114.inc
-let $FCT=cos;
--- source include/parser_bug21114.inc
-let $FCT=cot;
--- source include/parser_bug21114.inc
-let $FCT=crc32;
--- source include/parser_bug21114.inc
-let $FCT=crosses;
--- source include/parser_bug21114.inc
-let $FCT=datediff;
--- source include/parser_bug21114.inc
-let $FCT=date_format;
--- source include/parser_bug21114.inc
-let $FCT=dayname;
--- source include/parser_bug21114.inc
-let $FCT=dayofmonth;
--- source include/parser_bug21114.inc
-let $FCT=dayofweek;
--- source include/parser_bug21114.inc
-let $FCT=dayofyear;
--- source include/parser_bug21114.inc
-let $FCT=decode;
--- source include/parser_bug21114.inc
-let $FCT=degrees;
--- source include/parser_bug21114.inc
-let $FCT=des_decrypt;
--- source include/parser_bug21114.inc
-let $FCT=des_encrypt;
--- source include/parser_bug21114.inc
-let $FCT=dimension;
--- source include/parser_bug21114.inc
-let $FCT=disjoint;
--- source include/parser_bug21114.inc
-let $FCT=elt;
--- source include/parser_bug21114.inc
-let $FCT=encode;
--- source include/parser_bug21114.inc
-let $FCT=encrypt;
--- source include/parser_bug21114.inc
-let $FCT=endpoint;
--- source include/parser_bug21114.inc
-let $FCT=envelope;
--- source include/parser_bug21114.inc
-let $FCT=equals;
--- source include/parser_bug21114.inc
-let $FCT=exp;
--- source include/parser_bug21114.inc
-let $FCT=export_set;
--- source include/parser_bug21114.inc
-let $FCT=exteriorring;
--- source include/parser_bug21114.inc
-let $FCT=extractvalue;
--- source include/parser_bug21114.inc
-let $FCT=find_in_set;
--- source include/parser_bug21114.inc
-let $FCT=floor;
--- source include/parser_bug21114.inc
-let $FCT=found_rows;
--- source include/parser_bug21114.inc
-let $FCT=from_days;
--- source include/parser_bug21114.inc
-let $FCT=from_unixtime;
--- source include/parser_bug21114.inc
-let $FCT=geomcollfromtext;
--- source include/parser_bug21114.inc
-let $FCT=geomcollfromwkb;
--- source include/parser_bug21114.inc
-let $FCT=geometrycollectionfromtext;
--- source include/parser_bug21114.inc
-let $FCT=geometrycollectionfromwkb;
--- source include/parser_bug21114.inc
-let $FCT=geometryfromtext;
--- source include/parser_bug21114.inc
-let $FCT=geometryfromwkb;
--- source include/parser_bug21114.inc
-let $FCT=geometryn;
--- source include/parser_bug21114.inc
-let $FCT=geometrytype;
--- source include/parser_bug21114.inc
-let $FCT=geomfromtext;
--- source include/parser_bug21114.inc
-let $FCT=geomfromwkb;
--- source include/parser_bug21114.inc
-let $FCT=get_lock;
--- source include/parser_bug21114.inc
-let $FCT=glength;
--- source include/parser_bug21114.inc
-let $FCT=greatest;
--- source include/parser_bug21114.inc
-let $FCT=hex;
--- source include/parser_bug21114.inc
-let $FCT=ifnull;
--- source include/parser_bug21114.inc
-let $FCT=inet_aton;
--- source include/parser_bug21114.inc
-let $FCT=inet_ntoa;
--- source include/parser_bug21114.inc
-let $FCT=instr;
--- source include/parser_bug21114.inc
-let $FCT=interiorringn;
--- source include/parser_bug21114.inc
-let $FCT=intersects;
--- source include/parser_bug21114.inc
-let $FCT=isclosed;
--- source include/parser_bug21114.inc
-let $FCT=isempty;
--- source include/parser_bug21114.inc
-let $FCT=isnull;
--- source include/parser_bug21114.inc
-let $FCT=issimple;
--- source include/parser_bug21114.inc
-let $FCT=is_free_lock;
--- source include/parser_bug21114.inc
-let $FCT=is_used_lock;
--- source include/parser_bug21114.inc
-let $FCT=last_day;
--- source include/parser_bug21114.inc
-let $FCT=last_insert_id;
--- source include/parser_bug21114.inc
-let $FCT=lcase;
--- source include/parser_bug21114.inc
-let $FCT=least;
--- source include/parser_bug21114.inc
-let $FCT=length;
--- source include/parser_bug21114.inc
-let $FCT=linefromtext;
--- source include/parser_bug21114.inc
-let $FCT=linefromwkb;
--- source include/parser_bug21114.inc
-let $FCT=linestringfromtext;
--- source include/parser_bug21114.inc
-let $FCT=linestringfromwkb;
--- source include/parser_bug21114.inc
-let $FCT=ln;
--- source include/parser_bug21114.inc
-let $FCT=load_file;
--- source include/parser_bug21114.inc
-let $FCT=locate;
--- source include/parser_bug21114.inc
-let $FCT=log;
--- source include/parser_bug21114.inc
-let $FCT=log10;
--- source include/parser_bug21114.inc
-let $FCT=log2;
--- source include/parser_bug21114.inc
-let $FCT=lower;
--- source include/parser_bug21114.inc
-let $FCT=lpad;
--- source include/parser_bug21114.inc
-let $FCT=ltrim;
--- source include/parser_bug21114.inc
-let $FCT=makedate;
--- source include/parser_bug21114.inc
-let $FCT=maketime;
--- source include/parser_bug21114.inc
-let $FCT=make_set;
--- source include/parser_bug21114.inc
-let $FCT=master_pos_wait;
--- source include/parser_bug21114.inc
-let $FCT=mbrcontains;
--- source include/parser_bug21114.inc
-let $FCT=mbrdisjoint;
--- source include/parser_bug21114.inc
-let $FCT=mbrequal;
--- source include/parser_bug21114.inc
-let $FCT=mbrintersects;
--- source include/parser_bug21114.inc
-let $FCT=mbroverlaps;
--- source include/parser_bug21114.inc
-let $FCT=mbrtouches;
--- source include/parser_bug21114.inc
-let $FCT=mbrwithin;
--- source include/parser_bug21114.inc
-let $FCT=md5;
--- source include/parser_bug21114.inc
-let $FCT=mlinefromtext;
--- source include/parser_bug21114.inc
-let $FCT=mlinefromwkb;
--- source include/parser_bug21114.inc
-let $FCT=monthname;
--- source include/parser_bug21114.inc
-let $FCT=mpointfromtext;
--- source include/parser_bug21114.inc
-let $FCT=mpointfromwkb;
--- source include/parser_bug21114.inc
-let $FCT=mpolyfromtext;
--- source include/parser_bug21114.inc
-let $FCT=mpolyfromwkb;
--- source include/parser_bug21114.inc
-let $FCT=multilinestringfromtext;
--- source include/parser_bug21114.inc
-let $FCT=multilinestringfromwkb;
--- source include/parser_bug21114.inc
-let $FCT=multipointfromtext;
--- source include/parser_bug21114.inc
-let $FCT=multipointfromwkb;
--- source include/parser_bug21114.inc
-let $FCT=multipolygonfromtext;
--- source include/parser_bug21114.inc
-let $FCT=multipolygonfromwkb;
--- source include/parser_bug21114.inc
-let $FCT=name_const;
--- source include/parser_bug21114.inc
-let $FCT=nullif;
--- source include/parser_bug21114.inc
-let $FCT=numgeometries;
--- source include/parser_bug21114.inc
-let $FCT=numinteriorrings;
--- source include/parser_bug21114.inc
-let $FCT=numpoints;
--- source include/parser_bug21114.inc
-let $FCT=oct;
--- source include/parser_bug21114.inc
-let $FCT=octet_length;
--- source include/parser_bug21114.inc
-let $FCT=ord;
--- source include/parser_bug21114.inc
-let $FCT=overlaps;
--- source include/parser_bug21114.inc
-let $FCT=period_add;
--- source include/parser_bug21114.inc
-let $FCT=period_diff;
--- source include/parser_bug21114.inc
-let $FCT=pi;
--- source include/parser_bug21114.inc
-let $FCT=pointfromtext;
--- source include/parser_bug21114.inc
-let $FCT=pointfromwkb;
--- source include/parser_bug21114.inc
-let $FCT=pointn;
--- source include/parser_bug21114.inc
-let $FCT=polyfromtext;
--- source include/parser_bug21114.inc
-let $FCT=polyfromwkb;
--- source include/parser_bug21114.inc
-let $FCT=polygonfromtext;
--- source include/parser_bug21114.inc
-let $FCT=polygonfromwkb;
--- source include/parser_bug21114.inc
-let $FCT=pow;
--- source include/parser_bug21114.inc
-let $FCT=power;
--- source include/parser_bug21114.inc
-let $FCT=quote;
--- source include/parser_bug21114.inc
-let $FCT=radians;
--- source include/parser_bug21114.inc
-let $FCT=rand;
--- source include/parser_bug21114.inc
-let $FCT=release_lock;
--- source include/parser_bug21114.inc
-let $FCT=reverse;
--- source include/parser_bug21114.inc
-let $FCT=round;
--- source include/parser_bug21114.inc
-let $FCT=row_count;
--- source include/parser_bug21114.inc
-let $FCT=rpad;
--- source include/parser_bug21114.inc
-let $FCT=rtrim;
--- source include/parser_bug21114.inc
-let $FCT=sec_to_time;
--- source include/parser_bug21114.inc
-let $FCT=session_user;
--- source include/parser_bug21114.inc
-let $FCT=sha;
--- source include/parser_bug21114.inc
-let $FCT=sha1;
--- source include/parser_bug21114.inc
-let $FCT=sign;
--- source include/parser_bug21114.inc
-let $FCT=sin;
--- source include/parser_bug21114.inc
-let $FCT=sleep;
--- source include/parser_bug21114.inc
-let $FCT=soundex;
--- source include/parser_bug21114.inc
-let $FCT=space;
--- source include/parser_bug21114.inc
-let $FCT=sqrt;
--- source include/parser_bug21114.inc
-let $FCT=srid;
--- source include/parser_bug21114.inc
-let $FCT=startpoint;
--- source include/parser_bug21114.inc
-let $FCT=strcmp;
--- source include/parser_bug21114.inc
-let $FCT=str_to_date;
--- source include/parser_bug21114.inc
-let $FCT=subdate;
--- source include/parser_bug21114.inc
-let $FCT=substring_index;
--- source include/parser_bug21114.inc
-let $FCT=subtime;
--- source include/parser_bug21114.inc
-let $FCT=system_user;
--- source include/parser_bug21114.inc
-let $FCT=tan;
--- source include/parser_bug21114.inc
-let $FCT=timediff;
--- source include/parser_bug21114.inc
-let $FCT=time_format;
--- source include/parser_bug21114.inc
-let $FCT=time_to_sec;
--- source include/parser_bug21114.inc
-let $FCT=touches;
--- source include/parser_bug21114.inc
-let $FCT=to_days;
--- source include/parser_bug21114.inc
-let $FCT=ucase;
--- source include/parser_bug21114.inc
-let $FCT=uncompress;
--- source include/parser_bug21114.inc
-let $FCT=uncompressed_length;
--- source include/parser_bug21114.inc
-let $FCT=unhex;
--- source include/parser_bug21114.inc
-let $FCT=unix_timestamp;
--- source include/parser_bug21114.inc
-let $FCT=updatexml;
--- source include/parser_bug21114.inc
-let $FCT=upper;
--- source include/parser_bug21114.inc
-let $FCT=uuid;
--- source include/parser_bug21114.inc
-let $FCT=version;
--- source include/parser_bug21114.inc
-let $FCT=weekday;
--- source include/parser_bug21114.inc
-let $FCT=weekofyear;
--- source include/parser_bug21114.inc
-let $FCT=within;
--- source include/parser_bug21114.inc
-let $FCT=x;
--- source include/parser_bug21114.inc
-let $FCT=y;
--- source include/parser_bug21114.inc
-let $FCT=yearweek;
--- source include/parser_bug21114.inc
-
diff --git a/mysql-test/t/parser_not_embedded.test b/mysql-test/t/parser_not_embedded.test
deleted file mode 100644
index 3ebd23e888e..00000000000
--- a/mysql-test/t/parser_not_embedded.test
+++ /dev/null
@@ -1,101 +0,0 @@
---source include/not_embedded.inc
-
-###########################################################################
---echo #
---echo # Bug#39559: dump of stored procedures / functions with C-style
---echo # comment can't be read back
---echo #
-
---write_file $MYSQLTEST_VARDIR/tmp/bug39559.sql
-select 2 as expected, /*!01000/**/*/ 2 as result;
-select 1 as expected, /*!999998/**/*/ 1 as result;
-select 3 as expected, /*!01000 1 + */ 2 as result;
-select 2 as expected, /*!999990 1 + */ 2 as result;
-select 7 as expected, /*!01000 1 + /* 8 + */ 2 + */ 4 as result;
-select 8 as expected, /*!999998 1 + /* 2 + */ 4 + */ 8 as result;
-select 7 as expected, /*!01000 1 + /*!01000 8 + */ 2 + */ 4 as result;
-select 7 as expected, /*!01000 1 + /*!999998 8 + */ 2 + */ 4 as result;
-select 4 as expected, /*!999998 1 + /*!999998 8 + */ 2 + */ 4 as result;
-select 4 as expected, /*!999998 1 + /*!01000 8 + */ 2 + */ 4 as result;
-select 7 as expected, /*!01000 1 + /*!01000 8 + /*!01000 error */ 16 + */ 2 + */ 4 as result;
-select 4 as expected, /* 1 + /*!01000 8 + */ 2 + */ 4;
-EOF
-
---exec $MYSQL --comment --force --table test <$MYSQLTEST_VARDIR/tmp/bug39559.sql
---remove_file $MYSQLTEST_VARDIR/tmp/bug39559.sql
-
---echo # Bug#46527 "COMMIT AND CHAIN RELEASE does not make sense"
---echo #
---error ER_PARSE_ERROR
-COMMIT AND CHAIN RELEASE;
-
-COMMIT AND NO CHAIN RELEASE;
-disconnect default;
-connect(default, localhost, root,,);
-
-COMMIT RELEASE;
-disconnect default;
-connect(default, localhost, root,,);
-
---error ER_PARSE_ERROR
-COMMIT CHAIN RELEASE;
-
---error ER_PARSE_ERROR
-COMMIT NO CHAIN RELEASE;
-
---error ER_PARSE_ERROR
-COMMIT AND NO RELEASE;
---error ER_PARSE_ERROR
-COMMIT AND RELEASE;
-
-COMMIT NO RELEASE;
---error ER_PARSE_ERROR
-COMMIT CHAIN NO RELEASE;
---error ER_PARSE_ERROR
-COMMIT NO CHAIN NO RELEASE;
-
---error ER_PARSE_ERROR
-COMMIT AND RELEASE CHAIN;
-
-COMMIT AND NO CHAIN NO RELEASE;
-
---error ER_PARSE_ERROR
-ROLLBACK AND CHAIN RELEASE;
-
-ROLLBACK AND NO CHAIN RELEASE;
-disconnect default;
-connect(default, localhost, root,,);
-
-ROLLBACK RELEASE;
-disconnect default;
-connect(default, localhost, root,,);
-
---error ER_PARSE_ERROR
-ROLLBACK CHAIN RELEASE;
-
---error ER_PARSE_ERROR
-ROLLBACK NO CHAIN RELEASE;
-disconnect default;
-connect(default, localhost, root,,);
-
---error ER_PARSE_ERROR
-ROLLBACK AND NO RELEASE;
-
---error ER_PARSE_ERROR
-ROLLBACK AND RELEASE;
-
-ROLLBACK NO RELEASE;
-
---error ER_PARSE_ERROR
-ROLLBACK CHAIN NO RELEASE;
-
---error ER_PARSE_ERROR
-ROLLBACK NO CHAIN NO RELEASE;
---error ER_PARSE_ERROR
-ROLLBACK AND RELEASE CHAIN;
-
-ROLLBACK AND NO CHAIN NO RELEASE;
-
---echo #
---echo # End of 5.5 tests
---echo #
diff --git a/mysql-test/t/parser_precedence.test b/mysql-test/t/parser_precedence.test
deleted file mode 100644
index 7b69bc9c6da..00000000000
--- a/mysql-test/t/parser_precedence.test
+++ /dev/null
@@ -1,335 +0,0 @@
-
---disable_warnings
-drop table if exists t1_30237_bool;
---enable_warnings
-
-set sql_mode=NO_UNSIGNED_SUBTRACTION;
-
-create table t1_30237_bool(A boolean, B boolean, C boolean);
-
-insert into t1_30237_bool values
-(FALSE, FALSE, FALSE),
-(FALSE, FALSE, NULL),
-(FALSE, FALSE, TRUE),
-(FALSE, NULL, FALSE),
-(FALSE, NULL, NULL),
-(FALSE, NULL, TRUE),
-(FALSE, TRUE, FALSE),
-(FALSE, TRUE, NULL),
-(FALSE, TRUE, TRUE),
-(NULL, FALSE, FALSE),
-(NULL, FALSE, NULL),
-(NULL, FALSE, TRUE),
-(NULL, NULL, FALSE),
-(NULL, NULL, NULL),
-(NULL, NULL, TRUE),
-(NULL, TRUE, FALSE),
-(NULL, TRUE, NULL),
-(NULL, TRUE, TRUE),
-(TRUE, FALSE, FALSE),
-(TRUE, FALSE, NULL),
-(TRUE, FALSE, TRUE),
-(TRUE, NULL, FALSE),
-(TRUE, NULL, NULL),
-(TRUE, NULL, TRUE),
-(TRUE, TRUE, FALSE),
-(TRUE, TRUE, NULL),
-(TRUE, TRUE, TRUE) ;
-
---echo Testing OR, XOR, AND
-select A, B, A OR B, A XOR B, A AND B
- from t1_30237_bool where C is null order by A, B;
-
---echo Testing that OR is associative
-select A, B, C, (A OR B) OR C, A OR (B OR C), A OR B OR C
- from t1_30237_bool order by A, B, C;
-
-select count(*) from t1_30237_bool
- where ((A OR B) OR C) != (A OR (B OR C));
-
---echo Testing that XOR is associative
-select A, B, C, (A XOR B) XOR C, A XOR (B XOR C), A XOR B XOR C
- from t1_30237_bool order by A, B, C;
-
-select count(*) from t1_30237_bool
- where ((A XOR B) XOR C) != (A XOR (B XOR C));
-
---echo Testing that AND is associative
-select A, B, C, (A AND B) AND C, A AND (B AND C), A AND B AND C
- from t1_30237_bool order by A, B, C;
-
-select count(*) from t1_30237_bool
- where ((A AND B) AND C) != (A AND (B AND C));
-
---echo Testing that AND has precedence over OR
-select A, B, C, (A OR B) AND C, A OR (B AND C), A OR B AND C
- from t1_30237_bool order by A, B, C;
-select count(*) from t1_30237_bool
- where (A OR (B AND C)) != (A OR B AND C);
-select A, B, C, (A AND B) OR C, A AND (B OR C), A AND B OR C
- from t1_30237_bool order by A, B, C;
-select count(*) from t1_30237_bool
- where ((A AND B) OR C) != (A AND B OR C);
-
---echo Testing that AND has precedence over XOR
-select A, B, C, (A XOR B) AND C, A XOR (B AND C), A XOR B AND C
- from t1_30237_bool order by A, B, C;
-select count(*) from t1_30237_bool
- where (A XOR (B AND C)) != (A XOR B AND C);
-select A, B, C, (A AND B) XOR C, A AND (B XOR C), A AND B XOR C
- from t1_30237_bool order by A, B, C;
-select count(*) from t1_30237_bool
- where ((A AND B) XOR C) != (A AND B XOR C);
-
---echo Testing that XOR has precedence over OR
-select A, B, C, (A XOR B) OR C, A XOR (B OR C), A XOR B OR C
- from t1_30237_bool order by A, B, C;
-select count(*) from t1_30237_bool
- where ((A XOR B) OR C) != (A XOR B OR C);
-select A, B, C, (A OR B) XOR C, A OR (B XOR C), A OR B XOR C
- from t1_30237_bool order by A, B, C;
-select count(*) from t1_30237_bool
- where (A OR (B XOR C)) != (A OR B XOR C);
-
-drop table t1_30237_bool;
-
---echo Testing that NOT has precedence over OR
-select (NOT FALSE) OR TRUE, NOT (FALSE OR TRUE), NOT FALSE OR TRUE;
-
---echo Testing that NOT has precedence over XOR
-select (NOT FALSE) XOR FALSE, NOT (FALSE XOR FALSE), NOT FALSE XOR FALSE;
-
---echo Testing that NOT has precedence over AND
-select (NOT FALSE) AND FALSE, NOT (FALSE AND FALSE), NOT FALSE AND FALSE;
-
---echo Testing that NOT is associative
-select NOT NOT TRUE, NOT NOT NOT FALSE;
-
---echo Testing that IS has precedence over NOT
-select (NOT NULL) IS TRUE, NOT (NULL IS TRUE), NOT NULL IS TRUE;
-select (NOT NULL) IS NOT TRUE, NOT (NULL IS NOT TRUE), NOT NULL IS NOT TRUE;
-select (NOT NULL) IS FALSE, NOT (NULL IS FALSE), NOT NULL IS FALSE;
-select (NOT NULL) IS NOT FALSE, NOT (NULL IS NOT FALSE), NOT NULL IS NOT FALSE;
-select (NOT TRUE) IS UNKNOWN, NOT (TRUE IS UNKNOWN), NOT TRUE IS UNKNOWN;
-select (NOT TRUE) IS NOT UNKNOWN, NOT (TRUE IS NOT UNKNOWN), NOT TRUE IS NOT UNKNOWN;
-select (NOT TRUE) IS NULL, NOT (TRUE IS NULL), NOT TRUE IS NULL;
-select (NOT TRUE) IS NOT NULL, NOT (TRUE IS NOT NULL), NOT TRUE IS NOT NULL;
-
---echo Testing that IS [NOT] TRUE/FALSE/UNKNOWN predicates are not associative
-# Documenting existing behavior in 5.0.48
--- error ER_PARSE_ERROR
-select TRUE IS TRUE IS TRUE IS TRUE;
--- error ER_PARSE_ERROR
-select FALSE IS NOT TRUE IS NOT TRUE IS NOT TRUE;
--- error ER_PARSE_ERROR
-select NULL IS FALSE IS FALSE IS FALSE;
--- error ER_PARSE_ERROR
-select TRUE IS NOT FALSE IS NOT FALSE IS NOT FALSE;
--- error ER_PARSE_ERROR
-select FALSE IS UNKNOWN IS UNKNOWN IS UNKNOWN;
--- error ER_PARSE_ERROR
-select TRUE IS NOT UNKNOWN IS NOT UNKNOWN IS NOT UNKNOWN;
-
---echo Testing that IS [NOT] NULL predicates are associative
-# Documenting existing behavior in 5.0.48
-select FALSE IS NULL IS NULL IS NULL;
-select TRUE IS NOT NULL IS NOT NULL IS NOT NULL;
-
---echo Testing that comparison operators are left associative
-select 1 <=> 2 <=> 2, (1 <=> 2) <=> 2, 1 <=> (2 <=> 2);
-select 1 = 2 = 2, (1 = 2) = 2, 1 = (2 = 2);
-select 1 != 2 != 3, (1 != 2) != 3, 1 != (2 != 3);
-select 1 <> 2 <> 3, (1 <> 2) <> 3, 1 <> (2 <> 3);
-select 1 < 2 < 3, (1 < 2) < 3, 1 < (2 < 3);
-select 3 <= 2 <= 1, (3 <= 2) <= 1, 3 <= (2 <= 1);
-select 1 > 2 > 3, (1 > 2) > 3, 1 > (2 > 3);
-select 1 >= 2 >= 3, (1 >= 2) >= 3, 1 >= (2 >= 3);
-
--- echo Testing that | is associative
-select 0xF0 | 0x0F | 0x55, (0xF0 | 0x0F) | 0x55, 0xF0 | (0x0F | 0x55);
-
--- echo Testing that & is associative
-select 0xF5 & 0x5F & 0x55, (0xF5 & 0x5F) & 0x55, 0xF5 & (0x5F & 0x55);
-
--- echo Testing that << is left associative
-select 4 << 3 << 2, (4 << 3) << 2, 4 << (3 << 2);
-
--- echo Testing that >> is left associative
-select 256 >> 3 >> 2, (256 >> 3) >> 2, 256 >> (3 >> 2);
-
---echo Testing that & has precedence over |
-select 0xF0 & 0x0F | 0x55, (0xF0 & 0x0F) | 0x55, 0xF0 & (0x0F | 0x55);
-select 0x55 | 0xF0 & 0x0F, (0x55 | 0xF0) & 0x0F, 0x55 | (0xF0 & 0x0F);
-
---echo Testing that << has precedence over |
-select 0x0F << 4 | 0x0F, (0x0F << 4) | 0x0F, 0x0F << (4 | 0x0F);
-select 0x0F | 0x0F << 4, (0x0F | 0x0F) << 4, 0x0F | (0x0F << 4);
-
---echo Testing that >> has precedence over |
-select 0xF0 >> 4 | 0xFF, (0xF0 >> 4) | 0xFF, 0xF0 >> (4 | 0xFF);
-select 0xFF | 0xF0 >> 4, (0xFF | 0xF0) >> 4, 0xFF | (0xF0 >> 4);
-
---echo Testing that << has precedence over &
-select 0x0F << 4 & 0xF0, (0x0F << 4) & 0xF0, 0x0F << (4 & 0xF0);
-select 0xF0 & 0x0F << 4, (0xF0 & 0x0F) << 4, 0xF0 & (0x0F << 4);
-
---echo Testing that >> has precedence over &
-select 0xF0 >> 4 & 0x55, (0xF0 >> 4) & 0x55, 0xF0 >> (4 & 0x55);
-select 0x0F & 0xF0 >> 4, (0x0F & 0xF0) >> 4, 0x0F & (0xF0 >> 4);
-
---echo Testing that >> and << have the same precedence
-select 0xFF >> 4 << 2, (0xFF >> 4) << 2, 0xFF >> (4 << 2);
-select 0x0F << 4 >> 2, (0x0F << 4) >> 2, 0x0F << (4 >> 2);
-
---echo Testing that binary + is associative
-select 1 + 2 + 3, (1 + 2) + 3, 1 + (2 + 3);
-
---echo Testing that binary - is left associative
-select 1 - 2 - 3, (1 - 2) - 3, 1 - (2 - 3);
-
---echo Testing that binary + and binary - have the same precedence
-# evaluated left to right
-select 1 + 2 - 3, (1 + 2) - 3, 1 + (2 - 3);
-select 1 - 2 + 3, (1 - 2) + 3, 1 - (2 + 3);
-
---echo Testing that binary + has precedence over |
-select 0xF0 + 0x0F | 0x55, (0xF0 + 0x0F) | 0x55, 0xF0 + (0x0F | 0x55);
-select 0x55 | 0xF0 + 0x0F, (0x55 | 0xF0) + 0x0F, 0x55 | (0xF0 + 0x0F);
-
---echo Testing that binary + has precedence over &
-select 0xF0 + 0x0F & 0x55, (0xF0 + 0x0F) & 0x55, 0xF0 + (0x0F & 0x55);
-select 0x55 & 0xF0 + 0x0F, (0x55 & 0xF0) + 0x0F, 0x55 & (0xF0 + 0x0F);
-
---echo Testing that binary + has precedence over <<
-select 2 + 3 << 4, (2 + 3) << 4, 2 + (3 << 4);
-select 3 << 4 + 2, (3 << 4) + 2, 3 << (4 + 2);
-
---echo Testing that binary + has precedence over >>
-select 4 + 3 >> 2, (4 + 3) >> 2, 4 + (3 >> 2);
-select 3 >> 2 + 1, (3 >> 2) + 1, 3 >> (2 + 1);
-
---echo Testing that binary - has precedence over |
-select 0xFF - 0x0F | 0x55, (0xFF - 0x0F) | 0x55, 0xFF - (0x0F | 0x55);
-select 0x55 | 0xFF - 0xF0, (0x55 | 0xFF) - 0xF0, 0x55 | (0xFF - 0xF0);
-
---echo Testing that binary - has precedence over &
-select 0xFF - 0xF0 & 0x55, (0xFF - 0xF0) & 0x55, 0xFF - (0xF0 & 0x55);
-select 0x55 & 0xFF - 0xF0, (0x55 & 0xFF) - 0xF0, 0x55 & (0xFF - 0xF0);
-
---echo Testing that binary - has precedence over <<
-select 16 - 3 << 2, (16 - 3) << 2, 16 - (3 << 2);
-select 4 << 3 - 2, (4 << 3) - 2, 4 << (3 - 2);
-
---echo Testing that binary - has precedence over >>
-select 16 - 3 >> 2, (16 - 3) >> 2, 16 - (3 >> 2);
-select 16 >> 3 - 2, (16 >> 3) - 2, 16 >> (3 - 2);
-
---echo Testing that * is associative
-select 2 * 3 * 4, (2 * 3) * 4, 2 * (3 * 4);
-
---echo Testing that * has precedence over |
-select 2 * 0x40 | 0x0F, (2 * 0x40) | 0x0F, 2 * (0x40 | 0x0F);
-select 0x0F | 2 * 0x40, (0x0F | 2) * 0x40, 0x0F | (2 * 0x40);
-
---echo Testing that * has precedence over &
-select 2 * 0x40 & 0x55, (2 * 0x40) & 0x55, 2 * (0x40 & 0x55);
-select 0xF0 & 2 * 0x40, (0xF0 & 2) * 0x40, 0xF0 & (2 * 0x40);
-
---echo Testing that * has precedence over <<
-# Actually, can't prove it for the first case,
-# since << is a multiplication by a power of 2,
-# and * is associative
-select 5 * 3 << 4, (5 * 3) << 4, 5 * (3 << 4);
-select 2 << 3 * 4, (2 << 3) * 4, 2 << (3 * 4);
-
---echo Testing that * has precedence over >>
-# >> is a multiplication by a (negative) power of 2,
-# see above.
-select 3 * 4 >> 2, (3 * 4) >> 2, 3 * (4 >> 2);
-select 4 >> 2 * 3, (4 >> 2) * 3, 4 >> (2 * 3);
-
---echo Testing that * has precedence over binary +
-select 2 * 3 + 4, (2 * 3) + 4, 2 * (3 + 4);
-select 2 + 3 * 4, (2 + 3) * 4, 2 + (3 * 4);
-
---echo Testing that * has precedence over binary -
-select 4 * 3 - 2, (4 * 3) - 2, 4 * (3 - 2);
-select 4 - 3 * 2, (4 - 3) * 2, 4 - (3 * 2);
-
---echo Testing that / is left associative
-select 15 / 5 / 3, (15 / 5) / 3, 15 / (5 / 3);
-
---echo Testing that / has precedence over |
-select 105 / 5 | 2, (105 / 5) | 2, 105 / (5 | 2);
-select 105 | 2 / 5, (105 | 2) / 5, 105 | (2 / 5);
-
---echo Testing that / has precedence over &
-select 105 / 5 & 0x0F, (105 / 5) & 0x0F, 105 / (5 & 0x0F);
-select 0x0F & 105 / 5, (0x0F & 105) / 5, 0x0F & (105 / 5);
-
---echo Testing that / has precedence over <<
-select 0x80 / 4 << 2, (0x80 / 4) << 2, 0x80 / (4 << 2);
-select 0x80 << 4 / 2, (0x80 << 4) / 2, 0x80 << (4 / 2);
-
---echo Testing that / has precedence over >>
-select 0x80 / 4 >> 2, (0x80 / 4) >> 2, 0x80 / (4 >> 2);
-select 0x80 >> 4 / 2, (0x80 >> 4) / 2, 0x80 >> (4 / 2);
-
---echo Testing that / has precedence over binary +
-select 0x80 / 2 + 2, (0x80 / 2) + 2, 0x80 / (2 + 2);
-select 0x80 + 2 / 2, (0x80 + 2) / 2, 0x80 + (2 / 2);
-
---echo Testing that / has precedence over binary -
-select 0x80 / 4 - 2, (0x80 / 4) - 2, 0x80 / (4 - 2);
-select 0x80 - 4 / 2, (0x80 - 4) / 2, 0x80 - (4 / 2);
-
-# TODO: %, DIV, MOD
-
---echo Testing that ^ is associative
-select 0xFF ^ 0xF0 ^ 0x0F, (0xFF ^ 0xF0) ^ 0x0F, 0xFF ^ (0xF0 ^ 0x0F);
-select 0xFF ^ 0xF0 ^ 0x55, (0xFF ^ 0xF0) ^ 0x55, 0xFF ^ (0xF0 ^ 0x55);
-
---echo Testing that ^ has precedence over |
-select 0xFF ^ 0xF0 | 0x0F, (0xFF ^ 0xF0) | 0x0F, 0xFF ^ (0xF0 | 0x0F);
-select 0xF0 | 0xFF ^ 0xF0, (0xF0 | 0xFF) ^ 0xF0, 0xF0 | (0xFF ^ 0xF0);
-
---echo Testing that ^ has precedence over &
-select 0xFF ^ 0xF0 & 0x0F, (0xFF ^ 0xF0) & 0x0F, 0xFF ^ (0xF0 & 0x0F);
-select 0x0F & 0xFF ^ 0xF0, (0x0F & 0xFF) ^ 0xF0, 0x0F & (0xFF ^ 0xF0);
-
---echo Testing that ^ has precedence over <<
-select 0xFF ^ 0xF0 << 2, (0xFF ^ 0xF0) << 2, 0xFF ^ (0xF0 << 2);
-select 0x0F << 2 ^ 0xFF, (0x0F << 2) ^ 0xFF, 0x0F << (2 ^ 0xFF);
-
---echo Testing that ^ has precedence over >>
-select 0xFF ^ 0xF0 >> 2, (0xFF ^ 0xF0) >> 2, 0xFF ^ (0xF0 >> 2);
-select 0xFF >> 2 ^ 0xF0, (0xFF >> 2) ^ 0xF0, 0xFF >> (2 ^ 0xF0);
-
---echo Testing that ^ has precedence over binary +
-select 0xFF ^ 0xF0 + 0x0F, (0xFF ^ 0xF0) + 0x0F, 0xFF ^ (0xF0 + 0x0F);
-select 0x0F + 0xFF ^ 0xF0, (0x0F + 0xFF) ^ 0xF0, 0x0F + (0xFF ^ 0xF0);
-
---echo Testing that ^ has precedence over binary -
-select 0xFF ^ 0xF0 - 1, (0xFF ^ 0xF0) - 1, 0xFF ^ (0xF0 - 1);
-select 0x55 - 0x0F ^ 0x55, (0x55 - 0x0F) ^ 0x55, 0x55 - (0x0F ^ 0x55);
-
---echo Testing that ^ has precedence over *
-select 0xFF ^ 0xF0 * 2, (0xFF ^ 0xF0) * 2, 0xFF ^ (0xF0 * 2);
-select 2 * 0xFF ^ 0xF0, (2 * 0xFF) ^ 0xF0, 2 * (0xFF ^ 0xF0);
-
---echo Testing that ^ has precedence over /
-select 0xFF ^ 0xF0 / 2, (0xFF ^ 0xF0) / 2, 0xFF ^ (0xF0 / 2);
-select 0xF2 / 2 ^ 0xF0, (0xF2 / 2) ^ 0xF0, 0xF2 / (2 ^ 0xF0);
-
---echo Testing that ^ has precedence over %
-select 0xFF ^ 0xF0 % 0x20, (0xFF ^ 0xF0) % 0x20, 0xFF ^ (0xF0 % 0x20);
-select 0xFF % 0x20 ^ 0xF0, (0xFF % 0x20) ^ 0xF0, 0xFF % (0x20 ^ 0xF0);
-
---echo Testing that ^ has precedence over DIV
-select 0xFF ^ 0xF0 DIV 2, (0xFF ^ 0xF0) DIV 2, 0xFF ^ (0xF0 DIV 2);
-select 0xF2 DIV 2 ^ 0xF0, (0xF2 DIV 2) ^ 0xF0, 0xF2 DIV (2 ^ 0xF0);
-
---echo Testing that ^ has precedence over MOD
-select 0xFF ^ 0xF0 MOD 0x20, (0xFF ^ 0xF0) MOD 0x20, 0xFF ^ (0xF0 MOD 0x20);
-select 0xFF MOD 0x20 ^ 0xF0, (0xFF MOD 0x20) ^ 0xF0, 0xFF MOD (0x20 ^ 0xF0);
-
diff --git a/mysql-test/t/parser_stack.test b/mysql-test/t/parser_stack.test
deleted file mode 100644
index 8bc316da18e..00000000000
--- a/mysql-test/t/parser_stack.test
+++ /dev/null
@@ -1,395 +0,0 @@
-#
-# These tests are designed to cause an internal parser stack overflow,
-# and trigger my_yyoverflow().
-#
-
-use test;
-
-SELECT
-((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
-((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
-((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
-1
-))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
-))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
-))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
-;
-
-prepare stmt from
-"
-SELECT
-((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
-((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
-((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
-1
-))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
-))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
-))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
-"
-;
-
-execute stmt;
-
---disable_warnings
-drop view if exists view_overflow;
---enable_warnings
-
-CREATE VIEW view_overflow AS
-SELECT
-((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
-((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
-((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
-1
-))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
-))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
-))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
-;
-
-SELECT * from view_overflow;
-
-drop view view_overflow;
-
---disable_warnings
-drop procedure if exists proc_overflow;
---enable_warnings
-
-delimiter $$;
-
-CREATE PROCEDURE proc_overflow()
-BEGIN
-
- BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
- BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
- BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
- BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
- BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
- BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
- BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
- BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
- BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
- BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
-
- select 1;
- select 2;
- select 3;
-
- END; END; END; END; END; END; END; END; END; END; END; END;
- END; END; END; END; END; END; END; END; END; END; END; END;
- END; END; END; END; END; END; END; END; END; END; END; END;
- END; END; END; END; END; END; END; END; END; END; END; END;
- END; END; END; END; END; END; END; END; END; END; END; END;
- END; END; END; END; END; END; END; END; END; END; END; END;
- END; END; END; END; END; END; END; END; END; END; END; END;
- END; END; END; END; END; END; END; END; END; END; END; END;
- END; END; END; END; END; END; END; END; END; END; END; END;
- END; END; END; END; END; END; END; END; END; END; END; END;
-
-END $$
-
-delimiter ;$$
-
-call proc_overflow();
-
-drop procedure proc_overflow;
-
---disable_warnings
-drop function if exists func_overflow;
---enable_warnings
-
-delimiter $$;
-
-create function func_overflow() returns int
-BEGIN
- DECLARE x int default 0;
-
- BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
- BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
- BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
- BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
- BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
- BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
- BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
- BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
- BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
- BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
-
- SET x=x+1;
- SET x=x+2;
- SET x=x+3;
-
- END; END; END; END; END; END; END; END; END; END; END; END;
- END; END; END; END; END; END; END; END; END; END; END; END;
- END; END; END; END; END; END; END; END; END; END; END; END;
- END; END; END; END; END; END; END; END; END; END; END; END;
- END; END; END; END; END; END; END; END; END; END; END; END;
- END; END; END; END; END; END; END; END; END; END; END; END;
- END; END; END; END; END; END; END; END; END; END; END; END;
- END; END; END; END; END; END; END; END; END; END; END; END;
- END; END; END; END; END; END; END; END; END; END; END; END;
- END; END; END; END; END; END; END; END; END; END; END; END;
-
- return x;
-END $$
-
-delimiter ;$$
-
-select func_overflow();
-
-drop function func_overflow;
-
---disable_warnings
-drop table if exists table_overflow;
---enable_warnings
-
-create table table_overflow(a int, b int);
-
-delimiter $$;
-
-create trigger trigger_overflow before insert on table_overflow
-for each row
-BEGIN
-
- BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
- BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
- BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
- BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
- BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
- BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
- BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
- BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
- BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
- BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN BEGIN
-
- SET NEW.b := NEW.a;
- SET NEW.b := NEW.b + 1;
- SET NEW.b := NEW.b + 2;
- SET NEW.b := NEW.b + 3;
-
- END; END; END; END; END; END; END; END; END; END; END; END;
- END; END; END; END; END; END; END; END; END; END; END; END;
- END; END; END; END; END; END; END; END; END; END; END; END;
- END; END; END; END; END; END; END; END; END; END; END; END;
- END; END; END; END; END; END; END; END; END; END; END; END;
- END; END; END; END; END; END; END; END; END; END; END; END;
- END; END; END; END; END; END; END; END; END; END; END; END;
- END; END; END; END; END; END; END; END; END; END; END; END;
- END; END; END; END; END; END; END; END; END; END; END; END;
- END; END; END; END; END; END; END; END; END; END; END; END;
-
-END $$
-
-delimiter ;$$
-
-insert into table_overflow set a=10;
-insert into table_overflow set a=20;
-select * from table_overflow;
-
-drop table table_overflow;
-
---disable_warnings
-drop procedure if exists proc_35577;
---enable_warnings
-
-delimiter $$;
-
-CREATE PROCEDURE proc_35577()
-BEGIN
- DECLARE z_done INT DEFAULT 0;
- DECLARE t_done VARCHAR(5000);
- outer_loop: LOOP
- IF t_done=1 THEN
- LEAVE outer_loop;
- END IF;
-
- inner_block:BEGIN
- DECLARE z_done INT DEFAULT 0;
- SET z_done = 0;
- inner_loop: LOOP
- IF z_done=1 THEN
- LEAVE inner_loop;
- END IF;
- IF (t_done = 'a') THEN
- IF (t_done <> 0) THEN
- IF ( t_done > 0) THEN
- IF (t_done = 'a') THEN
- SET t_done = 'a';
- ELSEIF (t_done = 'a') THEN
- SET t_done = 'a';
- ELSEIF(t_done = 'a') THEN
- SET t_done = 'a';
- ELSEIF(t_done = 'a') THEN
- SET t_done = 'a';
- ELSEIF(t_done = 'a') THEN
- SET t_done = 'a';
- ELSEIF(t_done = 'a') THEN
- SET t_done = 'a';
- ELSEIF(t_done = 'a') THEN
- SET t_done = 'a';
- ELSEIF(t_done = 'a') THEN
- SET t_done = 'a';
- END IF;
- END IF;
- END IF;
- END IF;
- END LOOP inner_loop;
- END inner_block;
- END LOOP outer_loop;
-END $$
-
-delimiter ;$$
-
-drop procedure proc_35577;
-
-#
-# Bug#37269 (parser crash when creating stored procedure)
-#
-
---disable_warnings
-drop procedure if exists p_37269;
---enable_warnings
-
-delimiter $$;
-
-create procedure p_37269()
-begin
- declare done int default 0;
- declare varb int default 0;
- declare vara int default 0;
-
- repeat
- select now();
- until done end repeat;
- while varb do
- select now();
- begin
- select now();
- repeat
- select now();
- until done end repeat;
- if vara then
- select now();
- repeat
- select now();
- loop
- select now();
- end loop;
- repeat
- select now();
- label1: while varb do
- select now();
- end while label1;
- if vara then
- select now();
- repeat
- select now();
- until done end repeat;
- begin
- select now();
- while varb do
- select now();
- label1: while varb do
- select now();
- end while label1;
- if vara then
- select now();
- while varb do
- select now();
- loop
- select now();
- end loop;
- repeat
- select now();
- loop
- select now();
- while varb do
- select now();
- end while;
- repeat
- select now();
- label1: loop
- select now();
- if vara then
- select now();
- end if;
- end loop label1;
- until done end repeat;
- end loop;
- until done end repeat;
- end while;
- end if;
- end while;
- end;
- end if;
- until done end repeat;
- until done end repeat;
- end if;
- end;
- end while;
-end $$
-
-delimiter ;$$
-
-drop procedure p_37269;
-
-#
-# Bug#37228 (Sever crashes when creating stored procedure with more than
-# 10 IF/ELSEIF)
-#
-
---disable_warnings
-drop procedure if exists p_37228;
---enable_warnings
-
-delimiter $$;
-
-create procedure p_37228 ()
-BEGIN
- DECLARE v INT DEFAULT 123;
-
- IF (v > 1) THEN SET v = 1;
- ELSEIF (v < 10) THEN SET v = 10;
- ELSEIF (v < 11) THEN SET v = 11;
- ELSEIF (v < 12) THEN SET v = 12;
- ELSEIF (v < 13) THEN SET v = 13;
- ELSEIF (v < 14) THEN SET v = 14;
- ELSEIF (v < 15) THEN SET v = 15;
- ELSEIF (v < 16) THEN SET v = 16;
- ELSEIF (v < 17) THEN SET v = 17;
- ELSEIF (v < 18) THEN SET v = 18;
- ELSEIF (v < 19) THEN SET v = 19;
- ELSEIF (v < 20) THEN SET v = 20;
- ELSEIF (v < 21) THEN SET v = 21;
- ELSEIF (v < 22) THEN SET v = 22;
- ELSEIF (v < 23) THEN SET v = 23;
- ELSEIF (v < 24) THEN SET v = 24;
- ELSEIF (v < 25) THEN SET v = 25;
- ELSEIF (v < 26) THEN SET v = 26;
- ELSEIF (v < 27) THEN SET v = 27;
- ELSEIF (v < 28) THEN SET v = 28;
- ELSEIF (v < 29) THEN SET v = 29;
- ELSEIF (v < 30) THEN SET v = 30;
- ELSEIF (v < 31) THEN SET v = 31;
- ELSEIF (v < 32) THEN SET v = 32;
- ELSEIF (v < 33) THEN SET v = 33;
- ELSEIF (v < 34) THEN SET v = 34;
- ELSEIF (v < 35) THEN SET v = 35;
- ELSEIF (v < 36) THEN SET v = 36;
- ELSEIF (v < 37) THEN SET v = 37;
- ELSEIF (v < 38) THEN SET v = 38;
- ELSEIF (v < 39) THEN SET v = 39;
- END IF;
-END $$
-
-delimiter ;$$
-
-drop procedure p_37228;
-
-#
-# Bug#27863 (excessive memory usage for many small queries in a multiquery
-# packet).
-#
-
-let $i=`select repeat("set @a=1;", 65535)`;
---disable_query_log
-eval $i;
---enable_query_log
diff --git a/mysql-test/t/partition-master.opt b/mysql-test/t/partition-master.opt
deleted file mode 100644
index b1392bfd485..00000000000
--- a/mysql-test/t/partition-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---symbolic-links=1
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
deleted file mode 100644
index 7b7d1457426..00000000000
--- a/mysql-test/t/partition.test
+++ /dev/null
@@ -1,2916 +0,0 @@
-#--disable_abort_on_error
-#
-# Simple test for the partition storage engine
-# taken from the select test.
-#
-# Last update:
-# 2007-10-22 mleich - Move ARCHIVE, BLACKHOLE and CSV related sub tests to
-# new tests. Reason: All these might be not available.
-# - Minor cleanup
-#
---source include/have_partition.inc
-
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-
---echo #
---echo # Bug#11765667: bug#58655: ASSERTION FAILED,
---echo # SERVER CRASHES WITH MYSQLD GOT SIGNAL 6
---echo #
-CREATE TABLE t1 (
- id MEDIUMINT NOT NULL AUTO_INCREMENT,
- dt DATE, st VARCHAR(255), uid INT,
- id2nd LONGBLOB, filler VARCHAR(255), PRIMARY KEY(id, dt)
-);
-INSERT INTO t1 (dt, st, uid, id2nd, filler) VALUES
- ('1991-03-14', 'Initial Insert', 200, 1234567, 'No Data'),
- ('1991-02-26', 'Initial Insert', 201, 1234567, 'No Data'),
- ('1992-03-16', 'Initial Insert', 234, 1234567, 'No Data'),
- ('1992-07-02', 'Initial Insert', 287, 1234567, 'No Data'),
- ('1991-05-26', 'Initial Insert', 256, 1234567, 'No Data'),
- ('1991-04-25', 'Initial Insert', 222, 1234567, 'No Data'),
- ('1993-03-12', 'Initial Insert', 267, 1234567, 'No Data'),
- ('1993-03-14', 'Initial Insert', 291, 1234567, 'No Data'),
- ('1991-12-20', 'Initial Insert', 298, 1234567, 'No Data'),
- ('1994-10-31', 'Initial Insert', 220, 1234567, 'No Data');
-ALTER TABLE t1 PARTITION BY LIST (YEAR(dt)) (
- PARTITION d1 VALUES IN (1991, 1994),
- PARTITION d2 VALUES IN (1993),
- PARTITION d3 VALUES IN (1992, 1995, 1996)
-);
-INSERT INTO t1 (dt, st, uid, id2nd, filler) VALUES
- ('1991-07-14', 'After Partitioning Insert', 299, 1234567, 'Insert row');
-UPDATE t1 SET filler='Updating the row' WHERE uid=298;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug#59297: Can't find record in 'tablename' on update inner join
---echo #
-
-CREATE TABLE t1 (
-a char(2) NOT NULL,
-b char(2) NOT NULL,
-c int(10) unsigned NOT NULL,
-d varchar(255) DEFAULT NULL,
-e varchar(1000) DEFAULT NULL,
-PRIMARY KEY (a, b, c),
-KEY (a),
-KEY (a, b)
-)
-/*!50100 PARTITION BY KEY (a)
-PARTITIONS 20 */;
-
-INSERT INTO t1 (a, b, c, d, e) VALUES
-('07', '03', 343, '1', '07_03_343'),
-('01', '04', 343, '2', '01_04_343'),
-('01', '06', 343, '3', '01_06_343'),
-('01', '07', 343, '4', '01_07_343'),
-('01', '08', 343, '5', '01_08_343'),
-('01', '09', 343, '6', '01_09_343'),
-('03', '03', 343, '7', '03_03_343'),
-('03', '06', 343, '8', '03_06_343'),
-('03', '07', 343, '9', '03_07_343'),
-('04', '03', 343, '10', '04_03_343'),
-('04', '06', 343, '11', '04_06_343'),
-('05', '03', 343, '12', '05_03_343'),
-('11', '03', 343, '13', '11_03_343'),
-('11', '04', 343, '14', '11_04_343')
-;
-
-UPDATE t1 AS A,
-(SELECT '03' AS a, '06' AS b, 343 AS c, 'last' AS d) AS B
-SET A.e = B.d
-WHERE A.a = '03'
-AND A.b = '06'
-AND A.c = 343;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug#59503: explain extended crash in get_mm_leaf
---echo #
-CREATE TABLE t1 (a VARCHAR(51) CHARACTER SET latin1)
-ENGINE=MyISAM
-PARTITION BY KEY (a) PARTITIONS 1;
-INSERT INTO t1 VALUES ('a'),('b'),('c');
-EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE a > 1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#57778: failed primary key add to partitioned innodb table
---echo # inconsistent and crashes
---echo #
-CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL)
-PARTITION BY KEY (a) PARTITIONS 2;
-INSERT INTO t1 VALUES (0,1), (0,2);
---error ER_DUP_ENTRY
-ALTER TABLE t1 ADD PRIMARY KEY (a);
-SHOW CREATE TABLE t1;
-SELECT * FROM t1;
-UPDATE t1 SET a = 1, b = 1 WHERE a = 0 AND b = 2;
-ALTER TABLE t1 ADD PRIMARY KEY (a);
-SELECT * FROM t1;
-ALTER TABLE t1 DROP PRIMARY KEY;
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#57113: ha_partition::extra(ha_extra_function):
---echo # Assertion `m_extra_cache' failed
-CREATE TABLE t1
-(id INT NOT NULL PRIMARY KEY,
- name VARCHAR(16) NOT NULL,
- year YEAR,
- INDEX name (name(8))
-)
-PARTITION BY HASH(id) PARTITIONS 2;
-
-INSERT INTO t1 VALUES ( 1, 'FooBar', '1924' );
-
-CREATE TABLE t2 (id INT);
-
-INSERT INTO t2 VALUES (1),(2);
-
-UPDATE t1, t2 SET t1.year = '1955' WHERE t1.name = 'FooBar';
-
-DROP TABLE t1, t2;
-
-
---echo #
---echo # Bug#55458: Partitioned MyISAM table gets crashed by multi-table update
---echo #
-CREATE TABLE t1 (
- `id` int NOT NULL,
- `user_num` int DEFAULT NULL,
- PRIMARY KEY (`id`)
-) ENGINE=MyISAM CHARSET=latin1;
-INSERT INTO t1 VALUES (1,8601);
-INSERT INTO t1 VALUES (2,8601);
-INSERT INTO t1 VALUES (3,8601);
-INSERT INTO t1 VALUES (4,8601);
-CREATE TABLE t2 (
- `id` int(11) NOT NULL,
- `user_num` int DEFAULT NULL,
- `name` varchar(64) NOT NULL,
- PRIMARY KEY (`id`)
-) ENGINE=MyISAM CHARSET=latin1
-PARTITION BY HASH (id)
-PARTITIONS 2;
-INSERT INTO t2 VALUES (1,8601,'John');
-INSERT INTO t2 VALUES (2,8601,'JS');
-INSERT INTO t2 VALUES (3,8601,'John S');
-
-UPDATE t1, t2 SET t2.name = 'John Smith' WHERE t1.user_num = t2.user_num;
-
-DROP TABLE t1, t2;
-
---echo # Bug#39338: Fieldnames in
---echo # INFORMATIONSCHEMA.PARTITIONS.PARTITION_EXPRESSION become unescaped
---echo # NOTE: the partition expression is saved as a string, so changing from
---echo # normal quotes to ansi quotes does not change the expression, only
---echo # for partition by KEY.
-CREATE TABLE t1 (
- ID int(11) NOT NULL,
- `aaaa,aaaaa` tinyint(3) UNSIGNED NOT NULL DEFAULT '0',
- ddddddddd int(11) NOT NULL DEFAULT '0',
- new_field0 varchar(50),
- PRIMARY KEY(ID, `aaaa,aaaaa`, ddddddddd))
-PARTITION BY RANGE(ID)
-PARTITIONS 3
-SUBPARTITION BY LINEAR KEY(ID,`aaaa,aaaaa`)
-SUBPARTITIONS 2 (
- PARTITION p01 VALUES LESS THAN(100),
- PARTITION p11 VALUES LESS THAN(200),
- PARTITION p21 VALUES LESS THAN MAXVALUE);
-SELECT PARTITION_EXPRESSION, SUBPARTITION_EXPRESSION FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME='t1';
-show create table t1;
-drop table t1;
-
-#
-# Bug#48276: can't add column if subpartition exists
-CREATE TABLE t1 (a INT, b INT)
-PARTITION BY LIST (a)
-SUBPARTITION BY HASH (b)
-(PARTITION p1 VALUES IN (1));
-ALTER TABLE t1 ADD COLUMN c INT;
-DROP TABLE t1;
-
-#
-# Bug#46639: 1030 (HY000): Got error 124 from storage engine on
-# INSERT ... SELECT ...
-CREATE TABLE t1 (
- a int NOT NULL,
- b int NOT NULL);
-
-CREATE TABLE t2 (
- a int NOT NULL,
- b int NOT NULL,
- INDEX(b)
-)
-PARTITION BY HASH(a) PARTITIONS 2;
-
-INSERT INTO t1 VALUES (399, 22);
-INSERT INTO t2 VALUES (1, 22), (1, 42);
-
-INSERT INTO t2 SELECT 1, 399 FROM t2, t1
-WHERE t1.b = t2.b;
-
-DROP TABLE t1, t2;
-
-#
-# Bug#46478: timestamp field incorrectly defaulted when partition is reorganized
-#
-CREATE TABLE t1 (
- a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
- b varchar(10),
- PRIMARY KEY (a)
-)
-PARTITION BY RANGE (UNIX_TIMESTAMP(a)) (
- PARTITION p1 VALUES LESS THAN (1199134800),
- PARTITION pmax VALUES LESS THAN MAXVALUE
-);
-
-INSERT INTO t1 VALUES ('2007-07-30 17:35:48', 'p1');
-INSERT INTO t1 VALUES ('2009-07-14 17:35:55', 'pmax');
-INSERT INTO t1 VALUES ('2009-09-21 17:31:42', 'pmax');
-
-SELECT * FROM t1;
-SELECT * FROM t1 where a between '2007-01-01' and '2007-08-01';
-EXPLAIN PARTITIONS SELECT * FROM t1 where a between '2007-01-01' and '2007-08-01';
-EXPLAIN PARTITIONS SELECT * FROM t1 where a = '2007-07-30 17:35:48';
-ALTER TABLE t1 REORGANIZE PARTITION pmax INTO (
- PARTITION p3 VALUES LESS THAN (1247688000),
- PARTITION pmax VALUES LESS THAN MAXVALUE);
-SELECT * FROM t1;
-SELECT * FROM t1 where a between '2007-01-01' and '2007-08-01';
-EXPLAIN PARTITIONS SELECT * FROM t1 where a between '2007-01-01' and '2007-08-01';
-EXPLAIN PARTITIONS SELECT * FROM t1 where a = '2007-07-30 17:35:48';
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-#
-# Bug#45904: Error when CHARSET=utf8 and subpartitioning
-#
-create table t1 (a int NOT NULL, b varchar(5) NOT NULL)
-default charset=utf8
-partition by list (a)
-subpartition by key (b)
-(partition p0 values in (1),
- partition p1 values in (2));
-drop table t1;
-
-#
-# Bug#44059: rec_per_key on empty partition gives weird optimiser results
-#
-create table t1 (a int, b int, key(a))
-partition by list (a)
-( partition p0 values in (1),
- partition p1 values in (2));
-insert into t1 values (1,1),(2,1),(2,2),(2,3);
-show indexes from t1;
-analyze table t1;
-show indexes from t1;
-drop table t1;
-
-#
-# Bug#40181: hang if create index
-#
-create table t1 (a int)
-partition by hash (a);
-create index i on t1 (a);
-insert into t1 values (1);
-insert into t1 select * from t1;
---error ER_DUP_KEYNAME
-create index i on t1 (a);
-create index i2 on t1 (a);
-drop table t1;
-
-#
-# Bug#36001: Partitions: spelling and using some error messages
-#
---error ER_FOREIGN_KEY_ON_PARTITIONED
-CREATE TABLE t1 (a INT, FOREIGN KEY (a) REFERENCES t0 (a))
-ENGINE=MyISAM
-PARTITION BY HASH (a);
-
-#
-# Bug#40954: Crash if range search and order by.
-#
-CREATE TABLE t1 (
- pk INT NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (pk)
-)
-/*!50100 PARTITION BY HASH (pk)
-PARTITIONS 2 */;
-INSERT INTO t1 VALUES (NULL);
-INSERT INTO t1 VALUES (NULL);
-INSERT INTO t1 VALUES (NULL);
-SELECT * FROM t1 WHERE pk < 0 ORDER BY pk;
-DROP TABLE t1;
-
-#
-# Bug#35765: ALTER TABLE produces wrong error when non-existent storage engine
-# used
-SET sql_mode=no_engine_substitution;
---error ER_UNKNOWN_STORAGE_ENGINE
-CREATE TABLE t1 (a INT)
-ENGINE=NonExistentEngine;
---error ER_UNKNOWN_STORAGE_ENGINE
-CREATE TABLE t1 (a INT)
-ENGINE=NonExistentEngine
-PARTITION BY HASH (a);
-CREATE TABLE t1 (a INT)
-ENGINE=Memory;
---error ER_UNKNOWN_STORAGE_ENGINE
-ALTER TABLE t1 ENGINE=NonExistentEngine;
-# OK to only specify one partitions engine, since it is already assigned at
-# table level (after create, it is specified on all levels and all parts).
---error ER_UNKNOWN_STORAGE_ENGINE
-ALTER TABLE t1
-PARTITION BY HASH (a)
-(PARTITION p0 ENGINE=Memory,
- PARTITION p1 ENGINE=NonExistentEngine);
---error ER_UNKNOWN_STORAGE_ENGINE
-ALTER TABLE t1 ENGINE=NonExistentEngine;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-SET sql_mode='';
-CREATE TABLE t1 (a INT)
-ENGINE=NonExistentEngine;
-DROP TABLE t1;
-CREATE TABLE t1 (a INT)
-ENGINE=NonExistentEngine
-PARTITION BY HASH (a);
-DROP TABLE t1;
-CREATE TABLE t1 (a INT)
-ENGINE=Memory;
-ALTER TABLE t1 ENGINE=NonExistentEngine;
-# OK to only specify one partitions engine, since it is already assigned at
-# table level (after create, it is specified on all levels and all parts).
-ALTER TABLE t1
-PARTITION BY HASH (a)
-(PARTITION p0 ENGINE=Memory,
- PARTITION p1 ENGINE=NonExistentEngine);
-ALTER TABLE t1 ENGINE=NonExistentEngine;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-SET sql_mode=DEFAULT;
-
-#
-# Bug#40494: Crash MYSQL server crashes on range access with partitioning
-# and order by
-#
-CREATE TABLE t1 (a INT NOT NULL, KEY(a))
-PARTITION BY RANGE(a)
-(PARTITION p1 VALUES LESS THAN (200), PARTITION pmax VALUES LESS THAN MAXVALUE);
-INSERT INTO t1 VALUES (2), (40), (40), (70), (60), (90), (199);
-SELECT a FROM t1 WHERE a BETWEEN 60 AND 95 ORDER BY a ASC;
---sorted_result
-SELECT a FROM t1 WHERE a BETWEEN 60 AND 95;
-INSERT INTO t1 VALUES (200), (250), (210);
-SELECT a FROM t1 WHERE a BETWEEN 60 AND 220 ORDER BY a ASC;
-SELECT a FROM t1 WHERE a BETWEEN 200 AND 220 ORDER BY a ASC;
-SELECT a FROM t1 WHERE a BETWEEN 60 AND 95 ORDER BY a DESC;
-SELECT a FROM t1 WHERE a BETWEEN 60 AND 220 ORDER BY a DESC;
-SELECT a FROM t1 WHERE a BETWEEN 200 AND 220 ORDER BY a DESC;
---sorted_result
-SELECT a FROM t1 WHERE a BETWEEN 60 AND 220;
---sorted_result
-SELECT a FROM t1 WHERE a BETWEEN 200 AND 220;
---sorted_result
-SELECT a FROM t1 WHERE a BETWEEN 60 AND 95;
---sorted_result
-SELECT a FROM t1 WHERE a BETWEEN 60 AND 220;
---sorted_result
-SELECT a FROM t1 WHERE a BETWEEN 200 AND 220;
-DROP TABLE t1;
-
-#
-# Bug35931: Index search may return duplicates
-#
-CREATE TABLE t1 (
- a INT NOT NULL,
- b MEDIUMINT NOT NULL,
- c INT NOT NULL,
- KEY b (b)
-) ENGINE=MyISAM
-PARTITION BY LIST (a) (
- PARTITION p0 VALUES IN (1)
-);
-INSERT INTO t1 VALUES (1,1,0), (1,1,1), (1,1,2), (1,1,53), (1,1,4), (1,1,5),
-(1,1,6), (1,1,7), (1,1,8), (1,1,9), (1,1,10), (1,1,11), (1,1,12), (1,1,13),
-(1,1,14), (1,1,15), (1,1,16), (1,1,67), (1,1,18), (1,1,19), (1,1,20), (1,1,21),
-(1,1,22), (1,1,23), (1,1,24), (1,1,75), (1,1,26), (1,1,27), (1,1,128),
-(1,1,79), (1,1,30), (1,1,31), (1,1,32), (1,1,33), (1,1,34), (1,1,85), (1,1,36),
-(1,1,37), (1,1,38), (1,1,39), (1,1,40), (1,1,241), (1,1,42), (1,1,43),
-(1,1,44), (1,1,45), (1,1,46), (1,1,147), (1,1,48), (1,1,49), (1,2,0), (1,2,1),
-(1,2,2), (1,2,3), (1,2,4), (1,2,5), (1,2,6), (1,2,7), (1,2,8), (1,2,9),
-(1,2,10), (1,2,11), (1,2,12), (1,2,13), (1,2,14), (1,2,15), (1,2,16), (1,2,17),
-(1,2,18), (1,2,19), (1,2,20), (1,2,21), (1,2,22), (1,2,23), (1,2,24), (1,2,25),
-(1,2,26), (1,2,27), (1,2,28), (1,2,29), (1,2,30), (1,2,31), (1,2,32), (1,2,33),
-(1,2,34), (1,2,35), (1,2,36), (1,2,37), (1,2,38), (1,2,39), (1,2,40), (1,2,41),
-(1,2,42), (1,2,43), (1,2,44), (1,2,45), (1,2,46), (1,2,47), (1,2,48), (1,2,49),
-(1,6,0), (1,6,1), (1,6,2), (1,6,3), (1,6,4), (1,6,5), (1,6,6), (1,6,7),
-(1,6,8), (1,6,9), (1,6,10), (1,6,11), (1,6,12), (1,6,13), (1,6,14), (1,6,15),
-(1,6,16), (1,6,17), (1,6,18), (1,6,19), (1,6,20), (1,6,21), (1,6,22), (1,6,23),
-(1,6,24), (1,6,25), (1,6,26), (1,6,27), (1,6,28), (1,6,29), (1,6,30), (1,6,31),
-(1,6,32), (1,6,33), (1,6,34), (1,6,35), (1,6,36), (1,6,37), (1,6,38), (1,6,39),
-(1,6,40), (1,6,41), (1,6,42), (1,6,43), (1,6,44), (1,6,45), (1,6,46), (1,6,47),
-(1,6,48), (1,6,49), (1,7,0), (1,7,1), (1,7,2), (1,7,3), (1,7,4), (1,7,5),
-(1,7,6), (1,7,7), (1,7,8), (1,7,9), (1,7,10), (1,7,11), (1,7,12), (1,7,13),
-(1,7,14), (1,7,15), (1,7,16), (1,7,17), (1,7,18), (1,7,19), (1,7,20), (1,7,21),
-(1,7,22), (1,7,23), (1,7,24), (1,7,25), (1,7,26), (1,7,27), (1,7,28), (1,7,29),
- (1,7,30), (1,7,31), (1,7,32), (1,7,33), (1,7,34), (1,7,35), (1,7,38), (1,7,39),
-(1,7,90), (1,7,41), (1,7,43), (1,7,48), (1,7,49), (1,9,0), (1,9,1), (1,9,2),
-(1,9,3), (1,9,4), (1,9,5), (1,9,6), (1,9,7), (1,9,8), (1,9,9), (1,9,10),
-(1,9,11), (1,9,12), (1,9,13), (1,9,14), (1,9,15), (1,9,16), (1,9,17), (1,9,18),
-(1,9,19), (1,9,20), (1,9,21), (1,9,22), (1,9,23), (1,9,24), (1,9,25), (1,9,26),
-(1,9,29), (1,9,32), (1,9,35), (1,9,38), (1,10,0), (1,10,1), (1,10,2), (1,10,3),
-(1,10,4), (1,10,5), (1,10,6), (1,10,7), (1,10,8), (1,10,9), (1,10,10),
-(1,10,11), (1,10,13), (1,10,14), (1,10,15), (1,10,16), (1,10,17), (1,10,18),
-(1,10,22), (1,10,24), (1,10,25), (1,10,26), (1,10,28), (1,10,131), (1,10,33),
-(1,10,84), (1,10,35), (1,10,40), (1,10,42), (1,10,49), (1,11,0), (1,11,1),
-(1,11,2), (1,11,3), (1,11,4), (1,11,5), (1,11,6), (1,11,7), (1,11,8), (1,11,9),
-(1,11,10), (1,11,11), (1,11,12), (1,11,13), (1,11,14), (1,11,15), (1,11,16),
-(1,11,17), (1,11,18), (1,11,19), (1,11,20), (1,11,21), (1,11,22), (1,11,23),
-(1,11,24), (1,11,25), (1,11,26), (1,11,27), (1,11,28), (1,11,30), (1,11,31),
-(1,11,32), (1,11,33), (1,11,34), (1,11,35), (1,11,37), (1,11,39), (1,11,40),
-(1,11,42), (1,11,44), (1,11,45), (1,11,47), (1,11,48), (1,14,104), (1,14,58),
-(1,14,12), (1,14,13), (1,14,15), (1,14,16), (1,14,17), (1,14,34), (1,15,0),
-(1,15,1), (1,15,2), (1,15,3), (1,15,4), (1,15,5), (1,15,7), (1,15,9),
-(1,15,15), (1,15,27), (1,15,49), (1,16,0), (1,16,1), (1,16,3), (1,17,4),
-(1,19,1);
-SELECT COUNT(*) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
-SELECT SUM(c) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
-SELECT SUM(c+0.0) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
-ALTER TABLE t1 DROP INDEX b;
-SELECT COUNT(*) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
-SELECT SUM(c) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
-ALTER TABLE t1 ENGINE = Memory;
-SELECT COUNT(*) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
-SELECT SUM(c) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
-ALTER TABLE t1 ADD INDEX b USING HASH (b);
-SELECT COUNT(*) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
-SELECT SUM(c) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
-DROP TABLE t1;
-
-# Bug#37327 Range scan on partitioned table returns duplicate rows
-# (Duplicate of Bug#35931)
-CREATE TABLE `t1` (
- `c1` int(11) DEFAULT NULL,
- KEY `c1` (`c1`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-
-CREATE TABLE `t2` (
- `c1` int(11) DEFAULT NULL,
- KEY `c1` (`c1`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c1) (PARTITION a VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION b VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */;
-
-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 `t2` VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
-
-EXPLAIN PARTITIONS SELECT c1 FROM t1 WHERE (c1 > 10 AND c1 < 13) OR (c1 > 17 AND c1 < 20);
-
-FLUSH STATUS;
-SELECT c1 FROM t1 WHERE (c1 > 10 AND c1 < 13) OR (c1 > 17 AND c1 < 20);
-SHOW STATUS LIKE 'Handler_read_%';
-
-EXPLAIN PARTITIONS SELECT c1 FROM t2 WHERE (c1 > 10 AND c1 < 13) OR (c1 > 17 AND c1 < 20);
-
-FLUSH STATUS;
-SELECT c1 FROM t2 WHERE (c1 > 10 AND c1 < 13) OR (c1 > 17 AND c1 < 20);
-SHOW STATUS LIKE 'Handler_read_%';
-DROP TABLE t1,t2;
-
-# Bug#37329 Range scan on partitioned tables shows higher Handler_read_next
-# (marked as duplicate of Bug#35931)
-CREATE TABLE `t1` (
- `c1` int(11) DEFAULT NULL,
- KEY `c1` (`c1`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-
-CREATE TABLE `t2` (
- `c1` int(11) DEFAULT NULL,
- KEY `c1` (`c1`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (c1)
-(PARTITION a VALUES LESS THAN (100) ENGINE = MyISAM,
- PARTITION b VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */;
-
-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 `t2` VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
-
-EXPLAIN PARTITIONS SELECT c1 FROM t1 WHERE (c1 > 2 AND c1 < 5);
-
-FLUSH STATUS;
-SELECT c1 FROM t1 WHERE (c1 > 2 AND c1 < 5);
-SHOW STATUS LIKE 'Handler_read_%';
-
-EXPLAIN PARTITIONS SELECT c1 FROM t2 WHERE (c1 > 2 AND c1 < 5);
-
-FLUSH STATUS;
-SELECT c1 FROM t2 WHERE (c1 > 2 AND c1 < 5);
-SHOW STATUS LIKE 'Handler_read_%';
-
-EXPLAIN PARTITIONS SELECT c1 FROM t1 WHERE (c1 > 12 AND c1 < 15);
-
-FLUSH STATUS;
-SELECT c1 FROM t1 WHERE (c1 > 12 AND c1 < 15);
-SHOW STATUS LIKE 'Handler_read_%';
-
-EXPLAIN PARTITIONS SELECT c1 FROM t2 WHERE (c1 > 12 AND c1 < 15);
-
-FLUSH STATUS;
-SELECT c1 FROM t2 WHERE (c1 > 12 AND c1 < 15);
-SHOW STATUS LIKE 'Handler_read_%';
-DROP TABLE t1,t2;
-
---error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (a int) partition by list ((a/3)*10 div 1)
-(partition p0 values in (0), partition p1 values in (1));
-
-#
-# Bug #30695: An apostrophe ' in the comment of the ADD PARTITION causes the Server to crash.
-#
-# To verify the fix for crashing (on unix-type OS)
-# uncomment the exec and error rows!
-
-CREATE TABLE t1 (
- d DATE NOT NULL
-)
-PARTITION BY RANGE( YEAR(d) ) (
- PARTITION p0 VALUES LESS THAN (1960),
- PARTITION p1 VALUES LESS THAN (1970),
- PARTITION p2 VALUES LESS THAN (1980),
- PARTITION p3 VALUES LESS THAN (1990)
-);
-
-ALTER TABLE t1 ADD PARTITION (
-PARTITION `p5` VALUES LESS THAN (2010)
-COMMENT 'APSTART \' APEND'
-);
-#--exec sed 's/APSTART \\/APSTART /' var/master-data/test/t1.frm > tmpt1.frm && mv tmpt1.frm var/master-data/test/t1.frm
-#--error ER_PARSE_ERROR
-SELECT * FROM t1 LIMIT 1;
-
-DROP TABLE t1;
-
-#
-# Bug 30878: crashing when alter an auto_increment non partitioned
-# table to partitioned
-
-create table t1 (id int auto_increment, s1 int, primary key (id));
-
-insert into t1 values (null,1);
-insert into t1 values (null,6);
-
--- sorted_result
-select * from t1;
-
-alter table t1 partition by range (id) (
- partition p0 values less than (3),
- partition p1 values less than maxvalue
-);
-
-drop table t1;
-
-#
-# Bug 15890: Strange number of partitions accepted
-#
--- error ER_PARSE_ERROR
-create table t1 (a int)
-partition by key(a)
-partitions 0.2+e1;
--- error ER_PARSE_ERROR
-create table t1 (a int)
-partition by key(a)
-partitions -1;
--- error ER_PARSE_ERROR
-create table t1 (a int)
-partition by key(a)
-partitions 1.5;
--- error ER_PARSE_ERROR
-create table t1 (a int)
-partition by key(a)
-partitions 1e+300;
-
-#
-# Bug 19309 Partitions: Crash if double procedural alter
-#
-create table t1 (a int)
-partition by list (a)
-(partition p0 values in (1));
-
-create procedure pz()
-alter table t1 engine = myisam;
-
-call pz();
-call pz();
-drop procedure pz;
-drop table t1;
-
-#
-# BUG 16002: Handle unsigned integer functions properly
-#
---error ER_VALUES_IS_NOT_INT_TYPE_ERROR
-create table t1 (a bigint)
-partition by range (a)
-(partition p0 values less than (0xFFFFFFFFFFFFFFFF),
- partition p1 values less than (10));
---error ER_VALUES_IS_NOT_INT_TYPE_ERROR
-create table t1 (a bigint)
-partition by list (a)
-(partition p0 values in (0xFFFFFFFFFFFFFFFF),
- partition p1 values in (10));
-
-create table t1 (a bigint unsigned)
-partition by range (a)
-(partition p0 values less than (100),
- partition p1 values less than MAXVALUE);
-insert into t1 values (1);
-drop table t1;
-
-create table t1 (a bigint unsigned)
-partition by hash (a);
-insert into t1 values (0xFFFFFFFFFFFFFFFD);
-insert into t1 values (0xFFFFFFFFFFFFFFFE);
-select * from t1 where (a + 1) < 10;
-select * from t1 where (a + 1) > 10;
-drop table t1;
-
-#
-# Added test case
-#
-create table t1 (a int)
-partition by key(a)
-(partition p0 engine = MEMORY);
-drop table t1;
-
-#
-# BUG 19067 ALTER TABLE .. ADD PARTITION for subpartitioned table crashes
-#
-create table t1 (a int)
-partition by range (a)
-subpartition by key (a)
-(partition p0 values less than (1));
-alter table t1 add partition (partition p1 values less than (2));
-show create table t1;
-alter table t1 reorganize partition p1 into (partition p1 values less than (3));
-show create table t1;
-drop table t1;
-
-#
-# Partition by key no partition defined => OK
-#
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by key (a);
-
-#
-# Bug 13323: Select count(*) on empty table returns 2
-#
-select count(*) from t1;
-
-#
-# Test SHOW CREATE TABLE
-#
-show create table t1;
-
-drop table t1;
-#
-# Partition by key no partition, list of fields
-#
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by key (a, b);
-
-drop table t1;
-#
-# Partition by key specified 3 partitions and defined 3 => ok
-#
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by key (a)
-partitions 3
-(partition x1, partition x2, partition x3);
-
-drop table t1;
-#
-# Partition by key specifying nodegroup
-#
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by key (a)
-partitions 3
-(partition x1 nodegroup 0,
- partition x2 nodegroup 1,
- partition x3 nodegroup 2);
-
-drop table t1;
-#
-# Partition by key specifying engine
-#
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by key (a)
-partitions 3
-(partition x1 engine myisam,
- partition x2 engine myisam,
- partition x3 engine myisam);
-
-drop table t1;
-#
-# Partition by key specifying tablespace
-#
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by key (a)
-partitions 3
-(partition x1 tablespace ts1,
- partition x2 tablespace ts2,
- partition x3 tablespace ts3);
-
-CREATE TABLE t2 LIKE t1;
-
-drop table t2;
-drop table t1;
-
-#
-# Partition by key list, basic
-#
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by list (a)
-partitions 3
-(partition x1 values in (1,2,9,4) tablespace ts1,
- partition x2 values in (3, 11, 5, 7) tablespace ts2,
- partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
-
-drop table t1;
-#
-# Partition by key list, list function
-#
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by list (b*a)
-partitions 3
-(partition x1 values in (1,2,9,4) tablespace ts1,
- partition x2 values in (3, 11, 5, 7) tablespace ts2,
- partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
-
-drop table t1;
-
-#
-# Partition by key list, list function, no spec of #partitions
-#
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by list (b*a)
-(partition x1 values in (1) tablespace ts1,
- partition x2 values in (3, 11, 5, 7) tablespace ts2,
- partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
-
-drop table t1;
-
-#
-# Bug 13154: Insert crashes due to bad calculation of partition id
-# for PARTITION BY KEY and SUBPARTITION BY KEY
-#
-CREATE TABLE t1 (
-a int not null)
-partition by key(a);
-
-LOCK TABLES t1 WRITE;
-insert into t1 values (1);
-insert into t1 values (2);
-insert into t1 values (3);
-insert into t1 values (4);
-UNLOCK TABLES;
-
-drop table t1;
-
-#
-# Bug #13644 DROP PARTITION NULL's DATE column
-#
-CREATE TABLE t1 (a int, name VARCHAR(50), purchased DATE)
-PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (3),
- PARTITION p1 VALUES LESS THAN (7),
- PARTITION p2 VALUES LESS THAN (9),
- PARTITION p3 VALUES LESS THAN (11));
-INSERT INTO t1 VALUES
-(1, 'desk organiser', '2003-10-15'),
-(2, 'CD player', '1993-11-05'),
-(3, 'TV set', '1996-03-10'),
-(4, 'bookcase', '1982-01-10'),
-(5, 'exercise bike', '2004-05-09'),
-(6, 'sofa', '1987-06-05'),
-(7, 'popcorn maker', '2001-11-22'),
-(8, 'acquarium', '1992-08-04'),
-(9, 'study desk', '1984-09-16'),
-(10, 'lava lamp', '1998-12-25');
-
-SELECT * from t1 ORDER BY a;
-ALTER TABLE t1 DROP PARTITION p0;
-SELECT * from t1 ORDER BY a;
-
-drop table t1;
-
-#
-# Bug #13442; Truncate Partitioned table doesn't work
-#
-
-CREATE TABLE t1 (a int)
-PARTITION BY LIST (a)
-(PARTITION p0 VALUES IN (1,2,3), PARTITION p1 VALUES IN (4,5,6));
-
-insert into t1 values (1),(2),(3),(4),(5),(6);
-select * from t1;
-truncate t1;
-select * from t1;
-truncate t1;
-select * from t1;
-drop table t1;
-
-#
-# Bug #13445 Partition by KEY method crashes server
-#
-CREATE TABLE t1 (a int, b int, primary key(a,b))
-PARTITION BY KEY(b,a) PARTITIONS 4;
-
-insert into t1 values (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6);
-select * from t1 where a = 4;
-
-drop table t1;
-
-#
-# Bug#22351 - handler::index_next_same() call to key_cmp_if_same()
-# uses the wrong buffer
-#
-CREATE TABLE t1 (c1 INT, c2 INT, PRIMARY KEY USING BTREE (c1,c2)) ENGINE=MEMORY
- PARTITION BY KEY(c2,c1) PARTITIONS 4;
-INSERT INTO t1 VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6);
-SELECT * FROM t1 WHERE c1 = 4;
-DROP TABLE t1;
-
-#
-# Bug #13438: Engine clause in PARTITION clause causes crash
-#
-CREATE TABLE t1 (a int)
-PARTITION BY LIST (a)
-PARTITIONS 1
-(PARTITION x1 VALUES IN (1) ENGINE=MEMORY);
-
-show create table t1;
-drop table t1;
-
-#
-# Bug #13440: REPLACE causes crash in partitioned table
-#
-CREATE TABLE t1 (a int, unique(a))
-PARTITION BY LIST (a)
-(PARTITION x1 VALUES IN (10), PARTITION x2 VALUES IN (20));
-
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-REPLACE t1 SET a = 4;
-drop table t1;
-
-#
-# Bug #14365: Crash if value too small in list partitioned table
-#
-CREATE TABLE t1 (a int)
-PARTITION BY LIST (a)
-(PARTITION x1 VALUES IN (2), PARTITION x2 VALUES IN (3));
-
-insert into t1 values (2), (3);
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-insert into t1 values (4);
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-insert into t1 values (1);
-drop table t1;
-
-#
-# Bug 14327: PARTITIONS clause gets lost in SHOW CREATE TABLE
-#
-CREATE TABLE t1 (a int)
-PARTITION BY HASH(a)
-PARTITIONS 5;
-
-SHOW CREATE TABLE t1;
-
-drop table t1;
-
-#
-# Bug #13446: Update to value outside of list values doesn't give error
-#
-CREATE TABLE t1 (a int)
-PARTITION BY RANGE (a)
-(PARTITION x1 VALUES LESS THAN (2));
-
-insert into t1 values (1);
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-update t1 set a = 5;
-
-drop table t1;
-
-#
-# Bug #13441: Analyze on partitioned table didn't work
-#
-CREATE TABLE t1 (a int)
-PARTITION BY LIST (a)
-(PARTITION x1 VALUES IN (10), PARTITION x2 VALUES IN (20));
-
-analyze table t1;
-
-drop table t1;
-
-#
-# BUG 15221 (Cannot reorganize with the same name)
-#
-create table t1
-(a int)
-partition by range (a)
- ( partition p0 values less than(10),
- partition p1 values less than (20),
- partition p2 values less than (25));
-
-alter table t1 reorganize partition p2 into (partition p2 values less than (30));
-show create table t1;
-drop table t1;
-
-CREATE TABLE t1 (a int, b int)
-PARTITION BY RANGE (a)
-(PARTITION x0 VALUES LESS THAN (2),
- PARTITION x1 VALUES LESS THAN (4),
- PARTITION x2 VALUES LESS THAN (6),
- PARTITION x3 VALUES LESS THAN (8),
- PARTITION x4 VALUES LESS THAN (10),
- PARTITION x5 VALUES LESS THAN (12),
- PARTITION x6 VALUES LESS THAN (14),
- PARTITION x7 VALUES LESS THAN (16),
- PARTITION x8 VALUES LESS THAN (18),
- PARTITION x9 VALUES LESS THAN (20));
-
-ALTER TABLE t1 REORGANIZE PARTITION x0,x1,x2 INTO
-(PARTITION x1 VALUES LESS THAN (6));
-show create table t1;
-drop table t1;
-
-# Testcase for BUG#15819
-create table t1 (a int not null, b int not null) partition by LIST (a+b) (
- partition p0 values in (12),
- partition p1 values in (14)
-);
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-insert into t1 values (10,1);
-
-drop table t1;
-
-#
-# Bug#16901 Partitions: crash, SELECT, column of part.
-# function=first column of primary key
-#
-create table t1 (f1 integer,f2 integer, f3 varchar(10), primary key(f1,f2))
-partition by range(f1) subpartition by hash(f2) subpartitions 2
-(partition p1 values less than (0),
- partition p2 values less than (2),
- partition p3 values less than (2147483647));
-
-insert into t1 values(10,10,'10');
-insert into t1 values(2,2,'2');
-select * from t1 where f1 = 2;
-drop table t1;
-
-#
-# Bug #16907 Partitions: crash, SELECT goes into last partition, UNIQUE INDEX
-#
-create table t1 (f1 integer,f2 integer, unique index(f1))
-partition by range(f1 div 2)
-subpartition by hash(f1) subpartitions 2
-(partition partb values less than (2),
-partition parte values less than (4),
-partition partf values less than (10000));
-insert into t1 values(10,1);
-select * from t1 where f1 = 10;
-drop table t1;
-
-#
-# Bug #16775: Wrong engine type stored for subpartition
-#
-set session default_storage_engine= 'memory';
-create table t1 (f_int1 int(11) default null) engine = memory
- partition by range (f_int1) subpartition by hash (f_int1)
- (partition part1 values less than (1000)
- (subpartition subpart11 engine = memory));
-drop table t1;
-set session default_storage_engine='myisam';
-
-#
-# Bug #16782: Crash using REPLACE on table with primary key
-#
-create table t1 (f_int1 integer, f_int2 integer, primary key (f_int1))
- partition by hash(f_int1) partitions 2;
-insert into t1 values (1,1),(2,2);
-replace into t1 values (1,1),(2,2);
-drop table t1;
-
-#
-# Bug #17169: Partitions: out of memory if add partition and unique
-#
-create table t1 (s1 int, unique (s1)) partition by list (s1) (partition x1 VALUES in (10), partition x2 values in (20));
-alter table t1 add partition (partition x3 values in (30));
-drop table t1;
-
-#
-# Bug #17754 Change to explicit removal of partitioning scheme
-# Also added a number of tests to ensure that proper engine is
-# choosen in all kinds of scenarios.
-#
-
-create table t1 (a int)
-partition by key(a)
-partitions 2
-(partition p0 engine=myisam, partition p1 engine=myisam);
-show create table t1;
-
-alter table t1;
-show create table t1;
-
-alter table t1 engine=myisam;
-show create table t1;
-
-alter table t1 engine=heap;
-show create table t1;
-
-alter table t1 remove partitioning;
-show create table t1;
-
-drop table t1;
-
-create table t1 (a int)
-engine=myisam
-partition by key(a)
-partitions 2
-(partition p0 engine=myisam, partition p1 engine=myisam);
-show create table t1;
-
-alter table t1 add column b int remove partitioning;
-show create table t1;
-
-alter table t1
-engine=myisam
-partition by key(a)
-(partition p0 engine=myisam, partition p1);
-show create table t1;
-
-alter table t1
-engine=heap
-partition by key(a)
-(partition p0, partition p1 engine=heap);
-show create table t1;
-
-alter table t1 engine=myisam, add column c int remove partitioning;
-show create table t1;
-
-alter table t1
-engine=heap
-partition by key (a)
-(partition p0, partition p1);
-show create table t1;
-
-alter table t1
-partition by key (a)
-(partition p0, partition p1);
-show create table t1;
-
-alter table t1
-engine=heap
-partition by key (a)
-(partition p0, partition p1);
-show create table t1;
-
-# Since alter, it already have ENGINE=HEAP from before on table level
-# -> OK
-alter table t1
-partition by key(a)
-(partition p0, partition p1 engine=heap);
-
-# Since alter, it already have ENGINE=HEAP from before on table level
-# -> OK
-alter table t1
-partition by key(a)
-(partition p0 engine=heap, partition p1);
-
---error ER_MIX_HANDLER_ERROR
-alter table t1
-engine=heap
-partition by key (a)
-(partition p0 engine=heap, partition p1 engine=myisam);
-
---error ER_MIX_HANDLER_ERROR
-alter table t1
-partition by key (a)
-(partition p0 engine=heap, partition p1 engine=myisam);
-
-drop table t1;
-
-# Bug #17432: Partition functions containing NULL values should return
-# LONGLONG_MIN
-#
-CREATE TABLE t1 (
- f_int1 INTEGER, f_int2 INTEGER,
- f_char1 CHAR(10), f_char2 CHAR(10), f_charbig VARCHAR(1000)
- )
- PARTITION BY RANGE(f_int1 DIV 2)
- SUBPARTITION BY HASH(f_int1)
- SUBPARTITIONS 2
- (PARTITION parta VALUES LESS THAN (0),
- PARTITION partb VALUES LESS THAN (5),
- PARTITION parte VALUES LESS THAN (10),
- PARTITION partf VALUES LESS THAN (2147483647));
-INSERT INTO t1 SET f_int1 = NULL , f_int2 = -20, f_char1 = CAST(-20 AS CHAR),
- f_char2 = CAST(-20 AS CHAR), f_charbig = '#NULL#';
-SELECT * FROM t1 WHERE f_int1 IS NULL;
-SELECT * FROM t1;
-drop table t1;
-
-#
-# Bug 17430: Crash when SELECT * from t1 where field IS NULL
-#
-
-CREATE TABLE t1 (
- f_int1 INTEGER, f_int2 INTEGER,
- f_char1 CHAR(10), f_char2 CHAR(10), f_charbig VARCHAR(1000) )
- PARTITION BY LIST(MOD(f_int1,2))
- SUBPARTITION BY KEY(f_int1)
- (PARTITION part1 VALUES IN (-1) (SUBPARTITION sp1, SUBPARTITION sp2),
- PARTITION part2 VALUES IN (0) (SUBPARTITION sp3, SUBPARTITION sp5),
- PARTITION part3 VALUES IN (1) (SUBPARTITION sp4, SUBPARTITION sp6));
-
-INSERT INTO t1 SET f_int1 = 2, f_int2 = 2, f_char1 = '2', f_char2 = '2', f_charbig = '===2===';
-INSERT INTO t1 SET f_int1 = 2, f_int2 = 2, f_char1 = '2', f_char2 = '2', f_charbig = '===2===';
-
-SELECT * FROM t1 WHERE f_int1 IS NULL;
-drop table t1;
-
-#
-# Bug#14363 Partitions: failure if create in stored procedure
-#
-delimiter //;
-
-create procedure p ()
-begin
-create table t1 (s1 mediumint,s2 mediumint)
-partition by list (s2)
-(partition p1 values in (0),
- partition p2 values in (1));
-end//
-
-call p()//
-drop procedure p//
-drop table t1;
-
-create procedure p ()
-begin
-create table t1 (a int not null,b int not null,c int not null,primary key (a,b))
-partition by range (a)
-subpartition by hash (a+b)
-(partition x1 values less than (1)
- (subpartition x11,
- subpartition x12),
- partition x2 values less than (5)
- (subpartition x21,
- subpartition x22));
-end//
-
-call p()//
-drop procedure p//
-drop table t1//
-delimiter ;//
-
-#
-# Bug #15447 Partitions: NULL is treated as zero
-#
-
-# NULL for RANGE partition
-create table t1 (a int,b int,c int,key(a,b))
-partition by range (a)
-partitions 3
-(partition x1 values less than (0) tablespace ts1,
- partition x2 values less than (10) tablespace ts2,
- partition x3 values less than maxvalue tablespace ts3);
-
-insert into t1 values (NULL, 1, 1);
-insert into t1 values (0, 1, 1);
-insert into t1 values (12, 1, 1);
-
-select partition_name, partition_description, table_rows
-from information_schema.partitions where table_schema ='test';
-drop table t1;
-
-# NULL for LIST partition
---error ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR
-create table t1 (a int,b int, c int)
-partition by list(a)
-partitions 2
-(partition x123 values in (11,12),
- partition x234 values in (1 ,NULL, NULL));
-
---error ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR
-create table t1 (a int,b int, c int)
-partition by list(a)
-partitions 2
-(partition x123 values in (11, NULL),
- partition x234 values in (1 ,NULL));
-
-create table t1 (a int,b int, c int)
-partition by list(a)
-partitions 2
-(partition x123 values in (11, 12),
- partition x234 values in (5, 1));
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-insert into t1 values (NULL,1,1);
-drop table t1;
-
-create table t1 (a int,b int, c int)
-partition by list(a)
-partitions 2
-(partition x123 values in (11, 12),
- partition x234 values in (NULL, 1));
-
-insert into t1 values (11,1,6);
-insert into t1 values (NULL,1,1);
-
-select partition_name, partition_description, table_rows
-from information_schema.partitions where table_schema ='test';
-drop table t1;
-
-#
-# BUG 17947 Crash with REBUILD PARTITION
-#
-create table t1 (a int)
-partition by list (a)
-(partition p0 values in (1));
-
---error ER_PARSE_ERROR
-alter table t1 rebuild partition;
-
-drop table t1;
-
-#
-# BUG 15253 Insert that should fail doesn't
-#
-create table t1 (a int)
-partition by list (a)
-(partition p0 values in (5));
-
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-insert into t1 values (0);
-
-drop table t1;
-
-#
-# BUG #16370 Subpartitions names not shown in SHOW CREATE TABLE output
-#
-create table t1 (a int)
-partition by range (a) subpartition by hash (a)
-(partition p0 values less than (100));
-
-show create table t1;
-alter table t1 add partition (partition p1 values less than (200)
-(subpartition subpart21));
-
-show create table t1;
-
-drop table t1;
-
-create table t1 (a int)
-partition by key (a);
-
-show create table t1;
-alter table t1 add partition (partition p1);
-show create table t1;
-
-drop table t1;
-
-#
-# BUG 15407 Crash with subpartition
-#
---error ER_PARSE_ERROR
-create table t1 (a int, b int)
-partition by range (a)
-subpartition by hash(a)
-(partition p0 values less than (0) (subpartition sp0),
- partition p1 values less than (1));
-
---error ER_PARSE_ERROR
-create table t1 (a int, b int)
-partition by range (a)
-subpartition by hash(a)
-(partition p0 values less than (0),
- partition p1 values less than (1) (subpartition sp0));
-
-#
-# Bug 46354 Crash with subpartition
-#
---error ER_PARSE_ERROR
-create table t1 (a int, b int)
-partition by list (a)
-subpartition by hash(a)
-(partition p0 values in (0),
- partition p1 values in (1) (subpartition sp0));
-
-
-#
-# BUG 15961 No error when subpartition defined without subpartition by clause
-#
---error ER_SUBPARTITION_ERROR
-create table t1 (a int)
-partition by hash (a)
-(partition p0 (subpartition sp0));
-
-#
-# Bug 17127
-#
-create table t1 (a int)
-partition by range (a)
-(partition p0 values less than (1));
-
---error ER_PARTITION_WRONG_VALUES_ERROR
-alter table t1 add partition (partition p1 values in (2));
---error ER_PARTITION_REQUIRES_VALUES_ERROR
-alter table t1 add partition (partition p1);
-
-drop table t1;
-
-create table t1 (a int)
-partition by list (a)
-(partition p0 values in (1));
-
---error ER_PARTITION_WRONG_VALUES_ERROR
-alter table t1 add partition (partition p1 values less than (2));
---error ER_PARTITION_REQUIRES_VALUES_ERROR
-alter table t1 add partition (partition p1);
-
-drop table t1;
-
-create table t1 (a int)
-partition by hash (a)
-(partition p0);
-
---error ER_PARTITION_WRONG_VALUES_ERROR
-alter table t1 add partition (partition p1 values less than (2));
---error ER_PARTITION_WRONG_VALUES_ERROR
-alter table t1 add partition (partition p1 values in (2));
-
-drop table t1;
-
-#
-# BUG 17947 Crash with REBUILD PARTITION
-#
-create table t1 (a int)
-partition by list (a)
-(partition p0 values in (1));
-
---error ER_PARSE_ERROR
-alter table t1 rebuild partition;
-
-drop table t1;
-
-#
-# Bug #14526: Partitions: indexed searches fail
-#
-create table t2 (s1 int not null auto_increment, primary key (s1)) partition by list (s1) (partition p1 values in (1),partition p2 values in (2),partition p3 values in (3),partition p4 values in (4));
-insert into t2 values (null),(null),(null);
-select * from t2;
-select * from t2 where s1 < 2;
-update t2 set s1 = s1 + 1 order by s1 desc;
-select * from t2 where s1 < 3;
-select * from t2 where s1 = 2;
-drop table t2;
-
-#
-# Bug #17497: Partitions: crash if add partition on temporary table
-#
---error ER_PARTITION_NO_TEMPORARY
-create temporary table t1 (a int) partition by hash(a);
-
-#
-# Bug #17097: Partitions: failing ADD PRIMARY KEY leads to temporary rotten
-# metadata,crash
-#
-create table t1 (a int, b int) partition by list (a)
- (partition p1 values in (1), partition p2 values in (2));
---error ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF
-alter table t1 add primary key (b);
-show create table t1;
-drop table t1;
-
-############################################
-#
-# Author: Mikael Ronstrom
-# Date: 2006-03-01
-# Purpose
-# Bug 17772: Crash at ALTER TABLE with rename
-# and add column + comment on
-# partitioned table
-#
-############################################
-create table t1 (a int unsigned not null auto_increment primary key)
-partition by key(a);
-alter table t1 rename t2, add c char(10), comment "no comment";
-show create table t2;
-
-drop table t2;
-
-#
-# Bug#15336 Partitions: crash if create table as select
-#
-create table t1 (f1 int) partition by hash (f1) as select 1;
-drop table t1;
-
-#
-# bug #14350 Partitions: crash if prepared statement
-#
-prepare stmt1 from 'create table t1 (s1 int) partition by hash (s1)';
-execute stmt1;
---error ER_TABLE_EXISTS_ERROR
-execute stmt1;
-drop table t1;
-
-#
-# bug 17290 SP with delete, create and rollback to save point causes MySQLD core
-#
-delimiter |;
-eval CREATE PROCEDURE test.p1(IN i INT)
-BEGIN
- DECLARE CONTINUE HANDLER FOR sqlexception BEGIN END;
- DROP TABLE IF EXISTS t1;
- CREATE TABLE t1 (num INT,PRIMARY KEY(num));
- START TRANSACTION;
- INSERT INTO t1 VALUES(i);
- savepoint t1_save;
- INSERT INTO t1 VALUES (14);
- ROLLBACK to savepoint t1_save;
- COMMIT;
-END|
-delimiter ;|
-CALL test.p1(12);
-CALL test.p1(13);
-drop table t1;
-drop procedure test.p1;
-
-#
-# Bug 13520: Problem with delimiters in COMMENT DATA DIRECTORY ..
-#
-CREATE TABLE t1 (a int not null)
-partition by key(a)
-(partition p0 COMMENT='first partition');
-drop table t1;
-
-#
-# Bug 13433: Problem with delimited identifiers
-#
-CREATE TABLE t1 (`a b` int not null)
-partition by key(`a b`);
-drop table t1;
-
-CREATE TABLE t1 (`a b` int not null)
-partition by hash(`a b`);
-drop table t1;
-
-#
-# Bug#18053 Partitions: crash if null
-# Bug#18070 Partitions: wrong result on WHERE ... IS NULL
-#
-create table t1 (f1 integer) partition by range(f1)
-(partition p1 values less than (0), partition p2 values less than (10));
-insert into t1 set f1 = null;
-select * from t1 where f1 is null;
-explain partitions select * from t1 where f1 is null;
-drop table t1;
-
-create table t1 (f1 integer) partition by list(f1)
-(partition p1 values in (1), partition p2 values in (null));
-insert into t1 set f1 = null;
-insert into t1 set f1 = 1;
-select * from t1 where f1 is null or f1 = 1;
-drop table t1;
-
-create table t1 (f1 smallint)
-partition by list (f1) (partition p0 values in (null));
-insert into t1 values (null);
-select * from t1 where f1 is null;
-select * from t1 where f1 < 1;
-select * from t1 where f1 <= NULL;
-select * from t1 where f1 < NULL;
-select * from t1 where f1 >= NULL;
-select * from t1 where f1 > NULL;
-select * from t1 where f1 > 1;
-drop table t1;
-
-create table t1 (f1 smallint)
-partition by range (f1) (partition p0 values less than (0));
-insert into t1 values (null);
-select * from t1 where f1 is null;
-drop table t1;
-
-create table t1 (f1 integer) partition by list(f1)
-(
- partition p1 values in (1),
- partition p2 values in (NULL),
- partition p3 values in (2),
- partition p4 values in (3),
- partition p5 values in (4)
-);
-
-insert into t1 values (1),(2),(3),(4),(null);
-select * from t1 where f1 < 3;
-explain partitions select * from t1 where f1 < 3;
-select * from t1 where f1 is null;
-explain partitions select * from t1 where f1 is null;
-drop table t1;
-
-create table t1 (f1 int) partition by list(f1 div 2)
-(
- partition p1 values in (1),
- partition p2 values in (NULL),
- partition p3 values in (2),
- partition p4 values in (3),
- partition p5 values in (4)
-);
-
-insert into t1 values (2),(4),(6),(8),(null);
-select * from t1 where f1 < 3;
-explain partitions select * from t1 where f1 < 3;
-select * from t1 where f1 is null;
-explain partitions select * from t1 where f1 is null;
-drop table t1;
-
-create table t1 (a int) partition by LIST(a) (
- partition pn values in (NULL),
- partition p0 values in (0),
- partition p1 values in (1),
- partition p2 values in (2)
-);
-insert into t1 values (NULL),(0),(1),(2);
-select * from t1 where a is null or a < 2;
-explain partitions select * from t1 where a is null or a < 2;
-select * from t1 where a is null or a < 0 or a > 1;
-explain partitions select * from t1 where a is null or a < 0 or a > 1;
-drop table t1;
-
-#
-#Bug# 17631 SHOW TABLE STATUS reports wrong engine
-#
-CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, name VARCHAR(20))
-ENGINE=MyISAM DEFAULT CHARSET=latin1
-PARTITION BY RANGE(id)
-(PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM,
-PARTITION p1 VALUES LESS THAN (20) ENGINE = MyISAM,
-PARTITION p2 VALUES LESS THAN (30) ENGINE = MyISAM);
---replace_column 6 0 7 0 8 0 9 0 12 NULL 13 NULL 14 NULL
-SHOW TABLE STATUS;
-DROP TABLE t1;
-
-#
-#BUG 16002 Erroneus handling of unsigned partition functions
-#
---error ER_PARTITION_CONST_DOMAIN_ERROR
-create table t1 (a bigint unsigned)
-partition by list (a)
-(partition p0 values in (0-1));
-
-create table t1 (a bigint unsigned)
-partition by range (a)
-(partition p0 values less than (10));
-
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-insert into t1 values (0xFFFFFFFFFFFFFFFF);
-
-drop table t1;
-
-#
-#BUG 18750 Problems with partition names
-#
-create table t1 (a int)
-partition by list (a)
-(partition `s1 s2` values in (0));
-drop table t1;
-
-create table t1 (a int)
-partition by list (a)
-(partition `7` values in (0));
-drop table t1;
-
---error ER_WRONG_PARTITION_NAME
-create table t1 (a int)
-partition by list (a)
-(partition `s1 s2 ` values in (0));
-
---error ER_WRONG_PARTITION_NAME
-create table t1 (a int)
-partition by list (a)
-subpartition by hash (a)
-(partition p1 values in (0) (subpartition `p1 p2 `));
-
-#
-# BUG 18752 SHOW CREATE TABLE doesn't show NULL value in SHOW CREATE TABLE
-#
-CREATE TABLE t1 (a int)
-PARTITION BY LIST (a)
-(PARTITION p0 VALUES IN (NULL));
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
---error ER_NULL_IN_VALUES_LESS_THAN
-CREATE TABLE t1 (a int)
-PARTITION BY RANGE(a)
-(PARTITION p0 VALUES LESS THAN (NULL));
-
-#
-# Bug#18753 Partitions: auto_increment fails
-#
-create table t1 (s1 int auto_increment primary key)
-partition by list (s1)
-(partition p1 values in (1),
- partition p2 values in (2),
- partition p3 values in (3));
-insert into t1 values (null);
-insert into t1 values (null);
-insert into t1 values (null);
-select auto_increment from information_schema.tables where table_name='t1';
-select * from t1;
-drop table t1;
-
-#
-# BUG 19140 Partitions: Create index for partitioned table crashes
-#
-create table t1 (a int) engine=memory
-partition by key(a);
-insert into t1 values (1);
-create index inx1 on t1(a);
-drop table t1;
-
-#
-# Bug 19695 Partitions: SHOW CREATE TABLE shows table options even when it
-# shouldn't
-#
-create table t1 (a int)
-PARTITION BY KEY (a)
-(PARTITION p0);
-set session sql_mode='no_table_options';
-show create table t1;
-set session sql_mode='';
-drop table t1;
-
-#
-# BUG 19304 Partitions: MERGE handler not allowed in partitioned tables
-#
---error ER_PARTITION_MERGE_ERROR
-create table t1 (a int)
-partition by key (a)
-(partition p0 engine = MERGE);
-
-#
-# BUG 19062 Partition clause ignored if CREATE TABLE ... AS SELECT ...;
-#
-create table t1 (a varchar(1))
-partition by key (a)
-as select 'a';
-
-show create table t1;
-drop table t1;
-
-#
-# BUG 19501 Partitions: SHOW TABLE STATUS shows wrong Data_free
-#
-CREATE TABLE t1 (a int) ENGINE = MYISAM PARTITION BY KEY(a);
-INSERT into t1 values (1), (2);
---replace_column 9 0 12 NULL 13 NULL 14 NULL
-SHOW TABLE STATUS;
-DELETE from t1 where a = 1;
---replace_column 9 0 12 NULL 13 NULL 14 NULL
-SHOW TABLE STATUS;
-ALTER TABLE t1 OPTIMIZE PARTITION p0;
---replace_column 12 NULL 13 NULL 14 NULL
-SHOW TABLE STATUS;
-DROP TABLE t1;
-
-#
-# BUG 19502: ENABLE/DISABLE Keys don't work for partitioned tables
-#
-CREATE TABLE t1 (a int, index(a)) PARTITION BY KEY(a);
-ALTER TABLE t1 DISABLE KEYS;
-ALTER TABLE t1 ENABLE KEYS;
-DROP TABLE t1;
-
-#
-# Bug 17455 Partitions: Wrong message and error when using Repair/Optimize
-# table on partitioned table
-# (added check/analyze for gcov of Bug#20129)
-create table t1 (a int)
-engine=MEMORY
-partition by key (a);
-
-REPAIR TABLE t1;
-OPTIMIZE TABLE t1;
-CHECK TABLE t1;
-ANALYZE TABLE t1;
-
-drop table t1;
-
-#
-#BUG 17138 Problem with stored procedure and analyze partition
-#
---disable_warnings
-drop procedure if exists mysqltest_1;
---enable_warnings
-
-create table t1 (a int)
-partition by list (a)
-(partition p0 values in (0));
-
-insert into t1 values (0);
-delimiter //;
-
-create procedure mysqltest_1 ()
-begin
- begin
- declare continue handler for sqlexception begin end;
- update ignore t1 set a = 1 where a = 0;
- end;
- prepare stmt1 from 'alter table t1';
- execute stmt1;
-end//
-
-call mysqltest_1()//
-delimiter ;//
-drop table t1;
-drop procedure mysqltest_1;
-
-#
-# Bug 20583 Partitions: Crash using index_last
-#
-create table t1 (a int, index(a))
-partition by hash(a);
-insert into t1 values (1),(2);
-select * from t1 ORDER BY a DESC;
-drop table t1;
-
-#
-# Bug 21388: Bigint fails to find record
-#
-create table t1 (a bigint unsigned not null, primary key(a))
-engine = myisam
-partition by key (a)
-partitions 10;
-
-show create table t1;
-insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE),
-(18446744073709551613), (18446744073709551612);
-select * from t1;
-select * from t1 where a = 18446744073709551615;
-delete from t1 where a = 18446744073709551615;
-select * from t1;
-drop table t1;
-
-#
-# Bug 24502 reorganize partition closes connection
-#
-CREATE TABLE t1 (
- num int(11) NOT NULL, cs int(11) NOT NULL)
-PARTITION BY RANGE (num) SUBPARTITION BY HASH (
-cs) SUBPARTITIONS 2 (PARTITION p_X VALUES LESS THAN MAXVALUE);
-
-ALTER TABLE t1
-REORGANIZE PARTITION p_X INTO (
- PARTITION p_100 VALUES LESS THAN (100),
- PARTITION p_X VALUES LESS THAN MAXVALUE
- );
-
-drop table t1;
-
-#
-# Bug #24186 (nested query across partitions returns fewer records)
-#
-
-CREATE TABLE t2 (
- taken datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- id int(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (id,taken),
- KEY taken (taken)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-
-INSERT INTO t2 VALUES
-('2006-09-27 21:50:01',16421),
-('2006-10-02 21:50:01',16421),
-('2006-09-27 21:50:01',19092),
-('2006-09-28 21:50:01',19092),
-('2006-09-29 21:50:01',19092),
-('2006-09-30 21:50:01',19092),
-('2006-10-01 21:50:01',19092),
-('2006-10-02 21:50:01',19092),
-('2006-09-27 21:50:01',22589),
-('2006-09-29 21:50:01',22589);
-
-CREATE TABLE t1 (
- id int(8) NOT NULL,
- PRIMARY KEY (id)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-
-INSERT INTO t1 VALUES
-(16421),
-(19092),
-(22589);
-
-CREATE TABLE t4 (
- taken datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- id int(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (id,taken),
- KEY taken (taken)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
-PARTITION BY RANGE (to_days(taken))
-(
-PARTITION p01 VALUES LESS THAN (732920) ,
-PARTITION p02 VALUES LESS THAN (732950) ,
-PARTITION p03 VALUES LESS THAN MAXVALUE ) ;
-
-INSERT INTO t4 select * from t2;
-
-set @f_date='2006-09-28';
-set @t_date='2006-10-02';
-
-SELECT t1.id AS MyISAM_part
-FROM t1
-WHERE t1.id IN (
- SELECT distinct id
- FROM t4
- WHERE taken BETWEEN @f_date AND date_add(@t_date, INTERVAL 1 DAY))
-ORDER BY t1.id;
-
-drop table t1, t2, t4;
-
-CREATE TABLE t1 (
- taken datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- id int(11) NOT NULL DEFAULT '0',
- status varchar(20) NOT NULL DEFAULT '',
- PRIMARY KEY (id,taken)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
-PARTITION BY RANGE (to_days(taken))
-(
-PARTITION p15 VALUES LESS THAN (732950) ,
-PARTITION p16 VALUES LESS THAN MAXVALUE ) ;
-
-
-INSERT INTO t1 VALUES
-('2006-09-27 21:50:01',22589,'Open'),
-('2006-09-29 21:50:01',22589,'Verified');
-
-DROP TABLE IF EXISTS t2;
-CREATE TABLE t2 (
- id int(8) NOT NULL,
- severity tinyint(4) NOT NULL DEFAULT '0',
- priority tinyint(4) NOT NULL DEFAULT '0',
- status varchar(20) DEFAULT NULL,
- alien tinyint(4) NOT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-
-INSERT INTO t2 VALUES
-(22589,1,1,'Need Feedback',0);
-
-SELECT t2.id FROM t2 WHERE t2.id IN (SELECT id FROM t1 WHERE status = 'Verified');
-
-drop table t1, t2;
-
-#
-# Bug #27123 partition + on duplicate key update + varchar = Can't find record in <table>
-#
-create table t1 (c1 varchar(255),c2 tinyint,primary key(c1))
- partition by key (c1) partitions 10 ;
-insert into t1 values ('aaa','1') on duplicate key update c2 = c2 + 1;
-insert into t1 values ('aaa','1') on duplicate key update c2 = c2 + 1;
-select * from t1;
-drop table t1;
-
-#
-# Bug #28005 Partitions: can't use -9223372036854775808
-#
-
-create table t1 (s1 bigint) partition by list (s1) (partition p1 values in (-9223372036854775808));
-drop table t1;
-
-#
-# Bug #28806: Running SHOW TABLE STATUS during high INSERT load crashes server
-#
-create table t1(a int auto_increment, b int, primary key (b, a))
- partition by hash(b) partitions 2;
-insert into t1 values (null, 1);
---replace_column 9 0 12 NULL 13 NULL 14 NULL
-show table status;
-drop table t1;
-
-create table t1(a int auto_increment primary key)
- partition by key(a) partitions 2;
-insert into t1 values (null), (null), (null);
---replace_column 9 0 12 NULL 13 NULL 14 NULL
-show table status;
-drop table t1;
-# Bug #28488: Incorrect information in file: './test/t1_test#.frm'
-#
-
-CREATE TABLE t1(a INT NOT NULL, b TINYBLOB, KEY(a))
- PARTITION BY RANGE(a) ( PARTITION p0 VALUES LESS THAN (32));
-INSERT INTO t1 VALUES (1, REPEAT('a', 10));
-INSERT INTO t1 SELECT a + 1, b FROM t1;
-INSERT INTO t1 SELECT a + 2, b FROM t1;
-INSERT INTO t1 SELECT a + 4, b FROM t1;
-INSERT INTO t1 SELECT a + 8, b FROM t1;
-
-ALTER TABLE t1 ADD PARTITION (PARTITION p1 VALUES LESS THAN (64));
-ALTER TABLE t1 DROP PARTITION p1;
-
-DROP TABLE t1;
-
-#
-# Bug #30484: Partitions: crash with self-referencing trigger
-#
-
-create table t (s1 int) engine=myisam partition by key (s1);
-create trigger t_ad after delete on t for each row insert into t values (old.s1);
-insert into t values (1);
-drop table t;
-
-#
-# Bug #27084 partitioning by list seems failing when using case
-# BUG #18198: Case no longer supported, test case removed
-#
-
-create table t2 (b int);
---error ER_BAD_FIELD_ERROR
-create table t1 (b int)
-PARTITION BY RANGE (t2.b) (
- PARTITION p1 VALUES LESS THAN (10),
- PARTITION p2 VALUES LESS THAN (20)
-) select * from t2;
-create table t1 (a int)
-PARTITION BY RANGE (b) (
- PARTITION p1 VALUES LESS THAN (10),
- PARTITION p2 VALUES LESS THAN (20)
-) select * from t2;
-show create table t1;
-drop table t1, t2;
-
-#
-# Bug #32067 Partitions: crash with timestamp column
-# this bug occurs randomly on some UPDATE statement
-# with the '1032: Can't find record in 't1'' error
-
-create table t1
- (s1 timestamp on update current_timestamp, s2 int)
- partition by key(s1) partitions 3;
-
-insert into t1 values (null,null);
---disable_query_log
-begin;
-let $cnt= 1000;
-while ($cnt)
-{
- update t1 set s2 = 1;
- update t1 set s2 = 2;
- dec $cnt;
-}
-commit;
---enable_query_log
-
-drop table t1;
-
-#
-# BUG#32772: partition crash 1: enum column
-#
-# Note that month(int_col) is disallowed after bug#54483.
-create table t1 (
- c0 int,
- c1 bigint,
- c2 set('sweet'),
- key (c2,c1,c0),
- key(c0)
-) engine=myisam partition by hash (c0) partitions 5;
-
---disable_warnings
-insert ignore into t1 set c0 = -6502262, c1 = 3992917, c2 = 35019;
-insert ignore into t1 set c0 = 241221, c1 = -6862346, c2 = 56644;
---enable_warnings
-# This must not fail assert:
-select c1 from t1 group by (select c0 from t1 limit 1);
-drop table t1;
-
-# Bug #30495: optimize table t1,t2,t3 extended errors
-# (added more maintenace commands for Bug#20129
-CREATE TABLE t1(a int)
-PARTITION BY RANGE (a) (
- PARTITION p1 VALUES LESS THAN (10),
- PARTITION p2 VALUES LESS THAN (20)
-);
---error ER_PARSE_ERROR
-ALTER TABLE t1 OPTIMIZE PARTITION p1 EXTENDED;
---error ER_PARSE_ERROR
-ALTER TABLE t1 ANALYZE PARTITION p1 EXTENDED;
-ALTER TABLE t1 ANALYZE PARTITION p1;
-ALTER TABLE t1 CHECK PARTITION p1;
-ALTER TABLE t1 REPAIR PARTITION p1;
-ALTER TABLE t1 OPTIMIZE PARTITION p1;
-DROP TABLE t1;
-
-#
-# Bug #29258: Partitions: search fails for maximum unsigned bigint
-#
-CREATE TABLE t1 (s1 BIGINT UNSIGNED)
- PARTITION BY RANGE (s1) (
- PARTITION p0 VALUES LESS THAN (0),
- PARTITION p1 VALUES LESS THAN (1),
- PARTITION p2 VALUES LESS THAN (18446744073709551615)
-);
-INSERT INTO t1 VALUES (0), (18446744073709551614);
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-INSERT INTO t1 VALUES (18446744073709551615);
-DROP TABLE t1;
-
-CREATE TABLE t1 (s1 BIGINT UNSIGNED)
- PARTITION BY RANGE (s1) (
- PARTITION p0 VALUES LESS THAN (0),
- PARTITION p1 VALUES LESS THAN (1),
- PARTITION p2 VALUES LESS THAN (18446744073709551614),
- PARTITION p3 VALUES LESS THAN MAXVALUE
-);
-INSERT INTO t1 VALUES (-1), (0), (18446744073709551613),
- (18446744073709551614), (18446744073709551615);
-SELECT * FROM t1;
-SELECT * FROM t1 WHERE s1 = 0;
-SELECT * FROM t1 WHERE s1 = 18446744073709551614;
-SELECT * FROM t1 WHERE s1 = 18446744073709551615;
-DROP TABLE t1;
-
-CREATE TABLE t1 (s1 BIGINT UNSIGNED)
- PARTITION BY RANGE (s1) (
- PARTITION p0 VALUES LESS THAN (0),
- PARTITION p1 VALUES LESS THAN (1),
- PARTITION p2 VALUES LESS THAN (18446744073709551615),
- PARTITION p3 VALUES LESS THAN MAXVALUE
-);
-DROP TABLE t1;
-
-#
-# Bug #31890 Partitions: ORDER BY DESC in InnoDB not working
-#
-
-CREATE TABLE t1
-(int_column INT, char_column CHAR(5),
-PRIMARY KEY(char_column,int_column))
-PARTITION BY KEY(char_column,int_column)
-PARTITIONS 101;
-INSERT INTO t1 (int_column, char_column) VALUES
-( 39868 ,'zZZRW'),
-( 545592 ,'zZzSD'),
-( 4936 ,'zzzsT'),
-( 9274 ,'ZzZSX'),
-( 970185 ,'ZZzTN'),
-( 786036 ,'zZzTO'),
-( 37240 ,'zZzTv'),
-( 313801 ,'zzzUM'),
-( 782427 ,'ZZZva'),
-( 907955 ,'zZZvP'),
-( 453491 ,'zzZWV'),
-( 756594 ,'ZZZXU'),
-( 718061 ,'ZZzZH');
-SELECT * FROM t1 ORDER BY char_column DESC;
-DROP TABLE t1;
-
-#
-# Bug #32247 Test reports wrong value of "AUTO_INCREMENT" (on a partitioned InnoDB table)
-#
-
-CREATE TABLE t1(id MEDIUMINT NOT NULL AUTO_INCREMENT,
- user CHAR(25), PRIMARY KEY(id))
- PARTITION BY RANGE(id)
- SUBPARTITION BY hash(id) subpartitions 2
- (PARTITION pa1 values less than (10),
- PARTITION pa2 values less than (20),
- PARTITION pa11 values less than MAXVALUE);
---disable_query_log
-let $n= 15;
-begin;
-while ($n)
-{
- insert into t1 (user) values ('mysql');
- dec $n;
-}
-commit;
---enable_query_log
-show create table t1;
-drop table t1;
-
-#
-# Bug #38272 timestamps fields incorrectly defaulted on update accross partitions.
-#
-
-CREATE TABLE t1 (
- `ID` bigint(20) NOT NULL AUTO_INCREMENT,
- `createdDate` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `number` int,
- PRIMARY KEY (`ID`, number)
-)
-PARTITION BY RANGE (number) (
- PARTITION p0 VALUES LESS THAN (6),
- PARTITION p1 VALUES LESS THAN (11)
-);
-
-create table t2 (
- `ID` bigint(20),
- `createdDate` TIMESTAMP,
- `number` int
-);
-
-INSERT INTO t1 SET number=1;
-insert into t2 select * from t1;
-SELECT SLEEP(1);
-UPDATE t1 SET number=6;
-select count(*) from t1, t2 where t1.createdDate = t2.createdDate;
-
-drop table t1, t2;
-
-#
-# Bug #38083 Error-causing row inserted into partitioned table despite error
-#
-SET @orig_sql_mode = @@SQL_MODE;
-SET SQL_MODE='STRICT_ALL_TABLES,ERROR_FOR_DIVISION_BY_ZERO';
-CREATE TABLE t1 (c1 INT)
- PARTITION BY LIST(1 DIV c1) (
- PARTITION p0 VALUES IN (NULL),
- PARTITION p1 VALUES IN (1)
- );
-
--- error ER_DIVISION_BY_ZERO
-INSERT INTO t1 VALUES (0);
-SELECT * FROM t1;
-TRUNCATE t1;
--- error ER_DIVISION_BY_ZERO
-INSERT INTO t1 VALUES (NULL), (0), (1), (2);
-SELECT * FROM t1;
-DROP TABLE t1;
-SET SQL_MODE= @orig_sql_mode;
-
-
-
-#
-# Bug #38005 Partitions: error with insert select
-#
-
-create table t1 (s1 int) partition by hash(s1) partitions 2;
-create index i on t1 (s1);
-insert into t1 values (1);
-insert into t1 select s1 from t1;
-insert into t1 select s1 from t1;
-insert into t1 select s1 from t1 order by s1 desc;
-select * from t1;
-drop table t1;
-
-create table t1 (s1 int) partition by range(s1)
- (partition pa1 values less than (10),
- partition pa2 values less than MAXVALUE);
-create index i on t1 (s1);
-insert into t1 values (1);
-insert into t1 select s1 from t1;
-insert into t1 select s1 from t1;
-insert into t1 select s1 from t1 order by s1 desc;
-select * from t1;
-drop table t1;
-
-create table t1 (s1 int) partition by range(s1)
- (partition pa1 values less than (10),
- partition pa2 values less than MAXVALUE);
-create index i on t1 (s1);
-insert into t1 values (20);
-insert into t1 select s1 from t1;
-insert into t1 select s1 from t1;
-insert into t1 select s1 from t1 order by s1 desc;
-select * from t1;
-drop table t1;
-
-create table t1 (s1 int) partition by range(s1)
- (partition pa1 values less than (10),
- partition pa2 values less than MAXVALUE);
-create index i on t1 (s1);
-insert into t1 values (1), (2), (3), (4), (5), (6), (7), (8);
-insert into t1 select s1 from t1;
-insert into t1 select s1 from t1;
-insert into t1 select s1 from t1;
-insert into t1 select s1 from t1;
-insert into t1 select s1 from t1 order by s1 desc;
-insert into t1 select s1 from t1 where s1=3;
-select count(*) from t1;
-drop table t1;
-
-
---echo #
---echo # Bug#42944: partition not pruned correctly
---echo #
-CREATE TABLE t1 (a int) PARTITION BY RANGE (a)
- (PARTITION p0 VALUES LESS THAN (100),
- PARTITION p1 VALUES LESS THAN (200),
- PARTITION p2 VALUES LESS THAN (300),
- PARTITION p3 VALUES LESS THAN MAXVALUE);
-INSERT INTO t1 VALUES (10), (100), (200), (300), (400);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a>=200;
-DROP TABLE t1;
-
-#
-# Bug#44821: select distinct on partitioned table returns wrong results
-#
-CREATE TABLE t1 ( a INT, b INT, c INT, KEY bc(b, c) )
-PARTITION BY KEY (a, b) PARTITIONS 3
-;
-
-INSERT INTO t1 VALUES
-(17, 1, -8),
-(3, 1, -7),
-(23, 1, -6),
-(22, 1, -5),
-(11, 1, -4),
-(21, 1, -3),
-(19, 1, -2),
-(30, 1, -1),
-
-(20, 1, 1),
-(16, 1, 2),
-(18, 1, 3),
-(9, 1, 4),
-(15, 1, 5),
-(28, 1, 6),
-(29, 1, 7),
-(25, 1, 8),
-(10, 1, 9),
-(13, 1, 10),
-(27, 1, 11),
-(24, 1, 12),
-(12, 1, 13),
-(26, 1, 14),
-(14, 1, 15)
-;
-
-SELECT b, c FROM t1 WHERE b = 1 GROUP BY b, c;
-
-EXPLAIN
-SELECT b, c FROM t1 WHERE b = 1 GROUP BY b, c;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug #45807: crash accessing partitioned table and sql_mode
---echo # contains ONLY_FULL_GROUP_BY
---echo # Bug#46923: select count(*) from partitioned table fails with
---echo # ONLY_FULL_GROUP_BY
---echo #
-
-SET SESSION SQL_MODE='ONLY_FULL_GROUP_BY';
-CREATE TABLE t1(id INT,KEY(id)) ENGINE=MYISAM
- PARTITION BY HASH(id) PARTITIONS 2;
-SELECT COUNT(*) FROM t1;
-DROP TABLE t1;
-SET SESSION SQL_MODE=DEFAULT;
-
-# This testcase is commented due to the Bug #46853
-# Should be uncommented after fixing Bug #46853
-#--echo #
-#--echo # BUG#45816 - assertion failure with index containing double
-#--echo # column on partitioned table
-#--echo #
-#
-#CREATE TABLE t1 (
-# a INT DEFAULT NULL,
-# b DOUBLE DEFAULT NULL,
-# c INT DEFAULT NULL,
-# KEY idx2(b,a)
-#) PARTITION BY HASH(c) PARTITIONS 3;
-#
-#INSERT INTO t1 VALUES (6,8,9);
-#INSERT INTO t1 VALUES (6,8,10);
-#
-#SELECT 1 FROM t1 JOIN t1 AS t2 USING (a) FOR UPDATE;
-#
-#DROP TABLE t1;
-
---echo #
---echo # Bug#46198: Hang after failed ALTER TABLE on partitioned table.
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-#
-# Case 1.
-#
-
-CREATE TABLE t1 (s1 INT PRIMARY KEY) PARTITION BY HASH(s1);
-
-LOCK TABLES t1 WRITE, t1 b READ;
-
-UNLOCK TABLES;
-
---error ER_ONLY_ON_RANGE_LIST_PARTITION
-ALTER TABLE t1 DROP PARTITION p1;
-
-# The SELECT below used to hang in tdc_wait_for_old_versions().
-SELECT * FROM t1;
-
-DROP TABLE t1;
-
-#
-# Case 2.
-#
-
-CREATE TABLE t1 (s1 VARCHAR(5) PRIMARY KEY) PARTITION BY KEY(s1);
-
-LOCK TABLES t1 WRITE, t1 b READ;
-
-UNLOCK TABLES;
-
---error ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF
-ALTER TABLE t1 ADD COLUMN (s3 VARCHAR(5) UNIQUE);
-
-# The SELECT below used to hang in tdc_wait_for_old_versions().
-SELECT * FROM t1;
-
-DROP TABLE t1;
-
---echo #
---echo # BUG#51868 - crash with myisam_use_mmap and partitioned myisam tables
---echo #
-SET GLOBAL myisam_use_mmap=1;
-CREATE TABLE t1(a INT) PARTITION BY HASH(a) PARTITIONS 1;
-INSERT INTO t1 VALUES(0);
-FLUSH TABLE t1;
-TRUNCATE TABLE t1;
-INSERT INTO t1 VALUES(0);
-DROP TABLE t1;
-SET GLOBAL myisam_use_mmap=default;
-
---echo #
---echo # Bug#13580775 ASSERTION FAILED: RECORD_LENGTH == M_RECORD_LENGTH,
---echo # FILE FILESORT_UTILS.CC
---echo #
-
-CREATE TABLE t1 (
- a INT PRIMARY KEY,
- b INT,
- c CHAR(1),
- d INT,
- KEY (c,d)
-) PARTITION BY KEY () PARTITIONS 1;
-
-INSERT INTO t1 VALUES (1,1,'a',1), (2,2,'a',1);
-
-SELECT 1 FROM t1 WHERE 1 IN
-(SELECT group_concat(b)
- FROM t1
- WHERE c > geomfromtext('point(1 1)')
- GROUP BY b
-);
-
-DROP TABLE t1;
-
---echo #
---echo # Bug#13011410 CRASH IN FILESORT CODE WITH GROUP BY/ROLLUP
---echo #
-
-CREATE TABLE t1 (
- a INT,
- b MEDIUMINT,
- c VARCHAR(300) CHARACTER SET hp8 COLLATE hp8_bin,
- PRIMARY KEY (a,c(299)))
-ENGINE=myisam
-PARTITION BY LINEAR KEY () PARTITIONS 2;
-
-INSERT INTO t1 VALUES (1,2,'test'), (2,3,'hi'), (4,5,'bye');
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT 1 FROM t1 WHERE b < SOME
-( SELECT 1 FROM t1 WHERE a >= 1
- GROUP BY b WITH ROLLUP
- HAVING b > geomfromtext("")
-);
-
-DROP TABLE t1;
-
---echo
---echo MDEV-612 Valgrind error in ha_maria::check_if_incompatible_data
---echo
-
-CREATE TABLE t1 (a INT, b INT, KEY(a)) ENGINE=Aria PARTITION BY KEY(a) PARTITIONS 2;
-ALTER TABLE t1 ADD KEY (b);
-drop table t1;
-
---echo End of 5.1 tests
-
---echo #
---echo # BUG#55385: UPDATE statement throws an error, but still updates
---echo # the table entries
-
-CREATE TABLE t1_part (
- partkey int,
- nokey int
-) PARTITION BY LINEAR HASH(partkey) PARTITIONS 3;
-
-INSERT INTO t1_part VALUES (1, 1) , (10, 10);
-CREATE VIEW v1 AS SELECT * FROM t1_part;
-
---echo
---echo # Should be (1,1),(10,10)
-SELECT * FROM t1_part;
-
---echo
---echo # Case 1
---echo # Update is refused because partitioning key is updated
---error ER_MULTI_UPDATE_KEY_CONFLICT
-UPDATE t1_part AS A NATURAL JOIN t1_part B SET A.partkey = 2, B.nokey = 3;
---error ER_MULTI_UPDATE_KEY_CONFLICT
-UPDATE t1_part AS A NATURAL JOIN t1_part B SET A.nokey = 2, B.partkey = 3;
-
---echo
---echo # Case 2
---echo # Like 1, but partition accessed through a view
---error ER_MULTI_UPDATE_KEY_CONFLICT
-UPDATE t1_part AS A NATURAL JOIN v1 as B SET A.nokey = 2 , B.partkey = 3;
---error ER_MULTI_UPDATE_KEY_CONFLICT
-UPDATE v1 AS A NATURAL JOIN t1_part as B SET A.nokey = 2 , B.partkey = 3;
-
---echo
---echo # Should be (1,1),(10,10)
-SELECT * FROM t1_part;
-
---echo
---echo # Case 3
---echo # Update is accepted because partitioning key is not updated
-UPDATE t1_part AS A NATURAL JOIN t1_part B SET A.nokey = 2 , B.nokey = 3;
-
---echo
---echo # Should be (1,3),(10,3)
-SELECT * FROM t1_part;
-
---echo
-# Cleanup
-DROP VIEW v1;
-DROP TABLE t1_part;
-
---echo #
---echo # BUG#598247: partition.test produces valgrind errors in 5.3-based branches
---echo #
-CREATE TABLE t1 (
- a INT DEFAULT NULL,
- b DOUBLE DEFAULT NULL,
- c INT DEFAULT NULL,
- KEY idx2(b,a)
-) engine=myisam PARTITION BY HASH(c) PARTITIONS 3;
-
-INSERT INTO t1 VALUES (6,8,9);
-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;
-
---echo #
---echo # MDEV-365 "Got assertion when doing alter table on a partition"
---echo #
-
-CREATE TABLE t1 ( i INT ) ENGINE=Aria PARTITION BY HASH(i) PARTITIONS 2;
-INSERT INTO t1 VALUES (1),(2),(2),(3),(4);
-ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
-SELECT * from t1 order by i;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-5555: Incorrect index_merge on BTREE indices
---echo #
-
-CREATE TABLE t1 (
- id bigint(20) unsigned NOT NULL,
- id2 bigint(20) unsigned NOT NULL,
- dob date DEFAULT NULL,
- address char(100) DEFAULT NULL,
- city char(35) DEFAULT NULL,
- hours_worked_per_week smallint(5) unsigned DEFAULT NULL,
- weeks_worked_last_year tinyint(3) unsigned DEFAULT NULL,
- KEY dob (dob),
- KEY address (address),
- KEY city (city),
- KEY hours_worked_per_week (hours_worked_per_week),
- KEY weeks_worked_last_year (weeks_worked_last_year)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
-PARTITION BY KEY (id) PARTITIONS 5;
-
---echo # Insert some rows
---disable_query_log
-INSERT INTO t1 VALUES (123,123,'2001-04-14','address123','city123',40,51),
-(127,127,'1977-03-30','address127','city127',0,0),
-(131,131,'1985-07-29','address131','city131',50,52),
-(135,135,'1997-01-20','address135','city135',0,0),
-(139,139,'1963-04-27','address139','city139',27,52),
-(143,143,'1979-01-28','address143','city143',40,52),
-(147,147,'1985-08-28','address147','city147',0,0),
-(151,151,'1997-01-24','address151','city151',40,52),
-(156,156,'1975-02-19','address156','city156',46,52),
-(158,158,'1996-07-06','address158','city158',46,8),
-(164,164,'1925-12-30','address164','city164',0,0),
-(166,166,'2010-12-30','address166','city166',0,0),
-(172,172,'1996-08-15','address172','city172',0,0),
-(174,174,'2008-05-20','address174','city174',40,52),
-(180,180,'1969-09-05','address180','city180',25,52),
-(182,182,'1977-08-11','address182','city182',40,8),
-(188,188,'2012-03-29','address188','city188',0,0),
-(190,190,'1978-02-19','address190','city190',0,0),
-(215,215,'1982-02-07','address215','city215',40,36),
-(223,223,'2005-02-11','address223','city223',55,52),
-(247,247,'2005-07-02','address247','city247',30,51),
-(255,255,'1997-08-15','address255','city255',0,0),
-(2,2,'1973-05-05','address2','city2',25,52),
-(4,4,'2012-07-21','address4','city4',40,12),
-(6,6,'1982-07-15','address6','city6',0,0),
-(8,8,'1979-02-16','address8','city8',0,0),
-(10,10,'1955-10-06','address10','city10',60,52),
-(12,12,'1977-08-09','address12','city12',40,52),
-(14,14,'2005-03-28','address14','city14',0,0),
-(16,16,'1949-11-07','address16','city16',40,52),
-(18,18,'2012-01-04','address18','city18',0,0),
-(20,20,'2011-01-23','address20','city20',0,0),
-(22,22,'1954-10-14','address22','city22',20,52),
-(24,24,'2010-01-22','address24','city24',0,0),
-(26,26,'1999-08-15','address26','city26',0,0),
-(28,28,'1964-07-05','address28','city28',10,20),
-(30,30,'2004-10-13','address30','city30',0,0),
-(32,32,'2007-06-08','address32','city32',0,0),
-(34,34,'1977-02-23','address34','city34',40,52),
-(36,36,'2007-06-11','address36','city36',75,52),
-(38,38,'1932-04-12','address38','city38',0,0),
-(40,40,'1968-11-16','address40','city40',0,0),
-(42,42,'1996-10-01','address42','city42',38,52),
-(44,44,'1977-08-23','address44','city44',18,6),
-(46,46,'1978-11-23','address46','city46',0,0),
-(48,48,'1998-02-27','address48','city48',0,0),
-(50,50,'1923-09-08','address50','city50',40,52),
-(52,52,'1964-09-09','address52','city52',0,0),
-(55,55,'2001-01-27','address55','city55',40,40),
-(56,56,'1938-08-28','address56','city56',48,52),
-(59,59,'1967-12-19','address59','city59',40,52),
-(60,60,'1969-06-30','address60','city60',40,46),
-(63,63,'2002-04-05','address63','city63',0,0),
-(64,64,'1972-11-21','address64','city64',48,52),
-(67,67,'1988-04-04','address67','city67',0,0),
-(68,68,'1964-07-14','address68','city68',4,16),
-(71,71,'1998-03-09','address71','city71',0,0),
-(72,72,'1960-10-28','address72','city72',35,52),
-(75,75,'1968-04-14','address75','city75',40,52),
-(76,76,'1977-05-13','address76','city76',0,0),
-(79,79,'1982-12-19','address79','city79',0,0),
-(80,80,'1966-01-07','address80','city80',15,12),
-(83,83,'1947-02-09','address83','city83',10,18),
-(84,84,'1976-06-23','address84','city84',40,52),
-(87,87,'2000-10-24','address87','city87',25,4),
-(88,88,'2002-05-23','address88','city88',20,52),
-(91,91,'2000-11-28','address91','city91',60,52),
-(92,92,'1965-07-17','address92','city92',40,52),
-(95,95,'1977-09-16','address95','city95',30,52),
-(96,96,'1994-09-26','address96','city96',0,0),
-(99,99,'2008-02-19','address99','city99',0,0),
-(100,100,'1953-01-07','address100','city100',0,0),
-(103,103,'2010-12-29','address103','city103',0,0),
-(104,104,'1990-12-03','address104','city104',40,52),
-(107,107,'2003-10-27','address107','city107',0,0),
-(108,108,'1998-03-05','address108','city108',40,17),
-(111,111,'2002-10-18','address111','city111',0,0),
-(112,112,'1960-04-02','address112','city112',0,0),
-(115,115,'1989-05-28','address115','city115',40,52),
-(116,116,'1985-10-25','address116','city116',15,52),
-(119,119,'1974-04-15','address119','city119',0,0),
-(120,120,'1926-03-21','address120','city120',0,0),
-(157,157,'1972-03-23','address157','city157',0,0),
-(159,159,'2002-11-08','address159','city159',0,0),
-(165,165,'1998-07-10','address165','city165',0,0),
-(167,167,'1973-11-16','address167','city167',0,0),
-(173,173,'1966-06-26','address173','city173',0,0),
-(175,175,'1957-02-02','address175','city175',0,0),
-(181,181,'1964-11-16','address181','city181',45,26),
-(183,183,'1943-12-02','address183','city183',0,0),
-(189,189,'1986-06-30','address189','city189',0,0),
-(191,191,'2005-05-14','address191','city191',0,0),
-(196,196,'1961-03-23','address196','city196',0,0),
-(197,197,'1955-07-13','address197','city197',0,0),
-(198,198,'2006-11-26','address198','city198',0,0),
-(199,199,'1978-02-06','address199','city199',0,0),
-(208,208,'2012-04-13','address208','city208',48,52),
-(210,210,'1989-08-18','address210','city210',0,0),
-(211,211,'1982-08-17','address211','city211',40,52),
-(212,212,'1919-08-29','address212','city212',0,0),
-(213,213,'1987-03-25','address213','city213',0,0),
-(228,228,'1988-05-05','address228','city228',40,52),
-(229,229,'1936-10-15','address229','city229',0,0),
-(230,230,'1973-08-19','address230','city230',40,52),
-(231,231,'2002-06-18','address231','city231',50,52),
-(240,240,'2011-10-17','address240','city240',60,52),
-(242,242,'1981-07-24','address242','city242',0,0),
-(243,243,'1978-10-12','address243','city243',0,0),
-(244,244,'2003-01-15','address244','city244',0,0),
-(245,245,'1950-09-26','address245','city245',0,0),
-(125,125,'1939-08-02','address125','city125',28,32),
-(126,126,'1984-02-10','address126','city126',0,0),
-(129,129,'1992-01-20','address129','city129',0,0),
-(130,130,'1992-09-18','address130','city130',0,0),
-(133,133,'1996-05-07','address133','city133',24,20),
-(134,134,'1987-07-13','address134','city134',0,0),
-(137,137,'2004-03-10','address137','city137',0,0),
-(138,138,'1989-02-10','address138','city138',0,0),
-(141,141,'1970-03-21','address141','city141',0,0),
-(142,142,'1984-05-25','address142','city142',40,50),
-(145,145,'1959-05-24','address145','city145',0,0),
-(146,146,'1946-07-28','address146','city146',35,16),
-(149,149,'1993-09-16','address149','city149',0,0),
-(150,150,'1975-12-18','address150','city150',0,0),
-(153,153,'1993-12-20','address153','city153',0,0),
-(155,155,'1934-10-29','address155','city155',0,0),
-(161,161,'1969-11-04','address161','city161',50,50),
-(163,163,'1976-05-03','address163','city163',40,52),
-(169,169,'1982-12-19','address169','city169',0,0),
-(171,171,'1976-07-01','address171','city171',0,0),
-(177,177,'2002-11-16','address177','city177',0,0),
-(179,179,'1964-02-05','address179','city179',40,32),
-(185,185,'1981-02-06','address185','city185',0,0),
-(187,187,'1962-06-04','address187','city187',40,52),
-(216,216,'1996-05-21','address216','city216',48,52),
-(248,248,'1963-09-06','address248','city248',0,0),
-(256,256,'1966-07-14','address256','city256',0,0),
-(53,53,'1992-05-25','address53','city53',0,0),
-(57,57,'2003-11-12','address57','city57',25,20),
-(61,61,'1953-01-29','address61','city61',0,0),
-(65,65,'1975-05-02','address65','city65',10,10),
-(69,69,'1938-03-20','address69','city69',0,0),
-(73,73,'1969-05-05','address73','city73',0,0),
-(77,77,'1996-05-19','address77','city77',0,0),
-(81,81,'1985-06-22','address81','city81',0,0),
-(85,85,'2002-10-10','address85','city85',0,0),
-(89,89,'1958-06-16','address89','city89',0,0),
-(93,93,'1962-06-16','address93','city93',0,0),
-(97,97,'1964-10-08','address97','city97',0,0),
-(101,101,'1986-06-11','address101','city101',40,52),
-(105,105,'1999-05-14','address105','city105',40,45),
-(109,109,'2000-05-23','address109','city109',0,0),
-(113,113,'1960-08-03','address113','city113',8,15),
-(117,117,'1982-02-15','address117','city117',50,36),
-(121,121,'1998-10-18','address121','city121',24,52),
-(192,192,'1964-07-24','address192','city192',40,52),
-(193,193,'1973-05-03','address193','city193',0,0),
-(194,194,'1980-01-14','address194','city194',40,52),
-(195,195,'1975-07-15','address195','city195',45,52),
-(200,200,'2006-03-09','address200','city200',0,0),
-(201,201,'2008-05-20','address201','city201',3,28),
-(202,202,'2000-06-30','address202','city202',12,52),
-(203,203,'1992-07-08','address203','city203',50,52),
-(204,204,'1988-07-05','address204','city204',14,40),
-(205,205,'1950-10-29','address205','city205',0,0),
-(206,206,'1962-11-25','address206','city206',0,0),
-(207,207,'1946-06-03','address207','city207',0,0),
-(214,214,'1973-12-14','address214','city214',0,0),
-(217,217,'1945-11-06','address217','city217',40,36),
-(218,218,'2007-07-20','address218','city218',0,0),
-(219,219,'1979-10-05','address219','city219',0,0),
-(220,220,'1992-06-20','address220','city220',10,12),
-(221,221,'2007-03-26','address221','city221',50,52),
-(222,222,'1989-12-24','address222','city222',0,0),
-(224,224,'1975-07-14','address224','city224',0,0),
-(225,225,'1976-02-23','address225','city225',20,52),
-(226,226,'1974-06-22','address226','city226',0,0),
-(227,227,'2004-01-16','address227','city227',0,0),
-(232,232,'1958-01-01','address232','city232',0,0),
-(233,233,'1966-08-03','address233','city233',40,32),
-(234,234,'1975-10-22','address234','city234',40,52),
-(235,235,'1983-10-25','address235','city235',0,0),
-(236,236,'1974-03-07','address236','city236',0,0),
-(237,237,'1965-12-31','address237','city237',45,20),
-(238,238,'1971-10-16','address238','city238',0,0),
-(239,239,'1989-07-19','address239','city239',0,0),
-(246,246,'1960-07-08','address246','city246',0,0),
-(249,249,'1943-07-01','address249','city249',40,30),
-(250,250,'1983-10-15','address250','city250',30,52),
-(251,251,'1979-07-03','address251','city251',0,0),
-(252,252,'1985-10-04','address252','city252',15,4),
-(253,253,'1966-10-24','address253','city253',0,0),
-(254,254,'1956-02-02','address254','city254',0,0),
-(1,1,'2003-11-23','address1','city1',40,52),
-(3,3,'1938-01-23','address3','city3',0,0),
-(5,5,'2006-12-27','address5','city5',40,48),
-(7,7,'1969-04-09','address7','city7',0,0),
-(9,9,'2006-06-14','address9','city9',0,0),
-(11,11,'1999-01-12','address11','city11',40,52),
-(13,13,'1968-01-13','address13','city13',50,12),
-(15,15,'1960-04-11','address15','city15',0,0),
-(17,17,'2006-10-13','address17','city17',40,52),
-(19,19,'1950-08-19','address19','city19',0,0),
-(21,21,'2000-05-01','address21','city21',40,30),
-(23,23,'1952-06-09','address23','city23',40,52),
-(25,25,'1934-12-08','address25','city25',32,40),
-(27,27,'1995-04-19','address27','city27',40,45),
-(29,29,'1986-01-14','address29','city29',44,52),
-(31,31,'1978-04-19','address31','city31',10,20),
-(33,33,'1989-11-23','address33','city33',25,10),
-(35,35,'2012-01-02','address35','city35',8,48),
-(37,37,'2005-08-24','address37','city37',40,42),
-(39,39,'1973-11-02','address39','city39',40,52),
-(41,41,'2011-10-12','address41','city41',20,30),
-(43,43,'1960-12-24','address43','city43',0,0),
-(45,45,'1990-04-17','address45','city45',35,40),
-(47,47,'1964-04-02','address47','city47',0,0),
-(49,49,'1957-01-25','address49','city49',40,52),
-(51,51,'1970-10-20','address51','city51',0,0),
-(54,54,'1987-09-30','address54','city54',0,0),
-(58,58,'1975-05-07','address58','city58',0,0),
-(62,62,'1972-08-03','address62','city62',40,52),
-(66,66,'1995-11-04','address66','city66',0,0),
-(70,70,'1985-10-19','address70','city70',40,52),
-(74,74,'1969-06-09','address74','city74',0,0),
-(78,78,'2003-01-16','address78','city78',66,52),
-(82,82,'2012-04-29','address82','city82',50,30),
-(86,86,'2008-02-03','address86','city86',0,0),
-(90,90,'1973-05-15','address90','city90',35,12),
-(94,94,'1987-10-28','address94','city94',40,50),
-(98,98,'1973-06-10','address98','city98',65,50),
-(102,102,'2009-09-13','address102','city102',0,0),
-(106,106,'1986-07-03','address106','city106',0,0),
-(110,110,'1982-06-10','address110','city110',35,52),
-(114,114,'1963-10-08','address114','city114',48,52),
-(118,118,'1948-03-07','address118','city118',0,0),
-(122,122,'1997-12-19','address122','city122',0,0),
-(124,124,'1966-03-25','address124','city124',0,0),
-(128,128,'1968-08-13','address128','city128',0,0),
-(132,132,'1989-09-25','address132','city132',20,20),
-(136,136,'1993-09-02','address136','city136',0,0),
-(140,140,'1981-05-31','address140','city140',48,52),
-(144,144,'1960-09-15','address144','city144',0,0),
-(148,148,'1945-02-13','address148','city148',40,38),
-(152,152,'2010-11-13','address152','city152',20,52),
-(154,154,'1950-11-07','address154','city154',55,52),
-(160,160,'1981-01-17','address160','city160',0,0),
-(162,162,'2001-03-19','address162','city162',0,0),
-(168,168,'2003-03-28','address168','city168',0,0),
-(170,170,'1977-06-18','address170','city170',50,52),
-(176,176,'1967-04-15','address176','city176',30,50),
-(178,178,'1989-10-25','address178','city178',60,12),
-(184,184,'2004-04-21','address184','city184',0,0),
-(186,186,'1952-11-08','address186','city186',50,48),
-(209,209,'1943-03-15','address209','city209',40,30),
-(241,241,'1979-12-02','address241','city241',0,0),
-(257,257,'2010-03-06','address257','city257',40,47);
---enable_query_log
-
---sorted_result
-select * from t1 where hours_worked_per_week = 40 and weeks_worked_last_year = 52 and dob < '1949-11-21';
-select * from t1 IGNORE INDEX(dob, weeks_worked_last_year, hours_worked_per_week) where hours_worked_per_week = 40 and weeks_worked_last_year = 52 and dob < '1949-11-21';
-
-drop table t1;
-
---echo #
---echo # MDEV-6322: The PARTITION engine can return wrong query results
---echo #
-CREATE TABLE t1 (
- CustomerID varchar(5) DEFAULT NULL,
- CompanyName varchar(40) DEFAULT NULL,
- ContactName varchar(30) DEFAULT NULL,
- ContactTitle varchar(30) DEFAULT NULL,
- Address varchar(60) DEFAULT NULL,
- City varchar(15) DEFAULT NULL,
- Region varchar(15) DEFAULT NULL,
- PostalCode varchar(10) DEFAULT NULL,
- Country varchar(15) NOT NULL,
- Phone varchar(24) DEFAULT NULL,
- Fax varchar(24) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
-PARTITION BY LIST COLUMNS(Country)
-(PARTITION p1 VALUES IN ('Germany','Austria','Switzerland','Poland'),
- PARTITION p2 VALUES IN ('USA','Canada','Mexico'),
- PARTITION p3 VALUES IN ('Spain','Portugal','Italy'),
- PARTITION p4 VALUES IN ('UK','Ireland'),
- PARTITION p5 VALUES IN ('France','Belgium'),
- PARTITION p6 VALUES IN ('Sweden','Finland','Denmark','Norway'),
- PARTITION p7 VALUES IN ('Venezuela','Argentina','Brazil')
-);
-
-INSERT INTO t1 (CustomerID, City, Country) VALUES
-('ANATR','México D.F','Mexico'),
-('ANTON','México D.F','Mexico'),
-('BOTTM','Tsawassen','Canada'),
-('CENTC','México D.F','Mexico'),
-('GREAL','Eugene','USA'),
-('HUNGC','Elgin','USA'),
-('LAUGB','Vancouver','Canada'),
-('LAZYK','Walla Walla','USA'),
-('LETSS','San Francisco','USA'),
-('LONEP','Portland','USA');
-
-SELECT * FROM t1 WHERE Country = 'USA';
-DROP TABLE t1;
-
-#
-# Test ALTER TABLE ADD/DROP PARTITION IF EXISTS
-#
-
-CREATE TABLE t1 ( d DATE NOT NULL)
-PARTITION BY RANGE( YEAR(d) ) (
- PARTITION p0 VALUES LESS THAN (1960),
- PARTITION p1 VALUES LESS THAN (1970),
- PARTITION p2 VALUES LESS THAN (1980),
- PARTITION p3 VALUES LESS THAN (1990)
-);
-
-ALTER TABLE t1 ADD PARTITION IF NOT EXISTS(
-PARTITION `p5` VALUES LESS THAN (2010)
-COMMENT 'APSTART \' APEND'
-);
-
-ALTER TABLE t1 ADD PARTITION IF NOT EXISTS(
-PARTITION `p5` VALUES LESS THAN (2010)
-COMMENT 'APSTART \' APEND'
-);
-
-alter table t1 drop partition if exists p5;
-alter table t1 drop partition if exists p5;
-
-DROP TABLE t1;
-
-#
-# MDEV-14696 Server crashes in in prep_alter_part_table on 2nd execution of PS.
-#
-
-CREATE TABLE t1 (a INT) ENGINE=MyISAM PARTITION BY RANGE(a) (PARTITION p1 VALUES LESS THAN (0));
-ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES LESS THAN (1));
-PREPARE stmt FROM 'ALTER TABLE t1 ADD PARTITION IF NOT EXISTS (PARTITION p2 VALUES LESS THAN (2))';
-EXECUTE stmt;
-EXECUTE stmt;
-
-DEALLOCATE PREPARE stmt;
-DROP TABLE t1;
-
---echo #
---echo # End of 10.0 tests
---echo #
-
---echo #
---echo # MDEV-8283 crash in get_mm_leaf with xor on binary col
---echo #
-CREATE TABLE t1(a BINARY(80)) PARTITION BY KEY(a) PARTITIONS 3;
-SELECT 1 FROM t1 WHERE a XOR 'a';
-DROP TABLE t1;
-
---echo #
---echo # End of 10.1 tests
---echo #
diff --git a/mysql-test/t/partition_alter.test b/mysql-test/t/partition_alter.test
deleted file mode 100644
index 62a3e1c0777..00000000000
--- a/mysql-test/t/partition_alter.test
+++ /dev/null
@@ -1,127 +0,0 @@
---source include/have_innodb.inc
---source include/have_partition.inc
-
-CREATE TABLE `test_data` (
- `hid` bigint(20) unsigned NOT NULL,
- `itid` bigint(20) unsigned NOT NULL,
- `clocktime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- `values` double(16,4) NOT NULL,
- PRIMARY KEY (`hid`,`itid`,`clocktime`)
- ) ;
-
-INSERT INTO `test_data` (`hid`, `itid`, `clocktime`, `values`) VALUES
- (1, 1, '2015-03-10 06:25:16', 0.0000),
- (1, 1, '2015-03-10 06:26:24', 0.0000),
- (1, 1, '2015-03-10 06:27:32', 0.0000),
- (1, 1, '2015-03-10 06:28:40', 0.0000),
- (1, 1, '2015-03-10 06:29:49', 0.0000),
- (1, 1, '2015-03-10 06:30:57', 0.0000),
- (1, 1, '2015-03-10 06:32:05', 0.0000),
- (1, 1, '2015-03-10 06:33:14', 0.0000),
- (1, 1, '2015-03-10 06:34:22', 0.0000),
- (1, 1, '2015-03-10 06:35:30', 0.0000),
- (1, 1, '2015-03-10 06:36:39', 0.0000),
- (1, 1, '2015-03-10 06:37:47', 0.0000),
- (1, 1, '2015-03-10 06:38:55', 0.0000),
- (1, 1, '2015-03-10 06:40:03', 0.0000),
- (1, 1, '2015-03-10 06:41:09', 0.0000),
- (1, 1, '2015-03-10 06:42:21', 0.0000),
- (1, 1, '2015-03-10 06:43:29', 0.0000),
- (1, 1, '2015-03-10 06:44:37', 0.0000),
- (1, 1, '2015-03-10 06:45:46', 0.0000),
- (1, 1, '2015-03-10 06:47:05', 0.0000),
- (1, 1, '2015-03-10 06:48:21', 0.0000),
- (1, 1, '2015-03-10 06:49:41', 0.0000),
- (1, 1, '2015-03-10 06:50:58', 0.0000),
- (1, 1, '2015-03-10 06:52:08', 0.0000),
- (1, 1, '2015-03-10 06:53:17', 0.0000),
- (1, 1, '2015-03-10 06:54:25', 0.0000),
- (563, 1, '2015-03-17 14:28:28', 0.3125),
- (563, 1, '2015-03-17 14:29:39', 0.2775),
- (563, 1, '2015-03-17 14:30:49', 0.2675);
-
-
-CREATE PROCEDURE `create_part_max`()
- alter table `test_data`
- partition by range(unix_timestamp(clocktime)) (
- partition partMAX values less than MAXVALUE
- );
-
-call create_part_max();
-
-call create_part_max();
-
-drop procedure create_part_max;
-
-prepare stmt from "alter table `test_data`
- partition by range(unix_timestamp(clocktime)) (
- partition partMAX values less than MAXVALUE
- )";
-
-execute stmt;
-execute stmt;
-
-deallocate prepare stmt;
-
-drop table test_data;
-
-#
-# MDEV-12389 ADD CHECK leaves an orphaned .par file
-#
-
---let $datadir=`SELECT @@datadir`
-
-# InnoDB
-create table t1(id int, d date not null, b bool not null default 0, primary key(id,d))
-engine=innodb
-partition by range columns (d) (
-partition p1 values less than ('2016-10-18'),
-partition p2 values less than ('2020-10-19'));
-insert t1 values (0, '2000-01-02', 0);
-insert t1 values (1, '2020-01-02', 10);
---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
---error ER_CONSTRAINT_FAILED
-alter table t1 add check (b in (0, 1));
-alter table t1 add check (b in (0, 10));
-show create table t1;
---error ER_CONSTRAINT_FAILED
-insert t1 values (2, '2020-01-03', 20);
-drop table t1;
---list_files $datadir/test
-
-# MyISAM, different execution path
-create table t1(id int, d date not null, b bool not null default 0, primary key(id,d))
-partition by range columns (d) (
-partition p1 values less than ('2016-10-18'),
-partition p2 values less than ('2020-10-19'));
-insert t1 values (0, '2000-01-02', 0);
-insert t1 values (1, '2020-01-02', 10);
---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
---error ER_CONSTRAINT_FAILED
-alter table t1 add check (b in (0, 1));
-alter table t1 add check (b in (0, 10));
-show create table t1;
---error ER_CONSTRAINT_FAILED
-insert t1 values (2, '2020-01-03', 20);
-drop table t1;
---list_files $datadir/test
-
-#
-# MDEV-13097 Online alter of a partitioned MyISAM table with auto_increment
-#
-create table t1 (id_1 int auto_increment, id_2 int, id_3 int, d1 date, dt1 datetime default current_timestamp, dt2 datetime default current_timestamp on update current_timestamp, primary key (id_2, id_3), key(id_1)) partition by hash(id_2) partitions 3 (partition p01, partition p02, partition p03);
-insert into t1 values(0, 1, 1, NULL, now(), now());
-alter online table t1 delay_key_write=1;
-show create table t1;
-drop table t1;
-
-#
-# MDEV-14817 Server crashes in prep_alter_part_table() after table lock and multiple add partition
-#
-create or replace table t1 (x int) partition by hash (x) (partition p1, partition p2);
-lock table t1 write;
---error ER_SAME_NAME_PARTITION
-alter table t1 add partition (partition p1);
---error ER_SAME_NAME_PARTITION
-alter table t1 add partition (partition p1);
-drop table t1;
diff --git a/mysql-test/t/partition_binlog.test b/mysql-test/t/partition_binlog.test
deleted file mode 100644
index d6986c86ebe..00000000000
--- a/mysql-test/t/partition_binlog.test
+++ /dev/null
@@ -1,43 +0,0 @@
---source include/have_log_bin.inc
---source include/have_partition.inc
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
---echo #
---echo # Bug#58147: ALTER TABLE w/ TRUNCATE PARTITION fails
---echo # but the statement is written to binlog
---echo #
-
-CREATE TABLE t1(id INT)
-PARTITION BY RANGE (id)
-(PARTITION p0 VALUES LESS THAN (100),
- PARTITION pmax VALUES LESS THAN (MAXVALUE));
-
-INSERT INTO t1 VALUES (1), (10), (100), (1000);
-
---let $binlog_file=query_get_value(SHOW MASTER STATUS, File, 1)
---let $binlog_start=query_get_value(SHOW MASTER STATUS, Position, 1)
-
---error ER_UNKNOWN_PARTITION
-ALTER TABLE t1 TRUNCATE PARTITION p1;
---error ER_DROP_PARTITION_NON_EXISTENT
-ALTER TABLE t1 DROP PARTITION p1;
-
---echo # No error returned, output in table format instead:
-ALTER TABLE t1 ANALYZE PARTITION p1;
-ALTER TABLE t1 CHECK PARTITION p1;
-ALTER TABLE t1 OPTIMIZE PARTITION p1;
-ALTER TABLE t1 REPAIR PARTITION p1;
-
-ALTER TABLE t1 ANALYZE PARTITION p0;
-ALTER TABLE t1 CHECK PARTITION p0;
-ALTER TABLE t1 OPTIMIZE PARTITION p0;
-ALTER TABLE t1 REPAIR PARTITION p0;
-ALTER TABLE t1 TRUNCATE PARTITION p0;
-ALTER TABLE t1 DROP PARTITION p0;
-
---source include/show_binlog_events.inc
-
-DROP TABLE t1;
diff --git a/mysql-test/t/partition_binlog_stmt.test b/mysql-test/t/partition_binlog_stmt.test
deleted file mode 100644
index cc57222dc3c..00000000000
--- a/mysql-test/t/partition_binlog_stmt.test
+++ /dev/null
@@ -1,27 +0,0 @@
---source include/have_partition.inc
---source include/have_binlog_format_statement.inc
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
---echo #
---echo # Bug#51851: Server with SBR locks mutex twice on LOAD DATA into
---echo # partitioned MyISAM table
---write_file $MYSQLTEST_VARDIR/tmp/init_file.txt
-abcd
-EOF
-
-CREATE TABLE t1
-(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
- name TINYBLOB NOT NULL,
- modified TIMESTAMP DEFAULT '0000-00-00 00:00:00',
- INDEX namelocs (name(255))) ENGINE = MyISAM
-PARTITION BY HASH(id) PARTITIONS 2;
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/init_file.txt'
-INTO TABLE t1 (name);
-
---remove_file $MYSQLTEST_VARDIR/tmp/init_file.txt
-DROP TABLE t1;
diff --git a/mysql-test/t/partition_blackhole.test b/mysql-test/t/partition_blackhole.test
deleted file mode 100644
index 9344ecb3b62..00000000000
--- a/mysql-test/t/partition_blackhole.test
+++ /dev/null
@@ -1,24 +0,0 @@
-# Tests for the partition storage engine in connection with the
-# storage engine BLACKHOLE.
-#
-# Creation:
-# 2007-10-18 mleich - Move BLACKHOLE related sub tests of partition.test to
-# this test. Reason: BLACKHOLE is not everytime available.
-# - Minor cleanup
-#
-
---source include/have_partition.inc
---source include/have_blackhole.inc
-
-#
-# Bug#14524 Partitions: crash if blackhole
-#
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-CREATE TABLE `t1` (
- `id` int(11) default NULL
-) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 PARTITION BY HASH (id) ;
-SELECT * FROM t1;
-
-DROP TABLE t1;
diff --git a/mysql-test/t/partition_bug18198.test b/mysql-test/t/partition_bug18198.test
deleted file mode 100644
index 720d483e8ed..00000000000
--- a/mysql-test/t/partition_bug18198.test
+++ /dev/null
@@ -1,219 +0,0 @@
--- source include/have_partition.inc
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1 (col1 datetime)
-partition by range(datediff(col1,col1))
-(partition p0 values less than (10), partition p1 values less than (30));
-drop table t1;
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 int)
-partition by range(greatest(col1,10))
-(partition p0 values less than (2), partition p1 values less than (6));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 int)
-partition by range(isnull(col1))
-(partition p0 values less than (2), partition p1 values less than (6));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 int)
-partition by range(least(col1,12))
-(partition p0 values less than (2), partition p1 values less than (6));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 int)
-partition by range(case when col1>0 then 10 else 20 end)
-(partition p0 values less than (2), partition p1 values less than (6));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 int)
-partition by range(ifnull(col1,5))
-(partition p0 values less than (2), partition p1 values less than (6));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 int)
-partition by range(nullif(col1,5))
-(partition p0 values less than (2), partition p1 values less than (6));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 int)
-partition by range(bit_length(col1))
-(partition p0 values less than (2), partition p1 values less than (6));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 char(5))
-partition by range(bit_length(col1))
-(partition p0 values less than (2), partition p1 values less than (6));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 int)
-partition by range(char_length(col1))
-(partition p0 values less than (2), partition p1 values less than (6));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 char(5))
-partition by range(char_length(col1))
-(partition p0 values less than (2), partition p1 values less than (6));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 char(5))
-partition by range(character_length(col1))
-(partition p0 values less than (2), partition p1 values less than (6));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 int)
-partition by range(find_in_set(col1,1))
-(partition p0 values less than (2), partition p1 values less than (6));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 char(5))
-partition by range(find_in_set(col1,'1'))
-(partition p0 values less than (2), partition p1 values less than (6));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 int)
-partition by range(instr(col1,3))
-(partition p0 values less than (2), partition p1 values less than (6));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 char(5))
-partition by range(instr(col1,'3'))
-(partition p0 values less than (2), partition p1 values less than (6));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 char(5))
-partition by range(length(col1))
-(partition p0 values less than (2), partition p1 values less than (6));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 char(5))
-partition by range(locate(1,col1))
-(partition p0 values less than (2), partition p1 values less than (6));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 int)
-partition by range(locate(1,col1))
-(partition p0 values less than (2), partition p1 values less than (6));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 char(5))
-partition by range(octet_length(col1))
-(partition p0 values less than (2), partition p1 values less than (6));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 char(5))
-partition by range(position(1 in col1))
-(partition p0 values less than (2), partition p1 values less than (6));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 int)
-partition by range(position(1 in col1))
-(partition p0 values less than (2), partition p1 values less than (6));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 char(5))
-partition by range(strcmp(col1,2))
-(partition p0 values less than (2), partition p1 values less than (6));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 int)
-partition by range(strcmp(col1,2))
-(partition p0 values less than (2), partition p1 values less than (6));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 int)
-partition by range(crc32(col1))
-(partition p0 values less than (2), partition p1 values less than (6));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 int)
-partition by range(round(col1))
-(partition p0 values less than (2), partition p1 values less than (6));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 int)
-partition by range(sign(col1))
-(partition p0 values less than (2), partition p1 values less than (6));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 datetime)
-partition by range(period_add(col1,5))
-(partition p0 values less than (10), partition p1 values less than (30));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 datetime, col2 datetime)
-partition by range(period_diff(col1,col2))
-(partition p0 values less than (10), partition p1 values less than (30));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 int, col2 int)
-partition by range(period_diff(col1,col2))
-(partition p0 values less than (10), partition p1 values less than (30));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 datetime)
-partition by range(timestampdiff(day,5,col1))
-(partition p0 values less than (10), partition p1 values less than (30));
-
--- error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-create table t1 (col1 date)
-partition by range(unix_timestamp(col1))
-(partition p0 values less than (10), partition p1 values less than (30));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 datetime)
-partition by range(week(col1))
-(partition p0 values less than (10), partition p1 values less than (30));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 varchar(25))
-partition by range(cast(col1 as signed))
-(partition p0 values less than (10), partition p1 values less than (30));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 varchar(25))
-partition by range(convert(col1,unsigned))
-(partition p0 values less than (10), partition p1 values less than (30));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 int)
-partition by range(col1 | 20)
-(partition p0 values less than (10), partition p1 values less than (30));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 int)
-partition by range(col1 & 20)
-(partition p0 values less than (10), partition p1 values less than (30));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 int)
-partition by range(col1 ^ 20)
-(partition p0 values less than (10), partition p1 values less than (30));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 int)
-partition by range(col1 << 20)
-(partition p0 values less than (10), partition p1 values less than (30));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 int)
-partition by range(col1 >> 20)
-(partition p0 values less than (10), partition p1 values less than (30));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 int)
-partition by range(~col1)
-(partition p0 values less than (10), partition p1 values less than (30));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 int)
-partition by range(bit_count(col1))
-(partition p0 values less than (10), partition p1 values less than (30));
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (col1 int)
-partition by range(inet_aton(col1))
-(partition p0 values less than (10), partition p1 values less than (30));
diff --git a/mysql-test/t/partition_cache.test b/mysql-test/t/partition_cache.test
deleted file mode 100644
index b5d19796b7c..00000000000
--- a/mysql-test/t/partition_cache.test
+++ /dev/null
@@ -1,21 +0,0 @@
-# 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;
-# Using SELECT to get a space as first character.
-let $partitions_a= `SELECT ' PARTITION BY KEY (a) PARTITIONS 3'`;
-let $partitions_id= `SELECT ' PARTITION BY HASH (id) PARTITIONS 3'`;
-let $partitions_s1= `SELECT ' PARTITION BY KEY (s1) PARTITIONS 3'`;
-# partitioning does not support FOREIGN KEYs
-let $test_foreign_keys= 0;
-
---source include/query_cache.inc
diff --git a/mysql-test/t/partition_cache_innodb.test b/mysql-test/t/partition_cache_innodb.test
deleted file mode 100644
index dbcfea3088c..00000000000
--- a/mysql-test/t/partition_cache_innodb.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# 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
deleted file mode 100644
index 5347225f6da..00000000000
--- a/mysql-test/t/partition_cache_myisam.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# 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/partition_charset.test b/mysql-test/t/partition_charset.test
deleted file mode 100644
index 6842e5268fa..00000000000
--- a/mysql-test/t/partition_charset.test
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# Test for character set related things in combination
-# with the partition storage engine
-#
--- source include/have_partition.inc
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-set names utf8;
-create table t1 (s1 int)
- partition by list (s1)
- (partition c values in (1),
- partition Ç values in (3));
-insert into t1 values (1),(3);
-select * from t1;
-flush tables;
-set names latin1;
-select * from t1;
-drop table t1;
-
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (a varchar(1), primary key (a))
-partition by list (ascii(a))
-(partition p1 values in (65));
-#insert into t1 values ('A');
-#replace into t1 values ('A');
-#drop table t1;
diff --git a/mysql-test/t/partition_column.test b/mysql-test/t/partition_column.test
deleted file mode 100644
index be34e4eac63..00000000000
--- a/mysql-test/t/partition_column.test
+++ /dev/null
@@ -1,510 +0,0 @@
-#
-# Tests for the new column list partitioning introduced in second
-# version for partitioning.
-#
---source include/have_partition.inc
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
---echo #
---echo # Bug#52815: LIST COLUMNS doesn't insert rows in correct partition
---echo # if muliple columns used
-CREATE TABLE t1 (
-id INT NOT NULL,
-name VARCHAR(255),
-department VARCHAR(10),
-country VARCHAR(255)
-) PARTITION BY LIST COLUMNS (department, country) (
-PARTITION first_office VALUES IN (('dep1', 'Russia'), ('dep1', 'Croatia')),
-PARTITION second_office VALUES IN (('dep2', 'Russia'))
-);
-
-INSERT INTO t1 VALUES(1, 'Ann', 'dep1', 'Russia');
-INSERT INTO t1 VALUES(2, 'Bob', 'dep1', 'Croatia');
-INSERT INTO t1 VALUES(3, 'Cecil', 'dep2', 'Russia');
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-INSERT INTO t1 VALUES(3, 'Dan', 'dep2', 'Croatia');
-SELECT PARTITION_NAME,TABLE_ROWS
-FROM INFORMATION_SCHEMA.PARTITIONS
-WHERE TABLE_NAME = 't1';
-SHOW CREATE TABLE t1;
-SELECT * FROM t1 WHERE department = 'dep2' and country = 'Croatia';
-SELECT * FROM t1 WHERE department = 'dep1' and country = 'Croatia';
-DROP TABLE t1;
-
-#
-# Bug#51347: assertion with show create table + partition by columns
-# on decimal column
-#
---error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
-CREATE TABLE t1 (a DECIMAL)
-PARTITION BY RANGE COLUMNS (a)
-(PARTITION p0 VALUES LESS THAN (0));
-
---error ER_BLOB_FIELD_IN_PART_FUNC_ERROR
-CREATE TABLE t1 (a BLOB)
-PARTITION BY RANGE COLUMNS (a)
-(PARTITION p0 VALUES LESS THAN ("X"));
-
---error ER_BLOB_FIELD_IN_PART_FUNC_ERROR
-CREATE TABLE t1 (a TEXT)
-PARTITION BY RANGE COLUMNS (a)
-(PARTITION p0 VALUES LESS THAN ("X"));
-
---error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
-CREATE TABLE t1 (a FLOAT)
-PARTITION BY RANGE COLUMNS (a)
-(PARTITION p0 VALUES LESS THAN (0.0));
-
---error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
-CREATE TABLE t1 (a DOUBLE)
-PARTITION BY RANGE COLUMNS (a)
-(PARTITION p0 VALUES LESS THAN (0.0));
-
---error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
-CREATE TABLE t1 (d TIMESTAMP)
-PARTITION BY RANGE COLUMNS(d)
-(PARTITION p0 VALUES LESS THAN ('2000-01-01'),
- PARTITION p1 VALUES LESS THAN ('2040-01-01'));
-
---error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
-CREATE TABLE t1 (d BIT(1))
-PARTITION BY RANGE COLUMNS(d)
-(PARTITION p0 VALUES LESS THAN (0),
- PARTITION p1 VALUES LESS THAN (1));
-
---error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
-CREATE TABLE t1 (d ENUM("YES","NO"))
-PARTITION BY RANGE COLUMNS(d)
-(PARTITION p0 VALUES LESS THAN ("NO"),
- PARTITION p1 VALUES LESS THAN (MAXVALUE));
-
---error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
-CREATE TABLE t1 (d SET("Car","MC"))
-PARTITION BY RANGE COLUMNS(d)
-(PARTITION p0 VALUES LESS THAN ("MC"),
- PARTITION p1 VALUES LESS THAN (MAXVALUE));
-
-#
-# BUG#49180, Possible to define empty intervals for column list partitioning
-#
---error ER_RANGE_NOT_INCREASING_ERROR
-create table t1 (a int, b int)
-partition by range columns (a,b)
-( partition p0 values less than (maxvalue, 10),
- partition p1 values less than (maxvalue, maxvalue));
-
---error ER_RANGE_NOT_INCREASING_ERROR
-create table t1 (a int, b int, c int)
-partition by range columns (a,b,c)
-( partition p0 values less than (1, maxvalue, 10),
- partition p1 values less than (1, maxvalue, maxvalue));
-
-#
-# BUG#48737, Search fails with ucs2
-#
-create table t1 (a varchar(5) character set ucs2 collate ucs2_bin)
-partition by range columns (a)
-(partition p0 values less than (0x0041));
-insert into t1 values (0x00410000);
-select hex(a) from t1 where a like 'A_';
-explain partitions select hex(a) from t1 where a like 'A_';
-alter table t1 remove partitioning;
-select hex(a) from t1 where a like 'A_';
-create index a on t1 (a);
-select hex(a) from t1 where a like 'A_';
-insert into t1 values ('A_');
-select hex(a) from t1;
-drop table t1;
-
-#
-# BUG#48161, Delivering too few records using collate syntax with partitions
-#
-# Test case from BUG#48447 with some extension
-create table t1 (a varchar(1) character set latin1 collate latin1_general_ci)
-partition by range columns(a)
-( partition p0 values less than ('a'),
- partition p1 values less than ('b'),
- partition p2 values less than ('c'),
- partition p3 values less than ('d'));
-insert into t1 values ('A'),('a'),('B'),('b'),('C'),('c');
-select * from t1 where a > 'B' collate latin1_bin;
-select * from t1 where a <> 'B' collate latin1_bin;
-alter table t1 remove partitioning;
-select * from t1 where a > 'B' collate latin1_bin;
-select * from t1 where a <> 'B' collate latin1_bin;
-drop table t1;
-
-# Test case from BUG#48161
-create table t1 (a varchar(2) character set latin1,
- b varchar(2) character set latin1)
-partition by list columns(a,b)
-(partition p0 values in (('a','a')));
-insert into t1 values ('A','A');
-select * from t1 where b <> 'a' collate latin1_bin AND
- a = 'A' collate latin1_bin;
-alter table t1 remove partitioning;
-select * from t1 where b <> 'a' collate latin1_bin AND
- a = 'A' collate latin1_bin;
-drop table t1;
-
-create table t1 (a varchar(5))
-partition by list columns(a)
-( partition p0 values in ('\''),
- partition p1 values in ('\\'),
- partition p2 values in ('\0'));
-show create table t1;
-drop table t1;
-
-#
-# BUG#48165, sql_mode gives error
-#
-set @@sql_mode=allow_invalid_dates;
---error ER_WRONG_TYPE_COLUMN_VALUE_ERROR
-create table t1 (a char, b char, c date)
-partition by range columns (a,b,c)
-( partition p0 values less than (0,0,to_days('3000-11-31')));
-
---error ER_WRONG_TYPE_COLUMN_VALUE_ERROR
-create table t1 (a char, b char, c date)
-partition by range columns (a,b,c)
-( partition p0 values less than (0,0,'3000-11-31'));
-set @@sql_mode='';
-
---error ER_WRONG_TYPE_COLUMN_VALUE_ERROR
-create table t1 (a int, b char(10), c varchar(25), d datetime)
-partition by range columns(a,b,c,d)
-subpartition by hash (to_seconds(d))
-subpartitions 4
-( partition p0 values less than (1, 0, MAXVALUE, '1900-01-01'),
- partition p1 values less than (1, 'a', MAXVALUE, '1999-01-01'),
- partition p2 values less than (1, 'a', MAXVALUE, MAXVALUE),
- partition p3 values less than (1, MAXVALUE, MAXVALUE, MAXVALUE));
-
-create table t1 (a int, b char(10), c varchar(25), d datetime)
-partition by range columns(a,b,c,d)
-subpartition by hash (to_seconds(d))
-subpartitions 4
-( partition p0 values less than (1, '0', MAXVALUE, '1900-01-01'),
- partition p1 values less than (1, 'a', MAXVALUE, '1999-01-01'),
- partition p2 values less than (1, 'b', MAXVALUE, MAXVALUE),
- partition p3 values less than (1, MAXVALUE, MAXVALUE, MAXVALUE));
-select partition_method, partition_expression, partition_description
- from information_schema.partitions where table_name = "t1";
-show create table t1;
-drop table t1;
-
---error ER_NULL_IN_VALUES_LESS_THAN
-create table t1 (a int, b int)
-partition by range columns (a,b)
-(partition p0 values less than (NULL, maxvalue));
-
---error ER_MAXVALUE_IN_VALUES_IN, ER_PARSE_ERROR
-create table t1 (a int, b int)
-partition by list columns(a,b)
-( partition p0 values in ((maxvalue, 0)));
-
-create table t1 (a int, b int)
-partition by list columns (a,b)
-( partition p0 values in ((0,0)));
---error ER_MAXVALUE_IN_VALUES_IN, ER_PARSE_ERROR
-alter table t1 add partition
-(partition p1 values in (maxvalue, maxvalue));
-drop table t1;
-#
-# BUG#47837, Crash when two same fields in column list processing
-#
---error ER_SAME_NAME_PARTITION_FIELD
-create table t1 (a int, b int)
-partition by key (a,a);
---error ER_SAME_NAME_PARTITION_FIELD
-create table t1 (a int, b int)
-partition by list columns(a,a)
-( partition p values in ((1,1)));
-
-#
-# BUG#47838, List partitioning have problems with <= and >=
-#
-create table t1 (a int signed)
-partition by list (a)
-( partition p0 values in (1, 3, 5, 7, 9, NULL),
- partition p1 values in (2, 4, 6, 8, 0));
-insert into t1 values (NULL),(0),(1),(2),(2),(4),(4),(4),(8),(8);
-select * from t1 where NULL <= a;
-select * from t1 where a is null;
-explain partitions select * from t1 where a is null;
-select * from t1 where a <= 1;
-drop table t1;
-
-create table t1 (a int signed)
-partition by list columns(a)
-( partition p0 values in (1, 3, 5, 7, 9, NULL),
- partition p1 values in (2, 4, 6, 8, 0));
-insert into t1 values (NULL),(0),(1),(2),(2),(4),(4),(4),(8),(8);
-select * from t1 where a <= NULL;
-select * from t1 where a is null;
-explain partitions select * from t1 where a is null;
-select * from t1 where a <= 1;
-drop table t1;
-
-create table t1 (a int, b int)
-partition by list columns(a,b)
-( partition p0 values in ((1, NULL), (2, NULL), (NULL, NULL)),
- partition p1 values in ((1,1), (2,2)),
- partition p2 values in ((3, NULL), (NULL, 1)));
-select partition_method, partition_expression, partition_description
- from information_schema.partitions where table_name = "t1";
-show create table t1;
-#
-# BUG#47754 Crash when selecting using NOT BETWEEN for column list partitioning
-#
-insert into t1 values (3, NULL);
-insert into t1 values (NULL, 1);
-insert into t1 values (NULL, NULL);
-insert into t1 values (1, NULL);
-insert into t1 values (2, NULL);
-insert into t1 values (1,1);
-insert into t1 values (2,2);
-select * from t1 where a = 1;
-select * from t1 where a = 2;
-select * from t1 where a > 8;
-select * from t1 where a not between 8 and 8;
-show create table t1;
-drop table t1;
-
---error ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR
-create table t1 (a int)
-partition by list (a)
-( partition p0 values in (1),
- partition p1 values in (1));
-
-create table t1 (a int)
-partition by list (a)
-( partition p0 values in (2, 1),
- partition p1 values in (4, NULL, 3));
-select partition_method, partition_expression, partition_description
- from information_schema.partitions where table_name = "t1";
-show create table t1;
-insert into t1 values (1);
-insert into t1 values (2);
-insert into t1 values (3);
-insert into t1 values (4);
-insert into t1 values (NULL);
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-insert into t1 values (5);
-drop table t1;
-
---error ER_PARSE_ERROR
-create table t1 (a int)
-partition by list columns(a)
-( partition p0 values in (2, 1),
- partition p1 values in ((4), (NULL), (3)));
-
-create table t1 (a int)
-partition by list columns(a)
-( partition p0 values in (2, 1),
- partition p1 values in (4, NULL, 3));
-select partition_method, partition_expression, partition_description
- from information_schema.partitions where table_name = "t1";
-show create table t1;
-insert into t1 values (1);
-insert into t1 values (2);
-insert into t1 values (3);
-insert into t1 values (4);
-insert into t1 values (NULL);
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-insert into t1 values (5);
-show create table t1;
-drop table t1;
-
-create table t1 (a int, b char(10), c varchar(5), d int)
-partition by range columns(a,b,c)
-subpartition by key (c,d)
-subpartitions 3
-( partition p0 values less than (1,'abc','abc'),
- partition p1 values less than (2,'abc','abc'),
- partition p2 values less than (3,'abc','abc'),
- partition p3 values less than (4,'abc','abc'));
-select partition_method, partition_expression, partition_description
- from information_schema.partitions where table_name = "t1";
-show create table t1;
-
-insert into t1 values (1,'a','b',1),(2,'a','b',2),(3,'a','b',3);
-insert into t1 values (1,'b','c',1),(2,'b','c',2),(3,'b','c',3);
-insert into t1 values (1,'c','d',1),(2,'c','d',2),(3,'c','d',3);
-insert into t1 values (1,'d','e',1),(2,'d','e',2),(3,'d','e',3);
-select * from t1 where (a = 1 AND b < 'd' AND (c = 'b' OR (c = 'c' AND d = 1)) OR
- (a = 1 AND b >= 'a' AND (c = 'c' OR (c = 'd' AND d = 2))));
-drop table t1;
-
-create table t1 (a int, b varchar(2), c int)
-partition by range columns (a, b, c)
-(partition p0 values less than (1, 'A', 1),
- partition p1 values less than (1, 'B', 1));
-select partition_method, partition_expression, partition_description
- from information_schema.partitions where table_name = "t1";
-show create table t1;
-insert into t1 values (1, 'A', 1);
-explain partitions select * from t1 where a = 1 AND b <= 'A' and c = 1;
-select * from t1 where a = 1 AND b <= 'A' and c = 1;
-drop table t1;
-
-create table t1 (a char, b char, c char)
-partition by list columns(a)
-( partition p0 values in ('a'));
-insert into t1 (a) values ('a');
-select * from t1 where a = 'a';
-drop table t1;
-
---error ER_WRONG_TYPE_COLUMN_VALUE_ERROR
-create table t1 (d time)
-partition by range columns(d)
-( partition p0 values less than ('2000-01-01'),
- partition p1 values less than ('2040-01-01'));
-
-create table t1 (a int, b int)
-partition by range columns(a,b)
-(partition p0 values less than (maxvalue, 10));
-drop table t1;
-
-create table t1 (d date)
-partition by range columns(d)
-( partition p0 values less than ('2000-01-01'),
- partition p1 values less than ('2009-01-01'));
-drop table t1;
-
-create table t1 (d date)
-partition by range columns(d)
-( partition p0 values less than ('1999-01-01'),
- partition p1 values less than ('2000-01-01'));
-drop table t1;
-
-create table t1 (d date)
-partition by range columns(d)
-( partition p0 values less than ('2000-01-01'),
- partition p1 values less than ('3000-01-01'));
-drop table t1;
-
-create table t1 (a int, b int)
-partition by range columns(a,b)
-(partition p2 values less than (99,99),
- partition p1 values less than (99,999));
-
-insert into t1 values (99,998);
-select * from t1 where b = 998;
-drop table t1;
-
-create table t1 as select to_seconds(null) as to_seconds;
-select data_type from information_schema.columns
-where table_schema='test' and column_name='to_seconds';
-drop table t1;
-
---error ER_PARSE_ERROR
-create table t1 (a int, b int)
-partition by list columns(a,b)
-(partition p0 values in ((maxvalue,maxvalue)));
-create table t1 (a int, b int)
-partition by range columns(a,b)
-(partition p0 values less than (maxvalue,maxvalue));
-drop table t1;
-
-create table t1 (a int)
-partition by list columns(a)
-(partition p0 values in (0));
-select partition_method from information_schema.partitions where table_name='t1';
-drop table t1;
-
-create table t1 (a char(6))
-partition by range columns(a)
-(partition p0 values less than ('H23456'),
- partition p1 values less than ('M23456'));
-insert into t1 values ('F23456');
-select * from t1;
-drop table t1;
-
--- error 1054
-create table t1 (a char(6))
-partition by range columns(a)
-(partition p0 values less than (H23456),
- partition p1 values less than (M23456));
-
--- error ER_WRONG_TYPE_COLUMN_VALUE_ERROR
-create table t1 (a char(6))
-partition by range columns(a)
-(partition p0 values less than (23456),
- partition p1 values less than (23456));
-
--- error 1064
-create table t1 (a int, b int)
-partition by range columns(a,b)
-(partition p0 values less than (10));
-
--- error ER_PARTITION_COLUMN_LIST_ERROR
-create table t1 (a int, b int)
-partition by range columns(a,b)
-(partition p0 values less than (1,1,1);
-
-create table t1 (a int, b int)
-partition by range columns(a,b)
-(partition p0 values less than (1, 0),
- partition p1 values less than (2, maxvalue),
- partition p2 values less than (3, 3),
- partition p3 values less than (10, maxvalue));
-
--- error ER_NO_PARTITION_FOR_GIVEN_VALUE
-insert into t1 values (11,0);
-insert into t1 values (0,1),(1,1),(2,1),(3,1),(3,4),(4,9),(9,1);
-select * from t1;
-
-alter table t1
-partition by range columns(b,a)
-(partition p0 values less than (1,2),
- partition p1 values less than (3,3),
- partition p2 values less than (9,5));
-explain partitions select * from t1 where b < 2;
-select * from t1 where b < 2;
-explain partitions select * from t1 where b < 4;
-select * from t1 where b < 4;
-
-alter table t1 reorganize partition p1 into
-(partition p11 values less than (2,2),
- partition p12 values less than (3,3));
-
--- error ER_REORG_OUTSIDE_RANGE
-alter table t1 reorganize partition p0 into
-(partition p01 values less than (0,3),
- partition p02 values less than (1,1));
-
--- error ER_PARTITION_COLUMN_LIST_ERROR
-alter table t1 reorganize partition p2 into
-(partition p2 values less than(9,6,1));
-
--- error ER_PARTITION_COLUMN_LIST_ERROR
-alter table t1 reorganize partition p2 into
-(partition p2 values less than (10));
-
-alter table t1 reorganize partition p2 into
-(partition p21 values less than (4,7),
- partition p22 values less than (9,5));
-explain partitions select * from t1 where b < 4;
-select * from t1 where b < 4;
-drop table t1;
-
-create table t1 (a int, b int)
-partition by list columns(a,b)
-subpartition by hash (b)
-subpartitions 2
-(partition p0 values in ((0,0), (1,1)),
- partition p1 values in ((1000,1000)));
-insert into t1 values (1000,1000);
-#select * from t1 where a = 0 and b = 0;
-drop table t1;
-
-create table t1 (a char, b char, c char)
-partition by range columns(a,b,c)
-( partition p0 values less than ('a','b','c'));
-alter table t1 add partition
-(partition p1 values less than ('b','c','d'));
-drop table t1;
diff --git a/mysql-test/t/partition_column_prune.test b/mysql-test/t/partition_column_prune.test
deleted file mode 100644
index 848825ba71b..00000000000
--- a/mysql-test/t/partition_column_prune.test
+++ /dev/null
@@ -1,71 +0,0 @@
-#
-# Partition pruning tests for new COLUMN LIST feature
-#
--- source include/have_partition.inc
-
---disable_warnings
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
---enable_warnings
-
-create table t1 (a char, b char, c char)
-partition by range columns(a,b,c)
-( partition p0 values less than ('a','b','c'));
-insert into t1 values ('a', NULL, 'd');
-explain partitions select * from t1 where a = 'a' AND c = 'd';
-select * from t1 where a = 'a' AND c = 'd';
-drop table t1;
-
-## COLUMN_LIST partition pruning tests
-create table t1 (a int not null) partition by range columns(a) (
- partition p0 values less than (10),
- partition p1 values less than (20),
- partition p2 values less than (30),
- partition p3 values less than (40),
- partition p4 values less than (50),
- partition p5 values less than (60),
- partition p6 values less than (70)
-);
-insert into t1 values (5),(15),(25),(35),(45),(55),(65);
-insert into t1 values (5),(15),(25),(35),(45),(55),(65);
-
-create table t2 (a int not null) partition by range(a) (
- partition p0 values less than (10),
- partition p1 values less than (20),
- partition p2 values less than (30),
- partition p3 values less than (40),
- partition p4 values less than (50),
- partition p5 values less than (60),
- partition p6 values less than (70)
-);
-insert into t2 values (5),(15),(25),(35),(45),(55),(65);
-insert into t2 values (5),(15),(25),(35),(45),(55),(65);
-
-explain partitions select * from t1 where a > 35 and a < 45;
-explain partitions select * from t2 where a > 35 and a < 45;
-
-drop table t1, t2;
-
-create table t1 (a int not null, b int not null )
-partition by range columns(a,b) (
- partition p01 values less than (2,10),
- partition p02 values less than (2,20),
- partition p03 values less than (2,30),
-
- partition p11 values less than (4,10),
- partition p12 values less than (4,20),
- partition p13 values less than (4,30),
-
- partition p21 values less than (6,10),
- partition p22 values less than (6,20),
- partition p23 values less than (6,30)
-);
-
-insert into t1 values (2,5), (2,15), (2,25),
- (4,5), (4,15), (4,25), (6,5), (6,15), (6,25);
-insert into t1 select * from t1;
-
-explain partitions select * from t1 where a=2;
-explain partitions select * from t1 where a=4;
-explain partitions select * from t1 where a=2 and b < 22;
-
-drop table t1;
diff --git a/mysql-test/t/partition_csv.test b/mysql-test/t/partition_csv.test
deleted file mode 100644
index 44013dd4b0a..00000000000
--- a/mysql-test/t/partition_csv.test
+++ /dev/null
@@ -1,93 +0,0 @@
-# Tests for the partition storage engine in connection with the
-# storage engine CSV.
-#
-# Creation:
-# 2007-10-18 mleich - Move CSV related sub tests of partition.test to
-# this test. Reason: CSV is not everytime available.
-# - Minor cleanup
-#
-
---source include/have_partition.inc
---source include/have_csv.inc
-
-call mtr.add_suppression("Failed to write to mysql.general_log");
-
-#
-# Bug#19307: Partitions: csv delete failure
-# = CSV engine crashes
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
---error ER_PARTITION_MERGE_ERROR
-create table t1 (a int)
-engine = csv
-partition by list (a)
-(partition p0 values in (null));
-
-#
-# Bug #27816: Log tables ran with partitions crashes the server when logging
-# is enabled.
-#
-
-USE mysql;
-TRUNCATE TABLE general_log;
-SET @old_general_log_state = @@global.general_log;
-SET GLOBAL general_log = 0;
-ALTER TABLE general_log ENGINE = MyISAM;
---error ER_WRONG_USAGE
-ALTER TABLE general_log PARTITION BY RANGE (TO_DAYS(event_time))
- (PARTITION p0 VALUES LESS THAN (733144), PARTITION p1 VALUES LESS THAN (3000000));
-ALTER TABLE general_log ENGINE = CSV;
-SET GLOBAL general_log = @old_general_log_state;
-use test;
-
---echo #
---echo # Bug#40281: partitioning the general log table crashes the server
---echo #
-
---echo # set up partitioned log, and switch to it
-
-USE mysql;
-SET @old_general_log_state = @@global.general_log;
-SET GLOBAL general_log = 0;
-CREATE TABLE gl_partitioned LIKE general_log;
-ALTER TABLE gl_partitioned ENGINE=myisam;
-ALTER TABLE gl_partitioned PARTITION BY HASH (thread_id) PARTITIONS 10;
-ALTER TABLE general_log RENAME TO gl_nonpartitioned;
-ALTER TABLE gl_partitioned RENAME TO general_log;
-
-SELECT @@global.log_output INTO @old_glo;
-SET GLOBAL log_output='table';
-SET GLOBAL general_log =1;
-
---echo # do some things to be logged to partitioned log, should fail
-USE /* 1 */ test;
-
-CREATE TABLE t1 (i INT);
-
-connect (con1,localhost,root,,);
-INSERT INTO t1 VALUES (1);
-SELECT * FROM t1;
-disconnect con1;
-
-connection default;
-USE mysql;
-SET GLOBAL general_log =0;
-ALTER TABLE general_log RENAME TO gl_partitioned;
-ALTER TABLE gl_nonpartitioned RENAME TO general_log;
-
---echo # show whether we actually logged anything (no) to general_log
-SELECT COUNT(argument) FROM gl_partitioned;
-
-DROP TABLE gl_partitioned;
-
-SET GLOBAL log_output = @old_glo;
-SET GLOBAL general_log = 1;
-
-USE /* 2 */ test;
-DROP TABLE t1;
-
-SET GLOBAL general_log = @old_general_log_state;
-
---echo End of 5.1 tests
diff --git a/mysql-test/t/partition_datatype.test b/mysql-test/t/partition_datatype.test
deleted file mode 100644
index 9ab3bd4d5fa..00000000000
--- a/mysql-test/t/partition_datatype.test
+++ /dev/null
@@ -1,549 +0,0 @@
-#
-# Simple test for the partition storage engine
-# with most datatypes and null / not null
-# as partition by key
-# Created to verify the fix for Bug#31705
-# Partitions: crash if varchar length > 65530
-# BUG#48164 limited size to 3072 bytes
-#
--- source include/have_partition.inc
--- source include/have_innodb.inc
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
--- echo # test with not null
-create table t1 (a bit not null) partition by key (a);
-insert into t1 values (b'1');
-select hex(a) from t1 where a = b'1';
-drop table t1;
-create table t1 (a tinyint not null) partition by key (a);
-insert into t1 values (2);
-select * from t1 where a = 2;
-drop table t1;
-create table t1 (a smallint not null) partition by key (a);
-insert into t1 values (2);
-select * from t1 where a = 2;
-drop table t1;
-create table t1 (a mediumint not null) partition by key (a);
-insert into t1 values (2);
-select * from t1 where a = 2;
-drop table t1;
-create table t1 (a int not null) partition by key (a);
-insert into t1 values (2);
-select * from t1 where a = 2;
-drop table t1;
-create table t1 (a bigint not null) partition by key (a);
-insert into t1 values (2);
-select * from t1 where a = 2;
-drop table t1;
-create table t1 (a float not null) partition by key (a);
-insert into t1 values (0.5);
-select * from t1 where a = 0.5;
-drop table t1;
-create table t1 (a double not null) partition by key (a);
-insert into t1 values (0.5);
-select * from t1 where a = 0.5;
-drop table t1;
-create table t1 (a decimal(4,2) not null) partition by key (a);
-insert into t1 values (2.1);
-select * from t1 where a = 2.1;
-drop table t1;
-create table t1 (a date not null) partition by key (a);
-insert into t1 values ('2001-01-01');
-select * from t1 where a = '2001-01-01';
-drop table t1;
-create table t1 (a datetime not null) partition by key (a);
-insert into t1 values ('2001-01-01 01:02:03');
-select * from t1 where a = '2001-01-01 01:02:03';
-drop table t1;
-create table t1 (a timestamp not null) partition by key (a);
-insert into t1 values ('2001-01-01 01:02:03');
-select * from t1 where a = '2001-01-01 01:02:03';
-drop table t1;
-create table t1 (a time not null) partition by key (a);
-insert into t1 values ('01:02:03');
-select * from t1 where a = '01:02:03';
-drop table t1;
-create table t1 (a year not null) partition by key (a);
-insert into t1 values ('2001');
-select * from t1 where a = '2001';
-drop table t1;
-create table t1 (a varchar(10) character set utf8 not null) partition by key (a);
-insert into t1 values ('abc');
-select * from t1 where a = 'abc';
-drop table t1;
-create table t1 (a varchar(300) character set utf8 not null) partition by key (a);
-insert into t1 values ('abc');
-select * from t1 where a = 'abc';
-drop table t1;
-create table t1 (a varchar(10) character set latin1 not null) partition by key (a);
-insert into t1 values ('abc');
-select * from t1 where a = 'abc';
-drop table t1;
-create table t1 (a varchar(300) character set latin1 not null) partition by key (a);
-insert into t1 values ('abc');
-select * from t1 where a = 'abc';
-drop table t1;
-create table t1 (a char(10) character set utf8 not null) partition by key (a);
-insert into t1 values ('abc');
-select * from t1 where a = 'abc';
-drop table t1;
-create table t1 (a char(10) character set latin1 not null) partition by key (a);
-insert into t1 values ('abc');
-select * from t1 where a = 'abc';
-drop table t1;
-create table t1 (a enum('y','n') not null) partition by key (a);
-insert into t1 values ('y');
-select * from t1 where a = 'y';
-drop table t1;
-create table t1 (a set('y','n') not null) partition by key (a);
-insert into t1 values ('y');
-select * from t1 where a = 'y';
-drop table t1;
--- echo # test with null allowed
-create table t1 (a bit) partition by key (a);
-insert into t1 values (b'1');
-insert into t1 values (NULL);
-select hex(a) from t1 where a = b'1';
-select hex(a) from t1 where a is NULL;
-select hex(a) from t1 order by a;
-drop table t1;
-create table t1 (a tinyint) partition by key (a);
-insert into t1 values (2);
-select * from t1 where a = 2;
-drop table t1;
-create table t1 (a smallint) partition by key (a);
-insert into t1 values (2);
-select * from t1 where a = 2;
-drop table t1;
-create table t1 (a mediumint) partition by key (a);
-insert into t1 values (2);
-select * from t1 where a = 2;
-drop table t1;
-create table t1 (a int) partition by key (a);
-insert into t1 values (2);
-select * from t1 where a = 2;
-drop table t1;
-create table t1 (a bigint) partition by key (a);
-insert into t1 values (2);
-select * from t1 where a = 2;
-drop table t1;
-create table t1 (a float) partition by key (a);
-insert into t1 values (0.5);
-select * from t1 where a = 0.5;
-drop table t1;
-create table t1 (a double) partition by key (a);
-insert into t1 values (0.5);
-select * from t1 where a = 0.5;
-drop table t1;
-create table t1 (a decimal(4,2)) partition by key (a);
-insert into t1 values (2.1);
-select * from t1 where a = 2.1;
-drop table t1;
-create table t1 (a date) partition by key (a);
-insert into t1 values ('2001-01-01');
-select * from t1 where a = '2001-01-01';
-drop table t1;
-create table t1 (a datetime) partition by key (a);
-insert into t1 values ('2001-01-01 01:02:03');
-select * from t1 where a = '2001-01-01 01:02:03';
-drop table t1;
-create table t1 (a timestamp null) partition by key (a);
-insert into t1 values ('2001-01-01 01:02:03');
-select * from t1 where a = '2001-01-01 01:02:03';
-drop table t1;
-create table t1 (a time) partition by key (a);
-insert into t1 values ('01:02:03');
-select * from t1 where a = '01:02:03';
-drop table t1;
-create table t1 (a year) partition by key (a);
-insert into t1 values ('2001');
-select * from t1 where a = '2001';
-drop table t1;
-create table t1 (a varchar(10) character set utf8) partition by key (a);
-insert into t1 values ('abc');
-select * from t1 where a = 'abc';
-drop table t1;
-create table t1 (a varchar(300) character set utf8) partition by key (a);
-insert into t1 values ('abc');
-select * from t1 where a = 'abc';
-drop table t1;
-create table t1 (a varchar(10) character set latin1) partition by key (a);
-insert into t1 values ('abc');
-select * from t1 where a = 'abc';
-drop table t1;
-create table t1 (a varchar(300) character set latin1) partition by key (a);
-insert into t1 values ('abc');
-select * from t1 where a = 'abc';
-drop table t1;
-create table t1 (a char(10) character set utf8) partition by key (a);
-insert into t1 values ('abc');
-select * from t1 where a = 'abc';
-drop table t1;
-create table t1 (a char(10) character set latin1) partition by key (a);
-insert into t1 values ('abc');
-select * from t1 where a = 'abc';
-drop table t1;
-create table t1 (a enum('y','n')) partition by key (a);
-insert into t1 values ('y');
-select * from t1 where a = 'y';
-drop table t1;
-create table t1 (a set('y','n')) partition by key (a);
-insert into t1 values ('y');
-select * from t1 where a = 'y';
-drop table t1;
-create table t1 (a varchar(3068)) partition by key (a);
-insert into t1 values ('bbbb');
-insert into t1 values ('aaaa');
-select * from t1 where a = 'aaaa';
-select * from t1 where a like 'aaa%';
-select * from t1 where a = 'bbbb';
-drop table t1;
-create table t1 (a varchar(3069)) partition by key (a);
-insert into t1 values ('bbbb');
-insert into t1 values ('aaaa');
-select * from t1 where a = 'aaaa';
-select * from t1 where a like 'aaa%';
-select * from t1 where a = 'bbbb';
-drop table t1;
-create table t1 (a varchar(3070) not null) partition by key (a);
-insert into t1 values ('bbbb');
-insert into t1 values ('aaaa');
-select * from t1 where a = 'aaaa';
-select * from t1 where a like 'aaa%';
-select * from t1 where a = 'bbbb';
-drop table t1;
-set sql_mode='';
--- error ER_PARTITION_FIELDS_TOO_LONG
-create table t1 (a varchar(3070)) partition by key (a);
--- error ER_PARTITION_FIELDS_TOO_LONG
-create table t1 (a varchar(65532) not null) partition by key (a);
--- error ER_BLOB_FIELD_IN_PART_FUNC_ERROR
-create table t1 (a varchar(65533)) partition by key (a);
--- error ER_BLOB_FIELD_IN_PART_FUNC_ERROR
-create table t1 (a varchar(65534) not null) partition by key (a);
--- error ER_BLOB_FIELD_IN_PART_FUNC_ERROR
-create table t1 (a varchar(65535)) partition by key (a);
-set sql_mode=default;
-
-#
-# Bug#34358: error in key_restore for bitfields with uneven bits
-#
-create table t1 (a bit(27), primary key (a)) engine=myisam
-partition by hash (a)
-(partition p0, partition p1, partition p2);
-show create table t1;
-insert into t1 values (1),(4),(7),(10),(13),(16),(19),(22),(25),(28),(31),(34);
-select hex(a) from t1 where a = 7;
-drop table t1;
-
---echo #
---echo # Bug#28928: UNIX_TIMESTAMP() should be considered unary monotonic
---echo # by partition pruning
-SET @old_time_zone= @@session.time_zone;
-SET @@session.time_zone = 'UTC';
---echo # Using MyISAM to get stable values on TABLE_ROWS in I_S.PARTITIONS
-CREATE TABLE t1
-(a TIMESTAMP NULL,
- tz varchar(16))
-ENGINE = MyISAM;
-CREATE TABLE t2 LIKE t1;
-ALTER TABLE t2 PARTITION BY RANGE (UNIX_TIMESTAMP(a))
-(PARTITION `p0` VALUES LESS THAN (0),
- PARTITION `p-2000` VALUES LESS THAN (UNIX_TIMESTAMP(20000101)),
- PARTITION `p-2011-MSK` VALUES LESS THAN (UNIX_TIMESTAMP(20110326230000)),
- PARTITION `p-2011-MSD-1` VALUES LESS THAN (UNIX_TIMESTAMP(20111029220000)),
- PARTITION `p-2011-MSD-2` VALUES LESS THAN (UNIX_TIMESTAMP(20111029230000)),
- PARTITION `p-2012-MSK-1` VALUES LESS THAN (UNIX_TIMESTAMP(20111030000000)),
- PARTITION `p-2012-MSK-2` VALUES LESS THAN (UNIX_TIMESTAMP(20120324230000)),
- PARTITION `pEnd` VALUES LESS THAN (UNIX_TIMESTAMP(20380119031407)),
- PARTITION `pMax` VALUES LESS THAN MAXVALUE);
-
-
---echo # Test 'odd' values
-INSERT INTO t1 VALUES (NULL, 'UTC');
-INSERT INTO t1 VALUES ('0000-00-00 00:00:00', 'UTC');
---echo # Test invalid values
-INSERT IGNORE INTO t1 VALUES ('1901-01-01 00:00:00', 'UTCI');
-INSERT IGNORE INTO t1 VALUES ('1969-12-31 23:59:59', 'UTCI');
-INSERT IGNORE INTO t1 VALUES ('2038-01-19 03:14:08', 'UTCI');
-INSERT IGNORE INTO t1 VALUES ('1970-01-01 00:00:00', 'UTCI');
---echo # Test start range
-INSERT INTO t1 VALUES ('1970-01-01 00:00:01', 'UTC');
-INSERT INTO t1 VALUES ('1974-02-05 21:28:16', 'UTC');
---echo # Test end range
-INSERT INTO t1 VALUES ('2038-01-19 03:14:06', 'UTC');
-INSERT INTO t1 VALUES ('2038-01-19 03:14:07', 'UTC');
---echo # Test Daylight saving shift
-INSERT INTO t1 VALUES ('2011-03-26 22:59:59', 'UTC');
-INSERT INTO t1 VALUES ('2011-03-26 23:00:00', 'UTC');
-INSERT INTO t1 VALUES ('2011-03-26 23:00:01', 'UTC');
-INSERT INTO t1 VALUES ('2011-10-29 21:59:59', 'UTC');
-INSERT INTO t1 VALUES ('2011-10-29 22:00:00', 'UTC');
-INSERT INTO t1 VALUES ('2011-10-29 22:00:01', 'UTC');
-INSERT INTO t1 VALUES ('2011-10-29 22:59:59', 'UTC');
-INSERT INTO t1 VALUES ('2011-10-29 23:00:00', 'UTC');
-INSERT INTO t1 VALUES ('2011-10-29 23:00:01', 'UTC');
-INSERT INTO t1 VALUES ('2011-10-29 23:59:59', 'UTC');
-INSERT INTO t1 VALUES ('2011-10-30 00:00:00', 'UTC');
-INSERT INTO t1 VALUES ('2011-10-30 00:00:01', 'UTC');
-
-SET @@session.time_zone = 'Europe/Moscow';
-
---echo # Test 'odd' values
-INSERT INTO t1 VALUES (NULL, 'Moscow');
-INSERT INTO t1 VALUES ('0000-00-00 00:00:00', 'Moscow');
---echo # Test invalid values
-INSERT IGNORE INTO t1 VALUES ('0000-00-00 03:00:00', 'MoscowI');
-INSERT IGNORE INTO t1 VALUES ('1901-01-01 00:00:00', 'MoscowI');
-INSERT IGNORE INTO t1 VALUES ('1969-12-31 23:59:59', 'MoscowI');
-INSERT IGNORE INTO t1 VALUES ('1970-01-01 02:29:29', 'MoscowI');
-INSERT IGNORE INTO t1 VALUES ('2038-01-19 06:14:08', 'MoscowI');
-INSERT IGNORE INTO t1 VALUES ('1970-01-01 03:00:00', 'MoscowI');
---echo # values truncated to 03:00:00 due to daylight saving shift
-INSERT IGNORE INTO t1 VALUES ('2011-03-27 02:00:00', 'MoscowI');
-INSERT IGNORE INTO t1 VALUES ('2011-03-27 02:00:01', 'MoscowI');
-INSERT IGNORE INTO t1 VALUES ('2011-03-27 02:59:59', 'MoscowI');
---echo # Test start range
-INSERT INTO t1 VALUES ('1970-01-01 03:00:01', 'Moscow');
-INSERT INTO t1 VALUES ('1974-02-05 21:28:16', 'Moscow');
---echo # Test end range
-INSERT INTO t1 VALUES ('2038-01-19 06:14:06', 'Moscow');
-INSERT INTO t1 VALUES ('2038-01-19 06:14:07', 'Moscow');
---echo # Test Daylight saving shift
-INSERT INTO t1 VALUES ('2011-03-27 01:59:59', 'Moscow');
-INSERT INTO t1 VALUES ('2011-03-27 03:00:00', 'Moscow');
-INSERT INTO t1 VALUES ('2011-03-27 03:00:01', 'Moscow');
-INSERT INTO t1 VALUES ('2011-10-30 01:59:59', 'Moscow');
---echo # All values between 02:00 and 02:59:59 will be interpretated as DST
-INSERT INTO t1 VALUES ('2011-10-30 02:00:00', 'MoscowD');
-INSERT INTO t1 VALUES ('2011-10-30 02:00:01', 'MoscowD');
-INSERT INTO t1 VALUES ('2011-10-30 02:59:59', 'MoscowD');
-INSERT INTO t1 VALUES ('2011-10-30 03:00:00', 'Moscow');
-INSERT INTO t1 VALUES ('2011-10-30 03:00:01', 'Moscow');
-
-
-SET @@session.time_zone = 'UTC';
-
-INSERT INTO t2 SELECT * FROM t1;
-
-SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS
-WHERE TABLE_NAME = 't2';
-
-SELECT * FROM t1 ORDER BY a, tz;
-SELECT * FROM t2 ORDER BY a, tz;
-
-SELECT * FROM t2
-WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-26 23:00:00' ORDER BY a, tz;
-EXPLAIN PARTITIONS
-SELECT * FROM t2
-WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-26 23:00:00' ORDER BY a, tz;
-
-SELECT * FROM t2
-WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-26 22:59:59' ORDER BY a, tz;
-EXPLAIN PARTITIONS
-SELECT * FROM t2
-WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-26 22:59:59' ORDER BY a, tz;
-
-
-SELECT * FROM t2
-WHERE a BETWEEN '2011-03-26 22:59:59' and '2011-03-28 00:00:00' ORDER BY a, tz;
-EXPLAIN PARTITIONS
-SELECT * FROM t2
-WHERE a BETWEEN '2011-03-26 22:59:59' and '2011-03-28 00:00:00' ORDER BY a, tz;
-
-SELECT * FROM t2
-WHERE a BETWEEN '2011-03-26 23:00:00' and '2011-03-28 00:00:00' ORDER BY a, tz;
-EXPLAIN PARTITIONS
-SELECT * FROM t2
-WHERE a BETWEEN '2011-03-26 23:00:00' and '2011-03-28 00:00:00' ORDER BY a, tz;
-
-
-
-SELECT * FROM t2
-WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 23:00:00' ORDER BY a, tz;
-EXPLAIN PARTITIONS
-SELECT * FROM t2
-WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 23:00:00' ORDER BY a, tz;
-
-SELECT * FROM t2
-WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 22:59:59' ORDER BY a, tz;
-EXPLAIN PARTITIONS
-SELECT * FROM t2
-WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 22:59:59' ORDER BY a, tz;
-
-
-SELECT * FROM t2
-WHERE a BETWEEN '2011-10-29 22:59:59' and '2011-10-31 00:00:00' ORDER BY a, tz;
-EXPLAIN PARTITIONS
-SELECT * FROM t2
-WHERE a BETWEEN '2011-10-29 22:59:59' and '2011-10-31 00:00:00' ORDER BY a, tz;
-
-SELECT * FROM t2
-WHERE a BETWEEN '2011-10-29 23:00:00' and '2011-10-31 00:00:00' ORDER BY a, tz;
-EXPLAIN PARTITIONS
-SELECT * FROM t2
-WHERE a BETWEEN '2011-10-29 23:00:00' and '2011-10-31 00:00:00' ORDER BY a, tz;
-
-
---echo # Test end range changes
-DELETE FROM t2 WHERE a = 0;
-INSERT IGNORE INTO t2 VALUES ('1970-01-01 00:00:00', 'UTC');
-SELECT COUNT(*) FROM t2;
-SELECT COUNT(*) FROM t2 WHERE a = 0;
-SELECT * FROM t2 ORDER BY a, tz LIMIT 3;
-SELECT * FROM t2 ORDER BY a DESC, tz LIMIT 3;
-UPDATE IGNORE t2 SET a = TIMESTAMPADD(SECOND, 1, a);
-SELECT MIN(a), MAX(a) FROM t2;
-SELECT COUNT(*) FROM t2;
-SELECT COUNT(*) FROM t2 WHERE a = 0;
-SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS
-WHERE TABLE_NAME = 't2';
-SELECT * FROM t2 ORDER BY a, tz;
-
---echo # Test start range changes
-INSERT IGNORE INTO t2 VALUES ('1970-01-01 00:00:00', 'UTC');
-SELECT COUNT(*) FROM t2;
-SELECT COUNT(*) FROM t2 WHERE a = 0;
-SELECT * FROM t2 ORDER BY a, tz LIMIT 3;
-SELECT * FROM t2 ORDER BY a DESC, tz LIMIT 3;
-UPDATE IGNORE t2 SET a = TIMESTAMPADD(SECOND, -1, a);
-SELECT MIN(a), MAX(a) FROM t2;
-SELECT COUNT(*) FROM t2;
-SELECT COUNT(*) FROM t2 WHERE a = 0;
-SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS
-WHERE TABLE_NAME = 't2';
-SELECT * FROM t2 ORDER BY a, tz;
-
-SHOW CREATE TABLE t2;
-TRUNCATE TABLE t2;
-
-SET @@session.time_zone = 'Europe/Moscow';
-
-INSERT INTO t2 SELECT * FROM t1;
-
-SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS
-WHERE TABLE_NAME = 't2';
-
-SELECT * FROM t1 ORDER BY a, tz;
-SELECT * FROM t2 ORDER BY a, tz;
-
---echo # Testing the leap from 01:59:59 to 03:00:00
-SELECT * FROM t2
-WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-27 03:00:00' ORDER BY a, tz;
-EXPLAIN PARTITIONS
-SELECT * FROM t2
-WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-27 03:00:00' ORDER BY a, tz;
-
-SELECT * FROM t2
-WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-27 01:59:59' ORDER BY a, tz;
-EXPLAIN PARTITIONS
-SELECT * FROM t2
-WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-27 01:59:59' ORDER BY a, tz;
-
-
-SELECT * FROM t2
-WHERE a BETWEEN '2011-03-26 01:59:59' and '2011-03-28 00:00:00' ORDER BY a, tz;
-EXPLAIN PARTITIONS
-SELECT * FROM t2
-WHERE a BETWEEN '2011-03-26 01:59:59' and '2011-03-28 00:00:00' ORDER BY a, tz;
-
-SELECT * FROM t2
-WHERE a BETWEEN '2011-03-26 03:00:00' and '2011-03-28 00:00:00' ORDER BY a, tz;
-EXPLAIN PARTITIONS
-SELECT * FROM t2
-WHERE a BETWEEN '2011-03-26 03:00:00' and '2011-03-28 00:00:00' ORDER BY a, tz;
-
-
-
---echo # Testing the leap from 02:59:59 to 02:00:00
-SELECT * FROM t2
-WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 02:00:00' ORDER BY a, tz;
-EXPLAIN PARTITIONS
-SELECT * FROM t2
-WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 02:00:00' ORDER BY a, tz;
-
-SELECT * FROM t2
-WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 02:59:59' ORDER BY a, tz;
-EXPLAIN PARTITIONS
-SELECT * FROM t2
-WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 02:59:59' ORDER BY a, tz;
-
-
-SELECT * FROM t2
-WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 03:00:00' ORDER BY a, tz;
-EXPLAIN PARTITIONS
-SELECT * FROM t2
-WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 03:00:00' ORDER BY a, tz;
-
-SELECT * FROM t2
-WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 01:59:59' ORDER BY a, tz;
-EXPLAIN PARTITIONS
-SELECT * FROM t2
-WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 01:59:59' ORDER BY a, tz;
-
-
-
-SELECT * FROM t2
-WHERE a BETWEEN '2011-10-29 02:00:00' and '2011-10-31 00:00:00' ORDER BY a, tz;
-EXPLAIN PARTITIONS
-SELECT * FROM t2
-WHERE a BETWEEN '2011-10-29 02:00:00' and '2011-10-31 00:00:00' ORDER BY a, tz;
-
-SELECT * FROM t2
-WHERE a BETWEEN '2011-10-29 02:59:59' and '2011-10-31 00:00:00' ORDER BY a, tz;
-EXPLAIN PARTITIONS
-SELECT * FROM t2
-WHERE a BETWEEN '2011-10-29 02:59:59' and '2011-10-31 00:00:00' ORDER BY a, tz;
-
-
-SELECT * FROM t2
-WHERE a BETWEEN '2011-10-29 03:00:00' and '2011-10-31 00:00:00' ORDER BY a, tz;
-EXPLAIN PARTITIONS
-SELECT * FROM t2
-WHERE a BETWEEN '2011-10-29 03:00:00' and '2011-10-31 00:00:00' ORDER BY a, tz;
-
-SELECT * FROM t2
-WHERE a BETWEEN '2011-10-29 01:59:59' and '2011-10-31 00:00:00' ORDER BY a, tz;
-EXPLAIN PARTITIONS
-SELECT * FROM t2
-WHERE a BETWEEN '2011-10-29 01:59:59' and '2011-10-31 00:00:00' ORDER BY a, tz;
-
-
-
---echo # Test end range changes
-DELETE FROM t2 WHERE a = 0;
-INSERT IGNORE INTO t2 VALUES ('1970-01-01 00:00:00', 'Moscow');
-SELECT COUNT(*) FROM t2;
-SELECT COUNT(*) FROM t2 WHERE a = 0;
-SELECT * FROM t2 ORDER BY a, tz LIMIT 3;
-SELECT * FROM t2 ORDER BY a DESC, tz LIMIT 3;
-UPDATE IGNORE t2 SET a = TIMESTAMPADD(SECOND, 1, a);
-SELECT MIN(a), MAX(a) FROM t2;
-SELECT COUNT(*) FROM t2;
-SELECT COUNT(*) FROM t2 WHERE a = 0;
-SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS
-WHERE TABLE_NAME = 't2';
-SELECT * FROM t2 ORDER BY a, tz;
-
---echo # Test start range changes
-INSERT IGNORE INTO t2 VALUES ('1970-01-01 00:00:00', 'Moscow');
-SELECT COUNT(*) FROM t2;
-SELECT COUNT(*) FROM t2 WHERE a = 0;
-SELECT * FROM t2 ORDER BY a, tz LIMIT 3;
-SELECT * FROM t2 ORDER BY a DESC, tz LIMIT 3;
-UPDATE IGNORE t2 SET a = TIMESTAMPADD(SECOND, -1, a);
-SELECT MIN(a), MAX(a) FROM t2;
-SELECT COUNT(*) FROM t2;
-SELECT COUNT(*) FROM t2 WHERE a = 0;
-SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS
-WHERE TABLE_NAME = 't2';
-SELECT * FROM t2 ORDER BY a, tz;
-
-SHOW CREATE TABLE t2;
-TRUNCATE TABLE t2;
-
-DROP TABLE t1, t2;
-SET @@session.time_zone= @old_time_zone;
diff --git a/mysql-test/t/partition_debug_sync.test b/mysql-test/t/partition_debug_sync.test
deleted file mode 100644
index f085ea3fb83..00000000000
--- a/mysql-test/t/partition_debug_sync.test
+++ /dev/null
@@ -1,84 +0,0 @@
-#--disable_abort_on_error
-#
-# Test for the partition storage engine which require DEBUG_SYNC feature to
-# Created by Mattias Jonsson
-#
---source include/have_partition.inc
---source include/have_debug_sync.inc
---source include/have_debug.inc
---source include/have_innodb.inc
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
-SET DEBUG_SYNC= 'RESET';
---enable_warnings
-
---echo #
---echo # Bug#42438: Crash ha_partition::change_table_ptr
---echo # Test when remove partitioning is done while drop table is waiting
---echo # for the table.
---echo # After MDL was introduced, there is no longer any race, so test is done
---echo # by adding a small sleep to verify that the delete waits. This happens
---echo # only until ALTER tries to upgrade its MDL lock, which ends up in MDL
---echo # deadlock which is correctly reported.
-connect(con1, localhost, root,,);
-SET DEBUG_SYNC= 'RESET';
-CREATE TABLE t1
-(a INTEGER,
- b INTEGER NOT NULL,
- KEY (b))
-ENGINE = MYISAM
-/*!50100 PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (2),
- PARTITION p1 VALUES LESS THAN (20),
- PARTITION p2 VALUES LESS THAN (100),
- PARTITION p3 VALUES LESS THAN MAXVALUE ) */;
-SET DEBUG_SYNC= 'alter_table_before_create_table_no_lock SIGNAL removing_partitioning WAIT_FOR waiting_for_alter';
-SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL waiting_for_upgrade';
---send ALTER TABLE t1 REMOVE PARTITIONING
-connection default;
-SET DEBUG_SYNC= 'now WAIT_FOR removing_partitioning';
-SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL waiting_for_alter';
-SET DEBUG_SYNC= 'rm_table_no_locks_before_delete_table WAIT_FOR waiting_for_upgrade';
-DROP TABLE IF EXISTS t1;
-connection con1;
---error ER_LOCK_DEADLOCK
---reap
-connection default;
-SET DEBUG_SYNC= 'RESET';
-connection con1;
-SET DEBUG_SYNC= 'RESET';
-
---echo #
---echo # Bug#42438: Crash ha_partition::change_table_ptr
---echo # Test when remove partitioning is failing due to drop table is already
---echo # in progress.
---echo # After MDL was introduced, there is no longer any race, so test is done
---echo # by adding a small sleep to verify that the alter waits.
-CREATE TABLE t2
-(a INTEGER,
- b INTEGER NOT NULL,
- KEY (b))
-ENGINE = MYISAM
-PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (2),
- PARTITION p1 VALUES LESS THAN (20),
- PARTITION p2 VALUES LESS THAN (100),
- PARTITION p3 VALUES LESS THAN MAXVALUE);
-SET DEBUG_SYNC= 'alter_table_before_open_tables SIGNAL removing_partitions WAIT_FOR waiting_for_alter';
-SET DEBUG_SYNC= 'alter_table_before_rename_result_table WAIT_FOR delete_done';
---send ALTER TABLE t2 REMOVE PARTITIONING
-connection default;
-SET DEBUG_SYNC= 'now WAIT_FOR removing_partitions';
-SET DEBUG_SYNC= 'rm_table_no_locks_before_delete_table SIGNAL waiting_for_alter';
-SET DEBUG_SYNC= 'rm_table_no_locks_before_binlog SIGNAL delete_done';
-DROP TABLE IF EXISTS t2;
-connection con1;
---error ER_NO_SUCH_TABLE
---reap
-SET DEBUG_SYNC= 'RESET';
-disconnect con1;
---source include/wait_until_disconnected.inc
-connection default;
-SET DEBUG_SYNC= 'RESET';
-
---echo End of 5.1 tests
diff --git a/mysql-test/t/partition_default.test b/mysql-test/t/partition_default.test
deleted file mode 100644
index b0424f567e4..00000000000
--- a/mysql-test/t/partition_default.test
+++ /dev/null
@@ -1,542 +0,0 @@
-
---source include/have_partition.inc
-
-#
-# expression lists
-#
-create table t1 (a int, b int)
- PARTITION BY LIST (a)
- (
- PARTITION p2 VALUES IN (4,5,6),
- PARTITION p1 VALUES IN (1)
- )
-;
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-insert into t1 values (10,10);
-drop table t1;
-create table t1 (a int, b int)
- PARTITION BY LIST (a)
- (
- PARTITION p2 VALUES IN (4,5,6),
- PARTITION p1 VALUES IN (1),
- PARTITION p0 DEFAULT
- )
-;
-show create table t1;
-insert into t1 values (10,10);
-insert into t1 values (4,4);
-select * from t1;
---sorted_result
-select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
-drop table t1;
-
---error ER_PARTITION_DEFAULT_ERROR
-create table t1 (a int, b int)
- PARTITION BY LIST (a)
- (
- PARTITION p2 VALUES IN (4,5,6),
- PARTITION p1 VALUES IN (1),
- PARTITION p0 DEFAULT,
- PARTITION p3 DEFAULT
- )
-;
---error ER_PARTITION_DEFAULT_ERROR
-create table t1 (a int, b int)
- PARTITION BY LIST (a)
- (
- PARTITION p0 DEFAULT,
- PARTITION p2 VALUES IN (4,5,6),
- PARTITION p1 VALUES IN (1),
- PARTITION p3 DEFAULT
- )
-;
-
-create table t1 (a int, b int)
- PARTITION BY LIST (a)
- (
- PARTITION p0 DEFAULT,
- PARTITION p2 VALUES IN (4,5,6),
- PARTITION p1 VALUES IN (1)
- )
-;
-show create table t1;
-insert into t1 values (10,10);
-select * from t1;
---sorted_result
-select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
-drop table t1;
-
-#
-# Default has its value as 0 check that they are not clash.
-#
-create table t1 (a int, b int)
- PARTITION BY LIST (a)
- (
- PARTITION p0 DEFAULT,
- PARTITION p2 VALUES IN (4,5,6),
- PARTITION p1 VALUES IN (1, 0)
- )
-;
-show create table t1;
-insert into t1 values (10,10);
-select * from t1;
---sorted_result
-select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
-drop table t1;
-
-#
-# columns lists
-#
-create table t1 (a int, b int)
- PARTITION BY LIST COLUMNS(a,b)
- (
- PARTITION p2 VALUES IN ((1,4),(2,5),(3,6)),
- PARTITION p1 VALUES IN ((1,1),(0,0)),
- PARTITION p0 DEFAULT
- )
-;
-show create table t1;
-insert into t1 values (10,10);
-select * from t1;
---sorted_result
-select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
-drop table t1;
-
---error ER_PARTITION_DEFAULT_ERROR
-create table t1 (a int, b int)
- PARTITION BY LIST COLUMNS(a,b)
- (
- PARTITION p2 VALUES IN ((1,4),(2,5),(3,6)),
- PARTITION p1 VALUES IN ((1,1),(0,0)),
- PARTITION p0 DEFAULT,
- PARTITION p3 DEFAULT
- )
-;
-
---error ER_PARTITION_DEFAULT_ERROR
-create table t1 (a int, b int)
- PARTITION BY LIST COLUMNS(a,b)
- (
- PARTITION p0 DEFAULT,
- PARTITION p2 VALUES IN ((1,4),(2,5),(3,6)),
- PARTITION p1 VALUES IN ((1,1),(0,0)),
- PARTITION p3 DEFAULT
- )
-;
-
-#
-# partititon prunning test
-#
-
-create table t1 (a int, b int)
- PARTITION BY LIST (a)
- (
- PARTITION p2 VALUES IN (4,5,6),
- PARTITION p1 VALUES IN (1,20),
- PARTITION p0 default
- )
-;
-show create table t1;
-insert into t1 values (10,10);
---sorted_result
-select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
-select * from t1 where a=10;
-select * from t1 where a<=10;
-select * from t1 where a<=20;
-select * from t1 where a>=10;
-select * from t1 where a>=5;
-insert into t1 values (20,20),(5,5);
---sorted_result
-select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
-select * from t1 where a=10;
-select * from t1 where a<=10;
-select * from t1 where a<=20;
-select * from t1 where a>=10;
-select * from t1 where a>=5;
-explain partitions select * from t1 where a=10;
-explain partitions select * from t1 where a=5;
-select * from t1 where a=10 or a=5;
-explain partitions select * from t1 where a=10 or a=5;
-
-drop table t1;
-
-create table t1 (a int, b int)
- PARTITION BY LIST COLUMNS(a,b)
- (
- PARTITION p2 VALUES IN ((1,4),(2,5),(3,6),(5,5)),
- PARTITION p1 VALUES IN ((1,1),(20,20)),
- PARTITION p0 DEFAULT
- )
-;
-show create table t1;
-insert into t1 values (10,10);
---sorted_result
-select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
-select * from t1 where a=10 and b=10;
-explain partitions select * from t1 where a=10 and b=10;
-select * from t1 where a=10;
-explain partitions select * from t1 where a=10;
-select * from t1 where a<=10;
-select * from t1 where a>=10;
-insert into t1 values (20,20),(5,5);
---sorted_result
-select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
-select * from t1 where a=10 and b=10;
-explain partitions select * from t1 where a=10 and b=10;
-select * from t1 where a=10 and b=10 or a=20 and b=20;
-explain partitions select * from t1 where a=10 and b=10 or a=20 and b=20;
-drop table t1;
-
-#
-# partition pruning with expressions
-#
-create table t1 (a int, b int);
-
-insert into t1 values (10,10),(2,5),(0,0);
-
-select * from t1;
-
-alter table t1
- PARTITION BY LIST (a+b)
- (
- PARTITION p2 VALUES IN (1,2,3,7),
- PARTITION p1 VALUES IN (21,0),
- PARTITION p0 DEFAULT
- )
-;
-show create table t1;
-select * from t1;
-explain partitions select * from t1 where a=2 and b=5;
-explain partitions select * from t1 where a=10 and b=10;
-drop table t1;
-
-create table t1 (a int, b int);
-
-insert into t1 values (10,10),(2,5),(0,0);
-
-select * from t1;
-
-alter table t1
- PARTITION BY LIST (a+5)
- (
- PARTITION p2 VALUES IN (1,2,3,7),
- PARTITION p1 VALUES IN (0),
- PARTITION p0 DEFAULT
- )
-;
-show create table t1;
-select * from t1;
---sorted_result
-select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
-explain partitions select * from t1 where a>=2;
-explain partitions select * from t1 where a>=2 and a<=3;
-explain partitions select * from t1 where a=10;
-drop table t1;
-
-
-
-CREATE TABLE t1 (a DATE, KEY(a))
-PARTITION BY LIST (TO_DAYS(a))
-(PARTITION `pDEF` DEFAULT,
- PARTITION `p2001-01-01` VALUES IN (TO_DAYS('2001-01-01')),
- PARTITION `pNULL` VALUES IN (NULL),
- PARTITION `p0000-01-02` VALUES IN (TO_DAYS('0000-01-02')),
- PARTITION `p1001-01-01` VALUES IN (TO_DAYS('1001-01-01')));
-if ($verify_without_partitions)
-{
-ALTER TABLE t1 REMOVE PARTITIONING;
-}
-INSERT INTO t1 VALUES ('0000-00-00'), ('0000-01-02'), ('0001-01-01'),
- ('1001-00-00'), ('1001-01-01'), ('1002-00-00'), ('2001-01-01');
---source include/partition_date_range.inc
---echo # test without index
-ALTER TABLE t1 DROP KEY a;
---source include/partition_date_range.inc
-DROP TABLE t1;
---echo # TO_SECONDS, test of LIST and index
-CREATE TABLE t1 (a DATE, KEY(a))
-PARTITION BY LIST (TO_SECONDS(a))
-(PARTITION `pDEF` DEFAULT,
- PARTITION `p2001-01-01` VALUES IN (TO_SECONDS('2001-01-01')),
- PARTITION `pNULL` VALUES IN (NULL),
- PARTITION `p0000-01-02` VALUES IN (TO_SECONDS('0000-01-02')),
- PARTITION `p1001-01-01` VALUES IN (TO_SECONDS('1001-01-01')));
-if ($verify_without_partitions)
-{
-ALTER TABLE t1 REMOVE PARTITIONING;
-}
-INSERT INTO t1 VALUES ('0000-00-00'), ('0000-01-02'), ('0001-01-01'),
- ('1001-00-00'), ('1001-01-01'), ('1002-00-00'), ('2001-01-01');
---source include/partition_date_range.inc
---echo # test without index
-ALTER TABLE t1 DROP KEY a;
---source include/partition_date_range.inc
-DROP TABLE t1;
-
-#
-# ALTER TABLE test
-#
-
-create table t1 (a int, b int);
-
-insert into t1 values (10,10),(2,5),(0,0);
-
-select * from t1;
-
-alter table t1
- PARTITION BY LIST (a)
- (
- PARTITION p2 VALUES IN (1,2,3),
- PARTITION p1 VALUES IN (20,0),
- PARTITION p0 DEFAULT
- )
-;
-show create table t1;
-select * from t1;
---sorted_result
-select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
-explain partitions select * from t1 where a=2 and b=5;
-explain partitions select * from t1 where a=10 and b=10;
-alter table t1
- PARTITION BY LIST (a)
- (
- PARTITION p2 VALUES IN (1,2,3),
- PARTITION p1 VALUES IN (20,0),
- PARTITION p0 VALUES IN (10)
- )
-;
-show create table t1;
-select * from t1;
---sorted_result
-select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
-explain partitions select * from t1 where a=2 and b=5;
-explain partitions select * from t1 where a=10 and b=10;
-alter table t1
- PARTITION BY LIST (a)
- (
- PARTITION p2 DEFAULT,
- PARTITION p1 VALUES IN (20,0),
- PARTITION p0 VALUES IN (10)
- )
-;
-show create table t1;
-select * from t1;
---sorted_result
-select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
-explain partitions select * from t1 where a=2 and b=5;
-explain partitions select * from t1 where a=10 and b=10;
-
-alter table t1 drop partition p2;
-show create table t1;
-select * from t1;
---sorted_result
-select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
-
-alter table t1 add partition (PARTITION pd DEFAULT);
-show create table t1;
---error ER_PARTITION_DEFAULT_ERROR
-alter table t1 add partition (PARTITION pdd DEFAULT);
-alter table t1 drop partition pd;
---error ER_PARTITION_DEFAULT_ERROR
-alter table t1 add partition (PARTITION pdd DEFAULT,
- PARTITION pd DEFAULT);
-
-drop table t1;
-
-create table t1 (a int, b int);
-
-insert into t1 values (10,10),(2,5),(0,0);
-
-select * from t1;
-
-alter table t1
- PARTITION BY LIST COLUMNS(a,b)
- (
- PARTITION p2 VALUES IN ((1,4),(2,5),(3,6)),
- PARTITION p1 VALUES IN ((1,1),(0,0)),
- PARTITION p0 DEFAULT
- )
-;
-show create table t1;
-select * from t1;
---sorted_result
-select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
-explain partitions select * from t1 where a=2 and b=5;
-explain partitions select * from t1 where a=10 and b=10;
-alter table t1
- PARTITION BY LIST COLUMNS(a,b)
- (
- PARTITION p2 VALUES IN ((1,4),(2,5),(3,6)),
- PARTITION p1 VALUES IN ((1,1),(0,0)),
- PARTITION p0 VALUES IN ((10,10))
- )
-;
-show create table t1;
-select * from t1;
---sorted_result
-select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
-explain partitions select * from t1 where a=2 and b=5;
-explain partitions select * from t1 where a=10 and b=10;
-alter table t1
- PARTITION BY LIST COLUMNS(a,b)
- (
- PARTITION p2 DEFAULT,
- PARTITION p1 VALUES IN ((1,1),(0,0)),
- PARTITION p0 VALUES IN ((10,10))
- )
-;
-show create table t1;
-select * from t1;
---sorted_result
-select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
-explain partitions select * from t1 where a=2 and b=5;
-explain partitions select * from t1 where a=10 and b=10;
-
-alter table t1 drop partition p2;
-show create table t1;
-select * from t1;
---sorted_result
-select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
-
-alter table t1 add partition (PARTITION pd DEFAULT);
-show create table t1;
---error ER_PARTITION_DEFAULT_ERROR
-alter table t1 add partition (PARTITION pdd DEFAULT);
-alter table t1 drop partition pd;
---error ER_PARTITION_DEFAULT_ERROR
-alter table t1 add partition (PARTITION pdd DEFAULT,
- PARTITION pd DEFAULT);
-drop table t1;
-
-
-#
-# Problem of reorganizing DEFAULT partition
-#
-create table t1 (a int)
- PARTITION BY LIST (a)
- (
- PARTITION p2 VALUES IN (4,5,6),
- PARTITION p1 VALUES IN (1),
- PARTITION pd DEFAULT
- )
-;
-insert into t1 values (1),(2),(3),(4);
---sorted_result
-select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
-
-alter table t1 add partition
- (partition p0 VALUES IN (2,3));
-
---sorted_result
-select partition_name, table_rows from INFORMATION_SCHEMA.PARTITIONS where table_name='t1';
-
-drop table t1;
-
-#
-# Check that first DEFAULT works in LIST COLUMN
-#
-create table t1 (a int, b int)
- PARTITION BY LIST COLUMNS(a,b)
- (
- PARTITION p0 DEFAULT,
- PARTITION p2 VALUES IN ((1,4),(2,5),(3,6)),
- PARTITION p1 VALUES IN ((1,1),(0,0))
- )
-;
-
-show create table t1;
-
-drop table t1;
-
---echo #
---echo # MDEV-10765: Wrong result - query does not retrieve values from
---echo # default partition on a table partitioned by list columns
---echo #
-
-create table t1 (i int, j int) partition by list columns(i,j) (partition p1 values in ((10,10)), partition p2 default);
-insert into t1 values (10,1);
-select * from t1 where i = 10;
-explain partitions
-select * from t1 where i = 10;
-select * from t1 where i = 10 and j=1;
-explain partitions
-select * from t1 where i = 10 and j=1;
-insert into t1 values (10,10);
-select * from t1 where i = 10 and j=10;
-explain partitions
-select * from t1 where i = 10 and j=10;
-drop table t1;
-
-create table t1
-(
- a int not null,
- b int not null,
- c int
-)
-partition by list columns(a,b)
-(
- partition p1 values in ((10,10)),
- partition p2 values in ((10,20)),
- partition p3 values in ((10,30)),
- partition p4 values in ((10,40)),
- partition p5 values in ((10,50))
-);
-
-insert into t1 values
- (10,10,1234),
- (10,20,1234),
- (10,30,1234),
- (10,40,1234),
- (10,50,1234);
-
-explain partitions
-select * from t1
-where a>=10 and (a <=10 and b <=30);
-drop table t1;
-
---echo #
---echo # MDEV-10763: Wrong result - server does not return NULL values
---echo # from default list partition after ALTER table
---echo #
-create table t1 (i int) partition by list (i) ( partition p1 default);
-insert into t1 values (null);
-select * from t1 where i is null;
-alter table t1 partition by list (i) ( partition p1 values in (1), partition p2 default);
-select * from t1 where i is null;
-explain partitions
-select * from t1 where i is null;
-alter table t1 partition by list (i) (
- partition p0 values in (NULL),
- partition p1 values in (1),
- partition p2 default);
-select * from t1 where i is null;
-explain partitions
-select * from t1 where i is null;
-
-drop table t1;
-
-
---echo #
---echo # MDEV-12395: DROP PARTITION does not work as expected when
---echo # table has DEFAULT LIST partition
---echo #
-
-CREATE TABLE t1 (i INT)
- PARTITION BY LIST (i)
- (PARTITION p VALUES IN (1,2,3,4),
- PARTITION pdef DEFAULT);
-INSERT INTO t1 VALUES (1),(10);
-ALTER TABLE t1 DROP PARTITION p;
-SELECT * FROM t1;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (i INT)
- PARTITION BY LIST (i)
- (PARTITION p VALUES IN (1,2,3,4),
- PARTITION pdef DEFAULT);
-INSERT INTO t1 VALUES (1),(10);
-ALTER TABLE t1 DROP PARTITION pdef;
-SELECT * FROM t1;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
diff --git a/mysql-test/t/partition_disabled-master.opt b/mysql-test/t/partition_disabled-master.opt
deleted file mode 100644
index 2703cb02f07..00000000000
--- a/mysql-test/t/partition_disabled-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-skip-partition
diff --git a/mysql-test/t/partition_disabled.test b/mysql-test/t/partition_disabled.test
deleted file mode 100644
index 940aea105ce..00000000000
--- a/mysql-test/t/partition_disabled.test
+++ /dev/null
@@ -1,104 +0,0 @@
---disable_abort_on_error
-# Run this test only when mysqld has partitioning, but it is disabled.
-# The statements are not expected to work, just check that we
-# can't crash the server.
-if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME = 'partition' AND PLUGIN_STATUS='DISABLED'`)
-{
- --skip Test requires disabled partitioning
-}
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-let $MYSQLD_DATADIR= `SELECT @@datadir`;
-
-#
-# Bug#39893: Crash if select on a partitioned table,
-# when partitioning is disabled
-FLUSH TABLES;
---copy_file $MYSQLTEST_VARDIR/std_data/parts/t1.frm $MYSQLD_DATADIR/test/t1.frm
-SELECT * FROM t1;
-TRUNCATE TABLE t1;
-ANALYZE TABLE t1;
-CHECK TABLE t1;
-OPTIMIZE TABLE t1;
-REPAIR TABLE t1;
-ALTER TABLE t1 REPAIR PARTITION ALL;
-ALTER TABLE t1 CHECK PARTITION ALL;
-ALTER TABLE t1 OPTIMIZE PARTITION ALL;
-ALTER TABLE t1 ANALYZE PARTITION ALL;
-ALTER TABLE t1 REBUILD PARTITION ALL;
-ALTER TABLE t1 ENGINE Memory;
-ALTER TABLE t1 ADD (new INT);
---disable_warnings
-DROP TABLE t1;
---enable_warnings
-
---error ER_OPTION_PREVENTS_STATEMENT
-CREATE TABLE t1 (
- firstname VARCHAR(25) NOT NULL,
- lastname VARCHAR(25) NOT NULL,
- username VARCHAR(16) NOT NULL,
- email VARCHAR(35),
- joined DATE NOT NULL
-)
-PARTITION BY KEY(joined)
-PARTITIONS 6;
-
---error ER_OPTION_PREVENTS_STATEMENT
-ALTER TABLE t1 PARTITION BY KEY(joined) PARTITIONS 2;
-
---error ER_BAD_TABLE_ERROR
-drop table t1;
-
---error ER_OPTION_PREVENTS_STATEMENT
-CREATE TABLE t1 (
- firstname VARCHAR(25) NOT NULL,
- lastname VARCHAR(25) NOT NULL,
- username VARCHAR(16) NOT NULL,
- email VARCHAR(35),
- joined DATE NOT NULL
-)
-PARTITION BY RANGE( YEAR(joined) ) (
- PARTITION p0 VALUES LESS THAN (1960),
- PARTITION p1 VALUES LESS THAN (1970),
- PARTITION p2 VALUES LESS THAN (1980),
- PARTITION p3 VALUES LESS THAN (1990),
- PARTITION p4 VALUES LESS THAN MAXVALUE
-);
---error ER_BAD_TABLE_ERROR
-drop table t1;
-
---error ER_OPTION_PREVENTS_STATEMENT
-CREATE TABLE t1 (id INT, purchased DATE)
- PARTITION BY RANGE( YEAR(purchased) )
- SUBPARTITION BY HASH( TO_DAYS(purchased) )
- SUBPARTITIONS 2 (
- PARTITION p0 VALUES LESS THAN (1990),
- PARTITION p1 VALUES LESS THAN (2000),
- PARTITION p2 VALUES LESS THAN MAXVALUE
- );
---error ER_BAD_TABLE_ERROR
-drop table t1;
-
-# Create a table without partitions to test "EXPLAIN PARTITIONS"
-create table t1 (a varchar(10) charset latin1 collate latin1_bin);
-insert into t1 values (''),(' '),('a'),('a '),('a ');
-explain partitions select * from t1 where a='a ' OR a='a';
-drop table t1;
-
---echo #
---echo # bug#11760213-52599: ALTER TABLE REMOVE PARTITIONING ON NON-PARTITIONED
---echo # TABLE CORRUPTS MYISAM
---disable_warnings
-DROP TABLE if exists `t1`;
---enable_warnings
-CREATE TABLE `t1`(`a` INT)ENGINE=myisam;
-ALTER TABLE `t1` ADD COLUMN `b` INT;
-CREATE UNIQUE INDEX `i1` ON `t1`(`b`);
-CREATE UNIQUE INDEX `i2` ON `t1`(`a`);
-ALTER TABLE `t1` ADD PRIMARY KEY (`a`);
---error ER_PARTITION_MGMT_ON_NONPARTITIONED
-ALTER TABLE `t1` REMOVE PARTITIONING;
-CHECK TABLE `t1` EXTENDED;
-DROP TABLE t1;
-
diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test
deleted file mode 100644
index 3ee54605c36..00000000000
--- a/mysql-test/t/partition_error.test
+++ /dev/null
@@ -1,2076 +0,0 @@
-#
-# Simple test for the erroneos statements using the
-# partition storage engine
-#
--- source include/have_partition.inc
-
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-
-let $MYSQLD_DATADIR= `SELECT @@datadir`;
-
---echo #
---echo # Bug#60039: crash when exchanging a partition on
---echo # nonpartitioned table with a view
---echo #
-CREATE TABLE t1 (a int);
-CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1;
---error ER_CHECK_NO_SUCH_TABLE
-ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE v1;
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#13608188 - 64038: CRASH IN HANDLER::HA_THD ON ALTER TABLE AFTER
---echo # REPAIR NON-EXISTING PARTITION
---echo #
-CREATE TABLE t1 ( a INT, b INT );
-INSERT INTO t1 VALUES (5,3),(5,6);
-ALTER TABLE t1 PARTITION BY KEY(b) PARTITIONS 3 ;
-ALTER TABLE t1 REPAIR PARTITION p1, p3;
-ALTER TABLE t1 ORDER BY b;
-DROP TABLE t1;
-
---echo #
---echo # Bug#13593865 - 64037: CRASH IN HA_PARTITION::CREATE_HANDLERS ON
---echo # ALTER TABLE AFTER DROP PARTITION
---echo #
-
-CREATE TABLE t1 (a INT)
-PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (0),
- PARTITION p1 VALUES LESS THAN MAXVALUE ) ;
-
-ALTER TABLE t1 DROP PARTITION p1;
-ALTER TABLE t1 ANALYZE PARTITION p0, p1;
-
-ALTER TABLE t1 COMMENT 'altered';
-
-DROP TABLE t1;
-
---echo #
---echo # Bug#57924: crash when creating partitioned table with
---echo # multiple columns in the partition key
---echo #
---error ER_SAME_NAME_PARTITION_FIELD
-CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b))
-PARTITION BY KEY(a, b, a);
-CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b))
-PARTITION BY KEY(A, b);
-DROP TABLE t1;
---error ER_SAME_NAME_PARTITION_FIELD
-CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b))
-PARTITION BY KEY(a, b, A);
-
-
---echo #
---echo # Bug#54483: valgrind errors when making warnings for multiline inserts
---echo # into partition
---echo #
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARBINARY(10))
-PARTITION BY RANGE (DAYOFWEEK(a))
-(PARTITION a1 VALUES LESS THAN (60));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a CHAR(10))
-PARTITION BY RANGE (DAYOFWEEK(a))
-(PARTITION a1 VALUES LESS THAN (60));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY RANGE (DAYOFWEEK(a))
-(PARTITION a1 VALUES LESS THAN (60));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a TIMESTAMP)
-PARTITION BY RANGE (DAYOFWEEK(a))
-(PARTITION a1 VALUES LESS THAN (60));
-CREATE TABLE t1 (a DATE)
-PARTITION BY RANGE (DAYOFWEEK(a))
-(PARTITION a1 VALUES LESS THAN (60));
-INSERT IGNORE INTO t1 VALUES ('test'),('a'),('5');
-SHOW WARNINGS;
-DROP TABLE t1;
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY RANGE (DAYOFWEEK(a))
-(PARTITION a1 VALUES LESS THAN (60));
-INSERT IGNORE INTO t1 VALUES ('test'),('a'),('5');
-SHOW WARNINGS;
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a TIME)
-PARTITION BY RANGE (DAYOFWEEK(a))
-(PARTITION a1 VALUES LESS THAN (60));
-SHOW WARNINGS;
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (TO_DAYS(a));
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (TO_DAYS(a));
-DROP TABLE t1;
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (TO_DAYS(a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (TO_DAYS(a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (TO_DAYS(a));
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (DAYOFMONTH(a));
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (DAYOFMONTH(a));
-DROP TABLE t1;
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (DAYOFMONTH(a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (DAYOFMONTH(a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (DAYOFMONTH(a));
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (MONTH(a));
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (MONTH(a));
-DROP TABLE t1;
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (MONTH(a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (MONTH(a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (MONTH(a));
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (DAYOFYEAR(a));
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (DAYOFYEAR(a));
-DROP TABLE t1;
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (DAYOFYEAR(a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (DAYOFYEAR(a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (DAYOFYEAR(a));
-
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (HOUR(a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (HOUR(a));
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (HOUR(a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (HOUR(a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (HOUR(a));
-
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (MINUTE(a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (MINUTE(a));
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (MINUTE(a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (MINUTE(a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (MINUTE(a));
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (QUARTER(a));
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (QUARTER(a));
-DROP TABLE t1;
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (QUARTER(a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (QUARTER(a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (QUARTER(a));
-
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (SECOND(a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (SECOND(a));
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (SECOND(a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (SECOND(a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (SECOND(a));
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (YEARWEEK(a));
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (YEARWEEK(a));
-DROP TABLE t1;
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (YEARWEEK(a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (YEARWEEK(a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (YEARWEEK(a));
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (WEEKDAY(a));
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (WEEKDAY(a));
-DROP TABLE t1;
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (WEEKDAY(a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (WEEKDAY(a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (WEEKDAY(a));
-
---echo # TO_SECONDS() is added in 5.5.
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (TO_SECONDS(a));
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (TO_SECONDS(a));
-DROP TABLE t1;
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (TO_SECONDS(a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (TO_SECONDS(a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (TO_SECONDS(a));
-
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (TIME_TO_SEC(a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (TIME_TO_SEC(a));
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (TIME_TO_SEC(a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (TIME_TO_SEC(a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (TIME_TO_SEC(a));
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (FROM_DAYS(a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (FROM_DAYS(a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (FROM_DAYS(a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (TO_DAYS(FROM_DAYS(a)));
---error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (FROM_DAYS(a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (TO_DAYS(FROM_DAYS(a)));
---error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (FROM_DAYS(a));
-
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (MICROSECOND(a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (MICROSECOND(a));
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (MICROSECOND(a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (MICROSECOND(a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (MICROSECOND(a));
---echo # Bug#57071
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1
-(`date` date,
- `extracted_week` int,
- `yearweek` int,
- `week` int,
- `default_week_format` int)
-PARTITION BY LIST (EXTRACT(WEEK FROM date) % 3)
-(PARTITION p0 VALUES IN (0),
- PARTITION p1 VALUES IN (1),
- PARTITION p2 VALUES IN (2));
-CREATE TABLE t1
-(`date` date,
- `extracted_week` int,
- `yearweek` int,
- `week` int,
- `default_week_format` int);
-SET @old_default_week_format := @@default_week_format;
-SET default_week_format = 0;
-INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
-SET default_week_format = 1;
-INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
-SET default_week_format = 2;
-INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
-SET default_week_format = 3;
-INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
-SET default_week_format = 4;
-INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
-SET default_week_format = 5;
-INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
-SET default_week_format = 6;
-INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
-SET default_week_format = 7;
-INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format);
-SELECT * FROM t1;
-SET default_week_format = @old_default_week_format;
-DROP TABLE t1;
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (EXTRACT(YEAR FROM a));
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (EXTRACT(YEAR FROM a));
-DROP TABLE t1;
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (EXTRACT(YEAR FROM a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (EXTRACT(YEAR FROM a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (EXTRACT(YEAR FROM a));
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a));
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a));
-DROP TABLE t1;
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a));
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (EXTRACT(QUARTER FROM a));
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (EXTRACT(QUARTER FROM a));
-DROP TABLE t1;
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (EXTRACT(QUARTER FROM a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (EXTRACT(QUARTER FROM a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (EXTRACT(QUARTER FROM a));
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (EXTRACT(MONTH FROM a));
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (EXTRACT(MONTH FROM a));
-DROP TABLE t1;
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (EXTRACT(MONTH FROM a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (EXTRACT(MONTH FROM a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (EXTRACT(MONTH FROM a));
-
---echo # EXTRACT(WEEK...) is disallowed, see bug#57071.
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (EXTRACT(WEEK FROM a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (EXTRACT(WEEK FROM a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (EXTRACT(WEEK FROM a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (EXTRACT(WEEK FROM a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (EXTRACT(WEEK FROM a));
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (EXTRACT(DAY FROM a));
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (EXTRACT(DAY FROM a));
-DROP TABLE t1;
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (EXTRACT(DAY FROM a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (EXTRACT(DAY FROM a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (EXTRACT(DAY FROM a));
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a));
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a));
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a));
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a));
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a));
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a));
-
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (EXTRACT(HOUR FROM a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (EXTRACT(HOUR FROM a));
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (EXTRACT(HOUR FROM a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (EXTRACT(HOUR FROM a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (EXTRACT(HOUR FROM a));
-
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a));
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a));
-
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a));
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a));
-
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (EXTRACT(MINUTE FROM a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (EXTRACT(MINUTE FROM a));
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (EXTRACT(MINUTE FROM a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (EXTRACT(MINUTE FROM a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (EXTRACT(MINUTE FROM a));
-
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a));
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a));
-
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (EXTRACT(SECOND FROM a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (EXTRACT(SECOND FROM a));
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (EXTRACT(SECOND FROM a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (EXTRACT(SECOND FROM a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (EXTRACT(SECOND FROM a));
-
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (EXTRACT(MICROSECOND FROM a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (EXTRACT(MICROSECOND FROM a));
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (EXTRACT(MICROSECOND FROM a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (EXTRACT(MICROSECOND FROM a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (EXTRACT(MICROSECOND FROM a));
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a));
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a));
-
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a));
-
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a));
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a));
-
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a));
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a));
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a TIME, b DATE)
-PARTITION BY HASH (DATEDIFF(a, b));
-CREATE TABLE t1 (a DATE, b DATETIME)
-PARTITION BY HASH (DATEDIFF(a, b));
-DROP TABLE t1;
-CREATE TABLE t1 (a DATETIME, b DATE)
-PARTITION BY HASH (DATEDIFF(a, b));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a DATE, b VARCHAR(10))
-PARTITION BY HASH (DATEDIFF(a, b));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT, b DATETIME)
-PARTITION BY HASH (DATEDIFF(a, b));
-
-CREATE TABLE t1 (a TIME)
-PARTITION BY HASH (TIME_TO_SEC(a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a DATE)
-PARTITION BY HASH (TIME_TO_SEC(a));
-CREATE TABLE t1 (a DATETIME)
-PARTITION BY HASH (TIME_TO_SEC(a));
-DROP TABLE t1;
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a VARCHAR(10))
-PARTITION BY HASH (TIME_TO_SEC(a));
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (TIME_TO_SEC(a));
-
---echo #
---echo # Bug#50036: Inconsistent errors when using TIMESTAMP
---echo # columns/expressions
-
---echo # 1. correct and appropriate errors in light of
---echo # the fix for BUG#42849:
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (c TIMESTAMP)
-PARTITION BY RANGE (TO_DAYS(c))
-(PARTITION p0 VALUES LESS THAN (10000),
- PARTITION p1 VALUES LESS THAN (MAXVALUE));
-CREATE TABLE t2 (c TIMESTAMP);
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-ALTER TABLE t2
-PARTITION BY RANGE (TO_DAYS(c))
-(PARTITION p0 VALUES LESS THAN (10000),
- PARTITION p1 VALUES LESS THAN (MAXVALUE));
-
---error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
-CREATE TABLE t1 (c TIMESTAMP)
-PARTITION BY RANGE COLUMNS(c)
-(PARTITION p0 VALUES LESS THAN ('2000-01-01 00:00:00'),
- PARTITION p1 VALUES LESS THAN (MAXVALUE));
---error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
-ALTER TABLE t2 PARTITION BY RANGE COLUMNS(c)
-(PARTITION p0 VALUES LESS THAN ('2000-01-01 00:00:00'),
- PARTITION p1 VALUES LESS THAN (MAXVALUE));
-DROP TABLE t2;
-
---echo # 2. These errors where questionable before the fix:
-
---echo # VALUES clause are checked first, clearified the error message.
---error ER_VALUES_IS_NOT_INT_TYPE_ERROR
-CREATE TABLE t1 (c TIMESTAMP)
-PARTITION BY RANGE (c)
-(PARTITION p0 VALUES LESS THAN ('2000-01-01 00:00:00'),
- PARTITION p1 VALUES LESS THAN (MAXVALUE));
-
---echo # TIMESTAMP is not INT (e.g. UNIX_TIMESTAMP).
---error ER_VALUES_IS_NOT_INT_TYPE_ERROR
-CREATE TABLE t1 (c TIMESTAMP)
-PARTITION BY RANGE (UNIX_TIMESTAMP(c))
-(PARTITION p0 VALUES LESS THAN ('2000-01-01 00:00:00'),
- PARTITION p1 VALUES LESS THAN (MAXVALUE));
-
-CREATE TABLE t1 (c TIMESTAMP)
-PARTITION BY RANGE (UNIX_TIMESTAMP(c))
-(PARTITION p0 VALUES LESS THAN (UNIX_TIMESTAMP(20000101000000)),
- PARTITION p1 VALUES LESS THAN (MAXVALUE));
-DROP TABLE t1;
-
---echo # Changed error from ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR
---error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
-CREATE TABLE t1 (c TIMESTAMP)
-PARTITION BY HASH (c) PARTITIONS 4;
-
---echo # Moved to partition_myisam, since it was MyISAM specific
---echo # Added test with existing TIMESTAMP partitioning (when it was allowed).
-
---echo #
---echo # Bug#49477: Assertion `0' failed in ha_partition.cc:5530
---echo # with temporary table and partitions
---echo #
-CREATE TABLE t1 (a INT) PARTITION BY HASH(a);
---error ER_PARTITION_NO_TEMPORARY
-CREATE TEMPORARY TABLE tmp_t1 LIKE t1;
-DROP TABLE t1;
---echo #
---echo # Bug#42954: SQL MODE 'NO_DIR_IN_CREATE' does not work with
---echo # subpartitions
-let $curr_engine=`select @@default_storage_engine`;
-SET @org_mode=@@sql_mode;
-SET @@sql_mode='NO_DIR_IN_CREATE';
-SELECT @@sql_mode;
-CREATE TABLE t1 (id INT, purchased DATE)
-PARTITION BY RANGE(YEAR(purchased))
-SUBPARTITION BY HASH(TO_DAYS(purchased))
-(PARTITION p0 VALUES LESS THAN MAXVALUE
- DATA DIRECTORY = '/tmp/not-existing'
- INDEX DIRECTORY = '/tmp/not-existing');
---replace_result $curr_engine <curr_engine>
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-CREATE TABLE t1 (id INT, purchased DATE)
-PARTITION BY RANGE(YEAR(purchased))
-SUBPARTITION BY HASH(TO_DAYS(purchased)) SUBPARTITIONS 2
-(PARTITION p0 VALUES LESS THAN MAXVALUE
- (SUBPARTITION sp0
- DATA DIRECTORY = '/tmp/not-existing'
- INDEX DIRECTORY = '/tmp/not-existing',
- SUBPARTITION sp1));
---replace_result $curr_engine <curr_engine>
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-CREATE TABLE t1 (id INT, purchased DATE)
-PARTITION BY RANGE(YEAR(purchased))
-(PARTITION p0 VALUES LESS THAN MAXVALUE
- DATA DIRECTORY = '/tmp/not-existing'
- INDEX DIRECTORY = '/tmp/not-existing');
---replace_result $curr_engine <curr_engine>
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-SET @@sql_mode= @org_mode;
-
-#
-# Bug#38719: Partitioning returns a different error code for a
-# duplicate key error
-CREATE TABLE t1 (a INTEGER NOT NULL, PRIMARY KEY (a));
--- error ER_DUP_ENTRY
-INSERT INTO t1 VALUES (1),(1);
-DROP TABLE t1;
-CREATE TABLE t1 (a INTEGER NOT NULL, PRIMARY KEY (a))
-PARTITION BY KEY (a) PARTITIONS 2;
--- error ER_DUP_ENTRY
-INSERT INTO t1 VALUES (1),(1);
-DROP TABLE t1;
-
-#
-# Bug 29368:
-# Incorrect error, 1467, for syntax error when creating partition
---error ER_PARTITION_REQUIRES_VALUES_ERROR
-CREATE TABLE t1 (
- a int
-)
-PARTITION BY RANGE (a)
-(
- PARTITION p0 VALUES LESS THAN (1),
- PARTITION p1 VALU ES LESS THAN (2)
-);
-
-#
-# Partition by key stand-alone error
-#
---error ER_PARSE_ERROR
-partition by list (a)
-partitions 3
-(partition x1 values in (1,2,9,4) tablespace ts1,
- partition x2 values in (3, 11, 5, 7) tablespace ts2,
- partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
-
-#
-# Partition by key list, number of partitions defined, no partition defined
-#
---error ER_PARTITIONS_MUST_BE_DEFINED_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by list (a)
-partitions 2;
-
-#
-# Partition by key list, wrong result type
-#
---error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by list (sin(a))
-partitions 3
-(partition x1 values in (1,2,9,4) tablespace ts1,
- partition x2 values in (3, 11, 5, 7) tablespace ts2,
- partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
-
-#
-# Partition by key, partition function not allowed
-#
---error ER_PARSE_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by key (a+2)
-partitions 3
-(partition x1 tablespace ts1,
- partition x2 tablespace ts2,
- partition x3 tablespace ts3);
-
-#
-# Partition by key, no partition name
-#
---error ER_PARSE_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by key (a)
-partitions 3
-(partition tablespace ts1,
- partition x2 tablespace ts2,
- partition x3 tablespace ts3);
-
-#
-# Partition by key, invalid field in field list
-#
---error ER_FIELD_NOT_FOUND_PART_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by key (a,d)
-partitions 3
-(partition x1 tablespace ts1,
- partition x2 tablespace ts2,
- partition x3 tablespace ts3);
-
-select load_file('$MYSQLD_DATADIR/test/t1.par');
-#
-# Partition by hash, invalid field in function
-#
---error ER_BAD_FIELD_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by hash (a + d)
-partitions 3
-(partition x1 tablespace ts1,
- partition x2 tablespace ts2,
- partition x3 tablespace ts3);
-
-#
-# Partition by hash, invalid result type
-#
---error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by hash (sin(a))
-partitions 3
-(partition x1 tablespace ts1,
- partition x2 tablespace ts2,
- partition x3 tablespace ts3);
-
-#
-# Partition by key specified 3 partitions but only defined 2 => error
-#
---error ER_PARSE_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by key (a)
-partitions 3
-(partition x1, partition x2);
-
-#
-# Partition by hash, random function
-#
---error ER_PARSE_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by hash (rand(a))
-partitions 2
-(partition x1, partition x2);
-
-#
-# Partition by range, random function
-#
---error ER_PARSE_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by range (rand(a))
-partitions 2
-(partition x1 values less than (0), partition x2 values less than (2));
-
-#
-# Partition by list, random function
-#
---error ER_PARSE_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by list (rand(a))
-partitions 2
-(partition x1 values in (1), partition x2 values in (2));
-
-#
-# Partition by hash, values less than error
-#
---error ER_PARTITION_WRONG_VALUES_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by hash (a)
-partitions 2
-(partition x1 values less than (4),
- partition x2 values less than (5));
-select load_file('$MYSQLD_DATADIR/test/t1.par');
-
-#
-# Partition by hash, values in error
-#
---error ER_PARTITION_WRONG_VALUES_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by hash (a)
-partitions 2
-(partition x1 values in (4),
- partition x2 values in (5));
-select load_file('$MYSQLD_DATADIR/test/t1.par');
-
-#
-# Partition by hash, values in error
-#
---error ER_PARTITION_WRONG_VALUES_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by hash (a)
-partitions 2
-(partition x1 values in (4,6),
- partition x2 values in (5,7));
-select load_file('$MYSQLD_DATADIR/test/t1.par');
-
-#
-# Subpartition by key, no partitions defined, single field
-#
---error ER_SUBPARTITION_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key (a,b))
-partition by key (a)
-subpartition by key (b);
-select load_file('$MYSQLD_DATADIR/test/t1.par');
-
-#
-# Subpartition by key, no partitions defined, list of fields
-#
---error ER_SUBPARTITION_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key (a,b))
-partition by key (a)
-subpartition by key (a, b);
-select load_file('$MYSQLD_DATADIR/test/t1.par');
-
-#
-# Subpartition by hash, no partitions defined
-#
---error ER_SUBPARTITION_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key (a,b))
-partition by key (a)
-subpartition by hash (a+b);
-select load_file('$MYSQLD_DATADIR/test/t1.par');
-
-#
-# Subpartition by key, no partitions defined, single field
-#
---error ER_SUBPARTITION_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key (a,b))
-partition by key (a)
-subpartition by key (b);
-select load_file('$MYSQLD_DATADIR/test/t1.par');
-
-#
-# Subpartition by key, no partitions defined, list of fields
-#
---error ER_SUBPARTITION_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key (a,b))
-partition by key (a)
-subpartition by key (a, b);
-select load_file('$MYSQLD_DATADIR/test/t1.par');
-
-#
-# Subpartition by hash, no partitions defined
-#
---error ER_SUBPARTITION_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key (a,b))
-partition by key (a)
-subpartition by hash (a+b);
-select load_file('$MYSQLD_DATADIR/test/t1.par');
-
-#
-# Subpartition by hash, no partitions defined, wrong subpartition function
-#
---error ER_PARSE_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key (a,b))
-partition by key (a)
-subpartition by hash (rand(a+b));
-
-#
-# Subpartition by hash, wrong subpartition function
-#
---error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key (a,b))
-partition by key (a)
-subpartition by hash (sin(a+b))
-(partition x1 (subpartition x11, subpartition x12),
- partition x2 (subpartition x21, subpartition x22));
-select load_file('$MYSQLD_DATADIR/test/t1.par');
-
-#
-# Subpartition by hash, no partitions defined, wrong subpartition function
-#
---error ER_PARSE_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key (a,b))
-partition by range (a)
-subpartition by key (a+b)
-(partition x1 values less than (1) (subpartition x11, subpartition x12),
- partition x2 values less than (2) (subpartition x21, subpartition x22));
-
-#
-# Subpartition by hash, no partitions defined, wrong subpartition function
-#
---error ER_FIELD_NOT_FOUND_PART_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key (a,b))
-partition by range (a)
-subpartition by key (a,d)
-(partition x1 values less than (1) (subpartition x11, subpartition x12),
- partition x2 values less than (2) (subpartition x21, subpartition x22));
-select load_file('$MYSQLD_DATADIR/test/t1.par');
-
-#
-# Subpartition by hash, no partitions defined, wrong subpartition function
-#
---error ER_SUBPARTITION_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key (a,b))
-partition by key (a)
-subpartition by hash (3+4);
-
-#
-# Subpartition by hash, no partitions defined, wrong subpartition function
-#
---error ER_BAD_FIELD_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key (a,b))
-partition by range (a)
-subpartition by hash (a+d)
-(partition x1 values less than (1) (subpartition x11, subpartition x12),
- partition x2 values less than (2) (subpartition x21, subpartition x22));
-
-#
-# Partition by range, no partition => error
-#
---error ER_PARTITIONS_MUST_BE_DEFINED_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by range (a);
-select load_file('$MYSQLD_DATADIR/test/t1.par');
-
-#
-# Partition by range, invalid field in function
-#
---error ER_BAD_FIELD_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by range (a+d)
-partitions 2
-(partition x1 values less than (4) tablespace ts1,
- partition x2 values less than (8) tablespace ts2);
-
-#
-# Partition by range, inconsistent partition function and constants
-#
---error ER_VALUES_IS_NOT_INT_TYPE_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (4.0) tablespace ts1,
- partition x2 values less than (8) tablespace ts2);
-
-#
-# Partition by range, constant partition function not allowed
-#
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by range (3+4)
-partitions 2
-(partition x1 values less than (4) tablespace ts1,
- partition x2 values less than (8) tablespace ts2);
-
-#
-# Partition by range, no values less than definition
-#
---error ER_PARTITION_REQUIRES_VALUES_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (4),
- partition x2);
-
-#
-# Partition by range, no values in definition allowed
-#
---error ER_PARTITION_WRONG_VALUES_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by range (a)
-partitions 2
-(partition x1 values in (4),
- partition x2);
-
-#
-# Partition by range, values in error
-#
---error ER_PARTITION_WRONG_VALUES_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by range (a)
-partitions 2
-(partition x1 values in (4),
- partition x2 values less than (5));
-
-#
-# Partition by range, missing parenthesis
-#
---error ER_PARTITION_WRONG_VALUES_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by list (a)
-partitions 2
-(partition x1 values less than 4,
- partition x2 values less than (5));
-
-#
-# Partition by range, maxvalue in wrong place
-#
---error ER_PARTITION_MAXVALUE_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by range (a)
-partitions 2
-(partition x1 values less than maxvalue,
- partition x2 values less than (5));
-
-#
-# Partition by range, maxvalue in several places
-#
---error ER_PARTITION_MAXVALUE_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by range (a)
-partitions 2
-(partition x1 values less than maxvalue,
- partition x2 values less than maxvalue);
-
-#
-# Partition by range, not increasing ranges
-#
---error ER_RANGE_NOT_INCREASING_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (4),
- partition x2 values less than (3));
-
-#
-# Partition by range, wrong result type of partition function
-#
---error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by range (sin(a))
-partitions 2
-(partition x1 values less than (4),
- partition x2 values less than (5));
-
-#
-# Subpartition by hash, wrong number of subpartitions
-#
---error ER_PARSE_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key (a,b))
-partition by list (a)
-subpartition by hash (a+b)
-subpartitions 3
-( partition x1 values in (1,2,4)
- ( subpartition x11 nodegroup 0,
- subpartition x12 nodegroup 1),
- partition x2 values in (3,5,6)
- ( subpartition x21 nodegroup 0,
- subpartition x22 nodegroup 1)
-);
-
-#
-# Subpartition by hash, wrong number of subpartitions
-#
---error ER_PARSE_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key (a,b))
-partition by list (a)
-subpartition by hash (a+b)
-( partition x1 values in (1)
- ( subpartition x11 nodegroup 0,
- subpartition xextra,
- subpartition x12 nodegroup 1),
- partition x2 values in (2)
- ( subpartition x21 nodegroup 0,
- subpartition x22 nodegroup 1)
-);
-
-#
-# Subpartition by list => error
-#
---error ER_PARSE_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key (a,b))
-partition by key (a)
-subpartition by list (a+b)
-( partition x1
- ( subpartition x11 engine myisam,
- subpartition x12 engine myisam),
- partition x2
- ( subpartition x21 engine myisam,
- subpartition x22 engine myisam)
-);
-
-#
-# Subpartition by list => error
-#
---error ER_PARSE_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key (a,b))
-partition by key (a)
-subpartition by list (a+b)
-( partition x1
- ( subpartition x11 engine myisam values in (0),
- subpartition x12 engine myisam values in (1)),
- partition x2
- ( subpartition x21 engine myisam values in (0),
- subpartition x22 engine myisam values in (1))
-);
-
-#
-# Partition by list, no partition => error
-#
---error ER_PARTITIONS_MUST_BE_DEFINED_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by list (a);
-
-#
-# Partition by list, constant partition function not allowed
-#
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by list (3+4)
-partitions 2
-(partition x1 values in (4) tablespace ts1,
- partition x2 values in (8) tablespace ts2);
-
-#
-# Partition by list, invalid field in function
-#
---error ER_BAD_FIELD_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by list (a+d)
-partitions 2
-(partition x1 values in (4) tablespace ts1,
- partition x2 values in (8) tablespace ts2);
-
-#
-# Partition by list, no values in definition
-#
---error ER_PARTITION_REQUIRES_VALUES_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by list (a)
-partitions 2
-(partition x1 values in (4),
- partition x2);
-
-#
-# Partition by list, values less than error
-#
---error ER_PARTITION_WRONG_VALUES_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by list (a)
-partitions 2
-(partition x1 values in (4),
- partition x2 values less than (5));
-
-#
-# Partition by list, no values in definition
-#
---error ER_PARTITION_REQUIRES_VALUES_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by list (a)
-partitions 2
-(partition x1 values in (4,6),
- partition x2);
-
-#
-# Partition by list, duplicate values
-#
---error ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by list (a)
-partitions 2
-(partition x1 values in (4, 12+9),
- partition x2 values in (3, 21));
-
-#
-# Partition by list, wrong constant result type (not INT)
-#
---error ER_VALUES_IS_NOT_INT_TYPE_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by list (a)
-partitions 2
-(partition x1 values in (4.0, 12+8),
- partition x2 values in (3, 21));
-
-#
-# Partition by list, missing parenthesis
-#
---error ER_PARSE_ERROR
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by list (a)
-partitions 2
-(partition x1 values in 4,
- partition x2 values in (5));
-
-#
-# Bug #13439: Crash when LESS THAN (non-literal)
-#
---error ER_BAD_FIELD_ERROR
-CREATE TABLE t1 (a int)
-PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (x1));
-
-#
-# No partition for the given value
-#
-CREATE TABLE t1(a int)
- PARTITION BY RANGE (a) (PARTITION p1 VALUES LESS THAN(5));
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-insert into t1 values (10);
-drop table t1;
-
---error ER_PARTITION_CONST_DOMAIN_ERROR
-create table t1 (a bigint unsigned)
-partition by range (a)
-(partition p0 values less than (-1));
-#
-# Bug 18198 Partitions: Verify that erroneus partition functions doesn't work
-#
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (v varchar(12))
-partition by range (ascii(v))
-(partition p0 values less than (10));
-#drop table t1;
-
--- error ER_PARSE_ERROR
-create table t1 (a int)
-partition by hash (rand(a));
--- error ER_PARSE_ERROR
-create table t1 (a int)
-partition by hash(CURTIME() + a);
--- error ER_PARSE_ERROR
-create table t1 (a int)
-partition by hash (NOW()+a);
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (a int)
-partition by hash (extract(hour from convert_tz(a, '+00:00', '+00:00')));
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (a int)
-partition by range (a + (select count(*) from t1))
-(partition p1 values less than (1));
--- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (a char(10))
-partition by hash (extractvalue(a,'a'));
-
---echo #
---echo # Bug #42849: innodb crash with varying time_zone on partitioned
---echo # timestamp primary key
---echo #
-
-# A correctly partitioned table to test that trying to repartition it using
-# timezone-dependent expression will throw an error.
-CREATE TABLE old (a TIMESTAMP NOT NULL PRIMARY KEY)
-PARTITION BY RANGE (UNIX_TIMESTAMP(a)) (
-PARTITION p VALUES LESS THAN (1219089600),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
-# Check that allowed arithmetic/math functions involving TIMESTAMP values result
-# in ER_PARTITION_FUNC_NOT_ALLOWED_ERROR when used as a partitioning function
-
---error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
-CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
-PARTITION BY RANGE (a) (
-PARTITION p VALUES LESS THAN (20080819),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD
-ALTER TABLE old
-PARTITION BY RANGE (a) (
-PARTITION p VALUES LESS THAN (20080819),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
-PARTITION BY RANGE (a+0) (
-PARTITION p VALUES LESS THAN (20080819),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-ALTER TABLE old
-PARTITION BY RANGE (a+0) (
-PARTITION p VALUES LESS THAN (20080819),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
-PARTITION BY RANGE (a % 2) (
-PARTITION p VALUES LESS THAN (20080819),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-ALTER TABLE old
-PARTITION BY RANGE (a % 2) (
-PARTITION p VALUES LESS THAN (20080819),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
-PARTITION BY RANGE (ABS(a)) (
-PARTITION p VALUES LESS THAN (20080819),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-ALTER TABLE old
-PARTITION BY RANGE (ABS(a)) (
-PARTITION p VALUES LESS THAN (20080819),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
-PARTITION BY RANGE (CEILING(a)) (
-PARTITION p VALUES LESS THAN (20080819),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-ALTER TABLE old
-PARTITION BY RANGE (CEILING(a)) (
-PARTITION p VALUES LESS THAN (20080819),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
-PARTITION BY RANGE (FLOOR(a)) (
-PARTITION p VALUES LESS THAN (20080819),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-ALTER TABLE old
-PARTITION BY RANGE (FLOOR(a)) (
-PARTITION p VALUES LESS THAN (20080819),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
-# Check that allowed date/time functions involving TIMESTAMP values result
-# in ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR when used as a partitioning function
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
-PARTITION BY RANGE (TO_DAYS(a)) (
-PARTITION p VALUES LESS THAN (733638),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-ALTER TABLE old
-PARTITION BY RANGE (TO_DAYS(a)) (
-PARTITION p VALUES LESS THAN (733638),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
-PARTITION BY RANGE (DAYOFYEAR(a)) (
-PARTITION p VALUES LESS THAN (231),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-ALTER TABLE old
-PARTITION BY RANGE (DAYOFYEAR(a)) (
-PARTITION p VALUES LESS THAN (231),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
-PARTITION BY RANGE (DAYOFMONTH(a)) (
-PARTITION p VALUES LESS THAN (19),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-ALTER TABLE old
-PARTITION BY RANGE (DAYOFMONTH(a)) (
-PARTITION p VALUES LESS THAN (19),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
-PARTITION BY RANGE (DAYOFWEEK(a)) (
-PARTITION p VALUES LESS THAN (3),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-ALTER TABLE old
-PARTITION BY RANGE (DAYOFWEEK(a)) (
-PARTITION p VALUES LESS THAN (3),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
-PARTITION BY RANGE (MONTH(a)) (
-PARTITION p VALUES LESS THAN (8),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-ALTER TABLE old
-PARTITION BY RANGE (MONTH(a)) (
-PARTITION p VALUES LESS THAN (8),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
-PARTITION BY RANGE (HOUR(a)) (
-PARTITION p VALUES LESS THAN (17),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-ALTER TABLE old
-PARTITION BY RANGE (HOUR(a)) (
-PARTITION p VALUES LESS THAN (17),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
-PARTITION BY RANGE (MINUTE(a)) (
-PARTITION p VALUES LESS THAN (55),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-ALTER TABLE old
-PARTITION BY RANGE (MINUTE(a)) (
-PARTITION p VALUES LESS THAN (55),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
-PARTITION BY RANGE (QUARTER(a)) (
-PARTITION p VALUES LESS THAN (3),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-ALTER TABLE old
-PARTITION BY RANGE (QUARTER(a)) (
-PARTITION p VALUES LESS THAN (3),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
-PARTITION BY RANGE (SECOND(a)) (
-PARTITION p VALUES LESS THAN (7),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-ALTER TABLE old
-PARTITION BY RANGE (SECOND(a)) (
-PARTITION p VALUES LESS THAN (7),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
-PARTITION BY RANGE (YEARWEEK(a)) (
-PARTITION p VALUES LESS THAN (200833),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-ALTER TABLE old
-PARTITION BY RANGE (YEARWEEK(a)) (
-PARTITION p VALUES LESS THAN (200833),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
-PARTITION BY RANGE (YEAR(a)) (
-PARTITION p VALUES LESS THAN (2008),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-ALTER TABLE old
-PARTITION BY RANGE (YEAR(a)) (
-PARTITION p VALUES LESS THAN (2008),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
-PARTITION BY RANGE (WEEKDAY(a)) (
-PARTITION p VALUES LESS THAN (3),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-ALTER TABLE old
-PARTITION BY RANGE (WEEKDAY(a)) (
-PARTITION p VALUES LESS THAN (3),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
-PARTITION BY RANGE (TIME_TO_SEC(a)) (
-PARTITION p VALUES LESS THAN (64507),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-ALTER TABLE old
-PARTITION BY RANGE (TIME_TO_SEC(a)) (
-PARTITION p VALUES LESS THAN (64507),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
-PARTITION BY RANGE (EXTRACT(DAY FROM a)) (
-PARTITION p VALUES LESS THAN (18),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-ALTER TABLE old
-PARTITION BY RANGE (EXTRACT(DAY FROM a)) (
-PARTITION p VALUES LESS THAN (18),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE new (a TIMESTAMP NOT NULL, b TIMESTAMP NOT NULL, PRIMARY KEY(a,b))
-PARTITION BY RANGE (DATEDIFF(a, a)) (
-PARTITION p VALUES LESS THAN (18),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-ALTER TABLE old
-PARTITION BY RANGE (DATEDIFF(a, a)) (
-PARTITION p VALUES LESS THAN (18),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
-PARTITION BY RANGE (YEAR(a + 0)) (
-PARTITION p VALUES LESS THAN (2008),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-ALTER TABLE old
-PARTITION BY RANGE (YEAR(a + 0)) (
-PARTITION p VALUES LESS THAN (2008),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
-PARTITION BY RANGE (TO_DAYS(a + '2008-01-01')) (
-PARTITION p VALUES LESS THAN (733638),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-ALTER TABLE old
-PARTITION BY RANGE (TO_DAYS(a + '2008-01-01')) (
-PARTITION p VALUES LESS THAN (733638),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE new (a TIMESTAMP NOT NULL PRIMARY KEY)
-PARTITION BY RANGE (YEAR(a + '2008-01-01')) (
-PARTITION p VALUES LESS THAN (2008),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-ALTER TABLE old
-PARTITION BY RANGE (YEAR(a + '2008-01-01')) (
-PARTITION p VALUES LESS THAN (2008),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
-ALTER TABLE old ADD COLUMN b DATE;
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE new (a TIMESTAMP, b DATE)
-PARTITION BY RANGE (YEAR(a + b)) (
-PARTITION p VALUES LESS THAN (2008),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-ALTER TABLE old
-PARTITION BY RANGE (YEAR(a + b)) (
-PARTITION p VALUES LESS THAN (2008),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE new (a TIMESTAMP, b DATE)
-PARTITION BY RANGE (TO_DAYS(a + b)) (
-PARTITION p VALUES LESS THAN (733638),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-ALTER TABLE old
-PARTITION BY RANGE (TO_DAYS(a + b)) (
-PARTITION p VALUES LESS THAN (733638),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE new (a TIMESTAMP, b date)
-PARTITION BY RANGE (UNIX_TIMESTAMP(a + b)) (
-PARTITION p VALUES LESS THAN (1219089600),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-ALTER TABLE old
-PARTITION BY RANGE (UNIX_TIMESTAMP(a + b)) (
-PARTITION p VALUES LESS THAN (1219089600),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-CREATE TABLE new (a TIMESTAMP, b TIMESTAMP)
-PARTITION BY RANGE (UNIX_TIMESTAMP(a + b)) (
-PARTITION p VALUES LESS THAN (1219089600),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
-ALTER TABLE old MODIFY b TIMESTAMP;
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-ALTER TABLE old
-PARTITION BY RANGE (UNIX_TIMESTAMP(a + b)) (
-PARTITION p VALUES LESS THAN (1219089600),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
-DROP TABLE old;
-
---echo #
---echo # Bug #56709: Memory leaks at running the 5.1 test suite
---echo #
-
-CREATE TABLE t1 (a TIMESTAMP NOT NULL PRIMARY KEY);
-
---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-ALTER TABLE t1
-PARTITION BY RANGE (EXTRACT(DAY FROM a)) (
-PARTITION p VALUES LESS THAN (18),
-PARTITION pmax VALUES LESS THAN MAXVALUE);
-
-DROP TABLE t1;
-
---echo End of 5.1 tests
-
-#
-# MDEV-7113 difference between check_vcol_func_processor and check_partition_func_processor
-#
---error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (a int) partition by list (values(a) div 1) (partition p0 values in (0), partition p1 values in (1));
-
---error ER_PARSE_ERROR
-create table t1 (a int) partition by list (uuid_short()) (partition p0 values in (0), partition p1 values in (1));
-
---echo End of 5.5 tests
-
-CREATE TABLE t1 (a INT)
-PARTITION BY LIST (a)
-SUBPARTITION BY HASH (a) SUBPARTITIONS 2
-(PARTITION p1 VALUES IN (1) COMMENT "Comment in p1"
- (SUBPARTITION p1spFirst COMMENT "SubPartition comment in p1spFirst",
- SUBPARTITION p1spSecond COMMENT "SubPartition comment in p1spSecond"),
- PARTITION p2 VALUES IN (2) COMMENT "Comment in p2"
- (SUBPARTITION p2spFirst COMMENT "SubPartition comment in p2spFirst",
- SUBPARTITION p2spSecond COMMENT "SubPartition comment in p2spSecond"));
-SHOW CREATE TABLE t1;
-SELECT PARTITION_NAME, SUBPARTITION_NAME, PARTITION_COMMENT FROM INFORMATION_SCHEMA.PARTITIONS
-WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test';
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT)
-PARTITION BY LIST (a)
-SUBPARTITION BY HASH (a) SUBPARTITIONS 2
-(PARTITION p1 VALUES IN (1)
- (SUBPARTITION p1spFirst COMMENT "SubPartition comment in p1spFirst",
- SUBPARTITION p1spSecond),
- PARTITION p2 VALUES IN (2) COMMENT "Comment in p2"
- (SUBPARTITION p2spFirst,
- SUBPARTITION p2spSecond COMMENT "SubPartition comment in p2spSecond"));
-SHOW CREATE TABLE t1;
-SELECT PARTITION_NAME, SUBPARTITION_NAME, PARTITION_COMMENT FROM INFORMATION_SCHEMA.PARTITIONS
-WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test';
-DROP TABLE t1;
-
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-CREATE TABLE t1
-(a INT ,
- KEY inx_a (a) )
-PARTITION BY RANGE (a)
-SUBPARTITION BY HASH (a) SUBPARTITIONS 2
-(PARTITION pUpTo10 VALUES LESS THAN (10) COMMENT
-"This is a long comment (2050 ascii characters) 50 pUpTo10 partition ......80-!.................. 100 ................................................................................................ 200....................................................................................................................................................................................................................................................................................................... 500 ............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... 1000 ..............1024-|.......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... 1500 .............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................. 2000 ......................................2048-|++"
- (SUBPARTITION `p-10sp0` ,SUBPARTITION `p-10sp1` ),
- PARTITION pMax VALUES LESS THAN MAXVALUE COMMENT
-"This is a long comment (2050 ascii characters) 50 pMax partition comment .80-!.................. 100 ................................................................................................ 200....................................................................................................................................................................................................................................................................................................... 500 ............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... 1000 ..............1024-|.......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... 1500 .............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................. 2000 ......................................2048-|++"
- (SUBPARTITION `pMaxsp0` ,SUBPARTITION `pMaxsp1` ));
-
-SHOW CREATE TABLE t1;
-SELECT PARTITION_NAME, SUBPARTITION_NAME, PARTITION_COMMENT FROM INFORMATION_SCHEMA.PARTITIONS
-WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test';
-
-DROP TABLE t1;
diff --git a/mysql-test/t/partition_example.test b/mysql-test/t/partition_example.test
deleted file mode 100644
index 8c1b92b2e33..00000000000
--- a/mysql-test/t/partition_example.test
+++ /dev/null
@@ -1,23 +0,0 @@
---source include/not_windows_embedded.inc
---source include/have_example_plugin.inc
---source include/have_partition.inc
-
---replace_regex /\.dll/.so/
-eval install plugin example soname '$HA_EXAMPLE_SO';
-
-create table t1 (a int not null)
-engine=example
-partition by list (a)
-(partition p0 values in (1), partition p1 values in (2));
-show create table t1;
-drop table t1;
-
-create table t1 (a int not null)
-engine=example ull=12340
-partition by list (a)
-(partition p0 values in (1), partition p1 values in (2));
-show create table t1;
-drop table t1;
-
-select 1;
-uninstall plugin example;
diff --git a/mysql-test/t/partition_exchange-master.opt b/mysql-test/t/partition_exchange-master.opt
deleted file mode 100644
index 5a0380b7a1d..00000000000
--- a/mysql-test/t/partition_exchange-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-innodb_default_row_format=COMPACT
diff --git a/mysql-test/t/partition_exchange.test b/mysql-test/t/partition_exchange.test
deleted file mode 100644
index 8dc40da0caa..00000000000
--- a/mysql-test/t/partition_exchange.test
+++ /dev/null
@@ -1,525 +0,0 @@
---source include/have_innodb.inc
---source include/have_partition.inc
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2, t3, t, tp, tsp, tmp;
---enable_warnings
-
---echo #
---echo # Bug#11894100: EXCHANGE PARTITION CAN'T BE EXECUTED IF
---echo # ROW_FORMAT WAS SET EXPLICITLY
---echo #
-
---echo # Same definition (both have ROW_FORMAT set)
-CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- year year(2) DEFAULT NULL,
- modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
- PRIMARY KEY (id)
-) ENGINE=InnoDB ROW_FORMAT=COMPACT
-PARTITION BY HASH (id)
-PARTITIONS 2;
-
-CREATE TABLE t2 LIKE t1;
-ALTER TABLE t2 REMOVE PARTITIONING;
-
---vertical_results
-SHOW CREATE TABLE t1;
-SHOW CREATE TABLE t2;
-
-SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS
-FROM INFORMATION_SCHEMA.TABLES
-WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2')
-ORDER BY TABLE_NAME;
-
-ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2;
-SHOW CREATE TABLE t1;
-SHOW CREATE TABLE t2;
-SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS
-FROM INFORMATION_SCHEMA.TABLES
-WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2')
-ORDER BY TABLE_NAME;
-
-DROP TABLE t2;
-
---echo # Only the partitioned table have ROW_FORMAT set.
-CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- year year(2) DEFAULT NULL,
- modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
- PRIMARY KEY (id)
-) ENGINE=InnoDB;
-
-ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2;
-SHOW CREATE TABLE t1;
-SHOW CREATE TABLE t2;
-SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS
-FROM INFORMATION_SCHEMA.TABLES
-WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2')
-ORDER BY TABLE_NAME;
-
---echo # Only the non partitioned table have ROW_FORMAT set.
-DROP TABLE t1, t2;
-CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- year year(2) DEFAULT NULL,
- modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
- PRIMARY KEY (id)
-) ENGINE=InnoDB
-PARTITION BY HASH (id)
-PARTITIONS 2;
-CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- year year(2) DEFAULT NULL,
- modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
- PRIMARY KEY (id)
-) ENGINE=InnoDB ROW_FORMAT = COMPACT;
-
-ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2;
-SHOW CREATE TABLE t1;
-SHOW CREATE TABLE t2;
-SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS
-FROM INFORMATION_SCHEMA.TABLES
-WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2')
-ORDER BY TABLE_NAME;
-
---echo # No table have ROW_FORMAT set.
-DROP TABLE t1, t2;
-CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- year year(2) DEFAULT NULL,
- modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
- PRIMARY KEY (id)
-) ENGINE=InnoDB
-PARTITION BY HASH (id)
-PARTITIONS 2;
-CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- year year(2) DEFAULT NULL,
- modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
- PRIMARY KEY (id)
-) ENGINE=InnoDB;
-
-ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2;
-SHOW CREATE TABLE t1;
-SHOW CREATE TABLE t2;
-SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS
-FROM INFORMATION_SCHEMA.TABLES
-WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2')
-ORDER BY TABLE_NAME;
-
---echo # Not same ROW_FORMAT as default (but same).
-DROP TABLE t1, t2;
-CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- year year(2) DEFAULT NULL,
- modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
- PRIMARY KEY (id)
-) ENGINE=InnoDB ROW_FORMAT = REDUNDANT
-PARTITION BY HASH (id)
-PARTITIONS 2;
-CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- year year(2) DEFAULT NULL,
- modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
- PRIMARY KEY (id)
-) ENGINE=InnoDB ROW_FORMAT = REDUNDANT;
-
-ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2;
-SHOW CREATE TABLE t1;
-SHOW CREATE TABLE t2;
-SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS
-FROM INFORMATION_SCHEMA.TABLES
-WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2')
-ORDER BY TABLE_NAME;
-
---echo # Not same ROW_FORMAT as default (tables differs).
-DROP TABLE t1, t2;
-CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- year year(2) DEFAULT NULL,
- modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
- PRIMARY KEY (id)
-) ENGINE=InnoDB
-PARTITION BY HASH (id)
-PARTITIONS 2;
-CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- year year(2) DEFAULT NULL,
- modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
- PRIMARY KEY (id)
-) ENGINE=InnoDB ROW_FORMAT = REDUNDANT;
-
---error ER_PARTITION_EXCHANGE_DIFFERENT_OPTION
-ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2;
-SHOW CREATE TABLE t1;
-SHOW CREATE TABLE t2;
-SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS
-FROM INFORMATION_SCHEMA.TABLES
-WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2')
-ORDER BY TABLE_NAME;
-
---echo # Different than default (forced ROW_TYPE)
-DROP TABLE t1, t2;
-CREATE TABLE t1 (
- id int(11) NOT NULL AUTO_INCREMENT,
- year year(2) DEFAULT NULL,
- modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
- PRIMARY KEY (id)
-) ENGINE=InnoDB ROW_FORMAT = COMPACT
-PARTITION BY HASH (id)
-PARTITIONS 2;
-CREATE TABLE t2 (
- id int(11) NOT NULL AUTO_INCREMENT,
- year year(2) DEFAULT NULL,
- modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
- PRIMARY KEY (id)
-) ENGINE=InnoDB ROW_FORMAT = REDUNDANT;
-
---error ER_PARTITION_EXCHANGE_DIFFERENT_OPTION
-ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2;
-SHOW CREATE TABLE t1;
-SHOW CREATE TABLE t2;
-SELECT TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, CREATE_OPTIONS
-FROM INFORMATION_SCHEMA.TABLES
-WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME IN ('t1', 't2')
-ORDER BY TABLE_NAME;
---horizontal_results
-DROP TABLE t1, t2;
-
---echo #
---echo # Bug#56484: !table || (!table->read_set ||
---echo # bitmap_is_set(table->read_set, field_index))
---echo #
-CREATE TABLE t1 (a INT NOT NULL,b TIME NOT NULL DEFAULT '00:00:00')
-ENGINE=MyISAM
-PARTITION BY HASH (a) PARTITIONS 2;
-
-CREATE TABLE t2 (a INT) ENGINE=MYISAM;
---error ER_TABLES_DIFFERENT_METADATA
-ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2;
-DROP TABLE t1, t2;
-
---echo #
---echo # Bug#55784: Foreign key integrity broken by alter table
---echo #
-CREATE TABLE t1 (s1 INT PRIMARY KEY) ENGINE=InnoDB;
-
-CREATE TABLE t2 (s1 INT, FOREIGN KEY (s1) REFERENCES t1 (s1)) ENGINE=InnoDB;
-
-INSERT INTO t1 VALUES (1),(2),(3);
-
-INSERT INTO t2 VALUES (1),(2),(3);
-
-CREATE TABLE t3 (s1 INT PRIMARY KEY)
- ENGINE=InnoDB
- PARTITION BY LIST (s1)
- (PARTITION p1 VALUES IN (1,2,3));
-
---error ER_PARTITION_EXCHANGE_FOREIGN_KEY
-ALTER TABLE t3 EXCHANGE PARTITION p1 WITH TABLE t1;
-
-DROP TABLE t2, t1, t3;
-
---echo # Tests for WL#4445
-CREATE TABLE t (a INT,
- b VARCHAR(55),
- PRIMARY KEY (a))
-ENGINE = MyISAM;
-
-CREATE TABLE tp (a INT,
- b VARCHAR(55),
- PRIMARY KEY (a))
-ENGINE = MyISAM
-PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (100),
- PARTITION p1 VALUES LESS THAN MAXVALUE);
-
-CREATE TABLE tsp (a INT,
- b VARCHAR(55),
- PRIMARY KEY (a))
-ENGINE = MyISAM
-PARTITION BY RANGE (a)
-SUBPARTITION BY HASH(a)
-(PARTITION p0 VALUES LESS THAN (100)
- (SUBPARTITION sp0,
- SUBPARTITION sp1),
- PARTITION p1 VALUES LESS THAN MAXVALUE
- (SUBPARTITION sp2,
- SUBPARTITION sp3));
-
-INSERT INTO t VALUES (1, "First value"), (3, "Three"), (5, "Five"), (99, "End of values");
-INSERT INTO tp VALUES (2, "First value"), (10, "Ten"), (50, "Fifty"), (200, "Two hundred, end of values"), (61, "Sixty one"), (62, "Sixty two"), (63, "Sixty three"), (64, "Sixty four"), (161, "161"), (162, "162"), (163, "163"), (164, "164");
-INSERT INTO tsp VALUES (2, "First value"), (10, "Ten"), (50, "Fifty"), (200, "Two hundred, end of values"), (61, "Sixty one"), (62, "Sixty two"), (63, "Sixty three"), (64, "Sixty four"), (161, "161"), (162, "162"), (163, "163"), (164, "164");
-SHOW CREATE TABLE t;
-SHOW CREATE TABLE tp;
---sorted_result
-SELECT * FROM t;
---sorted_result
-SELECT * FROM tp;
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
-SHOW CREATE TABLE t;
-SHOW CREATE TABLE tp;
---sorted_result
-SELECT * FROM t;
---sorted_result
-SELECT * FROM tp;
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
---sorted_result
-SELECT * FROM t;
---sorted_result
-SELECT * FROM tp;
---error ER_ROW_DOES_NOT_MATCH_PARTITION
-ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t;
-SHOW CREATE TABLE t;
-SHOW CREATE TABLE tp;
---sorted_result
-SELECT * FROM t;
---sorted_result
-SELECT * FROM tp;
---echo # Test list of partitions
---error ER_PARSE_ERROR
-ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t IGNORE;
---error ER_PARSE_ERROR
-ALTER TABLE tp EXCHANGE PARTITION p0,p1 WITH TABLE t IGNORE;
---error ER_PARSE_ERROR
-ALTER TABLE tp EXCHANGE PARTITION p0,p1 WITH TABLE t;
---error ER_PARSE_ERROR
-ALTER TABLE tp EXCHANGE PARTITION (p0,p1) WITH TABLE t;
---error ER_PARSE_ERROR
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE (t,t2);
---error ER_PARSE_ERROR
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t,t2;
---error ER_UNKNOWN_PARTITION
-ALTER TABLE tp EXCHANGE PARTITION non_existent WITH TABLE t;
---error ER_PARTITION_INSTEAD_OF_SUBPARTITION
-ALTER TABLE tsp EXCHANGE PARTITION p0 WITH TABLE t;
---error ER_PARTITION_EXCHANGE_PART_TABLE
-ALTER TABLE tsp EXCHANGE PARTITION sp0 WITH TABLE tp;
-SHOW CREATE TABLE t;
-SHOW CREATE TABLE tp;
-SHOW CREATE TABLE tsp;
---sorted_result
-SELECT * FROM t;
---sorted_result
-SELECT * FROM tp;
---echo # Test exchange partition
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
-SHOW CREATE TABLE t;
-SHOW CREATE TABLE tp;
---sorted_result
-SELECT * FROM t;
---sorted_result
-SELECT * FROM tp;
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
-SHOW CREATE TABLE t;
-SHOW CREATE TABLE tp;
---sorted_result
-SELECT * FROM t;
---sorted_result
-SELECT * FROM tp;
---echo # Test exchange subpartition
-ALTER TABLE tsp EXCHANGE PARTITION sp1 WITH TABLE t;
-SHOW CREATE TABLE t;
-SHOW CREATE TABLE tsp;
---sorted_result
-SELECT * FROM t;
---sorted_result
-SELECT * FROM tsp;
-ALTER TABLE tsp EXCHANGE PARTITION sp1 WITH TABLE t;
-ALTER TABLE t ENGINE = InnoDB;
-ALTER TABLE tp ENGINE = InnoDB;
-SHOW CREATE TABLE t;
-SHOW CREATE TABLE tp;
---sorted_result
-SELECT * FROM t;
---sorted_result
-SELECT * FROM tp;
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
-SHOW CREATE TABLE t;
-SHOW CREATE TABLE tp;
---sorted_result
-SELECT * FROM t;
---sorted_result
-SELECT * FROM tp;
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
---echo # test different engines
-ALTER TABLE t ENGINE = MyISAM;
-ALTER TABLE tp ENGINE = InnoDB;
-SHOW CREATE TABLE t;
-SHOW CREATE TABLE tp;
---error ER_MIX_HANDLER_ERROR
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
-SHOW CREATE TABLE t;
-SHOW CREATE TABLE tp;
---echo # Test different charsets
-ALTER TABLE t ENGINE = MyISAM;
-CREATE TABLE tmp LIKE t;
-INSERT INTO tmp SELECT * FROM t;
-RENAME TABLE t TO tmp2, tmp TO t;
-ALTER TABLE tp ENGINE = MyISAM;
-ALTER TABLE t CHARACTER SET = koi8r COLLATE koi8r_general_ci;
---error ER_PARTITION_EXCHANGE_DIFFERENT_OPTION
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
-DROP TABLE t;
---echo # Test multiple different table options
-CREATE TABLE t (a INT,
- b VARCHAR(55),
- PRIMARY KEY (a))
-ENGINE = MyISAM MAX_ROWS = 100000 MIN_ROWS = 1000;
-INSERT INTO t SELECT * FROM tmp2;
-SHOW CREATE TABLE t;
-SHOW CREATE TABLE tp;
---error ER_PARTITION_EXCHANGE_DIFFERENT_OPTION
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
-SHOW WARNINGS;
-DROP TABLE t;
-RENAME TABLE tmp2 TO t;
-# test different keys
-ALTER TABLE t ADD KEY ba_key (b, a);
-ALTER TABLE tp ADD KEY ba_key (b, a);
-ALTER TABLE tsp ADD KEY ba_key (b, a);
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
-SHOW CREATE TABLE t;
-SHOW CREATE TABLE tp;
---sorted_result
-SELECT * FROM t;
---sorted_result
-SELECT * FROM tp;
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
-ALTER TABLE t DROP KEY ba_key;
---error ER_TABLES_DIFFERENT_METADATA
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
-ALTER TABLE t ADD KEY b_key (b);
---error ER_TABLES_DIFFERENT_METADATA
-ALTER TABLE tsp EXCHANGE PARTITION sp1 WITH TABLE t;
-ALTER TABLE t ADD KEY ba_key (b, a);
-ALTER TABLE t DROP KEY b_key;
-# test different index types
-# test different columns
-ALTER TABLE t CHANGE a c INT;
---error ER_TABLES_DIFFERENT_METADATA
-ALTER TABLE tsp EXCHANGE PARTITION sp1 WITH TABLE t;
-ALTER TABLE t CHANGE c a INT;
-# test different data/index dir
-# test different options (row_format, max/min_rows, comments, tablespace,
-# pack_keys, delay_key_write, checksum etc.
-# test foreign keys
---echo # test temporary table
-ALTER TABLE t ENGINE = MyISAM;
-ALTER TABLE tp ENGINE = MyISAM;
-CREATE TEMPORARY TABLE tmp LIKE t;
-INSERT INTO tmp SELECT * FROM t;
-ALTER TABLE t RENAME TO tmp2;
-ALTER TABLE tmp RENAME TO t;
-SHOW CREATE TABLE t;
-SHOW CREATE TABLE tp;
---error ER_PARTITION_EXCHANGE_TEMP_TABLE
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
-SHOW CREATE TABLE t;
-SHOW CREATE TABLE tp;
-DROP TEMPORARY TABLE t;
-ALTER TABLE tmp2 RENAME TO t;
---echo # Test non partitioned table
-ALTER TABLE tp REMOVE PARTITIONING;
---error ER_PARTITION_MGMT_ON_NONPARTITIONED
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
-
-# TODO:
-# Verify that it is possible to read a table that is going to be exchanged
-# (but not write)
-# Verify that it is possible to both read and write to the partition that is
-# going to be exchanged
-# test mdl locking (i.e. together with transactions and other ddl)
-# Add test in lc_0-2 to make sure renameing operators is ok with different lc
-# Add test to exchange between databases, also check grants.
-# Add test for privileges
-# check if correct error whithout partitioning support
-DROP TABLE t, tp, tsp;
-
-
---echo # Test with general_log
-use mysql;
-SET @old_general_log_state = @@global.general_log;
-SET GLOBAL general_log = 0;
-ALTER TABLE general_log ENGINE = MyISAM;
-CREATE TABLE t LIKE general_log;
-ALTER TABLE t PARTITION BY RANGE (UNIX_TIMESTAMP(event_time) DIV 1)
-(PARTITION p0 VALUES LESS THAN (123456789),
- PARTITION pMAX VALUES LESS THAN MAXVALUE);
---error ER_BAD_LOG_STATEMENT
-ALTER TABLE t EXCHANGE PARTITION p0 WITH TABLE general_log;
-ALTER TABLE general_log ENGINE = CSV;
-SET @@global.general_log = @old_general_log_state;
-DROP TABLE t;
-use test;
-
---echo # Test with LOCK TABLE
-# Test with only one table locked at a time, both table locked + read, write
-
-CREATE TABLE tp
-(a VARCHAR(24),
- b DATETIME,
- PRIMARY KEY (a,b))
-PARTITION BY RANGE COLUMNS (a, b)
-(PARTITION p0 VALUES LESS THAN ("Middle", '0000-00-00'),
- PARTITION p1 VALUES LESS THAN (MAXVALUE, '9999-12-31 23:59:59'));
-CREATE TABLE t LIKE tp;
-ALTER TABLE t REMOVE PARTITIONING;
-CREATE TABLE t2 LIKE t;
-INSERT INTO tp VALUES ("First in tp", '2000-01-02 03:04:25'), ("Zebra in tp", '0000-00-00 00:00:00'), ("Second in tp", '2010-01-01 05:12:24');
-INSERT INTO t VALUES ("First in t", '2000-01-02 03:04:25'), ("a test in t", '0000-00-00 00:00:00'), ("Echo in t", '2010-01-01 05:12:24');
-# 3 different kind of locks (none, READ, WRITE) for three different tables.
-# 3^3 = 18. The variant with no locks does not need testing -> 17
-let $count = 17;
-while ($count)
-{
-let $t_lock = `SELECT (CASE ($count % 3) WHEN 0 THEN 0 WHEN 1 THEN 'WRITE' WHEN 2 THEN 'READ' END)`;
-let $tp_lock = `SELECT (CASE ((($count + 2) DIV 3) % 3) WHEN 0 THEN 0 WHEN 1 THEN 'WRITE' WHEN 2 THEN 'READ' END)`;
-let $t2_lock = `SELECT (CASE ((($count + 8) DIV 9) % 3) WHEN 0 THEN 0 WHEN 1 THEN 'WRITE' WHEN 2 THEN 'READ' END)`;
---echo # tp_lock '$tp_lock' t_lock '$t_lock' t2_lock '$t2_lock' count '$count'
-let $lock_cmd = LOCK TABLE;
-let $take_lock = 0;
-if ($t_lock)
-{
- let $lock_cmd = $lock_cmd t $t_lock;
- let $take_lock = 1;
-}
-if ($tp_lock)
-{
- if ($take_lock)
- {
- let $lock_cmd = $lock_cmd, tp $tp_lock;
- }
- if (!$take_lock)
- {
- let $lock_cmd = $lock_cmd tp $tp_lock;
- }
- let $take_lock = 1;
-}
-if ($t2_lock)
-{
- if ($take_lock)
- {
- let $lock_cmd = $lock_cmd, t2 $t2_lock;
- }
- if (!$take_lock)
- {
- let $lock_cmd = $lock_cmd t2 $t2_lock;
- }
- let $take_lock = 1;
-}
-if ($take_lock)
-{
- eval $lock_cmd;
-}
---error 0, ER_TABLE_NOT_LOCKED, ER_TABLE_NOT_LOCKED_FOR_WRITE
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
-SHOW WARNINGS;
---error 0, ER_TABLE_NOT_LOCKED, ER_TABLE_NOT_LOCKED_FOR_WRITE
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t2;
-SHOW WARNINGS;
-UNLOCK TABLES;
-dec $count;
-}
-DROP TABLE t, t2, tp;
diff --git a/mysql-test/t/partition_explicit_prune.test b/mysql-test/t/partition_explicit_prune.test
deleted file mode 100644
index 68b829fbcc3..00000000000
--- a/mysql-test/t/partition_explicit_prune.test
+++ /dev/null
@@ -1,860 +0,0 @@
---source include/have_innodb.inc
---source include/have_partition.inc
-
-# Helper statement
-let $get_handler_status_counts= SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
-WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
-
---echo #
---echo # Bug#13559657: PARTITION SELECTION DOES NOT WORK WITH VIEWS
---echo #
-CREATE TABLE t1 (a int)
-ENGINE = InnoDB
-PARTITION BY HASH (a) PARTITIONS 2;
-INSERT INTO t1 VALUES (0), (1), (2), (3);
-CREATE VIEW v1 AS SELECT a FROM t1 PARTITION (p0);
-SHOW CREATE VIEW v1;
-FLUSH STATUS;
---sorted_result
-SELECT * FROM v1;
-eval $get_handler_status_counts;
---echo # 4 locks (1 table, 1 partition lock/unlock)
-FLUSH STATUS;
---sorted_result
-SELECT a FROM t1 PARTITION (p0);
-eval $get_handler_status_counts;
---echo # 4 locks (1 table, 1 partition lock/unlock)
-FLUSH STATUS;
-INSERT INTO v1 VALUES (10);
-eval $get_handler_status_counts;
---echo # 4 locks (1 table, 1 partition lock/unlock)
-FLUSH STATUS;
-# --error ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET
-# INSERT INTO v1 VALUES (11);
-eval $get_handler_status_counts;
---echo # 2 locks (1 table, all partitions pruned)
-FLUSH STATUS;
---sorted_result
-SELECT * FROM v1;
-eval $get_handler_status_counts;
---echo # 4 locks (1 table, 1 partition lock/unlock)
-FLUSH STATUS;
---sorted_result
-SELECT a FROM t1 PARTITION (p0);
-eval $get_handler_status_counts;
---echo # 4 locks (1 table, 1 partition lock/unlock)
---sorted_result
-SELECT * FROM t1;
-DROP VIEW v1;
-CREATE VIEW v1 AS SELECT a FROM t1 PARTITION (p0) WITH CHECK OPTION;
-FLUSH STATUS;
-INSERT INTO v1 VALUES (20);
-eval $get_handler_status_counts;
---echo # 4 locks (1 table, 1 partition lock/unlock)
-FLUSH STATUS;
-# --error ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET
-# INSERT INTO v1 VALUES (21);
-eval $get_handler_status_counts;
---echo # 2 locks (1 table, all partitions pruned)
---sorted_result
-SELECT * FROM v1;
---sorted_result
-SELECT * FROM t1;
-DROP VIEW v1;
-CREATE VIEW v1 AS
-SELECT a FROM t1 PARTITION (p0) WHERE a = 30 WITH CHECK OPTION;
-FLUSH STATUS;
-INSERT INTO v1 VALUES (30);
-eval $get_handler_status_counts;
---echo # 4 locks (1 table, 1 partition lock/unlock)
-FLUSH STATUS;
---error ER_VIEW_CHECK_FAILED
-INSERT INTO v1 VALUES (31);
-eval $get_handler_status_counts;
---echo # 2 locks (1 table, all partitions pruned)
-FLUSH STATUS;
---error ER_VIEW_CHECK_FAILED
-INSERT INTO v1 VALUES (32);
-eval $get_handler_status_counts;
---echo # 4 locks (1 table, 1 partition lock/unlock)
---sorted_result
-SELECT * FROM v1;
---sorted_result
-SELECT * FROM t1;
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo # Original tests for WL#5217
-
---echo # Must have InnoDB as engine to get the same statistics results.
---echo # embedded uses MyISAM as default. CREATE SELECT uses the default engine.
-SET @old_default_storage_engine = @@default_storage_engine;
-SET @@default_storage_engine = 'InnoDB';
-
---let $MYSQLD_DATADIR= `SELECT @@datadir`
-
---echo # Test to show if I_S affects HANDLER_ counts
-FLUSH STATUS;
-eval $get_handler_status_counts;
-eval $get_handler_status_counts;
---echo # OK, seems to add number of variables processed before HANDLER_WRITE
---echo # and number of variables + 1 evaluated in the previous call in RND_NEXT
-
-CREATE TABLE t1
-(a INT NOT NULL,
- b varchar (64),
- INDEX (b,a),
- PRIMARY KEY (a))
-ENGINE = InnoDB
-PARTITION BY RANGE (a)
-SUBPARTITION BY HASH (a) SUBPARTITIONS 2
-(PARTITION pNeg VALUES LESS THAN (0)
- (SUBPARTITION subp0,
- SUBPARTITION subp1),
- PARTITION `p0-9` VALUES LESS THAN (10)
- (SUBPARTITION subp2,
- SUBPARTITION subp3),
- PARTITION `p10-99` VALUES LESS THAN (100)
- (SUBPARTITION subp4,
- SUBPARTITION subp5),
- PARTITION `p100-99999` VALUES LESS THAN (100000)
- (SUBPARTITION subp6,
- SUBPARTITION subp7));
-
-SHOW CREATE TABLE t1;
---echo # First test that the syntax is OK
---error ER_PARSE_ERROR
-SHOW CREATE TABLE t1 PARTITION (subp0);
---echo # Not a correct partition list
---error ER_PARSE_ERROR
-INSERT INTO t1 PARTITION () VALUES (1, "error");
---error ER_UNKNOWN_PARTITION
-INSERT INTO t1 PARTITION (pNonExisting) VALUES (1, "error");
---error ER_UNKNOWN_PARTITION
-INSERT INTO t1 PARTITION (pNeg, pNonExisting) VALUES (1, "error");
---echo # Duplicate partitions and overlapping partitions and subpartitios is OK
-FLUSH STATUS;
-INSERT INTO t1 PARTITION (pNeg, pNeg) VALUES (-1, "pNeg(-subp1)");
-eval $get_handler_status_counts;
---echo # Should be 1 commit
---echo # 4 external locks (due to pruning of locks)
---echo # (1 ha_partition + 1 ha_innobase) x 2 (lock + unlock)
---echo # and 18 write (1 ha_innobase + 17 internal I_S write)
-INSERT INTO t1 PARTITION (pNeg, subp0) VALUES (-3, "pNeg(-subp1)");
-INSERT INTO t1 PARTITION (pNeg, subp0) VALUES (-2, "(pNeg-)subp0");
-
---echo # should be correct
-INSERT INTO t1 PARTITION (`p100-99999`) VALUES (100, "`p100-99999`(-subp6)"), (101, "`p100-99999`(-subp7)"), (1000, "`p100-99999`(-subp6)");
-INSERT INTO t1 PARTITION(`p10-99`,subp3) VALUES (1, "subp3"), (10, "p10-99");
-FLUSH STATUS;
-INSERT INTO t1 PARTITION(subp3) VALUES (3, "subp3");
-eval $get_handler_status_counts;
---echo # Should be 1 commit
---echo # 4 external locks
---echo # (1 ha_partition + 1 ha_innobase) x 2 (lock + unlock)
---echo # and 18 write (1 ha_innobase + 17 internal I_S write)
-FLUSH STATUS;
-LOCK TABLE t1 WRITE;
-eval $get_handler_status_counts;
---echo # should be 1 commit
---echo # 9 locks (1 ha_partition + 8 ha_innobase)
---echo # 17 writes (internal I_S)
-INSERT INTO t1 PARTITION(`p0-9`) VALUES (5, "p0-9:subp3");
-eval $get_handler_status_counts;
---echo # + 1 commit
---echo # + 19 rnd next (internal I_S)
---echo # + 19 write (18 internal I_S + 1 insert)
-UNLOCK TABLES;
-eval $get_handler_status_counts;
---echo # + 9 locks (unlocks)
---echo # + 19 rnd next (internal I_S)
---echo # + 18 write (internal I_S)
-
---echo # Not matching partitions with inserted value
---error ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET
-INSERT INTO t1 PARTITION (pNeg, pNeg) VALUES (1, "error");
---error ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET
-INSERT INTO t1 PARTITION (pNeg, subp0) VALUES (1, "error");
---error ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET
-INSERT INTO t1 PARTITION (`p100-99999`) VALUES (1, "error"), (10, "error");
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-INSERT INTO t1 VALUES (1000000, "error"), (9999999, "error");
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-INSERT INTO t1 PARTITION (`p100-99999`) VALUES (1000000, "error"), (9999999, "error");
---error ER_DUP_ENTRY,ER_DUP_KEY
-INSERT INTO t1 PARTITION (pNeg, subp4) VALUES (-7, "pNeg(-subp1)"), (-10, "pNeg(-subp0)"), (-1, "pNeg(-subp1)"), (-99, "pNeg(-subp1)");
-
-SELECT * FROM t1 ORDER BY a;
-ANALYZE TABLE t1;
-
-SET @save_innodb_stats_on_metadata=@@global.innodb_stats_on_metadata;
-SET @@global.innodb_stats_on_metadata=ON;
-SELECT PARTITION_NAME, SUBPARTITION_NAME, TABLE_ROWS
-FROM INFORMATION_SCHEMA.PARTITIONS
-WHERE TABLE_SCHEMA = 'test'
-AND TABLE_NAME = 't1' ORDER BY SUBPARTITION_NAME;
-SET @@global.innodb_stats_on_metadata=@save_innodb_stats_on_metadata;
-
-FLUSH STATUS;
---error ER_UNKNOWN_PARTITION
-SELECT * FROM t1 PARTITION (pNonexistent);
-eval $get_handler_status_counts;
---echo # should have failed before locking (only 17 internal I_S writes)
-FLUSH STATUS;
-SELECT * FROM t1 PARTITION (subp2);
-eval $get_handler_status_counts;
---echo # Should be 1 commit
---echo # 4 locks (1 ha_partition + 1 ha_innobase) x 2 (lock/unlock)
---echo # 1 read first (also calls index_read)
---echo # 2 read key (first from innobase_get_index and second from index first)
---echo # 17 writes (internal I_S)
-FLUSH STATUS;
-SELECT * FROM t1 PARTITION (subp2,pNeg) AS TableAlias;
-eval $get_handler_status_counts;
---echo # Should be 1 commit
---echo # 8 locks (1 ha_partition + 2 + 1 ha_innobase) x 2
---echo # 3 read first (one for each partition)
---echo # 6 read key (3 from read first and 3 from innobase_get_index)
---echo # 3 read next (one next call after each read row)
---echo # 17 writes (internal I_S)
-FLUSH STATUS;
-LOCK TABLE t1 READ, t1 as TableAlias READ;
-eval $get_handler_status_counts;
---echo # 1 commit
---echo # 18 locks
---echo # 18 READ KEY from opening a new partition table instance,
---echo # (1 innobase_get_index for each index, per partition, 1 x 2 x 8 = 16
---echo # + info(HA_STATUS_CONST) call on the partition with the most number
---echo # of rows, 2 innobase_get_index for updating both index statistics)
---echo # 17 writes (internal I_S)
-SELECT * FROM t1 PARTITION (subp3) AS TableAlias;
-eval $get_handler_status_counts;
---echo # + 1 commit
---echo # + 1 read first (read first key from index in one partition)
---echo # + 2 read key (innobase_get_index from index_init + from index_first)
---echo # + 3 read next (one after each row)
---echo # + 19 rnd next (from the last I_S query)
---echo # + 18 write (internal I_S)
-SELECT COUNT(*) FROM t1 PARTITION (`p10-99`);
-eval $get_handler_status_counts;
---echo # + 1 commit
---echo # + 2 read first (one for each subpart)
---echo # + 4 read key (innobase_get_index from index_init + from index_first)
---echo # + 1 read next (one after each row)
---echo # + 19 rnd next (from the last I_S query)
---echo # + 18 write (internal I_S)
-SELECT * FROM t1 WHERE a = 1000000;
-eval $get_handler_status_counts;
---echo # No matching partition, only internal I_S.
-SELECT * FROM t1 PARTITION (pNeg) WHERE a = 100;
-UNLOCK TABLES;
-eval $get_handler_status_counts;
---echo # + 18 for unlock (same as lock above) (100 is not in pNeg, no match)
-
---echo # Test that EXPLAIN PARTITION works
---error ER_UNKNOWN_PARTITION
-EXPLAIN PARTITIONS SELECT * FROM t1 PARTITION (pNonexistent);
-EXPLAIN PARTITIONS SELECT * FROM t1 PARTITION (subp2);
-FLUSH STATUS;
-EXPLAIN PARTITIONS SELECT * FROM t1 PARTITION (subp2,pNeg) AS TableAlias;
-eval $get_handler_status_counts;
---echo # 8 locks (1 ha_partition + 3 ha_innobase) x 2 (lock/unlock)
-EXPLAIN PARTITIONS SELECT * FROM t1 PARTITION (subp3) AS TableAlias;
-EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 PARTITION (`p10-99`);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 1000000;
-EXPLAIN PARTITIONS SELECT * FROM t1 PARTITION (pNeg) WHERE a = 100;
-
---echo # Test how it changes the alias/keywords/reserved words
---error ER_PARSE_ERROR
-SELECT * FROM t1 PARTITION;
-SELECT * FROM t1 `PARTITION`;
---error ER_PARSE_ERROR
-SELECT * FROM t1 AS PARTITION;
-SELECT * FROM t1 AS `PARTITION`;
-
---echo #
---echo # Test REPLACE
---echo #
-FLUSH STATUS;
---error ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET
-REPLACE INTO t1 PARTITION (subp0) VALUES (-21, 'Should fail!');
-eval $get_handler_status_counts;
---echo # 2 locks (1 ha_partition) x 2 (lock/unlock), Was 4 locks before WL4443
---echo # explicit pruning says part_id 0 and implicit pruning says part_id 1
---echo # so no partition will be locked!
---echo # 0 rollback (since no locked partition)
---echo # 17 writes (I_S internal)
-FLUSH STATUS;
-REPLACE INTO t1 PARTITION (subp1) VALUES (-21, 'Insert by REPLACE');
-eval $get_handler_status_counts;
---echo # 1 commit
---echo # 4 locks (1 ha_partition + 1 ha_innobase) x 2 (lock/unlock)
---echo # 18 writes (17 I_S internal, 1 ha_innobase)
-SELECT * FROM t1 PARTITION (pNeg);
-FLUSH STATUS;
-REPLACE INTO t1 PARTITION (subp1) VALUES (-21, 'REPLACEd by REPLACE');
-eval $get_handler_status_counts;
---echo # 1 commit
---echo # 4 locks (1 ha_partition + 1 ha_innobase) x 2 (lock/unlock)
---echo # 2 read key (1 innobase_get_index when init the index + 1 index read
---echo # to get the position to update)
---echo # 1 update (updated one row, since there is no delete trigger, update
---echo # is used instead of delete+insert)
---echo # 18 write (17 from I_S, 1 for the failed insert)
-SELECT * FROM t1 PARTITION (pNeg);
-FLUSH STATUS;
-LOCK TABLE t1 WRITE;
-eval $get_handler_status_counts;
---echo # 1 commit
---echo # 9 locks
---echo # 17 write (internal I_S)
-DELETE FROM t1 PARTITION(subp1) WHERE b = "REPLACEd by REPLACE";
-eval $get_handler_status_counts;
---echo # + 1 commit
---echo # + 1 delete (one row deleted)
---echo # + 3 read key (1 innodb_get_index in records_in_range,
---echo # 1 innodb_get_index in index_init, 1 index_read in index_read_first)
---echo # + 1 read next (search for another row in secondary index)
---echo # + 19 rnd next (internal I_S)
---echo # + 18 write (internal I_S)
---error ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET
-REPLACE INTO t1 PARTITION (subp0) VALUES (-21, 'Should fail!');
-eval $get_handler_status_counts;
---echo # Failed before start_stmt/execution.
---echo # + 19 rnd next (internal I_S)
---echo # 0 rollback (No partition had called start_stmt, all parts pruned)
---echo # + 18 write (internal I_S)
-REPLACE INTO t1 PARTITION (pNeg) VALUES (-21, 'Insert by REPLACE');
-eval $get_handler_status_counts;
---echo # + 1 commit
---echo # + 19 rnd next (internal I_S)
---echo # + 19 write (18 internal I_S + 1 real write)
-REPLACE INTO t1 PARTITION (subp1) VALUES (-21, 'REPLACEd by REPLACE');
-eval $get_handler_status_counts;
---echo # + 1 commit
---echo # + 2 read key (see non locked query)
---echo # + 19 rnd next (internal I_S)
---echo # + 1 update (see non locked query)
---echo # + 19 write (18 internal I_S + 1 failed write)
-SELECT * FROM t1 PARTITION (subp1);
-eval $get_handler_status_counts;
---echo # + 1 commit
---echo # + 1 read first
---echo # + 2 read key
---echo # + 3 read next
---echo # + 19 rnd next (internal I_S)
---echo # + 18 write (internal I_S)
-UNLOCK TABLES;
-eval $get_handler_status_counts;
---echo # + 9 locks
---echo # + 19 rnd next (internal I_S)
---echo # + 18 write (internal I_S)
-
---echo #
---echo # Test LOAD
---echo #
-SELECT * FROM t1 PARTITION (pNeg, `p10-99`);
-FLUSH STATUS;
-SELECT * FROM t1 PARTITION (pNeg, `p10-99`) INTO OUTFILE 'loadtest.txt';
-eval $get_handler_status_counts;
---echo # 1 commit
---echo # 10 locks (1 ha_partition + 4 ha_innobase) x 2 (lock/unlock)
---echo # 4 read first (for reading the first row in 4 partitions)
---echo # 8 read key (4 from read first + 4 for index init)
---echo # 5 read next (one after each row)
---echo # 17 write (internal I_S)
-FLUSH STATUS;
-ALTER TABLE t1 TRUNCATE PARTITION pNeg, `p10-99`;
-eval $get_handler_status_counts;
---echo # 10 locks (table + 4 partition) x (lock + unlock)
-SELECT * FROM t1 PARTITION (pNeg, `p10-99`);
-FLUSH STATUS;
---error ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET
-LOAD DATA INFILE 'loadtest.txt' INTO TABLE t1 PARTITION (pNeg);
-eval $get_handler_status_counts;
---echo # 6 locks (1 ha_partition + 2 ha_innobase) x 2 (lock+unlock)
---echo # 1 rollback
-SELECT * FROM t1 PARTITION (pNeg, `p10-99`);
-FLUSH STATUS;
-LOAD DATA INFILE 'loadtest.txt' INTO TABLE t1 PARTITION (pNeg, subp4, subp5);
-eval $get_handler_status_counts;
---echo # 10 lock (1 ha_partition + 4 ha_innobase) x 2 (lock + unlock)
-ALTER TABLE t1 TRUNCATE PARTITION pNeg, `p10-99`;
-FLUSH STATUS;
-LOCK TABLE t1 WRITE;
-eval $get_handler_status_counts;
---echo # 9 locks
---echo # 18 read key (ALTER forces table to be closed, see above for open)
-LOAD DATA INFILE 'loadtest.txt' INTO TABLE t1 PARTITION (pNeg, `p10-99`);
-eval $get_handler_status_counts;
---echo # + 23 write (18 internal I_S + 5 rows)
-UNLOCK TABLES;
-eval $get_handler_status_counts;
---echo # + 9 locks
---remove_file $MYSQLD_DATADIR/test/loadtest.txt
-
---echo #
---echo # Test UPDATE
---echo #
-FLUSH STATUS;
-UPDATE t1 PARTITION(subp0) SET b = concat(b, ', Updated');
-eval $get_handler_status_counts;
---echo # 1 commit
---echo # 4 lock (1 ha_partition + 1 ha_innobase) x 2 (lock + unlock)
---echo # 1 read first (read first row, called from first rnd_next)
---echo # 2 read key (innobase_get_index from rnd_init +
---echo # read next row from second rnd_next)
---echo # 1 update (update the row)
-# EXPLAIN PARTITIONS UPDATE t1 PARTITION(subp0) SET b = concat(b, ', Updated');
-SELECT * FROM t1 PARTITION (subp0) ORDER BY a;
-FLUSH STATUS;
-UPDATE t1 PARTITION(subp0) SET b = concat(b, ', Updated2') WHERE a = -2;
-eval $get_handler_status_counts;
---echo # 1 commit
---echo # 4 lock
---echo # 1 read key
---echo # 1 update
-# EXPLAIN PARTITIONS UPDATE t1 PARTITION(subp0) SET b = concat(b, ', Updated2') WHERE a = -2;
-FLUSH STATUS;
-UPDATE t1 PARTITION(subp0) SET a = -4, b = concat(b, ', Updated from a = -2')
-WHERE a = -2;
-eval $get_handler_status_counts;
---echo # 1 commit
---echo # 4 lock
---echo # 2 read key - (2 index read)
---echo # 1 read rnd - rnd_pos
---echo # 1 update
-# EXPLAIN PARTITIONS UPDATE t1 PARTITION(subp0) SET a = -4, b = concat(b, ', Updated from a = -2');
-FLUSH STATUS;
-UPDATE t1 PARTITION(subp0) SET b = concat(b, ', Updated2') WHERE a = 100;
-eval $get_handler_status_counts;
---echo # Nothing, since impossible PARTITION+WHERE clause.
-# EXPLAIN PARTITIONS UPDATE t1 PARTITION(subp0) SET b = concat(b, ', Updated2') WHERE a = 100;
-FLUSH STATUS;
-UPDATE t1 PARTITION(subp0) SET a = -2, b = concat(b, ', Updated from a = 100')
-WHERE a = 100;
-eval $get_handler_status_counts;
---echo # Nothing, since impossible PARTITION+WHERE clause.
-# EXPLAIN PARTITIONS UPDATE t1 PARTITION(subp0)
-# SET a = -2, b = concat(b, ', Updated from a = 100') WHERE a = 100;
-FLUSH STATUS;
---error ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET
-UPDATE t1 PARTITION(`p100-99999`) SET a = -2, b = concat(b, ', Updated from a = 100')
-WHERE a = 100;
-eval $get_handler_status_counts;
---echo # 6 lock
---echo # 4 read key (1 index init + 1 index read + 1 rnd init + 1 rnd pos)
---echo # 1 read rnd (rnd pos)
---echo # 1 rollback
-FLUSH STATUS;
---error ER_DUP_ENTRY,ER_DUP_KEY
-UPDATE t1 PARTITION(`p100-99999`, pNeg) SET a = -4, b = concat(b, ', Updated from a = 100')
-WHERE a = 100;
-eval $get_handler_status_counts;
---echo # 10 locks
---echo # 4 read key
---echo # 1 read rnd
---echo # 1 rollback
---echo # 18 write (17 internal I_S + 1 failed insert)
-FLUSH STATUS;
-UPDATE t1 PARTITION(`p100-99999`, pNeg) SET a = -222, b = concat(b, ', Updated from a = 100')
-WHERE a = 100;
-eval $get_handler_status_counts;
---echo # 1 commit
---echo # 1 delete
---echo # 4 read key
---echo # 1 read rnd
---echo # 18 write (17 internal I_S + 1 insert)
-
-SELECT * FROM t1 ORDER BY a;
---echo # Test of non matching partition (i.e ER_NO_PARTITION_FOUND)
-FLUSH STATUS;
-UPDATE t1 SET b = concat(b, ', Updated2') WHERE a = 1000000;
-eval $get_handler_status_counts;
---echo # Nothing (no matching partition found)
-FLUSH STATUS;
-UPDATE t1 PARTITION (pNeg) SET b = concat(b, ', Updated2') WHERE a = 1000000;
-eval $get_handler_status_counts;
---echo # Nothing (no matching partition found)
-FLUSH STATUS;
-LOCK TABLE t1 WRITE;
-eval $get_handler_status_counts;
---echo # 9 locks
-UPDATE t1 PARTITION (subp7) SET b = concat(b, ', Updated to 103'), a = 103 WHERE a = 101;
-eval $get_handler_status_counts;
---echo # + 4 read key
---echo # + 1 read rnd
---echo # + 1 update
-UPDATE t1 PARTITION (`p100-99999`) SET b = concat(b, ', Updated to 110'), a = 110 WHERE a = 103;
-eval $get_handler_status_counts;
---echo # + 1 delete
---echo # + 4 read key
---echo # + 1 read rnd
---echo # + 19 write (18 internal I_S + 1 insert)
-UNLOCK TABLES;
-eval $get_handler_status_counts;
---echo + 9 locks
-
---echo #
---echo # Test DELETE
---echo #
-SELECT * FROM t1 ORDER BY b, a;
-FLUSH STATUS;
-DELETE FROM t1 PARTITION (pNeg) WHERE a = -1;
-eval $get_handler_status_counts;
---echo # 1 delete
---echo # 4 locks (pruning works!).
---echo # 1 read key (index read)
-FLUSH STATUS;
-DELETE FROM t1 PARTITION (subp1) WHERE b like '%subp1%';
-eval $get_handler_status_counts;
---echo # 1 delete
---echo # 4 locks
---echo # 1 read first
---echo # 2 read key
---echo # 3 read rnd
-FLUSH STATUS;
-LOCK TABLE t1 WRITE;
-eval $get_handler_status_counts;
---echo # 9 locks
-DELETE FROM t1 PARTITION (subp1) WHERE b = 'p0-9:subp3';
-eval $get_handler_status_counts;
---echo # + 3 read key (1 innodb_get_index in records_in_range
---echo # + 1 innobase_get_index in index_init + 1 index read)
-DELETE FROM t1 PARTITION (`p0-9`) WHERE b = 'p0-9:subp3';
-eval $get_handler_status_counts;
---echo # + 1 delete
---echo # + 6 read key (same as above, but for two subpartitions)
---echo # + 1 read next (read next after found row)
-UNLOCK TABLES;
-eval $get_handler_status_counts;
---echo # + 9 locks
-
---echo # Test multi-table DELETE
---echo # Can be expressed in two different ways.
-CREATE TABLE t2 LIKE t1;
-FLUSH STATUS;
-INSERT INTO t2 PARTITION (`p10-99`, subp3, `p100-99999`) SELECT * FROM t1 PARTITION (subp3, `p10-99`, `p100-99999`);
-eval $get_handler_status_counts;
---echo # 24 locks (2 table, 5 + 5 subpartitions lock/unlock)
-FLUSH STATUS;
-ALTER TABLE t2 TRUNCATE PARTITION `p10-99`, `p0-9`, `p100-99999`;
-eval $get_handler_status_counts;
---echo # 14 locks (1 table, 6 subpartitions lock/unlock)
-FLUSH STATUS;
---error ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET
-INSERT INTO t2 PARTITION (subp3) SELECT * FROM t1 PARTITION (subp3, `p10-99`, `p100-99999`);
-eval $get_handler_status_counts;
---echo # 16 locks (2 tables, 1 + 5 subpartitions lock/unlock)
-FLUSH STATUS;
-INSERT IGNORE INTO t2 PARTITION (subp3) SELECT * FROM t1 PARTITION (subp3, `p10-99`, `p100-99999`);
-eval $get_handler_status_counts;
---echo # 16 locks (2 tables, 1 + 5 subpartitions lock/unlock)
-TRUNCATE TABLE t2;
-FLUSH STATUS;
-INSERT INTO t2 SELECT * FROM t1 PARTITION (subp3, `p10-99`, `p100-99999`);
-eval $get_handler_status_counts;
---echo # 30 locks (2 table, 8 + 5 subpartitions lock/unlock)
-FLUSH STATUS;
-CREATE TABLE t3 SELECT * FROM t1 PARTITION (pNeg,subp3,`p100-99999`);
-eval $get_handler_status_counts;
---echo # 14 locks (2 table, 5 subpartitions lock/unlock)
-SHOW CREATE TABLE t1;
-SELECT * FROM t1;
-SHOW CREATE TABLE t2;
-SELECT * FROM t2;
-SHOW CREATE TABLE t3;
-SELECT * FROM t3;
-FLUSH STATUS;
---error ER_PARSE_ERROR
-DELETE t1 PARTITION (pNeg), t3 FROM t1, t3
-WHERE t1.a = t3.a AND t3.b = 'subp3';
-eval $get_handler_status_counts;
---echo # Multi table delete without any matching rows
-FLUSH STATUS;
-DELETE t1, t2 FROM t1 PARTITION (pNeg), t3, t2 PARTITION (subp3)
-WHERE t1.a = t3.a AND t3.b = 'subp3' AND t3.a = t2.a;
-eval $get_handler_status_counts;
---echo # 12 locks (3 in t1, 1 in t3, 2 in t2) x 2 (lock + unlock)
---echo # 1 read first (first rnd_next in t2)
---echo # 4 read key (1 innodb_get_index in rnd_init in t2 + index read in t2
---echo # + 2 innodb_get_index in index_init in t1)
---echo # 3 read rnd next (3 rnd next in t2, 2 rows + 1 empty)
---echo # Multi table delete matching all rows in subp3 (2 rows in per table)
-FLUSH STATUS;
-DELETE FROM t2, t3 USING t2 PARTITION (`p0-9`), t3, t1 PARTITION (subp3)
-WHERE t1.a = t3.a AND t3.b = 'subp3' AND t2.a = t1.a;
-eval $get_handler_status_counts;
---echo # 4 delete (2 in t2 + 2 in t3)
---echo # 12 locks (3 in t2, 1 in t3, 2 in t1) x 2 (lock + unlock)
---echo # 3 read first (1 in t1 + 1 in t3 + 1 in t3, for second row in t1)
---echo # 17 read key (1 index_init in t1 + 1 read first in t1 +
---echo # 2 index_init in t2 + 1 index read in t2 +
---echo # 1 index_init in t3 + 1 index read in t3 +
---echo # 1 index read in t2 +
---echo # 1 index_init in t3 + 1 index read in t3 +
---echo # 2 index_init in t2 + 2 index read in t2 (from rnd_pos)
---echo # 1 index_init in t3 + 2 index read in t3 (from rnd_pos))
---echo # 2 read next (1 in t1 + 1 in t1, second row)
---echo # 4 read rnd (position on 4 found rows to delete)
---echo # 16 rnd next (8 in t3 + 8 in t3, for second row)
-SELECT * FROM t1 ORDER BY a;
-SELECT * FROM t2 ORDER BY a;
-SELECT * FROM t3 ORDER BY a;
-
-
---echo # Test TRUNCATE TABLE (should fail, since one should use
---echo # ALTER TABLE ... TRUNCATE PARTITION instead)
---error ER_PARSE_ERROR
-TRUNCATE TABLE t1 PARTITION(`p10-99`);
-
---echo # Test of locking in TRUNCATE PARTITION
---echo # Note that it does not support truncating subpartitions
-FLUSH STATUS;
-ALTER TABLE t1 TRUNCATE PARTITION pNeg;
-eval $get_handler_status_counts;
---echo # 6 locks (lock/unlock two subpartitions + table)
-
---echo # Test on non partitioned table
---error ER_PARTITION_CLAUSE_ON_NONPARTITIONED
-SELECT * FROM t3 PARTITION (pNeg);
-
-DROP TABLE t1, t2, t3;
-#
---echo # Test from superseeded WL# 2682
-# Partition select tests.
-#
---disable_warnings
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
---enable_warnings
-
-CREATE TABLE `t1` (
-`id` int(11) default NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
-PARTITION BY RANGE (id) (
-PARTITION p0 VALUES LESS THAN (6) ENGINE = MyISAM,
-PARTITION p1 VALUES LESS THAN (11) ENGINE = MyISAM,
-PARTITION p2 VALUES LESS THAN (16) ENGINE = MyISAM,
-PARTITION p3 VALUES LESS THAN (21) ENGINE = MyISAM);
-
-INSERT INTO `t1` VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10),
-(11), (12), (13), (14), (15), (16), (17), (18), (19), (20);
-
-SELECT * FROM t1;
-SELECT * FROM t1 PARTITION (p0);
-SELECT * FROM t1 PARTITION (p1);
-SELECT * FROM t1 PARTITION (p2);
-SELECT * FROM t1 PARTITION (p3);
-SELECT * FROM t1 PARTITION (p3) WHERE id = 2;
---error ER_UNKNOWN_PARTITION
-SELECT * FROM t1 PARTITION (foo);
-
-# now try indexes
-CREATE TABLE `t2` (
-`id` int(11) NOT NULL DEFAULT 0,
-PRIMARY KEY (`id`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
-PARTITION BY RANGE (id) (
-PARTITION p0 VALUES LESS THAN (6) ENGINE = MyISAM,
-PARTITION p1 VALUES LESS THAN (11) ENGINE = MyISAM,
-PARTITION p2 VALUES LESS THAN (16) ENGINE = MyISAM,
-PARTITION p3 VALUES LESS THAN (21) ENGINE = MyISAM);
-
-INSERT INTO `t2` VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10),
-(11), (12), (13), (14), (15), (16), (17), (18), (19), (20);
-
-SELECT * FROM t2;
-SELECT * FROM t2 PARTITION (p0);
-SELECT * FROM t2 PARTITION (p1);
-SELECT * FROM t2 PARTITION (p2);
-SELECT * FROM t2 PARTITION (p3);
-SELECT * FROM t2 PARTITION (p3) ORDER BY id;
-SELECT * FROM t2 PARTITION (p3) WHERE id = 2;
---error ER_UNKNOWN_PARTITION
-SELECT * FROM t2 PARTITION (foo);
-
-
-CREATE TABLE `t3` (
- `id` int(32) default NULL,
- `name` varchar(32) default NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
-PARTITION BY LIST (id) (
- PARTITION p0 VALUES IN (1,3,5,7),
- PARTITION p1 VALUES IN (0,2,4,6,8),
- PARTITION p2 VALUES IN (9,10,11,12,13)
-);
-
-INSERT INTO `t3` VALUES (1,'first'), (3,'third'),(5,'fifth'),(7,'seventh'),(0,'zilch'),(2,'second'),(4,'fourth'),(6,'sixth'),(8,'eighth'),(9,'ninth'),(10,'tenth'),(11,'eleventh'),(12,'twelfth'),(13,'thirteenth');
-
-SELECT * FROM `t3`;
-SELECT * FROM `t3` PARTITION (p0);
-SELECT * FROM `t3` PARTITION (p1);
-SELECT * FROM `t3` PARTITION (p2);
-SELECT * FROM `t3` PARTITION (p2) ORDER BY id;
-
-DROP TABLE IF EXISTS `t4`;
-CREATE TABLE `t4` (
- `id` int(32) default NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (id) ;
-
-INSERT INTO `t4` SELECT * FROM `t2`;
-INSERT INTO `t4` SELECT * FROM `t2` ORDER BY id;
-# not sure how to do this, since names could be anything
-#SELECT * FROM `t4` PARTITION (p0);
-#SELECT * FROM `t4` PARTITION (p1);
-#SELECT * FROM `t4` PARTITION (p2);
-#SELECT * FROM `t4` PARTITION (p3);
-#SELECT * FROM `t4` PARTITION (p3) ORDER BY id;
-
-CREATE TABLE `t5` (
- id int(32),
- name varchar(64),
- purchased date)
-PARTITION BY RANGE( YEAR(purchased) )
- SUBPARTITION BY HASH( TO_DAYS(purchased) ) (
- PARTITION p0 VALUES LESS THAN (1990) (
- SUBPARTITION s0,
- SUBPARTITION s1
- ),
- PARTITION p1 VALUES LESS THAN (2000) (
- SUBPARTITION s2,
- SUBPARTITION s3
- ),
- PARTITION p2 VALUES LESS THAN MAXVALUE (
- SUBPARTITION s4,
- SUBPARTITION s5
- )
- );
-
-INSERT INTO `t5` VALUES (1, 'aaaaaaa', '2006-01-05 00:00:00');
-INSERT INTO `t5` VALUES (2, 'bbbbbbb', '2005-08-05 00:00:00');
-INSERT INTO `t5` VALUES (3, 'ccccccc', '1985-08-07 00:00:00');
-INSERT INTO `t5` VALUES (4, 'ddddddd', '2000-01-01 00:00:00');
-INSERT INTO `t5` VALUES (5, 'eeeeeee', '1999-12-01 00:00:00');
-INSERT INTO `t5` VALUES (6, 'fffffff', '2003-11-12 00:00:00');
-INSERT INTO `t5` VALUES (7, 'ggggggg', '1990-01-05 00:00:00');
-INSERT INTO `t5` VALUES (8, 'hhhhhhh', '1978-01-05 00:00:00');
-INSERT INTO `t5` VALUES (9, 'iiiiiii', '1979-01-05 00:00:00');
-INSERT INTO `t5` VALUES (10, 'jjjjjjj', '1992-01-05 00:00:00');
-INSERT INTO `t5` VALUES (11, 'kkkkkkk', '1993-01-05 00:00:00');
-INSERT INTO `t5` VALUES (12, 'mmmmmmm', '1994-01-05 00:00:00');
-INSERT INTO `t5` VALUES (13, 'nnnnnnn', '1989-01-05 00:00:00');
-INSERT INTO `t5` VALUES (14, 'ooooooo', '1983-12-05 00:00:00');
-INSERT INTO `t5` VALUES (15, 'ppppppp', '1986-06-05 00:00:00');
-INSERT INTO `t5` VALUES (16, 'qqqqqqq', '1974-04-11 00:00:00');
-INSERT INTO `t5` VALUES (17, 'qqqqqqq', '1960-03-15 00:00:00');
-INSERT INTO `t5` VALUES (18, 'sssssss', '1950-09-23 00:00:00');
-INSERT INTO `t5` VALUES (19, 'ttttttt', '1999-08-02 00:00:00');
-INSERT INTO `t5` VALUES (20, 'uuuuuuu', '1994-05-28 00:00:00');
-
-SELECT * FROM `t5`;
-SELECT * FROM `t5` PARTITION(p0) ORDER BY id;
-SELECT * FROM `t5` PARTITION(s0) ORDER BY id;
-SELECT * FROM `t5` PARTITION(s1) ORDER BY id;
-SELECT * FROM `t5` PARTITION(p1) ORDER BY id;
-SELECT * FROM `t5` PARTITION(s2) ORDER BY id;
-SELECT * FROM `t5` PARTITION(s3) ORDER BY id;
-SELECT * FROM `t5` PARTITION(p2) ORDER BY id;
-SELECT * FROM `t5` PARTITION(s4) ORDER BY id;
-SELECT * FROM `t5` PARTITION(s5) ORDER BY id;
-
---disable_warnings
-drop table t1,t2,t3,t4,t5;
---enable_warnings
-
-# Tests for working together with partition pruning.
-create table t1 (a int) partition by hash(a) partitions 3;
-insert into t1 values(1),(2),(3);
-explain partitions select * from t1 where a=1;
-explain partitions select * from t1 partition (p1) where a=1;
-explain partitions select * from t1 partition (p1) where a=1 or a=2;
-explain partitions select * from t1 partition (p2) where a=1;
-
-drop table t1;
-
---echo #
---echo # Bug#59864: Crash if table empty: DELETE FROM t2 PARTITION (subp3).
---echo #
-CREATE TABLE t1
-(a INT NOT NULL,
- b varchar (64),
- INDEX (b,a),
- PRIMARY KEY (a))
-PARTITION BY RANGE (a)
-SUBPARTITION BY HASH (a) SUBPARTITIONS 3
-(PARTITION pNeg VALUES LESS THAN (0)
- (SUBPARTITION subp0,
- SUBPARTITION subp1,
- SUBPARTITION subp2),
- PARTITION `p0-29` VALUES LESS THAN (30)
- (SUBPARTITION subp3,
- SUBPARTITION subp4,
- SUBPARTITION subp5),
- PARTITION `p30-299` VALUES LESS THAN (300)
- (SUBPARTITION subp6,
- SUBPARTITION subp7,
- SUBPARTITION subp8),
- PARTITION `p300-2999` VALUES LESS THAN (3000)
- (SUBPARTITION subp9,
- SUBPARTITION subp10,
- SUBPARTITION subp11),
- PARTITION `p3000-299999` VALUES LESS THAN (300000)
- (SUBPARTITION subp12,
- SUBPARTITION subp13,
- SUBPARTITION subp14));
-
-eval SHOW CREATE TABLE t1;
-
-INSERT INTO t1 VALUES (-9, "negative nine"), (-8, "-8"), (-7, "-7"), (-6, "-6"), (-5, "-5"), (-4, "-4"), (-3, "-3"), (-2, "-2"), (-1, "-1");
-INSERT INTO t1 VALUES (9, "nine"), (8, "8"), (7, "7"), (6, "6"), (5, "5"), (4, "4"), (3, "3"), (2, "2"), (1, "1");
-INSERT INTO t1 VALUES (39, "Thirty nine"), (38, "38"), (37, "37"), (36, "36"), (35, "35"), (34, "34"), (33, "33"), (32, "32"), (31, "31");
-INSERT INTO t1 VALUES (339, "Three hundred thirty nine"), (338, "338"), (337, "337"), (336, "336"), (335, "335"), (334, "334"), (333, "333"), (332, "332"), (331, "331");
-INSERT INTO t1 VALUES (3339, "Three thousand three hundred thirty nine"), (3338, "3338"), (3337, "3337"), (3336, "3336"), (3335, "3335"), (3334, "3334"), (3333, "3333"), (3332, "3332"), (3331, "3331");
-
---sorted_result
-SELECT * FROM t1;
---sorted_result
-SELECT * FROM t1 PARTITION (subp3);
-
-DELETE FROM t1 PARTITION (subp3);
-
---sorted_result
-SELECT * FROM t1;
---sorted_result
-SELECT * FROM t1 PARTITION (subp3);
-
-DELETE FROM t1 PARTITION (`p0-29`);
-
---sorted_result
-SELECT * FROM t1;
---sorted_result
-SELECT * FROM t1 PARTITION (`p0-29`);
-
-ALTER TABLE t1 PARTITION BY HASH (a) PARTITIONS 3;
-
-DELETE FROM t1 PARTITION (p2);
-
---sorted_result
-SELECT * FROM t1;
---sorted_result
-SELECT * FROM t1 PARTITION (p2);
-
-DROP TABLE t1;
-
---echo #
---echo # Test explicit partition selection on a non partitioned temp table
---echo #
-CREATE TEMPORARY TABLE t1 (a INT);
---error ER_PARTITION_CLAUSE_ON_NONPARTITIONED
-SELECT * FROM t1 PARTITION(pNonexisting);
-DROP TEMPORARY TABLE t1;
-
---echo #
---echo # Test CREATE LIKE does not take PARTITION clause
---echo #
-CREATE TABLE t1 (a INT) PARTITION BY HASH (a) PARTITIONS 3;
---error ER_PARSE_ERROR
-CREATE TABLE t2 LIKE t1 PARTITION (p0, p2);
-DROP TABLE t1;
-
-SET @@default_storage_engine = @old_default_storage_engine;
diff --git a/mysql-test/t/partition_grant.test b/mysql-test/t/partition_grant.test
deleted file mode 100644
index a5df218bb10..00000000000
--- a/mysql-test/t/partition_grant.test
+++ /dev/null
@@ -1,82 +0,0 @@
--- source include/have_partition.inc
-# Grant tests not performed with embedded server
--- source include/not_embedded.inc
-
---disable_warnings
-drop schema if exists mysqltest_1;
---enable_warnings
-
-
-#
-# Bug #17139: ALTER TABLE ... DROP PARTITION should require DROP privilege
-#
-
-create schema mysqltest_1;
-use mysqltest_1;
-
-create table t1 (a int) partition by list (a) (partition p1 values in (1), partition p2 values in (2), partition p3 values in (3));
-insert into t1 values (1),(2);
-
-# We don't have DROP USER IF EXISTS. Use this workaround to
-# cleanup possible grants for mysqltest_1 left by previous tests
-# and ensure consistent results of SHOW GRANTS command below.
---disable_warnings
-create user mysqltest_1@localhost;
-grant usage on *.* to mysqltest_1@localhost;
-revoke all privileges on *.* from mysqltest_1@localhost;
---enable_warnings
-
-grant select,alter on mysqltest_1.* to mysqltest_1@localhost;
-
-connect (conn1,localhost,mysqltest_1,,mysqltest_1);
-show grants for current_user;
-alter table t1 add b int;
---error ER_TABLEACCESS_DENIED_ERROR
-alter table t1 drop partition p2;
-disconnect conn1;
-
-connection default;
-grant drop on mysqltest_1.* to mysqltest_1@localhost;
-
-connect (conn2,localhost,mysqltest_1,,mysqltest_1);
-alter table t1 drop partition p2;
-disconnect conn2;
-
-connection default;
-revoke alter on mysqltest_1.* from mysqltest_1@localhost;
-
-connect (conn3,localhost,mysqltest_1,,mysqltest_1);
---error ER_TABLEACCESS_DENIED_ERROR
-alter table t1 drop partition p3;
-disconnect conn3;
-
-connection default;
-
-revoke select,alter,drop on mysqltest_1.* from mysqltest_1@localhost;
-drop table t1;
-
-#
-# Bug #23675 Partitions: possible security breach via alter
-#
-
-create table t1 (s1 int);
-insert into t1 values (1);
-grant alter on mysqltest_1.* to mysqltest_1@localhost;
-connect (conn4,localhost,mysqltest_1,,mysqltest_1);
-connection conn4;
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-alter table t1 partition by list (s1) (partition p1 values in (2));
-connection default;
-grant select, alter on mysqltest_1.* to mysqltest_1@localhost;
-disconnect conn4;
-connect (conn5,localhost,mysqltest_1,,mysqltest_1);
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-alter table t1 partition by list (s1) (partition p1 values in (2));
-disconnect conn5;
-connection default;
-drop table t1;
-
-drop user mysqltest_1@localhost;
-drop schema mysqltest_1;
-
---echo End of 5.1 tests
diff --git a/mysql-test/t/partition_hash.test b/mysql-test/t/partition_hash.test
deleted file mode 100644
index c8f473a0477..00000000000
--- a/mysql-test/t/partition_hash.test
+++ /dev/null
@@ -1,175 +0,0 @@
-#--disable_abort_on_error
-#
-# Simple test for the partition storage engine
-# Taken fromm the select test
-#
--- source include/have_partition.inc
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-#
-# Bug#30822: crash when COALESCE
-#
-CREATE TABLE t1 (c1 INT)
- PARTITION BY HASH (c1)
- PARTITIONS 15;
-INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
-ALTER TABLE t1 COALESCE PARTITION 13;
-DROP TABLE t1;
-CREATE TABLE t1 (c1 INT)
- PARTITION BY LINEAR HASH (c1)
- PARTITIONS 5;
-INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
-ALTER TABLE t1 COALESCE PARTITION 3;
-DROP TABLE t1;
-
-#
-# More partition pruning tests, especially on interval walking
-#
-create table t1 (a int unsigned)
-partition by hash(a div 2)
-partitions 4;
-insert into t1 values (null),(0),(1),(2),(3),(4),(5),(6),(7);
-select * from t1 where a < 0;
-select * from t1 where a is null or (a >= 5 and a <= 7);
-select * from t1 where a is null;
-select * from t1 where a is not null;
-select * from t1 where a >= 1 and a < 3;
-select * from t1 where a >= 3 and a <= 5;
-select * from t1 where a > 2 and a < 4;
-select * from t1 where a > 3 and a <= 6;
-select * from t1 where a > 5;
-select * from t1 where a >= 1 and a <= 5;
-explain partitions select * from t1 where a < 0;
-explain partitions select * from t1 where a is null or (a >= 5 and a <= 7);
-explain partitions select * from t1 where a is null;
-explain partitions select * from t1 where a is not null;
-explain partitions select * from t1 where a >= 1 and a < 3;
-explain partitions select * from t1 where a >= 3 and a <= 5;
-explain partitions select * from t1 where a > 2 and a < 4;
-explain partitions select * from t1 where a > 3 and a <= 6;
-explain partitions select * from t1 where a > 5;
-explain partitions select * from t1 where a >= 1 and a <= 5;
-
-drop table t1;
-
-#
-# Partition by hash, basic
-#
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by hash (a + 2)
-partitions 3
-(partition x1 tablespace ts1,
- partition x2 tablespace ts2,
- partition x3 tablespace ts3);
-
-insert into t1 values (1,1,1);
-insert into t1 values (2,1,1);
-insert into t1 values (3,1,1);
-insert into t1 values (4,1,1);
-insert into t1 values (5,1,1);
-
-select * from t1;
-
-update t1 set c=3 where b=1;
-select * from t1;
-
-select b from t1 where a=3;
-select b,c from t1 where a=1 AND b=1;
-
-delete from t1 where a=1;
-delete from t1 where c=3;
-
-select * from t1;
-
-ALTER TABLE t1
-partition by hash (a + 3)
-partitions 3
-(partition x1 tablespace ts1,
- partition x2 tablespace ts2,
- partition x3 tablespace ts3);
-select * from t1;
-drop table t1;
-
-#
-# Partition by hash, only one partition
-#
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by hash (a)
-(partition x1);
-
-drop table t1;
-#
-# Partition by key, only one partition
-#
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by key (a)
-(partition x1);
-
-drop table t1;
-
-#
-# Bug# 15968 - crash when INSERT with f1 = -1 into partition by hash(f1)
-#
-CREATE TABLE t1 (f1 INTEGER, f2 char(20)) ENGINE = 'MYISAM' PARTITION BY HASH(f1) PARTITIONS 2;
-INSERT INTO t1 SET f1 = 0 - 1, f2 = '#######';
-select * from t1;
-drop table t1;
-
-#
-# BUG# 14524 Partitions: crash if blackhole
-#
-# Disable warnings to allow this test case to run without
-# the Blackhole storage engine.
-set sql_mode="";
---disable_warnings
-CREATE TABLE t1 (s1 int) ENGINE=BLACKHOLE PARTITION BY HASH (s1);
---enable_warnings
---error 0,ER_BINLOG_LOGGING_IMPOSSIBLE
-INSERT INTO t1 VALUES (0);
-DROP TABLE t1;
-set sql_mode=default;
-
-#
-# BUG 18423 Hash partitioning can lose rows in some queries
-#
-create table t1 (c1 int DEFAULT NULL,
- c2 varchar (30) DEFAULT NULL,
- c3 date DEFAULT NULL)
-engine = myisam
-partition by hash (to_days(c3))
-partitions 12;
-
-insert into t1 values
-(136,'abc','2002-01-05'),(142,'abc','2002-02-14'),(162,'abc','2002-06-28'),
-(182,'abc','2002-11-09'),(158,'abc','2002-06-01'),(184,'abc','2002-11-22');
-select * from t1;
-select * from t1 where c3 between '2002-01-01' and '2002-12-31';
-
-drop table t1;
-
-#
-# Bug#31210 - INSERT DELAYED crashes server when used on partitioned table
-#
-CREATE TABLE t1 (c1 INT) ENGINE=MyISAM PARTITION BY HASH(c1) PARTITIONS 1;
-# The test succeeds in an embedded server because normal insert is done.
-# The test fails in a normal server with
-# "DELAYED option not supported by table".
---error 0, ER_DELAYED_NOT_SUPPORTED
-INSERT DELAYED INTO t1 VALUES (1);
-DROP TABLE t1;
-
diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test
deleted file mode 100644
index 7b5a69fe622..00000000000
--- a/mysql-test/t/partition_innodb.test
+++ /dev/null
@@ -1,1021 +0,0 @@
-if (`select plugin_auth_version < "5.6.25" from information_schema.plugins where plugin_name='innodb'`)
-{
- --skip Not fixed in InnoDB as of 5.6.24 or earlier
-}
---source include/not_embedded.inc
---source include/have_partition.inc
---source include/have_innodb.inc
-
-call mtr.add_suppression("Deadlock found when trying to get lock; try restarting transaction");
-
-set global default_storage_engine='innodb';
-set session default_storage_engine='innodb';
-
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-
-let $MYSQLD_DATADIR= `SELECT @@datadir`;
-
---echo #
---echo # Bug#13694811: THE OPTIMIZER WRONGLY USES THE FIRST
---echo # INNODB PARTITION STATISTICS
---echo #
-
-CREATE TABLE t1
-(a INT,
- b varchar(64),
- PRIMARY KEY (a),
- KEY (b))
-ENGINE = InnoDB
-PARTITION BY RANGE (a)
-SUBPARTITION BY HASH (a) SUBPARTITIONS 10
-(PARTITION pNeg VALUES LESS THAN (0),
- PARTITION p0 VALUES LESS THAN (1000),
- PARTITION pMAX VALUES LESS THAN MAXVALUE);
-
---echo # Only one row in the first 10 subpartitions
-INSERT INTO t1 VALUES (-1, 'Only negative pk value');
-
-INSERT INTO t1 VALUES (0, 'Mod Zero'), (1, 'One'), (2, 'Two'), (3, 'Three'),
-(10, 'Zero'), (11, 'Mod One'), (12, 'Mod Two'), (13, 'Mod Three'),
-(20, '0'), (21, '1'), (22, '2'), (23, '3'),
-(4, '4'), (5, '5'), (6, '6'), (7, '7'), (8, '8'), (9, '9');
-INSERT INTO t1 SELECT a + 30, b FROM t1 WHERE a >= 0;
-ANALYZE TABLE t1;
-EXPLAIN SELECT b FROM t1 WHERE b between 'L' and 'N' AND a > -100;
-DROP TABLE t1;
-
---echo #
---echo # Bug#13007154: Crash in keys_to_use_for_scanning with ORDER BY
---echo # and PARTITIONING
---echo #
-CREATE TABLE t1 (a INT, KEY(a))
-ENGINE = InnoDB
-PARTITION BY KEY (a) PARTITIONS 1;
-SELECT 1 FROM t1 WHERE a > (SELECT LAST_INSERT_ID() FROM t1 LIMIT 0)
-ORDER BY a;
-DROP TABLE t1;
-
---echo #
---echo # Bug#56287: crash when using Partition datetime in sub in query
---echo #
-
-CREATE TABLE t1
-(c1 bigint(20) unsigned NOT NULL AUTO_INCREMENT,
- c2 varchar(40) not null default '',
- c3 datetime not NULL,
- PRIMARY KEY (c1,c3),
- KEY partidx(c3))
-ENGINE=InnoDB
-PARTITION BY RANGE (TO_DAYS(c3))
-(PARTITION p200912 VALUES LESS THAN (to_days('2010-01-01')),
- PARTITION p201103 VALUES LESS THAN (to_days('2011-04-01')),
- PARTITION p201912 VALUES LESS THAN MAXVALUE);
-
-insert into t1(c2,c3) values ("Test row",'2010-01-01 00:00:00');
-
-SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test';
-SELECT count(*) FROM t1 p where c3 in
-(select c3 from t1 t where t.c3 < timestamp '2011-04-26 19:19:44'
- and t.c3 > timestamp '2011-04-26 19:18:44') ;
-
-DROP TABLE t1;
-
-
---echo #
---echo # Bug#54747: Deadlock between REORGANIZE PARTITION and
---echo # SELECT is not detected
---echo #
-
-SET @old_innodb_thread_concurrency := @@innodb_thread_concurrency;
-SET @old_innodb_thread_sleep_delay := @@innodb_thread_sleep_delay;
-SET GLOBAL innodb_thread_concurrency = 1;
-
-CREATE TABLE t1
-(user_num BIGINT,
- hours SMALLINT,
- KEY user_num (user_num))
-ENGINE = InnoDB
-PARTITION BY RANGE COLUMNS (hours)
-(PARTITION hour_003 VALUES LESS THAN (3),
- PARTITION hour_004 VALUES LESS THAN (4),
- PARTITION hour_005 VALUES LESS THAN (5),
- PARTITION hour_last VALUES LESS THAN (MAXVALUE));
-
-INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
-
-BEGIN;
-SELECT COUNT(*) FROM t1;
-
---connect (con1,localhost,root,,)
---echo # SEND a ALTER PARTITION which waits on the ongoing transaction.
---send
-ALTER TABLE t1
-REORGANIZE PARTITION hour_003, hour_004 INTO
-(PARTITION oldest VALUES LESS THAN (4));
-
---echo # Connection default wait until the ALTER is in 'waiting for table...'
---echo # state and then continue the transaction by trying a SELECT
---connection default
-let $wait_condition =
-SELECT COUNT(*) = 1
-FROM information_schema.processlist
-WHERE INFO like 'ALTER TABLE t1%REORGANIZE PARTITION hour_003, hour_004%'
-AND STATE = 'Waiting for table metadata lock';
---source include/wait_condition.inc
-SELECT COUNT(*) FROM t1;
-COMMIT;
-
---echo # reaping ALTER.
---connection con1
---reap
-
---echo # Cleaning up.
---disconnect con1
-
---connection default
-
-SET GLOBAL innodb_thread_concurrency = @old_innodb_thread_concurrency;
-SET GLOBAL innodb_thread_sleep_delay = @old_innodb_thread_sleep_delay;
-DROP TABLE t1;
-
-
---echo #
---echo # Bug#50418: DROP PARTITION does not interact with transactions
---echo #
-CREATE TABLE t1 (
- id INT AUTO_INCREMENT NOT NULL,
- name CHAR(50) NOT NULL,
- myDate DATE NOT NULL,
- PRIMARY KEY (id, myDate),
- INDEX idx_date (myDate)
- ) ENGINE=InnoDB
-PARTITION BY RANGE ( TO_DAYS(myDate) ) (
- PARTITION p0 VALUES LESS THAN (734028),
- PARTITION p1 VALUES LESS THAN (734029),
- PARTITION p2 VALUES LESS THAN (734030),
- PARTITION p3 VALUES LESS THAN MAXVALUE
- ) ;
-INSERT INTO t1 VALUES
-(NULL, 'Lachlan', '2009-09-13'),
- (NULL, 'Clint', '2009-09-13'),
- (NULL, 'John', '2009-09-14'),
- (NULL, 'Dave', '2009-09-14'),
- (NULL, 'Jeremy', '2009-09-15'),
- (NULL, 'Scott', '2009-09-15'),
- (NULL, 'Jeff', '2009-09-16'),
- (NULL, 'Joe', '2009-09-16');
-SET AUTOCOMMIT=0;
-SELECT * FROM t1 FOR UPDATE;
-UPDATE t1 SET name = 'Mattias' WHERE id = 7;
-SELECT * FROM t1 WHERE id = 7;
---connect (con1, localhost, root,,)
-SET lock_wait_timeout = 1;
---echo # After the patch it will wait and fail on timeout.
---error ER_LOCK_WAIT_TIMEOUT
-ALTER TABLE t1 DROP PARTITION p3;
-SHOW WARNINGS;
---disconnect con1
---connection default
-SELECT * FROM t1;
---echo # No changes.
-COMMIT;
-DROP TABLE t1;
-
-
---echo #
---echo # Bug#51830: Incorrect partition pruning on range partition (regression)
---echo #
-CREATE TABLE t1 (a INT NOT NULL)
-ENGINE = InnoDB
-PARTITION BY RANGE(a)
-(PARTITION p10 VALUES LESS THAN (10),
- PARTITION p30 VALUES LESS THAN (30),
- PARTITION p50 VALUES LESS THAN (50),
- PARTITION p70 VALUES LESS THAN (70),
- PARTITION p90 VALUES LESS THAN (90));
-INSERT INTO t1 VALUES (10),(30),(50);
-INSERT INTO t1 VALUES (70);
-INSERT INTO t1 VALUES (80);
-INSERT INTO t1 VALUES (89);
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-INSERT INTO t1 VALUES (90);
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-INSERT INTO t1 VALUES (100);
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-insert INTO t1 VALUES (110);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 90;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 90;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 90;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 89;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 89;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 89;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 100;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 100;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 100;
-DROP TABLE t1;
-
---echo #
---echo # Bug#50104: Partitioned table with just 1 partion works with fk
---echo #
-CREATE TABLE t2 (
- id INT,
- PRIMARY KEY (id)
-) ENGINE=InnoDB ;
-
-CREATE TABLE t1 (
- id INT NOT NULL AUTO_INCREMENT,
- parent_id INT DEFAULT NULL,
- PRIMARY KEY (id),
- KEY parent_id (parent_id)
-) ENGINE=InnoDB;
-
-ALTER TABLE t1 PARTITION BY HASH (id) PARTITIONS 1;
-
---error ER_FOREIGN_KEY_ON_PARTITIONED
-ALTER TABLE t1 ADD CONSTRAINT test_ibfk_1 FOREIGN KEY (parent_id) REFERENCES t2 (id);
-
-ALTER TABLE t1 PARTITION BY HASH (id) PARTITIONS 2;
-
---error ER_FOREIGN_KEY_ON_PARTITIONED
-ALTER TABLE t1 ADD CONSTRAINT test_ibfk_1 FOREIGN KEY (parent_id) REFERENCES t2 (id);
-
-DROP TABLE t1, t2;
-
-#
-# BUG#47774, Assertion failure in InnoDB using column list partitioning
-#
-create table t1 (a varchar(5), b int signed, c varchar(10), d datetime)
-partition by range columns(b,c)
-subpartition by hash(to_seconds(d))
-( partition p0 values less than (2, 'b'),
- partition p1 values less than (4, 'd'),
- partition p2 values less than (10, 'za'));
-insert into t1 values ('a', 3, 'w', '2001-10-27 04:34:00');
-insert into t1 values ('r', 7, 'w', '2001-10-27 05:34:00');
-insert into t1 values ('g', 10, 'w', '2001-10-27 06:34:00');
-update t1 set a = 'c' where a > 'f';
-drop table t1;
-
-#
-# BUG#47776, Failed to update for MEMORY engine, crash for InnoDB and success for MyISAM
-#
-create table t1 (a varchar(5))
-engine=memory
-partition by range columns(a)
-( partition p0 values less than ('m'),
- partition p1 values less than ('za'));
-insert into t1 values ('j');
-update t1 set a = 'z' where (a >= 'j');
-drop table t1;
-
-create table t1 (a varchar(5))
-engine=myisam
-partition by range columns(a)
-( partition p0 values less than ('m'),
- partition p1 values less than ('za'));
-insert into t1 values ('j');
-update t1 set a = 'z' where (a >= 'j');
-drop table t1;
-
-create table t1 (a varchar(5))
-engine=innodb
-partition by range columns(a)
-( partition p0 values less than ('m'),
- partition p1 values less than ('za'));
-insert into t1 values ('j');
-update t1 set a = 'z' where (a >= 'j');
-drop table t1;
-
-#
-# Bug#47029: Crash when reorganize partition with subpartition
-#
-create table t1 (a int not null,
- b datetime not null,
- primary key (a,b))
-engine=innodb
-partition by range (to_days(b))
-subpartition by hash (a)
-subpartitions 2
-( partition p0 values less than (to_days('2009-01-01')),
- partition p1 values less than (to_days('2009-02-01')),
- partition p2 values less than (to_days('2009-03-01')),
- partition p3 values less than maxvalue);
-alter table t1 reorganize partition p1,p2 into
-( partition p2 values less than (to_days('2009-03-01')));
-drop table t1;
-#
-# Bug#40595: Non-matching rows not released with READ-COMMITTED on tables
-# with partitions
-CREATE TABLE t1 (id INT PRIMARY KEY, data INT) ENGINE = InnoDB
-PARTITION BY RANGE(id) (
- PARTITION p0 VALUES LESS THAN (5),
- PARTITION p1 VALUES LESS THAN (10),
- PARTITION p2 VALUES LESS THAN MAXVALUE
-);
-
-INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4), (5,5), (6,6), (7,7), (8,8),
- (9,9), (10,10), (11,11);
-
-SET @old_tx_isolation := @@session.tx_isolation;
-SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
-
-SET autocommit = 0;
-
-UPDATE t1 SET DATA = data*2 WHERE id = 3;
-
-# SHOW ENGINE InnoDB STATUS does not show transaction info in
-# PERFORMANCE-VERSION
-# grouping/referencing in replace_regex is very slow on long strings,
-# removing all before/after the interesting row before grouping/referencing
-#--replace_regex /.*---TRANSACTION [0-9]+ [0-9]+, .*, OS thread id [0-9]+// /MySQL thread id [0-9]+, query id [0-9]+ .*// /.*([0-9]+) lock struct\(s\), heap size [0-9]+, ([0-9]+) row lock\(s\).*/\1 lock struct(s) \2 row lock(s)/
-#SHOW ENGINE InnoDB STATUS;
-
-UPDATE t1 SET data = data*2 WHERE data = 2;
-
-# SHOW ENGINE InnoDB STATUS does not show transaction info in
-# PERFORMANCE-VERSION
-# grouping/referencing in replace_regex is very slow on long strings,
-# removing all before/after the interesting row before grouping/referencing
-#--replace_regex /.*---TRANSACTION [0-9]+ [0-9]+, .*, OS thread id [0-9]+// /MySQL thread id [0-9]+, query id [0-9]+ .*// /.*([0-9]+ lock struct\(s\)), heap size [0-9]+, ([0-9]+ row lock\(s\)).*/\1 \2/
-#SHOW ENGINE InnoDB STATUS;
-
-SET @@session.tx_isolation = @old_tx_isolation;
-
-DROP TABLE t1;
-
-#
-# Bug37721: ORDER BY when WHERE contains non-partitioned index column
-# wrong order since it did not use pk as second compare
---echo # Bug#37721, test of ORDER BY on PK and WHERE on INDEX
-CREATE TABLE t1 (
- a INT,
- b INT,
- PRIMARY KEY (a),
- INDEX (b))
-ENGINE InnoDB
-PARTITION BY HASH(a)
-PARTITIONS 3;
-# This will give the middle partition the highest value
-INSERT INTO t1 VALUES (0,0),(4,0),(2,0);
-SELECT a FROM t1 WHERE b = 0 ORDER BY a ASC;
-SELECT a FROM t1 WHERE b = 0 ORDER BY a DESC;
-ALTER TABLE t1 DROP INDEX b;
-SELECT a FROM t1 WHERE b = 0 ORDER BY a ASC;
-SELECT a FROM t1 WHERE b = 0 ORDER BY a DESC;
-DROP TABLE t1;
-CREATE TABLE t1 (
- a VARCHAR(600),
- b VARCHAR(600),
- PRIMARY KEY (a),
- INDEX (b))
-ENGINE InnoDB
-PARTITION BY KEY(a)
-PARTITIONS 3;
-# This will give the middle partition the highest value
-INSERT INTO t1 VALUES (concat(repeat('MySQL',100),'1'),repeat('0',257));
-INSERT INTO t1 VALUES (concat(repeat('MySQL',100),'3'),repeat('0',257));
-INSERT INTO t1 VALUES (concat(repeat('MySQL',100),'2'),repeat('0',257));
-SELECT right(a,1) FROM t1 WHERE b = repeat('0',257) ORDER BY a ASC;
-SELECT right(a,1) FROM t1 WHERE b = repeat('0',257) ORDER BY a DESC;
-ALTER TABLE t1 DROP INDEX b;
-SELECT right(a,1) FROM t1 WHERE b = repeat('0',257) ORDER BY a ASC;
-SELECT right(a,1) FROM t1 WHERE b = repeat('0',257) ORDER BY a DESC;
-DROP TABLE t1;
-
-#
-# Bug#32948 - FKs allowed to reference partitioned table
-#
--- echo # Bug#32948
-CREATE TABLE t1 (c1 INT, PRIMARY KEY (c1)) ENGINE=INNODB;
-CREATE TABLE t2 (c1 INT, PRIMARY KEY (c1),
- FOREIGN KEY (c1) REFERENCES t1 (c1)
- ON DELETE CASCADE)
-ENGINE=INNODB;
---error ER_ROW_IS_REFERENCED
-ALTER TABLE t1 PARTITION BY HASH(c1) PARTITIONS 5;
---error ER_ROW_IS_REFERENCED
-ALTER TABLE t1 ENGINE=MyISAM;
-DROP TABLE t2;
-DROP TABLE t1;
-
-#
-# Bug #14673: Wrong InnoDB default row format
-#
-create table t1 (a int) engine=innodb partition by hash(a) ;
-# Data_free for InnoDB tablespace varies depending on which
-# tests have been run before this one
---replace_column 10 # 12 #
-show table status like 't1';
-drop table t1;
-
-#
-# Bug 21173: SHOW TABLE STATUS crashes server in InnoDB
-#
-create table t1 (a int)
-engine = innodb
-partition by key (a);
-# Data_free for InnoDB tablespace varies depending on which
-# tests have been run before this one
---replace_column 10 # 12 #
-show table status;
-insert into t1 values (0), (1), (2), (3);
-# Data_free for InnoDB tablespace varies depending on which
-# tests have been run before this one
---replace_column 10 # 12 #
-show table status;
-drop table t1;
-
-create table t1 (a int auto_increment primary key)
-engine = innodb
-partition by key (a);
-# Data_free for InnoDB tablespace varies depending on which
-# tests have been run before this one
---replace_column 10 # 12 #
-show table status;
-insert into t1 values (NULL), (NULL), (NULL), (NULL);
-# Data_free for InnoDB tablespace varies depending on which
-# tests have been run before this one
---replace_column 10 # 12 #
-show table status;
-insert into t1 values (NULL), (NULL), (NULL), (NULL);
-# Data_free for InnoDB tablespace varies depending on which
-# tests have been run before this one
---replace_column 10 # 12 #
-show table status;
-drop table t1;
-
-#
-# BUG 19122 Crash after ALTER TABLE t1 REBUILD PARTITION p1
-#
-create table t1 (a int)
-partition by key (a)
-(partition p1 engine = innodb);
-
-alter table t1 rebuild partition p1;
-alter table t1 rebuild partition p1;
-alter table t1 rebuild partition p1;
-alter table t1 rebuild partition p1;
-alter table t1 rebuild partition p1;
-alter table t1 rebuild partition p1;
-alter table t1 rebuild partition p1;
-drop table t1;
-
-#
-# Bug 21339: Crash in Explain Partitions
-#
-create table t1 (a date)
-engine = innodb
-partition by range (year(a))
-(partition p0 values less than (2006),
- partition p1 values less than (2007));
-explain partitions select * from t1
-where a between '2006-01-01' and '2007-06-01';
-drop table t1;
-
-#
-# Bug 20397: Partitions: Crash when using non-existing engine
-#
-SET SQL_MODE="";
-create table t1 (a int)
-engine = x
-partition by key (a);
-show create table t1;
-drop table t1;
-
-create table t1 (a int)
-engine = innodb
-partition by list (a)
-(partition p0 values in (0));
-
-alter table t1 engine = x;
-show create table t1;
-drop table t1;
-SET SQL_MODE=default;
-
-# BUG#26117: index_merge sort-union over partitioned table crashes
-
-create table t1
-(
- id int unsigned auto_increment,
- time datetime not null,
- first_name varchar(40),
- last_name varchar(50),
- primary key (id, time),
- index first_index (first_name),
- index last_index (last_name)
-) engine=Innodb partition by range (to_days(time)) (
- partition p1 values less than (to_days('2007-02-07')),
- partition p2 values less than (to_days('2007-02-08')),
- partition p3 values less than MAXVALUE
-);
-
-insert into t1 (time, first_name, last_name) values ('2007-02-07', 'Q', 'Robert'),
-('2007-02-07', 'Mark', 'Nate'), ('2007-02-07', 'Nate', 'Oscar'),
-('2007-02-07', 'Zack', 'Alice'), ('2007-02-07', 'Jack', 'Kathy'),
-('2007-02-06', 'Alice', 'Alice'), ('2007-02-06', 'Brian', 'Charles'),
-('2007-02-06', 'Charles', 'David'), ('2007-02-06', 'David', 'Eric'),
-('2007-02-07', 'Hector', 'Isaac'), ('2007-02-07', 'Oscar', 'Patricia'),
-('2007-02-07', 'Patricia', 'Q'), ('2007-02-07', 'X', 'Yuri'),
-('2007-02-07', 'Robert', 'Shawn'), ('2007-02-07', 'Kathy', 'Lois'),
-('2007-02-07', 'Eric', 'Francis'), ('2007-02-06', 'Shawn', 'Theron'),
-('2007-02-06', 'U', 'Vincent'), ('2007-02-06', 'Francis', 'George'),
-('2007-02-06', 'George', 'Hector'), ('2007-02-06', 'Vincent', 'Walter'),
-('2007-02-06', 'Walter', 'X'), ('2007-02-07', 'Lois', 'Mark'),
-('2007-02-07', 'Yuri', 'Zack'), ('2007-02-07', 'Isaac', 'Jack'),
-('2007-02-07', 'Sharon', 'Mark'), ('2007-02-07', 'Michael', 'Michelle'),
-('2007-02-07', 'Derick', 'Nathan'), ('2007-02-07', 'Peter', 'Xavier'),
-('2007-02-07', 'Fred', 'Harold'), ('2007-02-07', 'Katherine', 'Lisa'),
-('2007-02-07', 'Tom', 'Rina'), ('2007-02-07', 'Jerry', 'Victor'),
-('2007-02-07', 'Alexander', 'Terry'), ('2007-02-07', 'Justin', 'John'),
-('2007-02-07', 'Greg', 'Ernest'), ('2007-02-07', 'Robert', 'Q'),
-('2007-02-07', 'Nate', 'Mark'), ('2007-02-07', 'Oscar', 'Nate'),
-('2007-02-07', 'Alice', 'Zack'), ('2007-02-07', 'Kathy', 'Jack'),
-('2007-02-06', 'Alice', 'Alice'), ('2007-02-06', 'Charles', 'Brian'),
-('2007-02-06', 'David', 'Charles'), ('2007-02-06', 'Eric', 'David'),
-('2007-02-07', 'Isaac', 'Hector'), ('2007-02-07', 'Patricia', 'Oscar'),
-('2007-02-07', 'Q', 'Patricia'), ('2007-02-07', 'Yuri', 'X'),
-('2007-02-07', 'Shawn', 'Robert'), ('2007-02-07', 'Lois', 'Kathy'),
-('2007-02-07', 'Francis', 'Eric'), ('2007-02-06', 'Theron', 'Shawn'),
-('2007-02-06', 'Vincent', 'U'), ('2007-02-06', 'George', 'Francis'),
-('2007-02-06', 'Hector', 'George'), ('2007-02-06', 'Walter', 'Vincent'),
-('2007-02-06', 'X', 'Walter'), ('2007-02-07', 'Mark', 'Lois'),
-('2007-02-07', 'Zack', 'Yuri'), ('2007-02-07', 'Jack', 'Isaac'),
-('2007-02-07', 'Mark', 'Sharon'), ('2007-02-07', 'Michelle', 'Michael'),
-('2007-02-07', 'Nathan', 'Derick'), ('2007-02-07', 'Xavier', 'Peter'),
-('2007-02-07', 'Harold', 'Fred'), ('2007-02-07', 'Lisa', 'Katherine'),
-('2007-02-07', 'Rina', 'Tom'), ('2007-02-07', 'Victor', 'Jerry'),
-('2007-02-07', 'Terry', 'Alexander'), ('2007-02-07', 'John', 'Justin'),
-('2007-02-07', 'Ernest', 'Greg');
-
-SELECT * FROM t1 WHERE first_name='Andy' OR last_name='Jake';
-
-drop table t1;
-
-#
-# BUG#30583 - Partition on DOUBLE key + INNODB + count(*) == crash
-#
-CREATE TABLE t1 (a DOUBLE NOT NULL, KEY(a)) ENGINE=InnoDB
-PARTITION BY KEY(a) PARTITIONS 10;
-INSERT INTO t1 VALUES(1),(2);
-SELECT COUNT(*) FROM t1;
-DROP TABLE t1;
-
-#
-# Bug #31893 Partitions: crash if subpartitions and engine change
-#
-create table t1 (int_column int, char_column char(5))
- PARTITION BY RANGE (int_column) subpartition by key (char_column) subpartitions 2
- (PARTITION p1 VALUES LESS THAN (5) ENGINE = InnoDB);
-alter table t1
-ENGINE = MyISAM
-PARTITION BY RANGE (int_column)
- subpartition by key (char_column) subpartitions 2
- (PARTITION p1 VALUES LESS THAN (5));
-show create table t1;
-drop table t1;
-
-#
-# BUG#46483 - drop table of partitioned table may leave extraneous file
-# Note: was only repeatable with InnoDB plugin
-#
-CREATE TABLE t1 (a INT) ENGINE=InnoDB
- PARTITION BY list(a) (PARTITION p1 VALUES IN (1));
-CREATE INDEX i1 ON t1 (a);
-DROP TABLE t1;
-
-# Before the fix it should show extra file like #sql-2405_2.par
---list_files $MYSQLD_DATADIR/test/ *.par
-
---disable_parsing
---echo #
---echo # Bug#47343: InnoDB fails to clean-up after lock wait timeout on
---echo # REORGANIZE PARTITION
---echo #
-CREATE TABLE t1 (
- a INT,
- b DATE NOT NULL,
- PRIMARY KEY (a, b)
-) ENGINE=InnoDB
-PARTITION BY RANGE (a) (
- PARTITION pMAX VALUES LESS THAN MAXVALUE
-) ;
-
-INSERT INTO t1 VALUES (1, '2001-01-01'), (2, '2002-02-02'), (3, '2003-03-03');
-
-START TRANSACTION;
-SELECT * FROM t1 FOR UPDATE;
-
-connect (con1, localhost, root,,);
---error ER_LOCK_WAIT_TIMEOUT
-ALTER TABLE t1 REORGANIZE PARTITION pMAX INTO
-(PARTITION p3 VALUES LESS THAN (3),
- PARTITION pMAX VALUES LESS THAN MAXVALUE);
-SHOW WARNINGS;
---error ER_LOCK_WAIT_TIMEOUT
-ALTER TABLE t1 REORGANIZE PARTITION pMAX INTO
-(PARTITION p3 VALUES LESS THAN (3),
- PARTITION pMAX VALUES LESS THAN MAXVALUE);
-SHOW WARNINGS;
-
-#Contents of the 'test' database directory:
---list_files $MYSQLD_DATADIR/test/ *.par
-
-disconnect con1;
-connection default;
-SELECT * FROM t1;
-COMMIT;
-DROP TABLE t1;
-
-#
-# Bug #55146 Assertion `m_part_spec.start_part == m_part_spec.end_part' in index_read_idx_map
-#
-
-CREATE TABLE t1 (i1 int NOT NULL primary key, f1 int) ENGINE = InnoDB
- PARTITION BY HASH(i1) PARTITIONS 2;
-
-INSERT INTO t1 VALUES (1,1), (2,2);
-
-SELECT * FROM t1 WHERE i1 = ( SELECT i1 FROM t1 WHERE f1=0 LIMIT 1 );
-
-DROP TABLE t1;
-
---enable_parsing
-
---echo #
---echo # Bug#54783: optimize table crashes with invalid timestamp default value and NO_ZERO_DATE
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (a INT, b TIMESTAMP DEFAULT '0000-00-00 00:00:00')
- ENGINE=INNODB PARTITION BY LINEAR HASH (a) PARTITIONS 1;
-SET @old_mode = @@sql_mode;
-SET SESSION sql_mode = 'NO_ZERO_DATE';
-OPTIMIZE TABLE t1;
-SET SESSION sql_mode = @old_mode;
-DROP TABLE t1;
-
---echo #
---echo # Bug#57985 "ONLINE/FAST ALTER PARTITION can fail and leave the
---echo # table unusable".
---echo #
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-CREATE TABLE t1 (a bigint not null, b int not null, PRIMARY KEY (a))
- ENGINE = InnoDB PARTITION BY KEY(a) PARTITIONS 2;
-INSERT INTO t1 values (0,1), (1,2);
---echo # The below ALTER should fail. It should leave the
---echo # table in its original, non-corrupted, usable state.
---error ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF
-ALTER TABLE t1 ADD UNIQUE KEY (b);
---echo # The below statements should succeed, as ALTER should
---echo # have left table intact.
-SHOW CREATE TABLE t1;
-SELECT * FROM t1;
-DROP TABLE t1;
---echo #
---echo # Bug #17299181 CREATE_TIME AND UPDATE_TIME ARE
---echo # WRONG FOR PARTITIONED TABLES
---echo #
-
-CREATE TABLE t1 (a int, PRIMARY KEY (a)) ENGINE=InnoDB
-PARTITION BY HASH (a) PARTITIONS 2;
-
-SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE
-CREATE_TIME IS NOT NULL AND TABLE_NAME='t1';
-
-DROP TABLE t1;
-
---echo #
---echo # BUG#12912171 - ASSERTION FAILED: QUICK->HEAD->READ_SET ==
---echo # SAVE_READ_SET
---echo #
-CREATE TABLE t1 (
- a INT,
- b INT,
- c INT,
- PRIMARY KEY (c,a), KEY (a),KEY (a)
-) ENGINE=INNODB PARTITION BY KEY () PARTITIONS 2;
-INSERT INTO t1 VALUES (1,5,1),(2,4,1),(3,3,1),(4,2,1),(5,1,1);
-UPDATE t1 SET b = 0, c=1 WHERE a <=>0;
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-5102 : MySQL Bug 69851
---echo #
-CREATE TABLE t1 (
- `col1` bigint(20) unsigned NOT NULL ,
- `col2` bigint(20) unsigned NOT NULL ,
- `col3` datetime NOT NULL ,
- PRIMARY KEY (`col3`),
- KEY (`col1`),
- KEY (`col2`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
- PARTITION BY RANGE (TO_DAYS(col3))
-(
- PARTITION p_20130310 VALUES LESS THAN (735303) ENGINE = InnoDB,
- PARTITION p_20130311 VALUES LESS THAN (735304) ENGINE = InnoDB,
- PARTITION p_20130312 VALUES LESS THAN (735305) ENGINE = InnoDB
-);
-INSERT INTO `t1` VALUES (2,96,'2013-03-08 16:28:05');
-INSERT INTO `t1` VALUES (1,2,'2013-03-08 16:47:39');
-INSERT INTO `t1` VALUES (1,2,'2013-03-08 16:50:27');
-INSERT INTO `t1` VALUES (1,2,'2013-03-11 16:33:04');
-INSERT INTO `t1` VALUES (1,2,'2013-03-11 16:33:24');
-INSERT INTO `t1` VALUES (2,2,'2013-03-12 10:11:48');
-
-SELECT * FROM t1 WHERE col1 = 1 AND col2 = 2
- AND col3 BETWEEN '2013-03-08 00:00:00' AND '2013-03-12 12:00:00'
-GROUP BY 1, 2, 3;
---replace_column 9 #
-EXPLAIN SELECT * FROM t1 WHERE col1 = 1 AND col2 = 2
- AND col3 BETWEEN '2013-03-08 00:00:00' AND '2013-03-12 12:00:00'
-GROUP BY 1, 2, 3;
-
-SELECT * FROM t1 USE INDEX () WHERE col1 = 1 AND col2 = 2
- AND col3 BETWEEN '2013-03-08 00:00:00' AND '2013-03-12 12:00:00'
-GROUP BY 1, 2, 3;
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-5177: ha_partition and innodb index intersection produce fewer rows (MySQL Bug#70703)
---echo #
-create table t1 (
- a int not null,
- b int not null,
- pk int not null,
- primary key (pk),
- key(a),
- key(b)
-) engine=innodb partition by hash(pk) partitions 10;
-
-insert into t1 values (1,2,4); # both
-insert into t1 values (1,0,17); # left
-insert into t1 values (1,2,25); # both
-
-insert into t1 values (10,20,122);
-insert into t1 values (10,20,123);
-
-# Now, fill in some data so that the optimizer choses index_merge
-create table t2 (a int);
-insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-insert into t1 select 1,2, 200 + A.a + 10*B.a + 100*C.a from t2 A, t2 B, t2 C;
-
-insert into t1 select 10+A.a + 10*B.a + 100*C.a + 1000*D.a,
- 10+A.a + 10*B.a + 100*C.a + 1000*D.a,
- 2000 + A.a + 10*B.a + 100*C.a + 1000*D.a
- from t2 A, t2 B, t2 C ,t2 D;
-
-# This should show index_merge, using intersect
---replace_column 9 #
-explain select * from t1 where a=1 and b=2 and pk between 1 and 999999 ;
-# 794 rows in output
-create temporary table t3 as
-select * from t1 where a=1 and b=2 and pk between 1 and 999 ;
-select count(*) from t3;
-drop table t3;
-
-# 802 rows in output
-create temporary table t3 as
-select * from t1 ignore index(a,b) where a=1 and b=2 and pk between 1 and 999 ;
-select count(*) from t3;
-drop table t3;
-
-drop table t1,t2;
-
---echo #
---echo # MySQL Bug#71095: Wrong results with PARTITION BY LIST COLUMNS()
---echo #
-create table t1(c1 int, c2 int, c3 int, c4 int,
-primary key(c1,c2)) engine=InnoDB
-partition by list columns(c2)
-(partition p1 values in (1,2) engine=InnoDB,
-partition p2 values in (3,4) engine=InnoDB);
-
-insert into t1 values (1,1,1,1),(2,3,1,1);
-select * from t1 where c1=2 and c2=3;
-drop table t1;
-
---echo #
---echo # MySQL Bug#72803: Wrong "Impossible where" with LIST partitioning
---echo # also MDEV-6240: Wrong "Impossible where" with LIST partitioning
---echo #
-CREATE TABLE t1 ( d DATE) ENGINE = InnoDB
-PARTITION BY LIST COLUMNS (d)
-(
- PARTITION p0 VALUES IN ('1990-01-01','1991-01-01'),
- PARTITION p1 VALUES IN ('1981-01-01')
-);
-
-INSERT INTO t1 (d) VALUES ('1991-01-01');
-SELECT * FROM t1 WHERE d = '1991-01-01';
-DROP TABLE t1;
-
-set global default_storage_engine=default;
-
---echo #
---echo # MDEV-9455: [ERROR] mysqld got signal 11
---echo #
-
-CREATE TABLE `t1` (
- `DIARY_TOTAL_DAY_SEQ` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
- `IMORY_ID` bigint(20) NOT NULL,
- `NAME` varchar(75) DEFAULT NULL,
- `DATETIME` varchar(10) NOT NULL DEFAULT '',
- `DAILY_CALL_CNT` int(11) DEFAULT NULL,
- `DAILY_SMS_CNT` int(11) DEFAULT NULL,
- `NUMBER` varchar(64) DEFAULT NULL,
- `DURATION` varchar(16) DEFAULT NULL,
- PRIMARY KEY (`DIARY_TOTAL_DAY_SEQ`,`DATETIME`),
- KEY `IDX_t1_01` (`IMORY_ID`,`DATETIME`)
-) AUTO_INCREMENT=328702514 DEFAULT CHARSET=utf8mb4
-PARTITION BY RANGE COLUMNS(`DATETIME`)
-(PARTITION p0 VALUES LESS THAN ('2015-10-01') ENGINE = InnoDB,
- PARTITION p1 VALUES LESS THAN ('2015-11-01') ENGINE = InnoDB,
- PARTITION p2 VALUES LESS THAN ('2015-12-01') ENGINE = InnoDB,
- PARTITION p3 VALUES LESS THAN ('2016-01-01') ENGINE = InnoDB,
- PARTITION p4 VALUES LESS THAN ('2016-02-01') ENGINE = InnoDB,
- PARTITION p5 VALUES LESS THAN ('2016-03-01') ENGINE = InnoDB,
- PARTITION p6 VALUES LESS THAN ('2016-04-01') ENGINE = InnoDB,
- PARTITION p7 VALUES LESS THAN ('2016-05-01') ENGINE = InnoDB,
- PARTITION p8 VALUES LESS THAN ('2016-06-01') ENGINE = InnoDB,
- PARTITION p9 VALUES LESS THAN ('2016-07-01') ENGINE = InnoDB,
- PARTITION p10 VALUES LESS THAN ('2016-08-01') ENGINE = InnoDB)
-;
-
-CREATE TABLE `t2` (
- `DIARY_SEQ` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
- `IMORY_ID` bigint(20) NOT NULL,
- `CALL_TYPE` varchar(1) DEFAULT NULL,
- `DATA_TYPE` varchar(1) DEFAULT NULL,
- `FEATURES` varchar(1) DEFAULT NULL,
- `NAME` varchar(75) DEFAULT NULL,
- `NUMBER` varchar(64) DEFAULT NULL,
- `DATETIME` datetime NOT NULL,
- `REG_DATE` datetime NOT NULL,
- `TITLE` varchar(50) DEFAULT NULL,
- `BODY` varchar(4200) DEFAULT NULL,
- `MIME_TYPE` varchar(32) DEFAULT NULL,
- `DURATION` varchar(16) DEFAULT NULL,
- `DEVICE_ID` varchar(64) DEFAULT NULL,
- `DEVICE_NAME` varchar(32) DEFAULT NULL,
- PRIMARY KEY (`DIARY_SEQ`,`DATETIME`,`REG_DATE`),
- KEY `IDX_TB_DIARY_01` (`IMORY_ID`,`DATETIME`,`CALL_TYPE`,`NUMBER`),
- KEY `IDX_TB_DIARY_02` (`REG_DATE`)
-) AUTO_INCREMENT=688799006 DEFAULT CHARSET=utf8mb4
-PARTITION BY RANGE COLUMNS(REG_DATE)
-(PARTITION p0 VALUES LESS THAN ('2015-10-01') ENGINE = InnoDB,
- PARTITION p1 VALUES LESS THAN ('2015-11-01') ENGINE = InnoDB,
- PARTITION p2 VALUES LESS THAN ('2015-12-01') ENGINE = InnoDB,
- PARTITION p3 VALUES LESS THAN ('2016-01-01') ENGINE = InnoDB,
- PARTITION p4 VALUES LESS THAN ('2016-02-01') ENGINE = InnoDB,
- PARTITION p5 VALUES LESS THAN ('2016-03-01') ENGINE = InnoDB,
- PARTITION p6 VALUES LESS THAN ('2016-04-01') ENGINE = InnoDB,
- PARTITION p7 VALUES LESS THAN ('2016-05-01') ENGINE = InnoDB,
- PARTITION p8 VALUES LESS THAN ('2016-06-01') ENGINE = InnoDB,
- PARTITION p9 VALUES LESS THAN ('2016-07-01') ENGINE = InnoDB,
- PARTITION p10 VALUES LESS THAN ('2016-08-01') ENGINE = InnoDB)
-;
-
-SELECT
- A.IMORY_ID,
- A.NUMBER,
- A.NAME,
- DATE_FORMAT(A.DATETIME, '%Y-%m-%d') AS TARGET_DATE,
- SUM( CASE WHEN A.DATA_TYPE='1' THEN 1 ELSE 0 END) AS CALL_CNT,
- SUM( CASE WHEN A.DATA_TYPE IN ('2', '3') THEN 1 ELSE 0 END) AS SMS_CNT,
- SUM(CAST(A.DURATION AS INT)) AS DURATION,
- ( SELECT COUNT(*)
- FROM t1
- WHERE IMORY_ID=A.IMORY_ID
- AND NUMBER=A.NUMBER
- AND NAME=A.NAME
- AND DATETIME = DATE_FORMAT(A.DATETIME, '%Y-%m-%d')
- ) STATS_COUNT
-FROM t2 A
-WHERE A.IMORY_ID = 55094102
- AND A.DATETIME LIKE (
- SELECT CONCAT (DATE_FORMAT(DATETIME, '%Y-%m-%d') ,'%')
- FROM t2
- WHERE IMORY_ID=55094102
- AND DIARY_SEQ IN ( 608351221, 608351225, 608351229 )
- group by DATE_FORMAT(DATETIME, '%Y-%m-%d')
- )
-GROUP BY A.IMORY_ID, A.NUMBER, A.NAME, DATE_FORMAT(A.DATETIME, '%Y-%m-%d')
-;
-
-drop table t2, t1;
-
-
-set global default_storage_engine='innodb';
-
---echo #
---echo # MDEV-5963: InnoDB: Assertion failure in file row0sel.cc line 2503,
---echo # Failing assertion: 0 with "key ptr now exceeds key end by 762 bytes"
---echo # (independent testcase for Oracle Bug#13947868)
---echo #
-CREATE TABLE t1 (f1 VARCHAR(512) CHARACTER SET utf8) ENGINE=InnoDB;
-INSERT INTO t1 VALUES ('j');
-
-CREATE TABLE t2 (
- f2 VARCHAR(5) CHARACTER SET latin1,
- f3 VARCHAR(5) CHARACTER SET utf8,
- f4 INT,
- f5 VARCHAR(512) CHARACTER SET utf8,
- f6 VARCHAR(256) CHARACTER SET utf8,
- key (f2),
- key (f3),
- key (f5)
-) ENGINE=InnoDB PARTITION BY LIST COLUMNS (f4)
- SUBPARTITION BY KEY(f6) SUBPARTITIONS 4 (
- PARTITION p0 VALUES IN (1,3,9,null),
- PARTITION p1 VALUES IN (2,4,0)
-);
-
-INSERT INTO t2 VALUES
- ('k','s',3,'b','j'),('a','b',NULL,'v','j'),('c','m',9,'t',NULL),
- ('b','l',9,'b',NULL),('i','y',3,'o','w'),('c','m',NULL,'a','m'),
- ('f','o',9,'m','w'),('f','q',NULL,'o','a');
-
-CREATE TABLE t3 LIKE t2;
-
-SELECT * FROM t1 INNER JOIN t2 ON ( f5 = f1 );
-INSERT INTO t3 SELECT * FROM t2 WHERE f3 = 'm' AND f2 ='c';
-
-DROP TABLE t1,t2,t3;
-
-set global default_storage_engine=default;
-
---echo #
---echo # Bug#13737949: CRASH IN HA_PARTITION::INDEX_INIT
---echo # Bug#18694052: SERVER CRASH IN HA_PARTITION::INIT_RECORD_PRIORITY_QUEUE
---echo #
-CREATE TABLE t1
-(a INT,
- b INT,
- PRIMARY KEY (a))
- ENGINE = InnoDB
- PARTITION BY HASH (a) PARTITIONS 3;
- START TRANSACTION WITH CONSISTENT SNAPSHOT;
- --connect (con1, localhost, root,,)
- ALTER TABLE t1 ADD INDEX idx1 (b);
- --connection default
- --error ER_TABLE_DEF_CHANGED
- SELECT b FROM t1 WHERE b = 0;
- --error ER_TABLE_DEF_CHANGED
- SELECT b FROM t1 WHERE b = 0;
- --disconnect con1
- DROP TABLE t1;
-
---echo # Same test without partitioning
-CREATE TABLE t1
-(a INT,
- b INT,
- PRIMARY KEY (a))
- ENGINE = InnoDB;
-START TRANSACTION WITH CONSISTENT SNAPSHOT;
---connect (con1, localhost, root,,)
-ALTER TABLE t1 ADD INDEX idx1 (b);
---connection default
---error ER_TABLE_DEF_CHANGED
-SELECT b FROM t1 WHERE b = 0;
---error ER_TABLE_DEF_CHANGED
-SELECT b FROM t1 WHERE b = 0;
---disconnect con1
-DROP TABLE t1;
-
---echo #
---echo # Bug#26390658 RENAMING A PARTITIONED TABLE DOES NOT UPDATE
---echo # MYSQL.INNODB_TABLE_STATS
---echo #
-
-CREATE DATABASE test_jfg;
-
-CREATE TABLE test_jfg.test_jfg1 (id int(10) unsigned NOT NULL,PRIMARY
-KEY (id)) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=1;
-CREATE TABLE test_jfg.test_jfg2 (id int(10) unsigned NOT NULL,PRIMARY
-KEY (id)) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=1
-PARTITION BY RANGE ( id ) (PARTITION p1000 VALUES LESS THAN (1000)
-ENGINE = InnoDB,PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE =
-InnoDB);
-
---replace_result #p# #P#
-SELECT database_name, table_name FROM mysql.innodb_table_stats WHERE
-database_name = 'test_jfg';
-
-RENAME TABLE test_jfg.test_jfg1 TO test_jfg.test_jfg11;
-RENAME TABLE test_jfg.test_jfg2 TO test_jfg.test_jfg12;
-
---replace_result #p# #P#
-SELECT database_name, table_name FROM mysql.innodb_table_stats WHERE
-database_name = 'test_jfg';
-
-DROP DATABASE test_jfg;
diff --git a/mysql-test/t/partition_innodb_plugin.test b/mysql-test/t/partition_innodb_plugin.test
deleted file mode 100644
index 74e1747746b..00000000000
--- a/mysql-test/t/partition_innodb_plugin.test
+++ /dev/null
@@ -1,153 +0,0 @@
---source include/have_partition.inc
---source include/have_innodb.inc
-
-let $MYSQLD_DATADIR= `SELECT @@datadir`;
-
-call mtr.add_suppression("InnoDB: Table .* does not exist in the InnoDB internal data dictionary .*");
-call mtr.add_suppression("Deadlock found when trying to get lock; try restarting transaction");
-
---echo #
---echo # Bug#11766879/Bug#60106: DIFF BETWEEN # OF INDEXES IN MYSQL VS INNODB,
---echo # PARTITONING, ON INDEX CREATE
---echo # Bug#12696518: MEMORY LEAKS IN HA_PARTITION (VALGRIND TESTS ON TRUNK)
---echo #
-CREATE TABLE t1 (
- id bigint NOT NULL AUTO_INCREMENT,
- time date,
- id2 bigint not null,
- PRIMARY KEY (id,time)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8
-/*!50100 PARTITION BY RANGE(TO_DAYS(time))
-(PARTITION p10 VALUES LESS THAN (734708) ENGINE = InnoDB,
- PARTITION p20 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */;
-
-INSERT INTO t1 (time,id2) VALUES ('2011-07-24',1);
-INSERT INTO t1 (time,id2) VALUES ('2011-07-25',1);
-INSERT INTO t1 (time,id2) VALUES ('2011-07-25',1);
-
---error ER_DUP_ENTRY
-CREATE UNIQUE INDEX uk_time_id2 on t1(time,id2);
-
-SELECT COUNT(*) FROM t1;
-SHOW CREATE TABLE t1;
-
-DROP TABLE t1;
-
-call mtr.add_suppression("InnoDB: Error: table `test`.`t1` .* InnoDB internal");
---echo #
---echo # Bug#55091: Server crashes on ADD PARTITION after a failed attempt
---echo #
-SET @old_innodb_file_per_table = @@global.innodb_file_per_table;
-SET @old_innodb_strict_mode = @@global.innodb_strict_mode;
-SET @@global.innodb_file_per_table = ON,
-@@global.innodb_strict_mode = ON;
-
---connect(con1,localhost,root,,)
-
-CREATE TABLE t1 (id INT NOT NULL
-PRIMARY KEY,
-user_num CHAR(10)
-) ENGINE = InnoDB
-KEY_BLOCK_SIZE=4
-PARTITION BY HASH(id) PARTITIONS 1;
-
---replace_result #p# #P#
---list_files $MYSQLD_DATADIR/test t1*
-SHOW CREATE TABLE t1;
-
-SET GLOBAL innodb_file_per_table = OFF;
-
---disconnect con1
---connect(con2,localhost,root,,)
-
-LOCK TABLE t1 WRITE;
-
---echo # ALTER fails because COMPRESSED/KEY_BLOCK_SIZE
---echo # are incompatible with innodb_file_per_table = OFF;
-
---replace_regex / - .*//
---error ER_GET_ERRNO
-ALTER TABLE t1 ADD PARTITION PARTITIONS 1;
-
---replace_result #p# #P#
---list_files $MYSQLD_DATADIR/test t1*
---echo # This SET is not needed to reproduce the bug,
---echo # it is here just to make the test case more realistic
-SET innodb_strict_mode = OFF;
-
-ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
---replace_result #p# #P#
---list_files $MYSQLD_DATADIR/test t1*
-
-# really bug#56172
-ALTER TABLE t1 REBUILD PARTITION p0;
-
-UNLOCK TABLES;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
---disconnect con2
---connection default
-SET @@global.innodb_strict_mode = @old_innodb_strict_mode;
-SET @@global.innodb_file_per_table = @old_innodb_file_per_table;
-
-#
-# Bug#32430 - show engine innodb status causes errors
-#
-SET NAMES utf8;
-CREATE TABLE `t``\""e` (a INT, PRIMARY KEY (a))
-ENGINE=InnoDB
-PARTITION BY RANGE (a)
-SUBPARTITION BY HASH (a)
-(PARTITION `p0``\""e` VALUES LESS THAN (100)
- (SUBPARTITION `sp0``\""e`,
- SUBPARTITION `sp1``\""e`),
- PARTITION `p1``\""e` VALUES LESS THAN (MAXVALUE)
- (SUBPARTITION `sp2``\""e`,
- SUBPARTITION `sp3``\""e`));
-INSERT INTO `t``\""e` VALUES (0), (2), (6), (10), (14), (18), (22);
-START TRANSACTION;
-connect(con1,localhost,root,,);
-SET NAMES utf8;
-START TRANSACTION;
-connection default;
-UPDATE `t``\""e` SET a = 16 WHERE a = 0;
-connection con1;
-UPDATE `t``\""e` SET a = 8 WHERE a = 22;
-let $id_1= `SELECT CONNECTION_ID()`;
-SEND;
-UPDATE `t``\""e` SET a = 12 WHERE a = 0;
-connection default;
-let $wait_condition= SELECT COUNT(*)=2 FROM INFORMATION_SCHEMA.INNODB_LOCKS;
---source include/wait_condition.inc
---sorted_result
-SELECT lock_table, COUNT(*) FROM INFORMATION_SCHEMA.INNODB_LOCKS
-GROUP BY lock_table;
-set @old_sql_mode = @@sql_mode;
-set sql_mode = 'ANSI_QUOTES';
---sorted_result
-SELECT lock_table, COUNT(*) FROM INFORMATION_SCHEMA.INNODB_LOCKS
-GROUP BY lock_table;
-set @@sql_mode = @old_sql_mode;
---error ER_LOCK_DEADLOCK
-UPDATE `t``\""e` SET a = 4 WHERE a = 22;
---echo # First table reported in 'SHOW ENGINE InnoDB STATUS'
-# RECORD LOCKS space id 0 page no 50 n bits 80 index `PRIMARY` in \
-# Database `test`, Table `t1`, Partition `p0`, Subpartition `sp0` \
-# trx id 0 775
-# NOTE: replace_regex is very slow on match copy/past '(.*)' regex's
-# on big texts, removing a lot of text before + after makes it much faster.
-#/.*in (.*) trx.*/\1/
---replace_regex /.*RECORD LOCKS space id [0-9]* page no [0-9]* n bits [0-9]* // / trx id .*// /.*index .* in // /trx table locks [0-9]* // /total table locks [0-9]* //
-SHOW ENGINE InnoDB STATUS;
-set @old_sql_mode = @@sql_mode;
-set sql_mode = 'ANSI_QUOTES';
---replace_regex /.*RECORD LOCKS space id [0-9]* page no [0-9]* n bits [0-9]* // / trx id .*// /.*index .* in // /trx table locks [0-9]* // /total table locks [0-9]* //
-SHOW ENGINE InnoDB STATUS;
-set @@sql_mode = @old_sql_mode;
-connection con1;
-REAP;
-ROLLBACK;
-disconnect con1;
-connection default;
-DROP TABLE `t``\""e`;
diff --git a/mysql-test/t/partition_innodb_semi_consistent-master.opt b/mysql-test/t/partition_innodb_semi_consistent-master.opt
deleted file mode 100644
index a177f285d66..00000000000
--- a/mysql-test/t/partition_innodb_semi_consistent-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-innodb-lock-wait-timeout=2 --default-storage-engine=MyISAM
diff --git a/mysql-test/t/partition_innodb_semi_consistent.test b/mysql-test/t/partition_innodb_semi_consistent.test
deleted file mode 100644
index 7a1dfc36173..00000000000
--- a/mysql-test/t/partition_innodb_semi_consistent.test
+++ /dev/null
@@ -1,201 +0,0 @@
--- source include/have_partition.inc
--- source include/not_embedded.inc
--- source include/have_innodb.inc
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-# basic tests of semi-consistent reads
-# for verifying Bug#40595: Non-matching rows not released with READ-COMMITTED
-# on tables with partitions
-
-connect (a,localhost,root,,);
-connect (b,localhost,root,,);
-connection a;
-set binlog_format=mixed;
-set session transaction isolation level repeatable read;
-create table t1(a int not null)
-engine=innodb
-DEFAULT CHARSET=latin1
-PARTITION BY RANGE(a)
-(PARTITION p0 VALUES LESS THAN (20),
- PARTITION p1 VALUES LESS THAN MAXVALUE);
-insert into t1 values (1),(2),(3),(4),(5),(6),(7);
-set autocommit=0;
-# this should lock the entire table
-select * from t1 where a=3 lock in share mode;
-connection b;
-set binlog_format=mixed;
-set session transaction isolation level repeatable read;
-set autocommit=0;
--- error ER_LOCK_WAIT_TIMEOUT
-update t1 set a=10 where a=5;
-commit;
-connection a;
-#DELETE FROM t1 WHERE a=5;
-commit;
-connection b;
-# perform a semi-consisent read (and unlock non-matching rows)
-set session transaction isolation level read committed;
-update t1 set a=10 where a=5;
-connection a;
--- error ER_LOCK_WAIT_TIMEOUT
-select * from t1 where a=2 for update;
-# this should lock the records (1),(2)
-select * from t1 where a=2 limit 1 for update;
-connection b;
-# semi-consistent read will skip non-matching locked rows a=1, a=2
-update t1 set a=11 where a=6;
--- error ER_LOCK_WAIT_TIMEOUT
-update t1 set a=12 where a=2;
--- error ER_LOCK_WAIT_TIMEOUT
-update t1 set a=13 where a=1;
-connection a;
-commit;
-connection b;
-update t1 set a=14 where a=1;
-commit;
-connection a;
---sorted_result
-select * from t1;
-drop table t1;
-
-connection default;
-disconnect a;
-disconnect b;
-
-#
-# Bug #31310: Locked rows silently skipped in read-committed isolation level.
-# (This also tests the '*_semi_consistent*' functions in partitioning)
-# Copied from include/mix1.inc
-
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-SET SESSION AUTOCOMMIT = 0;
-SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
-set binlog_format=mixed;
-connection con1;
-
-eval
-CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(256))
-ENGINE = InnoDB
-PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (300),
- PARTITION p1 VALUES LESS THAN MAXVALUE);
-INSERT INTO t1 VALUES (1,2);
-
---echo # 1. test for locking:
-
-BEGIN;
---enable_info
-UPDATE t1 SET b = 12 WHERE a = 1;
---disable_info
-SELECT * FROM t1;
-
-connection con2;
-
---enable_info
---disable_abort_on_error
---error ER_LOCK_WAIT_TIMEOUT
-UPDATE t1 SET b = 21 WHERE a = 1;
---disable_info
-ROLLBACK;
-
-connection con1;
-SELECT * FROM t1;
-ROLLBACK;
-
---echo # 2. test for serialized update:
-
-CREATE TABLE t2 (a INT);
-
-TRUNCATE t1;
-INSERT INTO t1 VALUES (1,'init');
-
-DELIMITER |;
-CREATE PROCEDURE p1()
-BEGIN
- # retry the UPDATE in case it times out the lock before con1 has time
- # to COMMIT.
- DECLARE do_retry INT DEFAULT 0;
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET do_retry = 1;
- retry_loop:LOOP
- UPDATE t1 SET b = CONCAT(b, '+con2') WHERE a = 1;
- IF do_retry = 0 THEN
- LEAVE retry_loop;
- END IF;
- SET do_retry = 0;
- END LOOP;
- INSERT INTO t2 VALUES ();
-END|
-DELIMITER ;|
-
-BEGIN;
---enable_info
-UPDATE t1 SET b = CONCAT(b, '+con1') WHERE a = 1;
---disable_info
-SELECT * FROM t1;
-
-connection con2;
-
---send CALL p1;
-
-connection con1;
-SELECT * FROM t1;
-COMMIT;
-
-let $bug31310 = 1;
-while ($bug31310)
-{
- let $bug31310= `SELECT 1 - COUNT(*) FROM t2`;
-}
-
-SELECT * FROM t1;
-
-connection con2;
---reap
-SELECT * FROM t1;
-COMMIT;
-
-connection con1;
-
---echo # 3. test for updated key column:
-
-TRUNCATE t1;
-DELETE FROM t2;
-
-INSERT INTO t1 VALUES (1,'init');
-
-BEGIN;
---enable_info
-UPDATE t1 SET a = 2, b = CONCAT(b, '+con1') WHERE a = 1;
---disable_info
-SELECT * FROM t1;
-
-connection con2;
-
---send CALL p1;
-
-connection con1;
-SELECT * FROM t1;
-COMMIT;
-
-let $bug31310 = 1;
-while ($bug31310)
-{
- let $bug31310= `SELECT 1 - COUNT(*) FROM t2`;
-}
-
-SELECT * FROM t1;
-
-connection con2;
-reap;
-SELECT * FROM t1;
-
-connection default;
-disconnect con1;
-disconnect con2;
-DROP PROCEDURE p1;
-DROP TABLE t1, t2;
-
diff --git a/mysql-test/t/partition_innodb_stmt.test b/mysql-test/t/partition_innodb_stmt.test
deleted file mode 100644
index 96a59cb9311..00000000000
--- a/mysql-test/t/partition_innodb_stmt.test
+++ /dev/null
@@ -1,56 +0,0 @@
---source include/have_partition.inc
---source include/have_binlog_format_statement.inc
---source include/have_innodb.inc
-
-SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
-
-CREATE TABLE t1
-(
- id SMALLINT NOT NULL,
- PRIMARY KEY (id)
-) ENGINE=innodb
-PARTITION BY RANGE (id)
-(
- PARTITION p1 VALUES LESS THAN (2),
- PARTITION p2 VALUES LESS THAN (4),
- PARTITION p3 VALUES LESS THAN (10)
-);
-
-INSERT INTO t1 VALUES (1),(2),(3);
-
---echo # Test READ COMMITTED -> REPEATABLE READ
-FLUSH TABLES;
-SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
-BEGIN;
-SELECT * FROM t1;
-
-connect (con1, localhost, root,,);
-connection con1;
-
-SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
-BEGIN;
-INSERT INTO t1 VALUES(7);
-COMMIT;
-
-connection default;
-COMMIT;
-
-FLUSH TABLES;
-
---echo # Test REPEATABLE READ -> READ COMMITTED
-SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
-BEGIN;
-SELECT * FROM t1;
-
-connection con1;
-
-SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
-BEGIN;
---error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE
-INSERT INTO t1 VALUES(9);
-COMMIT;
-
-disconnect con1;
-connection default;
-COMMIT;
-DROP TABLE t1;
diff --git a/mysql-test/t/partition_key_cache.test b/mysql-test/t/partition_key_cache.test
deleted file mode 100644
index 067eb7fae59..00000000000
--- a/mysql-test/t/partition_key_cache.test
+++ /dev/null
@@ -1,279 +0,0 @@
-# Test of key cache with partitions
---source include/have_partition.inc
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2, v, x;
---enable_warnings
-
---echo # Actual test of key caches
---echo # Verifing that reads/writes use the key cache correctly
-SELECT @org_key_cache_buffer_size:= @@global.default.key_buffer_size;
---echo # Minimize default key cache (almost disabled).
-SET @@global.default.key_buffer_size = 4096;
-CREATE TABLE t1 (
- a INT,
- b INT,
- c INT NOT NULL,
- PRIMARY KEY (a),
- KEY `inx_b` (b))
-PARTITION BY RANGE (a)
-SUBPARTITION BY HASH (a)
-(PARTITION p0 VALUES LESS THAN (1167602410)
- (SUBPARTITION sp0,
- SUBPARTITION sp1),
- PARTITION p1 VALUES LESS THAN MAXVALUE
- (SUBPARTITION sp2,
- SUBPARTITION sp3));
-CREATE TABLE t2 (
- a INT,
- b INT,
- c INT NOT NULL,
- PRIMARY KEY (a),
- KEY `inx_b` (b));
-FLUSH TABLES;
-FLUSH STATUS;
-
-# Genereate 4096 rows. Idea from:
-# http://datacharmer.blogspot.com/2007/12/data-from-nothing-solution-to-pop-quiz.html
-SET @a:=1167602400;
-CREATE VIEW v AS SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4;
-CREATE VIEW x AS SELECT 1 FROM v,v a,v b;
-# due to I_S performance, this was substituted with include files which
-# uses SHOW STATUS
-#DELIMITER |;
-#CREATE PROCEDURE was_zero_reads()
-#BEGIN
-# SELECT IF(VARIABLE_VALUE = 0,"Yes!","No!") as 'Was zero reads?'
-# FROM INFORMATION_SCHEMA.SESSION_STATUS
-# WHERE VARIABLE_NAME = 'KEY_READS';
-# FLUSH STATUS;
-#END|
-#DELIMITER ;|
-
-FLUSH STATUS;
-INSERT t1 SELECT @a, @a * (1 - ((@a % 2) * 2)) , 1167612400 - (@a:=@a+1) FROM x, x y;
---source include/check_key_req.inc
---echo # row distribution:
-SELECT PARTITION_NAME, SUBPARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA='test' and TABLE_NAME='t1';
-DROP VIEW x;
-DROP VIEW v;
-FLUSH TABLES;
-FLUSH STATUS;
-SELECT COUNT(b) FROM t1 WHERE b >= 0;
---source include/check_key_reads.inc
-INSERT t2 SELECT a,b,c FROM t1;
---source include/check_key_req.inc
-FLUSH STATUS;
-SELECT COUNT(b) FROM t2 WHERE b >= 0;
---source include/check_key_reads.inc
-FLUSH TABLES;
---echo # Setting the default key cache to 1M
-SET GLOBAL key_buffer_size = 1024*1024;
-FLUSH STATUS;
---echo # All these have to read the indexes
-LOAD INDEX INTO CACHE t1 PARTITION (p1);
---source include/check_key_reads.inc
-SELECT COUNT(b) FROM t1 WHERE b >= 0;
---source include/check_key_reads.inc
-SELECT COUNT(b) FROM t2 WHERE b >= 0;
---source include/check_key_reads.inc
---echo # All these should be able to use the key cache
-SELECT COUNT(b) FROM t1 WHERE b >= 0;
---source include/check_key_reads.inc
-SELECT COUNT(b) FROM t2 WHERE b >= 0;
---source include/check_key_reads.inc
-FLUSH TABLES;
-LOAD INDEX INTO CACHE t1 PARTITION (p1,p0);
---source include/check_key_reads.inc
---echo # should not be zero
-SELECT COUNT(b) FROM t1 WHERE b >= 0;
---source include/check_key_reads.inc
-LOAD INDEX INTO CACHE t2;
---source include/check_key_reads.inc
---echo # should not be zero
-SELECT COUNT(b) FROM t2 WHERE b >= 0;
---source include/check_key_reads.inc
-FLUSH TABLES;
-LOAD INDEX INTO CACHE t1 PARTITION (p1,p0) IGNORE LEAVES;
---source include/check_key_reads.inc
---echo # should not be zero
-SELECT COUNT(b) FROM t1 WHERE b >= 0;
---source include/check_key_reads.inc
-LOAD INDEX INTO CACHE t2 IGNORE LEAVES;
---source include/check_key_reads.inc
---echo # should not be zero
-SELECT COUNT(b) FROM t2 WHERE b >= 0;
---source include/check_key_reads.inc
-TRUNCATE TABLE t2;
-INSERT t2 SELECT a,b,c FROM t1;
---source include/check_key_req.inc
-DROP TABLE t1,t2;
-
-SET GLOBAL hot_cache.key_buffer_size = 1024*1024;
-SET GLOBAL warm_cache.key_buffer_size = 1024*1024;
-SET @@global.cold_cache.key_buffer_size = 1024*1024;
-SELECT @@global.default.key_buffer_size a, @@global.default.key_cache_block_size b, @@global.default.key_cache_age_threshold c, @@global.default.key_cache_division_limit d;
-SELECT @@global.hot_cache.key_buffer_size a, @@global.hot_cache.key_cache_block_size b, @@global.hot_cache.key_cache_age_threshold c, @@global.hot_cache.key_cache_division_limit d;
-SELECT @@global.warm_cache.key_buffer_size a, @@global.warm_cache.key_cache_block_size b, @@global.warm_cache.key_cache_age_threshold c, @@global.warm_cache.key_cache_division_limit d;
-SELECT @@global.cold_cache.key_buffer_size a, @@global.cold_cache.key_cache_block_size b, @@global.cold_cache.key_cache_age_threshold c, @@global.cold_cache.key_cache_division_limit d;
-CREATE TABLE t1 (
- a INT,
- b VARCHAR(257),
- c INT NOT NULL,
- PRIMARY KEY (a),
- KEY `inx_b` (b),
- KEY `inx_c`(c))
-PARTITION BY RANGE (a)
-SUBPARTITION BY HASH (a)
-(PARTITION p0 VALUES LESS THAN (10)
- (SUBPARTITION sp0,
- SUBPARTITION sp1),
- PARTITION p1 VALUES LESS THAN MAXVALUE
- (SUBPARTITION sp2,
- SUBPARTITION sp3));
-CREATE TABLE t2 (
- a INT,
- b VARCHAR(257),
- c INT NOT NULL,
- PRIMARY KEY (a),
- KEY `inx_b` (b),
- KEY `inx_c`(c));
-SET @a:=1167602400;
-# Genereate 4096 rows. Idea from:
-# http://datacharmer.blogspot.com/2007/12/data-from-nothing-solution-to-pop-quiz.html
-CREATE VIEW v AS SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4;
-CREATE VIEW x AS SELECT 1 FROM v,v a,v b;
-INSERT t1 SELECT @a, CONCAT('X_', @a, ' MySQL'), 1167612400 - (@a:=@a+1) FROM x, x a;
-DROP VIEW x;
-DROP VIEW v;
-INSERT t2 SELECT a, b, c FROM t1;
-SELECT COUNT(*) FROM t1;
-SELECT COUNT(*) FROM t2;
-FLUSH TABLES;
-
---echo # Restrict partitioned commands to partitioned tables only
---error ER_PARTITION_MGMT_ON_NONPARTITIONED
-CACHE INDEX t2 PARTITION (p0) KEY (`inx_b`) IN hot_cache;
---error ER_PARTITION_MGMT_ON_NONPARTITIONED
-CACHE INDEX t2 PARTITION (p0,`p1`) INDEX (`PRIMARY`) IN hot_cache;
---error ER_PARTITION_MGMT_ON_NONPARTITIONED
-CACHE INDEX t2 PARTITION (`p1`) INDEX (`PRIMARY`,`inx_b`) IN hot_cache;
---error ER_PARTITION_MGMT_ON_NONPARTITIONED
-CACHE INDEX t2 PARTITION (ALL) KEY (`inx_b`,`PRIMARY`) IN hot_cache;
---echo # Basic key cache testing
---echo # The manual correctly says: "The syntax of CACHE INDEX enables you to
---echo # specify that only particular indexes from a table should be assigned
---echo # to the cache. The current implementation assigns all the table's
---echo # indexes to the cache, so there is no reason to specify anything
---echo # other than the table name."
---echo # So the most of the test only tests the syntax
-CACHE INDEX t2 INDEX (`inx_b`) IN hot_cache;
-CACHE INDEX t2 KEY (`PRIMARY`) IN warm_cache;
-CACHE INDEX t2 KEY (`PRIMARY`,`inx_b`) IN cold_cache;
-CACHE INDEX t2 INDEX (inx_b,`PRIMARY`) IN default;
-CACHE INDEX t1 PARTITION (p0) KEY (`inx_b`) IN cold_cache;
---error ER_PARSE_ERROR
-CACHE INDEX t1 PARTITIONS (p0) KEY (`inx_b`) IN cold_cache;
---echo # only one table at a time if specifying partitions
---error ER_PARSE_ERROR
-CACHE INDEX t1,t2 PARTITION (p0) KEY (`inx_b`) IN cold_cache;
-CACHE INDEX t1 PARTITION (`p0`,p1) INDEX (`PRIMARY`) IN warm_cache;
-CACHE INDEX t1 PARTITION (`p1`) INDEX (`PRIMARY`,inx_b) IN hot_cache;
-CACHE INDEX t1 PARTITION (ALL) KEY (`inx_b`,`PRIMARY`) IN default;
-CACHE INDEX t1 PARTITION (ALL) IN hot_cache;
-CACHE INDEX t1 INDEX (`inx_b`) IN default;
-CACHE INDEX t1 KEY (`PRIMARY`) IN hot_cache;
-CACHE INDEX t1 KEY (`PRIMARY`,`inx_b`) IN warm_cache;
-CACHE INDEX t1 INDEX (`inx_b`,`PRIMARY`) IN cold_cache;
-CACHE INDEX t1 IN hot_cache;
---echo # Test of non existent key cache:
---error ER_UNKNOWN_KEY_CACHE
-CACHE INDEX t1 IN non_existent_key_cache;
---echo # Basic testing of LOAD INDEX
-LOAD INDEX INTO CACHE t2;
---echo # PRIMARY and secondary keys have different block sizes
-LOAD INDEX INTO CACHE t2 ignore leaves;
---echo # Must have INDEX or KEY before the index list
---error ER_PARSE_ERROR
-LOAD INDEX INTO CACHE t2 (`PRIMARY`);
-
---echo # Test of IGNORE LEAVES
-LOAD INDEX INTO CACHE t2 INDEX (`PRIMARY`);
-LOAD INDEX INTO CACHE t2 KEY (`PRIMARY`,`inx_b`) IGNORE LEAVES;
-CACHE INDEX t2 IN warm_cache;
-CACHE INDEX t1 IN cold_cache;
-LOAD INDEX INTO CACHE t2 KEY (`PRIMARY`) IGNORE LEAVES;
-CACHE INDEX t2 INDEX (`inx_b`, `inx_c`) IN hot_cache;
-LOAD INDEX INTO CACHE t2 KEY (`inx_b`, `inx_c`) IGNORE LEAVES;
-CACHE INDEX t2 IN warm_cache;
-CACHE INDEX t2 INDEX (`PRIMARY`, `inx_c`) IN hot_cache;
-LOAD INDEX INTO CACHE t2 KEY (`PRIMARY`,`inx_c`) IGNORE LEAVES;
-CACHE INDEX t2 INDEX (`inx_b`,`PRIMARY`) IN default;
-LOAD INDEX INTO CACHE t2 KEY (`PRIMARY`,`inx_b`);
-CACHE INDEX t2 IN default;
-LOAD INDEX INTO CACHE t2 IGNORE LEAVES;
-
---error ER_PARTITION_MGMT_ON_NONPARTITIONED
-LOAD INDEX INTO CACHE t2 PARTITION (p1) INDEX (`PRIMARY`);
-LOAD INDEX INTO CACHE t1, t2;
---echo # only one table at a time if specifying partitions
---error ER_PARSE_ERROR
-LOAD INDEX INTO CACHE t1 PARTITION (p0), t2;
-LOAD INDEX INTO CACHE t1 IGNORE LEAVES;
-LOAD INDEX INTO CACHE t1 INDEX (`PRIMARY`);
-LOAD INDEX INTO CACHE t1 INDEX (`PRIMARY`,`inx_b`) IGNORE LEAVES;
-LOAD INDEX INTO CACHE t1 INDEX (`inx_b`) IGNORE LEAVES;
-LOAD INDEX INTO CACHE t1 INDEX (`PRIMARY`) IGNORE LEAVES;
-LOAD INDEX INTO CACHE t1 INDEX (`PRIMARY`,`inx_b`);
-LOAD INDEX INTO CACHE t1 PARTITION (p1) INDEX (`PRIMARY`);
-LOAD INDEX INTO CACHE t1 PARTITION (`p1`,p0) KEY (`PRIMARY`) IGNORE LEAVES;
-LOAD INDEX INTO CACHE t1 PARTITION (ALL);
---error ER_PARSE_ERROR
-LOAD INDEX INTO CACHE t1 PARTITIONS ALL;
-LOAD INDEX INTO CACHE t1 PARTITION (p1,`p0`) IGNORE LEAVES;
-DROP INDEX `inx_b` on t1;
-DROP INDEX `inx_b` on t2;
---error ER_PARTITION_MGMT_ON_NONPARTITIONED
-CACHE INDEX t2 PARTITION (p0) KEY (`inx_b`) IN hot_cache;
-CACHE INDEX t2 INDEX (`inx_b`) IN hot_cache;
-CACHE INDEX t1 PARTITION (p0) KEY (`inx_b`) IN hot_cache;
-CACHE INDEX t1 INDEX (`inx_b`) IN hot_cache;
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug#12361113: crash when load index into cache
---echo #
---echo # Note that this creates an empty disabled key cache!
-SET GLOBAL key_cache_none.key_cache_block_size = 1024;
-CREATE TABLE t1 (a INT, b INTEGER NOT NULL, KEY (b) )
-ENGINE = MYISAM
-PARTITION BY HASH(a) PARTITIONS 2;
-INSERT INTO t1 VALUES (1, 1);
---error ER_UNKNOWN_KEY_CACHE
-CACHE INDEX t1 IN key_cache_none;
---error ER_UNKNOWN_KEY_CACHE
-CACHE INDEX t1 PARTITION (p0) IN key_cache_none;
---error ER_UNKNOWN_KEY_CACHE
-CACHE INDEX t1 PARTITION (p1) IN key_cache_none;
---error ER_UNKNOWN_KEY_CACHE
-CACHE INDEX t1 PARTITION (p0) KEY (`b`) IN key_cache_none;
---error ER_UNKNOWN_KEY_CACHE
-CACHE INDEX t1 PARTITION (p1) KEY (`b`) IN key_cache_none;
---echo # The bug crashed the server at LOAD INDEX below. Now it will succeed
---echo # since the default cache is used due to CACHE INDEX failed for
---echo # key_cache_none.
-LOAD INDEX INTO CACHE t1;
-DROP TABLE t1;
-
-
---echo # Clean up
-SET GLOBAL hot_cache.key_buffer_size = 0;
-SET GLOBAL warm_cache.key_buffer_size = 0;
-SET @@global.cold_cache.key_buffer_size = 0;
-SELECT @@global.default.key_buffer_size a, @@global.default.key_cache_block_size b, @@global.default.key_cache_age_threshold c, @@global.default.key_cache_division_limit d;
-SELECT @@global.hot_cache.key_buffer_size a, @@global.hot_cache.key_cache_block_size b, @@global.hot_cache.key_cache_age_threshold c, @@global.hot_cache.key_cache_division_limit d;
-SELECT @@global.warm_cache.key_buffer_size a, @@global.warm_cache.key_cache_block_size b, @@global.warm_cache.key_cache_age_threshold c, @@global.warm_cache.key_cache_division_limit d;
-SELECT @@global.cold_cache.key_buffer_size a, @@global.cold_cache.key_cache_block_size b, @@global.cold_cache.key_cache_age_threshold c, @@global.cold_cache.key_cache_division_limit d;
---disable_warnings
-SET @@global.default.key_buffer_size = @org_key_cache_buffer_size;
---enable_warnings
diff --git a/mysql-test/t/partition_list.test b/mysql-test/t/partition_list.test
deleted file mode 100644
index e2b6aff300f..00000000000
--- a/mysql-test/t/partition_list.test
+++ /dev/null
@@ -1,211 +0,0 @@
-#--disable_abort_on_error
-#
-# Simple test for the partition storage engine
-# testing list partitioning
-#
--- source include/have_partition.inc
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-#
-# Bug 20733: Zerofill columns gives wrong result with partitioned tables
-#
-create table t1 (a int unsigned)
-partition by list (a)
-(partition p0 values in (0),
- partition p1 values in (1),
- partition pnull values in (null),
- partition p2 values in (2));
-
-insert into t1 values (null),(0),(1),(2);
-select * from t1 where a < 2;
-select * from t1 where a <= 0;
-select * from t1 where a < 1;
-select * from t1 where a > 0;
-select * from t1 where a > 1;
-select * from t1 where a >= 0;
-select * from t1 where a >= 1;
-select * from t1 where a is null;
-select * from t1 where a is not null;
-select * from t1 where a is null or a > 0;
-drop table t1;
-
-create table t1 (a int unsigned, b int)
-partition by list (a)
-subpartition by hash (b)
-subpartitions 2
-(partition p0 values in (0),
- partition p1 values in (1),
- partition pnull values in (null, 2),
- partition p3 values in (3));
-select partition_method, partition_expression, partition_description
- from information_schema.partitions where table_name = "t1";
-insert into t1 values (0,0),(0,1),(1,0),(1,1),(null,0),(null,1);
-insert into t1 values (2,0),(2,1),(3,0),(3,1);
-
-explain partitions select * from t1 where a is null;
-select * from t1 where a is null;
-explain partitions select * from t1 where a = 2;
-select * from t1 where a = 2;
-select * from t1 where a <= 0;
-select * from t1 where a < 3;
-select * from t1 where a >= 1 or a is null;
-drop table t1;
-
-#
-# Test ordinary list partitioning that it works ok
-#
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null)
-partition by list(a)
-partitions 2
-(partition x123 values in (1,5,6),
- partition x234 values in (4,7,8));
-
-INSERT into t1 VALUES (1,1,1);
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-INSERT into t1 VALUES (2,1,1);
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-INSERT into t1 VALUES (3,1,1);
-INSERT into t1 VALUES (4,1,1);
-INSERT into t1 VALUES (5,1,1);
-INSERT into t1 VALUES (6,1,1);
-INSERT into t1 VALUES (7,1,1);
-INSERT into t1 VALUES (8,1,1);
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-INSERT into t1 VALUES (9,1,1);
-INSERT into t1 VALUES (1,2,1);
-INSERT into t1 VALUES (1,3,1);
-INSERT into t1 VALUES (1,4,1);
-INSERT into t1 VALUES (7,2,1);
-INSERT into t1 VALUES (7,3,1);
-INSERT into t1 VALUES (7,4,1);
-
-SELECT * from t1;
-SELECT * from t1 WHERE a=1;
-SELECT * from t1 WHERE a=7;
-SELECT * from t1 WHERE b=2;
-
-UPDATE t1 SET a=8 WHERE a=7 AND b=3;
-SELECT * from t1;
-UPDATE t1 SET a=8 WHERE a=5 AND b=1;
-SELECT * from t1;
-
-DELETE from t1 WHERE a=8;
-SELECT * from t1;
-DELETE from t1 WHERE a=2;
-SELECT * from t1;
-DELETE from t1 WHERE a=5 OR a=6;
-SELECT * from t1;
-
-ALTER TABLE t1
-partition by list(a)
-partitions 2
-(partition x123 values in (1,5,6),
- partition x234 values in (4,7,8));
-SELECT * from t1;
-INSERT into t1 VALUES (6,2,1);
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-INSERT into t1 VALUES (2,2,1);
-
-drop table t1;
-#
-# Subpartition by hash, two partitions and two subpartitions
-# Defined node group
-#
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key (a,b))
-partition by list (a)
-subpartition by hash (a+b)
-( partition x1 values in (1,2,3)
- ( subpartition x11 nodegroup 0,
- subpartition x12 nodegroup 1),
- partition x2 values in (4,5,6)
- ( subpartition x21 nodegroup 0,
- subpartition x22 nodegroup 1)
-);
-
-INSERT into t1 VALUES (1,1,1);
-INSERT into t1 VALUES (4,1,1);
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-INSERT into t1 VALUES (7,1,1);
-UPDATE t1 SET a=5 WHERE a=1;
-SELECT * from t1;
-UPDATE t1 SET a=6 WHERE a=4;
-SELECT * from t1;
-DELETE from t1 WHERE a=6;
-SELECT * from t1;
-
-drop table t1;
-
-#
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by list (a)
-(partition x1 values in (1,2,9,4) tablespace ts1);
-
-drop table t1;
-
-#
-#Bug #17173 Partitions: less-than search fails
-#
-CREATE TABLE t1 (s1 int) PARTITION BY LIST (s1)
-(PARTITION p1 VALUES IN (1),
-PARTITION p2 VALUES IN (2),
-PARTITION p3 VALUES IN (3),
-PARTITION p4 VALUES IN (4),
-PARTITION p5 VALUES IN (5));
-INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
-SELECT COUNT(*) FROM t1 WHERE s1 < 3;
-DROP TABLE t1;
-
-#
-# Bug 19281 Partitions: Auto-increment value lost
-#
-create table t1 (a int auto_increment primary key)
-auto_increment=100
-partition by list (a)
-(partition p0 values in (1, 100));
-create index inx on t1 (a);
-insert into t1 values (null);
-select * from t1;
-drop table t1;
-
---error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
-create table t1 (a char(1))
-partition by list (ascii(ucase(a)))
-(partition p1 values in (2));
-
---echo #
---echo # MDEV-11681: PARTITION BY LIST COLUMNS with default partition:
---echo # Assertion `part_info->num_list_values' failed in
---echo # get_part_iter_for_interval_cols_via_map
---echo #
-CREATE TABLE t1 (f int) PARTITION BY LIST COLUMNS (f) (PARTITION pdef DEFAULT);
-insert into t1 values (1),(2);
-select * from t1 where f = 1;
-
-drop table t1;
-
-CREATE TABLE t1 (f int, d int) PARTITION BY LIST COLUMNS (f,d) (PARTITION pdef DEFAULT);
-insert into t1 values (1,1),(2,2);
-select * from t1 where f = 1 and d = 1 ;
-
-drop table t1;
-CREATE TABLE t1 (f int) PARTITION BY LIST (f) (PARTITION pdef DEFAULT);
-insert into t1 values (1),(2);
-select * from t1 where f = 1;
-
-drop table t1;
-
---echo #end of 10.2 tests
diff --git a/mysql-test/t/partition_mgm.test b/mysql-test/t/partition_mgm.test
deleted file mode 100644
index bf9b5ed174e..00000000000
--- a/mysql-test/t/partition_mgm.test
+++ /dev/null
@@ -1,91 +0,0 @@
--- source include/have_partition.inc
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-#
-# Bug 40389: REORGANIZE PARTITION crashes when only using one partition
-#
-CREATE TABLE t1 (a INT PRIMARY KEY)
-ENGINE MYISAM
-PARTITION BY HASH (a)
-PARTITIONS 1;
-INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
-ALTER TABLE t1 REORGANIZE PARTITION;
-DROP TABLE t1;
-
-#
-# Bug 21143: mysqld hang when error in number of subparts in
-# REORGANIZE command
-#
-create table t1 (a int)
-partition by range (a)
-subpartition by key (a)
-(partition p0 values less than (10) (subpartition sp00, subpartition sp01),
- partition p1 values less than (20) (subpartition sp10, subpartition sp11));
-
--- error ER_PARTITION_WRONG_NO_SUBPART_ERROR
-alter table t1 reorganize partition p0 into
-(partition p0 values less than (10) (subpartition sp00,
-subpartition sp01, subpartition sp02));
-drop table t1;
-
-CREATE TABLE t1 (f_date DATE, f_varchar VARCHAR(30))
-PARTITION BY HASH(YEAR(f_date)) PARTITIONS 2;
-SHOW CREATE TABLE t1;
-let $MYSQLD_DATADIR= `select @@datadir`;
--- file_exists $MYSQLD_DATADIR/test/t1#P#p0.MYD
--- file_exists $MYSQLD_DATADIR/test/t1#P#p0.MYI
--- file_exists $MYSQLD_DATADIR/test/t1#P#p1.MYD
--- file_exists $MYSQLD_DATADIR/test/t1#P#p1.MYI
--- file_exists $MYSQLD_DATADIR/test/t1.frm
--- file_exists $MYSQLD_DATADIR/test/t1.par
-ALTER TABLE t1 COALESCE PARTITION 1;
-SHOW CREATE TABLE t1;
--- file_exists $MYSQLD_DATADIR/test/t1#P#p0.MYD
--- file_exists $MYSQLD_DATADIR/test/t1#P#p0.MYI
--- file_exists $MYSQLD_DATADIR/test/t1.frm
--- file_exists $MYSQLD_DATADIR/test/t1.par
-drop table t1;
-#
-# Bug 20767: REORGANIZE partition crashes
-#
-create table t1 (a int)
-partition by list (a)
-subpartition by hash (a)
-(partition p11 values in (1,2),
- partition p12 values in (3,4));
-
-alter table t1 REORGANIZE partition p11, p12 INTO
-(partition p1 values in (1,2,3,4));
-
-alter table t1 REORGANIZE partition p1 INTO
-(partition p11 values in (1,2),
- partition p12 values in (3,4));
-
-drop table t1;
-#
-# Verification tests for bug#14326
-#
-CREATE TABLE t1 (a INT)
-/*!50100 PARTITION BY HASH (a)
-/* Test
- of multi-line
- comment */
-PARTITIONS 5 */;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-CREATE TABLE t1 (a INT)
-/*!50100 PARTITION BY HASH (a)
--- with a single line comment embedded
-PARTITIONS 5 */;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-CREATE TABLE t1 (a INT)
-/*!50100 PARTITION BY HASH (a)
-PARTITIONS 5 */;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-CREATE TABLE t1 (a INT) /*!50100 PARTITION BY HASH (a) PARTITIONS 5 */;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
diff --git a/mysql-test/t/partition_mgm_err.test b/mysql-test/t/partition_mgm_err.test
deleted file mode 100644
index 0987c427fc7..00000000000
--- a/mysql-test/t/partition_mgm_err.test
+++ /dev/null
@@ -1,225 +0,0 @@
-#
-# Simple test for the erroneos create statements using the
-# partition storage engine
-#
--- source include/have_partition.inc
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-#
-# Try faulty DROP PARTITION and COALESCE PARTITION
-#
-CREATE TABLE t1 (a int, b int)
-PARTITION BY RANGE (a)
-(PARTITION x0 VALUES LESS THAN (2),
- PARTITION x1 VALUES LESS THAN (4),
- PARTITION x2 VALUES LESS THAN (6),
- PARTITION x3 VALUES LESS THAN (8),
- PARTITION x4 VALUES LESS THAN (10),
- PARTITION x5 VALUES LESS THAN (12),
- PARTITION x6 VALUES LESS THAN (14),
- PARTITION x7 VALUES LESS THAN (16),
- PARTITION x8 VALUES LESS THAN (18),
- PARTITION x9 VALUES LESS THAN (20));
-
---error ER_REORG_OUTSIDE_RANGE
-ALTER TABLE t1 REORGANIZE PARTITION x0,x1 INTO
-(PARTITION x01 VALUES LESS THAN (2),
- PARTITION x11 VALUES LESS THAN (5));
-
---error ER_DROP_PARTITION_NON_EXISTENT
-ALTER TABLE t1 DROP PARTITION x0, x1, x2, x3, x3;
-
---error ER_DROP_PARTITION_NON_EXISTENT
-ALTER TABLE t1 DROP PARTITION x0, x1, x2, x10;
-
---error ER_DROP_PARTITION_NON_EXISTENT
-ALTER TABLE t1 DROP PARTITION x10, x1, x2, x1;
-
---error ER_DROP_PARTITION_NON_EXISTENT
-ALTER TABLE t1 DROP PARTITION x10, x1, x2, x3;
-
---error ER_REORG_PARTITION_NOT_EXIST
-ALTER TABLE t1 REORGANIZE PARTITION x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10 INTO
-(PARTITION x11 VALUES LESS THAN (22));
-
---error ER_SAME_NAME_PARTITION
-ALTER TABLE t1 REORGANIZE PARTITION x0,x1,x2 INTO
-(PARTITION x3 VALUES LESS THAN (6));
-
---error ER_CONSECUTIVE_REORG_PARTITIONS
-ALTER TABLE t1 REORGANIZE PARTITION x0, x2 INTO
-(PARTITION x11 VALUES LESS THAN (2));
-
---error ER_DROP_PARTITION_NON_EXISTENT
-ALTER TABLE t1 REORGANIZE PARTITION x0, x1, x1 INTO
-(PARTITION x11 VALUES LESS THAN (4));
-
---error ER_REORG_OUTSIDE_RANGE
-ALTER TABLE t1 REORGANIZE PARTITION x0,x1 INTO
-(PARTITION x01 VALUES LESS THAN (5));
-
---error ER_RANGE_NOT_INCREASING_ERROR
-ALTER TABLE t1 REORGANIZE PARTITION x0,x1 INTO
-(PARTITION x01 VALUES LESS THAN (4),
- PARTITION x11 VALUES LESS THAN (2));
-
---error ER_RANGE_NOT_INCREASING_ERROR
-ALTER TABLE t1 REORGANIZE PARTITION x0,x1 INTO
-(PARTITION x01 VALUES LESS THAN (6),
- PARTITION x11 VALUES LESS THAN (4));
-
-DROP TABLE t1;
-
-CREATE TABLE t1 (a int)
-PARTITION BY KEY (a)
-PARTITIONS 2;
-
---error ER_SAME_NAME_PARTITION
-ALTER TABLE t1 ADD PARTITION (PARTITION p1);
-
-DROP TABLE t1;
-
---error ER_SAME_NAME_PARTITION
-CREATE TABLE t1 (a int)
-PARTITION BY KEY (a)
-(PARTITION x0, PARTITION x1, PARTITION x2, PARTITION x3, PARTITION x3);
-
-CREATE TABLE t1 (a int)
-PARTITION BY RANGE (a)
-SUBPARTITION BY KEY (a)
-SUBPARTITIONS 2
-(PARTITION x0 VALUES LESS THAN (4),
- PARTITION x1 VALUES LESS THAN (8));
-
---error ER_RANGE_NOT_INCREASING_ERROR
-ALTER TABLE t1 ADD PARTITION (PARTITION x2 VALUES LESS THAN (5)
-(SUBPARTITION sp0, SUBPARTITION sp1));
-
---error ER_ADD_PARTITION_SUBPART_ERROR
-ALTER TABLE t1 ADD PARTITION (PARTITION x2 VALUES LESS THAN (12)
-(SUBPARTITION sp0, SUBPARTITION sp1, SUBPARTITION sp2));
-
-DROP TABLE t1;
-
-CREATE TABLE t1 (a int)
-PARTITION BY LIST (a)
-(PARTITION x0 VALUES IN (1,2,3),
- PARTITION x1 VALUES IN (4,5,6));
-
---error ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR
-ALTER TABLE t1 ADD PARTITION (PARTITION x2 VALUES IN (3,4));
-
-DROP TABLE t1;
-
-CREATE TABLE t1 (a int);
-
---error ER_PARTITION_MGMT_ON_NONPARTITIONED
-ALTER TABLE t1 ADD PARTITION PARTITIONS 1;
-
---error ER_PARTITION_MGMT_ON_NONPARTITIONED
-ALTER TABLE t1 DROP PARTITION x1;
-
---error ER_PARTITION_MGMT_ON_NONPARTITIONED
-ALTER TABLE t1 COALESCE PARTITION 1;
-
---error ER_PARTITION_MGMT_ON_NONPARTITIONED
-ALTER TABLE t1 ANALYZE PARTITION p1;
-
---error ER_PARTITION_MGMT_ON_NONPARTITIONED
-ALTER TABLE t1 CHECK PARTITION p1;
-
---error ER_PARTITION_MGMT_ON_NONPARTITIONED
-ALTER TABLE t1 OPTIMIZE PARTITION p1;
-
---error ER_PARTITION_MGMT_ON_NONPARTITIONED
-ALTER TABLE t1 REPAIR PARTITION p1;
-
-DROP TABLE t1;
-
-CREATE TABLE t1 (a int)
-PARTITION BY KEY (a)
-(PARTITION x0, PARTITION x1);
-
---error ER_ADD_PARTITION_NO_NEW_PARTITION
-ALTER TABLE t1 ADD PARTITION PARTITIONS 0;
-
---error ER_TOO_MANY_PARTITIONS_ERROR
-ALTER TABLE t1 ADD PARTITION PARTITIONS 8192;
-
---error ER_ONLY_ON_RANGE_LIST_PARTITION
-ALTER TABLE t1 DROP PARTITION x0;
-
-ALTER TABLE t1 COALESCE PARTITION 1;
-
---error ER_DROP_LAST_PARTITION
-ALTER TABLE t1 COALESCE PARTITION 1;
-
-DROP TABLE t1;
-
-CREATE TABLE t1 (a int)
-PARTITION BY RANGE (a)
-(PARTITION x0 VALUES LESS THAN (4),
- PARTITION x1 VALUES LESS THAN (8));
-
---error ER_PARTITIONS_MUST_BE_DEFINED_ERROR
-ALTER TABLE t1 ADD PARTITION PARTITIONS 1;
-
---error ER_DROP_PARTITION_NON_EXISTENT
-ALTER TABLE t1 DROP PARTITION x2;
-
---error ER_COALESCE_ONLY_ON_HASH_PARTITION
-ALTER TABLE t1 COALESCE PARTITION 1;
-
-ALTER TABLE t1 DROP PARTITION x1;
-
---error ER_DROP_LAST_PARTITION
-ALTER TABLE t1 DROP PARTITION x0;
-
-DROP TABLE t1;
-
-#
-# Bug# 16534 - Trying to add multiple partitions crashes server
-#
-CREATE TABLE t1 ( id INT NOT NULL,
- fname VARCHAR(50) NOT NULL,
- lname VARCHAR(50) NOT NULL,
- hired DATE NOT NULL )
-PARTITION BY RANGE(YEAR(hired)) (
- PARTITION p1 VALUES LESS THAN (1991),
- PARTITION p2 VALUES LESS THAN (1996),
- PARTITION p3 VALUES LESS THAN (2001),
- PARTITION p4 VALUES LESS THAN (2005));
-ALTER TABLE t1 ADD PARTITION (
- PARTITION p5 VALUES LESS THAN (2010),
- PARTITION p6 VALUES LESS THAN MAXVALUE);
-DROP TABLE t1;
-
-#
-#BUG 15523 ALTER TABLE ... PARTITION BY does not work
-#
-CREATE TABLE t1 (a INT);
-SHOW CREATE TABLE t1;
-ALTER TABLE t1 PARTITION BY KEY(a) PARTITIONS 2;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-#
-#BUG 15820 create table with 1 partition, doing ALTER TABLE ADD PARTITION fails
-#
-CREATE TABLE t1 (a INT) PARTITION BY HASH(a);
-ALTER TABLE t1 ADD PARTITION PARTITIONS 4;
-DROP TABLE t1;
-
-#
-#BUG 15408: Partitions: subpartition names are not unique
-#
---error ER_SAME_NAME_PARTITION
-CREATE TABLE t1 (s1 int, s2 int)
-PARTITION BY LIST (s1)
-SUBPARTITION BY KEY (s2) (
-PARTITION p1 VALUES IN (0) (SUBPARTITION p1b),
-PARTITION p2 VALUES IN (2) (SUBPARTITION p1b)
-);
diff --git a/mysql-test/t/partition_mgm_err2.test b/mysql-test/t/partition_mgm_err2.test
deleted file mode 100644
index f683ec6277e..00000000000
--- a/mysql-test/t/partition_mgm_err2.test
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# Test of partitions that require symlinks
-#
---source include/have_partition.inc
---source include/have_symlink.inc
-
-#
-# This test is disabled on windows due to BUG#19107
-#
---source include/not_windows.inc
-#
-# BUG: 14354 Partitions: data directory clause fails
-#
---system rm -rf $MYSQLTEST_VARDIR/tmp/bug14354
---system mkdir $MYSQLTEST_VARDIR/tmp/bug14354
-disable_query_log;
-eval CREATE TABLE t1 (id int) PARTITION BY RANGE(id) (
-PARTITION p1 VALUES LESS THAN (20) ENGINE=myisam
-DATA DIRECTORY="$MYSQLTEST_VARDIR/tmp/bug14354"
-INDEX DIRECTORY="$MYSQLTEST_VARDIR/tmp/bug14354");
-enable_query_log;
-INSERT INTO t1 VALUES (15);
---system test -f $MYSQLTEST_VARDIR/tmp/bug14354/t1#P#p1.MYD
---system test -f $MYSQLTEST_VARDIR/tmp/bug14354/t1#P#p1.MYI
-DROP TABLE t1;
---system rm -rf $MYSQLTEST_VARDIR/tmp/bug14354
diff --git a/mysql-test/t/partition_myisam.test b/mysql-test/t/partition_myisam.test
deleted file mode 100644
index 4d083c37b68..00000000000
--- a/mysql-test/t/partition_myisam.test
+++ /dev/null
@@ -1,255 +0,0 @@
---source include/have_partition.inc
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-# These tests is only useful when running on MyISAM,
-# due to DATA/INDEX directory, non transactional behavior, tests with MyISAM
-# files etc.
-
-let $MYSQLD_DATADIR= `SELECT @@datadir`;
-
---echo #
---echo # BUG#11933226 - 60681: CHECKSUM TABLE RETURNS 0 FOR PARTITIONED TABLE
---echo #
-CREATE TABLE t1 (
- i INT
-)
-ENGINE=MyISAM
-PARTITION BY RANGE (i)
-(PARTITION p3 VALUES LESS THAN (3),
- PARTITION p5 VALUES LESS THAN (5),
- PARTITION pMax VALUES LESS THAN MAXVALUE);
-INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6);
-CHECKSUM TABLE t1;
-ALTER TABLE t1 CHECKSUM = 1;
-CHECKSUM TABLE t1 EXTENDED;
---echo # Before patch this returned 0!
-CHECKSUM TABLE t1;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
---echo # Same test without partitioning
-CREATE TABLE t1 (
- i INT
-) ENGINE=MyISAM;
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6);
-CHECKSUM TABLE t1;
-ALTER TABLE t1 CHECKSUM = 1;
-CHECKSUM TABLE t1 EXTENDED;
-CHECKSUM TABLE t1;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-#
-# Disabled by WL#946: binary format for timestamp column is not compatible.
-# So the trick with replacing FRM file does not work any more.
-#--echo #
-#--echo # Bug#50036: Inconsistent errors when using TIMESTAMP
-#--echo # columns/expressions
-#
-#--echo # Added test with existing TIMESTAMP partitioning (when it was allowed).
-#CREATE TABLE t1 (a TIMESTAMP)
-#ENGINE = MyISAM
-#PARTITION BY HASH (UNIX_TIMESTAMP(a));
-#INSERT INTO t1 VALUES ('2000-01-02 03:04:05');
-#--sorted_result
-#SELECT * FROM t1;
-#FLUSH TABLES;
-#--echo # replacing t1.frm with TO_DAYS(a) which was allowed earlier.
-#--remove_file $MYSQLD_DATADIR/test/t1.frm
-#--copy_file std_data/parts/t1TIMESTAMP.frm $MYSQLD_DATADIR/test/t1.frm
-#--echo # Disable warnings, since the result would differ when running with
-#--echo # --ps-protocol (only for the 'SELECT * FROM t1' statement).
-#--disable_warnings
-#--sorted_result
-#SELECT * FROM t1;
-#--enable_warnings
-#--replace_result MyISAM <curr_engine> InnoDB <curr_engine>
-#SHOW CREATE TABLE t1;
-#INSERT INTO t1 VALUES ('2001-02-03 04:05:06');
-#--sorted_result
-#SELECT * FROM t1;
-#SELECT a, hex(weight_string(a)) FROM t1;
-#ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
-#--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
-#ALTER TABLE t1
-#PARTITION BY RANGE (TO_DAYS(a))
-#(PARTITION p0 VALUES LESS THAN (10000),
-# PARTITION p1 VALUES LESS THAN (MAXVALUE));
-#SHOW CREATE TABLE t1;
-#CREATE TABLE t2 LIKE t1;
-#SHOW CREATE TABLE t2;
-#DROP TABLE t2;
-#CREATE TABLE t2 SELECT * FROM t1;
-#DROP TABLE t2;
-#ALTER TABLE t1 PARTITION BY HASH (UNIX_TIMESTAMP(a));
-#SHOW CREATE TABLE t1;
-#ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
-#SHOW CREATE TABLE t1;
-#--sorted_result
-#SELECT * FROM t1;
-#DROP TABLE t1;
-
---echo #
---echo # Bug#31931: Mix of handlers error message
---echo #
---error ER_MIX_HANDLER_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY HASH (a)
-( PARTITION p0 ENGINE=MyISAM,
- PARTITION p1);
---error ER_MIX_HANDLER_ERROR
-CREATE TABLE t1 (a INT)
-PARTITION BY LIST (a)
-SUBPARTITION BY HASH (a)
-( PARTITION p0 VALUES IN (0)
-( SUBPARTITION s0, SUBPARTITION s1 ENGINE=MyISAM, SUBPARTITION s2),
- PARTITION p1 VALUES IN (1)
-( SUBPARTITION s3 ENGINE=MyISAM, SUBPARTITION s4, SUBPARTITION s5 ENGINE=MyISAM));
-
---echo #
---echo # Bug#49161: Out of memory; restart server and try again (needed 2 bytes)
---echo #
-CREATE TABLE t1 (a INT)
-ENGINE = MyISAM
-PARTITION BY HASH (a);
-FLUSH TABLES;
---remove_file $MYSQLD_DATADIR/test/t1.par
---replace_result $MYSQLD_DATADIR ./
-CHECK TABLE t1;
---error ER_FAILED_READ_FROM_PAR_FILE
-SELECT * FROM t1;
---echo # Note that it is currently impossible to drop a partitioned table
---echo # without the .par file
---replace_result "Not owner" "Operation not permitted"
---error ER_GET_ERRNO
-DROP TABLE t1;
---remove_file $MYSQLD_DATADIR/test/t1.frm
---remove_file $MYSQLD_DATADIR/test/t1#P#p0.MYI
---remove_file $MYSQLD_DATADIR/test/t1#P#p0.MYD
-
---echo #
---echo # Bug#50392: insert_id is not reset for partitioned tables
---echo # auto_increment on duplicate entry
-CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY)
-ENGINE = MyISAM;
-SET INSERT_ID= 13;
-INSERT INTO t1 VALUES (NULL);
-SET INSERT_ID= 12;
---echo # For transactional engines, 12 will not be inserted, since the failing
---echo # statement is rolled back.
---error ER_DUP_ENTRY
-INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (NULL);
---echo # NOTE: 12 exists only in non transactional engines!
-SELECT * FROM t1;
-DROP TABLE t1;
-CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY)
-ENGINE = MyISAM
-PARTITION BY KEY(a);
-SET INSERT_ID= 13;
-INSERT INTO t1 VALUES (NULL);
-SET INSERT_ID= 12;
---error ER_DUP_ENTRY
-INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (NULL);
-SELECT * FROM t1;
-DROP TABLE t1;
-#
-# Bug#30102: rename table does corrupt tables with partition files on failure
-#
---echo # Bug#30102 test
-CREATE TABLE t1 (a INT)
-ENGINE = MyISAM
-PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (6),
- PARTITION `p1....................` VALUES LESS THAN (9),
- PARTITION p2 VALUES LESS THAN MAXVALUE);
-# partition p1 is 't1#P#p1' + @002e * 20 = 107 characters + file ending
-# total path lenght of './test/t1#P#p1@002e@002e<...>@002e.MY[ID]' is 118 chars
---echo # List of files in database `test`, all original t1-files here
---list_files $MYSQLD_DATADIR/test t1*
-INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
---echo # Renaming to a file name where the first partition is 250 chars
---echo # and the second partition is 350 chars
-# 7,7 avoids the error message, which is not deterministic.
---error 7,7
-RENAME TABLE t1 TO `t2_new..............................................end`;
-# 1234567890123456789012345678901234567890123456
---echo # List of files in database `test`, should not be any t2-files here
---list_files $MYSQLD_DATADIR/test t2*
---echo # List of files in database `test`, should be all t1-files here
---list_files $MYSQLD_DATADIR/test t1*
---sorted_result
-SELECT * FROM t1;
---echo # List of files in database `test`, should be all t1-files here
---list_files $MYSQLD_DATADIR/test t1*
---echo # Renaming to a file name where the first partition is 156 chars
---echo # and the second partition is 256 chars
-# 7,7 avoids the error message, which is not deterministic.
---error 7,7
-RENAME TABLE t1 TO `t2_............................_end`;
-# 1234567890123456789012345678
-# 7 + 4 + 5 + 28 * 5 = 16 + 140 = 156
---echo # List of files in database `test`, should not be any t2-files here
---list_files $MYSQLD_DATADIR/test t2*
---echo # List of files in database `test`, should be all t1-files here
---list_files $MYSQLD_DATADIR/test t1*
---sorted_result
-SELECT * FROM t1;
-DROP TABLE t1;
---echo # Should not be any files left here
---list_files $MYSQLD_DATADIR/test t1*
---list_files $MYSQLD_DATADIR/test t2*
---echo # End of bug#30102 test.
-
---echo # Test of post-push fix for bug#11766249/59316
-CREATE TABLE t1 (a INT, b VARCHAR(255), PRIMARY KEY (a))
-ENGINE = MyISAM
-PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (0) MAX_ROWS=100,
- PARTITION p1 VALUES LESS THAN (100) MAX_ROWS=100,
- PARTITION pMax VALUES LESS THAN MAXVALUE);
-INSERT INTO t1 VALUES (1, "Partition p1, first row");
-DROP TABLE t1;
-
---echo #
---echo # MDEV-10418 Assertion `m_extra_cache' failed
---echo # in ha_partition::late_extra_cache(uint)
---echo #
-
-CREATE TABLE t1 (f1 INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE TABLE t2 (f2 INT) ENGINE=MyISAM PARTITION BY RANGE(f2) (PARTITION pmax VALUES LESS THAN MAXVALUE);
-INSERT INTO t2 VALUES (8);
-
-CREATE ALGORITHM = MERGE VIEW v AS SELECT f2 FROM t2, t1;
-
-UPDATE v SET f2 = 1;
-
-SELECT * FROM t2;
-
-DROP VIEW v;
-DROP TABLE t2;
-DROP TABLE t1;
-
---echo #
---echo # bug#11760213-52599: ALTER TABLE REMOVE PARTITIONING ON NON-PARTITIONED
---echo # TABLE CORRUPTS MYISAM
---disable_warnings
-DROP TABLE if exists `t1`;
---enable_warnings
-CREATE TABLE `t1`(`a` INT)ENGINE=myisam;
-ALTER TABLE `t1` ADD COLUMN `b` INT;
-CREATE UNIQUE INDEX `i1` ON `t1`(`b`);
-CREATE UNIQUE INDEX `i2` ON `t1`(`a`);
-ALTER TABLE `t1` ADD PRIMARY KEY (`a`);
---error ER_PARTITION_MGMT_ON_NONPARTITIONED
-ALTER TABLE `t1` REMOVE PARTITIONING;
-CHECK TABLE `t1` EXTENDED;
-DROP TABLE t1;
diff --git a/mysql-test/t/partition_not_blackhole-master.opt b/mysql-test/t/partition_not_blackhole-master.opt
deleted file mode 100644
index 1e47be930bc..00000000000
--- a/mysql-test/t/partition_not_blackhole-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-skip-blackhole
diff --git a/mysql-test/t/partition_not_blackhole.test b/mysql-test/t/partition_not_blackhole.test
deleted file mode 100644
index d9e653b5252..00000000000
--- a/mysql-test/t/partition_not_blackhole.test
+++ /dev/null
@@ -1,29 +0,0 @@
---source include/have_partition.inc
---source include/not_blackhole.inc
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-let $MYSQLD_DATADIR= `SELECT @@datadir`;
-
---echo #
---echo # Bug#46086: crash when dropping a partitioned table and
---echo # the original engine is disabled
---echo # Copy a .frm and .par file which was created with:
---echo # create table `t1` (`id` int primary key) engine=blackhole
---echo # partition by key () partitions 1;
---copy_file std_data/parts/t1_blackhole.frm $MYSQLD_DATADIR/test/t1.frm
---copy_file std_data/parts/t1_blackhole.par $MYSQLD_DATADIR/test/t1.par
-SHOW TABLES;
---replace_result $MYSQLD_DATADIR ./
---error ER_FAILED_READ_FROM_PAR_FILE
-SHOW CREATE TABLE t1;
-
-# The replace is needed for Solaris
---replace_result "Not owner" "Operation not permitted"
---error ER_GET_ERRNO
-DROP TABLE t1;
---list_files $MYSQLD_DATADIR/test t1*
---remove_file $MYSQLD_DATADIR/test/t1.frm
---remove_file $MYSQLD_DATADIR/test/t1.par
diff --git a/mysql-test/t/partition_not_windows-master.opt b/mysql-test/t/partition_not_windows-master.opt
deleted file mode 100644
index b1392bfd485..00000000000
--- a/mysql-test/t/partition_not_windows-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---symbolic-links=1
diff --git a/mysql-test/t/partition_not_windows.test b/mysql-test/t/partition_not_windows.test
deleted file mode 100644
index 429329c79bb..00000000000
--- a/mysql-test/t/partition_not_windows.test
+++ /dev/null
@@ -1,214 +0,0 @@
-# Non-windows specific partition tests.
---source include/not_windows.inc
---source include/have_partition.inc
-# DATA DIRECTORY/INDEX DIRECTORY require symbolic link support
---source include/have_symlink.inc
-
-# The test for Bug 20770 is disabled on Windows due to BUG#19107; it
-# should be moved into partition.test once the bug has been resolved.
-
-#
-# Bug 20770 Partitions: DATA DIRECTORY clause change in reorganize
-# doesn't remove old directory
-
-let $MYSQLD_DATADIR= `select @@datadir`;
-let $data_directory = DATA DIRECTORY = '$MYSQLTEST_VARDIR/tmp';
-let $inx_directory = INDEX DIRECTORY = '$MYSQLTEST_VARDIR/tmp';
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval create table t1 (a int) engine myisam
-partition by range (a)
-subpartition by hash (a)
-(partition p0 VALUES LESS THAN (1) $data_directory $inx_directory
- (SUBPARTITION subpart00, SUBPARTITION subpart01));
-
---echo # Checking if file exists before alter
---file_exists $MYSQLD_DATADIR/test/t1.frm
---file_exists $MYSQLD_DATADIR/test/t1.par
---file_exists $MYSQLD_DATADIR/test/t1#P#p0#SP#subpart00.MYD
---file_exists $MYSQLD_DATADIR/test/t1#P#p0#SP#subpart00.MYI
---file_exists $MYSQLD_DATADIR/test/t1#P#p0#SP#subpart01.MYD
---file_exists $MYSQLD_DATADIR/test/t1#P#p0#SP#subpart01.MYI
---file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p0#SP#subpart00.MYD
---file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p0#SP#subpart01.MYD
---file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p0#SP#subpart00.MYI
---file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p0#SP#subpart01.MYI
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
-(partition p1 VALUES LESS THAN (1) $data_directory $inx_directory
- (SUBPARTITION subpart10, SUBPARTITION subpart11),
- partition p2 VALUES LESS THAN (2) $data_directory $inx_directory
- (SUBPARTITION subpart20, SUBPARTITION subpart21));
-
---echo # Checking if file exists after alter
---file_exists $MYSQLD_DATADIR/test/t1.frm
---file_exists $MYSQLD_DATADIR/test/t1.par
---file_exists $MYSQLD_DATADIR/test/t1#P#p1#SP#subpart10.MYD
---file_exists $MYSQLD_DATADIR/test/t1#P#p1#SP#subpart10.MYI
---file_exists $MYSQLD_DATADIR/test/t1#P#p1#SP#subpart11.MYD
---file_exists $MYSQLD_DATADIR/test/t1#P#p1#SP#subpart11.MYI
---file_exists $MYSQLD_DATADIR/test/t1#P#p2#SP#subpart20.MYD
---file_exists $MYSQLD_DATADIR/test/t1#P#p2#SP#subpart20.MYI
---file_exists $MYSQLD_DATADIR/test/t1#P#p2#SP#subpart21.MYD
---file_exists $MYSQLD_DATADIR/test/t1#P#p2#SP#subpart21.MYI
---file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p1#SP#subpart10.MYD
---file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p1#SP#subpart11.MYD
---file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p2#SP#subpart20.MYD
---file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p2#SP#subpart21.MYD
---file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p1#SP#subpart10.MYI
---file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p1#SP#subpart11.MYI
---file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p2#SP#subpart20.MYI
---file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p2#SP#subpart21.MYI
-
-drop table t1;
-
-#
-# Bug #24633 SQL MODE "NO_DIR_IN_CREATE" does not work with partitioned tables
-#
-disable_query_log;
-eval create table t2 (i int )
-partition by range (i)
-(
- partition p01 values less than (1000)
- data directory="$MYSQLTEST_VARDIR/tmp/"
- index directory="$MYSQLTEST_VARDIR/tmp/"
-);
-enable_query_log;
-
-set @org_mode=@@sql_mode;
-set @@sql_mode='NO_DIR_IN_CREATE';
-select @@sql_mode;
-create table t1 (i int )
-partition by range (i)
-(
- partition p01 values less than (1000)
- data directory='/not/existing'
- index directory='/not/existing'
-);
-show create table t2;
-DROP TABLE t1, t2;
-set @@sql_mode=@org_mode;
-
-#
-# Bug#32167: another privilege bypass with DATA/INDEX DIRECTORY
-#
-
-let $MYSQLD_DATADIR= `select @@datadir`;
-
---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
---error ER_WRONG_ARGUMENTS
-eval CREATE TABLE t1(a INT)
-PARTITION BY KEY (a)
-(PARTITION p0 DATA DIRECTORY '$MYSQLD_DATADIR/test');
-
---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
---error ER_WRONG_ARGUMENTS
-eval CREATE TABLE t1(a INT)
-PARTITION BY KEY (a)
-(PARTITION p0 INDEX DIRECTORY '$MYSQLD_DATADIR/test');
-
---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
---error ER_WRONG_ARGUMENTS
-eval CREATE TABLE ts (id INT, purchased DATE)
-PARTITION BY RANGE(YEAR(purchased))
-SUBPARTITION BY HASH(TO_DAYS(purchased)) (
-PARTITION p0 VALUES LESS THAN (1990) (
-SUBPARTITION s0a
- DATA DIRECTORY = '$MYSQLD_DATADIR/test',
-SUBPARTITION s0b
- DATA DIRECTORY = '$MYSQLD_DATADIR/test'
-));
-
---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
---error ER_WRONG_ARGUMENTS
-eval CREATE TABLE ts (id INT, purchased DATE)
-PARTITION BY RANGE(YEAR(purchased))
-SUBPARTITION BY HASH(TO_DAYS(purchased)) (
-PARTITION p0 VALUES LESS THAN (1990) (
-SUBPARTITION s0a
- INDEX DIRECTORY = '$MYSQLD_DATADIR/test',
-SUBPARTITION s0b
- INDEX DIRECTORY = '$MYSQLD_DATADIR/test'
-));
-
-# End Windows specific test failures.
-
-# These tests contain non-Windows specific directory/file format.
-
-#
-# Bug 25141: Crash Server on Partitioning command
-#
-
---disable_warnings
-DROP TABLE IF EXISTS `example`;
---enable_warnings
-
---mkdir $MYSQLTEST_VARDIR/p0Data
---mkdir $MYSQLTEST_VARDIR/p1Data
---mkdir $MYSQLTEST_VARDIR/p2Data
---mkdir $MYSQLTEST_VARDIR/p3Data
---mkdir $MYSQLTEST_VARDIR/p0Index
---mkdir $MYSQLTEST_VARDIR/p1Index
---mkdir $MYSQLTEST_VARDIR/p2Index
---mkdir $MYSQLTEST_VARDIR/p3Index
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval CREATE TABLE `example` (
- `ID_EXAMPLE` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `DESCRIPTION` varchar(30) NOT NULL,
- `LEVEL` smallint(5) unsigned DEFAULT NULL,
- PRIMARY KEY (`ID_EXAMPLE`)
-) ENGINE = MYISAM
-PARTITION BY HASH(ID_EXAMPLE)(
-PARTITION p0 DATA DIRECTORY = '$MYSQLTEST_VARDIR/p0Data'
-INDEX DIRECTORY = '$MYSQLTEST_VARDIR/p0Index',
-PARTITION p1 DATA DIRECTORY = '$MYSQLTEST_VARDIR/p1Data'
-INDEX DIRECTORY = '$MYSQLTEST_VARDIR/p1Index',
-PARTITION p2 DATA DIRECTORY = '$MYSQLTEST_VARDIR/p2Data'
-INDEX DIRECTORY = '$MYSQLTEST_VARDIR/p2Index',
-PARTITION p3 DATA DIRECTORY = '$MYSQLTEST_VARDIR/p3Data'
-INDEX DIRECTORY = '$MYSQLTEST_VARDIR/p3Index'
-);
-
-let $MYSQLD_DATADIR= `select @@datadir`;
-
---echo # Checking that MyISAM .MYD and .MYI are in test db and data/idx dir
---file_exists $MYSQLD_DATADIR/test/example#P#p0.MYI
---file_exists $MYSQLD_DATADIR/test/example#P#p0.MYD
---file_exists $MYSQLTEST_VARDIR/p0Data/example#P#p0.MYD
---file_exists $MYSQLTEST_VARDIR/p0Index/example#P#p0.MYI
---file_exists $MYSQLD_DATADIR/test/example#P#p1.MYI
---file_exists $MYSQLD_DATADIR/test/example#P#p1.MYD
---file_exists $MYSQLTEST_VARDIR/p1Data/example#P#p1.MYD
---file_exists $MYSQLTEST_VARDIR/p1Index/example#P#p1.MYI
---file_exists $MYSQLD_DATADIR/test/example#P#p2.MYI
---file_exists $MYSQLD_DATADIR/test/example#P#p2.MYD
---file_exists $MYSQLTEST_VARDIR/p2Data/example#P#p2.MYD
---file_exists $MYSQLTEST_VARDIR/p2Index/example#P#p2.MYI
---file_exists $MYSQLD_DATADIR/test/example#P#p3.MYI
---file_exists $MYSQLD_DATADIR/test/example#P#p3.MYD
---file_exists $MYSQLTEST_VARDIR/p3Data/example#P#p3.MYD
---file_exists $MYSQLTEST_VARDIR/p3Index/example#P#p3.MYI
-DROP TABLE example;
---rmdir $MYSQLTEST_VARDIR/p0Data
---rmdir $MYSQLTEST_VARDIR/p1Data
---rmdir $MYSQLTEST_VARDIR/p2Data
---rmdir $MYSQLTEST_VARDIR/p3Data
---rmdir $MYSQLTEST_VARDIR/p0Index
---rmdir $MYSQLTEST_VARDIR/p1Index
---rmdir $MYSQLTEST_VARDIR/p2Index
---rmdir $MYSQLTEST_VARDIR/p3Index
-
---error 1
-CREATE TABLE `example` (
- `ID_EXAMPLE` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `DESCRIPTION` varchar(30) NOT NULL,
- `LEVEL` smallint(5) unsigned DEFAULT NULL,
- PRIMARY KEY (`ID_EXAMPLE`)
-) ENGINE = MYISAM
-PARTITION BY HASH(ID_EXAMPLE)(
-PARTITION p0 DATA DIRECTORY = '/not/existent/p0Data',
-PARTITION p1 DATA DIRECTORY = '/not/existent/p1Data',
-PARTITION p2 DATA DIRECTORY = '/not/existent/p2Data',
-PARTITION p3 DATA DIRECTORY = '/not/existent/p3Data'
-);
diff --git a/mysql-test/t/partition_open_files_limit-master.opt b/mysql-test/t/partition_open_files_limit-master.opt
deleted file mode 100644
index 4c1ed0c3da3..00000000000
--- a/mysql-test/t/partition_open_files_limit-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---open-files-limit=5 --max_connections=2 --table_open_cache=1
diff --git a/mysql-test/t/partition_open_files_limit.test b/mysql-test/t/partition_open_files_limit.test
deleted file mode 100644
index e62ebd0ade7..00000000000
--- a/mysql-test/t/partition_open_files_limit.test
+++ /dev/null
@@ -1,26 +0,0 @@
---source include/have_partition.inc
-
---disable_warnings
-DROP TABLE IF EXISTS `t1`;
---enable_warnings
-
-# On some platforms the lowest possible open_files_limit is too high...
-let $max_open_files_limit= `SELECT @@open_files_limit > 511`;
-if ($max_open_files_limit)
-{
- skip Need open_files_limit to be lower than 512;
-}
-
-#
---echo # Bug#46922: crash when adding partitions and open_files_limit is reached
-#
-CREATE TABLE t1 (a INT PRIMARY KEY)
-ENGINE=MyISAM PARTITION BY KEY () PARTITIONS 1;
-INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11);
---echo # if the bug exists, then crash will happen here
---replace_regex /file '.*'/file '<partition file>'/
---error 23
-ALTER TABLE t1 ADD PARTITION PARTITIONS 511;
---sorted_result
-SELECT * FROM t1;
-DROP TABLE t1;
diff --git a/mysql-test/t/partition_order.test b/mysql-test/t/partition_order.test
deleted file mode 100644
index ad956361d00..00000000000
--- a/mysql-test/t/partition_order.test
+++ /dev/null
@@ -1,844 +0,0 @@
-#--disable_abort_on_error
-#
-# Simple test for the partition storage engine
-# Focuses on tests of ordered index read
-#
--- source include/have_partition.inc
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-#
-# Ordered index read, int type
-#
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, 1);
-INSERT into t1 values (2, 5);
-INSERT into t1 values (30, 4);
-INSERT into t1 values (35, 2);
-
-select * from t1 order by b;
-
-select * from t1 force index (b) where b > 0 order by b;
-
-drop table t1;
-
-#
-# Ordered index read, unsigned int type
-#
-CREATE TABLE t1 (
-a int not null,
-b int unsigned not null,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, 1);
-INSERT into t1 values (2, 5);
-INSERT into t1 values (30, 4);
-INSERT into t1 values (35, 2);
-
-select * from t1 force index (b) where b > 0 order by b;
-
-drop table t1;
-
-#
-# Ordered index read, tiny int type
-#
-CREATE TABLE t1 (
-a int not null,
-b tinyint not null,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, 1);
-INSERT into t1 values (2, 5);
-INSERT into t1 values (30, 4);
-INSERT into t1 values (35, 2);
-
-select * from t1 force index (b) where b > 0 order by b;
-
-drop table t1;
-
-#
-# Ordered index read, unsigned tinyint type
-#
-CREATE TABLE t1 (
-a int not null,
-b tinyint unsigned not null,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, 1);
-INSERT into t1 values (2, 5);
-INSERT into t1 values (30, 4);
-INSERT into t1 values (35, 2);
-
-select * from t1 force index (b) where b > 0 order by b;
-
-drop table t1;
-
-#
-# Ordered index read, smallint type
-#
-CREATE TABLE t1 (
-a int not null,
-b smallint not null,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, 1);
-INSERT into t1 values (2, 5);
-INSERT into t1 values (30, 4);
-INSERT into t1 values (35, 2);
-
-select * from t1 force index (b) where b > 0 order by b;
-
-drop table t1;
-
-#
-# Ordered index read, unsigned smallint type
-#
-CREATE TABLE t1 (
-a int not null,
-b smallint unsigned not null,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, 1);
-INSERT into t1 values (2, 5);
-INSERT into t1 values (30, 4);
-INSERT into t1 values (35, 2);
-
-select * from t1 force index (b) where b > 0 order by b;
-
-drop table t1;
-#
-# Ordered index read, mediumint type
-#
-CREATE TABLE t1 (
-a int not null,
-b mediumint not null,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, 1);
-INSERT into t1 values (2, 5);
-INSERT into t1 values (30, 4);
-INSERT into t1 values (35, 2);
-
-select * from t1 force index (b) where b > 0 order by b;
-
-drop table t1;
-
-#
-# Ordered index read, unsigned int type
-#
-CREATE TABLE t1 (
-a int not null,
-b mediumint unsigned not null,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, 1);
-INSERT into t1 values (2, 5);
-INSERT into t1 values (30, 4);
-INSERT into t1 values (35, 2);
-
-select * from t1 force index (b) where b > 0 order by b;
-
-drop table t1;
-
-#
-# Ordered index read, unsigned bigint type
-#
-CREATE TABLE t1 (
-a int not null,
-b bigint unsigned not null,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, 1);
-INSERT into t1 values (2, 5);
-INSERT into t1 values (30, 4);
-INSERT into t1 values (35, 2);
-
-select * from t1 force index (b) where b > 0 order by b;
-
-drop table t1;
-
-#
-# Ordered index read, bigint type
-#
-CREATE TABLE t1 (
-a int not null,
-b bigint not null,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, 1);
-INSERT into t1 values (2, 5);
-INSERT into t1 values (30, 4);
-INSERT into t1 values (35, 2);
-
-select * from t1 force index (b) where b > 0 order by b;
-
-drop table t1;
-#
-# Ordered index read, bigint type
-#
-CREATE TABLE t1 (
-a int not null,
-b bigint not null,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, 1);
-INSERT into t1 values (2, 5);
-INSERT into t1 values (30, 4);
-INSERT into t1 values (35, 2);
-
-select * from t1 force index (b) where b > 0 order by b;
-
-drop table t1;
-
-#
-# Ordered index read, float type
-#
-CREATE TABLE t1 (
-a int not null,
-b float not null,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, 1);
-INSERT into t1 values (2, 5);
-INSERT into t1 values (30, 4);
-INSERT into t1 values (35, 2);
-
-select * from t1 force index (b) where b > 0 order by b;
-
-drop table t1;
-
-#
-# Ordered index read, double type
-#
-CREATE TABLE t1 (
-a int not null,
-b double not null,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, 1);
-INSERT into t1 values (2, 5);
-INSERT into t1 values (30, 4);
-INSERT into t1 values (35, 2);
-
-select * from t1 force index (b) where b > 0 order by b;
-
-drop table t1;
-
-#
-# Ordered index read, unsigned double type
-#
-CREATE TABLE t1 (
-a int not null,
-b double unsigned not null,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, 1);
-INSERT into t1 values (2, 5);
-INSERT into t1 values (30, 4);
-INSERT into t1 values (35, 2);
-
-select * from t1 force index (b) where b > 0 order by b;
-
-drop table t1;
-
-#
-# Ordered index read, unsigned float type
-#
-CREATE TABLE t1 (
-a int not null,
-b float unsigned not null,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, 1);
-INSERT into t1 values (2, 5);
-INSERT into t1 values (30, 4);
-INSERT into t1 values (35, 2);
-
-select * from t1 force index (b) where b > 0 order by b;
-
-drop table t1;
-
-#
-# Ordered index read, double precision type
-#
-CREATE TABLE t1 (
-a int not null,
-b double precision not null,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, 1);
-INSERT into t1 values (2, 5);
-INSERT into t1 values (30, 4);
-INSERT into t1 values (35, 2);
-
-select * from t1 force index (b) where b > 0 order by b;
-
-drop table t1;
-#
-# Ordered index read, unsigned double precision type
-#
-CREATE TABLE t1 (
-a int not null,
-b double precision unsigned not null,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, 1);
-INSERT into t1 values (2, 5);
-INSERT into t1 values (30, 4);
-INSERT into t1 values (35, 2);
-
-select * from t1 force index (b) where b > 0 order by b;
-
-drop table t1;
-
-#
-# Ordered index read, decimal type
-#
-CREATE TABLE t1 (
-a int not null,
-b decimal not null,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, 1);
-INSERT into t1 values (2, 5);
-INSERT into t1 values (30, 4);
-INSERT into t1 values (35, 2);
-
-select * from t1 force index (b) where b > 0 order by b;
-
-drop table t1;
-#
-# Ordered index read, char type
-#
-CREATE TABLE t1 (
-a int not null,
-b char(10) not null,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, '1');
-INSERT into t1 values (2, '5');
-INSERT into t1 values (30, '4');
-INSERT into t1 values (35, '2');
-
-select * from t1 force index (b) where b > 0 order by b;
-
-drop table t1;
-
-#
-# Ordered index read, varchar type
-#
-CREATE TABLE t1 (
-a int not null,
-b varchar(10) not null,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, '1');
-INSERT into t1 values (2, '5');
-INSERT into t1 values (30, '4');
-INSERT into t1 values (35, '2');
-
-select * from t1 force index (b) where b > '0' order by b;
-
-drop table t1;
-#
-# Ordered index read, varchar type limited index size
-#
-CREATE TABLE t1 (
-a int not null,
-b varchar(10) not null,
-primary key(a),
-index (b(5)))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, '1');
-INSERT into t1 values (2, '5');
-INSERT into t1 values (30, '4');
-INSERT into t1 values (35, '2');
-
-select * from t1 force index (b) where b > '0' order by b;
-
-drop table t1;
-
-#
-# Ordered index read, varchar binary type
-#
-CREATE TABLE t1 (
-a int not null,
-b varchar(10) binary not null,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, '1');
-INSERT into t1 values (2, '5');
-INSERT into t1 values (30, '4');
-INSERT into t1 values (35, '2');
-
-select * from t1 force index (b) where b > '0' order by b;
-
-drop table t1;
-
-#
-# Ordered index read, tinytext type
-#
-CREATE TABLE t1 (
-a int not null,
-b tinytext not null,
-primary key(a),
-index (b(10)))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, '1');
-INSERT into t1 values (2, '5');
-INSERT into t1 values (30, '4');
-INSERT into t1 values (35, '2');
-
-select * from t1 force index (b) where b > '0' order by b;
-
-drop table t1;
-#
-# Ordered index read, text type
-#
-CREATE TABLE t1 (
-a int not null,
-b text not null,
-primary key(a),
-index (b(10)))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, '1');
-INSERT into t1 values (2, '5');
-INSERT into t1 values (30, '4');
-INSERT into t1 values (35, '2');
-
-select * from t1 force index (b) where b > '0' order by b;
-
-drop table t1;
-
-#
-# Ordered index read, mediumtext type
-#
-CREATE TABLE t1 (
-a int not null,
-b mediumtext not null,
-primary key(a),
-index (b(10)))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, '1');
-INSERT into t1 values (2, '5');
-INSERT into t1 values (30, '4');
-INSERT into t1 values (35, '2');
-
-select * from t1 force index (b) where b > '0' order by b;
-
-drop table t1;
-#
-# Ordered index read, longtext type
-#
-CREATE TABLE t1 (
-a int not null,
-b longtext not null,
-primary key(a),
-index (b(10)))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, '1');
-INSERT into t1 values (2, '5');
-INSERT into t1 values (30, '4');
-INSERT into t1 values (35, '2');
-
-select * from t1 force index (b) where b > '0' order by b;
-
-drop table t1;
-#
-# Ordered index read, enum type
-#
-CREATE TABLE t1 (
-a int not null,
-b enum('1','2', '4', '5') not null,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, '1');
-INSERT into t1 values (2, '5');
-INSERT into t1 values (30, '4');
-INSERT into t1 values (35, '2');
-
-select * from t1 force index (b) where b >= '1' order by b;
-
-drop table t1;
-#
-# Ordered index read, set type
-#
-CREATE TABLE t1 (
-a int not null,
-b set('1','2', '4', '5') not null,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, '1');
-INSERT into t1 values (2, '5');
-INSERT into t1 values (30, '4');
-INSERT into t1 values (35, '2');
-
-select * from t1 force index (b) where b >= '1' order by b;
-
-drop table t1;
-#
-# Ordered index read, date type
-#
-CREATE TABLE t1 (
-a int not null,
-b date not null,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, '2001-01-01');
-INSERT into t1 values (2, '2005-01-01');
-INSERT into t1 values (30, '2004-01-01');
-INSERT into t1 values (35, '2002-01-01');
-
-select * from t1 force index (b) where b > '2000-01-01' order by b;
-
-drop table t1;
-#
-# Ordered index read, datetime type
-#
-CREATE TABLE t1 (
-a int not null,
-b datetime not null,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, '2001-01-01 00:00:00');
-INSERT into t1 values (2, '2005-01-01 00:00:00');
-INSERT into t1 values (30, '2004-01-01 00:00:00');
-INSERT into t1 values (35, '2002-01-01 00:00:00');
-
-select * from t1 force index (b) where b > '2000-01-01 00:00:00' order by b;
-
-drop table t1;
-#
-# Ordered index read, timestamp type
-#
-CREATE TABLE t1 (
-a int not null,
-b timestamp not null,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, '2001-01-01 00:00:00');
-INSERT into t1 values (2, '2005-01-01 00:00:00');
-INSERT into t1 values (30, '2004-01-01 00:00:00');
-INSERT into t1 values (35, '2002-01-01 00:00:00');
-
-select * from t1 force index (b) where b > '2000-01-01 00:00:00' order by b;
-
-drop table t1;
-#
-# Ordered index read, time type
-#
-CREATE TABLE t1 (
-a int not null,
-b time not null,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, '01:00:00');
-INSERT into t1 values (2, '05:00:00');
-INSERT into t1 values (30, '04:00:00');
-INSERT into t1 values (35, '02:00:00');
-
-select * from t1 force index (b) where b > '00:00:00' order by b;
-
-drop table t1;
-#
-# Ordered index read, year type
-#
-CREATE TABLE t1 (
-a int not null,
-b year not null,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, 2001);
-INSERT into t1 values (2, 2005);
-INSERT into t1 values (30, 2004);
-INSERT into t1 values (35, 2002);
-
-select * from t1 force index (b) where b > 2000 order by b;
-
-drop table t1;
-#
-# Ordered index read, bit(5) type
-#
-CREATE TABLE t1 (
-a int not null,
-b bit(5) not null,
-c int,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, b'00001', NULL);
-INSERT into t1 values (2, b'00101', 2);
-INSERT into t1 values (30, b'00100', 2);
-INSERT into t1 values (35, b'00010', NULL);
-
-select a from t1 force index (b) where b > b'00000' order by b;
-
-drop table t1;
-#
-# Ordered index read, bit(15) type
-#
-CREATE TABLE t1 (
-a int not null,
-b bit(15) not null,
-c int,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, b'000000000000001', NULL);
-INSERT into t1 values (2, b'001010000000101', 2);
-INSERT into t1 values (30, b'001000000000100', 2);
-INSERT into t1 values (35, b'000100000000010', NULL);
-
-select a from t1 force index (b) where b > b'000000000000000' order by b;
-
-drop table t1;
-
-#
-# Ordered index read, NULL values
-#
-CREATE TABLE t1 (
-a int not null,
-b int,
-primary key(a),
-index (b))
-partition by range (a)
-partitions 2
-(partition x1 values less than (25),
- partition x2 values less than (100));
-
-# Insert a couple of tuples
-INSERT into t1 values (1, 1);
-INSERT into t1 values (5, NULL);
-INSERT into t1 values (2, 4);
-INSERT into t1 values (3, 3);
-INSERT into t1 values (4, 5);
-INSERT into t1 values (7, 1);
-INSERT into t1 values (6, 6);
-INSERT into t1 values (30, 4);
-INSERT into t1 values (35, 2);
-INSERT into t1 values (40, NULL);
-
-select * from t1 force index (b) where b < 10 OR b IS NULL order by b;
-select * from t1 force index (b) where b < 10 ORDER BY b;
-select * from t1 force index (b) where b < 10 ORDER BY b DESC;
-drop table t1;
-
-create table t1 (a int not null, b int, c varchar(20), key (a,b,c))
-partition by range (b)
-(partition p0 values less than (5),
- partition p1 values less than (10));
-INSERT into t1 values (1,1,'1'),(2,2,'2'),(1,3,'3'),(2,4,'4'),(1,5,'5');
-INSERT into t1 values (2,6,'6'),(1,7,'7'),(2,8,'8'),(1,9,'9');
-INSERT into t1 values (1, NULL, NULL), (2, NULL, '10');
-select * from t1 where a = 1 order by a desc, b desc;
-select * from t1 where a = 1 order by b desc;
-drop table t1;
diff --git a/mysql-test/t/partition_pruning.test b/mysql-test/t/partition_pruning.test
deleted file mode 100644
index 9d72e9c0d01..00000000000
--- a/mysql-test/t/partition_pruning.test
+++ /dev/null
@@ -1,1538 +0,0 @@
-#
-# Partition pruning tests. Currently we only detect which partitions to
-# prune, so the test is EXPLAINs.
-#
--- source include/have_partition.inc
-
---disable_warnings
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
---enable_warnings
-
---echo #
---echo # Bug#53806: Wrong estimates for range query in partitioned MyISAM table
---echo # Bug#46754: 'rows' field doesn't reflect partition pruning
---echo #
-CREATE TABLE t1 (a INT PRIMARY KEY)
-PARTITION BY RANGE (a) (
-PARTITION p0 VALUES LESS THAN (1),
-PARTITION p1 VALUES LESS THAN (2),
-PARTITION p2 VALUES LESS THAN (3),
-PARTITION p3 VALUES LESS THAN (4),
-PARTITION p4 VALUES LESS THAN (5),
-PARTITION p5 VALUES LESS THAN (6),
-PARTITION max VALUES LESS THAN MAXVALUE);
-
-INSERT INTO t1 VALUES (-1),(0),(1),(2),(3),(4),(5),(6),(7),(8);
-
---replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 11 #
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 1;
---replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 11 #
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 7;
---replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 11 #
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#49742: Partition Pruning not working correctly for RANGE
---echo #
-CREATE TABLE t1 (a INT PRIMARY KEY)
-PARTITION BY RANGE (a) (
-PARTITION p0 VALUES LESS THAN (1),
-PARTITION p1 VALUES LESS THAN (2),
-PARTITION p2 VALUES LESS THAN (3),
-PARTITION p3 VALUES LESS THAN (4),
-PARTITION p4 VALUES LESS THAN (5),
-PARTITION p5 VALUES LESS THAN (6),
-PARTITION max VALUES LESS THAN MAXVALUE);
-
-INSERT INTO t1 VALUES (-1),(0),(1),(2),(3),(4),(5),(6),(7),(8);
-
-SELECT * FROM t1 WHERE a < 1;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 1;
-SELECT * FROM t1 WHERE a < 2;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 2;
-SELECT * FROM t1 WHERE a < 3;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 3;
-SELECT * FROM t1 WHERE a < 4;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 4;
-SELECT * FROM t1 WHERE a < 5;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 5;
-SELECT * FROM t1 WHERE a < 6;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 6;
-SELECT * FROM t1 WHERE a < 7;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 7;
-SELECT * FROM t1 WHERE a <= 1;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 1;
-SELECT * FROM t1 WHERE a <= 2;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 2;
-SELECT * FROM t1 WHERE a <= 3;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 3;
-SELECT * FROM t1 WHERE a <= 4;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 4;
-SELECT * FROM t1 WHERE a <= 5;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 5;
-SELECT * FROM t1 WHERE a <= 6;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 6;
-SELECT * FROM t1 WHERE a <= 7;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 7;
-SELECT * FROM t1 WHERE a = 1;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 1;
-SELECT * FROM t1 WHERE a = 2;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 2;
-SELECT * FROM t1 WHERE a = 3;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 3;
-SELECT * FROM t1 WHERE a = 4;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 4;
-SELECT * FROM t1 WHERE a = 5;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 5;
-SELECT * FROM t1 WHERE a = 6;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 6;
-SELECT * FROM t1 WHERE a = 7;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 7;
-SELECT * FROM t1 WHERE a >= 1;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 1;
-SELECT * FROM t1 WHERE a >= 2;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 2;
-SELECT * FROM t1 WHERE a >= 3;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 3;
-SELECT * FROM t1 WHERE a >= 4;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 4;
-SELECT * FROM t1 WHERE a >= 5;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 5;
-SELECT * FROM t1 WHERE a >= 6;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 6;
-SELECT * FROM t1 WHERE a >= 7;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 7;
-SELECT * FROM t1 WHERE a > 1;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 1;
-SELECT * FROM t1 WHERE a > 2;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 2;
-SELECT * FROM t1 WHERE a > 3;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 3;
-SELECT * FROM t1 WHERE a > 4;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 4;
-SELECT * FROM t1 WHERE a > 5;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 5;
-SELECT * FROM t1 WHERE a > 6;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 6;
-SELECT * FROM t1 WHERE a > 7;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 7;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT PRIMARY KEY)
-PARTITION BY RANGE (a) (
-PARTITION p0 VALUES LESS THAN (1),
-PARTITION p1 VALUES LESS THAN (2),
-PARTITION p2 VALUES LESS THAN (3),
-PARTITION p3 VALUES LESS THAN (4),
-PARTITION p4 VALUES LESS THAN (5),
-PARTITION max VALUES LESS THAN MAXVALUE);
-
-INSERT INTO t1 VALUES (-1),(0),(1),(2),(3),(4),(5),(6),(7);
-
-SELECT * FROM t1 WHERE a < 1;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 1;
-SELECT * FROM t1 WHERE a < 2;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 2;
-SELECT * FROM t1 WHERE a < 3;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 3;
-SELECT * FROM t1 WHERE a < 4;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 4;
-SELECT * FROM t1 WHERE a < 5;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 5;
-SELECT * FROM t1 WHERE a < 6;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 6;
-SELECT * FROM t1 WHERE a <= 1;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 1;
-SELECT * FROM t1 WHERE a <= 2;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 2;
-SELECT * FROM t1 WHERE a <= 3;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 3;
-SELECT * FROM t1 WHERE a <= 4;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 4;
-SELECT * FROM t1 WHERE a <= 5;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 5;
-SELECT * FROM t1 WHERE a <= 6;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 6;
-SELECT * FROM t1 WHERE a = 1;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 1;
-SELECT * FROM t1 WHERE a = 2;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 2;
-SELECT * FROM t1 WHERE a = 3;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 3;
-SELECT * FROM t1 WHERE a = 4;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 4;
-SELECT * FROM t1 WHERE a = 5;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 5;
-SELECT * FROM t1 WHERE a = 6;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 6;
-SELECT * FROM t1 WHERE a >= 1;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 1;
-SELECT * FROM t1 WHERE a >= 2;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 2;
-SELECT * FROM t1 WHERE a >= 3;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 3;
-SELECT * FROM t1 WHERE a >= 4;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 4;
-SELECT * FROM t1 WHERE a >= 5;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 5;
-SELECT * FROM t1 WHERE a >= 6;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 6;
-SELECT * FROM t1 WHERE a > 1;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 1;
-SELECT * FROM t1 WHERE a > 2;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 2;
-SELECT * FROM t1 WHERE a > 3;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 3;
-SELECT * FROM t1 WHERE a > 4;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 4;
-SELECT * FROM t1 WHERE a > 5;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 5;
-SELECT * FROM t1 WHERE a > 6;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 6;
-DROP TABLE t1;
-
-#
-# Bug#20577: Partitions: use of to_days() function leads to selection failures
-#
---let $explain_partitions= 1;
---let $verify_without_partitions= 0;
---echo # test of RANGE and index
-CREATE TABLE t1 (a DATE, KEY(a))
-PARTITION BY RANGE (TO_DAYS(a))
-(PARTITION `pNULL` VALUES LESS THAN (0),
- PARTITION `p0001-01-01` VALUES LESS THAN (366 + 1),
- PARTITION `p1001-01-01` VALUES LESS THAN (TO_DAYS('1001-01-01') + 1),
- PARTITION `p2001-01-01` VALUES LESS THAN (TO_DAYS('2001-01-01') + 1));
-if ($verify_without_partitions)
-{
-ALTER TABLE t1 REMOVE PARTITIONING;
-}
-INSERT INTO t1 VALUES ('0000-00-00'), ('0000-01-02'), ('0001-01-01'),
- ('1001-00-00'), ('1001-01-01'), ('1002-00-00'), ('2001-01-01');
---source include/partition_date_range.inc
---echo # test without index
-ALTER TABLE t1 DROP KEY a;
---source include/partition_date_range.inc
-DROP TABLE t1;
-
---echo # test of LIST and index
-CREATE TABLE t1 (a DATE, KEY(a))
-PARTITION BY LIST (TO_DAYS(a))
-(PARTITION `p0001-01-01` VALUES IN (TO_DAYS('0001-01-01')),
- PARTITION `p2001-01-01` VALUES IN (TO_DAYS('2001-01-01')),
- PARTITION `pNULL` VALUES IN (NULL),
- PARTITION `p0000-01-02` VALUES IN (TO_DAYS('0000-01-02')),
- PARTITION `p1001-01-01` VALUES IN (TO_DAYS('1001-01-01')));
-if ($verify_without_partitions)
-{
-ALTER TABLE t1 REMOVE PARTITIONING;
-}
-INSERT INTO t1 VALUES ('0000-00-00'), ('0000-01-02'), ('0001-01-01'),
- ('1001-00-00'), ('1001-01-01'), ('1002-00-00'), ('2001-01-01');
---source include/partition_date_range.inc
---echo # test without index
-ALTER TABLE t1 DROP KEY a;
---source include/partition_date_range.inc
-DROP TABLE t1;
---echo # TO_SECONDS, test of LIST and index
-CREATE TABLE t1 (a DATE, KEY(a))
-PARTITION BY LIST (TO_SECONDS(a))
-(PARTITION `p0001-01-01` VALUES IN (TO_SECONDS('0001-01-01')),
- PARTITION `p2001-01-01` VALUES IN (TO_SECONDS('2001-01-01')),
- PARTITION `pNULL` VALUES IN (NULL),
- PARTITION `p0000-01-02` VALUES IN (TO_SECONDS('0000-01-02')),
- PARTITION `p1001-01-01` VALUES IN (TO_SECONDS('1001-01-01')));
-if ($verify_without_partitions)
-{
-ALTER TABLE t1 REMOVE PARTITIONING;
-}
-INSERT INTO t1 VALUES ('0000-00-00'), ('0000-01-02'), ('0001-01-01'),
- ('1001-00-00'), ('1001-01-01'), ('1002-00-00'), ('2001-01-01');
---source include/partition_date_range.inc
---echo # test without index
-ALTER TABLE t1 DROP KEY a;
---source include/partition_date_range.inc
-DROP TABLE t1;
-
-
-#
-# Bug#46362: Endpoint should be set to false for TO_DAYS(DATE)
-# There is a problem when comparing DATE with DATETIME.
-# In pruning it is converted into the field type
-# and in row evaluation it is converted to longlong
-# (like a DATETIME).
---echo # Test with DATETIME column NOT NULL
-CREATE TABLE t1 (
- a int(10) unsigned NOT NULL,
- b DATETIME NOT NULL,
- PRIMARY KEY (a, b)
-) PARTITION BY RANGE (TO_DAYS(b))
-(PARTITION p20090401 VALUES LESS THAN (TO_DAYS('2009-04-02')),
- PARTITION p20090402 VALUES LESS THAN (TO_DAYS('2009-04-03')),
- PARTITION p20090403 VALUES LESS THAN (TO_DAYS('2009-04-04')),
- PARTITION p20090404 VALUES LESS THAN (TO_DAYS('2009-04-05')),
- PARTITION p20090405 VALUES LESS THAN MAXVALUE);
-INSERT INTO t1 VALUES (1, '2009-01-01'), (1, '2009-04-01'), (2, '2009-04-01'),
- (1, '2009-04-02'), (2, '2009-04-02'), (1, '2009-04-02 23:59:59'),
- (1, '2009-04-03'), (2, '2009-04-03'), (1, '2009-04-04'), (2, '2009-04-04'),
- (1, '2009-04-05'), (1, '2009-04-06'), (1, '2009-04-07');
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03';
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME);
-DROP TABLE t1;
-
---echo # Test with DATE column NOT NULL
-CREATE TABLE t1 (
- a int(10) unsigned NOT NULL,
- b DATE NOT NULL,
- PRIMARY KEY (a, b)
-) PARTITION BY RANGE (TO_DAYS(b))
-(PARTITION p20090401 VALUES LESS THAN (TO_DAYS('2009-04-02')),
- PARTITION p20090402 VALUES LESS THAN (TO_DAYS('2009-04-03')),
- PARTITION p20090403 VALUES LESS THAN (TO_DAYS('2009-04-04')),
- PARTITION p20090404 VALUES LESS THAN (TO_DAYS('2009-04-05')),
- PARTITION p20090405 VALUES LESS THAN MAXVALUE);
-INSERT INTO t1 VALUES (1, '2009-01-01'), (1, '2009-04-01'), (2, '2009-04-01'),
- (1, '2009-04-02'), (2, '2009-04-02'), (1, '2009-04-03'), (2, '2009-04-03'),
- (1, '2009-04-04'), (2, '2009-04-04'), (1, '2009-04-05'), (1, '2009-04-06'),
- (1, '2009-04-07');
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03';
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME);
-DROP TABLE t1;
-
---echo # Test with DATETIME column NULL
-CREATE TABLE t1 (
- a int(10) unsigned NOT NULL,
- b DATETIME NULL
-) PARTITION BY RANGE (TO_DAYS(b))
-(PARTITION p20090401 VALUES LESS THAN (TO_DAYS('2009-04-02')),
- PARTITION p20090402 VALUES LESS THAN (TO_DAYS('2009-04-03')),
- PARTITION p20090403 VALUES LESS THAN (TO_DAYS('2009-04-04')),
- PARTITION p20090404 VALUES LESS THAN (TO_DAYS('2009-04-05')),
- PARTITION p20090405 VALUES LESS THAN MAXVALUE);
-INSERT INTO t1 VALUES (1, '2009-01-01'), (1, '2009-04-01'), (2, '2009-04-01'),
- (1, '2009-04-02'), (2, '2009-04-02'), (1, '2009-04-02 23:59:59'),
- (1, '2009-04-03'), (2, '2009-04-03'), (1, '2009-04-04'), (2, '2009-04-04'),
- (1, '2009-04-05'), (1, '2009-04-06'), (1, '2009-04-07');
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03';
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME);
-DROP TABLE t1;
-
---echo # Test with DATE column NULL
-CREATE TABLE t1 (
- a int(10) unsigned NOT NULL,
- b DATE NULL
-) PARTITION BY RANGE (TO_DAYS(b))
-(PARTITION p20090401 VALUES LESS THAN (TO_DAYS('2009-04-02')),
- PARTITION p20090402 VALUES LESS THAN (TO_DAYS('2009-04-03')),
- PARTITION p20090403 VALUES LESS THAN (TO_DAYS('2009-04-04')),
- PARTITION p20090404 VALUES LESS THAN (TO_DAYS('2009-04-05')),
- PARTITION p20090405 VALUES LESS THAN MAXVALUE);
-INSERT INTO t1 VALUES (1, '2009-01-01'), (1, '2009-04-01'), (2, '2009-04-01'),
- (1, '2009-04-02'), (2, '2009-04-02'), (1, '2009-04-03'), (2, '2009-04-03'),
- (1, '2009-04-04'), (2, '2009-04-04'), (1, '2009-04-05'), (1, '2009-04-06'),
- (1, '2009-04-07');
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE);
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03';
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03';
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME);
-EXPLAIN PARTITIONS SELECT * FROM t1
- WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME);
-DROP TABLE t1;
-
---echo # For better code coverage of the patch
-CREATE TABLE t1 (
- a int(10) unsigned NOT NULL,
- b DATE
-) PARTITION BY RANGE ( TO_DAYS(b) )
-(PARTITION p20090401 VALUES LESS THAN (TO_DAYS('2009-04-02')),
- PARTITION p20090402 VALUES LESS THAN (TO_DAYS('2009-04-03')),
- PARTITION p20090403 VALUES LESS THAN (TO_DAYS('2009-04-04')),
- PARTITION p20090404 VALUES LESS THAN (TO_DAYS('2009-04-05')),
- PARTITION p20090405 VALUES LESS THAN MAXVALUE);
-INSERT INTO t1 VALUES (1, '2009-01-01'), (2, NULL);
---echo # test with an invalid date, which lead to item->null_value is set.
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-99' AS DATETIME);
-DROP TABLE t1;
-
-#
-# Bug#40972: some sql execution lead the whole database crashing
-#
-# Setup so the start is at partition pX and end is at p1
-# Pruning does handle 'bad' dates differently.
-CREATE TABLE t1
-(a INT NOT NULL AUTO_INCREMENT,
- b DATETIME,
- PRIMARY KEY (a,b),
- KEY (b))
-PARTITION BY RANGE (to_days(b))
-(PARTITION p0 VALUES LESS THAN (733681) COMMENT = 'LESS THAN 2008-10-01',
- PARTITION p1 VALUES LESS THAN (733712) COMMENT = 'LESS THAN 2008-11-01',
- PARTITION pX VALUES LESS THAN MAXVALUE);
-SELECT a,b FROM t1 WHERE b >= '2008-12-01' AND b < '2009-12-00';
-DROP TABLE t1;
-
-# Check if we can infer from condition on partition fields that
-# no records will match.
-create table t1 ( a int not null) partition by hash(a) partitions 2;
-insert into t1 values (1),(2),(3);
-explain select * from t1 where a=5 and a=6;
-drop table t1;
-
-# Simple HASH partitioning
-create table t1 (
- a int(11) not null
-) partition by hash (a) partitions 2;
-insert into t1 values (1),(2),(3);
-
-explain partitions select * from t1 where a=1;
-explain partitions select * from t1 where a=2;
-explain partitions select * from t1 where a=1 or a=2;
-
-# Partitioning over several fields
-create table t2 (
- a int not null,
- b int not null
-) partition by key(a,b) partitions 2;
-insert into t2 values (1,1),(2,2),(3,3);
-
-explain partitions select * from t2 where a=1;
-explain partitions select * from t2 where b=1;
-
-explain partitions select * from t2 where a=1 and b=1;
-
-# RANGE(expr) partitioning
-create table t3 (
- a int
-)
-partition by range (a*1) (
- partition p0 values less than (10),
- partition p1 values less than (20)
-);
-insert into t3 values (5),(15);
-
-explain partitions select * from t3 where a=11;
-explain partitions select * from t3 where a=10;
-explain partitions select * from t3 where a=20;
-explain partitions select * from t3 where a=30;
-
-# LIST(expr) partitioning
-create table t4 (a int not null, b int not null) partition by LIST (a+b) (
- partition p0 values in (12),
- partition p1 values in (14)
-);
-insert into t4 values (10,2), (10,4);
-
-# empty OR one
-explain partitions select * from t4 where (a=10 and b=1) or (a=10 and b=2);
-
-# empty OR one OR empty
-explain partitions select * from t4
- where (a=10 and b=1) or (a=10 and b=2) or (a=10 and b = 3);
-
-# one OR empty OR one
-explain partitions select * from t4 where (a=10 and b=2) or (a=10 and b=3)
- or (a=10 and b = 4);
-
-# empty OR full
-explain partitions select * from t4 where (a=10 and b=1) or a=11;
-
-# one OR full
-explain partitions select * from t4 where (a=10 and b=2) or a=11;
-
-drop table t1, t2, t3, t4;
-
-# LIST(expr)/HASH subpartitioning.
-create table t5 (a int not null, b int not null,
- c int not null, d int not null)
-partition by LIST(a+b) subpartition by HASH (c+d) subpartitions 2
-(
- partition p0 values in (12),
- partition p1 values in (14)
-);
-
-insert into t5 values (10,2,0,0), (10,4,0,0), (10,2,0,1), (10,4,0,1);
-explain partitions select * from t5;
-
-# empty OR one OR empty
-explain partitions select * from t5
- where (a=10 and b=1) or (a=10 and b=2) or (a=10 and b = 3);
-
-# one OR empty OR one
-explain partitions select * from t5 where (a=10 and b=2) or (a=10 and b=3)
- or (a=10 and b = 4);
-
-# conditions on subpartitions only
-explain partitions select * from t5 where (c=1 and d=1);
-explain partitions select * from t5 where (c=2 and d=1);
-
-# mixed partition/subpartitions.
-explain partitions select * from t5 where (a=10 and b=2 and c=1 and d=1) or
-(c=2 and d=1);
-
-# same as above
-explain partitions select * from t5 where (a=10 and b=2 and c=1 and d=1) or
-(b=2 and c=2 and d=1);
-
-# LIST(field) partitioning, interval analysis.
-create table t6 (a int not null) partition by LIST(a) (
- partition p1 values in (1),
- partition p3 values in (3),
- partition p5 values in (5),
- partition p7 values in (7),
- partition p9 values in (9)
-);
-insert into t6 values (1),(3),(5);
-
-explain partitions select * from t6 where a < 1;
-explain partitions select * from t6 where a <= 1;
-explain partitions select * from t6 where a > 9;
-explain partitions select * from t6 where a >= 9;
-
-explain partitions select * from t6 where a > 0 and a < 5;
-explain partitions select * from t6 where a > 5 and a < 12;
-explain partitions select * from t6 where a > 3 and a < 8 ;
-
-explain partitions select * from t6 where a >= 0 and a <= 5;
-explain partitions select * from t6 where a >= 5 and a <= 12;
-explain partitions select * from t6 where a >= 3 and a <= 8;
-
-explain partitions select * from t6 where a > 3 and a < 5;
-
-drop table t6;
-
-create table t6 (a int unsigned not null) partition by LIST(a) (
- partition p1 values in (1),
- partition p3 values in (3),
- partition p5 values in (5),
- partition p7 values in (7),
- partition p9 values in (9)
-);
-insert into t6 values (1),(3),(5);
-
-explain partitions select * from t6 where a < 1;
-explain partitions select * from t6 where a <= 1;
-explain partitions select * from t6 where a > 9;
-explain partitions select * from t6 where a >= 9;
-
-explain partitions select * from t6 where a > 0 and a < 5;
-explain partitions select * from t6 where a > 5 and a < 12;
-explain partitions select * from t6 where a > 3 and a < 8 ;
-
-explain partitions select * from t6 where a >= 0 and a <= 5;
-explain partitions select * from t6 where a >= 5 and a <= 12;
-explain partitions select * from t6 where a >= 3 and a <= 8;
-
-explain partitions select * from t6 where a > 3 and a < 5;
-
-# RANGE(field) partitioning, interval analysis.
-create table t7 (a int not null) partition by RANGE(a) (
- partition p10 values less than (10),
- partition p30 values less than (30),
- partition p50 values less than (50),
- partition p70 values less than (70),
- partition p90 values less than (90)
-);
-insert into t7 values (10),(30),(50);
-
-# leftmost intervals
-explain partitions select * from t7 where a < 5;
-explain partitions select * from t7 where a < 9;
-explain partitions select * from t7 where a <= 9;
-explain partitions select * from t7 where a = 9;
-explain partitions select * from t7 where a >= 9;
-explain partitions select * from t7 where a > 9;
-explain partitions select * from t7 where a < 10;
-explain partitions select * from t7 where a <= 10;
-explain partitions select * from t7 where a = 10;
-explain partitions select * from t7 where a >= 10;
-explain partitions select * from t7 where a > 10;
-
-#rightmost intervals
-explain partitions select * from t7 where a < 89;
-explain partitions select * from t7 where a <= 89;
-explain partitions select * from t7 where a = 89;
-explain partitions select * from t7 where a > 89;
-explain partitions select * from t7 where a >= 89;
-explain partitions select * from t7 where a < 90;
-explain partitions select * from t7 where a <= 90;
-explain partitions select * from t7 where a = 90;
-explain partitions select * from t7 where a > 90;
-explain partitions select * from t7 where a >= 90;
-explain partitions select * from t7 where a > 91;
-
-# misc intervals
-explain partitions select * from t7 where a > 11 and a < 29;
-
-drop table t7;
-
-create table t7 (a int unsigned not null) partition by RANGE(a) (
- partition p10 values less than (10),
- partition p30 values less than (30),
- partition p50 values less than (50),
- partition p70 values less than (70),
- partition p90 values less than (90)
-);
-insert into t7 values (10),(30),(50);
-
-# leftmost intervals
-explain partitions select * from t7 where a < 5;
-explain partitions select * from t7 where a < 9;
-explain partitions select * from t7 where a <= 9;
-explain partitions select * from t7 where a = 9;
-explain partitions select * from t7 where a >= 9;
-explain partitions select * from t7 where a > 9;
-explain partitions select * from t7 where a < 10;
-explain partitions select * from t7 where a <= 10;
-explain partitions select * from t7 where a = 10;
-explain partitions select * from t7 where a >= 10;
-explain partitions select * from t7 where a > 10;
-
-#rightmost intervals
-explain partitions select * from t7 where a < 89;
-explain partitions select * from t7 where a <= 89;
-explain partitions select * from t7 where a = 89;
-explain partitions select * from t7 where a > 89;
-explain partitions select * from t7 where a >= 89;
-explain partitions select * from t7 where a < 90;
-explain partitions select * from t7 where a <= 90;
-explain partitions select * from t7 where a = 90;
-explain partitions select * from t7 where a > 90;
-explain partitions select * from t7 where a >= 90;
-explain partitions select * from t7 where a > 91;
-
-# misc intervals
-explain partitions select * from t7 where a > 11 and a < 29;
-
-# LIST(monontonic_func) partitioning
-create table t8 (a date not null) partition by RANGE(YEAR(a)) (
- partition p0 values less than (1980),
- partition p1 values less than (1990),
- partition p2 values less than (2000)
-);
-insert into t8 values ('1985-05-05'),('1995-05-05');
-
-explain partitions select * from t8 where a < '1980-02-02';
-
-# LIST(strict_monotonic_func) partitioning
-create table t9 (a date not null) partition by RANGE(TO_DAYS(a)) (
- partition p0 values less than (732299), -- 2004-12-19
- partition p1 values less than (732468), -- 2005-06-06
- partition p2 values less than (732664) -- 2005-12-19
-);
-insert into t9 values ('2005-05-05'), ('2005-04-04');
-
-explain partitions select * from t9 where a < '2004-12-19';
-explain partitions select * from t9 where a <= '2004-12-19';
-
-drop table t5,t6,t7,t8,t9;
-
-# Test the case where we can't create partitioning 'index'
-#
-# Not supported after bug#18198 is fixed
-#
-#create table t1 (a enum('a','b','c','d') default 'a')
-# partition by hash (ascii(a)) partitions 2;
-#insert into t1 values ('a'),('b'),('c');
-#explain partitions select * from t1 where a='b';
-#drop table t1;
-
-#
-# Test cases for bugs found in code review:
-#
-create table t1 (
- a1 int not null
-)
-partition by range (a1) (
- partition p0 values less than (3),
- partition p1 values less than (6),
- partition p2 values less than (9)
-);
-insert into t1 values (1),(2),(3);
-explain partitions select * from t1 where a1 > 3;
-explain partitions select * from t1 where a1 >= 3;
-
-explain partitions select * from t1 where a1 < 3 and a1 > 3;
-drop table t1;
-
-#
-create table t3 (a int, b int)
- partition by list(a) subpartition by hash(b) subpartitions 4 (
- partition p0 values in (1),
- partition p1 values in (2),
- partition p2 values in (3),
- partition p3 values in (4)
- );
-insert into t3 values (1,1),(2,2),(3,3);
-
-explain partitions select * from t3 where a=2 or b=1;
-explain partitions select * from t3 where a=4 or b=2;
-explain partitions select * from t3 where (a=2 or b=1) and (a=4 or b=2) ;
-drop table t3;
-
-# Test for NULLs
-create table t1 (a int) partition by hash(a) partitions 2;
-insert into t1 values (1),(2);
-explain partitions select * from t1 where a is null;
-
-# this uses both partitions
-explain partitions select * from t1 where a is not null;
-drop table t1;
-
-# Join tests
-create table t1 (a int not null, b int not null, key(a), key(b))
- partition by hash(a) partitions 4;
-insert into t1 values (1,1),(2,2),(3,3),(4,4);
-insert into t1 values (5,5),(6,6),(7,7),(8,8);
-
-explain partitions
-select * from t1 X, t1 Y
-where X.b = Y.b and (X.a=1 or X.a=2) and (Y.a=2 or Y.a=3);
-
-explain partitions
-select * from t1 X, t1 Y where X.a = Y.a and (X.a=1 or X.a=2);
-
-drop table t1;
-
-# Tests for "short ranges"
-create table t1 (a int) partition by hash(a) partitions 20;
-insert into t1 values (1),(2),(3);
-explain partitions select * from t1 where a > 1 and a < 3;
-explain partitions select * from t1 where a >= 1 and a < 3;
-explain partitions select * from t1 where a > 1 and a <= 3;
-explain partitions select * from t1 where a >= 1 and a <= 3;
-drop table t1;
-
-create table t1 (a int, b int)
- partition by list(a) subpartition by hash(b) subpartitions 20
-(
- partition p0 values in (0),
- partition p1 values in (1),
- partition p2 values in (2),
- partition p3 values in (3)
-);
-insert into t1 values (1,1),(2,2),(3,3);
-
-explain partitions select * from t1 where b > 1 and b < 3;
-explain partitions select * from t1 where b > 1 and b < 3 and (a =1 or a =2);
-drop table t1;
-
-# Test partition pruning for single-table UPDATE/DELETE.
-# TODO: Currently we test only "all partitions pruned away" case. Add more
-# tests when the patch that makes use of partition pruning results at
-# execution phase is pushed.
-
-create table t1 (a int) partition by list(a) (
- partition p0 values in (1,2),
- partition p1 values in (3,4)
-);
-insert into t1 values (1),(1),(2),(2),(3),(4),(3),(4);
-
-# This won't do any table access
-flush status;
-update t1 set a=100 where a=5;
-show status like 'Handler_read_rnd_next';
-
-# ... as compared to this, which will scan both partitions
-flush status;
-update t1 set a=100 where a+1=5+1;
-show status like 'Handler_read_rnd_next';
-
-# Same as above for DELETE:
-flush status;
-delete from t1 where a=5;
-show status like 'Handler_read_rnd_next';
-
-flush status;
-delete from t1 where a+1=5+1;
-show status like 'Handler_read_rnd_next';
-
-# Same as above multi-table UPDATE/DELETE
-create table t2 like t1;
-insert into t2 select * from t2;
-
-flush status;
-update t1,t2 set t1.a=1000, t2.a=1000 where t1.a=5 and t2.a=5;
-show status like 'Handler_read_rnd_next';
-# ^ This shows 3 accesses, these are caused by const table reads.
-# They should vanish when partition pruning results are used.
-
-flush status;
-delete t1,t2 from t1, t2 where t1.a=5 and t2.a=5;
-show status like 'Handler_read_rnd_next';
-drop table t1,t2;
-
-#
-# WL#2986 Tests (Checking if partition pruning results are used at query
-# execution phase)
-#
-CREATE TABLE `t1` (
- `a` int(11) default NULL
-);
-INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-CREATE TABLE `t2` (
- `a` int(11) default NULL,
- KEY `a` (`a`)
-) ;
-
-insert into t2 select A.a + 10*(B.a + 10* C.a) from t1 A, t1 B, t1 C ;
-insert into t1 select a from t2;
-
-drop table t2;
-CREATE TABLE `t2` (
- `a` int(11) default NULL,
- `b` int(11) default NULL
-)
-PARTITION BY RANGE (a) (
-PARTITION p0 VALUES LESS THAN (200),
-PARTITION p1 VALUES LESS THAN (400),
-PARTITION p2 VALUES LESS THAN (600),
-PARTITION p3 VALUES LESS THAN (800),
-PARTITION p4 VALUES LESS THAN (1001));
-
-insert into t2 select a,1 from t1 where a < 200;
-insert into t2 select a,2 from t1 where a >= 200 and a < 400;
-insert into t2 select a,3 from t1 where a >= 400 and a < 600;
-insert into t2 select a,4 from t1 where a >= 600 and a < 800;
-insert into t2 select a,5 from t1 where a >= 800 and a < 1001;
-
-explain partitions select * from t2;
-explain partitions select * from t2 where a < 801 and a > 200;
-explain partitions select * from t2 where a < 801 and a > 800;
-explain partitions select * from t2 where a > 600;
-explain partitions select * from t2 where a > 600 and b = 1;
-explain partitions select * from t2 where a > 600 and b = 4;
-explain partitions select * from t2 where a > 600 and b = 5;
-explain partitions select * from t2 where b = 5;
-
-flush status;
-update t2 set b = 100 where b = 6;
-show status like 'Handler_read_rnd_next';
-flush status;
-update t2 set a = 1002 where a = 1001;
-show status like 'Handler_read_rnd_next';
-flush status;
-update t2 set b = 6 where a = 600;
-show status like 'Handler_read_rnd_next';
-flush status;
-update t2 set b = 6 where a > 600 and a < 800;
-show status like 'Handler_read_rnd_next';
-flush status;
-delete from t2 where a > 600;
-show status like 'Handler_read_rnd_next';
-
-drop table t2;
-CREATE TABLE `t2` (
- `a` int(11) default NULL,
- `b` int(11) default NULL,
- index (b)
-)
-PARTITION BY RANGE (a) (
-PARTITION p0 VALUES LESS THAN (200),
-PARTITION p1 VALUES LESS THAN (400),
-PARTITION p2 VALUES LESS THAN (600),
-PARTITION p3 VALUES LESS THAN (800),
-PARTITION p4 VALUES LESS THAN (1001));
-
-insert into t2 select a,1 from t1 where a < 100;
-insert into t2 select a,2 from t1 where a >= 200 and a < 300;
-insert into t2 select a,3 from t1 where a >= 300 and a < 400;
-insert into t2 select a,4 from t1 where a >= 400 and a < 500;
-insert into t2 select a,5 from t1 where a >= 500 and a < 600;
-insert into t2 select a,6 from t1 where a >= 600 and a < 700;
-insert into t2 select a,7 from t1 where a >= 700 and a < 800;
-insert into t2 select a,8 from t1 where a >= 800 and a < 900;
-insert into t2 select a,9 from t1 where a >= 900 and a < 1001;
-
-explain partitions select * from t2;
-# not using indexes
-explain partitions select * from t2 where a = 101;
-explain partitions select * from t2 where a = 550;
-explain partitions select * from t2 where a = 833;
-explain partitions select * from t2 where (a = 100 OR a = 900);
-explain partitions select * from t2 where (a > 100 AND a < 600);
-explain partitions select * from t2 where b = 4;
-
-explain extended select * from t2 where b = 6;
-explain partitions select * from t2 where b = 6;
-
-explain extended select * from t2 where b in (1,3,5);
-explain partitions select * from t2 where b in (1,3,5);
-
-explain extended select * from t2 where b in (2,4,6);
-explain partitions select * from t2 where b in (2,4,6);
-
-explain extended select * from t2 where b in (7,8,9);
-explain partitions select * from t2 where b in (7,8,9);
-
-explain extended select * from t2 where b > 5;
-explain partitions select * from t2 where b > 5;
-
-explain extended select * from t2 where b > 5 and b < 8;
-explain partitions select * from t2 where b > 5 and b < 8;
-
-explain extended select * from t2 where b > 5 and b < 7;
-explain partitions select * from t2 where b > 5 and b < 7;
-
-explain extended select * from t2 where b > 0 and b < 5;
-explain partitions select * from t2 where b > 0 and b < 5;
-
-flush status;
-update t2 set a = 111 where b = 10;
-show status like 'Handler_read_rnd_next';
-show status like 'Handler_read_key';
-flush status;
-update t2 set a = 111 where b in (5,6);
-show status like 'Handler_read_rnd_next';
-show status like 'Handler_read_key';
-flush status;
-update t2 set a = 222 where b = 7;
-show status like 'Handler_read_rnd_next';
-show status like 'Handler_read_key';
-flush status;
-delete from t2 where b = 7;
-show status like 'Handler_read_rnd_next';
-show status like 'Handler_read_key';
-flush status;
-delete from t2 where b > 5;
-show status like 'Handler_read_rnd_next';
-show status like 'Handler_read_rnd_deleted';
-show status like 'Handler_read_key';
-show status like 'Handler_read_prev';
-show status like 'Handler_read_next';
-flush status;
-delete from t2 where b < 5 or b > 3;
-show status like 'Handler_read_rnd_next';
-show status like 'Handler_read_rnd_deleted';
-show status like 'Handler_read_key';
-show status like 'Handler_read_prev';
-show status like 'Handler_read_next';
-
-drop table t1, t2;
-
-# BUG#18025
-# part1: mediumint columns
-create table t1 ( f_int1 mediumint, f_int2 integer)
-partition by list(mod(f_int1,4)) (
- partition p_3 values in (-3),
- partition p_2 values in (-2),
- partition p_1 values in (-1),
- partition p0 values in (0),
- partition p1 values in (1),
- partition p2 values in (2),
- partition p3 values in (3)
-);
-
-insert into t1 values (9, 9), (8, 8), (7, 7), (6, 6), (5, 5),
- (4, 4), (3, 3), (2, 2), (1, 1);
-select * from t1 where f_int1 between 5 and 15 order by f_int1;
-
-drop table t1;
-
-# part2: bug in pruning code
-#create table t1 (a char(10) binary)
-#partition by list(ascii(a))
-# (partition p1 values in (ascii('a')),
-# partition p2 values in (ascii('b')),
-# partition p3 values in (ascii('c')),
-# partition p4 values in (ascii('d')),
-# partition p5 values in (ascii('e')));
-#insert into t1 values ('a'),('bb'),('ccc'),('dddd'),('eeEee');
-#select * from t1 where a>='a' and a <= 'dddd';
-#explain partitions select * from t1 where a>='a' and a <= 'dddd';
-#drop table t1;
-
-# BUG#18659: Assertion failure when subpartitioning is used and partition is
-# "IS NULL"
-create table t1 (f_int1 integer) partition by list(abs(mod(f_int1,2)))
- subpartition by hash(f_int1) subpartitions 2
-(
- partition part1 values in (0),
- partition part2 values in (1),
- partition part4 values in (null)
-);
-insert into t1 set f_int1 = null;
-
-select * from t1 where f_int1 is null;
-explain partitions select * from t1 where f_int1 is null;
-drop table t1;
-
-#
-# BUG#18558
-#
-create table t1 (a int not null, b int not null)
-partition by list(a)
- subpartition by hash(b) subpartitions 4
-(
- partition p0 values in (1),
- partition p1 values in (2),
- partition p2 values in (3)
-);
-insert into t1 values (1,1),(1,2),(1,3),(1,4),
- (2,1),(2,2),(2,3),(2,4);
-explain partitions select * from t1 where a=1 AND (b=1 OR b=2);
-drop table t1;
-
-create table t1 (a int, b int not null)
-partition by list(a)
- subpartition by hash(b) subpartitions 2
-(
- partition p0 values in (1),
- partition p1 values in (2),
- partition p2 values in (3),
- partition pn values in (NULL)
-);
-insert into t1 values (1,1),(1,2),(1,3),(1,4),
- (2,1),(2,2),(2,3),(2,4), (NULL,1);
-
-explain partitions select * from t1 where a IS NULL AND (b=1 OR b=2);
-
-explain partitions select * from t1 where (a IS NULL or a < 1) AND (b=1 OR b=2);
-explain partitions select * from t1 where (a IS NULL or a < 2) AND (b=1 OR b=2);
-explain partitions select * from t1 where (a IS NULL or a <= 1) AND (b=1 OR b=2);
-
-drop table t1;
-
-create table t1 ( a int) partition by list (MOD(a, 10))
-( partition p0 values in (0), partition p1 values in (1),
- partition p2 values in (2), partition p3 values in (3),
- partition p4 values in (4), partition p5 values in (5),
- partition p6 values in (6), partition pn values in (NULL)
-);
-insert into t1 values (NULL), (0),(1),(2),(3),(4),(5),(6);
-explain partitions select * from t1 where a is null or a < 2;
-drop table t1;
-
-# Testcase from BUG#18751
-create table t1 (s1 int) partition by list (s1)
- (partition p1 values in (0),
- partition p2 values in (1),
- partition p3 values in (null));
-
-insert into t1 values (0),(1),(null);
-
-select count(*) from t1 where s1 < 0 or s1 is null;
-explain partitions select count(*) from t1 where s1 < 0 or s1 is null;
-drop table t1;
-
-# No tests for NULLs in RANGE(monotonic_expr()) - they depend on BUG#15447
-# being fixed.
-
-#
-# BUG#17946 Like searches fail with partitioning
-#
-create table t1 (a char(32) primary key)
-partition by key()
-partitions 100;
-insert into t1 values ('na');
-select * from t1;
-select * from t1 where a like 'n%';
-drop table t1;
-
-
-# BUG#19055 Crashes for varchar_col=NUMBER or varchar_col IS NULL
-create table t1 (s1 varchar(15)) partition by key (s1);
-select * from t1 where s1 = 0 or s1 is null;
-insert into t1 values ('aa'),('bb'),('0');
-explain partitions select * from t1 where s1 = 0 or s1 is null;
-drop table t1;
-
-#
-# BUG#19684: EXPLAIN PARTITIONS produces garbage in 'partitions' column when
-# the length of string to be displayed exceeds some limit.
-create table t2 (a int, b int)
- partition by LIST(a)
- subpartition by HASH(b) subpartitions 40
-( partition p_0_long_partition_name values in(1),
- partition p_1_long_partition_name values in(2));
-
-insert into t2 values (1,1),(2,2);
-
---vertical_results
-explain partitions select * from t2;
---horizontal_results
-drop table t2;
-
-
-# BUG#20484 "Partitions: crash with explain and union"
-create table t1 (s1 int);
-explain partitions select 1 from t1 union all select 2;
-drop table t1;
-
-
-# BUG#20257: partition pruning test coverage for BIGINT UNSIGNED
-create table t1 (a bigint unsigned not null) partition by range(a) (
- partition p0 values less than (10),
- partition p1 values less than (100),
- partition p2 values less than (1000),
- partition p3 values less than (18446744073709551000),
- partition p4 values less than (18446744073709551614)
-);
-insert into t1 values (5),(15),(105),(1005);
-insert into t1 values (18446744073709551000+1);
-insert into t1 values (18446744073709551614-1);
-
-explain partitions select * from t1 where a < 10;
-explain partitions select * from t1
- where a >= 18446744073709551000-1 and a <= 18446744073709551000+1;
-
-explain partitions select * from t1
- where a between 18446744073709551001 and 18446744073709551002;
-
-explain partitions select * from t1 where a = 18446744073709551000;
-explain partitions select * from t1 where a = 18446744073709551613;
-explain partitions select * from t1 where a = 18446744073709551614;
-drop table t1;
-#
-# Test all variants of usage for interval_via_mapping
-# and interval_via_walking
-#
-# t1 will use interval_via_mapping since it uses a
-# monotonic function, whereas t2 will use
-# interval_via_walking since the intervals are short
-# and the function isn't monotonic (it is, but it isn't
-# discovered in this version).
-#
- create table t1 (a int)
- partition by range(a) (
- partition p0 values less than (64),
- partition p1 values less than (128),
- partition p2 values less than (255)
-);
-
-create table t2 (a int)
- partition by range(a+0) (
- partition p0 values less than (64),
- partition p1 values less than (128),
- partition p2 values less than (255)
-);
-
-insert into t1 values (0x20), (0x20), (0x41), (0x41), (0xFE), (0xFE);
-insert into t2 values (0x20), (0x20), (0x41), (0x41), (0xFE), (0xFE);
-explain partitions select * from t1 where a=0;
-explain partitions select * from t2 where a=0;
-explain partitions select * from t1 where a=0xFE;
-explain partitions select * from t2 where a=0xFE;
-explain partitions select * from t1 where a > 0xFE AND a <= 0xFF;
-explain partitions select * from t2 where a > 0xFE AND a <= 0xFF;
-explain partitions select * from t1 where a >= 0xFE AND a <= 0xFF;
-explain partitions select * from t2 where a >= 0xFE AND a <= 0xFF;
-explain partitions select * from t1 where a < 64 AND a >= 63;
-explain partitions select * from t2 where a < 64 AND a >= 63;
-explain partitions select * from t1 where a <= 64 AND a >= 63;
-explain partitions select * from t2 where a <= 64 AND a >= 63;
-drop table t1;
-drop table t2;
-
-create table t1(a bigint unsigned not null) partition by range(a+0) (
- partition p1 values less than (10),
- partition p2 values less than (20),
- partition p3 values less than (2305561538531885056),
- partition p4 values less than (2305561538531950591)
-);
-
-insert into t1 values (9),(19),(0xFFFF0000FFFF000-1), (0xFFFF0000FFFFFFF-1);
-insert into t1 values (9),(19),(0xFFFF0000FFFF000-1), (0xFFFF0000FFFFFFF-1);
-
-explain partitions select * from t1 where
- a >= 2305561538531885056-10 and a <= 2305561538531885056-8;
-
-explain partitions select * from t1 where
- a > 0xFFFFFFFFFFFFFFEC and a < 0xFFFFFFFFFFFFFFEE;
-
-explain partitions select * from t1 where a>=0 and a <= 0xFFFFFFFFFFFFFFFF;
-drop table t1;
-
-create table t1 (a bigint) partition by range(a+0) (
- partition p1 values less than (-1000),
- partition p2 values less than (-10),
- partition p3 values less than (10),
- partition p4 values less than (1000)
-);
-insert into t1 values (-15),(-5),(5),(15),(-15),(-5),(5),(15);
-explain partitions select * from t1 where a>-2 and a <=0;
-drop table t1;
-
-
-#
-# BUG#27927 Partition pruning not optimal with TO_DAYS function
-#
-
-CREATE TABLE t1 ( recdate DATETIME NOT NULL )
-PARTITION BY RANGE( TO_DAYS(recdate) ) (
- PARTITION p0 VALUES LESS THAN ( TO_DAYS('2007-03-08') ),
- PARTITION p1 VALUES LESS THAN ( TO_DAYS('2007-04-01') )
-);
-INSERT INTO t1 VALUES ('2007-03-01 12:00:00');
-INSERT INTO t1 VALUES ('2007-03-07 12:00:00');
-INSERT INTO t1 VALUES ('2007-03-08 12:00:00');
-INSERT INTO t1 VALUES ('2007-03-15 12:00:00');
--- echo must use p0 only:
-explain partitions select * from t1 where recdate < '2007-03-08 00:00:00';
-
-drop table t1;
-CREATE TABLE t1 ( recdate DATETIME NOT NULL )
-PARTITION BY RANGE( YEAR(recdate) ) (
- PARTITION p0 VALUES LESS THAN (2006),
- PARTITION p1 VALUES LESS THAN (2007)
-);
-INSERT INTO t1 VALUES ('2005-03-01 12:00:00');
-INSERT INTO t1 VALUES ('2005-03-01 12:00:00');
-INSERT INTO t1 VALUES ('2006-03-01 12:00:00');
-INSERT INTO t1 VALUES ('2006-03-01 12:00:00');
-
--- echo must use p0 only:
-explain partitions select * from t1 where recdate < '2006-01-01 00:00:00';
-drop table t1;
-
--- echo #
--- echo # BUG#33730 Full table scan instead selected partitions for query more than 10 partitions
--- echo #
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t1 (a int)
- partition by range(a+0) (
- partition p0 values less than (64),
- partition p1 values less than (128),
- partition p2 values less than (255)
-);
-insert into t1 select A.a + 10*B.a from t0 A, t0 B;
-
-# this will use interval_via_walking
-explain partitions select * from t1 where a between 10 and 13;
-explain partitions select * from t1 where a between 10 and 10+33;
-
-drop table t0, t1;
-
---echo #
---echo # Bug#71095: Wrong results with PARTITION BY LIST COLUMNS()
---echo #
-CREATE TABLE t1
-(c1 int,
- c2 int,
- c3 int,
- c4 int,
- PRIMARY KEY (c1,c2))
-PARTITION BY LIST COLUMNS (c2)
-(PARTITION p1 VALUES IN (1,2),
- PARTITION p2 VALUES IN (3,4));
-INSERT INTO t1 VALUES (1, 1, 1, 1), (2, 3, 1, 1);
-INSERT INTO t1 VALUES (1, 2, 1, 1), (2, 4, 1, 1);
-SELECT * FROM t1 WHERE c1 = 1 AND c2 < 1;
-SELECT * FROM t1 WHERE c1 = 1 AND c2 <= 1;
-SELECT * FROM t1 WHERE c1 = 1 AND c2 = 1;
-SELECT * FROM t1 WHERE c1 = 1 AND c2 >= 1;
-SELECT * FROM t1 WHERE c1 = 1 AND c2 > 1;
-SELECT * FROM t1 WHERE c1 = 1 AND c2 < 3;
-SELECT * FROM t1 WHERE c1 = 1 AND c2 <= 3;
-SELECT * FROM t1 WHERE c1 = 2 AND c2 <= 3;
-SELECT * FROM t1 WHERE c1 = 2 AND c2 = 3;
-SELECT * FROM t1 WHERE c1 = 2 AND c2 >= 3;
-SELECT * FROM t1 WHERE c1 = 2 AND c2 > 3;
-SELECT * FROM t1 WHERE c1 = 2 AND c2 < 4;
-SELECT * FROM t1 WHERE c1 = 2 AND c2 <= 4;
-SELECT * FROM t1 WHERE c1 = 2 AND c2 = 4;
-SELECT * FROM t1 WHERE c1 = 2 AND c2 >= 4;
-SELECT * FROM t1 WHERE c1 = 2 AND c2 > 4;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 < 1;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 <= 1;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 = 1;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 >= 1;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 > 1;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 < 3;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 <= 3;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 <= 3;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 = 3;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 >= 3;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 > 3;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 < 4;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 <= 4;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 = 4;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 >= 4;
-EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 > 4;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-6239: Partition pruning is not working as expected in an inner query
---echo #
-
-create table t1
-(
- company_id bigint(5),
- dept_id bigint(5),
- emp_id bigint(5),
- emp_name varchar(100),
- primary key (company_id, emp_id)
-) partition by list (company_id) (
- partition p_1000 values in (1000),
- partition p_2000 values in (2000),
- partition p_3000 values in (3000)
-);
-
-create table t2
-(
- company_id bigint(5),
- dept_id bigint(5),
- dept_name varchar(100),
- primary key (company_id, dept_id)
-) partition by list (company_id) (
- partition p_1000 values in (1000),
- partition p_2000 values in (2000),
- partition p_3000 values in (3000)
-);
-
-insert into t2 values
- (1000, 10, 'Engineering'),
- (1000, 20, 'Product Management'),
- (1000, 30, 'QA'),
- (2000, 40, 'Support'),
- (2000, 50, 'Professional Services');
-
-insert into t1 values
-(1000, 10, 1, 'John'),
-(1000, 10, 2, 'Smith'),
-(1000, 20, 3, 'Jacob'),
-(1000, 20, 4, 'Brian'),
-(1000, 30, 5, 'Chris'),
-(1000, 30, 6, 'Ryan'),
-(2000, 40, 7, 'Karin'),
-(2000, 40, 8, 'Jay'),
-(2000, 50, 9, 'Ana'),
-(2000, 50, 10, 'Jessica');
-
---echo # Table t2 should have only partition p_1000.
-explain partitions
-select * from t1
-where company_id = 1000
-and dept_id in (select dept_id from t2 where COMPANY_ID = 1000);
-
-drop table t1,t2;
-
---echo #
---echo # MDEV-9505: Valgrind failure in SEL_ARG::store_min,find_used_partitions,...
---echo #
-create table t1 (a int, b char(10), c varchar(5), d int)
-partition by range columns(a,b,c)
-subpartition by key (c,d)
-subpartitions 3
-( partition p0 values less than (1,'abc','abc'),
- partition p1 values less than (2,'abc','abc'),
- partition p2 values less than (3,'abc','abc'),
- partition p3 values less than (4,'abc','abc')
-);
-
-insert into t1 values (1,'a','b',1),(2,'a','b',2),(3,'a','b',3);
-select * from t1 where (a = 1 AND b < 'd' AND (c = 'b' OR (c = 'c' AND d = 1)) OR
- (a = 1 AND b >= 'a' AND (c = 'c' OR (c = 'd' AND d = 2))));
-drop table t1;
-
-
diff --git a/mysql-test/t/partition_range.test b/mysql-test/t/partition_range.test
deleted file mode 100644
index 3ff03248d88..00000000000
--- a/mysql-test/t/partition_range.test
+++ /dev/null
@@ -1,974 +0,0 @@
-#--disable_abort_on_error
-#
-# Simple test for the partition storage engine
-# Focuses on range partitioning tests
-#
--- source include/have_partition.inc
-
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-
---echo #
---echo # Bug#48229: group by performance issue of partitioned table
---echo #
-CREATE TABLE t1 (
- a INT,
- b INT,
- KEY a (a,b)
-)
-PARTITION BY HASH (a) PARTITIONS 1;
-
-# insert some rows (i.e. so that rows/blocks > 1)
-INSERT INTO t1 VALUES (0, 580092), (3, 894076), (4, 805483), (4, 913540), (6, 611137), (8, 171602), (9, 599495), (9, 746305), (10, 272829), (10, 847519), (12, 258869), (12, 929028), (13, 288970), (15, 20971), (15, 105839), (16, 788272), (17, 76914), (18, 827274), (19, 802258), (20, 123677), (20, 587729), (22, 701449), (25, 31565), (25, 230782), (25, 442887), (25, 733139), (25, 851020);
-
-# Before the fix the 'Extra' column showed 'Using index for group-by'
-EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10, 100, 3) GROUP BY a;
-
-DROP TABLE t1;
-
-#
-#BUG#49591, Add proper version number to SHOW CREATE TABLE
-#
-create table t1 (a DATETIME)
-partition by range (TO_DAYS(a))
-subpartition by hash(to_seconds(a))
-(partition p0 values less than (1));
-show create table t1;
-drop table t1;
-
---error ER_NULL_IN_VALUES_LESS_THAN
-create table t1 (a int)
-partition by range (a)
-( partition p0 values less than (NULL),
- partition p1 values less than (MAXVALUE));
-#
-# Merge fix of bug#27927 for TO_SECONDS function
-#
-create table t1 (a datetime not null)
-partition by range (TO_SECONDS(a))
-( partition p0 VALUES LESS THAN (TO_SECONDS('2007-03-08 00:00:00')),
- partition p1 VALUES LESS THAN (TO_SECONDS('2007-04-01 00:00:00')));
-select partition_method, partition_expression, partition_description
- from information_schema.partitions where table_name = "t1";
-INSERT INTO t1 VALUES ('2007-03-01 12:00:00'), ('2007-03-07 12:00:00');
-INSERT INTO t1 VALUES ('2007-03-08 12:00:00'), ('2007-03-15 12:00:00');
-explain partitions select * from t1 where a < '2007-03-08 00:00:00';
-explain partitions select * from t1 where a < '2007-03-08 00:00:01';
-explain partitions select * from t1 where a <= '2007-03-08 00:00:00';
-explain partitions select * from t1 where a <= '2007-03-07 23:59:59';
-explain partitions select * from t1 where a < '2007-03-07 23:59:59';
-show create table t1;
-drop table t1;
-#
-# New test cases for new function to_seconds
-#
-create table t1 (a date)
-partition by range(to_seconds(a))
-(partition p0 values less than (to_seconds('2004-01-01')),
- partition p1 values less than (to_seconds('2005-01-01')));
-insert into t1 values ('2003-12-30'),('2004-12-31');
-select * from t1;
-explain partitions select * from t1 where a <= '2003-12-31';
-select * from t1 where a <= '2003-12-31';
-explain partitions select * from t1 where a <= '2005-01-01';
-select * from t1 where a <= '2005-01-01';
-show create table t1;
-drop table t1;
-
-create table t1 (a datetime)
-partition by range(to_seconds(a))
-(partition p0 values less than (to_seconds('2004-01-01 12:00:00')),
- partition p1 values less than (to_seconds('2005-01-01 12:00:00')));
-insert into t1 values ('2004-01-01 11:59:29'),('2005-01-01 11:59:59');
-select * from t1;
-explain partitions select * from t1 where a <= '2004-01-01 11:59.59';
-select * from t1 where a <= '2004-01-01 11:59:59';
-explain partitions select * from t1 where a <= '2005-01-01';
-select * from t1 where a <= '2005-01-01';
-show create table t1;
-drop table t1;
-
-#
-# Adding new test cases for column list variant for partitioning
-#
---error 1064
-create table t1 (a int, b char(20))
-partition by range columns(a,b)
-(partition p0 values less than (1));
-
---error ER_TOO_MANY_VALUES_ERROR
-create table t1 (a int, b char(20))
-partition by range(a)
-(partition p0 values less than (1,"b"));
-
---error ER_TOO_MANY_VALUES_ERROR
-create table t1 (a int, b char(20))
-partition by range(a)
-(partition p0 values less than (1,"b"));
-
-create table t1 (a int, b char(20))
-partition by range columns(b)
-(partition p0 values less than ("b"));
-drop table t1;
-
-#
-# BUG 33429: Succeeds in adding partition when maxvalue on last partition
-#
-create table t1 (a int)
-partition by range (a)
-( partition p0 values less than (maxvalue));
---error ER_PARTITION_MAXVALUE_ERROR
-alter table t1 add partition (partition p1 values less than (100000));
-show create table t1;
-drop table t1;
-
-# BUG 32943:
-# Locking problems in relation to partitioning and triggers
-# Also fixes and test cases of generic lock issues with
-# partition change code.
-#
-create table t1 (a integer)
-partition by range (a)
-( partition p0 values less than (4),
- partition p1 values less than (100));
-
-delimiter |;
-create trigger tr1 before insert on t1
-for each row begin
- set @a = 1;
-end|
-
-delimiter ;|
-alter table t1 drop partition p0;
-
-drop table t1;
-
-create table t1 (a integer)
-partition by range (a)
-( partition p0 values less than (4),
- partition p1 values less than (100));
-LOCK TABLES t1 WRITE;
-alter table t1 drop partition p0;
-alter table t1 reorganize partition p1 into
-( partition p0 values less than (4),
- partition p1 values less than (100));
-alter table t1 add partition ( partition p2 values less than (200));
-UNLOCK TABLES;
-drop table t1;
-
-#
-# BUG 18198: Various tests for partition functions
-#
-#create table t1 (a varchar(10) charset latin1 collate latin1_bin, b int)
-#partition by range (ascii(a) * b)
-#(partition p0 values less than (2), partition p1 values less than (4000));
-#insert into t1 values ('a ', 2),('a',3);
-#drop table t1;
-
-#create table t1 (a varchar(10) charset latin1 collate latin1_bin, b int)
-#partition by range (b* ascii(a) * b)
-#(partition p0 values less than (2), partition p1 values less than (4000));
-#insert into t1 values ('a ', 2),('a',3);
-#drop table t1;
-
-#create table t1 (a varchar(10) charset latin1 collate latin1_bin,
-# b varchar(10) charset latin1 collate latin1_bin)
-#partition by range (ascii(b) * ascii(a))
-#(partition p0 values less than (2), partition p1 values less than (40000));
-#insert into t1 values ('a ', 'b '),('a','b');
-#drop table t1;
-
-#create table t1 (a varchar(10) charset latin1 collate latin1_bin,
-# b varchar(10) charset latin1 collate latin1_bin)
-#partition by range (ascii(a) * ascii(b))
-#(partition p0 values less than (2), partition p1 values less than (40000));
-#insert into t1 values ('a ', 'b '),('a','b');
-#drop table t1;
-
-#create table t1 (a varchar(10) charset latin1 collate latin1_bin,
-# b varchar(10) charset latin1 collate latin1_bin, c int)
-#partition by range (ascii(a) * c)
-#(partition p0 values less than (2), partition p1 values less than (4000));
-#insert into t1 values ('a ', 'b ', 2),('a','b', 3);
-#drop table t1;
-
-#create table t1 (a varchar(10) charset latin1 collate latin1_bin,
-# b varchar(10) charset latin1 collate latin1_bin, c int)
-#partition by range (c * ascii(a))
-#(partition p0 values less than (2), partition p1 values less than (4000));
-#insert into t1 values ('a ', 'b ', 2),('a','b', 3);
-#drop table t1;
-
-#
-# More checks for partition pruning
-#
-create table t1 (a int unsigned)
-partition by range (a)
-(partition pnull values less than (0),
- partition p0 values less than (1),
- partition p1 values less than(2));
-insert into t1 values (null),(0),(1);
-
-select * from t1 where a is null;
-select * from t1 where a >= 0;
-select * from t1 where a < 0;
-select * from t1 where a <= 0;
-select * from t1 where a > 1;
-explain partitions select * from t1 where a is null;
-explain partitions select * from t1 where a >= 0;
-explain partitions select * from t1 where a < 0;
-explain partitions select * from t1 where a <= 0;
-explain partitions select * from t1 where a > 1;
-drop table t1;
-
-create table t1 (a int unsigned, b int unsigned)
-partition by range (a)
-subpartition by hash (b)
-subpartitions 2
-(partition pnull values less than (0),
- partition p0 values less than (1),
- partition p1 values less than(2));
-insert into t1 values (null,0),(null,1),(0,0),(0,1),(1,0),(1,1);
-
-select * from t1 where a is null;
-select * from t1 where a >= 0;
-select * from t1 where a < 0;
-select * from t1 where a <= 0;
-select * from t1 where a > 1;
-explain partitions select * from t1 where a is null;
-explain partitions select * from t1 where a >= 0;
-explain partitions select * from t1 where a < 0;
-explain partitions select * from t1 where a <= 0;
-explain partitions select * from t1 where a > 1;
-
-drop table t1;
-
-#
-# Partition by range, basic
-#
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by range (a)
-partitions 3
-(partition x1 values less than (5) tablespace ts1,
- partition x2 values less than (10) tablespace ts2,
- partition x3 values less than maxvalue tablespace ts3);
-
-# Simple insert and verify test
-INSERT into t1 values (1, 1, 1);
-INSERT into t1 values (6, 1, 1);
-INSERT into t1 values (10, 1, 1);
-INSERT into t1 values (15, 1, 1);
-
-select * from t1;
-show create table t1;
-
-ALTER TABLE t1
-partition by range (a)
-partitions 3
-(partition x1 values less than (5) tablespace ts1,
- partition x2 values less than (10) tablespace ts2,
- partition x3 values less than maxvalue tablespace ts3);
-
-select * from t1;
-show create table t1;
-
-drop table if exists t1;
-
-#
-# Partition by range, basic
-# No primary key
-#
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null)
-partition by range (a)
-partitions 3
-(partition x1 values less than (5) tablespace ts1,
- partition x2 values less than (10) tablespace ts2,
- partition x3 values less than maxvalue tablespace ts3);
-
-# Simple insert and verify test
-INSERT into t1 values (1, 1, 1);
-INSERT into t1 values (6, 1, 1);
-INSERT into t1 values (10, 1, 1);
-INSERT into t1 values (15, 1, 1);
-
-select * from t1;
-
-ALTER TABLE t1
-partition by range (a)
-partitions 3
-(partition x1 values less than (5) tablespace ts1,
- partition x2 values less than (10) tablespace ts2,
- partition x3 values less than maxvalue tablespace ts3);
-
-select * from t1;
-
-drop table if exists t1;
-
-#
-# Partition by range, basic
-# No max value used
-#
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by range (a)
-partitions 3
-(partition x1 values less than (5) tablespace ts1,
- partition x2 values less than (10) tablespace ts2,
- partition x3 values less than (15) tablespace ts3);
-
-
-# Simple insert and verify test
-INSERT into t1 values (1, 1, 1);
-INSERT into t1 values (6, 1, 1);
-INSERT into t1 values (10, 1, 1);
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-INSERT into t1 values (15, 1, 1);
-
-select * from t1;
-
-ALTER TABLE t1
-partition by range (a)
-partitions 3
-(partition x1 values less than (5) tablespace ts1,
- partition x2 values less than (10) tablespace ts2,
- partition x3 values less than (15) tablespace ts3);
-
-select * from t1;
-
-drop table t1;
-
-#
-# Partition by range, only one partition
-#
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key(a,b))
-partition by range (a)
-(partition x1 values less than (1));
-
-drop table t1;
-
-#
-# Subpartition by hash, two partitions and two subpartitions
-#
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key (a,b))
-partition by range (a)
-subpartition by hash (a+b)
-( partition x1 values less than (1)
- ( subpartition x11,
- subpartition x12),
- partition x2 values less than (5)
- ( subpartition x21,
- subpartition x22)
-);
-
-SELECT * from t1;
-show create table t1;
-
-ALTER TABLE t1 ADD COLUMN d int;
-show create table t1;
-
-drop table t1;
-
-#
-# Subpartition by hash, two partitions and two subpartitions
-# Defined tablespace, engine and node group
-#
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key (a,b))
-partition by range (a)
-subpartition by hash (a+b)
-( partition x1 values less than (1)
- ( subpartition x11 tablespace t1 engine myisam nodegroup 0,
- subpartition x12 tablespace t2 engine myisam nodegroup 1),
- partition x2 values less than (5)
- ( subpartition x21 tablespace t1 engine myisam nodegroup 0,
- subpartition x22 tablespace t2 engine myisam nodegroup 1)
-);
-
-SELECT * from t1;
-
-drop table t1;
-
-#
-# Subpartition by hash, two partitions and two subpartitions
-# Defined tablespace, node group
-#
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key (a,b))
-partition by range (a)
-subpartition by hash (a+b)
-( partition x1 values less than (1)
- ( subpartition x11 tablespace t1 nodegroup 0,
- subpartition x12 tablespace t2 nodegroup 1),
- partition x2 values less than (5)
- ( subpartition x21 tablespace t1 nodegroup 0,
- subpartition x22 tablespace t2 nodegroup 1)
-);
-
-SELECT * from t1;
-
-drop table t1;
-
-#
-# Subpartition by hash, two partitions and two subpartitions
-# Defined engine and node group
-#
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key (a,b))
-partition by range (a)
-subpartition by hash (a+b)
-( partition x1 values less than (1)
- ( subpartition x11 engine myisam nodegroup 0,
- subpartition x12 engine myisam nodegroup 1),
- partition x2 values less than (5)
- ( subpartition x21 engine myisam nodegroup 0,
- subpartition x22 engine myisam nodegroup 1)
-);
-
-INSERT into t1 VALUES (1,1,1);
-INSERT into t1 VALUES (4,1,1);
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-INSERT into t1 VALUES (5,1,1);
-
-SELECT * from t1;
-
-ALTER TABLE t1
-partition by range (a)
-subpartition by hash (a+b)
-( partition x1 values less than (1)
- ( subpartition x11 engine myisam nodegroup 0,
- subpartition x12 engine myisam nodegroup 1),
- partition x2 values less than (5)
- ( subpartition x21 engine myisam nodegroup 0,
- subpartition x22 engine myisam nodegroup 1)
-);
-
-SELECT * from t1;
-
-drop table t1;
-
-#
-# Subpartition by hash, two partitions and two subpartitions
-# Defined tablespace, engine
-#
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key (a,b))
-partition by range (a)
-subpartition by hash (a+b)
-( partition x1 values less than (1)
- ( subpartition x11 tablespace t1 engine myisam,
- subpartition x12 tablespace t2 engine myisam),
- partition x2 values less than (5)
- ( subpartition x21 tablespace t1 engine myisam,
- subpartition x22 tablespace t2 engine myisam)
-);
-
-INSERT into t1 VALUES (1,1,1);
-INSERT into t1 VALUES (4,1,1);
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-INSERT into t1 VALUES (5,1,1);
-
-SELECT * from t1;
-
-ALTER TABLE t1
-partition by range (a)
-subpartition by hash (a+b)
-( partition x1 values less than (1)
- ( subpartition x11 tablespace t1 engine myisam,
- subpartition x12 tablespace t2 engine myisam),
- partition x2 values less than (5)
- ( subpartition x21 tablespace t1 engine myisam,
- subpartition x22 tablespace t2 engine myisam)
-);
-
-SELECT * from t1;
-
-drop table t1;
-
-#
-# Subpartition by hash, two partitions and two subpartitions
-# Defined tablespace
-#
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key (a,b))
-partition by range (a)
-subpartition by hash (a+b)
-( partition x1 values less than (1)
- ( subpartition x11 tablespace t1,
- subpartition x12 tablespace t2),
- partition x2 values less than (5)
- ( subpartition x21 tablespace t1,
- subpartition x22 tablespace t2)
-);
-
-INSERT into t1 VALUES (1,1,1);
-INSERT into t1 VALUES (4,1,1);
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-INSERT into t1 VALUES (5,1,1);
-
-SELECT * from t1;
-
-ALTER TABLE t1
-partition by range (a)
-subpartition by hash (a+b)
-( partition x1 values less than (1)
- ( subpartition x11 tablespace t1 engine myisam,
- subpartition x12 tablespace t2 engine myisam),
- partition x2 values less than (5)
- ( subpartition x21 tablespace t1 engine myisam,
- subpartition x22 tablespace t2 engine myisam)
-);
-
-SELECT * from t1;
-
-drop table t1;
-
-#
-# Subpartition by hash, two partitions and two subpartitions
-# Defined engine
-#
-CREATE TABLE t1 (
-a int not null,
-b int not null,
-c int not null,
-primary key (a,b))
-partition by range (a)
-subpartition by hash (a+b)
-( partition x1 values less than (1)
- ( subpartition x11 engine myisam,
- subpartition x12 engine myisam),
- partition x2 values less than (5)
- ( subpartition x21 engine myisam,
- subpartition x22 engine myisam)
-);
-
-INSERT into t1 VALUES (1,1,1);
-INSERT into t1 VALUES (4,1,1);
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-INSERT into t1 VALUES (5,1,1);
-
-SELECT * from t1;
-
-ALTER TABLE t1
-partition by range (a)
-subpartition by hash (a+b)
-( partition x1 values less than (1)
- ( subpartition x11 engine myisam,
- subpartition x12 engine myisam),
- partition x2 values less than (5)
- ( subpartition x21 engine myisam,
- subpartition x22 engine myisam)
-);
-
-SELECT * from t1;
-
-drop table t1;
-
-#
-# Bug #17894 Comparison with "less than" operator fails with Range partition
-#
-CREATE TABLE t1 (c1 int default NULL, c2 varchar(30) default NULL,
-c3 date default NULL) engine=myisam
-PARTITION BY RANGE (year(c3)) (PARTITION p0 VALUES LESS THAN (1995),
-PARTITION p1 VALUES LESS THAN (1996) , PARTITION p2 VALUES LESS THAN (1997) ,
-PARTITION p3 VALUES LESS THAN (1998) , PARTITION p4 VALUES LESS THAN (1999) ,
-PARTITION p5 VALUES LESS THAN (2000) , PARTITION p6 VALUES LESS THAN (2001) ,
-PARTITION p7 VALUES LESS THAN (2002) , PARTITION p8 VALUES LESS THAN (2003) ,
-PARTITION p9 VALUES LESS THAN (2004) , PARTITION p10 VALUES LESS THAN (2010),
-PARTITION p11 VALUES LESS THAN MAXVALUE );
-INSERT INTO t1 VALUES (1, 'testing partitions', '1995-07-17'),
-(3, 'testing partitions','1995-07-31'),
-(5, 'testing partitions','1995-08-13'),
-(7, 'testing partitions','1995-08-26'),
-(9, 'testing partitions','1995-09-09'),
-(0, 'testing partitions','2000-07-10'),
-(2, 'testing partitions','2000-07-23'),
-(4, 'testing partitions','2000-08-05'),
-(6, 'testing partitions','2000-08-19'),
-(8, 'testing partitions','2000-09-01');
-SELECT COUNT(*) FROM t1 WHERE c3 BETWEEN '1996-12-31' AND '2000-12-31';
-SELECT COUNT(*) FROM t1 WHERE c3 < '2000-12-31';
-DROP TABLE t1;
-
-#
-# BUG 16002: Unsigned partition functions not handled correctly
-#
---error ER_RANGE_NOT_INCREASING_ERROR
-create table t1 (a bigint unsigned)
-partition by range (a)
-(partition p0 values less than (10),
- partition p1 values less than (0));
-
-create table t1 (a bigint unsigned)
-partition by range (a)
-(partition p0 values less than (0),
- partition p1 values less than (10));
-show create table t1;
-drop table t1;
-
-create table t1 (a bigint unsigned)
-partition by range (a)
-(partition p0 values less than (2),
- partition p1 values less than (10));
-show create table t1;
---error ER_NO_PARTITION_FOR_GIVEN_VALUE
-insert into t1 values (0xFFFFFFFFFFFFFFFF);
-drop table t1;
-
-#
-# BUG 18962 Errors in DROP PARTITION
-#
-create table t1 (a int)
-partition by range (MOD(a,3))
-subpartition by hash(a)
-subpartitions 2
-(partition p0 values less than (1),
- partition p1 values less than (2),
- partition p2 values less than (3),
- partition p3 values less than (4));
-ALTER TABLE t1 DROP PARTITION p3;
-ALTER TABLE t1 DROP PARTITION p1;
-ALTER TABLE t1 DROP PARTITION p2;
-drop table t1;
-
-create table t1 (a int)
-partition by range (MOD(a,3))
-subpartition by hash(a)
-subpartitions 2
-(partition p0 values less than (1),
- partition p1 values less than (2),
- partition p2 values less than (3),
- partition p3 values less than (4));
-ALTER TABLE t1 DROP PARTITION p0;
-ALTER TABLE t1 DROP PARTITION p1;
-ALTER TABLE t1 DROP PARTITION p2;
-drop table t1;
-
-#
-# Bug 19830: ALTER TABLE t1 REORGANIZE PARTITION crashes
-#
-create table t1 (a int DEFAULT NULL,
- b varchar(30) DEFAULT NULL,
- c date DEFAULT NULL)
-ENGINE=MYISAM DEFAULT CHARSET=latin1;
-
-insert into t1 values (1, 'abc', '1995-01-01');
-insert into t1 values (1, 'abc', '1995-01-02');
-insert into t1 values (1, 'abc', '1995-01-03');
-insert into t1 values (1, 'abc', '1995-01-04');
-insert into t1 values (1, 'abc', '1995-01-05');
-insert into t1 values (1, 'abc', '1995-01-06');
-insert into t1 values (1, 'abc', '1995-01-07');
-insert into t1 values (1, 'abc', '1995-01-08');
-insert into t1 values (1, 'abc', '1995-01-09');
-insert into t1 values (1, 'abc', '1995-01-10');
-insert into t1 values (1, 'abc', '1995-01-11');
-insert into t1 values (1, 'abc', '1995-01-12');
-insert into t1 values (1, 'abc', '1995-01-13');
-insert into t1 values (1, 'abc', '1995-01-14');
-insert into t1 values (1, 'abc', '1995-01-15');
-insert into t1 values (1, 'abc', '1997-01-01');
-insert into t1 values (1, 'abc', '1997-01-02');
-insert into t1 values (1, 'abc', '1997-01-03');
-insert into t1 values (1, 'abc', '1997-01-04');
-insert into t1 values (1, 'abc', '1997-01-05');
-insert into t1 values (1, 'abc', '1997-01-06');
-insert into t1 values (1, 'abc', '1997-01-07');
-insert into t1 values (1, 'abc', '1997-01-08');
-insert into t1 values (1, 'abc', '1997-01-09');
-insert into t1 values (1, 'abc', '1997-01-10');
-insert into t1 values (1, 'abc', '1997-01-11');
-insert into t1 values (1, 'abc', '1997-01-12');
-insert into t1 values (1, 'abc', '1997-01-13');
-insert into t1 values (1, 'abc', '1997-01-14');
-insert into t1 values (1, 'abc', '1997-01-15');
-insert into t1 values (1, 'abc', '1998-01-01');
-insert into t1 values (1, 'abc', '1998-01-02');
-insert into t1 values (1, 'abc', '1998-01-03');
-insert into t1 values (1, 'abc', '1998-01-04');
-insert into t1 values (1, 'abc', '1998-01-05');
-insert into t1 values (1, 'abc', '1998-01-06');
-insert into t1 values (1, 'abc', '1998-01-07');
-insert into t1 values (1, 'abc', '1998-01-08');
-insert into t1 values (1, 'abc', '1998-01-09');
-insert into t1 values (1, 'abc', '1998-01-10');
-insert into t1 values (1, 'abc', '1998-01-11');
-insert into t1 values (1, 'abc', '1998-01-12');
-insert into t1 values (1, 'abc', '1998-01-13');
-insert into t1 values (1, 'abc', '1998-01-14');
-insert into t1 values (1, 'abc', '1998-01-15');
-insert into t1 values (1, 'abc', '1999-01-01');
-insert into t1 values (1, 'abc', '1999-01-02');
-insert into t1 values (1, 'abc', '1999-01-03');
-insert into t1 values (1, 'abc', '1999-01-04');
-insert into t1 values (1, 'abc', '1999-01-05');
-insert into t1 values (1, 'abc', '1999-01-06');
-insert into t1 values (1, 'abc', '1999-01-07');
-insert into t1 values (1, 'abc', '1999-01-08');
-insert into t1 values (1, 'abc', '1999-01-09');
-insert into t1 values (1, 'abc', '1999-01-10');
-insert into t1 values (1, 'abc', '1999-01-11');
-insert into t1 values (1, 'abc', '1999-01-12');
-insert into t1 values (1, 'abc', '1999-01-13');
-insert into t1 values (1, 'abc', '1999-01-14');
-insert into t1 values (1, 'abc', '1999-01-15');
-insert into t1 values (1, 'abc', '2000-01-01');
-insert into t1 values (1, 'abc', '2000-01-02');
-insert into t1 values (1, 'abc', '2000-01-03');
-insert into t1 values (1, 'abc', '2000-01-04');
-insert into t1 values (1, 'abc', '2000-01-05');
-insert into t1 values (1, 'abc', '2000-01-06');
-insert into t1 values (1, 'abc', '2000-01-07');
-insert into t1 values (1, 'abc', '2000-01-08');
-insert into t1 values (1, 'abc', '2000-01-09');
-insert into t1 values (1, 'abc', '2000-01-15');
-insert into t1 values (1, 'abc', '2000-01-11');
-insert into t1 values (1, 'abc', '2000-01-12');
-insert into t1 values (1, 'abc', '2000-01-13');
-insert into t1 values (1, 'abc', '2000-01-14');
-insert into t1 values (1, 'abc', '2000-01-15');
-insert into t1 values (1, 'abc', '2001-01-01');
-insert into t1 values (1, 'abc', '2001-01-02');
-insert into t1 values (1, 'abc', '2001-01-03');
-insert into t1 values (1, 'abc', '2001-01-04');
-insert into t1 values (1, 'abc', '2001-01-05');
-insert into t1 values (1, 'abc', '2001-01-06');
-insert into t1 values (1, 'abc', '2001-01-07');
-insert into t1 values (1, 'abc', '2001-01-08');
-insert into t1 values (1, 'abc', '2001-01-09');
-insert into t1 values (1, 'abc', '2001-01-15');
-insert into t1 values (1, 'abc', '2001-01-11');
-insert into t1 values (1, 'abc', '2001-01-12');
-insert into t1 values (1, 'abc', '2001-01-13');
-insert into t1 values (1, 'abc', '2001-01-14');
-insert into t1 values (1, 'abc', '2001-01-15');
-
-alter table t1
-partition by range (year(c))
-(partition p5 values less than (2000), partition p10 values less than (2010));
-
-alter table t1
-reorganize partition p5 into
-(partition p1 values less than (1996),
- partition p2 values less than (1997),
- partition p3 values less than (1998),
- partition p4 values less than (1999),
- partition p5 values less than (2000));
-
-drop table t1;
-
-#
-# New test cases for date based partitioning
-#
-CREATE TABLE t1 (a date)
-PARTITION BY RANGE (TO_DAYS(a))
-(PARTITION p3xx VALUES LESS THAN (TO_DAYS('2004-01-01')),
- PARTITION p401 VALUES LESS THAN (TO_DAYS('2004-02-01')),
- PARTITION p402 VALUES LESS THAN (TO_DAYS('2004-03-01')),
- PARTITION p403 VALUES LESS THAN (TO_DAYS('2004-04-01')),
- PARTITION p404 VALUES LESS THAN (TO_DAYS('2004-05-01')),
- PARTITION p405 VALUES LESS THAN (TO_DAYS('2004-06-01')),
- PARTITION p406 VALUES LESS THAN (TO_DAYS('2004-07-01')),
- PARTITION p407 VALUES LESS THAN (TO_DAYS('2004-08-01')),
- PARTITION p408 VALUES LESS THAN (TO_DAYS('2004-09-01')),
- PARTITION p409 VALUES LESS THAN (TO_DAYS('2004-10-01')),
- PARTITION p410 VALUES LESS THAN (TO_DAYS('2004-11-01')),
- PARTITION p411 VALUES LESS THAN (TO_DAYS('2004-12-01')),
- PARTITION p412 VALUES LESS THAN (TO_DAYS('2005-01-01')),
- PARTITION p501 VALUES LESS THAN (TO_DAYS('2005-02-01')),
- PARTITION p502 VALUES LESS THAN (TO_DAYS('2005-03-01')),
- PARTITION p503 VALUES LESS THAN (TO_DAYS('2005-04-01')),
- PARTITION p504 VALUES LESS THAN (TO_DAYS('2005-05-01')),
- PARTITION p505 VALUES LESS THAN (TO_DAYS('2005-06-01')),
- PARTITION p506 VALUES LESS THAN (TO_DAYS('2005-07-01')),
- PARTITION p507 VALUES LESS THAN (TO_DAYS('2005-08-01')),
- PARTITION p508 VALUES LESS THAN (TO_DAYS('2005-09-01')),
- PARTITION p509 VALUES LESS THAN (TO_DAYS('2005-10-01')),
- PARTITION p510 VALUES LESS THAN (TO_DAYS('2005-11-01')),
- PARTITION p511 VALUES LESS THAN (TO_DAYS('2005-12-01')),
- PARTITION p512 VALUES LESS THAN (TO_DAYS('2006-01-01')),
- PARTITION p601 VALUES LESS THAN (TO_DAYS('2006-02-01')),
- PARTITION p602 VALUES LESS THAN (TO_DAYS('2006-03-01')),
- PARTITION p603 VALUES LESS THAN (TO_DAYS('2006-04-01')),
- PARTITION p604 VALUES LESS THAN (TO_DAYS('2006-05-01')),
- PARTITION p605 VALUES LESS THAN (TO_DAYS('2006-06-01')),
- PARTITION p606 VALUES LESS THAN (TO_DAYS('2006-07-01')),
- PARTITION p607 VALUES LESS THAN (TO_DAYS('2006-08-01')));
-
-INSERT INTO t1 VALUES ('2003-01-13'),('2003-06-20'),('2003-08-30');
-INSERT INTO t1 VALUES ('2003-04-13'),('2003-07-20'),('2003-10-30');
-INSERT INTO t1 VALUES ('2003-05-13'),('2003-11-20'),('2003-12-30');
-
-INSERT INTO t1 VALUES ('2004-01-13'),('2004-01-20'),('2004-01-30');
-INSERT INTO t1 VALUES ('2004-02-13'),('2004-02-20'),('2004-02-28');
-INSERT INTO t1 VALUES ('2004-03-13'),('2004-03-20'),('2004-03-30');
-INSERT INTO t1 VALUES ('2004-04-13'),('2004-04-20'),('2004-04-30');
-INSERT INTO t1 VALUES ('2004-05-13'),('2004-05-20'),('2004-05-30');
-INSERT INTO t1 VALUES ('2004-06-13'),('2004-06-20'),('2004-06-30');
-INSERT INTO t1 VALUES ('2004-07-13'),('2004-07-20'),('2004-07-30');
-INSERT INTO t1 VALUES ('2004-08-13'),('2004-08-20'),('2004-08-30');
-INSERT INTO t1 VALUES ('2004-09-13'),('2004-09-20'),('2004-09-30');
-INSERT INTO t1 VALUES ('2004-10-13'),('2004-10-20'),('2004-10-30');
-INSERT INTO t1 VALUES ('2004-11-13'),('2004-11-20'),('2004-11-30');
-INSERT INTO t1 VALUES ('2004-12-13'),('2004-12-20'),('2004-12-30');
-
-INSERT INTO t1 VALUES ('2005-01-13'),('2005-01-20'),('2005-01-30');
-INSERT INTO t1 VALUES ('2005-02-13'),('2005-02-20'),('2005-02-28');
-INSERT INTO t1 VALUES ('2005-03-13'),('2005-03-20'),('2005-03-30');
-INSERT INTO t1 VALUES ('2005-04-13'),('2005-04-20'),('2005-04-30');
-INSERT INTO t1 VALUES ('2005-05-13'),('2005-05-20'),('2005-05-30');
-INSERT INTO t1 VALUES ('2005-06-13'),('2005-06-20'),('2005-06-30');
-INSERT INTO t1 VALUES ('2005-07-13'),('2005-07-20'),('2005-07-30');
-INSERT INTO t1 VALUES ('2005-08-13'),('2005-08-20'),('2005-08-30');
-INSERT INTO t1 VALUES ('2005-09-13'),('2005-09-20'),('2005-09-30');
-INSERT INTO t1 VALUES ('2005-10-13'),('2005-10-20'),('2005-10-30');
-INSERT INTO t1 VALUES ('2005-11-13'),('2005-11-20'),('2005-11-30');
-INSERT INTO t1 VALUES ('2005-12-13'),('2005-12-20'),('2005-12-30');
-
-INSERT INTO t1 VALUES ('2006-01-13'),('2006-01-20'),('2006-01-30');
-INSERT INTO t1 VALUES ('2006-02-13'),('2006-02-20'),('2006-02-28');
-INSERT INTO t1 VALUES ('2006-03-13'),('2006-03-20'),('2006-03-30');
-INSERT INTO t1 VALUES ('2006-04-13'),('2006-04-20'),('2006-04-30');
-INSERT INTO t1 VALUES ('2006-05-13'),('2006-05-20'),('2006-05-30');
-INSERT INTO t1 VALUES ('2006-06-13'),('2006-06-20'),('2006-06-30');
-INSERT INTO t1 VALUES ('2006-07-13'),('2006-07-20'),('2006-07-30');
-
-SELECT * FROM t1
-WHERE a >= '2004-07-01' AND a <= '2004-09-30';
-EXPLAIN PARTITIONS SELECT * FROM t1
-WHERE a >= '2004-07-01' AND a <= '2004-09-30';
-SELECT * from t1
-WHERE (a >= '2004-07-01' AND a <= '2004-09-30') OR
- (a >= '2005-07-01' AND a <= '2005-09-30');
-EXPLAIN PARTITIONS SELECT * from t1
-WHERE (a >= '2004-07-01' AND a <= '2004-09-30') OR
- (a >= '2005-07-01' AND a <= '2005-09-30');
-DROP TABLE t1;
-
-#
-# Bug 18198: Try with a couple of cases using VARCHAR fields in
-# partition function.
-#create table t1 (a varchar(20))
-#partition by range (ascii(a))
-#(partition p0 values less than (100),
-# partition p1 values less than maxvalue);
-
-#insert into t1 values ("12345678901234567890");
-#insert into t1 values ("A2345678901234567890");
-#insert into t1 values ("B2345678901234567890");
-#insert into t1 values ("1234567890123456789");
-#insert into t1 values ("1234567890123456");
-#select * from t1;
-#explain partitions select * from t1 where a = "12345678901234567890";
-#explain partitions select * from t1 where a = "12345678901234567890" OR
-# a = "A2345678901234567890" OR
-# a = "B2345678901234567890" OR
-# a = "C2345678901234567890";
-#explain partitions select * from t1 where a = "01234567890123456";
-#select * from t1 where a = "01234567890123456";
-#select * from t1 where a = "12345678901234567890" OR
-# a = "A2345678901234567890" OR
-# a = "B2345678901234567890" OR
-# a = "C2345678901234567890";
-#select * from t1 where a = "12345678901234567890";
-#drop table t1;
-
-
-#
-# BUG#30573: get wrong result with "group by" on PARTITIONed table
-#
-create table t1 (a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-CREATE TABLE t2 (
- defid int(10) unsigned NOT NULL,
- day int(10) unsigned NOT NULL,
- count int(10) unsigned NOT NULL,
- filler char(200),
- KEY (defid,day)
-)
-PARTITION BY RANGE (day) (
- PARTITION p7 VALUES LESS THAN (20070401) ,
- PARTITION p8 VALUES LESS THAN (20070501));
-
-insert into t2 select 20, 20070311, 1, 'filler' from t1 A, t1 B;
-insert into t2 select 20, 20070411, 1, 'filler' from t1 A, t1 B;
-insert into t2 values(52, 20070321, 123, 'filler') ;
-insert into t2 values(52, 20070322, 456, 'filler') ;
-
-select sum(count) from t2 ch where ch.defid in (50,52) and ch.day between 20070320 and 20070401 group by defid;
-drop table t1, t2;
-
-
---echo #
---echo # Bug#50939: Loose Index Scan unduly relies on engine to remember range
---echo # endpoints
---echo #
-CREATE TABLE t1 (
- a INT,
- b INT,
- KEY ( a, b )
-) PARTITION BY HASH (a) PARTITIONS 1;
-
-CREATE TABLE t2 (
- a INT,
- b INT,
- KEY ( a, b )
-);
-
-INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
-
-INSERT INTO t1 SELECT a + 5, b + 5 FROM t1;
-INSERT INTO t1 SELECT a + 10, b + 10 FROM t1;
-INSERT INTO t1 SELECT a + 20, b + 20 FROM t1;
-INSERT INTO t1 SELECT a + 40, b + 40 FROM t1;
-
-INSERT INTO t2 SELECT * FROM t1;
-
---echo # plans should be identical
-EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10,100) GROUP BY a;
-EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a;
-
-FLUSH status;
-SELECT a, MAX(b) FROM t1 WHERE a IN (10, 100) GROUP BY a;
---echo # Should be no more than 4 reads.
-SHOW status LIKE 'handler_read_key';
-
-FLUSH status;
-SELECT a, MAX(b) FROM t2 WHERE a IN (10, 100) GROUP BY a;
---echo # Should be no more than 4 reads.
-SHOW status LIKE 'handler_read_key';
-
-DROP TABLE t1, t2;
diff --git a/mysql-test/t/partition_rename_longfilename.test b/mysql-test/t/partition_rename_longfilename.test
deleted file mode 100644
index 51d9c583f56..00000000000
--- a/mysql-test/t/partition_rename_longfilename.test
+++ /dev/null
@@ -1,51 +0,0 @@
--- source include/not_windows.inc
--- source include/support_long_file_names.inc
--- source include/have_partition.inc
--- source include/not_embedded.inc
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-let $MYSQLD_DATADIR= `SELECT @@datadir`;
-
-#
-# Bug#30102: rename table does corrupt tables with partition files on failure
-# This test case renames the table such that the partition file name
-# is 255 chars long. Due the restriction of 260 char path name (including drive label)
-# this will fail in windows.
-# Other tests related to this bug can be found in partition_not_embedded.test
-#
-CREATE TABLE t1 (a INT)
-PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (6),
- PARTITION `p1....................` VALUES LESS THAN (9),
- PARTITION p2 VALUES LESS THAN MAXVALUE);
-# partition p1 is 't1#P#p1' + @002e * 20 = 107 characters + file ending
-# total path lenght of './test/t1#P#p1@002e@002e<...>@002e.MY[ID]' is 118 chars
---echo # List of files in database `test`, all original t1-files here
---list_files $MYSQLD_DATADIR/test t1*
-INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
---echo # Renaming to a file name where the first partition is 155 chars
---echo # and the second partition is 255 chars
-RENAME TABLE t1 TO `t2_............................end`;
-# 1234567890123456789012345678
-# t2_ + end
-# .MY[ID] or .frm
-# #P#p[012]
-# 28 * @002e
-# 6 + 4 + 5 + 28 * 5 = 155
---echo # List of files in database `test`, should not be any t1-files here
---list_files $MYSQLD_DATADIR/test t1*
---echo # List of files in database `test`, should be all t2-files here
---list_files $MYSQLD_DATADIR/test t2*
---sorted_result
-SELECT * FROM `t2_............................end`;
-RENAME TABLE `t2_............................end` to t1;
---echo # List of files in database `test`, should be all t1-files here
---list_files $MYSQLD_DATADIR/test t1*
---sorted_result
-SELECT * FROM t1;
-DROP TABLE t1;
---echo # Should not be any files left here
---list_files $MYSQLD_DATADIR/test t1*
---list_files $MYSQLD_DATADIR/test t2*
---echo # End of bug#30102 test.
diff --git a/mysql-test/t/partition_symlink.test b/mysql-test/t/partition_symlink.test
deleted file mode 100644
index 8f6e837299a..00000000000
--- a/mysql-test/t/partition_symlink.test
+++ /dev/null
@@ -1,222 +0,0 @@
-# Test that must have symlink. eg. using DATA/INDEX DIR
-# (DATA/INDEX DIR requires symlinks)
-# This test is only useful for MyISAM, since no other engine supports DATA DIR
--- source include/have_partition.inc
--- source include/have_symlink.inc
-# remove the not_windows line after fixing bug#33687
-# symlinks must also work for files, not only directories
-# as in --skip-symbolic-links
--- source include/not_windows.inc
--- disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP DATABASE IF EXISTS mysqltest2;
--- enable_warnings
-
---echo #
---echo # Test for WL#4445: EXCHANGE PARTITION
---echo #
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval CREATE TABLE t1 (a INT)
-ENGINE = MyISAM
-PARTITION BY LIST (a)
-(PARTITION p0 VALUES IN (0)
- DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
- INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp',
- PARTITION p1 VALUES IN (1)
- DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
- INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp',
- PARTITION p2 VALUES IN (2));
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval CREATE TABLE t2 (a INT)
-ENGINE = MyISAM
- DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
- INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp';
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-SHOW CREATE TABLE t1;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-SHOW CREATE TABLE t2;
-INSERT INTO t1 VALUES (0), (1), (2);
-ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
---error ER_TABLES_DIFFERENT_METADATA
-ALTER TABLE t1 EXCHANGE PARTITION p2 WITH TABLE t2;
-SELECT * FROM t1;
-SELECT * FROM t2;
-DROP TABLE t1, t2;
-# skipped because of bug#52354
-#CREATE TABLE t1 LIKE t2;
-#ALTER TABLE t1 PARTITION BY LIST (a)
-#(PARTITION p0 VALUES in (0));
-#--error ER_TABLES_DIFFERENT_METADATA
-#ALTER TABLE t1 EXCHANGE PARTITION p2 WITH TABLE t2;
-#SELECT * FROM t2;
-#DROP TABLE t1, t2;
-
-#
-# Bug 32091: Security breach via directory changes
-#
-# The below test shows that a pre-existing table mysqltest2.t1 cannot be
-# replaced by a user with no rights in 'mysqltest2'. The altered table
-# test.t1 will be altered (remove partitioning) into the test directory
-# and having its partitions removed from the mysqltest2 directory.
-# (the partitions data files are named <tablename>#P#<partname>.MYD
-# and will not collide with a non partitioned table's data files.)
-# NOTE: the privileges on files and directories are the same for all
-# database users in mysqld, though mysqld enforces privileges on
-# the database and table levels which in turn maps to directories and
-# files, but not the other way around (any db-user can use any
-# directory or file that the mysqld-process can use, via DATA/INDEX DIR)
-# this is the security flaw that was used in bug#32091 and bug#32111
-
--- echo # Creating two non colliding tables mysqltest2.t1 and test.t1
--- echo # test.t1 have partitions in mysqltest2-directory!
--- echo # user root:
- CREATE USER mysqltest_1@localhost;
- CREATE DATABASE mysqltest2;
- USE mysqltest2;
- CREATE TABLE t1 (a INT) ENGINE = MyISAM;
- INSERT INTO t1 VALUES (0);
-connect(con1,localhost,mysqltest_1,,);
--- echo # user mysqltest_1:
- USE test;
- -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
- eval CREATE TABLE t1 (a INT)
- ENGINE = MyISAM
- PARTITION BY LIST (a) (
- PARTITION p0 VALUES IN (0)
- DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
- INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp',
- PARTITION p1 VALUES IN (1)
- DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
- INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp',
- PARTITION p2 VALUES IN (2)
- );
- -- echo # without the patch for bug#32091 this would create
- -- echo # files mysqltest2/t1.MYD + .MYI and possible overwrite
- -- echo # the mysqltest2.t1 table (depending on bug#32111)
- -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
- ALTER TABLE t1 REMOVE PARTITIONING;
- INSERT INTO t1 VALUES (1);
- SELECT * FROM t1;
-connection default;
--- echo # user root:
- USE mysqltest2;
- FLUSH TABLES;
- -- echo # if the patch works, this should be different
- -- echo # and before the patch they were the same!
- SELECT * FROM t1;
- USE test;
- SELECT * FROM t1;
- DROP TABLE t1;
- DROP DATABASE mysqltest2;
-# The below test shows that a pre-existing partition can not be
-# destroyed by a new partition from another table.
-# (Remember that a table or partition that uses the DATA/INDEX DIR
-# is symlinked and thus has
-# 1. the real file in the DATA/INDEX DIR and
-# 2. a symlink in its default database directory pointing to
-# the real file.
-# So it is using/blocking 2 files in (in 2 different directories
--- echo # test that symlinks can not overwrite files when CREATE TABLE
--- echo # user root:
-
- CREATE DATABASE mysqltest2;
- USE mysqltest2;
- -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
- eval CREATE TABLE t1 (a INT)
- ENGINE = MyISAM
- PARTITION BY LIST (a) (
- PARTITION p0 VALUES IN (0)
- DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
- INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp',
- PARTITION p1 VALUES IN (1)
- DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
- INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp'
- );
-connection con1;
--- echo # user mysqltest_1:
- USE test;
- -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
- -- error 1,1
- eval CREATE TABLE t1 (a INT)
- ENGINE = MyISAM
- PARTITION BY LIST (a) (
- PARTITION p0 VALUES IN (0)
- DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
- INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp',
- PARTITION p1 VALUES IN (1)
- DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
- INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp'
- );
- -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
- -- error 1,1
- eval CREATE TABLE t1 (a INT)
- ENGINE = MyISAM
- PARTITION BY LIST (a) (
- PARTITION p0 VALUES IN (0)
- DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
- INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp',
- PARTITION p1 VALUES IN (1)
- DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp'
- INDEX DIRECTORY '$MYSQLTEST_VARDIR/tmp'
- );
-connection default;
--- echo # user root (cleanup):
- DROP DATABASE mysqltest2;
- USE test;
- DROP USER mysqltest_1@localhost;
- disconnect con1;
-
-#
-# Bug #24633 SQL MODE "NO_DIR_IN_CREATE" does not work with partitioned tables
-#
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval create table t2 (i int )
-ENGINE = MyISAM
-partition by range (i)
-(
- partition p01 values less than (1000)
- data directory="$MYSQLTEST_VARDIR/tmp"
- index directory="$MYSQLTEST_VARDIR/tmp"
-);
-
-set @org_mode=@@sql_mode;
-set @@sql_mode='NO_DIR_IN_CREATE';
-select @@sql_mode;
-create table t1 (i int )
-ENGINE = MyISAM
-partition by range (i)
-(
- partition p01 values less than (1000)
- data directory='/not/existing'
- index directory='/not/existing'
-);
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-show create table t2;
-DROP TABLE t1, t2;
-set @@sql_mode=@org_mode;
-
-#
-# Bug 21350: Data Directory problems
-#
-# Added ER_WRONG_TABLE_NAME and reported bug#39045
--- error ER_WRONG_ARGUMENTS, ER_WRONG_TABLE_NAME
-create table t1 (a int)
-ENGINE = MyISAM
-partition by key (a)
-(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
-
-#
-# Insert a test that manages to create the first partition and fails with
-# the second, ensure that we clean up afterwards in a proper manner.
-#
-# Added ER_WRONG_TABLE_NAME and reported bug#39045
---error ER_WRONG_ARGUMENTS, ER_WRONG_TABLE_NAME
-create table t1 (a int)
-ENGINE = MyISAM
-partition by key (a)
-(partition p0,
- partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data');
diff --git a/mysql-test/t/partition_sync.test b/mysql-test/t/partition_sync.test
deleted file mode 100644
index fd704f35534..00000000000
--- a/mysql-test/t/partition_sync.test
+++ /dev/null
@@ -1,83 +0,0 @@
---source include/have_partition.inc
---source include/have_debug.inc
-# Save the initial number of concurrent sessions.
---source include/count_sessions.inc
-
---echo #
---echo # Bug #43867 ALTER TABLE on a partitioned table
---echo # causes unnecessary deadlocks
---echo #
-
-CREATE TABLE t1 (a int) PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (1),
- PARTITION p1 VALUES LESS THAN (2));
-
-INSERT INTO t1 VALUES (0),(1);
-
-connect(con1,localhost,root);
-
-connection con1;
-BEGIN;
-SELECT * FROM t1;
-
-connection default;
---error ER_DROP_PARTITION_NON_EXISTENT
-ALTER TABLE t1 DROP PARTITION p3;
-
-connection con1;
---echo # This failed with deadlock and should not do so.
-SELECT * FROM t1;
-
-connection default;
-disconnect con1;
-DROP TABLE t1;
-
-
---echo #
---echo # Bug #46654 False deadlock on concurrent DML/DDL
---echo # with partitions, inconsistent behavior
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS tbl_with_partitions;
---enable_warnings
-
-CREATE TABLE tbl_with_partitions ( i INT )
- PARTITION BY HASH(i);
-INSERT INTO tbl_with_partitions VALUES (1);
-
-connect(con2,localhost,root);
-connect(con3,localhost,root);
-
-connection con3;
-LOCK TABLE tbl_with_partitions READ;
-
---echo # Access table with disabled autocommit
-connection default;
-SET AUTOCOMMIT = 0;
-SELECT * FROM tbl_with_partitions;
-
---echo # Alter table, abort after prepare
-connection con2;
-set session debug_dbug="+d,abort_copy_table";
---error ER_LOCK_WAIT_TIMEOUT
-ALTER TABLE tbl_with_partitions ADD COLUMN f INT;
-
---echo # Try accessing the table after Alter aborted.
---echo # This used to give ER_LOCK_DEADLOCK.
-connection default;
-SELECT * FROM tbl_with_partitions;
-
-connection con3;
-UNLOCK TABLES;
-
---echo # Cleanup
-connection default;
-disconnect con2;
-disconnect con3;
-DROP TABLE tbl_with_partitions;
-
-
-# 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
diff --git a/mysql-test/t/partition_truncate.test b/mysql-test/t/partition_truncate.test
deleted file mode 100644
index 62ed548808f..00000000000
--- a/mysql-test/t/partition_truncate.test
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# Simple tests to verify truncate partition syntax
-#
---source include/have_partition.inc
---disable_warnings
-drop table if exists t1, t2, t3, t4;
---enable_warnings
-
-create table t1 (a int)
-partition by list (a)
-(partition p1 values in (0));
---error ER_WRONG_PARTITION_NAME
-alter table t1 truncate partition p1,p1;
---error ER_UNKNOWN_PARTITION
-alter table t1 truncate partition p0;
-drop table t1;
-
-create table t1 (a int)
-partition by list (a)
-subpartition by hash (a)
-subpartitions 1
-(partition p1 values in (1)
- (subpartition sp1));
---error ER_WRONG_PARTITION_NAME
-alter table t1 truncate partition sp1;
-drop table t1;
-
-create table t1 (a int);
-insert into t1 values (1), (3), (8);
---error ER_PARTITION_MGMT_ON_NONPARTITIONED
-alter table t1 truncate partition p0;
-select count(*) from t1;
-drop table t1;
diff --git a/mysql-test/t/partition_utf8.test b/mysql-test/t/partition_utf8.test
deleted file mode 100644
index d3ad7ba671e..00000000000
--- a/mysql-test/t/partition_utf8.test
+++ /dev/null
@@ -1,42 +0,0 @@
-# Tests for Column list which requires utf8 output
---source include/have_partition.inc
-set names utf8;
-create table t1 (a varchar(2) character set cp1250)
-partition by list columns (a)
-( partition p0 values in (0x81));
-show create table t1;
-drop table t1;
-create table t1 (a varchar(2) character set cp1250)
-partition by list columns (a)
-( partition p0 values in (0x80));
-show create table t1;
-drop table t1;
-
-#
-# BUG#48164, too long partition fields causes crash
-#
---error ER_PARTITION_FIELDS_TOO_LONG
-create table t1 (a varchar(1500), b varchar(1570))
-partition by list columns(a,b)
-( partition p0 values in (('a','b')));
-
-create table t1 (a varchar(1023) character set utf8 collate utf8_spanish2_ci)
-partition by range columns(a)
-( partition p0 values less than ('CZ'),
- partition p1 values less than ('CH'),
- partition p2 values less than ('D'));
-insert into t1 values ('czz'),('chi'),('ci'),('cg');
-select * from t1 where a between 'cg' AND 'ci';
-drop table t1;
-
-#
-# BUG#48163, Dagger in UCS2 not working as partition value
-#
-create table t1 (a varchar(2) character set ucs2)
-partition by list columns (a)
-(partition p0 values in (0x2020),
- partition p1 values in (''));
-show create table t1;
-insert into t1 values ('');
-insert into t1 values (_ucs2 0x2020);
-drop table t1;
diff --git a/mysql-test/t/partition_windows.test b/mysql-test/t/partition_windows.test
deleted file mode 100644
index d42a7383c99..00000000000
--- a/mysql-test/t/partition_windows.test
+++ /dev/null
@@ -1,40 +0,0 @@
-# Windows-specific partition tests
---source include/windows.inc
---source include/have_partition.inc
-
-# These tests contain Windows specific directory/file format.
-
-#
-# Bug 25141: Crash Server on Partitioning command
-#
-# Bug#30459: Partitioning across disks failing on Windows
-# updated this test, since symlinked files are not supported on Windows
-# (not the same as symlinked directories that have a special hack
-# on windows). This test is not dependent on have_symlink.
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (
- c1 int(10) unsigned NOT NULL AUTO_INCREMENT,
- c2 varchar(30) NOT NULL,
- c3 smallint(5) unsigned DEFAULT NULL,
- PRIMARY KEY (c1)
-) ENGINE = MYISAM
-PARTITION BY HASH(c1)(
- PARTITION p0
- DATA DIRECTORY = 'C:/mysqltest/p0Data'
- INDEX DIRECTORY = 'D:/mysqltest/p0Index',
- PARTITION p1,
- PARTITION p2
- DATA DIRECTORY = 'E:/mysqltest/p2Data'
- INDEX DIRECTORY = 'F:/mysqltest/p2Index'
-);
-INSERT INTO t1 VALUES (NULL, "first", 1);
-INSERT INTO t1 VALUES (NULL, "second", 2);
-INSERT INTO t1 VALUES (NULL, "third", 3);
-ALTER TABLE t1 ADD PARTITION (PARTITION p3 DATA DIRECTORY = 'G:/mysqltest/p3Data' INDEX DIRECTORY = 'H:/mysqltest/p3Index');
-INSERT INTO t1 VALUES (NULL, "last", 4);
-DROP TABLE t1;
-
diff --git a/mysql-test/t/perror-win.test b/mysql-test/t/perror-win.test
deleted file mode 100644
index cc09b8527be..00000000000
--- a/mysql-test/t/perror-win.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# Windows-specific tests
---source include/windows.inc
---require r/have_perror.require
-disable_query_log;
-eval select LENGTH("$MY_PERROR") > 0 as "have_perror";
-enable_query_log;
-
-
---exec $MY_PERROR 150 2>&1
---exec $MY_PERROR 23 2>&1
---exec $MY_PERROR 1062 2>&1
---error 1
---exec $MY_PERROR 30000 2>&1
-
diff --git a/mysql-test/t/perror.test b/mysql-test/t/perror.test
deleted file mode 100644
index 69f1cb3257e..00000000000
--- a/mysql-test/t/perror.test
+++ /dev/null
@@ -1,34 +0,0 @@
---source include/not_windows.inc
-#
-# Check if the variable MY_PERROR is set
-#
---require r/have_perror.require
-disable_query_log;
-eval select LENGTH("$MY_PERROR") > 0 as "have_perror";
-enable_query_log;
-
---exec $MY_PERROR 150 > /dev/null
---exec $MY_PERROR --silent 120 > /dev/null
-
-#
-# Bug#16561 Unknown ERROR msg "ERROR 1186 (HY000): Binlog closed" by perror
-#
-
-# Test with error code 10000 as it's a common "unknown error"
-# As there is no error code defined for 10000, expect error
---error 1
---exec $MY_PERROR 10000 2>&1
-
-#
-# Bug#10143 (Perror not showing error description)
-#
-
-# test reported case
---exec $MY_PERROR 1062 2>&1
-
-# test errors that contain characters to escape in the text.
---exec $MY_PERROR 1408 2>&1
---exec $MY_PERROR 1459 2>&1
---exec $MY_PERROR 1461 2>&1
-
-
diff --git a/mysql-test/t/plugin.test b/mysql-test/t/plugin.test
deleted file mode 100644
index 68c4d5afd64..00000000000
--- a/mysql-test/t/plugin.test
+++ /dev/null
@@ -1,267 +0,0 @@
---source include/not_windows_embedded.inc
---source include/have_example_plugin.inc
-
---error ER_UNKNOWN_STORAGE_ENGINE
-CREATE TABLE t1(a int) ENGINE=EXAMPLE;
-
-INSTALL PLUGIN example SONAME 'ha_example';
---replace_regex /\.dll/.so/
---error ER_PLUGIN_INSTALLED
-INSTALL PLUGIN EXAMPLE SONAME 'ha_example';
-
-UNINSTALL PLUGIN example;
-
-INSTALL SONAME 'ha_example';
---replace_column 5 #
---replace_regex /\.dll/.so/
---query_vertical select * from information_schema.plugins where plugin_library like 'ha_example%'
-
-CREATE TABLE t1 (a int) ENGINE=EXAMPLE;
-CREATE TABLE t2 (a int) ENGINE=EXAMPLE;
-FLUSH TABLES;
-
-# Let's do some advanced ops with the example engine :)
-SELECT * FROM t1;
-
-# a couple of tests for variables
-set global example_ulong_var=500;
-set global example_enum_var= e1;
-set session example_int_var= -1;
-show status like 'example%';
-show variables like 'example%';
-
-select @@session.example_int_var;
-
-UNINSTALL SONAME 'ha_example';
-
-# the engine is NOT uninstalled yet,
-# because the table `t1` is open, sitting in the table defintion cache
-
---replace_column 5 #
---replace_regex /\.dll/.so/
---query_vertical select * from information_schema.plugins where plugin_library like 'ha_example%'
-DROP TABLE t1;
-
-# now the engine IS unloaded
-# and the table `t2` belongs to an unknown engine
-
---replace_column 5 #
---replace_regex /\.dll/.so/
---query_vertical select * from information_schema.plugins where plugin_library like 'ha_example%'
---error ER_UNKNOWN_STORAGE_ENGINE
-SELECT * FROM t2;
-DROP TABLE t2;
-
-
---error 1305
-UNINSTALL PLUGIN EXAMPLE;
-
---error 1305
-UNINSTALL PLUGIN non_exist;
-
-#
-# MDEV-3985 crash: uninstall soname 'a'
-#
---replace_regex /\.dll/.so/
---error 1305
-UNINSTALL SONAME 'non_exist';
-
---echo #
---echo # Bug#32034: check_func_enum() does not check correct values but set it
---echo # to impossible int val
---echo #
-INSTALL PLUGIN example SONAME 'ha_example';
-
-SET GLOBAL example_enum_var= e1;
-SET GLOBAL example_enum_var= e2;
---error 1231
-SET GLOBAL example_enum_var= impossible;
-
-UNINSTALL PLUGIN example;
-
-
-
-#
-# Bug #32757 hang with sql_mode set when setting some global variables
-#
-INSTALL PLUGIN example SONAME 'ha_example';
-
-select @@session.sql_mode into @old_sql_mode;
-
-# first, try normal sql_mode (no error, send OK)
-set session sql_mode='';
-set global example_ulong_var=500;
-select @@global.example_ulong_var;
-# overflow -- correct value, but throw warning
-set global example_ulong_var=1111;
-select @@global.example_ulong_var;
-
-# now, try STRICT (error occurrs, no message is sent, so send default)
-set session sql_mode='STRICT_ALL_TABLES';
-set global example_ulong_var=500;
-select @@global.example_ulong_var;
-# overflow -- throw warning, do NOT change value
---error ER_WRONG_VALUE_FOR_VAR
-set global example_ulong_var=1111;
-select @@global.example_ulong_var;
-
-set session sql_mode=@old_sql_mode;
-
-# finally, show that conditions that already raised an error are not
-# adversely affected (error was already sent, do nothing)
---error ER_WRONG_VALUE_FOR_VAR
-set session old=bla;
-
-###############################################################
-# engine-specific clauses in the CREATE TABLE:
-
---echo #legal values
-CREATE TABLE t1 ( a int complex='c,f,f,f' ) ENGINE=example ULL=10000 STR='dskj' one_or_two='one' YESNO=0;
-show create table t1;
-drop table t1;
-
-SET @OLD_SQL_MODE=@@SQL_MODE;
-SET SQL_MODE='IGNORE_BAD_TABLE_OPTIONS';
-
---echo #illegal value fixed
-CREATE TABLE t1 (a int, b int) ENGINE=example ULL=10000000000000000000 one_or_two='ttt' YESNO=SSS;
-show create table t1;
-
---echo #alter table
-alter table t1 ULL=10000000;
-show create table t1;
-alter table t1 change a a int complex='c,c,c';
-show create table t1;
-alter table t1 one_or_two=two;
-show create table t1;
-drop table t1;
-
---echo #illegal value error
-SET SQL_MODE='';
---error ER_BAD_OPTION_VALUE
-CREATE TABLE t1 (a int) ENGINE=example ULL=10000000000000000000 one_or_two='ttt' YESNO=SSS;
-
---error ER_PARSE_ERROR
-CREATE TABLE t1 (a int) ENGINE=example ULL=10.00;
-
---error ER_PARSE_ERROR
-CREATE TABLE t1 (a int) ENGINE=example ULL=1e2;
-
-CREATE TABLE t1 (a int) ENGINE=example ULL=0x1234;
-SHOW CREATE TABLE t1;
-SET example_varopt_default=33; # does not affect varopt of t1
-
-select create_options from information_schema.tables where table_schema='test' and table_name='t1';
-
-ALTER TABLE t1 ULL=DEFAULT;
-SHOW CREATE TABLE t1;
-
-DROP TABLE t1;
-
-create table t1 (a int) engine=example; # varopt is 10
-show create table t1;
-drop table t1;
-
-create table t1 (a int) engine=example varopt=15;
-show create table t1;
-alter table t1 varopt=default;
-show create table t1;
-drop table t1;
-
-SET @@SQL_MODE=@OLD_SQL_MODE;
-
-#
-# The only preparable statement above was CREATE TABLE.
-# We need to prepare another statement here to force the
-# previous one to be deallocated (mysqltest reuses the same handle)
-# and to unlock all thread-local plugin locks. Otherwise the plugin won't
-# uninstall.
-#
-select 1;
-UNINSTALL PLUGIN example;
-
---echo #
---echo # Bug #16194302 SUPPORT FOR FLOATING-POINT SYSTEM
---echo # VARIABLES USING THE PLUGIN INTERFACE.
---echo #
-
---replace_regex /\.dll/.so/
-eval INSTALL PLUGIN example SONAME 'ha_example';
-
-SET GLOBAL example_double_var = -0.1;
-SELECT @@GLOBAL.example_double_var;
-
-SET GLOBAL example_double_var = 0.000001;
-SELECT @@GLOBAL.example_double_var;
-
-SET GLOBAL example_double_var = 0.4;
-SELECT @@GLOBAL.example_double_var;
-
-SET GLOBAL example_double_var = 123.456789;
-SELECT @@GLOBAL.example_double_var;
-
-SET GLOBAL example_double_var = 500;
-SELECT @@GLOBAL.example_double_var;
-
-SET GLOBAL example_double_var = 999.999999;
-SELECT @@GLOBAL.example_double_var;
-
-SET GLOBAL example_double_var = 1000.51;
-SELECT @@GLOBAL.example_double_var;
-
-SET SESSION example_double_thdvar = -0.1;
-SELECT @@SESSION.example_double_thdvar;
-
-SET SESSION example_double_thdvar = 0.000001;
-SELECT @@SESSION.example_double_thdvar;
-
-SET SESSION example_double_thdvar = 0.4;
-SELECT @@SESSION.example_double_thdvar;
-
-SET SESSION example_double_thdvar = 123.456789;
-SELECT @@SESSION.example_double_thdvar;
-
-SET SESSION example_double_thdvar = 500;
-SELECT @@SESSION.example_double_thdvar;
-
-SET SESSION example_double_thdvar = 999.999999;
-SELECT @@SESSION.example_double_thdvar;
-
-SET SESSION example_double_thdvar = 1000.51;
-SELECT @@SESSION.example_double_thdvar;
-
-UNINSTALL PLUGIN example;
-
-#
-# MDEV-4573 UNINSTALL PLUGIN misleading error message for non-dynamic plugins
-#
---error ER_PLUGIN_DELETE_BUILTIN
-UNINSTALL PLUGIN MyISAM;
-
-#
-# MDEV-4529 Assertion `tmp->state == 4' fails on mix of INSTALL SONAME / UNINSTALL PLUGIN
-#
-
-select plugin_name from information_schema.plugins where plugin_library like 'ha_example%';
-install soname 'ha_example';
-select plugin_name from information_schema.plugins where plugin_library like 'ha_example%';
-uninstall plugin example;
-select plugin_name from information_schema.plugins where plugin_library like 'ha_example%';
-install soname 'ha_example';
-select plugin_name from information_schema.plugins where plugin_library like 'ha_example%';
-uninstall soname 'ha_example';
-select plugin_name from information_schema.plugins where plugin_library like 'ha_example%';
-
-
---echo #
---echo # MDEV-5309 - RENAME TABLE does not check for existence of the table's
---echo # engine
---echo #
-INSTALL PLUGIN example SONAME 'ha_example';
-CREATE TABLE t1(a INT) ENGINE=EXAMPLE;
-SELECT * FROM t1;
-FLUSH TABLES;
-UNINSTALL PLUGIN example;
---error ER_NO_SUCH_TABLE
-RENAME TABLE t1 TO t2;
-DROP TABLE t1;
diff --git a/mysql-test/t/plugin_auth.test b/mysql-test/t/plugin_auth.test
deleted file mode 100644
index c3c18b7e427..00000000000
--- a/mysql-test/t/plugin_auth.test
+++ /dev/null
@@ -1,589 +0,0 @@
---source include/have_plugin_auth.inc
---source include/not_embedded.inc
---source include/mysql_upgrade_preparation.inc
---source include/have_innodb.inc
-
-SET GLOBAL SQL_MODE="";
-SET LOCAL SQL_MODE="";
-
-query_vertical SELECT PLUGIN_STATUS, PLUGIN_TYPE, PLUGIN_DESCRIPTION
- FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME='test_plugin_server';
-
-CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
-CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
-
-SELECT plugin,authentication_string FROM mysql.user WHERE User='plug';
-
---echo ## test plugin auth
---disable_query_log
---error ER_ACCESS_DENIED_ERROR : this should fail : no grant
-connect(plug_con,localhost,plug,plug_dest);
---enable_query_log
-
-GRANT PROXY ON plug_dest TO plug;
---echo test proxies_priv columns
---replace_column 1 xx 7 xx
-SELECT * FROM mysql.proxies_priv WHERE user !='root';
---echo test mysql.proxies_priv;
-SHOW CREATE TABLE mysql.proxies_priv;
-
-connect(plug_con,localhost,plug,plug_dest);
-
-connection plug_con;
-select USER(),CURRENT_USER();
-
---echo ## test SET PASSWORD
-#--error ER_SET_PASSWORD_AUTH_PLUGIN
-SET PASSWORD = PASSWORD('plug_dest');
-
-connection default;
-disconnect plug_con;
-
---echo ## test bad credentials
---disable_query_log
---error ER_ACCESS_DENIED_ERROR
-connect(plug_con,localhost,plug,bad_credentials);
---enable_query_log
-
---echo ## test bad default plugin : should get CR_AUTH_PLUGIN_CANNOT_LOAD
---disable_result_log
---disable_query_log
---error 2059
-connect(plug_con_wrongp,localhost,plug,plug_dest,,,,,wrong_plugin_name);
---enable_query_log
---enable_result_log
-
---echo ## test correct default plugin
-connect(plug_con_rightp,localhost,plug,plug_dest,,,,,auth_test_plugin);
-connection plug_con_rightp;
-select USER(),CURRENT_USER();
-connection default;
-disconnect plug_con_rightp;
-
---echo ## test no_auto_create_user sql mode with plugin users
-SET @@sql_mode=no_auto_create_user;
-GRANT INSERT ON TEST.* TO grant_user IDENTIFIED WITH 'test_plugin_server';
-SET @@sql_mode="";
-DROP USER grant_user;
-
---echo ## test utf-8 user name
-CREATE USER `Ÿ` IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
-
-GRANT PROXY ON plug_dest TO `Ÿ`;
-
-connect(non_ascii,localhost,Ÿ,plug_dest);
-connection non_ascii;
-select USER(),CURRENT_USER();
-
-connection default;
-disconnect non_ascii;
-DROP USER `Ÿ`;
-
---echo ## test GRANT ... IDENTIFIED WITH/BY ...
-
-CREATE DATABASE test_grant_db;
-
---echo # create new user via GRANT WITH
-GRANT ALL PRIVILEGES ON test_grant_db.* TO new_grant_user
- IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
-
-GRANT PROXY ON plug_dest TO new_grant_user;
-
-connect(plug_con_grant,localhost,new_grant_user,plug_dest);
-connection plug_con_grant;
-select USER(),CURRENT_USER();
-USE test_grant_db;
-CREATE TABLE t1 (a INT);
-DROP TABLE t1;
-connection default;
-disconnect plug_con_grant;
-REVOKE ALL PRIVILEGES ON test_grant_db.* FROM new_grant_user;
-
---echo # try re-create existing user via GRANT IDENTIFIED BY
-GRANT ALL PRIVILEGES ON test_grant_db.* TO new_grant_user
- IDENTIFIED BY 'new_password';
-
---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
---error ER_ACCESS_DENIED_ERROR
-connect(plug_con_grant_deny,localhost,new_grant_user,plug_dest);
-
-connect(plug_con_grant,localhost,new_grant_user,new_password);
-connection plug_con_grant;
-select USER(),CURRENT_USER();
-USE test_grant_db;
-CREATE TABLE t1 (a INT);
-DROP TABLE t1;
-connection default;
-disconnect plug_con_grant;
-
-DROP USER new_grant_user;
-
---echo # try re-create existing user via GRANT IDENTIFIED WITH
-
-GRANT ALL PRIVILEGES ON test_grant_db.* TO plug
- IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
-
-GRANT ALL PRIVILEGES ON test_grant_db.* TO plug_dest
- IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
-
---error ER_PARSE_ERROR
-REVOKE SELECT on test_grant_db.* FROM joro
- INDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
-
---error ER_PARSE_ERROR
-REVOKE SELECT on test_grant_db.* FROM joro
- INDENTIFIED BY 'plug_dest_passwd';
-
---error ER_PARSE_ERROR
-REVOKE SELECT on test_grant_db.* FROM joro
- INDENTIFIED BY PASSWORD 'plug_dest_passwd';
-
-DROP DATABASE test_grant_db;
-
---echo ## GRANT PROXY tests
-
-CREATE USER grant_plug IDENTIFIED WITH 'test_plugin_server'
- AS 'grant_plug_dest';
-CREATE USER grant_plug_dest IDENTIFIED BY 'grant_plug_dest_passwd';
-CREATE USER grant_plug_dest2 IDENTIFIED BY 'grant_plug_dest_passwd2';
-
---echo # ALL PRIVILEGES doesn't include PROXY
-GRANT ALL PRIVILEGES ON *.* TO grant_plug;
---disable_query_log
---error ER_ACCESS_DENIED_ERROR : this should fail : no grant
-connect(grant_plug_con,localhost,grant_plug,grant_plug_dest);
---enable_query_log
-
---error ER_PARSE_ERROR : this should fail : can't combine PROXY
-GRANT ALL PRIVILEGES,PROXY ON grant_plug_dest TO grant_plug;
-
---echo this should fail : can't combine PROXY
---error ER_PARSE_ERROR
-GRANT ALL SELECT,PROXY ON grant_plug_dest TO grant_plug;
-
---echo # this should fail : no such grant
---error ER_NONEXISTING_GRANT
-REVOKE PROXY ON grant_plug_dest FROM grant_plug;
-
-connect(grant_plug_dest_con,localhost,grant_plug_dest,grant_plug_dest_passwd);
-connection grant_plug_dest_con;
---echo in grant_plug_dest_con
-
---echo ## testing what an ordinary user can grant
---echo this should fail : no rights to grant all
---error ER_ACCESS_DENIED_NO_PASSWORD_ERROR
-GRANT PROXY ON ''@'%%' TO grant_plug;
-
---echo this should fail : not the same user
---error ER_ACCESS_DENIED_NO_PASSWORD_ERROR
-GRANT PROXY ON grant_plug TO grant_plug_dest;
-
-# Security context in THD contains two pairs of (user,host)
-# 1. (user,host) pair referring to inbound connection
-# 2. (priv_user,priv_host) pair obtained from mysql.user table after doing
-# authnetication of incoming connection.
-# Granting/revoking proxy privileges, privileges should be checked wrt
-# (priv_user, priv_host) tuple that is obtained from mysql.user table
-# Following is a valid grant because effective user of connection is
-# grant_plug_dest@% and statement is trying to grant proxy on the same
-# user.
---echo This is a valid grant
-GRANT PROXY ON grant_plug_dest TO grant_plug;
-REVOKE PROXY ON grant_plug_dest FROM grant_plug;
-
---echo this should work : same user
-GRANT PROXY ON grant_plug_dest TO grant_plug_dest2;
-REVOKE PROXY ON grant_plug_dest FROM grant_plug_dest2;
-
-# grant_plug_dest@localhost is not the same as grant_plug_dest@%
-# so following grant/revoke should fail
---echo this should fail : not the same user
---error ER_ACCESS_DENIED_NO_PASSWORD_ERROR
-GRANT PROXY ON grant_plug_dest@localhost TO grant_plug WITH GRANT OPTION;
---echo this should fail : not the same user
---error ER_ACCESS_DENIED_NO_PASSWORD_ERROR
-REVOKE PROXY ON grant_plug_dest@localhost FROM grant_plug;
-
---echo this should fail : can't create users
---error ER_CANT_CREATE_USER_WITH_GRANT
-GRANT PROXY ON grant_plug_dest TO grant_plug@localhost;
-
-connection default;
---echo in default connection
-disconnect grant_plug_dest_con;
-
---echo # test what root can grant
-
---echo should work : root has PROXY to all users
-GRANT PROXY ON ''@'%%' TO grant_plug;
-REVOKE PROXY ON ''@'%%' FROM grant_plug;
-
---echo should work : root has PROXY to all users
-GRANT PROXY ON ''@'%%' TO proxy_admin IDENTIFIED BY 'test'
- WITH GRANT OPTION;
-
---echo need USAGE : PROXY doesn't contain it.
-GRANT USAGE on *.* TO proxy_admin;
-
-connect (proxy_admin_con,localhost,proxy_admin,test);
-connection proxy_admin_con;
---echo in proxy_admin_con;
-
---echo should work : proxy_admin has proxy to ''@'%%'
-GRANT PROXY ON future_user TO grant_plug;
-
-connection default;
---echo in default connection
-disconnect proxy_admin_con;
-
-SHOW GRANTS FOR grant_plug;
-REVOKE PROXY ON future_user FROM grant_plug;
-SHOW GRANTS FOR grant_plug;
-
---echo ## testing drop user
-CREATE USER test_drop@localhost;
-GRANT PROXY ON future_user TO test_drop@localhost;
-SHOW GRANTS FOR test_drop@localhost;
-DROP USER test_drop@localhost;
-SELECT * FROM mysql.proxies_priv WHERE Host = 'test_drop' AND User = 'localhost';
-
-DROP USER proxy_admin;
-
-DROP USER grant_plug,grant_plug_dest,grant_plug_dest2;
-
---echo ## END GRANT PROXY tests
-
---echo ## cleanup
-DROP USER plug;
-DROP USER plug_dest;
-
---echo ## @@proxy_user tests
-CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
-CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
-GRANT PROXY ON plug_dest TO plug;
-
-SELECT USER(),CURRENT_USER(),@@LOCAL.proxy_user;
-
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@GLOBAL.proxy_user;
-SELECT @@LOCAL.proxy_user;
-
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET GLOBAL proxy_user = 'test';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET LOCAL proxy_user = 'test';
-SELECT @@LOCAL.proxy_user;
-
-connect(plug_con,localhost,plug,plug_dest);
-connection plug_con;
---echo # in connection plug_con
-SELECT @@LOCAL.proxy_user;
-connection default;
---echo # in connection default
-disconnect plug_con;
-
---echo ## cleanup
-DROP USER plug;
-DROP USER plug_dest;
---echo ## END @@proxy_user tests
-
---echo ## @@external_user tests
-CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
-CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
-GRANT PROXY ON plug_dest TO plug;
-SELECT USER(),CURRENT_USER(),@@LOCAL.external_user;
-
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@GLOBAL.external_user;
-SELECT @@LOCAL.external_user;
-
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET GLOBAL external_user = 'test';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET LOCAL external_user = 'test';
-SELECT @@LOCAL.external_user;
-
-connect(plug_con,localhost,plug,plug_dest);
-connection plug_con;
---echo # in connection plug_con
-SELECT @@LOCAL.external_user;
-connection default;
---echo # in connection default
-disconnect plug_con;
-
---echo ## cleanup
-DROP USER plug;
-DROP USER plug_dest;
---echo ## END @@external_user tests
-
---echo #
---echo # Bug #56798 : Wrong credentials assigned when using a proxy user.
---echo #
-
-GRANT ALL PRIVILEGES ON *.* TO power_user;
-GRANT USAGE ON anonymous_db.* TO ''@'%%'
- IDENTIFIED WITH 'test_plugin_server' AS 'power_user';
-GRANT PROXY ON power_user TO ''@'%%';
-CREATE DATABASE confidential_db;
-
-connect(plug_con,localhost, test_login_user, power_user, confidential_db);
-SELECT user(),current_user(),@@proxy_user;
-
-connection default;
-disconnect plug_con;
-
-DROP USER power_user;
-DROP USER ''@'%%';
-DROP DATABASE confidential_db;
-
---echo # Test case #2 (crash with double grant proxy)
-
-CREATE USER ''@'%%' IDENTIFIED WITH 'test_plugin_server' AS 'standard_user';
-CREATE USER standard_user;
-CREATE DATABASE shared;
-GRANT ALL PRIVILEGES ON shared.* TO standard_user;
-GRANT PROXY ON standard_user TO ''@'%%';
---echo #should not crash
-GRANT PROXY ON standard_user TO ''@'%%';
-
-DROP USER ''@'%%';
-DROP USER standard_user;
-DROP DATABASE shared;
-
---echo #
---echo # Bug #57551 : Live upgrade fails between 5.1.52 -> 5.5.7-rc
---echo #
-
-CALL mtr.add_suppression("Missing system table mysql.proxies_priv.");
-
-DROP TABLE mysql.proxies_priv;
-
---echo # Must come back with mysql.proxies_priv absent.
---source include/restart_mysqld.inc
-
---error ER_NO_SUCH_TABLE
-SELECT * FROM mysql.proxies_priv;
-
-CREATE USER u1@localhost;
-GRANT ALL PRIVILEGES ON *.* TO u1@localhost;
-REVOKE ALL PRIVILEGES ON *.* FROM u1@localhost;
-GRANT ALL PRIVILEGES ON *.* TO u1@localhost;
-
-CREATE USER u2@localhost;
-GRANT ALL PRIVILEGES ON *.* TO u2@localhost;
-
---echo # access denied because of no privileges to root
---error ER_ACCESS_DENIED_NO_PASSWORD_ERROR
-GRANT PROXY ON u2@localhost TO u1@localhost;
-
---echo # access denied because of no privileges to root
---error ER_ACCESS_DENIED_NO_PASSWORD_ERROR
-REVOKE PROXY ON u2@localhost FROM u1@localhost;
-
---echo # go try graning proxy on itself, so that it will need the table
-connect(proxy_granter_con,localhost,u2,);
-connection proxy_granter_con;
-
---error ER_NO_SUCH_TABLE
-GRANT PROXY ON u2@localhost TO u1@localhost;
---error ER_NO_SUCH_TABLE
-REVOKE PROXY ON u2@localhost FROM u1@localhost;
-
-connection default;
-disconnect proxy_granter_con;
-
---echo # test if REVOKE works without the proxies_priv table
-REVOKE ALL PRIVILEGES ON *.* FROM u1@localhost, u2@localhost;
-
---echo # test if DROP USER work without the proxies_priv table
-DROP USER u1@localhost,u2@localhost;
-
---echo # test if FLUSH PRIVILEGES works without the proxies_priv table
-FLUSH PRIVILEGES;
-
---exec $MYSQL_UPGRADE --skip-verbose --force 2>&1
---query_vertical SELECT Host,User,Proxied_host,Proxied_user,With_grant FROM mysql.proxies_priv
-
-FLUSH PRIVILEGES;
-
---echo #
---echo # Bug#58139 : default-auth option not recognized in MySQL standard
---echo # command line clients
---echo #
-
---echo # Executing 'mysql'
---exec $MYSQL -u root -S $MASTER_MYSOCK -P $MASTER_MYPORT --default-auth=auth_test_plugin -e "SELECT 1"
-
---echo # Executing 'mysqladmin'
---exec $MYSQLADMIN -u root -S $MASTER_MYSOCK -P $MASTER_MYPORT --default-auth=auth_test_plugin ping
-
---echo # Executing 'mysqldump'
---exec $MYSQL_DUMP -u root -S $MASTER_MYSOCK -P $MASTER_MYPORT --compact --default-auth=auth_test_plugin test
-
---echo # Executing 'mysql_upgrade'
---exec $MYSQL_UPGRADE -u root -S $MASTER_MYSOCK -P $MASTER_MYPORT --default-auth=auth_test_plugin --skip-verbose --force --upgrade-system-tables
-
---echo #
---echo # Bug #59657: Move the client authentication_pam plugin into the
---echo # server repository
---echo #
-
-CREATE USER uplain@localhost IDENTIFIED WITH 'cleartext_plugin_server'
- AS 'cleartext_test';
-
---echo ## test plugin auth
---disable_query_log
---error ER_ACCESS_DENIED_ERROR : this should fail : no grant
-connect(cleartext_fail_con,localhost,uplain,cleartext_test2);
---enable_query_log
-
-connect(cleartext_con,localhost,uplain,cleartext_test);
-connection cleartext_con;
-select USER(),CURRENT_USER();
-
-connection default;
-disconnect cleartext_con;
-DROP USER uplain@localhost;
-
---echo #
---echo # Bug #59038 : mysql.user.authentication_string column
---echo # causes configuration wizard to fail
-
-INSERT IGNORE INTO mysql.user(
- Host,
- User,
- Password,
- Select_priv,
- Insert_priv,
- Update_priv,
- Delete_priv,
- Create_priv,
- Drop_priv,
- Reload_priv,
- Shutdown_priv,
- Process_priv,
- File_priv,
- Grant_priv,
- References_priv,
- Index_priv,
- Alter_priv,
- Show_db_priv,
- Super_priv,
- Create_tmp_table_priv,
- Lock_tables_priv,
- Execute_priv,
- Repl_slave_priv,
- Repl_client_priv,
- /*!50001
- Create_view_priv,
- Show_view_priv,
- Create_routine_priv,
- Alter_routine_priv,
- Create_user_priv,
- */
- ssl_type,
- ssl_cipher,
- x509_issuer,
- x509_subject,
- max_questions,
- max_updates,
- max_connections)
-VALUES (
- 'localhost',
- 'inserttest', '',
- 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y',
- 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y',
- /*!50001 'Y', 'Y', 'Y', 'Y', 'Y', */'', '', '', '', '0', '0', '0');
-FLUSH PRIVILEGES;
-DROP USER inserttest@localhost;
-SELECT IS_NULLABLE, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE
- COLUMN_NAME IN ('authentication_string', 'plugin') AND
- TABLE_NAME='user' AND
- TABLE_SCHEMA='mysql'
-ORDER BY COLUMN_NAME;
-
-
---echo #
---echo # Bug #11936829: diff. between mysql.user (authentication_string)
---echo # in fresh and upgraded 5.5.11
---echo #
-
-SELECT IS_NULLABLE, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS
- WHERE TABLE_SCHEMA= 'mysql' AND TABLE_NAME= 'user' AND
- COLUMN_NAME IN ('plugin', 'authentication_string')
- ORDER BY COLUMN_NAME;
-ALTER TABLE mysql.user MODIFY plugin char(64) DEFAULT '' NOT NULL;
-ALTER TABLE mysql.user MODIFY authentication_string TEXT NOT NULL;
-
---echo Run mysql_upgrade on a 5.5.10 external authentication column layout
---exec $MYSQL_UPGRADE --skip-verbose --force 2>&1
-
-SELECT IS_NULLABLE, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS
- WHERE TABLE_SCHEMA= 'mysql' AND TABLE_NAME= 'user' AND
- COLUMN_NAME IN ('plugin', 'authentication_string')
- ORDER BY COLUMN_NAME;
-let $datadir= `select @@datadir`;
-remove_file $datadir/mysql_upgrade_info;
-
-
---echo #
---echo # Bug # 11766641: 59792: BIN/MYSQL -UUNKNOWN -PUNKNOWN
---echo # .-> USING PASSWORD: NO
---echo #
-
---echo # shoud contain "using password=yes"
---error 1
---exec $MYSQL -uunknown -punknown 2>&1
-
---echo # shoud contain "using password=no"
---error 1
---exec $MYSQL -uunknown 2>&1
-
---echo #
---echo # Bug #12610784: SET PASSWORD INCORRECTLY KEEP AN OLD EMPTY PASSWORD
---echo #
-
-CREATE USER bug12610784@localhost;
-SET PASSWORD FOR bug12610784@localhost = PASSWORD('secret');
---disable_query_log
---error ER_ACCESS_DENIED_ERROR
-connect(b12610784,localhost,bug12610784,,test);
---enable_query_log
-connect(b12610784,localhost,bug12610784,secret,test);
-connection default;
-disconnect b12610784;
-DROP USER bug12610784@localhost;
-
-
---echo #
---echo # Bug #12818542: PAM: ADDING PASSWORD FOR AN ACCOUNT DISABLES PAM
---echo # AUTHENTICATION SETTINGS
---echo #
-
-CREATE USER bug12818542@localhost
- IDENTIFIED WITH 'test_plugin_server' AS 'bug12818542_dest';
-CREATE USER bug12818542_dest@localhost
- IDENTIFIED BY 'bug12818542_dest_passwd';
-GRANT PROXY ON bug12818542_dest@localhost TO bug12818542@localhost;
-
-connect(bug12818542_con,localhost,bug12818542,bug12818542_dest);
-connection bug12818542_con;
-SELECT USER(),CURRENT_USER();
-
-SET PASSWORD = PASSWORD('bruhaha');
-
-connection default;
-disconnect bug12818542_con;
-
-connect(bug12818542_con2,localhost,bug12818542,bug12818542_dest);
-connection bug12818542_con2;
-SELECT USER(),CURRENT_USER();
-
-connection default;
-disconnect bug12818542_con2;
-
-DROP USER bug12818542@localhost;
-DROP USER bug12818542_dest@localhost;
-
-SET GLOBAL SQL_MODE=default;
---echo End of 5.5 tests
diff --git a/mysql-test/t/plugin_auth_qa.test b/mysql-test/t/plugin_auth_qa.test
deleted file mode 100644
index fce72a66702..00000000000
--- a/mysql-test/t/plugin_auth_qa.test
+++ /dev/null
@@ -1,339 +0,0 @@
-# The numbers represent test cases of the test plan.
-
---source include/have_plugin_auth.inc
---source include/not_embedded.inc
-
-set sql_mode="";
-
-CREATE DATABASE test_user_db;
-
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
---echo ========== test 1.1 ======================================================
-# without '', without AS part
-CREATE USER plug IDENTIFIED WITH test_plugin_server;
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-DROP USER plug;
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server;
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-REVOKE ALL PRIVILEGES ON test_user_db.* FROM plug;
-DROP USER plug;
-# with '', without AS part
-CREATE USER plug IDENTIFIED WITH 'test_plugin_server';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-DROP USER plug;
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-REVOKE ALL PRIVILEGES ON test_user_db.* FROM plug;
-DROP USER plug;
-# without '', AS part empty
-CREATE USER plug IDENTIFIED WITH test_plugin_server AS '';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-DROP USER plug;
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS '';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-REVOKE ALL PRIVILEGES ON test_user_db.* FROM plug;
-DROP USER plug;
-# with '', AS part empty without ''
---error ER_PARSE_ERROR
-CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS ;
---error ER_PARSE_ERROR
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS;
-# without '', AS part without ''
---error ER_PARSE_ERROR
-CREATE USER plug IDENTIFIED WITH test_plugin_server AS plug_dest;
---error ER_PARSE_ERROR
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS plug_dest;
---echo ========== test 1.1 syntax errors ========================================
-# without auth_name
---error ER_PARSE_ERROR
-CREATE USER plug IDENTIFIED WITH AS plug_dest;
---error ER_PARSE_ERROR
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH AS plug_dest;
-# without auth_name and AS part
---error ER_PARSE_ERROR
-CREATE USER plug IDENTIFIED WITH;
---error ER_PARSE_ERROR
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH;
-# without auth_name but AS part
---error ER_PARSE_ERROR
-CREATE USER plug IDENTIFIED AS '';
---error ER_PARSE_ERROR
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED AS '';
-# with 2 auth_name parts
---error ER_PARSE_ERROR
-CREATE USER plug IDENTIFIED WITH 'test_plugin_server' IDENTIFIED WITH 'test_plugin_server';
---error ER_PARSE_ERROR
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug
- IDENTIFIED WITH 'test_plugin_server' IDENTIFIED WITH 'test_plugin_server';
-# with 2 AS parts
---error ER_PARSE_ERROR
-CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS '' AS 'plug_dest';
---error ER_PARSE_ERROR
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug AS '' AS 'plug_dest';
-# with 2 complete WITH parts
---error ER_PARSE_ERROR
-CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS ''
- IDENTIFIED WITH test_plugin_server AS 'plug_dest';
---error ER_PARSE_ERROR
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS ''
- IDENTIFIED WITH test_plugin_server AS 'plug_dest';
-# with BY and WITH part
---error ER_PARSE_ERROR
-CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'
- IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
---error ER_PARSE_ERROR
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED BY 'plug_dest_passwd'
- IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
-# with WITH part and BY part
---error ER_PARSE_ERROR
-CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
- USER plug_dest IDENTIFIED by 'plug_dest_pwd';
---error ER_PARSE_ERROR
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
- USER plug_dest IDENTIFIED by 'plug_dest_pwd';
-# with WITH part and BY part
---error ER_PARSE_ERROR
-CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
- plug_dest IDENTIFIED by 'plug_dest_pwd';
---error ER_PARSE_ERROR
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
- plug_dest IDENTIFIED by 'plug_dest_pwd';
-# with WITH part and BY part
---error ER_PARSE_ERROR
-CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
- IDENTIFIED by 'plug_dest_pwd';
---error ER_PARSE_ERROR
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
- IDENTIFIED by 'plug_dest_pwd';
-
---echo ========== test 1.1 combinations ==========================
-# CREATE...WITH/CREATE...BY
-CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
---echo ========== test 1.1.1.6/1.1.2.5 ============================
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-DROP USER plug, plug_dest;
-#
-CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-DROP USER plug;
-CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-DROP USER plug_dest;
-# GRANT...WITH/CREATE...BY
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-DROP USER plug, plug_dest;
-#
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS 'plug_dest';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-DROP USER plug;
-CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-DROP USER plug_dest;
-# CREATE...WITH/GRANT...BY
-CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-DROP USER plug, plug_dest;
-#
-CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-DROP USER plug;
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-DROP USER plug_dest;
-#
-CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server';
-DROP USER plug;
-#
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS 'plug_dest';
---error ER_CANNOT_USER
-CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
---error ER_CANNOT_USER
-CREATE USER plug IDENTIFIED WITH 'test_plugin_server';
-DROP USER plug;
-#
-CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
---sorted_result
-SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED BY 'plug_dest_passwd';
---sorted_result
-SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
-DROP USER plug;
-#
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS 'plug_dest';
---error ER_CANNOT_USER
-CREATE USER plug IDENTIFIED BY 'plug_dest_passwd';
-DROP USER plug;
-#
-CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
-CREATE USER plug_dest IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
---sorted_result
-SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
-DROP USER plug,plug_dest;
-#
-CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
---sorted_result
-SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest
- IDENTIFIED WITH test_plugin_server AS 'plug_dest';
---sorted_result
-SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
-DROP USER plug,plug_dest;
-#
-
---echo ========== test 1.1.1.1/1.1.2.1/1.1.1.5 ====================
-
-SET NAMES utf8;
-#
-CREATE USER plüg IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-DROP USER plüg;
-CREATE USER plüg_dest IDENTIFIED BY 'plug_dest_passwd';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-DROP USER plüg_dest;
-
-SET NAMES ascii;
-#
-CREATE USER 'plüg' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-DROP USER 'plüg';
-CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-DROP USER 'plüg_dest';
-
-SET NAMES latin1;
-#
---echo ========== test 1.1.1.5 ====================================
---error ER_PLUGIN_IS_NOT_LOADED
-CREATE USER 'plüg' IDENTIFIED WITH 'test_plügin_server' AS 'plüg_dest';
-CREATE USER 'plug' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-DROP USER 'plug';
-CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-DROP USER 'plüg_dest';
-
-SET NAMES utf8;
-#
---error ER_PLUGIN_IS_NOT_LOADED
-CREATE USER plüg IDENTIFIED WITH 'test_plügin_server' AS 'plüg_dest';
-CREATE USER 'plüg' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-DROP USER 'plüg';
-CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-DROP USER 'plüg_dest';
-
-CREATE USER plüg IDENTIFIED WITH test_plugin_server AS 'plüg_dest';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-DROP USER plüg;
-CREATE USER plüg_dest IDENTIFIED BY 'plug_dest_passwd';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-DROP USER plüg_dest;
-
---echo ========== test 1.1.1.2/1.1.2.2=============================
-
-SET @auth_name= 'test_plugin_server';
---error ER_PARSE_ERROR
-CREATE USER plug IDENTIFIED WITH @auth_name AS 'plug_dest';
-
-SET @auth_string= 'plug_dest';
---error ER_PARSE_ERROR
-CREATE USER plug IDENTIFIED WITH test_plugin_server AS @auth_string;
-
---echo ========== test 1.1.1.3/1.1.2.3=============================
-
---error ER_PLUGIN_IS_NOT_LOADED
-CREATE USER plug IDENTIFIED WITH 'hh''s_test_plugin_server' AS 'plug_dest';
-
-CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'hh''s_plug_dest';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-DROP USER plug;
-CREATE USER 'hh''s_plug_dest' IDENTIFIED BY 'plug_dest_passwd';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-DROP USER 'hh''s_plug_dest';
-
---echo ========== test 1.1.1.4 ====================================
-
---error ER_PARSE_ERROR
-CREATE USER plug IDENTIFIED WITH hh''s_test_plugin_server AS 'plug_dest';
-
---echo ========== test 1.1.3.1 ====================================
-
-GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-CREATE USER plug_dest;
-DROP USER plug_dest;
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest;
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-DROP USER grant_user,plug_dest;
-#
-set @save_sql_mode= @@sql_mode;
-SET @@sql_mode=no_auto_create_user;
-GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-CREATE USER plug_dest;
-DROP USER plug_dest;
---error ER_PASSWORD_NO_MATCH
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest;
-DROP USER grant_user;
-#
-GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
---sorted_result
-SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
-DROP USER plug_dest;
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_user_passwd';
---sorted_result
-SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
-DROP USER grant_user,plug_dest;
-set @@sql_mode= @save_sql_mode;
-#
-DROP DATABASE test_user_db;
-
---exit
-
diff --git a/mysql-test/t/plugin_auth_qa_1.test b/mysql-test/t/plugin_auth_qa_1.test
deleted file mode 100644
index b0b8ffb3544..00000000000
--- a/mysql-test/t/plugin_auth_qa_1.test
+++ /dev/null
@@ -1,285 +0,0 @@
-# The numbers represent test cases of the test plan.
-
---source include/have_plugin_auth.inc
---source include/not_embedded.inc
-
-CREATE DATABASE test_user_db;
-
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-
---echo ========== test 1.1.3.2 ====================================
-
-# CREATE...WITH/CREATE...BY/GRANT
-CREATE USER plug_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
-CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
-GRANT PROXY ON plug_dest TO plug_user;
---replace_result $MASTER_MYSOCK MASTER_MYSOCK
---exec $MYSQL -S $MASTER_MYSOCK -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
-REVOKE PROXY ON plug_dest FROM plug_user;
---error 1
---exec $MYSQL -S $MASTER_MYSOCK -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
-DROP USER plug_user,plug_dest;
-#
-# GRANT...WITH
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user
- IDENTIFIED WITH test_plugin_server AS 'plug_dest';
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd';
-GRANT PROXY ON plug_dest TO plug_user;
-
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
---echo 1)
---replace_result $MASTER_MYSOCK MASTER_MYSOCK
---exec $MYSQL -S $MASTER_MYSOCK -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
-REVOKE ALL PRIVILEGES ON test_user_db.* FROM 'plug_user';
---echo 2)
---replace_result $MASTER_MYSOCK MASTER_MYSOCK
---exec $MYSQL -S $MASTER_MYSOCK -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
-REVOKE PROXY ON plug_dest FROM plug_user;
---echo 3)
---error 1
---exec $MYSQL -S $MASTER_MYSOCK -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
-DROP USER plug_user,plug_dest;
-#
-# GRANT...WITH/CREATE...BY
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user
- IDENTIFIED WITH test_plugin_server AS 'plug_dest';
-CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
---echo 1)
---error 1
---exec $MYSQL -S $MASTER_MYSOCK -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
-GRANT PROXY ON plug_dest TO plug_user;
---echo 2)
---replace_result $MASTER_MYSOCK MASTER_MYSOCK
---exec $MYSQL -S $MASTER_MYSOCK -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();USE test_user_db;CREATE TABLE t1(a int);SHOW TABLES;DROP TABLE t1;" 2>&1
-REVOKE ALL PRIVILEGES ON test_user_db.* FROM 'plug_user';
-#REVOKE ALL PRIVILEGES ON test_user_db.* FROM 'plug_dest'';
-DROP USER plug_user,plug_dest;
-
---echo ========== test 1.2 ========================================
-
-# GRANT...WITH/CREATE...BY
-GRANT ALL PRIVILEGES ON test_user_db.* TO plug_user
- IDENTIFIED WITH test_plugin_server AS 'plug_dest';
-CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
-GRANT PROXY ON plug_dest TO plug_user;
---replace_result $MASTER_MYSOCK MASTER_MYSOCK
---exec $MYSQL -S $MASTER_MYSOCK -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();" 2>&1
-RENAME USER plug_dest TO new_dest;
---error 1
---exec $MYSQL -S $MASTER_MYSOCK -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();" 2>&1
-GRANT PROXY ON new_dest TO plug_user;
---error 1
---exec $MYSQL -S $MASTER_MYSOCK -u plug_user --password=new_dest -e "SELECT current_user();SELECT user();" 2>&1
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-DROP USER plug_user,new_dest;
-
-# CREATE...WITH/CREATE...BY
-CREATE USER plug_user
- IDENTIFIED WITH test_plugin_server AS 'plug_dest';
-CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
---error 1
---exec $MYSQL -S $MASTER_MYSOCK -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();" 2>&1
-GRANT PROXY ON plug_dest TO plug_user;
---replace_result $MASTER_MYSOCK MASTER_MYSOCK
---exec $MYSQL -S $MASTER_MYSOCK -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();" 2>&1
-RENAME USER plug_dest TO new_dest;
---error 1
---exec $MYSQL -S $MASTER_MYSOCK -u plug_user --password=plug_dest -e "SELECT current_user();SELECT user();" 2>&1
-GRANT PROXY ON new_dest TO plug_user;
---error 1
---exec $MYSQL -S $MASTER_MYSOCK -u plug_user --password=new_dest -e "SELECT current_user();SELECT user();" 2>&1
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-DROP USER plug_user,new_dest;
-# CREATE...WITH
-CREATE USER plug_user
- IDENTIFIED WITH test_plugin_server AS 'plug_dest';
-CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
-GRANT PROXY ON plug_dest TO plug_user;
-connect(plug_user,localhost,plug_user,plug_dest);
-select USER(),CURRENT_USER();
-connection default;
-disconnect plug_user;
-RENAME USER plug_user TO new_user;
-connect(plug_user,localhost,new_user,plug_dest);
-select USER(),CURRENT_USER();
-connection default;
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-disconnect plug_user;
-UPDATE mysql.user SET user='plug_user' WHERE user='new_user';
-FLUSH PRIVILEGES;
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-DROP USER plug_dest,plug_user;
---echo ========== test 1.3 ========================================
-
-#
-CREATE USER plug_user
- IDENTIFIED WITH test_plugin_server AS 'plug_dest';
-CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
-GRANT PROXY ON plug_dest TO plug_user;
-connect(plug_user,localhost,plug_user,plug_dest);
-select USER(),CURRENT_USER();
-connection default;
-disconnect plug_user;
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-UPDATE mysql.user SET user='new_user' WHERE user='plug_user';
-FLUSH PRIVILEGES;
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-UPDATE mysql.user SET authentication_string='new_dest' WHERE user='new_user';
-FLUSH PRIVILEGES;
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-UPDATE mysql.user SET plugin='new_plugin_server' WHERE user='new_user';
-FLUSH PRIVILEGES;
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
---disable_query_log
---error ER_PLUGIN_IS_NOT_LOADED
-connect(plug_user,localhost,new_user,new_dest);
---enable_query_log
-UPDATE mysql.user SET plugin='test_plugin_server' WHERE user='new_user';
-UPDATE mysql.user SET USER='new_dest' WHERE user='plug_dest';
-FLUSH PRIVILEGES;
-GRANT PROXY ON new_dest TO new_user;
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-connect(plug_user,localhost,new_user,new_dest);
-select USER(),CURRENT_USER();
-connection default;
-disconnect plug_user;
-UPDATE mysql.user SET USER='plug_dest' WHERE user='new_dest';
-FLUSH PRIVILEGES;
-CREATE USER new_dest IDENTIFIED BY 'new_dest_passwd';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-GRANT ALL PRIVILEGES ON test.* TO new_user;
-connect(plug_user,localhost,new_dest,new_dest_passwd);
-select USER(),CURRENT_USER();
-connection default;
-disconnect plug_user;
-DROP USER new_user,new_dest,plug_dest;
-
---echo ========== test 2, 2.1, 2.2 ================================
-
-CREATE USER ''@'%%' IDENTIFIED WITH test_plugin_server AS 'proxied_user';
-CREATE USER proxied_user IDENTIFIED BY 'proxied_user_passwd';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
-SELECT USER(),CURRENT_USER();
---echo ========== test 2.2.1 ======================================
-SELECT @@proxy_user;
-connection default;
-disconnect proxy_con;
---disable_query_log
---error ER_ACCESS_DENIED_ERROR : this should fail : no grant
-connect(proxy_con,localhost,proxy_user,proxied_user);
---enable_query_log
-GRANT PROXY ON proxied_user TO ''@'%%';
-connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
-SELECT USER(),CURRENT_USER();
-connection default;
-disconnect proxy_con;
-connect(proxy_con,localhost,proxy_user,proxied_user);
-SELECT USER(),CURRENT_USER();
---echo ========== test 2.2.1 ======================================
-SELECT @@proxy_user;
-connection default;
-disconnect proxy_con;
-DROP USER ''@'%%',proxied_user;
-#
-GRANT ALL PRIVILEGES ON test_user_db.* TO ''@'%%'
- IDENTIFIED WITH test_plugin_server AS 'proxied_user';
-CREATE USER proxied_user IDENTIFIED BY 'proxied_user_passwd';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
-SELECT USER(),CURRENT_USER();
-SELECT @@proxy_user;
-connection default;
-disconnect proxy_con;
---disable_query_log
---error ER_ACCESS_DENIED_ERROR : this should fail : no grant
-connect(proxy_con,localhost,proxy_user,proxied_user);
---enable_query_log
-GRANT PROXY ON proxied_user TO ''@'%%';
-connect(proxy_con,localhost,proxied_user,proxied_user_passwd);
-SELECT USER(),CURRENT_USER();
-connection default;
-disconnect proxy_con;
-connect(proxy_con,localhost,proxy_user,proxied_user);
-SELECT USER(),CURRENT_USER();
-SELECT @@proxy_user;
-connection default;
-disconnect proxy_con;
-DROP USER ''@'%%',proxied_user;
-#
-CREATE USER ''@'%%' IDENTIFIED WITH test_plugin_server AS 'proxied_user';
-CREATE USER proxied_user_1 IDENTIFIED BY 'proxied_user_1_pwd';
-CREATE USER proxied_user_2 IDENTIFIED BY 'proxied_user_2_pwd';
-CREATE USER proxied_user_3 IDENTIFIED BY 'proxied_user_3_pwd';
-CREATE USER proxied_user_4 IDENTIFIED BY 'proxied_user_4_pwd';
-CREATE USER proxied_user_5 IDENTIFIED BY 'proxied_user_5_pwd';
-GRANT PROXY ON proxied_user_1 TO ''@'%%';
-GRANT PROXY ON proxied_user_2 TO ''@'%%';
-GRANT PROXY ON proxied_user_3 TO ''@'%%';
-GRANT PROXY ON proxied_user_4 TO ''@'%%';
-GRANT PROXY ON proxied_user_5 TO ''@'%%';
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-connect(proxy_con_1,localhost,proxied_user_1,'proxied_user_1_pwd');
-connect(proxy_con_2,localhost,proxied_user_2,proxied_user_2_pwd);
-connect(proxy_con_3,localhost,proxied_user_3,proxied_user_3_pwd);
-connect(proxy_con_4,localhost,proxied_user_4,proxied_user_4_pwd);
-connect(proxy_con_5,localhost,proxied_user_5,proxied_user_5_pwd);
-connection proxy_con_1;
-SELECT USER(),CURRENT_USER();
-SELECT @@proxy_user;
-connection proxy_con_2;
-SELECT USER(),CURRENT_USER();
-SELECT @@proxy_user;
-connection proxy_con_3;
-SELECT USER(),CURRENT_USER();
-SELECT @@proxy_user;
-connection proxy_con_4;
-SELECT USER(),CURRENT_USER();
-SELECT @@proxy_user;
-connection proxy_con_5;
-SELECT USER(),CURRENT_USER();
-SELECT @@proxy_user;
-connection default;
-disconnect proxy_con_1;
-disconnect proxy_con_2;
-disconnect proxy_con_3;
-disconnect proxy_con_4;
-disconnect proxy_con_5;
-DROP USER ''@'%%',proxied_user_1,proxied_user_2,proxied_user_3,proxied_user_4,proxied_user_5;
-
---echo ========== test 3 ==========================================
-
-GRANT ALL PRIVILEGES ON *.* TO plug_user
- IDENTIFIED WITH test_plugin_server AS 'plug_dest';
-CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
-GRANT PROXY ON plug_dest TO plug_user;
-FLUSH PRIVILEGES;
-
-# Not working with the patch.
-
-#--replace_result $MYSQLADMIN MYSQLADMIN $MASTER_MYPORT MYPORT $MASTER_MYSOCK MYSOCK
-#--exec $MYSQLADMIN -h localhost -P $MASTER_MYPORT -S $MASTER_MYSOCK -u plug_user --password=plug_dest ping 2>&1
-#--replace_result $MYSQL_CHECK MYSQL_CHECK $MASTER_MYPORT MYPORT
-#--exec $MYSQL_CHECK -h localhost -P $MASTER_MYPORT -u plug_user --password=plug_dest test
-#--replace_result $MYSQL_DUMP MYSQL_DUMP $MASTER_MYPORT MYPORT
-#--exec $MYSQL_DUMP -h localhost -P $MASTER_MYPORT -u plug_user --password=plug_dest test
-#--replace_result $MYSQL_SHOW MYSQL_SHOW $MASTER_MYPORT MYPORT
-#--exec $MYSQL_SHOW -h localhost -P $MASTER_MYPORT --plugin_dir=../plugin/auth -u plug_user --password=plug_dest 2>&1
-DROP USER plug_user, plug_dest;
-DROP DATABASE test_user_db;
---exit
diff --git a/mysql-test/t/plugin_auth_qa_2-master.opt b/mysql-test/t/plugin_auth_qa_2-master.opt
deleted file mode 100644
index 6429a4458aa..00000000000
--- a/mysql-test/t/plugin_auth_qa_2-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---plugin-load-add=$QA_AUTH_INTERFACE_SO
diff --git a/mysql-test/t/plugin_auth_qa_2.test b/mysql-test/t/plugin_auth_qa_2.test
deleted file mode 100644
index db92f6ee453..00000000000
--- a/mysql-test/t/plugin_auth_qa_2.test
+++ /dev/null
@@ -1,153 +0,0 @@
-# Horst Hunger
-# Created: 2010-10-06
-#
-# Test of the authentification interface. The plugin checks the expected values set
-# by this application and the application checks the values set the the plugin.
---source include/have_plugin_interface.inc
---source include/not_embedded.inc
-
-CREATE DATABASE test_user_db;
-
---echo ========== test 1.1.3.2 ====================================
---echo === check contens of components of info ====================
-
-CREATE USER qa_test_1_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_1_dest';
-CREATE USER qa_test_1_dest IDENTIFIED BY 'dest_passwd';
-GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_1_dest identified by 'dest_passwd';
-GRANT PROXY ON qa_test_1_dest TO qa_test_1_user;
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-SELECT @@proxy_user;
-SELECT @@external_user;
-
---echo exec MYSQL -h localhost -P MASTER_MYPORT -u qa_test_1_user --password=qa_test_1_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
---exec $MYSQL -h localhost -P $MASTER_MYPORT -u qa_test_1_user --password=qa_test_1_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
-
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-
-DROP USER qa_test_1_user;
-DROP USER qa_test_1_dest;
-
---echo === Assign values to components of info ====================
-
-CREATE USER qa_test_2_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_2_dest';
-CREATE USER qa_test_2_dest IDENTIFIED BY 'dest_passwd';
-CREATE USER authenticated_as IDENTIFIED BY 'dest_passwd';
-GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_2_dest identified by 'dest_passwd';
-GRANT PROXY ON qa_test_2_dest TO qa_test_2_user;
-GRANT PROXY ON authenticated_as TO qa_test_2_user;
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-SELECT @@proxy_user;
-SELECT @@external_user;
-
---echo exec MYSQL -h localhost -P MASTER_MYPORT -u qa_test_2_user --password=qa_test_2_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
---exec $MYSQL -h localhost -P $MASTER_MYPORT -u qa_test_2_user --password=qa_test_2_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
-
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-
-DROP USER qa_test_2_user;
-DROP USER qa_test_2_dest;
-DROP USER authenticated_as;
-
---echo === Assign too high values for *length, which should have no effect ====
-
-CREATE USER qa_test_3_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_3_dest';
-CREATE USER qa_test_3_dest IDENTIFIED BY 'dest_passwd';
-GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_3_dest identified by 'dest_passwd';
-GRANT PROXY ON qa_test_3_dest TO qa_test_3_user;
-
---echo exec MYSQL -h localhost -P MASTER_MYPORT -u qa_test_3_user --password=qa_test_3_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
---exec $MYSQL -h localhost -P $MASTER_MYPORT -u qa_test_3_user --password=qa_test_3_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
-
-DROP USER qa_test_3_user;
-DROP USER qa_test_3_dest;
-
---echo === Assign too low values for *length, which should have no effect ====
-
-CREATE USER qa_test_4_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_4_dest';
-CREATE USER qa_test_4_dest IDENTIFIED BY 'dest_passwd';
-GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_4_dest identified by 'dest_passwd';
-GRANT PROXY ON qa_test_4_dest TO qa_test_4_user;
-
---echo exec MYSQL -h localhost -P MASTER_MYPORT -u qa_test_4_user --password=qa_test_4_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
---exec $MYSQL -h localhost -P $MASTER_MYPORT -u qa_test_4_user --password=qa_test_4_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
-
-DROP USER qa_test_4_user;
-DROP USER qa_test_4_dest;
-
---echo === Assign empty string especially to authenticated_as (in plugin) ====
-
-CREATE USER qa_test_5_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_5_dest';
-CREATE USER qa_test_5_dest IDENTIFIED BY 'dest_passwd';
-CREATE USER ''@'localhost' IDENTIFIED BY 'dest_passwd';
-GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_5_dest identified by 'dest_passwd';
-GRANT ALL PRIVILEGES ON test_user_db.* TO ''@'localhost' identified by 'dest_passwd';
-GRANT PROXY ON qa_test_5_dest TO qa_test_5_user;
-GRANT PROXY ON qa_test_5_dest TO ''@'localhost';
-
---sorted_result
-SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
-
---echo exec MYSQL -h localhost -P MASTER_MYPORT --user=qa_test_5_user --password=qa_test_5_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
---error 1
---exec $MYSQL -h localhost -P $MASTER_MYPORT --user=qa_test_5_user --password=qa_test_5_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
-
-DROP USER qa_test_5_user;
-DROP USER qa_test_5_dest;
-DROP USER ''@'localhost';
-
---echo === Assign 'root' especially to authenticated_as (in plugin) ====
-
-CREATE USER qa_test_6_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_6_dest';
-CREATE USER qa_test_6_dest IDENTIFIED BY 'dest_passwd';
-GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_6_dest identified by 'dest_passwd';
-GRANT PROXY ON qa_test_6_dest TO qa_test_6_user;
-
---sorted_result
-SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
-
---echo exec MYSQL -h localhost -P MASTER_MYPORT --user=qa_test_6_user --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
---error 1
---exec $MYSQL -h localhost -P $MASTER_MYPORT --user=qa_test_6_user --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
-
-GRANT PROXY ON qa_test_6_dest TO root IDENTIFIED WITH qa_auth_interface AS 'qa_test_6_dest';
---sorted_result
-SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
-
---echo exec MYSQL -h localhost -P MASTER_MYPORT --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
---error 1
---exec $MYSQL -h localhost -P $MASTER_MYPORT --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
-
-REVOKE PROXY ON qa_test_6_dest FROM root;
---sorted_result
-SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
-
---echo exec MYSQL -h localhost -P MASTER_MYPORT --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
---error 1
---exec $MYSQL -h localhost -P $MASTER_MYPORT --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
-
-DROP USER qa_test_6_user;
-DROP USER qa_test_6_dest;
-DELETE FROM mysql.user WHERE user='root' AND plugin='qa_auth_interface';
---sorted_result
-SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
-
-
---echo === Test of the --default_auth option for clients ====
-
-CREATE USER qa_test_11_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_11_dest';
-CREATE USER qa_test_11_dest IDENTIFIED BY 'dest_passwd';
-GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_11_dest identified by 'dest_passwd';
-GRANT PROXY ON qa_test_11_dest TO qa_test_11_user;
-
---echo exec MYSQL --default_auth=qa_auth_client -h localhost -P MASTER_MYPORT -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
---error 1
---exec $MYSQL --default_auth=qa_auth_client -h localhost -P $MASTER_MYPORT -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
-
-DROP USER qa_test_11_user, qa_test_11_dest;
-DROP DATABASE test_user_db;
-
---exit
diff --git a/mysql-test/t/plugin_auth_qa_3-master.opt b/mysql-test/t/plugin_auth_qa_3-master.opt
deleted file mode 100644
index db4629aa09d..00000000000
--- a/mysql-test/t/plugin_auth_qa_3-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---plugin-load-add=$QA_AUTH_SERVER_SO
diff --git a/mysql-test/t/plugin_auth_qa_3.test b/mysql-test/t/plugin_auth_qa_3.test
deleted file mode 100644
index 349d574227a..00000000000
--- a/mysql-test/t/plugin_auth_qa_3.test
+++ /dev/null
@@ -1,25 +0,0 @@
-# Horst Hunger
-# Created: 2010-10-06
-#
-# Test of the authentification interface. The plugin checks the expected values set
-# by this application and the application checks the values set the the plugin.
---source include/have_plugin_server.inc
---source include/not_embedded.inc
-
-CREATE DATABASE test_user_db;
-
-CREATE USER qa_test_11_user IDENTIFIED WITH qa_auth_server AS 'qa_test_11_dest';
-GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_11_dest identified by 'dest_passwd';
-GRANT PROXY ON qa_test_11_dest TO qa_test_11_user;
-
---echo exec MYSQL --default_auth=qa_auth_client -h localhost -P MASTER_MYPORT -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
---exec $MYSQL --default_auth=qa_auth_client -h localhost -P $MASTER_MYPORT -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
-
---echo exec MYSQL --default_auth=qa_auth_client -h localhost -P MASTER_MYPORT -u qa_test_2_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
---error 1
---exec $MYSQL --default_auth=qa_auth_client -h localhost -P $MASTER_MYPORT -u qa_test_2_user --password=qa_test_2_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
-
-DROP USER qa_test_11_user, qa_test_11_dest;
-DROP DATABASE test_user_db;
-
---exit
diff --git a/mysql-test/t/plugin_innodb.test b/mysql-test/t/plugin_innodb.test
deleted file mode 100644
index fb5dd84b997..00000000000
--- a/mysql-test/t/plugin_innodb.test
+++ /dev/null
@@ -1,27 +0,0 @@
---source include/not_embedded.inc
---source include/have_example_plugin.inc
---source include/have_innodb.inc
-
-if (!`select count(*) from information_schema.plugins
- where plugin_name = 'innodb' and plugin_status = 'active' and
- plugin_library is null`) {
- skip Need compiled-in InnoDB;
-}
-
-
---replace_regex /\.dll/.so/
-eval install plugin example soname '$HA_EXAMPLE_SO';
-create table t1(a int) engine=example;
-drop table t1;
-
-alter table mysql.plugin engine=innodb;
---echo restart
---source include/restart_mysqld.inc
-
-create table t1(a int) engine=example;
-select * from t1;
-drop table t1;
-
-alter table mysql.plugin engine=myisam;
-uninstall plugin example;
-
diff --git a/mysql-test/t/plugin_load.opt b/mysql-test/t/plugin_load.opt
deleted file mode 100644
index aeeb2e4eb7d..00000000000
--- a/mysql-test/t/plugin_load.opt
+++ /dev/null
@@ -1,6 +0,0 @@
---plugin-load-add=$DIALOG_EXAMPLES_SO
---plugin-load=$LIBDAEMON_EXAMPLE_SO
---plugin-load-add=EXAMPLE=$HA_EXAMPLE_SO
---plugin-load-add=$MYPLUGLIB_SO
---plugin-load-add=$HA_EXAMPLE_SO
---loose-plugin-example-enum-var=e2
diff --git a/mysql-test/t/plugin_load.test b/mysql-test/t/plugin_load.test
deleted file mode 100644
index fdae622645a..00000000000
--- a/mysql-test/t/plugin_load.test
+++ /dev/null
@@ -1,18 +0,0 @@
---source include/not_windows_embedded.inc
---source include/have_example_plugin.inc
-
-if (!$MYPLUGLIB_SO) {
- --echo needs SIMPLE_PARSER plugin
-}
-if (!$LIBDAEMON_EXAMPLE_SO) {
- --echo needs DAEMON_EXAMPLE plugin
-}
-if (!$DIALOG_EXAMPLES_SO) {
- --echo needs dialog examples plugins
-}
-SELECT @@global.example_enum_var = 'e2';
-
---sorted_result
-select plugin_name, plugin_status from information_schema.plugins
- where plugin_name in ('SIMPLE_PARSER', 'EXAMPLE',
- 'DAEMON_EXAMPLE', 'TWO_QUESTIONS', 'THREE_ATTEMPTS');
diff --git a/mysql-test/t/plugin_load_option.opt b/mysql-test/t/plugin_load_option.opt
deleted file mode 100644
index be9bc9d5487..00000000000
--- a/mysql-test/t/plugin_load_option.opt
+++ /dev/null
@@ -1,2 +0,0 @@
---plugin-load-add=EXAMPLE=$HA_EXAMPLE_SO
---loose-plugin-example=FORCE_PLUS_PERMANENT
diff --git a/mysql-test/t/plugin_load_option.test b/mysql-test/t/plugin_load_option.test
deleted file mode 100644
index e49b693b5be..00000000000
--- a/mysql-test/t/plugin_load_option.test
+++ /dev/null
@@ -1,8 +0,0 @@
---source include/not_windows_embedded.inc
---source include/have_example_plugin.inc
-
---error ER_PLUGIN_IS_PERMANENT
-UNINSTALL PLUGIN example;
-
-SELECT PLUGIN_NAME, PLUGIN_STATUS, LOAD_OPTION FROM INFORMATION_SCHEMA.PLUGINS
-WHERE PLUGIN_NAME IN ('MyISAM', 'EXAMPLE');
diff --git a/mysql-test/t/plugin_loaderr.opt b/mysql-test/t/plugin_loaderr.opt
deleted file mode 100644
index 38cb906723d..00000000000
--- a/mysql-test/t/plugin_loaderr.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb --innodb-page-size=6000
diff --git a/mysql-test/t/plugin_loaderr.test b/mysql-test/t/plugin_loaderr.test
deleted file mode 100644
index 85621ad047d..00000000000
--- a/mysql-test/t/plugin_loaderr.test
+++ /dev/null
@@ -1,26 +0,0 @@
-
---source include/not_embedded.inc
-
-# We used an invalid command-line option and InnoDB failed to start.
-# Ignore all related warnings
-call mtr.add_suppression("InnoDB");
-
---vertical_results
-SELECT
-PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE,PLUGIN_LIBRARY,PLUGIN_LIBRARY_VERSION,LOAD_OPTION
-FROM INFORMATION_SCHEMA.PLUGINS WHERE plugin_name = 'innodb';
-
---echo #
---echo # MDEV-6351 --plugin=force has no effect for built-in plugins
---echo #
---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server
---source include/wait_until_disconnected.inc
-
---error 1
---exec $MYSQLD_CMD --innodb=force --innodb-page-size=6000 --disable-log-error
-
---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---enable_reconnect
---source include/wait_until_connected_again.inc
---disable_reconnect
diff --git a/mysql-test/t/plugin_maturity-master.opt b/mysql-test/t/plugin_maturity-master.opt
deleted file mode 100644
index 70ba6280117..00000000000
--- a/mysql-test/t/plugin_maturity-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---plugin-maturity=stable
diff --git a/mysql-test/t/plugin_maturity.test b/mysql-test/t/plugin_maturity.test
deleted file mode 100644
index e1e4941492e..00000000000
--- a/mysql-test/t/plugin_maturity.test
+++ /dev/null
@@ -1,12 +0,0 @@
---source include/have_example_plugin.inc
-
-# test for --plugin_maturity
---replace_regex /\.dll/.so/
---error 1126
-eval INSTALL PLUGIN example SONAME '$HA_EXAMPLE_SO';
-
---replace_regex /\.dll/.so/
---error 1126
-eval INSTALL SONAME '$HA_EXAMPLE_SO';
---replace_regex /\.dll/.so/
-show warnings;
diff --git a/mysql-test/t/plugin_not_embedded.test b/mysql-test/t/plugin_not_embedded.test
deleted file mode 100644
index 3b4129b6b6b..00000000000
--- a/mysql-test/t/plugin_not_embedded.test
+++ /dev/null
@@ -1,32 +0,0 @@
---source include/not_embedded.inc
---source include/have_example_plugin.inc
-
---echo #
---echo # Bug#51770: UNINSTALL PLUGIN requires no privileges
---echo #
-
-CREATE USER bug51770@localhost;
-GRANT INSERT ON mysql.plugin TO bug51770@localhost;
-connect(con1,localhost,bug51770,,);
---replace_regex /\.dll/.so/
-eval INSTALL PLUGIN example SONAME '$HA_EXAMPLE_SO';
---error ER_TABLEACCESS_DENIED_ERROR
-UNINSTALL PLUGIN example;
-connection default;
-GRANT DELETE ON mysql.plugin TO bug51770@localhost;
-connection con1;
-UNINSTALL PLUGIN example;
-disconnect con1;
-connection default;
-DROP USER bug51770@localhost;
-
-#
-# BUG#58246: INSTALL PLUGIN not secure & crashable
-#
-# The bug consisted of not recognizing / on Windows, so checking / on
-# all platforms should cover this case.
-
-let $path = `select CONCAT_WS('/', '..', '$HA_EXAMPLE_SO')`;
---replace_regex /\.dll/.so/
---error ER_UDF_NO_PATHS
-eval INSTALL PLUGIN example SONAME '$path';
diff --git a/mysql-test/t/plugin_vars.test b/mysql-test/t/plugin_vars.test
deleted file mode 100644
index 8ba8fe2ec0e..00000000000
--- a/mysql-test/t/plugin_vars.test
+++ /dev/null
@@ -1,56 +0,0 @@
---echo #
---echo # MDEV-5345 - Deadlock between mysql_change_user(), SHOW VARIABLES and
---echo # INSTALL PLUGIN
---echo #
-
-# Prepare test
-delimiter |;
-CREATE PROCEDURE p_install(x INT)
-BEGIN
- DECLARE CONTINUE HANDLER FOR 1126 BEGIN END;
- WHILE x DO
- SET x= x - 1;
- INSTALL PLUGIN no_such_plugin SONAME 'no_such_object';
- END WHILE;
-END|
-
-CREATE PROCEDURE p_show_vars(x INT)
-WHILE x DO
- SET x= x - 1;
- SHOW VARIABLES;
-END WHILE|
-delimiter ;|
-
-connect(con1, localhost, root,,);
-connect(con2, localhost, root,,);
-
-# Start test
-connection con1;
---send CALL p_install(100)
-
-connection con2;
---send CALL p_show_vars(100)
-
-connection default;
-
-disable_result_log;
-let $i= 100;
-while ($i)
-{
- change_user;
- dec $i;
-}
-
-# Cleanup
-connection con1;
-reap;
-connection con2;
-reap;
-connection default;
-enable_result_log;
-
-disconnect con1;
-disconnect con2;
-USE test;
-DROP PROCEDURE p_install;
-DROP PROCEDURE p_show_vars;
diff --git a/mysql-test/t/pool_of_threads.cnf b/mysql-test/t/pool_of_threads.cnf
deleted file mode 100644
index f6651c878de..00000000000
--- a/mysql-test/t/pool_of_threads.cnf
+++ /dev/null
@@ -1,11 +0,0 @@
-!include include/default_my.cnf
-
-[mysqld.1]
-loose-thread-handling= pool-of-threads
-loose-thread_pool_size= 2
-loose-thread_pool_max_threads= 2
-extra-port= @ENV.MASTER_EXTRA_PORT
-extra-max-connections=1
-
-[ENV]
-MASTER_EXTRA_PORT= @OPT.port
diff --git a/mysql-test/t/pool_of_threads.test b/mysql-test/t/pool_of_threads.test
deleted file mode 100644
index f13a096985c..00000000000
--- a/mysql-test/t/pool_of_threads.test
+++ /dev/null
@@ -1,93 +0,0 @@
-# Start with thread_handling=pool-of-threads
-# and run a number of tests
-
--- source include/have_pool_of_threads.inc
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='outer_join_with_cache=off';
-# Slow test, don't run during staging part
--- source include/not_staging.inc
--- source include/long_test.inc
--- source include/common-tests.inc
-SET optimizer_switch=@save_optimizer_switch;
-
-# Test that we cannot have more simultaneous connections than
-# --thread-pool-size on the standard port, but _can_ have additional
-# connections on the extra port.
-
-# First set two connections running, and check that extra connection
-# on normal port fails due to --thread-pool-max-threads=2.
-# We can afford using a really long sleep, because we won't wait
-# till it ends, we'll interrupt it as soon as we don't need it anymore
-
-connection default;
---let $con1_id= `SELECT CONNECTION_ID()`
-
-send SELECT sleep(50);
---sleep 1
-
-connect(con2,localhost,root,,);
---let $con2_id= `SELECT CONNECTION_ID()`
-
-send SELECT sleep(50);
---sleep 0.5
-
---disable_abort_on_error
---disable_result_log
---disable_query_log
-connect(con3,localhost,root,,,,,connect_timeout=2);
---enable_query_log
---enable_result_log
---enable_abort_on_error
-let $error = $mysql_errno;
-if (!$error)
-{
- --echo # -- Error: managed to establish more than --thread_pool_max_threads connections
-}
-if ($error)
-{
- --echo # -- Success: more than --thread_pool_max_threads normal connections not possible
-}
-
-connect(extracon,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,);
-connection extracon;
-SELECT 'Connection on extra port ok';
-
-# Here, sleep just for slightly longer than 5 sec to trigger MDEV-4566
-# (abort in interruptible wait connection check).
-send SELECT sleep(5.5);
-
-
-connect(extracon2,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,);
-connection extracon2;
-SELECT 'Connection on extra port 2 ok';
-
---disable_abort_on_error
---disable_result_log
---disable_query_log
-connect(extracon3,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,,connect_timeout=2);
---enable_query_log
---enable_result_log
---enable_abort_on_error
-let $error = $mysql_errno;
-if (!$error)
-{
- --echo # -- Error: managed to establish more than --extra-max-connections + 1 connections
-}
-if ($error)
-{
- --echo # -- Success: more than --extra-max-connections + 1 normal connections not possible
-}
-
-connection extracon2;
---replace_result $con1_id <default_connection_ID>
-eval KILL QUERY $con1_id;
---replace_result $con2_id <con2_connection_ID>
-eval KILL QUERY $con2_id;
-
-connection default;
---reap
-connection con2;
---reap
-
-connection extracon;
---reap
diff --git a/mysql-test/t/preload.test b/mysql-test/t/preload.test
deleted file mode 100644
index 69949fccedc..00000000000
--- a/mysql-test/t/preload.test
+++ /dev/null
@@ -1,105 +0,0 @@
-#
-# Testing of PRELOAD
-#
-
-# Slow test, don't run during staging part
--- source include/not_staging.inc
-
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-
-
-create table t1 (
- a int not null auto_increment,
- b char(16) not null,
- primary key (a),
- key (b)
-);
-
-create table t2(
- a int not null auto_increment,
- b char(16) not null,
- primary key (a),
- key (b)
-);
-
-insert into t1(b) values
- ('test0'),
- ('test1'),
- ('test2'),
- ('test3'),
- ('test4'),
- ('test5'),
- ('test6'),
- ('test7');
-
-insert into t2(b) select b from t1;
-insert into t1(b) select b from t2;
-insert into t2(b) select b from t1;
-insert into t1(b) select b from t2;
-insert into t2(b) select b from t1;
-insert into t1(b) select b from t2;
-insert into t2(b) select b from t1;
-insert into t1(b) select b from t2;
-insert into t2(b) select b from t1;
-insert into t1(b) select b from t2;
-insert into t2(b) select b from t1;
-insert into t1(b) select b from t2;
-insert into t2(b) select b from t1;
-insert into t1(b) select b from t2;
-insert into t2(b) select b from t1;
-insert into t1(b) select b from t2;
-insert into t2(b) select b from t1;
-insert into t1(b) select b from t2;
-
-select count(*) from t1;
-select count(*) from t2;
-
-flush tables; flush status;
-show status like "key_read%";
-
-select count(*) from t1 where b = 'test1';
-show status like "key_read%";
-select count(*) from t1 where b = 'test1';
-show status like "key_read%";
-
-flush tables; flush status;
-select @@preload_buffer_size;
-load index into cache t1;
-show status like "key_read%";
-select count(*) from t1 where b = 'test1';
-show status like "key_read%";
-
-flush tables; flush status;
-show status like "key_read%";
-set session preload_buffer_size=256*1024;
-select @@preload_buffer_size;
-load index into cache t1 ignore leaves;
-show status like "key_read%";
-select count(*) from t1 where b = 'test1';
-show status like "key_read%";
-
-flush tables; flush status;
-show status like "key_read%";
-set session preload_buffer_size=1*1024;
-select @@preload_buffer_size;
-load index into cache t1, t2 key (primary,b) ignore leaves;
-show status like "key_read%";
-select count(*) from t1 where b = 'test1';
-select count(*) from t2 where b = 'test1';
-show status like "key_read%";
-
-flush tables; flush status;
-show status like "key_read%";
-load index into cache t3, t2 key (primary,b) ;
-show status like "key_read%";
-
-flush tables; flush status;
-show status like "key_read%";
-load index into cache t3 key (b), t2 key (c) ;
-show status like "key_read%";
-
-drop table t1, t2;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/processlist.test b/mysql-test/t/processlist.test
deleted file mode 100644
index 4734c75c8d3..00000000000
--- a/mysql-test/t/processlist.test
+++ /dev/null
@@ -1,72 +0,0 @@
-#
-# MDEV-4578 information_schema.processlist reports incorrect value for Time (2147483647)
-#
-
-source include/have_debug.inc;
-source include/have_debug_sync.inc;
-
-let $tid= `SELECT CONNECTION_ID()`;
-SET DEBUG_SYNC = 'dispatch_command_before_set_time WAIT_FOR do_set_time';
-send SELECT 1;
-
-connect (con1,localhost,root,,);
-
-SET DEBUG_SYNC = 'fill_schema_processlist_after_unow SIGNAL do_set_time WAIT_FOR fill_schema_proceed';
---replace_result $tid TID
-send_eval SELECT ID, TIME,TIME_MS FROM INFORMATION_SCHEMA.PROCESSLIST WHERE CONCAT(":", ID, ":") = ":$tid:";
-
-connection default;
-reap;
-SET DEBUG_SYNC = 'now SIGNAL fill_schema_proceed';
-
-connection con1;
---replace_result $tid TID
-reap;
-set debug_sync='reset';
-connection default;
-
-#
-# MDEV-4683 query start_time not reset when going to sleep
-#
-
-connection con1;
-# This DBUG insertion triggers a DEBUG_SYNC signal "query_done" once
-# the below SELECT SLEEP(5) has gone from "Query" to "Sleep" command
-# state. (We cannot just set the DEBUG_SYNC directly here, because
-# then it can trigger at the end of the SET DEBUG_SYNC statement (or
-# at the end of the Prepare step of the SELECT, if --ps-protocol),
-# thus occuring too early).
-SET debug_dbug="+d,sleep_inject_query_done_debug_sync";
-select sleep(5); #run a query that will take some time
-connection default;
-
-# Need to ensure that the previous query has really completed. Otherwise,
-# the select could see the previous query still in "Query" stage in the
-# processlist.
-SET DEBUG_SYNC = 'now WAIT_FOR query_done';
-
-# verify that the time in COM_SLEEP doesn't include the query run time
-select command, time < 5 from information_schema.processlist where id != connection_id();
-
-disconnect con1;
-set debug_sync='reset';
-
-connection default;
-
-
---echo #
---echo # 10.1 tests
---echo #
-
---echo #
---echo # MDEV-7807 information_schema.processlist truncates queries with binary strings
---echo #
-
-SET NAMES utf8;
---vertical_results
-SELECT INFO, INFO_BINARY, 'xxx😎yyy' AS utf8mb4_string FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%xxx%yyy%';
---horizontal_results
-
---echo #
---echo # End of 10.1 tests
---echo #
diff --git a/mysql-test/t/profiling.test b/mysql-test/t/profiling.test
deleted file mode 100644
index 1e1aada7c15..00000000000
--- a/mysql-test/t/profiling.test
+++ /dev/null
@@ -1,263 +0,0 @@
---source include/have_profiling.inc
-
-# Verify that the protocol isn't violated if we ask for profiling info
-# before profiling has recorded anything.
-show profiles;
-show profile all;
-
-# default is OFF
-show session variables like 'profil%';
-select @@profiling;
-
-# But size is okay
-set @start_value= @@global.profiling_history_size;
-set global profiling_history_size=100;
-show global variables like 'profil%';
-
-# turn on for testing
-set session profiling = ON;
-set session profiling_history_size=30; # small enough to overflow
-
-# verify it is active
-show session variables like 'profil%';
-select @@profiling;
-
-# Profiling is a descriptive look into the way the server operated
-# in retrospect. Chad doesn't think it's wise to include the result
-# log, as this creates a proscriptive specification about how the
-# server should work in the future -- or it forces everyone who
-# changes the server significantly to record the test results again,
-# and that violates the spirit of our tests. Please don't include
-# execution-specific data here, as in all of the "show profile" and
-# information_schema.profiling results.
-
-create table t1 (
- a int,
- b int
-);
-insert into t1 values (1,1), (2,null), (3, 4);
-insert into t1 values (5,1), (6,null), (7, 4);
-insert into t1 values (1,1), (2,null), (3, 4);
-insert into t1 values (5,1), (6,null), (7, 4);
-select max(x) from (select sum(a) as x from t1 group by b) as teeone;
-insert into t1 select * from t1;
-select count(*) from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-select count(*) from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-select count(*) from t1;
-select sum(a) from t1;
-select sum(a) from t1 group by b;
-select sum(a) + sum(b) from t1 group by b;
-select max(x) from (select sum(a) as x from t1 group by b) as teeone;
-select '012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890' as big_string;
-
---enable_result_log
---replace_column 2 #
-show profiles;
-
---disable_result_log
-###--replace_column 2 # 3 # 4 #
-show profile for query 15;
-###--replace_column 2 # 3 # 4 #
-show profile cpu for query 15;
-###--replace_column 2 # 3 # 4 # 5 # 6 #
-show profile cpu, block io for query 15;
-###--replace_column 2 # 3 # 4 #
-show profile cpu for query 9 limit 2 offset 2;
-show profile cpu for query 10 limit 0;
---error 0,ER_WRONG_ARGUMENTS
-show profile cpu for query 65534;
-###--replace_column 2 #
-show profile memory;
-###--replace_column 2 # 3 # 4 #
-show profile block io;
-###--replace_column 2 # 3 # 4 #
-show profile context switches;
-###--replace_column 2 # 3 # 4 #
-show profile page faults;
-###--replace_column 2 # 3 # 4 #
-show profile ipc;
-###--replace_column 2 #
-show profile swaps limit 1 offset 2;
-###--replace_column 2 # 5 #
-show profile source;
-show profile all for query 0 limit 0;
-###--replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 11 # 12 # 13 # 16 #
-show profile all for query 15;
-###--replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 11 # 12 # 13 # 16 #
-
-select * from information_schema.profiling;
-select query_id, state, duration from information_schema.profiling;
-select query_id, sum(duration) from information_schema.profiling group by query_id;
-select query_id, count(*) from information_schema.profiling group by query_id;
-select sum(duration) from information_schema.profiling;
-
-# Broken down into number of stages and duration of each query.
-select query_id, count(*), sum(duration) from information_schema.profiling group by query_id;
-select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling;
-
-
---enable_result_log
-drop table if exists t1, t2, t3;
-create table t1 (id int );
-create table t2 (id int not null);
-create table t3 (id int not null primary key);
-insert into t1 values (1), (2), (3);
-insert into t2 values (1), (2), (3);
-insert into t3 values (1), (2), (3);
-
---replace_column 2 #
-show profiles;
-
-select * from t1;
---replace_column 2 #
-show profiles;
---echo This ^^ should end in "select * from t1;"
-
-delete from t1;
-insert into t1 values (1), (2), (3);
-insert into t1 values (1), (2), (3);
-
-select * from t1;
---replace_column 2 #
-show profiles;
-
-# Turning profiling off does freeze it
-set session profiling = OFF;
-select sum(id) from t1;
---replace_column 2 #
-show profiles;
-
-## Verify that the various juggling of THD contexts doesn't affect profiling.
-
-## Functions and procedures
-set session profiling = ON;
-select @@profiling;
-create function f1() returns varchar(50) return 'hello';
-select @@profiling;
-select * from t1 where id <> f1();
-select @@profiling;
-
-set session profiling = OFF;
-drop table if exists profile_log;
-create table profile_log (how_many int);
-
---disable_warnings
-drop procedure if exists p1;
-drop procedure if exists p2;
-drop procedure if exists p3;
---enable_warnings
-
-delimiter //;
-create procedure p1 ()
- modifies sql data
-begin
- set profiling = ON;
- select 'This p1 should show up in profiling';
- insert into profile_log select count(*) from information_schema.profiling;
-end//
-create procedure p2()
- deterministic
-begin
- set profiling = ON;
- call p1();
- select 'This p2 should show up in profiling';
-end//
-create procedure p3 ()
- reads sql data
-begin
- set profiling = ON;
- select 'This p3 should show up in profiling';
- show profile;
-end//
-delimiter ;//
-
---disable_result_log
---echo first call to p1
-call p1;
-select * from profile_log;
---echo second call to p1
-call p1;
-select * from profile_log;
---echo third call to p1
-call p1;
-select * from profile_log;
-set session profiling = OFF;
-call p2;
-set session profiling = OFF;
-call p3;
-
---replace_column 1 # 2 #
-show profiles;
---enable_result_log
-
-drop procedure if exists p1;
-drop procedure if exists p2;
-drop procedure if exists p3;
-drop table if exists profile_log;
-
-## Triggers
-set session profiling = ON;
-drop table if exists t2;
-create table t2 (id int not null);
-create trigger t2_bi before insert on t2 for each row set @x=0;
-select @@profiling;
-insert into t2 values (1), (2), (3);
-select @@profiling;
-
-## ALTER TABLE
-set session profiling = ON;
-drop table if exists t1, t2;
-create table t1 (id int not null primary key);
-create table t2 (id int not null primary key, id1 int not null);
-select @@profiling;
-alter table t2 add foreign key (id1) references t1 (id) on delete cascade;
-select @@profiling;
-
-## Table LOCKing
-lock table t1 write;
-select @@profiling;
-unlock table;
-select @@profiling;
-
-## Transactions
-set autocommit=0;
-select @@profiling, @@autocommit;
-begin;
-select @@profiling;
-insert into t1 values (1);
-insert into t2 values (1,1);
---echo testing referential integrity cascade
-delete from t1 where id = 1;
-select @@profiling;
---echo testing rollback
---disable_warnings
-rollback;
---enable_warnings
-select @@profiling;
---echo testing commit
-begin;
-select @@profiling;
-commit;
-select @@profiling;
-
-drop table if exists t1, t2, t3;
-drop view if exists v1;
-drop function if exists f1;
-
-## Multiple queries in one packet. Combo statements don't work with ps-proto.
-#--eval select 1; select 2; select 3;
-## two continuations, one starting
-#select state from information_schema.profiling where seq=1 order by query_id desc limit 3;
-
-
-## last thing in the file
-set session profiling = OFF;
-set global profiling_history_size= @start_value;
-##
---echo End of 5.0 tests
diff --git a/mysql-test/t/progress_976225.test b/mysql-test/t/progress_976225.test
deleted file mode 100644
index 885f9d69de2..00000000000
--- a/mysql-test/t/progress_976225.test
+++ /dev/null
@@ -1,8 +0,0 @@
---source include/have_innodb.inc
-
-CREATE TABLE t1 (a INT) ENGINE=InnoDB;
-CREATE TABLE t2 (b INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1),(2);
-INSERT INTO t2 VALUES (3),(4);
-OPTIMIZE TABLE t1, t2;
-drop table t1, t2;
diff --git a/mysql-test/t/ps-master.opt b/mysql-test/t/ps-master.opt
deleted file mode 100644
index 2ae67eedad8..00000000000
--- a/mysql-test/t/ps-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---log-output=table,file --slow-query-log --log-queries-not-using-indexes --general-log
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
deleted file mode 100644
index a2f7d3c7bdc..00000000000
--- a/mysql-test/t/ps.test
+++ /dev/null
@@ -1,4674 +0,0 @@
--- source include/not_embedded.inc
--- source include/have_log_bin.inc
-
-call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.');
-#
-# SQL Syntax for Prepared Statements test
-#
---disable_warnings
-drop table if exists t1,t2,t3,t4;
-
-drop database if exists mysqltest1;
-# Avoid wrong warnings if mysql_client_test fails
-drop database if exists client_test_db;
---enable_warnings
-
-create table t1
-(
- a int primary key,
- b char(10)
-);
-insert into t1 values (1,'one');
-insert into t1 values (2,'two');
-insert into t1 values (3,'three');
-insert into t1 values (4,'four');
-
-# basic functionality
-set @a=2;
-prepare stmt1 from 'select * from t1 where a <= ?';
-execute stmt1 using @a;
-set @a=3;
-execute stmt1 using @a;
-
-# non-existant statement
---error 1243
-deallocate prepare no_such_statement;
-
---error 1210
-execute stmt1;
-
-# Nesting ps commands is not allowed:
---error ER_UNSUPPORTED_PS
-prepare stmt2 from 'prepare nested_stmt from "select 1"';
-
---error ER_UNSUPPORTED_PS
-prepare stmt2 from 'execute stmt1';
-
---error ER_UNSUPPORTED_PS
-prepare stmt2 from 'deallocate prepare z';
-
-# PS insert
-prepare stmt3 from 'insert into t1 values (?,?)';
-set @arg1=5, @arg2='five';
-execute stmt3 using @arg1, @arg2;
-select * from t1 where a>3;
-
-# PS update
-prepare stmt4 from 'update t1 set a=? where b=?';
-set @arg1=55, @arg2='five';
-execute stmt4 using @arg1, @arg2;
-select * from t1 where a>3;
-
-# PS create/delete
-prepare stmt4 from 'create table t2 (a int)';
-execute stmt4;
-prepare stmt4 from 'drop table t2';
-execute stmt4;
-
-# Do something that will cause error
---error 1051
-execute stmt4;
-
-# placeholders in result field names.
-prepare stmt5 from 'select ? + a from t1';
-set @a=1;
-execute stmt5 using @a;
-
-execute stmt5 using @no_such_var;
-
-set @nullvar=1;
-set @nullvar=NULL;
-execute stmt5 using @nullvar;
-
-set @nullvar2=NULL;
-execute stmt5 using @nullvar2;
-
-# Check that multiple SQL statements are disabled inside PREPARE
---error 1064
-prepare stmt6 from 'select 1; select2';
-
---error 1064
-prepare stmt6 from 'insert into t1 values (5,"five"); select2';
-
-# This shouldn't parse
---error 1064
-explain prepare stmt6 from 'insert into t1 values (5,"five"); select2';
-
-create table t2
-(
- a int
-);
-
-insert into t2 values (0);
-
-# parameter is NULL
-set @arg00=NULL ;
-prepare stmt1 from 'select 1 FROM t2 where a=?' ;
-execute stmt1 using @arg00 ;
-
-# prepare using variables:
---error 1064
-prepare stmt1 from @nosuchvar;
-
-set @ivar= 1234;
---error 1064
-prepare stmt1 from @ivar;
-
-set @fvar= 123.4567;
---error 1064
-prepare stmt1 from @fvar;
-
-drop table t1,t2;
-deallocate prepare stmt3;
-deallocate prepare stmt4;
-deallocate prepare stmt5;
-
-#
-# Bug #4105: Server crash on attempt to prepare a statement with character
-# set introducer
-#
-PREPARE stmt1 FROM "select _utf8 'A' collate utf8_bin = ?";
-set @var='A';
-EXECUTE stmt1 USING @var;
-DEALLOCATE PREPARE stmt1;
-
-#
-# BUG#3486: FOUND_ROWS() fails inside stored procedure [and prepared statement]
-#
-create table t1 (id int);
-prepare stmt1 from "select FOUND_ROWS()";
-select SQL_CALC_FOUND_ROWS * from t1;
-# Expect 0
-execute stmt1;
-insert into t1 values (1);
-select SQL_CALC_FOUND_ROWS * from t1;
-# Expect 1
-execute stmt1;
-# Expect 0
-execute stmt1;
-deallocate prepare stmt1;
-drop table t1;
-
-#
-# prepared EXPLAIN
-#
-create table t1
-(
- c1 tinyint, c2 smallint, c3 mediumint, c4 int,
- c5 integer, c6 bigint, c7 float, c8 double,
- c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
- c13 date, c14 datetime, c15 timestamp, c16 time,
- c17 year, c18 bit, c19 bool, c20 char,
- c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
- c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
- c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
- c32 set('monday', 'tuesday', 'wednesday')
-) engine = MYISAM ;
-create table t2 like t1;
-
-set @save_optimizer_switch=@@optimizer_switch;
-set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=off";
-
-set @tmp_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='derived_merge=off,derived_with_keys=off';
-
-set @stmt= ' 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 ' ;
-prepare stmt1 from @stmt ;
-execute stmt1 ;
-execute stmt1 ;
-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;
-deallocate prepare stmt1;
-
-set optimizer_switch=@tmp_optimizer_switch;
-
-drop tables t1,t2;
-
-set @@optimizer_switch=@save_optimizer_switch;
-
-#
-# parameters from variables (for field creation)
-#
-set @arg00=1;
-prepare stmt1 from ' create table t1 (m int) as select 1 as m ' ;
-execute stmt1 ;
-select m from t1;
-drop table t1;
-prepare stmt1 from ' create table t1 (m int) as select ? as m ' ;
-execute stmt1 using @arg00;
-select m from t1;
-deallocate prepare stmt1;
-drop table t1;
-
-#
-# eq() for parameters
-#
-create table t1 (id int(10) unsigned NOT NULL default '0',
- name varchar(64) NOT NULL default '',
- PRIMARY KEY (id), UNIQUE KEY `name` (`name`));
-insert into t1 values (1,'1'),(2,'2'),(3,'3'),(4,'4'),(5,'5'),(6,'6'),(7,'7');
-prepare stmt1 from 'select name from t1 where id=? or id=?';
-set @id1=1,@id2=6;
-execute stmt1 using @id1, @id2;
-select name from t1 where id=1 or id=6;
-deallocate prepare stmt1;
-drop table t1;
-
-#
-# SHOW TABLE STATUS test
-#
-create table t1 ( a int primary key, b varchar(30)) engine = MYISAM ;
-prepare stmt1 from ' show table status from test like ''t1%'' ';
---replace_column 8 4294967295 12 # 13 # 14 #
-execute stmt1;
---replace_column 8 4294967295 12 # 13 # 14 #
-show table status from test like 't1%' ;
-deallocate prepare stmt1 ;
-drop table t1;
-
-#
-# Bug#4912 "mysqld crashs in case a statement is executed a second time":
-# negation elimination should work once and not break prepared statements
-#
-
-create table t1(a varchar(2), b varchar(3));
-prepare stmt1 from "select a, b from t1 where (not (a='aa' and b < 'zzz'))";
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-drop table t1;
-
-#
-# Bug#5034 "prepared "select 1 into @arg15", second execute crashes
-# server".
-# Check that descendands of select_result can be reused in prepared
-# statements or are correctly created and deleted on each execute
-#
-
---let $outfile=$MYSQLTEST_VARDIR/tmp/f1.txt
---error 0,1
---remove_file $outfile
-
-prepare stmt1 from "select 1 into @var";
-execute stmt1;
-execute stmt1;
-prepare stmt1 from "create table t1 select 1 as i";
---disable_warnings ONCE
-execute stmt1;
-drop table t1;
---disable_warnings ONCE
-execute stmt1;
-prepare stmt1 from "insert into t1 select i from t1";
-execute stmt1;
-execute stmt1;
---replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
-eval prepare stmt1 from "select * from t1 into outfile '$outfile'";
-execute stmt1;
-deallocate prepare stmt1;
-drop table t1;
-
---remove_file $outfile
-
-#
-# BUG#5242 "Prepared statement names are case sensitive"
-#
-prepare stmt1 from 'select 1';
-prepare STMT1 from 'select 2';
-execute sTmT1;
-deallocate prepare StMt1;
-
---error 1243
-deallocate prepare Stmt1;
-
-# also check that statement names are in right charset.
-set names utf8;
-prepare `ü` from 'select 1234';
-execute `ü` ;
-set names latin1;
-execute `ü`;
-deallocate prepare `ü`;
-set names default;
-
-
-#
-# BUG#4368 "select * from t1 where a like ?" crashes server if a is in utf8
-# and ? is in latin1
-# Check that Item converting latin1 to utf8 (for LIKE function) is created
-# in memory of prepared statement.
-#
-
-create table t1 (a varchar(10)) charset=utf8;
-insert into t1 (a) values ('yahoo');
-set character_set_connection=latin1;
-prepare stmt from 'select a from t1 where a like ?';
-set @var='google';
-execute stmt using @var;
-execute stmt using @var;
-deallocate prepare stmt;
-drop table t1;
-
-#
-# BUG#5510 "inserting Null in AutoIncrement primary key Column Fails"
-# (prepared statements)
-# The cause: misuse of internal MySQL 'Field' API.
-#
-
-create table t1 (a bigint(20) not null primary key auto_increment);
-insert into t1 (a) values (null);
-select * from t1;
-prepare stmt from "insert into t1 (a) values (?)";
-set @var=null;
-execute stmt using @var;
-select * from t1;
-drop table t1;
-#
-# check the same for timestamps
-#
-create table t1 (a timestamp not null);
-prepare stmt from "insert into t1 (a) values (?)";
-execute stmt using @var;
---disable_result_log
-select * from t1;
---enable_result_log
-deallocate prepare stmt;
-drop table t1;
-
-#
-# BUG#5688 "Upgraded 4.1.5 Server seg faults" # (prepared statements)
-# The test case speaks for itself.
-# Just another place where we used wrong memory root for Items created
-# during statement prepare.
-#
-prepare stmt from "select 'abc' like convert('abc' using utf8)";
-execute stmt;
-execute stmt;
-deallocate prepare stmt;
-
-#
-# BUG#5748 "Prepared statement with BETWEEN and bigint values crashes
-# mysqld". Just another place where an item tree modification must be
-# rolled back.
-#
-create table t1 ( a bigint );
-prepare stmt from 'select a from t1 where a between ? and ?';
-set @a=1;
-execute stmt using @a, @a;
-execute stmt using @a, @a;
-execute stmt using @a, @a;
-drop table t1;
-deallocate prepare stmt;
-
-#
-# Bug #5987 subselect in bool function crashes server (prepared statements):
-# don't overwrite transformed subselects with old arguments of a bool
-# function.
-#
-create table t1 (a int);
-prepare stmt from "select * from t1 where 1 > (1 in (SELECT * FROM t1))";
-execute stmt;
-execute stmt;
-execute stmt;
-drop table t1;
-deallocate prepare stmt;
-
-#
-# Test case for Bug#6042 "constants propogation works only once (prepared
-# statements): check that the query plan changes whenever we change
-# placeholder value.
-#
-create table t1 (a int, b int);
-insert into t1 (a, b) values (1,1), (1,2), (2,1), (2,2);
-prepare stmt from
-"explain select * from t1 where t1.a=2 and t1.a=t1.b and t1.b > 1 + ?";
-set @v=5;
---replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 -
-execute stmt using @v;
-set @v=0;
---replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 -
-execute stmt using @v;
-set @v=5;
---replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 -
-execute stmt using @v;
-drop table t1;
-deallocate prepare stmt;
-
-#
-# A test case for Bug#5985 prepare stmt from "select rand(?)" crashes
-# server. Check that Item_func_rand is prepared-statements friendly.
-#
-create table t1 (a int);
-insert into t1 (a) values (1), (2), (3), (4);
-set @precision=10000000000;
---replace_column 1 - 3 -
-select rand(),
- cast(rand(10)*@precision as unsigned integer) from t1;
-prepare stmt from
-"select rand(),
- cast(rand(10)*@precision as unsigned integer),
- cast(rand(?)*@precision as unsigned integer) from t1";
-set @var=1;
---replace_column 1 - 3 -
-execute stmt using @var;
-set @var=2;
---replace_column 1 -
-execute stmt using @var;
-set @var=3;
---replace_column 1 -
-execute stmt using @var;
-drop table t1;
-deallocate prepare stmt;
-
-#
-# A test case for Bug#6050 "EXECUTE stmt reports ambiguous fieldnames with
-# identical tables from different schemata"
-# Check that field name resolving in prepared statements works OK.
-#
-create database mysqltest1;
-create table t1 (a int);
-create table mysqltest1.t1 (a int);
-select * from t1, mysqltest1.t1;
-prepare stmt from "select * from t1, mysqltest1.t1";
-execute stmt;
-execute stmt;
-execute stmt;
-drop table t1;
-drop table mysqltest1.t1;
-drop database mysqltest1;
-deallocate prepare stmt;
-select '1.1' as a, '1.2' as a UNION SELECT '2.1', '2.2';
-prepare stmt from
-"select '1.1' as a, '1.2' as a UNION SELECT '2.1', '2.2'";
-execute stmt;
-execute stmt;
-execute stmt;
-deallocate prepare stmt;
-
-#
-# Test CREATE TABLE ... SELECT (Bug #6094)
-#
-create table t1 (a int);
-insert into t1 values (1),(2),(3);
-create table t2 select * from t1;
---disable_warnings
-prepare stmt FROM 'create table t2 select * from t1';
-drop table t2;
-execute stmt;
-drop table t2;
-execute stmt;
---error 1050
-execute stmt;
-drop table t2;
-execute stmt;
---enable_warnings
-drop table t1,t2;
-deallocate prepare stmt;
-
-#
-# Bug#6088 "FOUND_ROWS returns wrong values for prepared statements when
-# LIMIT is used"
-#
-create table t1 (a int);
-insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
-prepare stmt from "select sql_calc_found_rows * from t1 limit 2";
-execute stmt;
-select found_rows();
-execute stmt;
-select found_rows();
-execute stmt;
-select found_rows();
-deallocate prepare stmt;
-drop table t1;
-
-#
-# Bug#6047 "permission problem when executing mysql_stmt_execute with derived
-# table"
-#
-
-CREATE TABLE t1 (N int, M tinyint);
-INSERT INTO t1 VALUES (1,0),(1,0),(2,0),(2,0),(3,0);
-PREPARE stmt FROM 'UPDATE t1 AS P1 INNER JOIN (SELECT N FROM t1 GROUP BY N HAVING COUNT(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2';
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-DROP TABLE t1;
-
-#
-# Bug#6297 "prepared statement, wrong handling of <parameter> IS NULL"
-# Test that placeholders work with IS NULL/IS NOT NULL clauses.
-#
-prepare stmt from "select ? is null, ? is not null, ?";
-select @no_such_var is null, @no_such_var is not null, @no_such_var;
-execute stmt using @no_such_var, @no_such_var, @no_such_var;
-set @var='abc';
-select @var is null, @var is not null, @var;
-execute stmt using @var, @var, @var;
-set @var=null;
-select @var is null, @var is not null, @var;
-execute stmt using @var, @var, @var;
-
-#
-# Bug#6873 "PS, having with subquery, crash during execute"
-# check that if we modify having subtree, we update JOIN->having pointer
-#
-create table t1 (pnum char(3));
-create table t2 (pnum char(3));
-prepare stmt from "select pnum from t2 having pnum in (select 'p1' from t1)";
-execute stmt;
-execute stmt;
-execute stmt;
-deallocate prepare stmt;
-drop table t1, t2;
-
-#
-#
-# Bug#19399 "Stored Procedures 'Lost Connection' when dropping/creating
-# tables"
-# Check that multi-delete tables are also cleaned up before re-execution.
-#
---disable_warnings
-drop table if exists t1;
-create temporary table if not exists t1 (a1 int);
---enable_warnings
-# exact delete syntax is essential
-prepare stmt from "delete t1 from t1 where (cast(a1/3 as unsigned) * 3) = a1";
-drop temporary table t1;
-create temporary table if not exists t1 (a1 int);
-# the server crashed on the next statement without the fix
-execute stmt;
-drop temporary table t1;
-create temporary table if not exists t1 (a1 int);
-# the problem was in memory corruption: repeat the test just in case
-execute stmt;
-drop temporary table t1;
-create temporary table if not exists t1 (a1 int);
-execute stmt;
-drop temporary table t1;
-deallocate prepare stmt;
-
-# Bug#6102 "Server crash with prepared statement and blank after
-# function name"
-# ensure that stored functions are cached when preparing a statement
-# before we open tables
-#
-create table t1 (a varchar(20));
-insert into t1 values ('foo');
-prepare stmt FROM 'SELECT char_length (a) FROM t1';
--- error ER_SP_DOES_NOT_EXIST
-prepare stmt2 FROM 'SELECT not_a_function (a) FROM t1';
-drop table t1;
-
-#
-# Bug #6089: FOUND_ROWS returns wrong values when no table/view is used
-#
-
-prepare stmt from "SELECT SQL_CALC_FOUND_ROWS 'foo' UNION SELECT 'bar' LIMIT 0";
-execute stmt;
-SELECT FOUND_ROWS();
-execute stmt;
-SELECT FOUND_ROWS();
-deallocate prepare stmt;
-
-#
-# Bug#9096 "select doesn't return all matched records if prepared statements
-# is used"
-# The bug was is bad co-operation of the optimizer's algorithm which determines
-# which keys can be used to execute a query, constants propagation
-# part of the optimizer and parameter markers used by prepared statements.
-
-drop table if exists t1;
-create table t1 (c1 int(11) not null, c2 int(11) not null,
- primary key (c1,c2), key c2 (c2), key c1 (c1));
-
-insert into t1 values (200887, 860);
-insert into t1 values (200887, 200887);
-
-select * from t1 where (c1=200887 and c2=200887) or c2=860;
-
-prepare stmt from
-"select * from t1 where (c1=200887 and c2=200887) or c2=860";
-execute stmt;
-prepare stmt from
-"select * from t1 where (c1=200887 and c2=?) or c2=?";
-set @a=200887, @b=860;
-# this query did not return all matching rows
-execute stmt using @a, @b;
-deallocate prepare stmt;
-
-drop table t1;
-
-#
-# Bug#9777 - another occurrence of the problem stated in Bug#9096:
-# we can not compare basic constants by their names, because a placeholder
-# is a basic constant while his name is always '?'
-#
-
-create table t1 (
- id bigint(20) not null auto_increment,
- code varchar(20) character set utf8 collate utf8_bin not null default '',
- company_name varchar(250) character set utf8 collate utf8_bin default null,
- setup_mode tinyint(4) default null,
- start_date datetime default null,
- primary key (id), unique key code (code)
-);
-
-create table t2 (
- id bigint(20) not null auto_increment,
- email varchar(250) character set utf8 collate utf8_bin default null,
- name varchar(250) character set utf8 collate utf8_bin default null,
- t1_id bigint(20) default null,
- password varchar(250) character set utf8 collate utf8_bin default null,
- primary_contact tinyint(4) not null default '0',
- email_opt_in tinyint(4) not null default '1',
- primary key (id), unique key email (email), key t1_id (t1_id),
- constraint t2_fk1 foreign key (t1_id) references t1 (id)
-);
-
-insert into t1 values
-(1, 'demo', 'demo s', 0, current_date()),
-(2, 'code2', 'name 2', 0, current_date()),
-(3, 'code3', 'name 3', 0, current_date());
-
-insert into t2 values
-(2, 'email1', 'name1', 3, 'password1', 0, 0),
-(3, 'email2', 'name1', 1, 'password2', 1, 0),
-(5, 'email3', 'name3', 2, 'password3', 0, 0);
-
-prepare stmt from 'select t2.id from t2, t1 where (t1.id=? and t2.t1_id=t1.id)';
-set @a=1;
-execute stmt using @a;
-
-select t2.id from t2, t1 where (t1.id=1 and t2.t1_id=t1.id);
-
-deallocate prepare stmt;
-drop table t1, t2;
-
-#
-# Bug#11060 "Server crashes on calling stored procedure with INSERT SELECT
-# UNION SELECT" aka "Server crashes on re-execution of prepared INSERT ...
-# SELECT with UNION".
-#
-create table t1 (id int);
-prepare stmt from "insert into t1 (id) select id from t1 union select id from t1";
-execute stmt;
-execute stmt;
-deallocate prepare stmt;
-drop table t1;
-#
-# Bug#11458 "Prepared statement with subselects return random data":
-# drop PARAM_TABLE_BIT from the list of tables used by a subquery
-#
-create table t1 (
- id int(11) unsigned not null primary key auto_increment,
- partner_id varchar(35) not null,
- t1_status_id int(10) unsigned
-);
-
-insert into t1 values ("1", "partner1", "10"), ("2", "partner2", "10"),
- ("3", "partner3", "10"), ("4", "partner4", "10");
-
-create table t2 (
- id int(11) unsigned not null default '0',
- t1_line_id int(11) unsigned not null default '0',
- article_id varchar(20),
- sequence int(11) not null default '0',
- primary key (id,t1_line_id)
-);
-
-insert into t2 values ("1", "1", "sup", "0"), ("2", "1", "sup", "1"),
- ("2", "2", "sup", "2"), ("2", "3", "sup", "3"),
- ("2", "4", "imp", "4"), ("3", "1", "sup", "0"),
- ("4", "1", "sup", "0");
-
-create table t3 (
- id int(11) not null default '0',
- preceding_id int(11) not null default '0',
- primary key (id,preceding_id)
-);
-
-create table t4 (
- user_id varchar(50) not null,
- article_id varchar(20) not null,
- primary key (user_id,article_id)
-);
-
-insert into t4 values("nicke", "imp");
-
-prepare stmt from
-'select distinct t1.partner_id
-from t1 left join t3 on t1.id = t3.id
- left join t1 pp on pp.id = t3.preceding_id
-where
- exists (
- select *
- from t2 as pl_inner
- where pl_inner.id = t1.id
- and pl_inner.sequence <= (
- select min(sequence) from t2 pl_seqnr
- where pl_seqnr.id = t1.id
- )
- and exists (
- select * from t4
- where t4.article_id = pl_inner.article_id
- and t4.user_id = ?
- )
- )
- and t1.id = ?
-group by t1.id
-having count(pp.id) = 0';
-set @user_id = 'nicke';
-set @id = '2';
-execute stmt using @user_id, @id;
-execute stmt using @user_id, @id;
-deallocate prepare stmt;
-drop table t1, t2, t3, t4;
-#
-# Bug#9379: make sure that Item::collation is reset when one sets
-# a parameter marker from a string variable.
-#
-prepare stmt from 'select ?=?';
-set @a='CHRISTINE ';
-set @b='CHRISTINE';
-execute stmt using @a, @b;
-execute stmt using @a, @b;
-set @a=1, @b=2;
-execute stmt using @a, @b;
-set @a='CHRISTINE ';
-set @b='CHRISTINE';
-execute stmt using @a, @b;
-deallocate prepare stmt;
-#
-# Bug#11299 "prepared statement makes wrong SQL syntax in binlog which stops
-# replication": check that errouneous queries with placeholders are not
-# allowed
-#
-create table t1 (a int);
---error 1064
-prepare stmt from "select ??";
---error 1064
-prepare stmt from "select ?FROM t1";
---error 1064
-prepare stmt from "select FROM t1 WHERE?=1";
---error 1064
-prepare stmt from "update t1 set a=a+?WHERE 1";
---disable_ps_protocol
---error 1064
-select ?;
---error 1064
-select ??;
---error 1064
-select ? from t1;
---enable_ps_protocol
-drop table t1;
-#
-# Bug#9359 "Prepared statements take snapshot of system vars at PREPARE
-# time"
-#
-prepare stmt from "select @@time_zone";
-execute stmt;
-set @@time_zone:='Japan';
-execute stmt;
-prepare stmt from "select @@tx_isolation";
-execute stmt;
-set transaction isolation level read committed;
-execute stmt;
-set transaction isolation level serializable;
-execute stmt;
-set @@tx_isolation=default;
-execute stmt;
-deallocate prepare stmt;
-
-#
-# Bug#14410 "Crash in Enum or Set type in CREATE TABLE and PS/SP"
-#
-# Part I. Make sure the typelib for ENUM is created in the statement memory
-# root.
-prepare stmt from "create temporary table t1 (letter enum('','a','b','c')
-not null)";
-execute stmt;
-drop table t1;
-execute stmt;
-drop table t1;
-execute stmt;
-drop table t1;
-# Part II. Make sure that when the default value is converted to UTF-8,
-# the new item is # created in the statement memory root.
-set names latin1;
-prepare stmt from "create table t1 (a enum('test') default 'test')
- character set utf8";
-execute stmt;
-drop table t1;
-execute stmt;
-drop table t1;
-execute stmt;
-drop table t1;
-# Cleanup
-set names default;
-deallocate prepare stmt;
-
-#
-# A test case for Bug#12734 "prepared statement may return incorrect result
-# set for a select SQL request": test that canDoTurboBM is reset for each
-# execute of a prepared statement.
-#
-create table t1 (
- word_id mediumint(8) unsigned not null default '0',
- formatted varchar(20) not null default ''
-);
-
-insert into t1 values
- (80,'pendant'), (475,'pretendants'), (989,'tendances'),
- (1019,'cependant'),(1022,'abondance'),(1205,'independants'),
- (13,'lessiver'),(25,'lambiner'),(46,'situer'),(71,'terminer'),
- (82,'decrocher');
-
-select count(*) from t1 where formatted like '%NDAN%';
-select count(*) from t1 where formatted like '%ER';
-prepare stmt from "select count(*) from t1 where formatted like ?";
-set @like="%NDAN%";
-execute stmt using @like;
-set @like="%ER";
-execute stmt using @like;
-set @like="%NDAN%";
-execute stmt using @like;
-set @like="%ER";
-execute stmt using @like;
-deallocate prepare stmt;
-drop table t1;
-
-#
-# Bug#13134 "Length of VARCHAR() utf8 column is increasing when table is
-# recreated with PS/SP"
-#
-
-prepare stmt from 'create table t1 (a varchar(10) character set utf8)';
-execute stmt;
---disable_warnings
-insert ignore into t1 (a) values (repeat('a', 20));
---enable_warnings
-select length(a) from t1;
-drop table t1;
-execute stmt;
---disable_warnings
-insert ignore into t1 (a) values (repeat('a', 20));
---enable_warnings
-# Check that the data is truncated to the same length
-select length(a) from t1;
-drop table t1;
-deallocate prepare stmt;
-
-#
-# Bug#16248 "WHERE (col1,col2) IN ((?,?)) gives wrong results":
-# check that ROW implementation is reexecution-friendly.
-#
-create table t1 (col1 integer, col2 integer);
-insert into t1 values(100,100),(101,101),(102,102),(103,103);
-prepare stmt from 'select col1, col2 from t1 where (col1, col2) in ((?,?))';
-set @a=100, @b=100;
-execute stmt using @a,@b;
-set @a=101, @b=101;
-execute stmt using @a,@b;
-set @a=102, @b=102;
-execute stmt using @a,@b;
-set @a=102, @b=103;
-execute stmt using @a,@b;
-deallocate prepare stmt;
-drop table t1;
-
-#
-# Bug#16365 Prepared Statements: DoS with too many open statements
-# Check that the limit @@max_prpeared_stmt_count works.
-#
-# This is also the test for bug#23159 prepared_stmt_count should be
-# status variable.
-#
-# Save the old value
-set @old_max_prepared_stmt_count= @@max_prepared_stmt_count;
-#
-# Disable prepared statement protocol: in this test we set
-# @@max_prepared_stmt_count to 0 or 1 and would like to test the limit
-# manually.
-#
---disable_ps_protocol
-#
-# A. Check that the new variables are present in SHOW VARIABLES and
-# SHOW STATUS lists.
-#
-show variables like 'max_prepared_stmt_count';
-show status like 'prepared_stmt_count';
-#
-# B. Check that the new system variable is selectable.
-#
-select @@max_prepared_stmt_count;
-#
-# C. Check that max_prepared_stmt_count is settable (global only).
-#
-set global max_prepared_stmt_count=-1;
-select @@max_prepared_stmt_count;
-set global max_prepared_stmt_count=10000000000000000;
-select @@max_prepared_stmt_count;
-set global max_prepared_stmt_count=default;
-select @@max_prepared_stmt_count;
---error ER_GLOBAL_VARIABLE
-set @@max_prepared_stmt_count=1;
---error ER_GLOBAL_VARIABLE
-set max_prepared_stmt_count=1;
---error ER_GLOBAL_VARIABLE
-set local max_prepared_stmt_count=1;
-# set to a reasonable limit works
-set global max_prepared_stmt_count=1;
-select @@max_prepared_stmt_count;
-#
-# D. Check that the variables actually work.
-#
-set global max_prepared_stmt_count=0;
-select @@max_prepared_stmt_count;
-show status like 'prepared_stmt_count';
---error ER_MAX_PREPARED_STMT_COUNT_REACHED
-prepare stmt from "select 1";
-show status like 'prepared_stmt_count';
-set global max_prepared_stmt_count=1;
-prepare stmt from "select 1";
-show status like 'prepared_stmt_count';
---error ER_MAX_PREPARED_STMT_COUNT_REACHED
-prepare stmt1 from "select 1";
-show status like 'prepared_stmt_count';
-deallocate prepare stmt;
-show status like 'prepared_stmt_count';
-#
-# E. Check that we can prepare a statement with the same name
-# successfully, without hitting the limit.
-#
-prepare stmt from "select 1";
-show status like 'prepared_stmt_count';
-prepare stmt from "select 2";
-show status like 'prepared_stmt_count';
-#
-# F. We can set the max below the current count. In this case no new
-# statements should be allowed to prepare.
-#
-show status like 'prepared_stmt_count';
-select @@max_prepared_stmt_count;
-set global max_prepared_stmt_count=0;
---error ER_MAX_PREPARED_STMT_COUNT_REACHED
-prepare stmt from "select 1";
-# Result: the old statement is deallocated, the new is not created.
---error ER_UNKNOWN_STMT_HANDLER
-execute stmt;
-show status like 'prepared_stmt_count';
---error ER_MAX_PREPARED_STMT_COUNT_REACHED
-prepare stmt from "select 1";
-show status like 'prepared_stmt_count';
-#
-# G. Show that the variables are up to date even after a connection with all
-# statements in it was terminated.
-#
-set global max_prepared_stmt_count=3;
-select @@max_prepared_stmt_count;
-show status like 'prepared_stmt_count';
-prepare stmt from "select 1";
-
-connect (con1,localhost,root,,);
-
-# Switch to connection con1
-connection con1;
-let $con1_id=`SELECT CONNECTION_ID()`;
-
-prepare stmt from "select 2";
-prepare stmt1 from "select 3";
---error ER_MAX_PREPARED_STMT_COUNT_REACHED
-prepare stmt2 from "select 4";
-connection default;
---error ER_MAX_PREPARED_STMT_COUNT_REACHED
-prepare stmt2 from "select 4";
-select @@max_prepared_stmt_count;
-show status like 'prepared_stmt_count';
-
-# Disconnect connection con1 and switch to default connection
-disconnect con1;
-connection default;
-
-# Wait for the connection con1 to die
-let $wait_condition=SELECT COUNT(*)=0 FROM information_schema.processlist WHERE id=$con1_id;
---source include/wait_condition.inc
-
-deallocate prepare stmt;
-
-select @@max_prepared_stmt_count;
-show status like 'prepared_stmt_count';
-#
-# Restore the old value.
-#
-set global max_prepared_stmt_count= @old_max_prepared_stmt_count;
---enable_ps_protocol
-
-
-#
-# Bug#19399 "Stored Procedures 'Lost Connection' when dropping/creating
-# tables"
-# Check that multi-delete tables are also cleaned up before re-execution.
-#
---disable_warnings
-drop table if exists t1;
-create temporary table if not exists t1 (a1 int);
---enable_warnings
-# exact delete syntax is essential
-prepare stmt from "delete t1 from t1 where (cast(a1/3 as unsigned) * 3) = a1";
-drop temporary table t1;
-create temporary table if not exists t1 (a1 int);
-# the server crashed on the next statement without the fix
-execute stmt;
-drop temporary table t1;
-create temporary table if not exists t1 (a1 int);
-# the problem was in memory corruption: repeat the test just in case
-execute stmt;
-drop temporary table t1;
-create temporary table if not exists t1 (a1 int);
-execute stmt;
-drop temporary table t1;
-deallocate prepare stmt;
-
-
-#
-# BUG#22085: Crash on the execution of a prepared statement that
-# uses an IN subquery with aggregate functions in HAVING
-#
-
-CREATE TABLE t1(
- ID int(10) unsigned NOT NULL auto_increment,
- Member_ID varchar(15) NOT NULL default '',
- Action varchar(12) NOT NULL,
- Action_Date datetime NOT NULL,
- Track varchar(15) default NULL,
- User varchar(12) default NULL,
- Date_Updated timestamp NOT NULL default CURRENT_TIMESTAMP on update
- CURRENT_TIMESTAMP,
- PRIMARY KEY (ID),
- KEY Action (Action),
- KEY Action_Date (Action_Date)
-);
-
-INSERT INTO t1(Member_ID, Action, Action_Date, Track) VALUES
- ('111111', 'Disenrolled', '2006-03-01', 'CAD' ),
- ('111111', 'Enrolled', '2006-03-01', 'CAD' ),
- ('111111', 'Disenrolled', '2006-07-03', 'CAD' ),
- ('222222', 'Enrolled', '2006-03-07', 'CAD' ),
- ('222222', 'Enrolled', '2006-03-07', 'CHF' ),
- ('222222', 'Disenrolled', '2006-08-02', 'CHF' ),
- ('333333', 'Enrolled', '2006-03-01', 'CAD' ),
- ('333333', 'Disenrolled', '2006-03-01', 'CAD' ),
- ('444444', 'Enrolled', '2006-03-01', 'CAD' ),
- ('555555', 'Disenrolled', '2006-03-01', 'CAD' ),
- ('555555', 'Enrolled', '2006-07-21', 'CAD' ),
- ('555555', 'Disenrolled', '2006-03-01', 'CHF' ),
- ('666666', 'Enrolled', '2006-02-09', 'CAD' ),
- ('666666', 'Enrolled', '2006-05-12', 'CHF' ),
- ('666666', 'Disenrolled', '2006-06-01', 'CAD' );
-
-PREPARE STMT FROM
-"SELECT GROUP_CONCAT(Track SEPARATOR ', ') FROM t1
- WHERE Member_ID=? AND Action='Enrolled' AND
- (Track,Action_Date) IN (SELECT Track, MAX(Action_Date) FROM t1
- WHERE Member_ID=?
- GROUP BY Track
- HAVING Track>='CAD' AND
- MAX(Action_Date)>'2006-03-01')";
-SET @id='111111';
-EXECUTE STMT USING @id,@id;
-SET @id='222222';
-EXECUTE STMT USING @id,@id;
-
-DEALLOCATE PREPARE STMT;
-DROP TABLE t1;
-
-#
-# BUG#21354: (COUNT(*) = 1) not working in SELECT inside prepared
-# statement
-#
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (i INT, INDEX(i));
-INSERT INTO t1 VALUES (1);
-
-PREPARE stmt FROM "SELECT (COUNT(i) = 1), COUNT(i) FROM t1 WHERE i = ?";
-SET @a = 0;
-EXECUTE stmt USING @a;
-SET @a = 1;
-EXECUTE stmt USING @a;
-SET @a = 0;
-EXECUTE stmt USING @a;
-
-PREPARE stmt FROM "SELECT (AVG(i) = 1), AVG(i) FROM t1 WHERE i = ?";
-SET @a = 0;
-EXECUTE stmt USING @a;
-SET @a = 1;
-EXECUTE stmt USING @a;
-SET @a = 0;
-EXECUTE stmt USING @a;
-
-PREPARE stmt FROM "SELECT (VARIANCE(i) = 1), VARIANCE(i) FROM t1 WHERE i = ?";
-SET @a = 0;
-EXECUTE stmt USING @a;
-SET @a = 1;
-EXECUTE stmt USING @a;
-SET @a = 0;
-EXECUTE stmt USING @a;
-
-PREPARE stmt FROM "SELECT (STDDEV(i) = 1), STDDEV(i) FROM t1 WHERE i = ?";
-SET @a = 0;
-EXECUTE stmt USING @a;
-SET @a = 1;
-EXECUTE stmt USING @a;
-SET @a = 0;
-EXECUTE stmt USING @a;
-
-PREPARE stmt FROM "SELECT (BIT_OR(i) = 1), BIT_OR(i) FROM t1 WHERE i = ?";
-SET @a = 0;
-EXECUTE stmt USING @a;
-SET @a = 1;
-EXECUTE stmt USING @a;
-SET @a = 0;
-EXECUTE stmt USING @a;
-
-PREPARE stmt FROM "SELECT (BIT_AND(i) = 1), BIT_AND(i) FROM t1 WHERE i = ?";
-SET @a = 0;
-EXECUTE stmt USING @a;
-SET @a = 1;
-EXECUTE stmt USING @a;
-SET @a = 0;
-EXECUTE stmt USING @a;
-
-PREPARE stmt FROM "SELECT (BIT_XOR(i) = 1), BIT_XOR(i) FROM t1 WHERE i = ?";
-SET @a = 0;
-EXECUTE stmt USING @a;
-SET @a = 1;
-EXECUTE stmt USING @a;
-SET @a = 0;
-EXECUTE stmt USING @a;
-
-DEALLOCATE PREPARE stmt;
-DROP TABLE t1;
-
-#
-# Bug#19182: CREATE TABLE bar (m INT) SELECT n FROM foo; doesn't work
-# from stored procedure.
-#
-# The cause of a bug was that cached LEX::create_list was modified,
-# and then together with LEX::key_list was reset.
-#
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-CREATE TABLE t1 (i INT);
-
-PREPARE st_19182
-FROM "CREATE TABLE t2 (i INT, j INT, KEY (i), KEY(j)) SELECT i FROM t1";
-
-EXECUTE st_19182;
-DESC t2;
-
-DROP TABLE t2;
-
-# Check that on second execution we don't loose 'j' column and the keys
-# on 'i' and 'j' columns.
-EXECUTE st_19182;
-DESC t2;
-
-DEALLOCATE PREPARE st_19182;
-DROP TABLE t2, t1;
-
-#
-# Bug #22060 "ALTER TABLE x AUTO_INCREMENT=y in SP crashes server"
-#
-# Code which implemented CREATE/ALTER TABLE and CREATE DATABASE
-# statement modified HA_CREATE_INFO structure in LEX, making these
-# statements PS/SP-unsafe (their re-execution might have resulted
-# in incorrect results).
-#
---disable_warnings
-drop database if exists mysqltest;
-drop table if exists t1, t2;
---enable_warnings
-# CREATE TABLE and CREATE TABLE ... SELECT
-create database mysqltest character set utf8;
-prepare stmt1 from "create table mysqltest.t1 (c char(10))";
-prepare stmt2 from "create table mysqltest.t2 select 'test'";
-execute stmt1;
---disable_warnings ONCE
-execute stmt2;
-show create table mysqltest.t1;
-show create table mysqltest.t2;
-drop table mysqltest.t1;
-drop table mysqltest.t2;
-alter database mysqltest character set latin1;
-execute stmt1;
---disable_warnings ONCE
-execute stmt2;
-show create table mysqltest.t1;
-show create table mysqltest.t2;
-drop database mysqltest;
-deallocate prepare stmt1;
-deallocate prepare stmt2;
-#
-# CREATE TABLE with DATA DIRECTORY option
-#
---disable_warnings
---disable_query_log
-eval prepare stmt from "create table t1 (c char(10)) data directory='$MYSQLTEST_VARDIR/tmp'";
---enable_query_log
-execute stmt;
-#
-# DATA DIRECTORY option does not always work: if the operating
-# system does not support symlinks, have_symlinks option is automatically
-# disabled.
-# In this case DATA DIRECTORY is silently ignored when
-# creating a table, and is not output by SHOW CREATE TABLE.
-#
---disable_result_log
-show create table t1;
---enable_result_log
-drop table t1;
-execute stmt;
---disable_result_log
-show create table t1;
---enable_result_log
---enable_warnings
-drop table t1;
-deallocate prepare stmt;
-#
-
-#
-# Bug #27937: crash on the second execution for prepared statement
-# from UNION with ORDER BY an expression containing RAND()
-#
-
-CREATE TABLE t1(a int);
-INSERT INTO t1 VALUES (2), (3), (1);
-
-PREPARE st1 FROM
- '(SELECT a FROM t1) UNION (SELECT a+10 FROM t1) ORDER BY RAND()*0+a';
-
-EXECUTE st1;
-EXECUTE st1;
-
-DEALLOCATE PREPARE st1;
-DROP TABLE t1;
-
-
-#
-# Bug #32137: prepared statement crash with str_to_date in update clause
-#
-create table t1 (a int, b tinyint);
-prepare st1 from 'update t1 set b= (str_to_date(a, a))';
-execute st1;
-deallocate prepare st1;
-drop table t1;
-
---echo End of 4.1 tests.
-
-############################# 5.0 tests start ################################
-#
-#
-# Bug#6102 "Server crash with prepared statement and blank after
-# function name"
-# ensure that stored functions are cached when preparing a statement
-# before we open tables
-#
-create table t1 (a varchar(20));
-insert into t1 values ('foo');
-prepare stmt FROM 'SELECT char_length (a) FROM t1';
--- error ER_SP_DOES_NOT_EXIST
-prepare stmt2 FROM 'SELECT not_a_function (a) FROM t1';
-drop table t1;
-
-#
-# Bug#8115: equality propagation and prepared statements
-#
-
-create table t1 (a char(3) not null, b char(3) not null,
- c char(3) not null, primary key (a, b, c));
-create table t2 like t1;
-
-# reduced query
-prepare stmt from
- "select t1.a from (t1 left outer join t2 on t2.a=1 and t1.b=t2.b)
- where t1.a=1";
-execute stmt;
-execute stmt;
-execute stmt;
-
-# original query
-prepare stmt from
-"select t1.a, t1.b, t1.c, t2.a, t2.b, t2.c from
-(t1 left outer join t2 on t2.a=? and t1.b=t2.b)
-left outer join t2 t3 on t3.a=? where t1.a=?";
-
-set @a:=1, @b:=1, @c:=1;
-
-execute stmt using @a, @b, @c;
-execute stmt using @a, @b, @c;
-execute stmt using @a, @b, @c;
-
-deallocate prepare stmt;
-
-drop table t1,t2;
-
-
-#
-# Bug#9383: INFORMATION_SCHEMA.COLUMNS, JOIN, Crash, prepared statement
-#
-
-eval SET @aux= "SELECT COUNT(*)
- FROM INFORMATION_SCHEMA.COLUMNS A,
- INFORMATION_SCHEMA.COLUMNS B
- WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA
- AND A.TABLE_NAME = B.TABLE_NAME
- AND A.COLUMN_NAME = B.COLUMN_NAME AND
- A.TABLE_NAME = 'user'";
-
-let $exec_loop_count= 3;
-eval prepare my_stmt from @aux;
-while ($exec_loop_count)
-{
- eval execute my_stmt;
- dec $exec_loop_count;
-}
-deallocate prepare my_stmt;
-
-# Test CALL in prepared mode
-delimiter |;
---disable_warnings
-drop procedure if exists p1|
-drop table if exists t1|
---enable_warnings
-create table t1 (id int)|
-insert into t1 values(1)|
-create procedure p1(a int, b int)
-begin
- declare c int;
- select max(id)+1 into c from t1;
- insert into t1 select a+b;
- insert into t1 select a-b;
- insert into t1 select a-c;
-end|
-set @a= 3, @b= 4|
-prepare stmt from "call p1(?, ?)"|
-execute stmt using @a, @b|
-execute stmt using @a, @b|
-select * from t1|
-deallocate prepare stmt|
-drop procedure p1|
-drop table t1|
-delimiter ;|
-
-
-#
-# Bug#7306 LIMIT ?, ? and also WL#1785 " Prepared statements: implement
-# support for placeholders in LIMIT clause."
-# Add basic test coverage for the feature.
-#
-create table t1 (a int);
-insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
-prepare stmt from "select * from t1 limit ?, ?";
-set @offset=0, @limit=1;
-execute stmt using @offset, @limit;
-select * from t1 limit 0, 1;
-set @offset=3, @limit=2;
-execute stmt using @offset, @limit;
-select * from t1 limit 3, 2;
-prepare stmt from "select * from t1 limit ?";
-execute stmt using @limit;
---error 1235
-prepare stmt from "select * from t1 where a in (select a from t1 limit ?)";
-prepare stmt from "select * from t1 union all select * from t1 limit ?, ?";
-set @offset=9;
-set @limit=2;
-execute stmt using @offset, @limit;
-prepare stmt from "(select * from t1 limit ?, ?) union all
- (select * from t1 limit ?, ?) order by a limit ?";
-execute stmt using @offset, @limit, @offset, @limit, @limit;
-
-drop table t1;
-deallocate prepare stmt;
-
-#
-# Bug#12651
-# (Crash on a PS including a subquery which is a select from a simple view)
-#
-CREATE TABLE b12651_T1(a int) ENGINE=MYISAM;
-CREATE TABLE b12651_T2(b int) ENGINE=MYISAM;
-CREATE VIEW b12651_V1 as SELECT b FROM b12651_T2;
-
-PREPARE b12651 FROM 'SELECT 1 FROM b12651_T1 WHERE a IN (SELECT b FROM b12651_V1)';
-EXECUTE b12651;
-
-DROP VIEW b12651_V1;
-DROP TABLE b12651_T1, b12651_T2;
-DEALLOCATE PREPARE b12651;
-
-
-
-#
-# Bug #14956: ROW_COUNT() returns incorrect result after EXECUTE of prepared
-# statement
-#
-create table t1 (id int);
-prepare ins_call from "insert into t1 (id) values (1)";
-execute ins_call;
-select row_count();
-drop table t1;
-
-#
-# BUG#16474: SP crashed MySQL
-# (when using "order by localvar", where 'localvar' is just that.
-# The actual bug test is in sp.test, this is just testing that we get the
-# expected result for prepared statements too, i.e. place holders work as
-# textual substitution. If it's a single integer, it works as the (deprecated)
-# "order by column#", otherwise it's an expression.
-#
-create table t1 (a int, b int);
-insert into t1 (a,b) values (2,8),(1,9),(3,7);
-
-# Will order by index
-prepare stmt from "select * from t1 order by ?";
-set @a=NULL;
-execute stmt using @a;
-set @a=1;
-execute stmt using @a;
-set @a=2;
-execute stmt using @a;
-deallocate prepare stmt;
-# For reference:
-select * from t1 order by 1;
-
-# Will not order by index.
-prepare stmt from "select * from t1 order by ?+1";
-set @a=0;
-execute stmt using @a;
-set @a=1;
-execute stmt using @a;
-deallocate prepare stmt;
-# For reference:
-select * from t1 order by 1+1;
-
-drop table t1;
-
-#
-# Bug#19308 "REPAIR/OPTIMIZE/ANALYZE supported in SP but not in PS".
-# Add test coverage for the added commands.
-#
-create table t1 (a int);
-create table t2 like t1;
-create table t3 like t2;
-prepare stmt from "repair table t1";
-execute stmt;
-execute stmt;
-prepare stmt from "optimize table t1";
-execute stmt;
-execute stmt;
-prepare stmt from "analyze table t1";
-execute stmt;
-execute stmt;
-prepare stmt from "repair table t1, t2, t3";
-execute stmt;
-execute stmt;
-prepare stmt from "optimize table t1, t2, t3";
-execute stmt;
-execute stmt;
-prepare stmt from "analyze table t1, t2, t3";
-execute stmt;
-execute stmt;
-prepare stmt from "repair table t1, t4, t3";
-execute stmt;
-execute stmt;
-prepare stmt from "optimize table t1, t3, t4";
-execute stmt;
-execute stmt;
-prepare stmt from "analyze table t4, t1";
-execute stmt;
-execute stmt;
-deallocate prepare stmt;
-drop table t1, t2, t3;
-
-#
-# Bug#17199 "Table not found" error occurs if the query contains a call
-# to a function from another database.
-# Test prepared statements- related behaviour.
-#
-#
-# ALTER TABLE RENAME and Prepared Statements: wrong DB name buffer was used
-# in ALTER ... RENAME which caused memory corruption in prepared statements.
-# No need to fix this problem in 4.1 as ALTER TABLE is not allowed in
-# Prepared Statements in 4.1.
-#
-create database mysqltest_long_database_name_to_thrash_heap;
-use test;
-create table t1 (i int);
-prepare stmt from "alter table test.t1 rename t1";
-use mysqltest_long_database_name_to_thrash_heap;
-execute stmt;
-show tables like 't1';
-prepare stmt from "alter table test.t1 rename t1";
-use test;
-execute stmt;
-show tables like 't1';
-use mysqltest_long_database_name_to_thrash_heap;
-show tables like 't1';
-deallocate prepare stmt;
-#
-# Check that a prepared statement initializes its current database at
-# PREPARE, and then works correctly even if the current database has been
-# changed.
-#
-use mysqltest_long_database_name_to_thrash_heap;
-# Necessary for preparation of INSERT/UPDATE/DELETE to succeed
-prepare stmt_create from "create table t1 (i int)";
-prepare stmt_insert from "insert into t1 (i) values (1)";
-prepare stmt_update from "update t1 set i=2";
-prepare stmt_delete from "delete from t1 where i=2";
-prepare stmt_select from "select * from t1";
-prepare stmt_alter from "alter table t1 add column (b int)";
-prepare stmt_alter1 from "alter table t1 drop column b";
-prepare stmt_analyze from "analyze table t1";
-prepare stmt_optimize from "optimize table t1";
-prepare stmt_show from "show tables like 't1'";
-prepare stmt_truncate from "truncate table t1";
-prepare stmt_drop from "drop table t1";
-# Drop the table that was used to prepare INSERT/UPDATE/DELETE: we will
-# create a new one by executing stmt_create
-drop table t1;
-# Switch the current database
-use test;
-# Check that all prepared statements operate on the database that was
-# active at PREPARE
-execute stmt_create;
-# should return empty set
-show tables like 't1';
-use mysqltest_long_database_name_to_thrash_heap;
-show tables like 't1';
-use test;
-execute stmt_insert;
-select * from mysqltest_long_database_name_to_thrash_heap.t1;
-execute stmt_update;
-select * from mysqltest_long_database_name_to_thrash_heap.t1;
-execute stmt_delete;
-execute stmt_select;
-execute stmt_alter;
-show columns from mysqltest_long_database_name_to_thrash_heap.t1;
-execute stmt_alter1;
-show columns from mysqltest_long_database_name_to_thrash_heap.t1;
-execute stmt_analyze;
-execute stmt_optimize;
-execute stmt_show;
-execute stmt_truncate;
-execute stmt_drop;
-show tables like 't1';
-use mysqltest_long_database_name_to_thrash_heap;
-show tables like 't1';
-#
-# Attempt a statement PREPARE when there is no current database:
-# is expected to return an error.
-#
-drop database mysqltest_long_database_name_to_thrash_heap;
---error ER_NO_DB_ERROR
-prepare stmt_create from "create table t1 (i int)";
---error ER_NO_DB_ERROR
-prepare stmt_insert from "insert into t1 (i) values (1)";
---error ER_NO_DB_ERROR
-prepare stmt_update from "update t1 set i=2";
---error ER_NO_DB_ERROR
-prepare stmt_delete from "delete from t1 where i=2";
---error ER_NO_DB_ERROR
-prepare stmt_select from "select * from t1";
---error ER_NO_DB_ERROR
-prepare stmt_alter from "alter table t1 add column (b int)";
---error ER_NO_DB_ERROR
-prepare stmt_alter1 from "alter table t1 drop column b";
---error ER_NO_DB_ERROR
-prepare stmt_analyze from "analyze table t1";
---error ER_NO_DB_ERROR
-prepare stmt_optimize from "optimize table t1";
---error ER_NO_DB_ERROR
-prepare stmt_show from "show tables like 't1'";
---error ER_NO_DB_ERROR
-prepare stmt_truncate from "truncate table t1";
---error ER_NO_DB_ERROR
-prepare stmt_drop from "drop table t1";
-#
-# The above has automatically deallocated all our statements.
-#
-# Attempt to CREATE a temporary table when no DB used: it should fail
-# This proves that no table can be used without explicit specification of
-# its database if there is no current database.
-#
---error ER_NO_DB_ERROR
-create temporary table t1 (i int);
-#
-# Restore the old environemnt
-#
-use test;
-
-
-#
-# BUG#21166: Prepared statement causes signal 11 on second execution
-#
-# Changes in an item tree done by optimizer weren't properly
-# registered and went unnoticed, which resulted in preliminary freeing
-# of used memory.
-#
---disable_warnings
-DROP TABLE IF EXISTS t1, t2, t3;
---enable_warnings
-
-CREATE TABLE t1 (i BIGINT, j BIGINT);
-CREATE TABLE t2 (i BIGINT);
-CREATE TABLE t3 (i BIGINT, j BIGINT);
-
-PREPARE stmt FROM "SELECT * FROM t1 JOIN t2 ON (t2.i = t1.i)
- LEFT JOIN t3 ON ((t3.i, t3.j) = (t1.i, t1.j))
- WHERE t1.i = ?";
-
-SET @a= 1;
-EXECUTE stmt USING @a;
-EXECUTE stmt USING @a;
-
-DEALLOCATE PREPARE stmt;
-DROP TABLE IF EXISTS t1, t2, t3;
-
-
-#
-# BUG#21081: SELECT inside stored procedure returns wrong results
-#
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-CREATE TABLE t1 (i INT KEY);
-CREATE TABLE t2 (i INT);
-
-INSERT INTO t1 VALUES (1), (2);
-INSERT INTO t2 VALUES (1);
-
-PREPARE stmt FROM "SELECT t2.i FROM t1 LEFT JOIN t2 ON t2.i = t1.i
- WHERE t1.i = ?";
-
-SET @arg= 1;
-EXECUTE stmt USING @arg;
-SET @arg= 2;
-EXECUTE stmt USING @arg;
-SET @arg= 1;
-EXECUTE stmt USING @arg;
-
-DEALLOCATE PREPARE stmt;
-DROP TABLE t1, t2;
-
-
-#
-# BUG#20327: Marking of a wrong field leads to a wrong result on select with
-# view, prepared statement and subquery.
-#
-CREATE TABLE t1 (i INT);
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-INSERT INTO t1 VALUES (1), (2);
-
-let $query = SELECT t1.i FROM t1 JOIN v1 ON t1.i = v1.i
- WHERE EXISTS (SELECT * FROM t1 WHERE v1.i = 1);
-eval $query;
-eval PREPARE stmt FROM "$query";
-# Statement execution should return '1'.
-EXECUTE stmt;
-# Check re-execution.
-EXECUTE stmt;
-
-DEALLOCATE PREPARE stmt;
-DROP VIEW v1;
-DROP TABLE t1;
-
-
-#
-# BUG#21856: Prepared Statments: crash if bad create
-#
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
---enable_warnings
-
-let $iterations= 100;
---disable_query_log
---disable_result_log
-while ($iterations)
-{
- --error ER_PARSE_ERROR
- PREPARE stmt FROM "CREATE PROCEDURE p1()";
- dec $iterations;
-}
---enable_query_log
---enable_result_log
-
-#
-# Bug 19764: SHOW commands end up in the slow log as table scans
-#
-
-flush status;
-prepare sq from 'show status like "slow_queries"';
-execute sq;
-prepare no_index from 'select 1 from information_schema.tables limit 1';
-execute sq;
-execute no_index;
-execute sq;
-deallocate prepare no_index;
-deallocate prepare sq;
-
-
-#
-# Bug 25027: query with a single-row non-correlated subquery
-# and IS NULL predicate
-#
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (1), (2);
-CREATE TABLE t2 (b int);
-INSERT INTO t2 VALUES (NULL);
-
-SELECT a FROM t1 WHERE (SELECT b FROM t2) IS NULL;
-PREPARE stmt FROM 'SELECT a FROM t1 WHERE (SELECT b FROM t2) IS NULL';
-
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-
-PREPARE stmt FROM 'SELECT a FROM t1 WHERE (SELECT b FROM t2 limit ?) IS NULL';
-SET @arg=1;
-EXECUTE stmt USING @arg;
-DEALLOCATE PREPARE stmt;
-
-DROP TABLE t1,t2;
-#
-# Bug#4968 "Stored procedure crash if cursor opened on altered table"
-# The bug is not repeatable any more after the fix for
-# Bug#15217 "Bug #15217 Using a SP cursor on a table created with PREPARE
-# fails with weird error", however ALTER TABLE is not re-execution friendly
-# and that caused a valgrind warning. Check that the warning is gone.
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (s1 char(20));
-prepare stmt from "alter table t1 modify s1 int";
-execute stmt;
-execute stmt;
-drop table t1;
-deallocate prepare stmt;
-
-#
-# Bug#6895 "Prepared Statements: ALTER TABLE DROP COLUMN does nothing"
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a int, b int);
-prepare s_6895 from "alter table t1 drop column b";
-execute s_6895;
-show columns from t1;
-drop table t1;
-create table t1 (a int, b int);
-execute s_6895;
-show columns from t1;
-drop table t1;
-create table t1 (a int, b int);
-execute s_6895;
-show columns from t1;
-deallocate prepare s_6895;
-drop table t1;
-
-#
-# Bug #22060 "ALTER TABLE x AUTO_INCREMENT=y in SP crashes server"
-#
-# 5.0 part of the test.
-#
-
-# ALTER TABLE
-create table t1 (i int primary key auto_increment) comment='comment for table t1';
-create table t2 (i int, j int, k int);
-prepare stmt from "alter table t1 auto_increment=100";
-execute stmt;
-show create table t1;
-# Let us trash table-cache's memory
-flush tables;
-select * from t2;
-execute stmt;
-show create table t1;
-deallocate prepare stmt;
-drop table t1, t2;
-# 5.1 part of the test.
-# CREATE DATABASE
-set @old_character_set_server= @@character_set_server;
-set @@character_set_server= latin1;
-prepare stmt from "create database mysqltest_1";
-execute stmt;
-show create database mysqltest_1;
-drop database mysqltest_1;
-set @@character_set_server= utf8;
-execute stmt;
-show create database mysqltest_1;
-drop database mysqltest_1;
-deallocate prepare stmt;
-set @@character_set_server= @old_character_set_server;
-
-
-#
-# BUG#24491 "using alias from source table in insert ... on duplicate key"
-#
---disable_warnings
-drop tables if exists t1;
---enable_warnings
-create table t1 (id int primary key auto_increment, value varchar(10));
-insert into t1 (id, value) values (1, 'FIRST'), (2, 'SECOND'), (3, 'THIRD');
-# Let us prepare INSERT ... SELECT ... ON DUPLICATE KEY UPDATE statement
-# which in its ON DUPLICATE KEY clause erroneously tries to assign value
-# to a column which is mentioned only in SELECT part.
-prepare stmt from "insert into t1 (id, value) select * from (select 4 as i, 'FOURTH' as v) as y on duplicate key update v = 'DUP'";
-# Both first and second attempts to execute it should fail
---error ER_BAD_FIELD_ERROR
-execute stmt;
---error ER_BAD_FIELD_ERROR
-execute stmt;
-deallocate prepare stmt;
-# And now the same test for more complex case which is more close
-# to the one that was reported originally.
-prepare stmt from "insert into t1 (id, value) select * from (select 4 as id, 'FOURTH' as value) as y on duplicate key update y.value = 'DUP'";
---error ER_BAD_FIELD_ERROR
-execute stmt;
---error ER_BAD_FIELD_ERROR
-execute stmt;
-deallocate prepare stmt;
-drop tables t1;
-
-#
-# Bug #28509: strange behaviour: passing a decimal value to PS
-#
-prepare stmt from "create table t1 select ?";
-set @a=1.0;
-execute stmt using @a;
-show create table t1;
-drop table t1;
-
-#
-# Bug#33798: prepared statements improperly handle large unsigned ints
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a bigint unsigned, b bigint(20) unsigned);
-prepare stmt from "insert into t1 values (?,?)";
-set @a= 9999999999999999;
-set @b= 14632475938453979136;
-insert into t1 values (@a, @b);
-select * from t1 where a = @a and b = @b;
-execute stmt using @a, @b;
-select * from t1 where a = @a and b = @b;
-deallocate prepare stmt;
-drop table t1;
-
-#
-# Bug#32890 Crash after repeated create and drop of tables and views
-#
-
---disable_warnings
-drop view if exists v1;
-drop table if exists t1;
---enable_warnings
-
-create table t1 (a int, b int);
-insert into t1 values (1,1), (2,2), (3,3);
-insert into t1 values (3,1), (1,2), (2,3);
-
-prepare stmt from "create view v1 as select * from t1";
-execute stmt;
-drop table t1;
-create table t1 (a int, b int);
-drop view v1;
-execute stmt;
-show create view v1;
-drop view v1;
-
-prepare stmt from "create view v1 (c,d) as select a,b from t1";
-execute stmt;
-show create view v1;
-select * from v1;
-drop view v1;
-execute stmt;
-deallocate prepare stmt;
-show create view v1;
-select * from v1;
-drop view v1;
-
-prepare stmt from "create view v1 (c) as select b+1 from t1";
-execute stmt;
-show create view v1;
-select * from v1;
-drop view v1;
-execute stmt;
-deallocate prepare stmt;
-show create view v1;
-select * from v1;
-drop view v1;
-
-prepare stmt from "create view v1 (c,d,e,f) as select a,b,a in (select a+2 from t1), a = all (select a from t1) from t1";
-execute stmt;
-show create view v1;
-select * from v1;
-drop view v1;
-execute stmt;
-deallocate prepare stmt;
-show create view v1;
-select * from v1;
-drop view v1;
-
-prepare stmt from "create or replace view v1 as select 1";
-execute stmt;
-show create view v1;
-select * from v1;
-execute stmt;
-show create view v1;
-deallocate prepare stmt;
-show create view v1;
-select * from v1;
-drop view v1;
-
-prepare stmt from "create view v1 as select 1, 1";
-execute stmt;
-show create view v1;
-select * from v1;
-drop view v1;
-execute stmt;
-deallocate prepare stmt;
-show create view v1;
-select * from v1;
-drop view v1;
-
-prepare stmt from "create view v1 (x) as select a from t1 where a > 1";
-execute stmt;
-show create view v1;
-select * from v1;
-drop view v1;
-execute stmt;
-deallocate prepare stmt;
-show create view v1;
-select * from v1;
-drop view v1;
-
-prepare stmt from "create view v1 as select * from `t1` `b`";
-execute stmt;
-show create view v1;
-select * from v1;
-drop view v1;
-execute stmt;
-deallocate prepare stmt;
-show create view v1;
-select * from v1;
-drop view v1;
-
-prepare stmt from "create view v1 (a,b,c) as select * from t1";
---error ER_VIEW_WRONG_LIST
-execute stmt;
---error ER_VIEW_WRONG_LIST
-execute stmt;
-deallocate prepare stmt;
-
-drop table t1;
-create temporary table t1 (a int, b int);
-
-prepare stmt from "create view v1 as select * from t1";
---error ER_VIEW_SELECT_TMPTABLE
-execute stmt;
---error ER_VIEW_SELECT_TMPTABLE
-execute stmt;
-deallocate prepare stmt;
-
-drop table t1;
-
---error ER_NO_SUCH_TABLE
-prepare stmt from "create view v1 as select * from t1";
---error ER_NO_SUCH_TABLE
-prepare stmt from "create view v1 as select * from `t1` `b`";
-
-#
-# Bug#33851: Passing UNSIGNED param to EXECUTE returns ERROR 1210
-#
-
-prepare stmt from "select ?";
-set @arg= 123456789.987654321;
-select @arg;
-execute stmt using @arg;
-set @arg= "string";
-select @arg;
-execute stmt using @arg;
-set @arg= 123456;
-select @arg;
-execute stmt using @arg;
-set @arg= cast(-12345.54321 as decimal(20, 10));
-select @arg;
-execute stmt using @arg;
-deallocate prepare stmt;
-
---echo #
---echo # Bug#48508: Crash on prepared statement re-execution.
---echo #
-create table t1(b int);
-insert into t1 values (0);
-create view v1 AS select 1 as a from t1 where b;
-prepare stmt from "select * from v1 where a";
-execute stmt;
-execute stmt;
-deallocate prepare stmt;
-drop table t1;
-drop view v1;
-
-create table t1(a bigint);
-create table t2(b tinyint);
-insert into t2 values (null);
-prepare stmt from "select 1 from t1 join t2 on a xor b where b > 1 and a =1";
-execute stmt;
-execute stmt;
-deallocate prepare stmt;
-drop table t1,t2;
---echo #
-
-
---echo #
---echo # Bug #49570: Assertion failed: !(order->used & map)
---echo # on re-execution of prepared statement
---echo #
-CREATE TABLE t1(a INT PRIMARY KEY);
-INSERT INTO t1 VALUES(0), (1);
-PREPARE stmt FROM
- "SELECT 1 FROM t1 JOIN t1 t2 USING(a) GROUP BY t2.a, t1.a";
-EXECUTE stmt;
-EXECUTE stmt;
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-DROP TABLE t1;
-
-
---echo End of 5.0 tests.
-
-#
-# Bug #20665: All commands supported in Stored Procedures should work in
-# Prepared Statements
-#
-create procedure proc_1() reset query cache;
-call proc_1();
-call proc_1();
-call proc_1();
-delimiter |;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function func_1() returns int deterministic begin reset query cache; return 1; end|
-create function func_1() returns int deterministic begin call proc_1(); return 1; end|
-delimiter ;|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-select func_1(), func_1(), func_1() from dual;
-drop function func_1;
-drop procedure proc_1;
-prepare abc from "reset query cache";
-execute abc;
-execute abc;
-execute abc;
-deallocate prepare abc;
-
-
-create procedure proc_1() reset master;
-delimiter |;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function func_1() returns int begin reset master; return 1; end|
-create function func_1() returns int begin call proc_1(); return 1; end|
-delimiter ;|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-select func_1(), func_1(), func_1() from dual;
-drop function func_1;
-drop procedure proc_1;
-prepare abc from "reset master";
-execute abc;
-execute abc;
-execute abc;
-deallocate prepare abc;
-
-
-create procedure proc_1() reset slave;
-call proc_1();
-call proc_1();
-call proc_1();
-delimiter |;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function func_1() returns int begin reset slave; return 1; end|
-create function func_1() returns int begin call proc_1(); return 1; end|
-delimiter ;|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-select func_1(), func_1(), func_1() from dual;
-drop function func_1;
-drop procedure proc_1;
-prepare abc from "reset slave";
-execute abc;
-execute abc;
-execute abc;
-deallocate prepare abc;
-
-
-create procedure proc_1(a integer) kill a;
---error ER_NO_SUCH_THREAD
-call proc_1(0);
---error ER_NO_SUCH_THREAD
-call proc_1(0);
---error ER_NO_SUCH_THREAD
-call proc_1(0);
-drop procedure proc_1;
-delimiter |;
-create function func_1() returns int begin kill 0; return 1; end|
-delimiter ;|
---error ER_NO_SUCH_THREAD
-select func_1() from dual;
---error ER_NO_SUCH_THREAD
-select func_1() from dual;
---error ER_NO_SUCH_THREAD
-select func_1() from dual;
-drop function func_1;
-prepare abc from "kill 0";
---error ER_NO_SUCH_THREAD
-execute abc;
---error ER_NO_SUCH_THREAD
-execute abc;
---error ER_NO_SUCH_THREAD
-execute abc;
-deallocate prepare abc;
-
-
-create procedure proc_1() flush hosts;
-call proc_1();
-call proc_1();
-call proc_1();
-call proc_1();
-delimiter |;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function func_1() returns int begin flush hosts; return 1; end|
-create function func_1() returns int begin call proc_1(); return 1; end|
-delimiter ;|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-select func_1(), func_1(), func_1() from dual;
-drop function func_1;
-drop procedure proc_1;
-prepare abc from "flush hosts";
-execute abc;
-execute abc;
-execute abc;
-deallocate prepare abc;
-
-
-create procedure proc_1() flush privileges;
-call proc_1();
-call proc_1();
-call proc_1();
-delimiter |;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function func_1() returns int begin flush privileges; return 1; end|
-create function func_1() returns int begin call proc_1(); return 1; end|
-delimiter ;|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-select func_1(), func_1(), func_1() from dual;
-drop function func_1;
-drop procedure proc_1;
-prepare abc from "flush privileges";
-deallocate prepare abc;
-
-
-create procedure proc_1() flush tables with read lock;
-call proc_1();
-unlock tables;
-call proc_1();
-unlock tables;
-call proc_1();
-unlock tables;
-delimiter |;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function func_1() returns int begin flush tables with read lock; return 1; end|
-create function func_1() returns int begin call proc_1(); return 1; end|
-delimiter ;|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-select func_1(), func_1(), func_1() from dual;
-drop function func_1;
-drop procedure proc_1;
-prepare abc from "flush tables with read lock";
-execute abc;
-execute abc;
-execute abc;
-deallocate prepare abc;
-unlock tables;
-
-
-create procedure proc_1() flush tables;
-call proc_1();
-call proc_1();
-call proc_1();
-delimiter |;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function func_1() returns int begin flush tables; return 1; end|
-create function func_1() returns int begin call proc_1(); return 1; end|
-delimiter ;|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-select func_1(), func_1(), func_1() from dual;
-drop function func_1;
-drop procedure proc_1;
-prepare abc from "flush tables";
-execute abc;
-execute abc;
-execute abc;
-deallocate prepare abc;
-
-
-create procedure proc_1() flush tables;
-flush tables;
---sorted_result
-show open tables from mysql;
-select Host, User from mysql.user limit 0;
-select Host, Db from mysql.host limit 0;
---sorted_result
-show open tables from mysql;
-call proc_1();
---sorted_result
-show open tables from mysql;
-select Host, User from mysql.user limit 0;
-select Host, Db from mysql.host limit 0;
---sorted_result
-show open tables from mysql;
-call proc_1();
---sorted_result
-show open tables from mysql;
-select Host, User from mysql.user limit 0;
-select Host, Db from mysql.host limit 0;
---sorted_result
-show open tables from mysql;
-call proc_1();
---sorted_result
-show open tables from mysql;
-select Host, User from mysql.user limit 0;
-select Host, Db from mysql.host limit 0;
---sorted_result
-show open tables from mysql;
-flush tables;
-delimiter |;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function func_1() returns int begin flush tables; return 1; end|
-create function func_1() returns int begin call proc_1(); return 1; end|
-delimiter ;|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-select func_1(), func_1(), func_1() from dual;
-drop function func_1;
-drop procedure proc_1;
-
-# make the output deterministic:
-# the order used in SHOW OPEN TABLES
-# is too much implementation dependent
---disable_ps_protocol
-flush tables;
-select Host, User from mysql.user limit 0;
-select Host, Db from mysql.host limit 0;
---sorted_result
-show open tables from mysql;
---enable_ps_protocol
-
-prepare abc from "flush tables";
-execute abc;
---sorted_result
-show open tables from mysql;
-select Host, User from mysql.user limit 0;
-select Host, Db from mysql.host limit 0;
---sorted_result
-show open tables from mysql;
-execute abc;
---sorted_result
-show open tables from mysql;
-select Host, User from mysql.user limit 0;
-select Host, Db from mysql.host limit 0;
---sorted_result
-show open tables from mysql;
-execute abc;
---sorted_result
-show open tables from mysql;
-select Host, User from mysql.user limit 0;
-select Host, Db from mysql.host limit 0;
---sorted_result
-show open tables from mysql;
-flush tables;
-deallocate prepare abc;
-
-
-create procedure proc_1() flush logs;
-call proc_1();
-call proc_1();
-call proc_1();
-delimiter |;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function func_1() returns int begin flush logs; return 1; end|
-create function func_1() returns int begin call proc_1(); return 1; end|
-delimiter ;|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-select func_1(), func_1(), func_1() from dual;
-drop function func_1;
-drop procedure proc_1;
-prepare abc from "flush logs";
-execute abc;
-execute abc;
-execute abc;
-deallocate prepare abc;
-
-
-create procedure proc_1() flush status;
-call proc_1();
-call proc_1();
-call proc_1();
-delimiter |;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function func_1() returns int begin flush status; return 1; end|
-create function func_1() returns int begin call proc_1(); return 1; end|
-delimiter ;|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-select func_1(), func_1(), func_1() from dual;
-drop function func_1;
-drop procedure proc_1;
-prepare abc from "flush status";
-execute abc;
-execute abc;
-execute abc;
-deallocate prepare abc;
-
-
-create procedure proc_1() flush slave;
-call proc_1();
-call proc_1();
-call proc_1();
-delimiter |;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function func_1() returns int begin flush slave; return 1; end|
-create function func_1() returns int begin call proc_1(); return 1; end|
-delimiter ;|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-select func_1(), func_1(), func_1() from dual;
-drop function func_1;
-drop procedure proc_1;
-prepare abc from "flush slave";
-execute abc;
-execute abc;
-execute abc;
-deallocate prepare abc;
-
-
-create procedure proc_1() flush master;
-delimiter |;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function func_1() returns int begin flush master; return 1; end|
-create function func_1() returns int begin call proc_1(); return 1; end|
-delimiter ;|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-select func_1(), func_1(), func_1() from dual;
-drop function func_1;
-drop procedure proc_1;
-prepare abc from "flush master";
-deallocate prepare abc;
-
-
-create procedure proc_1() flush des_key_file;
-call proc_1();
-call proc_1();
-call proc_1();
-delimiter |;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function func_1() returns int begin flush des_key_file; return 1; end|
-create function func_1() returns int begin call proc_1(); return 1; end|
-delimiter ;|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-select func_1(), func_1(), func_1() from dual;
-drop function func_1;
-drop procedure proc_1;
-prepare abc from "flush des_key_file";
-execute abc;
-execute abc;
-execute abc;
-deallocate prepare abc;
-
-
-create procedure proc_1() flush user_resources;
-call proc_1();
-call proc_1();
-call proc_1();
-delimiter |;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function func_1() returns int begin flush user_resources; return 1; end|
-create function func_1() returns int begin call proc_1(); return 1; end|
-delimiter ;|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-select func_1(), func_1(), func_1() from dual;
-drop function func_1;
-drop procedure proc_1;
-prepare abc from "flush user_resources";
-execute abc;
-execute abc;
-execute abc;
-deallocate prepare abc;
-
-
-create procedure proc_1() start slave;
-drop procedure proc_1;
-delimiter |;
-create function func_1() returns int begin start slave; return 1; end|
-delimiter ;|
-drop function func_1;
-prepare abc from "start slave";
-deallocate prepare abc;
-
-
-create procedure proc_1() stop slave;
-drop procedure proc_1;
-delimiter |;
-create function func_1() returns int begin stop slave; return 1; end|
-delimiter ;|
-drop function func_1;
-prepare abc from "stop slave";
-deallocate prepare abc;
-
-
-create procedure proc_1() show binlog events;
-drop procedure proc_1;
-delimiter |;
---error ER_SP_NO_RETSET
-create function func_1() returns int begin show binlog events; return 1; end|
-delimiter ;|
---error ER_SP_DOES_NOT_EXIST
-select func_1(), func_1(), func_1() from dual;
---error ER_SP_DOES_NOT_EXIST
-drop function func_1;
-prepare abc from "show binlog events";
-deallocate prepare abc;
-
-
-create procedure proc_1() show slave status;
-drop procedure proc_1;
-delimiter |;
---error ER_SP_NO_RETSET
-create function func_1() returns int begin show slave status; return 1; end|
-delimiter ;|
---error ER_SP_DOES_NOT_EXIST
-select func_1(), func_1(), func_1() from dual;
---error ER_SP_DOES_NOT_EXIST
-drop function func_1;
-prepare abc from "show slave status";
-deallocate prepare abc;
-
-
-create procedure proc_1() show master status;
-drop procedure proc_1;
-delimiter |;
---error ER_SP_NO_RETSET
-create function func_1() returns int begin show master status; return 1; end|
-delimiter ;|
---error ER_SP_DOES_NOT_EXIST
-select func_1(), func_1(), func_1() from dual;
---error ER_SP_DOES_NOT_EXIST
-drop function func_1;
-prepare abc from "show master status";
-deallocate prepare abc;
-
-
-create procedure proc_1() show master logs;
-drop procedure proc_1;
-delimiter |;
---error ER_SP_NO_RETSET
-create function func_1() returns int begin show master logs; return 1; end|
-delimiter ;|
---error ER_SP_DOES_NOT_EXIST
-select func_1(), func_1(), func_1() from dual;
---error ER_SP_DOES_NOT_EXIST
-drop function func_1;
-prepare abc from "show master logs";
-deallocate prepare abc;
-
-
-create procedure proc_1() show events;
-call proc_1();
-call proc_1();
-call proc_1();
-drop procedure proc_1;
-delimiter |;
---error ER_SP_NO_RETSET
-create function func_1() returns int begin show events; return 1; end|
-delimiter ;|
---error ER_SP_DOES_NOT_EXIST
-select func_1(), func_1(), func_1() from dual;
---error ER_SP_DOES_NOT_EXIST
-drop function func_1;
-prepare abc from "show events";
-execute abc;
-execute abc;
-execute abc;
-deallocate prepare abc;
-
-
---disable_warnings
-drop procedure if exists a;
---enable_warnings
-create procedure a() select 42;
-create procedure proc_1(a char(2)) show create procedure a;
-call proc_1("bb");
-call proc_1("bb");
-call proc_1("bb");
-drop procedure proc_1;
-delimiter |;
---error ER_SP_NO_RETSET
-create function func_1() returns int begin show create procedure a; return 1; end|
-delimiter ;|
---error ER_SP_DOES_NOT_EXIST
-select func_1(), func_1(), func_1() from dual;
---error ER_SP_DOES_NOT_EXIST
-drop function func_1;
-prepare abc from "show create procedure a";
-execute abc;
-execute abc;
-execute abc;
-deallocate prepare abc;
-drop procedure a;
-
-
---disable_warnings
-drop function if exists a;
---enable_warnings
-create function a() returns int return 42+13;
-create procedure proc_1(a char(2)) show create function a;
-call proc_1("bb");
-call proc_1("bb");
-call proc_1("bb");
-drop procedure proc_1;
-delimiter |;
---error ER_SP_NO_RETSET
-create function func_1() returns int begin show create function a; return 1; end|
-delimiter ;|
---error ER_SP_DOES_NOT_EXIST
-select func_1(), func_1(), func_1() from dual;
---error ER_SP_DOES_NOT_EXIST
-drop function func_1;
-prepare abc from "show create function a";
-execute abc;
-execute abc;
-execute abc;
-deallocate prepare abc;
-drop function a;
-
-
---disable_warnings
-drop table if exists tab1;
---enable_warnings
-create table tab1(a int, b char(1), primary key(a,b));
-create procedure proc_1() show create table tab1;
-call proc_1();
-call proc_1();
-call proc_1();
-drop procedure proc_1;
-delimiter |;
---error ER_SP_NO_RETSET
-create function func_1() returns int begin show create table tab1; return 1; end|
-delimiter ;|
---error ER_SP_DOES_NOT_EXIST
-select func_1(), func_1(), func_1() from dual;
---error ER_SP_DOES_NOT_EXIST
-drop function func_1;
-prepare abc from "show create table tab1";
-execute abc;
-execute abc;
-execute abc;
-deallocate prepare abc;
-drop table tab1;
-
-
---disable_warnings
-drop view if exists v1;
-drop table if exists t1;
---enable_warnings
-create table t1(a int, b char(5));
-insert into t1 values (1, "one"), (1, "edno"), (2, "two"), (2, "dve");
-create view v1 as
- (select a, count(*) from t1 group by a)
- union all
- (select b, count(*) from t1 group by b);
-create procedure proc_1() show create view v1;
-call proc_1();
-call proc_1();
-call proc_1();
-drop procedure proc_1;
-delimiter |;
---error ER_SP_NO_RETSET
-create function func_1() returns int begin show create view v1; return 1; end|
-delimiter ;|
---error ER_SP_DOES_NOT_EXIST
-select func_1(), func_1(), func_1() from dual;
---error ER_SP_DOES_NOT_EXIST
-drop function func_1;
-prepare abc from "show create view v1";
-execute abc;
-execute abc;
-execute abc;
-deallocate prepare abc;
-drop view v1;
-drop table t1;
-
-
-create procedure proc_1() install plugin my_plug soname 'some_plugin.so';
---error ER_CANT_OPEN_LIBRARY,ER_FEATURE_DISABLED
-call proc_1();
---error ER_CANT_OPEN_LIBRARY,ER_FEATURE_DISABLED
-call proc_1();
---error ER_CANT_OPEN_LIBRARY,ER_FEATURE_DISABLED
-call proc_1();
-drop procedure proc_1;
-delimiter |;
---error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-create function func_1() returns int begin install plugin my_plug soname '/tmp/plugin'; return 1; end|
-delimiter ;|
---error ER_SP_DOES_NOT_EXIST
-select func_1(), func_1(), func_1() from dual;
---error ER_SP_DOES_NOT_EXIST
-drop function func_1;
-prepare abc from "install plugin my_plug soname 'some_plugin.so'";
-deallocate prepare abc;
-
-
-create procedure proc_1() uninstall plugin my_plug;
---error ER_SP_DOES_NOT_EXIST
-call proc_1();
---error ER_SP_DOES_NOT_EXIST
-call proc_1();
---error ER_SP_DOES_NOT_EXIST
-call proc_1();
-drop procedure proc_1;
-delimiter |;
---error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-create function func_1() returns int begin uninstall plugin my_plug; return 1; end|
-delimiter ;|
---error ER_SP_DOES_NOT_EXIST
-select func_1(), func_1(), func_1() from dual;
---error ER_SP_DOES_NOT_EXIST
-drop function func_1;
-prepare abc from "uninstall plugin my_plug";
---error ER_SP_DOES_NOT_EXIST
-execute abc;
---error ER_SP_DOES_NOT_EXIST
-execute abc;
---error ER_SP_DOES_NOT_EXIST
-execute abc;
-deallocate prepare abc;
-
-
---disable_warnings
-drop database if exists mysqltest_xyz;
---enable_warnings
-create procedure proc_1() create database mysqltest_xyz;
-call proc_1();
-drop database if exists mysqltest_xyz;
-call proc_1();
---error ER_DB_CREATE_EXISTS
-call proc_1();
-drop database if exists mysqltest_xyz;
-call proc_1();
-drop database if exists mysqltest_xyz;
-drop procedure proc_1;
-delimiter |;
---error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-create function func_1() returns int begin create database mysqltest_xyz; return 1; end|
-delimiter ;|
---error ER_SP_DOES_NOT_EXIST
-select func_1(), func_1(), func_1() from dual;
---error ER_SP_DOES_NOT_EXIST
-drop function func_1;
-prepare abc from "create database mysqltest_xyz";
-execute abc;
-drop database if exists mysqltest_xyz;
-execute abc;
---error ER_DB_CREATE_EXISTS
-execute abc;
-drop database if exists mysqltest_xyz;
-execute abc;
-drop database if exists mysqltest_xyz;
-deallocate prepare abc;
-
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a int, b char(5));
-insert into t1 values (1, "one"), (2, "two"), (3, "three");
-create procedure proc_1() checksum table xyz;
-call proc_1();
-call proc_1();
-call proc_1();
-drop procedure proc_1;
-delimiter |;
---error ER_SP_NO_RETSET
-create function func_1() returns int begin checksum table t1; return 1; end|
-delimiter ;|
---error ER_SP_DOES_NOT_EXIST
-select func_1(), func_1(), func_1() from dual;
---error ER_SP_DOES_NOT_EXIST
-drop function func_1;
-prepare abc from "checksum table t1";
-execute abc;
-execute abc;
-execute abc;
-deallocate prepare abc;
-
-
-create procedure proc_1() create user pstest_xyz@localhost;
-call proc_1();
-drop user pstest_xyz@localhost;
-call proc_1();
---error ER_CANNOT_USER
-call proc_1();
-drop user pstest_xyz@localhost;
-call proc_1();
-drop user pstest_xyz@localhost;
-drop procedure proc_1;
-delimiter |;
---error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-create function func_1() returns int begin create user pstest_xyz@localhost; return 1; end|
-delimiter ;|
---error ER_SP_DOES_NOT_EXIST
-select func_1(), func_1(), func_1() from dual;
---error ER_SP_DOES_NOT_EXIST
-drop function func_1;
-prepare abc from "create user pstest_xyz@localhost";
-execute abc;
-drop user pstest_xyz@localhost;
-execute abc;
---error ER_CANNOT_USER
-execute abc;
-drop user pstest_xyz@localhost;
-execute abc;
-drop user pstest_xyz@localhost;
-deallocate prepare abc;
-
-
---disable_warnings
-drop event if exists xyz;
---enable_warnings
-#create procedure proc_1() create event xyz on schedule every 5 minute disable do select 123;
-#call proc_1();
-#drop event xyz;
-#call proc_1();
-#--error ER_EVENT_ALREADY_EXISTS
-#call proc_1();
-#drop event xyz;
-#call proc_1();
-#drop event xyz;
-#drop procedure proc_1;
-delimiter |;
---error ER_EVENT_RECURSION_FORBIDDEN
-create function func_1() returns int begin create event xyz on schedule at now() do select 123; return 1; end|
-delimiter ;|
---error ER_SP_DOES_NOT_EXIST
-select func_1(), func_1(), func_1() from dual;
---error ER_SP_DOES_NOT_EXIST
-drop function func_1;
---error ER_UNSUPPORTED_PS
-prepare abc from "create event xyz on schedule at now() do select 123";
---error ER_UNKNOWN_STMT_HANDLER
-deallocate prepare abc;
-
-
---disable_warnings
-drop event if exists xyz;
-create event xyz on schedule every 5 minute disable do select 123;
---enable_warnings
-create procedure proc_1() alter event xyz comment 'xyz';
-call proc_1();
-drop event xyz;
-create event xyz on schedule every 5 minute disable do select 123;
-call proc_1();
-drop event xyz;
-create event xyz on schedule every 5 minute disable do select 123;
-call proc_1();
-drop event xyz;
-drop procedure proc_1;
-delimiter |;
---error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-create function func_1() returns int begin alter event xyz comment 'xyz'; return 1; end|
-delimiter ;|
---error ER_UNSUPPORTED_PS
-prepare abc from "alter event xyz comment 'xyz'";
---error ER_UNKNOWN_STMT_HANDLER
-deallocate prepare abc;
-
-
---disable_warnings
-drop event if exists xyz;
-create event xyz on schedule every 5 minute disable do select 123;
---enable_warnings
-create procedure proc_1() drop event xyz;
-call proc_1();
-create event xyz on schedule every 5 minute disable do select 123;
-call proc_1();
---error ER_EVENT_DOES_NOT_EXIST
-call proc_1();
-drop procedure proc_1;
-delimiter |;
---error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-create function func_1() returns int begin drop event xyz; return 1; end|
-delimiter ;|
---error ER_UNSUPPORTED_PS
-prepare abc from "drop event xyz";
---error ER_UNKNOWN_STMT_HANDLER
-deallocate prepare abc;
-
-
---disable_warnings
-drop table if exists t1;
-create table t1 (a int, b char(5)) engine=myisam;
-insert into t1 values (1, "one"), (2, "two"), (3, "three");
---enable_warnings
-SET GLOBAL new_cache.key_buffer_size=128*1024;
-create procedure proc_1() cache index t1 in new_cache;
-call proc_1();
-call proc_1();
-call proc_1();
-drop procedure proc_1;
-SET GLOBAL second_cache.key_buffer_size=128*1024;
-prepare abc from "cache index t1 in second_cache";
-execute abc;
-execute abc;
-execute abc;
-deallocate prepare abc;
-drop table t1;
-
---disable_warnings
-drop table if exists t1;
-drop table if exists t2;
-create table t1 (a int, b char(5)) engine=myisam;
-insert into t1 values (1, "one"), (2, "two"), (3, "three");
-create table t2 (a int, b char(5)) engine=myisam;
-insert into t2 values (1, "one"), (2, "two"), (3, "three");
---enable_warnings
-create procedure proc_1() load index into cache t1 ignore leaves;
-call proc_1();
-call proc_1();
-call proc_1();
-drop procedure proc_1;
-delimiter |;
---error ER_SP_NO_RETSET
-create function func_1() returns int begin load index into cache t1 ignore leaves; return 1; end|
-delimiter ;|
-prepare abc from "load index into cache t2 ignore leaves";
-execute abc;
-execute abc;
-execute abc;
-deallocate prepare abc;
-drop table t1, t2;
-
-#
-# Bug #21422: GRANT/REVOKE possible inside stored function, probably in a trigger
-# This is disabled for now till it is resolved in 5.0
-#
-
-#create procedure proc_1() grant all on *.* to abc@host;
-#drop procedure proc_1;
-#delimiter |;
-#--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-#create function func_1() returns int begin grant all on *.* to abc@host; return 1; end|
-#delimiter ;|
-#prepare abc from "grant all on *.* to abc@host";
-#
-#create procedure proc_1() revoke all on *.* from abc@host;
-#drop procedure proc_1;
-#delimiter |;#--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-#create function func_1() returns int begin revoke all on *.* from abc@host; return 1; end|
-#delimiter ;|
-#prepare abc from "revoke all on *.* from abc@host";
-
-create procedure proc_1() show errors;
-call proc_1();
-call proc_1();
-call proc_1();
-drop procedure proc_1;
-delimiter |;
---error ER_SP_NO_RETSET
-create function func_1() returns int begin show errors; return 1; end|
-delimiter ;|
-prepare abc from "show errors";
-deallocate prepare abc;
-
---disable_warnings
-drop table if exists t1;
-drop table if exists t2;
---enable_warnings
-create procedure proc_1() show warnings;
-drop table if exists t1;
-call proc_1();
-drop table if exists t2;
-call proc_1();
-drop table if exists t1, t2;
-call proc_1();
-drop procedure proc_1;
-delimiter |;
---error ER_SP_NO_RETSET
-create function func_1() returns int begin show warnings; return 1; end|
-delimiter ;|
-prepare abc from "show warnings";
-drop table if exists t1;
-execute abc;
-drop table if exists t2;
-execute abc;
-drop table if exists t1, t2;
-execute abc;
-deallocate prepare abc;
-
-#
-# Bug#22684: The Functions ENCODE, DECODE and FORMAT are not real functions
-#
-
-set @my_password="password";
-set @my_data="clear text to encode";
-
-prepare stmt1 from 'select decode(encode(?, ?), ?)';
-execute stmt1 using @my_data, @my_password, @my_password;
-set @my_data="more text to encode";
-execute stmt1 using @my_data, @my_password, @my_password;
-set @my_password="new password";
-execute stmt1 using @my_data, @my_password, @my_password;
-deallocate prepare stmt1;
-
-set @to_format="123456789.123456789";
-set @dec=0;
-
-prepare stmt2 from 'select format(?, ?)';
-execute stmt2 using @to_format, @dec;
-set @dec=4;
-execute stmt2 using @to_format, @dec;
-set @dec=6;
-execute stmt2 using @to_format, @dec;
-set @dec=2;
-execute stmt2 using @to_format, @dec;
-set @to_format="100";
-execute stmt2 using @to_format, @dec;
-set @to_format="1000000";
-execute stmt2 using @to_format, @dec;
-set @to_format="10000";
-execute stmt2 using @to_format, @dec;
-deallocate prepare stmt2;
-
-
-#
-# BUG#18326: Do not lock table for writing during prepare of statement
-#
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-CREATE TABLE t1 (i INT);
-INSERT INTO t1 VALUES (1);
-CREATE TABLE t2 (i INT);
-INSERT INTO t2 VALUES (2);
-
-LOCK TABLE t1 READ, t2 WRITE;
-
-connect (conn1, localhost, root, , );
-
-# Prepare never acquires the lock, and thus should not block.
-PREPARE stmt1 FROM "SELECT i FROM t1";
-PREPARE stmt2 FROM "INSERT INTO t2 (i) VALUES (3)";
-
-# This should not block because READ lock on t1 is shared.
-EXECUTE stmt1;
-
-# This should block because WRITE lock on t2 is exclusive.
-send EXECUTE stmt2;
-
-connection default;
-
-SELECT * FROM t2;
-UNLOCK TABLES;
-let $wait_condition= SELECT COUNT(*) = 2 FROM t2;
---source include/wait_condition.inc
-SELECT * FROM t2;
-
-# DDL and DML works even if some client have a prepared statement
-# referencing the table.
-ALTER TABLE t1 ADD COLUMN j INT;
-ALTER TABLE t2 ADD COLUMN j INT;
-INSERT INTO t1 VALUES (4, 5);
-INSERT INTO t2 VALUES (4, 5);
-
-connection conn1;
-
-reap;
-EXECUTE stmt1;
-EXECUTE stmt2;
-SELECT * FROM t2;
-
-disconnect conn1;
-
-connection default;
-
-DROP TABLE t1, t2;
-
-#
-# Bug #24879 Prepared Statements: CREATE TABLE (UTF8 KEY) produces a growing
-# key length
-#
-# Test that parse information is not altered by subsequent executions of a
-# prepared statement
-#
-drop table if exists t1;
-prepare stmt
-from "create table t1 (c char(100) character set utf8, key (c(10)))";
-execute stmt;
-show create table t1;
-drop table t1;
-execute stmt;
-show create table t1;
-drop table t1;
-
-#
-# Bug #32030 DELETE does not return an error and deletes rows if error
-# evaluating WHERE
-#
-# Test that there is an error for prepared delete just like for the normal
-# one.
-#
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-create table t1 (a int, b int);
-create table t2 like t1;
-
-insert into t1 (a, b) values (1,1), (1,2), (1,3), (1,4), (1,5),
- (2,2), (2,3), (2,1), (3,1), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6);
-
-insert into t2 select a, max(b) from t1 group by a;
-
-prepare stmt from "delete from t2 where (select (select max(b) from t1 group
-by a having a < 2) x from t1) > 10000";
-
---error ER_SUBQUERY_NO_1_ROW
-delete from t2 where (select (select max(b) from t1 group
-by a having a < 2) x from t1) > 10000;
---error ER_SUBQUERY_NO_1_ROW
-execute stmt;
---error ER_SUBQUERY_NO_1_ROW
-execute stmt;
-
-deallocate prepare stmt;
-drop table t1, t2;
-
---echo #
---echo # Bug#27430 Crash in subquery code when in PS and table DDL changed
---echo # after PREPARE
---echo #
---echo # This part of the test doesn't work in embedded server, this is
---echo # why it's here. For the main test see ps_ddl*.test
---echo
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a int);
-prepare stmt from "show events where (1) in (select * from t1)";
-execute stmt;
-drop table t1;
-create table t1 (x int);
-execute stmt;
-drop table t1;
-deallocate prepare stmt;
-
---echo #
---echo # Bug#49141: Encode function is significantly slower in 5.1 compared to 5.0
---echo #
-
-prepare encode from "select encode(?, ?) into @ciphertext";
-prepare decode from "select decode(?, ?) into @plaintext";
-set @str="abc", @key="cba";
-execute encode using @str, @key;
-execute decode using @ciphertext, @key;
-select @plaintext;
-set @str="bcd", @key="dcb";
-execute encode using @str, @key;
-execute decode using @ciphertext, @key;
-select @plaintext;
-deallocate prepare encode;
-deallocate prepare decode;
-
---echo #
---echo # Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings
---echo #
-CREATE TABLE t1 (a DATETIME NOT NULL, b TINYINT);
-INSERT INTO t1 VALUES (0, 0),(0, 0);
-PREPARE stmt FROM "SELECT 1 FROM t1 WHERE
-ROW(a, b) >= ROW('1', (SELECT 1 FROM t1 WHERE a > 1234))";
---disable_warnings
-EXECUTE stmt;
-EXECUTE stmt;
---enable_warnings
-DEALLOCATE PREPARE stmt;
-DROP TABLE t1;
-
-###########################################################################
-
---echo #
---echo # Bug#54494 crash with explain extended and prepared statements
---echo #
-CREATE TABLE t1(a INT);
-INSERT INTO t1 VALUES (1),(2);
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='outer_join_with_cache=off';
-PREPARE stmt FROM 'EXPLAIN EXTENDED SELECT 1 FROM t1 RIGHT JOIN t1 t2 ON 1';
-EXECUTE stmt;
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-SET optimizer_switch=@save_optimizer_switch;
-DROP TABLE t1;
-
---echo #
---echo # Bug#54488 crash when using explain and prepared statements with subqueries
---echo #
-CREATE TABLE t1(f1 INT);
-INSERT INTO t1 VALUES (1),(1);
-PREPARE stmt FROM 'EXPLAIN SELECT 1 FROM t1 WHERE (SELECT (SELECT 1 FROM t1 GROUP BY f1))';
-EXECUTE stmt;
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-DROP TABLE t1;
-
---echo
---echo End of 5.1 tests.
-
---echo #
---echo # lp:1001500 Crash on the second execution of the PS for
---echo # a query with degenerated conjunctive condition
---echo # (see also mysql bug#12582849)
---echo #
-
-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
---echo #
---echo # WL#4435: Support OUT-parameters in prepared statements.
---echo #
---echo
-
-# The idea of this test case is to check that
-# - OUT-parameters of four allowed types (string, double, int, decimal) work
-# properly;
-# - INOUT and OUT parameters work properly;
-# - A mix of IN and OUT parameters work properly;
-
---disable_warnings
-DROP PROCEDURE IF EXISTS p_string;
-DROP PROCEDURE IF EXISTS p_double;
-DROP PROCEDURE IF EXISTS p_int;
-DROP PROCEDURE IF EXISTS p_decimal;
---enable_warnings
-
-delimiter |;
-
---echo
-CREATE PROCEDURE p_string(
- IN v0 INT,
- OUT v1 CHAR(32),
- IN v2 CHAR(32),
- INOUT v3 CHAR(32))
-BEGIN
- SET v0 = -1;
- SET v1 = 'test_v1';
- SET v2 = 'n/a';
- SET v3 = 'test_v3';
-END|
-
---echo
-CREATE PROCEDURE p_double(
- IN v0 INT,
- OUT v1 DOUBLE(4, 2),
- IN v2 DOUBLE(4, 2),
- INOUT v3 DOUBLE(4, 2))
-BEGIN
- SET v0 = -1;
- SET v1 = 12.34;
- SET v2 = 98.67;
- SET v3 = 56.78;
-END|
-
---echo
-CREATE PROCEDURE p_int(
- IN v0 CHAR(10),
- OUT v1 INT,
- IN v2 INT,
- INOUT v3 INT)
-BEGIN
- SET v0 = 'n/a';
- SET v1 = 1234;
- SET v2 = 9876;
- SET v3 = 5678;
-END|
-
---echo
-CREATE PROCEDURE p_decimal(
- IN v0 INT,
- OUT v1 DECIMAL(4, 2),
- IN v2 DECIMAL(4, 2),
- INOUT v3 DECIMAL(4, 2))
-BEGIN
- SET v0 = -1;
- SET v1 = 12.34;
- SET v2 = 98.67;
- SET v3 = 56.78;
-END|
-
-delimiter ;|
-
---echo
-PREPARE stmt_str FROM 'CALL p_string(?, ?, ?, ?)';
-PREPARE stmt_dbl FROM 'CALL p_double(?, ?, ?, ?)';
-PREPARE stmt_int FROM 'CALL p_int(?, ?, ?, ?)';
-PREPARE stmt_dec FROM 'CALL p_decimal(?, ?, ?, ?)';
-
---echo
-SET @x_str_1 = NULL;
-SET @x_str_2 = NULL;
-SET @x_str_3 = NULL;
-SET @x_dbl_1 = NULL;
-SET @x_dbl_2 = NULL;
-SET @x_dbl_3 = NULL;
-SET @x_int_1 = NULL;
-SET @x_int_2 = NULL;
-SET @x_int_3 = NULL;
-SET @x_dec_1 = NULL;
-SET @x_dec_2 = NULL;
-SET @x_dec_3 = NULL;
-
---echo
---echo -- Testing strings...
-
---echo
-EXECUTE stmt_str USING @x_int_1, @x_str_1, @x_str_2, @x_str_3;
-SELECT @x_int_1, @x_str_1, @x_str_2, @x_str_3;
-
---echo
-EXECUTE stmt_str USING @x_int_1, @x_str_1, @x_str_2, @x_str_3;
-SELECT @x_int_1, @x_str_1, @x_str_2, @x_str_3;
-
---echo
---echo -- Testing doubles...
-
---echo
-EXECUTE stmt_dbl USING @x_int_1, @x_dbl_1, @x_dbl_2, @x_dbl_3;
-SELECT @x_int_1, @x_dbl_1, @x_dbl_2, @x_dbl_3;
-
---echo
-EXECUTE stmt_dbl USING @x_int_1, @x_dbl_1, @x_dbl_2, @x_dbl_3;
-SELECT @x_int_1, @x_dbl_1, @x_dbl_2, @x_dbl_3;
-
---echo
---echo -- Testing ints...
-
---echo
-EXECUTE stmt_int USING @x_str_1, @x_int_1, @x_int_2, @x_int_3;
-SELECT @x_str_1, @x_int_1, @x_int_2, @x_int_3;
-
---echo
-EXECUTE stmt_int USING @x_str_1, @x_int_1, @x_int_2, @x_int_3;
-SELECT @x_str_1, @x_int_1, @x_int_2, @x_int_3;
-
---echo
---echo -- Testing decs...
-
---echo
-EXECUTE stmt_dec USING @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3;
-SELECT @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3;
-
---echo
-EXECUTE stmt_dec USING @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3;
-SELECT @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3;
-
---echo
-DEALLOCATE PREPARE stmt_str;
-DEALLOCATE PREPARE stmt_dbl;
-DEALLOCATE PREPARE stmt_int;
-DEALLOCATE PREPARE stmt_dec;
-
---echo
-DROP PROCEDURE p_string;
-DROP PROCEDURE p_double;
-DROP PROCEDURE p_int;
-DROP PROCEDURE p_decimal;
-
-#
-# Another test case for WL#4435: check out parameters in Dynamic SQL.
-#
-
---echo
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
-DROP PROCEDURE IF EXISTS p2;
---enable_warnings
-
---echo
-
-CREATE PROCEDURE p1(OUT v1 CHAR(10))
- SET v1 = 'test1';
-
---echo
-
-delimiter |;
-CREATE PROCEDURE p2(OUT v2 CHAR(10))
-BEGIN
- SET @query = 'CALL p1(?)';
- PREPARE stmt1 FROM @query;
- EXECUTE stmt1 USING @u1;
- DEALLOCATE PREPARE stmt1;
-
- SET v2 = @u1;
-END|
-delimiter ;|
-
---echo
-
-CALL p2(@a);
-SELECT @a;
-
---echo
-
-DROP PROCEDURE p1;
-DROP PROCEDURE p2;
-
-###########################################################################
-
---source t/wl4435_generated.inc
-
-###########################################################################
-
---echo
---echo # End of WL#4435.
-
-###########################################################################
-
-
---echo #
---echo # WL#4284: Transactional DDL locking
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-CREATE TABLE t1 (a INT);
-BEGIN;
-SELECT * FROM t1;
---echo # Test that preparing a CREATE TABLE does not take a exclusive metdata lock.
-PREPARE stmt1 FROM "CREATE TABLE t1 AS SELECT 1";
---error ER_TABLE_EXISTS_ERROR
-EXECUTE stmt1;
-DEALLOCATE PREPARE stmt1;
-DROP TABLE t1;
-
---echo #
---echo # WL#4284: Transactional DDL locking
---echo #
---echo # Test that metadata locks taken during prepare are released.
---echo #
-
-connect(con1,localhost,root,,);
-connection default;
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-CREATE TABLE t1 (a INT);
-connection con1;
-BEGIN;
-PREPARE stmt1 FROM "SELECT * FROM t1";
-connection default;
-DROP TABLE t1;
-disconnect con1;
-
---echo
---echo #
---echo # Bug#56115: invalid memory reads when PS selecting from
---echo # information_schema tables
---echo # Bug#58701: crash in Field::make_field, cursor-protocol
---echo #
---echo # NOTE: MTR should be run both with --ps-protocol and --cursor-protocol.
---echo #
---echo
-
-SELECT *
-FROM (SELECT 1 UNION SELECT 2) t;
-
---echo
---echo # Bug#13805127: Stored program cache produces wrong result in same THD
---echo
-
-PREPARE s1 FROM
-"
-SELECT c1, t2.c2, count(c3)
-FROM
- (
- SELECT 3 as c2 FROM dual WHERE @x = 1
- UNION
- SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
- ) AS t1,
- (
- SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
- UNION
- SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
- UNION
- SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
- ) AS t2
-WHERE t2.c2 = t1.c2
-GROUP BY c1, c2
-";
-
---echo
-SET @x = 1;
-SELECT c1, t2.c2, count(c3)
-FROM
- (
- SELECT 3 as c2 FROM dual WHERE @x = 1
- UNION
- SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
- ) AS t1,
- (
- SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
- UNION
- SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
- UNION
- SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
- ) AS t2
-WHERE t2.c2 = t1.c2
-GROUP BY c1, c2;
---echo
-EXECUTE s1;
-
---echo
-SET @x = 2;
-SELECT c1, t2.c2, count(c3)
-FROM
- (
- SELECT 3 as c2 FROM dual WHERE @x = 1
- UNION
- SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
- ) AS t1,
- (
- SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
- UNION
- SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
- UNION
- SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
- ) AS t2
-WHERE t2.c2 = t1.c2
-GROUP BY c1, c2;
---echo
-EXECUTE s1;
-
---echo
-SET @x = 1;
-SELECT c1, t2.c2, count(c3)
-FROM
- (
- SELECT 3 as c2 FROM dual WHERE @x = 1
- UNION
- SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
- ) AS t1,
- (
- SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
- UNION
- SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
- UNION
- SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
- ) AS t2
-WHERE t2.c2 = t1.c2
-GROUP BY c1, c2;
---echo
-EXECUTE s1;
-
-DEALLOCATE PREPARE s1;
-
-###########################################################################
-#
-# restoring of the Item tree in BETWEEN with dates
-#
-prepare stmt from "select date('2010-10-10') between '2010-09-09' and ?";
-set @a='2010-11-11';
-execute stmt using @a;
-execute stmt using @a;
-set @a='2010-08-08';
-execute stmt using @a;
-execute stmt using @a;
-
---echo #
---echo # Bug #892725: look-up is changed for a full scan when executing PS
---echo #
-
-create table t1 (a int primary key, b int);
-insert into t1 values
- (7,70), (3,40), (4,40), (8,70), (1,70), (9,50), (2,70);
-
-prepare st from 'select * from t1 where a=8';
-
-flush status;
-execute st;
-show status like '%Handler_read%';
-flush status;
-execute st;
-show status like '%Handler_read%';
-flush status;
-select * from t1 use index() where a=3;
-show status like '%Handler_read%';
-flush status;
-execute st;
-show status like '%Handler_read%';
-
-deallocate prepare st;
-drop table t1;
-
---echo #
---echo # Bug mdev-5410: crash at the execution of PS with subselect
---echo # formed by UNION with global ORDER BY
---echo #
-
-CREATE TABLE t1 (a int DEFAULT NULL);
-INSERT INTO t1 VALUES (2), (4);
-CREATE TABLE t2 (b int DEFAULT NULL);
-INSERT INTO t2 VALUES (1), (3);
-
-PREPARE stmt FROM "
-SELECT c1 FROM (SELECT (SELECT a FROM t1 WHERE t1.a <= t2.b
- UNION ALL
- SELECT a FROM t1 WHERE t1.a+3<= t2.b
- ORDER BY a DESC) AS c1 FROM t2) t3;
-";
-
-EXECUTE stmt;
-EXECUTE stmt;
-
-DROP TABLE t1,t2;
-
-
---echo #
---echo # MDEV-5369: Wrong result (0 instead of NULL) on 2nd execution of
---echo # PS with LEFT JOIN, TEMPTABLE view
---echo #
-
-
-CREATE TABLE t1 (a INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (0),(8);
-
-CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=MyISAM;
-CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2;
-
-SELECT SUM(pk) FROM t1 LEFT JOIN v2 ON a = pk;
-
-PREPARE stmt FROM "SELECT SUM(pk) FROM t1 LEFT JOIN v2 ON a = pk";
-EXECUTE stmt;
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-
-DROP VIEW v2;
-DROP TABLE t1, t2;
-
---echo # End of 5.3 tests
-
---echo #
---echo # MDEV-5505: Assertion `! is_set()' fails on PREPARE SELECT
---echo # with out of range in GROUP BY
---echo #
-CREATE TABLE t1 (a INT);
-
---error ER_DATA_OUT_OF_RANGE
-PREPARE stmt FROM "SELECT 1 FROM t1 GROUP BY 0 OR 18446744073709551615+1";
---error ER_DATA_OUT_OF_RANGE
-SELECT 1 FROM t1 GROUP BY 0 OR 18446744073709551615+1;
-
-drop table t1;
-
---echo # End of 5.3 tests
-
---echo #
---echo # MDEV-8756: MariaDB 10.0.21 crashes during PREPARE
---echo #
-
-CREATE TABLE t1 ( id INT(10), value INT(10) );
-CREATE TABLE t2 ( id INT(10) );
-SET @save_sql_mode= @@sql_mode;
-SET SESSION sql_mode = 'ONLY_FULL_GROUP_BY';
-
-PREPARE stmt FROM 'UPDATE t1 t1 SET value = (SELECT 1 FROM t2 WHERE id = t1.id)';
-execute stmt;
-insert into t1 values (1,10),(2,10),(3,10);
-insert into t2 values (1),(2);
-execute stmt;
-select * from t1;
-deallocate prepare stmt;
-SET SESSION sql_mode = @save_sql_mode;
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-8833: Crash of server on prepared statement with
---echo # conversion to semi-join
---echo #
-
-CREATE TABLE t1 (column1 INT);
-INSERT INTO t1 VALUES (3),(9);
-
-CREATE TABLE t2 (column2 INT);
-INSERT INTO t2 VALUES (1),(4);
-
-CREATE TABLE t3 (column3 INT);
-INSERT INTO t3 VALUES (6),(8);
-
-CREATE TABLE t4 (column4 INT);
-INSERT INTO t4 VALUES (2),(5);
-
-PREPARE stmt FROM "SELECT ( SELECT MAX( table1.column1 ) AS field1
-FROM t1 AS table1
-WHERE table3.column3 IN ( SELECT table2.column2 AS field2 FROM t2 AS table2 )
-) AS sq
-FROM t3 AS table3, t4 AS table4";
-EXECUTE stmt;
-EXECUTE stmt;
-deallocate prepare stmt;
-drop table t1,t2,t3,t4;
-
---echo #
---echo # MDEV-11859: the plans for the first and the second executions
---echo # of PS are not the same
---echo #
-
-create table t1 (id int, c varchar(3), key idx(c))engine=myisam;
-insert into t1 values (3,'bar'), (1,'xxx'), (2,'foo'), (5,'yyy');
-
-prepare stmt1 from
-"explain extended
- select * from t1 where (1, 2) in ( select 3, 4 ) or c = 'foo'";
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-
-prepare stmt1 from
-"select * from t1 where (1, 2) in ( select 3, 4 ) or c = 'foo'";
-flush status;
-execute stmt1;
-show status like '%Handler_read%';
-flush status;
-execute stmt1;
-show status like '%Handler_read%';
-deallocate prepare stmt1;
-
-prepare stmt2 from
-"explain extended
- select * from t1 where (1, 2) in ( select 3, 4 )";
-execute stmt2;
-execute stmt2;
-deallocate prepare stmt2;
-
-drop table t1;
-
---echo #
---echo # MDEV-9208: Function->Function->View = Mysqld segfault
---echo # (Server crashes in Dependency_marker::visit_field on 2nd
---echo # execution with merged subquery)
---echo #
-
-CREATE TABLE t1 (i1 INT);
-insert into t1 values(1),(2);
-
-CREATE TABLE t2 (i2 INT);
-insert into t2 values(1),(2);
-
-prepare stmt from "
- select 1 from (
- select
- if (i1<0, 0, 0) as f1,
- (select f1) as f2
- from t1, t2
- ) sq
-";
-
-execute stmt;
-execute stmt;
-
-drop table t1,t2;
-
---echo #
---echo # MDEV-9619: Assertion `null_ref_table' failed in virtual
---echo # table_map Item_direct_view_ref::used_tables() const on 2nd
---echo # execution of PS
---echo #
-
-CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE=MyISAM;
-CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
-INSERT INTO t1 VALUES ('a'),('b');
-
-CREATE TABLE t2 (f2 VARCHAR(10)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES ('c'),('d');
-
-PREPARE stmt FROM "SELECT * FROM v1 WHERE f1 = SOME ( SELECT f2 FROM t2 )";
-EXECUTE stmt;
-EXECUTE stmt;
-insert into t1 values ('c');
-EXECUTE stmt;
-EXECUTE stmt;
-
-deallocate prepare stmt;
-drop view v1;
-drop table t1,t2;
-
-CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE=MyISAM;
-CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
-INSERT INTO t1 VALUES ('a'),('b');
-
-CREATE TABLE t2 (f2 VARCHAR(10)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES ('c'),('d');
-
-PREPARE stmt FROM "SELECT * FROM v1 WHERE (f1,f1) = SOME ( SELECT f2,f2 FROM t2 )";
-EXECUTE stmt;
-EXECUTE stmt;
-insert into t1 values ('c');
-EXECUTE stmt;
-EXECUTE stmt;
-
-deallocate prepare stmt;
-drop view v1;
-drop table t1,t2;
-
-
-
-CREATE TABLE t1 (column1 INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (3),(9);
-
-CREATE TABLE t2 (column2 INT) ENGINE=MyISAM;
-
-INSERT INTO t2 VALUES (1),(4);
-
-CREATE TABLE t3 (column3 INT) ENGINE=MyISAM;
-INSERT INTO t3 VALUES (6),(8);
-
-CREATE TABLE t4 (column4 INT) ENGINE=MyISAM;
-INSERT INTO t4 VALUES (2),(5);
-
-PREPARE stmt FROM "
-SELECT (
- SELECT MAX( table1.column1 ) AS field1
- FROM t1 AS table1
- WHERE (111,table3.column3) IN ( SELECT 111,table2.column2 AS field2 FROM t2 AS table2 )
-) AS sq
-FROM t3 AS table3, t4 AS table4 GROUP BY sq
-";
-
-EXECUTE stmt;
-EXECUTE stmt;
-
-deallocate prepare stmt;
-drop table t1,t2,t3,t4;
-
-create table t1 (a int, b int, c int);
-create table t2 (x int, y int, z int);
-create table t3 as select * from t1;
-insert into t1 values (1,2,3),(4,5,6),(100,200,300),(400,500,600);
-insert into t2 values (1,2,3),(7,8,9),(100,200,300),(400,500,600);
-insert into t3 values (1,2,3),(11,12,13),(100,0,0),(400,500,600);
-
-
-set @optimizer_switch_save=@@optimizer_switch;
-set @join_cache_level_save=@@join_cache_level;
-set optimizer_switch='materialization=off';
-set join_cache_level=0;
-select * from t1 where (select a,b from t3 where t3.c=t1.c) in (select x,y from t2 where t1.c= t2.z);
-prepare stmt from "select * from t1 where (select a,b from t3 where t3.c=t1.c) in (select x,y from t2 where t1.c= t2.z)";
-EXECUTE stmt;
-EXECUTE stmt;
-
-create view v1 as select * from t1;
-create view v2 as select * from t2;
-create view v3 as select * from t3;
-select * from v1 where (select a,b from v3 where v3.c=v1.c) in (select x,y from v2 where v1.c= v2.z);
-prepare stmt from "select * from v1 where (select a,b from v3 where v3.c=v1.c) in (select x,y from v2 where v1.c= v2.z)";
-EXECUTE stmt;
-EXECUTE stmt;
-set optimizer_switch=@optimizer_switch_save;
-set join_cache_level=@join_cache_level_save;
-
-deallocate prepare stmt;
-drop view v1,v2,v3;
-drop table t1,t2,t3;
-
---echo #
---echo # MDEV-10657: incorrect result returned with binary protocol
---echo # (prepared statements)
---echo #
-
-create table t1 (code varchar(10) primary key);
-INSERT INTO t1(code) VALUES ('LINE1'), ('LINE2'), ('LINE3');
-SELECT X.*
-FROM
- (SELECT CODE, RN
- FROM
- (SELECT A.CODE, @cnt := @cnt + 1 AS RN
- FROM t1 A, (SELECT @cnt := 0) C) T
- ) X;
-drop table t1;
---echo # End of 5.5 tests
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-10709 Expressions as parameters to Dynamic SQL
---echo #
-
---echo #
---echo # Using a simple expressions as an EXECUTE parameter
---echo #
-
-PREPARE stmt FROM 'SELECT ? FROM DUAL';
-EXECUTE stmt USING 10;
-DEALLOCATE PREPARE stmt;
-
-PREPARE stmt FROM 'SELECT ? FROM DUAL';
-EXECUTE stmt USING TO_BASE64('xxx');
-DEALLOCATE PREPARE stmt;
-
-PREPARE stmt FROM 'SELECT ?+? FROM DUAL';
-EXECUTE stmt USING 10, 10 + 10;
-DEALLOCATE PREPARE stmt;
-
-PREPARE stmt FROM 'SELECT CONCAT(?,?) FROM DUAL';
-EXECUTE stmt USING 'xxx', CONCAT('yyy','zzz');
-DEALLOCATE PREPARE stmt;
-
---echo #
---echo # Testing disallowed expressions in USING
---echo #
-
-PREPARE stmt FROM 'SELECT ? FROM DUAL';
---error ER_PARSE_ERROR
-EXECUTE stmt USING (SELECT 1);
-DEALLOCATE PREPARE stmt;
-
-CREATE FUNCTION f1() RETURNS VARCHAR(10) RETURN 'test';
-PREPARE stmt FROM 'SELECT ? FROM DUAL';
---error ER_SUBQUERIES_NOT_SUPPORTED
-EXECUTE stmt USING f1();
-DEALLOCATE PREPARE stmt;
-DROP FUNCTION f1;
-
---echo #
---echo # Testing erroneous expressions in USING
---echo #
-
-PREPARE stmt FROM 'SELECT ?';
---error ER_CANT_AGGREGATE_2COLLATIONS
-EXECUTE stmt USING _latin1'a'=_latin2'a';
-DEALLOCATE PREPARE stmt;
-
-PREPARE stmt FROM 'SELECT ?';
---error ER_OPERAND_COLUMNS
-EXECUTE stmt USING ROW(1,2);
-DEALLOCATE PREPARE stmt;
-
---echo #
---echo # Creating tables from EXECUTE parameters
---echo #
-
-PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ? AS c1 FROM DUAL';
-EXECUTE stmt USING 10;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-EXECUTE stmt USING 10.123;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-EXECUTE stmt USING 10.123e0;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-EXECUTE stmt USING CURRENT_DATE;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-EXECUTE stmt USING CURRENT_TIMESTAMP;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-EXECUTE stmt USING CURRENT_TIMESTAMP(3);
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-EXECUTE stmt USING CURRENT_TIMESTAMP(6);
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-EXECUTE stmt USING CURRENT_TIME;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-EXECUTE stmt USING CURRENT_TIME(3);
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-EXECUTE stmt USING CURRENT_TIME(6);
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-DEALLOCATE PREPARE stmt;
-
-
---echo #
---echo # Using a user variable as an EXECUTE..USING out parameter
---echo #
-
-DELIMITER /;
-CREATE PROCEDURE p1(OUT a INT)
-BEGIN
- SET a:= 10;
-END;
-/
-DELIMITER ;/
-SET @a=1;
-CALL p1(@a);
-SELECT @a;
-SET @a=2;
-PREPARE stmt FROM 'CALL p1(?)';
-EXECUTE stmt USING @a;
-SELECT @a;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Using an SP variable as an EXECUTE..USING out parameter
---echo #
-
-DELIMITER /;
-CREATE PROCEDURE p1 (OUT a INT)
-BEGIN
- SET a=10;
-END;
-/
-CREATE PROCEDURE p2 (OUT a INT)
-BEGIN
- PREPARE stmt FROM 'CALL p1(?)';
- EXECUTE stmt USING a;
-END;
-/
-DELIMITER ;/
-SET @a= 1;
-CALL p2(@a);
-SELECT @a;
-DROP PROCEDURE p2;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Testing re-prepare on a table metadata update between PREPARE and EXECUTE
---echo #
-
-CREATE TABLE t1 (a INT);
-DELIMITER /;
-CREATE PROCEDURE p1(a INT)
-BEGIN
- INSERT INTO t1 VALUES (a);
-END;
-/
-DELIMITER ;/
-PREPARE stmt FROM 'CALL p1(?)';
-EXECUTE stmt USING 10;
-SELECT * FROM t1;
-CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=NEW.a+1;
-EXECUTE stmt USING 20;
-SELECT * FROM t1;
-DEALLOCATE PREPARE stmt;
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
---echo #
---echo # End of MDEV-10709 Expressions as parameters to Dynamic SQL
---echo #
-
---echo #
---echo # MDEV-10585 EXECUTE IMMEDIATE statement
---echo #
-
-EXECUTE IMMEDIATE 'SELECT 1 AS a';
-SET @a=10;
-EXECUTE IMMEDIATE 'SELECT ? AS a' USING @a;
-EXECUTE IMMEDIATE 'SELECT ? AS a' USING 20;
-
-
---echo #
---echo # Erroneous queries
---echo #
-
---error ER_PARSE_ERROR
-EXECUTE IMMEDIATE 'xxx';
-
---error ER_WRONG_ARGUMENTS
-EXECUTE IMMEDIATE 'SELECT 1' USING @a;
-
---error ER_WRONG_ARGUMENTS
-EXECUTE IMMEDIATE 'SELECT ?';
-
---error ER_UNSUPPORTED_PS
-EXECUTE IMMEDIATE 'EXECUTE IMMEDIATE "SELECT 1"';
-
---error ER_UNSUPPORTED_PS
-EXECUTE IMMEDIATE 'PREPARE stmt FROM "SELECT 1"';
-
---error ER_UNSUPPORTED_PS
-EXECUTE IMMEDIATE 'EXECUTE stmt';
-
---error ER_UNSUPPORTED_PS
-EXECUTE IMMEDIATE 'DEALLOCATE PREPARE stmt';
-
---error ER_CANT_AGGREGATE_2COLLATIONS
-EXECUTE IMMEDIATE 'SELECT ?' USING _latin1'a'=_latin2'a';
-
---error ER_OPERAND_COLUMNS
-EXECUTE IMMEDIATE 'SELECT ?' USING ROW(1,2);
-
---echo #
---echo # Testing disallowed expressions in USING
---echo #
-
---error ER_PARSE_ERROR
-EXECUTE IMMEDIATE 'SELECT ? FROM DUAL' USING (SELECT 1);
-
-CREATE FUNCTION f1() RETURNS VARCHAR(10) RETURN 'test';
---error ER_SUBQUERIES_NOT_SUPPORTED
-EXECUTE IMMEDIATE 'SELECT ? FROM DUAL' USING f1();
-DROP FUNCTION f1;
-
---echo #
---echo # DDL
---echo #
-
-EXECUTE IMMEDIATE 'CREATE TABLE t1 (a INT)';
-EXECUTE IMMEDIATE 'SHOW CREATE TABLE t1';
-EXECUTE IMMEDIATE 'DROP TABLE t1';
-
-SET @stmt= 'CREATE TABLE t1 (a INT)';
-EXECUTE IMMEDIATE @stmt;
-SET @stmt= 'SHOW CREATE TABLE t1';
-EXECUTE IMMEDIATE @stmt;
-SET @stmt= 'DROP TABLE t1';
-EXECUTE IMMEDIATE @stmt;
-
-
---echo #
---echo # DDL with parameters
---echo #
-
-SET @a= 10, @b= 10.1, @c= 10e0, @d='str';
-EXECUTE IMMEDIATE
- 'CREATE TABLE t1 AS SELECT ? AS a,? AS b,? AS c,? AS d'
- USING @a,@b,@c,@d;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-EXECUTE IMMEDIATE
- 'CREATE TABLE t1 AS SELECT ? AS a,? AS b,? AS c,? AS d'
- USING 10, 10.1, 10e0, 'str';
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-EXECUTE IMMEDIATE
- 'CREATE TABLE t1 AS SELECT ? AS t1,? AS t2, ? AS d1,? AS dt1, ? AS dt2'
- USING TIME'10:20:30',
- TIME'10:20:30.123',
- DATE'2001-01-01',
- TIMESTAMP'2001-01-01 10:20:30',
- TIMESTAMP'2001-01-01 10:20:30.123';
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-
---echo #
---echo # Using a user variable as an EXECUTE IMMEDIATE..USING out parameter
---echo #
-
-DELIMITER /;
-CREATE PROCEDURE p1(OUT a INT)
-BEGIN
- SET a:= 10;
-END;
-/
-DELIMITER ;/
-SET @a=1;
-CALL p1(@a);
-SELECT @a;
-SET @a=2;
-EXECUTE IMMEDIATE 'CALL p1(?)' USING @a;
-SELECT @a;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Using an SP variable as an EXECUTE IMMEDIATE..USING out parameter
---echo #
-
-DELIMITER /;
-CREATE PROCEDURE p1 (OUT a INT)
-BEGIN
- SET a=10;
-END;
-/
-CREATE PROCEDURE p2 (OUT a INT)
-BEGIN
- EXECUTE IMMEDIATE 'CALL p1(?)' USING a;
-END;
-/
-DELIMITER ;/
-SET @a= 1;
-CALL p2(@a);
-SELECT @a;
-DROP PROCEDURE p2;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Changing user variables
---echo #
-
-SET @a=10;
-EXECUTE IMMEDIATE 'SET @a=@a+1';
-SELECT @a;
-
-
---echo #
---echo # SET STATEMENT
---echo #
-
-SET @@max_sort_length=1024;
-EXECUTE IMMEDIATE 'SET STATEMENT max_sort_length=1025 FOR SELECT @@max_sort_length';
-SELECT @@max_sort_length;
-SET @@max_sort_length=DEFAULT;
-
-
---echo #
---echo # Similar to prepared EXECUTE, IMMEDIATE is not allowed in stored functions
---echo #
-DELIMITER $$;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE FUNCTION f1() RETURNS INT
-BEGIN
- EXECUTE IMMEDIATE 'DO 1';
- RETURN 1;
-END;
-$$
-DELIMITER ;$$
-
-
---echo #
---echo # Status variables
---echo #
-CREATE FUNCTION get_status_var(name TEXT) RETURNS INT
- RETURN (SELECT CAST(VARIABLE_VALUE AS INT)
- FROM INFORMATION_SCHEMA.SESSION_STATUS
- WHERE VARIABLE_NAME=name);
-DELIMITER $$;
-CREATE PROCEDURE test_status_var(name TEXT)
-BEGIN
- SET @cnt0=get_status_var(name);
- EXECUTE IMMEDIATE 'DO 1';
- SET @cnt1=get_status_var(name);
- SELECT @cnt1-@cnt0 AS increment;
-END;
-$$
-DELIMITER ;$$
---echo # Note, EXECUTE IMMEDIATE does not increment COM_EXECUTE_SQL
---echo # It increments COM_EXECUTE_IMMEDIATE instead.
-CALL test_status_var('COM_EXECUTE_SQL');
-CALL test_status_var('COM_EXECUTE_IMMEDIATE');
-CALL test_status_var('COM_STMT_PREPARE');
-CALL test_status_var('COM_STMT_EXECUTE');
-CALL test_status_var('COM_STMT_CLOSE');
-
-DROP PROCEDURE test_status_var;
-DROP FUNCTION get_status_var;
-
---echo #
---echo # End of MDEV-10585 EXECUTE IMMEDIATE statement
---echo #
-
---echo #
---echo # MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions
---echo #
-
---echo #
---echo # Testing erroneous and diallowed prepare source
---echo #
-
---error ER_CANT_AGGREGATE_2COLLATIONS
-EXECUTE IMMEDIATE CONCAT(_latin1'SELECT 1 AS c FROM ', _latin2 'DUAL');
---error ER_CANT_AGGREGATE_2COLLATIONS
-PREPARE stmt FROM CONCAT(_latin1'SELECT 1 AS c FROM ', _latin2 'DUAL');
-
---error ER_PARSE_ERROR
-EXECUTE IMMEDIATE (SELECT 'SELECT 1');
---error ER_PARSE_ERROR
-PREPARE stmt FROM (SELECT 'SELECT 1');
-
---error ER_BAD_FIELD_ERROR
-EXECUTE IMMEDIATE a;
---error ER_BAD_FIELD_ERROR
-PREPARE stmt FROM a;
-
---error ER_PARSE_ERROR
-EXECUTE IMMEDIATE NULL;
---error ER_PARSE_ERROR
-PREPARE stmt FROM NULL;
-
---error ER_PARSE_ERROR
-EXECUTE IMMEDIATE CONCAT(NULL);
---error ER_PARSE_ERROR
-PREPARE stmt FROM CONCAT(NULL);
-
---error ER_PARSE_ERROR
-EXECUTE IMMEDIATE ? USING 'SELECT 1';
-
---error ER_PARSE_ERROR
-EXECUTE IMMEDIATE 10;
-
---error ER_PARSE_ERROR
-EXECUTE IMMEDIATE TIME'10:20:30';
-
---error ER_OPERAND_COLUMNS
-EXECUTE IMMEDIATE ROW('SELECT 1','SELECT 2');
-
---error ER_INVALID_GROUP_FUNC_USE
-EXECUTE IMMEDIATE MAX('SELECT 1 AS c');
-
---error ER_BAD_FIELD_ERROR
-EXECUTE IMMEDIATE DEFAULT(a);
-
---error ER_BAD_FIELD_ERROR
-EXECUTE IMMEDIATE VALUE(a);
-
-
-CREATE FUNCTION f1() RETURNS VARCHAR(64) RETURN 't1';
---error ER_SUBQUERIES_NOT_SUPPORTED
-EXECUTE IMMEDIATE f1();
---error ER_SUBQUERIES_NOT_SUPPORTED
-PREPARE stmt FROM f1();
-DROP FUNCTION f1;
-
---error ER_SUBQUERIES_NOT_SUPPORTED
-EXECUTE IMMEDIATE non_existent();
-
-
---echo #
---echo # Testing literals in prepare source
---echo #
-EXECUTE IMMEDIATE N'SELECT 1 AS c';
-EXECUTE IMMEDIATE _latin1'SELECT 1 AS c';
-EXECUTE IMMEDIATE 'SELECT ' '1' ' AS c' ' FROM ' 'DUAL';
-EXECUTE IMMEDIATE 0x53454C4543542031 /*This is 'SELECT 1'*/;
-
---echo #
---echo # Testing user variables in prepare source
---echo #
-
-SET @stmt='SELECT 1 AS c FROM DUAL';
-EXECUTE IMMEDIATE @stmt;
-PREPARE stmt FROM @stmt;
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-
-SET @table_name='DUAL';
-EXECUTE IMMEDIATE CONCAT('SELECT 1 AS a FROM ', @table_name);
-PREPARE stmt FROM CONCAT('SELECT 1 AS a FROM ', @table_name);
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-
---echo #
---echo # Testing SP parameters and variables in prepare source
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1(table_name VARCHAR(64))
-BEGIN
- EXECUTE IMMEDIATE CONCAT('SELECT 1 AS c FROM ', table_name);
-END;
-$$
-DELIMITER ;$$
-CALL p1('DUAL');
-DROP PROCEDURE p1;
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE table_name VARCHAR(64) DEFAULT 'DUAL';
- EXECUTE IMMEDIATE CONCAT('SELECT 1 AS c FROM ', table_name);
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Testing complex expressions
---echo #
-EXECUTE IMMEDIATE CONVERT('SELECT 1 AS c' USING utf8);
-EXECUTE IMMEDIATE CAST('SELECT 1 AS c' AS CHAR);
-EXECUTE IMMEDIATE _latin1'SELECT 1 AS c' COLLATE latin1_bin;
-EXECUTE IMMEDIATE (((('SELECT 1 AS c'))));
-EXECUTE IMMEDIATE CASE WHEN 1>2 THEN 'SELECT 1 AS c' ELSE 'SELECT 2 AS c' END;
-EXECUTE IMMEDIATE TRIM('SELECT 1 AS c');
-EXECUTE IMMEDIATE SUBSTRING('SELECT 1 AS c' FROM 1);
-EXECUTE IMMEDIATE COALESCE(NULL, 'SELECT 1 AS c');
-
---echo #
---echo # Testing SET STATEMENT and system variables
---echo #
-CREATE TABLE t1 (a INT);
-SET STATEMENT max_sort_length=1025 FOR EXECUTE IMMEDIATE CONCAT('INSERT INTO t1 VALUES (', @@max_sort_length, ')');
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # End of MDEV-10866 Extend PREPARE and EXECUTE IMMEDIATE to understand expressions
---echo #
-
---echo #
---echo # End of 10.2 tests
---echo #
-
-
---echo #
---echo # MDEV-11360 Dynamic SQL: DEFAULT as a bind parameter
---echo #
-
-# Correct usage
-CREATE TABLE t1 (a INT DEFAULT 10, b INT DEFAULT NULL);
-EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?,?)' USING DEFAULT, DEFAULT;
-SELECT * FROM t1;
-UPDATE t1 SET a=20, b=30;
-SELECT * FROM t1;
-EXECUTE IMMEDIATE 'UPDATE t1 SET a=?,b=?' USING DEFAULT, DEFAULT;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-# Incorrect usage in a expression in INSERT..VALUES
-CREATE TABLE t1 (a INT DEFAULT 10);
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (?+1)' USING DEFAULT;
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'INSERT INTO t1 VALUES (CONCAT(?,?))' USING DEFAULT, 'test';
-DROP TABLE t1;
-
-# Incorrect usage in UPDATE..SET
-CREATE TABLE t1 (a INT DEFAULT 10);
-INSERT INTO t1 VALUES (20);
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'UPDATE t1 SET a=?+1' USING DEFAULT;
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'UPDATE t1 SET a=CONCAT(?,?)' USING DEFAULT, 'test';
-DROP TABLE t1;
-
-# Incorrect usage in not an UPDATE/INSERT query at all
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'SELECT CAST(? AS SIGNED)' USING DEFAULT;
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'SELECT CAST(? AS DOUBLE)' USING DEFAULT;
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'SELECT CAST(? AS CHAR)' USING DEFAULT;
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'SELECT CAST(? AS DECIMAL(10,1))' USING DEFAULT;
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'SELECT CAST(? AS TIME)' USING DEFAULT;
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'SELECT CAST(? AS DATE)' USING DEFAULT;
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'SELECT CAST(? AS DATETIME)' USING DEFAULT;
-
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'SELECT ?+1' USING DEFAULT;
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'SELECT CONCAT(?,?)' USING DEFAULT,'test';
-
-# Incorrect usage in the LIMIT clause
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'SELECT 1 LIMIT ?' USING DEFAULT;
-CREATE TABLE t1 (a INT DEFAULT 10);
-INSERT INTO t1 VALUES (1),(2),(3);
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'SELECT * FROM t1 LIMIT ?' USING DEFAULT;
-DROP TABLE t1;
-
---echo # The output of this query in 'Note' is a syntactically incorrect query.
---echo # But as it's never logged, it's ok. It should be human readable only.
-EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT ?' USING DEFAULT;
-
-# This tests Item_param::eq() for DEFAULT as a bound value
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1),(2),(3);
---error ER_INVALID_DEFAULT_PARAM
-EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE ?+a<=>?+a' USING DEFAULT,DEFAULT;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-11780 Crash with PREPARE + SP out parameter + literal
---echo #
-
-DELIMITER $$;
-CREATE OR REPLACE PROCEDURE p1(OUT a INT)
-BEGIN
- SET a=10;
-END;
-$$
-DELIMITER ;$$
-
-PREPARE stmt FROM 'CALL p1(?)';
---error ER_SP_NOT_VAR_ARG
-EXECUTE stmt USING 10;
---error ER_SP_NOT_VAR_ARG
-EXECUTE stmt USING DEFAULT;
---error ER_SP_NOT_VAR_ARG
-EXECUTE stmt USING IGNORE;
-DEALLOCATE PREPARE stmt;
-
---error ER_SP_NOT_VAR_ARG
-EXECUTE IMMEDIATE 'CALL p1(?)' USING 10;
---error ER_SP_NOT_VAR_ARG
-EXECUTE IMMEDIATE 'CALL p1(?)' USING DEFAULT;
---error ER_SP_NOT_VAR_ARG
-EXECUTE IMMEDIATE 'CALL p1(?)' USING IGNORE;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # MDEV-14434 Wrong result for CHARSET(CONCAT(?,const))
---echo #
-
-SET NAMES utf8;
-EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(5,_latin1'a'))";
-EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5;
-EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5.5;
-EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING 5.5e0;
-EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING TIME'10:20:30';
-EXECUTE IMMEDIATE "SELECT CHARSET(CONCAT(?,_latin1'a'))" USING TIMESTAMP'2001-01-01 10:20:30';
-
-EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5;
-EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5;
-EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING 5.5e0;
-EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIME'10:20:30';
-EXECUTE IMMEDIATE "SELECT COERCIBILITY(?)" USING TIMESTAMP'2001-01-01 10:20:30';
-
---echo #
---echo # MDEV-14435 Different UNSIGNED flag of out user variable for YEAR parameter for direct vs prepared CALL
---echo #
-
-CREATE PROCEDURE p1(OUT v INT UNSIGNED) SET v = 2010;
-CALL p1(@a);
-PREPARE stmt FROM 'CALL p1(?)';
-EXECUTE stmt USING @b;
-DEALLOCATE PREPARE stmt;
-CREATE TABLE t1 AS SELECT @a AS a, @b AS b;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-CREATE PROCEDURE p1(OUT v YEAR) SET v = 2010;
-CALL p1(@a);
-PREPARE stmt FROM 'CALL p1(?)';
-EXECUTE stmt USING @b;
-DEALLOCATE PREPARE stmt;
-CREATE TABLE t1 AS SELECT @a AS a, @b AS b;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-CREATE PROCEDURE p1(OUT v BIT(16)) SET v = 2010;
-CALL p1(@a);
-PREPARE stmt FROM 'CALL p1(?)';
-EXECUTE stmt USING @b;
-DEALLOCATE PREPARE stmt;
-CREATE TABLE t1 AS SELECT @a AS a, @b AS b;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
---echo #
---echo # MDEV-14426 Assertion in Diagnostics_area::set_error_status when using a bad datetime with PS and SP
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1(OUT a VARCHAR(20))
-BEGIN
- SET a=10;
-END;
-$$
---error ER_TRUNCATED_WRONG_VALUE
-BEGIN NOT ATOMIC
- DECLARE a DATETIME;
- CALL p1(a);
-END;
-$$
---error ER_TRUNCATED_WRONG_VALUE
-BEGIN NOT ATOMIC
- DECLARE a DATETIME;
- EXECUTE IMMEDIATE 'CALL p1(?)' USING a;
-END;
-$$
---error ER_TRUNCATED_WRONG_VALUE
-BEGIN NOT ATOMIC
- DECLARE a DATETIME;
- PREPARE stmt FROM 'CALL p1(?)';
- EXECUTE stmt USING a;
- DEALLOCATE PREPARE stmt;
-END;
-$$
-DELIMITER ;$$
-DROP PROCEDURE p1;
-
---echo #
---echo # MDEV-14454 Binary protocol returns wrong collation ID for SP OUT parameters
---echo #
-
-CREATE PROCEDURE p1(OUT v CHAR(32) CHARACTER SET utf8) SET v='aaa';
-PREPARE stmt1 FROM 'CALL p1(?)';
-EXECUTE stmt1 USING @a;
-CREATE TABLE t1 AS SELECT @a AS c1;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
---echo #
---echo # MDEV-14467 Item_param: replace {INT|DECIMAL|REAL|STRING|TIME}_VALUE with Type_handler
---echo #
-
-EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10;
-EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10.1;
-EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING 10.1e0;
-EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING '10';
-EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT 1 FROM DUAL LIMIT ?' USING TIME'10:10:10';
-
-EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 1 AS a,? AS b' USING 1;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 10 AS a,? AS b' USING 10;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 999999999 AS a,? AS b' USING 999999999;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 AS SELECT 2147483647 AS a,? AS b' USING 2147483647;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-14603 signal 11 with short stacktrace
---echo #
-
-SET NAMES utf8;
-CREATE TABLE t1(i INT);
-CREATE PROCEDURE p1(tn VARCHAR(32))
- EXECUTE IMMEDIATE CONCAT('ANALYZE TABLE ',tn);
-CALL p1('t1');
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-SET NAMES utf8;
-CREATE PROCEDURE p1()
- EXECUTE IMMEDIATE CONCAT('SELECT ',CONVERT(RAND() USING latin1));
---disable_result_log
-CALL p1();
---enable_result_log
-DROP PROCEDURE p1;
-
-SET NAMES utf8;
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- PREPARE stmt FROM CONCAT('SELECT ',CONVERT(RAND() USING latin1));
- EXECUTE stmt;
- DEALLOCATE PREPARE stmt;
-END;
-$$
-DELIMITER ;$$
---disable_result_log
-CALL p1();
---enable_result_log
-DROP PROCEDURE p1;
-
-SET NAMES utf8;
-CREATE PROCEDURE p1(a VARCHAR(10) CHARACTER SET utf8)
- EXECUTE IMMEDIATE 'SELECT ?' USING CONCAT(a, CONVERT(RAND() USING latin1));
---disable_result_log
-CALL p1('x');
---enable_result_log
-DROP PROCEDURE p1;
-
-SET NAMES utf8;
-DELIMITER $$;
-CREATE PROCEDURE p1(a VARCHAR(10) CHARACTER SET utf8)
-BEGIN
- PREPARE stmt FROM 'SELECT ?';
- EXECUTE stmt USING CONCAT(a, CONVERT(RAND() USING latin1));
- DEALLOCATE PREPARE stmt;
-END;
-$$
-DELIMITER ;$$
---disable_result_log
-CALL p1('x');
-DROP PROCEDURE p1;
diff --git a/mysql-test/t/ps_10nestset.test b/mysql-test/t/ps_10nestset.test
deleted file mode 100644
index 46a88653da3..00000000000
--- a/mysql-test/t/ps_10nestset.test
+++ /dev/null
@@ -1,73 +0,0 @@
-###############################################
-# #
-# Prepared Statements test on #
-# "nested sets" representing hierarchies #
-# #
-###############################################
-
-# Source: http://kris.koehntopp.de/artikel/sql-self-references (dated 1999)
-# Source: http://dbmsmag.com/9603d06.html (dated 1996)
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-# "Nested Set": This table represents an employee list with a hierarchy tree.
-# The tree is not modeled by "parent" links but rather by showing the "left"
-# and "right" border of any person's "region". By convention, "l" < "r".
-# As it is a tree, these "regions" of two persons A and B are either disjoint,
-# or A's region is completely contained in B's (B.l < A.l < A.r < B.r:
-# B is A's boss), or vice versa.
-# Any other overlaps violate the model. See the references for more info.
-
-create table t1 (
- id INTEGER AUTO_INCREMENT PRIMARY KEY,
- emp CHAR(10) NOT NULL,
- salary DECIMAL(6,2) NOT NULL,
- l INTEGER NOT NULL,
- r INTEGER NOT NULL);
-
-prepare st_ins from 'insert into t1 set emp = ?, salary = ?, l = ?, r = ?';
-
-# Initial employee list:
-# Jerry ( Bert () Chuck ( Donna () Eddie () Fred () ) )
-set @arg_nam= 'Jerry'; set @arg_sal= 1000; set @arg_l= 1; set @arg_r= 12;
-execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
-set @arg_nam= 'Bert'; set @arg_sal= 900; set @arg_l= 2; set @arg_r= 3;
-execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
-set @arg_nam= 'Chuck'; set @arg_sal= 900; set @arg_l= 4; set @arg_r= 11;
-execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
-set @arg_nam= 'Donna'; set @arg_sal= 800; set @arg_l= 5; set @arg_r= 6;
-execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
-set @arg_nam= 'Eddie'; set @arg_sal= 700; set @arg_l= 7; set @arg_r= 8;
-execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
-set @arg_nam= 'Fred'; set @arg_sal= 600; set @arg_l= 9; set @arg_r= 10;
-execute st_ins using @arg_nam, @arg_sal, @arg_l, @arg_r ;
-
-select * from t1;
-
-# Three successive raises, each one is 100 units for managers, 10 percent for others.
-prepare st_raise_base from 'update t1 set salary = salary * ( 1 + ? ) where r - l = 1';
-prepare st_raise_mgr from 'update t1 set salary = salary + ? where r - l > 1';
-let $1= 3;
-set @arg_percent= .10;
-set @arg_amount= 100;
-while ($1)
-{
- execute st_raise_base using @arg_percent;
- execute st_raise_mgr using @arg_amount;
- dec $1;
-}
-
-select * from t1;
-
-# Now, increase salary to a multiple of 50 (checks for bug#6138)
-prepare st_round from 'update t1 set salary = salary + ? - ( salary MOD ? )';
-set @arg_round= 50;
-execute st_round using @arg_round, @arg_round;
-
-select * from t1;
-
-drop table t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/ps_11bugs.test b/mysql-test/t/ps_11bugs.test
deleted file mode 100644
index ccab833e878..00000000000
--- a/mysql-test/t/ps_11bugs.test
+++ /dev/null
@@ -1,217 +0,0 @@
-###############################################
-# #
-# Prepared Statements #
-# re-testing bug DB entries #
-# #
-# The bugs are reported as "closed". #
-# Command sequences taken from bug report. #
-# No other test contains the bug# as comment. #
-# #
-# Tests drop/create tables 't1', 't2', ... #
-# #
-###############################################
-
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-
-# bug#1180: optimized away part of WHERE clause cause incorect prepared satatement results
-
-CREATE TABLE t1(session_id char(9) NOT NULL);
-INSERT INTO t1 VALUES ("abc");
-SELECT * FROM t1;
-
-prepare st_1180 from 'SELECT * FROM t1 WHERE ?="1111" and session_id = "abc"';
-
-# Must not find a row
-set @arg1= 'abc';
-execute st_1180 using @arg1;
-
-# Now, it should find one row
-set @arg1= '1111';
-execute st_1180 using @arg1;
-
-# Back to non-matching
-set @arg1= 'abc';
-execute st_1180 using @arg1;
-
-drop table t1;
-
-# end of bug#1180
-
-
-# bug#1644: Insertion of more than 3 NULL columns with parameter binding fails
-
-# Using prepared statements, insertion of more than three columns with NULL
-# values fails to insert additional NULLS. After the third column NULLS will
-# be inserted into the database as zeros.
-# First insert four columns of a value (i.e. 22) to verify binding is working
-# correctly. Then Bind to each columns bind parameter an is_null value of 1.
-# Then insert four more columns of integers, just for sanity.
-# A subsequent select on the server will result in this:
-# mysql> select * from foo_dfr;
-# +------+------+------+------+
-# | col1 | col2 | col3 | col4 |
-# +------+------+------+------+
-# | 22 | 22 | 22 | 22 |
-# | NULL | NULL | NULL | 0 |
-# | 88 | 88 | 88 | 88 |
-# +------+------+------+------+
-
-# Test is extended to more columns - code stores bit vector in bytes.
-
-create table t1 (
- c_01 char(6), c_02 integer, c_03 real, c_04 int(3), c_05 varchar(20),
- c_06 date, c_07 char(1), c_08 real, c_09 int(11), c_10 time,
- c_11 char(6), c_12 integer, c_13 real, c_14 int(3), c_15 varchar(20),
- c_16 date, c_17 char(1), c_18 real, c_19 int(11), c_20 text);
-# Do not use "timestamp" type, because it has a non-NULL default as of 4.1.2
-
-prepare st_1644 from 'insert into t1 values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
-
-set @arg01= 'row_1'; set @arg02= 1; set @arg03= 1.1; set @arg04= 111; set @arg05= 'row_one';
-set @arg06= '2004-10-12'; set @arg07= '1'; set @arg08= 1.1; set @arg09= '100100100'; set @arg10= '12:34:56';
-set @arg11= 'row_1'; set @arg12= 1; set @arg13= 1.1; set @arg14= 111; set @arg15= 'row_one';
-set @arg16= '2004-10-12'; set @arg17= '1'; set @arg18= 1.1; set @arg19= '100100100'; set @arg20= '12:34:56';
-execute st_1644 using @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, @arg09, @arg10,
- @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, @arg17, @arg18, @arg19, @arg20;
-
-set @arg01= NULL; set @arg02= NULL; set @arg03= NULL; set @arg04= NULL; set @arg05= NULL;
-set @arg06= NULL; set @arg07= NULL; set @arg08= NULL; set @arg09= NULL; set @arg10= NULL;
-set @arg11= NULL; set @arg12= NULL; set @arg13= NULL; set @arg14= NULL; set @arg15= NULL;
-set @arg16= NULL; set @arg17= NULL; set @arg18= NULL; set @arg19= NULL; set @arg20= NULL;
-execute st_1644 using @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, @arg09, @arg10,
- @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, @arg17, @arg18, @arg19, @arg20;
-
-set @arg01= 'row_3'; set @arg02= 3; set @arg03= 3.3; set @arg04= 333; set @arg05= 'row_three';
-set @arg06= '2004-10-12'; set @arg07= '3'; set @arg08= 3.3; set @arg09= '300300300'; set @arg10= '12:34:56';
-set @arg11= 'row_3'; set @arg12= 3; set @arg13= 3.3; set @arg14= 333; set @arg15= 'row_three';
-set @arg16= '2004-10-12'; set @arg17= '3'; set @arg18= 3.3; set @arg19= '300300300'; set @arg20= '12:34:56';
-execute st_1644 using @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, @arg09, @arg10,
- @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, @arg17, @arg18, @arg19, @arg20;
-
-select * from t1;
-
-drop table t1;
-
-# end of bug#1644
-
-
-# bug#1676: Prepared statement two-table join returns no rows when one is expected
-
-create table t1(
- cola varchar(50) not null,
- colb varchar(8) not null,
- colc varchar(12) not null,
- cold varchar(2) not null,
- primary key (cola, colb, cold));
-
-create table t2(
- cola varchar(50) not null,
- colb varchar(8) not null,
- colc varchar(2) not null,
- cold float,
- primary key (cold));
-
-insert into t1 values ('aaaa', 'yyyy', 'yyyy-dd-mm', 'R');
-
-insert into t2 values ('aaaa', 'yyyy', 'R', 203), ('bbbb', 'zzzz', 'C', 201);
-
-prepare st_1676 from 'select a.cola, a.colb, a.cold from t1 a, t2 b where a.cola = ? and a.colb = ? and a.cold = ? and b.cola = a.cola and b.colb = a.colb and b.colc = a.cold';
-
-set @arg0= "aaaa";
-set @arg1= "yyyy";
-set @arg2= "R";
-
-execute st_1676 using @arg0, @arg1, @arg2;
-
-drop table t1, t2;
-
-# end of bug#1676
-
-# End of 4.1 tests
-
-# bug#18492: mysqld reports ER_ILLEGAL_REFERENCE in --ps-protocol
-
-create table t1 (a int primary key);
-insert into t1 values (1);
-
-explain select * from t1 where 3 in (select (1+1) union select 1);
-
-select * from t1 where 3 in (select (1+1) union select 1);
-
-prepare st_18492 from 'select * from t1 where 3 in (select (1+1) union select 1)';
-execute st_18492;
-
-drop table t1;
-
-#
-# Bug#19356: Assertion failure with undefined @uservar in prepared statement execution
-#
-create table t1 (a int, b varchar(4));
-create table t2 (a int, b varchar(4), primary key(a));
-
-prepare stmt1 from 'insert into t1 (a, b) values (?, ?)';
-prepare stmt2 from 'insert into t2 (a, b) values (?, ?)';
-
-set @intarg= 11;
-set @varchararg= '2222';
-execute stmt1 using @intarg, @varchararg;
-execute stmt2 using @intarg, @varchararg;
-set @intarg= 12;
-execute stmt1 using @intarg, @UNDEFINED;
-execute stmt2 using @intarg, @UNDEFINED;
-set @intarg= 13;
-execute stmt1 using @UNDEFINED, @varchararg;
---error 1048
-execute stmt2 using @UNDEFINED, @varchararg;
-set @intarg= 14;
-set @nullarg= Null;
-execute stmt1 using @UNDEFINED, @nullarg;
---error 1048
-execute stmt2 using @nullarg, @varchararg;
-
-select * from t1;
-select * from t2;
-
-drop table t1;
-drop table t2;
-
-#
-# Bug #32124: crash if prepared statements refer to variables in the where
-# clause
-#
-
-CREATE TABLE t1 (a INT);
-PREPARE stmt FROM 'select 1 from `t1` where `a` = any (select (@@tmpdir))';
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-DROP TABLE t1;
-
-CREATE TABLE t2 (a INT PRIMARY KEY);
-INSERT INTO t2 VALUES (400000), (400001);
-
-SET @@sort_buffer_size=400000;
-
-DELIMITER |;
-
-CREATE FUNCTION p1(i INT) RETURNS INT
-BEGIN
- SET @@sort_buffer_size= i;
- RETURN i + 1;
-END|
-
-DELIMITER ;|
-
-SELECT * FROM t2 WHERE a = @@sort_buffer_size AND p1(@@sort_buffer_size + 1) > a - 1;
-
-DROP TABLE t2;
-DROP FUNCTION p1;
-
-
-SELECT CONCAT(@@sort_buffer_size);
-SELECT LEFT("12345", @@ft_boolean_syntax);
-
-SET @@sort_buffer_size=DEFAULT;
-
---echo End of 5.0 tests.
diff --git a/mysql-test/t/ps_1general.test b/mysql-test/t/ps_1general.test
deleted file mode 100644
index 01a0164722d..00000000000
--- a/mysql-test/t/ps_1general.test
+++ /dev/null
@@ -1,944 +0,0 @@
-###################### ps_general.test #######################
-# #
-# basic and miscellaneous tests for prepared statements #
-# #
-##############################################################
-
-#
-# NOTE: PLEASE SEE THE DETAILED DESCRIPTION AT THE BOTTOM OF THIS FILE
-# BEFORE ADDING NEW TEST CASES HERE !!!
-
---disable_warnings
-drop table if exists t5, t6, t7, t8;
-drop database if exists mysqltest ;
-
-# Cleanup from other tests
-drop database if exists client_test_db;
-drop database if exists testtets;
-drop table if exists t1Aa,t2Aa,v1Aa,v2Aa;
-drop view if exists t1Aa,t2Aa,v1Aa,v2Aa;
---enable_warnings
-
---disable_query_log
-select '------ basic tests ------' as test_sequence ;
---enable_query_log
-
-let $type= 'MYISAM' ;
-# create the tables (t1 and t9) used in many tests
---source include/ps_create.inc
-# insert data into these tables
---source include/ps_renew.inc
-
-
-################ The basic functions ################
-
-# 1. PREPARE stmt_name FROM <preparable statement>;
-# <preparable statement> ::=
-# 'literal_stmt' |
-# @variable_ref_stmt.
-# The statement may contain question marks as placeholders for parameters.
-#
-# Bind a statement name to a string containing a SQL statement and
-# send it to the server. The server will parse the statement and
-# reply with "Query Ok" or an error message.
-#
-PREPARE stmt FROM ' select * from t1 where a = ? ' ;
-
-# 2. EXECUTE stmt_name [USING @var [, @var ]];
-# Current values of supplied variables are used as parameters.
-#
-# Send the server the order to execute the statement and supply values
-# for the input parameters needed.
-# If no error occurs the server reply will be identical to the reply for
-# the query used in PREPARE with question marks replaced with values of
-# the input variables.
-#
-SET @var= 2 ;
-EXECUTE stmt USING @var ;
-# The non prepared statement with the same server reply would be:
-select * from t1 where a = @var ;
-
-# 3. DEALLOCATE PREPARE stmt_name;
-#
-# Send the server the order to drop the parse informations.
-# The server will reply with "Query Ok" or an error message.
-DEALLOCATE PREPARE stmt ;
-
-################ PREPARE ################
-# prepare without parameter
-prepare stmt1 from ' select 1 as my_col ' ;
-# prepare with parameter
-prepare stmt1 from ' select ? as my_col ' ;
-# prepare must fail (incomplete statements/wrong syntax)
---error ER_PARSE_ERROR
-prepare ;
---error ER_PARSE_ERROR
-prepare stmt1 ;
---error ER_PARSE_ERROR
-prepare stmt1 from ;
---error ER_PARSE_ERROR
-prepare_garbage stmt1 from ' select 1 ' ;
---error ER_PARSE_ERROR
-prepare stmt1 from_garbage ' select 1 ' ;
---error ER_PARSE_ERROR
-prepare stmt1 from ' select_garbage 1 ' ;
---error ER_PARSE_ERROR
-prepare from ' select 1 ' ;
---error ER_PARSE_ERROR
-prepare stmt1 ' select 1 ' ;
---error ER_PARSE_ERROR
-prepare ? from ' select ? as my_col ' ;
-# statement in variable
-set @arg00='select 1 as my_col';
-prepare stmt1 from @arg00;
-# prepare must fail (query variable is empty)
-set @arg00='';
---error ER_EMPTY_QUERY
-prepare stmt1 from @arg00;
-set @arg00=NULL;
-# prepare must fail (query variable is NULL)
---error ER_PARSE_ERROR
-prepare stmt1 from @arg01;
-
-prepare stmt1 from ' select * from t1 where a <= 2 ' ;
-# prepare must fail (column x does not exist)
---error ER_BAD_FIELD_ERROR
-prepare stmt1 from ' select * from t1 where x <= 2 ' ;
-# cases derived from client_test.c: test_null()
-# prepare must fail (column x does not exist)
---error ER_BAD_FIELD_ERROR
-prepare stmt1 from ' insert into t1(a,x) values(?,?) ' ;
---error ER_BAD_FIELD_ERROR
-prepare stmt1 from ' insert into t1(x,a) values(?,?) ' ;
---disable_warnings
-drop table if exists not_exist ;
---enable_warnings
-# prepare must fail (table does not exist)
---error ER_NO_SUCH_TABLE
-prepare stmt1 from ' select * from not_exist where a <= 2 ' ;
-
-# case derived from client_test.c: test_prepare_syntax()
-# prepare must fail (incomplete statement)
---error ER_PARSE_ERROR
-prepare stmt1 from ' insert into t1 values(? ' ;
---error ER_PARSE_ERROR
-prepare stmt1 from ' select a, b from t1
- where a=? and where ' ;
-
-################ EXECUTE ################
-# execute must fail (statement never_prepared never prepared)
---error ER_UNKNOWN_STMT_HANDLER
-execute never_prepared ;
-# execute must fail (prepare stmt1 just failed,
-# but there was a successful prepare of stmt1 before)
-prepare stmt1 from ' select * from t1 where a <= 2 ' ;
---error ER_NO_SUCH_TABLE
-prepare stmt1 from ' select * from not_exist where a <= 2 ' ;
---error ER_UNKNOWN_STMT_HANDLER
-execute stmt1 ;
-
-# drop the table between prepare and execute
-create table t5
-(
- a int primary key,
- b char(30),
- c int
-);
-insert into t5( a, b, c) values( 1, 'original table', 1);
-prepare stmt2 from ' select * from t5 ' ;
-execute stmt2 ;
-drop table t5 ;
-# execute must fail (table was dropped after prepare)
---error ER_NO_SUCH_TABLE
-execute stmt2 ;
-# cases derived from client_test.c: test_select_prepare()
-# 1. drop + create table (same column names/types/order)
-# between prepare and execute
-create table t5
-(
- a int primary key,
- b char(30),
- c int
-);
-insert into t5( a, b, c) values( 9, 'recreated table', 9);
-execute stmt2 ;
-drop table t5 ;
-# 2. drop + create table (same column names/types but different order)
-# between prepare and execute
-create table t5
-(
- a int primary key,
- c int,
- b char(30)
-);
-insert into t5( a, b, c) values( 9, 'recreated table', 9);
-execute stmt2 ;
-drop table t5 ;
-# 3. drop + create table (same column names/types/order+extra column)
-# between prepare and execute
-create table t5
-(
- a int primary key,
- b char(30),
- c int,
- d timestamp default '2008-02-23 09:23:45'
-);
-insert into t5( a, b, c) values( 9, 'recreated table', 9);
-execute stmt2 ;
-drop table t5 ;
-# 4. drop + create table (same column names/types, different order +
-# additional column) between prepare and execute
-create table t5
-(
- a int primary key,
- d timestamp default '2008-02-23 09:23:45',
- b char(30),
- c int
-);
-insert into t5( a, b, c) values( 9, 'recreated table', 9);
-execute stmt2 ;
-drop table t5 ;
-# 5. drop + create table (same column names/order, different types)
-# between prepare and execute
-create table t5
-(
- a timestamp default '2004-02-29 18:01:59',
- b char(30),
- c int
-);
-insert into t5( b, c) values( 'recreated table', 9);
-execute stmt2 ;
-drop table t5 ;
-# 6. drop + create table (same column types/order, different names)
-# between prepare and execute
-create table t5
-(
- f1 int primary key,
- f2 char(30),
- f3 int
-);
-insert into t5( f1, f2, f3) values( 9, 'recreated table', 9);
-execute stmt2 ;
-drop table t5 ;
-
-# execute without parameter
-prepare stmt1 from ' select * from t1 where a <= 2 ' ;
-execute stmt1 ;
-# execute with parameter
-set @arg00=1 ;
-set @arg01='two' ;
-prepare stmt1 from ' select * from t1 where a <= ? ' ;
-execute stmt1 using @arg00;
-# execute must fail (too small number of parameters)
---error ER_WRONG_ARGUMENTS
-execute stmt1 ;
-# execute must fail (too big number of parameters)
---error ER_WRONG_ARGUMENTS
-execute stmt1 using @arg00, @arg01;
-# execute must fail (parameter is not set)
-execute stmt1 using @not_set;
-
-################ DEALLOCATE ################
-# deallocate must fail (the statement 'never_prepared' was never prepared)
---error ER_UNKNOWN_STMT_HANDLER
-deallocate prepare never_prepared ;
-# deallocate must fail (prepare stmt1 just failed,
-# but there was a successful prepare before)
-prepare stmt1 from ' select * from t1 where a <= 2 ' ;
---error ER_NO_SUCH_TABLE
-prepare stmt1 from ' select * from not_exist where a <= 2 ' ;
---error ER_UNKNOWN_STMT_HANDLER
-deallocate prepare stmt1;
-create table t5
-(
- a int primary key,
- b char(10)
-);
-prepare stmt2 from ' select a,b from t5 where a <= 2 ' ;
-drop table t5 ;
-# deallocate prepared statement where the table was dropped after prepare
-deallocate prepare stmt2;
-
-## parallel use of more than one prepared statement handlers
-# switch between different queries
-prepare stmt1 from ' select a from t1 where a <= 2 ' ;
-prepare stmt2 from ' select b from t1 where a <= 2 ' ;
-execute stmt2 ;
-execute stmt1 ;
-# switch between statement handlers of the same query
-prepare stmt1 from ' select a from t1 where a <= 2 ' ;
-prepare stmt2 from ' select a from t1 where a <= 2 ' ;
-execute stmt2 ;
-execute stmt1 ;
-deallocate prepare stmt1 ;
-# Will the deallocate of stmt1 with the same query affect stmt2 ?
-execute stmt2 ;
-
---disable_query_log
-select '------ show and misc tests ------' as test_sequence ;
---enable_query_log
-
---disable_warnings
-drop table if exists t2;
---enable_warnings
-create table t2
-(
- a int primary key, b char(10)
-);
-
-################ SHOW COMMANDS ################
-prepare stmt4 from ' show databases ';
-execute stmt4;
-prepare stmt4 from ' show tables from test like ''t2%'' ';
-execute stmt4;
-prepare stmt4 from ' show columns from t2 where field in (select ?) ';
-SET @arg00="a";
-execute stmt4 using @arg00;
-SET @arg00="b";
-execute stmt4 using @arg00;
-SET @arg00=1;
-execute stmt4 using @arg00;
-
-prepare stmt4 from ' show columns from t2 from test like ''a%'' ';
-execute stmt4;
-create index t2_idx on t2(b);
-prepare stmt4 from ' show index from t2 from test ';
-execute stmt4;
-prepare stmt4 from ' show table status from test like ''t2%'' ';
-# egalize date and time values
---replace_column 8 # 12 # 13 # 14 # 19 #
-# Bug#4288 : prepared statement 'show table status ..', wrong output on execute
-execute stmt4;
-# try the same with the big table
-prepare stmt4 from ' show table status from test like ''t9%'' ';
-# egalize date and time values
---replace_column 8 # 12 # 13 # 14 # 19 #
-# Bug#4288
-execute stmt4;
-prepare stmt4 from ' show status like ''Threads_running'' ';
---replace_column 2 #
-execute stmt4;
-prepare stmt4 from ' show variables like ''sql_mode'' ';
-execute stmt4;
-prepare stmt4 from ' show engine myisam logs ';
-execute stmt4;
-prepare stmt4 from ' show grants for user ';
-prepare stmt4 from ' show create table t2 ';
-prepare stmt4 from ' show master status ';
-prepare stmt4 from ' show master logs ';
-prepare stmt4 from ' show slave status ';
-prepare stmt4 from ' show warnings limit 20 ';
-prepare stmt4 from ' show errors limit 20 ';
-prepare stmt4 from ' show storage engines ';
-# The output depends upon the precise order in which
-# storage engines are registered, so we switch off the output.
---disable_result_log
-execute stmt4;
---enable_result_log
-
-################ MISC STUFF ################
-## get a warning and an error
-# cases derived from client_test.c: test_warnings(), test_errors()
---disable_warnings
-drop table if exists t5;
---enable_warnings
-prepare stmt1 from ' drop table if exists t5 ' ;
-execute stmt1 ;
-prepare stmt1 from ' drop table t5 ' ;
---error ER_BAD_TABLE_ERROR
-execute stmt1 ;
-
-## SELECT @@version
-# cases derived from client_test.c: test_select_version()
-#
-# TODO: Metadata check is temporary disabled here, because metadata of
-# this statement also depends on @@version contents and you can't apply
-# replace_column and replace_result to it. It will be enabled again when
-# support of replace_column and replace_result on metadata will be
-# implemented.
-#
-#--enable_metadata
-prepare stmt1 from ' SELECT @@version ' ;
-# egalize the version
---replace_column 1 <version>
-execute stmt1 ;
-#--disable_metadata
-
-## do @var:= and set @var=
-# cases derived from client_test.c: test_do_set()
-prepare stmt_do from ' do @var:= (1 in (select a from t1)) ' ;
-prepare stmt_set from ' set @var= (1 in (select a from t1)) ' ;
-let $1= 3 ;
-while ($1)
-{
- execute stmt_do ;
- --disable_query_log
- select @var as 'content of @var is:' ;
- --enable_query_log
- execute stmt_set ;
- --disable_query_log
- select @var as 'content of @var is:' ;
- --enable_query_log
- dec $1 ;
-}
-# the same test with a table containing one column and 'select *'
---disable_warnings
-drop table if exists t5 ;
---enable_warnings
-create table t5 (a int) ;
-prepare stmt_do from ' do @var:= (1 in (select a from t5)) ' ;
-prepare stmt_set from ' set @var= (1 in (select a from t5)) ' ;
-let $1= 3 ;
-while ($1)
-{
- execute stmt_do ;
- --disable_query_log
- select @var as 'content of @var is:' ;
- --enable_query_log
- execute stmt_set ;
- --disable_query_log
- select @var as 'content of @var is:' ;
- --enable_query_log
- dec $1 ;
-}
-drop table t5 ;
-deallocate prepare stmt_do ;
-deallocate prepare stmt_set ;
-
-## nonsense like prepare of prepare,execute or deallocate
---error ER_UNSUPPORTED_PS
-prepare stmt1 from ' prepare stmt2 from '' select 1 '' ' ;
---error ER_UNSUPPORTED_PS
-prepare stmt1 from ' execute stmt2 ' ;
---error ER_UNSUPPORTED_PS
-prepare stmt1 from ' deallocate prepare never_prepared ' ;
-
-## We don't support alter view as prepared statements
---error ER_UNSUPPORTED_PS
-prepare stmt1 from 'alter view v1 as select 2';
-
-## switch the database connection
---error ER_UNSUPPORTED_PS
-prepare stmt4 from ' use test ' ;
-
-## create/drop database
-prepare stmt3 from ' create database mysqltest ';
-create database mysqltest ;
-prepare stmt3 from ' drop database mysqltest ';
-drop database mysqltest ;
-
-#### table related commands
-## describe
-prepare stmt3 from ' describe t2 ';
-execute stmt3;
-drop table t2 ;
---error ER_NO_SUCH_TABLE
-execute stmt3;
-## lock/unlock
---error ER_UNSUPPORTED_PS
-prepare stmt3 from ' lock tables t1 read ' ;
---error ER_UNSUPPORTED_PS
-prepare stmt3 from ' unlock tables ' ;
-## Load/Unload table contents
-
---let $datafile = $MYSQLTEST_VARDIR/tmp/data.txt
---error 0,1
---remove_file $datafile
-
---replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
---error ER_UNSUPPORTED_PS
-eval prepare stmt1 from ' load data infile ''$datafile''
- into table t1 fields terminated by ''\t'' ';
---replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
-eval prepare stmt1 from ' select * into outfile ''$datafile'' from t1 ';
- execute stmt1 ;
-##
-prepare stmt1 from ' optimize table t1 ' ;
-prepare stmt1 from ' analyze table t1 ' ;
-prepare stmt1 from ' checksum table t1 ' ;
-prepare stmt1 from ' repair table t1 ' ;
-
---remove_file $datafile
-
-## handler
---error ER_UNSUPPORTED_PS
-prepare stmt1 from ' handler t1 open ';
-
-
-## commit/rollback
-prepare stmt3 from ' commit ' ;
-prepare stmt3 from ' rollback ' ;
-
-
-## switch the sql_mode
-prepare stmt4 from ' SET sql_mode=ansi ';
-execute stmt4;
-# check if the sql_mode is now ansi
-select 'a' || 'b' ;
-prepare stmt4 from ' SET sql_mode="" ';
-execute stmt4;
-# check if the sql_mode is not ansi
-select '2' || '3' ;
-# Will a switch of the sqlmode affect the execution of already prepared
-# statements ?
-prepare stmt5 from ' select ''2'' || ''3'' ' ;
-execute stmt5;
-SET sql_mode=ansi;
-execute stmt5;
-SET sql_mode="";
-
-prepare stmt1 from ' flush local privileges ' ;
-prepare stmt1 from ' reset query cache ' ;
-prepare stmt1 from ' KILL 0 ';
-
-## simple explain
-# cases derived from client_test.c: test_explain_bug()
-prepare stmt1 from ' explain select a from t1 order by b ';
-# PS protocol gives slightly different metadata
---disable_ps_protocol
---enable_metadata
---replace_result 4096 4_OR_8_K 8192 4_OR_8_K
-execute stmt1;
---disable_metadata
-SET @arg00=1 ;
-prepare stmt1 from ' explain select a from t1 where a > ? order by b ';
---enable_metadata
---replace_result 4096 4_OR_8_K 8192 4_OR_8_K
-execute stmt1 using @arg00;
---disable_metadata
---enable_ps_protocol
-
-## parameters with probably problematic characters (quote, double quote)
-# cases derived from client_test.c: test_logs()
-# try if
---disable_warnings
-drop table if exists t2;
---enable_warnings
-create table t2 (id smallint, name varchar(20)) ;
-prepare stmt1 from ' insert into t2 values(?, ?) ' ;
-set @id= 9876 ;
-set @arg00= 'MySQL - Open Source Database' ;
-set @arg01= "'" ;
-set @arg02= '"' ;
-set @arg03= "my'sql'" ;
-set @arg04= 'my"sql"' ;
-insert into t2 values ( @id , @arg00 );
-insert into t2 values ( @id , @arg01 );
-insert into t2 values ( @id , @arg02 );
-insert into t2 values ( @id , @arg03 );
-insert into t2 values ( @id , @arg04 );
-prepare stmt1 from ' select * from t2 where id= ? and name= ? ';
-execute stmt1 using @id, @arg00 ;
-execute stmt1 using @id, @arg01 ;
-execute stmt1 using @id, @arg02 ;
-execute stmt1 using @id, @arg03 ;
-execute stmt1 using @id, @arg04 ;
-drop table t2;
-
-################ CREATE/DROP/ALTER/RENAME TESTS ################
---disable_query_log
-select '------ create/drop/alter/rename tests ------' as test_sequence ;
---enable_query_log
-
---disable_warnings
-drop table if exists t2, t3;
---enable_warnings
-
-## DROP TABLE
-prepare stmt_drop from ' drop table if exists t2 ' ;
---disable_warnings
-execute stmt_drop;
---enable_warnings
-
-## CREATE TABLE
-prepare stmt_create from ' create table t2 (
- a int primary key, b char(10)) ';
-execute stmt_create;
-prepare stmt3 from ' create table t3 like t2 ';
-execute stmt3;
-drop table t3;
-
-## CREATE TABLE .. SELECT
-set @arg00=1;
-prepare stmt3 from ' create table t3 (m int) select ? as m ' ;
-# Bug#4280 server hangs, prepared "create table .. as select ? .."
-execute stmt3 using @arg00;
-select m from t3;
-drop table t3;
-
-prepare stmt3 from ' create index t2_idx on t2(b) ';
-prepare stmt3 from ' drop index t2_idx on t2 ' ;
-prepare stmt3 from ' alter table t2 drop primary key ';
-
-## RENAME TABLE
---disable_warnings
-drop table if exists new_t2;
---enable_warnings
-prepare stmt3 from ' rename table t2 to new_t2 ';
-execute stmt3;
---error ER_TABLE_EXISTS_ERROR
-execute stmt3;
-rename table new_t2 to t2;
-drop table t2;
-## RENAME more than on TABLE within one statement
-# cases derived from client_test.c: test_rename()
-prepare stmt1 from ' rename table t5 to t6, t7 to t8 ' ;
-create table t5 (a int) ;
---error ER_NO_SUCH_TABLE
-execute stmt1 ;
-create table t7 (a int) ;
-# rename, t5 -> t6 and t7 -> t8
-execute stmt1 ;
-# rename must fail, t5 and t7 does not exist t6 and t8 already exist
---error ER_TABLE_EXISTS_ERROR
-execute stmt1 ;
-rename table t6 to t5, t8 to t7 ;
-# rename, t5 -> t6 and t7 -> t8
-execute stmt1 ;
-drop table t6, t8 ;
-
-
-################ BIG STATEMENT TESTS ################
---disable_query_log
-select '------ big statement tests ------' as test_sequence ;
---enable_query_log
-# The following tests use huge numbers of lines, characters or parameters
-# per prepared statement.
-# I assume the server and also the client (mysqltest) are stressed.
-#
-# Attention: The limits used are NOT derived from the manual
-# or other sources.
-
-## many lines ( 50 )
-let $my_stmt= select 'ABC' as my_const_col from t1 where
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 AND
-1 = 1 ;
-eval ($my_stmt) ;
-eval prepare stmt1 from "$my_stmt" ;
-execute stmt1 ;
-execute stmt1 ;
-
-## many characters ( about 1400 )
-
-let $my_stmt= select 'ABC' as my_const_col FROM t1 WHERE
-'1234567890123456789012345678901234567890123456789012345678901234567890'
-= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
-'1234567890123456789012345678901234567890123456789012345678901234567890'
-= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
-'1234567890123456789012345678901234567890123456789012345678901234567890'
-= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
-'1234567890123456789012345678901234567890123456789012345678901234567890'
-= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
-'1234567890123456789012345678901234567890123456789012345678901234567890'
-= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
-'1234567890123456789012345678901234567890123456789012345678901234567890'
-= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
-'1234567890123456789012345678901234567890123456789012345678901234567890'
-= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
-'1234567890123456789012345678901234567890123456789012345678901234567890'
-= '1234567890123456789012345678901234567890123456789012345678901234567890' AND
-'1234567890123456789012345678901234567890123456789012345678901234567890'
-= '1234567890123456789012345678901234567890123456789012345678901234567890' ;
-eval ($my_stmt) ;
-eval prepare stmt1 from "$my_stmt" ;
-execute stmt1 ;
-execute stmt1 ;
-
-
-## many parameters ( 50 )
---disable_query_log
-set @arg00= 1;
-set @arg01= 1;
-set @arg02= 1;
-set @arg03= 1;
-set @arg04= 1;
-set @arg05= 1;
-set @arg06= 1;
-set @arg07= 1;
-set @arg10= 1;
-set @arg11= 1;
-set @arg12= 1;
-set @arg13= 1;
-set @arg14= 1;
-set @arg15= 1;
-set @arg16= 1;
-set @arg17= 1;
-set @arg20= 1;
-set @arg21= 1;
-set @arg22= 1;
-set @arg23= 1;
-set @arg24= 1;
-set @arg25= 1;
-set @arg26= 1;
-set @arg27= 1;
-set @arg30= 1;
-set @arg31= 1;
-set @arg32= 1;
-set @arg33= 1;
-set @arg34= 1;
-set @arg35= 1;
-set @arg36= 1;
-set @arg37= 1;
-set @arg40= 1;
-set @arg41= 1;
-set @arg42= 1;
-set @arg43= 1;
-set @arg44= 1;
-set @arg45= 1;
-set @arg46= 1;
-set @arg47= 1;
-set @arg50= 1;
-set @arg51= 1;
-set @arg52= 1;
-set @arg53= 1;
-set @arg54= 1;
-set @arg55= 1;
-set @arg56= 1;
-set @arg57= 1;
-set @arg60= 1;
-set @arg61= 1;
---enable_query_log
-
-select 'ABC' as my_const_col FROM t1 WHERE
-@arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and
-@arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and
-@arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and
-@arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and
-@arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and
-@arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and @arg00=@arg00 and
-@arg00=@arg00 ;
-prepare stmt1 from ' select ''ABC'' as my_const_col FROM t1 WHERE
- ? = ? and ? = ? and ? = ? and ? = ? and
- ? = ? and ? = ? and ? = ? and ? = ? and
- ? = ? and ? = ? and ? = ? and ? = ? and
- ? = ? and ? = ? and ? = ? and ? = ? and
- ? = ? and ? = ? and ? = ? and ? = ? and
- ? = ? and ? = ? and ? = ? and ? = ? and
- ? = ? ' ;
-execute stmt1 using
-@arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00, @arg00,
-@arg00, @arg00;
-execute stmt1 using
-@arg00, @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07,
-@arg10, @arg11, @arg12, @arg13, @arg14, @arg15, @arg16, @arg17,
-@arg20, @arg21, @arg22, @arg23, @arg24, @arg25, @arg26, @arg27,
-@arg30, @arg31, @arg32, @arg33, @arg34, @arg35, @arg36, @arg37,
-@arg40, @arg41, @arg42, @arg43, @arg44, @arg45, @arg46, @arg47,
-@arg50, @arg51, @arg52, @arg53, @arg54, @arg55, @arg56, @arg57,
-@arg60, @arg61 ;
-
-# cases derived from client_test.c: test_mem_overun()
---disable_warnings
-drop table if exists t5 ;
---enable_warnings
-
-set @col_num= 1000 ;
-
---disable_query_log
-set @string= 'create table t5( ' ;
-let $1=`select @col_num - 1` ;
-while ($1)
-{
- eval set @string= concat(@string, 'c$1 int,') ;
- dec $1 ;
-}
-set @string= concat(@string, 'c0 int)' );
---enable_query_log
-select @string as "" ;
-prepare stmt1 from @string ;
-execute stmt1 ;
-
---disable_query_log
-set @string= 'insert into t5 values(' ;
-let $1=`select @col_num - 1` ;
-while ($1)
-{
- eval set @string= concat(@string, '1 ,') ;
- dec $1 ;
-}
-eval set @string= concat(@string, '1 )') ;
---enable_query_log
-select @string as "" ;
-prepare stmt1 from @string ;
-execute stmt1 ;
-
-prepare stmt1 from ' select * from t5 ' ;
---enable_metadata
-# prevent too long lines
---vertical_results
---disable_result_log
-execute stmt1 ;
---enable_result_log
---disable_metadata
---horizontal_results
-
-drop table t1, t5, t9;
-
---echo #
---echo # testcase for bug#11765413 - Crash with dependent subquery and
---echo # prepared statement
-create table t1 (c1 int);
-insert into t1 values (1);
-prepare stmt1 from "select 1 from t1 where 1=(select 1 from t1 having c1)";
-execute stmt1;
-drop prepare stmt1;
-drop table t1;
-
-##### RULES OF THUMB TO PRESERVE THE SYSTEMATICS OF THE PS TEST CASES #####
-#
-# 0. You don't have the time to
-# - read and pay attention to these rules of thumb
-# - accept that QA may move your test case to a different place
-# (I will not change your code!!) .
-# Please append your test case to
-# t/ps.test
-#
-# 1. You have more time and want to get as much value from you test case as
-# possible. Please try to make the following decisions:
-#
-# Will the execution or result of the sub test case depend on the
-# properties of a storage engine ?
-#
-# NO --> alter t/ps_1general.test (Example: Command with syntax error)
-# If you need a table, please try to use
-# t1 - very simple table
-# t9 - table with nearly all available column types
-# whenever possible.
-#
-# The structure and the content of these tables can be found in
-# include/ps_create.inc CREATE TABLE ...
-# include/ps_renew.inc DELETE all rows and INSERT some rows
-#
-# Both tables are managed by the same storage engine.
-# The type of the storage engine is stored in the variable
-# '$type' . In ps_1general.test $type is set to 'MYISAM'.
-#
-# Please feel free to source ps_create.inc or ps_renew.inc
-# whenever you think it helps. But please restore the original
-# state of these tables after your tests, because the following
-# statements may depend on it.
-#
-# YES
-# |
-# |
-# Is it possible to apply the sub test case to all table types ?
-# YES --> alter include/ps_query.inc (for SELECTs)
-# include/ps_modify.inc (for INSERT/UPDATE/DELETE)
-# include/ps_modify1.inc (also for INSERT/UPDATE/DELETE,
-# but t/ps_5merge.test will not source that file)
-# Please try to find an appropriate place within the file.
-# It would be nice if we have some systematics in the
-# order of the sub test cases (if possible).
-#
-# Please be aware, that
-# include: ps_query.inc, ps_modify.inc, ps_modify1.inc
-# will be sourced by several test case files stored within the
-# subdirectory 't'. So every change here will affect several test
-# cases.
-#
-# NO
-# |
-# |
-# Append the sub test case to the appropriate
-# ps_<number><table type>.test .
-#
-# 2. The current structure of the PS tests
-#
-# t/ps_1general.test Check of basic PS features, SHOW commands and DDL
-# The tests should not depend on the table type.
-#
-# t/ps_2myisam Check of PS on tables of type MYISAM .
-# t/ps_3innodb Check of PS on tables of type InnoDB .
-# ...
-# t/ps_6bdb Check of PS on tables of type BDB .
-# All storage engine related tests use the variable $type to hold the
-# name of the storage engine.
-#
-# include/ps_query.inc test cases with SELECT/...
-# These test cases should not modify the content or
-# the structure (DROP/ALTER..) of the tables
-# 't1' and 't9'.
-# include/ps_modify.inc test cases with INSERT/UPDATE/...
-# These test cases should not modify the structure
-# (DROP/ALTER..) of the tables
-# 't1' and 't9'.
-# These two test sequences will be applied to all table types .
-#
-# include/ps_modify1.inc test cases with INSERT/UPDATE/...
-# This test sequences will be applied to all table types
-# except MERGE tables.
-#
-# include/ps_create.inc DROP and CREATE of the tables
-# 't1' and 't9' .
-# include/ps_renew.inc DELETE all rows and INSERT some rows, that means
-# recreate the original content of these tables.
-# Please do not alter the commands concerning these two tables.
-#
-# Please feel free and encouraged to exploit the current code sharing
-# mechanism of the 'ps_<number><table type>' test cases. It is an convenient
-# way to check all storage engines.
-#
-# Thank you for reading these rules of thumb.
-#
-# Matthias
-
-# End of 4.1 tests
-
-#
-# MDEV-10318 unset params in --ps --embedded
-#
---error ER_PARSE_ERROR,2031
-select ?+1;
-
diff --git a/mysql-test/t/ps_2myisam.test b/mysql-test/t/ps_2myisam.test
deleted file mode 100644
index 0a335bd02a3..00000000000
--- a/mysql-test/t/ps_2myisam.test
+++ /dev/null
@@ -1,44 +0,0 @@
-###############################################
-# #
-# Prepared Statements test on MYISAM tables #
-# #
-###############################################
-
-#
-# NOTE: PLEASE SEE ps_1general.test (bottom)
-# BEFORE ADDING NEW TEST CASES HERE !!!
-
-use test;
-
-let $type= 'MYISAM' ;
--- source include/ps_create.inc
--- source include/ps_renew.inc
-
--- source include/ps_query.inc
-
-# parameter in SELECT ... MATCH/AGAINST
-# case derived from client_test.c: test_bug1500()
---disable_warnings
-drop table if exists t2 ;
---enable_warnings
-eval create table t2 (s varchar(25), fulltext(s))
-ENGINE = $type ;
-insert into t2 values ('Gravedigger'), ('Greed'),('Hollow Dogs') ;
-commit ;
-
-prepare stmt1 from ' select s from t2 where match (s) against (?) ' ;
-set @arg00='Dogs' ;
-execute stmt1 using @arg00 ;
-prepare stmt1 from ' SELECT s FROM t2
-where match (s) against (concat(?,''digger'')) ';
-set @arg00='Grave' ;
-execute stmt1 using @arg00 ;
-drop table t2 ;
-
--- source include/ps_modify.inc
--- source include/ps_modify1.inc
--- source include/ps_conv.inc
-
-drop table t1, t9;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/ps_3innodb-master.opt b/mysql-test/t/ps_3innodb-master.opt
deleted file mode 100644
index 96f0ce3f36c..00000000000
--- a/mysql-test/t/ps_3innodb-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---default-storage-engine=MyISAM
diff --git a/mysql-test/t/ps_3innodb.test b/mysql-test/t/ps_3innodb.test
deleted file mode 100644
index 10d2e7a9ae5..00000000000
--- a/mysql-test/t/ps_3innodb.test
+++ /dev/null
@@ -1,30 +0,0 @@
-###############################################
-# #
-# Prepared Statements test on InnoDB tables #
-# #
-###############################################
-
-#
-# NOTE: PLEASE SEE ps_1general.test (bottom)
-# BEFORE ADDING NEW TEST CASES HERE !!!
-
-# See Bug#38999 valgrind warnings for update statement in function
-# compare_record()
--- source include/not_valgrind.inc
-
-use test;
-
--- source include/have_innodb.inc
-
-let $type= 'InnoDB' ;
--- source include/ps_create.inc
--- source include/ps_renew.inc
-
--- source include/ps_query.inc
--- source include/ps_modify.inc
--- source include/ps_modify1.inc
--- source include/ps_conv.inc
-
-drop table t1, t9;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/ps_4heap.test b/mysql-test/t/ps_4heap.test
deleted file mode 100644
index 2c0b64b1503..00000000000
--- a/mysql-test/t/ps_4heap.test
+++ /dev/null
@@ -1,52 +0,0 @@
-###############################################
-# #
-# Prepared Statements test on HEAP tables #
-# #
-###############################################
-
-#
-# NOTE: PLEASE SEE ps_1general.test (bottom)
-# BEFORE ADDING NEW TEST CASES HERE !!!
-
-use test;
-
-let $type= 'HEAP' ;
---disable_warnings
-drop table if exists t1, t9 ;
---enable_warnings
-eval create table t1
-(
- a int, b varchar(30),
- primary key(a)
-) engine = $type ;
-
---disable_warnings
-drop table if exists t9;
---enable_warnings
-# The used table type doesn't support BLOB/TEXT columns.
-# (The server would send error 1163 .)
-# So we use char(100) instead.
-eval create table t9
-(
- c1 tinyint, c2 smallint, c3 mediumint, c4 int,
- c5 integer, c6 bigint, c7 float, c8 double,
- c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
- c13 date, c14 datetime, c15 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
- ON UPDATE CURRENT_TIMESTAMP, c16 time,
- c17 year, c18 tinyint, c19 bool, c20 char,
- c21 char(10), c22 varchar(30), c23 varchar(100), c24 varchar(100),
- c25 varchar(100), c26 varchar(100), c27 varchar(100), c28 varchar(100),
- c29 varchar(100), c30 varchar(100), c31 enum('one', 'two', 'three'),
- c32 set('monday', 'tuesday', 'wednesday'),
- primary key(c1)
-) engine = $type ;
--- source include/ps_renew.inc
-
--- source include/ps_query.inc
--- source include/ps_modify.inc
--- source include/ps_modify1.inc
--- source include/ps_conv.inc
-
-drop table t1, t9;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/ps_5merge.test b/mysql-test/t/ps_5merge.test
deleted file mode 100644
index adef6b51f0e..00000000000
--- a/mysql-test/t/ps_5merge.test
+++ /dev/null
@@ -1,86 +0,0 @@
-###############################################
-# #
-# Prepared Statements test on MERGE tables #
-# #
-###############################################
-
-#
-# NOTE: PLEASE SEE ps_1general.test (bottom)
-# BEFORE ADDING NEW TEST CASES HERE !!!
-
-use test;
-
---disable_warnings
-drop table if exists t1, t1_1, t1_2,
- t9, t9_1, t9_2;
---enable_warnings
-let $type= 'MYISAM' ;
--- source include/ps_create.inc
-rename table t1 to t1_1, t9 to t9_1 ;
--- source include/ps_create.inc
-rename table t1 to t1_2, t9 to t9_2 ;
-
-create table t1
-(
- a int, b varchar(30),
- primary key(a)
-) ENGINE = MERGE UNION=(t1_1,t1_2)
-INSERT_METHOD=FIRST;
-create table t9
-(
- c1 tinyint, c2 smallint, c3 mediumint, c4 int,
- c5 integer, c6 bigint, c7 float, c8 double,
- c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
- c13 date, c14 datetime, c15 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c16 time,
- c17 year, c18 tinyint, c19 bool, c20 char,
- c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
- c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
- c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
- c32 set('monday', 'tuesday', 'wednesday'),
- primary key(c1)
-) ENGINE = MERGE UNION=(t9_1,t9_2)
-INSERT_METHOD=FIRST;
--- source include/ps_renew.inc
-
--- source include/ps_query.inc
--- source include/ps_modify.inc
-# no test of ps_modify1, because insert .. select
-# is not allowed on MERGE tables
-# -- source include/ps_modify1.inc
--- source include/ps_conv.inc
-
-# Lets's try the same tests with INSERT_METHOD=LAST
-drop table t1, t9 ;
-create table t1
-(
- a int, b varchar(30),
- primary key(a)
-) ENGINE = MERGE UNION=(t1_1,t1_2)
-INSERT_METHOD=LAST;
-create table t9
-(
- c1 tinyint, c2 smallint, c3 mediumint, c4 int,
- c5 integer, c6 bigint, c7 float, c8 double,
- c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
- c13 date, c14 datetime, c15 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, c16 time,
- c17 year, c18 tinyint, c19 bool, c20 char,
- c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
- c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
- c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
- c32 set('monday', 'tuesday', 'wednesday'),
- primary key(c1)
-) ENGINE = MERGE UNION=(t9_1,t9_2)
-INSERT_METHOD=LAST;
--- source include/ps_renew.inc
-
--- source include/ps_query.inc
--- source include/ps_modify.inc
-# no test of ps_modify1, because insert .. select
-# is not allowed on MERGE tables
-# -- source include/ps_modify1.inc
--- source include/ps_conv.inc
-
-drop table t1, t1_1, t1_2,
- t9_1, t9_2, t9;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/ps_change_master.test b/mysql-test/t/ps_change_master.test
deleted file mode 100644
index d756b8cd4fb..00000000000
--- a/mysql-test/t/ps_change_master.test
+++ /dev/null
@@ -1,45 +0,0 @@
---source include/not_embedded.inc
---source include/have_log_bin.inc
-
---echo #
---echo # CHANGE MASTER TO doesn't work with prepared statements
---echo #
-
-CHANGE MASTER TO MASTER_HOST='host1', MASTER_USER='user1';
-
-let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
-let $master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1);
-
---echo # Master_Host : $master_host
---echo # Master_User : $master_user
-
-SET @s := "CHANGE MASTER TO MASTER_HOST='host2'";
-PREPARE stmt FROM @s;
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-
-let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
-let $master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1);
-
---echo # Master_Host : $master_host
---echo # Master_User : $master_user
-
-SET @s := "CHANGE MASTER TO MASTER_USER='user2'";
-PREPARE stmt FROM @s;
-EXECUTE stmt;
-# Multiple executions should not hurt.
-EXECUTE stmt;
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-
-let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
-let $master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1);
-
---echo # Master_Host : $master_host
---echo # Master_User : $master_user
-
-
-# Reset
-CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root';
-
---echo # End of test
diff --git a/mysql-test/t/ps_ddl.test b/mysql-test/t/ps_ddl.test
deleted file mode 100644
index 90226d379bf..00000000000
--- a/mysql-test/t/ps_ddl.test
+++ /dev/null
@@ -1,2285 +0,0 @@
-#
-# Testing the behavior of 'PREPARE', 'DDL', 'EXECUTE' scenarios
-#
-# Background:
-# In a statement like "select * from t1", t1 can be:
-# - nothing (the table does not exist)
-# - a real table
-# - a temporary table
-# - a view
-#
-# Changing the nature of "t1" between a PREPARE and an EXECUTE
-# can invalidate the internal state of a prepared statement, so that,
-# during the execute, the server should:
-# - detect state changes and fail to execute a statement,
-# instead of crashing the server or returning wrong results
-# - "RE-PREPARE" the statement to restore a valid internal state.
-#
-# Also, changing the physical structure of "t1", by:
-# - changing the definition of t1 itself (DDL on tables, views)
-# - changing TRIGGERs associated with a table
-# - changing PROCEDURE, FUNCTION referenced by a TRIGGER body,
-# - changing PROCEDURE, FUNCTION referenced by a VIEW body,
-# impacts the internal structure of a prepared statement, and should
-# cause the same verifications at execute time to be performed.
-#
-# This test provided in this file cover the different state transitions
-# between a PREPARE and an EXECUTE, and are organized as follows:
-# - Part 1: NOTHING -> TABLE
-# - Part 2: NOTHING -> TEMPORARY TABLE
-# - Part 3: NOTHING -> VIEW
-# - Part 4: TABLE -> NOTHING
-# - Part 5: TABLE -> TABLE (DDL)
-# - Part 6: TABLE -> TABLE (TRIGGER)
-# - Part 7: TABLE -> TABLE (TRIGGER dependencies)
-# - Part 8: TABLE -> TEMPORARY TABLE
-# - Part 9: TABLE -> VIEW
-# - Part 10: TEMPORARY TABLE -> NOTHING
-# - Part 11: TEMPORARY TABLE -> TABLE
-# - Part 12: TEMPORARY TABLE -> TEMPORARY TABLE (DDL)
-# - Part 13: TEMPORARY TABLE -> VIEW
-# - Part 14: VIEW -> NOTHING
-# - Part 15: VIEW -> TABLE
-# - Part 16: VIEW -> TEMPORARY TABLE
-# - Part 17: VIEW -> VIEW (DDL)
-# - Part 18: VIEW -> VIEW (VIEW dependencies)
-# - Part 19: Special tables (INFORMATION_SCHEMA)
-# - Part 20: Special tables (log tables)
-# - Part 21: Special tables (system tables)
-# - Part 22: Special tables (views temp tables)
-# - Part 23: Special statements
-# - Part 24: Testing the strength of TABLE_SHARE version
---disable_warnings
-drop temporary table if exists t1, t2, t3;
-drop table if exists t1, t2, t3;
-drop procedure if exists p_verify_reprepare_count;
-drop procedure if exists p1;
-drop function if exists f1;
-drop view if exists v1, v2;
---enable_warnings
-
-# Avoid selecting from a huge table possibly left over from previous tests,
-# as this really hurts --valgrind testing.
-TRUNCATE TABLE mysql.general_log;
-
-delimiter |;
-create procedure p_verify_reprepare_count(expected int)
-begin
- declare old_reprepare_count int default @reprepare_count;
-
- select variable_value from
- information_schema.session_status where
- variable_name='com_stmt_reprepare'
- into @reprepare_count;
-
- if old_reprepare_count + expected <> @reprepare_count then
- select concat("Expected: ", expected,
- ", actual: ", @reprepare_count - old_reprepare_count)
- as "ERROR";
- else
- select '' as "SUCCESS";
- end if;
-end|
-delimiter ;|
-set @reprepare_count= 0;
-flush status;
-
---echo =====================================================================
---echo Part 1: NOTHING -> TABLE transitions
---echo =====================================================================
-
-# can not be tested since prepare failed
---error ER_NO_SUCH_TABLE
-prepare stmt from "select * from t1";
-
---echo =====================================================================
---echo Part 2: NOTHING -> TEMPORARY TABLE transitions
---echo =====================================================================
-
-# can not be tested
-
---echo =====================================================================
---echo Part 3: NOTHING -> VIEW transitions
---echo =====================================================================
-
-# can not be tested
-
---echo =====================================================================
---echo Part 4: TABLE -> NOTHING transitions
---echo =====================================================================
-
---echo # Test 4-a: select ... from <table>
-create table t1 (a int);
-
-prepare stmt from "select * from t1";
-execute stmt;
-call p_verify_reprepare_count(0);
-execute stmt;
-call p_verify_reprepare_count(0);
-
-drop table t1;
---error ER_NO_SUCH_TABLE
-execute stmt;
-call p_verify_reprepare_count(0);
---error ER_NO_SUCH_TABLE
-execute stmt;
-call p_verify_reprepare_count(0);
-deallocate prepare stmt;
-
---echo # Test 4-b: TABLE -> NOTHING by renaming the table
-create table t1 (a int);
-prepare stmt from "select * from t1";
-execute stmt;
-call p_verify_reprepare_count(0);
-execute stmt;
-call p_verify_reprepare_count(0);
-
-rename table t1 to t2;
---error ER_NO_SUCH_TABLE
-execute stmt;
-call p_verify_reprepare_count(0);
---error ER_NO_SUCH_TABLE
-execute stmt;
-call p_verify_reprepare_count(0);
-
-deallocate prepare stmt;
-drop table t2;
-
---echo =====================================================================
---echo Part 5: TABLE -> TABLE (DDL) transitions
---echo =====================================================================
-
-create table t1 (a int);
-
-prepare stmt from "select a from t1";
-execute stmt;
-call p_verify_reprepare_count(0);
-execute stmt;
-call p_verify_reprepare_count(0);
-
-alter table t1 add column (b int);
-
-execute stmt;
-call p_verify_reprepare_count(1);
-execute stmt;
-call p_verify_reprepare_count(0);
-
-drop table t1;
-deallocate prepare stmt;
-
-
---echo =====================================================================
---echo Part 6: TABLE -> TABLE (TRIGGER) transitions
---echo =====================================================================
-
---echo # Test 6-a: adding a relevant trigger
-
-create table t1 (a int);
-
-prepare stmt from "insert into t1 (a) value (?)";
-set @val=1;
-execute stmt using @val;
-call p_verify_reprepare_count(0);
-
-# Relevant trigger: execute should reprepare
-create trigger t1_bi before insert on t1 for each row
- set @message= new.a;
-
-set @val=2;
-execute stmt using @val;
-call p_verify_reprepare_count(1);
-select @message;
-set @val=3;
-execute stmt using @val;
-call p_verify_reprepare_count(0);
-select @message;
-
-prepare stmt from "insert into t1 (a) value (?)";
-set @val=4;
-execute stmt using @val;
-call p_verify_reprepare_count(0);
-select @message;
-
---echo # Test 6-b: adding an irrelevant trigger
-
-# Unrelated trigger: reprepare may or may not happen, implementation dependent
-create trigger t1_bd before delete on t1 for each row
- set @message= old.a;
-
-set @val=5;
-execute stmt using @val;
-call p_verify_reprepare_count(1);
-select @message;
-set @val=6;
-execute stmt using @val;
-call p_verify_reprepare_count(0);
-select @message;
-
-prepare stmt from "insert into t1 (a) value (?)";
-set @val=7;
-execute stmt using @val;
-call p_verify_reprepare_count(0);
-select @message;
-
---echo # Test 6-c: changing a relevant trigger
-
-# Relevant trigger: execute should reprepare
-drop trigger t1_bi;
-create trigger t1_bi before insert on t1 for each row
- set @message= concat("new trigger: ", new.a);
-
-set @val=8;
-execute stmt using @val;
-call p_verify_reprepare_count(1);
-select @message;
-set @val=9;
-execute stmt using @val;
-call p_verify_reprepare_count(0);
-select @message;
-
-prepare stmt from "insert into t1 (a) value (?)";
-set @val=10;
-execute stmt using @val;
-call p_verify_reprepare_count(0);
-select @message;
-
---echo # Test 6-d: changing an irrelevant trigger
-
-# Unrelated trigger: reprepare may or may not happen, implementation dependent
-drop trigger t1_bd;
-
-set @val=11;
-execute stmt using @val;
-call p_verify_reprepare_count(1);
-select @message;
-
---echo Test 6-e: removing a relevant trigger
-
-drop trigger t1_bi;
-
-set @val=12;
-execute stmt using @val;
-call p_verify_reprepare_count(1);
-select @message;
-set @val=13;
-execute stmt using @val;
-call p_verify_reprepare_count(0);
-select @message;
-
-prepare stmt from "insert into t1 (a) value (?)";
-set @val=14;
-execute stmt using @val;
-call p_verify_reprepare_count(0);
-select @message;
-
-select * from t1 order by a;
-drop table t1;
-deallocate prepare stmt;
-
---echo =====================================================================
---echo Part 7: TABLE -> TABLE (TRIGGER dependencies) transitions
---echo =====================================================================
-
---echo # Test 7-a: dependent PROCEDURE has changed
---echo #
-
-create table t1 (a int);
-create trigger t1_ai after insert on t1 for each row
- call p1(new.a);
-create procedure p1(a int) begin end;
-prepare stmt from "insert into t1 (a) values (?)";
-set @var= 1;
-execute stmt using @var;
-drop procedure p1;
-create procedure p1 (a int) begin end;
-set @var= 2;
-execute stmt using @var;
---echo # Cleanup
-drop procedure p1;
-call p_verify_reprepare_count(1);
-
---echo # Test 7-b: dependent FUNCTION has changed
---echo #
---echo # Note, this scenario is supported, subject of Bug#12093
---echo #
-drop trigger t1_ai;
-create trigger t1_ai after insert on t1 for each row
- select f1(new.a+1) into @var;
-create function f1 (a int) returns int return a;
-prepare stmt from "insert into t1(a) values (?)";
-set @var=3;
-execute stmt using @var;
-select @var;
-drop function f1;
-create function f1 (a int) returns int return 0;
-execute stmt using @var;
-call p_verify_reprepare_count(1);
-drop function f1;
-deallocate prepare stmt;
-
---echo # Test 7-c: dependent VIEW has changed
---echo #
---echo # Note, this scenario is not functioning correctly, see
---echo # Bug#33255 Trigger using views and view ddl : corrupted triggers
---echo # and Bug #33000 Triggers do not detect changes in meta-data.
---echo #
-drop trigger t1_ai;
-create table t2 (a int unique);
-create table t3 (a int unique);
-create view v1 as select a from t2;
-create trigger t1_ai after insert on t1 for each row
- insert into v1 (a) values (new.a);
-
---echo # Demonstrate that the same bug is present
---echo # without prepared statements
-insert into t1 (a) values (5);
-select * from t2;
-select * from t3;
-drop view v1;
-create view v1 as select a from t3;
---error ER_NO_SUCH_TABLE
-insert into t1 (a) values (6);
-flush table t1;
-insert into t1 (a) values (6);
-select * from t2;
-select * from t3;
-
-prepare stmt from "insert into t1 (a) values (?)";
-set @var=7;
-execute stmt using @var;
-call p_verify_reprepare_count(0);
-select * from t3;
-select * from t2;
-drop view v1;
-create view v1 as select a from t2;
-set @var=8;
---echo # View in the INSERT-statement in the trigger is still pointing to
---echo # table 't3', because the trigger hasn't noticed the change
---echo # in view definition. This will be fixed by WL#4179.
---echo #
---echo # The prepared INSERT-statement however does notice the change,
---echo # but repreparation of the main statement doesn't cause repreparation
---echo # of trigger statements.
---echo #
---echo # The following EXECUTE results in ER_NO_SUCH_TABLE (t3) error, because
---echo # pre-locking list of the prepared statement has been changed
---echo # (the prepared statement has noticed the meta-data change),
---echo # but the trigger still tries to deal with 't3', which is not opened.
---echo # That's why '8' is not inserted neither into 't2', nor into 't3'.
---error ER_NO_SUCH_TABLE
-execute stmt using @var;
-call p_verify_reprepare_count(1);
-select * from t2;
-select * from t3;
-flush table t1;
-set @var=9;
-execute stmt using @var;
-call p_verify_reprepare_count(1);
-select * from t2;
-select * from t3;
-drop view v1;
-drop table t1,t2,t3;
-
---echo # Test 7-d: dependent TABLE has changed
-create table t1 (a int);
-create trigger t1_ai after insert on t1 for each row
- insert into t2 (a) values (new.a);
-create table t2 (a int);
-
-prepare stmt from "insert into t1 (a) values (?)";
-set @var=1;
-execute stmt using @var;
-alter table t2 add column comment varchar(255);
-set @var=2;
---echo # Since the dependent table is tracked in the prelocked
---echo # list of the prepared statement, invalidation happens
---echo # and the statement is re-prepared. This is an unnecessary
---echo # side effect, since the statement that *is* dependent
---echo # on t2 definition is inside the trigger, and it is currently
---echo # not reprepared (see the previous test case).
-execute stmt using @var;
-call p_verify_reprepare_count(1);
-select * from t1;
-select * from t2;
-drop table t1,t2;
-
---echo # Test 7-e: dependent TABLE TRIGGER has changed
-create table t1 (a int);
-create trigger t1_ai after insert on t1 for each row
- insert into t2 (a) values (new.a);
-create table t2 (a int unique);
-create trigger t2_ai after insert on t2 for each row
- insert into t3 (a) values (new.a);
-create table t3 (a int unique);
-create table t4 (a int unique);
-
-insert into t1 (a) values (1);
-select * from t1 join t2 on (t1.a=t2.a) join t3 on (t2.a=t3.a);
-drop trigger t2_ai;
-create trigger t2_ai after insert on t2 for each row
- insert into t4 (a) values (new.a);
-insert into t1 (a) values (2);
-select * from t1 join t2 on (t1.a=t2.a) join t4 on (t2.a=t4.a);
-
-prepare stmt from "insert into t1 (a) values (?)";
-set @var=3;
-execute stmt using @var;
-select * from t1 join t2 on (t1.a=t2.a) join t4 on (t2.a=t4.a);
-drop trigger t2_ai;
-create trigger t2_ai after insert on t2 for each row
- insert into t3 (a) values (new.a);
-set @var=4;
-execute stmt using @var;
-call p_verify_reprepare_count(1);
-select * from t1 join t2 on (t1.a=t2.a) join t3 on (t2.a=t3.a);
-select * from t1 join t2 on (t1.a=t2.a) join t4 on (t2.a=t4.a);
-
-drop table t1, t2, t3, t4;
-deallocate prepare stmt;
-
---echo =====================================================================
---echo Part 8: TABLE -> TEMPORARY TABLE transitions
---echo =====================================================================
-
---echo # Test 8-a: base table used recreated as temporary table
-create table t1 (a int);
-
-prepare stmt from "select * from t1";
-execute stmt;
-
-drop table t1;
-create temporary table t1 (a int);
-
-execute stmt;
-call p_verify_reprepare_count(1);
-execute stmt;
-call p_verify_reprepare_count(0);
-
-drop table t1;
-deallocate prepare stmt;
-
---echo # Test 8-b: temporary table has precedence over base table with same name
-create table t1 (a int);
-prepare stmt from 'select count(*) from t1';
-execute stmt;
-call p_verify_reprepare_count(0);
-execute stmt;
-call p_verify_reprepare_count(0);
-
-create temporary table t1 AS SELECT 1;
-execute stmt;
-call p_verify_reprepare_count(1);
-execute stmt;
-call p_verify_reprepare_count(0);
-
-deallocate prepare stmt;
-drop temporary table t1;
-drop table t1;
-
-
---echo =====================================================================
---echo Part 9: TABLE -> VIEW transitions
---echo =====================================================================
-
-create table t1 (a int);
-
-prepare stmt from "select * from t1";
-execute stmt;
-call p_verify_reprepare_count(0);
-
-drop table t1;
-create table t2 (a int);
-create view t1 as select * from t2;
-
-execute stmt;
-call p_verify_reprepare_count(1);
-
-drop view t1;
-drop table t2;
-deallocate prepare stmt;
-
---echo =====================================================================
---echo Part 10: TEMPORARY TABLE -> NOTHING transitions
---echo =====================================================================
-
-create temporary table t1 (a int);
-
-prepare stmt from "select * from t1";
-execute stmt;
-call p_verify_reprepare_count(0);
-
-drop temporary table t1;
---error ER_NO_SUCH_TABLE
-execute stmt;
-call p_verify_reprepare_count(0);
-deallocate prepare stmt;
-
---echo =====================================================================
---echo Part 11: TEMPORARY TABLE -> TABLE transitions
---echo =====================================================================
-
---echo # Test 11-a: temporary table replaced by base table
-create table t1 (a int);
-insert into t1 (a) value (1);
-create temporary table t1 (a int);
-
-prepare stmt from "select * from t1";
-execute stmt;
-call p_verify_reprepare_count(0);
-
-drop temporary table t1;
-
-execute stmt;
-call p_verify_reprepare_count(1);
-
-select * from t1;
-drop table t1;
-deallocate prepare stmt;
-
-
---echo # Test 11-b: temporary table has precedence over base table with same name
---echo # temporary table disappears
-create table t1 (a int);
-create temporary table t1 as select 1 as a;
-prepare stmt from "select count(*) from t1";
-execute stmt;
-call p_verify_reprepare_count(0);
-execute stmt;
-call p_verify_reprepare_count(0);
-
-drop temporary table t1;
-execute stmt;
-call p_verify_reprepare_count(1);
-execute stmt;
-call p_verify_reprepare_count(0);
-
-deallocate prepare stmt;
-drop table t1;
-
-
---echo =====================================================================
---echo Part 12: TEMPORARY TABLE -> TEMPORARY TABLE (DDL) transitions
---echo =====================================================================
-
-create temporary table t1 (a int);
-
-prepare stmt from "select a from t1";
-execute stmt;
-call p_verify_reprepare_count(0);
-
-drop temporary table t1;
-create temporary table t1 (a int, b int);
-
-execute stmt;
-call p_verify_reprepare_count(1);
-
-select * from t1;
-drop temporary table t1;
-deallocate prepare stmt;
-
---echo =====================================================================
---echo Part 13: TEMPORARY TABLE -> VIEW transitions
---echo =====================================================================
-
-create temporary table t1 (a int);
-create table t2 (a int);
-
-prepare stmt from "select * from t1";
-execute stmt;
-call p_verify_reprepare_count(0);
-
-drop temporary table t1;
-create view t1 as select * from t2;
-
-execute stmt;
-call p_verify_reprepare_count(1);
-
-drop view t1;
-drop table t2;
-deallocate prepare stmt;
-
---echo =====================================================================
---echo Part 14: VIEW -> NOTHING transitions
---echo =====================================================================
-
-create table t2 (a int);
-create view t1 as select * from t2;
-
-prepare stmt from "select * from t1";
-execute stmt;
-drop view t1;
-
---error ER_NO_SUCH_TABLE
-execute stmt;
-call p_verify_reprepare_count(0);
---error ER_NO_SUCH_TABLE
-execute stmt;
-call p_verify_reprepare_count(0);
-
-drop table t2;
-deallocate prepare stmt;
-
---echo =====================================================================
---echo Part 15: VIEW -> TABLE transitions
---echo =====================================================================
-
-create table t2 (a int);
-create view t1 as select * from t2;
-
-prepare stmt from "select * from t1";
-execute stmt;
-call p_verify_reprepare_count(0);
-
-drop view t1;
-create table t1 (a int);
-
-execute stmt;
-call p_verify_reprepare_count(1);
-
-drop table t2;
-drop table t1;
-deallocate prepare stmt;
-
---echo =====================================================================
---echo Part 16: VIEW -> TEMPORARY TABLE transitions
---echo =====================================================================
-
---echo #
---echo # Test 1: Merged view
---echo #
-create table t2 (a int);
-insert into t2 (a) values (1);
-create view t1 as select * from t2;
-
-prepare stmt from "select * from t1";
-execute stmt;
-call p_verify_reprepare_count(0);
-
-create temporary table t1 (a int);
-# t1 still refers to the view - no reprepare has been done.
-execute stmt;
-call p_verify_reprepare_count(0);
-
-drop view t1;
-# t1 still refers to the, now deleted, view - no reprepare has been done.
---error ER_NO_SUCH_TABLE
-execute stmt;
-call p_verify_reprepare_count(0);
-
-drop table t2;
-drop temporary table t1;
-deallocate prepare stmt;
-
---echo #
---echo # Test 2: Materialized view
---echo #
-create table t2 (a int);
-insert into t2 (a) values (1);
-create algorithm = temptable view t1 as select * from t2;
-
-prepare stmt from "select * from t1";
-execute stmt;
-call p_verify_reprepare_count(0);
-
-create temporary table t1 (a int);
-# t1 still refers to the view - no reprepare has been done.
-execute stmt;
-call p_verify_reprepare_count(0);
-
-drop view t1;
-# t1 still refers to the, now deleted, view - no reprepare has been done.
---error ER_NO_SUCH_TABLE
-execute stmt;
-call p_verify_reprepare_count(0);
-
-drop table t2;
-drop temporary table t1;
-deallocate prepare stmt;
-
---echo #
---echo # Test 3: View referencing an Information schema table
---echo #
-create view t1 as select table_name from information_schema.views;
-
-prepare stmt from "select * from t1";
-execute stmt;
-call p_verify_reprepare_count(0);
-
-create temporary table t1 (a int);
-# t1 has been substituted with a reference to the IS table
-execute stmt;
-call p_verify_reprepare_count(0);
-
-drop view t1;
---error 1146
-execute stmt;
-call p_verify_reprepare_count(0);
-
-drop temporary table t1;
-deallocate prepare stmt;
-
---echo =====================================================================
---echo Part 17: VIEW -> VIEW (DDL) transitions
---echo =====================================================================
-
-create table t2 (a int);
-insert into t2 values (10), (20), (30);
-
-create view t1 as select a, 2*a as b, 3*a as c from t2;
-select * from t1;
-
-prepare stmt from "select * from t1";
-execute stmt;
-
-drop view t1;
-create view t1 as select a, 2*a as b, 5*a as c from t2;
-select * from t1;
-
---echo # This is actually a test case for Bug#11748352 (36002 Prepared
---echo # statements: if a view used in a statement is replaced, bad data).
-execute stmt;
-call p_verify_reprepare_count(1);
-
-flush table t2;
-
-execute stmt;
-call p_verify_reprepare_count(1);
-
---echo # Check that we properly handle ALTER VIEW statements.
-execute stmt;
-call p_verify_reprepare_count(0);
-alter view t1 as select a, 3*a as b, 4*a as c from t2;
-execute stmt;
-call p_verify_reprepare_count(1);
-execute stmt;
-call p_verify_reprepare_count(0);
-execute stmt;
-call p_verify_reprepare_count(0);
-select * from t1;
-
---echo # Check that DROP & CREATE is properly handled under LOCK TABLES.
-drop view t1;
-flush tables; # empty TDC
-create view t1 as select a, 5*a as b, 6*a as c from t2;
-lock tables t1 read, t2 read;
-execute stmt;
-call p_verify_reprepare_count(1);
-execute stmt;
-call p_verify_reprepare_count(0);
-execute stmt;
-call p_verify_reprepare_count(0);
-unlock tables;
---echo # ... and once again...
-drop view t1;
-create view t1 as select a, 6*a as b, 7*a as c from t2;
-lock tables t1 read, t2 read;
-execute stmt;
-call p_verify_reprepare_count(1);
-execute stmt;
-call p_verify_reprepare_count(0);
-execute stmt;
-call p_verify_reprepare_count(0);
-unlock tables;
-
---echo # Check that ALTER VIEW is properly handled under LOCK TABLES.
-alter view t1 as select a, 7*a as b, 8*a as c from t2;
-lock tables t1 read, t2 read;
-execute stmt;
-call p_verify_reprepare_count(1);
-execute stmt;
-call p_verify_reprepare_count(0);
-execute stmt;
-call p_verify_reprepare_count(0);
-unlock tables;
-
-drop table t2;
-drop view t1;
-deallocate prepare stmt;
-
---echo # Check that DROP & CREATE is properly handled under LOCK TABLES when
---echo # LOCK TABLES does not contain the complete set of views.
-
-create table t1(a int);
-insert into t1 values (1), (2), (3);
-
-create view v1 as select a from t1;
-
-lock tables t1 read, v1 read;
-
-prepare stmt from 'select * from v1';
-
-execute stmt;
-call p_verify_reprepare_count(0);
-
-execute stmt;
-call p_verify_reprepare_count(0);
-
-unlock tables;
-
-drop view v1;
-create view v1 as select 2*a from t1;
-
-# Miss v1.
-lock tables t1 read;
-
---error ER_TABLE_NOT_LOCKED
-execute stmt;
-
-unlock tables;
-
-drop table t1;
-drop view v1;
-deallocate prepare stmt;
-
---echo # Check that ALTER VIEW is properly handled under LOCK TABLES when
---echo # LOCK TABLES does not contain the complete set of views.
-
-create table t1(a int);
-insert into t1 values (1), (2), (3);
-
-create view v1 as select a from t1;
-
-lock tables t1 read, v1 read;
-
-prepare stmt from 'select * from v1';
-
-execute stmt;
-call p_verify_reprepare_count(0);
-
-execute stmt;
-call p_verify_reprepare_count(0);
-
-unlock tables;
-
-alter view v1 as select 2*a from t1;
-
-# Miss v1.
-lock tables t1 read;
-
---error ER_TABLE_NOT_LOCKED
-execute stmt;
-
-unlock tables;
-
-drop table t1;
-drop view v1;
-deallocate prepare stmt;
-
---echo =====================================================================
---echo Part 18: VIEW -> VIEW (VIEW dependencies) transitions
---echo =====================================================================
-
---echo # Part 18a: dependent function has changed
-create table t1 (a int);
-insert into t1 (a) values (1), (2), (3);
-create function f1() returns int return (select max(a) from t1);
-create view v1 as select f1();
-prepare stmt from "select * from v1";
-execute stmt;
-execute stmt;
-call p_verify_reprepare_count(0);
-drop function f1;
-create function f1() returns int return 2;
---echo # XXX: Used to be another manifestation of Bug#12093.
---echo # We only used to get a different error
---echo # message because the non-existing procedure error is masked
---echo # by the view.
-execute stmt;
-execute stmt;
-call p_verify_reprepare_count(1);
-
---echo # Part 18b: dependent procedure has changed (referred to via a function)
-
-create table t2 (a int);
-insert into t2 (a) values (4), (5), (6);
-
-drop function f1;
-delimiter |;
-create function f1() returns int
-begin
- declare x int;
- call p1(x);
- return x;
-end|
-delimiter ;|
-create procedure p1(out x int) select max(a) from t1 into x;
-
-prepare stmt from "select * from v1";
-execute stmt;
-execute stmt;
-call p_verify_reprepare_count(0);
-drop procedure p1;
-create procedure p1(out x int) select max(a) from t2 into x;
---echo # XXX: used to be a bug. The prelocked list was not invalidated
---echo # and we kept opening table t1, whereas the procedure
---echo # is now referring to table t2
-execute stmt;
-call p_verify_reprepare_count(1);
-flush table t1;
-execute stmt;
-call p_verify_reprepare_count(0);
-execute stmt;
-
---echo # Test 18-c: dependent VIEW has changed
-
-drop view v1;
-create view v2 as select a from t1;
-create view v1 as select * from v2;
-prepare stmt from "select * from v1";
-execute stmt;
-execute stmt;
-call p_verify_reprepare_count(0);
-drop view v2;
-create view v2 as select a from t2;
-execute stmt;
-execute stmt;
-call p_verify_reprepare_count(1);
-flush table t1;
-execute stmt;
-call p_verify_reprepare_count(0);
-execute stmt;
---echo # Test 18-d: dependent TABLE has changed
-drop view v2;
-create table v2 as select * from t1;
-execute stmt;
-call p_verify_reprepare_count(1);
-execute stmt;
-call p_verify_reprepare_count(0);
-drop table v2;
-create table v2 (a int unique) as select * from t2;
-execute stmt;
-call p_verify_reprepare_count(1);
-execute stmt;
-call p_verify_reprepare_count(0);
-
---echo # Test 18-e: dependent TABLE trigger has changed
-
-prepare stmt from "insert into v1 (a) values (?)";
-set @var= 7;
-execute stmt using @var;
-call p_verify_reprepare_count(0);
-create trigger v2_bi before insert on v2 for each row set @message="v2_bi";
-set @var=8;
-execute stmt using @var;
-call p_verify_reprepare_count(1);
-select @message;
-drop trigger v2_bi;
-set @message=null;
-set @var=9;
-execute stmt using @var;
-call p_verify_reprepare_count(1);
-select @message;
-create trigger v2_bi after insert on v2 for each row set @message="v2_ai";
-set @var= 10;
-execute stmt using @var;
-call p_verify_reprepare_count(1);
-select @message;
-select * from v1;
-
---echo # Cleanup
-
---disable_warnings
-drop table if exists t1, t2, v1, v2;
-drop view if exists v1, v2;
-drop function f1;
-drop procedure p1;
---enable_warnings
-deallocate prepare stmt;
-
---echo =====================================================================
---echo Part 19: Special tables (INFORMATION_SCHEMA)
---echo =====================================================================
-
-# Using a temporary table internally should not confuse the prepared
-# statement code, and should not raise ER_PS_INVALIDATED errors
-prepare stmt from
- "select ROUTINE_SCHEMA, ROUTINE_NAME, ROUTINE_TYPE
- from INFORMATION_SCHEMA.ROUTINES where
- routine_name='p1'";
-
-create procedure p1() select "hi there";
-
-execute stmt;
-execute stmt;
-
-drop procedure p1;
-create procedure p1() select "hi there, again";
-
-execute stmt;
-execute stmt;
-call p_verify_reprepare_count(0);
-
-drop procedure p1;
-deallocate prepare stmt;
-
---echo =====================================================================
---echo Part 20: Special tables (log tables)
---echo =====================================================================
-
-prepare stmt from
- "select * from mysql.general_log where argument='IMPOSSIBLE QUERY STRING'";
-
---disable_result_log
-execute stmt;
-execute stmt;
-execute stmt;
-execute stmt;
---enable_result_log
-call p_verify_reprepare_count(0);
-deallocate prepare stmt;
-
---echo =====================================================================
---echo Part 21: Special tables (system tables)
---echo =====================================================================
-
-prepare stmt from
- "select type, db, name from mysql.proc where name='p1'";
-
-create procedure p1() select "hi there";
-
-execute stmt;
-execute stmt;
-
-drop procedure p1;
-create procedure p1() select "hi there, again";
-
-execute stmt;
-execute stmt;
-call p_verify_reprepare_count(0);
-
-drop procedure p1;
-deallocate prepare stmt;
-
---echo =====================================================================
---echo Part 22: Special tables (views temp tables)
---echo =====================================================================
-
-create table t1 (a int);
-
-create algorithm=temptable view v1 as select a*a as a2 from t1;
-
---echo # Using a temporary table internally should not confuse the prepared
---echo # statement code, and should not raise ER_PS_INVALIDATED errors
-show create view v1;
-
-prepare stmt from "select * from v1";
-
-insert into t1 values (1), (2), (3);
-execute stmt;
-execute stmt;
-
-insert into t1 values (4), (5), (6);
-execute stmt;
-execute stmt;
-call p_verify_reprepare_count(0);
-
-drop table t1;
-drop view v1;
-
---echo =====================================================================
---echo Part 23: Special statements
---echo =====================================================================
-
---echo # SQLCOM_ALTER_TABLE:
-
-
-create table t1 (a int);
-
-prepare stmt from "alter table t1 add column b int";
-execute stmt;
-
-drop table t1;
-create table t1 (a1 int, a2 int);
-
---echo # t1 has changed, and it's does not lead to reprepare
-execute stmt;
-
-alter table t1 drop column b;
-execute stmt;
-
-alter table t1 drop column b;
-execute stmt;
-call p_verify_reprepare_count(0);
-
-drop table t1;
-
---echo # SQLCOM_REPAIR:
-
-create table t1 (a int);
-
-insert into t1 values (1), (2), (3);
-
-prepare stmt from "repair table t1";
-
-execute stmt;
-execute stmt;
-
-drop table t1;
-create table t1 (a1 int, a2 int);
-insert into t1 values (1, 10), (2, 20), (3, 30);
-
---echo # t1 has changed, and it's does not lead to reprepare
-execute stmt;
-
-alter table t1 add column b varchar(50) default NULL;
-execute stmt;
-call p_verify_reprepare_count(0);
-
-alter table t1 drop column b;
-execute stmt;
-call p_verify_reprepare_count(0);
-
---echo # SQLCOM_ANALYZE:
-
-prepare stmt from "analyze table t1";
-execute stmt;
-
-drop table t1;
-create table t1 (a1 int, a2 int);
-insert into t1 values (1, 10), (2, 20), (3, 30);
---echo # t1 has changed, and it's not a problem
-execute stmt;
-
-alter table t1 add column b varchar(50) default NULL;
-execute stmt;
-
-alter table t1 drop column b;
-execute stmt;
-
-call p_verify_reprepare_count(0);
-
---echo # SQLCOM_OPTIMIZE:
-
-prepare stmt from "optimize table t1";
-execute stmt;
-
-drop table t1;
-create table t1 (a1 int, a2 int);
-insert into t1 values (1, 10), (2, 20), (3, 30);
-
---echo # t1 has changed, and it's not a problem
-execute stmt;
-
-alter table t1 add column b varchar(50) default NULL;
-execute stmt;
-
-alter table t1 drop column b;
-execute stmt;
-call p_verify_reprepare_count(0);
-
-drop table t1;
-
---echo # SQLCOM_SHOW_CREATE_PROC:
-
-prepare stmt from "show create procedure p1";
---error ER_SP_DOES_NOT_EXIST
-execute stmt;
---error ER_SP_DOES_NOT_EXIST
-execute stmt;
-
-create procedure p1() begin end;
-
---disable_result_log
-execute stmt;
-execute stmt;
---enable_result_log
-
-drop procedure p1;
-create procedure p1(x int, y int) begin end;
-
---disable_result_log
-execute stmt;
-execute stmt;
---enable_result_log
-
-drop procedure p1;
-
---error ER_SP_DOES_NOT_EXIST
-execute stmt;
---error ER_SP_DOES_NOT_EXIST
-execute stmt;
-call p_verify_reprepare_count(0);
-
---echo # SQLCOM_SHOW_CREATE_FUNC:
-
-prepare stmt from "show create function f1";
---error ER_SP_DOES_NOT_EXIST
-execute stmt;
---error ER_SP_DOES_NOT_EXIST
-execute stmt;
-
-create function f1() returns int return 0;
-
---disable_result_log
-execute stmt;
-execute stmt;
---enable_result_log
-
-drop function f1;
-create function f1(x int, y int) returns int return x+y;
-
---disable_result_log
-execute stmt;
-execute stmt;
---enable_result_log
-
-drop function f1;
-
---error ER_SP_DOES_NOT_EXIST
-execute stmt;
---error ER_SP_DOES_NOT_EXIST
-execute stmt;
-call p_verify_reprepare_count(0);
-
---echo # SQLCOM_SHOW_CREATE_TRIGGER:
-
-create table t1 (a int);
-
-prepare stmt from "show create trigger t1_bi";
---error ER_TRG_DOES_NOT_EXIST
-execute stmt;
---error ER_TRG_DOES_NOT_EXIST
-execute stmt;
-
-create trigger t1_bi before insert on t1 for each row set @message= "t1_bi";
-
---disable_result_log
-execute stmt;
-execute stmt;
---enable_result_log
-
-drop trigger t1_bi;
-
-create trigger t1_bi before insert on t1 for each row set @message= "t1_bi (2)";
-
---disable_result_log
-execute stmt;
-execute stmt;
---enable_result_log
-
-drop trigger t1_bi;
-
---error ER_TRG_DOES_NOT_EXIST
-execute stmt;
---error ER_TRG_DOES_NOT_EXIST
-execute stmt;
-call p_verify_reprepare_count(0);
-
-drop table t1;
-deallocate prepare stmt;
-
---echo =====================================================================
---echo Part 24: Testing the strength of TABLE_SHARE version
---echo =====================================================================
-
---echo # Test 24-a: number of columns
-
-create table t1 (a int);
-
-prepare stmt from "select a from t1";
-execute stmt;
-call p_verify_reprepare_count(0);
-
-alter table t1 add column b varchar(50) default NULL;
-
-execute stmt;
-call p_verify_reprepare_count(1);
-execute stmt;
-call p_verify_reprepare_count(0);
-
---echo # Test 24-b: column name
-
-alter table t1 change b c int;
-execute stmt;
-call p_verify_reprepare_count(1);
-execute stmt;
-call p_verify_reprepare_count(0);
-
---echo # Test 24-c: column type
-
-alter table t1 change a a varchar(10);
-
-execute stmt;
-call p_verify_reprepare_count(1);
-execute stmt;
-call p_verify_reprepare_count(0);
-
---echo # Test 24-d: column type length
-
-alter table t1 change a a varchar(20);
-
-execute stmt;
-call p_verify_reprepare_count(1);
-execute stmt;
-call p_verify_reprepare_count(0);
-
---echo # Test 24-e: column NULL property
-
-alter table t1 change a a varchar(20) NOT NULL;
-
-execute stmt;
-call p_verify_reprepare_count(1);
-execute stmt;
-call p_verify_reprepare_count(0);
-
---echo # Test 24-f: column DEFAULT
-
-alter table t1 change c c int DEFAULT 20;
-
-execute stmt;
-call p_verify_reprepare_count(1);
-execute stmt;
-call p_verify_reprepare_count(0);
-
---echo # Test 24-g: number of keys
-create unique index t1_a_idx on t1 (a);
-
-execute stmt;
-call p_verify_reprepare_count(1);
-execute stmt;
-call p_verify_reprepare_count(0);
-
---echo # Test 24-h: changing index uniqueness
-
-drop index t1_a_idx on t1;
-create index t1_a_idx on t1 (a);
-
-execute stmt;
-call p_verify_reprepare_count(1);
-execute stmt;
-call p_verify_reprepare_count(0);
-
---echo # Cleanup
-drop table t1;
-
-deallocate prepare stmt;
-
---echo =====================================================================
---echo Testing reported bugs
---echo =====================================================================
-
---echo #
---echo # Bug#27420 A combination of PS and view operations cause
---echo # error + assertion on shutdown
---echo #
-
---disable_warnings
-drop table if exists t_27420_100;
-drop table if exists t_27420_101;
-drop view if exists v_27420;
---enable_warnings
-
-create table t_27420_100(a int);
-insert into t_27420_100 values (1), (2);
-
-create table t_27420_101(a int);
-insert into t_27420_101 values (1), (2);
-
-create view v_27420 as select t_27420_100.a X, t_27420_101.a Y
- from t_27420_100, t_27420_101
- where t_27420_100.a=t_27420_101.a;
-
-prepare stmt from "select * from v_27420";
-
-execute stmt;
-call p_verify_reprepare_count(0);
-
-drop view v_27420;
-create table v_27420(X int, Y int);
-
-execute stmt;
-call p_verify_reprepare_count(1);
-
-drop table v_27420;
-# passes in 5.0, fails in 5.1, should pass
-create table v_27420 (a int, b int, filler char(200));
-
-execute stmt;
-call p_verify_reprepare_count(1);
-
-drop table t_27420_100;
-drop table t_27420_101;
-drop table v_27420;
-deallocate prepare stmt;
-
---echo #
---echo # Bug#27430 Crash in subquery code when in PS and table DDL changed
---echo # after PREPARE
---echo #
-
---disable_warnings
-drop table if exists t_27430_1;
-drop table if exists t_27430_2;
---enable_warnings
-
-create table t_27430_1 (a int not null, oref int not null, key(a));
-insert into t_27430_1 values
- (1, 1),
- (1, 1234),
- (2, 3),
- (2, 1234),
- (3, 1234);
-
-create table t_27430_2 (a int not null, oref int not null);
-insert into t_27430_2 values
- (1, 1),
- (2, 2),
- (1234, 3),
- (1234, 4);
-
-prepare stmt from
- "select oref, a, a in (select a from t_27430_1 where oref=t_27430_2.oref) Z from t_27430_2";
-
-execute stmt;
-call p_verify_reprepare_count(0);
-
-drop table t_27430_1, t_27430_2;
-
-create table t_27430_1 (a int, oref int, key(a));
-insert into t_27430_1 values
- (1, 1),
- (1, NULL),
- (2, 3),
- (2, NULL),
- (3, NULL);
-
-create table t_27430_2 (a int, oref int);
-insert into t_27430_2 values
- (1, 1),
- (2,2),
- (NULL, 3),
- (NULL, 4);
-
-execute stmt;
-call p_verify_reprepare_count(1);
-
-drop table t_27430_1;
-drop table t_27430_2;
-deallocate prepare stmt;
-
---echo #
---echo # Bug#27690 Re-execution of prepared statement after table
---echo # was replaced with a view crashes
---echo #
-
---disable_warnings
-drop table if exists t_27690_1;
-drop view if exists v_27690_1;
-drop table if exists v_27690_2;
---enable_warnings
-
-create table t_27690_1 (a int, b int);
-insert into t_27690_1 values (1,1),(2,2);
-
-create table v_27690_1 as select * from t_27690_1;
-create table v_27690_2 as select * from t_27690_1;
-
-prepare stmt from "select * from v_27690_1, v_27690_2";
-
-execute stmt;
-execute stmt;
-
-drop table v_27690_1;
-
---error ER_NO_SUCH_TABLE
-execute stmt;
-
---error ER_NO_SUCH_TABLE
-execute stmt;
-call p_verify_reprepare_count(0);
-
-create view v_27690_1 as select A.a, A.b from t_27690_1 A, t_27690_1 B;
-
-execute stmt;
-call p_verify_reprepare_count(1);
-execute stmt;
-call p_verify_reprepare_count(0);
-
-drop table t_27690_1;
-drop view v_27690_1;
-drop table v_27690_2;
-deallocate prepare stmt;
-
---echo #=====================================================================
---echo #
---echo # Bug#21294 Executing a prepared statement that executes
---echo # a stored function which was recreat
---echo #
-
-create function f1() returns int return 10;
-
-prepare stmt from "select f1()";
-execute stmt;
-
-drop function f1;
-create function f1() returns int return 10;
-
-# might pass or fail, implementation dependent
-execute stmt;
-
-drop function f1;
-create function f1() returns int return 20;
-
-execute stmt;
-call p_verify_reprepare_count(2);
-
-drop function f1;
-deallocate prepare stmt;
-
---echo #
---echo # Bug#12093 SP not found on second PS execution if another thread drops
---echo # other SP in between
---echo #
---disable_warnings
-drop table if exists t_12093;
-drop function if exists f_12093;
-drop function if exists f_12093_unrelated;
-drop procedure if exists p_12093;
-drop view if exists v_12093_unrelated;
---enable_warnings
-
-create table t_12093 (a int);
-create function f_12093() returns int return (select count(*) from t_12093);
-create procedure p_12093(a int) select * from t_12093;
-
-create function f_12093_unrelated() returns int return 2;
-create procedure p_12093_unrelated() begin end;
-create view v_12093_unrelated as select * from t_12093;
-
-connect (con1,localhost,root,,);
-connection default;
-
-let $my_drop = drop function f_12093_unrelated;
---source include/ps_ddl_1.inc
-#
-let $my_drop = drop procedure p_12093_unrelated;
---source include/ps_ddl_1.inc
-#
-# A reprepare of stmt_sf and stmt_sp is necessary because there is no
-# information about views within the table definition cache.
-let $my_drop = drop view v_12093_unrelated;
---source include/ps_ddl_1.inc
-
-call p_verify_reprepare_count(6);
-
-disconnect con1;
-drop table t_12093;
-drop function f_12093;
-drop procedure p_12093;
-deallocate prepare stmt_sf;
-deallocate prepare stmt_sp;
-
-
---echo =====================================================================
---echo Ensure that metadata validation is performed for every type of
---echo SQL statement where it is needed.
---echo =====================================================================
-
---echo #
---echo # SQLCOM_SELECT
---echo #
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a int);
-prepare stmt from "select 1 as res from dual where (1) in (select * from t1)";
-drop table t1;
-create table t1 (x int);
-execute stmt;
-drop table t1;
-deallocate prepare stmt;
-call p_verify_reprepare_count(1);
-
---echo #
---echo # SQLCOM_CREATE_TABLE
---echo #
-
---disable_warnings
-drop table if exists t1;
-drop table if exists t2;
---enable_warnings
-create table t1 (a int);
-prepare stmt from 'create table t2 as select * from t1';
-execute stmt;
-drop table t2;
-execute stmt;
-drop table t2;
-execute stmt;
-call p_verify_reprepare_count(0);
-# Base table with name of table to be created exists
---error ER_TABLE_EXISTS_ERROR
-execute stmt;
-call p_verify_reprepare_count(0);
---error ER_TABLE_EXISTS_ERROR
-execute stmt;
-call p_verify_reprepare_count(0);
-drop table t2;
-# Temporary table with name of table to be created exists
-create temporary table t2 (a int);
-# Temporary table and base table are not in the same name space.
-execute stmt;
-call p_verify_reprepare_count(0);
---error ER_TABLE_EXISTS_ERROR
-execute stmt;
-call p_verify_reprepare_count(0);
-drop temporary table t2;
---error ER_TABLE_EXISTS_ERROR
-execute stmt;
-call p_verify_reprepare_count(0);
-drop table t2;
-execute stmt;
-call p_verify_reprepare_count(0);
-drop table t2;
-# View with name of table to be created exists
-# Attention:
-# We cannot print the error message because it contains a random filename.
-# Example: 1050: Table '<some_path>/var/tmp/#sql_6979_0' already exists
-# Therefore we mangle it via
-# "--error ER_TABLE_EXISTS_ERROR,9999" (9999 is currently not used)
-# to "Got one of the listed errors".
-create view t2 as select 1;
---error ER_TABLE_EXISTS_ERROR,9999
-execute stmt;
-call p_verify_reprepare_count(0);
---error ER_TABLE_EXISTS_ERROR,9999
-execute stmt;
-call p_verify_reprepare_count(0);
-drop view t2;
-drop table t1;
-# Table to be used recreated (drop,create) with different layout
-create table t1 (x varchar(20));
-execute stmt;
-call p_verify_reprepare_count(1);
-select * from t2;
-drop table t2;
-execute stmt;
-call p_verify_reprepare_count(0);
-drop table t2;
-# Table to be used has a modified (alter table) layout
-alter table t1 add column y decimal(10,3);
-execute stmt;
-call p_verify_reprepare_count(1);
-select * from t2;
-drop table t2;
-execute stmt;
-call p_verify_reprepare_count(0);
-drop table t1;
-deallocate prepare stmt;
-create table t1 (a int);
-insert into t1 (a) values (1);
-prepare stmt from "create temporary table if not exists t2 as select * from t1";
-execute stmt;
-drop table t2;
-execute stmt;
-call p_verify_reprepare_count(0);
-execute stmt;
-call p_verify_reprepare_count(1);
-select * from t2;
-execute stmt;
-call p_verify_reprepare_count(0);
-select * from t2;
-drop table t2;
-create temporary table t2 (a varchar(10));
-execute stmt;
-select * from t2;
-call p_verify_reprepare_count(1);
-drop table t1;
-create table t1 (x int);
-execute stmt;
-call p_verify_reprepare_count(1);
-execute stmt;
-call p_verify_reprepare_count(0);
-drop table t1;
-drop temporary table t2;
-drop table t2;
-deallocate prepare stmt;
-
-create table t1 (a int);
-prepare stmt from "create table t2 like t1";
-execute stmt;
-call p_verify_reprepare_count(0);
-drop table t2;
-execute stmt;
-call p_verify_reprepare_count(0);
-drop table t2;
-# Table to be used does not exist
-drop table t1;
---error ER_NO_SUCH_TABLE
-execute stmt;
-call p_verify_reprepare_count(0);
---error ER_NO_SUCH_TABLE
-execute stmt;
-call p_verify_reprepare_count(0);
-# Table to be used recreated (drop,create) with different layout
-create table t1 (x char(17));
-execute stmt;
-call p_verify_reprepare_count(1);
-drop table t2;
-execute stmt;
-call p_verify_reprepare_count(0);
-drop table t2;
-# Table to be used has a modified (alter table) layout
-alter table t1 add column y time;
-execute stmt;
-call p_verify_reprepare_count(1);
-select * from t2;
-drop table t2;
-execute stmt;
-call p_verify_reprepare_count(0);
-drop table t1;
-drop table t2;
-deallocate prepare stmt;
-
-
---echo #
---echo # SQLCOM_UPDATE
---echo #
-
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-create table t1 (a int);
-create table t2 (a int);
-prepare stmt from "update t2 set a=a+1 where (1) in (select * from t1)";
-execute stmt;
-drop table t1;
-create table t1 (x int);
-execute stmt;
-drop table t1, t2;
-deallocate prepare stmt;
-
---echo #
---echo # SQLCOM_INSERT
---echo #
-
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-create table t1 (a int);
-create table t2 (a int);
-prepare stmt from "insert into t2 set a=((1) in (select * from t1))";
-execute stmt;
-drop table t1;
-create table t1 (x int);
-execute stmt;
-
-drop table t1, t2;
-deallocate prepare stmt;
-
---echo #
---echo # SQLCOM_INSERT_SELECT
---echo #
-
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-create table t1 (a int);
-create table t2 (a int);
-prepare stmt from "insert into t2 select * from t1";
-execute stmt;
-drop table t1;
-create table t1 (x int);
-execute stmt;
-drop table t1, t2;
-deallocate prepare stmt;
-
---echo #
---echo # SQLCOM_REPLACE
---echo #
-
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-create table t1 (a int);
-create table t2 (a int);
-prepare stmt from "replace t2 set a=((1) in (select * from t1))";
-execute stmt;
-drop table t1;
-create table t1 (x int);
-execute stmt;
-drop table t1, t2;
-deallocate prepare stmt;
-
---echo #
---echo # SQLCOM_REPLACE_SELECT
---echo #
-
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-create table t1 (a int);
-create table t2 (a int);
-prepare stmt from "replace t2 select * from t1";
-execute stmt;
-drop table t1;
-create table t1 (x int);
-execute stmt;
-drop table t1, t2;
-deallocate prepare stmt;
-
---echo #
---echo # SQLCOM_DELETE
---echo #
-
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-create table t1 (a int);
-create table t2 (a int);
-prepare stmt from "delete from t2 where (1) in (select * from t1)";
-execute stmt;
-drop table t1;
-create table t1 (x int);
-execute stmt;
-drop table t1, t2;
-deallocate prepare stmt;
-
---echo #
---echo # SQLCOM_DELETE_MULTI
---echo #
-
---disable_warnings
-drop table if exists t1, t2, t3;
---enable_warnings
-create table t1 (a int);
-create table t2 (a int);
-create table t3 (a int);
-prepare stmt from "delete t2, t3 from t2, t3 where (1) in (select * from t1)";
-execute stmt;
-drop table t1;
-create table t1 (x int);
-execute stmt;
-drop table t1, t2, t3;
-deallocate prepare stmt;
-
---echo #
---echo # SQLCOM_UPDATE_MULTI
---echo #
-
---disable_warnings
-drop table if exists t1, t2, t3;
---enable_warnings
-create table t1 (a int);
-create table t2 (a int);
-create table t3 (a int);
-prepare stmt from "update t2, t3 set t3.a=t2.a, t2.a=null where (1) in (select * from t1)";
-drop table t1;
-create table t1 (x int);
-execute stmt;
-drop table t1, t2, t3;
-deallocate prepare stmt;
---echo # Intermediate results: 8 SQLCOMs tested, 8 automatic reprepares
-call p_verify_reprepare_count(8);
-
---echo #
---echo # SQLCOM_LOAD
---echo #
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a varchar(20));
---error ER_UNSUPPORTED_PS
-prepare stmt from "load data infile '../std_data_ln/words.dat' into table t1";
-drop table t1;
-
---echo #
---echo # SQLCOM_SHOW_DATABASES
---echo #
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a int);
-prepare stmt from "show databases where (1) in (select * from t1)";
-execute stmt;
-drop table t1;
-create table t1 (x int);
-execute stmt;
-drop table t1;
-deallocate prepare stmt;
-
---echo #
---echo # SQLCOM_SHOW_TABLES
---echo #
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a int);
-prepare stmt from "show tables where (1) in (select * from t1)";
-execute stmt;
-drop table t1;
-create table t1 (x int);
-execute stmt;
-drop table t1;
-deallocate prepare stmt;
-
---echo #
---echo # SQLCOM_SHOW_FIELDS
---echo #
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a int);
-prepare stmt from "show fields from t1 where (1) in (select * from t1)";
-execute stmt;
-drop table t1;
-create table t1 (x int);
-execute stmt;
-drop table t1;
-deallocate prepare stmt;
-
---echo #
---echo # SQLCOM_SHOW_KEYS
---echo #
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a int);
-prepare stmt from "show keys from t1 where (1) in (select * from t1)";
-execute stmt;
-drop table t1;
-create table t1 (x int);
-execute stmt;
-drop table t1;
-deallocate prepare stmt;
-
---echo #
---echo # SQLCOM_SHOW_VARIABLES
---echo #
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a int);
-prepare stmt from "show variables where (1) in (select * from t1)";
-execute stmt;
-drop table t1;
-create table t1 (x int);
-execute stmt;
-drop table t1;
-deallocate prepare stmt;
-
---echo #
---echo # SQLCOM_SHOW_STATUS
---echo #
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a int);
-prepare stmt from "show status where (1) in (select * from t1)";
-execute stmt;
-drop table t1;
-create table t1 (x int);
-execute stmt;
-drop table t1;
-deallocate prepare stmt;
-
---echo #
---echo # SQLCOM_SHOW_ENGINE_STATUS, SQLCOM_SHOW_ENGINE_LOGS,
---echo # SQLCOM_SHOW_ENGINE_MUTEX, SQLCOM_SHOW_PROCESSLIST
---echo #
-
---echo # Currently can not have a where clause, need to be covered
---echo # with tests
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a int);
---error ER_PARSE_ERROR
-prepare stmt from "show engine all status where (1) in (select * from t1)";
---error ER_PARSE_ERROR
-prepare stmt from "show engine all logs where (1) in (select * from t1)";
---error ER_PARSE_ERROR
-prepare stmt from "show engine all mutex where (1) in (select * from t1)";
---error ER_PARSE_ERROR
-prepare stmt from "show processlist where (1) in (select * from t1)";
-drop table t1;
-
---echo #
---echo # SQLCOM_SHOW_CHARSETS
---echo #
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a int);
-prepare stmt from "show charset where (1) in (select * from t1)";
-execute stmt;
-drop table t1;
-create table t1 (x int);
-execute stmt;
-drop table t1;
-deallocate prepare stmt;
-
---echo #
---echo # SQLCOM_SHOW_COLLATIONS
---echo #
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a int);
-prepare stmt from "show collation where (1) in (select * from t1)";
-execute stmt;
-drop table t1;
-create table t1 (x int);
-execute stmt;
-drop table t1;
-deallocate prepare stmt;
-
---echo #
---echo # SQLCOM_SHOW_TABLE_STATUS
---echo #
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a int);
-prepare stmt from "show table status where (1) in (select * from t1)";
-execute stmt;
-drop table t1;
-create table t1 (x int);
-execute stmt;
-drop table t1;
-deallocate prepare stmt;
-
---echo #
---echo # SQLCOM_SHOW_TRIGGERS
---echo #
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a int);
-prepare stmt from "show triggers where (1) in (select * from t1)";
-execute stmt;
-drop table t1;
-create table t1 (x int);
-execute stmt;
-drop table t1;
-deallocate prepare stmt;
-
---echo #
---echo # SQLCOM_SHOW_OPEN_TABLES
---echo #
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a int);
-prepare stmt from "show open tables where (1) in (select * from t1)";
-execute stmt;
-drop table t1;
-create table t1 (x int);
-execute stmt;
-drop table t1;
-deallocate prepare stmt;
-
---echo #
---echo # SQLCOM_SHOW_STATUS_PROC
---echo #
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a int);
-prepare stmt from "show procedure status where (1) in (select * from t1)";
-execute stmt;
-drop table t1;
-create table t1 (x int);
-execute stmt;
-drop table t1;
-deallocate prepare stmt;
-
---echo #
---echo # SQLCOM_SHOW_STATUS_FUNC
---echo #
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a int);
-prepare stmt from "show function status where (1) in (select * from t1)";
-execute stmt;
-drop table t1;
-create table t1 (x int);
-execute stmt;
-drop table t1;
-deallocate prepare stmt;
-
---echo #
---echo # SQLCOM_SHOW_EVENTS
---echo #
---echo #
---echo # Please see this test in ps.test, it requires not_embedded.inc
---echo #
-
---echo #
---echo # SQLCOM_SET_OPTION
---echo #
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a int);
-prepare stmt from "set @a=((1) in (select * from t1))";
-execute stmt;
-drop table t1;
-create table t1 (x int);
-execute stmt;
-drop table t1;
-deallocate prepare stmt;
-
---echo #
---echo # SQLCOM_DO
---echo #
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a int);
-prepare stmt from "do ((1) in (select * from t1))";
-execute stmt;
-drop table t1;
-create table t1 (x int);
-execute stmt;
-drop table t1;
-deallocate prepare stmt;
-
---echo #
---echo # SQLCOM_CALL
---echo #
-
---disable_warnings
-drop table if exists t1;
-drop procedure if exists p1;
---enable_warnings
-create procedure p1(a int) begin end;
-create table t1 (a int);
-prepare stmt from "call p1((1) in (select * from t1))";
-execute stmt;
-drop table t1;
-create table t1 (x int);
-execute stmt;
-drop table t1;
-drop procedure p1;
-deallocate prepare stmt;
-
---echo #
---echo # SQLCOM_CREATE_VIEW
---echo #
-
---disable_warnings
-drop table if exists t1;
-drop view if exists v1;
---enable_warnings
-create table t1 (a int);
-prepare stmt from "create view v1 as select * from t1";
-execute stmt;
-drop view v1;
-drop table t1;
-create table t1 (x int);
-execute stmt;
-drop view v1;
-drop table t1;
-deallocate prepare stmt;
---echo # Intermediate result: number of reprepares matches the number
---echo # of tests
-call p_verify_reprepare_count(17);
-
---echo #
---echo # SQLCOM_ALTER_VIEW
---echo #
-
---disable_warnings
-drop view if exists v1;
---enable_warnings
-create view v1 as select 1;
---error ER_UNSUPPORTED_PS
-prepare stmt from "alter view v1 as select 2";
-drop view v1;
-
---echo # Cleanup
---echo #
---disable_warnings
-drop temporary table if exists t1, t2, t3;
-drop table if exists t1, t2, t3, v1, v2;
-drop procedure if exists p_verify_reprepare_count;
-drop procedure if exists p1;
-drop function if exists f1;
-drop view if exists v1, v2;
---enable_warnings
-
-
---echo #
---echo # Additional coverage for refactoring which was made as part of work
---echo # on bug '27480: Extend CREATE TEMPORARY TABLES privilege to allow
---echo # temp table operations'.
---echo #
---echo # Check that we don't try to pre-open temporary tables for the elements
---echo # from prelocking list, as this can lead to unwarranted ER_CANT_REOPEN
---echo # errors.
---disable_warnings ONCE
-DROP TABLE IF EXISTS t1, tm;
-CREATE TABLE t1 (a INT);
-CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
- SET @a:= (SELECT COUNT(*) FROM t1);
---echo # Prelocking list for the below statement should
---echo # contain t1 twice - once for the INSERT and once
---echo # SELECT from the trigger.
-PREPARE stmt1 FROM 'INSERT INTO t1 VALUES (1)';
-EXECUTE stmt1;
---echo # Create temporary table which will shadow t1.
-CREATE TEMPORARY TABLE t1 (b int);
---echo # The below execution of statement should not fail with ER_CANT_REOPEN
---echo # error. Instead stmt1 should be auto-matically reprepared and succeed.
-EXECUTE stmt1;
-DEALLOCATE PREPARE stmt1;
-DROP TEMPORARY TABLE t1;
-DROP TABLE t1;
---echo #
---echo # Also check that we properly reset table list elements from UNION
---echo # clause of CREATE TABLE and ALTER TABLE statements.
---echo #
-CREATE TEMPORARY TABLE t1 (i INT);
-PREPARE stmt2 FROM 'CREATE TEMPORARY TABLE tm (i INT) ENGINE=MERGE UNION=(t1)';
-EXECUTE stmt2;
-DROP TEMPORARY TABLE tm;
-EXECUTE stmt2;
-DEALLOCATE PREPARE stmt2;
-PREPARE stmt3 FROM 'ALTER TABLE tm UNION=(t1)';
-EXECUTE stmt3;
-EXECUTE stmt3;
-DEALLOCATE PREPARE stmt3;
-DROP TEMPORARY TABLES tm, t1;
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-10702 Crash in SET STATEMENT FOR EXECUTE
---echo #
-CREATE TABLE t1 (a INT);
-PREPARE stmt FROM 'INSERT INTO t1 VALUES (@@max_sort_length)';
-SET STATEMENT max_sort_length=2048 FOR EXECUTE stmt;
-SELECT * FROM t1;
-CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=NEW.a + 1;
-SET STATEMENT max_sort_length=2048 FOR EXECUTE stmt;
-SELECT * FROM t1;
-DROP TRIGGER tr1;
-SET STATEMENT max_sort_length=2048 FOR EXECUTE stmt;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # End of 10.1 tests
---echo #
diff --git a/mysql-test/t/ps_ddl1.test b/mysql-test/t/ps_ddl1.test
deleted file mode 100644
index 0145d445a14..00000000000
--- a/mysql-test/t/ps_ddl1.test
+++ /dev/null
@@ -1,398 +0,0 @@
-#
-# Testing the behavior of 'PREPARE', 'DDL', 'EXECUTE' scenarios
-#
-# There are several subtests which are probably "superfluous" because a DDL
-# statement before the EXECUTE <prepared stmt handle> contained a keyword
-# or action (Example: Alter) which causes that all prepared statements using
-# the modified object are reprepared before execution.
-# Please do not delete these subtests if they disturb. Just disable them by
-# if (0)
-# {
-# <tests to disable>
-# }.
-# There might be future optimisations of the server which decrease the amount
-# of unneeded reprepares or skip unneeded prepare steps and than these subtests
-# might become valuable.
-# Example:
-# Every preceding ALTER TABLE seems to cause a reprepare.
-# But if the ALTER only changed the table comment ...
-#
-# Created: 2008-04-18 mleich
-#
-
---disable_warnings
-drop temporary table if exists t1;
-drop table if exists t1, t2;
-drop procedure if exists p_verify_reprepare_count;
-drop procedure if exists p1;
-drop function if exists f1;
-drop view if exists t1;
-drop schema if exists mysqltest;
---enable_warnings
-
-delimiter |;
-create procedure p_verify_reprepare_count(expected int)
-begin
- declare old_reprepare_count int default @reprepare_count;
-
- select variable_value from
- information_schema.session_status where
- variable_name='com_stmt_reprepare'
- into @reprepare_count;
-
- if old_reprepare_count + expected <> @reprepare_count then
- select concat("Expected: ", expected,
- ", actual: ", @reprepare_count - old_reprepare_count)
- as "ERROR";
- else
- select '' as "SUCCESS";
- end if;
-end|
-delimiter ;|
-set @reprepare_count= 0;
-flush status;
-
---disable_warnings
-drop table if exists t1;
---disable_warnings
-
---echo # Column added or dropped is not within the list of selected columns
---echo # or table comment has changed.
---echo # A reprepare is probably not needed.
-create table t1 (a int, b int);
-prepare stmt from "select a from t1";
-execute stmt;
-call p_verify_reprepare_count(0);
-alter table t1 add column c int;
-execute stmt;
-call p_verify_reprepare_count(1);
-execute stmt;
-call p_verify_reprepare_count(0);
-alter table t1 drop column b;
-execute stmt;
-call p_verify_reprepare_count(1);
-execute stmt;
-call p_verify_reprepare_count(0);
-alter table t1 comment "My best table";
-execute stmt;
-call p_verify_reprepare_count(1);
-execute stmt;
-call p_verify_reprepare_count(0);
-drop table t1;
-deallocate prepare stmt;
-
---echo # Selects using the table at various positions, inser,update ...
---echo # + the table disappears
-create table t1 (a int);
-# Attention:
-# "truncate" must have the first position (= executed as last prepared
-# statement), because it recreates the table which has leads to reprepare
-# (is this really needed) of all statements.
-prepare stmt1 from "truncate t1";
-prepare stmt2 from "select 1 as my_column from t1";
-prepare stmt3 from "select 1 as my_column from (select * from t1) as t2";
-prepare stmt4 from
-"select 1 as my_column from (select 1) as t2 where exists (select 1 from t1)";
-prepare stmt5 from "select * from (select 1 as b) as t2, t1";
-prepare stmt6 from "select * from t1 union all select 1.5";
-prepare stmt7 from "select 1 as my_column union all select 1 from t1";
-prepare stmt8 from "insert into t1 values(1),(2)";
-prepare stmt9 from "update t1 set a = 3 where a = 2";
-prepare stmt10 from "delete from t1 where a = 1";
-let ps_stmt_count= 10;
---echo # Attention: Result logging is disabled.
-# Checks of correct results of statements are not the goal of this test.
-let $num= $ps_stmt_count;
-while ($num)
-{
- --disable_result_log
- eval execute stmt$num;
- --enable_result_log
- dec $num;
-}
-# There was no reprepare needed, because none of the objects has changed.
-call p_verify_reprepare_count(0);
-drop table t1;
-let $num= $ps_stmt_count;
-while ($num)
-{
- --error ER_NO_SUCH_TABLE
- eval execute stmt$num;
- dec $num;
-}
-# There was no reprepare needed, because the statement is no more applicable.
-call p_verify_reprepare_count(0);
-let $num= $ps_stmt_count;
-while ($num)
-{
- eval deallocate prepare stmt$num;
- dec $num;
-}
-
---echo # Selects using the table at various positions, inser,update ...
---echo # + layout change (drop column) which must cause a reprepare
-create table t1 (a int, b int);
-insert into t1 values(1,1),(2,2),(3,3);
-create table t2 like t1;
-insert into t1 values(2,2);
-prepare stmt1 from "select a,b from t1";
-prepare stmt2 from "select a,b from (select * from t1) as t1";
-prepare stmt3 from "select * from t1 where a = 2 and b = 2";
-prepare stmt4 from "select * from t2 where (a,b) in (select * from t1)";
-prepare stmt5 from "select * from t1 union select * from t2";
-prepare stmt6 from "select * from t1 union all select * from t2";
-prepare stmt7 from "insert into t1 set a = 4, b = 4";
-prepare stmt8 from "insert into t1 select * from t2";
-let ps_stmt_count= 8;
---echo # Attention: Result logging is disabled.
-# Checks of correct results of statements are not the goal of this test.
-let $num= $ps_stmt_count;
-while ($num)
-{
- --disable_result_log
- eval execute stmt$num;
- --enable_result_log
- dec $num;
-}
-call p_verify_reprepare_count(0);
-alter table t1 drop column b;
---disable_abort_on_error
-let $num= $ps_stmt_count;
-while ($num)
-{
- eval execute stmt$num;
- # A reprepare is needed, because layout change of t1 affects statement.
- call p_verify_reprepare_count(1);
- dec $num;
-}
-let $num= $ps_stmt_count;
-while ($num)
-{
- eval execute stmt$num;
- call p_verify_reprepare_count(1);
- dec $num;
-}
---echo # Why does the INSERT ... SELECT does not get a reprepare or is
---echo # only the counter not incremented?
-eval execute stmt8;
-call p_verify_reprepare_count(1);
---enable_abort_on_error
-alter table t2 add column c int;
---error ER_WRONG_VALUE_COUNT_ON_ROW
-eval execute stmt8;
-call p_verify_reprepare_count(1);
-let $num= $ps_stmt_count;
-while ($num)
-{
- eval deallocate prepare stmt$num;
- dec $num;
-}
-drop table t1;
-drop table t2;
-
-
---echo # select AVG(<col>) + optimizer uses index meets loss of the index
-create table t1 (a int, b int, primary key(b),unique index t1_unq_idx(a));
-# We need an index which is not converted to PRIMARY KEY (becomes in
-# case of InnoDB the key used for table clustering).
-insert into t1 set a = 0, b = 0;
-insert into t1 select a + 1, b + 1 from t1;
-insert into t1 select a + 2, b + 2 from t1;
-insert into t1 select a + 4, b + 4 from t1;
-insert into t1 select a + 8, b + 8 from t1;
-# "using index" optimizer strategy is intended
-let $possible_keys=
- query_get_value(explain select avg(a) from t1, possible_keys, 1);
-let $extra=
- query_get_value(explain select avg(a) from t1, Extra, 1);
---echo # Optimizer strategy: Possible keys = $possible_keys , Extra = $extra
-prepare stmt from "select avg(a) from t1";
-execute stmt;
-call p_verify_reprepare_count(0);
-execute stmt;
-call p_verify_reprepare_count(0);
-
-alter table t1 drop index t1_unq_idx;
-let $possible_keys=
- query_get_value(explain select avg(a) from t1, possible_keys, 1);
-let $extra=
- query_get_value(explain select avg(a) from t1, Extra, 1);
---echo # Optimizer strategy: Possible keys = $possible_keys , Extra = $extra
-execute stmt;
-call p_verify_reprepare_count(1);
-execute stmt;
-call p_verify_reprepare_count(0);
-
-
---echo # select AVG(<col>) + optimizer uses table scan meets a new index
-alter table t1 add unique index t1_unq_idx(a);
-let $possible_keys=
- query_get_value(explain select avg(a) from t1, possible_keys, 1);
-let $extra=
- query_get_value(explain select avg(a) from t1, Extra, 1);
---echo # Optimizer strategy: Possible keys = $possible_keys , Extra = $extra
-execute stmt;
-call p_verify_reprepare_count(1);
-execute stmt;
-call p_verify_reprepare_count(0);
-
-deallocate prepare stmt;
-drop table t1;
-
-
---echo # table replaced by not updatable view - Insert
-create table t1 (a int);
-prepare stmt from "insert into t1 values(1)";
-execute stmt;
-call p_verify_reprepare_count(0);
-
-drop table t1;
-create view t1 as select 1;
---error ER_NON_INSERTABLE_TABLE
-execute stmt;
-call p_verify_reprepare_count(1);
-
-drop view t1;
-create table t2 (a int);
-create view t1 as select * from t2 with check option;
-execute stmt;
-call p_verify_reprepare_count(1);
-execute stmt;
-call p_verify_reprepare_count(0);
-select * from t1;
-
-deallocate prepare stmt;
-drop view t1;
-drop table t2;
-
-
---echo =====================================================================
---echo Some freestyle tests
---echo =====================================================================
-
-create temporary table t1 as select 1 as a;
-delimiter |;
-create procedure p1()
-begin
- drop temporary table t1;
-end|
-create function f1() returns int
-begin
- call p1();
- return 1;
-end|
-delimiter ;|
-
-prepare stmt from "select f1() as my_column, a from t1";
---error ER_CANT_REOPEN_TABLE
-execute stmt;
-call p_verify_reprepare_count(0);
-select * from t1;
-
-prepare stmt from "select a, f1() as my_column from t1";
---error ER_CANT_REOPEN_TABLE
-execute stmt;
-call p_verify_reprepare_count(0);
-select * from t1;
-
-prepare stmt from "select f1() as my_column, count(*) from t1";
---error ER_CANT_REOPEN_TABLE
-execute stmt;
-call p_verify_reprepare_count(0);
-select * from t1;
-
-prepare stmt from "select count(*), f1() as my_column from t1";
---error ER_CANT_REOPEN_TABLE
-execute stmt;
-call p_verify_reprepare_count(0);
-select * from t1;
-
-
---echo # Execute fails, no drop of temporary table
-prepare stmt from "select 1 as my_column from (select 1) as t2
- where exists (select f1() from t1)";
-execute stmt;
-call p_verify_reprepare_count(0);
-execute stmt;
-call p_verify_reprepare_count(0);
-select * from t1;
-
---echo # Execute drops temporary table
-prepare stmt from "select f1()";
-execute stmt;
-call p_verify_reprepare_count(0);
---error ER_BAD_TABLE_ERROR
-execute stmt;
-call p_verify_reprepare_count(0);
-
-drop function f1;
-drop procedure p1;
-deallocate prepare stmt;
-
---echo # Execute fails, temporary table is not replaced by another
-create temporary table t1 as select 1 as a;
-delimiter |;
-create procedure p1()
-begin
- drop temporary table t1;
- create temporary table t1 as select 'abc' as a;
-end|
-create function f1() returns int
-begin
- call p1();
- return 1;
-end|
-delimiter ;|
-prepare stmt from "select count(*), f1() as my_column from t1";
---error ER_CANT_REOPEN_TABLE
-execute stmt;
-call p_verify_reprepare_count(0);
-select * from t1;
-deallocate prepare stmt;
-
-prepare stmt from "call p1";
-execute stmt;
-drop procedure p1;
-create schema mysqltest;
-delimiter |;
-create procedure mysqltest.p1()
-begin
- drop schema mysqltest;
- create schema mysqltest;
-end|
-delimiter ;|
---error ER_SP_DOES_NOT_EXIST
-execute stmt;
-call p_verify_reprepare_count(0);
---error ER_SP_DOES_NOT_EXIST
-execute stmt;
-call p_verify_reprepare_count(0);
-deallocate prepare stmt;
-drop schema mysqltest;
-drop temporary table t1;
-
-
-# Bug#36089 drop temp table in SP called by function, crash
-# Note: A non prepared "select 1 from t1 having count(*) = f1();" is sufficient.
-if (0)
-{
-create temporary table t1 as select 1 as a;
-prepare stmt from "select 1 from t1 having count(*) = f1()";
-execute stmt;
-call p_verify_reprepare_count(0);
-deallocate prepare stmt;
-drop temporary table t1;
-}
-
-
---echo # Cleanup
---echo #
---disable_warnings
-drop temporary table if exists t1;
-drop table if exists t1, t2;
-drop procedure if exists p_verify_reprepare_count;
-drop procedure if exists p1;
-drop function if exists f1;
-drop view if exists t1;
-drop schema if exists mysqltest;
---enable_warnings
diff --git a/mysql-test/t/ps_grant.test b/mysql-test/t/ps_grant.test
deleted file mode 100644
index 3d59cc36de0..00000000000
--- a/mysql-test/t/ps_grant.test
+++ /dev/null
@@ -1,127 +0,0 @@
-# Can't test grants with embedded server
--- source include/not_embedded.inc
-
-let $type= 'MYISAM' ;
-
-################ GRANT/REVOKE/DROP affecting a parallel session ################
---disable_query_log
-select '------ grant/revoke/drop affects a parallel session test ------'
- as test_sequence ;
---enable_query_log
-
-#---------------------------------------------------------------------#
-# Here we test that:
-# 1. A new GRANT will be visible within another sessions. #
-# #
-# Let's assume there is a parallel session with an already prepared #
-# statement for a table. #
-# A DROP TABLE will affect the EXECUTE properties. #
-# A REVOKE will affect the EXECUTE properties. #
-#---------------------------------------------------------------------#
-
-# Who am I ?
-# this is different across different systems:
-# select current_user(), user() ;
-
-#### create a new user account ####
-## There should be no grants for that non existing user
---error 1141
-show grants for second_user@localhost ;
-## create a new user account by using GRANT statements on t9
-create database mysqltest;
-# create the tables (t1 and t9) used in many tests
-use mysqltest;
---disable_query_log
---source include/ps_create.inc
---source include/ps_renew.inc
---enable_query_log
-use test;
-grant usage on mysqltest.* to second_user@localhost
-identified by 'looser' ;
-grant select on mysqltest.t9 to second_user@localhost
-identified by 'looser' ;
-show grants for second_user@localhost ;
-
-
-#### establish a second session to the new user account
-connect (con3,localhost,second_user,looser,mysqltest);
-## switch to the second session
-connection con3;
-# Who am I ?
-select current_user();
-## check the access rights
-show grants for current_user();
-prepare s_t9 from 'select c1 as my_col
- from t9 where c1= 1' ;
-execute s_t9 ;
-# check that we cannot do a SELECT on the table t1;
---error 1142
-select a as my_col from t1;
-
-
-#### give access rights to t1 and drop table t9
-## switch back to the first session
-connection default;
-grant select on mysqltest.t1 to second_user@localhost
-identified by 'looser' ;
-show grants for second_user@localhost ;
-drop table mysqltest.t9 ;
-show grants for second_user@localhost ;
-
-
-#### check the access as new user
-## switch to the second session
-connection con3;
-######## Question 1: The table t1 should be now accessible. ########
-show grants for second_user@localhost ;
-prepare s_t1 from 'select a as my_col from t1' ;
-execute s_t1 ;
-######## Question 2: The table t9 does not exist. ########
---error 1146
-execute s_t9 ;
-deallocate prepare s_t9;
-
-
-#### revoke the access rights to t1
-## switch back to the first session
-connection default;
-revoke all privileges on mysqltest.t1 from second_user@localhost;
-show grants for second_user@localhost ;
-
-#### check the access as new user
-## switch to the second session
-connection con3;
-show grants for second_user@localhost ;
-######## Question 2: The table t1 should be now not accessible. ########
---error 1142
-execute s_t1 ;
-
-## cleanup
-## switch back to the first session
-connection default;
-## disconnect the second session
-disconnect con3 ;
-## remove all rights of second_user@localhost
-revoke all privileges, grant option from second_user@localhost ;
-show grants for second_user@localhost ;
-drop user second_user@localhost ;
-commit ;
---error 1141
-show grants for second_user@localhost ;
-
-drop database mysqltest;
-
-# End of 4.1 tests
-
-#
-# grant/revoke + drop user
-#
-prepare stmt3 from ' grant all on test.t1 to drop_user@localhost
-identified by ''looser'' ';
-grant all on test.t1 to drop_user@localhost
-identified by 'looser' ;
-prepare stmt3 from ' revoke all privileges on test.t1 from
-drop_user@localhost ';
-revoke all privileges on test.t1 from drop_user@localhost ;
-prepare stmt3 from ' drop user drop_user@localhost ';
-drop user drop_user@localhost;
diff --git a/mysql-test/t/ps_max_subselect-5113.test b/mysql-test/t/ps_max_subselect-5113.test
deleted file mode 100644
index 255e81c1549..00000000000
--- a/mysql-test/t/ps_max_subselect-5113.test
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# MDEV-5113 Wrong result (extra row) and valgrind warnings in Item_maxmin_subselect::any_value on 2nd execution of PS with SELECT subquery
-#
-
-CREATE TABLE t1 (b INT NOT NULL);
-INSERT INTO t1 VALUES (0),(8);
-
-PREPARE stmt FROM '
- SELECT 1 FROM t1 AS o
- WHERE o.b >= ALL (
- SELECT a2.b FROM t1 AS a1 LEFT JOIN t1 AS a2 ON ( a2.b = a1.b )
- WHERE a1.b <= a2.b
- )
-';
-
-EXECUTE stmt;
-EXECUTE stmt;
-
-DROP TABLE t1;
-
diff --git a/mysql-test/t/ps_not_windows.test b/mysql-test/t/ps_not_windows.test
deleted file mode 100644
index 2003251dc55..00000000000
--- a/mysql-test/t/ps_not_windows.test
+++ /dev/null
@@ -1,29 +0,0 @@
-# doesn't work with embedded server
---source include/not_embedded.inc
-# Non-windows specific ps tests.
---source include/not_windows.inc
-# requires dynamic loading
-if (`SELECT @@have_dynamic_loading != 'YES'`) {
- --skip ps_not_windows requires dynamic loading
-}
-
-#
-# Bug #20665: All commands supported in Stored Procedures should work in
-# Prepared Statements
-#
-
-create procedure proc_1() install plugin my_plug soname '/root/some_plugin.so';
---error ER_UDF_NO_PATHS
-call proc_1();
---error ER_UDF_NO_PATHS
-call proc_1();
---error ER_UDF_NO_PATHS
-call proc_1();
-drop procedure proc_1;
-
-prepare abc from "install plugin my_plug soname '/root/some_plugin.so'";
---error ER_UDF_NO_PATHS
-execute abc;
---error ER_UDF_NO_PATHS
-execute abc;
-deallocate prepare abc;
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
deleted file mode 100644
index 1b1e24bc6f4..00000000000
--- a/mysql-test/t/query_cache.test
+++ /dev/null
@@ -1,1788 +0,0 @@
--- source include/have_query_cache.inc
--- source include/long_test.inc
-
-#
-# Tests with query cache
-#
-SET GLOBAL query_cache_type= Off;
-SET LOCAL query_cache_type= Off;
-SET LOCAL query_cache_type= 0;
---error ER_QUERY_CACHE_IS_GLOBALY_DISABLED
-SET LOCAL query_cache_type= on;
---error ER_QUERY_CACHE_IS_GLOBALY_DISABLED
-SET LOCAL query_cache_type= 1;
-set GLOBAL query_cache_size=1355776;
-SET GLOBAL query_cache_type= ON;
-SET LOCAL query_cache_type= ON;
-
-# Reset query cache variables.
-
-flush query cache; # This crashed in some versions
-flush query cache; # This crashed in some versions
-reset query cache;
-flush status;
---disable_warnings
-drop table if exists t1,t2,t3,t4,t11,t21,t1_1,t1_2,t9,t9_1,t9_2;
-drop database if exists mysqltest;
-
-# Fix possible left overs from other tests
-drop table if exists ```a`;
-drop view if exists v1;
---enable_warnings
-
-#
-# First simple test
-#
-
-create table t1 (a int not null);
-insert into t1 values (1),(2),(3);
-select * from t1;
-select * from t1;
-select sql_no_cache * from t1;
-select length(now()) from t1;
-
-# Only check the variables that are independent of the machine and startup
-# options
-
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-
-drop table t1;
-
-show status like "Qcache_queries_in_cache";
-
-#
-# MERGE TABLES with INSERT/UPDATE and DELETE
-#
-create table t1 (a int not null) ENGINE=MyISAM;
-insert into t1 values (1),(2),(3);
-create table t2 (a int not null) ENGINE=MyISAM;
-insert into t2 values (4),(5),(6);
-create table t3 (a int not null) engine=MERGE UNION=(t1,t2) INSERT_METHOD=FIRST;
-# insert
-select * from t3;
-select * from t3;
-show status like "Qcache_hits";
-show status like "Qcache_queries_in_cache";
-insert into t2 values (7);
-show status like "Qcache_queries_in_cache";
-select * from t1;
-select * from t1;
-show status like "Qcache_hits";
-show status like "Qcache_queries_in_cache";
-insert into t3 values (8);
-show status like "Qcache_queries_in_cache";
-# update
-select * from t3;
-show status like "Qcache_queries_in_cache";
-update t2 set a=9 where a=7;
-show status like "Qcache_queries_in_cache";
-select * from t1;
-show status like "Qcache_queries_in_cache";
-update t3 set a=10 where a=1;
-show status like "Qcache_queries_in_cache";
-#delete
-select * from t3;
-show status like "Qcache_queries_in_cache";
-delete from t2 where a=9;
-show status like "Qcache_queries_in_cache";
-select * from t1;
-show status like "Qcache_queries_in_cache";
-delete from t3 where a=10;
-show status like "Qcache_queries_in_cache";
-drop table t1, t2, t3;
-#
-# SELECT SQL_CACHE ...
-#
-set query_cache_type=demand;
-create table t1 (a int not null);
-insert into t1 values (1),(2),(3);
-select * from t1;
-show status like "Qcache_queries_in_cache";
-select sql_cache * from t1 union select * from t1;
-set query_cache_type=2;
-select sql_cache * from t1 union select * from t1;
-
-show status like "Qcache_hits";
-show status like "Qcache_queries_in_cache";
-set query_cache_type=on;
-#
-# RESET QUERY CACHE
-#
-reset query cache;
-show status like "Qcache_queries_in_cache";
-#
-# SELECT SQL_NO_CACHE
-#
-select sql_no_cache * from t1;
-show status like "Qcache_queries_in_cache";
-drop table t1;
-#
-# Check that queries that uses NOW(), LAST_INSERT_ID()... are not cached.
-#
-create table t1 (a text not null);
-select CONNECTION_ID() from t1;
-#GET_LOCK
-#RELEASE_LOCK
-#LOAD_FILE
-select FOUND_ROWS();
-select NOW() from t1;
-select CURDATE() from t1;
-select CURTIME() from t1;
-select DATABASE() from t1;
-select ENCRYPT("test") from t1;
-select LAST_INSERT_ID() from t1;
-select RAND() from t1;
-select UNIX_TIMESTAMP() from t1;
-select USER() from t1;
-select CURRENT_USER() from t1;
-select benchmark(1,1) from t1;
-explain extended select benchmark(1,1) from t1;
-show status like "Qcache_queries_in_cache";
-#
-# Tests when the cache is filled
-#
-create table t2 (a text not null);
-insert into t1 values("1111111111111111111111111111111111111111111111111111");
-insert into t2 select * from t1;
-insert into t1 select * from t2; # 2
-insert into t2 select * from t1; # 3
-insert into t1 select * from t2; # 5
-insert into t2 select * from t1; # 8
-insert into t1 select * from t2; # 13
-insert into t2 select * from t1; # 21
-insert into t1 select * from t2; # 34
-insert into t2 select * from t1; # 55
-insert into t1 select * from t2; # 89
-insert into t2 select * from t1; # 144
-insert into t1 select * from t2; # 233
-insert into t2 select * from t1; # 357
-insert into t1 select * from t2; # 610
-insert into t2 select * from t1; # 987
-insert into t1 select * from t2; # 1597
-insert into t2 select * from t1; # 2584
-insert into t1 select * from t2; # 4181
-
-show status like "Qcache_hits";
-show status like "Qcache_lowmem_prunes";
-disable_result_log;
-select a as a1, a as a2 from t1;
-select a as a2, a as a3 from t1;
-select a as a3, a as a4 from t1;
-# next query must be out of 1Mb cache
-select a as a1, a as a2 from t1;
-enable_result_log;
-show status like "Qcache_hits";
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_lowmem_prunes";
-reset query cache;
-#
-# Query bigger then query_cache_limit
-#
-insert into t2 select * from t1;
-insert into t1 select * from t2;
-insert into t2 select * from t1;
-insert into t1 select * from t2;
-insert into t2 select * from t1;
-insert into t1 select * from t2;
-insert into t2 select * from t1;
-insert into t1 select * from t2;
-insert into t2 select * from t1;
-insert into t1 select * from t2;
-disable_result_log;
-select * from t1;
-enable_result_log;
-show status like "Qcache_queries_in_cache";
-drop table t1,t2;
-
-#
-# noncachable ODBC work around (and prepare cache for drop database)
-#
-create database mysqltest;
-create table mysqltest.t1 (i int not null auto_increment, a int, primary key (i));
-insert into mysqltest.t1 (a) values (1);
-select * from mysqltest.t1 where i is null;
-
-#
-# drop db
-#
-create table t1(a int);
-select * from t1;
-show status like "Qcache_queries_in_cache";
-select * from mysqltest.t1;
-show status like "Qcache_queries_in_cache";
-drop database mysqltest;
-show status like "Qcache_queries_in_cache";
-drop table t1;
-
-#
-# Charset conversion (cp1251_koi8 always present)
-#
-create table t1 (a char(1) not null collate koi8r_general_ci);
-insert into t1 values(_koi8r"");
-set CHARACTER SET koi8r;
-select * from t1;
-set CHARACTER SET cp1251_koi8;
-select * from t1;
-set CHARACTER SET DEFAULT;
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_hits";
-drop table t1;
-
-# The following tests can't be done as the values differen on 32 and 64 bit
-# machines :(
-#show variables like "query_cache_size";
-#show status like "Qcache_free_memory";
-
-#
-# same tables in different db
-#
-create database if not exists mysqltest;
-create table mysqltest.t1 (i int not null);
-create table t1 (i int not null);
-insert into mysqltest.t1 (i) values (1);
-insert into t1 (i) values (2);
-
-select * from t1;
-use mysqltest;
-select * from t1;
-select * from t1;
-use test;
-select * from t1;
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_hits";
-
-drop database mysqltest;
-drop table t1;
-
-#
-# FOUND_ROWS()
-#
-
-create table t1 (i int not null);
-insert into t1 (i) values (1),(2),(3),(4);
-
-select SQL_CALC_FOUND_ROWS * from t1 limit 2;
-select FOUND_ROWS();
-show status like "Qcache_hits";
-show status like "Qcache_queries_in_cache";
-
-select * from t1 where i=1;
-select FOUND_ROWS();
-show status like "Qcache_hits";
-show status like "Qcache_queries_in_cache";
-
-select SQL_CALC_FOUND_ROWS * from t1 limit 2;
-select FOUND_ROWS();
-show status like "Qcache_hits";
-show status like "Qcache_queries_in_cache";
-
-select * from t1 where i=1;
-select FOUND_ROWS();
-show status like "Qcache_hits";
-show status like "Qcache_queries_in_cache";
-drop table t1;
-
-#
-# Test insert delayed
-#
-
-flush query cache;
-reset query cache;
-
-create table t1 (a int not null) ENGINE=MyISAM;
-insert into t1 values (1),(2),(3);
-select * from t1;
-select * from t1;
-show status like "Qcache_queries_in_cache";
-insert delayed into t1 values (4);
---sleep 5 # Wait for insert delayed to be executed.
-select a from t1;
-show status like "Qcache_queries_in_cache";
-drop table t1;
-show status like "Qcache_queries_in_cache";
-
-#
-# Test of min result data unit size changing
-#
-show global variables like "query_cache_min_res_unit";
-set GLOBAL query_cache_min_res_unit=1001;
-show global variables like "query_cache_min_res_unit";
-create table t1 (a int not null);
-insert into t1 values (1),(2),(3);
-create table t2 (a int not null);
-insert into t2 values (1),(2),(3);
-select * from t1;
-select * from t1;
-select * from t2;
-select * from t2;
-show status like "Qcache_hits";
-show status like "Qcache_queries_in_cache";
-drop table t1;
-select a from t2;
-select a from t2;
-show status like "Qcache_hits";
-show status like "Qcache_queries_in_cache";
-drop table t2;
-set GLOBAL query_cache_min_res_unit=default;
-show global variables like "query_cache_min_res_unit";
-
-#
-# Case sensitive test
-#
-create table t1 (a int not null);
-insert into t1 values (1);
-select "aaa" from t1;
-select "AAA" from t1;
-drop table t1;
-
-#
-# Test of query cache resizing
-#
-create table t1 (a int);
-set GLOBAL query_cache_size=1000;
-show global variables like "query_cache_size";
-select * from t1;
-set GLOBAL query_cache_size=1024;
-show global variables like "query_cache_size";
-select * from t1;
-set GLOBAL query_cache_size=10240;
-show global variables like "query_cache_size";
-select * from t1;
-set GLOBAL query_cache_size=20480;
-show global variables like "query_cache_size";
-select * from t1;
-set GLOBAL query_cache_size=40960;
-show global variables like "query_cache_size";
-select * from t1;
-set GLOBAL query_cache_size=51200;
-show global variables like "query_cache_size";
-select * from t1;
-set GLOBAL query_cache_size=61440;
-show global variables like "query_cache_size";
-select * from t1;
-set GLOBAL query_cache_size=81920;
-show global variables like "query_cache_size";
-select * from t1;
-set GLOBAL query_cache_size=102400;
-show global variables like "query_cache_size";
-select * from t1;
-drop table t1;
-
-#
-# Temporary tables
-#
-set GLOBAL query_cache_size=1048576;
-create table t1 (i int not null);
-create table t2 (i int not null);
-select * from t1;
-show status like "Qcache_queries_in_cache";
-create temporary table t3 (i int not null);
-select * from t2;
-show status like "Qcache_queries_in_cache";
-select * from t3;
-show status like "Qcache_queries_in_cache";
-update t1 set i=(select distinct 1 from (select * from t2) a);
-drop table t1, t2, t3;
-
-#
-# system databse test
-#
-use mysql;
-disable_result_log;
-select * from db;
-enable_result_log;
-show status like "Qcache_queries_in_cache";
-use test;
-disable_result_log;
-select * from mysql.db;
-enable_result_log;
-show status like "Qcache_queries_in_cache";
-
-#
-# simple rename test
-#
-create table t1(id int auto_increment primary key);
-insert into t1 values (NULL), (NULL), (NULL);
-select * from t1 where id=2;
-alter table t1 rename to t2;
---error ER_NO_SUCH_TABLE
-select * from t1 where id=2;
-drop table t2;
---error ER_NO_SUCH_TABLE
-select * from t1 where id=2;
-
-#
-# Load data invalidation test
-#
-create table t1 (word char(20) not null);
-select * from t1;
-show status like "Qcache_queries_in_cache";
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval load data infile '$MYSQLTEST_VARDIR/std_data/words.dat' into table t1;
-show status like "Qcache_queries_in_cache";
-select count(*) from t1;
-drop table t1;
-
-#
-# INTO OUTFILE/DUMPFILE test
-#
-create table t1 (a int);
-insert into t1 values (1),(2),(3);
-show status like "Qcache_queries_in_cache";
-select * from t1 into outfile "query_cache.out.file";
---error ER_FILE_EXISTS_ERROR
-select * from t1 into outfile "query_cache.out.file";
-select * from t1 limit 1 into dumpfile "query_cache.dump.file";
-show status like "Qcache_queries_in_cache";
-drop table t1;
-let $datadir=`select @@datadir`;
---remove_file $datadir/test/query_cache.dump.file
---remove_file $datadir/test/query_cache.out.file
-
-#
-# test of SQL_SELECT_LIMIT
-#
-create table t1 (a int);
-insert into t1 values (1),(2);
-show status like "Qcache_queries_in_cache";
-select * from t1;
-SET SQL_SELECT_LIMIT=1;
-select * from t1;
-show status like "Qcache_queries_in_cache";
-SET SQL_SELECT_LIMIT=DEFAULT;
-drop table t1;
-
-#
-# query cache crash on using same table twice in one query test
-#
-flush query cache;
-reset query cache;
-flush status;
-set GLOBAL query_cache_size=1048576;
-
-create table t1 (a int not null);
-insert into t1 values (1),(2),(3);
-create table t2 (a text not null);
-create table t3 (a text not null);
-insert into t3 values("1111111111111111111111111111111111111111111111111111");
-insert into t2 select * from t3;
-insert into t3 select * from t2;
-insert into t2 select * from t3;
-insert into t3 select * from t2;
-insert into t2 select * from t3;
-insert into t3 select * from t2;
-insert into t2 select * from t3;
-insert into t3 select * from t2;
-insert into t2 select * from t3;
-insert into t3 select * from t2;
-drop table t2;
-create table t2 (a int not null);
-insert into t2 values (1),(2),(3);
-create table t4 (a int not null);
-insert into t4 values (1),(2),(3);
-
-disable_result_log;
-select * from t4;
-select * from t2;
-select * from t1 as tt, t1 as ttt where tt.a=1 and ttt.a=2;
-select * from t2;
-select * from t4;
-select * from t1 as tt, t1 as ttt where tt.a=1 and ttt.a=2;
-select * from t2;
-select * from t4;
-select * from t1 as tt, t1 as ttt where tt.a=1 and ttt.a=2;
-
-delete from t2 where a=1;
-flush query cache;
-select * from t3;
-enable_result_log;
-delete from t4 where a=1;
-flush query cache;
-drop table t1,t2,t3,t4;
-
-#
-# WRITE LOCK & QC
-#
-set query_cache_wlock_invalidate=1;
-create table t1 (a int not null);
-create table t2 (a int not null);
-create view v1 as select * from t1;
-select * from t1;
-select * from t2;
-show status like "Qcache_queries_in_cache";
-lock table t1 write, t2 read;
-show status like "Qcache_queries_in_cache";
-unlock table;
-select * from t1;
-# Implicit locking of t1 does not invalidate QC
-show status like "Qcache_queries_in_cache";
-lock table v1 write;
-show status like "Qcache_queries_in_cache";
-unlock table;
-drop view v1;
-drop table t1,t2;
-set query_cache_wlock_invalidate=default;
-
-#
-# hiding real table stored in query cache by temporary table
-#
-CREATE TABLE t1 (id INT PRIMARY KEY);
-insert into t1 values (1),(2),(3);
-select * from t1;
-create temporary table t1 (a int not null auto_increment
-primary key);
-select * from t1;
-drop table t1;
-drop table t1;
-
-#
-# Test character set related variables:
-# character_set_result
-# character_set_client
-# charactet_set_connection/collation_connection
-# If at least one of the above variables has changed,
-# the cached query can't be reused. In the below test
-# absolutely the same query is used several times,
-# SELECT should fetch different results for every instance.
-# No hits should be produced.
-# New cache entry should appear for every SELECT.
-#
-SET NAMES koi8r;
-CREATE TABLE t1 (a char(1) character set koi8r);
-INSERT INTO t1 VALUES (_koi8r''),(_koi8r'');
-#
-# Run select
-#
-SELECT a,'',''='' FROM t1;
-show status like "Qcache_hits";
-show status like "Qcache_queries_in_cache";
-#
-# Change collation_connection and run the same query again
-#
-set collation_connection=koi8r_bin;
-SELECT a,'',''='' FROM t1;
-show status like "Qcache_hits";
-show status like "Qcache_queries_in_cache";
-#
-# Now change character_set_client and run the same query again
-#
-set character_set_client=cp1251;
-SELECT a,'',''='' FROM t1;
-show status like "Qcache_hits";
-show status like "Qcache_queries_in_cache";
-#
-# And finally change character_set_results and run the same query again
-#
-set character_set_results=cp1251;
-SELECT a,'',''='' FROM t1;
-show status like "Qcache_hits";
-show status like "Qcache_queries_in_cache";
-SET NAMES default;
-
-DROP TABLE t1;
-
-#
-# DROP current database test
-#
-CREATE TABLE t1 (a int(1));
-CREATE DATABASE mysqltest;
-USE mysqltest;
-DROP DATABASE mysqltest;
-SELECT * FROM test.t1;
-USE test;
-DROP TABLE t1;
-
-#
-# charset with NULL
-#
-set character_set_results=null;
-select @@character_set_results;
-set character_set_results=default;
-#
-# query cache and environment variables
-#
-# max_sort_length
-set GLOBAL query_cache_size=1355776;
-create table t1 (id int auto_increment primary key, c char(25));
-insert into t1 set c = repeat('x',24);
-insert into t1 set c = concat(repeat('x',24),'x');
-insert into t1 set c = concat(repeat('x',24),'w');
-insert into t1 set c = concat(repeat('x',24),'y');
-set max_sort_length=200;
-select c from t1 order by c, id;
-reset query cache;
-set max_sort_length=20;
-select c from t1 order by c, id;
-set max_sort_length=200;
-select c from t1 order by c, id;
-set max_sort_length=default;
-# sql_mode
-select '1' || '3' from t1;
-set SQL_MODE=oracle;
-select '1' || '3' from t1;
-set SQL_MODE=default;
-drop table t1;
-# group_concat_max_len
-create table t1 (a varchar(20), b int);
-insert into t1 values ('12345678901234567890', 1);
-set group_concat_max_len=10;
-select group_concat(a) FROM t1 group by b;
-set group_concat_max_len=1024;
-select group_concat(a) FROM t1 group by b;
-set group_concat_max_len=default;
-drop table t1;
-
-# comments before command
-#
-create table t1 (a int);
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-/**/ select * from t1;
-/**/ select * from t1;
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-
-#
-# Keep things tidy
-#
-DROP TABLE t1;
-SET GLOBAL query_cache_size=0;
-
-#
-# Information schema & query cache test
-#
-SET SESSION query_cache_type = 2;
-create table t1(a int);
-select table_name from information_schema.tables
-where table_schema="test";
-drop table t1;
-select table_name from information_schema.tables
-where table_schema="test";
-# Bug #8480: REPAIR TABLE needs to flush the table from the query cache
-SET SESSION query_cache_type = 1;
-set global query_cache_size=1024*1024;
-flush query cache;
-create table t1 ( a int );
-insert into t1 values (1);
-select a from t1;
-select a from t1;
-show status like 'qcache_queries_in_cache';
-repair table t1;
-show status like 'qcache_queries_in_cache';
-drop table t1;
-
-#
-# Bug #9549: Make sure cached queries that span more than one cache block
-# are handled properly in the embedded server.
-#
-# We just want a small query cache, so we can fragment it easily
-set GLOBAL query_cache_size=64*1024;
-# This actually gives us a usable cache size of about 48K
-
-# Each table is about 14K
-create table t1 (a text);
-insert into t1 values (repeat('abcdefghijklmnopqrstuvwxyz', 550));
-create table t2 (a text);
-insert into t2 values (repeat('ijklmnopqrstuvwxyzabcdefgh', 550));
-
-# Load a query from each table into the query cache
---disable_result_log
-select a from t1; # Q1
-select a from t2; # Q2
---enable_result_log
-show status like 'Qcache_%_blocks';
-
-# Now the cache looks like (14K for Q1)(14K for Q2)(20K free)
-
-# Flush Q1 from the cache by adding an out-of-order chunk to t1
-insert into t1 select reverse(a) from t1;
-show status like 'Qcache_%_blocks';
-
-# Now the cache looks like (14K free)(14K for Q2)(20K free)
-
-# Load our new data into the query cache
---disable_result_log
-select a from t1; # Q3
---enable_result_log
-show status like 'Qcache_%_blocks';
-
-# Now the cache should be like (14K for Q3)(14K for Q2)(14K for Q3)(6K free)
-
-# Note that Q3 is split across two chunks!
-
-# Load Q3 from the cache, and actually pay attention to the results
-select a from t1;
-
-flush query cache;
-
-drop table t1, t2;
-set GLOBAL query_cache_size=1355776;
-
-
-#
-# Query with warning prohibited to query cache (BUG#9414)
-#
-flush status;
-CREATE TABLE t1 (
- `date` datetime NOT NULL default '0000-00-00 00:00:00',
- KEY `date` (`date`)
-) ENGINE=MyISAM;
-
-INSERT INTO t1 VALUES ('20050326');
-INSERT INTO t1 VALUES ('20050325');
-SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050327 invalid';
-SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050328 invalid';
-SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050327 invalid';
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-drop table t1;
-
-#
-# queries with subquery in the FROM clause (BUG#11522)
-#
-create table t1 (a int);
-insert into t1 values (1);
-reset query cache;
-flush status;
-select * from (select * from t1) a;
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-select * from (select * from t1) a;
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-insert into t1 values (2);
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-select * from (select * from t1) a;
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-drop table t1;
-
-#
-# BUG#14652: Queries with leading '(' characters.
-#
-create table t1 (a int);
-flush status;
-(select a from t1) union (select a from t1);
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-(select a from t1) union (select a from t1);
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-
-set query_cache_strip_comments=1;
-(select a from t1) union (select a from t1);
-(select a from t1) /* */union (select a from t1);
-set query_cache_strip_comments=0;
-(select a from t1) union (select a from t1);
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-
-drop table t1;
-
-#
-# SP cursors and selects with query cache (BUG#9715)
-#
-create table t1 (a int);
-insert into t1 values (1),(2);
-
---disable_warnings
-drop procedure if exists p1;
---enable_warnings
-delimiter //;
-CREATE PROCEDURE `p1`()
-begin
-Declare c1 cursor for select a from t1;
-open c1;
-select * from t1;
-end//
-call p1()//
-drop procedure p1;
-
-create function f1() returns int
-begin
-Declare var1 int;
-select max(a) from t1 into var1;
-return var1;
-end//
-create procedure `p1`()
-begin
- select a, f1() from t1;
-end//
-SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
-SET GLOBAL log_bin_trust_function_creators = 1;
-call p1()//
-SET GLOBAL log_bin_trust_function_creators = @old_log_bin_trust_function_creators;
-drop procedure p1//
-drop function f1//
-
-drop table t1//
-delimiter ;//
-
-#
-# query in QC from normal execution and SP (BUG#6897)
-# improved to also test BUG#3583 and BUG#12990
-#
-flush query cache;
-reset query cache;
-flush status;
-delimiter //;
-create table t1 (s1 int)//
-create procedure f1 () begin
-select sql_cache * from t1;
-select sql_cache * from t1;
-select sql_cache * from t1;
-end;//
-create procedure f2 () begin
-select sql_cache * from t1 where s1=1;
-select sql_cache * from t1;
-end;//
-create procedure f3 () begin
-select sql_cache * from t1;
-select sql_cache * from t1 where s1=1;
-end;//
-create procedure f4 () begin
-select sql_cache * from t1;
-select sql_cache * from t1 where s1=1;
-select sql_cache * from t1;
-select sql_cache * from t1 where s1=1;
-select sql_cache * from t1 where s1=1;
-end;//
-delimiter ;//
-call f1();
-call f1();
-call f1();
-select sql_cache * from t1;
-insert into t1 values (1);
-select sql_cache * from t1;
-call f1();
-call f1();
-select sql_cache * from t1;
-flush query cache;
-reset query cache;
-flush status;
-select sql_cache * from t1;
-select sql_cache * from t1 where s1=1;
-call f1();
-call f2();
-call f3();
-call f4();
-call f4();
-call f3();
-call f2();
-select sql_cache * from t1 where s1=1;
-insert into t1 values (2);
-call f1();
-select sql_cache * from t1 where s1=1;
-select sql_cache * from t1;
-call f1();
-call f3();
-call f3();
-call f1();
-
-drop procedure f1;
-drop procedure f2;
-drop procedure f3;
-drop procedure f4;
-drop table t1;
-set GLOBAL query_cache_size=0;
-
---echo End of 4.1 tests
-
-#
-# Bug #10303: problem with last_query_cost
-#
-
-SET GLOBAL query_cache_size=102400;
-create table t1(a int);
-insert into t1 values(0), (1), (4), (5);
-select * from t1 where a > 3;
-select * from t1 where a > 3;
-show status like 'last_query_cost';
-drop table t1;
-SET GLOBAL query_cache_size=0;
-
-#
-# Bug #20045: Server crash on INSERT ... SELECT ... FROM non-mergeable view
-#
-set global query_cache_size=1024*1024;
-flush status;
-create table t1 (a int);
-insert into t1 (a) values (1), (2), (3);
-select * from t1;
-show status like 'Qcache_hits';
-select * from t1;
-show status like 'Qcache_hits';
-create table t2 like t1;
-select * from t1;
-show status like 'Qcache_hits';
-insert into t2 select * from t1;
-select * from t1;
-show status like 'Qcache_hits';
-drop table t1, t2;
-
-create table t1(c1 int);
-create table t2(c1 int);
-create table t3(c1 int);
-create view v1 as select t3.c1 as c1 from t3,t2 where t3.c1 = t2.c1;
-start transaction;
-insert into t1(c1) select c1 from v1;
-drop table t1, t2, t3;
-drop view v1;
-
-
-#
-# If running with --ps-protocol:
-# see if a query from the text protocol is served with results cached
-# from a query which used the binary (which would be wrong, results
-# are in different formats); if that happens, the results will
-# be incorrect and the test will fail.
-#
-
-create table t1(c1 int);
-insert into t1 values(1),(10),(100);
-select * from t1;
--- disable_ps_protocol
-select * from t1;
-select * from t1;
--- enable_ps_protocol
-select * from t1;
-drop table t1;
-
-set global query_cache_size=0;
-
-#
-# Query cache and changes to system variables
-#
-
-create table t1 (a int);
-insert into t1 values (1),(2),(3);
-set GLOBAL query_cache_type=1;
-set GLOBAL query_cache_limit=10240;
-set GLOBAL query_cache_min_res_unit=0;
-set GLOBAL query_cache_size= 102400;
-
-# default_week_format
-reset query cache;
-set LOCAL default_week_format = 0;
-select week('2007-01-04');
-select week('2007-01-04') from t1;
-select extract(WEEK FROM '2007-01-04') from t1;
-
-set LOCAL default_week_format = 2;
-select week('2007-01-04');
-select week('2007-01-04') from t1;
-select extract(WEEK FROM '2007-01-04') from t1;
-
-# div_precision_increment
-reset query cache;
-set LOCAL div_precision_increment=2;
-select 1/7;
-select 1/7 from t1;
-
-set LOCAL div_precision_increment=4;
-select 1/7;
-select 1/7 from t1;
-
-drop table t1;
-
-CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b));
-INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),
- ('Full-text indexes', 'are called collections'),
- ('Only MyISAM tables','support collections'),
- ('Function MATCH ... AGAINST()','is used to do a search'),
- ('Full-text search in MySQL', 'implements vector space model');
-
-
-set GLOBAL ft_boolean_syntax='+ -><()~*:""&|';
-
-select *, MATCH(a,b) AGAINST("+called +collections" IN BOOLEAN MODE) as x from t1;
-
-# swap +/-
-set GLOBAL ft_boolean_syntax='- +><()~*:""&|';
-
-select *, MATCH(a,b) AGAINST("+called +collections" IN BOOLEAN MODE) as x from t1;
-
-# If in the future we need to cache queries with functions
-# be sure not to cause dead lock if the query cache is flushed
-# while inserting a query in the query cache.
-delimiter |;
-create function change_global() returns integer deterministic
-begin
- set global ft_boolean_syntax='+ -><()~*:""&|';
- return 1;
-end|
-delimiter ;|
-select *, change_global() from t1;
-drop function change_global;
-
-drop table t1;
-
-set GLOBAL query_cache_type=default;
-set GLOBAL query_cache_limit=default;
-set GLOBAL query_cache_min_res_unit=default;
-set GLOBAL query_cache_size= default;
-
-
-#
-# Bug#28897 UUID() returns non-unique values when query cache is enabled
-#
-
-set GLOBAL query_cache_size=1024000;
-
-create table t1 (a char);
-insert into t1 values ('c');
-
-let $q1= `select UUID(), a from t1`;
-let $q2= `select UUID(), a from t1`;
-
-# disabling the logging of the query because the UUIDs are different each run.
---disable_query_log
-eval select a from t1 where "$q1" = "$q2";
---enable_query_log
-
-drop table t1;
-
-set GLOBAL query_cache_size= default;
-
-#
-# Bug #29053 SQL_CACHE in UNION causes non-deterministic functions to be cached
-#
-
-# This syntax is no longer allowed, therefore the test case has been commented
-# out.
-# See test for Bug#35020 below.
-#set GLOBAL query_cache_size=1000000;
-#
-#create table t1 (a char);
-#insert into t1 values ('c');
-#
-#let $q1= `select RAND() from t1 union select sql_cache 1 from t1;`;
-#let $q2= `select RAND() from t1 union select sql_cache 1 from t1;`;
-#
-# disabling the logging of the query because the times are different each run.
-#--disable_query_log
-#eval select a from t1 where "$q1" = "$q2";
-#--enable_query_log
-#
-#drop table t1;
-#
-#set GLOBAL query_cache_size= default;
-
-#
-# Bug#29856: Insufficient buffer space led to a server crash.
-#
-SET GLOBAL query_cache_size=64*1024*1024;
-CREATE TABLE t1 (id INT);
-DELIMITER |;
-CREATE PROCEDURE proc29856(IN theUPC TEXT)
-BEGIN
- SET @stmtStr := '';
- SELECT CONCAT("SELECT id FROM t1 WHERE id IN (",theUPC,")") INTO @stmtStr;
- PREPARE stmt FROM @stmtStr;
- EXECUTE stmt;
-END |
-DELIMITER ;|
-CALL proc29856('1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,
-25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,
-51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,
-77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,
-102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,
-121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,
-140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,
-159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,
-178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,
-197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,
-216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,
-235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,
-254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,
-273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,
-292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,
-311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,
-330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,
-349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,
-368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,
-387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,
-406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,
-425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,
-444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,
-463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,
-482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,
-501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,
-520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,
-539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,
-558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,
-577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,
-596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,
-615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,
-634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,
-653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,
-672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,
-691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,
-710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,
-729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,
-748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,
-767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,
-786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,
-805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,
-824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,
-843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,
-862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,
-881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,
-900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,
-919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,
-938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,
-957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,
-976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,
-995,996,997,998,999,1000,1001,1002,1003,1004,1005,1006,1007,1008,1009,1010,
-1011,1012,1013,1014,1015,1016,1017,1018,1019,1020,1021,1022,1023,1024,1025,
-1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,1037,1038,1039,1040,
-1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,
-1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,
-1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,
-1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,
-1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,
-1116,1117,1118,1119,1120,1121,1122,1123,1124,1125,1126,1127,1128,1129,1130,
-1131,1132,1133,1134,1135,1136,1137,1138,1139,1140,1141,1142,1143,1144,1145,
-1146,1147,1148,1149,1150,1151,1152,1153,1154,1155,1156,1157,1158,1159,1160,
-1161,1162,1163,1164,1165,1166,1167,1168,1169,1170,1171,1172,1173,1174,1175,
-1176,1177,1178,1179,1180,1181,1182,1183,1184,1185,1186,1187,1188,1189,1190,
-1191,1192,1193,1194,1195,1196,1197,1198,1199,1200,1201,1202,1203,1204,1205,
-1206,1207,1208,1209,1210,1211,1212,1213,1214,1215,1216,1217,1218,1219,1220,
-1221,1222,1223,1224,1225,1226,1227,1228,1229,1230,1231,1232,1233,1234,1235,
-1236,1237,1238,1239,1240,1241,1242,1243,1244,1245,1246,1247,1248,1249,1250,
-1251,1252,1253,1254,1255,1256,1257,1258,1259,1260,1261,1262,1263,1264,1265,
-1266,1267,1268,1269,1270,1271,1272,1273,1274,1275,1276,1277,1278,1279,1280,
-1281,1282,1283,1284,1285,1286,1287,1288,1289,1290,1291,1292,1293,1294,1295,
-1296,1297,1298,1299,1300,1301,1302,1303,1304,1305,1306,1307,1308,1309,1310,
-1311,1312,1313,1314,1315,1316,1317,1318,1319,1320,1321,1322,1323,1324,1325,
-1326,1327,1328,1329,1330,1331,1332,1333,1334,1335,1336,1337,1338,1339,1340,
-1341,1342,1343,1344,1345,1346,1347,1348,1349,1350,1351,1352,1353,1354,1355,
-1356,1357,1358,1359,1360,1361,1362,1363,1364,1365,1366,1367,1368,1369,1370,
-1371,1372,1373,1374,1375,1376,1377,1378,1379,1380,1381,1382,1383,1384,1385,
-1386,1387,1388,1389,1390,1391,1392,1393,1394,1395,1396,1397,1398,1399,1400,
-1401,1402,1403,1404,1405,1406,1407,1408,1409,1410,1411,1412,1413,1414,1415,
-1416,1417,1418,1419,1420,1421,1422,1423,1424,1425,1426,1427,1428,1429,1430,
-1431,1432,1433,1434,1435,1436,1437,1438,1439,1440,1441,1442,1443,1444,1445,
-1446,1447,1448,1449,1450,1451,1452,1453,1454,1455,1456,1457,1458,1459,1460,
-1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,
-1476,1477,1478,1479,1480,1481,1482,1483,1484,1485,1486,1487,1488,1489,1490,
-1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,
-1506,1507,1508,1509,1510,1511,1512,1513,1514,1515,1516,1517,1518,1519,1520,
-1521,1522,1523,1524,1525,1526,1527,1528,1529,1530,1531,1532,1533,1534,1535,
-1536,1537,1538,1539,1540,1541,1542,1543,1544,1545,1546,1547,1548,1549,1550,
-1551,1552,1553,1554,1555,1556,1557,1558,1559,1560,1561,1562,1563,1564,1565,
-1566,1567,1568,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,
-1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,1591,1592,1593,1594,1595,
-1596,1597,1598,1599,1600,1601,1602,1603,1604,1605,1606,1607,1608,1609,1610,
-1611,1612,1613,1614,1615,1616,1617,1618,1619,1620,1621,1622,1623,1624,1625,
-1626,1627,1628,1629,1630,1631,1632,1633,1634,1635,1636,1637,1638,1639,1640,
-1641,1642,1643,1644,1645,1646,1647,1648,1649,1650,1651,1652,1653,1654,1655,
-1656,1657,1658,1659,1660,1661,1662,1663,1664,1665,1666,1667,1668,1669,1670,
-1671,1672,1673,1674,1675,1676,1677,1678,1679,1680,1681,1682,1683,1684,1685,
-1686,1687,1688,1689,1690,1691,1692,1693,1694,1695,1696,1697,1698,1699,1700,
-1701,1702,1703,1704,1705,1706,1707,1708,1709,1710,1711,1712,1713,1714,1715,
-1716,1717,1718,1719,1720,1721,1722,1723,1724,1725,1726,1727,1728,1729,1730,
-1731,1732,1733,1734,1735,1736,1737,1738,1739,1740,1741,1742,1743,1744,1745,
-1746,1747,1748,1749,1750,1751,1752,1753,1754,1755,1756,1757,1758,1759,1760,
-1761,1762,1763,1764,1765,1766,1767,1768,1769,1770,1771,1772,1773,1774,1775,
-1776,1777,1778,1779,1780,1781,1782,1783,1784,1785,1786,1787,1788,1789,1790,
-1791,1792,1793,1794,1795,1796,1797,1798,1799,1800,1801,1802,1803,1804,1805,
-1806,1807,1808,1809,1810,1811');
-DROP PROCEDURE proc29856;
-DROP TABLE t1;
-SET GLOBAL query_cache_size= default;
-
-#
---echo #
---echo # Bug#25132 disabled query cache: Qcache_free_blocks = 1
---echo #
-set global query_cache_size=102400;
-set global query_cache_size=0;
-set global query_cache_type=0;
-show status like 'Qcache_free_blocks';
-set global query_cache_size=102400;
-show status like 'Qcache_free_blocks';
-set global query_cache_type=on;
-set session query_cache_type=on;
-
---echo Restore default values.
- --disable_warnings
- drop database if exists db1;
- drop database if exists db2;
- --enable_warnings
- set GLOBAL query_cache_size=15*1024*1024;
- create database db1;
- use db1;
- create table t1(c1 int)engine=myisam;
- insert into t1(c1) values (1);
- select * from db1.t1 f;
- show status like 'Qcache_queries_in_cache';
-
- create database db2;
- rename table db1.t1 to db2.t2;
- drop database db1;
- show status like 'Qcache_queries_in_cache';
- drop database db2;
- set global query_cache_size=default;
-
- --disable_warnings
- drop database if exists db1;
- drop database if exists db3;
- --enable_warnings
- set GLOBAL query_cache_size=15*1024*1024;
- create database db1;
- create database db3;
- use db1;
- create table t1(c1 int) engine=myisam;
- use db3;
- create table t1(c1 int) engine=myisam;
- use db1;
- insert into t1(c1) values (1);
- use test;
- select * from db1.t1;
- select c1+1 from db1.t1;
- select * from db3.t1;
- show status like 'Qcache_queries_in_cache';
- create database db2;
- rename table db1.t1 to db2.t2;
- drop database db1;
- show status like 'Qcache_queries_in_cache';
- drop database db2;
- drop database db3;
-
-set GLOBAL query_cache_type=default;
-set GLOBAL query_cache_limit=default;
-set GLOBAL query_cache_min_res_unit=default;
-set GLOBAL query_cache_size=default;
-set local query_cache_type=default;
-set GLOBAL query_cache_type=on;
-set local query_cache_type=on;
-
-#
-# Bug#33756 - query cache with concurrent_insert=0 appears broken
-#
-FLUSH STATUS;
-SET GLOBAL query_cache_size=10*1024*1024;
-SET @save_concurrent_insert= @@concurrent_insert;
-SET GLOBAL concurrent_insert= 0;
-CREATE TABLE t1 (c1 INT NOT NULL) ENGINE=MyISAM;
-INSERT INTO t1 (c1) VALUES (1), (2);
-#
-SHOW GLOBAL VARIABLES LIKE 'concurrent_insert';
-SHOW STATUS LIKE 'Qcache_hits';
-SELECT * FROM t1;
-SELECT * FROM t1;
-SHOW STATUS LIKE 'Qcache_hits';
-DROP TABLE t1;
-SET GLOBAL concurrent_insert= @save_concurrent_insert;
-SET GLOBAL query_cache_size= default;
-
-#
-# Bug#36326: nested transaction and select
-#
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-FLUSH STATUS;
-SET GLOBAL query_cache_size=1048576;
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
-SHOW STATUS LIKE 'Qcache_queries_in_cache';
-SELECT * FROM t1;
-BEGIN;
-SELECT * FROM t1;
-COMMIT;
-SHOW STATUS LIKE 'Qcache_queries_in_cache';
-SHOW STATUS LIKE "Qcache_hits";
-SELECT * FROM t1;
-BEGIN;
-SELECT * FROM t1;
-COMMIT;
-SHOW STATUS LIKE "Qcache_hits";
-DROP TABLE t1;
-SET GLOBAL query_cache_size= default;
-
-#
-# Bug#6760: Add SLEEP() function (feature request)
-#
-# Logics of original test:
-# Reveal that a query with SLEEP does not need less time than estimated.
-#
-# Bug#12689: SLEEP() gets incorrectly cached/optimized-away
-#
-# Description from bug report (slightly modified)
-#
-# Bug 1 (happened all time):
-# SELECT * FROM t1 WHERE SLEEP(1) will only result in a sleep of 1
-# second, regardless of the number of rows in t1.
-# Bug 2 (happened all time):
-# Such a query will also get cached by the query cache, but should not.
-#
-# Notes (mleich, 2008-05)
-# =======================
-#
-# Experiments around
-# Bug#36345 Test 'func_misc' fails on RHAS3 x86_64
-# showed that the tests for both bugs could produce in case of parallel
-# artificial system time (like via ntpd)
-# - decreases false alarm
-# - increases false success
-#
-# We try here to circumvent these issues by reimplementation of the tests
-# and sophisticated scripting, although the cause of the problems is a massive
-# error within the setup of the testing environment.
-# Tests relying on or checking derivates of the system time must never meet
-# parallel manipulations of system time.
-#
-# Results of experiments with/without manipulation of system time,
-# information_schema.processlist content, high load on testing box
-# ----------------------------------------------------------------
-# Definition: Predicted_cumulative_sleep_time =
-# #_of_result_rows * sleep_time_per_result_row
-#
-# 1. Total (real sleep time) ~= predicted_cumulative_sleep_time !!
-# 2. The state of a session within the PROCESSLIST changes to 'User sleep'
-# if the sessions runs a statement containing the sleep function and the
-# processing of the statement is just within the phase where the sleep
-# is done. (*)
-# 3. NOW() and processlist.time behave "synchronous" to system time and
-# show also the "jumps" caused by system time manipulations. (*)
-# 4. processlist.time is unsigned, the "next" value below 0 is ~ 4G (*)
-# 5. Current processlist.time ~= current real sleep time if the system time
-# was not manipulated. (*)
-# 6. High system load can cause delays of <= 2 seconds.
-# 7. Thanks to Davi for excellent hints and ideas.
-#
-# (*)
-# - information_schema.processlist is not available before MySQL 5.1.
-# - Observation of processlist content requires a
-# - "worker" session sending the query with "send" and pulling results
-# with "reap"
-# - session observing the processlist parallel to the worker session
-# "send" and "reap" do not work in case of an embedded server.
-# Conclusion: Tests based on processlist have too many restrictions.
-#
-# Solutions for subtests based on TIMEDIFF of values filled via NOW()
-# -------------------------------------------------------------------
-# Run the following sequence three times
-# 1. SELECT <start_time>
-# 2. Query with SLEEP
-# 3. SELECT <end_time>
-# If TIMEDIFF(<end_time>,<start_time>) is at least two times within a
-# reasonable range assume that we did not met errors we were looking for.
-#
-# It is extreme unlikely that we have two system time changes within the
-# < 30 seconds runtime. Even if the unlikely happens, there are so
-# frequent runs of this test on this or another testing box which will
-# catch the problem.
-#
-
---echo #------------------------------------------------------------------------
---echo # Tests for Bug#6760 and Bug#12689
-# Number of rows within the intended result set.
-SET @row_count = 4;
-# Parameter within SLEEP function
-SET @sleep_time_per_result_row = 1;
-# Maximum acceptable delay caused by high load on testing box
-SET @max_acceptable_delay = 2;
-# TIMEDIFF = time for query with sleep (mostly the time caused by SLEEP)
-# + time for delays caused by high load on testing box
-# Ensure that at least a reasonable fraction of TIMEDIFF belongs to the SLEEP
-# by appropriate setting of variables.
-# Ensure that any "judging" has a base of minimum three attempts.
-# (Test 2 uses all attempts except the first one.)
-if (!` SELECT (@sleep_time_per_result_row * @row_count - @max_acceptable_delay >
- @sleep_time_per_result_row) AND (@row_count - 1 >= 3)`)
-{
- --echo # Have to abort because of error in plausibility check
- --echo ######################################################
- --vertical_results
- SELECT @sleep_time_per_result_row * @row_count - @max_acceptable_delay >
- @sleep_time_per_result_row AS must_be_1,
- @row_count - 1 >= 3 AS must_be_also_1,
- @sleep_time_per_result_row, @row_count, @max_acceptable_delay;
- exit;
-}
-SET @@global.query_cache_size = 1024 * 64;
---disable_warnings
-DROP TEMPORARY TABLE IF EXISTS t_history;
-DROP TABLE IF EXISTS t1;
---enable_warnings
-CREATE TEMPORARY TABLE t_history (attempt SMALLINT,
-start_ts DATETIME, end_ts DATETIME,
-start_cached INTEGER, end_cached INTEGER);
-CREATE TABLE t1 (f1 BIGINT);
-let $num = `SELECT @row_count`;
---disable_query_log
-begin;
-while ($num)
-{
- INSERT INTO t1 VALUES (1);
- dec $num;
-}
-commit;
---enable_query_log
-
-let $loops = 4;
-let $num = $loops;
-while ($num)
-{
- let $Qcache_queries_in_cache =
- query_get_value(SHOW STATUS LIKE 'Qcache_queries_in_cache', Value, 1);
- eval
- INSERT INTO t_history
- SET attempt = $loops - $num + 1, start_ts = NOW(),
- start_cached = $Qcache_queries_in_cache;
- SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1;
- #
- # Do not determine Qcache_queries_in_cache before updating end_ts. The SHOW
- # might cost too much time on an overloaded box.
- eval
- UPDATE t_history SET end_ts = NOW()
- WHERE attempt = $loops - $num + 1;
- let $Qcache_queries_in_cache =
- query_get_value(SHOW STATUS LIKE 'Qcache_queries_in_cache', Value, 1);
- eval
- UPDATE t_history SET end_cached = $Qcache_queries_in_cache
- WHERE attempt = $loops - $num + 1;
- # DEBUG eval SELECT * FROM t_history WHERE attempt = $loops - $num + 1;
- dec $num;
-}
-
-# 1. The majority of queries with SLEEP must need a reasonable time
-# -> SLEEP has an impact on runtime
-# = Replacement for original Bug#6760 test
-# -> total runtime is clear more needed than for one result row needed
-# = Replacement for one of the original Bug#12689 tests
---echo # Test 1: Does the query with SLEEP need a reasonable time?
-eval SELECT COUNT(*) >= $loops - 1 INTO @aux1 FROM t_history
-WHERE TIMEDIFF(end_ts,start_ts) - @sleep_time_per_result_row * @row_count
- BETWEEN 0 AND @max_acceptable_delay;
-SELECT @aux1 AS "Expect 1";
-#
-# 2. The majority of queries (the first one must be ignored) with SLEEP must
-# need a reasonable time
-# -> If we assume that the result of a cached query will be sent back
-# immediate, without any sleep, than the query with SLEEP cannot be cached
-# (current and intended behaviour for queries with SLEEP).
-# -> It could be also not excluded that the query was cached but the server
-# honoured somehow the SLEEP. Such a behaviour would be also acceptable.
-# = Replacement for one of the original Bug#12689 tests
---echo # Test 2: Does the query with SLEEP need a reasonable time even in case
---echo # of the non first execution?
-eval SELECT COUNT(*) >= $loops - 1 - 1 INTO @aux2 FROM t_history
-WHERE TIMEDIFF(end_ts,start_ts) - @sleep_time_per_result_row * @row_count
- BETWEEN 0 AND @max_acceptable_delay
- AND attempt > 1;
-SELECT @aux2 AS "Expect 1";
-#
-# 3. The query with SLEEP should be not cached.
-# -> SHOW STATUS Qcache_queries_in_cache must be not incremented after
-# the execution of the query with SLEEP
---echo # Test 3: The query with SLEEP must be not cached.
-eval SELECT COUNT(*) = $loops INTO @aux3 FROM t_history
-WHERE end_cached = start_cached;
-SELECT @aux3 AS "Expect 1";
-#
-# Dump the content of t_history if one of the tests failed.
-if (`SELECT @aux1 + @aux2 + @aux3 <> 3`)
-{
- --echo # Some tests failed, dumping the content of t_history
- SELECT * FROM t_history;
-}
-DROP TABLE t1;
-DROP TEMPORARY TABLE t_history;
-SET @@global.query_cache_size = default;
-
---echo End of 5.0 tests
-
-#
-# Bug #31157: Crash when select+order by the avg of some field within the
-# group by
-#
-SET GLOBAL query_cache_size=1024*1024*512;
-CREATE TABLE t1 (a ENUM('rainbow'));
-INSERT INTO t1 VALUES (),(),(),(),();
-SELECT 1 FROM t1 GROUP BY (SELECT 1 FROM t1 ORDER BY AVG(LAST_INSERT_ID()));
-DROP TABLE t1;
-CREATE TABLE t1 (a LONGBLOB);
-INSERT INTO t1 SET a = 'aaaa';
-INSERT INTO t1 SET a = 'aaaa';
-SELECT 1 FROM t1 GROUP BY
- (SELECT LAST_INSERT_ID() FROM t1 ORDER BY MIN(a) ASC LIMIT 1);
-DROP TABLE t1;
-SET GLOBAL query_cache_size= default;
-
-
-#
-# Bug#35020: illegal sql_cache select syntax
-#
-CREATE TABLE t1( a INT );
-
---error ER_PARSE_ERROR
-SET @v = ( SELECT SQL_CACHE 1 );
---error ER_PARSE_ERROR
-SET @v = ( SELECT SQL_NO_CACHE 1 );
-
-#
-# Keywords 'SQL_CACHE' and 'SQL_NO_CACHE' are allowed as column names.
-# Hence the error messages are not intuitive.
-#
---error ER_BAD_FIELD_ERROR
-SELECT a FROM t1 WHERE a IN ( SELECT SQL_CACHE a FROM t1 );
---error ER_BAD_FIELD_ERROR
-SELECT a FROM t1 WHERE a IN ( SELECT SQL_NO_CACHE a FROM t1 );
---error ER_BAD_FIELD_ERROR
-SELECT ( SELECT SQL_CACHE a FROM t1 );
---error ER_BAD_FIELD_ERROR
-SELECT ( SELECT SQL_NO_CACHE a FROM t1 );
-
-SELECT SQL_CACHE * FROM t1;
-SELECT SQL_NO_CACHE * FROM t1;
-
-# SQL_CACHE is only allowed once in first top-level select.
---error ER_CANT_USE_OPTION_HERE
-SELECT * FROM t1 UNION SELECT SQL_CACHE * FROM t1;
---error ER_CANT_USE_OPTION_HERE
-SELECT * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1;
---error ER_BAD_FIELD_ERROR
-SELECT * FROM t1 WHERE a IN (SELECT SQL_CACHE a FROM t1);
---error ER_BAD_FIELD_ERROR
-SELECT * FROM t1 WHERE a IN (SELECT a FROM t1 UNION SELECT SQL_CACHE a FROM t1);
-
---error ER_CANT_USE_OPTION_HERE
-SELECT * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1;
---error ER_BAD_FIELD_ERROR
-SELECT * FROM t1 WHERE a IN (SELECT SQL_NO_CACHE a FROM t1);
---error ER_BAD_FIELD_ERROR
-SELECT * FROM t1 WHERE a IN
- (SELECT a FROM t1 UNION SELECT SQL_NO_CACHE a FROM t1);
---error ER_WRONG_USAGE
-SELECT SQL_CACHE SQL_NO_CACHE * FROM t1;
---error ER_WRONG_USAGE
-SELECT SQL_NO_CACHE SQL_CACHE * FROM t1;
---error ER_CANT_USE_OPTION_HERE
-SELECT SQL_CACHE * FROM t1 UNION SELECT SQL_CACHE * FROM t1;
---error ER_CANT_USE_OPTION_HERE
-SELECT SQL_CACHE * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1;
---error ER_CANT_USE_OPTION_HERE
-SELECT SQL_NO_CACHE * FROM t1 UNION SELECT SQL_CACHE * FROM t1;
---error ER_CANT_USE_OPTION_HERE
-SELECT SQL_NO_CACHE * FROM t1 UNION SELECT SQL_NO_CACHE * FROM t1;
---error ER_BAD_FIELD_ERROR
-SELECT SQL_CACHE * FROM t1 WHERE a IN
- (SELECT SQL_NO_CACHE a FROM t1);
---error ER_BAD_FIELD_ERROR
-SELECT SQL_CACHE * FROM t1 WHERE a IN
- (SELECT a FROM t1 UNION SELECT SQL_NO_CACHE a FROM t1);
-
-DROP TABLE t1;
-
---echo End of 5.1 tests
-
---echo #
---echo # Bug#51336 Assert in reload_acl_and_cache during RESET QUERY CACHE
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1(id INT);
-
-START TRANSACTION;
-SELECT * FROM t1;
-# This caused an assert
-RESET QUERY CACHE;
-
-COMMIT;
-DROP TABLE t1;
---echo New query cache switching OFF mechanism test
-set global query_cache_size=1024*1024*20;
-set global query_cache_type=on;
-select @@query_cache_size, @@global.query_cache_type, @@local.query_cache_type;
-set global query_cache_size=0;
-select @@query_cache_size, @@global.query_cache_type, @@local.query_cache_type;
-set global query_cache_size=1024*1024*20;
-select @@query_cache_size, @@global.query_cache_type, @@local.query_cache_type;
-set global query_cache_type=off;
-select @@query_cache_size, @@global.query_cache_type, @@local.query_cache_type;
-set global query_cache_type=on;
-select @@query_cache_size, @@global.query_cache_type, @@local.query_cache_type;
-set local query_cache_type= on;
-select @@query_cache_size, @@global.query_cache_type, @@local.query_cache_type;
-
---echo #
---echo # MDEV-4981: Account for queries handled by query-cache in
---echo # USER_STATISTICS (and in HOST_STATISTICS)
---echo #
-
-SET GLOBAL userstat=1;
-set GLOBAL query_cache_size=1355776;
-FLUSH USER_STATISTICS;
-FLUSH CLIENT_STATISTICS;
-reset query cache;
-flush status;
-
-create table t1 (a int);
-insert into t1 values (1);
-select * from t1;
-select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.CLIENT_STATISTICS
-where CLIENT="localhost";
-select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.USER_STATISTICS
-where USER="root";
-show status like "Qcache_hits";
-select * from t1;
-select * from t1;
-select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.CLIENT_STATISTICS
-where CLIENT="localhost";
-select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.USER_STATISTICS
-where USER="root";
-show status like "Qcache_hits";
-
-drop table t1;
-FLUSH USER_STATISTICS;
-FLUSH CLIENT_STATISTICS;
-flush status;
-
-create table t1 (a int);
-select * from t1;
-select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.CLIENT_STATISTICS
-where CLIENT="localhost";
-select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.USER_STATISTICS
-where USER="root";
-show status like "Qcache_hits";
-select * from t1;
-select * from t1;
-select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.CLIENT_STATISTICS
-where CLIENT="localhost";
-select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.USER_STATISTICS
-where USER="root";
-show status like "Qcache_hits";
-
-FLUSH USER_STATISTICS;
-FLUSH CLIENT_STATISTICS;
-flush status;
-
-create procedure p1()
- select * from t1;
-call p1;
-select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.CLIENT_STATISTICS
-where CLIENT="localhost";
-select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.USER_STATISTICS
-where USER="root";
-show status like "Qcache_hits";
-call p1;
-call p1;
-select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.CLIENT_STATISTICS
-where CLIENT="localhost";
-select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.USER_STATISTICS
-where USER="root";
-show status like "Qcache_hits";
-
-FLUSH USER_STATISTICS;
-FLUSH CLIENT_STATISTICS;
-flush status;
-
-SET GLOBAL query_cache_size= 0;
-call p1;
-select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.CLIENT_STATISTICS
-where CLIENT="localhost";
-select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.USER_STATISTICS
-where USER="root";
-show status like "Qcache_hits";
-call p1;
-call p1;
-select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.CLIENT_STATISTICS
-where CLIENT="localhost";
-select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.USER_STATISTICS
-where USER="root";
-show status like "Qcache_hits";
-drop procedure p1;
-drop table t1;
-set GLOBAL query_cache_size=1355776;
-SET GLOBAL userstat=default;
-
---echo End of 5.5 tests
-
---echo #
---echo # Bug#12977203: SERVER CRASH ON A DERIVED TABLE WITH QUERY CACHE ENABLED
---echo #
-SET @qc= @@query_cache_size;
-SET GLOBAL query_cache_size=1355776;
-CREATE TABLE t1 (f1 blob);
-SELECT COUNT(*) FROM (SELECT * FROM t1 ) tt;
-DROP TABLE t1;
-SET GLOBAL query_cache_size= @qc;
-
---echo #
---echo # MDEV-617 LP:671189 - Query cache is not used for tables or
---echo # databases with dots in their names
---echo #
-CREATE DATABASE `foo.bar`;
-use `foo.bar`;
-flush status;
-CREATE TABLE moocow (a int);
-INSERT INTO moocow VALUES (1), (2), (3);
-SHOW STATUS LIKE 'Qcache_inserts';
-SELECT * FROM moocow;
-SHOW STATUS LIKE 'Qcache_inserts';
-SHOW STATUS LIKE 'Qcache_hits';
-SELECT * FROM moocow;
-SHOW STATUS LIKE 'Qcache_hits';
-use test;
-drop database `foo.bar`;
-
---echo End of 10.0 tests
-
---echo #
---echo # MDEV-10766 Queries which start with WITH clause do not get
---echo # inserted into query cache
---echo #
-flush status;
-show status like "Qcache_inserts";
-create table t1 (i int);
-with cte as (select * from t1) select * from cte;
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-with cte as (select * from t1) select * from cte;
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-drop table t1;
-
---echo #
---echo # MDEV-15328: MariaDB 10.2.13 Crashes upon CALL PROCEDURE PARAM
---echo # LAST_INSERT_ID ()
---echo # (part 2, part 1 is in sp.test)
---echo #
-
-create table t1 (a int);
-insert into t1 values (1);
-CREATE FUNCTION foo (i INT UNSIGNED ) RETURNS int deterministic RETURN 1;
-show status like "Qcache_queries_in_cache";
-SELECT foo( LAST_INSERT_ID() ) from t1;
-show status like "Qcache_queries_in_cache";
-DROP FUNCTION foo;
-drop table t1;
-
---echo restore defaults
-SET GLOBAL query_cache_type= default;
-SET GLOBAL query_cache_size= default;
-SET LOCAL query_cache_type= default;
diff --git a/mysql-test/t/query_cache_28249.test b/mysql-test/t/query_cache_28249.test
deleted file mode 100644
index a08371fe576..00000000000
--- a/mysql-test/t/query_cache_28249.test
+++ /dev/null
@@ -1,113 +0,0 @@
-### t/query_cache_28249.test ###
-#
-# Test for
-# Bug#28249 Query Cache returns wrong result with concurrent insert / certain lock
-#
-# Last modification:
-# 2008-11-27 mleich - Move this test out of query_cache.test
-# - Fix Bug#40179 Test main.query_cache failing randomly on Pushbuild,
-# test weakness
-# - Minor improvements (comments,formatting etc.)
-#
-
---source include/have_query_cache.inc
---source include/not_embedded.inc
-
-SET @query_cache_type= @@global.query_cache_type;
-SET @query_cache_limit= @@global.query_cache_limit;
-SET @query_cache_min_res_unit= @@global.query_cache_min_res_unit;
-SET @query_cache_size= @@global.query_cache_size;
-
---echo # Bug#28249 Query Cache returns wrong result with concurrent insert/ certain lock
-connect (user1,localhost,root,,test,,);
-connect (user2,localhost,root,,test,,);
-connect (user3,localhost,root,,test,,);
-
-connection user1;
-
-SET GLOBAL query_cache_type=1;
-SET GLOBAL query_cache_limit=10000;
-SET GLOBAL query_cache_min_res_unit=0;
-SET GLOBAL query_cache_size= 102400;
-
-FLUSH TABLES;
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (a INT);
-INSERT INTO t1 VALUES (1),(2),(3);
-
-connection user2;
-LOCK TABLE t2 WRITE;
-
-connection user1;
---echo # "send" the next select, "reap" the result later.
---echo # The select will be blocked by the write lock on the t1.
-let $select_for_qc =
-SELECT *, (SELECT COUNT(*) FROM t2) FROM t1;
-send;
-eval $select_for_qc;
-
-connection user3;
-# Typical information_schema.processlist content after sufficient sleep time
-# ID USER COMMAND TIME STATE INFO
-# ....
-# 2 root Query 5 Waiting for table metadata lock SELECT *, (SELECT COUNT(*) FROM t2) FROM t1
-# ....
-# XXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-# The values marked with 'X' must be reached.
---echo # Poll till the select of connection user1 is blocked by the write lock on t1.
-let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist
-WHERE state = 'Waiting for table metadata lock'
- AND info = '$select_for_qc';
---source include/wait_condition.inc
-eval
-SELECT user,command,state,info FROM information_schema.processlist
-WHERE state = 'Waiting for table metadata lock'
- AND info = '$select_for_qc';
-INSERT INTO t1 VALUES (4);
-
-connection user2;
-UNLOCK TABLES;
-
-connection user1;
-#
-# Since the lock ordering rule in thr_multi_lock depends on
-# pointer values, from execution to execution we might have
-# different lock order, and therefore, sometimes lock t1 and block
-# on t2, and sometimes block on t2 right away. In the second case,
-# the following insert succeeds, and only then this select can
-# proceed, and we actually test nothing, as the very first select
-# returns 4 rows right away.
-# It's fine to have a test case that covers the problematic area
-# at least once in a while.
---echo # Collecting ("reap") the result from the previously blocked select.
---echo # The printing of the result (varies between 3 and 4 rows) set has to be suppressed.
---disable_result_log
---reap
---enable_result_log
-
-connection user3;
---echo # The next select enforces that effects of "concurrent_inserts" like the
---echo # record with a = 4 is missing in result sets can no more happen.
-SELECT 1 FROM t1 WHERE a = 4;
-
-connection user1;
---echo # The next result set must contain 4 rows.
-# If not, we have a regression of Bug#28249
-eval $select_for_qc;
-RESET QUERY CACHE;
-eval $select_for_qc;
-
-DROP TABLE t1,t2;
-
-connection default;
-disconnect user1;
-disconnect user2;
-disconnect user3;
-
-SET GLOBAL query_cache_type= @query_cache_type;
-SET GLOBAL query_cache_limit= @query_cache_limit;
-SET GLOBAL query_cache_min_res_unit= @query_cache_min_res_unit;
-SET GLOBAL query_cache_size= @query_cache_size;
diff --git a/mysql-test/t/query_cache_debug.test b/mysql-test/t/query_cache_debug.test
deleted file mode 100644
index 22ff1d45e63..00000000000
--- a/mysql-test/t/query_cache_debug.test
+++ /dev/null
@@ -1,353 +0,0 @@
---source include/not_embedded.inc
---source include/have_query_cache.inc
---source include/have_debug_sync.inc
---source include/long_test.inc
-
-set global query_cache_type= ON;
-#
-# Bug #30887 Server crashes on SET GLOBAL query_cache_size=0
-#
-flush status;
-set query_cache_type=DEMAND;
-set global query_cache_size= 1024*768;
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (a varchar(100));
-insert into t1 values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
-connect (bug30887con1, localhost, root, ,test);
-connect (bug30887con2, localhost, root, ,test);
-
-connection bug30887con1;
---echo Activate debug hook and attempt to retrieve the statement from the cache.
-set debug_sync="wait_in_query_cache_insert SIGNAL parked WAIT_FOR go";
---send select SQL_CACHE * from t1;
-
-connection default;
-set debug_sync="now WAIT_FOR parked";
-
-connection bug30887con2;
---echo clear the query cache.
-show status like 'Qcache_queries_in_cache';
-set global query_cache_size= 0;
-
-connection default;
---echo Signal the debug hook to release the lock.
-set debug_sync="now SIGNAL go";
-
---echo Show query cache status.
-show status like 'Qcache_queries_in_cache';
-
-connection bug30887con1;
---reap
-
-disconnect bug30887con1;
-disconnect bug30887con2;
-connection default;
-set debug_sync= 'RESET';
-set global query_cache_size= 0;
-use test;
-drop table t1;
-
-#
-# Bug#41098: Query Cache returns wrong result with concurrent insert
-#
-
-SET @old_concurrent_insert= @@GLOBAL.concurrent_insert;
-SET @old_query_cache_size= @@GLOBAL.query_cache_size;
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (a INT);
-INSERT INTO t1 VALUES (1),(2),(3);
-
-SET GLOBAL concurrent_insert= 1;
-SET GLOBAL query_cache_size= 1024*512;
-SET GLOBAL query_cache_type= ON;
-
-connect(con1,localhost,root,,test,,);
-connect(con2,localhost,root,,test,,);
-
-connection con1;
-SET DEBUG_SYNC = "wait_after_query_cache_invalidate SIGNAL parked WAIT_FOR go";
---echo # Send concurrent insert, will wait in the query cache table invalidate
---send INSERT INTO t1 VALUES (4)
-
-connection default;
---echo # Wait for concurrent insert to reach the debug point
-SET DEBUG_SYNC = "now WAIT_FOR parked";
-
-connection con2;
---echo # Send SELECT that shouldn't be cached
-SELECT * FROM t1;
-
-connection default;
---echo # Notify the concurrent insert to proceed
-SET DEBUG_SYNC = "now SIGNAL go";
-
-connection con1;
---echo # Gather insert result
---reap
-SHOW STATUS LIKE "Qcache_queries_in_cache";
---echo # Test that it's cacheable
-SELECT * FROM t1;
-SHOW STATUS LIKE "Qcache_queries_in_cache";
-
-disconnect con1;
-disconnect con2;
-
-connection default;
---echo # Restore defaults
-SET DEBUG_SYNC= 'RESET';
-RESET QUERY CACHE;
-DROP TABLE t1,t2;
-SET GLOBAL concurrent_insert= DEFAULT;
-SET GLOBAL query_cache_size= DEFAULT;
-SET GLOBAL query_cache_type= DEFAULT;
-
-
---echo #
---echo # Bug43758 Query cache can lock up threads in 'freeing items' state
---echo #
-FLUSH STATUS;
-SET GLOBAL query_cache_type=DEMAND;
-SET GLOBAL query_cache_size= 1024*768;
---disable_warnings
-DROP TABLE IF EXISTS t1,t2,t3,t4,t5;
---enable_warnings
-CREATE TABLE t1 (a VARCHAR(100));
-CREATE TABLE t2 (a VARCHAR(100));
-CREATE TABLE t3 (a VARCHAR(100));
-CREATE TABLE t4 (a VARCHAR(100));
-CREATE TABLE t5 (a VARCHAR(100));
-
-INSERT INTO t1 VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
-INSERT INTO t2 VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
-INSERT INTO t3 VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
-INSERT INTO t4 VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
-INSERT INTO t5 VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
-
-connect (thd2, localhost, root, ,test);
-connect (thd3, localhost, root, ,test);
-connect (thd1, localhost, root, ,test);
-
-connection thd1;
---echo **
---echo ** Load Query Cache with a result set and one table.
---echo **
-SELECT SQL_CACHE * FROM t1;
---echo *************************************************************************
---echo ** We want to accomplish the following state:
---echo ** - Query cache status: TABLE_FLUSH_IN_PROGRESS
---echo ** - THD1: invalidate_table_internal (iterating query blocks)
---echo ** - THD2: query_cache_insert (cond_wait)
---echo ** - THD3: query_cache_insert (cond_wait)
---echo ** - No thread should be holding the structure_guard_mutex.
---echo **
---echo ** First step is to place a DELETE-statement on the debug hook just
---echo ** before the mutex lock in invalidate_table_internal.
---echo ** This will allow new result sets to be written into the QC.
---echo **
-SET DEBUG_SYNC="wait_in_query_cache_invalidate1 SIGNAL parked1_1 WAIT_FOR go1_1";
-SET DEBUG_SYNC="wait_in_query_cache_invalidate2 SIGNAL parked1_2 WAIT_FOR go1_2";
---send DELETE FROM t1 WHERE a like '%a%';
-
-connection default;
---echo ** Assert that the expect process status is obtained.
-SET DEBUG_SYNC="now WAIT_FOR parked1_1";
--- echo **
-
-connection thd2;
---echo ** On THD2: Insert a result into the cache. This attempt will be blocked
---echo ** because of a debug hook placed just before the mutex lock after which
---echo ** the first part of the result set is written.
-SET DEBUG_SYNC="wait_in_query_cache_insert SIGNAL parked2 WAIT_FOR go2 EXECUTE 1";
---send SELECT SQL_CACHE * FROM t2 UNION SELECT * FROM t3
-
-connection default;
---echo ** Assert that the SELECT-stmt thread reaches the sync point.
-SET DEBUG_SYNC="now WAIT_FOR parked2";
---echo **
---echo **
-
-connection thd3;
---echo ** On THD3: Insert another result into the cache and block on the same
---echo ** debug hook.
-SET DEBUG_SYNC="wait_in_query_cache_insert SIGNAL parked3 WAIT_FOR go3 EXECUTE 1";
---send SELECT SQL_CACHE * FROM t4 UNION SELECT * FROM t5
-
-connection default;
---echo ** Assert that the SELECT-stmt thread reaches the sync point.
-SET DEBUG_SYNC="now WAIT_FOR parked3";
---echo **
---echo **
-
---echo ** Signal the DELETE thread, THD1, to continue. It will enter the mutex
---echo ** lock and set query cache status to TABLE_FLUSH_IN_PROGRESS and then
---echo ** unlock the mutex before stopping on the next debug hook.
-SET DEBUG_SYNC="now SIGNAL go1_1";
---echo ** Assert that we reach the next debug hook.
-SET DEBUG_SYNC="now WAIT_FOR parked1_2";
-
---echo **
---echo ** Signal the remaining debug hooks blocking THD2 and THD3.
---echo ** The threads will grab the guard mutex enter the wait condition and
---echo ** and finally release the mutex. The threads will continue to wait
---echo ** until a broadcast signal reaches them causing both threads to
---echo ** come alive and check the condition.
-SET DEBUG_SYNC="now SIGNAL go2";
-SET DEBUG_SYNC="now SIGNAL go3";
-
---echo **
---echo ** Finally signal the DELETE statement on THD1 one last time.
---echo ** The stmt will complete the query cache invalidation and return
---echo ** cache status to NO_FLUSH_IN_PROGRESS. On the status change
---echo ** One signal will be sent to the thread group waiting for executing
---echo ** invalidations and a broadcast signal will be sent to the thread
---echo ** group holding result set writers.
-SET DEBUG_SYNC="now SIGNAL go1_2";
-
---echo **
---echo *************************************************************************
---echo ** No tables should be locked
-connection thd2;
-reap;
-DELETE FROM t1;
-DELETE FROM t2;
-DELETE FROM t3;
-
-connection thd3;
-reap;
-DELETE FROM t4;
-DELETE FROM t5;
-
-connection thd1;
-reap;
-
---echo ** Done.
-
-connection default;
-disconnect thd1;
-disconnect thd2;
-disconnect thd3;
-SET DEBUG_SYNC= 'RESET';
-SET GLOBAL query_cache_size= 0;
-
-connection default;
---echo # Restore defaults
-RESET QUERY CACHE;
-FLUSH STATUS;
-DROP TABLE t1,t2,t3,t4,t5;
-SET GLOBAL query_cache_size= DEFAULT;
-SET GLOBAL query_cache_type= DEFAULT;
-
---echo #
---echo # Bug#56822: Add a thread state for sessions waiting on the query cache lock
---echo #
-
-SET @old_query_cache_size= @@GLOBAL.query_cache_size;
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1),(2),(3);
-
-SET GLOBAL concurrent_insert= 1;
-SET GLOBAL query_cache_size= 1024*512;
-SET GLOBAL query_cache_type= ON;
-
-connect(con1,localhost,root,,test,,);
-connect(con2,localhost,root,,test,,);
-
-connection con1;
-SET DEBUG_SYNC = "wait_in_query_cache_invalidate2 SIGNAL parked WAIT_FOR go";
---echo # Send INSERT, will wait in the query cache table invalidation
---send INSERT INTO t1 VALUES (4);
-
-connection default;
---echo # Wait for insert to reach the debug point
-SET DEBUG_SYNC = "now WAIT_FOR parked";
-
-connection con2;
---echo # Send a query that should wait on the query cache lock
---send RESET QUERY CACHE
-
-connection default;
---echo # Wait for the state to be reflected in the processlist
-let $wait_condition=
- SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Waiting for query cache lock" AND info = "RESET QUERY CACHE";
---source include/wait_condition.inc
---echo # Signal that the query cache can be unlocked
-SET DEBUG_SYNC="now SIGNAL go";
-
-connection con1;
---reap
-disconnect con1;
-
-connection con2;
---reap
-disconnect con2;
-
-connection default;
---echo # Restore defaults
-SET DEBUG_SYNC= 'RESET';
-RESET QUERY CACHE;
-DROP TABLE t1;
-SET GLOBAL query_cache_size= DEFAULT;
-SET GLOBAL query_cache_type= DEFAULT;
-
---echo #
---echo # MDEV-14526: MariaDB keeps crashing under load when
---echo # query_cache_type is changed
---echo #
-
-CREATE TABLE t1 (
- `id` int(10) NOT NULL AUTO_INCREMENT,
- `k` int(10) default '0',
- PRIMARY KEY (`id`))
-ENGINE=MyISAM;
-
-INSERT IGNORE INTO t1 VALUES
- (NULL,1),(NULL,8),(NULL,NULL),(NULL,NULL),(NULL,4),(NULL,9),(NULL,7),
- (NULL,3),(NULL,NULL),(NULL,2),(NULL,3),(NULL,NULL),(NULL,2),(NULL,7),
- (NULL,1),(NULL,2),(NULL,4),(NULL,NULL),(NULL,1),(NULL,1),(NULL,4);
-
-SET GLOBAL query_cache_size= 1024*1024;
-SET GLOBAL query_cache_type= 1;
-
---connect (con2,localhost,root,,test)
---connect (con1,localhost,root,,test)
-set debug_sync="wait_in_query_cache_store_query SIGNAL parked WAIT_FOR go";
---send
-
- SELECT DISTINCT id FROM t1 WHERE id BETWEEN 5603 AND 16218 ORDER BY k;
-
---connection default
-
-set debug_sync="now WAIT_FOR parked";
---connection con2
---send
- SET GLOBAL query_cache_type= 0;
-
---connection default
-set debug_sync="now SIGNAL go";
-
---connection con1
---reap
---connection con2
---reap
-
-# Cleanup
---disconnect con1
---disconnect con2
---connection default
-set debug_sync= 'RESET';
-DROP TABLE t1;
-SEt GLOBAL query_cache_size= DEFAULT;
-SEt GLOBAL query_cache_type= DEFAULT;
-
---echo # End of 5.5 tests
diff --git a/mysql-test/t/query_cache_innodb.test b/mysql-test/t/query_cache_innodb.test
deleted file mode 100644
index ba62ec36c16..00000000000
--- a/mysql-test/t/query_cache_innodb.test
+++ /dev/null
@@ -1,85 +0,0 @@
---source include/have_innodb.inc
---source include/have_query_cache.inc
---source include/not_embedded.inc
-
---echo #
---echo # MDEV-12485: foreign key on delete cascade stale entries with
---echo # query cache enabled
---echo #
-
-SET NAMES utf8;
-set global query_cache_type=1;
-set global query_cache_size=1024*1024;
-set query_cache_type=1;
-
-create table t1 ( id int unsigned auto_increment, primary key(id) ) engine=innodb;
-
-create table t2 ( t2id int unsigned, id int unsigned, primary key(t2id, id), foreign key (`id`) references t1(`id`) on delete cascade ) engine=innodb;
-
-insert into t1 values (1);
-insert into t2 values (1,1);
-select * from t2;
-show status like "Qcache_queries_in_cache";
-
-delete from t1;
-show status like "Qcache_queries_in_cache";
-select * from t2;
-
-optimize table t2;
-select * from t2;
-drop table t2;
-drop table t1;
-
-create database `testdatabase$ї`;
-use `testdatabase$ї`;
-create table `t1$ї` ( id int unsigned auto_increment, primary key(id) ) engine=innodb;
-
-create table `t2$ї` ( t2id int unsigned, id int unsigned, primary key(t2id, id), foreign key (`id`) references `t1$ї`(`id`) on delete cascade ) engine=innodb;
-
-insert into `t1$ї` values (1);
-insert into `t2$ї`values (1,1);
-select * from `t2$ї`;
-show status like "Qcache_queries_in_cache";
-
-delete from `t1$ї`;
-show status like "Qcache_queries_in_cache";
-select * from `t2$ї`;
-
-optimize table `t2$ї`;
-select * from `t2$ї`;
-
-use test;
-drop database `testdatabase$ї`;
-SET NAMES default;
-
-create database `#mysql50#-`;
-use `#mysql50#-`;
-create table `#mysql50#t-1` ( id int unsigned auto_increment, primary key(id) ) engine=innodb;
-
-create table `#mysql50#t-2` ( t2id int unsigned, id int unsigned, primary key(t2id, id), foreign key (`id`) references `#mysql50#t-1`(`id`) on delete cascade ) engine=innodb;
-
-insert into `#mysql50#t-1` values (1);
-insert into `#mysql50#t-2`values (1,1);
-select * from `#mysql50#t-2`;
-show status like "Qcache_queries_in_cache";
-
-delete from `#mysql50#t-1`;
-show status like "Qcache_queries_in_cache";
-select * from `#mysql50#t-2`;
-
-optimize table `#mysql50#t-2`;
-select * from `#mysql50#t-2`;
-
-use test;
-drop database `#mysql50#-`;
-SET NAMES default;
---disable_query_log
-call mtr.add_suppression("\\[ERROR\\] Invalid \\(old\\?\\) table or database name 't?-[12]?\\'");
---enable_query_log
---let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err
---let SEARCH_PATTERN=\\[ERROR\\] Invalid \\(old\\?\\) table or database name
---source include/search_pattern_in_file.inc
-
-set global query_cache_type=DEFAULT;
-set global query_cache_size=DEFAULT;
---echo End of 10.2 tests
diff --git a/mysql-test/t/query_cache_merge.test b/mysql-test/t/query_cache_merge.test
deleted file mode 100644
index 3046c4ecbfe..00000000000
--- a/mysql-test/t/query_cache_merge.test
+++ /dev/null
@@ -1,112 +0,0 @@
-# Test query cache with many tables
-
-SET GLOBAL query_cache_type=ON;
-SET LOCAL query_cache_type=ON;
-
---source include/have_query_cache.inc
-let $LIMIT=`SHOW VARIABLES LIKE 'open_files_limit'`;
-let $MIN_LIMIT=600;
-let $MAX_LIMIT=65536;
---source include/check_var_limit.inc
-
-SET @@global.query_cache_size=1355776;
-
-#
-# more then 255 (257) merged tables test
-#
-
-flush status;
-disable_query_log;
---disable_warnings
-let $1 = 257;
-while ($1)
-{
- eval drop table if exists t$1;
- eval create table t$1(a int) ENGINE=MyISAM;
- eval insert into t$1 values (1),(2);
- dec $1;
-}
---enable_warnings
-
-#
-# In order for the test to pass in --ps-protocol, we must
-# set table_definition_cache size to at least 258 elements.
-# Otherwise table versions are bound to change between
-# prepare and execute, and we will get a constant validation
-# error. See WL#4165 for details.
-#
-set @save_table_definition_cache= @@global.table_definition_cache;
-set @@global.table_definition_cache=512;
-create table t00 (a int) engine=MERGE UNION=(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257) INSERT_METHOD=FIRST;
-enable_query_log;
-select count(*) from t00;
-select count(*) from t00;
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_hits";
-delete from t256;
-show status like "Qcache_queries_in_cache";
-drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257,t00;
-
-SET @@global.query_cache_size=0;
-set @@global.table_definition_cache=@save_table_definition_cache;
-
-# End of 4.1 tests
-
-#
-# Bug#33362: Query cache invalidation (truncate) may hang if cached query uses many tables
-#
-
-SET @save_table_definition_cache = @@global.table_definition_cache;
-SET @@global.table_definition_cache = 512;
-
-let $c= 255;
-
-while ($c)
-{
- eval CREATE TABLE t$c (a INT);
- eval INSERT INTO t$c VALUES ($c);
- dec $c;
-}
-
-let $c= 254;
-let $str= t255;
-
-while ($c)
-{
- let $str= t$c,$str;
- dec $c;
-}
-
-eval CREATE TABLE t0 (a INT) ENGINE=MERGE UNION($str);
-SET GLOBAL query_cache_size = 1048576;
-FLUSH STATUS;
-SELECT a FROM t0 WHERE a = 1;
-SHOW STATUS LIKE "Qcache_queries_in_cache";
-
-let $c= 255;
-let $i= 1;
-
-while ($c)
-{
- eval TRUNCATE TABLE t$c;
- eval SELECT a FROM t$i;
- dec $c;
- inc $i;
-}
-
-SELECT a FROM t0;
-DROP TABLE t0;
-
-let $c= 255;
-
-while ($c)
-{
- eval DROP TABLE t$c;
- dec $c;
-}
-
-SET @@global.query_cache_size = default;
-SET @@global.table_definition_cache = @save_table_definition_cache;
-
-SET GLOBAL query_cache_type=default;
---echo End of 5.1 tests
diff --git a/mysql-test/t/query_cache_notembedded-master.opt b/mysql-test/t/query_cache_notembedded-master.opt
deleted file mode 100644
index 871d6965726..00000000000
--- a/mysql-test/t/query_cache_notembedded-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---query-cache-size=1355776
diff --git a/mysql-test/t/query_cache_notembedded.test b/mysql-test/t/query_cache_notembedded.test
deleted file mode 100644
index dff6c2a139b..00000000000
--- a/mysql-test/t/query_cache_notembedded.test
+++ /dev/null
@@ -1,336 +0,0 @@
--- source include/have_query_cache.inc
--- source include/not_embedded.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-
-#
-# Tests with query cache
-#
-set @sql_mode_save=@@global.sql_mode;
-set @query_cache_type_save=@@global.query_cache_type;
-set @query_cache_size_save=@@global.query_cache_size;
-
-set GLOBAL sql_mode="";
-set LOCAL sql_mode="";
-
-# Reset query cache variables.
-
-flush query cache; # This crashed in some versions
-flush query cache; # This crashed in some versions
-reset query cache;
-flush status;
---disable_warnings
-drop table if exists t1, t2, t3, t11, t21;
---enable_warnings
-#
-# FLUSH QUERY CACHE
-#
-create table t1 (a int not null);
-insert into t1 values (1),(2),(3);
-create table t2 (a int not null);
-insert into t2 values (1),(2),(3);
-select * from t1;
-select * from t2;
-insert into t1 values (4);
-show status like "Qcache_free_blocks";
-flush query cache;
-show status like "Qcache_free_blocks";
-drop table t1, t2;
-# With join results...
-create table t1 (a text not null);
-create table t11 (a text not null);
-create table t2 (a text not null);
-create table t21 (a text not null);
-create table t3 (a text not null);
-insert into t1 values("1111111111111111111111111111111111111111111111111111");
-insert into t2 select * from t1;
-insert into t1 select * from t2;
-insert into t2 select * from t1;
-insert into t1 select * from t2;
-insert into t2 select * from t1;
-insert into t1 select * from t2;
-insert into t2 select * from t1;
-insert into t1 select * from t2;
-insert into t2 select * from t1;
-insert into t1 select * from t2;
-insert into t2 select * from t1;
-insert into t1 select * from t2;
-insert into t2 select * from t1;
-insert into t1 select * from t2;
-insert into t2 select * from t1;
-# t11 and t21 must be over 4Kb (QUERY_CACHE_MIN_RESULT_DATA_SIZE)
-insert into t11 select * from t1;
-insert into t21 select * from t1;
-insert into t1 select * from t2;
-insert into t2 select * from t1;
-insert into t1 select * from t2;
-#results of t3 must be > 0.5Mb
-insert into t3 select * from t1;
-insert into t3 select * from t2;
-insert into t3 select * from t1;
-disable_result_log;
-select * from t11;
-select * from t21;
-enable_result_log;
-show status like "Qcache_total_blocks";
-show status like "Qcache_free_blocks";
-disable_result_log;
-insert into t11 values("");
-select * from t3;
-enable_result_log;
-show status like "Qcache_total_blocks";
-show status like "Qcache_free_blocks";
-flush query cache;
-show status like "Qcache_total_blocks";
-show status like "Qcache_free_blocks";
-drop table t1, t2, t3, t11, t21;
-
-#
-# do not use QC if tables locked (Bug#12385)
-#
-connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
-connection root;
-CREATE TABLE t1 ( a INT NOT NULL PRIMARY KEY AUTO_INCREMENT ) ENGINE =
-MyISAM;
-LOCK TABLE t1 READ LOCAL;
-connect (root2,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
-connection root2;
-INSERT INTO t1 VALUES (), (), ();
-connection root;
-SELECT * FROM t1;
-connection root2;
-SELECT * FROM t1;
-connection root;
-SELECT * FROM t1;
-UNLOCK TABLES;
-drop table t1;
-connection default;
-disconnect root;
-disconnect root2;
-
-#
-# query in QC from normal execution and SP (Bug#6897)
-# improved to also test Bug#3583 and Bug#12990
-#
-flush query cache;
-reset query cache;
-flush status;
-delimiter //;
-create table t1 (s1 int)//
-create procedure f1 () begin
-select sql_cache * from t1;
-select sql_cache * from t1;
-select sql_cache * from t1;
-end;//
-create procedure f2 () begin
-select sql_cache * from t1 where s1=1;
-select sql_cache * from t1;
-end;//
-create procedure f3 () begin
-select sql_cache * from t1;
-select sql_cache * from t1 where s1=1;
-end;//
-create procedure f4 () begin
-select sql_cache * from t1;
-select sql_cache * from t1 where s1=1;
-select sql_cache * from t1;
-select sql_cache * from t1 where s1=1;
-select sql_cache * from t1 where s1=1;
-end;//
-delimiter ;//
-call f1();
---replace_result 1 3
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-call f1();
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-call f1();
-select sql_cache * from t1;
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-insert into t1 values (1);
-select sql_cache * from t1;
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-call f1();
-call f1();
-select sql_cache * from t1;
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-flush query cache;
-reset query cache;
-flush status;
-select sql_cache * from t1;
-select sql_cache * from t1 where s1=1;
-call f1();
-call f2();
-call f3();
-call f4();
-call f4();
-call f3();
-call f2();
-select sql_cache * from t1 where s1=1;
-insert into t1 values (2);
-call f1();
-select sql_cache * from t1 where s1=1;
-select sql_cache * from t1;
-call f1();
-call f3();
-call f3();
-call f1();
-
-drop procedure f1;
-drop procedure f2;
-drop procedure f3;
-drop procedure f4;
-drop table t1;
-
-#
-# Bug#14767 INSERT in SF + concurrent SELECT with query cache
-#
-connection default;
-SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
-SET GLOBAL log_bin_trust_function_creators = 1;
-
-reset query cache;
---disable_warnings
-drop function if exists f1;
---enable_warnings
-create table t1 (id int);
-delimiter |;
-create function f1 ()
- returns int
-begin
- declare i_var int;
- set i_var = sleep(3);
- insert into t1 values(3);
- set i_var = sleep(3);
- return 0;
-end;|
-delimiter ;|
-
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-
-connection con1;
-send select f1();
-connection con2;
-select sleep(4);
-select * from t1;
-connection con1;
-reap;
-connection con2;
-# This gives wrong result i.e. 't' table seems to be empty
-select * from t1;
-reset query cache;
-select * from t1;
-drop table t1;
-drop function f1;
-disconnect con1;
-disconnect con2;
-connection default;
-
-set GLOBAL query_cache_size=0;
-
-# End of 5.0 tests
-
-SET @@global.log_bin_trust_function_creators = @old_log_bin_trust_function_creators;
-
-#
-# Bug #30269 Query cache eats memory
-#
---disable_warnings
-DROP DATABASE IF EXISTS bug30269;
---enable_warnings
-FLUSH STATUS;
-CREATE DATABASE bug30269;
-USE bug30269;
-CREATE TABLE test1 (id int, name varchar(23));
-CREATE VIEW view1 AS SELECT * FROM test1;
-INSERT INTO test1 VALUES (5, 'testit');
-GRANT SELECT (id) ON TABLE bug30269.test1 TO 'bug30269'@'localhost';
-GRANT SELECT ON TABLE bug30269.view1 TO 'bug30269'@'localhost';
-set global query_cache_size= 81920;
-connect (bug30269, localhost, bug30269,,);
-connection bug30269;
-USE bug30269;
-show status like 'Qcache_queries_in_cache';
---echo # Select statement not stored in query cache because of column privileges.
-SELECT id FROM test1 WHERE id>2;
-show status like 'Qcache_queries_in_cache';
-SELECT id FROM view1 WHERE id>2;
-show status like 'Qcache_queries_in_cache';
-
-connection default;
-USE test;
-DROP DATABASE bug30269;
-disconnect bug30269;
-DROP USER 'bug30269'@'localhost';
-
-set GLOBAL query_cache_type=ON;
-set LOCAL query_cache_type=ON;
-set GLOBAL query_cache_limit=default;
-set GLOBAL query_cache_min_res_unit=default;
-set GLOBAL query_cache_size=default;
-
-#
-# Bug#3583 query cache doesn't work for stored procedures
-#
-delimiter |;
---disable_warnings
-drop table if exists t1|
---enable_warnings
-create table t1 (
- id char(16) not null default '',
- data int not null
-)|
---disable_warnings
-drop procedure if exists bug3583|
---enable_warnings
---disable_warnings
-drop procedure if exists bug3583|
---enable_warnings
-create procedure bug3583()
-begin
- declare c int;
-
- select * from t1;
- select count(*) into c from t1;
- select c;
-end|
-
-insert into t1 values ("x", 3), ("y", 5)|
-set @x = @@query_cache_size|
-set global query_cache_size = 10*1024*1024|
-
-flush status|
-flush query cache|
-show status like 'Qcache_hits'|
-call bug3583()|
-show status like 'Qcache_hits'|
-call bug3583()|
-call bug3583()|
-show status like 'Qcache_hits'|
-
-set global query_cache_size = @x|
-flush status|
-flush query cache|
-delete from t1|
-drop procedure bug3583|
-drop table t1|
-delimiter ;|
-
-# Wait till we reached the initial number of concurrent sessions
---source include/wait_until_count_sessions.inc
-SET GLOBAL query_cache_size=@query_cache_size_save;
-SET GLOBAL query_cache_type=@query_cache_type_save;
-set GLOBAL sql_mode=@sql_mode_save;
-
diff --git a/mysql-test/t/query_cache_ps_no_prot.test b/mysql-test/t/query_cache_ps_no_prot.test
deleted file mode 100644
index 4b2bb842e34..00000000000
--- a/mysql-test/t/query_cache_ps_no_prot.test
+++ /dev/null
@@ -1,22 +0,0 @@
-#################### t/query_cache_ps_no_prot.test #####################
-#
-# Test grants with query cache to be run when mysqltest was started
-# without any "--<whatever>-protocol".
-#
-# Last update:
-# 2007-05-03 ML - Move t/query_cache_sql_prepare.test to
-# include/query_cache_sql_prepare.inc
-# - Create this test as non "--<whatever>-protocol" variant.
-#
-
-# We cannot run on embedded server because we use multiple sessions.
---source include/not_embedded.inc
---source include/have_query_cache.inc
-let collation=utf8_unicode_ci;
---source include/have_collation.inc
-
-# The file with expected results fits only to a run without
---source include/no_protocol.inc
-
-# The main testing script
---source include/query_cache_sql_prepare.inc
diff --git a/mysql-test/t/query_cache_ps_ps_prot.test b/mysql-test/t/query_cache_ps_ps_prot.test
deleted file mode 100644
index d431ce349d2..00000000000
--- a/mysql-test/t/query_cache_ps_ps_prot.test
+++ /dev/null
@@ -1,26 +0,0 @@
-#################### t/query_cache_ps_ps_prot.test #####################
-#
-# Test grants with query cache to be run when mysqltest was started
-# without any "--<whatever>-protocol".
-#
-# Last update:
-# 2007-05-03 ML - Move t/query_cache_sql_prepare.test to
-# include/query_cache_sql_prepare.inc
-# - Create this test as "--ps-protocol" only variant.
-#
-
-# We cannot run on embedded server because we use multiple sessions.
---source include/not_embedded.inc
---source include/have_query_cache.inc
-let collation=utf8_unicode_ci;
---source include/have_collation.inc
-
-# The file with expected results fits only to a run with "--ps-protocol".
-if (`SELECT $SP_PROTOCOL + $CURSOR_PROTOCOL + $VIEW_PROTOCOL > 0
- OR $PS_PROTOCOL = 0`)
-{
- --skip Test requires: ps-protocol enabled, other protocols disabled
-}
-
-# The main testing script
---source include/query_cache_sql_prepare.inc
diff --git a/mysql-test/t/query_cache_with_views.test b/mysql-test/t/query_cache_with_views.test
deleted file mode 100644
index 9b03d0e99d0..00000000000
--- a/mysql-test/t/query_cache_with_views.test
+++ /dev/null
@@ -1,149 +0,0 @@
--- source include/have_query_cache.inc
-#
-# QUERY CACHE options for VIEWs
-#
---disable_warnings
-drop table if exists t1,t2,v1,v2,v3;
-drop view if exists t1,t2,v1,v2,v3;
---enable_warnings
-set GLOBAL query_cache_type=ON;
-set LOCAL query_cache_type=ON;
-set GLOBAL query_cache_size=1355776;
-flush status;
-create table t1 (a int, b int);
-
-# queries with following views should not be in query cache
-create view v1 (c,d) as select sql_no_cache a,b from t1;
-create view v2 (c,d) as select a+rand(),b from t1;
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-select * from v1;
-select * from v2;
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-select * from v1;
-select * from v2;
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-
-drop view v1,v2;
-
-# SQL_CACHE option
-set query_cache_type=demand;
-flush status;
-# query with view will be cached, but direct acess to table will not
-create view v1 (c,d) as select sql_cache a,b from t1;
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-select * from v1;
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-select * from t1;
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-select * from v1;
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-select * from t1;
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-drop view v1;
-set query_cache_type=default;
-
-drop table t1;
-
-#
-# invalidation of view
-#
-create table t1 (a int);
-insert into t1 values (1), (2), (3);
-create view v1 as select a from t1 where a > 1;
-select * from v1;
-alter view v1 as select a from t1 where a > 2;
-select * from v1;
-drop view v1;
--- error 1146
-select * from v1;
-drop table t1;
-
-#
-# join view with QC
-#
-create table t1 (a int, primary key (a), b int);
-create table t2 (a int, primary key (a), b int);
-insert into t2 values (1000, 2000);
-create view v3 (a,b) as select t1.a as a, t2.a as b from t1, t2;
-select * from v3;
-drop view v3;
-drop table t1, t2;
-
-#
-# Bug #13424 locking view with query cache enabled crashes server
-#
-create table t1(f1 int);
-insert into t1 values(1),(2),(3);
-create view v1 as select * from t1;
-set query_cache_wlock_invalidate=1;
-lock tables v1 read /*!32311 local */;
-unlock tables;
-set query_cache_wlock_invalidate=default;
-drop view v1;
-drop table t1;
-
-#
-# BUG#15119: returning temptable view from the query cache.
-#
-flush status;
-create table t1 (a int, b int);
-create algorithm=temptable view v1 as select * from t1;
-select * from v1;
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-select * from v1;
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-insert into t1 values (1,1);
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-select * from v1;
-select * from v1;
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-drop view v1;
-show status like "Qcache_queries_in_cache";
-show status like "Qcache_inserts";
-show status like "Qcache_hits";
-drop table t1;
-
---echo #
---echo # Bug46615 Assertion in Query_cache::invalidate in INSERT in a VIEW of a MERGE table
---echo #
-CREATE TABLE t1 (c1 INT, c2 INT);
-CREATE TABLE t2 LIKE t1;
-SET AUTOCOMMIT=OFF;
-CREATE VIEW t1_view AS SELECT c1 FROM t1 NATURAL JOIN t2 ;
-# Before the bug patch the below INSERT stmt used to
-# crash when other fields than the ones listed in the
-# view definition were used.
---error ER_BAD_FIELD_ERROR
-INSERT INTO t1_view (c1, c2) SELECT c1, c2 FROM t1;
-DROP TABLE t1;
-DROP TABLE t2;
-DROP VIEW t1_view;
-SET AUTOCOMMIT=DEFAULT;
-
-# Reset default environment.
-set GLOBAL query_cache_size=default;
-set GLOBAL query_cache_type=default;
diff --git a/mysql-test/t/quick_select_4161.test b/mysql-test/t/quick_select_4161.test
deleted file mode 100644
index 87323087622..00000000000
--- a/mysql-test/t/quick_select_4161.test
+++ /dev/null
@@ -1,54 +0,0 @@
-#
-# MDEV-4161 Assertion `status_var.memory_used == 0' fails in virtual THD::~THD()
-#
---source include/have_debug_sync.inc
-
-CREATE TABLE t1 (
- event_date date DEFAULT '0000-00-00' NOT NULL,
- type int(11) DEFAULT '0' NOT NULL,
- event_id int(11) DEFAULT '0' NOT NULL,
- PRIMARY KEY (event_date,type,event_id)
-);
-
-INSERT INTO t1 VALUES ('1999-07-10',100100,24), ('1999-07-11',100100,25),
-('1999-07-13',100600,0), ('1999-07-13',100600,4), ('1999-07-13',100600,26),
-('1999-07-14',100600,10), ('1999-07-15',100600,16), ('1999-07-15',100800,45),
-('1999-07-15',101000,47), ('1999-07-16',100800,46), ('1999-07-20',100600,5),
-('1999-07-20',100600,27), ('1999-07-21',100600,11), ('1999-07-22',100600,17),
-('1999-07-23',100100,39), ('1999-07-24',100100,39), ('1999-07-24',100500,40),
-('1999-07-25',100100,39), ('1999-07-27',100600,1), ('1999-07-27',100600,6),
-('1999-07-27',100600,28), ('1999-07-28',100600,12), ('1999-07-29',100500,41),
-('1999-07-29',100600,18), ('1999-07-30',100500,41), ('1999-07-31',100500,41),
-('1999-08-01',100700,34), ('1999-08-03',100600,7), ('1999-08-03',100600,29),
-('1999-08-04',100600,13), ('1999-08-05',100500,42), ('1999-08-05',100600,19),
-('1999-08-06',100500,42), ('1999-08-07',100500,42), ('1999-08-08',100500,42),
-('1999-08-10',100600,2), ('1999-08-10',100600,9), ('1999-08-10',100600,30),
-('1999-08-11',100600,14), ('1999-08-12',100600,20), ('1999-08-17',100500,8),
-('1999-08-17',100600,31), ('1999-08-18',100600,15), ('1999-08-19',100600,22),
-('1999-08-24',100600,3), ('1999-08-24',100600,32), ('1999-08-27',100500,43),
-('1999-08-31',100600,33), ('1999-09-17',100100,37), ('1999-09-18',100100,37),
-('1999-09-19',100100,37), ('2000-12-18',100700,38);
-
-connect (killee, localhost, root);
-
-let $id=`select connection_id()`;
-
-set debug_sync='inside_make_join_statistics signal killme wait_for done';
-send select event_date,type,event_id from t1 WHERE event_date >= "1999-07-01" AND event_date < "1999-07-15" AND (type=100600 OR type=100100) ORDER BY event_date;
-
-connection default;
-set debug_sync='now wait_for killme';
---replace_result $id %connection%
-eval kill $id;
-set debug_sync='now signal done';
-
-connection killee;
---error 1053,1927,2006,2013
-reap;
-
-connection default;
-disconnect killee;
-
-drop table t1;
-set debug_sync='reset';
-
diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test
deleted file mode 100644
index 36e0e32b28b..00000000000
--- a/mysql-test/t/range.test
+++ /dev/null
@@ -1,2046 +0,0 @@
-#
-# Problem with range optimizer
-#
---source include/have_innodb.inc
-
-CREATE TABLE t1 (
- event_date date DEFAULT '0000-00-00' NOT NULL,
- type int(11) DEFAULT '0' NOT NULL,
- event_id int(11) DEFAULT '0' NOT NULL,
- PRIMARY KEY (event_date,type,event_id)
-);
-
-INSERT INTO t1 VALUES ('1999-07-10',100100,24), ('1999-07-11',100100,25),
-('1999-07-13',100600,0), ('1999-07-13',100600,4), ('1999-07-13',100600,26),
-('1999-07-14',100600,10), ('1999-07-15',100600,16), ('1999-07-15',100800,45),
-('1999-07-15',101000,47), ('1999-07-16',100800,46), ('1999-07-20',100600,5),
-('1999-07-20',100600,27), ('1999-07-21',100600,11), ('1999-07-22',100600,17),
-('1999-07-23',100100,39), ('1999-07-24',100100,39), ('1999-07-24',100500,40),
-('1999-07-25',100100,39), ('1999-07-27',100600,1), ('1999-07-27',100600,6),
-('1999-07-27',100600,28), ('1999-07-28',100600,12), ('1999-07-29',100500,41),
-('1999-07-29',100600,18), ('1999-07-30',100500,41), ('1999-07-31',100500,41),
-('1999-08-01',100700,34), ('1999-08-03',100600,7), ('1999-08-03',100600,29),
-('1999-08-04',100600,13), ('1999-08-05',100500,42), ('1999-08-05',100600,19),
-('1999-08-06',100500,42), ('1999-08-07',100500,42), ('1999-08-08',100500,42),
-('1999-08-10',100600,2), ('1999-08-10',100600,9), ('1999-08-10',100600,30),
-('1999-08-11',100600,14), ('1999-08-12',100600,20), ('1999-08-17',100500,8),
-('1999-08-17',100600,31), ('1999-08-18',100600,15), ('1999-08-19',100600,22),
-('1999-08-24',100600,3), ('1999-08-24',100600,32), ('1999-08-27',100500,43),
-('1999-08-31',100600,33), ('1999-09-17',100100,37), ('1999-09-18',100100,37),
-('1999-09-19',100100,37), ('2000-12-18',100700,38);
-
-select event_date,type,event_id from t1 WHERE event_date >= "1999-07-01" AND event_date < "1999-07-15" AND (type=100600 OR type=100100) ORDER BY event_date;
-explain select event_date,type,event_id from t1 WHERE type = 100601 and event_date >= "1999-07-01" AND event_date < "1999-07-15" AND (type=100600 OR type=100100) ORDER BY event_date;
-select event_date,type,event_id from t1 WHERE event_date >= "1999-07-01" AND event_date <= "1999-07-15" AND (type=100600 OR type=100100) or event_date >= "1999-07-01" AND event_date <= "1999-07-15" AND type=100099;
-drop table t1;
-
-CREATE TABLE t1 (
- PAPER_ID smallint(6) DEFAULT '0' NOT NULL,
- YEAR smallint(6) DEFAULT '0' NOT NULL,
- ISSUE smallint(6) DEFAULT '0' NOT NULL,
- CLOSED tinyint(4) DEFAULT '0' NOT NULL,
- ISS_DATE date DEFAULT '0000-00-00' NOT NULL,
- PRIMARY KEY (PAPER_ID,YEAR,ISSUE)
-);
-INSERT INTO t1 VALUES (3,1999,34,0,'1999-07-12'), (1,1999,111,0,'1999-03-23'),
- (1,1999,222,0,'1999-03-23'), (3,1999,33,0,'1999-07-12'),
- (3,1999,32,0,'1999-07-12'), (3,1999,31,0,'1999-07-12'),
- (3,1999,30,0,'1999-07-12'), (3,1999,29,0,'1999-07-12'),
- (3,1999,28,0,'1999-07-12'), (1,1999,40,1,'1999-05-01'),
- (1,1999,41,1,'1999-05-01'), (1,1999,42,1,'1999-05-01'),
- (1,1999,46,1,'1999-05-01'), (1,1999,47,1,'1999-05-01'),
- (1,1999,48,1,'1999-05-01'), (1,1999,49,1,'1999-05-01'),
- (1,1999,50,0,'1999-05-01'), (1,1999,51,0,'1999-05-01'),
- (1,1999,200,0,'1999-06-28'), (1,1999,52,0,'1999-06-28'),
- (1,1999,53,0,'1999-06-28'), (1,1999,54,0,'1999-06-28'),
- (1,1999,55,0,'1999-06-28'), (1,1999,56,0,'1999-07-01'),
- (1,1999,57,0,'1999-07-01'), (1,1999,58,0,'1999-07-01'),
- (1,1999,59,0,'1999-07-01'), (1,1999,60,0,'1999-07-01'),
- (3,1999,35,0,'1999-07-12');
-select YEAR,ISSUE from t1 where PAPER_ID=3 and (YEAR>1999 or (YEAR=1999 and ISSUE>28)) order by YEAR,ISSUE;
-check table t1;
-repair table t1;
-drop table t1;
-
-CREATE TABLE t1 (
- id int(11) NOT NULL auto_increment,
- parent_id int(11) DEFAULT '0' NOT NULL,
- level tinyint(4) DEFAULT '0' NOT NULL,
- PRIMARY KEY (id),
- KEY parent_id (parent_id),
- KEY level (level)
-);
-INSERT INTO t1 VALUES (1,0,0), (3,1,1), (4,1,1), (8,2,2), (9,2,2), (17,3,2),
-(22,4,2), (24,4,2), (28,5,2), (29,5,2), (30,5,2), (31,6,2), (32,6,2), (33,6,2),
-(203,7,2), (202,7,2), (20,3,2), (157,0,0), (193,5,2), (40,7,2), (2,1,1),
-(15,2,2), (6,1,1), (34,6,2), (35,6,2), (16,3,2), (7,1,1), (36,7,2), (18,3,2),
-(26,5,2), (27,5,2), (183,4,2), (38,7,2), (25,5,2), (37,7,2), (21,4,2),
-(19,3,2), (5,1,1), (179,5,2);
-SELECT * FROM t1 WHERE level = 1 AND parent_id = 1;
-# The following select returned 0 rows in 3.23.8
-SELECT * FROM t1 WHERE level = 1 AND parent_id = 1 order by id;
-drop table t1;
-
-#
-# Testing of bug in range optimizer with many key parts and > and <
-#
-
-create table t1(
- Satellite varchar(25) not null,
- SensorMode varchar(25) not null,
- FullImageCornersUpperLeftLongitude double not null,
- FullImageCornersUpperRightLongitude double not null,
- FullImageCornersUpperRightLatitude double not null,
- FullImageCornersLowerRightLatitude double not null,
- index two (Satellite, SensorMode, FullImageCornersUpperLeftLongitude, FullImageCornersUpperRightLongitude, FullImageCornersUpperRightLatitude, FullImageCornersLowerRightLatitude));
-
-insert into t1 values("OV-3","PAN1",91,-92,40,50);
-insert into t1 values("OV-4","PAN1",91,-92,40,50);
-
-select * from t1 where t1.Satellite = "OV-3" and t1.SensorMode = "PAN1" and t1.FullImageCornersUpperLeftLongitude > -90.000000 and t1.FullImageCornersUpperRightLongitude < -82.000000;
-drop table t1;
-
-create table t1 ( aString char(100) not null default "", key aString (aString(10)) );
-insert t1 (aString) values ( "believe in myself" ), ( "believe" ), ("baaa" ), ( "believe in love");
-select * from t1 where aString < "believe in myself" order by aString;
-select * from t1 where aString > "believe in love" order by aString;
-alter table t1 drop key aString;
-select * from t1 where aString < "believe in myself" order by aString;
-select * from t1 where aString > "believe in love" order by aString;
-drop table t1;
-
-#
-# Problem with binary strings
-#
-
-CREATE TABLE t1 (
- t1ID int(10) unsigned NOT NULL auto_increment,
- art binary(1) NOT NULL default '',
- KNR char(5) NOT NULL default '',
- RECHNR char(6) NOT NULL default '',
- POSNR char(2) NOT NULL default '',
- ARTNR char(10) NOT NULL default '',
- TEX char(70) NOT NULL default '',
- PRIMARY KEY (t1ID),
- KEY IdxArt (art),
- KEY IdxKnr (KNR),
- KEY IdxArtnr (ARTNR)
-) ENGINE=MyISAM;
-
-INSERT INTO t1 (art) VALUES ('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
-('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
-('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
-('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
-('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
-('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
-('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
-('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
-('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
-('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
-('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
-('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
-('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
-('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
-('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
-('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
-('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
-('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
-('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
-('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
-('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
-('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
-('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
-('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
-('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
-('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
-('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
-('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),
-('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),
-('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),
-('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),
-('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),
-('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),
-('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),
-('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),
-('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),
-('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),
-('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j');
-select count(*) from t1 where upper(art) = 'J';
-select count(*) from t1 where art = 'J' or art = 'j';
-select count(*) from t1 where art = 'j' or art = 'J';
-select count(*) from t1 where art = 'j';
-select count(*) from t1 where art = 'J';
-drop table t1;
-#
-# BETWEEN problems
-#
-create table t1 (x int, y int, index(x), index(y));
-insert into t1 (x) values (1),(2),(3),(4),(5),(6),(7),(8),(9);
-update t1 set y=x;
-# between with only one end fixed
-explain select * from t1, t1 t2 where t1.y = 8 and t2.x between 7 and t1.y+0;
-explain select * from t1, t1 t2 where t1.y = 8 and t2.x >= 7 and t2.x <= t1.y+0;
-# between with both expressions on both ends
-explain select * from t1, t1 t2 where t1.y = 2 and t2.x between t1.y-1 and t1.y+1;
-explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= t1.y-1 and t2.x <= t1.y+1;
-# equation propagation
-explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 0 and t1.y;
-explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 0 and t2.x <= t1.y;
-# testing IN
-explain select count(*) from t1 where x in (1);
-explain select count(*) from t1 where x in (1,2);
-drop table t1;
-
-#
-# bug #1172: "Force index" option caused server crash
-#
-CREATE TABLE t1 (key1 int(11) NOT NULL default '0', KEY i1 (key1));
-INSERT INTO t1 VALUES (0),(0),(0),(0),(0),(1),(1);
-CREATE TABLE t2 (keya int(11) NOT NULL default '0', KEY j1 (keya));
-INSERT INTO t2 VALUES (0),(0),(1),(1),(2),(2);
-explain select * from t1, t2 where (t1.key1 <t2.keya + 1) and t2.keya=3;
-explain select * from t1 force index(i1), t2 force index(j1) where
- (t1.key1 <t2.keya + 1) and t2.keya=3;
-DROP TABLE t1,t2;
-
-#
-# bug #1724: use RANGE on more selective column instead of REF on less
-# selective
-
-CREATE TABLE t1 (
- a int(11) default NULL,
- b int(11) default NULL,
- KEY a (a),
- KEY b (b)
-) ENGINE=MyISAM;
-
-
-INSERT INTO t1 VALUES
-(1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,2),(10,2),
-(13,2),(14,2),(15,2),(16,2),(17,3),(17,3),(16,3),(17,3),(19,3),(20,3),
-(21,4),(22,5),(23,5),(24,5),(25,5),(26,5),(30,5),(31,5),(32,5),(33,5),
-(33,5),(33,5),(33,5),(33,5),(34,5),(35,5);
-
-# we expect that optimizer will choose index on A
-EXPLAIN SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
-SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
-DROP TABLE t1;
-
-#
-# Test problem with range optimzer and sub ranges
-#
-
-CREATE TABLE t1 (a int, b int, c int, INDEX (c,a,b));
-INSERT INTO t1 VALUES (1,0,0),(1,0,0),(1,0,0);
-INSERT INTO t1 VALUES (0,1,0),(0,1,0),(0,1,0);
-# -- First reports 3; second reports 6
-SELECT COUNT(*) FROM t1 WHERE (c=0 and a=1) or (c=0 and b=1);
-SELECT COUNT(*) FROM t1 WHERE (c=0 and b=1) or (c=0 and a=1);
-DROP TABLE t1;
-
-#
-# Test problem with range optimization over overlapping ranges (#2448)
-#
-
-CREATE TABLE t1 ( a int not null, b int not null, INDEX ab(a,b) );
-INSERT INTO t1 VALUES (47,1), (70,1), (15,1), (15, 4);
-SELECT * FROM t1
-WHERE
-(
- ( b =1 AND a BETWEEN 14 AND 21 ) OR
- ( b =2 AND a BETWEEN 16 AND 18 ) OR
- ( b =3 AND a BETWEEN 15 AND 19 ) OR
- (a BETWEEN 19 AND 47)
-);
-DROP TABLE t1;
-
-#
-# Test of problem with IN on many different keyparts. (Bug #4157)
-#
-
-CREATE TABLE t1 (
-id int( 11 ) unsigned NOT NULL AUTO_INCREMENT ,
-line int( 5 ) unsigned NOT NULL default '0',
-columnid int( 3 ) unsigned NOT NULL default '0',
-owner int( 3 ) unsigned NOT NULL default '0',
-ordinal int( 3 ) unsigned NOT NULL default '0',
-showid smallint( 6 ) unsigned NOT NULL default '1',
-tableid int( 1 ) unsigned NOT NULL default '1',
-content int( 5 ) unsigned NOT NULL default '188',
-PRIMARY KEY ( owner, id ) ,
-KEY menu( owner, showid, columnid ) ,
-KEY `COLUMN` ( owner, columnid, line ) ,
-KEY `LINES` ( owner, tableid, content, id ) ,
-KEY recount( owner, line )
-) ENGINE = MYISAM;
-
-INSERT into t1 (owner,id,columnid,line) values (11,15,15,1),(11,13,13,5);
-
-SELECT id, columnid, tableid, content, showid, line, ordinal FROM t1 WHERE owner=11 AND ((columnid IN ( 15, 13, 14 ) AND line IN ( 1, 2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 31 )) OR (columnid IN ( 13, 14 ) AND line IN ( 15 ))) LIMIT 0 , 30;
-drop table t1;
-
-#
-# test for a bug with in() and unique key
-#
-
-create table t1 (id int(10) primary key);
-insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-select id from t1 where id in (2,5,9) ;
-select id from t1 where id=2 or id=5 or id=9 ;
-drop table t1;
-create table t1 ( id1 int not null, id2 int not null, idnull int null, c char(20), primary key (id1,id2));
-insert into t1 values (0,1,NULL,"aaa"), (1,1,NULL,"aaa"), (2,1,NULL,"aaa"),
- (3,1,NULL,"aaa"), (4,1,NULL,"aaa"), (5,1,NULL,"aaa"),
- (6,1,NULL,"aaa"), (7,1,NULL,"aaa"), (8,1,NULL,"aaa"),
- (9,1,NULL,"aaa"), (10,1,NULL,"aaa"), (11,1,NULL,"aaa"),
- (12,1,NULL,"aaa"), (13,1,NULL,"aaa"), (14,1,NULL,"aaa"),
- (15,1,NULL,"aaa"), (16,1,NULL,"aaa"), (17,1,NULL,"aaa"),
- (18,1,NULL,"aaa"), (19,1,NULL,"aaa"), (20,1,NULL,"aaa");
-select a.id1, b.idnull from t1 as a, t1 as b where a.id2=1 and a.id1=1 and b.id1=a.idnull order by b.id2 desc limit 1;
-drop table t1;
-
-
-#
-# Problem with optimizing !=
-#
-
-create table t1 (
- id int not null auto_increment,
- name char(1) not null,
- uid int not null,
- primary key (id),
- index uid_index (uid));
-
-create table t2 (
- id int not null auto_increment,
- name char(1) not null,
- uid int not null,
- primary key (id),
- index uid_index (uid));
-
-insert into t1(id, uid, name) values(1, 0, ' ');
-insert into t1(uid, name) values(0, ' ');
-
-insert into t2(uid, name) select uid, name from t1;
-insert into t1(uid, name) select uid, name from t2;
-insert into t2(uid, name) select uid, name from t1;
-insert into t1(uid, name) select uid, name from t2;
-insert into t2(uid, name) select uid, name from t1;
-insert into t1(uid, name) select uid, name from t2;
-insert into t2(uid, name) select uid, name from t1;
-insert into t1(uid, name) select uid, name from t2;
-insert into t2(uid, name) select uid, name from t1;
-insert into t1(uid, name) select uid, name from t2;
-insert into t2(uid, name) select uid, name from t1;
-insert into t2(uid, name) select uid, name from t1;
-insert into t2(uid, name) select uid, name from t1;
-insert into t2(uid, name) select uid, name from t1;
-insert into t1(uid, name) select uid, name from t2;
-
-delete from t2;
-insert into t2(uid, name) values
- (1, CHAR(64+1)),
- (2, CHAR(64+2)),
- (3, CHAR(64+3)),
- (4, CHAR(64+4)),
- (5, CHAR(64+5)),
- (6, CHAR(64+6)),
- (7, CHAR(64+7)),
- (8, CHAR(64+8)),
- (9, CHAR(64+9)),
- (10, CHAR(64+10)),
- (11, CHAR(64+11)),
- (12, CHAR(64+12)),
- (13, CHAR(64+13)),
- (14, CHAR(64+14)),
- (15, CHAR(64+15)),
- (16, CHAR(64+16)),
- (17, CHAR(64+17)),
- (18, CHAR(64+18)),
- (19, CHAR(64+19)),
- (20, CHAR(64+20)),
- (21, CHAR(64+21)),
- (22, CHAR(64+22)),
- (23, CHAR(64+23)),
- (24, CHAR(64+24)),
- (25, CHAR(64+25)),
- (26, CHAR(64+26));
-
-insert into t1(uid, name) select uid, name from t2 order by uid;
-
-delete from t2;
-insert into t2(id, uid, name) select id, uid, name from t1;
-
-select count(*) from t1;
-select count(*) from t2;
-
-analyze table t1,t2;
-
-explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
-explain select * from t1, t2 where t1.uid=t2.uid AND t2.uid > 0;
-explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0;
-explain select * from t1, t2 where t1.uid=t2.uid AND t2.uid != 0;
-
-select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
-select * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0;
-
-drop table t1,t2;
-
-# Fix for bug#4488
-#
-create table t1 (x bigint unsigned not null);
-insert into t1(x) values (0xfffffffffffffff0);
-insert into t1(x) values (0xfffffffffffffff1);
-select * from t1;
-select count(*) from t1 where x>0;
-select count(*) from t1 where x=0;
-select count(*) from t1 where x<0;
-select count(*) from t1 where x < -16;
-select count(*) from t1 where x = -16;
-select count(*) from t1 where x > -16;
-select count(*) from t1 where x = 18446744073709551601;
-
-
-create table t2 (x bigint not null);
-insert into t2(x) values (-16);
-insert into t2(x) values (-15);
-select * from t2;
-select count(*) from t2 where x>0;
-select count(*) from t2 where x=0;
-select count(*) from t2 where x<0;
-select count(*) from t2 where x < -16;
-select count(*) from t2 where x = -16;
-select count(*) from t2 where x > -16;
-select count(*) from t2 where x = 18446744073709551601;
-drop table t1,t2;
-
---disable_warnings
-create table t1 (x bigint unsigned not null primary key) engine=innodb;
---enable_warnings
-insert into t1(x) values (0xfffffffffffffff0);
-insert into t1(x) values (0xfffffffffffffff1);
-select * from t1;
-select count(*) from t1 where x>0;
-select count(*) from t1 where x=0;
-select count(*) from t1 where x<0;
-select count(*) from t1 where x < -16;
-select count(*) from t1 where x = -16;
-select count(*) from t1 where x > -16;
-select count(*) from t1 where x = 18446744073709551601;
-
-drop table t1;
-
-#
-# Bug #11185 incorrect comparison of unsigned int to signed constant
-#
-create table t1 (a bigint unsigned);
-create index t1i on t1(a);
-insert into t1 select 18446744073709551615;
-insert into t1 select 18446744073709551614;
-
-explain select * from t1 where a <> -1;
-select * from t1 where a <> -1;
-explain select * from t1 where a > -1 or a < -1;
-select * from t1 where a > -1 or a < -1;
-explain select * from t1 where a > -1;
-select * from t1 where a > -1;
-explain select * from t1 where a < -1;
-select * from t1 where a < -1;
-
-drop table t1;
-
-#
-# Bug #6045: Binary Comparison regression in MySQL 4.1
-# Binary searches didn't use a case insensitive index.
-#
-set names latin1;
-create table t1 (a char(10), b text, key (a)) character set latin1;
-INSERT INTO t1 (a) VALUES
-('111'),('222'),('222'),('222'),('222'),('444'),('aaa'),('AAA'),('bbb');
-# all these three can be optimized
-explain select * from t1 where a='aaa';
-explain select * from t1 where a=binary 'aaa';
-explain select * from t1 where a='aaa' collate latin1_bin;
-# this one cannot:
-explain select * from t1 where a='aaa' collate latin1_german1_ci;
-drop table t1;
-
-# Test for BUG#9348 "result for WHERE A AND (B OR C) differs from WHERE a AND (C OR B)"
---disable_warnings
-CREATE TABLE t1 (
- `CLIENT` char(3) character set latin1 collate latin1_bin NOT NULL default '000',
- `ARG1` char(3) character set latin1 collate latin1_bin NOT NULL default '',
- `ARG2` char(3) character set latin1 collate latin1_bin NOT NULL default '',
- `FUNCTION` varchar(10) character set latin1 collate latin1_bin NOT NULL default '',
- `FUNCTINT` int(11) NOT NULL default '0',
- KEY `VERI_CLNT~2` (`ARG1`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
---enable_warnings
-
-INSERT INTO t1 VALUES ('000',' 0',' 0','Text 001',0), ('000',' 0',' 1','Text 002',0),
- ('000',' 1',' 2','Text 003',0), ('000',' 2',' 3','Text 004',0),
- ('001',' 3',' 0','Text 017',0);
-
-SELECT count(*) FROM t1 WHERE CLIENT='000' AND (ARG1 != ' 1' OR ARG1 != ' 2');
-
-SELECT count(*) FROM t1 WHERE CLIENT='000' AND (ARG1 != ' 2' OR ARG1 != ' 1');
-drop table t1;
-
-# BUG#16168: Wrong range optimizer results, "Use_count: Wrong count ..."
-# warnings in server stderr.
-create table t1 (a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-CREATE TABLE t2 (
- pk1 int(11) NOT NULL,
- pk2 int(11) NOT NULL,
- pk3 int(11) NOT NULL,
- pk4 int(11) NOT NULL,
- filler char(82),
- PRIMARY KEY (pk1,pk2,pk3,pk4)
-) DEFAULT CHARSET=latin1;
-
-insert into t2 select 1, A.a+10*B.a, 432, 44, 'fillerZ' from t1 A, t1 B;
-INSERT INTO t2 VALUES (2621, 2635, 0, 0,'filler'), (2621, 2635, 1, 0,'filler'),
- (2621, 2635, 10, 0,'filler'), (2621, 2635, 11, 0,'filler'),
- (2621, 2635, 14, 0,'filler'), (2621, 2635, 1000015, 0,'filler');
-
-SELECT * FROM t2
-WHERE ((((pk4 =0) AND (pk1 =2621) AND (pk2 =2635)))
-OR ((pk4 =1) AND (((pk1 IN ( 7, 2, 1 ))) OR (pk1 =522)) AND ((pk2 IN ( 0, 2635))))
-) AND (pk3 >=1000000);
-drop table t1, t2;
-
-#
-# Bug #20732: Partial index and long sjis search with '>' fails sometimes
-#
-
-create table t1(a char(2), key(a(1)));
-insert into t1 values ('x'), ('xx');
-explain select a from t1 where a > 'x';
-select a from t1 where a > 'x';
-drop table t1;
-
-#
-# Bug #24776: assertion abort for 'range checked for each record'
-#
-
-CREATE TABLE t1 (
- OXID varchar(32) COLLATE latin1_german2_ci NOT NULL DEFAULT '',
- OXPARENTID varchar(32) COLLATE latin1_german2_ci NOT NULL DEFAULT 'oxrootid',
- OXLEFT int NOT NULL DEFAULT '0',
- OXRIGHT int NOT NULL DEFAULT '0',
- OXROOTID varchar(32) COLLATE latin1_german2_ci NOT NULL DEFAULT '',
- PRIMARY KEY (OXID),
- KEY OXNID (OXID),
- KEY OXLEFT (OXLEFT),
- KEY OXRIGHT (OXRIGHT),
- KEY OXROOTID (OXROOTID)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci;
-
-INSERT INTO t1 VALUES
-('d8c4177d09f8b11f5.52725521','oxrootid',1,40,'d8c4177d09f8b11f5.52725521'),
-('d8c4177d151affab2.81582770','d8c4177d09f8b11f5.52725521',2,3,
- 'd8c4177d09f8b11f5.52725521'),
-('d8c4177d206a333d2.74422679','d8c4177d09f8b11f5.52725521',4,5,
- 'd8c4177d09f8b11f5.52725521'),
-('d8c4177d225791924.30714720','d8c4177d09f8b11f5.52725521',6,7,
- 'd8c4177d09f8b11f5.52725521'),
-('d8c4177d2380fc201.39666693','d8c4177d09f8b11f5.52725521',8,9,
- 'd8c4177d09f8b11f5.52725521'),
-('d8c4177d24ccef970.14957924','d8c4177d09f8b11f5.52725521',10,11,
- 'd8c4177d09f8b11f5.52725521');
-INSERT INTO t1 VALUES
-('d8c4177d09f8b11f5.52725522','oxrootid',1,40,'d8c4177d09f8b11f5.52725522'),
-('d8c4177d151affab2.81582771','d8c4177d09f8b11f5.52725521',2,3,
- 'd8c4177d09f8b11f5.52725522'),
-('d8c4177d206a333d2.74422678','d8c4177d09f8b11f5.52725521',4,5,
- 'd8c4177d09f8b11f5.52725522'),
-('d8c4177d225791924.30714721','d8c4177d09f8b11f5.52725521',6,7,
- 'd8c4177d09f8b11f5.52725522'),
-('d8c4177d2380fc201.39666694','d8c4177d09f8b11f5.52725521',8,9,
- 'd8c4177d09f8b11f5.52725522'),
-('d8c4177d24ccef970.14957925','d8c4177d09f8b11f5.52725521',10,11,
- 'd8c4177d09f8b11f5.52725522');
-
-EXPLAIN
-SELECT s.oxid FROM t1 v, t1 s
- WHERE
- v.oxrootid ='d8c4177d09f8b11f5.52725521' AND
- s.oxleft > v.oxleft AND s.oxleft < v.oxright;
-
-SELECT s.oxid FROM t1 v, t1 s
- WHERE
- v.oxrootid ='d8c4177d09f8b11f5.52725521' AND
- s.oxleft > v.oxleft AND s.oxleft < v.oxright;
-
-DROP TABLE t1;
-
-# BUG#26624 high mem usage (crash) in range optimizer (depends on order of fields in where)
-create table t1 (
- c1 char(10), c2 char(10), c3 char(10), c4 char(10),
- c5 char(10), c6 char(10), c7 char(10), c8 char(10),
- c9 char(10), c10 char(10), c11 char(10), c12 char(10),
- c13 char(10), c14 char(10), c15 char(10), c16 char(10),
- index(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,c13,c14,c15,c16)
-);
-insert into t1 (c1) values ('1'),('1'),('1'),('1');
-
-# This must run without crash and fast:
-select * from t1 where
- c1 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
- "abcdefg1", "123456781", "qwertyui1", "asddfg1",
- "abcdefg2", "123456782", "qwertyui2", "asddfg2",
- "abcdefg3", "123456783", "qwertyui3", "asddfg3",
- "abcdefg4", "123456784", "qwertyui4", "asddfg4",
- "abcdefg5", "123456785", "qwertyui5", "asddfg5",
- "abcdefg6", "123456786", "qwertyui6", "asddfg6",
- "abcdefg7", "123456787", "qwertyui7", "asddfg7",
- "abcdefg8", "123456788", "qwertyui8", "asddfg8",
- "abcdefg9", "123456789", "qwertyui9", "asddfg9",
- "abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
- "abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
- "abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
- and c2 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
- "abcdefg1", "123456781", "qwertyui1", "asddfg1",
- "abcdefg2", "123456782", "qwertyui2", "asddfg2",
- "abcdefg3", "123456783", "qwertyui3", "asddfg3",
- "abcdefg4", "123456784", "qwertyui4", "asddfg4",
- "abcdefg5", "123456785", "qwertyui5", "asddfg5",
- "abcdefg6", "123456786", "qwertyui6", "asddfg6",
- "abcdefg7", "123456787", "qwertyui7", "asddfg7",
- "abcdefg8", "123456788", "qwertyui8", "asddfg8",
- "abcdefg9", "123456789", "qwertyui9", "asddfg9",
- "abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
- "abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
- "abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
- and c3 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
- "abcdefg1", "123456781", "qwertyui1", "asddfg1",
- "abcdefg2", "123456782", "qwertyui2", "asddfg2",
- "abcdefg3", "123456783", "qwertyui3", "asddfg3",
- "abcdefg4", "123456784", "qwertyui4", "asddfg4",
- "abcdefg5", "123456785", "qwertyui5", "asddfg5",
- "abcdefg6", "123456786", "qwertyui6", "asddfg6",
- "abcdefg7", "123456787", "qwertyui7", "asddfg7",
- "abcdefg8", "123456788", "qwertyui8", "asddfg8",
- "abcdefg9", "123456789", "qwertyui9", "asddfg9",
- "abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
- "abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
- "abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
- and c4 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
- "abcdefg1", "123456781", "qwertyui1", "asddfg1",
- "abcdefg2", "123456782", "qwertyui2", "asddfg2",
- "abcdefg3", "123456783", "qwertyui3", "asddfg3",
- "abcdefg4", "123456784", "qwertyui4", "asddfg4",
- "abcdefg5", "123456785", "qwertyui5", "asddfg5",
- "abcdefg6", "123456786", "qwertyui6", "asddfg6",
- "abcdefg7", "123456787", "qwertyui7", "asddfg7",
- "abcdefg8", "123456788", "qwertyui8", "asddfg8",
- "abcdefg9", "123456789", "qwertyui9", "asddfg9",
- "abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
- "abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
- "abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
- and c5 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
- "abcdefg1", "123456781", "qwertyui1", "asddfg1",
- "abcdefg2", "123456782", "qwertyui2", "asddfg2",
- "abcdefg3", "123456783", "qwertyui3", "asddfg3",
- "abcdefg4", "123456784", "qwertyui4", "asddfg4",
- "abcdefg5", "123456785", "qwertyui5", "asddfg5",
- "abcdefg6", "123456786", "qwertyui6", "asddfg6",
- "abcdefg7", "123456787", "qwertyui7", "asddfg7",
- "abcdefg8", "123456788", "qwertyui8", "asddfg8",
- "abcdefg9", "123456789", "qwertyui9", "asddfg9",
- "abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
- "abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
- "abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
- and c6 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
- "abcdefg1", "123456781", "qwertyui1", "asddfg1",
- "abcdefg2", "123456782", "qwertyui2", "asddfg2",
- "abcdefg3", "123456783", "qwertyui3", "asddfg3",
- "abcdefg4", "123456784", "qwertyui4", "asddfg4",
- "abcdefg5", "123456785", "qwertyui5", "asddfg5",
- "abcdefg6", "123456786", "qwertyui6", "asddfg6",
- "abcdefg7", "123456787", "qwertyui7", "asddfg7",
- "abcdefg8", "123456788", "qwertyui8", "asddfg8",
- "abcdefg9", "123456789", "qwertyui9", "asddfg9",
- "abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
- "abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
- "abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
- and c7 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
- "abcdefg1", "123456781", "qwertyui1", "asddfg1",
- "abcdefg2", "123456782", "qwertyui2", "asddfg2",
- "abcdefg3", "123456783", "qwertyui3", "asddfg3",
- "abcdefg4", "123456784", "qwertyui4", "asddfg4",
- "abcdefg5", "123456785", "qwertyui5", "asddfg5",
- "abcdefg6", "123456786", "qwertyui6", "asddfg6",
- "abcdefg7", "123456787", "qwertyui7", "asddfg7",
- "abcdefg8", "123456788", "qwertyui8", "asddfg8",
- "abcdefg9", "123456789", "qwertyui9", "asddfg9",
- "abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
- "abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
- "abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
- and c8 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
- "abcdefg1", "123456781", "qwertyui1", "asddfg1",
- "abcdefg2", "123456782", "qwertyui2", "asddfg2",
- "abcdefg3", "123456783", "qwertyui3", "asddfg3",
- "abcdefg4", "123456784", "qwertyui4", "asddfg4",
- "abcdefg5", "123456785", "qwertyui5", "asddfg5",
- "abcdefg6", "123456786", "qwertyui6", "asddfg6",
- "abcdefg7", "123456787", "qwertyui7", "asddfg7",
- "abcdefg8", "123456788", "qwertyui8", "asddfg8",
- "abcdefg9", "123456789", "qwertyui9", "asddfg9",
- "abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
- "abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
- "abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
- and c9 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
- "abcdefg1", "123456781", "qwertyui1", "asddfg1",
- "abcdefg2", "123456782", "qwertyui2", "asddfg2",
- "abcdefg3", "123456783", "qwertyui3", "asddfg3",
- "abcdefg4", "123456784", "qwertyui4", "asddfg4",
- "abcdefg5", "123456785", "qwertyui5", "asddfg5",
- "abcdefg6", "123456786", "qwertyui6", "asddfg6",
- "abcdefg7", "123456787", "qwertyui7", "asddfg7",
- "abcdefg8", "123456788", "qwertyui8", "asddfg8",
- "abcdefg9", "123456789", "qwertyui9", "asddfg9",
- "abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
- "abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
- "abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
- and c10 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh",
- "abcdefg1", "123456781", "qwertyui1", "asddfg1",
- "abcdefg2", "123456782", "qwertyui2", "asddfg2",
- "abcdefg3", "123456783", "qwertyui3", "asddfg3",
- "abcdefg4", "123456784", "qwertyui4", "asddfg4",
- "abcdefg5", "123456785", "qwertyui5", "asddfg5",
- "abcdefg6", "123456786", "qwertyui6", "asddfg6",
- "abcdefg7", "123456787", "qwertyui7", "asddfg7",
- "abcdefg8", "123456788", "qwertyui8", "asddfg8",
- "abcdefg9", "123456789", "qwertyui9", "asddfg9",
- "abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
- "abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
- "abcdefgC", "12345678C", "qwertyuiC", "asddfgC");
-drop table t1;
---echo End of 4.1 tests
-
-#
-# Test for optimization request #10561: to use keys for
-# NOT IN (c1,...,cn) and NOT BETWEEN c1 AND c2
-#
-
-CREATE TABLE t1 (
- id int(11) NOT NULL auto_increment,
- status varchar(20),
- PRIMARY KEY (id),
- KEY (status)
-);
-
-INSERT INTO t1 VALUES
-(1,'B'), (2,'B'), (3,'B'), (4,'B'), (5,'B'), (6,'B'),
-(7,'B'), (8,'B'), (9,'B'), (10,'B'), (11,'B'), (12,'B'),
-(13,'B'), (14,'B'), (15,'B'), (16,'B'), (17,'B'), (18,'B'),
-(19,'B'), (20,'B'), (21,'B'), (22,'B'), (23,'B'), (24,'B'),
-(25,'A'), (26,'A'), (27,'A'), (28,'A'), (29,'A'), (30,'A'),
-(31,'A'), (32,'A'), (33,'A'), (34,'A'), (35,'A'), (36,'A'),
-(37,'A'), (38,'A'), (39,'A'), (40,'A'), (41,'A'), (42,'A'),
-(43,'A'), (44,'A'), (45,'A'), (46,'A'), (47,'A'), (48,'A'),
-(49,'A'), (50,'A'), (51,'A'), (52,'A'), (53,'C'), (54,'C'),
-(55,'C'), (56,'C'), (57,'C'), (58,'C'), (59,'C'), (60,'C');
-
-EXPLAIN SELECT * FROM t1 WHERE status <> 'A' AND status <> 'B';
-EXPLAIN SELECT * FROM t1 WHERE status NOT IN ('A','B');
-
-SELECT * FROM t1 WHERE status <> 'A' AND status <> 'B';
-SELECT * FROM t1 WHERE status NOT IN ('A','B');
-
-EXPLAIN SELECT status FROM t1 WHERE status <> 'A' AND status <> 'B';
-EXPLAIN SELECT status FROM t1 WHERE status NOT IN ('A','B');
-
-EXPLAIN SELECT * FROM t1 WHERE status NOT BETWEEN 'A' AND 'B';
-EXPLAIN SELECT * FROM t1 WHERE status < 'A' OR status > 'B';
-
-SELECT * FROM t1 WHERE status NOT BETWEEN 'A' AND 'B';
-SELECT * FROM t1 WHERE status < 'A' OR status > 'B';
-
-DROP TABLE t1;
-
-#
-# Test for bug #10031: range to be used over a view
-#
-
-CREATE TABLE t1 (a int, b int, primary key(a,b));
-
-INSERT INTO t1 VALUES
- (1,1),(1,2),(1,3),(2,1),(2,2),(2,3),(3,1),(3,2),(3,3),(4,1),(4,2),(4,3);
-
-CREATE VIEW v1 as SELECT a,b FROM t1 WHERE b=3;
-
-EXPLAIN SELECT a,b FROM t1 WHERE a < 2 and b=3;
-EXPLAIN SELECT a,b FROM v1 WHERE a < 2 and b=3;
-
-EXPLAIN SELECT a,b FROM t1 WHERE a < 2;
-EXPLAIN SELECT a,b FROM v1 WHERE a < 2;
-
-SELECT a,b FROM t1 WHERE a < 2 and b=3;
-SELECT a,b FROM v1 WHERE a < 2 and b=3;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-#
-# Bug #11853: DELETE statement with a NOT (LIKE/<=>) where condition
-# for an indexed attribute
-#
-
-CREATE TABLE t1 (name varchar(15) NOT NULL, KEY idx(name));
-INSERT INTO t1 VALUES ('Betty'), ('Anna');
-
-SELECT * FROM t1;
-DELETE FROM t1 WHERE name NOT LIKE 'A%a';
-SELECT * FROM t1;
-
-DROP TABLE t1;
-
-CREATE TABLE t1 (a int, KEY idx(a));
-INSERT INTO t1 VALUES (NULL), (1), (2), (3);
-
-SELECT * FROM t1;
-DELETE FROM t1 WHERE NOT(a <=> 2);
-SELECT * FROM t1;
-
-DROP TABLE t1;
-
-#
-# BUG#13317: range optimization doesn't work for IN over VIEW.
-#
-create table t1 (a int, b int, primary key(a,b));
-create view v1 as select a, b from t1;
-
-INSERT INTO `t1` VALUES
-(0,0),(1,0),(2,0),(3,0),(4,0),(5,1),(6,1),(7,1),(8,1),(9,1),(10,2),(11,2),(12,2)
-,(13,2),(14,2),(15,3),(16,3),(17,3),(18,3),(19,3);
-
---replace_column 9 #
-explain select * from t1 where a in (3,4) and b in (1,2,3);
---replace_column 9 #
-explain select * from v1 where a in (3,4) and b in (1,2,3);
---replace_column 9 #
-explain select * from t1 where a between 3 and 4 and b between 1 and 2;
---replace_column 9 #
-explain select * from v1 where a between 3 and 4 and b between 1 and 2;
-
-drop view v1;
-drop table t1;
-
-# BUG#13455:
-create table t3 (a int);
-insert into t3 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1 (a varchar(10), filler char(200), key(a)) charset=binary;
-insert into t1 values ('a','');
-insert into t1 values ('a ','');
-insert into t1 values ('a ', '');
-insert into t1 select concat('a', 1000 + A.a + 10 * (B.a + 10 * C.a)), ''
- from t3 A, t3 B, t3 C;
-
-create table t2 (a varchar(10), filler char(200), key(a));
-insert into t2 select * from t1;
-
---replace_column 9 #
-explain select * from t1 where a between 'a' and 'a ';
---replace_column 9 #
-explain select * from t1 where a = 'a' or a='a ';
-
---replace_column 9 #
-explain select * from t2 where a between 'a' and 'a ';
---replace_column 9 #
-explain select * from t2 where a = 'a' or a='a ';
-
-update t1 set a='b' where a<>'a';
---replace_column 9 #
-explain select * from t1 where a not between 'b' and 'b';
-select a, hex(filler) from t1 where a not between 'b' and 'b';
-
-drop table t1,t2,t3;
-
-#
-# BUG#21282
-#
-create table t1 (a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t2 (a int, key(a));
-insert into t2 select 2*(A.a + 10*(B.a + 10*C.a)) from t1 A, t1 B, t1 C;
-
-set @a="select * from t2 force index (a) where a NOT IN(0";
-select count(*) from (select @a:=concat(@a, ',', a) from t2 ) Z;
-set @a=concat(@a, ')');
-
-insert into t2 values (11),(13),(15);
-
-set @b= concat("explain ", @a);
-
-prepare stmt1 from @b;
-execute stmt1;
-
-prepare stmt1 from @a;
-execute stmt1;
-
-drop table t1, t2;
-
-#
-# Bug #18165: range access for BETWEEN with a constant for the first argument
-#
-
-CREATE TABLE t1 (
- id int NOT NULL DEFAULT '0',
- b int NOT NULL DEFAULT '0',
- c int NOT NULL DEFAULT '0',
- INDEX idx1(b,c), INDEX idx2(c));
-
-INSERT INTO t1(id) VALUES (1), (2), (3), (4), (5), (6), (7), (8);
-
-INSERT INTO t1(b,c) VALUES (3,4), (3,4);
-
-SELECT * FROM t1 WHERE b<=3 AND 3<=c;
-SELECT * FROM t1 WHERE 3 BETWEEN b AND c;
-
-EXPLAIN SELECT * FROM t1 WHERE b<=3 AND 3<=c;
-EXPLAIN SELECT * FROM t1 WHERE 3 BETWEEN b AND c;
-
-SELECT * FROM t1 WHERE 0 < b OR 0 > c;
-SELECT * FROM t1 WHERE 0 NOT BETWEEN b AND c;
-
-EXPLAIN SELECT * FROM t1 WHERE 0 < b OR 0 > c;
-EXPLAIN SELECT * FROM t1 WHERE 0 NOT BETWEEN b AND c;
-
-DROP TABLE t1;
-
-#
-# Bug #16249: different results for a range with an without index
-# when a range condition use an invalid datetime constant
-#
-
-CREATE TABLE t1 (
- item char(20) NOT NULL default '',
- started datetime NOT NULL default '0000-00-00 00:00:00',
- price decimal(16,3) NOT NULL default '0.000',
- PRIMARY KEY (item,started)
-) ENGINE=MyISAM;
-
-INSERT INTO t1 VALUES
-('A1','2005-11-01 08:00:00',1000),
-('A1','2005-11-15 00:00:00',2000),
-('A1','2005-12-12 08:00:00',3000),
-('A2','2005-12-01 08:00:00',1000);
-
-EXPLAIN SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
-SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
-SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-02 00:00:00';
-
-DROP INDEX `PRIMARY` ON t1;
-
-EXPLAIN SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
-SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00';
-SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-02 00:00:00';
-
-DROP TABLE t1;
-
---echo
---echo BUG#32198 "Comparison of DATE with DATETIME still not using indexes correctly"
---echo
-CREATE TABLE t1 (
- id int(11) NOT NULL auto_increment,
- dateval date default NULL,
- PRIMARY KEY (id),
- KEY dateval (dateval)
-) AUTO_INCREMENT=173;
-
-INSERT INTO t1 VALUES
-(1,'2007-01-01'),(2,'2007-01-02'),(3,'2007-01-03'),(4,'2007-01-04'),
-(5,'2007-01-05'),(6,'2007-01-06'),(7,'2007-01-07'),(8,'2007-01-08'),
-(9,'2007-01-09'),(10,'2007-01-10'),(11,'2007-01-11');
-
---echo This must use range access:
-explain select * from t1 where dateval >= '2007-01-01 00:00:00' and dateval <= '2007-01-02 23:59:59';
-
-drop table t1;
-
-#
-# Bug #33833: different or-ed predicates were erroneously merged into one that
-# resulted in ref access instead of range access and a wrong result set
-#
-
-CREATE TABLE t1 (
- a varchar(32), index (a)
-) DEFAULT CHARSET=latin1 COLLATE=latin1_bin;
-
-INSERT INTO t1 VALUES
- ('B'), ('A'), ('A'), ('C'), ('B'), ('A'), ('A');
-
-SELECT a FROM t1 WHERE a='b' OR a='B';
-EXPLAIN SELECT a FROM t1 WHERE a='b' OR a='B';
-
-DROP TABLE t1;
-
-#
-# Bug #34731: highest possible value for INT erroneously filtered by WHERE
-#
-
-# test UNSIGNED. only occurs when indexed.
-CREATE TABLE t1 (f1 TINYINT(11) UNSIGNED NOT NULL, PRIMARY KEY (f1));
-
-INSERT INTO t1 VALUES (127),(254),(0),(1),(255);
-
-# test upper bound
-# count 5
-SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 256;
-SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 256.0;
-# count 4
-SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 255;
-
-# show we don't fiddle with lower bound on UNSIGNED
-# count 0
-SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < -1;
-# count 5
-SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -1;
-
-DROP TABLE t1;
-
-
-# test signed. only occurs when index.
-CREATE TABLE t1 ( f1 TINYINT(11) NOT NULL, PRIMARY KEY (f1));
-
-INSERT INTO t1 VALUES (127),(126),(0),(-128),(-127);
-
-# test upper bound
-# count 5
-SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 128;
-SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 128.0;
-# count 4
-SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 127;
-
-# test lower bound
-# count 5
-SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -129;
-SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -129.0;
-# count 4
-SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -128;
-
-DROP TABLE t1;
-
-# End of 5.0 tests
-
-# BUG#22393 fix: Adjust 'ref' estimate if we have 'range' estimate for
-# a smaller scan interval
-create table t1 (a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t2 (a int, b int, filler char(100));
-insert into t2 select A.a + 10 * (B.a + 10 * C.a), 10, 'filler' from t1 A,
-t1 B, t1 C where A.a < 5;
-
-insert into t2 select 1000, b, 'filler' from t2;
-alter table t2 add index (a,b);
-# t2 values
-# ( 1 , 10, 'filler')
-# ( 2 , 10, 'filler')
-# ( 3 , 10, 'filler')
-# (... , 10, 'filler')
-# ...
-# (1000, 10, 'filler') - 500 times
-
-# 500 rows, 1 row
-
-select 'In following EXPLAIN the access method should be ref, #rows~=500 (and not 2)' Z;
-explain select * from t2 where a=1000 and b<11;
-
-drop table t1, t2;
-
-#
-# Bug#42846: wrong result returned for range scan when using covering index
-#
-CREATE TABLE t1( a INT, b INT, KEY( a, b ) );
-
-CREATE TABLE t2( a INT, b INT, KEY( a, b ) );
-
-CREATE TABLE t3( a INT, b INT, KEY( a, b ) );
-
-INSERT INTO t1( a, b )
-VALUES (0, 1), (1, 2), (1, 4), (2, 3), (5, 0), (9, 7);
-
-INSERT INTO t2( a, b )
-VALUES ( 1, 1), ( 2, 1), ( 3, 1), ( 4, 1), ( 5, 1),
- ( 6, 1), ( 7, 1), ( 8, 1), ( 9, 1), (10, 1),
- (11, 1), (12, 1), (13, 1), (14, 1), (15, 1),
- (16, 1), (17, 1), (18, 1), (19, 1), (20, 1);
-
-INSERT INTO t2 SELECT a, 2 FROM t2 WHERE b = 1;
-INSERT INTO t2 SELECT a, 3 FROM t2 WHERE b = 1;
-
-# To make range scan compelling to the optimizer
-INSERT INTO t2 SELECT -1, -1 FROM t2;
-INSERT INTO t2 SELECT -1, -1 FROM t2;
-INSERT INTO t2 SELECT -1, -1 FROM t2;
-
-INSERT INTO t3
-VALUES (1, 0), (2, 0), (3, 0), (4, 0), (5, 0),
- (6, 0), (7, 0), (8, 0), (9, 0), (10, 0);
-
-# To make range scan compelling to the optimizer
-INSERT INTO t3 SELECT * FROM t3 WHERE a = 10;
-INSERT INTO t3 SELECT * FROM t3 WHERE a = 10;
-
-
-#
-# Problem#1 Test queries. Will give missing results unless Problem#1 is fixed.
-# With one exception, they are independent of Problem#2.
-#
-SELECT * FROM t1 WHERE
-3 <= a AND a < 5 OR
-5 < a AND b = 3 OR
-3 <= a;
-
-EXPLAIN
-SELECT * FROM t1 WHERE
-3 <= a AND a < 5 OR
-5 < a AND b = 3 OR
-3 <= a;
-
-# Query below: Tests both Problem#1 and Problem#2 (EXPLAIN differs as well)
-SELECT * FROM t1 WHERE
-3 <= a AND a < 5 OR
-5 <= a AND b = 3 OR
-3 <= a;
-
-EXPLAIN
-SELECT * FROM t1 WHERE
-3 <= a AND a < 5 OR
-5 <= a AND b = 3 OR
-3 <= a;
-
-SELECT * FROM t1 WHERE
-3 <= a AND a <= 5 OR
-5 <= a AND b = 3 OR
-3 <= a;
-
-EXPLAIN
-SELECT * FROM t1 WHERE
-3 <= a AND a <= 5 OR
-5 <= a AND b = 3 OR
-3 <= a;
-
-SELECT * FROM t1 WHERE
-3 <= a AND a <= 5 OR
-3 <= a;
-
-EXPLAIN
-SELECT * FROM t1 WHERE
-3 <= a AND a <= 5 OR
-3 <= a;
-
-#
-# Problem#2 Test queries.
-# These queries will give missing results if Problem#1 is fixed.
-# But Problem#1 also hides this bug.
-#
-SELECT * FROM t2 WHERE
-5 <= a AND a < 10 AND b = 1 OR
-15 <= a AND a < 20 AND b = 3
-OR
-1 <= a AND b = 1;
-
-EXPLAIN
-SELECT * FROM t2 WHERE
-5 <= a AND a < 10 AND b = 1 OR
-15 <= a AND a < 20 AND b = 3
-OR
-1 <= a AND b = 1;
-
-SELECT * FROM t2 WHERE
-5 <= a AND a < 10 AND b = 2 OR
-15 <= a AND a < 20 AND b = 3
-OR
-1 <= a AND b = 1;
-
-EXPLAIN
-SELECT * FROM t2 WHERE
-5 <= a AND a < 10 AND b = 2 OR
-15 <= a AND a < 20 AND b = 3
-OR
-1 <= a AND b = 1;
-
-SELECT * FROM t3 WHERE
-5 <= a AND a < 10 AND b = 3 OR
-a < 5 OR
-a < 10;
-
-EXPLAIN
-SELECT * FROM t3 WHERE
-5 <= a AND a < 10 AND b = 3 OR
-a < 5 OR
-a < 10;
-
-DROP TABLE t1, t2, t3;
-
---echo #
---echo # Bug #47123: Endless 100% CPU loop with STRAIGHT_JOIN
---echo #
-
-CREATE TABLE t1(a INT, KEY(a));
-INSERT INTO t1 VALUES (1), (NULL);
-SELECT * FROM t1 WHERE a <> NULL and (a <> NULL or a <= NULL);
-DROP TABLE t1;
-
---echo #
---echo # Bug#47925: regression of range optimizer and date comparison in 5.1.39!
---echo #
-CREATE TABLE t1 ( a DATE, KEY ( a ) );
-CREATE TABLE t2 ( a DATETIME, KEY ( a ) );
-
---echo # Make optimizer choose range scan
-INSERT INTO t1 VALUES ('2009-09-22'), ('2009-09-22'), ('2009-09-22');
-INSERT INTO t1 VALUES ('2009-09-23'), ('2009-09-23'), ('2009-09-23');
-
-INSERT INTO t2 VALUES ('2009-09-22 12:00:00'), ('2009-09-22 12:00:00'),
- ('2009-09-22 12:00:00');
-INSERT INTO t2 VALUES ('2009-09-23 12:00:00'), ('2009-09-23 12:00:00'),
- ('2009-09-23 12:00:00');
-
---echo # DATE vs DATE
---replace_column 1 X 2 X 3 X 7 X 8 X 9 X 10 X
-EXPLAIN
-SELECT * FROM t1 WHERE a >= '2009/09/23';
-SELECT * FROM t1 WHERE a >= '2009/09/23';
-SELECT * FROM t1 WHERE a >= '20090923';
-SELECT * FROM t1 WHERE a >= 20090923;
-SELECT * FROM t1 WHERE a >= '2009-9-23';
-SELECT * FROM t1 WHERE a >= '2009.09.23';
-SELECT * FROM t1 WHERE a >= '2009:09:23';
-
---echo # DATE vs DATETIME
---replace_column 1 X 2 X 3 X 7 X 8 X 9 X 10 X
-EXPLAIN
-SELECT * FROM t2 WHERE a >= '2009/09/23';
-SELECT * FROM t2 WHERE a >= '2009/09/23';
-SELECT * FROM t2 WHERE a >= '2009/09/23';
-SELECT * FROM t2 WHERE a >= '20090923';
-SELECT * FROM t2 WHERE a >= 20090923;
-SELECT * FROM t2 WHERE a >= '2009-9-23';
-SELECT * FROM t2 WHERE a >= '2009.09.23';
-SELECT * FROM t2 WHERE a >= '2009:09:23';
-
---echo # DATETIME vs DATETIME
---replace_column 1 X 2 X 3 X 7 X 8 X 9 X 10 X
-EXPLAIN
-SELECT * FROM t2 WHERE a >= '2009/09/23 12:00:00';
-SELECT * FROM t2 WHERE a >= '2009/09/23 12:00:00';
-SELECT * FROM t2 WHERE a >= '20090923120000';
-SELECT * FROM t2 WHERE a >= 20090923120000;
-SELECT * FROM t2 WHERE a >= '2009-9-23 12:00:00';
-SELECT * FROM t2 WHERE a >= '2009.09.23 12:00:00';
-SELECT * FROM t2 WHERE a >= '2009:09:23 12:00:00';
-
---echo # DATETIME vs DATE
---replace_column 1 X 2 X 3 X 7 X 8 X 9 X 10 X
-EXPLAIN
-SELECT * FROM t1 WHERE a >= '2009/09/23 00:00:00';
-SELECT * FROM t1 WHERE a >= '2009/09/23 00:00:00';
-SELECT * FROM t1 WHERE a >= '2009/09/23 00:00:00';
-SELECT * FROM t1 WHERE a >= '20090923000000';
-SELECT * FROM t1 WHERE a >= 20090923000000;
-SELECT * FROM t1 WHERE a >= '2009-9-23 00:00:00';
-SELECT * FROM t1 WHERE a >= '2009.09.23 00:00:00';
-SELECT * FROM t1 WHERE a >= '2009:09:23 00:00:00';
-
---echo # Test of the new get_date_from_str implementation
---echo # Behavior differs slightly between the trunk and mysql-pe.
---echo # The former may give errors for the truncated values, while the latter
---echo # gives warnings. The purpose of this test is not to interfere, and only
---echo # preserve existing behavior.
-SELECT str_to_date('2007-10-00', '%Y-%m-%d') >= '' AND
- str_to_date('2007-10-00', '%Y-%m-%d') <= '2007/10/20';
-
-SELECT str_to_date('2007-20-00', '%Y-%m-%d') >= '2007/10/20' AND
- str_to_date('2007-20-00', '%Y-%m-%d') <= '';
-
-SELECT str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20';
-SELECT str_to_date('2007-20-00', '%Y-%m-%d') BETWEEN '2007/10/20' AND '';
-
-SELECT str_to_date('', '%Y-%m-%d');
-
-DROP TABLE t1, t2;
-
---echo #
---echo # Bug#48459: valgrind errors with query using 'Range checked for each
---echo # record'
---echo #
-CREATE TABLE t1 (
- a INT,
- b CHAR(2),
- c INT,
- d INT,
- KEY ( c ),
- KEY ( d, a, b ( 2 ) ),
- KEY ( b ( 1 ) )
-);
-
-INSERT INTO t1 VALUES ( NULL, 'a', 1, 2 ), ( NULL, 'a', 1, 2 ),
- ( 1, 'a', 1, 2 ), ( 1, 'a', 1, 2 );
-
-CREATE TABLE t2 (
- a INT,
- c INT,
- e INT,
- KEY ( e )
-);
-
-INSERT INTO t2 VALUES ( 1, 1, NULL ), ( 1, 1, NULL );
-
---echo # Should not give Valgrind warnings
-SELECT 1
-FROM t1, t2
-WHERE t1.d <> '1' AND t1.b > '1'
-AND t1.a = t2.a AND t1.c = t2.c;
-
-DROP TABLE t1, t2;
-
---echo #
---echo # Bug #48665: sql-bench's insert test fails due to wrong result
---echo #
-
-CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a));
-
-INSERT INTO t1 VALUES (0,0), (1,1);
-
---replace_column 1 @ 2 @ 3 @ 5 @ 6 @ 7 @ 8 @ 9 @ 10 @
-EXPLAIN
-SELECT * FROM t1 FORCE INDEX (PRIMARY)
- WHERE (a>=1 AND a<=2) OR (a>=4 AND a<=5) OR (a>=0 AND a <=10);
-
---echo # Should return 2 rows
-SELECT * FROM t1 FORCE INDEX (PRIMARY)
- WHERE (a>=1 AND a<=2) OR (a>=4 AND a<=5) OR (a>=0 AND a <=10);
-
-DROP TABLE t1;
-
---echo #
---echo # Bug #54802: 'NOT BETWEEN' evaluation is incorrect
---echo #
-
-CREATE TABLE t1 (c_key INT, c_notkey INT, KEY(c_key));
-INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3);
-
-EXPLAIN SELECT * FROM t1 WHERE 2 NOT BETWEEN c_notkey AND c_key;
-SELECT * FROM t1 WHERE 2 NOT BETWEEN c_notkey AND c_key;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug #57030: 'BETWEEN' evaluation is incorrect
---echo #
-
-# Test some BETWEEN predicates which does *not* follow the
-# 'normal' pattern of <field> BETWEEN <low const> AND <high const>
-
-CREATE TABLE t1(pk INT PRIMARY KEY, i4 INT);
-CREATE UNIQUE INDEX i4_uq ON t1(i4);
-
-INSERT INTO t1 VALUES (1,10), (2,20), (3,30);
-
-EXPLAIN
-SELECT * FROM t1 WHERE i4 BETWEEN 10 AND 10;
-SELECT * FROM t1 WHERE i4 BETWEEN 10 AND 10;
-
-EXPLAIN
-SELECT * FROM t1 WHERE 10 BETWEEN i4 AND i4;
-SELECT * FROM t1 WHERE 10 BETWEEN i4 AND i4;
-
-EXPLAIN
-SELECT * FROM t1 WHERE 10 BETWEEN 10 AND i4;
-SELECT * FROM t1 WHERE 10 BETWEEN 10 AND i4;
-
-EXPLAIN
-SELECT * FROM t1 WHERE 10 BETWEEN i4 AND 10;
-SELECT * FROM t1 WHERE 10 BETWEEN i4 AND 10;
-
-EXPLAIN
-SELECT * FROM t1 WHERE 10 BETWEEN 10 AND 10;
-SELECT * FROM t1 WHERE 10 BETWEEN 10 AND 10;
-
-EXPLAIN
-SELECT * FROM t1 WHERE 10 BETWEEN 11 AND 11;
-SELECT * FROM t1 WHERE 10 BETWEEN 11 AND 11;
-
-EXPLAIN
-SELECT * FROM t1 WHERE 10 BETWEEN 100 AND 0;
-SELECT * FROM t1 WHERE 10 BETWEEN 100 AND 0;
-
-EXPLAIN
-SELECT * FROM t1 WHERE i4 BETWEEN 100 AND 0;
-SELECT * FROM t1 WHERE i4 BETWEEN 100 AND 0;
-
-EXPLAIN
-SELECT * FROM t1 WHERE i4 BETWEEN 10 AND 99999999999999999;
-SELECT * FROM t1 WHERE i4 BETWEEN 10 AND 99999999999999999;
-
-EXPLAIN
-SELECT * FROM t1 WHERE i4 BETWEEN 999999999999999 AND 30;
-SELECT * FROM t1 WHERE i4 BETWEEN 999999999999999 AND 30;
-
-EXPLAIN
-SELECT * FROM t1 WHERE i4 BETWEEN 10 AND '20';
-SELECT * FROM t1 WHERE i4 BETWEEN 10 AND '20';
-
-#Should detect the EQ_REF 't2.pk=t1.i4'
-EXPLAIN
-SELECT * FROM t1, t1 as t2 WHERE t2.pk BETWEEN t1.i4 AND t1.i4;
-SELECT * FROM t1, t1 as t2 WHERE t2.pk BETWEEN t1.i4 AND t1.i4;
-
-EXPLAIN
-SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk;
-SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk;
-
-DROP TABLE t1;
-
---echo #
---echo # BUG#13519696 - 62940: SELECT RESULTS VARY WITH VERSION AND
---echo # WITH/WITHOUT INDEX RANGE SCAN
---echo #
-
-create table t1 (id int unsigned not null auto_increment primary key);
-insert into t1 values (null);
-insert into t1 select null from t1;
-insert into t1 select null from t1;
-insert into t1 select null from t1;
-insert into t1 select null from t1;
-insert into t1 select null from t1;
-insert into t1 select null from t1;
-insert into t1 select null from t1;
-insert into t1 select null from t1;
-create table t2 (
- id int unsigned not null auto_increment,
- val decimal(5,3) not null,
- primary key (id,val),
- unique key (val,id),
- unique key (id));
---disable_warnings
-insert into t2 select null,id*0.0009 from t1;
---enable_warnings
-
-select count(val) from t2 ignore index (val) where val > 0.1155;
-select count(val) from t2 force index (val) where val > 0.1155;
-
-drop table t2, t1;
-
---echo #
---echo # BUG#13453382 - REGRESSION SINCE 5.1.39, RANGE OPTIMIZER WRONG
---echo # RESULTS WITH DECIMAL CONVERSION
---echo #
-
-create table t1 (a int,b int,c int,primary key (a,c));
-insert into t1 values (1,1,2),(1,1,3),(1,1,4);
-# show that the integer 3 is bigger than the decimal 2.9,
-# which should also apply to comparing "c" with 2.9
-# when c is 3.
-select convert(3, signed integer) > 2.9;
-select * from t1 force index (primary) where a=1 and c>= 2.9;
-select * from t1 ignore index (primary) where a=1 and c>= 2.9;
-select * from t1 force index (primary) where a=1 and c> 2.9;
-select * from t1 ignore index (primary) where a=1 and c> 2.9;
-drop table t1;
-
---echo #
---echo # BUG#13463488 - 63437: CHAR & BETWEEN WITH INDEX RETURNS WRONG
---echo # RESULT AFTER MYSQL 5.1.
---echo #
-
-CREATE TABLE t1(
- F1 CHAR(5) NOT NULL,
- F2 CHAR(5) NOT NULL,
- F3 CHAR(5) NOT NULL,
- PRIMARY KEY(F1),
- INDEX IDX_F2(F2)
-);
-
-INSERT INTO t1 VALUES
-('A','A','A'),('AA','AA','AA'),('AAA','AAA','AAA'),
-('AAAA','AAAA','AAAA'),('AAAAA','AAAAA','AAAAA');
-
-SELECT * FROM t1 WHERE F1 = 'A ';
-SELECT * FROM t1 IGNORE INDEX(PRIMARY) WHERE F1 = 'A ';
-SELECT * FROM t1 WHERE F1 >= 'A ';
-SELECT * FROM t1 WHERE F1 > 'A ';
-SELECT * FROM t1 WHERE F1 BETWEEN 'A ' AND 'AAAAA';
-SELECT * FROM t1 WHERE F2 BETWEEN 'A ' AND 'AAAAA';
-SELECT * FROM t1 WHERE F3 BETWEEN 'A ' AND 'AAAAA';
-SELECT * FROM t1 IGNORE INDEX(PRIMARY) WHERE F1 BETWEEN 'A ' AND
-'AAAAA';
-
-DROP TABLE t1;
-
---echo #
---echo # mdev-4894: Poor performance with unnecessary
---echo # (bug#70021) 'Range checked for each record'
---echo #
-
-create table t1( key1 int not null, INDEX i1(key1) );
-insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8);
-insert into t1 select key1+8 from t1;
-insert into t1 select key1+16 from t1;
-insert into t1 select key1+32 from t1;
-insert into t1 select key1+64 from t1;
-insert into t1 select key1+128 from t1;
-insert into t1 select key1+256 from t1;
-insert into t1 select key1+512 from t1;
-
-alter table t1 add key2 int not null, add index i2(key2);
-update t1 set key2=key1;
-analyze table t1;
-
-create table t2 (a int);
-insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8);
-insert into t2 select a+16 from t2;
-insert into t2 select a+32 from t2;
-insert into t2 select a+64 from t2;
-
-explain
-select count(*) from t2 left join t1 on (t1.key1 < 3 or t1.key1 > 1020) and t1.key2 < 1000;
-select count(*) from t2 left join t1 on (t1.key1 < 3 or t1.key1 > 1020) and t1.key2 < 1000;
-explain
-select count(*) from t2 left join t1 on (t1.key1 < 3 or t1.key1 > 1020) and t1.key2 < t2.a;
-select count(*) from t2 left join t1 on (t1.key1 < 3 or t1.key1 > 1020) and t1.key2 < t2.a;
-
-drop table t1,t2;
-
---echo End of 5.1 tests
-
---echo #
---echo # LP Bug #533117: Wrong use_count in SEL_ARG trees
---echo # (Bug #58731)
---echo #
-
-create table t1 (a int, b int, c int, key idx (a,b,c));
-insert into t1 values (0,0,0), (2,2,0), (1,1,1), (2,2,1);
-
-explain
-select * from t1 force index (idx) where a >=1 and c <= 1 and a=b and b > 1;
-select * from t1 force index (idx) where a >=1 and c <= 1 and a=b and b > 1;
-
-drop table t1;
-
-#
-# lp:750117 Bogus warning with aggregate and datetime column
-#
-create table t1 (f1 datetime, key (f1));
-insert into t1 values ('2000-03-09 15:56:59'),('2000-05-05 23:24:28'),('2000-06-13 13:12:06');
-select min(f1) from t1 where f1 >= '2006-05-25 07:00:20' and f1 between '2003-11-23 10:00:09' and '2010-01-01 01:01:01' and f1 > '2001-01-01 01:01:01';
-drop table t1;
-
---echo #
---echo # BUG#11765831: 'RANGE ACCESS' MAY INCORRECTLY FILTER
---echo # AWAY QUALIFYING ROWS
---echo #
-
-CREATE TABLE t10(
- K INT NOT NULL AUTO_INCREMENT,
- I INT, J INT,
- PRIMARY KEY(K),
- KEY(I,J)
-);
-INSERT INTO t10(I,J) VALUES (6,1),(6,2),(6,3),(6,4),(6,5),
- (6,6),(6,7),(6,8),(6,9),(6,0);
-
-CREATE TABLE t100 LIKE t10;
-INSERT INTO t100(I,J) SELECT X.I, X.K+(10*Y.K) FROM t10 AS X,t10 AS Y;
-
-# Insert offending value:
-INSERT INTO t100(I,J) VALUES(8,26);
-
-let $query= SELECT * FROM t100 WHERE I <> 6 OR (I <> 8 AND J = 5);
-
-#Verify that 'range' access will be used
---echo
---eval EXPLAIN $query
-
-# Only row 101,8,26 should be returned
---echo
---eval $query
-
-DROP TABLE t10,t100;
-
---echo #
---echo # lp:817363: Wrong result with sort_union and multipart key in maria-5.3
---echo #
-CREATE TABLE t1 (a int NOT NULL , b int, c int, d varchar(32), KEY (d,b), PRIMARY KEY (a)) ;
-INSERT INTO t1 VALUES (7,7,NULL,'e'),(8,1,0,'p'),(9,7,1,'s'),(10,1,1,'j'),(12,2,0,'c'),(13,0,0,'a'),(14,1,1,'q');
-
-SELECT c FROM t1 WHERE d='q' OR d>='q' OR a > 97 OR (d IN ('j','s','i') AND b = 102);
-SELECT c FROM t1 ignore index (d) WHERE d='q' OR d>='q' OR a > 97 OR (d IN ('j','s','i') AND b = 102);
-
-SELECT * FROM t1 ignore index(d) WHERE d = 'q' OR d >= 'q' OR (d IN ( 'j' , 's' , 'i' ) AND ( b = 102 ));
-SELECT * FROM t1 force index(d) WHERE d = 'q' OR d >= 'q' OR (d IN ( 'j' , 's' , 'i' ) AND ( b = 102 ));
-
-DROP TABLE t1;
-
---disable_parsing
-# MariaDB: Moved the following to partition.test
---echo #
---echo # BUG#12912171 - ASSERTION FAILED: QUICK->HEAD->READ_SET ==
---echo # SAVE_READ_SET
---echo #
-CREATE TABLE t1 (
- a INT,
- b INT,
- c INT,
- PRIMARY KEY (c,a), KEY (a),KEY (a)
-) ENGINE=INNODB PARTITION BY KEY () PARTITIONS 2;
-INSERT INTO t1 VALUES (1,5,1),(2,4,1),(3,3,1),(4,2,1),(5,1,1);
-UPDATE t1 SET b = 0, c=1 WHERE a <=>0;
-SELECT * FROM t1;
-DROP TABLE t1;
---enable_parsing
-
---echo #
---echo # BUG#13256446 - ASSERTION QUICK->HEAD->READ_SET ==
---echo # SAVE_READ_SET' FAILED IN OPT_RANGE.CC:1606
---echo #
-CREATE TABLE t1 (
- f1 INT AUTO_INCREMENT,
- f2 INT,
- f3 INT,
- f4 INT,
- PRIMARY KEY (f1),KEY(f2)
-) ENGINE=INNODB;
-CREATE ALGORITHM=MERGE VIEW v2 AS SELECT f1,f2,f3,f4 FROM t1 WHERE f2=103;
-INSERT INTO t1 VALUES (154,0,NULL,0),(0,NULL,9,0),
- (NULL,102,NULL,3),(0,3,NULL,0), (9,0,NULL,0),(0,9,NULL,157);
-SELECT * FROM v2;
-UPDATE v2 SET f4=0, f2=NULL, f1=NULL WHERE f1 > 16 ORDER BY f1;
-SELECT * FROM v2;
-DROP TABLE t1;
-DROP VIEW v2;
-
-CREATE TABLE t1 (
- f1 INT AUTO_INCREMENT,
- f2 INT,
- f3 INT,
- f4 INT,
- PRIMARY KEY (f1),KEY(f2)
-) ENGINE=INNODB;
-INSERT INTO t1 VALUES(1,NULL,NULL,0), (2,2,0,3), (9,0,107,18),
- (10,0,0,0), (231,0,0,0), (232,0,8,0), (234,0,0,NULL), (235,8,0,3);
-CREATE ALGORITHM=MERGE VIEW v3 AS SELECT f1,f2,f3,f4 FROM t1 WHERE f1<=85 ;
-SELECT * FROM v3;
-UPDATE v3 SET f3=0, f4=4 WHERE f2=68 ORDER BY f1;
-SELECT * FROM v3;
-DROP TABLE t1;
-DROP VIEW v3;
-
---echo #
---echo # MDEV-6105: Emoji unicode character string search query makes mariadb performance down
---echo #
-SET NAMES utf8;
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1(
-id int AUTO_INCREMENT,
-fd varchar(20),
-primary key(id),
-index ix_fd(fd)
-)engine=innodb default charset=UTF8;
-INSERT INTO t1(id, fd) VALUES (null, ''),(null, 'matt'),(null, 'pitt'),(null, 'lee'),(null, 'kim');
-INSERT INTO t1 (fd) SELECT fd FROM t1;
-INSERT INTO t1 (fd) SELECT fd FROM t1;
-INSERT INTO t1 (fd) SELECT fd FROM t1;
-INSERT INTO t1 (fd) SELECT fd FROM t1;
-INSERT INTO t1 (fd) SELECT fd FROM t1;
-INSERT INTO t1 (fd) SELECT fd FROM t1;
-INSERT INTO t1 (fd) SELECT fd FROM t1;
-INSERT INTO t1 (fd) SELECT fd FROM t1;
-INSERT INTO t1 (fd) SELECT fd FROM t1;
-INSERT INTO t1 (fd) SELECT fd FROM t1;
-INSERT INTO t1 (fd) SELECT fd FROM t1;
-INSERT INTO t1 (fd) SELECT fd FROM t1;
-INSERT INTO t1 (fd) SELECT fd FROM t1;
---echo # The following should show "Impossible WHERE" :
-explain
-SELECT * FROM t1 WHERE fd='😁';
-SELECT * FROM t1 WHERE fd='😁';
-
---echo # The following must not use range access:
---replace_column 9 #
-explain select count(*) from t1 where fd <'😁';
-select count(*) from t1 where fd <'😁';
-select count(*) from t1 ignore index (ix_fd) where fd <'😁';
-
-drop table t1;
-set names default;
-
-#
-# Bug#17755540 VALGRIND ERROR WHEN SETTING UP ROW COMPARATORS
-#
-create table t2 (a int, b int, c int, d int, key x(a, b));
-insert into t2 values (2, 2, 2, 2), (3, 3, 3, 3), (4, 4, 4, 4), (5, 5, 5, 5),
- (6, 6, 6, 6), (7, 7, 7, 7), (8, 8, 8, 8), (9, 9, 9, 9);
-insert into t2 select * from t2;
-insert into t2 values (0, 0, 0, 0), (1, 1, 1, 1);
-analyze table t2;
-select a, b from t2 where (a, b) in ((0, 0), (1, 1));
-drop table t2;
-
---echo #
---echo # MDEV-10228: Delete missing rows with OR conditions
---echo # (The example uses UPDATE, because UPDATE allows to use index hints
---echo # and so it's possible to make an example that works with any storage
---echo # engine)
---echo #
-
-CREATE TABLE t1 (
- key1varchar varchar(14) NOT NULL,
- key2int int(11) NOT NULL DEFAULT '0',
- col1 int,
- PRIMARY KEY (key1varchar,key2int),
- KEY key1varchar (key1varchar),
- KEY key2int (key2int)
-) DEFAULT CHARSET=utf8;
-
-insert into t1 values
- ('value1',0, 0),
- ('value1',1, 0),
- ('value1',1000685, 0),
- ('value1',1003560, 0),
- ('value1',1004807, 0);
-
-update t1 force index (PRIMARY) set col1=12345
-where (key1varchar='value1' AND (key2int <=1 OR key2int > 1));
---echo # The following must show col1=12345 for all rows:
-select * from t1;
-drop table t1;
-
---echo #
---echo # BUG#13731380: RANGE OPTIMIZER CALLS RECORDS_IN_RANGE() FOR OPEN RANGE
---echo #
-
-CREATE TABLE t1 (pk INT PRIMARY KEY);
-INSERT INTO t1 VALUES (1),(3),(5);
-SELECT * FROM t1 WHERE pk <> 3 OR pk < 4;
-DROP TABLE t1;
-
---echo #
---echo # BUG#13803810: TOO FEW ROWS RETURNED FOR RANGE ACCESS IN
---echo # VARCHAR INDEX USING DATETIME VALUE
---echo
-CREATE TABLE t1 (a DATETIME);
-INSERT INTO t1 VALUES ('2001-01-01 00:00:00');
-INSERT INTO t1 VALUES ('2001-01-01 11:22:33');
-
-CREATE TABLE t2 (b VARCHAR(64), KEY (b));
-INSERT INTO t2 VALUES ('2001-01-01');
-INSERT INTO t2 VALUES ('2001.01.01');
-INSERT INTO t2 VALUES ('2001#01#01');
-INSERT INTO t2 VALUES ('2001-01-01 00:00:00');
-INSERT INTO t2 VALUES ('2001-01-01 11:22:33');
-
-
---echo
---echo # range/ref access cannot be used for this query
---echo
-EXPLAIN SELECT * FROM t2 WHERE b=CAST('2001-01-01' AS DATE);
-SELECT * FROM t2 WHERE b=CAST('2001-01-01' AS DATE);
-
-let $query_ab=SELECT * FROM t1, t2 WHERE a=b ORDER BY BINARY a, BINARY b;
-let $query_ba=SELECT * FROM t1, t2 WHERE b=a ORDER BY BINARY a, BINARY b;
-
---echo
---echo # range/ref access cannot be used for any of the queries below.
---echo # See BUG#13814468 about 'Range checked for each record'
---echo
-eval EXPLAIN $query_ab;
-eval $query_ab;
---echo
-eval EXPLAIN $query_ba;
-eval $query_ba;
-
---echo
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-5606: range optimizer: "x < y" is sargable, while "y > x" is not
---echo #
-create table t1(a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t2(a int);
-insert into t2 select A.a + B.a* 10 + C.a * 100 from t1 A, t1 B, t1 C;
-alter table t2 add key(a);
---echo # Should have "range checked for each table" for second table:
-explain select * from t1, t2 where t2.a < t1.a;
---echo # Should have "range checked for each table" for second table:
-explain select * from t1, t2 where t1.a > t2.a;
-
-create table t3 (a int primary key, b int);
-insert into t3 select a,a from t1;
---echo # The second table should use 'range':
-explain select * from t3, t2 where t2.a < t3.b and t3.a=1;
---echo # The second table should use 'range':
-explain select * from t3, t2 where t3.b > t2.a and t3.a=1;
-drop table t1,t2,t3;
-
---echo #
---echo # MDEV-6480: Remove conditions for which range optimizer returned SEL_ARG::IMPOSSIBLE.
---echo #
-create table t1(a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t2 (a int, b int, c int, key(a), key(b));
-insert into t2
-select
- A.a + B.a* 10 + C.a * 100,
- A.a + B.a* 10 + C.a * 100,
- 12345
-from
- t1 A, t1 B, t1 C;
-
---echo # EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE:
-explain extended select * from t2 where (b > 25 and b < 15) or a<44;
-
---echo # EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE:
-explain extended select * from t2 where a < 44 or (b > 25 and b < 15);
-
---echo # Here, conditions b will not be removed, because "c<44" is not sargable
---echo # and hence (b.. and .. b) part is not analyzed at all:
-explain extended select * from t2 where c < 44 or (b > 25 and b < 15);
-
---echo # EXPLAIN EXTENDED should show that 'b > 25 and b < 15' is removed from the WHERE:
-explain extended select * from t2 where (b > 25 and b < 15) or c < 44;
-
---echo # Try a case where both OR parts produce SEL_ARG::IMPOSSIBLE:
-explain extended select * from t2 where (b > 25 and b < 15) or (a>55 and a<44);
-
-drop table t1,t2;
-
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-8189 field<>const and const<>field are not symmetric
---echo #
-CREATE TABLE t1 (a INT, b INT, KEY(a));
-INSERT INTO t1 (a) VALUES (10),(10),(10),(10),(10),(10),(10),(10),(10),(10),(70);
-EXPLAIN SELECT * FROM t1 WHERE a<>10;
-EXPLAIN SELECT * FROM t1 WHERE 10<>a;
-SELECT * FROM t1 WHERE a<>10;
-SELECT * FROM t1 WHERE 10<>a;
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-8613 Full table scan for WHERE indexed_varchar_column <=> 'bad-character'
---echo #
-SET NAMES utf8;
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8, KEY(a)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('a'),('b'),('c'),('d'),('e');
-EXPLAIN SELECT * FROM t1 WHERE a<=>'😎';
-DROP TABLE t1;
-
---echo #
---echo # MDEV-10185: Assertion `tree1->keys[key_no] && tree2->keys[key_no]' failed in
---echo # sel_trees_can_be_ored(RANGE_OPT_PARAM*, SEL_TREE*, SEL_TREE*, key_map*)
---echo #
-CREATE TABLE t1 (pk INT PRIMARY KEY);
-INSERT INTO t1 VALUES (1),(2);
-SELECT * FROM t1 WHERE pk != 1000 OR pk IN ( 1000, 0, 1, 100, 2 ) OR pk >= 5;
-DROP TABLE t1;
-
---echo #
---echo # End of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-10454: range access keys extracted
---echo # from <row> IN (<row value list>)
---echo #
-
-create table t1(a int, b int, c varchar(16), key idx(a,b)) engine=myisam;
-
-insert into t1 values
- (1,1,'xx'), (2,2,'yyy'), (3,3,'zzzz'), (1,2,'zz'), (1,3,'x'),
- (2,3,'yy'), (4,5,'ww'), (7,8,'xxxxx'), (4,3,'zyx'), (1,2,'uuu'),
- (2,1,'w'), (5,5,'wx'), (2,3,'ww'), (7,7,'xxxyy'), (3,3,'zyxw'),
- (3,2,'uuuw'), (2,2,'wxz'), (5,5,'xw'), (12,12,'xx'), (12,12,'y'),
- (13,13,'z'), (11,12,'zz'), (11,13,'x'), (12,13,'y'), (14,15,'w'),
- (17,18,'xx'), (14,13,'zx'), (11,12,'u'), (12,11,'w'), (5,5,'wx'),
- (12,13,'ww'), (17,17,'xxxyy'), (13,13,'zyxw'), (13,12,'uuuw'), (12,12,'wxz'),
- (15,15,'xw'), (1,1,'xa'), (2,2,'yya'), (3,3,'zzza'), (1,2,'za'),
- (1,3,'xb'), (2,3,'ya'), (4,5,'wa'), (7,8,'xxxxa'), (4,3,'zya'),
- (1,2,'uua'), (2,1,'wb'), (5,5,'wc'), (2,3,'wa'), (7,7,'xxxya'),
- (3,3,'zyxa'), (3,2,'uuua'), (2,2,'wxa'), (5,5,'xa'), (12,12,'xa'),
- (22,12,'yb'), (23,13,'zb'), (21,12,'za'), (24,13,'c'), (32,13,'d'),
- (34,15,'wd'), (47,18,'xa'), (54,13,'za'), (51,12,'ub'), (52,11,'wc'),
- (5,5,'wd'), (62,13,'wa'), (67,17,'xxxya'), (63,13,'zyxa'), (73,12,'uuua'),
- (82,12,'wxa'), (85,15,'xd');
-
---echo # range access to t1 by 2-component keys for index idx
-let $q1=
-select * from t1 where (a,b) IN ((2, 3),(3,3),(8,8),(7,7));
-eval explain $q1;
-eval explain format=json $q1;
-eval $q1;
-eval prepare stmt from "$q1";
-execute stmt;
-execute stmt;
-deallocate prepare stmt;
-
---echo # range access to t1 by 1-component keys for index idx
-let $q2=
-select * from t1 where (a,b+a) IN ((4,9),(8,8),(7,7));
-eval explain $q2;
-eval explain format=json $q2;
-eval $q2;
-
---echo # range access to t1 by 1-component keys for index idx
-let $q3=
-select * from t1 where (a,b) IN ((4,a-1),(8,a+8),(7,a+7));
-eval explain $q3;
-eval explain format=json $q3;
-eval $q3;
-
-# this setting should be removed after fixes for mdev-12186, mdev-12187
-set @save_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='index_merge=off';
-
-create table t2(
- d int, e int, key idx1(d), key idx2(e), f varchar(32)
-) engine=myisam;
-
-insert into t2 values
- (9,5,'a'), (9,8,'b'), (9,3,'c'), (9,2,'d'), (9,1,'e'),
- (6,5,'f'), (6,3,'g'), (6,7,'h'), (3,3,'i'), (6,2,'j'),
- (9,5,'aa'), (9,8,'ba'), (9,3,'ca'), (2,2,'da'), (9,1,'ea'),
- (6,5,'fa'), (6,3,'ga'), (6,7,'ha'), (9,3,'ia'), (6,2,'ja');
-
---echo # join order: (t2,t1) with ref access of t1
---echo # range access to t1 by keys for index idx1
-let $q4=
-select * from t1,t2
- where a = d and (a,e) in ((3,3),(7,7),(2,2));
-eval explain $q4;
-eval explain format=json $q4;
-eval $q4;
-
-insert into t2 values
- (4,5,'a'), (7,8,'b'), (4,3,'c'), (1,2,'d'), (2,1,'e'), (5,5,'f'),
- (2,3,'g'), (7,7,'h'), (3,3,'i'), (3,2,'j'), (2,2,'k'), (5,5,'l'),
- (4,5,'aa'), (7,8,'bb'), (4,3,'cc'), (1,2,'dd'), (2,1,'ee'), (9,5,'ff'),
- (2,3,'gg'), (7,7,'hh'), (3,3,'ii'), (3,2,'jj'), (2,2,'kk'), (9,5,'ll'),
- (4,5,'aaa'), (7,8,'bbb'), (4,3,'ccc'), (1,2,'ddd'), (2,1,'eee'), (5,5,'fff'),
- (2,3,'ggg'), (7,7,'hhh'), (3,3,'iii'), (3,2,'jjj'), (2,2,'kkk'), (5,5,'lll'),
- (14,15,'a'), (17,18,'b'), (14,13,'c'), (11,12,'d'), (12,11,'e'), (15,15,'f'),
- (12,13,'g'), (17,17,'h'), (13,13,'i'), (13,12,'j'), (12,12,'k'), (15,15,'l'),
- (24,25,'a'), (27,28,'b'), (24,23,'c'), (21,22,'d'), (22,21,'e'), (25,25,'f'),
- (22,23,'g'), (27,27,'h'), (23,23,'i'), (23,22,'j'), (22,22,'k'), (25,25,'l'),
- (34,35,'a'), (37,38,'b'), (34,33,'c'), (31,32,'d'), (32,31,'e'), (35,35,'f'),
- (32,33,'g'), (37,37,'h'), (33,33,'i'), (33,32,'j'), (32,32,'k'), (35,35,'l'),
- (44,45,'a'), (47,48,'b'), (44,43,'c'), (41,42,'d'), (42,41,'e'), (45,45,'f'),
- (42,43,'g'), (47,47,'h'), (43,43,'i'), (43,42,'j'), (42,42,'k'), (45,45,'l');
-
---echo # join order: (t1,t2) with ref access of t2
---echo # range access to t1 by 1-component keys for index idx
-let $q5=
-select * from t1,t2
- where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1;
-eval explain $q5;
-eval explain format=json $q5;
-eval $q5;
-eval prepare stmt from "$q5";
-execute stmt;
-execute stmt;
-deallocate prepare stmt;
-
-insert into t1 select * from t1;
-
---echo # join order: (t2,t1) with ref access of t1
---echo # range access to t2 by keys for index idx2
-let $q6=
-select * from t1,t2
- where a = d and (a,e) in ((4,4),(7,7),(8,8)) and length(f) = 1;
-eval explain $q6;
-eval explain format=json $q6;
-eval $q6;
-
-alter table t2 drop index idx1, drop index idx2, add index idx3(d,e);
-
---echo # join order: (t2,t1) with ref access of t1
---echo # range access to t2 by 2-component keys for index idx3
-let $q7=
-select * from t1,t2
- where a = d and (a,e) in ((4,4),(7,7),(8,8)) and length(f) = 1;
-eval explain $q7;
-eval explain format=json $q7;
-eval $q7;
-
---echo # join order: (t1,t2) with ref access of t2
---echo # range access to t1 by 1-component keys for index idx
-let $q8=
-select * from t1,t2
- where a = d and (a,e) in ((4,d+1),(7,d+1),(8,d+1)) and length(f) = 1;
-eval explain $q8;
-eval explain format=json $q8;
-eval $q8;
-
---echo # join order: (t1,t2) with ref access of t2
---echo # no range access
-let $q9=
-select * from t1,t2
- where a = d and (a,e) in ((e,d+1),(7,7),(8,8)) and length(f) = 1;
-eval explain $q9;
-eval explain format=json $q9;
-eval $q9;
-
---echo # join order: (t1,t2) with ref access of t2
---echo # range access to t1 by 1-component keys for index idx
-let $q10=
-select * from t1,t2
- where a = d and (a,2) in ((2,2),(7,7),(8,8)) and
- length(c) = 1 and length(f) = 1;
-eval explain $q10;
-eval explain format=json $q10;
-eval $q10;
-eval prepare stmt from "$q10";
-execute stmt;
-execute stmt;
-deallocate prepare stmt;
-
-create table t3 (id int primary key, v int) engine=myisam;
-
-insert into t3 values
- (3,2), (1,1), (4,12), (2,15);
-
---echo # join order: (t3,t1,t2) with const t3 and ref access of t2
---echo # range access to t1 by 1-component keys for index idx
-let $q11=
-select * from t1,t2,t3
- where id = 1 and a = d and
- (a,v+1) in ((2,2),(7,7),(8,8)) and
- length(c) = 1 and length(f) = 1;
-eval explain $q11;
-eval explain format=json $q11;
-eval $q11;
-
---echo # IN predicate is always FALSE
-let $q12=
-select * from t1,t2,t3
- where id = 1 and a = d and
- (a,v+1) in ((9,9),(7,7),(8,8)) and
- length(c) = 1 and length(f) = 1;
-eval explain $q12;
-eval prepare stmt from "$q12";
-execute stmt;
-execute stmt;
-deallocate prepare stmt;
-
-set optimizer_switch=@save_optimizer_switch;
-
-drop table t1,t2,t3;
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/range_innodb.test b/mysql-test/t/range_innodb.test
deleted file mode 100644
index f76794814ef..00000000000
--- a/mysql-test/t/range_innodb.test
+++ /dev/null
@@ -1,47 +0,0 @@
---echo #
---echo # Range optimizer (and related) tests that need InnoDB.
---echo #
-
---source include/have_innodb.inc
-
---disable_warnings
-drop table if exists t0, t1, t2;
---enable_warnings
-
---echo #
---echo # MDEV-6735: Range checked for each record used with key
---echo #
-
-create table t0(a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1(a int);
-insert into t1 select A.a + B.a* 10 + C.a * 100 + D.a * 1000
-from t0 A, t0 B, t0 C, t0 D;
-
-create table t2 (
- a int,
- b int,
- filler1 char(100),
- filler2 char(100),
- filler3 char(100),
- filler4 char(100),
- key(a),
- key(b)
-) engine=innodb;
-
-insert into t2
-select
- a,a,
- repeat('0123456789', 10),
- repeat('0123456789', 10),
- repeat('0123456789', 10),
- repeat('0123456789', 10)
-from t1;
-
-analyze table t2;
---echo # The following must not use "Range checked for each record":
-explain select * from t0 left join t2 on t2.a <t0.a and t2.b between 50 and 250;
-
-drop table t0,t1,t2;
-
diff --git a/mysql-test/t/range_interrupted-13751.test b/mysql-test/t/range_interrupted-13751.test
deleted file mode 100644
index 000a46383e8..00000000000
--- a/mysql-test/t/range_interrupted-13751.test
+++ /dev/null
@@ -1,25 +0,0 @@
-source include/have_debug.inc;
-#
-# MDEV-13751 Interrupted SELECT fails with 1030: 'Got error 1 "Operation not permitted" from storage engine MyISAM'
-#
-CREATE TABLE t1 (i INT AUTO_INCREMENT, c VARCHAR(1), KEY(i), KEY(c,i)) ENGINE=MyISAM;
-INSERT INTO t1 (c) VALUES ('a'),('b'),('c'),('d');
-INSERT INTO t1 (c) SELECT c FROM t1;
-INSERT INTO t1 (c) SELECT c FROM t1;
-INSERT INTO t1 (c) SELECT c FROM t1;
-INSERT INTO t1 (c) SELECT c FROM t1;
-INSERT INTO t1 (c) SELECT c FROM t1;
-INSERT INTO t1 (c) SELECT c FROM t1;
-
-set @old_dbug=@@session.debug_dbug;
-set debug_dbug="+d,kill_join_init_read_record";
-
---error ER_QUERY_INTERRUPTED
-SELECT 1 FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
-WHERE alias1.c = alias2.c OR alias1.i <= 1
-;
-
-set debug_dbug=@old_dbug;
-
-DROP TABLE t1;
-
diff --git a/mysql-test/t/range_mrr_icp.test b/mysql-test/t/range_mrr_icp.test
deleted file mode 100644
index 724da8aea3b..00000000000
--- a/mysql-test/t/range_mrr_icp.test
+++ /dev/null
@@ -1,7 +0,0 @@
-set @mrr_icp_extra_tmp=@@optimizer_switch;
-set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
-
---source t/range.test
-
-set optimizer_switch=@mrr_icp_extra_tmp;
-
diff --git a/mysql-test/t/range_vs_index_merge.test b/mysql-test/t/range_vs_index_merge.test
deleted file mode 100644
index 84b87579e85..00000000000
--- a/mysql-test/t/range_vs_index_merge.test
+++ /dev/null
@@ -1,1299 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1,t2,t3,t4;
-DROP DATABASE IF EXISTS world;
---enable_warnings
-
-set names utf8;
-
-CREATE DATABASE world;
-
-use world;
-
---source include/world_schema.inc
-
---disable_query_log
---disable_result_log
---disable_warnings
---source include/world.inc
---enable_warnings
---enable_result_log
---enable_query_log
-
-SELECT COUNT(*) FROM Country;
-SELECT COUNT(*) FROM City;
-SELECT COUNT(*) FROM CountryLanguage;
-
-CREATE INDEX Name ON City(Name);
-
---disable_query_log
---disable_result_log
---disable_warnings
-ANALYZE TABLE City;
---enable_warnings
---enable_result_log
---enable_query_log
-
-set session optimizer_switch='index_merge_sort_intersection=off';
-
-# The following 4 queries are added for code coverage
-
-#the exptected # of rows differ on 32-bit and 64-bit platforms for innodb
---replace_column 9 4079
-EXPLAIN
-SELECT * FROM City
- WHERE (Population >= 100000 OR Name LIKE 'P%' OR Population < 100000);
-
-EXPLAIN
-SELECT * FROM City
- WHERE (Population >= 100000 OR Name LIKE 'P%') AND Country='CAN' OR
- (Population < 100000 OR Name Like 'T%') AND Country='ARG';
-
-EXPLAIN
-SELECT * FROM City
- WHERE Population < 200000 AND Name LIKE 'P%' AND
- (Population > 300000 OR Name LIKE 'T%') AND
- (Population < 100000 OR Name LIKE 'Pa%');
-
-EXPLAIN
-SELECT * FROM City
- WHERE Population > 100000 AND Name LIKE 'Aba%' OR
- Country IN ('CAN', 'ARG') AND ID BETWEEN 120 AND 130 OR
- Country <= 'ALB' AND Name LIKE 'L%' OR
- ID BETWEEN 3807 AND 3810;
-
-# The output of the next 3 commands tells us about selectivities
-# of the conditions utilized in 2 queries following after them
-
-EXPLAIN
-SELECT * FROM City
- WHERE (Population > 101000 AND Population < 115000);
-
-EXPLAIN
-SELECT * FROM City
- WHERE (Population > 101000 AND Population < 102000);
-
-EXPLAIN
-SELECT * FROM City
- WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F'));
-
-# The pattern of the WHERE condition used in the following 2 queries is
-# (range(key1) OR range(key2)) AND range(key3)
-# Varying values of the constants in the second conjunct of the condition
-# we can get either a plan with range index scan for key3 or a plan with
-# an index merge retrieval over key2 and key3
-
-EXPLAIN
-SELECT * FROM City
- WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F'))
- AND (Population > 101000 AND Population < 115000);
-
-EXPLAIN
-SELECT * FROM City
- WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F'))
- AND (Population > 101000 AND Population < 102000);
-
-# The following 4 queries check that the plans
-# for the previous 2 plans are valid
-
-SELECT * FROM City USE INDEX ()
- WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F'))
- AND (Population > 101000 AND Population < 115000);
-
-SELECT * FROM City
- WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F'))
- AND (Population > 101000 AND Population < 115000);
-
-SELECT * FROM City USE INDEX ()
- WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F'))
- AND (Population > 101000 AND Population < 102000);
-
-SELECT * FROM City
- WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F'))
- AND (Population > 101000 AND Population < 102000);
-
-# The output of the next 7 commands tells us about selectivities
-# of the conditions utilized in 4 queries following after them
-
-EXPLAIN
-SELECT * FROM City WHERE (Name < 'Ac');
-EXPLAIN
-SELECT * FROM City WHERE (Name < 'Bb');
-EXPLAIN
-SELECT * FROM City WHERE (Country > 'A' AND Country < 'B');
-EXPLAIN
-SELECT * FROM City WHERE (Name BETWEEN 'P' AND 'Pb');
-EXPLAIN
-SELECT * FROM City WHERE (Name BETWEEN 'P' AND 'S');
-EXPLAIN
-SELECT * FROM City WHERE (Population > 101000 AND Population < 110000);
-EXPLAIN
-SELECT * FROM City WHERE (Population > 103000 AND Population < 104000);
-
-# The pattern of the WHERE condition used in the following 4 queries is
-# (range1(key1) AND range(key2)) OR (range2(key1) AND range(key3)
-# Varying values of the constants in the range conjuncts of the condition
-# we can get:
-# 1. a plan with range index over key1
-# index merge retrievals over:
-# 2. key1 and key3
-# 3. key2 and key1
-# 4. key2 and key3
-
-EXPLAIN
-SELECT * FROM City
- WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR
- (Name BETWEEN 'P' AND 'Pb' AND (Population > 101000 AND Population < 110000));
-
-EXPLAIN
-SELECT * FROM City
- WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR
- (Name BETWEEN 'P' AND 'S' AND (Population > 103000 AND Population < 104000));
-
-EXPLAIN
-SELECT * FROM City
- WHERE (Name < 'Bb' AND (Country > 'A' AND Country < 'B')) OR
- (Name BETWEEN 'P' AND 'Pb' AND (Population > 101000 AND Population < 110000));
-
-EXPLAIN
-SELECT * FROM City
- WHERE (Name < 'Bb' AND (Country > 'A' AND Country < 'B')) OR
- (Name BETWEEN 'P' AND 'S' AND (Population > 103000 AND Population < 104000));
-
-# The following 8 queries check that the plans
-# for the previous 4 plans are valid
-
-SELECT * FROM City USE INDEX ()
- WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR
- (Name BETWEEN 'P' AND 'Pb' AND (Population > 101000 AND Population < 110000));
-
-SELECT * FROM City
- WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR
- (Name BETWEEN 'P' AND 'Pb' AND (Population > 101000 AND Population < 110000));
-
-SELECT * FROM City USE INDEX ()
- WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR
- (Name BETWEEN 'P' AND 'S' AND (Population > 103000 AND Population < 104000));
-
-SELECT * FROM City
- WHERE (Name < 'Ac' AND (Country > 'A' AND Country < 'B')) OR
- (Name BETWEEN 'P' AND 'S' AND (Population > 103000 AND Population < 104000));
-
-SELECT * FROM City USE INDEX ()
- WHERE (Name < 'Bb' AND (Country > 'A' AND Country < 'B')) OR
- (Name BETWEEN 'P' AND 'Pb' AND (Population > 101000 AND Population < 110000));
-
-SELECT * FROM City
- WHERE (Name < 'Bb' AND (Country > 'A' AND Country < 'B')) OR
- (Name BETWEEN 'P' AND 'Pb' AND (Population > 101000 AND Population < 110000));
-
-SELECT * FROM City USE INDEX ()
- WHERE (Name < 'Bb' AND (Country > 'A' AND Country < 'B')) OR
- (Name BETWEEN 'P' AND 'S' AND (Population > 103000 AND Population < 104000));
-
-SELECT * FROM City
- WHERE (Name < 'Bb' AND (Country > 'A' AND Country < 'B')) OR
- (Name BETWEEN 'P' AND 'S' AND (Population > 103000 AND Population < 104000));
-
-
-# The output of the next 6 commands tells us about selectivities
-# of the conditions utilized in 3 queries following after them
-
-EXPLAIN
-SELECT * FROM City WHERE (ID < 10) OR (ID BETWEEN 100 AND 110);
-EXPLAIN
-SELECT * FROM City WHERE (ID < 200) OR (ID BETWEEN 100 AND 200);
-EXPLAIN
-SELECT * FROM City WHERE (ID < 600) OR (ID BETWEEN 900 AND 1500);
-EXPLAIN
-SELECT * FROM City WHERE Country > 'A' AND Country < 'ARG';
-EXPLAIN
-SELECT * FROM City WHERE Name LIKE 'H%' OR Name LIKE 'P%' ;
-EXPLAIN
-SELECT * FROM City WHERE Name LIKE 'Ha%' OR Name LIKE 'Pa%' ;
-
-# The pattern of the WHERE condition used in the following 3 queries is
-# (range1(key1) AND (range1(key2) OR range(key3)) OR
-# (range2(key1) AND (range2(key2) OR range(key4))
-# Varying values of the constants in the range predicates of the condition
-# we can get:
-# 1. a plan with range index over key1
-# 2. an index merge retrieval over key1, key2 and key3
-
-EXPLAIN
-SELECT * FROM City
- WHERE ((ID < 10) AND (Name LIKE 'H%' OR (Country > 'A' AND Country < 'ARG')))
- OR ((ID BETWEEN 100 AND 110) AND
- (Name LIKE 'P%' OR (Population > 103000 AND Population < 104000)));
-
-EXPLAIN
-SELECT * FROM City
- WHERE ((ID < 800) AND (Name LIKE 'Ha%' OR (Country > 'A' AND Country < 'ARG')))
- OR ((ID BETWEEN 900 AND 1500) AND
- (Name LIKE 'Pa%' OR (Population > 103000 AND Population < 104000)));
-
-EXPLAIN
-SELECT * FROM City
- WHERE ((ID < 200) AND (Name LIKE 'Ha%' OR (Country > 'A' AND Country < 'ARG')))
- OR ((ID BETWEEN 100 AND 200) AND
- (Name LIKE 'Pa%' OR (Population > 103000 AND Population < 104000)));
-
-
-# The following 6 queries check that the plans
-# for the previous 3 plans are valid
-
-SELECT * FROM City USE INDEX ()
- WHERE ((ID < 10) AND (Name LIKE 'H%' OR (Country > 'A' AND Country < 'ARG')))
- OR ((ID BETWEEN 100 AND 110) AND
- (Name LIKE 'P%' OR (Population > 103000 AND Population < 104000)));
-
-SELECT * FROM City
- WHERE ((ID < 10) AND (Name LIKE 'H%' OR (Country > 'A' AND Country < 'ARG')))
- OR ((ID BETWEEN 100 AND 110) AND
- (Name LIKE 'P%' OR (Population > 103000 AND Population < 104000)));
-
-SELECT * FROM City USE INDEX()
- WHERE ((ID < 800) AND (Name LIKE 'Ha%' OR (Country > 'A' AND Country < 'ARG')))
- OR ((ID BETWEEN 900 AND 1500) AND
- (Name LIKE 'Pa%' OR (Population > 103000 AND Population < 104000)));
-
-SELECT * FROM City
- WHERE ((ID < 800) AND (Name LIKE 'Ha%' OR (Country > 'A' AND Country < 'ARG')))
- OR ((ID BETWEEN 900 AND 1500) AND
- (Name LIKE 'Pa%' OR (Population > 103000 AND Population < 104000)));
-
-SELECT * FROM City USE INDEX ()
- WHERE ((ID < 200) AND (Name LIKE 'Ha%' OR (Country > 'A' AND Country < 'ARG')))
- OR ((ID BETWEEN 100 AND 200) AND
- (Name LIKE 'Pa%' OR (Population > 103000 AND Population < 104000)));
-
-SELECT * FROM City
- WHERE ((ID < 200) AND (Name LIKE 'Ha%' OR (Country > 'A' AND Country < 'ARG')))
- OR ((ID BETWEEN 100 AND 200) AND
- (Name LIKE 'Pa%' OR (Population > 103000 AND Population < 104000)));
-
-
-# The output of the next 8 commands tells us about selectivities
-# of the conditions utilized in 2 queries following after them
-
-EXPLAIN
-SELECT * FROM City WHERE Population > 101000 AND Population < 102000;
-EXPLAIN
-SELECT * FROM City WHERE Population > 101000 AND Population < 110000;
-EXPLAIN
-SELECT * FROM City WHERE Country < 'C';
-EXPLAIN
-SELECT * FROM City WHERE Country < 'AGO';
-EXPLAIN
-SELECT * FROM City WHERE Name BETWEEN 'P' AND 'S';
-EXPLAIN
-SELECT * FROM City WHERE Name BETWEEN 'P' AND 'Pb';
-EXPLAIN
-SELECT * FROM City WHERE ID BETWEEN 3400 AND 3800;
-EXPLAIN
-SELECT * FROM City WHERE ID BETWEEN 3790 AND 3800;
-EXPLAIN
-SELECT * FROM City WHERE Name LIKE 'P%';
-
-# The pattern of the WHERE condition used in the following 2 queries is
-# (range(key1) AND (range1(key2) OR range1(key3)) OR
-# (range(key4) AND (range2(key2) OR range2(key3))
-# Varying values of the constants in the range predicates of the condition
-# we can get:
-# index merge retrievals over:
-# 1. key1, key2 and key3
-# 2. key4, key2 and key3
-
-EXPLAIN
-SELECT * FROM City
- WHERE ((Population > 101000 AND Population < 102000) AND
- (Country < 'C' OR Name BETWEEN 'P' AND 'S')) OR
- ((ID BETWEEN 3400 AND 3800) AND
- (Country < 'AGO' OR Name LIKE 'Pa%'));
-
-EXPLAIN
-SELECT * FROM City
- WHERE ((Population > 101000 AND Population < 110000) AND
- (Country < 'AGO' OR Name BETWEEN 'P' AND 'Pb')) OR
- ((ID BETWEEN 3790 AND 3800) AND
- (Country < 'C' OR Name LIKE 'P%'));
-
-# The following 4 queries check that the plans
-# for the previous 2 plans are valid
-
-SELECT * FROM City USE INDEX ()
- WHERE ((Population > 101000 AND Population < 102000) AND
- (Country < 'C' OR Name BETWEEN 'P' AND 'S')) OR
- ((ID BETWEEN 3400 AND 3800) AND
- (Country < 'AGO' OR Name LIKE 'Pa%'));
-
-SELECT * FROM City
- WHERE ((Population > 101000 AND Population < 102000) AND
- (Country < 'C' OR Name BETWEEN 'P' AND 'S')) OR
- ((ID BETWEEN 3400 AND 3800) AND
- (Country < 'AGO' OR Name LIKE 'Pa%'));
-
-SELECT * FROM City USE INDEX ()
- WHERE ((Population > 101000 AND Population < 110000) AND
- (Country < 'AGO' OR Name BETWEEN 'P' AND 'Pb')) OR
- ((ID BETWEEN 3790 AND 3800) AND
- (Country < 'C' OR Name LIKE 'P%'));
-
-SELECT * FROM City
- WHERE ((Population > 101000 AND Population < 110000) AND
- (Country < 'AGO' OR Name BETWEEN 'P' AND 'Pb')) OR
- ((ID BETWEEN 3790 AND 3800) AND
- (Country < 'C' OR Name LIKE 'P%'));
-
-
-CREATE INDEX CountryPopulation ON City(Country,Population);
-
---disable_query_log
---disable_result_log
---disable_warnings
-ANALYZE TABLE City;
---enable_warnings
---enable_result_log
---enable_query_log
-
-# The output of the next 5 commands tells us about selectivities
-# of the conditions utilized in 2 queries following after them
-
-EXPLAIN
-SELECT * FROM City WHERE Name LIKE 'Pas%';
-EXPLAIN
-SELECT * FROM City WHERE Name LIKE 'P%';
-EXPLAIN
-SELECT * FROM City WHERE (Population > 101000 AND Population < 103000);
-EXPLAIN
-SELECT * FROM City WHERE Country='USA';
-EXPLAIN
-SELECT * FROM City WHERE Country='FIN';
-
-# The pattern of the WHERE condition used in the following 3 queries is
-# (range(key1_p2) OR (range(key2)) AND key1_p1=c
-# Varying values of the constants in the range predicates of the condition
-# we can get:
-# 1. a plan with range index over key1_p1
-# 2. an index merge retrieval over: key1 and key2
-
-EXPLAIN
-SELECT * FROM City
- WHERE ((Population > 101000 AND Population < 103000) OR Name LIKE 'Pas%')
- AND Country='USA';
-
-EXPLAIN
-SELECT * FROM City
- WHERE ((Population > 101000 AND Population < 103000) OR Name LIKE 'P%')
- AND Country='FIN';
-
-# The following 4 queries check that the plans
-# for the previous 2 plans are valid
-
-SELECT * FROM City
- WHERE ((Population > 101000 AND Population < 103000) OR Name LIKE 'Pas%')
- AND Country='USA';
-
-SELECT * FROM City USE INDEX ()
- WHERE ((Population > 101000 AND Population < 103000) OR Name LIKE 'Pas%')
- AND Country='USA';
-
-SELECT * FROM City
- WHERE ((Population > 101000 AND Population < 103000) OR Name LIKE 'P%')
- AND Country='FIN';
-
-SELECT * FROM City USE INDEX ()
- WHERE ((Population > 101000 AND Population < 103000) OR Name LIKE 'P%')
- AND Country='FIN';
-
-
-CREATE INDEX CountryName ON City(Country,Name);
-
---disable_query_log
---disable_result_log
---disable_warnings
-ANALYZE TABLE City;
---enable_warnings
---enable_result_log
---enable_query_log
-
-# The output of the next 12 commands tells us about selectivities
-# of the conditions utilized in 3 queries following after them
-
-EXPLAIN
-SELECT * FROM City WHERE Country='USA';
-EXPLAIN
-SELECT * FROM City WHERE Country='FIN';
-EXPLAIN
-SELECT * FROM City WHERE Country='BRA';
-EXPLAIN
-SELECT * FROM City WHERE ID BETWEEN 3790 AND 3800;
-EXPLAIN
-SELECT * FROM City WHERE ID BETWEEN 4025 AND 4035;
-EXPLAIN
-SELECT * FROM City WHERE ID BETWEEN 4028 AND 4032;
-EXPLAIN
-SELECT * FROM City WHERE ID BETWEEN 3500 AND 3800;
-EXPLAIN
-SELECT * FROM City WHERE ID BETWEEN 4000 AND 4300;
-EXPLAIN
-SELECT * FROM City WHERE ID BETWEEN 250 and 260 ;
-EXPLAIN
-SELECT * FROM City WHERE (Population > 101000 AND Population < 102000);
-EXPLAIN
-SELECT * FROM City WHERE (Population > 101000 AND Population < 103000);
-EXPLAIN
-SELECT * FROM City WHERE Name LIKE 'Pa%';
-
-# The pattern of the WHERE condition used in the following 3 queries is
-# (range(key1_p2) OR range1(key3)) AND
-# range(key1|2_p1=c) AND
-# (range(key2_p2) OR range2(key3))
-# Varying values of the constants in the range conjuncts of the condition
-# we can get:
-# 1. a plan with range index over key1|2_p1
-# index merge retrievals over:
-# 2. key1 and key3
-# 3. key2 and key3
-set @tmp_range_vs_index_merge=@@optimizer_switch;
-set optimizer_switch='extended_keys=off';
-
-EXPLAIN
-SELECT * FROM City
- WHERE ((Population > 101000 AND Population < 102000) OR
- ID BETWEEN 3790 AND 3800) AND Country='USA'
- AND (Name LIKE 'Pa%' OR ID BETWEEN 4025 AND 4035);
-
-EXPLAIN
-SELECT * FROM City
- WHERE ((Population > 101000 AND Population < 103000) OR
- ID BETWEEN 3790 AND 3800) AND Country='USA'
- AND (Name LIKE 'Pa%' OR ID BETWEEN 4028 AND 4032);
-
-EXPLAIN
-SELECT * FROM City
- WHERE ((Population > 101000 AND Population < 110000) OR
- ID BETWEEN 3500 AND 3800) AND Country='FIN'
- AND (Name BETWEEN 'P' AND 'T' OR ID BETWEEN 4000 AND 4300);
-
-# The following 6 queries check that the plans
-# for the previous 3 plans are valid
-
-SELECT * FROM City USE INDEX ()
- WHERE ((Population > 101000 AND Population < 102000) OR
- ID BETWEEN 3790 AND 3800) AND Country='USA'
- AND (Name LIKE 'Pa%' OR ID BETWEEN 4025 AND 4035);
-
-SELECT * FROM City
- WHERE ((Population > 101000 AND Population < 102000) OR
- ID BETWEEN 3790 AND 3800) AND Country='USA'
- AND (Name LIKE 'Pa%' OR ID BETWEEN 4025 AND 4035);
-
-SELECT * FROM City USE INDEX ()
- WHERE ((Population > 101000 AND Population < 102000) OR
- ID BETWEEN 3790 AND 3800) AND Country='USA'
- AND (Name LIKE 'Pa%' OR ID BETWEEN 4028 AND 4032);
-
-SELECT * FROM City
- WHERE ((Population > 101000 AND Population < 102000) OR
- ID BETWEEN 3790 AND 3800) AND Country='USA'
- AND (Name LIKE 'Pa%' OR ID BETWEEN 4028 AND 4032);
-
-SELECT * FROM City USE INDEX ()
- WHERE ((Population > 101000 AND Population < 102000) OR
- ID BETWEEN 3790 AND 3800) AND Country='FIN'
- AND (Name LIKE 'Pa%' OR ID BETWEEN 4025 AND 4035);
-
-SELECT * FROM City
- WHERE ((Population > 101000 AND Population < 102000) OR
- ID BETWEEN 3790 AND 3800) AND Country='FIN'
- AND (Name LIKE 'Pa%' OR ID BETWEEN 4025 AND 4035);
-
-
-# The pattern of the WHERE condition used in the following query is
-# (range(key1_p2) OR range1(key3)) AND range(key1|2_p1=c1) AND
-# (range(key2_p2) OR range1(key3)) AND range(key1|2_p1=c2)
-# We get an index merge retrieval over key1, key2 and key3 for it
-
-EXPLAIN
-SELECT * FROM City
- WHERE ((Population > 101000 and Population < 102000) OR
- ID BETWEEN 3790 AND 3800) AND Country='USA'
- OR (Name LIKE 'Pa%' OR ID BETWEEN 250 AND 260) AND Country='BRA';
-
-# The following 2 queries check that the plans
-# for the previous plan is valid
-
-SELECT * FROM City USE INDEX ()
- WHERE ((Population > 101000 and Population < 102000) OR
- ID BETWEEN 3790 AND 3800) AND Country='USA'
- OR (Name LIKE 'Pa%' OR ID BETWEEN 250 AND 260) AND Country='BRA';
-
-SELECT * FROM City
- WHERE ((Population > 101000 and Population < 102000) OR
- ID BETWEEN 3790 AND 3800) AND Country='USA'
- OR (Name LIKE 'Pa%' OR ID BETWEEN 250 AND 260) AND Country='BRA';
-
-# The pattern of the WHERE condition used in the following query is
-# (impossible_range(key1_p2) OR range1(key3)) AND
-# range(key1|2_p1=c1) AND
-# (range(key2_p2) OR range2(key3))
-# where range1(key3) and range2(key3) are disjoint
-# Varying values of the constant in range predicates we get plans:
-# 1. with an index scan over key2
-# 2. with an index scan over key4=key2_p2
-
-EXPLAIN
-SELECT * FROM City
- WHERE ((Population > 101000 AND Population < 11000) OR
- ID BETWEEN 3500 AND 3800) AND Country='USA'
- AND (Name LIKE 'P%' OR ID BETWEEN 4000 AND 4300);
-
-EXPLAIN
-SELECT * FROM City
- WHERE ((Population > 101000 AND Population < 11000) OR
- ID BETWEEN 3500 AND 3800) AND Country='USA'
- AND (Name LIKE 'Pho%' OR ID BETWEEN 4000 AND 4300);
-
-# The following 4 queries check that the plans
-# for the previous 2 plans are valid
-
-SELECT * FROM City USE INDEX ()
- WHERE ((Population > 101000 AND Population < 11000) OR
- ID BETWEEN 3500 AND 3800) AND Country='USA'
- AND (Name LIKE 'P%' OR ID BETWEEN 4000 AND 4300);
-
-SELECT * FROM City
- WHERE ((Population > 101000 AND Population < 11000) OR
- ID BETWEEN 3500 AND 3800) AND Country='USA'
- AND (Name LIKE 'P%' OR ID BETWEEN 4000 AND 4300);
-
-SELECT * FROM City USE INDEX ()
- WHERE ((Population > 101000 AND Population < 11000) OR
- ID BETWEEN 3500 AND 3800) AND Country='USA'
- AND (Name LIKE 'Pho%' OR ID BETWEEN 4000 AND 4300);
-
-SELECT * FROM City
- WHERE ((Population > 101000 AND Population < 11000) OR
- ID BETWEEN 3500 AND 3800) AND Country='USA'
- AND (Name LIKE 'Pho%' OR ID BETWEEN 4000 AND 4300);
-
-
-DROP INDEX Population ON City;
-DROP INDEX Name ON City;
-set optimizer_switch=@tmp_range_vs_index_merge;
-
-# The pattern of the WHERE condition used in the following query is
-# (key1|2_p1=c AND range(key1_p2)) OR (key1|2_p1=c AND range(key2_p2))
-# We get an index merge retrieval over key1, key2 for it
-
-EXPLAIN
-SELECT * FROM City
- WHERE Country='USA' AND Population BETWEEN 101000 AND 102000 OR
- Country='USA' AND Name LIKE 'Pa%';
-
-# The following 2 queries check that the plans
-# for the previous plan is valid
-
-SELECT * FROM City USE INDEX()
- WHERE Country='USA' AND Population BETWEEN 101000 AND 102000 OR
- Country='USA' AND Name LIKE 'Pa%';
-
-SELECT * FROM City
- WHERE Country='USA' AND Population BETWEEN 101000 AND 102000 OR
- Country='USA' AND Name LIKE 'Pa%';
-
-
-# The pattern of the WHERE condition used in the following query is
-# key1|2_p1=c AND (range(key1_p2) OR range(key2_p2))
-# We get an index merge retrieval over key1, key2 for it
-
-EXPLAIN
-SELECT * FROM City
- WHERE Country='USA' AND
- (Population BETWEEN 101000 AND 102000 OR Name LIKE 'Pa%');
-
-# The following 2 queries check that the plans
-# for the previous plan is valid
-
-SELECT * FROM City
- WHERE Country='USA' AND
- (Population BETWEEN 101000 AND 102000 OR Name LIKE 'Pa%');
-
-SELECT * FROM City
- WHERE Country='USA' AND
- (Population BETWEEN 101000 AND 102000 OR Name LIKE 'Pa%');
-
-
-#
-# LP bug #954262: index merge oover long disjunction in WHERE
-#
-
-set @save_optimizer_switch=@@optimizer_switch;
-
-CREATE INDEX CityName on City(Name);
-
-let $cond =
-(Name='Manila' AND Country='PHL') OR
-(Name='Addis Abeba' AND Country='ETH') OR
-(Name='Jakarta' AND Country='IDN') OR
-(Name='Bangalore' AND Country='IND') OR
-(Name='Teheran' AND Country='IRN') OR
-(Name='Roma' AND Country='ITA') OR
-(Name='Delhi' AND Country='IND') OR
-(Name='Venezia' AND Country='ITA') OR
-(Name='Tokyo' AND Country='JPN') OR
-(Name='Toronto' AND Country='CAN') OR
-(Name='Peking' AND Country='CHN') OR
-(Name='Lagos' AND Country='NGA') OR
-(Name='Tijuana' AND Country='MEX') OR
-(Name='Rabat' AND Country='MAR') OR
-(Name='Seoul' AND Country='KOR') OR
-(Name='Vancouver' AND Country='CAN') OR
-(Name='Kaunas' AND Country='LTU') OR
-(Name='Paris' AND Country='FRA') OR
-(Name='Dakar' AND Country='SEN') OR
-(Name='Basel' AND Country='CHE') OR
-(Name='Praha' AND Country='CZE') OR
-(Name='Ankara' AND Country='TUR') OR
-(Name='Dresden' AND Country='DEU') OR
-(Name='Lugansk' AND Country='UKR') OR
-(Name='Caracas' AND Country='VEN') OR
-(Name='Samara' AND Country='RUS') OR
-(Name='Seattle' AND Country='USA');
-
-eval
-EXPLAIN SELECT Name, Country, Population FROM City WHERE
-$cond;
-eval
-SELECT Name, Country, Population FROM City WHERE
-$cond;
-
-set optimizer_switch='index_merge=off';
-
-eval
-EXPLAIN SELECT Name, Country, Population FROM City WHERE
-$cond;
-eval
-SELECT Name, Country, Population FROM City WHERE
-$cond;
-
-set optimizer_switch=@save_optimizer_switch;
-
---echo #
---echo # Bug mdev-585: range vs index-merge with ORDER BY ... LIMIT n
---echo # (LP bug #637962)
---echo #
-
-DROP INDEX CountryPopulation ON City;
-DROP INDEX CountryName ON City;
-DROP INDEX CityName on City;
-
-CREATE INDEX Name ON City(Name);
-CREATE INDEX Population ON City(Population);
-
-
---replace_column 9 #
-EXPLAIN
-SELECT * FROM City
- WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H'))
- AND (Population >= 100000 AND Population < 120000);
-FLUSH STATUS;
-SELECT * FROM City
- WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H'))
- AND (Population >= 100000 AND Population < 120000);
-SHOW STATUS LIKE 'Handler_read_%';
-
-
---replace_column 9 #
-EXPLAIN
-SELECT * FROM City
- WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H'))
- AND (Population >= 100000 AND Population < 120000)
-ORDER BY Population LIMIT 5;
-
-FLUSH STATUS;
-SELECT * FROM City
- WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H'))
- AND (Population >= 100000 AND Population < 120000)
-ORDER BY Population LIMIT 5;
-SHOW STATUS LIKE 'Handler_read_%';
-
-
-set optimizer_switch='index_merge=off';
-
---replace_column 9 #
-EXPLAIN
-SELECT * FROM City
- WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H'))
- AND (Population >= 100000 AND Population < 120000)
-ORDER BY Population LIMIT 5;
-
-FLUSH STATUS;
-SELECT * FROM City
- WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H'))
- AND (Population >= 100000 AND Population < 120000)
-ORDER BY Population LIMIT 5;
-SHOW STATUS LIKE 'Handler_read_%';
-
-set optimizer_switch=@save_optimizer_switch;
-
-
-DROP DATABASE world;
-
-use test;
-
-#
-# Bug #17259: a bad range scan and a good index merge plan
-#
-
-CREATE TABLE t1 (
- id int(10) unsigned NOT NULL auto_increment,
- account_id int(10) unsigned NOT NULL,
- first_name varchar(50) default NULL,
- middle_name varchar(50) default NULL,
- last_name varchar(100) default NULL,
- home_address_1 varchar(150) default NULL,
- home_city varchar(75) default NULL,
- home_state char(2) default NULL,
- home_postal_code varchar(50) default NULL,
- home_county varchar(75) default NULL,
- home_country char(3) default NULL,
- work_address_1 varchar(150) default NULL,
- work_city varchar(75) default NULL,
- work_state char(2) default NULL,
- work_postal_code varchar(50) default NULL,
- work_county varchar(75) default NULL,
- work_country char(3) default NULL,
- login varchar(50) NOT NULL,
- PRIMARY KEY (id),
- KEY login (login,account_id),
- KEY account_id (account_id),
- KEY user_home_country_indx (home_country),
- KEY user_work_country_indx (work_country),
- KEY user_home_state_indx (home_state),
- KEY user_work_state_indx (work_state),
- KEY user_home_city_indx (home_city),
- KEY user_work_city_indx (work_city),
- KEY user_first_name_indx (first_name),
- KEY user_last_name_indx (last_name)
-);
-
-insert into t1(account_id, login, home_state, work_state) values
- (1, 'pw', 'ia', 'ia'), (1, 'pw', 'ia', 'ia'), (1, 'pw', 'ia', 'ia'),
- (1, 'pw', 'ia', 'ia'), (1, 'pw', 'ia', 'ia'), (1, 'pw', 'ia', 'ia');
-insert into t1(account_id, login, home_state, work_state)
- select 1, 'pw', 'ak', 'ak' from t1;
-insert into t1(account_id, login, home_state, work_state)
- select 1, 'pw', 'ak', 'ak' from t1;
-insert into t1(account_id, login, home_state, work_state)
- select 1, 'pw', 'ak', 'ak' from t1;
-insert into t1(account_id, login, home_state, work_state)
- select 1, 'pw', 'ak', 'ak' from t1;
-insert into t1(account_id, login, home_state, work_state)
- select 1, 'pw', 'ak', 'ak' from t1;
-insert into t1(account_id, login, home_state, work_state)
- select 1, 'pw', 'ak', 'ak' from t1;
-insert into t1(account_id, login, home_state, work_state)
- select 1, 'pw', 'ak', 'ak' from t1;
-insert into t1(account_id, login, home_state, work_state)
- select 1, 'pw', 'ak', 'ak' from t1;
-insert into t1(account_id, login, home_state, work_state)
- select 1, 'pw', 'ak', 'ak' from t1;
-
-analyze table t1;
-
-select count(*) from t1 where account_id = 1;
-
-select * from t1
- where (home_state = 'ia' or work_state='ia') and account_id = 1;
-
-explain
-select * from t1
- where (home_state = 'ia' or work_state='ia') and account_id = 1;
-
-drop table t1;
-
-#
-# Bug #17673: no index merge plan if the condition for the last used
-# index component is factored out of the or formula
-#
-
-CREATE TABLE t1 (
- c1 int(11) NOT NULL auto_increment,
- c2 decimal(10,0) default NULL,
- c3 decimal(10,0) default NULL,
- c4 decimal(10,0) default NULL,
- c5 decimal(10,0) default NULL,
- cp decimal(1,0) default NULL,
- ce decimal(10,0) default NULL,
- cdata char(20),
- PRIMARY KEY (c1),
- KEY k1 (c2,c3,cp,ce),
- KEY k2 (c4,c5,cp,ce)
-);
-
-insert into t1 (c2, c3, c4, c5, cp) values(1,1,1,1,1);
-insert into t1 (c2, c3, c4, c5, cp) values(2,1,1,1,4);
-insert into t1 (c2, c3, c4, c5, cp) values(2,1,2,1,1);
-insert into t1 (c2, c3, c4, c5, cp) values(2,1,3,1,4);
-insert into t1 (c2, c3, c4, c5, cp) values(3,1,4,1,4);
-
-insert into t1 (c2, c3, c4, c5, cp)
- select c2, c3, c4, c5, cp from t1 where cp = 4;
-insert into t1 (c2, c3, c4, c5, cp)
- select c2, c3, c4, c5, cp from t1 where cp = 4;
-insert into t1 (c2, c3, c4, c5, cp)
- select c2, c3, c4, c5, cp from t1 where cp = 4;
-insert into t1 (c2, c3, c4, c5, cp)
- select c2, c3, c4, c5, cp from t1 where cp = 4;
-insert into t1 (c2, c3, c4, c5, cp)
- select c2, c3, c4, c5, cp from t1 where cp = 4;
-insert into t1 (c2, c3, c4, c5, cp)
- select c2, c3, c4, c5, cp from t1 where cp = 4;
-insert into t1 (c2, c3, c4, c5, cp)
- select c2, c3, c4, c5, cp from t1 where cp = 4;
-insert into t1 (c2, c3, c4, c5, cp)
- select c2, c3, c4, c5, cp from t1 where cp = 4;
-insert into t1 (c2, c3, c4, c5, cp)
- select c2, c3, c4, c5, cp from t1 where cp = 4;
-insert into t1 (c2, c3, c4, c5, cp)
- select c2, c3, c4, c5, cp from t1 where cp = 4;
-insert into t1 (c2, c3, c4, c5, cp)
- select c2, c3, c4, c5, cp from t1 where cp = 4;
-
-analyze table t1;
-
-explain
- select * from t1 where (c2=1 and c3=1) or (c4=2 and c5=1);
-
-explain
- select * from t1
- where (c2=1 and c3=1 and cp=1) or (c4=2 and c5=1 and cp=1);
-
-explain
- select * from t1
- where ((c2=1 and c3=1) or (c4=2 and c5=1)) and cp=1;
-
-select * from t1
- where (c2=1 and c3=1 and cp=1) or (c4=2 and c5=1 and cp=1);
-
-select * from t1
- where ((c2=1 and c3=1) or (c4=2 and c5=1)) and cp=1;
-
-drop table t1;
-
-#
-# Bug #23322: a bad range scan and a good index merge plan
-#
-
-create table t1 (
- c1 int auto_increment primary key,
- c2 char(20),
- c3 char (20),
- c4 int
-);
-alter table t1 add key k1 (c2);
-alter table t1 add key k2 (c3);
-alter table t1 add key k3 (c4);
-
-insert into t1 values(null, 'a', 'b', 0);
-insert into t1 values(null, 'c', 'b', 0);
-insert into t1 values(null, 'a', 'd', 0);
-insert into t1 values(null, 'ccc', 'qqq', 0);
-
-insert into t1 (c2,c3) select c2,c3 from t1 where c2 != 'a';
-insert into t1 (c2,c3) select c2,c3 from t1 where c2 != 'a';
-insert into t1 (c2,c3) select c2,c3 from t1 where c2 != 'a';
-insert into t1 (c2,c3) select c2,c3 from t1 where c2 != 'a';
-insert into t1 (c2,c3) select c2,c3 from t1 where c2 != 'a';
-insert into t1 (c2,c3) select c2,c3 from t1 where c2 != 'a';
-insert into t1 (c2,c3) select c2,c3 from t1 where c2 != 'a';
-
-insert into t1 (c2,c3,c4) select c2,c3,1 from t1 where c2 != 'a';
-insert into t1 (c2,c3,c4) select c2,c3,2 from t1 where c2 != 'a';
-insert into t1 (c2,c3,c4) select c2,c3,3 from t1 where c2 != 'a';
-insert into t1 (c2,c3,c4) select c2,c3,4 from t1 where c2 != 'a';
-
-analyze table t1;
-
-select count(*) from t1 where (c2='e' OR c3='q');
-select count(*) from t1 where c4 != 0;
-
-explain
- select distinct c1 from t1 where (c2='e' OR c3='q');
-
-explain
- select distinct c1 from t1 where (c4!= 0) AND (c2='e' OR c3='q');
-
-drop table t1;
-
-#
-# Bug #30151: a bad range scan and a good index merge plan
-#
-
-create table t1 (
- id int unsigned auto_increment primary key,
- c1 char(12),
- c2 char(15),
- c3 char(1)
-);
-
-insert into t1 (c3) values ('1'), ('2');
-
-insert into t1 (c3) select c3 from t1;
-insert into t1 (c3) select c3 from t1;
-insert into t1 (c3) select c3 from t1;
-insert into t1 (c3) select c3 from t1;
-insert into t1 (c3) select c3 from t1;
-insert into t1 (c3) select c3 from t1;
-insert into t1 (c3) select c3 from t1;
-insert into t1 (c3) select c3 from t1;
-insert into t1 (c3) select c3 from t1;
-insert into t1 (c3) select c3 from t1;
-insert into t1 (c3) select c3 from t1;
-insert into t1 (c3) select c3 from t1;
-
-update t1 set c1=lpad(id+1000, 12, ' '), c2=lpad(id+10000, 15, ' ');
-
-alter table t1 add unique index (c1), add unique index (c2), add index (c3);
-
-analyze table t1;
-
-explain
- select * from t1 where (c1=' 100000' or c2=' 2000000');
-explain
- select * from t1 where (c1=' 100000' or c2=' 2000000') and c3='2';
-
-select * from t1 where (c1=' 100000' or c2=' 2000000');
-select * from t1 where (c1=' 100000' or c2=' 2000000') and c3='2';
-
-drop table t1;
-
-#
-# Bug #637978: invalid index merge access plan causes to wrong results
-#
-
-CREATE TABLE t1 (
- a smallint DEFAULT NULL,
- pk int NOT NULL AUTO_INCREMENT PRIMARY KEY,
- b varchar(10) DEFAULT NULL,
- c varchar(64) DEFAULT NULL,
- INDEX idx1 (a),
- INDEX idx2 (b),
- INDEX idx3 (c)
-);
---disable_query_log
---disable_result_log
-INSERT INTO t1 VALUES
-(30371,99001,'dl','e'),(3,99002,'Ohio','t'),(9,99003,'Delaware','xb'),
-(0,99004,'Pennsylvan','i'),(-199,99005,'y','d'),(0,99006,'with','Rhode Island'),
-(3,99007,'km','qkmiimdxbdljsejtsfrvwlrgacinbmfuosflnenlpomkmvbig'),
-(22860,99008,'ovqkmiimdx','uovqkmiimdxbdljsejtsfrvwlrgacinbmfuosflnenlpomkmvbig'),
-(212,99009,'f','p'),(NULL,99010,'i','k'),(20426,99011,'Vermont','New York'),
-(0,99012,'Oregon','w'),(31831,99013,'s','isrcijpuovqkmiimdxbdljsejtsfrvwl'),
-(123,99014,'t','p'),(32767,99015,'q','Maine'),
-(NULL,99016,'know','qqqpisrcijpuovqkmiimdxbdljsejtsfrvwlrgacinbmfuosflnenlpo'),
-(1,99017,'going','North Carolina'),(-717,99018,'ad','Indiana'),
-(32767,99019,'Maryland','aa'),(31280,99020,'Nebraska','Colorado'),
-(0,99021,'q','Ohio'),
-(5989,99022,'rovaadtqqq','lrovaadtqqqpisrcijpuovqkmiimdxbdljsejtsfrvwlrgacinb'),
-(89,99023,'n','Pennsylvania'),(0,99024,'Florida','c'),(97,99025,'Maine','y'),
-(149,99026,'xaemnl','Idaho'),(NULL,99027,'h','y'),(26276,99028,'going','New York'),
-(242,99029,'bdhxaemnlr','sbdhxaemnlrovaadtqqqpisrcijpuovqkmiimdxb'),
-(32767,99030,'if','a'),(26581,99031,'Arizona','q'),(45,99032,'ysazsbdhxa','f'),
-(0,99033,'qv','s'),(NULL,99034,'Louisiana','lqvfysazsbdhxaemnlrovaadtqqqpisrc'),
-(160,99035,'Connecticu','x'),(23241,99036,'lx','q'),(0,99037,'u','Colorado'),
-(-19141,99038,'w','h'),(218,99039,'s','uo'),(4,99040,'Montana','Oklahoma'),
-(97,99041,'r','ls'),(32767,99042,'q','v'),(7,99043,'mlsuownlnl','did'),
-(NULL,99044,'ui','i'),(2,99045,'to','I\'ll'),(0,99046,'Nevada','g'),
-(3251,99047,'y','New York'),(0,99048,'wyttuimlsu','you\'re'),
-(7,99049,'he','South Carolina'),(32767,99050,'s','right'),
-(172,99051,'Arizona','e'),(0,99052,'x','lxmvwyttuimlsuownlnlxklq'),
-(NULL,99053,'f','wfjlxmvwyttuimlsuownlnlxklqvfysazs'),(44,99054,'s','n'),
-(-17561,99055,'me','wm'),(88,99056,'y','my'),(7313,99057,'jx','New Hampshire'),
-(63,99058,'zl','South Carolina'),(9,99059,'ma','Illinois'),
-(6,99060,'lamazljxpg','like'),(17021,99061,'x','v'),(0,99062,'New Mexico','j'),
-(179,99427,'fliq','because'),
-(107,99063,'Virginia','Mississippi'),
-(0,99064,'si','to'),(113,99065,'Illinois','Kansas'),(20808,99066,'tsi','d'),
-(-15372,99067,'d','vdftsidjtvulamazljxpgiwmbnmwfjlxmvwyttuimlsuownlnl'),
-(0,99068,'y','then'),(2,99069,'all','b'),(NULL,99070,'by','Wisconsin'),
-(4,99071,'about','right'),(5,99072,'m','s'),(0,99073,'e','Pennsylvania'),
-(-28284,99074,'x','f'),(1,99075,'Rhode Isla','Georgia'),(NULL,99076,'p','was'),
-(168,99077,'Tennessee','Minnesota'),(18349,99078,'x','Rhode Island'),
-(5,99079,'as','d'),(12217,99080,'c','i'),(0,99081,'rdvdxboydm','s'),
-(19132,99082,'her','jerdvdxboydmpefbiesqbyyvdftsidjtvulamazljxpgiwmbn'),
-(0,99083,'all','jhjerdvdxboydmpefbiesqbyyvdftsidjtvulamazljx'),
-(32767,99084,'s','flj'),(-4947,99085,'something','Vermont'),
-(0,99086,'cjfljhjerd','Washington');
---enable_query_log
---enable_result_log
-
-SELECT COUNT(*) FROM t1 IGNORE INDEX (idx2,idx3)
- WHERE c = 'i' OR b IN ( 'Arkansas' , 'd' , 'pdib' , 'can' ) OR
- (pk BETWEEN 120 AND 79 + 255 OR a IN ( 4 , 179 , 1 ) ) AND a > 8 ;
-SELECT COUNT(*) FROM t1
- WHERE c = 'i' OR b IN ( 'Arkansas' , 'd' , 'pdib' , 'can' ) OR
- (pk BETWEEN 120 AND 79 + 255 OR a IN ( 4 , 179 , 1 ) ) AND a > 8 ;
-EXPLAIN
-SELECT COUNT(*) FROM t1
- WHERE c = 'i' OR b IN ( 'Arkansas' , 'd' , 'pdib' , 'can' ) OR
- (pk BETWEEN 120 AND 79 + 255 OR a IN ( 4 , 179 , 1 ) ) AND a > 8 ;
-
-DROP TABLE t1;
-
-#
-# Bug #684117: ORing of two index merge that caused a crash
-#
-
-CREATE TABLE t1 (
- f1 int, f2 int, f3 int, f4 int, f5 int,
- PRIMARY KEY (f4), KEY (f1), KEY (f2), KEY (f3)
-) ;
-INSERT INTO t1 VALUES (0,0,NULL,9,5), (0,0,1,9425,NULL);
-
-SELECT f5 FROM t1
- WHERE f2 != 1 OR f1 IS NULL OR f4 = 4 OR
- f2 AND (f4 BETWEEN 6 AND 255 OR f3 IS NULL);
-
-DROP TABLE t1;
-
-#
-# Bug #685952: An invalid index merge union plan
-#
-
-CREATE TABLE t1 (
- f1 int, f2 int, f3 int, f4 int,
- PRIMARY KEY (f1), KEY (f3), KEY (f4)
-);
-
-INSERT INTO t1 VALUES (9,0,2,6), (9930,0,0,NULL);
-
-SET SESSION optimizer_switch='index_merge_intersection=off';
-SET SESSION optimizer_switch='index_merge_sort_union=off';
-
-SET SESSION optimizer_switch='index_merge_union=off';
-
-EXPLAIN
-SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4)
- WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10
- OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 != 1 );
-
-SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4)
- WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10
- OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 != 1 );
-
-SET SESSION optimizer_switch='index_merge_union=on';
-
-EXPLAIN
-SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4)
- WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10
- OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 != 1 );
-
-SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4)
- WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10
- OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 != 1 );
-
-
-INSERT INTO t1 VALUES
- (93,0,3,6), (9933,0,3,3), (94,0,4,6), (9934,0,4,4),
- (95,0,5,6), (9935,0,5,5), (96,0,6,6), (9936,0,6,6),
- (97,0,7,6), (9937,0,7,7), (98,0,8,6), (9938,0,8,8),
- (99,0,9,6), (9939,0,9,9);
-
-SET SESSION optimizer_switch='index_merge_union=off';
-
-EXPLAIN
-SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4)
- WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10
- OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 != 1 );
-
-SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4)
- WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10
- OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 != 1 );
-
-SET SESSION optimizer_switch='index_merge_union=on';
-
-EXPLAIN
-SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4)
- WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10
- OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 != 1 );
-
-SELECT * FROM t1 FORCE KEY (PRIMARY,f3,f4)
- WHERE ( f3 = 1 OR f1 = 7 ) AND f1 < 10
- OR f3 BETWEEN 2 AND 2 AND ( f3 = 1 OR f4 != 1 );
-
-SET SESSION optimizer_switch=DEFAULT;
-
-DROP TABLE t1;
-
-#
-# Bug #752353: valgrind complain on a jump depending
-# on an uninitialised value
-#
-
-CREATE TABLE t1 (f1 int) ;
-INSERT INTO t1 VALUES (0), (0);
-
-CREATE TABLE t2 (f1 int, f2 int, f3 int, f4 int, INDEX idx (f3,f2)) ;
-INSERT INTO t2 VALUES (5,6,0,0), (0,4,0,0);
-
-CREATE TABLE t3 (f1 int, f2 int, INDEX idx1 (f2,f1) , INDEX idx2 (f1)) ;
-INSERT INTO t3 VALUES (6,0),( 4,0);
-
-SELECT * FROM t1,t2,t3
- WHERE (t2.f3 = 1 OR t3.f1=t2.f1) AND t3.f1 <> t2.f2 AND t3.f2 = t2.f4;
-
-DROP TABLE t1,t2,t3;
-
-#
-# LP bug #823301: index merge sort union with possible index scan
-#
-
-CREATE TABLE t1 (
- a int, b int, c int, d int,
- PRIMARY KEY(b), INDEX idx1(d), INDEX idx2(d,b,c)
-);
-INSERT INTO t1 VALUES
- (0,58,7,7),(0,63,2,0),(0,64,186,8),(0,65,1,-2), (0,71,190,-3),
- (0,72,321,-7),(0,73,0,3),(0,74,5,25),(0,75,5,3);
-
-SET SESSION optimizer_switch='index_merge_sort_union=off';
-EXPLAIN
-SELECT * FROM t1
- WHERE t1.b>7 AND t1.d>1 AND t1.d<>8 OR t1.d>=7 AND t1.d<8 OR t1.d>7;
-SELECT * FROM t1
- WHERE t1.b>7 AND t1.d>1 AND t1.d<>8 OR t1.d>=7 AND t1.d<8 OR t1.d>7;
-SET SESSION optimizer_switch='index_merge_sort_union=on';
-EXPLAIN
-SELECT * FROM t1
- WHERE t1.b>7 AND t1.d>1 AND t1.d<>8 OR t1.d>=7 AND t1.d<8 OR t1.d>7;
-SELECT * FROM t1
- WHERE t1.b>7 AND t1.d>1 AND t1.d<>8 OR t1.d>=7 AND t1.d<8 OR t1.d>7;
-SET SESSION optimizer_switch=DEFAULT;
-
-DROP TABLE t1;
-
-#
-# LP bug #800184: possible index merge sort union
-#
-
-CREATE TABLE t1 (a int NOT NULL PRIMARY KEY, b int, c int, INDEX idx(c,b));
-INSERT INTO t1 VALUES (19,1,NULL), (20,5,7);
-
-EXPLAIN
-SELECT * FROM t1
- WHERE t1.a>300 AND t1.c!=0 AND t1.b>=350 AND t1.b<=400 AND
- (t1.c=0 OR t1.a=500);
-SELECT * FROM t1
- WHERE t1.a>300 AND t1.c!=0 AND t1.b>=350 AND t1.b<=400 AND
- (t1.c=0 OR t1.a=500);
-
-DROP TABLE t1;
-
-#
-# LP bug #891953: always true OR
-#
-
-CREATE TABLE t1 (a int PRIMARY KEY, b int, INDEX idx(b));
-INSERT INTO t1 VALUES (167,9999), (168,10000);
-
-EXPLAIN
-SELECT * FROM t1
- WHERE a BETWEEN 4 AND 5 AND b IN (255,4) OR a IN (2,14,25) OR a!=2;
-SELECT * FROM t1
- WHERE a BETWEEN 4 AND 5 AND b IN (255,4) OR a IN (2,14,25) OR a!=2;
-
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-8603: Wrong result OR/AND condition over index fields
---echo #
-
-CREATE TABLE t1 (
- id INT NOT NULL,
- state VARCHAR(64),
- capital VARCHAR(64),
- UNIQUE KEY (id),
- KEY state (state,id),
- KEY capital (capital, id)
-);
-
-INSERT INTO t1 VALUES
- (1,'Arizona','Phoenix'),
- (2,'Hawaii','Honolulu'),
- (3,'Georgia','Atlanta'),
- (4,'Florida','Tallahassee'),
- (5,'Alaska','Juneau'),
- (6,'Michigan','Lansing'),
- (7,'Pennsylvania','Harrisburg'),
- (8,'Virginia','Richmond')
-;
-
-EXPLAIN
-SELECT * FROM t1 FORCE KEY (state,capital)
-WHERE ( state = 'Alabama' OR state >= 'Colorado' ) AND id != 9
- OR ( capital >= 'Topeka' OR state = 'Kansas' ) AND state != 'Texas';
-SELECT * FROM t1 FORCE KEY (state,capital)
-WHERE ( state = 'Alabama' OR state >= 'Colorado' ) AND id != 9
- OR ( capital >= 'Topeka' OR state = 'Kansas' ) AND state != 'Texas';
-
-DROP TABLE t1;
-
---echo #
---echo # mdev-11574: do not build index merge of two indexes when
---echo # one index is an infix of the other index
---echo #
-
-set names utf8;
-
-CREATE DATABASE world;
-
-use world;
-
---source include/world_schema.inc
-
---disable_query_log
---disable_result_log
---disable_warnings
---source include/world.inc
---enable_warnings
---enable_result_log
---enable_query_log
-
-DROP INDEX Country ON City;
-CREATE INDEX CountryName ON City(Country,Name);
-CREATE INDEX Name ON City(Name);
-
---disable_query_log
---disable_result_log
---disable_warnings
-ANALYZE TABLE City;
---enable_warnings
---enable_result_log
---enable_query_log
-
-let $q=
-select * from City
-where
- Country='FIN' AND Name IN ('Lahti','Imatra') OR
- Country='RUS' AND Name IN ('St Petersburg', 'Moscow') OR
- Country='SWE' AND Name IN ('Stockholm', 'Uppsala') OR
- Country='DEU' AND Name IN ('Berlin', 'Bonn') OR
- Country='BEL' AND Name IN ('Antwerpen', 'Gent') OR
- Country='PRT' AND Name IN ('Braga', 'Porto') OR
- Country='FRA' AND Name IN ('Paris', 'Marcel') OR
- Country='POL' AND Name IN ('Warszawa', 'Wroclaw') OR
- Country='NOR' AND Name IN ('Oslo', 'Bergen') OR
- Country='ITA' AND Name IN ('Napoli', 'Venezia');
-
-eval $q;
-eval explain $q;
-
-
-DROP DATABASE world;
-
-#the following command must be the last one in the file
-set session optimizer_switch='index_merge_sort_intersection=default';
-
diff --git a/mysql-test/t/range_vs_index_merge_innodb.test b/mysql-test/t/range_vs_index_merge_innodb.test
deleted file mode 100644
index e85cd044ece..00000000000
--- a/mysql-test/t/range_vs_index_merge_innodb.test
+++ /dev/null
@@ -1,7 +0,0 @@
---source include/have_innodb.inc
-
-SET SESSION STORAGE_ENGINE='InnoDB';
-
---source t/range_vs_index_merge.test
-
-SET SESSION STORAGE_ENGINE=DEFAULT;
diff --git a/mysql-test/t/read_many_rows_innodb.test b/mysql-test/t/read_many_rows_innodb.test
deleted file mode 100644
index ed86275447f..00000000000
--- a/mysql-test/t/read_many_rows_innodb.test
+++ /dev/null
@@ -1,17 +0,0 @@
-# t/read_many_rows_innodb.test
-#
-# Check how filesort and buffered-record-reads works with InnoDB.
-# This test takes a long time.
-#
-# Last update:
-# 2006-08-03 ML test refactored (MySQL 5.1)
-# main code --> include/read_many_rows_innodb.inc
-#
-
---source include/big_test.inc
-
---source include/have_innodb.inc
-let $engine_type= InnoDB;
-let $other_engine_type= MyISAM;
-
---source include/read_many_rows.inc
diff --git a/mysql-test/t/read_only.test b/mysql-test/t/read_only.test
deleted file mode 100644
index a05f813346e..00000000000
--- a/mysql-test/t/read_only.test
+++ /dev/null
@@ -1,346 +0,0 @@
-# Test of the READ_ONLY global variable:
-# check that it blocks updates unless they are only on temporary tables.
-
-# should work with embedded server after mysqltest is fixed
---source include/not_embedded.inc
-set @start_read_only= @@global.read_only;
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
---disable_warnings
-DROP TABLE IF EXISTS t1,t2,t3;
---enable_warnings
-
-# READ_ONLY does nothing to SUPER users
-# so we use a non-SUPER one:
-
-create user test@localhost;
-grant CREATE, SELECT, DROP on *.* to test@localhost;
-
-connect (con1,localhost,test,,test);
-
-connection default;
-
-set global read_only=0;
-
-connection con1;
-
-create table t1 (a int);
-create trigger trg1 before insert on t1 for each row set @a:=1;
-
-insert into t1 values(1);
-
-create table t2 select * from t1;
-
-connection default;
-
-set global read_only=1;
-
-# We check that SUPER can:
-
-create table t3 (a int);
-drop table t3;
-
-connection con1;
-
-select @@global.read_only;
-
---error ER_OPTION_PREVENTS_STATEMENT
-create table t3 (a int);
-
---error ER_OPTION_PREVENTS_STATEMENT
-insert into t1 values(1);
-
---error ER_OPTION_PREVENTS_STATEMENT
-drop trigger trg1;
-
-# if a statement, after parse stage, looks like it will update a
-# non-temp table, it will be rejected, even if at execution it would
-# have turned out that 0 rows would be updated
---error ER_OPTION_PREVENTS_STATEMENT
-update t1 set a=1 where 1=0;
-
-# multi-update is special (see sql_parse.cc) so we test it
---error ER_OPTION_PREVENTS_STATEMENT
-update t1,t2 set t1.a=t2.a+1 where t1.a=t2.a;
-
-# check multi-delete to be sure
---error ER_OPTION_PREVENTS_STATEMENT
-delete t1,t2 from t1,t2 where t1.a=t2.a;
-
-# With temp tables updates should be accepted:
-
-create temporary table t3 (a int);
-
-create temporary table t4 (a int) select * from t3;
-
-insert into t3 values(1);
-
-insert into t4 select * from t3;
-
---error ER_OPTION_PREVENTS_STATEMENT
-create table t3 (a int);
-
-# a non-temp table updated:
---error ER_OPTION_PREVENTS_STATEMENT
-update t1,t3 set t1.a=t3.a+1 where t1.a=t3.a;
-
-# no non-temp table updated (just swapped):
-update t1,t3 set t3.a=t1.a+1 where t1.a=t3.a;
-
-update t4,t3 set t4.a=t3.a+1 where t4.a=t3.a;
-
---error ER_OPTION_PREVENTS_STATEMENT
-delete t1 from t1,t3 where t1.a=t3.a;
-
-delete t3 from t1,t3 where t1.a=t3.a;
-
-delete t4 from t3,t4 where t4.a=t3.a;
-
-# and even homonymous ones
-
-create temporary table t1 (a int);
-
-insert into t1 values(1);
-
-update t1,t3 set t1.a=t3.a+1 where t1.a=t3.a;
-
-delete t1 from t1,t3 where t1.a=t3.a;
-
-drop table t1;
-
---error ER_OPTION_PREVENTS_STATEMENT
-insert into t1 values(1);
-
-#
-# MDEV-14056 DROP TEMPORARY TABLE IF EXISTS causes error 1290 with read_only option
-#
-drop temporary table if exists t1;
-
-#
-# Bug#11733 COMMITs should not happen if read-only is set
-#
-
-# LOCK TABLE ... WRITE / READ_ONLY
-# - is an error in the same connection
-# - is ok in a different connection
-
-connection default;
-set global read_only=0;
-lock table t1 write;
-
-connection con1;
-lock table t2 write;
-
-connection default;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-set global read_only=1;
-unlock tables ;
-# The following call blocks until con1 releases the write lock.
-# Blocking is expected.
---echo send set global read_only=1;
-send set global read_only=1;
-
-connection con1;
-select @@global.read_only;
-unlock tables ;
-let $wait_condition= SELECT @@global.read_only= 1;
---source include/wait_condition.inc
-select @@global.read_only;
-
-connection default;
---echo reap;
-reap;
-
-# LOCK TABLE ... READ / READ_ONLY
-# - is an error in the same connection
-# - is ok in a different connection
-
-connection default;
-set global read_only=0;
-lock table t1 read;
-
-connection con1;
-lock table t2 read;
-
-connection default;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-set global read_only=1;
-unlock tables ;
-
-# after unlock tables in current connection
-# the next command must be executed successfully
-set global read_only=1;
-select @@global.read_only;
-
-connection con1;
-select @@global.read_only;
-unlock tables ;
-
-connection default;
-
-# pending transaction / READ_ONLY
-# - is an error in the same connection
-# - is ok in a different connection
-
-connection default;
-set global read_only=0;
-BEGIN;
-
-connection con1;
-BEGIN;
-
-connection default;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-set global read_only=1;
-ROLLBACK;
-
-set global read_only=1;
-
-connection con1;
-select @@global.read_only;
-ROLLBACK;
-
-# Verify that FLUSH TABLES WITH READ LOCK do not block READ_ONLY
-# - in the same SUPER connection
-# - in another SUPER connection
-
-connection default;
-set global read_only=0;
-flush tables with read lock;
-set global read_only=1;
-unlock tables;
-
-connect (root2,localhost,root,,test);
-
-connection default;
-set global read_only=0;
-flush tables with read lock;
-
-connection root2;
-set global read_only=1;
-
-connection default;
-select @@global.read_only;
-unlock tables;
-disconnect root2;
-
-# Bug#22077 DROP TEMPORARY TABLE fails with wrong error if read_only is set
-#
-# check if DROP TEMPORARY on a non-existing temporary table returns the right
-# error
-
---error ER_BAD_TABLE_ERROR
-drop temporary table ttt;
-
-# check if DROP TEMPORARY TABLE IF EXISTS produces a warning with read_only set
-drop temporary table if exists ttt;
-
-#
-# Cleanup
-#
-connection default;
-set global read_only=0;
-disconnect con1;
-drop table t1,t2;
-drop user test@localhost;
-
---echo #
---echo # Bug#27440 read_only allows create and drop database
---echo #
-set global read_only= 1;
---disable_warnings
-drop database if exists mysqltest_db1;
-drop database if exists mysqltest_db2;
---enable_warnings
-
-delete from mysql.user where User like 'mysqltest_%';
-delete from mysql.db where User like 'mysqltest_%';
-delete from mysql.tables_priv where User like 'mysqltest_%';
-delete from mysql.columns_priv where User like 'mysqltest_%';
-flush privileges;
-
-create user `mysqltest_u1`@`%`;
-grant all on mysqltest_db2.* to `mysqltest_u1`@`%`;
-create database mysqltest_db1;
-grant all on mysqltest_db1.* to `mysqltest_u1`@`%`;
-flush privileges;
-connect (con_bug27440,127.0.0.1,mysqltest_u1,,test,$MASTER_MYPORT,);
-connection con_bug27440;
---error ER_OPTION_PREVENTS_STATEMENT
-create database mysqltest_db2;
-show databases like '%mysqltest_db2%';
---error ER_OPTION_PREVENTS_STATEMENT
-drop database mysqltest_db1;
-disconnect con_bug27440;
-connection default;
-delete from mysql.user where User like 'mysqltest_%';
-delete from mysql.db where User like 'mysqltest_%';
-delete from mysql.tables_priv where User like 'mysqltest_%';
-delete from mysql.columns_priv where User like 'mysqltest_%';
-flush privileges;
-drop database mysqltest_db1;
-set global read_only= @start_read_only;
-
-
---echo #
---echo # WL#5968 Implement START TRANSACTION READ (WRITE|ONLY);
---echo #
-
---echo #
---echo # Test interaction with read_only system variable.
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1(a INT);
-INSERT INTO t1 VALUES (1), (2);
-
-CREATE USER user1;
-connect (con1, localhost, user1);
-connection default;
-
-SET GLOBAL read_only= 1;
-
---echo # All allowed with super privilege
-START TRANSACTION;
-COMMIT;
-
-START TRANSACTION READ ONLY;
-COMMIT;
-
-START TRANSACTION READ WRITE;
-COMMIT;
-
---echo # We allow implicit RW transaction without super privilege
---echo # for compatibility reasons
-connection con1;
-START TRANSACTION;
---echo # Check that table updates are still disallowed.
---error ER_OPTION_PREVENTS_STATEMENT
-INSERT INTO t1 VALUES (3);
---error ER_OPTION_PREVENTS_STATEMENT
-UPDATE t1 SET a= 1;
---error ER_OPTION_PREVENTS_STATEMENT
-DELETE FROM t1;
-COMMIT;
-
-START TRANSACTION READ ONLY;
-COMMIT;
-
---echo # Explicit RW trans is not allowed without super privilege
---error ER_OPTION_PREVENTS_STATEMENT
-START TRANSACTION READ WRITE;
-COMMIT;
-disconnect con1;
---source include/wait_until_disconnected.inc
-connection default;
-DROP USER user1;
-
-SET GLOBAL read_only= 0;
-DROP TABLE t1;
-
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/read_only_innodb.test b/mysql-test/t/read_only_innodb.test
deleted file mode 100644
index 9ba3ccaca07..00000000000
--- a/mysql-test/t/read_only_innodb.test
+++ /dev/null
@@ -1,251 +0,0 @@
-# should work with embedded server after mysqltest is fixed
--- source include/not_embedded.inc
--- source include/have_innodb.inc
-
-#
-# BUG#11733: COMMITs should not happen if read-only is set
-#
-
---disable_warnings
-DROP TABLE IF EXISTS table_11733 ;
---enable_warnings
-
-# READ_ONLY does nothing to SUPER users
-# so we use a non-SUPER one:
-
-create user test@localhost;
-grant CREATE, SELECT, DROP on *.* to test@localhost;
-
-connect (con1,localhost,test,,test);
-
-connection default;
-set global read_only=0;
-
-# Any transactional engine will do
-create table table_11733 (a int) engine=InnoDb;
-
-connection con1;
-BEGIN;
-insert into table_11733 values(11733);
-
-connection default;
-set global read_only=1;
-
-connection con1;
-select @@global.read_only;
-select * from table_11733 ;
---error ER_OPTION_PREVENTS_STATEMENT
-COMMIT;
-
-connection default;
-set global read_only=0;
-drop table table_11733 ;
-drop user test@localhost;
-
-disconnect con1;
-
-#
-# Bug #35732: read-only blocks SELECT statements in InnoDB
-#
-# Test 1: read only mode
-create user test@localhost;
-GRANT CREATE, SELECT, DROP ON *.* TO test@localhost;
-connect(con1, localhost, test, , test);
-
-connection default;
-CREATE TABLE t1(a INT) ENGINE=INNODB;
-INSERT INTO t1 VALUES (0), (1);
-SET GLOBAL read_only=1;
-
-connection con1;
-SELECT * FROM t1;
-BEGIN;
-SELECT * FROM t1;
-COMMIT;
-
-connection default;
-SET GLOBAL read_only=0;
-
-#
-# Test 2: global read lock
-#
-FLUSH TABLES WITH READ LOCK;
-
-connection con1;
-SELECT * FROM t1;
-BEGIN;
-SELECT * FROM t1;
-COMMIT;
-
-#
-# Tests that LOCK TABLE doesn't block the SET READ_ONLY=1 for the InnoDB tables
-#
-
-connection default;
-UNLOCK TABLES;
-
-connection con1;
-lock table t1 read;
-
-connection default;
-set global read_only=1;
-
-connection con1;
-unlock tables;
-
-connection default;
-SET GLOBAL read_only=0;
-
-UNLOCK TABLES;
-DROP TABLE t1;
-DROP USER test@localhost;
-
-disconnect con1;
-
---echo echo End of 5.1 tests
-
---echo #
---echo # Bug#33669: Transactional temporary tables do not work under --read-only
---echo #
-
---disable_warnings
-DROP DATABASE IF EXISTS db1;
---enable_warnings
-
---echo # Setup user and tables
-CREATE USER bug33669@localhost;
-CREATE DATABASE db1;
-CREATE TABLE db1.t1 (a INT) ENGINE=INNODB;
-CREATE TABLE db1.t2 (a INT) ENGINE=INNODB;
-INSERT INTO db1.t1 VALUES (1);
-INSERT INTO db1.t2 VALUES (2);
-GRANT CREATE TEMPORARY TABLES, DROP, INSERT, DELETE, UPDATE,
- SELECT, LOCK TABLES ON db1.* TO bug33669@localhost;
-SET GLOBAL READ_ONLY = ON;
-connect(con1,localhost,bug33669,,db1);
-
---echo
---echo # Create, insert and drop temporary table:
---echo
-CREATE TEMPORARY TABLE temp (a INT) ENGINE=INNODB;
-INSERT INTO temp VALUES (1);
-DROP TABLE temp;
-
---echo
---echo # Lock base tables and use temporary table:
---echo
-CREATE TEMPORARY TABLE temp (a INT) ENGINE=INNODB;
-LOCK TABLES t1 READ, t2 READ;
-SELECT * FROM t1;
-INSERT INTO temp values (1);
-SELECT * FROM t2;
-UNLOCK TABLES;
-DROP TABLE temp;
-
---echo
---echo # Transaction
---echo
-BEGIN;
-SELECT * FROM t1;
-CREATE TEMPORARY TABLE temp (a INT) ENGINE=INNODB;
---error ER_OPTION_PREVENTS_STATEMENT
-INSERT INTO t1 VALUES (1);
-INSERT INTO temp VALUES (1);
-SELECT * FROM t2;
-ROLLBACK;
-SELECT * FROM temp;
-DROP TABLE temp;
-
---echo
---echo # Lock base table as READ and temporary table as WRITE:
---echo
-CREATE TEMPORARY TABLE temp (a INT) ENGINE=INNODB;
-LOCK TABLES t1 READ, temp WRITE;
-SELECT * FROM t1;
-SELECT * FROM temp;
---error ER_OPTION_PREVENTS_STATEMENT
-INSERT INTO t1 VALUES (1);
-INSERT INTO temp VALUES (1);
-DROP TABLE temp;
-UNLOCK TABLES;
-
---echo
---echo # Lock temporary table that shadows a base table:
---echo
-CREATE TEMPORARY TABLE t1 (a INT) ENGINE=INNODB;
-LOCK TABLES t1 WRITE;
-DROP TABLE t1;
---error ER_TABLE_NOT_LOCKED
-SELECT * FROM t1;
-
---echo
---echo # INSERT SELECT from base table into temporary table:
---echo
-
-CREATE TEMPORARY TABLE temp1 (a INT) ENGINE=INNODB;
-CREATE TEMPORARY TABLE temp2 LIKE temp1;
-BEGIN;
-INSERT INTO temp1 VALUES (10);
-INSERT INTO temp2 VALUES (10);
-INSERT INTO temp1 SELECT * FROM t1;
-INSERT INTO temp2 SELECT * FROM t2;
-SELECT * FROM temp1 ORDER BY a;
-SELECT * FROM temp2 ORDER BY a;
-ROLLBACK;
-SELECT * FROM temp1,temp2;
-LOCK TABLES t1 READ, t2 READ;
-INSERT INTO temp1 VALUES (10);
-INSERT INTO temp2 VALUES (10);
-INSERT INTO temp1 SELECT * FROM t1;
-INSERT INTO temp2 SELECT * FROM t2;
-SELECT * FROM temp1 ORDER BY a;
-SELECT * FROM temp2 ORDER BY a;
-UNLOCK TABLES;
-DELETE temp1, temp2 FROM temp1, temp2;
-INSERT INTO temp1 VALUES (10);
-INSERT INTO temp2 VALUES (10);
-INSERT INTO temp1 SELECT * FROM t1;
-INSERT INTO temp2 SELECT * FROM t2;
-SELECT * FROM temp1 ORDER BY a;
-SELECT * FROM temp2 ORDER BY a;
-DROP TABLE temp1, temp2;
-
---echo
---echo # INSERT and INSERT SELECT that uses subqueries:
-CREATE TEMPORARY TABLE temp1 (a INT) ENGINE=INNODB;
-CREATE TEMPORARY TABLE temp2 LIKE temp1;
-INSERT INTO temp1 (a) VALUES ((SELECT MAX(a) FROM t1));
-LOCK TABLES t2 READ;
-INSERT INTO temp2 (a) VALUES ((SELECT MAX(a) FROM t2));
-UNLOCK TABLES;
-LOCK TABLES t1 READ, t2 READ;
-INSERT INTO temp1 SELECT * FROM t1 WHERE a < (SELECT MAX(a) FROM t2);
-INSERT INTO temp2 SELECT * FROM t2 WHERE a > (SELECT MAX(a) FROM t1);
-UNLOCK TABLES;
-INSERT INTO temp1 SELECT * FROM t1 WHERE a < (SELECT MAX(a) FROM t2);
-INSERT INTO temp2 SELECT * FROM t2 WHERE a > (SELECT MAX(a) FROM t1);
-SELECT * FROM temp1 ORDER BY a;
-SELECT * FROM temp2 ORDER BY a;
-DROP TABLE temp1, temp2;
-
---echo
---echo # Multiple table update:
---echo
-
-CREATE TEMPORARY TABLE temp1 (a INT) ENGINE=INNODB;
-CREATE TEMPORARY TABLE temp2 LIKE temp1;
-INSERT INTO temp1 VALUES (1),(2);
-INSERT INTO temp2 VALUES (3),(4);
-UPDATE temp1,temp2 SET temp1.a = 5, temp2.a = 10;
-SELECT * FROM temp1, temp2;
-DROP TABLE temp1, temp2;
-
---echo
---echo # Disconnect and cleanup
---echo
-disconnect con1;
-connection default;
-SET GLOBAL READ_ONLY = OFF;
-DROP USER bug33669@localhost;
-DROP DATABASE db1;
-
diff --git a/mysql-test/t/rename.test b/mysql-test/t/rename.test
deleted file mode 100644
index a55bc845acc..00000000000
--- a/mysql-test/t/rename.test
+++ /dev/null
@@ -1,97 +0,0 @@
-#
-# Test of rename table
-#
-
---source include/count_sessions.inc
-
---disable_warnings
-drop table if exists t0,t1,t2,t3,t4;
-# Clear up from other tests (to ensure that SHOW TABLES below is right)
-drop table if exists t0,t5,t6,t7,t8,t9,t1_1,t1_2,t9_1,t9_2;
---enable_warnings
-
-create table t0 SELECT 1,"table 1";
-create table t2 SELECT 2,"table 2";
-create table t3 SELECT 3,"table 3";
-rename table t0 to t1;
-rename table t3 to t4, t2 to t3, t1 to t2, t4 to t1;
-select * from t1;
-rename table t3 to t4, t2 to t3, t1 to t2, t4 to t1;
-rename table t3 to t4, t2 to t3, t1 to t2, t4 to t1;
-select * from t1;
-
-# The following should give errors
---error ER_TABLE_EXISTS_ERROR
-rename table t1 to t2;
---error ER_TABLE_EXISTS_ERROR
-rename table t1 to t1;
---error ER_TABLE_EXISTS_ERROR
-rename table t3 to t4, t2 to t3, t1 to t2, t4 to t2;
-show tables like "t_";
---error ER_TABLE_EXISTS_ERROR
-rename table t3 to t1, t2 to t3, t1 to t2, t4 to t1;
---error ER_NO_SUCH_TABLE
-rename table t3 to t4, t5 to t3, t1 to t2, t4 to t1;
-
-select * from t1;
-select * from t2;
-select * from t3;
-
-# This should give a warning for t4
-drop table if exists t1,t2,t3,t4;
-
-#
-# Bug #2397 RENAME TABLES is not blocked by
-# FLUSH TABLES WITH READ LOCK
-#
-
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-
-connection con1;
-CREATE TABLE t1 (a int);
-CREATE TABLE t3 (a int);
-connection con2;
-FLUSH TABLES WITH READ LOCK;
-connection con1;
-send RENAME TABLE t1 TO t2, t3 to t4;
-connection con2;
-show tables;
-UNLOCK TABLES;
-connection con1;
-reap;
-connection con2;
-
-# Wait for the the tables to be renamed
-# i.e the query below succeds
-let $query= select * from t2, t4;
-source include/wait_for_query_to_succeed.inc;
-
-show tables;
-
-drop table t2, t4;
-
-disconnect con2;
-disconnect con1;
-connection default;
-
-
---echo End of 4.1 tests
-
-
---echo #
---echo # Bug#14959: "ALTER TABLE isn't able to rename a view"
---echo # Bug#53976: "ALTER TABLE RENAME is allowed on views
---echo # (not documented, broken)"
---echo #
-create table t1(f1 int);
-create view v1 as select * from t1;
---error ER_WRONG_OBJECT
-alter table v1 rename to v2;
-drop view v1;
-drop table t1;
-
---echo End of 5.0 tests
-
---source include/wait_until_count_sessions.inc
-
diff --git a/mysql-test/t/renamedb.test b/mysql-test/t/renamedb.test
deleted file mode 100644
index 71d0c127058..00000000000
--- a/mysql-test/t/renamedb.test
+++ /dev/null
@@ -1,53 +0,0 @@
-
-# TODO: enable these tests when RENAME DATABASE is implemented.
-#
-# --disable_warnings
-# drop database if exists testdb1;
-# --enable_warnings
-#
-# create database testdb1 default character set latin2;
-# use testdb1;
-# create table t1 (a int);
-# insert into t1 values (1),(2),(3);
-# show create database testdb1;
-# show tables;
-# rename database testdb1 to testdb2;
-# --error 1049
-# show create database testdb1;
-# show create database testdb2;
-# select database();
-# show tables;
-# select a from t1 order by a;
-# drop database testdb2;
-#
-#
-# Bug#19392 Rename Database: Crash if case change
-#
-# create database testdb1;
-# --error 1007
-# rename database testdb1 to testdb1;
-# drop database testdb1;
-
-#
-# WL#4030 (Deprecate RENAME DATABASE: replace with ALTER DATABASE <name> UPGRADE)
-#
-
---error ER_PARSE_ERROR
-rename database testdb1 to testdb2;
-
---error ER_WRONG_USAGE
-ALTER DATABASE wrong UPGRADE DATA DIRECTORY NAME;
-
---error ER_WRONG_USAGE
-ALTER DATABASE `#mysql41#not-supported` UPGRADE DATA DIRECTORY NAME;
-
---error ER_WRONG_USAGE
-ALTER DATABASE `#mysql51#not-yet` UPGRADE DATA DIRECTORY NAME;
-
---error ER_WRONG_DB_NAME
-ALTER DATABASE `#mysql50#` UPGRADE DATA DIRECTORY NAME;
-
---error ER_BAD_DB_ERROR
-ALTER DATABASE `#mysql50#upgrade-me` UPGRADE DATA DIRECTORY NAME;
-
-
diff --git a/mysql-test/t/reopen_temp_table.test b/mysql-test/t/reopen_temp_table.test
deleted file mode 100644
index 2aa6caa1655..00000000000
--- a/mysql-test/t/reopen_temp_table.test
+++ /dev/null
@@ -1,184 +0,0 @@
---source include/have_innodb.inc
-
---echo #
---echo # MDEV-5535: Cannot reopen temporary table
---echo #
-
---disable_warnings
-DROP DATABASE IF EXISTS temp_db;
---enable_warnings
-
-CREATE DATABASE temp_db;
-USE temp_db;
-
---echo #
---echo # Reopen temporary table
---echo #
-
-CREATE TEMPORARY TABLE t1(i int)ENGINE=INNODB;
-INSERT INTO t1 VALUES(1), (2);
-SELECT * FROM t1 a, t1 b;
-DROP TABLE t1;
-
---echo #
---echo # CREATE & Stored routines
---echo #
-
-DELIMITER |;
-CREATE FUNCTION f1() RETURNS INT
-BEGIN
- DROP TEMPORARY TABLE t1;
- RETURN 1;
-END|
-DELIMITER ;|
---error ER_BAD_TABLE_ERROR
-CREATE TEMPORARY TABLE t1 AS SELECT f1();
-DROP FUNCTION f1;
-
-DELIMITER |;
-CREATE FUNCTION f2() RETURNS INT
-BEGIN
- CREATE TEMPORARY TABLE t2(i INT);
- INSERT INTO t2 VALUES(1), (2);
- RETURN 1;
-END|
-DELIMITER ;|
---error ER_TABLE_EXISTS_ERROR
-CREATE TEMPORARY TABLE t2 AS SELECT f2();
-SELECT * FROM t2;
-DROP TABLE t2;
-DROP FUNCTION f2;
-
-CREATE TEMPORARY TABLE t3 AS SELECT 1 AS a;
-DELIMITER |;
-CREATE PROCEDURE p1()
-BEGIN
- DROP TEMPORARY TABLE t3;
-end|
-CREATE FUNCTION f3() RETURNS INT
-BEGIN
- CALL p1();
- RETURN 1;
-END|
-DELIMITER ;|
-PREPARE STMT FROM "SELECT f3() AS my_Column, a FROM t3";
---error ER_CANT_REOPEN_TABLE
-EXECUTE STMT;
-DROP TABLE t3;
-DROP FUNCTION f3;
-DROP PROCEDURE p1;
-
-CREATE TEMPORARY TABLE t4 (i INT);
-INSERT INTO t4 VALUES(1), (2);
-DELIMITER |;
-CREATE FUNCTION f4() RETURNS INT
-BEGIN
- DROP TEMPORARY TABLE t4;
- RETURN 1;
-END|
-DELIMITER ;|
---error ER_CANT_REOPEN_TABLE
-SELECT f4() FROM t4;
-SELECT * FROM t4;
-DROP TABLE t4;
-DROP FUNCTION f4;
-
-CREATE TEMPORARY TABLE t5 AS SELECT 1 AS a;
-DELIMITER |;
-CREATE PROCEDURE p2()
-BEGIN
- DROP TEMPORARY TABLE t5;
-END|
-CREATE FUNCTION f5() RETURNS INT
-BEGIN
- CALL p2();
- RETURN 1;
-END|
-DELIMITER ;|
---error ER_CANT_REOPEN_TABLE
-SELECT f5() AS my_column, a FROM t5;
-DROP TABLE t5;
-DROP FUNCTION f5;
-DROP PROCEDURE p2;
-
---echo #
---echo # CTAS
---echo #
-
-CREATE TABLE t1(i INT);
-INSERT INTO t1 VALUES(1), (2);
-CREATE TEMPORARY TABLE t1
- SELECT temp_1.i a, temp_2.i b FROM t1 AS temp_1, t1 AS temp_2;
-SELECT * FROM t1;
-DROP TABLE t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # HANDLER
---echo #
-
-CREATE TABLE t1 (a INT, KEY a(a));
-INSERT INTO t1 (a) VALUES (1), (2), (3), (4), (5);
-CREATE TABLE t2 (a INT, KEY a (a)) SELECT * FROM t1;
-CREATE TEMPORARY TABLE t3 (a INT, KEY a (a)) SELECT * FROM t2;
-HANDLER t3 OPEN;
-SELECT * FROM t1;
-LOCK TABLE t1 READ;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-HANDLER t3 OPEN;
-UNLOCK TABLES;
---error ER_NONUNIQ_TABLE
-HANDLER t3 OPEN;
-HANDLER t3 READ NEXT;
-HANDLER t3 OPEN AS t3_1;
-HANDLER t3_1 READ NEXT;
-HANDLER t3_1 READ NEXT;
-HANDLER t3 CLOSE;
-HANDLER t3_1 CLOSE;
-DROP TEMPORARY TABLE t3;
-DROP TABLE t1, t2;
-
---echo #
---echo # INSERT-SELECT
---echo #
-
-CREATE TEMPORARY TABLE t4 (a INT) ENGINE=MYISAM;
-INSERT INTO t4 VALUES(1), (2);
-INSERT INTO t4 SELECT * FROM t4;
-SELECT COUNT(*) FROM t4;
-DROP TABLE t4;
-
-CREATE TABLE t5 (a INT) ENGINE=INNODB;
-CREATE TEMPORARY TABLE t6 (a INT) ENGINE=INNODB;
-INSERT INTO t5 VALUES(1), (2);
-INSERT INTO t6 SELECT * FROM t5;
-INSERT INTO t6 SELECT * FROM t6;
-INSERT INTO t5 SELECT * FROM t6;
-SELECT COUNT(*)=6 FROM t5;
-SELECT COUNT(*)=4 FROM t6;
-DROP TABLE t5, t6;
-
---echo #
---echo # MDEV-10216: Assertion `strcmp(share->unique_file_name,filename) ||
---echo # share->last_version' failed in myisam/mi_open.c:67: test_if_reopen
---echo #
-CREATE TEMPORARY TABLE t7 (i INT) ENGINE=MYISAM;
-INSERT INTO t7 VALUES(1);
-ALTER TABLE t7 RENAME TO t;
-SELECT * FROM t a, t b;
-DROP TABLE t;
-
-CREATE TEMPORARY TABLE t7 (i INT) ENGINE=ARIA;
-INSERT INTO t7 VALUES(1);
-ALTER TABLE t7 RENAME TO t;
-SELECT * FROM t a, t b;
-DROP TABLE t;
-
-CREATE TEMPORARY TABLE t8 (i INT) ENGINE=ARIA;
-ALTER TABLE t8 rename to t;
-SELECT (SELECT 1 FROM t a1, t a2 ) AS f1, ( SELECT 2 FROM t a3 ) AS f2 FROM DUAL;
-DROP TABLE t;
-
---echo # Cleanup
-DROP DATABASE temp_db;
diff --git a/mysql-test/t/repair.test b/mysql-test/t/repair.test
deleted file mode 100644
index 5494e370133..00000000000
--- a/mysql-test/t/repair.test
+++ /dev/null
@@ -1,240 +0,0 @@
-#
-# Test of repair table
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1 SELECT 1,"table 1";
-repair table t1 use_frm;
-alter table t1 ENGINE=HEAP;
-repair table t1 use_frm;
-drop table t1;
-
-#
-# disabled keys during repair
-#
-create table t1(id int PRIMARY KEY, st varchar(10), KEY st_key(st));
-insert into t1 values(1, "One");
-alter table t1 disable keys;
-show keys from t1;
-repair table t1 extended;
-show keys from t1;
-drop table t1;
-
-
-# non-existent table
-repair table t1 use_frm;
-
-create table t1 engine=myisam SELECT 1,"table 1";
-flush tables;
-let $MYSQLD_DATADIR= `select @@datadir`;
-system echo 1 > $MYSQLD_DATADIR/test/t1.MYI ;
-repair table t1;
-repair table t1 use_frm;
-drop table t1;
-
-#
-# BUG#18874 - Setting myisam_repair_threads > 1, index cardinality always 1
-#
-CREATE TABLE t1(a INT, KEY(a));
-INSERT INTO t1 VALUES(1),(2),(3),(4),(5);
-SET myisam_repair_threads=2;
-REPAIR TABLE t1;
-SHOW INDEX FROM t1;
-SET myisam_repair_threads=@@global.myisam_repair_threads;
-DROP TABLE t1;
-
-#
-# BUG#22562 - REPAIR TABLE .. USE_FRM causes server crash on Windows and
-# server hangs on Linux
-#
-CREATE TABLE t1(a INT);
-USE mysql;
-REPAIR TABLE test.t1 USE_FRM;
-USE test;
-DROP TABLE t1;
-
-#
-# BUG#23175 - MYISAM crash/repair failed during repair
-#
-CREATE TABLE t1(a CHAR(255), KEY(a));
-SET myisam_sort_buffer_size=4096;
---replace_regex /Current myisam_sort_buffer_size.*/X/
-INSERT INTO t1 VALUES
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0');
-SET myisam_repair_threads=2;
---replace_regex /Current myisam_sort_buffer_size.*/X/
-REPAIR TABLE t1;
-SET myisam_repair_threads=@@global.myisam_repair_threads;
-SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
-DROP TABLE t1;
-
-#
-# BUG#31174 - "Repair" command on MyISAM crashes with small
-# myisam_sort_buffer_size
-#
-CREATE TABLE t1(a CHAR(255), KEY(a));
-SET myisam_sort_buffer_size=4496;
-INSERT INTO t1 VALUES
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),
-('0'),('0'),('0'),('0'),('0'),('0'),('0');
-SET myisam_repair_threads=2;
-REPAIR TABLE t1;
-SET myisam_repair_threads=@@global.myisam_repair_threads;
-SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
-DROP TABLE t1;
-
---echo # End of 4.1 tests
-
-#
-# BUG#36055 - mysql_upgrade doesn't really 'upgrade' tables
-#
-
---echo # Test with a saved table from 4.1
-let $MYSQLD_DATADIR= `select @@datadir`;
---copy_file std_data/bug36055.frm $MYSQLD_DATADIR/test/t1.frm
---copy_file std_data/bug36055.MYD $MYSQLD_DATADIR/test/t1.MYD
---copy_file std_data/bug36055.MYI $MYSQLD_DATADIR/test/t1.MYI
-
---replace_column 12 # 13 #
-SHOW TABLE STATUS LIKE 't1';
-SELECT * FROM t1;
-
---echo # Run CHECK TABLE, it should indicate table need a REPAIR TABLE
-CHECK TABLE t1 FOR UPGRADE;
-
---echo # REPAIR old table USE_FRM should fail
-REPAIR TABLE t1 USE_FRM;
-
---echo # Run REPAIR TABLE to upgrade .frm file
-REPAIR TABLE t1;
---replace_column 12 # 13 #
-SHOW TABLE STATUS LIKE 't1';
-SELECT * FROM t1;
-
-REPAIR TABLE t1 USE_FRM;
-SELECT * FROM t1;
-
-DROP TABLE t1;
-
---echo # End of 5.0 tests
-
-#
-# Bug#18775 - Temporary table from alter table visible to other threads
-#
-# REPAIR TABLE ... USE_FRM on temporary table crashed the table or server.
---disable_warnings
-DROP TABLE IF EXISTS tt1;
---enable_warnings
-CREATE TEMPORARY TABLE tt1 (c1 INT);
-REPAIR TABLE tt1 USE_FRM;
-DROP TABLE tt1;
-
-
---echo #
---echo # Bug #48248 assert in MDL_ticket::upgrade_shared_lock_to_exclusive
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1(a INT);
-LOCK TABLES t1 READ;
-REPAIR TABLE t1;
-
-UNLOCK TABLES;
-DROP TABLE t1;
-
-
---echo #
---echo # Test for bug #50784 "MDL: Assertion `m_tickets.is_empty() ||
---echo # m_tickets.front() == m_trans_sentinel'"
---echo #
---disable_warnings
-drop tables if exists t1, t2;
---enable_warnings
-create table t1 (i int);
-create table t2 (j int);
-set @@autocommit= 0;
-repair table t1, t2;
-set @@autocommit= default;
-drop tables t1, t2;
-
---echo #
---echo # Check that we have decent error messages when using crashed
---echo # .frm file from MySQL 3.23
---echo #
-
---echo # Test with a saved table from 3.23
-let $MYSQLD_DATADIR= `select @@datadir`;
---copy_file std_data/host_old.frm $MYSQLD_DATADIR/test/t1.frm
---copy_file std_data/host_old.MYD $MYSQLD_DATADIR/test/t1.MYD
---copy_file std_data/host_old.MYI $MYSQLD_DATADIR/test/t1.MYI
-
---error ER_GET_ERRNO
-select count(*) from t1;
-check table t1;
-repair table t1;
-repair table t1 use_frm;
-select count(*) from t1;
-check table t1;
-drop table t1;
-
-#
-# MDEV-8115 mysql_upgrade crashes the server with REPAIR VIEW
-#
-create table t1 (a blob);
-create view v1 as select * from t1;
-repair view v1;
-drop view v1;
-drop table t1;
-
---echo # End of 5.5 tests
-
-#
-# MDEV-11539 test_if_reopen: Assertion `strcmp(share->unique_file_name,filename) || share->last_version' failed upon select from I_S
-#
-CREATE TABLE t1 (i INT) ENGINE=MyISAM;
-INSERT t1 VALUES (1);
-LOCK TABLE t1 WRITE;
-REPAIR TABLE t1;
---disable_result_log
-SELECT * FROM INFORMATION_SCHEMA.TABLES;
---enable_result_log
-SELECT * FROM t1;
-UNLOCK TABLES;
-DROP TABLE t1;
-
---echo # End of 10.0 tests
diff --git a/mysql-test/t/repair_symlink-5543.test b/mysql-test/t/repair_symlink-5543.test
deleted file mode 100644
index 4c120334d05..00000000000
--- a/mysql-test/t/repair_symlink-5543.test
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# MDEV-5543 MyISAM repair unsafe usage of TMD files
-#
---source include/have_symlink.inc
---source include/not_windows.inc
---source include/have_maria.inc
-
---replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
-eval create table t1 (a int) engine=myisam data directory='$MYSQL_TMP_DIR';
-insert t1 values (1);
---system ln -s $MYSQL_TMP_DIR/foobar5543 $MYSQL_TMP_DIR/t1.TMD
---echo # Some systems fail with errcode 40, when doing openat, while others
---echo # don't have openat and fail with errcode 20.
---replace_regex / '.*\/t1/ 'MYSQL_TMP_DIR\/t1/ /40/20/ /".*"/"<errmsg>"/
-repair table t1;
-drop table t1;
-
---replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
-eval create table t2 (a int) engine=aria data directory='$MYSQL_TMP_DIR';
-insert t2 values (1);
---system ln -s $MYSQL_TMP_DIR/foobar5543 $MYSQL_TMP_DIR/t2.TMD
---replace_regex / '.*\/t2/ 'MYSQL_TMP_DIR\/t2/ /40/20/ /".*"/"<errmsg>"/
-repair table t2;
-drop table t2;
-
---list_files $MYSQL_TMP_DIR foobar5543
-
diff --git a/mysql-test/t/replace.test b/mysql-test/t/replace.test
deleted file mode 100644
index 3f2569b0c62..00000000000
--- a/mysql-test/t/replace.test
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# Test of REPLACE with MyISAM and HEAP
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-CREATE TABLE t1 (
- gesuchnr int(11) DEFAULT '0' NOT NULL,
- benutzer_id int(11) DEFAULT '0' NOT NULL,
- PRIMARY KEY (gesuchnr,benutzer_id)
-);
-
-replace into t1 (gesuchnr,benutzer_id) values (2,1);
-replace into t1 (gesuchnr,benutzer_id) values (1,1);
-replace into t1 (gesuchnr,benutzer_id) values (1,1);
-alter table t1 engine=heap;
-replace into t1 (gesuchnr,benutzer_id) values (1,1);
-drop table t1;
-
-#
-# Test when using replace on a key that has used up it's whole range
-#
-
-create table t1 (a tinyint not null auto_increment primary key, b char(20) default "default_value");
-insert into t1 values (126,"first"),(63, "middle"),(0,"last");
---error HA_ERR_AUTOINC_ERANGE
-insert into t1 values (0,"error");
---error HA_ERR_AUTOINC_ERANGE
-replace into t1 values (0,"error");
-replace into t1 values (126,"first updated");
-replace into t1 values (63,default);
-select * from t1;
-drop table t1;
-
-# End of 4.1 tests
-
-#
-# Bug#19789: REPLACE was allowed for a VIEW with CHECK OPTION enabled.
-#
-CREATE TABLE t1 (f1 INT);
-CREATE VIEW v1 AS SELECT f1 FROM t1 WHERE f1 = 0 WITH CHECK OPTION;
---error 1369
-REPLACE INTO v1 (f1) VALUES (1);
-DROP TABLE t1;
-DROP VIEW v1;
diff --git a/mysql-test/t/rollback.test b/mysql-test/t/rollback.test
deleted file mode 100644
index 3b8ad901907..00000000000
--- a/mysql-test/t/rollback.test
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-# This test should fail as MyISAM doesn't have rollback
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-# PS doesn't work with BEGIN ... ROLLBACK
---disable_ps_protocol
-
-create table t1 (n int not null primary key) engine=myisam;
-begin work;
-insert into t1 values (4);
-insert into t1 values (5);
-rollback;
-select @@warning_count;
-select @@error_count;
-show warnings;
-show errors;
-select * from t1;
-select @@warning_count;
-show warnings;
-drop table t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/round.test b/mysql-test/t/round.test
deleted file mode 100644
index 4ba65c08fcf..00000000000
--- a/mysql-test/t/round.test
+++ /dev/null
@@ -1,145 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (sint8 tinyint not null);
-INSERT INTO t1 VALUES ('0.1');
-INSERT INTO t1 VALUES ('0.5');
-INSERT INTO t1 VALUES ('127.4');
-INSERT IGNORE INTO t1 VALUES ('127.5');
-INSERT INTO t1 VALUES ('-0.1');
-INSERT INTO t1 VALUES ('-0.5');
-INSERT INTO t1 VALUES ('-127.4');
-INSERT INTO t1 VALUES ('-127.5');
-INSERT INTO t1 VALUES ('-128.4');
-INSERT IGNORE INTO t1 VALUES ('-128.5');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (uint8 tinyint unsigned not null);
-INSERT INTO t1 VALUES ('0.1');
-INSERT INTO t1 VALUES ('0.5');
-INSERT INTO t1 VALUES ('127.4');
-INSERT INTO t1 VALUES ('127.5');
-INSERT INTO t1 VALUES ('-0.1');
-INSERT IGNORE INTO t1 VALUES ('-0.5');
-INSERT INTO t1 VALUES ('255.4');
-INSERT IGNORE INTO t1 VALUES ('255.5');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
-CREATE TABLE t1 (sint16 smallint not null);
-INSERT INTO t1 VALUES ('0.1');
-INSERT INTO t1 VALUES ('0.5');
-INSERT INTO t1 VALUES ('32767.4');
-INSERT IGNORE INTO t1 VALUES ('32767.5');
-INSERT INTO t1 VALUES ('-0.1');
-INSERT INTO t1 VALUES ('-0.5');
-INSERT INTO t1 VALUES ('-32767.4');
-INSERT INTO t1 VALUES ('-32767.5');
-INSERT INTO t1 VALUES ('-32768.4');
-INSERT IGNORE INTO t1 VALUES ('-32768.5');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
-CREATE TABLE t1 (uint16 smallint unsigned not null);
-INSERT INTO t1 VALUES ('0.1');
-INSERT INTO t1 VALUES ('0.5');
-INSERT INTO t1 VALUES ('32767.4');
-INSERT INTO t1 VALUES ('32767.5');
-INSERT INTO t1 VALUES ('-0.1');
-INSERT IGNORE INTO t1 VALUES ('-0.5');
-INSERT INTO t1 VALUES ('65535.4');
-INSERT IGNORE INTO t1 VALUES ('65535.5');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (sint24 mediumint not null);
-INSERT INTO t1 VALUES ('0.1');
-INSERT INTO t1 VALUES ('0.5');
-INSERT INTO t1 VALUES ('8388607.4');
-INSERT IGNORE INTO t1 VALUES ('8388607.5');
-INSERT INTO t1 VALUES ('-0.1');
-INSERT INTO t1 VALUES ('-0.5');
-INSERT INTO t1 VALUES ('-8388607.4');
-INSERT INTO t1 VALUES ('-8388607.5');
-INSERT INTO t1 VALUES ('-8388608.4');
-INSERT IGNORE INTO t1 VALUES ('-8388608.5');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (uint24 mediumint unsigned not null);
-INSERT INTO t1 VALUES ('0.1');
-INSERT INTO t1 VALUES ('0.5');
-INSERT INTO t1 VALUES ('8388607.4');
-INSERT INTO t1 VALUES ('8388607.5');
-INSERT INTO t1 VALUES ('-0.1');
-INSERT IGNORE INTO t1 VALUES ('-0.5');
-INSERT INTO t1 VALUES ('16777215.4');
-INSERT IGNORE INTO t1 VALUES ('16777215.5');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (sint64 bigint not null);
-INSERT INTO t1 VALUES ('0.1');
-INSERT INTO t1 VALUES ('0.5');
-INSERT INTO t1 VALUES ('9223372036854775807.4');
-INSERT IGNORE INTO t1 VALUES ('9223372036854775807.5');
-INSERT INTO t1 VALUES ('-0.1');
-INSERT INTO t1 VALUES ('-0.5');
-INSERT INTO t1 VALUES ('-9223372036854775807.4');
-INSERT INTO t1 VALUES ('-9223372036854775807.5');
-INSERT INTO t1 VALUES ('-9223372036854775808.4');
-INSERT IGNORE INTO t1 VALUES ('-9223372036854775808.5');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (uint64 bigint unsigned not null);
-INSERT INTO t1 VALUES ('0.1');
-INSERT INTO t1 VALUES ('0.5');
-INSERT INTO t1 VALUES ('9223372036854775807.4');
-INSERT INTO t1 VALUES ('9223372036854775807.5');
-INSERT INTO t1 VALUES ('-0.1');
-INSERT IGNORE INTO t1 VALUES ('-0.5');
-INSERT INTO t1 VALUES ('18446744073709551615.4');
-INSERT IGNORE INTO t1 VALUES ('18446744073709551615.5');
-INSERT INTO t1 VALUES ('1844674407370955161.0');
-INSERT INTO t1 VALUES ('1844674407370955161.1');
-INSERT INTO t1 VALUES ('1844674407370955161.2');
-INSERT INTO t1 VALUES ('1844674407370955161.3');
-INSERT INTO t1 VALUES ('1844674407370955161.4');
-INSERT INTO t1 VALUES ('1844674407370955161.5');
-INSERT INTO t1 VALUES ('1844674407370955161.0e1');
-INSERT INTO t1 VALUES ('1844674407370955161.1e1');
-INSERT INTO t1 VALUES ('1844674407370955161.2e1');
-INSERT INTO t1 VALUES ('1844674407370955161.3e1');
-INSERT INTO t1 VALUES ('1844674407370955161.4e1');
-INSERT INTO t1 VALUES ('1844674407370955161.5e1');
-INSERT INTO t1 VALUES ('18446744073709551610e-1');
-INSERT INTO t1 VALUES ('18446744073709551611e-1');
-INSERT INTO t1 VALUES ('18446744073709551612e-1');
-INSERT INTO t1 VALUES ('18446744073709551613e-1');
-INSERT INTO t1 VALUES ('18446744073709551614e-1');
-INSERT INTO t1 VALUES ('18446744073709551615e-1');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (str varchar(128), sint64 bigint not null default 0);
-INSERT INTO t1 (str) VALUES ('1.5');
-INSERT INTO t1 (str) VALUES ('1.00005e4');
-INSERT INTO t1 (str) VALUES ('1.0005e3');
-INSERT INTO t1 (str) VALUES ('1.005e2');
-INSERT INTO t1 (str) VALUES ('1.05e1');
-INSERT INTO t1 (str) VALUES ('1.5e0');
-INSERT INTO t1 (str) VALUES ('100005e-1');
-INSERT INTO t1 (str) VALUES ('100050e-2');
-INSERT INTO t1 (str) VALUES ('100500e-3');
-INSERT INTO t1 (str) VALUES ('105000e-4');
-INSERT INTO t1 (str) VALUES ('150000e-5');
-UPDATE t1 SET sint64=str;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
diff --git a/mysql-test/t/row-checksum-master.opt b/mysql-test/t/row-checksum-master.opt
deleted file mode 100644
index 990e4941ae9..00000000000
--- a/mysql-test/t/row-checksum-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-innodb-strict-mode=0
diff --git a/mysql-test/t/row-checksum-old-master.opt b/mysql-test/t/row-checksum-old-master.opt
deleted file mode 100644
index 40027795fff..00000000000
--- a/mysql-test/t/row-checksum-old-master.opt
+++ /dev/null
@@ -1,2 +0,0 @@
---old
---loose-innodb-strict-mode=0
diff --git a/mysql-test/t/row-checksum-old.test b/mysql-test/t/row-checksum-old.test
deleted file mode 100644
index 71188ddf432..00000000000
--- a/mysql-test/t/row-checksum-old.test
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-# Run row-checksum.test with old mode
-#
---source t/row-checksum.test
diff --git a/mysql-test/t/row-checksum.opt b/mysql-test/t/row-checksum.opt
deleted file mode 100644
index 977b569a781..00000000000
--- a/mysql-test/t/row-checksum.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-innodb-strict-mode=off
diff --git a/mysql-test/t/row-checksum.test b/mysql-test/t/row-checksum.test
deleted file mode 100644
index 82efcf3ef93..00000000000
--- a/mysql-test/t/row-checksum.test
+++ /dev/null
@@ -1,62 +0,0 @@
-#
-# Test checksum
-#
-
--- source include/have_innodb.inc
--- source include/have_maria.inc
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1 (a int null, v varchar(100)) engine=myisam checksum=0;
-insert into t1 values(null, null), (1, "hello");
-checksum table t1;
-checksum table t1 quick;
-checksum table t1 extended;
-drop table if exists t1;
-create table t1 (a int null, v varchar(100)) engine=myisam checksum=1;
-insert into t1 values(null, null), (1, "hello");
-checksum table t1;
-checksum table t1 quick;
-checksum table t1 extended;
-drop table if exists t1;
-
-create table t1 (a int null, v varchar(100)) engine=innodb checksum=0;
-insert into t1 values(null, null), (1, "hello");
-checksum table t1;
-checksum table t1 quick;
-checksum table t1 extended;
-drop table t1;
-
-create table t1 (a int null, v varchar(100)) engine=maria checksum=0;
-insert into t1 values(null, null), (1, "hello");
-checksum table t1;
-checksum table t1 quick;
-checksum table t1 extended;
-drop table t1;
-create table t1 (a int null, v varchar(100)) engine=maria checksum=1;
-insert into t1 values(null, null), (1, "hello");
-checksum table t1;
-checksum table t1 quick;
-checksum table t1 extended;
-drop table t1;
-
-
-#
-# These checksums will be different prefixes fixed sizes rows with one extra
-# flag byte
-#
-create table t1 (a int null, v varchar(100)) engine=myisam checksum=1 row_format=fixed;
-insert into t1 values(null, null), (1, "hello");
-checksum table t1;
-checksum table t1 quick;
-checksum table t1 extended;
-drop table if exists t1;
-
-create table t1 (a int null, v varchar(100)) engine=innodb checksum=0 row_format=compact;
-insert into t1 values(null, null), (1, "hello");
-checksum table t1;
-checksum table t1 quick;
-checksum table t1 extended;
-drop table t1;
diff --git a/mysql-test/t/row.test b/mysql-test/t/row.test
deleted file mode 100644
index 80c61c414bf..00000000000
--- a/mysql-test/t/row.test
+++ /dev/null
@@ -1,316 +0,0 @@
-# Initialise
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-select (1,2,3) IN ((3,2,3), (1,2,3), (1,3,3));
-select row(10,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3));
-select row(1,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3));
-select row(10,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3));
-select row('a',1.5,3) IN (row(1,2,3), row('a',1.5,3), row('a','a','a'));
-select row('a',0,3) IN (row(3,2,3), row('a','a','3'), row(1,3,3));
-select row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3));
-select row('a',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3));
-select row('b',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3));
-select row('b',1.5,3) IN (row('b',NULL,3), row('a',1.5,3), row(1,3,3));
-select row('b',1.5,3) IN (row('b',NULL,4), row('a',1.5,3), row(1,3,3));
-select (1,2,(3,4)) IN ((3,2,(3,4)), (1,2,(3,4)));
--- error 1241
-select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,4));
-select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL)));
-explain extended select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL)));
-select row(1,2,row(3,null)) IN (row(3,2,row(3,4)), row(1,2,row(4,5)));
-select row(1,2,row(3,null)) IN (row(3,2,row(3,4)), row(1,2,row(3,5)));
-
-
-SELECT (1,2,3)=(0,NULL,3);
-SELECT (1,2,3)=(1,NULL,3);
-SELECT (1,2,3)=(1,NULL,0);
-
-SELECT ROW(1,2,3)=ROW(1,2,3);
-SELECT ROW(2,2,3)=ROW(1+1,2,3);
-SELECT ROW(1,2,3)=ROW(1+1,2,3);
-SELECT ROW(1,2,3)<ROW(1+1,2,3);
-SELECT ROW(1,2,3)>ROW(1+1,2,3);
-SELECT ROW(1,2,3)<=ROW(1+1,2,3);
-SELECT ROW(1,2,3)>=ROW(1+1,2,3);
-SELECT ROW(1,2,3)<>ROW(1+1,2,3);
-SELECT ROW(NULL,2,3)=ROW(NULL,2,3);
-SELECT ROW(NULL,2,3)<=>ROW(NULL,2,3);
-SELECT ROW(1,2,ROW(3,4,5))=ROW(1,2,ROW(3,4,5));
-SELECT ROW('test',2,3.33)=ROW('test',2,3.33);
--- error 1241
-SELECT ROW('test',2,3.33)=ROW('test',2,3.33,4);
-SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,33));
-SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,3));
-SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,NULL));
--- error 1241
-SELECT ROW('test',2,ROW(3,33))=ROW('test',2,4);
-
-create table t1 ( a int, b int, c int);
-insert into t1 values (1,2,3), (2,3,1), (3,2,1), (1,2,NULL);
-select * from t1 where ROW(1,2,3)=ROW(a,b,c);
-select * from t1 where ROW(0,2,3)=ROW(a,b,c);
-select * from t1 where ROW(1,2,3)<ROW(a,b,c);
-select ROW(a,2,3) IN(row(1,b,c), row(2,3,1)) from t1;
-select ROW(c,2,3) IN(row(1,b,a), row(2,3,1)) from t1;
-select ROW(a,b,c) IN(row(1,2,3), row(3,2,1)) from t1;
-select ROW(1,2,3) IN(row(a,b,c), row(1,2,3)) from t1;
-drop table t1;
-
--- error 1241
-select ROW(1,1);
-
-create table t1 (i int);
--- error 1241
-select 1 from t1 where ROW(1,1);
--- error 1241
-select count(*) from t1 order by ROW(1,1);
--- error 1241
-select count(*) from t1 having (1,1) order by i;
-drop table t1;
-
-create table t1 (a int, b int);
-insert into t1 values (1, 4);
-insert into t1 values (10, 40);
-insert into t1 values (1, 4);
-insert into t1 values (10, 43);
-insert into t1 values (1, 4);
-insert into t1 values (10, 41);
-insert into t1 values (1, 4);
-insert into t1 values (10, 43);
-insert into t1 values (1, 4);
-select a, MAX(b), (1, MAX(b)) = (1, 4) from t1 group by a;
-drop table t1;
-SELECT ROW(2,10) <=> ROW(3,4);
-SELECT ROW(NULL,10) <=> ROW(3,NULL);
-
-#
-# Bug #27484: nested row expressions in IN predicate
-#
-
---error 1241
-SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),ROW(1,1));
---error 1241
-SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),ROW(1,1),ROW(1,ROW(2,3)));
---error 1241
-SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),ROW(1,ROW(2,2,2)));
---error 1241
-SELECT ROW(1,ROW(2,3,4)) IN (ROW(1,ROW(2,3,4)),ROW(1,ROW(2,2)));
-
---error 1241
-SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),(SELECT 1,1));
---error 1241
-SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),(SELECT 1,1),ROW(1,ROW(2,4)));
---error 1241
-SELECT ROW(1,ROW(2,3)) IN ((SELECT 1,1),ROW(1,ROW(2,3)));
-
---error 1241
-SELECT ROW(2,1) IN (ROW(21,2),ROW(ROW(1,1,3),0));
---error 1241
-SELECT ROW(2,1) IN (ROW(ROW(1,1,3),0),ROW(21,2));
-
-#
-# Bug#27704: erroneous comparison of rows with NULL components
-#
-CREATE TABLE t1(a int, b int, c int);
-INSERT INTO t1 VALUES (1, 2, 3),
- (NULL, 2, 3 ), (1, NULL, 3 ), (1, 2, NULL),
- (NULL, 2, 3+1), (1, NULL, 3+1), (1, 2+1, NULL),
- (NULL, 2, 3-1), (1, NULL, 3-1), (1, 2-1, NULL);
-
-SELECT (1,2,3) = (1, NULL, 3);
-SELECT (1,2,3) = (1+1, NULL, 3);
-SELECT (1,2,3) = (1, NULL, 3+1);
-SELECT * FROM t1 WHERE (a,b,c) = (1,2,3);
-
-SELECT (1,2,3) <> (1, NULL, 3);
-SELECT (1,2,3) <> (1+1, NULL, 3);
-SELECT (1,2,3) <> (1, NULL, 3+1);
-SELECT * FROM t1 WHERE (a,b,c) <> (1,2,3);
-
-SELECT (1,2,3) < (NULL, 2, 3);
-SELECT (1,2,3) < (1, NULL, 3);
-SELECT (1,2,3) < (1-1, NULL, 3);
-SELECT (1,2,3) < (1+1, NULL, 3);
-SELECT * FROM t1 WHERE (a,b,c) < (1,2,3);
-
-SELECT (1,2,3) <= (NULL, 2, 3);
-SELECT (1,2,3) <= (1, NULL, 3);
-SELECT (1,2,3) <= (1-1, NULL, 3);
-SELECT (1,2,3) <= (1+1, NULL, 3);
-SELECT * FROM t1 WHERE (a,b,c) <= (1,2,3);
-
-SELECT (1,2,3) > (NULL, 2, 3);
-SELECT (1,2,3) > (1, NULL, 3);
-SELECT (1,2,3) > (1-1, NULL, 3);
-SELECT (1,2,3) > (1+1, NULL, 3);
-SELECT * FROM t1 WHERE (a,b,c) > (1,2,3);
-
-SELECT (1,2,3) >= (NULL, 2, 3);
-SELECT (1,2,3) >= (1, NULL, 3);
-SELECT (1,2,3) >= (1-1, NULL, 3);
-SELECT (1,2,3) >= (1+1, NULL, 3);
-SELECT * FROM t1 WHERE (a,b,c) >= (1,2,3);
-
-DROP TABLE t1;
-
-# End of 4.1 tests
-
-#
-# Correct NULL handling in row comporison (BUG#12509)
-#
-SELECT ROW(1,1,1) = ROW(1,1,1) as `1`, ROW(1,1,1) = ROW(1,2,1) as `0`, ROW(1,NULL,1) = ROW(2,2,1) as `0`, ROW(1,NULL,1) = ROW(1,2,2) as `0`, ROW(1,NULL,1) = ROW(1,2,1) as `null` ;
-select row(NULL,1)=(2,0);
-
-#
-# Bug #16081: row equalities are to be used for query optimizations
-#
-
-CREATE TABLE t1 (a int, b int, PRIMARY KEY (a,b));
-INSERT INTO t1 VALUES (1,1), (2,1), (3,1), (1,2), (3,2), (3,3);
-
-EXPLAIN SELECT * FROM t1 WHERE a=3 AND b=2;
-EXPLAIN SELECT * FROM t1 WHERE (a,b)=(3,2);
-SELECT * FROM t1 WHERE a=3 and b=2;
-SELECT * FROM t1 WHERE (a,b)=(3,2);
-
-CREATE TABLE t2 (a int, b int, c int, PRIMARY KEY (a,b,c));
-INSERT INTO t2 VALUES
- (1,1,2), (3,1,3), (1,2,2), (4,4,2),
- (1,1,1), (3,1,1), (1,2,1);
-
-EXPLAIN SELECT * FROM t1,t2 WHERE t1.a=t2.a AND t1.b=t2.b;
-EXPLAIN SELECT * FROM t1,t2 WHERE (t1.a,t1.b)=(t2.a,t2.b);
-SELECT * FROM t1,t2 WHERE t1.a=t2.a and t1.b=t2.b;
-SELECT * FROM t1,t2 WHERE (t1.a,t1.b)=(t2.a,t2.b);
-
-EXPLAIN SELECT * FROM t1,t2 WHERE t1.a=t2.a AND t1.b=2;
-EXPLAIN SELECT * FROM t1,t2 WHERE (t1.a,t1.b)=(t2.a,2);
---sorted_result
-SELECT * FROM t1,t2 WHERE t1.a=1 and t1.b=t2.b;
-SELECT * FROM t1,t2 WHERE (t1.a,t1.b)=(t2.a,2);
-
-EXPLAIN EXTENDED SELECT * FROM t1,t2 WHERE (t1.a,t1.b)=(t2.a,t2.b+1);
-SELECT * FROM t1,t2 WHERE (t1.a,t1.b)=(t2.a,t2.b+1);
-
-EXPLAIN EXTENDED SELECT * FROM t1,t2 WHERE (t1.a-1,t1.b)=(t2.a-1,t2.b+1);
---sorted_result
-SELECT * FROM t1,t2 WHERE (t1.a-1,t1.b)=(t2.a-1,t2.b+1);
-
-EXPLAIN SELECT * FROM t2 WHERE a=3 AND b=2;
-EXPLAIN SELECT * FROM t2 WHERE (a,b)=(3,2);
-SELECT * FROM t2 WHERE a=3 and b=2;
-SELECT * FROM t2 WHERE (a,b)=(3,2);
-
-EXPLAIN SELECT * FROM t1,t2 WHERE t2.a=t1.a AND t2.b=2 AND t2.c=1;
-EXPLAIN EXTENDED SELECT * FROM t1,t2 WHERE (t2.a,(t2.b,t2.c))=(t1.a,(2,1));
-SELECT * FROM t1,t2 WHERE (t2.a,(t2.b,t2.c))=(t1.a,(2,1));
-
-EXPLAIN EXTENDED SELECT * FROM t1,t2 WHERE t2.a=t1.a AND (t2.b,t2.c)=(2,1);
-SELECT * FROM t1,t2 WHERE t2.a=t1.a AND (t2.b,t2.c)=(2,1);
-
-DROP TABLE t1,t2;
-
-#
-# Bug #27154: crash (memory corruption) when using row equalities
-#
-
-CREATE TABLE t1(
- a int, b int, c int, d int, e int, f int, g int, h int,
- PRIMARY KEY (a,b,c,d,e,f,g)
-);
-INSERT INTO t1 VALUES (1,2,3,4,5,6,7,99);
-
-SELECT h FROM t1 WHERE (a,b,c,d,e,f,g)=(1,2,3,4,5,6,7);
-
-SET @x:= (SELECT h FROM t1 WHERE (a,b,c,d,e,f,g)=(1,2,3,4,5,6,7));
-SELECT @x;
-
-DROP TABLE t1;
-
-#
-# Bug #34620: item_row.cc:50: Item_row::illegal_method_call(const char*):
-# Assertion `0' failed
-#
-
-CREATE TABLE t1 (a INT, b INT);
-INSERT INTO t1 VALUES (1,1);
-
-SELECT ROW(a, 1) IN (SELECT SUM(b), 1) FROM t1 GROUP BY a;
-SELECT ROW(a, 1) IN (SELECT SUM(b), 3) FROM t1 GROUP BY a;
-
-DROP TABLE t1;
-
-#
-# Bug#37601 Cast Is Not Done On Row Comparison
-#
-create table t1 (a varchar(200),
- b int unsigned not null primary key auto_increment)
-default character set 'utf8';
-
-create table t2 (c varchar(200),
- d int unsigned not null primary key auto_increment)
-default character set 'latin1';
-
-insert into t1 (a) values('abc');
-insert into t2 (c) values('abc');
-select * from t1,t2 where (a,b) = (c,d);
-
-select host,user from mysql.user where (host,user) = ('localhost','test');
-drop table t1,t2;
-
---echo #
---echo # Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings
---echo #
-CREATE TABLE t1 (a DATETIME NOT NULL, b TINYINT);
-INSERT INTO t1 VALUES (0, 0),(0, 0);
---disable_warnings
-SELECT 1 FROM t1 WHERE ROW(a, b) >=
-ROW('1', (SELECT 1 FROM t1 WHERE a > 1234));
---enable_warnings
-DROP TABLE t1;
-
---echo #
---echo # Bug #54190: Comparison to row subquery produces incorrect result
---echo #
-
-SELECT ROW(1,2) = (SELECT 1,2 FROM DUAL WHERE 1 = 0);
-SELECT ROW(1,2) = (SELECT 1,3 FROM DUAL WHERE 1 = 0);
-
-CREATE TABLE t1 (i INT);
-INSERT INTO t1 () VALUES (1), (2), (3);
-
-SELECT ROW(1,2) = (SELECT 1,2 FROM t1 WHERE 1 = 0);
-SELECT ROW(1,2) = (SELECT 1,3 FROM t1 WHERE 1 = 0);
-SELECT i FROM t1 WHERE ROW(1,2) = (SELECT 1,2 FROM DUAL WHERE 1 = 0);
-SELECT i FROM t1 WHERE ROW(1,2) = (SELECT 1,3 FROM DUAL WHERE 1 = 0);
-
-DROP TABLE t1;
-
---echo End of 5.1 tests
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-8709 Row equality elements do not get propagated
---echo #
-CREATE TABLE t1 (a INT, b INT);
-INSERT INTO t1 VALUES (10,10),(20,20);
-# Checking that the a>=10 part gets optimized away in both scalar and row notations
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10 AND b=10 AND a>=10;
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a,b)=(10,10) AND a>=10;
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-9369 IN operator with ( num, NULL ) gives inconsistent result
---echo #
-SELECT (1,null) NOT IN ((2,2),(3,3)), (1,null) NOT IN ((2,2)), (1,null) NOT IN ((3,3));
-
-
---echo #
---echo # End of 10.1 tests
---echo #
diff --git a/mysql-test/t/rowid_order_innodb.test b/mysql-test/t/rowid_order_innodb.test
deleted file mode 100644
index 152eb28d388..00000000000
--- a/mysql-test/t/rowid_order_innodb.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# t/rowid_order_innodb.test
-#
-# Test for rowid ordering (and comparison) functions.
-# do index_merge select for tables with PK of various types.
-#
-# Last update:
-# 2006-07-28 ML test refactored (MySQL 5.1)
-# main code t/rowid_order_innodb.test -> include/rowid_order.inc
-#
-
---source include/have_innodb.inc
-let $engine_type= InnoDB;
-
---source include/rowid_order.inc
diff --git a/mysql-test/t/rpl_mysqldump_slave.test b/mysql-test/t/rpl_mysqldump_slave.test
deleted file mode 100644
index 345bdb82535..00000000000
--- a/mysql-test/t/rpl_mysqldump_slave.test
+++ /dev/null
@@ -1,88 +0,0 @@
---source include/master-slave.inc
-
---echo #
---echo # New --dump-slave, --apply-slave-statements functionality
---echo #
-
-# There is a gap between when START SLAVE returns and when MASTER_LOG_FILE and
-# MASTER_LOG_POS are set. Ensure that we don't call SHOW SLAVE STATUS during
-# that gap.
---sync_slave_with_master
-
-connection master;
-use test;
-
-connection slave;
-
-# Execute mysqldump with --dump-slave
---replace_regex /MASTER_LOG_POS=[0-9]+/MASTER_LOG_POS=BINLOG_START/
---exec $MYSQL_DUMP_SLAVE --compact --dump-slave test
-
-# Execute mysqldump with --dump-slave and --apply-slave-statements
---replace_regex /MASTER_LOG_POS=[0-9]+/MASTER_LOG_POS=BINLOG_START/
---exec $MYSQL_DUMP_SLAVE --compact --dump-slave --apply-slave-statements test
-
---replace_regex /MASTER_LOG_POS=[0-9]+/MASTER_LOG_POS=BINLOG_START/
---replace_result $MASTER_MYPORT MASTER_MYPORT
-# Execute mysqldump with --dump-slave ,--apply-slave-statements and --include-master-host-port
---exec $MYSQL_DUMP_SLAVE --compact --dump-slave --apply-slave-statements --include-master-host-port test
-
-#
-# MDEV-5624 mysqldump --dump-slave option does not restart the replication if the dump has failed
-#
-start slave;
---replace_regex /MASTER_LOG_POS=[0-9]+/MASTER_LOG_POS=BINLOG_START/
---error 2
---exec $MYSQL_DUMP_SLAVE --compact --dump-slave no_such_db
-start slave;
-
-
---echo *** Test mysqldump --dump-slave GTID functionality.
-
---connection master
-SET gtid_seq_no = 1000;
-CREATE TABLE t1 (a INT PRIMARY KEY);
-DROP TABLE t1;
---sync_slave_with_master
-
---connection slave
-# Inject a local transaction on the slave to check that this is not considered
-# for --dump-slave.
-CREATE TABLE t2 (a INT PRIMARY KEY);
-DROP TABLE t2;
-
---echo
---echo 1. --dump-slave=1
---echo
---replace_regex /MASTER_LOG_POS=[0-9]+/MASTER_LOG_POS=BINLOG_START/
---exec $MYSQL_DUMP_SLAVE --compact --dump-slave=1 --gtid test
-
---echo
---echo 2. --dump-slave=2
---echo
---replace_regex /MASTER_LOG_POS=[0-9]+/MASTER_LOG_POS=BINLOG_START/
---exec $MYSQL_DUMP_SLAVE --compact --dump-slave=2 --gtid test
-
-
---echo *** Test mysqldump --master-data GTID functionality.
---echo
---echo 1. --master-data=1
---echo
---replace_regex /MASTER_LOG_POS=[0-9]+/MASTER_LOG_POS=BINLOG_START/
---exec $MYSQL_DUMP_SLAVE --compact --master-data=1 --gtid test
-
---echo
---echo 2. --master-data=2
---echo
---replace_regex /MASTER_LOG_POS=[0-9]+/MASTER_LOG_POS=BINLOG_START/
---exec $MYSQL_DUMP_SLAVE --compact --master-data=2 --gtid test
-
---echo
---echo 3. --master-data --single-transaction
---echo
---replace_regex /MASTER_LOG_POS=[0-9]+/MASTER_LOG_POS=BINLOG_START/
---exec $MYSQL_DUMP_SLAVE --compact --master-data --single-transaction --gtid test
-
-
-
---source include/rpl_end.inc
diff --git a/mysql-test/t/schema.test b/mysql-test/t/schema.test
deleted file mode 100644
index 8f9047e2e3f..00000000000
--- a/mysql-test/t/schema.test
+++ /dev/null
@@ -1,179 +0,0 @@
-#
-# Just a couple of tests to make sure that schema works.
-#
-# Drop mysqltest1 database, as it can left from the previous tests.
-#
-
-# Save the initial number of concurrent sessions.
---source include/count_sessions.inc
-
---disable_warnings
-drop database if exists mysqltest1;
---enable_warnings
-
-create schema foo;
-show create schema foo;
-show schemas;
-drop schema foo;
-
-
---echo #
---echo # Bug #48940 MDL deadlocks against mysql_rm_db
---echo #
-
---disable_warnings
-DROP SCHEMA IF EXISTS schema1;
---enable_warnings
-
-connect(con2, localhost, root);
-
-connection default;
-
-CREATE SCHEMA schema1;
-CREATE TABLE schema1.t1 (a INT);
-
-SET autocommit= FALSE;
-INSERT INTO schema1.t1 VALUES (1);
-
-connection con2;
---send DROP SCHEMA schema1
-
-connection default;
-let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist
- WHERE state= 'Waiting for table metadata lock'
- AND info='DROP SCHEMA schema1';
---source include/wait_condition.inc
-# Error 1 is from ALTER DATABASE when the database does not exist.
-# Listing the error twice to prevent result diffences based on filename.
---error 1,1
-ALTER SCHEMA schema1 DEFAULT CHARACTER SET utf8;
-SET autocommit= TRUE;
-
-connection con2;
---reap
-
-connection default;
-disconnect con2;
-
-
---echo #
---echo # Bug #49988 MDL deadlocks with mysql_create_db, reload_acl_and_cache
---echo #
-
---disable_warnings
-DROP SCHEMA IF EXISTS schema1;
---enable_warnings
-
-connect (con2, localhost, root);
-
-connection default;
-CREATE SCHEMA schema1;
-CREATE TABLE schema1.t1 (id INT);
-LOCK TABLE schema1.t1 WRITE;
-
-connection con2;
---send DROP SCHEMA schema1
-
-connection default;
-let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for schema metadata lock' and info='DROP SCHEMA schema1';
---source include/wait_condition.inc
-
---echo # CREATE SCHEMA used to give a deadlock.
---echo # Now we prohibit CREATE SCHEMA in LOCK TABLES mode.
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-CREATE SCHEMA IF NOT EXISTS schema1;
-
---echo # UNLOCK TABLES so DROP SCHEMA can continue.
-UNLOCK TABLES;
-
-connection con2;
---reap
-
-connection default;
-disconnect con2;
-
-
---echo #
---echo # Bug#54360 Deadlock DROP/ALTER/CREATE DATABASE with open HANDLER
---echo #
-
-CREATE DATABASE db1;
-CREATE TABLE db1.t1 (a INT);
-INSERT INTO db1.t1 VALUES (1), (2);
-
-connect (con1, localhost, root);
-HANDLER db1.t1 OPEN;
-
-connection default;
---echo # Sending:
---send DROP DATABASE db1
-
-connect (con2, localhost, root);
-let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for table metadata lock' AND info='DROP DATABASE db1';
---source include/wait_condition.inc
-
-connection con1;
-# All these statements before resulted in deadlock.
-CREATE DATABASE db2;
-ALTER DATABASE db2 DEFAULT CHARACTER SET utf8;
-DROP DATABASE db2;
-HANDLER t1 CLOSE;
-
-connection default;
---echo # Reaping: DROP DATABASE db1
---reap
-disconnect con1;
-disconnect con2;
-
-
---echo #
---echo # Tests for increased CREATE/ALTER/DROP DATABASE concurrency with
---echo # database name locks.
---echo #
-
---disable_warnings
-DROP DATABASE IF EXISTS db1;
-DROP DATABASE IF EXISTS db2;
---enable_warnings
-
-connect (con2, localhost, root);
-connect (con3, localhost, root);
-
-connection default;
-CREATE DATABASE db1;
-CREATE TABLE db1.t1 (id INT);
-START TRANSACTION;
-INSERT INTO db1.t1 VALUES (1);
-
-connection con2;
---echo # DROP DATABASE should block due to the active transaction
---echo # Sending:
---send DROP DATABASE db1
-
-connection con3;
-let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='Waiting for table metadata lock' and info='DROP DATABASE db1';
---source include/wait_condition.inc
---echo # But it should still be possible to CREATE/ALTER/DROP other databases.
-CREATE DATABASE db2;
-ALTER DATABASE db2 DEFAULT CHARACTER SET utf8;
-DROP DATABASE db2;
-
-connection default;
---echo # End the transaction so DROP DATABASE db1 can continue
-COMMIT;
-
-connection con2;
---echo # Reaping: DROP DATABASE db1
---reap
-
-connection default;
-disconnect con2;
-disconnect con3;
-
-
-# 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
diff --git a/mysql-test/t/second_frac-9175.test b/mysql-test/t/second_frac-9175.test
deleted file mode 100644
index 91baf997459..00000000000
--- a/mysql-test/t/second_frac-9175.test
+++ /dev/null
@@ -1,9 +0,0 @@
-#
-# MDEV-9175 Query parser tansforms MICROSECOND into SECOND_FRAC, which does not work
-#
-
-select timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456');
-explain extended select timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456');
-create view v1 as select timestampdiff(microsecond,'2000-01-01 00:00:00','2001-01-01 00:00:00.123456');
-select * from v1;
-drop view v1;
diff --git a/mysql-test/t/secure_file_priv_win-master.opt b/mysql-test/t/secure_file_priv_win-master.opt
deleted file mode 100644
index e9a43a5584d..00000000000
--- a/mysql-test/t/secure_file_priv_win-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---secure_file_priv=$MYSQL_TMP_DIR
diff --git a/mysql-test/t/secure_file_priv_win.test b/mysql-test/t/secure_file_priv_win.test
deleted file mode 100644
index a12510974ce..00000000000
--- a/mysql-test/t/secure_file_priv_win.test
+++ /dev/null
@@ -1,79 +0,0 @@
-#
-# Bug58747 breaks secure_file_priv+not secure yet+still accesses other folders
-#
-
-# we do the windows specific relative directory testing
-
---source include/windows.inc
-
-CREATE TABLE t1 (c1 longtext);
-INSERT INTO t1 values ('a');
-
-LET $MYSQL_TMP_DIR_UCASE= `SELECT upper('$MYSQL_TMP_DIR')`;
-LET $MYSQL_TMP_DIR_LCASE= `SELECT lower('$MYSQL_TMP_DIR')`;
-
-#create the file
---replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
-eval SELECT * FROM t1 INTO OUTFILE '$MYSQL_TMP_DIR/B11764517.tmp';
-
---replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
-show global variables like 'secure_file_priv';
-
---replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
-eval SELECT load_file('$MYSQL_TMP_DIR\\\\B11764517.tmp') AS x;
-
---replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
-eval SELECT load_file('$MYSQL_TMP_DIR/B11764517.tmp') AS x;
-
---replace_result $MYSQL_TMP_DIR_UCASE MYSQL_TMP_DIR_UCASE
-eval SELECT load_file('$MYSQL_TMP_DIR_UCASE/B11764517.tmp') AS x;
-
---replace_result $MYSQL_TMP_DIR_LCASE MYSQL_TMP_DIR_LCASE
-eval SELECT load_file('$MYSQL_TMP_DIR_LCASE/B11764517.tmp') AS x;
-
---replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
-eval SELECT load_file('$MYSQL_TMP_DIR\\\\..a..\\\\..\\\\..\\\\B11764517.tmp') AS x;
-
---replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
-eval LOAD DATA INFILE '$MYSQL_TMP_DIR\\\\B11764517.tmp' INTO TABLE t1;
-
---replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
-eval LOAD DATA INFILE '$MYSQL_TMP_DIR/B11764517.tmp' INTO TABLE t1;
-
---replace_result $MYSQL_TMP_DIR_UCASE MYSQL_TMP_DIR_UCASE
-eval LOAD DATA INFILE '$MYSQL_TMP_DIR_UCASE/B11764517.tmp' INTO TABLE t1;
-
---replace_result $MYSQL_TMP_DIR_LCASE MYSQL_TMP_DIR_LCASE
-eval LOAD DATA INFILE '$MYSQL_TMP_DIR_LCASE/B11764517.tmp' INTO TABLE t1;
-
---replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
---error ER_OPTION_PREVENTS_STATEMENT
-eval LOAD DATA INFILE "$MYSQL_TMP_DIR\\\\..a..\\\\..\\\\..\\\\B11764517.tmp" into table t1;
-
---replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
---error ER_OPTION_PREVENTS_STATEMENT
-eval SELECT * FROM t1 INTO OUTFILE '$MYSQL_TMP_DIR\\\\..a..\\\\..\\\\..\\\\B11764517-2.tmp';
-
---replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
-eval SELECT * FROM t1 INTO OUTFILE '$MYSQL_TMP_DIR\\\\B11764517-2.tmp';
-
---replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
-eval SELECT * FROM t1 INTO OUTFILE '$MYSQL_TMP_DIR/B11764517-3.tmp';
-
---replace_result $MYSQL_TMP_DIR_UCASE MYSQL_TMP_DIR_UCASE
-eval SELECT * FROM t1 INTO OUTFILE '$MYSQL_TMP_DIR_UCASE/B11764517-4.tmp';
-
---replace_result $MYSQL_TMP_DIR_LCASE MYSQL_TMP_DIR_LCASE
-eval SELECT * FROM t1 INTO OUTFILE '$MYSQL_TMP_DIR_LCASE/B11764517-5.tmp';
-
---error 0,1
---remove_file $MYSQL_TMP_DIR/B11764517.tmp;
---error 0,1
---remove_file $MYSQL_TMP_DIR/B11764517-2.tmp;
---error 0,1
---remove_file $MYSQL_TMP_DIR/B11764517-3.tmp;
---error 0,1
---remove_file $MYSQL_TMP_DIR/B11764517-4.tmp;
---error 0,1
---remove_file $MYSQL_TMP_DIR/B11764517-5.tmp;
-DROP TABLE t1;
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
deleted file mode 100644
index 52ef4aa2111..00000000000
--- a/mysql-test/t/select.test
+++ /dev/null
@@ -1,4673 +0,0 @@
-#
-# Find string "NOTE NOTE NOTE" in order to find some 'unsure' tests
-#
-
-#
-# Simple select test
-#
-
---disable_warnings
-drop table if exists t1,t2,t3,t4,t11;
-# The following may be left from older tests
-drop table if exists t1_1,t1_2,t9_1,t9_2,t1aa,t2aa;
-drop view if exists v1;
---enable_warnings
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch=ifnull(@optimizer_switch_for_select_test,'outer_join_with_cache=off');
-if (`select @join_cache_level_for_select_test is null`)
-{
- set join_cache_level=1;
-}
-if (`select @join_cache_level_for_select_test is not null`)
-{
- set join_cache_level=@join_cache_level_for_select_test;
-}
-
-CREATE TABLE t1 (
- Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
- Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
-);
-
-INSERT INTO t1 VALUES (9410,9412);
-
-select period from t1;
-select * from t1;
-select t1.* from t1;
-
-#
-# Create test table
-#
-
-CREATE TABLE t2 (
- auto int not null auto_increment,
- fld1 int(6) unsigned zerofill DEFAULT '000000' NOT NULL,
- companynr tinyint(2) unsigned zerofill DEFAULT '00' NOT NULL,
- fld3 char(30) DEFAULT '' NOT NULL,
- fld4 char(35) DEFAULT '' NOT NULL,
- fld5 char(35) DEFAULT '' NOT NULL,
- fld6 char(4) DEFAULT '' NOT NULL,
- UNIQUE fld1 (fld1),
- KEY fld3 (fld3),
- PRIMARY KEY (auto)
-);
-
-#
-# Populate table
-#
-
---disable_query_log
-INSERT INTO t2 VALUES (1,000001,00,'Omaha','teethe','neat','');
-INSERT INTO t2 VALUES (2,011401,37,'breaking','dreaded','Steinberg','W');
-INSERT INTO t2 VALUES (3,011402,37,'Romans','scholastics','jarring','');
-INSERT INTO t2 VALUES (4,011403,37,'intercepted','audiology','tinily','');
-INSERT INTO t2 VALUES (5,011501,37,'bewilderingly','wallet','balled','');
-INSERT INTO t2 VALUES (6,011701,37,'astound','parters','persist','W');
-INSERT INTO t2 VALUES (7,011702,37,'admonishing','eschew','attainments','');
-INSERT INTO t2 VALUES (8,011703,37,'sumac','quitter','fanatic','');
-INSERT INTO t2 VALUES (9,012001,37,'flanking','neat','measures','FAS');
-INSERT INTO t2 VALUES (10,012003,37,'combed','Steinberg','rightfulness','');
-INSERT INTO t2 VALUES (11,012004,37,'subjective','jarring','capably','');
-INSERT INTO t2 VALUES (12,012005,37,'scatterbrain','tinily','impulsive','');
-INSERT INTO t2 VALUES (13,012301,37,'Eulerian','balled','starlet','');
-INSERT INTO t2 VALUES (14,012302,36,'dubbed','persist','terminators','');
-INSERT INTO t2 VALUES (15,012303,37,'Kane','attainments','untying','');
-INSERT INTO t2 VALUES (16,012304,37,'overlay','fanatic','announces','FAS');
-INSERT INTO t2 VALUES (17,012305,37,'perturb','measures','featherweight','FAS');
-INSERT INTO t2 VALUES (18,012306,37,'goblins','rightfulness','pessimist','FAS');
-INSERT INTO t2 VALUES (19,012501,37,'annihilates','capably','daughter','');
-INSERT INTO t2 VALUES (20,012602,37,'Wotan','impulsive','decliner','FAS');
-INSERT INTO t2 VALUES (21,012603,37,'snatching','starlet','lawgiver','');
-INSERT INTO t2 VALUES (22,012604,37,'concludes','terminators','stated','');
-INSERT INTO t2 VALUES (23,012605,37,'laterally','untying','readable','');
-INSERT INTO t2 VALUES (24,012606,37,'yelped','announces','attrition','');
-INSERT INTO t2 VALUES (25,012701,37,'grazing','featherweight','cascade','FAS');
-INSERT INTO t2 VALUES (26,012702,37,'Baird','pessimist','motors','FAS');
-INSERT INTO t2 VALUES (27,012703,37,'celery','daughter','interrogate','');
-INSERT INTO t2 VALUES (28,012704,37,'misunderstander','decliner','pests','W');
-INSERT INTO t2 VALUES (29,013601,37,'handgun','lawgiver','stairway','');
-INSERT INTO t2 VALUES (30,013602,37,'foldout','stated','dopers','FAS');
-INSERT INTO t2 VALUES (31,013603,37,'mystic','readable','testicle','W');
-INSERT INTO t2 VALUES (32,013604,37,'succumbed','attrition','Parsifal','W');
-INSERT INTO t2 VALUES (33,013605,37,'Nabisco','cascade','leavings','');
-INSERT INTO t2 VALUES (34,013606,37,'fingerings','motors','postulation','W');
-INSERT INTO t2 VALUES (35,013607,37,'aging','interrogate','squeaking','');
-INSERT INTO t2 VALUES (36,013608,37,'afield','pests','contrasted','');
-INSERT INTO t2 VALUES (37,013609,37,'ammonium','stairway','leftover','');
-INSERT INTO t2 VALUES (38,013610,37,'boat','dopers','whiteners','');
-INSERT INTO t2 VALUES (39,013801,37,'intelligibility','testicle','erases','W');
-INSERT INTO t2 VALUES (40,013802,37,'Augustine','Parsifal','Punjab','W');
-INSERT INTO t2 VALUES (41,013803,37,'teethe','leavings','Merritt','');
-INSERT INTO t2 VALUES (42,013804,37,'dreaded','postulation','Quixotism','');
-INSERT INTO t2 VALUES (43,013901,37,'scholastics','squeaking','sweetish','FAS');
-INSERT INTO t2 VALUES (44,016001,37,'audiology','contrasted','dogging','FAS');
-INSERT INTO t2 VALUES (45,016201,37,'wallet','leftover','scornfully','FAS');
-INSERT INTO t2 VALUES (46,016202,37,'parters','whiteners','bellow','');
-INSERT INTO t2 VALUES (47,016301,37,'eschew','erases','bills','');
-INSERT INTO t2 VALUES (48,016302,37,'quitter','Punjab','cupboard','FAS');
-INSERT INTO t2 VALUES (49,016303,37,'neat','Merritt','sureties','FAS');
-INSERT INTO t2 VALUES (50,016304,37,'Steinberg','Quixotism','puddings','');
-INSERT INTO t2 VALUES (51,018001,37,'jarring','sweetish','tapestry','');
-INSERT INTO t2 VALUES (52,018002,37,'tinily','dogging','fetters','');
-INSERT INTO t2 VALUES (53,018003,37,'balled','scornfully','bivalves','');
-INSERT INTO t2 VALUES (54,018004,37,'persist','bellow','incurring','');
-INSERT INTO t2 VALUES (55,018005,37,'attainments','bills','Adolph','');
-INSERT INTO t2 VALUES (56,018007,37,'fanatic','cupboard','pithed','');
-INSERT INTO t2 VALUES (57,018008,37,'measures','sureties','emergency','');
-INSERT INTO t2 VALUES (58,018009,37,'rightfulness','puddings','Miles','');
-INSERT INTO t2 VALUES (59,018010,37,'capably','tapestry','trimmings','');
-INSERT INTO t2 VALUES (60,018012,37,'impulsive','fetters','tragedies','W');
-INSERT INTO t2 VALUES (61,018013,37,'starlet','bivalves','skulking','W');
-INSERT INTO t2 VALUES (62,018014,37,'terminators','incurring','flint','');
-INSERT INTO t2 VALUES (63,018015,37,'untying','Adolph','flopping','W');
-INSERT INTO t2 VALUES (64,018016,37,'announces','pithed','relaxing','FAS');
-INSERT INTO t2 VALUES (65,018017,37,'featherweight','emergency','offload','FAS');
-INSERT INTO t2 VALUES (66,018018,37,'pessimist','Miles','suites','W');
-INSERT INTO t2 VALUES (67,018019,37,'daughter','trimmings','lists','FAS');
-INSERT INTO t2 VALUES (68,018020,37,'decliner','tragedies','animized','FAS');
-INSERT INTO t2 VALUES (69,018021,37,'lawgiver','skulking','multilayer','W');
-INSERT INTO t2 VALUES (70,018022,37,'stated','flint','standardizes','FAS');
-INSERT INTO t2 VALUES (71,018023,37,'readable','flopping','Judas','');
-INSERT INTO t2 VALUES (72,018024,37,'attrition','relaxing','vacuuming','W');
-INSERT INTO t2 VALUES (73,018025,37,'cascade','offload','dentally','W');
-INSERT INTO t2 VALUES (74,018026,37,'motors','suites','humanness','W');
-INSERT INTO t2 VALUES (75,018027,37,'interrogate','lists','inch','W');
-INSERT INTO t2 VALUES (76,018028,37,'pests','animized','Weissmuller','W');
-INSERT INTO t2 VALUES (77,018029,37,'stairway','multilayer','irresponsibly','W');
-INSERT INTO t2 VALUES (78,018030,37,'dopers','standardizes','luckily','FAS');
-INSERT INTO t2 VALUES (79,018032,37,'testicle','Judas','culled','W');
-INSERT INTO t2 VALUES (80,018033,37,'Parsifal','vacuuming','medical','FAS');
-INSERT INTO t2 VALUES (81,018034,37,'leavings','dentally','bloodbath','FAS');
-INSERT INTO t2 VALUES (82,018035,37,'postulation','humanness','subschema','W');
-INSERT INTO t2 VALUES (83,018036,37,'squeaking','inch','animals','W');
-INSERT INTO t2 VALUES (84,018037,37,'contrasted','Weissmuller','Micronesia','');
-INSERT INTO t2 VALUES (85,018038,37,'leftover','irresponsibly','repetitions','');
-INSERT INTO t2 VALUES (86,018039,37,'whiteners','luckily','Antares','');
-INSERT INTO t2 VALUES (87,018040,37,'erases','culled','ventilate','W');
-INSERT INTO t2 VALUES (88,018041,37,'Punjab','medical','pityingly','');
-INSERT INTO t2 VALUES (89,018042,37,'Merritt','bloodbath','interdependent','');
-INSERT INTO t2 VALUES (90,018043,37,'Quixotism','subschema','Graves','FAS');
-INSERT INTO t2 VALUES (91,018044,37,'sweetish','animals','neonatal','');
-INSERT INTO t2 VALUES (92,018045,37,'dogging','Micronesia','scribbled','FAS');
-INSERT INTO t2 VALUES (93,018046,37,'scornfully','repetitions','chafe','W');
-INSERT INTO t2 VALUES (94,018048,37,'bellow','Antares','honoring','');
-INSERT INTO t2 VALUES (95,018049,37,'bills','ventilate','realtor','');
-INSERT INTO t2 VALUES (96,018050,37,'cupboard','pityingly','elite','');
-INSERT INTO t2 VALUES (97,018051,37,'sureties','interdependent','funereal','');
-INSERT INTO t2 VALUES (98,018052,37,'puddings','Graves','abrogating','');
-INSERT INTO t2 VALUES (99,018053,50,'tapestry','neonatal','sorters','');
-INSERT INTO t2 VALUES (100,018054,37,'fetters','scribbled','Conley','');
-INSERT INTO t2 VALUES (101,018055,37,'bivalves','chafe','lectured','');
-INSERT INTO t2 VALUES (102,018056,37,'incurring','honoring','Abraham','');
-INSERT INTO t2 VALUES (103,018057,37,'Adolph','realtor','Hawaii','W');
-INSERT INTO t2 VALUES (104,018058,37,'pithed','elite','cage','');
-INSERT INTO t2 VALUES (105,018059,36,'emergency','funereal','hushes','');
-INSERT INTO t2 VALUES (106,018060,37,'Miles','abrogating','Simla','');
-INSERT INTO t2 VALUES (107,018061,37,'trimmings','sorters','reporters','');
-INSERT INTO t2 VALUES (108,018101,37,'tragedies','Conley','Dutchman','FAS');
-INSERT INTO t2 VALUES (109,018102,37,'skulking','lectured','descendants','FAS');
-INSERT INTO t2 VALUES (110,018103,37,'flint','Abraham','groupings','FAS');
-INSERT INTO t2 VALUES (111,018104,37,'flopping','Hawaii','dissociate','');
-INSERT INTO t2 VALUES (112,018201,37,'relaxing','cage','coexist','W');
-INSERT INTO t2 VALUES (113,018202,37,'offload','hushes','Beebe','');
-INSERT INTO t2 VALUES (114,018402,37,'suites','Simla','Taoism','');
-INSERT INTO t2 VALUES (115,018403,37,'lists','reporters','Connally','');
-INSERT INTO t2 VALUES (116,018404,37,'animized','Dutchman','fetched','FAS');
-INSERT INTO t2 VALUES (117,018405,37,'multilayer','descendants','checkpoints','FAS');
-INSERT INTO t2 VALUES (118,018406,37,'standardizes','groupings','rusting','');
-INSERT INTO t2 VALUES (119,018409,37,'Judas','dissociate','galling','');
-INSERT INTO t2 VALUES (120,018601,37,'vacuuming','coexist','obliterates','');
-INSERT INTO t2 VALUES (121,018602,37,'dentally','Beebe','traitor','');
-INSERT INTO t2 VALUES (122,018603,37,'humanness','Taoism','resumes','FAS');
-INSERT INTO t2 VALUES (123,018801,37,'inch','Connally','analyzable','FAS');
-INSERT INTO t2 VALUES (124,018802,37,'Weissmuller','fetched','terminator','FAS');
-INSERT INTO t2 VALUES (125,018803,37,'irresponsibly','checkpoints','gritty','FAS');
-INSERT INTO t2 VALUES (126,018804,37,'luckily','rusting','firearm','W');
-INSERT INTO t2 VALUES (127,018805,37,'culled','galling','minima','');
-INSERT INTO t2 VALUES (128,018806,37,'medical','obliterates','Selfridge','');
-INSERT INTO t2 VALUES (129,018807,37,'bloodbath','traitor','disable','');
-INSERT INTO t2 VALUES (130,018808,37,'subschema','resumes','witchcraft','W');
-INSERT INTO t2 VALUES (131,018809,37,'animals','analyzable','betroth','W');
-INSERT INTO t2 VALUES (132,018810,37,'Micronesia','terminator','Manhattanize','');
-INSERT INTO t2 VALUES (133,018811,37,'repetitions','gritty','imprint','');
-INSERT INTO t2 VALUES (134,018812,37,'Antares','firearm','peeked','');
-INSERT INTO t2 VALUES (135,019101,37,'ventilate','minima','swelling','');
-INSERT INTO t2 VALUES (136,019102,37,'pityingly','Selfridge','interrelationships','W');
-INSERT INTO t2 VALUES (137,019103,37,'interdependent','disable','riser','');
-INSERT INTO t2 VALUES (138,019201,37,'Graves','witchcraft','Gandhian','W');
-INSERT INTO t2 VALUES (139,030501,37,'neonatal','betroth','peacock','A');
-INSERT INTO t2 VALUES (140,030502,50,'scribbled','Manhattanize','bee','A');
-INSERT INTO t2 VALUES (141,030503,37,'chafe','imprint','kanji','');
-INSERT INTO t2 VALUES (142,030504,37,'honoring','peeked','dental','');
-INSERT INTO t2 VALUES (143,031901,37,'realtor','swelling','scarf','FAS');
-INSERT INTO t2 VALUES (144,036001,37,'elite','interrelationships','chasm','A');
-INSERT INTO t2 VALUES (145,036002,37,'funereal','riser','insolence','A');
-INSERT INTO t2 VALUES (146,036004,37,'abrogating','Gandhian','syndicate','');
-INSERT INTO t2 VALUES (147,036005,37,'sorters','peacock','alike','');
-INSERT INTO t2 VALUES (148,038001,37,'Conley','bee','imperial','A');
-INSERT INTO t2 VALUES (149,038002,37,'lectured','kanji','convulsion','A');
-INSERT INTO t2 VALUES (150,038003,37,'Abraham','dental','railway','A');
-INSERT INTO t2 VALUES (151,038004,37,'Hawaii','scarf','validate','A');
-INSERT INTO t2 VALUES (152,038005,37,'cage','chasm','normalizes','A');
-INSERT INTO t2 VALUES (153,038006,37,'hushes','insolence','comprehensive','');
-INSERT INTO t2 VALUES (154,038007,37,'Simla','syndicate','chewing','');
-INSERT INTO t2 VALUES (155,038008,37,'reporters','alike','denizen','');
-INSERT INTO t2 VALUES (156,038009,37,'Dutchman','imperial','schemer','');
-INSERT INTO t2 VALUES (157,038010,37,'descendants','convulsion','chronicle','');
-INSERT INTO t2 VALUES (158,038011,37,'groupings','railway','Kline','');
-INSERT INTO t2 VALUES (159,038012,37,'dissociate','validate','Anatole','');
-INSERT INTO t2 VALUES (160,038013,37,'coexist','normalizes','partridges','');
-INSERT INTO t2 VALUES (161,038014,37,'Beebe','comprehensive','brunch','');
-INSERT INTO t2 VALUES (162,038015,37,'Taoism','chewing','recruited','');
-INSERT INTO t2 VALUES (163,038016,37,'Connally','denizen','dimensions','W');
-INSERT INTO t2 VALUES (164,038017,37,'fetched','schemer','Chicana','W');
-INSERT INTO t2 VALUES (165,038018,37,'checkpoints','chronicle','announced','');
-INSERT INTO t2 VALUES (166,038101,37,'rusting','Kline','praised','FAS');
-INSERT INTO t2 VALUES (167,038102,37,'galling','Anatole','employing','');
-INSERT INTO t2 VALUES (168,038103,37,'obliterates','partridges','linear','');
-INSERT INTO t2 VALUES (169,038104,37,'traitor','brunch','quagmire','');
-INSERT INTO t2 VALUES (170,038201,37,'resumes','recruited','western','A');
-INSERT INTO t2 VALUES (171,038202,37,'analyzable','dimensions','relishing','');
-INSERT INTO t2 VALUES (172,038203,37,'terminator','Chicana','serving','A');
-INSERT INTO t2 VALUES (173,038204,37,'gritty','announced','scheduling','');
-INSERT INTO t2 VALUES (174,038205,37,'firearm','praised','lore','');
-INSERT INTO t2 VALUES (175,038206,37,'minima','employing','eventful','');
-INSERT INTO t2 VALUES (176,038208,37,'Selfridge','linear','arteriole','A');
-INSERT INTO t2 VALUES (177,042801,37,'disable','quagmire','disentangle','');
-INSERT INTO t2 VALUES (178,042802,37,'witchcraft','western','cured','A');
-INSERT INTO t2 VALUES (179,046101,37,'betroth','relishing','Fenton','W');
-INSERT INTO t2 VALUES (180,048001,37,'Manhattanize','serving','avoidable','A');
-INSERT INTO t2 VALUES (181,048002,37,'imprint','scheduling','drains','A');
-INSERT INTO t2 VALUES (182,048003,37,'peeked','lore','detectably','FAS');
-INSERT INTO t2 VALUES (183,048004,37,'swelling','eventful','husky','');
-INSERT INTO t2 VALUES (184,048005,37,'interrelationships','arteriole','impelling','');
-INSERT INTO t2 VALUES (185,048006,37,'riser','disentangle','undoes','');
-INSERT INTO t2 VALUES (186,048007,37,'Gandhian','cured','evened','');
-INSERT INTO t2 VALUES (187,048008,37,'peacock','Fenton','squeezes','');
-INSERT INTO t2 VALUES (188,048101,37,'bee','avoidable','destroyer','FAS');
-INSERT INTO t2 VALUES (189,048102,37,'kanji','drains','rudeness','');
-INSERT INTO t2 VALUES (190,048201,37,'dental','detectably','beaner','FAS');
-INSERT INTO t2 VALUES (191,048202,37,'scarf','husky','boorish','');
-INSERT INTO t2 VALUES (192,048203,37,'chasm','impelling','Everhart','');
-INSERT INTO t2 VALUES (193,048204,37,'insolence','undoes','encompass','A');
-INSERT INTO t2 VALUES (194,048205,37,'syndicate','evened','mushrooms','');
-INSERT INTO t2 VALUES (195,048301,37,'alike','squeezes','Alison','A');
-INSERT INTO t2 VALUES (196,048302,37,'imperial','destroyer','externally','FAS');
-INSERT INTO t2 VALUES (197,048303,37,'convulsion','rudeness','pellagra','');
-INSERT INTO t2 VALUES (198,048304,37,'railway','beaner','cult','');
-INSERT INTO t2 VALUES (199,048305,37,'validate','boorish','creek','A');
-INSERT INTO t2 VALUES (200,048401,37,'normalizes','Everhart','Huffman','');
-INSERT INTO t2 VALUES (201,048402,37,'comprehensive','encompass','Majorca','FAS');
-INSERT INTO t2 VALUES (202,048403,37,'chewing','mushrooms','governing','A');
-INSERT INTO t2 VALUES (203,048404,37,'denizen','Alison','gadfly','FAS');
-INSERT INTO t2 VALUES (204,048405,37,'schemer','externally','reassigned','FAS');
-INSERT INTO t2 VALUES (205,048406,37,'chronicle','pellagra','intentness','W');
-INSERT INTO t2 VALUES (206,048407,37,'Kline','cult','craziness','');
-INSERT INTO t2 VALUES (207,048408,37,'Anatole','creek','psychic','');
-INSERT INTO t2 VALUES (208,048409,37,'partridges','Huffman','squabbled','');
-INSERT INTO t2 VALUES (209,048410,37,'brunch','Majorca','burlesque','');
-INSERT INTO t2 VALUES (210,048411,37,'recruited','governing','capped','');
-INSERT INTO t2 VALUES (211,048412,37,'dimensions','gadfly','extracted','A');
-INSERT INTO t2 VALUES (212,048413,37,'Chicana','reassigned','DiMaggio','');
-INSERT INTO t2 VALUES (213,048601,37,'announced','intentness','exclamation','FAS');
-INSERT INTO t2 VALUES (214,048602,37,'praised','craziness','subdirectory','');
-INSERT INTO t2 VALUES (215,048603,37,'employing','psychic','fangs','');
-INSERT INTO t2 VALUES (216,048604,37,'linear','squabbled','buyer','A');
-INSERT INTO t2 VALUES (217,048801,37,'quagmire','burlesque','pithing','A');
-INSERT INTO t2 VALUES (218,050901,37,'western','capped','transistorizing','A');
-INSERT INTO t2 VALUES (219,051201,37,'relishing','extracted','nonbiodegradable','');
-INSERT INTO t2 VALUES (220,056002,37,'serving','DiMaggio','dislocate','');
-INSERT INTO t2 VALUES (221,056003,37,'scheduling','exclamation','monochromatic','FAS');
-INSERT INTO t2 VALUES (222,056004,37,'lore','subdirectory','batting','');
-INSERT INTO t2 VALUES (223,056102,37,'eventful','fangs','postcondition','A');
-INSERT INTO t2 VALUES (224,056203,37,'arteriole','buyer','catalog','FAS');
-INSERT INTO t2 VALUES (225,056204,37,'disentangle','pithing','Remus','');
-INSERT INTO t2 VALUES (226,058003,37,'cured','transistorizing','devices','A');
-INSERT INTO t2 VALUES (227,058004,37,'Fenton','nonbiodegradable','bike','A');
-INSERT INTO t2 VALUES (228,058005,37,'avoidable','dislocate','qualify','');
-INSERT INTO t2 VALUES (229,058006,37,'drains','monochromatic','detained','');
-INSERT INTO t2 VALUES (230,058007,37,'detectably','batting','commended','');
-INSERT INTO t2 VALUES (231,058101,37,'husky','postcondition','civilize','');
-INSERT INTO t2 VALUES (232,058102,37,'impelling','catalog','Elmhurst','');
-INSERT INTO t2 VALUES (233,058103,37,'undoes','Remus','anesthetizing','');
-INSERT INTO t2 VALUES (234,058105,37,'evened','devices','deaf','');
-INSERT INTO t2 VALUES (235,058111,37,'squeezes','bike','Brigham','');
-INSERT INTO t2 VALUES (236,058112,37,'destroyer','qualify','title','');
-INSERT INTO t2 VALUES (237,058113,37,'rudeness','detained','coarse','');
-INSERT INTO t2 VALUES (238,058114,37,'beaner','commended','combinations','');
-INSERT INTO t2 VALUES (239,058115,37,'boorish','civilize','grayness','');
-INSERT INTO t2 VALUES (240,058116,37,'Everhart','Elmhurst','innumerable','FAS');
-INSERT INTO t2 VALUES (241,058117,37,'encompass','anesthetizing','Caroline','A');
-INSERT INTO t2 VALUES (242,058118,37,'mushrooms','deaf','fatty','FAS');
-INSERT INTO t2 VALUES (243,058119,37,'Alison','Brigham','eastbound','');
-INSERT INTO t2 VALUES (244,058120,37,'externally','title','inexperienced','');
-INSERT INTO t2 VALUES (245,058121,37,'pellagra','coarse','hoarder','A');
-INSERT INTO t2 VALUES (246,058122,37,'cult','combinations','scotch','W');
-INSERT INTO t2 VALUES (247,058123,37,'creek','grayness','passport','A');
-INSERT INTO t2 VALUES (248,058124,37,'Huffman','innumerable','strategic','FAS');
-INSERT INTO t2 VALUES (249,058125,37,'Majorca','Caroline','gated','');
-INSERT INTO t2 VALUES (250,058126,37,'governing','fatty','flog','');
-INSERT INTO t2 VALUES (251,058127,37,'gadfly','eastbound','Pipestone','');
-INSERT INTO t2 VALUES (252,058128,37,'reassigned','inexperienced','Dar','');
-INSERT INTO t2 VALUES (253,058201,37,'intentness','hoarder','Corcoran','');
-INSERT INTO t2 VALUES (254,058202,37,'craziness','scotch','flyers','A');
-INSERT INTO t2 VALUES (255,058303,37,'psychic','passport','competitions','W');
-INSERT INTO t2 VALUES (256,058304,37,'squabbled','strategic','suppliers','FAS');
-INSERT INTO t2 VALUES (257,058602,37,'burlesque','gated','skips','');
-INSERT INTO t2 VALUES (258,058603,37,'capped','flog','institutes','');
-INSERT INTO t2 VALUES (259,058604,37,'extracted','Pipestone','troop','A');
-INSERT INTO t2 VALUES (260,058605,37,'DiMaggio','Dar','connective','W');
-INSERT INTO t2 VALUES (261,058606,37,'exclamation','Corcoran','denies','');
-INSERT INTO t2 VALUES (262,058607,37,'subdirectory','flyers','polka','');
-INSERT INTO t2 VALUES (263,060401,36,'fangs','competitions','observations','FAS');
-INSERT INTO t2 VALUES (264,061701,36,'buyer','suppliers','askers','');
-INSERT INTO t2 VALUES (265,066201,36,'pithing','skips','homeless','FAS');
-INSERT INTO t2 VALUES (266,066501,36,'transistorizing','institutes','Anna','');
-INSERT INTO t2 VALUES (267,068001,36,'nonbiodegradable','troop','subdirectories','W');
-INSERT INTO t2 VALUES (268,068002,36,'dislocate','connective','decaying','FAS');
-INSERT INTO t2 VALUES (269,068005,36,'monochromatic','denies','outwitting','W');
-INSERT INTO t2 VALUES (270,068006,36,'batting','polka','Harpy','W');
-INSERT INTO t2 VALUES (271,068007,36,'postcondition','observations','crazed','');
-INSERT INTO t2 VALUES (272,068008,36,'catalog','askers','suffocate','');
-INSERT INTO t2 VALUES (273,068009,36,'Remus','homeless','provers','FAS');
-INSERT INTO t2 VALUES (274,068010,36,'devices','Anna','technically','');
-INSERT INTO t2 VALUES (275,068011,36,'bike','subdirectories','Franklinizations','');
-INSERT INTO t2 VALUES (276,068202,36,'qualify','decaying','considered','');
-INSERT INTO t2 VALUES (277,068302,36,'detained','outwitting','tinnily','');
-INSERT INTO t2 VALUES (278,068303,36,'commended','Harpy','uninterruptedly','');
-INSERT INTO t2 VALUES (279,068401,36,'civilize','crazed','whistled','A');
-INSERT INTO t2 VALUES (280,068501,36,'Elmhurst','suffocate','automate','');
-INSERT INTO t2 VALUES (281,068502,36,'anesthetizing','provers','gutting','W');
-INSERT INTO t2 VALUES (282,068503,36,'deaf','technically','surreptitious','');
-INSERT INTO t2 VALUES (283,068602,36,'Brigham','Franklinizations','Choctaw','');
-INSERT INTO t2 VALUES (284,068603,36,'title','considered','cooks','');
-INSERT INTO t2 VALUES (285,068701,36,'coarse','tinnily','millivolt','FAS');
-INSERT INTO t2 VALUES (286,068702,36,'combinations','uninterruptedly','counterpoise','');
-INSERT INTO t2 VALUES (287,068703,36,'grayness','whistled','Gothicism','');
-INSERT INTO t2 VALUES (288,076001,36,'innumerable','automate','feminine','');
-INSERT INTO t2 VALUES (289,076002,36,'Caroline','gutting','metaphysically','W');
-INSERT INTO t2 VALUES (290,076101,36,'fatty','surreptitious','sanding','A');
-INSERT INTO t2 VALUES (291,076102,36,'eastbound','Choctaw','contributorily','');
-INSERT INTO t2 VALUES (292,076103,36,'inexperienced','cooks','receivers','FAS');
-INSERT INTO t2 VALUES (293,076302,36,'hoarder','millivolt','adjourn','');
-INSERT INTO t2 VALUES (294,076303,36,'scotch','counterpoise','straggled','A');
-INSERT INTO t2 VALUES (295,076304,36,'passport','Gothicism','druggists','');
-INSERT INTO t2 VALUES (296,076305,36,'strategic','feminine','thanking','FAS');
-INSERT INTO t2 VALUES (297,076306,36,'gated','metaphysically','ostrich','');
-INSERT INTO t2 VALUES (298,076307,36,'flog','sanding','hopelessness','FAS');
-INSERT INTO t2 VALUES (299,076402,36,'Pipestone','contributorily','Eurydice','');
-INSERT INTO t2 VALUES (300,076501,36,'Dar','receivers','excitation','W');
-INSERT INTO t2 VALUES (301,076502,36,'Corcoran','adjourn','presumes','FAS');
-INSERT INTO t2 VALUES (302,076701,36,'flyers','straggled','imaginable','FAS');
-INSERT INTO t2 VALUES (303,078001,36,'competitions','druggists','concoct','W');
-INSERT INTO t2 VALUES (304,078002,36,'suppliers','thanking','peering','W');
-INSERT INTO t2 VALUES (305,078003,36,'skips','ostrich','Phelps','FAS');
-INSERT INTO t2 VALUES (306,078004,36,'institutes','hopelessness','ferociousness','FAS');
-INSERT INTO t2 VALUES (307,078005,36,'troop','Eurydice','sentences','');
-INSERT INTO t2 VALUES (308,078006,36,'connective','excitation','unlocks','');
-INSERT INTO t2 VALUES (309,078007,36,'denies','presumes','engrossing','W');
-INSERT INTO t2 VALUES (310,078008,36,'polka','imaginable','Ruth','');
-INSERT INTO t2 VALUES (311,078101,36,'observations','concoct','tying','');
-INSERT INTO t2 VALUES (312,078103,36,'askers','peering','exclaimers','');
-INSERT INTO t2 VALUES (313,078104,36,'homeless','Phelps','synergy','');
-INSERT INTO t2 VALUES (314,078105,36,'Anna','ferociousness','Huey','W');
-INSERT INTO t2 VALUES (315,082101,36,'subdirectories','sentences','merging','');
-INSERT INTO t2 VALUES (316,083401,36,'decaying','unlocks','judges','A');
-INSERT INTO t2 VALUES (317,084001,36,'outwitting','engrossing','Shylock','W');
-INSERT INTO t2 VALUES (318,084002,36,'Harpy','Ruth','Miltonism','');
-INSERT INTO t2 VALUES (319,086001,36,'crazed','tying','hen','W');
-INSERT INTO t2 VALUES (320,086102,36,'suffocate','exclaimers','honeybee','FAS');
-INSERT INTO t2 VALUES (321,086201,36,'provers','synergy','towers','');
-INSERT INTO t2 VALUES (322,088001,36,'technically','Huey','dilutes','W');
-INSERT INTO t2 VALUES (323,088002,36,'Franklinizations','merging','numerals','FAS');
-INSERT INTO t2 VALUES (324,088003,36,'considered','judges','democracy','FAS');
-INSERT INTO t2 VALUES (325,088004,36,'tinnily','Shylock','Ibero-','');
-INSERT INTO t2 VALUES (326,088101,36,'uninterruptedly','Miltonism','invalids','');
-INSERT INTO t2 VALUES (327,088102,36,'whistled','hen','behavior','');
-INSERT INTO t2 VALUES (328,088103,36,'automate','honeybee','accruing','');
-INSERT INTO t2 VALUES (329,088104,36,'gutting','towers','relics','A');
-INSERT INTO t2 VALUES (330,088105,36,'surreptitious','dilutes','rackets','');
-INSERT INTO t2 VALUES (331,088106,36,'Choctaw','numerals','Fischbein','W');
-INSERT INTO t2 VALUES (332,088201,36,'cooks','democracy','phony','W');
-INSERT INTO t2 VALUES (333,088203,36,'millivolt','Ibero-','cross','FAS');
-INSERT INTO t2 VALUES (334,088204,36,'counterpoise','invalids','cleanup','');
-INSERT INTO t2 VALUES (335,088302,37,'Gothicism','behavior','conspirator','');
-INSERT INTO t2 VALUES (336,088303,37,'feminine','accruing','label','FAS');
-INSERT INTO t2 VALUES (337,088305,37,'metaphysically','relics','university','');
-INSERT INTO t2 VALUES (338,088402,37,'sanding','rackets','cleansed','FAS');
-INSERT INTO t2 VALUES (339,088501,36,'contributorily','Fischbein','ballgown','');
-INSERT INTO t2 VALUES (340,088502,36,'receivers','phony','starlet','');
-INSERT INTO t2 VALUES (341,088503,36,'adjourn','cross','aqueous','');
-INSERT INTO t2 VALUES (342,098001,58,'straggled','cleanup','portrayal','A');
-INSERT INTO t2 VALUES (343,098002,58,'druggists','conspirator','despising','W');
-INSERT INTO t2 VALUES (344,098003,58,'thanking','label','distort','W');
-INSERT INTO t2 VALUES (345,098004,58,'ostrich','university','palmed','');
-INSERT INTO t2 VALUES (346,098005,58,'hopelessness','cleansed','faced','');
-INSERT INTO t2 VALUES (347,098006,58,'Eurydice','ballgown','silverware','');
-INSERT INTO t2 VALUES (348,141903,29,'excitation','starlet','assessor','');
-INSERT INTO t2 VALUES (349,098008,58,'presumes','aqueous','spiders','');
-INSERT INTO t2 VALUES (350,098009,58,'imaginable','portrayal','artificially','');
-INSERT INTO t2 VALUES (351,098010,58,'concoct','despising','reminiscence','');
-INSERT INTO t2 VALUES (352,098011,58,'peering','distort','Mexican','');
-INSERT INTO t2 VALUES (353,098012,58,'Phelps','palmed','obnoxious','');
-INSERT INTO t2 VALUES (354,098013,58,'ferociousness','faced','fragile','');
-INSERT INTO t2 VALUES (355,098014,58,'sentences','silverware','apprehensible','');
-INSERT INTO t2 VALUES (356,098015,58,'unlocks','assessor','births','');
-INSERT INTO t2 VALUES (357,098016,58,'engrossing','spiders','garages','');
-INSERT INTO t2 VALUES (358,098017,58,'Ruth','artificially','panty','');
-INSERT INTO t2 VALUES (359,098018,58,'tying','reminiscence','anteater','');
-INSERT INTO t2 VALUES (360,098019,58,'exclaimers','Mexican','displacement','A');
-INSERT INTO t2 VALUES (361,098020,58,'synergy','obnoxious','drovers','A');
-INSERT INTO t2 VALUES (362,098021,58,'Huey','fragile','patenting','A');
-INSERT INTO t2 VALUES (363,098022,58,'merging','apprehensible','far','A');
-INSERT INTO t2 VALUES (364,098023,58,'judges','births','shrieks','');
-INSERT INTO t2 VALUES (365,098024,58,'Shylock','garages','aligning','W');
-INSERT INTO t2 VALUES (366,098025,37,'Miltonism','panty','pragmatism','');
-INSERT INTO t2 VALUES (367,106001,36,'hen','anteater','fevers','W');
-INSERT INTO t2 VALUES (368,108001,36,'honeybee','displacement','reexamines','A');
-INSERT INTO t2 VALUES (369,108002,36,'towers','drovers','occupancies','');
-INSERT INTO t2 VALUES (370,108003,36,'dilutes','patenting','sweats','FAS');
-INSERT INTO t2 VALUES (371,108004,36,'numerals','far','modulators','');
-INSERT INTO t2 VALUES (372,108005,36,'democracy','shrieks','demand','W');
-INSERT INTO t2 VALUES (373,108007,36,'Ibero-','aligning','Madeira','');
-INSERT INTO t2 VALUES (374,108008,36,'invalids','pragmatism','Viennese','W');
-INSERT INTO t2 VALUES (375,108009,36,'behavior','fevers','chillier','W');
-INSERT INTO t2 VALUES (376,108010,36,'accruing','reexamines','wildcats','FAS');
-INSERT INTO t2 VALUES (377,108011,36,'relics','occupancies','gentle','');
-INSERT INTO t2 VALUES (378,108012,36,'rackets','sweats','Angles','W');
-INSERT INTO t2 VALUES (379,108101,36,'Fischbein','modulators','accuracies','');
-INSERT INTO t2 VALUES (380,108102,36,'phony','demand','toggle','');
-INSERT INTO t2 VALUES (381,108103,36,'cross','Madeira','Mendelssohn','W');
-INSERT INTO t2 VALUES (382,108111,50,'cleanup','Viennese','behaviorally','');
-INSERT INTO t2 VALUES (383,108105,36,'conspirator','chillier','Rochford','');
-INSERT INTO t2 VALUES (384,108106,36,'label','wildcats','mirror','W');
-INSERT INTO t2 VALUES (385,108107,36,'university','gentle','Modula','');
-INSERT INTO t2 VALUES (386,108108,50,'cleansed','Angles','clobbering','');
-INSERT INTO t2 VALUES (387,108109,36,'ballgown','accuracies','chronography','');
-INSERT INTO t2 VALUES (388,108110,36,'starlet','toggle','Eskimoizeds','');
-INSERT INTO t2 VALUES (389,108201,36,'aqueous','Mendelssohn','British','W');
-INSERT INTO t2 VALUES (390,108202,36,'portrayal','behaviorally','pitfalls','');
-INSERT INTO t2 VALUES (391,108203,36,'despising','Rochford','verify','W');
-INSERT INTO t2 VALUES (392,108204,36,'distort','mirror','scatter','FAS');
-INSERT INTO t2 VALUES (393,108205,36,'palmed','Modula','Aztecan','');
-INSERT INTO t2 VALUES (394,108301,36,'faced','clobbering','acuity','W');
-INSERT INTO t2 VALUES (395,108302,36,'silverware','chronography','sinking','W');
-INSERT INTO t2 VALUES (396,112101,36,'assessor','Eskimoizeds','beasts','FAS');
-INSERT INTO t2 VALUES (397,112102,36,'spiders','British','Witt','W');
-INSERT INTO t2 VALUES (398,113701,36,'artificially','pitfalls','physicists','FAS');
-INSERT INTO t2 VALUES (399,116001,36,'reminiscence','verify','folksong','A');
-INSERT INTO t2 VALUES (400,116201,36,'Mexican','scatter','strokes','FAS');
-INSERT INTO t2 VALUES (401,116301,36,'obnoxious','Aztecan','crowder','');
-INSERT INTO t2 VALUES (402,116302,36,'fragile','acuity','merry','');
-INSERT INTO t2 VALUES (403,116601,36,'apprehensible','sinking','cadenced','');
-INSERT INTO t2 VALUES (404,116602,36,'births','beasts','alimony','A');
-INSERT INTO t2 VALUES (405,116603,36,'garages','Witt','principled','A');
-INSERT INTO t2 VALUES (406,116701,36,'panty','physicists','golfing','');
-INSERT INTO t2 VALUES (407,116702,36,'anteater','folksong','undiscovered','');
-INSERT INTO t2 VALUES (408,118001,36,'displacement','strokes','irritates','');
-INSERT INTO t2 VALUES (409,118002,36,'drovers','crowder','patriots','A');
-INSERT INTO t2 VALUES (410,118003,36,'patenting','merry','rooms','FAS');
-INSERT INTO t2 VALUES (411,118004,36,'far','cadenced','towering','W');
-INSERT INTO t2 VALUES (412,118005,36,'shrieks','alimony','displease','');
-INSERT INTO t2 VALUES (413,118006,36,'aligning','principled','photosensitive','');
-INSERT INTO t2 VALUES (414,118007,36,'pragmatism','golfing','inking','');
-INSERT INTO t2 VALUES (415,118008,36,'fevers','undiscovered','gainers','');
-INSERT INTO t2 VALUES (416,118101,36,'reexamines','irritates','leaning','A');
-INSERT INTO t2 VALUES (417,118102,36,'occupancies','patriots','hydrant','A');
-INSERT INTO t2 VALUES (418,118103,36,'sweats','rooms','preserve','');
-INSERT INTO t2 VALUES (419,118202,36,'modulators','towering','blinded','A');
-INSERT INTO t2 VALUES (420,118203,36,'demand','displease','interactions','A');
-INSERT INTO t2 VALUES (421,118204,36,'Madeira','photosensitive','Barry','');
-INSERT INTO t2 VALUES (422,118302,36,'Viennese','inking','whiteness','A');
-INSERT INTO t2 VALUES (423,118304,36,'chillier','gainers','pastimes','W');
-INSERT INTO t2 VALUES (424,118305,36,'wildcats','leaning','Edenization','');
-INSERT INTO t2 VALUES (425,118306,36,'gentle','hydrant','Muscat','');
-INSERT INTO t2 VALUES (426,118307,36,'Angles','preserve','assassinated','');
-INSERT INTO t2 VALUES (427,123101,36,'accuracies','blinded','labeled','');
-INSERT INTO t2 VALUES (428,123102,36,'toggle','interactions','glacial','A');
-INSERT INTO t2 VALUES (429,123301,36,'Mendelssohn','Barry','implied','W');
-INSERT INTO t2 VALUES (430,126001,36,'behaviorally','whiteness','bibliographies','W');
-INSERT INTO t2 VALUES (431,126002,36,'Rochford','pastimes','Buchanan','');
-INSERT INTO t2 VALUES (432,126003,36,'mirror','Edenization','forgivably','FAS');
-INSERT INTO t2 VALUES (433,126101,36,'Modula','Muscat','innuendo','A');
-INSERT INTO t2 VALUES (434,126301,36,'clobbering','assassinated','den','FAS');
-INSERT INTO t2 VALUES (435,126302,36,'chronography','labeled','submarines','W');
-INSERT INTO t2 VALUES (436,126402,36,'Eskimoizeds','glacial','mouthful','A');
-INSERT INTO t2 VALUES (437,126601,36,'British','implied','expiring','');
-INSERT INTO t2 VALUES (438,126602,36,'pitfalls','bibliographies','unfulfilled','FAS');
-INSERT INTO t2 VALUES (439,126702,36,'verify','Buchanan','precession','');
-INSERT INTO t2 VALUES (440,128001,36,'scatter','forgivably','nullified','');
-INSERT INTO t2 VALUES (441,128002,36,'Aztecan','innuendo','affects','');
-INSERT INTO t2 VALUES (442,128003,36,'acuity','den','Cynthia','');
-INSERT INTO t2 VALUES (443,128004,36,'sinking','submarines','Chablis','A');
-INSERT INTO t2 VALUES (444,128005,36,'beasts','mouthful','betterments','FAS');
-INSERT INTO t2 VALUES (445,128007,36,'Witt','expiring','advertising','');
-INSERT INTO t2 VALUES (446,128008,36,'physicists','unfulfilled','rubies','A');
-INSERT INTO t2 VALUES (447,128009,36,'folksong','precession','southwest','FAS');
-INSERT INTO t2 VALUES (448,128010,36,'strokes','nullified','superstitious','A');
-INSERT INTO t2 VALUES (449,128011,36,'crowder','affects','tabernacle','W');
-INSERT INTO t2 VALUES (450,128012,36,'merry','Cynthia','silk','A');
-INSERT INTO t2 VALUES (451,128013,36,'cadenced','Chablis','handsomest','A');
-INSERT INTO t2 VALUES (452,128014,36,'alimony','betterments','Persian','A');
-INSERT INTO t2 VALUES (453,128015,36,'principled','advertising','analog','W');
-INSERT INTO t2 VALUES (454,128016,36,'golfing','rubies','complex','W');
-INSERT INTO t2 VALUES (455,128017,36,'undiscovered','southwest','Taoist','');
-INSERT INTO t2 VALUES (456,128018,36,'irritates','superstitious','suspend','');
-INSERT INTO t2 VALUES (457,128019,36,'patriots','tabernacle','relegated','');
-INSERT INTO t2 VALUES (458,128020,36,'rooms','silk','awesome','W');
-INSERT INTO t2 VALUES (459,128021,36,'towering','handsomest','Bruxelles','');
-INSERT INTO t2 VALUES (460,128022,36,'displease','Persian','imprecisely','A');
-INSERT INTO t2 VALUES (461,128023,36,'photosensitive','analog','televise','');
-INSERT INTO t2 VALUES (462,128101,36,'inking','complex','braking','');
-INSERT INTO t2 VALUES (463,128102,36,'gainers','Taoist','true','FAS');
-INSERT INTO t2 VALUES (464,128103,36,'leaning','suspend','disappointing','FAS');
-INSERT INTO t2 VALUES (465,128104,36,'hydrant','relegated','navally','W');
-INSERT INTO t2 VALUES (466,128106,36,'preserve','awesome','circus','');
-INSERT INTO t2 VALUES (467,128107,36,'blinded','Bruxelles','beetles','');
-INSERT INTO t2 VALUES (468,128108,36,'interactions','imprecisely','trumps','');
-INSERT INTO t2 VALUES (469,128202,36,'Barry','televise','fourscore','W');
-INSERT INTO t2 VALUES (470,128203,36,'whiteness','braking','Blackfoots','');
-INSERT INTO t2 VALUES (471,128301,36,'pastimes','true','Grady','');
-INSERT INTO t2 VALUES (472,128302,36,'Edenization','disappointing','quiets','FAS');
-INSERT INTO t2 VALUES (473,128303,36,'Muscat','navally','floundered','FAS');
-INSERT INTO t2 VALUES (474,128304,36,'assassinated','circus','profundity','W');
-INSERT INTO t2 VALUES (475,128305,36,'labeled','beetles','Garrisonian','W');
-INSERT INTO t2 VALUES (476,128307,36,'glacial','trumps','Strauss','');
-INSERT INTO t2 VALUES (477,128401,36,'implied','fourscore','cemented','FAS');
-INSERT INTO t2 VALUES (478,128502,36,'bibliographies','Blackfoots','contrition','A');
-INSERT INTO t2 VALUES (479,128503,36,'Buchanan','Grady','mutations','');
-INSERT INTO t2 VALUES (480,128504,36,'forgivably','quiets','exhibits','W');
-INSERT INTO t2 VALUES (481,128505,36,'innuendo','floundered','tits','');
-INSERT INTO t2 VALUES (482,128601,36,'den','profundity','mate','A');
-INSERT INTO t2 VALUES (483,128603,36,'submarines','Garrisonian','arches','');
-INSERT INTO t2 VALUES (484,128604,36,'mouthful','Strauss','Moll','');
-INSERT INTO t2 VALUES (485,128702,36,'expiring','cemented','ropers','');
-INSERT INTO t2 VALUES (486,128703,36,'unfulfilled','contrition','bombast','');
-INSERT INTO t2 VALUES (487,128704,36,'precession','mutations','difficultly','A');
-INSERT INTO t2 VALUES (488,138001,36,'nullified','exhibits','adsorption','');
-INSERT INTO t2 VALUES (489,138002,36,'affects','tits','definiteness','FAS');
-INSERT INTO t2 VALUES (490,138003,36,'Cynthia','mate','cultivation','A');
-INSERT INTO t2 VALUES (491,138004,36,'Chablis','arches','heals','A');
-INSERT INTO t2 VALUES (492,138005,36,'betterments','Moll','Heusen','W');
-INSERT INTO t2 VALUES (493,138006,36,'advertising','ropers','target','FAS');
-INSERT INTO t2 VALUES (494,138007,36,'rubies','bombast','cited','A');
-INSERT INTO t2 VALUES (495,138008,36,'southwest','difficultly','congresswoman','W');
-INSERT INTO t2 VALUES (496,138009,36,'superstitious','adsorption','Katherine','');
-INSERT INTO t2 VALUES (497,138102,36,'tabernacle','definiteness','titter','A');
-INSERT INTO t2 VALUES (498,138103,36,'silk','cultivation','aspire','A');
-INSERT INTO t2 VALUES (499,138104,36,'handsomest','heals','Mardis','');
-INSERT INTO t2 VALUES (500,138105,36,'Persian','Heusen','Nadia','W');
-INSERT INTO t2 VALUES (501,138201,36,'analog','target','estimating','FAS');
-INSERT INTO t2 VALUES (502,138302,36,'complex','cited','stuck','A');
-INSERT INTO t2 VALUES (503,138303,36,'Taoist','congresswoman','fifteenth','A');
-INSERT INTO t2 VALUES (504,138304,36,'suspend','Katherine','Colombo','');
-INSERT INTO t2 VALUES (505,138401,29,'relegated','titter','survey','A');
-INSERT INTO t2 VALUES (506,140102,29,'awesome','aspire','staffing','');
-INSERT INTO t2 VALUES (507,140103,29,'Bruxelles','Mardis','obtain','');
-INSERT INTO t2 VALUES (508,140104,29,'imprecisely','Nadia','loaded','');
-INSERT INTO t2 VALUES (509,140105,29,'televise','estimating','slaughtered','');
-INSERT INTO t2 VALUES (510,140201,29,'braking','stuck','lights','A');
-INSERT INTO t2 VALUES (511,140701,29,'true','fifteenth','circumference','');
-INSERT INTO t2 VALUES (512,141501,29,'disappointing','Colombo','dull','A');
-INSERT INTO t2 VALUES (513,141502,29,'navally','survey','weekly','A');
-INSERT INTO t2 VALUES (514,141901,29,'circus','staffing','wetness','');
-INSERT INTO t2 VALUES (515,141902,29,'beetles','obtain','visualized','');
-INSERT INTO t2 VALUES (516,142101,29,'trumps','loaded','Tannenbaum','');
-INSERT INTO t2 VALUES (517,142102,29,'fourscore','slaughtered','moribund','');
-INSERT INTO t2 VALUES (518,142103,29,'Blackfoots','lights','demultiplex','');
-INSERT INTO t2 VALUES (519,142701,29,'Grady','circumference','lockings','');
-INSERT INTO t2 VALUES (520,143001,29,'quiets','dull','thugs','FAS');
-INSERT INTO t2 VALUES (521,143501,29,'floundered','weekly','unnerves','');
-INSERT INTO t2 VALUES (522,143502,29,'profundity','wetness','abut','');
-INSERT INTO t2 VALUES (523,148001,29,'Garrisonian','visualized','Chippewa','A');
-INSERT INTO t2 VALUES (524,148002,29,'Strauss','Tannenbaum','stratifications','A');
-INSERT INTO t2 VALUES (525,148003,29,'cemented','moribund','signaled','');
-INSERT INTO t2 VALUES (526,148004,29,'contrition','demultiplex','Italianizes','A');
-INSERT INTO t2 VALUES (527,148005,29,'mutations','lockings','algorithmic','A');
-INSERT INTO t2 VALUES (528,148006,29,'exhibits','thugs','paranoid','FAS');
-INSERT INTO t2 VALUES (529,148007,29,'tits','unnerves','camping','A');
-INSERT INTO t2 VALUES (530,148009,29,'mate','abut','signifying','A');
-INSERT INTO t2 VALUES (531,148010,29,'arches','Chippewa','Patrice','W');
-INSERT INTO t2 VALUES (532,148011,29,'Moll','stratifications','search','A');
-INSERT INTO t2 VALUES (533,148012,29,'ropers','signaled','Angeles','A');
-INSERT INTO t2 VALUES (534,148013,29,'bombast','Italianizes','semblance','');
-INSERT INTO t2 VALUES (535,148023,36,'difficultly','algorithmic','taxed','');
-INSERT INTO t2 VALUES (536,148015,29,'adsorption','paranoid','Beatrice','');
-INSERT INTO t2 VALUES (537,148016,29,'definiteness','camping','retrace','');
-INSERT INTO t2 VALUES (538,148017,29,'cultivation','signifying','lockout','');
-INSERT INTO t2 VALUES (539,148018,29,'heals','Patrice','grammatic','');
-INSERT INTO t2 VALUES (540,148019,29,'Heusen','search','helmsman','');
-INSERT INTO t2 VALUES (541,148020,29,'target','Angeles','uniform','W');
-INSERT INTO t2 VALUES (542,148021,29,'cited','semblance','hamming','');
-INSERT INTO t2 VALUES (543,148022,29,'congresswoman','taxed','disobedience','');
-INSERT INTO t2 VALUES (544,148101,29,'Katherine','Beatrice','captivated','A');
-INSERT INTO t2 VALUES (545,148102,29,'titter','retrace','transferals','A');
-INSERT INTO t2 VALUES (546,148201,29,'aspire','lockout','cartographer','A');
-INSERT INTO t2 VALUES (547,148401,29,'Mardis','grammatic','aims','FAS');
-INSERT INTO t2 VALUES (548,148402,29,'Nadia','helmsman','Pakistani','');
-INSERT INTO t2 VALUES (549,148501,29,'estimating','uniform','burglarized','FAS');
-INSERT INTO t2 VALUES (550,148502,29,'stuck','hamming','saucepans','A');
-INSERT INTO t2 VALUES (551,148503,29,'fifteenth','disobedience','lacerating','A');
-INSERT INTO t2 VALUES (552,148504,29,'Colombo','captivated','corny','');
-INSERT INTO t2 VALUES (553,148601,29,'survey','transferals','megabytes','FAS');
-INSERT INTO t2 VALUES (554,148602,29,'staffing','cartographer','chancellor','');
-INSERT INTO t2 VALUES (555,150701,29,'obtain','aims','bulk','A');
-INSERT INTO t2 VALUES (556,152101,29,'loaded','Pakistani','commits','A');
-INSERT INTO t2 VALUES (557,152102,29,'slaughtered','burglarized','meson','W');
-INSERT INTO t2 VALUES (558,155202,36,'lights','saucepans','deputies','');
-INSERT INTO t2 VALUES (559,155203,29,'circumference','lacerating','northeaster','A');
-INSERT INTO t2 VALUES (560,155204,29,'dull','corny','dipole','');
-INSERT INTO t2 VALUES (561,155205,29,'weekly','megabytes','machining','0');
-INSERT INTO t2 VALUES (562,156001,29,'wetness','chancellor','therefore','');
-INSERT INTO t2 VALUES (563,156002,29,'visualized','bulk','Telefunken','');
-INSERT INTO t2 VALUES (564,156102,29,'Tannenbaum','commits','salvaging','');
-INSERT INTO t2 VALUES (565,156301,29,'moribund','meson','Corinthianizes','A');
-INSERT INTO t2 VALUES (566,156302,29,'demultiplex','deputies','restlessly','A');
-INSERT INTO t2 VALUES (567,156303,29,'lockings','northeaster','bromides','');
-INSERT INTO t2 VALUES (568,156304,29,'thugs','dipole','generalized','A');
-INSERT INTO t2 VALUES (569,156305,29,'unnerves','machining','mishaps','');
-INSERT INTO t2 VALUES (570,156306,29,'abut','therefore','quelling','');
-INSERT INTO t2 VALUES (571,156501,29,'Chippewa','Telefunken','spiritual','A');
-INSERT INTO t2 VALUES (572,158001,29,'stratifications','salvaging','beguiles','FAS');
-INSERT INTO t2 VALUES (573,158002,29,'signaled','Corinthianizes','Trobriand','FAS');
-INSERT INTO t2 VALUES (574,158101,29,'Italianizes','restlessly','fleeing','A');
-INSERT INTO t2 VALUES (575,158102,29,'algorithmic','bromides','Armour','A');
-INSERT INTO t2 VALUES (576,158103,29,'paranoid','generalized','chin','A');
-INSERT INTO t2 VALUES (577,158201,29,'camping','mishaps','provers','A');
-INSERT INTO t2 VALUES (578,158202,29,'signifying','quelling','aeronautic','A');
-INSERT INTO t2 VALUES (579,158203,29,'Patrice','spiritual','voltage','W');
-INSERT INTO t2 VALUES (580,158204,29,'search','beguiles','sash','');
-INSERT INTO t2 VALUES (581,158301,29,'Angeles','Trobriand','anaerobic','A');
-INSERT INTO t2 VALUES (582,158302,29,'semblance','fleeing','simultaneous','A');
-INSERT INTO t2 VALUES (583,158303,29,'taxed','Armour','accumulating','A');
-INSERT INTO t2 VALUES (584,158304,29,'Beatrice','chin','Medusan','A');
-INSERT INTO t2 VALUES (585,158305,29,'retrace','provers','shouted','A');
-INSERT INTO t2 VALUES (586,158306,29,'lockout','aeronautic','freakish','');
-INSERT INTO t2 VALUES (587,158501,29,'grammatic','voltage','index','FAS');
-INSERT INTO t2 VALUES (588,160301,29,'helmsman','sash','commercially','');
-INSERT INTO t2 VALUES (589,166101,50,'uniform','anaerobic','mistiness','A');
-INSERT INTO t2 VALUES (590,166102,50,'hamming','simultaneous','endpoint','');
-INSERT INTO t2 VALUES (591,168001,29,'disobedience','accumulating','straight','A');
-INSERT INTO t2 VALUES (592,168002,29,'captivated','Medusan','flurried','');
-INSERT INTO t2 VALUES (593,168003,29,'transferals','shouted','denotative','A');
-INSERT INTO t2 VALUES (594,168101,29,'cartographer','freakish','coming','FAS');
-INSERT INTO t2 VALUES (595,168102,29,'aims','index','commencements','FAS');
-INSERT INTO t2 VALUES (596,168103,29,'Pakistani','commercially','gentleman','');
-INSERT INTO t2 VALUES (597,168104,29,'burglarized','mistiness','gifted','');
-INSERT INTO t2 VALUES (598,168202,29,'saucepans','endpoint','Shanghais','');
-INSERT INTO t2 VALUES (599,168301,29,'lacerating','straight','sportswriting','A');
-INSERT INTO t2 VALUES (600,168502,29,'corny','flurried','sloping','A');
-INSERT INTO t2 VALUES (601,168503,29,'megabytes','denotative','navies','');
-INSERT INTO t2 VALUES (602,168601,29,'chancellor','coming','leaflet','A');
-INSERT INTO t2 VALUES (603,173001,40,'bulk','commencements','shooter','');
-INSERT INTO t2 VALUES (604,173701,40,'commits','gentleman','Joplin','FAS');
-INSERT INTO t2 VALUES (605,173702,40,'meson','gifted','babies','');
-INSERT INTO t2 VALUES (606,176001,40,'deputies','Shanghais','subdivision','FAS');
-INSERT INTO t2 VALUES (607,176101,40,'northeaster','sportswriting','burstiness','W');
-INSERT INTO t2 VALUES (608,176201,40,'dipole','sloping','belted','FAS');
-INSERT INTO t2 VALUES (609,176401,40,'machining','navies','assails','FAS');
-INSERT INTO t2 VALUES (610,176501,40,'therefore','leaflet','admiring','W');
-INSERT INTO t2 VALUES (611,176601,40,'Telefunken','shooter','swaying','0');
-INSERT INTO t2 VALUES (612,176602,40,'salvaging','Joplin','Goldstine','FAS');
-INSERT INTO t2 VALUES (613,176603,40,'Corinthianizes','babies','fitting','');
-INSERT INTO t2 VALUES (614,178001,40,'restlessly','subdivision','Norwalk','W');
-INSERT INTO t2 VALUES (615,178002,40,'bromides','burstiness','weakening','W');
-INSERT INTO t2 VALUES (616,178003,40,'generalized','belted','analogy','FAS');
-INSERT INTO t2 VALUES (617,178004,40,'mishaps','assails','deludes','');
-INSERT INTO t2 VALUES (618,178005,40,'quelling','admiring','cokes','');
-INSERT INTO t2 VALUES (619,178006,40,'spiritual','swaying','Clayton','');
-INSERT INTO t2 VALUES (620,178007,40,'beguiles','Goldstine','exhausts','');
-INSERT INTO t2 VALUES (621,178008,40,'Trobriand','fitting','causality','');
-INSERT INTO t2 VALUES (622,178101,40,'fleeing','Norwalk','sating','FAS');
-INSERT INTO t2 VALUES (623,178102,40,'Armour','weakening','icon','');
-INSERT INTO t2 VALUES (624,178103,40,'chin','analogy','throttles','');
-INSERT INTO t2 VALUES (625,178201,40,'provers','deludes','communicants','FAS');
-INSERT INTO t2 VALUES (626,178202,40,'aeronautic','cokes','dehydrate','FAS');
-INSERT INTO t2 VALUES (627,178301,40,'voltage','Clayton','priceless','FAS');
-INSERT INTO t2 VALUES (628,178302,40,'sash','exhausts','publicly','');
-INSERT INTO t2 VALUES (629,178401,40,'anaerobic','causality','incidentals','FAS');
-INSERT INTO t2 VALUES (630,178402,40,'simultaneous','sating','commonplace','');
-INSERT INTO t2 VALUES (631,178403,40,'accumulating','icon','mumbles','');
-INSERT INTO t2 VALUES (632,178404,40,'Medusan','throttles','furthermore','W');
-INSERT INTO t2 VALUES (633,178501,40,'shouted','communicants','cautioned','W');
-INSERT INTO t2 VALUES (634,186002,37,'freakish','dehydrate','parametrized','A');
-INSERT INTO t2 VALUES (635,186102,37,'index','priceless','registration','A');
-INSERT INTO t2 VALUES (636,186201,40,'commercially','publicly','sadly','FAS');
-INSERT INTO t2 VALUES (637,186202,40,'mistiness','incidentals','positioning','');
-INSERT INTO t2 VALUES (638,186203,40,'endpoint','commonplace','babysitting','');
-INSERT INTO t2 VALUES (639,186302,37,'straight','mumbles','eternal','A');
-INSERT INTO t2 VALUES (640,188007,37,'flurried','furthermore','hoarder','');
-INSERT INTO t2 VALUES (641,188008,37,'denotative','cautioned','congregates','');
-INSERT INTO t2 VALUES (642,188009,37,'coming','parametrized','rains','');
-INSERT INTO t2 VALUES (643,188010,37,'commencements','registration','workers','W');
-INSERT INTO t2 VALUES (644,188011,37,'gentleman','sadly','sags','A');
-INSERT INTO t2 VALUES (645,188012,37,'gifted','positioning','unplug','W');
-INSERT INTO t2 VALUES (646,188013,37,'Shanghais','babysitting','garage','A');
-INSERT INTO t2 VALUES (647,188014,37,'sportswriting','eternal','boulder','A');
-INSERT INTO t2 VALUES (648,188015,37,'sloping','hoarder','hollowly','A');
-INSERT INTO t2 VALUES (649,188016,37,'navies','congregates','specifics','');
-INSERT INTO t2 VALUES (650,188017,37,'leaflet','rains','Teresa','');
-INSERT INTO t2 VALUES (651,188102,37,'shooter','workers','Winsett','');
-INSERT INTO t2 VALUES (652,188103,37,'Joplin','sags','convenient','A');
-INSERT INTO t2 VALUES (653,188202,37,'babies','unplug','buckboards','FAS');
-INSERT INTO t2 VALUES (654,188301,40,'subdivision','garage','amenities','');
-INSERT INTO t2 VALUES (655,188302,40,'burstiness','boulder','resplendent','FAS');
-INSERT INTO t2 VALUES (656,188303,40,'belted','hollowly','priding','FAS');
-INSERT INTO t2 VALUES (657,188401,37,'assails','specifics','configurations','');
-INSERT INTO t2 VALUES (658,188402,37,'admiring','Teresa','untidiness','A');
-INSERT INTO t2 VALUES (659,188503,37,'swaying','Winsett','Brice','W');
-INSERT INTO t2 VALUES (660,188504,37,'Goldstine','convenient','sews','FAS');
-INSERT INTO t2 VALUES (661,188505,37,'fitting','buckboards','participated','');
-INSERT INTO t2 VALUES (662,190701,37,'Norwalk','amenities','Simon','FAS');
-INSERT INTO t2 VALUES (663,190703,50,'weakening','resplendent','certificates','');
-INSERT INTO t2 VALUES (664,191701,37,'analogy','priding','Fitzpatrick','');
-INSERT INTO t2 VALUES (665,191702,37,'deludes','configurations','Evanston','A');
-INSERT INTO t2 VALUES (666,191703,37,'cokes','untidiness','misted','');
-INSERT INTO t2 VALUES (667,196001,37,'Clayton','Brice','textures','A');
-INSERT INTO t2 VALUES (668,196002,37,'exhausts','sews','save','');
-INSERT INTO t2 VALUES (669,196003,37,'causality','participated','count','');
-INSERT INTO t2 VALUES (670,196101,37,'sating','Simon','rightful','A');
-INSERT INTO t2 VALUES (671,196103,37,'icon','certificates','chaperone','');
-INSERT INTO t2 VALUES (672,196104,37,'throttles','Fitzpatrick','Lizzy','A');
-INSERT INTO t2 VALUES (673,196201,37,'communicants','Evanston','clenched','A');
-INSERT INTO t2 VALUES (674,196202,37,'dehydrate','misted','effortlessly','');
-INSERT INTO t2 VALUES (675,196203,37,'priceless','textures','accessed','');
-INSERT INTO t2 VALUES (676,198001,37,'publicly','save','beaters','A');
-INSERT INTO t2 VALUES (677,198003,37,'incidentals','count','Hornblower','FAS');
-INSERT INTO t2 VALUES (678,198004,37,'commonplace','rightful','vests','A');
-INSERT INTO t2 VALUES (679,198005,37,'mumbles','chaperone','indulgences','FAS');
-INSERT INTO t2 VALUES (680,198006,37,'furthermore','Lizzy','infallibly','A');
-INSERT INTO t2 VALUES (681,198007,37,'cautioned','clenched','unwilling','FAS');
-INSERT INTO t2 VALUES (682,198008,37,'parametrized','effortlessly','excrete','FAS');
-INSERT INTO t2 VALUES (683,198009,37,'registration','accessed','spools','A');
-INSERT INTO t2 VALUES (684,198010,37,'sadly','beaters','crunches','FAS');
-INSERT INTO t2 VALUES (685,198011,37,'positioning','Hornblower','overestimating','FAS');
-INSERT INTO t2 VALUES (686,198012,37,'babysitting','vests','ineffective','');
-INSERT INTO t2 VALUES (687,198013,37,'eternal','indulgences','humiliation','A');
-INSERT INTO t2 VALUES (688,198014,37,'hoarder','infallibly','sophomore','');
-INSERT INTO t2 VALUES (689,198015,37,'congregates','unwilling','star','');
-INSERT INTO t2 VALUES (690,198017,37,'rains','excrete','rifles','');
-INSERT INTO t2 VALUES (691,198018,37,'workers','spools','dialysis','');
-INSERT INTO t2 VALUES (692,198019,37,'sags','crunches','arriving','');
-INSERT INTO t2 VALUES (693,198020,37,'unplug','overestimating','indulge','');
-INSERT INTO t2 VALUES (694,198021,37,'garage','ineffective','clockers','');
-INSERT INTO t2 VALUES (695,198022,37,'boulder','humiliation','languages','');
-INSERT INTO t2 VALUES (696,198023,50,'hollowly','sophomore','Antarctica','A');
-INSERT INTO t2 VALUES (697,198024,37,'specifics','star','percentage','');
-INSERT INTO t2 VALUES (698,198101,37,'Teresa','rifles','ceiling','A');
-INSERT INTO t2 VALUES (699,198103,37,'Winsett','dialysis','specification','');
-INSERT INTO t2 VALUES (700,198105,37,'convenient','arriving','regimented','A');
-INSERT INTO t2 VALUES (701,198106,37,'buckboards','indulge','ciphers','');
-INSERT INTO t2 VALUES (702,198201,37,'amenities','clockers','pictures','A');
-INSERT INTO t2 VALUES (703,198204,37,'resplendent','languages','serpents','A');
-INSERT INTO t2 VALUES (704,198301,53,'priding','Antarctica','allot','A');
-INSERT INTO t2 VALUES (705,198302,53,'configurations','percentage','realized','A');
-INSERT INTO t2 VALUES (706,198303,53,'untidiness','ceiling','mayoral','A');
-INSERT INTO t2 VALUES (707,198304,53,'Brice','specification','opaquely','A');
-INSERT INTO t2 VALUES (708,198401,37,'sews','regimented','hostess','FAS');
-INSERT INTO t2 VALUES (709,198402,37,'participated','ciphers','fiftieth','');
-INSERT INTO t2 VALUES (710,198403,37,'Simon','pictures','incorrectly','');
-INSERT INTO t2 VALUES (711,202101,37,'certificates','serpents','decomposition','FAS');
-INSERT INTO t2 VALUES (712,202301,37,'Fitzpatrick','allot','stranglings','');
-INSERT INTO t2 VALUES (713,202302,37,'Evanston','realized','mixture','FAS');
-INSERT INTO t2 VALUES (714,202303,37,'misted','mayoral','electroencephalography','FAS');
-INSERT INTO t2 VALUES (715,202304,37,'textures','opaquely','similarities','FAS');
-INSERT INTO t2 VALUES (716,202305,37,'save','hostess','charges','W');
-INSERT INTO t2 VALUES (717,202601,37,'count','fiftieth','freest','FAS');
-INSERT INTO t2 VALUES (718,202602,37,'rightful','incorrectly','Greenberg','FAS');
-INSERT INTO t2 VALUES (719,202605,37,'chaperone','decomposition','tinting','');
-INSERT INTO t2 VALUES (720,202606,37,'Lizzy','stranglings','expelled','W');
-INSERT INTO t2 VALUES (721,202607,37,'clenched','mixture','warm','');
-INSERT INTO t2 VALUES (722,202901,37,'effortlessly','electroencephalography','smoothed','');
-INSERT INTO t2 VALUES (723,202902,37,'accessed','similarities','deductions','FAS');
-INSERT INTO t2 VALUES (724,202903,37,'beaters','charges','Romano','W');
-INSERT INTO t2 VALUES (725,202904,37,'Hornblower','freest','bitterroot','');
-INSERT INTO t2 VALUES (726,202907,37,'vests','Greenberg','corset','');
-INSERT INTO t2 VALUES (727,202908,37,'indulgences','tinting','securing','');
-INSERT INTO t2 VALUES (728,203101,37,'infallibly','expelled','environing','FAS');
-INSERT INTO t2 VALUES (729,203103,37,'unwilling','warm','cute','');
-INSERT INTO t2 VALUES (730,203104,37,'excrete','smoothed','Crays','');
-INSERT INTO t2 VALUES (731,203105,37,'spools','deductions','heiress','FAS');
-INSERT INTO t2 VALUES (732,203401,37,'crunches','Romano','inform','FAS');
-INSERT INTO t2 VALUES (733,203402,37,'overestimating','bitterroot','avenge','');
-INSERT INTO t2 VALUES (734,203404,37,'ineffective','corset','universals','');
-INSERT INTO t2 VALUES (735,203901,37,'humiliation','securing','Kinsey','W');
-INSERT INTO t2 VALUES (736,203902,37,'sophomore','environing','ravines','FAS');
-INSERT INTO t2 VALUES (737,203903,37,'star','cute','bestseller','');
-INSERT INTO t2 VALUES (738,203906,37,'rifles','Crays','equilibrium','');
-INSERT INTO t2 VALUES (739,203907,37,'dialysis','heiress','extents','0');
-INSERT INTO t2 VALUES (740,203908,37,'arriving','inform','relatively','');
-INSERT INTO t2 VALUES (741,203909,37,'indulge','avenge','pressure','FAS');
-INSERT INTO t2 VALUES (742,206101,37,'clockers','universals','critiques','FAS');
-INSERT INTO t2 VALUES (743,206201,37,'languages','Kinsey','befouled','');
-INSERT INTO t2 VALUES (744,206202,37,'Antarctica','ravines','rightfully','FAS');
-INSERT INTO t2 VALUES (745,206203,37,'percentage','bestseller','mechanizing','FAS');
-INSERT INTO t2 VALUES (746,206206,37,'ceiling','equilibrium','Latinizes','');
-INSERT INTO t2 VALUES (747,206207,37,'specification','extents','timesharing','');
-INSERT INTO t2 VALUES (748,206208,37,'regimented','relatively','Aden','');
-INSERT INTO t2 VALUES (749,208001,37,'ciphers','pressure','embassies','');
-INSERT INTO t2 VALUES (750,208002,37,'pictures','critiques','males','FAS');
-INSERT INTO t2 VALUES (751,208003,37,'serpents','befouled','shapelessly','FAS');
-INSERT INTO t2 VALUES (752,208004,37,'allot','rightfully','genres','FAS');
-INSERT INTO t2 VALUES (753,208008,37,'realized','mechanizing','mastering','');
-INSERT INTO t2 VALUES (754,208009,37,'mayoral','Latinizes','Newtonian','');
-INSERT INTO t2 VALUES (755,208010,37,'opaquely','timesharing','finishers','FAS');
-INSERT INTO t2 VALUES (756,208011,37,'hostess','Aden','abates','');
-INSERT INTO t2 VALUES (757,208101,37,'fiftieth','embassies','teem','');
-INSERT INTO t2 VALUES (758,208102,37,'incorrectly','males','kiting','FAS');
-INSERT INTO t2 VALUES (759,208103,37,'decomposition','shapelessly','stodgy','FAS');
-INSERT INTO t2 VALUES (760,208104,37,'stranglings','genres','scalps','FAS');
-INSERT INTO t2 VALUES (761,208105,37,'mixture','mastering','feed','FAS');
-INSERT INTO t2 VALUES (762,208110,37,'electroencephalography','Newtonian','guitars','');
-INSERT INTO t2 VALUES (763,208111,37,'similarities','finishers','airships','');
-INSERT INTO t2 VALUES (764,208112,37,'charges','abates','store','');
-INSERT INTO t2 VALUES (765,208113,37,'freest','teem','denounces','');
-INSERT INTO t2 VALUES (766,208201,37,'Greenberg','kiting','Pyle','FAS');
-INSERT INTO t2 VALUES (767,208203,37,'tinting','stodgy','Saxony','');
-INSERT INTO t2 VALUES (768,208301,37,'expelled','scalps','serializations','FAS');
-INSERT INTO t2 VALUES (769,208302,37,'warm','feed','Peruvian','FAS');
-INSERT INTO t2 VALUES (770,208305,37,'smoothed','guitars','taxonomically','FAS');
-INSERT INTO t2 VALUES (771,208401,37,'deductions','airships','kingdom','A');
-INSERT INTO t2 VALUES (772,208402,37,'Romano','store','stint','A');
-INSERT INTO t2 VALUES (773,208403,37,'bitterroot','denounces','Sault','A');
-INSERT INTO t2 VALUES (774,208404,37,'corset','Pyle','faithful','');
-INSERT INTO t2 VALUES (775,208501,37,'securing','Saxony','Ganymede','FAS');
-INSERT INTO t2 VALUES (776,208502,37,'environing','serializations','tidiness','FAS');
-INSERT INTO t2 VALUES (777,208503,37,'cute','Peruvian','gainful','FAS');
-INSERT INTO t2 VALUES (778,208504,37,'Crays','taxonomically','contrary','FAS');
-INSERT INTO t2 VALUES (779,208505,37,'heiress','kingdom','Tipperary','FAS');
-INSERT INTO t2 VALUES (780,210101,37,'inform','stint','tropics','W');
-INSERT INTO t2 VALUES (781,210102,37,'avenge','Sault','theorizers','');
-INSERT INTO t2 VALUES (782,210103,37,'universals','faithful','renew','0');
-INSERT INTO t2 VALUES (783,210104,37,'Kinsey','Ganymede','already','');
-INSERT INTO t2 VALUES (784,210105,37,'ravines','tidiness','terminal','');
-INSERT INTO t2 VALUES (785,210106,37,'bestseller','gainful','Hegelian','');
-INSERT INTO t2 VALUES (786,210107,37,'equilibrium','contrary','hypothesizer','');
-INSERT INTO t2 VALUES (787,210401,37,'extents','Tipperary','warningly','FAS');
-INSERT INTO t2 VALUES (788,213201,37,'relatively','tropics','journalizing','FAS');
-INSERT INTO t2 VALUES (789,213203,37,'pressure','theorizers','nested','');
-INSERT INTO t2 VALUES (790,213204,37,'critiques','renew','Lars','');
-INSERT INTO t2 VALUES (791,213205,37,'befouled','already','saplings','');
-INSERT INTO t2 VALUES (792,213206,37,'rightfully','terminal','foothill','');
-INSERT INTO t2 VALUES (793,213207,37,'mechanizing','Hegelian','labeled','');
-INSERT INTO t2 VALUES (794,216101,37,'Latinizes','hypothesizer','imperiously','FAS');
-INSERT INTO t2 VALUES (795,216103,37,'timesharing','warningly','reporters','FAS');
-INSERT INTO t2 VALUES (796,218001,37,'Aden','journalizing','furnishings','FAS');
-INSERT INTO t2 VALUES (797,218002,37,'embassies','nested','precipitable','FAS');
-INSERT INTO t2 VALUES (798,218003,37,'males','Lars','discounts','FAS');
-INSERT INTO t2 VALUES (799,218004,37,'shapelessly','saplings','excises','FAS');
-INSERT INTO t2 VALUES (800,143503,50,'genres','foothill','Stalin','');
-INSERT INTO t2 VALUES (801,218006,37,'mastering','labeled','despot','FAS');
-INSERT INTO t2 VALUES (802,218007,37,'Newtonian','imperiously','ripeness','FAS');
-INSERT INTO t2 VALUES (803,218008,37,'finishers','reporters','Arabia','');
-INSERT INTO t2 VALUES (804,218009,37,'abates','furnishings','unruly','');
-INSERT INTO t2 VALUES (805,218010,37,'teem','precipitable','mournfulness','');
-INSERT INTO t2 VALUES (806,218011,37,'kiting','discounts','boom','FAS');
-INSERT INTO t2 VALUES (807,218020,37,'stodgy','excises','slaughter','A');
-INSERT INTO t2 VALUES (808,218021,50,'scalps','Stalin','Sabine','');
-INSERT INTO t2 VALUES (809,218022,37,'feed','despot','handy','FAS');
-INSERT INTO t2 VALUES (810,218023,37,'guitars','ripeness','rural','');
-INSERT INTO t2 VALUES (811,218024,37,'airships','Arabia','organizer','');
-INSERT INTO t2 VALUES (812,218101,37,'store','unruly','shipyard','FAS');
-INSERT INTO t2 VALUES (813,218102,37,'denounces','mournfulness','civics','FAS');
-INSERT INTO t2 VALUES (814,218103,37,'Pyle','boom','inaccuracy','FAS');
-INSERT INTO t2 VALUES (815,218201,37,'Saxony','slaughter','rules','FAS');
-INSERT INTO t2 VALUES (816,218202,37,'serializations','Sabine','juveniles','FAS');
-INSERT INTO t2 VALUES (817,218203,37,'Peruvian','handy','comprised','W');
-INSERT INTO t2 VALUES (818,218204,37,'taxonomically','rural','investigations','');
-INSERT INTO t2 VALUES (819,218205,37,'kingdom','organizer','stabilizes','A');
-INSERT INTO t2 VALUES (820,218301,37,'stint','shipyard','seminaries','FAS');
-INSERT INTO t2 VALUES (821,218302,37,'Sault','civics','Hunter','A');
-INSERT INTO t2 VALUES (822,218401,37,'faithful','inaccuracy','sporty','FAS');
-INSERT INTO t2 VALUES (823,218402,37,'Ganymede','rules','test','FAS');
-INSERT INTO t2 VALUES (824,218403,37,'tidiness','juveniles','weasels','');
-INSERT INTO t2 VALUES (825,218404,37,'gainful','comprised','CERN','');
-INSERT INTO t2 VALUES (826,218407,37,'contrary','investigations','tempering','');
-INSERT INTO t2 VALUES (827,218408,37,'Tipperary','stabilizes','afore','FAS');
-INSERT INTO t2 VALUES (828,218409,37,'tropics','seminaries','Galatean','');
-INSERT INTO t2 VALUES (829,218410,37,'theorizers','Hunter','techniques','W');
-INSERT INTO t2 VALUES (830,226001,37,'renew','sporty','error','');
-INSERT INTO t2 VALUES (831,226002,37,'already','test','veranda','');
-INSERT INTO t2 VALUES (832,226003,37,'terminal','weasels','severely','');
-INSERT INTO t2 VALUES (833,226004,37,'Hegelian','CERN','Cassites','FAS');
-INSERT INTO t2 VALUES (834,226005,37,'hypothesizer','tempering','forthcoming','');
-INSERT INTO t2 VALUES (835,226006,37,'warningly','afore','guides','');
-INSERT INTO t2 VALUES (836,226007,37,'journalizing','Galatean','vanish','FAS');
-INSERT INTO t2 VALUES (837,226008,37,'nested','techniques','lied','A');
-INSERT INTO t2 VALUES (838,226203,37,'Lars','error','sawtooth','FAS');
-INSERT INTO t2 VALUES (839,226204,37,'saplings','veranda','fated','FAS');
-INSERT INTO t2 VALUES (840,226205,37,'foothill','severely','gradually','');
-INSERT INTO t2 VALUES (841,226206,37,'labeled','Cassites','widens','');
-INSERT INTO t2 VALUES (842,226207,37,'imperiously','forthcoming','preclude','');
-INSERT INTO t2 VALUES (843,226208,37,'reporters','guides','Jobrel','');
-INSERT INTO t2 VALUES (844,226209,37,'furnishings','vanish','hooker','');
-INSERT INTO t2 VALUES (845,226210,37,'precipitable','lied','rainstorm','');
-INSERT INTO t2 VALUES (846,226211,37,'discounts','sawtooth','disconnects','');
-INSERT INTO t2 VALUES (847,228001,37,'excises','fated','cruelty','');
-INSERT INTO t2 VALUES (848,228004,37,'Stalin','gradually','exponentials','A');
-INSERT INTO t2 VALUES (849,228005,37,'despot','widens','affective','A');
-INSERT INTO t2 VALUES (850,228006,37,'ripeness','preclude','arteries','');
-INSERT INTO t2 VALUES (851,228007,37,'Arabia','Jobrel','Crosby','FAS');
-INSERT INTO t2 VALUES (852,228008,37,'unruly','hooker','acquaint','');
-INSERT INTO t2 VALUES (853,228009,37,'mournfulness','rainstorm','evenhandedly','');
-INSERT INTO t2 VALUES (854,228101,37,'boom','disconnects','percentage','');
-INSERT INTO t2 VALUES (855,228108,37,'slaughter','cruelty','disobedience','');
-INSERT INTO t2 VALUES (856,228109,37,'Sabine','exponentials','humility','');
-INSERT INTO t2 VALUES (857,228110,37,'handy','affective','gleaning','A');
-INSERT INTO t2 VALUES (858,228111,37,'rural','arteries','petted','A');
-INSERT INTO t2 VALUES (859,228112,37,'organizer','Crosby','bloater','A');
-INSERT INTO t2 VALUES (860,228113,37,'shipyard','acquaint','minion','A');
-INSERT INTO t2 VALUES (861,228114,37,'civics','evenhandedly','marginal','A');
-INSERT INTO t2 VALUES (862,228115,37,'inaccuracy','percentage','apiary','A');
-INSERT INTO t2 VALUES (863,228116,37,'rules','disobedience','measures','');
-INSERT INTO t2 VALUES (864,228117,37,'juveniles','humility','precaution','');
-INSERT INTO t2 VALUES (865,228118,37,'comprised','gleaning','repelled','');
-INSERT INTO t2 VALUES (866,228119,37,'investigations','petted','primary','FAS');
-INSERT INTO t2 VALUES (867,228120,37,'stabilizes','bloater','coverings','');
-INSERT INTO t2 VALUES (868,228121,37,'seminaries','minion','Artemia','A');
-INSERT INTO t2 VALUES (869,228122,37,'Hunter','marginal','navigate','');
-INSERT INTO t2 VALUES (870,228201,37,'sporty','apiary','spatial','');
-INSERT INTO t2 VALUES (871,228206,37,'test','measures','Gurkha','');
-INSERT INTO t2 VALUES (872,228207,37,'weasels','precaution','meanwhile','A');
-INSERT INTO t2 VALUES (873,228208,37,'CERN','repelled','Melinda','A');
-INSERT INTO t2 VALUES (874,228209,37,'tempering','primary','Butterfield','');
-INSERT INTO t2 VALUES (875,228210,37,'afore','coverings','Aldrich','A');
-INSERT INTO t2 VALUES (876,228211,37,'Galatean','Artemia','previewing','A');
-INSERT INTO t2 VALUES (877,228212,37,'techniques','navigate','glut','A');
-INSERT INTO t2 VALUES (878,228213,37,'error','spatial','unaffected','');
-INSERT INTO t2 VALUES (879,228214,37,'veranda','Gurkha','inmate','');
-INSERT INTO t2 VALUES (880,228301,37,'severely','meanwhile','mineral','');
-INSERT INTO t2 VALUES (881,228305,37,'Cassites','Melinda','impending','A');
-INSERT INTO t2 VALUES (882,228306,37,'forthcoming','Butterfield','meditation','A');
-INSERT INTO t2 VALUES (883,228307,37,'guides','Aldrich','ideas','');
-INSERT INTO t2 VALUES (884,228308,37,'vanish','previewing','miniaturizes','W');
-INSERT INTO t2 VALUES (885,228309,37,'lied','glut','lewdly','');
-INSERT INTO t2 VALUES (886,228310,37,'sawtooth','unaffected','title','');
-INSERT INTO t2 VALUES (887,228311,37,'fated','inmate','youthfulness','');
-INSERT INTO t2 VALUES (888,228312,37,'gradually','mineral','creak','FAS');
-INSERT INTO t2 VALUES (889,228313,37,'widens','impending','Chippewa','');
-INSERT INTO t2 VALUES (890,228314,37,'preclude','meditation','clamored','');
-INSERT INTO t2 VALUES (891,228401,65,'Jobrel','ideas','freezes','');
-INSERT INTO t2 VALUES (892,228402,65,'hooker','miniaturizes','forgivably','FAS');
-INSERT INTO t2 VALUES (893,228403,65,'rainstorm','lewdly','reduce','FAS');
-INSERT INTO t2 VALUES (894,228404,65,'disconnects','title','McGovern','W');
-INSERT INTO t2 VALUES (895,228405,65,'cruelty','youthfulness','Nazis','W');
-INSERT INTO t2 VALUES (896,228406,65,'exponentials','creak','epistle','W');
-INSERT INTO t2 VALUES (897,228407,65,'affective','Chippewa','socializes','W');
-INSERT INTO t2 VALUES (898,228408,65,'arteries','clamored','conceptions','');
-INSERT INTO t2 VALUES (899,228409,65,'Crosby','freezes','Kevin','');
-INSERT INTO t2 VALUES (900,228410,65,'acquaint','forgivably','uncovering','');
-INSERT INTO t2 VALUES (901,230301,37,'evenhandedly','reduce','chews','FAS');
-INSERT INTO t2 VALUES (902,230302,37,'percentage','McGovern','appendixes','FAS');
-INSERT INTO t2 VALUES (903,230303,37,'disobedience','Nazis','raining','');
-INSERT INTO t2 VALUES (904,018062,37,'humility','epistle','infest','');
-INSERT INTO t2 VALUES (905,230501,37,'gleaning','socializes','compartment','');
-INSERT INTO t2 VALUES (906,230502,37,'petted','conceptions','minting','');
-INSERT INTO t2 VALUES (907,230503,37,'bloater','Kevin','ducks','');
-INSERT INTO t2 VALUES (908,230504,37,'minion','uncovering','roped','A');
-INSERT INTO t2 VALUES (909,230505,37,'marginal','chews','waltz','');
-INSERT INTO t2 VALUES (910,230506,37,'apiary','appendixes','Lillian','');
-INSERT INTO t2 VALUES (911,230507,37,'measures','raining','repressions','A');
-INSERT INTO t2 VALUES (912,230508,37,'precaution','infest','chillingly','');
-INSERT INTO t2 VALUES (913,230509,37,'repelled','compartment','noncritical','');
-INSERT INTO t2 VALUES (914,230901,37,'primary','minting','lithograph','');
-INSERT INTO t2 VALUES (915,230902,37,'coverings','ducks','spongers','');
-INSERT INTO t2 VALUES (916,230903,37,'Artemia','roped','parenthood','');
-INSERT INTO t2 VALUES (917,230904,37,'navigate','waltz','posed','');
-INSERT INTO t2 VALUES (918,230905,37,'spatial','Lillian','instruments','');
-INSERT INTO t2 VALUES (919,230906,37,'Gurkha','repressions','filial','');
-INSERT INTO t2 VALUES (920,230907,37,'meanwhile','chillingly','fixedly','');
-INSERT INTO t2 VALUES (921,230908,37,'Melinda','noncritical','relives','');
-INSERT INTO t2 VALUES (922,230909,37,'Butterfield','lithograph','Pandora','');
-INSERT INTO t2 VALUES (923,230910,37,'Aldrich','spongers','watering','A');
-INSERT INTO t2 VALUES (924,230911,37,'previewing','parenthood','ungrateful','');
-INSERT INTO t2 VALUES (925,230912,37,'glut','posed','secures','');
-INSERT INTO t2 VALUES (926,230913,37,'unaffected','instruments','chastisers','');
-INSERT INTO t2 VALUES (927,230914,37,'inmate','filial','icon','');
-INSERT INTO t2 VALUES (928,231304,37,'mineral','fixedly','reuniting','A');
-INSERT INTO t2 VALUES (929,231305,37,'impending','relives','imagining','A');
-INSERT INTO t2 VALUES (930,231306,37,'meditation','Pandora','abiding','A');
-INSERT INTO t2 VALUES (931,231307,37,'ideas','watering','omnisciently','');
-INSERT INTO t2 VALUES (932,231308,37,'miniaturizes','ungrateful','Britannic','');
-INSERT INTO t2 VALUES (933,231309,37,'lewdly','secures','scholastics','A');
-INSERT INTO t2 VALUES (934,231310,37,'title','chastisers','mechanics','A');
-INSERT INTO t2 VALUES (935,231311,37,'youthfulness','icon','humidly','A');
-INSERT INTO t2 VALUES (936,231312,37,'creak','reuniting','masterpiece','');
-INSERT INTO t2 VALUES (937,231313,37,'Chippewa','imagining','however','');
-INSERT INTO t2 VALUES (938,231314,37,'clamored','abiding','Mendelian','');
-INSERT INTO t2 VALUES (939,231315,37,'freezes','omnisciently','jarred','');
-INSERT INTO t2 VALUES (940,232102,37,'forgivably','Britannic','scolds','');
-INSERT INTO t2 VALUES (941,232103,37,'reduce','scholastics','infatuate','');
-INSERT INTO t2 VALUES (942,232104,37,'McGovern','mechanics','willed','A');
-INSERT INTO t2 VALUES (943,232105,37,'Nazis','humidly','joyfully','');
-INSERT INTO t2 VALUES (944,232106,37,'epistle','masterpiece','Microsoft','');
-INSERT INTO t2 VALUES (945,232107,37,'socializes','however','fibrosities','');
-INSERT INTO t2 VALUES (946,232108,37,'conceptions','Mendelian','Baltimorean','');
-INSERT INTO t2 VALUES (947,232601,37,'Kevin','jarred','equestrian','');
-INSERT INTO t2 VALUES (948,232602,37,'uncovering','scolds','Goodrich','');
-INSERT INTO t2 VALUES (949,232603,37,'chews','infatuate','apish','A');
-INSERT INTO t2 VALUES (950,232605,37,'appendixes','willed','Adlerian','');
-INSERT INTO t2 VALUES (5950,1232605,37,'appendixes','willed','Adlerian','');
-INSERT INTO t2 VALUES (5951,1232606,37,'appendixes','willed','Adlerian','');
-INSERT INTO t2 VALUES (5952,1232607,37,'appendixes','willed','Adlerian','');
-INSERT INTO t2 VALUES (5953,1232608,37,'appendixes','willed','Adlerian','');
-INSERT INTO t2 VALUES (5954,1232609,37,'appendixes','willed','Adlerian','');
-INSERT INTO t2 VALUES (951,232606,37,'raining','joyfully','Tropez','');
-INSERT INTO t2 VALUES (952,232607,37,'infest','Microsoft','nouns','');
-INSERT INTO t2 VALUES (953,232608,37,'compartment','fibrosities','distracting','');
-INSERT INTO t2 VALUES (954,232609,37,'minting','Baltimorean','mutton','');
-INSERT INTO t2 VALUES (955,236104,37,'ducks','equestrian','bridgeable','A');
-INSERT INTO t2 VALUES (956,236105,37,'roped','Goodrich','stickers','A');
-INSERT INTO t2 VALUES (957,236106,37,'waltz','apish','transcontinental','A');
-INSERT INTO t2 VALUES (958,236107,37,'Lillian','Adlerian','amateurish','');
-INSERT INTO t2 VALUES (959,236108,37,'repressions','Tropez','Gandhian','');
-INSERT INTO t2 VALUES (960,236109,37,'chillingly','nouns','stratified','');
-INSERT INTO t2 VALUES (961,236110,37,'noncritical','distracting','chamberlains','');
-INSERT INTO t2 VALUES (962,236111,37,'lithograph','mutton','creditably','');
-INSERT INTO t2 VALUES (963,236112,37,'spongers','bridgeable','philosophic','');
-INSERT INTO t2 VALUES (964,236113,37,'parenthood','stickers','ores','');
-INSERT INTO t2 VALUES (965,238005,37,'posed','transcontinental','Carleton','');
-INSERT INTO t2 VALUES (966,238006,37,'instruments','amateurish','tape','A');
-INSERT INTO t2 VALUES (967,238007,37,'filial','Gandhian','afloat','A');
-INSERT INTO t2 VALUES (968,238008,37,'fixedly','stratified','goodness','A');
-INSERT INTO t2 VALUES (969,238009,37,'relives','chamberlains','welcoming','');
-INSERT INTO t2 VALUES (970,238010,37,'Pandora','creditably','Pinsky','FAS');
-INSERT INTO t2 VALUES (971,238011,37,'watering','philosophic','halting','');
-INSERT INTO t2 VALUES (972,238012,37,'ungrateful','ores','bibliography','');
-INSERT INTO t2 VALUES (973,238013,37,'secures','Carleton','decoding','');
-INSERT INTO t2 VALUES (974,240401,41,'chastisers','tape','variance','A');
-INSERT INTO t2 VALUES (975,240402,41,'icon','afloat','allowed','A');
-INSERT INTO t2 VALUES (976,240901,41,'reuniting','goodness','dire','A');
-INSERT INTO t2 VALUES (977,240902,41,'imagining','welcoming','dub','A');
-INSERT INTO t2 VALUES (978,241801,41,'abiding','Pinsky','poisoning','');
-INSERT INTO t2 VALUES (979,242101,41,'omnisciently','halting','Iraqis','A');
-INSERT INTO t2 VALUES (980,242102,41,'Britannic','bibliography','heaving','');
-INSERT INTO t2 VALUES (981,242201,41,'scholastics','decoding','population','A');
-INSERT INTO t2 VALUES (982,242202,41,'mechanics','variance','bomb','A');
-INSERT INTO t2 VALUES (983,242501,41,'humidly','allowed','Majorca','A');
-INSERT INTO t2 VALUES (984,242502,41,'masterpiece','dire','Gershwins','');
-INSERT INTO t2 VALUES (985,246201,41,'however','dub','explorers','');
-INSERT INTO t2 VALUES (986,246202,41,'Mendelian','poisoning','libretto','A');
-INSERT INTO t2 VALUES (987,246203,41,'jarred','Iraqis','occurred','');
-INSERT INTO t2 VALUES (988,246204,41,'scolds','heaving','Lagos','');
-INSERT INTO t2 VALUES (989,246205,41,'infatuate','population','rats','');
-INSERT INTO t2 VALUES (990,246301,41,'willed','bomb','bankruptcies','A');
-INSERT INTO t2 VALUES (991,246302,41,'joyfully','Majorca','crying','');
-INSERT INTO t2 VALUES (992,248001,41,'Microsoft','Gershwins','unexpected','');
-INSERT INTO t2 VALUES (993,248002,41,'fibrosities','explorers','accessed','A');
-INSERT INTO t2 VALUES (994,248003,41,'Baltimorean','libretto','colorful','A');
-INSERT INTO t2 VALUES (995,248004,41,'equestrian','occurred','versatility','A');
-INSERT INTO t2 VALUES (996,248005,41,'Goodrich','Lagos','cosy','');
-INSERT INTO t2 VALUES (997,248006,41,'apish','rats','Darius','A');
-INSERT INTO t2 VALUES (998,248007,41,'Adlerian','bankruptcies','mastering','A');
-INSERT INTO t2 VALUES (999,248008,41,'Tropez','crying','Asiaticizations','A');
-INSERT INTO t2 VALUES (1000,248009,41,'nouns','unexpected','offerers','A');
-INSERT INTO t2 VALUES (1001,248010,41,'distracting','accessed','uncles','A');
-INSERT INTO t2 VALUES (1002,248011,41,'mutton','colorful','sleepwalk','');
-INSERT INTO t2 VALUES (1003,248012,41,'bridgeable','versatility','Ernestine','');
-INSERT INTO t2 VALUES (1004,248013,41,'stickers','cosy','checksumming','');
-INSERT INTO t2 VALUES (1005,248014,41,'transcontinental','Darius','stopped','');
-INSERT INTO t2 VALUES (1006,248015,41,'amateurish','mastering','sicker','');
-INSERT INTO t2 VALUES (1007,248016,41,'Gandhian','Asiaticizations','Italianization','');
-INSERT INTO t2 VALUES (1008,248017,41,'stratified','offerers','alphabetic','');
-INSERT INTO t2 VALUES (1009,248018,41,'chamberlains','uncles','pharmaceutic','');
-INSERT INTO t2 VALUES (1010,248019,41,'creditably','sleepwalk','creator','');
-INSERT INTO t2 VALUES (1011,248020,41,'philosophic','Ernestine','chess','');
-INSERT INTO t2 VALUES (1012,248021,41,'ores','checksumming','charcoal','');
-INSERT INTO t2 VALUES (1013,248101,41,'Carleton','stopped','Epiphany','A');
-INSERT INTO t2 VALUES (1014,248102,41,'tape','sicker','bulldozes','A');
-INSERT INTO t2 VALUES (1015,248201,41,'afloat','Italianization','Pygmalion','A');
-INSERT INTO t2 VALUES (1016,248202,41,'goodness','alphabetic','caressing','A');
-INSERT INTO t2 VALUES (1017,248203,41,'welcoming','pharmaceutic','Palestine','A');
-INSERT INTO t2 VALUES (1018,248204,41,'Pinsky','creator','regimented','A');
-INSERT INTO t2 VALUES (1019,248205,41,'halting','chess','scars','A');
-INSERT INTO t2 VALUES (1020,248206,41,'bibliography','charcoal','realest','A');
-INSERT INTO t2 VALUES (1021,248207,41,'decoding','Epiphany','diffusing','A');
-INSERT INTO t2 VALUES (1022,248208,41,'variance','bulldozes','clubroom','A');
-INSERT INTO t2 VALUES (1023,248209,41,'allowed','Pygmalion','Blythe','A');
-INSERT INTO t2 VALUES (1024,248210,41,'dire','caressing','ahead','');
-INSERT INTO t2 VALUES (1025,248211,50,'dub','Palestine','reviver','');
-INSERT INTO t2 VALUES (1026,250501,34,'poisoning','regimented','retransmitting','A');
-INSERT INTO t2 VALUES (1027,250502,34,'Iraqis','scars','landslide','');
-INSERT INTO t2 VALUES (1028,250503,34,'heaving','realest','Eiffel','');
-INSERT INTO t2 VALUES (1029,250504,34,'population','diffusing','absentee','');
-INSERT INTO t2 VALUES (1030,250505,34,'bomb','clubroom','aye','');
-INSERT INTO t2 VALUES (1031,250601,34,'Majorca','Blythe','forked','A');
-INSERT INTO t2 VALUES (1032,250602,34,'Gershwins','ahead','Peruvianizes','');
-INSERT INTO t2 VALUES (1033,250603,34,'explorers','reviver','clerked','');
-INSERT INTO t2 VALUES (1034,250604,34,'libretto','retransmitting','tutor','');
-INSERT INTO t2 VALUES (1035,250605,34,'occurred','landslide','boulevard','');
-INSERT INTO t2 VALUES (1036,251001,34,'Lagos','Eiffel','shuttered','');
-INSERT INTO t2 VALUES (1037,251002,34,'rats','absentee','quotes','A');
-INSERT INTO t2 VALUES (1038,251003,34,'bankruptcies','aye','Caltech','');
-INSERT INTO t2 VALUES (1039,251004,34,'crying','forked','Mossberg','');
-INSERT INTO t2 VALUES (1040,251005,34,'unexpected','Peruvianizes','kept','');
-INSERT INTO t2 VALUES (1041,251301,34,'accessed','clerked','roundly','');
-INSERT INTO t2 VALUES (1042,251302,34,'colorful','tutor','features','A');
-INSERT INTO t2 VALUES (1043,251303,34,'versatility','boulevard','imaginable','A');
-INSERT INTO t2 VALUES (1044,251304,34,'cosy','shuttered','controller','');
-INSERT INTO t2 VALUES (1045,251305,34,'Darius','quotes','racial','');
-INSERT INTO t2 VALUES (1046,251401,34,'mastering','Caltech','uprisings','A');
-INSERT INTO t2 VALUES (1047,251402,34,'Asiaticizations','Mossberg','narrowed','A');
-INSERT INTO t2 VALUES (1048,251403,34,'offerers','kept','cannot','A');
-INSERT INTO t2 VALUES (1049,251404,34,'uncles','roundly','vest','');
-INSERT INTO t2 VALUES (1050,251405,34,'sleepwalk','features','famine','');
-INSERT INTO t2 VALUES (1051,251406,34,'Ernestine','imaginable','sugars','');
-INSERT INTO t2 VALUES (1052,251801,34,'checksumming','controller','exterminated','A');
-INSERT INTO t2 VALUES (1053,251802,34,'stopped','racial','belays','');
-INSERT INTO t2 VALUES (1054,252101,34,'sicker','uprisings','Hodges','A');
-INSERT INTO t2 VALUES (1055,252102,34,'Italianization','narrowed','translatable','');
-INSERT INTO t2 VALUES (1056,252301,34,'alphabetic','cannot','duality','A');
-INSERT INTO t2 VALUES (1057,252302,34,'pharmaceutic','vest','recording','A');
-INSERT INTO t2 VALUES (1058,252303,34,'creator','famine','rouses','A');
-INSERT INTO t2 VALUES (1059,252304,34,'chess','sugars','poison','');
-INSERT INTO t2 VALUES (1060,252305,34,'charcoal','exterminated','attitude','');
-INSERT INTO t2 VALUES (1061,252306,34,'Epiphany','belays','dusted','');
-INSERT INTO t2 VALUES (1062,252307,34,'bulldozes','Hodges','encompasses','');
-INSERT INTO t2 VALUES (1063,252308,34,'Pygmalion','translatable','presentation','');
-INSERT INTO t2 VALUES (1064,252309,34,'caressing','duality','Kantian','');
-INSERT INTO t2 VALUES (1065,256001,34,'Palestine','recording','imprecision','A');
-INSERT INTO t2 VALUES (1066,256002,34,'regimented','rouses','saving','');
-INSERT INTO t2 VALUES (1067,256003,34,'scars','poison','maternal','');
-INSERT INTO t2 VALUES (1068,256004,34,'realest','attitude','hewed','');
-INSERT INTO t2 VALUES (1069,256005,34,'diffusing','dusted','kerosene','');
-INSERT INTO t2 VALUES (1070,258001,34,'clubroom','encompasses','Cubans','');
-INSERT INTO t2 VALUES (1071,258002,34,'Blythe','presentation','photographers','');
-INSERT INTO t2 VALUES (1072,258003,34,'ahead','Kantian','nymph','A');
-INSERT INTO t2 VALUES (1073,258004,34,'reviver','imprecision','bedlam','A');
-INSERT INTO t2 VALUES (1074,258005,34,'retransmitting','saving','north','A');
-INSERT INTO t2 VALUES (1075,258006,34,'landslide','maternal','Schoenberg','A');
-INSERT INTO t2 VALUES (1076,258007,34,'Eiffel','hewed','botany','A');
-INSERT INTO t2 VALUES (1077,258008,34,'absentee','kerosene','curs','');
-INSERT INTO t2 VALUES (1078,258009,34,'aye','Cubans','solidification','');
-INSERT INTO t2 VALUES (1079,258010,34,'forked','photographers','inheritresses','');
-INSERT INTO t2 VALUES (1080,258011,34,'Peruvianizes','nymph','stiller','');
-INSERT INTO t2 VALUES (1081,258101,68,'clerked','bedlam','t1','A');
-INSERT INTO t2 VALUES (1082,258102,68,'tutor','north','suite','A');
-INSERT INTO t2 VALUES (1083,258103,34,'boulevard','Schoenberg','ransomer','');
-INSERT INTO t2 VALUES (1084,258104,68,'shuttered','botany','Willy','');
-INSERT INTO t2 VALUES (1085,258105,68,'quotes','curs','Rena','A');
-INSERT INTO t2 VALUES (1086,258106,68,'Caltech','solidification','Seattle','A');
-INSERT INTO t2 VALUES (1087,258107,68,'Mossberg','inheritresses','relaxes','A');
-INSERT INTO t2 VALUES (1088,258108,68,'kept','stiller','exclaim','');
-INSERT INTO t2 VALUES (1089,258109,68,'roundly','t1','implicated','A');
-INSERT INTO t2 VALUES (1090,258110,68,'features','suite','distinguish','');
-INSERT INTO t2 VALUES (1091,258111,68,'imaginable','ransomer','assayed','');
-INSERT INTO t2 VALUES (1092,258112,68,'controller','Willy','homeowner','');
-INSERT INTO t2 VALUES (1093,258113,68,'racial','Rena','and','');
-INSERT INTO t2 VALUES (1094,258201,34,'uprisings','Seattle','stealth','');
-INSERT INTO t2 VALUES (1095,258202,34,'narrowed','relaxes','coinciding','A');
-INSERT INTO t2 VALUES (1096,258203,34,'cannot','exclaim','founder','A');
-INSERT INTO t2 VALUES (1097,258204,34,'vest','implicated','environing','');
-INSERT INTO t2 VALUES (1098,258205,34,'famine','distinguish','jewelry','');
-INSERT INTO t2 VALUES (1099,258301,34,'sugars','assayed','lemons','A');
-INSERT INTO t2 VALUES (1100,258401,34,'exterminated','homeowner','brokenness','A');
-INSERT INTO t2 VALUES (1101,258402,34,'belays','and','bedpost','A');
-INSERT INTO t2 VALUES (1102,258403,34,'Hodges','stealth','assurers','A');
-INSERT INTO t2 VALUES (1103,258404,34,'translatable','coinciding','annoyers','');
-INSERT INTO t2 VALUES (1104,258405,34,'duality','founder','affixed','');
-INSERT INTO t2 VALUES (1105,258406,34,'recording','environing','warbling','');
-INSERT INTO t2 VALUES (1106,258407,34,'rouses','jewelry','seriously','');
-INSERT INTO t2 VALUES (1107,228123,37,'poison','lemons','boasted','');
-INSERT INTO t2 VALUES (1108,250606,34,'attitude','brokenness','Chantilly','');
-INSERT INTO t2 VALUES (1109,208405,37,'dusted','bedpost','Iranizes','');
-INSERT INTO t2 VALUES (1110,212101,37,'encompasses','assurers','violinist','');
-INSERT INTO t2 VALUES (1111,218206,37,'presentation','annoyers','extramarital','');
-INSERT INTO t2 VALUES (1112,150401,37,'Kantian','affixed','spates','');
-INSERT INTO t2 VALUES (1113,248212,41,'imprecision','warbling','cloakroom','');
-INSERT INTO t2 VALUES (1114,128026,00,'saving','seriously','gazer','');
-INSERT INTO t2 VALUES (1115,128024,00,'maternal','boasted','hand','');
-INSERT INTO t2 VALUES (1116,128027,00,'hewed','Chantilly','tucked','');
-INSERT INTO t2 VALUES (1117,128025,00,'kerosene','Iranizes','gems','');
-INSERT INTO t2 VALUES (1118,128109,00,'Cubans','violinist','clinker','');
-INSERT INTO t2 VALUES (1119,128705,00,'photographers','extramarital','refiner','');
-INSERT INTO t2 VALUES (1120,126303,00,'nymph','spates','callus','');
-INSERT INTO t2 VALUES (1121,128308,00,'bedlam','cloakroom','leopards','');
-INSERT INTO t2 VALUES (1122,128204,00,'north','gazer','comfortingly','');
-INSERT INTO t2 VALUES (1123,128205,00,'Schoenberg','hand','generically','');
-INSERT INTO t2 VALUES (1124,128206,00,'botany','tucked','getters','');
-INSERT INTO t2 VALUES (1125,128207,00,'curs','gems','sexually','');
-INSERT INTO t2 VALUES (1126,118205,00,'solidification','clinker','spear','');
-INSERT INTO t2 VALUES (1127,116801,00,'inheritresses','refiner','serums','');
-INSERT INTO t2 VALUES (1128,116803,00,'stiller','callus','Italianization','');
-INSERT INTO t2 VALUES (1129,116804,00,'t1','leopards','attendants','');
-INSERT INTO t2 VALUES (1130,116802,00,'suite','comfortingly','spies','');
-INSERT INTO t2 VALUES (1131,128605,00,'ransomer','generically','Anthony','');
-INSERT INTO t2 VALUES (1132,118308,00,'Willy','getters','planar','');
-INSERT INTO t2 VALUES (1133,113702,00,'Rena','sexually','cupped','');
-INSERT INTO t2 VALUES (1134,113703,00,'Seattle','spear','cleanser','');
-INSERT INTO t2 VALUES (1135,112103,00,'relaxes','serums','commuters','');
-INSERT INTO t2 VALUES (1136,118009,00,'exclaim','Italianization','honeysuckle','');
-INSERT INTO t2 VALUES (5136,1118009,00,'exclaim','Italianization','honeysuckle','');
-INSERT INTO t2 VALUES (1137,138011,00,'implicated','attendants','orphanage','');
-INSERT INTO t2 VALUES (1138,138010,00,'distinguish','spies','skies','');
-INSERT INTO t2 VALUES (1139,138012,00,'assayed','Anthony','crushers','');
-INSERT INTO t2 VALUES (1140,068304,00,'homeowner','planar','Puritan','');
-INSERT INTO t2 VALUES (1141,078009,00,'and','cupped','squeezer','');
-INSERT INTO t2 VALUES (1142,108013,00,'stealth','cleanser','bruises','');
-INSERT INTO t2 VALUES (1143,084004,00,'coinciding','commuters','bonfire','');
-INSERT INTO t2 VALUES (1144,083402,00,'founder','honeysuckle','Colombo','');
-INSERT INTO t2 VALUES (1145,084003,00,'environing','orphanage','nondecreasing','');
-INSERT INTO t2 VALUES (1146,088504,00,'jewelry','skies','innocents','');
-INSERT INTO t2 VALUES (1147,088005,00,'lemons','crushers','masked','');
-INSERT INTO t2 VALUES (1148,088007,00,'brokenness','Puritan','file','');
-INSERT INTO t2 VALUES (1149,088006,00,'bedpost','squeezer','brush','');
-INSERT INTO t2 VALUES (1150,148025,00,'assurers','bruises','mutilate','');
-INSERT INTO t2 VALUES (1151,148024,00,'annoyers','bonfire','mommy','');
-INSERT INTO t2 VALUES (1152,138305,00,'affixed','Colombo','bulkheads','');
-INSERT INTO t2 VALUES (1153,138306,00,'warbling','nondecreasing','undeclared','');
-INSERT INTO t2 VALUES (1154,152701,00,'seriously','innocents','displacements','');
-INSERT INTO t2 VALUES (1155,148505,00,'boasted','masked','nieces','');
-INSERT INTO t2 VALUES (1156,158003,00,'Chantilly','file','coeducation','');
-INSERT INTO t2 VALUES (1157,156201,00,'Iranizes','brush','brassy','');
-INSERT INTO t2 VALUES (1158,156202,00,'violinist','mutilate','authenticator','');
-INSERT INTO t2 VALUES (1159,158307,00,'extramarital','mommy','Washoe','');
-INSERT INTO t2 VALUES (1160,158402,00,'spates','bulkheads','penny','');
-INSERT INTO t2 VALUES (1161,158401,00,'cloakroom','undeclared','Flagler','');
-INSERT INTO t2 VALUES (1162,068013,00,'gazer','displacements','stoned','');
-INSERT INTO t2 VALUES (1163,068012,00,'hand','nieces','cranes','');
-INSERT INTO t2 VALUES (1164,068203,00,'tucked','coeducation','masterful','');
-INSERT INTO t2 VALUES (1165,088205,00,'gems','brassy','biracial','');
-INSERT INTO t2 VALUES (1166,068704,00,'clinker','authenticator','steamships','');
-INSERT INTO t2 VALUES (1167,068604,00,'refiner','Washoe','windmills','');
-INSERT INTO t2 VALUES (1168,158502,00,'callus','penny','exploit','');
-INSERT INTO t2 VALUES (1169,123103,00,'leopards','Flagler','riverfront','');
-INSERT INTO t2 VALUES (1170,148026,00,'comfortingly','stoned','sisterly','');
-INSERT INTO t2 VALUES (1171,123302,00,'generically','cranes','sharpshoot','');
-INSERT INTO t2 VALUES (1172,076503,00,'getters','masterful','mittens','');
-INSERT INTO t2 VALUES (1173,126304,00,'sexually','biracial','interdependency','');
-INSERT INTO t2 VALUES (1174,068306,00,'spear','steamships','policy','');
-INSERT INTO t2 VALUES (1175,143504,00,'serums','windmills','unleashing','');
-INSERT INTO t2 VALUES (1176,160201,00,'Italianization','exploit','pretenders','');
-INSERT INTO t2 VALUES (1177,148028,00,'attendants','riverfront','overstatements','');
-INSERT INTO t2 VALUES (1178,148027,00,'spies','sisterly','birthed','');
-INSERT INTO t2 VALUES (1179,143505,00,'Anthony','sharpshoot','opportunism','');
-INSERT INTO t2 VALUES (1180,108014,00,'planar','mittens','showroom','');
-INSERT INTO t2 VALUES (1181,076104,00,'cupped','interdependency','compromisingly','');
-INSERT INTO t2 VALUES (1182,078106,00,'cleanser','policy','Medicare','');
-INSERT INTO t2 VALUES (1183,126102,00,'commuters','unleashing','corresponds','');
-INSERT INTO t2 VALUES (1184,128029,00,'honeysuckle','pretenders','hardware','');
-INSERT INTO t2 VALUES (1185,128028,00,'orphanage','overstatements','implant','');
-INSERT INTO t2 VALUES (1186,018410,00,'skies','birthed','Alicia','');
-INSERT INTO t2 VALUES (1187,128110,00,'crushers','opportunism','requesting','');
-INSERT INTO t2 VALUES (1188,148506,00,'Puritan','showroom','produced','');
-INSERT INTO t2 VALUES (1189,123303,00,'squeezer','compromisingly','criticizes','');
-INSERT INTO t2 VALUES (1190,123304,00,'bruises','Medicare','backer','');
-INSERT INTO t2 VALUES (1191,068504,00,'bonfire','corresponds','positively','');
-INSERT INTO t2 VALUES (1192,068305,00,'Colombo','hardware','colicky','');
-INSERT INTO t2 VALUES (1193,000000,00,'nondecreasing','implant','thrillingly','');
---enable_query_log
-
-#
-# Search with a key
-#
-
-select t2.fld3 from t2 where companynr = 58 and fld3 like "%imaginable%";
-select fld3 from t2 where fld3 like "%cultivation" ;
-
-#
-# Search with a key using sorting and limit the same time
-#
-
-select t2.fld3,companynr from t2 where companynr = 57+1 order by fld3;
-select fld3,companynr from t2 where companynr = 58 order by fld3;
-
-select fld3 from t2 order by fld3 desc limit 10;
-select fld3 from t2 order by fld3 desc limit 5;
-select fld3 from t2 order by fld3 desc limit 5,5;
-
-#
-# Search with a key having a constant with each unique key.
-# The table is read directly with read-next on fld3
-#
-
-select t2.fld3 from t2 where fld3 = 'honeysuckle';
-select t2.fld3 from t2 where fld3 LIKE 'honeysuckl_';
-select t2.fld3 from t2 where fld3 LIKE 'hon_ysuckl_';
-select t2.fld3 from t2 where fld3 LIKE 'honeysuckle%';
-select t2.fld3 from t2 where fld3 LIKE 'h%le';
-
-select t2.fld3 from t2 where fld3 LIKE 'honeysuckle_';
-select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%';
-
-#
-# Test using INDEX and IGNORE INDEX
-#
-
-explain select t2.fld3 from t2 where fld3 = 'honeysuckle';
-
-explain select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle';
-explain select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle';
-
-explain select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle';
-explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle';
-
-#
-# NOTE NOTE NOTE
-# The next should give an error
-#
-
--- error 1176
-explain select fld3 from t2 ignore index (fld3,not_used);
--- error 1176
-explain select fld3 from t2 use index (not_used);
-
-#
-# Test sorting with a used key (there is no need for sorting)
-#
-
-select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
-explain select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
-select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3;
-
-#
-# Search with a key having a constant with many occurrences
-# The table is read directly with read-next having fld3 to get the
-# occurrences
-#
-
-select fld1,fld3 from t2 where companynr = 37 and fld3 = 'appendixes';
-
-#
-# Search with bunched 'or's.
-# If one can limit the key to a certain interval only the possible
-# alternatives will be gone through
-#
-
-select fld1 from t2 where fld1=250501 or fld1="250502";
-explain select fld1 from t2 where fld1=250501 or fld1="250502";
-select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502;
-explain select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502;
-
-#
-# Search with a key with LIKE constant
-# If the like starts with a certain letter key will be used.
-#
-
---sorted_result
-select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%';
-select fld3 from t2 where fld3 like "L%" and fld3 = "ok";
-select fld3 from t2 where (fld3 like "C%" and fld3 = "Chantilly");
-select fld1,fld3 from t2 where fld1 like "25050%";
-select fld1,fld3 from t2 where fld1 like "25050_";
-
-#
-# Search using distinct. An automatic grouping will be done over all the fields,
-# if only distinct is used. In any other case a temporary table will always
-# be created. If only the field used for sorting is from the main register,
-# it will be sorted first before the distinct table is created.
-#
-
-select distinct companynr from t2;
-select distinct companynr from t2 order by companynr;
-select distinct companynr from t2 order by companynr desc;
-select distinct t2.fld3,period from t2,t1 where companynr=37 and fld3 like "O%";
-
-select distinct fld3 from t2 where companynr = 34 order by fld3;
-select distinct fld3 from t2 limit 10;
-select distinct fld3 from t2 having fld3 like "A%" limit 10;
-select distinct substring(fld3,1,3) from t2 where fld3 like "A%";
-select distinct substring(fld3,1,3) as a from t2 having a like "A%" order by a limit 10;
-select distinct substring(fld3,1,3) from t2 where fld3 like "A%" limit 10;
-select distinct substring(fld3,1,3) as a from t2 having a like "A%" limit 10;
-
-# make a big table.
-
-create table t3 (
- period int not null,
- name char(32) not null,
- companynr int not null,
- price double(11,0),
- price2 double(11,0),
- key (period),
- key (name)
-);
-
---disable_query_log
-INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1001,"Iranizes",37,5987435,234724);
-INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1002,"violinist",37,28357832,8723648);
-INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1003,"extramarital",37,39654943,235872);
-INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1004,"spates",78,726498,72987523);
-INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1005,"cloakroom",78,98439034,823742);
-INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1006,"gazer",101,834598,27348324);
-INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1007,"hand",154,983543950,29837423);
-INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1008,"tucked",311,234298,3275892);
-INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1009,"gems",447,2374834,9872392);
-INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1010,"clinker",512,786542,76234234);
---enable_query_log
-
-create temporary table tmp engine = myisam select * from t3;
-
-insert into t3 select * from tmp;
-insert into tmp select * from t3;
-insert into t3 select * from tmp;
-insert into tmp select * from t3;
-insert into t3 select * from tmp;
-insert into tmp select * from t3;
-insert into t3 select * from tmp;
-insert into tmp select * from t3;
-insert into t3 select * from tmp;
-insert into tmp select * from t3;
-insert into t3 select * from tmp;
-insert into tmp select * from t3;
-insert into t3 select * from tmp;
-insert into tmp select * from t3;
-insert into t3 select * from tmp;
-insert into tmp select * from t3;
-insert into t3 select * from tmp;
-#insert into tmp select * from t3;
-#insert into t3 select * from tmp;
-
-alter table t3 add t2nr int not null auto_increment primary key first;
-
-drop table tmp;
-
-# big table done
-
-SET BIG_TABLES=1;
-select distinct concat(fld3," ",fld3) as namn from t2,t3 where t2.fld1=t3.t2nr order by namn limit 10;
-SET BIG_TABLES=0;
-select distinct concat(fld3," ",fld3) from t2,t3 where t2.fld1=t3.t2nr order by fld3 limit 10;
-select distinct fld5 from t2 limit 10;
-
-#
-# Force use of remove_dupp
-#
-
-select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
-SET BIG_TABLES=1; # Force use of MyISAM
-select distinct fld3,count(*) from t2 group by companynr,fld3 limit 10;
-SET BIG_TABLES=0;
-select distinct fld3,repeat("a",length(fld3)),count(*) from t2 group by companynr,fld3 limit 100,10;
-
-#
-# A big order by that should trigger a merge in filesort
-#
-
-select distinct companynr,rtrim(space(512+companynr)) from t3 order by 1,2;
-
-#
-# Search with distinct and order by with many table.
-#
-
-select distinct fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by fld3;
-
-#
-# Here the last fld3 is optimized away from the order by
-#
-
-explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by t3.t2nr,fld3;
-
-#
-# Some test with ORDER BY and limit
-#
-
-explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
-explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
-explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
-
-#
-# Search with a constant table.
-#
-
-select period from t1;
-select period from t1 where period=1900;
-select fld3,period from t1,t2 where fld1 = 011401 order by period;
-
-#
-# Search with a constant table and several keyparts. (Rows are read only once
-# in the beginning of the search)
-#
-
-select fld3,period from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3.period=1001;
-
-explain select fld3,period from t2,t3 where t2.fld1 = 011401 and t3.t2nr=t2.fld1 and 1001 = t3.period;
-
-#
-# Search with a constant table and several rows from another table
-#
-
-select fld3,period from t2,t1 where companynr*10 = 37*10;
-
-#
-# Search with a table reference and without a key.
-# t3 will be the main table.
-#
-
-select fld3,period,price,price2 from t2,t3 where t2.fld1=t3.t2nr and period >= 1001 and period <= 1002 and t2.companynr = 37 order by fld3,period, price;
-
-#
-# Search with an interval on a table with full key on reference table.
-# Here t2 will be the main table and only records matching the
-# t2nr will be checked.
-#
-
-select t2.fld1,fld3,period,price,price2 from t2,t3 where t2.fld1>= 18201 and t2.fld1 <= 18811 and t2.fld1=t3.t2nr and period = 1001 and t2.companynr = 37;
-
-#
-# We need another table for join stuff..
-#
-
-create table t4 (
- companynr tinyint(2) unsigned zerofill NOT NULL default '00',
- companyname char(30) NOT NULL default '',
- PRIMARY KEY (companynr),
- UNIQUE KEY companyname(companyname)
-) ENGINE=MyISAM MAX_ROWS=50 PACK_KEYS=1 COMMENT='companynames';
-
---disable_query_log
-INSERT INTO t4 (companynr, companyname) VALUES (29,'company 1');
-INSERT INTO t4 (companynr, companyname) VALUES (34,'company 2');
-INSERT INTO t4 (companynr, companyname) VALUES (36,'company 3');
-INSERT INTO t4 (companynr, companyname) VALUES (37,'company 4');
-INSERT INTO t4 (companynr, companyname) VALUES (40,'company 5');
-INSERT INTO t4 (companynr, companyname) VALUES (41,'company 6');
-INSERT INTO t4 (companynr, companyname) VALUES (53,'company 7');
-INSERT INTO t4 (companynr, companyname) VALUES (58,'company 8');
-INSERT INTO t4 (companynr, companyname) VALUES (65,'company 9');
-INSERT INTO t4 (companynr, companyname) VALUES (68,'company 10');
-INSERT INTO t4 (companynr, companyname) VALUES (50,'company 11');
-INSERT INTO t4 (companynr, companyname) VALUES (00,'Unknown');
---enable_query_log
-
-#
-# Test of stright join to force a full join.
-#
-
-select STRAIGHT_JOIN t2.companynr,companyname from t4,t2 where t2.companynr=t4.companynr group by t2.companynr;
-
-select SQL_SMALL_RESULT t2.companynr,companyname from t4,t2 where t2.companynr=t4.companynr group by t2.companynr;
-
-#
-# Full join (same alias)
-#
-
-select * from t1,t1 t12;
-select t2.fld1,t22.fld1 from t2,t2 t22 where t2.fld1 >= 250501 and t2.fld1 <= 250505 and t22.fld1 >= 250501 and t22.fld1 <= 250505;
-
-#
-# Test of left join.
-#
-insert into t2 (fld1, companynr) values (999999,99);
-
-select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null;
-select count(*) from t2 left join t4 using (companynr) where t4.companynr is not null;
-explain select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null;
-explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr is null;
-
-select companynr,companyname from t2 left join t4 using (companynr) where companynr is null;
-select count(*) from t2 left join t4 using (companynr) where companynr is not null;
-explain select companynr,companyname from t2 left join t4 using (companynr) where companynr is null;
-explain select companynr,companyname from t4 left join t2 using (companynr) where companynr is null;
-delete from t2 where fld1=999999;
-
-#
-# Test left join optimization
-
-explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0;
-explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0;
-explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 and t4.companynr > 0;
-
-explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0;
-explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0;
-explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 and companynr > 0;
-# Following can't be optimized
-explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null;
-explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0 or t4.companynr > 0;
-explain select t2.companynr,companyname from t4 left join t2 using (companynr) where ifnull(t2.companynr,1)>0;
-
-explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr is null;
-explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0 or companynr > 0;
-explain select companynr,companyname from t4 left join t2 using (companynr) where ifnull(companynr,1)>0;
-
-#
-# Joins with forms.
-#
-
-select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
-explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
-
-#
-# Search using 'or' with the same referens group.
-# An interval search will be done first with the first table and after that
-# the other table is referenced with a key with a 'test if key in use' for
-# each record
-#
-
-select t2.fld1,t2.companynr,fld3,period from t3,t2 where t2.fld1 = 38208 and t2.fld1=t3.t2nr and period = 1008 or t2.fld1 = 38008 and t2.fld1 =t3.t2nr and period = 1008;
-
-select t2.fld1,t2.companynr,fld3,period from t3,t2 where (t2.fld1 = 38208 or t2.fld1 = 38008) and t2.fld1=t3.t2nr and period>=1008 and period<=1009;
-
-select t2.fld1,t2.companynr,fld3,period from t3,t2 where (t3.t2nr = 38208 or t3.t2nr = 38008) and t2.fld1=t3.t2nr and period>=1008 and period<=1009;
-
-#
-# Test of many parenthesis levels
-#
-
-select period from t1 where (((period > 0) or period < 10000 or (period = 1900)) and (period=1900 and period <= 1901) or (period=1903 and (period=1903)) and period>=1902) or ((period=1904 or period=1905) or (period=1906 or period>1907)) or (period=1908 and period = 1909);
-select period from t1 where ((period > 0 and period < 1) or (((period > 0 and period < 100) and (period > 10)) or (period > 10)) or (period > 0 and (period > 5 or period > 6)));
-
-select a.fld1 from t2 as a,t2 b where ((a.fld1 = 250501 and a.fld1=b.fld1) or a.fld1=250502 or a.fld1=250503 or (a.fld1=250505 and a.fld1<=b.fld1 and b.fld1>=a.fld1)) and a.fld1=b.fld1;
-
-select fld1 from t2 where fld1 in (250502,98005,98006,250503,250605,250606) and fld1 >=250502 and fld1 not in (250605,250606);
-
-select fld1 from t2 where fld1 between 250502 and 250504;
-
-select fld3 from t2 where (((fld3 like "_%L%" ) or (fld3 like "%ok%")) and ( fld3 like "L%" or fld3 like "G%")) and fld3 like "L%" ;
-
-#
-# Group on one table.
-# optimizer: sort table by group and send rows.
-#
-
-select count(*) from t1;
-select companynr,count(*),sum(fld1) from t2 group by companynr;
-select companynr,count(*) from t2 group by companynr order by companynr desc limit 5;
-select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 where companynr = 34 and fld4<>"";
-explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 where companynr = 34 and fld4<>"";
-select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3;
-select companynr,t2nr,count(price),sum(price),min(price),max(price),avg(price) from t3 where companynr = 37 group by companynr,t2nr limit 10;
-select /*! SQL_SMALL_RESULT */ companynr,t2nr,count(price),sum(price),min(price),max(price),avg(price) from t3 where companynr = 37 group by companynr,t2nr limit 10;
-select companynr,count(price),sum(price),min(price),max(price),avg(price) from t3 group by companynr ;
-select distinct mod(companynr,10) from t4 group by companynr;
-select distinct 1 from t4 group by companynr;
-select count(distinct fld1) from t2;
-select companynr,count(distinct fld1) from t2 group by companynr;
-select companynr,count(*) from t2 group by companynr;
-select companynr,count(distinct concat(fld1,repeat(65,1000))) from t2 group by companynr;
-select companynr,count(distinct concat(fld1,repeat(65,200))) from t2 group by companynr;
-select companynr,count(distinct floor(fld1/100)) from t2 group by companynr;
-select companynr,count(distinct concat(repeat(65,1000),floor(fld1/100))) from t2 group by companynr;
-
-#
-# group with where on a key field
-#
-
-select sum(fld1),fld3 from t2 where fld3="Romans" group by fld1 limit 10;
-select name,count(*) from t3 where name='cloakroom' group by name;
-select name,count(*) from t3 where name='cloakroom' and price>10 group by name;
-select count(*) from t3 where name='cloakroom' and price2=823742;
-select name,count(*) from t3 where name='cloakroom' and price2=823742 group by name;
-select name,count(*) from t3 where name >= "extramarital" and price <= 39654943 group by name;
-select t2.fld3,count(*) from t2,t3 where t2.fld1=158402 and t3.name=t2.fld3 group by t3.name;
-
-#
-# Group with extra not group fields.
-#
-
-select companynr|0,companyname from t4 group by 1;
-select t2.companynr,companyname,count(*) from t2,t4 where t2.companynr=t4.companynr group by t2.companynr order by companyname;
-select t2.fld1,count(*) from t2,t3 where t2.fld1=158402 and t3.name=t2.fld3 group by t3.name;
-
-#
-# Calculation with group functions
-#
-
-select sum(Period)/count(*) from t1;
-select companynr,count(price) as "count",sum(price) as "sum" ,abs(sum(price)/count(price)-avg(price)) as "diff",(0+count(price))*companynr as func from t3 group by companynr;
-select companynr,sum(price)/count(price) as avg from t3 group by companynr having avg > 70000000 order by avg;
-
-#
-# Group with order on not first table
-# optimizer: sort table by group and write group records to tmp table.
-# sort tmp_table and send rows.
-#
-
-select companynr,count(*) from t2 group by companynr order by 2 desc;
-select companynr,count(*) from t2 where companynr > 40 group by companynr order by 2 desc;
-select t2.fld4,t2.fld1,count(price),sum(price),min(price),max(price),avg(price) from t3,t2 where t3.companynr = 37 and t2.fld1 = t3.t2nr group by fld1,t2.fld4;
-
-#
-# group by with many tables
-# optimizer: create tmp table with group-by uniq index.
-# write with update to tmp table.
-# sort tmp table according to order (or group if no order)
-# send rows
-#
-
-select t3.companynr,fld3,sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = 512 group by companynr,fld3;
-select t2.companynr,count(*),min(fld3),max(fld3),sum(price),avg(price) from t2,t3 where t3.companynr >= 30 and t3.companynr <= 58 and t3.t2nr = t2.fld1 and 1+1=2 group by t2.companynr;
-
-#
-# group with many tables and long group on many tables. group on formula
-# optimizer: create tmp table with neaded fields
-# sort tmp table by group and calculate sums to new table
-# if different order by than group, sort tmp table
-# send rows
-#
-
-select t3.companynr+0,t3.t2nr,fld3,sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = 37 group by 1,t3.t2nr,fld3,fld3,fld3,fld3,fld3 order by fld1;
-
-#
-# WHERE const folding
-# optimize: If there is a "field = const" part in the where, change all
-# instances of field in the and level to const.
-# All instances of const = const are checked once and removed.
-#
-
-#
-# Where -> t3.t2nr = 98005 and t2.fld1 = 98005
-#
-
-select sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = 512 and t3.t2nr = 38008 and t2.fld1 = 38008 or t2.fld1= t3.t2nr and t3.t2nr = 38008 and t2.fld1 = 38008;
-
-select t2.fld1,sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = 512 and t3.t2nr = 38008 and t2.fld1 = 38008 or t2.fld1 = t3.t2nr and t3.t2nr = 38008 and t2.fld1 = 38008 or t3.t2nr = t2.fld1 and t2.fld1 = 38008 group by t2.fld1;
-
-explain select fld3 from t2 where 1>2 or 2>3;
-explain select fld3 from t2 where fld1=fld1;
-
-#
-# HAVING
-#
-
-select companynr,fld1 from t2 HAVING fld1=250501 or fld1=250502;
-select companynr,fld1 from t2 WHERE fld1>=250501 HAVING fld1<=250502;
-select companynr,count(*) as count,sum(fld1) as sum from t2 group by companynr having count > 40 and sum/count >= 120000;
-select companynr from t2 group by companynr having count(*) > 40 and sum(fld1)/count(*) >= 120000 ;
-select t2.companynr,companyname,count(*) from t2,t4 where t2.companynr=t4.companynr group by companyname having t2.companynr >= 40;
-
-#
-# MIN(), MAX() and COUNT() optimizing
-#
-
-select count(*) from t2;
-select count(*) from t2 where fld1 < 098024;
-# PS does correct pre-zero here. MySQL can't do it as it returns a number.
---disable_ps_protocol
-select min(fld1) from t2 where fld1>= 098024;
---enable_ps_protocol
-select max(fld1) from t2 where fld1>= 098024;
-select count(*) from t3 where price2=76234234;
-select count(*) from t3 where companynr=512 and price2=76234234;
-explain select min(fld1),max(fld1),count(*) from t2;
-# PS does correct pre-zero here. MySQL can't do it as it returns a number.
---disable_ps_protocol
-select min(fld1),max(fld1),count(*) from t2;
---enable_ps_protocol
-select min(t2nr),max(t2nr) from t3 where t2nr=2115 and price2=823742;
-select count(*),min(t2nr),max(t2nr) from t3 where name='spates' and companynr=78;
-select t2nr,count(*) from t3 where name='gems' group by t2nr limit 20;
-select max(t2nr) from t3 where price=983543950;
-
-#
-# Test of alias
-#
-
-select t1.period from t3 = t1 limit 1;
-select t1.period from t1 as t1 limit 1;
-select t1.period as "Nuvarande period" from t1 as t1 limit 1;
-select period as ok_period from t1 limit 1;
-select period as ok_period from t1 group by ok_period limit 1;
-select 1+1 as summa from t1 group by summa limit 1;
-select period as "Nuvarande period" from t1 group by "Nuvarande period" limit 1;
-
-#
-# Some simple show commands
-#
-
-show tables;
-show tables from test like "s%";
-show tables from test like "t?";
-# We mask out the Privileges column because it differs with embedded server
---replace_column 8 #
-show full columns from t2;
---replace_column 8 #
-show full columns from t2 from test like 'f%';
---replace_column 8 #
-show full columns from t2 from test like 's%';
-show keys from t2;
-
-drop table t4, t3, t2, t1;
-
-#
-# Test of DO
-#
-
-DO 1;
-DO benchmark(100,1+1),1,1;
-
-#
-# Bug #6449: do default;
-#
-
---error ER_PARSE_ERROR
-do default;
---error ER_BAD_FIELD_ERROR
-do foobar;
-
-#
-# random in WHERE clause
-#
-
-CREATE TABLE t1 (
- id mediumint(8) unsigned NOT NULL auto_increment,
- pseudo varchar(35) NOT NULL default '',
- PRIMARY KEY (id),
- UNIQUE KEY pseudo (pseudo)
-);
-INSERT INTO t1 (pseudo) VALUES ('test');
-INSERT INTO t1 (pseudo) VALUES ('test1');
-SELECT 1 as rnd1 from t1 where rand() > 2;
-DROP TABLE t1;
-
-#
-# Test of bug with SUM(CASE...)
-#
-
-CREATE TABLE t1 (gvid int(10) unsigned default NULL, hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, mmid int(10) unsigned default NULL, hdid int(10) unsigned default NULL, fsid int(10) unsigned default NULL, ctid int(10) unsigned default NULL, dtid int(10) unsigned default NULL, cost int(10) unsigned default NULL, performance int(10) unsigned default NULL, serialnumber bigint(20) unsigned default NULL, monitored tinyint(3) unsigned default '1', removed tinyint(3) unsigned default '0', target tinyint(3) unsigned default '0', dt_modified timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, name varchar(255) binary default NULL, description varchar(255) default NULL, UNIQUE KEY hmid (hmid,volid)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (200001,2,1,1,100,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\E$',''),(200002,2,2,1,101,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\C$',''),(200003,1,3,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,0,1,20020425060427,'c:',NULL);
-CREATE TABLE t2 ( hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, sampletid smallint(5) unsigned default NULL, sampletime datetime default NULL, samplevalue bigint(20) unsigned default NULL, KEY idx1 (hmid,volid,sampletid,sampletime)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12:00:01',35);
-# Disable PS becasue we get more warnings from PS than from normal execution
---disable_ps_protocol
-SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'wrong-date-value' AND b.sampletime < 'wrong-date-value' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
---enable_ps_protocol
-# Testing the same select with NULL's instead of invalid datetime values
-SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= NULL AND b.sampletime < NULL AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
-DROP TABLE t1,t2;
-
-#
-# Test of bigint comparision
-#
-
-create table t1 ( A_Id bigint(20) NOT NULL default '0', A_UpdateBy char(10) NOT NULL default '', A_UpdateDate bigint(20) NOT NULL default '0', A_UpdateSerial int(11) NOT NULL default '0', other_types bigint(20) NOT NULL default '0', wss_type bigint(20) NOT NULL default '0');
-INSERT INTO t1 VALUES (102935998719055004,'brade',1029359987,2,102935229116544068,102935229216544093);
-select wss_type from t1 where wss_type ='102935229216544106';
-select wss_type from t1 where wss_type ='102935229216544105';
-select wss_type from t1 where wss_type ='102935229216544104';
-select wss_type from t1 where wss_type ='102935229216544093';
-select wss_type from t1 where wss_type =102935229216544093;
-drop table t1;
-select 1+2,"aaaa",3.13*2.0 into @a,@b,@c;
-select @a;
-select @b;
-select @c;
-
-#
-# Test of removing redundant braces in the FROM part
-# (We test each construct with the braced join to the left and right;
-# the latter case used to cause a syntax errors.)
-#
-
-create table t1 (a int not null auto_increment primary key);
-insert into t1 values ();
-insert into t1 values ();
-insert into t1 values ();
-# ,
-select * from (t1 as t2 left join t1 as t3 using (a)), t1;
-select * from t1, (t1 as t2 left join t1 as t3 using (a));
-# stright_join
-select * from (t1 as t2 left join t1 as t3 using (a)) straight_join t1;
-select * from t1 straight_join (t1 as t2 left join t1 as t3 using (a));
-# inner join on
-select * from (t1 as t2 left join t1 as t3 using (a)) inner join t1 on t1.a>1;
-select * from t1 inner join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
-# inner join using
-select * from (t1 as t2 left join t1 as t3 using (a)) inner join t1 using ( a );
-select * from t1 inner join (t1 as t2 left join t1 as t3 using (a)) using ( a );
-# left [outer] join on
---sorted_result
-select * from (t1 as t2 left join t1 as t3 using (a)) left outer join t1 on t1.a>1;
---sorted_result
-select * from t1 left outer join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
-# left join using
-select * from (t1 as t2 left join t1 as t3 using (a)) left join t1 using ( a );
-select * from t1 left join (t1 as t2 left join t1 as t3 using (a)) using ( a );
-# natural left join
-select * from (t1 as t2 left join t1 as t3 using (a)) natural left join t1;
-select * from t1 natural left join (t1 as t2 left join t1 as t3 using (a));
-# right join on
---sorted_result
-select * from (t1 as t2 left join t1 as t3 using (a)) right join t1 on t1.a>1;
---sorted_result
-select * from t1 right join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
-# right [outer] joing using
-select * from (t1 as t2 left join t1 as t3 using (a)) right outer join t1 using ( a );
-select * from t1 right outer join (t1 as t2 left join t1 as t3 using (a)) using ( a );
-# natural right join
-select * from (t1 as t2 left join t1 as t3 using (a)) natural right join t1;
-select * from t1 natural right join (t1 as t2 left join t1 as t3 using (a));
-# natural join
-select * from t1 natural join (t1 as t2 left join t1 as t3 using (a));
-select * from (t1 as t2 left join t1 as t3 using (a)) natural join t1;
-drop table t1;
-
-CREATE TABLE t1 ( aa char(2), id int(11) NOT NULL auto_increment, t2_id int(11) NOT NULL default '0', PRIMARY KEY (id), KEY replace_id (t2_id)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ("1",8264,2506),("2",8299,2517),("3",8301,2518),("4",8302,2519),("5",8303,2520),("6",8304,2521),("7",8305,2522);
-CREATE TABLE t2 ( id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (2517), (2518), (2519), (2520), (2521), (2522);
-select * from t1, t2 WHERE t1.t2_id = t2.id and t1.t2_id > 0 order by t1.id LIMIT 0, 5;
-drop table t1,t2;
-
-#
-# outer join, impossible on condition, where, and usable key for range
-#
-create table t1 (id1 int NOT NULL);
-create table t2 (id2 int NOT NULL);
-create table t3 (id3 int NOT NULL);
-create table t4 (id4 int NOT NULL, id44 int NOT NULL, KEY (id4));
-
-insert into t1 values (1);
-insert into t1 values (2);
-insert into t2 values (1);
-insert into t4 values (1,1);
-
-explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
-left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
-select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3
-left join t4 on id3 = id4 where id2 = 1 or id4 = 1;
-
-drop table t1,t2,t3,t4;
-#
-# Bug #2298
-#
-
-create table t1(s varchar(10) not null);
-create table t2(s varchar(10) not null primary key);
-create table t3(s varchar(10) not null primary key);
-insert into t1 values ('one\t'), ('two\t');
-insert into t2 values ('one\r'), ('two\t');
-insert into t3 values ('one '), ('two\t');
-select * from t1 where s = 'one';
-select * from t2 where s = 'one';
-select * from t3 where s = 'one';
-select * from t1,t2 where t1.s = t2.s;
-select * from t2,t3 where t2.s = t3.s;
-drop table t1, t2, t3;
-
-#
-# Bug #3759
-# Both queries should produce identical plans and results.
-#
-create table t1 (a integer, b integer, index(a), index(b));
-create table t2 (c integer, d integer, index(c), index(d));
-insert into t1 values (1,2), (2,2), (3,2), (4,2);
-insert into t2 values (1,3), (2,3), (3,4), (4,4);
-explain select * from t1 left join t2 on a=c where d in (4);
-select * from t1 left join t2 on a=c where d in (4);
-explain select * from t1 left join t2 on a=c where d = 4;
-select * from t1 left join t2 on a=c where d = 4;
-drop table t1, t2;
-
-#
-# Covering index is mentioned in EXPLAIN output for const tables (bug #5333)
-#
-
-CREATE TABLE t1 (
- i int(11) NOT NULL default '0',
- c char(10) NOT NULL default '',
- PRIMARY KEY (i),
- UNIQUE KEY c (c)
-) ENGINE=MyISAM;
-
-INSERT INTO t1 VALUES (1,'a');
-INSERT INTO t1 VALUES (2,'b');
-INSERT INTO t1 VALUES (3,'c');
-
-EXPLAIN SELECT i FROM t1 WHERE i=1;
-
-DROP TABLE t1;
-
-#
-# Test case for bug 7520: a wrong cost of the index for a BLOB field
-#
-
-CREATE TABLE t1 ( a BLOB, INDEX (a(20)) );
-CREATE TABLE t2 ( a BLOB, INDEX (a(20)) );
-
-INSERT INTO t1 VALUES ('one'),('two'),('three'),('four'),('five');
-INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five');
-INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five');
-
-EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a;
-EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a;
-
-DROP TABLE t1, t2;
-
-#
-# Test case for bug 7098: substitution of a constant for a string field
-#
-
-CREATE TABLE t1 ( city char(30) );
-INSERT INTO t1 VALUES ('London');
-INSERT INTO t1 VALUES ('Paris');
-
-SELECT * FROM t1 WHERE city='London';
-SELECT * FROM t1 WHERE city='london';
-EXPLAIN SELECT * FROM t1 WHERE city='London' AND city='london';
-SELECT * FROM t1 WHERE city='London' AND city='london';
-EXPLAIN SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
-SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
-
-DROP TABLE t1;
-
-#
-# Bug#7425 inconsistent sort order on unsigned columns result of substraction
-#
-
-create table t1 (a int(11) unsigned, b int(11) unsigned);
-insert into t1 values (1,0), (1,1), (18446744073709551615,0);
-select a-b from t1 order by 1;
-select a-b , (a-b < 0) from t1 order by 1;
-select a-b as d, (a-b >= 0), b from t1 group by b having d >= 0;
-select cast((a - b) as unsigned) from t1 order by 1;
-drop table t1;
-
-
-#
-# Bug#8733 server accepts malformed query (multiply mentioned distinct)
-#
-create table t1 (a int(11));
-select all all * from t1;
-select distinct distinct * from t1;
---error 1221
-select all distinct * from t1;
---error 1221
-select distinct all * from t1;
-drop table t1;
-
-#
-# Test for BUG#10095
-#
-CREATE TABLE t1 (
- kunde_intern_id int(10) unsigned NOT NULL default '0',
- kunde_id int(10) unsigned NOT NULL default '0',
- FK_firma_id int(10) unsigned NOT NULL default '0',
- aktuell enum('Ja','Nein') NOT NULL default 'Ja',
- vorname varchar(128) NOT NULL default '',
- nachname varchar(128) NOT NULL default '',
- geloescht enum('Ja','Nein') NOT NULL default 'Nein',
- firma varchar(128) NOT NULL default ''
-);
-
-INSERT INTO t1 VALUES
- (3964,3051,1,'Ja','Vorname1','1Nachname','Nein','Print Schau XXXX'),
- (3965,3051111,1,'Ja','Vorname1111','1111Nachname','Nein','Print Schau XXXX');
-
-
-SELECT kunde_id ,FK_firma_id ,aktuell, vorname, nachname, geloescht FROM t1
- WHERE
- (
- (
- ( '' != '' AND firma LIKE CONCAT('%', '', '%'))
- OR
- (vorname LIKE CONCAT('%', 'Vorname1', '%') AND
- nachname LIKE CONCAT('%', '1Nachname', '%') AND
- 'Vorname1' != '' AND 'xxxx' != '')
- )
- AND
- (
- aktuell = 'Ja' AND geloescht = 'Nein' AND FK_firma_id = 2
- )
- )
- ;
-
-SELECT kunde_id ,FK_firma_id ,aktuell, vorname, nachname,
-geloescht FROM t1
- WHERE
- (
- (
- aktuell = 'Ja' AND geloescht = 'Nein' AND FK_firma_id = 2
- )
- AND
- (
- ( '' != '' AND firma LIKE CONCAT('%', '', '%') )
- OR
- ( vorname LIKE CONCAT('%', 'Vorname1', '%') AND
-nachname LIKE CONCAT('%', '1Nachname', '%') AND 'Vorname1' != '' AND
-'xxxx' != '')
- )
- )
- ;
-
-SELECT COUNT(*) FROM t1 WHERE
-( 0 OR (vorname LIKE '%Vorname1%' AND nachname LIKE '%1Nachname%' AND 1))
-AND FK_firma_id = 2;
-
-drop table t1;
-
-#
-#
-# Test for Bug#8009, SELECT failed on bigint unsigned when using HEX
-#
-
-CREATE TABLE t1 (b BIGINT(20) UNSIGNED NOT NULL, PRIMARY KEY (b));
-INSERT INTO t1 VALUES (0x8000000000000000);
-SELECT b FROM t1 WHERE b=0x8000000000000000;
-DROP TABLE t1;
-
-#
-# IN with outer join condition (BUG#9393)
-#
-CREATE TABLE `t1` ( `gid` int(11) default NULL, `uid` int(11) default NULL);
-
-CREATE TABLE `t2` ( `ident` int(11) default NULL, `level` char(16) default NULL);
-INSERT INTO `t2` VALUES (0,'READ');
-
-CREATE TABLE `t3` ( `id` int(11) default NULL, `name` char(16) default NULL);
-INSERT INTO `t3` VALUES (1,'fs');
-
-select * from t3 left join t1 on t3.id = t1.uid, t2 where t2.ident in (0, t1.gid, t3.id, 0);
-
-drop table t1,t2,t3;
-
-# Test for BUG#11700
-CREATE TABLE t1 (
- acct_id int(11) NOT NULL default '0',
- profile_id smallint(6) default NULL,
- UNIQUE KEY t1$acct_id (acct_id),
- KEY t1$profile_id (profile_id)
-);
-INSERT INTO t1 VALUES (132,17),(133,18);
-
-CREATE TABLE t2 (
- profile_id smallint(6) default NULL,
- queue_id int(11) default NULL,
- seq int(11) default NULL,
- KEY t2$queue_id (queue_id)
-);
-INSERT INTO t2 VALUES (17,31,4),(17,30,3),(17,36,2),(17,37,1);
-
-CREATE TABLE t3 (
- id int(11) NOT NULL default '0',
- qtype int(11) default NULL,
- seq int(11) default NULL,
- warn_lvl int(11) default NULL,
- crit_lvl int(11) default NULL,
- rr1 tinyint(4) NOT NULL default '0',
- rr2 int(11) default NULL,
- default_queue tinyint(4) NOT NULL default '0',
- KEY t3$qtype (qtype),
- KEY t3$id (id)
-);
-
-INSERT INTO t3 VALUES (30,1,29,NULL,NULL,0,NULL,0),(31,1,28,NULL,NULL,0,NULL,0),
- (36,1,34,NULL,NULL,0,NULL,0),(37,1,35,NULL,NULL,0,121,0);
-
-SELECT COUNT(*) FROM t1 a STRAIGHT_JOIN t2 pq STRAIGHT_JOIN t3 q
-WHERE
- (pq.profile_id = a.profile_id) AND (a.acct_id = 132) AND
- (pq.queue_id = q.id) AND (q.rr1 <> 1);
-
-drop table t1,t2,t3;
-
-#
-# Bug #11482 Wrongly applied optimization was erroneously rejecting valid
-# rows
-create table t1 (f1 int);
-insert into t1 values (1),(NULL);
-create table t2 (f2 int, f3 int, f4 int);
-create index idx1 on t2 (f4);
-insert into t2 values (1,2,3),(2,4,6);
-select A.f2 from t1 left join t2 A on A.f2 = f1 where A.f3=(select min(f3)
-from t2 C where A.f4 = C.f4) or A.f3 IS NULL;
-drop table t1,t2;
-
-#
-# Bug #11521 Negative integer keys incorrectly substituted for 0 during
-# range analysis.
-
-create table t2 (a tinyint unsigned);
-create index t2i on t2(a);
-insert into t2 values (0), (254), (255);
-explain select * from t2 where a > -1;
-select * from t2 where a > -1;
-drop table t2;
-
-#
-# Bug #11745: SELECT ... FROM DUAL with WHERE condition
-#
-
-CREATE TABLE t1 (a int, b int, c int);
-INSERT INTO t1
- SELECT 50, 3, 3 FROM DUAL
- WHERE NOT EXISTS
- (SELECT * FROM t1 WHERE a = 50 AND b = 3);
-SELECT * FROM t1;
-INSERT INTO t1
- SELECT 50, 3, 3 FROM DUAL
- WHERE NOT EXISTS
- (SELECT * FROM t1 WHERE a = 50 AND b = 3);
-select found_rows();
-SELECT * FROM t1;
-select count(*) from t1;
-select found_rows();
-select count(*) from t1 limit 2,3;
-select found_rows();
-select SQL_CALC_FOUND_ROWS count(*) from t1 limit 2,3;
-select found_rows();
-
-DROP TABLE t1;
-
-#
-# Bug 7672 Unknown column error in order clause
-#
-CREATE TABLE t1 (a INT, b INT);
-(SELECT a, b AS c FROM t1) ORDER BY c+1;
-(SELECT a, b AS c FROM t1) ORDER BY b+1;
-SELECT a, b AS c FROM t1 ORDER BY c+1;
-SELECT a, b AS c FROM t1 ORDER BY b+1;
-drop table t1;
-
-#
-# Bug #13356 assertion failed in resolve_const_item()
-#
-create table t1(f1 int, f2 int);
-create table t2(f3 int);
-select f1 from t1,t2 where f1=f2 and (f1,f2) = ((1,1));
-select f1 from t1,t2 where f1=f2 and (f1,NULL) = ((1,1));
-select f1 from t1,t2 where f1=f2 and (f1,f2) = ((1,NULL));
-insert into t1 values(1,1),(2,null);
-insert into t2 values(2);
-select * from t1,t2 where f1=f3 and (f1,f2) = (2,null);
-select * from t1,t2 where f1=f3 and (f1,f2) <=> (2,null);
-drop table t1,t2;
-
-#
-# Bug #13535
-#
-create table t1 (f1 int not null auto_increment primary key, f2 varchar(10));
-create table t11 like t1;
-insert into t1 values(1,""),(2,"");
---replace_column 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X 19 X
-show table status like 't1%';
-select 123 as a from t1 where f1 is null;
-drop table t1,t11;
-
-#
-# Bug #3874 (function in GROUP and LEFT JOIN)
-#
-
-CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL, UNIQUE idx (a,b) );
-INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4);
-CREATE TABLE t2 ( a INT NOT NULL, b INT NOT NULL, e INT );
-INSERT INTO t2 VALUES ( 1,10,1), (1,10,2), (1,11,1), (1,11,2), (1,2,1), (1,2,2),(1,2,3);
-SELECT t2.a, t2.b, IF(t1.b IS NULL,'',e) AS c, COUNT(*) AS d FROM t2 LEFT JOIN
-t1 ON t2.a = t1.a AND t2.b = t1.b GROUP BY a, b, c;
-SELECT t2.a, t2.b, IF(t1.b IS NULL,'',e) AS c, COUNT(*) AS d FROM t2 LEFT JOIN
-t1 ON t2.a = t1.a AND t2.b = t1.b GROUP BY t1.a, t1.b, c;
-SELECT t2.a, t2.b, IF(t1.b IS NULL,'',e) AS c, COUNT(*) AS d FROM t2 LEFT JOIN
-t1 ON t2.a = t1.a AND t2.b = t1.b GROUP BY t2.a, t2.b, c;
-SELECT t2.a, t2.b, IF(t1.b IS NULL,'',e) AS c, COUNT(*) AS d FROM t2,t1
-WHERE t2.a = t1.a AND t2.b = t1.b GROUP BY a, b, c;
-DROP TABLE IF EXISTS t1, t2;
-
-#
-# Bug #13855 select distinct with group by caused server crash
-#
-create table t1 (f1 int primary key, f2 int);
-create table t2 (f3 int, f4 int, primary key(f3,f4));
-insert into t1 values (1,1);
-insert into t2 values (1,1),(1,2);
-select distinct count(f2) >0 from t1 left join t2 on f1=f3 group by f1;
-drop table t1,t2;
-
-#
-# Bug #14482 Server crash when subselecting from the same table
-#
-create table t1 (f1 int,f2 int);
-insert into t1 values(1,1);
-create table t2 (f3 int, f4 int, primary key(f3,f4));
-insert into t2 values(1,1);
-select * from t1 where f1 in (select f3 from t2 where (f3,f4)= (select f3,f4 from t2));
-drop table t1,t2;
-
-#
-# Bug #4981: 4.x and 5.x produce non-optimal execution path, 3.23 regression test failure
-#
-CREATE TABLE t1(a int, b int, c int, KEY b(b), KEY c(c));
-insert into t1 values (1,0,0),(2,0,0);
-CREATE TABLE t2 (a int, b varchar(2), c varchar(2), PRIMARY KEY(a));
-insert into t2 values (1,'',''), (2,'','');
-CREATE TABLE t3 (a int, b int, PRIMARY KEY (a,b), KEY a (a), KEY b (b));
-insert into t3 values (1,1),(1,2);
-# must have "range checked" for t2
-explain select straight_join DISTINCT t2.a,t2.b, t1.c from t1, t3, t2
- where (t1.c=t2.a or (t1.c=t3.a and t2.a=t3.b)) and t1.b=556476786 and
- t2.b like '%%' order by t2.b limit 0,1;
-DROP TABLE t1,t2,t3;
-
-#
-# Bug #17873: confusing error message when IGNORE INDEX refers a column name
-#
-
-CREATE TABLE t1 (a int, INDEX idx(a));
-INSERT INTO t1 VALUES (2), (3), (1);
-
-EXPLAIN SELECT * FROM t1 IGNORE INDEX (idx);
---error 1176
-EXPLAIN SELECT * FROM t1 IGNORE INDEX (a);
---error 1176
-EXPLAIN SELECT * FROM t1 FORCE INDEX (a);
-
-DROP TABLE t1;
-
-#
-# Bug #21019: First result of SELECT COUNT(*) different than consecutive runs
-#
-CREATE TABLE t1 (a int, b int);
-INSERT INTO t1 VALUES (1,1), (2,1), (4,10);
-
-CREATE TABLE t2 (a int PRIMARY KEY, b int, KEY b (b));
-INSERT INTO t2 VALUES (1,NULL), (2,10);
-ALTER TABLE t1 ENABLE KEYS;
-
-EXPLAIN SELECT STRAIGHT_JOIN SQL_NO_CACHE COUNT(*) FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
-SELECT STRAIGHT_JOIN SQL_NO_CACHE * FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
-EXPLAIN SELECT STRAIGHT_JOIN SQL_NO_CACHE COUNT(*) FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
-SELECT STRAIGHT_JOIN SQL_NO_CACHE * FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
-DROP TABLE IF EXISTS t1,t2;
-
-#
-# Bug #20954 "avg(keyval) retuns 0.38 but max(keyval) returns an empty set"
-#
---disable_ps_protocol
-CREATE TABLE t1 (key1 float default NULL, UNIQUE KEY key1 (key1));
-CREATE TABLE t2 (key2 float default NULL, UNIQUE KEY key2 (key2));
-INSERT INTO t1 VALUES (0.3762),(0.3845),(0.6158),(0.7941);
-INSERT INTO t2 VALUES (1.3762),(1.3845),(1.6158),(1.7941);
-
-explain select max(key1) from t1 where key1 <= 0.6158;
-explain select max(key2) from t2 where key2 <= 1.6158;
-explain select min(key1) from t1 where key1 >= 0.3762;
-explain select min(key2) from t2 where key2 >= 1.3762;
-explain select max(key1), min(key2) from t1, t2
-where key1 <= 0.6158 and key2 >= 1.3762;
-explain select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5;
-explain select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;
-
-select max(key1) from t1 where key1 <= 0.6158;
-select max(key2) from t2 where key2 <= 1.6158;
-select min(key1) from t1 where key1 >= 0.3762;
-select min(key2) from t2 where key2 >= 1.3762;
-select max(key1), min(key2) from t1, t2
-where key1 <= 0.6158 and key2 >= 1.3762;
-select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5;
-select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;
-
-DROP TABLE t1,t2;
---enable_ps_protocol
-
-#
-# Bug #18759 "Incorrect string to numeric conversion"
-#
-# This test is here so that the behavior will not be changed to 4.1
-# and not to 5.0 either. In 4.1 and 5.0 sending an integer as a string
-# will be converted internally to real (double) value and it is not
-# as accurate as bigint (longlong) for integers. Thus the results may
-# vary. In 5.1 internally it is decimal, which is a string type and
-# will be more accurate. Due to rather big changes needed to fix this
-# in 4.1 or 5.0 it is not desired to do it in the stable versions.
-#
-# This test is here only to make sure that behavior is not changed in
-# 4.1 and 5.0
-#
-CREATE TABLE t1 (i BIGINT UNSIGNED NOT NULL);
-INSERT INTO t1 VALUES (10);
-SELECT i='1e+01',i=1e+01, i in (1e+01,1e+01), i in ('1e+01','1e+01') FROM t1;
-DROP TABLE t1;
-
-#
-# Bug #22533: storing large hex strings
-#
-
-create table t1(a bigint unsigned, b bigint);
-insert ignore into t1 values (0xfffffffffffffffff, 0xfffffffffffffffff),
- (0x10000000000000000, 0x10000000000000000),
- (0x8fffffffffffffff, 0x8fffffffffffffff);
-select hex(a), hex(b) from t1;
-drop table t1;
-
-#
-# Bug #32103: optimizer crash when join on int and mediumint with variable in
-# where clause
-#
-
-CREATE TABLE t1 (c0 int);
-CREATE TABLE t2 (c0 int);
-
-# We need any variable that:
-# 1. has integer type,
-# 2. can be used with the "@@name" syntax
-# 3. available in every server build
-INSERT INTO t1 VALUES(@@connect_timeout);
-INSERT INTO t2 VALUES(@@connect_timeout);
-
-# We only need to ensure 1 row is returned to validate the results
---replace_column 1 X 2 X
-SELECT * FROM t1 JOIN t2 ON t1.c0 = t2.c0 WHERE (t1.c0 <=> @@connect_timeout);
-
-DROP TABLE t1, t2;
-
---echo End of 4.1 tests
-
-#
-# Test for bug #6474
-#
-
-CREATE TABLE t1 (
-K2C4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '',
-K4N4 varchar(4) character set latin1 collate latin1_bin NOT NULL default '0000',
-F2I4 int(11) NOT NULL default '0'
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-
-INSERT INTO t1 VALUES
-('W%RT', '0100', 1),
-('W-RT', '0100', 1),
-('WART', '0100', 1),
-('WART', '0200', 1),
-('WERT', '0100', 2),
-('WORT','0200', 2),
-('WT', '0100', 2),
-('W_RT', '0100', 2),
-('WaRT', '0100', 3),
-('WART', '0300', 3),
-('WRT' , '0400', 3),
-('WURM', '0500', 3),
-('W%T', '0600', 4),
-('WA%T', '0700', 4),
-('WA_T', '0800', 4);
-
-SELECT K2C4, K4N4, F2I4 FROM t1
- WHERE K2C4 = 'WART' AND
- (F2I4 = 2 AND K2C4 = 'WART' OR (F2I4 = 2 OR K4N4 = '0200'));
-SELECT K2C4, K4N4, F2I4 FROM t1
- WHERE K2C4 = 'WART' AND (K2C4 = 'WART' OR K4N4 = '0200');
-DROP TABLE t1;
-
-#
-# Bug#8670
-#
-create table t1 (a int, b int);
-create table t2 like t1;
-select t1.a from (t1 inner join t2 on t1.a=t2.a) where t2.a=1;
-select t1.a from ((t1 inner join t2 on t1.a=t2.a)) where t2.a=1;
-select x.a, y.a, z.a from ( (t1 x inner join t2 y on x.a=y.a) inner join t2 z on y.a=z.a) WHERE x.a=1;
-drop table t1,t2;
-
-#
-# Bug#9820
-#
-
-create table t1 (s1 varchar(5));
-insert into t1 values ('Wall');
-select min(s1) from t1 group by s1 with rollup;
-drop table t1;
-
-#
-# Bug#9799
-#
-
-create table t1 (s1 int) engine=myisam;
-insert into t1 values (0);
-select avg(distinct s1) from t1 group by s1 with rollup;
-drop table t1;
-
-#
-# Bug#9800
-#
-
-create table t1 (s1 int);
-insert into t1 values (null),(1);
-select distinct avg(s1) as x from t1 group by s1 with rollup;
-drop table t1;
-
-
-#
-# Test for bug #10084: STRAIGHT_JOIN with ON expression
-#
-
-CREATE TABLE t1 (a int);
-CREATE TABLE t2 (a int);
-INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
-INSERT INTO t2 VALUES (2), (4), (6);
-
-SELECT t1.a FROM t1 STRAIGHT_JOIN t2 ON t1.a=t2.a;
-
-EXPLAIN SELECT t1.a FROM t1 STRAIGHT_JOIN t2 ON t1.a=t2.a;
-EXPLAIN SELECT t1.a FROM t1 INNER JOIN t2 ON t1.a=t2.a;
-
-DROP TABLE t1,t2;
-
-#
-# Bug #10650
-#
-
-select x'3136' + 0, X'3136' + 0, b'10' + 0, B'10' + 0;
-
-#
-# Bug #11398 Bug in field_conv() results in wrong result of join with index
-#
-create table t1 (f1 varchar(6) default NULL, f2 int(6) primary key not null);
-create table t2 (f3 varchar(5) not null, f4 varchar(5) not null, UNIQUE KEY UKEY (f3,f4));
-insert into t1 values (" 2", 2);
-insert into t2 values (" 2", " one "),(" 2", " two ");
-select * from t1 left join t2 on f1 = f3;
-drop table t1,t2;
-
-#
-# Bug #6558 Views: CREATE VIEW fails with JOIN ... USING
-#
-
-create table t1 (empnum smallint, grp int);
-create table t2 (empnum int, name char(5));
-insert into t1 values(1,1);
-insert into t2 values(1,'bob');
-create view v1 as select * from t2 inner join t1 using (empnum);
-select * from v1;
-drop table t1,t2;
-drop view v1;
-
-#
-# Bug #10646 Columns included in the join between two tables are ambigious
-# in the select
-#
-
-create table t1 (pk int primary key, b int);
-create table t2 (pk int primary key, c int);
-select pk from t1 inner join t2 using (pk);
-drop table t1,t2;
-
-#
-# Bug #10972 Natural join of view and underlying table gives wrong result
-#
-
-create table t1 (s1 int, s2 char(5), s3 decimal(10));
-create view v1 as select s1, s2, 'x' as s3 from t1;
-select * from t1 natural join v1;
-insert into t1 values (1,'x',5);
-select * from t1 natural join v1;
-drop table t1;
-drop view v1;
-
-#
-# Bug #6276 A SELECT that does a NATURAL OUTER JOIN without common
-# columns crashes server because of empty ON condition
-#
-
-create table t1(a1 int);
-create table t2(a2 int);
-insert into t1 values(1),(2);
-insert into t2 values(1),(2);
-create view v2 (c) as select a1 from t1;
-
---sorted_result
-select * from t1 natural left join t2;
---sorted_result
-select * from t1 natural right join t2;
-
---sorted_result
-select * from v2 natural left join t2;
---sorted_result
-select * from v2 natural right join t2;
-
-drop table t1, t2;
-drop view v2;
-
-
-#
-# Bug #4789 Incosistent results of more than 2-way natural joins due to
-# incorrect transformation to join ... on.
-#
-
-create table t1 (a int(10), t1_val int(10));
-create table t2 (b int(10), t2_val int(10));
-create table t3 (a int(10), b int(10));
-insert into t1 values (1,1),(2,2);
-insert into t2 values (1,1),(2,2),(3,3);
-insert into t3 values (1,1),(2,1),(3,1),(4,1);
-# the following two queries must return the same result
-select * from t1 natural join t2 natural join t3;
-select * from t1 natural join t3 natural join t2;
-drop table t1, t2, t3;
-
-
-#
-# Bug #12841: Server crash on DO IFNULL(NULL,NULL)
-#
-# (testing returning of int, decimal, real, string)
-DO IFNULL(NULL, NULL);
-SELECT CAST(IFNULL(NULL, NULL) AS DECIMAL);
-SELECT ABS(IFNULL(NULL, NULL));
-SELECT IFNULL(NULL, NULL);
-
-#
-# BUG #12595 (ESCAPE must be exactly one)
-#
-SET @OLD_SQL_MODE12595=@@SQL_MODE, @@SQL_MODE='';
-SHOW LOCAL VARIABLES LIKE 'SQL_MODE';
-
-CREATE TABLE BUG_12595(a varchar(100));
-INSERT INTO BUG_12595 VALUES ('hakan%'), ('hakank'), ("ha%an");
-SELECT * FROM BUG_12595 WHERE a LIKE 'hakan\%';
-SELECT * FROM BUG_12595 WHERE a LIKE 'hakan*%' ESCAPE '*';
--- error 1210
-SELECT * FROM BUG_12595 WHERE a LIKE 'hakan**%' ESCAPE '**';
-# this should work when sql_mode is not NO_BACKSLASH_ESCAPES
-SELECT * FROM BUG_12595 WHERE a LIKE 'hakan%' ESCAPE '';
-SELECT * FROM BUG_12595 WHERE a LIKE 'hakan\%' ESCAPE '';
-SELECT * FROM BUG_12595 WHERE a LIKE 'ha\%an' ESCAPE 0x5c;
-SELECT * FROM BUG_12595 WHERE a LIKE 'ha%%an' ESCAPE '%';
-SELECT * FROM BUG_12595 WHERE a LIKE 'ha\%an' ESCAPE '\\';
-SELECT * FROM BUG_12595 WHERE a LIKE 'ha|%an' ESCAPE '|';
-
-SET @@SQL_MODE='NO_BACKSLASH_ESCAPES';
-SHOW LOCAL VARIABLES LIKE 'SQL_MODE';
-SELECT * FROM BUG_12595 WHERE a LIKE 'hakan\%';
-SELECT * FROM BUG_12595 WHERE a LIKE 'hakan*%' ESCAPE '*';
--- error 1210
-SELECT * FROM BUG_12595 WHERE a LIKE 'hakan**%' ESCAPE '**';
--- error 1210
-SELECT * FROM BUG_12595 WHERE a LIKE 'hakan\%' ESCAPE '\\';
-#this gives an error when NO_BACKSLASH_ESCAPES is set
--- error 1210
-SELECT * FROM BUG_12595 WHERE a LIKE 'hakan%' ESCAPE '';
-SELECT * FROM BUG_12595 WHERE a LIKE 'ha\%an' ESCAPE 0x5c;
-SELECT * FROM BUG_12595 WHERE a LIKE 'ha|%an' ESCAPE '|';
--- error 1210
-SELECT * FROM BUG_12595 WHERE a LIKE 'hakan\n%' ESCAPE '\n';
-
-SET @@SQL_MODE=@OLD_SQL_MODE12595;
-DROP TABLE BUG_12595;
-
-#
-# Bug #6495 Illogical requirement for column qualification in NATURAL join
-#
-
-create table t1 (a char(1));
-create table t2 (a char(1));
-insert into t1 values ('a'),('b'),('c');
-insert into t2 values ('b'),('c'),('d');
-select a from t1 natural join t2;
-select * from t1 natural join t2 where a = 'b';
-drop table t1, t2;
-
-#
-# Bug #12977 Compare table names with qualifying field tables only
-# for base tables, search all nested join operands of natural joins.
-#
-
-CREATE TABLE t1 (`id` TINYINT);
-CREATE TABLE t2 (`id` TINYINT);
-CREATE TABLE t3 (`id` TINYINT);
-INSERT INTO t1 VALUES (1),(2),(3);
-INSERT INTO t2 VALUES (2);
-INSERT INTO t3 VALUES (3);
--- error 1052
-SELECT t1.id,t3.id FROM t1 JOIN t2 ON (t2.id=t1.id) LEFT JOIN t3 USING (id);
--- error 1052
-SELECT t1.id,t3.id FROM t1 JOIN t2 ON (t2.notacolumn=t1.id) LEFT JOIN t3 USING (id);
--- error 1052
-SELECT id,t3.id FROM t1 JOIN t2 ON (t2.id=t1.id) LEFT JOIN t3 USING (id);
--- error 1052
-SELECT id,t3.id FROM (t1 JOIN t2 ON (t2.id=t1.id)) LEFT JOIN t3 USING (id);
-
-drop table t1, t2, t3;
-
-#
-# Bug #13067 JOIN xxx USING is case sensitive
-#
-
-create table t1 (a int(10),b int(10));
-create table t2 (a int(10),b int(10));
-insert into t1 values (1,10),(2,20),(3,30);
-insert into t2 values (1,10);
-# both queries should produce the same result
-select * from t1 inner join t2 using (A);
-select * from t1 inner join t2 using (a);
-drop table t1, t2;
-
-#
-# Bug #12943 Incorrect nesting of [INNER| CROSS] JOIN due to unspecified
-# associativity in the parser.
-#
-
-create table t1 (a int, c int);
-create table t2 (b int);
-create table t3 (b int, a int);
-create table t4 (c int);
-insert into t1 values (1,1);
-insert into t2 values (1);
-insert into t3 values (1,1);
-insert into t4 values (1);
-
-select * from t1 join t2 join t3 on (t2.b = t3.b and t1.a = t3.a);
-# Notice that ',' has lower priority than 'join', thus we have that:
-# t1, t2 join t3 <==> t1, (t2 join t3).
--- error 1054
-select * from t1, t2 join t3 on (t2.b = t3.b and t1.a = t3.a);
-select * from t1 join t2 join t3 join t4 on (t1.a = t4.c and t2.b = t4.c);
-select * from t1 join t2 join t4 using (c);
-drop table t1, t2, t3, t4;
-
-#
-# Bug #12291 Table wasn't reinited for index scan after sequential scan
-#
-create table t1(x int, y int);
-create table t2(x int, y int);
-create table t3(x int, primary key(x));
-insert into t1 values (1, 1), (2, 1), (3, 1), (4, 3), (5, 6), (6, 6);
-insert into t2 values (1, 1), (2, 1), (3, 3), (4, 6), (5, 6);
-insert into t3 values (1), (2), (3), (4), (5);
-select t1.x, t3.x from t1, t2, t3 where t1.x = t2.x and t3.x >= t1.y and t3.x <= t2.y;
-drop table t1,t2,t3;
-
-#
-# Bug #13127 LEFT JOIN against a VIEW returns NULL instead of correct value
-#
-
-create table t1 (id char(16) not null default '', primary key (id));
-insert into t1 values ('100'),('101'),('102');
-create table t2 (id char(16) default null);
-insert into t2 values (1);
-create view v1 as select t1.id from t1;
-create view v2 as select t2.id from t2;
-create view v3 as select (t1.id+2) as id from t1 natural left join t2;
-
-# all queries must return the same result
-select t1.id from t1 left join v2 using (id);
-select t1.id from v2 right join t1 using (id);
---sorted_result
-select t1.id from t1 left join v3 using (id);
-select * from t1 left join v2 using (id);
-select * from v2 right join t1 using (id);
---sorted_result
-select * from t1 left join v3 using (id);
-
-select v1.id from v1 left join v2 using (id);
-select v1.id from v2 right join v1 using (id);
---sorted_result
-select v1.id from v1 left join v3 using (id);
-select * from v1 left join v2 using (id);
-select * from v2 right join v1 using (id);
---sorted_result
-select * from v1 left join v3 using (id);
-
-drop table t1, t2;
-drop view v1, v2, v3;
-
-#
-# Bug #13597 Column in ON condition not resolved if references a table in
-# nested right join.
-#
-
-create table t1 (id int(11) not null default '0');
-insert into t1 values (123),(191),(192);
-create table t2 (id char(16) character set utf8 not null);
-insert into t2 values ('58013'),('58014'),('58015'),('58016');
-create table t3 (a_id int(11) not null, b_id char(16) character set utf8);
-insert into t3 values (123,null),(123,null),(123,null),(123,null),(123,null),(123,'58013');
-
-# both queries are equivalent
-select count(*)
-from t1 inner join (t3 left join t2 on t2.id = t3.b_id) on t1.id = t3.a_id;
-
-select count(*)
-from t1 inner join (t2 right join t3 on t2.id = t3.b_id) on t1.id = t3.a_id;
-
-drop table t1,t2,t3;
-
-#
-# Bug #13832 Incorrect parse order of join productions due to unspecified
-# operator priorities results in incorrect join tree.
-#
-
-create table t1 (a int);
-create table t2 (b int);
-create table t3 (c int);
-select * from t1 join t2 join t3 on (t1.a=t3.c);
-select * from t1 join t2 left join t3 on (t1.a=t3.c);
-select * from t1 join t2 right join t3 on (t1.a=t3.c);
-select * from t1 join t2 straight_join t3 on (t1.a=t3.c);
-drop table t1, t2 ,t3;
-
-#
-# Bug #14093 Query takes a lot of time when date format is not valid
-# fix optimizes execution. so here we just check that returned set is
-# correct.
-create table t1(f1 int, f2 date);
-insert into t1 values(1,'2005-01-01'),(2,'2005-09-01'),(3,'2005-09-30'),
- (4,'2005-10-01'),(5,'2005-12-30');
-# should return all records
-select * from t1 where f2 >= 0 order by f2;
-select * from t1 where f2 >= '0000-00-00' order by f2;
-# should return 4,5
-select * from t1 where f2 >= '2005-09-31' order by f2;
-select * from t1 where f2 >= '2005-09-3a' order by f2;
-# should return 1,2,3
-select * from t1 where f2 <= '2005-09-31' order by f2;
-select * from t1 where f2 <= '2005-09-3a' order by f2;
-drop table t1;
-
-#
-# Bug ##14662 ORDER BY on column of a view, with an alias of the same
-# column causes ambiguous
-#
-
-create table t1 (f1 int, f2 int);
-insert into t1 values (1, 30), (2, 20), (3, 10);
-create algorithm=merge view v1 as select f1, f2 from t1;
-create algorithm=merge view v2 (f2, f1) as select f1, f2 from t1;
-create algorithm=merge view v3 as select t1.f1 as f2, t1.f2 as f1 from t1;
-select t1.f1 as x1, f1 from t1 order by t1.f1;
-select v1.f1 as x1, f1 from v1 order by v1.f1;
-select v2.f1 as x1, f1 from v2 order by v2.f1;
-select v3.f1 as x1, f1 from v3 order by v3.f1;
-select f1, f2, v1.f1 as x1 from v1 order by v1.f1;
-select f1, f2, v2.f1 as x1 from v2 order by v2.f1;
-select f1, f2, v3.f1 as x1 from v3 order by v3.f1;
-drop table t1;
-drop view v1, v2, v3;
-
-#
-# Bug #15106: lost equality predicate of the form field=const in a join query
-#
-
-CREATE TABLE t1(key_a int4 NOT NULL, optimus varchar(32), PRIMARY KEY(key_a));
-CREATE TABLE t2(key_a int4 NOT NULL, prime varchar(32), PRIMARY KEY(key_a));
-CREATE table t3(key_a int4 NOT NULL, key_b int4 NOT NULL, foo varchar(32),
- PRIMARY KEY(key_a,key_b));
-
-INSERT INTO t1 VALUES (0,'');
-INSERT INTO t1 VALUES (1,'i');
-INSERT INTO t1 VALUES (2,'j');
-INSERT INTO t1 VALUES (3,'k');
-
-INSERT INTO t2 VALUES (1,'r');
-INSERT INTO t2 VALUES (2,'s');
-INSERT INTO t2 VALUES (3,'t');
-
-INSERT INTO t3 VALUES (1,5,'x');
-INSERT INTO t3 VALUES (1,6,'y');
-INSERT INTO t3 VALUES (2,5,'xx');
-INSERT INTO t3 VALUES (2,6,'yy');
-INSERT INTO t3 VALUES (2,7,'zz');
-INSERT INTO t3 VALUES (3,5,'xxx');
-
-SELECT t2.key_a,foo
- FROM t1 INNER JOIN t2 ON t1.key_a = t2.key_a
- INNER JOIN t3 ON t1.key_a = t3.key_a
- WHERE t2.key_a=2 and key_b=5;
-EXPLAIN SELECT t2.key_a,foo
- FROM t1 INNER JOIN t2 ON t1.key_a = t2.key_a
- INNER JOIN t3 ON t1.key_a = t3.key_a
- WHERE t2.key_a=2 and key_b=5;
-
-SELECT t2.key_a,foo
- FROM t1 INNER JOIN t2 ON t2.key_a = t1.key_a
- INNER JOIN t3 ON t1.key_a = t3.key_a
- WHERE t2.key_a=2 and key_b=5;
-EXPLAIN SELECT t2.key_a,foo
- FROM t1 INNER JOIN t2 ON t2.key_a = t1.key_a
- INNER JOIN t3 ON t1.key_a = t3.key_a
- WHERE t2.key_a=2 and key_b=5;
-
-DROP TABLE t1,t2,t3;
-
-#
-# Bug#15347 Wrong result of subselect when records cache and set functions
-# are involved
-#
-create table t1 (f1 int);
-insert into t1 values(1),(2);
-create table t2 (f2 int, f3 int, key(f2));
-insert into t2 values(1,1),(2,2);
-create table t3 (f4 int not null);
-insert into t3 values (2),(2),(2);
-select f1,(select count(*) from t2,t3 where f2=f1 and f3=f4) as count from t1;
-drop table t1,t2,t3;
-
-#
-# Bug #15633 Evaluation of Item_equal for non-const table caused wrong
-# select result
-#
-create table t1 (f1 int unique);
-create table t2 (f2 int unique);
-create table t3 (f3 int unique);
-insert into t1 values(1),(2);
-insert into t2 values(1),(2);
-insert into t3 values(1),(NULL);
-select * from t3 where f3 is null;
-select t2.f2 from t1 left join t2 on f1=f2 join t3 on f1=f3 where f1=1;
-drop table t1,t2,t3;
-
-#
-# Bug#15268 Unchecked null value caused server crash
-#
-create table t1(f1 char, f2 char not null);
-insert into t1 values(null,'a');
-create table t2 (f2 char not null);
-insert into t2 values('b');
-select * from t1 left join t2 on f1=t2.f2 where t1.f2='a';
-drop table t1,t2;
-
-#
-# Bug#15538 unchecked table absense caused server crash.
-#
---error 1064
-select * from (select * left join t on f1=f2) tt;
-
-#
-# Bug #16504: re-evaluation of Item_equal object after reading const table
-#
-
-CREATE TABLE t1 (sku int PRIMARY KEY, pr int);
-CREATE TABLE t2 (sku int PRIMARY KEY, sppr int, name varchar(255));
-
-INSERT INTO t1 VALUES
- (10, 10), (20, 10), (30, 20), (40, 30), (50, 10), (60, 10);
-
-INSERT INTO t2 VALUES
- (10, 10, 'aaa'), (20, 10, 'bbb'), (30, 10, 'ccc'), (40, 20, 'ddd'),
- (50, 10, 'eee'), (60, 20, 'fff'), (70, 20, 'ggg'), (80, 30, 'hhh');
-
-SELECT t2.sku, t2.sppr, t2.name, t1.sku, t1.pr
- FROM t2, t1 WHERE t2.sku=20 AND (t2.sku=t1.sku OR t2.sppr=t1.sku);
-EXPLAIN
-SELECT t2.sku, t2.sppr, t2.name, t1.sku, t1.pr
- FROM t2, t1 WHERE t2.sku=20 AND (t2.sku=t1.sku OR t2.sppr=t1.sku);
-
-
-DROP TABLE t1,t2;
-
-#
-# Bug#18712: Truncation problem (needs just documenting and test
-# cases to prevent fixing this accidently. It is intended behaviour)
-#
-
-SET SQL_MODE='NO_UNSIGNED_SUBTRACTION';
-CREATE TABLE t1 (i TINYINT UNSIGNED NOT NULL);
-INSERT t1 SET i = 0;
-UPDATE t1 SET i = -1;
-SELECT * FROM t1;
-UPDATE t1 SET i = CAST(i - 1 AS SIGNED);
-SELECT * FROM t1;
-UPDATE t1 SET i = i - 1;
-SELECT * FROM t1;
-DROP TABLE t1;
-SET SQL_MODE=default;
-
-# BUG#17379
-
-create table t1 (a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t2 (a int, b int, c int, e int, primary key(a,b,c));
-insert into t2 select A.a, B.a, C.a, C.a from t1 A, t1 B, t1 C;
-analyze table t2;
-select 'In next EXPLAIN, B.rows must be exactly 10:' Z;
-
-explain select * from t2 A, t2 B where A.a=5 and A.b=5 and A.C<5
- and B.a=5 and B.b=A.e and (B.b =1 or B.b = 3 or B.b=5);
-drop table t1, t2;
-
-#
-#Bug #18940: selection of optimal execution plan caused by equality
-# propagation (the bug was fixed by the patch for bug #17379)
-
-CREATE TABLE t1 (a int PRIMARY KEY, b int, INDEX(b));
-INSERT INTO t1 VALUES (1, 3), (9,4), (7,5), (4,5), (6,2),
- (3,1), (5,1), (8,9), (2,2), (0,9);
-
-CREATE TABLE t2 (c int, d int, f int, INDEX(c,f));
-INSERT INTO t2 VALUES
- (1,0,0), (1,0,1), (2,0,0), (2,0,1), (3,0,0), (4,0,1),
- (5,0,0), (5,0,1), (6,0,0), (0,0,1), (7,0,0), (7,0,1),
- (0,0,0), (0,0,1), (8,0,0), (8,0,1), (9,0,0), (9,0,1);
-
-EXPLAIN
-SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6;
-EXPLAIN
-SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0;
-
-DROP TABLE t1, t2;
-
-#
-# Bug #18895: BIT values cause joins to fail
-#
-create table t1 (
- a int unsigned not null auto_increment primary key,
- b bit not null,
- c bit not null
-);
-
-create table t2 (
- a int unsigned not null auto_increment primary key,
- b bit not null,
- c int unsigned not null,
- d varchar(50)
-);
-
-insert into t1 (b,c) values (0,1), (0,1);
-insert into t2 (b,c) values (0,1);
-
-# Row 1 should succeed. Row 2 should fail. Both fail.
-select t1.a, t1.b + 0, t1.c + 0, t2.a, t2.b + 0, t2.c, t2.d
-from t1 left outer join t2 on t1.a = t2.c and t2.b <> 1
-where t1.b <> 1 order by t1.a;
-
-drop table t1,t2;
-
-#
-# Bug #20569: Garbage in DECIMAL results from some mathematical functions
-#
-SELECT 0.9888889889 * 1.011111411911;
-
-#
-# Bug #10977: No warning issued if a column name is truncated
-#
-prepare stmt from 'select 1 as " a "';
-execute stmt;
-
-#
-# Bug #21390: wrong estimate of rows after elimination of const tables
-#
-
-CREATE TABLE t1 (a int NOT NULL PRIMARY KEY, b int NOT NULL);
-INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4);
-
-CREATE TABLE t2 (c int NOT NULL, INDEX idx(c));
-INSERT INTO t2 VALUES
- (1), (1), (1), (1), (1), (1), (1), (1),
- (2), (2), (2), (2),
- (3), (3),
- (4);
-
-EXPLAIN SELECT b FROM t1, t2 WHERE b=c AND a=1;
-EXPLAIN SELECT b FROM t1, t2 WHERE b=c AND a=4;
-
-DROP TABLE t1, t2;
-
-#
-# No matches for a join after substitution of a const table
-#
-
-CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a int);
-INSERT INTO t1 VALUES (1,2), (2,NULL), (3,2);
-
-CREATE TABLE t2 (b int, c INT, INDEX idx1(b));
-INSERT INTO t2 VALUES (2,1), (3,2);
-
-CREATE TABLE t3 (d int, e int, INDEX idx1(d));
-INSERT INTO t3 VALUES (2,10), (2,20), (1,30), (2,40), (2,50);
-
-EXPLAIN
-SELECT * FROM t1 LEFT JOIN t2 ON t2.b=t1.a INNER JOIN t3 ON t3.d=t1.id
- WHERE t1.id=2;
-SELECT * FROM t1 LEFT JOIN t2 ON t2.b=t1.a INNER JOIN t3 ON t3.d=t1.id
- WHERE t1.id=2;
-
-DROP TABLE t1,t2,t3;
-
-#
-# Bug#20503: Server crash due to the ORDER clause isn't taken into account
-# while space allocation
-#
-create table t1 (c1 varchar(1), c2 int, c3 int, c4 int, c5 int, c6 int,
-c7 int, c8 int, c9 int, fulltext key (`c1`));
-select distinct match (`c1`) against ('z') , c2, c3, c4,c5, c6,c7, c8
- from t1 where c9=1 order by c2, c2;
-drop table t1;
-
-#
-# Bug #22735: no equality propagation for BETWEEN and IN with STRING arguments
-#
-
-CREATE TABLE t1 (pk varchar(10) PRIMARY KEY, fk varchar(16));
-CREATE TABLE t2 (pk varchar(16) PRIMARY KEY, fk varchar(10));
-
-INSERT INTO t1 VALUES
- ('d','dddd'), ('i','iii'), ('a','aa'), ('b','bb'), ('g','gg'),
- ('e','eee'), ('c','cccc'), ('h','hhh'), ('j','jjj'), ('f','fff');
-INSERT INTO t2 VALUES
- ('jjj', 'j'), ('cc','c'), ('ccc','c'), ('aaa', 'a'), ('jjjj','j'),
- ('hhh','h'), ('gg','g'), ('fff','f'), ('ee','e'), ('ffff','f'),
- ('bbb','b'), ('ff','f'), ('cccc','c'), ('dddd','d'), ('jj','j'),
- ('aaaa','a'), ('bb','b'), ('eeee','e'), ('aa','a'), ('hh','h');
-
-EXPLAIN SELECT t2.*
- FROM t1 JOIN t2 ON t2.fk=t1.pk
- WHERE t2.fk < 'c' AND t2.pk=t1.fk;
-EXPLAIN SELECT t2.*
- FROM t1 JOIN t2 ON t2.fk=t1.pk
- WHERE t2.fk BETWEEN 'a' AND 'b' AND t2.pk=t1.fk;
-EXPLAIN SELECT t2.*
- FROM t1 JOIN t2 ON t2.fk=t1.pk
- WHERE t2.fk IN ('a','b') AND t2.pk=t1.fk;
-
-DROP TABLE t1,t2;
-
-#
-# Bug #22367: Optimizer uses ref join type instead of eq_ref for simple
-# join on strings
-#
-CREATE TABLE t1 (a int, b varchar(20) NOT NULL, PRIMARY KEY(a));
-CREATE TABLE t2 (a int, b varchar(20) NOT NULL,
- PRIMARY KEY (a), UNIQUE KEY (b));
-INSERT INTO t1 VALUES (1,'a'),(2,'b'),(3,'c');
-INSERT INTO t2 VALUES (1,'a'),(2,'b'),(3,'c');
-
-EXPLAIN SELECT t1.a FROM t1 LEFT JOIN t2 ON t2.b=t1.b WHERE t1.a=3;
-
-DROP TABLE t1,t2;
-
-#
-# Bug #19579: predicates that become sargable after reading const tables
-# are not taken into account by optimizer
-#
-
-CREATE TABLE t1(id int PRIMARY KEY, b int, e int);
-CREATE TABLE t2(i int, a int, INDEX si(i), INDEX ai(a));
-CREATE TABLE t3(a int PRIMARY KEY, c char(4), INDEX ci(c));
-
-INSERT INTO t1 VALUES
- (1,10,19), (2,20,22), (4,41,42), (9,93,95), (7, 77,79),
- (6,63,67), (5,55,58), (3,38,39), (8,81,89);
-INSERT INTO t2 VALUES
- (21,210), (41,410), (82,820), (83,830), (84,840),
- (65,650), (51,510), (37,370), (94,940), (76,760),
- (22,220), (33,330), (40,400), (95,950), (38,380),
- (67,670), (88,880), (57,570), (96,960), (97,970);
-INSERT INTO t3 VALUES
- (210,'bb'), (950,'ii'), (400,'ab'), (500,'ee'), (220,'gg'),
- (440,'gg'), (310,'eg'), (380,'ee'), (840,'bb'), (830,'ff'),
- (230,'aa'), (960,'ii'), (410,'aa'), (510,'ee'), (290,'bb'),
- (450,'gg'), (320,'dd'), (390,'hh'), (850,'jj'), (860,'ff');
-
-EXPLAIN
-SELECT t3.a FROM t1,t2 FORCE INDEX (si),t3
- WHERE t1.id = 8 AND t2.i BETWEEN t1.b AND t1.e AND
- t3.a=t2.a AND t3.c IN ('bb','ee');
-EXPLAIN
-SELECT t3.a FROM t1,t2,t3
- WHERE t1.id = 8 AND t2.i BETWEEN t1.b AND t1.e AND
- t3.a=t2.a AND t3.c IN ('bb','ee') ;
-
-EXPLAIN
-SELECT t3.a FROM t1,t2 FORCE INDEX (si),t3
- WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND
- t3.c IN ('bb','ee');
-EXPLAIN
-SELECT t3.a FROM t1,t2,t3
- WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND
- t3.c IN ('bb','ee');
-
-DROP TABLE t1,t2,t3;
-
-#
-# Bug#25172: Not checked buffer size leads to a server crash
-#
-CREATE TABLE t1 ( f1 int primary key, f2 int, f3 int, f4 int, f5 int, f6 int, checked_out int);
-CREATE TABLE t2 ( f11 int PRIMARY KEY );
-INSERT INTO t1 VALUES (1,1,1,0,0,0,0),(2,1,1,3,8,1,0),(3,1,1,4,12,1,0);
-INSERT INTO t2 VALUES (62);
-SELECT * FROM t1 LEFT JOIN t2 ON f11 = t1.checked_out GROUP BY f1 ORDER BY f2, f3, f4, f5 LIMIT 0, 1;
-DROP TABLE t1, t2;
-
-#
-# Bug#6298: LIMIT #, -1 no longer works to set start with no end limit
-#
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1(a int);
-INSERT into t1 values (1), (2), (3);
-
-# LIMIT N, -1 was accepted by accident in 4.0, but was not intended.
-# This test verifies that this illegal construct is now properly detected.
-
---error ER_PARSE_ERROR
-SELECT * FROM t1 LIMIT 2, -1;
-
-DROP TABLE t1;
-
-#
-# 25407: wrong estimate of NULL keys for unique indexes
-#
-
-CREATE TABLE t1 (
- ID_with_null int NULL,
- ID_better int NOT NULL,
- INDEX idx1 (ID_with_null),
- INDEX idx2 (ID_better)
-);
-
-INSERT INTO t1 VALUES (1,1), (2,1), (null,3), (null,3), (null,3), (null,3);
-INSERT INTO t1 SELECT * FROM t1 WHERE ID_with_null IS NULL;
-INSERT INTO t1 SELECT * FROM t1 WHERE ID_with_null IS NULL;
-INSERT INTO t1 SELECT * FROM t1 WHERE ID_with_null IS NULL;
-INSERT INTO t1 SELECT * FROM t1 WHERE ID_with_null IS NULL;
-INSERT INTO t1 SELECT * FROM t1 WHERE ID_with_null IS NULL;
-
-SELECT COUNT(*) FROM t1 WHERE ID_with_null IS NULL;
-SELECT COUNT(*) FROM t1 WHERE ID_better=1;
-
-EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID_with_null IS NULL;
-
-DROP INDEX idx1 ON t1;
-CREATE UNIQUE INDEX idx1 ON t1(ID_with_null);
-
-EXPLAIN SELECT * FROM t1 WHERE ID_better=1 AND ID_with_null IS NULL;
-
-DROP TABLE t1;
-
-CREATE TABLE t1 (
- ID1_with_null int NULL,
- ID2_with_null int NULL,
- ID_better int NOT NULL,
- INDEX idx1 (ID1_with_null, ID2_with_null),
- INDEX idx2 (ID_better)
-);
-
-INSERT INTO t1 VALUES (1,1,1), (2,2,1), (3,null,3), (null,3,3), (null,null,3),
- (3,null,3), (null,3,3), (null,null,3), (3,null,3), (null,3,3), (null,null,3);
-
-INSERT INTO t1 SELECT * FROM t1 WHERE ID1_with_null IS NULL;
-INSERT INTO t1 SELECT * FROM t1 WHERE ID2_with_null IS NULL;
-INSERT INTO t1 SELECT * FROM t1 WHERE ID1_with_null IS NULL;
-INSERT INTO t1 SELECT * FROM t1 WHERE ID2_with_null IS NULL;
-INSERT INTO t1 SELECT * FROM t1 WHERE ID1_with_null IS NULL;
-INSERT INTO t1 SELECT * FROM t1 WHERE ID2_with_null IS NULL;
-
-SELECT COUNT(*) FROM t1 WHERE ID1_with_null IS NULL AND ID2_with_null=3;
-SELECT COUNT(*) FROM t1 WHERE ID1_with_null=3 AND ID2_with_null IS NULL;
-SELECT COUNT(*) FROM t1 WHERE ID1_with_null IS NULL AND ID2_with_null IS NULL;
-SELECT COUNT(*) FROM t1 WHERE ID_better=1;
-
-EXPLAIN SELECT * FROM t1
- WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null=3 ;
-EXPLAIN SELECT * FROM t1
- WHERE ID_better=1 AND ID1_with_null=3 AND ID2_with_null=3 IS NULL ;
-EXPLAIN SELECT * FROM t1
- WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null IS NULL;
-
-DROP INDEX idx1 ON t1;
-CREATE UNIQUE INDEX idx1 ON t1(ID1_with_null,ID2_with_null);
-
-EXPLAIN SELECT * FROM t1
- WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null=3 ;
-EXPLAIN SELECT * FROM t1
- WHERE ID_better=1 AND ID1_with_null=3 AND ID2_with_null IS NULL ;
-EXPLAIN SELECT * FROM t1
- WHERE ID_better=1 AND ID1_with_null IS NULL AND ID2_with_null IS NULL;
-EXPLAIN SELECT * FROM t1
- WHERE ID_better=1 AND ID1_with_null IS NULL AND
- (ID2_with_null=1 OR ID2_with_null=2);
-
-DROP TABLE t1;
-
-#
-# Bug #22344: InnoDB keys act strange on datetime vs timestamp comparison
-#
-CREATE TABLE t1 (a INT, ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, KEY ts(ts));
-INSERT INTO t1 VALUES (30,"2006-01-03 23:00:00"), (31,"2006-01-03 23:00:00");
-ANALYZE TABLE t1;
-
-CREATE TABLE t2 (a INT, dt1 DATETIME, dt2 DATETIME, PRIMARY KEY (a));
-INSERT INTO t2 VALUES (30, "2006-01-01 00:00:00", "2999-12-31 00:00:00");
-INSERT INTO t2 SELECT a+1,dt1,dt2 FROM t2;
-ANALYZE TABLE t2;
-
-EXPLAIN
-SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
- AND t1.ts BETWEEN t2.dt1 AND t2.dt2
- AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
-
-SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
- AND t1.ts BETWEEN t2.dt1 AND t2.dt2
- AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
-
-DROP TABLE t1,t2;
-# Bug #22026: Warning when using IF statement and large unsigned bigint
-#
-
-create table t1 (a bigint unsigned);
-insert into t1 values
- (if(1, 9223372036854775808, 1)),
- (case when 1 then 9223372036854775808 else 1 end),
- (coalesce(9223372036854775808, 1));
-select * from t1;
-drop table t1;
-create table t1 select
- if(1, 9223372036854775808, 1) i,
- case when 1 then 9223372036854775808 else 1 end c,
- coalesce(9223372036854775808, 1) co;
-show create table t1;
-drop table t1;
-# Ensure we handle big values properly
-select
- if(1, cast(1111111111111111111 as unsigned), 1) i,
- case when 1 then cast(1111111111111111111 as unsigned) else 1 end c,
- coalesce(cast(1111111111111111111 as unsigned), 1) co;
-
-#
-# Bug #22971: indexes on text columns are ignored for ref accesses
-#
-
-CREATE TABLE t1 (name varchar(255));
-CREATE TABLE t2 (name varchar(255), n int, KEY (name(3)));
-INSERT INTO t1 VALUES ('ccc'), ('bb'), ('cc '), ('aa '), ('aa');
-INSERT INTO t2 VALUES ('bb',1), ('aa',2), ('cc ',3);
-INSERT INTO t2 VALUES (concat('cc ', 0x06), 4);
-INSERT INTO t2 VALUES ('cc',5), ('bb ',6), ('cc ',7);
-SELECT * FROM t2;
-SELECT * FROM t2 ORDER BY name;
-SELECT name, LENGTH(name), n FROM t2 ORDER BY name;
-
-EXPLAIN SELECT name, LENGTH(name), n FROM t2 WHERE name='cc ';
-SELECT name, LENGTH(name), n FROM t2 WHERE name='cc ';
-EXPLAIN SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%';
-SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%';
-EXPLAIN SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%' ORDER BY name;
-SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%' ORDER BY name;
-EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t1.name=t2.name;
-SELECT * FROM t1 LEFT JOIN t2 ON t1.name=t2.name;
-
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (name text);
-CREATE TABLE t2 (name text, n int, KEY (name(3)));
-INSERT INTO t1 VALUES ('ccc'), ('bb'), ('cc '), ('aa '), ('aa');
-INSERT INTO t2 VALUES ('bb',1), ('aa',2), ('cc ',3);
-INSERT INTO t2 VALUES (concat('cc ', 0x06), 4);
-INSERT INTO t2 VALUES ('cc',5), ('bb ',6), ('cc ',7);
-SELECT * FROM t2;
-SELECT * FROM t2 ORDER BY name;
-SELECT name, LENGTH(name), n FROM t2 ORDER BY name;
-
-EXPLAIN SELECT name, LENGTH(name), n FROM t2 WHERE name='cc ';
-SELECT name, LENGTH(name), n FROM t2 WHERE name='cc ';
-EXPLAIN SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%';
-SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%';
-EXPLAIN SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%' ORDER BY name;
-SELECT name , LENGTH(name), n FROM t2 WHERE name LIKE 'cc%' ORDER BY name;
-EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t1.name=t2.name;
-SELECT * FROM t1 LEFT JOIN t2 ON t1.name=t2.name;
-
-DROP TABLE t1,t2;
-
-
-#
-# Bug #26963: join with predicates that contain fields from equalities evaluated
-# to constants after constant table substitution
-#
-
-CREATE TABLE t1 (
- access_id int NOT NULL default '0',
- name varchar(20) default NULL,
- rank int NOT NULL default '0',
- KEY idx (access_id)
-);
-
-CREATE TABLE t2 (
- faq_group_id int NOT NULL default '0',
- faq_id int NOT NULL default '0',
- access_id int default NULL,
- UNIQUE KEY idx1 (faq_id),
- KEY idx2 (faq_group_id,faq_id)
-);
-
-INSERT INTO t1 VALUES
- (1,'Everyone',2),(2,'Help',3),(3,'Technical Support',1),(4,'Chat User',4);
-INSERT INTO t2 VALUES
- (261,265,1),(490,494,1);
-
-
-SELECT t2.faq_id
- FROM t1 INNER JOIN t2 IGNORE INDEX (idx1)
- ON (t1.access_id = t2.access_id)
- LEFT JOIN t2 t
- ON (t.faq_group_id = t2.faq_group_id AND
- find_in_set(t.access_id, '1,4') < find_in_set(t2.access_id, '1,4'))
- WHERE
- t2.access_id IN (1,4) AND t.access_id IS NULL AND t2.faq_id in (265);
-
-SELECT t2.faq_id
- FROM t1 INNER JOIN t2
- ON (t1.access_id = t2.access_id)
- LEFT JOIN t2 t
- ON (t.faq_group_id = t2.faq_group_id AND
- find_in_set(t.access_id, '1,4') < find_in_set(t2.access_id, '1,4'))
- WHERE
- t2.access_id IN (1,4) AND t.access_id IS NULL AND t2.faq_id in (265);
-
-DROP TABLE t1,t2;
-
-
-#
-# Bug #19372: Optimizer does not use index anymore when WHERE index NOT IN
-# () is added
-#
-CREATE TABLE t1 (a INT, b INT, KEY inx (b,a));
-
-INSERT INTO t1 VALUES (1,1), (1,2), (1,3), (1,4), (1,5), (1, 6), (1,7);
-EXPLAIN SELECT COUNT(*) FROM t1 f1 INNER JOIN t1 f2
- ON ( f1.b=f2.b AND f1.a<f2.a )
- WHERE 1 AND f1.b NOT IN (100,2232,3343,51111);
-DROP TABLE t1;
-
-#
-# Bug #27352: Incorrect result of nested selects instead of error reporting
-#
-
-CREATE TABLE t1 (c1 INT, c2 INT);
-INSERT INTO t1 VALUES (1,11), (2,22), (2,22);
-
-let $n= 31;
-let $q= COUNT(c2);
-while ($n)
-{
- let $q= (SELECT $q);
- dec $n;
-}
---disable_warnings
-eval EXPLAIN SELECT c1 FROM t1 WHERE $q > 0;
---enable_warnings
-
-let $n= 64;
-let $q= COUNT(c2);
-while ($n)
-{
- let $q= (SELECT $q);
- dec $n;
-}
---error ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT
-eval EXPLAIN SELECT c1 FROM t1 WHERE $q > 0;
-
-DROP TABLE t1;
-
-#
-# Bug #30396: crash for a join with equalities and sargable predicates
-# in disjunctive parts of the WHERE condition
-#
-
-CREATE TABLE t1 (
- c1 int(11) NOT NULL AUTO_INCREMENT,
- c2 varchar(1000) DEFAULT NULL,
- c3 bigint(20) DEFAULT NULL,
- c4 bigint(20) DEFAULT NULL,
- PRIMARY KEY (c1)
-);
-
-EXPLAIN EXTENDED
-SELECT join_2.c1
-FROM
- t1 AS join_0,
- t1 AS join_1,
- t1 AS join_2,
- t1 AS join_3,
- t1 AS join_4,
- t1 AS join_5,
- t1 AS join_6,
- t1 AS join_7
-WHERE
- join_0.c1=join_1.c1 AND
- join_1.c1=join_2.c1 AND
- join_2.c1=join_3.c1 AND
- join_3.c1=join_4.c1 AND
- join_4.c1=join_5.c1 AND
- join_5.c1=join_6.c1 AND
- join_6.c1=join_7.c1
- OR
- join_0.c2 < '?' AND
- join_1.c2 < '?' AND
- join_2.c2 > '?' AND
- join_2.c2 < '!' AND
- join_3.c2 > '?' AND
- join_4.c2 = '?' AND
- join_5.c2 <> '?' AND
- join_6.c2 <> '?' AND
- join_7.c2 >= '?' AND
- join_0.c1=join_1.c1 AND
- join_1.c1=join_2.c1 AND
- join_2.c1=join_3.c1 AND
- join_3.c1=join_4.c1 AND
- join_4.c1=join_5.c1 AND
- join_5.c1=join_6.c1 AND
- join_6.c1=join_7.c1
-GROUP BY
- join_3.c1,
- join_2.c1,
- join_7.c1,
- join_1.c1,
- join_0.c1;
-
-SHOW WARNINGS;
-
-DROP TABLE t1;
-
-#
-# Bug #27695: Misleading warning when declaring all space column names and
-# truncation of one-space column names to zero length names.
-#
-
---disable_ps_protocol
-SELECT 1 AS ` `;
-SELECT 1 AS ` `;
-SELECT 1 AS ` x`;
---enable_ps_protocol
-
---error 1166
-CREATE VIEW v1 AS SELECT 1 AS ``;
-
---error 1166
-CREATE VIEW v1 AS SELECT 1 AS ` `;
-
---error 1166
-CREATE VIEW v1 AS SELECT 1 AS ` `;
-
---error 1166
-CREATE VIEW v1 AS SELECT (SELECT 1 AS ` `);
-
-CREATE VIEW v1 AS SELECT 1 AS ` x`;
-SELECT `x` FROM v1;
-
---error 1166
-ALTER VIEW v1 AS SELECT 1 AS ` `;
-
-DROP VIEW v1;
-
-#
-# Bug#31800: Date comparison fails with timezone and slashes for greater
-# than comparison
-#
-
-# On DATETIME-like literals with trailing garbage, BETWEEN fudged in a
-# DATETIME comparator, while greater/less-than used bin-string comparisons.
-# Should correctly be compared as DATE or DATETIME, but throw a warning:
-
-select str_to_date('2007-10-09','%Y-%m-%d') between '2007/10/01 00:00:00 GMT'
- and '2007/10/20 00:00:00 GMT';
-select str_to_date('2007-10-09','%Y-%m-%d') > '2007/10/01 00:00:00 GMT-6';
-select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/20 00:00:00 GMT-6';
-select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6';
-
-# We have all we need -- and trailing garbage:
-# (leaving out a leading zero in first example to prove it's a
-# value-comparison, not a string-comparison!)
-select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6';
-select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 x00:00:00 GMT-6';
-select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:00:00 GMT-6';
-select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 00:x00:00 GMT-6';
-# no time at all:
-select str_to_date('2007-10-01','%Y-%m-%d %H:%i:%s') = '2007-10-01 x12:34:56 GMT-6';
-# partial time:
-select str_to_date('2007-10-01 12:34:00','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6';
-# fail, different second part:
-select str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34x:56 GMT-6';
-# correct syntax, no trailing nonsense -- this one must throw no warning:
-select str_to_date('2007-10-01 12:34:56','%Y-%m-%d %H:%i:%s') = '2007-10-01 12:34:56';
-# no warning, but failure (different hour parts):
-select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-01 12:00:00';
-# succeed:
-select str_to_date('2007-10-01 12','%Y-%m-%d %H') = '2007-10-01 12:00:00';
-# succeed, but warn for "trailing garbage" (":34"):
-select str_to_date('2007-10-01 12:34','%Y-%m-%d %H') = '2007-10-01 12:00:00';
-# invalid date (Feb 30) succeeds
-select str_to_date('2007-02-30 12:34','%Y-%m-%d %H:%i') = '2007-02-30 12:34';
-# 0-day for both, just works in default SQL mode.
-select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34';
-# 0-day, succeed
-select str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01 00:00:00'
- and '2007/10/20 00:00:00';
-set SQL_MODE=TRADITIONAL;
-# 0-day throws warning in traditional mode, and fails
-select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34';
-select str_to_date('2007-10-01 12:34','%Y-%m-%d %H:%i') = '2007-10-00 12:34';
-# different code-path: get_datetime_value() with 0-day
-select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '2007-10-01 12:34';
-select str_to_date('2007-10-00','%Y-%m-%d') between '2007/09/01'
- and '2007/10/20';
-set SQL_MODE=DEFAULT;
-select str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20';
-select str_to_date('','%Y-%m-%d') between '2007/10/01' and '2007/10/20';
-select str_to_date('','%Y-%m-%d %H:%i') = '2007-10-01 12:34';
-select str_to_date(NULL,'%Y-%m-%d %H:%i') = '2007-10-01 12:34';
-select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '';
-
-select str_to_date('1','%Y-%m-%d') = '1';
-select str_to_date('1','%Y-%m-%d') = '1';
-select str_to_date('','%Y-%m-%d') = '';
-
-select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01';
-select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and NULL;
-select str_to_date('2000-01-01','%Y-%m-%d') between NULL and '2001-01-01';
-select str_to_date('2000-01-01','%Y-%m-%d') between '2001-01-01' and NULL;
-select str_to_date('2000-01-01','%Y-%m-%d') between NULL and '1000-01-01';
-select str_to_date('2000-01-01','%Y-%m-%d') between NULL and NULL;
-
-#
-# Bug #30666: Incorrect order when using range conditions on 2 tables or more
-#
-
-CREATE TABLE t1 (c11 INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY);
-CREATE TABLE t2 (c21 INT UNSIGNED NOT NULL,
- c22 INT DEFAULT NULL,
- KEY(c21, c22));
-CREATE TABLE t3 (c31 INT UNSIGNED NOT NULL DEFAULT 0,
- c32 INT DEFAULT NULL,
- c33 INT NOT NULL,
- c34 INT UNSIGNED DEFAULT 0,
- KEY (c33, c34, c32));
-
-INSERT INTO t1 values (),(),(),(),();
-INSERT INTO t2 SELECT a.c11, b.c11 FROM t1 a, t1 b;
-INSERT INTO t3 VALUES (1, 1, 1, 0),
- (2, 2, 0, 0),
- (3, 3, 1, 0),
- (4, 4, 0, 0),
- (5, 5, 1, 0);
-
-# Show that ORDER BY produces the correct results order
-SELECT c32 FROM t1, t2, t3 WHERE t1.c11 IN (1, 3, 5) AND
- t3.c31 = t1.c11 AND t2.c21 = t1.c11 AND
- t3.c33 = 1 AND t2.c22 in (1, 3)
- ORDER BY c32;
-
-# Show that ORDER BY DESC produces the correct results order
-SELECT c32 FROM t1, t2, t3 WHERE t1.c11 IN (1, 3, 5) AND
- t3.c31 = t1.c11 AND t2.c21 = t1.c11 AND
- t3.c33 = 1 AND t2.c22 in (1, 3)
- ORDER BY c32 DESC;
-
-DROP TABLE t1, t2, t3;
-###########################################################################
-
---echo
---echo #
---echo # Bug#30736: Row Size Too Large Error Creating a Table and
---echo # Inserting Data.
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS t2;
---enable_warnings
-
---echo
-
-CREATE TABLE t1(
- c1 DECIMAL(10, 2),
- c2 FLOAT);
-
---echo
-
-INSERT INTO t1 VALUES (0, 1), (2, 3), (4, 5);
-
---echo
-
-CREATE TABLE t2(
- c3 DECIMAL(10, 2))
- SELECT
- c1 * c2 AS c3
- FROM t1;
-
---echo
-
-SELECT * FROM t1;
-
---echo
-
-SELECT * FROM t2;
-
---echo
-
-DROP TABLE t1;
-DROP TABLE t2;
-
---echo
-
-###########################################################################
-
-#
-# Bug #32335: Error on BIGINT > NULL + 1
-#
-
-CREATE TABLE t1 (c1 BIGINT NOT NULL);
-INSERT INTO t1 (c1) VALUES (1);
-SELECT * FROM t1 WHERE c1 > NULL + 1;
-DROP TABLE t1;
-
---echo
-
-###########################################################################
-
-#
-# Bug #33764: Wrong result with IN(), CONCAT() and implicit type conversion
-#
-
-CREATE TABLE t1 (a VARCHAR(10) NOT NULL PRIMARY KEY);
-INSERT INTO t1 (a) VALUES ('foo0'), ('bar0'), ('baz0');
-SELECT * FROM t1 WHERE a IN (CONCAT('foo', 0), 'bar');
-DROP TABLE t1;
-
-#
-# Bug #32942 now() - interval '7200' second is NOT pre-calculated, causing "full table scan"
-#
-
-CREATE TABLE t1 (a INT, b INT);
-CREATE TABLE t2 (a INT, c INT, KEY(a));
-
-INSERT INTO t1 VALUES (1, 1), (2, 2);
-INSERT INTO t2 VALUES (1, 1), (1, 2), (1, 3), (1, 4), (1, 5),
- (2, 1), (2, 2), (2, 3), (2, 4), (2, 5),
- (3, 1), (3, 2), (3, 3), (3, 4), (3, 5),
- (4, 1), (4, 2), (4, 3), (4, 4), (4, 5);
-
-FLUSH STATUS;
-SELECT DISTINCT b FROM t1 LEFT JOIN t2 USING(a) WHERE c <= 3;
-SHOW STATUS LIKE 'Handler_read%';
-DROP TABLE t1, t2;
-
-#
-# Bug#40953 SELECT query throws "ERROR 1062 (23000): Duplicate entry..." error
-#
-CREATE TABLE t1 (f1 bigint(20) NOT NULL default '0',
- f2 int(11) NOT NULL default '0',
- f3 bigint(20) NOT NULL default '0',
- f4 varchar(255) NOT NULL default '',
- PRIMARY KEY (f1),
- KEY key1 (f4),
- KEY key2 (f2));
-CREATE TABLE t2 (f1 int(11) NOT NULL default '0',
- f2 enum('A1','A2','A3') NOT NULL default 'A1',
- f3 int(11) NOT NULL default '0',
- PRIMARY KEY (f1),
- KEY key1 (f3));
-CREATE TABLE t3 (f1 bigint(20) NOT NULL default '0',
- f2 datetime NOT NULL default '1980-01-01 00:00:00',
- PRIMARY KEY (f1));
-
-insert into t1 values (1, 1, 1, 'abc');
-insert into t1 values (2, 1, 2, 'def');
-insert into t1 values (3, 1, 2, 'def');
-insert into t2 values (1, 'A1', 1);
-insert into t3 values (1, '1980-01-01');
-
-SELECT a.f3, cr.f4, count(*) count
-FROM t2 a
-STRAIGHT_JOIN t1 cr ON cr.f2 = a.f1
-LEFT JOIN
-(t1 cr2
- JOIN t3 ae2 ON cr2.f3 = ae2.f1
-) ON a.f1 = cr2.f2 AND ae2.f2 < now() - INTERVAL 7 DAY AND
-cr.f4 = cr2.f4
-GROUP BY a.f3, cr.f4;
-
-drop table t1, t2, t3;
-
-
-#
-# Bug #40925: Equality propagation takes non indexed attribute
-#
-
-CREATE TABLE t1 (a INT KEY, b INT);
-INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4);
-
-EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND a = b LIMIT 2;
-EXPLAIN EXTENDED SELECT a, b FROM t1 WHERE a > 1 AND b = a LIMIT 2;
-
-DROP TABLE t1;
-
-
---echo #
---echo # Bug#47019: Assertion failed: 0, file .\rt_mbr.c, line 138 when
---echo # forcing a spatial index
---echo #
-CREATE TABLE t1(a LINESTRING NOT NULL, SPATIAL KEY(a));
-INSERT INTO t1 VALUES
- (GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)')),
- (GEOMFROMTEXT('LINESTRING(-1 -1, 1 -1, -1 -1, -1 1, 1 1)'));
-EXPLAIN SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2;
-SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2;
-EXPLAIN SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2 FORCE INDEX(a);
-SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2 FORCE INDEX(a);
-DROP TABLE t1;
-
-
---echo #
---echo # Bug #48291 : crash with row() operator,select into @var, and
---echo # subquery returning multiple rows
---echo #
-
-CREATE TABLE t1(a INT);
-INSERT INTO t1 VALUES (2),(3);
-
---echo # Should not crash
---error ER_SUBQUERY_NO_1_ROW
-SELECT 1 FROM t1 WHERE a <> 1 AND NOT
-ROW(1,a) <=> ROW(1,(SELECT 1 FROM t1))
-INTO @var0;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug #48458: simple query tries to allocate enormous amount of
---echo # memory
---echo #
-
-CREATE TABLE t1(a INT NOT NULL, b YEAR);
-INSERT IGNORE INTO t1 VALUES ();
-CREATE TABLE t2(c INT);
---echo # Should not err out because of out-of-memory
-SELECT 1 FROM t2 JOIN t1 ON 1=1
- WHERE a != '1' AND NOT a >= b OR NOT ROW(b,a )<> ROW(a,a);
-DROP TABLE t1,t2;
-
-
---echo #
---echo # Bug #49199: Optimizer handles incorrectly:
---echo # field='const1' AND field='const2' in some cases
---echo
-CREATE TABLE t1(a DATETIME NOT NULL);
-INSERT INTO t1 VALUES('2001-01-01');
-SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00';
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00';
-DROP TABLE t1;
-
-CREATE TABLE t1(a DATE NOT NULL);
-INSERT INTO t1 VALUES('2001-01-01');
-SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00';
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00';
-DROP TABLE t1;
-
-CREATE TABLE t1(a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
-INSERT INTO t1 VALUES('2001-01-01');
-SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00';
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a='2001-01-01 00:00:00';
-DROP TABLE t1;
-
-CREATE TABLE t1(a DATETIME NOT NULL, b DATE NOT NULL);
-INSERT INTO t1 VALUES('2001-01-01', '2001-01-01');
-SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00';
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00';
-DROP TABLE t1;
-
-CREATE TABLE t1(a DATETIME NOT NULL, b VARCHAR(20) NOT NULL);
-INSERT INTO t1 VALUES('2001-01-01', '2001-01-01');
-SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00';
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a=b AND b='2001-01-01 00:00:00';
-
-SELECT * FROM t1 WHERE a='2001-01-01 00:00:00' AND a=b AND b='2001-01-01';
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01 00:00:00' AND a=b AND b='2001-01-01';
-DROP TABLE t1;
-
-CREATE TABLE t1(a DATETIME NOT NULL, b DATE NOT NULL);
-INSERT INTO t1 VALUES('2001-01-01', '2001-01-01');
-SELECT x.a, y.a, z.a FROM t1 x
- JOIN t1 y ON x.a=y.a
- JOIN t1 z ON y.a=z.a
- WHERE x.a='2001-01-01' AND z.a='2001-01-01 00:00:00';
-EXPLAIN EXTENDED SELECT x.a, y.a, z.a FROM t1 x
- JOIN t1 y ON x.a=y.a
- JOIN t1 z ON y.a=z.a
- WHERE x.a='2001-01-01' AND z.a='2001-01-01 00:00:00';
-DROP TABLE t1;
-
-
---echo #
---echo # Bug #49897: crash in ptr_compare when char(0) NOT NULL
---echo # column is used for ORDER BY
---echo #
-SET @old_sort_buffer_size= @@session.sort_buffer_size;
-SET @@sort_buffer_size= 40000;
-
-CREATE TABLE t1(a CHAR(0) NOT NULL);
---disable_warnings
-INSERT IGNORE INTO t1 VALUES (0), (0), (0);
---enable_warnings
-INSERT INTO t1 SELECT t11.a FROM t1 t11, t1 t12;
-INSERT INTO t1 SELECT t11.a FROM t1 t11, t1 t12;
-INSERT INTO t1 SELECT t11.a FROM t1 t11, t1 t12;
-EXPLAIN SELECT a FROM t1 ORDER BY a;
---disable_result_log
-SELECT a FROM t1 ORDER BY a;
---enable_result_log
-DROP TABLE t1;
-
-CREATE TABLE t1(a CHAR(0) NOT NULL, b CHAR(0) NOT NULL, c int);
---disable_warnings
-INSERT IGNORE INTO t1 VALUES (0, 0, 0), (0, 0, 2), (0, 0, 1);
---enable_warnings
-INSERT INTO t1 SELECT t11.a, t11.b, t11.c FROM t1 t11, t1 t12;
-INSERT INTO t1 SELECT t11.a, t11.b, t11.c FROM t1 t11, t1 t12;
-INSERT INTO t1 SELECT t11.a, t11.b, t11.c FROM t1 t11, t1 t12;
-EXPLAIN SELECT a FROM t1 ORDER BY a LIMIT 5;
-SELECT a FROM t1 ORDER BY a LIMIT 5;
-EXPLAIN SELECT * FROM t1 ORDER BY a, b LIMIT 5;
-SELECT * FROM t1 ORDER BY a, b LIMIT 5;
-EXPLAIN SELECT * FROM t1 ORDER BY a, b, c LIMIT 5;
-SELECT * FROM t1 ORDER BY a, b, c LIMIT 5;
-EXPLAIN SELECT * FROM t1 ORDER BY c, a LIMIT 5;
-SELECT * FROM t1 ORDER BY c, a LIMIT 5;
-
-SET @@sort_buffer_size= @old_sort_buffer_size;
-DROP TABLE t1;
-
-
---echo End of 5.0 tests
-
-#
-# Bug #30639: limit offset,rowcount wraps when rowcount >= 2^32 in windows
-#
-create table t1(a INT, KEY (a));
-INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
-SELECT a FROM t1 ORDER BY a LIMIT 2;
-SELECT a FROM t1 ORDER BY a LIMIT 2,4294967296;
-SELECT a FROM t1 ORDER BY a LIMIT 2,4294967297;
-DROP TABLE t1;
-
-#
-# Bug #37936: ASSERT_COLUMN_MARKED_FOR_WRITE in Field_datetime::store ,
-# Field_varstring::store
-#
-
-CREATE TABLE t1 (date_key date);
-
-CREATE TABLE t2 (
- pk int,
- int_nokey int,
- int_key int,
- date_key date NOT NULL,
- date_nokey date,
- varchar_key varchar(1)
-);
-
-INSERT INTO t2 VALUES
-(1,1,1,'0000-00-00',NULL,NULL),
-(1,1,1,'0000-00-00',NULL,NULL);
-
-SELECT 1 FROM t2 WHERE pk > ANY (SELECT 1 FROM t2);
-
-SELECT COUNT(DISTINCT 1) FROM t2
- WHERE date_key = (SELECT 1 FROM t1 WHERE t2.date_key IS NULL) GROUP BY pk;
-SELECT date_nokey FROM t2
- WHERE int_key IN (SELECT 1 FROM t1)
- HAVING date_nokey = '10:41:7'
- ORDER BY date_key;
-
-DROP TABLE t1,t2;
-
-#
-# Bug #42957: no results from
-# select where .. (col=col and col=col) or ... (false expression)
-#
-CREATE TABLE t1 (a INT NOT NULL, b INT);
-INSERT INTO t1 VALUES (1, 1);
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a) OR b > 2;
-SELECT * FROM t1 WHERE (a=a AND a=a) OR b > 2;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL);
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND c=c) OR b > 20;
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a AND b=b) OR b > 20;
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND a=a) OR b > 20;
-DROP TABLE t1;
-
-
---echo #
---echo # Bug#45266: Uninitialized variable lead to an empty result.
---echo #
---disable_warnings
-drop table if exists A,AA,B,BB;
-CREATE TABLE `A` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `date_key` date NOT NULL,
- `date_nokey` date NOT NULL,
- `datetime_key` datetime NOT NULL,
- `int_nokey` int(11) NOT NULL,
- `time_key` time NOT NULL,
- `time_nokey` time NOT NULL,
- PRIMARY KEY (`pk`),
- KEY `date_key` (`date_key`),
- KEY `time_key` (`time_key`),
- KEY `datetime_key` (`datetime_key`)
-);
-
-CREATE TABLE `AA` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `int_nokey` int(11) NOT NULL,
- `time_key` time NOT NULL,
- KEY `time_key` (`time_key`),
- PRIMARY KEY (`pk`)
-);
-
-CREATE TABLE `B` (
- `date_nokey` date NOT NULL,
- `date_key` date NOT NULL,
- `time_key` time NOT NULL,
- `datetime_nokey` datetime NOT NULL,
- `varchar_key` varchar(1) NOT NULL,
- KEY `date_key` (`date_key`),
- KEY `time_key` (`time_key`),
- KEY `varchar_key` (`varchar_key`)
-);
-
-INSERT INTO `B` VALUES ('2003-07-28','2003-07-28','15:13:38','0000-00-00 00:00:00','f'),('0000-00-00','0000-00-00','00:05:48','2004-07-02 14:34:13','x');
-
-CREATE TABLE `BB` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `int_nokey` int(11) NOT NULL,
- `date_key` date NOT NULL,
- `varchar_nokey` varchar(1) NOT NULL,
- `date_nokey` date NOT NULL,
- PRIMARY KEY (`pk`),
- KEY `date_key` (`date_key`)
-);
-
-INSERT INTO `BB` VALUES (10,8,'0000-00-00','i','0000-00-00'),(11,0,'2005-08-18','','2005-08-18');
-# Test #1
-SELECT table1 . `pk` AS field1
- FROM
- (BB AS table1 INNER JOIN
- (AA AS table2 STRAIGHT_JOIN A AS table3
- ON ( table3 . `date_key` = table2 . `pk` ))
- ON ( table3 . `datetime_key` = table2 . `int_nokey` ))
- WHERE ( table3 . `date_key` <= 4 AND table2 . `pk` = table1 . `varchar_nokey`)
- GROUP BY field1 ;
-
-SELECT table3 .`date_key` field1
- FROM
- B table1 LEFT JOIN B table3 JOIN
- (BB table6 JOIN A table7 ON table6 .`varchar_nokey`)
- ON table6 .`int_nokey` ON table6 .`date_key`
- WHERE NOT ( table1 .`varchar_key` AND table7 .`pk`) GROUP BY field1;
-
-# Test #2
-SELECT table4 . `time_nokey` AS field1 FROM
- (AA AS table1 CROSS JOIN
- (AA AS table2 STRAIGHT_JOIN
- (B AS table3 STRAIGHT_JOIN A AS table4
- ON ( table4 . `date_key` = table3 . `time_key` ))
- ON ( table4 . `pk` = table3 . `date_nokey` ))
- ON ( table4 . `time_key` = table3 . `datetime_nokey` ))
- WHERE ( table4 . `time_key` < table1 . `time_key` AND
- table1 . `int_nokey` != 'f')
- GROUP BY field1 ORDER BY field1 , field1;
-
-SELECT table1 .`time_key` field2 FROM B table1 LEFT JOIN BB JOIN A table5 ON table5 .`date_nokey` ON table5 .`int_nokey` GROUP BY field2;
---enable_warnings
-
-drop table A,AA,B,BB;
---echo #end of test for bug#45266
-
---echo #
---echo # Bug#33546: Slowdown on re-evaluation of constant expressions.
---echo #
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
-CREATE TABLE t2 (b INT);
-INSERT INTO t2 VALUES (2);
-SELECT * FROM t1 WHERE a = 1 + 1;
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = 1 + 1;
-SELECT * FROM t1 HAVING a = 1 + 1;
-EXPLAIN EXTENDED SELECT * FROM t1 HAVING a = 1 + 1;
-SELECT * FROM t1, t2 WHERE a = b + (1 + 1);
-EXPLAIN EXTENDED SELECT * FROM t1, t2 WHERE a = b + (1 + 1);
-SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1;
-EXPLAIN EXTENDED SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1;
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > UNIX_TIMESTAMP('2009-03-10 00:00:00');
-
-delimiter |;
-CREATE FUNCTION f1() RETURNS INT DETERMINISTIC
-BEGIN
- SET @cnt := @cnt + 1;
- RETURN 1;
-END;|
-delimiter ;|
-
-SET @cnt := 0;
-SELECT * FROM t1 WHERE a = f1();
-SELECT @cnt;
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = f1();
-DROP TABLE t1, t2;
-DROP FUNCTION f1;
---echo # End of bug#33546
-
---echo #
---echo # BUG#48052: Valgrind warning - uninitialized value in init_read_record()
---echo #
-
-# Needed in 6.0 codebase
-#--echo # Disable Index condition pushdown
-#--replace_column 1 #
-#SELECT @old_icp:=@@engine_condition_pushdown;
-#SET SESSION engine_condition_pushdown = 'OFF';
-
-CREATE TABLE t1 (
- pk int(11) NOT NULL,
- i int(11) DEFAULT NULL,
- v varchar(1) DEFAULT NULL,
- PRIMARY KEY (pk)
-);
-
-INSERT INTO t1 VALUES (2,7,'m');
-INSERT INTO t1 VALUES (3,9,'m');
-
-SELECT v
-FROM t1
-WHERE NOT pk > 0
-HAVING v <= 't'
-ORDER BY pk;
-
-# Needed in 6.0 codebase
-#--echo # Restore old value for Index condition pushdown
-#SET SESSION engine_condition_pushdown=@old_icp;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug#49489 Uninitialized cache led to a wrong result.
---echo #
-CREATE TABLE t1(c1 DOUBLE(5,4));
-INSERT INTO t1 VALUES (9.1234);
-SELECT * FROM t1 WHERE c1 < 9.12345;
-DROP TABLE t1;
---echo # End of test for bug#49489.
-
-
---echo #
---echo # Bug #49517: Inconsistent behavior while using
---echo # NULLable BIGINT and INT columns in comparison
---echo #
-CREATE TABLE t1(a BIGINT UNSIGNED NOT NULL, b BIGINT NULL, c INT NULL);
-INSERT INTO t1 VALUES(105, NULL, NULL);
-SELECT * FROM t1 WHERE b < 102;
-SELECT * FROM t1 WHERE c < 102;
-SELECT * FROM t1 WHERE 102 < b;
-SELECT * FROM t1 WHERE 102 < c;
-DROP TABLE t1;
-
-
---echo #
---echo # Bug #54459: Assertion failed: param.sort_length,
---echo # file .\filesort.cc, line 149 (part II)
---echo #
-CREATE TABLE t1(a ENUM('') NOT NULL);
-INSERT INTO t1 VALUES (), (), ();
-EXPLAIN SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci;
-SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci;
-DROP TABLE t1;
-
---echo #
---echo # Bug #702310: usage of 2 join buffers after ref access to an empty table
---echo #
-
-CREATE TABLE t1 (f1 int) ;
-INSERT INTO t1 VALUES (9);
-
-CREATE TABLE t2 (f1 int);
-INSERT INTO t2 VALUES (3),(7),(18);
-INSERT INTO t2 VALUES (3),(7),(18);
-INSERT INTO t2 VALUES (3),(7),(18);
-INSERT INTO t2 VALUES (3),(7),(18);
-
-CREATE TABLE t3 (f1 int);
-INSERT INTO t3 VALUES (17);
-
-CREATE TABLE t4 (f1 int PRIMARY KEY, f2 varchar(1024)) ;
-
-CREATE TABLE t5 (f1 int) ;
-INSERT INTO t5 VALUES (20),(5);
-
-CREATE TABLE t6(f1 int);
-INSERT INTO t6 VALUES (9),(7);
-
-SET SESSION join_buffer_size = 2176;
-
-EXPLAIN
-SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;
-SELECT STRAIGHT_JOIN * FROM t2, (t1 LEFT JOIN (t3,t4) ON t1.f1 = t4.f1), t5, t6;
-
-SET SESSION join_buffer_size = DEFAULT;
-
-DROP TABLE t1,t2,t3,t4,t5,t6;
-
---echo #
---echo # Bug #698882: best equality substitution not applied to ref
---echo #
-
-CREATE TABLE t1 (a1 int NOT NULL, b1 char(10), INDEX idx (a1));
-CREATE TABLE t2 (a2 int NOT NULL, b2 char(10), INDEX idx (a2));
-CREATE TABLE t3 (a3 int NOT NULL, b3 char(10), INDEX idx (a3));
-INSERT INTO t1 VALUES (2,'xx'), (1,'xxx'), (11,'xxxxxxx');
-INSERT INTO t2 VALUES
- (7,'yyyy'), (2,'y'), (3,'yyy'), (1,'yy'), (1,'yyyyy'),
- (3,'yy'), (1,'y'), (4,'yyy'), (7,'y'), (4,'yyyyy'), (7,'yyy'),
- (7,'yyyy'), (2,'yy'), (3,'yyy'), (1,'yyyyyyyy'), (1,'yyyyy'),
- (3,'yy'), (1,'yyy'), (4,'yyy'), (7,'y'), (4,'yyyyy'), (7,'yyy');
-INSERT INTO t3 VALUES
- (9,'zzzzzzz'), (2,'zzzzz'), (1,'z'), (9,'zz'), (1,'zz'), (5,'zzzzzzz'),
- (4,'zz'), (3,'z'), (5,'zzzzzz'), (3,'zz'), (4,'zzzz'), (3,'z'),
- (9,'zzzzzzzz'), (2,'zz'), (1,'zz'), (9,'zzz'), (1,'zzz'), (5,'zzzzzzzz'),
- (4,'zzz'), (3,'zz'), (5,'zzzzzzz'), (3,'zzz'), (4,'zzzzz'), (3,'zz'),
- (9,'zzzzzz'), (2,'zzzz'), (1,'zzz'), (9,'z'), (1,'z'), (5,'zzzzzz'),
- (4,'z'), (3,'zzz'), (5,'zzzzz'), (3,'z'), (4,'zzz'), (3,'zzzz'),
- (9,'zzzzz'), (2,'zzz'), (1,'zzzz'), (9,'zzz'), (1,'zzzz'), (5,'zzzzz'),
- (4,'zzz'), (3,'zzzz'), (5,'zzzz'), (3,'zzz'), (4,'zz'), (3,'zzzzz');
-
-set @tmp= @@optimizer_switch;
-SET SESSION optimizer_switch='index_condition_pushdown=off';
-
-EXPLAIN SELECT * from t1,t2,t3 WHERE t3.a3=t1.a1 AND t2.a2=t1.a1;
-EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.a2=t1.a1 AND t3.a3=t1.a1;
-EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.a2=t1.a1 AND t3.a3=t2.a2;
-
---sorted_result
-SELECT * from t1,t2,t3
- WHERE t3.a3=t1.a1 AND t2.a2=t1.a1 AND
- LENGTH(CONCAT(CONCAT(t1.b1,t2.b2),t3.b3)) <= 7;
---sorted_result
-SELECT * FROM t1,t2,t3
- WHERE t2.a2=t1.a1 AND t3.a3=t1.a1 AND
- LENGTH(CONCAT(CONCAT(t1.b1,t2.b2),t3.b3)) <= 7;
---sorted_result
-SELECT * FROM t1,t2,t3
- WHERE t2.a2=t1.a1 AND t3.a3=t2.a2 AND
- LENGTH(CONCAT(CONCAT(t1.b1,t2.b2),t3.b3)) <= 7;
-
-SET SESSION optimizer_switch=@tmp;
-
-DROP TABLE t1,t2,t3;
-
-
---echo #
---echo # Bug #707555: crash with equality substitution in ref
---echo #
-
-CREATE TABLE t1 (f11 int, f12 int, PRIMARY KEY (f11), KEY (f12)) ;
-INSERT INTO t1 VALUES (1,NULL), (8,NULL);
-
-CREATE TABLE t2 (f21 int, f22 int, f23 int, KEY (f22)) ;
-INSERT INTO t2 VALUES (1,NULL,3), (2,7,8);
-
-CREATE TABLE t3 (f31 int, f32 int(11), PRIMARY KEY (f31), KEY (f32)) ;
-INSERT INTO t3 VALUES (1,494862336);
-
-CREATE TABLE t4 (f41 int, f42 int, PRIMARY KEY (f41), KEY (f42)) ;
-INSERT INTO t4 VALUES (1,NULL), (8,NULL);
-
-CREATE TABLE t5 (f51 int, PRIMARY KEY (f51)) ;
-INSERT IGNORE INTO t5 VALUES (100);
-
-CREATE TABLE t6 (f61 int, f62 int, KEY (f61)) ;
-INSERT INTO t6 VALUES (NULL,1), (3,10);
-
-CREATE TABLE t7 (f71 int, f72 int, KEY (f72)) ;
-INSERT INTO t7 VALUES (1,NULL), (2,7);
-
-EXPLAIN
-SELECT t2.f23 FROM
- (t1 LEFT JOIN (t2 JOIN t3 ON t2.f22=t3.f32) ON t1.f11=t3.f31)
- LEFT JOIN
- (((t4 JOIN t5 ON t4.f42=t5.f51) LEFT JOIN t6 ON t6.f62>0) JOIN t7 ON t6.f61>0)
- ON t3.f31 = t6.f61
- WHERE t7.f71>0;
-
-SELECT t2.f23 FROM
- (t1 LEFT JOIN (t2 JOIN t3 ON t2.f22=t3.f32) ON t1.f11=t3.f31)
- LEFT JOIN
- (((t4 JOIN t5 ON t4.f42=t5.f51) LEFT JOIN t6 ON t6.f62>0) JOIN t7 ON t6.f61>0)
- ON t3.f31 = t6.f61
- WHERE t7.f71>0;
-
-DROP TABLE t1,t2,t3,t4,t5,t6,t7;
-#
-# Bug #780425: "sql_buffer_result=1 gives wrong result for GROUP BY with a
-# constant expression"
-#
-
-CREATE TABLE t1(f1 int UNSIGNED) engine=myisam;
-INSERT INTO t1 VALUES (3),(2),(1);
-set sql_buffer_result=0;
-SELECT f1 FROM t1 GROUP BY 1;
-SELECT f1 FROM t1 GROUP BY '123' = 'abc';
-SELECT 1 FROM t1 GROUP BY 1;
-set sql_buffer_result=1;
-SELECT f1 FROM t1 GROUP BY 1;
-SELECT f1 FROM t1 GROUP BY '123' = 'abc';
-SELECT 1 FROM t1 GROUP BY 1;
-drop table t1;
-set sql_buffer_result= 0;
-
-
---echo #
---echo # Bug #58422: Incorrect result when OUTER JOIN'ing
---echo # with an empty table
---echo #
-
-CREATE TABLE t_empty(pk INT PRIMARY KEY, i INT) ENGINE = MYISAM;
-CREATE TABLE t1(pk INT PRIMARY KEY, i INT) ENGINE = MYISAM;
-INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
-CREATE TABLE t2(pk INT PRIMARY KEY, i INT) ENGINE = MYISAM;
-INSERT INTO t2 VALUES (1,1), (2,2), (3,3);
-
-EXPLAIN
-SELECT *
- FROM
- t1
- LEFT OUTER JOIN
- (t2 INNER JOIN t_empty ON TRUE)
- ON t1.pk=t2.pk
- WHERE t2.pk <> 2;
-
-SELECT *
- FROM
- t1
- LEFT OUTER JOIN
- (t2 INNER JOIN t_empty ON TRUE)
- ON t1.pk=t2.pk
- WHERE t2.pk <> 2;
-
-
-EXPLAIN
-SELECT *
- FROM
- t1
- LEFT OUTER JOIN
- (t2 CROSS JOIN t_empty)
- ON t1.pk=t2.pk
- WHERE t2.pk <> 2;
-
-SELECT *
- FROM
- t1
- LEFT OUTER JOIN
- (t2 CROSS JOIN t_empty)
- ON t1.pk=t2.pk
- WHERE t2.pk <> 2;
-
-
-EXPLAIN
-SELECT *
- FROM
- t1
- LEFT OUTER JOIN
- (t2 INNER JOIN t_empty ON t_empty.i=t2.i)
- ON t1.pk=t2.pk
- WHERE t2.pk <> 2;
-
-SELECT *
- FROM
- t1
- LEFT OUTER JOIN
- (t2 INNER JOIN t_empty ON t_empty.i=t2.i)
- ON t1.pk=t2.pk
- WHERE t2.pk <> 2;
-
-
-
-DROP TABLE t1,t2,t_empty;
-
-
---echo End of 5.1 tests
-
---echo #
---echo # Bug#45227: Lost HAVING clause led to a wrong result.
---echo #
-CREATE TABLE `CC` (
- `int_nokey` int(11) NOT NULL,
- `int_key` int(11) NOT NULL,
- `varchar_key` varchar(1) NOT NULL,
- `varchar_nokey` varchar(1) NOT NULL,
- KEY `int_key` (`int_key`),
- KEY `varchar_key` (`varchar_key`)
-);
-INSERT INTO `CC` VALUES
-(0,8,'q','q'),(5,8,'m','m'),(7,3,'j','j'),(1,2,'z','z'),(8,2,'a','a'),(2,6,'',''),(1,8,'e'
-,'e'),(8,9,'t','t'),(5,2,'q','q'),(4,6,'b','b'),(5,5,'w','w'),(3,2,'m','m'),(0,4,'x','x'),
-(8,9,'',''),(0,6,'w','w'),(4,5,'x','x'),(0,0,'e','e'),(0,0,'e','e'),(2,8,'p','p'),(0,0,'x'
-,'x');
-EXPLAIN SELECT `varchar_nokey` G1 FROM CC WHERE `int_nokey` AND `int_key` <= 4
- HAVING G1 ORDER BY `varchar_key` LIMIT 6 ;
-
-SELECT `varchar_nokey` G1 FROM CC WHERE `int_nokey` AND `int_key` <= 4
- HAVING G1 ORDER BY `varchar_key` LIMIT 6 ;
-
-DROP TABLE CC;
---echo # End of test#45227
---echo #
---echo # BUG#776274: substitution of a single row table
---echo #
-
-CREATE TABLE t1 (a int NOT NULL , b int);
-INSERT INTO t1 VALUES (2,2);
-
-SELECT * FROM t1 WHERE a = b;
-EXPLAIN
-SELECT * FROM t1 WHERE a = b;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug#54515: Crash in opt_range.cc::get_best_group_min_max on
---echo # SELECT from VIEW with GROUP BY
---echo #
-
-CREATE TABLE t1 (
- col_int_key int DEFAULT NULL,
- KEY int_key (col_int_key)
-) ;
-
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE VIEW view_t1 AS
- SELECT t1.col_int_key AS col_int_key
- FROM t1;
-
-SELECT col_int_key FROM view_t1 GROUP BY col_int_key;
-
-DROP VIEW view_t1;
-DROP TABLE t1;
-
---echo # End of test BUG#54515
-
---echo #
---echo # Bug #57203 Assertion `field_length <= 255' failed.
---echo #
-
---error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
-SELECT coalesce((avg(distinct (geomfromtext("point(25379 -22010)")))))
-UNION ALL
-SELECT coalesce((avg(distinct (geomfromtext("point(25379 -22010)")))))
-AS foo
-;
-
-CREATE table t1(a text);
-INSERT INTO t1 VALUES (''), ('');
-SELECT avg(distinct(t1.a)) FROM t1, t1 t2
-GROUP BY t2.a ORDER BY t1.a;
-
-DROP TABLE t1;
-
---echo # End of test BUG#57203
-
---echo #
---echo # lp:822760 Wrong result with view + invalid dates
---echo #
-CREATE TABLE t1 (f1 date);
-INSERT IGNORE INTO t1 VALUES ('0000-00-00');
-CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1;
-SELECT * FROM t1 HAVING f1 = 'zz';
-SELECT * FROM t1 HAVING f1 <= 'aa' ;
-SELECT * FROM t1 HAVING f1 = 'zz' AND f1 <= 'aa' ;
-SELECT * FROM t1 WHERE f1 = 'zz' AND f1 <= 'aa' ;
-SELECT * FROM v1 HAVING f1 = 'zz' AND f1 <= 'aa' ;
-DROP TABLE t1;
-DROP VIEW v1;
-
---echo #
---echo # Bug#63020: Function "format"'s 'locale' argument is not considered
---echo # when creating a "view'
---echo #
-
-CREATE TABLE t1 (f1 DECIMAL(10,2));
-INSERT INTO t1 VALUES (11.67),(17865.3),(12345678.92);
-CREATE VIEW view_t1 AS SELECT FORMAT(f1,1,'sk_SK') AS f1 FROM t1;
-SHOW CREATE VIEW view_t1;
-SELECT * FROM view_t1;
-DROP TABLE t1;
-DROP VIEW view_t1;
---echo # End of test BUG#63020
-
---echo #
---echo # Bug #13571700 TINYBLOB NOT NULL, CRASH IN PROTOCOL::NET_STORE_DATA
---echo #
-
-CREATE TABLE t1 (a TINYBLOB NOT NULL);
-SELECT a, COUNT(*) FROM t1 WHERE 0;
-DROP TABLE t1;
-
-SET optimizer_switch=@save_optimizer_switch;
-
---echo #
---echo # LP bug#994275 Assertion `real->type() == Item::FIELD_ITEM' failed
---echo # in add_not_null_conds(JOIN*) with JOIN, ZEROFILL column, PK
---echo #
-
-CREATE TABLE t1 ( a INT(6) ZEROFILL );
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE TABLE t2 ( b INT PRIMARY KEY );
-INSERT INTO t2 VALUES (3),(4);
-SELECT * FROM t1, t2 WHERE a=3 AND a=b;
-drop table t1,t2;
-
---echo #
---echo # Bug mdev-4250: wrong transformation of WHERE condition with OR
---echo #
-
-CREATE TABLE t1 (pk int PRIMARY KEY, a int);
-INSERT INTO t1 VALUES (3,0), (2,0), (4,1), (5,0), (1,0);
-
-SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0;
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0;
-
-DROP TABLE t1;
-
-SELECT * FROM mysql.time_zone
-WHERE ( NOT (Use_leap_seconds <= Use_leap_seconds AND Time_zone_id != 1)
- AND Time_zone_id = Time_zone_id
- OR Time_zone_id <> Time_zone_id )
- AND Use_leap_seconds <> 'N';
-
---echo #
---echo # Bug mdev-4274: result of simplification of OR badly merged
---echo # into embedding AND
---echo #
-
-CREATE TABLE t1 (a int, b int, INDEX idx(b)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (8,8);
-
-CREATE TABLE t2 (c int, INDEX idx(c)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (8), (9);
-
-EXPLAIN EXTENDED
-SELECT * FROM t1 INNER JOIN t2 ON ( c = a )
- WHERE 1 IS NULL OR b < 33 AND b = c;
-SELECT * FROM t1 INNER JOIN t2 ON ( c = a )
- WHERE 1 IS NULL OR b < 33 AND b = c;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug mdev-4413: another manifestations of bug mdev-4274
---echo # (valgrind complains)
---echo #
-
-CREATE TABLE t1 (a int, b int) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (7,1);
-
-CREATE TABLE t2 (c int) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (0), (8);
-
-SELECT * FROM t1, t2
- WHERE c = a AND
- ( 0 OR ( b BETWEEN 45 AND 300 OR a > 45 AND a < 100 ) AND b = c );
-
-DROP TABLE t1, t2;
-
---echo #
---echo # Bug mdev-4355: equalities from the result of simplification of OR
---echo # are not propagated to lower AND levels
---echo #
-
-CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,101),(2,102),(3,103),(4,104),(5,11);
-
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE (1 != 1 OR a = 5) AND (b != 1 OR a = 1);
-SELECT * FROM t1 WHERE (1 != 1 OR a = 5) AND (b != 1 OR a = 1);
-
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (1 != 1 OR a = 5);
-SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (1 != 1 OR a = 5);
-
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (a = 5 OR 1 != 1);
-SELECT * FROM t1 WHERE (b != 1 OR a = 1) AND (a = 5 OR 1 != 1);
-
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE (b = 1 OR a = 1) AND (b = 5 AND a = 5 OR 1 != 1);
-SELECT * FROM t1 WHERE (b = 1 OR a = 1) AND (b = 5 AND a = 5 OR 1 != 1);
-
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE (b = 1 OR a = 5) AND (b = 5 AND a = 5 OR 1 != 1);
-SELECT * FROM t1 WHERE (b = 1 OR a = 5) AND (b = 5 AND a = 5 OR 1 != 1);
-
-DROP TABLE t1;
-
---echo #
---echo # Bug mdev-4418: impossible multiple equality in OR formula
---echo # after row substitution
---echo #
-
-CREATE TABLE t1 (a int, b varchar(1)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (0,'j'), (8,'v');
-
-CREATE TABLE t2 (c varchar(1), d varchar(1)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES ('k','k');
-
-EXPLAIN EXTENDED
-SELECT * FROM t1, t2 WHERE c=b AND (1=2 OR ((b='h' OR a=136) AND d=b));
-SELECT * FROM t1, t2 WHERE c=b AND (1=2 OR ((b='h' OR a=136) AND d=b));
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug mdev-4944: range conditition in OR formula with fields
---echo # belonging to multiple equalities
---echo #
-
-CREATE TABLE t1 (i1 int, j1 int) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,8);
-
-CREATE TABLE t2 (i2 int, INDEX idx (i2)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (8), (9);
-
-EXPLAIN EXTENDED
-SELECT * FROM t1, t2
- WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 );
-SELECT * FROM t1, t2
- WHERE i1 = i2 AND ( FALSE OR ( j1 > 27 AND j1 < 100 OR j1 <= 3 ) AND j1 = i2 );
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug mdev-4971: equality propagation after merging degenerate
---echo # disjunction into embedding AND level
---echo #
-
-CREATE TABLE t1 (pk1 int, a1 int, b1 int, PRIMARY KEY(pk1)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,10,100), (2,20,200) ;
-
-CREATE TABLE t2 (pk2 int, a2 int, PRIMARY KEY(pk2)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (1,1);
-
-SELECT * FROM t1, t2
- WHERE a1 = pk2 AND ( ( b1 = 6 OR a2 > 4 ) AND pk2 = a2 OR pk1 IS NULL );
-EXPLAIN EXTENDED
-SELECT * FROM t1, t2
- WHERE a1 = pk2 AND ( ( b1 = 6 OR a2 > 4 ) AND pk2 = a2 OR pk1 IS NULL );
-
-INSERT INTO t1 VALUES (3,1,6);
-SELECT * FROM t1, t2
- WHERE a1 = pk2 AND ( ( b1 = 6 OR a2 > 4 ) AND pk2 = a2 OR pk1 IS NULL );
-
-DROP TABLE t1,t2;
-
---echo End of 5.3 tests
-
---echo #
---echo # mysql BUG#1271 Undefined variable in PASSWORD()
---echo # function is not handled correctly
---echo #
-
-create table t1 (
-name VARCHAR(50) NOT NULL PRIMARY KEY,
-pw VARCHAR(41) NOT NULL);
-
-INSERT INTO t1 (name, pw)
-VALUES ('tom', PASSWORD('my_pw'));
-
-SET @pass='my_pw';
-SET @wrong='incorrect';
-
-select * from t1;
-select length(PASSWORD(@pass));
-
-
-SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@pass);
-SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@wrong);
-SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@undefined);
-
-
-select (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@pass));
-select (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@wrong));
-select (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@undefined));
-
-drop table t1;
-
---echo End of 10.0 tests
diff --git a/mysql-test/t/select_debug.test b/mysql-test/t/select_debug.test
deleted file mode 100644
index 49415400db3..00000000000
--- a/mysql-test/t/select_debug.test
+++ /dev/null
@@ -1,19 +0,0 @@
---source include/have_debug.inc
-
---echo #
---echo # Bug #725050: print keyuse info when hash join is used
---echo #
-
-create table t1 (a int, b int);
-insert into t1 values (2,2), (1,1);
-create table t2 (a int);
-insert into t2 values (2), (3);
-
-set session join_cache_level=3;
-set @@debug_dbug= 'd,opt';
-
-explain select t1.b from t1,t2 where t1.b=t2.a;
-select t1.b from t1,t2 where t1.b=t2.a;
-
-set session join_cache_level=default;
-drop table t1,t2;
diff --git a/mysql-test/t/select_found.test b/mysql-test/t/select_found.test
deleted file mode 100644
index 33613697722..00000000000
--- a/mysql-test/t/select_found.test
+++ /dev/null
@@ -1,289 +0,0 @@
-#
-# Testing of found_rows()
-#
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-create table t1 (a int not null auto_increment, b int not null, primary key(a));
-insert into t1 (b) values (2),(3),(5),(5),(5),(6),(7),(9);
-select SQL_CALC_FOUND_ROWS * from t1;
-select found_rows();
-select SQL_CALC_FOUND_ROWS * from t1 limit 1;
-select found_rows();
-select SQL_BUFFER_RESULT SQL_CALC_FOUND_ROWS * from t1 limit 1;
-select found_rows();
-select SQL_CALC_FOUND_ROWS * from t1 order by b desc limit 1;
-select found_rows();
-select SQL_CALC_FOUND_ROWS distinct b from t1 limit 1;
-select found_rows();
-select SQL_CALC_FOUND_ROWS b,count(*) as c from t1 group by b order by c desc limit 1;
-select found_rows();
-select SQL_CALC_FOUND_ROWS * from t1 left join t1 as t2 on (t1.b=t2.a) limit 2,1;
-select found_rows();
-drop table t1;
-
-#
-# Test SQL_CALC_FOUND_ROWS optimization when used with one table and filesort
-#
-
-create table t1 (a int not null primary key);
-insert into t1 values (1),(2),(3),(4),(5);
-select sql_calc_found_rows a from t1 where a in (1,2,3) order by a desc limit 0,2;
-select FOUND_ROWS();
-select sql_calc_found_rows a from t1 where a in (1,2,3) order by a+2 desc limit 0,2;
-select FOUND_ROWS();
-drop table t1;
-
-#
-# Test of SQL_CALC_FOUND_ROWS with DISTINCT
-#
-
-CREATE TABLE t1 (
-`id` smallint(5) unsigned NOT NULL auto_increment,
-`kid` smallint(5) unsigned NOT NULL default '0',
-PRIMARY KEY (`id`),
-KEY `kid` (`kid`)
-);
-
-CREATE TABLE t2 (
- id smallint(5) unsigned NOT NULL auto_increment,
- name varchar(50) NOT NULL default '',
- email varchar(50) NOT NULL default '',
- PRIMARY KEY (id),
- UNIQUE KEY e_n (email,name)
-);
-
---disable_query_log
-begin;
-let $1=200;
-let $2=0;
-while ($1)
-{
- inc $2;
- eval INSERT INTO t2 VALUES ($2,'name$2','email$2');
- dec $1;
-}
-commit;
---enable_query_log
-
-EXPLAIN SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10;
-SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10;
-SELECT FOUND_ROWS();
-
-SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL order by email LIMIT 10;
-SELECT FOUND_ROWS();
-
-SELECT DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10;
-SELECT DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL ORDER BY email LIMIT 10;
-INSERT INTO `t1` (`id`, `kid`) VALUES ('0', '150');
-
-SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10;
-SELECT FOUND_ROWS();
-
-drop table t1,t2;
-
-#
-# Test bug when using range optimization
-#
-
-CREATE TABLE `t1` (
- `titre` char(80) NOT NULL default '',
- `numeropost` mediumint(8) unsigned NOT NULL auto_increment,
- `maxnumrep` int(10) unsigned NOT NULL default '0',
- PRIMARY KEY (`numeropost`),
- KEY `maxnumrep` (`maxnumrep`)
-) ENGINE=MyISAM ROW_FORMAT=FIXED;
-INSERT INTO t1 (titre,maxnumrep) VALUES
-('test1','1'),('test2','2'),('test3','3');
-SELECT SQL_CALC_FOUND_ROWS titre,numeropost,maxnumrep FROM t1 WHERE numeropost IN (1,2) ORDER BY maxnumrep DESC LIMIT 0, 1;
-SELECT FOUND_ROWS();
-SELECT SQL_CALC_FOUND_ROWS 1 FROM (SELECT 1) as a LIMIT 0;
-SELECT FOUND_ROWS();
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE numeropost > 1 LIMIT 0;
-SELECT FOUND_ROWS();
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 0;
-SELECT FOUND_ROWS();
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 ORDER BY numeropost LIMIT 0;
-SELECT FOUND_ROWS();
-drop table t1;
-
-#
-# Test problem with impossible WHERE (Bug #1468)
-#
-
-create table t1 (id int, primary key (id));
-insert into t1 values (1), (2), (3), (4), (5);
-select SQL_CALC_FOUND_ROWS * from t1 where id > 3 limit 0, 1;
-select FOUND_ROWS();
-select SQL_CALC_FOUND_ROWS * from t1 where id > 3 AND 1=2 limit 0, 1;
-select FOUND_ROWS();
-select SQL_CALC_FOUND_ROWS * from t1 where id > 6 limit 0, 1;
-select FOUND_ROWS();
-drop table t1;
-
-#
-# Other bugs with range optimization
-#
-
-# bug #2448
-
-CREATE TABLE t1 ( a int not null, b int not null, KEY ab(a,b) );
-INSERT INTO t1 VALUES ( 47, 1 );
-INSERT INTO t1 VALUES ( 70, 1 );
-SELECT * FROM t1
-WHERE
-(
- ( b =1 AND a BETWEEN 14 AND 21 ) OR
- ( b =2 AND a BETWEEN 16 AND 18 ) OR
- ( b =3 AND a BETWEEN 15 AND 19 )
-);
-DROP TABLE t1;
-
-# bug #2698
-
-CREATE TABLE t1 ( a integer, u varchar(15), r integer, key uao_idx( r, a, u));
-DELETE FROM t1
-WHERE ( r = 1 AND a IN ( 1, 2 ) AND ( u = 'w' OR u LIKE 'w/%' ) )
- OR ( r = 1 AND a IN ( 3 ) AND ( u = 'w/U' OR u LIKE 'w/U/%' ) )
- OR ( r = 1 AND a IN ( 1, 2, 3 ) AND ( u = 'w' ) );
-drop table t1;
-
-#
-# Bug #3738: we have a ref key
-#
-
-CREATE TABLE t1 (a VARCHAR(16), UNIQUE(a));
-INSERT INTO t1 VALUES ('1'), ('2'), ('3');
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a = '2' LIMIT 0, 1;
-SELECT FOUND_ROWS();
-DROP TABLE t1;
-
-#
-# Bug #3845: group by, having and empty result
-#
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (0), (0), (1), (2);
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a = 0 GROUP BY a HAVING a > 10;
-SELECT FOUND_ROWS();
-DROP TABLE t1;
-
-#
-# Bug #6089: queries which don't use any tables
-#
-
-SELECT 'foo';
-SELECT FOUND_ROWS();
-SELECT SQL_CALC_FOUND_ROWS 'foo';
-SELECT FOUND_ROWS();
-SELECT SQL_CALC_FOUND_ROWS 'foo' limit 0;
-SELECT FOUND_ROWS();
-SELECT FOUND_ROWS();
-
-SELECT SQL_CALC_FOUND_ROWS 'foo' UNION SELECT 'bar' LIMIT 0;
-SELECT FOUND_ROWS();
-
-#
-# Bug #7945: group by + distinct with constant expression + limit
-#
-
-CREATE TABLE t1 (a int, b int);
-INSERT INTO t1 VALUES (1,2), (1,3), (1,4), (1,5);
-SELECT SQL_CALC_FOUND_ROWS DISTINCT 'a' FROM t1 GROUP BY b LIMIT 2;
-SELECT FOUND_ROWS();
-DROP TABLE t1;
-
-# End of 4.1 tests
-
-#
-# MDEV-5549 Wrong row counter in found_rows() result
-#
-create table t1 (f1 int primary key, f2 tinyint) engine=myisam;
-insert t1 values (10,3),(11,2),(12,3);
-create table t2 (f3 int primary key) engine=myisam;
-insert t2 values (11),(12),(13);
-#explain select f1 from t1,t2 where f1=f3 and f2=3 order by f1;
-select f1 from t1,t2 where f1=f3 and f2=3 order by f1;
-select found_rows();
-drop table t1, t2;
-
-#
-# MDEV-5898 FOUND_ROWS() return incorrect value when using DISTINCT
-#
-create table t1 (a1 int auto_increment primary key, c1 int);
-
-insert t1 (a1) values (null);
-insert t1 (a1) select null from t1;
-insert t1 (a1) select null from t1;
-insert t1 (a1) select null from t1;
-insert t1 (a1) select null from t1;
-insert t1 (a1) select null from t1;
-insert t1 (a1) select null from t1;
-insert t1 (a1) select null from t1;
-insert t1 (a1) select null from t1;
-insert t1 (a1) select null from t1;
-update t1 set c1=a1 % 2;
-
-create table t2 (a2 int, b2 int, c2 char(16) default '', primary key (a2, b2));
-
-insert t2 select a1, 1, 'ok' from t1;
-insert t2 select a1, 2, 'ko' from t1;
-insert t2 select a1, 3, 'ko' from t1;
-insert t2 select a1, 4, 'ok' from t1;
-insert t2 select a1, 5, 'ok' from t1;
-
---disable_result_log ONCE
-select sql_calc_found_rows distinct a1,c2 from t1 join t2 on a2=a1
- where a1 <= 256 and c1=0 and c2='ok' order by a1 desc limit 46;
-
-select found_rows();
-
-drop table t1, t2;
-
-#
-# MDEV-6221 SQL_CALC_FOUND_ROWS yields wrong result again
-#
-create table t1 (i1 int, v1 int, primary key(i1,v1));
-insert into t1 values (1,1),(2,2),(3,3);
-create table t2 (i2 int primary key, v2 int);
-insert into t2 values (1,5),(2,5),(3,10);
-select 1 as res from t1 left join t2 on i1 = i2 where v2 = 5 or v1 = 5 or v1 = 10 order by v1;
---disable_result_log ONCE
-select sql_calc_found_rows 1 as res from t1 left join t2 on i1 = i2 where v2 = 5 or v1 = 5 or v1 = 10 order by v1 limit 1;
-select found_rows() as count;
---disable_result_log ONCE
-select sql_calc_found_rows 1 as res from t1 left join t2 on i1 = i2 where v2 = 5 order by v1 limit 1;
-select found_rows() as count;
-drop table t1, t2;
-
-#
-# MDEV-7219 SQL_CALC_FOUND_ROWS yields wrong result
-#
-create table t1 (i int, v varchar(64), key (i));
-
---disable_query_log
-let $1=150;
-while ($1)
-{
- eval insert into t1 values ($1 % 2, 'foo');
- dec $1;
-}
---enable_query_log
-
-select sql_calc_found_rows * from t1 where i = 0 order by v limit 59,2;
-select found_rows();
-select sql_calc_found_rows * from t1 ignore index (i) where i = 0 order by v limit 59,2;
-select found_rows();
-drop table t1;
-
-#
-# MDEV-9390 Function found_rows() gives incorrect result where the previous SELECT contains ORDER BY clause
-#
-create table t1(c1 int);
-insert into t1 values(1),(2),(3),(4),(5);
-select * from t1 order by c1 limit 2,1;
-select found_rows();
-select sql_calc_found_rows * from t1 order by c1 limit 2,1;
-select found_rows();
-drop table t1;
diff --git a/mysql-test/t/select_jcl6.test b/mysql-test/t/select_jcl6.test
deleted file mode 100644
index f7c1aa988c7..00000000000
--- a/mysql-test/t/select_jcl6.test
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Run select.test with BKA enabled
-#
-
-set @save_optimizer_switch_jcl6=@@optimizer_switch;
-set @@optimizer_switch='optimize_join_buffer_size=on';
-set @@optimizer_switch='semijoin_with_cache=on';
-set @@optimizer_switch='outer_join_with_cache=on';
-set @@optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
-
-set join_cache_level=6;
-show variables like 'join_cache_level';
-
-set @optimizer_switch_for_select_test=@@optimizer_switch;
-set @join_cache_level_for_select_test=@@join_cache_level;
-
---source t/select.test
-
-set join_cache_level=default;
-show variables like 'join_cache_level';
-
-set @@optimizer_switch=@save_optimizer_switch_jcl6;
-set @optimizer_switch_for_select_test=NULL;
-set @join_cache_level_for_select_test=NULL;
diff --git a/mysql-test/t/select_pkeycache-master.opt b/mysql-test/t/select_pkeycache-master.opt
deleted file mode 100644
index a6c0f247334..00000000000
--- a/mysql-test/t/select_pkeycache-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---key_cache_segments=7
diff --git a/mysql-test/t/select_pkeycache.test b/mysql-test/t/select_pkeycache.test
deleted file mode 100644
index e0ee96e937a..00000000000
--- a/mysql-test/t/select_pkeycache.test
+++ /dev/null
@@ -1,8 +0,0 @@
-
-#
-# Run select.test with the segmented default key cache (with 7 segments)
-# (see setting the number of segments in select_pkecache-master.opt)
-# The result is expected the same as for select.test
-#
-
---source t/select.test
diff --git a/mysql-test/t/select_safe.test b/mysql-test/t/select_safe.test
deleted file mode 100644
index c76e337cd10..00000000000
--- a/mysql-test/t/select_safe.test
+++ /dev/null
@@ -1,92 +0,0 @@
-#
-# test of safe selects
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-SET SQL_SAFE_UPDATES=1,SQL_SELECT_LIMIT=4, MAX_JOIN_SIZE=9;
-create table t1 (a int auto_increment primary key, b char(20));
-insert into t1 values(1,"test");
-SELECT SQL_BUFFER_RESULT * from t1;
-update t1 set b="a" where a=1;
-delete from t1 where a=1;
-insert into t1 values(1,"test"),(2,"test2");
-SELECT SQL_BUFFER_RESULT * from t1;
-update t1 set b="a" where a=1;
-select 1 from t1,t1 as t2,t1 as t3;
-
-# The following should give errors:
---error 1175
-update t1 set b="a";
---error 1175
-update t1 set b="a" where b="test";
---error 1175
-delete from t1;
---error 1175
-delete from t1 where b="test";
---error 1175
-delete from t1 where a+0=1;
---error 1104
-select 1 from t1,t1 as t2,t1 as t3,t1 as t4,t1 as t5;
-
-# The following should be ok:
-update t1 set b="a" limit 1;
-update t1 set b="a" where b="b" limit 2;
-delete from t1 where b="test" limit 1;
-delete from t1 where a+0=1 limit 2;
-
-# Test SQL_BIG_SELECTS
-
-alter table t1 add key b (b);
-SET MAX_JOIN_SIZE=2;
-SELECT @@MAX_JOIN_SIZE, @@SQL_BIG_SELECTS;
-insert into t1 values (null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a");
---error 1104
-SELECT * from t1 order by a;
-SET SQL_BIG_SELECTS=1;
-SELECT * from t1 order by a;
-SET MAX_JOIN_SIZE=2;
---error 1104
-SELECT * from t1;
-SET MAX_JOIN_SIZE=DEFAULT;
-SELECT * from t1;
-
-#
-# Test MAX_SEEKS_FOR_KEY
-#
-analyze table t1;
-insert into t1 values (null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a");
-insert into t1 values (null,"b"),(null,"b"),(null,"c"),(null,"c"),(null,"d"),(null,"d"),(null,"e"),(null,"e"),(null,"a"),(null,"e");
-insert into t1 values (null,"x"),(null,"x"),(null,"y"),(null,"y"),(null,"z"),(null,"z"),(null,"v"),(null,"v"),(null,"a"),(null,"v");
-explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
-set MAX_SEEKS_FOR_KEY=1;
-explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
-SET MAX_SEEKS_FOR_KEY=DEFAULT;
-
-drop table t1;
-
-# BUG#8726
-create table t1 (a int);
-insert into t1 values (1),(2),(3),(4),(5);
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-
-set local max_join_size=8;
---error 1104
-select * from (select * from t1) x;
-
-set local max_join_size=1;
---error 1104
-select * from (select a.a as aa, b.a as ba from t1 a, t1 b) x;
-
-set local max_join_size=1;
---error 1104
-select * from (select 1 union select 2 union select 3) x;
-drop table t1;
-
-SET SQL_SAFE_UPDATES=0,SQL_SELECT_LIMIT=DEFAULT, MAX_JOIN_SIZE=DEFAULT;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/selectivity.test b/mysql-test/t/selectivity.test
deleted file mode 100644
index 3e60f242083..00000000000
--- a/mysql-test/t/selectivity.test
+++ /dev/null
@@ -1,1050 +0,0 @@
---source include/have_stat_tables.inc
-
---disable_warnings
-drop table if exists t0,t1,t2,t3;
---enable_warnings
-
-select @@global.use_stat_tables;
-select @@session.use_stat_tables;
-
-set @save_use_stat_tables=@@use_stat_tables;
-
-set use_stat_tables='preferably';
-
-set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity;
-set @save_histogram_size=@@histogram_size;
-set @save_histogram_type=@@histogram_type;
-
-# check that statistics on nulls is used
-
-set optimizer_use_condition_selectivity=3;
-
-create table t1 (a int);
-insert into t1 values
- (9), (3), (2), (NULL), (NULL), (2), (NULL), (1), (5), (NULL);
-
-analyze table t1;
-
-select * from mysql.column_stats;
-
-flush table t1;
-
-explain extended
-select * from t1 where a is null;
-
-explain extended
-select * from t1 where a is not null;
-
-drop table t1;
-
-set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-
---disable_warnings
-DROP DATABASE IF EXISTS dbt3_s001;
---enable_warnings
-
-CREATE DATABASE dbt3_s001;
-
-use dbt3_s001;
-
---disable_query_log
---disable_result_log
---disable_warnings
---source include/dbt3_s001.inc
-
-ANALYZE TABLE
-customer, lineitem, nation, orders, part, partsupp, region, supplier;
-FLUSH TABLE
-customer, lineitem, nation, orders, part, partsupp, region, supplier;
---enable_warnings
---enable_result_log
---enable_query_log
-
---echo === Q2 ===
-
-set optimizer_use_condition_selectivity=5;
-explain extended
-select
- s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment
-from
- part, supplier, partsupp, nation, region
-where
- p_partkey = ps_partkey
- and s_suppkey = ps_suppkey
- and p_size = 9
- and p_type like '%TIN'
- and s_nationkey = n_nationkey
- and n_regionkey = r_regionkey
- and r_name = 'ASIA'
- and ps_supplycost = (
- select
- min(ps_supplycost)
- from
- partsupp, supplier, nation, region
- where
- p_partkey = ps_partkey
- and s_suppkey = ps_suppkey
- and s_nationkey = n_nationkey
- and n_regionkey = r_regionkey
- and r_name = 'ASIA'
- )
-order by
- s_acctbal desc, n_name, s_name, p_partkey;
-set optimizer_use_condition_selectivity=4;
-explain extended
-select
- s_acctbal, s_name, n_name, p_partkey, p_mfgr, s_address, s_phone, s_comment
-from
- part, supplier, partsupp, nation, region
-where
- p_partkey = ps_partkey
- and s_suppkey = ps_suppkey
- and p_size = 9
- and p_type like '%TIN'
- and s_nationkey = n_nationkey
- and n_regionkey = r_regionkey
- and r_name = 'ASIA'
- and ps_supplycost = (
- select
- min(ps_supplycost)
- from
- partsupp, supplier, nation, region
- where
- p_partkey = ps_partkey
- and s_suppkey = ps_suppkey
- and s_nationkey = n_nationkey
- and n_regionkey = r_regionkey
- and r_name = 'ASIA'
- )
-order by
- s_acctbal desc, n_name, s_name, p_partkey;
-
---echo === Q15 ===
-
-create view revenue0 (supplier_no, total_revenue) as
- select l_suppkey, sum(l_extendedprice * (1 - l_discount))
- from lineitem
- where
- l_shipdate >= '1995-08-01'
- and l_shipdate < date_add('1995-08-01', interval 90 day)
- group by l_suppkey;
-
-let $Q15=
-select s_suppkey, s_name, s_address, s_phone, total_revenue
-from supplier, revenue0
-where s_suppkey = supplier_no
- and total_revenue = (select max(total_revenue) from revenue0)
-order by s_suppkey;
-
-set @save_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='index_condition_pushdown=off';
-
-set optimizer_use_condition_selectivity=1;
-eval EXPLAIN EXTENDED $Q15;
-eval $Q15;
-
-set optimizer_use_condition_selectivity=3;
-eval EXPLAIN EXTENDED $Q15;
-eval $Q15;
-
-set optimizer_switch=@save_optimizer_switch;
-
-drop view revenue0;
-
-
---echo === Q16 ===
-
-let $Q16=
-select p_brand, p_type, p_size, count(distinct ps_suppkey) as supplier_cnt
-from partsupp, part
-where p_partkey = ps_partkey
- and p_brand <> 'Brand#11'
- and p_type not like 'SMALL POLISHED%'
- and p_size in (49, 37, 27, 5, 40, 6, 22, 8)
- and ps_suppkey not in (select s_suppkey from supplier
- where s_comment like '%Customer%Complaints%')
-group by p_brand, p_type, p_size
-order by supplier_cnt desc, p_brand, p_type, p_size;
-
-set optimizer_use_condition_selectivity=1;
-eval EXPLAIN EXTENDED $Q16;
-eval $Q16;
-
-set optimizer_use_condition_selectivity=3;
-eval EXPLAIN EXTENDED $Q16;
-eval $Q16;
-
-set optimizer_use_condition_selectivity=4;
-eval EXPLAIN EXTENDED $Q16;
-eval $Q16;
-
-
---echo === Q18 ===
-
-let $Q18=
-select
- c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, sum(l_quantity)
-from customer, orders, lineitem
-where
- o_orderkey in (select l_orderkey from lineitem
- group by l_orderkey having sum(l_quantity) > 250)
- and c_custkey = o_custkey
- and o_orderkey = l_orderkey
-group by c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice
-order by o_totalprice desc, o_orderdate;
-
-set optimizer_use_condition_selectivity=1;
-eval EXPLAIN EXTENDED $Q18;
-eval $Q18;
-
-set optimizer_use_condition_selectivity=3;
-eval EXPLAIN EXTENDED $Q18;
-eval $Q18;
-
-
---echo === Q22 ===
-
-let $Q22=
-select cntrycode, count(*) as numcust, sum(c_acctbal) as totacctbal
-from (
- select substr(c_phone, 1, 2) as cntrycode, c_acctbal
- from customer
- where
- substr(c_phone, 1, 2) in ('10', '20', '14', '19', '11', '28', '25')
- and c_acctbal > (select avg(c_acctbal) from customer
- where c_acctbal > 0.00
- and substr(c_phone, 1, 2) in
- ('10', '20', '14', '19', '11', '28', '25'))
- and not exists (select * from orders where o_custkey = c_custkey)
- ) as vip
-group by cntrycode
-order by cntrycode;
-
-set optimizer_use_condition_selectivity=1;
-eval EXPLAIN EXTENDED $Q22;
-eval $Q22;
-
-set optimizer_use_condition_selectivity=3;
-eval EXPLAIN EXTENDED $Q22;
-eval $Q22;
-
-
---echo === Q20 ===
-
-let $Q20=
-select sql_calc_found_rows
- s_name, s_address
-from supplier, nation
-where s_suppkey in (select ps_suppkey from partsupp
- where ps_partkey in (select p_partkey from part
- where p_name like 'g%')
- and ps_availqty >
- (select 0.5 * sum(l_quantity)
- from lineitem
- where l_partkey = ps_partkey
- and l_suppkey = ps_suppkey
- and l_shipdate >= date('1993-01-01')
- and l_shipdate < date('1993-01-01') +
- interval '1' year ))
-and s_nationkey = n_nationkey
-and n_name = 'UNITED STATES'
-order by s_name
-limit 10;
-
-set optimizer_use_condition_selectivity=1;
-eval EXPLAIN EXTENDED $Q20;
-eval $Q20;
-
-SELECT ((SELECT COUNT(*) FROM part WHERE p_name LIKE 'g%') /
- (SELECT COUNT(*) FROM part)) AS sel;
-
-set optimizer_use_condition_selectivity=3;
-eval EXPLAIN EXTENDED $Q20;
-eval $Q20;
-
-set histogram_size=127;
-
-ANALYZE TABLE part PERSISTENT FOR COLUMNS(p_name) INDEXES();
-
-flush table part;
-
-set optimizer_use_condition_selectivity=4;
-eval EXPLAIN EXTENDED $Q20;
-eval $Q20;
-
-set histogram_type='DOUBLE_PREC_HB';
-set histogram_size=126;
-
-ANALYZE TABLE part PERSISTENT FOR COLUMNS(p_name) INDEXES();
-
-flush table part;
-
-eval EXPLAIN EXTENDED $Q20;
-eval $Q20;
-
-set histogram_type='SINGLE_PREC_HB';
-set histogram_size=24;
-
-ANALYZE TABLE nation PERSISTENT FOR COLUMNS(n_name) INDEXES();
-
-flush table nation;
-
-eval EXPLAIN EXTENDED $Q20;
-eval $Q20;
-
-DROP DATABASE dbt3_s001;
-
-set histogram_type=@save_histogram_type;
-set histogram_size=@save_histogram_size;
-set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-
-use test;
-
---echo #
---echo # Bug mdev-4348: using view with use_condition_selectivity > 1
---echo #
-
-set @tmp_use_stat_tables=@@use_stat_tables;
-set use_stat_tables='never';
-set optimizer_use_condition_selectivity=3;
-
-CREATE TABLE t1 (a int, b int);
-INSERT t1 VALUES (7,1), (0,7);
-CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
-
-CREATE TABLE t2 (c int, d int, index idx(d));
-INSERT INTO t2 VALUES
- (0,4), (8,6), (1,3), (8,5), (9,3), (2,2), (6,2),
- (1,9), (6,3), (2,8), (4,1), (0,7), (4,8), (4,5);
-
-EXPLAIN EXTENDED
-SELECT * FROM v1 INNER JOIN t2 ON ( a = c AND b = d );
-
-SELECT * FROM v1 INNER JOIN t2 ON ( a = c AND b = d );
-
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
-set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-set use_stat_tables=@tmp_use_stat_tables;
-
---echo #
---echo # Bug mdev-4349: impossible range for non-indexed column
---echo #
-
-set optimizer_use_condition_selectivity=3;
-
-create table t1 (a int);
-insert into t1 values
- (3), (7), (2), (5), (7), (1), (2), (2);
-
-set optimizer_use_condition_selectivity=1;
-explain extended
-select * from t1 where a < 1 and a > 7;
-select * from t1 where a < 1 and a > 7;
-
-set optimizer_use_condition_selectivity=3;
-explain extended
-select * from t1 where a < 1 and a > 7;
-select * from t1 where a < 1 and a > 7;
-
-drop table t1;
-
-create table t1 (a int);
-insert into t1 values (1);
-
-create table t2 (b int);
-insert into t2 values (2),(3);
-
-explain extended
-select * from t1 where a in ( select b from t2 ) AND ( a > 3 );
-select * from t1 where a in ( select b from t2 ) AND ( a > 3 );
-
-drop table t1,t2;
-
-set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-
---echo #
---echo # Bug mdev-4350: erroneous negative selectivity
---echo #
-
-create table t1 (a int);
-insert into t1 values (1), (1);
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-insert into t1 values (0);
-select count(*) from t1;
-
-set use_stat_tables='preferably';
-set histogram_size=127;
-set histogram_type='SINGLE_PREC_HB';
-analyze table t1;
-flush table t1;
-
-set optimizer_use_condition_selectivity=4;
-explain extended select * from t1 where a=0;
-
-drop table t1;
-
-set histogram_size=@save_histogram_size;
-set histogram_type=@save_histogram_type;
-set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-
---echo #
---echo # Bug mdev-4367: 2-way join with an empty table
---echo # when optimizer_use_condition_selectivity=3
---echo #
-
-set optimizer_use_condition_selectivity=3;
-
-CREATE TABLE t1 (a varchar(1)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('j'),('k');
-
-CREATE TABLE t2 (b varchar(1)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES ('x'),('y');
-
-CREATE TABLE t3 (c varchar(1), KEY(c)) ENGINE=MyISAM;
-
-SELECT * FROM t1 STRAIGHT_JOIN (t2 JOIN t3 ON c = b AND b > 'z');
-
-DROP TABLE t1,t2,t3;
-
-set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-
---echo #
---echo # Bug mdev-4366: impossible condition on an indexed column discovered after
---echo # substitution of constant tables
---echo # with optimizer_use_condition_selectivity=3
---echo #
-
-CREATE TABLE t1 (pk int PRIMARY KEY, a int);
-INSERT INTO t1 VALUES
- (1,4), (2,6), (3,3), (4,5);
-
-CREATE TABLE t2 (b int);
-INSERT INTO t2 VALUES (1), (7);
-
-set optimizer_use_condition_selectivity=1;
-EXPLAIN EXTENDED
-SELECT 1 FROM t1, t2 WHERE pk = 6 AND a = 2 AND b = 10;
-SELECT 1 FROM t1, t2 WHERE pk = 6 AND a = 2 AND b = 10;
-
-set optimizer_use_condition_selectivity=3;
-EXPLAIN EXTENDED
-SELECT 1 FROM t1, t2 WHERE pk = 6 AND a = 2 AND b = 10;
-SELECT 1 FROM t1, t2 WHERE pk = 6 AND a = 2 AND b = 10;
-
-DROP TABLE t1,t2;
-
-set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-
---echo #
---echo # Bug mdev-4370: Histograms have bean created, but the query is run after
---echo # FLUSH TABLES with optimizer_use_condition_selectivity=3
---echo #
-
-set use_stat_tables=PREFERABLY;
-set histogram_size=10;
-set histogram_type='SINGLE_PREC_HB';
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (9), (1);
-ANALYZE TABLE t1;
-FLUSH TABLES;
-
-set optimizer_use_condition_selectivity=3;
-
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE a > 3;
-SELECT * FROM t1 WHERE a > 3;
-
-set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-
-DROP TABLE t1;
-
-set histogram_size=@save_histogram_size;
-set histogram_type=@save_histogram_type;
-set use_stat_tables=@save_use_stat_tables;
-
---echo #
---echo # Bug mdev-4371: Join with condition supported by index on an empty table
---echo # with optimizer_use_condition_selectivity=3
---echo #
-
-set use_stat_tables=PREFERABLY;
-
-CREATE TABLE t1 (a int, b int, INDEX(a));
-
-CREATE TABLE t2 (c int);
-INSERT INTO t2 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
-
-ANALYZE TABLE t1, t2;
-FLUSH TABLES;
-
-set optimizer_use_condition_selectivity=3;
-
-set @save_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='index_condition_pushdown=off';
-
-EXPLAIN EXTENDED
-SELECT * FROM t1, t2 WHERE a > 9;
-SELECT * FROM t1, t2 WHERE a > 9;
-
-set optimizer_switch=@save_optimizer_switch;
-
-set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-
-DROP TABLE t1,t2;
-
-set use_stat_tables=@save_use_stat_tables;
-
---echo #
---echo # Bug mdev-4373: condition on a short varchar column
---echo # with optimizer_use_condition_selectivity=3
---echo #
-
-set use_stat_tables=PREFERABLY;
-
-CREATE TABLE t1 (a varchar(1));
-INSERT INTO t1 VALUES ('x'), ('y');
-
-ANALYZE TABLE t1;
-FLUSH TABLES;
-
-set optimizer_use_condition_selectivity=3;
-
-SELECT * FROM t1 WHERE a <= 'w';
-
-set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-
-DROP TABLE t1;
-
-set use_stat_tables=@save_use_stat_tables;
-
---echo #
---echo # Bug mdev-4372: exists subquery in WHERE
---echo # with optimizer_use_condition_selectivity=3
---echo #
-
-set use_stat_tables = PREFERABLY;
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES
- (1),(7),(4),(7),(0),(2),(9),(4),(0),(9),(1),(3),(8),(8);
-CREATE TABLE t2 (b int);
-INSERT INTO t2 VALUES (4),(5),(2),(5),(1),(1),(2);
-
-ANALYZE TABLE t1, t2;
-FLUSH TABLES;
-
-set optimizer_use_condition_selectivity=3;
-
-EXPLAIN EXTENDED
-SELECT * FROM t1, t2 WHERE EXISTS ( SELECT 1 FROM t1, t2 ) AND a != b OR a <= 4;
-
-set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-
-DROP TABLE t1,t2;
-
-set use_stat_tables=@save_use_stat_tables;
-
-
---echo #
---echo # Bug mdev-4363: selectivity of the condition a IS NULL OR IS NOT NULL
---echo # with optimizer_use_condition_selectivity=3
---echo #
-
-set use_stat_tables = PREFERABLY;
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES
- (1),(7),(4),(7),(NULL),(2),(NULL),(4),(NULL),(NULL),(1),(3),(8),(8);
-
-ANALYZE TABLE t1;
-FLUSH TABLE t1;
-
-set optimizer_use_condition_selectivity=3;
-
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE a IS NULL;
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE a IS NOT NULL;
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE a IS NULL OR a IS NOT NULL;
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE a IS NULL OR a < 5;
-
-set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-
-DROP TABLE t1;
-
-set use_stat_tables=@save_use_stat_tables;
-
---echo #
---echo # Bug mdev-4378: 2-way join with a materialized IN subquery in WHERE
---echo # when optimizer_use_condition_selectivity=4
---echo #
-
-set use_stat_tables=PREFERABLY;
-set histogram_size=50;
-set histogram_type=SINGLE_PREC_HB;
-
-CREATE TABLE t1 (a INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (8),(9),(6);
-
-CREATE TABLE t2 (b INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (8),(1),(8),(9),(24),(6),(1),(6),(2),(4);
-
-CREATE TABLE t3 (ln VARCHAR(16)) ENGINE=MyISAM;
-INSERT INTO t3 VALUES
-('smith'),('black'),('white'),('jones'),
-('brown'),('taylor'),('anderson'),('taylor');
-
-ANALYZE TABLE t1, t2, t3;
-FLUSH TABLES;
-
-set optimizer_use_condition_selectivity=4;
-
-SELECT * FROM t1, t2 WHERE 'garcia' IN ( SELECT MIN( ln ) FROM t3 WHERE ln = 'sun' );
-
-set histogram_size=@save_histogram_size;
-set histogram_type=@save_histogram_type;
-set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-
-DROP TABLE t1,t2,t3;
-
-set use_stat_tables=@save_use_stat_tables;
-
---echo #
---echo # Bug mdev-4380: 2-way join with a materialized IN subquery in WHERE
---echo # when optimizer_use_condition_selectivity=3
---echo #
-
-set use_stat_tables=PREFERABLY;
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (5),(9);
-
-CREATE TABLE t2 (b VARCHAR(8));
-INSERT INTO t2 VALUES ('red'),('blue');
-
-CREATE TABLE t3 (c VARCHAR(8), d VARCHAR(8));
-INSERT INTO t3 VALUES ('white','black'),('cyan','yellow');
-
-ANALYZE TABLE t1, t2, t3;
-FLUSH TABLES;
-
-set optimizer_use_condition_selectivity=3;
-
-SELECT * FROM t1, t2 WHERE ( 'orange', 'green' ) IN (
- SELECT MAX(c), MAX(d) FROM t3, t2 WHERE c >= d AND b = c
-);
-
-set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-
-DROP TABLE t1,t2,t3;
-
-set use_stat_tables=@save_use_stat_tables;
-
---echo #
---echo # Bug mdev-4389: join with degenerated range condition in WHERE
---echo # when optimizer_use_condition_selectivity=3
---echo #
-
-set use_stat_tables=PREFERABLY;
-
-CREATE TABLE t1 (f1 VARCHAR(1));
-INSERT t1 VALUES ('p'),('q');
-
-CREATE TABLE t2 (f2 VARCHAR(1));
-INSERT INTO t2 VALUES
- ('o'),('v'),('f'),('f'),('e'),('l'),('j'),('p'),('r'),('j'),
- ('j'),('u'),('i'),('r'),('x'),('a'),('x'),('s');
-
-ANALYZE TABLE t1, t2;
-FLUSH TABLES;
-
-SET optimizer_use_condition_selectivity=3;
-
-SELECT * FROM t1, t2 AS t2a, t2 AS t2b WHERE f1 <= 'a' AND t2a.f2 = f1;
-
-set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-
-DROP TABLE t1,t2;
-
-set use_stat_tables=@save_use_stat_tables;
-
---echo #
---echo # Bug mdev-4406: range condition for non-nullable column
---echo # when optimizer_use_condition_selectivity=3
---echo #
-
-create table t1 (a int not null);
-insert into t1 values
- (7), (6), (4), (9), (1), (5), (2), (1), (3), (8);
-
-set use_stat_tables='preferably';
-
-analyze table t1;
-flush table t1;
-
-set optimizer_use_condition_selectivity=3;
-
-select count(*) from t1 where a between 5 and 7;
-explain extended select * from t1 where a between 5 and 7;
-
-alter table t1 change column a a int;
-analyze table t1;
-flush table t1;
-
-explain extended select * from t1 where a between 5 and 7;
-
-set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-
-drop table t1;
-
-set use_stat_tables=@save_use_stat_tables;
-
-
---echo #
---echo # Bug mdev-5200: impossible where with a semijoin subquery
---echo # when optimizer_use_condition_selectivity=2
---echo #
-
-set use_stat_tables = 'preferably';
-set optimizer_use_condition_selectivity = 2;
-
-CREATE TABLE t1 (i1 int) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (0), (1);
-
-CREATE TABLE t2 (pk2 int, i2 int, c2 char(1), PRIMARY KEY(pk2)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (1,8,'m'), (2,9,'b');
-
-CREATE TABLE t3 (c3 char(1), INDEX(c3)) ENGINE=MyISAM;
-INSERT INTO t3 VALUES ('v'), ('c');
-
-ANALYZE TABLE t1,t2,t3;
-
-SELECT * FROM t1
- WHERE 2 IN ( SELECT pk2 FROM t2 LEFT JOIN t3 ON (c3 = c2 ) WHERE i2 = 3 );
-EXPLAIN EXTENDED
-SELECT * FROM t1
- WHERE 2 IN ( SELECT pk2 FROM t2 LEFT JOIN t3 ON (c3 = c2 ) WHERE i2 = 3 );
-
-set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # Bug mdev-5415: query over an information schema table
---echo # when optimizer_use_condition_selectivity=3
---echo #
-
-set optimizer_use_condition_selectivity = 3;
-
-SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE SQL_MODE != '';
-
-set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-
---echo #
---echo # Bug mdev-5630: always true conjunctive condition
---echo # when optimizer_use_condition_selectivity=3
---echo #
-
-set use_stat_tables = 'preferably';
-set optimizer_use_condition_selectivity = 3;
-
-CREATE TABLE t1 (a int) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (10);
-
-CREATE TABLE t2 (id int, flag char(1), INDEX(id)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (100,'0'),(101,'1');
-
-ANALYZE TABLE t1, t2;
-
-SELECT * FROM t1, t2 WHERE id = a AND ( a = 16 OR flag AND a != 6 );
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug mdev-4429: join with range condition whose selectivity == 0
---echo # when optimizer_use_condition_selectivity=3
---echo #
-
-CREATE TABLE language (lang_group INT, lang VARCHAR(16) PRIMARY KEY);
-INSERT INTO language VALUES
- (1,'Chinese'),(6,'English'),(1,'French'),
- (1,'German'),(1,'Italian'),(0,'Japanese');
-
-CREATE TABLE country (code varchar(3) PRIMARY KEY,
- country_group INT DEFAULT NULL);
-INSERT INTO country VALUES ('USA',3),('FRA',5);
-
-CREATE TABLE continent (cont_group INT, cont varchar(16) PRIMARY KEY);
-INSERT INTO continent VALUES
- (1,'N.America'),(1,'S.America'),(3,'Australia'),
- (4,'Africa'),(5,'Antarctica'),(6,'Eurasia');
-
-SET use_stat_tables=PREFERABLY;
-ANALYZE TABLE country, language, continent;
-FLUSH TABLES;
-SET optimizer_use_condition_selectivity=3;
-
-SELECT * FROM language, country, continent
- WHERE country_group = lang_group AND lang_group IS NULL;
-EXPLAIN EXTENDED
-SELECT * FROM language, country, continent
- WHERE country_group = lang_group AND lang_group IS NULL;
-
-set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-
-drop table language, country, continent;
-
-set use_stat_tables=@save_use_stat_tables;
-
---echo #
---echo # Bug mdev-5191: performance degradation due to a suboptimal chosen plan
---echo # when optimizer_use_condition_selectivity=3
---echo #
-
-set use_stat_tables = 'preferably';
-
-set @@RAND_SEED1=810763568, @@RAND_SEED2=600681772;
-set TIMESTAMP=1394806993;
-
-create table t1 (a int, b int) engine=myisam;
-insert t1 values (rand()*1e5, rand()*1e5);
-insert t1 select rand()*1e5, rand()*1e5 from t1;
-insert t1 select rand()*1e5, rand()*1e5 from t1;
-insert t1 select rand()*1e5, rand()*1e5 from t1;
-insert t1 select rand()*1e5, rand()*1e5 from t1;
-insert t1 select rand()*1e5, rand()*1e5 from t1;
-insert t1 select rand()*1e5, rand()*1e5 from t1;
-insert t1 select rand()*1e5, rand()*1e5 from t1;
-insert t1 select rand()*1e5, rand()*1e5 from t1;
-insert t1 select rand()*1e5, rand()*1e5 from t1;
-insert t1 select rand()*1e5, rand()*1e5 from t1;
-insert t1 select rand()*1e5, rand()*1e5 from t1;
-insert t1 select rand()*1e5, rand()*1e5 from t1;
-insert t1 select rand()*1e5, rand()*1e5 from t1;
-insert t1 select rand()*1e5, rand()*1e5 from t1;
-insert t1 select rand()*1e5, rand()*1e5 from t1;
-insert t1 select rand()*1e5, rand()*1e5 from t1;
-insert t1 select rand()*1e5, rand()*1e5 from t1;
-insert t1 select rand()*1e5, rand()*1e5 from t1;
-
-create table t2 (c int, d int, key(c), key(d)) engine=myisam;
-insert t2 select floor(rand()*1e5/2)*2, floor(rand()*1e5/3)*3 from t1;
-
-analyze table t1,t2;
-
-set optimizer_use_condition_selectivity=1;
-explain extended
-select * from t1, t2, t1 as t3
- where t1.b=t2.c and t2.d=t3.a and t3.b<5 and t1.a < 2000;
---sorted_result
-select * from t1, t2, t1 as t3
- where t1.b=t2.c and t2.d=t3.a and t3.b<5 and t1.a < 2000;
-
-set optimizer_use_condition_selectivity=3;
-explain extended
-select * from t1, t2, t1 as t3
- where t1.b=t2.c and t2.d=t3.a and t3.b<5 and t1.a < 2000;
---sorted_result
-select * from t1, t2, t1 as t3
- where t1.b=t2.c and t2.d=t3.a and t3.b<5 and t1.a < 2000;
-
-set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-
-drop table t1,t2;
-
-set histogram_type=@save_histogram_type;
-set histogram_size=@save_histogram_size;
-set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-
-
---echo #
---echo # Bug mdev-5931: no where condition after constant table row substitution
---echo # with optimizer_use_condition_selectivity=3
---echo #
-
-CREATE TABLE t1 (a varchar(3), b varchar(3)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('foo', 'foo');
-
-CREATE TABLE t2 (c INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (1), (2);
-
-set optimizer_use_condition_selectivity=3;
-
-EXPLAIN EXTENDED
-SELECT * FROM t1, t2 WHERE c >= 0 OR a = b ;
-
-SELECT * FROM t1, t2 WHERE c >= 0 OR a = b ;
-
-set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug mdev-6325: wrong selectivity of a column with ref access
---echo #
-
-create table t0(a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t1(a int);
-insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
-create table t2 (a int, b int, key(a));
-insert into t2 select A.a + 10*B.a, 12345 from t0 A, t0 B, t0 C;
-
-set use_stat_tables='preferably';
-set histogram_size=100;
-
-set optimizer_use_condition_selectivity=4;
-analyze table t1 persistent for all;
-analyze table t2 persistent for all;
-
-explain extended
-select * from t1 straight_join t2 where t1.a=t2.a and t1.a<10;
-explain extended
-select * from t1 straight_join t2 where t1.a=t2.a and t2.a<10;
-
-set histogram_size=@save_histogram_size;
-set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-
-drop table t0,t1,t2;
-
---echo #
---echo # Bug mdev-6843: col IS NULL in where condition when col is always NULL
---echo #
-
-create table t0(a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t1(a int);
-insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
-create table t2 (a int, b int);
-insert into t2 select NULL, a from t1;
-
-set use_stat_tables='preferably';
-set histogram_size=100;
-
-set optimizer_use_condition_selectivity=4;
-analyze table t2 persistent for all;
-
-explain extended
-select * from t2 a straight_join t2 b where a.a is null;
-
-set histogram_size=@save_histogram_size;
-set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-
-drop table t0,t1,t2;
-
---echo #
---echo # Bug mdev-7316: a conjunct in WHERE with selectivity == 0
---echo #
-
-CREATE TABLE t1 (a varchar(16), b int, PRIMARY KEY(a), KEY(b));
-INSERT INTO t1 VALUES
- ('USAChinese',10), ('USAEnglish',20), ('USAFrench',30);
-
-CREATE TABLE t2 (i int);
-INSERT INTO t2 VALUES
- (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(1),(2),(3),(4);
-
-ANALYZE TABLE t1, t2;
-
-set use_stat_tables='preferably';
-set optimizer_use_condition_selectivity=3;
-
-EXPLAIN EXTENDED
-SELECT * FROM t1, t2
- WHERE a <> 'USARussian' AND b IS NULL;
-
-SELECT * FROM t1, t2
- WHERE a <> 'USARussian' AND b IS NULL;
-
-set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-
-DROP TABLE t1,t2;
-
-set use_stat_tables=@save_use_stat_tables;
-
---echo #
---echo # Bug mdev-11096: range condition over column without statistical data
---echo #
-
-set use_stat_tables='preferably';
-set optimizer_use_condition_selectivity=3;
-
-create table t1(col1 char(32));
-insert into t1 values ('a'),('b'),('c'),('d'), ('e'),('f'),('g'),('h');
-analyze table t1 persistent for columns () indexes ();
-
-explain extended
-select * from t1 where col1 > 'b' and col1 < 'e';
-select * from t1 where col1 > 'b' and col1 < 'e';
-
-drop table t1;
-
-set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-set use_stat_tables=@save_use_stat_tables;
-
---echo #
---echo # Bug mdev-9628: unindexed blob column without min-max statistics
---echo # with optimizer_use_condition_selectivity=3
---echo #
-
-set use_stat_tables='preferably';
-set optimizer_use_condition_selectivity=3;
-
-create table t1(col1 char(32));
-insert into t1 values ('a'),('b'),('c'),('d'), ('e'),('f'),('g'),('h');
-analyze table t1;
-
-create table t2(col1 text);
-insert into t2 values ('a'),('b'),('c'),('d'), ('e'),('f'),('g'),('h');
-analyze table t2;
-
-select * from t1 where col1 > 'b' and col1 < 'd';
-explain extended
-select * from t1 where col1 > 'b' and col1 < 'd';
-
-select * from t2 where col1 > 'b' and col1 < 'd';
-explain extended
-select * from t2 where col1 > 'b' and col1 < 'd';
-
-select * from t2 where col1 < 'b' and col1 > 'd';
-explain extended
-select * from t2 where col1 < 'b' and col1 > 'd';
-
-drop table t1,t2;
-
-set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-set use_stat_tables=@save_use_stat_tables;
-
---echo #
---echo # Bug mdev-11364: IS NULL over not nullable datetime column
---echo # in mergeable derived
---echo #
-
-set use_stat_tables='preferably';
-set optimizer_use_condition_selectivity=4;
-set HISTOGRAM_SIZE = 255;
-
-CREATE TABLE t1 (t TIME, d DATE NOT NULL);
-INSERT INTO t1 VALUES ('10:00:00', '0000-00-00'),('11:00:00','0000-00-00');
-
-ANALYZE TABLE t1;
-
-SELECT * FROM (SELECT t FROM t1 WHERE d IS NULL) sq;
-
-DROP TABLE t1;
-
-set histogram_size=@save_histogram_size;
-set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-set use_stat_tables=@save_use_stat_tables;
diff --git a/mysql-test/t/selectivity_innodb.test b/mysql-test/t/selectivity_innodb.test
deleted file mode 100644
index e2dba034363..00000000000
--- a/mysql-test/t/selectivity_innodb.test
+++ /dev/null
@@ -1,176 +0,0 @@
---source include/have_innodb.inc
-
-SET SESSION STORAGE_ENGINE='InnoDB';
-
-set @save_optimizer_switch_for_selectivity_test=@@optimizer_switch;
-set optimizer_switch='extended_keys=on';
-
---source selectivity.test
-
-set optimizer_switch=@save_optimizer_switch_for_selectivity_test;
-set @tmp_ust= @@use_stat_tables;
-set @tmp_oucs= @@optimizer_use_condition_selectivity;
-
-
---echo #
---echo # MDEV-6808: MariaDB 10.0.13 crash with optimizer_use_condition_selectivity > 1
---echo #
-set @tmp_mdev6808= @@optimizer_use_condition_selectivity;
-SET optimizer_use_condition_selectivity = 2;
-CREATE TABLE t1 (
- event_id int(11) unsigned NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (event_id)
-) ENGINE=InnoDB;
-
-CREATE TABLE t2 (
- repost_id int(11) unsigned NOT NULL AUTO_INCREMENT,
- subject_type varchar(24) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
- subject_id int(11) unsigned NOT NULL,
- object_type varchar(24) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
- object_id int(11) unsigned NOT NULL,
- is_private int(1) NOT NULL DEFAULT '0',
- PRIMARY KEY (repost_id),
- UNIQUE KEY `BETWEEN` (subject_type,subject_id,object_type,object_id,is_private),
- KEY SUBJECT (subject_type,subject_id),
- KEY OBJECT (object_type,object_id)
-) ENGINE=InnoDB;
-
-SELECT
- *
-FROM
- t2, t1
-WHERE
- t2.object_type = 'event' AND
- t2.object_id = t1.event_id AND
- t2.is_private = 0 AND
- t2.subject_id = 127994 AND
- t2.subject_type in ('user')
-;
-DROP TABLE t1, t2;
-set optimizer_use_condition_selectivity=@tmp_mdev6808;
-
---echo #
---echo # MDEV-6442: Assertion `join->best_read < double(...)' failed with optimizer_use_condition_selectivity >=3, ...
---echo #
-SET use_stat_tables = PREFERABLY;
-SET optimizer_use_condition_selectivity = 3;
-
-CREATE TABLE t1 ( a VARCHAR(3), b VARCHAR(8), KEY (a,b) ) ENGINE=InnoDB;
-INSERT INTO t1 VALUES ('USA','Chinese'),('USA','English');
-
-CREATE TABLE t2 (i INT) ENGINE=InnoDB;
-
-SELECT * FROM t1, t2 WHERE ( 't', 'o' ) IN (
- SELECT t1_2.b, t1_1.a FROM t1 AS t1_1 STRAIGHT_JOIN t1 AS t1_2 ON ( t1_2.a = t1_1.b )
-);
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-6738: use_stat_table + histograms crashing optimizer
---echo #
-
-set use_stat_tables='preferably';
-set optimizer_use_condition_selectivity=4;
-
---echo # Need innodb because there is a special kind of field_bit for non-myisam tables
-create table t1(col1 int, col2 bit(1) DEFAULT NULL) engine=innodb;
-
-select * from t1 where col2 != true;
-
-drop table t1;
-
---echo #
---echo # MDEV-7413: optimizer_use_condition_selectivity > 2 crashes 10.0.15+maria-1~wheezy
---echo #
-
-CREATE TABLE t1 (
- parent_id int,
- child_group_id int,
- child_user_id int,
- KEY (parent_id,child_group_id,child_user_id)
-) ENGINE=InnoDB;
-
-CREATE TABLE t2 (
- id int,
- lower_group_name varchar(255),
- directory_id int(20),
- UNIQUE KEY (directory_id)
-) ENGINE=InnoDB;
-
-CREATE TABLE t3 (id int) ENGINE=InnoDB;
-
-insert into t1 values (1,1,1),(2,2,2);
-insert into t2 values (10,'foo',10),(20,'bar',20);
-insert into t3 values (101),(102);
-set use_stat_tables = PREFERABLY, optimizer_use_condition_selectivity = 3;
-
-select * from t1, t2, t3
-where t1.child_user_id=t3.id and t1.child_group_id is null and t2.lower_group_name='foo' and t1.parent_id=t2.id and t2.directory_id=10;
-
-drop table t1,t2,t3;
-
---echo #
---echo # MDEV-9187: duplicate of bug mdev-9628
---echo #
-
-set use_stat_tables = preferably;
-set optimizer_use_condition_selectivity=3;
-
-CREATE TABLE t1 (f1 char(32)) ENGINE=InnoDB;
-INSERT INTO t1 VALUES ('foo'),('bar'),('qux');
-ANALYZE TABLE t1;
-
-SELECT * FROM t1 WHERE f1 < 'm';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE f1 < 'm';
-
-CREATE TABLE t2 (f1 TEXT) ENGINE=InnoDB;
-INSERT INTO t2 VALUES ('foo'),('bar'),('qux');
-ANALYZE TABLE t2;
-
-SELECT * FROM t2 WHERE f1 <> 'qux';
-EXPLAIN EXTENDED
-SELECT * FROM t2 WHERE f1 <> 'qux';
-
-DROP TABLE t1,t2;
-
---echo #
---echo # End of 10.0 tests
---echo #
-
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-11060: sql/protocol.cc:532: void Protocol::end_statement(): Assertion `0' failed
---echo #
-
-
-set optimizer_use_condition_selectivity=4;
-
---disable_warnings
-drop view if exists v1;
---enable_warnings
-
-create table t1 (a int not null, b int, c int) engine=InnoDB;
-create trigger trgi before insert on t1 for each row set new.a=if(new.a is null,new.b,new.c);
-
-create table t2 (d int, e int) engine=InnoDB;
-update t1, t2 set a=NULL, b=2, c=NULL where b=d and e=200;
-
-create view v1 as select * from t1, t2 where d=2;
---error ER_BAD_NULL_ERROR
-insert v1 (a,c) values (NULL, 20);
-
-drop table t1,t2;
-drop view v1;
-
---echo #
---echo # End of 10.1 tests
---echo #
-
-set use_stat_tables= @tmp_ust;
-set optimizer_use_condition_selectivity= @tmp_oucs;
-SET SESSION STORAGE_ENGINE=DEFAULT;
diff --git a/mysql-test/t/selectivity_no_engine.test b/mysql-test/t/selectivity_no_engine.test
deleted file mode 100644
index 2a31c01ed97..00000000000
--- a/mysql-test/t/selectivity_no_engine.test
+++ /dev/null
@@ -1,238 +0,0 @@
---source include/have_stat_tables.inc
-
---echo #
---echo # Engine-agnostic tests for statistics-based selectivity calculations.
---echo # - selectivity tests that depend on the engine should go into
---echo # t/selectivity.test. That test is run with myisam/innodb/xtradb.
---echo # - this file is for tests that don't depend on the engine.
---echo #
-
---disable_warnings
-drop table if exists t0,t1,t2,t3;
---enable_warnings
-
-select @@global.use_stat_tables;
-select @@session.use_stat_tables;
-
-set @save_use_stat_tables=@@use_stat_tables;
-
-set use_stat_tables='preferably';
-
-set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity;
-set @save_histogram_size=@@histogram_size;
-set @save_histogram_type=@@histogram_type;
-
---echo #
---echo # MDEV-5917: EITS: different order of predicates in IN (...) causes different estimates
---echo #
-create table t1(a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t2 (col1 int);
---echo # one value in 1..100 range
-insert into t2 select ta.a + tb.a*10 from t1 ta, t1 tb;
---echo # ten values in 100...200 range
-insert into t2 select 100 + ta.a + tb.a*10 from t1 ta, t1 tb, t1 tc;
-
-set histogram_type='SINGLE_PREC_HB';
-set histogram_size=100;
-set optimizer_use_condition_selectivity=4;
-analyze table t2 persistent for all;
-
---echo # The following two must have the same in 'Extra' column:
-explain extended select * from t2 where col1 IN (20, 180);
-explain extended select * from t2 where col1 IN (180, 20);
-
-drop table t1, t2;
-
---echo #
---echo # MDEV-5926: EITS: Histogram estimates for column=least_possible_value are wrong
---echo #
-create table t0(a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t1(a int);
-insert into t1 select ta.a from t0 ta, t0 tb, t0 tc;
-set histogram_size=20;
-set histogram_type='single_prec_hb';
-analyze table t1 persistent for all;
-set use_stat_tables='preferably';
-set optimizer_use_condition_selectivity=4;
---echo # Should select about 10%:
-explain extended select * from t1 where a=2;
---echo # Should select about 10%:
-explain extended select * from t1 where a=1;
---echo # Must not have filtered=100%:
-explain extended select * from t1 where a=0;
---echo # Again, must not have filtered=100%:
-explain extended select * from t1 where a=-1;
-
-drop table t0, t1;
-
---echo #
---echo # MDEV-4362: Selectivity estimates for IN (...) do not depend on whether the values are in range
---echo #
-create table t1 (col1 int);
-set @a=-1;
-create table t2 (a int) select (@a:=@a+1) as a from information_schema.session_variables ta limit 100;
-insert into t1 select ta.a from t2 ta, t2 tb where ta.a < 100 and tb.a < 100;
-select min(col1), max(col1), count(*) from t1;
-set histogram_size=100;
-analyze table t1 persistent for all;
-explain extended select * from t1 where col1 in (1,2,3);
---echo # Must not cause fp division by zero, or produce nonsense numbers:
-explain extended select * from t1 where col1 in (-1,-2,-3);
-explain extended select * from t1 where col1<=-1;
-drop table t1, t2;
-
---echo #
---echo # MDEV-5984: EITS: Incorrect filtered% value for single-table select with range access
---echo #
-create table t1(a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t2 (a int, b int, col1 varchar(64), col2 varchar(64), key(a,b));
-insert into t2 select ta.a+10*tb.a, tc.a+10*td.a, 'filler-data1', 'filler-data2' from t1 ta, t1 tb, t1 tc, t1 td;
-
-set histogram_size=100;
-set optimizer_use_condition_selectivity=4;
-set use_stat_tables='preferably';
-analyze table t2 persistent for all;
---echo # This must show filtered=100%:
-explain extended select * from t2 where a in (1,2,3) and b in (1,2,3);
-
-drop table t2, t1;
-
---echo #
---echo # MDEV-5980: EITS: if condition is used for REF access, its selectivity is still in filtered%
---echo #
-create table t0(a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t1(key1 int, col1 int, key(key1));
-insert into t1 select ta.a, ta.a from t0 ta, t0 tb, t0 tc;
-
-set histogram_size=100;
-set use_stat_tables='preferably';
-set optimizer_use_condition_selectivity=4;
-analyze table t1 persistent for all;
---echo # 10% is ok
-explain extended select * from t1 where col1=2;
---echo # Must show 100%, not 10%
-explain extended select * from t1 where key1=2;
-drop table t0, t1;
-
---echo # MDEV-6003: EITS: ref access, keypart2=const vs keypart2=expr - inconsistent filtered% value
---echo #
-create table t0(a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t1 (
- kp1 int, kp2 int,
- filler1 char(100),
- filler2 char(100),
- key(kp1, kp2)
-);
-
-insert into t1
-select
- ta.a,
- tb.a,
- 'filler-data-1',
- 'filler-data-2'
-from t0 ta, t0 tb, t0 tc;
-set histogram_size=100;
-set use_stat_tables='preferably';
-set optimizer_use_condition_selectivity=4;
-analyze table t1 persistent for all;
---echo # NOTE: 10*100%, 10*100% rows is ok
-explain extended select * from t0, t1 where t1.kp1=t0.a and t1.kp2=t0.a+1;
-
---echo # NOTE: t0: 10*100% is ok, t1: 10*9.90% is bad. t1 should have 10*100%.
-explain extended select * from t0, t1 where t1.kp1=t0.a and t1.kp2=4;
-drop table t0, t1;
-
---echo #
---echo # MDEV-6209: Assertion `join->best_read < double(1.79769313486231570815e+308L)'
---echo # failed in bool greedy_search with optimizer_use_condition_selectivity>1
---echo #
-SET optimizer_use_condition_selectivity = 2;
-
-CREATE TABLE t1 (a CHAR(6), b INT, PRIMARY KEY (a,b)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('foo',1),('bar',2);
-
-SELECT * FROM t1 AS t1_1, t1 AS t1_2 WHERE NOT ( t1_1.a <> 'baz');
-DROP TABLE t1;
-
---echo #
---echo # MDEV-6308: Server crashes in table_multi_eq_cond_selectivity with ...
---echo #
-CREATE TABLE t1 (
- id varchar(40) COLLATE utf8_bin,
- dt datetime,
- PRIMARY KEY (id)
-);
-
-INSERT INTO t1 VALUES ('foo','2011-04-12 05:18:08'),
- ('bar','2013-09-19 11:37:03');
-
-CREATE TABLE t2 (
- t1_id varchar(40) COLLATE utf8_bin,
- f1 varchar(64),
- f2 varchar(1024),
- KEY (f1,f2(255))
-);
-
-INSERT INTO t2 VALUES ('foo','baz','qux'),('bar','baz','qux');
-
-set optimizer_use_condition_selectivity=2;
-explain
-select * from t1,t2 where t1.id = t2.t1_id and t2.f2='qux' and t2.f1='baz';
-select * from t1,t2 where t1.id = t2.t1_id and t2.f2='qux' and t2.f1='baz';
-
-drop table t1,t2;
-
---echo #
---echo # MDEV-5985: EITS: selectivity estimates look illogical for join and non-key equalities
---echo #
-
-create table t0(a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t1(a int);
-insert into t1 select ta.a + tb.a* 10 + tc.a * 100 from t0 ta, t0 tb, t0 tc;
-create table t2 as select * from t1;
-set histogram_size=100;
-set use_stat_tables='preferably';
-set optimizer_use_condition_selectivity=4;
-analyze table t1 persistent for all;
-analyze table t2 persistent for all;
---echo # Filtered will be 4.95, 9.90
-explain extended select * from t1 ta, t2 tb where ta.a < 40 and tb.a < 100;
---echo # Here, tb.filtered should not become 100%:
-explain extended select * from t1 ta, t2 tb where ta.a < 40 and tb.a < 100 and tb.a=ta.a;
-
-drop table t0,t1,t2;
-
---echo #
---echo # MDEV-8779: mysqld got signal 11 in sql/opt_range_mrr.cc:100(step_down_to)
---echo #
-set @tmp_mdev8779=@@optimizer_use_condition_selectivity;
-set optimizer_use_condition_selectivity=5;
-CREATE TABLE t1 (
- i int(10) unsigned NOT NULL AUTO_INCREMENT,
- n varchar(2048) NOT NULL,
- d tinyint(1) unsigned NOT NULL,
- p int(10) unsigned NOT NULL,
- PRIMARY KEY (i)
-) DEFAULT CHARSET=utf8;
-insert into t1 values (1,'aaa',1,1), (2,'bbb',2,2);
-SELECT * FROM t1 WHERE t1.d = 0 AND t1.p = '1' AND t1.i != '-1' AND t1.n = 'some text';
-set optimizer_use_condition_selectivity= @tmp_mdev8779;
-DROP TABLE t1;
-
---echo #
---echo # End of the test file
---echo #
-
-set use_stat_tables= @save_use_stat_tables;
-set histogram_type=@save_histogram_type;
-set histogram_size=@save_histogram_size;
-set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
-
diff --git a/mysql-test/t/servers.test b/mysql-test/t/servers.test
deleted file mode 100644
index 645206c376e..00000000000
--- a/mysql-test/t/servers.test
+++ /dev/null
@@ -1,24 +0,0 @@
-# Generic tests for servers (do not require FEDERATED)
-set sql_mode="";
-
---echo #
---echo # MDEV-4594 - CREATE SERVER crashes embedded
---echo #
-CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS(HOST 'localhost');
-SELECT * FROM mysql.servers;
-DROP SERVER s1;
-
-CREATE SERVER s1 FOREIGN DATA WRAPPER foo OPTIONS(USER 'bar');
-SELECT * FROM mysql.servers;
-DROP SERVER s1;
-
---error ER_CANT_CREATE_FEDERATED_TABLE
-CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS(USER 'bar');
-
-CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS(HOST 'bar');
-SELECT * FROM mysql.servers;
-DROP SERVER s1;
-
-CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS(SOCKET 'bar');
-SELECT * FROM mysql.servers;
-DROP SERVER s1;
diff --git a/mysql-test/t/set_password_plugin-9835.test b/mysql-test/t/set_password_plugin-9835.test
deleted file mode 100644
index 6afccd74f9d..00000000000
--- a/mysql-test/t/set_password_plugin-9835.test
+++ /dev/null
@@ -1,131 +0,0 @@
-#
-# MDEV-9835 Valid password is not working after server restart.
-#
-# Various combinations of SET PASSWORD and not-empty mysql.user.plugin field
-#
---source include/not_embedded.inc
-
---enable_connect_log
-
-set global secure_auth=0;
-
-# The hash (old and new) is for 'test'
-create user natauth@localhost identified via 'mysql_native_password' using '*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29';
-
-create user newpass@localhost identified by password '*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29';
-
-create user newpassnat@localhost identified via 'mysql_native_password';
-set password for newpassnat@localhost = '*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29';
-
-create user oldauth@localhost identified with 'mysql_old_password' using '378b243e220ca493';
-
-create user oldpass@localhost identified by password '378b243e220ca493';
-
-create user oldpassold@localhost identified with 'mysql_old_password';
-set password for oldpassold@localhost = '378b243e220ca493';
-
---sorted_result
-select user, host, password, plugin, authentication_string from mysql.user where user != 'root';
-
---connect(con,localhost,natauth,test,)
-select current_user();
---disconnect con
---connect(con,localhost,newpass,test,)
-select current_user();
---disconnect con
---connect(con,localhost,newpassnat,test,)
-select current_user();
---disconnect con
---connect(con,localhost,oldauth,test,)
-select current_user();
---disconnect con
---connect(con,localhost,oldpass,test,)
-select current_user();
---disconnect con
---connect(con,localhost,oldpassold,test,)
-select current_user();
---disconnect con
-
---connection default
-
-flush privileges;
-
---connect(con,localhost,natauth,test,)
-select current_user();
---disconnect con
---connect(con,localhost,newpass,test,)
-select current_user();
---disconnect con
---connect(con,localhost,newpassnat,test,)
-select current_user();
---disconnect con
---connect(con,localhost,oldauth,test,)
-select current_user();
---disconnect con
---connect(con,localhost,oldpass,test,)
-select current_user();
---disconnect con
---connect(con,localhost,oldpassold,test,)
-select current_user();
---disconnect con
-
---connection default
-
-# changing to the NEW password hash
-set password for natauth@localhost = PASSWORD('test2');
-set password for newpass@localhost = PASSWORD('test2');
-set password for newpassnat@localhost = PASSWORD('test2');
-set password for oldauth@localhost = PASSWORD('test2');
-set password for oldpass@localhost = PASSWORD('test2');
-set password for oldpassold@localhost = PASSWORD('test2');
-
---sorted_result
-select user, host, password, plugin, authentication_string from mysql.user where user != 'root';
-
---connect(con,localhost,natauth,test2,)
-select current_user();
---disconnect con
---connect(con,localhost,newpass,test2,)
-select current_user();
---disconnect con
---connect(con,localhost,newpassnat,test2,)
-select current_user();
---disconnect con
---connect(con,localhost,oldauth,test2,)
-select current_user();
---disconnect con
---connect(con,localhost,oldpass,test2,)
-select current_user();
---disconnect con
---connect(con,localhost,oldpassold,test2,)
-select current_user();
---disconnect con
-
---connection default
-
-flush privileges;
-
---connect(con,localhost,natauth,test2,)
-select current_user();
---disconnect con
---connect(con,localhost,newpass,test2,)
-select current_user();
---disconnect con
---connect(con,localhost,newpassnat,test2,)
-select current_user();
---disconnect con
---connect(con,localhost,oldauth,test2,)
-select current_user();
---disconnect con
---connect(con,localhost,oldpass,test2,)
-select current_user();
---disconnect con
---connect(con,localhost,oldpassold,test2,)
-select current_user();
---disconnect con
-
---connection default
-drop user natauth@localhost, newpass@localhost, newpassnat@localhost;
-drop user oldauth@localhost, oldpass@localhost, oldpassold@localhost;
-set global secure_auth=default;
-
diff --git a/mysql-test/t/set_statement.test b/mysql-test/t/set_statement.test
deleted file mode 100644
index cc361553cfd..00000000000
--- a/mysql-test/t/set_statement.test
+++ /dev/null
@@ -1,1132 +0,0 @@
---echo '# SET STATEMENT ..... FOR .... TEST'
-############################ STATEMENT_SET #############################
-# #
-# Testing working functionality of SET STATEMENT #
-# #
-# #
-# There is important documentation within #
-# #
-# #
-# Author: Joe Lukas #
-# Creation: #
-# 2009-08-02 Implement this test as part of #
-# WL#681 Per query variable settings #
-# #
-########################################################################
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP FUNCTION IF EXISTS myProc;
-DROP PROCEDURE IF EXISTS p1;
-DROP PROCEDURE IF EXISTS p2;
-DROP PROCEDURE IF EXISTS p3;
-DROP PROCEDURE IF EXISTS p4;
-DROP PROCEDURE IF EXISTS p5;
-DROP PROCEDURE IF EXISTS p6;
-DROP VIEW IF EXISTS v1;
-DROP TABLE IF EXISTS STATEMENT;
---enable_warnings
-SET @save_binlog_format = @@binlog_format;
-SET @save_keep_files_on_create = @@keep_files_on_create;
-SET @save_max_join_size = @@max_join_size;
-SET @save_myisam_repair_threads = @@myisam_repair_threads;
-SET @save_myisam_sort_buffer_size = @@myisam_sort_buffer_size;
-SET @save_sort_buffer_size = @@sort_buffer_size;
-####################################################################
-#Set up current database
-####################################################################
---echo '# Setup database'
-CREATE TABLE t1 (v1 INT, v2 INT);
-INSERT INTO t1 VALUES (1,2);
-INSERT INTO t1 VALUES (3,4);
---echo ''
---echo '#------------------ STATEMENT Test 1 -----------------------#'
-####################################################################
-# Checks with variable value type ulong #
-####################################################################
---echo '# Initialize variables to known setting'
-SET SESSION sort_buffer_size=100000;
---echo ''
---echo '# Pre-STATEMENT variable value'
-SHOW SESSION VARIABLES LIKE 'sort_buffer_size';
-SET STATEMENT sort_buffer_size=150000 FOR SELECT *,@@sort_buffer_size FROM t1;
---echo ''
---echo '# Post-STATEMENT variable value'
-SHOW SESSION VARIABLES LIKE 'sort_buffer_size';
---echo ''
---echo '#------------------ STATEMENT Test 2 -----------------------#'
-####################################################################
-# Checks for multiple set values inside STATEMENT ... FOR #
-####################################################################
---echo '# Initialize variables to known setting'
-SET SESSION binlog_format=mixed;
-SET SESSION sort_buffer_size=100000;
---echo '# Pre-STATEMENT variable value'
-SHOW SESSION VARIABLES LIKE 'sort_buffer_size';
-SHOW SESSION VARIABLES LIKE 'binlog_format';
-SET STATEMENT sort_buffer_size=150000, binlog_format=row
- FOR SELECT *,@@sort_buffer_size,@@binlog_format FROM t1;
---echo '# Post-STATEMENT variable value'
-SHOW SESSION VARIABLES LIKE 'sort_buffer_size';
-SHOW SESSION VARIABLES LIKE 'binlog_format';
-
---echo ''
---echo '#------------------ STATEMENT Test 3 -----------------------#'
-####################################################################
-# Check current variable value is stored in using stored #
-# statements. #
-####################################################################
---echo '# set initial variable value, make prepared statement
-SET SESSION binlog_format=row;
-PREPARE stmt1 FROM 'SET STATEMENT binlog_format=row FOR SELECT *,@@binlog_format FROM t1';
---echo ''
---echo '# Change variable setting'
-SET SESSION binlog_format=mixed;
---echo ''
---echo '# Pre-STATEMENT variable value'
---echo ''
-SHOW SESSION VARIABLES LIKE 'binlog_format';
---echo ''
-EXECUTE stmt1;
---echo ''
---echo '# Post-STATEMENT variable value'
-SHOW SESSION VARIABLES LIKE 'binlog_format';
-
---echo ''
-DEALLOCATE PREPARE stmt1;
---echo '#------------------ STATEMENT Test 4 -----------------------#'
-####################################################################
-# Check works with OPTIMIZE TABLE command #
-# Checks works with a variable value of type INT #
-# Checks works with variable type ULONGLONG #
-####################################################################
---echo '# set initial variable value, make prepared statement
-SET SESSION myisam_sort_buffer_size=500000, myisam_repair_threads=1;
---echo ''
---echo '# Pre-STATEMENT variable value'
-SHOW SESSION VARIABLES LIKE 'myisam_sort_buffer_size';
-SHOW SESSION VARIABLES LIKE 'myisam_repair_threads';
---echo ''
-SET STATEMENT myisam_sort_buffer_size=800000,
- myisam_repair_threads=2 FOR OPTIMIZE TABLE t1;
---echo ''
---echo '# Post-STATEMENT variable value'
-SHOW SESSION VARIABLES LIKE 'myisam_sort_buffer_size';
-SHOW SESSION VARIABLES LIKE 'myisam_repair_threads';
-
---echo ''
---echo '#------------------ STATEMENT Test 5 -----------------------#'
-####################################################################
-# Checks if variable reset after error in statement after FOR #
-####################################################################
---echo '# Initialize variables to known setting'
-SET SESSION sort_buffer_size=100000;
---echo ''
---echo '# Pre-STATEMENT variable value'
-SHOW SESSION VARIABLES LIKE 'sort_buffer_size';
---echo ''
---error ER_NO_SUCH_TABLE
-SET STATEMENT sort_buffer_size=150000 FOR SELECT * FROM t2;
---echo ''
---echo '# Post-STATEMENT variable value'
-SHOW SESSION VARIABLES LIKE 'sort_buffer_size';
-
---echo ''
---echo '#------------------ STATEMENT Test 6 -----------------------#'
-####################################################################
-# Checks works with variable type MY_BOOL #
-####################################################################
---echo '# Initialize variables to known setting'
-SET SESSION keep_files_on_create=ON;
---echo ''
---echo '# Pre-STATEMENT variable value'
-SHOW SESSION VARIABLES LIKE 'keep_files_on_create';
---echo ''
-SET STATEMENT keep_files_on_create=OFF FOR SELECT *,@@keep_files_on_create FROM t1;
---echo ''
---echo '# Post-STATEMENT variable value'
-SHOW SESSION VARIABLES LIKE 'keep_files_on_create';
-
---echo ''
---echo '#------------------ STATEMENT Test 7 -----------------------#'
-####################################################################
-# Checks works with variable type HA_ROWS #
-####################################################################
---echo '# Initialize variables to known setting'
-SET SESSION max_join_size=2222220000000;
---echo ''
---echo '# Pre-STATEMENT variable value'
-SHOW SESSION VARIABLES LIKE 'max_join_size';
---echo ''
-SET STATEMENT max_join_size=1000000000000 FOR SELECT *,@@max_join_size FROM t1;
---echo ''
---echo '# Post-STATEMENT variable value'
-SHOW SESSION VARIABLES LIKE 'max_join_size';
-
---echo ''
---echo '#------------------Test 8-----------------------#'
-####################################################################
-# Ensure variable of each type is set to proper value during #
-# statement after FOR execution #
-####################################################################
---echo '# Initialize test variables'
-SET SESSION myisam_sort_buffer_size=500000,
- myisam_repair_threads=1,
- sort_buffer_size = 200000,
- max_join_size=2222220000000,
- keep_files_on_create=ON;
-
---echo ''
---echo '# LONG '
-SHOW SESSION VARIABLES LIKE 'sort_buffer_size';
-SET STATEMENT sort_buffer_size = 100000
- FOR SHOW SESSION VARIABLES LIKE 'sort_buffer_size';
-SHOW SESSION VARIABLES LIKE 'sort_buffer_size';
---echo ''
---echo '# MY_BOOL '
-SHOW SESSION VARIABLES LIKE 'keep_files_on_create';
-SET STATEMENT keep_files_on_create=OFF
- FOR SHOW SESSION VARIABLES LIKE 'keep_files_on_create';
-SHOW SESSION VARIABLES LIKE 'keep_files_on_create';
-
---echo ''
---echo '# INT/LONG '
-SHOW SESSION VARIABLES LIKE 'myisam_repair_threads';
-SET STATEMENT myisam_repair_threads=2
- FOR SHOW SESSION VARIABLES LIKE 'myisam_repair_threads';
-SHOW SESSION VARIABLES LIKE 'myisam_repair_threads';
---echo ''
---echo '# ULONGLONG '
-SHOW SESSION VARIABLES LIKE 'max_join_size';
-SET STATEMENT max_join_size=2000000000000
- FOR SHOW SESSION VARIABLES LIKE 'max_join_size';
-SHOW SESSION VARIABLES LIKE 'max_join_size';
-
---echo ''
---echo '#------------------Test 9-----------------------#'
-####################################################################
-# No 1 - Check works with CREATE ... BEGIN ... END command #
-# Display variables during execution #
-# No 2 - Test with DROP command #
-####################################################################
---echo '# set initial variable values
-SET SESSION myisam_sort_buffer_size=500000,
- myisam_repair_threads=1,
- sort_buffer_size=100000,
- binlog_format=mixed,
- keep_files_on_create=ON,
- max_join_size=2222220000000;
---echo ''
---echo ''
---echo '# Pre-STATEMENT variable value
-SELECT @@myisam_sort_buffer_size,
- @@myisam_repair_threads,
- @@sort_buffer_size,
- @@binlog_format,
- @@keep_files_on_create,
- @@max_join_size;
---echo ''
---echo ''
-DELIMITER |;
-CREATE FUNCTION myProc (cost DECIMAL(10,2))
- RETURNS DECIMAL(10,2)
-
- SQL SECURITY DEFINER
-
- tax: BEGIN
- DECLARE order_tax DECIMAL(10,2);
- SET order_tax = cost * .05 + @@sort_buffer_size;
- RETURN order_tax;
- END|
-DELIMITER ;|
---echo ''
---echo '# During Execution values
-SET STATEMENT myisam_sort_buffer_size=400000,
- myisam_repair_threads=2,
- sort_buffer_size=200000,
- binlog_format=row,
- keep_files_on_create=OFF,
- max_join_size=4444440000000 FOR
- SELECT myProc(123.45);
-SET STATEMENT myisam_sort_buffer_size=400000,
- myisam_repair_threads=2,
- sort_buffer_size=300000,
- binlog_format=row,
- keep_files_on_create=OFF,
- max_join_size=4444440000000 FOR
- SELECT myProc(123.45);
---echo ''
---echo '# Post-STATEMENT No 1 variable value Pre-STATEMENT for No 2'
-SELECT @@myisam_sort_buffer_size,
- @@myisam_repair_threads,
- @@sort_buffer_size,
- @@binlog_format,
- @@keep_files_on_create,
- @@max_join_size;
---echo ''
-SET STATEMENT myisam_sort_buffer_size=400000,
- myisam_repair_threads=2,
- sort_buffer_size=200000,
- binlog_format=row,
- keep_files_on_create=OFF,
- max_join_size=4444440000000 FOR
- DROP FUNCTION myProc;
---echo ''
---echo '# Post-STATEMENT No 2 variable value
-SELECT @@myisam_sort_buffer_size,
- @@myisam_repair_threads,
- @@sort_buffer_size,
- @@binlog_format,
- @@keep_files_on_create,
- @@max_join_size;
-
---echo ''
---echo '#------------------Test 11-----------------------#'
-####################################################################
-# No 1 - Check with PREPARE statement #
-# check with different variable on inside PREPARE #
-# No 2 - Check with EXECUTE statement #
-####################################################################
---echo '# set initial variable values
-SET SESSION myisam_sort_buffer_size=500000,
- myisam_repair_threads=1,
- sort_buffer_size=100000,
- binlog_format=mixed,
- keep_files_on_create=ON,
- max_join_size=2222220000000;
---echo ''
---echo ''
---echo '# Pre-STATEMENT variable value
-SELECT @@myisam_sort_buffer_size,
- @@myisam_repair_threads,
- @@sort_buffer_size,
- @@binlog_format,
- @@keep_files_on_create,
- @@max_join_size;
---echo ''
---echo ''
-SET STATEMENT myisam_sort_buffer_size=400000,
- myisam_repair_threads=2,
- sort_buffer_size=200000,
- keep_files_on_create=OFF,
- max_join_size=4444440000000 FOR
- PREPARE stmt1 FROM
- 'SET STATEMENT binlog_format=row FOR SELECT *,@@binlog_format,@@sort_buffer_size FROM t1';
---echo ''
---echo 'Test No 1 Post Value & Test 2 Pre values'
-SELECT @@myisam_sort_buffer_size,
- @@myisam_repair_threads,
- @@sort_buffer_size,
- @@binlog_format,
- @@keep_files_on_create,
- @@max_join_size;
---echo ''
---echo ''
-SET STATEMENT myisam_sort_buffer_size=400000,
- myisam_repair_threads=2,
- sort_buffer_size=200000,
- keep_files_on_create=OFF,
- max_join_size=4444440000000 FOR
- EXECUTE stmt1;
---echo ''
---echo '# Post-STATEMENT No 2
-SELECT @@myisam_sort_buffer_size,
- @@myisam_repair_threads,
- @@sort_buffer_size,
- @@binlog_format,
- @@keep_files_on_create,
- @@max_join_size;
---echo ''
---echo ''
---echo '#------------------Test 12-----------------------#'
-####################################################################
-# No 1 - Check with PROCEDURE (show variables in procedure) #
-# No 2 - Check with CALL statement show variables in PROCEDURE #
-####################################################################
---echo '# set initial variable values
-SET SESSION myisam_sort_buffer_size=500000,
- myisam_repair_threads=1,
- sort_buffer_size=100000,
- binlog_format=mixed,
- keep_files_on_create=ON,
- max_join_size=2222220000000;
---echo ''
---echo ''
---echo '# Pre-STATEMENT variable value
-SELECT @@myisam_sort_buffer_size,
- @@myisam_repair_threads,
- @@sort_buffer_size,
- @@binlog_format,
- @@keep_files_on_create,
- @@max_join_size;
---echo ''
---echo ''
-DELIMITER |;
-SET STATEMENT myisam_sort_buffer_size=400000,
- myisam_repair_threads=2,
- sort_buffer_size=200000,
- binlog_format=row,
- keep_files_on_create=OFF,
- max_join_size=4444440000000 FOR
- CREATE PROCEDURE p1() BEGIN
- SELECT @@myisam_sort_buffer_size,
- @@myisam_repair_threads,
- @@sort_buffer_size,
- @@binlog_format,
- @@keep_files_on_create,
- @@max_join_size;
- END|
-DELIMITER ;|
---echo ''
---echo 'Test No 1 Post Value & Test 2 Pre values'
-SELECT @@myisam_sort_buffer_size,
- @@myisam_repair_threads,
- @@sort_buffer_size,
- @@binlog_format,
- @@keep_files_on_create,
- @@max_join_size;
---echo ''
---echo ''
-SET STATEMENT myisam_sort_buffer_size=400001,
- myisam_repair_threads=3,
- sort_buffer_size=200001,
- binlog_format=row,
- keep_files_on_create=OFF,
- max_join_size=4444440000001 FOR
- CALL p1();
---echo ''
---echo '# Post-STATEMENT No 2
-SELECT @@myisam_sort_buffer_size,
- @@myisam_repair_threads,
- @@sort_buffer_size,
- @@binlog_format,
- @@keep_files_on_create,
- @@max_join_size;
---echo ''
---echo ''
-
---echo '#------------------Test 13-----------------------#'
-####################################################################
-# Check PROCEDURE containing SET STATEMENT FOR #
-# p1() from test 12 will be used to display variables #
-####################################################################
---echo '# set initial variable values
-SET SESSION myisam_sort_buffer_size=500000,
- myisam_repair_threads=1,
- sort_buffer_size=100000,
- binlog_format=mixed,
- keep_files_on_create=ON,
- max_join_size=2222220000000;
---echo ''
---echo ''
-DELIMITER |;
-CREATE PROCEDURE p2() BEGIN
- SET STATEMENT myisam_sort_buffer_size=400000,
- myisam_repair_threads=3,
- sort_buffer_size=300000,
- binlog_format=mixed,
- keep_files_on_create=OFF,
- max_join_size=3333330000000 FOR
- CALL p1();
- END|
-DELIMITER ;|
---echo ''
---echo '# Pre-STATEMENT variable value
-SELECT @@myisam_sort_buffer_size,
- @@myisam_repair_threads,
- @@sort_buffer_size,
- @@binlog_format,
- @@keep_files_on_create,
- @@max_join_size;
---echo ''
---echo ''
-SET STATEMENT myisam_sort_buffer_size=400000,
- myisam_repair_threads=2,
- sort_buffer_size=200000,
- binlog_format=row,
- keep_files_on_create=OFF,
- max_join_size=4444440000000 FOR
- CALL p2();
---echo ''
---echo '# Post-STATEMENT
-SELECT @@myisam_sort_buffer_size,
- @@myisam_repair_threads,
- @@sort_buffer_size,
- @@binlog_format,
- @@keep_files_on_create,
- @@max_join_size;
---echo ''
---echo ''
---echo '#------------------Test 14-----------------------#'
-####################################################################
-# Check PROCEDURE containing compound SET STATEMENT FOR #
-# p2() will be used as compounding statement from test 13 #
-####################################################################
---echo '# set initial variable values
-SET SESSION myisam_sort_buffer_size=500000,
- myisam_repair_threads=1,
- sort_buffer_size=100000,
- binlog_format=mixed,
- keep_files_on_create=ON,
- max_join_size=2222220000000;
---echo ''
---echo ''
-DELIMITER |;
-CREATE PROCEDURE p3() BEGIN
- SELECT @@myisam_sort_buffer_size,
- @@myisam_repair_threads,
- @@sort_buffer_size,
- @@binlog_format,
- @@keep_files_on_create,
- @@max_join_size;
- SET STATEMENT myisam_sort_buffer_size=320000,
- myisam_repair_threads=2,
- sort_buffer_size=220022,
- binlog_format=row,
- keep_files_on_create=ON,
- max_join_size=2222220000000 FOR
- CALL p2();
- END|
-DELIMITER ;|
---echo ''
---echo '# Pre-STATEMENT variable value
-SELECT @@myisam_sort_buffer_size,
- @@myisam_repair_threads,
- @@sort_buffer_size,
- @@binlog_format,
- @@keep_files_on_create,
- @@max_join_size;
---echo ''
---echo ''
-SET STATEMENT myisam_sort_buffer_size=400000,
- myisam_repair_threads=2,
- sort_buffer_size=200000,
- binlog_format=row,
- keep_files_on_create=OFF,
- max_join_size=4444440000000 FOR
- CALL p3();
---echo ''
---echo '# Post-STATEMENT
-SELECT @@myisam_sort_buffer_size,
- @@myisam_repair_threads,
- @@sort_buffer_size,
- @@binlog_format,
- @@keep_files_on_create,
- @@max_join_size;
---echo ''
---echo ''
-
- --echo ''
---echo ''
---echo '#------------------Test 15-----------------------#'
-####################################################################
-# Check PROCEDURE containing compound SET STATEMENT FOR #
-# call multiple SET STATEMENT .. FOR showing SELECT #
-####################################################################
---echo '# set initial variable values
-SET SESSION myisam_sort_buffer_size=500000,
- myisam_repair_threads=1,
- sort_buffer_size=100000,
- binlog_format=mixed,
- keep_files_on_create=ON,
- max_join_size=2222220000000;
---echo ''
---echo ''
-DELIMITER |;
-CREATE PROCEDURE p4() BEGIN
- SELECT @@myisam_sort_buffer_size,
- @@myisam_repair_threads,
- @@sort_buffer_size,
- @@binlog_format,
- @@keep_files_on_create,
- @@max_join_size;
- SET STATEMENT myisam_sort_buffer_size=320000,
- myisam_repair_threads=2,
- sort_buffer_size=220022,
- binlog_format=row,
- keep_files_on_create=ON,
- max_join_size=2222220000000 FOR
- SELECT @@myisam_sort_buffer_size,
- @@myisam_repair_threads,
- @@sort_buffer_size,
- @@binlog_format,
- @@keep_files_on_create,
- @@max_join_size;
- SET STATEMENT myisam_sort_buffer_size=320000,
- myisam_repair_threads=2,
- sort_buffer_size=220022,
- binlog_format=row,
- keep_files_on_create=ON,
- max_join_size=2222220000000 FOR
- SELECT @@myisam_sort_buffer_size,
- @@myisam_repair_threads,
- @@sort_buffer_size,
- @@binlog_format,
- @@keep_files_on_create,
- @@max_join_size;
- SET STATEMENT myisam_sort_buffer_size=320000,
- myisam_repair_threads=2,
- sort_buffer_size=220022,
- binlog_format=row,
- keep_files_on_create=ON,
- max_join_size=2222220000000 FOR
- SELECT @@myisam_sort_buffer_size,
- @@myisam_repair_threads,
- @@sort_buffer_size,
- @@binlog_format,
- @@keep_files_on_create,
- @@max_join_size;
- END|
-DELIMITER ;|
---echo ''
---echo '# Pre-STATEMENT variable value
-SELECT @@myisam_sort_buffer_size,
- @@myisam_repair_threads,
- @@sort_buffer_size,
- @@binlog_format,
- @@keep_files_on_create,
- @@max_join_size;
---echo ''
---echo ''
-SET STATEMENT myisam_sort_buffer_size=400000,
- myisam_repair_threads=2,
- sort_buffer_size=200000,
- binlog_format=row,
- keep_files_on_create=OFF,
- max_join_size=4444440000000 FOR
- CALL p4();
---echo ''
---echo '# Post-STATEMENT
-SELECT @@myisam_sort_buffer_size,
- @@myisam_repair_threads,
- @@sort_buffer_size,
- @@binlog_format,
- @@keep_files_on_create,
- @@max_join_size;
-
---echo ''
---echo ''
---echo '#------------------Test 16-----------------------#'
-####################################################################
-# Test Effect on parsing #
-####################################################################
---echo ''
---echo '# Pre-STATEMENT variable value
-SELECT @@sql_mode;
---echo ''
---echo ''
-SET STATEMENT sql_mode='ansi' FOR PREPARE stmt FROM 'SELECT "t1".* FROM t1';
-execute stmt;
-ALTER TABLE t1 ADD COLUMN v3 int;
-# repreparation with other mode does not cause an error
-execute stmt;
-ALTER TABLE t1 drop COLUMN v3;
-deallocate prepare stmt;
---echo ''
---echo '# Post-STATEMENT
-SELECT @@sql_mode;
---echo check the same behaviour in normal set
-SET sql_mode='ansi';
-PREPARE stmt FROM 'SELECT "t1".* FROM t1';
-SET sql_mode=default;
-execute stmt;
-ALTER TABLE t1 ADD COLUMN v3 int;
-# repreparation with other mode does not cause an error
-execute stmt;
-ALTER TABLE t1 drop COLUMN v3;
-deallocate prepare stmt;
-# the above test about SP
-SELECT @@sql_mode;
-SET sql_mode='ansi';
-SELECT @@sql_mode;
-DELIMITER |;
- CREATE PROCEDURE p6() BEGIN
- SELECT @@sql_mode;
- SELECT "t1".* FROM t1;
- END|
-DELIMITER ;|
-SET sql_mode=default;
-call p6;
-ALTER TABLE t1 ADD COLUMN v3 int;
-#force SP stack invalidation
-create view v1 as select * from t1;
-drop view v1;
-call p6;
-ALTER TABLE t1 drop COLUMN v3;
-drop procedure p6;
-
-
-SELECT @@sql_mode;
-DELIMITER |;
---echo # SET and the statement parsed as one unit before the SET takes effect
---error ER_PARSE_ERROR
-SET STATEMENT sql_mode='ansi' FOR
- CREATE PROCEDURE p6() BEGIN
- SELECT @@sql_mode;
- SELECT "t1".* FROM t1;
- END|
-DELIMITER ;|
-#call p1;
-#ALTER TABLE t1 ADD COLUMN v3 int;
-#--echo # no reparsing for now
-#call p1;
-#ALTER TABLE t1 drop COLUMN v3;
-#drop procedure p1;
-
-
-# the above test about compound statement
-SELECT @@sql_mode;
-SET sql_mode='ansi';
-SELECT @@sql_mode;
-DELIMITER |;
-BEGIN NOT ATOMIC
- SELECT @@sql_mode;
- SELECT "t1".* FROM t1;
-END|
-DELIMITER ;|
-SET sql_mode=default;
-
-
-SELECT @@sql_mode;
-DELIMITER |;
---echo # SET and the statement parsed as one unit before the SET takes effect
---error ER_PARSE_ERROR
-SET STATEMENT sql_mode='ansi' FOR
-BEGIN NOT ATOMIC
- SELECT @@sql_mode;
- SELECT "t1".* FROM t1;
-END|
-SET STATEMENT sql_mode='ansi' FOR
-BEGIN NOT ATOMIC
- SELECT @@sql_mode;
- SELECT * FROM t1;
- SELECT @@sql_mode;
-END|
-DELIMITER ;|
---echo ''
---echo ''
---echo '#------------------Test 17-----------------------#'
-####################################################################
-# Test effect of SET STATEMENT FOR with SET SESSION modifying #
-# the same variables as the SET STATEMENT #
-####################################################################
---echo '# set initial variable values
-SET SESSION myisam_sort_buffer_size=500000,
- myisam_repair_threads=1,
- sort_buffer_size=100000,
- binlog_format=mixed,
- keep_files_on_create=ON,
- max_join_size=2222220000000;
---echo ''
---echo '# Pre-STATEMENT variable value
-SELECT @@myisam_sort_buffer_size,
- @@myisam_repair_threads,
- @@sort_buffer_size,
- @@binlog_format,
- @@keep_files_on_create,
- @@max_join_size;
---echo ''
---echo ''
-SET STATEMENT myisam_sort_buffer_size=320000,
- myisam_repair_threads=2,
- sort_buffer_size=220022,
- binlog_format=row,
- keep_files_on_create=ON,
- max_join_size=2222220000000
- FOR SET SESSION
- myisam_sort_buffer_size=260000,
- myisam_repair_threads=3,
- sort_buffer_size=230013,
- binlog_format=row,
- keep_files_on_create=ON,
- max_join_size=2323230000000;
-
---echo ''
---echo '# Post-STATEMENT
-SELECT @@myisam_sort_buffer_size,
- @@myisam_repair_threads,
- @@sort_buffer_size,
- @@binlog_format,
- @@keep_files_on_create,
- @@max_join_size;
-
---echo ''
---echo ''
---echo '#------------------Test 18-----------------------#'
-####################################################################
-# Test effect of SET SESSION inside a stored procedure with #
-# with a SET STATEMENT on outside variables #
-####################################################################
---echo '# set initial variable values
-SET SESSION myisam_sort_buffer_size=500000,
- myisam_repair_threads=1,
- sort_buffer_size=100000,
- binlog_format=mixed,
- keep_files_on_create=ON,
- max_join_size=2222220000000;
---echo ''
---echo '# Pre-STATEMENT variable value
-SELECT @@myisam_sort_buffer_size,
- @@myisam_repair_threads,
- @@sort_buffer_size,
- @@binlog_format,
- @@keep_files_on_create,
- @@max_join_size;
---echo ''
---echo ''
-DELIMITER |;
-CREATE PROCEDURE p5() BEGIN
- SELECT @@myisam_sort_buffer_size,
- @@myisam_repair_threads,
- @@sort_buffer_size,
- @@binlog_format,
- @@keep_files_on_create,
- @@max_join_size;
- SET SESSION
- myisam_sort_buffer_size=260000,
- myisam_repair_threads=3,
- sort_buffer_size=230013,
- binlog_format=row,
- keep_files_on_create=ON,
- max_join_size=2323230000000;
- SELECT @@myisam_sort_buffer_size,
- @@myisam_repair_threads,
- @@sort_buffer_size,
- @@binlog_format,
- @@keep_files_on_create,
- @@max_join_size;
- END|
-DELIMITER ;|
---echo ''
---echo ''
-SET STATEMENT myisam_sort_buffer_size=400000,
- myisam_repair_threads=2,
- sort_buffer_size=200000,
- binlog_format=row,
- keep_files_on_create=OFF,
- max_join_size=4444440000000 FOR
- CALL p5();
-
---echo ''
---echo '# Post-STATEMENT
-SELECT @@myisam_sort_buffer_size,
- @@myisam_repair_threads,
- @@sort_buffer_size,
- @@binlog_format,
- @@keep_files_on_create,
- @@max_join_size;
-
---echo ''
---echo ''
---echo '#------------------Test 19-----------------------#'
-#Test for bad syntax
---error ER_PARSE_ERROR
-SET STATEMENT max_error_count=100 FOR;
---error ER_PARSE_ERROR
-SET STATEMENT max_error_count=100 INSERT t1 VALUES (1,2);
---error ER_PARSE_ERROR
-SET STATEMENT FOR INSERT INTO t1 VALUES (1,2);
---error ER_PARSE_ERROR
-SET max_error_count=100 FOR INSERT INTO t1 VALUES (1,2);
---error ER_PARSE_ERROR
-SET STATEMENT GLOBAL max_error_count=100 FOR INSERT INTO t1 VALUES (1,2);
---error ER_PARSE_ERROR
-SET STATEMENT @@global.max_error_count=100 FOR INSERT INTO t1 VALUES (1,2);
-
---echo ''
---echo ''
---echo '#------------------Test 20-----------------------#'
-#Test for global-only variables
---error ER_GLOBAL_VARIABLE
-SET STATEMENT connect_timeout=100 FOR INSERT INTO t1 VALUES (1,2);
-
---echo ''
---echo ''
---echo '#------------------Test 21-----------------------#'
-#Test for recursion
-SELECT @@myisam_sort_buffer_size, @@sort_buffer_size;
-SET STATEMENT myisam_sort_buffer_size = 700000, sort_buffer_size = 3000000
- FOR SET STATEMENT myisam_sort_buffer_size=200000
- FOR SELECT @@myisam_sort_buffer_size, @@sort_buffer_size;
-SELECT @@myisam_sort_buffer_size, @@sort_buffer_size;
-
---echo ''
---echo ''
---echo '#------------------Test 22-----------------------#'
-#Test for STATEMENT keyword
-CREATE TABLE STATEMENT(a INT);
-DROP TABLE STATEMENT;
-
---echo ''
---echo '# Cleanup'
-DROP TABLE t1;
-DROP PROCEDURE p1;
-DROP PROCEDURE p2;
-DROP PROCEDURE p3;
-DROP PROCEDURE p4;
-DROP PROCEDURE p5;
-
-#
-# Limitation of opening tables for set operation
-#
-CREATE TABLE t1 (v1 INT, v2 INT);
-insert into t1 values (1,1);
-DELIMITER |;
-CREATE FUNCTION myProc ()
- RETURNS INT
-
- SQL SECURITY DEFINER
-
- BEGIN
- DECLARE mx INT;
- SET mx = (select max(v1) from t1);
- RETURN mx;
- END|
-DELIMITER ;|
---error ER_SUBQUERIES_NOT_SUPPORTED
-SET STATEMENT myisam_repair_threads=(select max(v1) from t1) FOR
- select 1;
-
---error ER_SUBQUERIES_NOT_SUPPORTED
-SET STATEMENT myisam_repair_threads=myProc() FOR
- select 1;
-drop function myProc;
-drop table t1;
-
-#
-# Prepared Statement
-#
-set session binlog_format=mixed;
-PREPARE stmt1 FROM 'SELECT @@binlog_format';
-execute stmt1;
-set statement binlog_format=row for execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-set statement binlog_format=row for PREPARE stmt1 FROM 'SELECT @@binlog_format';
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-PREPARE stmt1 FROM 'set statement binlog_format=row for SELECT @@binlog_format';
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-set session binlog_format=default;
-
-#
-# Percona server bug#1341438
-# SET SESSION statement combined with SET STATEMENT has no effect
-#
-set session binlog_format=mixed;
-SET STATEMENT sort_buffer_size=150000 FOR set session binlog_format=row;
-SELECT @@binlog_format;
-
-#
-# restore variables of original tests
-#
-SET @@binlog_format = @save_binlog_format;
-SET @@keep_files_on_create = @save_keep_files_on_create;
-SET @@max_join_size = @save_max_join_size;
-SET @@myisam_repair_threads = @save_myisam_repair_threads;
-SET @@myisam_sort_buffer_size = @save_myisam_sort_buffer_size;
-SET @@sort_buffer_size = @save_sort_buffer_size;
-
-#
-# Percona sever bug#1341606
-# SET STATEMENT incorrectly restore vaues of some variables
-#
---echo #Correctly set timestamp
-set session timestamp=4646464;
-select @@timestamp != 4646464;
-select @@timestamp != 4646464;
---echo #Correctly returned normal behaviour
-set session timestamp=default;
-select @@timestamp != 4646464;
-select @@timestamp != 4646464;
---echo #here timestamp should be set only for the statement then restored default
-set statement timestamp=4646464 for select @@timestamp;
-set @save_tm=@@timestamp;
-select @@timestamp != 4646464;
-select @@timestamp != 4646464;
-let $wait_condition=select @@timestamp != @save_tm;
-source include/wait_condition.inc;
-eval $wait_condition;
-
-#
-# Test of temporary changing default storage engine
-#
-set @save_dfs=@@default_storage_engine;
-SET @@default_storage_engine=MyISAM;
-SET STATEMENT default_storage_engine=MEMORY for CREATE TABLE t1 (a int);
-SHOW CREATE TABLE t1;
-select @@default_storage_engine;
-drop table t1;
-SET STATEMENT default_storage_engine=MyISAM for CREATE TABLE t1 (a int);
-SHOW CREATE TABLE t1;
-drop table t1;
-SET @@default_storage_engine=@save_dfs;
-
-#
-# MDEV-6946:Assertion `0' failed in mysql_execute_command on SET STATEMENT
-# keycache1.key_buffer_size=.. FOR
-#
---error ER_GLOBAL_VARIABLE
-SET STATEMENT keycache1.key_buffer_size=1024 FOR SELECT 1;
-
-
-#
-# MDEV-6940: SET STATEMENT executed after SET GLOBAL does not work
-#
-set @save_general_log=@@global.general_log;
---echo # SET STATEMENT works (OK)
-set statement lock_wait_timeout=1 for select @@lock_wait_timeout;
---echo # Setting a totally unrelated global variable
-set global general_log=0;
---echo # SET STATEMENT should work
-set statement lock_wait_timeout=1 for select @@lock_wait_timeout;
-set global general_log=@save_general_log;
-
---echo # MDEV-7006 MDEV-7007: SET statement and slow log
-
-set @save_long_query_time= @@long_query_time;
-set @save_slow_query_log= @@slow_query_log;
-set @save_log_output= @@log_output;
-
-set statement long_query_time=default for select @@long_query_time;
-set statement log_slow_filter=default for select @@log_slow_filter;
-set statement log_slow_verbosity=default for select @@log_slow_verbosity;
-set statement log_slow_rate_limit=default for select @@log_slow_rate_limit;
-set statement slow_query_log=default for select @@slow_query_log;
-
-truncate table mysql.slow_log;
-set slow_query_log= 1;
-set global log_output='TABLE';
-
-select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_time%';
-set @@long_query_time=0.01;
---echo #should be written
-select sleep(0.1);
-set @@long_query_time=@save_long_query_time;
-select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_time%';
---echo #---
---echo #should be written
-set statement long_query_time=0.01 for select sleep(0.1);
-select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_time%';
---echo #---
-set @@long_query_time=0.01;
---echo #should NOT be written
-set statement slow_query_log=0 for select sleep(0.1);
-set @@long_query_time=@save_long_query_time;
-select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_time%';
---echo #---
---echo #should NOT be written
-set statement long_query_time=0.01,log_slow_filter='full_scan' for select sleep(0.1);
-select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_time%';
---echo #---
---echo #should NOT be written
-set statement long_query_time=0.01,log_slow_rate_limit=9999 for select sleep(0.1);
-select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_time%';
---echo #---
---echo #should NOT be written
-set statement long_query_time=0.01,min_examined_row_limit=50 for select sleep(0.1);
-select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_time%';
---echo #---
-#
-# log_slow_verbosity is impossible to check because results are not written
-# in TABLE mode
-#
-
-set global log_output= @save_log_output;
-set @@slow_query_log= @save_slow_query_log;
-set @@long_query_time= @save_long_query_time;
-truncate table mysql.slow_log;
-
-
-#
-# Prohibited Variables
-#
---error ER_SET_STATEMENT_NOT_SUPPORTED
-set statement autocommit=default for select 1;
---error ER_SET_STATEMENT_NOT_SUPPORTED
-set statement tx_isolation=default for select 1;
---error ER_SET_STATEMENT_NOT_SUPPORTED
-set statement skip_replication=default for select 1;
---error ER_SET_STATEMENT_NOT_SUPPORTED
-set statement sql_log_off=default for select 1;
---error ER_SET_STATEMENT_NOT_SUPPORTED
-set statement character_set_client=default for select 1;
---error ER_SET_STATEMENT_NOT_SUPPORTED
-set statement character_set_connection=default for select 1;
---error ER_SET_STATEMENT_NOT_SUPPORTED
-set statement character_set_filesystem=default for select 1;
---error ER_SET_STATEMENT_NOT_SUPPORTED
-set statement collation_connection=default for select 1;
---error ER_SET_STATEMENT_NOT_SUPPORTED
-set statement query_cache_type=default for select 1;
---error ER_SET_STATEMENT_NOT_SUPPORTED
-set statement wait_timeout=default for select 1;
---error ER_SET_STATEMENT_NOT_SUPPORTED
-set statement interactive_timeout=default for select 1;
-
-# MDEV-6996: SET STATEMENT default_week_format = .. has no effect
-set @save_week_format=@@default_week_format;
-set @@default_week_format=0;
-SET STATEMENT default_week_format = 2 FOR SELECT WEEK('2000-01-01');
-create table t1 (a date);
-insert t1 values ('2000-01-01');
-explain extended select week(a) from t1;
-prepare stmt1 from "select week(a) from t1";
-execute stmt1;
-set default_week_format = 2;
-execute stmt1;
-alter table t1 engine=myisam;
-execute stmt1;
-deallocate prepare stmt1;
-drop table t1;
-set @@default_week_format=@save_week_format;
-
-# MDEV-7015: SET STATEMENT old_passwords has no effect
-set @save_old_passwords=@@old_passwords;
-set @@old_passwords=0;
-set statement OLD_PASSWORDS = 0 for select password('test');
-set statement OLD_PASSWORDS = 1 for select password('test');
-set statement OLD_PASSWORDS = 0 for explain extended select password('test');
-set statement OLD_PASSWORDS = 1 for explain extended select password('test');
-create table t1 (a char(10));
-insert t1 values ('qwertyuiop');
-prepare stmt1 from "select password(a) from t1";
-execute stmt1;
-set old_passwords=1;
-execute stmt1;
-alter table t1 engine=myisam;
-execute stmt1;
-deallocate prepare stmt1;
-drop table t1;
-set @@old_passwords=@save_old_passwords;
-
---echo #
---echo #MDEV-6951:Erroneous SET STATEMENT produces two identical errors
---echo #
-
---error ER_UNKNOWN_SYSTEM_VARIABLE
-set statement non_existing=1 for select 1;
-show errors;
-
---echo #
---echo # MDEV-6954: SET STATEMENT rand_seedX = ...FOR ... makes
---echo # the next rand() to return 0
---echo #
-set @rnd=1;
-let $1=10;
---disable_query_log
---echo # test that rand() is not always 0 after restoring rand_seed, rand_seed2...
-while ($1)
-{
- --disable_result_log
- set statement rand_seed1=1, rand_seed2=1 for select 1;
- --enable_result_log
- set @rnd= rand()=0 and @rnd;
- dec $1;
-}
---enable_query_log
---echo # @rnd should be 0
-select @rnd;
diff --git a/mysql-test/t/set_statement_debug.test b/mysql-test/t/set_statement_debug.test
deleted file mode 100644
index 7089733ab4f..00000000000
--- a/mysql-test/t/set_statement_debug.test
+++ /dev/null
@@ -1,26 +0,0 @@
---source include/have_debug.inc
---source include/have_debug_sync.inc
-
-call mtr.add_suppression("Sort aborted.*");
-
-set @save_debug_dbug= @@debug_dbug;
-
-# check that change debug_dbug visible in SELECT
-set statement debug_dbug="d,something" for select @@debug_dbug;
-set @@debug_dbug= @save_debug_dbug;
-
-#check that change debug_dbug has influence of hooks...
-CREATE TABLE t1(f0 int auto_increment primary key, f1 int);
-INSERT INTO t1(f1) VALUES (0),(1),(2),(3),(4),(5);
-CALL mtr.add_suppression("Out of sort memory");
---error ER_OUT_OF_SORTMEMORY
-SET statement debug_dbug= '+d,alloc_sort_buffer_fail' for SELECT * FROM t1 ORDER BY f1 ASC, f0;
-
-# ... and works only for one statement
-SELECT * FROM t1 ORDER BY f1 ASC, f0;
-
-DROP TABLE t1;
-set @@debug_dbug= @save_debug_dbug;
-
---error ER_SET_STATEMENT_NOT_SUPPORTED
-set statement DEBUG_SYNC = 'now SIGNAL hi' for select 1;
diff --git a/mysql-test/t/set_statement_notembedded.test b/mysql-test/t/set_statement_notembedded.test
deleted file mode 100644
index 7bb8f5e1aab..00000000000
--- a/mysql-test/t/set_statement_notembedded.test
+++ /dev/null
@@ -1,13 +0,0 @@
---source include/not_embedded.inc
-
-#
-# statement timeout
-#
-SELECT @@MAX_STATEMENT_TIME;
-SET STATEMENT MAX_STATEMENT_TIME=2 FOR SELECT SLEEP(1);
-SHOW STATUS LIKE "max_statement_time_exceeded";
-SET STATEMENT MAX_STATEMENT_TIME=2 FOR SELECT SLEEP(3);
-SHOW STATUS LIKE "max_statement_time_exceeded";
-SELECT @@MAX_STATEMENT_TIME;
-
-
diff --git a/mysql-test/t/set_statement_notembedded_binlog.test b/mysql-test/t/set_statement_notembedded_binlog.test
deleted file mode 100644
index b0c00008d4f..00000000000
--- a/mysql-test/t/set_statement_notembedded_binlog.test
+++ /dev/null
@@ -1,88 +0,0 @@
---source include/have_log_bin.inc
---source include/not_embedded.inc
---source include/have_binlog_format_statement.inc
-
---disable_warnings
-drop table if exists t1;
-drop view if exists t1;
---enable_warnings
-
---echo #
---echo # MDEV-6948: SET STATEMENT gtid_domain_id = ... FOR has no effect
---echo # (same for gtid_seq_no and server_id)
---echo #
-reset master;
-create table t1 (i int);
-set gtid_domain_id = 10;
-insert into t1 values (1),(2);
-set statement gtid_domain_id = 20 for insert into t1 values (3),(4);
-
---replace_column 1 x 2 x 3 x 4 x 5 x
-show binlog events limit 5,5;
-
-drop table t1;
-
-reset master;
-SET @a=11;
-
-create table t1 (a int not null auto_increment, c int, d int, primary key (a));
-create table t2 (b int);
-insert into t2 values (1),(2);
-
-DELIMITER |;
-CREATE function f1() returns int
-BEGIN
- SET STATEMENT last_insert_id=@a for insert into t1 values (NULL, @a,
- last_insert_id());
- SET @a:=@a*100+13;
- return @a;
-end|
-DELIMITER ;|
-
-
-call mtr.add_suppression("Unsafe statement written to the binary log using");
-select f1() from t2;
-
---replace_column 1 x 2 x 3 x 4 x 5 x
-show binlog events limit 16, 100;
-
-select * from t1;
-
-drop function f1;
-drop table t1,t2;
-
-
-reset master;
-SET @a=11;
-
-create table t1 (a int not null auto_increment, c int, d int, primary key (a));
-create table t2 (b int);
-insert into t2 values (1),(2);
-
-DELIMITER |;
-CREATE function f1() returns int
-BEGIN
- SET @save= @@last_insert_id;
- SET session last_insert_id=@a;
- insert into t1 values (NULL, @a, last_insert_id());
- SET session last_insert_id=@save;
- SET @a:=@a*100+13;
- return @a;
-end|
-DELIMITER ;|
-
-select f1() from t2;
-
---replace_column 1 x 2 x 3 x 4 x 5 x
-show binlog events limit 13, 100;
-
-select * from t1;
-
-drop function f1;
-drop table t1,t2;
-
-reset master;
-set statement last_insert_id = 112 for create table t1 as select last_insert_id();
---replace_column 1 x 2 x 3 x 4 x 5 x
-show binlog events limit 4,1;
-drop table t1;
diff --git a/mysql-test/t/set_statement_profiling.test b/mysql-test/t/set_statement_profiling.test
deleted file mode 100644
index 6ef64d2f18c..00000000000
--- a/mysql-test/t/set_statement_profiling.test
+++ /dev/null
@@ -1,9 +0,0 @@
-source include/have_profiling.inc;
-
-#
-# Prohibited Variables
-#
---error ER_SET_STATEMENT_NOT_SUPPORTED
-set statement profiling=default for select 1;
---error ER_SET_STATEMENT_NOT_SUPPORTED
-set statement profiling_history_size=default for select 1;
diff --git a/mysql-test/t/shm-master.opt b/mysql-test/t/shm-master.opt
deleted file mode 100644
index d71395213b1..00000000000
--- a/mysql-test/t/shm-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---skip-grant-tables --loose-shared-memory-base-name=HeyMrBaseNameXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX$MTR_BUILD_THREAD --loose-shared-memory=1
diff --git a/mysql-test/t/shm.test b/mysql-test/t/shm.test
deleted file mode 100644
index 346ce49476e..00000000000
--- a/mysql-test/t/shm.test
+++ /dev/null
@@ -1,47 +0,0 @@
-# We currently only have shm support on windows, so in order
-# to optimize things we skip this test on all other platforms
---source include/windows.inc
-
-# thread pool causes different results
--- source include/not_threadpool.inc
-
-# Only run this test if shared memory is avaliable
-let $shm= query_get_value("SHOW VARIABLES LIKE 'shared_memory'", Value, 1);
-if ($shm != ON){
- skip No shm support;
-}
-let $shm_name= query_get_value("SHOW GLOBAL VARIABLES LIKE 'shared_memory_base_name'", Value, 1);
-
-# Connect using SHM for testing
-connect(shm_con,localhost,root,,,,$shm_name,SHM);
-
-# Source select test case
--- source include/common-tests.inc
-
-connection default;
-disconnect shm_con;
-
-#
-# Bug #24924: shared-memory-base-name that is too long causes buffer overflow
-#
---exec $MYSQLADMIN --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --shared-memory-base-name=HeyMrBaseNameXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ping
-
-#
-# Bug #33899: Deadlock in mysql_real_query with shared memory connections
-#
-
-let $stmt= `SELECT REPEAT('a', 2048)`;
-
-SET @max_allowed_packet= @@global.max_allowed_packet;
-SET @net_buffer_length= @@global.net_buffer_length;
-
-SET GLOBAL max_allowed_packet= 1024;
-SET GLOBAL net_buffer_length= 1024;
-
---error 1
---exec echo SELECT '$stmt'| $MYSQL --protocol=memory --shared-memory-base-name=$shm_name 2>&1
-
-SET GLOBAL max_allowed_packet= @max_allowed_packet;
-SET GLOBAL net_buffer_length= @net_buffer_length;
-
---echo End of 5.0 tests.
diff --git a/mysql-test/t/show.test b/mysql-test/t/show.test
deleted file mode 100644
index 3101f443264..00000000000
--- a/mysql-test/t/show.test
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-# MDEV-9538 Server crashes in check_show_access on SHOW STATISTICS
-# MDEV-9539 Server crashes in make_columns_old_format on SHOW GEOMETRY_COLUMNS
-# MDEV-9540 SHOW SPATIAL_REF_SYS and SHOW SYSTEM_VARIABLES return empty results with numerous warnings
-#
---error ER_PARSE_ERROR
-show statistics;
---error ER_PARSE_ERROR
-show spatial_ref_sys
---error ER_PARSE_ERROR
-show system_variables;
---error ER_PARSE_ERROR
-show geometry_columns;
---error ER_PARSE_ERROR
-show nonexistent;
diff --git a/mysql-test/t/show_bad_definer-5553.test b/mysql-test/t/show_bad_definer-5553.test
deleted file mode 100644
index 7c7f253ae7d..00000000000
--- a/mysql-test/t/show_bad_definer-5553.test
+++ /dev/null
@@ -1,12 +0,0 @@
---source include/not_embedded.inc
-#
-# MDEV-5553 A view or procedure with a non existing definer can block "SHOW TABLE STATUS" with an unclear error message
-#
-
-create database mysqltest1; # all-open privileges on test db desroy the test
-use mysqltest1;
-create table t1(id int primary key);
-create definer=unknownuser@'%' sql security definer view v1 as select t1.id from t1 group by t1.id;
---replace_column 8 # 12 # 13 # 19 #
-show table status;
-drop database mysqltest1;
diff --git a/mysql-test/t/show_check-master.opt b/mysql-test/t/show_check-master.opt
deleted file mode 100644
index af474d42e8d..00000000000
--- a/mysql-test/t/show_check-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---log-output=table,file --slow-query-log --log-queries-not-using-indexes --myisam-recover-options=""
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
deleted file mode 100644
index a24fa632ea5..00000000000
--- a/mysql-test/t/show_check.test
+++ /dev/null
@@ -1,1392 +0,0 @@
-################################################################################
-#
-# NOTICE:
-#
-# This file unfortunately contains characters in various different encodings.
-# Be careful when editing this file to ensure that you (or your editor) do
-# not change things (such as encodings) on lines that you did not mean to
-# modify.
-#
-################################################################################
-
-
-# Uses GRANT commands that usually disabled in embedded server
--- source include/not_embedded.inc
-
-# check that CSV engine was compiled in, as the result of the test
-# depends on the presence of the log tables (which are CSV-based).
---source include/have_csv.inc
-
-#
-# Test of some show commands
-#
-
---disable_warnings
-drop table if exists t1,t2;
-drop table if exists t1aa,t2aa;
-drop database if exists mysqltest;
-drop database if exists mysqltest1;
-
-delete from mysql.user where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
-delete from mysql.db where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
-flush privileges;
---enable_warnings
-
-create table t1 (a int not null primary key, b int not null,c int not null, key(b,c));
-insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4);
-
---echo -- Here we enable metadata just to check that the collation of the
---echo -- resultset is non-binary for string type. This should be changed
---echo -- after Bug#29394 is implemented.
-
---enable_metadata
-check table t1 fast;
-check table t1 fast;
-check table t1 changed;
-insert into t1 values (5,5,5);
-check table t1 changed;
-check table t1 medium;
-check table t1 extended;
-show index from t1;
---disable_metadata
---error ER_DUP_ENTRY
-insert into t1 values (5,5,5);
-
---echo -- Here we enable metadata just to check that the collation of the
---echo -- resultset is non-binary for string type. This should be changed
---echo -- after Bug#29394 is implemented.
-
---enable_metadata
-optimize table t1;
---disable_metadata
-optimize table t1;
-drop table t1;
-
-# show variables;
-
---echo -- Here we enable metadata just to check that the collation of the
---echo -- resultset is non-binary for string type. This should be changed
---echo -- after Bug#29394 is implemented.
-
---enable_metadata
-show variables like "wait_timeout%";
-show variables like "WAIT_timeout%";
-show variables like "this_doesn't_exists%";
-show table status from test like "this_doesn't_exists%";
-show databases;
-show databases like "test%";
---disable_metadata
-
-#
-# Check of show index
-#
-create table t1 (f1 int not null, f2 int not null, f3 int not null, f4 int not null, primary key(f1,f2,f3,f4));
-insert into t1 values (1,1,1,0),(1,1,2,0),(1,1,3,0),(1,2,1,0),(1,2,2,0),(1,2,3,0),(1,3,1,0),(1,3,2,0),(1,3,3,0),(1,1,1,1),(1,1,2,1),(1,1,3,1),(1,2,1,1),(1,2,2,1),(1,2,3,1),(1,3,1,1),(1,3,2,1),(1,3,3,1);
-
---echo -- Here we enable metadata just to check that the collation of the
---echo -- resultset is non-binary for string type. This should be changed
---echo -- after Bug#29394 is implemented.
-
---enable_metadata
-analyze table t1;
---disable_metadata
-show index from t1;
-
---echo -- Here we enable metadata just to check that the collation of the
---echo -- resultset is non-binary for string type. This should be changed
---echo -- after Bug#29394 is implemented.
-
---enable_metadata
-
-repair table t1;
---disable_metadata
-show index from t1;
-drop table t1;
-
-#
-# Test of SHOW CREATE
-#
-
-create temporary table t1 (a int not null);
-show create table t1;
-alter table t1 rename t2;
-show create table t2;
-drop table t2;
-
-create table t1 (
- test_set set( 'val1', 'val2', 'val3' ) not null default '',
- name char(20) default 'O''Brien' comment 'O''Brien as default',
- c int not null comment 'int column',
- `c-b` int comment 'name with a minus',
- `space 2` int comment 'name with a space'
- ) comment = 'it\'s a table' ;
-show create table t1;
-set sql_quote_show_create=0;
-show create table t1;
-set sql_quote_show_create=1;
-show full columns from t1;
-drop table t1;
-
-create table t1 (a int not null, unique aa (a));
-show create table t1;
-drop table t1;
-create table t1 (a int not null, primary key (a));
-show create table t1;
-drop table t1;
-
-flush tables;
---sorted_result
-show open tables;
-create table t1(n int);
-insert into t1 values (1);
---sorted_result
-show open tables;
-drop table t1;
-
-create table t1 (a int not null, b VARCHAR(10), INDEX (b) ) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" ENGINE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed;
-show create table t1;
-alter table t1 MAX_ROWS=200 ROW_FORMAT=dynamic PACK_KEYS=0;
-show create table t1;
-ALTER TABLE t1 AVG_ROW_LENGTH=0 CHECKSUM=0 COMMENT="" MIN_ROWS=0 MAX_ROWS=0 PACK_KEYS=DEFAULT DELAY_KEY_WRITE=0 ROW_FORMAT=default;
-show create table t1;
-drop table t1;
-
-create table t1 (a decimal(9,2), b decimal (9,0), e double(9,2), f double(5,0), h float(3,2), i float(3,0));
-show columns from t1;
-show full columns from t1;
-drop table t1;
-
-#
-# Do a create table that tries to cover all types and options
-#
-create table t1 (
-type_bool bool not null default 0,
-type_tiny tinyint not null auto_increment primary key,
-type_short smallint(3),
-type_mediumint mediumint,
-type_bigint bigint,
-type_decimal decimal(5,2),
-type_numeric numeric(5,2),
-empty_char char(0),
-type_char char(2),
-type_varchar varchar(10),
-type_timestamp timestamp not null default current_timestamp on update current_timestamp,
-type_date date not null default '0000-00-00',
-type_time time not null default '00:00:00',
-type_datetime datetime not null default '0000-00-00 00:00:00',
-type_year year,
-type_enum enum ('red', 'green', 'blue'),
-type_set enum ('red', 'green', 'blue'),
-type_tinyblob tinyblob,
-type_blob blob,
-type_medium_blob mediumblob,
-type_long_blob longblob,
-index(type_short)
-) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" ENGINE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed CHARSET=latin1;
-
-# Not tested above: UNION INSERT_METHOD DATA DIRECTORY INDEX DIRECTORY
-show create table t1;
-insert into t1 (type_timestamp) values ("2003-02-07 10:00:01");
-select * from t1;
-drop table t1;
-
-#
-# Check metadata
-#
-create table t1 (a int not null);
-create table t2 select max(a) from t1;
-show columns from t2;
-drop table t1,t2;
-
-# Check auto conversions of types
-
-create table t1 (c decimal, d double, f float, r real);
-show columns from t1;
-drop table t1;
-
-create table t1 (c decimal(3,3), d double(3,3), f float(3,3));
-show columns from t1;
-drop table t1;
-
-#
-# Test for Bug#2593 SHOW CREATE TABLE doesn't properly double quotes
-#
-
-SET @old_sql_mode= @@sql_mode, sql_mode= '';
-SET @old_sql_quote_show_create= @@sql_quote_show_create, sql_quote_show_create= OFF;
-
-CREATE TABLE ```ab``cd``` (i INT);
-SHOW CREATE TABLE ```ab``cd```;
-DROP TABLE ```ab``cd```;
-
-CREATE TABLE ```ab````cd``` (i INT);
-SHOW CREATE TABLE ```ab````cd```;
-DROP TABLE ```ab````cd```;
-
-CREATE TABLE ```a` (i INT);
-SHOW CREATE TABLE ```a`;
-DROP TABLE ```a`;
-
-CREATE TABLE `a.1` (i INT);
-SHOW CREATE TABLE `a.1`;
-DROP TABLE `a.1`;
-
-SET sql_mode= 'ANSI_QUOTES';
-
-CREATE TABLE """a" (i INT);
-SHOW CREATE TABLE """a";
-DROP TABLE """a";
-
-# to test quotes around keywords.. :
-
-SET sql_mode= '';
-SET sql_quote_show_create= OFF;
-
-CREATE TABLE t1 (i INT);
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE `table` (i INT);
-SHOW CREATE TABLE `table`;
-DROP TABLE `table`;
-
-SET sql_quote_show_create= @old_sql_quote_show_create;
-SET sql_mode= @old_sql_mode;
-
-#
-# Test for Bug#2719 Heap tables status shows wrong or missing data.
-#
-
-select @@max_heap_table_size;
-
-CREATE TABLE t1 (
- a int(11) default NULL,
- KEY a USING BTREE (a)
-) ENGINE=HEAP;
-
-CREATE TABLE t2 (
- b int(11) default NULL,
- index(b)
-) ENGINE=HEAP;
-
-CREATE TABLE t3 (
- a int(11) default NULL,
- b int(11) default NULL,
- KEY a USING BTREE (a),
- index(b)
-) ENGINE=HEAP;
-
-insert into t1 values (1),(2);
-insert into t2 values (1),(2);
-insert into t3 values (1,1),(2,2);
---replace_column 6 # 7 # 8 # 9 # 12 #
-show table status;
-insert into t1 values (3),(4);
-insert into t2 values (3),(4);
-insert into t3 values (3,3),(4,4);
---replace_column 6 # 7 # 8 # 9 # 12 #
-show table status;
-insert into t1 values (5);
-insert into t2 values (5);
-insert into t3 values (5,5);
---replace_column 6 # 7 # 8 # 9 # 12 #
-show table status;
-delete from t1 where a=3;
-delete from t2 where b=3;
-delete from t3 where a=3;
---replace_column 6 # 7 # 8 # 9 # 10 # 12 #
-show table status;
-truncate table t1;
-truncate table t2;
-truncate table t3;
---replace_column 6 # 7 # 8 # 9 # 12 #
-show table status;
-insert into t1 values (5);
-insert into t2 values (5);
-insert into t3 values (5,5);
---replace_column 6 # 7 # 8 # 9 # 12 #
-show table status;
-delete from t1 where a=5;
-delete from t2 where b=5;
-delete from t3 where a=5;
---replace_column 6 # 7 # 8 # 9 # 10 # 12 #
-show table status;
-
-drop table t1, t2, t3;
-
-#
-# Test for Bug#3342 SHOW CREATE DATABASE seems to require DROP privilege
-#
-
-create database mysqltest;
-show create database mysqltest;
-create table mysqltest.t1(a int);
-insert into mysqltest.t1 values(1);
-create user mysqltest_1@localhost;
-grant select on `mysqltest`.* to mysqltest_1@localhost;
-create user mysqltest_2@localhost;
-grant usage on `mysqltest`.* to mysqltest_2@localhost;
-create user mysqltest_3@localhost;
-grant drop on `mysqltest`.* to mysqltest_3@localhost;
-
-connect (con1,localhost,mysqltest_1,,mysqltest);
-connection con1;
-select * from t1;
-show create database mysqltest;
---error ER_TABLEACCESS_DENIED_ERROR
-drop table t1;
---error ER_DBACCESS_DENIED_ERROR
-drop database mysqltest;
-disconnect con1;
---source include/wait_until_disconnected.inc
-
-connect (con2,localhost,mysqltest_2,,test);
-connection con2;
---error ER_TABLEACCESS_DENIED_ERROR
-select * from mysqltest.t1;
---error ER_DBACCESS_DENIED_ERROR
-show create database mysqltest;
---error ER_TABLEACCESS_DENIED_ERROR
-drop table mysqltest.t1;
---error ER_DBACCESS_DENIED_ERROR
-drop database mysqltest;
-disconnect con2;
---source include/wait_until_disconnected.inc
-
-connect (con3,localhost,mysqltest_3,,test);
-connection con3;
---error ER_TABLEACCESS_DENIED_ERROR
-select * from mysqltest.t1;
-show create database mysqltest;
-drop table mysqltest.t1;
-drop database mysqltest;
-disconnect con3;
---source include/wait_until_disconnected.inc
-
-connection default;
-set names binary;
-delete from mysql.user
-where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
-delete from mysql.db
-where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
-flush privileges;
-
-# Test that USING <keytype> is always shown in SHOW CREATE TABLE when it was
-# specified during table creation, but not otherwise. (Bug#7235)
-CREATE TABLE t1 (i int, KEY (i)) ENGINE=MEMORY;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-CREATE TABLE t1 (i int, KEY USING HASH (i)) ENGINE=MEMORY;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MEMORY;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-# Test that when an index is created with the default key algorithm and
-# altered to another storage engine, it gets the default key algorithm
-# for that storage engine, but when it is specified, the specified type is
-# preserved.
-CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
-SHOW CREATE TABLE t1;
-ALTER TABLE t1 ENGINE=MEMORY;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
-SHOW CREATE TABLE t1;
-ALTER TABLE t1 ENGINE=MEMORY;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-# Test for Bug#9439 Reporting wrong datatype for sub_part on show index
-CREATE TABLE t1(
- field1 text NOT NULL,
- PRIMARY KEY(field1(1000))
-);
---enable_metadata
-show index from t1;
---disable_metadata
-drop table t1;
-
-# Test for Bug#11635 mysqldump exports TYPE instead of USING for HASH
-create table t1 (
- c1 int NOT NULL,
- c2 int NOT NULL,
- PRIMARY KEY USING HASH (c1),
- INDEX USING BTREE(c2)
-);
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-# Test for Bug#93 4.1 protocol crash on corrupted frm and SHOW TABLE STATUS
-
-flush tables;
-
-# Create a junk frm file on disk
-let $MYSQLD_DATADIR= `select @@datadir`;
-system echo "this is a junk file for test" >> $MYSQLD_DATADIR/test/t1.frm ;
---replace_column 6 # 7 # 8 # 9 # 12 #
-SHOW TABLE STATUS like 't1';
---error ER_NOT_FORM_FILE
-show create table t1;
---disable_warnings
-drop table if exists t1;
---enable_warnings
---error 0,1
---remove_file $MYSQLD_DATADIR/test/t1.frm
-
-#
-# Bug#12183 SHOW OPEN TABLES behavior doesn't match grammar
-# First we close all open tables with FLUSH tables and then we open some.
-#
-
---echo
---echo # Bug#12183 SHOW OPEN TABLES behavior doesn't match grammar.
---echo
-
-# NOTE: SHOW OPEN TABLES does not sort result list by database or table names.
-# Tables are listed in the order they were opened. We can not use the system
-# database (mysql) for the test here, because we have no control over the order
-# of opening tables in it. Consequently, we can not use 'SHOW OPEN TABLES'.
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest1;
---enable_warnings
-
-CREATE DATABASE mysqltest1;
-use mysqltest1;
-
---echo
-
-CREATE TABLE t1(a INT);
-CREATE TABLE t2(a INT);
-
---echo
-
---disable_ps_protocol
-FLUSH TABLES;
-
---echo
-
-SELECT 1 FROM t1;
-SELECT 1 FROM t2;
-
---echo
-
-SHOW OPEN TABLES FROM mysqltest1;
-
---echo
-
-SHOW OPEN TABLES FROM mysqltest1 LIKE 'z%';
-
---echo
-
-SHOW OPEN TABLES FROM mysqltest1 LIKE 't1%';
-
---echo
-
-SHOW OPEN TABLES FROM mysqltest1 LIKE '%1%';
-
---echo
-
-FLUSH TABLES;
---enable_ps_protocol
-
---echo
-
-DROP DATABASE mysqltest1;
-use test;
-
---echo
-
-#
-# Bug#12591 SHOW TABLES FROM dbname produces wrong error message
-#
---error ER_BAD_DB_ERROR
-SHOW TABLES FROM non_existing_database;
-
---echo End of 4.1 tests
-
-#
-# Bug#17203 "sql_no_cache sql_cache" in views created from prepared
-# statement
-#
-# The problem was that initial user setting was forgotten, and current
-# runtime-determined values of the flags were shown instead.
-#
---disable_warnings
-DROP VIEW IF EXISTS v1;
-DROP PROCEDURE IF EXISTS p1;
---enable_warnings
-
-# Check that SHOW CREATE VIEW shows SQL_CACHE flag exaclty as
-# specified by the user.
-CREATE VIEW v1 AS SELECT 1;
-SHOW CREATE VIEW v1;
-DROP VIEW v1;
-
-CREATE VIEW v1 AS SELECT SQL_CACHE 1;
-SHOW CREATE VIEW v1;
-DROP VIEW v1;
-
-CREATE VIEW v1 AS SELECT SQL_NO_CACHE 1;
-SHOW CREATE VIEW v1;
-DROP VIEW v1;
-
-# Usage of NOW() disables caching, but we still have show what the
-# user have specified.
-CREATE VIEW v1 AS SELECT NOW();
-SHOW CREATE VIEW v1;
-DROP VIEW v1;
-
-CREATE VIEW v1 AS SELECT SQL_CACHE NOW();
-SHOW CREATE VIEW v1;
-DROP VIEW v1;
-
-CREATE VIEW v1 AS SELECT SQL_NO_CACHE NOW();
-SHOW CREATE VIEW v1;
-DROP VIEW v1;
-
---error ER_WRONG_USAGE
-CREATE VIEW v1 AS SELECT SQL_CACHE SQL_NO_CACHE NOW();
-
---error ER_WRONG_USAGE
-CREATE VIEW v1 AS SELECT SQL_NO_CACHE SQL_CACHE NOW();
-
---error ER_WRONG_USAGE
-CREATE VIEW v1 AS SELECT SQL_CACHE SQL_NO_CACHE SQL_CACHE NOW();
-
-# Check CREATE VIEW in a prepared statement in a procedure.
-delimiter |;
-CREATE PROCEDURE p1()
-BEGIN
- SET @s= 'CREATE VIEW v1 AS SELECT SQL_CACHE 1';
- PREPARE stmt FROM @s;
- EXECUTE stmt;
- DROP PREPARE stmt;
-END |
-delimiter ;|
-CALL p1();
-SHOW CREATE VIEW v1;
-
-DROP PROCEDURE p1;
-DROP VIEW v1;
-
-
-#
-# Check that SHOW TABLES and SHOW COLUMNS give a error if there is no
-# referenced database and table respectively.
-#
---error ER_BAD_DB_ERROR
-SHOW TABLES FROM no_such_database;
---error ER_NO_SUCH_TABLE
-SHOW COLUMNS FROM no_such_table;
-
-
-#
-# Bug#19764 SHOW commands end up in the slow log as table scans
-#
-flush status;
-show status like 'slow_queries';
-show tables;
-show status like 'slow_queries';
-# Table scan query, to ensure that slow_queries does still get incremented
-# (mysqld is started with --log-queries-not-using-indexes)
-select 1 from information_schema.tables limit 1;
-show status like 'slow_queries';
-
-create table t1 (a int);
-create trigger tr1 before insert on t1 for each row
-begin
-end;
-create view v1 as select a from t1;
-create procedure p1()
-begin
-end;
-create function f1()
-returns int
-return 0;
-create event e1 on schedule every 1 year starts now()
- ends date_add(now(), interval 5 hour) do
-begin
-end;
-
---disable_result_log
-flush status;
-show databases;
-show tables;
-show events;
-show table status;
---sorted_result
-show open tables;
-show plugins;
-show columns in t1;
-show slave hosts;
-show keys in t1;
-show storage engines;
-show authors;
-show contributors;
-show privileges;
-show count(*) warnings;
-show count(*) errors;
-show warnings;
-show status;
-show processlist;
-show variables;
-show charset;
-show collation;
-show grants;
-show create database test;
-show create table t1;
-show create view v1;
-show master status;
-show slave status;
-show create procedure p1;
-show create function f1;
-show create trigger tr1;
-show procedure status;
-show create event e1;
---enable_result_log
-
-show status like 'slow_queries';
-
-drop view v1;
-drop table t1;
-drop procedure p1;
-drop function f1;
-drop event e1;
-
-#
-# Bug#10491 Server returns data as charset binary SHOW CREATE TABLE or SELECT
-# FROM I_S.
-#
-
-#
-# Part 1: check that meta-data specifies not-binary character set.
-#
-
-# Ensure that all needed objects are dropped.
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest1;
-DROP TABLE IF EXISTS t1;
-DROP VIEW IF EXISTS v1;
-DROP PROCEDURE IF EXISTS p1;
-DROP FUNCTION IF EXISTS f1;
---enable_warnings
-
-# Create objects.
-
-CREATE DATABASE mysqltest1;
-
-CREATE TABLE t1(c INT NOT NULL PRIMARY KEY);
-
-CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1;
-
-CREATE VIEW v1 AS SELECT 1;
-
-CREATE PROCEDURE p1() SELECT 1;
-
-CREATE FUNCTION f1() RETURNS INT RETURN 1;
-
-
-# Test.
-
-set names utf8;
-
---echo -- Here we enable metadata just to check that the collation of the
---echo -- resultset is non-binary for string type. This should be changed
---echo -- after Bug#29394 is implemented.
-
---enable_metadata
-
---echo ----------------------------------------------------------------
-
-SHOW CHARACTER SET LIKE 'utf8';
-
---echo ----------------------------------------------------------------
-
-SHOW COLLATION LIKE 'latin1_bin';
-
---echo ----------------------------------------------------------------
-
-SHOW CREATE DATABASE mysqltest1;
-
---echo ----------------------------------------------------------------
-
-SHOW DATABASES LIKE 'mysqltest1';
-
---echo ----------------------------------------------------------------
-
-SHOW CREATE TABLE t1;
-
---echo ----------------------------------------------------------------
-
-SHOW INDEX FROM t1;
-
---echo ----------------------------------------------------------------
-
-SELECT
- TABLE_CATALOG,
- TABLE_SCHEMA,
- TABLE_NAME,
- TABLE_TYPE,
- ENGINE,
- ROW_FORMAT,
- TABLE_COLLATION,
- CREATE_OPTIONS,
- TABLE_COMMENT
-FROM INFORMATION_SCHEMA.TABLES
-WHERE table_name = 't1';
-
---echo ----------------------------------------------------------------
-
-SELECT
- TABLE_CATALOG,
- TABLE_SCHEMA,
- TABLE_NAME,
- COLUMN_NAME,
- COLUMN_DEFAULT,
- IS_NULLABLE,
- DATA_TYPE,
- CHARACTER_SET_NAME,
- COLLATION_NAME,
- COLUMN_TYPE,
- COLUMN_KEY,
- EXTRA,
- PRIVILEGES,
- COLUMN_COMMENT
-FROM INFORMATION_SCHEMA.COLUMNS
-WHERE table_name = 't1';
-
---echo ----------------------------------------------------------------
-
-SHOW TABLES LIKE 't1';
-
---echo ----------------------------------------------------------------
-
-SHOW COLUMNS FROM t1;
-
---echo ----------------------------------------------------------------
-
---replace_column 6 #
-SHOW TRIGGERS LIKE 't1';
-
---echo ----------------------------------------------------------------
-
-SELECT
- TRIGGER_CATALOG,
- TRIGGER_SCHEMA,
- TRIGGER_NAME,
- EVENT_MANIPULATION,
- EVENT_OBJECT_CATALOG,
- EVENT_OBJECT_SCHEMA,
- EVENT_OBJECT_TABLE,
- ACTION_CONDITION,
- ACTION_STATEMENT,
- ACTION_ORIENTATION,
- ACTION_TIMING,
- ACTION_REFERENCE_OLD_TABLE,
- ACTION_REFERENCE_NEW_TABLE,
- ACTION_REFERENCE_OLD_ROW,
- ACTION_REFERENCE_NEW_ROW,
- SQL_MODE,
- DEFINER
-FROM INFORMATION_SCHEMA.TRIGGERS
-WHERE trigger_name = 't1_bi';
-
-# Metadata is different for the field "CREATED" with and without --ps
-# So test it separately.
-
---disable_ps_protocol
---replace_column 1 #
-SELECT CREATED FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name='t1_bi';
---enable_ps_protocol
-
---echo ----------------------------------------------------------------
-
-SHOW CREATE VIEW v1;
-
---echo ----------------------------------------------------------------
-
-SELECT *
-FROM INFORMATION_SCHEMA.VIEWS
-WHERE table_name = 'v1';
-
---echo ----------------------------------------------------------------
-
-SHOW CREATE PROCEDURE p1;
-
---echo ----------------------------------------------------------------
-
-SELECT
- SPECIFIC_NAME,
- ROUTINE_CATALOG,
- ROUTINE_SCHEMA,
- ROUTINE_NAME,
- ROUTINE_TYPE,
- DTD_IDENTIFIER,
- ROUTINE_BODY,
- ROUTINE_DEFINITION,
- EXTERNAL_NAME,
- EXTERNAL_LANGUAGE,
- PARAMETER_STYLE,
- IS_DETERMINISTIC,
- SQL_DATA_ACCESS,
- SQL_PATH,
- SECURITY_TYPE,
- SQL_MODE,
- ROUTINE_COMMENT,
- DEFINER
-FROM INFORMATION_SCHEMA.ROUTINES
-WHERE routine_name = 'p1';
-
---echo ----------------------------------------------------------------
-
-SHOW CREATE FUNCTION f1;
-
---echo ----------------------------------------------------------------
-
-SELECT
- SPECIFIC_NAME,
- ROUTINE_CATALOG,
- ROUTINE_SCHEMA,
- ROUTINE_NAME,
- ROUTINE_TYPE,
- DTD_IDENTIFIER,
- ROUTINE_BODY,
- ROUTINE_DEFINITION,
- EXTERNAL_NAME,
- EXTERNAL_LANGUAGE,
- PARAMETER_STYLE,
- IS_DETERMINISTIC,
- SQL_DATA_ACCESS,
- SQL_PATH,
- SECURITY_TYPE,
- SQL_MODE,
- ROUTINE_COMMENT,
- DEFINER
-FROM INFORMATION_SCHEMA.ROUTINES
-WHERE routine_name = 'f1';
-
---echo ----------------------------------------------------------------
-
---disable_metadata
-
-# Cleanup.
-
-DROP DATABASE mysqltest1;
-DROP TABLE t1;
-DROP VIEW v1;
-DROP PROCEDURE p1;
-DROP FUNCTION f1;
-
-#
-# Part 2: check that table with non-latin1 characters are dumped/restored
-# correctly.
-#
-# See MDEV-14651 for details
-# Ensure that all needed objects are dropped.
-
-#set names koi8r;
-
-#--disable_warnings
-#DROP DATABASE IF EXISTS mysqltest1;
-#--enable_warnings
-
-# Create objects.
-
-#CREATE DATABASE mysqltest1;
-
-#use mysqltest1;
-
-#CREATE TABLE t1(1 INT);
-
-# Check:
-# - Dump mysqltest1;
-
-#--let $outfile1=$MYSQLTEST_VARDIR/tmp/show_check.mysqltest1.sql
-
-#--source include/count_sessions.inc
-#--echo
-#--echo ---> Dumping mysqltest1 to outfile1
-#--exec $MYSQL_DUMP --default-character-set=latin1 --character-sets-dir=$MYSQL_SHAREDIR/charsets --databases mysqltest1 > $outfile1
-# Take care that the additional session caused by MYSQL_DUMP has disappeared.
-#--source include/wait_until_count_sessions.inc
-
-# - Clean mysqltest1;
-
-#--echo
-#--echo
-
-#DROP DATABASE mysqltest1;
-
-# - Restore mysqltest1;
-
-#--echo
-#--echo
-
-#--source include/count_sessions.inc
-#--echo ---> Restoring mysqltest1...
-#--exec $MYSQL test < $outfile1
-#--remove_file $outfile1
-# Take care that the additional session caused by MYSQL has disappeared.
-#--source include/wait_until_count_sessions.inc
-
-# - Check definition of the table.
-
-#SHOW CREATE TABLE mysqltest1.t1;
-
-# Cleanup.
-
-#DROP DATABASE mysqltest1;
-#use test;
-
-#
-# Bug#28808 log_queries_not_using_indexes variable dynamic change is ignored
-#
-flush status;
-show variables like "log_queries_not_using_indexes";
-select 1 from information_schema.tables limit 1;
-show status like 'slow_queries';
-set session log_queries_not_using_indexes=OFF;
-show variables like "log_queries_not_using_indexes";
-select 1 from information_schema.tables limit 1;
-show status like 'slow_queries';
-set session log_queries_not_using_indexes=ON;
-show variables like "log_queries_not_using_indexes";
-select 1 from information_schema.tables limit 1;
-show status like 'slow_queries';
-
-#
-# Bug#30088 Can't disable myisam-recover by a value of ""
-#
-show variables like 'myisam_recover_options';
-
-#
-# Bug#37301 Length and Max_length differ with no obvious reason
-#
-CREATE TABLE t1 (
- Codigo int(10) unsigned NOT NULL auto_increment,
- Nombre varchar(255) default NULL,
- Telefono varchar(255) default NULL,
- Observaciones longtext,
- Direccion varchar(255) default NULL,
- Dni varchar(255) default NULL,
- CP int(11) default NULL,
- Provincia varchar(255) default NULL,
- Poblacion varchar(255) default NULL,
- PRIMARY KEY (Codigo)
-) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
---enable_metadata
-show create table t1;
---disable_metadata
-drop table t1;
-
---echo End of 5.0 tests
-
---disable_result_log
-SHOW AUTHORS;
---enable_result_log
-
-#
-# Bug#9785 SELECT privilege for the whole database is needed to do
-# SHOW CREATE DATABASE
-#
-create database mysqltest;
-show create database mysqltest;
-create table mysqltest.t1(a int);
-insert into mysqltest.t1 values(1);
-create user mysqltest_4@localhost;
-grant select on `mysqltest`.`t1` to mysqltest_4@localhost;
-connect (con4,localhost,mysqltest_4,,mysqltest);
-connection con4;
-show create database mysqltest;
-disconnect con4;
---source include/wait_until_disconnected.inc
-connection default;
-delete from mysql.user where user='mysqltest_4';
-delete from mysql.db where user='mysqltest_4';
-delete from mysql.tables_priv where user='mysqltest_4';
-flush privileges;
-drop database mysqltest;
-
-#
-# Ensure that show plugin code is tested
-#
-
---disable_result_log
-show plugins;
---enable_result_log
-
-#
-# Bug#19874 SHOW COLUMNS and SHOW KEYS handle identifiers containing
-# \ incorrectly
-#
-create database `mysqlttest\1`;
-create table `mysqlttest\1`.`a\b` (a int);
-show tables from `mysqlttest\1`;
-show fields from `mysqlttest\1`.`a\b`;
-show columns from `a\b` from `mysqlttest\1`;
-show keys from `mysqlttest\1`.`a\b`;
-drop table `mysqlttest\1`.`a\b`;
-drop database `mysqlttest\1`;
-
-#
-# Bug#24392 SHOW ENGINE MUTEX STATUS is a synonym for SHOW INNODB STATUS
-#
-
---error ER_UNKNOWN_STORAGE_ENGINE
-show engine foobar status;
---error ER_UNKNOWN_STORAGE_ENGINE
-show engine foobar logs;
---error ER_UNKNOWN_STORAGE_ENGINE
-show engine foobar mutex;
-
---error ER_UNKNOWN_STORAGE_ENGINE
-show engine mutex status;
-
-show engine csv status;
-show engine csv logs;
-show engine csv mutex;
-#
-# Bug#25081 SHOW FULL TABLES on table with latin chars in name fails
-#
-set names utf8;
---disable_warnings
-drop table if exists `été`;
---enable_warnings
-create table `été` (field1 int);
-show full tables;
-drop table `été`;
-set names latin1;
-
---echo #
---echo # Bug#4374 SHOW TABLE STATUS FROM ignores collation_connection
---echo # Character set: Latin-1 (ISO-8859-1)
---echo #
-SET NAMES latin1;
-CREATE DATABASE ``;
-CREATE TABLE ``.`` (a int) ENGINE=Memory;
---replace_column 6 # 7 # 8 # 9 # 12 #
-SHOW TABLE STATUS FROM `` LIKE '';
-DROP DATABASE ``;
-
-#
-# Bug#26402 Server crashes with old-style named table
-#
---error ER_NO_SUCH_TABLE,ER_FILE_NOT_FOUND
-show columns from `#mysql50#????????`;
-call mtr.add_suppression("Can.t find file: '.\\\\test\\\\\\?{8}.frm'");
-
-#
-# SHOW CREATE TRIGGER test.
-#
-
-# Prepare.
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP PROCEDURE IF EXISTS p1;
---enable_warnings
-
-CREATE TABLE t1(c1 INT);
-
-CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1;
-
-# Test.
-
---replace_column 7 #
-SHOW CREATE TRIGGER t1_bi;
-
-CREATE PROCEDURE p1() SHOW CREATE TRIGGER t1_bi;
-
---replace_column 7 #
-CALL p1();
---replace_column 7 #
-CALL p1();
---replace_column 7 #
-CALL p1();
---replace_column 7 #
-CALL p1();
---replace_column 7 #
-CALL p1();
---replace_column 7 #
-CALL p1();
---replace_column 7 #
-CALL p1();
---replace_column 7 #
-CALL p1();
---replace_column 7 #
-CALL p1();
---replace_column 7 #
-CALL p1();
-
-PREPARE stmt1 FROM 'SHOW CREATE TRIGGER t1_bi';
-
---replace_column 7 #
-EXECUTE stmt1;
---replace_column 7 #
-EXECUTE stmt1;
---replace_column 7 #
-EXECUTE stmt1;
---replace_column 7 #
-EXECUTE stmt1;
---replace_column 7 #
-EXECUTE stmt1;
---replace_column 7 #
-EXECUTE stmt1;
---replace_column 7 #
-EXECUTE stmt1;
---replace_column 7 #
-EXECUTE stmt1;
---replace_column 7 #
-EXECUTE stmt1;
---replace_column 7 #
-EXECUTE stmt1;
-
-# Cleanup.
-
-DROP TABLE t1;
-DROP PROCEDURE p1;
-DEALLOCATE PREPARE stmt1;
-
-#
-# Bug#10491 Server returns data as charset binary SHOW CREATE TABLE or SELECT
-# FROM INFORMATION_SCHEMA.
-#
-# Before the change performed to fix the bug, the metadata of the output of
-# SHOW CREATE statements would always describe the result as 'binary'. That
-# would ensure that the result is never converted to character_set_client
-# (which was essential to mysqldump). Now we return to the client the actual
-# character set of the object -- which is character_set_client of the
-# connection that issues the CREATE statement, and this triggers an automatic
-# conversion to character_set_results of the connection that issues SHOW CREATE
-# statement.
-#
-# This test demonstrates that this conversion indeed is taking place.
-#
-
-# Prepare: create objects in a one character set.
-
-set names koi8r;
-
---disable_warnings
-DROP VIEW IF EXISTS v1;
-DROP PROCEDURE IF EXISTS p1;
-DROP FUNCTION IF EXISTS f1;
-DROP TABLE IF EXISTS t1;
-DROP EVENT IF EXISTS ev1;
---enable_warnings
-
-CREATE VIEW v1 AS SELECT '' AS test;
-
-CREATE PROCEDURE p1() SELECT '' AS test;
-
-CREATE FUNCTION f1() RETURNS CHAR(10) RETURN '';
-
-CREATE TABLE t1(c1 CHAR(10));
-CREATE TRIGGER t1_bi BEFORE INSERT ON t1
- FOR EACH ROW
- SET NEW.c1 = '';
-
-CREATE EVENT ev1 ON SCHEDULE AT '2030-01-01 00:00:00' DO SELECT '' AS test;
-
-# Test: switch the character set and show that SHOW CREATE output is
-# automatically converted to the new character_set_client.
-
-set names utf8;
-
-SHOW CREATE VIEW v1;
-
-SHOW CREATE PROCEDURE p1;
-
-SHOW CREATE FUNCTION f1;
-
---replace_column 7 #
-SHOW CREATE TRIGGER t1_bi;
-
-SHOW CREATE EVENT ev1;
-
-# Cleanup.
-
-DROP VIEW v1;
-DROP PROCEDURE p1;
-DROP FUNCTION f1;
-DROP TABLE t1;
-DROP EVENT ev1;
-
-#
-# Bug#30036 SHOW TABLE TYPES causes the debug client to crash
-#
---disable_result_log
-SHOW STORAGE ENGINES;
---enable_result_log
-
-
-#
-# Bug#32710 SHOW INNODB STATUS requires SUPER
-#
-
-CREATE USER test_u@localhost;
-GRANT PROCESS ON *.* TO test_u@localhost;
-
-connect (conn1, localhost, test_u,,);
-
---disable_result_log
-SHOW ENGINE MYISAM MUTEX;
-SHOW ENGINE MYISAM STATUS;
---enable_result_log
-
-disconnect conn1;
---source include/wait_until_disconnected.inc
-connection default;
-DROP USER test_u@localhost;
-
---echo End of 5.1 tests
-
---echo #
---echo # Bug#52593 SHOW CREATE TABLE is blocked if table is locked
---echo # for write by another connection
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-connect(con1, localhost,root);
-connection default;
-
-CREATE TABLE t1 (i INT PRIMARY KEY);
-LOCK TABLE t1 WRITE;
-connection con1;
---echo # This statement used to be blocked.
-SHOW CREATE TABLE t1;
-
-disconnect con1;
---source include/wait_until_disconnected.inc
-
-connection default;
-UNLOCK TABLES;
-DROP TABLE t1;
-
-
---echo #
---echo # Bug#54905 Connection with WRITE lock cannot ALTER table due to
---echo # concurrent SHOW CREATE
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1(a INT);
-
-connect (con1,localhost,root);
-LOCK TABLE t1 WRITE;
-
-connection default;
-START TRANSACTION;
-SHOW CREATE TABLE t1;
-
-connection con1;
-# Used to block
-ALTER TABLE t1 CHARACTER SET = utf8;
-UNLOCK TABLES;
-
-connection default;
-COMMIT;
-disconnect con1;
-DROP TABLE t1;
-
-
---echo #
---echo # Bug#55498 SHOW CREATE TRIGGER takes wrong type of metadata lock.
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (a INT);
-CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a = 1;
-
---echo # Test 1: SHOW CREATE TRIGGER with WRITE locked table.
-
-connect (con1, localhost, root);
-LOCK TABLE t1 WRITE;
-
-connection default;
-# Should not block.
---replace_column 7 #
-SHOW CREATE TRIGGER t1_bi;
-
-connection con1;
-UNLOCK TABLES;
-
---echo # Test 2: ALTER TABLE with SHOW CREATE TRIGGER in transaction
-
-connection default;
-START TRANSACTION;
---replace_column 7 #
-SHOW CREATE TRIGGER t1_bi;
-
-connection con1;
-# Should not block.
-ALTER TABLE t1 CHARACTER SET = utf8;
-
-disconnect con1;
---source include/wait_until_disconnected.inc
-
-connection default;
-COMMIT;
-DROP TRIGGER t1_bi;
-DROP TABLE t1;
-
-
---echo #
---echo # Bug#57306 SHOW PROCESSLIST does not display string literals well.
---echo #
-
-SET NAMES latin1;
-SELECT GET_LOCK('t', 1000);
---connect (con1,localhost,root,,)
---connection con1
-SET NAMES latin1;
---send SELECT GET_LOCK('t',1000) AS 'óóóó';
---connection default
-# Make sure con1 has switched from "SET NAMES" to "SELECT GET_LOCK"
-let $wait_timeout= 10;
-let $wait_condition= SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%GET_LOCK%' AND ID != CONNECTION_ID();
---source include/wait_condition.inc
---replace_column 1 ### 3 ### 6 ### 7 ###
-SHOW PROCESSLIST;
-SET NAMES utf8;
---replace_column 1 ### 3 ### 6 ### 7 ###
-SHOW PROCESSLIST;
-SELECT RELEASE_LOCK('t');
---connection con1
---reap
---disconnect con1
---source include/wait_until_disconnected.inc
---connection default
-SET NAMES latin1;
-
-
---echo #
---echo # Test SHOW AUTHORS and SHOW CONTRIBUTORS
---echo #
-
---disable_result_log
-SHOW AUTHORS;
---enable_result_log
-SHOW WARNINGS;
-
---disable_result_log
-SHOW CONTRIBUTORS;
---enable_result_log
-SHOW WARNINGS;
diff --git a/mysql-test/t/show_create_user.test b/mysql-test/t/show_create_user.test
deleted file mode 100644
index a10c8aeeda6..00000000000
--- a/mysql-test/t/show_create_user.test
+++ /dev/null
@@ -1,34 +0,0 @@
---source include/not_embedded.inc
-
-create user foo;
-show create user foo;
-
-create user foo@test;
-show create user foo@test;
-
-create user foo2@test identified by 'password';
-show create user foo2@test;
-
-alter user foo2@test identified with 'someplugin' as 'somepassword';
-show create user foo2@test;
-
-create user foo3@test require SSL;
-show create user foo3@test;
-
-create user foo4@test require cipher 'text' issuer 'foo_issuer' subject 'foo_subject';
-show create user foo4@test;
-
-create user foo5@test require SSL
- with MAX_QUERIES_PER_HOUR 10
- MAX_UPDATES_PER_HOUR 20
- MAX_CONNECTIONS_PER_HOUR 30
- MAX_USER_CONNECTIONS 40
- MAX_STATEMENT_TIME 0.5;
-show create user foo5@test;
-
-drop user foo5@test;
-drop user foo4@test;
-drop user foo3@test;
-drop user foo2@test;
-drop user foo@test;
-drop user foo;
diff --git a/mysql-test/t/show_explain.test b/mysql-test/t/show_explain.test
deleted file mode 100644
index 6615ff66737..00000000000
--- a/mysql-test/t/show_explain.test
+++ /dev/null
@@ -1,1204 +0,0 @@
-#
-# Tests for SHOW EXPLAIN FOR functionality
-#
---source include/have_debug.inc
---source include/have_innodb.inc
-
---disable_warnings
-drop table if exists t0, t1, t2, t3, t4;
-drop view if exists v1;
---enable_warnings
-SET @old_debug= @@session.debug;
-
-#
-# Testcases in this file do not work with embedded server. The reason for this
-# is that we use the following commands for synchronization:
-#
-# set @show_explain_probe_select_id=1;
-# set debug_dbug='d,show_explain_probe_join_exec_start';
-# send select count(*) from t1 where a < 100000;
-#
-# When ran with mysqltest_embedded, this translates into:
-#
-# Thread1> DBUG_PUSH("d,show_explain_probe_join_exec_start");
-# Thread1> create another thread for doing "send ... reap"
-# Thread2> mysql_parse("select count(*) from t1 where a < 100000");
-#
-# That is, "select count(*) ..." is ran in a thread for which DBUG_PUSH(...)
-# has not been called. As a result, show_explain_probe_join_exec_start does not fire, and
-# "select count(*) ..." does not wait till its SHOW EXPLAIN command, and the
-# test fails.
-#
--- source include/not_embedded.inc
-
-set debug_sync='RESET';
-
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t1 (a int);
-insert into t1 select A.a + 10*B.a + 100*C.a from t0 A, t0 B, t0 C;
-alter table t1 add b int, add c int, add filler char(32);
-update t1 set b=a, c=a, filler='fooo';
-alter table t1 add key(a), add key(b);
-
-#
-# Try killing a non-existent thread
-#
---error ER_NO_SUCH_THREAD
-show explain for 2000000000;
-
---error ER_SET_CONSTANTS_ONLY
-show explain for (select max(a) from t0);
-
-#
-# Setup two threads and their ids
-#
-let $thr1=`select connection_id()`;
-connect (con1, localhost, root,,);
-connection con1;
-let $thr2=`select connection_id()`;
-SET @old_debug= @@session.debug;
-connection default;
-
-# SHOW EXPLAIN FOR <idle thread>
---error ER_TARGET_NOT_EXPLAINABLE
-evalp show explain for $thr2;
-
-# SHOW EXPLAIN FOR <ourselves>
---error ER_TARGET_NOT_EXPLAINABLE
-evalp show explain for $thr1;
-
-let $wait_condition= select State='show_explain_trap' from information_schema.processlist where id=$thr2;
-
-#
-# Test SHOW EXPLAIN for simple queries
-#
-connection con1;
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
-send select count(*) from t1 where a < 100000;
-
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-connection con1;
-reap;
-
-
-send select max(c) from t1 where a < 10;
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-connection con1;
-reap;
-
-
---echo # We can catch EXPLAIN, too.
-set @show_expl_tmp= @@optimizer_switch;
-set optimizer_switch='index_condition_pushdown=on,mrr=on,mrr_sort_keys=on';
-send explain select max(c) from t1 where a < 10;
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-connection con1;
-reap;
-set optimizer_switch= @show_expl_tmp;
-set debug_dbug=@old_debug;
-
---echo # UNION, first branch
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
-send explain select a from t0 A union select a+1 from t0 B;
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-connection con1;
-reap;
-set debug_dbug=@old_debug;
-
-
---echo # UNION, second branch
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
-send explain select a from t0 A union select a+1 from t0 B;
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-connection con1;
-reap;
-set debug_dbug=@old_debug;
-
-
---echo # Uncorrelated subquery, select
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
-send select a, (select max(a) from t0 B) from t0 A where a<1;
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-connection con1;
-reap;
-set debug_dbug=@old_debug;
-
-
---echo # Uncorrelated subquery, explain
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
-send explain select a, (select max(a) from t0 B) from t0 A where a<1;
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-connection con1;
-reap;
-set debug_dbug=@old_debug;
-
---echo # correlated subquery, select
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
-send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-connection con1;
-reap;
-set debug_dbug=@old_debug;
-
---echo # correlated subquery, explain
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
-send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-connection con1;
-reap;
-set debug_dbug=@old_debug;
-
---echo # correlated subquery, select, while inside the subquery
-set @show_explain_probe_select_id=2; # <---
-set debug_dbug='+d,show_explain_probe_join_exec_start';
-send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-connection con1;
-reap;
-set debug_dbug=@old_debug;
-
---echo # correlated subquery, explain, while inside the subquery
-set @show_explain_probe_select_id=2;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
-send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-connection con1;
-reap;
-set debug_dbug=@old_debug;
-
---echo # correlated subquery, explain, while inside the subquery
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_end';
-send select a, (select max(a) from t0 b where b.a+a.a<10) from t0 a where a<1;
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-connection con1;
-reap;
-set debug_dbug=@old_debug;
-
-# TODO: explain in the parent subuqery when the un-correlated child has been
-# run (and have done irreversible cleanups)
-# ^^ Is this at all possible after 5.3?
-# Maybe, for 5.3 try this:
-# - run before/after the parent has invoked child's optimization
-# - run after materialization
-
---echo # Try to do SHOW EXPLAIN for a query that runs a SET command:
---echo # I've found experimentally that select_id==2 here...
---echo #
-set @show_explain_probe_select_id=2;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
-send set @foo= (select max(a) from t0 where sin(a) >0);
-connection default;
---source include/wait_condition.inc
---error ER_TARGET_NOT_EXPLAINABLE
-evalp show explain for $thr2;
-evalp kill query $thr2;
-connection con1;
---error ER_QUERY_INTERRUPTED
-reap;
-set debug_dbug=@old_debug;
-
---echo #
---echo # Attempt SHOW EXPLAIN for an UPDATE
---echo #
-create table t2 as select a as a, a as dummy from t0 limit 2;
-set @show_explain_probe_select_id=2;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
-send update t2 set dummy=0 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
-connection default;
---source include/wait_condition.inc
-#--error ER_TARGET_NOT_EXPLAINABLE
-evalp show explain for $thr2;
---source include/wait_condition.inc
-#--error ER_TARGET_NOT_EXPLAINABLE
-evalp show explain for $thr2;
-connection con1;
-reap;
-drop table t2;
-set debug_dbug=@old_debug;
-
---echo #
---echo # Attempt SHOW EXPLAIN for a DELETE (UPD: now works)
---echo #
-create table t2 as select a as a, a as dummy from t0 limit 2;
-set @show_explain_probe_select_id=2;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
-send delete from t2 where (select max(a) from t0 where t2.a + t0.a <3) >3 ;
-connection default;
---source include/wait_condition.inc
-#--error ER_TARGET_NOT_EXPLAINABLE
-evalp show explain for $thr2;
---source include/wait_condition.inc
-#--error ER_TARGET_NOT_EXPLAINABLE
-evalp show explain for $thr2;
-connection con1;
-reap;
-drop table t2;
-set debug_dbug=@old_debug;
-
---echo #
---echo # Multiple SHOW EXPLAIN calls for one select
---echo #
-create table t2 as select a as a, a as dummy from t0 limit 3;
-set @show_explain_probe_select_id=2;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
-send select t2.a, ((select max(a) from t0 where t2.a + t0.a <3) >3) as SUBQ from t2;
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
---source include/wait_condition.inc
-evalp show explain for $thr2;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-connection con1;
-reap;
-drop table t2;
-set debug_dbug=@old_debug;
-
---echo #
---echo # SHOW EXPLAIN for SELECT ... ORDER BY with "Using filesort"
---echo #
-explain select * from t0 order by a;
-
-set debug_dbug='+d,show_explain_probe_join_exec_start';
-set @show_explain_probe_select_id=1;
-send select * from t0 order by a;
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-connection con1;
-reap;
-set debug_dbug=@old_debug;
-
---echo #
---echo # SHOW EXPLAIN for SELECT ... with "Using temporary"
---echo #
-connection default;
-explain select distinct a from t0;
-connection con1;
-
-set debug_dbug='+d,show_explain_probe_join_exec_start';
-set @show_explain_probe_select_id=1;
-send select distinct a from t0;
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-connection con1;
-reap;
-set debug_dbug=@old_debug;
-
---echo #
---echo # SHOW EXPLAIN for SELECT ... with "Using temporary; Using filesort"
---echo #
-connection default;
-explain select distinct a from t0;
-connection con1;
-
-set debug_dbug='+d,show_explain_probe_join_exec_start';
-set @show_explain_probe_select_id=1;
-send select distinct a from t0;
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-connection con1;
-reap;
-set debug_dbug=@old_debug;
-
---echo #
---echo # MDEV-238: SHOW EXPLAIN: Server crashes in JOIN::print_explain with FROM subquery and GROUP BY
---echo #
-CREATE TABLE t2 ( a INT );
-INSERT INTO t2 VALUES (1),(2),(1),(4),(2);
-explain SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a;
-
-set debug_dbug='+d,show_explain_in_find_all_keys';
-send SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a;
-
-connection default;
---source include/wait_condition.inc
---echo # FIXED by "conservative assumptions about when QEP is available" fix:
---echo # NOTE: current code will not show "Using join buffer":
-#--error ER_TARGET_NOT_EXPLAINABLE
-evalp show explain for $thr2;
-connection con1;
-reap;
-set debug_dbug=@old_debug;
-DROP TABLE t2;
-
-
---echo #
---echo # MDEV-239: Assertion `field_types == 0 ... ' failed in Protocol_text::store(double, uint32, String*) with
---echo # SHOW EXPLAIN over EXPLAIN EXTENDED
---echo #
-
-
-CREATE TABLE t2 (a INT);
-INSERT INTO t2 VALUES (1),(2),(1),(4),(2);
-
-EXPLAIN EXTENDED SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a ;
-
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_end';
-send EXPLAIN EXTENDED SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a ;
-
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-connection con1;
-reap;
-set debug_dbug=@old_debug;
-DROP TABLE t2;
-
-
---echo #
---echo # MDEV-240: SHOW EXPLAIN: Assertion `this->optimized == 2' failed in
---echo # JOIN::print_explain on query with a JOIN, TEMPTABLE view,
---echo #
-CREATE TABLE t3 (a INT);
-CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t3;
-INSERT INTO t3 VALUES (8);
-CREATE TABLE t2 (b INT);
-INSERT INTO t2 VALUES (4),(5),(6),(7),(8),(9);
-explain SELECT * FROM v1, t2;
-
-set @show_explain_probe_select_id=2;
-set debug_dbug='+d,show_explain_probe_join_exec_end';
-send SELECT * FROM v1, t2;
-
-connection default;
---source include/wait_condition.inc
---error ER_TARGET_NOT_EXPLAINABLE
-evalp show explain for $thr2;
-evalp kill query $thr2;
-connection con1;
---error ER_QUERY_INTERRUPTED
-reap;
-set debug_dbug=@old_debug;
-DROP VIEW v1;
-DROP TABLE t2, t3;
-
---echo #
---echo # MDEV-267: SHOW EXPLAIN: Server crashes in JOIN::print_explain on most of queries
---echo #
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_end';
-send select sleep(1);
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-connection con1;
-reap;
-set debug_dbug=@old_debug;
-
-
---echo #
---echo # Same as above, but try another reason for JOIN to be degenerate
---echo #
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_end';
-send select * from t0 where 1>10;
-connection default;
---source include/wait_condition.inc
-#--error ER_TARGET_NOT_EXPLAINABLE
-evalp show explain for $thr2;
-connection con1;
-reap;
-set debug_dbug=@old_debug;
-
---echo #
---echo # Same as above, but try another reason for JOIN to be degenerate (2)
---echo #
-create table t3(a int primary key);
-insert into t3 select a from t0;
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_end';
-send select * from t0,t3 where t3.a=112233;
-connection default;
---source include/wait_condition.inc
-# --error ER_TARGET_NOT_EXPLAINABLE
-evalp show explain for $thr2;
-connection con1;
-reap;
-set debug_dbug=@old_debug;
-drop table t3;
-
---echo #
---echo # MDEV-270: SHOW EXPLAIN: server crashes in JOIN::print_explain on a query with
---echo # select tables optimized away
---echo #
-
-CREATE TABLE t2 (pk INT PRIMARY KEY, a INT ) ENGINE=MyISAM;
-INSERT INTO t2 VALUES
- (1,4),(2,62),(3,7),(4,1),(5,0),(6,7),(7,7),(8,1),(9,7),(10,1),
- (11,5),(12,2),(13,0),(14,1),(15,8),(16,1),(17,1),(18,9),(19,1),(20,5) ;
-
-explain SELECT * FROM t2 WHERE a =
- (SELECT MAX(a) FROM t2
- WHERE pk= (SELECT MAX(pk) FROM t2 WHERE pk = 3)
- );
-
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_do_select';
-send SELECT * FROM t2 WHERE a =
- (SELECT MAX(a) FROM t2
- WHERE pk= (SELECT MAX(pk) FROM t2 WHERE pk = 3)
- );
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-connection con1;
-reap;
-set debug_dbug=@old_debug;
-drop table t2;
-
-
---echo #
---echo # MDEV-273: SHOW EXPLAIN: server crashes in JOIN::print_explain on a query with impossible WHERE
---echo #
-CREATE TABLE t2 (a1 INT, KEY(a1)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES
- (4),(6),(7),(1),(0),(7),(7),(1),(7),(1),
- (5),(2),(0),(1),(8),(1),(1),(9),(1),(5);
-
-CREATE TABLE t3 (b1 INT) ENGINE=MyISAM;
-INSERT INTO t3 VALUES
- (4),(5),(8),(4),(8),(2),(9),(6),(4),(8),
- (3),(5),(9),(6),(8),(3),(2),(6),(3),(1),
- (4),(3),(1),(7),(0),(0),(9),(5),(9),(0),
- (2),(2),(5),(9),(1),(4),(8),(6),(5),(5),
- (1),(7),(2),(8),(9),(3),(2),(6),(6),(5),
- (4),(3),(2),(7),(4),(6),(0),(8),(5),(8),
- (2),(9),(7),(5),(7),(0),(4),(3),(1),(0),
- (6),(2),(8),(3),(7),(3),(5),(5),(1),(2),
- (1),(7),(1),(9),(9),(8),(3);
-CREATE TABLE t4 (c1 INT) ENGINE=MyISAM;
-
-EXPLAIN
-SELECT count(*) FROM t2, t3
-WHERE a1 < ALL (
- SELECT a1 FROM t2
- WHERE a1 IN ( SELECT a1 FROM t2, t4 )
-);
-
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_do_select';
-send
-SELECT count(*) FROM t2, t3
-WHERE a1 < ALL (
- SELECT a1 FROM t2
- WHERE a1 IN ( SELECT a1 FROM t2, t4 )
-);
-
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-connection con1;
-reap;
-set debug_dbug=@old_debug;
-drop table t2, t3, t4;
-
---echo #
---echo # MDEV-275: SHOW EXPLAIN: server crashes in JOIN::print_explain with IN subquery and aggregate function
---echo #
-CREATE TABLE t2 ( `pk` INT NOT NULL PRIMARY KEY, `a1` INT NOT NULL, KEY(`a1`)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES
- (1,5),(2,4),(3,6),(4,9),(5,2),(6,8),(7,4),(8,8),(9,0),(10,43),
- (11,23),(12,3),(13,45),(14,16),(15,2),(16,33),(17,2),(18,5),(19,9),(20,2);
-
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_end';
-send
- SELECT * FROM t2 WHERE (5, 78) IN (SELECT `a1`, MAX(`a1`) FROM t2 GROUP BY `a1`);
-connection default;
---source include/wait_condition.inc
-# --error ER_TARGET_NOT_EXPLAINABLE
-evalp show explain for $thr2;
-connection con1;
-reap;
-set debug_dbug=@old_debug;
-
-DROP TABLE t2;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-305: SHOW EXPLAIN: ref returned by SHOW EXPLAIN is different from the normal EXPLAIN ('const' vs empty string)
---echo #
-CREATE TABLE t1(a INT, KEY(a));
-INSERT INTO t1 VALUES (3),(1),(5),(1);
-
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
-
-send SELECT 'test' FROM t1 WHERE a=1;
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-connection con1;
-reap;
-set debug_dbug=@old_debug;
-
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-299: SHOW EXPLAIN: Plan produced by SHOW EXPLAIN changes back and forth during query execution
---echo #
-
-create table t1 (key1 int, col1 int, col2 int, filler char(100), key(key1));
-insert into t1 select A.a+ 10 * B.a, 10, 10, 'filler-data' from t0 A, t0 B;
-
-# Make matches 3 records
-update t1 set col1=3, col2=10 where key1=1; # small range
-update t1 set col1=3, col2=1000 where key1=2; # big range
-update t1 set col1=3, col2=10 where key1=3; # small range again
-update t1 set col1=3, col2=1000 where key1=4; # big range
-
-set @tmp_mdev299_jcl= @@join_cache_level;
-set join_cache_level=0;
-
-explain select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100;
-
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_test_if_quick_select';
-
-send
-select count(*) from t1 A, t1 B where B.key1 < A.col2 and A.col1=3 AND B.col2 + 1 < 100;
-
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
---source include/wait_condition.inc
-evalp show explain for $thr2;
---source include/wait_condition.inc
-evalp show explain for $thr2;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-connection con1;
-reap;
-
-set debug_dbug=@old_debug;
-drop table t1;
-
---echo #
---echo # MDEV-297: SHOW EXPLAIN: Server gets stuck until timeout occurs while
---echo # executing SHOW INDEX and SHOW EXPLAIN in parallel
---echo #
-CREATE TABLE t1(a INT, b INT, c INT, KEY(a), KEY(b), KEY(c));
-INSERT INTO t1 (a) VALUES (3),(1),(5),(1);
-
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
-
-send SHOW INDEX FROM t1;
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-connection con1;
-reap;
-set debug_dbug=@old_debug;
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-324: SHOW EXPLAIN: Plan produced by SHOW EXPLAIN for a query with TEMPTABLE view
---echo # loses 'DERIVED' line on the way without saying that the plan was already deleted
---echo #
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1),(2);
-CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
-
-EXPLAIN SELECT a + 1 FROM v1;
-
-set debug_dbug='+d,show_explain_probe_join_tab_preread';
-set @show_explain_probe_select_id=1;
-
-send
- SELECT a + 1 FROM v1;
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-connection con1;
-reap;
-set debug_dbug=@old_debug;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-323: SHOW EXPLAIN: Plan produced by SHOW EXPLAIN loses
---echo # 'UNION RESULT' line on the way without saying that the plan was already deleted
---echo #
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (4),(6);
-
-EXPLAIN
-SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 );
-
-set debug_dbug='+d,show_explain_probe_union_read';
-send
-SELECT a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 );
-
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-
---source include/wait_condition.inc
-evalp show explain for $thr2;
-
-connection con1;
-reap;
-
-set debug_dbug=@old_debug;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-327: SHOW EXPLAIN: Different select_type in plans produced by SHOW EXPLAIN
---echo # and standard EXPLAIN: 'SUBQUERY' vs 'DEPENDENT SUBQUERY'
---echo #
-CREATE TABLE t1 (a INT) ENGINE=Aria;
-INSERT INTO t1 VALUES
-(4),(6),(3),(5),(3),(246),(2),(9),(3),(8),
-(1),(8),(8),(5),(7),(5),(1),(6),(2),(9);
-
-CREATE TABLE t2 (b INT) ENGINE=Aria;
-INSERT INTO t2 VALUES
-(1),(7),(4),(7),(0),(2),(9),(4),(0),(9),
-(1),(3),(8),(8),(18),(84),(6),(3),(6),(6);
-
-EXPLAIN
-SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias
-WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b );
-
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
---send
-SELECT * FROM t1, ( SELECT * FROM t2 ) AS alias
-WHERE a < ALL ( SELECT b FROM t1, t2 WHERE a = b );
-
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-
-connection con1;
-reap;
-set debug_dbug=@old_debug;
-DROP TABLE t1, t2;
-
---echo #
---echo # Test that SHOW EXPLAIN will print 'Distinct'.
---echo #
-CREATE TABLE t1 (a int(10) unsigned not null primary key,b int(10) unsigned);
-INSERT INTO t1 VALUES (1,1),(2,1),(3,1),(4,1);
-
-CREATE TABLE t3 (a int(10) unsigned, key(A), b text);
-INSERT INTO t3 VALUES (1,'1'),(2,'2');
-
-create temporary table t4 select * from t3;
-insert into t3 select * from t4;
-insert into t4 select * from t3;
-insert into t3 select * from t4;
-insert into t4 select * from t3;
-insert into t3 select * from t4;
-insert into t4 select * from t3;
-insert into t3 select * from t4;
-explain select distinct t1.a from t1,t3 where t1.a=t3.a;
-
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
---send
-select distinct t1.a from t1,t3 where t1.a=t3.a;
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-
-connection con1;
-reap;
-set debug_dbug=@old_debug;
-
-drop table t1,t3,t4;
-
---echo #
---echo # ---------- SHOW EXPLAIN and permissions -----------------
---echo #
-create user test2@localhost;
-grant ALL on test.* to test2@localhost;
-
-# Give the user SUPER privilege so it can set debug_dbug variable.
-grant super on *.* to test2@localhost;
-connect (con2, localhost, test2,,);
-connection con1;
-
---echo #
---echo # First, make sure that user 'test2' cannot do SHOW EXPLAIN on us
---echo #
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
-send
-select * from t0 where a < 3;
-
-connection default;
---source include/wait_condition.inc
-
-connection con2;
---error ER_SPECIFIC_ACCESS_DENIED_ERROR
-evalp show explain for $thr2;
-
-connection default;
-evalp show explain for $thr2;
-
-connection con1;
-reap;
-set debug_dbug=@old_debug;
-
---echo #
---echo # Check that user test2 can do SHOW EXPLAIN on its own queries
---echo #
-connect (con3, localhost, test2,,);
-
-connection con2;
-let $thr_con2=`select connection_id()`;
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
-send
-select * from t0 where a < 3;
-
-connection con1;
-let $save_wait_condition= $wait_condition;
-let $wait_condition= select State='show_explain_trap' from information_schema.processlist where id=$thr_con2;
---source include/wait_condition.inc
-
-connection con3;
-evalp show explain for $thr_con2;
-
-connection con2;
-reap;
-
-connection con1;
-
-disconnect con3;
-let $wait_condition= $save_wait_condition;
---echo #
---echo # Now, grant test2 a PROCESSLIST permission, and see that he's able to observe us
---echo #
-disconnect con2;
-grant process on *.* to test2@localhost;
-connect (con2, localhost, test2,,);
-connection con1;
-set debug_dbug=@old_debug;
-
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
-send
-select * from t0 where a < 3;
-
-connection default;
---source include/wait_condition.inc
-
-connection con2;
-evalp show explain for $thr2;
-
-connection con1;
-reap;
-set debug_dbug=@old_debug;
-
-revoke all privileges on test.* from test2@localhost;
-drop user test2@localhost;
-
-disconnect con2;
---echo #
---echo # Test that it is possible to KILL a SHOW EXPLAIN command that's waiting
---echo # on its target thread
---echo #
-connect (con2, localhost, root,,);
-connect (con3, localhost, root,,);
-connection con2;
-create table t1 (pk int primary key, data char(64)) engine=innodb;
-insert into t1 select A.a + 10 * B.a + 100 * C.a, 'data1' from t0 A, t0 B, t0 C;
-
---echo # Lock two threads
-set autocommit=0;
-select * from t1 where pk between 10 and 20 for update;
-
-connection con1;
-set autocommit=0;
-# This will freeze
-send
-select * from t1 where pk between 10 and 20 for update;
-
-# run SHOW EXPLAIN on a frozen thread
-connection default;
-let $save_wait_condition= $wait_condition;
-let $wait_condition= select State='Sending data' from information_schema.processlist where id=$thr2;
-let $thr_default=`select connection_id()`;
---source include/wait_condition.inc
---echo # do: send_eval show explain for thr2;
---disable_query_log
-send_eval show explain for $thr2;
---enable_query_log
-
-# kill the SHOW EXPLAIN command
-connection con3;
-let $wait_condition= select State='show explain' from information_schema.processlist where id=$thr_default;
---source include/wait_condition.inc
-evalp kill query $thr_default;
-
-connection default;
---error ER_QUERY_INTERRUPTED
-reap;
-
-connection con2;
-rollback;
-
-connection con1;
-reap;
-
-drop table t1;
-disconnect con3;
-disconnect con2;
-let $wait_condition= $save_wait_condition;
-
---echo #
---echo # Check that the I_S table is invisible
---echo #
-select table_name from information_schema.tables where table_schema='information_schema' and table_name like '%explain%';
-
---echo #
---echo # MDEV-325: SHOW EXPLAIN: Plan produced by SHOW EXPLAIN is different from standard EXPLAIN: type ALL vs 'index_merge'..
---echo #
-CREATE TABLE t1 (a INT, b INT, KEY(a), KEY(b)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES
-(8,0),(128,5050),(5372,8),(234,7596),(2,0),(2907,8930),(1,0),
-(0,5224),(8,7638),(960,5),(9872,1534),(0,2295),(3408,9809),
-(7,0),(1168,0),(2089,5570),(0,205),(88,1018),(0,26528),
-(0,0),(4,5567),(1444,145),(6,0),(1,7535),(7793,534),(70,9),
-(178,1),(44,5),(189,0),(3,0);
-
-EXPLAIN
-SELECT a+SLEEP(0.01) FROM t1
-WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129
-ORDER BY b;
-
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
---send
-SELECT a+SLEEP(0.01) FROM t1
-WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129
-ORDER BY b;
-
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-
-connection con1;
-reap;
-set debug_dbug=@old_debug;
-
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_do_select';
---send
-SELECT a+SLEEP(0.01) FROM t1
-WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129
-ORDER BY b;
-
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-
-connection con1;
-reap;
-
-set debug_dbug=@old_debug;
-
-drop table t1;
-
---echo #
---echo # MDEV-298: SHOW EXPLAIN: Plan returned by SHOW EXPLAIN only contains
---echo # 'Using temporary' while the standard EXPLAIN says 'Using temporary; Using filesort'
---echo #
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),
- (10),(11),(12),(13),(14),(15),(16);
-INSERT INTO t1 SELECT t11.a FROM t1 t11, t1 t12, t1 t13;
-
-EXPLAIN SELECT a FROM t1 GROUP BY a;
-
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
---send
-SELECT a FROM t1 GROUP BY a;
-
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-
-connection con1;
-reap;
-
-set debug_dbug=@old_debug;
-
-drop table t1;
-
---echo #
---echo # MDEV-408: SHOW EXPLAIN: Some values are chopped off in SHOW EXPLAIN output
---echo #
-CREATE TABLE t1 (a INT, b VARCHAR(35)) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (3989,'Abilene'),(3873,'Akron');
-
-CREATE TABLE t2 (c INT, d VARCHAR(52) PRIMARY KEY, KEY(c)) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (86,'English'),(87,'Russian');
-
-explain SELECT SUM(a + SLEEP(0.1)) FROM t1 WHERE a IN ( SELECT c FROM t2 WHERE d < b ) OR b < 's';
-
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
---send
-SELECT SUM(a + SLEEP(0.1)) FROM t1 WHERE a IN ( SELECT c FROM t2 WHERE d < b ) OR b < 's';
-
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-
-connection con1;
-reap;
-
-set debug_dbug=@old_debug;
-drop table t1, t2;
-
---echo #
---echo # MDEV-412: SHOW EXPLAIN: Server crashes in JOIN::print_explain on a query with inner join and ORDER BY the same column twice
---echo #
-CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(3), KEY(b)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES
-(3795,'USA'),(3913,'USA'),(3846,'ITA'),(4021,'USA'),(4005,'RUS'),(4038,'USA'),
-(3825,'USA'),(3840,'USA'),(3987,'USA'),(3807,'USA'),(3896,'USA'),(4052,'USA'),
-(3973,'USA'),(3982,'ITA'),(3965,'USA'),(3852,'RUS'),(4006,'USA'),(3800,'USA'),
-(4020,'USA'),(4040,'USA'),(3916,'USA'),(3817,'USA'),(3885,'USA'),(3802,'USA'),
-(4009,'ITA'),(3895,'USA'),(3963,'RUS'),(4045,'USA'),(3988,'USA'),(3815,'USA'),
-(4063,'USA'),(3978,'USA'),(4019,'USA'),(3954,'USA'),(3950,'USA'),(3974,'ITA'),
-(4054,'USA'),(4061,'RUS'),(3976,'USA'),(3966,'USA'),(3957,'USA'),(3981,'USA'),
-(3923,'USA'),(3876,'USA'),(3819,'USA'),(3877,'USA'),(3829,'ITA'),(3964,'USA'),
-(4053,'RUS'),(3917,'USA'),(3874,'USA'),(4023,'USA'),(4001,'USA'),(3872,'USA'),
-(3890,'USA'),(3962,'USA'),(3886,'USA'),(4026,'ITA'),(3869,'USA'),(3937,'RUS'),
-(3975,'USA'),(3944,'USA'),(3908,'USA'),(3867,'USA'),(3947,'USA'),(3838,'USA'),
-(3796,'USA'),(3893,'USA'),(3920,'ITA'),(3994,'USA'),(3875,'RUS'),(4011,'USA'),
-(4013,'USA'),(3810,'USA'),(3834,'USA'),(3968,'USA'),(3931,'USA'),(3839,'USA'),
-(4042,'USA'),(4039,'ITA'),(3811,'USA'),(3837,'RUS'),(4041,'USA'),(3884,'USA'),
-(3894,'USA'),(3879,'USA'),(3942,'USA'),(3959,'USA'),(3814,'USA'),(4044,'USA'),
-(3971,'ITA'),(3823,'USA'),(3793,'RUS'),(3855,'USA'),(3905,'USA'),(3865,'USA'),
-(4046,'USA'),(3990,'USA'),(4022,'USA'),(3833,'USA'),(3918,'USA'),(4064,'ITA'),
-(3821,'USA'),(3836,'RUS'),(3921,'USA'),(3914,'USA'),(3888,'USA');
-
-CREATE TABLE t2 (c VARCHAR(3) PRIMARY KEY) ENGINE=MyISAM;
-INSERT INTO t2 VALUES ('USA');
-
-CREATE TABLE t3 (d VARCHAR(3), e VARCHAR(52), PRIMARY KEY (d,e)) ENGINE=MyISAM;
-INSERT INTO t3 VALUES
-('JPN','Japanese'),('KOR','Korean'),('POL','Polish'),('PRT','Portuguese'),
-('ESP','Spanish'),('FRA','French'),('VNM','Vietnamese');
-
-explain
-SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2;
-
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_do_select';
-
-send
-SELECT b AS field1, b AS field2 FROM t1, t2, t3 WHERE d = b ORDER BY field1, field2;
-
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-
-connection con1;
-reap;
-
-set debug_dbug=@old_debug;
-
-DROP TABLE t1,t2,t3;
-
-
---echo #
---echo # MDEV-423: SHOW EXPLAIN: 'Using where' for a subquery is shown in EXPLAIN, but not in SHOW EXPLAIN output
---echo #
-CREATE TABLE t1 (a INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (7),(0),(9),(3),(4),(2),(5),(7),(0),(9),(3),(4),(2),(5);
-
-CREATE TABLE t2 (b INT, c INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES
-(0,4),(8,6),(1,3),(8,5),(9,3),(24,246),(6,2),(1,9),(6,3),(2,8),
-(4,1),(8,8),(4,8),(4,5),(7,7),(4,5),(1,1),(9,6),(4,2),(8,9);
-
-create table t3 like t2;
-insert into t3 select * from t2;
-
-explain
-SELECT max(a+b+c) FROM t1 AS alias1, ( SELECT * FROM t2 ) AS alias
-WHERE EXISTS ( SELECT * FROM t3 WHERE b = c ) OR a <= 10;
-
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
-
-send
-SELECT max(a+b+c) FROM t1 AS alias1, ( SELECT * FROM t2 ) AS alias
-WHERE EXISTS ( SELECT * FROM t3 WHERE b = c ) OR a <= 10;
-
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-
-connection con1;
-reap;
-
-set debug_dbug=@old_debug;
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # MDEV-416: Server crashes in SQL_SELECT::cleanup on EXPLAIN with SUM ( DISTINCT ) in a non-correlated subquery (5.5-show-explain tree)
---echo #
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE TABLE t2 (b INT);
-INSERT INTO t2 VALUES (8),(9);
-
-EXPLAIN SELECT * FROM t1
-WHERE ( 8, 89 ) IN ( SELECT b, SUM( DISTINCT b ) FROM t2 GROUP BY b );
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Check if queries in non-default charsets work.
---echo #
-
-set names cp1251;
-# The below are two Russian letters with codes E3FB in cp1251 encoding.
-select charset('');
-select hex('');
-
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
-
-send
-select * from t0 where length('') = a;
-
-connection default;
-set names utf8;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-set names default;
-
-connection con1;
-# The constant should be two letters, the last looking like 'bl'
-reap;
-
-set debug_dbug=@old_debug;
-set names default;
-
---echo #
---echo # MDEV-462: SHOW EXPLAIN: Assertion `table_list->table' fails in find_field_in_table_ref if FOR contains a non-numeric value
---echo #
---error ER_SET_CONSTANTS_ONLY
-show explain for foo;
-
---echo #
---echo # MDEV-411: SHOW EXPLAIN: For dependent subquery EXPLAIN produces type=index, key, 'Using where; Using index',
---echo # while SHOW EXPLAIN says type=ALL, no key, 'Range checked for each record'
---echo #
-CREATE TABLE t1 (a INT NOT NULL, KEY(a)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (7),(0);
-
-CREATE TABLE t2 (b INT NOT NULL) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (0),(8);
-
-explain
-SELECT SUM(b) FROM ( SELECT * FROM t1 ) AS alias1, t2
-WHERE b <= ANY (
- SELECT a FROM t1
- WHERE a = b + SLEEP(0.2) OR a >= ( SELECT SUM(b) FROM t2 ));
-
-
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_join_exec_start';
-
-send
-SELECT SUM(b) FROM ( SELECT * FROM t1 ) AS alias1, t2
-WHERE b <= ANY (
- SELECT a FROM t1
- WHERE a = b + SLEEP(0.2) OR a >= ( SELECT SUM(b) FROM t2 ));
-
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-
-connection con1;
-reap;
-
-set debug_dbug=@old_debug;
-DROP TABLE t1,t2;
-drop table t0;
-
---echo #
---echo # MDEV-5148: Server crashes in print_explain on killing EXPLAIN EXTENDED
---echo #
-create table t0 (a int not null);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1 (a int, b int);
-insert into t1 select a,a from t0;
-
-create table t2 as select * from t1;
-
-set @show_explain_probe_select_id=2;
-set debug_dbug='+d,show_explain_probe_best_ext_lim_search';
-send
-explain
-select * from t0
-where not exists ( select 1 from t1, t2 where t1.b=t2.b and t2.a=t0.a) and a is null;
-
-connection default;
---source include/wait_condition.inc
-evalp kill query $thr2;
-
-connection con1;
---error ER_QUERY_INTERRUPTED
-reap;
-
-drop table t0,t1,t2;
-
---echo # End
-connection default;
-disconnect con1;
-set debug_sync='RESET';
diff --git a/mysql-test/t/show_explain_non_select.test b/mysql-test/t/show_explain_non_select.test
deleted file mode 100644
index 21b16739141..00000000000
--- a/mysql-test/t/show_explain_non_select.test
+++ /dev/null
@@ -1,78 +0,0 @@
-#
-# SHOW EXPLAIN tests for non-select subqueries
-#
---source include/have_debug.inc
---source include/have_innodb.inc
---source include/not_embedded.inc
-
---disable_warnings
-drop table if exists t0, t1;
---enable_warnings
-
-SET @old_debug= @@session.debug;
-set debug_sync='RESET';
-
-#
-# Setup two threads and their ids
-#
-let $thr1=`select connection_id()`;
-connect (con2, localhost, root,,);
-connection con2;
-let $thr2=`select connection_id()`;
-connection default;
-
-#
-# Create tables
-#
-create table t0 (a int) engine=myisam;
-insert into t0 values (1),(2),(3),(4),(5),(6),(7),(8);
-
-create table t1 (a int, b int, filler char(100), key(a), key(b));
-insert into t1
-select A.a+10*B.a + 10*C.a, A.a+10*B.a + 10*C.a, 'filler'
-from t0 A, t0 B, t0 C;
-
-let $wait_condition= select State='show_explain_trap' from information_schema.processlist where id=$thr2;
-
---echo #
---echo # Test SHOW EXPLAIN for single-table DELETE
---echo #
-connection con2;
-set debug_dbug='+d,show_explain_probe_delete_exec_start';
-send delete from t1 where a<10 and b+1>1000;
-
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-connection con2;
-reap;
-
---echo #
---echo # Test SHOW EXPLAIN for multi-table DELETE
---echo #
-set @show_explain_probe_select_id=1;
-set debug_dbug='+d,show_explain_probe_do_select';
-send delete t1 from t1, t0 where t0.a=t1.a and t1.b +1 > 1000;
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-connection con2;
-reap;
-
---echo #
---echo # Test SHOW EXPLAIN for single-table UPDATE
---echo #
-connection con2;
-set debug_dbug='+d,show_explain_probe_update_exec_start';
-send update t1 set filler='filler-data-2' where a<10 and b+1>1000;
-
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-connection con2;
-reap;
-
-drop table t0,t1;
-
-set debug_dbug=@old_debug;
-set debug_sync='RESET';
diff --git a/mysql-test/t/show_explain_ps.test b/mysql-test/t/show_explain_ps.test
deleted file mode 100644
index b43cd559e09..00000000000
--- a/mysql-test/t/show_explain_ps.test
+++ /dev/null
@@ -1,60 +0,0 @@
-#
-# Test how SHOW EXPLAIN is represented in performance schema
-#
---source include/have_debug.inc
---source include/have_perfschema.inc
-# Like all other perfschema tests, we don't work on embedded server:
---source include/not_embedded.inc
-
-# There is a query below that selects from P_S tables.
-# Remove possible history that could confuse it
-truncate table performance_schema.events_statements_history_long;
-truncate table performance_schema.events_stages_history_long;
-
---disable_warnings
-drop table if exists t0, t1;
---enable_warnings
-
-select * from performance_schema.setup_instruments where name like '%show_explain%';
-
---echo # We've got no instances
-select * from performance_schema.cond_instances where name like '%show_explain%';
-
---echo # Check out if our cond is hit.
-
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-let $thr1=`select connection_id()`;
-connect (con1, localhost, root,,);
-connection con1;
-let $thr2=`select connection_id()`;
-connection default;
-
-let $wait_condition= select State='show_explain_trap' from information_schema.processlist where id=$thr2;
-
-#
-# Test SHOW EXPLAIN for simple queries
-#
-connection con1;
-set @show_explain_probe_select_id=1;
-set debug_dbug='d,show_explain_probe_join_exec_start';
-send select count(*) from t0 where a < 100000;
-
-connection default;
---source include/wait_condition.inc
-evalp show explain for $thr2;
-connection con1;
-reap;
-
-set debug_dbug='';
-
-select event_name
-from
-performance_schema.events_stages_history_long
-where
- event_name like '%show explain' and
- thread_id in(select thread_id
- from performance_schema.events_statements_history_long
- where EVENT_NAME='statement/sql/show_explain');
-drop table t0;
diff --git a/mysql-test/t/show_function_with_pad_char_to_full_length.test b/mysql-test/t/show_function_with_pad_char_to_full_length.test
deleted file mode 100644
index f47f36294d4..00000000000
--- a/mysql-test/t/show_function_with_pad_char_to_full_length.test
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Test that show function status succeeds with
-# sql_mode = 'PAD_CHAR_TO_FULL_LENGTH (MDEV-13149)
-
-# show function status
-
-create function f() returns int return 1;
---replace_column 1 T 3 T 4 T 5 T 6 T 7 T 8 T 9 T 10 T 11 T
-show function status;
-set sql_mode = 'PAD_CHAR_TO_FULL_LENGTH';
---replace_column 1 T 3 T 4 T 5 T 6 T 7 T 8 T 9 T 10 T 11 T
-show function status;
-drop function f;
-select @@sql_mode;
-
-# select ROUTINE_NAME from information_schema.ROUTINES
-
-create function f() returns int return 1;
-select ROUTINE_NAME from information_schema.ROUTINES where ROUTINE_NAME='f';
-set sql_mode = 'PAD_CHAR_TO_FULL_LENGTH';
-select ROUTINE_NAME from information_schema.ROUTINES where ROUTINE_NAME='f';
-drop function f;
-select @@sql_mode;
diff --git a/mysql-test/t/show_grants_with_plugin-7985.test b/mysql-test/t/show_grants_with_plugin-7985.test
deleted file mode 100644
index 84f71c72667..00000000000
--- a/mysql-test/t/show_grants_with_plugin-7985.test
+++ /dev/null
@@ -1,160 +0,0 @@
---source include/not_embedded.inc
-call mtr.add_suppression("password and an authentication plugin");
-
---echo #
---echo # Create a user with mysql_native_password plugin.
---echo # The user has no password or auth_string set.
---echo #
-
-create user u1;
-GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password;
-select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
-
---echo #
---echo # The user's grants should show no password at all.
---echo #
-show grants for u1;
---echo #
---echo # Test to see if connecting with no password is succesful.
---echo #
---connect (con1, localhost, u1,,)
-show grants;
---disconnect con1
-
---connection default
---echo #
---echo # Test after flushing privileges.
---echo #
-flush privileges;
---connect (con1, localhost, u1,,)
-show grants;
---disconnect con1
-
---connection default
---echo #
---echo # Now add a mysql_native password string in authentication_string.
---echo #
-# Password string is SOMETHING
-GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password
-USING '*7AFEFD08B6B720E781FB000CAA418F54FA662626';
-select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
---echo #
---echo # Test to see if connecting with password is succesful.
---echo #
---connect (con1, localhost, u1,'SOMETHING',)
-show grants;
---disconnect con1
-
---connection default
---echo #
---echo # Test after flushing privileges.
---echo #
-flush privileges;
---connect (con1, localhost, u1,'SOMETHING',)
-show grants;
---disconnect con1
---connection default
-
---echo #
---echo # Now we also set a password for the user.
---echo #
-set password for u1 = PASSWORD('SOMETHINGELSE');
-select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
-
---echo #
---echo # Here we should use the password field, as that primes over
---echo # the authentication_string field.
---echo #
-show grants for u1;
-
---echo #
---echo # Logging in with the user's password should work.
---echo #
---connect (con1, localhost, u1,'SOMETHINGELSE',)
-show grants;
---disconnect con1
---connection default
---echo #
---echo # Reload privileges and test logging in again.
---echo #
-flush privileges;
-show grants for u1;
---echo #
---echo # Here we connect via the user's password again.
---echo #
---connect (con1, localhost, u1,'SOMETHINGELSE',)
-show grants;
---disconnect con1
---connection default
-
---echo #
---echo # Now we remove the authentication plugin password, flush privileges and
---echo # try again.
---echo #
-update mysql.user set authentication_string = '' where user='u1';
-select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
-flush privileges;
-show grants for u1;
---echo #
---echo # Here we connect via the user's password.
---echo #
---connect (con1, localhost, u1,'SOMETHINGELSE',)
-select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
---disconnect con1
---connection default
-
---echo #
---echo # Try and set a wrong auth_string password, with mysql_native_password.
---echo # Make sure it fails.
---echo #
---error ER_PASSWD_LENGTH
-GRANT USAGE ON *.* TO u1 IDENTIFIED VIA mysql_native_password USING 'asd';
---echo #
---echo # Now set a correct password.
---echo #
-GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password
-USING '*7AFEFD08B6B720E781FB000CAA418F54FA662626';
-show grants for u1;
-
---echo #
---echo # Test if the user can now use that password instead.
---echo #
---connect (con1, localhost, u1,'SOMETHING',)
-show grants;
---disconnect con1
-
---echo #
---echo # Test if the user can now use that password instead, after flushing privileges;
---echo #
---connection default
-flush privileges;
-
---connect (con1, localhost, u1,'SOMETHING',)
-show grants;
---disconnect con1
---connection default
-
---echo #
---echo # Clear all passwords from the user.
---echo #
-set password for u1 = '';
-select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
-
---echo #
---echo # Test no password connect.
---echo #
---connect (con1, localhost, u1,,)
-show grants;
---disconnect con1
---connection default
-
---echo #
---echo # Test no password connect, after flushing privileges.
---echo #
-flush privileges;
---connect (con1, localhost, u1,,)
-show grants;
---disconnect con1
---connection default
-
-drop user u1;
diff --git a/mysql-test/t/show_profile.test b/mysql-test/t/show_profile.test
deleted file mode 100644
index c20b29c40bf..00000000000
--- a/mysql-test/t/show_profile.test
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Test for show profiles
-# No meaningful check is possible.
-# So it only checks that SET profiling is possible and
-# that SHOW PROFILES, SHOW PROFILE FOR QUERY and SHOW PROFILE CPU FOR QUERY
-# do not cause syntax errors. It also increases code coverage for sql_profile.cc
-
---source include/have_profiling.inc
-SET profiling = 1;
-SELECT 1;
---replace_column 2 #
-SHOW PROFILES;
---disable_result_log
-SHOW PROFILE FOR QUERY 1;
-SHOW PROFILE CPU FOR QUERY 1;
---enable_result_log
-SET profiling = 0;
-
diff --git a/mysql-test/t/show_row_order-9226.test b/mysql-test/t/show_row_order-9226.test
deleted file mode 100644
index 06df24061ec..00000000000
--- a/mysql-test/t/show_row_order-9226.test
+++ /dev/null
@@ -1,73 +0,0 @@
-#
-# MDEV-9226 SHOW COLUMNS returns wrong column order for tables with large ENUMs
-#
-create table test_table (
- column_number_1 enum('1','2') not null,
- column_number_2 enum('1','2','3','4','5','6','7','8','9','10','11','12') not null,
- column_number_3 varchar(10) not null,
- column_number_4 varchar(10) not null,
- column_number_5 enum(
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa01',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa02',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa03',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa04',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa05',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa06',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa07',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa08',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa09',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa10',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa11',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa12',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa13',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa14',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa15',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa16',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa17',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa18',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa19',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa20',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa21',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa22',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa23',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa24',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa25',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa26',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa27',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa28',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa29',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa30',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa31',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa32',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa33',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa34',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa35',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa36',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa37',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa38',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa39',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa40',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa41',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa42',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa43',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa44',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa45',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa46',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa47',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa48',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa49',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa50',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa51',
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa52'
- ) not null,
- column_number_6 enum('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','65','66','67','68','69','70','71','72','73','74','75','76','77','78','79','80','81','82','83','84','85','86','87','88','89','90','91','92','93','94','95','96','97','98','99','100','101','102','103','104','105','106','107','108','109','110','111','112','113','114','115','116','117','118','119','120','121','122','123','124','125','126','127','128','129','130','131') not null,
- column_number_7 enum('1','2','3','4','5','6','7') not null,
- column_number_8 enum('8') not null,
- column_number_9 enum('9') not null,
- column_number_10 varchar(10) not null,
- column_number_11 enum('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49') not null
-) default charset=utf8mb4;
-# SHOW command must list columns in the table order
-# (SELECT isn't required to do it, though)
-show columns from test_table;
-drop table test_table;
diff --git a/mysql-test/t/shutdown.test b/mysql-test/t/shutdown.test
deleted file mode 100644
index e423725177b..00000000000
--- a/mysql-test/t/shutdown.test
+++ /dev/null
@@ -1,38 +0,0 @@
---source include/not_embedded.inc
-#
-# SHUTDOWN statement
-#
-create user user1@localhost;
-
-connect (c1,localhost,user1,,);
-
---error ER_SPECIFIC_ACCESS_DENIED_ERROR
-shutdown;
-
-connection default;
-disconnect c1;
---connect (c1,localhost,root,,)
-
-create procedure try_shutdown() shutdown;
-drop procedure try_shutdown;
-
---let $_server_id= `SELECT @@server_id`
---let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
---exec echo "wait" > $_expect_file_name
-
---send shutdown
---connection default
---source include/wait_until_disconnected.inc
-
---exec echo "restart" > $_expect_file_name
---enable_reconnect
---source include/wait_until_connected_again.inc
-
-drop user user1@localhost;
-
---echo #
---echo # MDEV-8491 - On shutdown, report the user and the host executed that.
---echo #
---let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err
---let SEARCH_PATTERN=mysqld(\.exe)? \(initiated by: root\[root\] @ localhost \[(::1)?\]\): Normal shutdown
---source include/search_pattern_in_file.inc
diff --git a/mysql-test/t/sighup-6580.test b/mysql-test/t/sighup-6580.test
deleted file mode 100644
index c89b3d20a0a..00000000000
--- a/mysql-test/t/sighup-6580.test
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-# MDEV-6580 Assertion `thd' failed in my_malloc_size_cb_func upon writing status report into error log
-#
-source include/not_windows.inc;
-source include/not_embedded.inc;
-let $pid=`select @@pid_file`;
-exec kill -1 `cat $pid`;
-
-select 'ok';
-
diff --git a/mysql-test/t/signal.test b/mysql-test/t/signal.test
deleted file mode 100644
index cdb5796f1da..00000000000
--- a/mysql-test/t/signal.test
+++ /dev/null
@@ -1,2687 +0,0 @@
-# Tests for SIGNAL and RESIGNAL
-
---echo #
---echo # PART 1: syntax
---echo #
-
---echo #
---echo # Test every new reserved and non reserved keywords
---echo #
-
---disable_warnings
-drop table if exists signal_non_reserved;
---enable_warnings
-
-create table signal_non_reserved (
- class_origin int,
- subclass_origin int,
- constraint_catalog int,
- constraint_schema int,
- constraint_name int,
- catalog_name int,
- schema_name int,
- table_name int,
- column_name int,
- cursor_name int,
- message_text int,
- sqlcode int
-);
-
-drop table signal_non_reserved;
-
---disable_warnings
-drop table if exists diag_non_reserved;
---enable_warnings
-
-create table diag_non_reserved (
- diagnostics int,
- current int,
- stacked int,
- exception int
-);
-
-drop table diag_non_reserved;
-
---disable_warnings
-drop table if exists diag_cond_non_reserved;
---enable_warnings
-
-create table diag_cond_non_reserved (
- condition_identifier int,
- condition_number int,
- condition_name int,
- connection_name int,
- message_length int,
- message_octet_length int,
- parameter_mode int,
- parameter_name int,
- parameter_ordinal_position int,
- returned_sqlstate int,
- routine_catalog int,
- routine_name int,
- routine_schema int,
- server_name int,
- specific_name int,
- trigger_catalog int,
- trigger_name int,
- trigger_schema int
-);
-
-drop table diag_cond_non_reserved;
-
---disable_warnings
-drop table if exists diag_stmt_non_reserved;
---enable_warnings
-
-create table diag_stmt_non_reserved (
- number int,
- more int,
- command_function int,
- command_function_code int,
- dynamic_function int,
- dynamic_function_code int,
- row_count int,
- transactions_committed int,
- transactions_rolled_back int,
- transaction_active int
-);
-
-drop table diag_stmt_non_reserved;
-
---disable_warnings
-drop table if exists test_reserved;
---enable_warnings
-
---error ER_PARSE_ERROR
-create table test_reserved (signal int);
-
---error ER_PARSE_ERROR
-create table test_reserved (resignal int);
-
---error ER_PARSE_ERROR
-create table test_reserved (condition int);
-
---echo #
---echo # Test the SIGNAL syntax
---echo #
-
---disable_warnings
-drop procedure if exists test_invalid;
-drop procedure if exists test_signal_syntax;
-drop function if exists test_signal_func;
---enable_warnings
-
-delimiter $$;
-
---error ER_PARSE_ERROR
-create procedure test_invalid()
-begin
- SIGNAL;
-end $$
-
---error ER_SP_COND_MISMATCH
-create procedure test_invalid()
-begin
- SIGNAL foo;
-end $$
-
---error ER_SIGNAL_BAD_CONDITION_TYPE
-create procedure test_invalid()
-begin
- DECLARE foo CONDITION FOR 1234;
- SIGNAL foo;
-end $$
-
-create procedure test_signal_syntax()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo;
-end $$
-drop procedure test_signal_syntax $$
-
-create procedure test_signal_syntax()
-begin
- SIGNAL SQLSTATE '23000';
-end $$
-drop procedure test_signal_syntax $$
-
-create procedure test_signal_syntax()
-begin
- SIGNAL SQLSTATE VALUE '23000';
-end $$
-drop procedure test_signal_syntax $$
-
-create procedure test_signal_syntax()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET CLASS_ORIGIN = 'foo';
-end $$
-drop procedure test_signal_syntax $$
-
-create procedure test_signal_syntax()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET SUBCLASS_ORIGIN = 'foo';
-end $$
-drop procedure test_signal_syntax $$
-
-create procedure test_signal_syntax()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET CONSTRAINT_CATALOG = 'foo';
-end $$
-drop procedure test_signal_syntax $$
-
-create procedure test_signal_syntax()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET CONSTRAINT_SCHEMA = 'foo';
-end $$
-drop procedure test_signal_syntax $$
-
-create procedure test_signal_syntax()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET CONSTRAINT_NAME = 'foo';
-end $$
-drop procedure test_signal_syntax $$
-
-create procedure test_signal_syntax()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET CATALOG_NAME = 'foo';
-end $$
-drop procedure test_signal_syntax $$
-
-create procedure test_signal_syntax()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET SCHEMA_NAME = 'foo';
-end $$
-drop procedure test_signal_syntax $$
-
-create procedure test_signal_syntax()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET TABLE_NAME = 'foo';
-end $$
-drop procedure test_signal_syntax $$
-
-create procedure test_signal_syntax()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET COLUMN_NAME = 'foo';
-end $$
-drop procedure test_signal_syntax $$
-
-create procedure test_signal_syntax()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET CURSOR_NAME = 'foo';
-end $$
-drop procedure test_signal_syntax $$
-
-create procedure test_signal_syntax()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET MESSAGE_TEXT = 'foo';
-end $$
-drop procedure test_signal_syntax $$
-
-create procedure test_signal_syntax()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET MYSQL_ERRNO = 'foo';
-end $$
-drop procedure test_signal_syntax $$
-
---error ER_DUP_SIGNAL_SET
-create procedure test_invalid()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET CLASS_ORIGIN = 'foo', CLASS_ORIGIN = 'bar';
-end $$
-
---error ER_DUP_SIGNAL_SET
-create procedure test_invalid()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET MESSAGE_TEXT = 'foo', MESSAGE_TEXT = 'bar';
-end $$
-
---error ER_DUP_SIGNAL_SET
-create procedure test_invalid()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET MYSQL_ERRNO = 'foo', MYSQL_ERRNO = 'bar';
-end $$
-
-create procedure test_signal_syntax()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET
- CLASS_ORIGIN = 'foo',
- SUBCLASS_ORIGIN = 'foo',
- CONSTRAINT_CATALOG = 'foo',
- CONSTRAINT_SCHEMA = 'foo',
- CONSTRAINT_NAME = 'foo',
- CATALOG_NAME = 'foo',
- SCHEMA_NAME = 'foo',
- TABLE_NAME = 'foo',
- COLUMN_NAME = 'foo',
- CURSOR_NAME = 'foo',
- MESSAGE_TEXT = 'foo',
- MYSQL_ERRNO = 'foo';
-end $$
-drop procedure test_signal_syntax $$
-
---error ER_SP_BAD_SQLSTATE
-SIGNAL SQLSTATE '00000' $$
-
---error ER_SP_BAD_SQLSTATE
-SIGNAL SQLSTATE '00001' $$
-
---error ER_SP_BAD_SQLSTATE
-create procedure test_invalid()
-begin
- SIGNAL SQLSTATE '00000';
-end $$
-
---error ER_SP_BAD_SQLSTATE
-create procedure test_invalid()
-begin
- SIGNAL SQLSTATE '00001';
-end $$
-
---echo #
---echo # Test conditions information that SIGNAL can not set
---echo #
-
---error ER_PARSE_ERROR
-create procedure test_invalid()
-begin
- SIGNAL SQLSTATE '12345' SET bla_bla = 'foo';
-end $$
-
---error ER_PARSE_ERROR
-create procedure test_invalid()
-begin
- SIGNAL SQLSTATE '12345' SET CONDITION_IDENTIFIER = 'foo';
-end $$
-
---error ER_PARSE_ERROR
-create procedure test_invalid()
-begin
- SIGNAL SQLSTATE '12345' SET CONDITION_NUMBER = 'foo';
-end $$
-
---error ER_PARSE_ERROR
-create procedure test_invalid()
-begin
- SIGNAL SQLSTATE '12345' SET CONNECTION_NAME = 'foo';
-end $$
-
---error ER_PARSE_ERROR
-create procedure test_invalid()
-begin
- SIGNAL SQLSTATE '12345' SET MESSAGE_LENGTH = 'foo';
-end $$
-
---error ER_PARSE_ERROR
-create procedure test_invalid()
-begin
- SIGNAL SQLSTATE '12345' SET MESSAGE_OCTET_LENGTH = 'foo';
-end $$
-
---error ER_PARSE_ERROR
-create procedure test_invalid()
-begin
- SIGNAL SQLSTATE '12345' SET PARAMETER_MODE = 'foo';
-end $$
-
---error ER_PARSE_ERROR
-create procedure test_invalid()
-begin
- SIGNAL SQLSTATE '12345' SET PARAMETER_NAME = 'foo';
-end $$
-
---error ER_PARSE_ERROR
-create procedure test_invalid()
-begin
- SIGNAL SQLSTATE '12345' SET PARAMETER_ORDINAL_POSITION = 'foo';
-end $$
-
---error ER_PARSE_ERROR
-create procedure test_invalid()
-begin
- SIGNAL SQLSTATE '12345' SET RETURNED_SQLSTATE = 'foo';
-end $$
-
---error ER_PARSE_ERROR
-create procedure test_invalid()
-begin
- SIGNAL SQLSTATE '12345' SET ROUTINE_CATALOG = 'foo';
-end $$
-
---error ER_PARSE_ERROR
-create procedure test_invalid()
-begin
- SIGNAL SQLSTATE '12345' SET ROUTINE_NAME = 'foo';
-end $$
-
---error ER_PARSE_ERROR
-create procedure test_invalid()
-begin
- SIGNAL SQLSTATE '12345' SET ROUTINE_SCHEMA = 'foo';
-end $$
-
---error ER_PARSE_ERROR
-create procedure test_invalid()
-begin
- SIGNAL SQLSTATE '12345' SET SERVER_NAME = 'foo';
-end $$
-
---error ER_PARSE_ERROR
-create procedure test_invalid()
-begin
- SIGNAL SQLSTATE '12345' SET SPECIFIC_NAME = 'foo';
-end $$
-
---error ER_PARSE_ERROR
-create procedure test_invalid()
-begin
- SIGNAL SQLSTATE '12345' SET TRIGGER_CATALOG = 'foo';
-end $$
-
---error ER_PARSE_ERROR
-create procedure test_invalid()
-begin
- SIGNAL SQLSTATE '12345' SET TRIGGER_NAME = 'foo';
-end $$
-
---error ER_PARSE_ERROR
-create procedure test_invalid()
-begin
- SIGNAL SQLSTATE '12345' SET TRIGGER_SCHEMA = 'foo';
-end $$
-
-delimiter ;$$
-
---echo #
---echo # Test the RESIGNAL syntax
---echo #
-
---disable_warnings
-drop procedure if exists test_invalid;
-drop procedure if exists test_resignal_syntax;
---enable_warnings
-
-delimiter $$;
-
---error ER_SP_COND_MISMATCH
-create procedure test_invalid()
-begin
- RESIGNAL foo;
-end $$
-
-create procedure test_resignal_syntax()
-begin
- RESIGNAL;
-end $$
-drop procedure test_resignal_syntax $$
-
---error ER_SIGNAL_BAD_CONDITION_TYPE
-create procedure test_invalid()
-begin
- DECLARE foo CONDITION FOR 1234;
- RESIGNAL foo;
-end $$
-
-create procedure test_resignal_syntax()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- RESIGNAL foo;
-end $$
-drop procedure test_resignal_syntax $$
-
-create procedure test_resignal_syntax()
-begin
- RESIGNAL SQLSTATE '23000';
-end $$
-drop procedure test_resignal_syntax $$
-
-create procedure test_resignal_syntax()
-begin
- RESIGNAL SQLSTATE VALUE '23000';
-end $$
-drop procedure test_resignal_syntax $$
-
-create procedure test_resignal_syntax()
-begin
- RESIGNAL SET CLASS_ORIGIN = 'foo';
-end $$
-drop procedure test_resignal_syntax $$
-
-create procedure test_resignal_syntax()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- RESIGNAL foo SET CLASS_ORIGIN = 'foo';
-end $$
-drop procedure test_resignal_syntax $$
-
-create procedure test_resignal_syntax()
-begin
- RESIGNAL SET SUBCLASS_ORIGIN = 'foo';
-end $$
-drop procedure test_resignal_syntax $$
-
-create procedure test_resignal_syntax()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- RESIGNAL foo SET SUBCLASS_ORIGIN = 'foo';
-end $$
-drop procedure test_resignal_syntax $$
-
-create procedure test_resignal_syntax()
-begin
- RESIGNAL SET CONSTRAINT_CATALOG = 'foo';
-end $$
-drop procedure test_resignal_syntax $$
-
-create procedure test_resignal_syntax()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- RESIGNAL foo SET CONSTRAINT_CATALOG = 'foo';
-end $$
-drop procedure test_resignal_syntax $$
-
-create procedure test_resignal_syntax()
-begin
- RESIGNAL SET CONSTRAINT_SCHEMA = 'foo';
-end $$
-drop procedure test_resignal_syntax $$
-
-create procedure test_resignal_syntax()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- RESIGNAL foo SET CONSTRAINT_SCHEMA = 'foo';
-end $$
-drop procedure test_resignal_syntax $$
-
-create procedure test_resignal_syntax()
-begin
- RESIGNAL SET CONSTRAINT_NAME = 'foo';
-end $$
-drop procedure test_resignal_syntax $$
-
-create procedure test_resignal_syntax()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- RESIGNAL foo SET CONSTRAINT_NAME = 'foo';
-end $$
-drop procedure test_resignal_syntax $$
-
-create procedure test_resignal_syntax()
-begin
- RESIGNAL SET CATALOG_NAME = 'foo';
-end $$
-drop procedure test_resignal_syntax $$
-
-create procedure test_resignal_syntax()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- RESIGNAL foo SET CATALOG_NAME = 'foo';
-end $$
-drop procedure test_resignal_syntax $$
-
-create procedure test_resignal_syntax()
-begin
- RESIGNAL SET SCHEMA_NAME = 'foo';
-end $$
-drop procedure test_resignal_syntax $$
-
-create procedure test_resignal_syntax()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- RESIGNAL foo SET SCHEMA_NAME = 'foo';
-end $$
-drop procedure test_resignal_syntax $$
-
-create procedure test_resignal_syntax()
-begin
- RESIGNAL SET TABLE_NAME = 'foo';
-end $$
-drop procedure test_resignal_syntax $$
-
-create procedure test_resignal_syntax()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- RESIGNAL foo SET TABLE_NAME = 'foo';
-end $$
-drop procedure test_resignal_syntax $$
-
-create procedure test_resignal_syntax()
-begin
- RESIGNAL SET COLUMN_NAME = 'foo';
-end $$
-drop procedure test_resignal_syntax $$
-
-create procedure test_resignal_syntax()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- RESIGNAL foo SET COLUMN_NAME = 'foo';
-end $$
-drop procedure test_resignal_syntax $$
-
-create procedure test_resignal_syntax()
-begin
- RESIGNAL SET CURSOR_NAME = 'foo';
-end $$
-drop procedure test_resignal_syntax $$
-
-create procedure test_resignal_syntax()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- RESIGNAL foo SET CURSOR_NAME = 'foo';
-end $$
-drop procedure test_resignal_syntax $$
-
-create procedure test_resignal_syntax()
-begin
- RESIGNAL SET MESSAGE_TEXT = 'foo';
-end $$
-drop procedure test_resignal_syntax $$
-
-create procedure test_resignal_syntax()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- RESIGNAL foo SET MESSAGE_TEXT = 'foo';
-end $$
-drop procedure test_resignal_syntax $$
-
-create procedure test_resignal_syntax()
-begin
- RESIGNAL SET MYSQL_ERRNO = 'foo';
-end $$
-drop procedure test_resignal_syntax $$
-
-create procedure test_resignal_syntax()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- RESIGNAL foo SET MYSQL_ERRNO = 'foo';
-end $$
-drop procedure test_resignal_syntax $$
-
---error ER_DUP_SIGNAL_SET
-create procedure test_invalid()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- RESIGNAL foo SET CLASS_ORIGIN = 'foo', CLASS_ORIGIN = 'bar';
-end $$
-
---error ER_DUP_SIGNAL_SET
-create procedure test_invalid()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- RESIGNAL foo SET MESSAGE_TEXT = 'foo', MESSAGE_TEXT = 'bar';
-end $$
-
---error ER_DUP_SIGNAL_SET
-create procedure test_invalid()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- RESIGNAL foo SET MYSQL_ERRNO = 'foo', MYSQL_ERRNO = 'bar';
-end $$
-
-create procedure test_resignal_syntax()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- RESIGNAL foo SET
- CLASS_ORIGIN = 'foo',
- SUBCLASS_ORIGIN = 'foo',
- CONSTRAINT_CATALOG = 'foo',
- CONSTRAINT_SCHEMA = 'foo',
- CONSTRAINT_NAME = 'foo',
- CATALOG_NAME = 'foo',
- SCHEMA_NAME = 'foo',
- TABLE_NAME = 'foo',
- COLUMN_NAME = 'foo',
- CURSOR_NAME = 'foo',
- MESSAGE_TEXT = 'foo';
-end $$
-drop procedure test_resignal_syntax $$
-
---error ER_SP_BAD_SQLSTATE
-create procedure test_invalid()
-begin
- RESIGNAL SQLSTATE '00000';
-end $$
-
---error ER_SP_BAD_SQLSTATE
-create procedure test_invalid()
-begin
- RESIGNAL SQLSTATE '00001';
-end $$
-
-delimiter ;$$
-
---echo #
---echo # PART 2: non preparable statements
---echo #
-
---error ER_UNSUPPORTED_PS
-prepare stmt from 'SIGNAL SQLSTATE \'23000\'';
-
---error ER_UNSUPPORTED_PS
-prepare stmt from 'RESIGNAL SQLSTATE \'23000\'';
-
---echo #
---echo # PART 3: runtime execution
---echo #
-
---disable_warnings
-drop procedure if exists test_signal;
-drop procedure if exists test_resignal;
-drop table if exists t_warn;
-drop table if exists t_cursor;
---enable_warnings
-
-# Helper tables
-create table t_warn(a integer(2));
-create table t_cursor(a integer);
-
---echo #
---echo # SIGNAL can also appear in a query
---echo #
-
---error ER_SP_COND_MISMATCH
-SIGNAL foo;
-
-SIGNAL SQLSTATE '01000';
-
---error ER_SIGNAL_NOT_FOUND
-SIGNAL SQLSTATE '02000';
-
---error ER_SIGNAL_EXCEPTION
-SIGNAL SQLSTATE '23000';
-
---error ER_SIGNAL_EXCEPTION
-SIGNAL SQLSTATE VALUE '23000';
-
---error ER_WRONG_VALUE_FOR_VAR
-SIGNAL SQLSTATE 'HY000' SET MYSQL_ERRNO = 65536;
-
---error ER_WRONG_VALUE_FOR_VAR
-SIGNAL SQLSTATE 'HY000' SET MYSQL_ERRNO = 99999;
-
---error ER_WRONG_VALUE_FOR_VAR
-SIGNAL SQLSTATE 'HY000' SET MYSQL_ERRNO = 4294967295;
-
---error ER_WRONG_VALUE_FOR_VAR
-SIGNAL SQLSTATE 'HY000' SET MYSQL_ERRNO = 0;
-
---error ER_PARSE_ERROR
-SIGNAL SQLSTATE 'HY000' SET MYSQL_ERRNO = -1;
-
---error ER_WRONG_VALUE_FOR_VAR
-SIGNAL SQLSTATE 'HY000' SET MYSQL_ERRNO = 65535;
-
---error 65534
-SIGNAL SQLSTATE 'HY000' SET MYSQL_ERRNO = 65534;
-
---echo #
---echo # RESIGNAL can also appear in a query
---echo #
-
---error ER_RESIGNAL_WITHOUT_ACTIVE_HANDLER
-RESIGNAL;
-
---error ER_SP_COND_MISMATCH
-RESIGNAL foo;
-
---error ER_RESIGNAL_WITHOUT_ACTIVE_HANDLER
-RESIGNAL SQLSTATE '12345';
-
---error ER_RESIGNAL_WITHOUT_ACTIVE_HANDLER
-RESIGNAL SQLSTATE VALUE '12345';
-
---echo #
---echo # Different kind of SIGNAL conditions
---echo #
-
-delimiter $$;
-
-create procedure test_signal()
-begin
- # max range
- DECLARE foo CONDITION FOR SQLSTATE 'AABBB';
- SIGNAL foo SET MYSQL_ERRNO = 65534;
-end $$
-
---error 65534
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- # max range
- DECLARE foo CONDITION FOR SQLSTATE 'AABBB';
- SIGNAL foo SET MYSQL_ERRNO = 65536;
-end $$
-
---error ER_WRONG_VALUE_FOR_VAR
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- # Error
- DECLARE foo CONDITION FOR SQLSTATE '99999';
- SIGNAL foo SET MYSQL_ERRNO = 9999;
-end $$
-
---error 9999
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- # warning
- DECLARE too_few_records CONDITION FOR SQLSTATE '01000';
- SIGNAL too_few_records SET MYSQL_ERRNO = 1261;
-end $$
-
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- # Not found
- DECLARE sp_fetch_no_data CONDITION FOR SQLSTATE '02000';
- SIGNAL sp_fetch_no_data SET MYSQL_ERRNO = 1329;
-end $$
-
---error ER_SP_FETCH_NO_DATA
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- # Error
- DECLARE sp_cursor_already_open CONDITION FOR SQLSTATE '24000';
- SIGNAL sp_cursor_already_open SET MYSQL_ERRNO = 1325;
-end $$
-
---error ER_SP_CURSOR_ALREADY_OPEN
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- # Severe error
- DECLARE lock_deadlock CONDITION FOR SQLSTATE '40001';
- SIGNAL lock_deadlock SET MYSQL_ERRNO = 1213;
-end $$
-
---error ER_LOCK_DEADLOCK
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- # Unknown -> error
- DECLARE foo CONDITION FOR SQLSTATE "99999";
- SIGNAL foo;
-end $$
-
---error ER_SIGNAL_EXCEPTION
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- # warning, no subclass
- DECLARE warn CONDITION FOR SQLSTATE "01000";
- SIGNAL warn;
-end $$
-
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- # warning, with subclass
- DECLARE warn CONDITION FOR SQLSTATE "01123";
- SIGNAL warn;
-end $$
-
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- # Not found, no subclass
- DECLARE not_found CONDITION FOR SQLSTATE "02000";
- SIGNAL not_found;
-end $$
-
---error ER_SIGNAL_NOT_FOUND
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- # Not found, with subclass
- DECLARE not_found CONDITION FOR SQLSTATE "02XXX";
- SIGNAL not_found;
-end $$
-
---error ER_SIGNAL_NOT_FOUND
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- # Error, no subclass
- DECLARE error CONDITION FOR SQLSTATE "12000";
- SIGNAL error;
-end $$
-
---error ER_SIGNAL_EXCEPTION
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- # Error, with subclass
- DECLARE error CONDITION FOR SQLSTATE "12ABC";
- SIGNAL error;
-end $$
-
---error ER_SIGNAL_EXCEPTION
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- # Severe error, no subclass
- DECLARE error CONDITION FOR SQLSTATE "40000";
- SIGNAL error;
-end $$
-
---error ER_SIGNAL_EXCEPTION
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- # Severe error, with subclass
- DECLARE error CONDITION FOR SQLSTATE "40001";
- SIGNAL error;
-end $$
-
---error ER_SIGNAL_EXCEPTION
-call test_signal() $$
-drop procedure test_signal $$
-
---echo #
---echo # Test the scope of condition
---echo #
-
-create procedure test_signal()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '99999';
- begin
- DECLARE foo CONDITION FOR 8888;
- end;
- SIGNAL foo SET MYSQL_ERRNO=9999; /* outer */
-end $$
-
---error 9999
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE foo CONDITION FOR 9999;
- begin
- DECLARE foo CONDITION FOR SQLSTATE '88888';
- SIGNAL foo SET MYSQL_ERRNO=8888; /* inner */
- end;
-end $$
-
---error 8888
-call test_signal() $$
-drop procedure test_signal $$
-
---echo #
---echo # Test SET MYSQL_ERRNO
---echo #
-
-create procedure test_signal()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '99999';
- SIGNAL foo SET MYSQL_ERRNO = 1111;
-end $$
-
---error 1111
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE warn CONDITION FOR SQLSTATE "01000";
- SIGNAL warn SET MYSQL_ERRNO = 1111;
-end $$
-
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE not_found CONDITION FOR SQLSTATE "02000";
- SIGNAL not_found SET MYSQL_ERRNO = 1111;
-end $$
-
---error 1111
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE error CONDITION FOR SQLSTATE "55000";
- SIGNAL error SET MYSQL_ERRNO = 1111;
-end $$
-
---error 1111
-call test_signal() $$
-drop procedure test_signal $$
-
---echo #
---echo # Test SET MESSAGE_TEXT
---echo #
-
---error ER_SIGNAL_EXCEPTION
-SIGNAL SQLSTATE '77777' SET MESSAGE_TEXT='' $$
-
-create procedure test_signal()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '77777';
- SIGNAL foo SET
- MESSAGE_TEXT = "",
- MYSQL_ERRNO=5678;
-end $$
-
---error 5678
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '99999';
- SIGNAL foo SET
- MESSAGE_TEXT = "Something bad happened",
- MYSQL_ERRNO=9999;
-end $$
-
---error 9999
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE warn CONDITION FOR SQLSTATE "01000";
- SIGNAL warn SET MESSAGE_TEXT = "Something bad happened";
-end $$
-
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE not_found CONDITION FOR SQLSTATE "02000";
- SIGNAL not_found SET MESSAGE_TEXT = "Something bad happened";
-end $$
-
---error ER_SIGNAL_NOT_FOUND
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE error CONDITION FOR SQLSTATE "55000";
- SIGNAL error SET MESSAGE_TEXT = "Something bad happened";
-end $$
-
---error ER_SIGNAL_EXCEPTION
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE something CONDITION FOR SQLSTATE "01000";
- SIGNAL something SET MESSAGE_TEXT = _utf8 "This is a UTF8 text";
-end $$
-
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE something CONDITION FOR SQLSTATE "01000";
- SIGNAL something SET MESSAGE_TEXT = "";
-end $$
-
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE warn CONDITION FOR SQLSTATE "01111";
- SIGNAL warn SET MESSAGE_TEXT = "á a";
-end $$
-
-call test_signal() $$
-show warnings $$
-drop procedure test_signal $$
-
---echo #
---echo # Test SET complex expressions
---echo #
-
-create procedure test_signal()
-begin
- DECLARE error CONDITION FOR SQLSTATE '99999';
- SIGNAL error SET
- MYSQL_ERRNO = NULL;
-end $$
-
---error ER_WRONG_VALUE_FOR_VAR
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE error CONDITION FOR SQLSTATE '99999';
- SIGNAL error SET
- CLASS_ORIGIN = NULL;
-end $$
-
---error ER_WRONG_VALUE_FOR_VAR
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE error CONDITION FOR SQLSTATE '99999';
- SIGNAL error SET
- SUBCLASS_ORIGIN = NULL;
-end $$
-
---error ER_WRONG_VALUE_FOR_VAR
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE error CONDITION FOR SQLSTATE '99999';
- SIGNAL error SET
- CONSTRAINT_CATALOG = NULL;
-end $$
-
---error ER_WRONG_VALUE_FOR_VAR
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE error CONDITION FOR SQLSTATE '99999';
- SIGNAL error SET
- CONSTRAINT_SCHEMA = NULL;
-end $$
-
---error ER_WRONG_VALUE_FOR_VAR
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE error CONDITION FOR SQLSTATE '99999';
- SIGNAL error SET
- CONSTRAINT_NAME = NULL;
-end $$
-
---error ER_WRONG_VALUE_FOR_VAR
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE error CONDITION FOR SQLSTATE '99999';
- SIGNAL error SET
- CATALOG_NAME = NULL;
-end $$
-
---error ER_WRONG_VALUE_FOR_VAR
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE error CONDITION FOR SQLSTATE '99999';
- SIGNAL error SET
- SCHEMA_NAME = NULL;
-end $$
-
---error ER_WRONG_VALUE_FOR_VAR
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE error CONDITION FOR SQLSTATE '99999';
- SIGNAL error SET
- TABLE_NAME = NULL;
-end $$
-
---error ER_WRONG_VALUE_FOR_VAR
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE error CONDITION FOR SQLSTATE '99999';
- SIGNAL error SET
- COLUMN_NAME = NULL;
-end $$
-
---error ER_WRONG_VALUE_FOR_VAR
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE error CONDITION FOR SQLSTATE '99999';
- SIGNAL error SET
- CURSOR_NAME = NULL;
-end $$
-
---error ER_WRONG_VALUE_FOR_VAR
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE error CONDITION FOR SQLSTATE '99999';
- SIGNAL error SET
- MESSAGE_TEXT = NULL;
-end $$
-
---error ER_WRONG_VALUE_FOR_VAR
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE something CONDITION FOR SQLSTATE '99999';
- DECLARE message_text VARCHAR(64) DEFAULT "Local string variable";
- DECLARE sqlcode INTEGER DEFAULT 1234;
-
- SIGNAL something SET
- MESSAGE_TEXT = message_text,
- MYSQL_ERRNO = sqlcode;
-end $$
-
---error 1234
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal(message_text VARCHAR(64), sqlcode INTEGER)
-begin
- DECLARE something CONDITION FOR SQLSTATE "12345";
-
- SIGNAL something SET
- MESSAGE_TEXT = message_text,
- MYSQL_ERRNO = sqlcode;
-end $$
-
---error ER_WRONG_VALUE_FOR_VAR
-call test_signal("Parameter string", NULL) $$
-
---error ER_WRONG_VALUE_FOR_VAR
-call test_signal(NULL, 1234) $$
-
---error 5678
-call test_signal("Parameter string", 5678) $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE something CONDITION FOR SQLSTATE "AABBB";
-
- SIGNAL something SET
- MESSAGE_TEXT = @message_text,
- MYSQL_ERRNO = @sqlcode;
-end $$
-
---error ER_WRONG_VALUE_FOR_VAR
-call test_signal() $$
-
-set @sqlcode= 12 $$
-
---error ER_WRONG_VALUE_FOR_VAR
-call test_signal() $$
-
-set @message_text= "User variable" $$
-
---error 12
-call test_signal() $$
-drop procedure test_signal $$
-
---error ER_PARSE_ERROR
-create procedure test_invalid()
-begin
- DECLARE something CONDITION FOR SQLSTATE "AABBB";
-
- SIGNAL something SET
- MESSAGE_TEXT = @message_text := 'illegal',
- MYSQL_ERRNO = @sqlcode := 1234;
-end $$
-
-create procedure test_signal()
-begin
- DECLARE aaa VARCHAR(64);
- DECLARE bbb VARCHAR(64);
- DECLARE ccc VARCHAR(64);
- DECLARE ddd VARCHAR(64);
- DECLARE eee VARCHAR(64);
- DECLARE fff VARCHAR(64);
- DECLARE ggg VARCHAR(64);
- DECLARE hhh VARCHAR(64);
- DECLARE iii VARCHAR(64);
- DECLARE jjj VARCHAR(64);
- DECLARE kkk VARCHAR(64);
-
- DECLARE warn CONDITION FOR SQLSTATE "01234";
-
- set aaa= repeat("A", 64);
- set bbb= repeat("B", 64);
- set ccc= repeat("C", 64);
- set ddd= repeat("D", 64);
- set eee= repeat("E", 64);
- set fff= repeat("F", 64);
- set ggg= repeat("G", 64);
- set hhh= repeat("H", 64);
- set iii= repeat("I", 64);
- set jjj= repeat("J", 64);
- set kkk= repeat("K", 64);
-
- SIGNAL warn SET
- CLASS_ORIGIN = aaa,
- SUBCLASS_ORIGIN = bbb,
- CONSTRAINT_CATALOG = ccc,
- CONSTRAINT_SCHEMA = ddd,
- CONSTRAINT_NAME = eee,
- CATALOG_NAME = fff,
- SCHEMA_NAME = ggg,
- TABLE_NAME = hhh,
- COLUMN_NAME = iii,
- CURSOR_NAME = jjj,
- MESSAGE_TEXT = kkk,
- MYSQL_ERRNO = 65534;
-end $$
-
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE warn CONDITION FOR SQLSTATE "01234";
-
- SIGNAL warn SET
- MYSQL_ERRNO = 999999999999999999999999999999999999999999999999999;
-end $$
-
---error ER_WRONG_VALUE_FOR_VAR
-call test_signal() $$
-drop procedure test_signal $$
-
-SET sql_mode= '' $$
-create procedure test_signal()
-begin
- DECLARE aaax VARCHAR(65);
- DECLARE bbbx VARCHAR(65);
- DECLARE cccx VARCHAR(65);
- DECLARE dddx VARCHAR(65);
- DECLARE eeex VARCHAR(65);
- DECLARE fffx VARCHAR(65);
- DECLARE gggx VARCHAR(65);
- DECLARE hhhx VARCHAR(65);
- DECLARE iiix VARCHAR(65);
- DECLARE jjjx VARCHAR(65);
- DECLARE kkkx VARCHAR(65);
- DECLARE lllx VARCHAR(129);
-
- DECLARE warn CONDITION FOR SQLSTATE "01234";
-
- set aaax= concat(repeat("A", 64), "X");
- set bbbx= concat(repeat("B", 64), "X");
- set cccx= concat(repeat("C", 64), "X");
- set dddx= concat(repeat("D", 64), "X");
- set eeex= concat(repeat("E", 64), "X");
- set fffx= concat(repeat("F", 64), "X");
- set gggx= concat(repeat("G", 64), "X");
- set hhhx= concat(repeat("H", 64), "X");
- set iiix= concat(repeat("I", 64), "X");
- set jjjx= concat(repeat("J", 64), "X");
- set kkkx= concat(repeat("K", 64), "X");
- set lllx= concat(repeat("1", 100),
- repeat("2", 20),
- repeat("8", 8),
- "X");
-
- SIGNAL warn SET
- CLASS_ORIGIN = aaax,
- SUBCLASS_ORIGIN = bbbx,
- CONSTRAINT_CATALOG = cccx,
- CONSTRAINT_SCHEMA = dddx,
- CONSTRAINT_NAME = eeex,
- CATALOG_NAME = fffx,
- SCHEMA_NAME = gggx,
- TABLE_NAME = hhhx,
- COLUMN_NAME = iiix,
- CURSOR_NAME = jjjx,
- MESSAGE_TEXT = lllx,
- MYSQL_ERRNO = 10000;
-end $$
-
-#NOTE: the warning text for ER_TRUNCATED_WRONG_VALUE contains
-# value: '%-.128s', so the warning printed truncates the value too,
-# which affects MESSAGE_TEXT (the X is missing)
-
-call test_signal() $$
-drop procedure test_signal $$
-set sql_mode = DEFAULT $$
-
-# Test that HANDLER can catch conditions raised by SIGNAL
-
-create procedure test_signal()
-begin
- DECLARE warn CONDITION FOR SQLSTATE "01234";
- DECLARE CONTINUE HANDLER for SQLSTATE "01234"
- begin
- select "Caught by SQLSTATE";
- end;
-
- SIGNAL warn SET
- MESSAGE_TEXT = "Raising a warning",
- MYSQL_ERRNO = 1012;
-end $$
-
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE warn CONDITION FOR SQLSTATE "01234";
- DECLARE CONTINUE HANDLER for 1012
- begin
- select "Caught by number";
- end;
-
- SIGNAL warn SET
- MESSAGE_TEXT = "Raising a warning",
- MYSQL_ERRNO = 1012;
-end $$
-
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE warn CONDITION FOR SQLSTATE "01234";
- DECLARE CONTINUE HANDLER for SQLWARNING
- begin
- select "Caught by SQLWARNING";
- end;
-
- SIGNAL warn SET
- MESSAGE_TEXT = "Raising a warning",
- MYSQL_ERRNO = 1012;
-end $$
-
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE not_found CONDITION FOR SQLSTATE "02ABC";
- DECLARE CONTINUE HANDLER for SQLSTATE "02ABC"
- begin
- select "Caught by SQLSTATE";
- end;
-
- SIGNAL not_found SET
- MESSAGE_TEXT = "Raising a not found",
- MYSQL_ERRNO = 1012;
-end $$
-
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE not_found CONDITION FOR SQLSTATE "02ABC";
- DECLARE CONTINUE HANDLER for 1012
- begin
- select "Caught by number";
- end;
-
- SIGNAL not_found SET
- MESSAGE_TEXT = "Raising a not found",
- MYSQL_ERRNO = 1012;
-end $$
-
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE not_found CONDITION FOR SQLSTATE "02ABC";
- DECLARE CONTINUE HANDLER for NOT FOUND
- begin
- select "Caught by NOT FOUND";
- end;
-
- SIGNAL not_found SET
- MESSAGE_TEXT = "Raising a not found",
- MYSQL_ERRNO = 1012;
-end $$
-
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE error CONDITION FOR SQLSTATE "55555";
- DECLARE CONTINUE HANDLER for SQLSTATE "55555"
- begin
- select "Caught by SQLSTATE";
- end;
-
- SIGNAL error SET
- MESSAGE_TEXT = "Raising an error",
- MYSQL_ERRNO = 1012;
-end $$
-
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE error CONDITION FOR SQLSTATE "55555";
- DECLARE CONTINUE HANDLER for 1012
- begin
- select "Caught by number";
- end;
-
- SIGNAL error SET
- MESSAGE_TEXT = "Raising an error",
- MYSQL_ERRNO = 1012;
-end $$
-
-call test_signal() $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE error CONDITION FOR SQLSTATE "55555";
- DECLARE CONTINUE HANDLER for SQLEXCEPTION
- begin
- select "Caught by SQLEXCEPTION";
- end;
-
- SIGNAL error SET
- MESSAGE_TEXT = "Raising an error",
- MYSQL_ERRNO = 1012;
-end $$
-
-call test_signal() $$
-drop procedure test_signal $$
-
---echo #
---echo # Test where SIGNAL can be used
---echo #
-
---echo
---echo # RETURN statement clears Diagnostics Area, thus
---echo # the warnings raised in a stored function are not
---echo # visible outsidef the stored function. So, we're using
---echo # @@warning_count variable to check that SIGNAL succeeded.
---echo
-
-create function test_signal_func() returns integer
-begin
- DECLARE v INT;
- DECLARE warn CONDITION FOR SQLSTATE "01XXX";
-
- SIGNAL warn SET
- MESSAGE_TEXT = "This function SIGNAL a warning",
- MYSQL_ERRNO = 1012;
-
- SELECT @@warning_count INTO v;
- return v;
-end $$
-
-select test_signal_func() $$
-drop function test_signal_func $$
-
-create function test_signal_func() returns integer
-begin
- DECLARE not_found CONDITION FOR SQLSTATE "02XXX";
-
- SIGNAL not_found SET
- MESSAGE_TEXT = "This function SIGNAL not found",
- MYSQL_ERRNO = 1012;
-
- return 5;
-end $$
-
---error 1012
-select test_signal_func() $$
-drop function test_signal_func $$
-
-create function test_signal_func() returns integer
-begin
- DECLARE error CONDITION FOR SQLSTATE "50000";
-
- SIGNAL error SET
- MESSAGE_TEXT = "This function SIGNAL an error",
- MYSQL_ERRNO = 1012;
-
- return 5;
-end $$
-
---error 1012
-select test_signal_func() $$
-drop function test_signal_func $$
-
---disable_warnings
-drop table if exists t1 $$
---enable_warnings
-
-create table t1 (a integer) $$
-
-create trigger t1_ai after insert on t1 for each row
-begin
- DECLARE msg VARCHAR(128);
- DECLARE warn CONDITION FOR SQLSTATE "01XXX";
-
- set msg= concat("This trigger SIGNAL a warning, a=", NEW.a);
- SIGNAL warn SET
- MESSAGE_TEXT = msg,
- MYSQL_ERRNO = 1012;
-end $$
-
-insert into t1 values (1), (2) $$
-
-drop trigger t1_ai $$
-
-create trigger t1_ai after insert on t1 for each row
-begin
- DECLARE msg VARCHAR(128);
- DECLARE not_found CONDITION FOR SQLSTATE "02XXX";
-
- set msg= concat("This trigger SIGNAL a not found, a=", NEW.a);
- SIGNAL not_found SET
- MESSAGE_TEXT = msg,
- MYSQL_ERRNO = 1012;
-end $$
-
---error 1012
-insert into t1 values (3), (4) $$
-
-drop trigger t1_ai $$
-
-create trigger t1_ai after insert on t1 for each row
-begin
- DECLARE msg VARCHAR(128);
- DECLARE error CONDITION FOR SQLSTATE "03XXX";
-
- set msg= concat("This trigger SIGNAL an error, a=", NEW.a);
- SIGNAL error SET
- MESSAGE_TEXT = msg,
- MYSQL_ERRNO = 1012;
-end $$
-
---error 1012
-insert into t1 values (5), (6) $$
-
-drop table t1 $$
-
-create table t1 (errno integer, msg varchar(128)) $$
-
-create trigger t1_ai after insert on t1 for each row
-begin
- DECLARE warn CONDITION FOR SQLSTATE "01XXX";
-
- SIGNAL warn SET
- MESSAGE_TEXT = NEW.msg,
- MYSQL_ERRNO = NEW.errno;
-end $$
-
-insert into t1 set errno=1012, msg='Warning message 1 in trigger' $$
-insert into t1 set errno=1013, msg='Warning message 2 in trigger' $$
-
-drop table t1 $$
-
---disable_warnings
-drop table if exists t1 $$
-drop procedure if exists p1 $$
-drop function if exists f1 $$
---enable_warnings
-
-create table t1 (s1 int) $$
-insert into t1 values (1) $$
-
-create procedure p1()
-begin
- declare a int;
- declare c cursor for select f1() from t1;
- declare continue handler for sqlstate '03000'
- select "caught 03000";
- declare continue handler for 1326
- select "caught cursor is not open";
-
- select "Before open";
- open c;
- select "Before fetch";
- fetch c into a;
- select "Before close";
- close c;
-end $$
-
-create function f1() returns int
-begin
- signal sqlstate '03000';
- return 5;
-end $$
-
-## FIXME : MEMORY plugin warning, valgrind leak, bug#36518
-## call p1() $$
-
-drop table t1 $$
-drop procedure p1 $$
-drop function f1 $$
-
---echo #
---echo # Test the RESIGNAL runtime
---echo #
-
-# 6 tests:
-# {Signaled warning, Signaled Not Found, Signaled Error,
-# warning, not found, error} --> RESIGNAL
-
-create procedure test_resignal()
-begin
- DECLARE warn CONDITION FOR SQLSTATE "01234";
- DECLARE CONTINUE HANDLER for 1012
- begin
- select "before RESIGNAL";
- RESIGNAL;
- select "after RESIGNAL";
- end;
-
- SIGNAL warn SET
- MESSAGE_TEXT = "Raising a warning",
- MYSQL_ERRNO = 1012;
-end $$
-
-call test_resignal() $$
-drop procedure test_resignal $$
-
-create procedure test_resignal()
-begin
- DECLARE not_found CONDITION FOR SQLSTATE "02222";
- DECLARE CONTINUE HANDLER for 1012
- begin
- select "before RESIGNAL";
- RESIGNAL;
- select "after RESIGNAL";
- end;
-
- SIGNAL not_found SET
- MESSAGE_TEXT = "Raising a not found",
- MYSQL_ERRNO = 1012;
-end $$
-
---error 1012
-call test_resignal() $$
-drop procedure test_resignal $$
-
-create procedure test_resignal()
-begin
- DECLARE error CONDITION FOR SQLSTATE "55555";
- DECLARE CONTINUE HANDLER for 1012
- begin
- select "before RESIGNAL";
- RESIGNAL;
- select "after RESIGNAL";
- end;
-
- SIGNAL error SET
- MESSAGE_TEXT = "Raising an error",
- MYSQL_ERRNO = 1012;
-end $$
-
---error 1012
-call test_resignal() $$
-drop procedure test_resignal $$
-
-create procedure test_resignal()
-begin
- DECLARE CONTINUE HANDLER for sqlwarning
- begin
- select "before RESIGNAL";
- RESIGNAL;
- select "after RESIGNAL";
- end;
-
- insert ignore into t_warn set a= 9999999999999999;
-end $$
-
-call test_resignal() $$
-drop procedure test_resignal $$
-
-create procedure test_resignal()
-begin
- DECLARE x integer;
- DECLARE c cursor for select * from t_cursor;
- DECLARE CONTINUE HANDLER for not found
- begin
- select "before RESIGNAL";
- RESIGNAL;
- select "after RESIGNAL";
- end;
-
- open c;
- fetch c into x;
- close c;
-end $$
-
---error ER_SP_FETCH_NO_DATA
-call test_resignal() $$
-drop procedure test_resignal $$
-
-create procedure test_resignal()
-begin
- DECLARE CONTINUE HANDLER for sqlexception
- begin
- select "before RESIGNAL";
- RESIGNAL;
- select "after RESIGNAL";
- end;
-
- drop table no_such_table;
-end $$
-
---error ER_BAD_TABLE_ERROR
-call test_resignal() $$
-drop procedure test_resignal $$
-
-# 6 tests:
-# {Signaled warning, Signaled Not Found, Signaled Error,
-# warning, not found, error} --> RESIGNAL SET ...
-
-create procedure test_resignal()
-begin
- DECLARE warn CONDITION FOR SQLSTATE "01234";
- DECLARE CONTINUE HANDLER for 1012
- begin
- select "before RESIGNAL";
- RESIGNAL SET
- MESSAGE_TEXT = "RESIGNAL of a warning",
- MYSQL_ERRNO = 5555 ;
- select "after RESIGNAL";
- end;
-
- SIGNAL warn SET
- MESSAGE_TEXT = "Raising a warning",
- MYSQL_ERRNO = 1012;
-end $$
-
-call test_resignal() $$
-drop procedure test_resignal $$
-
-create procedure test_resignal()
-begin
- DECLARE not_found CONDITION FOR SQLSTATE "02111";
- DECLARE CONTINUE HANDLER for 1012
- begin
- select "before RESIGNAL";
- RESIGNAL SET
- MESSAGE_TEXT = "RESIGNAL of a not found",
- MYSQL_ERRNO = 5555 ;
- select "after RESIGNAL";
- end;
-
- SIGNAL not_found SET
- MESSAGE_TEXT = "Raising a not found",
- MYSQL_ERRNO = 1012;
-end $$
-
---error 5555
-call test_resignal() $$
-drop procedure test_resignal $$
-
-create procedure test_resignal()
-begin
- DECLARE error CONDITION FOR SQLSTATE "33333";
- DECLARE CONTINUE HANDLER for 1012
- begin
- select "before RESIGNAL";
- RESIGNAL SET
- MESSAGE_TEXT = "RESIGNAL of an error",
- MYSQL_ERRNO = 5555 ;
- select "after RESIGNAL";
- end;
-
- SIGNAL error SET
- MESSAGE_TEXT = "Raising an error",
- MYSQL_ERRNO = 1012;
-end $$
-
---error 5555
-call test_resignal() $$
-drop procedure test_resignal $$
-
-create procedure test_resignal()
-begin
- DECLARE CONTINUE HANDLER for sqlwarning
- begin
- select "before RESIGNAL";
- RESIGNAL SET
- MESSAGE_TEXT = "RESIGNAL of a warning",
- MYSQL_ERRNO = 5555 ;
- select "after RESIGNAL";
- end;
-
- insert ignore into t_warn set a= 9999999999999999;
-end $$
-
-call test_resignal() $$
-drop procedure test_resignal $$
-
-create procedure test_resignal()
-begin
- DECLARE x integer;
- DECLARE c cursor for select * from t_cursor;
- DECLARE CONTINUE HANDLER for not found
- begin
- select "before RESIGNAL";
- RESIGNAL SET
- MESSAGE_TEXT = "RESIGNAL of not found",
- MYSQL_ERRNO = 5555 ;
- select "after RESIGNAL";
- end;
-
- open c;
- fetch c into x;
- close c;
-end $$
-
---error 5555
-call test_resignal() $$
-drop procedure test_resignal $$
-
-create procedure test_resignal()
-begin
- DECLARE CONTINUE HANDLER for sqlexception
- begin
- select "before RESIGNAL";
- RESIGNAL SET
- MESSAGE_TEXT = "RESIGNAL of an error",
- MYSQL_ERRNO = 5555 ;
- select "after RESIGNAL";
- end;
-
- drop table no_such_table;
-end $$
-
---error 5555
-call test_resignal() $$
-drop procedure test_resignal $$
-
-#########################################################
-
-# 3 tests:
-# {Signaled warning}
-# --> RESIGNAL SQLSTATE {warning, not found, error} SET ...
-
-create procedure test_resignal()
-begin
- DECLARE warn CONDITION FOR SQLSTATE "01111";
- DECLARE CONTINUE HANDLER for 1012
- begin
- select "before RESIGNAL";
- RESIGNAL SQLSTATE "01222" SET
- MESSAGE_TEXT = "RESIGNAL to warning",
- MYSQL_ERRNO = 5555 ;
- select "after RESIGNAL";
- end;
-
- SIGNAL warn SET
- MESSAGE_TEXT = "Raising a warning",
- MYSQL_ERRNO = 1012;
-end $$
-
-call test_resignal() $$
-drop procedure test_resignal $$
-
-create procedure test_resignal()
-begin
- DECLARE warn CONDITION FOR SQLSTATE "01111";
- DECLARE CONTINUE HANDLER for 1012
- begin
- select "before RESIGNAL";
- RESIGNAL SQLSTATE "02222" SET
- MESSAGE_TEXT = "RESIGNAL to not found",
- MYSQL_ERRNO = 5555 ;
- select "after RESIGNAL";
- end;
-
- SIGNAL warn SET
- MESSAGE_TEXT = "Raising a warning",
- MYSQL_ERRNO = 1012;
-end $$
-
---error 5555
-call test_resignal() $$
-show warnings $$
-drop procedure test_resignal $$
-
-create procedure test_resignal()
-begin
- DECLARE warn CONDITION FOR SQLSTATE "01111";
- DECLARE CONTINUE HANDLER for 1012
- begin
- select "before RESIGNAL";
- RESIGNAL SQLSTATE "33333" SET
- MESSAGE_TEXT = "RESIGNAL to error",
- MYSQL_ERRNO = 5555 ;
- select "after RESIGNAL";
- end;
-
- SIGNAL warn SET
- MESSAGE_TEXT = "Raising a warning",
- MYSQL_ERRNO = 1012;
-end $$
-
---error 5555
-call test_resignal() $$
-show warnings $$
-drop procedure test_resignal $$
-
-# 3 tests:
-# {Signaled not found}
-# --> RESIGNAL SQLSTATE {warning, not found, error} SET ...
-
-create procedure test_resignal()
-begin
- DECLARE not_found CONDITION FOR SQLSTATE "02ABC";
- DECLARE CONTINUE HANDLER for 1012
- begin
- select "before RESIGNAL";
- RESIGNAL SQLSTATE "01222" SET
- MESSAGE_TEXT = "RESIGNAL to warning",
- MYSQL_ERRNO = 5555 ;
- select "after RESIGNAL";
- end;
-
- SIGNAL not_found SET
- MESSAGE_TEXT = "Raising a not found",
- MYSQL_ERRNO = 1012;
-end $$
-
-call test_resignal() $$
-drop procedure test_resignal $$
-
-create procedure test_resignal()
-begin
- DECLARE not_found CONDITION FOR SQLSTATE "02ABC";
- DECLARE CONTINUE HANDLER for 1012
- begin
- select "before RESIGNAL";
- RESIGNAL SQLSTATE "02222" SET
- MESSAGE_TEXT = "RESIGNAL to not found",
- MYSQL_ERRNO = 5555 ;
- select "after RESIGNAL";
- end;
-
- SIGNAL not_found SET
- MESSAGE_TEXT = "Raising a not found",
- MYSQL_ERRNO = 1012;
-end $$
-
---error 5555
-call test_resignal() $$
-show warnings $$
-drop procedure test_resignal $$
-
-create procedure test_resignal()
-begin
- DECLARE not_found CONDITION FOR SQLSTATE "02ABC";
- DECLARE CONTINUE HANDLER for 1012
- begin
- select "before RESIGNAL";
- RESIGNAL SQLSTATE "33333" SET
- MESSAGE_TEXT = "RESIGNAL to error",
- MYSQL_ERRNO = 5555 ;
- select "after RESIGNAL";
- end;
-
- SIGNAL not_found SET
- MESSAGE_TEXT = "Raising a not found",
- MYSQL_ERRNO = 1012;
-end $$
-
---error 5555
-call test_resignal() $$
-show warnings $$
-drop procedure test_resignal $$
-
-# 3 tests:
-# {Signaled error}
-# --> RESIGNAL SQLSTATE {warning, not found, error} SET ...
-
-create procedure test_resignal()
-begin
- DECLARE error CONDITION FOR SQLSTATE "AAAAA";
- DECLARE CONTINUE HANDLER for 1012
- begin
- select "before RESIGNAL";
- RESIGNAL SQLSTATE "01222" SET
- MESSAGE_TEXT = "RESIGNAL to warning",
- MYSQL_ERRNO = 5555 ;
- select "after RESIGNAL";
- end;
-
- SIGNAL error SET
- MESSAGE_TEXT = "Raising an error",
- MYSQL_ERRNO = 1012;
-end $$
-
-call test_resignal() $$
-drop procedure test_resignal $$
-
-create procedure test_resignal()
-begin
- DECLARE error CONDITION FOR SQLSTATE "AAAAA";
- DECLARE CONTINUE HANDLER for 1012
- begin
- select "before RESIGNAL";
- RESIGNAL SQLSTATE "02222" SET
- MESSAGE_TEXT = "RESIGNAL to not found",
- MYSQL_ERRNO = 5555 ;
- select "after RESIGNAL";
- end;
-
- SIGNAL error SET
- MESSAGE_TEXT = "Raising an error",
- MYSQL_ERRNO = 1012;
-end $$
-
---error 5555
-call test_resignal() $$
-show warnings $$
-drop procedure test_resignal $$
-
-create procedure test_resignal()
-begin
- DECLARE error CONDITION FOR SQLSTATE "AAAAA";
- DECLARE CONTINUE HANDLER for 1012
- begin
- select "before RESIGNAL";
- RESIGNAL SQLSTATE "33333" SET
- MESSAGE_TEXT = "RESIGNAL to error",
- MYSQL_ERRNO = 5555 ;
- select "after RESIGNAL";
- end;
-
- SIGNAL error SET
- MESSAGE_TEXT = "Raising an error",
- MYSQL_ERRNO = 1012;
-end $$
-
---error 5555
-call test_resignal() $$
-show warnings $$
-drop procedure test_resignal $$
-
-# 3 tests:
-# {warning}
-# --> RESIGNAL SQLSTATE {warning, not found, error} SET ...
-
-create procedure test_resignal()
-begin
- DECLARE CONTINUE HANDLER for sqlwarning
- begin
- select "before RESIGNAL";
- RESIGNAL SQLSTATE "01111" SET
- MESSAGE_TEXT = "RESIGNAL to a warning",
- MYSQL_ERRNO = 5555 ;
- select "after RESIGNAL";
- end;
-
- insert ignore into t_warn set a= 9999999999999999;
-end $$
-
-call test_resignal() $$
-drop procedure test_resignal $$
-
-create procedure test_resignal()
-begin
- DECLARE CONTINUE HANDLER for sqlwarning
- begin
- select "before RESIGNAL";
- RESIGNAL SQLSTATE "02444" SET
- MESSAGE_TEXT = "RESIGNAL to a not found",
- MYSQL_ERRNO = 5555 ;
- select "after RESIGNAL";
- end;
-
- insert ignore into t_warn set a= 9999999999999999;
-end $$
-
---error 5555
-call test_resignal() $$
-show warnings $$
-drop procedure test_resignal $$
-
-create procedure test_resignal()
-begin
- DECLARE CONTINUE HANDLER for sqlwarning
- begin
- select "before RESIGNAL";
- RESIGNAL SQLSTATE "44444" SET
- MESSAGE_TEXT = "RESIGNAL to an error",
- MYSQL_ERRNO = 5555 ;
- select "after RESIGNAL";
- end;
-
- insert ignore into t_warn set a= 9999999999999999;
-end $$
-
---error 5555
-call test_resignal() $$
-show warnings $$
-drop procedure test_resignal $$
-
-# 3 tests:
-# {not found}
-# --> RESIGNAL SQLSTATE {warning, not found, error} SET ...
-
-create procedure test_resignal()
-begin
- DECLARE x integer;
- DECLARE c cursor for select * from t_cursor;
- DECLARE CONTINUE HANDLER for not found
- begin
- select "before RESIGNAL";
- RESIGNAL SQLSTATE "01111" SET
- MESSAGE_TEXT = "RESIGNAL to a warning",
- MYSQL_ERRNO = 5555 ;
- select "after RESIGNAL";
- end;
-
- open c;
- fetch c into x;
- close c;
-end $$
-
-call test_resignal() $$
-drop procedure test_resignal $$
-
-create procedure test_resignal()
-begin
- DECLARE x integer;
- DECLARE c cursor for select * from t_cursor;
- DECLARE CONTINUE HANDLER for not found
- begin
- select "before RESIGNAL";
- RESIGNAL SQLSTATE "02444" SET
- MESSAGE_TEXT = "RESIGNAL to a not found",
- MYSQL_ERRNO = 5555 ;
- select "after RESIGNAL";
- end;
-
- open c;
- fetch c into x;
- close c;
-end $$
-
---error 5555
-call test_resignal() $$
-show warnings $$
-drop procedure test_resignal $$
-
-create procedure test_resignal()
-begin
- DECLARE x integer;
- DECLARE c cursor for select * from t_cursor;
- DECLARE CONTINUE HANDLER for not found
- begin
- select "before RESIGNAL";
- RESIGNAL SQLSTATE "44444" SET
- MESSAGE_TEXT = "RESIGNAL to an error",
- MYSQL_ERRNO = 5555 ;
- select "after RESIGNAL";
- end;
-
- open c;
- fetch c into x;
- close c;
-end $$
-
---error 5555
-call test_resignal() $$
-show warnings $$
-drop procedure test_resignal $$
-
-# 3 tests:
-# {error}
-# --> RESIGNAL SQLSTATE {warning, not found, error} SET ...
-
-create procedure test_resignal()
-begin
- DECLARE CONTINUE HANDLER for sqlexception
- begin
- select "before RESIGNAL";
- RESIGNAL SQLSTATE "01111" SET
- MESSAGE_TEXT = "RESIGNAL to a warning",
- MYSQL_ERRNO = 5555 ;
- select "after RESIGNAL";
- end;
-
- drop table no_such_table;
-end $$
-
-call test_resignal() $$
-drop procedure test_resignal $$
-
-create procedure test_resignal()
-begin
- DECLARE CONTINUE HANDLER for sqlexception
- begin
- select "before RESIGNAL";
- RESIGNAL SQLSTATE "02444" SET
- MESSAGE_TEXT = "RESIGNAL to a not found",
- MYSQL_ERRNO = 5555 ;
- select "after RESIGNAL";
- end;
-
- drop table no_such_table;
-end $$
-
---error 5555
-call test_resignal() $$
-show warnings $$
-drop procedure test_resignal $$
-
-create procedure test_resignal()
-begin
- DECLARE CONTINUE HANDLER for sqlexception
- begin
- select "before RESIGNAL";
- RESIGNAL SQLSTATE "44444" SET
- MESSAGE_TEXT = "RESIGNAL to an error",
- MYSQL_ERRNO = 5555 ;
- select "after RESIGNAL";
- end;
-
- drop table no_such_table;
-end $$
-
---error 5555
-call test_resignal() $$
-show warnings $$
-drop procedure test_resignal $$
-
---echo #
---echo # More complex cases
---echo #
-
---disable_warnings
-drop procedure if exists peter_p1 $$
-drop procedure if exists peter_p2 $$
---enable_warnings
-
-CREATE PROCEDURE peter_p1 ()
-BEGIN
- DECLARE x CONDITION FOR 1231;
- DECLARE EXIT HANDLER FOR x
- BEGIN
- SELECT '2';
- RESIGNAL SET MYSQL_ERRNO = 9999;
- END;
-
- BEGIN
- DECLARE EXIT HANDLER FOR x
- BEGIN
- SELECT '1';
- RESIGNAL SET SCHEMA_NAME = 'test';
- END;
- SET @@sql_mode=NULL;
- END;
-END
-$$
-
-CREATE PROCEDURE peter_p2 ()
-BEGIN
- DECLARE x CONDITION for 9999;
- DECLARE EXIT HANDLER FOR x
- BEGIN
- SELECT '3';
- RESIGNAL SET MESSAGE_TEXT = 'Hi, I am a useless error message';
- END;
- CALL peter_p1();
-END
-$$
-
-#
-# Here, RESIGNAL only modifies the condition caught,
-# so there is only 1 condition at the end
-# The final SQLSTATE is 42000 (it comes from the error 1231),
-# since the condition attributes are preserved.
-#
---error 9999
-CALL peter_p2() $$
-show warnings $$
-
-drop procedure peter_p1 $$
-drop procedure peter_p2 $$
-
-CREATE PROCEDURE peter_p1 ()
-BEGIN
- DECLARE x CONDITION FOR SQLSTATE '42000';
- DECLARE EXIT HANDLER FOR x
- BEGIN
- SELECT '2';
- SHOW WARNINGS;
- RESIGNAL x SET MYSQL_ERRNO = 9999;
- END;
-
- BEGIN
- DECLARE EXIT HANDLER FOR x
- BEGIN
- SELECT '1';
- SHOW WARNINGS;
- RESIGNAL x SET
- SCHEMA_NAME = 'test',
- MYSQL_ERRNO= 1232;
- END;
- /* Raises ER_WRONG_VALUE_FOR_VAR : 1231, SQLSTATE 42000 */
- SET @@sql_mode=NULL;
- END;
-END
-$$
-
-CREATE PROCEDURE peter_p2 ()
-BEGIN
- DECLARE x CONDITION for SQLSTATE '42000';
- DECLARE EXIT HANDLER FOR x
- BEGIN
- SELECT '3';
- SHOW WARNINGS;
- RESIGNAL x SET
- MESSAGE_TEXT = 'Hi, I am a useless error message',
- MYSQL_ERRNO = 9999;
- END;
- CALL peter_p1();
-END
-$$
-
-#
-# Here, "RESIGNAL <condition>" create a new condition in the diagnostics
-# area, so that there are 4 conditions at the end.
-#
---error 9999
-CALL peter_p2() $$
-show warnings $$
-
-drop procedure peter_p1 $$
-drop procedure peter_p2 $$
-
-#
-# Test the value of MESSAGE_TEXT in RESIGNAL when no SET MESSAGE_TEXT clause
-# is provided (the expected result is the text from the SIGNALed condition)
-#
-
-drop procedure if exists peter_p3 $$
-
-create procedure peter_p3()
-begin
- declare continue handler for sqlexception
- resignal sqlstate '99002' set mysql_errno = 2;
-
- signal sqlstate '99001' set mysql_errno = 1, message_text = "Original";
-end $$
-
---error 2
-call peter_p3() $$
-
-# Expecting 2 conditions, both with the text "Original"
-show warnings $$
-
-drop procedure peter_p3 $$
-
-delimiter ;$$
-
-drop table t_warn;
-drop table t_cursor;
-
---echo #
---echo # Miscelaneous test cases
---echo #
-
-delimiter $$;
-
-create procedure test_signal()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET MYSQL_ERRNO = 0x12; /* 18 */
-end $$
-
--- error 18
-call test_signal $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET MYSQL_ERRNO = 0b00010010; /* 18 */
-end $$
-
--- error 18
-call test_signal $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET MYSQL_ERRNO = '65'; /* 65 */
-end $$
-
--- error 65
-call test_signal $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET MYSQL_ERRNO = 'A'; /* illegal */
-end $$
-
--- error ER_WRONG_VALUE_FOR_VAR
-call test_signal $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET MYSQL_ERRNO = "65"; /* 65 */
-end $$
-
--- error 65
-call test_signal $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET MYSQL_ERRNO = "A"; /* illegal */
-end $$
-
--- error ER_WRONG_VALUE_FOR_VAR
-call test_signal $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET MYSQL_ERRNO = `65`; /* illegal */
-end $$
-
--- error ER_BAD_FIELD_ERROR
-call test_signal $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET MYSQL_ERRNO = `A`; /* illegal */
-end $$
-
--- error ER_BAD_FIELD_ERROR
-call test_signal $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET MYSQL_ERRNO = 3.141592; /* 3 */
-end $$
-
--- error 3
-call test_signal $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET MYSQL_ERRNO = 1000,
- MESSAGE_TEXT= 0x41; /* A */
-end $$
-
--- error 1000
-call test_signal $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET MYSQL_ERRNO = 1000,
- MESSAGE_TEXT= 0b01000001; /* A */
-end $$
-
--- error 1000
-call test_signal $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET MYSQL_ERRNO = 1000,
- MESSAGE_TEXT = "Hello";
-end $$
-
--- error 1000
-call test_signal $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET MYSQL_ERRNO = 1000,
- MESSAGE_TEXT = 'Hello';
-end $$
-
--- error 1000
-call test_signal $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET MYSQL_ERRNO = 1000,
- MESSAGE_TEXT = `Hello`;
-end $$
-
--- error ER_BAD_FIELD_ERROR
-call test_signal $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
- SIGNAL foo SET MYSQL_ERRNO = 1000,
- MESSAGE_TEXT = 65.4321;
-end $$
-
--- error 1000
-call test_signal $$
-drop procedure test_signal $$
-
--- error ER_PARSE_ERROR
-create procedure test_signal()
-begin
- DECLARE céèçà foo CONDITION FOR SQLSTATE '12345';
- SIGNAL céèçà SET MYSQL_ERRNO = 1000;
-end $$
-
--- error ER_PARSE_ERROR
-create procedure test_signal()
-begin
- DECLARE "céèçà" CONDITION FOR SQLSTATE '12345';
- SIGNAL "céèçà" SET MYSQL_ERRNO = 1000;
-end $$
-
--- error ER_PARSE_ERROR
-create procedure test_signal()
-begin
- DECLARE 'céèçà' CONDITION FOR SQLSTATE '12345';
- SIGNAL 'céèçà' SET MYSQL_ERRNO = 1000;
-end $$
-
-create procedure test_signal()
-begin
- DECLARE `céèçà` CONDITION FOR SQLSTATE '12345';
- SIGNAL `céèçà` SET MYSQL_ERRNO = 1000;
-end $$
-
--- error 1000
-call test_signal $$
-drop procedure test_signal $$
-
-create procedure test_signal()
-begin
- SIGNAL SQLSTATE '77777' SET MYSQL_ERRNO = 1000, MESSAGE_TEXT='ÁÂÃÅÄ';
-end $$
-
-# Commented until WL#751 is implemented in this version
-# -- error 1000
-# call test_signal $$
-drop procedure test_signal $$
-
-delimiter ; $$
-
diff --git a/mysql-test/t/signal_code.test b/mysql-test/t/signal_code.test
deleted file mode 100644
index 6922a447c6a..00000000000
--- a/mysql-test/t/signal_code.test
+++ /dev/null
@@ -1,42 +0,0 @@
-# Tests for SIGNAL and RESIGNAL
-
--- source include/have_debug.inc
-
-use test;
-
---disable_warnings
-drop procedure if exists signal_proc;
-drop function if exists signal_func;
---enable_warnings
-
-delimiter $$;
-
-create procedure signal_proc()
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
-
- SIGNAL foo;
- SIGNAL foo SET MESSAGE_TEXT = "This is an error message";
- RESIGNAL foo;
- RESIGNAL foo SET MESSAGE_TEXT = "This is an error message";
-end $$
-
-create function signal_func() returns int
-begin
- DECLARE foo CONDITION FOR SQLSTATE '12345';
-
- SIGNAL foo;
- SIGNAL foo SET MESSAGE_TEXT = "This is an error message";
- RESIGNAL foo;
- RESIGNAL foo SET MESSAGE_TEXT = "This is an error message";
- return 0;
-end $$
-
-delimiter ;$$
-
-show procedure code signal_proc;
-drop procedure signal_proc;
-
-show function code signal_func;
-drop function signal_func;
-
diff --git a/mysql-test/t/signal_demo1.test b/mysql-test/t/signal_demo1.test
deleted file mode 100644
index 62020b8f3fd..00000000000
--- a/mysql-test/t/signal_demo1.test
+++ /dev/null
@@ -1,330 +0,0 @@
-#
-# Demonstrate how SIGNAL can be used to enforce integrity constraints.
-#
-
-# Naming:
-# - PO: Purchase Order
-# - AB: Address Book
-# - IN: Inventory
-
-# Simplified schema:
-#
-# Relation 1:
-# PO_ORDER (PK: po_id) 1:1 <---> 0:N (FK: po_id) PO_ORDER_LINE
-#
-# Relation 2:
-# IN_INVENTORY (PK: item_id) 1:1 <---> 0:N (FK: item_id) PO_ORDER_LINE
-#
-# Relation 3:
-# +--> 0:1 (PK: person_id) AB_PHYSICAL_PERSON
-# PO_ORDER (FK: cust_id) 1:1 <--|
-# +--> 0:1 (PK: company_id) AB_MORAL_PERSON
-# This is an 'arc' relationship :)
-#
-
-
---disable_warnings
-drop database if exists demo;
---enable_warnings
-
-create database demo;
-
-use demo;
-
-create table ab_physical_person (
- person_id integer,
- first_name VARCHAR(50),
- middle_initial CHAR,
- last_name VARCHAR(50),
- primary key (person_id));
-
-create table ab_moral_person (
- company_id integer,
- name VARCHAR(100),
- primary key (company_id));
-
-create table in_inventory (
- item_id integer,
- descr VARCHAR(50),
- stock integer,
- primary key (item_id));
-
-create table po_order (
- po_id integer auto_increment,
- cust_type char, /* arc relationship, see cust_id */
- cust_id integer, /* FK to ab_physical_person *OR* ab_moral_person */
- primary key (po_id));
-
-create table po_order_line (
- po_id integer, /* FK to po_order.po_id */
- line_no integer,
- item_id integer, /* FK to in_inventory.item_id */
- qty integer);
-
-delimiter $$;
-
---echo #
---echo # Schema integrity enforcement
---echo #
-
-create procedure check_pk_person(in person_type char, in id integer)
-begin
- declare x integer;
- declare msg varchar(128);
-
- /*
- Test integrity constraints for an 'arc' relationship.
- Based on 'person_type', 'id' points to either a
- physical person, or a moral person.
- */
- case person_type
- when 'P' then
- begin
- select count(person_id) from ab_physical_person
- where ab_physical_person.person_id = id
- into x;
-
- if (x != 1)
- then
- set msg= concat('No such physical person, PK:', id);
- SIGNAL SQLSTATE '45000' SET
- MESSAGE_TEXT = msg,
- MYSQL_ERRNO = 10000;
- end if;
- end;
-
- when 'M' then
- begin
- select count(company_id) from ab_moral_person
- where ab_moral_person.company_id = id
- into x;
-
- if (x != 1)
- then
- set msg= concat('No such moral person, PK:', id);
- SIGNAL SQLSTATE '45000' SET
- MESSAGE_TEXT = msg,
- MYSQL_ERRNO = 10000;
- end if;
- end;
-
- else
- begin
- set msg= concat('No such person type:', person_type);
- SIGNAL SQLSTATE '45000' SET
- MESSAGE_TEXT = msg,
- MYSQL_ERRNO = 20000;
- end;
- end case;
-end
-$$
-
-create procedure check_pk_inventory(in id integer)
-begin
- declare x integer;
- declare msg varchar(128);
-
- select count(item_id) from in_inventory
- where in_inventory.item_id = id
- into x;
-
- if (x != 1)
- then
- set msg= concat('Failed integrity constraint, table in_inventory, PK:',
- id);
- SIGNAL SQLSTATE '45000' SET
- MESSAGE_TEXT = msg,
- MYSQL_ERRNO = 10000;
- end if;
-end
-$$
-
-create procedure check_pk_order(in id integer)
-begin
- declare x integer;
- declare msg varchar(128);
-
- select count(po_id) from po_order
- where po_order.po_id = id
- into x;
-
- if (x != 1)
- then
- set msg= concat('Failed integrity constraint, table po_order, PK:', id);
- SIGNAL SQLSTATE '45000' SET
- MESSAGE_TEXT = msg,
- MYSQL_ERRNO = 10000;
- end if;
-end
-$$
-
-create trigger po_order_bi before insert on po_order
-for each row
-begin
- call check_pk_person(NEW.cust_type, NEW.cust_id);
-end
-$$
-
-create trigger po_order_bu before update on po_order
-for each row
-begin
- call check_pk_person(NEW.cust_type, NEW.cust_id);
-end
-$$
-
-create trigger po_order_line_bi before insert on po_order_line
-for each row
-begin
- call check_pk_order(NEW.po_id);
- call check_pk_inventory(NEW.item_id);
-end
-$$
-
-create trigger po_order_line_bu before update on po_order_line
-for each row
-begin
- call check_pk_order(NEW.po_id);
- call check_pk_inventory(NEW.item_id);
-end
-$$
-
---echo #
---echo # Application helpers
---echo #
-
-create procedure po_create_order(
- in p_cust_type char,
- in p_cust_id integer,
- out id integer)
-begin
- insert into po_order set cust_type = p_cust_type, cust_id = p_cust_id;
- set id = last_insert_id();
-end
-$$
-
-create procedure po_add_order_line(
- in po integer,
- in line integer,
- in item integer,
- in q integer)
-begin
- insert into po_order_line set
- po_id = po, line_no = line, item_id = item, qty = q;
-end
-$$
-
-delimiter ;$$
-
---echo #
---echo # Create sample data
---echo #
-
-insert into ab_physical_person values
- ( 1, "John", "A", "Doe"),
- ( 2, "Marry", "B", "Smith")
-;
-
-insert into ab_moral_person values
- ( 3, "ACME real estate, INC"),
- ( 4, "Local school")
-;
-
-insert into in_inventory values
- ( 100, "Table, dinner", 5),
- ( 101, "Chair", 20),
- ( 200, "Table, coffee", 3),
- ( 300, "School table", 25),
- ( 301, "School chairs", 50)
-;
-
-select * from ab_physical_person order by person_id;
-select * from ab_moral_person order by company_id;
-select * from in_inventory order by item_id;
-
---echo #
---echo # Entering an order
---echo #
-
-set @my_po = 0;
-
-/* John Doe wants 1 table and 4 chairs */
-call po_create_order("P", 1, @my_po);
-
-call po_add_order_line (@my_po, 1, 100, 1);
-call po_add_order_line (@my_po, 2, 101, 4);
-
-/* Marry Smith wants a coffee table */
-call po_create_order("P", 2, @my_po);
-
-call po_add_order_line (@my_po, 1, 200, 1);
-
---echo #
---echo # Entering bad data in an order
---echo #
-
-# There is no item 999 in in_inventory
---error 10000
-call po_add_order_line (@my_po, 1, 999, 1);
-
---echo #
---echo # Entering bad data in an unknown order
---echo #
-
-# There is no order 99 in po_order
---error 10000
-call po_add_order_line (99, 1, 100, 1);
-
---echo #
---echo # Entering an order for an unknown company
---echo #
-
-# There is no moral person of id 7
---error 10000
-call po_create_order("M", 7, @my_po);
-
---echo #
---echo # Entering an order for an unknown person type
---echo #
-
-# There is no person of type X
---error 20000
-call po_create_order("X", 1, @my_po);
-
-/* The local school wants 10 class tables and 20 chairs */
-call po_create_order("M", 4, @my_po);
-
-call po_add_order_line (@my_po, 1, 300, 10);
-call po_add_order_line (@my_po, 2, 301, 20);
-
-# Raw data
-select * from po_order;
-select * from po_order_line;
-
-# Creative reporting ...
-
-select po_id as "PO#",
- ( case cust_type
- when "P" then concat (pp.first_name,
- " ",
- pp.middle_initial,
- " ",
- pp.last_name)
- when "M" then mp.name
- end ) as "Sold to"
- from po_order po
- left join ab_physical_person pp on po.cust_id = pp.person_id
- left join ab_moral_person mp on po.cust_id = company_id
-;
-
-select po_id as "PO#",
- ol.line_no as "Line",
- ol.item_id as "Item",
- inv.descr as "Description",
- ol.qty as "Quantity"
- from po_order_line ol, in_inventory inv
- where inv.item_id = ol.item_id
- order by ol.item_id, ol.line_no;
-
-drop database demo;
-
-
diff --git a/mysql-test/t/signal_demo2.test b/mysql-test/t/signal_demo2.test
deleted file mode 100644
index 30f5cef715c..00000000000
--- a/mysql-test/t/signal_demo2.test
+++ /dev/null
@@ -1,192 +0,0 @@
-#
-# Demonstrate how RESIGNAL can be used to 'catch' and 're-throw' an error
-#
-
---disable_warnings
-drop database if exists demo;
---enable_warnings
-
-create database demo;
-
-use demo;
-
-delimiter $$;
-
-create procedure proc_top_a(p1 integer)
-begin
- ## DECLARE CONTINUE HANDLER for SQLEXCEPTION, NOT FOUND
- begin
- end;
-
- select "Starting ...";
- call proc_middle_a(p1);
- select "The end";
-end
-$$
-
-create procedure proc_middle_a(p1 integer)
-begin
- DECLARE l integer;
- # without RESIGNAL:
- # Should be: DECLARE EXIT HANDLER for SQLEXCEPTION, NOT FOUND
- DECLARE EXIT HANDLER for 1 /* not sure how to handle exceptions */
- begin
- select "Oops ... now what ?";
- end;
-
- select "In prod_middle()";
-
- create temporary table t1(a integer, b integer);
- select GET_LOCK("user_mutex", 10) into l;
-
- insert into t1 set a = p1, b = p1;
-
- call proc_bottom_a(p1);
-
- select RELEASE_LOCK("user_mutex") into l;
- drop temporary table t1;
-end
-$$
-
-create procedure proc_bottom_a(p1 integer)
-begin
- select "In proc_bottom()";
-
- if (p1 = 1) then
- begin
- select "Doing something that works ...";
- select * from t1;
- end;
- end if;
-
- if (p1 = 2) then
- begin
- select "Doing something that fail (simulate an error) ...";
- drop table no_such_table;
- end;
- end if;
-
- if (p1 = 3) then
- begin
- select "Doing something that *SHOULD* works ...";
- select * from t1;
- end;
- end if;
-
-end
-$$
-
-delimiter ;$$
-
-#
-# Code without RESIGNAL:
-# errors are apparent to the caller,
-# but there is no cleanup code,
-# so that the environment (get_lock(), temporary table) is polluted ...
-#
-call proc_top_a(1);
-
-# Expected
---error ER_BAD_TABLE_ERROR
-call proc_top_a(2);
-
-# Dirty state
---error ER_TABLE_EXISTS_ERROR
-call proc_top_a(3);
-
-# Dirty state
---error ER_TABLE_EXISTS_ERROR
-call proc_top_a(1);
-
-drop temporary table if exists t1;
-
-delimiter $$;
-
-create procedure proc_top_b(p1 integer)
-begin
- select "Starting ...";
- call proc_middle_b(p1);
- select "The end";
-end
-$$
-
-create procedure proc_middle_b(p1 integer)
-begin
- DECLARE l integer;
- DECLARE EXIT HANDLER for SQLEXCEPTION, NOT FOUND
- begin
- begin
- DECLARE CONTINUE HANDLER for SQLEXCEPTION, NOT FOUND
- begin
- /* Ignore errors from the cleanup code */
- end;
-
- select "Doing cleanup !";
- select RELEASE_LOCK("user_mutex") into l;
- drop temporary table t1;
- end;
-
- RESIGNAL;
- end;
-
- select "In prod_middle()";
-
- create temporary table t1(a integer, b integer);
- select GET_LOCK("user_mutex", 10) into l;
-
- insert into t1 set a = p1, b = p1;
-
- call proc_bottom_b(p1);
-
- select RELEASE_LOCK("user_mutex") into l;
- drop temporary table t1;
-end
-$$
-
-create procedure proc_bottom_b(p1 integer)
-begin
- select "In proc_bottom()";
-
- if (p1 = 1) then
- begin
- select "Doing something that works ...";
- select * from t1;
- end;
- end if;
-
- if (p1 = 2) then
- begin
- select "Doing something that fail (simulate an error) ...";
- drop table no_such_table;
- end;
- end if;
-
- if (p1 = 3) then
- begin
- select "Doing something that *SHOULD* works ...";
- select * from t1;
- end;
- end if;
-
-end
-$$
-
-delimiter ;$$
-
-#
-# Code with RESIGNAL:
-# errors are apparent to the caller,
-# the but cleanup code did get a chance to act ...
-#
-
-call proc_top_b(1);
-
---error ER_BAD_TABLE_ERROR
-call proc_top_b(2);
-
-call proc_top_b(3);
-
-call proc_top_b(1);
-
-drop database demo;
-
diff --git a/mysql-test/t/signal_demo3.test b/mysql-test/t/signal_demo3.test
deleted file mode 100644
index a685111c3c1..00000000000
--- a/mysql-test/t/signal_demo3.test
+++ /dev/null
@@ -1,144 +0,0 @@
-#
-# Demonstrate how RESIGNAL can be used to print a stack trace
-#
-
-# Save defaults
-
-SET @start_global_value = @@global.max_error_count;
-SELECT @start_global_value;
-SET @start_session_value = @@session.max_error_count;
-SELECT @start_session_value;
-
---disable_warnings
-drop database if exists demo;
---enable_warnings
-
-create database demo;
-
-use demo;
-
-delimiter $$;
-
-create procedure proc_1()
-begin
- declare exit handler for sqlexception
- resignal sqlstate '45000' set message_text='Oops in proc_1';
-
- call proc_2();
-end
-$$
-
-create procedure proc_2()
-begin
- declare exit handler for sqlexception
- resignal sqlstate '45000' set message_text='Oops in proc_2';
-
- call proc_3();
-end
-$$
-
-create procedure proc_3()
-begin
- declare exit handler for sqlexception
- resignal sqlstate '45000' set message_text='Oops in proc_3';
-
- call proc_4();
-end
-$$
-
-create procedure proc_4()
-begin
- declare exit handler for sqlexception
- resignal sqlstate '45000' set message_text='Oops in proc_4';
-
- call proc_5();
-end
-$$
-
-create procedure proc_5()
-begin
- declare exit handler for sqlexception
- resignal sqlstate '45000' set message_text='Oops in proc_5';
-
- call proc_6();
-end
-$$
-
-create procedure proc_6()
-begin
- declare exit handler for sqlexception
- resignal sqlstate '45000' set message_text='Oops in proc_6';
-
- call proc_7();
-end
-$$
-
-create procedure proc_7()
-begin
- declare exit handler for sqlexception
- resignal sqlstate '45000' set message_text='Oops in proc_7';
-
- call proc_8();
-end
-$$
-
-create procedure proc_8()
-begin
- declare exit handler for sqlexception
- resignal sqlstate '45000' set message_text='Oops in proc_8';
-
- call proc_9();
-end
-$$
-
-create procedure proc_9()
-begin
- declare exit handler for sqlexception
- resignal sqlstate '45000' set message_text='Oops in proc_9';
-
- ## Do something that fails, to see how errors are reported
- drop table oops_it_is_not_here;
-end
-$$
-
-delimiter ;$$
-
--- error ER_SIGNAL_EXCEPTION
-call proc_1();
-
-# This is the interesting part:
-# the complete call stack from the origin of failure (proc_9)
-# to the top level caller (proc_1) is available ...
-
-show warnings;
-
-SET @@session.max_error_count = 5;
-SELECT @@session.max_error_count;
-
--- error ER_SIGNAL_EXCEPTION
-call proc_1();
-show warnings;
-
-SET @@session.max_error_count = 7;
-SELECT @@session.max_error_count;
-
--- error ER_SIGNAL_EXCEPTION
-call proc_1();
-show warnings;
-
-SET @@session.max_error_count = 9;
-SELECT @@session.max_error_count;
-
--- error ER_SIGNAL_EXCEPTION
-call proc_1();
-show warnings;
-
-drop database demo;
-
-# Restore defaults
-
-SET @@global.max_error_count = @start_global_value;
-SELECT @@global.max_error_count;
-SET @@session.max_error_count = @start_session_value;
-SELECT @@session.max_error_count;
-
diff --git a/mysql-test/t/signal_sqlmode.test b/mysql-test/t/signal_sqlmode.test
deleted file mode 100644
index 2b311fd1ab1..00000000000
--- a/mysql-test/t/signal_sqlmode.test
+++ /dev/null
@@ -1,108 +0,0 @@
-# Tests for SIGNAL, RESIGNAL and GET DIAGNOSTICS
-
-SET @save_sql_mode=@@sql_mode;
-
-SET sql_mode='';
-
---disable_warnings
-drop procedure if exists p;
-drop procedure if exists p2;
-drop procedure if exists p3;
---enable_warnings
-
-delimiter $$;
-
-create procedure p()
-begin
- declare utf8_var VARCHAR(128) CHARACTER SET UTF8;
- set utf8_var = concat(repeat('A', 128), 'X');
- select length(utf8_var), utf8_var;
-end
-$$
-
-create procedure p2()
-begin
- declare msg VARCHAR(129) CHARACTER SET UTF8;
- set msg = concat(repeat('A', 128), 'X');
- select length(msg), msg;
-
- signal sqlstate '55555' set message_text = msg;
-end
-$$
-
-create procedure p3()
-begin
- declare name VARCHAR(65) CHARACTER SET UTF8;
- set name = concat(repeat('A', 64), 'X');
- select length(name), name;
-
- signal sqlstate '55555' set
- message_text = 'Message',
- table_name = name;
-end
-$$
-delimiter ;$$
-
-call p;
-
---error ER_SIGNAL_EXCEPTION
-call p2;
-
---error ER_SIGNAL_EXCEPTION
-call p3;
-
-drop procedure p;
-drop procedure p2;
-drop procedure p3;
-
-SET sql_mode='STRICT_ALL_TABLES';
-
-delimiter $$;
-
-create procedure p()
-begin
- declare utf8_var VARCHAR(128) CHARACTER SET UTF8;
- set utf8_var = concat(repeat('A', 128), 'X');
- select length(utf8_var), utf8_var;
-end
-$$
-
-create procedure p2()
-begin
- declare msg VARCHAR(129) CHARACTER SET UTF8;
- set msg = concat(repeat('A', 128), 'X');
- select length(msg), msg;
-
- signal sqlstate '55555' set message_text = msg;
-end
-$$
-
-create procedure p3()
-begin
- declare name VARCHAR(65) CHARACTER SET UTF8;
- set name = concat(repeat('A', 64), 'X');
- select length(name), name;
-
- signal sqlstate '55555' set
- message_text = 'Message',
- table_name = name;
-end
-$$
-
-delimiter ;$$
-
---error ER_DATA_TOO_LONG
-call p;
-
---error ER_COND_ITEM_TOO_LONG
-call p2;
-
---error ER_COND_ITEM_TOO_LONG
-call p3;
-
-drop procedure p;
-drop procedure p2;
-drop procedure p3;
-
-SET @@sql_mode=@save_sql_mode;
-
diff --git a/mysql-test/t/simultaneous_assignment.test b/mysql-test/t/simultaneous_assignment.test
deleted file mode 100644
index a21e33346d6..00000000000
--- a/mysql-test/t/simultaneous_assignment.test
+++ /dev/null
@@ -1,204 +0,0 @@
--- source include/have_innodb.inc
-SET sql_mode='STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,SIMULTANEOUS_ASSIGNMENT';
-
---echo #
---echo # MDEV-13417 UPDATE produces wrong values if an UPDATEd column is later used as an UPDATE source
---echo #
-
-CREATE TABLE t1 (c1 INTEGER, c2 INTEGER, c3 INTEGER) ENGINE=InnoDb;
-INSERT INTO t1(c1,c2,c3) VALUES (1,1,1);
-CREATE TABLE t2 (c1 INTEGER, c2 INTEGER, c3 INTEGER) ENGINE=InnoDb;
-INSERT INTO t2(c1,c2,c3) VALUES (1,1,1);
-
---echo #
---echo # Check that a column is only updated once.
---echo #
-
---error ER_UPDATED_COLUMN_ONLY_ONCE
-UPDATE t1
- SET c1 = 1,
- c1 = 2;
-
---error ER_UPDATED_COLUMN_ONLY_ONCE
-UPDATE t1, t2
- SET t1.c1 = t1.c1 + 1,
- t1.c2 = t1.c1 + 1,
- t2.c2 = t1.c2 + 1,
- t2.c2 = t1.c2 + 1;
-
---echo #
---echo # Check standard update
---echo #
-
-UPDATE t1
- SET c1 = c1+1,
- c2 = c1+1,
- c3 = c2+1
- WHERE c1=10;
-
-START TRANSACTION;
-UPDATE t1
- SET c1 = c1+1,
- c2 = c1+1,
- c3 = c2+1;
-SELECT * FROM t1;
-ROLLBACK;
-
---echo #
---echo # Check update through a single view
---echo #
-
-CREATE VIEW v1 (a, b) AS SELECT c1, c2 FROM t1;
---error ER_UPDATED_COLUMN_ONLY_ONCE
-UPDATE v1
- SET a = 10,
- a = b+1;
-SELECT * FROM t1;
-DROP VIEW v1;
-
-CREATE VIEW v1 (a, b) AS SELECT c2, c2 FROM t1;
---error ER_UPDATED_COLUMN_ONLY_ONCE
-UPDATE v1
- SET a = 10,
- b = 20;
-SELECT * FROM t1;
-DROP VIEW v1;
-
---echo #
---echo # Check update through a multi table view
---echo #
-
-CREATE VIEW v1 (a, b) AS SELECT t1.c1, t2.c1 FROM t1, t2 WHERE t1.c1=t2.c1;
---error ER_VIEW_MULTIUPDATE
-UPDATE v1
- SET a = 10,
- b = 20;
-
-START TRANSACTION;
-UPDATE v1
- SET a = 10;
-ROLLBACK;
-
---error ER_UPDATED_COLUMN_ONLY_ONCE
-UPDATE v1
- SET a = 10,
- a = a + 1;
-DROP VIEW v1;
-
---echo #
---echo # Check multi update
---echo #
-
-START TRANSACTION;
-UPDATE t1, t2
- SET t1.c1 = t1.c1 + 1,
- t1.c2 = t1.c1 + 1,
- t2.c2 = t1.c2 + 1,
- t2.c3 = t2.c2 + 1
-WHERE t1.c1=t2.c1;
-SELECT * FROM t1;
-SELECT * FROM t2;
-ROLLBACK;
-
-DELIMITER /;
-CREATE TRIGGER tr1 BEFORE UPDATE ON t1 FOR EACH ROW
-BEGIN
- INSERT INTO t2 VALUES(10+old.c1,10+old.c2,10+old.c3);
- INSERT INTO t2 VALUES(20+new.c1,10+new.c2,10+new.c3);
-END;
-/
-DELIMITER ;/
-START TRANSACTION;
-UPDATE t1
- SET c1 = c1+1,
- c2 = c1+1,
- c3 = c2+1;
-SELECT * FROM t1;
-SELECT * FROM t2;
-ROLLBACK;
-
-DROP TABLE t1;
-DROP TABLE t2;
-
---echo #
---echo # Check update fired by INSERT ... ON DUPLICATE KEY UPDATE
---echo #
-
-CREATE TABLE t1 (
- id INT(11) NOT NULL AUTO_INCREMENT,
- name VARCHAR(60) NOT NULL,
- nb_visits INT NOT NULL,
- nb_visits_prev INT NOT NULL default 0,
- PRIMARY KEY (id),
- UNIQUE KEY name (name)
-) ENGINE=InnoDB AUTO_INCREMENT=1;
-
-INSERT INTO t1(name, nb_visits) VALUES('nico', 1)
- ON DUPLICATE KEY UPDATE nb_visits = nb_visits + 1;
-SELECT * FROM t1;
-INSERT INTO t1(name, nb_visits) VALUES('nico', 1)
- ON DUPLICATE KEY UPDATE nb_visits = nb_visits + 1, nb_visits_prev=nb_visits;
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Update table with virtual column
---echo #
-
-CREATE TABLE t1 (c1 INTEGER, c2 INTEGER, c3 INTEGER AS (c1 MOD 10) VIRTUAL, c4 INTEGER AS (c1+c2 MOD 5) PERSISTENT ) ENGINE=InnoDb;
-INSERT INTO t1(c1,c2) VALUES (1,1);
-
-SELECT * FROM t1;
-UPDATE t1 SET c2 = 10, c1 = c2;
-SELECT * FROM t1;
-UPDATE t1 SET c2 = 4, c1 = c2;
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Update dynamic column
---echo #
-SET @@local.character_set_connection='latin1';
-CREATE TABLE assets (
- item_name VARCHAR(32) PRIMARY KEY,
- dynamic_col1 BLOB,
- dynamic_col2 BLOB
-);
-
-INSERT INTO assets VALUES ('Thinkpad Laptop', COLUMN_CREATE('color', 'black', 'price', 500),COLUMN_CREATE('CPU', 'Core I7', 'memory', '8Go'));
-INSERT INTO assets VALUES ('Thinkpad Laptop2', COLUMN_CREATE('color', 'yellow', 'price', 700),COLUMN_CREATE('CPU', 'Core I7', 'memory', '16Go'));
-SELECT item_name, COLUMN_GET(dynamic_col1, 'color' as char) AS color1,
- COLUMN_GET(dynamic_col2, 'color' as char) AS color2
- FROM assets;
-UPDATE assets
- SET dynamic_col1=COLUMN_ADD(dynamic_col1, 'warranty', '3 years'),
- dynamic_col2=dynamic_col1
- WHERE item_name LIKE 'Thinkpad Laptop%';
-
-SELECT item_name, COLUMN_GET(dynamic_col1, 'warranty' as char) AS waranty1,
- COLUMN_GET(dynamic_col2, 'warranty' as char) AS waranty2,
- COLUMN_GET(dynamic_col2, 'color' as char) AS color2
- FROM assets;
-
-DROP TABLE assets;
-
---echo #
---echo # Update TEXT column
---echo #
-
-CREATE TABLE ft2(copy TEXT,copy2 TEXT,FULLTEXT(copy)) ENGINE=MyISAM;
-INSERT INTO ft2(copy) VALUES
- ('MySQL vs MariaDB database'),
- ('Oracle vs MariaDB database'),
- ('PostgreSQL vs MariaDB database'),
- ('MariaDB overview'),
- ('Foreign keys'),
- ('Primary keys'),
- ('Indexes'),
- ('Transactions'),
- ('Triggers');
-SELECT * FROM ft2;
-UPDATE ft2 SET copy = UPPER(copy),
- copy2= copy;
-SELECT * FROM ft2;
-DROP TABLE ft2;
diff --git a/mysql-test/t/single_delete_update.test b/mysql-test/t/single_delete_update.test
deleted file mode 100644
index ec939641ea3..00000000000
--- a/mysql-test/t/single_delete_update.test
+++ /dev/null
@@ -1,454 +0,0 @@
-#
-# Single table specific update/delete tests (mysql_update and mysql_delete)
-#
-
---echo #
---echo # Bug #30584: delete with order by and limit clauses does not use
---echo # limit efficiently
---echo #
-
-CREATE TABLE t1 (i INT);
-INSERT INTO t1 VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19),
- (20),(21),(22),(23),(24),(25);
-
-CREATE TABLE t2(a INT, i INT PRIMARY KEY);
-INSERT INTO t2 (i) SELECT i FROM t1;
-
-FLUSH STATUS;
-SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-
-FLUSH STATUS;
-DELETE FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i;
-
-DROP TABLE t2;
-
---echo #
---echo # index on field prefix:
---echo #
-
-CREATE TABLE t2(a INT, i CHAR(2), INDEX(i(1)));
-INSERT INTO t2 (i) SELECT i FROM t1;
-
-FLUSH STATUS;
-SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-
-FLUSH STATUS;
-DELETE FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i;
-
-DROP TABLE t2;
-
---echo #
---echo # constant inside ORDER BY list, should use filesort
---echo # on a small table
---echo #
-
-CREATE TABLE t2(a INT, b INT, c INT, d INT, INDEX(a, b, c));
-INSERT INTO t2 (a, b, c) SELECT i, i, i FROM t1;
-
-FLUSH STATUS;
-SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-
-let $cnt = `SELECT COUNT(*) FROM t2 WHERE b = 10`;
-
-FLUSH STATUS;
-DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
---echo ## should be 5 (previous LIMIT)
-eval SELECT $cnt - COUNT(*) FROM t2 WHERE b = 10;
-
-DROP TABLE t2;
-
---echo #
---echo # same test as above (constant inside ORDER BY list), but with
---echo # a larger table - should not use filesort
---echo #
-
-CREATE TABLE t2(a INT, b INT, c INT, d INT, INDEX(a, b, c));
-INSERT INTO t2 (a, b, c) SELECT i, i, i FROM t1;
-
-INSERT INTO t2 (a, b, c) SELECT t1.i, t1.i, t1.i FROM t1, t1 x1, t1 x2;
-
-FLUSH STATUS;
-SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-
-let $cnt = `SELECT COUNT(*) FROM t2 WHERE b = 10`;
-
-FLUSH STATUS;
-DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
---echo ## should be 5 (previous LIMIT)
-eval SELECT $cnt - COUNT(*) FROM t2 WHERE b = 10;
-
-DROP TABLE t2;
-
---echo #
---echo # as above + partial index, should use filesort
---echo #
-
-CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), d CHAR(2), INDEX (a,b(1),c));
-INSERT INTO t2 SELECT i, i, i, i FROM t1;
-
-FLUSH STATUS;
-SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-
-FLUSH STATUS;
-DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-SELECT * FROM t2 WHERE b = 10 ORDER BY a, c;
-
-DROP TABLE t2;
-
---echo #
---echo # as above but index is without HA_READ_ORDER flag, should use filesort
---echo #
-
-CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), d CHAR(2), INDEX (a,b,c)) ENGINE=HEAP;
-INSERT INTO t2 SELECT i, i, i, i FROM t1;
-
-FLUSH STATUS;
-SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-
-FLUSH STATUS;
-DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-SELECT * FROM t2 WHERE b = 10 ORDER BY a, c;
-
-DROP TABLE t2;
-
---echo #
---echo # quick select is Index Merge, should use filesort
---echo #
-
-CREATE TABLE t2 (i INT, key1 INT, key2 INT, INDEX (key1), INDEX (key2));
-INSERT INTO t2 (key1, key2) SELECT i, i FROM t1;
-
-FLUSH STATUS;
-SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
---replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x
-EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
-
-FLUSH STATUS;
-DELETE FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
---replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x
-EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
-DROP TABLE t2;
-
---echo #
---echo # reverse quick select, should not use filesort
---echo #
-
-CREATE TABLE t2(a INT, i INT PRIMARY KEY);
-INSERT INTO t2 (i) SELECT i FROM t1;
-
-FLUSH STATUS;
-SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-
-FLUSH STATUS;
-DELETE FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i;
-
-DROP TABLE t2;
-
---echo #
---echo # mixed sorting direction, should use filesort
---echo #
-
-CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), INDEX (a, b));
-INSERT INTO t2 SELECT i, i, i FROM t1;
-
-FLUSH STATUS;
-SELECT * FROM t2 ORDER BY a, b DESC LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-
-FLUSH STATUS;
-DELETE FROM t2 ORDER BY a, b DESC LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-SELECT * FROM t2 ORDER BY a, b DESC;
-
-DROP TABLE t2;
-
---echo #
---echo # LIMIT with no WHERE and DESC direction, should not use filesort
---echo #
-
-CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), INDEX (a, b));
-INSERT INTO t2 (a, b) SELECT i, i FROM t1;
-INSERT INTO t2 (a, b) SELECT t1.i, t1.i FROM t1, t1 x1, t1 x2;
-
-FLUSH STATUS;
-SELECT * FROM t2 ORDER BY a, b LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-
-FLUSH STATUS;
-SELECT * FROM t2 ORDER BY a DESC, b DESC LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-
-FLUSH STATUS;
-DELETE FROM t2 ORDER BY a DESC, b DESC LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-SELECT * FROM t2 WHERE c = 10 ORDER BY a DESC, b DESC;
-
-DROP TABLE t1, t2;
-
-
---echo #
---echo # Bug #36569: UPDATE ... WHERE ... ORDER BY... always does a filesort
---echo # even if not required
---echo #
-
-CREATE TABLE t1 (i INT);
-INSERT INTO t1 VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19),
- (20),(21),(22),(23),(24),(25);
-
-CREATE TABLE t2(a INT, i INT PRIMARY KEY);
-INSERT INTO t2 (i) SELECT i FROM t1;
-
-FLUSH STATUS;
-SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-
-FLUSH STATUS;
-UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i;
-
-DROP TABLE t2;
-
---echo #
---echo # index on field prefix:
---echo #
-
-CREATE TABLE t2(a INT, i CHAR(2), INDEX(i(1)));
-INSERT INTO t2 (i) SELECT i FROM t1;
-
-FLUSH STATUS;
-SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-
-FLUSH STATUS;
-UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i;
-
-DROP TABLE t2;
-
---echo #
---echo # constant inside ORDER BY list, should use filesort
---echo # on a small table
---echo #
-
-CREATE TABLE t2(a INT, b INT, c INT, d INT, INDEX(a, b, c));
-INSERT INTO t2 (a, b, c) SELECT i, i, i FROM t1;
-
-FLUSH STATUS;
-SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-
-let $cnt = `SELECT COUNT(*) FROM t2 WHERE b = 10`;
-
-FLUSH STATUS;
-UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
---echo ## should be 5 (previous LIMIT)
-SELECT COUNT(*) FROM t2 WHERE b = 10 AND d = 10 ORDER BY a, c;
-
-DROP TABLE t2;
-
---echo #
---echo # same test as above (constant inside ORDER BY list), but with
---echo # a larger table - should not use filesort
---echo #
-
-CREATE TABLE t2(a INT, b INT, c INT, d INT, INDEX(a, b, c));
-INSERT INTO t2 (a, b, c) SELECT i, i, i FROM t1;
-
-INSERT INTO t2 (a, b, c) SELECT t1.i, t1.i, t1.i FROM t1, t1 x1, t1 x2;
-
-FLUSH STATUS;
-SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-
-let $cnt = `SELECT COUNT(*) FROM t2 WHERE b = 10`;
-
-FLUSH STATUS;
-UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
---echo ## should be 5 (previous LIMIT)
-SELECT COUNT(*) FROM t2 WHERE b = 10 AND d = 10 ORDER BY a, c;
-
-DROP TABLE t2;
-
---echo #
---echo # as above + partial index, should use filesort
---echo #
-
-CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), d CHAR(2), INDEX (a,b(1),c));
-INSERT INTO t2 SELECT i, i, i, i FROM t1;
-
-FLUSH STATUS;
-SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-
-FLUSH STATUS;
-UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-SELECT * FROM t2 WHERE b = 10 ORDER BY a, c;
-
-DROP TABLE t2;
-
---echo #
---echo # as above but index is without HA_READ_ORDER flag, should use filesort
---echo #
-
-CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), d CHAR(2), INDEX (a,b,c)) ENGINE=HEAP;
-INSERT INTO t2 SELECT i, i, i, i FROM t1;
-
-FLUSH STATUS;
-SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-
-FLUSH STATUS;
-UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-SELECT * FROM t2 WHERE b = 10 ORDER BY a, c;
-
-DROP TABLE t2;
-
---echo #
---echo # quick select is Index Merge, should use filesort
---echo #
-
-CREATE TABLE t2 (i INT, key1 INT, key2 INT, INDEX (key1), INDEX (key2));
-INSERT INTO t2 (key1, key2) SELECT i, i FROM t1;
-
-FLUSH STATUS;
-SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
---replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x
-EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
-
-FLUSH STATUS;
-UPDATE t2 SET i = 123 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
---replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x
-EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1;
-
-DROP TABLE t2;
-
---echo #
---echo # reverse quick select, should not use filesort
---echo #
-
-CREATE TABLE t2(a INT, i INT PRIMARY KEY);
-INSERT INTO t2 (i) SELECT i FROM t1;
-
-FLUSH STATUS;
-SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-
-FLUSH STATUS;
-UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i;
-
-DROP TABLE t2;
-
---echo #
---echo # mixed sorting direction, should use filesort
---echo #
-
-CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), INDEX (a, b));
-INSERT INTO t2 SELECT i, i, i FROM t1;
-
-FLUSH STATUS;
-SELECT * FROM t2 ORDER BY a, b DESC LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-
-FLUSH STATUS;
-UPDATE t2 SET c = 10 ORDER BY a, b DESC LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-SELECT * FROM t2 WHERE c = 10 ORDER BY a, b DESC;
-
-DROP TABLE t2;
-
---echo #
---echo # LIMIT with no WHERE and DESC direction, should not use filesort
---echo #
-
-CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), INDEX (a, b));
-INSERT INTO t2 (a, b) SELECT i, i FROM t1;
-INSERT INTO t2 (a, b) SELECT t1.i, t1.i FROM t1, t1 x1, t1 x2;
-
-FLUSH STATUS;
-SELECT * FROM t2 ORDER BY a, b LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-
-FLUSH STATUS;
-SELECT * FROM t2 ORDER BY a DESC, b DESC LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-
-FLUSH STATUS;
-UPDATE t2 SET c = 10 ORDER BY a DESC, b DESC LIMIT 5;
-SHOW SESSION STATUS LIKE 'Sort%';
-SHOW STATUS LIKE 'Handler_read_%';
-SELECT * FROM t2 WHERE c = 10 ORDER BY a DESC, b DESC;
-
-DROP TABLE t1, t2;
-
diff --git a/mysql-test/t/single_delete_update_innodb.test b/mysql-test/t/single_delete_update_innodb.test
deleted file mode 100644
index 7e7817d4dd6..00000000000
--- a/mysql-test/t/single_delete_update_innodb.test
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Single table specific update/delete tests (mysql_update and mysql_delete)
-#
---source include/have_innodb.inc
-
-
---echo #
---echo # Bug #53742: UPDATEs have no effect after applying patch for bug 36569
---echo #
-
-CREATE TABLE t1 (
- pk INT NOT NULL AUTO_INCREMENT,
- c1_idx CHAR(1) DEFAULT 'y',
- c2 INT,
- PRIMARY KEY (pk),
- INDEX c1_idx (c1_idx)
-) ENGINE=InnoDB;
-
-INSERT INTO t1 VALUES (), (), (), ();
-
-SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
-UPDATE t1 SET c2 = 0 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
-SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
-SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC;
-
-DELETE FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2;
-SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC;
-
-DROP TABLE t1;
-
diff --git a/mysql-test/t/skip_grants-master.opt b/mysql-test/t/skip_grants-master.opt
deleted file mode 100644
index 5699a3387b8..00000000000
--- a/mysql-test/t/skip_grants-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---skip-grant-tables
diff --git a/mysql-test/t/skip_grants.test b/mysql-test/t/skip_grants.test
deleted file mode 100644
index 5f79404e7e4..00000000000
--- a/mysql-test/t/skip_grants.test
+++ /dev/null
@@ -1,139 +0,0 @@
-# This tests not performed with embedded server
--- source include/not_embedded.inc
-
-use test;
-
-#
-# BUG#16777: Can not create trigger nor view w/o definer if --skip-grant-tables
-# specified
-#
-# Also, the following test cases have been moved here:
-# - test that we can create VIEW if privileges check switched off has been
-# moved here;
-# - test that we can create and drop procedure without warnings (BUG#9993);
-# - BUG#17595: "DROP FUNCTION IF EXISTS" crashes server;
-# - BUG#13504: creation view with DEFINER clause if --skip-grant-tables
-#
-
-# Prepare.
-
---disable_warnings
-
-DROP VIEW IF EXISTS v1;
-DROP VIEW IF EXISTS v2;
-DROP VIEW IF EXISTS v3;
-
-DROP TABLE IF EXISTS t1;
-
-DROP PROCEDURE IF EXISTS p1;
-DROP PROCEDURE IF EXISTS p2;
-DROP PROCEDURE IF EXISTS p3;
-
-DROP FUNCTION IF EXISTS f1;
-DROP FUNCTION IF EXISTS f2;
-DROP FUNCTION IF EXISTS f3;
-
---enable_warnings
-
-# Test case.
-
-CREATE TABLE t1(c INT);
-
-# - try to create with implicit definer (definer would be ''@'');
-
-CREATE TRIGGER t1_bi BEFORE INSERT ON t1
- FOR EACH ROW
- SET @a = 1;
-
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-CREATE PROCEDURE p1()
- SELECT 1;
-
-CREATE FUNCTION f1() RETURNS INT
- RETURN 1;
-
-# - try to create with explicit definer;
-
-CREATE DEFINER=a@b TRIGGER ti_ai AFTER INSERT ON t1
- FOR EACH ROW
- SET @b = 1;
-
-CREATE DEFINER=a@b VIEW v2 AS SELECT * FROM t1;
-
-CREATE DEFINER=a@b PROCEDURE p2()
- SELECT 2;
-
-CREATE DEFINER=a@b FUNCTION f2() RETURNS INT
- RETURN 2;
-
-# - try to create with explicit definer with empty host;
-
-CREATE DEFINER=a@'' TRIGGER ti_bu BEFORE UPDATE ON t1
- FOR EACH ROW
- SET @c = 1;
-
-CREATE DEFINER=a@'' VIEW v3 AS SELECT * FROM t1;
-
-CREATE DEFINER=a@'' PROCEDURE p3()
- SELECT 3;
-
-CREATE DEFINER=a@'' FUNCTION f3() RETURNS INT
- RETURN 3;
-
-# - check that empty host name is treated correctly;
-
-SHOW CREATE VIEW v3;
-
-SHOW CREATE PROCEDURE p3;
-
-SHOW CREATE FUNCTION f3;
-
-# Cleanup.
-
-DROP TRIGGER t1_bi;
-DROP TRIGGER ti_ai;
-DROP TRIGGER ti_bu;
-
-DROP VIEW v1;
-DROP VIEW v2;
-DROP VIEW v3;
-
-DROP TABLE t1;
-
-DROP PROCEDURE p1;
-DROP PROCEDURE p2;
-DROP PROCEDURE p3;
-
-DROP FUNCTION f1;
-DROP FUNCTION f2;
-DROP FUNCTION f3;
-
-#
-# Bug #26807 "set global event_scheduler=1" and --skip-grant-tables crashes server
-#
-set global event_scheduler=1;
-set global event_scheduler=0;
-
-#
-# Bug#26285 Selecting information_schema crahes server
-#
-select count(*) from information_schema.COLUMN_PRIVILEGES;
-select count(*) from information_schema.SCHEMA_PRIVILEGES;
-select count(*) from information_schema.TABLE_PRIVILEGES;
-select count(*) from information_schema.USER_PRIVILEGES;
---echo End of 5.0 tests
-
---echo #
---echo # Bug#29817 Queries with UDF fail with non-descriptive error
---echo # if mysql.proc is missing
---echo #
---error ER_SP_DOES_NOT_EXIST
-select no_such_function(1);
-
---echo End of 5.1 tests
-
-#
-# MDEV-8280 crash in 'show global status' with --skip-grant-tables
-#
-show global status like 'Acl%';
diff --git a/mysql-test/t/skip_log_bin-master.opt b/mysql-test/t/skip_log_bin-master.opt
deleted file mode 100644
index 9ebccecc95e..00000000000
--- a/mysql-test/t/skip_log_bin-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-skip-log-bin
diff --git a/mysql-test/t/skip_log_bin.test b/mysql-test/t/skip_log_bin.test
deleted file mode 100644
index 6175b2cf7d3..00000000000
--- a/mysql-test/t/skip_log_bin.test
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-# binlog_off.test purpose is to verify that the --skip-log-bin flag
-# works correctly
-#
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-#
-# Bug #38798 Assertion mysql_bin_log.is_open() failed in
-# binlog_trans_log_savepos()
-# Testing that there is no crash.
-# Before BUG#38798, the code for CREATE...SELECT called an internal function to
-# binlog the statement, even with --skip-log-bin. This caused an assertion
-# to be thrown since the binlog was not open.
-
-set @@session.binlog_format=row;
-
-create table t1 (a int);
-insert into t1 values (1);
-create table t2 select * from t1;
-
-# clean-up
-drop table t1, t2;
diff --git a/mysql-test/t/skip_name_resolve-master.opt b/mysql-test/t/skip_name_resolve-master.opt
deleted file mode 100644
index ab6ca1731f5..00000000000
--- a/mysql-test/t/skip_name_resolve-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---skip-name-resolve
diff --git a/mysql-test/t/skip_name_resolve.test b/mysql-test/t/skip_name_resolve.test
deleted file mode 100644
index b0c5118f970..00000000000
--- a/mysql-test/t/skip_name_resolve.test
+++ /dev/null
@@ -1,53 +0,0 @@
-# Can't be tested with embedded server
---source include/not_embedded.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-# Bug#8471 IP address with mask fail when skip-name-resolve is on
-CREATE USER mysqltest_1@'127.0.0.1/255.255.255.255';
-GRANT ALL ON test.* TO mysqltest_1@'127.0.0.1/255.255.255.255';
-SHOW GRANTS FOR mysqltest_1@'127.0.0.1/255.255.255.255';
-REVOKE ALL ON test.* FROM mysqltest_1@'127.0.0.1/255.255.255.255';
-DROP USER mysqltest_1@'127.0.0.1/255.255.255.255';
-
-# End of 4.1 tests
-
-# Bug#13407 Remote connecting crashes server
-# Server crashed when one used USER() function in connection for which
-# was impossible to obtain peer hostname.
-connect (con1, localhost, root, , test, $MASTER_MYPORT, );
---replace_column 1 #
-SELECT USER();
-# We are only interested in the fact that statement below doesn't
-# crash server.
---disable_result_log
-SHOW PROCESSLIST;
---enable_result_log
-connection default;
-disconnect con1;
-
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
-
---echo #
---echo # Bug #37168: Missing variable - skip_name_resolve
---echo #
-
-SHOW VARIABLES LIKE 'skip_name_resolve';
-SHOW GLOBAL VARIABLES LIKE 'skip_name_resolve';
-SHOW SESSION VARIABLES LIKE 'skip_name_resolve';
-
-SELECT @@skip_name_resolve;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@LOCAL.skip_name_resolve;
-SELECT @@GLOBAL.skip_name_resolve;
-
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@skip_name_resolve=0;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@LOCAL.skip_name_resolve=0;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@GLOBAL.skip_name_resolve=0;
-
---echo End of 5.1 tests
diff --git a/mysql-test/t/slowlog_enospace-10508.test b/mysql-test/t/slowlog_enospace-10508.test
deleted file mode 100644
index b2c26a5984d..00000000000
--- a/mysql-test/t/slowlog_enospace-10508.test
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# MDEV-10508 Mariadb crash on out of disk space during dump import
-#
---source include/have_sequence.inc
---source include/have_debug.inc
-
-call mtr.add_suppression('Error writing file.*errno: 28 ');
-create table t1 (a int, b int) engine=memory;
-insert t1 select seq, seq+1 from seq_1_to_1000;
-set global general_log=0;
-set global log_queries_not_using_indexes=1;
-set debug_dbug='+d,simulate_file_write_error';
---disable_result_log
---let $run= 50
-while ($run)
-{
- select * from t1 where a>10;
- dec $run;
-}
---enable_result_log
-set debug_dbug='';
-set global general_log=1;
-set global log_queries_not_using_indexes=default;
-drop table t1;
diff --git a/mysql-test/t/sp-anchor-row-type-cursor.test b/mysql-test/t/sp-anchor-row-type-cursor.test
deleted file mode 100644
index 7089175507c..00000000000
--- a/mysql-test/t/sp-anchor-row-type-cursor.test
+++ /dev/null
@@ -1,1118 +0,0 @@
-
---echo #
---echo # Start of 10.3 tests
---echo #
-
---echo #
---echo # MDEV-12461 TYPE OF and ROW TYPE OF anchored data types
---echo #
-
---echo #
---echo # A complete working example
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(32));
-CREATE TABLE t2 LIKE t1;
-INSERT INTO t1 VALUES (10,'b10');
-INSERT INTO t1 VALUES (20,'b20');
-INSERT INTO t1 VALUES (30,'b30');
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE c CURSOR FOR SELECT a,b FROM t1;
- BEGIN
- DECLARE done INT DEFAULT 0;
- DECLARE rec ROW TYPE OF c;
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=1;
- OPEN c;
- read_loop: LOOP
- FETCH c INTO rec;
- IF done THEN
- LEAVE read_loop;
- END IF;
- SELECT rec.a ,rec.b FROM dual;
- INSERT INTO t2 VALUES (rec.a, rec.b);
- END LOOP;
- CLOSE c;
- END;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-SELECT * FROM t2;
-DROP PROCEDURE p1;
-DROP TABLE t2;
-DROP TABLE t1;
-
-
---echo #
---echo # cursor ROW TYPE referring to a table in a non-existing database
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur CURSOR FOR SELECT * FROM tes2.t1;
- BEGIN
- DECLARE rec ROW TYPE OF cur;
- END;
-END;
-$$
-DELIMITER ;$$
---error ER_NO_SUCH_TABLE
-CALL p1();
-CREATE TABLE t1 (a INT, b VARCHAR(10), c DOUBLE, d DECIMAL(10));
---error ER_NO_SUCH_TABLE
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # cursor ROW TYPE referring to a table in the current database
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur CURSOR FOR SELECT * FROM t1;
- BEGIN
- DECLARE rec ROW TYPE OF cur;
- CREATE TABLE t2 AS SELECT rec.a, rec.b, rec.c, rec.d;
- SHOW CREATE TABLE t2;
- DROP TABLE t2;
- END;
-END;
-$$
-DELIMITER ;$$
---error ER_NO_SUCH_TABLE
-CALL p1();
-CREATE TABLE t1 (a INT, b VARCHAR(10), c DOUBLE, d DECIMAL(10));
-CALL p1();
-DROP TABLE t1;
---error ER_NO_SUCH_TABLE
-CALL p1();
-DROP PROCEDURE p1;
-
-
---echo #
---echo # cursor ROW TYPE referring to a table in an explicitly specified database
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur CURSOR FOR SELECT * FROM test.t1;
- BEGIN
- DECLARE rec ROW TYPE OF cur;
- CREATE TABLE t2 AS SELECT rec.a, rec.b, rec.c, rec.d;
- SHOW CREATE TABLE t2;
- DROP TABLE t2;
- END;
-END;
-$$
-DELIMITER ;$$
---error ER_NO_SUCH_TABLE
-CALL p1();
-CREATE TABLE t1 (a INT, b VARCHAR(10), c DOUBLE, d DECIMAL(10));
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Cursor ROW TYPE referring to a view in the current database
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur CURSOR FOR SELECT * FROM v1;
- BEGIN
- DECLARE rec ROW TYPE OF cur;
- CREATE TABLE t2 AS SELECT rec.a, rec.b, rec.c, rec.d;
- SHOW CREATE TABLE t2;
- DROP TABLE t2;
- END;
-END;
-$$
-DELIMITER ;$$
---error ER_NO_SUCH_TABLE
-CALL p1();
-CREATE TABLE t1 (a INT, b VARCHAR(10), c DOUBLE, d DECIMAL(10));
-CREATE VIEW v1 AS SELECT * FROM t1;
-CALL p1();
-DROP VIEW v1;
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # cursor ROW TYPE referring to a view in an explicitly specified database
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur CURSOR FOR SELECT * FROM test.v1;
- BEGIN
- DECLARE rec ROW TYPE OF cur;
- CREATE TABLE t2 AS SELECT rec.a, rec.b, rec.c, rec.d;
- SHOW CREATE TABLE t2;
- DROP TABLE t2;
- END;
-END;
-$$
-DELIMITER ;$$
---error ER_NO_SUCH_TABLE
-CALL p1();
-CREATE TABLE t1 (a INT, b VARCHAR(10), c DOUBLE, d DECIMAL(10));
-CREATE VIEW v1 AS SELECT * FROM t1;
-CALL p1();
-DROP VIEW v1;
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Checking that all cursor ROW TYPE fields are NULL by default
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10), c DOUBLE, d DECIMAL(10,2));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur1 CURSOR FOR SELECT * FROM t1;
- BEGIN
- DECLARE rec1 ROW TYPE OF cur1;
- SELECT rec1.a, rec1.b, rec1.c, rec1.d;
- END;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # A cursor ROW TYPE variable with a ROW expression as a default
---echo #
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur1 CURSOR FOR SELECT * FROM t1;
- BEGIN
- DECLARE rec1 ROW TYPE OF cur1 DEFAULT ROW(10,'bbb');
- SELECT rec1.a, rec1.b;
- END;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # A cursor ROW TYPE variable with an incompatible ROW expression as a default
---echo #
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur1 CURSOR FOR SELECT * FROM t1;
- BEGIN
- DECLARE rec1 ROW TYPE OF cur1 DEFAULT ROW(10,'bbb','ccc');
- SELECT rec1.a, rec1.b;
- END;
-END;
-$$
-DELIMITER ;$$
---error ER_OPERAND_COLUMNS
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # A cursor ROW TYPE variable with a ROW variable as a default
---echo #
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur CURSOR FOR SELECT * FROM t1;
- BEGIN
- DECLARE rec1 ROW(a INT, b VARCHAR(10)) DEFAULT ROW(10,'bbb');
- DECLARE rec2 ROW TYPE OF cur DEFAULT rec1;
- SELECT rec2.a, rec2.b;
- END;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # A ROW variable using a cursor ROW TYPE variable as a default
---echo #
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur1 CURSOR FOR SELECT * FROM t1;
- BEGIN
- DECLARE rec1 ROW TYPE OF cur1 DEFAULT ROW(10,'bbb');
- DECLARE rec2 ROW(a INT, b VARCHAR(10)) DEFAULT rec1;
- SELECT rec2.a, rec2.b;
- END;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Assigning cursor ROW TYPE variables with a different column count
---echo #
-CREATE TABLE t1 (a INT, b VARCHAR(10), c DOUBLE);
-CREATE TABLE t2 (a INT, b VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur1 CURSOR FOR SELECT * FROM t1;
- DECLARE cur2 CURSOR FOR SELECT * FROM t2;
- BEGIN
- DECLARE rec1 ROW TYPE OF cur1;
- DECLARE rec2 ROW TYPE OF cur2;
- SET rec2=rec1;
- END;
-END;
-$$
-DELIMITER ;$$
---error ER_OPERAND_COLUMNS
-CALL p1();
-DROP PROCEDURE p1;
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur1 CURSOR FOR SELECT * FROM t1;
- DECLARE cur2 CURSOR FOR SELECT * FROM t2;
- BEGIN
- DECLARE rec1 ROW TYPE OF cur1;
- DECLARE rec2 ROW TYPE OF cur2;
- SET rec1=rec2;
- END;
-END;
-$$
-DELIMITER ;$$
---error ER_OPERAND_COLUMNS
-CALL p1();
-DROP TABLE t2;
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Assigning compatible cursor ROW TYPE variables (equal number of fields)
---echo #
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-CREATE TABLE t2 (x INT, y VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur1 CURSOR FOR SELECT * FROM t1;
- DECLARE cur2 CURSOR FOR SELECT * FROM t2;
- BEGIN
- DECLARE rec1 ROW TYPE OF cur1;
- DECLARE rec2 ROW TYPE OF cur2;
- SET rec1.a= 10;
- SET rec1.b= 'bbb';
- SET rec2=rec1;
- SELECT rec2.x, rec2.y;
- END;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP TABLE t2;
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Assigning between incompatible cursor ROW TYPE and explicit ROW variables
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur1 CURSOR FOR SELECT * FROM t1;
- BEGIN
- DECLARE rec1 ROW TYPE OF cur1;
- DECLARE rec2 ROW(x INT,y INT,z INT);
- SET rec2.x= 10;
- SET rec2.y= 20;
- SET rec2.z= 30;
- SET rec1= rec2;
- END;
-END;
-$$
-DELIMITER ;$$
---error ER_OPERAND_COLUMNS
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Assigning between compatible cursor ROW TYPE and explicit ROW variables
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur1 CURSOR FOR SELECT * FROM t1;
- BEGIN
- DECLARE rec1 ROW TYPE OF cur1;
- DECLARE rec2 ROW(x INT,y INT);
- SET rec2.x= 10;
- SET rec2.y= 20;
- SET rec1= rec2;
- SELECT rec1.a, rec1.b;
- SET rec1.a= 11;
- SET rec1.b= 21;
- SET rec2= rec1;
- SELECT rec2.x, rec2.y;
- END;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Assigning cursor ROW TYPE from a ROW expression
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur1 CURSOR FOR SELECT * FROM t1;
- BEGIN
- DECLARE rec1 ROW TYPE OF cur1;
- SET rec1= ROW(10,20);
- SELECT rec1.a, rec1.b;
- END;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Fetching a cursor into a cursor ROW TYPE variable with a wrong field count
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10), c DOUBLE, d DECIMAL(10,2));
-CREATE TABLE t2 (a INT, b VARCHAR(10));
-INSERT INTO t1 VALUES (10,'bb1',111.111e2, 12.31);
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur1 CURSOR FOR SELECT * FROM t1;
- DECLARE cur2 CURSOR FOR SELECT * FROM t2;
- BEGIN
- DECLARE rec2 ROW TYPE OF cur2;
- OPEN cur1;
- FETCH cur1 INTO rec2;
- CLOSE cur1;
- END;
-END;
-$$
-DELIMITER ;$$
---error ER_SP_WRONG_NO_OF_FETCH_ARGS
-CALL p1();
-DROP TABLE t2;
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Fetching a cursor into a cursor ROW TYPE variable
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10), c DOUBLE, d DECIMAL(10,2));
-CREATE TABLE t2 LIKE t1;
-INSERT INTO t1 VALUES (10,'bb1',111.111e2, 12.31);
-INSERT INTO t1 VALUES (20,'bb2',222.222e2, 12.32);
-INSERT INTO t1 VALUES (30,'bb3',333.333e2, 12.33);
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur CURSOR FOR SELECT * FROM t1;
- BEGIN
- DECLARE done INT DEFAULT 0;
- DECLARE rec ROW TYPE OF cur;
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=TRUE;
- OPEN cur;
- read_loop: LOOP
- FETCH cur INTO rec;
- IF done THEN
- LEAVE read_loop;
- END IF;
- SELECT rec.a, rec.b, rec.c, rec.d;
- INSERT INTO t2 VALUES (rec.a, rec.b, rec.c, rec.d);
- END LOOP;
- CLOSE cur;
- END;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-SELECT * FROM t2;
-DROP TABLE t2;
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Fetching a cursor into a cursor ROW TYPE variable, ROW TYPE OF cur declared inside the LOOP
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10), c DOUBLE, d DECIMAL(10,2));
-CREATE TABLE t2 LIKE t1;
-INSERT INTO t1 VALUES (10,'bb1',111.111e2, 12.31);
-INSERT INTO t1 VALUES (20,'bb2',222.222e2, 12.32);
-INSERT INTO t1 VALUES (30,'bb3',333.333e2, 12.33);
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE done INT DEFAULT 0;
- DECLARE cur CURSOR FOR SELECT * FROM t1;
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=TRUE;
- OPEN cur;
- read_loop: LOOP
- BEGIN
- DECLARE rec ROW TYPE OF cur;
- FETCH cur INTO rec;
- IF done THEN
- LEAVE read_loop;
- END IF;
- SELECT rec.a, rec.b, rec.c, rec.d;
- INSERT INTO t2 VALUES (rec.a, rec.b, rec.c, rec.d);
- END;
- END LOOP;
- CLOSE cur;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-SELECT * FROM t2;
-DROP TABLE t2;
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Fetching a cursor into a cursor ROW TYPE variable with different column names
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-CREATE TABLE t2 (x INT, y VARCHAR(10));
-INSERT INTO t1 VALUES (10,'bbb');
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur1 CURSOR FOR SELECT * FROM t1;
- DECLARE cur2 CURSOR FOR SELECT * FROM t2;
- BEGIN
- DECLARE rec2 ROW TYPE OF cur2;
- OPEN cur1;
- FETCH cur1 INTO rec2;
- SELECT rec2.x, rec2.y;
- CLOSE cur1;
- END;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP TABLE t2;
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Fetching a cursor into a cursor ROW TYPE variable, with truncation
---echo #
-
-SET sql_mode='';
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-CREATE TABLE t2 (a INT, b INT);
-INSERT INTO t1 VALUES (10,'11x');
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur1 CURSOR FOR SELECT * FROM t1;
- DECLARE cur2 CURSOR FOR SELECT * FROM t2;
- BEGIN
- DECLARE rec2 ROW TYPE OF cur2;
- OPEN cur1;
- FETCH cur1 INTO rec2;
- SELECT rec2.a, rec2.b;
- CLOSE cur1;
- END;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP TABLE t2;
-DROP TABLE t1;
-DROP PROCEDURE p1;
-SET sql_mode=DEFAULT;
-
-
---echo #
---echo # cursor ROW TYPE variables are not allowed in LIMIT
---echo #
-CREATE TABLE t1 (a INT, b INT);
-INSERT INTO t1 VALUES (1,2);
-DELIMITER $$;
---error ER_WRONG_SPVAR_TYPE_IN_LIMIT
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur1 CURSOR FOR SELECT * FROM t1;
- BEGIN
- DECLARE rec1 ROW TYPE OF cur1 DEFAULT (1,2);
- SELECT * FROM t1 LIMIT rec1.a;
- END;
-END;
-$$
-DELIMITER ;$$
-DROP TABLE t1;
-
-
---echo #
---echo # cursor ROW TYPE variable fields as OUT parameters
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1(OUT a INT,OUT b VARCHAR(10))
-BEGIN
- SET a=10;
- SET b='bb';
-END;
-$$
-CREATE PROCEDURE p2()
-BEGIN
- DECLARE cur1 CURSOR FOR SELECT * FROM t1;
- BEGIN
- DECLARE rec1 ROW TYPE OF cur1;
- CALL p1(rec1.a, rec1.b);
- SELECT rec1.a, rec1.b;
- END;
-END;
-$$
-DELIMITER ;$$
-CALL p2();
-DROP PROCEDURE p2;
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-
---echo #
---echo # Passing the entire cursor ROW TYPE variable
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1(a ROW(a INT, b VARCHAR(10)))
-BEGIN
- SELECT a.a, a.b;
-END;
-$$
-CREATE PROCEDURE p2()
-BEGIN
- DECLARE cur CURSOR FOR SELECT * FROM t1;
- BEGIN
- DECLARE rec1 ROW TYPE OF cur DEFAULT ROW(10,'bb');
- CALL p1(rec1);
- END;
-END;
-$$
-DELIMITER ;$$
-CALL p2();
-DROP PROCEDURE p2;
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-
---echo #
---echo # Passing the entire cursor ROW TYPE variable as an OUT parameter
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1(OUT a ROW(a INT, b VARCHAR(10)))
-BEGIN
- SET a= ROW(10,'bb');
-END;
-$$
-CREATE PROCEDURE p2()
-BEGIN
- DECLARE cur CURSOR FOR SELECT * FROM t1;
- BEGIN
- DECLARE rec1 ROW TYPE OF cur;
- CALL p1(rec1);
- SELECT rec1.a, rec1.b;
- END;
-END;
-$$
-DELIMITER ;$$
-CALL p2();
-DROP PROCEDURE p2;
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-
---echo #
---echo # Assigning a cursor ROW TYPE field to an OUT parameter
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1 (INOUT res INTEGER)
-BEGIN
- DECLARE a INT DEFAULT 10;
- DECLARE cur1 CURSOR FOR SELECT a FROM DUAL;
- BEGIN
- DECLARE rec1 ROW TYPE OF cur1;
- OPEN cur1;
- FETCH cur1 INTO rec1;
- CLOSE cur1;
- SET res=rec1.a;
- END;
-END;
-$$
-DELIMITER ;$$
-CALL p1(@res);
-SELECT @res;
-SET @res=NULL;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Testing Item_splocal_row_field_by_name::print
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur1 CURSOR FOR SELECT * FROM t1;
- BEGIN
- DECLARE rec ROW TYPE OF cur1 DEFAULT ROW(10,'bb');
- EXPLAIN EXTENDED SELECT rec.a, rec.b;
- END;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-
---echo #
---echo # Run time error in the cursor statement
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur1 CURSOR FOR SELECT
- 10 AS a,
- CONCAT(_latin1'a' COLLATE latin1_bin,
- _latin1'a' COLLATE latin1_swedish_ci) AS b;
- BEGIN
- DECLARE rec1 ROW TYPE OF cur1;
- OPEN cur1;
- FETCH cur1 INTO rec1;
- CLOSE cur1;
- SELECT a,b;
- END;
-END;
-$$
-DELIMITER ;$$
---error ER_CANT_AGGREGATE_2COLLATIONS
-CALL p1();
-DROP PROCEDURE p1;
-
-
-
---echo #
---echo # Non-existing field
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur1 CURSOR FOR SELECT * FROM t1;
- BEGIN
- DECLARE rec ROW TYPE OF cur1;
- SELECT rec.c;
- END;
-END;
-$$
-DELIMITER ;$$
---error ER_ROW_VARIABLE_DOES_NOT_HAVE_FIELD
-CALL p1();
-ALTER TABLE t1 ADD c INT;
-#
-# The below ALTER is needed as a workaround to call sp_cache_invalidate()
-# Please remove it after fixing MDEV-12166
-#
-ALTER PROCEDURE p1 COMMENT 'test';
-CALL p1();
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-
---echo #
---echo # Testing that field names are case insensitive
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur CURSOR FOR SELECT * FROM t1;
- BEGIN
- DECLARE rec ROW TYPE OF cur DEFAULT ROW(10,'bb');
- SELECT rec.A, rec.B;
- END;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-
---echo #
---echo # Testing that cursor ROW TYPE uses temporary tables vs shadowed real tables
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-CREATE TEMPORARY TABLE t1 (x INT, y VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur CURSOR FOR SELECT * FROM t1;
- BEGIN
- DECLARE rec ROW TYPE OF cur DEFAULT ROW(10,'bb');
- SELECT rec.A, rec.B;
- END;
-END;
-$$
-DELIMITER ;$$
---error ER_ROW_VARIABLE_DOES_NOT_HAVE_FIELD
-CALL p1();
-DROP TEMPORARY TABLE t1;
-#
-# The below ALTER is needed as a workaround to call sp_cache_invalidate()
-# Please remove it after fixing MDEV-12166
-#
-ALTER PROCEDURE p1 COMMENT 'test';
-CALL p1();
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-
---echo #
---echo # Testing that the structure of cursor ROW TYPE variables is determined at the DECLARE CURSOR instantiation time
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(32));
-INSERT INTO t1 VALUES (10,'b10');
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur CURSOR FOR SELECT * FROM t1;
- DROP TABLE t1;
- CREATE TABLE t1 (a INT, b VARCHAR(32), c INT);
- BEGIN
- DECLARE rec ROW TYPE OF cur; -- This has a column "c"
- SET rec.c=10;
- END;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
-CREATE TABLE t1 (a INT, b VARCHAR(32));
-INSERT INTO t1 VALUES (10,'b10');
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur CURSOR FOR SELECT * FROM t1;
- BEGIN
- DECLARE rec ROW TYPE OF cur; -- This does not have a column "c"
- DROP TABLE t1;
- CREATE TABLE t1 (a INT, b VARCHAR(32), c INT);
- SET rec.c=10;
- END;
-END;
-$$
-DELIMITER ;$$
---error ER_ROW_VARIABLE_DOES_NOT_HAVE_FIELD
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Duplicate field nams in a cursor referenced by cursor ROW TYPE
---echo #
-
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (a INT);
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur CURSOR FOR SELECT * FROM t1, t2;
- BEGIN
- DECLARE rec ROW TYPE OF cur;
- SELECT rec.a;
- SET rec.a=10;
- END;
-END;
-$$
-DELIMITER ;$$
---error ER_DUP_FIELDNAME
-CALL p1();
-DROP PROCEDURE p1;
-DROP TABLE t2;
-DROP TABLE t1;
-
-
---echo #
---echo # Tricky field names a cursor referenced by cursor ROW TYPE
---echo #
-
-SET NAMES utf8;
-CREATE TABLE t1 (a VARCHAR(10));
-INSERT INTO t1 VALUES ('a');
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur CURSOR FOR SELECT a, CONCAT(a,'a'), CONCAT(a,'ö') FROM t1;
- BEGIN
- DECLARE rec ROW TYPE OF cur;
- OPEN cur;
- FETCH cur INTO rec;
- CLOSE cur;
- SELECT rec.a, rec.`CONCAT(a,'a')`, rec.`CONCAT(a,'ö')`;
- END;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP PROCEDURE p1;
-DROP TABLE t1;
-SET NAMES latin1;
-
-
---echo #
---echo # Using definitions recursively (cursor ROW TYPE variables in another cursor SELECT)
---echo #
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-INSERT INTO t1 VALUES (10,'b1'),(20,'b2'),(30,'b3');
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur1 CURSOR FOR SELECT a,b FROM t1;
- BEGIN
- DECLARE rec1 ROW TYPE OF cur1 DEFAULT ROW(0,'b0');
- DECLARE cur2 CURSOR FOR SELECT rec1.a AS a, rec1.b AS b FROM t1;
- BEGIN
- DECLARE done INT DEFAULT 0;
- DECLARE rec2 ROW TYPE OF cur2;
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=TRUE;
- OPEN cur2;
- read_loop: LOOP
- FETCH cur2 INTO rec2;
- IF done THEN
- LEAVE read_loop;
- END IF;
- SELECT rec2.a, rec2.b;
- END LOOP;
- CLOSE cur2;
- END;
- END;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-
---echo #
---echo # Testing queries with auto-generated Items.
---echo # An instance of Item_func_conv_charset is created during the below SELECT query.
---echo # We check here that during an implicit cursor OPEN
---echo # done in sp_instr_cursor_copy_struct::exec_core()
---echo # all temporary Items are created on a proper memory root and are safely destroyed.
---echo #
-
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1, b VARCHAR(10) CHARACTER SET utf8);
-INSERT INTO t1 VALUES (0xFF, 'a');
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur1 CURSOR FOR SELECT CONCAT(a,b) AS c FROM t1;
- BEGIN
- DECLARE rec1 ROW TYPE OF cur1;
- OPEN cur1;
- FETCH cur1 INTO rec1;
- CLOSE cur1;
- SELECT HEX(rec1.c);
- END;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
---echo #
---echo # SELECT INTO + cursor ROW TYPE variable with a wrong column count
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(32));
-INSERT INTO t1 VALUES (10,'b10');
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur1 CURSOR FOR SELECT 10, 'b0', 'c0';
- BEGIN
- DECLARE rec1 ROW TYPE OF cur1;
- SELECT * FROM t1 INTO rec1;
- SELECT rec1.a, rec1.b;
- END;
-END;
-$$
-DELIMITER ;$$
---error ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # SELECT INTO + multiple cursor ROW TYPE variables
---echo #
-CREATE TABLE t1 (a INT, b VARCHAR(32));
-INSERT INTO t1 VALUES (10,'b10');
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur1 CURSOR FOR SELECT * FROM t1;
- BEGIN
- DECLARE rec1 ROW TYPE OF cur1;
- SELECT * FROM t1 INTO rec1, rec1;
- SELECT rec1.a, rec1.b;
- END;
-END;
-$$
-DELIMITER ;$$
---error ER_OPERAND_COLUMNS
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo # SELECT INTO + cursor ROW TYPE working example
-CREATE TABLE t1 (a INT, b VARCHAR(32));
-INSERT INTO t1 VALUES (10,'b10');
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur1 CURSOR FOR SELECT * FROM t1;
- BEGIN
- DECLARE rec1 ROW TYPE OF cur1;
- SELECT * FROM t1 INTO rec1;
- SELECT rec1.a, rec1.b;
- END;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
---echo #
---echo # End of MDEV-12461 TYPE OF and ROW TYPE OF anchored data types
---echo #
-
-
---echo #
---echo # MDEV-12916 Wrong column data type for an INT field of a cursor-anchored ROW variable
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a INT DEFAULT 10;
- DECLARE cur1 CURSOR FOR SELECT a;
- BEGIN
- DECLARE rec1 ROW TYPE OF cur1;
- CREATE TABLE t1 AS SELECT rec1.a;
- SHOW CREATE TABLE t1;
- DROP TABLE t1;
- END;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP PROCEDURE p1;
-
-
---echo #
---echo # MDEV-14139 Anchored data types for variables
---echo #
-
-DELIMITER $$;
-BEGIN NOT ATOMIC
- DECLARE c1 CURSOR FOR SELECT 10 AS a, 'bbb' AS b, TIME'10:20:30' AS c;
- BEGIN
- DECLARE row1 ROW TYPE OF c1;
- DECLARE a_row1 TYPE OF row1;
- DECLARE aa_row1 TYPE OF a_row1;
- CREATE TABLE t2 AS SELECT a_row1.a AS a, a_row1.b AS b, a_row1.c AS c;
- SHOW CREATE TABLE t2;
- DROP TABLE t2;
- CREATE TABLE t2 AS SELECT aa_row1.a AS a, aa_row1.b AS b, aa_row1.c AS c;
- SHOW CREATE TABLE t2;
- DROP TABLE t2;
- END;
-END;
-$$
-DELIMITER ;$$
diff --git a/mysql-test/t/sp-anchor-row-type-table.test b/mysql-test/t/sp-anchor-row-type-table.test
deleted file mode 100644
index 3f04dc68586..00000000000
--- a/mysql-test/t/sp-anchor-row-type-table.test
+++ /dev/null
@@ -1,883 +0,0 @@
-
---echo #
---echo # Start of 10.3 tests
---echo #
-
---echo #
---echo # MDEV-12461 TYPE OF and ROW TYPE OF anchored data types
---echo #
-
---echo #
---echo # Referring to a table in a non-existing database
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec ROW TYPE OF test2.t1;
-END;
-$$
-DELIMITER ;$$
---error ER_NO_SUCH_TABLE
-CALL p1();
-CREATE TABLE t1 (a INT, b VARCHAR(10), c DOUBLE, d DECIMAL(10));
---error ER_NO_SUCH_TABLE
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Referring to a table in the current database
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec ROW TYPE OF t1;
- CREATE TABLE t2 AS SELECT rec.a, rec.b, rec.c, rec.d;
- SHOW CREATE TABLE t2;
- DROP TABLE t2;
-END;
-$$
-DELIMITER ;$$
---error ER_NO_SUCH_TABLE
-CALL p1();
-CREATE TABLE t1 (a INT, b VARCHAR(10), c DOUBLE, d DECIMAL(10));
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Referring to a table in an explicitly specified database
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec ROW TYPE OF test.t1;
- CREATE TABLE t2 AS SELECT rec.a, rec.b, rec.c, rec.d;
- SHOW CREATE TABLE t2;
- DROP TABLE t2;
-END;
-$$
-DELIMITER ;$$
---error ER_NO_SUCH_TABLE
-CALL p1();
-CREATE TABLE t1 (a INT, b VARCHAR(10), c DOUBLE, d DECIMAL(10));
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Referring to a view in the current database
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec ROW TYPE OF v1;
- CREATE TABLE t2 AS SELECT rec.a, rec.b, rec.c, rec.d;
- SHOW CREATE TABLE t2;
- DROP TABLE t2;
-END;
-$$
-DELIMITER ;$$
---error ER_NO_SUCH_TABLE
-CALL p1();
-CREATE TABLE t1 (a INT, b VARCHAR(10), c DOUBLE, d DECIMAL(10));
-CREATE VIEW v1 AS SELECT * FROM t1;
-CALL p1();
-DROP VIEW v1;
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Referring to a view in an explicitly specified database
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec ROW TYPE OF test.v1;
- CREATE TABLE t2 AS SELECT rec.a, rec.b, rec.c, rec.d;
- SHOW CREATE TABLE t2;
- DROP TABLE t2;
-END;
-$$
-DELIMITER ;$$
---error ER_NO_SUCH_TABLE
-CALL p1();
-CREATE TABLE t1 (a INT, b VARCHAR(10), c DOUBLE, d DECIMAL(10));
-CREATE VIEW v1 AS SELECT * FROM t1;
-CALL p1();
-DROP VIEW v1;
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Checking that all table ROW TYPE fields are NULL by default
---echo #
-CREATE TABLE t1 (a INT, b VARCHAR(10), c DOUBLE, d DECIMAL(10,2));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec1 ROW TYPE OF t1;
- SELECT rec1.a, rec1.b, rec1.c, rec1.d;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # A table ROW TYPE variable with a ROW expression as a default
---echo #
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec1 ROW TYPE OF t1 DEFAULT ROW(10,'bbb');
- SELECT rec1.a, rec1.b;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # A table ROW TYPE variable with an incompatible ROW expression as a default
---echo #
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec1 ROW TYPE OF t1 DEFAULT ROW(10,'bbb','ccc');
- SELECT rec1.a, rec1.b;
-END;
-$$
-DELIMITER ;$$
---error ER_OPERAND_COLUMNS
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # A table ROW TYPE variable with a ROW variable as a default
---echo #
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec1 ROW(a INT, b VARCHAR(10)) DEFAULT ROW(10,'bbb');
- DECLARE rec2 ROW TYPE OF t1 DEFAULT rec1;
- SELECT rec2.a, rec2.b;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # A ROW variable using a table ROW TYPE variable as a default
---echo #
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec1 ROW TYPE OF t1 DEFAULT ROW(10,'bbb');
- DECLARE rec2 ROW(a INT, b VARCHAR(10)) DEFAULT rec1;
- SELECT rec2.a, rec2.b;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Assigning table ROW TYPE variables with a different column count
---echo #
-CREATE TABLE t1 (a INT, b VARCHAR(10), c DOUBLE);
-CREATE TABLE t2 (a INT, b VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec1 ROW TYPE OF t1;
- DECLARE rec2 ROW TYPE OF t2;
- SET rec2=rec1;
-END;
-$$
-DELIMITER ;$$
---error ER_OPERAND_COLUMNS
-CALL p1();
-DROP PROCEDURE p1;
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec1 ROW TYPE OF t1;
- DECLARE rec2 ROW TYPE OF t2;
- SET rec1=rec2;
-END;
-$$
-DELIMITER ;$$
---error ER_OPERAND_COLUMNS
-CALL p1();
-DROP TABLE t2;
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Assigning compatible table ROW TYPE variables (equal number of fields)
---echo #
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-CREATE TABLE t2 (x INT, y VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec1 ROW TYPE OF t1;
- DECLARE rec2 ROW TYPE OF t2;
- SET rec1.a= 10;
- SET rec1.b= 'bbb';
- SET rec2=rec1;
- SELECT rec2.x, rec2.y;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP TABLE t2;
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Assigning between incompatible table ROW TYPE and explicit ROW variables
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec1 ROW TYPE OF t1;
- DECLARE rec2 ROW(x INT,y INT,z INT);
- SET rec2.x= 10;
- SET rec2.y= 20;
- SET rec2.z= 30;
- SET rec1= rec2;
-END;
-$$
-DELIMITER ;$$
---error ER_OPERAND_COLUMNS
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Assigning between compatible table ROW TYPE and explicit ROW variables
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec1 ROW TYPE OF t1;
- DECLARE rec2 ROW(x INT,y INT);
- SET rec2.x= 10;
- SET rec2.y= 20;
- SET rec1= rec2;
- SELECT rec1.a, rec1.b;
- SET rec1.a= 11;
- SET rec1.b= 21;
- SET rec2= rec1;
- SELECT rec2.x, rec2.y;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Assigning table ROW TYPE from a ROW expression
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec1 ROW TYPE OF t1;
- SET rec1= ROW(10,20);
- SELECT rec1.a, rec1.b;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Fetching a cursor into a table ROW TYPE variable with a wrong field count
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10), c DOUBLE, d DECIMAL(10,2));
-CREATE TABLE t2 (a INT, b VARCHAR(10));
-INSERT INTO t1 VALUES (10,'bb1',111.111e2, 12.31);
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec2 ROW TYPE OF t2;
- DECLARE cur1 CURSOR FOR SELECT * FROM t1;
- OPEN cur1;
- FETCH cur1 INTO rec2;
- CLOSE cur1;
-END;
-$$
-DELIMITER ;$$
---error ER_SP_WRONG_NO_OF_FETCH_ARGS
-CALL p1();
-DROP TABLE t2;
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Fetching a cursor into a table ROW TYPE variable
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10), c DOUBLE, d DECIMAL(10,2));
-CREATE TABLE t2 LIKE t1;
-INSERT INTO t1 VALUES (10,'bb1',111.111e2, 12.31);
-INSERT INTO t1 VALUES (20,'bb2',222.222e2, 12.32);
-INSERT INTO t1 VALUES (30,'bb3',333.333e2, 12.33);
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE done INT DEFAULT 0;
- DECLARE rec ROW TYPE OF t1;
- DECLARE cur CURSOR FOR SELECT * FROM t1;
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=TRUE;
- OPEN cur;
- read_loop: LOOP
- FETCH cur INTO rec;
- IF done THEN
- LEAVE read_loop;
- END IF;
- SELECT rec.a, rec.b, rec.c, rec.d;
- INSERT INTO t2 VALUES (rec.a, rec.b, rec.c, rec.d);
- END LOOP;
- CLOSE cur;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-SELECT * FROM t2;
-DROP TABLE t2;
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
---echo #
---echo # Fetching a cursor into a table ROW TYPE variable with different column names
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-CREATE TABLE t2 (x INT, y VARCHAR(10));
-INSERT INTO t1 VALUES (10,'bbb');
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec2 ROW TYPE OF t2;
- DECLARE cur1 CURSOR FOR SELECT * FROM t1;
- OPEN cur1;
- FETCH cur1 INTO rec2;
- SELECT rec2.x, rec2.y;
- CLOSE cur1;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP TABLE t2;
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Fetching a cursor into a table ROW TYPE variable, with truncation
---echo #
-
-SET sql_mode='';
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-CREATE TABLE t2 (a INT, b INT);
-INSERT INTO t1 VALUES (10,'11x');
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec2 ROW TYPE OF t2;
- DECLARE cur1 CURSOR FOR SELECT * FROM t1;
- OPEN cur1;
- FETCH cur1 INTO rec2;
- SELECT rec2.a, rec2.b;
- CLOSE cur1;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP TABLE t2;
-DROP TABLE t1;
-DROP PROCEDURE p1;
-SET sql_mode=DEFAULT;
-
---echo #
---echo # table ROW TYPE variables are not allowed in LIMIT
---echo #
-CREATE TABLE t1 (a INT, b INT);
-INSERT INTO t1 VALUES (1,2);
-DELIMITER $$;
---error ER_WRONG_SPVAR_TYPE_IN_LIMIT
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec1 ROW TYPE OF t1 DEFAULT (1,2);
- SELECT * FROM t1 LIMIT rec1.a;
-END;
-$$
-DELIMITER ;$$
-DROP TABLE t1;
-
-
---echo #
---echo # table ROW TYPE variable fields as OUT parameters
---echo #
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1(OUT a INT,OUT b VARCHAR(10))
-BEGIN
- SET a=10;
- SET b='bb';
-END;
-$$
-CREATE PROCEDURE p2()
-BEGIN
- DECLARE rec1 ROW TYPE OF t1;
- CALL p1(rec1.a, rec1.b);
- SELECT rec1.a, rec1.b;
-END;
-$$
-DELIMITER ;$$
-CALL p2();
-DROP PROCEDURE p2;
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-
---echo #
---echo # Passing the entire table ROW TYPE variable
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1(a ROW(a INT, b VARCHAR(10)))
-BEGIN
- SELECT a.a, a.b;
-END;
-$$
-CREATE PROCEDURE p2()
-BEGIN
- DECLARE rec1 ROW TYPE OF t1 DEFAULT ROW(10,'bb');
- CALL p1(rec1);
-END;
-$$
-DELIMITER ;$$
-CALL p2();
-DROP PROCEDURE p2;
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-
---echo #
---echo # Passing the entire table ROW TYPE variable as an OUT parameter
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1(OUT a ROW(a INT, b VARCHAR(10)))
-BEGIN
- SET a= ROW(10,'bb');
-END;
-$$
-CREATE PROCEDURE p2()
-BEGIN
- DECLARE rec1 ROW TYPE OF t1;
- CALL p1(rec1);
- SELECT rec1.a, rec1.b;
-END;
-$$
-DELIMITER ;$$
-CALL p2();
-DROP PROCEDURE p2;
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-
---echo #
---echo # Assigning a table ROW TYPE field to an OUT parameter
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1 (INOUT res INTEGER)
-BEGIN
- DECLARE rec1 ROW TYPE OF t1 DEFAULT ROW(10,'b0');
- SET res=rec1.a;
-END;
-$$
-DELIMITER ;$$
-CALL p1(@res);
-SELECT @res;
-SET @res=NULL;
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-
---echo #
---echo # Testing Item_splocal_row_field_by_name::print
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec ROW TYPE OF t1 DEFAULT ROW(10,'bb');
- EXPLAIN EXTENDED SELECT rec.a, rec.b;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
---echo #
---echo # Non-existing field
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec ROW TYPE OF t1;
- SELECT rec.c;
-END;
-$$
-DELIMITER ;$$
---error ER_ROW_VARIABLE_DOES_NOT_HAVE_FIELD
-CALL p1();
-ALTER TABLE t1 ADD c INT;
-CALL p1();
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-
---echo #
---echo # Testing that field names are case insensitive
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec ROW TYPE OF t1 DEFAULT ROW(10,'bb');
- SELECT rec.A, rec.B;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-
---echo #
---echo # Testing that table ROW TYPE uses temporary tables vs shadowed real tables
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-CREATE TEMPORARY TABLE t1 (x INT, y VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec ROW TYPE OF t1 DEFAULT ROW(10,'bb');
- SELECT rec.A, rec.B;
-END;
-$$
-DELIMITER ;$$
---error ER_ROW_VARIABLE_DOES_NOT_HAVE_FIELD
-CALL p1();
-DROP TEMPORARY TABLE t1;
-CALL p1();
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
---echo #
---echo # Testing that the structure of table ROW TYPE variables is determined at the very beginning and is not changed after ALTER
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(32));
-INSERT INTO t1 VALUES (10,'b10');
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- ALTER TABLE t1 ADD c INT;
- BEGIN
- DECLARE rec ROW TYPE OF t1; -- this will not have column "c"
- SET rec.c=10;
- END;
-END;
-$$
-DELIMITER ;$$
---error ER_ROW_VARIABLE_DOES_NOT_HAVE_FIELD
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # SELECT INTO + table ROW TYPE variable with a wrong column count
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(32));
-INSERT INTO t1 VALUES (10,'b10');
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec1 ROW TYPE OF t1;
- SELECT 10,'a','b' FROM t1 INTO rec1;
- SELECT rec1.a, rec1.b;
-END;
-$$
-DELIMITER ;$$
---error ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
---echo #
---echo # SELECT INTO + multiple table ROW TYPE variables
---echo #
-CREATE TABLE t1 (a INT, b VARCHAR(32));
-INSERT INTO t1 VALUES (10,'b10');
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec1 ROW TYPE OF t1;
- SELECT 10,'a' FROM t1 INTO rec1, rec1;
- SELECT rec1.a, rec1.b;
-END;
-$$
-DELIMITER ;$$
---error ER_OPERAND_COLUMNS
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # SELECT INTO + table ROW TYPE working example
---echo #
-CREATE TABLE t1 (a INT, b VARCHAR(32));
-INSERT INTO t1 VALUES (10,'b10');
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec1 ROW TYPE OF t1;
- SELECT * FROM t1 INTO rec1;
- SELECT rec1.a, rec1.b;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # End of MDEV-12461 TYPE OF and ROW TYPE OF anchored data types
---echo #
-
-
---echo #
---echo # MDEV-12347 Valgrind reports invalid read errors in Item_field_row::element_index_by_name
---echo #
-
-# An additional test for MDEV-12347, to make sure that
-# Column_definition::interval creates a permanent copy of TYPELIB on
-# the memory root when processing %ROWTYPE for a table with ENUM/SET column,
-# rather than reuses the TYPELIB from table->field[i], which is freed in the
-# end of sp_rcontext::resolve_table_rowtype_ref().
-
-CREATE TABLE t1 (a INT, b ENUM('b0','b1','b12','b3'));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- BEGIN
- DECLARE rec ROW TYPE OF t1;
- SET rec.b='b0';
- SELECT rec.b;
- END;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
-CREATE TABLE t1 (a INT, b SET('b0','b1','b12','b3'));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- BEGIN
- DECLARE rec ROW TYPE OF t1;
- SET rec.b='b0';
- SELECT rec.b;
- END;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # MDEV-13581 ROW TYPE OF t1 and t1%ROWTYPE for routine parameters
---echo #
-
-CREATE TABLE t1 (a INT, b TEXT, c ENUM('a','b','c'));
-DELIMITER $$;
-CREATE PROCEDURE p1 (a ROW TYPE OF t1)
-BEGIN
- CREATE TABLE t2 AS SELECT a.a AS a, a.b AS b, a.c AS c;
- SHOW CREATE TABLE t2;
- DROP TABLE t2;
-END;
-$$
-CREATE PROCEDURE p2()
-BEGIN
- DECLARE a ROW TYPE OF t1;
- CALL p1(a);
-END;
-$$
-DELIMITER ;$$
-CALL p2();
-DROP PROCEDURE p2;
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-
-CREATE TABLE t1 (a INT, b TEXT);
-DELIMITER $$;
-CREATE PROCEDURE p1 (OUT a ROW TYPE OF t1)
-BEGIN
- SET a.a=10;
- SET a.b='text';
-END;
-$$
-CREATE PROCEDURE p2()
-BEGIN
- DECLARE a ROW TYPE OF t1;
- CALL p1(a);
- SELECT a.a, a.b;
-END;
-$$
-CREATE FUNCTION f1(a ROW TYPE OF t1) RETURNS TEXT
-BEGIN
- RETURN CONCAT(a.a, ' ', a.b);
-END;
-$$
-CREATE FUNCTION f2() RETURNS TEXT
-BEGIN
- DECLARE a ROW TYPE OF t1;
- CALL p1(a);
- RETURN f1(a);
-END;
-$$
-DELIMITER ;$$
-CALL p2();
-SELECT f2();
-DROP PROCEDURE p2;
-DROP PROCEDURE p1;
-DROP FUNCTION f2;
-DROP FUNCTION f1;
-DROP TABLE t1;
-
-
-CREATE DATABASE db1;
-CREATE TABLE db1.t1 (a INT, b TEXT);
-DELIMITER $$;
-CREATE PROCEDURE p1 (OUT a ROW TYPE OF db1.t1)
-BEGIN
- SET a.a=10;
- SET a.b='text';
-END;
-$$
-CREATE PROCEDURE p2()
-BEGIN
- DECLARE a ROW TYPE OF db1.t1;
- CALL p1(a);
- SELECT a.a, a.b;
-END;
-$$
-CREATE FUNCTION f1(a ROW TYPE OF db1.t1) RETURNS TEXT
-BEGIN
- RETURN CONCAT(a.a, ' ', a.b);
-END;
-$$
-CREATE FUNCTION f2() RETURNS TEXT
-BEGIN
- DECLARE a ROW TYPE OF db1.t1;
- CALL p1(a);
- RETURN f1(a);
-END;
-$$
-DELIMITER ;$$
-CALL p2();
-SELECT f2();
-DROP PROCEDURE p2;
-DROP PROCEDURE p1;
-DROP FUNCTION f2;
-DROP FUNCTION f1;
-DROP DATABASE db1;
-
---echo #
---echo # MDEV-14139 Anchored data types for variables
---echo #
-
-CREATE TABLE t1 (int11 INT, text0 TEXT);
-DELIMITER $$;
-BEGIN NOT ATOMIC
- DECLARE row1 ROW TYPE OF t1;
- DECLARE a_row1 TYPE OF row1;
- DECLARE aa_row1 TYPE OF a_row1;
- CREATE TABLE t2 AS SELECT a_row1.int11 AS int11, a_row1.text0 AS text0;
- SHOW CREATE TABLE t2;
- DROP TABLE t2;
- CREATE TABLE t2 AS SELECT aa_row1.int11 AS int11, aa_row1.text0 AS text0;
- SHOW CREATE TABLE t2;
- DROP TABLE t2;
-END;
-$$
-DELIMITER ;$$
-DROP TABLE t1;
diff --git a/mysql-test/t/sp-anchor-type.test b/mysql-test/t/sp-anchor-type.test
deleted file mode 100644
index 7f952d626e0..00000000000
--- a/mysql-test/t/sp-anchor-type.test
+++ /dev/null
@@ -1,762 +0,0 @@
-
---echo #
---echo # Start of 10.3 tests
---echo #
-
---echo #
---echo # MDEV-12461 TYPE OF and ROW TYPE OF anchored data types
---echo #
-
---echo #
---echo # Missing table
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a TYPE OF t1.a;
-END;
-$$
-DELIMITER ;$$
---error ER_NO_SUCH_TABLE
-CALL p1();
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Missing column
---echo #
-
-CREATE TABLE t1 (b INT);
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a TYPE OF t1.a;
-END;
-$$
-DELIMITER ;$$
---error ER_BAD_FIELD_ERROR
-CALL p1();
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-
---echo #
---echo # One TYPE OF variable
---echo #
-
-CREATE TABLE t1 (a INT);
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a TYPE OF t1.a;
- SET a= 123;
- SELECT a;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
---echo #
---echo # Two TYPE OF variables, with a truncation warning on assignment
---echo #
-
-SET sql_mode='';
-CREATE TABLE t1 (a TINYINT, b INT);
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a TYPE OF t1.a;
- DECLARE b TYPE OF t1.b;
- SET a= 200;
- SET b= 200;
- SELECT a, b;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP PROCEDURE p1;
-DROP TABLE t1;
-SET sql_mode=DEFAULT;
-
-
---echo #
---echo # TYPE OF variables for fields with various attributes
---echo #
-
-CREATE TABLE t1 (
- id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
- a TINYINT NOT NULL,
- b INT NOT NULL,
- ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- UNIQUE(a)
-);
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE id TYPE OF t1.id;
- DECLARE a TYPE OF t1.a;
- DECLARE b TYPE OF t1.b;
- DECLARE ts TYPE OF t1.ts;
- SELECT id, a, b, ts;
- CREATE TABLE t2 AS SELECT id, a, b, ts;
- SHOW CREATE TABLE t2;
- DROP TABLE t2;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-
---echo #
---echo # TYPE OF + virtual columns
---echo #
-
-CREATE TABLE t1 (
- a INT NOT NULL,
- b VARCHAR(32),
- c INT AS (a + 10) VIRTUAL,
- d VARCHAR(5) AS (left(b,5)) PERSISTENT
-);
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE c TYPE OF t1.c;
- DECLARE d TYPE OF t1.d;
- SELECT c, d;
- CREATE TABLE t2 AS SELECT c, d;
- SHOW CREATE TABLE t2;
- DROP TABLE t2;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-
---echo #
---echo # TYPE OF + the ZEROFILL attribute
---echo #
-
-CREATE TABLE t1 (
- dz DECIMAL(10,3) ZEROFILL
-);
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE dzr TYPE OF t1.dz DEFAULT 10;
- DECLARE dzt DECIMAL(10,3) ZEROFILL DEFAULT 10;
- SELECT dzr, dzt;
- CREATE TABLE t2 AS SELECT dzr,dzt;
- SHOW CREATE TABLE t2;
- DROP TABLE t2;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-
---echo #
---echo # Temporary tables shadow real tables for TYPE OF purposes
---echo #
-CREATE TABLE t1 (a VARCHAR(10));
-INSERT INTO t1 VALUES ('t1');
-CREATE TEMPORARY TABLE t1 (a INT);
-INSERT INTO t1 VALUES (10);
-SELECT * FROM t1;
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a TYPE OF t1.a DEFAULT 11;
- CREATE TABLE t2 AS SELECT a;
-END;
-$$
-DELIMITER ;$$
---echo #
---echo # Should use INT(11) as TYPE OF, as in the temporary table
---echo #
-CALL p1();
-SHOW CREATE TABLE t2;
-SELECT * FROM t2;
-DROP TABLE t2;
-SELECT * FROM t1;
-DROP TEMPORARY TABLE t1;
-SELECT * FROM t1;
---echo #
---echo # Should use VARCHAR(10) as TYPE OF, as in the real table
---echo #
-CALL p1();
-SHOW CREATE TABLE t2;
-SELECT * FROM t2;
-DROP TABLE t2;
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-
---echo #
---echo # "TYPE OF t1.a" searches for "t1" in the current database
---echo #
-
-CREATE TABLE t1 (a VARCHAR(10));
-CREATE DATABASE test1;
-CREATE TABLE test1.t1 (a INT);
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a TYPE OF t1.a DEFAULT 11;
- CREATE TABLE test.t2 AS SELECT a;
-END;
-$$
-DELIMITER ;$$
-
---echo #
---echo # This interprets "TYPE OF t1.a" as VARCHAR(10), as in test.t1.a
---echo #
-
-USE test;
-CALL test.p1();
-SHOW CREATE TABLE test.t2;
-DROP TABLE test.t2;
-
---echo #
---echo # This interprets "TYPE OF t1.a" as INT, as in test1.t1.a
---echo #
-
-USE test1;
-CALL test.p1();
-SHOW CREATE TABLE test.t2;
-DROP TABLE test.t2;
-
---echo #
---echo # Error if there is no an active database
---echo #
-
-DROP DATABASE test1;
---error ER_NO_DB_ERROR
-CALL test.p1();
-
-USE test;
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-
---echo #
---echo # A reference to a table in a non-existing database
---echo #
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a TYPE OF test1.t1.a;
- CREATE TABLE t1 AS SELECT a;
-END;
-$$
-DELIMITER ;$$
---error ER_NO_SUCH_TABLE
-CALL p1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # A reference to a table in a different database
---echo #
-CREATE TABLE t1(a INT);
-CREATE DATABASE test1;
-CREATE TABLE test1.t1 (a VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a TYPE OF t1.a;
- DECLARE b TYPE OF test1.t1.a;
- CREATE TABLE t2 AS SELECT a,b;
-END;
-$$
-DELIMITER ;$$
-CALL p1;
-SHOW CREATE TABLE t2;
-DROP PROCEDURE p1;
-DROP TABLE t2;
-DROP DATABASE test1;
-DROP TABLE t1;
-
-
---echo #
---echo # Using a table before it appears in a TYPE OF declaration + multiple TYPE OF declarations
---echo #
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-INSERT INTO t1 (a,b) VALUES (10,'b10');
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- INSERT INTO t1 (a,b) VALUES (11, 'b11');
- SELECT * FROM t1;
- BEGIN
- DECLARE va TYPE OF t1.a DEFAULT 30;
- DECLARE vb TYPE OF t1.b DEFAULT 'b30';
- INSERT INTO t1 (a,b) VALUES (12,'b12');
- SELECT * FROM t1;
- INSERT INTO t1 (a,b) VALUES (va, vb);
- SELECT * FROM t1;
- END;
- BEGIN
- DECLARE va TYPE OF t1.a DEFAULT 40;
- DECLARE vb TYPE OF t1.b DEFAULT 'b40';
- INSERT INTO t1 (a,b) VALUES (va,vb);
- SELECT * FROM t1;
- END;
-END;
-$$
-DELIMITER ;$$
-CALL p1;
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # TYPE OF variables + TABLE vs VIEW
---echo #
-
-CREATE TABLE t1 (
- bit6 BIT(6),
- bit7 BIT(7),
- bit8 BIT(8),
- i1 TINYINT,
- i2 SMALLINT,
- i3 MEDIUMINT,
- i4 INT,
- i8 BIGINT,
- ff FLOAT,
- fd DOUBLE,
- cc CHAR(10),
- cv VARCHAR(10),
- cvu VARCHAR(10) CHARACTER SET utf8,
- t1 TINYTEXT,
- t2 TEXT,
- t3 MEDIUMTEXT,
- t4 LONGTEXT,
- enum1 ENUM('a','b','c'),
- set1 SET('a','b','c'),
- blob1 TINYBLOB,
- blob2 BLOB,
- blob3 MEDIUMBLOB,
- blob4 LONGBLOB,
- yy YEAR,
- dd DATE,
- tm0 TIME,
- tm3 TIME(3),
- tm6 TIME(6),
- dt0 DATETIME,
- dt3 DATETIME(3),
- dt6 DATETIME(6),
- ts0 TIMESTAMP,
- ts3 TIMESTAMP(3),
- ts6 TIMESTAMP(6),
- dc100 DECIMAL(10,0),
- dc103 DECIMAL(10,3),
- dc209 DECIMAL(20,9)
-);
-
-
-DELIMITER $$;
-CREATE PROCEDURE p1(command enum('create','select'))
-BEGIN
- DECLARE bit6 TYPE OF t1.bit6 DEFAULT 0x30;
- DECLARE bit7 TYPE OF t1.bit7 DEFAULT 0x41;
- DECLARE bit8 TYPE OF t1.bit8 DEFAULT 0x7E;
- DECLARE i1 TYPE OF t1.i1 DEFAULT 11;
- DECLARE i2 TYPE OF t1.i2 DEFAULT 12;
- DECLARE i3 TYPE OF t1.i3 DEFAULT 13;
- DECLARE i4 TYPE OF t1.i4 DEFAULT 14;
- DECLARE i8 TYPE OF t1.i8 DEFAULT 18;
- DECLARE ff TYPE OF t1.ff DEFAULT 21;
- DECLARE fd TYPE OF t1.fd DEFAULT 22;
- DECLARE cc TYPE OF t1.cc DEFAULT 'char';
- DECLARE cv TYPE OF t1.cv DEFAULT 'varchar';
- DECLARE cvu TYPE OF t1.cvu DEFAULT 'varcharu8';
- DECLARE t1 TYPE OF t1.t1 DEFAULT 'text1';
- DECLARE t2 TYPE OF t1.t2 DEFAULT 'text2';
- DECLARE t3 TYPE OF t1.t3 DEFAULT 'text3';
- DECLARE t4 TYPE OF t1.t4 DEFAULT 'text4';
- DECLARE enum1 TYPE OF t1.enum1 DEFAULT 'b';
- DECLARE set1 TYPE OF t1.set1 DEFAULT 'a,c';
- DECLARE blob1 TYPE OF t1.blob1 DEFAULT 'blob1';
- DECLARE blob2 TYPE OF t1.blob2 DEFAULT 'blob2';
- DECLARE blob3 TYPE OF t1.blob3 DEFAULT 'blob3';
- DECLARE blob4 TYPE OF t1.blob4 DEFAULT 'blob4';
- DECLARE yy TYPE OF t1.yy DEFAULT 2001;
- DECLARE dd TYPE OF t1.dd DEFAULT '2001-01-01';
- DECLARE tm0 TYPE OF t1.tm0 DEFAULT '00:00:01';
- DECLARE tm3 TYPE OF t1.tm3 DEFAULT '00:00:03.333';
- DECLARE tm6 TYPE OF t1.tm6 DEFAULT '00:00:06.666666';
- DECLARE dt0 TYPE OF t1.dt0 DEFAULT '2001-01-01 00:00:01';
- DECLARE dt3 TYPE OF t1.dt3 DEFAULT '2001-01-03 00:00:01.333';
- DECLARE dt6 TYPE OF t1.dt6 DEFAULT '2001-01-06 00:00:01.666666';
- DECLARE ts0 TYPE OF t1.ts0 DEFAULT '2002-01-01 00:00:01';
- DECLARE ts3 TYPE OF t1.ts3 DEFAULT '2002-01-03 00:00:01.333';
- DECLARE ts6 TYPE OF t1.ts6 DEFAULT '2002-01-06 00:00:01.666666';
- DECLARE dc100 TYPE OF t1.dc100 DEFAULT 10;
- DECLARE dc103 TYPE OF t1.dc103 DEFAULT 10.123;
- DECLARE dc209 TYPE OF t1.dc209 DEFAULT 10.123456789;
- CASE
- WHEN command='create' THEN
- CREATE TABLE t2 AS SELECT
- bit6, bit7, bit8,
- i1,i2,i3,i4,i8,
- ff,fd, dc100, dc103, dc209,
- cc,cv,cvu,
- t1,t2,t3,t4,
- enum1, set1,
- blob1, blob2, blob3, blob4,
- dd, yy,
- tm0, tm3, tm6,
- dt0, dt3, dt6,
- ts0, ts3, ts6;
- WHEN command='select' THEN
- SELECT
- bit6, bit7, bit8,
- i1,i2,i3,i4,i8,
- ff,fd, dc100, dc103, dc209,
- cc,cv,cvu,
- t1,t2,t3,t4,
- enum1, set1,
- blob1, blob2, blob3, blob4,
- dd, yy,
- tm0, tm3, tm6,
- dt0, dt3, dt6,
- ts0, ts3, ts6;
- END CASE;
-END;
-$$
-DELIMITER ;$$
-
---echo #
---echo # TABLE
---echo #
-CALL p1('create');
-SHOW CREATE TABLE t2;
---vertical_results
-SELECT * FROM t2;
---horizontal_results
-DROP TABLE t2;
-
---disable_ps_protocol
---enable_metadata
---vertical_results
-CALL p1('select');
---horizontal_results
---disable_metadata
---enable_ps_protocol
-
---echo #
---echo # VIEW
---echo #
-ALTER TABLE t1 RENAME t0;
-CREATE VIEW t1 AS SELECT * FROM t0;
-
-CALL p1('create');
-SHOW CREATE TABLE t2;
---vertical_results
-SELECT * FROM t2;
---horizontal_results
-DROP TABLE t2;
-
---disable_ps_protocol
---enable_metadata
---vertical_results
-CALL p1('select');
---horizontal_results
---disable_metadata
---enable_ps_protocol
-
-DROP VIEW t1;
-DROP TABLE t0;
-
-DROP PROCEDURE p1;
-
---echo #
---echo # VIEW with subqueries
---echo #
-CREATE TABLE t1 (a INT,b INT);
-INSERT INTO t1 VALUES (10,1),(20,2),(30,3),(40,4);
-SELECT AVG(a) FROM t1;
-CREATE VIEW v1 AS SELECT a,1 as b FROM t1 WHERE a>(SELECT AVG(a) FROM t1) AND b>(SELECT 1);
-SELECT * FROM v1;
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a TYPE OF v1.a DEFAULT 10;
- DECLARE b TYPE OF v1.b DEFAULT 1;
- SELECT a,b;
-END;
-$$
-DELIMITER ;$$
-CALL p1;
-DROP PROCEDURE p1;
-DELIMITER $$;
-CREATE FUNCTION f1() RETURNS INT
-BEGIN
- DECLARE a TYPE OF v1.a DEFAULT 10;
- DECLARE b TYPE OF v1.b DEFAULT 1;
- RETURN a+b;
-END;
-$$
-DELIMITER ;$$
-SELECT f1();
-DROP FUNCTION f1;
-DROP VIEW v1;
-DROP TABLE t1;
-
-
---echo #
---echo # TYPE OF variables + INFORMATION_SCHEMA
---echo #
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE tables_table_name TYPE OF INFORMATION_SCHEMA.TABLES.TABLE_NAME;
- DECLARE tables_table_rows TYPE OF INFORMATION_SCHEMA.TABLES.TABLE_ROWS;
- DECLARE processlist_info TYPE OF INFORMATION_SCHEMA.PROCESSLIST.INFO;
- DECLARE processlist_info_binary TYPE OF INFORMATION_SCHEMA.PROCESSLIST.INFO_BINARY;
- CREATE TABLE t1 AS SELECT
- tables_table_name,
- tables_table_rows,
- processlist_info,
- processlist_info_binary;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # TYPE OF + Table structure change
---echo # Data type for both a0 and a1 is chosen in the very beginning
---echo #
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a0 TYPE OF t1.a;
- ALTER TABLE t1 MODIFY a VARCHAR(10); -- This does not affect a1
- BEGIN
- DECLARE a1 TYPE OF t1.a;
- CREATE TABLE t2 AS SELECT a0, a1;
- SHOW CREATE TABLE t2;
- DROP TABLE t2;
- END;
-END
-$$
-DELIMITER ;$$
-CREATE TABLE t1 (a INT);
-CALL p1;
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # TYPE OF in parameters
---echo #
-CREATE TABLE t1 (a VARCHAR(10));
-CREATE DATABASE test1;
-CREATE TABLE test1.t1 (b SMALLINT);
-DELIMITER $$;
-CREATE PROCEDURE p1(a TYPE OF t1.a, b TYPE OF test1.t1.b)
-BEGIN
- CREATE TABLE t2 AS SELECT a, b;
-END;
-$$
-DELIMITER ;$$
-CALL p1('test', 123);
-SHOW CREATE TABLE t2;
-SELECT * FROM t2;
-DROP TABLE t2;
-DROP PROCEDURE p1;
-DROP TABLE test1.t1;
-DROP DATABASE test1;
-DROP TABLE t1;
-
---echo #
---echo # TYPE OF in a stored function variables and arguments
---echo #
-
-CREATE TABLE t1 (a INT);
-DELIMITER $$;
-CREATE FUNCTION f1 (prm TYPE OF t1.a) RETURNS INT
-BEGIN
- DECLARE a TYPE OF t1.a DEFAULT prm;
- RETURN a;
-END;
-$$
-DELIMITER ;$$
-SELECT f1(20);
-DROP FUNCTION f1;
-DROP TABLE t1;
-
-
---echo #
---echo # TYPE OF in function RETURN clause is not supported yet
---echo #
-DELIMITER $$;
---error ER_PARSE_ERROR
-CREATE FUNCTION f1() RETURN TYPE OF t1.a
-BEGIN
- RETURN 0;
-END;
-$$
-DELIMITER ;$$
-
-
---echo #
---echo # Using TYPE OF variables as FETCH targets
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10),c DATETIME(3));
-INSERT INTO t1 VALUES (1,'b1','2001-01-01 10:20:30.123');
-INSERT INTO t1 VALUES (2,'b2','2001-01-02 10:20:30.123');
-CREATE TABLE t2 LIKE t1;
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE done INT DEFAULT 0;
- DECLARE v_a TYPE OF t1.a;
- DECLARE v_b TYPE OF t1.b;
- DECLARE v_c TYPE OF t1.c;
- DECLARE c CURSOR FOR SELECT a,b,c FROM t1;
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=TRUE;
- OPEN c;
- read_loop: LOOP
- FETCH c INTO v_a, v_b, v_c;
- IF done THEN
- LEAVE read_loop;
- END IF;
- INSERT INTO t2 (a,b,c) VALUES (v_a, v_b, v_c);
- END LOOP;
- CLOSE c;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-SELECT * FROM t2;
-DROP TABLE t2;
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-
---echo #
---echo # Using TYPE OF variables as SELECT INTO targets
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10),c DATETIME(3));
-INSERT INTO t1 VALUES (1,'b1','2001-01-01 10:20:30.123');
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE v_a TYPE OF t1.a;
- DECLARE v_b TYPE OF t1.b;
- DECLARE v_c TYPE OF t1.c;
- SELECT * FROM t1 INTO v_a, v_b, v_c;
- SELECT v_a, v_b, v_c;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
---echo #
---echo # End of MDEV-12461 TYPE OF and ROW TYPE OF anchored data types
---echo #
-
---echo #
---echo # MDEV-14139 Anchored data types for variables
---echo #
-
-DELIMITER $$;
---error ER_SP_UNDECLARED_VAR
-BEGIN NOT ATOMIC
- DECLARE a TYPE OF a;
-END;
-$$
-DELIMITER ;$$
-
-
-DELIMITER $$;
-BEGIN NOT ATOMIC
- DECLARE int11 INT;
- DECLARE dec103 DECIMAL(10,3);
- DECLARE flt0 FLOAT;
- DECLARE dbl0 DOUBLE;
- DECLARE enum0 ENUM('a','b');
- DECLARE bit3 BIT(3);
-
- DECLARE varchar10 VARCHAR(10);
- DECLARE text1 TEXT;
- DECLARE tinytext1 TINYTEXT;
- DECLARE mediumtext1 MEDIUMTEXT;
- DECLARE longtext1 LONGTEXT;
-
- DECLARE time3 TIME(3);
- DECLARE datetime4 DATETIME(4);
- DECLARE timestamp5 TIMESTAMP(5);
- DECLARE date0 DATE;
-
- DECLARE a_int11 TYPE OF int11;
- DECLARE a_dec103 TYPE OF dec103;
- DECLARE a_flt0 TYPE OF flt0;
- DECLARE a_dbl0 TYPE OF dbl0;
- DECLARE a_bit3 TYPE OF bit3;
- DECLARE a_enum0 TYPE OF enum0;
- DECLARE a_varchar10 TYPE OF varchar10;
- DECLARE a_text1 TYPE OF text1;
- DECLARE a_tinytext1 TYPE OF tinytext1;
- DECLARE a_mediumtext1 TYPE OF mediumtext1;
- DECLARE a_longtext1 TYPE OF longtext1;
- DECLARE a_time3 TYPE OF time3;
- DECLARE a_datetime4 TYPE OF datetime4;
- DECLARE a_timestamp5 TYPE OF timestamp5;
- DECLARE a_date0 TYPE OF date0;
-
- DECLARE aa_int11 TYPE OF a_int11;
- DECLARE aa_dec103 TYPE OF a_dec103;
- DECLARE aa_flt0 TYPE OF a_flt0;
- DECLARE aa_dbl0 TYPE OF a_dbl0;
- DECLARE aa_bit3 TYPE OF a_bit3;
- DECLARE aa_enum0 TYPE OF a_enum0;
- DECLARE aa_varchar10 TYPE OF a_varchar10;
- DECLARE aa_text1 TYPE OF a_text1;
- DECLARE aa_tinytext1 TYPE OF a_tinytext1;
- DECLARE aa_mediumtext1 TYPE OF a_mediumtext1;
- DECLARE aa_longtext1 TYPE OF a_longtext1;
- DECLARE aa_time3 TYPE OF a_time3;
- DECLARE aa_datetime4 TYPE OF a_datetime4;
- DECLARE aa_timestamp5 TYPE OF a_timestamp5;
- DECLARE aa_date0 TYPE OF a_date0;
-
- CREATE TABLE t1 AS
- SELECT a_int11,a_dec103,a_flt0,a_dbl0,a_bit3,
- a_enum0,a_varchar10,
- a_text1,a_tinytext1,a_mediumtext1,a_longtext1,
- a_time3,a_datetime4,a_timestamp5,a_date0;
- SHOW CREATE TABLE t1;
- DROP TABLE t1;
-
- CREATE TABLE t1 AS
- SELECT aa_int11,aa_dec103,aa_flt0,aa_dbl0,aa_bit3,
- aa_enum0,aa_varchar10,
- aa_text1,aa_tinytext1,aa_mediumtext1,aa_longtext1,
- aa_time3,aa_datetime4,aa_timestamp5,aa_date0;
- SHOW CREATE TABLE t1;
- DROP TABLE t1;
-
-END;
-$$
-DELIMITER ;$$
diff --git a/mysql-test/t/sp-big.test b/mysql-test/t/sp-big.test
deleted file mode 100644
index 4220541697e..00000000000
--- a/mysql-test/t/sp-big.test
+++ /dev/null
@@ -1,117 +0,0 @@
-#
-# Bug #11602: SP with very large body not handled well
-#
-source include/have_sequence.inc;
-
-create table t1 (a int);
-insert into t1 values (1),(2),(3);
-
-let $body=`select repeat('select count(*) into out1 from t1;\n', 3072)`;
-
-delimiter //;
---disable_query_log
-eval select length('$body') as length//
-eval create procedure test.longprocedure (out out1 int) deterministic
-begin
- $body
-end//
---enable_query_log
-
-delimiter ;//
-
-# this is larger than the length above, because it includes the 'begin' and
-# 'end' bits and some whitespace
-select length(routine_definition) from information_schema.routines where routine_schema = 'test' and routine_name = 'longprocedure';
-
-call test.longprocedure(@value); select @value;
-
-drop procedure test.longprocedure;
-drop table t1;
-#
-# Bug #9819 "Cursors: Mysql Server Crash while fetching from table with 5
-# million records.":
-# To really test the bug, increase the number of loop iterations ($1).
-# For 4 millions set $1 to 22.
-create table t1 (f1 char(100) , f2 mediumint , f3 int , f4 real, f5 numeric);
-insert into t1 (f1, f2, f3, f4, f5) values
-("This is a test case for for Bug#9819", 1, 2, 3.0, 4.598);
-create table t2 like t1;
-let $1=8;
---disable_query_log
---disable_result_log
-begin;
-while ($1)
-{
- eval insert into t1 select * from t1;
- dec $1;
-}
-commit;
---enable_result_log
---enable_query_log
-select count(*) from t1;
-select count(*) from t2;
---disable_warnings
-drop procedure if exists p1;
---enable_warnings
-delimiter |;
-create procedure p1()
-begin
- declare done integer default 0;
- declare vf1 char(100) ;
- declare vf2 mediumint;
- declare vf3 int ;
- declare vf4 real ;
- declare vf5 numeric ;
- declare cur1 cursor for select f1,f2,f3,f4,f5 from t1;
- declare continue handler for sqlstate '02000' set done = 1;
- open cur1;
- while done <> 1 do
- fetch cur1 into vf1, vf2, vf3, vf4, vf5;
- if not done then
- insert into t2 values (vf1, vf2, vf3, vf4, vf5);
- end if;
- end while;
- close cur1;
-end|
-delimiter ;|
-call p1();
-select count(*) from t1;
-select count(*) from t2;
-select f1 from t1 limit 1;
-select f1 from t2 limit 1;
-drop procedure p1;
-drop table t1, t2;
-
-#
-# Loops with many iterations
-# (Item_equal must be created in the execution arena)
-#
-create table t1 (
- `id1` int unsigned not null default '0',
- `id2` int unsigned not null default '0',
- `link_type` int unsigned not null default '0',
- `visibility` tinyint not null default '0',
- `data` varchar(255) not null default '',
- `time` int unsigned not null default '0',
- `version` int unsigned not null default '0',
- primary key (id1, link_type, visibility, id2)
-) default collate=latin1_bin;
-
-delimiter //;
-create procedure select_test()
-begin
- declare id1_cond int;
- set id1_cond = 1;
- while id1_cond <= 10000 do
- select count(*) as cnt from (select id1 from t1 force index (primary) where id1 = id1_cond and link_type = 1 and visibility = 1 order by id2 desc) as t into @cnt;
- set id1_cond = id1_cond + 1;
- end while;
-end//
-delimiter ;//
-
-insert t1 select seq, seq, 1, 1, seq, seq, seq from seq_1_to_2000;
-set @before=unix_timestamp();
-call select_test();
-select unix_timestamp() - @before < 60;
-drop procedure select_test;
-drop table t1;
diff --git a/mysql-test/t/sp-bugs.test b/mysql-test/t/sp-bugs.test
deleted file mode 100644
index 3239dfeaeec..00000000000
--- a/mysql-test/t/sp-bugs.test
+++ /dev/null
@@ -1,323 +0,0 @@
-# Test file for stored procedure bugfixes
-
---echo #
---echo # Bug #47412: Valgrind warnings / user can read uninitalized memory
---echo # using SP variables
---echo #
-
-CREATE SCHEMA testdb;
-USE testdb;
-DELIMITER |;
-CREATE FUNCTION f2 () RETURNS INTEGER
-BEGIN
- DECLARE CONTINUE HANDLER FOR SQLSTATE '42000' SET @aux = 1;
- RETURN f_not_exists () ;
-END|
-CREATE PROCEDURE p3 ( arg1 VARCHAR(32) )
-BEGIN
- CALL p_not_exists ( );
-END|
-DELIMITER ;|
---echo # should not return valgrind warnings
---error ER_SP_DOES_NOT_EXIST
-CALL p3 ( f2 () );
-
-DROP SCHEMA testdb;
-
-CREATE SCHEMA testdb;
-USE testdb;
-DELIMITER |;
-CREATE FUNCTION f2 () RETURNS INTEGER
-BEGIN
- DECLARE CONTINUE HANDLER FOR SQLSTATE '42000' SET @aux = 1;
- RETURN f_not_exists () ;
-END|
-CREATE PROCEDURE p3 ( arg2 INTEGER )
-BEGIN
- CALL p_not_exists ( );
-END|
-DELIMITER ;|
---echo # should not return valgrind warnings
---error ER_SP_DOES_NOT_EXIST
-CALL p3 ( f2 () );
-
-DROP SCHEMA testdb;
-
-CREATE SCHEMA testdb;
-USE testdb;
-DELIMITER |;
-CREATE FUNCTION f2 () RETURNS INTEGER
-BEGIN
- DECLARE CONTINUE HANDLER FOR SQLSTATE '42000' SET @aux = 1;
- RETURN f_not_exists () ;
-END|
-DELIMITER ;|
---echo # should not return valgrind warnings
-SELECT f2 ();
-
-DROP SCHEMA testdb;
-
-USE test;
-
---echo #
---echo # Bug#50423: Crash on second call of a procedure dropping a trigger
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP TRIGGER IF EXISTS tr1;
-DROP PROCEDURE IF EXISTS p1;
---enable_warnings
-
-CREATE TABLE t1 (f1 INTEGER);
-CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET @aux = 1;
-CREATE PROCEDURE p1 () DROP TRIGGER tr1;
-
-CALL p1 ();
---error ER_TRG_DOES_NOT_EXIST
-CALL p1 ();
-
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
---echo #
---echo # Bug#50423: Crash on second call of a procedure dropping a trigger
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP TRIGGER IF EXISTS tr1;
-DROP PROCEDURE IF EXISTS p1;
---enable_warnings
-
-CREATE TABLE t1 (f1 INTEGER);
-CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET @aux = 1;
-CREATE PROCEDURE p1 () DROP TRIGGER tr1;
-
-CALL p1 ();
---error ER_TRG_DOES_NOT_EXIST
-CALL p1 ();
-
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
---echo #
---echo # Bug#54375: Error in stored procedure leaves connection
---echo # in different default schema
---echo #
-
---disable_warnings
-SET @@SQL_MODE = 'STRICT_ALL_TABLES';
-DROP DATABASE IF EXISTS db1;
-CREATE DATABASE db1;
-USE db1;
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (c1 int NOT NULL PRIMARY KEY);
-INSERT INTO t1 VALUES (1);
-DELIMITER $$;
-CREATE FUNCTION f1 (
- some_value int
-)
-RETURNS smallint
-DETERMINISTIC
-BEGIN
- INSERT INTO t1 SET c1 = some_value;
- RETURN(LAST_INSERT_ID());
-END$$
-DELIMITER ;$$
-DROP DATABASE IF EXISTS db2;
-CREATE DATABASE db2;
---enable_warnings
-USE db2;
-SELECT DATABASE();
---error ER_DUP_ENTRY
-SELECT db1.f1(1);
-SELECT DATABASE();
-USE test;
-DROP FUNCTION db1.f1;
-DROP TABLE db1.t1;
-DROP DATABASE db1;
-DROP DATABASE db2;
-USE test;
-
---echo #
---echo # Bug#13105873:valgrind warning:possible crash in foreign
---echo # key handling on subsequent create table if not exists
---echo #
-
---disable_warnings
-DROP DATABASE IF EXISTS testdb;
---enable_warnings
-CREATE DATABASE testdb;
-USE testdb;
-CREATE TABLE t1 (id1 INT PRIMARY KEY);
-DELIMITER $;
-CREATE PROCEDURE `p1`()
-BEGIN
- CREATE TABLE IF NOT EXISTS t2(id INT PRIMARY KEY,
- CONSTRAINT FK FOREIGN KEY (id) REFERENCES t1( id1 ));
-END$
-DELIMITER ;$
-CALL p1();
---echo # below stmt should not return valgrind warnings
-CALL p1();
-DROP DATABASE testdb;
-USE test;
-
---echo End of 5.1 tests
-
---echo #
---echo # BUG#13489996 valgrind:conditional jump or move depends on
---echo # uninitialised values-field_blob
---echo #
-
-CREATE FUNCTION sf() RETURNS BLOB RETURN "";
-SELECT sf();
-DROP FUNCTION sf;
-
---echo #
---echo # Bug#11763507 - 56224: FUNCTION NAME IS CASE-SENSITIVE
---echo #
-SET @@SQL_MODE = '';
-DELIMITER $;
-CREATE FUNCTION testf_bug11763507() RETURNS INT
-BEGIN
- RETURN 0;
-END
-$
-
-CREATE PROCEDURE testp_bug11763507()
-BEGIN
- SELECT "PROCEDURE testp_bug11763507";
-END
-$
-
-DELIMITER ;$
-
-# STORED FUNCTIONS
-SELECT testf_bug11763507();
-SELECT TESTF_bug11763507();
-
---replace_column 5 # 6 #
-SHOW FUNCTION STATUS LIKE 'testf_bug11763507';
---replace_column 5 # 6 #
-SHOW FUNCTION STATUS WHERE NAME='testf_bug11763507';
---replace_column 5 # 6 #
-SHOW FUNCTION STATUS LIKE 'TESTF_bug11763507';
---replace_column 5 # 6 #
-SHOW FUNCTION STATUS WHERE NAME='TESTF_bug11763507';
-
-SHOW CREATE FUNCTION testf_bug11763507;
-SHOW CREATE FUNCTION TESTF_bug11763507;
-
-# STORED PROCEDURE
-CALL testp_bug11763507();
-CALL TESTP_bug11763507();
-
---replace_column 5 # 6 #
-SHOW PROCEDURE STATUS LIKE 'testp_bug11763507';
---replace_column 5 # 6 #
-SHOW PROCEDURE STATUS WHERE NAME='testp_bug11763507';
---replace_column 5 # 6 #
-SHOW PROCEDURE STATUS LIKE 'TESTP_bug11763507';
---replace_column 5 # 6 #
-SHOW PROCEDURE STATUS WHERE NAME='TESTP_bug11763507';
-
-SHOW CREATE PROCEDURE testp_bug11763507;
-SHOW CREATE PROCEDURE TESTP_bug11763507;
-
-# INFORMATION SCHEMA
-SELECT specific_name FROM INFORMATION_SCHEMA.ROUTINES WHERE specific_name LIKE 'testf_bug11763507';
-SELECT specific_name FROM INFORMATION_SCHEMA.ROUTINES WHERE specific_name LIKE 'TESTF_bug11763507';
-
-SELECT specific_name FROM INFORMATION_SCHEMA.ROUTINES WHERE specific_name='testf_bug11763507';
-SELECT specific_name FROM INFORMATION_SCHEMA.ROUTINES WHERE specific_name='TESTF_bug11763507';
-
-DROP PROCEDURE testp_bug11763507;
-DROP FUNCTION testf_bug11763507;
-
---echo #END OF BUG#11763507 test.
-
---echo #
---echo # MDEV-5531 double call procedure in one session
---echo #
-
-CREATE TABLE `t1` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `create_ts` int(10) unsigned DEFAULT '0',
- PRIMARY KEY (`id`)
-) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
-
-DELIMITER $$;
-
-CREATE PROCEDURE test_5531 (IN step TINYINT(1))
-BEGIN
- DECLARE counts INT DEFAULT 0;
- DECLARE cur1 CURSOR FOR
-
- SELECT ct.id
- FROM (SELECT NULL) AS z
- JOIN (
- SELECT id
- FROM `t1`
- LIMIT 10
- ) AS ct
- JOIN (SELECT NULL) AS x ON(
- EXISTS(
- SELECT 1
- FROM `t1`
- WHERE id=ct.id
- LIMIT 1
- )
- );
-
- IF step=1 THEN
- TRUNCATE t1;
- REPEAT
- INSERT INTO `t1`
- (create_ts) VALUES
- (UNIX_TIMESTAMP());
-
- SET counts=counts+1;
- UNTIL counts>150 END REPEAT;
-
- SET max_sp_recursion_depth=1;
-
- CALL test_5531(2);
- SET max_sp_recursion_depth=2;
- CALL test_5531(2);
- ELSEIF step=2 THEN
- OPEN cur1; CLOSE cur1;
- END IF;
-END $$
-DELIMITER ;$$
-CALL test_5531(1);
-DROP PROCEDURE test_5531;
-DROP TABLE t1;
-
-#
-# MDEV-6601 Assertion `!thd->in_active_multi_stmt_transa ction() || thd->in_multi_stmt_transaction_mode()' failed on executing a stored procedure with commit
-#
-delimiter |;
-create procedure sp() begin
- commit;
-end|
-delimiter ;|
-start transaction;
-call sp();
-drop procedure sp;
-
---echo #
---echo # MDEV-11146 SP variables of the SET data type erroneously allow values with comma
---echo #
-
-DELIMITER $$;
---error ER_ILLEGAL_VALUE_FOR_TYPE
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a SET('a','b','c','a,b');
- SET a='a,b';
- SELECT a, a+0;
-END;
-$$
-DELIMITER ;$$
diff --git a/mysql-test/t/sp-bugs2.test b/mysql-test/t/sp-bugs2.test
deleted file mode 100644
index 2579e3485c6..00000000000
--- a/mysql-test/t/sp-bugs2.test
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# MDEV-6610 Assertion `thd->is_error() || thd->killed' failed in mysql_execute_command on executing an SP with repeated CREATE TABLE .. SELECT
-#
-CREATE TABLE t1 (i INT);
-SET @a = 2;
-
-CREATE TABLE IF NOT EXISTS t2 (i INT) ENGINE = MyISAM
- AS SELECT * FROM t1;
-CREATE TABLE IF NOT EXISTS t2 (i INT) ENGINE = MyISAM
- AS SELECT * FROM t1;
-DROP TABLE t2;
-
---delimiter |
-CREATE PROCEDURE sp()
-BEGIN
-REPEAT
- CREATE TABLE IF NOT EXISTS t2 (i INT) ENGINE = MyISAM
- AS SELECT * FROM t1;
- SET @a = @a - 1;
-UNTIL @a = 0
-END REPEAT ;
-END |
---delimiter ;
-
-CALL sp();
-
-DROP PROCEDURE sp;
-DROP TABLE t1, t2;
-
diff --git a/mysql-test/t/sp-code.test b/mysql-test/t/sp-code.test
deleted file mode 100644
index 1f2f5191f0a..00000000000
--- a/mysql-test/t/sp-code.test
+++ /dev/null
@@ -1,929 +0,0 @@
-#
-# Test the debugging feature "show procedure/function code <name>"
-#
-
--- source include/have_debug.inc
-
---disable_warnings
-drop procedure if exists empty;
-drop procedure if exists code_sample;
---enable_warnings
-
-create procedure empty()
-begin
-end;
-show procedure code empty;
-drop procedure empty;
-
-create function almost_empty()
- returns int
- return 0;
-show function code almost_empty;
-drop function almost_empty;
-
-delimiter //;
-create procedure code_sample(x int, out err int, out nulls int)
-begin
- declare count int default 0;
-
- set nulls = 0;
- begin
- declare c cursor for select name from t1;
- declare exit handler for not found close c;
-
- open c;
- loop
- begin
- declare n varchar(20);
- declare continue handler for sqlexception set err=1;
-
- fetch c into n;
- if isnull(n) then
- set nulls = nulls + 1;
- else
- set count = count + 1;
- update t2 set idx = count where name=n;
- end if;
- end;
- end loop;
- end;
- select t.name, t.idx from t2 t order by idx asc;
-end//
-delimiter ;//
-show procedure code code_sample;
-drop procedure code_sample;
-
-
-#
-# BUG#15737: Stored procedure optimizer bug with LEAVE
-#
-# This is a much more extensive test case than is strictly needed,
-# but it was kept as is for two reasons:
-# - The bug occurs under some quite special circumstances, so it
-# wasn't trivial to create a smaller test,
-# - There's some value in having another more complex code sample
-# in this test file. This might catch future code generation bugs
-# that doesn't show in behaviour in any obvious way.
-
---disable_warnings
-drop procedure if exists sudoku_solve;
---enable_warnings
-
-delimiter //;
-create procedure sudoku_solve(p_naive boolean, p_all boolean)
- deterministic
- modifies sql data
-begin
- drop temporary table if exists sudoku_work, sudoku_schedule;
-
- create temporary table sudoku_work
- (
- row smallint not null,
- col smallint not null,
- dig smallint not null,
- cnt smallint,
- key using btree (cnt),
- key using btree (row),
- key using btree (col),
- unique key using hash (row,col)
- );
-
- create temporary table sudoku_schedule
- (
- idx int not null auto_increment primary key,
- row smallint not null,
- col smallint not null
- );
-
- call sudoku_init();
-
- if p_naive then
- update sudoku_work set cnt = 0 where dig = 0;
- else
- call sudoku_count();
- end if;
- insert into sudoku_schedule (row,col)
- select row,col from sudoku_work where cnt is not null order by cnt desc;
-
- begin
- declare v_scounter bigint default 0;
- declare v_i smallint default 1;
- declare v_dig smallint;
- declare v_schedmax smallint;
-
- select count(*) into v_schedmax from sudoku_schedule;
-
- more:
- loop
- begin
- declare v_tcounter bigint default 0;
-
- sched:
- while v_i <= v_schedmax do
- begin
- declare v_row, v_col smallint;
-
- select row,col into v_row,v_col from sudoku_schedule where v_i = idx;
-
- select dig into v_dig from sudoku_work
- where v_row = row and v_col = col;
-
- case v_dig
- when 0 then
- set v_dig = 1;
- update sudoku_work set dig = 1
- where v_row = row and v_col = col;
- when 9 then
- if v_i > 0 then
- update sudoku_work set dig = 0
- where v_row = row and v_col = col;
- set v_i = v_i - 1;
- iterate sched;
- else
- select v_scounter as 'Solutions';
- leave more;
- end if;
- else
- set v_dig = v_dig + 1;
- update sudoku_work set dig = v_dig
- where v_row = row and v_col = col;
- end case;
-
- set v_tcounter = v_tcounter + 1;
- if not sudoku_digit_ok(v_row, v_col, v_dig) then
- iterate sched;
- end if;
- set v_i = v_i + 1;
- end;
- end while sched;
-
- select dig from sudoku_work;
- select v_tcounter as 'Tests';
- set v_scounter = v_scounter + 1;
-
- if p_all and v_i > 0 then
- set v_i = v_i - 1;
- else
- leave more;
- end if;
- end;
- end loop more;
- end;
-
- drop temporary table sudoku_work, sudoku_schedule;
-end//
-delimiter ;//
-
-# The interestings parts are where the code for the two "leave" are:
-# ...
-#| 26 | jump_if_not 30 (v_i@3 > 0) |
-# ...
-#| 30 | stmt 0 "select v_scounter as 'Solutions'" |
-#| 31 | jump 45 |
-# ...
-#| 42 | jump_if_not 45 (p_all@1 and (v_i@3 > 0)) |
-#| 43 | set v_i@3 (v_i@3 - 1) |
-#| 44 | jump 14 |
-#| 45 | stmt 9 "drop temporary table sudoku_work, sud..." |
-#+-----+-----------------------------------------------------------------------+
-# The bug appeared at position 42 (with the wrong destination).
-show procedure code sudoku_solve;
-
-drop procedure sudoku_solve;
-
-#
-# Bug#19194 (Right recursion in parser for CASE causes excessive stack
-# usage, limitation)
-# This bug also exposed a flaw in the generated code with nested case
-# statements
-#
-
---disable_warnings
-DROP PROCEDURE IF EXISTS proc_19194_simple;
-DROP PROCEDURE IF EXISTS proc_19194_searched;
-DROP PROCEDURE IF EXISTS proc_19194_nested_1;
-DROP PROCEDURE IF EXISTS proc_19194_nested_2;
-DROP PROCEDURE IF EXISTS proc_19194_nested_3;
-DROP PROCEDURE IF EXISTS proc_19194_nested_4;
---enable_warnings
-
-delimiter |;
-
-CREATE PROCEDURE proc_19194_simple(i int)
-BEGIN
- DECLARE str CHAR(10);
-
- CASE i
- WHEN 1 THEN SET str="1";
- WHEN 2 THEN SET str="2";
- WHEN 3 THEN SET str="3";
- ELSE SET str="unknown";
- END CASE;
-
- SELECT str;
-END|
-
-CREATE PROCEDURE proc_19194_searched(i int)
-BEGIN
- DECLARE str CHAR(10);
-
- CASE
- WHEN i=1 THEN SET str="1";
- WHEN i=2 THEN SET str="2";
- WHEN i=3 THEN SET str="3";
- ELSE SET str="unknown";
- END CASE;
-
- SELECT str;
-END|
-
-# Outer SIMPLE case, inner SEARCHED case
-CREATE PROCEDURE proc_19194_nested_1(i int, j int)
-BEGIN
- DECLARE str_i CHAR(10);
- DECLARE str_j CHAR(10);
-
- CASE i
- WHEN 10 THEN SET str_i="10";
- WHEN 20 THEN
- BEGIN
- set str_i="20";
- CASE
- WHEN j=1 THEN SET str_j="1";
- WHEN j=2 THEN SET str_j="2";
- WHEN j=3 THEN SET str_j="3";
- ELSE SET str_j="unknown";
- END CASE;
- select "i was 20";
- END;
- WHEN 30 THEN SET str_i="30";
- WHEN 40 THEN SET str_i="40";
- ELSE SET str_i="unknown";
- END CASE;
-
- SELECT str_i, str_j;
-END|
-
-# Outer SEARCHED case, inner SIMPLE case
-CREATE PROCEDURE proc_19194_nested_2(i int, j int)
-BEGIN
- DECLARE str_i CHAR(10);
- DECLARE str_j CHAR(10);
-
- CASE
- WHEN i=10 THEN SET str_i="10";
- WHEN i=20 THEN
- BEGIN
- set str_i="20";
- CASE j
- WHEN 1 THEN SET str_j="1";
- WHEN 2 THEN SET str_j="2";
- WHEN 3 THEN SET str_j="3";
- ELSE SET str_j="unknown";
- END CASE;
- select "i was 20";
- END;
- WHEN i=30 THEN SET str_i="30";
- WHEN i=40 THEN SET str_i="40";
- ELSE SET str_i="unknown";
- END CASE;
-
- SELECT str_i, str_j;
-END|
-
-# Outer SIMPLE case, inner SIMPLE case
-CREATE PROCEDURE proc_19194_nested_3(i int, j int)
-BEGIN
- DECLARE str_i CHAR(10);
- DECLARE str_j CHAR(10);
-
- CASE i
- WHEN 10 THEN SET str_i="10";
- WHEN 20 THEN
- BEGIN
- set str_i="20";
- CASE j
- WHEN 1 THEN SET str_j="1";
- WHEN 2 THEN SET str_j="2";
- WHEN 3 THEN SET str_j="3";
- ELSE SET str_j="unknown";
- END CASE;
- select "i was 20";
- END;
- WHEN 30 THEN SET str_i="30";
- WHEN 40 THEN SET str_i="40";
- ELSE SET str_i="unknown";
- END CASE;
-
- SELECT str_i, str_j;
-END|
-
-# Outer SEARCHED case, inner SEARCHED case
-CREATE PROCEDURE proc_19194_nested_4(i int, j int)
-BEGIN
- DECLARE str_i CHAR(10);
- DECLARE str_j CHAR(10);
-
- CASE
- WHEN i=10 THEN SET str_i="10";
- WHEN i=20 THEN
- BEGIN
- set str_i="20";
- CASE
- WHEN j=1 THEN SET str_j="1";
- WHEN j=2 THEN SET str_j="2";
- WHEN j=3 THEN SET str_j="3";
- ELSE SET str_j="unknown";
- END CASE;
- select "i was 20";
- END;
- WHEN i=30 THEN SET str_i="30";
- WHEN i=40 THEN SET str_i="40";
- ELSE SET str_i="unknown";
- END CASE;
-
- SELECT str_i, str_j;
-END|
-
-delimiter ;|
-
-SHOW PROCEDURE CODE proc_19194_simple;
-SHOW PROCEDURE CODE proc_19194_searched;
-SHOW PROCEDURE CODE proc_19194_nested_1;
-SHOW PROCEDURE CODE proc_19194_nested_2;
-SHOW PROCEDURE CODE proc_19194_nested_3;
-SHOW PROCEDURE CODE proc_19194_nested_4;
-
-CALL proc_19194_nested_1(10, 1);
-
-#
-# Before 19194, the generated code was:
-# 20 jump_if_not 23(27) 30
-# 21 set str_i@2 _latin1'30'
-# As opposed to the expected:
-# 20 jump_if_not 23(27) (case_expr@0 = 30)
-# 21 set str_i@2 _latin1'30'
-#
-# and as a result, this call returned "30",
-# because the expression 30 is always true,
-# masking the case 40, case 0 and the else.
-#
-CALL proc_19194_nested_1(25, 1);
-
-CALL proc_19194_nested_1(20, 1);
-CALL proc_19194_nested_1(20, 2);
-CALL proc_19194_nested_1(20, 3);
-CALL proc_19194_nested_1(20, 4);
-CALL proc_19194_nested_1(30, 1);
-CALL proc_19194_nested_1(40, 1);
-CALL proc_19194_nested_1(0, 0);
-
-CALL proc_19194_nested_2(10, 1);
-
-#
-# Before 19194, the generated code was:
-# 20 jump_if_not 23(27) (case_expr@0 = (i@0 = 30))
-# 21 set str_i@2 _latin1'30'
-# As opposed to the expected:
-# 20 jump_if_not 23(27) (i@0 = 30)
-# 21 set str_i@2 _latin1'30'
-# and as a result, this call crashed the server, because there is no
-# such variable as "case_expr@0".
-#
-CALL proc_19194_nested_2(25, 1);
-
-CALL proc_19194_nested_2(20, 1);
-CALL proc_19194_nested_2(20, 2);
-CALL proc_19194_nested_2(20, 3);
-CALL proc_19194_nested_2(20, 4);
-CALL proc_19194_nested_2(30, 1);
-CALL proc_19194_nested_2(40, 1);
-CALL proc_19194_nested_2(0, 0);
-
-CALL proc_19194_nested_3(10, 1);
-CALL proc_19194_nested_3(25, 1);
-CALL proc_19194_nested_3(20, 1);
-CALL proc_19194_nested_3(20, 2);
-CALL proc_19194_nested_3(20, 3);
-CALL proc_19194_nested_3(20, 4);
-CALL proc_19194_nested_3(30, 1);
-CALL proc_19194_nested_3(40, 1);
-CALL proc_19194_nested_3(0, 0);
-
-CALL proc_19194_nested_4(10, 1);
-CALL proc_19194_nested_4(25, 1);
-CALL proc_19194_nested_4(20, 1);
-CALL proc_19194_nested_4(20, 2);
-CALL proc_19194_nested_4(20, 3);
-CALL proc_19194_nested_4(20, 4);
-CALL proc_19194_nested_4(30, 1);
-CALL proc_19194_nested_4(40, 1);
-CALL proc_19194_nested_4(0, 0);
-
-DROP PROCEDURE proc_19194_simple;
-DROP PROCEDURE proc_19194_searched;
-DROP PROCEDURE proc_19194_nested_1;
-DROP PROCEDURE proc_19194_nested_2;
-DROP PROCEDURE proc_19194_nested_3;
-DROP PROCEDURE proc_19194_nested_4;
-
-#
-# Bug#19207: Final parenthesis omitted for CREATE INDEX in Stored
-# Procedure
-#
-# Wrong criteria was used to distinguish the case when there was no
-# lookahead performed in the parser. Bug affected only statements
-# ending in one-character token without any optional tail, like CREATE
-# INDEX and CALL.
-#
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
---enable_warnings
-
-CREATE PROCEDURE p1() CREATE INDEX idx ON t1 (c1);
-SHOW PROCEDURE CODE p1;
-
-DROP PROCEDURE p1;
-
-
-#
-# Bug#26977 exception handlers never hreturn
-#
---disable_warnings
-drop table if exists t1;
-drop procedure if exists proc_26977_broken;
-drop procedure if exists proc_26977_works;
---enable_warnings
-
-create table t1(a int unique);
-
-delimiter //;
-
-create procedure proc_26977_broken(v int)
-begin
- declare i int default 5;
-
- declare continue handler for sqlexception
- begin
- select 'caught something';
- retry:
- while i > 0 do
- begin
- set i = i - 1;
- select 'looping', i;
- end;
- end while retry;
- end;
-
- select 'do something';
- insert into t1 values (v);
- select 'do something again';
- insert into t1 values (v);
-end//
-
-create procedure proc_26977_works(v int)
-begin
- declare i int default 5;
-
- declare continue handler for sqlexception
- begin
- select 'caught something';
- retry:
- while i > 0 do
- begin
- set i = i - 1;
- select 'looping', i;
- end;
- end while retry;
- select 'optimizer: keep hreturn';
- end;
-
- select 'do something';
- insert into t1 values (v);
- select 'do something again';
- insert into t1 values (v);
-end//
-delimiter ;//
-
-show procedure code proc_26977_broken;
-
-show procedure code proc_26977_works;
-
-## This caust an error because of jump short cut
-## optimization.
-call proc_26977_broken(1);
-
-## This works
-call proc_26977_works(2);
-
-drop table t1;
-drop procedure proc_26977_broken;
-drop procedure proc_26977_works;
-
-#
-# Bug#33618 Crash in sp_rcontext
-#
-
---disable_warnings
-drop procedure if exists proc_33618_h;
-drop procedure if exists proc_33618_c;
---enable_warnings
-
-delimiter //;
-
-create procedure proc_33618_h(num int)
-begin
- declare count1 int default '0';
- declare vb varchar(30);
- declare last_row int;
-
- while(num>=1) do
- set num=num-1;
- begin
- declare cur1 cursor for select `a` from t_33618;
- declare continue handler for not found set last_row = 1;
- set last_row:=0;
- open cur1;
- rep1:
- repeat
- begin
- declare exit handler for 1062 begin end;
- fetch cur1 into vb;
- if (last_row = 1) then
- ## should generate a hpop instruction here
- leave rep1;
- end if;
- end;
- until last_row=1
- end repeat;
- close cur1;
- end;
- end while;
-end//
-
-create procedure proc_33618_c(num int)
-begin
- declare count1 int default '0';
- declare vb varchar(30);
- declare last_row int;
-
- while(num>=1) do
- set num=num-1;
- begin
- declare cur1 cursor for select `a` from t_33618;
- declare continue handler for not found set last_row = 1;
- set last_row:=0;
- open cur1;
- rep1:
- repeat
- begin
- declare cur2 cursor for select `b` from t_33618;
- fetch cur1 into vb;
- if (last_row = 1) then
- ## should generate a cpop instruction here
- leave rep1;
- end if;
- end;
- until last_row=1
- end repeat;
- close cur1;
- end;
- end while;
-end//
-delimiter ;//
-
-show procedure code proc_33618_h;
-show procedure code proc_33618_c;
-
-drop procedure proc_33618_h;
-drop procedure proc_33618_c;
-
-#
-# Bug#20906 (Multiple assignments in SET in stored routine produce incorrect
-# instructions)
-#
-
---disable_warnings
-drop procedure if exists p_20906_a;
-drop procedure if exists p_20906_b;
---enable_warnings
-
-create procedure p_20906_a() SET @a=@a+1, @b=@b+1;
-show procedure code p_20906_a;
-
-set @a=1;
-set @b=1;
-
-call p_20906_a();
-select @a, @b;
-
-create procedure p_20906_b() SET @a=@a+1, @b=@b+1, @c=@c+1;
-show procedure code p_20906_b;
-
-set @a=1;
-set @b=1;
-set @c=1;
-
-call p_20906_b();
-select @a, @b, @c;
-
-drop procedure p_20906_a;
-drop procedure p_20906_b;
-
---echo End of 5.0 tests.
-
-#
-# Bug #26303: reserve() not called before qs_append() may lead to buffer
-# overflow
-#
-DELIMITER //;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE dummy int default 0;
-
- CASE 12
- WHEN 12
- THEN SET dummy = 0;
- END CASE;
-END//
-DELIMITER ;//
-SHOW PROCEDURE CODE p1;
-DROP PROCEDURE p1;
-
---echo #
---echo # Bug#23032: Handlers declared in a SP do not handle warnings generated in sub-SP
---echo #
-
---echo
---echo # - Case 4: check that "No Data trumps Warning".
---echo
-
-CREATE TABLE t1(a INT);
-INSERT INTO t1 VALUES (1), (2), (3);
-
-delimiter |;
-
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE c CURSOR FOR SELECT a FROM t1;
-
- OPEN c;
-
- BEGIN
- DECLARE v INT;
-
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- BEGIN
- SELECT "Warning found!";
- SHOW WARNINGS;
- END;
-
- DECLARE EXIT HANDLER FOR NOT FOUND
- BEGIN
- SELECT "End of Result Set found!";
- SHOW WARNINGS;
- END;
-
- WHILE TRUE DO
- FETCH c INTO v;
- END WHILE;
- END;
-
- CLOSE c;
-
- SELECT a INTO @foo FROM t1 LIMIT 1; # Clear warning stack
-END|
-
-delimiter ;|
-
-SET SESSION debug_dbug="+d,bug23032_emit_warning";
-CALL p1();
-SET SESSION debug_dbug="-d,bug23032_emit_warning";
-
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#11763507 - 56224: FUNCTION NAME IS CASE-SENSITIVE
---echo #
-SET @@SQL_MODE = '';
-DELIMITER $;
-CREATE FUNCTION testf_bug11763507() RETURNS INT
-BEGIN
- RETURN 0;
-END
-$
-
-CREATE PROCEDURE testp_bug11763507()
-BEGIN
- SELECT "PROCEDURE testp_bug11763507";
-END
-$
-
-DELIMITER ;$
-
-# STORED FUNCTIONS
-SHOW FUNCTION CODE testf_bug11763507;
-SHOW FUNCTION CODE TESTF_bug11763507;
-
-# STORED PROCEDURE
-SHOW PROCEDURE CODE testp_bug11763507;
-SHOW PROCEDURE CODE TESTP_bug11763507;
-
-DROP PROCEDURE testp_bug11763507;
-DROP FUNCTION testf_bug11763507;
-
---echo #END OF BUG#11763507 test.
-
-
---echo #
---echo # MDEV-13581 ROW TYPE OF t1 and t1%ROWTYPE for routine parameters
---echo #
-
-CREATE TABLE t1 (a INT, b TEXT);
-DELIMITER $$;
-CREATE PROCEDURE p1(a ROW TYPE OF t1, OUT b ROW TYPE OF t1)
-BEGIN
- SET a.a = 100;
- SET a.b = 'aaa';
- SET b.a = 200;
- SET b.b = 'bbb';
- SET a = b;
- SET b = a;
- SET a.a = b.a;
- SET b.a = a.a;
-END;
-$$
-DELIMITER ;$$
-SHOW PROCEDURE CODE p1;
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-14415 Add Oracle-style FOR loop to sql_mode=DEFAULT
---echo #
-
---echo # Integer range FOR loop
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- FOR i IN 1..3
- DO
- SELECT i;
- END FOR;
-END;
-$$
-DELIMITER ;$$
-CALL p1;
-SHOW PROCEDURE CODE p1;
-DROP PROCEDURE p1;
-
-
---echo # Nested integer range FOR loops
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- fori:
- FOR i IN 1..3
- DO
- forj:
- FOR j IN 1..3
- DO
- IF i = 3 THEN
- LEAVE fori;
- END IF;
- IF j = 3 THEN
- LEAVE forj;
- END IF;
- SELECT i,j;
- END FOR;
- END FOR;
-END;
-$$
-DELIMITER ;$$
-CALL p1;
-SHOW PROCEDURE CODE p1;
-DROP PROCEDURE p1;
-
-
---echo # Explicit cursor FOR loops
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur0 CURSOR FOR SELECT 10 AS a, 'b0' AS b;
- DECLARE cur1 CURSOR FOR SELECT 10 AS a, 'b0' AS b;
- DECLARE cur2 CURSOR FOR SELECT 10 AS a, 'b0' AS b;
- FOR rec1 IN cur1
- DO
- SELECT rec1.a, rec1.b;
- SET rec1.a= 11;
- SET rec1.b= 'b1';
- SELECT rec1.a, rec1.b;
- END FOR;
- FOR rec0 IN cur0
- DO
- SET rec0.a= 10;
- SET rec0.b='b0';
- END FOR;
- FOR rec2 IN cur2
- DO
- SET rec2.a= 10;
- SET rec2.b='b0';
- END FOR;
-END;
-$$
-DELIMITER ;$$
-SHOW PROCEDURE CODE p1;
-DROP PROCEDURE p1;
-
-
---echo # Nested explicit cursor FOR loops
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur0 CURSOR FOR SELECT 10 AS a, 'b0' AS b;
- FOR rec0 IN cur0
- DO
- BEGIN
- DECLARE cur1 CURSOR FOR SELECT 11 AS a, 'b1' AS b;
- SET rec0.a= 11;
- SET rec0.b= 'b0';
- FOR rec1 IN cur1
- DO
- SET rec1.a= 11;
- SET rec1.b= 'b1';
- BEGIN
- DECLARE cur2 CURSOR FOR SELECT 12 AS a, 'b2' AS b;
- FOR rec2 IN cur2
- DO
- SET rec2.a=12;
- SET rec2.b='b2';
- END FOR;
- END;
- END FOR;
- END;
- END FOR;
-END;
-$$
-DELIMITER ;$$
-SHOW PROCEDURE CODE p1;
-DROP PROCEDURE p1;
-
-
---echo # Implicit cursor FOR loops
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- FOR rec1 IN (SELECT 11 AS a, 'b1' AS b)
- DO
- SELECT rec1.a, rec1.b;
- SET rec1.a= 11;
- SET rec1.b= 'b1';
- SELECT rec1.a, rec1.b;
- END FOR;
- FOR rec0 IN (SELECT 10 AS a, 'b0' AS b)
- DO
- SET rec0.a= 10;
- SET rec0.b='b0';
- END FOR;
- FOR rec2 IN (SELECT 12 AS a, 'b2' AS b)
- DO
- SET rec2.a= 10;
- SET rec2.b='b0';
- END FOR;
-END;
-$$
-DELIMITER ;$$
-SHOW PROCEDURE CODE p1;
-DROP PROCEDURE p1;
-
---echo # Nested implicit cursor FOR loops
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- FOR rec0 IN (SELECT 10 AS a, 'b0' AS b)
- DO
- SET rec0.a= 11;
- SET rec0.b= 'b0';
- FOR rec1 IN (SELECT 11 AS a, 'b1' AS b)
- DO
- SET rec1.a= 11;
- SET rec1.b= 'b1';
- FOR rec2 IN (SELECT 12 AS a, 'b2' AS b)
- DO
- SET rec2.a=12;
- SET rec2.b='b2';
- END FOR;
- END FOR;
- END FOR;
-END;
-$$
-DELIMITER ;$$
-SHOW PROCEDURE CODE p1;
-DROP PROCEDURE p1;
diff --git a/mysql-test/t/sp-cursor.test b/mysql-test/t/sp-cursor.test
deleted file mode 100644
index 2e7a72cf8d0..00000000000
--- a/mysql-test/t/sp-cursor.test
+++ /dev/null
@@ -1,609 +0,0 @@
-
---echo #
---echo # MDEV-12457 Cursors with parameters
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,'old'),(2,'old'),(3,'old'),(4,'old'),(5,'old');
-DELIMITER $$;
-CREATE PROCEDURE p1(min INT,max INT)
-BEGIN
- DECLARE done INT DEFAULT FALSE;
- DECLARE va INT;
- DECLARE cur CURSOR(pmin INT, pmax INT) FOR SELECT a FROM t1 WHERE a BETWEEN pmin AND pmax;
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=TRUE;
- OPEN cur(min,max);
- read_loop: LOOP
- FETCH cur INTO va;
- IF done THEN
- LEAVE read_loop;
- END IF;
- INSERT INTO t1 VALUES (va,'new');
- END LOOP;
- CLOSE cur;
-END;
-$$
-DELIMITER ;$$
-CALL p1(2,4);
-SELECT * FROM t1 ORDER BY b DESC,a;
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-
---echo #
---echo # OPEN with a wrong number of parameters
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-DELIMITER $$;
---error ER_WRONG_PARAMCOUNT_TO_CURSOR
-CREATE PROCEDURE p1(a_a INT,a_b VARCHAR(32))
-BEGIN
- DECLARE v_a INT;
- DECLARE v_b VARCHAR(10);
- DECLARE c CURSOR (p_a INT, p_b VARCHAR(32)) FOR SELECT * FROM t1 WHERE a=p_a;
- OPEN c(a_a);
- CLOSE c;
-END;
-$$
-DELIMITER ;$$
-DROP TABLE t1;
-
-
---echo #
---echo # Cursor parameters are not visible outside of the cursor
---echo #
-
-DELIMITER $$;
---error ER_UNKNOWN_SYSTEM_VARIABLE
-CREATE PROCEDURE p1(a_a INT)
-BEGIN
- DECLARE v_a INT;
- DECLARE c CURSOR (p_a INT) FOR SELECT a FROM t1 WHERE a=p_a;
- OPEN c(a_a);
- SET p_a=10;
-END;
-$$
-DELIMITER ;$$
-
-DELIMITER $$;
---error ER_UNKNOWN_SYSTEM_VARIABLE
-CREATE PROCEDURE p1(a_a INT)
-BEGIN
- DECLARE v_a INT;
- DECLARE c CURSOR (p_a INT) FOR SELECT a FROM t1 WHERE a=p_a;
- SET p_a= 10;
- OPEN c(a_a);
-END;
-$$
-DELIMITER ;$$
-
-
---echo #
---echo # Cursor parameter shadowing a local variable
---echo #
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1);
-DELIMITER $$;
-CREATE PROCEDURE p1(a INT)
-BEGIN
- DECLARE done INT DEFAULT 0;
- DECLARE v_a INT DEFAULT NULL;
- DECLARE p_a INT DEFAULT NULL;
- DECLARE c CURSOR (p_a VARCHAR(32)) FOR SELECT p_a FROM t1;
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=TRUE;
- OPEN c(a);
- read_loop: LOOP
- FETCH c INTO v_a;
- IF done THEN
- LEAVE read_loop;
- END IF;
- SELECT v_a;
- END LOOP;
- CLOSE c;
-END;
-$$
-DELIMITER ;$$
-CALL p1(1);
-CALL p1(NULL);
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-
---echo #
---echo # Parameters in SELECT list
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1(a_a INT, a_b VARCHAR(32))
-BEGIN
- DECLARE v_a INT;
- DECLARE v_b VARCHAR(10);
- DECLARE c CURSOR (p_a INT, p_b VARCHAR(32)) FOR SELECT p_a,p_b FROM DUAL;
- OPEN c(a_a + 0,a_b);
- FETCH c INTO v_a, v_b;
- SELECT v_a, v_b;
- CLOSE c;
- OPEN c(a_a + 1,a_b);
- FETCH c INTO v_a, v_b;
- SELECT v_a, v_b;
- CLOSE c;
-END;
-$$
-DELIMITER ;$$
-CALL p1(1,'b1');
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Parameters in SELECT list + UNION
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1(a_a INT, a_b VARCHAR(32))
-BEGIN
- DECLARE v_a INT;
- DECLARE v_b VARCHAR(10);
- DECLARE c CURSOR(p_a INT, p_b VARCHAR(32)) FOR
- SELECT p_a,p_b FROM DUAL
- UNION ALL
- SELECT p_a+1,CONCAT(p_b,'b') FROM DUAL;
- OPEN c(a_a,a_b);
- FETCH c INTO v_a, v_b;
- SELECT v_a, v_b;
- FETCH c INTO v_a, v_b;
- SELECT v_a, v_b;
- CLOSE c;
-END;
-$$
-DELIMITER ;$$
-CALL p1(1,'b1');
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Parameters in SELECT list + type conversion + warnings
---echo #
-
-SET sql_mode='';
-DELIMITER $$;
-CREATE PROCEDURE p1(a_a VARCHAR(32))
-BEGIN
- DECLARE v_a INT;
- DECLARE c CURSOR (p_a INT) FOR SELECT p_a FROM DUAL;
- OPEN c(a_a);
- FETCH c INTO v_a;
- SELECT v_a;
- CLOSE c;
-END;
-$$
-DELIMITER ;$$
-CALL p1('1b');
-CALL p1('b1');
-DROP PROCEDURE p1;
-SET sql_mode=DEFAULT;
-
-
---echo #
---echo # One parameter in SELECT list + subselect
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1(a_a VARCHAR(32))
-BEGIN
- DECLARE v_a VARCHAR(10);
- DECLARE c CURSOR (p_a VARCHAR(32)) FOR
- SELECT p_a FROM DUAL UNION SELECT REVERSE(p_a) FROM DUAL;
- OPEN c((SELECT a_a));
- FETCH c INTO v_a;
- SELECT v_a;
- FETCH c INTO v_a;
- SELECT v_a;
- CLOSE c;
-END;
-$$
-DELIMITER ;$$
-CALL p1('ab');
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Two parameters in SELECT list + subselect
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE v_a VARCHAR(32);
- DECLARE v_b VARCHAR(32);
- DECLARE c CURSOR (p_a VARCHAR(32), p_b VARCHAR(32)) FOR
- SELECT p_a, p_b FROM DUAL
- UNION
- SELECT p_b, p_a FROM DUAL;
- OPEN c((SELECT 'aaa'),(SELECT 'bbb'));
- FETCH c INTO v_a, v_b;
- SELECT v_a, v_b;
- FETCH c INTO v_a, v_b;
- SELECT v_a, v_b;
- CLOSE c;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Two parameters in SELECT list + two parameters in WHERE + subselects
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1(a_a VARCHAR(32), a_b VARCHAR(32))
-BEGIN
- DECLARE done INT DEFAULT 0;
- DECLARE v_a VARCHAR(32);
- DECLARE v_b VARCHAR(32);
- DECLARE c CURSOR (value_a VARCHAR(32), value_b VARCHAR(32),
- pattern_a VARCHAR(32), pattern_b VARCHAR(32)) FOR
- SELECT value_a, value_b FROM DUAL WHERE value_a LIKE pattern_a
- UNION
- SELECT value_b, value_a FROM DUAL WHERE value_b LIKE pattern_b;
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=TRUE;
- OPEN c((SELECT 'aaa'),(SELECT 'bbb'),(SELECT a_a),(SELECT a_b));
- read_loop: LOOP
- FETCH c INTO v_a, v_b;
- IF done THEN
- LEAVE read_loop;
- END IF;
- SELECT v_a, v_b;
- END LOOP;
- CLOSE c;
-END;
-$$
-DELIMITER ;$$
-CALL p1('%','%');
-CALL p1('aaa','xxx');
-CALL p1('xxx','bbb');
-CALL p1('xxx','xxx');
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Parameters in SELECT list + stored function
---echo #
-
-DELIMITER $$;
-CREATE FUNCTION f1 (a VARCHAR(32)) RETURNS VARCHAR(32)
-BEGIN
- RETURN CONCAT(a,'y');
-END;
-$$
-CREATE PROCEDURE p1(a_a VARCHAR(32))
-BEGIN
- DECLARE done INT DEFAULT 0;
- DECLARE v_a VARCHAR(10);
- DECLARE v_b VARCHAR(10);
- DECLARE c CURSOR (p_sel_a VARCHAR(32), p_cmp_a VARCHAR(32)) FOR
- SELECT p_sel_a, p_cmp_a FROM DUAL;
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=TRUE;
- OPEN c(f1(a_a), f1(a_a));
- read_loop: LOOP
- FETCH c INTO v_a, v_b;
- IF done THEN
- LEAVE read_loop;
- END IF;
- SELECT v_a, v_b;
- END LOOP;
- CLOSE c;
-END;
-$$
-DELIMITER ;$$
-CALL p1('x');
-# A complex expression
-CALL p1(f1(COALESCE(NULL, f1('x'))));
-DROP PROCEDURE p1;
-DROP FUNCTION f1;
-
-
---echo #
---echo # One parameter in WHERE clause
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-CREATE TABLE t2 (a INT, b VARCHAR(10));
-INSERT INTO t1 VALUES (1,'11');
-INSERT INTO t1 VALUES (1,'12');
-INSERT INTO t1 VALUES (2,'21');
-INSERT INTO t1 VALUES (2,'22');
-INSERT INTO t1 VALUES (3,'31');
-INSERT INTO t1 VALUES (3,'32');
-DELIMITER $$;
-CREATE PROCEDURE p1(a_a INT)
-BEGIN
- DECLARE done INT DEFAULT 0;
- DECLARE v_a INT;
- DECLARE v_b VARCHAR(10);
- DECLARE c CURSOR (p_a INT) FOR SELECT a,b FROM t1 WHERE a=p_a;
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=TRUE;
- OPEN c(a_a);
- read_loop: LOOP
- FETCH c INTO v_a, v_b;
- IF done THEN
- LEAVE read_loop;
- END IF;
- INSERT INTO t2 VALUES (v_a,v_b);
- END LOOP;
- CLOSE c;
-END;
-$$
-DELIMITER ;$$
-CALL p1(1);
-SELECT * FROM t2;
-DROP TABLE t1;
-DROP TABLE t2;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Two parameters in WHERE clause
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-CREATE TABLE t2 (a INT, b VARCHAR(10));
-INSERT INTO t1 VALUES (1,'11');
-INSERT INTO t1 VALUES (1,'12');
-INSERT INTO t1 VALUES (2,'21');
-INSERT INTO t1 VALUES (2,'22');
-INSERT INTO t1 VALUES (3,'31');
-INSERT INTO t1 VALUES (3,'32');
-DELIMITER $$;
-CREATE PROCEDURE p1(a_a INT, a_b VARCHAR(32))
-BEGIN
- DECLARE done INT DEFAULT 0;
- DECLARE v_a INT;
- DECLARE v_b VARCHAR(10);
- DECLARE c CURSOR (p_a INT, p_b VARCHAR(32)) FOR SELECT a,b FROM t1 WHERE a=p_a AND b=p_b;
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=TRUE;
- OPEN c(a_a, a_b);
- read_loop: LOOP
- FETCH c INTO v_a, v_b;
- IF done THEN
- LEAVE read_loop;
- END IF;
- INSERT INTO t2 VALUES (v_a,v_b);
- END LOOP;
- CLOSE c;
-END;
-$$
-DELIMITER ;$$
-CALL p1(1,'11');
-SELECT * FROM t2;
-DROP TABLE t1;
-DROP TABLE t2;
-DROP PROCEDURE p1;
-
---echo #
---echo # Parameters in WHERE and HAVING clauses
---echo #
-CREATE TABLE t1 (name VARCHAR(10), value INT);
-INSERT INTO t1 VALUES ('but',1);
-INSERT INTO t1 VALUES ('but',1);
-INSERT INTO t1 VALUES ('but',1);
-INSERT INTO t1 VALUES ('bin',1);
-INSERT INTO t1 VALUES ('bin',1);
-INSERT INTO t1 VALUES ('bot',1);
-DELIMITER $$;
-CREATE PROCEDURE p1 (arg_name_limit VARCHAR(32), arg_total_limit INT)
-BEGIN
- DECLARE i INT DEFAULT 0;
- DECLARE v_name VARCHAR(10);
- DECLARE v_total INT;
--- +0 is needed to work around the bug MDEV-11081
- DECLARE c CURSOR(p_v INT) FOR
- SELECT name, SUM(value + p_v) + 0 AS total FROM t1
- WHERE name LIKE arg_name_limit
- GROUP BY name HAVING total>=arg_total_limit;
- WHILE i < 2 DO
- BEGIN
- DECLARE done INT DEFAULT 0;
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=TRUE;
- OPEN c(i);
- read_loop: LOOP
- FETCH c INTO v_name, v_total;
- IF done THEN
- LEAVE read_loop;
- END IF;
- SELECT v_name, v_total;
- END LOOP;
- CLOSE c;
- SET i= i + 1;
- END;
- END WHILE;
-END;
-$$
-DELIMITER ;$$
-CALL p1('%', 2);
-CALL p1('b_t', 0);
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-
---echo #
---echo # One parameter in LIMIT clause
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-INSERT INTO t1 VALUES (1,'b1');
-INSERT INTO t1 VALUES (2,'b2');
-INSERT INTO t1 VALUES (3,'b3');
-INSERT INTO t1 VALUES (4,'b4');
-INSERT INTO t1 VALUES (5,'b5');
-INSERT INTO t1 VALUES (6,'b6');
-DELIMITER $$;
-CREATE PROCEDURE p1(a_a INT)
-BEGIN
- DECLARE done INT DEFAULT 0;
- DECLARE v_a INT;
- DECLARE v_b VARCHAR(10);
- DECLARE c CURSOR (p_a INT) FOR SELECT a,b FROM t1 ORDER BY a LIMIT p_a;
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=TRUE;
- CREATE TABLE t2 (a INT, b VARCHAR(10));
- OPEN c(a_a);
- read_loop: LOOP
- FETCH c INTO v_a, v_b;
- IF done THEN
- LEAVE read_loop;
- END IF;
- INSERT INTO t2 VALUES (v_a,v_b);
- END LOOP;
- CLOSE c;
- SELECT * FROM t2;
- DROP TABLE t2;
-END;
-$$
-DELIMITER ;$$
-CALL p1(1);
-CALL p1(3);
-CALL p1(6);
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
-
---echo #
---echo # End of MDEV-12457 Cursors with parameters
---echo #
-
-
---echo #
---echo # MDEV-14415 Add Oracle-style FOR loop to sql_mode=DEFAULT
---echo #
-
---echo # Explicit cursor
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-INSERT INTO t1 VALUES (1,'b1'), (2,'b2'), (3,'b3');
-DELIMITER $$;
-BEGIN NOT ATOMIC
- DECLARE cur CURSOR FOR SELECT * FROM t1;
- FOR rec IN cur
- DO
- SELECT rec.a AS a, rec.b AS b;
- END FOR;
-END;
-$$
-DELIMITER ;$$
-DROP TABLE t1;
-
---echo # Explicit cursor with parameters
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-INSERT INTO t1 VALUES (1,'b1'), (2,'b2'), (3,'b3');
-DELIMITER $$;
-BEGIN NOT ATOMIC
- DECLARE cur CURSOR(pa INT) FOR SELECT * FROM t1 WHERE a>=pa;
- FOR rec IN cur(2)
- DO
- SELECT rec.a AS a, rec.b AS b;
- END FOR;
-END;
-$$
-DELIMITER ;$$
-DROP TABLE t1;
-
---echo # Explicit cursor + label
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-INSERT INTO t1 VALUES ('1','b1'), ('2','b2');
-DELIMITER $$;
-BEGIN NOT ATOMIC
- DECLARE cur CURSOR FOR SELECT * FROM t1;
- forrec:
- FOR rec IN cur
- DO
- SELECT rec.a AS a, rec.b AS b;
- IF rec.a = 2 THEN
- LEAVE forrec;
- END IF;
- END FOR forrec;
-END;
-$$
-DELIMITER ;$$
-DROP TABLE t1;
-
---echo # Explicit cursor + FETCH inside the loop body produce an error on "NOT FOUND"
-
-DELIMITER $$;
---error ER_SP_FETCH_NO_DATA
-BEGIN NOT ATOMIC
- DECLARE x INT;
- DECLARE cur CURSOR FOR SELECT 1 AS x;
- FOR rec IN cur
- DO
- FETCH cur INTO x;
- END FOR;
-END;
-$$
-DELIMITER ;$$
-
-
---echo # Explicit cursor + FETCH inside the loop body are normally handled by "HANDLER FOR NOT FOUND"
-
-DELIMITER $$;
-BEGIN NOT ATOMIC
- DECLARE done INT DEFAULT 0;
- DECLARE cur CURSOR FOR SELECT 1 AS x, 'y1' AS y UNION
- SELECT 2,'y2' UNION
- SELECT 3,'y3';
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
- forrec:
- FOR rec IN cur
- DO
- SELECT CONCAT(rec.x, ' ', rec.y) AS 'Implicit FETCH';
- FETCH cur INTO rec;
- IF done THEN
- SELECT 'NO DATA' AS `Explicit FETCH`;
- LEAVE forrec;
- ELSE
- SELECT CONCAT(rec.x, ' ', rec.y) AS 'Explicit FETCH';
- END IF;
- END FOR;
-END;
-$$
-DELIMITER ;$$
-
-
---echo # Implicit cursor
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-INSERT INTO t1 VALUES ('1','b1'), ('2','b2');
-DELIMITER $$;
-BEGIN NOT ATOMIC
- FOR rec IN (SELECT * FROM t1)
- DO
- SELECT rec.a AS a, rec.b AS b;
- END FOR;
-END;
-$$
-DELIMITER ;$$
-DROP TABLE t1;
-
---echo # Implicit cursor + label
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-INSERT INTO t1 VALUES ('1','b1'), ('2','b2');
-DELIMITER $$;
-BEGIN NOT ATOMIC
- forrec:
- FOR rec IN (SELECT * FROM t1)
- DO
- SELECT rec.a AS a, rec.b AS b;
- IF rec.a = 2 THEN
- LEAVE forrec;
- END IF;
- END FOR;
-END;
-$$
-DELIMITER ;$$
-DROP TABLE t1;
diff --git a/mysql-test/t/sp-destruct.test b/mysql-test/t/sp-destruct.test
deleted file mode 100644
index 607c733b492..00000000000
--- a/mysql-test/t/sp-destruct.test
+++ /dev/null
@@ -1,322 +0,0 @@
-#
-# Destructive stored procedure tests
-#
-# We do horrible things to the mysql.proc table here, so any unexpected
-# failures here might leave it in an undetermined state.
-#
-# In the case of trouble you might want to skip this.
-#
-
--- source include/not_embedded.inc
-
-# Supress warnings written to the log file
-call mtr.add_suppression("Column count of mysql.proc is wrong. Expected 21, found 20. The table is probably corrupted");
-call mtr.add_suppression("Stored routine .test...bug14233_[123].: invalid value in column mysql.proc");
-
-# Backup proc table
-let $MYSQLD_DATADIR= `select @@datadir`;
-flush table mysql.proc;
---copy_file $MYSQLD_DATADIR/mysql/proc.frm $MYSQLTEST_VARDIR/tmp/proc.frm
---copy_file $MYSQLD_DATADIR/mysql/proc.MYD $MYSQLTEST_VARDIR/tmp/proc.MYD
---copy_file $MYSQLD_DATADIR/mysql/proc.MYI $MYSQLTEST_VARDIR/tmp/proc.MYI
-
-use test;
-
---disable_warnings
-drop procedure if exists bug14233;
-drop function if exists bug14233;
-drop table if exists t1;
-drop view if exists v1;
---enable_warnings
-
-create procedure bug14233()
- set @x = 42;
-
-create function bug14233_f() returns int
- return 42;
-
-create table t1 (id int);
-create trigger t1_ai after insert on t1 for each row call bug14233();
-
-# Unsupported tampering with the mysql.proc definition
-alter table mysql.proc drop security_type;
---error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2
-call bug14233();
---error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2
-create view v1 as select bug14233_f();
---error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2
-insert into t1 values (0);
---error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2
-show procedure status;
-
-flush table mysql.proc;
-
-# Thrashing the .frm file
---remove_file $MYSQLD_DATADIR/mysql/proc.frm
---write_file $MYSQLD_DATADIR/mysql/proc.frm
-saljdfa
-EOF
---replace_result $MYSQLTEST_VARDIR . master-data// '' '\\' '/'
---error ER_NOT_FORM_FILE
-call bug14233();
---replace_result $MYSQLTEST_VARDIR . master-data// '' '\\' '/'
---error ER_NOT_FORM_FILE
-create view v1 as select bug14233_f();
---replace_result $MYSQLTEST_VARDIR . master-data// '' '\\' '/'
---error ER_NOT_FORM_FILE
-insert into t1 values (0);
-
-flush table mysql.proc;
-
-# Drop the mysql.proc table
---remove_file $MYSQLD_DATADIR/mysql/proc.frm
---remove_file $MYSQLD_DATADIR/mysql/proc.MYD
---remove_file $MYSQLD_DATADIR/mysql/proc.MYI
---error ER_NO_SUCH_TABLE
-call bug14233();
---error ER_NO_SUCH_TABLE
-create view v1 as select bug14233_f();
---error ER_NO_SUCH_TABLE
-insert into t1 values (0);
-
-# Restore mysql.proc
---copy_file $MYSQLTEST_VARDIR/tmp/proc.frm $MYSQLD_DATADIR/mysql/proc.frm
---copy_file $MYSQLTEST_VARDIR/tmp/proc.MYD $MYSQLD_DATADIR/mysql/proc.MYD
---copy_file $MYSQLTEST_VARDIR/tmp/proc.MYI $MYSQLD_DATADIR/mysql/proc.MYI
---remove_file $MYSQLTEST_VARDIR/tmp/proc.frm
---remove_file $MYSQLTEST_VARDIR/tmp/proc.MYD
---remove_file $MYSQLTEST_VARDIR/tmp/proc.MYI
-
-flush table mysql.proc;
-flush privileges;
-
-delete from mysql.proc where name like 'bug14233%';
-
-# Unsupported editing of mysql.proc, circumventing checks in "create ..."
-insert into mysql.proc
-(
- db, name, type, specific_name, language, sql_data_access, is_deterministic,
- security_type, param_list, returns, body, definer, created, modified,
- sql_mode, comment, character_set_client, collation_connection, db_collation,
- body_utf8
-)
-values
-(
- 'test', 'bug14233_1', 'FUNCTION', 'bug14233_1', 'SQL', 'READS_SQL_DATA', 'NO',
- 'DEFINER', '', 'int(10)',
- 'select count(*) from mysql.user',
- 'root@localhost', NOW() , '0000-00-00 00:00:00', '', '',
- '', '', '',
- 'select count(*) from mysql.user'
-),
-(
- 'test', 'bug14233_2', 'FUNCTION', 'bug14233_2', 'SQL', 'READS_SQL_DATA', 'NO',
- 'DEFINER', '', 'int(10)',
- 'begin declare x int; select count(*) into x from mysql.user; end',
- 'root@localhost', NOW() , '0000-00-00 00:00:00', '', '',
- '', '', '',
- 'begin declare x int; select count(*) into x from mysql.user; end'
-),
-(
- 'test', 'bug14233_3', 'PROCEDURE', 'bug14233_3', 'SQL', 'READS_SQL_DATA','NO',
- 'DEFINER', '', '',
- 'alksj wpsj sa ^#!@ ',
- 'root@localhost', NOW() , '0000-00-00 00:00:00', '', '',
- '', '', '',
- 'alksj wpsj sa ^#!@ '
-);
-
---error ER_SP_PROC_TABLE_CORRUPT
-select bug14233_1();
---error ER_SP_PROC_TABLE_CORRUPT
-create view v1 as select bug14233_1();
-
---error ER_SP_PROC_TABLE_CORRUPT
-select bug14233_2();
---error ER_SP_PROC_TABLE_CORRUPT
-create view v1 as select bug14233_2();
-
---error ER_SP_PROC_TABLE_CORRUPT
-call bug14233_3();
-drop trigger t1_ai;
-create trigger t1_ai after insert on t1 for each row call bug14233_3();
---error ER_SP_PROC_TABLE_CORRUPT
-insert into t1 values (0);
-
-# Clean-up
-drop trigger t1_ai;
-drop table t1;
-
-#
-# BUG#16303: erroneus stored procedures and functions should be droppable
-#
-drop function bug14233_1;
-drop function bug14233_2;
-drop procedure bug14233_3;
-# Assert: These should show nothing.
-show procedure status where db=DATABASE();
-show function status where db=DATABASE();
-
-#
-# Bug#41726 upgrade from 5.0 to 5.1.30 crashes if you didn't run mysql_upgrade
-#
-
-
---disable_warnings
-DROP TABLE IF EXISTS proc_backup;
-DROP PROCEDURE IF EXISTS p1;
---enable_warnings
-
---echo # Backup the proc table
-
-RENAME TABLE mysql.proc TO proc_backup;
-CREATE TABLE mysql.proc LIKE proc_backup;
-FLUSH TABLE mysql.proc;
-
---echo # Test with a valid table.
-
-CREATE PROCEDURE p1()
- SET @foo = 10;
-CALL p1();
---replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
-SHOW PROCEDURE STATUS;
-
---echo # Modify a field of the table.
-
-ALTER TABLE mysql.proc MODIFY comment CHAR (32);
-
---error ER_CANNOT_LOAD_FROM_TABLE_V2
-CREATE PROCEDURE p2()
- SET @foo = 10;
---echo # Procedure loaded from the cache
-CALL p1();
---error ER_CANNOT_LOAD_FROM_TABLE_V2
-SHOW PROCEDURE STATUS;
-
-DROP TABLE mysql.proc;
-RENAME TABLE proc_backup TO mysql.proc;
-FLUSH TABLE mysql.proc;
-
-
---echo #
---echo # Bug#51376 Assert `! is_set()' failed in
---echo # Diagnostics_area::set_ok_status on DROP FUNCTION
---echo #
-
---disable_warnings
-DROP FUNCTION IF EXISTS f1;
---enable_warnings
-
-CREATE FUNCTION f1() RETURNS INT RETURN 1;
-
---echo # Backup the procs_priv table
-RENAME TABLE mysql.procs_priv TO procs_priv_backup;
-FLUSH TABLE mysql.procs_priv;
-
-# DROP FUNCTION used to cause an assert.
-DROP FUNCTION f1;
-SHOW WARNINGS;
-
---echo # Restore the procs_priv table
-RENAME TABLE procs_priv_backup TO mysql.procs_priv;
-FLUSH TABLE mysql.procs_priv;
-
-
---echo #
---echo # Bug #56137 "Assertion `thd->lock == 0' failed on upgrading from
---echo # 5.1.50 to 5.5.6".
---echo #
---disable_warnings
-drop database if exists mysqltest;
---enable_warnings
---echo # Backup mysql.proc.
-flush table mysql.proc;
-let $MYSQLD_DATADIR= `select @@datadir`;
---copy_file $MYSQLD_DATADIR/mysql/proc.frm $MYSQLTEST_VARDIR/tmp/proc.frm
---copy_file $MYSQLD_DATADIR/mysql/proc.MYD $MYSQLTEST_VARDIR/tmp/proc.MYD
---copy_file $MYSQLD_DATADIR/mysql/proc.MYI $MYSQLTEST_VARDIR/tmp/proc.MYI
-
-create database mysqltest;
---echo # Corrupt mysql.proc to make it unusable by current version of server.
-alter table mysql.proc drop column security_type;
---echo # The below statement should not cause assertion failure.
-drop database mysqltest;
-
---echo # Restore mysql.proc.
-drop table mysql.proc;
---copy_file $MYSQLTEST_VARDIR/tmp/proc.frm $MYSQLD_DATADIR/mysql/proc.frm
---copy_file $MYSQLTEST_VARDIR/tmp/proc.MYD $MYSQLD_DATADIR/mysql/proc.MYD
---copy_file $MYSQLTEST_VARDIR/tmp/proc.MYI $MYSQLD_DATADIR/mysql/proc.MYI
---remove_file $MYSQLTEST_VARDIR/tmp/proc.frm
---remove_file $MYSQLTEST_VARDIR/tmp/proc.MYD
---remove_file $MYSQLTEST_VARDIR/tmp/proc.MYI
-
-
---echo #
---echo # Bug#58414 mysql_upgrade fails on dump upgrade between 5.1.53 -> 5.5.8
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS proc_backup;
-DROP DATABASE IF EXISTS db1;
---enable_warnings
-
---echo # Backup the proc table
-RENAME TABLE mysql.proc TO proc_backup;
-CREATE TABLE mysql.proc LIKE proc_backup;
-
-CREATE DATABASE db1;
-CREATE PROCEDURE db1.p1() SET @foo = 10;
-
---echo # Modify a field of the table.
-ALTER TABLE mysql.proc MODIFY comment CHAR (32);
-
-# This should not fail even if mysql.proc is invalid.
-DROP DATABASE db1;
-
---echo # Restore mysql.proc
-DROP TABLE mysql.proc;
-RENAME TABLE proc_backup TO mysql.proc;
-
-#
-# BUG#19875331 - HANDLE_FATAL_SIGNAL 11 IN STRMAKE
-#
-create database mysqltest1;
-create procedure mysqltest1.foo() select "foo";
-update mysql.proc set name='' where db='mysqltest1';
-drop database mysqltest1;
-
-
---echo #
---echo # MDEV-15444 Querying I_S.PARAMETERS can crash with a corrupted mysql.proc
---echo #
-
-CREATE OR REPLACE FUNCTION f1 (a INT) RETURNS INT RETURN 10;
-CREATE OR REPLACE FUNCTION f2 (a INT) RETURNS INT RETURN 10;
-
-# Get the current data type for mysql.proc.type
---vertical_results
-SELECT
- @type0:=COLUMN_TYPE AS t0,
- @type1:=REPLACE(COLUMN_TYPE,')',',''XXX'')') AS t1
- FROM INFORMATION_SCHEMA.COLUMNS
-WHERE table_schema='mysql' AND table_name='proc' AND column_name='type';
---horizontal_results
-
-# Change mysql.proc.type and update the record for 'f1'
-EXECUTE IMMEDIATE CONCAT('ALTER TABLE mysql.proc MODIFY type ', @type1);
-SHOW COLUMNS IN mysql.proc LIKE 'type';
-UPDATE mysql.proc SET type='XXX' WHERE name='f1' AND db='test';
-
-# Check the I_S query
---vertical_results
-SELECT * FROM INFORMATION_SCHEMA.PARAMETERS WHERE SPECIFIC_SCHEMA='test';
---horizontal_results
-
-# Restore the record for 'f1' and restore mysql.proc.type
-UPDATE mysql.proc SET type='FUNCTION' WHERE name='f1' AND db='test';
-EXECUTE IMMEDIATE CONCAT('ALTER TABLE mysql.proc MODIFY type ', @type0);
-SHOW COLUMNS IN mysql.proc LIKE 'type';
-
-DROP FUNCTION f1;
-DROP FUNCTION f2;
diff --git a/mysql-test/t/sp-dynamic.test b/mysql-test/t/sp-dynamic.test
deleted file mode 100644
index 3a467e26818..00000000000
--- a/mysql-test/t/sp-dynamic.test
+++ /dev/null
@@ -1,362 +0,0 @@
-delimiter |;
-
---disable_warnings
-drop procedure if exists p1|
-drop procedure if exists p2|
---enable_warnings
-
-######################################################################
-# Test Dynamic SQL in stored procedures. #############################
-######################################################################
-#
-# A. Basics
-#
-create procedure p1()
-begin
- prepare stmt from "select 1";
- execute stmt;
- execute stmt;
- execute stmt;
- deallocate prepare stmt;
-end|
-call p1()|
-call p1()|
-call p1()|
-drop procedure p1|
-#
-# B. Recursion. Recusion is disabled in SP, and recursive use of PS is not
-# possible as well.
-#
-create procedure p1()
-begin
- execute stmt;
-end|
-prepare stmt from "call p1()"|
-# Allow SP resursion to be show that it has not influence here
-set @SAVE_SP_RECURSION_LEVELS=@@max_sp_recursion_depth|
-set @@max_sp_recursion_depth=100|
---error ER_PS_NO_RECURSION
-execute stmt|
---error ER_PS_NO_RECURSION
-execute stmt|
---error ER_PS_NO_RECURSION
-execute stmt|
---error ER_PS_NO_RECURSION
-call p1()|
---error ER_PS_NO_RECURSION
-call p1()|
---error ER_PS_NO_RECURSION
-call p1()|
-set @@max_sp_recursion_depth=@SAVE_SP_RECURSION_LEVELS|
---error ER_SP_RECURSION_LIMIT
-call p1()|
---error ER_SP_RECURSION_LIMIT
-call p1()|
---error ER_SP_RECURSION_LIMIT
-call p1()|
-
-drop procedure p1|
-#
-# C. Create/drop a stored procedure in Dynamic SQL.
-# One cannot create stored procedure from a stored procedure because of
-# the way MySQL SP cache works: it's important that this limitation is not
-# possible to circumvent by means of Dynamic SQL.
-#
-create procedure p1()
-begin
- prepare stmt from "create procedure p2() begin select 1; end";
- execute stmt;
- deallocate prepare stmt;
-end|
---error ER_UNSUPPORTED_PS
-call p1()|
---error ER_UNSUPPORTED_PS
-call p1()|
-drop procedure p1|
-create procedure p1()
-begin
- prepare stmt from "drop procedure p2";
- execute stmt;
- deallocate prepare stmt;
-end|
---error ER_UNSUPPORTED_PS
-call p1()|
---error ER_UNSUPPORTED_PS
-call p1()|
-drop procedure p1|
-#
-# D. Create/Drop/Alter a table (a DDL that issues a commit) in Dynamic SQL.
-# (should work ok).
-#
-create procedure p1()
-begin
- prepare stmt_drop from "drop table if exists t1";
- execute stmt_drop;
- prepare stmt from "create table t1 (a int)";
- execute stmt;
- insert into t1 (a) values (1);
- select * from t1;
- prepare stmt_alter from "alter table t1 add (b int)";
- execute stmt_alter;
- insert into t1 (a,b) values (2,1);
- deallocate prepare stmt_alter;
- deallocate prepare stmt;
- deallocate prepare stmt_drop;
-end|
-call p1()|
-call p1()|
-drop procedure p1|
-#
-# A more real example (a case similar to submitted by 24/7).
-#
-create procedure p1()
-begin
- set @tab_name=concat("tab_", replace(curdate(), '-', '_'));
- set @drop_sql=concat("drop table if exists ", @tab_name);
- set @create_sql=concat("create table ", @tab_name, " (a int)");
- set @insert_sql=concat("insert into ", @tab_name, " values (1), (2), (3)");
- set @select_sql=concat("select * from ", @tab_name);
- select @tab_name;
- select @drop_sql;
- select @create_sql;
- select @insert_sql;
- select @select_sql;
- prepare stmt_drop from @drop_sql;
- execute stmt_drop;
- prepare stmt from @create_sql;
- execute stmt;
- prepare stmt from @insert_sql;
- execute stmt;
- prepare stmt from @select_sql;
- execute stmt;
- execute stmt_drop;
- deallocate prepare stmt;
- deallocate prepare stmt_drop;
-end|
---disable_result_log
-call p1()|
-call p1()|
---enable_result_log
-drop procedure p1|
-#
-# E. Calling a stored procedure with Dynamic SQL
-# from a stored function (currently disabled).
-#
-create procedure p1()
-begin
- prepare stmt_drop from "drop table if exists t1";
- execute stmt_drop;
- prepare stmt from "create table t1 (a int)";
- execute stmt;
- deallocate prepare stmt;
- deallocate prepare stmt_drop;
-end|
---disable_warnings
-drop function if exists f1|
---enable_warnings
-create function f1(a int) returns int
-begin
- call p1();
- return 1;
-end|
-
-# Every stored procedure that contains Dynamic SQL is marked as
-# such. Stored procedures that contain Dynamic SQL are not
-# allowed in a stored function or trigger, and here we get the
-# corresponding error message.
-
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-select f1(0)|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-select f1(f1(0))|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-select f1(f1(f1(0)))|
-drop function f1|
-drop procedure p1|
-#
-# F. Rollback and cleanup lists management in Dynamic SQL.
-#
-create procedure p1()
-begin
- drop table if exists t1;
- create table t1 (id integer not null primary key,
- name varchar(20) not null);
- insert into t1 (id, name) values (1, 'aaa'), (2, 'bbb'), (3, 'ccc');
- prepare stmt from "select name from t1";
- execute stmt;
- select name from t1;
- execute stmt;
- prepare stmt from
- "select name from t1 where name=(select name from t1 where id=2)";
- execute stmt;
- select name from t1 where name=(select name from t1 where id=2);
- execute stmt;
-end|
-call p1()|
-call p1()|
-drop procedure p1|
-#
-# H. Executing a statement prepared externally in SP.
-#
-prepare stmt from "select * from t1"|
-create procedure p1()
-begin
- execute stmt;
- deallocate prepare stmt;
-end|
-call p1()|
---error ER_UNKNOWN_STMT_HANDLER
-call p1()|
-drop procedure p1|
-#
-# I. Use of an SP variable in Dynamic SQL is not possible and
-# this limitation is necessary for correct binary logging: prepared
-# statements do not substitute SP variables with their values for binlog, so
-# SP variables must be not accessible in Dynamic SQL.
-#
-set sql_mode= ''|
-create procedure p1()
-begin
- declare a char(10);
- set a="sp-variable";
- set @a="mysql-variable";
- prepare stmt from "select 'dynamic sql:', @a, a";
- execute stmt;
-end|
---error ER_BAD_FIELD_ERROR
-call p1()|
---error ER_BAD_FIELD_ERROR
-call p1()|
-set sql_mode= DEFAULT|
-drop procedure p1|
-#
-# J. Use of placeholders in Dynamic SQL.
-#
-create procedure p1()
-begin
- prepare stmt from 'select ? as a';
- execute stmt using @a;
-end|
-set @a=1|
-call p1()|
-call p1()|
-drop procedure p1|
-#
-# K. Use of continue handlers with Dynamic SQL.
-#
-drop table if exists t1|
-drop table if exists t2|
-create table t1 (id integer primary key auto_increment,
- stmt_text char(35), status varchar(20))|
-insert into t1 (stmt_text) values
- ("select 1"), ("flush tables"), ("handler t1 open as ha"),
- ("analyze table t1"), ("check table t1"), ("checksum table t1"),
- ("check table t1"), ("optimize table t1"), ("repair table t1"),
- ("describe extended select * from t1"),
- ("help help"), ("show databases"), ("show tables"),
- ("show table status"), ("show open tables"), ("show storage engines"),
- ("insert into t1 (id) values (1)"), ("update t1 set status=''"),
- ("delete from t1"), ("truncate t1"), ("call p1()"), ("foo bar"),
- ("create view v1 as select 1"), ("alter view v1 as select 2"),
- ("drop view v1"),("create table t2 (a int)"),("alter table t2 add (b int)"),
- ("drop table t2")|
-create procedure p1()
-begin
- declare v_stmt_text varchar(255);
- declare v_id integer;
- declare done int default 0;
- declare c cursor for select id, stmt_text from t1;
- declare continue handler for 1295 -- ER_UNSUPPORTED_PS
- set @status='not supported';
- declare continue handler for 1064 -- ER_SYNTAX_ERROR
- set @status='syntax error';
- declare continue handler for sqlstate '02000' set done = 1;
-
- prepare update_stmt from "update t1 set status=? where id=?";
- open c;
- repeat
- if not done then
- fetch c into v_id, v_stmt_text;
- set @id=v_id, @stmt_text=v_stmt_text;
- set @status="supported";
- prepare stmt from @stmt_text;
- execute update_stmt using @status, @id;
- end if;
- until done end repeat;
- deallocate prepare update_stmt;
-end|
-call p1()|
-select * from t1|
-drop procedure p1|
-drop table t1|
-#
-# Bug#7115 "Prepared Statements: packet error if execution within stored
-# procedure".
-#
-prepare stmt from 'select 1'|
-create procedure p1() execute stmt|
-call p1()|
-call p1()|
-drop procedure p1|
-#
-# Bug#10975 "Prepared statements: crash if function deallocates"
-# Check that a prepared statement that is currently in use
-# can't be deallocated.
-#
-# a) Prepared statements and stored procedure cache:
-#
-# TODO: add when the corresponding bug (Bug #12093 "SP not found on second
-# PS execution if another thread drops other SP in between") is fixed.
-#
-# b) attempt to deallocate a prepared statement that is being executed
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function f1() returns int
-begin
- deallocate prepare stmt;
- return 1;
-end|
-
-# b)-2 a crash (#1) spotted by Sergey Petrunia during code review
-create procedure p1()
-begin
- prepare stmt from 'select 1 A';
- execute stmt;
-end|
-prepare stmt from 'call p1()'|
---error ER_PS_NO_RECURSION
-execute stmt|
---error ER_PS_NO_RECURSION
-execute stmt|
-drop procedure p1|
-
-#
-# Bug#10605 "Stored procedure with multiple SQL prepared statements
-# disconnects client"
-#
---disable_warnings
-drop table if exists t1, t2|
---enable_warnings
-create procedure p1 (a int) language sql deterministic
-begin
- declare rsql varchar(100);
- drop table if exists t1, t2;
- set @rsql= "create table t1 (a int)";
- select @rsql;
- prepare pst from @rsql;
- execute pst;
- set @rsql= null;
- set @rsql= "create table t2 (a int)";
- select @rsql;
- prepare pst from @rsql;
- execute pst;
- drop table if exists t1, t2;
-end|
-set @a:=0|
-call p1(@a)|
-select @a|
-call p1(@a)|
-select @a|
-drop procedure if exists p1|
-
-# End of the test
-delimiter ;|
diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test
deleted file mode 100644
index 0e16948f438..00000000000
--- a/mysql-test/t/sp-error.test
+++ /dev/null
@@ -1,3851 +0,0 @@
-#
-# Stored PROCEDURE error tests
-#
-
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-
-# Backup the mysql.proc table
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval SELECT * FROM mysql.proc INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/proc.txt';
-
-# Make sure we don't have any procedures left.
-delete from mysql.proc;
-
-delimiter |;
-
-# This should give three syntax errors (sometimes crashed; bug #643)
-# (Unfortunately, this is not a 100% test, on some platforms this
-# passed despite the bug.)
---error 1064
-create procedure syntaxerror(t int)|
---error 1064
-create procedure syntaxerror(t int)|
---error 1064
-create procedure syntaxerror(t int)|
-
-# Check that we get the right error, i.e. UDF declaration parses correctly,
-# but foo.so doesn't exist.
-# This generates an error message containing a misleading errno which
-# might vary between systems (it usually doesn't have anything to do with
-# the actual failing dlopen()).
-#--error 1126
-#create function foo returns real soname "foo.so"|
-
-
---disable_warnings
-drop table if exists t3|
---enable_warnings
-create table t3 ( x int )|
-insert into t3 values (2), (3)|
-
-create procedure bad_into(out param int)
- select x from t3 into param|
-
---error 1172
-call bad_into(@x)|
-
-drop procedure bad_into|
-drop table t3|
-
-
-create procedure proc1()
- set @x = 42|
-
-create function func1() returns int
- return 42|
-
-# Can't create recursively
---error 1303
-create procedure foo()
- create procedure bar() set @x=3|
---error 1303
-create procedure foo()
- create function bar() returns double return 2.3|
-
-# Already exists
---error 1304
-create procedure proc1()
- set @x = 42|
---error 1304
-create function func1() returns int
- return 42|
-
-drop procedure proc1|
-drop function func1|
-
-# Does not exist
---error 1305
-alter procedure foo|
---error 1305
-alter function foo|
---error 1305
-drop procedure foo|
---error 1305
-drop function foo|
---error 1305
-call foo()|
-drop procedure if exists foo|
---error 1305
-show create procedure foo|
---error 1305
-show create function foo|
-
-# LEAVE/ITERATE with no match
---error 1308
-create procedure foo()
-foo: loop
- leave bar;
-end loop|
---error 1308
-create procedure foo()
-foo: loop
- iterate bar;
-end loop|
---error 1308
-create procedure foo()
-foo: begin
- iterate foo;
-end|
-
-# Redefining label
---error 1309
-create procedure foo()
-foo: loop
- foo: loop
- set @x=2;
- end loop foo;
-end loop foo|
-
-# End label mismatch
---error 1310
-create procedure foo()
-foo: loop
- set @x=2;
-end loop bar|
-
-# RETURN in FUNCTION only
---error 1313
-create procedure foo()
- return 42|
-
-# Wrong number of arguments
-create procedure p(x int)
- set @x = x|
-create function f(x int) returns int
- return x+42|
-
---error 1318
-call p()|
---error 1318
-call p(1, 2)|
---error 1318
-select f()|
---error 1318
-select f(1, 2)|
-
-drop procedure p|
-drop function f|
-
---error 1319
-create procedure p(val int, out res int)
-begin
- declare x int default 0;
- declare continue handler for foo set x = 1;
-
- insert into test.t1 values (val);
- if (x) then
- set res = 0;
- else
- set res = 1;
- end if;
-end|
-
---error 1319
-create procedure p(val int, out res int)
-begin
- declare x int default 0;
- declare foo condition for 1146;
- declare continue handler for bar set x = 1;
-
- insert into test.t1 values (val);
- if (x) then
- set res = 0;
- else
- set res = 1;
- end if;
-end|
-
---error 1320
-create function f(val int) returns int
-begin
- declare x int;
-
- set x = val+3;
-end|
-
-create function f(val int) returns int
-begin
- declare x int;
-
- set x = val+3;
- if x < 4 then
- return x;
- end if;
-end|
-
---error 1321
-select f(10)|
-
-drop function f|
-
---error ER_PARSE_ERROR
-create procedure p()
-begin
- declare c cursor for insert into test.t1 values ("foo", 42);
-
- open c;
- close c;
-end|
-
---error 1323
-create procedure p()
-begin
- declare x int;
- declare c cursor for select * into x from test.t limit 1;
-
- open c;
- close c;
-end|
-
---error 1324
-create procedure p()
-begin
- declare c cursor for select * from test.t;
-
- open cc;
- close c;
-end|
-
---disable_warnings
-drop table if exists t1|
---enable_warnings
-create table t1 (val int)|
-
-create procedure p()
-begin
- declare c cursor for select * from test.t1;
-
- open c;
- open c;
- close c;
-end|
---error 1325
-call p()|
-drop procedure p|
-
-create procedure p()
-begin
- declare c cursor for select * from test.t1;
-
- open c;
- close c;
- close c;
-end|
---error 1326
-call p()|
-drop procedure p|
-
---error 1305
-alter procedure bar3 sql security invoker|
-
-drop table t1|
-
---disable_warnings
-drop table if exists t1|
---enable_warnings
-create table t1 (val int, x float)|
-insert into t1 values (42, 3.1), (19, 1.2)|
-
---error 1327
-create procedure p()
-begin
- declare x int;
- declare c cursor for select * from t1;
-
- open c;
- fetch c into x, y;
- close c;
-end|
-
-create procedure p()
-begin
- declare x int;
- declare c cursor for select * from t1;
-
- open c;
- fetch c into x;
- close c;
-end|
---error 1328
-call p()|
-drop procedure p|
-
-create procedure p()
-begin
- declare x int;
- declare y float;
- declare z int;
- declare c cursor for select * from t1;
-
- open c;
- fetch c into x, y, z;
- close c;
-end|
---error 1328
-call p()|
-drop procedure p|
-
---error 1330
-create procedure p(in x int, x char(10))
-begin
-end|
---error 1330
-create function p(x int, x char(10))
-begin
-end|
-
---error 1331
-create procedure p()
-begin
- declare x float;
- declare x int;
-end|
-
---error 1332
-create procedure p()
-begin
- declare c condition for 1064;
- declare c condition for 1065;
-end|
-
---error 1333
-create procedure p()
-begin
- declare c cursor for select * from t1;
- declare c cursor for select field from t1;
-end|
-
-# USE is not allowed
---error ER_SP_BADSTATEMENT
-create procedure u()
- use sptmp|
-
-# Enforced standard order of declarations
---error 1337
-create procedure p()
-begin
- declare c cursor for select * from t1;
- declare x int;
-end|
---error 1337
-create procedure p()
-begin
- declare x int;
- declare continue handler for sqlstate '42S99' set x = 1;
- declare foo condition for sqlstate '42S99';
-end|
-
---error 1338
-create procedure p()
-begin
- declare x int;
- declare continue handler for sqlstate '42S99' set x = 1;
- declare c cursor for select * from t1;
-end|
-
-# Check in and inout arguments.
---disable_warnings
-drop procedure if exists p|
---enable_warnings
-create procedure p(in x int, inout y int, out z int)
-begin
- set y = x+y;
- set z = x+y;
-end|
-
-set @tmp_x = 42|
-set @tmp_y = 3|
-set @tmp_z = 0|
-# For reference: this is ok
-call p(@tmp_x, @tmp_y, @tmp_z)|
-select @tmp_x, @tmp_y, @tmp_z|
-
---error ER_SP_NOT_VAR_ARG
-call p(42, 43, @tmp_z)|
---error ER_SP_NOT_VAR_ARG
-call p(42, @tmp_y, 43)|
-
-drop procedure p|
-
-
-#
-# Let us test that we can access mysql.proc table for routines
-# definitions lookup without locking it explicitly.
-#
-create procedure p() begin end|
-lock table t1 read|
-# This should succeed
-call p()|
-unlock tables|
-drop procedure p|
-# Let us check restrictions which this ability puts on mysql.proc locking.
---error ER_WRONG_LOCK_OF_SYSTEM_TABLE
-lock tables t1 read, mysql.proc write|
---error ER_WRONG_LOCK_OF_SYSTEM_TABLE
-lock tables mysql.proc write, mysql.user write|
-# Locking for read should be OK
-lock tables t1 read, mysql.proc read|
-unlock tables|
-# You also should be able lock only mysql.proc for write
-lock tables mysql.proc write|
-unlock tables|
-
-
-#
-# Check that in functions we don't allow to update tables which
-# are used by statements which invoke these functions.
-#
---disable_warnings
-drop function if exists f1|
---enable_warnings
-create function f1(i int) returns int
-begin
- insert into t1 (val) values (i);
- return 0;
-end|
---error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
-select val, f1(val) from t1|
-# Table alias should not matter
---error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
-select val, f1(val) from t1 as tab|
-select * from t1|
---error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
-update t1 set val= f1(val)|
-select * from t1|
-# But this should be OK
-select f1(17)|
-select * from t1|
-# Cleanup
-delete from t1 where val= 17|
-drop function f1|
-
-
-#
-# BUG#1965
-#
-create procedure bug1965()
-begin
- declare c cursor for select val from t1 order by valname;
- open c;
- close c;
-end|
-
---error 1054
-call bug1965()|
-drop procedure bug1965|
-
-#
-# BUG#1966
-#
---error 1327
-select 1 into a|
-
-#
-# BUG#1653
-#
---disable_warnings
-drop table if exists t3|
---enable_warnings
-create table t3 (column_1_0 int)|
-
-create procedure bug1653()
- update t3 set column_1 = 0|
-
---error 1054
-call bug1653()|
-drop table t3|
-create table t3 (column_1 int)|
-call bug1653()|
-
-drop procedure bug1653|
-drop table t3|
-
-#
-# BUG#2259
-#
-# Note: When this bug existed, it did not necessarily cause a crash
-# in all builds, but valgrind did give warnings.
-create procedure bug2259()
-begin
- declare v1 int;
- declare c1 cursor for select s1 from t1;
-
- fetch c1 into v1;
-end|
-
---error 1326
-call bug2259()|
-drop procedure bug2259|
-
-#
-# BUG#2272
-#
-create procedure bug2272()
-begin
- declare v int;
-
- update t1 set v = 42;
-end|
-
-insert into t1 values (666, 51.3)|
---error 1054
-call bug2272()|
-truncate table t1|
-drop procedure bug2272|
-
-#
-# BUG#2329
-#
-create procedure bug2329_1()
-begin
- declare v int;
-
- insert into t1 (v) values (5);
-end|
-
-create procedure bug2329_2()
-begin
- declare v int;
-
- replace t1 set v = 5;
-end|
-
---error 1054
-call bug2329_1()|
---error 1054
-call bug2329_2()|
-drop procedure bug2329_1|
-drop procedure bug2329_2|
-
-#
-# BUG#3287
-#
-create function bug3287() returns int
-begin
- declare v int default null;
-
- case
- when v is not null then return 1;
- end case;
- return 2;
-end|
---error 1339
-select bug3287()|
-drop function bug3287|
-
-create procedure bug3287(x int)
-case x
-when 0 then
- insert into test.t1 values (x, 0.1);
-when 1 then
- insert into test.t1 values (x, 1.1);
-end case|
---error 1339
-call bug3287(2)|
-drop procedure bug3287|
-
-#
-# BUG#3297
-#
---disable_warnings
-drop table if exists t3|
---enable_warnings
-create table t3 (s1 int, primary key (s1))|
-insert into t3 values (5),(6)|
-
-create procedure bug3279(out y int)
-begin
- declare x int default 0;
- begin
- declare exit handler for sqlexception set x = x+1;
- insert into t3 values (5);
- end;
- if x < 2 then
- set x = x+1;
- insert into t3 values (6);
- end if;
- set y = x;
-end|
-
-set @x = 0|
---error ER_DUP_ENTRY
-call bug3279(@x)|
-select @x|
-drop procedure bug3279|
-drop table t3|
-
-#
-# BUG#3339
-#
---error 1049
-create procedure nodb.bug3339() begin end|
-
-#
-# BUG#2653
-#
-create procedure bug2653_1(a int, out b int)
- set b = aa|
-
-create procedure bug2653_2(a int, out b int)
-begin
- if aa < 0 then
- set b = - a;
- else
- set b = a;
- end if;
-end|
-
---error 1054
-call bug2653_1(1, @b)|
---error 1054
-call bug2653_2(2, @b)|
-
-drop procedure bug2653_1|
-drop procedure bug2653_2|
-
-#
-# BUG#4344
-#
---error 1357
-create procedure bug4344() drop procedure bug4344|
---error 1357
-create procedure bug4344() drop function bug4344|
-
-#
-# BUG#3294: Stored procedure crash if table dropped before use
-# (Actually, when an error occurs within an error handler.)
---disable_warnings
-drop procedure if exists bug3294|
---enable_warnings
-create procedure bug3294()
-begin
- declare continue handler for sqlexception drop table t5;
- drop table t5;
- drop table t5;
-end|
-
-create table t5 (x int)|
---error 1051
-call bug3294()|
-drop procedure bug3294|
-
-#
-# BUG#876: Stored Procedures: Invalid SQLSTATE is allowed in
-# a DECLARE ? HANDLER FOR stmt.
-#
---disable_warnings
-drop procedure if exists bug8776_1|
-drop procedure if exists bug8776_2|
-drop procedure if exists bug8776_3|
-drop procedure if exists bug8776_4|
---enable_warnings
---error ER_SP_BAD_SQLSTATE
-create procedure bug8776_1()
-begin
- declare continue handler for sqlstate '42S0200test' begin end;
- begin end;
-end|
-
---error ER_SP_BAD_SQLSTATE
-create procedure bug8776_2()
-begin
- declare continue handler for sqlstate '4200' begin end;
- begin end;
-end|
-
---error ER_SP_BAD_SQLSTATE
-create procedure bug8776_3()
-begin
- declare continue handler for sqlstate '420000' begin end;
- begin end;
-end|
-
---error ER_SP_BAD_SQLSTATE
-create procedure bug8776_4()
-begin
- declare continue handler for sqlstate '42x00' begin end;
- begin end;
-end|
-
-
-#
-# BUG#6600: Stored procedure crash after repeated calls with check table
-#
---error ER_SP_BADSTATEMENT
-create procedure bug6600()
- check table t1|
-
-# Check these two as well, while we're at it. (Although it isn't really
-# related to the bug report, but to the fix.)
---error ER_SP_BADSTATEMENT
-create procedure bug6600()
- lock table t1 read|
---error ER_SP_BADSTATEMENT
-create procedure bug6600()
- unlock table t1|
-
-#
-# BUG#9566: explicit LOCK TABLE and store procedures result in illegal state
-#
-# We should not think that mysql.proc table does not exist if we are unable
-# to open it under LOCK TABLE or in prelocked mode.
-#
---disable_warnings
-drop procedure if exists bug9566|
---enable_warnings
-create procedure bug9566()
-begin
- select * from t1;
-end|
-lock table t1 read|
-# This should fail since we forgot to lock mysql.proc for writing
-# explicitly, and we can't open mysql.proc for _writing_ if there
-# are locked tables.
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-alter procedure bug9566 comment 'Some comment'|
-unlock tables|
-# This should succeed
-drop procedure bug9566|
-
-
-#
-# BUG#7299: Stored procedures: exception handler catches not-found conditions
-#
---disable_warnings
-drop procedure if exists bug7299|
---enable_warnings
-create procedure bug7299()
-begin
- declare v int;
- declare c cursor for select val from t1;
- declare exit handler for sqlexception select 'Error!';
-
- open c;
- fetch c into v;
-end|
-
-truncate table t1|
---error ER_SP_FETCH_NO_DATA
-call bug7299()|
-drop procedure bug7299|
-
-
-#
-# BUG#9073: Able to declare two handlers for same condition in same scope
-#
---error ER_SP_DUP_HANDLER
-create procedure bug9073()
-begin
- declare continue handler for sqlexception select 1;
- declare continue handler for sqlexception select 2;
-end|
---error ER_SP_DUP_HANDLER
-create procedure bug9073()
-begin
- declare condname1 condition for 1234;
- declare continue handler for condname1 select 1;
- declare exit handler for condname1 select 2;
-end|
---error ER_SP_DUP_HANDLER
-create procedure bug9073()
-begin
- declare condname1 condition for sqlstate '42000';
- declare condname2 condition for sqlstate '42000';
- declare exit handler for condname1 select 1;
- declare continue handler for condname2 select 2;
-end|
---error ER_SP_DUP_HANDLER
-create procedure bug9073()
-begin
- declare condname1 condition for sqlstate '42000';
- declare exit handler for condname1 select 1;
- declare exit handler for sqlstate '42000' select 2;
-end|
-
-# This should still work.
---disable_warnings
-drop procedure if exists bug9073|
---enable_warnings
-create procedure bug9073()
-begin
- declare condname1 condition for sqlstate '42000';
- declare continue handler for condname1 select 1;
- begin
- declare exit handler for sqlstate '42000' select 2;
- begin
- declare continue handler for sqlstate '42000' select 3;
- end;
- end;
-end|
-drop procedure bug9073|
-
-
-#
-# BUG#7047: Stored procedure crash if alter procedure
-#
---error ER_SP_NO_DROP_SP
-create procedure bug7047()
- alter procedure bug7047|
---error ER_SP_NO_DROP_SP
-create function bug7047() returns int
-begin
- alter function bug7047;
- return 0;
-end|
-
-
-#
-# BUG#8408: Stored procedure crash if function contains SHOW
-# BUG#9058: Stored Procedures: Crash if function included SELECT
-#
-
-# Some things are caught when parsing
---error ER_SP_NO_RETSET
-create function bug8408() returns int
-begin
- select * from t1;
- return 0;
-end|
---error ER_SP_NO_RETSET
-create function bug8408() returns int
-begin
- show warnings;
- return 0;
-end|
---error ER_SP_NO_RETSET
-create function bug8408(a int) returns int
-begin
- declare b int;
- select b;
- return b;
-end|
-
---disable_warnings
-drop function if exists bug8408_f|
-drop procedure if exists bug8408_p|
---enable_warnings
-
-# Some things must be caught at invokation time
-create function bug8408_f() returns int
-begin
- call bug8408_p();
- return 0;
-end|
-create procedure bug8408_p()
- select * from t1|
-
-call bug8408_p()|
---error ER_SP_NO_RETSET
-select bug8408_f()|
-
-drop procedure bug8408_p|
-drop function bug8408_f|
-
-# But this is ok
-create function bug8408() returns int
-begin
- declare n int default 0;
- select count(*) into n from t1;
- return n;
-end|
-
-insert into t1 value (2, 2.7), (3, 3.14), (7, 7.0)|
-select *,bug8408() from t1|
-
-drop function bug8408|
-truncate table t1|
-
-
-#
-# BUG#10537: Server crashes while loading data file into table through
-# procedure.
-# Disable load until it's PS and SP safe
---disable_warnings
-drop procedure if exists bug10537|
---enable_warnings
---error ER_SP_BADSTATEMENT
-create procedure bug10537()
- load data local infile '/tmp/somefile' into table t1|
-
-
-#
-# BUG#8409: Stored procedure crash if function contains FLUSH
-#
---disable_warnings
-drop function if exists bug8409|
---enable_warnings
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function bug8409()
- returns int
-begin
- flush tables;
- return 5;
-end|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function bug8409() returns int begin reset query cache;
-return 1; end|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function bug8409() returns int begin reset master;
-return 1; end|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function bug8409() returns int begin reset slave;
-return 1; end|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function bug8409() returns int begin flush hosts;
-return 1; end|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function bug8409() returns int begin flush privileges;
-return 1; end|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function bug8409() returns int begin flush tables with read lock;
-return 1; end|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function bug8409() returns int begin flush tables;
-return 1; end|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function bug8409() returns int begin flush logs;
-return 1; end|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function bug8409() returns int begin flush status;
-return 1; end|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function bug8409() returns int begin flush slave;
-return 1; end|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function bug8409() returns int begin flush master;
-return 1; end|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function bug8409() returns int begin flush des_key_file;
-return 1; end|
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create function bug8409() returns int begin flush user_resources;
-return 1; end|
-
-
-#
-# BUG#9529: Stored Procedures: No Warning on truncation of procedure name
-# during creation.
-# BUG#17015: Routine name truncation not an error
-# When we started using utf8 for mysql.proc, this limit appeared
-# to be higher, but in reality the names were truncated.
---error ER_TOO_LONG_IDENT
-create procedure bug9529_901234567890123456789012345678901234567890123456789012345()
-begin
-end|
-
---disable_warnings
-drop procedure if exists bug17015_0123456789012345678901234567890123456789012345678901234|
---enable_warnings
-# Check the upper limit, just to make sure.
-create procedure bug17015_0123456789012345678901234567890123456789012345678901234()
-begin
-end|
-
---replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
-show procedure status like 'bug17015%'|
-drop procedure bug17015_0123456789012345678901234567890123456789012345678901234|
-
-
-#
-# BUG#10969: Stored procedures: crash if default() function
-#
---disable_warnings
-drop procedure if exists bug10969|
---enable_warnings
---error ER_WRONG_COLUMN_NAME
-create procedure bug10969()
-begin
- declare s1 int default 0;
- select default(s1) from t30;
-end|
-
-# This should work
-create procedure bug10969()
-begin
- declare s1 int default 0;
- select default(t30.s1) from t30;
-end|
-
-drop procedure bug10969|
-
-
-drop table t1|
-
-delimiter ;|
-
-# BUG#9814: Closing a cursor that is not open
-create table t1(f1 int);
-create table t2(f1 int);
-
-delimiter |;
-CREATE PROCEDURE SP001()
-P1: BEGIN
- DECLARE ENDTABLE INT DEFAULT 0;
- DECLARE TEMP_NUM INT;
- DECLARE TEMP_SUM INT;
- DECLARE C1 CURSOR FOR SELECT F1 FROM t1;
- DECLARE C2 CURSOR FOR SELECT F1 FROM t2;
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET ENDTABLE = 1;
-
- SET ENDTABLE=0;
- SET TEMP_SUM=0;
- SET TEMP_NUM=0;
-
- OPEN C1;
-
- FETCH C1 INTO TEMP_NUM;
- WHILE ENDTABLE = 0 DO
- SET TEMP_SUM=TEMP_NUM+TEMP_SUM;
- FETCH C1 INTO TEMP_NUM;
- END WHILE;
- SELECT TEMP_SUM;
- CLOSE C1;
- CLOSE C1;
- SELECT 'end of proc';
-END P1|
-delimiter ;|
---error 1326
-call SP001();
-drop procedure SP001;
-drop table t1, t2;
-
-# Bug #11394 "Recursion in SP crash server" and bug #11600 "Stored
-# procedures: crash with function calling itself".
-# We have to disable recursion since in many cases LEX and many
-# Item's can't be used in reentrant way nowdays.
-delimiter |;
---disable_warnings
-drop function if exists bug11394|
-drop function if exists bug11394_1|
-drop function if exists bug11394_2|
-drop procedure if exists bug11394|
---enable_warnings
-create function bug11394(i int) returns int
-begin
- if i <= 0 then
- return 0;
- else
- return (i in (100, 200, bug11394(i-1), 400));
- end if;
-end|
-# If we allow recursive functions without additional modifications
-# this will crash server since Item for "IN" is not reenterable.
---error 1424
-select bug11394(2)|
-drop function bug11394|
-create function bug11394_1(i int) returns int
-begin
- if i <= 0 then
- return 0;
- else
- return (select bug11394_1(i-1));
- end if;
-end|
-# The following statement will crash because some LEX members responsible
-# for selects cannot be used in reentrant fashion.
---error 1424
-select bug11394_1(2)|
-drop function bug11394_1|
-# Note that the following should be allowed since it does not contains
-# recursion
-create function bug11394_2(i int) returns int return i|
-select bug11394_2(bug11394_2(10))|
-drop function bug11394_2|
-create procedure bug11394(i int, j int)
-begin
- if i > 0 then
- call bug11394(i - 1,(select 1));
- end if;
-end|
---error ER_SP_RECURSION_LIMIT
-call bug11394(2, 1)|
-set @@max_sp_recursion_depth=10|
-call bug11394(2, 1)|
-set @@max_sp_recursion_depth=default|
-drop procedure bug11394|
-delimiter ;|
-
-
-#
-# BUG 12490 (Packets out of order if calling HELP CONTENTS from Stored Procedure)
-#
---error ER_SP_BADSTATEMENT
-CREATE PROCEDURE BUG_12490() HELP CONTENTS;
---error ER_PARSE_ERROR
-CREATE FUNCTION BUG_12490() RETURNS INT HELP CONTENTS;
-CREATE TABLE t_bug_12490(a int);
---error ER_SP_BADSTATEMENT
-CREATE TRIGGER BUG_12490 BEFORE UPDATE ON t_bug_12490 FOR EACH ROW HELP CONTENTS;
-DROP TABLE t_bug_12490;
-
-#
-# Bug#11834 "Re-execution of prepared statement with dropped function
-# crashes server". Also tests handling of prepared stmts which use
-# stored functions but does not require prelocking.
-#
---disable_warnings
-drop function if exists bug11834_1;
-drop function if exists bug11834_2;
---enable_warnings
-create function bug11834_1() returns int return 10;
-create function bug11834_2() returns int return bug11834_1();
-prepare stmt from "select bug11834_2()";
-execute stmt;
-# Re-execution of statement should not crash server.
-execute stmt;
-drop function bug11834_1;
-# Attempt to execute statement should return proper error and
-# should not crash server.
-
-# NOTE! The error we get from the below query indicates that the sp bug11834_2
-# does not exist(this is wrong but can be accepted)
-# This behaviour has been reported as bug#21294
---error ER_SP_DOES_NOT_EXIST
-execute stmt;
-deallocate prepare stmt;
-drop function bug11834_2;
-
-#
-# Bug#12953 "Stored procedures: crash if OPTIMIZE TABLE in function"
-#
-delimiter |;
---disable_warnings
-DROP FUNCTION IF EXISTS bug12953|
---enable_warnings
---error ER_SP_NO_RETSET
-CREATE FUNCTION bug12953() RETURNS INT
-BEGIN
- OPTIMIZE TABLE t1;
- RETURN 1;
-END|
-delimiter ;|
-
-#
-# Bug##12995 "Inside function "Table 't4' was not locked with LOCK TABLES"
-#
-delimiter |;
---disable_warnings
-DROP FUNCTION IF EXISTS bug12995|
---enable_warnings
---error ER_SP_BADSTATEMENT
-CREATE FUNCTION bug12995() RETURNS INT
-BEGIN
- HANDLER t1 OPEN;
- RETURN 1;
-END|
---error ER_SP_BADSTATEMENT
-CREATE FUNCTION bug12995() RETURNS INT
-BEGIN
- HANDLER t1 READ FIRST;
- RETURN 1;
-END|
---error ER_SP_BADSTATEMENT
-CREATE FUNCTION bug12995() RETURNS INT
-BEGIN
- HANDLER t1 CLOSE;
- RETURN 1;
-END|
---error 1305
-SELECT bug12995()|
-delimiter ;|
-
-
-#
-# BUG#12712: SET AUTOCOMMIT should fail within SP/functions/triggers
-#
---disable_warnings
-drop procedure if exists bug12712;
-drop function if exists bug12712;
---enable_warnings
-# Can...
-create procedure bug12712()
- set session autocommit = 0;
-
-select @@autocommit;
-set @au = @@autocommit;
-call bug12712();
-select @@autocommit;
-set session autocommit = @au;
-
-delimiter |;
-create function bug12712()
- returns int
-begin
- call bug12712();
- return 0;
-end|
-
-# Can't...
---error ER_SP_CANT_SET_AUTOCOMMIT
-set @x = bug12712()|
-drop procedure bug12712|
-drop function bug12712|
---error ER_SP_CANT_SET_AUTOCOMMIT
-create function bug12712()
- returns int
-begin
- set session autocommit = 0;
- return 0;
-end|
---error ER_SP_CANT_SET_AUTOCOMMIT
-create function bug12712()
- returns int
-begin
- set @@autocommit = 0;
- return 0;
-end|
---error ER_SP_CANT_SET_AUTOCOMMIT
-create function bug12712()
- returns int
-begin
- set local autocommit = 0;
- return 0;
-end|
-delimiter ;|
---error ER_SP_CANT_SET_AUTOCOMMIT
-create trigger bug12712
- before insert on t1 for each row set session autocommit = 0;
-
-#
-# BUG#9367: Stored procedures: client hang after "show warnings"
-#
---disable_parsing
---disable_warnings
-drop procedure if exists bug9367;
---enable_warnings
-create table t1 (s1 int);
-select s1 from t1;
-delimiter |;
-create procedure bug9367()
-begin
- declare v int;
- declare c cursor for select s1 from t1;
- open c;
- show warnings;
- fetch c into v;
- select v;
-end|
-delimiter ;|
-call bug9367();
-drop procedure bug9367;
-drop table t1;
---enable_parsing
-
-#
-# BUG#13510: Setting password local variable changes current password
-#
-delimiter |;
---disable_warnings
-drop procedure if exists bug13510_1|
-drop procedure if exists bug13510_2|
-drop procedure if exists bug13510_3|
-drop procedure if exists bug13510_4|
---enable_warnings
-
---error ER_SP_BAD_VAR_SHADOW
-create procedure bug13510_1()
-begin
- declare password varchar(10);
-
- set password = 'foo1';
- select password;
-end|
-
-# Check that an error message is sent
---error ER_PARSE_ERROR
-set names='foo2'|
-
---error ER_SP_BAD_VAR_SHADOW
-create procedure bug13510_2()
-begin
- declare names varchar(10);
-
- set names = 'foo2';
- select names;
-end|
-
-create procedure bug13510_3()
-begin
- declare password varchar(10);
-
- set `password` = 'foo3';
- select password;
-end|
-
-create procedure bug13510_4()
-begin
- declare names varchar(10);
-
- set `names` = 'foo4';
- select names;
-end|
-
-call bug13510_3()|
-call bug13510_4()|
-
-drop procedure bug13510_3|
-drop procedure bug13510_4|
-
-
-#
-# Test that statements which implicitly commit transaction are prohibited
-# in stored function and triggers. Attempt to create function or trigger
-# containing such statement should produce error (includes test for
-# bug #13627).
-#
---disable_warnings
-drop function if exists bug_13627_f|
---enable_warnings
-
-CREATE TABLE t1 (a int)|
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN DROP TRIGGER test1; END |
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE FUNCTION bug_13627_f() returns int BEGIN DROP TRIGGER test1; return 1; END |
-
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create table t2 (a int); END |
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE FUNCTION bug_13627_f() returns int BEGIN create table t2 (a int); return 1; END |
-
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create index t1_i on t1 (a); END |
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE FUNCTION bug_13627_f() returns int BEGIN create index t1_i on t1 (a); return 1; END |
-
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN alter table t1 add column b int; END |
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE FUNCTION bug_13627_f() returns int BEGIN alter table t1 add column b int; return 1; END |
-
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN rename table t1 to t2; END |
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE FUNCTION bug_13627_f() returns int BEGIN rename table t1 to t2; return 1; END |
-
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN truncate table t1; END |
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE FUNCTION bug_13627_f() returns int BEGIN truncate table t1; return 1; END |
-
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop table t1; END |
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE FUNCTION bug_13627_f() returns int BEGIN drop table t1; return 1; END |
-
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop index t1_i on t1; END |
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE FUNCTION bug_13627_f() returns int BEGIN drop index t1_i on t1; return 1; END |
-
--- error ER_SP_BADSTATEMENT
-CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN unlock tables; END |
--- error ER_SP_BADSTATEMENT
-CREATE FUNCTION bug_13627_f() returns int BEGIN unlock tables; return 1; END |
-
--- error ER_SP_BADSTATEMENT
-CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN LOCK TABLE t1 READ; END |
--- error ER_SP_BADSTATEMENT
-CREATE FUNCTION bug_13627_f() returns int BEGIN LOCK TABLE t1 READ; return 1; END |
-
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create database mysqltest; END |
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE FUNCTION bug_13627_f() returns int BEGIN create database mysqltest; return 1; END |
-
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop database mysqltest; END |
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE FUNCTION bug_13627_f() returns int BEGIN drop database mysqltest; return 1; END |
-
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create user 'mysqltest_1'; END |
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE FUNCTION bug_13627_f() returns int BEGIN create user 'mysqltest_1'; return 1; END |
-
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE TRIGGER bug21975 BEFORE INSERT ON t1 FOR EACH ROW BEGIN grant select on t1 to 'mysqltest_1'; END |
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE FUNCTION bug21975() returns int BEGIN grant select on t1 to 'mysqltest_1'; return 1; END |
-
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE TRIGGER bug21975 BEFORE INSERT ON t1 FOR EACH ROW BEGIN revoke select on t1 from 'mysqltest_1'; END |
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE FUNCTION bug21975() returns int BEGIN revoke select on t1 from 'mysqltest_1'; return 1; END |
-
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE TRIGGER bug21975 BEFORE INSERT ON t1 FOR EACH ROW BEGIN revoke all privileges on *.* from 'mysqltest_1'; END |
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE FUNCTION bug21975() returns int BEGIN revoke all privileges on *.* from 'mysqltest_1'; return 1; END |
-
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop user 'mysqltest_1'; END |
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE FUNCTION bug_13627_f() returns int BEGIN drop user 'mysqltest_1'; return 1; END |
-
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN rename user 'mysqltest_2' to 'mysqltest_1'; END |
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE FUNCTION bug_13627_f() returns int BEGIN rename user 'mysqltest_2' to 'mysqltest_1'; return 1; END |
-
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create view v1 as select 1; END |
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE FUNCTION bug_13627_f() returns int BEGIN create view v1 as select 1; return 1; END |
-
--- error ER_SP_BADSTATEMENT
-CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN alter view v1 as select 1; END |
--- error ER_SP_BADSTATEMENT
-CREATE FUNCTION bug_13627_f() returns int BEGIN alter view v1 as select 1; return 1; END |
-
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop view v1; END |
--- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE FUNCTION bug_13627_f() returns int BEGIN drop view v1; return 1; END |
-
--- error ER_SP_NO_RECURSIVE_CREATE
-CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create trigger tr2 before insert on t1 for each row do select 1; END |
--- error ER_SP_NO_RECURSIVE_CREATE
-CREATE FUNCTION bug_13627_f() returns int BEGIN create trigger tr2 before insert on t1 for each row do select 1; return 1; END |
-
--- error ER_SP_NO_DROP_SP
-CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop function bug_13627_f; END |
--- error ER_SP_NO_DROP_SP
-CREATE FUNCTION bug_13627_f() returns int BEGIN drop function bug_13627_f; return 1; END |
-
--- error ER_SP_NO_RECURSIVE_CREATE
-CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create function f2 () returns int return 1; END |
--- error ER_SP_NO_RECURSIVE_CREATE
-CREATE FUNCTION bug_13627_f() returns int BEGIN create function f2 () returns int return 1; return 1; END |
-
-CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW
- BEGIN
- CREATE TEMPORARY TABLE t2 (a int);
- DROP TEMPORARY TABLE t2;
- END |
-CREATE FUNCTION bug_13627_f() returns int
- BEGIN
- CREATE TEMPORARY TABLE t2 (a int);
- DROP TEMPORARY TABLE t2;
- return 1;
- END |
-
-drop table t1|
-drop function bug_13627_f|
-
-delimiter ;|
-
-# BUG#12329: "Bogus error msg when executing PS with stored procedure after
-# SP was re-created". See also test for related bug#13399 in trigger.test
-drop function if exists bug12329;
---enable_warnings
-create table t1 as select 1 a;
-create table t2 as select 1 a;
-create function bug12329() returns int return (select a from t1);
-prepare stmt1 from 'select bug12329()';
-execute stmt1;
-drop function bug12329;
-create function bug12329() returns int return (select a+100 from t2);
-select bug12329();
-execute stmt1;
-deallocate prepare stmt1;
-drop function bug12329;
-drop table t1, t2;
-
-#
-# Bug#13514 "server crash when create a stored procedure before choose a
-# database" and
-# Bug#13587 "Server crash when SP is created without database
-# selected"
-#
-create database mysqltest1;
-use mysqltest1;
-drop database mysqltest1;
---error ER_NO_DB_ERROR
-create function f1() returns int return 1;
-delimiter |;
---error ER_NO_DB_ERROR
-create procedure p1(out param1 int)
-begin
- select count(*) into param1 from t3;
-end|
-delimiter ;|
-use test;
-
-
-#
-# BUG#13037: undefined variable in IF cause erroneous error-message
-#
-
---disable_warnings
-DROP PROCEDURE IF EXISTS bug13037_p1;
-DROP PROCEDURE IF EXISTS bug13037_p2;
-DROP PROCEDURE IF EXISTS bug13037_p3;
---enable_warnings
-
-delimiter |;
-
-CREATE PROCEDURE bug13037_p1()
-BEGIN
- IF bug13037_foo THEN
- SELECT 1;
- END IF;
-END|
-
-CREATE PROCEDURE bug13037_p2()
-BEGIN
- SET @bug13037_foo = bug13037_bar;
-END|
-
-CREATE PROCEDURE bug13037_p3()
-BEGIN
- SELECT bug13037_foo;
-END|
-
-delimiter ;|
-
---echo
-
---error 1054
-CALL bug13037_p1();
---error 1054
-CALL bug13037_p2();
---error 1054
-CALL bug13037_p3();
-
---error 1054
-CALL bug13037_p1();
---error 1054
-CALL bug13037_p2();
---error 1054
-CALL bug13037_p3();
-
-DROP PROCEDURE bug13037_p1;
-DROP PROCEDURE bug13037_p2;
-DROP PROCEDURE bug13037_p3;
-
-#
-# Bug#14569 "editing a stored procedure kills mysqld-nt"
-#
-create database mysqltest1;
-create database mysqltest2;
-use mysqltest1;
-drop database mysqltest1;
-create procedure mysqltest2.p1() select version();
---error ER_NO_DB_ERROR
-create procedure p2() select version();
-use mysqltest2;
---replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
-show procedure status;
-drop database mysqltest2;
-use test;
-
-#
-# Bug#13012 "SP: REPAIR/BACKUP/RESTORE TABLE crashes the server"
-#
-delimiter |;
---disable_warnings
-DROP FUNCTION IF EXISTS bug13012|
---enable_warnings
---error ER_SP_NO_RETSET
-CREATE FUNCTION bug13012() RETURNS INT
-BEGIN
- REPAIR TABLE t1;
- RETURN 1;
-END|
-create table t1 (a int)|
-CREATE PROCEDURE bug13012_1() REPAIR TABLE t1|
-CREATE FUNCTION bug13012_2() RETURNS INT
-BEGIN
- CALL bug13012_1();
- RETURN 1;
-END|
---error ER_SP_NO_RETSET
-SELECT bug13012_2()|
-drop table t1|
-drop procedure bug13012_1|
-drop function bug13012_2|
-delimiter ;|
-
-#
-# BUG#11555 "Stored procedures: current SP tables locking make
-# impossible view security". We should not expose names of tables
-# which are implicitly used by view (via stored routines/triggers).
-#
-# Note that SQL standard assumes that you simply won't be able drop table
-# and leave some objects (routines/views/triggers) which were depending on
-# it. Such objects should be dropped in advance (by default) or will be
-# dropped simultaneously with table (DROP TABLE with CASCADE clause).
-# So these tests probably should go away once we will implement standard
-# behavior.
---disable_warnings
-drop function if exists bug11555_1;
-drop function if exists bug11555_2;
-drop view if exists v1, v2, v3, v4;
---enable_warnings
-create function bug11555_1() returns int return (select max(i) from t1);
-create function bug11555_2() returns int return bug11555_1();
-# It is OK to report name of implicitly used table which is missing
-# when we create view.
-# For stored functions however, because of exceptions handlers, there is
-# no easy way to find out if a missing table makes the view invalid.
-create view v1 as select bug11555_1();
-drop view v1;
-create view v2 as select bug11555_2();
-drop view v2;
-# But we should hide name of missing implicitly used table when we use view
-create table t1 (i int);
-create view v1 as select bug11555_1();
-create view v2 as select bug11555_2();
-create view v3 as select * from v1;
-drop table t1;
---error ER_VIEW_INVALID
-select * from v1;
---error ER_VIEW_INVALID
-select * from v2;
---error ER_VIEW_INVALID
-select * from v3;
-# Note that creation of view which depends on broken view is yet
-# another form of view usage.
-create view v4 as select * from v1;
-drop view v1, v2, v3, v4;
-# We also should hide details about broken triggers which are
-# invoked for view.
-drop function bug11555_1;
-drop function bug11555_2;
-create table t1 (i int);
-create table t2 (i int);
-create trigger t1_ai after insert on t1 for each row insert into t2 values (new.i);
-create view v1 as select * from t1;
-drop table t2;
-# Limitation, the desired error is ER_VIEW_INVALID
---error ER_NO_SUCH_TABLE
-insert into v1 values (1);
-drop trigger t1_ai;
-create function bug11555_1() returns int return (select max(i) from t2);
-create trigger t1_ai after insert on t1 for each row set @a:=bug11555_1();
-# Limitation, the desired error is ER_VIEW_INVALID
---error ER_NO_SUCH_TABLE
-insert into v1 values (2);
-drop function bug11555_1;
-drop table t1;
-drop view v1;
-
-#
-# BUG#15658: Server crashes after creating function as empty string
-#
---disable_warnings
-drop procedure if exists ` bug15658`;
---enable_warnings
-
---error ER_SP_WRONG_NAME
-create procedure ``() select 1;
---error ER_SP_WRONG_NAME
-create procedure ` `() select 1;
---error ER_SP_WRONG_NAME
-create procedure `bug15658 `() select 1;
---error ER_WRONG_DB_NAME
-create procedure ``.bug15658() select 1;
---error ER_WRONG_DB_NAME
-create procedure `x `.bug15658() select 1;
-
-# This should work
-create procedure ` bug15658`() select 1;
-call ` bug15658`();
---replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
-show procedure status;
-drop procedure ` bug15658`;
-
-
-#
-# BUG#14270: Stored procedures: crash if load index
-#
---disable_warnings
-drop function if exists bug14270;
-drop table if exists t1;
---enable_warnings
-
-create table t1 (s1 int primary key);
-
-delimiter |;
---error ER_SP_NO_RETSET
-create function bug14270() returns int
-begin
- load index into cache t1;
- return 1;
-end|
-
---error ER_SP_NO_RETSET
-create function bug14270() returns int
-begin
- cache index t1 key (`primary`) in keycache1;
- return 1;
-end|
-delimiter ;|
-
-drop table t1;
-
-
-#
-# BUG#15091: Sp Returns Unknown error in order clause....and
-# there is no order by clause
-#
---disable_warnings
-drop procedure if exists bug15091;
---enable_warnings
-
-delimiter |;
-create procedure bug15091()
-begin
- declare selectstr varchar(6000) default ' ';
- declare conditionstr varchar(5000) default '';
-
- set selectstr = concat(selectstr,
- ' and ',
- c.operatorid,
- 'in (',conditionstr, ')');
-end|
-delimiter ;|
-
-# The error message used to be:
-# ERROR 1109 (42S02): Unknown table 'c' in order clause
-# but is now rephrased to something less misleading:
-# ERROR 1109 (42S02): Unknown table 'c' in field list
---error ER_UNKNOWN_TABLE
-call bug15091();
-
-drop procedure bug15091;
-
-
-#
-# BUG#16896: Stored function: unused AGGREGATE-clause in CREATE FUNCTION
-#
---disable_warnings
-drop function if exists bug16896;
---enable_warnings
-
---error ER_INVALID_AGGREGATE_FUNCTION
-create aggregate function bug16896() returns int return 1;
-
-#
-#
-# BUG#14702: misleading error message when syntax error in CREATE
-# PROCEDURE
-#
-# Misleading error message was given when IF NOT EXISTS was used in
-# CREATE PROCEDURE.
-#
---disable_warnings
-DROP PROCEDURE IF EXISTS bug14702;
---enable_warnings
-
---error ER_PARSE_ERROR
-CREATE IF NOT EXISTS PROCEDURE bug14702()
-BEGIN
-END;
-
-CREATE PROCEDURE IF NOT EXISTS bug14702()
-BEGIN
-END;
-DROP PROCEDURE IF EXISTS bug14702;
-
-#
-# BUG#20953: create proc with a create view that uses local
-# vars/params should fail to create
-#
-# See test case for what syntax is forbidden in a view.
-#
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (i INT);
-
-# We do not have to drop this procedure and view because they won't be
-# created.
---error ER_PARSE_ERROR
-CREATE PROCEDURE bug20953() CREATE VIEW v AS SELECT 1 INTO @a;
---error ER_PARSE_ERROR
-CREATE PROCEDURE bug20953() CREATE VIEW v AS SELECT 1 INTO DUMPFILE "file";
---error ER_PARSE_ERROR
-CREATE PROCEDURE bug20953() CREATE VIEW v AS SELECT 1 INTO OUTFILE "file";
---error ER_PARSE_ERROR
-CREATE PROCEDURE bug20953()
- CREATE VIEW v AS SELECT i FROM t1 PROCEDURE ANALYSE();
---error ER_PARSE_ERROR
-CREATE PROCEDURE bug20953() CREATE VIEW v AS SELECT 1 FROM (SELECT 1) AS d1 into @w;
---error ER_VIEW_SELECT_VARIABLE
-CREATE PROCEDURE bug20953(i INT) CREATE VIEW v AS SELECT i;
-delimiter |;
---error ER_VIEW_SELECT_VARIABLE
-CREATE PROCEDURE bug20953()
-BEGIN
- DECLARE i INT;
- CREATE VIEW v AS SELECT i;
-END |
-delimiter ;|
---error ER_VIEW_SELECT_VARIABLE
-PREPARE stmt FROM "CREATE VIEW v AS SELECT ?";
-
-DROP TABLE t1;
-
-
-#
-# BUG#24491 "using alias from source table in insert ... on duplicate key"
-#
---disable_warnings
-drop tables if exists t1;
-drop procedure if exists bug24491;
---enable_warnings
-create table t1 (id int primary key auto_increment, value varchar(10));
-insert into t1 (id, value) values (1, 'FIRST'), (2, 'SECOND'), (3, 'THIRD');
-# Let us create routine with INSERT ... SELECT ... ON DUPLICATE KEY UPDATE
-# statement which in its ON DUPLICATE KEY clause erroneously tries to assign
-# value to a column which is mentioned only in SELECT part.
-create procedure bug24491()
- insert into t1 (id, value) select * from (select 4 as i, 'FOURTH' as v) as y on duplicate key update v = 'DUP';
-# Both first and second calls to it should fail
---error ER_BAD_FIELD_ERROR
-call bug24491();
---error ER_BAD_FIELD_ERROR
-call bug24491();
-drop procedure bug24491;
-# And now the same test for more complex case which is more close
-# to the one that was reported originally.
-create procedure bug24491()
- insert into t1 (id, value) select * from (select 4 as id, 'FOURTH' as value) as y on duplicate key update y.value = 'DUP';
---error ER_BAD_FIELD_ERROR
-call bug24491();
---error ER_BAD_FIELD_ERROR
-call bug24491();
-drop procedure bug24491;
-drop tables t1;
-
-#
-# BUG#18914: Calling certain SPs from triggers fail
-#
-# Failing to call a procedure that does implicit commit from a trigger
-# is a correct behaviour, however the error message was misleading.
-#
-# DROP TABLE IF EXISTS is also fixed to give correct error instead of
-# "Table doesn't exist".
-#
---disable_warnings
-DROP FUNCTION IF EXISTS bug18914_f1;
-DROP FUNCTION IF EXISTS bug18914_f2;
-DROP PROCEDURE IF EXISTS bug18914_p1;
-DROP PROCEDURE IF EXISTS bug18914_p2;
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-CREATE TABLE t1 (i INT);
-
-CREATE PROCEDURE bug18914_p1() CREATE TABLE t2 (i INT);
-CREATE PROCEDURE bug18914_p2() DROP TABLE IF EXISTS no_such_table;
-
-delimiter |;
-CREATE FUNCTION bug18914_f1() RETURNS INT
-BEGIN
- CALL bug18914_p1();
- RETURN 1;
-END |
-
-CREATE FUNCTION bug18914_f2() RETURNS INT
-BEGIN
- CALL bug18914_p2();
- RETURN 1;
-END |
-delimiter ;|
-
-CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
- CALL bug18914_p1();
-
---error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-INSERT INTO t1 VALUES (1);
-
---error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-SELECT bug18914_f1();
-
---error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-SELECT bug18914_f2();
-
---error ER_NO_SUCH_TABLE
-SELECT * FROM t2;
-
-DROP FUNCTION bug18914_f1;
-DROP FUNCTION bug18914_f2;
-DROP PROCEDURE bug18914_p1;
-DROP PROCEDURE bug18914_p2;
-DROP TABLE t1;
-
-#
-# Bug#20713 (Functions will not not continue for SQLSTATE VALUE '42S02')
-#
-
---disable_warnings
-drop table if exists bogus_table_20713;
-drop function if exists func_20713_a;
-drop function if exists func_20713_b;
---enable_warnings
-
-create table bogus_table_20713( id int(10) not null primary key);
-insert into bogus_table_20713 values (1), (2), (3);
-
-delimiter //;
-
-create function func_20713_a() returns int(11)
-begin
- declare id int;
-
- declare continue handler for sqlexception set id=null;
-
- set @in_func := 1;
- set id = (select id from bogus_table_20713 where id = 3);
- set @in_func := 2;
-
- return id;
-end//
-
-create function func_20713_b() returns int(11)
-begin
- declare id int;
-
- declare continue handler for sqlstate value '42S02' set id=null;
-
- set @in_func := 1;
- set id = (select id from bogus_table_20713 where id = 3);
- set @in_func := 2;
-
- return id;
-end//
-
-delimiter ;//
-
-set @in_func := 0;
-select func_20713_a();
-select @in_func;
-
-set @in_func := 0;
-select func_20713_b();
-select @in_func;
-
-drop table bogus_table_20713;
-
-set @in_func := 0;
-select func_20713_a();
-select @in_func;
-
-set @in_func := 0;
-select func_20713_b();
-select @in_func;
-
-drop function if exists func_20713_a;
-drop function if exists func_20713_b;
-
-#
-# Bug#25345 (Cursors from Functions)
-#
-
---disable_warnings
-drop table if exists table_25345_a;
-drop table if exists table_25345_b;
-drop procedure if exists proc_25345;
-drop function if exists func_25345;
-drop function if exists func_25345_b;
---enable_warnings
-
-create table table_25345_a (a int);
-create table table_25345_b (b int);
-
-delimiter ||;
-
-create procedure proc_25345()
-begin
- declare c1 cursor for select a from table_25345_a;
- declare c2 cursor for select b from table_25345_b;
-
- select 1 as result;
-end ||
-
-create function func_25345() returns int(11)
-begin
- call proc_25345();
- return 1;
-end ||
-
-create function func_25345_b() returns int(11)
-begin
- declare c1 cursor for select a from table_25345_a;
- declare c2 cursor for select b from table_25345_b;
-
- return 1;
-end ||
-
-delimiter ;||
-
-call proc_25345();
---error ER_SP_NO_RETSET
-select func_25345();
-select func_25345_b();
-
-drop table table_25345_a;
-
-call proc_25345();
---error ER_SP_NO_RETSET
-select func_25345();
-select func_25345_b();
-
-drop table table_25345_b;
-drop procedure proc_25345;
-drop function func_25345;
-drop function func_25345_b;
-
-#
-# End of 5.0 tests
-#
---echo End of 5.0 tests
-
-#
-# Bug#16164 "Easter egg": check that SHOW AUTHORS is disabled in
-# stored functions/triggers
-#
---disable_warnings
-drop function if exists bug16164;
---enable_warnings
-delimiter |;
---error ER_SP_NO_RETSET
-create function bug16164() returns int
-begin
- show authors;
- return 42;
-end|
-delimiter ;|
-
-
-#
-# BUG#20701: BINARY keyword should be forbidden in stored routines
-#
---disable_warnings
-drop function if exists bug20701;
---enable_warnings
-create function bug20701() returns varchar(25) binary return "test";
-drop function bug20701;
-create function bug20701() returns varchar(25) return "test";
-drop function bug20701;
-
-#
-# Bug#26503 (Illegal SQL exception handler code causes the server to crash)
-#
-
-delimiter //;
-
---error ER_SP_LILABEL_MISMATCH
-create procedure proc_26503_error_1()
-begin
-retry:
- repeat
- begin
- declare continue handler for sqlexception
- begin
- iterate retry;
- end
-
- select "do something";
- end
- until true end repeat retry;
-end//
-
---error ER_SP_LILABEL_MISMATCH
-create procedure proc_26503_error_2()
-begin
-retry:
- repeat
- begin
- declare continue handler for sqlexception
- iterate retry;
-
- select "do something";
- end
- until true end repeat retry;
-end//
-
---error ER_SP_LILABEL_MISMATCH
-create procedure proc_26503_error_3()
-begin
-retry:
- repeat
- begin
- declare continue handler for sqlexception
- begin
- leave retry;
- end
-
- select "do something";
- end
- until true end repeat retry;
-end//
-
---error ER_SP_LILABEL_MISMATCH
-create procedure proc_26503_error_4()
-begin
-retry:
- repeat
- begin
- declare continue handler for sqlexception
- leave retry;
-
- select "do something";
- end
- until true end repeat retry;
-end//
-
-delimiter ;//
-
-
-#
-# Bug#28360 (RENAME DATABASE destroys routines)
-#
-
---disable_warnings
-drop procedure if exists proc_28360;
-drop function if exists func_28360;
---enable_warnings
-
-delimiter //;
-
---error ER_SP_NO_DROP_SP
-CREATE PROCEDURE proc_28360()
-BEGIN
- ALTER DATABASE `#mysql50#upgrade-me` UPGRADE DATA DIRECTORY NAME;
-END//
-
---error ER_SP_NO_DROP_SP
-CREATE FUNCTION func_28360() RETURNS int
-BEGIN
- ALTER DATABASE `#mysql50#upgrade-me` UPGRADE DATA DIRECTORY NAME;
- RETURN 0;
-END//
-
-delimiter ;//
-
-
-#
-# Bug#29223 declare cursor c for SHOW .....
-#
-
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
---enable_warnings
---delimiter |
---error ER_PARSE_ERROR
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE c char(100);
- DECLARE cur1 CURSOR FOR SHOW TABLES;
-
- OPEN cur1;
- FETCH cur1 INTO c;
- select c;
- CLOSE cur1;
-END|
---delimiter ;
-
-#
-# Bug#29816 Syntactically wrong query fails with misleading error message
-#
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest;
---enable_warnings
-CREATE DATABASE mysqltest;
-USE mysqltest;
-DROP DATABASE mysqltest;
-# Both ER_SP_DOES_NOT_EXIST and ER_PARSE_ERROR are valid here,
-# the result is implementation dependent:
-# See Bug#29816 for details
---error ER_SP_DOES_NOT_EXIST
-SELECT inexistent(), 1 + ,;
---error ER_SP_DOES_NOT_EXIST
-SELECT inexistent();
---error ER_PARSE_ERROR
-SELECT .inexistent();
---error ER_PARSE_ERROR
-SELECT ..inexistent();
-USE test;
-
-#
-# Bug#30904 SET PASSWORD statement is non-transactional
-#
-
-delimiter |;
-
---error ER_SP_CANT_SET_AUTOCOMMIT
-create function f1() returns int
-begin
- set @test = 1, password = password('foo');
- return 1;
-end|
-
---error ER_SP_CANT_SET_AUTOCOMMIT
-create trigger t1
- before insert on t2 for each row set password = password('foo');|
-
-delimiter ;|
-
-#
-# Bug#30882 Dropping a temporary table inside a stored function may cause a server crash
-#
-
---disable_warnings
-drop function if exists f1;
-drop function if exists f2;
-drop table if exists t1, t2;
---enable_warnings
-
-delimiter |;
-create function f1() returns int
-begin
- drop temporary table t1;
- return 1;
-end|
-delimiter ;|
---error ER_BAD_TABLE_ERROR
-create temporary table t1 as select f1();
-
-delimiter |;
-create function f2() returns int
-begin
- create temporary table t2 as select f1();
- return 1;
-end|
-delimiter ;|
---error ER_BAD_TABLE_ERROR
-create temporary table t1 as select f2();
-
-drop function f1;
-drop function f2;
-
-delimiter |;
-create function f1() returns int
-begin
- drop temporary table t2,t1;
- return 1;
-end|
-create function f2() returns int
-begin
- create temporary table t2 as select f1();
- return 1;
-end|
-delimiter ;|
---error ER_BAD_TABLE_ERROR
-create temporary table t1 as select f2();
-
-drop function f1;
-drop function f2;
-
-create temporary table t2(a int);
-select * from t2;
-delimiter |;
-create function f2() returns int
-begin
- drop temporary table t2;
- return 1;
-end|
-delimiter ;|
-select f2();
-
-drop function f2;
---error ER_BAD_TABLE_ERROR
-drop table t2;
-
---echo End of 5.1 tests
-
-#
-# Bug#33983 (Stored Procedures: wrong end <label> syntax is accepted)
-#
-
---disable_warnings
-drop procedure if exists proc_33983_a;
-drop procedure if exists proc_33983_b;
-drop procedure if exists proc_33983_c;
-drop procedure if exists proc_33983_d;
---enable_warnings
-
-delimiter |;
-
---error ER_SP_LABEL_MISMATCH
-create procedure proc_33983_a()
-begin
- label1:
- begin
- label2:
- begin
- select 1;
- end label1;
- end;
-end|
-
---error ER_SP_LABEL_MISMATCH
-create procedure proc_33983_b()
-begin
- label1:
- repeat
- label2:
- repeat
- select 1;
- until FALSE end repeat label1;
- until FALSE end repeat;
-end|
-
---error ER_SP_LABEL_MISMATCH
-create procedure proc_33983_c()
-begin
- label1:
- while TRUE do
- label2:
- while TRUE do
- select 1;
- end while label1;
- end while;
-end|
-
---error ER_SP_LABEL_MISMATCH
-create procedure proc_33983_d()
-begin
- label1:
- loop
- label2:
- loop
- select 1;
- end loop label1;
- end loop;
-end|
-
-CREATE TABLE t1 (a INT)|
-INSERT INTO t1 VALUES (1),(2)|
-CREATE PROCEDURE p1(a INT) BEGIN END|
---error ER_SUBQUERY_NO_1_ROW
-CALL p1((SELECT * FROM t1))|
-DROP PROCEDURE IF EXISTS p1|
-DROP TABLE t1|
-
-delimiter ;|
-
-#
-# Bug#21801: SQL exception handlers and warnings
-#
-
---disable_warnings
-drop procedure if exists p1;
---enable_warnings
-delimiter |;
-create procedure p1()
-begin
- create table t1 (a int) engine=MyISAM;
- drop table t1;
-end|
-delimiter ;|
-call p1();
-call p1();
-drop procedure p1;
-
-#
-# Bug#8759 (Stored Procedures: SQLSTATE '00000' should be illegal)
-#
-
---disable_warnings
-drop procedure if exists proc_8759;
---enable_warnings
-
-delimiter $$;
-
---error ER_SP_BAD_SQLSTATE
-create procedure proc_8759()
-begin
- declare should_be_illegal condition for sqlstate '00000';
- declare continue handler for should_be_illegal set @x=0;
-end$$
-
---error ER_SP_BAD_SQLSTATE
-create procedure proc_8759()
-begin
- declare continue handler for sqlstate '00000' set @x=0;
-end$$
-
-delimiter ;$$
-
-#
-# Bug#36510 (Stored Procedures: mysql_error_code 0 should be illegal)
-#
-
---disable_warnings
-drop procedure if exists proc_36510;
---enable_warnings
-
-delimiter $$;
-
---error ER_SP_BAD_SQLSTATE
-create procedure proc_36510()
-begin
- declare should_be_illegal condition for sqlstate '00123';
- declare continue handler for should_be_illegal set @x=0;
-end$$
-
---error ER_SP_BAD_SQLSTATE
-create procedure proc_36510()
-begin
- declare continue handler for sqlstate '00123' set @x=0;
-end$$
-
---error ER_WRONG_VALUE
-create procedure proc_36510()
-begin
- declare should_be_illegal condition for 0;
- declare continue handler for should_be_illegal set @x=0;
-end$$
-
---error ER_WRONG_VALUE
-create procedure proc_36510()
-begin
- declare continue handler for 0 set @x=0;
-end$$
-delimiter ;$$
-
-#
-# Bug#15192: "fatal errors" are caught by handlers in stored procedures
-#
-
---disable_warnings
-drop procedure if exists p1;
---enable_warnings
-set @old_recursion_depth = @@max_sp_recursion_depth;
-set @@max_sp_recursion_depth = 255;
-delimiter |;
-create procedure p1(a int)
-begin
- declare continue handler for 1436 -- ER_STACK_OVERRUN_NEED_MORE
- select 'exception';
- call p1(a+1);
-end|
-delimiter ;|
---error 0,ER_STACK_OVERRUN_NEED_MORE,ER_SP_RECURSION_LIMIT
-call p1(1);
-set @@max_sp_recursion_depth = @old_recursion_depth;
-drop procedure p1;
-
-#
-# BUG#NNNN: New bug synopsis
-#
-#--disable_warnings
-#drop procedure if exists bugNNNN;
-#drop function if exists bugNNNN;
-#--enable_warnings
-#create procedure bugNNNN...
-#create function bugNNNN...
-
-#
-# CLEANUP and RESTORE
-#
-LOAD DATA INFILE '../../tmp/proc.txt' INTO TABLE mysql.proc;
-remove_file $MYSQLTEST_VARDIR/tmp/proc.txt;
-
-#
-# Bug #38159: Function parsing problem generates misleading error message
-#
-
-CREATE TABLE t1 (a INT, b INT);
-INSERT INTO t1 VALUES (1,1), (2,2);
---error ER_FUNC_INEXISTENT_NAME_COLLISION
-SELECT MAX (a) FROM t1 WHERE b = 999999;
-SELECT AVG (a) FROM t1 WHERE b = 999999;
---error ER_SP_DOES_NOT_EXIST
-SELECT non_existent (a) FROM t1 WHERE b = 999999;
-DROP TABLE t1;
-
-
-#
-# Bug #46374 crash, INSERT INTO t1 uses function, function modifies t1
-#
-CREATE TABLE t1 ( f2 INTEGER, f3 INTEGER );
-INSERT INTO t1 VALUES ( 1, 1 );
-
-delimiter |;
-
-CREATE FUNCTION func_1 () RETURNS INTEGER
-BEGIN
- INSERT INTO t1 SELECT * FROM t1 ;
- RETURN 1 ;
-END|
-
-delimiter ;|
-
-# The bug caused the following INSERT statement to trigger
-# an assertion. Error 1442 is the correct response
-#
---error 1442
-INSERT INTO t1 SELECT * FROM (SELECT 2 AS f1, 2 AS f2) AS A WHERE func_1() = 5;
-
-# Cleanup
-DROP FUNCTION func_1;
-DROP TABLE t1;
-
-
-
---echo #
---echo # Bug #47788: Crash in TABLE_LIST::hide_view_error on UPDATE + VIEW +
---echo # SP + MERGE + ALTER
---echo #
-
-CREATE TABLE t1 (pk INT, b INT, KEY (b));
-CREATE ALGORITHM = TEMPTABLE VIEW v1 AS SELECT * FROM t1;
-
-CREATE PROCEDURE p1 (a int) UPDATE IGNORE v1 SET b = a;
-
---error ER_NON_UPDATABLE_TABLE
-CALL p1(5);
-
-ALTER TABLE t1 CHANGE COLUMN b b2 INT;
-
---error ER_VIEW_INVALID
-CALL p1(7);
-
-DROP PROCEDURE p1;
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#12428824 - PARSER STACK OVERFLOW AND CRASH IN SP_ADD_USED_ROUTINE
---echo # WITH OBSCURE QUERY
---echo #
-
---error ER_TOO_LONG_IDENT
-SELECT very_long_fn_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222225555555555555555555555555577777777777777777777777777777777777777777777777777777777777777777777777788888888999999999999999999999();
-
---error ER_TOO_LONG_IDENT
-CALL very_long_pr_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222225555555555555555555555555577777777777777777777777777777777777777777777777777777777777777777777777788888888999999999999999999999();
-
---error ER_WRONG_DB_NAME
-SELECT very_long_db_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222225555555555555555555555555577777777777777777777777777777777777777777777777777777777777777777777777788888888999999999999999999999.simple_func();
-
---error ER_WRONG_DB_NAME
-CALL very_long_db_name_1111111111111111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222225555555555555555555555555577777777777777777777777777777777777777777777777777777777777777777777777788888888999999999999999999999.simple_proc();
-
---error ER_TOO_LONG_IDENT
-SELECT db_name.very_long_fn_name_111111111111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999999999999999999();
-
---error ER_TOO_LONG_IDENT
-CALL db_name.very_long_pr_name_111111111111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999999999999999999();
---echo End of 5.1 tests
-
---echo #
---echo # Bug#23032: Handlers declared in a SP do not handle warnings generated in sub-SP
---echo #
-
---echo
---echo # - Case 1
---echo
-
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
-DROP PROCEDURE IF EXISTS p2;
-DROP PROCEDURE IF EXISTS p3;
-DROP PROCEDURE IF EXISTS p4;
-DROP PROCEDURE IF EXISTS p5;
-DROP PROCEDURE IF EXISTS p6;
---enable_warnings
-
-delimiter |;
-
-CREATE PROCEDURE p1()
- BEGIN
- SELECT CAST('10 ' as unsigned integer);
- SELECT 1;
- CALL p2();
- END|
-
-CREATE PROCEDURE p2()
- BEGIN
- SELECT CAST('10 ' as unsigned integer);
- END|
-
-delimiter ;|
-
-CALL p1();
-
-DROP PROCEDURE p1;
-DROP PROCEDURE p2;
-
---echo
---echo # - Case 2
---echo
-
-delimiter |;
-
-CREATE PROCEDURE p1()
- BEGIN
- DECLARE c INT DEFAULT 0;
- DECLARE CONTINUE HANDLER FOR SQLSTATE '22007' SET c = c + 1;
- CALL p2();
- CALL p3();
- CALL p4();
- SELECT c;
- SELECT @@warning_count;
- SHOW WARNINGS;
- END|
-
-CREATE PROCEDURE p2()
- BEGIN
- SELECT CAST('10 ' as unsigned integer);
- END|
-
-CREATE PROCEDURE p3()
- BEGIN
- SELECT CAST('10 ' as unsigned integer);
- SELECT 1;
- END|
-
-CREATE PROCEDURE p4()
- BEGIN
- SELECT CAST('10 ' as unsigned integer);
- CALL p2();
- END|
-
-CREATE PROCEDURE p5()
- BEGIN
- SELECT CAST('10 ' as unsigned integer);
- SHOW WARNINGS;
- END|
-
-CREATE PROCEDURE P6()
- BEGIN
- DECLARE c INT DEFAULT 0;
- DECLARE CONTINUE HANDLER FOR SQLSTATE '22007' SET c = c + 1;
- CALL p5();
- SELECT c;
- END|
-
-delimiter ;|
-
-CALL p1();
-CALL p6();
-
-DROP PROCEDURE p1;
-DROP PROCEDURE p2;
-DROP PROCEDURE p3;
-DROP PROCEDURE p4;
-DROP PROCEDURE p5;
-DROP PROCEDURE p6;
-
---echo
---echo # - Case 3: check that "Exception trumps No Data".
---echo
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1(a INT);
-INSERT INTO t1 VALUES (1), (2), (3);
-
-delimiter |;
-
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE c CURSOR FOR SELECT a FROM t1;
-
- OPEN c;
-
- BEGIN
- DECLARE v1 INT;
- DECLARE v2 INT;
-
- DECLARE EXIT HANDLER FOR SQLEXCEPTION
- SELECT "Error caught (expected)";
-
- DECLARE EXIT HANDLER FOR NOT FOUND
- SELECT "End of Result Set found!";
-
- WHILE TRUE DO
- FETCH c INTO v1, v2;
- END WHILE;
- END;
-
- CLOSE c;
-
- SELECT a INTO @foo FROM t1 LIMIT 1; # Clear warning stack
-END|
-
-delimiter ;|
-
-CALL p1();
-
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#36185: Incorrect precedence for warning and exception handlers
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP PROCEDURE IF EXISTS p1;
---enable_warnings
-
-CREATE TABLE t1 (a INT, b INT NOT NULL);
-
-delimiter |;
-
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE CONTINUE HANDLER FOR SQLWARNING SELECT 'warning';
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SELECT 'exception';
- INSERT INTO t1 VALUES (CAST('10 ' AS SIGNED), NULL);
-END|
-
-delimiter ;|
-
-CALL p1();
-
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
---echo #
---echo # Bug#5889: Exit handler for a warning doesn't hide the warning in trigger
---echo #
-SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
-CREATE TABLE t1(a INT, b INT);
-INSERT INTO t1 VALUES (1, 2);
-
-delimiter |;
-
-CREATE TRIGGER t1_bu BEFORE UPDATE ON t1 FOR EACH ROW
-BEGIN
- DECLARE EXIT HANDLER FOR SQLWARNING
- SET NEW.a = 10;
-
- SET NEW.a = 99999999999;
-END|
-
-delimiter ;|
-
-UPDATE t1 SET b = 20;
-
-SHOW WARNINGS;
-
-SELECT * FROM t1;
-
-DROP TRIGGER t1_bu;
-DROP TABLE t1;
-SET sql_mode = DEFAULT;
-
---echo #
---echo # Bug#9857: Stored procedures: handler for sqlwarning ignored
---echo #
-
-SET @sql_mode_saved = @@sql_mode;
-SET sql_mode = traditional;
-
-delimiter |;
-
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- SELECT 'warning caught (expected)';
-
- SELECT 5 / 0;
-END|
-
-CREATE PROCEDURE p2()
-BEGIN
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
- SELECT 'error caught (unexpected)';
-
- SELECT 5 / 0;
-END|
-
-delimiter ;|
-
-CALL p1();
-SHOW WARNINGS;
-
-CALL p2();
-SHOW WARNINGS;
-
-DROP PROCEDURE p1;
-DROP PROCEDURE p2;
-SET sql_mode = @sql_mode_saved;
-
---echo #
---echo # Bug#55850: Trigger warnings not cleared.
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS t2;
-DROP PROCEDURE IF EXISTS p1;
---enable_warnings
-
-CREATE TABLE t1(x SMALLINT, y SMALLINT, z SMALLINT);
-CREATE TABLE t2(a SMALLINT, b SMALLINT, c SMALLINT,
- d SMALLINT, e SMALLINT, f SMALLINT);
-
-CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
- INSERT IGNORE INTO t2(a, b, c) VALUES(99999, 99999, 99999);
-
-CREATE TRIGGER t1_ai AFTER INSERT ON t1 FOR EACH ROW
- INSERT IGNORE INTO t2(d, e, f) VALUES(99999, 99999, 99999);
-
-CREATE PROCEDURE p1()
- INSERT IGNORE INTO t1 VALUES(99999, 99999, 99999);
-
-# What happened before the patch was:
-# - INSERT INTO t1 added 3 warnings about overflow in 'x', 'y' and 'z' columns;
-# - t1_bi run and added 3 warnings about overflow in 'a', 'b' and 'c' columns;
-# - t1_ai run and added 3 warnings about overflow in 'd', 'e' and 'f' columns;
-# => we had 9 warnings.
-#
-# Now what happens is:
-# - INSERT INTO t1 adds 3 warnings about overflow in 'x', 'y' and 'z' columns;
-# - t1_bi adds 3 warnings about overflow in 'a', 'b' and 'c' columns;
-# - The warnings added by triggers are cleared;
-# - t1_ai run and added 3 warnings about overflow in 'd', 'e' and 'f' columns;
-# - The warnings added by triggers are cleared;
-# => we have 3 warnings.
-
---echo
-CALL p1();
-
---echo
-SHOW WARNINGS;
-
---echo
-DROP TABLE t1;
-DROP TABLE t2;
-DROP PROCEDURE p1;
-
---echo # ----------------------------------------------------------------------
-SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
-CREATE TABLE t1(x SMALLINT, y SMALLINT, z SMALLINT);
-CREATE TABLE t2(a SMALLINT, b SMALLINT, c SMALLINT NOT NULL);
-
-delimiter |;
-
-CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
-BEGIN
- INSERT INTO t2 VALUES(
- CAST('111111 ' AS SIGNED),
- CAST('222222 ' AS SIGNED),
- NULL);
-END|
-
-delimiter ;|
-
-CREATE PROCEDURE p1()
- INSERT INTO t1 VALUES(99999, 99999, 99999);
-
---echo
---error ER_BAD_NULL_ERROR
-CALL p1();
-
---echo
-SHOW WARNINGS;
-
---echo
-DROP TABLE t1;
-DROP TABLE t2;
-DROP PROCEDURE p1;
-SET sql_mode = DEFAULT;
-
---echo
---echo ###################################################################
---echo # Tests for the following bugs:
---echo # - Bug#11763171: 55852 - Possibly inappropriate handler activation.
---echo # - Bug#11749343: 38806 - Wrong scope for SQL HANDLERS in SP.
---echo ###################################################################
---echo
-
-#
-# Structure of SQL-block:
-# BEGIN
-# <Handler declaration block>
-# <Statement block>
-# END
-#
-# Scope of Handler-decl-block is Statement-block.
-# I.e. SQL-conditions thrown in the Handler-decl-block can not be handled by
-# the same block, only by outer SQL-blocks.
-#
-# This rule is recursive, i.e. if a Handler-decl-block has nested SQL-blocks,
-# the SQL-conditions from those nested blocks can not be handled by the this
-# Handler-decl-block, only by outer SQL-blocks.
-#
-
-delimiter |;
-
---echo
---echo # -- Check that SQL-conditions thrown by Statement-blocks are
---echo # -- handled by Handler-decl blocks properly.
---echo
-
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
- SELECT 'H1' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- SELECT 'H2' AS HandlerId;
-
- SIGNAL SQLSTATE '01000'; # Should be handled by H2.
-END|
-
---echo
-CALL p1()|
-
---echo
---echo # -- Check that SQL-conditions thrown by Statement-blocks are
---echo # -- handled by Handler-decl blocks properly in case of nested
---echo # -- SQL-blocks.
---echo
-
-CREATE PROCEDURE p2()
-BEGIN
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
- SELECT 'H1' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- SELECT 'H2' AS HandlerId;
-
- BEGIN
-
- SELECT 'B1' AS BlockId;
- BEGIN
-
- SELECT 'B2' AS BlockId;
- BEGIN
- SELECT 'B3' AS BlockId;
- SIGNAL SQLSTATE '01000'; # Should be handled by H2.
- END;
-
- END;
-
- END;
-
-END|
-
---echo
-CALL p2()|
-
---echo
---echo # -- Check SQL-handler resolution rules.
---echo
-
-CREATE PROCEDURE p3()
-BEGIN
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
- SELECT 'H1' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- SELECT 'H2' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLSTATE '01000'
- SELECT 'H3' AS HandlerId;
-
- SIGNAL SQLSTATE '01000'; # Should be handled by H3.
-END|
-
---echo
-CALL p3()|
---echo
-
-CREATE PROCEDURE p4()
-BEGIN
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
- SELECT 'H1' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLSTATE '01000'
- SELECT 'H2' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- SELECT 'H3' AS HandlerId;
-
- SIGNAL SQLSTATE '01000'; # Should be handled by H2.
-END|
-
---echo
-CALL p4()|
---echo
-
-CREATE PROCEDURE p5()
-BEGIN
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
- SELECT 'H1' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLSTATE '01000'
- SELECT 'H2' AS HandlerId;
-
- BEGIN
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- SELECT 'H3' AS HandlerId;
-
- SIGNAL SQLSTATE '01000'; # Should be handled by H3.
- END;
-END|
-
---echo
-CALL p5()|
-
---echo
---echo # -- Check that handlers don't handle its own exceptions.
---echo
-
-CREATE PROCEDURE p6()
-BEGIN
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
- BEGIN
- SELECT 'H1' AS HandlerId;
- SIGNAL SQLSTATE 'HY000'; # Should *not* be handled by H1.
- END;
-
- SELECT 'S1' AS SignalId;
- SIGNAL SQLSTATE 'HY000'; # Should be handled by H1.
-END|
-
---echo
---error ER_SIGNAL_EXCEPTION
-CALL p6()|
-
---echo
---echo # -- Check that handlers don't handle its own warnings.
---echo
-
-CREATE PROCEDURE p7()
-BEGIN
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- BEGIN
- SELECT 'H1' AS HandlerId;
- SIGNAL SQLSTATE '01000'; # Should *not* be handled by H1.
- END;
-
- SELECT 'S1' AS SignalId;
- SIGNAL SQLSTATE '01000'; # Should be handled by H1.
-END|
-
---echo
-CALL p7()|
-
---echo
---echo # -- Check that conditions for handlers are not handled by the handlers
---echo # -- from the same block.
---echo
-
-CREATE PROCEDURE p8()
-BEGIN
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- SELECT 'H1' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
- BEGIN
- SELECT 'H2' AS HandlerId;
- SIGNAL SQLSTATE '01000'; # Should *not* be handled by H1.
- END;
-
- SELECT 'S1' AS SignalId;
- SIGNAL SQLSTATE 'HY000'; # Should be handled by H2.
-END|
-
---echo
-CALL p8()|
-
---echo
---echo # -- Check that conditions for handlers are not handled by the handlers
---echo # -- from the same block even if they are thrown deep down the stack.
---echo
-
-CREATE PROCEDURE p9()
-BEGIN
-
- DECLARE CONTINUE HANDLER FOR SQLSTATE '01000'
- SELECT 'Wrong:H1:1' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- SELECT 'Wrong:H1:2' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
- BEGIN
-
- DECLARE CONTINUE HANDLER FOR SQLSTATE '01000'
- SELECT 'Wrong:H2:1' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- SELECT 'Wrong:H2:2' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
- BEGIN
-
- DECLARE CONTINUE HANDLER FOR SQLSTATE '01000'
- SELECT 'Wrong:H3:1' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- SELECT 'Wrong:H3:2' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
- BEGIN
-
- DECLARE CONTINUE HANDLER FOR SQLSTATE '01000'
- SELECT 'Wrong:H4:1' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- SELECT 'Wrong:H4:2' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
- BEGIN
-
- DECLARE CONTINUE HANDLER FOR SQLSTATE '01000'
- SELECT 'Wrong:H5:1' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- SELECT 'Wrong:H5:2' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
- BEGIN
-
- DECLARE CONTINUE HANDLER FOR SQLSTATE '01000'
- SELECT 'Wrong:H6:1' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- SELECT 'Wrong:H6:2' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
- BEGIN
- SELECT 'H2' AS HandlerId;
- SIGNAL SQLSTATE '01000'; # Should *not* be handled by H1.
- END;
-
- SELECT 'S6' AS SignalId;
- SIGNAL SQLSTATE 'HY000';
- END;
-
- SELECT 'S5' AS SignalId;
- SIGNAL SQLSTATE 'HY000';
-
- END;
-
- SELECT 'S4' AS SignalId;
- SIGNAL SQLSTATE 'HY000';
-
- END;
-
- SELECT 'S3' AS SignalId;
- SIGNAL SQLSTATE 'HY000';
-
- END;
-
- SELECT 'S2' AS SignalId;
- SIGNAL SQLSTATE 'HY000';
-
- END;
-
- SELECT 'S1' AS SignalId;
- SIGNAL SQLSTATE 'HY000'; # Should be handled by H2.
-
-END|
-
---echo
-CALL p9()|
-
---echo
---echo # -- Check that handlers are choosen properly in case of deep stack and
---echo # -- nested SQL-blocks.
---echo
-
-CREATE PROCEDURE p10()
-BEGIN
- DECLARE CONTINUE HANDLER FOR SQLSTATE '01000'
- SELECT 'H1' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- SELECT 'H2' AS HandlerId;
-
- BEGIN
- BEGIN
- BEGIN
-
- DECLARE CONTINUE HANDLER FOR SQLSTATE '01000'
- SELECT 'Wrong:H1:1' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- SELECT 'Wrong:H1:2' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
- BEGIN
-
- DECLARE CONTINUE HANDLER FOR SQLSTATE '01000'
- SELECT 'Wrong:H2:1' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- SELECT 'Wrong:H2:2' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
- BEGIN
-
- DECLARE CONTINUE HANDLER FOR SQLSTATE '01000'
- SELECT 'Wrong:H3:1' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- SELECT 'Wrong:H3:2' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
- BEGIN
-
- DECLARE CONTINUE HANDLER FOR SQLSTATE '01000'
- SELECT 'Wrong:H4:1' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- SELECT 'Wrong:H4:2' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
- BEGIN
-
- DECLARE CONTINUE HANDLER FOR SQLSTATE '01000'
- SELECT 'Wrong:H5:1' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- SELECT 'Wrong:H5:2' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
- BEGIN
-
- DECLARE CONTINUE HANDLER FOR SQLSTATE '01000'
- SELECT 'Wrong:H6:1' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- SELECT 'Wrong:H6:2' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
- BEGIN
- SELECT 'H2' AS HandlerId;
- SIGNAL SQLSTATE '01000'; # Should be handled by H1.
- END;
-
- SELECT 'S6' AS SignalId;
- SIGNAL SQLSTATE 'HY000';
- END;
-
- SELECT 'S5' AS SignalId;
- SIGNAL SQLSTATE 'HY000';
-
- END;
-
- SELECT 'S4' AS SignalId;
- SIGNAL SQLSTATE 'HY000';
-
- END;
-
- SELECT 'S3' AS SignalId;
- SIGNAL SQLSTATE 'HY000';
-
- END;
-
- SELECT 'S2' AS SignalId;
- SIGNAL SQLSTATE 'HY000';
-
- END;
-
- SELECT 'S1' AS SignalId;
- SIGNAL SQLSTATE 'HY000'; # Should be handled by H2.
-
- END;
- END;
- END;
-END|
-
---echo
-CALL p10()|
-
---echo
---echo # -- Test stored procedure from Peter's mail.
---echo
-
-CREATE PROCEDURE p11()
-BEGIN
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
- SELECT 'H1' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- SELECT 'H2' AS HandlerId;
-
- BEGIN
- DECLARE CONTINUE HANDLER FOR SQLSTATE '01000', 1249
- BEGIN
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
- SELECT 'H3' AS HandlerId;
-
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- SELECT 'H4' AS HandlerId;
-
- BEGIN
- SELECT 'H5' AS HandlerId;
-
- SELECT 'S3' AS SignalId;
- SIGNAL SQLSTATE 'HY000'; # H3
-
- SELECT 'S4' AS SignalId;
- SIGNAL SQLSTATE '22003'; # H3
-
- SELECT 'S5' AS SignalId;
- SIGNAL SQLSTATE '01000' SET MYSQL_ERRNO = 1249; # H4
- END;
- END;
-
- SELECT 'S6' AS SignalId;
- SIGNAL SQLSTATE 'HY000'; # H1
-
- SELECT 'S7' AS SignalId;
- SIGNAL SQLSTATE '22003'; # H1
-
- SELECT 'S8' AS SignalId;
- SIGNAL SQLSTATE '01000' SET MYSQL_ERRNO = 1249; # H5
- END;
-
- SELECT 'S1' AS SignalId;
- SIGNAL SQLSTATE 'HY000'; # H1
-
- SELECT 'S2' AS SignalId;
- SIGNAL SQLSTATE '01000' SET MYSQL_ERRNO = 1249; # H2
-END|
-
---echo
-CALL p11()|
-
---echo
---echo # -- Check that runtime stack-trace can be deeper than parsing-time one.
---echo
-
-CREATE PROCEDURE p12()
-BEGIN
- DECLARE CONTINUE HANDLER FOR SQLSTATE '01001'
- BEGIN
- DECLARE CONTINUE HANDLER FOR SQLSTATE '01001'
- BEGIN
- DECLARE CONTINUE HANDLER FOR SQLSTATE '01001'
- BEGIN
- DECLARE CONTINUE HANDLER FOR SQLSTATE '01001'
- BEGIN
- DECLARE CONTINUE HANDLER FOR SQLSTATE '01001'
- BEGIN
- SELECT 'H1:5' AS HandlerId;
- SIGNAL SQLSTATE '01002';
- END;
- SELECT 'H1:4' AS HandlerId;
- SIGNAL SQLSTATE '01001';
- END;
- SELECT 'H1:3' AS HandlerId;
- SIGNAL SQLSTATE '01001';
- END;
- SELECT 'H1:2' AS HandlerId;
- SIGNAL SQLSTATE '01001';
- END;
- SELECT 'H1:1' AS HandlerId;
- SIGNAL SQLSTATE '01001';
- END;
-
- #########################################################
-
- DECLARE CONTINUE HANDLER FOR SQLSTATE '01002'
- SELECT 'OK' AS Msg;
-
- #########################################################
-
- BEGIN
-
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- BEGIN
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- BEGIN
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- BEGIN
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- BEGIN
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- BEGIN
- SELECT 'H2:5' AS HandlerId;
- SIGNAL SQLSTATE '01001';
- END;
- SELECT 'H2:4' AS HandlerId;
- SIGNAL SQLSTATE '01000';
- END;
- SELECT 'H2:3' AS HandlerId;
- SIGNAL SQLSTATE '01000';
- END;
- SELECT 'H2:2' AS HandlerId;
- SIGNAL SQLSTATE '01000';
- END;
- SELECT 'H2:1' AS HandlerId;
- SIGNAL SQLSTATE '01000';
- END;
-
- #######################################################
-
- SELECT 'Throw 01000' AS Msg;
- SIGNAL SQLSTATE '01000';
- END;
-
-END|
-
---echo
-CALL p12()|
-
---echo
---echo # -- Check that handler-call-frames are removed properly for EXIT
---echo # -- handlers.
---echo
-
-CREATE PROCEDURE p13()
-BEGIN
-
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- BEGIN
- DECLARE CONTINUE HANDLER FOR SQLWARNING
- BEGIN
- DECLARE EXIT HANDLER FOR SQLWARNING
- BEGIN
- SELECT 'EXIT handler 3' AS Msg;
- END;
-
- SELECT 'CONTINUE handler 2: 1' AS Msg;
- SIGNAL SQLSTATE '01000';
- SELECT 'CONTINUE handler 2: 2' AS Msg;
- END;
-
- SELECT 'CONTINUE handler 1: 1' AS Msg;
- SIGNAL SQLSTATE '01000';
- SELECT 'CONTINUE handler 1: 2' AS Msg;
- END;
-
- SELECT 'Throw 01000' AS Msg;
- SIGNAL SQLSTATE '01000';
-END|
-
---echo
-CALL p13()|
-
-delimiter ;|
-
---echo
---echo # That's it. Cleanup.
---echo
-
-DROP PROCEDURE p1;
-DROP PROCEDURE p2;
-DROP PROCEDURE p3;
-DROP PROCEDURE p4;
-DROP PROCEDURE p5;
-DROP PROCEDURE p6;
-DROP PROCEDURE p7;
-DROP PROCEDURE p8;
-DROP PROCEDURE p9;
-DROP PROCEDURE p10;
-DROP PROCEDURE p11;
-DROP PROCEDURE p12;
-DROP PROCEDURE p13;
-
---echo
---echo # Bug#12731619: NESTED SP HANDLERS CAN TRIGGER ASSERTION
---echo
-
---disable_warnings
-DROP FUNCTION IF EXISTS f1;
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1(msg VARCHAR(255));
-
-delimiter |;
-CREATE FUNCTION f1() RETURNS INT
-BEGIN
-
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION # handler 1
- BEGIN
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION # handler 2
- BEGIN
- INSERT INTO t1 VALUE('WRONG: Inside H2');
- RETURN 2;
- END;
-
- INSERT INTO t1 VALUE('CORRECT: Inside H1');
- RETURN 1;
- END;
-
- BEGIN
- DECLARE CONTINUE HANDLER FOR SQLWARNING # handler 3
- BEGIN
- INSERT INTO t1 VALUE('WRONG: Inside H3');
- RETURN 3;
- END;
-
- INSERT INTO t1 VALUE('CORRECT: Calling f1()');
- RETURN f1(); # -- exception here
- END;
-
- INSERT INTO t1 VALUE('WRONG: Returning 10');
- RETURN 10;
-
-END|
-
-delimiter ;|
-
---echo
-SELECT f1();
---echo
-SELECT * FROM t1;
---echo
-
-DROP FUNCTION f1;
-DROP TABLE t1;
-
-
---echo
---echo # Check that handled SQL-conditions are properly cleared from DA.
---echo
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS t2;
-DROP PROCEDURE IF EXISTS p1;
-DROP PROCEDURE IF EXISTS p2;
-DROP PROCEDURE IF EXISTS p3;
-DROP PROCEDURE IF EXISTS p4;
-DROP PROCEDURE IF EXISTS p5;
---enable_warnings
-
-CREATE TABLE t1(a CHAR, b CHAR, c CHAR);
-CREATE TABLE t2(a SMALLINT, b SMALLINT, c SMALLINT);
-
-delimiter |;
-
---echo
---echo # Check that SQL-conditions for which SQL-handler has been invoked,
---echo # are cleared from the Diagnostics Area. Note, there might be several
---echo # SQL-conditions, but SQL-handler must be invoked only once.
---echo
-
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE EXIT HANDLER FOR SQLWARNING
- SELECT 'Warning caught' AS msg;
-
- # The INSERT below raises 3 SQL-conditions (warnings). The EXIT HANDLER
- # above must be invoked once (for one condition), but all three conditions
- # must be cleared from the Diagnostics Area.
-
- INSERT IGNORE INTO t1 VALUES('qqqq', 'ww', 'eee');
-
- # The following INSERT will not be executed, because of the EXIT HANDLER.
-
- INSERT INTO t1 VALUES('zzz', 'xx', 'yyyy');
-END|
-
---echo
-CALL p1()|
---echo
-SELECT * FROM t1|
-
---echo
---echo # Check that SQL-conditions for which SQL-handler has *not* been
---echo # invoked, are *still* cleared from the Diagnostics Area.
---echo
-
-CREATE PROCEDURE p2()
-BEGIN
- DECLARE CONTINUE HANDLER FOR 1292
- SELECT 'Warning 1292 caught' AS msg;
-
- # The following INSERT raises 6 SQL-warnings with code 1292,
- # and 3 SQL-warnings with code 1264. The CONTINUE HANDLER above must be
- # invoked once, and all nine SQL-warnings must be cleared from
- # the Diagnostics Area.
-
- INSERT IGNORE INTO t2
- SELECT
- CAST(CONCAT(CAST('1 ' AS UNSIGNED INTEGER), '999999 ') AS SIGNED INTEGER),
- CAST(CONCAT(CAST('2 ' AS UNSIGNED INTEGER), '999999 ') AS SIGNED INTEGER),
- CAST(CONCAT(CAST('3 ' AS UNSIGNED INTEGER), '999999 ') AS SIGNED INTEGER);
-END|
-
---echo
-CALL p2()|
-
---echo
---echo # Check that if there are two equally ranked SQL-handlers to handle
---echo # SQL-conditions from SQL-statement, only one of them will be invoked.
---echo
-
-CREATE PROCEDURE p3()
-BEGIN
- DECLARE CONTINUE HANDLER FOR 1292
- SELECT 'Warning 1292 caught' AS msg;
-
- DECLARE CONTINUE HANDLER FOR 1264
- SELECT 'Warning 1264 caught' AS msg;
-
- # The following INSERT raises 6 SQL-warnings with code 1292,
- # and 3 SQL-warnings with code 1264. Only one of the CONTINUE HANDLERs above
- # must be called, and only once. The SQL Standard does not define, which one
- # should be invoked.
-
- INSERT INTO t2
- SELECT
- CAST(CONCAT(CAST('1 ' AS UNSIGNED INTEGER), '999999 ') AS SIGNED INTEGER),
- CAST(CONCAT(CAST('2 ' AS UNSIGNED INTEGER), '999999 ') AS SIGNED INTEGER),
- CAST(CONCAT(CAST('3 ' AS UNSIGNED INTEGER), '999999 ') AS SIGNED INTEGER);
-END|
-
---echo
-CALL p3()|
-
---echo
---echo # The same as p3, but 1264 comes first.
---echo
-
-CREATE PROCEDURE p4()
-BEGIN
- DECLARE CONTINUE HANDLER FOR 1292
- SELECT 'Warning 1292 caught' AS msg;
-
- DECLARE CONTINUE HANDLER FOR 1264
- SELECT 'Warning 1264 caught' AS msg;
-
- # The following INSERT raises 4 SQL-warnings with code 1292,
- # and 3 SQL-warnings with code 1264. Only one of the CONTINUE HANDLERs above
- # must be called, and only once. The SQL Standard does not define, which one
- # should be invoked.
-
- INSERT INTO t2
- SELECT
- CAST(999999 AS SIGNED INTEGER),
- CAST(CONCAT(CAST('2 ' AS UNSIGNED INTEGER), '999999 ') AS SIGNED INTEGER),
- CAST(CONCAT(CAST('3 ' AS UNSIGNED INTEGER), '999999 ') AS SIGNED INTEGER);
-END|
-
---echo
-CALL p4()|
-
---echo
---echo # Check that if a SQL-handler raised its own SQL-conditions, there are
---echo # preserved after handler exit.
---echo
-
-CREATE PROCEDURE p5()
-BEGIN
- DECLARE EXIT HANDLER FOR 1292
- BEGIN
- SELECT 'Handler for 1292 (1)' AS Msg;
- SIGNAL SQLSTATE '01000' SET MYSQL_ERRNO = 1234;
- SHOW WARNINGS;
- SELECT 'Handler for 1292 (2)' AS Msg;
- END;
-
- INSERT IGNORE INTO t2
- SELECT
- CAST(999999 AS SIGNED INTEGER),
- CAST(CONCAT(CAST('2 ' AS UNSIGNED INTEGER), '999999 ') AS SIGNED INTEGER),
- CAST(CONCAT(CAST('3 ' AS UNSIGNED INTEGER), '999999 ') AS SIGNED INTEGER);
-END|
-
---echo
-CALL p5()|
-
---echo
---echo # Check that SQL-conditions are available inside the handler, but
---echo # cleared after the handler exits.
---echo
-
-CREATE PROCEDURE p6()
-BEGIN
- DECLARE CONTINUE HANDLER FOR 1292
- BEGIN
- SHOW WARNINGS;
- SELECT 'Handler for 1292' Msg;
- END;
-
- INSERT IGNORE INTO t2
- SELECT
- CAST(CONCAT(CAST('1 ' AS UNSIGNED INTEGER), '999999 ') AS SIGNED INTEGER),
- CAST(CONCAT(CAST('2 ' AS UNSIGNED INTEGER), '999999 ') AS SIGNED INTEGER),
- CAST(CONCAT(CAST('3 ' AS UNSIGNED INTEGER), '999999 ') AS SIGNED INTEGER);
-END|
-
---echo
-CALL p6()|
-
-delimiter ;|
-
---echo
-DROP PROCEDURE p1;
-DROP PROCEDURE p2;
-DROP PROCEDURE p3;
-DROP PROCEDURE p4;
-DROP PROCEDURE p5;
-DROP PROCEDURE p6;
-DROP TABLE t1;
-DROP TABLE t2;
-
---echo
---echo # Bug#13059316: ASSERTION FAILURE IN SP_RCONTEXT.CC
---echo # Check DECLARE statements that raise conditions before handlers
---echo # are declared.
---echo
-
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
-DROP PROCEDURE IF EXISTS p2;
---enable_warnings
-
-delimiter |;
-
-SET sql_mode = '';
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE var1 INTEGER DEFAULT 'string';
- DECLARE EXIT HANDLER FOR SQLWARNING SELECT 'H1';
-END|
-
---echo
-CALL p1()|
---echo
-SET sql_mode = DEFAULT;
-
-CREATE PROCEDURE p2()
-BEGIN
- DECLARE EXIT HANDLER FOR SQLWARNING SELECT 'H2';
- CALL p1();
-END|
-
---echo
-CALL p2()|
-
-delimiter ;|
-
---echo
-DROP PROCEDURE p1;
-DROP PROCEDURE p2;
-
-
---echo #
---echo # Bug#13113222 RQG_SIGNAL_RESIGNAL FAILED WITH ASSERTION.
---echo #
-
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
-DROP PROCEDURE IF EXISTS p2;
---enable_warnings
-
-delimiter |;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SELECT 'triggered p1';
- # This will trigger an error.
- SIGNAL SQLSTATE 'HY000';
-END|
-
-CREATE PROCEDURE p2()
-BEGIN
- DECLARE CONTINUE HANDLER FOR SQLWARNING SELECT 'triggered p2';
- # This will trigger a warning.
- SIGNAL SQLSTATE '01000';
-END|
-delimiter ;|
-
-SET @old_max_error_count= @@session.max_error_count;
-SET SESSION max_error_count= 0;
-CALL p1();
-CALL p2();
-SET SESSION max_error_count= @old_max_error_count;
-
-DROP PROCEDURE p1;
-DROP PROCEDURE p2;
-
---echo
---echo # Bug#12652873: 61392: Continue handler for NOT FOUND being triggered
---echo # from internal stored function.
---echo
-
---disable_warnings
-DROP FUNCTION IF EXISTS f1;
-DROP FUNCTION IF EXISTS f2;
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
---echo
-
-CREATE TABLE t1 (a INT, b INT);
-INSERT INTO t1 VALUES (1, 2);
-
-delimiter |;
-
---echo
---echo # f1() raises NOT_FOUND condition.
---echo # Raising NOT_FOUND can not be simulated by SIGNAL,
---echo # because SIGNAL would raise SQL-error in that case.
---echo
-
-CREATE FUNCTION f1() RETURNS INTEGER
-BEGIN
- DECLARE v VARCHAR(5) DEFAULT -1;
- SELECT b FROM t1 WHERE a = 2 INTO v;
- RETURN v;
-END|
-
---echo
---echo # Here we check that the NOT_FOUND condition raised in f1()
---echo # is not visible in the outer function (f2), i.e. the continue
---echo # handler in f2() will not be called.
---echo
-
-CREATE FUNCTION f2() RETURNS INTEGER
-BEGIN
- DECLARE v INTEGER;
-
- DECLARE CONTINUE HANDLER FOR NOT FOUND
- SET @msg = 'Handler activated.';
-
- SELECT f1() INTO v;
-
- RETURN v;
-END|
-
-delimiter ;|
-
-SET @msg = '';
-
---echo
-SELECT f2();
---echo
-SELECT @msg;
---echo
-
-DROP FUNCTION f1;
-DROP FUNCTION f2;
-DROP TABLE t1;
diff --git a/mysql-test/t/sp-fib.test b/mysql-test/t/sp-fib.test
deleted file mode 100644
index 24a51b99c2d..00000000000
--- a/mysql-test/t/sp-fib.test
+++ /dev/null
@@ -1,54 +0,0 @@
-# Fibonacci, for recursion test. (Yet Another Numerical series :)
-# Split from main.sp due to problems reported in Bug#15866
-
---disable_warnings
-drop table if exists t3;
---enable_warnings
-create table t3 ( f bigint unsigned not null );
-
-# We deliberately do it the awkward way, fetching the last two
-# values from the table, in order to exercise various statements
-# and table accesses at each turn.
---disable_warnings
-drop procedure if exists fib;
---enable_warnings
-
-# Now for multiple statements...
-delimiter |;
-
-create procedure fib(n int unsigned)
-begin
- if n > 1 then
- begin
- declare x, y bigint unsigned;
- declare c cursor for select f from t3 order by f desc limit 2;
- open c;
- fetch c into y;
- fetch c into x;
- insert into t3 values (x+y);
- call fib(n-1);
- ## Close the cursor AFTER the recursion to ensure that the stack
- ## frame is somewhat intact.
- close c;
- end;
- end if;
-end|
-
-# Enable recursion
-set @@max_sp_recursion_depth= 20|
-
-insert into t3 values (0), (1)|
-
-# The small number of recursion levels is intentional.
-# We need to avoid
-# Bug#15866 main.sp fails (thread stack limit
-# insufficient for recursive call "fib(20)")
-# which affects some platforms.
-call fib(4)|
-
-select * from t3 order by f asc|
-
-drop table t3|
-drop procedure fib|
-set @@max_sp_recursion_depth= 0|
-
diff --git a/mysql-test/t/sp-for-loop.test b/mysql-test/t/sp-for-loop.test
deleted file mode 100644
index 6350e9fb9d3..00000000000
--- a/mysql-test/t/sp-for-loop.test
+++ /dev/null
@@ -1,212 +0,0 @@
---echo #
---echo # MDEV-14415 Add Oracle-style FOR loop to sql_mode=DEFAULT
---echo #
-
-
-CREATE TABLE t1 (a INT);
-DELIMITER /;
-FOR i IN 1..3
-DO
- INSERT INTO t1 VALUES (i);
-END FOR;
-/
-DELIMITER ;/
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
-# Dots must have no delimiters in between
-
-DELIMITER /;
---error ER_PARSE_ERROR
-CREATE FUNCTION f1 (lower_bound INT, upper_bound INT, lim INT) RETURNS INT
-BEGIN
- DECLARE total INT DEFAULT 0;
- FOR i IN lower_bound . . upper_bound
- DO
- NULL
- END FOR;
- RETURN total;
-END;
-/
-DELIMITER ;/
-
-
-DELIMITER /;
-CREATE FUNCTION f1 (lower_bound INT, upper_bound INT, lim INT) RETURNS INT
-BEGIN
- DECLARE total INT DEFAULT 0;
- lab:
- FOR i IN lower_bound .. upper_bound
- DO
- SET total= total + i;
- IF i = lim THEN
- LEAVE lab;
- END IF;
- -- Bounds are calculated only once.
- -- The below assignments have no effect on the loop condition
- SET lower_bound= 900;
- SET upper_bound= 1000;
- END FOR;
- RETURN total;
-END;
-/
-DELIMITER ;/
-SELECT f1(1, 3, 100) FROM DUAL;
-SELECT f1(1, 3, 2) FROM DUAL;
-DROP FUNCTION f1;
-
-
-DELIMITER /;
-CREATE FUNCTION f1() RETURNS INT
-BEGIN
- DECLARE total INT DEFAULT 0;
- FOR i IN 1 .. 5
- DO
- SET total= total + 1000;
- forj:
- FOR j IN 1 .. 5
- DO
- SET total= total + 1;
- IF j = 3 THEN
- LEAVE forj; -- End the internal loop
- END IF;
- END FOR;
- END FOR;
- RETURN total;
-END;
-/
-DELIMITER ;/
-SELECT f1() FROM DUAL;
-DROP FUNCTION f1;
-
-
-DELIMITER /;
-CREATE FUNCTION f1 (a INT, b INT) RETURNS INT
-BEGIN
- DECLARE total INT DEFAULT 0;
- fori:
- FOR i IN REVERSE a..1
- DO
- SET total= total + i;
- IF i = b THEN
- LEAVE fori;
- END IF;
- END FOR;
- RETURN total;
-END
-/
-DELIMITER ;/
-SELECT f1(3, 100) FROM DUAL;
-SELECT f1(3, 2) FROM DUAL;
-DROP FUNCTION f1;
-
-
---echo # Testing labeled FOR LOOP statement
-
-DELIMITER /;
-CREATE FUNCTION f1 (a INT, limita INT, b INT, limitb INT) RETURNS INT
-BEGIN
- DECLARE total INT DEFAULT 0;
- la:
- FOR ia IN 1 .. a
- DO
- SET total= total + 1000;
- lb:
- FOR ib IN 1 .. b
- DO
- SET total= total + 1;
- IF ib = limitb THEN
- LEAVE lb;
- END IF;
- IF ia = limita THEN
- LEAVE la;
- END IF;
- END FOR lb;
- END FOR la;
- RETURN total;
-END;
-/
-DELIMITER ;/
-SELECT f1(1, 1, 1, 1) FROM DUAL;
-SELECT f1(1, 2, 1, 2) FROM DUAL;
-SELECT f1(2, 1, 2, 1) FROM DUAL;
-SELECT f1(2, 1, 2, 2) FROM DUAL;
-SELECT f1(2, 2, 2, 2) FROM DUAL;
-SELECT f1(2, 3, 2, 3) FROM DUAL;
-DROP FUNCTION f1;
-
-
---echo # Testing labeled ITERATE in a labeled FOR LOOP statement
-
-DELIMITER /;
-CREATE FUNCTION f1 (a INT, b INT, blim INT) RETURNS INT
-BEGIN
- DECLARE total INT DEFAULT 0;
- la:
- FOR ia IN 1 .. a
- DO
- SET total= total + 1000;
- BEGIN
- DECLARE ib INT DEFAULT 1;
- WHILE ib <= b
- DO
- IF ib > blim THEN
- ITERATE la;
- END IF;
- SET ib= ib + 1;
- SET total= total + 1;
- END WHILE;
- END;
- END FOR la;
- RETURN total;
-END;
-/
-DELIMITER ;/
-SELECT f1(3,3,0), f1(3,3,1), f1(3,3,2), f1(3,3,3), f1(3,3,4) FROM DUAL;
-DROP FUNCTION f1;
-
-
---echo # Testing INTERATE statement
-
-DELIMITER /;
-CREATE FUNCTION f1(a INT) RETURNS INT
-BEGIN
- DECLARE total INT DEFAULT 0;
- fori:
- FOR i IN 1 .. a
- DO
- IF i=5 THEN
- ITERATE fori;
- END IF;
- SET total= total + 1;
- END FOR;
- RETURN total;
-END;
-/
-DELIMITER ;/
-SELECT f1(3), f1(4), f1(5), f1(6) FROM DUAL;
-DROP FUNCTION f1;
-
-
-DELIMITER /;
-CREATE FUNCTION f1(a INT) RETURNS INT
-BEGIN
- DECLARE total INT DEFAULT 0;
- lj:
- FOR j IN 1 .. 2
- DO
- FOR i IN 1 .. a
- DO
- IF i=5 THEN
- ITERATE lj;
- END IF;
- SET total= total + 1;
- END FOR;
- END FOR;
- RETURN total;
-END;
-/
-DELIMITER ;/
-SELECT f1(3), f1(4), f1(5) FROM DUAL;
-DROP FUNCTION f1;
diff --git a/mysql-test/t/sp-group.test b/mysql-test/t/sp-group.test
deleted file mode 100644
index 2083ac97595..00000000000
--- a/mysql-test/t/sp-group.test
+++ /dev/null
@@ -1,187 +0,0 @@
---source include/have_innodb.inc
-
-drop table if exists t1;
-drop view if exists view_t1;
-
-#
-# Test case for MDEV 7601, MDEV-7594 and MDEV-7555
-# Server crashes in functions related to stored procedures
-# Server crashes in different ways while executing concurrent
-# flow involving views and non-empty sql_mode with ONLY_FULL_GROUP_BY
-#
-
-SET sql_mode=ONLY_FULL_GROUP_BY;
-
-CREATE TABLE t1 (
- pk INT,
- f0 INT, f1 INT, f2 INT, f3 INT, f4 INT,
- f5 INT, f6 INT, f7 INT, f8 INT, f9 INT,
- PRIMARY KEY (pk)
-);
-
-CREATE VIEW view_t1 AS SELECT * FROM t1;
-CREATE PROCEDURE s1()
- SELECT * FROM (
- INFORMATION_SCHEMA.`INNODB_BUFFER_PAGE_LRU` AS table1
- LEFT JOIN test.view_t1 AS table2
- ON ( table2.`f6` = table1.FREE_PAGE_CLOCK)
- )
- ORDER BY table1.NUMBER_RECORDS
- LIMIT 0
-;
-CALL s1;
-CALL s1;
-
-drop table t1;
-drop view view_t1;
-drop procedure s1;
-
-#
-# MDEV-7590
-# Server crashes in st_select_lex_unit::cleanup on executing a trigger
-#
-
-CREATE TABLE A (
- pk INTEGER AUTO_INCREMENT,
- col_int_key INTEGER,
- col_varchar_key VARCHAR(1),
- PRIMARY KEY (pk)
-) ENGINE=MyISAM;
-CREATE VIEW view_A AS SELECT * FROM A;
-CREATE TABLE C (
- pk INTEGER AUTO_INCREMENT,
- col_int_nokey INTEGER,
- col_int_key INTEGER,
- col_date_key DATE,
- col_date_nokey DATE,
- col_time_key TIME,
- col_time_nokey TIME,
- col_datetime_key DATETIME,
- col_datetime_nokey DATETIME,
- col_varchar_key VARCHAR(1),
- col_varchar_nokey VARCHAR(1),
- PRIMARY KEY (pk)
-) ENGINE=MyISAM;
-CREATE VIEW view_C AS SELECT * FROM C;
-CREATE TABLE AA (
- pk INTEGER AUTO_INCREMENT,
- col_int_nokey INTEGER,
- col_int_key INTEGER,
- col_date_key DATE,
- col_date_nokey DATE,
- col_time_key TIME,
- col_time_nokey TIME,
- col_datetime_key DATETIME,
- col_datetime_nokey DATETIME,
- col_varchar_key VARCHAR(1),
- col_varchar_nokey VARCHAR(1),
- PRIMARY KEY (pk),
- KEY (col_varchar_key, col_int_key)
-) ENGINE=MyISAM;
-CREATE VIEW view_AA AS SELECT * FROM AA;
-CREATE TABLE BB (
- pk INTEGER AUTO_INCREMENT,
- col_int_key INTEGER,
- col_varchar_key VARCHAR(1),
- col_varchar_nokey VARCHAR(1),
- PRIMARY KEY (pk),
- KEY (col_varchar_key, col_int_key)
-) ENGINE=MyISAM;
-CREATE VIEW view_BB AS SELECT * FROM BB;
-CREATE TABLE DD (
- pk INTEGER AUTO_INCREMENT,
- col_int_key INTEGER,
- col_date_key DATE,
- col_time_key TIME,
- col_datetime_key DATETIME,
- col_varchar_key VARCHAR(1),
- PRIMARY KEY (pk),
- KEY (col_varchar_key, col_int_key)
-) ENGINE=MyISAM;
-CREATE VIEW view_DD AS SELECT * FROM DD;
-CREATE TRIGGER k BEFORE INSERT ON `DD` FOR EACH ROW INSERT INTO `view_BB` SELECT * FROM `view_A` LIMIT 0 ;
-CREATE TRIGGER r BEFORE INSERT ON `A` FOR EACH ROW INSERT INTO `view_AA` SELECT * FROM `view_C` LIMIT 0 ;
---error ER_WRONG_AUTO_KEY
-ALTER TABLE `DD` DROP PRIMARY KEY;
-INSERT INTO `view_A` ( `pk` ) VALUES (NULL);
---error 0,ER_WRONG_VALUE_COUNT_ON_ROW
-INSERT INTO `DD` ( `pk` ) VALUES (NULL);
-INSERT INTO `A` ( `pk` ) VALUES (NULL);
---error 0,ER_WRONG_VALUE_COUNT_ON_ROW
-INSERT INTO `view_DD` ( `pk` ) VALUES (NULL);
-
-drop trigger r;
-drop trigger k;
-drop view view_A,view_AA,view_C,view_BB,view_DD;
-drop table A,C,AA,BB,DD;
-
-#
-# MDEV-7581
-# Server crashes in st_select_lex_unit::cleanup after a sequence of statements
-#
-
-CREATE TABLE A (
- i INT,
- i1 INT,
- i2 INT,
- d1 DATE,
- d2 DATE,
- col_time_nokey1 TIME,
- col_time_nokey2 TIME,
- col_datetime_nokey1 DATETIME,
- col_datetime_nokey2 DATETIME,
- col_varchar_nokey1 VARCHAR(1),
- col_varchar_nokey2 VARCHAR(1)
-) ENGINE=MyISAM;
-
-CREATE VIEW view_A AS SELECT * FROM A;
-
-CREATE TABLE B (
- col_varchar_nokey VARCHAR(1)
-) ENGINE=MyISAM;
-
-CREATE TABLE AA (
- i INT,
- i1 INT,
- i2 INT,
- d1 DATE,
- d2 DATE,
- col_time_nokey1 TIME,
- col_time_nokey2 TIME,
- col_datetime_nokey1 DATETIME,
- col_datetime_nokey2 DATETIME,
- col_varchar_nokey1 VARCHAR(1),
- col_varchar_nokey2 VARCHAR(1)
-) ENGINE=MyISAM;
-
-CREATE VIEW view_AA AS SELECT * FROM AA;
-
-CREATE TABLE DD (
- i INT,
- i1 INT,
- i2 INT,
- d1 DATE,
- d2 DATE,
- col_time_nokey1 TIME,
- col_time_nokey2 TIME,
- col_datetime_nokey1 DATETIME,
- col_datetime_nokey2 DATETIME,
- col_varchar_nokey1 VARCHAR(1),
- col_varchar_nokey2 VARCHAR(1)
-) ENGINE=MyISAM;
-
-CREATE VIEW view_DD AS SELECT * FROM DD;
-
-CREATE TRIGGER tr1 BEFORE INSERT ON `AA` FOR EACH ROW INSERT INTO `view_A` SELECT * FROM `view_AA` LIMIT 0 ;
-CREATE TRIGGER tr2 BEFORE INSERT ON `B` FOR EACH ROW INSERT INTO `D` SELECT * FROM `A` LIMIT 0 ;
-
-INSERT INTO `view_AA` ( `i` ) VALUES (1);
-INSERT INTO `AA` ( `i` ) VALUES (2);
-DELETE FROM `B`;
-INSERT INTO `view_DD` ( `i` ) VALUES (1);
-INSERT INTO `view_AA` ( `i` ) VALUES (3);
-
-drop trigger tr1;
-drop trigger tr2;
-drop view view_A, view_AA,view_DD;
-drop table A,B,AA,DD;
diff --git a/mysql-test/t/sp-innodb.test b/mysql-test/t/sp-innodb.test
deleted file mode 100644
index 23715166a02..00000000000
--- a/mysql-test/t/sp-innodb.test
+++ /dev/null
@@ -1,162 +0,0 @@
-
---source include/have_innodb.inc
-
---disable_warnings
-drop table if exists t1,t2;
-drop procedure if exists p1;
---enable_warnings
-
---echo #
---echo #MDEV-6985: MariaDB crashes on stored procedure call
---echo #
-CREATE TABLE `t1` (
- `ID` int(11) NOT NULL,
- PRIMARY KEY (`ID`)
-) ENGINE=InnoDB;
-
-CREATE TABLE `t2` (
- `ID` int(11) NOT NULL,
- `DATE` datetime DEFAULT NULL,
- PRIMARY KEY (`ID`)
-) ENGINE=InnoDB;
-
---delimiter ;;
-
-CREATE PROCEDURE `p1`()
-BEGIN
- DECLARE _mySelect CURSOR FOR
- SELECT DISTINCT t1.ID
- FROM t1
- LEFT JOIN t2 AS t2 ON
- t2.ID = t1.ID
- AND t2.DATE = (
- SELECT MAX(T3.DATE) FROM t2 AS T3 WHERE T3.ID = t2.ID AND T3.DATE<=NOW()
- )
- WHERE t1.ID = 1;
- OPEN _mySelect;
- CLOSE _mySelect;
-END ;;
---delimiter ;
-
-CALL p1();
-CALL p1();
-
-drop procedure p1;
-drop table t1,t2;
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
---echo
---echo #
---echo # BUG 16041903: CONTINUE HANDLER NOT INVOKED
---echo # IN A STORED FUNCTION AFTER A LOCK WAIT TIMEOUT
---echo #
-
---echo
---echo # Save and set lock wait timeout
-SET @lock_wait_timeout_saved= @@lock_wait_timeout;
-SET @innodb_lock_wait_timeout_saved= @@innodb_lock_wait_timeout;
-SET @@lock_wait_timeout= 1;
-SET @@innodb_lock_wait_timeout= 1;
-
---echo
---echo # Create a function with exit handler:
-DELIMITER //;
-CREATE FUNCTION f1() RETURNS VARCHAR(20)
-BEGIN
- DECLARE EXIT HANDLER FOR SQLSTATE '42S02' RETURN 'No such table';
- INSERT INTO no_such_table VALUES (1);
-END//
-
---echo
---echo # Create a function calling f1():
-CREATE FUNCTION f2() RETURNS VARCHAR(20)
-BEGIN
- RETURN f1();
-END//
-
---echo
---echo # Create a function provoking deadlock:
-CREATE FUNCTION f3() RETURNS VARCHAR(20)
-BEGIN
- UPDATE t1 SET i= 1 WHERE i= 1;
- RETURN 'Will never get here';
-END//
-
---echo
---echo # Create a function calling f3, to create
---echo # a deadlock indirectly:
-CREATE FUNCTION f4() RETURNS VARCHAR(20)
-BEGIN
- RETURN f3();
-END//
-DELIMITER ;//
-
---echo
---echo # Open another connection, create and initialize a table
---echo # to be used for provoking deadlock, put a lock on the table:
-connect (con1,localhost,root,,);
-CREATE TABLE t1 (i INT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1);
-SET AUTOCOMMIT= 0;
-UPDATE t1 SET i=1 WHERE i=1;
-
---echo
---echo # On the default connection, do an update to provoke a
---echo # deadlock, then call the function with handler. This case
---echo # fails without the patch (with error ER_NO_SUCH_TABLE):
---connection default
-SET AUTOCOMMIT= 0;
---error ER_LOCK_WAIT_TIMEOUT
-UPDATE t1 SET i=1 WHERE i=1;
-SELECT f1() AS 'f1():';
-
---echo
---echo # Provoke another deadlock, then call the function with
---echo # handler indirectly. This case fails without the patch
---echo # (with error ER_NO_SUCH_TABLE):
---error ER_LOCK_WAIT_TIMEOUT
-UPDATE t1 SET i= 1 WHERE i= 1;
-SELECT f2() AS 'f2():';
-
---echo
---echo # Provoke yet another deadlock, but now from within a function,
---echo # then call the function with handler. This succeeds even
---echo # without the patch because is_fatal_sub_stmt_error is reset
---echo # in restore_sub_stmt after the failing function has been
---echo # executed. The test case is included anyway for better coverage:
---error ER_LOCK_WAIT_TIMEOUT
-SELECT f3() AS 'f3():';
-SELECT f1() AS 'f1():';
-
---echo # Provoke yet another deadlock, but now from within a function,
---echo # calling another function, then call the function with handler.
---echo # This succeeds even without the patch because
---echo # is_fatal_sub_stmt_error is reset in restore_sub_stmt after
---echo # the failing function has been executed. The test case is
---echo # included anyway for better coverage:
---error ER_LOCK_WAIT_TIMEOUT
-SELECT f4() AS 'f4():';
-SELECT f1() AS 'f1():';
-
---echo
---echo # Disconnect, drop functions and table:
---disconnect con1
-DROP FUNCTION f4;
-DROP FUNCTION f3;
-DROP FUNCTION f2;
-DROP FUNCTION f1;
-DROP TABLE t1;
-
---echo
---echo # Reset lock wait timeouts
-SET @@lock_wait_timeout= @lock_wait_timeout_saved;
-SET @@innodb_lock_wait_timeout= @innodb_lock_wait_timeout_saved;
-
---echo #
---echo # BUG 16041903: End of test case
---echo #
-
-# Wait till we reached the initial number of concurrent sessions
---source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/sp-lock.test b/mysql-test/t/sp-lock.test
deleted file mode 100644
index 83ea07d4bda..00000000000
--- a/mysql-test/t/sp-lock.test
+++ /dev/null
@@ -1,1007 +0,0 @@
-#
-# Metadata lock handling for stored procedures and
-# functions.
-#
---echo #
---echo # Test coverage for changes performed by the fix
---echo # for Bug#30977 "Concurrent statement using stored function
---echo # and DROP FUNCTION breaks SBR.
---echo #
-
---echo #
---echo # 1) Verify that the preceding transaction is
---echo # (implicitly) committed before CREATE/ALTER/DROP
---echo # PROCEDURE. Note, that this is already tested
---echo # in implicit_commit.test, but here we use an alternative
---echo # approach.
---echo #
-
---echo # Start a transaction, create a savepoint,
---echo # then call a DDL operation on a procedure, and then check
---echo # that the savepoint is no longer present.
-
---disable_warnings
-drop table if exists t1;
-drop procedure if exists p1;
-drop procedure if exists p2;
-drop procedure if exists p3;
-drop procedure if exists p4;
-drop function if exists f1;
---enable_warnings
-create table t1 (a int);
---echo #
---echo # Test 'CREATE PROCEDURE'.
---echo #
-begin;
-savepoint sv;
-create procedure p1() begin end;
---error ER_SP_DOES_NOT_EXIST
-rollback to savepoint sv;
---echo #
---echo # Test 'ALTER PROCEDURE'.
---echo #
-begin;
-savepoint sv;
-alter procedure p1 comment 'changed comment';
---error ER_SP_DOES_NOT_EXIST
-rollback to savepoint sv;
---echo #
---echo # Test 'DROP PROCEDURE'.
---echo #
-begin;
-savepoint sv;
-drop procedure p1;
---error ER_SP_DOES_NOT_EXIST
-rollback to savepoint sv;
---echo #
---echo # Test 'CREATE FUNCTION'.
---echo #
-begin;
-savepoint sv;
-create function f1() returns int return 1;
---error ER_SP_DOES_NOT_EXIST
-rollback to savepoint sv;
---echo #
---echo # Test 'ALTER FUNCTION'.
---echo #
-begin;
-savepoint sv;
-alter function f1 comment 'new comment';
---error ER_SP_DOES_NOT_EXIST
-rollback to savepoint sv;
---echo #
---echo # Test 'DROP FUNCTION'.
---echo #
-begin;
-savepoint sv;
-drop function f1;
---error ER_SP_DOES_NOT_EXIST
-rollback to savepoint sv;
-
---echo #
---echo # 2) Verify that procedure DDL operations fail
---echo # under lock tables.
---echo #
---echo # Auxiliary routines to test ALTER.
-create procedure p1() begin end;
-create function f1() returns int return 1;
-
-lock table t1 write;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-create procedure p2() begin end;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-alter procedure p1 comment 'changed comment';
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-drop procedure p1;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-create function f2() returns int return 1;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-alter function f1 comment 'changed comment';
-lock table t1 read;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-create procedure p2() begin end;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-alter procedure p1 comment 'changed comment';
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-drop procedure p1;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-create function f2() returns int return 1;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-alter function f1 comment 'changed comment';
-unlock tables;
---echo #
---echo # Even if we locked a temporary table.
---echo # Todo: this is a restriction we could possibly lift.
---echo #
-drop table t1;
-create temporary table t1 (a int);
-lock table t1 read;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-create procedure p2() begin end;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-alter procedure p1 comment 'changed comment';
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-drop procedure p1;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-create function f2() returns int return 1;
---error ER_LOCK_OR_ACTIVE_TRANSACTION
-alter function f1 comment 'changed comment';
-unlock tables;
-
-drop function f1;
-drop procedure p1;
-drop temporary table t1;
-
---echo #
---echo # 3) Verify that CREATE/ALTER/DROP routine grab an
---echo # exclusive lock.
---echo #
---echo # For that, start a transaction, use a routine. In a concurrent
---echo # connection, try to drop or alter the routine. It should place
---echo # a pending or exclusive lock and block. In another concurrnet
---echo # connection, try to use the routine.
---echo # That should block on the pending exclusive lock.
---echo #
-connect(con1, localhost, root,,);
-connect(con2, localhost, root,,);
-connect(con3, localhost, root,,);
-
---echo #
---echo # Test DROP PROCEDURE.
---echo #
-connection default;
-create procedure p1() begin end;
-delimiter |;
-create function f1() returns int
-begin
- call p1();
- return 1;
-end|
-delimiter ;|
-begin;
-select f1();
-connection con1;
---echo # Sending 'drop procedure p1'...
-send drop procedure p1;
-connection con2;
---echo # Waiting for 'drop procedure t1' to get blocked on MDL lock...
-let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for stored procedure metadata lock' and
-info='drop procedure p1';
---source include/wait_condition.inc
---echo # Demonstrate that there is a pending exclusive lock.
---echo # Sending 'select f1()'...
-send select f1();
-connection con3;
---echo # Waiting for 'select f1()' to get blocked by a pending MDL lock...
-let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for stored procedure metadata lock' and info='select f1()';
-connection default;
-commit;
-connection con1;
---echo # Reaping 'drop procedure p1'...
-reap;
-connection con2;
---echo # Reaping 'select f1()'
---error ER_SP_DOES_NOT_EXIST
-reap;
-connection default;
-
---echo #
---echo # Test CREATE PROCEDURE.
---echo #
-create procedure p1() begin end;
-begin;
-select f1();
-connection con1;
---echo # Sending 'create procedure p1'...
-send create procedure p1() begin end;
-connection con2;
---echo # Waiting for 'create procedure t1' to get blocked on MDL lock...
-let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for stored procedure metadata lock' and
-info='create procedure p1() begin end';
---source include/wait_condition.inc
---echo # Demonstrate that there is a pending exclusive lock.
---echo # Sending 'select f1()'...
-send select f1();
-connection con3;
---echo # Waiting for 'select f1()' to get blocked by a pending MDL lock...
-let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for stored procedure metadata lock' and info='select f1()';
-connection default;
-commit;
-connection con1;
---echo # Reaping 'create procedure p1'...
---error ER_SP_ALREADY_EXISTS
-reap;
-connection con2;
---echo # Reaping 'select f1()'
-reap;
-connection default;
-
---echo #
---echo # Test ALTER PROCEDURE.
---echo #
-begin;
-select f1();
-connection con1;
---echo # Sending 'alter procedure p1'...
-send alter procedure p1 contains sql;
-connection con2;
---echo # Waiting for 'alter procedure t1' to get blocked on MDL lock...
-let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for stored procedure metadata lock' and
-info='alter procedure p1 contains sql';
---source include/wait_condition.inc
---echo # Demonstrate that there is a pending exclusive lock.
---echo # Sending 'select f1()'...
-send select f1();
-connection con3;
---echo # Waiting for 'select f1()' to get blocked by a pending MDL lock...
-let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for stored procedure metadata lock' and info='select f1()';
-connection default;
-commit;
-connection con1;
---echo # Reaping 'alter procedure p1'...
-reap;
-connection con2;
---echo # Reaping 'select f1()'
-reap;
-connection default;
-
---echo #
---echo # Test DROP FUNCTION.
---echo #
-begin;
-select f1();
-connection con1;
---echo # Sending 'drop function f1'...
-send drop function f1;
-connection con2;
---echo # Waiting for 'drop function f1' to get blocked on MDL lock...
-let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for stored function metadata lock' and
-info='drop function f1';
---source include/wait_condition.inc
---echo # Demonstrate that there is a pending exclusive lock.
---echo # Sending 'select f1()'...
-send select f1();
-connection con3;
---echo # Waiting for 'select f1()' to get blocked by a pending MDL lock...
-let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for stored function metadata lock' and info='select f1()';
-connection default;
-commit;
-connection con1;
---echo # Reaping 'drop function f1'...
-reap;
-connection con2;
---echo # Reaping 'select f1()'
---error ER_SP_DOES_NOT_EXIST
-reap;
-connection default;
-
---echo #
---echo # Test CREATE FUNCTION.
---echo #
-create function f1() returns int return 1;
-begin;
-select f1();
-connection con1;
---echo # Sending 'create function f1'...
-send create function f1() returns int return 2;
-connection con2;
---echo # Waiting for 'create function f1' to get blocked on MDL lock...
-let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for stored function metadata lock' and
-info='create function f1() returns int return 2';
---source include/wait_condition.inc
---echo # Demonstrate that there is a pending exclusive lock.
---echo # Sending 'select f1()'...
-send select f1();
-connection con3;
---echo # Waiting for 'select f1()' to get blocked by a pending MDL lock...
-let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for stored function metadata lock' and info='select f1()';
-connection default;
-commit;
-connection con1;
---echo # Reaping 'create function f1'...
---error ER_SP_ALREADY_EXISTS
-reap;
-connection con2;
---echo # Reaping 'select f1()'
-reap;
-connection default;
-
---echo #
---echo # Test ALTER FUNCTION.
---echo #
-begin;
-select f1();
-connection con1;
---echo # Sending 'alter function f1'...
-send alter function f1 contains sql;
-connection con2;
---echo # Waiting for 'alter function f1' to get blocked on MDL lock...
-let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for stored function metadata lock' and
-info='alter function f1 contains sql';
---source include/wait_condition.inc
---echo # Demonstrate that there is a pending exclusive lock.
---echo # Sending 'select f1()'...
-send select f1();
-connection con3;
---echo # Waiting for 'select f1()' to get blocked by a pending MDL lock...
-let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for stored function metadata lock' and info='select f1()';
-connection default;
-commit;
-connection con1;
---echo # Reaping 'alter function f1'...
-reap;
-connection con2;
---echo # Reaping 'select f1()'
-reap;
-connection default;
-drop function f1;
-drop procedure p1;
-
---echo #
---echo # 4) MDL lock should not be taken for
---echo # unrolled CALL statements.
---echo # The primary goal of metadata locks is a consistent binary log.
---echo # When a call statement is unrolled, it doesn't get to the
---echo # binary log, instead the statements that are contained
---echo # in the procedure body do. This can nest to any level.
---echo #
-create procedure p1() begin end;
-create procedure p2() begin end;
-create table t1 (a int);
-delimiter |;
-create procedure p3()
-begin
- call p1();
- call p1();
- call p2();
-end|
-create procedure p4()
-begin
- call p1();
- call p1();
- call p2();
- call p2();
- call p3();
-end|
-delimiter ;|
-begin;
-select * from t1;
-savepoint sv;
-call p4();
---echo # Prepared statement should not add any locks either.
-prepare stmt from "call p4()";
-execute stmt;
-execute stmt;
-connection con1;
-drop procedure p1;
-drop procedure p2;
-drop procedure p3;
-drop procedure p4;
-connection default;
---echo # This is to verify there was no implicit commit.
-rollback to savepoint sv;
---error ER_SP_DOES_NOT_EXIST
-call p4();
-commit;
-drop table t1;
-
---echo #
---echo # 5) Locks should be taken on routines
---echo # used indirectly by views or triggers.
---echo #
---echo #
---echo # A function is used from a trigger.
---echo #
-create function f1() returns int return 1;
-create table t1 (a int);
-create table t2 (a int, b int);
-create trigger t1_ai after insert on t1 for each row
- insert into t2 (a, b) values (new.a, f1());
-begin;
-insert into t1 (a) values (1);
-connection con1;
---echo # Sending 'drop function f1'
-send drop function f1;
-connection con2;
---echo # Waiting for 'drop function f1' to get blocked on MDL lock...
-let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for stored function metadata lock' and
-info='drop function f1';
---source include/wait_condition.inc
-connection default;
-commit;
-connection con1;
---echo # Reaping 'drop function f1'...
-reap;
-connection default;
---echo #
---echo # A function is used from a view.
---echo #
-create function f1() returns int return 1;
-create view v1 as select f1() as a;
-begin;
-select * from v1;
-connection con1;
---echo # Sending 'drop function f1'
-send drop function f1;
-connection con2;
---echo # Waiting for 'drop function f1' to get blocked on MDL lock...
-let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for stored function metadata lock' and
-info='drop function f1';
---source include/wait_condition.inc
-connection default;
-commit;
-connection con1;
---echo # Reaping 'drop function f1'...
-reap;
-connection default;
---echo #
---echo # A procedure is used from a function.
---echo #
-delimiter |;
-create function f1() returns int
-begin
- declare v_out int;
- call p1(v_out);
- return v_out;
-end|
-delimiter ;|
-create procedure p1(out v_out int) set v_out=3;
-begin;
-select * from v1;
-connection con1;
---echo # Sending 'drop procedure p1'
-send drop procedure p1;
-connection con2;
---echo # Waiting for 'drop procedure p1' to get blocked on MDL lock...
-let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for stored procedure metadata lock' and
-info='drop procedure p1';
---source include/wait_condition.inc
-connection default;
-commit;
-connection con1;
---echo # Reaping 'drop procedure p1'...
-reap;
-connection default;
-
---echo #
---echo # Deep nesting: a function is used from a procedure used
---echo # from a function used from a view used in a trigger.
---echo #
-create function f2() returns int return 4;
-create procedure p1(out v_out int) set v_out=f2();
-drop trigger t1_ai;
-create trigger t1_ai after insert on t1 for each row
- insert into t2 (a, b) values (new.a, (select max(a) from v1));
-begin;
-insert into t1 (a) values (3);
-connection con1;
---echo # Sending 'drop function f2'
-send drop function f2;
-connection con2;
---echo # Waiting for 'drop function f2' to get blocked on MDL lock...
-let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for stored function metadata lock' and
-info='drop function f2';
---source include/wait_condition.inc
-connection default;
-commit;
-connection con1;
---echo # Reaping 'drop function f2'...
-reap;
-connection default;
-
-drop view v1;
-drop function f1;
-drop procedure p1;
-drop table t1, t2;
-
---echo #
---echo # 6) Check that ER_LOCK_DEADLOCK is reported if
---echo # acquisition of a shared lock fails during a transaction or
---echo # we need to back off to flush the sp cache.
---echo #
---echo # Sic: now this situation does not require a back off since we
---echo # flush the cache on the fly.
---echo #
-create function f1() returns int return 7;
-create table t1 (a int);
-begin;
-select * from t1;
-# Used to have a back-off here, with optional ER_LOCK_DEADLOCK
-#--error ER_LOCK_DEADLOCK
-select f1();
-commit;
-drop table t1;
-drop function f1;
-
---echo #
---echo # 7) Demonstrate that under LOCK TABLES we accumulate locks
---echo # on stored routines, and release metadata locks in
---echo # ROLLBACK TO SAVEPOINT. That is done only for those stored
---echo # routines that are not part of LOCK TABLES prelocking list.
---echo # Those stored routines that are part of LOCK TABLES
---echo # prelocking list are implicitly locked when entering
---echo # LOCK TABLES, and ROLLBACK TO SAVEPOINT has no effect on
---echo # them.
---echo #
-create function f1() returns varchar(20) return "f1()";
-create function f2() returns varchar(20) return "f2()";
-create view v1 as select f1() as a;
-set @@session.autocommit=0;
-lock table v1 read;
-select * from v1;
-savepoint sv;
-select f2();
-connection con1;
---echo # Sending 'drop function f1'...
-send drop function f1;
-connection con2;
---echo # Waiting for 'drop function f1' to get blocked on MDL lock...
-let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for stored function metadata lock' and
-info='drop function f1';
---source include/wait_condition.inc
---echo # Sending 'drop function f2'...
-send drop function f2;
-connection default;
---echo # Waiting for 'drop function f2' to get blocked on MDL lock...
-let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for stored function metadata lock' and
-info='drop function f2';
---source include/wait_condition.inc
-rollback to savepoint sv;
-connection con2;
---echo # Reaping 'drop function f2'...
-reap;
-connection default;
-unlock tables;
-connection con1;
---echo # Reaping 'drop function f1'...
-reap;
-connection default;
---error ER_SP_DOES_NOT_EXIST
-drop function f1;
---error ER_SP_DOES_NOT_EXIST
-drop function f2;
-drop view v1;
-set @@session.autocommit=default;
-
---echo #
---echo # 8) Check the situation when we're preparing or executing a
---echo # prepared statement, and as part of that try to flush the
---echo # session sp cache. However, one of the procedures that
---echo # needs a flush is in use. Verify that there is no infinite
---echo # reprepare loop and no crash.
---echo #
-create function f1() returns int return 1;
-delimiter |;
---echo #
---echo # We just mention p1() in the body of f2() to make
---echo # sure that p1() metadata is validated when validating
---echo # 'select f2()'.
---echo # Recursion is not allowed in stored functions, so
---echo # an attempt to just invoke p1() from f2() which is in turn
---echo # called from p1() would have given a run-time error.
---echo #
-create function f2() returns int
-begin
- if @var is null then
- call p1();
- end if;
- return 1;
-end|
-create procedure p1()
-begin
- select f1() into @var;
- execute stmt;
-end|
-delimiter ;|
-connection con2;
-prepare stmt from "select f2()";
-connection default;
-begin;
-select f1();
-connection con1;
---echo # Sending 'alter function f1 ...'...
-send alter function f1 comment "comment";
-connection con2;
---echo # Waiting for 'alter function f1 ...' to get blocked on MDL lock...
-let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for stored function metadata lock' and
-info like 'alter function f1 comment%';
---source include/wait_condition.inc
---echo # Sending 'call p1()'...
-send call p1();
-connection default;
---echo # Waiting for 'call p1()' to get blocked on MDL lock on f1...
-let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for stored function metadata lock' and
-info='select f1() into @var';
---source include/wait_condition.inc
---echo # Let 'alter function f1 ...' go through...
-commit;
-connection con1;
---echo # Reaping 'alter function f1 ...'
-reap;
-connection con2;
---echo # Reaping 'call p1()'...
-reap;
-deallocate prepare stmt;
-connection default;
-drop function f1;
-drop function f2;
-drop procedure p1;
-
---echo #
---echo # 9) Check the situation when a stored function is invoked
---echo # from a stored procedure, and recursively invokes the
---echo # stored procedure that is in use. But for the second
---echo # invocation, a cache flush is requested. We can't
---echo # flush the procedure that's in use, and are forced
---echo # to use an old version. It is not a violation of
---echo # consistency, since we unroll top-level calls.
---echo # Just verify the code works.
---echo #
-create function f1() returns int return 1;
-begin;
-select f1();
-connection con1;
---echo # Sending 'alter function f1 ...'...
-send alter function f1 comment "comment";
-connection con2;
---echo # Waiting for 'alter function f1 ...' to get blocked on MDL lock...
-let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for stored function metadata lock' and
-info like 'alter function f1 comment%';
---source include/wait_condition.inc
-delimiter |;
---echo #
---echo # We just mention p1() in the body of f2() to make
---echo # sure that p1() is prelocked for f2().
---echo # Recursion is not allowed in stored functions, so
---echo # an attempt to just invoke p1() from f2() which is in turn
---echo # called from p1() would have given a run-time error.
---echo #
-create function f2() returns int
-begin
- if @var is null then
- call p1();
- end if;
- return 1;
-end|
-create procedure p1()
-begin
- select f1() into @var;
- select f2() into @var;
-end|
-delimiter ;|
---echo # Sending 'call p1()'...
-send call p1();
-connection default;
---echo # Waiting for 'call p1()' to get blocked on MDL lock on f1...
-let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='Waiting for stored function metadata lock' and
-info='select f1() into @var';
---source include/wait_condition.inc
---echo # Let 'alter function f1 ...' go through...
-commit;
-connection con1;
---echo # Reaping 'alter function f1 ...'
-reap;
-connection con2;
---echo # Reaping 'call p1()'...
-reap;
-connection default;
-drop function f1;
-drop function f2;
-drop procedure p1;
-
---echo #
---echo # 10) A select from information_schema.routines now
---echo # flushes the stored routines caches. Test that this
---echo # does not remove from the cache a stored routine
---echo # that is already prelocked.
---echo #
-create function f1() returns int return get_lock("30977", 100000);
-create function f2() returns int return 2;
-delimiter |;
-create function f3() returns varchar(255)
-begin
- declare res varchar(255);
- declare c cursor for select routine_name from
- information_schema.routines where routine_name='f1';
- select f1() into @var;
- open c;
- fetch c into res;
- close c;
- select f2() into @var;
- return res;
-end|
-delimiter ;|
-connection con1;
-select get_lock("30977", 0);
-connection default;
---echo # Sending 'select f3()'...
-send select f3();
-connection con1;
---echo # Waiting for 'select f3()' to get blocked on the user level lock...
-let $wait_condition=select count(*)=1 from information_schema.processlist
-where state='User lock' and info='select f1() into @var';
---source include/wait_condition.inc
---echo # Do something to change the cache version.
-create function f4() returns int return 4;
-drop function f4;
-select release_lock("30977");
-connection default;
---echo # Reaping 'select f3()'...
---echo # Routine 'f2()' should exist and get executed successfully.
-reap;
-select @var;
-drop function f1;
-drop function f2;
-drop function f3;
-
-
---echo # 11) Check the situation when the connection is flushing the
---echo # SP cache which contains a procedure that is being executed.
---echo #
---echo # Function f1() calls p1(). Procedure p1() has a DROP
---echo # VIEW statement, which, we know, invalidates the routines cache.
---echo # During cache flush p1() must not be flushed since it's in
---echo # use.
---echo #
-delimiter |;
-create function f1() returns int
-begin
- call p1();
- return 1;
-end|
-create procedure p1()
-begin
- create view v1 as select 1;
- drop view v1;
- select f1() into @var;
- set @exec_count=@exec_count+1;
-end|
-delimiter ;|
-set @exec_count=0;
---error ER_SP_RECURSION_LIMIT
-call p1();
-select @exec_count;
-set @@session.max_sp_recursion_depth=5;
-set @exec_count=0;
---error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-call p1();
-select @exec_count;
-drop procedure p1;
-drop function f1;
-set @@session.max_sp_recursion_depth=default;
-
-connection con1;
-disconnect con1;
---source include/wait_until_disconnected.inc
-connection con2;
-disconnect con2;
---source include/wait_until_disconnected.inc
-connection con3;
-disconnect con3;
---source include/wait_until_disconnected.inc
-connection default;
-
-
---echo #
---echo # SHOW CREATE PROCEDURE p1 called from p1, after p1 was altered
---echo #
---echo # We are just covering the existing behaviour with tests. The
---echo # results are not necessarily correct."
---echo #
-
-delimiter |;
-CREATE PROCEDURE p1()
-BEGIN
- SELECT get_lock("test", 10);
- SHOW CREATE PROCEDURE p1;
-END|
-delimiter ;|
-
-connect (con2, localhost, root);
-connect (con3, localhost, root);
-
-connection default;
-SELECT get_lock("test", 10);
-
-connection con2;
---echo # Will halt before executing SHOW CREATE PROCEDURE p1
---echo # Sending:
---send CALL p1()
-
-connection con3;
-let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state='User lock' and info='SELECT get_lock("test", 10)';
---source include/wait_condition.inc
---echo # Alter p1
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1() BEGIN END;
-
-connection default;
---echo # Resume CALL p1, now with new p1
-SELECT release_lock("test");
-
-connection con2;
---echo # Reaping: CALL p1()
---reap
-
-connection con3;
-disconnect con3;
---source include/wait_until_disconnected.inc
-connection con2;
-disconnect con2;
---source include/wait_until_disconnected.inc
-connection default;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Bug#57663 Concurrent statement using stored function and DROP DATABASE
---echo # breaks SBR
---echo #
-
---disable_warnings
-DROP DATABASE IF EXISTS db1;
-DROP FUNCTION IF EXISTS f1;
---enable_warnings
-
-connect(con1, localhost, root);
-connect(con2, localhost, root);
-
---echo # Test 1: Check that DROP DATABASE block if a function is used
---echo # by an active transaction.
-
-connection default;
-CREATE DATABASE db1;
-CREATE FUNCTION db1.f1() RETURNS INTEGER RETURN 1;
-START TRANSACTION;
-SELECT db1.f1();
-
-connection con1;
---echo # Sending:
---send DROP DATABASE db1
-
-connection default;
---echo # Waiting for DROP DATABASE to be blocked by the lock on f1()
-let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist
- WHERE state= 'Waiting for stored function metadata lock'
- AND info='DROP DATABASE db1';
---source include/wait_condition.inc
-COMMIT;
-
-connection con1;
---echo # Reaping: DROP DATABASE db1
---reap
-
---echo # Test 2: Check that DROP DATABASE blocks if a procedure is
---echo # used by an active transaction.
-
-connection default;
-CREATE DATABASE db1;
-CREATE PROCEDURE db1.p1() BEGIN END;
-delimiter |;
-CREATE FUNCTION f1() RETURNS INTEGER
-BEGIN
- CALL db1.p1();
- RETURN 1;
-END|
-delimiter ;|
-START TRANSACTION;
-SELECT f1();
-
-connection con1;
---echo # Sending:
---send DROP DATABASE db1
-
-connection default;
---echo # Waiting for DROP DATABASE to be blocked by the lock on p1()
-let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist
- WHERE state= 'Waiting for stored procedure metadata lock'
- AND info='DROP DATABASE db1';
---source include/wait_condition.inc
-COMMIT;
-
-connection con1;
---echo # Reaping: DROP DATABASE db1
---reap
-
---echo # Test 3: Check that DROP DATABASE is not selected as a victim if a
---echo # deadlock is discovered with DML statements.
-
-connection default;
-CREATE DATABASE db1;
-CREATE TABLE db1.t1 (a INT);
-CREATE FUNCTION db1.f1() RETURNS INTEGER RETURN 1;
-START TRANSACTION;
-# DROP DATABASE will lock tables (t1) before functions (f1)
-SELECT db1.f1();
-
-connection con1;
---echo # Sending:
---send DROP DATABASE db1
-
-connection default;
---echo # Waiting for DROP DATABASE to be blocked by the lock on f1()
-let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist
- WHERE state= 'Waiting for stored function metadata lock'
- AND info='DROP DATABASE db1';
---source include/wait_condition.inc
---error ER_LOCK_DEADLOCK
-SELECT * FROM db1.t1;
-COMMIT;
-
-connection con1;
---echo # Reaping: DROP DATABASE db1
---reap
-
---echo # Test 4: Check that active DROP DATABASE blocks stored routine DDL.
-
-connection default;
-CREATE DATABASE db1;
-CREATE FUNCTION db1.f1() RETURNS INTEGER RETURN 1;
-CREATE FUNCTION db1.f2() RETURNS INTEGER RETURN 2;
-START TRANSACTION;
-SELECT db1.f2();
-
-connection con1;
---echo # Sending:
---send DROP DATABASE db1
-
-connection con2;
---echo # Waiting for DROP DATABASE to be blocked by the lock on f2()
-let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist
- WHERE state= 'Waiting for stored function metadata lock'
- AND info='DROP DATABASE db1';
---source include/wait_condition.inc
---echo # Sending:
---send ALTER FUNCTION db1.f1 COMMENT "test"
-
-connection default;
---echo # Waiting for ALTER FUNCTION to be blocked by the schema lock on db1
-let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist
- WHERE state= 'Waiting for schema metadata lock'
- AND info='ALTER FUNCTION db1.f1 COMMENT "test"';
---source include/wait_condition.inc
-COMMIT;
-
-connection con1;
---echo # Reaping: DROP DATABASE db1
---reap
-disconnect con1;
---source include/wait_until_disconnected.inc
-
-connection con2;
---echo # Reaping: ALTER FUNCTION f1 COMMENT 'test'
---error ER_SP_DOES_NOT_EXIST
---reap
-disconnect con2;
---source include/wait_until_disconnected.inc
-
-connection default;
-DROP FUNCTION f1;
-
-
---echo #
---echo # End of 5.5 tests
---echo #
diff --git a/mysql-test/t/sp-no-code.test b/mysql-test/t/sp-no-code.test
deleted file mode 100644
index 47a1a126627..00000000000
--- a/mysql-test/t/sp-no-code.test
+++ /dev/null
@@ -1,12 +0,0 @@
-#
-# Test the debugging feature "show procedure/function code <name>"
-#
-
--- source include/not_debug.inc
-
---error ER_FEATURE_DISABLED
-show procedure code foo;
-
---error ER_FEATURE_DISABLED
-show function code foo;
-
diff --git a/mysql-test/t/sp-prelocking.test b/mysql-test/t/sp-prelocking.test
deleted file mode 100644
index 38cbd5aa110..00000000000
--- a/mysql-test/t/sp-prelocking.test
+++ /dev/null
@@ -1,446 +0,0 @@
-#
-# Tests of prelocking-free execution of stored procedures.
-# Currently two properties of prelocking-free SP execution are checked:
-# - It is possible to execute DDL statements in prelocking-free stored
-# procedure
-# - The same procedure can be called in prelocking-free mode and
-# in prelocked mode (from within a function).
-
---disable_warnings
-drop database if exists mysqltest;
-drop table if exists t1, t2, t3, t4;
-drop procedure if exists sp1;
-drop procedure if exists sp2;
-drop procedure if exists sp3;
-drop procedure if exists sp4;
-drop function if exists f1;
-drop function if exists f2;
-drop function if exists f3;
---enable_warnings
-
-# BUG#8072
-
-create database mysqltest;
-delimiter //;
-use mysqltest//
-create procedure sp1 ()
-begin
- drop table if exists t1;
- select 1 as "my-col";
-end;
-//
-delimiter ;//
-
-select database();
-call sp1();
-select database();
-
-use test;
-select database();
-call mysqltest.sp1();
-select database();
-
-drop procedure mysqltest.sp1;
-drop database mysqltest;
-
-# BUG#8766
-
-delimiter //;
-create procedure sp1()
-begin
- create table t1 (a int);
- insert into t1 values (10);
-end//
-
-create procedure sp2()
-begin
- create table t2(a int);
- insert into t2 values(1);
- call sp1();
-end//
-
-create function f1() returns int
-begin
- return (select max(a) from t1);
-end//
-
-create procedure sp3()
-begin
- call sp1();
- select 'func', f1();
-end//
-
-delimiter ;//
-
-call sp1();
-select 't1',a from t1;
-
-drop table t1;
-call sp2();
-select 't1',a from t1;
-select 't2',a from t2;
-drop table t1, t2;
-
-call sp3();
-select 't1',a from t1;
-
-drop table t1;
-
-drop procedure sp1;
-drop procedure sp2;
-drop procedure sp3;
-drop function f1;
-
-delimiter //;
-create procedure sp1()
-begin
- create temporary table t2(a int);
- insert into t2 select * from t1;
-end//
-
-create procedure sp2()
-begin
- create temporary table t1 (a int);
- insert into t1 values(1);
- call sp1();
- select 't1', a from t1;
- select 't2', a from t2;
- drop table t1;
- drop table t2;
-end//
-
-delimiter ;//
-call sp2();
-
-drop procedure sp1;
-drop procedure sp2;
-
-# Miscelaneous tests
-create table t1 (a int);
-insert into t1 values(1),(2);
-create table t2 as select * from t1;
-create table t3 as select * from t1;
-create table t4 as select * from t1;
-delimiter //;
-create procedure sp1(a int)
-begin
- select a;
-end //
-
-create function f1() returns int
-begin
- return (select max(a) from t1);
-end //
-
-delimiter ;//
-
-CALL sp1(f1());
-
-#############
-delimiter //;
-create procedure sp2(a int)
-begin
- select * from t3;
- select a;
-end //
-
-create procedure sp3()
-begin
- select * from t1;
- call sp2(5);
-end //
-
-create procedure sp4()
-begin
- select * from t2;
- call sp3();
-end //
-
-delimiter ;//
-call sp4();
-
-drop procedure sp1;
-drop procedure sp2;
-drop procedure sp3;
-drop procedure sp4;
-drop function f1;
-
-# Test that prelocking state restoration works with cursors
---disable_warnings
-drop view if exists v1;
---enable_warnings
-delimiter //;
-
-create function f1(ab int) returns int
-begin
- declare i int;
- set i= (select max(a) from t1 where a < ab) ;
- return i;
-end //
-
-create function f2(ab int) returns int
-begin
- declare i int;
- set i= (select max(a) from t2 where a < ab) ;
- return i;
-end //
-
-create view v1 as
- select t3.a as x, t4.a as y, f2(3) as z
- from t3, t4 where t3.a = t4.a //
-
-create procedure sp1()
-begin
- declare a int;
- set a= (select f1(4) + count(*) A from t1, v1);
-end //
-
-
-create function f3() returns int
-begin
- call sp1();
- return 1;
-end //
-
-call sp1() //
-
-select f3() //
-select f3() //
-
-call sp1() //
-
-# ---------------
-drop procedure sp1//
-drop function f3//
-
-create procedure sp1()
-begin
- declare x int;
- declare c cursor for select f1(3) + count(*) from v1;
- open c;
- fetch c into x;
-end;//
-
-create function f3() returns int
-begin
- call sp1();
- return 1;
-end //
-
-call sp1() //
-call sp1() //
-
-select f3() //
-call sp1() //
-
-delimiter ;//
-drop view v1;
-drop table t1,t2,t3,t4;
-drop function f1;
-drop function f2;
-drop function f3;
-drop procedure sp1;
-
-#
-# Bug#15683 "crash, Function on nested VIEWs, Prepared statement"
-# Check that when creating the prelocking list a nested view
-# is not merged until it's used.
-#
---disable_warnings
-drop table if exists t1;
-drop view if exists v1, v2, v3;
-drop function if exists bug15683;
---enable_warnings
-create table t1 (f1 bigint, f2 varchar(20), f3 bigint);
-insert into t1 set f1 = 1, f2 = 'schoenenbourg', f3 = 1;
-create view v1 as select 1 from t1 union all select 1;
-create view v2 as select 1 from v1;
-create view v3 as select 1 as f1 from v2;
-
-delimiter |;
-create function bug15683() returns bigint
-begin
-return (select count(*) from v3);
-end|
-delimiter ;|
-
-prepare stmt from "select bug15683()";
-execute stmt;
-execute stmt;
-deallocate prepare stmt;
-drop table t1;
-drop view v1, v2, v3;
-drop function bug15683;
-
-
-#
-# Bug#19634 "Re-execution of multi-delete which involve trigger/stored
-# function crashes server"
-#
---disable_warnings
-drop table if exists t1, t2, t3;
-drop function if exists bug19634;
---enable_warnings
-create table t1 (id int, data int);
-create table t2 (id int);
-create table t3 (data int);
-create function bug19634() returns int return (select count(*) from t3);
-prepare stmt from "delete t1 from t1, t2 where t1.id = t2.id and bug19634()";
-# This should not crash server
-execute stmt;
-execute stmt;
-deallocate prepare stmt;
-
-create trigger t1_bi before delete on t1 for each row insert into t3 values (old.data);
-prepare stmt from "delete t1 from t1, t2 where t1.id = t2.id";
-
-execute stmt;
-execute stmt;
-deallocate prepare stmt;
-
-drop function bug19634;
-drop table t1, t2, t3;
-
-#
-# Bug #27907 Misleading error message when opening/locking tables
-#
-
---disable_warnings
-drop table if exists bug_27907_logs;
-drop table if exists bug_27907_t1;
---enable_warnings
-
-create table bug_27907_logs (a int);
-create table bug_27907_t1 (a int);
-
-delimiter |;
-
-create trigger bug_27907_t1_ai after insert on bug_27907_t1
-for each row
-begin
- insert into bug_27907_logs (a) values (1);
-end|
-
-delimiter ;|
-
-drop table bug_27907_logs;
-
-#
-# was failing before with error ER_NOT_LOCKED
-#
---error ER_NO_SUCH_TABLE
-insert into bug_27907_t1(a) values (1);
-
-drop table bug_27907_t1;
-
---echo
---echo Bug#22427 create table if not exists + stored function results in
---echo inconsistent behavior
---echo
---echo Add a test case, the bug itself was fixed by the patch for
---echo Bug#20662
---echo
---disable_warnings
-drop table if exists t1;
-drop function if exists f_bug22427;
---enable_warnings
-create table t1 (i int);
-insert into t1 values (1);
-create function f_bug22427() returns int return (select max(i) from t1);
-select f_bug22427();
-# Until this bug was fixed, the following emitted error
-# ERROR 1213: Deadlock found when trying to get lock
-create table if not exists t1 select f_bug22427() as i;
---error ER_TABLE_EXISTS_ERROR
-create table t1 select f_bug22427() as i;
-drop table t1;
-drop function f_bug22427;
-
---echo #
---echo # Bug #29929 LOCK TABLES does not pre-lock tables used in triggers of the locked tables
---echo #
---disable_warnings
-DROP table IF EXISTS t1,t2;
---enable_warnings
-CREATE TABLE t1 (c1 INT);
-CREATE TABLE t2 (c2 INT);
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (2);
-DELIMITER //;
-CREATE TRIGGER t1_ai AFTER INSERT ON t1 FOR EACH ROW
-BEGIN
-UPDATE t2 SET c2= c2 + 1;
-END//
-DELIMITER ;//
---echo # Take a table lock on t1.
---echo # This should pre-lock t2 through the trigger.
-LOCK TABLE t1 WRITE;
-INSERT INTO t1 VALUES (3);
-UNLOCK TABLES;
-LOCK TABLE t1 READ;
---error ER_TABLE_NOT_LOCKED
-INSERT INTO t2 values(4);
-UNLOCK TABLES;
-SELECT * FROM t1;
-SELECT * FROM t2;
-DROP TRIGGER t1_ai;
-DROP TABLE t1, t2;
-
---echo End of 5.0 tests
-
---echo #
---echo # Bug#21142859: FUNCTION UPDATING A VIEW FAILS TO FIND TABLE THAT ACTUALLY EXISTS
---echo #
-
-CREATE TABLE t1 SELECT 1 AS fld1, 'A' AS fld2;
-CREATE TABLE t2 (fld3 INT, fld4 CHAR(1));
-
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-CREATE TRIGGER t1_au AFTER UPDATE ON t1
-FOR EACH ROW INSERT INTO t2 VALUES (new.fld1, new.fld2);
-
-DELIMITER !;
-CREATE FUNCTION f1() RETURNS INT
-BEGIN
- UPDATE v1 SET fld2='B' WHERE fld1=1;
- RETURN row_count();
-END !
-DELIMITER ;!
-
---echo # Without the patch, an error was getting reported.
-SELECT f1();
-
-DROP FUNCTION f1;
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug #16672723 "CAN'T FIND TEMPORARY TABLE".
---echo #
-CREATE FUNCTION f1() RETURNS INT RETURN 1;
-CREATE TEMPORARY TABLE tmp1(a INT);
-PREPARE stmt1 FROM "CREATE TEMPORARY TABLE tmp2 AS SELECT b FROM (SELECT f1() AS b FROM tmp1) AS t";
---echo # The below statement failed before the fix.
-EXECUTE stmt1;
-DROP TEMPORARY TABLES tmp1, tmp2;
-DEALLOCATE PREPARE stmt1;
-DROP FUNCTION f1;
-
-#
-# MDEV-9084 Calling a stored function from a nested select from temporary table causes unpredictable behavior
-#
-delimiter $$;
-create procedure sp1()
-begin
- drop table if exists t1, t2;
- create temporary table t1 select 1 v;
- create table t2 (col varchar(45)) select distinct col from (select sf1() as col from t1) t;
-end$$
-delimiter ;$$
-create function sf1() returns text return 'blah';
-call test.sp1();
-call test.sp1();
-drop procedure sp1;
-drop function sf1;
-drop table t2;
diff --git a/mysql-test/t/sp-row-vs-var.inc b/mysql-test/t/sp-row-vs-var.inc
deleted file mode 100644
index 54d323f7341..00000000000
--- a/mysql-test/t/sp-row-vs-var.inc
+++ /dev/null
@@ -1,6 +0,0 @@
---let $query= CREATE PROCEDURE p1() BEGIN DECLARE var $type; DECLARE rec ROW(var $type); CREATE TABLE t1 AS SELECT var,rec.var FROM DUAL;END
---eval $query
-CALL p1();
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-DROP PROCEDURE p1;
diff --git a/mysql-test/t/sp-row.test b/mysql-test/t/sp-row.test
deleted file mode 100644
index 837e24c89c0..00000000000
--- a/mysql-test/t/sp-row.test
+++ /dev/null
@@ -1,1506 +0,0 @@
---echo #
---echo # MDEV-10914 ROW data type for stored routine variables
---echo #
-
-
-
---echo #
---echo # ROW of ROWs is not supported yet
---echo #
-
-DELIMITER $$;
---error ER_PARSE_ERROR
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a ROW(a ROW(a INT));
-END;
-$$
-DELIMITER ;$$
-
-
---echo #
---echo # Returning the entire ROW parameter from a function
---echo #
-# TODO: this should probably return an error at compile time
-DELIMITER $$;
-CREATE FUNCTION f1(a ROW(a INT, b INT)) RETURNS INT
-BEGIN
- RETURN a;
-END;
-$$
-DELIMITER ;$$
---error ER_OPERAND_COLUMNS
-SELECT f1(ROW(10,20));
-DROP FUNCTION f1;
-
-
-
---echo #
---echo # ROW as an SP parameter
---echo #
-
-DELIMITER $$;
-CREATE FUNCTION f1(a ROW(a INT,b INT)) RETURNS INT
-BEGIN
- RETURN a.b;
-END;
-$$
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a ROW(a INT,b INT) DEFAULT (11,21);
- SELECT f1(a);
-END;
-$$
-DELIMITER ;$$
-SELECT f1(ROW(10,20));
---error ER_OPERAND_COLUMNS
-SELECT f1(10);
---error ER_OPERAND_COLUMNS
-SELECT f1(ROW(10,20,30));
-CALL p1();
-DROP PROCEDURE p1;
-DROP FUNCTION f1;
-
-DELIMITER $$;
-CREATE PROCEDURE p1(a ROW(a INT,b INT))
-BEGIN
- SELECT a.a, a.b;
-END;
-$$
-DELIMITER ;$$
-CALL p1(ROW(10,20));
---error ER_OPERAND_COLUMNS
-CALL p1(10);
---error ER_OPERAND_COLUMNS
-CALL p1(ROW(10,20,30));
-DROP PROCEDURE p1;
-
-
---echo #
---echo # ROW as an SP OUT parameter
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1(OUT a ROW(a INT,b INT))
-BEGIN
- SET a.a=10;
- SET a.b=20;
-END;
-$$
-CREATE PROCEDURE p2()
-BEGIN
- DECLARE a ROW(a INT,b INT) DEFAULT (11,21);
- CALL p1(a);
- SELECT a.a,a.b;
-END;
-$$
-DELIMITER ;$$
-CALL p2();
-DROP PROCEDURE p2;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # ROW as an SP return value is not supported yet
---echo #
-
-DELIMITER $$;
---error ER_PARSE_ERROR
-CREATE FUNCTION p1() RETURNS ROW(a INT)
-BEGIN
- RETURN NULL;
-END;
-$$
-DELIMITER ;$$
-
-
---echo #
---echo # Diplicate row field
---echo #
-DELIMITER $$;
---error ER_DUP_FIELDNAME
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a ROW (a INT, a DOUBLE);
- SELECT a.a;
-END;
-$$
-DELIMITER ;$$
-
-
---echo #
---echo # Bad scalar default value
---echo #
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a ROW (a INT, b DOUBLE) DEFAULT 1;
- SELECT a.a;
-END;
-$$
-DELIMITER ;$$
---error ER_OPERAND_COLUMNS
-CALL p1();
-DROP PROCEDURE p1;
-
---echo #
---echo # Bad ROW default value with a wrong number of fields
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a ROW (a INT, b DOUBLE) DEFAULT ROW(1,2,3);
- SELECT a.a;
-END;
-$$
-DELIMITER ;$$
---error ER_OPERAND_COLUMNS
-CALL p1();
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Scalar variable vs table alias cause no ambiguity
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a INT;
- -- a.x is a table column here (not a row variable field)
- SELECT a.x FROM a;
- SELECT a.x FROM t1 a;
-END;
-$$
-DELIMITER ;$$
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Using the entire ROW variable in select list
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a ROW (a INT);
- SELECT a;
-END;
-$$
-DELIMITER ;$$
---error ER_OPERAND_COLUMNS
-CALL p1();
-DROP PROCEDURE p1;
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a ROW (a INT,b INT);
- SELECT a;
-END;
-$$
-DELIMITER ;$$
---error ER_OPERAND_COLUMNS
-CALL p1();
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Using the entire ROW variable in functions
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a ROW (a INT);
- SELECT COALESCE(a);
-END;
-$$
-DELIMITER ;$$
---error ER_OPERAND_COLUMNS
-CALL p1();
-DROP PROCEDURE p1;
-
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a ROW (a INT,b INT);
- SELECT COALESCE(a);
-END;
-$$
-DELIMITER ;$$
---error ER_OPERAND_COLUMNS
-CALL p1();
-DROP PROCEDURE p1;
-
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a ROW (a INT);
- SELECT a+1;
-END;
-$$
-DELIMITER ;$$
---error ER_OPERAND_COLUMNS
-CALL p1();
-DROP PROCEDURE p1;
-
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a ROW (a INT,b INT);
- SELECT a+1;
-END;
-$$
-DELIMITER ;$$
---error ER_OPERAND_COLUMNS
-CALL p1();
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Comparing the entire ROW to a scalar value
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a ROW (a INT,b INT);
- SELECT a=1;
-END;
-$$
-DELIMITER ;$$
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-CALL p1();
-DROP PROCEDURE p1;
-
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a ROW (a INT,b INT);
- SELECT 1=a;
-END;
-$$
-DELIMITER ;$$
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-CALL p1();
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Passing the entire ROW to a stored function
---echo #
-
-DELIMITER $$;
-CREATE FUNCTION f1(a INT) RETURNS INT
-BEGIN
- RETURN a;
-END;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a ROW (a INT,b INT);
- SELECT f1(a);
-END;
-$$
-DELIMITER ;$$
---error ER_OPERAND_COLUMNS
-CALL p1();
-DROP PROCEDURE p1;
-DROP FUNCTION f1;
-
-
-#DELIMITER $$;
-#CREATE FUNCTION f1(a INT) RETURNS INT
-#BEGIN
-# RETURN a;
-#END;
-#CREATE PROCEDURE p1()
-#BEGIN
-# DECLARE a ROW (a INT);
-# SELECT f1(a);
-#END;
-#$$
-#DELIMITER ;$$
-##--error ER_OPERAND_COLUMNS
-#CALL p1();
-#DROP PROCEDURE p1;
-#DROP FUNCTION f1;
-
-
---echo #
---echo # Assigning a scalar value to a ROW variable with 1 column
---echo #
-
-DELIMITER $$;
-CREATE OR REPLACE PROCEDURE p1()
-BEGIN
- DECLARE rec ROW(a INT);
- SET rec=1;
-END;
-$$
-DELIMITER ;$$
---error ER_OPERAND_COLUMNS
-CALL p1();
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Assigning a scalar value to a ROW variable with 2 columns
---echo #
-
-DELIMITER $$;
-CREATE OR REPLACE PROCEDURE p1()
-BEGIN
- DECLARE rec ROW(a INT,b INT);
- SET rec=1;
-END;
-$$
-DELIMITER ;$$
---error ER_OPERAND_COLUMNS
-CALL p1();
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Assigning a ROW value to a ROW variable with different number of columns
---echo #
-
-DELIMITER $$;
-CREATE OR REPLACE PROCEDURE p1()
-BEGIN
- DECLARE rec ROW(a INT,b INT);
- SET rec=ROW(1,2,3);
-END;
-$$
-DELIMITER ;$$
---error ER_OPERAND_COLUMNS
-CALL p1();
-DROP PROCEDURE p1;
-
---echo #
---echo # Returning the entire ROW from a function is not supported yet
---echo # This syntax would be needed: SELECT f1().x FROM DUAL;
---echo #
-DELIMITER $$;
-CREATE FUNCTION f1(a INT) RETURNS INT
-BEGIN
- DECLARE rec ROW(a INT);
- RETURN rec;
-END;
-$$
-DELIMITER ;$$
---error ER_OPERAND_COLUMNS
-SELECT f1(10);
-DROP FUNCTION f1;
-
-
---echo #
---echo # Using the entire ROW in SELECT..CREATE
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec ROW(a INT,b INT);
- CREATE TABLE t1 AS SELECT rec;
-END;
-$$
-DELIMITER ;$$
---error ER_OPERAND_COLUMNS
-CALL p1();
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Using the entire ROW in LIMIT
---echo #
-DELIMITER $$;
---error ER_WRONG_SPVAR_TYPE_IN_LIMIT
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec ROW(a INT);
- SET rec.a= '10';
- SELECT * FROM t1 LIMIT rec;
-END;
-$$
-DELIMITER ;$$
-
-
---echo #
---echo # Setting ROW fields using a SET command
---echo #
-DELIMITER $$;
-CREATE OR REPLACE PROCEDURE p1()
-BEGIN
- DECLARE rec ROW(a INT,b DOUBLE,c VARCHAR(10));
- DECLARE a INT;
- SET @a= 10, rec.a=10, rec.b=20, rec.c= 'test', a= 5;
- SELECT rec.a, rec.b, rec.c, a;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Assigning a ROW variable from a ROW value
---echo #
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec ROW(a INT,b INT);
- SET rec=ROW(1,2);
- SELECT rec.a, rec.b;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Assigning a ROW variable from another ROW value
---echo #
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec1 ROW(a INT,b INT);
- DECLARE rec2 ROW(a INT,b INT);
- SET rec1=ROW(1,2);
- SET rec2=rec1;
- SELECT rec2.a, rec2.b;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Comparing a ROW variable to a ROW() function
---echo #
-
-DELIMITER $$;
-CREATE OR REPLACE PROCEDURE p1()
-BEGIN
- DECLARE rec ROW(a INT,b INT);
- SET rec.a= 1;
- SET rec.b= 2;
- SELECT rec=(0,0), rec=ROW(0,0), (0,0)=rec, ROW(0,0)=rec;
- SELECT rec=(1,2), rec=ROW(1,2), (1,2)=rec, ROW(1,2)=rec;
- SELECT rec=(NULL,0), rec=ROW(NULL,0);
- SELECT rec=(NULL,2), rec=ROW(NULL,2);
- SELECT rec<>(0,0), rec<>ROW(0,0);
- SELECT rec<>(1,2), rec<>ROW(1,2);
- SELECT rec<>(NULL,0), rec<>ROW(NULL,0);
- SELECT rec<>(NULL,2), rec<>ROW(NULL,2);
- SELECT rec IN ((0,0)), rec IN (ROW(0,0));
- SELECT rec IN ((1,2)), rec IN (ROW(1,2));
- SELECT rec IN ((0,NULL),(1,2));
- SELECT rec NOT IN ((0,NULL),(1,1));
- SELECT rec NOT IN ((1,NULL),(1,1));
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Comparing a ROW variable to another ROW variable
---echo #
-
-DELIMITER $$;
-CREATE OR REPLACE PROCEDURE p1()
-BEGIN
- DECLARE rec1,rec2,rec3 ROW(a INT,b INT);
- SET rec1.a= 1;
- SET rec1.b= 2;
- SET rec2.a= 11;
- SET rec2.b= 12;
- SET rec3.a= 11;
- SET rec3.b= 12;
- SELECT rec1=rec2, rec2=rec1, rec2=rec3, rec3=rec2;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Referencing a non-existing row variable
---echo #
-DELIMITER $$;
---error ER_UNKNOWN_STRUCTURED_VARIABLE
-CREATE PROCEDURE p1()
-BEGIN
- SET a.b=1;
-END;
-$$
-DELIMITER ;$$
-
---echo #
---echo # Referencing a non-existing row field
---echo #
-DELIMITER $$;
---error ER_ROW_VARIABLE_DOES_NOT_HAVE_FIELD
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a ROW(a INT,b INT);
- SELECT a.c FROM t1;
-END;
-$$
-DELIMITER ;$$
-
-
---echo #
---echo # ROW and scalar variables with the same name shadowing each other
---echo #
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a ROW(a INT);
- SET a.a=100;
- SELECT a.a;
- BEGIN
- DECLARE a INT DEFAULT 200;
- SELECT a;
- BEGIN
- DECLARE a ROW(a INT);
- SET a.a=300;
- SELECT a.a;
- END;
- SELECT a;
- END;
- SELECT a.a;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP PROCEDURE p1;
-
-
---echo #
---echo # ROW with good default values
---echo #
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a ROW(a INT,b INT) DEFAULT (10,20);
- DECLARE b ROW(a INT,b INT) DEFAULT (11,21);
- DECLARE c ROW(a INT,b INT) DEFAULT a;
- SELECT a.a, a.b, b.a, b.b, c.a, c.b FROM DUAL;
-END;
-$$
-DELIMITER ;$$
-CALL p1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # ROW in WHERE clause
---echo #
-
-CREATE TABLE t1 (a INT,b INT);
-INSERT INTO t1 VALUES (10,20);
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec ROW(a INT,b INT) DEFAULT ROW(10,20);
- SELECT * FROM t1 WHERE rec=ROW(a,b);
- SELECT * FROM t1 WHERE ROW(a,b)=rec;
- SELECT * FROM t1 WHERE rec=ROW(10,20);
- SELECT * FROM t1 WHERE ROW(10,20)=rec;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # ROW fields in WHERE clause
---echo #
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (10),(20);
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec ROW(a INT);
- SET rec.a= 10;
- SELECT * FROM t1 WHERE a=rec.a;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # ROW fields in HAVING clause
---echo #
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (10),(20);
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec ROW(a INT);
- SET rec.a= 10;
- SELECT * FROM t1 HAVING a=rec.a;
- SELECT * FROM t1 HAVING MIN(a)=rec.a;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # ROW fields in LIMIT clause
---echo #
-
-CREATE TABLE t1 (a INT);
---error ER_SP_UNDECLARED_VAR
-SELECT 1 FROM t1 LIMIT t1.a;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (10),(20);
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec ROW(a INT);
- SET rec.a= 10;
- SELECT * FROM t1 LIMIT rec.a;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
-DELIMITER $$;
---error ER_WRONG_SPVAR_TYPE_IN_LIMIT
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec ROW(a VARCHAR(10));
- SET rec.a= '10';
- SELECT * FROM t1 LIMIT rec.a;
-END;
-$$
-DELIMITER ;$$
-
-
---echo #
---echo # ROW fields in select list
---echo #
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (10),(20);
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE t1 ROW(a INT);
- SET t1.a= 10;
- SELECT t1.a, 'This is the variable t1.a value, rather than the column t1.a' AS comm FROM t1;
- SELECT t1.a, t2.a, t1.a+t2.a FROM t1 t2;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # ROW fields as insert values
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(10));
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec ROW(a INT, b VARCHAR(10));
- SET rec.a= 10;
- SET rec.b= 'test';
- INSERT INTO t1 VALUES (rec.a, rec.b);
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-SELECT * FROM t1;
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # ROW fields as SP out parameters
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1(OUT a INT, OUT b VARCHAR(32))
-BEGIN
- SET a= 10;
- SET b= 'test';
-END;
-$$
-CREATE PROCEDURE p2()
-BEGIN
- DECLARE rec ROW(a INT, b VARCHAR(10));
- CALL p1(rec.a, rec.b);
- SELECT rec.a, rec.b;
-END;
-$$
-DELIMITER ;$$
-CALL p2;
-DROP PROCEDURE p1;
-DROP PROCEDURE p2;
-
-
---echo #
---echo # ROW fields as dynamic SQL out parameters
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1(OUT a INT, OUT b VARCHAR(32))
-BEGIN
- SET a= 20;
- SET b= 'test-dynamic-sql';
-END;
-$$
-CREATE PROCEDURE p2()
-BEGIN
- DECLARE rec ROW(a INT, b VARCHAR(30));
- EXECUTE IMMEDIATE 'CALL p1(?,?)' USING rec.a, rec.b;
- SELECT rec.a, rec.b;
-END;
-$$
-DELIMITER ;$$
-CALL p2;
-DROP PROCEDURE p1;
-DROP PROCEDURE p2;
-
-
---echo #
---echo # ROW fields as SELECT..INTO targets
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec ROW(a INT, b VARCHAR(10));
- SELECT 10,'test' INTO rec.a,rec.b;
- SELECT rec.a, rec.b;
-END;
-$$
-DELIMITER ;$$
-CALL p1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Implicit default NULL handling
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec ROW(a INT, b VARCHAR(10), c DOUBLE, d DECIMAL(10,0), e TIME, f DATETIME);
- SELECT rec.a, rec.b, rec.c, rec.d, rec.e, rec.f FROM DUAL;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP PROCEDURE p1;
-
-
---echo #
---echo # NULL handling
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec1 ROW(a INT, b VARCHAR(10)) DEFAULT (NULL,NULL);
- DECLARE rec2 ROW(a INT, b VARCHAR(10)) DEFAULT rec1;
- SELECT rec1.a, rec1.b, rec2.a, rec2.b;
-
- SET rec1= (10,20);
- SET rec2= rec1;
- SELECT rec1.a, rec1.b, rec2.a, rec2.b;
-
- SET rec1= (NULL,20);
- SET rec2= rec1;
- SELECT rec1.a, rec1.b, rec2.a, rec2.b;
-
- SET rec1= (10,NULL);
- SET rec2= rec1;
- SELECT rec1.a, rec1.b, rec2.a, rec2.b;
-
- SET rec1= (NULL,NULL);
- SET rec2= rec1;
- SELECT rec1.a, rec1.b, rec2.a, rec2.b;
-END;
-$$
-DELIMITER ;$$
-CALL p1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Testing multiple ROW variable declarations
---echo # This makes sure that fill_field_definitions() is called only once
---echo # per a ROW field, so create length is not converted to internal length
---echo # multiple times.
---echo #
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec1, rec2, rec3 ROW(a VARCHAR(10) CHARACTER SET utf8);
- CREATE TABLE t1 AS SELECT rec1.a, rec2.a, rec3.a;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
---echo #
---echo # INT
---echo #
-
---let type=INT
---source sp-row-vs-var.inc
-
---let type=INT(1)
---source sp-row-vs-var.inc
-
---let type=INT(2)
---source sp-row-vs-var.inc
-
---let type=INT(3)
---source sp-row-vs-var.inc
-
---let type=INT(4)
---source sp-row-vs-var.inc
-
---let type=INT(5)
---source sp-row-vs-var.inc
-
---let type=INT(6)
---source sp-row-vs-var.inc
-
---let type=INT(7)
---source sp-row-vs-var.inc
-
---let type=INT(8)
---source sp-row-vs-var.inc
-
---let type=INT(9)
---source sp-row-vs-var.inc
-
---let type=INT(10)
---source sp-row-vs-var.inc
-
---let type=INT(11)
---source sp-row-vs-var.inc
-
---let type=INT(12)
---source sp-row-vs-var.inc
-
---let type=INT(13)
---source sp-row-vs-var.inc
-
---let type=INT(14)
---source sp-row-vs-var.inc
-
---let type=INT(20)
---source sp-row-vs-var.inc
-
---let type=INT(21)
---source sp-row-vs-var.inc
-
-
---echo #
---echo # TINYINT
---echo #
-
---let type=TINYINT
---source sp-row-vs-var.inc
-
---let type=TINYINT(1)
---source sp-row-vs-var.inc
-
---let type=TINYINT(2)
---source sp-row-vs-var.inc
-
---let type=TINYINT(3)
---source sp-row-vs-var.inc
-
---let type=TINYINT(4)
---source sp-row-vs-var.inc
-
---let type=TINYINT(5)
---source sp-row-vs-var.inc
-
---let type=TINYINT(6)
---source sp-row-vs-var.inc
-
---let type=TINYINT(7)
---source sp-row-vs-var.inc
-
---let type=TINYINT(8)
---source sp-row-vs-var.inc
-
---let type=TINYINT(9)
---source sp-row-vs-var.inc
-
---let type=TINYINT(10)
---source sp-row-vs-var.inc
-
---let type=TINYINT(11)
---source sp-row-vs-var.inc
-
---let type=TINYINT(12)
---source sp-row-vs-var.inc
-
---let type=TINYINT(13)
---source sp-row-vs-var.inc
-
---let type=TINYINT(14)
---source sp-row-vs-var.inc
-
---let type=TINYINT(20)
---source sp-row-vs-var.inc
-
---let type=TINYINT(21)
---source sp-row-vs-var.inc
-
---echo #
---echo # SMALLINT
---echo #
-
---let type=SMALLINT
---source sp-row-vs-var.inc
-
---let type=SMALLINT(1)
---source sp-row-vs-var.inc
-
---let type=SMALLINT(2)
---source sp-row-vs-var.inc
-
---let type=SMALLINT(3)
---source sp-row-vs-var.inc
-
---let type=SMALLINT(4)
---source sp-row-vs-var.inc
-
---let type=SMALLINT(5)
---source sp-row-vs-var.inc
-
---let type=SMALLINT(6)
---source sp-row-vs-var.inc
-
---let type=SMALLINT(7)
---source sp-row-vs-var.inc
-
---let type=SMALLINT(8)
---source sp-row-vs-var.inc
-
---let type=SMALLINT(9)
---source sp-row-vs-var.inc
-
---let type=SMALLINT(10)
---source sp-row-vs-var.inc
-
---let type=SMALLINT(11)
---source sp-row-vs-var.inc
-
---let type=SMALLINT(12)
---source sp-row-vs-var.inc
-
---let type=SMALLINT(13)
---source sp-row-vs-var.inc
-
---let type=SMALLINT(14)
---source sp-row-vs-var.inc
-
---let type=SMALLINT(20)
---source sp-row-vs-var.inc
-
---let type=SMALLINT(21)
---source sp-row-vs-var.inc
-
-
---echo #
---echo # MEDIUMINT
---echo #
-
---let type=MEDIUMINT
---source sp-row-vs-var.inc
-
---let type=MEDIUMINT(1)
---source sp-row-vs-var.inc
-
---let type=MEDIUMINT(2)
---source sp-row-vs-var.inc
-
---let type=MEDIUMINT(3)
---source sp-row-vs-var.inc
-
---let type=MEDIUMINT(4)
---source sp-row-vs-var.inc
-
---let type=MEDIUMINT(5)
---source sp-row-vs-var.inc
-
---let type=MEDIUMINT(6)
---source sp-row-vs-var.inc
-
---let type=MEDIUMINT(7)
---source sp-row-vs-var.inc
-
---let type=MEDIUMINT(8)
---source sp-row-vs-var.inc
-
---let type=MEDIUMINT(9)
---source sp-row-vs-var.inc
-
---let type=MEDIUMINT(10)
---source sp-row-vs-var.inc
-
---let type=MEDIUMINT(11)
---source sp-row-vs-var.inc
-
---let type=MEDIUMINT(12)
---source sp-row-vs-var.inc
-
---let type=MEDIUMINT(13)
---source sp-row-vs-var.inc
-
---let type=MEDIUMINT(14)
---source sp-row-vs-var.inc
-
---let type=MEDIUMINT(20)
---source sp-row-vs-var.inc
-
---let type=MEDIUMINT(21)
---source sp-row-vs-var.inc
-
-
---echo #
---echo # BIGINT
---echo #
-
---let type=BIGINT
---source sp-row-vs-var.inc
-
---let type=BIGINT(1)
---source sp-row-vs-var.inc
-
---let type=BIGINT(2)
---source sp-row-vs-var.inc
-
---let type=BIGINT(3)
---source sp-row-vs-var.inc
-
---let type=BIGINT(4)
---source sp-row-vs-var.inc
-
---let type=BIGINT(5)
---source sp-row-vs-var.inc
-
---let type=BIGINT(6)
---source sp-row-vs-var.inc
-
---let type=BIGINT(7)
---source sp-row-vs-var.inc
-
---let type=BIGINT(8)
---source sp-row-vs-var.inc
-
---let type=BIGINT(9)
---source sp-row-vs-var.inc
-
---let type=BIGINT(10)
---source sp-row-vs-var.inc
-
---let type=BIGINT(11)
---source sp-row-vs-var.inc
-
---let type=BIGINT(12)
---source sp-row-vs-var.inc
-
---let type=BIGINT(13)
---source sp-row-vs-var.inc
-
---let type=BIGINT(14)
---source sp-row-vs-var.inc
-
---let type=BIGINT(20)
---source sp-row-vs-var.inc
-
---let type=BIGINT(21)
---source sp-row-vs-var.inc
-
-
---echo #
---echo # DOUBLE
---echo #
-
---let type=DOUBLE
---source sp-row-vs-var.inc
-
---let type=DOUBLE(30,1)
---source sp-row-vs-var.inc
-
---let type=DOUBLE(30,2)
---source sp-row-vs-var.inc
-
---let type=DOUBLE(30,3)
---source sp-row-vs-var.inc
-
---let type=DOUBLE(30,4)
---source sp-row-vs-var.inc
-
---let type=DOUBLE(30,5)
---source sp-row-vs-var.inc
-
---let type=DOUBLE(30,6)
---source sp-row-vs-var.inc
-
---let type=DOUBLE(30,7)
---source sp-row-vs-var.inc
-
---let type=DOUBLE(30,8)
---source sp-row-vs-var.inc
-
---let type=DOUBLE(30,9)
---source sp-row-vs-var.inc
-
---let type=DOUBLE(30,10)
---source sp-row-vs-var.inc
-
---let type=DOUBLE(30,11)
---source sp-row-vs-var.inc
-
---let type=DOUBLE(30,12)
---source sp-row-vs-var.inc
-
---let type=DOUBLE(30,13)
---source sp-row-vs-var.inc
-
---let type=DOUBLE(30,14)
---source sp-row-vs-var.inc
-
---let type=DOUBLE(30,20)
---source sp-row-vs-var.inc
-
---let type=DOUBLE(30,21)
---source sp-row-vs-var.inc
-
---echo #
---echo # VARCHAR
---echo #
-
---let type=CHAR
---source sp-row-vs-var.inc
-
---let type=BINARY
---source sp-row-vs-var.inc
-
---let type=CHAR(1)
---source sp-row-vs-var.inc
-
---let type=CHAR(10)
---source sp-row-vs-var.inc
-
---let type=NCHAR(10)
---source sp-row-vs-var.inc
-
---let type=BINARY(10)
---source sp-row-vs-var.inc
-
---let type=VARBINARY(10)
---source sp-row-vs-var.inc
-
---let type=VARCHAR(10)
---source sp-row-vs-var.inc
-
---let type=VARCHAR(10) CHARACTER SET utf8
---source sp-row-vs-var.inc
-
---let type=VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_bin
---source sp-row-vs-var.inc
-
---echo #
---echo # TIME
---echo #
-
---let type=TIME
---source sp-row-vs-var.inc
-
---let type=TIME(1)
---source sp-row-vs-var.inc
-
---let type=TIME(2)
---source sp-row-vs-var.inc
-
---let type=TIME(3)
---source sp-row-vs-var.inc
-
---let type=TIME(4)
---source sp-row-vs-var.inc
-
---let type=TIME(5)
---source sp-row-vs-var.inc
-
---let type=TIME(6)
---source sp-row-vs-var.inc
-
---echo #
---echo # DATETIME
---echo #
-
---let type=DATETIME
---source sp-row-vs-var.inc
-
---let type=DATETIME(1)
---source sp-row-vs-var.inc
-
---let type=DATETIME(2)
---source sp-row-vs-var.inc
-
---let type=DATETIME(3)
---source sp-row-vs-var.inc
-
---let type=DATETIME(4)
---source sp-row-vs-var.inc
-
---let type=DATETIME(5)
---source sp-row-vs-var.inc
-
---let type=DATETIME(6)
---source sp-row-vs-var.inc
-
-
---echo #
---echo # LOB
---echo #
-
---let type=TEXT
---source sp-row-vs-var.inc
-
---let type=TINYTEXT
---source sp-row-vs-var.inc
-
---let type=MEDIUMTEXT
---source sp-row-vs-var.inc
-
---let type=LONGTEXT
---source sp-row-vs-var.inc
-
---let type=TEXT CHARACTER SET utf8
---source sp-row-vs-var.inc
-
---let type=TINYTEXT CHARACTER SET utf8
---source sp-row-vs-var.inc
-
---let type=MEDIUMTEXT CHARACTER SET utf8
---source sp-row-vs-var.inc
-
---let type=LONGTEXT CHARACTER SET utf8
---source sp-row-vs-var.inc
-
-
---echo #
---echo # End of MDEV-10914 ROW data type for stored routine variables
---echo #
-
-
---echo #
---echo # MDEV-12291 Allow ROW variables as SELECT INTO targets
---echo #
-
-
---echo # ROW variable with a wrong column count
-CREATE TABLE t1 (a INT, b VARCHAR(32));
-INSERT INTO t1 VALUES (10,'b10');
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec1 ROW(a INT, b VARCHAR(32), c DOUBLE);
- SELECT * FROM t1 INTO rec1;
- SELECT rec1.a, rec1.b;
-END;
-$$
-DELIMITER ;$$
---error ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo # Multiple ROW variables
-CREATE TABLE t1 (a INT, b VARCHAR(32));
-INSERT INTO t1 VALUES (10,'b10');
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec1 ROW(a INT, b VARCHAR(32));
- SELECT * FROM t1 INTO rec1, rec1;
- SELECT rec1.a, rec1.b;
-END;
-$$
-DELIMITER ;$$
---error ER_OPERAND_COLUMNS
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo # ROW variables working example
-CREATE TABLE t1 (a INT, b VARCHAR(32));
-INSERT INTO t1 VALUES (10,'b10');
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE rec1 ROW(a INT, b VARCHAR(32));
- SELECT * FROM t1 INTO rec1;
- SELECT rec1.a, rec1.b;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # MDEV-13273 Confusion between table alias and ROW type variable
---echo #
-
-CREATE TABLE t1 (c1 INT, c2 INT);
-INSERT INTO t1 VALUES (0,0);
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a INT;
- DECLARE b INT;
- -- a.c1 is a table column
- SELECT a.c1 INTO b
- FROM t1 a
- WHERE a.c2 = 0;
- SELECT b;
-END;
-$$
-DELIMITER ;$$
-CALL p1;
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 INT, c2 INT);
-INSERT INTO t1 VALUES (0,0);
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a ROW (c1 INT, c2 INT) DEFAULT ROW(101,102);
- DECLARE b INT;
- -- a.c1 is a ROW variable field
- SELECT a.c1 INTO b
- FROM t1 a
- WHERE a.c2 = 102;
- SELECT b;
-END;
-$$
-DELIMITER ;$$
-CALL p1;
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 INT, c2 INT);
-INSERT INTO t1 VALUES (0,0);
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a ROW TYPE OF t1 DEFAULT ROW (10,20);
- DECLARE b INT;
- -- a.c1 is a ROW variable field
- SELECT a.c1 INTO b
- FROM t1 a
- WHERE a.c2 = 20;
- SELECT b;
-END;
-$$
-DELIMITER ;$$
-CALL p1;
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 INT, c2 INT);
-INSERT INTO t1 VALUES (0,0);
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur1 CURSOR FOR SELECT * FROM t1;
- BEGIN
- DECLARE a ROW TYPE OF cur1 DEFAULT ROW (10,20);
- DECLARE b INT;
- -- a.c1 is a ROW variable field
- SELECT a.c1 INTO b
- FROM t1 a
- WHERE a.c2 = 20;
- SELECT b;
- END;
-END;
-$$
-DELIMITER ;$$
-CALL p1;
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-13527 Crash when EXPLAIN SELECT .. INTO row_sp_variable.field
---echo #
-
-DELIMITER $$;
-BEGIN NOT ATOMIC
- DECLARE a ROW(a INT);
- EXPLAIN SELECT 1 INTO a.a;
-END;
-$$
-DELIMITER ;$$
-
-
---echo #
---echo # MDEV-14139 Anchored data types for variables
---echo #
-
-DELIMITER $$;
-BEGIN NOT ATOMIC
- DECLARE row1 ROW(int11 INT,text1 TEXT);
- DECLARE a_row1 TYPE OF row1;
- DECLARE aa_row1 TYPE OF a_row1;
- CREATE TABLE t1 AS SELECT a_row1.int11 AS int11, a_row1.text1 AS text1;
- SHOW CREATE TABLE t1;
- DROP TABLE t1;
- CREATE TABLE t1 AS SELECT aa_row1.int11 AS int11, aa_row1.text1 AS text1;
- SHOW CREATE TABLE t1;
- DROP TABLE t1;
-END;
-$$
-DELIMITER ;$$
diff --git a/mysql-test/t/sp-security-anchor-type.test b/mysql-test/t/sp-security-anchor-type.test
deleted file mode 100644
index e61d5e38052..00000000000
--- a/mysql-test/t/sp-security-anchor-type.test
+++ /dev/null
@@ -1,328 +0,0 @@
---source include/not_embedded.inc
-
---echo #
---echo # MDEV-12461 TYPE OF and ROW TYPE OF anchored data types
---echo #
-
-
---echo #
---echo # Initiation:
---echo # - creating database db1
---echo # - creating user user1 with access rights to db1
---echo #
-
-CREATE DATABASE db1;
-CREATE TABLE db1.t1 (a INT, b VARCHAR(10));
-
-CREATE USER user1;
-
-GRANT ALL PRIVILEGES ON test.* TO user1;
-
-connect (conn1,localhost,user1,,test);
-
-SELECT database();
-SELECT user();
-
---echo #
---echo # Making sure that user1 does not have privileges to db1.t1
---echo #
-
---error ER_TABLEACCESS_DENIED_ERROR
-SHOW CREATE TABLE db1.t1;
---error ER_TABLEACCESS_DENIED_ERROR
-SHOW FIELDS IN db1.t1;
-
-
---echo #
---echo # Trigger: using TYPE OF with a table we don't have access to
---echo #
-CREATE TABLE test.t1 (a INT, b INT);
-INSERT INTO test.t1 (a,b) VALUES (10,20);
-SELECT * FROM t1;
-DELIMITER $$;
-CREATE TRIGGER test.tr1 BEFORE INSERT ON test.t1 FOR EACH ROW
-BEGIN
- DECLARE b TYPE OF db1.t1.b DEFAULT 20;
- SET NEW.b = 10;
-END
-$$
-DELIMITER ;$$
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO t1 (a) VALUES (10);
-SELECT * FROM t1;
-DROP TRIGGER tr1;
-DROP TABLE t1;
-
-
---echo #
---echo # Stored procedure: Using TYPE OF for with a table that we don't have access to
---echo # DEFINER user1, SQL SECURITY DEFAULT
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a TYPE OF db1.t1.a DEFAULT 10;
- SELECT a;
-END;
-$$
-DELIMITER ;$$
---error ER_TABLEACCESS_DENIED_ERROR
-CALL p1;
-DROP PROCEDURE p1;
-
-#DELIMITER $$;
-#CREATE PROCEDURE p1()
-#BEGIN
-# DECLARE a ROW TYPE OF db1.t1;
-# SELECT a.a;
-#END;
-#$$
-#DELIMITER ;$$
-#--error ER_TABLEACCESS_DENIED_ERROR
-#CALL p1;
-#DROP PROCEDURE p1;
-
-
---echo #
---echo # Stored procedure: Using TYPE OF for with a table that we don't have access to
---echo # DEFINER root, SQL SECURITY INVOKER
---echo #
-
-connection default;
-DELIMITER $$;
-CREATE PROCEDURE p1()
-SQL SECURITY INVOKER
-BEGIN
- DECLARE a TYPE OF db1.t1.a DEFAULT 10;
- SELECT a;
-END;
-$$
-DELIMITER ;$$
-connection conn1;
---error ER_TABLEACCESS_DENIED_ERROR
-CALL p1;
-DROP PROCEDURE p1;
-
-
-connection default;
-DELIMITER $$;
-CREATE PROCEDURE p1()
-SQL SECURITY INVOKER
-BEGIN
- DECLARE a ROW TYPE OF db1.t1;
- SELECT a.a;
-END;
-$$
-DELIMITER ;$$
-connection conn1;
---error ER_TABLEACCESS_DENIED_ERROR
-CALL p1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Stored procedure: Using TYPE OF for with a table that we don't have access to
---echo # DEFINER root, SQL SECURITY DEFINER
---echo #
-
-connection default;
-DELIMITER $$;
-CREATE PROCEDURE p1()
-SQL SECURITY DEFINER
-BEGIN
- DECLARE a TYPE OF db1.t1.a DEFAULT 10;
- SELECT a;
-END;
-$$
-DELIMITER ;$$
-connection conn1;
-CALL p1;
-DROP PROCEDURE p1;
-
-connection default;
-DELIMITER $$;
-CREATE PROCEDURE p1()
-SQL SECURITY DEFINER
-BEGIN
- DECLARE a ROW TYPE OF db1.t1;
- SET a.a= 10;
- SELECT a.a;
-END;
-$$
-DELIMITER ;$$
-connection conn1;
-CALL p1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Stored function: Using TYPE OF for with a table that we don't have access to
---echo # DEFINER user1, SQL SECURITY DEFAULT
---echo #
-
-CREATE TABLE t1 (a INT);
-DELIMITER $$;
-CREATE FUNCTION f1() RETURNS INT
-BEGIN
- DECLARE a TYPE OF db1.t1.a DEFAULT 0;
- RETURN OCTET_LENGTH(a);
-END;
-$$
-DELIMITER ;$$
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT f1();
-DROP FUNCTION f1;
-DROP TABLE t1;
-
-
---echo #
---echo # Stored function: Using TYPE OF for with a table that we don't have access to
---echo # DEFINER root, SQL SECURITY INVOKER
---echo #
-
-connection default;
-CREATE TABLE t1 (a INT);
-DELIMITER $$;
-CREATE FUNCTION f1() RETURNS INT
-SQL SECURITY INVOKER
-BEGIN
- DECLARE a TYPE OF db1.t1.a DEFAULT 0;
- RETURN OCTET_LENGTH(a);
-END;
-$$
-DELIMITER ;$$
-connection conn1;
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT f1();
-DROP FUNCTION f1;
-DROP TABLE t1;
-
-
---echo #
---echo # Stored function: Using TYPE OF for with a table that we don't have access to
---echo # DEFINER root, SQL SECURITY DEFINER
---echo #
-
-connection default;
-CREATE TABLE t1 (a INT);
-DELIMITER $$;
-CREATE FUNCTION f1() RETURNS INT
-SQL SECURITY DEFINER
-BEGIN
- DECLARE a TYPE OF db1.t1.a DEFAULT 0;
- RETURN OCTET_LENGTH(a);
-END;
-$$
-DELIMITER ;$$
-connection conn1;
-SELECT f1();
-DROP FUNCTION f1;
-DROP TABLE t1;
-
-
-connection default;
-GRANT SELECT (a) ON db1.t1 TO user1;
-connection conn1;
-
---echo #
---echo # Making sure that user1 has access to db1.t1.a, but not to db1.t1.b
---echo #
-
---error ER_TABLEACCESS_DENIED_ERROR
-SHOW CREATE TABLE db1.t1;
-SHOW FIELDS IN db1.t1;
-
---echo #
---echo # Trigger: Per-column privileges
---echo #
-CREATE TABLE test.t1 (a INT, b INT);
-INSERT INTO test.t1 (a,b) VALUES (10,20);
-SELECT * FROM t1;
-# TYPE OF reference using a column we have access to
-DELIMITER $$;
-CREATE TRIGGER test.tr1 BEFORE INSERT ON test.t1 FOR EACH ROW
-BEGIN
- DECLARE a TYPE OF db1.t1.a DEFAULT 20;
- BEGIN
- SET NEW.b := 10;
- END;
-END
-$$
-DELIMITER ;$$
-INSERT INTO t1 (a) VALUES (10);
-SELECT * FROM t1;
-DROP TRIGGER tr1;
-# TYPE OF reference using a column that we don't have access to
-DELIMITER $$;
-CREATE TRIGGER test.tr1 BEFORE INSERT ON test.t1 FOR EACH ROW
-BEGIN
- DECLARE b TYPE OF db1.t1.b DEFAULT 20;
- BEGIN
- SET NEW.b = 10;
- END;
-END
-$$
-DELIMITER ;$$
---error ER_COLUMNACCESS_DENIED_ERROR
-INSERT INTO t1 (a) VALUES (10);
-SELECT * FROM t1;
-DROP TRIGGER tr1;
-DROP TABLE t1;
-
-
-
---echo #
---echo # Stored procedure: Per-column privileges
---echo # DEFINER user1, SQL SECURITY DEFAULT
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a TYPE OF db1.t1.a DEFAULT 10;
- SELECT a;
-END;
-$$
-DELIMITER ;$$
-CALL p1;
-DROP PROCEDURE p1;
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE b TYPE OF db1.t1.b DEFAULT 10;
- SELECT b;
-END;
-$$
-DELIMITER ;$$
---error ER_COLUMNACCESS_DENIED_ERROR
-CALL p1;
-DROP PROCEDURE p1;
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE b ROW TYPE OF db1.t1;
- SET b.b=10;
- SELECT b.b;
-END;
-$$
-DELIMITER ;$$
---error ER_COLUMNACCESS_DENIED_ERROR
-CALL p1;
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Clean up
---echo #
-disconnect conn1;
-connection default;
-
-DROP USER user1;
-DROP DATABASE db1;
-
---echo #
---echo # End of MDEV-12461 TYPE OF and ROW TYPE OF anchored data types
---echo #
diff --git a/mysql-test/t/sp-security.test b/mysql-test/t/sp-security.test
deleted file mode 100644
index 059a5dd0fa8..00000000000
--- a/mysql-test/t/sp-security.test
+++ /dev/null
@@ -1,1052 +0,0 @@
-#
-# Testing SQL SECURITY of stored procedures
-#
-
-# Can't test with embedded server that doesn't support grants
--- source include/not_embedded.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-connect (con1root,localhost,root,,);
-
-connection con1root;
-use test;
-
-# Create user user1 with no particular access rights
-create user user1@localhost;
-grant usage on *.* to user1@localhost;
-flush privileges;
-
---disable_warnings
-drop table if exists t1;
-drop database if exists db1_secret;
---enable_warnings
-# Create our secret database
-create database db1_secret;
-
-# Can create a procedure in other db
-create procedure db1_secret.dummy() begin end;
-drop procedure db1_secret.dummy;
-
-use db1_secret;
-
-create table t1 ( u varchar(64), i int );
-insert into t1 values('test', 0);
-
-# A test procedure and function
-create procedure stamp(i int)
- insert into db1_secret.t1 values (user(), i);
---replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
-show procedure status like 'stamp';
-
-delimiter |;
-create function db() returns varchar(64)
-begin
- declare v varchar(64);
-
- select u into v from t1 limit 1;
-
- return v;
-end|
-delimiter ;|
---replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
-show function status like 'db';
-
-# root can, of course
-call stamp(1);
-select * from t1;
-select db();
-
-create user user1@'%';
-grant execute on procedure db1_secret.stamp to user1@'%';
-grant execute on function db1_secret.db to user1@'%';
-set sql_mode='';
-grant execute on procedure db1_secret.stamp to ''@'%';
-grant execute on function db1_secret.db to ''@'%';
-set sql_mode=default;
-
-connect (con2user1,localhost,user1,,);
-connect (con3anon,localhost,anon,,);
-
-
-#
-# User1 can
-#
-connection con2user1;
-
-# This should work...
-call db1_secret.stamp(2);
-select db1_secret.db();
-
-# ...but not this
---error ER_TABLEACCESS_DENIED_ERROR
-select * from db1_secret.t1;
-
-# ...and not this
---error ER_DBACCESS_DENIED_ERROR
-create procedure db1_secret.dummy() begin end;
---error ER_PROCACCESS_DENIED_ERROR
-drop procedure db1_secret.dummy;
---error ER_PROCACCESS_DENIED_ERROR
-drop procedure db1_secret.stamp;
---error ER_PROCACCESS_DENIED_ERROR
-drop function db1_secret.db;
-
-
-#
-# Anonymous can
-#
-connection con3anon;
-
-# This should work...
-call db1_secret.stamp(3);
-select db1_secret.db();
-
-# ...but not this
---error ER_TABLEACCESS_DENIED_ERROR
-select * from db1_secret.t1;
-
-# ...and not this
---error ER_DBACCESS_DENIED_ERROR
-create procedure db1_secret.dummy() begin end;
---error ER_PROCACCESS_DENIED_ERROR
-drop procedure db1_secret.dummy;
---error ER_PROCACCESS_DENIED_ERROR
-drop procedure db1_secret.stamp;
---error ER_PROCACCESS_DENIED_ERROR
-drop function db1_secret.db;
-
-
-#
-# Check it out
-#
-connection con1root;
-select * from t1;
-
-#
-# Change to invoker's rights
-#
-alter procedure stamp sql security invoker;
---replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
-show procedure status like 'stamp';
-
-alter function db sql security invoker;
---replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
-show function status like 'db';
-
-# root still can
-call stamp(4);
-select * from t1;
-select db();
-
-#
-# User1 cannot
-#
-connection con2user1;
-
-# This should not work
---error ER_TABLEACCESS_DENIED_ERROR
-call db1_secret.stamp(5);
---error ER_TABLEACCESS_DENIED_ERROR
-select db1_secret.db();
-
-#
-# Anonymous cannot
-#
-connection con3anon;
-
-# This should not work
---error ER_TABLEACCESS_DENIED_ERROR
-call db1_secret.stamp(6);
---error ER_TABLEACCESS_DENIED_ERROR
-select db1_secret.db();
-
-#
-# Bug#2777 Stored procedure doesn't observe definer's rights
-#
-
-connection con1root;
---disable_warnings
-drop database if exists db2;
---enable_warnings
-create database db2;
-
-use db2;
-
-create table t2 (s1 int);
-insert into t2 values (0);
-
-grant usage on db2.* to user1@localhost;
-grant select on db2.* to user1@localhost;
-create user user2@localhost;
-grant usage on db2.* to user2@localhost;
-grant select,insert,update,delete,create routine on db2.* to user2@localhost;
-grant create routine on db2.* to user1@localhost;
-flush privileges;
-
-connection con2user1;
-use db2;
-
-create procedure p () insert into t2 values (1);
-
-# Check that this doesn't work.
---error ER_TABLEACCESS_DENIED_ERROR
-call p();
-
-connect (con4user2,localhost,user2,,);
-
-connection con4user2;
-use db2;
-
-# This should not work, since p is executed with definer's (user1's) rights.
---error ER_PROCACCESS_DENIED_ERROR
-call p();
-select * from t2;
-
-create procedure q () insert into t2 values (2);
-
-call q();
-select * from t2;
-
-connection con1root;
-grant usage on procedure db2.q to user2@localhost with grant option;
-
-connection con4user2;
-grant execute on procedure db2.q to user1@localhost;
-
-connection con2user1;
-use db2;
-
-# This should work
-call q();
-select * from t2;
-
-#
-# Bug#6030 Stored procedure has no appropriate DROP privilege
-# (or ALTER for that matter)
-
-# still connection con2user1 in db2
-
-# This should work:
-alter procedure p modifies sql data;
-drop procedure p;
-
-# This should NOT work
---error ER_PROCACCESS_DENIED_ERROR
-alter procedure q modifies sql data;
---error ER_PROCACCESS_DENIED_ERROR
-drop procedure q;
-
-connection con1root;
-use db2;
-# But root always can
-alter procedure q modifies sql data;
-drop procedure q;
-
-
-# Clean up
-#Still connection con1root;
-disconnect con2user1;
-disconnect con3anon;
-disconnect con4user2;
-use test;
-select type,db,name from mysql.proc where db like 'db%';
-drop database db1_secret;
-drop database db2;
-# Make sure the routines are gone
-select type,db,name from mysql.proc where db like 'db%';
-# Get rid of the users
-delete from mysql.user where user='user1' or user='user2';
-delete from mysql.user where user='' and host='%';
-# And any routine privileges
-delete from mysql.procs_priv where user='user1' or user='user2';
-# Delete the grants to user ''@'%' that was created above
-delete from mysql.procs_priv where user='' and host='%';
-delete from mysql.db where user='user2';
-flush privileges;
-#
-# Test the new security acls
-#
-create user usera@localhost;
-grant usage on *.* to usera@localhost;
-create user userb@localhost;
-grant usage on *.* to userb@localhost;
-create user userc@localhost;
-grant usage on *.* to userc@localhost;
-create database sptest;
-create table t1 ( u varchar(64), i int );
-create procedure sptest.p1(i int) insert into test.t1 values (user(), i);
-grant insert on t1 to usera@localhost;
-grant execute on procedure sptest.p1 to usera@localhost;
-show grants for usera@localhost;
-grant execute on procedure sptest.p1 to userc@localhost with grant option;
-show grants for userc@localhost;
-
-connect (con2usera,localhost,usera,,);
-connect (con3userb,localhost,userb,,);
-connect (con4userc,localhost,userc,,);
-
-connection con2usera;
-call sptest.p1(1);
---error ER_PROCACCESS_DENIED_ERROR
-grant execute on procedure sptest.p1 to userb@localhost;
---error ER_PROCACCESS_DENIED_ERROR
-drop procedure sptest.p1;
-
-connection con3userb;
---error ER_PROCACCESS_DENIED_ERROR
-call sptest.p1(2);
---error ER_PROCACCESS_DENIED_ERROR
-grant execute on procedure sptest.p1 to userb@localhost;
---error ER_PROCACCESS_DENIED_ERROR
-drop procedure sptest.p1;
-
-connection con4userc;
-call sptest.p1(3);
-grant execute on procedure sptest.p1 to userb@localhost;
---error ER_PROCACCESS_DENIED_ERROR
-drop procedure sptest.p1;
-
-connection con3userb;
-call sptest.p1(4);
---error ER_PROCACCESS_DENIED_ERROR
-grant execute on procedure sptest.p1 to userb@localhost;
---error ER_PROCACCESS_DENIED_ERROR
-drop procedure sptest.p1;
-
-connection con1root;
-select * from t1;
-
-grant all privileges on procedure sptest.p1 to userc@localhost;
-show grants for userc@localhost;
-show grants for userb@localhost;
-
-connection con4userc;
-revoke all privileges on procedure sptest.p1 from userb@localhost;
-
-connection con1root;
-show grants for userb@localhost;
-
-#cleanup
-disconnect con4userc;
-disconnect con3userb;
-disconnect con2usera;
-use test;
-drop database sptest;
-delete from mysql.user where user='usera' or user='userb' or user='userc';
-delete from mysql.procs_priv where user='usera' or user='userb' or user='userc';
-delete from mysql.tables_priv where user='usera';
-flush privileges;
-drop table t1;
-
-#
-# Bug#9503 reseting correct parameters of thread after error in SP function
-#
-connect (root,localhost,root,,test);
-connection root;
-
---disable_warnings
-drop function if exists bug_9503;
-drop user if exists user1@localhost;
---enable_warnings
-delimiter //;
-create database mysqltest//
-use mysqltest//
-create table t1 (s1 int)//
-create user user1@localhost//
-grant select on t1 to user1@localhost//
-create function bug_9503 () returns int sql security invoker begin declare v int;
-select min(s1) into v from t1; return v; end//
-delimiter ;//
-
-connect (user1,localhost,user1,,test);
-connection user1;
-use mysqltest;
--- error ER_PROCACCESS_DENIED_ERROR
-select bug_9503();
-
-connection root;
-grant execute on function bug_9503 to user1@localhost;
-
-connection user1;
-do 1;
-use test;
-
-disconnect user1;
-connection root;
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1@localhost;
-drop function bug_9503;
-use test;
-drop database mysqltest;
-connection default;
-disconnect root;
-
-#
-# correct value from current_user() in function run from "security definer"
-# (Bug#7291 Stored procedures: wrong CURRENT_USER value)
-#
-connection con1root;
-use test;
-
-select current_user();
-select user();
-create procedure bug7291_0 () sql security invoker select current_user(), user();
-create procedure bug7291_1 () sql security definer call bug7291_0();
-create procedure bug7291_2 () sql security invoker call bug7291_0();
-grant execute on procedure bug7291_0 to user1@localhost;
-grant execute on procedure bug7291_1 to user1@localhost;
-grant execute on procedure bug7291_2 to user1@localhost;
-
-connect (user1,localhost,user1,,);
-connection user1;
-
-call bug7291_2();
-call bug7291_1();
-
-connection con1root;
-drop procedure bug7291_1;
-drop procedure bug7291_2;
-drop procedure bug7291_0;
-disconnect user1;
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1@localhost;
-drop user user1@localhost;
-
-#
-# Bug#12318 Wrong error message when accessing an inaccessible stored
-# procedure in another database when the current database is
-# information_schema.
-#
-
---disable_warnings
-drop database if exists mysqltest_1;
---enable_warnings
-
-create database mysqltest_1;
-delimiter //;
-create procedure mysqltest_1.p1()
-begin
- select 1 from dual;
-end//
-delimiter ;//
-
-create user mysqltest_1@localhost;
-grant usage on *.* to mysqltest_1@localhost;
-
-connect (n1,localhost,mysqltest_1,,information_schema,$MASTER_MYPORT,$MASTER_MYSOCK);
-connection n1;
---error ER_PROCACCESS_DENIED_ERROR
-call mysqltest_1.p1();
-disconnect n1;
-# Test also without a current database
-connect (n2,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,$MASTER_MYSOCK);
-connection n2;
---error ER_PROCACCESS_DENIED_ERROR
-call mysqltest_1.p1();
-disconnect n2;
-
-connection default;
-
-drop procedure mysqltest_1.p1;
-drop database mysqltest_1;
-
-revoke usage on *.* from mysqltest_1@localhost;
-drop user mysqltest_1@localhost;
-
-#
-# Bug#12812 create view calling a function works without execute right
-# on function
-delimiter |;
---disable_warnings
-drop function if exists bug12812|
---enable_warnings
-create function bug12812() returns char(2)
-begin
- return 'ok';
-end;
-create user user_bug12812@localhost IDENTIFIED BY 'ABC'|
---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
-connect (test_user_12812,localhost,user_bug12812,ABC,test)|
---error ER_PROCACCESS_DENIED_ERROR
-SELECT test.bug12812()|
---error ER_PROCACCESS_DENIED_ERROR
-CREATE VIEW v1 AS SELECT test.bug12812()|
-# Cleanup
-connection default|
-disconnect test_user_12812|
-DROP USER user_bug12812@localhost|
-drop function bug12812|
-delimiter ;|
-
-
-#
-# Bug#14834 Server denies to execute Stored Procedure
-#
-# The problem here was with '_' in the database name.
-#
-create database db_bug14834;
-
-create user user1_bug14834@localhost identified by '';
-# The exact name of the database (no wildcard)
-grant all on `db\_bug14834`.* to user1_bug14834@localhost;
-
-create user user2_bug14834@localhost identified by '';
-# The exact name of the database (no wildcard)
-grant all on `db\_bug14834`.* to user2_bug14834@localhost;
-
-create user user3_bug14834@localhost identified by '';
-# Wildcards in the database name
-grant all on `db__ug14834`.* to user3_bug14834@localhost;
-
-connect (user1_bug14834,localhost,user1_bug14834,,db_bug14834);
-# Create the procedure and check that we can call it
-create procedure p_bug14834() select user(), current_user();
-call p_bug14834();
-
-connect (user2_bug14834,localhost,user2_bug14834,,db_bug14834);
-# This didn't work before
-call p_bug14834();
-
-connect (user3_bug14834,localhost,user3_bug14834,,db_bug14834);
-# Should also work
-call p_bug14834();
-
-# Cleanup
-connection default;
-disconnect user1_bug14834;
-disconnect user2_bug14834;
-disconnect user3_bug14834;
-drop user user1_bug14834@localhost;
-drop user user2_bug14834@localhost;
-drop user user3_bug14834@localhost;
-drop database db_bug14834;
-
-
-#
-# Bug#14533 'desc tbl' in stored procedure causes error
-# ER_TABLEACCESS_DENIED_ERROR
-#
-create database db_bug14533;
-use db_bug14533;
-create table t1 (id int);
-create user user_bug14533@localhost identified by '';
-
-create procedure bug14533_1()
- sql security definer
- desc db_bug14533.t1;
-
-create procedure bug14533_2()
- sql security definer
- select * from db_bug14533.t1;
-
-grant execute on procedure db_bug14533.bug14533_1 to user_bug14533@localhost;
-grant execute on procedure db_bug14533.bug14533_2 to user_bug14533@localhost;
-
-connect (user_bug14533,localhost,user_bug14533,,test);
-
-# These should work
-call db_bug14533.bug14533_1();
-call db_bug14533.bug14533_2();
-
-# For reference, these should not work
---error ER_TABLEACCESS_DENIED_ERROR
-desc db_bug14533.t1;
---error ER_TABLEACCESS_DENIED_ERROR
-select * from db_bug14533.t1;
-
-# Cleanup
-connection default;
-disconnect user_bug14533;
-drop user user_bug14533@localhost;
-drop database db_bug14533;
-
-
-#
-# WL#2897 Complete definer support in the stored routines.
-#
-# The following cases are tested:
-# 1. check that if DEFINER-clause is not explicitly specified, stored routines
-# are created with CURRENT_USER privileges;
-# 2. check that if DEFINER-clause specifies non-current user, SUPER privilege
-# is required to create a stored routine;
-# 3. check that if DEFINER-clause specifies non-existent user, a warning is
-# emitted.
-# 4. check that SHOW CREATE PROCEDURE | FUNCTION works correctly;
-#
-# The following cases are tested in other test suites:
-# - check that mysqldump dumps new attribute correctly;
-# - check that slave replicates CREATE-statements with explicitly specified
-# DEFINER correctly.
-#
-
-# Setup the environment.
-
---connection con1root
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest;
---enable_warnings
-
-CREATE DATABASE mysqltest;
-
-CREATE USER mysqltest_1@localhost;
-GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_1@localhost;
-
-CREATE USER mysqltest_2@localhost;
-GRANT SUPER ON *.* TO mysqltest_2@localhost;
-GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;
-
---connect (mysqltest_2_con,localhost,mysqltest_2,,mysqltest)
---connect (mysqltest_1_con,localhost,mysqltest_1,,mysqltest)
-
-# test case (1).
-
---connection mysqltest_2_con
-
-USE mysqltest;
-
-CREATE PROCEDURE wl2897_p1() SELECT 1;
-
-CREATE FUNCTION wl2897_f1() RETURNS INT RETURN 1;
-
-# test case (2).
-
---connection mysqltest_1_con
-
-USE mysqltest;
-
---error ER_SPECIFIC_ACCESS_DENIED_ERROR
-CREATE DEFINER=root@localhost PROCEDURE wl2897_p2() SELECT 2;
-
---error ER_SPECIFIC_ACCESS_DENIED_ERROR
-CREATE DEFINER=root@localhost FUNCTION wl2897_f2() RETURNS INT RETURN 2;
-
-# test case (3).
-
---connection mysqltest_2_con
-
-use mysqltest;
-
-CREATE DEFINER='a @ b @ c'@localhost PROCEDURE wl2897_p3() SELECT 3;
-
-CREATE DEFINER='a @ b @ c'@localhost FUNCTION wl2897_f3() RETURNS INT RETURN 3;
-
-# test case (4).
-
---connection con1root
-
-USE mysqltest;
-
-SHOW CREATE PROCEDURE wl2897_p1;
-SHOW CREATE PROCEDURE wl2897_p3;
-
-SHOW CREATE FUNCTION wl2897_f1;
-SHOW CREATE FUNCTION wl2897_f3;
-
-# Cleanup.
-
-DROP USER mysqltest_1@localhost;
-DROP USER mysqltest_2@localhost;
-
-DROP DATABASE mysqltest;
-
---disconnect mysqltest_1_con
---disconnect mysqltest_2_con
-
-
-#
-# Bug#13198 SP executes if definer does not exist
-#
-
-# Prepare environment.
-
---connection con1root
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest;
---enable_warnings
-
-CREATE DATABASE mysqltest;
-
-CREATE USER mysqltest_1@localhost;
-GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_1@localhost;
-
-CREATE USER mysqltest_2@localhost;
-GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;
-
---connect (mysqltest_1_con,localhost,mysqltest_1,,mysqltest)
---connect (mysqltest_2_con,localhost,mysqltest_2,,mysqltest)
-
-# Create a procedure/function under u1.
-
---connection mysqltest_1_con
-
-USE mysqltest;
-
-CREATE PROCEDURE bug13198_p1()
- SELECT 1;
-
-CREATE FUNCTION bug13198_f1() RETURNS INT
- RETURN 1;
-
-CALL bug13198_p1();
-
-SELECT bug13198_f1();
-
-# Check that u2 can call the procedure/function.
-
---connection mysqltest_2_con
-
-USE mysqltest;
-
-CALL bug13198_p1();
-
-SELECT bug13198_f1();
-
-# Drop user u1 (definer of the object);
-
---connection con1root
-
---disconnect mysqltest_1_con
-
-DROP USER mysqltest_1@localhost;
-
-# Check that u2 can not call the procedure/function.
-
---connection mysqltest_2_con
-
-USE mysqltest;
-
---error ER_NO_SUCH_USER
-CALL bug13198_p1();
-
---error ER_NO_SUCH_USER
-SELECT bug13198_f1();
-
-# Cleanup.
-
---connection con1root
-
---disconnect mysqltest_2_con
-
-DROP USER mysqltest_2@localhost;
-
-DROP DATABASE mysqltest;
-
-#
-# Bug#19857 When a user with CREATE ROUTINE priv creates a routine,
-# it results in NULL p/w
-#
-
-# Can't test with embedded server that doesn't support grants
-
-GRANT USAGE ON *.* TO user19857@localhost IDENTIFIED BY 'meow';
-GRANT SELECT, INSERT, UPDATE, DELETE, CREATE ROUTINE, ALTER ROUTINE ON test.* TO
-user19857@localhost;
-SELECT Host,User,Password FROM mysql.user WHERE User='user19857';
-
---connect (mysqltest_2_con,localhost,user19857,meow,test)
---connection mysqltest_2_con
-
-USE test;
-
-DELIMITER //;
- CREATE PROCEDURE sp19857() DETERMINISTIC
- BEGIN
- DECLARE a INT;
- SET a=1;
- SELECT a;
- END //
-DELIMITER ;//
-
-SHOW CREATE PROCEDURE test.sp19857;
-
---disconnect mysqltest_2_con
---connect (mysqltest_2_con,localhost,user19857,meow,test)
---connection mysqltest_2_con
-
-DROP PROCEDURE IF EXISTS test.sp19857;
-
---connection con1root
-
---disconnect mysqltest_2_con
-
-SELECT Host,User,Password FROM mysql.user WHERE User='user19857';
-
-DROP USER user19857@localhost;
-
---disconnect con1root
---connection default
-use test;
-
-#
-# Bug#18630 Arguments of suid routine calculated in wrong security context
-#
-# Arguments of suid routines were calculated in definer's security
-# context instead of caller's context thus creating security hole.
-#
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP VIEW IF EXISTS v1;
-DROP FUNCTION IF EXISTS f_suid;
-DROP PROCEDURE IF EXISTS p_suid;
-DROP FUNCTION IF EXISTS f_evil;
---enable_warnings
-DELETE FROM mysql.user WHERE user LIKE 'mysqltest\_%';
-DELETE FROM mysql.db WHERE user LIKE 'mysqltest\_%';
-DELETE FROM mysql.tables_priv WHERE user LIKE 'mysqltest\_%';
-DELETE FROM mysql.columns_priv WHERE user LIKE 'mysqltest\_%';
-FLUSH PRIVILEGES;
-
-CREATE TABLE t1 (i INT);
-CREATE FUNCTION f_suid(i INT) RETURNS INT SQL SECURITY DEFINER RETURN 0;
-CREATE PROCEDURE p_suid(IN i INT) SQL SECURITY DEFINER SET @c:= 0;
-
-CREATE USER mysqltest_u1@localhost;
-# Thanks to this grant statement privileges of anonymous users on
-# 'test' database are not applicable for mysqltest_u1@localhost.
-GRANT EXECUTE ON test.* TO mysqltest_u1@localhost;
-
-delimiter |;
-CREATE DEFINER=mysqltest_u1@localhost FUNCTION f_evil () RETURNS INT
- SQL SECURITY INVOKER
-BEGIN
- SET @a:= CURRENT_USER();
- SET @b:= (SELECT COUNT(*) FROM t1);
- RETURN @b;
-END|
-delimiter ;|
-
-CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT f_evil();
-
-connect (conn1, localhost, mysqltest_u1,,);
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT COUNT(*) FROM t1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT f_evil();
-SELECT @a, @b;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT f_suid(f_evil());
-SELECT @a, @b;
-
---error ER_TABLEACCESS_DENIED_ERROR
-CALL p_suid(f_evil());
-SELECT @a, @b;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v1;
-SELECT @a, @b;
-
-disconnect conn1;
-connection default;
-
-DROP VIEW v1;
-DROP FUNCTION f_evil;
-DROP USER mysqltest_u1@localhost;
-DROP PROCEDURE p_suid;
-DROP FUNCTION f_suid;
-DROP TABLE t1;
-
---echo #
---echo # Bug #48872 : Privileges for stored functions ignored if function name
---echo # is mixed case
---echo #
-
-CREATE DATABASE B48872;
-USE B48872;
-CREATE TABLE `TestTab` (id INT);
-INSERT INTO `TestTab` VALUES (1),(2);
-CREATE FUNCTION `f_Test`() RETURNS INT RETURN 123;
-CREATE FUNCTION `f_Test_denied`() RETURNS INT RETURN 123;
-CREATE USER 'tester';
-CREATE USER 'Tester';
-GRANT SELECT ON TABLE `TestTab` TO 'tester';
-GRANT EXECUTE ON FUNCTION `f_Test` TO 'tester';
-GRANT EXECUTE ON FUNCTION `f_Test_denied` TO 'Tester';
-
-SELECT f_Test();
-SELECT * FROM TestTab;
-
-CONNECT (con_tester,localhost,tester,,B48872);
-CONNECT (con_tester_denied,localhost,Tester,,B48872);
-CONNECTION con_tester;
-
-SELECT * FROM TestTab;
-SELECT `f_Test`();
-SELECT `F_TEST`();
-SELECT f_Test();
-SELECT F_TEST();
-
-CONNECTION con_tester_denied;
-
---disable_result_log
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM TestTab;
---error ER_PROCACCESS_DENIED_ERROR
-SELECT `f_Test`();
---error ER_PROCACCESS_DENIED_ERROR
-SELECT `F_TEST`();
---error ER_PROCACCESS_DENIED_ERROR
-SELECT f_Test();
---error ER_PROCACCESS_DENIED_ERROR
-SELECT F_TEST();
---enable_result_log
-SELECT `f_Test_denied`();
-SELECT `F_TEST_DENIED`();
-
-CONNECTION default;
-DISCONNECT con_tester;
-DISCONNECT con_tester_denied;
-DROP TABLE `TestTab`;
-DROP FUNCTION `f_Test`;
-DROP FUNCTION `f_Test_denied`;
-
-USE test;
-DROP USER 'tester';
-DROP USER 'Tester';
-DROP DATABASE B48872;
-
---echo End of 5.0 tests.
-
-
---echo #
---echo # Test for bug#57061 "User without privilege on routine can discover
---echo # its existence."
---echo #
---disable_warnings
-drop database if exists mysqltest_db;
---enable_warnings
-create database mysqltest_db;
---echo # Create user with no privileges on mysqltest_db database.
-create user bug57061_user@localhost;
-create function mysqltest_db.f1() returns int return 0;
-create procedure mysqltest_db.p1() begin end;
-connect (conn1, localhost, bug57061_user,,);
---echo # Attempt to drop routine on which user doesn't have privileges
---echo # should result in the same 'access denied' type of error whether
---echo # routine exists or not.
---error ER_PROCACCESS_DENIED_ERROR
-drop function if exists mysqltest_db.f_does_not_exist;
---error ER_PROCACCESS_DENIED_ERROR
-drop procedure if exists mysqltest_db.p_does_not_exist;
---error ER_PROCACCESS_DENIED_ERROR
-drop function if exists mysqltest_db.f1;
---error ER_PROCACCESS_DENIED_ERROR
-drop procedure if exists mysqltest_db.p1;
-connection default;
-disconnect conn1;
-drop user bug57061_user@localhost;
-drop database mysqltest_db;
-
-
---echo #
---echo # Bug#11882603 SELECT_ACL ON ANY COLUMN IN MYSQL.PROC ALLOWS TO SEE
---echo # DEFINITION OF ANY ROUTINE.
---echo #
-
---disable_warnings
-DROP DATABASE IF EXISTS db1;
---enable_warnings
-
-CREATE DATABASE db1;
-CREATE PROCEDURE db1.p1() SELECT 1;
-CREATE USER user2@localhost IDENTIFIED BY '';
-GRANT SELECT(db) ON mysql.proc TO user2@localhost;
-
-connect (con2, localhost, user2);
---echo # The statement below before disclosed info from body_utf8 column.
---error ER_SP_DOES_NOT_EXIST
-SHOW CREATE PROCEDURE db1.p1;
-
---echo # Check that SHOW works with SELECT grant on whole table
-connection default;
-GRANT SELECT ON mysql.proc TO user2@localhost;
-
-connection con2;
---echo # This should work
-SHOW CREATE PROCEDURE db1.p1;
-
-connection default;
-disconnect con2;
-DROP USER user2@localhost;
-DROP DATABASE db1;
-
---echo #
---echo # Test for bug#12602983 - User without privilege on routine can discover
---echo # its existence by executing "select non_existing_func();" or by
---echo # "call non_existing_proc()";
---echo #
---disable_warnings
-drop database if exists mysqltest_db;
---enable_warnings
-create database mysqltest_db;
-create function mysqltest_db.f1() returns int return 0;
-create procedure mysqltest_db.p1() begin end;
-
---echo # Create user with no privileges on mysqltest_db database.
-create user bug12602983_user@localhost;
-
-connect (conn1, localhost, bug12602983_user,,);
-
---echo # Attempt to execute routine on which user doesn't have privileges
---echo # should result in the same 'access denied' error whether
---echo # routine exists or not.
---error ER_PROCACCESS_DENIED_ERROR
-select mysqltest_db.f_does_not_exist();
---error ER_PROCACCESS_DENIED_ERROR
-call mysqltest_db.p_does_not_exist();
-
---error ER_PROCACCESS_DENIED_ERROR
-select mysqltest_db.f1();
---error ER_PROCACCESS_DENIED_ERROR
-call mysqltest_db.p1();
-
---error ER_PROCACCESS_DENIED_ERROR
-create view bug12602983_v1 as select mysqltest_db.f_does_not_exist();
---error ER_PROCACCESS_DENIED_ERROR
-create view bug12602983_v1 as select mysqltest_db.f1();
-
-connection default;
-disconnect conn1;
-drop user bug12602983_user@localhost;
-drop database mysqltest_db;
-
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
-
-set password=password('foobar');
-create procedure sp1() select 1;
-show grants;
-grant execute on procedure sp1 to current_user() identified by 'barfoo';
-show grants;
-drop procedure sp1;
-set password='';
-
---echo #
---echo # MDEV-13396 Unexpected "alter routine comand defined" during CREATE OR REPLACE PROCEDURE
---echo #
-
-CREATE DATABASE u1;
-DELIMITER $$;
-CREATE PROCEDURE u1.p1() BEGIN SELECT 1; END; $$
-CREATE FUNCTION u1.f1() RETURNS INT BEGIN RETURN 1; END; $$
-DELIMITER ;$$
-
-CREATE USER u1@localhost;
-GRANT CREATE ROUTINE ON u1.* TO u1@localhost;
-GRANT ALTER ROUTINE ON FUNCTION u1.f1 TO u1@localhost;
-GRANT ALTER ROUTINE ON PROCEDURE u1.p1 TO u1@localhost;
-
-connect (u1, localhost, u1,,);
-USE u1;
-DELIMITER $$;
-CREATE OR REPLACE FUNCTION f1() RETURNS INT BEGIN RETURN 2; END; $$
-CREATE OR REPLACE PROCEDURE p1() BEGIN SELECT 1; END; $$
-DELIMITER ;$$
-
-disconnect u1;
-connection default;
-DROP DATABASE u1;
-DROP USER u1@localhost;
diff --git a/mysql-test/t/sp-threads.test b/mysql-test/t/sp-threads.test
deleted file mode 100644
index 7a6d1258331..00000000000
--- a/mysql-test/t/sp-threads.test
+++ /dev/null
@@ -1,201 +0,0 @@
-# This test should work in embedded server after mysqltest is fixed
--- source include/not_embedded.inc
-#
-# Testing stored procedures with multiple connections,
-# except security/privilege tests, they go to sp-security.test
-#
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-connect (con1root,localhost,root,,);
-connect (con2root,localhost,root,,);
-connect (con3root,localhost,root,,);
-
-connection con1root;
-use test;
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (s1 int, s2 int, s3 int);
-
-delimiter //;
-create procedure bug4934()
-begin
- insert into t1 values (1,0,1);
-end//
-delimiter ;//
-
-
-connection con2root;
-use test;
-
-call bug4934();
-select * from t1;
-
-
-connection con1root;
-
-drop table t1;
-create table t1 (s1 int, s2 int, s3 int);
-
-drop procedure bug4934;
-delimiter //;
-create procedure bug4934()
-begin
-end//
-delimiter ;//
-
-
-connection con2root;
-
-select * from t1;
-call bug4934();
-select * from t1;
-
-connection con1root;
-
-drop table t1;
-drop procedure bug4934;
-
-
-#
-# Bug#9486 Can't perform multi-update in stored procedure
-#
---disable_warnings
-drop procedure if exists bug9486;
-drop table if exists t1, t2;
---enable_warnings
-create table t1 (id1 int, val int);
-create table t2 (id2 int);
-
-create procedure bug9486()
- update t1, t2 set val= 1 where id1=id2;
-call bug9486();
-# Let us check that SP invocation requires write lock for t2.
-connection con2root;
-lock tables t2 write;
-connection con1root;
-let $con1root_id=`SELECT CONNECTION_ID()`;
-send call bug9486();
-connection con2root;
-# There should be call statement in locked state.
-let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist WHERE
- id=$con1root_id AND state='Waiting for table metadata lock';
---source include/wait_condition.inc
---replace_result $con1root_id con1root_id
-eval SELECT state,info FROM information_schema.processlist WHERE id=$con1root_id;
-unlock tables;
-connection con1root;
-reap;
-
-drop procedure bug9486;
-drop table t1, t2;
-
-
-#
-# Bug#11158 Can't perform multi-delete in stored procedure
-#
---disable_warnings
-drop procedure if exists bug11158;
---enable_warnings
-create procedure bug11158() delete t1 from t1, t2 where t1.id = t2.id;
-create table t1 (id int, j int);
-insert into t1 values (1, 1), (2, 2);
-create table t2 (id int);
-insert into t2 values (1);
-# Procedure should work and cause proper effect (delete only first row)
-call bug11158();
-select * from t1;
-# Also let us test that we obtain only read (and thus non exclusive) lock
-# for table from which we are not going to delete rows.
-connection con2root;
-lock tables t2 read;
-connection con1root;
-call bug11158();
-connection con2root;
-unlock tables;
-connection con1root;
-# Clean-up
-drop procedure bug11158;
-drop table t1, t2;
-
-
-#
-# Bug#11554 Server crashes on statement indirectly using non-cached function
-#
---disable_warnings
-drop function if exists bug11554;
-drop view if exists v1;
---enable_warnings
-create table t1 (i int);
-create function bug11554 () returns int return 1;
-create view v1 as select bug11554() as f;
-connection con2root;
-# This should not crash server
-insert into t1 (select f from v1);
-# Clean-up
-connection con1root;
-drop function bug11554;
-drop table t1;
-drop view v1;
-
-
-# Bug#12228 Crash happens during calling specific SP in multithread environment
---disable_warnings
-drop procedure if exists p1;
-drop procedure if exists p2;
---enable_warnings
-
-connection con1root;
-delimiter |;
-create table t1 (s1 int)|
-create procedure p1() select * from t1|
-create procedure p2()
-begin
- insert into t1 values (1);
- call p1();
- select * from t1;
-end|
-delimiter ;|
-
-connection con2root;
-use test;
-lock table t1 write;
-
-connection con1root;
-send call p2();
-
-connection con3root;
-use test;
-drop procedure p1;
-create procedure p1() select * from t1;
-
-connection con2root;
-unlock tables;
-
-connection con1root;
-# Crash will be here if we hit Bug#12228
-reap;
-
-drop procedure p1;
-drop procedure p2;
-drop table t1;
-
-
-#
-# Bug#NNNN New bug synopsis
-#
-#--disable_warnings
-#drop procedure if exists bugNNNN;
-#--enable_warnings
-#create procedure bugNNNN...
-
-connection default;
-disconnect con1root;
-disconnect con2root;
-disconnect con3root;
-
-# Wait till we reached the initial number of concurrent sessions
---source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/sp-ucs2.test b/mysql-test/t/sp-ucs2.test
deleted file mode 100644
index 3532169e5a1..00000000000
--- a/mysql-test/t/sp-ucs2.test
+++ /dev/null
@@ -1,177 +0,0 @@
--- source include/have_ucs2.inc
-
-delimiter |;
-
-#
-# BUG#17615: problem with character set
-#
---disable_warnings
-drop function if exists bug17615|
---enable_warnings
-
-create table t3 (a varchar(256) unicode)|
-
-create function bug17615() returns varchar(256) unicode
-begin
- declare tmp_res varchar(256) unicode;
- set tmp_res= 'foo string';
- return tmp_res;
-end|
-
-insert into t3 values(bug17615())|
-select * from t3|
-
-drop function bug17615|
-drop table t3|
-
-
-#
-# Testing COLLATE clause in
-# - IN parameter
-# - RETURNS
-# - DELCARE
-#
-
-CREATE FUNCTION f(f1 VARCHAR(64) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci)
- RETURNS VARCHAR(64) CHARACTER SET ucs2 COLLATE ucs2_danish_ci
-BEGIN
- DECLARE f2 VARCHAR(64) CHARACTER SET ucs2 COLLATE ucs2_swedish_ci;
- DECLARE f3 VARCHAR(64) CHARACTER SET ucs2 COLLATE ucs2_bin;
- SET f1= concat(collation(f1), ' ', collation(f2), ' ', collation(f3));
- RETURN f1;
-END|
-SELECT f('a')|
-SELECT collation(f('a'))|
-DROP FUNCTION f|
-
-#
-# Testing keywords UNICODE + BINARY
-#
-CREATE FUNCTION f()
- RETURNS VARCHAR(64) UNICODE BINARY
-BEGIN
- RETURN '';
-END|
-SHOW CREATE FUNCTION f;
-DROP FUNCTION f;
-
-CREATE FUNCTION f()
- RETURNS VARCHAR(64) BINARY UNICODE
-BEGIN
- RETURN '';
-END|
-SHOW CREATE FUNCTION f;
-DROP FUNCTION f;
-
-
-#
-# Testing keywords ASCII + BINARY
-#
-CREATE FUNCTION f()
- RETURNS VARCHAR(64) ASCII BINARY
-BEGIN
- RETURN '';
-END|
-SHOW CREATE FUNCTION f;
-DROP FUNCTION f;
-
-CREATE FUNCTION f()
- RETURNS VARCHAR(64) BINARY ASCII
-BEGIN
- RETURN '';
-END|
-SHOW CREATE FUNCTION f;
-DROP FUNCTION f;
-
-#
-# Testing COLLATE in OUT parameter
-#
-
-CREATE PROCEDURE p1(IN f1 VARCHAR(64) CHARACTER SET ucs2 COLLATE ucs2_czech_ci,
- OUT f2 VARCHAR(64) CHARACTER SET ucs2 COLLATE ucs2_polish_ci)
-BEGIN
- SET f2= f1;
- SET f2= concat(collation(f1), ' ', collation(f2));
-END|
-
-
-CREATE FUNCTION f1()
- RETURNS VARCHAR(64) CHARACTER SET ucs2
-BEGIN
- DECLARE f1 VARCHAR(64) CHARACTER SET ucs2;
- DECLARE f2 VARCHAR(64) CHARACTER SET ucs2;
- SET f1='str';
- CALL p1(f1, f2);
- RETURN f2;
-END|
-
-
-SELECT f1()|
-DROP PROCEDURE p1|
-DROP FUNCTION f1|
-
-
-#
-# COLLATE with no CHARACTER SET in IN param
-#
---error ER_COLLATION_CHARSET_MISMATCH
-CREATE FUNCTION f(f1 VARCHAR(64) COLLATE ucs2_unicode_ci)
- RETURNS VARCHAR(64) CHARACTER SET ucs2
-BEGIN
- RETURN 'str';
-END|
-
-
-#
-# COLLATE with no CHARACTER SET in RETURNS
-#
---error ER_COLLATION_CHARSET_MISMATCH
-CREATE FUNCTION f(f1 VARCHAR(64) CHARACTER SET ucs2)
- RETURNS VARCHAR(64) COLLATE ucs2_unicode_ci
-BEGIN
- RETURN 'str';
-END|
-
-
-#
-# COLLATE with no CHARACTER SET in DECLARE
-#
---error ER_COLLATION_CHARSET_MISMATCH
-CREATE FUNCTION f(f1 VARCHAR(64) CHARACTER SET ucs2)
- RETURNS VARCHAR(64) CHARACTER SET ucs2
-BEGIN
- DECLARE f2 VARCHAR(64) COLLATE ucs2_unicode_ci;
- RETURN 'str';
-END|
-
-
-delimiter ;|
-
-#
-# Bug#48766 SHOW CREATE FUNCTION returns extra data in return clause
-#
-SET NAMES utf8;
---disable_warnings
-DROP FUNCTION IF EXISTS bug48766;
---enable_warnings
-#
-# Test that Latin letters are not prepended with extra '\0'.
-#
-CREATE FUNCTION bug48766 ()
- RETURNS ENUM( 'w' ) CHARACTER SET ucs2
- RETURN 0;
-SHOW CREATE FUNCTION bug48766;
-SELECT DTD_IDENTIFIER FROM INFORMATION_SCHEMA.ROUTINES
-WHERE ROUTINE_NAME='bug48766';
-DROP FUNCTION bug48766;
-#
-# Test non-Latin characters
-#
-CREATE FUNCTION bug48766 ()
- RETURNS ENUM('а','б','в','г') CHARACTER SET ucs2
- RETURN 0;
-SHOW CREATE FUNCTION bug48766;
-SELECT DTD_IDENTIFIER FROM INFORMATION_SCHEMA.ROUTINES
-WHERE ROUTINE_NAME='bug48766';
-
-DROP FUNCTION bug48766;
diff --git a/mysql-test/t/sp-vars.test b/mysql-test/t/sp-vars.test
deleted file mode 100644
index 57d5563e609..00000000000
--- a/mysql-test/t/sp-vars.test
+++ /dev/null
@@ -1,1538 +0,0 @@
-###########################################################################
-#
-# Cleanup.
-#
-###########################################################################
-
---disable_warnings
-
-# Drop stored routines (if any) for general SP-vars test cases. These routines
-# are created in include/sp-vars.inc file.
-
-DROP PROCEDURE IF EXISTS sp_vars_check_dflt;
-DROP PROCEDURE IF EXISTS sp_vars_check_assignment;
-DROP FUNCTION IF EXISTS sp_vars_check_ret1;
-DROP FUNCTION IF EXISTS sp_vars_check_ret2;
-DROP FUNCTION IF EXISTS sp_vars_check_ret3;
-DROP FUNCTION IF EXISTS sp_vars_check_ret4;
-DROP FUNCTION IF EXISTS sp_vars_div_zero;
-
---enable_warnings
-
-###########################################################################
-#
-# Some general tests for SP-vars functionality.
-#
-###########################################################################
-
-# Create the procedure in ANSI mode. Check that all necessary warnings are
-# emitted properly.
-
-SET @@sql_mode = 'ansi';
-
---source include/sp-vars.inc
-
---echo
---echo ---------------------------------------------------------------
---echo Calling the routines, created in ANSI mode.
---echo ---------------------------------------------------------------
---echo
-
-CALL sp_vars_check_dflt();
-
-CALL sp_vars_check_assignment();
-
-SELECT sp_vars_check_ret1();
-
-SELECT sp_vars_check_ret2();
-
-SELECT sp_vars_check_ret3();
-
-SELECT sp_vars_check_ret4();
-
-SELECT sp_vars_div_zero();
-
-# Check that changing sql_mode after creating a store procedure does not
-# matter.
-
-SET @@sql_mode = 'traditional';
-
---echo
---echo ---------------------------------------------------------------
---echo Calling in TRADITIONAL mode the routines, created in ANSI mode.
---echo ---------------------------------------------------------------
---echo
-
-CALL sp_vars_check_dflt();
-
-CALL sp_vars_check_assignment();
-
-SELECT sp_vars_check_ret1();
-
-SELECT sp_vars_check_ret2();
-
-SELECT sp_vars_check_ret3();
-
-SELECT sp_vars_check_ret4();
-
-SELECT sp_vars_div_zero();
-
-# Create the procedure in TRADITIONAL mode. Check that error will be thrown on
-# execution.
-
-DROP PROCEDURE sp_vars_check_dflt;
-DROP PROCEDURE sp_vars_check_assignment;
-DROP FUNCTION sp_vars_check_ret1;
-DROP FUNCTION sp_vars_check_ret2;
-DROP FUNCTION sp_vars_check_ret3;
-DROP FUNCTION sp_vars_check_ret4;
-DROP FUNCTION sp_vars_div_zero;
-
---source include/sp-vars.inc
-
---echo
---echo ---------------------------------------------------------------
---echo Calling the routines, created in TRADITIONAL mode.
---echo ---------------------------------------------------------------
---echo
-
---error ER_WARN_DATA_OUT_OF_RANGE
-CALL sp_vars_check_dflt();
-
---error ER_WARN_DATA_OUT_OF_RANGE
-CALL sp_vars_check_assignment();
-
---error ER_WARN_DATA_OUT_OF_RANGE
-SELECT sp_vars_check_ret1();
-
---error ER_WARN_DATA_OUT_OF_RANGE
-SELECT sp_vars_check_ret2();
-
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-SELECT sp_vars_check_ret3();
-
-# TODO: Is it an error, that only a warning is emitted here? Check the same
-# behaviour with tables.
-
-SELECT sp_vars_check_ret4();
-
---error ER_DIVISION_BY_ZERO
-SELECT sp_vars_div_zero();
-
-SET @@sql_mode = 'ansi';
-
-#
-# Cleanup.
-#
-
-DROP PROCEDURE sp_vars_check_dflt;
-DROP PROCEDURE sp_vars_check_assignment;
-DROP FUNCTION sp_vars_check_ret1;
-DROP FUNCTION sp_vars_check_ret2;
-DROP FUNCTION sp_vars_check_ret3;
-DROP FUNCTION sp_vars_check_ret4;
-DROP FUNCTION sp_vars_div_zero;
-
-###########################################################################
-#
-# Tests for BIT data type.
-#
-###########################################################################
-
---echo
---echo ---------------------------------------------------------------
---echo BIT data type tests
---echo ---------------------------------------------------------------
---echo
-
-#
-# Prepare.
-#
-
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
---enable_warnings
-
-#
-# Test case.
-#
-
-delimiter |;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE v1 BIT;
- DECLARE v2 BIT(1);
- DECLARE v3 BIT(3) DEFAULT b'101';
- DECLARE v4 BIT(64) DEFAULT 0x5555555555555555;
- DECLARE v5 BIT(3);
- DECLARE v6 BIT(64);
- DECLARE v7 BIT(8) DEFAULT 128;
- DECLARE v8 BIT(8) DEFAULT '128';
- DECLARE v9 BIT(8) DEFAULT ' 128';
- DECLARE v10 BIT(8) DEFAULT 'x 128';
-
- SET v1 = v4;
- SET v2 = 0;
- SET v5 = v4; # check overflow
- SET v6 = v3; # check padding
-
- SELECT HEX(v1);
- SELECT HEX(v2);
- SELECT HEX(v3);
- SELECT HEX(v4);
- SELECT HEX(v5);
- SELECT HEX(v6);
- SELECT HEX(v7);
- SELECT HEX(v8);
- SELECT HEX(v9);
- SELECT HEX(v10);
-END|
-delimiter ;|
-
-CALL p1();
-
-#
-# Cleanup.
-#
-
-DROP PROCEDURE p1;
-
-###########################################################################
-#
-# Tests for CASE statements functionality:
-# - test for general functionality (scopes, nested cases, CASE in loops);
-# - test that if type of the CASE expression is changed on each iteration,
-# the execution will be correct.
-#
-###########################################################################
-
---echo
---echo ---------------------------------------------------------------
---echo CASE expression tests.
---echo ---------------------------------------------------------------
---echo
-
-#
-# Prepare.
-#
-
-DROP PROCEDURE IF EXISTS p1;
-DROP PROCEDURE IF EXISTS p2;
-DROP TABLE IF EXISTS t1;
-
-#
-# Test case.
-#
-
-CREATE TABLE t1(log_msg VARCHAR(1024));
-
-delimiter |;
-
-CREATE PROCEDURE p1(arg VARCHAR(255))
-BEGIN
- INSERT INTO t1 VALUES('p1: step1');
-
- CASE arg * 10
- WHEN 10 * 10 THEN
- INSERT INTO t1 VALUES('p1: case1: on 10');
- WHEN 10 * 10 + 10 * 10 THEN
- BEGIN
- CASE arg / 10
- WHEN 1 THEN
- INSERT INTO t1 VALUES('p1: case1: case2: on 1');
- WHEN 2 THEN
- BEGIN
- DECLARE i TINYINT DEFAULT 10;
-
- WHILE i > 0 DO
- INSERT INTO t1 VALUES(CONCAT('p1: case1: case2: loop: i: ', i));
-
- CASE MOD(i, 2)
- WHEN 0 THEN
- INSERT INTO t1 VALUES('p1: case1: case2: loop: i is even');
- WHEN 1 THEN
- INSERT INTO t1 VALUES('p1: case1: case2: loop: i is odd');
- ELSE
- INSERT INTO t1 VALUES('p1: case1: case2: loop: ERROR');
- END CASE;
-
- SET i = i - 1;
- END WHILE;
- END;
- ELSE
- INSERT INTO t1 VALUES('p1: case1: case2: ERROR');
- END CASE;
-
- CASE arg
- WHEN 10 THEN
- INSERT INTO t1 VALUES('p1: case1: case3: on 10');
- WHEN 20 THEN
- INSERT INTO t1 VALUES('p1: case1: case3: on 20');
- ELSE
- INSERT INTO t1 VALUES('p1: case1: case3: ERROR');
- END CASE;
- END;
- ELSE
- INSERT INTO t1 VALUES('p1: case1: ERROR');
- END CASE;
-
- CASE arg * 10
- WHEN 10 * 10 THEN
- INSERT INTO t1 VALUES('p1: case4: on 10');
- WHEN 10 * 10 + 10 * 10 THEN
- BEGIN
- CASE arg / 10
- WHEN 1 THEN
- INSERT INTO t1 VALUES('p1: case4: case5: on 1');
- WHEN 2 THEN
- BEGIN
- DECLARE i TINYINT DEFAULT 10;
-
- WHILE i > 0 DO
- INSERT INTO t1 VALUES(CONCAT('p1: case4: case5: loop: i: ', i));
-
- CASE MOD(i, 2)
- WHEN 0 THEN
- INSERT INTO t1 VALUES('p1: case4: case5: loop: i is even');
- WHEN 1 THEN
- INSERT INTO t1 VALUES('p1: case4: case5: loop: i is odd');
- ELSE
- INSERT INTO t1 VALUES('p1: case4: case5: loop: ERROR');
- END CASE;
-
- SET i = i - 1;
- END WHILE;
- END;
- ELSE
- INSERT INTO t1 VALUES('p1: case4: case5: ERROR');
- END CASE;
-
- CASE arg
- WHEN 10 THEN
- INSERT INTO t1 VALUES('p1: case4: case6: on 10');
- WHEN 20 THEN
- INSERT INTO t1 VALUES('p1: case4: case6: on 20');
- ELSE
- INSERT INTO t1 VALUES('p1: case4: case6: ERROR');
- END CASE;
- END;
- ELSE
- INSERT INTO t1 VALUES('p1: case4: ERROR');
- END CASE;
-END|
-
-CREATE PROCEDURE p2()
-BEGIN
- DECLARE i TINYINT DEFAULT 3;
-
- WHILE i > 0 DO
- IF MOD(i, 2) = 0 THEN
- SET @_test_session_var = 10;
- ELSE
- SET @_test_session_var = 'test';
- END IF;
-
- CASE @_test_session_var
- WHEN 10 THEN
- INSERT INTO t1 VALUES('p2: case: numerical type');
- WHEN 'test' THEN
- INSERT INTO t1 VALUES('p2: case: string type');
- ELSE
- INSERT INTO t1 VALUES('p2: case: ERROR');
- END CASE;
-
- SET i = i - 1;
- END WHILE;
-END|
-
-delimiter ;|
-
-CALL p1(10);
-CALL p1(20);
-
-CALL p2();
-
-SELECT * FROM t1;
-
-#
-# Cleanup.
-#
-
-DROP PROCEDURE p1;
-DROP PROCEDURE p2;
-DROP TABLE t1;
-
-###########################################################################
-#
-# Test case for BUG#14161: Stored procedure cannot retrieve bigint unsigned.
-#
-###########################################################################
-
---echo
---echo ---------------------------------------------------------------
---echo BUG#14161
---echo ---------------------------------------------------------------
---echo
-
-#
-# Prepare.
-#
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP PROCEDURE IF EXISTS p1;
---enable_warnings
-
-#
-# Test case.
-#
-
-CREATE TABLE t1(col BIGINT UNSIGNED);
-
-INSERT INTO t1 VALUE(18446744073709551614);
-
-delimiter |;
-CREATE PROCEDURE p1(IN arg BIGINT UNSIGNED)
-BEGIN
- SELECT arg;
- SELECT * FROM t1;
- SELECT * FROM t1 WHERE col = arg;
-END|
-delimiter ;|
-
-CALL p1(18446744073709551614);
-
-#
-# Cleanup.
-#
-
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
-###########################################################################
-#
-# Test case for BUG#13705: parameters to stored procedures are not verified.
-#
-###########################################################################
-
---echo
---echo ---------------------------------------------------------------
---echo BUG#13705
---echo ---------------------------------------------------------------
---echo
-
-#
-# Prepare.
-#
-
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
---enable_warnings
-
-#
-# Test case.
-#
-
-delimiter |;
-CREATE PROCEDURE p1(x VARCHAR(10), y CHAR(3)) READS SQL DATA
-BEGIN
- SELECT x, y;
-END|
-delimiter ;|
-
-CALL p1('alpha', 'abc');
-CALL p1('alpha', 'abcdef');
-
-#
-# Cleanup.
-#
-
-DROP PROCEDURE p1;
-
-###########################################################################
-#
-# Test case for BUG#13675: DATETIME/DATE type in store proc param seems to be
-# converted as varbinary.
-#
-# TODO: test case failed.
-#
-###########################################################################
-
---echo
---echo ---------------------------------------------------------------
---echo BUG#13675
---echo ---------------------------------------------------------------
---echo
-
-#
-# Prepare.
-#
-
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-#
-# Test case.
-#
-
-delimiter |;
-CREATE PROCEDURE p1(x DATETIME)
-BEGIN
- CREATE TABLE t1 SELECT x;
- SHOW CREATE TABLE t1;
- DROP TABLE t1;
-END|
-delimiter ;|
-
-CALL p1(NOW());
-
-CALL p1('test');
-
-#
-# Cleanup.
-#
-
-DROP PROCEDURE p1;
-
-###########################################################################
-#
-# Test case for BUG#12976: Boolean values reversed in stored procedures?
-#
-###########################################################################
-
---echo
---echo ---------------------------------------------------------------
---echo BUG#12976
---echo ---------------------------------------------------------------
---echo
-
-#
-# Prepare.
-#
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP PROCEDURE IF EXISTS p1;
-DROP PROCEDURE IF EXISTS p2;
---enable_warnings
-
-#
-# Test case.
-#
-
-CREATE TABLE t1(b BIT(1));
-
-INSERT INTO t1(b) VALUES(b'0'), (b'1');
-
-delimiter |;
-CREATE PROCEDURE p1()
-BEGIN
- SELECT HEX(b),
- b = 0,
- b = FALSE,
- b IS FALSE,
- b = 1,
- b = TRUE,
- b IS TRUE
- FROM t1;
-END|
-
-CREATE PROCEDURE p2()
-BEGIN
- DECLARE vb BIT(1);
- SELECT b INTO vb FROM t1 WHERE b = 0;
-
- SELECT HEX(vb),
- vb = 0,
- vb = FALSE,
- vb IS FALSE,
- vb = 1,
- vb = TRUE,
- vb IS TRUE;
-
- SELECT b INTO vb FROM t1 WHERE b = 1;
-
- SELECT HEX(vb),
- vb = 0,
- vb = FALSE,
- vb IS FALSE,
- vb = 1,
- vb = TRUE,
- vb IS TRUE;
-END|
-delimiter ;|
-
-call p1();
-
-call p2();
-
-#
-# Cleanup.
-#
-
-DROP TABLE t1;
-DROP PROCEDURE p1;
-DROP PROCEDURE p2;
-
-# Additional tests for Bug#12976
-
---disable_warnings
-DROP TABLE IF EXISTS table_12976_a;
-DROP TABLE IF EXISTS table_12976_b;
-DROP PROCEDURE IF EXISTS proc_12976_a;
-DROP PROCEDURE IF EXISTS proc_12976_b;
---enable_warnings
-
-CREATE TABLE table_12976_a (val bit(1));
-
-CREATE TABLE table_12976_b(
- appname varchar(15),
- emailperm bit not null default 1,
- phoneperm bit not null default 0);
-
-insert into table_12976_b values ('A', b'1', b'1'), ('B', b'0', b'0');
-
-delimiter ||;
-CREATE PROCEDURE proc_12976_a()
-BEGIN
- declare localvar bit(1);
- SELECT val INTO localvar FROM table_12976_a;
- SELECT coalesce(localvar, 1)+1, coalesce(val, 1)+1 FROM table_12976_a;
-END||
-
-CREATE PROCEDURE proc_12976_b(
- name varchar(15),
- out ep bit,
- out msg varchar(10))
-BEGIN
- SELECT emailperm into ep FROM table_12976_b where (appname = name);
- IF ep is true THEN
- SET msg = 'True';
- ELSE
- SET msg = 'False';
- END IF;
-END||
-
-delimiter ;||
-
-INSERT table_12976_a VALUES (0);
-call proc_12976_a();
-UPDATE table_12976_a set val=1;
-call proc_12976_a();
-
-call proc_12976_b('A', @ep, @msg);
-select @ep, @msg;
-
-call proc_12976_b('B', @ep, @msg);
-select @ep, @msg;
-
-DROP TABLE table_12976_a;
-DROP TABLE table_12976_b;
-DROP PROCEDURE proc_12976_a;
-DROP PROCEDURE proc_12976_b;
-
-
-###########################################################################
-#
-# Test case for BUG#9572: Stored procedures: variable type declarations
-# ignored.
-#
-###########################################################################
-
---echo
---echo ---------------------------------------------------------------
---echo BUG#9572
---echo ---------------------------------------------------------------
---echo
-
-#
-# Prepare.
-#
-
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
-DROP PROCEDURE IF EXISTS p2;
-DROP PROCEDURE IF EXISTS p3;
-
-DROP PROCEDURE IF EXISTS p4;
-DROP PROCEDURE IF EXISTS p5;
-DROP PROCEDURE IF EXISTS p6;
---enable_warnings
-
-#
-# Test case.
-#
-
-SET @@sql_mode = 'traditional';
-
-delimiter |;
-
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE v TINYINT DEFAULT 1e200;
- SELECT v;
-END|
-
-CREATE PROCEDURE p2()
-BEGIN
- DECLARE v DECIMAL(5) DEFAULT 1e200;
- SELECT v;
-END|
-
-CREATE PROCEDURE p3()
-BEGIN
- DECLARE v CHAR(5) DEFAULT 'abcdef';
- SELECT v LIKE 'abc___';
-END|
-
-CREATE PROCEDURE p4(arg VARCHAR(2))
-BEGIN
- DECLARE var VARCHAR(1);
- SET var := arg;
- SELECT arg, var;
-END|
-
-CREATE PROCEDURE p5(arg CHAR(2))
-BEGIN
- DECLARE var CHAR(1);
- SET var := arg;
- SELECT arg, var;
-END|
-
-CREATE PROCEDURE p6(arg DECIMAL(2))
-BEGIN
- DECLARE var DECIMAL(1);
- SET var := arg;
- SELECT arg, var;
-END|
-
-delimiter ;|
-
---error ER_WARN_DATA_OUT_OF_RANGE
-CALL p1();
---error ER_WARN_DATA_OUT_OF_RANGE
-CALL p2();
---error ER_DATA_TOO_LONG
-CALL p3();
-
---error ER_DATA_TOO_LONG
-CALL p4('aaa');
---error ER_DATA_TOO_LONG
-CALL p5('aa');
---error ER_WARN_DATA_OUT_OF_RANGE
-CALL p6(10);
-
-#
-# Cleanup.
-#
-
-SET @@sql_mode = 'ansi';
-
-DROP PROCEDURE p1;
-DROP PROCEDURE p2;
-DROP PROCEDURE p3;
-
-DROP PROCEDURE p4;
-DROP PROCEDURE p5;
-DROP PROCEDURE p6;
-
-###########################################################################
-#
-# Test case for BUG#9078: STORED PROCDURE: Decimal digits are not displayed
-# when we use DECIMAL datatype.
-#
-###########################################################################
-
---echo
---echo ---------------------------------------------------------------
---echo BUG#9078
---echo ---------------------------------------------------------------
---echo
-
-#
-# Prepare.
-#
-
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
---enable_warnings
-
-#
-# Test case.
-#
-
-delimiter |;
-CREATE PROCEDURE p1 (arg DECIMAL(64,2))
-BEGIN
- DECLARE var DECIMAL(64,2);
-
- SET var = arg;
- SELECT var;
-END|
-delimiter ;|
-
-CALL p1(1929);
-CALL p1(1929.00);
-CALL p1(1929.003);
-
-#
-# Cleanup.
-#
-
-DROP PROCEDURE p1;
-
-###########################################################################
-#
-# Test case for BUG#8768: Functions: For any unsigned data type, -ve values can
-# be passed and returned.
-#
-# TODO: there is a bug here -- the function created in ANSI mode should not
-# throw errors instead of warnings if called in TRADITIONAL mode.
-#
-###########################################################################
-
---echo
---echo ---------------------------------------------------------------
---echo BUG#8768
---echo ---------------------------------------------------------------
---echo
-
-#
-# Prepare.
-#
-
---disable_warnings
-DROP FUNCTION IF EXISTS f1;
---enable_warnings
-
-#
-# Test case.
-#
-
-# Create a function in ANSI mode.
-
-delimiter |;
-CREATE FUNCTION f1(arg TINYINT UNSIGNED) RETURNS TINYINT
-BEGIN
- RETURN arg;
-END|
-delimiter ;|
-
-SELECT f1(-2500);
-
-# Call in TRADITIONAL mode the function created in ANSI mode.
-
-SET @@sql_mode = 'traditional';
-
-# TODO: a warning should be emitted here.
---error ER_WARN_DATA_OUT_OF_RANGE
-SELECT f1(-2500);
-
-# Recreate the function in TRADITIONAL mode.
-
-DROP FUNCTION f1;
-
-delimiter |;
-CREATE FUNCTION f1(arg TINYINT UNSIGNED) RETURNS TINYINT
-BEGIN
- RETURN arg;
-END|
-delimiter ;|
-
---error ER_WARN_DATA_OUT_OF_RANGE
-SELECT f1(-2500);
-
-#
-# Cleanup.
-#
-
-SET @@sql_mode = 'ansi';
-
-DROP FUNCTION f1;
-
-###########################################################################
-#
-# Test case for BUG#8769: Functions: For Int datatypes, out of range values can
-# be passed and returned.
-#
-# TODO: there is a bug here -- the function created in ANSI mode should not
-# throw errors instead of warnings if called in TRADITIONAL mode.
-#
-###########################################################################
-
---echo
---echo ---------------------------------------------------------------
---echo BUG#8769
---echo ---------------------------------------------------------------
---echo
-
-#
-# Prepare.
-#
-
---disable_warnings
-DROP FUNCTION IF EXISTS f1;
---enable_warnings
-
-#
-# Test case.
-#
-
-# Create a function in ANSI mode.
-
-delimiter |;
-CREATE FUNCTION f1(arg MEDIUMINT) RETURNS MEDIUMINT
-BEGIN
- RETURN arg;
-END|
-delimiter ;|
-
-SELECT f1(8388699);
-
-# Call in TRADITIONAL mode the function created in ANSI mode.
-
-SET @@sql_mode = 'traditional';
-
-# TODO: a warning should be emitted here.
---error ER_WARN_DATA_OUT_OF_RANGE
-SELECT f1(8388699);
-
-# Recreate the function in TRADITIONAL mode.
-
-DROP FUNCTION f1;
-
-delimiter |;
-CREATE FUNCTION f1(arg MEDIUMINT) RETURNS MEDIUMINT
-BEGIN
- RETURN arg;
-END|
-delimiter ;|
-
---error ER_WARN_DATA_OUT_OF_RANGE
-SELECT f1(8388699);
-
-#
-# Cleanup.
-#
-
-SET @@sql_mode = 'ansi';
-
-DROP FUNCTION f1;
-
-###########################################################################
-#
-# Test case for BUG#8702: Stored Procedures: No Error/Warning shown for
-# inappropriate data type matching.
-#
-###########################################################################
-
---echo
---echo ---------------------------------------------------------------
---echo BUG#8702
---echo ---------------------------------------------------------------
---echo
-
-#
-# Prepare.
-#
-
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-#
-# Test case.
-#
-
-CREATE TABLE t1(col VARCHAR(255));
-
-INSERT INTO t1(col) VALUES('Hello, world!');
-
-delimiter |;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE sp_var INTEGER;
-
- SELECT col INTO sp_var FROM t1 LIMIT 1;
- SET @user_var = sp_var;
-
- SELECT sp_var;
- SELECT @user_var;
-END|
-delimiter ;|
-
-CALL p1();
-
-#
-# Cleanup.
-#
-
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-###########################################################################
-#
-# Test case for BUG#12903: upper function does not work inside a function.
-#
-###########################################################################
-
---echo
---echo ---------------------------------------------------------------
---echo BUG#12903
---echo ---------------------------------------------------------------
---echo
-
-#
-# Prepare.
-#
-
---disable_warnings
-DROP FUNCTION IF EXISTS f1;
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-#
-# Test case.
-#
-
-CREATE TABLE t1(txt VARCHAR(255));
-
-delimiter |;
-CREATE FUNCTION f1(arg VARCHAR(255)) RETURNS VARCHAR(255)
-BEGIN
- DECLARE v1 VARCHAR(255);
- DECLARE v2 VARCHAR(255);
-
- SET v1 = CONCAT(LOWER(arg), UPPER(arg));
- SET v2 = CONCAT(LOWER(v1), UPPER(v1));
-
- INSERT INTO t1 VALUES(v1), (v2);
-
- RETURN CONCAT(LOWER(arg), UPPER(arg));
-END|
-delimiter ;|
-
-SELECT f1('_aBcDe_');
-
-SELECT * FROM t1;
-
-#
-# Cleanup.
-#
-
-DROP FUNCTION f1;
-DROP TABLE t1;
-
-###########################################################################
-#
-# Test case for BUG#13808: ENUM type stored procedure parameter accepts
-# non-enumerated data.
-#
-###########################################################################
-
---echo
---echo ---------------------------------------------------------------
---echo BUG#13808
---echo ---------------------------------------------------------------
---echo
-
-#
-# Prepare.
-#
-
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
-DROP PROCEDURE IF EXISTS p2;
-DROP FUNCTION IF EXISTS f1;
---enable_warnings
-
-#
-# Test case.
-#
-
-delimiter |;
-
-CREATE PROCEDURE p1(arg ENUM('a', 'b'))
-BEGIN
- SELECT arg;
-END|
-
-CREATE PROCEDURE p2(arg ENUM('a', 'b'))
-BEGIN
- DECLARE var ENUM('c', 'd') DEFAULT arg;
-
- SELECT arg, var;
-END|
-
-CREATE FUNCTION f1(arg ENUM('a', 'b')) RETURNS ENUM('c', 'd')
-BEGIN
- RETURN arg;
-END|
-
-delimiter ;|
-
-CALL p1('c');
-
-CALL p2('a');
-
-SELECT f1('a');
-
-#
-# Cleanup.
-#
-
-DROP PROCEDURE p1;
-DROP PROCEDURE p2;
-DROP FUNCTION f1;
-
-###########################################################################
-#
-# Test case for BUG#13909: Varchar Stored Procedure Parameter always BINARY
-# string (ignores CHARACTER SET).
-#
-###########################################################################
-
---echo
---echo ---------------------------------------------------------------
---echo BUG#13909
---echo ---------------------------------------------------------------
---echo
-
-#
-# Prepare.
-#
-
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
-DROP PROCEDURE IF EXISTS p2;
---enable_warnings
-
-#
-# Test case.
-#
-
-delimiter |;
-
-CREATE PROCEDURE p1(arg VARCHAR(255))
-BEGIN
- SELECT CHARSET(arg);
-END|
-
-CREATE PROCEDURE p2(arg VARCHAR(255) CHARACTER SET UTF8)
-BEGIN
- SELECT CHARSET(arg);
-END|
-
-delimiter ;|
-
-CALL p1('t');
-CALL p1(_UTF8 't');
-
-
-CALL p2('t');
-CALL p2(_LATIN1 't');
-
-#
-# Cleanup.
-#
-
-DROP PROCEDURE p1;
-DROP PROCEDURE p2;
-
-###########################################################################
-#
-# Test case for BUG#14188: BINARY variables have no 0x00 padding.
-#
-###########################################################################
-
---echo
---echo ---------------------------------------------------------------
---echo BUG#14188
---echo ---------------------------------------------------------------
---echo
-
-#
-# Prepare.
-#
-
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
---enable_warnings
-
-#
-# Test case.
-#
-
-delimiter |;
-CREATE PROCEDURE p1(arg1 BINARY(2), arg2 VARBINARY(2))
-BEGIN
- DECLARE var1 BINARY(2) DEFAULT 0x41;
- DECLARE var2 VARBINARY(2) DEFAULT 0x42;
-
- SELECT HEX(arg1), HEX(arg2);
- SELECT HEX(var1), HEX(var2);
-END|
-delimiter ;|
-
-CALL p1(0x41, 0x42);
-
-#
-# Cleanup.
-#
-
-DROP PROCEDURE p1;
-
-###########################################################################
-#
-# Test case for BUG#15148: Stored procedure variables accept non-scalar values.
-#
-###########################################################################
-
---echo
---echo ---------------------------------------------------------------
---echo BUG#15148
---echo ---------------------------------------------------------------
---echo
-
-#
-# Prepare.
-#
-
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-#
-# Test case.
-#
-
-CREATE TABLE t1(col1 TINYINT, col2 TINYINT);
-
-INSERT INTO t1 VALUES(1, 2), (11, 12);
-
-delimiter |;
-CREATE PROCEDURE p1(arg TINYINT)
-BEGIN
- SELECT arg;
-END|
-delimiter ;|
-
---error ER_OPERAND_COLUMNS
-CALL p1((1, 2));
-
---error ER_OPERAND_COLUMNS
-CALL p1((SELECT * FROM t1 LIMIT 1));
-
---error ER_OPERAND_COLUMNS
-CALL p1((SELECT col1, col2 FROM t1 LIMIT 1));
-
-#
-# Cleanup.
-#
-
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-###########################################################################
-#
-# Test case for BUG#13613: substring function in stored procedure.
-#
-###########################################################################
-
---echo
---echo ---------------------------------------------------------------
---echo BUG#13613
---echo ---------------------------------------------------------------
---echo
-
-#
-# Prepare.
-#
-
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
-DROP FUNCTION IF EXISTS f1;
---enable_warnings
-
-#
-# Test case.
-#
-
-delimiter |;
-
-CREATE PROCEDURE p1(x VARCHAR(50))
-BEGIN
- SET x = SUBSTRING(x, 1, 3);
- SELECT x;
-END|
-
-CREATE FUNCTION f1(x VARCHAR(50)) RETURNS VARCHAR(50)
-BEGIN
- RETURN SUBSTRING(x, 1, 3);
-END|
-
-delimiter ;|
-
-CALL p1('abcdef');
-
-SELECT f1('ABCDEF');
-
-#
-# Cleanup.
-#
-
-DROP PROCEDURE p1;
-DROP FUNCTION f1;
-
-###########################################################################
-#
-# Test case for BUG#13665: concat with '' produce incorrect results in SP.
-#
-###########################################################################
-
---echo
---echo ---------------------------------------------------------------
---echo BUG#13665
---echo ---------------------------------------------------------------
---echo
-
-#
-# Prepare.
-#
-
---disable_warnings
-DROP FUNCTION IF EXISTS f1;
---enable_warnings
-
-#
-# Test case.
-#
-
-delimiter |;
-CREATE FUNCTION f1() RETURNS VARCHAR(20000)
-BEGIN
- DECLARE var VARCHAR(2000);
-
- SET var = '';
- SET var = CONCAT(var, 'abc');
- SET var = CONCAT(var, '');
-
- RETURN var;
-END|
-delimiter ;|
-
-SELECT f1();
-
-#
-# Cleanup.
-#
-
-DROP FUNCTION f1;
-
-
-#
-# Bug#17226: Variable set in cursor on first iteration is assigned
-# second iterations value
-#
-# The problem was in incorrect handling of local variables of type
-# TEXT (BLOB).
-#
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
---enable_warnings
-
-delimiter |;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE v_char VARCHAR(255);
- DECLARE v_text TEXT DEFAULT '';
-
- SET v_char = 'abc';
-
- SET v_text = v_char;
-
- SET v_char = 'def';
-
- SET v_text = concat(v_text, '|', v_char);
-
- SELECT v_text;
-END|
-delimiter ;|
-
-CALL p1();
-
-DROP PROCEDURE p1;
-
-#
-# Bug #27415 Text Variables in stored procedures
-# If the SP varible was also referenced on the right side
-# the result was corrupted.
-#
-DELIMITER |;
-
---disable_warnings
-DROP PROCEDURE IF EXISTS bug27415_text_test|
-DROP PROCEDURE IF EXISTS bug27415_text_test2|
---enable_warnings
-
-CREATE PROCEDURE bug27415_text_test(entity_id_str_in text)
-BEGIN
- DECLARE str_remainder text;
-
- SET str_remainder = entity_id_str_in;
-
- select 'before substr', str_remainder;
- SET str_remainder = SUBSTRING(str_remainder, 3);
- select 'after substr', str_remainder;
-END|
-
-CREATE PROCEDURE bug27415_text_test2(entity_id_str_in text)
-BEGIN
- DECLARE str_remainder text;
- DECLARE str_remainder2 text;
-
- SET str_remainder2 = entity_id_str_in;
- select 'before substr', str_remainder2;
- SET str_remainder = SUBSTRING(str_remainder2, 3);
- select 'after substr', str_remainder;
-END|
-
-CALL bug27415_text_test('a,b,c')|
-CALL bug27415_text_test('a,b,c')|
-CALL bug27415_text_test2('a,b,c')|
-CALL bug27415_text_test('a,b,c')|
-
-DROP PROCEDURE bug27415_text_test|
-DROP PROCEDURE bug27415_text_test2|
-
-DELIMITER ;|
-
-# End of 5.0 tests.
-
-#
-# Bug #26277 User variable returns one type in SELECT @v and other for CREATE as SELECT @v
-#
---disable_warnings
-drop function if exists f1;
-drop table if exists t1;
---enable_warnings
-
-delimiter |;
-create function f1() returns int
-begin
- if @a=1 then set @b='abc';
- else set @b=1;
- end if;
- set @a=1;
- return 0;
-end|
-
-create table t1 (a int)|
-insert into t1 (a) values (1), (2)|
-
-set @b=1|
-set @a=0|
-select f1(), @b from t1|
-
-set @b:='test'|
-set @a=0|
-select f1(), @b from t1|
-
-delimiter ;|
-
-drop function f1;
-drop table t1;
-# End of 5.1 tests.
-
-
-###########################################################################
-#
-# Test case for BUG#28299: To-number conversion warnings work
-# differenly with CHAR and VARCHAR sp variables
-#
-###########################################################################
-
---echo
---echo ---------------------------------------------------------------
---echo BUG#28299
---echo ---------------------------------------------------------------
---echo
-
-DELIMITER |;
-CREATE PROCEDURE ctest()
-BEGIN
- DECLARE i CHAR(16);
- DECLARE j INT;
- SET i= 'string';
- SET j= 1 + i;
-END|
-DELIMITER ;|
-
-CALL ctest();
-DROP PROCEDURE ctest;
-
-DELIMITER |;
-CREATE PROCEDURE vctest()
-BEGIN
- DECLARE i VARCHAR(16);
- DECLARE j INT;
- SET i= 'string';
- SET j= 1 + i;
-END|
-DELIMITER ;|
-
-CALL vctest();
-DROP PROCEDURE vctest;
-
---echo #
---echo # Start of 10.3 tests
---echo #
-
---echo #
---echo # MDEV-12876 Wrong data type for CREATE..SELECT sp_var
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE i8 TINYINT;
- DECLARE i16 SMALLINT;
- DECLARE i32 INT;
- DECLARE i64 BIGINT;
- DECLARE f FLOAT;
- DECLARE d DOUBLE;
- DECLARE b8 BIT(8);
- DECLARE y YEAR;
- DECLARE t1 TINYTEXT;
- DECLARE t2 TEXT;
- DECLARE t3 MEDIUMTEXT;
- DECLARE t4 LONGTEXT;
- CREATE TABLE t1 AS SELECT i8, i16, i32, i64, f, d, b8, y, t1, t2, t3, t4;
-END;
-$$
-DELIMITER ;$$
-CALL p1;
-DESCRIBE t1;
-DROP TABLE t1;
-DROP PROCEDURE p1;
-
---echo #
---echo # MDEV-12917 Wrong data type for CREATE..SELECT year_sp_variable
---echo #
-
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE a YEAR;
- CREATE OR REPLACE TABLE t1 AS SELECT a;
- SHOW CREATE TABLE t1;
- DROP TABLE t1;
-END;
-$$
-DELIMITER ;$$
-CALL p1;
-DROP PROCEDURE p1;
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
deleted file mode 100644
index c97f6dbba68..00000000000
--- a/mysql-test/t/sp.test
+++ /dev/null
@@ -1,10122 +0,0 @@
-#
-# Basic stored PROCEDURE tests
-#
-# Test cases for bugs are added at the end. See template there.
-#
-# Some tests that require --error go into sp-error.test
-# Tests that require innodb go into sp_trans.test
-# Tests that check privilege and security issues go to sp-security.test.
-# Tests that require multiple connections, except security/privilege tests,
-# go to sp-thread.
-# Tests that uses 'goto' to into sp-goto.test (currently disabled)
-# Tests that destroys system tables (e.g. mysql.proc) for error testing
-# go to sp-destruct.
-# Tests that require --with-geometry go into sp_gis.test
-# Tests that require multibyte character sets, which are not always available,
-# go into separate files (e.g. sp-ucs2.test)
-use test;
-
-# Test tables
-#
-# t1 and t2 are reused throughout the file, and dropped at the end.
-# t3 and up are created and dropped when needed.
-#
---disable_warnings
-drop table if exists t1,t2,t3,t4;
-drop view if exists v1;
-drop procedure if exists p1;
-drop procedure if exists p2;
-drop function if exists f1;
-drop function if exists f2;
---enable_warnings
-create table t1 (
- id char(16) not null default '',
- data int not null
-);
-create table t2 (
- s char(16),
- i int,
- d double
-);
-
-
-# Single statement, no params.
---disable_warnings
-drop procedure if exists foo42;
---enable_warnings
-create procedure foo42()
- insert into test.t1 values ("foo", 42);
-
-call foo42();
-select * from t1;
-delete from t1;
-drop procedure foo42;
-
-
-# Single statement, two IN params.
---disable_warnings
-drop procedure if exists bar;
---enable_warnings
-create procedure bar(x char(16), y int)
- insert into test.t1 values (x, y);
-
-call bar("bar", 666);
-select * from t1;
-delete from t1;
-# Don't drop procedure yet...
-
-
-# Now for multiple statements...
-delimiter |;
-
-# Empty statement
---disable_warnings
-drop procedure if exists empty|
---enable_warnings
-create procedure empty()
-begin
-end|
-
-call empty()|
-drop procedure empty|
-
-# Scope test. This is legal (warnings might be possible in the future,
-# but for the time being, we just accept it).
---disable_warnings
-drop procedure if exists scope|
---enable_warnings
-create procedure scope(a int, b float)
-begin
- declare b int;
- declare c float;
-
- begin
- declare c int;
- end;
-end|
-
-drop procedure scope|
-
-# Two statements.
---disable_warnings
-drop procedure if exists two|
---enable_warnings
-create procedure two(x1 char(16), x2 char(16), y int)
-begin
- insert into test.t1 values (x1, y);
- insert into test.t1 values (x2, y);
-end|
-
-call two("one", "two", 3)|
-select * from t1|
-delete from t1|
-drop procedure two|
-
-
-# Simple test of local variables and SET.
---disable_warnings
-drop procedure if exists locset|
---enable_warnings
-create procedure locset(x char(16), y int)
-begin
- declare z1, z2 int;
- set z1 = y;
- set z2 = z1+2;
- insert into test.t1 values (x, z2);
-end|
-
-call locset("locset", 19)|
-select * from t1|
-delete from t1|
-drop procedure locset|
-
-
-# In some contexts local variables are not recognized
-# (and in some, you have to qualify the identifier).
---disable_warnings
-drop procedure if exists setcontext|
---enable_warnings
-create procedure setcontext()
-begin
- declare data int default 2;
-
- insert into t1 (id, data) values ("foo", 1);
- replace t1 set data = data, id = "bar";
- update t1 set id = "kaka", data = 3 where t1.data = data;
-end|
-
-call setcontext()|
-select * from t1 order by data|
-delete from t1|
-drop procedure setcontext|
-
-
-# Set things to null
-create table t3 ( d date, i int, f double, s varchar(32) )|
-
---disable_warnings
-drop procedure if exists nullset|
---enable_warnings
-create procedure nullset()
-begin
- declare ld date;
- declare li int;
- declare lf double;
- declare ls varchar(32);
-
- set ld = null, li = null, lf = null, ls = null;
- insert into t3 values (ld, li, lf, ls);
-
- insert into t3 (i, f, s) values ((ld is null), 1, "ld is null"),
- ((li is null), 1, "li is null"),
- ((li = 0), null, "li = 0"),
- ((lf is null), 1, "lf is null"),
- ((lf = 0), null, "lf = 0"),
- ((ls is null), 1, "ls is null");
-end|
-
-call nullset()|
-select * from t3|
-drop table t3|
-drop procedure nullset|
-
-
-# The peculiar (non-standard) mixture of variables types in SET.
---disable_warnings
-drop procedure if exists mixset|
---enable_warnings
-create procedure mixset(x char(16), y int)
-begin
- declare z int;
-
- set @z = y, z = 666, max_join_size = 100;
- insert into test.t1 values (x, z);
-end|
-
-let $start_value= `SELECT @@max_join_size`|
-call mixset("mixset", 19)|
-show variables like 'max_join_size'|
-select id,data,@z from t1|
-delete from t1|
-drop procedure mixset|
---disable_query_log
-eval SET @@max_join_size= $start_value|
---enable_query_log
-
-# Multiple CALL statements, one with OUT parameter.
---disable_warnings
-drop procedure if exists zip|
---enable_warnings
-create procedure zip(x char(16), y int)
-begin
- declare z int;
- call zap(y, z);
- call bar(x, z);
-end|
-
-# SET local variables and OUT parameter.
---disable_warnings
-drop procedure if exists zap|
---enable_warnings
-create procedure zap(x int, out y int)
-begin
- declare z int;
- set z = x+1, y = z;
-end|
-
-call zip("zip", 99)|
-select * from t1|
-delete from t1|
-drop procedure zip|
-drop procedure bar|
-
-# Top-level OUT parameter
-call zap(7, @zap)|
-select @zap|
-
-drop procedure zap|
-
-
-# "Deep" calls...
---disable_warnings
-drop procedure if exists c1|
---enable_warnings
-create procedure c1(x int)
- call c2("c", x)|
---disable_warnings
-drop procedure if exists c2|
---enable_warnings
-create procedure c2(s char(16), x int)
- call c3(x, s)|
---disable_warnings
-drop procedure if exists c3|
---enable_warnings
-create procedure c3(x int, s char(16))
- call c4("level", x, s)|
---disable_warnings
-drop procedure if exists c4|
---enable_warnings
-create procedure c4(l char(8), x int, s char(16))
- insert into t1 values (concat(l,s), x)|
-
-call c1(42)|
-select * from t1|
-delete from t1|
-drop procedure c1|
-drop procedure c2|
-drop procedure c3|
-drop procedure c4|
-
-# INOUT test
---disable_warnings
-drop procedure if exists iotest|
---enable_warnings
-create procedure iotest(x1 char(16), x2 char(16), y int)
-begin
- call inc2(x2, y);
- insert into test.t1 values (x1, y);
-end|
-
---disable_warnings
-drop procedure if exists inc2|
---enable_warnings
-create procedure inc2(x char(16), y int)
-begin
- call inc(y);
- insert into test.t1 values (x, y);
-end|
-
---disable_warnings
-drop procedure if exists inc|
---enable_warnings
-create procedure inc(inout io int)
- set io = io + 1|
-
-call iotest("io1", "io2", 1)|
-select * from t1 order by data desc|
-delete from t1|
-drop procedure iotest|
-drop procedure inc2|
-
-# Propagating top-level @-vars
---disable_warnings
-drop procedure if exists incr|
---enable_warnings
-create procedure incr(inout x int)
- call inc(x)|
-
-# Before
-select @zap|
-call incr(@zap)|
-# After
-select @zap|
-
-drop procedure inc|
-drop procedure incr|
-
-# Call-by-value test
-# The expected result is:
-# ("cbv2", 4)
-# ("cbv1", 4711)
---disable_warnings
-drop procedure if exists cbv1|
---enable_warnings
-create procedure cbv1()
-begin
- declare y int default 3;
-
- call cbv2(y+1, y);
- insert into test.t1 values ("cbv1", y);
-end|
-
---disable_warnings
-drop procedure if exists cbv2|
---enable_warnings
-create procedure cbv2(y1 int, inout y2 int)
-begin
- set y2 = 4711;
- insert into test.t1 values ("cbv2", y1);
-end|
-
-call cbv1()|
-select * from t1 order by data|
-delete from t1|
-drop procedure cbv1|
-drop procedure cbv2|
-
-
-# Subselect arguments
-
-insert into t2 values ("a", 1, 1.1), ("b", 2, 1.2), ("c", 3, 1.3)|
-
---disable_warnings
-drop procedure if exists sub1|
---enable_warnings
-create procedure sub1(id char(16), x int)
- insert into test.t1 values (id, x)|
-
---disable_warnings
-drop procedure if exists sub2|
---enable_warnings
-create procedure sub2(id char(16))
-begin
- declare x int;
- set x = (select sum(t.i) from test.t2 t);
- insert into test.t1 values (id, x);
-end|
-
---disable_warnings
-drop procedure if exists sub3|
---enable_warnings
-create function sub3(i int) returns int deterministic
- return i+1|
-
-call sub1("sub1a", (select 7))|
-call sub1("sub1b", (select max(i) from t2))|
---error ER_OPERAND_COLUMNS
-call sub1("sub1c", (select i,d from t2 limit 1))|
-call sub1("sub1d", (select 1 from (select 1) a))|
-call sub2("sub2")|
-select * from t1 order by id|
-select sub3((select max(i) from t2))|
-drop procedure sub1|
-drop procedure sub2|
-drop function sub3|
-delete from t1|
-delete from t2|
-
-# Basic tests of the flow control constructs
-
-# Just test on 'x'...
---disable_warnings
-drop procedure if exists a0|
---enable_warnings
-create procedure a0(x int)
-while x do
- set x = x-1;
- insert into test.t1 values ("a0", x);
-end while|
-
-call a0(3)|
-select * from t1 order by data desc|
-delete from t1|
-drop procedure a0|
-
-
-# The same, but with a more traditional test.
---disable_warnings
-drop procedure if exists a|
---enable_warnings
-create procedure a(x int)
-while x > 0 do
- set x = x-1;
- insert into test.t1 values ("a", x);
-end while|
-
-call a(3)|
-select * from t1 order by data desc|
-delete from t1|
-drop procedure a|
-
-
-# REPEAT
---disable_warnings
-drop procedure if exists b|
---enable_warnings
-create procedure b(x int)
-repeat
- insert into test.t1 values (repeat("b",3), x);
- set x = x-1;
-until x = 0 end repeat|
-
-call b(3)|
-select * from t1 order by data desc|
-delete from t1|
-drop procedure b|
-
-
-# Check that repeat isn't parsed the wrong way
---disable_warnings
-drop procedure if exists b2|
---enable_warnings
-create procedure b2(x int)
-repeat(select 1 into outfile 'b2');
- insert into test.t1 values (repeat("b2",3), x);
- set x = x-1;
-until x = 0 end repeat|
-
-# We don't actually want to call it.
-drop procedure b2|
-
-
-# Labelled WHILE with ITERATE (pointless really)
---disable_warnings
-drop procedure if exists c|
---enable_warnings
-create procedure c(x int)
-hmm: while x > 0 do
- insert into test.t1 values ("c", x);
- set x = x-1;
- iterate hmm;
- insert into test.t1 values ("x", x);
-end while hmm|
-
-call c(3)|
-select * from t1 order by data desc|
-delete from t1|
-drop procedure c|
-
-
-# Labelled WHILE with LEAVE
---disable_warnings
-drop procedure if exists d|
---enable_warnings
-create procedure d(x int)
-hmm: while x > 0 do
- insert into test.t1 values ("d", x);
- set x = x-1;
- leave hmm;
- insert into test.t1 values ("x", x);
-end while|
-
-call d(3)|
-select * from t1|
-delete from t1|
-drop procedure d|
-
-
-# LOOP, with simple IF statement
---disable_warnings
-drop procedure if exists e|
---enable_warnings
-create procedure e(x int)
-foo: loop
- if x = 0 then
- leave foo;
- end if;
- insert into test.t1 values ("e", x);
- set x = x-1;
-end loop foo|
-
-call e(3)|
-select * from t1 order by data desc|
-delete from t1|
-drop procedure e|
-
-
-# A full IF statement
---disable_warnings
-drop procedure if exists f|
---enable_warnings
-create procedure f(x int)
-if x < 0 then
- insert into test.t1 values ("f", 0);
-elseif x = 0 then
- insert into test.t1 values ("f", 1);
-else
- insert into test.t1 values ("f", 2);
-end if|
-
-call f(-2)|
-call f(0)|
-call f(4)|
-select * from t1 order by data|
-delete from t1|
-drop procedure f|
-
-
-# This form of CASE is really just syntactic sugar for IF-ELSEIF-...
---disable_warnings
-drop procedure if exists g|
---enable_warnings
-create procedure g(x int)
-case
-when x < 0 then
- insert into test.t1 values ("g", 0);
-when x = 0 then
- insert into test.t1 values ("g", 1);
-else
- insert into test.t1 values ("g", 2);
-end case|
-
-call g(-42)|
-call g(0)|
-call g(1)|
-select * from t1 order by data|
-delete from t1|
-drop procedure g|
-
-
-# The "simple CASE"
---disable_warnings
-drop procedure if exists h|
---enable_warnings
-create procedure h(x int)
-case x
-when 0 then
- insert into test.t1 values ("h0", x);
-when 1 then
- insert into test.t1 values ("h1", x);
-else
- insert into test.t1 values ("h?", x);
-end case|
-
-call h(0)|
-call h(1)|
-call h(17)|
-select * from t1 order by data|
-delete from t1|
-drop procedure h|
-
-
-# It's actually possible to LEAVE a BEGIN-END block
---disable_warnings
-drop procedure if exists i|
---enable_warnings
-create procedure i(x int)
-foo:
-begin
- if x = 0 then
- leave foo;
- end if;
- insert into test.t1 values ("i", x);
-end foo|
-
-call i(0)|
-call i(3)|
-select * from t1|
-delete from t1|
-drop procedure i|
-
-
-# SELECT with one of more result set sent back to the clinet
-insert into t1 values ("foo", 3), ("bar", 19)|
-insert into t2 values ("x", 9, 4.1), ("y", -1, 19.2), ("z", 3, 2.2)|
-
---disable_warnings
-drop procedure if exists sel1|
---enable_warnings
-create procedure sel1()
-begin
- select * from t1 order by data;
-end|
-
-call sel1()|
-drop procedure sel1|
-
---disable_warnings
-drop procedure if exists sel2|
---enable_warnings
-create procedure sel2()
-begin
- select * from t1 order by data;
- select * from t2 order by s;
-end|
-
-call sel2()|
-drop procedure sel2|
-delete from t1|
-delete from t2|
-
-# SELECT INTO local variables
---disable_warnings
-drop procedure if exists into_test|
---enable_warnings
-create procedure into_test(x char(16), y int)
-begin
- insert into test.t1 values (x, y);
- select id,data into x,y from test.t1 limit 1;
- insert into test.t1 values (concat(x, "2"), y+2);
-end|
-
-call into_test("into", 100)|
-select * from t1 order by data|
-delete from t1|
-drop procedure into_test|
-
-
-# SELECT INTO with a mix of local and global variables
---disable_warnings
-drop procedure if exists into_tes2|
---enable_warnings
-create procedure into_test2(x char(16), y int)
-begin
- insert into test.t1 values (x, y);
- select id,data into x,@z from test.t1 limit 1;
- insert into test.t1 values (concat(x, "2"), y+2);
-end|
-
-call into_test2("into", 100)|
-select id,data,@z from t1 order by data|
-delete from t1|
-drop procedure into_test2|
-
-
-# SELECT * INTO ... (bug test)
---disable_warnings
-drop procedure if exists into_test3|
---enable_warnings
-create procedure into_test3()
-begin
- declare x char(16);
- declare y int;
-
- select * into x,y from test.t1 limit 1;
- insert into test.t2 values (x, y, 0.0);
-end|
-
-insert into t1 values ("into3", 19)|
-# Two call needed for bug test
-call into_test3()|
-call into_test3()|
-select * from t2|
-delete from t1|
-delete from t2|
-drop procedure into_test3|
-
-
-# SELECT INTO with no data is a warning ("no data", which we will
-# not see normally). When not caught, execution proceeds.
---disable_warnings
-drop procedure if exists into_test4|
---enable_warnings
-create procedure into_test4()
-begin
- declare x int;
-
- select data into x from test.t1 limit 1;
- insert into test.t3 values ("into4", x);
-end|
-
-delete from t1|
-create table t3 ( s char(16), d int)|
-call into_test4()|
-select * from t3|
-insert into t1 values ("i4", 77)|
-call into_test4()|
-select * from t3|
-delete from t1|
-drop table t3|
-drop procedure into_test4|
-
-
-# These two (and the two procedures above) caused an assert() to fail in
-# sql_base.cc:lock_tables() at some point.
---disable_warnings
-drop procedure if exists into_outfile|
---enable_warnings
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval create procedure into_outfile(x char(16), y int)
-begin
- insert into test.t1 values (x, y);
- select * into outfile "$MYSQLTEST_VARDIR/tmp/spout" from test.t1;
- insert into test.t1 values (concat(x, "2"), y+2);
-end|
-
-# Check that file does not exists
---error 1
---file_exists $MYSQLTEST_VARDIR/tmp/spout
-call into_outfile("ofile", 1)|
---remove_file $MYSQLTEST_VARDIR/tmp/spout
-delete from t1|
-drop procedure into_outfile|
-
---disable_warnings
-drop procedure if exists into_dumpfile|
---enable_warnings
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval create procedure into_dumpfile(x char(16), y int)
-begin
- insert into test.t1 values (x, y);
- select * into dumpfile "$MYSQLTEST_VARDIR/tmp/spdump" from test.t1 limit 1;
- insert into test.t1 values (concat(x, "2"), y+2);
-end|
-
-# Check that file does not exists
---error 1
---file_exists $MYSQLTEST_VARDIR/tmp/spdump
-call into_dumpfile("dfile", 1)|
---remove_file $MYSQLTEST_VARDIR/tmp/spdump
-delete from t1|
-drop procedure into_dumpfile|
-
---disable_warnings
-drop procedure if exists create_select|
---enable_warnings
-create procedure create_select(x char(16), y int)
-begin
- insert into test.t1 values (x, y);
- create temporary table test.t3 select * from test.t1;
- insert into test.t3 values (concat(x, "2"), y+2);
-end|
-
-call create_select("cs", 90)|
-select * from t1, t3|
-drop table t3|
-delete from t1|
-drop procedure create_select|
-
-
-# A minimal, constant FUNCTION.
---disable_warnings
-drop function if exists e|
---enable_warnings
-create function e() returns double
- return 2.7182818284590452354|
-
-set @e = e()|
-select e(), @e|
-
-# A minimal function with one argument
---disable_warnings
-drop function if exists inc|
---enable_warnings
-create function inc(i int) returns int
- return i+1|
-
-select inc(1), inc(99), inc(-71)|
-
-# A minimal function with two arguments
---disable_warnings
-drop function if exists mul|
---enable_warnings
-create function mul(x int, y int) returns int
- return x*y|
-
-select mul(1,1), mul(3,5), mul(4711, 666)|
-
-# A minimal string function
---disable_warnings
-drop function if exists append|
---enable_warnings
-create function append(s1 char(8), s2 char(8)) returns char(16)
- return concat(s1, s2)|
-
-select append("foo", "bar")|
-
-# A function with flow control
---disable_warnings
-drop function if exists fac|
---enable_warnings
-create function fac(n int unsigned) returns bigint unsigned
-begin
- declare f bigint unsigned default 1;
-
- while n > 1 do
- set f = f * n;
- set n = n - 1;
- end while;
- return f;
-end|
-
-select fac(1), fac(2), fac(5), fac(10)|
-
-# Nested calls
---disable_warnings
-drop function if exists fun|
---enable_warnings
-create function fun(d double, i int, u int unsigned) returns double
- return mul(inc(i), fac(u)) / e()|
-
-select fun(2.3, 3, 5)|
-
-
-# Various function calls in differen statements
-
-insert into t2 values (append("xxx", "yyy"), mul(4,3), e())|
-insert into t2 values (append("a", "b"), mul(2,mul(3,4)), fun(1.7, 4, 6))|
-
-# Disable PS because double's give a bit different values
---disable_ps_protocol
-select * from t2 where s = append("a", "b")|
-select * from t2 where i = mul(4,3) or i = mul(mul(3,4),2) order by i|
-select * from t2 where d = e()|
-select * from t2 order by i|
---enable_ps_protocol
-delete from t2|
-
-drop function e|
-drop function inc|
-drop function mul|
-drop function append|
-drop function fun|
-
-
-#
-# CONDITIONs and HANDLERs
-#
-
---disable_warnings
-drop procedure if exists hndlr1|
---enable_warnings
-create procedure hndlr1(val int)
-begin
- declare x int default 0;
- declare foo condition for 1136;
- declare bar condition for sqlstate '42S98'; # Just for testing syntax
- declare zip condition for sqlstate value '42S99'; # Just for testing syntax
- declare continue handler for foo set x = 1;
-
- insert into test.t1 values ("hndlr1", val, 2); # Too many values
- if (x) then
- insert into test.t1 values ("hndlr1", val); # This instead then
- end if;
-end|
-
-call hndlr1(42)|
-select * from t1|
-delete from t1|
-drop procedure hndlr1|
-
---disable_warnings
-drop procedure if exists hndlr2|
---enable_warnings
-create procedure hndlr2(val int)
-begin
- declare x int default 0;
-
- begin
- declare exit handler for sqlstate '21S01' set x = 1;
-
- insert into test.t1 values ("hndlr2", val, 2); # Too many values
- end;
-
- insert into test.t1 values ("hndlr2", x);
-end|
-
-call hndlr2(42)|
-select * from t1|
-delete from t1|
-drop procedure hndlr2|
-
-
---disable_warnings
-drop procedure if exists hndlr3|
---enable_warnings
-create procedure hndlr3(val int)
-begin
- declare x int default 0;
- declare continue handler for sqlexception # Any error
- begin
- declare z int;
-
- set z = 2 * val;
- set x = 1;
- end;
-
- if val < 10 then
- begin
- declare y int;
-
- set y = val + 10;
- insert into test.t1 values ("hndlr3", y, 2); # Too many values
- if x then
- insert into test.t1 values ("hndlr3", y);
- end if;
- end;
- end if;
-end|
-
-call hndlr3(3)|
-select * from t1|
-delete from t1|
-drop procedure hndlr3|
-
-
-# Variables might be uninitialized when using handlers
-# (Otherwise the compiler can detect if a variable is not set, but
-# not in this case.)
-create table t3 ( id char(16), data int )|
-
---disable_warnings
-drop procedure if exists hndlr4|
---enable_warnings
-create procedure hndlr4()
-begin
- declare x int default 0;
- declare val int; # No default
- declare continue handler for sqlstate '02000' set x=1;
-
- select data into val from test.t3 where id='z' limit 1; # No hits
-
- insert into test.t3 values ('z', val);
-end|
-
-call hndlr4()|
-select * from t3|
-drop table t3|
-drop procedure hndlr4|
-
-
-#
-# Cursors
-#
---disable_warnings
-drop procedure if exists cur1|
---enable_warnings
-create procedure cur1()
-begin
- declare a char(16);
- declare b int;
- declare c double;
- declare done int default 0;
- declare c cursor for select * from test.t2;
- declare continue handler for sqlstate '02000' set done = 1;
-
- open c;
- repeat
- fetch c into a, b, c;
- if not done then
- insert into test.t1 values (a, b+c);
- end if;
- until done end repeat;
- close c;
-end|
-
-insert into t2 values ("foo", 42, -1.9), ("bar", 3, 12.1), ("zap", 666, -3.14)|
-call cur1()|
-select * from t1|
-drop procedure cur1|
-
-create table t3 ( s char(16), i int )|
-
---disable_warnings
-drop procedure if exists cur2|
---enable_warnings
-create procedure cur2()
-begin
- declare done int default 0;
- declare c1 cursor for select id,data from test.t1 order by id,data;
- declare c2 cursor for select i from test.t2 order by i;
- declare continue handler for sqlstate '02000' set done = 1;
-
- open c1;
- open c2;
- repeat
- begin
- declare a char(16);
- declare b,c int;
-
- fetch from c1 into a, b;
- fetch next from c2 into c;
- if not done then
- if b < c then
- insert into test.t3 values (a, b);
- else
- insert into test.t3 values (a, c);
- end if;
- end if;
- end;
- until done end repeat;
- close c1;
- close c2;
-end|
-
-call cur2()|
-select * from t3 order by i,s|
-delete from t1|
-delete from t2|
-drop table t3|
-drop procedure cur2|
-
-
-# The few characteristics we parse
---disable_warnings
-drop procedure if exists chistics|
---enable_warnings
-create procedure chistics()
- language sql
- modifies sql data
- not deterministic
- sql security definer
- comment 'Characteristics procedure test'
- insert into t1 values ("chistics", 1)|
-
-show create procedure chistics|
-# Call it, just to make sure.
-call chistics()|
-select * from t1|
-delete from t1|
-alter procedure chistics sql security invoker|
-show create procedure chistics|
-drop procedure chistics|
-
---disable_warnings
-drop function if exists chistics|
---enable_warnings
-create function chistics() returns int
- language sql
- deterministic
- sql security invoker
- comment 'Characteristics procedure test'
- return 42|
-
-show create function chistics|
-# Call it, just to make sure.
-select chistics()|
-alter function chistics
- no sql
- comment 'Characteristics function test'|
-show create function chistics|
-drop function chistics|
-
-
-# Check mode settings
-insert into t1 values ("foo", 1), ("bar", 2), ("zip", 3)|
-
-set @@sql_mode = 'ANSI'|
-delimiter $|
---disable_warnings
-drop procedure if exists modes$
---enable_warnings
-create procedure modes(out c1 int, out c2 int)
-begin
- declare done int default 0;
- declare x int;
- declare c cursor for select data from t1;
- declare continue handler for sqlstate '02000' set done = 1;
-
- select 1 || 2 into c1;
- set c2 = 0;
- open c;
- repeat
- fetch c into x;
- if not done then
- set c2 = c2 + 1;
- end if;
- until done end repeat;
- close c;
-end$
-delimiter |$
-set @@sql_mode = ''|
-
-set sql_select_limit = 1|
-call modes(@c1, @c2)|
-set sql_select_limit = default|
-
-select @c1, @c2|
-delete from t1|
-drop procedure modes|
-
-
-# Check that dropping a database without routines works.
-# (Dropping with routines is tested in sp-security.test)
-# First an empty db.
-create database sp_db1|
-drop database sp_db1|
-
-# Again, with a table.
-create database sp_db2|
-use sp_db2|
-# Just put something in here...
-create table t3 ( s char(4), t int )|
-insert into t3 values ("abcd", 42), ("dcba", 666)|
-use test|
-drop database sp_db2|
-
-# And yet again, with just a procedure.
-create database sp_db3|
-use sp_db3|
---disable_warnings
-drop procedure if exists dummy|
---enable_warnings
-create procedure dummy(out x int)
- set x = 42|
-use test|
-drop database sp_db3|
-# Check that it's gone
-select type,db,name from mysql.proc where db = 'sp_db3'|
-
-
-# ROW_COUNT() function after a CALL
-# We test the other cases here too, although it's not strictly SP specific
---disable_warnings
-drop procedure if exists rc|
---enable_warnings
-create procedure rc()
-begin
- delete from t1;
- insert into t1 values ("a", 1), ("b", 2), ("c", 3);
-end|
-
-call rc()|
-select row_count()|
---disable_ps_protocol
-update t1 set data=42 where id = "b";
-select row_count()|
---enable_ps_protocol
-delete from t1|
-select row_count()|
-delete from t1|
-select row_count()|
-select * from t1|
-select row_count()|
-drop procedure rc|
-
-
-#
-# Let us test how well new locking scheme works.
-#
-
-# Let us prepare playground
---disable_warnings
-drop function if exists f0|
-drop function if exists f1|
-drop function if exists f2|
-drop function if exists f3|
-drop function if exists f4|
-drop function if exists f5|
-drop function if exists f6|
-drop function if exists f7|
-drop function if exists f8|
-drop function if exists f9|
-drop function if exists f10|
-drop function if exists f11|
-drop function if exists f12_1|
-drop function if exists f12_2|
-drop view if exists v0|
-drop view if exists v1|
-drop view if exists v2|
---enable_warnings
-delete from t1|
-delete from t2|
-insert into t1 values ("a", 1), ("b", 2) |
-insert into t2 values ("a", 1, 1.0), ("b", 2, 2.0), ("c", 3, 3.0) |
-
-# Test the simplest function using tables
-create function f1() returns int
- return (select sum(data) from t1)|
-select f1()|
-# This should work too (and give 2 rows as result)
-select id, f1() from t1 order by id|
-
-# Function which uses two instances of table simultaneously
-create function f2() returns int
- return (select data from t1 where data <= (select sum(data) from t1) order by data limit 1)|
-select f2()|
-select id, f2() from t1 order by id|
-
-# Function which uses the same table twice in different queries
-create function f3() returns int
-begin
- declare n int;
- declare m int;
- set n:= (select min(data) from t1);
- set m:= (select max(data) from t1);
- return n < m;
-end|
-select f3()|
-select id, f3() from t1 order by id|
-
-# Calling two functions using same table
-select f1(), f3()|
-select id, f1(), f3() from t1 order by id|
-
-# Function which uses two different tables
-create function f4() returns double
- return (select d from t1, t2 where t1.data = t2.i and t1.id= "b")|
-select f4()|
-select s, f4() from t2 order by s|
-
-# Recursive functions which due to this recursion require simultaneous
-# access to several instance of the same table won't work
-create function f5(i int) returns int
-begin
- if i <= 0 then
- return 0;
- elseif i = 1 then
- return (select count(*) from t1 where data = i);
- else
- return (select count(*) + f5( i - 1) from t1 where data = i);
- end if;
-end|
-select f5(1)|
-# Since currently recursive functions are disallowed ER_SP_NO_RECURSION
-# error will be returned, once we will allow them error about
-# insufficient number of locked tables will be returned instead.
---error ER_SP_NO_RECURSION
-select f5(2)|
---error ER_SP_NO_RECURSION
-select f5(3)|
-
-# OTOH this should work
-create function f6() returns int
-begin
- declare n int;
- set n:= f1();
- return (select count(*) from t1 where data <= f7() and data <= n);
-end|
-create function f7() returns int
- return (select sum(data) from t1 where data <= f1())|
-select f6()|
-select id, f6() from t1 order by id|
-
-#
-# Let us test how new locking work with views
-#
-# The most trivial view
-create view v1 (a) as select f1()|
-select * from v1|
-select id, a from t1, v1 order by id|
-select * from v1, v1 as v|
-# A bit more complex construction
-create view v2 (a) as select a*10 from v1|
-select * from v2|
-select id, a from t1, v2 order by id|
-select * from v1, v2|
-
-# Nice example where the same view is used on
-# on different expression levels
-create function f8 () returns int
- return (select count(*) from v2)|
-
-select *, f8() from v1|
-
-# Let us test what will happen if function is missing
-drop function f1|
---error ER_VIEW_INVALID
-select * from v1|
-
-# And what will happen if we have recursion which involves
-# views and functions ?
-create function f1() returns int
- return (select sum(data) from t1) + (select sum(data) from v1)|
---error ER_SP_NO_RECURSION
-select f1()|
---error ER_SP_NO_RECURSION
-select * from v1|
---error ER_SP_NO_RECURSION
-select * from v2|
-# Back to the normal cases
-drop function f1|
-create function f1() returns int
- return (select sum(data) from t1)|
-
-# Let us also test some weird cases where no real tables is used
-create function f0() returns int
- return (select * from (select 100) as r)|
-select f0()|
-select *, f0() from (select 1) as t|
-create view v0 as select f0()|
-select * from v0|
-select *, f0() from v0|
-
-#
-# Let us test how well prelocking works with explicit LOCK TABLES.
-#
-lock tables t1 read, t1 as t11 read|
-# These should work well
-select f3()|
-select id, f3() from t1 as t11 order by id|
-# Degenerate cases work too :)
-select f0()|
-# But these should not (particularly views should be locked explicitly).
---error ER_TABLE_NOT_LOCKED
-select * from v0|
---error ER_TABLE_NOT_LOCKED
-select *, f0() from v0, (select 123) as d1|
---error ER_TABLE_NOT_LOCKED
-select id, f3() from t1|
---error ER_TABLE_NOT_LOCKED
-select f4()|
-unlock tables|
-
-# Let us test how LOCK TABLES which implicitly depends on functions
-# works
-lock tables v2 read, mysql.proc read|
-select * from v2|
-select * from v1|
-# These should not work as we have too little instances of tables locked
---error ER_TABLE_NOT_LOCKED
-select * from v1, t1|
---error ER_TABLE_NOT_LOCKED
-select f4()|
-unlock tables|
-
-# Tests for handling of temporary tables in functions.
-#
-# Unlike for permanent tables we should be able to create, use
-# and drop such tables in functions.
-#
-# Simplest function using temporary table. It is also test case for bug
-# #12198 "Temporary table aliasing does not work inside stored functions"
-create function f9() returns int
-begin
- declare a, b int;
- drop temporary table if exists t3;
- create temporary table t3 (id int);
- insert into t3 values (1), (2), (3);
- set a:= (select count(*) from t3);
- set b:= (select count(*) from t3 t3_alias);
- return a + b;
-end|
-# This will emit warning as t3 was not existing before.
-select f9()|
-select f9() from t1 limit 1|
-
-# Function which uses both temporary and permanent tables.
-create function f10() returns int
-begin
- drop temporary table if exists t3;
- create temporary table t3 (id int);
- insert into t3 select id from t4;
- return (select count(*) from t3);
-end|
-# Check that we don't ignore completely tables used in function
---error ER_NO_SUCH_TABLE
-select f10()|
-create table t4 as select 1 as id|
-select f10()|
-
-create function f11() returns int
-begin
- drop temporary table if exists t3;
- create temporary table t3 (id int);
- insert into t3 values (1), (2), (3);
- return (select count(*) from t3 as a, t3 as b);
-end|
-select f11()|
-select f11() from t1|
-# Test that using a single table instance at a time works
-create function f12_1() returns int
-begin
- drop temporary table if exists t3;
- create temporary table t3 (id int);
- insert into t3 values (1), (2), (3);
- return f12_2();
-end|
-create function f12_2() returns int
- return (select count(*) from t3)|
-
-drop temporary table t3|
-select f12_1()|
-drop temporary table t3|
-select f12_1() from t1 limit 1|
-
-# Cleanup
-drop function f0|
-drop function f1|
-drop function f2|
-drop function f3|
-drop function f4|
-drop function f5|
-drop function f6|
-drop function f7|
-drop function f8|
-drop function f9|
-drop function f10|
-drop function f11|
-drop function f12_1|
-drop function f12_2|
-drop view v0|
-drop view v1|
-drop view v2|
-truncate table t1 |
-truncate table t2 |
-drop table t4|
-
-# End of non-bug tests
-
-
-#
-# Some "real" examples
-#
-
-# fac
-
---disable_warnings
-drop table if exists t3|
---enable_warnings
-create table t3 (n int unsigned not null primary key, f bigint unsigned)|
-
---disable_warnings
-drop procedure if exists ifac|
---enable_warnings
-create procedure ifac(n int unsigned)
-begin
- declare i int unsigned default 1;
-
- if n > 20 then
- set n = 20; # bigint overflow otherwise
- end if;
- while i <= n do
- begin
- insert into test.t3 values (i, fac(i));
- set i = i + 1;
- end;
- end while;
-end|
-
-call ifac(20)|
-select * from t3|
-drop table t3|
---replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
-show function status like '%f%'|
-drop procedure ifac|
-drop function fac|
---replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
-show function status like '%f%'|
-
-
-# primes
-
---disable_warnings
-drop table if exists t3|
---enable_warnings
-
-create table t3 (
- i int unsigned not null primary key,
- p bigint unsigned not null
-)|
-
-insert into t3 values
- ( 0, 3), ( 1, 5), ( 2, 7), ( 3, 11), ( 4, 13),
- ( 5, 17), ( 6, 19), ( 7, 23), ( 8, 29), ( 9, 31),
- (10, 37), (11, 41), (12, 43), (13, 47), (14, 53),
- (15, 59), (16, 61), (17, 67), (18, 71), (19, 73),
- (20, 79), (21, 83), (22, 89), (23, 97), (24, 101),
- (25, 103), (26, 107), (27, 109), (28, 113), (29, 127),
- (30, 131), (31, 137), (32, 139), (33, 149), (34, 151),
- (35, 157), (36, 163), (37, 167), (38, 173), (39, 179),
- (40, 181), (41, 191), (42, 193), (43, 197), (44, 199)|
-
---disable_warnings
-drop procedure if exists opp|
---enable_warnings
-create procedure opp(n bigint unsigned, out pp bool)
-begin
- declare r double;
- declare b, s bigint unsigned default 0;
-
- set r = sqrt(n);
-
- again:
- loop
- if s = 45 then
- set b = b+200, s = 0;
- else
- begin
- declare p bigint unsigned;
-
- select t.p into p from test.t3 t where t.i = s;
- if b+p > r then
- set pp = 1;
- leave again;
- end if;
- if mod(n, b+p) = 0 then
- set pp = 0;
- leave again;
- end if;
- set s = s+1;
- end;
- end if;
- end loop;
-end|
-
---disable_warnings
-drop procedure if exists ip|
---enable_warnings
-create procedure ip(m int unsigned)
-begin
- declare p bigint unsigned;
- declare i int unsigned;
-
- set i=45, p=201;
-
- while i < m do
- begin
- declare pp bool default 0;
-
- call opp(p, pp);
- if pp then
- insert into test.t3 values (i, p);
- set i = i+1;
- end if;
- set p = p+2;
- end;
- end while;
-end|
-show create procedure opp|
---replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
-show procedure status where name like '%p%' and db='test'|
-
-# This isn't the fastest way in the world to compute prime numbers, so
-# don't be too ambitious. ;-)
-call ip(200)|
-# We don't want to select the entire table here, just pick a few
-# examples.
-# The expected result is:
-# i p
-# --- ----
-# 45 211
-# 100 557
-# 199 1229
-select * from t3 where i=45 or i=100 or i=199|
-drop table t3|
-drop procedure opp|
-drop procedure ip|
---replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
-show procedure status where name like '%p%' and db='test'|
-
-
-#
-# Comment & suid
-#
-
---disable_warnings
-drop procedure if exists bar|
---enable_warnings
-create procedure bar(x char(16), y int)
- comment "111111111111" sql security invoker
- insert into test.t1 values (x, y)|
---replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
-show procedure status like 'bar'|
-alter procedure bar comment "2222222222" sql security definer|
-alter procedure bar comment "3333333333"|
-alter procedure bar|
-show create procedure bar|
---replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
-show procedure status like 'bar'|
-drop procedure bar|
-
-#
-# rexecution
-#
---disable_warnings
-drop procedure if exists p1|
---enable_warnings
-create procedure p1 ()
- select (select s1 from t3) from t3|
-
-create table t3 (s1 int)|
-
-call p1()|
-insert into t3 values (1)|
-call p1()|
-drop procedure p1|
-drop table t3|
-
-#
-# backticks
-#
---disable_warnings
-drop function if exists foo|
---enable_warnings
-create function `foo` () returns int
- return 5|
-select `foo` ()|
-drop function `foo`|
-
-#
-# Implicit LOCK/UNLOCK TABLES for table access in functions
-#
-
---disable_warnings
-drop function if exists t1max|
---enable_warnings
-create function t1max() returns int
-begin
- declare x int;
- select max(data) into x from t1;
- return x;
-end|
-
-insert into t1 values ("foo", 3), ("bar", 2), ("zip", 5), ("zap", 1)|
-select t1max()|
-drop function t1max|
-
-create table t3 (
- v char(16) not null primary key,
- c int unsigned not null
-)|
-
-create function getcount(s char(16)) returns int
-begin
- declare x int;
-
- select count(*) into x from t3 where v = s;
- if x = 0 then
- insert into t3 values (s, 1);
- else
- update t3 set c = c+1 where v = s;
- end if;
- return x;
-end|
-select * from t1 where data = getcount("bar")|
-select * from t3|
-select getcount("zip")|
-select getcount("zip")|
-select * from t3|
-select getcount(id) from t1 where data = 3|
-select getcount(id) from t1 where data = 5|
-select * from t3|
-drop table t3|
-drop function getcount|
-
-
-# Test cases for different combinations of condition handlers in nested
-# begin-end blocks in stored procedures.
-#
-# Note that the standard specifies that the most specific handler should
-# be triggered even if it's an outer handler masked by a less specific
-# handler in an inner block.
-# Note also that '02000' is more specific than NOT FOUND; there might be
-# other '02xxx' states, even if we currently do not issue them in any
-# situation (e.g. '02001').
-#
-# The combinations we test are these:
-#
-# Inner
-# errcode sqlstate not found sqlwarning sqlexception
-# Outer +------------+------------+------------+------------+------------+
-#errcode | h_ee (i) | h_es (o) | h_en (o) | h_ew (o) | h_ex (o) |
-#sqlstate | h_se (i) | h_ss (i) | h_sn (o) | h_sw (o) | h_sx (o) |
-#not found | h_ne (i) | h_ns (i) | h_nn (i) | | |
-#sqlwarning | h_we (i) | h_ws (i) | | h_ww (i) | |
-#sqlexception | h_xe (i) | h_xs (i) | | | h_xx (i) |
-# +------------+---------------------------------------------------+
-#
-# (i) means that the inner handler is the one that should be invoked,
-# (o) means that the outer handler should be invoked.
-#
-# ('not found', 'sqlwarning' and 'sqlexception' are mutually exclusive, hence
-# no tests for those combinations.)
-#
-
---disable_warnings
-drop table if exists t3|
-drop procedure if exists h_ee|
-drop procedure if exists h_es|
-drop procedure if exists h_en|
-drop procedure if exists h_ew|
-drop procedure if exists h_ex|
-drop procedure if exists h_se|
-drop procedure if exists h_ss|
-drop procedure if exists h_sn|
-drop procedure if exists h_sw|
-drop procedure if exists h_sx|
-drop procedure if exists h_ne|
-drop procedure if exists h_ns|
-drop procedure if exists h_nn|
-drop procedure if exists h_we|
-drop procedure if exists h_ws|
-drop procedure if exists h_ww|
-drop procedure if exists h_xe|
-drop procedure if exists h_xs|
-drop procedure if exists h_xx|
---enable_warnings
-
-# smallint - to get out of range warnings
-# primary key - to get constraint errors
-create table t3 (a smallint primary key)|
-
-insert into t3 (a) values (1)|
-
-create procedure h_ee()
- deterministic
-begin
- declare continue handler for 1062 -- ER_DUP_ENTRY
- select 'Outer (bad)' as 'h_ee';
-
- begin
- declare continue handler for 1062 -- ER_DUP_ENTRY
- select 'Inner (good)' as 'h_ee';
-
- insert into t3 values (1);
- end;
-end|
-
-create procedure h_es()
- deterministic
-begin
- declare continue handler for 1062 -- ER_DUP_ENTRY
- select 'Outer (good)' as 'h_es';
-
- begin
- -- integrity constraint violation
- declare continue handler for sqlstate '23000'
- select 'Inner (bad)' as 'h_es';
-
- insert into t3 values (1);
- end;
-end|
-
-create procedure h_en()
- deterministic
-begin
- declare continue handler for 1329 -- ER_SP_FETCH_NO_DATA
- select 'Outer (good)' as 'h_en';
-
- begin
- declare x int;
- declare continue handler for sqlstate '02000' -- no data
- select 'Inner (bad)' as 'h_en';
-
- select a into x from t3 where a = 42;
- end;
-end|
-
-create procedure h_ew()
- deterministic
-begin
- declare continue handler for 1264 -- ER_WARN_DATA_OUT_OF_RANGE
- select 'Outer (good)' as 'h_ew';
-
- begin
- declare continue handler for sqlwarning
- select 'Inner (bad)' as 'h_ew';
-
- insert into t3 values (123456789012);
- end;
- delete from t3;
- insert into t3 values (1);
-end|
-
-create procedure h_ex()
- deterministic
-begin
- declare continue handler for 1062 -- ER_DUP_ENTRY
- select 'Outer (good)' as 'h_ex';
-
- begin
- declare continue handler for sqlexception
- select 'Inner (bad)' as 'h_ex';
-
- insert into t3 values (1);
- end;
-end|
-
-create procedure h_se()
- deterministic
-begin
- -- integrity constraint violation
- declare continue handler for sqlstate '23000'
- select 'Outer (bad)' as 'h_se';
-
- begin
- declare continue handler for 1062 -- ER_DUP_ENTRY
- select 'Inner (good)' as 'h_se';
-
- insert into t3 values (1);
- end;
-end|
-
-create procedure h_ss()
- deterministic
-begin
- -- integrity constraint violation
- declare continue handler for sqlstate '23000'
- select 'Outer (bad)' as 'h_ss';
-
- begin
- -- integrity constraint violation
- declare continue handler for sqlstate '23000'
- select 'Inner (good)' as 'h_ss';
-
- insert into t3 values (1);
- end;
-end|
-
-create procedure h_sn()
- deterministic
-begin
- -- Note: '02000' is more specific than NOT FOUND ;
- -- there might be other not found states
- declare continue handler for sqlstate '02000' -- no data
- select 'Outer (good)' as 'h_sn';
-
- begin
- declare x int;
- declare continue handler for not found
- select 'Inner (bad)' as 'h_sn';
-
- select a into x from t3 where a = 42;
- end;
-end|
-
-create procedure h_sw()
- deterministic
-begin
- -- data exception - numeric value out of range
- declare continue handler for sqlstate '22003'
- select 'Outer (good)' as 'h_sw';
-
- begin
- declare continue handler for sqlwarning
- select 'Inner (bad)' as 'h_sw';
-
- insert into t3 values (123456789012);
- end;
- delete from t3;
- insert into t3 values (1);
-end|
-
-create procedure h_sx()
- deterministic
-begin
- -- integrity constraint violation
- declare continue handler for sqlstate '23000'
- select 'Outer (good)' as 'h_sx';
-
- begin
- declare continue handler for sqlexception
- select 'Inner (bad)' as 'h_sx';
-
- insert into t3 values (1);
- end;
-end|
-
-create procedure h_ne()
- deterministic
-begin
- declare continue handler for not found
- select 'Outer (bad)' as 'h_ne';
-
- begin
- declare x int;
- declare continue handler for 1329 -- ER_SP_FETCH_NO_DATA
- select 'Inner (good)' as 'h_ne';
-
- select a into x from t3 where a = 42;
- end;
-end|
-
-create procedure h_ns()
- deterministic
-begin
- declare continue handler for not found
- select 'Outer (bad)' as 'h_ns';
-
- begin
- declare x int;
- declare continue handler for sqlstate '02000' -- no data
- select 'Inner (good)' as 'h_ns';
-
- select a into x from t3 where a = 42;
- end;
-end|
-
-create procedure h_nn()
- deterministic
-begin
- declare continue handler for not found
- select 'Outer (bad)' as 'h_nn';
-
- begin
- declare x int;
- declare continue handler for not found
- select 'Inner (good)' as 'h_nn';
-
- select a into x from t3 where a = 42;
- end;
-end|
-
-create procedure h_we()
- deterministic
-begin
- declare continue handler for sqlwarning
- select 'Outer (bad)' as 'h_we';
-
- begin
- declare continue handler for 1264 -- ER_WARN_DATA_OUT_OF_RANGE
- select 'Inner (good)' as 'h_we';
-
- insert into t3 values (123456789012);
- end;
- delete from t3;
- insert into t3 values (1);
-end|
-
-create procedure h_ws()
- deterministic
-begin
- declare continue handler for sqlwarning
- select 'Outer (bad)' as 'h_ws';
-
- begin
- -- data exception - numeric value out of range
- declare continue handler for sqlstate '22003'
- select 'Inner (good)' as 'h_ws';
-
- insert into t3 values (123456789012);
- end;
- delete from t3;
- insert into t3 values (1);
-end|
-
-create procedure h_ww()
- deterministic
-begin
- declare continue handler for sqlwarning
- select 'Outer (bad)' as 'h_ww';
-
- begin
- declare continue handler for sqlwarning
- select 'Inner (good)' as 'h_ww';
-
- insert into t3 values (123456789012);
- end;
- delete from t3;
- insert into t3 values (1);
-end|
-
-create procedure h_xe()
- deterministic
-begin
- declare continue handler for sqlexception
- select 'Outer (bad)' as 'h_xe';
-
- begin
- declare continue handler for 1062 -- ER_DUP_ENTRY
- select 'Inner (good)' as 'h_xe';
-
- insert into t3 values (1);
- end;
-end|
-
-create procedure h_xs()
- deterministic
-begin
- declare continue handler for sqlexception
- select 'Outer (bad)' as 'h_xs';
-
- begin
- -- integrity constraint violation
- declare continue handler for sqlstate '23000'
- select 'Inner (good)' as 'h_xs';
-
- insert into t3 values (1);
- end;
-end|
-
-create procedure h_xx()
- deterministic
-begin
- declare continue handler for sqlexception
- select 'Outer (bad)' as 'h_xx';
-
- begin
- declare continue handler for sqlexception
- select 'Inner (good)' as 'h_xx';
-
- insert into t3 values (1);
- end;
-end|
-
-call h_ee()|
-call h_es()|
-call h_en()|
-call h_ew()|
-call h_ex()|
-call h_se()|
-call h_ss()|
-call h_sn()|
-call h_sw()|
-call h_sx()|
-call h_ne()|
-call h_ns()|
-call h_nn()|
-call h_we()|
-call h_ws()|
-call h_ww()|
-call h_xe()|
-call h_xs()|
-call h_xx()|
-
-drop table t3|
-drop procedure h_ee|
-drop procedure h_es|
-drop procedure h_en|
-drop procedure h_ew|
-drop procedure h_ex|
-drop procedure h_se|
-drop procedure h_ss|
-drop procedure h_sn|
-drop procedure h_sw|
-drop procedure h_sx|
-drop procedure h_ne|
-drop procedure h_ns|
-drop procedure h_nn|
-drop procedure h_we|
-drop procedure h_ws|
-drop procedure h_ww|
-drop procedure h_xe|
-drop procedure h_xs|
-drop procedure h_xx|
-
-
-#
-# Test cases for old bugs
-#
-
-#
-# BUG#822
-#
---disable_warnings
-drop procedure if exists bug822|
---enable_warnings
-create procedure bug822(a_id char(16), a_data int)
-begin
- declare n int;
- select count(*) into n from t1 where id = a_id and data = a_data;
- if n = 0 then
- insert into t1 (id, data) values (a_id, a_data);
- end if;
-end|
-
-delete from t1|
-call bug822('foo', 42)|
-call bug822('foo', 42)|
-call bug822('bar', 666)|
-select * from t1 order by data|
-delete from t1|
-drop procedure bug822|
-
-#
-# BUG#1495
-#
---disable_warnings
-drop procedure if exists bug1495|
---enable_warnings
-create procedure bug1495()
-begin
- declare x int;
-
- select data into x from t1 order by id limit 1;
- if x > 10 then
- insert into t1 values ("less", x-10);
- else
- insert into t1 values ("more", x+10);
- end if;
-end|
-
-insert into t1 values ('foo', 12)|
-call bug1495()|
-delete from t1 where id='foo'|
-insert into t1 values ('bar', 7)|
-call bug1495()|
-delete from t1 where id='bar'|
-select * from t1 order by data|
-delete from t1|
-drop procedure bug1495|
-
-#
-# BUG#1547
-#
---disable_warnings
-drop procedure if exists bug1547|
---enable_warnings
-create procedure bug1547(s char(16))
-begin
- declare x int;
-
- select data into x from t1 where s = id limit 1;
- if x > 10 then
- insert into t1 values ("less", x-10);
- else
- insert into t1 values ("more", x+10);
- end if;
-end|
-
-insert into t1 values ("foo", 12), ("bar", 7)|
-call bug1547("foo")|
-call bug1547("bar")|
-select * from t1 order by id|
-delete from t1|
-drop procedure bug1547|
-
-#
-# BUG#1656
-#
---disable_warnings
-drop table if exists t70|
---enable_warnings
-create table t70 (s1 int,s2 int)|
-insert into t70 values (1,2)|
-
---disable_warnings
-drop procedure if exists bug1656|
---enable_warnings
-create procedure bug1656(out p1 int, out p2 int)
- select * into p1, p1 from t70|
-
-call bug1656(@1, @2)|
-select @1, @2|
-drop table t70|
-drop procedure bug1656|
-
-#
-# BUG#1862
-#
-create table t3(a int)|
-
---disable_warnings
-drop procedure if exists bug1862|
---enable_warnings
-create procedure bug1862()
-begin
- insert into t3 values(2);
- flush tables;
-end|
-
-call bug1862()|
-# the second call caused a segmentation
-call bug1862()|
-select * from t3|
-drop table t3|
-drop procedure bug1862|
-
-#
-# BUG#1874
-#
---disable_warnings
-drop procedure if exists bug1874|
---enable_warnings
-create procedure bug1874()
-begin
- declare x int;
- declare y double;
- select max(data) into x from t1;
- insert into t2 values ("max", x, 0);
- select min(data) into x from t1;
- insert into t2 values ("min", x, 0);
- select sum(data) into x from t1;
- insert into t2 values ("sum", x, 0);
- select avg(data) into y from t1;
- insert into t2 values ("avg", 0, y);
-end|
-
-insert into t1 (data) values (3), (1), (5), (9), (4)|
-call bug1874()|
-select * from t2 order by i|
-delete from t1|
-delete from t2|
-drop procedure bug1874|
-
-#
-# BUG#2260
-#
---disable_warnings
-drop procedure if exists bug2260|
---enable_warnings
-create procedure bug2260()
-begin
- declare v1 int;
- declare c1 cursor for select data from t1;
- declare continue handler for not found set @x2 = 1;
-
- open c1;
- fetch c1 into v1;
- set @x2 = 2;
- close c1;
-end|
-
-call bug2260()|
-select @x2|
-drop procedure bug2260|
-
-#
-# BUG#2267 "Lost connect if stored procedure has SHOW FUNCTION STATUS"
-#
---disable_warnings
-drop procedure if exists bug2267_1|
---enable_warnings
-create procedure bug2267_1()
-begin
- show procedure status where db='test';
-end|
-
---disable_warnings
-drop procedure if exists bug2267_2|
---enable_warnings
-create procedure bug2267_2()
-begin
- show function status where db='test';
-end|
-
---disable_warnings
-drop procedure if exists bug2267_3|
---enable_warnings
-create procedure bug2267_3()
-begin
- show create procedure bug2267_1;
-end|
-
---disable_warnings
-drop procedure if exists bug2267_4|
-drop function if exists bug2267_4|
---enable_warnings
-create procedure bug2267_4()
-begin
- show create function bug2267_4;
-end|
-create function bug2267_4() returns int return 100|
-
---replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
-call bug2267_1()|
---replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
-call bug2267_2()|
-call bug2267_3()|
-call bug2267_4()|
-
-drop procedure bug2267_1|
-drop procedure bug2267_2|
-drop procedure bug2267_3|
-drop procedure bug2267_4|
-drop function bug2267_4|
-
-#
-# BUG#2227
-#
---disable_warnings
-drop procedure if exists bug2227|
---enable_warnings
-create procedure bug2227(x int)
-begin
- declare y float default 2.6;
- declare z char(16) default "zzz";
-
- select 1.3, x, y, 42, z;
-end|
-
-call bug2227(9)|
-drop procedure bug2227|
-
-#
-# BUG#2614 "Stored procedure with INSERT ... SELECT that does not
-# contain any tables crashes server"
-#
---disable_warnings
-drop procedure if exists bug2614|
---enable_warnings
-create procedure bug2614()
-begin
- drop table if exists t3;
- create table t3 (id int default '0' not null);
- insert into t3 select 12;
- insert into t3 select * from t3;
-end|
-
---disable_warnings
-call bug2614()|
---enable_warnings
-call bug2614()|
-drop table t3|
-drop procedure bug2614|
-
-#
-# BUG#2674
-#
---disable_warnings
-drop function if exists bug2674|
---enable_warnings
-create function bug2674() returns int
- return @@sort_buffer_size|
-
-set @osbs = @@sort_buffer_size|
-set @@sort_buffer_size = 262000|
-select bug2674()|
-drop function bug2674|
-set @@sort_buffer_size = @osbs|
-
-#
-# BUG#3259
-#
---disable_warnings
-drop procedure if exists bug3259_1 |
---enable_warnings
-create procedure bug3259_1 () begin end|
---disable_warnings
-drop procedure if exists BUG3259_2 |
---enable_warnings
-create procedure BUG3259_2 () begin end|
---disable_warnings
-drop procedure if exists Bug3259_3 |
---enable_warnings
-create procedure Bug3259_3 () begin end|
-
-call BUG3259_1()|
-call BUG3259_1()|
-call bug3259_2()|
-call Bug3259_2()|
-call bug3259_3()|
-call bUG3259_3()|
-
-drop procedure bUg3259_1|
-drop procedure BuG3259_2|
-drop procedure BUG3259_3|
-
-#
-# BUG#2772
-#
---disable_warnings
-drop function if exists bug2772|
---enable_warnings
-create function bug2772() returns char(10) character set latin2
- return 'a'|
-
-select bug2772()|
-drop function bug2772|
-
-#
-# BUG#2776
-#
---disable_warnings
-drop procedure if exists bug2776_1|
---enable_warnings
-create procedure bug2776_1(out x int)
-begin
- declare v int;
-
- set v = default;
- set x = v;
-end|
-
---disable_warnings
-drop procedure if exists bug2776_2|
---enable_warnings
-create procedure bug2776_2(out x int)
-begin
- declare v int default 42;
-
- set v = default;
- set x = v;
-end|
-
-set @x = 1|
-call bug2776_1(@x)|
-select @x|
-call bug2776_2(@x)|
-select @x|
-drop procedure bug2776_1|
-drop procedure bug2776_2|
-
-#
-# BUG#2780
-#
-create table t3 (s1 smallint)|
-
-insert into t3 values (123456789012)|
-
---disable_warnings
-drop procedure if exists bug2780|
---enable_warnings
-create procedure bug2780()
-begin
- declare exit handler for sqlwarning set @x = 1;
-
- set @x = 0;
- insert into t3 values (123456789012);
- insert into t3 values (0);
-end|
-
-call bug2780()|
-select @x|
-select * from t3|
-
-drop procedure bug2780|
-drop table t3|
-
-#
-# BUG#1863
-#
-create table t3 (content varchar(10) )|
-insert into t3 values ("test1")|
-insert into t3 values ("test2")|
-create table t4 (f1 int, rc int, t3 int)|
-
---disable_warnings
-drop procedure if exists bug1863|
---enable_warnings
-create procedure bug1863(in1 int)
-begin
-
- declare ind int default 0;
- declare t1 int;
- declare t2 int;
- declare t3 int;
-
- declare rc int default 0;
- declare continue handler for 1065 set rc = 1;
-
- drop temporary table if exists temp_t1;
- create temporary table temp_t1 (
- f1 int auto_increment, f2 varchar(20), primary key (f1)
- );
-
- insert into temp_t1 (f2) select content from t3;
-
- select f2 into t3 from temp_t1 where f1 = 10;
-
- if (rc) then
- insert into t4 values (1, rc, t3);
- end if;
-
- insert into t4 values (2, rc, t3);
-
-end|
-
-call bug1863(10)|
-call bug1863(10)|
-select * from t4|
-
-drop procedure bug1863|
-drop temporary table temp_t1;
-drop table t3, t4|
-
-#
-# BUG#2656
-#
-
-create table t3 (
- OrderID int not null,
- MarketID int,
- primary key (OrderID)
-)|
-
-create table t4 (
- MarketID int not null,
- Market varchar(60),
- Status char(1),
- primary key (MarketID)
-)|
-
-insert t3 (OrderID,MarketID) values (1,1)|
-insert t3 (OrderID,MarketID) values (2,2)|
-insert t4 (MarketID,Market,Status) values (1,"MarketID One","A")|
-insert t4 (MarketID,Market,Status) values (2,"MarketID Two","A")|
-
---disable_warnings
-drop procedure if exists bug2656_1|
---enable_warnings
-create procedure bug2656_1()
-begin
- select
- m.Market
- from t4 m JOIN t3 o
- ON o.MarketID != 1 and o.MarketID = m.MarketID;
-end |
-
---disable_warnings
-drop procedure if exists bug2656_2|
---enable_warnings
-create procedure bug2656_2()
-begin
- select
- m.Market
- from
- t4 m, t3 o
- where
- m.MarketID != 1 and m.MarketID = o.MarketID;
-
-end |
-
-call bug2656_1()|
-call bug2656_1()|
-call bug2656_2()|
-call bug2656_2()|
-drop procedure bug2656_1|
-drop procedure bug2656_2|
-drop table t3, t4|
-
-
-#
-# BUG#3426
-#
---disable_warnings
-drop procedure if exists bug3426|
---enable_warnings
-create procedure bug3426(in_time int unsigned, out x int)
-begin
- if in_time is null then
- set @stamped_time=10;
- set x=1;
- else
- set @stamped_time=in_time;
- set x=2;
- end if;
-end|
-
-# so that from_unixtime() has a deterministic result
-set time_zone='+03:00';
-
-call bug3426(1000, @i)|
-select @i, from_unixtime(@stamped_time, '%d-%m-%Y %h:%i:%s') as time|
-call bug3426(NULL, @i)|
-select @i, from_unixtime(@stamped_time, '%d-%m-%Y %h:%i:%s') as time|
-# Clear SP cache
-alter procedure bug3426 sql security invoker|
-call bug3426(NULL, @i)|
-select @i, from_unixtime(@stamped_time, '%d-%m-%Y %h:%i:%s') as time|
-call bug3426(1000, @i)|
-select @i, from_unixtime(@stamped_time, '%d-%m-%Y %h:%i:%s') as time|
-
-drop procedure bug3426|
-
-#
-# BUG#3734
-#
-create table t3 (
- id int unsigned auto_increment not null primary key,
- title VARCHAR(200),
- body text,
- fulltext (title,body)
-)|
-
-insert into t3 (title,body) values
- ('MySQL Tutorial','DBMS stands for DataBase ...'),
- ('How To Use MySQL Well','After you went through a ...'),
- ('Optimizing MySQL','In this tutorial we will show ...'),
- ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
- ('MySQL vs. YourSQL','In the following database comparison ...'),
- ('MySQL Security','When configured properly, MySQL ...')|
-
---disable_warnings
-drop procedure if exists bug3734 |
---enable_warnings
-create procedure bug3734 (param1 varchar(100))
- select * from t3 where match (title,body) against (param1)|
-
-call bug3734('database')|
-call bug3734('Security')|
-
-drop procedure bug3734|
-drop table t3|
-
-#
-# BUG#3863
-#
---disable_warnings
-drop procedure if exists bug3863|
---enable_warnings
-create procedure bug3863()
-begin
- set @a = 0;
- while @a < 5 do
- set @a = @a + 1;
- end while;
-end|
-
-call bug3863()|
-select @a|
-call bug3863()|
-select @a|
-
-drop procedure bug3863|
-
-#
-# BUG#2460
-#
-
-create table t3 (
- id int(10) unsigned not null default 0,
- rid int(10) unsigned not null default 0,
- msg text not null,
- primary key (id),
- unique key rid (rid, id)
-)|
-
---disable_warnings
-drop procedure if exists bug2460_1|
---enable_warnings
-create procedure bug2460_1(in v int)
-begin
- ( select n0.id from t3 as n0 where n0.id = v )
- union
- ( select n0.id from t3 as n0, t3 as n1
- where n0.id = n1.rid and n1.id = v )
- union
- ( select n0.id from t3 as n0, t3 as n1, t3 as n2
- where n0.id = n1.rid and n1.id = n2.rid and n2.id = v );
-end|
-
-call bug2460_1(2)|
-call bug2460_1(2)|
-insert into t3 values (1, 1, 'foo'), (2, 1, 'bar'), (3, 1, 'zip zap')|
-call bug2460_1(2)|
-call bug2460_1(2)|
-
---disable_warnings
-drop procedure if exists bug2460_2|
---enable_warnings
-create procedure bug2460_2()
-begin
- drop table if exists t3;
- create temporary table t3 (s1 int);
- insert into t3 select 1 union select 1;
-end|
-
-call bug2460_2()|
-call bug2460_2()|
-select * from t3|
-
-drop procedure bug2460_1|
-drop procedure bug2460_2|
-drop table t3|
-
-
-#
-# BUG#2564
-#
-set @@sql_mode = ''|
---disable_warnings
-drop procedure if exists bug2564_1|
---enable_warnings
-create procedure bug2564_1()
- comment 'Joe''s procedure'
- insert into `t1` values ("foo", 1)|
-
-set @@sql_mode = 'ANSI_QUOTES'|
---disable_warnings
-drop procedure if exists bug2564_2|
---enable_warnings
-create procedure bug2564_2()
- insert into "t1" values ('foo', 1)|
-
-delimiter $|
-set @@sql_mode = ''$
---disable_warnings
-drop function if exists bug2564_3$
---enable_warnings
-create function bug2564_3(x int, y int) returns int
- return x || y$
-
-set @@sql_mode = 'ANSI'$
---disable_warnings
-drop function if exists bug2564_4$
---enable_warnings
-create function bug2564_4(x int, y int) returns int
- return x || y$
-delimiter |$
-
-set @@sql_mode = ''|
-show create procedure bug2564_1|
-show create procedure bug2564_2|
-show create function bug2564_3|
-show create function bug2564_4|
-
-drop procedure bug2564_1|
-drop procedure bug2564_2|
-drop function bug2564_3|
-drop function bug2564_4|
-
-#
-# BUG#3132
-#
---disable_warnings
-drop function if exists bug3132|
---enable_warnings
-create function bug3132(s char(20)) returns char(50)
- return concat('Hello, ', s, '!')|
-
-select bug3132('Bob') union all select bug3132('Judy')|
-drop function bug3132|
-
-#
-# BUG#3843
-#
---disable_warnings
-drop procedure if exists bug3843|
---enable_warnings
-create procedure bug3843()
- analyze table t1|
-
-# Testing for packets out of order
-call bug3843()|
-call bug3843()|
-select 1+2|
-
-drop procedure bug3843|
-
-#
-# BUG#3368
-#
-create table t3 ( s1 char(10) )|
-insert into t3 values ('a'), ('b')|
-
---disable_warnings
-drop procedure if exists bug3368|
---enable_warnings
-create procedure bug3368(v char(10))
-begin
- select group_concat(v) from t3;
-end|
-
-call bug3368('x')|
-call bug3368('yz')|
-drop procedure bug3368|
-drop table t3|
-
-#
-# BUG#4579
-#
-create table t3 (f1 int, f2 int)|
-insert into t3 values (1,1)|
-
---disable_warnings
-drop procedure if exists bug4579_1|
---enable_warnings
-create procedure bug4579_1 ()
-begin
- declare sf1 int;
-
- select f1 into sf1 from t3 where f1=1 and f2=1;
- update t3 set f2 = f2 + 1 where f1=1 and f2=1;
- call bug4579_2();
-end|
-
---disable_warnings
-drop procedure if exists bug4579_2|
---enable_warnings
-create procedure bug4579_2 ()
-begin
-end|
-
-call bug4579_1()|
-call bug4579_1()|
-call bug4579_1()|
-
-drop procedure bug4579_1|
-drop procedure bug4579_2|
-drop table t3|
-
-#
-# BUG#2773: Function's data type ignored in stored procedures
-#
---disable_warnings
-drop procedure if exists bug2773|
---enable_warnings
-
-create function bug2773() returns int return null|
-create table t3 as select bug2773()|
-show create table t3|
-drop table t3|
-drop function bug2773|
-
-#
-# BUG#3788: Stored procedure packet error
-#
---disable_warnings
-drop procedure if exists bug3788|
---enable_warnings
-
-create function bug3788() returns date return cast("2005-03-04" as date)|
-select bug3788()|
-drop function bug3788|
-
-create function bug3788() returns binary(1) return 5|
-select bug3788()|
-drop function bug3788|
-
-
-#
-# BUG#4726
-#
-create table t3 (f1 int, f2 int, f3 int)|
-insert into t3 values (1,1,1)|
-
---disable_warnings
-drop procedure if exists bug4726|
---enable_warnings
-create procedure bug4726()
-begin
- declare tmp_o_id INT;
- declare tmp_d_id INT default 1;
-
- while tmp_d_id <= 2 do
- begin
- select f1 into tmp_o_id from t3 where f2=1 and f3=1;
- set tmp_d_id = tmp_d_id + 1;
- end;
- end while;
-end|
-
-call bug4726()|
-call bug4726()|
-call bug4726()|
-
-drop procedure bug4726|
-drop table t3|
-
-#
-# BUG#4318
-#
-
---disable_parsing # Don't know if HANDLER commands can work with SPs, or at all..
-create table t3 (s1 int)|
-insert into t3 values (3), (4)|
-
---disable_warnings
-drop procedure if exists bug4318|
---enable_warnings
-create procedure bug4318()
- handler t3 read next|
-
-handler t3 open|
-# Expect no results, as tables are closed, but there shouldn't be any errors
-call bug4318()|
-call bug4318()|
-handler t3 close|
-
-drop procedure bug4318|
-drop table t3|
---enable_parsing
-
-#
-# BUG#4902: Stored procedure with SHOW WARNINGS leads to packet error
-#
-# Added tests for most other show commands we could find too.
-# (Skipping those already tested, and the ones depending on optional handlers.)
-#
-# Note: This will return a large number of results of different formats,
-# which makes it impossible to filter with --replace_column.
-# It's possible that some of these are not deterministic across
-# platforms. If so, just remove the offending command.
-#
---disable_warnings
-drop procedure if exists bug4902|
---enable_warnings
-create procedure bug4902()
-begin
- show charset like 'foo';
- show collation like 'foo';
- show create table t1;
- show create database test;
- show databases like 'foo';
- show errors;
- show columns from t1;
- show keys from t1;
- show open tables like 'foo';
- # Removed because result will differ in embedded mode.
- #show privileges;
- show status like 'foo';
- show tables like 'foo';
- show variables like 'foo';
- show warnings;
-end|
---disable_parsing
---replace_regex /table_id: [0-9]+/table_id: #/
-show binlog events|
-show storage engines|
-show master status|
-show slave hosts|
-show slave status|
---enable_parsing
-
-call bug4902()|
-call bug4902()|
-
-drop procedure bug4902|
-
-#
-# BUG#4904
-#
---disable_warnings
-drop procedure if exists bug4904|
---enable_warnings
-create procedure bug4904()
-begin
- declare continue handler for sqlstate 'HY000' begin end;
-
- create table t2 as select * from t3;
-end|
-
--- error 1146
-call bug4904()|
-
-drop procedure bug4904|
-
-create table t3 (s1 char character set latin1, s2 char character set latin2)|
-
---disable_warnings
-drop procedure if exists bug4904|
---enable_warnings
-create procedure bug4904 ()
-begin
- declare continue handler for sqlstate 'HY000' begin end;
-
- select s1 from t3 union select s2 from t3;
-end|
-
-call bug4904()|
-
-drop procedure bug4904|
-drop table t3|
-
-#
-# BUG#336
-#
---disable_warnings
-drop procedure if exists bug336|
---enable_warnings
-create procedure bug336(out y int)
-begin
- declare x int;
- set x = (select sum(t.data) from test.t1 t);
- set y = x;
-end|
-
-insert into t1 values ("a", 2), ("b", 3)|
-call bug336(@y)|
-select @y|
-delete from t1|
-drop procedure bug336|
-
-#
-# BUG#3157
-#
---disable_warnings
-drop procedure if exists bug3157|
---enable_warnings
-create procedure bug3157()
-begin
- if exists(select * from t1) then
- set @n= @n + 1;
- end if;
- if (select count(*) from t1) then
- set @n= @n + 1;
- end if;
-end|
-
-set @n = 0|
-insert into t1 values ("a", 1)|
-call bug3157()|
-select @n|
-delete from t1|
-drop procedure bug3157|
-
-#
-# BUG#5251: mysql changes creation time of a procedure/function when altering
-#
---disable_warnings
-drop procedure if exists bug5251|
---enable_warnings
-create procedure bug5251()
-begin
-end|
-
-select created into @c1 from mysql.proc
- where db='test' and name='bug5251'|
---sleep 2
-alter procedure bug5251 comment 'foobar'|
-select count(*) from mysql.proc
- where db='test' and name='bug5251' and created = @c1|
-
-drop procedure bug5251|
-
-#
-# BUG#5279: Stored procedure packets out of order if CHECKSUM TABLE
-#
---disable_warnings
-drop procedure if exists bug5251|
---enable_warnings
-create procedure bug5251()
- checksum table t1|
-
-call bug5251()|
-call bug5251()|
-drop procedure bug5251|
-
-#
-# BUG#5287: Stored procedure crash if leave outside loop
-#
---disable_warnings
-drop procedure if exists bug5287|
---enable_warnings
-create procedure bug5287(param1 int)
-label1:
- begin
- declare c cursor for select 5;
-
- loop
- if param1 >= 0 then
- leave label1;
- end if;
- end loop;
-end|
-call bug5287(1)|
-drop procedure bug5287|
-
-
-#
-# BUG#5307: Stored procedure allows statement after BEGIN ... END
-#
---disable_warnings
-drop procedure if exists bug5307|
---enable_warnings
-create procedure bug5307()
-begin
-end; set @x = 3|
-
-call bug5307()|
-select @x|
-drop procedure bug5307|
-
-#
-# BUG#5258: Stored procedure modified date is 0000-00-00
-# (This was a design flaw)
---disable_warnings
-drop procedure if exists bug5258|
---enable_warnings
-create procedure bug5258()
-begin
-end|
-
---disable_warnings
-drop procedure if exists bug5258_aux|
---enable_warnings
-create procedure bug5258_aux()
-begin
- declare c, m char(19);
-
- select created,modified into c,m from mysql.proc where name = 'bug5258';
- if c = m then
- select 'Ok';
- else
- select c, m;
- end if;
-end|
-
-call bug5258_aux()|
-
-drop procedure bug5258|
-drop procedure bug5258_aux|
-
-#
-# BUG#4487: Stored procedure connection aborted if uninitialized char
-#
---disable_warnings
-drop function if exists bug4487|
---enable_warnings
-create function bug4487() returns char
-begin
- declare v char;
- return v;
-end|
-
-select bug4487()|
-drop function bug4487|
-
-
-#
-# BUG#4941: Stored procedure crash fetching null value into variable.
-#
---disable_warnings
-drop procedure if exists bug4941|
---enable_warnings
---disable_warnings
-drop procedure if exists bug4941|
---enable_warnings
-create procedure bug4941(out x int)
-begin
- declare c cursor for select i from t2 limit 1;
- open c;
- fetch c into x;
- close c;
-end|
-
-insert into t2 values (null, null, null)|
-set @x = 42|
-call bug4941(@x)|
-select @x|
-delete from t1|
-drop procedure bug4941|
-
-#
-# BUG#4905: Stored procedure doesn't clear for "Rows affected"
-#
---disable_warnings
-drop procedure if exists bug4905|
---enable_warnings
-
-create table t3 (s1 int,primary key (s1))|
-
---disable_warnings
-drop procedure if exists bug4905|
---enable_warnings
-create procedure bug4905()
-begin
- declare v int;
- declare continue handler for sqlstate '23000' set v = 5;
-
- insert into t3 values (1);
-end|
-
-call bug4905()|
-select row_count()|
-call bug4905()|
-select row_count()|
-call bug4905()|
-select row_count()|
-select * from t3|
-
-drop procedure bug4905|
-drop table t3|
-
-#
-# BUG#6022: Stored procedure shutdown problem with self-calling function.
-#
-
---disable_parsing # until we implement support for recursive stored functions.
---disable_warnings
-drop function if exists bug6022|
---enable_warnings
-
---disable_warnings
-drop function if exists bug6022|
---enable_warnings
-create function bug6022(x int) returns int
-begin
- if x < 0 then
- return 0;
- else
- return bug6022(x-1);
- end if;
-end|
-
-select bug6022(5)|
-drop function bug6022|
---enable_parsing
-
-#
-# BUG#6029: Stored procedure specific handlers should have priority
-#
---disable_warnings
-drop procedure if exists bug6029|
---enable_warnings
-
---disable_warnings
-drop procedure if exists bug6029|
---enable_warnings
-create procedure bug6029()
-begin
- declare exit handler for 1136 select '1136';
- declare exit handler for sqlstate '23000' select 'sqlstate 23000';
- declare continue handler for sqlexception select 'sqlexception';
-
- insert into t3 values (1);
- insert into t3 values (1,2);
-end|
-
-create table t3 (s1 int, primary key (s1))|
-insert into t3 values (1)|
-call bug6029()|
-delete from t3|
-call bug6029()|
-
-drop procedure bug6029|
-drop table t3|
-
-#
-# BUG#8540: Local variable overrides an alias
-#
---disable_warnings
-drop procedure if exists bug8540|
---enable_warnings
-
-create procedure bug8540()
-begin
- declare x int default 1;
- select x as y, x+0 as z;
-end|
-
-call bug8540()|
-drop procedure bug8540|
-
-#
-# BUG#6642: Stored procedure crash if expression with set function
-#
-create table t3 (s1 int)|
-
---disable_warnings
-drop procedure if exists bug6642|
---enable_warnings
-
-create procedure bug6642()
- select abs(count(s1)) from t3|
-
-call bug6642()|
-call bug6642()|
-drop procedure bug6642|
-
-#
-# BUG#7013: Stored procedure crash if group by ... with rollup
-#
-insert into t3 values (0),(1)|
---disable_warnings
-drop procedure if exists bug7013|
---enable_warnings
-create procedure bug7013()
- select s1,count(s1) from t3 group by s1 with rollup|
-call bug7013()|
-call bug7013()|
-drop procedure bug7013|
-
-#
-# BUG#7743: 'Lost connection to MySQL server during query' on Stored Procedure
-#
---disable_warnings
-drop table if exists t4|
---enable_warnings
-create table t4 (
- a mediumint(8) unsigned not null auto_increment,
- b smallint(5) unsigned not null,
- c char(32) not null,
- primary key (a)
-) engine=myisam default charset=latin1|
-insert into t4 values (1, 2, 'oneword')|
-insert into t4 values (2, 2, 'anotherword')|
-
---disable_warnings
-drop procedure if exists bug7743|
---enable_warnings
-create procedure bug7743 ( searchstring char(28) )
-begin
- declare var mediumint(8) unsigned;
- select a into var from t4 where b = 2 and c = binary searchstring limit 1;
- select var;
-end|
-
-call bug7743("oneword")|
-call bug7743("OneWord")|
-call bug7743("anotherword")|
-call bug7743("AnotherWord")|
-drop procedure bug7743|
-drop table t4|
-
-#
-# BUG#7992: SELECT .. INTO variable .. within Stored Procedure crashes
-# the server
-#
-delete from t3|
-insert into t3 values(1)|
-drop procedure if exists bug7992_1|
-drop procedure if exists bug7992_2|
-create procedure bug7992_1()
-begin
- declare i int;
- select max(s1)+1 into i from t3;
-end|
-create procedure bug7992_2()
- insert into t3 (s1) select max(t4.s1)+1 from t3 as t4|
-
-call bug7992_1()|
-call bug7992_1()|
-call bug7992_2()|
-call bug7992_2()|
-
-drop procedure bug7992_1|
-drop procedure bug7992_2|
-drop table t3|
-
-#
-# BUG#8116: calling simple stored procedure twice in a row results
-# in server crash
-#
-create table t3 ( userid bigint(20) not null default 0 )|
-
---disable_warnings
-drop procedure if exists bug8116|
---enable_warnings
-create procedure bug8116(in _userid int)
- select * from t3 where userid = _userid|
-
-call bug8116(42)|
-call bug8116(42)|
-drop procedure bug8116|
-drop table t3|
-
-#
-# BUG#6857: current_time() in STORED PROCEDURES
-#
---disable_warnings
-drop procedure if exists bug6857|
---enable_warnings
-create procedure bug6857()
-begin
- declare t0, t1 int;
- declare plus bool default 0;
- set t0 = unix_timestamp();
- select sleep(1.1);
- set t1 = unix_timestamp();
- if t1 > t0 then
- set plus = 1;
- end if;
- select plus;
-end|
-
-call bug6857()|
-
-drop procedure bug6857|
-
-#
-# BUG#8757: Stored Procedures: Scope of Begin and End Statements do not
-# work properly.
---disable_warnings
-drop procedure if exists bug8757|
---enable_warnings
-create procedure bug8757()
-begin
- declare x int;
- declare c1 cursor for select data from t1 limit 1;
-
- begin
- declare y int;
- declare c2 cursor for select i from t2 limit 1;
-
- open c2;
- fetch c2 into y;
- close c2;
- select 2,y;
- end;
- open c1;
- fetch c1 into x;
- close c1;
- select 1,x;
-end|
-
-delete from t1|
-delete from t2|
-insert into t1 values ("x", 1)|
-insert into t2 values ("y", 2, 0.0)|
-
-call bug8757()|
-
-delete from t1|
-delete from t2|
-drop procedure bug8757|
-
-
-#
-# BUG#8762: Stored Procedures: Inconsistent behavior
-# of DROP PROCEDURE IF EXISTS statement.
---disable_warnings
-drop procedure if exists bug8762|
---enable_warnings
-# Doesn't exist
-drop procedure if exists bug8762; create procedure bug8762() begin end|
-# Does exist
-drop procedure if exists bug8762; create procedure bug8762() begin end|
-drop procedure bug8762|
-
-
-#
-# BUG#5240: Stored procedure crash if function has cursor declaration
-#
---disable_warnings
-drop function if exists bug5240|
---enable_warnings
-create function bug5240 () returns int
-begin
- declare x int;
- declare c cursor for select data from t1 limit 1;
-
- open c;
- fetch c into x;
- close c;
- return x;
-end|
-
-delete from t1|
-insert into t1 values ("answer", 42)|
-select id, bug5240() from t1|
-drop function bug5240|
-
-#
-# BUG#7992: rolling back temporary Item tree changes in SP
-#
---disable_warnings
-drop procedure if exists p1|
---enable_warnings
-create table t3(id int)|
-insert into t3 values(1)|
-create procedure bug7992()
-begin
- declare i int;
- select max(id)+1 into i from t3;
-end|
-
-call bug7992()|
-call bug7992()|
-drop procedure bug7992|
-drop table t3|
-delimiter ;|
-
-#
-# BUG#8849: problem with insert statement with table alias's
-#
-# Rolling back changes to AND/OR structure of ON and WHERE clauses in SP
-#
-
-delimiter |;
-create table t3 (
- lpitnumber int(11) default null,
- lrecordtype int(11) default null
-)|
-
-create table t4 (
- lbsiid int(11) not null default '0',
- ltradingmodeid int(11) not null default '0',
- ltradingareaid int(11) not null default '0',
- csellingprice decimal(19,4) default null,
- primary key (lbsiid,ltradingmodeid,ltradingareaid)
-)|
-
-create table t5 (
- lbsiid int(11) not null default '0',
- ltradingareaid int(11) not null default '0',
- primary key (lbsiid,ltradingareaid)
-)|
-
---disable_warnings
-drop procedure if exists bug8849|
---enable_warnings
-create procedure bug8849()
-begin
- insert into t5
- (
- t5.lbsiid,
- t5.ltradingareaid
- )
- select distinct t3.lpitnumber, t4.ltradingareaid
- from
- t4 join t3 on
- t3.lpitnumber = t4.lbsiid
- and t3.lrecordtype = 1
- left join t4 as price01 on
- price01.lbsiid = t4.lbsiid and
- price01.ltradingmodeid = 1 and
- t4.ltradingareaid = price01.ltradingareaid;
-end|
-
-call bug8849()|
-call bug8849()|
-call bug8849()|
-drop procedure bug8849|
-drop tables t3,t4,t5|
-
-#
-# BUG#8937: Stored Procedure: AVG() works as SUM() in SELECT ... INTO statement
-#
---disable_warnings
-drop procedure if exists bug8937|
---enable_warnings
-create procedure bug8937()
-begin
- declare s,x,y,z int;
- declare a float;
-
- select sum(data),avg(data),min(data),max(data) into s,x,y,z from t1;
- select s,x,y,z;
- select avg(data) into a from t1;
- select a;
-end|
-
-delete from t1|
-insert into t1 (data) values (1), (2), (3), (4), (6)|
-call bug8937()|
-
-drop procedure bug8937|
-delete from t1|
-
-
-#
-# BUG#6900: Stored procedure inner handler ignored
-# BUG#9074: STORED PROC: The scope of every handler declared is not
-# properly applied
-#
---disable_warnings
-drop procedure if exists bug6900|
-drop procedure if exists bug9074|
-drop procedure if exists bug6900_9074|
---enable_warnings
-
-create table t3 (w char unique, x char)|
-insert into t3 values ('a', 'b')|
-
-create procedure bug6900()
-begin
- declare exit handler for sqlexception select '1';
-
- begin
- declare exit handler for sqlexception select '2';
-
- insert into t3 values ('x', 'y', 'z');
- end;
-end|
-
-create procedure bug9074()
-begin
- declare x1, x2, x3, x4, x5, x6 int default 0;
-
- begin
- declare continue handler for sqlstate '23000' set x5 = 1;
-
- insert into t3 values ('a', 'b');
- set x6 = 1;
- end;
-
- begin1_label:
- begin
- declare continue handler for sqlstate '23000' set x1 = 1;
-
- insert into t3 values ('a', 'b');
- set x2 = 1;
-
- begin2_label:
- begin
- declare exit handler for sqlstate '23000' set x3 = 1;
-
- set x4= 1;
- insert into t3 values ('a','b');
- set x4= 0;
- end begin2_label;
- end begin1_label;
-
- select x1, x2, x3, x4, x5, x6;
-end|
-
-create procedure bug6900_9074(z int)
-begin
- declare exit handler for sqlstate '23000' select '23000';
-
- begin
- declare exit handler for sqlexception select 'sqlexception';
-
- if z = 1 then
- insert into t3 values ('a', 'b');
- else
- insert into t3 values ('x', 'y', 'z');
- end if;
- end;
-end|
-
-call bug6900()|
-call bug9074()|
-call bug6900_9074(0)|
-call bug6900_9074(1)|
-
-drop procedure bug6900|
-drop procedure bug9074|
-drop procedure bug6900_9074|
-drop table t3|
-
-
-#
-# BUG#7185: Stored procedure crash if identifier is AVG
-#
---disable_warnings
-drop procedure if exists avg|
---enable_warnings
-create procedure avg ()
-begin
-end|
-
-call avg ()|
-drop procedure avg|
-
-
-#
-# BUG#6129: Stored procedure won't display @@sql_mode value
-#
---disable_warnings
-drop procedure if exists bug6129|
---enable_warnings
-set @old_mode= @@sql_mode;
-set @@sql_mode= "ERROR_FOR_DIVISION_BY_ZERO";
-create procedure bug6129()
- select @@sql_mode|
-call bug6129()|
-set @@sql_mode= "NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO"|
-call bug6129()|
-set @@sql_mode= "NO_ZERO_IN_DATE"|
-call bug6129()|
-set @@sql_mode=@old_mode;
-
-drop procedure bug6129|
-
-
-#
-# BUG#9856: Stored procedures: crash if handler for sqlexception, not found
-#
---disable_warnings
-drop procedure if exists bug9856|
---enable_warnings
-create procedure bug9856()
-begin
- declare v int;
- declare c cursor for select data from t1;
- declare exit handler for sqlexception, not found select '16';
-
- open c;
- fetch c into v;
- select v;
-end|
-
-delete from t1|
-call bug9856()|
-call bug9856()|
-drop procedure bug9856|
-
-
-#
-# BUG##9674: Stored Procs: Using declared vars in algebric operation causes
-# system crash.
-#
---disable_warnings
-drop procedure if exists bug9674_1|
-drop procedure if exists bug9674_2|
---enable_warnings
-create procedure bug9674_1(out arg int)
-begin
- declare temp_in1 int default 0;
- declare temp_fl1 int default 0;
-
- set temp_in1 = 100;
- set temp_fl1 = temp_in1/10;
- set arg = temp_fl1;
-end|
-
-create procedure bug9674_2()
-begin
- declare v int default 100;
-
- select v/10;
-end|
-
-call bug9674_1(@sptmp)|
-call bug9674_1(@sptmp)|
-select @sptmp|
-call bug9674_2()|
-call bug9674_2()|
-drop procedure bug9674_1|
-drop procedure bug9674_2|
-
-
-#
-# BUG#9598: stored procedure call within stored procedure overwrites IN variable
-#
---disable_warnings
-drop procedure if exists bug9598_1|
-drop procedure if exists bug9598_2|
---enable_warnings
-create procedure bug9598_1(in var_1 char(16),
- out var_2 integer, out var_3 integer)
-begin
- set var_2 = 50;
- set var_3 = 60;
-end|
-
-create procedure bug9598_2(in v1 char(16),
- in v2 integer,
- in v3 integer,
- in v4 integer,
- in v5 integer)
-begin
- select v1,v2,v3,v4,v5;
- call bug9598_1(v1,@tmp1,@tmp2);
- select v1,v2,v3,v4,v5;
-end|
-
-call bug9598_2('Test',2,3,4,5)|
-select @tmp1, @tmp2|
-
-drop procedure bug9598_1|
-drop procedure bug9598_2|
-
-
-#
-# BUG#9902: Crash with simple stored function using user defined variables
-#
---disable_warnings
-drop procedure if exists bug9902|
---enable_warnings
-create function bug9902() returns int(11)
-begin
- set @x = @x + 1;
- return @x;
-end|
-
---disable_query_log
---echo # Set query cache size, if we have query cache
-if (`select @@have_query_cache='YES'`) {
- set @qcs1 = @@query_cache_size|
- set global query_cache_size = 102400|
-}
---enable_query_log
-set @x = 1|
-insert into t1 values ("qc", 42)|
-select bug9902() from t1|
-select bug9902() from t1|
-select @x|
-
---echo # Restore the old query cache size
---disable_query_log
-if (`select @@have_query_cache='YES'`) {
- set global query_cache_size = @qcs1|
-}
---enable_query_log
-delete from t1|
-drop function bug9902|
-
-
-#
-# BUG#9102: Stored proccedures: function which returns blob causes crash
-#
---disable_warnings
-drop function if exists bug9102|
---enable_warnings
-create function bug9102() returns blob return 'a'|
-select bug9102()|
-drop function bug9102|
-
-
-#
-# BUG#7648: Stored procedure crash when invoking a function that returns a bit
-#
---disable_warnings
-drop function if exists bug7648|
---enable_warnings
-create function bug7648() returns bit(8) return 'a'|
-select bug7648()|
-drop function bug7648|
-
-
-#
-# BUG#9775: crash if create function that returns enum or set
-#
---disable_warnings
-drop function if exists bug9775|
---enable_warnings
-create function bug9775(v1 char(1)) returns enum('a','b') return v1|
-select bug9775('a'),bug9775('b'),bug9775('c')|
-drop function bug9775|
-create function bug9775(v1 int) returns enum('a','b') return v1|
-select bug9775(1),bug9775(2),bug9775(3)|
-drop function bug9775|
-
-create function bug9775(v1 char(1)) returns set('a','b') return v1|
-select bug9775('a'),bug9775('b'),bug9775('a,b'),bug9775('c')|
-drop function bug9775|
-create function bug9775(v1 int) returns set('a','b') return v1|
-select bug9775(1),bug9775(2),bug9775(3),bug9775(4)|
-drop function bug9775|
-
-
-#
-# BUG#8861: If Return is a YEAR data type, value is not shown in year format
-#
---disable_warnings
-drop function if exists bug8861|
---enable_warnings
-create function bug8861(v1 int) returns year return v1|
-select bug8861(05)|
-set @x = bug8861(05)|
-select @x|
-drop function bug8861|
-
-
-#
-# BUG#9004: Inconsistent behaviour of SP re. warnings
-#
---disable_warnings
-drop procedure if exists bug9004_1|
-drop procedure if exists bug9004_2|
---enable_warnings
-create procedure bug9004_1(x char(16))
-begin
- insert into t1 values (x, 42);
- insert into t1 values (x, 17);
-end|
-create procedure bug9004_2(x char(16))
- call bug9004_1(x)|
-
-# Truncation warnings expected...
-call bug9004_1('12345678901234567')|
-call bug9004_2('12345678901234567890')|
-
-delete from t1|
-drop procedure bug9004_1|
-drop procedure bug9004_2|
-
-#
-# BUG#7293: Stored procedure crash with soundex
-#
---disable_warnings
-drop procedure if exists bug7293|
---enable_warnings
-insert into t1 values ('secret', 0)|
-create procedure bug7293(p1 varchar(100))
-begin
- if exists (select id from t1 where soundex(p1)=soundex(id)) then
- select 'yes';
- end if;
-end;|
-call bug7293('secret')|
-call bug7293 ('secrete')|
-drop procedure bug7293|
-delete from t1|
-
-
-#
-# BUG#9841: Unexpected read lock when trying to update a view in a
-# stored procedure
-#
---disable_warnings
-drop procedure if exists bug9841|
-drop view if exists v1|
---enable_warnings
-
-create view v1 as select * from t1, t2 where id = s|
-create procedure bug9841 ()
- update v1 set data = 10|
-call bug9841()|
-
-drop view v1|
-drop procedure bug9841|
-
-
-#
-# BUG#5963 subqueries in SET/IF
-#
---disable_warnings
-drop procedure if exists bug5963|
---enable_warnings
-
-create procedure bug5963_1 () begin declare v int; set v = (select s1 from t3); select v; end;|
-create table t3 (s1 int)|
-insert into t3 values (5)|
-call bug5963_1()|
-call bug5963_1()|
-drop procedure bug5963_1|
-drop table t3|
-
-create procedure bug5963_2 (cfk_value int)
-begin
- if cfk_value in (select cpk from t3) then
- set @x = 5;
- end if;
- end;
-|
-create table t3 (cpk int)|
-insert into t3 values (1)|
-call bug5963_2(1)|
-call bug5963_2(1)|
-drop procedure bug5963_2|
-drop table t3|
-
-
-#
-# BUG#9559: Functions: Numeric Operations using -ve value gives incorrect
-# results.
-#
---disable_warnings
-drop function if exists bug9559|
---enable_warnings
-create function bug9559()
- returns int
-begin
- set @y = -6/2;
- return @y;
-end|
-
-select bug9559()|
-
-drop function bug9559|
-
-
-#
-# BUG#10961: Stored procedures: crash if select * from dual
-#
---disable_warnings
-drop procedure if exists bug10961|
---enable_warnings
-# "select * from dual" results in an error, so the cursor will not open
-create procedure bug10961()
-begin
- declare v char;
- declare x int;
- declare c cursor for select * from dual;
- declare continue handler for sqlexception select x;
-
- set x = 1;
- open c;
- set x = 2;
- fetch c into v;
- set x = 3;
- close c;
-end|
-
-call bug10961()|
-call bug10961()|
-
-drop procedure bug10961|
-
-#
-# BUG #6866: Second call of a stored procedure using a view with on expressions
-#
-
---disable_warnings
-DROP PROCEDURE IF EXISTS bug6866|
---enable_warnings
-
-DROP VIEW IF EXISTS tv|
-DROP TABLE IF EXISTS tt1,tt2,tt3|
-
-CREATE TABLE tt1 (a1 int, a2 int, a3 int, data varchar(10))|
-CREATE TABLE tt2 (a2 int, data2 varchar(10))|
-CREATE TABLE tt3 (a3 int, data3 varchar(10))|
-
-INSERT INTO tt1 VALUES (1, 1, 4, 'xx')|
-
-INSERT INTO tt2 VALUES (1, 'a')|
-INSERT INTO tt2 VALUES (2, 'b')|
-INSERT INTO tt2 VALUES (3, 'c')|
-
-INSERT INTO tt3 VALUES (4, 'd')|
-INSERT INTO tt3 VALUES (5, 'e')|
-INSERT INTO tt3 VALUES (6, 'f')|
-
-CREATE VIEW tv AS
-SELECT tt1.*, tt2.data2, tt3.data3
- FROM tt1 INNER JOIN tt2 ON tt1.a2 = tt2.a2
- LEFT JOIN tt3 ON tt1.a3 = tt3.a3
- ORDER BY tt1.a1, tt2.a2, tt3.a3|
-
-CREATE PROCEDURE bug6866 (_a1 int)
-BEGIN
-SELECT * FROM tv WHERE a1 = _a1;
-END|
-
-CALL bug6866(1)|
-CALL bug6866(1)|
-CALL bug6866(1)|
-
-DROP PROCEDURE bug6866;
-
-DROP VIEW tv|
-DROP TABLE tt1, tt2, tt3|
-
-#
-# BUG#10136: items cleunup
-#
---disable_warnings
-DROP PROCEDURE IF EXISTS bug10136|
---enable_warnings
-create table t3 ( name char(5) not null primary key, val float not null)|
-insert into t3 values ('aaaaa', 1), ('bbbbb', 2), ('ccccc', 3)|
-create procedure bug10136()
-begin
- declare done int default 3;
-
- repeat
- select * from t3;
- set done = done - 1;
- until done <= 0 end repeat;
-
-end|
-call bug10136()|
-call bug10136()|
-call bug10136()|
-drop procedure bug10136|
-drop table t3|
-
-#
-# BUG#11529: crash server after use stored procedure
-#
---disable_warnings
-drop procedure if exists bug11529|
---enable_warnings
-create procedure bug11529()
-begin
- declare c cursor for select id, data from t1 where data in (10,13);
-
- open c;
- begin
- declare vid char(16);
- declare vdata int;
- declare exit handler for not found begin end;
-
- while true do
- fetch c into vid, vdata;
- end while;
- end;
- close c;
-end|
-
-insert into t1 values
- ('Name1', 10),
- ('Name2', 11),
- ('Name3', 12),
- ('Name4', 13),
- ('Name5', 14)|
-
-call bug11529()|
-call bug11529()|
-delete from t1|
-drop procedure bug11529|
-
-
-#
-# BUG#6063: Stored procedure labels are subject to restrictions (partial)
-# BUG#7088: Stored procedures: labels won't work if character set is utf8
-#
-
-set character set utf8|
-
---disable_warnings
-drop procedure if exists bug6063|
-drop procedure if exists bug7088_1|
-drop procedure if exists bug7088_2|
---enable_warnings
-
-create procedure bug6063()
-begin
- lâbel: begin end;
- label: begin end;
- label1: begin end;
-end|
-
-create procedure bug7088_1()
- label1: begin end label1|
-
-create procedure bug7088_2()
- läbel1: begin end|
-
-call bug6063()|
-call bug7088_1()|
-call bug7088_2()|
-
-set character set default|
-
-show create procedure bug6063|
-show create procedure bug7088_1|
-show create procedure bug7088_2|
-
-drop procedure bug6063|
-drop procedure bug7088_1|
-drop procedure bug7088_2|
-
-#
-# BUG#9565: "Wrong locking in stored procedure if a sub-sequent procedure
-# is called".
-#
---disable_warnings
-drop procedure if exists bug9565_sub|
-drop procedure if exists bug9565|
---enable_warnings
-create procedure bug9565_sub()
-begin
- select * from t1;
-end|
-create procedure bug9565()
-begin
- insert into t1 values ("one", 1);
- call bug9565_sub();
-end|
-call bug9565()|
-delete from t1|
-drop procedure bug9565_sub|
-drop procedure bug9565|
-
-
-#
-# BUG#9538: SProc: Creation fails if we try to SET system variable
-# using @@var_name in proc
-#
---disable_warnings
-drop procedure if exists bug9538|
---enable_warnings
-create procedure bug9538()
- set @@sort_buffer_size = 1000000|
-
-set @x = @@sort_buffer_size|
-set @@sort_buffer_size = 2000000|
-select @@sort_buffer_size|
-call bug9538()|
-select @@sort_buffer_size|
-set @@sort_buffer_size = @x|
-
-drop procedure bug9538|
-
-
-#
-# BUG#8692: Cursor fetch of empty string
-#
---disable_warnings
-drop procedure if exists bug8692|
---enable_warnings
-create table t3 (c1 varchar(5), c2 char(5), c3 enum('one','two'), c4 text, c5 blob, c6 char(5), c7 varchar(5))|
-insert into t3 values ('', '', '', '', '', '', NULL)|
-
-create procedure bug8692()
-begin
- declare v1 VARCHAR(10);
- declare v2 VARCHAR(10);
- declare v3 VARCHAR(10);
- declare v4 VARCHAR(10);
- declare v5 VARCHAR(10);
- declare v6 VARCHAR(10);
- declare v7 VARCHAR(10);
- declare c8692 cursor for select c1,c2,c3,c4,c5,c6,c7 from t3;
- open c8692;
- fetch c8692 into v1,v2,v3,v4,v5,v6,v7;
- select v1, v2, v3, v4, v5, v6, v7;
-end|
-
-call bug8692()|
-drop procedure bug8692|
-drop table t3|
-
-#
-# Bug#10055 "Using stored function with information_schema causes empty
-# result set"
-#
---disable_warnings
-drop function if exists bug10055|
---enable_warnings
-create function bug10055(v char(255)) returns char(255) return lower(v)|
-# This select should not crash server and should return all fields in t1
-select t.column_name, bug10055(t.column_name)
-from information_schema.columns as t
-where t.table_schema = 'test' and t.table_name = 't1'|
-drop function bug10055|
-
-#
-# Bug #12297 "SP crashes the server if data inserted inside a lon loop"
-# The test for memleak bug, so actually there is no way to test it
-# from the suite. The test below could be used to check SP memory
-# consumption by passing large input parameter.
-#
-
---disable_warnings
-drop procedure if exists bug12297|
---enable_warnings
-
-create procedure bug12297(lim int)
-begin
- set @x = 0;
- repeat
- insert into t1(id,data)
- values('aa', @x);
- set @x = @x + 1;
- until @x >= lim
- end repeat;
-end|
-
-call bug12297(10)|
-drop procedure bug12297|
-
-#
-# Bug #11247 "Stored procedures: Function calls in long loops leak memory"
-# One more memleak bug test. One could use this test to check that the memory
-# isn't leaking by increasing the input value for p_bug11247.
-#
-
---disable_warnings
-drop function if exists f_bug11247|
-drop procedure if exists p_bug11247|
---enable_warnings
-
-create function f_bug11247(param int)
- returns int
-return param + 1|
-
-create procedure p_bug11247(lim int)
-begin
- declare v int default 0;
-
- while v < lim do
- set v= f_bug11247(v);
- end while;
-end|
-
-call p_bug11247(10)|
-drop function f_bug11247|
-drop procedure p_bug11247|
-#
-# BUG#12168: "'DECLARE CONTINUE HANDLER FOR NOT FOUND ...' in conditional
-# handled incorrectly"
-#
---disable_warnings
-drop procedure if exists bug12168|
-drop table if exists t3, t4|
---enable_warnings
-
-create table t3 (a int)|
-insert into t3 values (1),(2),(3),(4)|
-
-create table t4 (a int)|
-
-create procedure bug12168(arg1 char(1))
-begin
- declare b, c integer;
- if arg1 = 'a' then
- begin
- declare c1 cursor for select a from t3 where a % 2;
- declare continue handler for not found set b = 1;
- set b = 0;
- open c1;
- c1_repeat: repeat
- fetch c1 into c;
- if (b = 1) then
- leave c1_repeat;
- end if;
-
- insert into t4 values (c);
- until b = 1
- end repeat;
- end;
- end if;
- if arg1 = 'b' then
- begin
- declare c2 cursor for select a from t3 where not a % 2;
- declare continue handler for not found set b = 1;
- set b = 0;
- open c2;
- c2_repeat: repeat
- fetch c2 into c;
- if (b = 1) then
- leave c2_repeat;
- end if;
-
- insert into t4 values (c);
- until b = 1
- end repeat;
- end;
- end if;
-end|
-
-call bug12168('a')|
-select * from t4|
-truncate t4|
-call bug12168('b')|
-select * from t4|
-truncate t4|
-call bug12168('a')|
-select * from t4|
-truncate t4|
-call bug12168('b')|
-select * from t4|
-truncate t4|
-drop table t3, t4|
-drop procedure if exists bug12168|
-
-#
-# Bug #11333 "Stored Procedure: Memory blow up on repeated SELECT ... INTO
-# query"
-# One more memleak bug. Use the test to check memory consumption.
-#
-
---disable_warnings
-drop table if exists t3|
-drop procedure if exists bug11333|
---enable_warnings
-
-create table t3 (c1 char(128))|
-
-insert into t3 values
- ('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA')|
-
-
-create procedure bug11333(i int)
-begin
- declare tmp varchar(128);
- set @x = 0;
- repeat
- select c1 into tmp from t3
- where c1 = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA';
- set @x = @x + 1;
- until @x >= i
- end repeat;
-end|
-
-call bug11333(10)|
-
-drop procedure bug11333|
-drop table t3|
-
-#
-# BUG#9048: Creating a function with char binary IN parameter fails
-#
---disable_warnings
-drop function if exists bug9048|
---enable_warnings
-create function bug9048(f1 char binary) returns char
-begin
- set f1= concat( 'hello', f1 );
- return f1;
-end|
-drop function bug9048|
-
-create function bug9048(f1 char binary) returns char binary
-begin
- set f1= concat( 'hello', f1 );
- return f1;
-end|
-select collation(bug9048("foo"))|
-drop function bug9048|
-
-# Bug #12849 Stored Procedure: Crash on procedure call with CHAR type
-# 'INOUT' parameter
-#
-
---disable_warnings
-drop procedure if exists bug12849_1|
---enable_warnings
-create procedure bug12849_1(inout x char) select x into x|
-set @var='a'|
-call bug12849_1(@var)|
-select @var|
-drop procedure bug12849_1|
-
---disable_warnings
-drop procedure if exists bug12849_2|
---enable_warnings
-create procedure bug12849_2(inout foo varchar(15))
-begin
-select concat(foo, foo) INTO foo;
-end|
-set @var='abcd'|
-call bug12849_2(@var)|
-select @var|
-drop procedure bug12849_2|
-
-#
-# BUG#13133: Local variables in stored procedures are not initialized correctly.
-#
---disable_warnings
-drop procedure if exists bug131333|
-drop function if exists bug131333|
---enable_warnings
-create procedure bug131333()
-begin
- begin
- declare a int;
-
- select a;
- set a = 1;
- select a;
- end;
- begin
- declare b int;
-
- select b;
- end;
-end|
-
-create function bug131333()
- returns int
-begin
- begin
- declare a int;
-
- set a = 1;
- end;
- begin
- declare b int;
-
- return b;
- end;
-end|
-
-call bug131333()|
-select bug131333()|
-
-drop procedure bug131333|
-drop function bug131333|
-
-#
-# BUG#12379: PROCEDURE with HANDLER calling FUNCTION with error get
-# strange result
-#
---disable_warnings
-drop function if exists bug12379|
-drop procedure if exists bug12379_1|
-drop procedure if exists bug12379_2|
-drop procedure if exists bug12379_3|
-drop table if exists t3|
---enable_warnings
-
-create table t3 (c1 char(1) primary key not null)|
-
-create function bug12379()
- returns integer
-begin
- insert into t3 values('X');
- insert into t3 values('X');
- return 0;
-end|
-
-create procedure bug12379_1()
-begin
- declare exit handler for sqlexception select 42;
-
- select bug12379();
-END|
-create procedure bug12379_2()
-begin
- declare exit handler for sqlexception begin end;
-
- select bug12379();
-end|
-create procedure bug12379_3()
-begin
- select bug12379();
-end|
-
---error ER_DUP_ENTRY
-select bug12379()|
-select 1|
-# statement-based binlogging will show warning which row-based won't;
-# so we hide it (this warning is already tested in rpl_stm_sp.test)
---disable_warnings
-call bug12379_1()|
-select 2|
-call bug12379_2()|
---enable_warnings
-select 3|
---error ER_DUP_ENTRY
-call bug12379_3()|
-select 4|
-
-drop function bug12379|
-drop procedure bug12379_1|
-drop procedure bug12379_2|
-drop procedure bug12379_3|
-drop table t3|
-
-#
-# Bug #13124 Stored Procedure using SELECT INTO crashes server
-#
-
---disable_warnings
-drop procedure if exists bug13124|
---enable_warnings
-create procedure bug13124()
-begin
- declare y integer;
- set @x=y;
-end|
-call bug13124()|
-drop procedure bug13124|
-
-#
-# Bug #12979 Stored procedures: crash if inout decimal parameter
-#
-
-# check NULL inout parameters processing
-
---disable_warnings
-drop procedure if exists bug12979_1|
---enable_warnings
-create procedure bug12979_1(inout d decimal(5)) set d = d / 2|
-set @bug12979_user_var = NULL|
-call bug12979_1(@bug12979_user_var)|
-drop procedure bug12979_1|
-
-# check NULL local variables processing
-
---disable_warnings
-drop procedure if exists bug12979_2|
---enable_warnings
-create procedure bug12979_2()
-begin
-declare internal_var decimal(5);
-set internal_var= internal_var / 2;
-select internal_var;
-end|
-call bug12979_2()|
-drop procedure bug12979_2|
-
-
-#
-# BUG#6127: Stored procedure handlers within handlers don't work
-#
---disable_warnings
-drop table if exists t3|
-drop procedure if exists bug6127|
---enable_warnings
-create table t3 (s1 int unique)|
-
-set @sm=@@sql_mode|
-set sql_mode='traditional'|
-
-create procedure bug6127()
-begin
- declare continue handler for sqlstate '23000'
- begin
- declare continue handler for sqlstate '22003'
- insert into t3 values (0);
-
- insert into t3 values (1000000000000000);
- end;
-
- insert into t3 values (1);
- insert into t3 values (1);
-end|
-
-call bug6127()|
-select * from t3|
---error ER_DUP_ENTRY
-call bug6127()|
-select * from t3|
-set sql_mode=@sm|
-drop table t3|
-drop procedure bug6127|
-
-
-#
-# BUG#12589: Assert when creating temp. table from decimal stored procedure
-# variable
-#
---disable_warnings
-drop procedure if exists bug12589_1|
-drop procedure if exists bug12589_2|
-drop procedure if exists bug12589_3|
---enable_warnings
-create procedure bug12589_1()
-begin
- declare spv1 decimal(3,3);
- set spv1= 123.456;
-
- set spv1 = 'test';
- create temporary table tm1 as select spv1;
- show create table tm1;
- drop temporary table tm1;
-end|
-
-create procedure bug12589_2()
-begin
- declare spv1 decimal(6,3);
- set spv1= 123.456;
-
- create temporary table tm1 as select spv1;
- show create table tm1;
- drop temporary table tm1;
-end|
-
-create procedure bug12589_3()
-begin
- declare spv1 decimal(6,3);
- set spv1= -123.456;
-
- create temporary table tm1 as select spv1;
- show create table tm1;
- drop temporary table tm1;
-end|
-
-# Note: The type of the field will match the value, not the declared
-# type of the variable. (This is a type checking issue which
-# might be changed later.)
-
-# Warning expected from "set spv1 = 'test'", the value is set to decimal "0".
-call bug12589_1()|
-# No warnings here
-call bug12589_2()|
-call bug12589_3()|
-drop procedure bug12589_1|
-drop procedure bug12589_2|
-drop procedure bug12589_3|
-
-#
-# BUG#7049: Stored procedure CALL errors are ignored
-#
---disable_warnings
-drop table if exists t3|
-drop procedure if exists bug7049_1|
-drop procedure if exists bug7049_2|
-drop procedure if exists bug7049_3|
-drop procedure if exists bug7049_4|
-drop function if exists bug7049_1|
-drop function if exists bug7049_2|
---enable_warnings
-
-create table t3 ( x int unique )|
-
-create procedure bug7049_1()
-begin
- insert into t3 values (42);
- insert into t3 values (42);
-end|
-
-create procedure bug7049_2()
-begin
- declare exit handler for sqlexception
- select 'Caught it' as 'Result';
-
- call bug7049_1();
- select 'Missed it' as 'Result';
-end|
-
-create procedure bug7049_3()
- call bug7049_1()|
-
-create procedure bug7049_4()
-begin
- declare exit handler for sqlexception
- select 'Caught it' as 'Result';
-
- call bug7049_3();
- select 'Missed it' as 'Result';
-end|
-
-create function bug7049_1()
- returns int
-begin
- insert into t3 values (42);
- insert into t3 values (42);
- return 42;
-end|
-
-create function bug7049_2()
- returns int
-begin
- declare x int default 0;
- declare continue handler for sqlexception
- set x = 1;
-
- set x = bug7049_1();
- return x;
-end|
-
-call bug7049_2()|
-select * from t3|
-delete from t3|
-call bug7049_4()|
-select * from t3|
-select bug7049_2()|
-
-drop table t3|
-drop procedure bug7049_1|
-drop procedure bug7049_2|
-drop procedure bug7049_3|
-drop procedure bug7049_4|
-drop function bug7049_1|
-drop function bug7049_2|
-
-
-#
-# BUG#13941: replace() string fuction behaves badly inside stored procedure
-# (BUG#13914: IFNULL is returning garbage in stored procedure)
-#
---disable_warnings
-drop function if exists bug13941|
-drop procedure if exists bug13941|
---enable_warnings
-
-create function bug13941(p_input_str text)
- returns text
-begin
- declare p_output_str text;
-
- set p_output_str = p_input_str;
-
- set p_output_str = replace(p_output_str, 'xyzzy', 'plugh');
- set p_output_str = replace(p_output_str, 'test', 'prova');
- set p_output_str = replace(p_output_str, 'this', 'questo');
- set p_output_str = replace(p_output_str, ' a ', 'una ');
- set p_output_str = replace(p_output_str, 'is', '');
-
- return p_output_str;
-end|
-
-create procedure bug13941(out sout varchar(128))
-begin
- set sout = 'Local';
- set sout = ifnull(sout, 'DEF');
-end|
-
-# Note: The bug showed different behaviour in different types of builds,
-# giving garbage results in some, and seemingly working in others.
-# Running with valgrind (or purify) is the safe way to check that it's
-# really working correctly.
-select bug13941('this is a test')|
-call bug13941(@a)|
-select @a|
-
-drop function bug13941|
-drop procedure bug13941|
-
-
-#
-# BUG#13095: Cannot create VIEWs in prepared statements
-#
-
-delimiter ;|
-
---disable_warnings
-DROP PROCEDURE IF EXISTS bug13095;
-DROP TABLE IF EXISTS bug13095_t1;
-DROP VIEW IF EXISTS bug13095_v1;
---enable_warnings
-
-delimiter |;
-
-CREATE PROCEDURE bug13095(tbl_name varchar(32))
-BEGIN
- SET @str =
- CONCAT("CREATE TABLE ", tbl_name, "(stuff char(15))");
- SELECT @str;
- PREPARE stmt FROM @str;
- EXECUTE stmt;
-
- SET @str =
- CONCAT("INSERT INTO ", tbl_name, " VALUES('row1'),('row2'),('row3')" );
- SELECT @str;
- PREPARE stmt FROM @str;
- EXECUTE stmt;
-
- SET @str =
- CONCAT("CREATE VIEW bug13095_v1(c1) AS SELECT stuff FROM ", tbl_name);
- SELECT @str;
- PREPARE stmt FROM @str;
- EXECUTE stmt;
-
- SELECT * FROM bug13095_v1;
-
- SET @str =
- "DROP VIEW bug13095_v1";
- SELECT @str;
- PREPARE stmt FROM @str;
- EXECUTE stmt;
-END|
-
-delimiter ;|
-
-CALL bug13095('bug13095_t1');
-
---disable_warnings
-DROP PROCEDURE IF EXISTS bug13095;
-DROP VIEW IF EXISTS bug13095_v1;
-DROP TABLE IF EXISTS bug13095_t1;
---enable_warnings
-
-delimiter |;
-
-#
-# BUG#1473: Dumping of stored functions seems to cause corruption in
-# the function body
-#
---disable_warnings
-drop function if exists bug14723|
-drop procedure if exists bug14723|
---enable_warnings
-
-delimiter ;;|
-/*!50003 create function bug14723()
- returns bigint(20)
-main_loop: begin
- return 42;
-end */;;
-show create function bug14723;;
-select bug14723();;
-
-/*!50003 create procedure bug14723()
-main_loop: begin
- select 42;
-end */;;
-show create procedure bug14723;;
-call bug14723();;
-
-delimiter |;;
-
-drop function bug14723|
-drop procedure bug14723|
-
-#
-# Bug#14845 "mysql_stmt_fetch returns MYSQL_NO_DATA when COUNT(*) is 0"
-# Check that when fetching from a cursor, COUNT(*) works properly.
-#
-create procedure bug14845()
-begin
- declare a char(255);
- declare done int default 0;
- declare c cursor for select count(*) from t1 where 1 = 0;
- declare continue handler for sqlstate '02000' set done = 1;
- open c;
- repeat
- fetch c into a;
- if not done then
- select a;
- end if;
- until done end repeat;
- close c;
-end|
-call bug14845()|
-drop procedure bug14845|
-
-#
-# BUG#13549 "Server crash with nested stored procedures".
-# Server should not crash when during execution of stored procedure
-# we have to parse trigger/function definition and this new trigger/
-# function has more local variables declared than invoking stored
-# procedure and last of these variables is used in argument of NOT
-# operator.
-#
---disable_warnings
-drop procedure if exists bug13549_1|
-drop procedure if exists bug13549_2|
---enable_warnings
-CREATE PROCEDURE `bug13549_2`()
-begin
- call bug13549_1();
-end|
-CREATE PROCEDURE `bug13549_1`()
-begin
- declare done int default 0;
- set done= not done;
-end|
-CALL bug13549_2()|
-drop procedure bug13549_2|
-drop procedure bug13549_1|
-
-#
-# BUG#10100: function (and stored procedure?) recursivity problem
-#
---disable_warnings
-drop function if exists bug10100f|
-drop procedure if exists bug10100p|
-drop procedure if exists bug10100t|
-drop procedure if exists bug10100pt|
-drop procedure if exists bug10100pv|
-drop procedure if exists bug10100pd|
-drop procedure if exists bug10100pc|
---enable_warnings
-# routines with simple recursion
-create function bug10100f(prm int) returns int
-begin
- if prm > 1 then
- return prm * bug10100f(prm - 1);
- end if;
- return 1;
-end|
-create procedure bug10100p(prm int, inout res int)
-begin
- set res = res * prm;
- if prm > 1 then
- call bug10100p(prm - 1, res);
- end if;
-end|
-create procedure bug10100t(prm int)
-begin
- declare res int;
- set res = 1;
- call bug10100p(prm, res);
- select res;
-end|
-
-# a procedure which use tables and recursion
-create table t3 (a int)|
-insert into t3 values (0)|
-create view v1 as select a from t3|
-create procedure bug10100pt(level int, lim int)
-begin
- if level < lim then
- update t3 set a=level;
- FLUSH TABLES;
- call bug10100pt(level+1, lim);
- else
- select * from t3;
- end if;
-end|
-# view & recursion
-create procedure bug10100pv(level int, lim int)
-begin
- if level < lim then
- update v1 set a=level;
- FLUSH TABLES;
- call bug10100pv(level+1, lim);
- else
- select * from v1;
- end if;
-end|
-# dynamic sql & recursion
-prepare stmt2 from "select * from t3;"|
-create procedure bug10100pd(level int, lim int)
-begin
- if level < lim then
- select level;
- prepare stmt1 from "update t3 set a=a+2";
- execute stmt1;
- FLUSH TABLES;
- execute stmt1;
- FLUSH TABLES;
- execute stmt1;
- FLUSH TABLES;
- deallocate prepare stmt1;
- execute stmt2;
- select * from t3;
- call bug10100pd(level+1, lim);
- else
- execute stmt2;
- end if;
-end|
-# cursor & recursion
-create procedure bug10100pc(level int, lim int)
-begin
- declare lv int;
- declare c cursor for select a from t3;
- open c;
- if level < lim then
- select level;
- fetch c into lv;
- select lv;
- update t3 set a=level+lv;
- FLUSH TABLES;
- call bug10100pc(level+1, lim);
- else
- select * from t3;
- end if;
- close c;
-end|
-
-set @@max_sp_recursion_depth=4|
-select @@max_sp_recursion_depth|
--- error ER_SP_NO_RECURSION
-select bug10100f(3)|
--- error ER_SP_NO_RECURSION
-select bug10100f(6)|
-call bug10100t(5)|
-call bug10100pt(1,5)|
-call bug10100pv(1,5)|
-update t3 set a=1|
-call bug10100pd(1,5)|
-select * from t3|
-update t3 set a=1|
-call bug10100pc(1,5)|
-select * from t3|
-set @@max_sp_recursion_depth=0|
-select @@max_sp_recursion_depth|
--- error ER_SP_NO_RECURSION
-select bug10100f(5)|
--- error ER_SP_RECURSION_LIMIT
-call bug10100t(5)|
-
-#end of the stack checking
-deallocate prepare stmt2|
-
-drop function bug10100f|
-drop procedure bug10100p|
-drop procedure bug10100t|
-drop procedure bug10100pt|
-drop procedure bug10100pv|
-drop procedure bug10100pd|
-drop procedure bug10100pc|
-drop view v1|
-
-#
-# BUG#13729: Stored procedures: packet error after exception handled
-#
---disable_warnings
-drop procedure if exists bug13729|
-drop table if exists t3|
---enable_warnings
-
-create table t3 (s1 int, primary key (s1))|
-
-insert into t3 values (1),(2)|
-
-create procedure bug13729()
-begin
- declare continue handler for sqlexception select 55;
-
- update t3 set s1 = 1;
-end|
-
-call bug13729()|
-# Used to cause Packets out of order
-select * from t3|
-
-drop procedure bug13729|
-drop table t3|
-
-#
-# BUG#14643: Stored Procedure: Continuing after failed var. initialization
-# crashes server.
-#
---disable_warnings
-drop procedure if exists bug14643_1|
-drop procedure if exists bug14643_2|
---enable_warnings
-
-create procedure bug14643_1()
-begin
- declare continue handler for sqlexception select 'boo' as 'Handler';
-
- begin
- declare v int default undefined_var;
-
- if v = 1 then
- select 1;
- else
- select v, isnull(v);
- end if;
- end;
-end|
-
-create procedure bug14643_2()
-begin
- declare continue handler for sqlexception select 'boo' as 'Handler';
-
- case undefined_var
- when 1 then
- select 1;
- else
- select 2;
- end case;
-
- select undefined_var;
-end|
-
-call bug14643_1()|
-call bug14643_2()|
-
-drop procedure bug14643_1|
-drop procedure bug14643_2|
-
-#
-# BUG#14304: auto_increment field incorrect set in SP
-#
---disable_warnings
-drop procedure if exists bug14304|
-drop table if exists t3, t4|
---enable_warnings
-
-create table t3(a int primary key auto_increment)|
-create table t4(a int primary key auto_increment)|
-
-create procedure bug14304()
-begin
- insert into t3 set a=null;
- insert into t4 set a=null;
- insert into t4 set a=null;
- insert into t4 set a=null;
- insert into t4 set a=null;
- insert into t4 set a=null;
- insert into t4 select null as a;
-
- insert into t3 set a=null;
- insert into t3 set a=null;
-
- select * from t3;
-end|
-
-call bug14304()|
-
-drop procedure bug14304|
-drop table t3, t4|
-
-#
-# BUG#14376: MySQL crash on scoped variable (re)initialization
-#
---disable_warnings
-drop procedure if exists bug14376|
---enable_warnings
-
-create procedure bug14376()
-begin
- declare x int default x;
-end|
-
-# Not the error we want, but that's what we got for now...
---error ER_BAD_FIELD_ERROR
-call bug14376()|
-drop procedure bug14376|
-
-create procedure bug14376()
-begin
- declare x int default 42;
-
- begin
- declare x int default x;
-
- select x;
- end;
-end|
-
-call bug14376()|
-
-drop procedure bug14376|
-
-create procedure bug14376(x int)
-begin
- declare x int default x;
-
- select x;
-end|
-
-call bug14376(4711)|
-
-drop procedure bug14376|
-
-#
-# Bug#5967 "Stored procedure declared variable used instead of column"
-# The bug should be fixed later.
-# Test precedence of names of parameters, variable declarations,
-# variable declarations in nested compound statements, table columns,
-# table columns in cursor declarations.
-# According to the standard, table columns take precedence over
-# variable declarations. In MySQL 5.0 it's vice versa.
-#
-
---disable_warnings
-drop procedure if exists bug5967|
-drop table if exists t3|
---enable_warnings
-create table t3 (a varchar(255))|
-insert into t3 (a) values ("a - table column")|
-create procedure bug5967(a varchar(255))
-begin
- declare i varchar(255);
- declare c cursor for select a from t3;
- select a;
- select a from t3 into i;
- select i as 'Parameter takes precedence over table column'; open c;
- fetch c into i;
- close c;
- select i as 'Parameter takes precedence over table column in cursors';
- begin
- declare a varchar(255) default 'a - local variable';
- declare c1 cursor for select a from t3;
- select a as 'A local variable takes precedence over parameter';
- open c1;
- fetch c1 into i;
- close c1;
- select i as 'A local variable takes precedence over parameter in cursors';
- begin
- declare a varchar(255) default 'a - local variable in a nested compound statement';
- declare c2 cursor for select a from t3;
- select a as 'A local variable in a nested compound statement takes precedence over a local variable in the outer statement';
- select a from t3 into i;
- select i as 'A local variable in a nested compound statement takes precedence over table column';
- open c2;
- fetch c2 into i;
- close c2;
- select i as 'A local variable in a nested compound statement takes precedence over table column in cursors';
- end;
- end;
-end|
-call bug5967("a - stored procedure parameter")|
-drop procedure bug5967|
-
-#
-# Bug#13012 "SP: REPAIR/BACKUP/RESTORE TABLE crashes the server"
-#
---let $backupdir = $MYSQLTEST_VARDIR/tmp/
---error 0,1
---remove_file $backupdir/t1.frm
---error 0,1
---remove_file $backupdir/t1.MYD
-
---disable_warnings
-drop procedure if exists bug13012|
---enable_warnings
-# Disable warnings also for BACKUP/RESTORE: they are deprecated.
-eval create procedure bug13012()
- BEGIN
- REPAIR TABLE t1;
- END|
-call bug13012()|
-
---enable_warnings
-
-drop procedure bug13012|
-
-create view v1 as select * from t1|
-create procedure bug13012()
-BEGIN
- REPAIR TABLE t1,t2,t3,v1;
- OPTIMIZE TABLE t1,t2,t3,v1;
- ANALYZE TABLE t1,t2,t3,v1;
-END|
-call bug13012()|
-call bug13012()|
-call bug13012()|
-drop procedure bug13012|
-drop view v1|
-select * from t1 order by data|
-
-#
-# A test case for Bug#15392 "Server crashes during prepared statement
-# execute": make sure that stored procedure check for error conditions
-# properly and do not continue execution if an error has been set.
-#
-# It's necessary to use several DBs because in the original code
-# the successful return of mysql_change_db overrode the error from
-# execution.
-drop schema if exists mysqltest1|
-drop schema if exists mysqltest2|
-drop schema if exists mysqltest3|
-create schema mysqltest1|
-create schema mysqltest2|
-create schema mysqltest3|
-use mysqltest3|
-
-create procedure mysqltest1.p1 (out prequestid varchar(100))
-begin
- call mysqltest2.p2('call mysqltest3.p3(1, 2)');
-end|
-
-create procedure mysqltest2.p2(in psql text)
-begin
- declare lsql text;
- set @lsql= psql;
- prepare lstatement from @lsql;
- execute lstatement;
- deallocate prepare lstatement;
-end|
-
-create procedure mysqltest3.p3(in p1 int)
-begin
- select p1;
-end|
-
---error ER_SP_WRONG_NO_OF_ARGS
-call mysqltest1.p1(@rs)|
---error ER_SP_WRONG_NO_OF_ARGS
-call mysqltest1.p1(@rs)|
---error ER_SP_WRONG_NO_OF_ARGS
-call mysqltest1.p1(@rs)|
-drop schema if exists mysqltest1|
-drop schema if exists mysqltest2|
-drop schema if exists mysqltest3|
-use test|
-
-#
-# Bug#15441 "Running SP causes Server to Crash": check that an SP variable
-# can not be used in VALUES() function.
-#
---disable_warnings
-drop table if exists t3|
-drop procedure if exists bug15441|
---enable_warnings
-create table t3 (id int not null primary key, county varchar(25))|
-insert into t3 (id, county) values (1, 'York')|
-
-# First check that a stored procedure that refers to a parameter in VALUES()
-# function won't parse.
-
-create procedure bug15441(c varchar(25))
-begin
- update t3 set id=2, county=value(c);
-end|
---error ER_BAD_FIELD_ERROR
-call bug15441('county')|
-drop procedure bug15441|
-
-# Now check the case when there is an ambiguity between column names
-# and stored procedure parameters: the parser shall resolve the argument
-# of VALUES() function to the column name.
-
-# It's hard to deduce what county refers to in every case (INSERT statement):
-# 1st county refers to the column
-# 2nd county refers to the procedure parameter
-# 3d and 4th county refers to the column, again, but
-# for 4th county it has the value of SP parameter
-
-# In UPDATE statement, just check that values() function returns NULL for
-# non- INSERT...UPDATE statements, as stated in the manual.
-
-create procedure bug15441(county varchar(25))
-begin
- declare c varchar(25) default "hello";
-
- insert into t3 (id, county) values (1, county)
- on duplicate key update county= values(county);
- select * from t3;
-
- update t3 set id=2, county=value(id);
- select * from t3;
-end|
-call bug15441('Yale')|
-drop table t3|
-drop procedure bug15441|
-
-#
-# BUG#14498: Stored procedures: hang if undefined variable and exception
-#
---disable_warnings
-drop procedure if exists bug14498_1|
-drop procedure if exists bug14498_2|
-drop procedure if exists bug14498_3|
-drop procedure if exists bug14498_4|
-drop procedure if exists bug14498_5|
---enable_warnings
-
-create procedure bug14498_1()
-begin
- declare continue handler for sqlexception select 'error' as 'Handler';
-
- if v then
- select 'yes' as 'v';
- else
- select 'no' as 'v';
- end if;
- select 'done' as 'End';
-end|
-
-create procedure bug14498_2()
-begin
- declare continue handler for sqlexception select 'error' as 'Handler';
-
- while v do
- select 'yes' as 'v';
- end while;
- select 'done' as 'End';
-end|
-
-create procedure bug14498_3()
-begin
- declare continue handler for sqlexception select 'error' as 'Handler';
-
- repeat
- select 'maybe' as 'v';
- until v end repeat;
- select 'done' as 'End';
-end|
-
-create procedure bug14498_4()
-begin
- declare continue handler for sqlexception select 'error' as 'Handler';
-
- case v
- when 1 then
- select '1' as 'v';
- when 2 then
- select '2' as 'v';
- else
- select '?' as 'v';
- end case;
- select 'done' as 'End';
-end|
-
-create procedure bug14498_5()
-begin
- declare continue handler for sqlexception select 'error' as 'Handler';
-
- case
- when v = 1 then
- select '1' as 'v';
- when v = 2 then
- select '2' as 'v';
- else
- select '?' as 'v';
- end case;
- select 'done' as 'End';
-end|
-
-call bug14498_1()|
-call bug14498_2()|
-call bug14498_3()|
-call bug14498_4()|
-call bug14498_5()|
-
-drop procedure bug14498_1|
-drop procedure bug14498_2|
-drop procedure bug14498_3|
-drop procedure bug14498_4|
-drop procedure bug14498_5|
-
-#
-# BUG#15231: Stored procedure bug with not found condition handler
-#
---disable_warnings
-drop table if exists t3|
-drop procedure if exists bug15231_1|
-drop procedure if exists bug15231_2|
-drop procedure if exists bug15231_3|
-drop procedure if exists bug15231_4|
-drop procedure if exists bug15231_5|
-drop procedure if exists bug15231_6|
---enable_warnings
-
-create table t3 (id int not null)|
-
-create procedure bug15231_1()
-begin
- declare xid integer;
- declare xdone integer default 0;
- declare continue handler for not found set xdone = 1;
-
- set xid=null;
- call bug15231_2(xid);
- select xid, xdone;
-end|
-
-create procedure bug15231_2(inout ioid integer)
-begin
- select "Before NOT FOUND condition is triggered" as '1';
- select id into ioid from t3 where id=ioid;
- select "After NOT FOUND condtition is triggered" as '2';
-
- if ioid is null then
- set ioid=1;
- end if;
-end|
-
-create procedure bug15231_3()
-begin
- declare exit handler for sqlwarning
- select 'Caught it (correct)' as 'Result';
-
- call bug15231_4();
-end|
-
-create procedure bug15231_4()
-begin
- declare x decimal(2,1);
-
- set x = 'zap';
- select 'Missed it (correct)' as 'Result';
- show warnings;
-end|
-
-create procedure bug15231_5()
-begin
- declare exit handler for sqlwarning
- select 'Caught it (wrong)' as 'Result';
-
- call bug15231_6();
-end|
-
-create procedure bug15231_6()
-begin
- declare x decimal(2,1);
-
- set x = 'zap';
- select 'Missed it (correct)' as 'Result';
- select id from t3;
-end|
-
-call bug15231_1()|
-call bug15231_3()|
-call bug15231_5()|
-
-drop table t3|
-drop procedure bug15231_1|
-drop procedure bug15231_2|
-drop procedure bug15231_3|
-drop procedure bug15231_4|
-drop procedure bug15231_5|
-drop procedure bug15231_6|
-
-
-#
-# BUG#15011: error handler in nested block not activated
-#
---disable_warnings
-drop procedure if exists bug15011|
---enable_warnings
-
-create table t3 (c1 int primary key)|
-
-insert into t3 values (1)|
-
-create procedure bug15011()
- deterministic
-begin
- declare continue handler for 1062
- select 'Outer' as 'Handler';
-
- begin
- declare continue handler for 1062
- select 'Inner' as 'Handler';
-
- insert into t3 values (1);
- end;
-end|
-
-call bug15011()|
-
-drop procedure bug15011|
-drop table t3|
-
-
-#
-# BUG#17476: Stored procedure not returning data when it is called first
-# time per connection
-#
---disable_warnings
-drop procedure if exists bug17476|
---enable_warnings
-
-create table t3 ( d date )|
-insert into t3 values
- ( '2005-01-01' ), ( '2005-01-02' ), ( '2005-01-03' ),
- ( '2005-01-04' ), ( '2005-02-01' ), ( '2005-02-02' )|
-
-create procedure bug17476(pDateFormat varchar(10))
- select date_format(t3.d, pDateFormat), count(*)
- from t3
- group by date_format(t3.d, pDateFormat)|
-
-call bug17476('%Y-%m')|
-call bug17476('%Y-%m')|
-
-drop table t3|
-drop procedure bug17476|
-
-
-#
-# BUG#16887: Cursor causes server segfault
-#
---disable_warnings
-drop table if exists t3|
-drop procedure if exists bug16887|
---enable_warnings
-
-create table t3 ( c varchar(1) )|
-
-insert into t3 values
- (' '),('.'),(';'),(','),('-'),('_'),('('),(')'),('/'),('\\')|
-
-create procedure bug16887()
-begin
- declare i int default 10;
-
- again:
- while i > 0 do
- begin
- declare breakchar varchar(1);
- declare done int default 0;
- declare t3_cursor cursor for select c from t3;
- declare continue handler for not found set done = 1;
-
- set i = i - 1;
- select i;
-
- if i = 3 then
- iterate again;
- end if;
-
- open t3_cursor;
-
- loop
- fetch t3_cursor into breakchar;
-
- if done = 1 then
- begin
- close t3_cursor;
- iterate again;
- end;
- end if;
- end loop;
- end;
- end while;
-end|
-
-call bug16887()|
-
-drop table t3|
-drop procedure bug16887|
-
-#
-# BUG#16474: SP crashed MySQL
-# (when using "order by localvar", where 'localvar' is just that.
-#
---disable_warnings
-drop procedure if exists bug16474_1|
-drop procedure if exists bug16474_2|
---enable_warnings
-
-delete from t1|
-insert into t1 values ('c', 2), ('b', 3), ('a', 1)|
-
-create procedure bug16474_1()
-begin
- declare x int;
-
- select id from t1 order by x, id;
-end|
-
-#
-# BUG#14945: Truncate table doesn't reset the auto_increment counter
-#
---disable_warnings
-drop procedure if exists bug14945|
---enable_warnings
-create table t3 (id int not null auto_increment primary key)|
-create procedure bug14945() deterministic truncate t3|
-insert into t3 values (null)|
-call bug14945()|
-insert into t3 values (null)|
-select * from t3|
-drop table t3|
-drop procedure bug14945|
-
-# This does NOT order by column index; variable is an expression.
-create procedure bug16474_2(x int)
- select id from t1 order by x, id|
-
-call bug16474_1()|
-call bug16474_2(1)|
-call bug16474_2(2)|
-drop procedure bug16474_1|
-drop procedure bug16474_2|
-
-# For reference: user variables are expressions too and do not affect ordering.
-set @x = 2|
-select * from t1 order by @x, data|
-
-delete from t1|
-
-
-#
-# BUG#15728: LAST_INSERT_ID function inside a stored function returns 0
-#
-# The solution is not to reset last_insert_id on enter to sub-statement.
-#
---disable_warnings
-drop function if exists bug15728|
-drop table if exists t3|
---enable_warnings
-
-create table t3 (
- id int not null auto_increment,
- primary key (id)
-)|
-create function bug15728() returns int(11)
- return last_insert_id()|
-
-insert into t3 values (0)|
-select last_insert_id()|
-select bug15728()|
-
-drop function bug15728|
-drop table t3|
-
-
-#
-# BUG#18787: Server crashed when calling a stored procedure containing
-# a misnamed function
-#
---disable_warnings
-drop procedure if exists bug18787|
---enable_warnings
-create procedure bug18787()
-begin
- declare continue handler for sqlexception begin end;
-
- select no_such_function();
-end|
-
-call bug18787()|
-drop procedure bug18787|
-
-
-#
-# BUG#18344: DROP DATABASE does not drop associated routines
-# (... if the database name is longer than 21 characters)
-#
-# 1234567890123456789012
-create database bug18344_012345678901|
-use bug18344_012345678901|
-create procedure bug18344() begin end|
-create procedure bug18344_2() begin end|
-
-create database bug18344_0123456789012|
-use bug18344_0123456789012|
-create procedure bug18344() begin end|
-create procedure bug18344_2() begin end|
-
-use test|
-
---sorted_result
-select schema_name from information_schema.schemata where
- schema_name like 'bug18344%'|
---sorted_result
-select routine_name,routine_schema from information_schema.routines where
- routine_schema like 'bug18344%'|
-
-drop database bug18344_012345678901|
-drop database bug18344_0123456789012|
-
-# Should be nothing left.
-select schema_name from information_schema.schemata where
- schema_name like 'bug18344%'|
-select routine_name,routine_schema from information_schema.routines where
- routine_schema like 'bug18344%'|
-
-
-#
-# BUG#12472/BUG#15137 'CREATE TABLE ... SELECT ... which explicitly or
-# implicitly uses stored function gives "Table not locked" error'.
-#
---disable_warnings
-drop function if exists bug12472|
---enable_warnings
-create function bug12472() returns int return (select count(*) from t1)|
-# Check case when function is used directly
-create table t3 as select bug12472() as i|
-show create table t3|
-select * from t3|
-drop table t3|
-# Check case when function is used indirectly through view
-create view v1 as select bug12472() as j|
-create table t3 as select * from v1|
-show create table t3|
-select * from t3|
-drop table t3|
-drop view v1|
-drop function bug12472|
-
-
-#
-# BUG#18587: Function that accepts and returns TEXT garbles data if longer than
-# 766 chars
-#
-
-# Prepare.
-
---disable_warnings
-DROP FUNCTION IF EXISTS bug18589_f1|
-DROP PROCEDURE IF EXISTS bug18589_p1|
-DROP PROCEDURE IF EXISTS bug18589_p2|
---enable_warnings
-
-CREATE FUNCTION bug18589_f1(arg TEXT) RETURNS TEXT
-BEGIN
- RETURN CONCAT(arg, "");
-END|
-
-CREATE PROCEDURE bug18589_p1(arg TEXT, OUT ret TEXT)
-BEGIN
- SET ret = CONCAT(arg, "");
-END|
-
-CREATE PROCEDURE bug18589_p2(arg TEXT)
-BEGIN
- DECLARE v TEXT;
- CALL bug18589_p1(arg, v);
- SELECT v;
-END|
-
-# Test case.
-
-SELECT bug18589_f1(REPEAT("a", 767))|
-
-SET @bug18589_v1 = ""|
-CALL bug18589_p1(REPEAT("a", 767), @bug18589_v1)|
-SELECT @bug18589_v1|
-
-CALL bug18589_p2(REPEAT("a", 767))|
-
-# Cleanup.
-
-DROP FUNCTION bug18589_f1|
-DROP PROCEDURE bug18589_p1|
-DROP PROCEDURE bug18589_p2|
-
-
-#
-# BUG#18037: Server crash when returning system variable in stored procedures
-# BUG#19633: Stack corruption in fix_fields()/THD::rollback_item_tree_changes()
-#
-
-# Prepare.
-
---disable_warnings
-DROP FUNCTION IF EXISTS bug18037_f1|
-DROP PROCEDURE IF EXISTS bug18037_p1|
-DROP PROCEDURE IF EXISTS bug18037_p2|
---enable_warnings
-
-# Test case.
-
-CREATE FUNCTION bug18037_f1() RETURNS INT
-BEGIN
- RETURN @@server_id;
-END|
-
-CREATE PROCEDURE bug18037_p1()
-BEGIN
- DECLARE v INT DEFAULT @@server_id;
-END|
-
-CREATE PROCEDURE bug18037_p2()
-BEGIN
- CASE @@server_id
- WHEN -1 THEN
- SELECT 0;
- ELSE
- SELECT 1;
- END CASE;
-END|
-
-SELECT bug18037_f1()|
-CALL bug18037_p1()|
-CALL bug18037_p2()|
-
-# Cleanup.
-
-DROP FUNCTION bug18037_f1|
-DROP PROCEDURE bug18037_p1|
-DROP PROCEDURE bug18037_p2|
-
-#
-# Bug#17199: "Table not found" error occurs if the query contains a call
-# to a function from another database.
-# See also ps.test for an additional test case for this bug.
-#
-use test|
-create table t3 (i int)|
-insert into t3 values (1), (2)|
-create database mysqltest1|
-use mysqltest1|
-create function bug17199() returns varchar(2) deterministic return 'ok'|
-use test|
-select *, mysqltest1.bug17199() from t3|
-#
-# Bug#18444: Fully qualified stored function names don't work correctly
-# in select statements
-#
-use mysqltest1|
-create function bug18444(i int) returns int no sql deterministic return i + 1|
-use test|
-select mysqltest1.bug18444(i) from t3|
-drop database mysqltest1|
-#
-# Check that current database has no influence to a stored procedure
-#
-create database mysqltest1 charset=utf8|
-create database mysqltest2 charset=utf8|
-create procedure mysqltest1.p1()
-begin
--- alters the default collation of database test
- alter database character set koi8r;
-end|
-use mysqltest1|
-call p1()|
-show create database mysqltest1|
-show create database mysqltest2|
-alter database mysqltest1 character set utf8|
-use mysqltest2|
-call mysqltest1.p1()|
-show create database mysqltest1|
-show create database mysqltest2|
-drop database mysqltest1|
-drop database mysqltest2|
-#
-# Restore the old environemnt
-use test|
-#
-# Bug#15217 "Using a SP cursor on a table created with PREPARE fails with
-# weird error". Check that the code that is supposed to work at
-# the first execution of a stored procedure actually works for
-# sp_instr_copen.
-
---disable_warnings
-drop table if exists t3|
-drop procedure if exists bug15217|
---enable_warnings
-create table t3 as select 1|
-create procedure bug15217()
-begin
- declare var1 char(255);
- declare cur1 cursor for select * from t3;
- open cur1;
- fetch cur1 into var1;
- select concat('data was: /', var1, '/');
- close cur1;
-end |
-# Returns expected result
-call bug15217()|
-flush tables |
-# Returns error with garbage as column name
-call bug15217()|
-drop table t3|
-drop procedure bug15217|
-
-
-#
-# BUG#21013: Performance Degrades when importing data that uses
-# Trigger and Stored Procedure
-#
-# This is a performance and memory leak test. Run with large number
-# passed to bug21013() procedure.
-#
---disable_warnings
-DROP PROCEDURE IF EXISTS bug21013 |
---enable_warnings
-
-CREATE PROCEDURE bug21013(IN lim INT)
-BEGIN
- DECLARE i INT DEFAULT 0;
- WHILE (i < lim) DO
- SET @b = LOCATE(_latin1'b', @a, 1);
- SET i = i + 1;
- END WHILE;
-END |
-
-SET @a = _latin2"aaaaaaaaaa" |
-CALL bug21013(10) |
-
-DROP PROCEDURE bug21013 |
-
-
-#
-# BUG#16211: Stored function return type for strings is ignored
-#
-
-# Prepare: create database with fixed, pre-defined character set.
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest1|
-DROP DATABASE IF EXISTS mysqltest2|
---enable_warnings
-
-CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8|
-CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8|
-
-# Test case:
-
-use mysqltest1|
-
-# - Create two stored functions -- with and without explicit CHARSET-clause
-# for return value;
-
-CREATE FUNCTION bug16211_f1() RETURNS CHAR(10)
- RETURN ""|
-
-CREATE FUNCTION bug16211_f2() RETURNS CHAR(10) CHARSET koi8r
- RETURN ""|
-
-CREATE FUNCTION mysqltest2.bug16211_f3() RETURNS CHAR(10)
- RETURN ""|
-
-CREATE FUNCTION mysqltest2.bug16211_f4() RETURNS CHAR(10) CHARSET koi8r
- RETURN ""|
-
-# - Check that CHARSET-clause is specified for the second function;
-
-SHOW CREATE FUNCTION bug16211_f1|
-SHOW CREATE FUNCTION bug16211_f2|
-
-SHOW CREATE FUNCTION mysqltest2.bug16211_f3|
-SHOW CREATE FUNCTION mysqltest2.bug16211_f4|
-
-SELECT dtd_identifier
-FROM INFORMATION_SCHEMA.ROUTINES
-WHERE ROUTINE_SCHEMA = "mysqltest1" AND ROUTINE_NAME = "bug16211_f1"|
-
-SELECT dtd_identifier
-FROM INFORMATION_SCHEMA.ROUTINES
-WHERE ROUTINE_SCHEMA = "mysqltest1" AND ROUTINE_NAME = "bug16211_f2"|
-
-SELECT dtd_identifier
-FROM INFORMATION_SCHEMA.ROUTINES
-WHERE ROUTINE_SCHEMA = "mysqltest2" AND ROUTINE_NAME = "bug16211_f3"|
-
-SELECT dtd_identifier
-FROM INFORMATION_SCHEMA.ROUTINES
-WHERE ROUTINE_SCHEMA = "mysqltest2" AND ROUTINE_NAME = "bug16211_f4"|
-
-SELECT CHARSET(bug16211_f1())|
-SELECT CHARSET(bug16211_f2())|
-
-SELECT CHARSET(mysqltest2.bug16211_f3())|
-SELECT CHARSET(mysqltest2.bug16211_f4())|
-
-# - Alter database character set.
-
-ALTER DATABASE mysqltest1 CHARACTER SET cp1251|
-ALTER DATABASE mysqltest2 CHARACTER SET cp1251|
-
-# - Check that CHARSET-clause has not changed.
-
-SHOW CREATE FUNCTION bug16211_f1|
-SHOW CREATE FUNCTION bug16211_f2|
-
-SHOW CREATE FUNCTION mysqltest2.bug16211_f3|
-SHOW CREATE FUNCTION mysqltest2.bug16211_f4|
-
-SELECT dtd_identifier
-FROM INFORMATION_SCHEMA.ROUTINES
-WHERE ROUTINE_SCHEMA = "mysqltest1" AND ROUTINE_NAME = "bug16211_f1"|
-
-SELECT dtd_identifier
-FROM INFORMATION_SCHEMA.ROUTINES
-WHERE ROUTINE_SCHEMA = "mysqltest1" AND ROUTINE_NAME = "bug16211_f2"|
-
-SELECT dtd_identifier
-FROM INFORMATION_SCHEMA.ROUTINES
-WHERE ROUTINE_SCHEMA = "mysqltest2" AND ROUTINE_NAME = "bug16211_f3"|
-
-SELECT dtd_identifier
-FROM INFORMATION_SCHEMA.ROUTINES
-WHERE ROUTINE_SCHEMA = "mysqltest2" AND ROUTINE_NAME = "bug16211_f4"|
-
-SELECT CHARSET(bug16211_f1())|
-SELECT CHARSET(bug16211_f2())|
-
-SELECT CHARSET(mysqltest2.bug16211_f3())|
-SELECT CHARSET(mysqltest2.bug16211_f4())|
-
-# Cleanup.
-
-use test|
-
-DROP DATABASE mysqltest1|
-DROP DATABASE mysqltest2|
-
-
-#
-# BUG#16676: Database CHARSET not used for stored procedures
-#
-
-# Prepare: create database with fixed, pre-defined character set.
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest1|
---enable_warnings
-
-CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8|
-
-# Test case:
-
-use mysqltest1|
-
-# - Create two stored procedures -- with and without explicit CHARSET-clause;
-
-CREATE PROCEDURE bug16676_p1(
- IN p1 CHAR(10),
- INOUT p2 CHAR(10),
- OUT p3 CHAR(10))
-BEGIN
- SELECT CHARSET(p1), COLLATION(p1);
- SELECT CHARSET(p2), COLLATION(p2);
- SELECT CHARSET(p3), COLLATION(p3);
-END|
-
-CREATE PROCEDURE bug16676_p2(
- IN p1 CHAR(10) CHARSET koi8r,
- INOUT p2 CHAR(10) CHARSET cp1251,
- OUT p3 CHAR(10) CHARSET greek)
-BEGIN
- SELECT CHARSET(p1), COLLATION(p1);
- SELECT CHARSET(p2), COLLATION(p2);
- SELECT CHARSET(p3), COLLATION(p3);
-END|
-
-# - Call procedures.
-
-SET @v2 = 'b'|
-SET @v3 = 'c'|
-
-CALL bug16676_p1('a', @v2, @v3)|
-CALL bug16676_p2('a', @v2, @v3)|
-
-# Cleanup.
-
-use test|
-
-DROP DATABASE mysqltest1|
-#
-# BUG#8153: Stored procedure with subquery and continue handler, wrong result
-#
-
---disable_warnings
-drop table if exists t3|
-drop table if exists t4|
-drop procedure if exists bug8153_subselect|
-drop procedure if exists bug8153_subselect_a|
-drop procedure if exists bug8153_subselect_b|
-drop procedure if exists bug8153_proc_a|
-drop procedure if exists bug8153_proc_b|
---enable_warnings
-
-create table t3 (a int)|
-create table t4 (a int)|
-insert into t3 values (1), (1), (2), (3)|
-insert into t4 values (1), (1)|
-
-## Testing the use case reported in Bug#8153
-
-create procedure bug8153_subselect()
-begin
- declare continue handler for sqlexception
- begin
- select 'statement failed';
- end;
- update t3 set a=a+1 where (select a from t4 where a=1) is null;
- select 'statement after update';
-end|
-
-call bug8153_subselect()|
-select * from t3|
-
-call bug8153_subselect()|
-select * from t3|
-
-drop procedure bug8153_subselect|
-
-## Testing a subselect with a non local handler
-
-create procedure bug8153_subselect_a()
-begin
- declare continue handler for sqlexception
- begin
- select 'in continue handler';
- end;
-
- select 'reachable code a1';
- call bug8153_subselect_b();
- select 'reachable code a2';
-end|
-
-create procedure bug8153_subselect_b()
-begin
- select 'reachable code b1';
- update t3 set a=a+1 where (select a from t4 where a=1) is null;
- select 'unreachable code b2';
-end|
-
-call bug8153_subselect_a()|
-select * from t3|
-
-call bug8153_subselect_a()|
-select * from t3|
-
-drop procedure bug8153_subselect_a|
-drop procedure bug8153_subselect_b|
-
-## Testing extra use cases, found while investigating
-## This is related to BUG#18787, with a non local handler
-
-create procedure bug8153_proc_a()
-begin
- declare continue handler for sqlexception
- begin
- select 'in continue handler';
- end;
-
- select 'reachable code a1';
- call bug8153_proc_b();
- select 'reachable code a2';
-end|
-
-create procedure bug8153_proc_b()
-begin
- select 'reachable code b1';
- select no_such_function();
- select 'unreachable code b2';
-end|
-
-call bug8153_proc_a()|
-
-drop procedure bug8153_proc_a|
-drop procedure bug8153_proc_b|
-drop table t3|
-drop table t4|
-
-#
-# BUG#19862: Sort with filesort by function evaluates function twice
-#
---disable_warnings
-drop procedure if exists bug19862|
---enable_warnings
-CREATE TABLE t11 (a INT)|
-CREATE TABLE t12 (a INT)|
-CREATE FUNCTION bug19862(x INT) RETURNS INT
- BEGIN
- INSERT INTO t11 VALUES (x);
- RETURN x+1;
- END|
-INSERT INTO t12 VALUES (1), (2)|
-SELECT bug19862(a) FROM t12 ORDER BY 1|
-SELECT * FROM t11|
-DROP TABLE t11, t12|
-DROP FUNCTION bug19862|
-
-
-# Bug#21002 "Derived table not selecting from a "real" table fails in JOINs"
-#
-# A regression caused by the fix for Bug#18444: for derived tables we should
-# set an empty string as the current database. They do not belong to any
-# database and must be usable even if there is no database
-# selected.
---disable_warnings
-drop table if exists t3|
-drop database if exists mysqltest1|
---enable_warnings
-create table t3 (a int)|
-insert into t3 (a) values (1), (2)|
-
-create database mysqltest1|
-use mysqltest1|
-drop database mysqltest1|
-
-# No current database
-select database()|
-
-select * from (select 1 as a) as t1 natural join (select * from test.t3) as t2|
-use test|
-drop table t3|
-
-
-# Test for BUG#16899: Possible buffer overflow in handling of DEFINER-clause.
-#
-# Prepare.
-
---disable_warnings
-DROP PROCEDURE IF EXISTS bug16899_p1|
-DROP FUNCTION IF EXISTS bug16899_f1|
---enable_warnings
-
---error ER_WRONG_STRING_LENGTH
-CREATE DEFINER=longer_than_80_456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789@localhost PROCEDURE bug16899_p1()
-BEGIN
- SET @a = 1;
-END|
-
---error ER_WRONG_STRING_LENGTH
-CREATE DEFINER=some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY
- FUNCTION bug16899_f1() RETURNS INT
-BEGIN
- RETURN 1;
-END|
-
-
-#
-# BUG#21416: SP: Recursion level higher than zero needed for non-recursive call
-#
---disable_warnings
-drop procedure if exists bug21416|
---enable_warnings
-create procedure bug21416() show create procedure bug21416|
-call bug21416()|
-drop procedure bug21416|
-
-
-#
-# BUG#21414: SP: Procedure undroppable, to some extent
-#
---disable_warnings
-DROP PROCEDURE IF EXISTS bug21414|
---enable_warnings
-
-CREATE PROCEDURE bug21414() SELECT 1|
-
-FLUSH TABLES WITH READ LOCK|
-
---error ER_CANT_UPDATE_WITH_READLOCK
-DROP PROCEDURE bug21414|
-
-UNLOCK TABLES|
-
---echo The following should succeed.
-DROP PROCEDURE bug21414|
-
-
-#
-# BUG#21311: Possible stack overrun if SP has non-latin1 name
-#
-set names utf8|
---disable_warnings
-drop database if exists това_е_дълго_име_за_база_данни_нали|
---enable_warnings
-create database това_е_дълго_име_за_база_данни_нали|
-INSERT INTO mysql.proc VALUES ('това_е_дълго_име_за_база_данни_нали','това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго','PROCEDURE','това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго','SQL','CONTAINS_SQL','NO','DEFINER','','','bad_body','root@localhost',now(), now(),'','', 'utf8', 'utf8_general_ci', 'utf8_general_ci', 'n/a', 'NONE')|
---error ER_SP_PROC_TABLE_CORRUPT
-call това_е_дълго_име_за_база_данни_нали.това_е_процедура_с_доста_дълго_име_нали_и_още_по_дълго()|
-drop database това_е_дълго_име_за_база_данни_нали|
-
-
-#
-# BUG#21493: Crash on the second call of a procedure containing
-# a select statement that uses an IN aggregating subquery
-#
-
-CREATE TABLE t3 (
- Member_ID varchar(15) NOT NULL,
- PRIMARY KEY (Member_ID)
-)|
-
-CREATE TABLE t4 (
- ID int(10) unsigned NOT NULL auto_increment,
- Member_ID varchar(15) NOT NULL default '',
- Action varchar(12) NOT NULL,
- Action_Date datetime NOT NULL,
- Track varchar(15) default NULL,
- User varchar(12) default NULL,
- Date_Updated timestamp NOT NULL default CURRENT_TIMESTAMP on update
- CURRENT_TIMESTAMP,
- PRIMARY KEY (ID),
- KEY Action (Action),
- KEY Action_Date (Action_Date)
-)|
-
-
-INSERT INTO t3(Member_ID) VALUES
- ('111111'), ('222222'), ('333333'), ('444444'), ('555555'), ('666666')|
-
-INSERT INTO t4(Member_ID, Action, Action_Date, Track) VALUES
- ('111111', 'Disenrolled', '2006-03-01', 'CAD' ),
- ('111111', 'Enrolled', '2006-03-01', 'CAD' ),
- ('111111', 'Disenrolled', '2006-07-03', 'CAD' ),
- ('222222', 'Enrolled', '2006-03-07', 'CAD' ),
- ('222222', 'Enrolled', '2006-03-07', 'CHF' ),
- ('222222', 'Disenrolled', '2006-08-02', 'CHF' ),
- ('333333', 'Enrolled', '2006-03-01', 'CAD' ),
- ('333333', 'Disenrolled', '2006-03-01', 'CAD' ),
- ('444444', 'Enrolled', '2006-03-01', 'CAD' ),
- ('555555', 'Disenrolled', '2006-03-01', 'CAD' ),
- ('555555', 'Enrolled', '2006-07-21', 'CAD' ),
- ('555555', 'Disenrolled', '2006-03-01', 'CHF' ),
- ('666666', 'Enrolled', '2006-02-09', 'CAD' ),
- ('666666', 'Enrolled', '2006-05-12', 'CHF' ),
- ('666666', 'Disenrolled', '2006-06-01', 'CAD' )|
-
---disable_warnings
-DROP FUNCTION IF EXISTS bug21493|
---enable_warnings
-
-CREATE FUNCTION bug21493(paramMember VARCHAR(15)) RETURNS varchar(45)
-BEGIN
-DECLARE tracks VARCHAR(45);
-SELECT GROUP_CONCAT(Track SEPARATOR ', ') INTO tracks FROM t4
- WHERE Member_ID=paramMember AND Action='Enrolled' AND
- (Track,Action_Date) IN (SELECT Track, MAX(Action_Date) FROM t4
- WHERE Member_ID=paramMember GROUP BY Track);
-RETURN tracks;
-END|
-
-SELECT bug21493('111111')|
-SELECT bug21493('222222')|
-
-SELECT bug21493(Member_ID) FROM t3|
-
-DROP FUNCTION bug21493|
-DROP TABLE t3,t4|
-
-#
-# Bug#20028 Function with select return no data
-#
-
---disable_warnings
-drop function if exists func_20028_a|
-drop function if exists func_20028_b|
-drop function if exists func_20028_c|
-drop procedure if exists proc_20028_a|
-drop procedure if exists proc_20028_b|
-drop procedure if exists proc_20028_c|
-drop table if exists table_20028|
---enable_warnings
-
-create table table_20028 (i int)|
-
-SET @save_sql_mode=@@sql_mode|
-
-SET sql_mode=''|
-
-create function func_20028_a() returns integer
-begin
- declare temp integer;
- select i into temp from table_20028 limit 1;
- return ifnull(temp, 0);
-end|
-
-create function func_20028_b() returns integer
-begin
- return func_20028_a();
-end|
-
-create function func_20028_c() returns integer
-begin
- declare div_zero integer;
- set SQL_MODE='TRADITIONAL';
- select 1/0 into div_zero;
- return div_zero;
-end|
-
-create procedure proc_20028_a()
-begin
- declare temp integer;
- select i into temp from table_20028 limit 1;
-end|
-
-create procedure proc_20028_b()
-begin
- call proc_20028_a();
-end|
-
-create procedure proc_20028_c()
-begin
- declare div_zero integer;
- set SQL_MODE='TRADITIONAL';
- select 1/0 into div_zero;
-end|
-
-select func_20028_a()|
-select func_20028_b()|
---error ER_DIVISION_BY_ZERO
-select func_20028_c()|
-call proc_20028_a()|
-call proc_20028_b()|
---error ER_DIVISION_BY_ZERO
-call proc_20028_c()|
-
-SET sql_mode='TRADITIONAL'|
-
-drop function func_20028_a|
-drop function func_20028_b|
-drop function func_20028_c|
-drop procedure proc_20028_a|
-drop procedure proc_20028_b|
-drop procedure proc_20028_c|
-
-create function func_20028_a() returns integer
-begin
- declare temp integer;
- select i into temp from table_20028 limit 1;
- return ifnull(temp, 0);
-end|
-
-create function func_20028_b() returns integer
-begin
- return func_20028_a();
-end|
-
-create function func_20028_c() returns integer
-begin
- declare div_zero integer;
- set SQL_MODE='';
- select 1/0 into div_zero;
- return div_zero;
-end|
-
-create procedure proc_20028_a()
-begin
- declare temp integer;
- select i into temp from table_20028 limit 1;
-end|
-
-create procedure proc_20028_b()
-begin
- call proc_20028_a();
-end|
-
-create procedure proc_20028_c()
-begin
- declare div_zero integer;
- set SQL_MODE='';
- select 1/0 into div_zero;
-end|
-
-select func_20028_a()|
-select func_20028_b()|
-select func_20028_c()|
-call proc_20028_a()|
-call proc_20028_b()|
-call proc_20028_c()|
-
-SET @@sql_mode=@save_sql_mode|
-
-drop function func_20028_a|
-drop function func_20028_b|
-drop function func_20028_c|
-drop procedure proc_20028_a|
-drop procedure proc_20028_b|
-drop procedure proc_20028_c|
-drop table table_20028|
-
-#
-# Bug#21462 Stored procedures with no arguments require parenthesis
-#
-
---disable_warnings
-drop procedure if exists proc_21462_a|
-drop procedure if exists proc_21462_b|
---enable_warnings
-
-create procedure proc_21462_a()
-begin
- select "Called A";
-end|
-
-create procedure proc_21462_b(x int)
-begin
- select "Called B";
-end|
-
-call proc_21462_a|
-call proc_21462_a()|
--- error ER_SP_WRONG_NO_OF_ARGS
-call proc_21462_a(1)|
-
--- error ER_SP_WRONG_NO_OF_ARGS
-call proc_21462_b|
--- error ER_SP_WRONG_NO_OF_ARGS
-call proc_21462_b()|
-call proc_21462_b(1)|
-
-drop procedure proc_21462_a|
-drop procedure proc_21462_b|
-
-
-#
-# Bug#19733 "Repeated alter, or repeated create/drop, fails"
-# Check that CREATE/DROP INDEX is re-execution friendly.
-#
---disable_warnings
-drop table if exists t3|
-drop procedure if exists proc_bug19733|
---enable_warnings
-create table t3 (s1 int)|
-
-create procedure proc_bug19733()
-begin
- declare v int default 0;
- while v < 100 do
- create index i on t3 (s1);
- drop index i on t3;
- set v = v + 1;
- end while;
-end|
-
-call proc_bug19733()|
-call proc_bug19733()|
-call proc_bug19733()|
-
-drop procedure proc_bug19733|
-drop table t3|
-
-
-#
-# BUG#20492: Subsequent calls to stored procedure yeild incorrect
-# result if join is used
-#
-# Optimized ON expression in join wasn't properly saved for reuse.
-#
---disable_warnings
-DROP PROCEDURE IF EXISTS p1|
-DROP VIEW IF EXISTS v1, v2|
-DROP TABLE IF EXISTS t3, t4|
---enable_warnings
-
-CREATE TABLE t3 (t3_id INT)|
-
-INSERT INTO t3 VALUES (0)|
-INSERT INTO t3 VALUES (1)|
-
-CREATE TABLE t4 (t4_id INT)|
-
-INSERT INTO t4 VALUES (2)|
-
-CREATE VIEW v1 AS
-SELECT t3.t3_id, t4.t4_id
-FROM t3 JOIN t4 ON t3.t3_id = 0|
-
-CREATE VIEW v2 AS
-SELECT t3.t3_id AS t3_id_1, v1.t3_id AS t3_id_2, v1.t4_id
-FROM t3 LEFT JOIN v1 ON t3.t3_id = 0|
-
-CREATE PROCEDURE p1() SELECT * FROM v2|
-
-# Results should not differ.
-CALL p1()|
-CALL p1()|
-
-DROP PROCEDURE p1|
-DROP VIEW v1, v2|
-DROP TABLE t3, t4|
-
---echo End of 5.0 tests
-
---echo Begin of 5.1 tests
-
-#
-# BUG#18239: Possible to overload internal functions with stored functions
-#
-
-delimiter ;|
-
---disable_warnings
-drop function if exists pi;
---enable_warnings
-
-create function pi() returns varchar(50)
-return "pie, my favorite desert.";
-
-SET @save_sql_mode=@@sql_mode;
-
-SET SQL_MODE='IGNORE_SPACE';
-
-select pi(), pi ();
-
-# Non deterministic warnings from db_load_routine
---disable_warnings
-select test.pi(), test.pi ();
---enable_warnings
-
-SET SQL_MODE='';
-
-select pi(), pi ();
-
-# Non deterministic warnings from db_load_routine
---disable_warnings
-select test.pi(), test.pi ();
---enable_warnings
-
-SET @@sql_mode=@save_sql_mode;
-
-drop function pi;
-# End of BUG#18239
-
-#
-# BUG#22619: Spaces considered harmful
-#
-
---disable_warnings
-drop function if exists test.database;
-drop function if exists test.current_user;
-drop function if exists test.md5;
---enable_warnings
-
-create database nowhere;
-use nowhere;
-drop database nowhere;
-
-SET @save_sql_mode=@@sql_mode;
-
-SET SQL_MODE='IGNORE_SPACE';
-
-select database(), database ();
-select current_user(), current_user ();
-select md5("aaa"), md5 ("aaa");
-
-SET SQL_MODE='';
-
-select database(), database ();
-select current_user(), current_user ();
-select md5("aaa"), md5 ("aaa");
-
-use test;
-
-create function `database`() returns varchar(50)
-return "Stored function database";
-
-create function `current_user`() returns varchar(50)
-return "Stored function current_user";
-
-create function md5(x varchar(50)) returns varchar(50)
-return "Stored function md5";
-
-SET SQL_MODE='IGNORE_SPACE';
-
-select database(), database ();
-select current_user(), current_user ();
-select md5("aaa"), md5 ("aaa");
-
-# Non deterministic warnings from db_load_routine
---disable_warnings
-select test.database(), test.database ();
-select test.current_user(), test.current_user ();
-select test.md5("aaa"), test.md5 ("aaa");
---enable_warnings
-
-SET SQL_MODE='';
-
-select database(), database ();
-select current_user(), current_user ();
-select md5("aaa"), md5 ("aaa");
-
-# Non deterministic warnings from db_load_routine
---disable_warnings
-select test.database(), test.database ();
-select test.current_user(), test.current_user ();
-select test.md5("aaa"), test.md5 ("aaa");
---enable_warnings
-
-SET @@sql_mode=@save_sql_mode;
-
-drop function test.database;
-drop function test.current_user;
-drop function md5;
-
-use test;
-delimiter |;
-# End of BUG#22619
-
---echo End of 5.1 tests
-
-#
-# BUG#23760: ROW_COUNT() and store procedure not owrking together
-#
---disable_warnings
-DROP TABLE IF EXISTS bug23760|
-DROP TABLE IF EXISTS bug23760_log|
-DROP PROCEDURE IF EXISTS bug23760_update_log|
-DROP PROCEDURE IF EXISTS bug23760_test_row_count|
-DROP FUNCTION IF EXISTS bug23760_rc_test|
---enable_warnings
-CREATE TABLE bug23760 (
- id INT NOT NULL AUTO_INCREMENT ,
- num INT NOT NULL ,
- PRIMARY KEY ( id )
-)|
-
-CREATE TABLE bug23760_log (
- id INT NOT NULL AUTO_INCREMENT ,
- reason VARCHAR(50)NULL ,
- ammount INT NOT NULL ,
- PRIMARY KEY ( id )
-)|
-
-CREATE PROCEDURE bug23760_update_log(r Varchar(50), a INT)
-BEGIN
- INSERT INTO bug23760_log (reason, ammount) VALUES(r, a);
-END|
-
-CREATE PROCEDURE bug23760_test_row_count()
-BEGIN
- UPDATE bug23760 SET num = num + 1;
- CALL bug23760_update_log('Test is working', ROW_COUNT());
- UPDATE bug23760 SET num = num - 1;
-END|
-
-
-CREATE PROCEDURE bug23760_test_row_count2(level INT)
-BEGIN
- IF level THEN
- UPDATE bug23760 SET num = num + 1;
- CALL bug23760_update_log('Test2 is working', ROW_COUNT());
- CALL bug23760_test_row_count2(level - 1);
- END IF;
-END|
-
-CREATE FUNCTION bug23760_rc_test(in_var INT) RETURNS INT RETURN in_var|
-
-INSERT INTO bug23760 (num) VALUES (0), (1), (1), (2), (3), (5), (8)|
-SELECT ROW_COUNT()|
-
-CALL bug23760_test_row_count()|
-SELECT * FROM bug23760_log ORDER BY id|
-
-SET @save_max_sp_recursion= @@max_sp_recursion_depth|
-SELECT @save_max_sp_recursion|
-SET max_sp_recursion_depth= 5|
-SELECT @@max_sp_recursion_depth|
-CALL bug23760_test_row_count2(2)|
-SELECT ROW_COUNT()|
-SELECT * FROM bug23760_log ORDER BY id|
-SELECT * FROM bug23760 ORDER by ID|
-SET max_sp_recursion_depth= @save_max_sp_recursion|
-
-SELECT bug23760_rc_test(123)|
-INSERT INTO bug23760 (num) VALUES (13), (21), (34), (55)|
-SELECT bug23760_rc_test(ROW_COUNT())|
-
-DROP TABLE bug23760, bug23760_log|
-DROP PROCEDURE bug23760_update_log|
-DROP PROCEDURE bug23760_test_row_count|
-DROP PROCEDURE bug23760_test_row_count2|
-DROP FUNCTION bug23760_rc_test|
-
-#
-# BUG#24117: server crash on a FETCH with a cursor on a table which is not in
-# the table cache
-#
-
---disable_warnings
-DROP PROCEDURE IF EXISTS bug24117|
-DROP TABLE IF EXISTS t3|
---enable_warnings
-CREATE TABLE t3(c1 ENUM('abc'))|
-INSERT INTO t3 VALUES('abc')|
-CREATE PROCEDURE bug24117()
-BEGIN
- DECLARE t3c1 ENUM('abc');
- DECLARE mycursor CURSOR FOR SELECT c1 FROM t3;
- OPEN mycursor;
- FLUSH TABLES;
- FETCH mycursor INTO t3c1;
- CLOSE mycursor;
-END|
-CALL bug24117()|
-DROP PROCEDURE bug24117|
-DROP TABLE t3|
-
-#
-# Bug#8407(Stored functions/triggers ignore exception handler)
-#
-
---disable_warnings
-drop function if exists func_8407_a|
-drop function if exists func_8407_b|
---enable_warnings
-
-create function func_8407_a() returns int
-begin
- declare x int;
-
- declare continue handler for sqlexception
- begin
- end;
-
- select 1 from no_such_view limit 1 into x;
-
- return x;
-end|
-
-create function func_8407_b() returns int
-begin
- declare x int default 0;
-
- declare continue handler for sqlstate '42S02'
- begin
- set x:= x+1000;
- end;
-
- case (select 1 from no_such_view limit 1)
- when 1 then set x:= x+1;
- when 2 then set x:= x+2;
- else set x:= x+100;
- end case;
- set x:=x + 500;
-
- return x;
-end|
-
-select func_8407_a()|
-select func_8407_b()|
-
-drop function func_8407_a|
-drop function func_8407_b|
-
-#
-# Bug#26503 (Illegal SQL exception handler code causes the server to crash)
-#
-
---disable_warnings
-drop table if exists table_26503|
-drop procedure if exists proc_26503_ok_1|
-drop procedure if exists proc_26503_ok_2|
-drop procedure if exists proc_26503_ok_3|
-drop procedure if exists proc_26503_ok_4|
---enable_warnings
-
-create table table_26503(a int unique)|
-
-create procedure proc_26503_ok_1(v int)
-begin
- declare i int default 5;
-
- declare continue handler for sqlexception
- begin
- select 'caught something';
- retry:
- while i > 0 do
- begin
- set i = i - 1;
- select 'looping', i;
- iterate retry;
- select 'dead code';
- end;
- end while retry;
- select 'leaving handler';
- end;
-
- select 'do something';
- insert into table_26503 values (v);
- select 'do something again';
- insert into table_26503 values (v);
-end|
-
-create procedure proc_26503_ok_2(v int)
-begin
- declare i int default 5;
-
- declare continue handler for sqlexception
- begin
- select 'caught something';
- retry:
- while i > 0 do
- begin
- set i = i - 1;
- select 'looping', i;
- leave retry;
- select 'dead code';
- end;
- end while;
- select 'leaving handler';
- end;
-
- select 'do something';
- insert into table_26503 values (v);
- select 'do something again';
- insert into table_26503 values (v);
-end|
-
-## The outer retry label should not prevent using the inner label.
-
-create procedure proc_26503_ok_3(v int)
-begin
- declare i int default 5;
-
-retry:
- begin
- declare continue handler for sqlexception
- begin
- select 'caught something';
- retry:
- while i > 0 do
- begin
- set i = i - 1;
- select 'looping', i;
- iterate retry;
- select 'dead code';
- end;
- end while retry;
- select 'leaving handler';
- end;
-
- select 'do something';
- insert into table_26503 values (v);
- select 'do something again';
- insert into table_26503 values (v);
- end;
-end|
-
-## The outer retry label should not prevent using the inner label.
-
-create procedure proc_26503_ok_4(v int)
-begin
- declare i int default 5;
-
-retry:
- begin
- declare continue handler for sqlexception
- begin
- select 'caught something';
- retry:
- while i > 0 do
- begin
- set i = i - 1;
- select 'looping', i;
- leave retry;
- select 'dead code';
- end;
- end while;
- select 'leaving handler';
- end;
-
- select 'do something';
- insert into table_26503 values (v);
- select 'do something again';
- insert into table_26503 values (v);
- end;
-end|
-
-call proc_26503_ok_1(1)|
-call proc_26503_ok_2(2)|
-call proc_26503_ok_3(3)|
-call proc_26503_ok_4(4)|
-
-drop table table_26503|
-drop procedure proc_26503_ok_1|
-drop procedure proc_26503_ok_2|
-drop procedure proc_26503_ok_3|
-drop procedure proc_26503_ok_4|
-
-#
-# Bug#25373: Stored functions wasn't compared correctly which leads to a wrong
-# result.
-#
---disable_warnings
-DROP FUNCTION IF EXISTS bug25373|
---disable_warnings
-CREATE FUNCTION bug25373(p1 INTEGER) RETURNS INTEGER
-LANGUAGE SQL DETERMINISTIC
-RETURN p1;|
-CREATE TABLE t3 (f1 INT, f2 FLOAT)|
-INSERT INTO t3 VALUES (1, 3.4), (1, 2), (1, 0.9), (2, 8), (2, 7)|
-SELECT SUM(f2), bug25373(f1) FROM t3 GROUP BY bug25373(f1) WITH ROLLUP|
-DROP FUNCTION bug25373|
-DROP TABLE t3|
-
-
-#
-# BUG#25082: Default database change on trigger execution breaks replication.
-#
-# As it turned out, this bug has actually two bugs. So, here we have two test
-# cases -- one in sp.test, the other in sp-security.test.
-#
-
-#
-# Test case 1: error on dropping the current database.
-#
-
-# Prepare.
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest1|
-DROP DATABASE IF EXISTS mysqltest2|
---enable_warnings
-
-CREATE DATABASE mysqltest1|
-CREATE DATABASE mysqltest2|
-
-# Test.
-
-CREATE PROCEDURE mysqltest1.p1()
- DROP DATABASE mysqltest2|
-
-use mysqltest2|
-
-CALL mysqltest1.p1()|
-
-SELECT DATABASE()|
-
-# Cleanup.
-
-DROP DATABASE mysqltest1|
-
-use test|
-
-
-#
-# Bug#20777: Function w BIGINT UNSIGNED shows diff. behaviour --ps-protocol
---disable_warnings
-drop function if exists bug20777|
-drop table if exists examplebug20777|
---enable_warnings
-create function bug20777(f1 bigint unsigned) returns bigint unsigned
-begin
- set f1 = (f1 - 10); set f1 = (f1 + 10);
-return f1;
-end|
-delimiter ;|
-select bug20777(9223372036854775803) as '9223372036854775803 2**63-5';
-select bug20777(9223372036854775804) as '9223372036854775804 2**63-4';
-select bug20777(9223372036854775805) as '9223372036854775805 2**63-3';
-select bug20777(9223372036854775806) as '9223372036854775806 2**63-2';
-select bug20777(9223372036854775807) as '9223372036854775807 2**63-1';
-select bug20777(9223372036854775808) as '9223372036854775808 2**63+0';
-select bug20777(9223372036854775809) as '9223372036854775809 2**63+1';
-select bug20777(9223372036854775810) as '9223372036854775810 2**63+2';
---error ER_DATA_OUT_OF_RANGE
-select bug20777(-9223372036854775808) as 'lower bounds signed bigint';
-select bug20777(9223372036854775807) as 'upper bounds signed bigint';
---error ER_DATA_OUT_OF_RANGE
-select bug20777(0) as 'lower bounds unsigned bigint';
-select bug20777(18446744073709551615) as 'upper bounds unsigned bigint';
-select bug20777(18446744073709551616) as 'upper bounds unsigned bigint + 1';
---error ER_DATA_OUT_OF_RANGE
-select bug20777(-1) as 'lower bounds unsigned bigint - 1';
-
-create table examplebug20777 as select
- 0 as 'i',
- bug20777(9223372036854775806) as '2**63-2',
- bug20777(9223372036854775807) as '2**63-1',
- bug20777(9223372036854775808) as '2**63',
- bug20777(9223372036854775809) as '2**63+1',
- bug20777(18446744073709551614) as '2**64-2',
- bug20777(18446744073709551615) as '2**64-1',
- bug20777(18446744073709551616) as '2**64';
-insert into examplebug20777 values (1, 9223372036854775806, 9223372036854775807, 223372036854775808, 9223372036854775809, 18446744073709551614, 18446744073709551615, 8446744073709551616);
-show create table examplebug20777;
-select * from examplebug20777 order by i;
-
-drop table examplebug20777;
-select bug20777(18446744073709551613)+1;
-drop function bug20777;
-delimiter |;
-
-
-#
-# BUG#5274: Stored procedure crash if length of CHAR variable too great.
-#
-
-# Prepare.
-
---disable_warnings
-DROP FUNCTION IF EXISTS bug5274_f1|
-DROP FUNCTION IF EXISTS bug5274_f2|
---enable_warnings
-
-# Test.
-
-CREATE FUNCTION bug5274_f1(p1 CHAR) RETURNS CHAR
- RETURN CONCAT(p1, p1)|
-
-CREATE FUNCTION bug5274_f2() RETURNS CHAR
-BEGIN
- DECLARE v1 INT DEFAULT 0;
- DECLARE v2 CHAR DEFAULT 'x';
-
- WHILE v1 < 30 DO
- SET v1 = v1 + 1;
- SET v2 = bug5274_f1(v2);
- END WHILE;
-
- RETURN v2;
-END|
-
-SELECT bug5274_f2()|
-
-# Cleanup.
-
-DROP FUNCTION bug5274_f1|
-DROP FUNCTION bug5274_f2|
-
-#
-# Bug#21513 (SP having body starting with quoted label rendered unusable)
-#
---disable_warnings
-drop procedure if exists proc_21513|
---enable_warnings
-
-create procedure proc_21513()`my_label`:BEGIN END|
-show create procedure proc_21513|
-
-drop procedure proc_21513|
-
-###
---echo End of 5.0 tests.
-
-#
-# BUG#NNNN: New bug synopsis
-#
-#--disable_warnings
-#drop procedure if exists bugNNNN|
-#--enable_warnings
-#create procedure bugNNNN...
-#
-# Add bugs above this line. Use existing tables t1 and t2 when
-# practical, or create table t3,t4 etc temporarily (and drop them).
-# NOTE: The delimiter is `|`, and not `;`. It is changed to `;`
-# at the end of the file!
-#
-
-delimiter ;|
-drop table t1,t2;
-
-# Disable warnings to allow test run without InnoDB
---disable_warnings
-CREATE TABLE t1 (a int auto_increment primary key) engine=MyISAM;
-CREATE TABLE t2 (a int auto_increment primary key, b int) engine=innodb;
---enable_warnings
-set @a=0;
-
-delimiter |;
-CREATE function bug27354() RETURNS int not deterministic
-begin
-insert into t1 values (null);
-set @a=@a+1;
-return @a;
-end|
-
-delimiter ;|
-update t2 set b=1 where a=bug27354();
-select count(t_1.a),count(t_2.a) from t1 as t_1, t2 as t_2 /* must be 0,0 */;
-insert into t2 values (1,1),(2,2),(3,3);
-update t2 set b=-b where a=bug27354();
-select * from t2 /* must return 1,-1 ... */;
-select count(*) from t1 /* must be 3 */;
-
-
-drop table t1,t2;
-drop function bug27354;
-
-#
-# Bug #28605: SHOW CREATE VIEW with views using stored_procedures no longer
-# showing SP names.
-#
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE FUNCTION metered(a INT) RETURNS INT RETURN 12;
-
-CREATE VIEW v1 AS SELECT test.metered(a) as metered FROM t1;
-
-SHOW CREATE VIEW v1;
-
-DROP VIEW v1;
-DROP FUNCTION metered;
-DROP TABLE t1;
-
-#
-# Bug#29834: Accessing a view column by name in SP/PS causes a memory leak.
-#
-# This is leak test. Run with large number assigned to $execute_cnt,
-# $p1_cnt, $p2_cnt, @p1_p2_cnt, $f1_normal_cnt or $f1_prep_cnt variables.
-#
-
-let $execute_cnt= 2;
-let $p1_cnt= 2;
-let $p2_cnt= 2;
-SET @p1_p2_cnt= 2;
-let $f1_normal_cnt= 2;
-let $f1_prep_cnt= 2;
-
-CREATE TABLE t1 (c1 INT);
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-PREPARE s1 FROM 'SELECT c1 FROM v1';
-while ($execute_cnt)
-{
- EXECUTE s1;
- dec $execute_cnt;
-}
-
-DELIMITER |;
-
-CREATE PROCEDURE p1(IN loops BIGINT(19) UNSIGNED)
-BEGIN
- WHILE loops > 0 DO
- SELECT c1 FROM v1;
- SET loops = loops - 1;
- END WHILE;
-END|
-
-CREATE PROCEDURE p2(IN loops BIGINT(19) UNSIGNED)
-BEGIN
- WHILE loops > 0 DO
- SELECT c1 FROM v1;
- CALL p1(@p1_p2_cnt);
- SET loops = loops - 1;
- END WHILE;
-END|
-
-CREATE FUNCTION f1(loops INT UNSIGNED)
- RETURNS INT
-BEGIN
- DECLARE tmp INT;
- WHILE loops > 0 DO
- SELECT c1 INTO tmp FROM v1;
- SET loops = loops - 1;
- END WHILE;
- RETURN loops;
-END|
-
-DELIMITER ;|
-
-eval CALL p1($p1_cnt);
-eval CALL p2($p2_cnt);
-
-eval SELECT f1($f1_normal_cnt);
-
-eval PREPARE s1 FROM 'SELECT f1($f1_prep_cnt)';
-EXECUTE s1;
-EXECUTE s1;
-
-DROP PROCEDURE p1;
-DROP PROCEDURE p2;
-DROP FUNCTION f1;
-DROP VIEW v1;
-DROP TABLE t1;
-
-#
-# Bug#28551 "The warning 'No database selected' is reported when calling
-# stored procedures"
-#
---disable_warnings
-drop database if exists mysqltest_db1;
---enable_warnings
-create database mysqltest_db1;
-create procedure mysqltest_db1.sp_bug28551() begin end;
-call mysqltest_db1.sp_bug28551();
-show warnings;
-drop database mysqltest_db1;
-#
-# Bug#29050 Creation of a legal stored procedure fails if a database is not
-# selected prior
-#
---disable_warnings
-drop database if exists mysqltest_db1;
-drop table if exists test.t1;
---enable_warnings
-create database mysqltest_db1;
-use mysqltest_db1;
-# For the sake of its side effect
-drop database mysqltest_db1;
-# Now we have no current database selected.
-create table test.t1 (id int);
-insert into test.t1 (id) values (1);
-delimiter //;
-create procedure test.sp_bug29050() begin select * from t1; end//
-delimiter ;//
-show warnings;
-call test.sp_bug29050();
-show warnings;
-# Restore the old current database
-use test;
-drop procedure sp_bug29050;
-drop table t1;
-
-#
-# Bug #30120 SP with local variables with non-ASCII names crashes server.
-#
-
-SET NAMES latin1;
-
-DELIMITER |;
-
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE INT;
- SELECT ;
-END|
-
-DELIMITER ;|
-
-CALL p1();
-
-SET NAMES default;
-DROP PROCEDURE p1;
-
-#
-# Bug#25411 (trigger code truncated)
-#
-
---disable_warnings
-drop procedure if exists proc_25411_a;
-drop procedure if exists proc_25411_b;
-drop procedure if exists proc_25411_c;
---enable_warnings
-
-delimiter $$;
-
-create procedure proc_25411_a()
-begin
- /* real comment */
- select 1;
- /*! select 2; */
- select 3;
- /*!00000 select 4; */
- /*!999999 select 5; */
-end
-$$
-
-create procedure proc_25411_b(
-/* real comment */
-/*! p1 int, */
-/*!00000 p2 int */
-/*!999999 ,p3 int */
-)
-begin
- select p1, p2;
-end
-$$
-
-create procedure proc_25411_c()
-begin
- select 1/*!,2*//*!00000,3*//*!999999,4*/;
- select 1/*! ,2*//*!00000 ,3*//*!999999 ,4*/;
- select 1/*!,2 *//*!00000,3 *//*!999999,4 */;
- select 1/*! ,2 *//*!00000 ,3 *//*!999999 ,4 */;
- select 1 /*!,2*/ /*!00000,3*/ /*!999999,4*/ ;
-end
-$$
-
-delimiter ;$$
-
-show create procedure proc_25411_a;
-call proc_25411_a();
-
-show create procedure proc_25411_b;
-select name, param_list, body from mysql.proc where name like "%25411%";
-call proc_25411_b(10, 20);
-
-show create procedure proc_25411_c;
-call proc_25411_c();
-
-drop procedure proc_25411_a;
-drop procedure proc_25411_b;
-drop procedure proc_25411_c;
-
-
-#
-# Bug#26302 (MySQL server cuts off trailing "*/" from comments in SP/func)
-#
-
---disable_warnings
-drop procedure if exists proc_26302;
---enable_warnings
-
-create procedure proc_26302()
-select 1 /* testing */;
-
-show create procedure proc_26302;
-
-select ROUTINE_NAME, ROUTINE_DEFINITION from information_schema.ROUTINES
-where ROUTINE_NAME = "proc_26302";
-
-drop procedure proc_26302;
-
-
-# Bug #29338: no optimization for stored functions with a trivial body
-# always returning constant.
-#
-
-CREATE FUNCTION f1() RETURNS INT DETERMINISTIC RETURN 2;
-CREATE FUNCTION f2(I INT) RETURNS INT DETERMINISTIC RETURN 3;
-
-CREATE TABLE t1 (c1 INT, INDEX(c1));
-
-INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
-
-CREATE VIEW v1 AS SELECT c1 FROM t1;
-
-EXPLAIN SELECT * FROM t1 WHERE c1=1;
-EXPLAIN SELECT * FROM t1 WHERE c1=f1();
-
-EXPLAIN SELECT * FROM v1 WHERE c1=1;
-EXPLAIN SELECT * FROM v1 WHERE c1=f1();
-
-EXPLAIN SELECT * FROM t1 WHERE c1=f2(10);
-EXPLAIN SELECT * FROM t1 WHERE c1=f2(c1);
-EXPLAIN SELECT * FROM t1 WHERE c1=f2(rand());
-
-
-DROP VIEW v1;
-DROP FUNCTION f1;
-DROP FUNCTION f2;
-DROP TABLE t1;
-
-#
-# Bug#29408 Cannot find view in columns table if the selection contains a function
-#
-delimiter |;
-
-create function f1()
- returns int(11)
-not deterministic
-contains sql
-sql security definer
-comment ''
-begin
- declare x int(11);
- set x=-1;
- return x;
-end|
-
-delimiter ;|
-
-create view v1 as select 1 as one, f1() as days;
-
-connect (bug29408, localhost, root,,*NO-ONE*);
-connection bug29408;
-
-show create view test.v1;
-select column_name from information_schema.columns
-where table_name='v1' and table_schema='test';
-
-connection default;
-disconnect bug29408;
-drop view v1;
-drop function f1;
-
-#
-# Bug#13675: DATETIME/DATE type in store proc param seems to be converted as
-# varbinary
-#
-
---echo
---echo # Bug#13675.
---echo
-
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
-DROP PROCEDURE IF EXISTS p2;
-
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
---echo
-
-CREATE PROCEDURE p1(v DATETIME) CREATE TABLE t1 SELECT v;
-
-CREATE PROCEDURE p2(v INT) CREATE TABLE t1 SELECT v;
-
---echo
-CALL p1(NOW());
-SHOW CREATE TABLE t1;
-
---echo
-DROP TABLE t1;
-
---echo
-CALL p1('text');
-SHOW CREATE TABLE t1;
-
---echo
-DROP TABLE t1;
-
---echo
-CALL p2(10);
-SHOW CREATE TABLE t1;
-
---echo
-DROP TABLE t1;
-
---echo
-CALL p2('text');
-SHOW CREATE TABLE t1;
-
---echo
-DROP TABLE t1;
-
---echo
-DROP PROCEDURE p1;
-DROP PROCEDURE p2;
-
-###########################################################################
-
-#
-# Bug#31035: select from function, group by result crasher.
-#
-
-###########################################################################
-
---echo
-
---echo #
---echo # Bug#31035.
---echo #
-
---echo
-
---echo #
---echo # - Prepare.
---echo #
-
---echo
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP FUNCTION IF EXISTS f1;
-DROP FUNCTION IF EXISTS f2;
-DROP FUNCTION IF EXISTS f3;
-DROP FUNCTION IF EXISTS f4;
---enable_warnings
-
---echo
-
---echo #
---echo # - Create required objects.
---echo #
-
---echo
-
-CREATE TABLE t1(c1 INT);
-
---echo
-
-INSERT INTO t1 VALUES (1), (2), (3);
-
---echo
-
-CREATE FUNCTION f1()
- RETURNS INT
- NOT DETERMINISTIC
- RETURN 1;
-
---echo
-
-CREATE FUNCTION f2(p INT)
- RETURNS INT
- NOT DETERMINISTIC
- RETURN 1;
-
---echo
-
-CREATE FUNCTION f3()
- RETURNS INT
- DETERMINISTIC
- RETURN 1;
-
---echo
-
-CREATE FUNCTION f4(p INT)
- RETURNS INT
- DETERMINISTIC
- RETURN 1;
-
---echo
-
---echo #
---echo # - Check.
---echo #
-
---echo
-
-# Not deterministic function, no arguments.
-
-SELECT f1() AS a FROM t1 GROUP BY a;
-
---echo
-
-# Not deterministic function, non-constant argument.
-
-SELECT f2(@a) AS a FROM t1 GROUP BY a;
-
---echo
-
-# Deterministic function, no arguments.
-
-SELECT f3() AS a FROM t1 GROUP BY a;
-
---echo
-
-# Deterministic function, constant argument.
-
-SELECT f4(0) AS a FROM t1 GROUP BY a;
-
---echo
-
-# Deterministic function, non-constant argument.
-
-SELECT f4(@a) AS a FROM t1 GROUP BY a;
-
---echo
-
---echo #
---echo # - Cleanup.
---echo #
-
---echo
-
-DROP TABLE t1;
-DROP FUNCTION f1;
-DROP FUNCTION f2;
-DROP FUNCTION f3;
-DROP FUNCTION f4;
-
---echo
-
-###########################################################################
-
-#
-# Bug#31191: JOIN in combination with stored function crashes the server.
-#
-
-###########################################################################
-
---echo #
---echo # Bug#31191.
---echo #
-
---echo
-
---echo #
---echo # - Prepare.
---echo #
-
---echo
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS t2;
-DROP FUNCTION IF EXISTS f1;
---enable_warnings
-
---echo
-
---echo #
---echo # - Create required objects.
---echo #
-
---echo
-
-CREATE TABLE t1 (
- id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
- barcode INT(8) UNSIGNED ZEROFILL nOT NULL,
- PRIMARY KEY (id),
- UNIQUE KEY barcode (barcode)
-);
-
---echo
-
-INSERT INTO t1 (id, barcode) VALUES (1, 12345678);
-INSERT INTO t1 (id, barcode) VALUES (2, 12345679);
-
---echo
-
-CREATE TABLE test.t2 (
- id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
- barcode BIGINT(11) UNSIGNED ZEROFILL NOT NULL,
- PRIMARY KEY (id)
-);
-
---echo
-
-INSERT INTO test.t2 (id, barcode) VALUES (1, 12345106708);
-INSERT INTO test.t2 (id, barcode) VALUES (2, 12345106709);
-
---echo
-
-CREATE FUNCTION f1(p INT(8))
- RETURNS BIGINT(11) UNSIGNED
- READS SQL DATA
- RETURN FLOOR(p/1000)*1000000 + 100000 + FLOOR((p MOD 1000)/10)*100 + (p MOD 10);
-
---echo
-
---echo #
---echo # - Check.
---echo #
-
---echo
-
-SELECT DISTINCT t1.barcode, f1(t1.barcode)
-FROM t1
-INNER JOIN t2
-ON f1(t1.barcode) = t2.barcode
-WHERE t1.barcode=12345678;
-
---echo
-
---echo #
---echo # - Cleanup.
---echo #
-
---echo
-
-DROP TABLE t1;
-DROP TABLE t2;
-DROP FUNCTION f1;
-
---echo
-
-###########################################################################
-
-#
-# Bug#31226: Group by function crashes mysql.
-#
-
-###########################################################################
-
---echo #
---echo # Bug#31226.
---echo #
-
---echo
-
---echo #
---echo # - Prepare.
---echo #
-
---echo
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP FUNCTION IF EXISTS f1;
---enable_warnings
-
---echo
-
---echo #
---echo # - Create required objects.
---echo #
-
---echo
-
-CREATE TABLE t1(id INT);
-
---echo
-
-INSERT INTO t1 VALUES (1), (2), (3);
-
---echo
-
-CREATE FUNCTION f1()
- RETURNS DATETIME
- NOT DETERMINISTIC NO SQL
- RETURN NOW();
-
---echo
-
---echo #
---echo # - Check.
---echo #
-
---echo
-
---replace_column 1 <timestamp>
-SELECT f1() FROM t1 GROUP BY 1;
-
---echo
-
---echo #
---echo # - Cleanup.
---echo #
-
---echo
-
-DROP TABLE t1;
-DROP FUNCTION f1;
-
---echo
-
-###########################################################################
-
-#
-# Bug#28318 (CREATE FUNCTION (UDF) requires a schema)
-#
-
---disable_warnings
-DROP PROCEDURE IF EXISTS db28318_a.t1;
-DROP PROCEDURE IF EXISTS db28318_b.t2;
-DROP DATABASE IF EXISTS db28318_a;
-DROP DATABASE IF EXISTS db28318_b;
---enable_warnings
-
-CREATE DATABASE db28318_a;
-CREATE DATABASE db28318_b;
-
-CREATE PROCEDURE db28318_a.t1() SELECT "db28318_a.t1";
-CREATE PROCEDURE db28318_b.t2() CALL t1();
-
-use db28318_a;
-
-# In db28318_b.t2, t1 refers to db28318_b.t1
---error ER_SP_DOES_NOT_EXIST
-CALL db28318_b.t2();
-
-DROP PROCEDURE db28318_a.t1;
-DROP PROCEDURE db28318_b.t2;
-DROP DATABASE db28318_a;
-DROP DATABASE db28318_b;
-use test;
-
-###########################################################################
-
-#
-# Bug#29770 Two handlers are allowed to catch an error in an stored procedure.
-#
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP PROCEDURE IF EXISTS bug29770;
---enable_warnings
-
-CREATE TABLE t1(a int);
-delimiter |;
-CREATE PROCEDURE bug29770()
-BEGIN
- DECLARE CONTINUE HANDLER FOR SQLSTATE '42S22' SET @state:= 'run';
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @exception:= 'run';
- SELECT x FROM t1;
-END|
-delimiter ;|
-CALL bug29770();
-SELECT @state, @exception;
-DROP TABLE t1;
-DROP PROCEDURE bug29770;
-
-#
-# Bug#33618 Crash in sp_rcontext
-#
-
-use test;
-
---disable_warnings
-drop table if exists t_33618;
-drop procedure if exists proc_33618;
---enable_warnings
-
-create table t_33618 (`a` int, unique(`a`), `b` varchar(30)) engine=myisam;
-insert into t_33618 (`a`,`b`) values (1,'1'),(2,'2');
-
-delimiter //;
-
-create procedure proc_33618(num int)
-begin
- declare count1 int default '0';
- declare vb varchar(30);
- declare last_row int;
-
- while(num>=1) do
- set num=num-1;
- begin
- declare cur1 cursor for select `a` from t_33618;
- declare continue handler for not found set last_row = 1;
- set last_row:=0;
- open cur1;
- rep1:
- repeat
- begin
- declare exit handler for 1062 begin end;
- fetch cur1 into vb;
- if (last_row = 1) then
- leave rep1;
- end if;
- end;
- until last_row=1
- end repeat;
- close cur1;
- end;
- end while;
-end//
-
-delimiter ;//
-
-call proc_33618(20);
-
-drop table t_33618;
-drop procedure proc_33618;
-
---echo #
---echo # Bug#30787: Stored function ignores user defined alias.
---echo #
-use test;
---disable_warnings
-drop function if exists func30787;
---enable_warnings
-create table t1(f1 int);
-insert into t1 values(1),(2);
-delimiter |;
-create function func30787(p1 int) returns int
-begin
- return p1;
-end |
-delimiter ;|
-select (select func30787(f1)) as ttt from t1;
-drop function func30787;
-drop table t1;
-
-#
-# Bug #33811: Call to stored procedure with SELECT * / RIGHT JOIN fails
-# after the first time
-#
-CREATE TABLE t1 (id INT);
-INSERT INTO t1 VALUES (1),(2),(3),(4);
-
-CREATE PROCEDURE test_sp()
- SELECT t1.* FROM t1 RIGHT JOIN t1 t2 ON t1.id=t2.id;
-
-CALL test_sp();
-CALL test_sp();
-
-DROP PROCEDURE test_sp;
-DROP TABLE t1;
-
-
-###########################################################################
-#
-# Bug#38291 memory corruption and server crash with view/sp/function
-#
-
-create table t1(c1 INT);
-create function f1(p1 int) returns varchar(32)
- return 'aaa';
-create view v1 as select f1(c1) as parent_control_name from t1;
-
-delimiter //;
-create procedure p1()
-begin
- select parent_control_name as c1 from v1;
-end //
-delimiter ;//
-
-call p1();
-call p1();
-
-drop procedure p1;
-drop function f1;
-drop view v1;
-drop table t1;
-
-#
-# Bug#38469 invalid memory read and/or crash with utf8 text field, stored procedure, uservar
-#
-delimiter $;
---disable_warnings
-drop procedure if exists `p2` $
---enable_warnings
-create procedure `p2`(in `a` text charset utf8)
-begin
- declare `pos` int default 1;
- declare `str` text charset utf8;
- set `str` := `a`;
- select substr(`str`, `pos`+ 1 ) into `str`;
-end $
-delimiter ;$
-call `p2`('s s s s s s');
-drop procedure `p2`;
-
-#
-# Bug#38823: Invalid memory access when a SP statement does wildcard expansion
-#
-
---disable_warnings
-drop table if exists t1;
-drop procedure if exists p1;
---enable_warnings
-
-delimiter $;
-create procedure p1() begin select * from t1; end$
---error ER_NO_SUCH_TABLE
-call p1$
-create table t1 (a integer)$
-call p1$
-alter table t1 add b integer;
-call p1$
-delimiter ;$
-
-drop table t1;
-drop procedure p1;
-
---echo # ------------------------------------------------------------------
---echo # -- End of 5.0 tests
---echo # ------------------------------------------------------------------
-
-###########################################################################
-
-#
-# Bug#20550: Stored function: wrong RETURN type metadata when used in a VIEW.
-#
-
-###########################################################################
-
---echo
-
---echo #
---echo # Bug#20550.
---echo #
-
---echo
-
---echo #
---echo # - Prepare.
---echo #
-
---echo
-
---disable_warnings
-DROP VIEW IF EXISTS v1;
-DROP VIEW IF EXISTS v2;
-DROP FUNCTION IF EXISTS f1;
-DROP FUNCTION IF EXISTS f2;
---enable_warnings
-
---echo
-
---echo #
---echo # - Create required objects.
---echo #
-
---echo
-
-CREATE FUNCTION f1() RETURNS VARCHAR(65525) RETURN 'Hello';
-
---echo
-
-CREATE FUNCTION f2() RETURNS TINYINT RETURN 1;
-
---echo
-
-CREATE VIEW v1 AS SELECT f1();
-
---echo
-
-CREATE VIEW v2 AS SELECT f2();
-
---echo
-
---echo #
---echo # - Check.
---echo #
-
---echo
-
-SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'v1';
-
---echo
-
-SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'v2';
-
---echo
-
---echo #
---echo # - Cleanup.
---echo #
-
---echo
-
-DROP FUNCTION f1;
-DROP FUNCTION f2;
-DROP VIEW v1;
-DROP VIEW v2;
-
---echo
-
-###########################################################################
-
-#
-# Bug#24923: Functions with ENUM issues.
-#
-
-###########################################################################
-
---echo #
---echo # - Bug#24923: prepare.
---echo #
-
---echo
-
---disable_warnings
-DROP FUNCTION IF EXISTS f1;
---enable_warnings
-
---echo
-
---echo #
---echo # - Bug#24923: create required objects.
---echo #
-
---echo
-
-delimiter |;
-
-CREATE FUNCTION f1(p INT)
- RETURNS ENUM ('Very_long_enum_element_identifier',
- 'Another_very_long_enum_element_identifier')
- BEGIN
- CASE p
- WHEN 1 THEN
- RETURN 'Very_long_enum_element_identifier';
- ELSE
- RETURN 'Another_very_long_enum_element_identifier';
- END CASE;
- END|
-
-delimiter ;|
-
---echo
-
---echo #
---echo # - Bug#24923: check.
---echo #
-
---echo
-
-SELECT f1(1);
-
---echo
-
-SELECT f1(2);
-
---echo
-
-SHOW CREATE FUNCTION f1;
-
---echo #
---echo # - Bug#24923: cleanup.
---echo #
-
---echo
-
-DROP FUNCTION f1;
-
---echo
-
-###########################################################################
-
-#
-# Bug#32633 Can not create any routine if SQL_MODE=no_engine_substitution
-#
-# Ensure that when new SQL modes are introduced, they are also added to
-# the mysql.proc table.
-#
-
---disable_warnings
-drop procedure if exists p;
---enable_warnings
-set @old_mode= @@sql_mode;
-set @@sql_mode= cast(pow(2,32)-1 as unsigned integer);
-select @@sql_mode into @full_mode;
-create procedure p() as begin end;
-call p();
-set @@sql_mode= @old_mode;
-# Rename SQL modes that differ in name between the server and the table definition.
-select replace(@full_mode, 'ALLOW_INVALID_DATES', 'INVALID_DATES') into @full_mode;
-select name from mysql.proc where name = 'p' and sql_mode = @full_mode;
-drop procedure p;
-
-#
-# Bug#43962 "Packets out of order" calling a SHOW TABLE STATUS
-#
-DELIMITER //;
-CREATE DEFINER = 'root'@'localhost' PROCEDURE p1()
-NOT DETERMINISTIC
-CONTAINS SQL
-SQL SECURITY DEFINER
-COMMENT ''
-BEGIN
- SHOW TABLE STATUS like 't1';
-END;//
-DELIMITER ;//
-
-
-CREATE TABLE t1 (f1 INT);
---disable_result_log
-let $tab_count= 4;
-while ($tab_count)
-{
- EVAL CALL p1();
- dec $tab_count ;
-}
---enable_result_log
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-#
-# Bug#47649 crash during CALL procedure
-#
-CREATE TABLE t1 ( f1 integer, primary key (f1));
-CREATE TABLE t2 LIKE t1;
-CREATE TEMPORARY TABLE t3 LIKE t1;
-delimiter |;
-CREATE PROCEDURE p1 () BEGIN SELECT f1 FROM t3 AS A WHERE A.f1 IN ( SELECT f1 FROM t3 ) ;
-END|
-delimiter ;|
-CALL p1;
-CREATE VIEW t3 AS SELECT f1 FROM t2 A WHERE A.f1 IN ( SELECT f1 FROM t2 );
-DROP TABLE t3;
-CALL p1;
-CALL p1;
-DROP PROCEDURE p1;
-DROP TABLE t1, t2;
-DROP VIEW t3;
-
---echo #
---echo # Bug #46629: Item_in_subselect::val_int(): Assertion `0'
---echo # on subquery inside a SP
---echo #
-CREATE TABLE t1(a INT);
-CREATE TABLE t2(a INT, b INT PRIMARY KEY);
-
-DELIMITER |;
-CREATE PROCEDURE p1 ()
-BEGIN
- SELECT a FROM t1 A WHERE A.b IN (SELECT b FROM t2 AS B);
-END|
-DELIMITER ;|
---error ER_BAD_FIELD_ERROR
-CALL p1;
---error ER_BAD_FIELD_ERROR
-CALL p1;
-DROP PROCEDURE p1;
-DROP TABLE t1, t2;
-
---echo #
---echo # Bug#47627: SET @@{global.session}.local_variable in stored routine causes crash
---echo # Bug#48626: Crash or lost connection using SET for declared variables with @@
---echo #
-
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
-DROP PROCEDURE IF EXISTS p2;
-DROP PROCEDURE IF EXISTS p3;
---enable_warnings
-
-delimiter //;
-
---error ER_UNKNOWN_SYSTEM_VARIABLE
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE v INT DEFAULT 0;
- SET @@SESSION.v= 10;
-END//
-
-CREATE PROCEDURE p2()
-BEGIN
- DECLARE v INT DEFAULT 0;
- SET v= 10;
-END//
-call p2()//
-
---error ER_UNKNOWN_SYSTEM_VARIABLE
-CREATE PROCEDURE p3()
-BEGIN
- DECLARE v INT DEFAULT 0;
- SELECT @@SESSION.v;
-END//
-
---error ER_UNKNOWN_SYSTEM_VARIABLE
-CREATE PROCEDURE p4()
-BEGIN
- DECLARE v INT DEFAULT 0;
- SET @@GLOBAL.v= 10;
-END//
-
-CREATE PROCEDURE p5()
-BEGIN
- DECLARE init_connect INT DEFAULT 0;
- SET init_connect= 10;
- SET @@GLOBAL.init_connect= 'SELECT 1';
- SET @@SESSION.IDENTITY= 1;
- SELECT @@SESSION.IDENTITY;
- SELECT @@GLOBAL.init_connect;
- SELECT init_connect;
-END//
-
---error ER_UNKNOWN_SYSTEM_VARIABLE
-CREATE PROCEDURE p6()
-BEGIN
- DECLARE v INT DEFAULT 0;
- SET @@v= 0;
-END//
-
-delimiter ;//
-
-SET @old_init_connect= @@GLOBAL.init_connect;
-CALL p5();
-SET @@GLOBAL.init_connect= @old_init_connect;
-
-DROP PROCEDURE p2;
-DROP PROCEDURE p5;
-
-
---echo #
---echo # Bug#11840395 (formerly known as bug#60347):
---echo # The string "versiondata" seems
---echo # to be 'leaking' into the schema name space
---echo #
---disable_warnings
-DROP DATABASE IF EXISTS mixedCaseDbName;
---enable_warnings
-CREATE DATABASE mixedCaseDbName;
-DELIMITER |;
-CREATE PROCEDURE mixedCaseDbName.tryMyProc() begin end|
-CREATE FUNCTION mixedCaseDbName.tryMyFunc() returns text begin return 'IT WORKS'; end
-|
-DELIMITER ;|
-call mixedCaseDbName.tryMyProc();
-select mixedCaseDbName.tryMyFunc();
-DROP DATABASE mixedCaseDbName;
-
-
---echo #
---echo # Bug#11766594 59736: SELECT DISTINCT.. INCORRECT RESULT WITH DETERMINISTIC FUNCTION IN WHERE C
---echo #
-
-CREATE TABLE t1 (a INT, b INT, KEY(b));
-CREATE TABLE t2 (c INT, d INT, KEY(c));
-INSERT INTO t1 VALUES (1,1),(1,1),(1,2);
-INSERT INTO t2 VALUES (1,1),(1,2);
-
-DELIMITER $;
-
-CREATE FUNCTION f1() RETURNS INT DETERMINISTIC
-BEGIN
- DECLARE a int;
- -- SQL statement inside
- SELECT 1 INTO a;
- RETURN a;
-END $
-
-DELIMITER ;$
-
-SELECT COUNT(DISTINCT d) FROM t1, t2 WHERE a = c AND b = f1();
-
-DROP FUNCTION f1;
-DROP TABLE t1, t2;
-
-
---echo # ------------------------------------------------------------------
---echo # -- End of 5.1 tests
---echo # ------------------------------------------------------------------
-
-#
-# Bug#39255: Stored procedures: crash if function references nonexistent table
-#
-
---disable_warnings
-DROP FUNCTION IF EXISTS f1;
-DROP TABLE IF EXISTS t_non_existing;
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-delimiter |;
-CREATE FUNCTION f1() RETURNS INT
-BEGIN
- DECLARE v INT;
- SELECT a INTO v FROM t_non_existing;
- RETURN 1;
-END|
-delimiter ;|
-
-CREATE TABLE t1 (a INT) ENGINE = myisam;
-INSERT INTO t1 VALUES (1);
-
---error ER_NO_SUCH_TABLE
-SELECT * FROM t1 WHERE a = f1();
-
-DROP FUNCTION f1;
-DROP TABLE t1;
-
-#
-# Bug#36649: Condition area is not properly cleaned up after stored routine invocation
-#
-
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
---enable_warnings
-
-delimiter |;
-CREATE PROCEDURE p1(a INT, b CHAR)
-BEGIN
- IF a > 0 THEN
- CALL p1(a-1, 'ab');
- ELSE
- SELECT 1;
- END IF;
-END|
-delimiter ;|
-
-SET @save_max_sp_recursion= @@max_sp_recursion_depth;
-SET @@max_sp_recursion_depth= 5;
-CALL p1(4, 'a');
-SET @@max_sp_recursion_depth= @save_max_sp_recursion;
-
-DROP PROCEDURE p1;
-
-#
-# Ensure that rules for message list clean up are being respected.
-#
-
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
---enable_warnings
-
-delimiter |;
-CREATE PROCEDURE p1(a CHAR)
-BEGIN
- SELECT 1;
- SELECT CAST('10 ' as UNSIGNED INTEGER);
- SELECT 1;
-END|
-delimiter ;|
-
-CALL p1('data truncated parameter');
-
-DROP PROCEDURE p1;
-
-#
-# Cascading stored procedure/function calls.
-#
-
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
-DROP PROCEDURE IF EXISTS p2;
-DROP PROCEDURE IF EXISTS p3;
-DROP PROCEDURE IF EXISTS p4;
---enable_warnings
-
-delimiter |;
-CREATE PROCEDURE p1()
- CALL p2()|
-CREATE PROCEDURE p2()
- CALL p3()|
-CREATE PROCEDURE p3()
- CALL p4()|
-CREATE PROCEDURE p4()
-BEGIN
- SELECT 1;
- SELECT CAST('10 ' as UNSIGNED INTEGER);
- SELECT 2;
-END|
-delimiter ;|
-
-CALL p1();
-
-DROP PROCEDURE p1;
-DROP PROCEDURE p2;
-DROP PROCEDURE p3;
-DROP PROCEDURE p4;
-
---disable_warnings
-DROP FUNCTION IF EXISTS f1;
-DROP FUNCTION IF EXISTS f2;
-DROP FUNCTION IF EXISTS f3;
-DROP FUNCTION IF EXISTS f4;
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (a CHAR(2));
-
-INSERT INTO t1 VALUES ('aa');
-
-delimiter |;
-CREATE FUNCTION f1() RETURNS CHAR
- RETURN (SELECT f2())|
-CREATE FUNCTION f2() RETURNS CHAR
- RETURN (SELECT f3())|
-CREATE FUNCTION f3() RETURNS CHAR
- RETURN (SELECT f4())|
-CREATE FUNCTION f4() RETURNS CHAR
-BEGIN
- RETURN (SELECT a FROM t1);
-END|
-delimiter ;|
-
-SELECT f1();
-
-DROP FUNCTION f1;
-DROP FUNCTION f2;
-DROP FUNCTION f3;
-DROP FUNCTION f4;
-DROP TABLE t1;
-
---echo #
---echo # Bug#34197: CREATE PROCEDURE fails when COMMENT truncated in non
---echo # strict SQL mode
---echo #
-
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
---enable_warnings
-
-CREATE PROCEDURE p1 ()
-COMMENT
-'12345678901234567890123456789012345678901234567890123456789012345678901234567890'
-BEGIN
-END;
-
-SELECT comment FROM mysql.proc WHERE name = "p1";
-
-SELECT routine_comment FROM information_schema.routines WHERE routine_name = "p1";
-
-DROP PROCEDURE p1;
-
-
---echo #
---echo # Bug #47313 assert in check_key_in_view during CALL procedure
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP VIEW IF EXISTS t1, t2_unrelated;
-DROP PROCEDURE IF EXISTS p1;
---enable_warnings
-
-CREATE PROCEDURE p1(IN x INT) INSERT INTO t1 VALUES (x);
-CREATE VIEW t1 AS SELECT 10 AS f1;
-
---echo # t1 refers to the view
---error ER_NON_INSERTABLE_TABLE
-CALL p1(1);
-
-CREATE TEMPORARY TABLE t1 (f1 INT);
-
---echo # t1 still refers to the view since it was inlined
---error ER_NON_INSERTABLE_TABLE
-CALL p1(2);
-
-DROP VIEW t1;
-
---echo # t1 now refers to the temporary table
-CALL p1(3);
-
---echo # Check which values were inserted into the temp table.
-SELECT * FROM t1;
-
-DROP TEMPORARY TABLE t1;
-DROP PROCEDURE p1;
-
---echo # Now test what happens if the sp cache is invalidated.
-
-CREATE PROCEDURE p1(IN x INT) INSERT INTO t1 VALUES (x);
-CREATE VIEW t1 AS SELECT 10 AS f1;
-CREATE VIEW v2_unrelated AS SELECT 1 AS r1;
-
---echo # Load the procedure into the sp cache
---error ER_NON_INSERTABLE_TABLE
-CALL p1(4);
-
-CREATE TEMPORARY TABLE t1 (f1 int);
-
-ALTER VIEW v2_unrelated AS SELECT 2 AS r1;
-
---echo # Alter view causes the sp cache to be invalidated.
---echo # Now t1 refers to the temporary table, not the view.
-CALL p1(5);
-
---echo # Check which values were inserted into the temp table.
-SELECT * FROM t1;
-
-DROP TEMPORARY TABLE t1;
-DROP VIEW t1, v2_unrelated;
-DROP PROCEDURE p1;
-
-CREATE PROCEDURE p1(IN x INT) INSERT INTO t1 VALUES (x);
-CREATE TEMPORARY TABLE t1 (f1 INT);
-
---echo # t1 refers to the temporary table
-CALL p1(6);
-
-CREATE VIEW t1 AS SELECT 10 AS f1;
-
---echo # Create view causes the sp cache to be invalidated.
---echo # t1 still refers to the temporary table since it shadows the view.
-CALL p1(7);
-
-DROP VIEW t1;
-
---echo # Check which values were inserted into the temp table.
-SELECT * FROM t1;
-
-DROP TEMPORARY TABLE t1;
-DROP PROCEDURE p1;
-
---echo #
---echo # Bug #11918 Can't use a declared variable in LIMIT clause
---echo #
---disable_warnings
-drop table if exists t1;
-drop procedure if exists p1;
---enable_warnings
-create table t1 (c1 int);
-insert into t1 (c1) values (1), (2), (3), (4), (5);
-
-delimiter |;
-create procedure p1()
-begin
- declare a integer;
- declare b integer;
- select * from t1 limit a, b;
-end|
-delimiter ;|
---echo # How do we handle NULL limit values?
-call p1();
-drop table t1;
-create table t1 (a int);
-insert into t1 (a) values (1), (2), (3), (4), (5);
---echo #
---echo # Do we correctly resolve identifiers in LIMIT?
---echo # Since DROP and CREATE did not invalidate
---echo # the SP cache, we can't test until
---echo # we drop and re-create the procedure.
---echo #
---error ER_BAD_FIELD_ERROR
-call p1();
---echo #
---echo # Drop and recreate the procedure, then repeat
---echo #
-drop procedure p1;
-delimiter |;
-create procedure p1()
-begin
- declare a integer;
- declare b integer;
- select * from t1 limit a, b;
-end|
-delimiter ;|
---echo # Stored procedure variables are resolved correctly in the LIMIT
-call p1();
-drop table t1;
-create table t1 (c1 int);
-insert into t1 (c1) values (1), (2), (3), (4), (5);
-drop procedure p1;
---echo # Try to create a procedure that
---echo # refers to non-existing variables.
---error ER_SP_UNDECLARED_VAR
-create procedure p1(p1 integer, p2 integer)
- select * from t1 limit a, b;
---echo #
---echo # Try to use data types not allowed in LIMIT
---echo #
---error ER_WRONG_SPVAR_TYPE_IN_LIMIT
-create procedure p1(p1 date, p2 date) select * from t1 limit p1, p2;
---error ER_WRONG_SPVAR_TYPE_IN_LIMIT
-create procedure p1(p1 integer, p2 float) select * from t1 limit p1, p2;
---error ER_WRONG_SPVAR_TYPE_IN_LIMIT
-create procedure p1(p1 integer, p2 char(1)) select * from t1 limit p1, p2;
---error ER_WRONG_SPVAR_TYPE_IN_LIMIT
-create procedure p1(p1 varchar(5), p2 char(1)) select * from t1 limit p1, p2;
---error ER_WRONG_SPVAR_TYPE_IN_LIMIT
-create procedure p1(p1 decimal, p2 decimal) select * from t1 limit p1, p2;
---error ER_WRONG_SPVAR_TYPE_IN_LIMIT
-create procedure p1(p1 double, p2 double) select * from t1 limit p1, p2;
-
---echo #
---echo # Finally, test the valid case.
---echo #
-create procedure p1(p1 integer, p2 integer)
- select * from t1 limit p1, p2;
-
-call p1(NULL, NULL);
-call p1(0, 0);
-call p1(0, -1);
-call p1(-1, 0);
-call p1(-1, -1);
-call p1(0, 1);
-call p1(1, 0);
-call p1(1, 5);
-call p1(3, 2);
-
-delimiter |;
---echo # Try to create a function that
---echo # refers to non-existing variables.
---error ER_SP_UNDECLARED_VAR
-create function f1(p1 integer, p2 integer)
- returns int
-begin
- declare a int;
- set a = (select count(*) from t1 limit a, b);
- return a;
-end|
-
-create function f1()
- returns int
-begin
- declare a, b, c int;
- set a = (select count(*) from t1 limit b, c);
- return a;
-end|
-
-delimiter ;|
---echo # How do we handle NULL limit values?
-select f1();
-
-drop function f1;
-
-delimiter |;
---echo #
---echo # Try to use data types not allowed in LIMIT
---echo #
---error ER_WRONG_SPVAR_TYPE_IN_LIMIT
-create function f1(p1 date, p2 date)
- returns int
-begin
- declare a int;
- set a = (select count(*) from t1 limit p1, p2);
- return a;
-end|
-
---error ER_WRONG_SPVAR_TYPE_IN_LIMIT
-create function f1(p1 integer, p2 float)
- returns int
-begin
- declare a int;
- set a = (select count(*) from t1 limit p1, p2);
- return a;
-end|
-
---error ER_WRONG_SPVAR_TYPE_IN_LIMIT
-create function f1(p1 integer, p2 char(1))
- returns int
-begin
- declare a int;
- set a = (select count(*) from t1 limit p1, p2);
- return a;
-end|
-
---error ER_WRONG_SPVAR_TYPE_IN_LIMIT
-create function f1(p1 varchar(5), p2 char(1))
- returns int
-begin
- declare a int;
- set a = (select count(*) from t1 limit p1, p2);
- return a;
-end|
-
---error ER_WRONG_SPVAR_TYPE_IN_LIMIT
-create function f1(p1 decimal, p2 decimal)
- returns int
-begin
- declare a int;
- set a = (select count(*) from t1 limit p1, p2);
- return a;
-end|
-
---error ER_WRONG_SPVAR_TYPE_IN_LIMIT
-create function f1(p1 double, p2 double)
- returns int
-begin
- declare a int;
- set a = (select count(*) from t1 limit p1, p2);
- return a;
-end|
-
---echo #
---echo # Finally, test the valid case.
---echo #
-
-create function f1(p1 integer, p2 integer)
-returns int
-begin
- declare count int;
- set count= (select count(*) from (select * from t1 limit p1, p2) t_1);
- return count;
-end|
-
-delimiter ;|
-
-select f1(0, 0);
-select f1(0, -1);
-select f1(-1, 0);
-select f1(-1, -1);
-select f1(0, 1);
-select f1(1, 0);
-select f1(1, 5);
-select f1(3, 2);
-
---echo # Cleanup
-drop table t1;
-drop procedure p1;
-drop function f1;
-
---echo #
---echo # BUG#11766234: 59299: ASSERT (TABLE_REF->TABLE || TABLE_REF->VIEW)
---echo # FAILS IN SET_FIELD_ITERATOR
---echo #
-
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (a INT);
-CREATE VIEW v1 AS SELECT a FROM t2;
-CREATE PROCEDURE proc() SELECT * FROM t1 NATURAL JOIN v1;
-ALTER TABLE t2 CHANGE COLUMN a b CHAR;
-
---echo
---error ER_VIEW_INVALID
-CALL proc();
---error ER_VIEW_INVALID
-CALL proc();
-
---echo
-DROP TABLE t1,t2;
-DROP VIEW v1;
-DROP PROCEDURE proc;
-
-
---echo
---echo # --
---echo # -- Bug 11765684 - 58674: SP-cache does not detect changes in
---echo # -- pre-locking list caused by triggers
---echo # ---
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS t2;
-DROP TABLE IF EXISTS t3;
-DROP PROCEDURE IF EXISTS p1;
---enable_warnings
-
-CREATE TABLE t1(a INT);
-CREATE TABLE t2(a INT);
-CREATE TABLE t3(a INT);
-
-CREATE PROCEDURE p1()
- INSERT INTO t1(a) VALUES (1);
-
---echo
-CREATE TRIGGER t1_ai AFTER INSERT ON t1
- FOR EACH ROW
- INSERT INTO t2(a) VALUES (new.a);
-
---echo
-CALL p1();
-
---echo
-CREATE TRIGGER t1_bi BEFORE INSERT ON t1
- FOR EACH ROW
- INSERT INTO t3(a) VALUES (new.a);
-
---echo
-CALL p1();
-
---echo
-DROP TABLE t1, t2, t3;
-DROP PROCEDURE p1;
---echo
-
-
---echo
---echo # --
---echo # -- Bug#12652769 - 61470: case operator in stored routine retains old
---echo # -- value of input parameter
---echo # ---
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP PROCEDURE IF EXISTS p1;
---enable_warnings
-
-CREATE TABLE t1 (s1 CHAR(5) CHARACTER SET utf8);
-INSERT INTO t1 VALUES ('a');
-
-delimiter |;
-
-CREATE PROCEDURE p1(dt DATETIME, i INT)
-BEGIN
- SELECT
- CASE
- WHEN i = 1 THEN 2
- ELSE dt
- END AS x1;
-
- SELECT
- CASE _latin1'a'
- WHEN _utf8'a' THEN 'A'
- END AS x2;
-
- SELECT
- CASE _utf8'a'
- WHEN _latin1'a' THEN _utf8'A'
- END AS x3;
-
- SELECT
- CASE s1
- WHEN _latin1'a' THEN _latin1'b'
- ELSE _latin1'c'
- END AS x4
- FROM t1;
-END|
-
-delimiter ;|
-
---echo
-CALL p1('2011-04-03 05:14:10', 1);
-CALL p1('2011-04-03 05:14:11', 2);
-CALL p1('2011-04-03 05:14:12', 2);
-CALL p1('2011-04-03 05:14:13', 2);
-
---echo
-DROP TABLE t1;
-DROP PROCEDURE p1;
---echo
-
---echo #
---echo # Bug#12621017 - Crash if a sp variable is used in the
---echo # limit clause of a set statement
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP PROCEDURE IF EXISTS p1;
-DROP PROCEDURE IF EXISTS p2;
---enable_warnings
-
-CREATE TABLE t1 (c1 INT);
-INSERT INTO t1 VALUES (1);
-
-delimiter |;
-
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE foo, cnt INT UNSIGNED DEFAULT 1;
- SET foo = (SELECT MIN(c1) FROM t1 LIMIT cnt);
-END|
-
-CREATE PROCEDURE p2()
-BEGIN
-
-DECLARE iLimit INT;
-DECLARE iVal INT;
-
-DECLARE cur1 CURSOR FOR
- SELECT c1 FROM t1
- LIMIT iLimit;
-
-SET iLimit=1;
-
-OPEN cur1;
-FETCH cur1 INTO iVal;
-
-END|
-
-delimiter ;|
-
-CALL p1();
-CALL p2();
-
-DROP PROCEDURE p1;
-DROP PROCEDURE p2;
-DROP TABLE t1;
-
---echo
---echo # Bug#13805127: Stored program cache produces wrong result in same THD
---echo
-
-delimiter |;
-
-CREATE PROCEDURE p1(x INT UNSIGNED)
-BEGIN
- SELECT c1, t2.c2, count(c3)
- FROM
- (
- SELECT 3 as c2 FROM dual WHERE x = 1
- UNION
- SELECT 2 FROM dual WHERE x = 1 OR x = 2
- ) AS t1,
- (
- SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
- UNION
- SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
- UNION
- SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
- ) AS t2
- WHERE t2.c2 = t1.c2
- GROUP BY c1, c2
- ;
-END|
-
-delimiter ;|
-
---echo
-CALL p1(1);
-CALL p1(2);
-CALL p1(1);
-
-DROP PROCEDURE p1;
-
---echo # End of 5.5 test
-
-
---echo #
---echo # Bug#12663165 SP DEAD CODE REMOVAL DOESN'T UNDERSTAND CONTINUE HANDLERS
---echo #
-
---disable_warnings
-DROP FUNCTION IF EXISTS f1;
---enable_warnings
-
-delimiter $;
-CREATE FUNCTION f1() RETURNS INT
-BEGIN
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
- BEGIN
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION RETURN f1();
- BEGIN
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION RETURN f1();
- RETURN f1();
- END;
- END;
-RETURN 1;
-END $
-delimiter ;$
-
-# This used to cause an assertion.
-SELECT f1();
-
-DROP FUNCTION f1;
-
---echo # ------------------------------------------------------------------
---echo # -- End of 5.1 tests
---echo # ------------------------------------------------------------------
-
---echo #
---echo # lp:993459 Execution of PS for a query with GROUP BY
---echo # returns wrong result (see also mysql bug#13805127)
---echo #
-
---echo
---echo # Bug#13805127: Stored program cache produces wrong result in same THD
---echo
-
-delimiter |;
-
-CREATE PROCEDURE p1(x INT UNSIGNED)
-BEGIN
- SELECT c1, t2.c2, count(c3)
- FROM
- (
- SELECT 3 as c2 FROM dual WHERE x = 1
- UNION
- SELECT 2 FROM dual WHERE x = 1 OR x = 2
- ) AS t1,
- (
- SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
- UNION
- SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
- UNION
- SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
- ) AS t2
- WHERE t2.c2 = t1.c2
- GROUP BY c1, c2
- ;
-END|
-
-delimiter ;|
-
---echo
-CALL p1(1);
-CALL p1(2);
-CALL p1(1);
-
-DROP PROCEDURE p1;
-
---echo
---echo MDEV-3900 Optimizer difference between MySQL and MariaDB with stored functions in WHERE clause of UPDATE or DELETE statements
---echo
-
-CREATE FUNCTION tdn() RETURNS int(7) DETERMINISTIC RETURN to_days(now());
-
-CREATE TABLE t1 (pk INT NOT NULL AUTO_INCREMENT PRIMARY KEY, daynum INT, a CHAR(1), INDEX(daynum), INDEX(a)) ENGINE=MyISAM;
-INSERT INTO t1 (daynum) VALUES (1),(2),(3),(4),(5),(TO_DAYS(NOW())),(7),(8);
-INSERT INTO t1 (daynum) SELECT a1.daynum FROM t1 a1, t1 a2, t1 a3, t1 a4, t1 a5;
-
-FLUSH TABLES;
-FLUSH STATUS;
-
-SHOW STATUS LIKE '%Handler_read%';
-UPDATE t1 SET a = '+' WHERE daynum=tdn();
-SHOW STATUS LIKE '%Handler_read%';
-
-drop function tdn;
-drop table t1;
-
---echo #
---echo # lp: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
---echo Stored procedures and a condition handler in a nested procedure call
---echo doesn't suppress the condition from being passed on to the calling
---echo procedure
---echo
-
---disable_warnings
-drop procedure if exists p1;
-drop procedure if exists p0;
---enable_warnings
-
-create table t1 (id int);
-delimiter $$;
-create procedure p1 () begin
-declare i int default 0;
-declare continue handler for not found begin
-select "You should see this message and the warning that generated this" as "message";
-show warnings;
-end;
-select id into i from t1;
-end$$
-create procedure p0 () begin
-declare continue handler for not found begin
-select "You should NOT see this message" as "message";
-end;
-call p1();
-end$$
-delimiter ;$$
-call p0();
-
-drop procedure p1;
-drop procedure p0;
-drop table t1;
-
---echo
---echo Test if stored procedures propagates errors
---echo
-
-create table t1 (id int primary key);
-delimiter $$;
-create procedure p1 () begin
-insert into t1 values(1);
-insert into t1 values(2);
-insert into t1 values(2);
-insert into t1 values(3);
-end$$
-create procedure p2 () begin
- declare x int;
- select id into x from t1 where id=5;
-end$$
-delimiter ;$$
---error ER_DUP_ENTRY
-call p1();
-show warnings;
-select * from t1;
-call p2();
-
-drop procedure p1;
-drop procedure p2;
-
-drop table t1;
-
---echo #
---echo # MDEV-4978 - Server cursor is broken with blobs in the select list,
---echo # ORDER BY does not work
---echo #
-CREATE TABLE t1(a INT, b BLOB);
-INSERT INTO t1 VALUES(1,REPEAT('a',4835)),(2,'b'),(3,'c'),(4,'d'),(5,REPEAT('e',805)),(6,'f');
-
-DELIMITER |;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE done INT DEFAULT 0;
- DECLARE v1 INT;
- DECLARE v2 BLOB;
- DECLARE c1 CURSOR FOR SELECT * FROM t1 ORDER BY a;
- DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done=1;
- OPEN c1;
- REPEAT
- FETCH c1 INTO v1, v2;
- IF NOT done THEN
- SELECT v1;
- END IF;
- UNTIL done END REPEAT;
- CLOSE c1;
-END|
-DELIMITER ;|
-
-CALL p1;
-
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-10713: signal 11 error on multi-table update - crash in
---echo # handler::increment_statistics or in make_select or assertion
---echo # failure pfs_thread == ((PFS_thread*) pthread_getspecific((THR_PFS)))
---echo #
-
-CREATE TABLE `t1` (
- `CLOSE_YN` varchar(10) COLLATE utf8_bin DEFAULT NULL
-) DEFAULT CHARSET=utf8 COLLATE=utf8_bin ;
-
-
-CREATE TABLE `t2` (
- `ap_close_to` varchar(8) COLLATE utf8_bin DEFAULT NULL
-) DEFAULT CHARSET=utf8 COLLATE=utf8_bin ;
-insert t1 values (1);
-
-
---delimiter $$
-
-CREATE FUNCTION `f1`(`P_DC_CD` VARBINARY(50), `P_SYS_DATE` DATETIME) RETURNS datetime
- DETERMINISTIC
- SQL SECURITY INVOKER
-BEGIN
- DECLARE V_SYS_DATE DATETIME;
- SELECT now() AS LOC_DATE INTO V_SYS_DATE ;
- RETURN v_sys_date ;
-END $$
-
---delimiter ;
-
-update t1 S
-JOIN
-(
- SELECT CASE
- WHEN DATE_FORMAT( f1('F01', NOW()) , '%Y%m%d') <= CLOSE_YMD
- THEN '99991231'
- ELSE '' END ACCOUNT_APPLY_YYYYMMDD
- FROM (
- select case
- when 'AP'='AP'
- then ap_close_to
- end AS CLOSE_YMD
- from t2
- ) A
-) X
-SET S.CLOSE_YN = ''
-where 1=1;
-
-drop function if exists f1;
-drop table t1,t2;
-
---echo # End of 5.5 test
-
---echo #
---echo # MDEV-7040: Crash in field_conv, memcpy_field_possible, part#2
---echo #
-create table t1 (
- col1 bigint(20),
- col2 char(1),
- col3 char(2)
-);
-insert into t1 values (1,'a','a'), (2,'b','b');
-
-create table t2 as select * from t1;
-create table t3 as select * from t1;
-create table t4 as select * from t1;
-create table t5 as select * from t1;
-create table t6 as select * from t1;
-
-flush tables;
-
-DELIMITER |;
-
-CREATE PROCEDURE p1()
-begin
- DECLARE _var1 bigint(20) UNSIGNED;
- DECLARE _var2 CHAR(1) DEFAULT NULL;
- DECLARE _var3 CHAR(1) DEFAULT NULL;
-
- DECLARE _done BOOLEAN DEFAULT 0;
-
- declare cur1 cursor for
- select col1, col2, col3
- from t1
- where
- col1 in (select t2.col1 from t2 where t2.col2=t1.col2) or
- col2 in (select t3.col3 from t3 where t3.col3=t1.col2) ;
-
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET _done = 1;
-
- OPEN cur1;
-
- set _var1 = (select _var1 from t4 limit 1);
- set _var1 = (select _var1 from t5 limit 1);
- set _var1 = (select _var1 from t6 limit 1);
-label1:
- LOOP
- SET _done = 0;
- FETCH cur1 INTO _var1, _var2, _var3;
- IF _done THEN
- LEAVE label1;
- END IF;
- END LOOP label1;
- CLOSE cur1;
-end|
-DELIMITER ;|
-
-set @tmp_toc= @@table_open_cache;
-set @tmp_tdc= @@table_definition_cache;
-
-set global table_open_cache=1;
-set global table_definition_cache=1;
-call p1();
-
-set global table_open_cache= @tmp_toc;
-set global table_definition_cache= @tmp_tdc;
-drop procedure p1;
-
-drop table t1,t2,t3,t4,t5,t6;
-
---echo #
---echo # MDEV-11935: Queries in stored procedures with and
---echo # EXISTS(SELECT * FROM VIEW) crashes and closes hte conneciton.
---echo #
-
-CREATE TABLE ANY_TABLE (
- ENTITY_UID BIGINT NOT NULL
-);
-CREATE TABLE SECURITY_PATH(
-origid BIGINT UNSIGNED NOT NULL,
-destid BIGINT UNSIGNED NOT NULL,
-KEY (destid)
-);
-CREATE VIEW ENTITY_ACCESS (
-ENTITY_UID,
-OWNER_UID
-) AS
-SELECT SP1.origid,
- SP2.destid
-FROM SECURITY_PATH SP1
-JOIN SECURITY_PATH SP2 ON SP1.destid = SP2.origid
-;
---delimiter //
-CREATE PROCEDURE SP_EXAMPLE_SELECT ()
-BEGIN
- SELECT *
- FROM ANY_TABLE AT1
- WHERE EXISTS ( SELECT *
- FROM ENTITY_ACCESS EA
- WHERE AT1.ENTITY_UID = EA.ENTITY_UID
- AND EA.OWNER_UID IS NULL );
-END
-//
---delimiter ;
-CALL SP_EXAMPLE_SELECT ();
-CALL SP_EXAMPLE_SELECT ();
-
-drop procedure SP_EXAMPLE_SELECT;
-drop view ENTITY_ACCESS;
-drop table ANY_TABLE, SECURITY_PATH;
---echo # End of 10.0 test
-
-DELIMITER |;
-CREATE FUNCTION f(f1 VARCHAR(64) COLLATE latin1_german2_ci)
- RETURNS VARCHAR(64)
-BEGIN
- RETURN 'str';
-END|
-DROP FUNCTION f|
-
-CREATE FUNCTION f(f1 VARCHAR(64))
- RETURNS VARCHAR(64) COLLATE latin1_german2_ci
-BEGIN
- RETURN 'str';
-END|
-DROP FUNCTION f|
-
-CREATE FUNCTION f(f1 VARCHAR(64))
- RETURNS VARCHAR(64)
-BEGIN
- DECLARE f2 VARCHAR(64) COLLATE latin1_german2_ci;
- RETURN 'str';
-END|
-DROP FUNCTION f|
-DELIMITER ;|
-
---echo #
---echo # MDEV-7023: Error 2027: Malformed packet and assertion
---echo # `field_types == 0 || field_types[field_pos] == MYSQL_TYPE_INT24 ||
---echo #field_types[field_pos] == MYSQL_TYPE_LONG' failure in
---echo #Protocol_text::store_long
---echo #
-create table t1 (i int);
-create table t2 (i int);
---delimiter |
---error ER_SP_NO_RETSET
-create function f() returns int
-begin
- analyze insert into t1 values (1);
- return 1;
-end |
---error ER_SP_NO_RETSET
-create function f() returns int
-begin
- analyze insert t1 select * from t2;
- return 1;
-end |
---error ER_SP_NO_RETSET
-create function f() returns int
-begin
- analyze delete from t1;
- return 1;
-end |
---error ER_SP_NO_RETSET
-create function f() returns int
-begin
- analyze delete t1 from t1,t2;
- return 1;
-end |
---error ER_SP_NO_RETSET
-create function f() returns int
-begin
- analyze update t1 set i=1;
- return 1;
-end |
---error ER_SP_NO_RETSET
-create function f() returns int
-begin
- analyze update t1,t2 set i=1;
- return 1;
-end |
---error ER_SP_NO_RETSET
-create function f() returns int
-begin
- analyze replace t1 set i=1;
- return 1;
-end |
---error ER_SP_NO_RETSET
-create function f() returns int
-begin
- analyze replace t1 select * from t2;
- return 1;
-end |
---delimiter ;
-
-drop table t1,t2;
-
---echo #
---echo # MDEV-11584: GRANT inside an SP does not work well on 2nd execution
---echo #
-
-CREATE PROCEDURE sp1()
- GRANT ALL PRIVILEGES ON *.* TO 'foo'@'%' IDENTIFIED BY 'pass';
-CALL sp1();
-CALL sp1();
-drop user 'foo'@'%';
-drop procedure sp1;
-
---echo #
---echo # MDEV-10972: Insert from select / view / union --
---echo # repeatable crash in 10.1, 10.2 Linux/Mac/Windows
---echo #
-
-create table t (id int auto_increment primary key);
-insert into t values (9494),(9495),(9496),(9497),(9498),(9499),(9500),(9501),(9502),(9503);
-
-create VIEW v AS
-select id from t
-union
-select id from t
-;
-
-drop procedure if exists p;
-create procedure p()
-insert into tmp_t select t.id from (
- select id from v
- union
- select id from v
-) sq
-inner join t on (sq.id = t.id);
-
---error ER_NO_SUCH_TABLE
-CALL p();
-create table tmp_t (id int null);
-CALL p();
-
-drop procedure p;
-drop view v;
-drop table t, tmp_t;
-
-
---echo #
---echo # MDEV-13936: Server crashes in Time_and_counter_tracker::incr_loops
---echo #
-CREATE TABLE t1 (i INT);
-CREATE VIEW v1 AS SELECT * FROM t1 WHERE RAND() > 0.5;
-CREATE FUNCTION f1() RETURNS INT RETURN ( SELECT MAX(i) FROM v1 );
-
---error ER_NON_INSERTABLE_TABLE
-REPLACE INTO v1 VALUES (f1());
-SET @aux = f1();
-
-# Cleanup
-DROP FUNCTION f1;
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-14857: problem with 10.2.11 server crashing when
---echo # executing stored procedure
---echo #
-
-SET max_sp_recursion_depth=10;
-
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (b INT);
-
-delimiter ||;
-
-CREATE PROCEDURE proc_0()
-BEGIN
- CALL empty_1();
- CALL proc_1();
-END ||
-
-CREATE PROCEDURE proc_1()
-BEGIN
- CALL proc_2();
- CALL proc_3();
- CALL proc_4();
- CALL proc_5();
-END ||
-
-CREATE PROCEDURE proc_2()
- CALL proc_6();
-||
-
-CREATE PROCEDURE proc_3()
-BEGIN
- CALL empty_2();
- CALL empty_3();
-END ||
-
-CREATE PROCEDURE proc_4()
- CALL proc_7();
-||
-
-CREATE PROCEDURE proc_5()
- CALL proc_select();
-||
-
-CREATE PROCEDURE proc_6()
-BEGIN
- CALL empty_4();
- CALL empty_5();
- CALL empty_6();
- CALL empty_7();
- CALL proc_8();
-END ||
-
-CREATE PROCEDURE proc_7()
- CALL proc_9('foo');
-||
-
-CREATE PROCEDURE proc_8()
- CALL proc_10();
-||
-
-CREATE PROCEDURE proc_9(IN opt VARCHAR(40))
- IF LEFT(opt,1) <> '_' THEN
- CALL proc_11();
- END IF;
-||
-
-CREATE PROCEDURE proc_10()
- CALL proc_12();
-||
-
-CREATE PROCEDURE proc_11()
-BEGIN
- CALL empty_8();
- CALL empty_9();
- CALL empty_10();
- CALL proc_13();
-END ||
-
-CREATE PROCEDURE proc_12()
-BEGIN
- CALL empty_11();
- CALL empty_12();
- CALL empty_13();
-END ||
-
-CREATE PROCEDURE proc_13()
-BEGIN
- CALL proc_9('_bar');
- CALL empty_14();
-END ||
-
-delimiter ;||
-
-CREATE PROCEDURE empty_1() BEGIN END ;
-CREATE PROCEDURE empty_2() BEGIN END ;
-CREATE PROCEDURE empty_3() BEGIN END ;
-CREATE PROCEDURE empty_4() BEGIN END ;
-CREATE PROCEDURE empty_5() BEGIN END ;
-CREATE PROCEDURE empty_6() BEGIN END ;
-CREATE PROCEDURE empty_7() BEGIN END ;
-CREATE PROCEDURE empty_8() BEGIN END ;
-CREATE PROCEDURE empty_9() BEGIN END ;
-CREATE PROCEDURE empty_10() BEGIN END ;
-CREATE PROCEDURE empty_11() BEGIN END ;
-CREATE PROCEDURE empty_12() BEGIN END ;
-CREATE PROCEDURE empty_13() BEGIN END ;
-CREATE PROCEDURE empty_14() BEGIN END ;
-
-CREATE PROCEDURE proc_select()
- SELECT * FROM t1 WHERE NOT EXISTS ( SELECT * FROM t2)
-;
-
-CALL proc_0();
-
-# Cleanup
-DROP PROCEDURE empty_1;
-DROP PROCEDURE empty_2;
-DROP PROCEDURE empty_3;
-DROP PROCEDURE empty_4;
-DROP PROCEDURE empty_5;
-DROP PROCEDURE empty_6;
-DROP PROCEDURE empty_7;
-DROP PROCEDURE empty_8;
-DROP PROCEDURE empty_9;
-DROP PROCEDURE empty_10;
-DROP PROCEDURE empty_11;
-DROP PROCEDURE empty_12;
-DROP PROCEDURE empty_13;
-DROP PROCEDURE empty_14;
-DROP PROCEDURE proc_0;
-DROP PROCEDURE proc_1;
-DROP PROCEDURE proc_2;
-DROP PROCEDURE proc_3;
-DROP PROCEDURE proc_4;
-DROP PROCEDURE proc_5;
-DROP PROCEDURE proc_6;
-DROP PROCEDURE proc_7;
-DROP PROCEDURE proc_8;
-DROP PROCEDURE proc_9;
-DROP PROCEDURE proc_10;
-DROP PROCEDURE proc_11;
-DROP PROCEDURE proc_12;
-DROP PROCEDURE proc_13;
-DROP PROCEDURE proc_select;
-DROP TABLE t1, t2;
-
-SET max_sp_recursion_depth=default;
-
---echo #End of 10.1 tests
-
---echo #
---echo # MDEV-11081: CURSOR for query with GROUP BY
---echo #
-
-CREATE TABLE t1 (name VARCHAR(10), value INT);
-INSERT INTO t1 VALUES ('b',1);
-INSERT INTO t1 VALUES ('b',1);
-INSERT INTO t1 VALUES ('c',1);
-INSERT INTO t1 VALUES ('a',1);
-INSERT INTO t1 VALUES ('a',1);
-INSERT INTO t1 VALUES ('a',1);
-DELIMITER |;
-CREATE PROCEDURE p1 ()
-BEGIN
- DECLARE done INT DEFAULT FALSE;
- DECLARE v_name VARCHAR(10);
- DECLARE v_total INT;
- DECLARE c CURSOR FOR
- SELECT name, SUM(value) AS total FROM t1 GROUP BY name;
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
- OPEN c;
-read_loop:
- LOOP
- FETCH c INTO v_name, v_total;
- IF done THEN
- LEAVE read_loop;
- END IF;
- SELECT v_name, v_total;
- END LOOP;
- CLOSE c;
-END;
-|
-DELIMITER ;|
-CALL p1();
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-13346: CURSOR a query with GROUP BY using derived table
---echo #
-
-DELIMITER |;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE c CURSOR FOR
- SELECT
- IFNULL(NULL,1) AS col
- FROM
- ( select 1 as id ) AS t
- GROUP BY t.id
- ;
- OPEN c;
-END
-|
-DELIMITER ;|
-CALL p1();
-DROP PROCEDURE p1;
-
---echo #
---echo # MDEV-15057 Crash when using an unknown identifier as an SP parameter
---echo #
-
-CREATE OR REPLACE PROCEDURE p1 (a VARCHAR(10)) SELECT 1;
---error ER_BAD_FIELD_ERROR
-CALL p1(a);
-drop procedure p1;
-
-DELIMITER |;
-
-CREATE OR REPLACE PROCEDURE p1 (a VARCHAR(10)) SELECT a|
-CREATE OR REPLACE PROCEDURE p2 ()
-BEGIN
- DECLARE name VARCHAR(10);
- SET name="hello";
- call p1(name);
-END|
-CREATE OR REPLACE PROCEDURE p3 ()
-BEGIN
- DECLARE name VARCHAR(10);
- SET name="hello";
- call p1(name2);
-END|
-
-DELIMITER ;|
-
-call p2();
---error ER_BAD_FIELD_ERROR
-call p3();
-drop procedure p1;
-drop procedure p2;
-drop procedure p3;
-
---echo #
---echo # MDEV-15328: MariaDB 10.2.13 Crashes upon CALL PROCEDURE PARAM
---echo # LAST_INSERT_ID ()
---echo # (part 1, part 2 is in query_cache.test)
---echo #
-
-CREATE PROCEDURE foo ( IN i INT UNSIGNED ) BEGIN END;
-CALL foo( LAST_INSERT_ID() );
-DROP PROCEDURE foo;
-
---echo #
---echo # Start of 10.3 tests
---echo #
-
---echo #
---echo # MDEV-12007 Allow ROW variables as a cursor FETCH target
---echo #
-
-
---echo # The cursor and the ROW variable in FETCH must have the same number of fields
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE done INT DEFAULT FALSE;
- DECLARE rec ROW(aa INT, bb VARCHAR(32), cc INT);
- DECLARE cur CURSOR FOR SELECT 10 AS a,'b10' AS b;
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
- OPEN cur;
-read_loop:
- LOOP
- FETCH cur INTO rec;
- IF done THEN
- LEAVE read_loop;
- END IF;
- END LOOP;
- CLOSE cur;
-END;
-$$
-DELIMITER ;$$
---error ER_SP_WRONG_NO_OF_FETCH_ARGS
-CALL p1();
-DROP PROCEDURE p1;
-
-
---echo # Multiple ROW variables in FETCH
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE done INT DEFAULT FALSE;
- DECLARE rec1 ROW(aa INT);
- DECLARE rec2 ROW(aa INT);
- DECLARE cur CURSOR FOR SELECT 10 AS a, 20 AS b;
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
- OPEN cur;
-read_loop:
- LOOP
- FETCH cur INTO rec1, rec2;
- IF done THEN
- LEAVE read_loop;
- END IF;
- END LOOP;
- CLOSE cur;
-END;
-$$
-DELIMITER ;$$
---error ER_OPERAND_COLUMNS
-CALL p1();
-DROP PROCEDURE p1;
-
-
---echo # A complete working example
-CREATE TABLE t1 (a INT, b VARCHAR(32));
-INSERT INTO t1 VALUES (10,'b10');
-INSERT INTO t1 VALUES (20,'b20');
-INSERT INTO t1 VALUES (30,'b30');
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE done INT DEFAULT FALSE;
- DECLARE rec ROW(aa INT, bb VARCHAR(32));
- DECLARE cur CURSOR FOR SELECT a,b FROM t1;
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
- OPEN cur;
-read_loop:
- LOOP
- FETCH cur INTO rec;
- IF done THEN
- LEAVE read_loop;
- END IF;
- SELECT CONCAT('rec=(',rec.aa,',',rec.bb,')') AS c;
- END LOOP;
- CLOSE cur;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-
---echo # A ROW variable with a single field
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE done INT DEFAULT FALSE;
- DECLARE rec ROW(aa INT);
- DECLARE cur CURSOR FOR SELECT 10 AS a UNION SELECT 20;
- DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
- OPEN cur;
-read_loop:
- LOOP
- FETCH cur INTO rec;
- IF done THEN
- LEAVE read_loop;
- END IF;
- SELECT CONCAT('rec=(',rec.aa,')') AS c;
- END LOOP;
- CLOSE cur;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP PROCEDURE p1;
-
---echo #
---echo # MDEV-14228 MariaDB crashes with function
---echo #
-
-CREATE TABLE t1 (c VARCHAR(16), KEY(c));
-INSERT INTO t1 VALUES ('foo');
-
-DELIMITER $$;
-CREATE FUNCTION f1() RETURNS VARCHAR(16)
-BEGIN
- DECLARE v VARCHAR(16);
- FOR v IN (SELECT DISTINCT c FROM t1)
- DO
- IF (v = 'bar') THEN
- SELECT 1 INTO @a;
- END IF;
- END FOR;
- RETURN 'qux';
-END $$
-DELIMITER ;$$
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT f1();
-DROP FUNCTION f1;
-
-DELIMITER $$;
-CREATE FUNCTION f1() RETURNS VARCHAR(16)
-BEGIN
- DECLARE v ROW TYPE OF t1;
- IF v = 'bar' THEN
- RETURN 'eq';
- END IF;
- RETURN 'ne';
-END $$
-DELIMITER ;$$
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT f1();
-DROP FUNCTION f1;
-
-DELIMITER $$;
-CREATE FUNCTION f1() RETURNS VARCHAR(16)
-BEGIN
- DECLARE v ROW(a INT);
- IF v = 'bar' THEN
- RETURN 'eq';
- END IF;
- RETURN 'ne';
-END $$
-DELIMITER ;$$
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT f1();
-DROP FUNCTION f1;
-
-DROP TABLE t1;
-
-
-DELIMITER $$;
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-BEGIN NOT ATOMIC
- DECLARE v ROW(a INT);
- SELECT v IN ('a','b');
-END $$
-DELIMITER ;$$
-
-DELIMITER $$;
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-BEGIN NOT ATOMIC
-DECLARE v ROW(a INT);
- SELECT 'a' IN (v,'b');
-END $$
-DELIMITER ;$$
-
-DELIMITER $$;
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-BEGIN NOT ATOMIC
- DECLARE v ROW(a INT);
- SELECT 'a' IN ('b',v);
-END $$
-DELIMITER ;$$
-
---echo #
---echo # MDEV-15112 Inconsistent evaluation of spvariable=0 in strict mode
---echo #
-
-SET sql_mode=STRICT_ALL_TABLES;
-CREATE OR REPLACE TABLE t1 (e TIMESTAMP(6));
-INSERT INTO t1 VALUES ('2001-01-01 10:20:30');
-
-DELIMITER $$;
-CREATE FUNCTION f1(a VARBINARY(255))
-RETURNS INT
-DETERMINISTIC
-BEGIN
- RETURN a = timestamp'2038-01-19 03:14:07.999999'
- OR a = 0;
-END
-$$
-CREATE FUNCTION f2(a VARBINARY(255))
-RETURNS INT
-DETERMINISTIC
-BEGIN
- RETURN a = 0;
-END
-$$
-CREATE OR REPLACE FUNCTION f3(a VARBINARY(255))
-RETURNS INT
-DETERMINISTIC
-BEGIN
- RETURN a = timestamp'2038-01-19 03:14:07.999999'
- OR a = sleep(0);
-END
-$$
-DELIMITER ;$$
-
---error ER_TRUNCATED_WRONG_VALUE
-SELECT f1(e) FROM t1;
---error ER_TRUNCATED_WRONG_VALUE
-SELECT f2(e) FROM t1;
---error ER_TRUNCATED_WRONG_VALUE
-SELECT f3(e) FROM t1;
-
-DROP FUNCTION f1;
-DROP FUNCTION f2;
-DROP FUNCTION f3;
-DROP TABLE t1;
-
---echo # Test affected rows from an sp
-
-create table t1 (a int);
-
-DELIMITER $$;
-create procedure p1()
-begin
-insert into t1 values(1);
-insert into t1 values(2);
-end;
-$$
-create procedure p2()
-begin
-insert into t1 values(1);
-call p1();
-select row_count();
-insert into t1 values(2);
-insert into t1 values(2);
-end;
-$$
-DELIMITER ;$$
-
---enable_info
-CALL p2();
---disable_info
-DROP PROCEDURE p1;
-DROP PROCEDURE p2;
-drop table t1;
diff --git a/mysql-test/t/sp_gis.test b/mysql-test/t/sp_gis.test
deleted file mode 100644
index 51ed78b27d5..00000000000
--- a/mysql-test/t/sp_gis.test
+++ /dev/null
@@ -1,39 +0,0 @@
--- source include/have_geometry.inc
-
-use test;
-
-#
-# BUG#21025: misleading error message when creating functions named 'x', or 'y'
-#
-
---disable_warnings
-drop function if exists a;
-drop function if exists x;
-drop function if exists y;
---enable_warnings
-
-create function a() returns int
-return 1;
-
-create function x() returns int
-return 2;
-
-create function y() returns int
-return 3;
-
-select a();
---error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select x();
---error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
-select y();
-select x(PointFromText("POINT(10 20)")), y(PointFromText("POINT(10 20)"));
-
-# Non deterministic warnings from db_load_routine
---disable_warnings
-select test.a(), test.x(), test.y();
---enable_warnings
-
-drop function a;
-drop function x;
-drop function y;
-
diff --git a/mysql-test/t/sp_missing_4665.test b/mysql-test/t/sp_missing_4665.test
deleted file mode 100644
index 19e845e58c7..00000000000
--- a/mysql-test/t/sp_missing_4665.test
+++ /dev/null
@@ -1,9 +0,0 @@
-#
-# MDEV-4665 crash when referencing missing function in a subquery
-#
-create table t (a int);
-create or replace view v as select 1 from t where a;
---error ER_SP_DOES_NOT_EXIST
-delete from v where (select g());
-drop view v;
-drop table t;
diff --git a/mysql-test/t/sp_notembedded.test b/mysql-test/t/sp_notembedded.test
deleted file mode 100644
index 41bfd871c39..00000000000
--- a/mysql-test/t/sp_notembedded.test
+++ /dev/null
@@ -1,489 +0,0 @@
-# Can't test with embedded server
--- source include/not_embedded.inc
-# Disable concurrent inserts to avoid test failures
-set @old_concurrent_insert= @@global.concurrent_insert;
-set @@global.concurrent_insert= 0;
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
---disable_warnings
-drop table if exists t1,t3;
---enable_warnings
-delimiter |;
-
-
-#
-# Bug#4902 Stored procedure with SHOW WARNINGS leads to packet error
-#
-# Added tests for show grants command
---disable_warnings
-drop procedure if exists bug4902|
---enable_warnings
-create procedure bug4902()
-begin
- show grants for 'root'@'localhost';
-end|
---disable_parsing
-show binlog events|
-show storage engines|
-show master status|
-show slave hosts|
-show slave status|
---enable_parsing
-
-call bug4902()|
-call bug4902()|
-
-drop procedure bug4902|
-
-# We need separate SP for SHOW PROCESSLIST since we want use replace_column
---disable_warnings
-drop procedure if exists bug4902_2|
---enable_warnings
-create procedure bug4902_2()
-begin
- show processlist;
-end|
---disable_result_log
-call bug4902_2()|
---enable_result_log
-show warnings|
---disable_result_log
-call bug4902_2()|
---enable_result_log
-show warnings|
-drop procedure bug4902_2|
-
-#
-# Bug#6807 Stored procedure crash if CREATE PROCEDURE ... KILL QUERY
-#
---disable_warnings
-drop procedure if exists bug6807|
---enable_warnings
-create procedure bug6807()
-begin
- declare a int;
-
- set a = connection_id();
- kill query a;
- select 'Not reached';
-end|
-
---error ER_QUERY_INTERRUPTED
-call bug6807()|
---error ER_QUERY_INTERRUPTED
-call bug6807()|
-
-drop procedure bug6807|
-
-
-#
-# Bug#10100 function (and stored procedure?) recursivity problem
-#
---disable_warnings
-drop function if exists bug10100f|
-drop procedure if exists bug10100p|
-drop procedure if exists bug10100t|
-drop procedure if exists bug10100pt|
-drop procedure if exists bug10100pv|
-drop procedure if exists bug10100pd|
-drop procedure if exists bug10100pc|
---enable_warnings
-# routines with simple recursion
-create function bug10100f(prm int) returns int
-begin
- if prm > 1 then
- return prm * bug10100f(prm - 1);
- end if;
- return 1;
-end|
-set statement sql_mode = '' for
-create procedure bug10100p(prm int, inout res int)
-begin
- set res = res * prm;
- if prm > 1 then
- call bug10100p(prm - 1, res);
- end if;
-end|
-set statement sql_mode = '' for
-create procedure bug10100t(prm int)
-begin
- declare res int;
- set res = 1;
- call bug10100p(prm, res);
- select res;
-end|
-
-# a procedure which use tables and recursion
-create table t3 (a int)|
-insert into t3 values (0)|
-create view v1 as select a from t3;
-create procedure bug10100pt(level int, lim int)
-begin
- if level < lim then
- update t3 set a=level;
- FLUSH TABLES;
- call bug10100pt(level+1, lim);
- else
- select * from t3;
- end if;
-end|
-# view & recursion
-create procedure bug10100pv(level int, lim int)
-begin
- if level < lim then
- update v1 set a=level;
- FLUSH TABLES;
- call bug10100pv(level+1, lim);
- else
- select * from v1;
- end if;
-end|
-# dynamic sql & recursion
-prepare stmt2 from "select * from t3;";
-create procedure bug10100pd(level int, lim int)
-begin
- if level < lim then
- select level;
- prepare stmt1 from "update t3 set a=a+2";
- execute stmt1;
- FLUSH TABLES;
- execute stmt1;
- FLUSH TABLES;
- execute stmt1;
- FLUSH TABLES;
- deallocate prepare stmt1;
- execute stmt2;
- select * from t3;
- call bug10100pd(level+1, lim);
- else
- execute stmt2;
- end if;
-end|
-# cursor & recursion
-create procedure bug10100pc(level int, lim int)
-begin
- declare lv int;
- declare c cursor for select a from t3;
- open c;
- if level < lim then
- select level;
- fetch c into lv;
- select lv;
- update t3 set a=level+lv;
- FLUSH TABLES;
- call bug10100pc(level+1, lim);
- else
- select * from t3;
- end if;
- close c;
-end|
-
-# end of the stack checking
-set @@max_sp_recursion_depth=255|
-set @var=1|
-# disable log because error about stack overrun contains numbers which
-# depend on a system
--- disable_result_log
--- error ER_STACK_OVERRUN_NEED_MORE
-call bug10100p(255, @var)|
--- error ER_STACK_OVERRUN_NEED_MORE
-call bug10100pt(1,255)|
--- error ER_STACK_OVERRUN_NEED_MORE
-call bug10100pv(1,255)|
--- error ER_STACK_OVERRUN_NEED_MORE
-call bug10100pd(1,255)|
--- error ER_STACK_OVERRUN_NEED_MORE
-call bug10100pc(1,255)|
--- enable_result_log
-set @@max_sp_recursion_depth=0|
-
-deallocate prepare stmt2|
-
-drop function bug10100f|
-drop procedure bug10100p|
-drop procedure bug10100t|
-drop procedure bug10100pt|
-drop procedure bug10100pv|
-drop procedure bug10100pd|
-drop procedure bug10100pc|
-drop view v1|
-drop table t3|
-
-delimiter ;|
-
-
-#
-# Bug#15298 SHOW GRANTS FOR CURRENT_USER: Incorrect output in DEFINER context
-#
---disable_warnings
-drop procedure if exists bug15298_1;
-drop procedure if exists bug15298_2;
---enable_warnings
-create user 'mysqltest_1'@'localhost';
-grant all privileges on test.* to 'mysqltest_1'@'localhost';
-create procedure 15298_1 () sql security definer show grants for current_user;
-create procedure 15298_2 () sql security definer show grants;
-
-connect (con1,localhost,mysqltest_1,,test);
-call 15298_1();
-call 15298_2();
-
-connection default;
-disconnect con1;
-drop user mysqltest_1@localhost;
-drop procedure 15298_1;
-drop procedure 15298_2;
-
-#
-# Bug#29936 Stored Procedure DML ignores low_priority_updates setting
-#
-
---disable_warnings
-drop table if exists t1;
-drop procedure if exists p1;
---enable_warnings
-
-create table t1 (value varchar(15));
-create procedure p1() update t1 set value='updated' where value='old';
-
-# load the procedure into sp cache and execute once
-call p1();
-
-insert into t1 (value) values ("old"),("irrelevant");
-
-connect (rl_holder, localhost, root,,);
-connect (rl_acquirer, localhost, root,,);
-connect (rl_contender, localhost, root,,);
-connect (rl_wait, localhost, root,,);
-
-connection rl_holder;
-select get_lock('b26162',120);
-
-connection rl_acquirer;
---send select 'rl_acquirer', value from t1 where get_lock('b26162',120);
-
-# we must wait till this select opens and locks the tables
-connection rl_wait;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "User lock" and
- info = "select 'rl_acquirer', value from t1 where get_lock('b26162',120)";
---source include/wait_condition.inc
-
-connection default;
-set session low_priority_updates=on;
---send call p1();
-
-connection rl_wait;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for table level lock" and
- info = "update t1 set value='updated' where value='old'";
---source include/wait_condition.inc
-
-connection rl_contender;
-select 'rl_contender', value from t1;
-
-connection rl_holder;
-select release_lock('b26162');
-
-connection rl_acquirer;
---reap
-connection default;
---reap
-
-disconnect rl_holder;
-disconnect rl_acquirer;
-disconnect rl_wait;
-disconnect rl_contender;
-drop procedure p1;
-drop table t1;
-set session low_priority_updates=default;
-
-#
-# Bug#44798 MySQL engine crashes when creating stored procedures with execute_priv=N
-#
-INSERT IGNORE INTO mysql.user (Host, User, Password, Select_priv, Insert_priv, Update_priv,
-Delete_priv, Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv,
-Grant_priv, References_priv, Index_priv, Alter_priv, Show_db_priv, Super_priv,
-Create_tmp_table_priv, Lock_tables_priv, Execute_priv, Repl_slave_priv, Repl_client_priv,
-Create_view_priv, Show_view_priv, Create_routine_priv, Alter_routine_priv,
-Create_user_priv, ssl_type, ssl_cipher, x509_issuer, x509_subject, max_questions,
-max_updates, max_connections, max_user_connections)
-VALUES('%', 'mysqltest_1', password(''), 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'N', 'N', 'N',
-'N', 'N', 'N', 'Y', 'Y', 'N', 'N', 'Y', 'Y', 'N', 'N', 'N', 'N', 'N', 'Y', 'Y', 'N', '',
-'', '', '', '0', '0', '0', '0');
-FLUSH PRIVILEGES;
-
-connect (con1, localhost, mysqltest_1,,);
-connection con1;
-CREATE PROCEDURE p1(i INT) BEGIN END;
-disconnect con1;
-connection default;
-DROP PROCEDURE p1;
-
-DELETE FROM mysql.user WHERE User='mysqltest_1';
-FLUSH PRIVILEGES;
-
-
---echo #
---echo # Bug#44521 Prepared Statement: CALL p() - crashes: `! thd->main_da.is_sent' failed et.al.
---echo #
-SELECT GET_LOCK('Bug44521', 0);
---connect (con1,localhost,root,,)
-delimiter $;
-CREATE PROCEDURE p()
-BEGIN
- SELECT 1;
- SELECT GET_LOCK('Bug44521', 100);
- SELECT 2;
-END$
-delimiter ;$
---send CALL p();
---connection default
-let $wait_condition=
- SELECT count(*) = 1 FROM information_schema.processlist
- WHERE state = "User lock" AND info = "SELECT GET_LOCK('Bug44521', 100)";
---source include/wait_condition.inc
-let $conid =
- `SELECT id FROM information_schema.processlist
- WHERE state = "User lock" AND info = "SELECT GET_LOCK('Bug44521', 100)"`;
-dirty_close con1;
-SELECT RELEASE_LOCK('Bug44521');
-let $wait_condition=
- SELECT count(*) = 0 FROM information_schema.processlist
- WHERE id = $conid;
---source include/wait_condition.inc
-DROP PROCEDURE p;
-
-#
-# Bug#47736 killing a select from a view when the view is processing a function, asserts
-#
-CREATE TABLE t1(a int);
-INSERT INTO t1 VALUES (1);
-CREATE FUNCTION f1 (inp TEXT) RETURNS INT NO SQL RETURN sleep(60);
-CREATE VIEW v1 AS SELECT f1('a') FROM t1;
-
---connect (con1, localhost, root,,)
---let $ID_1= `SELECT connection_id()`
---send SELECT * FROM v1;
-
---connect (con2, localhost, root,,)
---let $ID_2= `SELECT connection_id()`
---send SELECT * FROM v1
-
---connection default
-let $wait_condition=
- select count(*) = 2 from information_schema.processlist where state = "User sleep";
---source include/wait_condition.inc
---disable_query_log
---eval KILL QUERY $ID_2
---eval KILL QUERY $ID_1
---enable_query_log
-
---connection con1
---error ER_QUERY_INTERRUPTED
---reap
---connection con2
---error ER_QUERY_INTERRUPTED
---reap
-
---connection default
-DROP VIEW v1;
-DROP TABLE t1;
-DROP FUNCTION f1;
---disconnect con1
---disconnect con2
-
---echo # ------------------------------------------------------------------
---echo # -- End of 5.1 tests
---echo # ------------------------------------------------------------------
-
---echo #
---echo # Test for bug#11763757 "56510: ERROR 42000: FUNCTION DOES NOT EXIST
---echo # IF NOT-PRIV USER RECONNECTS ".
---echo #
---echo # The real problem was that server was unable handle properly stored
---echo # functions in databases which names contained dot.
---echo #
-
-connection default;
-
---disable_warnings
-DROP DATABASE IF EXISTS `my.db`;
---enable_warnings
-
-create database `my.db`;
-use `my.db`;
-
-CREATE FUNCTION f1(a int) RETURNS INT RETURN a;
-
-connect (addcon, localhost, root,,);
-connection addcon;
-USE `my.db`;
-SELECT f1(1);
-SELECT `my.db`.f1(2);
-
-connection default;
-disconnect addcon;
-DROP DATABASE `my.db`;
-USE test;
-
-
---echo #
---echo # Bug#11763507 - 56224: FUNCTION NAME IS CASE-SENSITIVE
---echo #
-SET @@SQL_MODE = '';
-DELIMITER $;
-
-CREATE EVENT teste_bug11763507 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR
-DO SELECT 1 $
-
-DELIMITER ;$
-# EVENTS
---replace_column 6 # 7 # 8 # 9 #
-SHOW EVENTS LIKE 'teste_bug11763507';
---replace_column 6 # 7 # 8 # 9 #
-SHOW EVENTS LIKE 'TESTE_bug11763507';
-
---replace_column 4 #
-SHOW CREATE EVENT teste_bug11763507;
---replace_column 4 #
-SHOW CREATE EVENT TESTE_bug11763507;
-
-DROP EVENT teste_bug11763507;
---echo #END OF BUG#11763507 test.
-
---echo # ------------------------------------------------------------------
---echo # -- End of 5.1 tests
---echo # ------------------------------------------------------------------
-
-#
-# A case of SHOW GRANTS
-# (creating a new procedure changes the password)
-#
-grant create routine on test.* to foo1@localhost identified by 'foo';
-update mysql.user set password = replace(password, '*', '-') where user='foo1';
---connect (foo,localhost,foo1,foo)
-show grants;
---connection default
-flush privileges;
---connection foo
-show grants;
-create procedure spfoo() select 1;
-show grants;
-
---connection default
---disconnect foo
-drop procedure spfoo;
-drop user foo1@localhost;
-
-#
-# Restore global concurrent_insert value. Keep in the end of the test file.
-#
-
-set @@global.concurrent_insert= @old_concurrent_insert;
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/sp_stress_case.test b/mysql-test/t/sp_stress_case.test
deleted file mode 100644
index 1b5bd8991a9..00000000000
--- a/mysql-test/t/sp_stress_case.test
+++ /dev/null
@@ -1,89 +0,0 @@
-#
-# Bug#19194 (Right recursion in parser for CASE causes excessive stack
-# usage, limitation)
-#
-
---disable_warnings
-DROP PROCEDURE IF EXISTS proc_19194_codegen;
-DROP PROCEDURE IF EXISTS bug_19194_simple;
-DROP PROCEDURE IF EXISTS bug_19194_searched;
---enable_warnings
-
-delimiter |;
-
-CREATE PROCEDURE proc_19194_codegen(
- IN proc_name VARCHAR(50),
- IN count INTEGER,
- IN simple INTEGER,
- OUT body MEDIUMTEXT)
-BEGIN
- DECLARE code MEDIUMTEXT;
- DECLARE i INT DEFAULT 1;
-
- SET code = concat("CREATE PROCEDURE ", proc_name, "(i INT)\n");
- SET code = concat(code, "BEGIN\n");
- SET code = concat(code, " DECLARE str CHAR(10);\n");
-
- IF (simple)
- THEN
- SET code = concat(code, " CASE i\n");
- ELSE
- SET code = concat(code, " CASE\n");
- END IF;
-
- WHILE (i <= count)
- DO
- IF (simple)
- THEN
- SET code = concat(code, " WHEN ", i, " THEN SET str=\"", i, "\";\n");
- ELSE
- SET code = concat(code, " WHEN i=", i, " THEN SET str=\"", i, "\";\n");
- END IF;
-
- SET i = i + 1;
- END WHILE;
-
- SET code = concat(code, " ELSE SET str=\"unknown\";\n");
- SET code = concat(code, " END CASE;\n");
- SET code = concat(code, " SELECT str;\n");
-
- SET code = concat(code, "END\n");
-
- SET body = code;
-END|
-
-delimiter ;|
-
-set @body="";
-call proc_19194_codegen("test_simple", 10, 1, @body);
-select @body;
-call proc_19194_codegen("test_searched", 10, 0, @body);
-select @body;
-
---disable_query_log
-call proc_19194_codegen("bug_19194_simple", 5000, 1, @body);
-let $proc_body = `select @body`;
-eval $proc_body;
-call proc_19194_codegen("bug_19194_searched", 5000, 1, @body);
-let $proc_body = `select @body`;
-eval $proc_body;
---enable_query_log
-
-CALL bug_19194_simple(1);
-CALL bug_19194_simple(2);
-CALL bug_19194_simple(1000);
-CALL bug_19194_simple(4998);
-CALL bug_19194_simple(4999);
-CALL bug_19194_simple(9999);
-
-CALL bug_19194_searched(1);
-CALL bug_19194_searched(2);
-CALL bug_19194_searched(1000);
-CALL bug_19194_searched(4998);
-CALL bug_19194_searched(4999);
-CALL bug_19194_searched(9999);
-
-DROP PROCEDURE proc_19194_codegen;
-DROP PROCEDURE bug_19194_simple;
-DROP PROCEDURE bug_19194_searched;
-
diff --git a/mysql-test/t/sp_sync.test b/mysql-test/t/sp_sync.test
deleted file mode 100644
index a5682fc572f..00000000000
--- a/mysql-test/t/sp_sync.test
+++ /dev/null
@@ -1,170 +0,0 @@
-# This test should work in embedded server after mysqltest is fixed
--- source include/not_embedded.inc
-
---echo Tests of synchronization of stored procedure execution.
-
---source include/have_debug_sync.inc
-
-# Save the initial number of concurrent sessions.
---source include/count_sessions.inc
-
-# Clean up resources used in this test case.
---disable_warnings
-SET DEBUG_SYNC= 'RESET';
---enable_warnings
-
---echo #
---echo # Bug #30977 Concurrent statement using stored function and
---echo # DROP FUNCTION breaks SBR
---echo #
---echo # A stored routine could change after dispatch_command()
---echo # but before a MDL lock is taken. This must be noticed and the
---echo # sp cache flushed so the correct version can be loaded.
---echo #
-
-connect (con2, localhost, root);
-
-connection default;
-CREATE FUNCTION f1() RETURNS INT RETURN 1;
---echo # Get f1 cached
-SELECT f1();
---echo # Then start executing it again...
-SET DEBUG_SYNC= 'before_execute_sql_command SIGNAL before WAIT_FOR changed';
---echo # Sending:
---send SELECT f1()
-
-connection con2;
-SET DEBUG_SYNC= 'now WAIT_FOR before';
---echo # ... but before f1 is locked, change it.
-DROP FUNCTION f1;
-CREATE FUNCTION f1() RETURNS INT RETURN 2;
-SET DEBUG_SYNC= 'now SIGNAL changed';
-
---echo # We should now get '2' and not '1'.
-connection default;
---echo # Reaping: SELECT f1()
---reap
-
-disconnect con2;
-DROP FUNCTION f1;
-SET DEBUG_SYNC= 'RESET';
-
---echo #
---echo # Field translation items must be cleared in case of back-offs
---echo # for queries that use Information Schema tables. Otherwise
---echo # memory allocated in fix_fields() for views may end up referring
---echo # to freed memory.
---echo #
-
---disable_warnings
-DROP FUNCTION IF EXISTS f1;
---enable_warnings
-
-connect (con2, localhost, root);
-connect (con3, localhost, root);
-
-connection default;
-CREATE FUNCTION f1() RETURNS INT RETURN 0;
-
-connection con2;
-SET DEBUG_SYNC= 'after_wait_locked_pname SIGNAL locked WAIT_FOR issued';
---echo # con2 will now have an x-lock on f1
---echo # Sending:
---send ALTER FUNCTION f1 COMMENT 'comment'
-
-connection default;
-SET DEBUG_SYNC= 'now WAIT_FOR locked';
---disable_result_log
---echo # This query will block due to the x-lock on f1 and back-off
---send SHOW OPEN TABLES WHERE f1()=0
-
-connection con3;
-let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist
- WHERE state= 'Waiting for stored function metadata lock'
- AND info='SHOW OPEN TABLES WHERE f1()=0';
---source include/wait_condition.inc
---echo # Check that the IS query is blocked before releasing the x-lock
-SET DEBUG_SYNC= 'now SIGNAL issued';
-
-connection default;
---echo # Reaping: ALTER FUNCTION f1 COMMENT 'comment'
---reap
---enable_result_log
-DROP FUNCTION f1;
-SET DEBUG_SYNC= 'RESET';
-disconnect con2;
-disconnect con3;
-
-
---echo #
---echo # Bug #48246 assert in close_thread_table
---echo #
-
-CREATE TABLE t0 (b INTEGER);
-CREATE TABLE t1 (a INTEGER);
-CREATE FUNCTION f1(b INTEGER) RETURNS INTEGER RETURN 1;
-CREATE PROCEDURE p1() SELECT COUNT(f1(a)) FROM t1, t0;
-
-INSERT INTO t0 VALUES(1);
-INSERT INTO t1 VALUES(1), (2);
-
-connect (con2, localhost, root);
-CALL p1();
-
-SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL locked_t1 WAIT_FOR go_for_t0';
---echo # This call used to cause an assertion. MDL deadlock with upcoming
---echo # LOCK TABLES statement will cause back-off and retry.
---echo # A variable indicating if a prelocking list exists, used to be not
---echo # reset properly causing an eventual assert.
---echo # Sending:
---send CALL p1()
-
-connection default;
-SET DEBUG_SYNC= 'now WAIT_FOR locked_t1';
---echo # Issue LOCK TABLES statement which will enter in MDL deadlock
---echo # with CALL statement and as result will cause it to perform
---echo # back-off and retry.
-SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL go_for_t0';
-LOCK TABLES t0 WRITE, t1 WRITE;
-UNLOCK TABLES;
-
-connection con2;
---echo # Reaping: CALL p1()
---reap;
-
-connection default;
-disconnect con2;
-DROP PROCEDURE p1;
-DROP FUNCTION f1;
-DROP TABLES t0, t1;
-
-
---echo #
---echo # test for bug#11756013
---echo #
---disable_warnings
-DROP SCHEMA IF EXISTS s1;
---enable_warnings
-CREATE SCHEMA s1;
-CREATE PROCEDURE s1.p1() BEGIN END;
-
-connect (con3, localhost, root);
-SET DEBUG_SYNC='before_db_dir_check SIGNAL check_db WAIT_FOR dropped_schema';
---send CALL s1.p1
-
-connection default;
-SET DEBUG_SYNC='now WAIT_FOR check_db';
-DROP SCHEMA s1;
-SET DEBUG_SYNC='now SIGNAL dropped_schema';
-
-connection con3;
---error ER_BAD_DB_ERROR
---reap
-connection default;
-disconnect con3;
-
-SET DEBUG_SYNC = 'RESET';
-
-# 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
diff --git a/mysql-test/t/sp_trans.test b/mysql-test/t/sp_trans.test
deleted file mode 100644
index a9759b99269..00000000000
--- a/mysql-test/t/sp_trans.test
+++ /dev/null
@@ -1,707 +0,0 @@
-#
-# tests that require InnoDB...
-#
-
--- source include/have_log_bin.inc
--- source include/have_innodb.inc
-
-set SQL_MODE="";
-
-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_warnings
-drop table if exists t1, t2, t3;
---enable_warnings
-
-delimiter |;
-
-#
-# BUG#8850: Truncate table in a stored procedure locks the tables
-#
---disable_warnings
-drop procedure if exists bug8850|
---enable_warnings
-create table t1 (a int) engine=innodb|
-create procedure bug8850()
-begin
- truncate table t1; insert t1 values (1); rollback;
-end|
-
-set autocommit=0|
-insert t1 values (2)|
-call bug8850()|
-commit|
-select * from t1|
-
-call bug8850()|
-set autocommit=1|
-select * from t1|
-drop table t1|
-drop procedure bug8850|
-
-
-#
-# BUG#10015: Crash in InnoDB if stored routines are used
-# (crash happens in auto-commit mode)
-#
---disable_warnings
-drop function if exists bug10015_1|
-drop function if exists bug10015_2|
-drop function if exists bug10015_3|
-drop function if exists bug10015_4|
-drop function if exists bug10015_5|
-drop function if exists bug10015_6|
-drop function if exists bug10015_7|
-drop procedure if exists bug10015_8|
---enable_warnings
-create table t1 (id int) engine=innodb|
-create table t2 (id int primary key, j int) engine=innodb|
-insert into t1 values (1),(2),(3)|
-create function bug10015_1() returns int return (select count(*) from t1)|
-select *, bug10015_1() from t1|
-drop function bug10015_1|
-# Test couple of a bit more complex cases
-create function bug10015_2() returns int
- begin
- declare i, s int;
- set i:= (select min(id) from t1);
- set s:= (select max(id) from t1);
- return (s - i);
- end|
-select *, bug10015_2() from t1|
-drop function bug10015_2|
-create function bug10015_3() returns int
- return (select max(a.id - b.id) from t1 as a, t1 as b where a.id >= b.id)|
-select *, bug10015_3() from t1|
-drop function bug10015_3|
-create function bug10015_4(i int) returns int
- begin
- declare m int;
- set m:= (select max(id) from t2);
- insert into t2 values (i, m);
- return m;
- end|
-select *, bug10015_4(id) from t1|
-select * from t2|
-drop function bug10015_4|
-# Now let us test how statement rollback works
-# This function will cause the whole stmt to be rolled back,
-# there should not be any traces left.
-create function bug10015_5(i int) returns int
- begin
- if (i = 5) then
- insert into t2 values (1, 0);
- end if;
- return i;
- end|
---error ER_DUP_ENTRY
-insert into t1 values (bug10015_5(4)), (bug10015_5(5))|
-select * from t1|
-drop function bug10015_5|
-# Thanks to error-handler this function should not cause rollback
-# of statement calling it. But insert statement in it should be
-# rolled back completely and don't leave any traces in t2.
-# Unfortunately we can't implement such behavior in 5.0, so it
-# is something to be fixed in later 5.* releases (TODO).
-create function bug10015_6(i int) returns int
- begin
- declare continue handler for sqlexception set @error_in_func:= 1;
- if (i = 5) then
- insert into t2 values (4, 0), (1, 0);
- end if;
- return i;
- end|
-set @error_in_func:= 0|
-insert into t1 values (bug10015_6(5)), (bug10015_6(6))|
-select @error_in_func|
-select * from t1|
-select * from t2|
-drop function bug10015_6|
-# Let us test that we don't allow any statements causing transaction
-# commit in stored functions (we test only most interesting cases here).
-# Cases which can be caught at creation time:
---error 1422
-create function bug10015_7() returns int
- begin
- alter table t1 add k int;
- return 1;
- end|
---error 1422
-create function bug10015_7() returns int
- begin
- start transaction;
- return 1;
- end|
---error 1422
-create function bug10015_7() returns int
- begin
- drop table t1;
- return 1;
- end|
-# It should be OK to drop temporary table.
-create function bug10015_7() returns int
- begin
- drop temporary table t1;
- return 1;
- end|
-drop function bug10015_7|
---error 1422
-create function bug10015_7() returns int
- begin
- commit;
- return 1;
- end|
-# Now let us test cases which we can catch only at run-time:
-create function bug10015_7() returns int
- begin
- call bug10015_8();
- return 1;
- end|
-create procedure bug10015_8() alter table t1 add k int|
---error 1422
-select *, bug10015_7() from t1|
-drop procedure bug10015_8|
-create procedure bug10015_8() start transaction|
---error 1422
-select *, bug10015_7() from t1|
-drop procedure bug10015_8|
-# Again it is OK to drop temporary table
-# We are surpressing warnings since they are not essential
-create procedure bug10015_8() drop temporary table if exists t1_temp|
---disable_warnings
-select *, bug10015_7() from t1|
---enable_warnings
-drop procedure bug10015_8|
-create procedure bug10015_8() commit|
---error 1422
-select *, bug10015_7() from t1|
-drop procedure bug10015_8|
-drop function bug10015_7|
-drop table t1, t2|
-
-
-#
-# BUG#13825 "Triggers: crash if release savepoint".
-# Also general test for handling of savepoints in stored routines.
-#
-# According to SQL standard we should establish new savepoint
-# level before executing stored function/trigger and destroy
-# this savepoint level after execution. Stored procedures by
-# default should be executed using the same savepoint level
-# as their caller (to execute stored procedure using new
-# savepoint level one should explicitly specify NEW SAVEPOINT
-# LEVEL clause in procedure creation statement which MySQL
-# does not support yet).
---disable_warnings
-drop function if exists bug13825_0|
-drop function if exists bug13825_1|
-drop function if exists bug13825_2|
-drop function if exists bug13825_3|
-drop function if exists bug13825_4|
-drop function if exists bug13825_5|
-drop procedure if exists bug13825_0|
-drop procedure if exists bug13825_1|
-drop procedure if exists bug13825_2|
-drop table if exists t1|
---enable_warnings
-create table t1 (i int) engine=innodb|
-create table t2 (i int) engine=innodb|
-create function bug13825_0() returns int
-begin
- rollback to savepoint x;
- return 1;
-end|
-create function bug13825_1() returns int
-begin
- release savepoint x;
- return 1;
-end|
-create function bug13825_2() returns int
-begin
- insert into t1 values (2);
- savepoint x;
- insert into t1 values (3);
- rollback to savepoint x;
- insert into t1 values (4);
- return 1;
-end|
-create procedure bug13825_0()
-begin
- rollback to savepoint x;
-end|
-create procedure bug13825_1()
-begin
- release savepoint x;
-end|
-create procedure bug13825_2()
-begin
- savepoint x;
-end|
-insert into t2 values (1)|
-create trigger t2_bi before insert on t2 for each row
- rollback to savepoint x|
-create trigger t2_bu before update on t2 for each row
- release savepoint x|
-create trigger t2_bd before delete on t2 for each row
-begin
- insert into t1 values (2);
- savepoint x;
- insert into t1 values (3);
- rollback to savepoint x;
- insert into t1 values (4);
-end|
-create function bug13825_3(rb int) returns int
-begin
- insert into t1 values(1);
- savepoint x;
- insert into t1 values(2);
- if rb then
- rollback to savepoint x;
- end if;
- insert into t1 values(3);
- return rb;
-end|
-create function bug13825_4() returns int
-begin
- savepoint x;
- insert into t1 values(2);
- rollback to savepoint x;
- return 0;
-end|
-create function bug13825_5(p int) returns int
-begin
- savepoint x;
- insert into t2 values(p);
- rollback to savepoint x;
- insert into t2 values(p+1);
- return p;
-end|
-set autocommit= 0|
-# Test of savepoint level handling for stored functions and triggers
-begin |
-insert into t1 values (1)|
-savepoint x|
---error ER_SP_DOES_NOT_EXIST
-set @a:= bug13825_0()|
---error ER_SP_DOES_NOT_EXIST
-insert into t2 values (2)|
---error ER_SP_DOES_NOT_EXIST
-set @a:= bug13825_1()|
---error ER_SP_DOES_NOT_EXIST
-update t2 set i = 2|
-set @a:= bug13825_2()|
-select * from t1|
-rollback to savepoint x|
-select * from t1|
-delete from t2|
-select * from t1|
-rollback to savepoint x|
-select * from t1|
-# Of course savepoints set in function should not be visible from its caller
-release savepoint x|
-set @a:= bug13825_2()|
-select * from t1|
---error ER_SP_DOES_NOT_EXIST
-rollback to savepoint x|
-delete from t1|
-commit|
-# Test of savepoint level handling for stored procedures
-begin|
-insert into t1 values (5)|
-savepoint x|
-insert into t1 values (6)|
-call bug13825_0()|
-select * from t1|
-call bug13825_1()|
---error ER_SP_DOES_NOT_EXIST
-rollback to savepoint x|
-savepoint x|
-insert into t1 values (7)|
-call bug13825_2()|
-rollback to savepoint x|
-select * from t1|
-delete from t1|
-commit|
-set autocommit= 1|
-# Let us test that savepoints work inside of functions
-# even in auto-commit mode
-select bug13825_3(0)|
-select * from t1|
-delete from t1|
-select bug13825_3(1)|
-select * from t1|
-delete from t1|
-# Curious case: rolling back to savepoint which is set by first
-# statement in function should not rollback whole transaction.
-set autocommit= 0|
-begin|
-insert into t1 values (1)|
-set @a:= bug13825_4()|
-select * from t1|
-delete from t1|
-commit|
-set autocommit= 1|
-# Other curious case: savepoint in the middle of statement
-drop table t2|
-create table t2 (i int) engine=innodb|
-insert into t1 values (1), (bug13825_5(2)), (3)|
-select * from t1|
-select * from t2|
-# Cleanup
-drop function bug13825_0|
-drop function bug13825_1|
-drop function bug13825_2|
-drop function bug13825_3|
-drop function bug13825_4|
-drop function bug13825_5|
-drop procedure bug13825_0|
-drop procedure bug13825_1|
-drop procedure bug13825_2|
-drop table t1, t2|
-
-
-#
-# BUG#14840: CONTINUE handler problem
-#
---disable_warnings
-drop table if exists t3|
-drop procedure if exists bug14840_1|
-drop procedure if exists bug14840_2|
---enable_warnings
-
-create table t3
-(
- x int,
- y int,
- primary key (x)
-) engine=InnoDB|
-
-# This used to hang the client since the insert returned with an
-# error status (left over from the update) even though it succeeded,
-# which caused the execution to end at that point.
-create procedure bug14840_1()
-begin
- declare err int default 0;
- declare continue handler for sqlexception
- set err = err + 1;
-
- start transaction;
- update t3 set x = 1, y = 42 where x = 2;
- insert into t3 values (3, 4711);
- if err > 0 then
- rollback;
- else
- commit;
- end if;
- select * from t3;
-end|
-
-# A simpler (non-transactional) case: insert at select should be done
-create procedure bug14840_2()
-begin
- declare err int default 0;
- declare continue handler for sqlexception
- begin
- set err = err + 1;
- select err as 'Ping';
- end;
-
- update t3 set x = 1, y = 42 where x = 2;
- update t3 set x = 1, y = 42 where x = 2;
- insert into t3 values (3, 4711);
- select * from t3;
-end|
-
-insert into t3 values (1, 3), (2, 5)|
-call bug14840_1()|
-
-delete from t3|
-insert into t3 values (1, 3), (2, 5)|
-call bug14840_2()|
-
-drop procedure bug14840_1|
-drop procedure bug14840_2|
-drop table t3|
-
-
-#
-# BUG#10656: Stored Procedure - Create index and Truncate table command error
-#
---disable_warnings
-drop procedure if exists bug10656_create_index|
-drop procedure if exists bug10656_myjoin|
-drop procedure if exists bug10656_truncate_table|
---enable_warnings
-
-CREATE TABLE t3 (
- `ID` int(11) default NULL,
- `txt` char(5) default NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1|
-
-INSERT INTO t3 (`ID`,`txt`) VALUES
- (1,'a'), (2,'b'), (3,'c'), (4,'d')|
-
-CREATE TABLE t4 (
- `ID` int(11) default NULL,
- `txt` char(5) default NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1|
-
-INSERT INTO t4 (`ID`,`txt`) VALUES
- (1,'a'), (2,'b'), (3,'c'), (4,'d')|
-
-create procedure bug10656_create_index()
-begin
- create index bug10656_my_index on t3 (ID);
-end|
-call bug10656_create_index()|
-
-create procedure bug10656_myjoin()
-begin
- update t3, t4 set t3.txt = t4.txt where t3.id = t4.id;
-end|
-call bug10656_myjoin()|
-
-create procedure bug10656_truncate_table()
-begin
- truncate table t3;
-end|
-call bug10656_truncate_table()|
-
-
-drop procedure bug10656_create_index|
-drop procedure bug10656_myjoin|
-drop procedure bug10656_truncate_table|
-drop table t3, t4|
-
-#
-# BUG#3448
-#
---disable_warnings
-create table t3 (
- a int primary key,
- ach char(1)
-) engine = innodb|
-
-create table t4 (
- b int primary key,
- bch char(1)
-) engine = innodb|
---enable_warnings
-
-insert into t3 values (1 , 'aCh1' ) , ('2' , 'aCh2')|
-insert into t4 values (1 , 'bCh1' )|
-
---disable_warnings
-drop procedure if exists bug3448|
---enable_warnings
-create procedure bug3448()
- select * from t3 inner join t4 on t3.a = t4.b|
-
-select * from t3 inner join t4 on t3.a = t4.b|
-call bug3448()|
-call bug3448()|
-
-drop procedure bug3448|
-drop table t3, t4|
-
-#
-# BUG#14210: "Simple query with > operator on large table gives server
-# crash"
-# Check that cursors work in case when HEAP tables are converted to
-# MyISAM
-#
---disable_warnings
-drop procedure if exists bug14210|
---enable_warnings
-set @@session.max_heap_table_size=16384|
-select @@session.max_heap_table_size|
-# To trigger the memory corruption the original table must be InnoDB.
-# No harm if it's not, so don't warn if the suite is run with --skip-innodb
---disable_warnings
-create table t3 (a char(255)) engine=InnoDB|
---enable_warnings
-create procedure bug14210_fill_table()
-begin
- declare table_size, max_table_size int default 0;
- select @@session.max_heap_table_size into max_table_size;
- delete from t3;
- insert into t3 (a) values (repeat('a', 255));
- repeat
- insert into t3 select a from t3;
- select count(*)*255 from t3 into table_size;
- until table_size > max_table_size*2 end repeat;
-end|
---disable_warnings
-call bug14210_fill_table()|
---enable_warnings
-drop procedure bug14210_fill_table|
-create table t4 like t3|
-
-create procedure bug14210()
-begin
- declare a char(255);
- declare done int default 0;
- declare c cursor for select * from t3;
- declare continue handler for sqlstate '02000' set done = 1;
- open c;
- repeat
- fetch c into a;
- if not done then
- insert into t4 values (upper(a));
- end if;
- until done end repeat;
- close c;
-end|
-call bug14210()|
-select count(*) from t4|
-
-drop table t3, t4|
-drop procedure bug14210|
-set @@session.max_heap_table_size=default|
-
-#
-# BUG#7787: Stored procedures: improper warning for "grant execute" statement
-#
-
-# Prepare.
-
-CREATE DATABASE db_bug7787|
-use db_bug7787|
-
-# Test.
-
-CREATE PROCEDURE p1()
- SHOW ENGINE INNODB STATUS; |
-
-GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost|
-
-# Cleanup.
-
-DROP DATABASE db_bug7787|
-drop user user_bug7787@localhost|
-use test|
-
-#
-# Bug#13575 SP funcs in select with distinct/group and order by can
-# produce bad data
-#
-create table t3 (f1 int, f2 varchar(3), primary key(f1)) engine=innodb|
-insert into t3 values (1,'aaa'),(2,'bbb'),(3,'ccc')|
-CREATE FUNCTION bug13575 ( p1 integer )
-returns varchar(3)
-BEGIN
-DECLARE v1 VARCHAR(10) DEFAULT null;
-SELECT f2 INTO v1 FROM t3 WHERE f1 = p1;
-RETURN v1;
-END|
-select distinct f1, bug13575(f1) from t3 order by f1|
-drop function bug13575|
-drop table t3|
-
-#
-# BUG#11758414: Default storage_engine not honored when set
-# from within a stored procedure
-#
-SELECT @@GLOBAL.storage_engine INTO @old_engine|
-SET @@GLOBAL.storage_engine=InnoDB|
-SET @@SESSION.storage_engine=InnoDB|
-# show defaults at define-time
-SHOW GLOBAL VARIABLES LIKE 'storage_engine'|
-SHOW SESSION VARIABLES LIKE 'storage_engine'|
-CREATE PROCEDURE bug11758414()
-BEGIN
- SET @@GLOBAL.storage_engine="MyISAM";
- SET @@SESSION.storage_engine="MyISAM";
- # show defaults at execution time / that setting them worked
- SHOW GLOBAL VARIABLES LIKE 'storage_engine';
- SHOW SESSION VARIABLES LIKE 'storage_engine';
- CREATE TABLE t1 (id int);
- CREATE TABLE t2 (id int) ENGINE=InnoDB;
- # show we're heeding the default (at run-time, not parse-time!)
- SHOW CREATE TABLE t1;
- # show that we didn't break explicit override with ENGINE=...
- SHOW CREATE TABLE t2;
-END;
-|
-CALL bug11758414|
-# show that changing defaults within SP stuck
-SHOW GLOBAL VARIABLES LIKE 'storage_engine'|
-SHOW SESSION VARIABLES LIKE 'storage_engine'|
-DROP PROCEDURE bug11758414|
-DROP TABLE t1, t2|
-SET @@GLOBAL.storage_engine=@old_engine|
-
---echo #
---echo # End of 5.1 tests
---echo #
-
---echo #
---echo # Bug #35877 Update .. WHERE with function, constraint violation, crash
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1_aux|
-DROP TABLE IF EXISTS t1_not_null|
-DROP FUNCTION IF EXISTS f1_two_inserts|
---enable_warnings
-
--- echo # MyISAM test
-CREATE TABLE t1_not_null (f1 BIGINT, f2 BIGINT NOT NULL)|
-CREATE TABLE t1_aux (f1 BIGINT, f2 BIGINT)|
-INSERT INTO t1_aux VALUES (1,1)|
-
-CREATE FUNCTION f1_two_inserts() returns INTEGER
-BEGIN
- INSERT INTO t1_not_null SET f1 = 10, f2 = NULL;
- RETURN 1;
-END|
-
--- error ER_BAD_NULL_ERROR
-UPDATE t1_aux SET f2 = 2 WHERE f1 = f1_two_inserts()|
-
--- echo # InnoDB test
-ALTER TABLE t1_not_null ENGINE = InnoDB|
-ALTER TABLE t1_aux ENGINE = InnoDB|
-
--- error ER_BAD_NULL_ERROR
-UPDATE t1_aux SET f2 = 2 WHERE f1 = f1_two_inserts()|
-
-DROP TABLE t1_aux, t1_not_null|
-DROP FUNCTION f1_two_inserts|
-
---echo #
---echo # Bug#49938: Failing assertion: inode or deadlock in fsp/fsp0fsp.c
---echo #
-
---disable_warnings
-DROP PROCEDURE IF EXISTS p1|
-DROP TABLE IF EXISTS t1|
---enable_warnings
-
-CREATE TABLE t1 (a INT) ENGINE=INNODB|
-
-CREATE PROCEDURE p1()
-BEGIN
- TRUNCATE TABLE t1;
-END|
-
-LOCK TABLES t1 WRITE|
-CALL p1()|
-FLUSH TABLES;
-UNLOCK TABLES|
-CALL p1()|
-
-DROP PROCEDURE p1|
-DROP TABLE t1|
-
-#
-# BUG#NNNN: New bug synopsis
-#
-#--disable_warnings
-#drop procedure if exists bugNNNN|
-#--enable_warnings
-#create procedure bugNNNN...
-
-delimiter ;|
diff --git a/mysql-test/t/sp_trans_log.test b/mysql-test/t/sp_trans_log.test
deleted file mode 100644
index deea6e6d9b6..00000000000
--- a/mysql-test/t/sp_trans_log.test
+++ /dev/null
@@ -1,49 +0,0 @@
-# binlog disabled in embedded server
--- source include/not_embedded.inc
-
-# part of sp_trans test that appeared to be sensitive to binlog format
---source include/have_innodb.inc
---source include/have_binlog_format_mixed.inc
-
-delimiter |;
-
-#
-# Bug#13270 INSERT,UPDATE,etc that calls func with side-effect does not binlog
-# Bug#23333 stored function + non-transac table + transac table =
-# breaks stmt-based binlog
-# Bug#27395 OPTION_STATUS_NO_TRANS_UPDATE is not preserved at the end of SF()
-#
---disable_warnings
-drop function if exists bug23333|
-drop table if exists t1,t2|
---enable_warnings
-CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM|
-CREATE TABLE t2 (a int NOT NULL auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB|
-
-insert into t2 values (1,1)|
-
-create function bug23333()
-RETURNS int(11)
-DETERMINISTIC
-begin
- insert into t1 values (null);
- select count(*) from t1 into @a;
- return @a;
-end|
-delimiter ;|
-
-reset master;
---error ER_DUP_ENTRY
-insert into t2 values (bug23333(),1);
-# the following must show there are events after the query
-# the binlog_limit is used to hide the differences between the mixed
-# and row logging formats after BUG#53259
-let $binlog_limit= 0, 4;
-source include/show_binlog_events.inc;
-select count(*),@a from t1 /* must be 1,1 */;
-
-
-# clean-up
-
-drop table t1,t2;
-drop function if exists bug23333;
diff --git a/mysql-test/t/sql_mode.test b/mysql-test/t/sql_mode.test
deleted file mode 100644
index 9f38dc935e7..00000000000
--- a/mysql-test/t/sql_mode.test
+++ /dev/null
@@ -1,556 +0,0 @@
---disable_warnings
-drop table if exists t1,t2,v1,v2;
-drop view if exists t1,t2,v1,v2;
---enable_warnings
-
-CREATE TABLE `t1` (
- a int not null auto_increment,
- `pseudo` varchar(35) character set latin2 NOT NULL default '',
- `email` varchar(60) character set latin2 NOT NULL default '',
- PRIMARY KEY (a),
- UNIQUE KEY `email` USING BTREE (`email`)
-) ENGINE=HEAP CHARSET=latin1 ROW_FORMAT DYNAMIC;
-set @@sql_mode="";
-show variables like 'sql_mode';
-show create table t1;
-set @@sql_mode="ansi_quotes";
-show variables like 'sql_mode';
-show create table t1;
-set @@sql_mode="no_table_options";
-show variables like 'sql_mode';
-show create table t1;
-set @@sql_mode="no_key_options";
-show variables like 'sql_mode';
-show create table t1;
-set @@sql_mode="no_field_options,mysql323,mysql40";
-show variables like 'sql_mode';
-show create table t1;
-set sql_mode="postgresql,oracle,mssql,db2,maxdb";
-select @@sql_mode;
-show create table t1;
-drop table t1;
-
-#
-# Check that a binary collation adds 'binary'
-# suffix into a char() column definition in
-# mysql40 and mysql2323 modes. This allows
-# not to lose the column's case sensitivity
-# when loading the dump in pre-4.1 servers.
-#
-# Thus, in 4.0 and 3.23 modes we dump:
-#
-# 'char(10) collate xxx_bin' as 'char(10) binary'
-# 'binary(10)' as 'binary(10)'
-#
-# In mysql-4.1 these types are different, and they will
-# be recreated differently.
-#
-# In mysqld-4.0 the the above two types were the same,
-# so it will create a 'char(10) binary' column for both definitions.
-#
-CREATE TABLE t1 (
- a char(10),
- b char(10) collate latin1_bin,
- c binary(10)
-) character set latin1;
-set @@sql_mode="";
-show create table t1;
-set @@sql_mode="mysql323";
-show create table t1;
-set @@sql_mode="mysql40";
-show create table t1;
-drop table t1;
-
-#
-# BUG#5318 - failure: 'IGNORE_SPACE' affects numeric values after DEFAULT
-#
-# Force the usage of the default
-set session sql_mode = '';
-# statement for comparison, value starts with '.'
-create table t1 ( min_num dec(6,6) default .000001);
-show create table t1;
-drop table t1 ;
-#
-set session sql_mode = 'IGNORE_SPACE';
-# statement for comparison, value starts with '0'
-create table t1 ( min_num dec(6,6) default 0.000001);
-show create table t1;
-drop table t1 ;
-# This statement fails, value starts with '.'
-create table t1 ( min_num dec(6,6) default .000001);
-show create table t1;
-drop table t1 ;
-
-#
-# Bug #10732: Set SQL_MODE to NULL gives garbled error message
-#
---error 1231
-set @@SQL_MODE=NULL;
-
-#
-# Bug #797: in sql_mode=ANSI, show create table ignores auto_increment
-#
-set session sql_mode=ansi;
-create table t1
-(f1 integer auto_increment primary key,
- f2 timestamp not null default current_timestamp on update current_timestamp);
-show create table t1;
-set session sql_mode=no_field_options;
-show create table t1;
-drop table t1;
-
-# End of 4.1 tests
-
-#
-# test for
-# WL 1941 "NO_C_ESCAPES sql_mode"
-#
-# an sql_mode to disable \n, \r, \b, etc escapes in string literals. actually, to
-# disable special meaning of backslash completely. It's not in the SQL standard
-# and it causes some R/3 tests to fail.
-#
-
-SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='';
-show local variables like 'SQL_MODE';
-
-CREATE TABLE t1 (p int not null auto_increment, a varchar(20), primary key(p));
-INSERT t1 (a) VALUES
-('\\'),
-('\n'),
-('\b'),
-('\r'),
-('\t'),
-('\x'),
-('\a'),
-('\aa'),
-('\\a'),
-('\\aa'),
-('_'),
-('\_'),
-('\\_'),
-('\\\_'),
-('\\\\_'),
-('%'),
-('\%'),
-('\\%'),
-('\\\%'),
-('\\\\%')
-;
-
-SELECT p, hex(a) FROM t1;
-
-delete from t1 where a in ('\n','\r','\t', '\b');
-
-select
- masks.p,
- masks.a as mask,
- examples.a as example
-from
- t1 as masks
- left join t1 as examples on examples.a LIKE masks.a
-order by masks.p, example;
-
-DROP TABLE t1;
-
-SET @@SQL_MODE='NO_BACKSLASH_ESCAPES';
-show local variables like 'SQL_MODE';
-
-CREATE TABLE t1 (p int not null auto_increment, a varchar(20), primary key(p));
-INSERT t1 (a) VALUES
-('\\'),
-('\n'),
-('\b'),
-('\r'),
-('\t'),
-('\x'),
-('\a'),
-('\aa'),
-('\\a'),
-('\\aa'),
-('_'),
-('\_'),
-('\\_'),
-('\\\_'),
-('\\\\_'),
-('%'),
-('\%'),
-('\\%'),
-('\\\%'),
-('\\\\%')
-;
-
-SELECT p, hex(a) FROM t1;
-
-delete from t1 where a in ('\n','\r','\t', '\b');
-
-select
- masks.p,
- masks.a as mask,
- examples.a as example
-from
- t1 as masks
- left join t1 as examples on examples.a LIKE masks.a
-order by masks.p, example;
-
-DROP TABLE t1;
-
-# Bug #6368: Make sure backslashes mixed with doubled quotes are handled
-# correctly in NO_BACKSLASH_ESCAPES mode
-SET @@SQL_MODE='NO_BACKSLASH_ESCAPES';
-SELECT 'a\\b', 'a\\\"b', 'a''\\b', 'a''\\\"b';
-SELECT "a\\b", "a\\\'b", "a""\\b", "a""\\\'b";
-
-SET @@SQL_MODE='';
-SELECT 'a\\b', 'a\\\"b', 'a''\\b', 'a''\\\"b';
-SELECT "a\\b", "a\\\'b", "a""\\b", "a""\\\'b";
-
-#
-# Bug#6877: MySQL should give an error if the requested table type
-# is not available
-#
-
-#set session sql_mode = 'NO_ENGINE_SUBSTITUTION';
-#--error 1289
-#create table t1 (a int) engine=isam;
-#--error 1146
-#show create table t1;
-#drop table if exists t1;
-#
-## for comparison, lets see the warnings...
-#set session sql_mode = '';
-#create table t1 (a int) engine=isam;
-#show create table t1;
-#drop table t1;
-
-#
-# Bug #6903: ANSI_QUOTES does not come into play with SHOW CREATE FUNCTION
-# or PROCEDURE because it displays the SQL_MODE used to create the routine.
-#
-SET @@SQL_MODE='';
-create function `foo` () returns int return 5;
-show create function `foo`;
-SET @@SQL_MODE='ANSI_QUOTES';
-show create function `foo`;
-drop function `foo`;
-
-create function `foo` () returns int return 5;
-show create function `foo`;
-SET @@SQL_MODE='';
-show create function `foo`;
-drop function `foo`;
-
-#
-# Bug #6903: ANSI_QUOTES should have effect for SHOW CREATE VIEW (Bug #6903)
-#
-SET @@SQL_MODE='';
-create table t1 (a int);
-create table t2 (a int);
-create view v1 as select a from t1;
-show create view v1;
-SET @@SQL_MODE='ANSI_QUOTES';
-show create view v1;
-# Test a view with a subselect, which will get shown incorrectly without
-# thd->lex->view_prepare_mode set properly.
-create view v2 as select a from t2 where a in (select a from v1);
-drop view v2, v1;
-drop table t1, t2;
-
-select @@sql_mode;
-set sql_mode=2097152;
-select @@sql_mode;
-# BUG#14675
-set sql_mode=4194304;
-select @@sql_mode;
-set sql_mode=16384+(65536*4);
-select @@sql_mode;
---error 1231
-set sql_mode=2147483648*2*2*2; # that mode does not exist
-select @@sql_mode;
-
-#
-# Test WL921: Retain spaces when retrieving CHAR column values
-
-set sql_mode=PAD_CHAR_TO_FULL_LENGTH;
-create table t1 (a int auto_increment primary key, b char(5));
-insert into t1 (b) values('a'),('b\t'),('c ');
-select concat('x',b,'x') from t1;
-set sql_mode=0;
-select concat('x',b,'x') from t1;
-drop table t1;
-
-SET @@SQL_MODE=@OLD_SQL_MODE;
-
-
-#
-# Bug #32753: PAD_CHAR_TO_FULL_LENGTH is not documented and interferes
-# with grant tables
-#
-
-create user mysqltest_32753@localhost;
-
-# try to make the user-table space-padded
---connection default
-set @OLD_SQL_MODE=@@SESSION.SQL_MODE;
-set session sql_mode='PAD_CHAR_TO_FULL_LENGTH';
-flush privileges;
-
-# if user-table is affected by PAD_CHAR_TO_FULL_LENGTH, our connect will fail
-# --error 1045
-connect (user_32753,localhost,mysqltest_32753,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
-select current_user();
-
-# clean up
---connection default
-set session sql_mode=@OLD_SQL_MODE;
-flush privileges;
-
---disconnect user_32753
-
---connection default
-drop user mysqltest_32753@localhost;
-
-
-#
-# Bug#21099 MySQL 5.0.22 silently creates MyISAM tables even though
-# InnoDB specified.
-#
-
-SET @org_mode=@@sql_mode;
-SET @@sql_mode='traditional';
-
-# Agreed change was to add NO_ENGINE_SUBSTITUTION to TRADITIONAL sql mode.
-SELECT @@sql_mode LIKE '%NO_ENGINE_SUBSTITUTION%';
-
-SET sql_mode=@org_mode;
-
-
-#
-# Bug#45100: Incomplete DROP USER in case of SQL_MODE = 'PAD_CHAR_TO_FULL_LENGTH'
-#
-
---disable_warnings
-DROP TABLE IF EXISTS t1,t2;
---enable_warnings
-
-# Generate some prerequisites
-CREATE USER 'user_PCTFL'@'localhost' identified by 'PWD';
-CREATE USER 'user_no_PCTFL'@'localhost' identified by 'PWD';
-
-CREATE TABLE t1 (f1 BIGINT);
-CREATE TABLE t2 (f1 CHAR(3) NOT NULL, f2 CHAR(20));
-
-# Grant privilege on a TABLE
-GRANT ALL ON t1 TO 'user_PCTFL'@'localhost','user_no_PCTFL'@'localhost';
-# Grant privilege on some COLUMN of a table
-GRANT SELECT(f1) ON t2 TO 'user_PCTFL'@'localhost','user_no_PCTFL'@'localhost';
-
-SET @OLD_SQL_MODE = @@SESSION.SQL_MODE;
-SET SESSION SQL_MODE = 'PAD_CHAR_TO_FULL_LENGTH';
-DROP USER 'user_PCTFL'@'localhost';
-SET SESSION SQL_MODE = @OLD_SQL_MODE;
-DROP USER 'user_no_PCTFL'@'localhost';
-
-FLUSH PRIVILEGES;
-
-SELECT * FROM mysql.db WHERE Host = 'localhost' AND User LIKE 'user_%PCTFL';
-SELECT * FROM mysql.tables_priv WHERE Host = 'localhost' AND User LIKE 'user_%PCTFL';
-SELECT * FROM mysql.columns_priv WHERE Host = 'localhost' AND User LIKE 'user_%PCTFL';
-
-# Cleanup
-DROP TABLE t1;
-DROP TABLE t2;
-
-
---echo
---echo #
---echo # Test for Bug#12601974 - STORED PROCEDURE SQL_MODE=NO_BACKSLASH_ESCAPES
---echo # IGNORED AND BREAKS REPLICATION
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS test_table;
-DROP FUNCTION IF EXISTS test_function;
---enable_warnings
-
-CREATE TABLE test_table (c1 CHAR(50));
-
-SET @org_mode=@@sql_mode;
-
-SET @@sql_mode='';
-
-PREPARE insert_stmt FROM 'INSERT INTO test_table VALUES (?)';
-PREPARE update_stmt FROM 'UPDATE test_table SET c1= ? WHERE c1= ?';
-DELIMITER $;
-CREATE FUNCTION test_function(var CHAR(50)) RETURNS CHAR(50)
-BEGIN
- DECLARE char_val CHAR(50);
- SELECT c1 INTO char_val FROM test_table WHERE c1=var;
- RETURN char_val;
-END
-$
-DELIMITER ;$
-
-SET @var1='abcd\'ef';
-SET @var2='abcd\"ef';
-SET @var3='abcd\bef';
-SET @var4='abcd\nef';
-SET @var5='abcd\ref';
-SET @var6='abcd\tef';
-SET @var7='abcd\\ef';
-SET @var8='abcd\%ef';
-SET @var9='abcd\_ef';
-
-SET @to_var1='wxyz\'ef';
-SET @to_var2='wxyz\"ef';
-SET @to_var3='wxyz\bef';
-SET @to_var4='wxyz\nef';
-SET @to_var5='wxyz\ref';
-SET @to_var6='wxyz\tef';
-SET @to_var7='wxyz\\ef';
-SET @to_var8='wxyz\%ef';
-SET @to_var9='wxyz\_ef';
-
---echo # STRING LILTERAL WITH BACKSLASH IN PREPARE STATEMENT
-EXECUTE insert_stmt USING @var1;
-EXECUTE insert_stmt USING @var2;
-EXECUTE insert_stmt USING @var3;
-EXECUTE insert_stmt USING @var4;
-EXECUTE insert_stmt USING @var5;
-EXECUTE insert_stmt USING @var6;
-EXECUTE insert_stmt USING @var7;
-EXECUTE insert_stmt USING @var8;
-EXECUTE insert_stmt USING @var9;
-
-SELECT * FROM test_table;
-
-EXECUTE update_stmt USING @to_var1, @var1;
-EXECUTE update_stmt USING @to_var2, @var2;
-EXECUTE update_stmt USING @to_var3, @var3;
-EXECUTE update_stmt USING @to_var4, @var4;
-EXECUTE update_stmt USING @to_var5, @var5;
-EXECUTE update_stmt USING @to_var6, @var6;
-EXECUTE update_stmt USING @to_var7, @var7;
-EXECUTE update_stmt USING @to_var8, @var8;
-EXECUTE update_stmt USING @to_var9, @var9;
-
-SELECT * FROM test_table;
-
---echo
---echo # END OF CASE - STRING LILTERAL WITH BACKSLASH IN PREPARE STATEMENT
-
---echo # STRING LILTERAL WITH BACKSLASH IN FUNCTION RETURNING STRING
-select test_function(@to_var1);
-SELECT test_function(@to_var2);
-SELECT test_function(@to_var3);
-SELECT test_function(@to_var4);
-SELECT test_function(@to_var5);
-SELECT test_function(@to_var6);
-SELECT test_function(@to_var7);
-SELECT test_function(@to_var8);
-SELECT test_function(@to_var9);
-
---echo
---echo # END OF CASE - STRING LILTERAL WITH BACKSLASH IN FUNCTION RETURNING STRING
-DELETE FROM test_table;
-DROP FUNCTION test_function;
-
-SET @@sql_mode='NO_BACKSLASH_ESCAPES';
-DELIMITER $;
-CREATE FUNCTION test_function(var CHAR(50)) RETURNS CHAR(50)
-BEGIN
- DECLARE char_val CHAR(50);
- SELECT c1 INTO char_val FROM test_table WHERE c1=var;
- RETURN char_val;
-END
-$
-DELIMITER ;$
-
---echo # STRING LILTERAL WITH BACKSLASH IN PREPARE STATEMENT
-EXECUTE insert_stmt USING @var1;
-EXECUTE insert_stmt USING @var2;
-EXECUTE insert_stmt USING @var3;
-EXECUTE insert_stmt USING @var4;
-EXECUTE insert_stmt USING @var5;
-EXECUTE insert_stmt USING @var6;
-EXECUTE insert_stmt USING @var7;
-EXECUTE insert_stmt USING @var8;
-EXECUTE insert_stmt USING @var9;
-
-SELECT * FROM test_table;
-
-EXECUTE update_stmt USING @to_var1, @var1;
-EXECUTE update_stmt USING @to_var2, @var2;
-EXECUTE update_stmt USING @to_var3, @var3;
-EXECUTE update_stmt USING @to_var4, @var4;
-EXECUTE update_stmt USING @to_var5, @var5;
-EXECUTE update_stmt USING @to_var6, @var6;
-EXECUTE update_stmt USING @to_var7, @var7;
-EXECUTE update_stmt USING @to_var8, @var8;
-EXECUTE update_stmt USING @to_var9, @var9;
-
-SELECT * FROM test_table;
-
---echo
---echo # END OF CASE - STRING LILTERAL WITH BACKSLASH IN PREPARE STATEMENT
-
---echo # STRING LILTERAL WITH BACKSLASH IN FUNCTION RETURNING STRING
-select test_function(@to_var1);
-SELECT test_function(@to_var2);
-SELECT test_function(@to_var3);
-SELECT test_function(@to_var4);
-SELECT test_function(@to_var5);
-SELECT test_function(@to_var6);
-SELECT test_function(@to_var7);
-SELECT test_function(@to_var8);
-SELECT test_function(@to_var9);
-
---echo
---echo # END OF CASE - STRING LILTERAL WITH BACKSLASH IN FUNCTION RETURNING STRING
-
-DROP TABLE test_table;
-DROP FUNCTION test_function;
-SET @@sql_mode= @org_mode;
-
---echo
---echo #End of Test for Bug#12601974
-
---echo #
---echo # MDEV-11848 Automatic statement repreparation changes query semantics
---echo #
-SET sql_mode=DEFAULT;
-CREATE OR REPLACE TABLE t1 (a TEXT);
-PREPARE stmt FROM 'INSERT INTO t1 (a) VALUES (2||3)';
-EXECUTE stmt;
-SET sql_mode=ORACLE;
-EXECUTE stmt;
-ALTER TABLE t1 ADD b INT;
-EXECUTE stmt;
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-12390 Wrong error line numbers reported with sql_mode=IGNORE_SPACE
---echo #
-
-SET sql_mode=IGNORE_SPACE;
-DELIMITER $$;
---error ER_PARSE_ERROR
-CREATE PROCEDURE p1()
-BEGIN
- SELECT 1+1;
- syntax error;
-END;
-$$
-DELIMITER ;$$
-
-
-SET sql_mode=DEFAULT;
-DELIMITER $$;
---error ER_PARSE_ERROR
-CREATE PROCEDURE p1()
-BEGIN
- SELECT 1+1;
- syntax error;
-END;
-$$
-DELIMITER ;$$
diff --git a/mysql-test/t/ssl-big.test b/mysql-test/t/ssl-big.test
deleted file mode 100644
index 59825a148a4..00000000000
--- a/mysql-test/t/ssl-big.test
+++ /dev/null
@@ -1,66 +0,0 @@
-# Turn on ssl between the client and server
-# and run a number of tests
-
--- source include/have_ssl_communication.inc
--- source include/big_test.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-#
-# Bug#29579 Clients using SSL can hang the server
-#
-
-connect (ssl_con,localhost,root,,,,,SSL);
-
-create table t1 (a int);
-
-disconnect ssl_con;
-
-
---disable_query_log
---disable_result_log
-
-let $count= 2000;
-while ($count)
-{
- connect (ssl_con,localhost,root,,,,,SSL);
-
- eval insert into t1 values ($count);
- dec $count;
-
- # This select causes the net buffer to fill as the server sends the results
- # but the client doesn't reap the results. The results are larger each time
- # through the loop, so that eventually the buffer is completely full
- # at the exact moment the server attempts to the close the connection with
- # the lock held.
- send select * from t1;
-
- # now send the quit the command so the server will initiate the shutdown.
- send_quit ssl_con;
-
- # if the server is hung, this will hang too:
- connect (ssl_con2,localhost,root,,,,,SSL);
-
- # no hang if we get here, close and retry
- disconnect ssl_con2;
- disconnect ssl_con;
-}
---enable_query_log
---enable_result_log
-
-connect (ssl_con,localhost,root,,,,,SSL);
-
-drop table t1;
-connection default;
-disconnect ssl_con;
-
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
-
-## This test file is for testing encrypted communication only, not other
-## encryption routines that the SSL library happens to provide!
diff --git a/mysql-test/t/ssl.test b/mysql-test/t/ssl.test
deleted file mode 100644
index f2ac288db7a..00000000000
--- a/mysql-test/t/ssl.test
+++ /dev/null
@@ -1,41 +0,0 @@
-# Turn on ssl between the client and server
-# and run a number of tests
-
--- source include/have_ssl_communication.inc
-# Slow test, don't run during staging part
--- source include/not_staging.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-connect (ssl_con,localhost,root,,,,,SSL);
-
-# Check ssl turned on
-SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
-
-# Check ssl expiration
-SHOW STATUS LIKE 'Ssl_server_not_before';
-SHOW STATUS LIKE 'Ssl_server_not_after';
-
-# Source select test case
--- source include/common-tests.inc
-
-# Check ssl turned on
-SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
-
-#
-# MDEV-7697 Client reports ERROR 2006 (MySQL server has gone away) or ERROR 2013 (Lost connection to MySQL server during query) while executing AES* functions under SSL
-#
-select aes_decrypt('MySQL','adf');
-select 'still connected?';
-
-connection default;
-disconnect ssl_con;
-
-create user mysqltest_1@localhost;
-grant usage on mysqltest.* to mysqltest_1@localhost require cipher "AES256-SHA";
---exec $MYSQL -umysqltest_1 --ssl-cipher=AES256-SHA -e "show status like 'ssl_cipher'" 2>&1
-drop user mysqltest_1@localhost;
-
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/ssl_7937.combinations b/mysql-test/t/ssl_7937.combinations
deleted file mode 100644
index 71b134e229a..00000000000
--- a/mysql-test/t/ssl_7937.combinations
+++ /dev/null
@@ -1,10 +0,0 @@
-[x509v3]
---loose-enable-ssl
---loose-ssl-cert=$MYSQL_TEST_DIR/std_data/serversan-cert.pem
---loose-ssl-key=$MYSQL_TEST_DIR/std_data/serversan-key.pem
-
-[ssl]
---loose-enable-ssl
-
-[nossl]
---loose-disable-ssl
diff --git a/mysql-test/t/ssl_7937.test b/mysql-test/t/ssl_7937.test
deleted file mode 100644
index aa8cd225d7b..00000000000
--- a/mysql-test/t/ssl_7937.test
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# MDEV-7937: Enforce SSL when --ssl client option is used
-#
-
-source include/have_ssl_crypto_functs.inc;
-
-# create a procedure instead of SHOW STATUS LIKE 'ssl_cipher'
-# because the cipher depends on openssl (or yassl) version,
-# and it's actual value doesn't matter here anyway
-create procedure have_ssl()
- select if(variable_value > '','yes','no') as 'have_ssl'
- from information_schema.session_status
- where variable_name='ssl_cipher';
-
---disable_abort_on_error
---echo mysql --ssl-ca=cacert.pem -e "call test.have_ssl()"
---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem -e "call test.have_ssl()" 2>&1
---echo mysql --ssl -e "call test.have_ssl()"
---exec $MYSQL --ssl -e "call test.have_ssl()" 2>&1
---echo mysql --ssl-ca=cacert.pem --ssl-verify-server-cert -e "call test.have_ssl()"
---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-verify-server-cert -e "call test.have_ssl()" 2>&1
-
---echo mysql --ssl --ssl-verify-server-cert -e "call test.have_ssl()"
-# this is the test where certificate verification fails.
-# but yassl doesn't support certificate verification, so
-# we fake the test result for yassl
-let yassl=`select variable_value='Unknown' from information_schema.session_status where variable_name='Ssl_session_cache_mode'`;
-if (!$yassl) {
- --replace_result "self signed certificate in certificate chain" "Failed to verify the server certificate" "Error in the certificate." "Failed to verify the server certificate"
- --exec $MYSQL --ssl --ssl-verify-server-cert -e "call test.have_ssl()" 2>&1
-}
-if ($yassl) {
- --echo ERROR 2026 (HY000): SSL connection error: Failed to verify the server certificate
-}
-drop procedure have_ssl;
diff --git a/mysql-test/t/ssl_8k_key-master.opt b/mysql-test/t/ssl_8k_key-master.opt
deleted file mode 100644
index 856b33e95ee..00000000000
--- a/mysql-test/t/ssl_8k_key-master.opt
+++ /dev/null
@@ -1,2 +0,0 @@
---loose-ssl-key=$MYSQL_TEST_DIR/std_data/server8k-key.pem
---loose-ssl-cert=$MYSQL_TEST_DIR/std_data/server8k-cert.pem
diff --git a/mysql-test/t/ssl_8k_key.test b/mysql-test/t/ssl_8k_key.test
deleted file mode 100644
index edfead46658..00000000000
--- a/mysql-test/t/ssl_8k_key.test
+++ /dev/null
@@ -1,11 +0,0 @@
-# schannel does not support keys longer than 4k
--- source include/not_windows.inc
-
--- source include/have_ssl_communication.inc
-#
-# Bug#29784 YaSSL assertion failure when reading 8k key.
-#
---exec $MYSQL --connect-timeout=180 --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SELECT (VARIABLE_VALUE <> '') as have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'" 2>&1
-
-## This test file is for testing encrypted communication only, not other
-## encryption routines that the SSL library happens to provide!
diff --git a/mysql-test/t/ssl_and_innodb.test b/mysql-test/t/ssl_and_innodb.test
deleted file mode 100644
index 4966f05b37b..00000000000
--- a/mysql-test/t/ssl_and_innodb.test
+++ /dev/null
@@ -1,11 +0,0 @@
--- source include/have_innodb.inc
--- source include/have_ssl_crypto_functs.inc
-
-CREATE TABLE t1(a int) engine=innodb;
-INSERT INTO t1 VALUES (1);
-
-SELECT DISTINCT
-convert((SELECT des_decrypt(2,1) AS a FROM t1 WHERE @a:=1), signed) as d
-FROM t1 ;
-
-DROP TABLE t1;
diff --git a/mysql-test/t/ssl_ca.test b/mysql-test/t/ssl_ca.test
deleted file mode 100644
index 106da140130..00000000000
--- a/mysql-test/t/ssl_ca.test
+++ /dev/null
@@ -1,16 +0,0 @@
---source include/have_ssl_communication.inc
---source include/not_embedded.inc
-
---echo #
---echo # Bug#21920657: SSL-CA FAILS SILENTLY IF THE PATH CANNOT BE FOUND
---echo #
-
---echo # try to connect with wrong '--ssl-ca' path : should fail
-
---replace_regex /SSL connection error.*/SSL connection error: xxxx/
---error 1
---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/wrong-cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';" 2>&1
---echo
-
---echo # try to connect with correct '--ssl-ca' path : should connect
---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';"
diff --git a/mysql-test/t/ssl_cert_verify.test b/mysql-test/t/ssl_cert_verify.test
deleted file mode 100644
index 83f621b7ca9..00000000000
--- a/mysql-test/t/ssl_cert_verify.test
+++ /dev/null
@@ -1,43 +0,0 @@
-# Want to skip this test from Valgrind execution
---source include/no_valgrind_without_big.inc
-# This test should work in embedded server after we fix mysqltest
--- source include/not_embedded.inc
--- source include/have_ssl_communication.inc
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-let $ssl_verify_fail_path = --ssl --ssl-ca=$MYSQL_TEST_DIR/std_data/ca-cert-verify.pem --ssl-key=$MYSQL_TEST_DIR/std_data/server-key-verify-fail.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/server-cert-verify-fail.pem;
-let $ssl_verify_pass_path = --ssl --ssl-ca=$MYSQL_TEST_DIR/std_data/ca-cert-verify.pem --ssl-key=$MYSQL_TEST_DIR/std_data/server-key-verify-pass.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/server-cert-verify-pass.pem;
-
---echo #T1: Host name (/CN=localhost/) as OU name in the server certificate, server certificate verification should fail.
---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server
---source include/wait_until_disconnected.inc
-
---exec echo "restart:" $ssl_verify_fail_path > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---enable_reconnect
---source include/wait_until_connected_again.inc
-
---error 1
---exec $MYSQL --protocol=tcp --ssl-ca=$MYSQL_TEST_DIR/std_data/ca-cert-verify.pem --ssl-verify-server-cert -e "SHOW STATUS like 'Ssl_version'"
-
---echo #T2: Host name (localhost) as common name in the server certificate, server certificate verification should pass.
---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server
---source include/wait_until_disconnected.inc
-
---exec echo "restart:" $ssl_verify_pass_path > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---enable_reconnect
---source include/wait_until_connected_again.inc
-
---replace_result TLSv1.2 TLS_VERSION TLSv1.1 TLS_VERSION TLSv1 TLS_VERSION
---exec $MYSQL --protocol=tcp --ssl-ca=$MYSQL_TEST_DIR/std_data/ca-cert-verify.pem --ssl-verify-server-cert -e "SHOW STATUS like 'Ssl_version'"
-
---echo # restart server using restart
---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server
---source include/wait_until_disconnected.inc
-
---exec echo "restart: " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---enable_reconnect
---source include/wait_until_connected_again.inc
diff --git a/mysql-test/t/ssl_cipher-master.opt b/mysql-test/t/ssl_cipher-master.opt
deleted file mode 100644
index d750c46ba5c..00000000000
--- a/mysql-test/t/ssl_cipher-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-ssl-cipher=AES128-SHA
diff --git a/mysql-test/t/ssl_cipher.test b/mysql-test/t/ssl_cipher.test
deleted file mode 100644
index cf249343324..00000000000
--- a/mysql-test/t/ssl_cipher.test
+++ /dev/null
@@ -1,23 +0,0 @@
-# Turn on ssl between the client and server
-# and run a number of tests
-
---echo #
---echo # BUG#11760210 - SSL_CIPHER_LIST NOT SET OR RETURNED FOR "SHOW STATUS LIKE 'SSL_CIPHER_LIST'"
---echo #
-
--- source include/have_ssl_communication.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-connect (ssl_con,localhost,root,,,,,SSL);
-
-# Check Cipher Name and Cipher List
-SHOW STATUS LIKE 'Ssl_cipher';
-SHOW STATUS LIKE 'Ssl_cipher_list';
-
-connection default;
-disconnect ssl_con;
-
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/ssl_compress.test b/mysql-test/t/ssl_compress.test
deleted file mode 100644
index 588d4555db8..00000000000
--- a/mysql-test/t/ssl_compress.test
+++ /dev/null
@@ -1,35 +0,0 @@
-# Turn on compression between the client and server
-# and run a number of tests
-
--- source include/have_ssl_communication.inc
--- source include/have_compress.inc
--- source include/not_staging.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-connect (ssl_compress_con,localhost,root,,,,,SSL COMPRESS);
-
-# Check ssl turned on
-SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
-
-# Check compression turned on
-SHOW STATUS LIKE 'Compression';
-
-# Source select test case
--- source include/common-tests.inc
-
-# Check ssl turned on
-SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
-
-# Check compression turned on
-SHOW STATUS LIKE 'Compression';
-
-connection default;
-disconnect ssl_compress_con;
-
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
-
-## This test file is for testing encrypted communication only, not other
-## encryption routines that the SSL library happens to provide!
diff --git a/mysql-test/t/ssl_connect.test b/mysql-test/t/ssl_connect.test
deleted file mode 100644
index ce57e4f746d..00000000000
--- a/mysql-test/t/ssl_connect.test
+++ /dev/null
@@ -1,18 +0,0 @@
-
--- source include/have_ssl_communication.inc
-
-# Repeat connect/disconnect
-
-let $i=100;
-disable_connect_log;
-while ($i)
-{
- connect (test_con1,localhost,root,,,,,SSL);
- disconnect test_con1;
- dec $i;
-}
-enable_connect_log;
-echo completed;
-
-## This test file is for testing encrypted communication only, not other
-## encryption routines that the SSL library happens to provide!
diff --git a/mysql-test/t/ssl_crl-master.opt b/mysql-test/t/ssl_crl-master.opt
deleted file mode 100644
index 8500f8cd6e7..00000000000
--- a/mysql-test/t/ssl_crl-master.opt
+++ /dev/null
@@ -1,4 +0,0 @@
---ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem
---ssl-key=$MYSQL_TEST_DIR/std_data/crl-server-key.pem
---ssl-cert=$MYSQL_TEST_DIR/std_data/crl-server-cert.pem
---ssl-crl=$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl
diff --git a/mysql-test/t/ssl_crl.test b/mysql-test/t/ssl_crl.test
deleted file mode 100644
index 65c14837e50..00000000000
--- a/mysql-test/t/ssl_crl.test
+++ /dev/null
@@ -1,16 +0,0 @@
-# This test should work in embedded server after we fix mysqltest
--- source include/not_embedded.inc
--- source include/have_openssl.inc
-
---echo # test --crl for the client : should connect
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-valid-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-valid-cert.pem test --ssl-crl=$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl -e "SHOW VARIABLES like '%ssl%';"
-
---echo # test --crlpath for the client : should connect
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-valid-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-valid-cert.pem --ssl-crlpath=$MYSQL_TEST_DIR/std_data/crldir test -e "SHOW VARIABLES like '%ssl%';"
-
---echo # try logging in with a certificate in the server's --ssl-crl : should fail
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---error 1
---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem test -e "SHOW VARIABLES like '%ssl%';"
diff --git a/mysql-test/t/ssl_crl_clients-master.opt b/mysql-test/t/ssl_crl_clients-master.opt
deleted file mode 100644
index fa885a61a0c..00000000000
--- a/mysql-test/t/ssl_crl_clients-master.opt
+++ /dev/null
@@ -1,4 +0,0 @@
---ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem
---ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem
---ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem
---ssl-crl=$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl
diff --git a/mysql-test/t/ssl_crl_clients.test b/mysql-test/t/ssl_crl_clients.test
deleted file mode 100644
index 7c05f498fbe..00000000000
--- a/mysql-test/t/ssl_crl_clients.test
+++ /dev/null
@@ -1,41 +0,0 @@
-# This test should work in embedded server after we fix mysqltest
--- source include/not_embedded.inc
--- source include/have_openssl.inc
-
---echo # Test clients with and without CRL lists
-
-let $ssl_base = --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-server-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-server-cert.pem;
-let $ssl_crl = $ssl_base --ssl-crl=$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl;
-let $ssl_crlpath = $ssl_base --ssl-crlpath=$MYSQL_TEST_DIR/std_data/crldir;
-
-
---echo ############ Test mysql ##############
-
---echo # Test mysql connecting to a server with a certificate revoked by -crl
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---error 1
---exec $MYSQL $ssl_crl test -e "SHOW VARIABLES like '%ssl%';"
-
---echo # Test mysql connecting to a server with a certificate revoked by -crlpath
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---error 1
---exec $MYSQL $ssl_crlpath test -e "SHOW VARIABLES like '%ssl%';"
-
-
---echo ############ Test mysqladmin ##############
-let $admin_prefix = --no-defaults;
-let $admin_suffix = --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping;
-
---echo # Test mysqladmin connecting to a server with a certificate revoked by -crl
---disable_result_log
---replace_regex /.*mysqladmin.*: connect/mysqladmin: connect/
---error 2
---exec $MYSQLADMIN $admin_prefix $ssl_crl $admin_suffix 2>&1
---enable_result_log
-
---disable_result_log
---echo # Test mysqladmin connecting to a server with a certificate revoked by -crlpath
---replace_regex /.*mysqladmin.*: connect/mysqladmin: connect/
---error 2
---exec $MYSQLADMIN $admin_prefix $ssl_crlpath $admin_suffix 2>&1
---enable_result_log
diff --git a/mysql-test/t/ssl_crl_clients_valid-master.opt b/mysql-test/t/ssl_crl_clients_valid-master.opt
deleted file mode 100644
index 258df564eba..00000000000
--- a/mysql-test/t/ssl_crl_clients_valid-master.opt
+++ /dev/null
@@ -1,4 +0,0 @@
---ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem
---ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-valid-key.pem
---ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-valid-cert.pem
---ssl-crl=$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl
diff --git a/mysql-test/t/ssl_crl_clients_valid.test b/mysql-test/t/ssl_crl_clients_valid.test
deleted file mode 100644
index f08fbf09397..00000000000
--- a/mysql-test/t/ssl_crl_clients_valid.test
+++ /dev/null
@@ -1,23 +0,0 @@
-# This test should work in embedded server after we fix mysqltest
--- source include/not_embedded.inc
--- source include/have_openssl.inc
-
---echo # Test clients with and without CRL lists
-
-let $ssl_base = --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-server-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-server-cert.pem;
-let $ssl_crl = $ssl_base --ssl-crl=$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl;
-let $ssl_crlpath = $ssl_base --ssl-crlpath=$MYSQL_TEST_DIR/std_data/crldir;
-
-
---echo ############ Test mysql ##############
-
---echo # Test mysql connecting to a server with an empty crl
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL $ssl_crl test -e "SHOW VARIABLES like '%ssl%';" 2>&1
-
---echo ############ Test mysqladmin ##############
-let $admin_prefix = --no-defaults;
-let $admin_suffix = --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping;
-
---echo # Test mysqladmin connecting to a server with an empty crl
---exec $MYSQLADMIN $admin_prefix $ssl_crl $admin_suffix 2>&1
diff --git a/mysql-test/t/ssl_crl_clrpath-master.opt b/mysql-test/t/ssl_crl_clrpath-master.opt
deleted file mode 100644
index b1f486a322b..00000000000
--- a/mysql-test/t/ssl_crl_clrpath-master.opt
+++ /dev/null
@@ -1,4 +0,0 @@
---ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem
---ssl-key=$MYSQL_TEST_DIR/std_data/crl-server-key.pem
---ssl-cert=$MYSQL_TEST_DIR/std_data/crl-server-cert.pem
---ssl-crlpath=$MYSQL_TEST_DIR/std_data/crldir
diff --git a/mysql-test/t/ssl_crl_clrpath.test b/mysql-test/t/ssl_crl_clrpath.test
deleted file mode 100644
index 50d84ad175e..00000000000
--- a/mysql-test/t/ssl_crl_clrpath.test
+++ /dev/null
@@ -1,16 +0,0 @@
-# This test should work in embedded server after we fix mysqltest
--- source include/not_embedded.inc
--- source include/have_openssl.inc
-
---echo # test --crl for the client : should connect
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-valid-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-valid-cert.pem test --ssl-crl=$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl -e "SHOW VARIABLES like '%ssl%';"
-
---echo # test --crlpath for the client : should connect
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-valid-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-valid-cert.pem --ssl-crlpath=$MYSQL_TEST_DIR/std_data/crldir test -e "SHOW VARIABLES like '%ssl%';"
-
---echo # try logging in with a certificate in the server's --ssl-crlpath : should fail
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---error 1
---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem test -e "SHOW VARIABLES like '%ssl%';"
diff --git a/mysql-test/t/ssl_timeout-9836.opt b/mysql-test/t/ssl_timeout-9836.opt
deleted file mode 100644
index 7a2696875b8..00000000000
--- a/mysql-test/t/ssl_timeout-9836.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-thread-handling=pool-of-threads
diff --git a/mysql-test/t/ssl_timeout-9836.test b/mysql-test/t/ssl_timeout-9836.test
deleted file mode 100644
index 5b57917f3b8..00000000000
--- a/mysql-test/t/ssl_timeout-9836.test
+++ /dev/null
@@ -1,11 +0,0 @@
-#
-# MDEV-9836 Connection lost when using SSL
-#
--- source include/have_ssl_communication.inc
-connect(con1,localhost,root,,,,,SSL);
-SET @@net_read_timeout=1;
-SELECT 1;
-# MDEV-9836 - YASSL bug - SSL connection lost if it has been idle, for longer than net_read_timeout
--- sleep 2
-SELECT 1;
-disconnect con1;
diff --git a/mysql-test/t/ssl_timeout.test b/mysql-test/t/ssl_timeout.test
deleted file mode 100644
index 430fe7130de..00000000000
--- a/mysql-test/t/ssl_timeout.test
+++ /dev/null
@@ -1,20 +0,0 @@
---source include/have_ssl_communication.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
---echo # connect with read timeout so SLEEP() should timeout
-connect (ssl_con,localhost,root,,,,,SSL read_timeout=5);
-
---echo # Check ssl turned on
-SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
-
-# --error CR_SERVER_LOST
---error 2013
-SELECT SLEEP(600);
-
-connection default;
-disconnect ssl_con;
-
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/stack-crash.test b/mysql-test/t/stack-crash.test
deleted file mode 100644
index e4feb95a332..00000000000
--- a/mysql-test/t/stack-crash.test
+++ /dev/null
@@ -1,96 +0,0 @@
-#
-# Test to ensure that we don't get stack overflows
-#
-
-drop table if exists t1,t2;
-
-#
-# MDEV-5724
-# Server crashes on SQL select containing more group by and left join
-# statements
-# This was because record_buffer was 300,000 bytes and caused stack overflow
-#
-
-CREATE TABLE t1 (
- `sspo_id` int(11) NOT NULL AUTO_INCREMENT,
- `sspo_uid` int(11) NOT NULL DEFAULT '0',
- `sspo_type` varchar(1) NOT NULL DEFAULT 'P',
- `sspo_text` longtext NOT NULL,
- `sspo_image` varchar(255) NOT NULL,
- `sspo_source` int(11) NOT NULL DEFAULT '0',
- `sspo_event_name` varchar(255) NOT NULL DEFAULT '',
- `sspo_event_location` varchar(255) NOT NULL DEFAULT '',
- `sspo_event_date` datetime DEFAULT NULL,
- `sspo_remote_title` varchar(255) NOT NULL,
- `sspo_remote_url` varchar(255) NOT NULL,
- `sspo_remote_desc` text NOT NULL,
- `sspo_remote_image` varchar(255) NOT NULL,
- `sspo_obj_status` varchar(1) NOT NULL DEFAULT 'A',
- `sspo_cr_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
- `sspo_cr_uid` int(11) NOT NULL DEFAULT '0',
- `sspo_lu_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
- `sspo_lu_uid` int(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (`sspo_id`),
- KEY `post_uid` (`sspo_uid`,`sspo_cr_date`)
-) AUTO_INCREMENT=30 DEFAULT CHARSET=utf8;
-INSERT INTO t1 VALUES (1,2,'P','test1','',0,'','',NULL,'','','','','A','2013-09-30 00:19:32',2,'2013-09-30 00:19:32',2),(2,2,'P','bbb','',0,'','',NULL,'','','','','A','2013-10-02 15:06:35',2,'2013-10-02 15:06:35',2);
-
-CREATE TABLE `t2` (
- `spoo_id` int(11) NOT NULL AUTO_INCREMENT,
- `spoo_user_type_id` int(11) NOT NULL DEFAULT '0',
- `spoo_uid` int(11) NOT NULL DEFAULT '0',
- `spoo_option_id` int(11) NOT NULL DEFAULT '0',
- `spoo_value` varchar(10000) NOT NULL,
- `spoo_obj_status` varchar(1) NOT NULL DEFAULT 'A',
- `spoo_cr_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
- `spoo_cr_uid` int(11) NOT NULL DEFAULT '0',
- `spoo_lu_date` datetime NOT NULL DEFAULT '1970-01-01 00:00:00',
- `spoo_lu_uid` int(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (`spoo_id`),
- KEY `object_option_main_idx` (`spoo_user_type_id`,`spoo_uid`,`spoo_option_id`,`spoo_value`(255))
-) AUTO_INCREMENT=107 DEFAULT CHARSET=utf8;
-INSERT INTO `t2` VALUES (19,1,2,6,'Dortmund','A','2013-09-26 01:36:51',2,'2013-09-26 01:36:51',2),(20,1,2,8,'49','A','2013-09-26 01:36:51',2,'2013-09-26 01:36:51',2);
-
-SELECT Count(*)
-FROM t1 AS tbl
- LEFT JOIN t2 a
- ON a.spoo_uid = sspo_uid
- AND a.spoo_option_id = 1
- LEFT JOIN t2 b
- ON b.spoo_uid = sspo_uid
- AND b.spoo_option_id = 2
- LEFT JOIN t2 c
- ON c.spoo_uid = sspo_uid
- AND c.spoo_option_id = 3
- LEFT JOIN t2 d
- ON d.spoo_uid = sspo_uid
- AND d.spoo_option_id = 5
- LEFT JOIN t2 e
- ON e.spoo_uid = sspo_uid
- AND e.spoo_option_id = 4
- LEFT JOIN t2 f
- ON f.spoo_uid = sspo_uid
- AND f.spoo_option_id = 11
- LEFT JOIN t2 g
- ON g.spoo_uid = sspo_uid
- AND g.spoo_option_id = 7
- LEFT JOIN t2 h
- ON h.spoo_uid = sspo_uid
- AND h.spoo_option_id = 10
- LEFT JOIN t2 i
- ON i.spoo_uid = sspo_uid
- AND i.spoo_option_id = 18
- LEFT JOIN t2 j
- ON j.spoo_uid = sspo_uid
- AND j.spoo_option_id = 6
-GROUP BY a.spoo_value,
- b.spoo_value,
- c.spoo_value,
- d.spoo_value,
- e.spoo_value,
- f.spoo_value,
- g.spoo_value,
- h.spoo_value,
- i.spoo_value,
- j.spoo_value;
-drop table t1,t2;
diff --git a/mysql-test/t/stat_tables-enospc.test b/mysql-test/t/stat_tables-enospc.test
deleted file mode 100644
index 12e42f6adc0..00000000000
--- a/mysql-test/t/stat_tables-enospc.test
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# MDEV-6181 EITS could eat all tmpdir space and hang
-#
-# test that ANALYZE TABLE is immediately aborted when going out of disk space
---source include/have_debug.inc
-call mtr.add_suppression("No space left on device");
-create table t1 (a varchar(255), b varchar(255), c varchar(255));
---disable_query_log
-let $i=10000;
-while ($i) {
- insert t1 values (repeat(format(rand(),10), 20),
- repeat(format(rand(),10), 20),
- repeat(format(rand(),10), 20));
- dec $i;
-}
---enable_query_log
-set use_stat_tables=PREFERABLY, optimizer_use_condition_selectivity=3;
-set debug_dbug='+d,simulate_file_write_error';
---replace_regex /'.*'/'tmp-file'/
-analyze table t1;
-set debug_dbug='';
-drop table t1;
-
diff --git a/mysql-test/t/stat_tables.test b/mysql-test/t/stat_tables.test
deleted file mode 100644
index 4cbaa9e27c8..00000000000
--- a/mysql-test/t/stat_tables.test
+++ /dev/null
@@ -1,308 +0,0 @@
---source include/have_stat_tables.inc
-
-select @@global.use_stat_tables;
-select @@session.use_stat_tables;
-
-set @save_use_stat_tables=@@use_stat_tables;
-
-set use_stat_tables='preferably';
-
---disable_warnings
-DROP DATABASE IF EXISTS dbt3_s001;
---enable_warnings
-
-CREATE DATABASE dbt3_s001;
-
-use dbt3_s001;
-
-set @save_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='extended_keys=off';
-
---disable_query_log
---disable_result_log
---disable_warnings
---source include/dbt3_s001.inc
-create index i_p_retailprice on part(p_retailprice);
-delete from mysql.table_stats;
-delete from mysql.column_stats;
-delete from mysql.index_stats;
-ANALYZE TABLE
-customer, lineitem, nation, orders, part, partsupp, region, supplier;
-FLUSH TABLE mysql.table_stats, mysql.index_stats;
---enable_warnings
---enable_result_log
---enable_query_log
-
-select * from mysql.table_stats;
-select * from mysql.index_stats;
-
-set optimizer_switch=@save_optimizer_switch;
-
-set @save_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='index_condition_pushdown=off';
-
-let $Q5=
-select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue
-from customer, orders, lineitem, supplier, nation, region
-where c_custkey = o_custkey and l_orderkey = o_orderkey
- and l_suppkey = s_suppkey and c_nationkey = s_nationkey
- and s_nationkey = n_nationkey and n_regionkey = r_regionkey
- and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01'
- and o_orderdate < date '1995-01-01' + interval '1' year
-group by n_name
-order by revenue desc;
-
-eval EXPLAIN $Q5;
-eval $Q5;
-
-set optimizer_switch=@save_optimizer_switch;
-
-delete from mysql.index_stats;
-
---disable_query_log
---disable_result_log
---disable_warnings
-ANALYZE TABLE
-customer, lineitem, nation, orders, part, partsupp, region, supplier;
-FLUSH TABLE mysql.table_stats, mysql.index_stats;
---enable_warnings
---enable_result_log
---enable_query_log
-
-select * from mysql.table_stats;
-select * from mysql.index_stats;
-
-select * from mysql.table_stats where table_name='orders';
-select * from mysql.index_stats where table_name='orders';
-select (select cardinality from mysql.table_stats where table_name='orders') /
- (select avg_frequency from mysql.index_stats
- where index_name='i_o_orderdate' and prefix_arity=1) as n_distinct;
-select count(distinct o_orderdate) from orders;
-select (select cardinality from mysql.table_stats where table_name='orders') /
- (select avg_frequency from mysql.index_stats
- where index_name='i_o_custkey' and prefix_arity=1) as n_distinct;
-select count(distinct o_custkey) from orders;
-show index from orders;
-select index_name, column_name, cardinality from information_schema.statistics
- where table_name='orders';
-
-set @save_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='index_condition_pushdown=off';
-
-eval EXPLAIN $Q5;
-eval $Q5;
-
-set optimizer_switch=@save_optimizer_switch;
-
-let $Q8=
-select o_year,
- sum(case when nation = 'UNITED STATES' then volume else 0 end) /
- sum(volume) as mkt_share
-from (select extract(year from o_orderdate) as o_year,
- l_extendedprice * (1-l_discount) as volume,
- n2.n_name as nation
- from part, supplier, lineitem, orders, customer,
- nation n1, nation n2, region
- where p_partkey = l_partkey and s_suppkey = l_suppkey
- and l_orderkey = o_orderkey and o_custkey = c_custkey
- and c_nationkey = n1.n_nationkey and n1.n_regionkey = r_regionkey
- and r_name = 'AMERICA' and s_nationkey = n2.n_nationkey
- and o_orderdate between date '1995-01-01' and date '1996-12-31'
- and p_type = 'STANDARD BRUSHED STEEL' ) as all_nations
-group by o_year
-order by o_year;
-
-eval EXPLAIN $Q8;
-eval $Q8;
-
-
-let $Q9=
-select nation, o_year, sum(amount) as sum_profit
-from (select n_name as nation,
- extract(year from o_orderdate) as o_year,
- l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity as amount
- from part, supplier, lineitem, partsupp, orders, nation
- where s_suppkey = l_suppkey and ps_suppkey = l_suppkey
- and ps_partkey = l_partkey and p_partkey = l_partkey
- and o_orderkey = l_orderkey and s_nationkey = n_nationkey
- and p_name like '%green%') as profit
-group by nation, o_year
-order by nation, o_year desc;
-
-eval EXPLAIN $Q9;
-eval $Q9;
-
-
-set @save_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='extended_keys=on';
-
-let $QQ1=
-select o_orderkey, p_partkey
- from part, lineitem, orders
- where p_retailprice > 1100 and o_orderdate='1997-01-01'
- and o_orderkey=l_orderkey and p_partkey=l_partkey;
-
-eval EXPLAIN $QQ1;
-eval $QQ1;
-
-set optimizer_switch=@save_optimizer_switch;
-
-
-DROP DATABASE dbt3_s001;
-
-use test;
-
---echo #
---echo # Bug mdev-473: ANALYZE table locked for write
---echo #
-
-set use_stat_tables='complementary';
-
-create table t1 (i int);
-
-lock table t1 write;
-analyze table t1;
-alter table t1 add column a varchar(8);
-
-drop table t1;
-
---echo #
---echo # Bug mdev-487: memory leak in ANALYZE with stat tables
---echo #
-
-SET use_stat_tables = 'preferably';
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1),(2);
-DELETE FROM t1 WHERE a=1;
-
-ANALYZE TABLE t1;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug mdev-518: corrupted/missing statistical tables
---echo #
-
-CREATE TABLE t1 (i int) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(2);
-
-FLUSH TABLE t1;
-SET use_stat_tables='never';
-EXPLAIN SELECT * FROM t1;
-
---move_file $MYSQLTEST_VARDIR/mysqld.1/data/mysql/table_stats.MYD $MYSQLTEST_VARDIR/mysqld.1/data/mysql/table_stats.MYD.save
-
-FLUSH TABLES;
-SET use_stat_tables='preferably';
---disable_warnings
-EXPLAIN SELECT * FROM t1;
---enable_warnings
-
-# Cleanup
---move_file $MYSQLTEST_VARDIR/mysqld.1/data/mysql/table_stats.MYD.save $MYSQLTEST_VARDIR/mysqld.1/data/mysql/table_stats.MYD
-DROP TABLE t1;
-
-set use_stat_tables=@save_use_stat_tables;
-
---echo #
---echo # Bug mdev-5204: invalid impossible where after reading const tables
---echo # when use_stat_tables = 'preferably'
---echo #
-
-set use_stat_tables = 'preferably';
-
-CREATE TABLE t1 (id int PRIMARY KEY) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(2);
-ANALYZE TABLE t1;
-
-CREATE TABLE t2 (name char(3)) ENGINE=MyISAM;
-ANALYZE TABLE t2;
-INSERT INTO t2 VALUES ('USA'),('AUS');
-
-SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE name IN ( 'AUS','YEM' ) AND id = 1;
-EXPLAIN
-SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE name IN ( 'AUS','YEM' ) AND id = 1;
-
-ANALYZE TABLE t2;
-
-SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE name IN ( 'AUS','YEM' ) AND id = 1;
-EXPLAIN
-SELECT * FROM t1 STRAIGHT_JOIN t2 WHERE name IN ( 'AUS','YEM' ) AND id = 1;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-7370: Server deadlocks on renaming a table for which persistent statistics exists
---echo #
-
---disable_warnings
-drop database if exists db1;
-drop database if exists db1;
---enable_warnings
-
-create database db1;
-create database db2;
-use db1;
---echo #
---echo # First, run the original testcase:
---echo #
-create table t1 (i int);
-insert into t1 values (10),(20);
-analyze table t1 persistent for all;
-rename table t1 to db2.t1;
-
---echo # Verify that stats in the old database are gone:
-select * from mysql.column_stats where db_name='db1' and table_name='t1';
-select * from mysql.table_stats where db_name='db1' and table_name='t1';
-
---echo # Verify that stats are present in the new database:
-select * from mysql.column_stats where db_name='db2' and table_name='t1';
-select * from mysql.table_stats where db_name='db2' and table_name='t1';
-
-
---echo #
---echo # Now, try with more than one column and with indexes:
---echo #
-use test;
-create table t1(a int primary key);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-
-use db1;
-create table t2 (a int, b int, c int, key IDX1(a), key IDX2(a,b));
-insert into t2 select a/10, a/2, a from test.t1;
-analyze table t2 persistent for all;
-
-alter table t2 rename db2.t2;
-
---echo # Verify that stats in the old database are gone:
-select * from mysql.table_stats where db_name='db1' and table_name='t2';
-select * from mysql.column_stats where db_name='db1' and table_name='t2';
-select * from mysql.index_stats where db_name='db1' and table_name='t2';
-
---echo # Verify that stats are present in the new database:
-select * from mysql.table_stats where db_name='db2' and table_name='t2';
-select * from mysql.column_stats where db_name='db2' and table_name='t2';
-select * from mysql.index_stats where db_name='db2' and table_name='t2';
-
-use db2;
---echo #
---echo # Now, rename within the same database and verify:
---echo #
-rename table t2 to t3;
---echo # No stats under old name:
-select * from mysql.table_stats where db_name='db2' and table_name='t2';
-select * from mysql.column_stats where db_name='db2' and table_name='t2';
-select * from mysql.index_stats where db_name='db2' and table_name='t2';
---echo # Stats under the new name:
-select * from mysql.table_stats where db_name='db2' and table_name='t3';
-select * from mysql.column_stats where db_name='db2' and table_name='t3';
-select * from mysql.index_stats where db_name='db2' and table_name='t3';
-
-use test;
-drop database db1;
-drop database db2;
-drop table t1;
-
-set use_stat_tables=@save_use_stat_tables;
diff --git a/mysql-test/t/stat_tables_disabled.test b/mysql-test/t/stat_tables_disabled.test
deleted file mode 100644
index c9d923f903b..00000000000
--- a/mysql-test/t/stat_tables_disabled.test
+++ /dev/null
@@ -1,78 +0,0 @@
---source include/have_innodb.inc
-
-SET SESSION STORAGE_ENGINE='InnoDB';
-
-select @@global.use_stat_tables;
-select @@session.use_stat_tables;
-
-set @save_use_stat_tables=@@use_stat_tables;
-
-set use_stat_tables='preferably';
-
---disable_warnings
-DROP DATABASE IF EXISTS dbt3_s001;
---enable_warnings
-
-CREATE DATABASE dbt3_s001;
-
-use dbt3_s001;
-
-set @save_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='extended_keys=off';
-
---disable_query_log
---disable_result_log
---disable_warnings
---source include/dbt3_s001.inc
-delete from mysql.table_stats;
-delete from mysql.column_stats;
-delete from mysql.index_stats;
-ANALYZE TABLE
-customer, lineitem, nation, orders, part, partsupp, region, supplier;
---enable_warnings
---enable_result_log
---enable_query_log
-
---echo #
---echo # Bug mdev-503: optimizer ignores setting use_stat_tables='preferably'
---echo #
-
-flush tables
-customer, lineitem, nation, orders, part, partsupp, region, supplier;
-
-let $Q3S=
-select sql_calc_found_rows straight_join
- l_orderkey, sum(l_extendedprice*(1-l_discount)) as revenue,
- o_orderdate, o_shippriority
-from orders, customer, lineitem
-where c_mktsegment = 'BUILDING' and c_custkey = o_custkey
- and l_orderkey = o_orderkey and o_orderdate < date '1995-03-15'
- and l_shipdate > date '1995-03-15'
-group by l_orderkey, o_orderdate, o_shippriority
-order by revenue desc, o_orderdate
-limit 10;
-
-set use_stat_tables='never';
---replace_column 9 #
-eval EXPLAIN $Q3S;
-
-set use_stat_tables='preferably';
---replace_result 2 1
-eval EXPLAIN $Q3S;
-
-flush tables customer, orders, lineitem;
-eval EXPLAIN $Q3S;
-
---echo # End of the test case for mdev-503
-
-set optimizer_switch=@save_optimizer_switch;
-
-
-DROP DATABASE dbt3_s001;
-
-use test;
-
-set use_stat_tables=@save_use_stat_tables;
-
-
-SET SESSION STORAGE_ENGINE=DEFAULT;
diff --git a/mysql-test/t/stat_tables_innodb.test b/mysql-test/t/stat_tables_innodb.test
deleted file mode 100644
index 04e81de8f9d..00000000000
--- a/mysql-test/t/stat_tables_innodb.test
+++ /dev/null
@@ -1,12 +0,0 @@
---source include/have_innodb.inc
-
-SET SESSION STORAGE_ENGINE='InnoDB';
-
-set @save_optimizer_switch_for_stat_tables_test=@@optimizer_switch;
-set optimizer_switch='extended_keys=on';
-
---source stat_tables.test
-
-set optimizer_switch=@save_optimizer_switch_for_stat_tables_test;
-
-SET SESSION STORAGE_ENGINE=DEFAULT;
diff --git a/mysql-test/t/stat_tables_innodb_debug.test b/mysql-test/t/stat_tables_innodb_debug.test
deleted file mode 100644
index f3652fc2312..00000000000
--- a/mysql-test/t/stat_tables_innodb_debug.test
+++ /dev/null
@@ -1,36 +0,0 @@
---source include/have_innodb.inc
---source include/have_sequence.inc
---source include/have_stat_tables.inc
---source include/have_debug_sync.inc
---source include/not_embedded.inc
-
---echo #
---echo # MDEV-7901: re-implement analyze table for low impact
---echo #
-
-create table t1 (a int, b int, c int, key IDX1(a), key IDX2(a,b)) engine=innodb;
-insert into t1 select seq/10, seq/2, seq from seq_0_to_9;
-
-
-SET DEBUG_SYNC='statistics_collection_start1 SIGNAL analyzing WAIT_FOR written';
-
-send analyze table t1 persistent for all;
-connect (con1, localhost, root,,);
---connection con1
-
-SET DEBUG_SYNC= 'now WAIT_FOR analyzing';
-
-select count(*) from t1;
-# insert will work even with MyISAM because it allow to append file
-insert into t1 values (333,333,333);
-# but update now hang for MyISAM bacause can't get lock (InnoDB/XtraDB works)
-update t1 set a=1;
-
-SET DEBUG_SYNC= 'now SIGNAL written';
-
---connection default
---reap
-select count(*) from t1;
-
-set debug_sync='RESET';
-drop table t1;
diff --git a/mysql-test/t/stat_tables_myisam_debug.test b/mysql-test/t/stat_tables_myisam_debug.test
deleted file mode 100644
index e8ef44325b9..00000000000
--- a/mysql-test/t/stat_tables_myisam_debug.test
+++ /dev/null
@@ -1,33 +0,0 @@
---source include/have_sequence.inc
---source include/have_stat_tables.inc
---source include/have_debug_sync.inc
---source include/not_embedded.inc
-
---echo #
---echo # MDEV-7901: re-implement analyze table for low impact
---echo #
-
-create table t1 (a int, b int, c int, key IDX1(a), key IDX2(a,b)) engine=myisam;
-insert into t1 select seq/10, seq/2, seq from seq_0_to_9;
-
-
-SET DEBUG_SYNC='statistics_collection_start1 SIGNAL analyzing WAIT_FOR written';
-
-send analyze table t1 persistent for all;
-connect (con1, localhost, root,,);
---connection con1
-
-SET DEBUG_SYNC= 'now WAIT_FOR analyzing';
-
-select count(*) from t1;
-# insert will work even with MyISAM because it allow to append file
-insert into t1 values (333,333,333);
-
-SET DEBUG_SYNC= 'now SIGNAL written';
-
---connection default
---reap
-select count(*) from t1;
-
-set debug_sync='RESET';
-drop table t1;
diff --git a/mysql-test/t/stat_tables_par.test b/mysql-test/t/stat_tables_par.test
deleted file mode 100644
index 9d4038911ff..00000000000
--- a/mysql-test/t/stat_tables_par.test
+++ /dev/null
@@ -1,278 +0,0 @@
---source include/have_stat_tables.inc
---source include/have_debug_sync.inc
---source include/not_embedded.inc
-
-set @save_use_stat_tables=@@use_stat_tables;
-
-set use_stat_tables='preferably';
-
---disable_warnings
-DROP DATABASE IF EXISTS dbt3_s001;
---enable_warnings
-
-CREATE DATABASE dbt3_s001;
-
-use dbt3_s001;
-
-set @save_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='extended_keys=off';
-
---disable_query_log
---disable_result_log
---disable_warnings
---source include/dbt3_s001.inc
-delete from mysql.table_stats;
-delete from mysql.column_stats;
-delete from mysql.index_stats;
-ANALYZE TABLE
-customer, lineitem, nation, orders, part, partsupp, region, supplier;
---enable_warnings
---enable_result_log
---enable_query_log
-
-select * from mysql.table_stats;
-select * from mysql.index_stats;
-
-
-#
-# Test for parallel memory allocation for statistical data
-#
-# assumes that start the code of memory allocation for stats data has this line:
-#
-# DEBUG_SYNC(thd, "statistics_mem_alloc_start1");
-# DEBUG_SYNC(thd, "statistics_mem_alloc_start2");
-#
-
-let $Q6=
-select round(sum(l_extendedprice*l_discount),4) as revenue
-from lineitem
-where l_shipdate >= date '1994-01-01'
- and l_shipdate < date '1994-01-01' + interval '1' year
- and l_discount between 0.06 - 0.01 and 0.06 + 0.01
- and l_quantity < 24;
-
-flush table lineitem;
-set use_stat_tables='never';
-eval $Q6;
-
-connect (con1, localhost, root,,);
-connect (con2, localhost, root,,);
-
-connection con1;
-set debug_sync='statistics_mem_alloc_start1 WAIT_FOR second_thread_started_too';
-set debug_sync='statistics_mem_alloc_start2 SIGNAL first_thread_working';
-use dbt3_s001;
-set use_stat_tables='preferably';
---send_eval $Q6
-
-connection con2;
-set debug_sync='statistics_mem_alloc_start1 SIGNAL second_thread_started_too';
-set debug_sync='statistics_mem_alloc_start2 WAIT_FOR first_thread_working';
-use dbt3_s001;
-set use_stat_tables='preferably';
---send_eval $Q6
-
-connection con1;
---reap
-
-connection con2;
---reap
-
-connection default;
-set use_stat_tables='preferably';
-disconnect con1;
-disconnect con2;
-set debug_sync='RESET';
-
-#
-# Test for parallel statistics collection
-#
-# assumes that start of stats collection code has this line:
-#
-# DEBUG_SYNC(thd, "statistics_collection_start1");
-# DEBUG_SYNC(thd, "statistics_collection_start2");
-#
-
-select * from mysql.index_stats where table_name='lineitem' order by index_name;
-delete from mysql.index_stats
- where table_name='lineitem' and
- index_name in ('i_l_shipdate', 'i_l_receiptdate');
-select * from mysql.index_stats where table_name='lineitem' order by index_name;
---disable_result_log
---disable_warnings
-analyze table lineitem persistent for columns() indexes (i_l_shipdate);
---enable_warnings
---enable_result_log
-select * from mysql.index_stats where table_name='lineitem' order by index_name;
-delete from mysql.index_stats
- where table_name='lineitem' and index_name= 'i_l_shipdate';
-select * from mysql.index_stats where table_name='lineitem' order by index_name;
-
-connect (con1, localhost, root,,);
-connect (con2, localhost, root,,);
-
-connection con1;
-set debug_sync='statistics_collection_start1 WAIT_FOR second_thread_started_too';
-set debug_sync='statistics_collection_start2 SIGNAL first_thread_working';
-use dbt3_s001;
-set use_stat_tables='preferably';
---send analyze table lineitem persistent for columns() indexes (i_l_shipdate)
-
-connection con2;
-set debug_sync='statistics_collection_start1 SIGNAL second_thread_started_too';
-set debug_sync='statistics_collection_start2 WAIT_FOR first_thread_working';
-use dbt3_s001;
-set use_stat_tables='preferably';
---send analyze table lineitem persistent for columns() indexes (i_l_receiptdate)
-
-connection con1;
---disable_result_log
---disable_warnings
---reap
---enable_warnings
---enable_result_log
-
-connection con2;
---disable_result_log
---disable_warnings
---reap
---enable_warnings
---enable_result_log
-
-connection default;
-disconnect con1;
-disconnect con2;
-set debug_sync='RESET';
-
-select * from mysql.index_stats where table_name='lineitem' order by index_name, prefix_arity;
-
-#
-# Test for parallel statistics collection and update (innodb)
-#
-
-select * from mysql.index_stats where table_name='lineitem'
- order by index_name, prefix_arity;
-set debug_sync='RESET';
-
-let $innodb_storage_engine= 0;
-if (`SELECT UPPER(@@storage_engine) = 'INNODB'`)
-{
- let $innodb_storage_engine= 1;
-}
-
-connect (con1, localhost, root,,);
-connect (con2, localhost, root,,);
-
-connection con1;
-set debug_sync='statistics_collection_start SIGNAL parked WAIT_FOR finish';
-use dbt3_s001;
-set use_stat_tables='preferably';
---send analyze table lineitem persistent for all
-
-connection con2;
-set debug_sync='now WAIT_FOR parked';
-use dbt3_s001;
-set use_stat_tables='never';
-if ($innodb_storage_engine)
-{
- select * from lineitem where l_orderkey=1 and l_partkey=156;
- delete from lineitem where l_orderkey=1 and l_partkey=156;
- select * from lineitem where l_orderkey=1 and l_partkey=156;
-}
-set debug_sync='now SIGNAL finish';
-
-connection con1;
---disable_result_log
---disable_warnings
---reap
---enable_warnings
---enable_result_log
-
-connection default;
-disconnect con1;
-disconnect con2;
-set debug_sync='RESET';
-
-select * from mysql.index_stats where table_name='lineitem'
- order by index_name, prefix_arity;
-
-#
-# Bug mdev-3891: deadlock for ANALYZE and SELECT over mysql.index_stats
-#
-
-set @save_global_use_stat_tables=@@global.use_stat_tables;
-set global use_stat_tables='preferably';
-set debug_sync='RESET';
-
-connect (con1, localhost, root,,);
-connect (con2, localhost, root,,);
-
-connection con1;
-set debug_sync='statistics_update_start SIGNAL parker WAIT_FOR go1 EXECUTE 1';
-set debug_sync='thr_multi_lock_before_thr_lock SIGNAL go2 EXECUTE 3';
-use dbt3_s001;
---send analyze table lineitem persistent for all
-
-connection con2;
-set debug_sync='open_and_process_table WAIT_FOR parker';
-set debug_sync='statistics_read_start SIGNAL go1 WAIT_FOR go2';
-use dbt3_s001;
---send select * from mysql.index_stats, lineitem where index_name= 'i_l_shipdate' and l_orderkey=1 and l_partkey=68 order by prefix_arity;
-
-connection con1;
---disable_result_log
---disable_warnings
---reap
---enable_warnings
---enable_result_log
-
-connection con2;
---disable_warnings
---reap
---enable_warnings
-
-connection default;
-disconnect con1;
-disconnect con2;
-set debug_sync='RESET';
-
-set global use_stat_tables=@save_global_use_stat_tables;
-
-DROP DATABASE dbt3_s001;
-
-use test;
-
-#
-# Bug mdev-4019: crash when executing in parallel ANALYZE and
-# SELECT * FROM information_schema.statistics
-#
-
-set @save_global_use_stat_tables=@@global.use_stat_tables;
-set global use_stat_tables='preferably';
-set debug_sync='RESET';
-
-create table t1 (a int, b int, key(a));
-insert t1 values (1,1),(2,2);
-
-analyze table t1;
-
-SET debug_sync='after_open_table_ignore_flush WAIT_FOR go';
-send select * from information_schema.statistics where table_schema='test';
-
-connect(con1, localhost, root);
-connection con1;
-select * from t1;
-SET DEBUG_SYNC= "now SIGNAL go";
-
-connection default;
-reap;
-
-connection default;
-disconnect con1;
-set debug_sync='RESET';
-
-drop table t1;
-set global use_stat_tables=@save_global_use_stat_tables;
-
-
-set use_stat_tables=@save_use_stat_tables;
diff --git a/mysql-test/t/stat_tables_par_innodb.test b/mysql-test/t/stat_tables_par_innodb.test
deleted file mode 100644
index fd5833e4aaf..00000000000
--- a/mysql-test/t/stat_tables_par_innodb.test
+++ /dev/null
@@ -1,12 +0,0 @@
---source include/have_innodb.inc
-
-SET SESSION STORAGE_ENGINE='InnoDB';
-
-set @save_optimizer_switch_for_stat_tables_test=@@optimizer_switch;
-set optimizer_switch='extended_keys=on';
-
---source stat_tables_par.test
-
-set optimizer_switch=@save_optimizer_switch_for_stat_tables_test;
-
-SET SESSION STORAGE_ENGINE=DEFAULT;
diff --git a/mysql-test/t/stat_tables_partition.test b/mysql-test/t/stat_tables_partition.test
deleted file mode 100644
index 1316e5cca11..00000000000
--- a/mysql-test/t/stat_tables_partition.test
+++ /dev/null
@@ -1,17 +0,0 @@
---source include/have_partition.inc
-
---echo #
---echo # Bug mdev-3866: valgrind complain from ANALYZE on a table with BIT field
---echo #
-
-SET use_stat_tables = 'preferably';
-
-CREATE TABLE t1 (pk int PRIMARY KEY, a bit(1), INDEX idx(a)
-) ENGINE=MyISAM PARTITION BY KEY(pk) PARTITIONS 2;
-INSERT INTO t1 VALUES (1,1),(2,0),(3,0),(4,1);
-
-ANALYZE TABLE t1;
-
-SET use_stat_tables = DEFAULT;
-
-DROP TABLE t1;
diff --git a/mysql-test/t/stat_tables_rbr.test b/mysql-test/t/stat_tables_rbr.test
deleted file mode 100644
index 29f7c4e6622..00000000000
--- a/mysql-test/t/stat_tables_rbr.test
+++ /dev/null
@@ -1,30 +0,0 @@
---source include/have_binlog_format_row.inc
---source include/have_innodb.inc
---source include/have_partition.inc
-
---echo #
---echo # Bug mdev-463: assertion failure when running ANALYZE with RBR on
---echo #
-
-SET GLOBAL use_stat_tables = PREFERABLY;
-
---connect (con1,localhost,root,,)
-CREATE TABLE t1 (i INT) ENGINE=InnoDB;
-ANALYZE TABLE t1;
-
-# Cleanup
-DROP TABLE t1;
-SET GLOBAL use_stat_tables = DEFAULT;
---disconnect con1
-
---connection default
-
-SET use_stat_tables = PREFERABLY;
-
-CREATE TABLE t1 ( a INT ) ENGINE=MyISAM PARTITION BY HASH(a) PARTITIONS 2;
-ALTER TABLE t1 ANALYZE PARTITION p1;
-source include/show_binlog_events.inc;
-
-SET use_stat_tables = DEFAULT;
-
-DROP TABLE t1;
diff --git a/mysql-test/t/stat_tables_repl.test b/mysql-test/t/stat_tables_repl.test
deleted file mode 100644
index ac24c9dcbd7..00000000000
--- a/mysql-test/t/stat_tables_repl.test
+++ /dev/null
@@ -1,58 +0,0 @@
---source include/have_stat_tables.inc
---source include/have_binlog_format_row.inc
---source include/master-slave.inc
-
---echo #
---echo # Bug mdev-485: unexpected failure with replication of DROP/ALTER table
---echo # when RBR is on
---echo #
-
-CREATE TABLE t1 ( a int, b int ) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (2,20), (1,20), (3,30);
-ANALYZE TABLE t1;
-DROP TABLE t1;
-
---sync_slave_with_master
---connection master
-
-CREATE TABLE t1 ( a int, b int, INDEX idx1(b) ) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (2,20), (1,20), (3,30);
-ANALYZE TABLE t1;
-DROP INDEX idx1 ON t1;
-
---sync_slave_with_master
---connection master
-
-DROP TABLE t1;
-
-CREATE TABLE t1 ( a int, b int, INDEX idx1(b) ) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (2,20), (1,20), (3,30);
-ANALYZE TABLE t1;
-ALTER TABLE t1 DROP COLUMN b;
-
---sync_slave_with_master
---connection master
-
-DROP TABLE t1;
-
-CREATE TABLE t1 ( a int, b int, INDEX idx1(b) ) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (2,20), (1,20), (3,30);
-ANALYZE TABLE t1;
-ALTER TABLE t1 RENAME to s;
-
---sync_slave_with_master
---connection master
-
-DROP TABLE s;
-
-CREATE TABLE t1 ( a int, b int, INDEX idx1(b) ) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (2,20), (1,20), (3,30);
-ANALYZE TABLE t1;
-ALTER TABLE t1 CHANGE COLUMN b c int ;
-
---sync_slave_with_master
---connection master
-
-DROP TABLE t1;
-
---source include/rpl_end.inc
diff --git a/mysql-test/t/statistics.test b/mysql-test/t/statistics.test
deleted file mode 100644
index e9ecb56a1cb..00000000000
--- a/mysql-test/t/statistics.test
+++ /dev/null
@@ -1,855 +0,0 @@
---source include/have_stat_tables.inc
---source include/have_innodb.inc
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-set @save_use_stat_tables=@@use_stat_tables;
-
-DELETE FROM mysql.table_stats;
---sorted_result
-DELETE FROM mysql.column_stats;
---sorted_result
-DELETE FROM mysql.index_stats;
-
-set use_stat_tables='preferably';
-
-CREATE TABLE t1 (
- a int NOT NULL PRIMARY KEY,
- b varchar(32),
- c char(16),
- d date,
- e double,
- f bit(3),
- INDEX idx1 (b, e),
- INDEX idx2 (c, d),
- INDEX idx3 (d),
- INDEX idx4 (e, b, d)
-) ENGINE= MYISAM;
-
-INSERT INTO t1 VALUES
- (0, NULL, NULL, NULL, NULL, NULL),
- (7, 'xxxxxxxxxxxxxxxxxxxxxxxxxx', 'dddddddd', '1990-05-15', 0.1, b'100'),
- (17, 'vvvvvvvvvvvvv', 'aaaa', '1989-03-12', 0.01, b'101'),
- (1, 'vvvvvvvvvvvvv', NULL, '1989-03-12', 0.01, b'100'),
- (12, 'wwwwwwwwwwwwwwwwwwwwwwwwwwww', 'dddddddd', '1999-07-23', 0.112, b'001'),
- (23, 'vvvvvvvvvvvvv', 'dddddddd', '1999-07-23', 0.1, b'100'),
- (8, 'vvvvvvvvvvvvv', 'aaaa', '1999-07-23', 0.1, b'100'),
- (22, 'xxxxxxxxxxxxxxxxxxxxxxxxxx', 'aaaa', '1989-03-12', 0.112, b'001'),
- (31, 'wwwwwwwwwwwwwwwwwwwwwwwwwwww', 'aaaa', '1999-07-23', 0.01, b'001'),
- (10, NULL, 'aaaa', NULL, 0.01, b'010'),
- (5, 'wwwwwwwwwwwwwwwwwwwwwwwwwwww', 'dddddddd', '1999-07-23', 0.1, b'100'),
- (15, 'vvvvvvvvvvvvv', 'ccccccccc', '1990-05-15', 0.1, b'010'),
- (30, NULL, 'bbbbbb', NULL, NULL, b'100'),
- (38, 'zzzzzzzzzzzzzzzzzz', 'bbbbbb', NULL, NULL, NULL),
- (18, 'zzzzzzzzzzzzzzzzzz', 'ccccccccc', '1990-05-15', 0.01, b'010'),
- (9, 'yyy', 'bbbbbb', '1998-08-28', 0.01, NULL),
- (29, 'vvvvvvvvvvvvv', 'dddddddd', '1999-07-23', 0.012, b'010'),
- (3, 'yyy', 'dddddddd', '1990-05-15', 0.112, b'010'),
- (39, 'zzzzzzzzzzzzzzzzzz', 'bbbbbb', NULL, 0.01, b'100'),
- (14, 'xxxxxxxxxxxxxxxxxxxxxxxxxx', 'ccccccccc', '1990-05-15', 0.1, b'100'),
- (40, 'zzzzzzzzzzzzzzzzzz', 'bbbbbb', '1989-03-12', NULL, NULL),
- (44, NULL, 'aaaa', '1989-03-12', NULL, b'010'),
- (19, 'vvvvvvvvvvvvv', 'ccccccccc', '1990-05-15', 0.012, b'011'),
- (21, 'zzzzzzzzzzzzzzzzzz', 'dddddddd', '1989-03-12', 0.112, b'100'),
- (45, NULL, NULL, '1989-03-12', NULL, b'011'),
- (2, 'wwwwwwwwwwwwwwwwwwwwwwwwwwww', 'ccccccccc', '1990-05-15', 0.1, b'001'),
- (35, 'yyy', 'aaaa', '1990-05-15', 0.05, b'011'),
- (4, 'vvvvvvvvvvvvv', 'dddddddd', '1999-07-23', 0.01, b'101'),
- (47, NULL, 'aaaa', '1990-05-15', 0.05, b'010'),
- (42, NULL, 'ccccccccc', '1989-03-12', 0.01, b'010'),
- (32, NULL, 'bbbbbb', '1990-05-15', 0.01, b'011'),
- (49, 'wwwwwwwwwwwwwwwwwwwwwwwwwwww' , 'aaaa', '1990-05-15', NULL, NULL),
- (43, 'wwwwwwwwwwwwwwwwwwwwwwwwwwww' , 'bbbbbb', '1990-05-15', NULL, b'100'),
- (37, 'yyy', NULL, '1989-03-12', 0.05, b'011'),
- (41, 'xxxxxxxxxxxxxxxxxxxxxxxxxx', 'ccccccccc', '1990-05-15', 0.05, NULL),
- (34, 'yyy', NULL, NULL, NULL, NULL),
- (33, 'zzzzzzzzzzzzzzzzzz', 'dddddddd', '1989-03-12', 0.05, b'011'),
- (24, 'wwwwwwwwwwwwwwwwwwwwwwwwwwww', 'dddddddd', '1990-05-15', 0.01, b'101'),
- (11, 'yyy', 'ccccccccc', '1999-07-23', 0.1, NULL),
- (25, 'zzzzzzzzzzzzzzzzzz', 'bbb', '1989-03-12', 0.01, b'101');
-
-ANALYZE TABLE t1;
-
-SELECT * FROM mysql.table_stats;
-SELECT * FROM mysql.column_stats;
-SELECT * FROM mysql.index_stats;
-
-SELECT COUNT(*) FROM t1;
-
-SELECT * FROM mysql.column_stats
- WHERE db_name='test' AND table_name='t1' AND column_name='a';
-SELECT MIN(t1.a), MAX(t1.a),
- (SELECT COUNT(*) FROM t1 WHERE t1.b IS NULL) /
- (SELECT COUNT(*) FROM t1) AS "NULLS_RATIO(t1.a)",
- (SELECT COUNT(t1.a) FROM t1) /
- (SELECT COUNT(DISTINCT t1.a) FROM t1) AS "AVG_FREQUENCY(t1.a)"
-FROM t1;
-
-SELECT * FROM mysql.column_stats
- WHERE db_name='test' AND table_name='t1' AND column_name='b';
-SELECT MIN(t1.b), MAX(t1.b),
- (SELECT COUNT(*) FROM t1 WHERE t1.b IS NULL) /
- (SELECT COUNT(*) FROM t1) AS "NULLS_RATIO(t1.b)",
- (SELECT COUNT(t1.b) FROM t1) /
- (SELECT COUNT(DISTINCT t1.b) FROM t1) AS "AVG_FREQUENCY(t1.b)"
-FROM t1;
-
-SELECT * FROM mysql.column_stats
- WHERE db_name='test' AND table_name='t1' AND column_name='c';
-SELECT MIN(t1.c), MAX(t1.c),
- (SELECT COUNT(*) FROM t1 WHERE t1.c IS NULL) /
- (SELECT COUNT(*) FROM t1) AS "NULLS_RATIO(t1.c)",
- (SELECT COUNT(t1.c) FROM t1) /
- (SELECT COUNT(DISTINCT t1.c) FROM t1) AS "AVG_FREQUENCY(t1.c)"
-FROM t1;
-
-SELECT * FROM mysql.column_stats
- WHERE db_name='test' AND table_name='t1' AND column_name='d';
-SELECT MIN(t1.d), MAX(t1.d),
- (SELECT COUNT(*) FROM t1 WHERE t1.d IS NULL) /
- (SELECT COUNT(*) FROM t1) AS "NULLS_RATIO(t1.d)",
- (SELECT COUNT(t1.d) FROM t1) /
- (SELECT COUNT(DISTINCT t1.d) FROM t1) AS "AVG_FREQUENCY(t1.d)"
-FROM t1;
-
-SELECT * FROM mysql.column_stats
- WHERE db_name='test' AND table_name='t1' AND column_name='e';
-SELECT MIN(t1.e), MAX(t1.e),
- (SELECT COUNT(*) FROM t1 WHERE t1.e IS NULL) /
- (SELECT COUNT(*) FROM t1) AS "NULLS_RATIO(t1.e)",
- (SELECT COUNT(t1.e) FROM t1) /
- (SELECT COUNT(DISTINCT t1.e) FROM t1) AS "AVG_FREQUENCY(t1.e)"
-FROM t1;
-
-SELECT * FROM mysql.index_stats
- WHERE db_name='test' AND table_name='t1' AND index_name='idx1';
-SELECT
- (SELECT COUNT(*) FROM t1 WHERE t1.b IS NOT NULL) /
- (SELECT COUNT(DISTINCT t1.b) FROM t1 WHERE t1.b IS NOT NULL)
- AS 'ARITY 1',
- (SELECT COUNT(*) FROM t1 WHERE t1.b IS NOT NULL AND t1.e IS NOT NULL) /
- (SELECT COUNT(DISTINCT t1.b, t1.e) FROM t1
- WHERE t1.b IS NOT NULL AND t1.e IS NOT NULL)
- AS 'ARITY 2';
-
-SELECT * FROM mysql.index_stats
- WHERE db_name='test' AND table_name='t1' AND index_name='idx2';
-SELECT
- (SELECT COUNT(*) FROM t1 WHERE t1.c IS NOT NULL) /
- (SELECT COUNT(DISTINCT t1.c) FROM t1 WHERE t1.c IS NOT NULL)
- AS 'ARITY 1',
- (SELECT COUNT(*) FROM t1 WHERE t1.c IS NOT NULL AND t1.d IS NOT NULL) /
- (SELECT COUNT(DISTINCT t1.c, t1.d) FROM t1
- WHERE t1.c IS NOT NULL AND t1.d IS NOT NULL)
- AS 'ARITY 2';
-
-SELECT * FROM mysql.index_stats
- WHERE db_name='test' AND table_name='t1' AND index_name='idx3';
-SELECT
- (SELECT COUNT(*) FROM t1 WHERE t1.d IS NOT NULL) /
- (SELECT COUNT(DISTINCT t1.d) FROM t1 WHERE t1.d IS NOT NULL)
- AS 'ARITY 1';
-
-SELECT * FROM mysql.index_stats
- WHERE db_name='test' AND table_name='t1' AND index_name='idx4';
-SELECT
- (SELECT COUNT(*) FROM t1 WHERE t1.e IS NOT NULL) /
- (SELECT COUNT(DISTINCT t1.e) FROM t1 WHERE t1.e IS NOT NULL)
- AS 'ARITY 1',
- (SELECT COUNT(*) FROM t1 WHERE t1.e IS NOT NULL AND t1.b IS NOT NULL) /
- (SELECT COUNT(DISTINCT t1.e, t1.b) FROM t1
- WHERE t1.e IS NOT NULL AND t1.b IS NOT NULL)
- AS 'ARITY 2',
- (SELECT COUNT(*) FROM t1
- WHERE t1.e IS NOT NULL AND t1.b IS NOT NULL AND t1.d IS NOT NULL) /
- (SELECT COUNT(DISTINCT t1.e, t1.b, t1.d) FROM t1
- WHERE t1.e IS NOT NULL AND t1.b IS NOT NULL AND t1.d IS NOT NULL)
- AS 'ARITY 3';
-
-
-DELETE FROM mysql.column_stats;
-
-set histogram_size=4;
-ANALYZE TABLE t1;
-
---sorted_result
-SELECT db_name, table_name, column_name,
- min_value, max_value,
- nulls_ratio, avg_frequency,
- hist_size, hist_type, HEX(histogram)
- FROM mysql.column_stats;
-
-DELETE FROM mysql.column_stats;
-
-set histogram_size=8;
-set histogram_type='DOUBLE_PREC_HB';
-ANALYZE TABLE t1;
-
---sorted_result
-SELECT db_name, table_name, column_name,
- min_value, max_value,
- nulls_ratio, avg_frequency,
- hist_size, hist_type, HEX(histogram)
- FROM mysql.column_stats;
-
-DELETE FROM mysql.column_stats;
-
-set histogram_size= 0;
-set histogram_type=default;
-ANALYZE TABLE t1;
-
-
-CREATE TABLE t3 (
- a int NOT NULL PRIMARY KEY,
- b varchar(32),
- c char(16),
- INDEX idx (c)
-) ENGINE=MYISAM;
-
-INSERT INTO t3 VALUES
- (0, NULL, NULL),
- (7, 'xxxxxxxxxxxxxxxxxxxxxxxxxx', 'dddddddd'),
- (17, 'vvvvvvvvvvvvv', 'aaaa'),
- (1, 'vvvvvvvvvvvvv', NULL),
- (12, 'wwwwwwwwwwwwwwwwwwwwwwwwwwww', 'dddddddd'),
- (23, 'vvvvvvvvvvvvv', 'dddddddd'),
- (8, 'vvvvvvvvvvvvv', 'aaaa'),
- (22, 'xxxxxxxxxxxxxxxxxxxxxxxxxx', 'aaaa'),
- (31, 'wwwwwwwwwwwwwwwwwwwwwwwwwwww', 'aaaa'),
- (10, NULL, 'aaaa'),
- (5, 'wwwwwwwwwwwwwwwwwwwwwwwwwwww', 'dddddddd'),
- (15, 'vvvvvvvvvvvvv', 'ccccccccc'),
- (30, NULL, 'bbbbbb'),
- (38, 'zzzzzzzzzzzzzzzzzz', 'bbbbbb'),
- (18, 'zzzzzzzzzzzzzzzzzz', 'ccccccccc'),
- (9, 'yyy', 'bbbbbb'),
- (29, 'vvvvvvvvvvvvv', 'dddddddd');
-
-ANALYZE TABLE t3;
-
---sorted_result
-SELECT * FROM mysql.table_stats;
---sorted_result
-SELECT * FROM mysql.column_stats;
---sorted_result
-SELECT * FROM mysql.index_stats;
-
-ALTER TABLE t1 RENAME TO s1;
---sorted_result
-SELECT * FROM mysql.table_stats;
---sorted_result
-SELECT * FROM mysql.column_stats;
---sorted_result
-SELECT * FROM mysql.index_stats;
-
-RENAME TABLE s1 TO t1;
---sorted_result
-SELECT * FROM mysql.table_stats;
---sorted_result
-SELECT * FROM mysql.column_stats;
---sorted_result
-SELECT * FROM mysql.index_stats;
-
-DROP TABLE t3;
-SELECT * FROM mysql.table_stats;
---sorted_result
-SELECT * FROM mysql.column_stats;
---sorted_result
-SELECT * FROM mysql.index_stats;
-
-
-CREATE TEMPORARY TABLE t0 (
- a int NOT NULL PRIMARY KEY,
- b varchar(32)
-);
-INSERT INTO t0 SELECT a,b FROM t1;
-
-ALTER TABLE t1 CHANGE COLUMN b x varchar(32),
- CHANGE COLUMN e y double;
-SHOW CREATE TABLE t1;
---sorted_result
-SELECT * FROM mysql.column_stats;
-
-ALTER TABLE t1 CHANGE COLUMN x b varchar(32),
- CHANGE COLUMN y e double;
-SHOW CREATE TABLE t1;
---sorted_result
-SELECT * FROM mysql.column_stats;
-
-ALTER TABLE t1 RENAME TO s1, CHANGE COLUMN b x varchar(32);
-SHOW CREATE TABLE s1;
-SELECT * FROM mysql.table_stats;
---sorted_result
-SELECT * FROM mysql.column_stats;
---sorted_result
-SELECT * FROM mysql.index_stats;
-
-ALTER TABLE s1 RENAME TO t1, CHANGE COLUMN x b varchar(32);
-SHOW CREATE TABLE t1;
-SELECT * FROM mysql.table_stats;
---sorted_result
-SELECT * FROM mysql.column_stats;
---sorted_result
-SELECT * FROM mysql.index_stats;
-
-ALTER TABLE t1 CHANGE COLUMN b x varchar(30);
-SHOW CREATE TABLE t1;
---sorted_result
-SELECT * FROM mysql.column_stats;
---sorted_result
-SELECT * FROM mysql.index_stats;
-
-ALTER TABLE t1 CHANGE COLUMN x b varchar(32);
-SHOW CREATE TABLE t1;
---sorted_result
-SELECT * FROM mysql.column_stats;
---sorted_result
-SELECT * FROM mysql.index_stats;
-
-ANALYZE TABLE t1 PERSISTENT FOR COLUMNS(b) INDEXES(idx1, idx4);
---sorted_result
-SELECT * FROM mysql.column_stats;
---sorted_result
-SELECT * FROM mysql.index_stats;
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval
-SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/save_column_stats'
- FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n'
- FROM mysql.column_stats WHERE column_name='b';
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval
-SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/save_index_stats'
- FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n'
- FROM mysql.index_stats WHERE index_name IN ('idx1', 'idx4');
-
-ALTER TABLE t1 CHANGE COLUMN b x varchar(30);
-SHOW CREATE TABLE t1;
---sorted_result
-SELECT * FROM mysql.column_stats;
---sorted_result
-SELECT * FROM mysql.index_stats;
-
-ALTER TABLE t1 CHANGE COLUMN x b varchar(32);
-SHOW CREATE TABLE t1;
---sorted_result
-SELECT * FROM mysql.column_stats;
---sorted_result
-SELECT * FROM mysql.index_stats;
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval
-LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/save_column_stats'
- INTO TABLE mysql.column_stats
- FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n';
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval
-LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/save_index_stats'
- INTO TABLE mysql.index_stats
- FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n';
---sorted_result
-SELECT * FROM mysql.column_stats;
---sorted_result
-SELECT * FROM mysql.index_stats;
-remove_file $MYSQLTEST_VARDIR/tmp/save_column_stats;
-remove_file $MYSQLTEST_VARDIR/tmp/save_index_stats;
-
-
-ALTER TABLE t1 DROP COLUMN b;
-SHOW CREATE TABLE t1;
---sorted_result
-SELECT * FROM mysql.column_stats;
---sorted_result
-SELECT * FROM mysql.index_stats;
-
-DROP INDEX idx2 ON t1;
-SHOW CREATE TABLE t1;
---sorted_result
-SELECT * FROM mysql.index_stats;
-
-DROP INDEX idx1 ON t1;
-DROP INDEX idx4 ON t1;
-SHOW CREATE TABLE t1;
-
-ALTER TABLE t1 ADD COLUMN b varchar(32);
-CREATE INDEX idx1 ON t1(b, e);
-CREATE INDEX idx2 ON t1(c, d);
-CREATE INDEX idx4 ON t1(e, b, d);
-SHOW CREATE TABLE t1;
---sorted_result
-SELECT * FROM mysql.column_stats;
---sorted_result
-SELECT * FROM mysql.index_stats;
-
-ANALYZE TABLE t1 PERSISTENT FOR COLUMNS(b) INDEXES(idx1, idx2, idx4);
---sorted_result
-SELECT * FROM mysql.column_stats;
---sorted_result
-SELECT * FROM mysql.index_stats;
-
-UPDATE t1 SET b=(SELECT b FROM t0 WHERE t0.a= t1.a);
-ANALYZE TABLE t1 PERSISTENT FOR COLUMNS(b) INDEXES(idx1, idx2, idx4);
---sorted_result
-SELECT * FROM mysql.column_stats;
---sorted_result
-SELECT * FROM mysql.index_stats;
-
-ALTER TABLE t1 DROP COLUMN b,
- DROP INDEX idx1, DROP INDEX idx2, DROP INDEX idx4;
-SHOW CREATE TABLE t1;
---sorted_result
-SELECT * FROM mysql.column_stats;
---sorted_result
-SELECT * FROM mysql.index_stats;
-
-ALTER TABLE t1 ADD COLUMN b varchar(32);
-ALTER TABLE t1
- ADD INDEX idx1 (b, e), ADD INDEX idx2 (c, d), ADD INDEX idx4 (e, b, d);
-UPDATE t1 SET b=(SELECT b FROM t0 WHERE t0.a= t1.a);
-SHOW CREATE TABLE t1;
---sorted_result
-SELECT * FROM mysql.column_stats;
---sorted_result
-SELECT * FROM mysql.index_stats;
-ANALYZE TABLE t1 PERSISTENT FOR COLUMNS(b) INDEXES(idx1, idx2, idx4);
---sorted_result
-SELECT * FROM mysql.column_stats;
---sorted_result
-SELECT * FROM mysql.index_stats;
-
-DELETE FROM mysql.table_stats;
-DELETE FROM mysql.column_stats;
-DELETE FROM mysql.index_stats;
-
-ANALYZE TABLE t1 PERSISTENT FOR COLUMNS() INDEXES();
-SELECT * FROM mysql.table_stats;
-SELECT * FROM mysql.column_stats;
-SELECT * FROM mysql.index_stats;
-
-ANALYZE TABLE t1 PERSISTENT FOR COLUMNS(c,e,b) INDEXES(idx2,idx4);
-SELECT * FROM mysql.table_stats;
---sorted_result
-SELECT * FROM mysql.column_stats;
---sorted_result
-SELECT * FROM mysql.index_stats;
-
-DELETE FROM mysql.index_stats WHERE table_name='t1' AND index_name='primary';
---sorted_result
-SELECT * FROM mysql.index_stats;
-ANALYZE TABLE t1 PERSISTENT FOR COLUMNS() INDEXES(primary);
---sorted_result
-SELECT * FROM mysql.index_stats;
-
-DELETE FROM mysql.table_stats;
-DELETE FROM mysql.column_stats;
-DELETE FROM mysql.index_stats;
-
-ANALYZE TABLE t1 PERSISTENT FOR COLUMNS ALL INDEXES ALL;
-
-SELECT * FROM mysql.table_stats;
---sorted_result
-SELECT * FROM mysql.column_stats;
---sorted_result
-SELECT * FROM mysql.index_stats;
-
-CREATE TABLE t2 LIKE t1;
-ALTER TABLE t2 ENGINE=InnoDB;
-INSERT INTO t2 SELECT * FROM t1;
-
-set optimizer_switch='extended_keys=off';
-
-ANALYZE TABLE t2;
-
---sorted_result
-SELECT * FROM mysql.table_stats;
-SELECT * FROM mysql.column_stats ORDER BY column_name, table_name;
-SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
-
-DELETE FROM mysql.table_stats;
-DELETE FROM mysql.column_stats;
-DELETE FROM mysql.index_stats;
-
-set optimizer_switch='extended_keys=on';
-
-ANALYZE TABLE t2;
-
-SELECT * FROM mysql.table_stats;
-SELECT * FROM mysql.column_stats ORDER BY column_name;
-SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
-
-ALTER TABLE t2 DROP PRIMARY KEY, DROP INDEX idx1;
-SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
-
-UPDATE t2 SET b=0 WHERE b IS NULL;
-ALTER TABLE t2 ADD PRIMARY KEY (a,b);
-SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
-
-ANALYZE TABLE t2 PERSISTENT FOR COLUMNS() INDEXES ALL;
-SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
-
-ALTER TABLE t2 CHANGE COLUMN b b varchar(30);
-SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
-
-ANALYZE TABLE t2 PERSISTENT FOR COLUMNS ALL INDEXES ALL;
-SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
-
-ALTER TABLE t2 CHANGE COLUMN b b varchar(32);
-SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
-
-ANALYZE TABLE t2 PERSISTENT FOR COLUMNS ALL INDEXES ALL;
-SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
-
-ALTER TABLE t2 DROP COLUMN b, DROP PRIMARY KEY, ADD PRIMARY KEY(a);
-SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
-
-ANALYZE TABLE t2 PERSISTENT FOR COLUMNS() INDEXES ALL;
-SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name;
-
-set optimizer_switch='extended_keys=off';
-
-ALTER TABLE t1
- DROP INDEX idx1,
- DROP INDEX idx4;
-ALTER TABLE t1
- MODIFY COLUMN b text,
- ADD INDEX idx1 (b(4), e),
- ADD INDEX idx4 (e, b(4), d);
-
---sorted_result
-SELECT * FROM mysql.column_stats;
---sorted_result
-SELECT * FROM mysql.index_stats;
-
-ANALYZE TABLE t1;
-
---sorted_result
-SELECT * FROM mysql.column_stats;
---sorted_result
-SELECT * FROM mysql.index_stats;
-
-DELETE FROM mysql.table_stats;
-DELETE FROM mysql.column_stats;
-DELETE FROM mysql.index_stats;
-
-ANALYZE TABLE mysql.column_stats PERSISTENT FOR ALL;
-
-ANALYZE TABLE mysql.column_stats;
-
-SELECT * FROM mysql.table_stats;
-SELECT * FROM mysql.column_stats;
-SELECT * FROM mysql.index_stats;
-
-set use_stat_tables='never';
-
-ANALYZE TABLE t1 PERSISTENT FOR ALL;
-
-SELECT * FROM mysql.table_stats;
---sorted_result
-SELECT * FROM mysql.column_stats;
---sorted_result
-SELECT * FROM mysql.index_stats;
-
-
-DELETE FROM mysql.table_stats;
-DELETE FROM mysql.column_stats;
-DELETE FROM mysql.index_stats;
-
-
-ANALYZE TABLE t1 PERSISTENT FOR COLUMNS(b) INDEXES();
-ANALYZE TABLE t1 PERSISTENT FOR columns(a,b) INDEXES();
-ANALYZE TABLE t1 PERSISTENT FOR columns(b) indexes(idx2);
-ANALYZE TABLE t1 PERSISTENT FOR columns() indexes(idx2);
-
-DELETE FROM mysql.table_stats;
-DELETE FROM mysql.column_stats;
-DELETE FROM mysql.index_stats;
-
-
-DROP TABLE t1,t2;
-
-set names utf8;
-
-CREATE DATABASE world;
-
-use world;
-
---source include/world_schema_utf8.inc
-
---disable_query_log
---disable_result_log
---disable_warnings
---source include/world.inc
---enable_warnings
---enable_result_log
---enable_query_log
-
-set use_stat_tables='preferably';
-
---disable_result_log
-ANALYZE TABLE Country, City, CountryLanguage;
---enable_result_log
-
---sorted_result
-SELECT UPPER(db_name), UPPER(table_name), cardinality
- FROM mysql.table_stats;
---sorted_result
-SELECT UPPER(db_name), UPPER(table_name),
- column_name, min_value, max_value, nulls_ratio, avg_length, avg_frequency
- FROM mysql.column_stats;
---sorted_result
-SELECT UPPER(db_name), UPPER(table_name),
- index_name, prefix_arity, avg_frequency
- FROM mysql.index_stats;
-
-use test;
-
-set use_stat_tables='never';
-
-CREATE DATABASE world_innodb;
-
-use world_innodb;
-
---source include/world_schema_utf8.inc
-
-ALTER TABLE Country ENGINE=InnoDB;
-ALTER TABLE City ENGINE=InnoDB;
-ALTER TABLE CountryLanguage ENGINE=InnoDB;
-
---disable_query_log
---disable_result_log
---disable_warnings
---source include/world.inc
---enable_warnings
---enable_result_log
---enable_query_log
-
-set use_stat_tables='preferably';
-
---disable_result_log
-ANALYZE TABLE Country, City, CountryLanguage;
---enable_result_log
-
---sorted_result
-SELECT UPPER(db_name), UPPER(table_name), cardinality
- FROM mysql.table_stats;
---sorted_result
-SELECT UPPER(db_name), UPPER(table_name),
- column_name, min_value, max_value, nulls_ratio, avg_length, avg_frequency
- FROM mysql.column_stats;
---sorted_result
-SELECT UPPER(db_name), UPPER(table_name),
- index_name, prefix_arity, avg_frequency
- FROM mysql.index_stats;
-
-use world;
-set use_stat_tables='preferably';
---disable_result_log
-set histogram_size=100;
-set histogram_type='SINGLE_PREC_HB';
-ANALYZE TABLE CountryLanguage;
-set histogram_size=254;
-set histogram_type='DOUBLE_PREC_HB';
-ANALYZE TABLE City;
-FLUSH TABLES;
---enable_result_log
-
---query_vertical select UPPER(db_name),UPPER(table_name),UPPER(column_name),min_value,max_value,nulls_ratio,avg_length,avg_frequency,hist_size,hist_type,hex(histogram),decode_histogram(hist_type,histogram) from mysql.column_stats where UPPER(db_name)='WORLD' and UPPER(table_name)='COUNTRYLANGUAGE' and UPPER(column_name) = 'PERCENTAGE';
---query_vertical select UPPER(db_name),UPPER(table_name),UPPER(column_name),min_value,max_value,nulls_ratio,avg_length,avg_frequency,hist_size,hist_type,hex(histogram),decode_histogram(hist_type,histogram) from mysql.column_stats where UPPER(db_name)='WORLD' and UPPER(table_name)='CITY' and UPPER(column_name) = 'POPULATION';
-
-set histogram_type=default;
-set histogram_size=default;
-
-use test;
-DROP DATABASE world;
-
---sorted_result
-SELECT UPPER(db_name), UPPER(table_name), cardinality
- FROM mysql.table_stats;
---sorted_result
-SELECT UPPER(db_name), UPPER(table_name),
- column_name, min_value, max_value, nulls_ratio, avg_length, avg_frequency
- FROM mysql.column_stats;
---sorted_result
-SELECT UPPER(db_name), UPPER(table_name),
- index_name, prefix_arity, avg_frequency
- FROM mysql.index_stats;
-
-DROP DATABASE world_innodb;
-SELECT UPPER(db_name), UPPER(table_name), cardinality
- FROM mysql.table_stats;
-SELECT UPPER(db_name), UPPER(table_name),
- column_name, min_value, max_value, nulls_ratio, avg_length, avg_frequency
- FROM mysql.column_stats;
-SELECT UPPER(db_name), UPPER(table_name),
- index_name, prefix_arity, avg_frequency
- FROM mysql.index_stats;
-
-DELETE FROM mysql.table_stats;
-DELETE FROM mysql.column_stats;
-DELETE FROM mysql.index_stats;
-
---echo #
---echo # Bug mdev-4357: empty string as a value of the HIST_SIZE column
---echo # from mysql.column_stats
---echo #
-
-create table t1 (a int);
-insert into t1 values (1),(2),(3);
-
-set histogram_size=10;
-
-analyze table t1 persistent for all;
-
-select db_name, table_name, column_name,
- min_value, max_value,
- nulls_ratio, avg_frequency,
- hist_size, hist_type, HEX(histogram)
- FROM mysql.column_stats;
-
-set histogram_size=default;
-
-drop table t1;
-
---echo #
---echo # Bug mdev-4359: wrong setting of the HIST_SIZE column
---echo # (see also mdev-4357) from mysql.column_stats
---echo #
-
-create table t1 ( a int);
-insert into t1 values (1),(2),(3),(4),(5);
-
-set histogram_size=10;
-set histogram_type='double_prec_hb';
-
-show variables like 'histogram%';
-
-analyze table t1 persistent for all;
-
-select db_name, table_name, column_name,
- min_value, max_value,
- nulls_ratio, avg_frequency,
- hist_size, hist_type, HEX(histogram)
- FROM mysql.column_stats;
-
-set histogram_size=default;
-set histogram_type=default;
-
-drop table t1;
-
---echo #
---echo # Bug mdev-4369: histogram for a column with many distinct values
---echo #
-
-
-CREATE TABLE t1 (id int);
-CREATE TABLE t2 (id int);
-
-INSERT INTO t1 (id) VALUES (1), (1), (1),(1);
-INSERT INTO t1 (id) SELECT id FROM t1;
-INSERT INTO t1 SELECT id+1 FROM t1;
-INSERT INTO t1 SELECT id+2 FROM t1;
-INSERT INTO t1 SELECT id+4 FROM t1;
-INSERT INTO t1 SELECT id+8 FROM t1;
-INSERT INTO t1 SELECT id+16 FROM t1;
-INSERT INTO t1 SELECT id+32 FROM t1;
-INSERT INTO t1 SELECT id+64 FROM t1;
-INSERT INTO t1 SELECT id+128 FROM t1;
-INSERT INTO t1 SELECT id+256 FROM t1;
-INSERT INTO t1 SELECT id+512 FROM t1;
-
-INSERT INTO t2 SELECT id FROM t1 ORDER BY id*rand();
-
-SELECT COUNT(*) FROM t2;
-SELECT COUNT(DISTINCT id) FROM t2;
-
-set @@tmp_table_size=1024*16;
-set @@max_heap_table_size=1024*16;
-
-set histogram_size=63;
-
-analyze table t2 persistent for all;
-
-select db_name, table_name, column_name,
- min_value, max_value,
- nulls_ratio, avg_frequency,
- hist_size, hist_type, HEX(histogram)
- FROM mysql.column_stats;
-
-set histogram_size=default;
-
-drop table t1, t2;
-
-set use_stat_tables=@save_use_stat_tables;
-
---echo #
---echo # Bug MDEV-7383: min/max value for a column not utf8 compatible
---echo #
-
-create table t1 (a varchar(100)) engine=MyISAM;
-insert into t1 values(unhex('D879626AF872675F73E662F8'));
-analyze table t1 persistent for all;
-show warnings;
-
-select db_name, table_name, column_name,
- HEX(min_value), HEX(max_value),
- nulls_ratio, avg_frequency,
- hist_size, hist_type, HEX(histogram)
- FROM mysql.column_stats;
-
-drop table t1;
-
---echo #
---echo # MDEV-9590: Always print "Engine-independent statistic" warnings and
---echo # might be filtering columns unintentionally from engines
---echo #
-
-set use_stat_tables='NEVER';
-create table t1 (test blob);
-show variables like 'use_stat_tables';
-analyze table t1;
-drop table t1;
-
---echo #
---echo # MDEV-10435 crash with bad stat tables
---echo #
-
-set use_stat_tables='preferably';
-call mtr.add_suppression("Column count of mysql.table_stats is wrong. Expected 3, found 1. The table is probably corrupted");
-
-rename table mysql.table_stats to test.table_stats;
-flush tables;
-create table t1 (a int);
---error ER_NO_SUCH_TABLE
-rename table t1 to t2, t3 to t4;
-drop table t1;
-rename table test.table_stats to mysql.table_stats;
-
-rename table mysql.table_stats to test.table_stats;
-create table mysql.table_stats (a int);
-flush tables;
-create table t1 (a int);
---error ER_NO_SUCH_TABLE
-rename table t1 to t2, t3 to t4;
-drop table t1, mysql.table_stats;
-rename table test.table_stats to mysql.table_stats;
-
-set use_stat_tables=@save_use_stat_tables;
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-10134 Add full support for DEFAULT
---echo #
-
-CREATE TABLE t1 (a BLOB, b TEXT DEFAULT DECODE_HISTOGRAM('SINGLE_PREC_HB',a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES (0x0000000000000000000000000101010101010101010202020303030304040404050505050606070707080809090A0A0B0C0D0D0E0E0F10111213131415161718191B1C1E202224292A2E33373B4850575F6A76818C9AA7B9C4CFDADFE5EBF0F4F8FAFCFF);
-SELECT b FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/statistics_index_crash-7362.test b/mysql-test/t/statistics_index_crash-7362.test
deleted file mode 100644
index 3873b896dae..00000000000
--- a/mysql-test/t/statistics_index_crash-7362.test
+++ /dev/null
@@ -1,30 +0,0 @@
-# Test cases that cover the crashes within:
-# MDEV-7362 ANALYZE TABLES crash with table-independent-statistics gathering
-# MDEV-7380 engine-independent stats SEGV on ANALYZE TABLE (#2)
-
---source include/have_stat_tables.inc
---source include/have_innodb.inc
-
-CREATE TABLE t1 (a longtext, FULLTEXT KEY (`a`)) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (unhex('3E0D0A4141414142334E7A6143317963324541414141424977414141674541726D'));
-ANALYZE TABLE t1 PERSISTENT FOR ALL;
---sorted_result
-SELECT * FROM mysql.index_stats WHERE index_name='a' AND table_name='t1';
-DROP TABLE t1;
-
-CREATE TABLE t1 (a longtext, FULLTEXT KEY (`a`)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (unhex('3E0D0A4141414142334E7A6143317963324541414141424977414141674541726D'));
-ANALYZE TABLE t1 PERSISTENT FOR ALL;
---sorted_result
-SELECT * FROM mysql.index_stats WHERE index_name='a' AND table_name='t1';
-DROP TABLE t1;
-
-CREATE TABLE geom (g GEOMETRY NOT NULL, SPATIAL INDEX(g)) ENGINE=MyISAM;
-INSERT INTO geom VALUES
- (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)))')),
- (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)))')),
- (MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
-ANALYZE TABLE geom PERSISTENT FOR ALL;
---sorted_result
-SELECT * FROM mysql.index_stats WHERE index_name='g' AND table_name='geom';
-DROP TABLE geom;
diff --git a/mysql-test/t/status-master.opt b/mysql-test/t/status-master.opt
deleted file mode 100644
index eb3bb4fe50d..00000000000
--- a/mysql-test/t/status-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---log-output=table,file
diff --git a/mysql-test/t/status.test b/mysql-test/t/status.test
deleted file mode 100644
index 92fba9ab0a6..00000000000
--- a/mysql-test/t/status.test
+++ /dev/null
@@ -1,440 +0,0 @@
-# This test requires that --log-output includes 'table', and the general
-# log is on
-
-# embedded server causes different stat
--- source include/not_embedded.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-# Disable concurrent inserts to avoid sporadic test failures as it might
-# affect the the value of variables used throughout the test case.
-set @old_concurrent_insert= @@global.concurrent_insert;
-set @@global.concurrent_insert= 0;
-
-# Disable logging to table, since this will also cause table locking and unlocking, which will
-# show up in SHOW STATUS and may cause sporadic failures
-
-SET @old_log_output = @@global.log_output;
-SET GLOBAL LOG_OUTPUT = 'FILE';
-
-# PS causes different statistics
---disable_ps_protocol
-
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-connection default;
-
-flush status;
-
-show status like 'Table_lock%';
-select * from information_schema.session_status where variable_name like 'Table_lock%';
-
-set sql_log_bin=0;
-set @old_general_log = @@global.general_log;
-set global general_log = 'OFF';
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1(n int) engine=myisam;
-insert into t1 values(1);
-select get_lock('mysqltest_lock', 100);
-
-connection con2;
---echo # Sending:
---send update t1 set n = get_lock('mysqltest_lock', 100)
-
-connection con1;
---echo # Wait for the first UPDATE to get blocked.
-let $wait_condition= select count(*) from INFORMATION_SCHEMA.PROCESSLIST
- where STATE = "User lock" and
- INFO = "update t1 set n = get_lock('mysqltest_lock', 100)";
---source include/wait_condition.inc
-
-let $ID= `select connection_id()`;
---echo # Sending:
---send update t1 set n = 3
-
-connection default;
---echo # wait for the second UPDATE to get blocked
-let $wait_condition= select 1 from INFORMATION_SCHEMA.PROCESSLIST
- where ID = $ID and STATE = "Waiting for table level lock";
---source include/wait_condition.inc
-select release_lock('mysqltest_lock');
-
-connection con2;
---echo # Reaping first UPDATE
---reap
-select release_lock('mysqltest_lock');
-
-connection con1;
---echo # Reaping second UPDATE
-reap;
-show status like 'Table_locks_waited';
-
-connection default;
-drop table t1;
-set global general_log = @old_general_log;
-
-disconnect con2;
-disconnect con1;
-
-# End of 4.1 tests
-
-#
-# last_query_cost
-#
-
-select 1;
-show status like 'last_query_cost';
-create table t1 (a int);
-insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
-insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
-insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
-insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
-insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
-select * from t1 where a=6;
-show status like 'last_query_cost';
-# Ensure value dosn't change by second status call
-show status like 'last_query_cost';
-select 1;
-show status like 'last_query_cost';
-drop table t1;
-
-#
-# Test for Bug#15933 max_used_connections is wrong after FLUSH STATUS
-# if connections are cached
-#
-#
-# The first suggested fix from the bug report was chosen
-# (see http://bugs.mysql.com/bug.php?id=15933):
-#
-# a) On flushing the status, set max_used_connections to
-# threads_connected, not to 0.
-#
-# b) Check if it is necessary to increment max_used_connections when
-# taking a thread from the cache as well as when creating new threads
-#
-
-# Wait for at most $disconnect_timeout seconds for disconnects to finish.
-let $disconnect_timeout = 10;
-
-# Wait for any previous disconnects to finish.
-FLUSH STATUS;
---disable_query_log
---disable_result_log
-eval SET @wait_left = $disconnect_timeout;
-let $max_used_connections = `SHOW STATUS LIKE 'max_used_connections'`;
-eval SET @max_used_connections = SUBSTRING('$max_used_connections', 21)+0;
-let $wait_more = `SELECT @max_used_connections != 1 && @wait_left > 0`;
-while ($wait_more)
-{
- sleep 1;
- FLUSH STATUS;
- SET @wait_left = @wait_left - 1;
- let $max_used_connections = `SHOW STATUS LIKE 'max_used_connections'`;
- eval SET @max_used_connections = SUBSTRING('$max_used_connections', 21)+0;
- let $wait_more = `SELECT @max_used_connections != 1 && @wait_left > 0`;
-}
---enable_query_log
---enable_result_log
-
-# Prerequisite.
-SHOW STATUS LIKE 'max_used_connections';
-SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
-
-# Save original setting.
-SET @save_thread_cache_size=@@thread_cache_size;
-SET GLOBAL thread_cache_size=3;
-
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-
-connection con1;
-disconnect con2;
-
-# Check that max_used_connections still reflects maximum value.
-SHOW STATUS LIKE 'max_used_connections';
-SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
-
-# Check that after flush max_used_connections equals to current number
-# of connections. First wait for previous disconnect to finish.
-FLUSH STATUS;
---disable_query_log
---disable_result_log
-eval SET @wait_left = $disconnect_timeout;
-let $max_used_connections = `SHOW STATUS LIKE 'max_used_connections'`;
-eval SET @max_used_connections = SUBSTRING('$max_used_connections', 21)+0;
-let $wait_more = `SELECT @max_used_connections != 2 && @wait_left > 0`;
-while ($wait_more)
-{
- sleep 1;
- FLUSH STATUS;
- SET @wait_left = @wait_left - 1;
- let $max_used_connections = `SHOW STATUS LIKE 'max_used_connections'`;
- eval SET @max_used_connections = SUBSTRING('$max_used_connections', 21)+0;
- let $wait_more = `SELECT @max_used_connections != 2 && @wait_left > 0`;
-}
---enable_query_log
---enable_result_log
-# Check that we don't count disconnected thread any longer.
-SHOW STATUS LIKE 'max_used_connections';
-SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
-
-# Check that max_used_connections is updated when cached thread is
-# reused...
-connect (con2,localhost,root,,);
-SHOW STATUS LIKE 'max_used_connections';
-SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
-
-# ...and when new thread is created.
-connect (con3,localhost,root,,);
-SHOW STATUS LIKE 'max_used_connections';
-SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
-
-# Restore original setting.
-connection default;
-SET GLOBAL thread_cache_size=@save_thread_cache_size;
-
-disconnect con3;
-disconnect con2;
-disconnect con1;
-
-
-#
-# Bug#30377 EXPLAIN loses last_query_cost when used with UNION
-#
-
-CREATE TABLE t1 ( a INT );
-INSERT INTO t1 VALUES (1), (2);
-
-SELECT a FROM t1 LIMIT 1;
-SHOW SESSION STATUS LIKE 'Last_query_cost';
-
-EXPLAIN SELECT a FROM t1;
-SHOW SESSION STATUS LIKE 'Last_query_cost';
-
-SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY a;
-SHOW SESSION STATUS LIKE 'Last_query_cost';
-
-EXPLAIN SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY a;
-SHOW SESSION STATUS LIKE 'Last_query_cost';
-
-SELECT a IN (SELECT a FROM t1) FROM t1 LIMIT 1;
-SHOW SESSION STATUS LIKE 'Last_query_cost';
-
-SELECT (SELECT a FROM t1 LIMIT 1) x FROM t1 LIMIT 1;
-SHOW SESSION STATUS LIKE 'Last_query_cost';
-
-SELECT * FROM t1 a, t1 b LIMIT 1;
-SHOW SESSION STATUS LIKE 'Last_query_cost';
-
-DROP TABLE t1;
-
-
-# End of 5.0 tests
-
-#
-# Ensure that SHOW STATUS only changes global status variables
-#
-
-connect (con1,localhost,root,,);
-let $rnd_next = `show global status like 'handler_read_rnd_next'`;
-let $tmp_table = `show global status like 'Created_tmp_tables'`;
-show status like 'com_show_status';
-show status like 'hand%write%';
-show status like '%tmp%';
-show status like 'hand%write%';
-show status like '%tmp%';
-show status like 'com_show_status';
-let $rnd_next2 = `show global status like 'handler_read_rnd_next'`;
-let $tmp_table2 = `show global status like 'Created_tmp_tables'`;
---disable_query_log
-eval select substring_index('$rnd_next2',0x9,-1)-substring_index('$rnd_next',0x9,-1) as rnd_diff, substring_index('$tmp_table2',0x9,-1)-substring_index('$tmp_table',0x9,-1) as tmp_table_diff;
---enable_query_log
-disconnect con1;
-connection default;
-
-#
-# Bug#30252 Com_create_function is not incremented.
-#
-flush status;
-show status like 'Com%function';
-
-DELIMITER //;
-create function f1 (x INTEGER) returns integer
- begin
- declare ret integer;
- set ret = x * 10;
- return ret;
- end //
-DELIMITER ;//
-
-drop function f1;
-
-show status like 'Com%function';
-
-#
-# Bug#37908 Skipped access right check caused server crash.
-#
-connect (root, localhost, root,,test);
-connection root;
-let $root_connection_id= `select connection_id()`;
---disable_warnings
-create database db37908;
---enable_warnings
-create table db37908.t1(f1 int);
-insert into db37908.t1 values(1);
-create user mysqltest_1@localhost;
-grant usage,execute on test.* to mysqltest_1@localhost;
-delimiter |;
-create procedure proc37908() begin select 1; end |
-create function func37908() returns int sql security invoker
- return (select * from db37908.t1 limit 1)|
-delimiter ;|
-
-connect (user1,localhost,mysqltest_1,,test);
-connection user1;
-let $user1_connection_id= `select connection_id()`;
-
---error ER_TABLEACCESS_DENIED_ERROR
-select * from db37908.t1;
---error ER_TABLEACCESS_DENIED_ERROR
-show status where variable_name ='uptime' and 2 in (select * from db37908.t1);
---error ER_TABLEACCESS_DENIED_ERROR
-show procedure status where name ='proc37908' and 1 in (select f1 from db37908.t1);
---error ER_TABLEACCESS_DENIED_ERROR
-show function status where name ='func37908' and 1 in (select func37908());
-
-connection default;
-disconnect user1;
-disconnect root;
-drop database db37908;
-drop procedure proc37908;
-drop function func37908;
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
-DROP USER mysqltest_1@localhost;
-# Wait till the sessions user1 and root are disconnected
-let $wait_condition =
- SELECT COUNT(*) = 0
- FROM information_schema.processlist
- WHERE id in ('$root_connection_id','$user1_connection_id');
---source include/wait_condition.inc
-
-#
-# Bug#41131 "Questions" fails to increment - ignores statements instead stored procs
-#
-connect (con1,localhost,root,,);
-connection con1;
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
-DROP FUNCTION IF EXISTS f1;
---enable_warnings
-DELIMITER $$;
-CREATE FUNCTION f1() RETURNS INTEGER
-BEGIN
- DECLARE foo INTEGER;
- DECLARE bar INTEGER;
- SET foo=1;
- SET bar=2;
- RETURN foo;
-END $$
-CREATE PROCEDURE p1()
- BEGIN
- SELECT 1;
-END $$
-DELIMITER ;$$
-let $org_queries= `SHOW STATUS LIKE 'Queries'`;
-SELECT f1();
-CALL p1();
-let $new_queries= `SHOW STATUS LIKE 'Queries'`;
---disable_query_log
-let $diff= `SELECT SUBSTRING('$new_queries',9)-SUBSTRING('$org_queries',9)`;
---enable_query_log
-eval SELECT $diff;
-disconnect con1;
-connection default;
-DROP PROCEDURE p1;
-DROP FUNCTION f1;
-
-# End of 5.1 tests
-
-#
-# Test of internal temporary table status variables
-#
-
-flush status;
-create table t1 (a int not null auto_increment primary key, g int, b blob);
-insert into t1 (g,b) values (1,'a'), (2, 'b'), (3, 'b'), (1, 'c');
-select * from t1;
-select b, count(*) from t1 group by b;
-select g, count(*) from t1 group by g;
-show status like 'Row%';
-show status like 'Handler%';
-show status like '%tmp%';
-drop table t1;
-
-#
-# Test of handler status counts
-#
-CREATE TABLE t1 (i int(11) DEFAULT NULL, KEY i (i) ) ENGINE=MyISAM;
-insert into t1 values (1),(2),(3),(4),(5);
-flush status;
-select * from t1 where i=5 union select * from t1 where i=5;
-show status like "handler%";
-drop table t1;
-
-# End of 5.3 tests
-
---echo #
---echo # MDEV-11153 - Introduce status variables for table cache monitoring and
---echo # tuning
---echo #
-SET @old_table_open_cache= @@table_open_cache;
-SET @@global.table_open_cache=10;
-FLUSH TABLES;
-FLUSH STATUS;
-SHOW STATUS LIKE 'Table_open_cache%';
-disable_query_log;
-let $i= `SELECT @@table_open_cache + 5`;
-while ($i)
-{
- eval CREATE TABLE t$i(a INT);
- eval DELETE FROM t$i;
- eval DELETE FROM t$i;
- eval DELETE FROM t$i;
- dec $i;
-}
-enable_query_log;
-SHOW STATUS LIKE 'Table_open_cache%';
-FLUSH TABLES;
-FLUSH STATUS;
-disable_query_log;
-let $i= `SELECT @@table_open_cache + 5`;
-while ($i)
-{
- eval DROP TABLE t$i;
- dec $i;
-}
-enable_query_log;
-SET @@global.table_open_cache= @old_table_open_cache;
-
---echo #
---echo # MDEV-14505 - Threads_running becomes scalability bottleneck
---echo #
---echo # Session status for Threads_running is currently always 1.
-SHOW STATUS LIKE 'Threads_running';
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='THREADS_RUNNING';
-FLUSH STATUS;
-SHOW STATUS LIKE 'Threads_running';
-SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='THREADS_RUNNING';
-
-# Restore global concurrent_insert value. Keep in the end of the test file.
---connection default
-set @@global.concurrent_insert= @old_concurrent_insert;
-SET GLOBAL log_output = @old_log_output;
-
-# Wait till we reached the initial number of concurrent sessions
---source include/wait_until_count_sessions.inc
-
diff --git a/mysql-test/t/status2.test b/mysql-test/t/status2.test
deleted file mode 100644
index 2d1541c54f2..00000000000
--- a/mysql-test/t/status2.test
+++ /dev/null
@@ -1,68 +0,0 @@
---source include/not_embedded.inc
-
---echo #
---echo # Bug#24289 Status Variable "Questions" gets wrong values with Stored Routines
---echo #
-FLUSH STATUS;
-DELIMITER $$;
-CREATE FUNCTION testQuestion() RETURNS INTEGER
-BEGIN
- DECLARE foo INTEGER;
- DECLARE bar INTEGER;
- SET foo=1;
- SET bar=2;
- RETURN foo;
-END $$
-CREATE PROCEDURE testQuestion2()
-BEGIN
- SELECT 1;
-END $$
-DELIMITER ;$$
---disable_warnings
-DROP TABLE IF EXISTS t1,t2;
---enable_warnings
-CREATE TABLE t1 (c1 INT);
-CREATE TABLE t2 (c1 INT);
-CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND
- DO INSERT INTO t1 VALUES(1);
-
---echo Assert Questions == 7
-SHOW STATUS LIKE 'Questions';
-SELECT testQuestion();
---echo Assert Questions == 9
-SHOW STATUS LIKE 'Questions';
-CALL testQuestion2();
---echo Assert Questions == 11
-SHOW STATUS LIKE 'Questions';
-SELECT 1;
---echo Assert Questions == 13
-SHOW STATUS LIKE 'Questions';
-connect (con1,localhost,root,,);
-connection con1;
-SELECT 1;
-connection default;
-disconnect con1;
---echo Assert Questions == 14
-SHOW STATUS LIKE 'Questions';
-DELIMITER $$;
-CREATE TRIGGER trigg1 AFTER INSERT ON t1
- FOR EACH ROW BEGIN
- INSERT INTO t2 VALUES (1);
- END;
-$$
-DELIMITER ;$$
---echo Assert Questions == 16
-SHOW STATUS LIKE 'Questions';
-INSERT INTO t1 VALUES (1);
---echo Assert Questions == 18
-SHOW STATUS LIKE 'Questions';
-# TODO: Uncomment the lines below when FLUSH GLOBAL STATUS is implemented.
-# FLUSH STATUS;
-# SHOW GLOBAL STATUS LIKE 'Questions';
-DROP PROCEDURE testQuestion2;
-DROP TRIGGER trigg1;
-DROP FUNCTION testQuestion;
-DROP EVENT ev1;
-DROP TABLE t1,t2;
---echo End of 6.0 tests
-
diff --git a/mysql-test/t/status_bug17954.test b/mysql-test/t/status_bug17954.test
deleted file mode 100644
index 36430cceeff..00000000000
--- a/mysql-test/t/status_bug17954.test
+++ /dev/null
@@ -1,54 +0,0 @@
-# This test requires that --log-output includes 'table', and the general
-# log is on
-
-# embedded server causes different stat
--- source include/not_embedded.inc
-
-# thread pool causes different results
--- source include/not_threadpool.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-# Disable concurrent inserts to avoid sporadic test failures as it might
-# affect the the value of variables used throughout the test case.
-set @old_concurrent_insert= @@global.concurrent_insert;
-set @@global.concurrent_insert= 0;
-
-# Disable logging to table, since this will also cause table locking and unlocking, which will
-# show up in SHOW STATUS and may cause sporadic failures
-
-SET @old_log_output = @@global.log_output;
-SET GLOBAL LOG_OUTPUT = 'FILE';
-
-# PS causes different statistics
---disable_ps_protocol
-
-flush status;
-
-#
-# Bug#17954 Threads_connected > Threads_created
-#
-
---disable_warnings
-DROP VIEW IF EXISTS v1;
---enable_warnings
-
-CREATE VIEW v1 AS SELECT VARIABLE_NAME AS NAME, CONVERT(VARIABLE_VALUE, UNSIGNED) AS VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS;
-
-SELECT VALUE INTO @tc FROM v1 WHERE NAME = 'Threads_connected';
-SELECT NAME FROM v1 WHERE NAME = 'Threads_created' AND VALUE < @tc;
-#SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS where variable_name like '%thread%';
-#SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS;
-#SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES;
-
-DROP VIEW v1;
-
-# Restore global concurrent_insert value. Keep in the end of the test file.
---connection default
-set @@global.concurrent_insert= @old_concurrent_insert;
-SET GLOBAL log_output = @old_log_output;
-
-# Wait till we reached the initial number of concurrent sessions
---source include/wait_until_count_sessions.inc
-
diff --git a/mysql-test/t/str_to_datetime_457.test b/mysql-test/t/str_to_datetime_457.test
deleted file mode 100644
index dd25f98ebdd..00000000000
--- a/mysql-test/t/str_to_datetime_457.test
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# MDEV-457 Inconsistent data truncation on datetime values with fractional seconds represented as strings with no delimiters
-# (and other problems with str_to_datetime)
-#
-
-# first was ok, second was not
-select cast('01:02:03 ' as time), cast('01:02:03 ' as time);
-# first two were ok, third was not
-select cast('2002-011-012' as date), cast('2002.11.12' as date), cast('2002.011.012' as date);
-# only two microsecond digits were ok, third was truncated with a warning
-select cast('2012103123595912' as datetime(6)), cast('20121031235959123' as datetime(6));
-# zero string date was considered 'out of range'. Must be either ok or invalid format
-select cast(0 as date), cast('0000-00-00' as date), cast('0' as date);
-# first was ok, second was not
-select extract(hour from '100000:02:03'), extract(hour from '100000:02:03 ');
-
---echo #
---echo # backward compatibility craziness
---echo #
-select cast('12:00:00.12.34.56' as time); # was 12:00:00
-select cast('12:00:00 12.34.56' as time); # was 12:34:56
-select cast('12:00:00-12.34.56' as time); # was 12:00:00
-select cast('12:00:00.12.34.56' as datetime);
-select cast('12:00:00-12.34.56' as datetime);
-select cast('12:00:00 12.34.56' as datetime);
-select cast('12:00:00.123456' as time);
diff --git a/mysql-test/t/strict-master.opt b/mysql-test/t/strict-master.opt
deleted file mode 100644
index 96f0ce3f36c..00000000000
--- a/mysql-test/t/strict-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---default-storage-engine=MyISAM
diff --git a/mysql-test/t/strict.test b/mysql-test/t/strict.test
deleted file mode 100644
index 830f051a5f6..00000000000
--- a/mysql-test/t/strict.test
+++ /dev/null
@@ -1,1373 +0,0 @@
-# Testing of "strict" mode
-
--- source include/have_innodb.inc
-
-set @org_mode=@@sql_mode;
-set @@sql_mode='ansi,traditional';
-select @@sql_mode;
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-# Test INSERT with DATE
-
-CREATE TABLE t1 (col1 date);
-INSERT INTO t1 VALUES('2004-01-01'),('2004-02-29');
-INSERT INTO t1 VALUES('0000-10-31');
-
-# All test cases expected to fail should return
-# SQLSTATE 22007 <invalid date value>
---error 1292
-INSERT INTO t1 VALUES('2004-0-31');
---error 1292
-INSERT INTO t1 VALUES('2004-01-02'),('2004-0-31');
---error 1292
-INSERT INTO t1 VALUES('2004-10-0');
---error 1292
-INSERT INTO t1 VALUES('2004-09-31');
---error 1292
-INSERT INTO t1 VALUES('2004-10-32');
---error 1292
-INSERT INTO t1 VALUES('2003-02-29');
---error 1292
-INSERT INTO t1 VALUES('2004-13-15');
---error 1292
-INSERT INTO t1 VALUES('0000-00-00');
-# Standard says we should return SQLSTATE 22018
---error 1292
-INSERT INTO t1 VALUES ('59');
-
-# Test the different related modes
-set @@sql_mode='STRICT_ALL_TABLES';
-INSERT INTO t1 VALUES('2004-01-03'),('2004-0-31');
-set @@sql_mode='STRICT_ALL_TABLES,NO_ZERO_IN_DATE';
---error 1292
-INSERT INTO t1 VALUES('2004-0-30');
---error 1292
-INSERT INTO t1 VALUES('2004-01-04'),('2004-0-31'),('2004-01-05');
-INSERT INTO t1 VALUES('0000-00-00');
-INSERT IGNORE INTO t1 VALUES('2004-0-29');
-set @@sql_mode='STRICT_ALL_TABLES,NO_ZERO_DATE';
---error 1292
-INSERT INTO t1 VALUES('0000-00-00');
-INSERT IGNORE INTO t1 VALUES('0000-00-00');
-INSERT INTO t1 VALUES ('2004-0-30');
---error 1292
-INSERT INTO t1 VALUES ('2004-2-30');
-set @@sql_mode='STRICT_ALL_TABLES,ALLOW_INVALID_DATES';
-INSERT INTO t1 VALUES ('2004-2-30');
-set @@sql_mode='ansi,traditional';
-INSERT IGNORE INTO t1 VALUES('2004-02-29'),('2004-13-15'),('0000-00-00');
-
-select * from t1;
-drop table t1;
-
-# Test difference in behaviour with InnoDB and MyISAM tables
-
-set @@sql_mode='strict_trans_tables';
-CREATE TABLE t1 (col1 date) engine=myisam;
---error 1292
-INSERT INTO t1 VALUES('2004-13-31'),('2004-1-1');
-INSERT INTO t1 VALUES ('2004-1-2'), ('2004-13-31'),('2004-1-3');
-INSERT IGNORE INTO t1 VALUES('2004-13-31'),('2004-1-4');
---error 1292
-INSERT INTO t1 VALUES ('2003-02-29');
-INSERT ignore INTO t1 VALUES('2003-02-30');
-set @@sql_mode='STRICT_ALL_TABLES,ALLOW_INVALID_DATES';
-INSERT ignore INTO t1 VALUES('2003-02-31');
-select * from t1;
-drop table t1;
-
-set @@sql_mode='strict_trans_tables';
-CREATE TABLE t1 (col1 date) engine=innodb;
---error 1292
-INSERT INTO t1 VALUES('2004-13-31'),('2004-1-1');
---error 1292
-INSERT INTO t1 VALUES ('2004-1-2'), ('2004-13-31'),('2004-1-3');
-INSERT IGNORE INTO t1 VALUES('2004-13-31'),('2004-1-4');
---error 1292
-INSERT INTO t1 VALUES ('2003-02-29');
-INSERT ignore INTO t1 VALUES('2003-02-30');
-set @@sql_mode='STRICT_ALL_TABLES,ALLOW_INVALID_DATES';
-INSERT ignore INTO t1 VALUES('2003-02-31');
-select * from t1;
-drop table t1;
-set @@sql_mode='ansi,traditional';
-
-# Test INSERT with DATETIME
-
-CREATE TABLE t1 (col1 datetime);
-INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('2004-02-29 15:30:00');
-INSERT INTO t1 VALUES('0000-10-31 15:30:00');
-
-# All test cases expected to fail should return
-# SQLSTATE 22007 <invalid datetime value>
---error 1292
-INSERT INTO t1 VALUES('2004-0-31 15:30:00');
---error 1292
-INSERT INTO t1 VALUES('2004-10-0 15:30:00');
---error 1292
-INSERT INTO t1 VALUES('2004-09-31 15:30:00');
---error 1292
-INSERT INTO t1 VALUES('2004-10-32 15:30:00');
---error 1292
-INSERT INTO t1 VALUES('2003-02-29 15:30:00');
---error 1292
-INSERT INTO t1 VALUES('2004-13-15 15:30:00');
---error 1292
-INSERT INTO t1 VALUES('0000-00-00 15:30:00');
-# Standard says we should return SQLSTATE 22018
---error 1292
-INSERT INTO t1 VALUES ('59');
-select * from t1;
-drop table t1;
-
-# Test INSERT with TIMESTAMP
-
-CREATE TABLE t1 (col1 timestamp);
-INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('2004-02-29 15:30:00');
-
-# All test cases expected to fail should return
-# SQLSTATE 22007 <invalid datetime value>
-# Standard says we should return ok, but we can't as this is out of range
---error 1292
-INSERT INTO t1 VALUES('0000-10-31 15:30:00');
---error 1292
-INSERT INTO t1 VALUES('2004-0-31 15:30:00');
---error 1292
-INSERT INTO t1 VALUES('2004-10-0 15:30:00');
---error 1292
-INSERT INTO t1 VALUES('2004-09-31 15:30:00');
---error 1292
-INSERT INTO t1 VALUES('2004-10-32 15:30:00');
---error 1292
-INSERT INTO t1 VALUES('2003-02-29 15:30:00');
---error 1292
-INSERT INTO t1 VALUES('2004-13-15 15:30:00');
---error 1292
-INSERT INTO t1 VALUES('2004-02-29 25:30:00');
---error 1292
-INSERT INTO t1 VALUES('2004-02-29 15:65:00');
---error 1292
-INSERT INTO t1 VALUES('2004-02-29 15:31:61');
---error 1292
-INSERT INTO t1 VALUES('0000-00-00 15:30:00');
---error 1292
-INSERT INTO t1 VALUES('0000-00-00 00:00:00');
-INSERT IGNORE INTO t1 VALUES('0000-00-00 00:00:00');
-# Standard says we should return SQLSTATE 22018
---error 1292
-INSERT INTO t1 VALUES ('59');
-
-set @@sql_mode='STRICT_ALL_TABLES,ALLOW_INVALID_DATES';
---error 1292
-INSERT INTO t1 VALUES('2004-0-31 15:30:00');
---error 1292
-INSERT INTO t1 VALUES('2004-10-0 15:30:00');
---error 1292
-INSERT INTO t1 VALUES('2004-10-32 15:30:00');
---error 1292
-INSERT INTO t1 VALUES('2004-02-30 15:30:04');
-INSERT INTO t1 VALUES('0000-00-00 00:00:00');
-set @@sql_mode='STRICT_ALL_TABLES,NO_ZERO_IN_DATE';
-INSERT INTO t1 VALUES('0000-00-00 00:00:00');
-set @@sql_mode='STRICT_ALL_TABLES,NO_ZERO_DATE';
---error 1292
-INSERT INTO t1 VALUES('0000-00-00 00:00:00');
-set @@sql_mode='ansi,traditional';
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
-#### Test INSERT with STR_TO_DATE into DATE/DATETIME/TIMESTAMP
-
-CREATE TABLE t1 (col1 date, col2 datetime, col3 timestamp);
-
-INSERT INTO t1 (col1) VALUES (STR_TO_DATE('15.10.2004','%d.%m.%Y'));
-INSERT INTO t1 (col2) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i'));
-INSERT INTO t1 (col3) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i'));
-
-# Zero year is not a problem for DATE/DATETIME
-INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
-INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
-
-## Test INSERT with STR_TO_DATE into DATE
-# All test cases expected to fail should return
-# SQLSTATE 22007 <invalid date value>
-
---error 1411
-INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
---error 1411
-INSERT INTO t1 (col1) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
---error 1292
-INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i'));
---error 1411
-INSERT INTO t1 (col1) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
---error 1292
-INSERT INTO t1 (col1) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i'));
---error 1411
-INSERT INTO t1 (col1) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i'));
---error 1411
-INSERT INTO t1 (col1) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
-
-## Test INSERT with STR_TO_DATE into DATETIME
-# All test cases expected to fail should return
-# SQLSTATE 22007 <invalid datetime value>
-
---error 1411
-INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
---error 1411
-INSERT INTO t1 (col2) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
---error 1292
-INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i'));
---error 1411
-INSERT INTO t1 (col2) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
---error 1292
-INSERT INTO t1 (col2) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i'));
---error 1411
-INSERT INTO t1 (col2) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i'));
---error 1411
-INSERT INTO t1 (col2) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
-
-## Test INSERT with STR_TO_DATE into TIMESTAMP
-# All test cases expected to fail should return
-# SQLSTATE 22007 <invalid datetime value>
-
---error 1292
-INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
---error 1411
-INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
---error 1411
-INSERT INTO t1 (col3) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
---error 1292
-INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i'));
---error 1411
-INSERT INTO t1 (col3) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
---error 1292
-INSERT INTO t1 (col3) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i'));
---error 1411
-INSERT INTO t1 (col3) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i'));
---error 1411
-INSERT INTO t1 (col3) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
-
-drop table t1;
-
-
-#### Test INSERT with CAST AS DATE/DATETIME into DATE/DATETIME/TIMESTAMP
-
-CREATE TABLE t1 (col1 date, col2 datetime, col3 timestamp);
-
-INSERT INTO t1 (col1) VALUES (CAST('2004-10-15' AS DATE));
-INSERT INTO t1 (col2) VALUES (CAST('2004-10-15 10:15' AS DATETIME));
-INSERT INTO t1 (col3) VALUES (CAST('2004-10-15 10:15' AS DATETIME));
-
-
-## Test INSERT with CAST AS DATE into DATE
-# All test cases expected to fail should return
-# SQLSTATE 22007 <invalid date value>
-
-INSERT INTO t1 (col1) VALUES(CAST('0000-10-31' AS DATE));
-
---error 1292
-INSERT INTO t1 (col1) VALUES(CAST('2004-10-0' AS DATE));
---error 1292
-INSERT INTO t1 (col1) VALUES(CAST('2004-0-10' AS DATE));
-
-# deactivated because of Bug#8294
-# Bug#8294 Traditional: Misleading error message for invalid CAST to DATE
-# --error 1292
-# INSERT INTO t1 (col1) VALUES(CAST('2004-9-31' AS DATE));
-# --error 1292
-# INSERT INTO t1 (col1) VALUES(CAST('2004-10-32' AS DATE));
-# --error 1292
-# INSERT INTO t1 (col1) VALUES(CAST('2003-02-29' AS DATE));
-# --error 1292
-# INSERT INTO t1 (col1) VALUES(CAST('2004-13-15' AS DATE));
-
-# deactivated because of Bug#6145
-# Bug#6145: Traditional: CONVERT and CAST should reject zero DATE values
---error 1292
-INSERT INTO t1 (col1) VALUES(CAST('0000-00-00' AS DATE));
-
-## Test INSERT with CAST AS DATETIME into DATETIME
-# All test cases expected to fail should return
-# SQLSTATE 22007 <invalid datetime value>
-
-INSERT INTO t1 (col2) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
-
---error 1292
-INSERT INTO t1 (col2) VALUES(CAST('2004-10-0 15:30' AS DATETIME));
---error 1292
-INSERT INTO t1 (col2) VALUES(CAST('2004-0-10 15:30' AS DATETIME));
-
-# deactivated because of Bug#8294
-# Bug#8294 Traditional: Misleading error message for invalid CAST to DATE
-#--error 1292
-#INSERT INTO t1 (col2) VALUES(CAST('2004-9-31 15:30' AS DATETIME));
-#--error 1292
-#INSERT INTO t1 (col2) VALUES(CAST('2004-10-32 15:30' AS DATETIME));
-#--error 1292
-#INSERT INTO t1 (col2) VALUES(CAST('2003-02-29 15:30' AS DATETIME));
-#--error 1292
-#INSERT INTO t1 (col2) VALUES(CAST('2004-13-15 15:30' AS DATETIME));
-
-# Bug#6145: Traditional: CONVERT and CAST should reject zero DATE values
---error 1292
-INSERT INTO t1 (col2) VALUES(CAST('0000-00-00' AS DATETIME));
-
-## Test INSERT with CAST AS DATETIME into TIMESTAMP
-# All test cases expected to fail should return
-# SQLSTATE 22007 <invalid datetime value>
---error 1292
-INSERT INTO t1 (col3) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
-# should return OK
-# We accept this to be a failure
-
---error 1292
-INSERT INTO t1 (col3) VALUES(CAST('2004-10-0 15:30' AS DATETIME));
---error 1292
-INSERT INTO t1 (col3) VALUES(CAST('2004-0-10 15:30' AS DATETIME));
-# should return SQLSTATE 22007 <invalid datetime value>
-
-# deactivated because of Bug#8294
-# Bug#8294 Traditional: Misleading error message for invalid CAST to DATE
-#--error 1292
-#INSERT INTO t1 (col3) VALUES(CAST('2004-9-31 15:30' AS DATETIME));
-#--error 1292
-#INSERT INTO t1 (col3) VALUES(CAST('2004-10-32 15:30' AS DATETIME));
-#--error 1292
-#INSERT INTO t1 (col3) VALUES(CAST('2003-02-29 15:30' AS DATETIME));
-#--error 1292
-#INSERT INTO t1 (col3) VALUES(CAST('2004-13-15 15:30' AS DATETIME));
-
-# Bug#6145: Traditional: CONVERT and CAST should reject zero DATE values
---error 1292
-INSERT INTO t1 (col3) VALUES(CAST('0000-00-00' AS DATETIME));
-
-drop table t1;
-
-
-#### Test INSERT with CONVERT to DATE/DATETIME into DATE/DATETIME/TIMESTAMP
-
-CREATE TABLE t1 (col1 date, col2 datetime, col3 timestamp);
-
-INSERT INTO t1 (col1) VALUES (CONVERT('2004-10-15',DATE));
-INSERT INTO t1 (col2) VALUES (CONVERT('2004-10-15 10:15',DATETIME));
-INSERT INTO t1 (col3) VALUES (CONVERT('2004-10-15 10:15',DATETIME));
-
-
-## Test INSERT with CONVERT to DATE into DATE
-# All test cases expected to fail should return
-# SQLSTATE 22007 <invalid date value>
-
-INSERT INTO t1 (col1) VALUES(CONVERT('0000-10-31' , DATE));
-
---error 1292
-INSERT INTO t1 (col1) VALUES(CONVERT('2004-10-0' , DATE));
---error 1292
-INSERT INTO t1 (col1) VALUES(CONVERT('2004-0-10' , DATE));
---error 1292
-INSERT INTO t1 (col1) VALUES('2004-0-10');
-
-# deactivated because of Bug#8294
-# Bug#8294 Traditional: Misleading error message for invalid CAST to DATE
-#--error 1292
-#INSERT INTO t1 (col1) VALUES(CONVERT('2004-9-31' , DATE));
-#--error 1292
-#INSERT INTO t1 (col1) VALUES(CONVERT('2004-10-32' , DATE));
-#--error 1292
-#INSERT INTO t1 (col1) VALUES(CONVERT('2003-02-29' , DATE));
-#--error 1292
-#INSERT INTO t1 (col1) VALUES(CONVERT('2004-13-15',DATE));
-
-# Bug#6145: Traditional: CONVERT and CAST should reject zero DATE values
---error 1292
-INSERT INTO t1 (col1) VALUES(CONVERT('0000-00-00',DATE));
-
-## Test INSERT with CONVERT to DATETIME into DATETIME
-# All test cases expected to fail should return
-# SQLSTATE 22007 <invalid datetime value>
-
-INSERT INTO t1 (col2) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
-
---error 1292
-INSERT INTO t1 (col2) VALUES(CONVERT('2004-10-0 15:30',DATETIME));
---error 1292
-INSERT INTO t1 (col2) VALUES(CONVERT('2004-0-10 15:30',DATETIME));
-
-# deactivated because of Bug#8294
-# Bug#8294 Traditional: Misleading error message for invalid CAST to DATE
-#--error 1292
-#INSERT INTO t1 (col2) VALUES(CONVERT('2004-9-31 15:30',DATETIME));
-#--error 1292
-#INSERT INTO t1 (col2) VALUES(CONVERT('2004-10-32 15:30',DATETIME));
-#--error 1292
-#INSERT INTO t1 (col2) VALUES(CONVERT('2003-02-29 15:30',DATETIME));
-#--error 1292
-#INSERT INTO t1 (col2) VALUES(CONVERT('2004-13-15 15:30',DATETIME));
-
-# Bug#6145: Traditional: CONVERT and CAST should reject zero DATE values
---error 1292
-INSERT INTO t1 (col2) VALUES(CONVERT('0000-00-00',DATETIME));
-
-## Test INSERT with CONVERT to DATETIME into DATETIME
-# All test cases expected to fail should return
-# SQLSTATE 22007 <invalid datetime value>
---error 1292
-INSERT INTO t1 (col3) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
-# should return OK
-# We accept this to be a failure
-
---error 1292
-INSERT INTO t1 (col3) VALUES(CONVERT('2004-10-0 15:30',DATETIME));
---error 1292
-INSERT INTO t1 (col3) VALUES(CONVERT('2004-0-10 15:30',DATETIME));
-
-# deactivated because of Bug#8294
-# Bug#8294 Traditional: Misleading error message for invalid CAST to DATE
-#--error 1292
-#INSERT INTO t1 (col3) VALUES(CONVERT('2004-9-31 15:30',DATETIME));
-#--error 1292
-#INSERT INTO t1 (col3) VALUES(CONVERT('2004-10-32 15:30',DATETIME));
-#--error 1292
-#INSERT INTO t1 (col3) VALUES(CONVERT('2003-02-29 15:30',DATETIME));
-#--error 1292
-#INSERT INTO t1 (col3) VALUES(CONVERT('2004-13-15 15:30',DATETIME));
-
-# Bug#6145: Traditional: CONVERT and CAST should reject zero DATE values
---error 1292
-INSERT INTO t1 (col3) VALUES(CONVERT('0000-00-00',DATETIME));
-
-drop table t1;
-
-
-# Test INSERT with TINYINT
-
-CREATE TABLE t1(col1 TINYINT, col2 TINYINT UNSIGNED);
-INSERT INTO t1 VALUES(-128,0),(0,0),(127,255),('-128','0'),('0','0'),('127','255'),(-128.0,0.0),(0.0,0.0),(127.0,255.0);
-# Test that we restored the mode checking properly after an ok query
-SELECT MOD(col1,0) FROM t1 WHERE col1 > 0 LIMIT 2;
--- error 1264
-INSERT INTO t1 (col1) VALUES(-129);
--- error 1264
-INSERT INTO t1 (col1) VALUES(128);
--- error 1264
-INSERT INTO t1 (col2) VALUES(-1);
--- error 1264
-INSERT INTO t1 (col2) VALUES(256);
--- error 1264
-INSERT INTO t1 (col1) VALUES('-129');
--- error 1264
-INSERT INTO t1 (col1) VALUES('128');
--- error 1264
-INSERT INTO t1 (col2) VALUES('-1');
--- error 1264
-INSERT INTO t1 (col2) VALUES('256');
--- error 1264
-INSERT INTO t1 (col1) VALUES(128.0);
--- error 1264
-INSERT INTO t1 (col2) VALUES(-1.0);
--- error 1264
-INSERT INTO t1 (col2) VALUES(256.0);
-SELECT MOD(col1,0) FROM t1 WHERE col1 > 0 LIMIT 1;
---error 1264
-UPDATE t1 SET col1 = col1 - 50 WHERE col1 < 0;
---error 1264
-UPDATE t1 SET col2=col2 + 50 WHERE col2 > 0;
---error 1365
-UPDATE t1 SET col1=col1 / 0 WHERE col1 > 0;
-set @@sql_mode='ERROR_FOR_DIVISION_BY_ZERO';
-INSERT INTO t1 values (1/0,1/0);
-set @@sql_mode='ansi,traditional';
-SELECT MOD(col1,0) FROM t1 WHERE col1 > 0 LIMIT 2;
-# Should return SQLSTATE 22018 invalid character value for cast
---error 1366
-INSERT INTO t1 (col1) VALUES ('');
---error 1366
-INSERT INTO t1 (col1) VALUES ('a59b');
---error 1265
-INSERT INTO t1 (col1) VALUES ('1a');
-INSERT IGNORE INTO t1 (col1) VALUES ('2a');
-INSERT IGNORE INTO t1 values (1/0,1/0);
-set @@sql_mode='ansi';
-INSERT INTO t1 values (1/0,1/0);
-set @@sql_mode='ansi,traditional';
-INSERT IGNORE INTO t1 VALUES('-129','-1'),('128','256');
-INSERT IGNORE INTO t1 VALUES(-129.0,-1.0),(128.0,256.0);
-UPDATE IGNORE t1 SET col2=1/NULL where col1=0;
-
-SELECT * FROM t1;
-DROP TABLE t1;
-
-# Test INSERT with SMALLINT
-
-CREATE TABLE t1(col1 SMALLINT, col2 SMALLINT UNSIGNED);
-INSERT INTO t1 VALUES(-32768,0),(0,0),(32767,65535),('-32768','0'),('32767','65535'),(-32768.0,0.0),(32767.0,65535.0);
-
---error 1264
-INSERT INTO t1 (col1) VALUES(-32769);
---error 1264
-INSERT INTO t1 (col1) VALUES(32768);
---error 1264
-INSERT INTO t1 (col2) VALUES(-1);
---error 1264
-INSERT INTO t1 (col2) VALUES(65536);
---error 1264
-INSERT INTO t1 (col1) VALUES('-32769');
---error 1264
-INSERT INTO t1 (col1) VALUES('32768');
---error 1264
-INSERT INTO t1 (col2) VALUES('-1');
---error 1264
-INSERT INTO t1 (col2) VALUES('65536');
---error 1264
-INSERT INTO t1 (col1) VALUES(-32769.0);
---error 1264
-INSERT INTO t1 (col1) VALUES(32768.0);
---error 1264
-INSERT INTO t1 (col2) VALUES(-1.0);
---error 1264
-INSERT INTO t1 (col2) VALUES(65536.0);
---error 1264
-UPDATE t1 SET col1 = col1 - 50 WHERE col1 < 0;
---error 1264
-UPDATE t1 SET col2 = col2 + 50 WHERE col2 > 0;
---error 1365
-UPDATE t1 SET col1 = col1 / 0 WHERE col1 > 0;
---error 1365
-UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
---error 1366
-INSERT INTO t1 (col1) VALUES ('');
---error 1366
-INSERT INTO t1 (col1) VALUES ('a59b');
---error 1265
-INSERT INTO t1 (col1) VALUES ('1a');
-INSERT IGNORE INTO t1 (col1) VALUES ('2a');
-INSERT IGNORE INTO t1 values (1/0,1/0);
-INSERT IGNORE INTO t1 VALUES(-32769,-1),(32768,65536);
-INSERT IGNORE INTO t1 VALUES('-32769','-1'),('32768','65536');
-INSERT IGNORE INTO t1 VALUES(-32769,-1.0),(32768.0,65536.0);
-UPDATE IGNORE t1 SET col2=1/NULL where col1=0;
-
-SELECT * FROM t1;
-DROP TABLE t1;
-
-# Test INSERT with MEDIUMINT
-
-CREATE TABLE t1 (col1 MEDIUMINT, col2 MEDIUMINT UNSIGNED);
-INSERT INTO t1 VALUES(-8388608,0),(0,0),(8388607,16777215),('-8388608','0'),('8388607','16777215'),(-8388608.0,0.0),(8388607.0,16777215.0);
---error 1264
-INSERT INTO t1 (col1) VALUES(-8388609);
---error 1264
-INSERT INTO t1 (col1) VALUES(8388608);
---error 1264
-INSERT INTO t1 (col2) VALUES(-1);
---error 1264
-INSERT INTO t1 (col2) VALUES(16777216);
---error 1264
-INSERT INTO t1 (col1) VALUES('-8388609');
---error 1264
-INSERT INTO t1 (col1) VALUES('8388608');
---error 1264
-INSERT INTO t1 (col2) VALUES('-1');
---error 1264
-INSERT INTO t1 (col2) VALUES('16777216');
---error 1264
-INSERT INTO t1 (col1) VALUES(-8388609.0);
---error 1264
-INSERT INTO t1 (col1) VALUES(8388608.0);
---error 1264
-INSERT INTO t1 (col2) VALUES(-1.0);
---error 1264
-INSERT INTO t1 (col2) VALUES(16777216.0);
-
---error 1264
-UPDATE t1 SET col1 = col1 - 50 WHERE col1 < 0;
---error 1264
-UPDATE t1 SET col2 = col2 + 50 WHERE col2 > 0;
---error 1365
-UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0;
---error 1365
-UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
---error 1366
-INSERT INTO t1 (col1) VALUES ('');
---error 1366
-INSERT INTO t1 (col1) VALUES ('a59b');
---error 1265
-INSERT INTO t1 (col1) VALUES ('1a');
-INSERT IGNORE INTO t1 (col1) VALUES ('2a');
-INSERT IGNORE INTO t1 values (1/0,1/0);
-INSERT IGNORE INTO t1 VALUES(-8388609,-1),(8388608,16777216);
-INSERT IGNORE INTO t1 VALUES('-8388609','-1'),('8388608','16777216');
-INSERT IGNORE INTO t1 VALUES(-8388609.0,-1.0),(8388608.0,16777216.0);
-UPDATE IGNORE t1 SET col2=1/NULL where col1=0;
-
-SELECT * FROM t1;
-DROP TABLE t1;
-
-# Test INSERT with INT
-
-CREATE TABLE t1 (col1 INT, col2 INT UNSIGNED);
-INSERT INTO t1 VALUES(-2147483648,0),(0,0),(2147483647,4294967295),('-2147483648','0'),('2147483647','4294967295'),(-2147483648.0,0.0),(2147483647.0,4294967295.0);
---error 1264
-INSERT INTO t1 (col1) VALUES(-2147483649);
---error 1264
-INSERT INTO t1 (col1) VALUES(2147643648);
---error 1264
-INSERT INTO t1 (col2) VALUES(-1);
---error 1264
-INSERT INTO t1 (col2) VALUES(4294967296);
---error 1264
-INSERT INTO t1 (col1) VALUES('-2147483649');
---error 1264
-INSERT INTO t1 (col1) VALUES('2147643648');
---error 1264
-INSERT INTO t1 (col2) VALUES('-1');
---error 1264
-INSERT INTO t1 (col2) VALUES('4294967296');
---error 1264
-INSERT INTO t1 (col1) VALUES(-2147483649.0);
---error 1264
-INSERT INTO t1 (col1) VALUES(2147643648.0);
---error 1264
-INSERT INTO t1 (col2) VALUES(-1.0);
---error 1264
-INSERT INTO t1 (col2) VALUES(4294967296.0);
-
---error 1264
-UPDATE t1 SET col1 = col1 - 50 WHERE col1 < 0;
---error 1264
-UPDATE t1 SET col2 =col2 + 50 WHERE col2 > 0;
---error 1365
-UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0;
---error 1365
-UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
---error 1366
-INSERT INTO t1 (col1) VALUES ('');
---error 1366
-INSERT INTO t1 (col1) VALUES ('a59b');
---error 1265
-INSERT INTO t1 (col1) VALUES ('1a');
-INSERT IGNORE INTO t1 (col1) VALUES ('2a');
-INSERT IGNORE INTO t1 values (1/0,1/0);
-INSERT IGNORE INTO t1 values (-2147483649, -1),(2147643648,4294967296);
-INSERT IGNORE INTO t1 values ('-2147483649', '-1'),('2147643648','4294967296');
-INSERT IGNORE INTO t1 values (-2147483649.0, -1.0),(2147643648.0,4294967296.0);
-UPDATE IGNORE t1 SET col2=1/NULL where col1=0;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-# Test INSERT with BIGINT
-# Note that this doesn't behave 100 % to standard as we rotate
-# integers when it's too big/small (just like C)
-
-CREATE TABLE t1 (col1 BIGINT, col2 BIGINT UNSIGNED);
-INSERT INTO t1 VALUES(-9223372036854775808,0),(0,0),(9223372036854775807,18446744073709551615);
-INSERT INTO t1 VALUES('-9223372036854775808','0'),('9223372036854775807','18446744073709551615');
-INSERT INTO t1 VALUES(-9223372036854774000.0,0.0),(9223372036854775700.0,1844674407370954000.0);
-
---error 1264
-INSERT INTO t1 (col1) VALUES(-9223372036854775809);
---error 1264
-INSERT INTO t1 (col1) VALUES(9223372036854775808);
---error 1264
-INSERT INTO t1 (col2) VALUES(-1);
-
---error 1264
-INSERT INTO t1 (col2) VALUES(18446744073709551616);
---error 1264
-INSERT INTO t1 (col1) VALUES('-9223372036854775809');
---error 1264
-INSERT INTO t1 (col1) VALUES('9223372036854775808');
---error 1264
-INSERT INTO t1 (col2) VALUES('-1');
---error 1264
-INSERT INTO t1 (col2) VALUES('18446744073709551616');
-
-# Note that the following two double numbers are slighty bigger than max/min
-# bigint becasue of rounding errors when converting it to bigint
---error 1264
-INSERT INTO t1 (col1) VALUES(-9223372036854785809.0);
---error 1264
-INSERT INTO t1 (col1) VALUES(9223372036854785808.0);
---error 1264
-INSERT INTO t1 (col2) VALUES(-1.0);
---error 1264
-INSERT INTO t1 (col2) VALUES(18446744073709551616.0);
-
-# The following doesn't give an error as it's done in integer context
-# UPDATE t1 SET col1=col1 - 5000 WHERE col1 < 0;
-# UPDATE t1 SET col2 =col2 + 5000 WHERE col2 > 0;
-
---error 1365
-UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0;
---error 1365
-UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
---error 1366
-INSERT INTO t1 (col1) VALUES ('');
---error 1366
-INSERT INTO t1 (col1) VALUES ('a59b');
---error 1265
-INSERT INTO t1 (col1) VALUES ('1a');
-INSERT IGNORE INTO t1 (col1) VALUES ('2a');
-INSERT IGNORE INTO t1 values (1/0,1/0);
-INSERT IGNORE INTO t1 VALUES(-9223372036854775809,-1),(9223372036854775808,18446744073709551616);
-INSERT IGNORE INTO t1 VALUES('-9223372036854775809','-1'),('9223372036854775808','18446744073709551616');
-INSERT IGNORE INTO t1 VALUES(-9223372036854785809.0,-1.0),(9223372036854785808.0,18446744073709551616.0);
-UPDATE IGNORE t1 SET col2=1/NULL where col1=0;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-# Test INSERT with NUMERIC
-
-CREATE TABLE t1 (col1 NUMERIC(4,2));
-INSERT INTO t1 VALUES (10.55),(10.5555),(0),(-10.55),(-10.5555),(11),(1e+01);
-# Note that the +/-10.5555 is inserted as +/-10.55, not +/-10.56 !
-INSERT INTO t1 VALUES ('10.55'),('10.5555'),('-10.55'),('-10.5555'),('11'),('1e+01');
-
-# The 2 following inserts should generate a warning, but doesn't yet
-# because NUMERIC works like DECIMAL
---error 1264
-INSERT INTO t1 VALUES (101.55);
---error 1264
-INSERT INTO t1 VALUES (101);
---error 1264
-INSERT INTO t1 VALUES (-101.55);
---error 1264
-INSERT INTO t1 VALUES (1010.55);
---error 1264
-INSERT INTO t1 VALUES (1010);
-# The 2 following inserts should generate a warning, but doesn't yet
-# because NUMERIC works like DECIMAL
---error 1264
-INSERT INTO t1 VALUES ('101.55');
---error 1264
-INSERT INTO t1 VALUES ('101');
---error 1264
-INSERT INTO t1 VALUES ('-101.55');
---error 1264
-INSERT INTO t1 VALUES ('-1010.55');
---error 1264
-INSERT INTO t1 VALUES ('-100E+1');
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('-100E');
---error 1264
-UPDATE t1 SET col1 =col1 * 50000 WHERE col1 =11;
---error 1365
-UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0;
---error 1365
-UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
-#--error 1265
---error 1366
-INSERT INTO t1 (col1) VALUES ('');
-#--error 1265
---error 1366
-INSERT INTO t1 (col1) VALUES ('a59b');
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 (col1) VALUES ('1a');
-INSERT IGNORE INTO t1 (col1) VALUES ('2a');
-INSERT IGNORE INTO t1 values (1/0);
-INSERT IGNORE INTO t1 VALUES(1000),(-1000);
-INSERT IGNORE INTO t1 VALUES('1000'),('-1000');
-INSERT IGNORE INTO t1 VALUES(1000.0),(-1000.0);
-UPDATE IGNORE t1 SET col1=1/NULL where col1=0;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-# Test INSERT with FLOAT
-
-CREATE TABLE t1 (col1 FLOAT, col2 FLOAT UNSIGNED);
-INSERT INTO t1 VALUES (-1.1E-37,0),(+3.4E+38,+3.4E+38);
-INSERT INTO t1 VALUES ('-1.1E-37',0),('+3.4E+38','+3.4E+38');
-# We don't give warnings for underflow
-INSERT INTO t1 (col1) VALUES (3E-46);
---error 1264
-INSERT INTO t1 (col1) VALUES (+3.4E+39);
---error 1264
-INSERT INTO t1 (col2) VALUES (-1.1E-3);
---error 1264
-INSERT INTO t1 (col1) VALUES ('+3.4E+39');
---error 1264
-INSERT INTO t1 (col2) VALUES ('-1.1E-3');
---error 1264
-UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0;
---error 1365
-UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0;
---error 1365
-UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0;
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 (col1) VALUES ('');
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 (col1) VALUES ('a59b');
---error 1265
-INSERT INTO t1 (col1) VALUES ('1a');
-INSERT IGNORE INTO t1 (col1) VALUES ('2a');
-INSERT IGNORE INTO t1 (col1) VALUES (1/0);
-INSERT IGNORE INTO t1 VALUES (+3.4E+39,-3.4E+39);
-INSERT IGNORE INTO t1 VALUES ('+3.4E+39','-3.4E+39');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-# Test INSERT with DOUBLE
-
-CREATE TABLE t1 (col1 DOUBLE PRECISION, col2 DOUBLE PRECISION UNSIGNED);
-INSERT INTO t1 VALUES (-2.2E-307,0),(2E-307,0),(+1.7E+308,+1.7E+308);
-INSERT INTO t1 VALUES ('-2.2E-307',0),('-2E-307',0),('+1.7E+308','+1.7E+308');
-# We don't give warnings for underflow
-INSERT INTO t1 (col1) VALUES (-2.2E-330);
---error 1367,1264
-INSERT INTO t1 (col1) VALUES (+1.7E+309);
---error 1264
-INSERT INTO t1 (col2) VALUES (-1.1E-3);
---error 1264
-INSERT INTO t1 (col1) VALUES ('+1.8E+309');
---error 1264
-INSERT INTO t1 (col2) VALUES ('-1.2E-3');
---error ER_DATA_OUT_OF_RANGE
-UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0;
---error 1365
-UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0;
---error 1365
-UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0;
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 (col1) VALUES ('');
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 (col1) VALUES ('a59b');
---error 1265
-INSERT INTO t1 (col1) VALUES ('1a');
-INSERT IGNORE INTO t1 (col1) VALUES ('2a');
-INSERT IGNORE INTO t1 (col1) values (1/0);
---error 1367
-INSERT IGNORE INTO t1 VALUES (+1.9E+309,-1.9E+309);
-INSERT IGNORE INTO t1 VALUES ('+2.0E+309','-2.0E+309');
-# stupid...
---replace_result -0 0 1.7976931348623e+308 1.79769313486232e+308
-SELECT * FROM t1;
-DROP TABLE t1;
-
-# Testing INSERT with CHAR/VARCHAR
-
-CREATE TABLE t1 (col1 CHAR(5), col2 VARCHAR(6));
-INSERT INTO t1 VALUES ('hello', 'hello'),('he', 'he'),('hello ', 'hello ');
---error 1406
-INSERT INTO t1 (col1) VALUES ('hellobob');
---error 1406
-INSERT INTO t1 (col2) VALUES ('hellobob');
-INSERT INTO t1 (col2) VALUES ('hello ');
---error 1406
-UPDATE t1 SET col1 ='hellobob' WHERE col1 ='he';
---error 1406
-UPDATE t1 SET col2 ='hellobob' WHERE col2 ='he';
-INSERT IGNORE INTO t1 VALUES ('hellobob', 'hellobob');
-UPDATE IGNORE t1 SET col2 ='hellotrudy' WHERE col2 ='he';
-SELECT * FROM t1;
-DROP TABLE t1;
-
-# Testing INSERT with ENUM
-
-CREATE TABLE t1 (col1 enum('red','blue','green'));
-INSERT INTO t1 VALUES ('red'),('blue'),('green');
---error 1265
-INSERT INTO t1 (col1) VALUES ('yellow');
---error 1265
-INSERT INTO t1 (col1) VALUES ('redd');
---error 1265
-INSERT INTO t1 VALUES ('');
---error 1265
-UPDATE t1 SET col1 ='yellow' WHERE col1 ='green';
-INSERT IGNORE INTO t1 VALUES ('yellow');
-UPDATE IGNORE t1 SET col1 ='yellow' WHERE col1 ='blue';
-SELECT * FROM t1;
-DROP TABLE t1;
-
-# Testing of insert of NULL in not NULL column
-
-CREATE TABLE t1 (col1 INT NOT NULL, col2 CHAR(5) NOT NULL, col3 DATE NOT NULL);
-INSERT INTO t1 VALUES (100, 'hello', '2004-08-20');
-INSERT INTO t1 (col1,col2,col3) VALUES (101, 'hell2', '2004-08-21');
---error 1048
-INSERT INTO t1 (col1,col2,col3) VALUES (NULL, '', '2004-01-01');
---error 1048
-INSERT INTO t1 (col1,col2,col3) VALUES (102, NULL, '2004-01-01');
---error 1048
-INSERT INTO t1 VALUES (103,'',NULL);
---error 1048
-UPDATE t1 SET col1=NULL WHERE col1 =100;
---error 1048
-UPDATE t1 SET col2 =NULL WHERE col2 ='hello';
---error 1048
-UPDATE t1 SET col2 =NULL where col3 IS NOT NULL;
-INSERT IGNORE INTO t1 values (NULL,NULL,NULL);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-# Testing of default values
-
-CREATE TABLE t1 (col1 INT NOT NULL default 99, col2 CHAR(6) NOT NULL);
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (1, 'hello');
-INSERT INTO t1 (col2) VALUES ('hello2');
---error 1048
-INSERT INTO t1 (col2) VALUES (NULL);
---error 1364
-INSERT INTO t1 (col1) VALUES (2);
---error 1364
-INSERT INTO t1 VALUES(default(col1),default(col2));
---error 1364
-INSERT INTO t1 (col1) SELECT 1;
---error 1048
-INSERT INTO t1 SELECT 1,NULL;
-INSERT IGNORE INTO t1 values (NULL,NULL);
-INSERT IGNORE INTO t1 (col1) values (3);
-INSERT IGNORE INTO t1 () values ();
-SELECT * FROM t1;
-DROP TABLE t1;
-
-#
-# Bug #9029 Traditional: Wrong SQLSTATE returned for string truncation
-#
-
-set sql_mode='traditional';
-create table t1 (charcol char(255), varcharcol varchar(255),
-binarycol binary(255), varbinarycol varbinary(255), tinytextcol tinytext,
-tinyblobcol tinyblob);
---error 1406
-insert into t1 (charcol) values (repeat('x',256));
---error 1406
-insert into t1 (varcharcol) values (repeat('x',256));
---error 1406
-insert into t1 (binarycol) values (repeat('x',256));
---error 1406
-insert into t1 (varbinarycol) values (repeat('x',256));
---error 1406
-insert into t1 (tinytextcol) values (repeat('x',256));
---error 1406
-insert into t1 (tinyblobcol) values (repeat('x',256));
-select * from t1;
-drop table t1;
-
-#
-# Bug #5902: STR_TO_DATE() didn't give errors in traditional mode
-#
-
-set sql_mode='traditional';
-create table t1 (col1 datetime);
---error 1292
-insert into t1 values(STR_TO_DATE('31.10.2004 15.30 abc','%d.%m.%Y %H.%i'));
---error 1411
-insert into t1 values(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
---error 1411
-insert into t1 values(STR_TO_DATE('2004.12.12 22:22:33 AM','%Y.%m.%d %r'));
---error 1411
-insert into t1 values(STR_TO_DATE('2004.12.12 abc','%Y.%m.%d %T'));
-set sql_mode='';
-insert into t1 values(STR_TO_DATE('31.10.2004 15.30 abc','%d.%m.%Y %H.%i'));
-insert into t1 values(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i'));
-insert into t1 values(STR_TO_DATE('2004.12.12 22:22:33 AM','%Y.%m.%d %r'));
-insert into t1 values(STR_TO_DATE('2004.12.12 abc','%Y.%m.%d %T'));
-
-# Some correct values, just to test the functions
-insert into t1 values(STR_TO_DATE('31.10.2004 15.30','%d.%m.%Y %H.%i'));
-insert into t1 values(STR_TO_DATE('2004.12.12 11:22:33 AM','%Y.%m.%d %r'));
-insert into t1 values(STR_TO_DATE('2004.12.12 10:22:59','%Y.%m.%d %T'));
-
-select * from t1;
-
-# Check that select don't abort even in strict mode (for now)
-set sql_mode='traditional';
-
-select count(*) from t1 where STR_TO_DATE('2004.12.12 10:22:61','%Y.%m.%d %T') IS NULL;
-
-drop table t1;
-
-#
-# Check insert with wrong CAST() (Bug #5912)
-#
-
-create table t1 (col1 char(3), col2 integer);
---error 1292
-insert into t1 (col1) values (cast(1000 as char(3)));
---error 1292
-insert into t1 (col1) values (cast(1000E+0 as char(3)));
---error 1292
-insert into t1 (col1) values (cast(1000.0 as char(3)));
---error 1292
-insert into t1 (col2) values (cast('abc' as signed integer));
---error 1292
-insert into t1 (col2) values (10E+0 + 'a');
---error 1292
-insert into t1 (col2) values (cast('10a' as unsigned integer));
-insert into t1 (col2) values (cast('10' as unsigned integer));
-insert into t1 (col2) values (cast('10' as signed integer));
-insert into t1 (col2) values (10E+0 + '0 ');
-select * from t1;
-drop table t1;
-
-#
-# Zero dates using numbers was not checked properly (Bug #5933 & #6145)
-#
-
-create table t1 (col1 date, col2 datetime, col3 timestamp);
---error 1292
-insert into t1 values (0,0,0);
---error 1292
-insert into t1 values (0.0,0.0,0.0);
---error 1292
-insert into t1 (col1) values (convert('0000-00-00',date));
---error 1292
-insert into t1 (col1) values (cast('0000-00-00' as date));
-
-set sql_mode='no_zero_date';
-insert into t1 values (0,0,0);
-insert into t1 values (0.0,0.0,0.0);
-drop table t1;
-set sql_mode='traditional';
-create table t1 (col1 date);
-insert ignore into t1 values ('0000-00-00');
---error 1292
-insert into t1 select * from t1;
-insert ignore into t1 values ('0000-00-00');
-insert ignore into t1 (col1) values (cast('0000-00-00' as date));
---error 1292
-insert into t1 select * from t1;
---error 1292
-alter table t1 modify col1 datetime;
-alter ignore table t1 modify col1 datetime;
---error 1292
-insert into t1 select * from t1;
-select * from t1;
-drop table t1;
-
-#
-# Test of inserting an invalid value via a stored procedure (Bug #5907)
-#
-create table t1 (col1 tinyint);
-drop procedure if exists t1;
-delimiter |;
-create procedure t1 () begin declare exit handler for sqlexception
-select'a'; insert into t1 values (200); end;|
-delimiter ;|
-call t1();
-select * from t1;
-drop procedure t1;
-drop table t1;
-
-#
-# Restore mode
-#
-set sql_mode=@org_mode;
-
-# Test fields with no default value that are NOT NULL (Bug #5986)
-SET @@sql_mode = 'traditional';
-CREATE TABLE t1 (i int not null);
---error 1364
-INSERT INTO t1 VALUES ();
---error 1364
-INSERT INTO t1 VALUES (DEFAULT);
---error 1364
-INSERT INTO t1 VALUES (DEFAULT(i));
-ALTER TABLE t1 ADD j int;
---error 1364
-INSERT INTO t1 SET j = 1;
---error 1364
-INSERT INTO t1 SET j = 1, i = DEFAULT;
---error 1364
-INSERT INTO t1 SET j = 1, i = DEFAULT(i);
---error 1364
-INSERT INTO t1 VALUES (DEFAULT,1);
-DROP TABLE t1;
-SET @@sql_mode = '';
-CREATE TABLE t1 (i int not null);
-INSERT INTO t1 VALUES ();
-INSERT INTO t1 VALUES (DEFAULT);
-# DEFAULT(i) is an error even with the default sql_mode
---error 1364
-INSERT INTO t1 VALUES (DEFAULT(i));
-ALTER TABLE t1 ADD j int;
-INSERT INTO t1 SET j = 1;
-INSERT INTO t1 SET j = 1, i = DEFAULT;
---error 1364
-INSERT INTO t1 SET j = 1, i = DEFAULT(i);
-INSERT INTO t1 VALUES (DEFAULT,1);
-DROP TABLE t1;
-
-#
-# Bugs #8295 and #8296: varchar and varbinary conversion
-#
-
-set @@sql_mode='traditional';
---error 1074
-create table t1(a varchar(65537));
---error 1074
-create table t1(a varbinary(65537));
-
-#
-# Bug #9881: problem with altering table
-#
-
-set @@sql_mode='traditional';
-create table t1(a int, b date not null);
-alter table t1 modify a bigint unsigned not null;
-show create table t1;
-drop table t1;
-
-#
-# Bug #5906: handle invalid date due to conversion
-#
-set @@sql_mode='traditional';
-create table t1 (d date);
---error 1292
-insert into t1 values ('2000-10-00');
---error 1292
-insert into t1 values (1000);
-insert into t1 values ('2000-10-01');
---error 1292
-update t1 set d = 1100;
-select * from t1;
-drop table t1;
-
-#
-# Bug #11964: alter table with timestamp field
-#
-
-set @@sql_mode='traditional';
-create table t1(a int, b timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
-alter table t1 add primary key(a);
-show create table t1;
-drop table t1;
-create table t1(a int, b timestamp not null default 20050102030405);
-alter table t1 add primary key(a);
-show create table t1;
-drop table t1;
-
-#
-# BIT fields
-#
-
-set @@sql_mode='traditional';
-create table t1(a bit(2));
---error 1406
-insert into t1 values(b'101');
-select * from t1;
-drop table t1;
-
-#
-# Bug#17626 CREATE TABLE ... SELECT failure with TRADITIONAL SQL mode
-#
-set sql_mode='traditional';
-create table t1 (date date not null);
-create table t2 select date from t1;
-show create table t2;
-drop table t2,t1;
-set @@sql_mode= @org_mode;
-
-#
-# Bug #13934 Silent truncation of table comments
-#
-set @@sql_mode='traditional';
---error ER_TOO_LONG_TABLE_COMMENT
-create table t1 (i int)
-comment '123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*123456789*';
---error ER_TOO_LONG_FIELD_COMMENT
-create table t1 (
-i int comment
-'123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*');
-set @@sql_mode= @org_mode;
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-create table t1
-(i int comment
- '123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*
- 123456789*123456789*123456789*123456789*');
-
-select column_name, column_comment from information_schema.columns where
-table_schema = 'test' and table_name = 't1';
-drop table t1;
-
-set names utf8;
-create table t1 (i int)
-comment '123456789*123456789*123456789*123456789*123456789*123456789*';
-show create table t1;
-drop table t1;
-
-#
-# Bug #39591: Crash if table comment is longer than 62 characters
-#
-
-#60 chars, 120 (+1) bytes (UTF-8 with 2-byte chars)
-CREATE TABLE t3 (f1 INT) COMMENT 'כקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחןכקבהחן';
-SHOW CREATE TABLE t3;
-DROP TABLE t3;
-
-#
-# Bug #26359: Strings becoming truncated and converted to numbers under STRICT mode
-#
-set sql_mode= 'traditional';
-create table t1(col1 tinyint, col2 tinyint unsigned,
- col3 smallint, col4 smallint unsigned,
- col5 mediumint, col6 mediumint unsigned,
- col7 int, col8 int unsigned,
- col9 bigint, col10 bigint unsigned);
---error 1366
-insert into t1(col1) values('-');
---error 1366
-insert into t1(col2) values('+');
---error 1366
-insert into t1(col3) values('-');
---error 1366
-insert into t1(col4) values('+');
---error 1366
-insert into t1(col5) values('-');
---error 1366
-insert into t1(col6) values('+');
---error 1366
-insert into t1(col7) values('-');
---error 1366
-insert into t1(col8) values('+');
---error 1366
-insert into t1(col9) values('-');
---error 1366
-insert into t1(col10) values('+');
-drop table t1;
-
-#
-# Bug #27176: Assigning a string to an year column has unexpected results
-#
-set sql_mode='traditional';
-create table t1(a year);
---error 1366
-insert into t1 values ('-');
---error 1366
-insert into t1 values ('+');
---error 1366
-insert into t1 values ('');
---error 1265
-insert into t1 values ('2000a');
---error 1265
-insert into t1 values ('2E3x');
-drop table t1;
-
-#
-# Bug#27069 set with identical elements are created
-#
-set sql_mode='traditional';
---error 1291
-create table t1 (f1 set('a','a'));
---error 1291
-create table t1 (f1 enum('a','a'));
-
-#
-# Bug #22824: strict, datetime, NULL, wrong warning
-#
-set @@sql_mode='NO_ZERO_DATE';
-create table t1(a datetime not null);
-select count(*) from t1 where a is null;
-drop table t1;
-
---echo End of 5.0 tests
-
---echo #
---echo # Start of 5.6 tests
---echo #
-
---echo #
---echo # WL#946 TIME/TIMESTAMP/DATETIME with fractional seconds: CAST to DATETIME
---echo #
-
---echo #
---echo # STR_TO_DATE with NO_ZERO_DATE did not return NULL (with warning)
---echo # in get_date(). Only did in val_str() and val_int().
-SET sql_mode='NO_ZERO_DATE';
-SELECT STR_TO_DATE('2001','%Y'),CONCAT(STR_TO_DATE('2001','%Y')), STR_TO_DATE('2001','%Y')+1, STR_TO_DATE('0','%Y')+1, STR_TO_DATE('0000','%Y')+1;
-SET sql_mode='NO_ZERO_IN_DATE';
-SELECT STR_TO_DATE('2001','%Y'),CONCAT(STR_TO_DATE('2001','%Y')), STR_TO_DATE('2001','%Y')+1, STR_TO_DATE('0000','%Y')+1;
-
---echo #
---echo # End of 5.6 tests
---echo #
diff --git a/mysql-test/t/strict_autoinc_1myisam.test b/mysql-test/t/strict_autoinc_1myisam.test
deleted file mode 100644
index d9ecce30974..00000000000
--- a/mysql-test/t/strict_autoinc_1myisam.test
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# Bug#20573 Strict mode auto-increment
-#
-
-let $type= 'MYISAM' ;
---source include/strict_autoinc.inc
-
-# end of test
diff --git a/mysql-test/t/strict_autoinc_2innodb.test b/mysql-test/t/strict_autoinc_2innodb.test
deleted file mode 100644
index 83dfe950938..00000000000
--- a/mysql-test/t/strict_autoinc_2innodb.test
+++ /dev/null
@@ -1,10 +0,0 @@
--- source include/have_innodb.inc
-
-#
-# Bug#20573 Strict mode auto-increment
-#
-
-let $type= 'InnoDB' ;
---source include/strict_autoinc.inc
-
-# end of test
diff --git a/mysql-test/t/strict_autoinc_3heap.test b/mysql-test/t/strict_autoinc_3heap.test
deleted file mode 100644
index f266ecdfda2..00000000000
--- a/mysql-test/t/strict_autoinc_3heap.test
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# Bug#20573 Strict mode auto-increment
-#
-
-let $type= 'MEMORY' ;
---source include/strict_autoinc.inc
-
-# end of test
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
deleted file mode 100644
index c5cec99cebf..00000000000
--- a/mysql-test/t/subselect.test
+++ /dev/null
@@ -1,6153 +0,0 @@
-#
-# NOTE. Please do not switch connection inside this test.
-# subselect.test is included from several other test cases which set
-# explicit session properties that must be preserved throughout the test.
-# If you need to use a dedicated connection for a test case,
-# close the new connection and switch back to "default" as soon
-# as possible.
-#
-# Initialise
---disable_warnings
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t11,t12;
-drop view if exists v2;
---enable_warnings
-
-call mtr.add_suppression("Sort aborted.*");
-
-set @subselect_tmp=@@optimizer_switch;
-set @@optimizer_switch=ifnull(@optimizer_switch_for_subselect_test,
- "semijoin=on,firstmatch=on,loosescan=on,semijoin_with_cache=on,partial_match_rowid_merge=off,partial_match_table_scan=off");
-
-if (`select @join_cache_level_for_subselect_test is null`)
-{
- set join_cache_level=1;
-}
-if (`select @join_cache_level_for_subselect_test is not null`)
-{
- set join_cache_level=@join_cache_level_for_subselect_test;
-}
- set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
-
-select (select 2);
-explain extended select (select 2);
-SELECT (SELECT 1) UNION SELECT (SELECT 2);
-explain extended SELECT (SELECT 1) UNION SELECT (SELECT 2);
-SELECT (SELECT (SELECT 0 UNION SELECT 0));
-explain extended SELECT (SELECT (SELECT 0 UNION SELECT 0));
--- error ER_ILLEGAL_REFERENCE
-SELECT (SELECT 1 FROM (SELECT 1) as b HAVING a=1) as a;
--- error ER_ILLEGAL_REFERENCE
-SELECT (SELECT 1 FROM (SELECT 1) as b HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) as c HAVING a=1) as b;
-SELECT (SELECT 1),MAX(1) FROM (SELECT 1) as a;
--- error ER_ILLEGAL_REFERENCE
-SELECT (SELECT a) as a;
-EXPLAIN EXTENDED SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
-SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
--- error ER_BAD_FIELD_ERROR
-SELECT (SELECT 1), a;
-SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1;
--- error ER_BAD_FIELD_ERROR
-SELECT 1 FROM (SELECT (SELECT a) b) c;
-SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id);
--- error ER_OPERAND_COLUMNS
-SELECT * FROM (SELECT 1) a WHERE 1 IN (SELECT 1,1);
-SELECT 1 IN (SELECT 1);
-SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
--- error ER_PARSE_ERROR
-select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
--- error ER_PARSE_ERROR
-SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
--- error ER_BAD_FIELD_ERROR
-SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
--- error ER_BAD_FIELD_ERROR
-SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;
-SELECT (SELECT 1,2,3) = ROW(1,2,3);
-SELECT (SELECT 1,2,3) = ROW(1,2,1);
-SELECT (SELECT 1,2,3) < ROW(1,2,1);
-SELECT (SELECT 1,2,3) > ROW(1,2,1);
-SELECT (SELECT 1,2,3) = ROW(1,2,NULL);
-SELECT ROW(1,2,3) = (SELECT 1,2,3);
-SELECT ROW(1,2,3) = (SELECT 1,2,1);
-SELECT ROW(1,2,3) < (SELECT 1,2,1);
-SELECT ROW(1,2,3) > (SELECT 1,2,1);
-SELECT ROW(1,2,3) = (SELECT 1,2,NULL);
-SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a');
-SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b');
-SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b');
-SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a');
-SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a');
-SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a');
-
--- error ER_OPERAND_COLUMNS
-SELECT (SELECT * FROM (SELECT 'test' a,'test' b) a);
-
-SELECT 1 as a,(SELECT a+a) b,(SELECT b);
-
-create table t1 (a int);
-create table t2 (a int, b int);
-create table t3 (a int);
-create table t4 (a int not null, b int not null);
-insert into t1 values (2);
-insert into t2 values (1,7),(2,7);
-insert into t4 values (4,8),(3,8),(5,9);
--- error ER_ILLEGAL_REFERENCE
-select (select a from t1 where t1.a = a1) as a2, (select b from t2 where t2.b=a2) as a1;
-select (select a from t1 where t1.a=t2.a), a from t2;
-select (select a from t1 where t1.a=t2.b), a from t2;
-select (select a from t1), a, (select 1 union select 2 limit 1) from t2;
-select (select a from t3), a from t2;
-select * from t2 where t2.a=(select a from t1);
-insert into t3 values (6),(7),(3);
-select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1);
-(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 order by a limit 2) limit 3;
-(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a);
-explain extended (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a);
-select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
-select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from
-(select * from t2 where a>1) as tt;
-set @tmp_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='derived_merge=off,derived_with_keys=off';
-explain extended select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from
-(select * from t2 where a>1) as tt;
-set optimizer_switch=@tmp_optimizer_switch;
-select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1);
-select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3 where t3.a > t1.a) order by 1 desc limit 1);
-select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3 where t3.a < t1.a) order by 1 desc limit 1);
-select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
-explain extended select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
-select * from t3 where exists (select * from t2 where t2.b=t3.a);
-select * from t3 where not exists (select * from t2 where t2.b=t3.a);
-select * from t3 where a in (select b from t2);
-select * from t3 where a not in (select b from t2);
-select * from t3 where a = some (select b from t2);
-select * from t3 where a <> any (select b from t2);
-
-# Rewrite: select * from t3 where not exists (select b from t2 where a <> b);
-select * from t3 where a = all (select b from t2);
-
-select * from t3 where a <> all (select b from t2);
-insert into t2 values (100, 5);
-select * from t3 where a < any (select b from t2);
-select * from t3 where a < all (select b from t2);
-select * from t3 where a >= any (select b from t2);
-explain extended select * from t3 where a >= any (select b from t2);
-select * from t3 where a >= all (select b from t2);
-delete from t2 where a=100;
--- error ER_OPERAND_COLUMNS
-select * from t3 where a in (select a,b from t2);
--- error ER_OPERAND_COLUMNS
-select * from t3 where a in (select * from t2);
-insert into t4 values (12,7),(1,7),(10,9),(9,6),(7,6),(3,9),(1,10);
-# empty set
-select b,max(a) as ma from t4 group by b having b < (select max(t2.a) from t2 where t2.b=t4.b);
-insert into t2 values (2,10);
-select b,max(a) as ma from t4 group by b having ma < (select max(t2.a) from t2 where t2.b=t4.b);
-delete from t2 where a=2 and b=10;
-select b,max(a) as ma from t4 group by b having b >= (select max(t2.a) from t2 where t2.b=t4.b);
-create table t5 (a int);
-select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
-insert into t5 values (5);
-select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
-insert into t5 values (2);
-select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
-explain extended select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
--- error ER_SUBQUERY_NO_1_ROW
-select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
-create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
-create table t7( uq int primary key, name char(25));
-insert into t7 values(1,"Oblastnaia bolnitsa"),(2,"Bolnitsa Krasnogo Kresta");
-insert into t6 values (1,1),(1,2),(2,2),(1,3);
-select * from t6 where exists (select * from t7 where uq = clinic_uq);
-explain extended select * from t6 where exists (select * from t7 where uq = clinic_uq);
-
-# not unique fields
--- error ER_NON_UNIQ_ERROR
-select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
-
-# different tipes & group functions
-drop table t1,t2,t3;
-
-CREATE TABLE t3 (a varchar(20),b char(1) NOT NULL default '0');
-INSERT INTO t3 VALUES ('W','a'),('A','c'),('J','b');
-CREATE TABLE t2 (a varchar(20),b int NOT NULL default '0');
-INSERT INTO t2 VALUES ('W','1'),('A','3'),('J','2');
-CREATE TABLE t1 (a varchar(20),b date NOT NULL default '0000-00-00');
-INSERT INTO t1 VALUES ('W','1732-02-22'),('A','1735-10-30'),('J','1743-04-13');
-SELECT * FROM t1 WHERE b = (SELECT MIN(b) FROM t1);
-SELECT * FROM t2 WHERE b = (SELECT MIN(b) FROM t2);
-SELECT * FROM t3 WHERE b = (SELECT MIN(b) FROM t3);
-
-CREATE TABLE `t8` (
- `pseudo` varchar(35) character set latin1 NOT NULL default '',
- `email` varchar(60) character set latin1 NOT NULL default '',
- PRIMARY KEY (`pseudo`),
- UNIQUE KEY `email` (`email`)
-) ENGINE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-
-INSERT INTO t8 (pseudo,email) VALUES ('joce','test');
-INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1');
-INSERT INTO t8 (pseudo,email) VALUES ('2joce1','2test1');
-EXPLAIN EXTENDED SELECT pseudo,(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce')) FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
--- error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
-t8 WHERE pseudo='joce');
--- error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-SELECT pseudo FROM t8 WHERE pseudo=(SELECT * FROM t8 WHERE
-pseudo='joce');
-SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
--- error ER_SUBQUERY_NO_1_ROW
-SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo LIKE '%joce%');
-
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8;
-
-#searchconthardwarefr3 forumconthardwarefr7
-CREATE TABLE `t1` (
- `topic` mediumint(8) unsigned NOT NULL default '0',
- `date` date NOT NULL default '0000-00-00',
- `pseudo` varchar(35) character set latin1 NOT NULL default '',
- PRIMARY KEY (`pseudo`,`date`,`topic`),
- KEY `topic` (`topic`)
-) ENGINE=MyISAM ROW_FORMAT=DYNAMIC;
-INSERT INTO t1 (topic,date,pseudo) VALUES
-('43506','2002-10-02','joce'),('40143','2002-08-03','joce');
-EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
-EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
-SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
-SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
-SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1) UNION ALL SELECT 1;
--- error ER_SUBQUERY_NO_1_ROW
-SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1) UNION SELECT 1;
-EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1);
-drop table t1;
-
-#forumconthardwarefr7 searchconthardwarefr7
-CREATE TABLE `t1` (
- `numeropost` mediumint(8) unsigned NOT NULL auto_increment,
- `maxnumrep` int(10) unsigned NOT NULL default '0',
- PRIMARY KEY (`numeropost`),
- UNIQUE KEY `maxnumrep` (`maxnumrep`)
-) ENGINE=MyISAM ROW_FORMAT=FIXED;
-
-INSERT INTO t1 (numeropost,maxnumrep) VALUES (40143,1),(43506,2);
-
-CREATE TABLE `t2` (
- `mot` varchar(30) NOT NULL default '',
- `topic` mediumint(8) unsigned NOT NULL default '0',
- `date` date NOT NULL default '0000-00-00',
- `pseudo` varchar(35) NOT NULL default '',
- PRIMARY KEY (`mot`,`pseudo`,`date`,`topic`)
- ) ENGINE=MyISAM ROW_FORMAT=DYNAMIC;
-
-INSERT INTO t2 (mot,topic,date,pseudo) VALUES ('joce','40143','2002-10-22','joce'), ('joce','43506','2002-10-22','joce');
-select numeropost as a FROM t1 GROUP BY (SELECT 1 FROM t1 HAVING a=1);
-SELECT numeropost,maxnumrep FROM t1 WHERE exists (SELECT 1 FROM t2 WHERE (mot='joce') AND date >= '2002-10-21' AND t1.numeropost = t2.topic) ORDER BY maxnumrep DESC LIMIT 0, 20;
--- error ER_BAD_FIELD_ERROR
-SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) b;
--- error ER_BAD_FIELD_ERROR
-SELECT 1 IN (SELECT 1 FROM t2 HAVING a);
-
-SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY topic);
-SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100);
-SELECT * from t2 where topic IN (SELECT SUM(topic) FROM t1);
-SELECT * from t2 where topic = any (SELECT topic FROM t2 GROUP BY topic);
-SELECT * from t2 where topic = any (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100);
-SELECT * from t2 where topic = any (SELECT SUM(topic) FROM t1);
-SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic);
-SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100);
-SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) from t2;
-SELECT * from t2 where topic = all (SELECT SUM(topic) FROM t2);
-SELECT * from t2 where topic <> any (SELECT SUM(topic) FROM t2);
-SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000);
-SELECT * from t2 where topic = any (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000);
-SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000);
-SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) from t2;
-drop table t1,t2;
-
-#forumconthardwarefr7
-CREATE TABLE `t1` (
- `numeropost` mediumint(8) unsigned NOT NULL auto_increment,
- `maxnumrep` int(10) unsigned NOT NULL default '0',
- PRIMARY KEY (`numeropost`),
- UNIQUE KEY `maxnumrep` (`maxnumrep`)
-) ENGINE=MyISAM ROW_FORMAT=FIXED;
-
-INSERT INTO t1 (numeropost,maxnumrep) VALUES (1,0),(2,1);
--- error ER_SUBQUERY_NO_1_ROW
-select numeropost as a FROM t1 GROUP BY (SELECT 1 FROM t1 HAVING a=1);
--- error ER_SUBQUERY_NO_1_ROW
-select numeropost as a FROM t1 ORDER BY (SELECT 1 FROM t1 HAVING a=1);
-show warnings;
-drop table t1;
-
-create table t1 (a int);
-insert into t1 values (1),(2),(3);
-(select * from t1) union (select * from t1) order by (select a from t1 limit 1);
-drop table t1;
-
-#iftest
-CREATE TABLE t1 (field char(1) NOT NULL DEFAULT 'b');
-INSERT INTO t1 VALUES ();
--- error ER_SUBQUERY_NO_1_ROW
-SELECT field FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1 FROM (SELECT 1) a HAVING field='b');
-drop table t1;
-
-# threadhardwarefr7
-CREATE TABLE `t1` (
- `numeropost` mediumint(8) unsigned NOT NULL default '0',
- `numreponse` int(10) unsigned NOT NULL auto_increment,
- `pseudo` varchar(35) NOT NULL default '',
- PRIMARY KEY (`numeropost`,`numreponse`),
- UNIQUE KEY `numreponse` (`numreponse`),
- KEY `pseudo` (`pseudo`,`numeropost`)
-) ENGINE=MyISAM;
--- error ER_ILLEGAL_REFERENCE
-SELECT (SELECT numeropost FROM t1 HAVING numreponse=a),numreponse FROM (SELECT * FROM t1) as a;
--- error ER_BAD_FIELD_ERROR
-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');
-EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
-EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
-drop table t1;
-
-CREATE TABLE t1 (a int(1));
-INSERT INTO t1 VALUES (1);
-SELECT 1 FROM (SELECT a FROM t1) b HAVING (SELECT b.a)=1;
-drop table t1;
-
-#update with subselects
-create table t1 (a int NOT NULL, b int, primary key (a));
-create table t2 (a int NOT NULL, b int, primary key (a));
-insert into t1 values (0, 10),(1, 11),(2, 12);
-insert into t2 values (1, 21),(2, 22),(3, 23);
-select * from t1;
--- error ER_SUBQUERY_NO_1_ROW
-update t1 set b= (select b from t2);
-update t1 set b= (select b from t2 where t1.a = t2.a);
-select * from t1;
-drop table t1, t2;
-
-#delete with subselects
-create table t1 (a int NOT NULL, b int, primary key (a));
-create table t2 (a int NOT NULL, b int, primary key (a));
-insert into t1 values (0, 10),(1, 11),(2, 12);
-insert into t2 values (1, 21),(2, 12),(3, 23);
-select * from t1;
-select * from t1 where b = (select b from t2 where t1.a = t2.a);
-# Works since MDEV-12137
-# previously : ER_UPDATE_TABLE_USED
---enable_info
-delete from t1 where b in (select b from t1);
---disable_info
-insert into t1 values (0, 10),(1, 11),(2, 12);
--- error ER_SUBQUERY_NO_1_ROW
-delete from t1 where b = (select b from t2);
-delete from t1 where b = (select b from t2 where t1.a = t2.a);
-select * from t1 order by b;
-drop table t1, t2;
-
-#multi-delete with subselects
-
-create table t11 (a int NOT NULL, b int, primary key (a));
-create table t12 (a int NOT NULL, b int, primary key (a));
-create table t2 (a int NOT NULL, b int, primary key (a));
-insert into t11 values (0, 10),(1, 11),(2, 12);
-insert into t12 values (33, 10),(22, 11),(2, 12);
-insert into t2 values (1, 21),(2, 12),(3, 23);
-select * from t11;
-select * from t12;
--- error ER_UPDATE_TABLE_USED
-delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
--- error ER_SUBQUERY_NO_1_ROW
-delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
-delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
-select * from t11;
-select * from t12;
-drop table t11, t12, t2;
-
-#insert with subselects
-CREATE TABLE t1 (x int) ENGINE=MyISAM;
-create table t2 (a int) ENGINE=MyISAM;
-create table t3 (b int);
-insert into t2 values (1);
-insert into t3 values (1),(2);
--- error ER_UPDATE_TABLE_USED
-INSERT INTO t1 (x) VALUES ((SELECT x FROM t1));
--- error ER_SUBQUERY_NO_1_ROW
-INSERT INTO t1 (x) VALUES ((SELECT b FROM t3));
-INSERT INTO t1 (x) VALUES ((SELECT a FROM t2));
-select * from t1;
-insert into t2 values (1);
-let $row_count_before= `SELECT COUNT(*) FROM t1`;
-INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
-let $wait_condition= SELECT COUNT(*) <> $row_count_before FROM t1;
---source include/wait_condition.inc
-select * from t1;
-INSERT INTO t1 (x) select (SELECT SUM(a)+1 FROM t2) FROM t2;
-select * from t1;
-# After this, only data based on old t1 records should have been added.
-INSERT INTO t1 (x) select (SELECT SUM(x)+2 FROM t1) FROM t2;
-select * from t1;
--- error ER_BAD_FIELD_ERROR
-INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(x) FROM t2));
-let $row_count_before= `SELECT COUNT(*) FROM t1`;
-INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
-let $wait_condition= SELECT COUNT(*) <> $row_count_before FROM t1;
---source include/wait_condition.inc
-select * from t1;
-#
-#TODO: should be uncommented after Bug#380 fix pushed
-#INSERT INTO t1 (x) SELECT (SELECT SUM(a)+b FROM t2) from t3;
-#select * from t1;
-drop table t1, t2, t3;
-
-#replace with subselects
-CREATE TABLE t1 (x int not null, y int, primary key (x)) ENGINE=MyISAM;
-create table t2 (a int);
-create table t3 (a int);
-insert into t2 values (1);
-insert into t3 values (1),(2);
-select * from t1;
--- error ER_UPDATE_TABLE_USED
-replace into t1 (x, y) VALUES ((SELECT x FROM t1), (SELECT a+1 FROM t2));
--- error ER_SUBQUERY_NO_1_ROW
-replace into t1 (x, y) VALUES ((SELECT a FROM t3), (SELECT a+1 FROM t2));
-replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+1 FROM t2));
-select * from t1;
-replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+2 FROM t2));
-select * from t1;
-let $row_count_before= `SELECT COUNT(*) FROM t1`;
-replace DELAYED into t1 (x, y) VALUES ((SELECT a+3 FROM t2), (SELECT a FROM t2));
-# We get one additional row
-let $wait_condition= SELECT COUNT(*) <> $row_count_before FROM t1;
---source include/wait_condition.inc
-select * from t1;
-let $row_count_before= `SELECT COUNT(*) FROM t1 WHERE y = 2`;
-replace DELAYED into t1 (x, y) VALUES ((SELECT a+3 FROM t2), (SELECT a+1 FROM t2));
-let $wait_condition= SELECT COUNT(*) <> $row_count_before FROM t1 WHERE y = 2;
---source include/wait_condition.inc
-select * from t1;
-replace LOW_PRIORITY into t1 (x, y) VALUES ((SELECT a+1 FROM t2), (SELECT a FROM t2));
-select * from t1;
-drop table t1, t2, t3;
-
--- error ER_NO_TABLES_USED
-SELECT * FROM (SELECT 1) b WHERE 1 IN (SELECT *);
-
-CREATE TABLE t2 (id int(11) default NULL, KEY id (id)) ENGINE=MyISAM CHARSET=latin1;
-INSERT INTO t2 VALUES (1),(2);
-SELECT * FROM t2 WHERE id IN (SELECT 1);
-EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1);
-SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
-SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1));
-EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1));
-EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
-SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3);
-SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
--- error ER_UPDATE_TABLE_USED
-INSERT INTO t2 VALUES ((SELECT * FROM t2));
--- error ER_UPDATE_TABLE_USED
-INSERT INTO t2 VALUES ((SELECT id FROM t2));
-SELECT * FROM t2;
-CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) ENGINE=MyISAM CHARSET=latin1;
-INSERT INTO t1 values (1),(1);
--- error ER_SUBQUERY_NO_1_ROW
-UPDATE t2 SET id=(SELECT * FROM t1);
-drop table t2, t1;
-
-#NULL test
-create table t1 (a int);
-insert into t1 values (1),(2),(3);
-select 1 IN (SELECT * from t1);
-select 10 IN (SELECT * from t1);
-select NULL IN (SELECT * from t1);
-update t1 set a=NULL where a=2;
-select 1 IN (SELECT * from t1);
-select 3 IN (SELECT * from t1);
-select 10 IN (SELECT * from t1);
-select 1 > ALL (SELECT * from t1);
-select 10 > ALL (SELECT * from t1);
-select 1 > ANY (SELECT * from t1);
-select 10 > ANY (SELECT * from t1);
-drop table t1;
-create table t1 (a varchar(20));
-insert into t1 values ('A'),('BC'),('DEF');
-select 'A' IN (SELECT * from t1);
-select 'XYZS' IN (SELECT * from t1);
-select NULL IN (SELECT * from t1);
-update t1 set a=NULL where a='BC';
-select 'A' IN (SELECT * from t1);
-select 'DEF' IN (SELECT * from t1);
-select 'XYZS' IN (SELECT * from t1);
-select 'A' > ALL (SELECT * from t1);
-select 'XYZS' > ALL (SELECT * from t1);
-select 'A' > ANY (SELECT * from t1);
-select 'XYZS' > ANY (SELECT * from t1);
-drop table t1;
-create table t1 (a float);
-insert into t1 values (1.5),(2.5),(3.5);
-select 1.5 IN (SELECT * from t1);
-select 10.5 IN (SELECT * from t1);
-select NULL IN (SELECT * from t1);
-update t1 set a=NULL where a=2.5;
-select 1.5 IN (SELECT * from t1);
-select 3.5 IN (SELECT * from t1);
-select 10.5 IN (SELECT * from t1);
-select 1.5 > ALL (SELECT * from t1);
-select 10.5 > ALL (SELECT * from t1);
-select 1.5 > ANY (SELECT * from t1);
-select 10.5 > ANY (SELECT * from t1);
-explain extended select (select a+1) from t1;
-select (select a+1) from t1;
-drop table t1;
-
-#
-# Null with keys
-#
-
-CREATE TABLE t1 (a int(11) NOT NULL default '0', PRIMARY KEY (a));
-CREATE TABLE t2 (a int(11) default '0', INDEX (a));
-INSERT INTO t1 VALUES (1),(2),(3),(4);
-INSERT INTO t2 VALUES (1),(2),(3);
-SELECT t1.a, t1.a in (select t2.a from t2) FROM t1;
-explain extended SELECT t1.a, t1.a in (select t2.a from t2) FROM t1;
-CREATE TABLE t3 (a int(11) default '0');
-INSERT INTO t3 VALUES (1),(2),(3);
-SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1;
-explain extended SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1;
-drop table t1,t2,t3;
-
---echo # check correct NULL Processing for normal IN/ALL/ANY
---echo # and 2 ways of max/min optimization
-create table t1 (a int);
-insert into t1 values (1), (100), (NULL), (1000);
-create table t2 (a int not null);
-
---echo # subselect returns empty set (for NULL and non-NULL left part)
-select a, a in (select * from t2) from t1;
-select a, a > any (select * from t2) from t1;
-select a, a > all (select * from t2) from t1;
-select a from t1 where a in (select * from t2);
-select a from t1 where a > any (select * from t2);
-select a from t1 where a > all (select * from t2);
-select a from t1 where a in (select * from t2 group by a);
-select a from t1 where a > any (select * from t2 group by a);
-select a from t1 where a > all (select * from t2 group by a);
-
-insert into t2 values (1),(200);
-
---echo # sebselect returns non-empty set without NULLs
-select a, a in (select * from t2) from t1;
-select a, a > any (select * from t2) from t1;
-select a, a > all (select * from t2) from t1;
-select a from t1 where a in (select * from t2);
-select a from t1 where a > any (select * from t2);
-select a from t1 where a > all (select * from t2);
-select a from t1 where a in (select * from t2 group by a);
-select a from t1 where a > any (select * from t2 group by a);
-select a from t1 where a > all (select * from t2 group by a);
-
-drop table t2;
-create table t2 (a int);
-insert into t2 values (1),(NULL),(200);
-
---echo # sebselect returns non-empty set with NULLs
-select a, a in (select * from t2) from t1;
-select a, a > any (select * from t2) from t1;
-select a, a > all (select * from t2) from t1;
-select a from t1 where a in (select * from t2);
-select a from t1 where a > any (select * from t2);
-select a from t1 where a > all (select * from t2);
-select a from t1 where a in (select * from t2 group by a);
-select a from t1 where a > any (select * from t2 group by a);
-select a from t1 where a > all (select * from t2 group by a);
-
-
-drop table t1, t2;
-
-#LIMIT is not supported now
-create table t1 (a float);
--- error ER_NOT_SUPPORTED_YET
-select 10.5 IN (SELECT * from t1 LIMIT 1);
--- error ER_PARSE_ERROR
-select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5);
--- error ER_NOT_SUPPORTED_YET
-select 10.5 IN (SELECT * from t1 UNION SELECT 1.5 LIMIT 1);
-drop table t1;
-
-create table t1 (a int, b int, c varchar(10));
-create table t2 (a int);
-insert into t1 values (1,2,'a'),(2,3,'b'),(3,4,'c');
-insert into t2 values (1),(2),(NULL);
-select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a'),(select c from t1 where a=t2.a) from t2;
-select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b'),(select c from t1 where a=t2.a) from t2;
-select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c'),(select c from t1 where a=t2.a) from t2;
-drop table t1,t2;
-
-create table t1 (a int, b real, c varchar(10));
-insert into t1 values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b');
-select ROW(1, 1, 'a') IN (select a,b,c from t1);
-select ROW(1, 2, 'a') IN (select a,b,c from t1);
-select ROW(1, 1, 'a') IN (select b,a,c from t1);
-select ROW(1, 1, 'a') IN (select a,b,c from t1 where a is not null);
-select ROW(1, 2, 'a') IN (select a,b,c from t1 where a is not null);
-select ROW(1, 1, 'a') IN (select b,a,c from t1 where a is not null);
-select ROW(1, 1, 'a') IN (select a,b,c from t1 where c='b' or c='a');
-select ROW(1, 2, 'a') IN (select a,b,c from t1 where c='b' or c='a');
-select ROW(1, 1, 'a') IN (select b,a,c from t1 where c='b' or c='a');
--- error ER_NOT_SUPPORTED_YET
-select ROW(1, 1, 'a') IN (select b,a,c from t1 limit 2);
-drop table t1;
-
-#
-# DO & SET
-#
-create table t1 (a int);
-insert into t1 values (1);
-do @a:=(SELECT a from t1);
-select @a;
-set @a:=2;
-set @a:=(SELECT a from t1);
-select @a;
-drop table t1;
--- error ER_NO_SUCH_TABLE
-do (SELECT a from t1);
--- error ER_NO_SUCH_TABLE
-set @a:=(SELECT a from t1);
-
-CREATE TABLE t1 (a int, KEY(a));
-HANDLER t1 OPEN;
--- error ER_PARSE_ERROR
-HANDLER t1 READ a=((SELECT 1));
-HANDLER t1 CLOSE;
-drop table t1;
-
-create table t1 (a int);
-create table t2 (b int);
-insert into t1 values (1),(2);
-insert into t2 values (1);
-select a from t1 where a in (select a from t1 where a in (select b from t2));
-drop table t1, t2;
-
-create table t1 (a int, b int);
-create table t2 like t1;
-insert into t1 values (1,2),(1,3),(1,4),(1,5);
-insert into t2 values (1,2),(1,3);
-select * from t1 where row(a,b) in (select a,b from t2);
-drop table t1, t2;
-
-CREATE TABLE `t1` (`i` int(11) NOT NULL default '0',PRIMARY KEY (`i`)) ENGINE=MyISAM CHARSET=latin1;
-INSERT INTO t1 VALUES (1);
-UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
-select * from t1;
-drop table t1;
-
-#test of uncacheable subqueries
-CREATE TABLE t1 (a int(1));
-EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1;
-EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1;
-EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1;
-drop table t1;
-
-
-CREATE TABLE `t1` (
- `mot` varchar(30) character set latin1 NOT NULL default '',
- `topic` mediumint(8) unsigned NOT NULL default '0',
- `date` date NOT NULL default '0000-00-00',
- `pseudo` varchar(35) character set latin1 NOT NULL default '',
- PRIMARY KEY (`mot`,`pseudo`,`date`,`topic`),
- KEY `pseudo` (`pseudo`,`date`,`topic`),
- KEY `topic` (`topic`)
-) ENGINE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-
-CREATE TABLE `t2` (
- `mot` varchar(30) character set latin1 NOT NULL default '',
- `topic` mediumint(8) unsigned NOT NULL default '0',
- `date` date NOT NULL default '0000-00-00',
- `pseudo` varchar(35) character set latin1 NOT NULL default '',
- PRIMARY KEY (`mot`,`pseudo`,`date`,`topic`),
- KEY `pseudo` (`pseudo`,`date`,`topic`),
- KEY `topic` (`topic`)
-) ENGINE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC;
-
-CREATE TABLE `t3` (
- `numeropost` mediumint(8) unsigned NOT NULL auto_increment,
- `maxnumrep` int(10) unsigned NOT NULL default '0',
- PRIMARY KEY (`numeropost`),
- UNIQUE KEY `maxnumrep` (`maxnumrep`)
-) ENGINE=MyISAM CHARSET=latin1;
-INSERT IGNORE INTO t1 VALUES ('joce','1','','joce'),('test','2','','test');
-
-INSERT IGNORE INTO t2 VALUES ('joce','1','','joce'),('test','2','','test');
-
-INSERT INTO t3 VALUES (1,1);
-
-SELECT DISTINCT topic FROM t2 WHERE NOT EXISTS(SELECT * FROM t3 WHERE
-numeropost=topic);
-select * from t1;
-DELETE FROM t1 WHERE topic IN (SELECT DISTINCT topic FROM t2 WHERE NOT
-EXISTS(SELECT * FROM t3 WHERE numeropost=topic));
-select * from t1;
-
-drop table t1, t2, t3;
-
-SELECT * FROM (SELECT 1 as a,(SELECT a)) a;
-CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT 1)) a;
-SHOW CREATE TABLE t1;
-drop table t1;
-CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a)) a;
-SHOW CREATE TABLE t1;
-drop table t1;
-CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a;
-SHOW CREATE TABLE t1;
-drop table t1;
-CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a;
-select * from t1;
-SHOW CREATE TABLE t1;
-drop table t1;
-
-create table t1 (a int);
-insert into t1 values (1), (2), (3);
-explain extended select a,(select (select rand() from t1 limit 1) from t1 limit 1)
-from t1;
-drop table t1;
-
-#
-# error in IN
-#
--- error ER_NO_SUCH_TABLE
-select t1.Continent, t2.Name, t2.Population from t1 LEFT JOIN t2 ON t1.Code = t2.Country where t2.Population IN (select max(t2.Population) AS Population from t2, t1 where t2.Country = t1.Code group by Continent);
-
-#
-# complex subquery
-#
-
-CREATE TABLE t1 (
- ID int(11) NOT NULL auto_increment,
- name char(35) NOT NULL default '',
- t2 char(3) NOT NULL default '',
- District char(20) NOT NULL default '',
- Population int(11) NOT NULL default '0',
- PRIMARY KEY (ID)
-) ENGINE=MyISAM;
-
-INSERT INTO t1 VALUES (130,'Sydney','AUS','New South Wales',3276207);
-INSERT INTO t1 VALUES (131,'Melbourne','AUS','Victoria',2865329);
-INSERT INTO t1 VALUES (132,'Brisbane','AUS','Queensland',1291117);
-
-CREATE TABLE t2 (
- Code char(3) NOT NULL default '',
- Name char(52) NOT NULL default '',
- Continent enum('Asia','Europe','North America','Africa','Oceania','Antarctica','South America') NOT NULL default 'Asia',
- Region char(26) NOT NULL default '',
- SurfaceArea float(10,2) NOT NULL default '0.00',
- IndepYear smallint(6) default NULL,
- Population int(11) NOT NULL default '0',
- LifeExpectancy float(3,1) default NULL,
- GNP float(10,2) default NULL,
- GNPOld float(10,2) default NULL,
- LocalName char(45) NOT NULL default '',
- GovernmentForm char(45) NOT NULL default '',
- HeadOfState char(60) default NULL,
- Capital int(11) default NULL,
- Code2 char(2) NOT NULL default '',
- PRIMARY KEY (Code)
-) ENGINE=MyISAM;
-
-INSERT INTO t2 VALUES ('AUS','Australia','Oceania','Australia and New Zealand',7741220.00,1901,18886000,79.8,351182.00,392911.00,'Australia','Constitutional Monarchy, Federation','Elisabeth II',135,'AU');
-INSERT INTO t2 VALUES ('AZE','Azerbaijan','Asia','Middle East',86600.00,1991,7734000,62.9,4127.00,4100.00,'Azärbaycan','Federal Republic','Heydär Äliyev',144,'AZ');
-
-select t2.Continent, t1.Name, t1.Population from t2 LEFT JOIN t1 ON t2.Code = t1.t2 where t1.Population IN (select max(t1.Population) AS Population from t1, t2 where t1.t2 = t2.Code group by Continent);
-
-drop table t1, t2;
-
-#
-# constants in IN
-#
-CREATE TABLE `t1` (
- `id` mediumint(8) unsigned NOT NULL auto_increment,
- `pseudo` varchar(35) character set latin1 NOT NULL default '',
- PRIMARY KEY (`id`),
- UNIQUE KEY `pseudo` (`pseudo`)
-) ENGINE=MyISAM PACK_KEYS=1 ROW_FORMAT=DYNAMIC;
-INSERT INTO t1 (pseudo) VALUES ('test');
-SELECT 0 IN (SELECT 1 FROM t1 a);
-EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a);
-INSERT INTO t1 (pseudo) VALUES ('test1');
-SELECT 0 IN (SELECT 1 FROM t1 a);
-EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a);
-drop table t1;
-
-CREATE TABLE `t1` (
- `i` int(11) NOT NULL default '0',
- PRIMARY KEY (`i`)
-) ENGINE=MyISAM CHARSET=latin1;
-
-INSERT INTO t1 VALUES (1);
-UPDATE t1 SET i=i+(SELECT MAX(i) FROM (SELECT 1) t) WHERE i=(SELECT MAX(i));
-UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
--- error ER_BAD_FIELD_ERROR
-UPDATE t1 SET t.i=i+(SELECT MAX(i) FROM (SELECT 1) t);
-select * from t1;
-drop table t1;
-
-#
-# Multi update test
-#
-CREATE TABLE t1 (
- id int(11) default NULL
-) ENGINE=MyISAM CHARSET=latin1;
-INSERT INTO t1 VALUES (1),(1),(2),(2),(1),(3);
-CREATE TABLE t2 (
- id int(11) default NULL,
- name varchar(15) default NULL
-) ENGINE=MyISAM CHARSET=latin1;
-
-INSERT INTO t2 VALUES (4,'vita'), (1,'vita'), (2,'vita'), (1,'vita');
-update t1, t2 set t2.name='lenka' where t2.id in (select id from t1);
-select * from t2;
-drop table t1,t2;
-
-#
-# correct NULL in <CONSTANT> IN (SELECT ...)
-#
-create table t1 (a int, unique index indexa (a));
-insert into t1 values (-1), (-4), (-2), (NULL);
-select -10 IN (select a from t1 FORCE INDEX (indexa));
-drop table t1;
-
-#
-# Test optimization for sub selects
-#
-create table t1 (id int not null auto_increment primary key, salary int, key(salary));
-insert into t1 (salary) values (100),(1000),(10000),(10),(500),(5000),(50000);
-explain extended SELECT id FROM t1 where salary = (SELECT MAX(salary) FROM t1);
-drop table t1;
-
-CREATE TABLE t1 (
- ID int(10) unsigned NOT NULL auto_increment,
- SUB_ID int(3) unsigned NOT NULL default '0',
- REF_ID int(10) unsigned default NULL,
- REF_SUB int(3) unsigned default '0',
- PRIMARY KEY (ID,SUB_ID),
- UNIQUE KEY t1_PK (ID,SUB_ID),
- KEY t1_FK (REF_ID,REF_SUB),
- KEY t1_REFID (REF_ID)
-) ENGINE=MyISAM CHARSET=cp1251;
-INSERT INTO t1 VALUES (1,0,NULL,NULL),(2,0,NULL,NULL);
-SELECT DISTINCT REF_ID FROM t1 WHERE ID= (SELECT DISTINCT REF_ID FROM t1 WHERE ID=2);
-DROP TABLE t1;
-
-#
-# uninterruptable update
-#
-create table t1 (a int, b int);
-create table t2 (a int, b int);
-
-insert into t1 values (1,0), (2,0), (3,0);
-insert into t2 values (1,1), (2,1), (3,1), (2,2);
-
-update ignore t1 set b=(select b from t2 where t1.a=t2.a);
-select * from t1;
-
-drop table t1, t2;
-
-#
-# reduced subselect in ORDER BY & GROUP BY clauses
-#
-
-CREATE TABLE `t1` (
- `id` mediumint(8) unsigned NOT NULL auto_increment,
- `pseudo` varchar(35) NOT NULL default '',
- `email` varchar(60) NOT NULL default '',
- PRIMARY KEY (`id`),
- UNIQUE KEY `email` (`email`),
- UNIQUE KEY `pseudo` (`pseudo`)
-) ENGINE=MyISAM CHARSET=latin1 PACK_KEYS=1 ROW_FORMAT=DYNAMIC;
-INSERT INTO t1 (id,pseudo,email) VALUES (1,'test','test'),(2,'test1','test1');
-SELECT pseudo as a, pseudo as b FROM t1 GROUP BY (SELECT a) ORDER BY (SELECT id*1);
-drop table if exists t1;
-
-(SELECT 1 as a) UNION (SELECT 1) ORDER BY (SELECT a+0);
-
-#
-# IN subselect optimization test
-#
-create table t1 (a int not null, b int, primary key (a));
-create table t2 (a int not null, primary key (a));
-create table t3 (a int not null, b int, primary key (a));
-insert into t1 values (1,10), (2,20), (3,30), (4,40);
-insert into t2 values (2), (3), (4), (5);
-insert into t3 values (10,3), (20,4), (30,5);
-select * from t2 where t2.a in (select a from t1);
-explain extended select * from t2 where t2.a in (select a from t1);
-select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
-explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
-select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
-explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
-drop table t1, t2, t3;
-create table t1 (a int, b int, index a (a,b));
-create table t2 (a int, index a (a));
-create table t3 (a int, b int, index a (a));
-insert into t1 values (1,10), (2,20), (3,30), (4,40);
-# making table large enough
-create table t0(a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-insert into t1
-select rand()*100000+200,rand()*100000 from t0 A, t0 B, t0 C, t0 D;
-
-insert into t2 values (2), (3), (4), (5);
-insert into t3 values (10,3), (20,4), (30,5);
-select * from t2 where t2.a in (select a from t1);
-explain extended select * from t2 where t2.a in (select a from t1);
-select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
-explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
-select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
-explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
-insert into t1 values (3,31);
-select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
-select * from t2 where t2.a in (select a from t1 where t1.b <> 30 and t1.b <> 31);
-explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
-drop table t0, t1, t2, t3;
-
-#
-# alloc_group_fields() working
-#
-create table t1 (a int, b int);
-create table t2 (a int, b int);
-create table t3 (a int, b int);
-insert into t1 values (0,100),(1,2), (1,3), (2,2), (2,7), (2,-1), (3,10);
-insert into t2 values (0,0), (1,1), (2,1), (3,1), (4,1);
-insert into t3 values (3,3), (2,2), (1,1);
-select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3;
-drop table t1,t2,t3;
-
-#
-# aggregate functions in HAVING test
-#
-create table t1 (s1 int);
-create table t2 (s1 int);
-insert into t1 values (1);
-insert into t2 values (1);
-select * from t1 where exists (select s1 from t2 having max(t2.s1)=t1.s1);
-drop table t1,t2;
-
-#
-# update subquery with wrong field (to force name resolving
-# in UPDATE name space)
-#
-create table t1 (s1 int);
-create table t2 (s1 int);
-insert into t1 values (1);
-insert into t2 values (1);
--- error ER_BAD_FIELD_ERROR
-update t1 set s1 = s1 + 1 where 1 = (select x.s1 as A from t2 WHERE t2.s1 > t1.s1 order by A);
-DROP TABLE t1, t2;
-
-#
-# collation test
-#
-CREATE TABLE t1 (s1 CHAR(5) COLLATE latin1_german1_ci,
- s2 CHAR(5) COLLATE latin1_swedish_ci);
-INSERT INTO t1 VALUES ('z','?');
--- error ER_CANT_AGGREGATE_2COLLATIONS
-select * from t1 where s1 > (select max(s2) from t1);
--- error ER_CANT_AGGREGATE_2COLLATIONS
-select * from t1 where s1 > any (select max(s2) from t1);
-drop table t1;
-
-#
-# aggregate functions reinitialization
-#
-create table t1(toid int,rd int);
-create table t2(userid int,pmnew int,pmtotal int);
-insert into t2 values(1,0,0),(2,0,0);
-insert into t1 values(1,0),(1,0),(1,0),(1,12),(1,15),(1,123),(1,12312),(1,12312),(1,123),(2,0),(2,0),(2,1),(2,2);
-select userid,pmtotal,pmnew, (select count(rd) from t1 where toid=t2.userid) calc_total, (select count(rd) from t1 where rd=0 and toid=t2.userid) calc_new from t2 where userid in (select distinct toid from t1);
-drop table t1, t2;
-
-#
-# row union
-#
-create table t1 (s1 char(5));
--- error ER_OPERAND_COLUMNS
-select (select 'a','b' from t1 union select 'a','b' from t1) from t1;
-insert into t1 values ('tttt');
-select * from t1 where ('a','b')=(select 'a','b' from t1 union select 'a','b' from t1);
-explain extended (select * from t1);
-(select * from t1);
-drop table t1;
-
-#
-# IN optimisation test results
-#
-create table t1 (s1 char(5), index s1(s1));
-create table t2 (s1 char(5), index s1(s1));
-insert into t1 values ('a1'),('a2'),('a3');
-insert into t2 values ('a1'),('a2');
-select s1, s1 NOT IN (SELECT s1 FROM t2) from t1;
-select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
-select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
-select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
-explain extended select s1, s1 NOT IN (SELECT s1 FROM t2) from t1;
-explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
-explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
-explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
-drop table t1,t2;
-
-#
-# correct ALL optimisation
-#
-create table t2 (a int, b int not null);
-create table t3 (a int);
-insert into t3 values (6),(7),(3);
-select * from t3 where a >= all (select b from t2);
-explain extended select * from t3 where a >= all (select b from t2);
-select * from t3 where a >= some (select b from t2);
-explain extended select * from t3 where a >= some (select b from t2);
-select * from t3 where a >= all (select b from t2 group by 1);
-explain extended select * from t3 where a >= all (select b from t2 group by 1);
-select * from t3 where a >= some (select b from t2 group by 1);
-explain extended select * from t3 where a >= some (select b from t2 group by 1);
-select * from t3 where NULL >= any (select b from t2);
-explain extended select * from t3 where NULL >= any (select b from t2);
-select * from t3 where NULL >= any (select b from t2 group by 1);
-explain extended select * from t3 where NULL >= any (select b from t2 group by 1);
-select * from t3 where NULL >= some (select b from t2);
-explain extended select * from t3 where NULL >= some (select b from t2);
-select * from t3 where NULL >= some (select b from t2 group by 1);
-explain extended select * from t3 where NULL >= some (select b from t2 group by 1);
-#
-# optimized static ALL/ANY with grouping
-#
-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);
-explain extended select * from t3 where a > all (select max(b) from t2 group by a);
-drop table t2, t3;
-
-#
-# correct used_tables()
-#
-
-CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ;
-INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now());
-CREATE TABLE `t2` (`db_id` int(11) NOT NULL auto_increment,`name` varchar(200) NOT NULL default '',`primary_uid` smallint(6) NOT NULL default '0',`secondary_uid` smallint(6) NOT NULL default '0',PRIMARY KEY (`db_id`),UNIQUE KEY `name_2` (`name`),FULLTEXT KEY `name` (`name`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=2147483647;
-INSERT INTO `t2` (`db_id`, `name`, `primary_uid`, `secondary_uid`) VALUES (18, 'Not Set 1', 0, 0),(19, 'Valid', 1, 2),(20, 'Valid 2', 1, 2),(21, 'Should Not Return', 1, 2),(26, 'Not Set 2', 0, 0),(-1, 'ALL DB\'S', 0, 0);
-CREATE TABLE `t3` (`taskgenid` mediumint(9) NOT NULL auto_increment,`dbid` int(11) NOT NULL default '0',`taskid` int(11) NOT NULL default '0',`mon` tinyint(4) NOT NULL default '1',`tues` tinyint(4) NOT NULL default '1',`wed` tinyint(4) NOT NULL default '1',`thur` tinyint(4) NOT NULL default '1',`fri` tinyint(4) NOT NULL default '1',`sat` tinyint(4) NOT NULL default '0',`sun` tinyint(4) NOT NULL default '0',`how_often` smallint(6) NOT NULL default '1',`userid` smallint(6) NOT NULL default '0',`active` tinyint(4) NOT NULL default '1',PRIMARY KEY (`taskgenid`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=2 ;
-INSERT INTO `t3` (`taskgenid`, `dbid`, `taskid`, `mon`, `tues`,`wed`, `thur`, `fri`, `sat`, `sun`, `how_often`, `userid`, `active`) VALUES (1,-1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1);
-CREATE TABLE `t4` (`task_id` smallint(6) NOT NULL default '0',`description` varchar(200) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
-INSERT INTO `t4` (`task_id`, `description`) VALUES (1, 'Daily Check List'),(2, 'Weekly Status');
-select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid;
-SELECT dbid, name FROM t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND ((date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01')) AND t4.task_id = taskid;
-drop table t1,t2,t3,t4;
-
-#
-# cardinality check
-#
-CREATE TABLE t1 (id int(11) default NULL) ENGINE=MyISAM CHARSET=latin1;
-INSERT INTO t1 VALUES (1),(5);
-CREATE TABLE t2 (id int(11) default NULL) ENGINE=MyISAM CHARSET=latin1;
-INSERT INTO t2 VALUES (2),(6);
--- error ER_OPERAND_COLUMNS
-select * from t1 where (1,2,6) in (select * from t2);
-DROP TABLE t1,t2;
-
-#
-# DO and SET with errors
-#
-create table t1 (s1 int);
-insert into t1 values (1);
-insert into t1 values (2);
--- error ER_SUBQUERY_NO_1_ROW
-set sort_buffer_size = (select s1 from t1);
-do (select * from t1);
-drop table t1;
-
-#
-# optimized ALL/ANY with union
-#
-create table t1 (s1 char);
-insert into t1 values ('e');
-select * from t1 where 'f' > any (select s1 from t1);
-select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1);
-explain extended select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1);
-drop table t1;
-
-#
-# filesort in subquery (restoring join_tab)
-#
-CREATE TABLE t1 (number char(11) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
-INSERT INTO t1 VALUES ('69294728265'),('18621828126'),('89356874041'),('95895001874');
-CREATE TABLE t2 (code char(5) NOT NULL default '',UNIQUE KEY code (code)) ENGINE=MyISAM CHARSET=latin1;
-INSERT INTO t2 VALUES ('1'),('1226'),('1245'),('1862'),('18623'),('1874'),('1967'),('6');
-select c.number as phone,(select p.code from t2 p where c.number like concat(p.code, '%') order by length(p.code) desc limit 1) as code from t1 c;
-drop table t1, t2;
-
-#
-# unresolved field error
-#
-create table t1 (s1 int);
-create table t2 (s1 int);
--- error ER_BAD_FIELD_ERROR
-select * from t1 where (select count(*) from t2 where t1.s2) = 1;
--- error ER_BAD_FIELD_ERROR
-select * from t1 where (select count(*) from t2 group by t1.s2) = 1;
--- error ER_BAD_FIELD_ERROR
-select count(*) from t2 group by t1.s2;
-drop table t1, t2;
-
-#
-# fix_fields() in add_ref_to_table_cond()
-#
-CREATE TABLE t1(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC VARCHAR(20) DEFAULT NULL,PRIMARY KEY (COLA, COLB));
-CREATE TABLE t2(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC CHAR(1) NOT NULL,PRIMARY KEY (COLA));
-INSERT INTO t1 VALUES (1,1,'1A3240'), (1,2,'4W2365');
-INSERT INTO t2 VALUES (100, 200, 'C');
-SELECT DISTINCT COLC FROM t1 WHERE COLA = (SELECT COLA FROM t2 WHERE COLB = 200 AND COLC ='C' LIMIT 1);
-DROP TABLE t1, t2;
-
-CREATE TABLE t1 (a int(1));
-INSERT INTO t1 VALUES (1),(1),(1),(1),(1),(2),(3),(4),(5);
-SELECT DISTINCT (SELECT a) FROM t1 LIMIT 100;
-DROP TABLE t1;
-
-
-#
-# Bug#2198 SELECT INTO OUTFILE (with Sub-Select) Problem
-#
-
-create table t1 (a int, b decimal(13, 3));
-insert into t1 values (1, 0.123);
-let $outfile_abs= $MYSQLTEST_VARDIR/tmp/subselect.out.file.1;
-let $outfile_rel= ../../tmp/subselect.out.file.1;
---error 0,1
---remove_file $outfile_abs
-eval select a, (select max(b) from t1) into outfile "$outfile_rel" from t1;
-delete from t1;
-eval load data infile "$outfile_rel" into table t1;
---remove_file $outfile_abs
-select * from t1;
-drop table t1;
-
-
-#
-# Bug#2479 dependant subquery with limit crash
-#
-
-CREATE TABLE `t1` (
- `id` int(11) NOT NULL auto_increment,
- `id_cns` tinyint(3) unsigned NOT NULL default '0',
- `tipo` enum('','UNO','DUE') NOT NULL default '',
- `anno_dep` smallint(4) unsigned zerofill NOT NULL default '0000',
- `particolare` mediumint(8) unsigned NOT NULL default '0',
- `generale` mediumint(8) unsigned NOT NULL default '0',
- `bis` tinyint(3) unsigned NOT NULL default '0',
- PRIMARY KEY (`id`),
- UNIQUE KEY `idx_cns_gen_anno` (`anno_dep`,`id_cns`,`generale`,`particolare`),
- UNIQUE KEY `idx_cns_par_anno` (`id_cns`,`anno_dep`,`tipo`,`particolare`,`bis`)
-);
-INSERT INTO `t1` VALUES (1,16,'UNO',1987,2048,9681,0),(2,50,'UNO',1987,1536,13987,0),(3,16,'UNO',1987,2432,14594,0),(4,16,'UNO',1987,1792,13422,0),(5,16,'UNO',1987,1025,10240,0),(6,16,'UNO',1987,1026,7089,0);
-CREATE TABLE `t2` (
- `id` tinyint(3) unsigned NOT NULL auto_increment,
- `max_anno_dep` smallint(6) unsigned NOT NULL default '0',
- PRIMARY KEY (`id`)
-);
-INSERT INTO `t2` VALUES (16,1987),(50,1990),(51,1990);
-
-SELECT cns.id, cns.max_anno_dep, cns.max_anno_dep = (SELECT s.anno_dep FROM t1 AS s WHERE s.id_cns = cns.id ORDER BY s.anno_dep DESC LIMIT 1) AS PIPPO FROM t2 AS cns;
-
-DROP TABLE t1, t2;
-
-#
-# GLOBAL LIMIT
-#
-create table t1 (a int);
-insert into t1 values (1), (2), (3);
-SET SQL_SELECT_LIMIT=1;
-select sum(a) from (select * from t1) as a;
-select 2 in (select * from t1);
-SET SQL_SELECT_LIMIT=default;
-drop table t1;
-
-
-#
-# Bug#3118 subselect + order by
-#
-
-CREATE TABLE t1 (a int, b int, INDEX (a));
-INSERT INTO t1 VALUES (1, 1), (1, 2), (1, 3);
-SELECT * FROM t1 WHERE a = (SELECT MAX(a) FROM t1 WHERE a = 1) ORDER BY b;
-DROP TABLE t1;
-
-# Item_cond fix field
-#
-create table t1(val varchar(10));
-insert into t1 values ('aaa'), ('bbb'),('eee'),('mmm'),('ppp');
-select count(*) from t1 as w1 where w1.val in (select w2.val from t1 as w2 where w2.val like 'm%') and w1.val in (select w3.val from t1 as w3 where w3.val like 'e%');
-drop table t1;
-
-#
-# ref_or_null replacing with ref
-#
-create table t1 (id int not null, text varchar(20) not null default '', primary key (id));
-insert into t1 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text11'), (12, 'text12');
-select * from t1 where id not in (select id from t1 where id < 8);
-select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null);
-explain extended select * from t1 where id not in (select id from t1 where id < 8);
-explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null);
-insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
-create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
-insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10');
-select * from t1 a left join t2 b on (a.id=b.id or b.id is null) join t1 c on (if(isnull(b.id), 1000, b.id)=c.id);
-explain extended select * from t1 a left join t2 b on (a.id=b.id or b.id is null) join t1 c on (if(isnull(b.id), 1000, b.id)=c.id);
-drop table t1,t2;
-
-#
-# Static tables & rund() in subqueries
-#
-create table t1 (a int);
-insert into t1 values (1);
-explain select benchmark(1000, (select a from t1 where a=sha(rand())));
-drop table t1;
-
-
-#
-# Bug#3188 Ambiguous Column in Subselect crashes server
-#
-create table t1(id int);
-create table t2(id int);
-create table t3(flag int);
--- error ER_PARSE_ERROR
-select (select * from t3 where id not null) from t1, t2;
-drop table t1,t2,t3;
-
-
-#
-# aggregate functions (Bug#3505 Wrong results on use of ORDER BY with subqueries)
-#
-CREATE TABLE t1 (id INT);
-CREATE TABLE t2 (id INT);
-INSERT INTO t1 VALUES (1), (2);
-INSERT INTO t2 VALUES (1);
-SELECT t1.id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id);
-SELECT id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id);
-SELECT t1.id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id) ORDER BY t1.id;
-SELECT id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id) ORDER BY id;
-DROP TABLE t1,t2;
-
-#
-# ALL/ANY test
-#
-CREATE TABLE t1 ( a int, b int );
-INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
-SELECT a FROM t1 WHERE a > ANY ( SELECT a FROM t1 WHERE b = 2 );
-SELECT a FROM t1 WHERE a < ANY ( SELECT a FROM t1 WHERE b = 2 );
-SELECT a FROM t1 WHERE a = ANY ( SELECT a FROM t1 WHERE b = 2 );
-SELECT a FROM t1 WHERE a >= ANY ( SELECT a FROM t1 WHERE b = 2 );
-SELECT a FROM t1 WHERE a <= ANY ( SELECT a FROM t1 WHERE b = 2 );
-SELECT a FROM t1 WHERE a <> ANY ( SELECT a FROM t1 WHERE b = 2 );
-SELECT a FROM t1 WHERE a > ALL ( SELECT a FROM t1 WHERE b = 2 );
-SELECT a FROM t1 WHERE a < ALL ( SELECT a FROM t1 WHERE b = 2 );
-SELECT a FROM t1 WHERE a = ALL ( SELECT a FROM t1 WHERE b = 2 );
-SELECT a FROM t1 WHERE a >= ALL ( SELECT a FROM t1 WHERE b = 2 );
-SELECT a FROM t1 WHERE a <= ALL ( SELECT a FROM t1 WHERE b = 2 );
-SELECT a FROM t1 WHERE a <> ALL ( SELECT a FROM t1 WHERE b = 2 );
-# with index
-ALTER TABLE t1 ADD INDEX (a);
-SELECT a FROM t1 WHERE a > ANY ( SELECT a FROM t1 WHERE b = 2 );
-SELECT a FROM t1 WHERE a < ANY ( SELECT a FROM t1 WHERE b = 2 );
-SELECT a FROM t1 WHERE a = ANY ( SELECT a FROM t1 WHERE b = 2 );
-SELECT a FROM t1 WHERE a >= ANY ( SELECT a FROM t1 WHERE b = 2 );
-SELECT a FROM t1 WHERE a <= ANY ( SELECT a FROM t1 WHERE b = 2 );
-SELECT a FROM t1 WHERE a <> ANY ( SELECT a FROM t1 WHERE b = 2 );
-SELECT a FROM t1 WHERE a > ALL ( SELECT a FROM t1 WHERE b = 2 );
-SELECT a FROM t1 WHERE a < ALL ( SELECT a FROM t1 WHERE b = 2 );
-SELECT a FROM t1 WHERE a = ALL ( SELECT a FROM t1 WHERE b = 2 );
-SELECT a FROM t1 WHERE a >= ALL ( SELECT a FROM t1 WHERE b = 2 );
-SELECT a FROM t1 WHERE a <= ALL ( SELECT a FROM t1 WHERE b = 2 );
-SELECT a FROM t1 WHERE a <> ALL ( SELECT a FROM t1 WHERE b = 2 );
-# having clause test
-SELECT a FROM t1 WHERE a > ANY (SELECT a FROM t1 HAVING a = 2);
-SELECT a FROM t1 WHERE a < ANY (SELECT a FROM t1 HAVING a = 2);
-SELECT a FROM t1 WHERE a = ANY (SELECT a FROM t1 HAVING a = 2);
-SELECT a FROM t1 WHERE a >= ANY (SELECT a FROM t1 HAVING a = 2);
-SELECT a FROM t1 WHERE a <= ANY (SELECT a FROM t1 HAVING a = 2);
-SELECT a FROM t1 WHERE a <> ANY (SELECT a FROM t1 HAVING a = 2);
-SELECT a FROM t1 WHERE a > ALL (SELECT a FROM t1 HAVING a = 2);
-SELECT a FROM t1 WHERE a < ALL (SELECT a FROM t1 HAVING a = 2);
-SELECT a FROM t1 WHERE a = ALL (SELECT a FROM t1 HAVING a = 2);
-SELECT a FROM t1 WHERE a >= ALL (SELECT a FROM t1 HAVING a = 2);
-SELECT a FROM t1 WHERE a <= ALL (SELECT a FROM t1 HAVING a = 2);
-SELECT a FROM t1 WHERE a <> ALL (SELECT a FROM t1 HAVING a = 2);
-# union test
-SELECT a FROM t1 WHERE a > ANY (SELECT a FROM t1 WHERE b = 2 UNION SELECT a FROM t1 WHERE b = 2);
-SELECT a FROM t1 WHERE a < ANY (SELECT a FROM t1 WHERE b = 2 UNION SELECT a FROM t1 WHERE b = 2);
-SELECT a FROM t1 WHERE a = ANY (SELECT a FROM t1 WHERE b = 2 UNION SELECT a FROM t1 WHERE b = 2);
-SELECT a FROM t1 WHERE a >= ANY (SELECT a FROM t1 WHERE b = 2 UNION SELECT a FROM t1 WHERE b = 2);
-SELECT a FROM t1 WHERE a <= ANY (SELECT a FROM t1 WHERE b = 2 UNION SELECT a FROM t1 WHERE b = 2);
-SELECT a FROM t1 WHERE a <> ANY (SELECT a FROM t1 WHERE b = 2 UNION SELECT a FROM t1 WHERE b = 2);
-SELECT a FROM t1 WHERE a > ALL (SELECT a FROM t1 WHERE b = 2 UNION SELECT a FROM t1 WHERE b = 2);
-SELECT a FROM t1 WHERE a < ALL (SELECT a FROM t1 WHERE b = 2 UNION SELECT a FROM t1 WHERE b = 2);
-SELECT a FROM t1 WHERE a = ALL (SELECT a FROM t1 WHERE b = 2 UNION SELECT a FROM t1 WHERE b = 2);
-SELECT a FROM t1 WHERE a >= ALL (SELECT a FROM t1 WHERE b = 2 UNION SELECT a FROM t1 WHERE b = 2);
-SELECT a FROM t1 WHERE a <= ALL (SELECT a FROM t1 WHERE b = 2 UNION SELECT a FROM t1 WHERE b = 2);
-SELECT a FROM t1 WHERE a <> ALL (SELECT a FROM t1 WHERE b = 2 UNION SELECT a FROM t1 WHERE b = 2);
-# union + having test
-SELECT a FROM t1 WHERE a > ANY (SELECT a FROM t1 HAVING a = 2 UNION SELECT a FROM t1 HAVING a = 2);
-SELECT a FROM t1 WHERE a < ANY (SELECT a FROM t1 HAVING a = 2 UNION SELECT a FROM t1 HAVING a = 2);
-SELECT a FROM t1 WHERE a = ANY (SELECT a FROM t1 HAVING a = 2 UNION SELECT a FROM t1 HAVING a = 2);
-SELECT a FROM t1 WHERE a >= ANY (SELECT a FROM t1 HAVING a = 2 UNION SELECT a FROM t1 HAVING a = 2);
-SELECT a FROM t1 WHERE a <= ANY (SELECT a FROM t1 HAVING a = 2 UNION SELECT a FROM t1 HAVING a = 2);
-SELECT a FROM t1 WHERE a <> ANY (SELECT a FROM t1 HAVING a = 2 UNION SELECT a FROM t1 HAVING a = 2);
-SELECT a FROM t1 WHERE a > ALL (SELECT a FROM t1 HAVING a = 2 UNION SELECT a FROM t1 HAVING a = 2);
-SELECT a FROM t1 WHERE a < ALL (SELECT a FROM t1 HAVING a = 2 UNION SELECT a FROM t1 HAVING a = 2);
-SELECT a FROM t1 WHERE a = ALL (SELECT a FROM t1 HAVING a = 2 UNION SELECT a FROM t1 HAVING a = 2);
-SELECT a FROM t1 WHERE a >= ALL (SELECT a FROM t1 HAVING a = 2 UNION SELECT a FROM t1 HAVING a = 2);
-SELECT a FROM t1 WHERE a <= ALL (SELECT a FROM t1 HAVING a = 2 UNION SELECT a FROM t1 HAVING a = 2);
-SELECT a FROM t1 WHERE a <> ALL (SELECT a FROM t1 HAVING a = 2 UNION SELECT a FROM t1 HAVING a = 2);
-# row tests
-# < > >= <= and = ALL/ <> ANY do not support row operation
--- error ER_OPERAND_COLUMNS
-SELECT a FROM t1 WHERE (1,2) > ANY (SELECT a FROM t1 WHERE b = 2);
--- error ER_OPERAND_COLUMNS
-SELECT a FROM t1 WHERE a > ANY (SELECT a,2 FROM t1 WHERE b = 2);
--- error ER_OPERAND_COLUMNS
-SELECT a FROM t1 WHERE (1,2) > ANY (SELECT a,2 FROM t1 WHERE b = 2);
--- error ER_OPERAND_COLUMNS
-SELECT a FROM t1 WHERE (1,2) > ALL (SELECT a FROM t1 WHERE b = 2);
--- error ER_OPERAND_COLUMNS
-SELECT a FROM t1 WHERE a > ALL (SELECT a,2 FROM t1 WHERE b = 2);
--- error ER_OPERAND_COLUMNS
-SELECT a FROM t1 WHERE (1,2) > ALL (SELECT a,2 FROM t1 WHERE b = 2);
--- error ER_OPERAND_COLUMNS
-SELECT a FROM t1 WHERE (1,2) = ALL (SELECT a,2 FROM t1 WHERE b = 2);
--- error ER_OPERAND_COLUMNS
-SELECT a FROM t1 WHERE (1,2) <> ANY (SELECT a,2 FROM t1 WHERE b = 2);
-# following should be converted to IN
--- error ER_OPERAND_COLUMNS
-SELECT a FROM t1 WHERE (1,2) = ANY (SELECT a FROM t1 WHERE b = 2);
--- error ER_OPERAND_COLUMNS
-SELECT a FROM t1 WHERE a = ANY (SELECT a,2 FROM t1 WHERE b = 2);
-SELECT a FROM t1 WHERE (1,2) = ANY (SELECT a,2 FROM t1 WHERE b = 2);
--- error ER_OPERAND_COLUMNS
-SELECT a FROM t1 WHERE (1,2) <> ALL (SELECT a FROM t1 WHERE b = 2);
--- error ER_OPERAND_COLUMNS
-SELECT a FROM t1 WHERE a <> ALL (SELECT a,2 FROM t1 WHERE b = 2);
-SELECT a FROM t1 WHERE (1,2) <> ALL (SELECT a,2 FROM t1 WHERE b = 2);
-SELECT a FROM t1 WHERE (a,1) = ANY (SELECT a,1 FROM t1 WHERE b = 2);
-SELECT a FROM t1 WHERE (a,1) <> ALL (SELECT a,1 FROM t1 WHERE b = 2);
-SELECT a FROM t1 WHERE (a,1) = ANY (SELECT a,1 FROM t1 HAVING a = 2);
-SELECT a FROM t1 WHERE (a,1) <> ALL (SELECT a,1 FROM t1 HAVING a = 2);
-SELECT a FROM t1 WHERE (a,1) = ANY (SELECT a,1 FROM t1 WHERE b = 2 UNION SELECT a,1 FROM t1 WHERE b = 2);
-SELECT a FROM t1 WHERE (a,1) <> ALL (SELECT a,1 FROM t1 WHERE b = 2 UNION SELECT a,1 FROM t1 WHERE b = 2);
-SELECT a FROM t1 WHERE (a,1) = ANY (SELECT a,1 FROM t1 HAVING a = 2 UNION SELECT a,1 FROM t1 HAVING a = 2);
-SELECT a FROM t1 WHERE (a,1) <> ALL (SELECT a,1 FROM t1 HAVING a = 2 UNION SELECT a,1 FROM t1 HAVING a = 2);
-# without optimisation
-SELECT a FROM t1 WHERE a > ANY (SELECT a FROM t1 WHERE b = 2 group by a);
-SELECT a FROM t1 WHERE a < ANY (SELECT a FROM t1 WHERE b = 2 group by a);
-SELECT a FROM t1 WHERE a = ANY (SELECT a FROM t1 WHERE b = 2 group by a);
-SELECT a FROM t1 WHERE a >= ANY (SELECT a FROM t1 WHERE b = 2 group by a);
-SELECT a FROM t1 WHERE a <= ANY (SELECT a FROM t1 WHERE b = 2 group by a);
-SELECT a FROM t1 WHERE a <> ANY (SELECT a FROM t1 WHERE b = 2 group by a);
-SELECT a FROM t1 WHERE a > ALL (SELECT a FROM t1 WHERE b = 2 group by a);
-SELECT a FROM t1 WHERE a < ALL (SELECT a FROM t1 WHERE b = 2 group by a);
-SELECT a FROM t1 WHERE a = ALL (SELECT a FROM t1 WHERE b = 2 group by a);
-SELECT a FROM t1 WHERE a >= ALL (SELECT a FROM t1 WHERE b = 2 group by a);
-SELECT a FROM t1 WHERE a <= ALL (SELECT a FROM t1 WHERE b = 2 group by a);
-SELECT a FROM t1 WHERE a <> ALL (SELECT a FROM t1 WHERE b = 2 group by a);
-# without optimisation + having
-SELECT a FROM t1 WHERE a > ANY (SELECT a FROM t1 group by a HAVING a = 2);
-SELECT a FROM t1 WHERE a < ANY (SELECT a FROM t1 group by a HAVING a = 2);
-SELECT a FROM t1 WHERE a = ANY (SELECT a FROM t1 group by a HAVING a = 2);
-SELECT a FROM t1 WHERE a >= ANY (SELECT a FROM t1 group by a HAVING a = 2);
-SELECT a FROM t1 WHERE a <= ANY (SELECT a FROM t1 group by a HAVING a = 2);
-SELECT a FROM t1 WHERE a <> ANY (SELECT a FROM t1 group by a HAVING a = 2);
-SELECT a FROM t1 WHERE a > ALL (SELECT a FROM t1 group by a HAVING a = 2);
-SELECT a FROM t1 WHERE a < ALL (SELECT a FROM t1 group by a HAVING a = 2);
-SELECT a FROM t1 WHERE a = ALL (SELECT a FROM t1 group by a HAVING a = 2);
-SELECT a FROM t1 WHERE a >= ALL (SELECT a FROM t1 group by a HAVING a = 2);
-SELECT a FROM t1 WHERE a <= ALL (SELECT a FROM t1 group by a HAVING a = 2);
-SELECT a FROM t1 WHERE a <> ALL (SELECT a FROM t1 group by a HAVING a = 2);
-# EXISTS in string contence
-SELECT concat(EXISTS(SELECT a FROM t1 WHERE b = 2 and a.a > t1.a), '-') from t1 a;
-SELECT concat(EXISTS(SELECT a FROM t1 WHERE b = 2 and a.a < t1.a), '-') from t1 a;
-SELECT concat(EXISTS(SELECT a FROM t1 WHERE b = 2 and a.a = t1.a), '-') from t1 a;
-DROP TABLE t1;
-CREATE TABLE t1 ( a double, b double );
-INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
-SELECT a FROM t1 WHERE a > ANY (SELECT a FROM t1 WHERE b = 2e0);
-SELECT a FROM t1 WHERE a < ANY (SELECT a FROM t1 WHERE b = 2e0);
-SELECT a FROM t1 WHERE a = ANY (SELECT a FROM t1 WHERE b = 2e0);
-SELECT a FROM t1 WHERE a >= ANY (SELECT a FROM t1 WHERE b = 2e0);
-SELECT a FROM t1 WHERE a <= ANY (SELECT a FROM t1 WHERE b = 2e0);
-SELECT a FROM t1 WHERE a <> ANY (SELECT a FROM t1 WHERE b = 2e0);
-SELECT a FROM t1 WHERE a > ALL (SELECT a FROM t1 WHERE b = 2e0);
-SELECT a FROM t1 WHERE a < ALL (SELECT a FROM t1 WHERE b = 2e0);
-SELECT a FROM t1 WHERE a = ALL (SELECT a FROM t1 WHERE b = 2e0);
-SELECT a FROM t1 WHERE a >= ALL (SELECT a FROM t1 WHERE b = 2e0);
-SELECT a FROM t1 WHERE a <= ALL (SELECT a FROM t1 WHERE b = 2e0);
-SELECT a FROM t1 WHERE a <> ALL (SELECT a FROM t1 WHERE b = 2e0);
-DROP TABLE t1;
-CREATE TABLE t1 ( a char(1), b char(1));
-INSERT INTO t1 VALUES ('1','1'),('2','2'),('3','3');
-SELECT a FROM t1 WHERE a > ANY (SELECT a FROM t1 WHERE b = '2');
-SELECT a FROM t1 WHERE a < ANY (SELECT a FROM t1 WHERE b = '2');
-SELECT a FROM t1 WHERE a = ANY (SELECT a FROM t1 WHERE b = '2');
-SELECT a FROM t1 WHERE a >= ANY (SELECT a FROM t1 WHERE b = '2');
-SELECT a FROM t1 WHERE a <= ANY (SELECT a FROM t1 WHERE b = '2');
-SELECT a FROM t1 WHERE a <> ANY (SELECT a FROM t1 WHERE b = '2');
-SELECT a FROM t1 WHERE a > ALL (SELECT a FROM t1 WHERE b = '2');
-SELECT a FROM t1 WHERE a < ALL (SELECT a FROM t1 WHERE b = '2');
-SELECT a FROM t1 WHERE a = ALL (SELECT a FROM t1 WHERE b = '2');
-SELECT a FROM t1 WHERE a >= ALL (SELECT a FROM t1 WHERE b = '2');
-SELECT a FROM t1 WHERE a <= ALL (SELECT a FROM t1 WHERE b = '2');
-SELECT a FROM t1 WHERE a <> ALL (SELECT a FROM t1 WHERE b = '2');
-DROP TABLE t1;
-
-
-#
-# SELECT(EXISTS * ...)optimisation
-#
-create table t1 (a int, b int);
-insert into t1 values (1,2),(3,4);
-select * from t1 up where exists (select * from t1 where t1.a=up.a);
-explain extended select * from t1 up where exists (select * from t1 where t1.a=up.a);
-drop table t1;
-
-
-#
-# Bug#4102 subselect in HAVING
-#
-
-CREATE TABLE t1 (t1_a int);
-INSERT INTO t1 VALUES (1);
-CREATE TABLE t2 (t2_a int, t2_b int, PRIMARY KEY (t2_a, t2_b));
-INSERT INTO t2 VALUES (1, 1), (1, 2);
-SELECT * FROM t1, t2 table2 WHERE t1_a = 1 AND table2.t2_a = 1
- HAVING table2.t2_b = (SELECT MAX(t2_b) FROM t2 WHERE t2_a = table2.t2_a);
-DROP TABLE t1, t2;
-
-
-#
-# Test problem with NULL and derived tables
-# (Bug#4097 JOIN with subquery causes entire column to report NULL)
-#
-
-CREATE TABLE t1 (id int(11) default NULL,name varchar(10) default NULL);
-INSERT INTO t1 VALUES (1,'Tim'),(2,'Rebecca'),(3,NULL);
-CREATE TABLE t2 (id int(11) default NULL, pet varchar(10) default NULL);
-INSERT INTO t2 VALUES (1,'Fido'),(2,'Spot'),(3,'Felix');
-SELECT a.*, b.* FROM (SELECT * FROM t1) AS a JOIN t2 as b on a.id=b.id;
-drop table t1,t2;
-
-
-#
-# outer fields resolving in INSERT/REPLACE and CRETE with SELECT
-#
-CREATE TABLE t1 ( a int, b int );
-CREATE TABLE t2 ( c int, d int );
-INSERT INTO t1 VALUES (1,2), (2,3), (3,4);
-SELECT a AS abc, b FROM t1 outr WHERE b =
- (SELECT MIN(b) FROM t1 WHERE a=outr.a);
-INSERT INTO t2 SELECT a AS abc, b FROM t1 outr WHERE b =
- (SELECT MIN(b) FROM t1 WHERE a=outr.a);
-select * from t2;
-CREATE TABLE t3 SELECT a AS abc, b FROM t1 outr WHERE b =
- (SELECT MIN(b) FROM t1 WHERE a=outr.a);
-select * from t3;
-prepare stmt1 from "INSERT INTO t2 SELECT a AS abc, b FROM t1 outr WHERE b = (SELECT MIN(b) FROM t1 WHERE a=outr.a);";
-execute stmt1;
-deallocate prepare stmt1;
-select * from t2;
-drop table t3;
-prepare stmt1 from "CREATE TABLE t3 SELECT a AS abc, b FROM t1 outr WHERE b = (SELECT MIN(b) FROM t1 WHERE a=outr.a);";
-execute stmt1;
-select * from t3;
-deallocate prepare stmt1;
-DROP TABLE t1, t2, t3;
-
-#
-# Aggregate function comparation with ALL/ANY/SOME subselect
-#
-CREATE TABLE `t1` ( `a` int(11) default NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-insert into t1 values (1);
-CREATE TABLE `t2` ( `b` int(11) default NULL, `a` int(11) default NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-insert into t2 values (1,2);
-select t000.a, count(*) `C` FROM t1 t000 GROUP BY t000.a HAVING count(*) > ALL (SELECT count(*) FROM t2 t001 WHERE t001.a=1);
-drop table t1,t2;
-
-
-#
-# Bug#4769 - fulltext in subselect
-#
-create table t1 (a int not null auto_increment primary key, b varchar(40), fulltext(b));
-insert into t1 (b) values ('ball'),('ball games'), ('games'), ('foo'), ('foobar'), ('Serg'), ('Sergei'),('Georg'), ('Patrik'),('Hakan');
-create table t2 (a int);
-insert into t2 values (1),(3),(2),(7);
-select a,b from t1 where match(b) against ('Ball') > 0;
-select a from t2 where a in (select a from t1 where match(b) against ('Ball') > 0);
-drop table t1,t2;
-
-
-#
-# Bug#5003 - like in subselect
-#
-CREATE TABLE t1(`IZAVORGANG_ID` VARCHAR(11) CHARACTER SET latin1 COLLATE latin1_bin,`KUERZEL` VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_bin,`IZAANALYSEART_ID` VARCHAR(11) CHARACTER SET latin1 COLLATE latin1_bin,`IZAPMKZ_ID` VARCHAR(11) CHARACTER SET latin1 COLLATE latin1_bin);
-CREATE INDEX AK01IZAVORGANG ON t1(izaAnalyseart_id,Kuerzel);
-INSERT INTO t1(`IZAVORGANG_ID`,`KUERZEL`,`IZAANALYSEART_ID`,`IZAPMKZ_ID`)VALUES('D0000000001','601','D0000000001','I0000000001');
-INSERT INTO t1(`IZAVORGANG_ID`,`KUERZEL`,`IZAANALYSEART_ID`,`IZAPMKZ_ID`)VALUES('D0000000002','602','D0000000001','I0000000001');
-INSERT INTO t1(`IZAVORGANG_ID`,`KUERZEL`,`IZAANALYSEART_ID`,`IZAPMKZ_ID`)VALUES('D0000000003','603','D0000000001','I0000000001');
-INSERT INTO t1(`IZAVORGANG_ID`,`KUERZEL`,`IZAANALYSEART_ID`,`IZAPMKZ_ID`)VALUES('D0000000004','101','D0000000001','I0000000001');
-SELECT `IZAVORGANG_ID` FROM t1 WHERE `KUERZEL` IN(SELECT MIN(`KUERZEL`)`Feld1` FROM t1 WHERE `KUERZEL` LIKE'601%'And`IZAANALYSEART_ID`='D0000000001');
-drop table t1;
-
-#
-# Optimized IN with compound index
-#
-CREATE TABLE `t1` ( `aid` int(11) NOT NULL default '0', `bid` int(11) NOT NULL default '0', PRIMARY KEY (`aid`,`bid`));
-CREATE TABLE `t2` ( `aid` int(11) NOT NULL default '0', `bid` int(11) NOT NULL default '0', PRIMARY KEY (`aid`,`bid`));
-insert into t1 values (1,1),(1,2),(2,1),(2,2);
-insert into t2 values (1,2),(2,2);
-select * from t1 where t1.aid not in (select aid from t2 where bid=t1.bid);
-alter table t2 drop primary key;
-alter table t2 add key KEY1 (aid, bid);
-select * from t1 where t1.aid not in (select aid from t2 where bid=t1.bid);
-alter table t2 drop key KEY1;
-alter table t2 add primary key (bid, aid);
-select * from t1 where t1.aid not in (select aid from t2 where bid=t1.bid);
-drop table t1,t2;
-
-#
-# resolving fields of grouped outer SELECT
-#
-CREATE TABLE t1 (howmanyvalues bigint, avalue int);
-INSERT INTO t1 VALUES (1, 1),(2, 1),(2, 2),(3, 1),(3, 2),(3, 3),(4, 1),(4, 2),(4, 3),(4, 4);
-SELECT howmanyvalues, count(*) from t1 group by howmanyvalues;
-SELECT a.howmanyvalues, (SELECT count(*) from t1 b where b.howmanyvalues = a.howmanyvalues) as mycount from t1 a group by a.howmanyvalues;
-CREATE INDEX t1_howmanyvalues_idx ON t1 (howmanyvalues);
-SELECT a.howmanyvalues, (SELECT count(*) from t1 b where b.howmanyvalues+1 = a.howmanyvalues+1) as mycount from t1 a group by a.howmanyvalues;
-SELECT a.howmanyvalues, (SELECT count(*) from t1 b where b.howmanyvalues = a.howmanyvalues) as mycount from t1 a group by a.howmanyvalues;
-SELECT a.howmanyvalues, (SELECT count(*) from t1 b where b.howmanyvalues = a.avalue) as mycount from t1 a group by a.howmanyvalues;
-drop table t1;
-
-create table t1 (x int);
-select (select b.x from t1 as b where b.x=a.x) from t1 as a where a.x=2 group by a.x;
-drop table t1;
-
-#
-# Test of correct maybe_null flag returning by subquwery for temporary table
-# creation
-#
-CREATE TABLE `t1` ( `master` int(10) unsigned NOT NULL default '0', `map` smallint(6) unsigned NOT NULL default '0', `slave` int(10) unsigned NOT NULL default '0', `access` int(10) unsigned NOT NULL default '0', UNIQUE KEY `access_u` (`master`,`map`,`slave`));
-INSERT INTO `t1` VALUES (1,0,0,700),(1,1,1,400),(1,5,5,400),(1,12,12,400),(1,12,32,400),(4,12,32,400);
-CREATE TABLE `t2` ( `id` int(10) unsigned NOT NULL default '0', `pid` int(10) unsigned NOT NULL default '0', `map` smallint(6) unsigned NOT NULL default '0', `level` tinyint(4) unsigned NOT NULL default '0', `title` varchar(255) default NULL, PRIMARY KEY (`id`,`pid`,`map`), KEY `level` (`level`), KEY `id` (`id`,`map`)) ;
-INSERT INTO `t2` VALUES (6,5,12,7,'a'),(12,0,0,7,'a'),(12,1,0,7,'a'),(12,5,5,7,'a'),(12,5,12,7,'a');
--- error ER_BAD_FIELD_ERROR
-SELECT b.sc FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
-SELECT b.ac FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
-drop tables t1,t2;
-
-
-#
-# Test for Bug#6462 Same request on same data returns different results
-# a.k.a. "Proper cleanup of subqueries is missing for SET and DO statements".
-#
-create table t1 (a int not null, b int not null, c int, primary key (a,b));
-insert into t1 values (1,1,1), (2,2,2), (3,3,3);
-set @b:= 0;
-# Let us check that subquery will use covering index
-explain select sum(a) from t1 where b > @b;
-# This should not crash -debug server due to failing assertion
-set @a:= (select sum(a) from t1 where b > @b);
-# And this should not falsely report index usage
-explain select a from t1 where c=2;
-# Same for DO statement
-do @a:= (select sum(a) from t1 where b > @b);
-explain select a from t1 where c=2;
-drop table t1;
-
-#
-# Subselect in non-select command just after connection
-# Disconnect new connection and switch back when test is finished
-#
-connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
-connection root;
-set @got_val= (SELECT 1 FROM (SELECT 'A' as my_col) as T1 ) ;
-disconnect root;
-connection default;
-
-#
-# primary query with temporary table and subquery with grouping
-#
-create table t1 (a int, b int);
-create table t2 (a int, b int);
-insert into t1 values (1,1),(1,2),(1,3),(2,4),(2,5);
-insert into t2 values (1,3),(2,1);
-select distinct a,b, (select max(b) from t2 where t1.b=t2.a) from t1 order by t1.b;
-drop table t1, t2;
-
-#
-# subqueries with full text search
-#
-create table t1 (id int);
-create table t2 (id int, body text, fulltext (body));
-insert into t1 values(1),(2),(3);
-insert into t2 values (1,'test'), (2,'mysql'), (3,'test'), (4,'test');
-select count(distinct id) from t1 where id in (select id from t2 where match(body) against ('mysql' in boolean mode));
-drop table t2,t1;
-
-#
-# Equal operation under row and empty subquery
-#
-create table t1 (s1 int,s2 int);
-insert into t1 values (20,15);
-select * from t1 where (('a',null) <=> (select 'a',s2 from t1 where s1 = 0));
-drop table t1;
-
-#
-# ALL/ANY with NULL
-#
-create table t1 (s1 int);
-insert into t1 values (1),(null);
-select * from t1 where s1 < all (select s1 from t1);
-select s1, s1 < all (select s1 from t1) from t1;
-drop table t1;
-
-#
-# reference on changable fields from subquery
-#
-CREATE TABLE t1 (
- Code char(3) NOT NULL default '',
- Name char(52) NOT NULL default '',
- Continent enum('Asia','Europe','North America','Africa','Oceania','Antarctica','South America') NOT NULL default 'Asia',
- Region char(26) NOT NULL default '',
- SurfaceArea float(10,2) NOT NULL default '0.00',
- IndepYear smallint(6) default NULL,
- Population int(11) NOT NULL default '0',
- LifeExpectancy float(3,1) default NULL,
- GNP float(10,2) default NULL,
- GNPOld float(10,2) default NULL,
- LocalName char(45) NOT NULL default '',
- GovernmentForm char(45) NOT NULL default '',
- HeadOfState char(60) default NULL,
- Capital int(11) default NULL,
- Code2 char(2) NOT NULL default ''
-) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('XXX','Xxxxx','Oceania','Xxxxxx',26.00,0,0,0,0,0,'Xxxxx','Xxxxx','Xxxxx',NULL,'XX');
-INSERT INTO t1 VALUES ('ASM','American Samoa','Oceania','Polynesia',199.00,0,68000,75.1,334.00,NULL,'Amerika Samoa','US Territory','George W. Bush',54,'AS');
-INSERT INTO t1 VALUES ('ATF','French Southern territories','Antarctica','Antarctica',7780.00,0,0,NULL,0.00,NULL,'Terres australes françaises','Nonmetropolitan Territory of France','Jacques Chirac',NULL,'TF');
-INSERT INTO t1 VALUES ('UMI','United States Minor Outlying Islands','Oceania','Micronesia/Caribbean',16.00,0,0,NULL,0.00,NULL,'United States Minor Outlying Islands','Dependent Territory of the US','George W. Bush',NULL,'UM');
-/*!40000 ALTER TABLE t1 ENABLE KEYS */;
-SELECT DISTINCT Continent AS c FROM t1 outr WHERE
- Code <> SOME ( SELECT Code FROM t1 WHERE Continent = outr.Continent AND
- Population < 200);
-drop table t1;
-
-
-#
-# Test for Bug#7885 Server crash when 'any' subselect compared to
-# non-existant field.
-#
-create table t1 (a1 int);
-create table t2 (b1 int);
---error ER_BAD_FIELD_ERROR
-select * from t1 where a2 > any(select b1 from t2);
-select * from t1 where a1 > any(select b1 from t2);
-drop table t1,t2;
-
-
-#
-# Comparison subquery with * and row
-#
-create table t1 (a integer, b integer);
-select (select * from t1) = (select 1,2);
-select (select 1,2) = (select * from t1);
-# queries whih can be converted to IN
-select row(1,2) = ANY (select * from t1);
-select row(1,2) != ALL (select * from t1);
-drop table t1;
-
-#
-# Comparison subquery and row with nested rows
-#
-create table t1 (a integer, b integer);
--- error ER_OPERAND_COLUMNS
-select row(1,(2,2)) in (select * from t1 );
--- error ER_OPERAND_COLUMNS
-select row(1,(2,2)) = (select * from t1 );
--- error ER_OPERAND_COLUMNS
-select (select * from t1) = row(1,(2,2));
-drop table t1;
-
-#
-# Forward reference detection
-#
-create table t1 (a integer);
-insert into t1 values (1);
--- error ER_ILLEGAL_REFERENCE
-select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx ;
--- error ER_ILLEGAL_REFERENCE
-select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx;
-select 1 as xx, 1 = ALL ( select 1 from t1 where 1 = xx );
--- error ER_ILLEGAL_REFERENCE
-select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx;
--- error ER_ILLEGAL_REFERENCE
-select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx from DUAL;
-drop table t1;
-
-
-#
-# Test for Bug#8218 Join does not pass string from right table
-#
-CREATE TABLE t1 (
- categoryId int(11) NOT NULL,
- courseId int(11) NOT NULL,
- startDate datetime NOT NULL,
- endDate datetime NOT NULL,
- createDate datetime NOT NULL,
- modifyDate timestamp NOT NULL,
- attributes text NOT NULL
-);
-INSERT INTO t1 VALUES (1,41,'2004-02-09','2010-01-01','2004-02-09','2004-02-09',''),
-(1,86,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
-(1,87,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
-(2,52,'2004-03-15','2004-10-01','2004-03-15','2004-09-17',''),
-(2,53,'2004-03-16','2004-10-01','2004-03-16','2004-09-17',''),
-(2,88,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
-(2,89,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
-(3,51,'2004-02-09','2010-01-01','2004-02-09','2004-02-09',''),
-(5,12,'2004-02-18','2010-01-01','2004-02-18','2004-02-18','');
-
-CREATE TABLE t2 (
- userId int(11) NOT NULL,
- courseId int(11) NOT NULL,
- date datetime NOT NULL
-);
-INSERT INTO t2 VALUES (5141,71,'2003-11-18'),
-(5141,72,'2003-11-25'),(5141,41,'2004-08-06'),
-(5141,52,'2004-08-06'),(5141,53,'2004-08-06'),
-(5141,12,'2004-08-06'),(5141,86,'2004-10-21'),
-(5141,87,'2004-10-21'),(5141,88,'2004-10-21'),
-(5141,89,'2004-10-22'),(5141,51,'2004-10-26');
-
-
-CREATE TABLE t3 (
- groupId int(11) NOT NULL,
- parentId int(11) NOT NULL,
- startDate datetime NOT NULL,
- endDate datetime NOT NULL,
- createDate datetime NOT NULL,
- modifyDate timestamp NOT NULL,
- ordering int(11)
-);
-INSERT INTO t3 VALUES (12,9,'1000-01-01','3999-12-31','2004-01-29','2004-01-29',NULL);
-
-CREATE TABLE t4 (
- id int(11) NOT NULL,
- groupTypeId int(11) NOT NULL,
- groupKey varchar(50) NOT NULL,
- name text,
- ordering int(11),
- description text,
- createDate datetime NOT NULL,
- modifyDate timestamp NOT NULL
-);
-INSERT INTO t4 VALUES (9,5,'stationer','stationer',0,'Stationer','2004-01-29','2004-01-29'),
-(12,5,'group2','group2',0,'group2','2004-01-29','2004-01-29');
-
-CREATE TABLE t5 (
- userId int(11) NOT NULL,
- groupId int(11) NOT NULL,
- createDate datetime NOT NULL,
- modifyDate timestamp NOT NULL
-);
-INSERT INTO t5 VALUES (5141,12,'2004-08-06','2004-08-06');
-
-select
- count(distinct t2.userid) pass,
- groupstuff.*,
- count(t2.courseid) crse,
- t1.categoryid,
- t2.courseid,
- date_format(date, '%b%y') as colhead
-from t2
-join t1 on t2.courseid=t1.courseid
-join
-(
- select
- t5.userid,
- parentid,
- parentgroup,
- childid,
- groupname,
- grouptypeid
- from t5
- join
- (
- select t4.id as parentid,
- t4.name as parentgroup,
- t4.id as childid,
- t4.name as groupname,
- t4.grouptypeid
- from t4
- ) as gin on t5.groupid=gin.childid
-) as groupstuff on t2.userid = groupstuff.userid
-group by
- groupstuff.groupname, colhead , t2.courseid;
-
-drop table t1, t2, t3, t4, t5;
-
-
-#
-# Transformation in left expression of subquery (Bug#8888)
-#
-create table t1 (a int);
-insert into t1 values (1), (2), (3);
-SELECT 1 FROM t1 WHERE (SELECT 1) in (SELECT 1);
-drop table t1;
-
-#
-# subselect into HAVING clause (code covarage improvement)
-#
-create table t1 (a int);
-create table t2 (a int);
-insert into t1 values (1),(2);
-insert into t2 values (0),(1),(2),(3);
-select a from t2 where a in (select a from t1);
-select a from t2 having a in (select a from t1);
-prepare stmt1 from "select a from t2 where a in (select a from t1)";
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-prepare stmt1 from "select a from t2 having a in (select a from t1)";
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-drop table t1, t2;
-
-#
-# single row subqueries and row operations (code covarage improvement)
-#
-create table t1 (a int, b int);
-insert into t1 values (1,2);
--- error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-select 1 = (select * from t1);
--- error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-select (select * from t1) = 1;
--- error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-select (1,2) = (select a from t1);
--- error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-select (select a from t1) = (1,2);
--- error ER_OPERAND_COLUMNS
-select (1,2,3) = (select * from t1);
--- error ER_OPERAND_COLUMNS
-select (select * from t1) = (1,2,3);
-drop table t1;
-
-
-#
-# Item_int_with_ref check (Bug#10020)
-#
-CREATE TABLE `t1` (
- `itemid` bigint(20) unsigned NOT NULL auto_increment,
- `sessionid` bigint(20) unsigned default NULL,
- `time` int(10) unsigned NOT NULL default '0',
- `type` set('A','D','E','F','G','I','L','N','U') collate latin1_general_ci NOT
-NULL default '',
- `data` text collate latin1_general_ci NOT NULL,
- PRIMARY KEY (`itemid`)
-) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
-INSERT INTO `t1` VALUES (1, 1, 1, 'D', '');
-CREATE TABLE `t2` (
- `sessionid` bigint(20) unsigned NOT NULL auto_increment,
- `pid` int(10) unsigned NOT NULL default '0',
- `date` int(10) unsigned NOT NULL default '0',
- `ip` varchar(15) collate latin1_general_ci NOT NULL default '',
- PRIMARY KEY (`sessionid`)
-) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
-INSERT INTO `t2` VALUES (1, 1, 1, '10.10.10.1');
-SELECT s.ip, count( e.itemid ) FROM `t1` e JOIN t2 s ON s.sessionid = e.sessionid WHERE e.sessionid = ( SELECT sessionid FROM t2 ORDER BY sessionid DESC LIMIT 1 ) GROUP BY s.ip HAVING count( e.itemid ) >0 LIMIT 0 , 30;
-drop tables t1,t2;
-
-
-# Bug#11821 Select from subselect using aggregate function on an enum segfaults
-create table t1 (fld enum('0','1'));
-insert into t1 values ('1');
-select * from (select max(fld) from t1) as foo;
-drop table t1;
-
-
-#
-# Bug#11867 queries with ROW(,elems>) IN (SELECT DISTINCT <cols> FROM ...)
-#
-
-set @tmp11867_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='semijoin_with_cache=off';
-
-CREATE TABLE t1 (one int, two int, flag char(1));
-CREATE TABLE t2 (one int, two int, flag char(1));
-INSERT INTO t1 VALUES(1,2,'Y'),(2,3,'Y'),(3,4,'Y'),(5,6,'N'),(7,8,'N');
-INSERT INTO t2 VALUES(1,2,'Y'),(2,3,'Y'),(3,4,'Y'),(5,6,'N'),(7,8,'N');
-
-SELECT * FROM t1
- WHERE ROW(one,two) IN (SELECT DISTINCT one,two FROM t2 WHERE flag = 'N');
-SELECT * FROM t1
- WHERE ROW(one,two) IN (SELECT DISTINCT one,two FROM t1 WHERE flag = 'N');
-
-insert into t2 values (null,null,'N');
-insert into t2 values (null,3,'0');
-insert into t2 values (null,5,'0');
-insert into t2 values (10,null,'0');
-insert into t1 values (10,3,'0');
-insert into t1 values (10,5,'0');
-insert into t1 values (10,10,'0');
-SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N') as 'test' from t1;
-SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N');
-SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N' group by one,two) as 'test' from t1;
-SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0') as 'test' from t1;
-SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1;
-explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0') as 'test' from t1;
-explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N');
-explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1;
-DROP TABLE t1,t2;
-
-set optimizer_switch=@tmp11867_optimizer_switch;
-
-#
-# Bug#12392 where cond with IN predicate for rows and NULL values in table
-#
-
-CREATE TABLE t1 (a char(5), b char(5));
-INSERT INTO t1 VALUES (NULL,'aaa'), ('aaa','aaa');
-
-SELECT * FROM t1 WHERE (a,b) IN (('aaa','aaa'), ('aaa','bbb'));
-
-DROP TABLE t1;
-
-
-#
-# Bug#11479 subquery over left join with an empty inner table
-#
-
-CREATE TABLE t1 (a int);
-CREATE TABLE t2 (a int, b int);
-CREATE TABLE t3 (b int NOT NULL);
-INSERT INTO t1 VALUES (1), (2), (3), (4);
-INSERT INTO t2 VALUES (1,10), (3,30);
-
-SELECT * FROM t2 LEFT JOIN t3 ON t2.b=t3.b
- WHERE t3.b IS NOT NULL OR t2.a > 10;
-SELECT * FROM t1
- WHERE t1.a NOT IN (SELECT a FROM t2 LEFT JOIN t3 ON t2.b=t3.b
- WHERE t3.b IS NOT NULL OR t2.a > 10);
-
-DROP TABLE t1,t2,t3;
-
-
-#
-# Bug#18503 Queries with a quantified subquery returning empty set may
-# return a wrong result.
-#
-CREATE TABLE t1 (f1 INT);
-CREATE TABLE t2 (f2 INT);
-INSERT INTO t1 VALUES (1);
-SELECT * FROM t1 WHERE f1 > ALL (SELECT f2 FROM t2);
-SELECT * FROM t1 WHERE f1 > ALL (SELECT f2 FROM t2 WHERE 1=0);
-INSERT INTO t2 VALUES (1);
-INSERT INTO t2 VALUES (2);
-SELECT * FROM t1 WHERE f1 > ALL (SELECT f2 FROM t2 WHERE f2=0);
-DROP TABLE t1, t2;
-
-
-#
-# Bug#16302 Quantified subquery without any tables gives wrong results
-#
-select 1 from dual where 1 < any (select 2);
-select 1 from dual where 1 < all (select 2);
-select 1 from dual where 2 > any (select 1);
-select 1 from dual where 2 > all (select 1);
-select 1 from dual where 1 < any (select 2 from dual);
-select 1 from dual where 1 < all (select 2 from dual where 1!=1);
-
-
-# Bug#20975 Wrong query results for subqueries within NOT
-create table t1 (s1 char);
-insert into t1 values (1),(2);
-
-select * from t1 where (s1 < any (select s1 from t1));
-select * from t1 where not (s1 < any (select s1 from t1));
-
-select * from t1 where (s1 < ALL (select s1+1 from t1));
-select * from t1 where not(s1 < ALL (select s1+1 from t1));
-
-select * from t1 where (s1+1 = ANY (select s1 from t1));
-select * from t1 where NOT(s1+1 = ANY (select s1 from t1));
-
-select * from t1 where (s1 = ALL (select s1/s1 from t1));
-select * from t1 where NOT(s1 = ALL (select s1/s1 from t1));
-drop table t1;
-
-
-#
-# Bug#16255 Subquery in where
-#
-create table t1 (
- retailerID varchar(8) NOT NULL,
- statusID int(10) unsigned NOT NULL,
- changed datetime NOT NULL,
- UNIQUE KEY retailerID (retailerID, statusID, changed)
-);
-
-INSERT INTO t1 VALUES("0026", "1", "2005-12-06 12:18:56");
-INSERT INTO t1 VALUES("0026", "2", "2006-01-06 12:25:53");
-INSERT INTO t1 VALUES("0037", "1", "2005-12-06 12:18:56");
-INSERT INTO t1 VALUES("0037", "2", "2006-01-06 12:25:53");
-INSERT INTO t1 VALUES("0048", "1", "2006-01-06 12:37:50");
-INSERT INTO t1 VALUES("0059", "1", "2006-01-06 12:37:50");
-
-select * from t1 r1
- where (r1.retailerID,(r1.changed)) in
- (SELECT r2.retailerId,(max(changed)) from t1 r2
- group by r2.retailerId);
-drop table t1;
-
-
-#
-# Bug#21180 Subselect with index for both WHERE and ORDER BY
-# produces empty result
-#
-create table t1(a int, primary key (a));
-insert into t1 values (10);
-
-create table t2 (a int primary key, b varchar(32), c int, unique key b(c, b));
-insert into t2(a, c, b) values (1,10,'359'), (2,10,'35988'), (3,10,'35989');
-
-explain 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;
-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;
-
-explain 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;
-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;
-
-drop table t1,t2;
-
-
-#
-# Bug#21853 assert failure for a grouping query with
-# an ALL/ANY quantified subquery in HAVING
-#
-
-CREATE TABLE t1 (
- field1 int NOT NULL,
- field2 int NOT NULL,
- field3 int NOT NULL,
- PRIMARY KEY (field1,field2,field3)
-);
-CREATE TABLE t2 (
- fieldA int NOT NULL,
- fieldB int NOT NULL,
- PRIMARY KEY (fieldA,fieldB)
-);
-
-INSERT INTO t1 VALUES
- (1,1,1), (1,1,2), (1,2,1), (1,2,2), (1,2,3), (1,3,1);
-INSERT INTO t2 VALUES (1,1), (1,2), (1,3);
-
-SELECT field1, field2, COUNT(*)
- FROM t1 GROUP BY field1, field2;
-
-SELECT field1, field2
- FROM t1
- GROUP BY field1, field2
- HAVING COUNT(*) >= ALL (SELECT fieldB
- FROM t2 WHERE fieldA = field1);
-SELECT field1, field2
- FROM t1
- GROUP BY field1, field2
- HAVING COUNT(*) < ANY (SELECT fieldB
- FROM t2 WHERE fieldA = field1);
-
-DROP TABLE t1, t2;
-
-
-#
-# Bug#23478 not top-level IN subquery returning a non-empty result set
-# with possible NULL values by index access from the outer query
-#
-
-CREATE TABLE t1(a int, INDEX (a));
-INSERT INTO t1 VALUES (1), (3), (5), (7);
-INSERT INTO t1 VALUES (NULL);
-
-CREATE TABLE t2(a int);
-INSERT INTO t2 VALUES (1),(2),(3);
-
-EXPLAIN SELECT a, a IN (SELECT a FROM t1) FROM t2;
-SELECT a, a IN (SELECT a FROM t1) FROM t2;
-
-DROP TABLE t1,t2;
-
-
-#
-# Bug#11302 getObject() returns a String for a sub-query of type datetime
-#
-CREATE TABLE t1 (a DATETIME);
-INSERT INTO t1 VALUES ('1998-09-23'), ('2003-03-25');
-
-CREATE TABLE t2 AS SELECT
- (SELECT a FROM t1 WHERE a < '2000-01-01') AS sub_a
- FROM t1 WHERE a > '2000-01-01';
-SHOW CREATE TABLE t2;
-
-CREATE TABLE t3 AS (SELECT a FROM t1 WHERE a < '2000-01-01') UNION (SELECT a FROM t1 WHERE a > '2000-01-01');
-SHOW CREATE TABLE t3;
-
-DROP TABLE t1,t2,t3;
-
-
-#
-# Bug#24670 subquery witout tables but with a WHERE clause
-#
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (1), (2);
-
-SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) > 0;
-SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) IS NULL;
-EXPLAIN SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) IS NULL;
-
-DROP TABLE t1;
-
-
-#
-# Bug#24653 sorting by expressions containing subselects
-# that return more than one row
-#
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (2), (4), (1), (3);
-
-CREATE TABLE t2 (b int, c int);
-INSERT INTO t2 VALUES
- (2,1), (1,3), (2,1), (4,4), (2,2), (1,4);
-
-SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 2 );
---error ER_SUBQUERY_NO_1_ROW
-SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 1);
-SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 2), a;
---error ER_SUBQUERY_NO_1_ROW
-SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 1), a;
-
-SELECT b, MAX(c) FROM t2 GROUP BY b, (SELECT c FROM t2 WHERE b > 2);
---error ER_SUBQUERY_NO_1_ROW
-SELECT b, MAX(c) FROM t2 GROUP BY b, (SELECT c FROM t2 WHERE b > 1);
-
---sorted_result
-SELECT a FROM t1 GROUP BY a
- HAVING IFNULL((SELECT b FROM t2 WHERE b > 2),
- (SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b)) > 3;
---error ER_SUBQUERY_NO_1_ROW
-SELECT a FROM t1 GROUP BY a
- HAVING IFNULL((SELECT b FROM t2 WHERE b > 1),
- (SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b)) > 3;
---sorted_result
-SELECT a FROM t1 GROUP BY a
- HAVING IFNULL((SELECT b FROM t2 WHERE b > 4),
- (SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b)) > 3;
---error ER_SUBQUERY_NO_1_ROW
-SELECT a FROM t1 GROUP BY a
- HAVING IFNULL((SELECT b FROM t2 WHERE b > 4),
- (SELECT c FROM t2 WHERE c=a AND b > 1 ORDER BY b)) > 3;
---sorted_result
-SELECT a FROM t1
- ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 2),
- (SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b));
---error ER_SUBQUERY_NO_1_ROW
-SELECT a FROM t1
- ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 1),
- (SELECT c FROM t2 WHERE c=a AND b > 1 ORDER BY b));
---sorted_result
-SELECT a FROM t1
- ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 4),
- (SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b));
---error ER_SUBQUERY_NO_1_ROW
-SELECT a FROM t1
- ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 4),
- (SELECT c FROM t2 WHERE c=a AND b > 1 ORDER BY b));
-
-DROP TABLE t1,t2;
-
-# End of 4.1 tests
-
-#
-#decimal-related tests
-#
-create table t1 (df decimal(5,1));
-insert into t1 values(1.1);
-insert into t1 values(2.2);
-
-select * from t1 where df <= all (select avg(df) from t1 group by df);
-select * from t1 where df >= all (select avg(df) from t1 group by df);
-drop table t1;
-
-create table t1 (df decimal(5,1));
-insert into t1 values(1.1);
-select 1.1 * exists(select * from t1);
-drop table t1;
-
-CREATE TABLE t1 (
- grp int(11) default NULL,
- a decimal(10,2) default NULL);
-
-insert into t1 values (1, 1), (2, 2), (2, 3), (3, 4), (3, 5), (3, 6), (NULL, NULL);
-select * from t1;
-select min(a) from t1 group by grp;
-drop table t1;
-
-
-#
-# Test for Bug#9338 lame substitution of c1 instead of c2
-#
-
-CREATE table t1 ( c1 integer );
-INSERT INTO t1 VALUES ( 1 );
-INSERT INTO t1 VALUES ( 2 );
-INSERT INTO t1 VALUES ( 3 );
-
-CREATE TABLE t2 ( c2 integer );
-INSERT INTO t2 VALUES ( 1 );
-INSERT INTO t2 VALUES ( 4 );
-INSERT INTO t2 VALUES ( 5 );
-
-SELECT * FROM t1 LEFT JOIN t2 ON c1 = c2 WHERE c2 IN (1);
-
-SELECT * FROM t1 LEFT JOIN t2 ON c1 = c2
- WHERE c2 IN ( SELECT c2 FROM t2 WHERE c2 IN ( 1 ) );
-
-DROP TABLE t1,t2;
-
-
-#
-# Test for Bug#9516 wrong evaluation of not_null_tables attribute in SQ
-#
-CREATE TABLE t1 ( c1 integer );
-INSERT INTO t1 VALUES ( 1 );
-INSERT INTO t1 VALUES ( 2 );
-INSERT INTO t1 VALUES ( 3 );
-INSERT INTO t1 VALUES ( 6 );
-
-CREATE TABLE t2 ( c2 integer );
-INSERT INTO t2 VALUES ( 1 );
-INSERT INTO t2 VALUES ( 4 );
-INSERT INTO t2 VALUES ( 5 );
-INSERT INTO t2 VALUES ( 6 );
-
-CREATE TABLE t3 ( c3 integer );
-INSERT INTO t3 VALUES ( 7 );
-INSERT INTO t3 VALUES ( 8 );
-
-SELECT c1,c2 FROM t1 LEFT JOIN t2 ON c1 = c2
- WHERE EXISTS (SELECT c3 FROM t3 WHERE c2 IS NULL );
-
-DROP TABLE t1,t2,t3;
-
-
-#
-# Item_int_with_ref check (Bug#10020)
-#
-CREATE TABLE `t1` (
- `itemid` bigint(20) unsigned NOT NULL auto_increment,
- `sessionid` bigint(20) unsigned default NULL,
- `time` int(10) unsigned NOT NULL default '0',
- `type` set('A','D','E','F','G','I','L','N','U') collate latin1_general_ci NOT
-NULL default '',
- `data` text collate latin1_general_ci NOT NULL,
- PRIMARY KEY (`itemid`)
-) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
-INSERT INTO `t1` VALUES (1, 1, 1, 'D', '');
-CREATE TABLE `t2` (
- `sessionid` bigint(20) unsigned NOT NULL auto_increment,
- `pid` int(10) unsigned NOT NULL default '0',
- `date` int(10) unsigned NOT NULL default '0',
- `ip` varchar(15) collate latin1_general_ci NOT NULL default '',
- PRIMARY KEY (`sessionid`)
-) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
-INSERT INTO `t2` VALUES (1, 1, 1, '10.10.10.1');
-SELECT s.ip, count( e.itemid ) FROM `t1` e JOIN t2 s ON s.sessionid = e.sessionid WHERE e.sessionid = ( SELECT sessionid FROM t2 ORDER BY sessionid DESC LIMIT 1 ) GROUP BY s.ip HAVING count( e.itemid ) >0 LIMIT 0 , 30;
-drop tables t1,t2;
-
-
-#
-# Correct building of equal fields list (do not include outer
-# fields) (Bug#6384)
-#
-CREATE TABLE t1 (EMPNUM CHAR(3));
-CREATE TABLE t2 (EMPNUM CHAR(3) );
-INSERT INTO t1 VALUES ('E1'),('E2');
-INSERT INTO t2 VALUES ('E1');
-DELETE FROM t1
-WHERE t1.EMPNUM NOT IN
- (SELECT t2.EMPNUM
- FROM t2
- WHERE t1.EMPNUM = t2.EMPNUM);
-select * from t1;
-DROP TABLE t1,t2;
-
-
-#
-# Test for Bug#11487 range access in a subquery
-#
-
-CREATE TABLE t1(select_id BIGINT, values_id BIGINT);
-INSERT INTO t1 VALUES (1, 1);
-CREATE TABLE t2 (select_id BIGINT, values_id BIGINT,
- PRIMARY KEY(select_id,values_id));
-INSERT INTO t2 VALUES (0, 1), (0, 2), (0, 3), (1, 5);
-
-SELECT values_id FROM t1
-WHERE values_id IN (SELECT values_id FROM t2
- WHERE select_id IN (1, 0));
-SELECT values_id FROM t1
-WHERE values_id IN (SELECT values_id FROM t2
- WHERE select_id BETWEEN 0 AND 1);
-SELECT values_id FROM t1
-WHERE values_id IN (SELECT values_id FROM t2
- WHERE select_id = 0 OR select_id = 1);
-
-DROP TABLE t1, t2;
-
-
-# Bug#11821 Select from subselect using aggregate function on an enum segfaults
-create table t1 (fld enum('0','1'));
-insert into t1 values ('1');
-select * from (select max(fld) from t1) as foo;
-drop table t1;
-
-
-#
-# Test for Bug#11762 subquery with an aggregate function in HAVING
-#
-
-CREATE TABLE t1 (a int, b int);
-CREATE TABLE t2 (c int, d int);
-CREATE TABLE t3 (e int);
-
-INSERT INTO t1 VALUES
- (1,10), (2,10), (1,20), (2,20), (3,20), (2,30), (4,40);
-INSERT INTO t2 VALUES
- (2,10), (2,20), (4,10), (5,10), (3,20), (2,40);
-INSERT INTO t3 VALUES (10), (30), (10), (20) ;
-
-SELECT a, MAX(b), MIN(b) FROM t1 GROUP BY a;
-SELECT * FROM t2;
-SELECT * FROM t3;
-
-SELECT a FROM t1 GROUP BY a
- HAVING a IN (SELECT c FROM t2 WHERE MAX(b)>20);
-SELECT a FROM t1 GROUP BY a
- HAVING a IN (SELECT c FROM t2 WHERE MAX(b)<d);
-SELECT a FROM t1 GROUP BY a
- HAVING a IN (SELECT c FROM t2 WHERE MAX(b)>d);
-SELECT a FROM t1 GROUP BY a
- HAVING a IN (SELECT c FROM t2
- WHERE d >= SOME(SELECT e FROM t3 WHERE MAX(b)=e));
-SELECT a FROM t1 GROUP BY a
- HAVING a IN (SELECT c FROM t2
- WHERE EXISTS(SELECT e FROM t3 WHERE MAX(b)=e AND e <= d));
-SELECT a FROM t1 GROUP BY a
- HAVING a IN (SELECT c FROM t2
- WHERE d > SOME(SELECT e FROM t3 WHERE MAX(b)=e));
-SELECT a FROM t1 GROUP BY a
- HAVING a IN (SELECT c FROM t2
- WHERE EXISTS(SELECT e FROM t3 WHERE MAX(b)=e AND e < d));
-SELECT a FROM t1 GROUP BY a
- HAVING a IN (SELECT c FROM t2
- WHERE MIN(b) < d AND
- EXISTS(SELECT e FROM t3 WHERE MAX(b)=e AND e <= d));
-
-SELECT a, SUM(a) FROM t1 GROUP BY a;
-
-SELECT a FROM t1
- WHERE EXISTS(SELECT c FROM t2 GROUP BY c HAVING SUM(a) = c) GROUP BY a;
-SELECT a FROM t1 GROUP BY a
- HAVING EXISTS(SELECT c FROM t2 GROUP BY c HAVING SUM(a) = c);
-
-SELECT a FROM t1
- WHERE a < 3 AND
- EXISTS(SELECT c FROM t2 GROUP BY c HAVING SUM(a) != c) GROUP BY a;
-SELECT a FROM t1
- WHERE a < 3 AND
- EXISTS(SELECT c FROM t2 GROUP BY c HAVING SUM(a) != c);
-
-SELECT t1.a FROM t1 GROUP BY t1.a
- HAVING t1.a < ALL(SELECT t2.c FROM t2 GROUP BY t2.c
- HAVING EXISTS(SELECT t3.e FROM t3 GROUP BY t3.e
- HAVING SUM(t1.a+t2.c) < t3.e/4));
-SELECT t1.a FROM t1 GROUP BY t1.a
- HAVING t1.a > ALL(SELECT t2.c FROM t2
- WHERE EXISTS(SELECT t3.e FROM t3 GROUP BY t3.e
- HAVING SUM(t1.a+t2.c) < t3.e/4));
--- error ER_INVALID_GROUP_FUNC_USE
-SELECT t1.a FROM t1 GROUP BY t1.a
- HAVING t1.a > ALL(SELECT t2.c FROM t2
- WHERE EXISTS(SELECT t3.e FROM t3
- WHERE SUM(t1.a+t2.c) < t3.e/4));
--- error ER_INVALID_GROUP_FUNC_USE
-SELECT t1.a from t1 GROUP BY t1.a HAVING AVG(SUM(t1.b)) > 20;
-
-SELECT t1.a FROM t1 GROUP BY t1.a
- HAVING t1.a IN (SELECT t2.c FROM t2 GROUP BY t2.c
- HAVING AVG(t2.c+SUM(t1.b)) > 20);
-SELECT t1.a FROM t1 GROUP BY t1.a
- HAVING t1.a IN (SELECT t2.c FROM t2 GROUP BY t2.c
- HAVING AVG(SUM(t1.b)) > 20);
-
-SELECT t1.a, SUM(b) AS sum FROM t1 GROUP BY t1.a
- HAVING t1.a IN (SELECT t2.c FROM t2 GROUP BY t2.c
- HAVING t2.c+sum > 20);
-
-DROP TABLE t1,t2,t3;
-
-
-#
-# Test for Bug#16603 GROUP BY in a row subquery with a quantifier
-# when an index is defined on the grouping field
-
-CREATE TABLE t1 (a varchar(5), b varchar(10));
-INSERT INTO t1 VALUES
- ('AAA', 5), ('BBB', 4), ('BBB', 1), ('CCC', 2),
- ('CCC', 7), ('AAA', 2), ('AAA', 4), ('BBB', 3), ('AAA', 8);
-
-SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
-EXPLAIN
-SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
-
-ALTER TABLE t1 ADD INDEX(a);
-
-SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
-EXPLAIN
-SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
-
-DROP TABLE t1;
-
-
-#
-# Bug#17366 Unchecked Item_int results in server crash
-#
-create table t1( f1 int,f2 int);
-insert into t1 values (1,1),(2,2);
-select tt.t from (select 'crash1' as t, f2 from t1) as tt left join t1 on tt.t = 'crash2' and tt.f2 = t1.f2 where tt.t = 'crash1';
-drop table t1;
-
-
-#
-# Bug#18306 server crash on delete using subquery.
-#
-
-create table t1 (c int, key(c));
-insert into t1 values (1142477582), (1142455969);
-create table t2 (a int, b int);
-insert into t2 values (2, 1), (1, 0);
-delete from t1 where c <= 1140006215 and (select b from t2 where a = 2) = 1;
-drop table t1, t2;
-
-
-#
-# Bug#7549 Missing error message for invalid view selection with subquery
-#
-
-CREATE TABLE t1 (a INT);
-
---error ER_BAD_FIELD_ERROR
-CREATE VIEW v1 AS SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
---error ER_BAD_FIELD_ERROR
-CREATE VIEW v2 AS SELECT * FROM t1 WHERE no_such_column = (SELECT 1);
---error ER_BAD_FIELD_ERROR
-SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
-
-DROP TABLE t1;
-
-
-#
-# Bug#19077 A nested materialized derived table is used before being populated.
-#
-create table t1 (i int, j bigint);
-insert into t1 values (1, 2), (2, 2), (3, 2);
-select * from (select min(i) from t1 where j=(select * from (select min(j) from t1) t2)) t3;
-drop table t1;
-
-
-#
-# Bug#19700 subselect returning BIGINT always returned it as SIGNED
-#
-CREATE TABLE t1 (i BIGINT UNSIGNED);
-INSERT INTO t1 VALUES (10000000000000000000); # > MAX SIGNED BIGINT 9323372036854775807
-INSERT INTO t1 VALUES (1);
-
-CREATE TABLE t2 (i BIGINT UNSIGNED);
-INSERT INTO t2 VALUES (10000000000000000000); # same as first table
-INSERT INTO t2 VALUES (1);
-
-/* simple test */
-SELECT t1.i FROM t1 JOIN t2 ON t1.i = t2.i;
-
-/* subquery test */
-SELECT t1.i FROM t1 WHERE t1.i = (SELECT MAX(i) FROM t2);
-
-/* subquery test with cast*/
-SELECT t1.i FROM t1 WHERE t1.i = CAST((SELECT MAX(i) FROM t2) AS UNSIGNED);
-
-DROP TABLE t1;
-DROP TABLE t2;
-
-
-#
-# Bug#20519 subselect with LIMIT M, N
-#
-
-CREATE TABLE t1 (
- id bigint(20) unsigned NOT NULL auto_increment,
- name varchar(255) NOT NULL,
- PRIMARY KEY (id)
-);
-INSERT INTO t1 VALUES
- (1, 'Balazs'), (2, 'Joe'), (3, 'Frank');
-
-CREATE TABLE t2 (
- id bigint(20) unsigned NOT NULL auto_increment,
- mid bigint(20) unsigned NOT NULL,
- date date NOT NULL,
- PRIMARY KEY (id)
-);
-INSERT INTO t2 VALUES
- (1, 1, '2006-03-30'), (2, 2, '2006-04-06'), (3, 3, '2006-04-13'),
- (4, 2, '2006-04-20'), (5, 1, '2006-05-01');
-
-SELECT *,
- (SELECT date FROM t2 WHERE mid = t1.id
- ORDER BY date DESC LIMIT 0, 1) AS date_last,
- (SELECT date FROM t2 WHERE mid = t1.id
- ORDER BY date DESC LIMIT 3, 1) AS date_next_to_last
- FROM t1;
-SELECT *,
- (SELECT COUNT(*) FROM t2 WHERE mid = t1.id
- ORDER BY date DESC LIMIT 1, 1) AS date_count
- FROM t1;
-SELECT *,
- (SELECT date FROM t2 WHERE mid = t1.id
- ORDER BY date DESC LIMIT 0, 1) AS date_last,
- (SELECT date FROM t2 WHERE mid = t1.id
- ORDER BY date DESC LIMIT 1, 1) AS date_next_to_last
- FROM t1;
-DROP TABLE t1,t2;
-
-
-#
-# Bug#20869 subselect with range access by DESC
-#
-
-CREATE TABLE t1 (
- i1 int(11) NOT NULL default '0',
- i2 int(11) NOT NULL default '0',
- t datetime NOT NULL default '0000-00-00 00:00:00',
- PRIMARY KEY (i1,i2,t)
-);
-INSERT INTO t1 VALUES
-(24,1,'2005-03-03 16:31:31'),(24,1,'2005-05-27 12:40:07'),
-(24,1,'2005-05-27 12:40:08'),(24,1,'2005-05-27 12:40:10'),
-(24,1,'2005-05-27 12:40:25'),(24,1,'2005-05-27 12:40:30'),
-(24,2,'2005-03-03 13:43:05'),(24,2,'2005-03-03 16:23:31'),
-(24,2,'2005-03-03 16:31:30'),(24,2,'2005-05-27 12:37:02'),
-(24,2,'2005-05-27 12:40:06');
-
-CREATE TABLE t2 (
- i1 int(11) NOT NULL default '0',
- i2 int(11) NOT NULL default '0',
- t datetime default NULL,
- PRIMARY KEY (i1)
-);
-INSERT INTO t2 VALUES (24,1,'2006-06-20 12:29:40');
-
-EXPLAIN
-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
- ORDER BY t1.t DESC LIMIT 1);
-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
- ORDER BY t1.t DESC LIMIT 1);
-
-DROP TABLE t1, t2;
-
-
-#
-# Bug#14654 Cannot select from the same table twice within a UNION statement
-#
-CREATE TABLE t1 (i INT);
-
-(SELECT i FROM t1) UNION (SELECT i FROM t1);
-SELECT sql_no_cache * FROM t1 WHERE NOT EXISTS
- (
- (SELECT i FROM t1) UNION
- (SELECT i FROM t1)
- );
-
-#TODO:not supported
---error ER_PARSE_ERROR
-SELECT * FROM t1
-WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1)));
-
-#TODO:not supported
---error ER_PARSE_ERROR
-explain select ((select t11.i from t1 t11) union (select t12.i from t1 t12))
- from t1;
-
-explain select * from t1 where not exists
- ((select t11.i from t1 t11) union (select t12.i from t1 t12));
-
-DROP TABLE t1;
-
-
-#
-# Bug#21798 memory leak during query execution with subquery in column
-# list using a function
-#
-CREATE TABLE t1 (a VARCHAR(250), b INT auto_increment, PRIMARY KEY (b));
-insert into t1 (a) values (FLOOR(rand() * 100));
-insert into t1 (a) select FLOOR(rand() * 100) from t1;
-insert into t1 (a) select FLOOR(rand() * 100) from t1;
-insert into t1 (a) select FLOOR(rand() * 100) from t1;
-insert into t1 (a) select FLOOR(rand() * 100) from t1;
-insert into t1 (a) select FLOOR(rand() * 100) from t1;
-insert into t1 (a) select FLOOR(rand() * 100) from t1;
-insert into t1 (a) select FLOOR(rand() * 100) from t1;
-insert into t1 (a) select FLOOR(rand() * 100) from t1;
-insert into t1 (a) select FLOOR(rand() * 100) from t1;
-insert into t1 (a) select FLOOR(rand() * 100) from t1;
-insert into t1 (a) select FLOOR(rand() * 100) from t1;
-insert into t1 (a) select FLOOR(rand() * 100) from t1;
-insert into t1 (a) select FLOOR(rand() * 100) from t1;
-
-SELECT a,
- (SELECT REPEAT(' ',250) FROM t1 i1
- WHERE i1.b=t1.a ORDER BY RAND() LIMIT 1) AS a
-FROM t1 ORDER BY a LIMIT 5;
-DROP TABLE t1;
-
-
-#
-# Bug#21540 Subqueries with no from and aggregate functions return
-# wrong results
-CREATE TABLE t1 (a INT, b INT);
-CREATE TABLE t2 (a INT);
-INSERT INTO t2 values (1);
-INSERT INTO t1 VALUES (1,1),(1,2),(2,3),(3,4);
-SELECT (SELECT COUNT(DISTINCT t1.b) from t2) FROM t1 GROUP BY t1.a;
-SELECT (SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3)
- FROM t1 GROUP BY t1.a;
-SELECT COUNT(DISTINCT t1.b), (SELECT COUNT(DISTINCT t1.b)) FROM t1 GROUP BY t1.a;
-SELECT COUNT(DISTINCT t1.b),
- (SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3)
- FROM t1 GROUP BY t1.a;
-SELECT (
- SELECT (
- SELECT COUNT(DISTINCT t1.b)
- )
-)
-FROM t1 GROUP BY t1.a;
-SELECT (
- SELECT (
- SELECT (
- SELECT COUNT(DISTINCT t1.b)
- )
- )
- FROM t1 GROUP BY t1.a LIMIT 1)
-FROM t1 t2
-GROUP BY t2.a;
-DROP TABLE t1,t2;
-
-
-#
-# Bug#21727 Correlated subquery that requires filesort:
-# slow with big sort_buffer_size
-#
-
-CREATE TABLE t1 (a int, b int, PRIMARY KEY (b));
-CREATE TABLE t2 (x int auto_increment, y int, z int,
- PRIMARY KEY (x), FOREIGN KEY (y) REFERENCES t1 (b));
-create table t3 (a int);
-insert into t3 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-insert into t1 select RAND()*1000, A.a + 10*(B.a+10*(C.a+10*D.a))
-from t3 A, t3 B, t3 C, t3 D where D.a<3;
-insert into t2(y,z) select t1.b, RAND()*1000 from t1, t3;
-enable_query_log;
-
-SET SESSION sort_buffer_size = 32 * 1024;
-SELECT SQL_NO_CACHE COUNT(*)
- FROM (SELECT a, b, (SELECT x FROM t2 WHERE y=b ORDER BY z DESC LIMIT 1) c
- FROM t1) t;
-
-SET SESSION sort_buffer_size = 8 * 1024 * 1024;
-SELECT SQL_NO_CACHE COUNT(*)
- FROM (SELECT a, b, (SELECT x FROM t2 WHERE y=b ORDER BY z DESC LIMIT 1) c
- FROM t1) t;
-
-DROP TABLE t1,t2,t3;
-
-#
-# Bug#25219 EXIST subquery with UNION over a mix of
-# correlated and uncorrelated selects
-#
-
-CREATE TABLE t1 (id char(4) PRIMARY KEY, c int);
-CREATE TABLE t2 (c int);
-
-INSERT INTO t1 VALUES ('aa', 1);
-INSERT INTO t2 VALUES (1);
-
-SELECT * FROM t1
- WHERE EXISTS (SELECT c FROM t2 WHERE c=1
- UNION
- SELECT c from t2 WHERE c=t1.c);
-
-INSERT INTO t1 VALUES ('bb', 2), ('cc', 3), ('dd',1);
-
-SELECT * FROM t1
- WHERE EXISTS (SELECT c FROM t2 WHERE c=1
- UNION
- SELECT c from t2 WHERE c=t1.c);
-
-INSERT INTO t2 VALUES (2);
-CREATE TABLE t3 (c int);
-INSERT INTO t3 VALUES (1);
-
-SELECT * FROM t1
- WHERE EXISTS (SELECT t2.c FROM t2 JOIN t3 ON t2.c=t3.c WHERE t2.c=1
- UNION
- SELECT c from t2 WHERE c=t1.c);
-
-DROP TABLE t1,t2,t3;
-
-
-#
-# Bug#23800 Outer fields in correlated subqueries is used in a temporary
-# table created for sorting.
-#
-CREATE TABLE t1(f1 int);
-CREATE TABLE t2(f2 int, f21 int, f3 timestamp);
-INSERT INTO t1 VALUES (1),(1),(2),(2);
-INSERT INTO t2 VALUES (1,1,"2004-02-29 11:11:11"), (2,2,"2004-02-29 11:11:11");
-SELECT ((SELECT f2 FROM t2 WHERE f21=f1 LIMIT 1) * COUNT(f1)) AS sq FROM t1 GROUP BY f1;
-SELECT (SELECT SUM(1) FROM t2 ttt GROUP BY t2.f3 LIMIT 1) AS tt FROM t2;
-PREPARE stmt1 FROM 'SELECT ((SELECT f2 FROM t2 WHERE f21=f1 LIMIT 1) * COUNT(f1)) AS sq FROM t1 GROUP BY f1';
-EXECUTE stmt1;
-EXECUTE stmt1;
-DEALLOCATE PREPARE stmt1;
-SELECT f2, AVG(f21),
- (SELECT t.f3 FROM t2 AS t WHERE t2.f2=t.f2 AND t.f3=MAX(t2.f3)) AS test
- FROM t2 GROUP BY f2;
-DROP TABLE t1,t2;
-CREATE TABLE t1 (a int, b INT, c CHAR(10) NOT NULL);
-INSERT INTO t1 VALUES
- (1,1,'a'), (1,2,'b'), (1,3,'c'), (1,4,'d'), (1,5,'e'),
- (2,1,'f'), (2,2,'g'), (2,3,'h'), (3,4,'i'), (3,3,'j'),
- (3,2,'k'), (3,1,'l'), (1,9,'m');
-SELECT a, MAX(b),
- (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b)) AS test
- FROM t1 GROUP BY a;
-DROP TABLE t1;
-
-
-#
-# Bug#21904 (parser problem when using IN with a double "(())")
-#
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS t2;
-DROP TABLE IF EXISTS t1xt2;
---enable_warnings
-
-CREATE TABLE t1 (
- id_1 int(5) NOT NULL,
- t varchar(4) DEFAULT NULL
-);
-
-CREATE TABLE t2 (
- id_2 int(5) NOT NULL,
- t varchar(4) DEFAULT NULL
-);
-
-CREATE TABLE t1xt2 (
- id_1 int(5) NOT NULL,
- id_2 int(5) NOT NULL
-);
-
-INSERT INTO t1 VALUES (1, 'a'), (2, 'b'), (3, 'c'), (4, 'd');
-
-INSERT INTO t2 VALUES (2, 'bb'), (3, 'cc'), (4, 'dd'), (12, 'aa');
-
-INSERT INTO t1xt2 VALUES (2, 2), (3, 3), (4, 4);
-
-# subselect returns 0 rows
-
-SELECT DISTINCT t1.id_1 FROM t1 WHERE
-(12 IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));
-
-SELECT DISTINCT t1.id_1 FROM t1 WHERE
-(12 IN ((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1)));
-
-SELECT DISTINCT t1.id_1 FROM t1 WHERE
-(12 IN (((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1))));
-
-SELECT DISTINCT t1.id_1 FROM t1 WHERE
-(12 NOT IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));
-
-SELECT DISTINCT t1.id_1 FROM t1 WHERE
-(12 NOT IN ((SELECT t1xt2.id_2 FROM t1xt2 where t1.id_1 = t1xt2.id_1)));
-
-SELECT DISTINCT t1.id_1 FROM t1 WHERE
-(12 NOT IN (((SELECT t1xt2.id_2 FROM t1xt2 where t1.id_1 = t1xt2.id_1))));
-
-insert INTO t1xt2 VALUES (1, 12);
-
-# subselect returns 1 row
-
-SELECT DISTINCT t1.id_1 FROM t1 WHERE
-(12 IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));
-
-SELECT DISTINCT t1.id_1 FROM t1 WHERE
-(12 IN ((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1)));
-
-SELECT DISTINCT t1.id_1 FROM t1 WHERE
-(12 IN (((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1))));
-
-SELECT DISTINCT t1.id_1 FROM t1 WHERE
-(12 NOT IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));
-
-SELECT DISTINCT t1.id_1 FROM t1 WHERE
-(12 NOT IN ((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1)));
-
-SELECT DISTINCT t1.id_1 FROM t1 WHERE
-(12 NOT IN (((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1))));
-
-insert INTO t1xt2 VALUES (2, 12);
-
-# subselect returns more than 1 row
-
-SELECT DISTINCT t1.id_1 FROM t1 WHERE
-(12 IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));
-
-SELECT DISTINCT t1.id_1 FROM t1 WHERE
-(12 IN ((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1)));
-
-SELECT DISTINCT t1.id_1 FROM t1 WHERE
-(12 IN (((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1))));
-
-SELECT DISTINCT t1.id_1 FROM t1 WHERE
-(12 NOT IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));
-
-SELECT DISTINCT t1.id_1 FROM t1 WHERE
-(12 NOT IN ((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1)));
-
-SELECT DISTINCT t1.id_1 FROM t1 WHERE
-(12 NOT IN (((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1))));
-
-DROP TABLE t1;
-DROP TABLE t2;
-DROP TABLE t1xt2;
-
-
-#
-# Bug#26728 derived table with concatanation of literals in select list
-#
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (3), (1), (2);
-
-SELECT 'this is ' 'a test.' AS col1, a AS col2 FROM t1;
-SELECT * FROM (SELECT 'this is ' 'a test.' AS col1, a AS t2 FROM t1) t;
-
-DROP table t1;
-
-
-#
-# Bug#27257 COUNT(*) aggregated in outer query
-#
-
-CREATE TABLE t1 (a int, b int);
-CREATE TABLE t2 (m int, n int);
-INSERT INTO t1 VALUES (2,2), (2,2), (3,3), (3,3), (3,3), (4,4);
-INSERT INTO t2 VALUES (1,11), (2,22), (3,32), (4,44), (4,44);
-
-SELECT COUNT(*), a,
- (SELECT m FROM t2 WHERE m = count(*) LIMIT 1)
- FROM t1 GROUP BY a;
-
-SELECT COUNT(*), a,
- (SELECT MIN(m) FROM t2 WHERE m = count(*))
- FROM t1 GROUP BY a;
-
-SELECT COUNT(*), a
- FROM t1 GROUP BY a
- HAVING (SELECT MIN(m) FROM t2 WHERE m = count(*)) > 1;
-
-DROP TABLE t1,t2;
-
-
-#
-# Bug#27229 GROUP_CONCAT in subselect with COUNT() as an argument
-#
-
-CREATE TABLE t1 (a int, b int);
-CREATE TABLE t2 (m int, n int);
-INSERT INTO t1 VALUES (2,2), (2,2), (3,3), (3,3), (3,3), (4,4);
-INSERT INTO t2 VALUES (1,11), (2,22), (3,32), (4,44), (4,44);
-
-SELECT COUNT(*) c, a,
- (SELECT GROUP_CONCAT(COUNT(a)) FROM t2 WHERE m = a)
- FROM t1 GROUP BY a;
-
-SELECT COUNT(*) c, a,
- (SELECT GROUP_CONCAT(COUNT(a)+1) FROM t2 WHERE m = a)
- FROM t1 GROUP BY a;
-
-DROP table t1,t2;
-
-
-#
-# Bug#27321 Wrong subquery result in a grouping select
-#
-CREATE TABLE t1 (a int, b INT, d INT, c CHAR(10) NOT NULL, PRIMARY KEY (a, b));
-INSERT INTO t1 VALUES (1,1,0,'a'), (1,2,0,'b'), (1,3,0,'c'), (1,4,0,'d'),
-(1,5,0,'e'), (2,1,0,'f'), (2,2,0,'g'), (2,3,0,'h'), (3,4,0,'i'), (3,3,0,'j'),
-(3,2,0,'k'), (3,1,0,'l'), (1,9,0,'m'), (1,0,10,'n'), (2,0,5,'o'), (3,0,7,'p');
-
-SELECT a, MAX(b),
- (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b + 0)) as test
- FROM t1 GROUP BY a;
-SELECT a x, MAX(b),
- (SELECT t.c FROM t1 AS t WHERE x=t.a AND t.b=MAX(t1.b + 0)) as test
- FROM t1 GROUP BY a;
-SELECT a, AVG(b),
- (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=AVG(t1.b)) AS test
- FROM t1 WHERE t1.d=0 GROUP BY a;
-
-SELECT tt.a,
- (SELECT (SELECT c FROM t1 as t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a)
- LIMIT 1) FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1) as test
- FROM t1 as tt;
-
-SELECT tt.a,
- (SELECT (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a)
- LIMIT 1)
- FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1) as test
- FROM t1 as tt GROUP BY tt.a;
-
-SELECT tt.a, MAX(
- (SELECT (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a)
- LIMIT 1)
- FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1)) as test
- FROM t1 as tt GROUP BY tt.a;
-
-DROP TABLE t1;
-
-
-#
-# Bug#27348 SET FUNCTION used in a subquery from WHERE condition
-#
-
-CREATE TABLE t1 (a int, b int);
-INSERT INTO t1 VALUES (2,22),(1,11),(2,22);
-
-SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 0 GROUP BY a;
-SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 1 GROUP BY a;
-
-SELECT a FROM t1 t0
- WHERE (SELECT COUNT(t0.b) FROM t1 t WHERE t.b>20) GROUP BY a;
-
-SET @@sql_mode='ansi';
---error ER_INVALID_GROUP_FUNC_USE
-SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 0 GROUP BY a;
---error ER_INVALID_GROUP_FUNC_USE
-SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 1 GROUP BY a;
-
---error ER_INVALID_GROUP_FUNC_USE
-SELECT a FROM t1 t0
- WHERE (SELECT COUNT(t0.b) FROM t1 t WHERE t.b>20) GROUP BY a;
-
-SET @@sql_mode=default;
-
-DROP TABLE t1;
-
-
-#
-# Bug#27363 nested aggregates in outer, subquery / sum(select count(outer))
-#
-CREATE TABLE t1 (a INT); INSERT INTO t1 values (1),(1),(1),(1);
-CREATE TABLE t2 (x INT); INSERT INTO t1 values (1000),(1001),(1002);
-
---error ER_INVALID_GROUP_FUNC_USE
-SELECT SUM( (SELECT COUNT(a) FROM t2) ) FROM t1;
---error ER_INVALID_GROUP_FUNC_USE
-SELECT SUM( (SELECT SUM(COUNT(a)) FROM t2) ) FROM t1;
-SELECT COUNT(1) FROM DUAL;
-
---error ER_INVALID_GROUP_FUNC_USE
-SELECT SUM( (SELECT AVG( (SELECT t1.a FROM t2) ) FROM DUAL) ) FROM t1;
-
---error ER_INVALID_GROUP_FUNC_USE
-SELECT
- SUM( (SELECT AVG( (SELECT COUNT(*) FROM t1 t HAVING t1.a < 12) ) FROM t2) )
-FROM t1;
-
---error ER_INVALID_GROUP_FUNC_USE
-SELECT t1.a as XXA,
- SUM( (SELECT AVG( (SELECT COUNT(*) FROM t1 t HAVING XXA < 12) ) FROM t2) )
-FROM t1;
-
-DROP TABLE t1,t2;
-
-
-#
-# Bug#27807 Server crash when executing subquery with EXPLAIN
-#
-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);
-DROP TABLE t1;
-
-
-#
-# Bug#28377 grouping query with a correlated subquery in WHERE condition
-#
-
-CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id));
-INSERT INTO t1 VALUES
- (3,'FL'), (2,'GA'), (4,'FL'), (1,'GA'), (5,'NY'), (7,'FL'), (6,'NY');
-CREATE TABLE t2 (id int NOT NULL, INDEX idx(id));
-INSERT INTO t2 VALUES (7), (5), (1), (3);
-
-SELECT id, st FROM t1
- WHERE st IN ('GA','FL') AND EXISTS(SELECT 1 FROM t2 WHERE t2.id=t1.id);
-SELECT id, st FROM t1
- WHERE st IN ('GA','FL') AND EXISTS(SELECT 1 FROM t2 WHERE t2.id=t1.id)
- GROUP BY id;
-
-SELECT id, st FROM t1
- WHERE st IN ('GA','FL') AND NOT EXISTS(SELECT 1 FROM t2 WHERE t2.id=t1.id);
-SELECT id, st FROM t1
- WHERE st IN ('GA','FL') AND NOT EXISTS(SELECT 1 FROM t2 WHERE t2.id=t1.id)
- GROUP BY id;
-
-DROP TABLE t1,t2;
-
-
-#
-# Bug#28728 crash with EXPLAIN EXTENDED for a query with a derived table
-# over a grouping subselect
-#
-
-CREATE TABLE t1 (a int);
-
-INSERT INTO t1 VALUES (1), (2);
-
-EXPLAIN EXTENDED
-SELECT * FROM (SELECT count(*) FROM t1 GROUP BY a) as res;
-
-DROP TABLE t1;
-
-
-#
-# Bug#28811 crash for query containing subquery with ORDER BY and LIMIT 1
-#
-
-CREATE TABLE t1 (
- a varchar(255) default NULL,
- b timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
- INDEX idx(a,b)
-);
-CREATE TABLE t2 (
- a varchar(255) default NULL
-);
-
-INSERT INTO t1 VALUES ('abcdefghijk','2007-05-07 06:00:24');
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO t1 SELECT * FROM t1;
-INSERT INTO `t1` VALUES ('asdf','2007-02-08 01:11:26');
-INSERT INTO `t2` VALUES ('abcdefghijk');
-INSERT INTO `t2` VALUES ('asdf');
-
-SET session sort_buffer_size=8192;
-
-SELECT (SELECT 1 FROM t1 WHERE t1.a=t2.a ORDER BY t1.b LIMIT 1) AS d1 FROM t2;
-
-DROP TABLE t1,t2;
-
-
-#
-# Bug#27333 subquery grouped for aggregate of outer query / no aggregate
-# of subquery
-#
-CREATE TABLE t1 (a INTEGER, b INTEGER);
-CREATE TABLE t2 (x INTEGER);
-INSERT INTO t1 VALUES (1,11), (2,22), (2,22);
-INSERT INTO t2 VALUES (1), (2);
-
-# wasn't failing, but should
---error ER_SUBQUERY_NO_1_ROW
-SELECT a, COUNT(b), (SELECT COUNT(b) FROM t2) FROM t1 GROUP BY a;
-
-# fails as it should
---error ER_SUBQUERY_NO_1_ROW
-SELECT a, COUNT(b), (SELECT COUNT(b)+0 FROM t2) FROM t1 GROUP BY a;
-
-SELECT (SELECT SUM(t1.a)/AVG(t2.x) FROM t2) FROM t1;
-DROP TABLE t1,t2;
-
-# second test case from 27333
-CREATE TABLE t1 (a INT, b INT);
-INSERT INTO t1 VALUES (1, 2), (1,3), (1,4), (2,1), (2,2);
-
-# returns no rows, when it should
-SELECT a1.a, COUNT(*) FROM t1 a1 WHERE a1.a = 1
-AND EXISTS( SELECT a2.a FROM t1 a2 WHERE a2.a = a1.a)
-GROUP BY a1.a;
-DROP TABLE t1;
-
-#test cases from 29297
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (a INT);
-INSERT INTO t1 VALUES (1),(2);
-INSERT INTO t2 VALUES (1),(2);
-SELECT (SELECT SUM(t1.a) FROM t2 WHERE a=0) FROM t1;
---error ER_SUBQUERY_NO_1_ROW
-SELECT (SELECT SUM(t1.a) FROM t2 WHERE a!=0) FROM t1;
-SELECT (SELECT SUM(t1.a) FROM t2 WHERE a=1) FROM t1;
-DROP TABLE t1,t2;
-
-#
-# Bug#31884 Assertion + crash in subquery in the SELECT clause.
-#
-
-CREATE TABLE t1 (a1 INT, a2 INT);
-CREATE TABLE t2 (b1 INT, b2 INT);
-
-INSERT INTO t1 VALUES (100, 200);
-INSERT INTO t1 VALUES (101, 201);
-INSERT INTO t2 VALUES (101, 201);
-INSERT INTO t2 VALUES (103, 203);
-
-SELECT ((a1,a2) IN (SELECT * FROM t2 WHERE b2 > 0)) IS NULL FROM t1;
-DROP TABLE t1, t2;
-
-#
-# Bug31048 Many nested subqueries may cause server crash.
-#
-#create table t1(a int,b int,key(a),key(b));
-#insert into t1(a,b) values (1,2),(2,1),(2,3),(3,4),(5,4),(5,5),
-# (6,7),(7,4),(5,3);
-# TODO: enable the test after fixing 33266 in 6.0
-
-#let $nesting= 26;
-#let $should_work_nesting= 5;
-#let $start= select sum(a),a from t1 where a> ( select sum(a) from t1 ;
-#let $end= )group by a ;
-#let $start_app= where a> ( select sum(a) from t1 ;
-#let $end_pre= )group by b limit 1 ;
-
-#--disable_result_log
-#--disable_query_log
-# At least 4 level nesting should work without errors
-#while ($should_work_nesting)
-#{
-#--echo $should_work_nesting
-# eval $start $end;
-# eval explain $start $end;
-# let $start= $start
-# $start_app;
-# let $end= $end_pre
-# $end;
-# dec $should_work_nesting;
-#}
-# Other may fail with the 'stack overrun error'
-#while ($nesting)
-#{
-#--echo $nesting
-#--error 0,1436
-# eval $start $end;
-#--error 0,1436
-# eval explain $start $end;
-# let $start= $start
-# $start_app;
-# let $end= $end_pre
-# $end;
-# dec $nesting;
-#}
-#--enable_result_log
-#--enable_query_log
-#drop table t1;
-
-#
-# Bug#28076 inconsistent binary/varbinary comparison
-#
-
-CREATE TABLE t1 (s1 BINARY(5), s2 VARBINARY(5));
-INSERT INTO t1 VALUES (0x41,0x41), (0x42,0x42), (0x43,0x43);
-
-SELECT s1, s2 FROM t1 WHERE s2 IN (SELECT s1 FROM t1);
-SELECT s1, s2 FROM t1 WHERE (s2, 10) IN (SELECT s1, 10 FROM t1);
-
-CREATE INDEX I1 ON t1 (s1);
-CREATE INDEX I2 ON t1 (s2);
-
-SELECT s1, s2 FROM t1 WHERE s2 IN (SELECT s1 FROM t1);
-SELECT s1, s2 FROM t1 WHERE (s2, 10) IN (SELECT s1, 10 FROM t1);
-
-TRUNCATE t1;
-INSERT INTO t1 VALUES (0x41,0x41);
-SELECT * FROM t1 WHERE s1 = (SELECT s2 FROM t1);
-
-DROP TABLE t1;
-
-CREATE TABLE t1 (a1 VARBINARY(2) NOT NULL DEFAULT '0', PRIMARY KEY (a1));
-CREATE TABLE t2 (a2 BINARY(2) default '0', INDEX (a2));
-CREATE TABLE t3 (a3 BINARY(2) default '0');
-INSERT INTO t1 VALUES (1),(2),(3),(4);
-INSERT INTO t2 VALUES (1),(2),(3);
-INSERT INTO t3 VALUES (1),(2),(3);
-SELECT LEFT(t2.a2, 1) FROM t2,t3 WHERE t3.a3=t2.a2;
-SELECT t1.a1, t1.a1 in (SELECT t2.a2 FROM t2,t3 WHERE t3.a3=t2.a2) FROM t1;
-DROP TABLE t1,t2,t3;
-
-CREATE TABLE t1 (a1 BINARY(3) PRIMARY KEY, b1 VARBINARY(3));
-CREATE TABLE t2 (a2 VARBINARY(3) PRIMARY KEY);
-CREATE TABLE t3 (a3 VARBINARY(3) PRIMARY KEY);
-INSERT INTO t1 VALUES (1,10), (2,20), (3,30), (4,40);
-INSERT INTO t2 VALUES (2), (3), (4), (5);
-INSERT INTO t3 VALUES (10), (20), (30);
-SELECT LEFT(t1.a1,1) FROM t1,t3 WHERE t1.b1=t3.a3;
-SELECT a2 FROM t2 WHERE t2.a2 IN (SELECT t1.a1 FROM t1,t3 WHERE t1.b1=t3.a3);
-DROP TABLE t1, t2, t3;
-
-
-#
-# Bug#30788 Inconsistent retrieval of char/varchar
-#
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='semijoin_with_cache=off';
-SET optimizer_switch='materialization=off';
-
-CREATE TABLE t1 (a CHAR(1), b VARCHAR(10));
-INSERT INTO t1 VALUES ('a', 'aa');
-INSERT INTO t1 VALUES ('a', 'aaa');
-SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);
-CREATE INDEX I1 ON t1 (a);
-CREATE INDEX I2 ON t1 (b);
-EXPLAIN SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);
-SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);
-
-CREATE TABLE t2 (a VARCHAR(1), b VARCHAR(10));
-INSERT INTO t2 SELECT * FROM t1;
-CREATE INDEX I1 ON t2 (a);
-CREATE INDEX I2 ON t2 (b);
-EXPLAIN SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2);
-SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2);
-EXPLAIN
-SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500);
-SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500);
-
-DROP TABLE t1,t2;
-
-SET optimizer_switch= @save_optimizer_switch;
-
-#
-# Bug#32400 Complex SELECT query returns correct result only on some occasions
-#
-
-CREATE TABLE t1(a INT, b INT);
-INSERT INTO t1 VALUES (1,1), (1,2), (2,3), (2,4);
-
---error ER_BAD_FIELD_ERROR
-EXPLAIN
-SELECT a AS out_a, MIN(b) FROM t1
-WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a)
-GROUP BY a;
-
---error ER_BAD_FIELD_ERROR
-SELECT a AS out_a, MIN(b) FROM t1
-WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a)
-GROUP BY a;
-
-EXPLAIN
-SELECT a AS out_a, MIN(b) FROM t1 t1_outer
-WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a)
-GROUP BY a;
-
-SELECT a AS out_a, MIN(b) FROM t1 t1_outer
-WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a)
-GROUP BY a;
-
-DROP TABLE t1;
-
-
-#
-# Bug#32036 EXISTS within a WHERE clause with a UNION crashes MySQL 5.122
-#
-
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (a INT);
-
-INSERT INTO t1 VALUES (1),(2);
-INSERT INTO t2 VALUES (1),(2);
-
-SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a));
-EXPLAIN EXTENDED
-SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a));
-
-
-EXPLAIN EXTENDED
-SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION
- (SELECT 1 FROM t2 WHERE t1.a = t2.a));
-
-DROP TABLE t1,t2;
-
-
-#
-# Bug#33675 Usage of an uninitialized memory by filesort in a subquery
-# caused server crash.
-#
-create table t0(a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t1(f11 int, f12 int);
-create table t2(f21 int unsigned not null, f22 int, f23 varchar(10));
-insert into t1 values(1,1),(2,2), (3, 3);
---disable_warnings
-insert ignore into t2
-select -1 , (@a:=(A.a + 10 * (B.a + 10 * (C.a+10*D.a))))/5000 + 1, @a
-from t0 A, t0 B, t0 C, t0 D;
---enable_warnings
-set session sort_buffer_size= 33*1024;
-select count(*) from t1 where f12 =
-(select f22 from t2 where f22 = f12 order by f21 desc, f22, f23 limit 1);
-
-drop table t0,t1,t2;
-
-#
-# Bug#33794 "MySQL crashes executing specific query on specific dump"
-#
-CREATE TABLE t4 (
- f7 varchar(32) collate utf8_bin NOT NULL default '',
- f10 varchar(32) collate utf8_bin default NULL,
- PRIMARY KEY (f7)
-);
-INSERT INTO t4 VALUES(1,1), (2,null);
-
-CREATE TABLE t2 (
- f4 varchar(32) collate utf8_bin NOT NULL default '',
- f2 varchar(50) collate utf8_bin default NULL,
- f3 varchar(10) collate utf8_bin default NULL,
- PRIMARY KEY (f4),
- UNIQUE KEY uk1 (f2)
-);
-INSERT INTO t2 VALUES(1,1,null), (2,2,null);
-
-CREATE TABLE t1 (
- f8 varchar(32) collate utf8_bin NOT NULL default '',
- f1 varchar(10) collate utf8_bin default NULL,
- f9 varchar(32) collate utf8_bin default NULL,
- PRIMARY KEY (f8)
-);
-INSERT INTO t1 VALUES (1,'P',1), (2,'P',1), (3,'R',2);
-
-CREATE TABLE t3 (
- f6 varchar(32) collate utf8_bin NOT NULL default '',
- f5 varchar(50) collate utf8_bin default NULL,
- PRIMARY KEY (f6)
-);
-INSERT INTO t3 VALUES (1,null), (2,null);
-
-SELECT
- IF(t1.f1 = 'R', a1.f2, t2.f2) AS a4,
- IF(t1.f1 = 'R', a1.f3, t2.f3) AS f3,
- SUM(
- IF(
- (SELECT VPC.f2
- FROM t2 VPC, t4 a2, t2 a3
- WHERE
- VPC.f4 = a2.f10 AND a3.f2 = a4
- LIMIT 1) IS NULL,
- 0,
- t3.f5
- )
- ) AS a6
-FROM
- t2, t3, t1 JOIN t2 a1 ON t1.f9 = a1.f4
-GROUP BY a4;
-
-DROP TABLE t1, t2, t3, t4;
-
-
-#
-# Bug#36139 "float, zerofill, crash with subquery"
-#
-create table t1 (a float(5,4) zerofill);
-create table t2 (a float(5,4),b float(2,0));
-
-select t1.a from t1 where
- t1.a= (select b from t2 limit 1) and not
- t1.a= (select a from t2 limit 1) ;
-
-drop table t1, t2;
-
-
-#
-# Bug#36011 Server crash with explain extended on query with dependent
-# subqueries
-#
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1),(2);
-SET @save_join_cache_level=@@join_cache_level;
-SET join_cache_level=0;
-EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 GROUP BY a);
-EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 WHERE a > 3 GROUP BY a);
-SET join_cache_level=@save_join_cache_level;
-DROP TABLE t1;
-
---echo #
---echo # Bug#45061: Incorrectly market field caused wrong result.
---echo #
-CREATE TABLE `C` (
- `int_nokey` int(11) NOT NULL,
- `int_key` int(11) NOT NULL,
- KEY `int_key` (`int_key`)
-);
-
-INSERT INTO `C` VALUES (9,9), (0,0), (8,6), (3,6), (7,6), (0,4),
-(1,7), (9,4), (0,8), (9,4), (0,7), (5,5), (0,0), (8,5), (8,7),
-(5,2), (1,8), (7,0), (0,9), (9,5);
-
---disable_warnings
-SELECT * FROM C WHERE `int_key` IN (SELECT `int_nokey`);
-EXPLAIN EXTENDED SELECT * FROM C WHERE `int_key` IN (SELECT `int_nokey`);
---enable_warnings
-
-DROP TABLE C;
---echo # End of test for bug#45061.
-
-
---echo #
---echo # Bug #46749: Segfault in add_key_fields() with outer subquery level
---echo # field references
---echo #
-
-CREATE TABLE t1 (
- a int,
- b int,
- UNIQUE (a), KEY (b)
-);
-INSERT INTO t1 VALUES (1,1), (2,1);
-
-CREATE TABLE st1 like t1;
-INSERT INTO st1 VALUES (1,1), (2,1);
-
-CREATE TABLE st2 like t1;
-INSERT INTO st2 VALUES (1,1), (2,1);
-
-# should have "impossible where"
-EXPLAIN
-SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
-FROM t1
-WHERE a = 230;
-
-# should not crash
-SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
-FROM t1
-WHERE a = 230;
-
-DROP TABLE t1, st1, st2;
-
---echo #
---echo # Bug #48709: Assertion failed in sql_select.cc:11782:
---echo # int join_read_key(JOIN_TAB*)
---echo #
-
-CREATE TABLE t1 (pk int PRIMARY KEY, int_key int);
-INSERT INTO t1 VALUES (10,1), (14,1);
-
-CREATE TABLE t2 (pk int PRIMARY KEY, int_key int);
-INSERT INTO t2 VALUES (3,3), (5,NULL), (7,3);
-
---echo # should have eq_ref for t1
---replace_column 1 x 2 x 5 x 6 x 7 x 8 x 9 x 10 x
-EXPLAIN
-SELECT * FROM t2 outr
-WHERE outr.int_key NOT IN (SELECT t1.pk FROM t1, t2)
-ORDER BY outr.pk;
-
---echo # should not crash on debug binaries
-SELECT * FROM t2 outr
-WHERE outr.int_key NOT IN (SELECT t1.pk FROM t1, t2)
-ORDER BY outr.pk;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug#12329653
---echo # EXPLAIN, UNION, PREPARED STATEMENT, CRASH, SQL_FULL_GROUP_BY
---echo #
-
-CREATE TABLE t1(a1 int);
-INSERT INTO t1 VALUES (1),(2);
-
-SELECT @@session.sql_mode INTO @old_sql_mode;
-SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
-
-## First a simpler query, illustrating the transformation
-## '1 < some (...)' => '1 < max(...)'
-EXPLAIN EXTENDED
-SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1);
-SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1);
-
-## The query which made the server crash.
-PREPARE stmt FROM
-'SELECT 1 UNION ALL
-SELECT 1 FROM t1
-ORDER BY
-(SELECT 1 FROM t1 AS t1_0
- WHERE 1 < SOME (SELECT a1 FROM t1)
-)' ;
-
---error ER_SUBQUERY_NO_1_ROW
-EXECUTE stmt ;
---error ER_SUBQUERY_NO_1_ROW
-EXECUTE stmt ;
-
-SET SESSION sql_mode=@old_sql_mode;
-
-DEALLOCATE PREPARE stmt;
-DROP TABLE t1;
-
---echo #
---echo # Bug#12763207 - ASSERT IN SUBSELECT::SINGLE_VALUE_TRANSFORMER
---echo #
-
-CREATE TABLE t1(a1 int);
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE TABLE t2(a1 int);
-INSERT INTO t2 VALUES (3);
-
-SELECT @@session.sql_mode INTO @old_sql_mode;
-SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
-
-## All these are subject to the transformation
-## '1 < some (...)' => '1 < max(...)'
-SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2 FROM t2);
-SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2.0 FROM t2);
-SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 'a' FROM t2);
-SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t2);
-
-SET SESSION sql_mode=@old_sql_mode;
-
-DROP TABLE t1, t2;
-
---echo #
---echo # Bug#12763207 - ASSERT IN SUBSELECT::SINGLE_VALUE_TRANSFORMER
---echo #
-
-create table t2(i int);
-insert into t2 values(0);
-
-SELECT @@session.sql_mode INTO @old_sql_mode;
-SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
-
-CREATE VIEW v1 AS
-SELECT 'f' FROM t2 UNION SELECT 'x' FROM t2
-;
-
-CREATE TABLE t1 (
- pk int NOT NULL,
- col_varchar_key varchar(1) DEFAULT NULL,
- PRIMARY KEY (pk),
- KEY col_varchar_key (col_varchar_key)
-);
-
-SELECT t1.pk
-FROM t1
-WHERE t1.col_varchar_key < ALL ( SELECT * FROM v1 )
-;
-
-SET SESSION sql_mode=@old_sql_mode;
-
-drop table t2, t1;
-drop view v1;
-
---echo # End of 5.0 tests.
-
-#
-# Test [NOT] IN truth table (both as top-level and general predicate).
-#
-
-create table t_out (subcase char(3),
- a1 char(2), b1 char(2), c1 char(2));
-create table t_in (a2 char(2), b2 char(2), c2 char(2));
-
-insert into t_out values ('A.1','2a', NULL, '2a');
-#------------------------- A.2 - impossible
-insert into t_out values ('A.3', '2a', NULL, '2a');
-insert into t_out values ('A.4', '2a', NULL, 'xx');
-insert into t_out values ('B.1', '2a', '2a', '2a');
-insert into t_out values ('B.2', '2a', '2a', '2a');
-insert into t_out values ('B.3', '3a', 'xx', '3a');
-insert into t_out values ('B.4', 'xx', '3a', '3a');
-
-insert into t_in values ('1a', '1a', '1a');
-insert into t_in values ('2a', '2a', '2a');
-insert into t_in values (NULL, '2a', '2a');
-insert into t_in values ('3a', NULL, '3a');
--- echo
--- echo Test general IN semantics (not top-level)
--- echo
--- echo case A.1
-select subcase,
- (a1, b1, c1) IN (select * from t_in where a2 = 'no_match') pred_in,
- (a1, b1, c1) NOT IN (select * from t_in where a2 = 'no_match') pred_not_in
-from t_out where subcase = 'A.1';
-
--- echo case A.2 - impossible
-
--- echo case A.3
-select subcase,
- (a1, b1, c1) IN (select * from t_in) pred_in,
- (a1, b1, c1) NOT IN (select * from t_in) pred_not_in
-from t_out where subcase = 'A.3';
-
--- echo case A.4
-select subcase,
- (a1, b1, c1) IN (select * from t_in) pred_in,
- (a1, b1, c1) NOT IN (select * from t_in) pred_not_in
-from t_out where subcase = 'A.4';
-
--- echo case B.1
-select subcase,
- (a1, b1, c1) IN (select * from t_in where a2 = 'no_match') pred_in,
- (a1, b1, c1) NOT IN (select * from t_in where a2 = 'no_match') pred_not_in
-from t_out where subcase = 'B.1';
-
--- echo case B.2
-select subcase,
- (a1, b1, c1) IN (select * from t_in) pred_in,
- (a1, b1, c1) NOT IN (select * from t_in) pred_not_in
-from t_out where subcase = 'B.2';
-
--- echo case B.3
-select subcase,
- (a1, b1, c1) IN (select * from t_in) pred_in,
- (a1, b1, c1) NOT IN (select * from t_in) pred_not_in
-from t_out where subcase = 'B.3';
-
--- echo case B.4
-select subcase,
- (a1, b1, c1) IN (select * from t_in) pred_in,
- (a1, b1, c1) NOT IN (select * from t_in) pred_not_in
-from t_out where subcase = 'B.4';
-
--- echo
--- echo Test IN as top-level predicate, and
--- echo as non-top level for cases A.3, B.3 (the only cases with NULL result).
--- echo
--- echo case A.1
-select case when count(*) > 0 then 'T' else 'F' end as pred_in from t_out
-where subcase = 'A.1' and
- (a1, b1, c1) IN (select * from t_in where a1 = 'no_match');
-
-select case when count(*) > 0 then 'T' else 'F' end as pred_not_in from t_out
-where subcase = 'A.1' and
- (a1, b1, c1) NOT IN (select * from t_in where a1 = 'no_match');
-
-select case when count(*) > 0 then 'T' else 'F' end as not_pred_in from t_out
-where subcase = 'A.1' and
- NOT((a1, b1, c1) IN (select * from t_in where a1 = 'no_match'));
-
--- echo case A.3
-select case when count(*) > 0 then 'T' else 'F' end as pred_in from t_out
-where subcase = 'A.3' and
- (a1, b1, c1) IN (select * from t_in);
-
-select case when count(*) > 0 then 'T' else 'F' end as pred_not_in from t_out
-where subcase = 'A.3' and
- (a1, b1, c1) NOT IN (select * from t_in);
-
-select case when count(*) > 0 then 'T' else 'F' end as not_pred_in from t_out
-where subcase = 'A.3' and
- NOT((a1, b1, c1) IN (select * from t_in));
-# test non-top level result indirectly
-select case when count(*) > 0 then 'N' else 'wrong result' end as pred_in from t_out
-where subcase = 'A.3' and
- ((a1, b1, c1) IN (select * from t_in)) is NULL and
- ((a1, b1, c1) NOT IN (select * from t_in)) is NULL;
-
--- echo case A.4
-select case when count(*) > 0 then 'T' else 'F' end as pred_in from t_out
-where subcase = 'A.4' and
- (a1, b1, c1) IN (select * from t_in);
-
-select case when count(*) > 0 then 'T' else 'F' end as pred_not_in from t_out
-where subcase = 'A.4' and
- (a1, b1, c1) NOT IN (select * from t_in);
-
-select case when count(*) > 0 then 'T' else 'F' end as not_pred_in from t_out
-where subcase = 'A.4' and
- NOT((a1, b1, c1) IN (select * from t_in));
-
--- echo case B.1
-select case when count(*) > 0 then 'T' else 'F' end as pred_in from t_out
-where subcase = 'B.1' and
- (a1, b1, c1) IN (select * from t_in where a1 = 'no_match');
-
-select case when count(*) > 0 then 'T' else 'F' end as pred_not_in from t_out
-where subcase = 'B.1' and
- (a1, b1, c1) NOT IN (select * from t_in where a1 = 'no_match');
-
-select case when count(*) > 0 then 'T' else 'F' end as not_pred_in from t_out
-where subcase = 'B.1' and
- NOT((a1, b1, c1) IN (select * from t_in where a1 = 'no_match'));
-
--- echo case B.2
-select case when count(*) > 0 then 'T' else 'F' end as pred_in from t_out
-where subcase = 'B.2' and
- (a1, b1, c1) IN (select * from t_in);
-
-select case when count(*) > 0 then 'T' else 'F' end as pred_not_in from t_out
-where subcase = 'B.2' and
- (a1, b1, c1) NOT IN (select * from t_in);
-
-select case when count(*) > 0 then 'T' else 'F' end as not_pred_in from t_out
-where subcase = 'B.2' and
- NOT((a1, b1, c1) IN (select * from t_in));
-
--- echo case B.3
-select case when count(*) > 0 then 'T' else 'F' end as pred_in from t_out
-where subcase = 'B.3' and
- (a1, b1, c1) IN (select * from t_in);
-
-select case when count(*) > 0 then 'T' else 'F' end as pred_not_in from t_out
-where subcase = 'B.3' and
- (a1, b1, c1) NOT IN (select * from t_in);
-
-select case when count(*) > 0 then 'T' else 'F' end as not_pred_in from t_out
-where subcase = 'B.3' and
- NOT((a1, b1, c1) IN (select * from t_in));
-# test non-top level result indirectly
-select case when count(*) > 0 then 'N' else 'wrong result' end as pred_in from t_out
-where subcase = 'B.3' and
- ((a1, b1, c1) IN (select * from t_in)) is NULL and
- ((a1, b1, c1) NOT IN (select * from t_in)) is NULL;
-
--- echo case B.4
-select case when count(*) > 0 then 'T' else 'F' end as pred_in from t_out
-where subcase = 'B.4' and
- (a1, b1, c1) IN (select * from t_in);
-
-select case when count(*) > 0 then 'T' else 'F' end as pred_not_in from t_out
-where subcase = 'B.4' and
- (a1, b1, c1) NOT IN (select * from t_in);
-
-select case when count(*) > 0 then 'T' else 'F' end as not_pred_in from t_out
-where subcase = 'B.4' and
- NOT((a1, b1, c1) IN (select * from t_in));
-
-drop table t_out;
-drop table t_in;
-
-
-#
-# Bug#27348 SET FUNCTION used in a subquery from WHERE condition
-#
-
-CREATE TABLE t1 (a INT, b INT);
-INSERT INTO t1 VALUES (2,22),(1,11),(2,22);
-
-SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 0 GROUP BY a;
-SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 1 GROUP BY a;
-
-SELECT a FROM t1 t0
- WHERE (SELECT COUNT(t0.b) FROM t1 t WHERE t.b>20) GROUP BY a;
-
-SET @@sql_mode='ansi';
---error ER_INVALID_GROUP_FUNC_USE
-SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 0 GROUP BY a;
---error ER_INVALID_GROUP_FUNC_USE
-SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 1 GROUP BY a;
-
---error ER_INVALID_GROUP_FUNC_USE
-SELECT a FROM t1 t0
- WHERE (SELECT COUNT(t0.b) FROM t1 t WHERE t.b>20) GROUP BY a;
-
-SET @@sql_mode=default;
-DROP TABLE t1;
-
-#
-# Bug#20835 (literal string with =any values)
-#
-CREATE TABLE t1 (s1 CHAR(1));
-INSERT INTO t1 VALUES ('a');
-SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1);
-DROP TABLE t1;
-
-#
-# Bug#37004 NOT IN subquery with MAX over an empty set
-#
-
-CREATE TABLE t1(c INT, KEY(c));
-CREATE TABLE t2(a INT, b INT);
-INSERT INTO t2 VALUES (1, 10), (2, NULL);
-INSERT INTO t1 VALUES (1), (3);
-
-SELECT * FROM t2 WHERE b NOT IN (SELECT max(t.c) FROM t1, t1 t WHERE t.c>10);
-
-DROP TABLE t1,t2;
-
-#
-# Bug#38191 Server crash with subquery containing DISTINCT and ORDER BY
-#
-
-CREATE TABLE t1(pk INT PRIMARY KEY, a INT, INDEX idx(a));
-INSERT INTO t1 VALUES (1, 10), (3, 30), (2, 20);
-CREATE TABLE t2(pk INT PRIMARY KEY, a INT, b INT, INDEX idxa(a));
-INSERT INTO t2 VALUES (2, 20, 700), (1, 10, 200), (4, 10, 100);
-SELECT * FROM t1
- WHERE EXISTS (SELECT DISTINCT a FROM t2 WHERE t1.a < t2.a ORDER BY b);
-DROP TABLE t1,t2;
-
-#
-# Bug#37548 result value erronously reported being NULL in certain subqueries
-#
-
-CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a), KEY b (b));
-
-INSERT INTO t1 VALUES (1,NULL), (9,NULL);
-
-CREATE TABLE t2 (
- a INT,
- b INT,
- c INT,
- d INT,
- PRIMARY KEY (a),
- UNIQUE KEY b (b,c,d),
- KEY b_2 (b),
- KEY c (c),
- KEY d (d)
-);
-
-INSERT INTO t2 VALUES
- (43, 2, 11 ,30),
- (44, 2, 12 ,30),
- (45, 1, 1 ,10000),
- (46, 1, 2 ,10000),
- (556,1, 32 ,10000);
-
-CREATE TABLE t3 (
- a INT,
- b INT,
- c INT,
- PRIMARY KEY (a),
- UNIQUE KEY b (b,c),
- KEY c (c),
- KEY b_2 (b)
-);
-
-INSERT INTO t3 VALUES (1,1,1), (2,32,1);
-
-explain
-SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT 1) AS incorrect FROM t1, t3 WHERE t3.b=t1.a;
-SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT 1) AS incorrect FROM t1, t3 WHERE t3.b=t1.a;
-
-DROP TABLE t1,t2,t3;
-
-# -- echo #
-# -- echo # Bug#33204: INTO is allowed in subselect, causing inconsistent results
-# -- echo #
-# CREATE TABLE t1( a INT );
-# INSERT INTO t1 VALUES (1),(2);
-#
-# CREATE TABLE t2( a INT, b INT );
-#
-# --error ER_PARSE_ERROR
-# SELECT *
-# FROM (SELECT a INTO @var FROM t1 WHERE a = 2) t1a;
-# --error ER_PARSE_ERROR
-# SELECT *
-# FROM (SELECT a INTO OUTFILE 'file' FROM t1 WHERE a = 2) t1a;
-# --error ER_PARSE_ERROR
-# SELECT *
-# FROM (SELECT a INTO DUMPFILE 'file' FROM t1 WHERE a = 2) t1a;
-#
-# --error ER_PARSE_ERROR
-# SELECT * FROM (
-# SELECT 1 a
-# UNION
-# SELECT a INTO @var FROM t1 WHERE a = 2
-# ) t1a;
-#
-# --error ER_PARSE_ERROR
-# SELECT * FROM (
-# SELECT 1 a
-# UNION
-# SELECT a INTO OUTFILE 'file' FROM t1 WHERE a = 2
-# ) t1a;
-#
-# --error ER_PARSE_ERROR
-# SELECT * FROM (
-# SELECT 1 a
-# UNION
-# SELECT a INTO DUMPFILE 'file' FROM t1 WHERE a = 2
-# ) t1a;
-#
-# SELECT * FROM (SELECT a FROM t1 WHERE a = 2) t1a;
-#
-# SELECT * FROM (
-# SELECT a FROM t1 WHERE a = 2
-# UNION
-# SELECT a FROM t1 WHERE a = 2
-# ) t1a;
-#
-# SELECT * FROM (
-# SELECT 1 a
-# UNION
-# SELECT a FROM t1 WHERE a = 2
-# UNION
-# SELECT a FROM t1 WHERE a = 2
-# ) t1a;
-#
-# # This was not allowed previously. Possibly, it should be allowed on the future.
-# # For now, the intent is to keep the fix as non-intrusive as possible.
-# --error ER_PARSE_ERROR
-# SELECT * FROM ((SELECT 1 a) UNION SELECT 1 a);
-# SELECT * FROM (SELECT 1 a UNION (SELECT 1 a)) alias;
-# SELECT * FROM (SELECT 1 UNION SELECT 1) t1a;
-# --error ER_PARSE_ERROR
-# SELECT * FROM ((SELECT 1 a INTO @a)) t1a;
-# --error ER_PARSE_ERROR
-# SELECT * FROM ((SELECT 1 a INTO OUTFILE 'file' )) t1a;
-# --error ER_PARSE_ERROR
-# SELECT * FROM ((SELECT 1 a INTO DUMPFILE 'file' )) t1a;
-#
-# --error ER_PARSE_ERROR
-# SELECT * FROM (SELECT 1 a UNION (SELECT 1 a INTO @a)) t1a;
-# --error ER_PARSE_ERROR
-# SELECT * FROM (SELECT 1 a UNION (SELECT 1 a INTO DUMPFILE 'file' )) t1a;
-# --error ER_PARSE_ERROR
-# SELECT * FROM (SELECT 1 a UNION (SELECT 1 a INTO OUTFILE 'file' )) t1a;
-#
-# --error ER_PARSE_ERROR
-# SELECT * FROM (SELECT 1 a UNION ((SELECT 1 a INTO @a))) t1a;
-# --error ER_PARSE_ERROR
-# SELECT * FROM (SELECT 1 a UNION ((SELECT 1 a INTO DUMPFILE 'file' ))) t1a;
-# --error ER_PARSE_ERROR
-# SELECT * FROM (SELECT 1 a UNION ((SELECT 1 a INTO OUTFILE 'file' ))) t1a;
-#
-# SELECT * FROM (SELECT 1 a ORDER BY a) t1a;
-# SELECT * FROM (SELECT 1 a UNION SELECT 1 a ORDER BY a) t1a;
-# SELECT * FROM (SELECT 1 a UNION SELECT 1 a LIMIT 1) t1a;
-# SELECT * FROM (SELECT 1 a UNION SELECT 1 a ORDER BY a LIMIT 1) t1a;
-#
-# # Test of rule
-# # table_factor: '(' get_select_lex query_expression_body ')' opt_table_alias
-# # UNION should not be allowed inside the parentheses, nor should
-# # aliases after.
-# #
-# SELECT * FROM t1 JOIN (SELECT 1 UNION SELECT 1) alias ON 1;
-# --error ER_PARSE_ERROR
-# SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1;
-# --error ER_PARSE_ERROR
-# SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1;
-# --error ER_PARSE_ERROR
-# SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1;
-# --error ER_PARSE_ERROR
-# SELECT * FROM t1 JOIN (t1 t1a) t1a ON 1;
-# --error ER_PARSE_ERROR
-# SELECT * FROM t1 JOIN ((t1 t1a)) t1a ON 1;
-#
-# SELECT * FROM t1 JOIN (t1 t1a) ON 1;
-# SELECT * FROM t1 JOIN ((t1 t1a)) ON 1;
-#
-# SELECT * FROM (t1 t1a);
-# SELECT * FROM ((t1 t1a));
-#
-# SELECT * FROM t1 JOIN (SELECT 1 t1a) alias ON 1;
-# SELECT * FROM t1 JOIN ((SELECT 1 t1a)) alias ON 1;
-#
-# SELECT * FROM t1 JOIN (SELECT 1 a) a ON 1;
-# SELECT * FROM t1 JOIN ((SELECT 1 a)) a ON 1;
-#
-# # For the join, TABLE_LIST::select_lex == NULL
-# # Check that we handle this.
-# --error ER_PARSE_ERROR
-# SELECT * FROM (t1 JOIN (SELECT 1) t1a1 ON 1) t1a2;
-#
-# SELECT * FROM t1 WHERE a = ALL ( SELECT 1 );
-# SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION SELECT 1 );
-# SELECT * FROM t1 WHERE a = ANY ( SELECT 3 UNION SELECT 1 );
-#
-# --error ER_PARSE_ERROR
-# SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION SELECT 1 INTO @a);
-# --error ER_PARSE_ERROR
-# SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION SELECT 1 INTO OUTFILE 'file' );
-# --error ER_PARSE_ERROR
-# SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION SELECT 1 INTO DUMPFILE 'file' );
-#
-# SELECT * FROM t1 WHERE a = ( SELECT 1 );
-# SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 );
-# --error ER_PARSE_ERROR
-# SELECT * FROM t1 WHERE a = ( SELECT 1 INTO @a);
-# --error ER_PARSE_ERROR
-# SELECT * FROM t1 WHERE a = ( SELECT 1 INTO OUTFILE 'file' );
-# --error ER_PARSE_ERROR
-# SELECT * FROM t1 WHERE a = ( SELECT 1 INTO DUMPFILE 'file' );
-#
-# --error ER_PARSE_ERROR
-# SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 INTO @a);
-# --error ER_PARSE_ERROR
-# SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 INTO OUTFILE 'file' );
-# --error ER_PARSE_ERROR
-# SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 INTO DUMPFILE 'file' );
-#
-# --error ER_PARSE_ERROR
-# SELECT ( SELECT 1 INTO @v );
-# --error ER_PARSE_ERROR
-# SELECT ( SELECT 1 INTO OUTFILE 'file' );
-# --error ER_PARSE_ERROR
-# SELECT ( SELECT 1 INTO DUMPFILE 'file' );
-#
-# --error ER_PARSE_ERROR
-# SELECT ( SELECT 1 UNION SELECT 1 INTO @v );
-# --error ER_PARSE_ERROR
-# SELECT ( SELECT 1 UNION SELECT 1 INTO OUTFILE 'file' );
-# --error ER_PARSE_ERROR
-# SELECT ( SELECT 1 UNION SELECT 1 INTO DUMPFILE 'file' );
-#
-# # Make sure context is popped when we leave the nested select
-# SELECT ( SELECT a FROM t1 WHERE a = 1 ), a FROM t1;
-# SELECT ( SELECT a FROM t1 WHERE a = 1 UNION SELECT 1 ), a FROM t1;
-#
-# # Make sure we have feature F561 (see .yy file)
-# SELECT * FROM t2 WHERE (a, b) IN (SELECT a, b FROM t2);
-#
-# # Make sure the parser does not allow nested UNIONs anywhere
-#
-# --error ER_PARSE_ERROR
-# SELECT 1 UNION ( SELECT 1 UNION SELECT 1 );
-# --error ER_PARSE_ERROR
-# ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1;
-#
-# --error ER_PARSE_ERROR
-# SELECT ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
-# --error ER_PARSE_ERROR
-# SELECT ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1;
-# SELECT ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
-# SELECT ((SELECT 1 UNION SELECT 1 UNION SELECT 1));
-#
-# --error ER_PARSE_ERROR
-# SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
-# --error ER_PARSE_ERROR
-# SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
-# SELECT * FROM ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ) a;
-#
-# --error ER_PARSE_ERROR
-# SELECT * FROM t1 WHERE a = ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
-# --error ER_PARSE_ERROR
-# SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
-# --error ER_PARSE_ERROR
-# SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
-# --error ER_PARSE_ERROR
-# SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
-#
-# --error ER_PARSE_ERROR
-# SELECT * FROM t1 WHERE a = ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
-# --error ER_PARSE_ERROR
-# SELECT * FROM t1 WHERE a = ALL ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
-# --error ER_PARSE_ERROR
-# SELECT * FROM t1 WHERE a = ANY ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
-# --error ER_PARSE_ERROR
-# SELECT * FROM t1 WHERE a IN ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
-#
-# SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
-# SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
-# SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
-# SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
-#
-# --error ER_PARSE_ERROR
-# SELECT * FROM t1 WHERE EXISTS ( SELECT 1 UNION SELECT 1 INTO @v );
-# SELECT EXISTS(SELECT 1+1);
-# --error ER_PARSE_ERROR
-# SELECT EXISTS(SELECT 1+1 INTO @test);
-# --error ER_PARSE_ERROR
-# SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION SELECT 1 INTO @v );
-#
-# --error ER_PARSE_ERROR
-# SELECT * FROM t1 WHERE EXISTS ( SELECT 1 INTO @v );
-# --error ER_PARSE_ERROR
-# SELECT * FROM t1 WHERE a IN ( SELECT 1 INTO @v );
-# DROP TABLE t1, t2;
-#
-# Bug#37460 Assertion failed:
-# !table->file || table->file->inited == handler::NONE
-#
-CREATE TABLE t1 (id int);
-CREATE TABLE t2 (id int, c int);
-
-INSERT INTO t1 (id) VALUES (1);
-INSERT INTO t2 (id) VALUES (1);
-INSERT INTO t1 (id) VALUES (1);
-INSERT INTO t2 (id) VALUES (1);
-
-CREATE VIEW v1 AS
-SELECT t2.c AS c FROM t1, t2
-WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
-UPDATE v1 SET c=1;
-
-CREATE VIEW v2 (a,b) AS
-SELECT t2.id, t2.c AS c FROM t1, t2
-WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
-
---error ER_VIEW_CHECK_FAILED
-INSERT INTO v2(a,b) VALUES (2,2);
-
-# disabled for now as this refers to old content of t2
---disable_parsing
-INSERT INTO v2(a,b) VALUES (1,2);
---enable_parsing
-SELECT * FROM v1;
-
-CREATE VIEW v3 AS
-SELECT t2.c AS c FROM t2
-WHERE 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
-
-DELETE FROM v3;
-
-DROP VIEW v1,v2,v3;
-DROP TABLE t1,t2;
-
---echo #
---echo # BUG#37822 Correlated subquery with IN and IS UNKNOWN provides wrong result
---echo #
-create table t1(id integer primary key, g integer, v integer, s char(1));
-create table t2(id integer primary key, g integer, v integer, s char(1));
-insert into t1 values
- (10, 10, 10, 'l'),
- (20, 20, 20, 'l'),
- (40, 40, 40, 'l'),
- (41, 40, null, 'l'),
- (50, 50, 50, 'l'),
- (51, 50, null, 'l'),
- (60, 60, 60, 'l'),
- (61, 60, null, 'l'),
- (70, 70, 70, 'l'),
- (90, 90, null, 'l');
-insert into t2 values
- (10, 10, 10, 'r'),
- (30, 30, 30, 'r'),
- (50, 50, 50, 'r'),
- (60, 60, 60, 'r'),
- (61, 60, null, 'r'),
- (70, 70, 70, 'r'),
- (71, 70, null, 'r'),
- (80, 80, 80, 'r'),
- (81, 80, null, 'r'),
- (100,100,null, 'r');
-
-select *
-from t1
-where v in(select v
- from t2
- where t1.g=t2.g) is unknown;
-drop table t1, t2;
-
---echo #
---echo # Bug#37822 Correlated subquery with IN and IS UNKNOWN provides wrong result
---echo #
-create table t1(id integer primary key, g integer, v integer, s char(1));
-create table t2(id integer primary key, g integer, v integer, s char(1));
-insert into t1 values
- (10, 10, 10, 'l'),
- (20, 20, 20, 'l'),
- (40, 40, 40, 'l'),
- (41, 40, null, 'l'),
- (50, 50, 50, 'l'),
- (51, 50, null, 'l'),
- (60, 60, 60, 'l'),
- (61, 60, null, 'l'),
- (70, 70, 70, 'l'),
- (90, 90, null, 'l');
-insert into t2 values
- (10, 10, 10, 'r'),
- (30, 30, 30, 'r'),
- (50, 50, 50, 'r'),
- (60, 60, 60, 'r'),
- (61, 60, null, 'r'),
- (70, 70, 70, 'r'),
- (71, 70, null, 'r'),
- (80, 80, 80, 'r'),
- (81, 80, null, 'r'),
- (100,100,null, 'r');
-
-select *
-from t1
-where v in(select v
- from t2
- where t1.g=t2.g) is unknown;
-drop table t1, t2;
-
--- echo #
--- echo # Bug#33204: INTO is allowed in subselect, causing inconsistent results
--- echo #
-CREATE TABLE t1( a INT );
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE TABLE t2( a INT, b INT );
-
---error ER_PARSE_ERROR
-SELECT *
-FROM (SELECT a INTO @var FROM t1 WHERE a = 2) t1a;
---error ER_PARSE_ERROR
-SELECT *
-FROM (SELECT a INTO OUTFILE 'file' FROM t1 WHERE a = 2) t1a;
---error ER_PARSE_ERROR
-SELECT *
-FROM (SELECT a INTO DUMPFILE 'file' FROM t1 WHERE a = 2) t1a;
-
---error ER_PARSE_ERROR
-SELECT * FROM (
- SELECT 1 a
- UNION
- SELECT a INTO @var FROM t1 WHERE a = 2
-) t1a;
-
---error ER_PARSE_ERROR
-SELECT * FROM (
- SELECT 1 a
- UNION
- SELECT a INTO OUTFILE 'file' FROM t1 WHERE a = 2
-) t1a;
-
---error ER_PARSE_ERROR
-SELECT * FROM (
- SELECT 1 a
- UNION
- SELECT a INTO DUMPFILE 'file' FROM t1 WHERE a = 2
-) t1a;
-
-SELECT * FROM (SELECT a FROM t1 WHERE a = 2) t1a;
-
-SELECT * FROM (
- SELECT a FROM t1 WHERE a = 2
- UNION
- SELECT a FROM t1 WHERE a = 2
-) t1a;
-
-SELECT * FROM (
- SELECT 1 a
- UNION
- SELECT a FROM t1 WHERE a = 2
- UNION
- SELECT a FROM t1 WHERE a = 2
-) t1a;
-
-# This was not allowed previously. Possibly, it should be allowed on the future.
-# For now, the intent is to keep the fix as non-intrusive as possible.
-SELECT * FROM ((SELECT 1 a) UNION SELECT 1 a) q;
-SELECT * FROM (SELECT 1 a UNION (SELECT 1 a)) alias;
-SELECT * FROM (SELECT 1 UNION SELECT 1) t1a;
---error ER_PARSE_ERROR
-SELECT * FROM ((SELECT 1 a INTO @a)) t1a;
---error ER_PARSE_ERROR
-SELECT * FROM ((SELECT 1 a INTO OUTFILE 'file' )) t1a;
---error ER_PARSE_ERROR
-SELECT * FROM ((SELECT 1 a INTO DUMPFILE 'file' )) t1a;
-
---error ER_PARSE_ERROR
-SELECT * FROM (SELECT 1 a UNION (SELECT 1 a INTO @a)) t1a;
---error ER_PARSE_ERROR
-SELECT * FROM (SELECT 1 a UNION (SELECT 1 a INTO DUMPFILE 'file' )) t1a;
---error ER_PARSE_ERROR
-SELECT * FROM (SELECT 1 a UNION (SELECT 1 a INTO OUTFILE 'file' )) t1a;
-
---error ER_PARSE_ERROR
-SELECT * FROM (SELECT 1 a UNION ((SELECT 1 a INTO @a))) t1a;
---error ER_PARSE_ERROR
-SELECT * FROM (SELECT 1 a UNION ((SELECT 1 a INTO DUMPFILE 'file' ))) t1a;
---error ER_PARSE_ERROR
-SELECT * FROM (SELECT 1 a UNION ((SELECT 1 a INTO OUTFILE 'file' ))) t1a;
-
-SELECT * FROM (SELECT 1 a ORDER BY a) t1a;
-SELECT * FROM (SELECT 1 a UNION SELECT 1 a ORDER BY a) t1a;
-SELECT * FROM (SELECT 1 a UNION SELECT 1 a LIMIT 1) t1a;
-SELECT * FROM (SELECT 1 a UNION SELECT 1 a ORDER BY a LIMIT 1) t1a;
-
-# Test of rule
-# table_factor: '(' get_select_lex query_expression_body ')' opt_table_alias
-# UNION should not be allowed inside the parentheses, nor should
-# aliases after.
-#
-SELECT * FROM t1 JOIN (SELECT 1 UNION SELECT 1) alias ON 1;
---error ER_DERIVED_MUST_HAVE_ALIAS
-SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1;
---error ER_PARSE_ERROR
-SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1;
---error ER_PARSE_ERROR
-SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1;
---error ER_PARSE_ERROR
-SELECT * FROM t1 JOIN (t1 t1a) t1a ON 1;
---error ER_PARSE_ERROR
-SELECT * FROM t1 JOIN ((t1 t1a)) t1a ON 1;
-
-SELECT * FROM t1 JOIN (t1 t1a) ON 1;
-SELECT * FROM t1 JOIN ((t1 t1a)) ON 1;
-
-SELECT * FROM (t1 t1a);
-SELECT * FROM ((t1 t1a));
-
-SELECT * FROM t1 JOIN (SELECT 1 t1a) alias ON 1;
-SELECT * FROM t1 JOIN ((SELECT 1 t1a)) alias ON 1;
-
-SELECT * FROM t1 JOIN (SELECT 1 a) a ON 1;
-SELECT * FROM t1 JOIN ((SELECT 1 a)) a ON 1;
-
-# For the join, TABLE_LIST::select_lex == NULL
-# Check that we handle this.
---error ER_PARSE_ERROR
-SELECT * FROM (t1 JOIN (SELECT 1) t1a1 ON 1) t1a2;
-
-SELECT * FROM t1 WHERE a = ALL ( SELECT 1 );
-SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION SELECT 1 );
-SELECT * FROM t1 WHERE a = ANY ( SELECT 3 UNION SELECT 1 );
-
---error ER_PARSE_ERROR
-SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION SELECT 1 INTO @a);
---error ER_PARSE_ERROR
-SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION SELECT 1 INTO OUTFILE 'file' );
---error ER_PARSE_ERROR
-SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION SELECT 1 INTO DUMPFILE 'file' );
-
-SELECT * FROM t1 WHERE a = ( SELECT 1 );
-SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 );
---error ER_PARSE_ERROR
-SELECT * FROM t1 WHERE a = ( SELECT 1 INTO @a);
---error ER_PARSE_ERROR
-SELECT * FROM t1 WHERE a = ( SELECT 1 INTO OUTFILE 'file' );
---error ER_PARSE_ERROR
-SELECT * FROM t1 WHERE a = ( SELECT 1 INTO DUMPFILE 'file' );
-
---error ER_PARSE_ERROR
-SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 INTO @a);
---error ER_PARSE_ERROR
-SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 INTO OUTFILE 'file' );
---error ER_PARSE_ERROR
-SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 INTO DUMPFILE 'file' );
-
---error ER_PARSE_ERROR
-SELECT ( SELECT 1 INTO @v );
---error ER_PARSE_ERROR
-SELECT ( SELECT 1 INTO OUTFILE 'file' );
---error ER_PARSE_ERROR
-SELECT ( SELECT 1 INTO DUMPFILE 'file' );
-
---error ER_PARSE_ERROR
-SELECT ( SELECT 1 UNION SELECT 1 INTO @v );
---error ER_PARSE_ERROR
-SELECT ( SELECT 1 UNION SELECT 1 INTO OUTFILE 'file' );
---error ER_PARSE_ERROR
-SELECT ( SELECT 1 UNION SELECT 1 INTO DUMPFILE 'file' );
-
-# Make sure context is popped when we leave the nested select
-SELECT ( SELECT a FROM t1 WHERE a = 1 ), a FROM t1;
-SELECT ( SELECT a FROM t1 WHERE a = 1 UNION SELECT 1 ), a FROM t1;
-
-# Make sure we have feature F561 (see .yy file)
-SELECT * FROM t2 WHERE (a, b) IN (SELECT a, b FROM t2);
-
-# Make sure the parser does not allow nested UNIONs anywhere
-
---error ER_PARSE_ERROR
-SELECT 1 UNION ( SELECT 1 UNION SELECT 1 );
---error ER_PARSE_ERROR
-( SELECT 1 UNION SELECT 1 ) UNION SELECT 1;
-
---error ER_PARSE_ERROR
-SELECT ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
---error ER_PARSE_ERROR
-SELECT ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1;
-SELECT ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
-SELECT ((SELECT 1 UNION SELECT 1 UNION SELECT 1));
-
---error ER_PARSE_ERROR
-SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
---error ER_DERIVED_MUST_HAVE_ALIAS
-SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
-SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ) a;
-SELECT * FROM ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ) a;
-
---error ER_PARSE_ERROR
-SELECT * FROM t1 WHERE a = ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
---error ER_PARSE_ERROR
-SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
---error ER_PARSE_ERROR
-SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
---error ER_PARSE_ERROR
-SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
-
---error ER_PARSE_ERROR
-SELECT * FROM t1 WHERE a = ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
---error ER_PARSE_ERROR
-SELECT * FROM t1 WHERE a = ALL ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
---error ER_PARSE_ERROR
-SELECT * FROM t1 WHERE a = ANY ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
---error ER_PARSE_ERROR
-SELECT * FROM t1 WHERE a IN ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
-
-SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
-SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
-SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
-SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
-
---error ER_PARSE_ERROR
-SELECT * FROM t1 WHERE EXISTS ( SELECT 1 UNION SELECT 1 INTO @v );
-SELECT EXISTS(SELECT 1+1);
---error ER_PARSE_ERROR
-SELECT EXISTS(SELECT 1+1 INTO @test);
---error ER_PARSE_ERROR
-SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION SELECT 1 INTO @v );
-
---error ER_PARSE_ERROR
-SELECT * FROM t1 WHERE EXISTS ( SELECT 1 INTO @v );
---error ER_PARSE_ERROR
-SELECT * FROM t1 WHERE a IN ( SELECT 1 INTO @v );
-
-DROP TABLE t1, t2;
-#
-# Bug #31157: Crash when select+order by the avg of some field within the
-# group by
-#
-CREATE TABLE t1 (a ENUM('rainbow'));
-INSERT INTO t1 VALUES (),(),(),(),();
-SELECT 1 FROM t1 GROUP BY (SELECT 1 FROM t1 ORDER BY AVG(LAST_INSERT_ID()));
-DROP TABLE t1;
-CREATE TABLE t1 (a LONGBLOB);
-INSERT INTO t1 SET a = 'aaaa';
-INSERT INTO t1 SET a = 'aaaa';
-SELECT 1 FROM t1 GROUP BY
- (SELECT LAST_INSERT_ID() FROM t1 ORDER BY MIN(a) ASC LIMIT 1);
-DROP TABLE t1;
-
-#Seems to be not needed here: set @@optimizer_switch=@subselect_tmp;
---echo #
---echo # Bug #49512 : subquery with aggregate function crash
---echo # subselect_single_select_engine::exec()
-
-CREATE TABLE t1(a INT);
-INSERT INTO t1 VALUES();
-
---echo # should not crash
-SELECT 1 FROM t1 WHERE a <> SOME
-(
- SELECT MAX((SELECT a FROM t1 LIMIT 1)) AS d
- FROM t1,t1 a
-);
-DROP TABLE t1;
-
---echo #
---echo # Bug #45989 take 2 : memory leak after explain encounters an
---echo # error in the query
---echo #
-
-CREATE TABLE t1(a LONGTEXT);
-INSERT INTO t1 VALUES (repeat('a',@@global.max_allowed_packet));
-INSERT INTO t1 VALUES (repeat('b',@@global.max_allowed_packet));
-
---error ER_BAD_FIELD_ERROR
-EXPLAIN EXTENDED SELECT DISTINCT 1 FROM t1,
-(SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) AS d1
-WHERE t1.a = d1.a;
-
-DROP TABLE t1;
-
-
-#
-# Bug #47904 Incorrect results w/ table subquery, derived SQs, and LEFT JOIN on index
-#
-
---echo Set up test tables.
-CREATE TABLE t1 (
- t1_id INT UNSIGNED,
-
- PRIMARY KEY(t1_id)
-) Engine=MyISAM;
-
-INSERT INTO t1 (t1_id) VALUES (1), (2), (3), (4), (5);
-
-CREATE TABLE t2 SELECT * FROM t1;
-
-CREATE TABLE t3 (
- t3_id INT UNSIGNED AUTO_INCREMENT,
- t1_id INT UNSIGNED,
- amount DECIMAL(16,2),
-
- PRIMARY KEY(t3_id),
- KEY(t1_id)
-) Engine=MyISAM;
-
-INSERT INTO t3 (t1_id, t3_id, amount)
- VALUES (1, 1, 100.00), (2, 2, 200.00), (4, 4, 400.00);
-
---echo This is the 'inner query' running by itself.
---echo Produces correct results.
-SELECT
- t1.t1_id,
- IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
-FROM
- t1
- LEFT JOIN t2 ON t2.t1_id=t1.t1_id
-GROUP BY
- t1.t1_id
-;
-
---echo SELECT * FROM (the same inner query)
---echo Produces correct results.
-SELECT * FROM (
-SELECT
- t1.t1_id,
- IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
-FROM
- t1
- LEFT JOIN t2 ON t2.t1_id=t1.t1_id
-GROUP BY
- t1.t1_id
-) AS t;
-
---echo Now make t2.t1_id part of a key.
-ALTER TABLE t2 ADD PRIMARY KEY(t1_id);
-
---echo Same inner query by itself.
---echo Still correct results.
-SELECT
- t1.t1_id,
- IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
-FROM
- t1
- LEFT JOIN t2 ON t2.t1_id=t1.t1_id
-GROUP BY
- t1.t1_id;
-
---echo SELECT * FROM (the same inner query), now with indexes on the LEFT JOIN
-SELECT * FROM (
-SELECT
- t1.t1_id,
- IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
-FROM
- t1
- LEFT JOIN t2 ON t2.t1_id=t1.t1_id
-GROUP BY
- t1.t1_id
-) AS t;
-
-
-DROP TABLE t3;
-DROP TABLE t2;
-DROP TABLE t1;
-
-
---echo #
---echo # Bug #52711: Segfault when doing EXPLAIN SELECT with
---echo # union...order by (select... where...)
---echo #
-
-CREATE TABLE t1 (a VARCHAR(10), FULLTEXT KEY a (a));
-INSERT INTO t1 VALUES (1),(2);
-CREATE TABLE t2 (b INT);
-INSERT INTO t2 VALUES (1),(2);
-
---echo # Should not crash
---disable_result_log
-EXPLAIN
-SELECT * FROM t2 UNION SELECT * FROM t2
- ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
-
---echo # Should not crash
-SELECT * FROM t2 UNION SELECT * FROM t2
- ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
-DROP TABLE t1,t2;
---enable_result_log
-
---echo #
---echo # Bug #58818: Incorrect result for IN/ANY subquery
---echo # with HAVING condition
---echo #
-
-CREATE TABLE t1(i INT);
-INSERT INTO t1 VALUES (1), (2), (3);
-CREATE TABLE t1s(i INT);
-INSERT INTO t1s VALUES (10), (20), (30);
-CREATE TABLE t2s(i INT);
-INSERT INTO t2s VALUES (100), (200), (300);
-
-SELECT * FROM t1
-WHERE t1.i NOT IN
-(
- SELECT STRAIGHT_JOIN t2s.i
- FROM
- t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i
- HAVING t2s.i = 999
-);
-
-SELECT * FROM t1
-WHERE t1.I IN
-(
- SELECT STRAIGHT_JOIN t2s.i
- FROM
- t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i
- HAVING t2s.i = 999
-) IS UNKNOWN;
-
-SELECT * FROM t1
-WHERE NOT t1.I = ANY
-(
- SELECT STRAIGHT_JOIN t2s.i
- FROM
- t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i
- HAVING t2s.i = 999
-);
-
-SELECT * FROM t1
- WHERE t1.i = ANY (
- SELECT STRAIGHT_JOIN t2s.i
- FROM
- t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i
- HAVING t2s.i = 999
- ) IS UNKNOWN;
-
-DROP TABLE t1,t1s,t2s;
-
---echo # LP BUG#675248 - select->prep_where references on freed memory
-
-CREATE TABLE t1 (a int, b int);
-insert into t1 values (1,1),(0,0);
-
-CREATE TABLE t2 (c int);
-insert into t2 values (1),(2);
-
-prepare stmt1 from "select sum(a),(select sum(c) from t2 where table1.b) as sub
-from t1 as table1 group by sub";
-
-execute stmt1;
-
-deallocate prepare stmt1;
-
-prepare stmt1 from "select sum(a),(select sum(c) from t2 having table1.b) as sub
-from t1 as table1";
-
-execute stmt1;
-
-deallocate prepare stmt1;
-
-drop table t1,t2;
-
---echo #
---echo # Bug LP#693935/#58727: Assertion failure with
---echo # a single row subquery returning more than one row
---echo #
-
-create table t1 (a char(1) charset utf8);
-insert into t1 values ('a'), ('b');
-create table t2 (a binary(1));
-insert into t2 values ('x'), ('y');
-
--- error ER_SUBQUERY_NO_1_ROW
-select * from t2 where a=(select a from t1) and a='x';
-
-drop table t1,t2;
-
---echo # End of 5.1 tests
-
---echo #
---echo # Bug #11765713 58705:
---echo # OPTIMIZER LET ENGINE DEPEND ON UNINITIALIZED VALUES
---echo # CREATED BY OPT_SUM_QUERY
---echo #
-
-CREATE TABLE t1(a INT NOT NULL, KEY (a));
-INSERT INTO t1 VALUES (0), (1);
-
---error ER_SUBQUERY_NO_1_ROW
-SELECT 1 as foo FROM t1 WHERE a < SOME
- (SELECT a FROM t1 WHERE a <=>
- (SELECT a FROM t1)
- );
-
-SELECT 1 as foo FROM t1 WHERE a < SOME
- (SELECT a FROM t1 WHERE a <=>
- (SELECT a FROM t1 where a is null)
- );
-
-DROP TABLE t1;
-
---echo #
---echo # Bug #57704: Cleanup code dies with void TABLE::set_keyread(bool):
---echo # Assertion `file' failed.
---echo #
-
-CREATE TABLE t1 (a INT);
-
---error ER_OPERAND_COLUMNS
-SELECT 1 FROM
- (SELECT ROW(
- (SELECT 1 FROM t1 RIGHT JOIN
- (SELECT 1 FROM t1, t1 t2) AS d ON 1),
- 1) FROM t1) AS e;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug#13721076 CRASH WITH TIME TYPE/TIMESTAMP() AND WARNINGS IN SUBQUERY
---echo #
-
-CREATE TABLE t1(a TIME NOT NULL);
-INSERT INTO t1 VALUES ('00:00:32');
-
-SELECT 1 FROM t1 WHERE a >
-(SELECT timestamp(a) AS a FROM t1);
-
-DROP TABLE t1;
-
---echo #
---echo # No BUG#, a case brought from 5.2's innodb_mysql_lock.test
---echo #
-
-create table t1 (i int not null primary key);
-insert into t1 values (1),(2),(3),(4),(5);
-
-create table t2 (j int not null primary key);
-insert into t2 values (1),(2),(3),(4),(5);
-
-create table t3 (k int not null primary key);
-insert into t3 values (1),(2),(3);
-
-create view v2 as select t2.j as j from t2 where t2.j in (select t1.i from t1);
-
-select * from t3 where k in (select j from v2);
-
-drop table t1,t2,t3;
-drop view v2;
-
---echo #
---echo # Bug#52068: Optimizer generates invalid semijoin materialization plan
---echo #
---disable_warnings
-drop table if exists ot1, ot2, it1, it2;
---enable_warnings
-CREATE TABLE ot1(a INTEGER);
-INSERT INTO ot1 VALUES(5), (8);
-CREATE TABLE it2(a INTEGER);
-INSERT INTO it2 VALUES(9), (5), (1), (8);
-CREATE TABLE it3(a INTEGER);
-INSERT INTO it3 VALUES(7), (1), (0), (5), (1), (4);
-CREATE TABLE ot4(a INTEGER);
-INSERT INTO ot4 VALUES(1), (3), (5), (7), (9), (7), (3), (1);
-
-let $query=
-SELECT * FROM ot1,ot4
-WHERE (ot1.a,ot4.a) IN (SELECT it2.a,it3.a
- FROM it2,it3);
-
-eval $query;
-eval explain $query;
-
-DROP TABLE IF EXISTS ot1, ot4, it2, it3;
-
-
---echo #
---echo # Bug#729039: NULL keys used to evaluate subquery
---echo #
-
-CREATE TABLE t1 (a int) ;
-INSERT INTO t1 VALUES (NULL), (1), (NULL), (2);
-
-CREATE TABLE t2 (a int, INDEX idx(a)) ;
-INSERT INTO t2 VALUES (NULL), (1), (NULL);
-
-SELECT * FROM t1
- WHERE EXISTS (SELECT a FROM t2 USE INDEX () WHERE t2.a = t1.a);
-EXPLAIN
-SELECT * FROM t1
- WHERE EXISTS (SELECT a FROM t2 USE INDEX() WHERE t2.a = t1.a);
-
-SELECT * FROM t1
- WHERE EXISTS (SELECT a FROM t2 WHERE t2.a = t1.a);
-EXPLAIN
-SELECT * FROM t1
- WHERE EXISTS (SELECT a FROM t2 WHERE t2.a = t1.a);
-
-DROP TABLE t1,t2;
-
---echo #
---echo # BUG#752992: Wrong results for a subquery with 'semijoin=on'
---echo #
-CREATE TABLE t1 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL);
-INSERT INTO t1 VALUES (11,0);
-INSERT INTO t1 VALUES (12,5);
-INSERT INTO t1 VALUES (15,0);
-CREATE TABLE t2 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL);
-INSERT INTO t2 VALUES (11,1);
-INSERT INTO t2 VALUES (12,2);
-INSERT INTO t2 VALUES (15,4);
-
-
-SET @save_join_cache_level=@@join_cache_level;
-SET join_cache_level=0;
-EXPLAIN SELECT * FROM t1 WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON 1);
-SELECT * FROM t1 WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON 1);
-SET join_cache_level=@save_join_cache_level;
-
-DROP table t1,t2;
-
---echo #
---echo # Bug#751350: crash with pushed condition for outer references when
---echo # there should be none of such conditions
---echo #
-
-CREATE TABLE t1 (a int, b int) ;
-INSERT INTO t1 VALUES (0,0),(0,0);
-set @optimizer_switch_save=@@optimizer_switch;
-set @@optimizer_switch='semijoin=off,materialization=on,in_to_exists=on';
-EXPLAIN
-SELECT b FROM t1
- WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a )
- GROUP BY b;
-
-SELECT b FROM t1
- WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a )
- GROUP BY b;
-set @@optimizer_switch=@optimizer_switch_save;
-DROP TABLE t1;
-
---echo #
---echo # Bug #11765713 58705:
---echo # OPTIMIZER LET ENGINE DEPEND ON UNINITIALIZED VALUES
---echo # CREATED BY OPT_SUM_QUERY
---echo #
-
-CREATE TABLE t1(a INT NOT NULL, KEY (a));
-INSERT INTO t1 VALUES (0), (1);
-
---error ER_SUBQUERY_NO_1_ROW
-SELECT 1 as foo FROM t1 WHERE a < SOME
- (SELECT a FROM t1 WHERE a <=>
- (SELECT a FROM t1)
- );
-
-SELECT 1 as foo FROM t1 WHERE a < SOME
- (SELECT a FROM t1 WHERE a <=>
- (SELECT a FROM t1 where a is null)
- );
-
-DROP TABLE t1;
-
-#
-# LP BUG#823169 NULLs with ALL/ANY and maxmin optimization
-#
-CREATE TABLE t1 (a int(11), b varchar(1));
-INSERT INTO t1 VALUES (2,NULL),(5,'d'),(7,'g');
-
-SELECT a FROM t1 WHERE b < ANY ( SELECT b FROM t1 GROUP BY b );
-SELECT a FROM t1 WHERE b < ANY ( SELECT b FROM t1 );
-SELECT a FROM t1 WHERE b > ANY ( SELECT b FROM t1 GROUP BY b );
-SELECT a FROM t1 WHERE b > ANY ( SELECT b FROM t1 );
-SELECT a FROM t1 WHERE b <= ANY ( SELECT b FROM t1 GROUP BY b );
-SELECT a FROM t1 WHERE b <= ANY ( SELECT b FROM t1 );
-SELECT a FROM t1 WHERE b >= ANY ( SELECT b FROM t1 GROUP BY b );
-SELECT a FROM t1 WHERE b >= ANY ( SELECT b FROM t1 );
-SELECT a FROM t1 WHERE b = ANY ( SELECT b FROM t1 );
-SELECT a FROM t1 WHERE b = ANY ( SELECT b FROM t1 GROUP BY b );
-SELECT a FROM t1 WHERE b <> ANY ( SELECT b FROM t1 );
-SELECT a FROM t1 WHERE b <> ANY ( SELECT b FROM t1 GROUP BY b );
-
-SELECT a FROM t1 WHERE b < ALL ( SELECT b FROM t1 GROUP BY b );
-SELECT a FROM t1 WHERE b < ALL ( SELECT b FROM t1 );
-SELECT a FROM t1 WHERE b > ALL ( SELECT b FROM t1 GROUP BY b );
-SELECT a FROM t1 WHERE b > ALL ( SELECT b FROM t1 );
-SELECT a FROM t1 WHERE b <= ALL ( SELECT b FROM t1 GROUP BY b );
-SELECT a FROM t1 WHERE b <= ALL ( SELECT b FROM t1 );
-SELECT a FROM t1 WHERE b >= ALL ( SELECT b FROM t1 GROUP BY b );
-SELECT a FROM t1 WHERE b >= ALL ( SELECT b FROM t1 );
-SELECT a FROM t1 WHERE b = ALL ( SELECT b FROM t1 );
-SELECT a FROM t1 WHERE b = ALL ( SELECT b FROM t1 GROUP BY b );
-SELECT a FROM t1 WHERE b <> ALL ( SELECT b FROM t1 );
-SELECT a FROM t1 WHERE b <> ALL ( SELECT b FROM t1 GROUP BY b );
-
-delete from t1;
-INSERT INTO t1 VALUES (2,NULL),(5,'d'),(7,'g');
-
-SELECT a FROM t1 WHERE b < ANY ( SELECT b FROM t1 GROUP BY b );
-SELECT a FROM t1 WHERE b < ANY ( SELECT b FROM t1 );
-SELECT a FROM t1 WHERE b > ANY ( SELECT b FROM t1 GROUP BY b );
-SELECT a FROM t1 WHERE b > ANY ( SELECT b FROM t1 );
-SELECT a FROM t1 WHERE b <= ANY ( SELECT b FROM t1 GROUP BY b );
-SELECT a FROM t1 WHERE b <= ANY ( SELECT b FROM t1 );
-SELECT a FROM t1 WHERE b >= ANY ( SELECT b FROM t1 GROUP BY b );
-SELECT a FROM t1 WHERE b >= ANY ( SELECT b FROM t1 );
-SELECT a FROM t1 WHERE b = ANY ( SELECT b FROM t1 );
-SELECT a FROM t1 WHERE b = ANY ( SELECT b FROM t1 GROUP BY b );
-SELECT a FROM t1 WHERE b <> ANY ( SELECT b FROM t1 );
-SELECT a FROM t1 WHERE b <> ANY ( SELECT b FROM t1 GROUP BY b );
-
-SELECT a FROM t1 WHERE b < ALL ( SELECT b FROM t1 GROUP BY b );
-SELECT a FROM t1 WHERE b < ALL ( SELECT b FROM t1 );
-SELECT a FROM t1 WHERE b > ALL ( SELECT b FROM t1 GROUP BY b );
-SELECT a FROM t1 WHERE b > ALL ( SELECT b FROM t1 );
-SELECT a FROM t1 WHERE b <= ALL ( SELECT b FROM t1 GROUP BY b );
-SELECT a FROM t1 WHERE b <= ALL ( SELECT b FROM t1 );
-SELECT a FROM t1 WHERE b >= ALL ( SELECT b FROM t1 GROUP BY b );
-SELECT a FROM t1 WHERE b >= ALL ( SELECT b FROM t1 );
-SELECT a FROM t1 WHERE b = ALL ( SELECT b FROM t1 );
-SELECT a FROM t1 WHERE b = ALL ( SELECT b FROM t1 GROUP BY b );
-SELECT a FROM t1 WHERE b <> ALL ( SELECT b FROM t1 );
-SELECT a FROM t1 WHERE b <> ALL ( SELECT b FROM t1 GROUP BY b );
-
-drop table t1;
-
---echo #
---echo # Fix of lp:780386 (NULL left part with empty ALL subquery).
---echo #
-CREATE TABLE t1 ( f11 int) ;
-INSERT IGNORE INTO t1 VALUES (0),(0);
-
-CREATE TABLE t2 ( f3 int, f10 int, KEY (f10,f3)) ;
-INSERT IGNORE INTO t2 VALUES (NULL,NULL),(5,0);
-
-DROP TABLE IF EXISTS t3;
-CREATE TABLE t3 ( f3 int) ;
-INSERT INTO t3 VALUES (0),(0);
-
-SELECT a1.f3 AS r FROM t2 AS a1 , t1 WHERE a1.f3 < ALL ( SELECT f3 FROM t3 WHERE f3 = 1 ) ;
-DROP TABLE t1, t2, t3;
-
---echo #
---echo # Bug#12763207 - ASSERT IN SUBSELECT::SINGLE_VALUE_TRANSFORMER
---echo #
-
-CREATE TABLE t1(a1 int);
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE TABLE t2(a1 int);
-INSERT INTO t2 VALUES (3);
-
-SELECT @@session.sql_mode INTO @old_sql_mode;
-SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
-
-## All these are subject to the transformation
-## '1 < some (...)' => '1 < max(...)'
-SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2 FROM t2);
-SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2.0 FROM t2);
-SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 'a' FROM t2);
-SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t2);
-
-SET SESSION sql_mode=@old_sql_mode;
-
-DROP TABLE t1, t2;
-
-create table t2(i int);
-insert into t2 values(0);
-
-SELECT @@session.sql_mode INTO @old_sql_mode;
-SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
-
-CREATE VIEW v1 AS
-SELECT 'f' FROM t2 UNION SELECT 'x' FROM t2
-;
-
-CREATE TABLE t1 (
- pk int NOT NULL,
- col_varchar_key varchar(1) DEFAULT NULL,
- PRIMARY KEY (pk),
- KEY col_varchar_key (col_varchar_key)
-);
-
-SELECT t1.pk
-FROM t1
-WHERE t1.col_varchar_key < ALL ( SELECT * FROM v1 )
-;
-
-SET SESSION sql_mode=@old_sql_mode;
-
-drop table t2, t1;
-drop view v1;
-
---echo #
---echo # BUG#50257: Missing info in REF column of the EXPLAIN
---echo # lines for subselects
---echo #
-
-CREATE TABLE t1 (a INT, b INT, INDEX (a));
-INSERT INTO t1 VALUES (3, 10), (2, 20), (7, 10), (5, 20);
-
-EXPLAIN SELECT * FROM (SELECT * FROM t1 WHERE a=7) t;
-EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
-
-DROP TABLE t1;
-
---echo #
---echo # BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
---echo # (duplicate of LP bug #888456)
---echo #
-
-CREATE TABLE t1 (f1 varchar(1));
-INSERT INTO t1 VALUES ('v'),('s');
-
-CREATE TABLE t2 (f1_key varchar(1), KEY (f1_key));
-INSERT INTO t2 VALUES ('j'),('v'),('c'),('m'),('d'),
-('d'),('y'),('t'),('d'),('s');
-
-EXPLAIN
-SELECT table1.f1, table2.f1_key FROM t1 AS table1, t2 AS table2
- WHERE EXISTS (SELECT DISTINCT f1_key FROM t2
- WHERE f1_key != table2.f1_key AND f1_key >= table1.f1);
---sorted_result
-SELECT table1.f1, table2.f1_key FROM t1 AS table1, t2 AS table2
- WHERE EXISTS (SELECT DISTINCT f1_key FROM t2
- WHERE f1_key != table2.f1_key AND f1_key >= table1.f1);
-
-DROP TABLE t1,t2;
-
---echo #
---echo # LP bug 919427: EXPLAIN for a query over a single-row table
---echo # with IN subquery in WHERE condition
---echo #
-
-CREATE TABLE ot (
- col_int_nokey int(11),
- col_varchar_nokey varchar(1)
-) ;
-INSERT INTO ot VALUES (1,'x');
-
-CREATE TABLE it1(
- col_int_key int(11),
- col_varchar_key varchar(1),
- KEY idx_cvk_cik (col_varchar_key,col_int_key)
-);
-INSERT INTO it1 VALUES (NULL,'x'), (NULL,'f');
-
-CREATE TABLE it2 (
- col_int_key int(11),
- col_varchar_key varchar(1),
- col_varchar_key2 varchar(1),
- KEY idx_cvk_cvk2_cik (col_varchar_key, col_varchar_key2, col_int_key),
- KEY idx_cvk_cik (col_varchar_key, col_int_key)
-);
-INSERT INTO it2 VALUES (NULL,'x','x'), (NULL,'f','f');
-
-EXPLAIN
-SELECT col_int_nokey FROM ot
- WHERE col_varchar_nokey IN
- (SELECT col_varchar_key FROM it1 WHERE col_int_key IS NULL);
-SELECT col_int_nokey FROM ot
- WHERE col_varchar_nokey IN
- (SELECT col_varchar_key FROM it1 WHERE col_int_key IS NULL);
-
-EXPLAIN
-SELECT col_int_nokey FROM ot
- WHERE (col_varchar_nokey, 'x') IN
- (SELECT col_varchar_key, col_varchar_key2 FROM it2);
-SELECT col_int_nokey FROM ot
- WHERE (col_varchar_nokey, 'x') IN
- (SELECT col_varchar_key, col_varchar_key2 FROM it2);
-
-DROP TABLE ot,it1,it2;
-
---echo #
---echo # MDEV-746
---echo # Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY
---echo # HAS AN EMPTY RESULT
---echo #
-
-CREATE TABLE t1 (
- pk int NOT NULL,
- col_int_nokey int NOT NULL,
- col_int_key int NOT NULL,
- col_time_key time NOT NULL,
- col_varchar_key varchar(1) NOT NULL,
- col_varchar_nokey varchar(1) NOT NULL,
- PRIMARY KEY (pk),
- KEY col_int_key (col_int_key),
- KEY col_time_key (col_time_key),
- KEY col_varchar_key (col_varchar_key,col_int_key)
-) ENGINE=MyISAM;
-
-CREATE TABLE t2 (
- pk int NOT NULL AUTO_INCREMENT,
- col_int_nokey int NOT NULL,
- col_int_key int NOT NULL,
- col_time_key time NOT NULL,
- col_varchar_key varchar(1) NOT NULL,
- col_varchar_nokey varchar(1) NOT NULL,
- PRIMARY KEY (pk),
- KEY col_int_key (col_int_key),
- KEY col_time_key (col_time_key),
- KEY col_varchar_key (col_varchar_key,col_int_key)
-) ENGINE=MyISAM;
-
-INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b');
-
-SET @var2:=4, @var3:=8;
-
---echo
---echo Testcase without inner subquery
-
-let $subq=
-SELECT @var3:=12, sq4_alias1.*
-FROM t1 AS sq4_alias1
-WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
- sq4_alias1.col_varchar_key = @var3;
-
-eval EXPLAIN $subq;
-eval $subq;
-SELECT @var3;
-
-# Now as derived table:
-eval EXPLAIN SELECT * FROM ( $subq ) AS alias3;
-eval SELECT * FROM ( $subq ) AS alias3;
-SELECT @var3;
-
---echo
---echo Testcase with inner subquery; crashed WL#6095
-SET @var3=8;
-let $subq=
-SELECT sq4_alias1.*
-FROM t1 AS sq4_alias1
-WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
- NOT IN
- (SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
- c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
- FROM t2 AS c_sq1_alias1
- WHERE (c_sq1_alias1.col_int_nokey != @var2
- OR c_sq1_alias1.pk != @var3));
-
-eval EXPLAIN $subq;
-eval $subq;
-# Now as derived table:
-eval EXPLAIN SELECT * FROM ( $subq ) AS alias3;
-eval SELECT * FROM ( $subq ) AS alias3;
-
-DROP TABLE t1,t2;
-
---echo # End of 5.2 tests
-
---echo #
---echo # BUG#779885: Crash in eliminate_item_equal with materialization=on in
---echo #
-
-CREATE TABLE t1 ( f1 int );
-INSERT INTO t1 VALUES (19), (20);
-
-CREATE TABLE t2 ( f10 varchar(32) );
-INSERT INTO t2 VALUES ('c'),('d');
-
-CREATE TABLE t3 ( f10 varchar(32) );
-INSERT INTO t3 VALUES ('a'),('b');
-
-SELECT *
-FROM t1
-WHERE
-( 't' ) IN (
- SELECT t3.f10
- FROM t3
- JOIN t2
- ON t2.f10 = t3.f10
-);
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # BUG lp:813473: Wrong result with outer join + NOT IN subquery
---echo # This bug is a duplicate of Bug#11764086 whose test case is added below
---echo #
-
-CREATE TABLE t1 (c int) ;
-INSERT INTO t1 VALUES (5),(6);
-
-CREATE TABLE t2 (a int, b int) ;
-INSERT INTO t2 VALUES (20,9),(20,9);
-
-create table t3 (d int, e int);
-insert into t3 values (2, 9), (3,10);
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='outer_join_with_cache=off';
-
-EXPLAIN
-SELECT t2.b , t1.c
-FROM t2 LEFT JOIN t1 ON t1.c < 3
-WHERE (t2.b , t1.c) NOT IN (SELECT * from t3);
-
-SELECT t2.b , t1.c
-FROM t2 LEFT JOIN t1 ON t1.c < 3
-WHERE (t2.b, t1.c) NOT IN (SELECT * from t3);
-
-SET optimizer_switch=@save_optimizer_switch;
-
-drop table t1, t2, t3;
-
---echo #
---echo # BUG#50257: Missing info in REF column of the EXPLAIN
---echo # lines for subselects
---echo #
-
-CREATE TABLE t1 (a INT, b INT, INDEX (a));
-INSERT INTO t1 VALUES (3, 10), (2, 20), (7, 10), (5, 20);
-
---echo
-set @tmp_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='derived_merge=off,derived_with_keys=off';
-EXPLAIN SELECT * FROM (SELECT * FROM t1 WHERE a=7) t;
-set optimizer_switch=@tmp_optimizer_switch;
---echo
-EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
-
---echo
-DROP TABLE t1;
-
---echo #
---echo # Bug#11764086: Null left operand to NOT IN in WHERE clause
---echo # behaves differently than real NULL
---echo #
-
-CREATE TABLE parent (id int);
-INSERT INTO parent VALUES (1), (2);
-
-CREATE TABLE child (parent_id int, other int);
-INSERT INTO child VALUES (1,NULL);
-
---echo # Offending query (c.parent_id is NULL for null-complemented rows only)
-
-SELECT p.id, c.parent_id
-FROM parent p
-LEFT JOIN child c
-ON p.id = c.parent_id
-WHERE c.parent_id NOT IN (
- SELECT parent_id
- FROM child
- WHERE parent_id = 3
- );
-
---echo # Some syntactic variations with IS FALSE and IS NOT TRUE
-
-SELECT p.id, c.parent_id
-FROM parent p
-LEFT JOIN child c
-ON p.id = c.parent_id
-WHERE c.parent_id IN (
- SELECT parent_id
- FROM child
- WHERE parent_id = 3
- ) IS NOT TRUE;
-
-SELECT p.id, c.parent_id
-FROM parent p
-LEFT JOIN child c
-ON p.id = c.parent_id
-WHERE c.parent_id IN (
- SELECT parent_id
- FROM child
- WHERE parent_id = 3
- ) IS FALSE;
-
-DROP TABLE parent, child;
-
---echo # End of test for bug#11764086.
-
---echo #
---echo # Bug 11765699 - 58690: !TABLE || (!TABLE->READ_SET ||
---echo # BITMAP_IS_SET(TABLE->READ_SET, FIELD_INDEX
---echo #
-
-CREATE TABLE t1(a INT);
-INSERT INTO t1 VALUES (0), (1);
-
-CREATE TABLE t2(
- b TEXT,
- c INT,
- PRIMARY KEY (b(1))
-);
-INSERT INTO t2 VALUES ('a', 2), ('b', 3);
-
-SELECT 1 FROM t1 WHERE a =
- (SELECT 1 FROM t2 WHERE b =
- (SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
- ORDER BY b
- );
-
-SELECT 1 FROM t1 WHERE a =
- (SELECT 1 FROM t2 WHERE b =
- (SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
- GROUP BY b
- );
-
-DROP TABLE t1, t2;
-
---echo #
---echo # BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
---echo #
-
-CREATE TABLE t1 (f1 varchar(1));
-INSERT INTO t1 VALUES ('v'),('s');
-
-CREATE TABLE t2 (f1_key varchar(1), KEY (f1_key));
-INSERT INTO t2 VALUES ('j'),('v'),('c'),('m'),('d'),
-('d'),('y'),('t'),('d'),('s');
-
-let $query=SELECT table1.f1, table2.f1_key
-FROM t1 AS table1, t2 AS table2
-WHERE EXISTS
-(
-SELECT DISTINCT f1_key
-FROM t2
-WHERE f1_key != table2.f1_key AND f1_key >= table1.f1 );
-
---sorted_result
-eval $query;
-eval explain $query;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # lp:826279: assertion failure with GROUP BY a result of subquery
---echo #
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (0), (0);
-
-CREATE TABLE t2 (a int, b int, c int);
-INSERT INTO t2 VALUES (10,7,0), (0,7,0);
-
-CREATE TABLE t3 (a int, b int);
-INSERT INTO t3 VALUES (10,7), (0,7);
-
-SELECT SUM(DISTINCT b),
- (SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0
- WHERE t.a != 0 AND t2.a != 0)
- FROM (SELECT * FROM t3) AS t
-GROUP BY 2;
-
-SELECT SUM(DISTINCT b),
- (SELECT t2.a FROM t1,t2 WHERE t.a != 0 or 1=2 LIMIT 1)
- FROM (SELECT * FROM t3) AS t
-GROUP BY 2;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # Bug#12329653
---echo # EXPLAIN, UNION, PREPARED STATEMENT, CRASH, SQL_FULL_GROUP_BY
---echo #
-
-CREATE TABLE t1(a1 int);
-INSERT INTO t1 VALUES (1),(2);
-
-SELECT @@session.sql_mode INTO @old_sql_mode;
-SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
-
-## First a simpler query, illustrating the transformation
-## '1 < some (...)' => '1 < max(...)'
-SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1);
-
-## The query which made the server crash.
-PREPARE stmt FROM
-'SELECT 1 UNION ALL
-SELECT 1 FROM t1
-ORDER BY
-(SELECT 1 FROM t1 AS t1_0
- WHERE 1 < SOME (SELECT a1 FROM t1)
-)' ;
-
---error ER_SUBQUERY_NO_1_ROW
-EXECUTE stmt ;
---error ER_SUBQUERY_NO_1_ROW
-EXECUTE stmt ;
-
-SET SESSION sql_mode=@old_sql_mode;
-
-DEALLOCATE PREPARE stmt;
-DROP TABLE t1;
-
---echo #
---echo # LP BUG#833777 Performance regression with deeply nested subqueries
---echo #
-
-create table t1 (a int not null, b char(10) not null);
-insert into t1 values (1, 'a');
-set @@optimizer_switch='in_to_exists=on,semijoin=off,materialization=off,subquery_cache=off';
-select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1)))))))))))))))))))))))))))));
-set @@optimizer_switch=@subselect_tmp;
-drop table t1;
-
---echo #
---echo # LP BUG#894397 Wrong result with in_to_exists, constant table , semijoin=OFF,materialization=OFF
---echo #
-
-CREATE TABLE t1 (a varchar(3));
-INSERT INTO t1 VALUES ('AAA'),('BBB');
-CREATE TABLE t2 (a varchar(3));
-INSERT INTO t2 VALUES ('CCC');
-set @@optimizer_switch='semijoin=off,materialization=off,in_to_exists=on,subquery_cache=off';
-SELECT * FROM t1 WHERE t1.a IN (SELECT t2.a FROM t2 WHERE t2.a < 'ZZZ');
-set @@optimizer_switch=@subselect_tmp;
-drop table t1, t2;
-
---echo #
---echo # LP bug #859375: Assertion `0' failed in st_select_lex_unit::optimize
---echo # with view , UNION and prepared statement (rewriting fake_select
---echo # condition).
---echo #
-
-CREATE TABLE t1 ( f1 int NOT NULL, f4 varchar(1) NOT NULL) ;
-INSERT INTO t1 VALUES (6,'d'),(7,'y');
-
-CREATE TABLE t2 ( f1 int NOT NULL, f2 int NOT NULL) ;
-INSERT INTO t2 VALUES (10,7);
-
-CREATE VIEW v2 AS SELECT * FROM t2;
-
-PREPARE st1 FROM "
- SELECT *
- FROM t1
- LEFT JOIN v2 ON ( v2.f2 = t1.f1 )
- WHERE v2.f1 NOT IN (
- SELECT 1 UNION
- SELECT 247
- )
-";
-
-EXECUTE st1;
-deallocate prepare st1;
-
-DROP VIEW v2;
-DROP TABLE t1,t2;
-
---echo #
---echo # LP bug #887458 Crash in subselect_union_engine::no_rows with
---echo # double UNION and join_cache_level=3,8
---echo # (IN/ALL/ANY optimizations should not be applied to fake_select)
-
-CREATE TABLE t2 ( a int, b varchar(1)) ;
-INSERT IGNORE INTO t2 VALUES (8,'y'),(8,'y');
-
-CREATE TABLE t1 ( b varchar(1)) ;
-INSERT IGNORE INTO t1 VALUES (NULL),(NULL);
-
-set @save_join_cache_level=@@join_cache_level;
-SET SESSION join_cache_level=3;
-
-SELECT *
-FROM t1, t2
-WHERE t2.b IN (
- SELECT 'm' UNION
- SELECT 'm'
-) OR t1.b <> SOME (
- SELECT 'v' UNION
- SELECT 't'
-);
-
-set @@join_cache_level= @save_join_cache_level;
-drop table t1,t2;
-
-
---echo #
---echo # LP bug #885162 Got error 124 from storage engine with UNION inside
---echo # subquery and join_cache_level=3..8
---echo # (IN/ALL/ANY optimizations should not be applied to fake_select)
---echo #
-
-CREATE TABLE t1 (
- f1 varchar(1) DEFAULT NULL
- );
-INSERT INTO t1 VALUES ('c');
-set @save_join_cache_level=@@join_cache_level;
-SET SESSION join_cache_level=8;
-SELECT * FROM t1 WHERE t1.f1 IN ( SELECT 'k' UNION SELECT 'e' );
-set @@join_cache_level= @save_join_cache_level;
-drop table t1;
-
-
---echo #
---echo # LP BUG#747278 incorrect values of the NULL (no rows) single
---echo # row subquery requested via element_index() interface
---echo #
-
-CREATE TABLE t1 (f1a int, f1b int) ;
-INSERT IGNORE INTO t1 VALUES (1,1),(2,2);
-CREATE TABLE t2 ( f2 int);
-INSERT IGNORE INTO t2 VALUES (3),(4);
-CREATE TABLE t3 (f3a int default 1, f3b int default 2);
-INSERT INTO t3 VALUES (1,1),(2,2);
-
-# check different IN with switches where the bug was found
-set @old_optimizer_switch = @@session.optimizer_switch;
-set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,subquery_cache=off,semijoin=off';
-
-SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2;
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2;
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2;
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1);
-SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2;
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2;
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2;
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1);
-
-set @@session.optimizer_switch=@old_optimizer_switch;
-
-# check different IN with default switches
-SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2;
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2;
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2;
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1);
-SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2;
-SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2;
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2;
-SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1);
-
-# other row operation with NULL single row subquery also should work
-select (null, null) = (null, null);
-SELECT (SELECT f3a, f3a FROM t3 where f3a > 3) = (0, 0);
-
-drop tables t1,t2,t3;
-
---echo #
---echo # LP BUG#825051 Wrong result with date/datetime and subquery with GROUP BY and in_to_exists
---echo #
-
-CREATE TABLE t1 (a date, KEY (a)) ;
-INSERT INTO t1 VALUES ('2009-01-01'),('2009-02-02');
-set @old_optimizer_switch = @@optimizer_switch;
-SET @@optimizer_switch='semijoin=off,materialization=off,in_to_exists=on,subquery_cache=off';
-EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1);
-SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1);
-SET @@optimizer_switch='semijoin=off,materialization=on,in_to_exists=off,subquery_cache=off';
-EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1);
-SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1);
-set @@optimizer_switch=@old_optimizer_switch;
-drop table t1;
-
---echo #
---echo # LP BUG#908269 incorrect condition in case of subqueries depending
---echo # on constant tables
---echo #
-CREATE TABLE t1 ( a INT );
-INSERT INTO t1 VALUES (1),(5);
-
-# t2 must be MyISAM or Aria and contain 1 row
-CREATE TABLE t2 ( b INT ) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (1);
-
-CREATE TABLE t3 ( c INT );
-INSERT INTO t3 VALUES (4),(5);
-
-SET optimizer_switch='subquery_cache=off';
-
-SELECT ( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
-
-# This query just for example, it should return the same as above (1 and NULL)
-SELECT ( SELECT b FROM t2 WHERE b = a OR b * 0) FROM t1;
-
-# example with "random"
-SELECT ( SELECT b FROM t2 WHERE b = a OR rand() * 0) FROM t1;
-
-drop table t1,t2,t3;
-set optimizer_switch=@subselect_tmp;
-
---echo #
---echo # LP BUG#905353 Wrong non-empty result with a constant table,
---echo # aggregate function in subquery, MyISAM or Aria
---echo #
-
-CREATE TABLE t1 ( a INT ) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1);
-
-SELECT a FROM t1 WHERE ( SELECT MIN(a) = 100 );
-
-drop table t1;
-
---echo #
---echo # LP BUG#985667 Wrong result with subquery in SELECT clause, and constant table in
---echo # main query and implicit grouping
---echo #
-
-CREATE TABLE t1 (f1 int) engine=MyISAM;
-INSERT INTO t1 VALUES (7),(8);
-
-CREATE TABLE t2 (f2 int, f3 varchar(1)) engine=MyISAM;
-INSERT INTO t2 VALUES (3,'f');
-
-EXPLAIN
-SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
-SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
-
-EXPLAIN
-SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
-SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
-
-EXPLAIN
-SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3;
-SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3;
-
-EXPLAIN
-SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3;
-SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3;
-
-drop table t1,t2;
-
---echo #
---echo # LP BUG#1002079 Server crashes in Item_singlerow_subselect::val_int with constant table,
---echo # HAVING, UNION in subquery
---echo #
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (7),(0);
-CREATE TABLE t2 (b INT);
-
-EXPLAIN
-SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7;
-
-SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7;
-
-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 # MDEV-367: Different results with and without subquery_cache on
---echo # a query with a constant NOT IN condition
---echo #
-CREATE TABLE t1 (a INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(2),(3);
-
-set @mdev367_optimizer_switch = @@optimizer_switch;
-
-set optimizer_switch = 'subquery_cache=on';
-SELECT * FROM t1 WHERE ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) OR a > 100;
-SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1;
-set optimizer_switch=@mdev367_optimizer_switch;
-
-set optimizer_switch = 'subquery_cache=off';
-SELECT * FROM t1 WHERE ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) OR a > 100;
-SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1;
-set optimizer_switch=@mdev367_optimizer_switch;
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-521 single value subselect transformation problem
---echo #
-CREATE TABLE t1 (f1 char(2), PRIMARY KEY (f1)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('u1'),('u2');
-
-SELECT a.* FROM t1 a WHERE ( SELECT EXISTS ( SELECT 1 FROM t1 b WHERE b.f1 = a.f1 ) );
-FLUSH TABLES;
-SELECT a.* FROM t1 a WHERE ( SELECT EXISTS ( SELECT 1 FROM t1 b WHERE b.f1 = a.f1 ) );
-
-# Cleanup
-DROP TABLE t1;
-
---echo # return optimizer switch changed in the beginning of this test
-set optimizer_switch=@subselect_tmp;
-
---echo #
---echo # lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not
---echo # precomputed and thus not part of optimization
---echo #
-
-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 #
---echo # MDEV-430: Server crashes in select_describe on EXPLAIN with
---echo # materialization+semijoin, 2 nested subqueries, aggregate functions
---echo #
-CREATE TABLE t1 (a INT, KEY(a));
-INSERT INTO t1 VALUES (1),(8);
-
-CREATE TABLE t2 (b INT, KEY(b));
-INSERT INTO t2 VALUES (45),(17),(20);
-
-EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-435: Expensive subqueries may be evaluated during optimization in merge_key_fields
---echo #
-
-CREATE TABLE t1 (a INT, KEY(a)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (8),(0);
-
-CREATE TABLE t2 (b INT, c VARCHAR(1)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (4,'j'),(6,'v');
-
-CREATE TABLE t3 (d VARCHAR(1)) ENGINE=MyISAM;
-INSERT INTO t3 VALUES ('b'),('c');
-
-EXPLAIN
-SELECT * FROM t1
-WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
-
-SELECT * FROM t1
-WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
-
-drop table t1, t2, t3;
-
-
---echo #
---echo # MDEV-405: Server crashes in test_if_skip_sort_order on EXPLAIN with GROUP BY and HAVING in EXISTS subquery
---echo #
-CREATE TABLE t1 (a INT, KEY(a));
-INSERT INTO t1 VALUES (1),(8);
-
-CREATE TABLE t2 (b INT, KEY(b));
-INSERT INTO t2 VALUES (45),(17),(20);
-
-EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-5991: crash in Item_field::used_tables
---echo #
-create table t1 (c int);
-select exists(select 1 from t1 group by `c` in (select `c` from t1));
-drop table t1;
-
---echo #
---echo # MDEV-7565: Server crash with Signal 6 (part 2)
---echo #
-Select
- (Select Sum(`TestCase`.Revenue) From mysql.slow_log E
- Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
- ) As `ControlRev`
-From
-(Select 3 as Revenue, 4 as TemplateID) As `TestCase`
-Group By TestCase.Revenue, TestCase.TemplateID;
-
---echo #
---echo # MDEV-7445:Server crash with Signal 6
---echo #
-
---delimiter |
-CREATE PROCEDURE procedure2()
-BEGIN
- Select
- (Select Sum(`TestCase`.Revenue) From mysql.slow_log E
- Where TestCase.TemplateID not in (Select 1 from mysql.slow_log where 2=2)
- ) As `ControlRev`
- From
- (Select 3 as Revenue, 4 as TemplateID) As `TestCase`
- Group By TestCase.Revenue, TestCase.TemplateID;
-
-END |
---delimiter ;
-call procedure2();
-call procedure2();
-
-drop procedure procedure2;
-
-
-SELECT
- (SELECT user FROM mysql.user
- WHERE h.host in (SELECT host FROM mysql.user)
- ) AS sq
-FROM mysql.host h GROUP BY h.host;
-
-
---echo #
---echo # MDEV-7846:Server crashes in Item_subselect::fix
---echo #_fields or fails with Thread stack overrun
---echo #
-CREATE TABLE t1 (column1 INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (3),(9);
-
-CREATE TABLE t2 (column2 INT) ENGINE=MyISAM;
-
-INSERT INTO t2 VALUES (1),(4);
-
-CREATE TABLE t3 (column3 INT) ENGINE=MyISAM;
-INSERT INTO t3 VALUES (6),(8);
-
-CREATE TABLE t4 (column4 INT) ENGINE=MyISAM;
-INSERT INTO t4 VALUES (2),(5);
-
-
-PREPARE stmt FROM "
-SELECT (
- SELECT MAX( table1.column1 ) AS field1
- FROM t1 AS table1
- WHERE table3.column3 IN ( SELECT table2.column2 AS field2 FROM t2 AS table2 )
-) AS sq
-FROM t3 AS table3, t4 AS table4 GROUP BY sq
-";
-
-EXECUTE stmt;
-EXECUTE stmt;
-
-deallocate prepare stmt;
-drop table t1,t2,t3,t4;
-
---echo #
---echo # MDEV-7122
---echo # Assertion `0' failed in subselect_hash_sj_engine::init
---echo #
-SET SESSION big_tables=1;
-CREATE TABLE t1(a char(255) DEFAULT '', KEY(a(10))) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-INSERT INTO t1 VALUES(0),(0),(0);
-SELECT * FROM t1 WHERE a IN(SELECT MIN(a) FROM t1);
-DROP TABLE t1;
-SET SESSION big_tables=0;
-
---echo #
---echo # MDEV-10776: Server crash on query
---echo #
-create table t1 (field1 int);
-
-insert into t1 values (1);
-
-select round((select 1 from t1 limit 1))
-from t1
-group by round((select 1 from t1 limit 1));
-
-drop table t1;
-
---echo #
---echo # MDEV-7930: Assertion `table_share->tmp_table != NO_TMP_TABLE ||
---echo # m_lock_type != 2' failed in handler::ha_index_read_map
---echo #
-
-CREATE TABLE t1 (f1 INT);
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE TABLE t2 (f2 INT, KEY(f2));
-INSERT INTO t2 VALUES (3);
-
-CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM t2;
-
---error ER_WRONG_GROUP_FIELD
-SELECT ( SELECT MIN(t2.f2) FROM t1 ) AS sq FROM t2 GROUP BY sq;
---error ER_WRONG_GROUP_FIELD
-SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
-SELECT * FROM v2 where ( SELECT MIN(v2.f2) FROM t1 ) > 0;
-SELECT count(*) FROM v2 group by ( SELECT MIN(v2.f2) FROM t1 );
-
-delete from t1;
---error ER_WRONG_GROUP_FIELD
-SELECT ( SELECT MIN(t2.f2) FROM t1 ) AS sq FROM t2 GROUP BY sq;
---error ER_WRONG_GROUP_FIELD
-SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
-
-drop view v2;
-drop table t1,t2;
-
---echo #
---echo # MDEV-10386 Assertion `fixed == 1' failed in virtual String* Item_func_conv_charset::val_str(String*)
---echo #
-
-CREATE TABLE t1 (f1 CHAR(3) CHARACTER SET utf8 NULL, f2 CHAR(3) CHARACTER SET latin1 NULL);
-INSERT INTO t1 VALUES ('foo','bar');
-SELECT * FROM t1 WHERE f2 >= SOME ( SELECT f1 FROM t1 );
-SELECT * FROM t1 WHERE f2 <= SOME ( SELECT f1 FROM t1 );
-DROP TABLE t1;
-
---echo #
---echo # MDEV-10146: Wrong result (or questionable result and behavior)
---echo # with aggregate function in uncorrelated SELECT subquery
---echo #
-CREATE TABLE t1 (f1 INT);
-CREATE VIEW v1 AS SELECT * FROM t1;
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE TABLE t2 (f2 int);
-
-INSERT INTO t2 VALUES (3);
-SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1;
-
-SELECT ( SELECT MAX(f1) FROM t2 ) FROM v1;
-
-INSERT INTO t2 VALUES (4);
-
---error ER_SUBQUERY_NO_1_ROW
-SELECT ( SELECT MAX(f1) FROM t2 ) FROM v1;
---error ER_SUBQUERY_NO_1_ROW
-SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1;
-
-drop view v1;
-drop table t1,t2;
-
-#
-# MDEV-7828 Assertion `key_read == 0' failed in TABLE::enable_keyread with SELECT SQ and WHERE SQ
-#
-CREATE TABLE t1 (f1 INT, KEY(f1)) ENGINE=MyISAM;
-INSERT t1 VALUES (4),(8);
-CREATE TABLE t2 (f2 INT, KEY(f2)) ENGINE=MyISAM;
-INSERT t2 VALUES (6);
-SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2;
---echo #
---echo # Disable this query till MDEV-13399 is resolved
---echo #
---echo # INSERT t2 VALUES (9);
---echo # --error ER_SUBQUERY_NO_1_ROW
---echo # SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2;
---echo #
-drop table t1, t2;
-
---echo #
---echo # MDEV-13933: Wrong results in COUNT() query with EXISTS and exists_to_in
---echo # (5.5 test)
---echo #
-SET @optimiser_switch_save= @@optimizer_switch;
-
-CREATE TABLE t1 (a INT NOT NULL);
-INSERT INTO t1 VALUES (1),(1),(1),(5),(5);
-
-CREATE TABLE t2 (b INT);
-INSERT INTO t2 VALUES (5),(1);
-
-CREATE TABLE t3 (c INT, KEY(c));
-INSERT INTO t3 VALUES (5),(5);
-
-SET optimizer_switch='semijoin=on';
-select t1.a from t1 where t1.a in (select `test`.`t2`.`b` from `test`.`t2`)
-and t1.a in (select `test`.`t3`.`c` from `test`.`t3`);
-
-SET optimizer_switch='semijoin=off';
-select t1.a from t1 where t1.a in (select `test`.`t2`.`b` from `test`.`t2`)
-and t1.a in (select `test`.`t3`.`c` from `test`.`t3`);
-
-SET @@optimizer_switch= @optimiser_switch_save;
-DROP TABLE t1, t2, t3;
-
---echo End of 5.5 tests
---echo # End of 10.0 tests
-
---echo #
---echo # MDEV-9487: Server crashes in Time_and_counter_tracker::incr_loops
---echo # with UNION in ALL subquery
---echo #
-SET NAMES utf8;
-CREATE TABLE t1 (f VARCHAR(8)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('foo');
-SELECT f FROM t1 WHERE f > ALL ( SELECT 'bar' UNION SELECT 'baz' );
-SELECT f FROM t1 WHERE f > ALL ( SELECT 'bar');
-drop table t1;
-SET NAMES default;
-
---echo #
---echo # MDEV-10045: Server crashes in Time_and_counter_tracker::incr_loops
---echo #
-SET NAMES utf8;
-
-CREATE TABLE t1 (f1 VARCHAR(3), f2 INT UNSIGNED) ENGINE=MyISAM;
-CREATE TABLE t2 (f3 INT) ENGINE=MyISAM;
-
-SELECT * FROM t1, t2 WHERE f3 = f2 AND f1 > ANY ( SELECT 'foo' UNION SELECT 'bar' );
-SELECT * FROM t1, t2 WHERE f3 = f2 AND f1 > ANY ( SELECT 'foo');
-
-DROP TABLE t1, t2;
-SET NAMES default;
-
---echo # End of 10.1 tests
-
---echo #
---echo # MDEV-12564: IN TO EXISTS transformation for rows after
---echo # conversion an outer join to inner join
---echo #
-
-CREATE TABLE t (
-pk int PRIMARY KEY, i int NOT NULL, c varchar(8), KEY(c)
-) ENGINE=MyISAM;
-INSERT INTO t VALUES (1,10,'foo'),(2,20,'bar');
-
-SELECT * FROM t t1 RIGHT JOIN t t2 ON (t2.pk = t1.pk)
- WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo';
-
-DROP TABLE t;
-
---echo # End of 10.2 tests
diff --git a/mysql-test/t/subselect2.test b/mysql-test/t/subselect2.test
deleted file mode 100644
index c106d40b095..00000000000
--- a/mysql-test/t/subselect2.test
+++ /dev/null
@@ -1,413 +0,0 @@
--- source include/have_innodb.inc
-
-#
-# test of big query with a lot of IN subqueries.
-#
-
---disable_warnings
-drop table if exists t1, t2, t3, t4;
---enable_warnings
-
-set @subselect2_test_tmp=@@optimizer_switch;
-set optimizer_switch='semijoin=on,firstmatch=on,mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
-
-CREATE TABLE t1
-(
-DOCID VARCHAR(32)BINARY NOT NULL
-, UUID VARCHAR(32)BINARY NOT NULL
-, MIMETYPE VARCHAR(80)BINARY
-, CONTENTDATA LONGBLOB
-, CONTENTSIZE INTEGER
-, VERSIONID INTEGER
-, REPID VARCHAR(32)BINARY
-, MODIFIED TIMESTAMP
-, MODIFIER VARCHAR(255)BINARY
-, ORIGINATOR INTEGER
-
-, PRIMARY KEY ( DOCID )
-) ENGINE=InnoDB
-;
-
-INSERT IGNORE INTO t1 (DOCID) VALUES ("1"), ("2");
-
-CREATE TABLE t2
-(
-DOCID VARCHAR(32)BINARY NOT NULL
-, DOCNAME VARCHAR(255)BINARY NOT NULL
-, DOCTYPEID VARCHAR(32)BINARY NOT NULL
-, FOLDERID VARCHAR(32)BINARY NOT NULL
-, AUTHOR VARCHAR(255)BINARY
-, CREATED TIMESTAMP NOT NULL
-, TITLE VARCHAR(255)BINARY
-, SUBTITLE VARCHAR(255)BINARY
-, DOCABSTRACT LONGBLOB
-, PUBLISHDATE TIMESTAMP
-, EXPIRATIONDATE TIMESTAMP
-, LOCKEDBY VARCHAR(80)BINARY
-, STATUS VARCHAR(80)BINARY
-, PARENTDOCID VARCHAR(32)BINARY
-, REPID VARCHAR(32)BINARY
-, MODIFIED TIMESTAMP NOT NULL
-, MODIFIER VARCHAR(255)BINARY NOT NULL
-, PUBLISHSTATUS INTEGER
-, ORIGINATOR INTEGER
-
-, PRIMARY KEY ( DOCID )
-) ENGINE=InnoDB
-;
-CREATE INDEX DDOCTYPEID_IDX ON t2 (DOCTYPEID);
-CREATE INDEX DFOLDERID_IDX ON t2 (FOLDERID);
-CREATE TABLE t3
-(
-FOLDERID VARCHAR(32)BINARY NOT NULL
-, FOLDERNAME VARCHAR(255)BINARY NOT NULL
-, CREATOR VARCHAR(255)BINARY
-, CREATED TIMESTAMP NOT NULL
-, DESCRIPTION VARCHAR(255)BINARY
-, FOLDERTYPE INTEGER NOT NULL
-, MODIFIED TIMESTAMP
-, MODIFIER VARCHAR(255)BINARY
-, FOLDERSIZE INTEGER NOT NULL
-, PARENTID VARCHAR(32)BINARY
-, REPID VARCHAR(32)BINARY
-, ORIGINATOR INTEGER
-
-, PRIMARY KEY ( FOLDERID )
-) ENGINE=InnoDB;
-
-CREATE INDEX FFOLDERID_IDX ON t3 (FOLDERID);
-CREATE INDEX CMFLDRPARNT_IDX ON t3 (PARENTID);
-
-CREATE TABLE t4
-(
-DOCTYPEID VARCHAR(32)BINARY NOT NULL
-, DOCTYPENAME VARCHAR(80)BINARY NOT NULL
-, DESCRIPTION VARCHAR(255)BINARY
-, EXTNDATA LONGBLOB
-, MODIFIED TIMESTAMP
-, MODIFIER VARCHAR(255)BINARY
-, ORIGINATOR INTEGER
-
-, PRIMARY KEY ( DOCTYPEID )
-) ENGINE=InnoDB;
-
-INSERT INTO t2 VALUES("c373e9f59cf15a6c3e57444553544200", "c373e9f59cf15a6c3e57444553544200", "340d243d45f111d497b00010a4ef934d", "2f6161e879db43c1a5b82c21ddc49089", NULL, "2003-06-06 07:48:42", NULL, NULL, NULL, "2003-06-06 07:48:42", "2003-06-06 07:48:42", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-06 07:48:42", "admin", "0", NULL);
-
-INSERT INTO t2 VALUES("c373e9f5a472f43ba45e444553544200", "c373e9f5a472f43ba45e444553544200", "340d243d45f111d497b00010a4ef934d", "2f6161e879db43c1a5b82c21ddc49089", NULL, "2003-06-07 18:50:12", NULL, NULL, NULL, "2003-06-07 18:50:12", "2003-06-07 18:50:12", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-07 18:50:12", "admin", "0", NULL);
-
-
-INSERT INTO t2 VALUES("c373e9f5a4a0f56014eb444553544200", "c373e9f5a4a0f56014eb444553544200", "340d243d45f111d497b00010a4ef934d", "2f6161e879db43c1a5b82c21ddc49089", NULL, "2003-06-07 19:39:26", NULL, NULL, NULL, "2003-06-07 19:39:26", "2003-06-07 19:39:26", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-07 19:39:26", "admin", "0", NULL);
-INSERT INTO t2 VALUES("c373e9f5a4a0f8fa4a86444553544200", "c373e9f5a4a0f8fa4a86444553544200", "340d243d45f111d497b00010a4ef934d", "2f6161e879db43c1a5b82c21ddc49089", NULL, "2003-06-07 19:43:05", NULL, NULL, NULL, "2003-06-07 19:43:05", "2003-06-07 19:43:05", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-07 19:43:05", "admin", "0", NULL);
-INSERT INTO t2 VALUES("c373e9f5ac7b537205ce444553544200", "c373e9f5ac7b537205ce444553544200", "340d243d45f111d497b00010a4ef934d", "2f6161e879db43c1a5b82c21ddc49089", NULL, "2003-06-09 08:15:24", NULL, NULL, NULL, "2003-06-09 08:15:24", "2003-06-09 08:15:24", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-09 08:15:24", "admin", "0", NULL);
-INSERT INTO t2 VALUES("c373e9f5ad0792012454444553544200", "c373e9f5ad0792012454444553544200", "340d243d45f111d497b00010a4ef934d", "2f6161e879db43c1a5b82c21ddc49089", NULL, "2003-06-09 10:51:44", NULL, NULL, NULL, "2003-06-09 10:51:44", "2003-06-09 10:51:44", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-09 10:51:44", "admin", "0", NULL);
-INSERT INTO t2 VALUES("c373e9f5ad079821ef34444553544200", "First Discussion", "c373e9f5ad079174ff17444553544200", "c373e9f5ad0796c0eca4444553544200", "Goldilocks", "2003-06-09 11:16:50", "Title: First Discussion", NULL, NULL, "2003-06-09 10:51:26", "2003-06-09 10:51:26", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-09 11:16:50", "admin", "0", NULL);
-INSERT INTO t2 VALUES("c373e9f5ad07993f3859444553544200", "Last Discussion", "c373e9f5ad079174ff17444553544200", "c373e9f5ad0796c0eca4444553544200", "Goldilocks", "2003-06-09 11:21:06", "Title: Last Discussion", NULL, "Setting new abstract and keeping doc checked out", "2003-06-09 10:51:26", "2003-06-09 10:51:26", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-09 11:21:06", "admin", "0", NULL);
-INSERT INTO t2 VALUES("c373e9f5ad079a3219c4444553544200", "testdoclayout", "340d243c45f111d497b00010a4ef934d", "c373e9f5ad0796c0eca4444553544200", "Goldilocks", "2003-06-09 11:25:31", "Title: Test doc layout", "Subtitle: test doc layout", NULL, "2003-06-09 10:51:27", "2003-06-09 10:51:27", NULL, NULL, NULL, "03eea05112b845949f3fd03278b5fe43", "2003-06-09 11:25:31", "admin", "0", NULL);
-
-
-
-INSERT INTO t3 VALUES("0c9aab05b15048c59bc35c8461507deb", "System", "System", "2003-06-05 16:30:00", "The system content repository folder.", "3", "2003-06-05 16:30:00", "System", "0", NULL, "9c9aab05b15048c59bc35c8461507deb", "1");
-INSERT INTO t3 VALUES("2f6161e879db43c1a5b82c21ddc49089", "Default", "System", "2003-06-09 10:52:02", "The default content repository folder.", "3", "2003-06-05 16:30:00", "System", "0", NULL, "03eea05112b845949f3fd03278b5fe43", "1");
-INSERT INTO t3 VALUES("c373e9f5ad0791724315444553544200", "AddDocumentTest", "admin", "2003-06-09 10:51:25", "Movie Reviews", "0", "2003-06-09 10:51:25", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL);
-INSERT INTO t3 VALUES("c373e9f5ad07919e1963444553544200", "NewDestDirectory", "admin", "2003-06-09 10:51:28", "Adding new directory", "128", "2003-06-09 10:51:28", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL);
-INSERT INTO t3 VALUES("c373e9f5ad07919fe525444553544200", "SubDestDirectory", "admin", "2003-06-09 10:51:28", "Adding new directory", "128", "2003-06-09 10:51:28", "admin", "0", "c373e9f5ad07919e1963444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
-INSERT INTO t3 VALUES("c373e9f5ad0791a0dab5444553544200", "Level1", "admin", "2003-06-09 10:51:29", NULL, "0", "2003-06-09 10:51:29", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL);
-INSERT INTO t3 VALUES("c373e9f5ad0791a14669444553544200", "Level2", "admin", "2003-06-09 10:51:29", NULL, "0", "2003-06-09 10:51:29", "admin", "0", "c373e9f5ad0791a0dab5444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
-INSERT INTO t3 VALUES("c373e9f5ad0791a23c0e444553544200", "Level3", "admin", "2003-06-09 10:51:29", NULL, "0", "2003-06-09 10:51:29", "admin", "0", "c373e9f5ad0791a14669444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
-INSERT INTO t3 VALUES("c373e9f5ad0791a6b11f444553544200", "Dir1", "admin", "2003-06-09 10:51:30", NULL, "0", "2003-06-09 10:51:30", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL);
-INSERT INTO t3 VALUES("c373e9f5ad0791a897d6444553544200", "Dir2", "admin", "2003-06-09 10:51:30", NULL, "0", "2003-06-09 10:51:30", "admin", "0", "c373e9f5ad0791a6b11f444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
-INSERT INTO t3 VALUES("c373e9f5ad0791a9a063444553544200", "NewDestDirectory", "admin", "2003-06-09 10:51:31", NULL, "0", "2003-06-09 10:51:31", "admin", "0", "c373e9f5ad0791a897d6444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
-INSERT INTO t3 VALUES("c373e9f5ad0791aa73e3444553544200", "LevelA", "admin", "2003-06-09 10:51:31", NULL, "0", "2003-06-09 10:51:31", "admin", "0", "c373e9f5ad0791a0dab5444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
-INSERT INTO t3 VALUES("c373e9f5ad0791ab034b444553544200", "LevelB", "admin", "2003-06-09 10:51:31", NULL, "0", "2003-06-09 10:51:31", "admin", "0", "c373e9f5ad0791aa73e3444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
-INSERT INTO t3 VALUES("c373e9f5ad0791ac7311444553544200", "LevelC", "admin", "2003-06-09 10:51:32", NULL, "0", "2003-06-09 10:51:32", "admin", "0", "c373e9f5ad0791ab034b444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
-INSERT INTO t3 VALUES("c373e9f5ad0791ad66cf444553544200", "test2", "admin", "2003-06-09 10:51:32", NULL, "0", "2003-06-09 10:51:32", "admin", "0", "c373e9f5ad0791724315444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
-INSERT INTO t3 VALUES("c373e9f5ad0791aebd87444553544200", "test3", "admin", "2003-06-09 10:51:33", NULL, "0", "2003-06-09 10:51:33", "admin", "0", "c373e9f5ad0791ad66cf444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
-INSERT INTO t3 VALUES("c373e9f5ad0791dbaac4444553544200", "Special Caf Folder", "admin", "2003-06-09 10:51:43", "test folder names with special chars", "0", "2003-06-09 10:51:43", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL);
-INSERT INTO t3 VALUES("c373e9f5ad0796bf913f444553544200", "CopiedFolder", "admin", "2003-06-09 11:09:05", "Movie Reviews", "0", "2003-06-09 11:09:05", "admin", "0", "c373e9f5ad0791a23c0e444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
-INSERT INTO t3 VALUES("c373e9f5ad0796c0eca4444553544200", "Movie Reviews", "admin", "2003-06-09 11:09:13", "Movie Reviews", "0", "2003-06-09 11:09:13", "admin", "33", "c373e9f5ad0796bf913f444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
-INSERT INTO t3 VALUES("c373e9f5ad0796d9b895444553544200", "NewBookFolder", "admin", "2003-06-09 11:12:41", "NewBooks - folder", "0", "2003-06-09 11:12:41", "admin", "0", "c373e9f5ad0796c0eca4444553544200", "03eea05112b845949f3fd03278b5fe43", NULL);
-INSERT INTO t3 VALUES("c373e9f5ad079b4c9355444553544200", "CopiedFolder", "admin", "2003-06-09 11:26:34", "Movie Reviews", "0", "2003-06-09 11:26:34", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL);
-
-
-INSERT INTO t4 VALUES("340d243c45f111d497b00010a4ef934d", "Document Layout", "The system Document Layouts Document Type", NULL, "2003-06-05 16:30:00", "System", "1");
-INSERT INTO t4 VALUES("340d243d45f111d497b00010a4ef934d", "Default", "The default system Document Type", NULL, "2003-06-05 16:30:00", "System", "1");
-INSERT INTO t4 VALUES("4d09dd60850711d4998a204c4f4f5020", "__SystemResourceType", "The type for all the uploaded resources", NULL, "2003-06-05 16:30:00", "System", "1");
-INSERT INTO t4 VALUES("91d4d595478211d497b40010a4ef934d", "__PmcSystemDefaultType", "The type for all the default available fields", NULL, "2003-06-05 16:30:00", "System", "1");
-INSERT INTO t4 VALUES("c373e9f59cf15a59b08a444553544200", "NoFieldDocType", "plain doc type", NULL, "2003-06-06 07:48:40", "admin", NULL);
-INSERT INTO t4 VALUES("c373e9f59cf15a5c6a99444553544200", "Movie Review", "This doc type is for movie reviews", "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<props autocheckin=\"false\" autopublish=\"false\" binary=\"choice\" categories=\"none\" cleanup=\"false\" folder=\"none\"><![CDATA[Doc type for cm tests]]></props>\r\n", "2003-06-06 07:48:40", "admin", NULL);
-INSERT INTO t4 VALUES("c373e9f59cf15a6116a5444553544200", "Special Docu20A4u20A4u0113u016BType", "test special chars xxx in doc type", NULL, "2003-06-06 07:48:41", "admin", NULL);
-INSERT INTO t4 VALUES("c373e9f59cf15a695d47444553544200", "Movie", NULL, NULL, "2003-06-06 07:48:41", "admin", NULL);
-INSERT INTO t4 VALUES("c373e9f5ad079174ff17444553544200", "Discussion", NULL, NULL, "2003-06-09 10:51:25", "admin", NULL);
-INSERT INTO t4 VALUES("c373e9f5ad0791da7e2b444553544200", "Books", "list of recommended books", "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<props autocheckin=\"false\" autopublish=\"false\" binary=\"choice\" categories=\"none\" cleanup=\"false\" folder=\"none\"><![CDATA[Doc type for cm tests]]><![CDATA[Doc type for book tests]]></props>\r\n", "2003-06-09 10:51:40", "admin", NULL);
-
-ALTER TABLE t2 ADD FOREIGN KEY FK_DCMNTS_DCTYPES ( DOCTYPEID)
- REFERENCES t4 (DOCTYPEID );
-ALTER TABLE t2 ADD FOREIGN KEY FK_DCMNTS_FLDRS ( FOLDERID)
- REFERENCES t3 (FOLDERID );
-ALTER TABLE t3 ADD FOREIGN KEY FK_FLDRS_PRNTID ( PARENTID)
- REFERENCES t3 (FOLDERID );
-
-SELECT t2.*, t4.DOCTYPENAME, t1.CONTENTSIZE,t1.MIMETYPE FROM t2 INNER JOIN t4 ON t2.DOCTYPEID = t4.DOCTYPEID LEFT OUTER JOIN t1 ON t2.DOCID = t1.DOCID WHERE t2.FOLDERID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND t3.FOLDERNAME = 'Level1') AND t3.FOLDERNAME = 'Level2') AND t3.FOLDERNAME = 'Level3') AND t3.FOLDERNAME = 'CopiedFolder') AND t3.FOLDERNAME = 'Movie Reviews') AND t2.DOCNAME = 'Last Discussion';
-
-EXPLAIN SELECT t2.*, t4.DOCTYPENAME, t1.CONTENTSIZE,t1.MIMETYPE FROM t2 INNER JOIN t4 ON t2.DOCTYPEID = t4.DOCTYPEID LEFT OUTER JOIN t1 ON t2.DOCID = t1.DOCID WHERE t2.FOLDERID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID IN(SELECT t3.FOLDERID FROM t3 WHERE t3.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND t3.FOLDERNAME = 'Level1') AND t3.FOLDERNAME = 'Level2') AND t3.FOLDERNAME = 'Level3') AND t3.FOLDERNAME = 'CopiedFolder') AND t3.FOLDERNAME = 'Movie Reviews') AND t2.DOCNAME = 'Last Discussion';
-
-drop table t1, t2, t3, t4;
-# End of 4.1 tests
-
-#
-# Bug #20792: Incorrect results from aggregate subquery
-#
-CREATE TABLE t1 (a int(10) , PRIMARY KEY (a)) Engine=InnoDB;
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE TABLE t2 (a int(10), PRIMARY KEY (a)) Engine=InnoDB;
-INSERT INTO t2 VALUES (1);
-
-CREATE TABLE t3 (a int(10), b int(10), c int(10),
- PRIMARY KEY (a)) Engine=InnoDB;
-INSERT INTO t3 VALUES (1,2,1);
-
-SELECT t1.* FROM t1 WHERE (SELECT COUNT(*) FROM t3,t2 WHERE t3.c=t2.a
- and t2.a='1' AND t1.a=t3.b) > 0;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # Bug #902356: DISTINCT in materialized subquery
---echo #
-
-CREATE TABLE t1 (pk int PRIMARY KEY, a int, KEY(a)) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (0, 4), (8, 6);
-
-CREATE TABLE t2 (pk int PRIMARY KEY, a int, KEY(a)) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (0, 4), (8, 6);
-
-CREATE TABLE t3 (b INT, KEY(b));
-INSERT INTO t3 VALUES (7), (0), (4), (2);
-
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-SET @tmp_optimizer_switch=@@optimizer_switch;
-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;
-SELECT * FROM t2,t3 WHERE (2,9) IN (SELECT DISTINCT a,pk FROM t1) OR a = b;
-
-EXPLAIN
-SELECT * FROM t2,t3 WHERE (2,9) IN (SELECT DISTINCT a,pk FROM v1) OR a = b;
-SELECT * FROM t2,t3 WHERE (2,9) IN (SELECT DISTINCT a,pk FROM v1) OR a = b;
-
-SET optimizer_switch=@tmp_optimizer_switch;
-
-DROP VIEW v1;
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # MDEV-536: LP:1050806 - different result for a query using subquery
---echo #
-DROP TABLE IF EXISTS `t1`;
-
-CREATE TABLE `t1` (
- `node_uid` bigint(20) unsigned DEFAULT NULL,
- `date` datetime DEFAULT NULL,
- `mirror_date` datetime DEFAULT NULL,
- KEY `date` (`date`)
-) ENGINE=MyISAM;
-
-INSERT INTO `t1` VALUES (2085,'2012-01-01 00:00:00','2013-01-01 00:00:00');
-INSERT INTO `t1` VALUES (2084,'2012-02-01 00:00:00','2013-01-01 00:00:00');
-INSERT INTO `t1` VALUES (2088,'2012-03-01 00:00:00','2013-01-01 00:00:00');
-
-SELECT * FROM (
- SELECT node_uid, date, mirror_date, @result := 0 AS result
- FROM t1
- WHERE date < '2012-12-12 12:12:12'
- AND node_uid in (2085, 2084)
- ORDER BY mirror_date ASC
-) AS calculated_result;
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-567: Wrong result from a query with correlated subquery if ICP is allowed
---echo #
-CREATE TABLE t1 (a int, b int, INDEX idx(a));
-INSERT INTO t1 VALUES (9,0), (7,1), (1,9), (7,3), (2,1);
-
-CREATE TABLE t2 (a int, b int, INDEX idx(a));
-INSERT INTO t2 VALUES (2,1), (6,4), (7,6), (9,4);
-
-CREATE TABLE t3 (a int, b int);
-INSERT INTO t3 VALUES (1,0), (1,1), (1,3);
-
-SELECT * FROM t3
- WHERE a = (SELECT COUNT(DISTINCT t2.b) FROM t1, t2
- WHERE t1.a = t2.a AND t2.a BETWEEN 7 AND 9
- AND t3.b = t1.b
- GROUP BY t1.b);
-
-
-set @tmp_mdev567=@@optimizer_switch;
-set optimizer_switch='mrr=off';
-SELECT * FROM t3
- WHERE a = (SELECT COUNT(DISTINCT t2.b) FROM t1, t2
- WHERE t1.a = t2.a AND t2.a BETWEEN 7 AND 9
- AND t3.b = t1.b
- GROUP BY t1.b);
-
-DROP TABLE t1,t2,t3;
-set optimizer_switch=@tmp_mdev567;
-
---echo #
---echo # MDEV-4996: degenerate OR formula in WHERE of a subquery
---echo #
-
-CREATE TABLE t1 (a int, c1 varchar(1)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (2,'x'), (8,'d');
-
-CREATE TABLE t2 (m int, n int, c2 varchar(1)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (0, 5, 'x'), (1, 4,'p');
-
-SELECT * FROM t1 WHERE c1 NOT IN (
- SELECT t2a.c2 FROM t2 AS t2a, t2 AS t2b, t2 AS t2c
- WHERE t2c.c2 = t2b.c2 AND ( t2a.m = t2b.n OR 0 ) AND
- ( t2b.m != a OR t2b.m = t2a.m ));
-
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE c1 NOT IN (
- SELECT t2a.c2 FROM t2 AS t2a, t2 AS t2b, t2 AS t2c
- WHERE t2c.c2 = t2b.c2 AND ( t2a.m = t2b.n OR 0 ) AND
- ( t2b.m != a OR t2b.m = t2a.m ));
-
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-614, also MDEV-536, also LP:1050806:
---echo # different result for a query using subquery between 5.5.25 and 5.5.27
---echo #
-
-CREATE TABLE `t1` (
- `node_uid` bigint(20) unsigned DEFAULT NULL,
- `date` datetime DEFAULT NULL,
- `mirror_date` datetime DEFAULT NULL,
- KEY `date` (`date`)
-) ENGINE=MyISAM;
-
-INSERT INTO `t1` VALUES (2085,'2012-01-01 00:00:00','2013-01-01 00:00:00');
-INSERT INTO `t1` VALUES (2084,'2012-02-01 00:00:00','2013-01-01 00:00:00');
-INSERT INTO `t1` VALUES (2088,'2012-03-01 00:00:00','2013-01-01 00:00:00');
-
-explain
-SELECT * FROM (
- SELECT node_uid, date, mirror_date, @result := 0 AS result
- FROM t1
- WHERE date < '2012-12-12 12:12:12'
- AND node_uid in (2085, 2084)
- ORDER BY mirror_date ASC
-) AS calculated_result;
-
-SELECT * FROM (
- SELECT node_uid, date, mirror_date, @result := 0 AS result
- FROM t1
- WHERE date < '2012-12-12 12:12:12'
- AND node_uid in (2085, 2084)
- ORDER BY mirror_date ASC
-) AS calculated_result;
-
-set @tmp_mdev614=@@optimizer_switch;
-set optimizer_switch='mrr=off';
-explain
-SELECT * FROM (
- SELECT node_uid, date, mirror_date, @result := 0 AS result
- FROM t1
- WHERE date < '2012-12-12 12:12:12'
- AND node_uid in (2085, 2084)
- ORDER BY mirror_date ASC
-) AS calculated_result;
-
-SELECT * FROM (
- SELECT node_uid, date, mirror_date, @result := 0 AS result
- FROM t1
- WHERE date < '2012-12-12 12:12:12'
- AND node_uid in (2085, 2084)
- ORDER BY mirror_date ASC
-) AS calculated_result;
-
-set optimizer_switch=@tmp_mdev614;
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-4420: non-expensive single-value subquery used as
---echo # used as an access key to join a table
---echo #
-
-create table t1 (a varchar(3));
-insert into t1 values ('USA'), ('FRA');
-create table t2 select * from t1;
-insert into t2 values ('RUS');
-create table t3 select * from t2;
-create index idx on t3(a);
-
-explain extended
-select * from t1, t2 left join t3 on ( t2.a = t3.a )
-where t1.a = t2.a and ( t1.a = ( select min(a) from t1 ) or 0 );
-
-select * from t1, t2 left join t3 on ( t2.a = t3.a )
-where t1.a = t2.a and ( t1.a = ( select min(a) from t1 ) or 0 );
-
-drop table t1,t2,t3;
-
---echo #
---echo # MDEV-10148: Database crashes in the query to the View
---echo #
-CREATE TABLE t1 (
- key_code INT(11) NOT NULL,
- value_string VARCHAR(50) NULL DEFAULT NULL,
- PRIMARY KEY (key_code)
-) COLLATE='utf8_general_ci' ENGINE=InnoDB ;
-
-CREATE TABLE t2 (
- key_code INT(11) NOT NULL,
- target_date DATE NULL DEFAULT NULL,
- PRIMARY KEY (key_code)
-) COLLATE='utf8_general_ci' ENGINE=InnoDB ;
-
-CREATE TABLE t3 (
- now_date DATE NOT NULL,
- PRIMARY KEY (now_date)
-) COLLATE='utf8_general_ci' ENGINE=InnoDB ;
-
-CREATE VIEW v1
-AS
-SELECT
- B.key_code,
- B.target_date
-FROM
- t2 B INNER JOIN t3 C ON
- B.target_date = C.now_date
-;
-SET @s = 'SELECT A.* FROM t1 A WHERE A.key_code IN (SELECT key_code FROM v1)';
-PREPARE stmt FROM @s;
-EXECUTE stmt; #1st time -> success
-EXECUTE stmt; #2nd time -> crash
-DEALLOCATE PREPARE stmt;
-DROP VIEW v1;
-DROP TABLE t1,t2,t3;
-
-set optimizer_switch=@subselect2_test_tmp;
-
-#
-# Bug #23303485 : HANDLE_FATAL_SIGNAL (SIG=11) IN SUBSELECT_UNION_ENGINE::NO_ROWS
-#
-create table t1 (a int);
-create table t2 (a int);
-create table t3(a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-insert into t2 select a from t1;
-insert into t3 select a from t1;
---error ER_SUBQUERY_NO_1_ROW
-select null in (select a from t1 where a < out3.a union select a from t2 where
- (select a from t3) +1 < out3.a+1) from t3 out3;
-drop table t1, t2, t3;
diff --git a/mysql-test/t/subselect3.test b/mysql-test/t/subselect3.test
deleted file mode 100644
index 0221315eb35..00000000000
--- a/mysql-test/t/subselect3.test
+++ /dev/null
@@ -1,1318 +0,0 @@
---disable_warnings
-drop table if exists t0, t1, t2, t3, t4, t5, t11, t12, t21, t22;
---enable_warnings
-
-set @subselect3_tmp= @@optimizer_switch;
-set optimizer_switch='semijoin=on,firstmatch=on,loosescan=on,semijoin_with_cache=on';
-if (`select @join_cache_level_for_subselect3_test is null`)
-{
- set join_cache_level=1;
-}
-if (`select @join_cache_level_for_subselect3_test is not null`)
-{
- set join_cache_level=@join_cache_level_for_subselect3_test;
-}
-
-#
-# 1. Subquery with GROUP/HAVING
-#
-create table t1 (oref int, grp int, ie int) ;
-insert into t1 (oref, grp, ie) values
- (1, 1, 1),
- (1, 1, 1),
- (1, 2, NULL),
-
- (2, 1, 3),
-
- (3, 1, 4),
- (3, 2, NULL);
-
-# Ok, for
-# select max(ie) from t1 where oref=PARAM group by grp
-# we'll have:
-# PARAM subquery result
-# 1 -> {(1), (NULL)} matching + NULL
-# 2 -> {(3)} non-matching
-# 3 -> {(3), (NULL)} non-matching + NULL
-# 4 -> {} empty set
-
-create table t2 (oref int, a int);
-insert into t2 values
- (1, 1),
- (2, 2),
- (3, 3),
- (4, NULL),
- (2, NULL);
-
-# true, false, null, false, null
-select a, oref, a in (select max(ie)
- from t1 where oref=t2.oref group by grp) Z from t2;
-
-# This must have a trigcond
-explain extended
-select a, oref, a in (select max(ie)
- from t1 where oref=t2.oref group by grp) Z from t2;
-
-# This must not have a trigcond:
-explain extended
-select a, oref from t2
-where a in (select max(ie) from t1 where oref=t2.oref group by grp);
-select a, oref, a in (
- select max(ie) from t1 where oref=t2.oref group by grp union
- select max(ie) from t1 where oref=t2.oref group by grp
- ) Z from t2;
-
-# Non-correlated subquery, 2 NULL evaluations
-create table t3 (a int);
-insert into t3 values (NULL), (NULL);
-flush status;
-select a in (select max(ie) from t1 where oref=4 group by grp) from t3;
-show status like 'Handler_read_rnd_next';
-select ' ^ This must show 11' Z;
-
-set @save_optimizer_switch=@@optimizer_switch;
-set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=off";
-
-# This must show trigcond:
-explain extended select a in (select max(ie) from t1 where oref=4 group by grp) from t3;
-
-set @@optimizer_switch=@save_optimizer_switch;
-drop table t1, t2, t3;
-
-#
-# 2. Subquery handled with 'index_subquery':
-#
-create table t1 (a int, oref int, key(a));
-insert into t1 values
- (1, 1),
- (1, NULL),
- (2, 3),
- (2, NULL),
- (3, NULL);
-insert into t1 values (5, 7), (8, 9), (4, 1);
-
-create table t2 (a int, oref int);
-insert into t2 values (1, 1), (2,2), (NULL, 3), (NULL, 4);
-
-select oref, a, a in (select a from t1 where oref=t2.oref) Z from t2;
-
-# The next explain shows "using index" but that is just incorrect display
-# (there is a bug filed about this).
-explain extended
-select oref, a, a in (select a from t1 where oref=t2.oref) Z from t2;
-
-flush status;
-select oref, a from t2 where a in (select a from t1 where oref=t2.oref);
-# This will only show access to t2:
-show status like '%Handler_read_rnd_next';
-
-# Check that repeated NULL-scans are not cached (subq. is not correlated):
-delete from t2;
-insert into t2 values (NULL, 0),(NULL, 0), (NULL, 0), (NULL, 0);
-
-set optimizer_switch='subquery_cache=off';
-flush status;
-select oref, a, a in (select a from t1 where oref=t2.oref) Z from t2;
-show status like '%Handler_read%';
-select 'No key lookups, seq reads: 29= 5 reads from t2 + 4 * 6 reads from t1.' Z;
-set @@optimizer_switch=@save_optimizer_switch;
-
-drop table t1, t2;
-
-#
-# 3. Subquery handled with 'unique_index_subquery':
-#
-create table t1 (a int, b int, primary key (a));
-insert into t1 values (1,1), (3,1),(100,1);
-
-create table t2 (a int, b int);
-insert into t2 values (1,1),(2,1),(NULL,1),(NULL,0);
-
-select a,b, a in (select a from t1 where t1.b = t2.b) Z from t2 ;
-
-drop table t1, t2;
-
-#
-# 4. Subquery that is a join, with ref access
-#
-create table t1 (a int, b int, key(a));
-insert into t1 values
- (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
-
-create table t2 like t1;
-insert into t2 select * from t1;
-update t2 set b=1;
-
-create table t3 (a int, oref int);
-insert into t3 values (1, 1), (NULL,1), (NULL,0);
-select a, oref,
- t3.a in (select t1.a from t1, t2 where t1.b=t2.a and t2.b=t3.oref) Z
-from t3;
-
-# This must have trigcond in WHERE and HAVING:
-explain extended
-select a, oref,
- t3.a in (select t1.a from t1, t2 where t1.b=t2.a and t2.b=t3.oref) Z
-from t3;
-
-drop table t1, t2, t3;
-
-
-#
-# BUG#24085: Wrong query result for "NULL IN (SELECT ... UNION SELECT ...)"
-#
-
-# case 1: NULL IN (SELECT not_null_val FROM ...) w/o HAVING/GROUP-BY/etc
-create table t1 (a int NOT NULL, b int NOT NULL, key(a));
-insert into t1 values
- (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
-
-create table t2 like t1;
-insert into t2 select * from t1;
-update t2 set b=1;
-
-create table t3 (a int, oref int);
-insert into t3 values (1, 1), (NULL,1), (NULL,0);
-select a, oref,
- t3.a in (select t1.a from t1, t2 where t1.b=t2.a and t2.b=t3.oref) Z
-from t3;
-
---echo This must show a trig_cond:
-explain extended
-select a, oref,
- t3.a in (select t1.a from t1, t2 where t1.b=t2.a and t2.b=t3.oref) Z
-from t3;
-drop table t1,t2,t3;
-
-
-# case 2: NULL IN (SELECT not_null_val FROM) where SELECT has GROUP BY
-create table t1 (oref int, grp int);
-insert into t1 (oref, grp) values
- (1, 1),
- (1, 1);
-
-# Ok, for
-# select count(*) from t1 group by grp having grp=PARAM
-# we'll have:
-# PARAM subuqery result
-# 1 -> {(2)}
-# 2 -> {} - empty set
-create table t2 (oref int, a int);
-insert into t2 values
- (1, NULL),
- (2, NULL);
-
-select a, oref,
- a in (select count(*) from t1 group by grp having grp=t2.oref) Z from t2;
-
---echo This must show a trig_cond:
-explain extended
-select a, oref,
- a in (select count(*) from t1 group by grp having grp=t2.oref) Z from t2;
-
-drop table t1, t2;
-
-create table t1 (a int, b int, primary key (a));
-insert into t1 values (1,1), (3,1),(100,1);
-create table t2 (a int, b int);
-insert into t2 values (1,1),(2,1),(NULL,1),(NULL,0);
-
-select a,b, a in (select a from t1 where t1.b = t2.b union select a from
-t1 where t1.b = t2.b) Z from t2 ;
-select a,b, a in (select a from t1 where t1.b = t2.b) Z from t2 ;
-drop table t1, t2;
-
-
-#
-# BUG#24127: Incorrect results of row-based subqueries with NULLs on the left side.
-#
-create table t3 (a int);
-insert into t3 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t2 (a int, b int, oref int);
-insert into t2 values (NULL,1, 100), (NULL,2, 100);
-
-create table t1 (a int, b int, c int, key(a,b));
-insert into t1 select 2*A, 2*A, 100 from t3;
-
-# First test index subquery engine
-explain extended select a,b, oref, (a,b) in (select a,b from t1 where c=t2.oref) Z from t2;
-select a,b, oref, (a,b) in (select a,b from t1 where c=t2.oref) Z from t2;
-
-# Then check that we do turn off 'ref' scans in the subquery
-create table t4 (x int);
-insert into t4 select A.a + 10*B.a from t1 A, t1 B;
-explain extended
- select a,b, oref,
- (a,b) in (select a,b from t1,t4 where c=t2.oref) Z
- from t2;
-select a,b, oref,
- (a,b) in (select a,b from t1,t4 where c=t2.oref) Z
-from t2;
-
-drop table t1,t2,t3,t4;
-
-# More tests for tricky multi-column cases, where some of pushed-down
-# equalities are used for index lookups and some arent.
-create table t1 (oref char(4), grp int, ie1 int, ie2 int);
-insert into t1 (oref, grp, ie1, ie2) values
- ('aa', 10, 2, 1),
- ('aa', 10, 1, 1),
- ('aa', 20, 2, 1),
- ('bb', 10, 3, 1),
- ('cc', 10, 4, 2),
- ('cc', 20, 3, 2),
-
- ('ee', 10, 2, 1),
- ('ee', 10, 1, 2),
-
- ('ff', 20, 2, 2),
- ('ff', 20, 1, 2);
-create table t2 (oref char(4), a int, b int);
-insert into t2 values
- ('ee', NULL, 1),
- ('bb', 2, 1),
- ('ff', 2, 2),
- ('cc', 3, NULL),
- ('bb', NULL, NULL),
- ('aa', 1, 1),
- ('dd', 1, NULL);
-alter table t1 add index idx(ie1,ie2);
-
-# cc 3 NULL NULL
-select oref, a, b, (a,b) in (select ie1,ie2 from t1 where oref=t2.oref) Z from t2 where a=3 and b is null ;
-insert into t2 values ('new1', 10,10);
-insert into t1 values ('new1', 1234, 10, NULL);
-# new1, 10, 10, NULL,
-select oref, a, b, (a,b) in (select ie1,ie2 from t1 where oref=t2.oref) Z from t2 where a=10 and b=10;
-explain extended
-select oref, a, b, (a,b) in (select ie1,ie2 from t1 where oref=t2.oref) Z from t2 where a=10 and b=10;
-drop table t1, t2;
-
-# Now test different column types:
-create table t1 (oref char(4), grp int, ie int);
-insert into t1 (oref, grp, ie) values
- ('aa', 10, 2),
- ('aa', 10, 1),
- ('aa', 20, NULL),
-
- ('bb', 10, 3),
-
- ('cc', 10, 4),
- ('cc', 20, NULL),
-
- ('ee', 10, NULL),
- ('ee', 10, NULL),
-
- ('ff', 20, 2),
- ('ff', 20, 1);
-
-create table t2 (oref char(4), a int);
-insert into t2 values
- ('ee', NULL),
- ('bb', 2),
- ('ff', 2),
- ('cc', 3),
- ('aa', 1),
- ('dd', NULL),
- ('bb', NULL);
-
-select oref, a, a in (select ie from t1 where oref=t2.oref) Z from t2;
-
-select oref, a from t2 where a in (select ie from t1 where oref=t2.oref);
-
-select oref, a from t2 where a not in (select ie from t1 where oref=t2.oref);
-
-
-select oref, a, a in (select min(ie) from t1 where oref=t2.oref group by grp) Z from t2;
-
-select oref, a from t2 where
- a in (select min(ie) from t1 where oref=t2.oref group by grp);
-
-select oref, a from t2 where
- a not in (select min(ie) from t1 where oref=t2.oref group by grp);
-
-#
-update t1 set ie=3 where oref='ff' and ie=1;
-
-select oref, a, a in (select min(ie) from t1 where oref=t2.oref group by
-grp) Z from t2;
-
-
-select oref, a from t2 where a in (select min(ie) from t1 where
-oref=t2.oref group by grp);
-
-select oref, a from t2 where a not in (select min(ie) from t1 where
-oref=t2.oref group by grp);
-
-select oref, a, a in (select min(ie) from t1 where oref=t2.oref group by
-grp having min(ie) > 1) Z from t2;
-
-select oref, a from t2 where a in (select min(ie) from t1 where
-oref=t2.oref group by grp having min(ie) > 1);
-
-select oref, a from t2 where a not in (select min(ie) from t1 where
-oref=t2.oref group by grp having min(ie) > 1);
-
-#
-alter table t1 add index idx(ie);
-
-explain select oref, a, a in (select ie from t1 where oref=t2.oref) Z from t2;
-
-select oref, a, a in (select ie from t1 where oref=t2.oref) Z from t2;
-
-select oref, a from t2 where a in (select ie from t1 where oref=t2.oref);
-
-select oref, a from t2 where a not in (select ie from t1 where oref=t2.oref);
-
-
-alter table t1 drop index idx;
-alter table t1 add index idx(oref,ie);
-
-explain select oref, a, a in (select ie from t1 where oref=t2.oref) Z from t2;
-
-select oref, a, a in (select ie from t1 where oref=t2.oref) Z from t2;
-
-select oref, a from t2 where a in (select ie from t1 where oref=t2.oref);
-
-select oref, a from t2 where a not in (select ie from t1 where oref=t2.oref);
-
-explain
-select oref, a,
- a in (select min(ie) from t1 where oref=t2.oref
- group by grp having min(ie) > 1) Z
-from t2;
-
-select oref, a,
- a in (select min(ie) from t1 where oref=t2.oref
- group by grp having min(ie) > 1) Z
-from t2;
-
-select oref, a from t2 where a in (select min(ie) from t1 where oref=t2.oref
- group by grp having min(ie) > 1);
-
-select oref, a from t2 where a not in (select min(ie) from t1 where oref=t2.oref
- group by grp having min(ie) > 1);
-
-drop table t1,t2;
-
-create table t1 (oref char(4), grp int, ie1 int, ie2 int);
-insert into t1 (oref, grp, ie1, ie2) values
- ('aa', 10, 2, 1),
- ('aa', 10, 1, 1),
- ('aa', 20, 2, 1),
-
- ('bb', 10, 3, 1),
-
- ('cc', 10, 4, 2),
- ('cc', 20, 3, 2),
-
- ('ee', 10, 2, 1),
- ('ee', 10, 1, 2),
-
- ('ff', 20, 2, 2),
- ('ff', 20, 1, 2);
-
-create table t2 (oref char(4), a int, b int);
-insert into t2 values
- ('ee', NULL, 1),
- ('bb', 2, 1),
- ('ff', 2, 2),
- ('cc', 3, NULL),
- ('bb', NULL, NULL),
- ('aa', 1, 1),
- ('dd', 1, NULL);
-
-select oref, a, b, (a,b) in (select ie1,ie2 from t1 where oref=t2.oref) Z from t2;
-
-select oref, a, b from t2 where (a,b) in (select ie1,ie2 from t1 where oref=t2.oref);
-
-select oref, a, b from t2 where (a,b) not in (select ie1,ie2 from t1 where oref=t2.oref);
-
-select oref, a, b,
- (a,b) in (select min(ie1),max(ie2) from t1
- where oref=t2.oref group by grp) Z
-from t2;
-
-select oref, a, b from t2 where
- (a,b) in (select min(ie1), max(ie2) from t1 where oref=t2.oref group by grp);
-
-select oref, a, b from t2 where
- (a,b) not in (select min(ie1), max(ie2) from t1 where oref=t2.oref group by grp);
-
-alter table t1 add index idx(ie1,ie2);
-
-explain select oref, a, b, (a,b) in (select ie1,ie2 from t1 where oref=t2.oref) Z from t2;
-
-select oref, a, b, (a,b) in (select ie1,ie2 from t1 where oref=t2.oref) Z from t2;
-
-select oref, a, b from t2 where (a,b) in (select ie1,ie2 from t1 where oref=t2.oref);
-
-select oref, a, b from t2 where (a,b) not in (select ie1,ie2 from t1 where oref=t2.oref);
-
-explain extended
-select oref, a, b, (a,b) in (select ie1,ie2 from t1 where oref=t2.oref) Z from t2;
-
-drop table t1,t2;
-
-create table t1 (oref char(4), grp int, ie int primary key);
-insert into t1 (oref, grp, ie) values
- ('aa', 10, 2),
- ('aa', 10, 1),
-
- ('bb', 10, 3),
-
- ('cc', 10, 4),
- ('cc', 20, 5),
- ('cc', 10, 6);
-
-create table t2 (oref char(4), a int);
-insert into t2 values
- ('ee', NULL),
- ('bb', 2),
- ('cc', 5),
- ('cc', 2),
- ('cc', NULL),
- ('aa', 1),
- ('bb', NULL);
-
-explain select oref, a, a in (select ie from t1 where oref=t2.oref) Z from t2;
-
-select oref, a, a in (select ie from t1 where oref=t2.oref) Z from t2;
-
-select oref, a from t2 where a in (select ie from t1 where oref=t2.oref);
-
-select oref, a from t2 where a not in (select ie from t1 where oref=t2.oref);
-
-explain
-select oref, a, a in (select min(ie) from t1 where oref=t2.oref group by grp) Z from t2;
-
-select oref, a, a in (select min(ie) from t1 where oref=t2.oref group by grp) Z from t2;
-
-drop table t1,t2;
-
-#
-# BUG#24420: row-based IN suqueries with aggregation when the left operand
-# of the subquery predicate may contain NULL values
-#
-
-create table t1 (a int, b int);
-insert into t1 values (0,0), (2,2), (3,3);
-create table t2 (a int, b int);
-insert into t2 values (1,1), (3,3);
-
-select a, b, (a,b) in (select a, min(b) from t2 group by a) Z from t1;
-
-insert into t2 values (NULL,4);
-select a, b, (a,b) in (select a, min(b) from t2 group by a) Z from t1;
-
-drop table t1,t2;
-
-#
-# Bug #24484: Aggregate function used in column list subquery gives erroneous
-# error
-#
-CREATE TABLE t1 (a int, b INT, c CHAR(10) NOT NULL, PRIMARY KEY (a, b));
-INSERT INTO t1 VALUES (1,1,'a'), (1,2,'b'), (1,3,'c'), (1,4,'d'), (1,5,'e'),
- (2,1,'f'), (2,2,'g'), (2,3,'h'), (3,4,'i'),(3,3,'j'), (3,2,'k'), (3,1,'l'),
- (1,9,'m');
-CREATE TABLE t2 (a int, b INT, c CHAR(10) NOT NULL, PRIMARY KEY (a, b));
-INSERT INTO t2 SELECT * FROM t1;
-
-# Gives error, but should work since it is (a, b) is the PK so only one
-# given match possible
-SELECT a, MAX(b), (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b))
- as test FROM t1 GROUP BY a;
-SELECT * FROM t1 GROUP by t1.a
- HAVING (MAX(t1.b) > (SELECT MAX(t2.b) FROM t2 WHERE t2.c < t1.c
- HAVING MAX(t2.b+t1.a) < 10));
-
-SELECT a,b,c FROM t1 WHERE b in (9,3,4) ORDER BY b,c;
-
-SELECT a, MAX(b),
- (SELECT COUNT(DISTINCT t.c) FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b)
- LIMIT 1)
- as cnt,
- (SELECT t.b FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b) LIMIT 1)
- as t_b,
- (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b) LIMIT 1)
- as t_b,
- (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b) ORDER BY t.c LIMIT 1)
- as t_b
- FROM t1 GROUP BY a;
-
-SELECT a, MAX(b),
- (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b) LIMIT 1) as test
- FROM t1 GROUP BY a;
-
-
-DROP TABLE t1, t2;
-
-# The next three test cases must be executed with the IN=>EXISTS strategy
-set @@optimizer_switch="partial_match_rowid_merge=off,partial_match_table_scan=off";
-
-#
-# Bug #27870: crash of an equijoin query with WHERE condition containing
-# a subquery predicate of the form <join attr> NOT IN (SELECT ...)
-#
-
-CREATE TABLE t1 (a int);
-CREATE TABLE t2 (b int, PRIMARY KEY(b));
-INSERT INTO t1 VALUES (1), (NULL), (4);
-INSERT INTO t2 VALUES (3), (1),(2), (5), (4), (7), (6);
-
-EXPLAIN EXTENDED
-SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1));
-SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1));
-SELECT a FROM t1, t2 WHERE a=b AND (b NOT IN (SELECT a FROM t1 WHERE a > 4));
-
-DROP TABLE t1,t2;
-
-#
-# Bug #28375: crash for NOT IN subquery predicate when left operand becomes NULL
-#
-
-CREATE TABLE t1 (id int);
-CREATE TABLE t2 (id int PRIMARY KEY);
-CREATE TABLE t3 (id int PRIMARY KEY, name varchar(10));
-INSERT INTO t1 VALUES (2), (NULL), (3), (1);
-INSERT INTO t2 VALUES (234), (345), (457);
-INSERT INTO t3 VALUES (222,'bbb'), (333,'ccc'), (111,'aaa');
-
-EXPLAIN
-SELECT * FROM t1
- WHERE t1.id NOT IN (SELECT t2.id FROM t2,t3
- WHERE t3.name='xxx' AND t2.id=t3.id);
-SELECT * FROM t1
- WHERE t1.id NOT IN (SELECT t2.id FROM t2,t3
- WHERE t3.name='xxx' AND t2.id=t3.id);
-
-SELECT (t1.id IN (SELECT t2.id FROM t2,t3
- WHERE t3.name='xxx' AND t2.id=t3.id)) AS x
- FROM t1;
-
-DROP TABLE t1,t2,t3;
-
-#
-# Bug #22855: Optimizer doesn't rewrite NOT IN subselects to a correlated
-# subquery
-#
-CREATE TABLE t1 (a INT NOT NULL);
-INSERT INTO t1 VALUES (1),(-1), (65),(66);
-
-CREATE TABLE t2 (a INT UNSIGNED NOT NULL PRIMARY KEY);
-INSERT INTO t2 VALUES (65),(66);
-
-SELECT a FROM t1 WHERE a NOT IN (65,66);
-SELECT a FROM t1 WHERE a NOT IN (SELECT a FROM t2);
-EXPLAIN SELECT a FROM t1 WHERE a NOT IN (SELECT a FROM t2);
-
-DROP TABLE t1, t2;
-
-set @@optimizer_switch=@save_optimizer_switch;
-
-#
-# Bug #34763: item_subselect.cc:1235:Item_in_subselect::row_value_transformer:
-# Assertion failed, unexpected error message:
-# ERROR 1247 (42S22): Reference '<list ref>' not supported (forward
-# reference in item list)
-#
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES(1);
-
-CREATE TABLE t2 (placeholder CHAR(11));
-INSERT INTO t2 VALUES("placeholder");
-
-SELECT ROW(1, 2) IN (SELECT t1.a, 2) FROM t1 GROUP BY t1.a;
-SELECT ROW(1, 2) IN (SELECT t1.a, 2 FROM t2) FROM t1 GROUP BY t1.a;
-
-DROP TABLE t1, t2;
-
-#
-# Bug #36005: crash in subselect with single row
-# (subselect_single_select_engine::exec)
-#
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1),(2),(3);
-CREATE TABLE t2 SELECT * FROM t1;
-
-SELECT 1 FROM t1 WHERE t1.a NOT IN (SELECT 1 FROM t1, t2 WHERE 0);
-
-DROP TABLE t1, t2;
-
-#
-# Bug 2198
-#
-
-create table t1 (a int, b decimal(13, 3));
-insert into t1 values (1, 0.123);
-select a, (select max(b) from t1) into outfile "subselect.out.file.1" from t1;
-delete from t1;
-load data infile "subselect.out.file.1" into table t1;
-select * from t1;
-drop table t1;
-let $datadir=`select @@datadir`;
---remove_file $datadir/test/subselect.out.file.1
-
-#
-# Bug #37894: Assertion in init_read_record_seq in handler.h line 1444
-#
-
-CREATE TABLE t1 (
- pk INT PRIMARY KEY,
- int_key INT,
- varchar_key VARCHAR(5) UNIQUE,
- varchar_nokey VARCHAR(5)
-);
-INSERT INTO t1 VALUES (9, 7,NULL,NULL), (10,8,'p' ,'p');
-
-SELECT varchar_nokey
-FROM t1
-WHERE NULL NOT IN (
- SELECT INNR.pk FROM t1 AS INNR2
- LEFT JOIN t1 AS INNR ON ( INNR2.int_key = INNR.int_key )
- WHERE INNR.varchar_key > 'n{'
-);
-
-DROP TABLE t1;
-
-#
-# Bug #39069: <row constructor> IN <table-subquery> seriously messed up
-#
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1), (2), (11);
-
---echo # 2nd and 3rd columns should be same
-SELECT a, ROW(11, 12) = (SELECT a, 22), ROW(11, 12) IN (SELECT a, 22) FROM t1 GROUP BY t1.a;
-SELECT a, ROW(11, 12) = (SELECT a, 12), ROW(11, 12) IN (SELECT a, 12) FROM t1 GROUP BY t1.a;
-SELECT a, ROW(11, 12) = (SELECT a, 22), ROW(11, 12) IN (SELECT a, 22) FROM t1;
-SELECT a, ROW(11, 12) = (SELECT a, 12), ROW(11, 12) IN (SELECT a, 12) FROM t1;
-
-# The x alias is used below to workaround bug #40674.
-# Regression tests for sum function on outer column in subselect from dual:
-SELECT a AS x, ROW(11, 12) = (SELECT MAX(x), 22), ROW(11, 12) IN (SELECT MAX(x), 22) FROM t1;
---echo # 2nd and 3rd columns should be same
-EXPLAIN SELECT a AS x, ROW(11, 12) = (SELECT MAX(x), 12), ROW(11, 12) IN (SELECT MAX(x), 12) FROM t1;
-SELECT a AS x, ROW(11, 12) = (SELECT MAX(x), 12), ROW(11, 12) IN (SELECT MAX(x), 12) FROM t1;
-
-DROP TABLE t1;
-
---echo # both columns should be same
-SELECT ROW(1,2) = (SELECT NULL, NULL), ROW(1,2) IN (SELECT NULL, NULL);
-SELECT ROW(1,2) = (SELECT 1, NULL), ROW(1,2) IN (SELECT 1, NULL);
-SELECT ROW(1,2) = (SELECT NULL, 2), ROW(1,2) IN (SELECT NULL, 2);
-SELECT ROW(1,2) = (SELECT NULL, 1), ROW(1,2) IN (SELECT NULL, 1);
-SELECT ROW(1,2) = (SELECT 1, 1), ROW(1,2) IN (SELECT 1, 1);
-SELECT ROW(1,2) = (SELECT 1, 2), ROW(1,2) IN (SELECT 1, 2);
-
-#
-# Bug #37362 Crash in do_field_eq
-#
-# Note that currently this test produces wrong output, see MBug#430669.
-#
-CREATE TABLE t1 (a INT, b INT, c INT);
-INSERT INTO t1 VALUES (1,1,1), (1,1,1);
-
---error 1054
-EXPLAIN EXTENDED
- SELECT c FROM
- ( SELECT
- (SELECT COUNT(a) FROM
- (SELECT COUNT(b) FROM t1) AS x GROUP BY c
- ) FROM t1 GROUP BY b
- ) AS y;
-SHOW WARNINGS;
-
-DROP TABLE t1;
-
-
---echo End of 5.0 tests
-
---echo #
---echo # BUG#36896: Server crash on SELECT FROM DUAL
---echo #
-create table t1 (a int);
-select 1 as res from dual where (1) in (select * from t1);
-drop table t1;
-
-#
-# BUG#36135 "void Diagnostics_area::set_eof_status(THD*): Assertion `!is_set()' failed."
-#
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1 (
- a int(11) default null,
- b int(11) default null,
- key (a)
-);
-# produce numbers 0..999
-insert into t1 select A.a+10*(B.a+10*C.a),A.a+10*(B.a+10*C.a) from t0 A, t0 B, t0 C;
-
-create table t2 (a int(11) default null);
-insert into t2 values (0),(1);
-
-create table t3 (a int(11) default null);
-insert into t3 values (0),(1);
-
-create table t4 (a int(11) default null);
-insert into t4 values (0),(1);
-
-create table t5 (a int(11) default null);
-insert into t5 values (0),(1),(0),(1);
-
-# this must not fail assertion
---error 1242
-select * from t2, t3
-where
- t2.a < 10 and
- t3.a+1 = 2 and
- t3.a in (select t1.b from t1
- where t1.a+1=t1.a+1 and
- t1.a < (select t4.a+10
- from t4, t5 limit 2));
-
-drop table t0, t1, t2, t3, t4, t5;
-
---echo #
---echo # BUG#48177 - SELECTs with NOT IN subqueries containing NULL
---echo # values return too many records
---echo #
-
-CREATE TABLE t1 (
- i1 int DEFAULT NULL,
- i2 int DEFAULT NULL
-) ;
-
-INSERT INTO t1 VALUES (1, NULL);
-INSERT INTO t1 VALUES (2, 3);
-INSERT INTO t1 VALUES (4, NULL);
-INSERT INTO t1 VALUES (4, 0);
-INSERT INTO t1 VALUES (NULL, NULL);
-
-CREATE TABLE t2 (
- i1 int DEFAULT NULL,
- i2 int DEFAULT NULL
-) ;
-
-INSERT INTO t2 VALUES (4, NULL);
-INSERT INTO t2 VALUES (5, 0);
-
---echo
---echo Data in t1
-SELECT i1, i2 FROM t1;
-
---echo
---echo Data in subquery (should be filtered out)
-SELECT i1, i2 FROM t2 ORDER BY i1;
-
-FLUSH STATUS;
-set @save_optimizer_switch2=@@optimizer_switch;
-set optimizer_switch='subquery_cache=off';
-
---echo
-SELECT i1, i2
-FROM t1
-WHERE (i1, i2)
- NOT IN (SELECT i1, i2 FROM t2);
-
---echo
---echo # Check that the subquery only has to be evaluated once
---echo # for all-NULL values even though there are two (NULL,NULL) records
---echo # Baseline:
-SHOW STATUS LIKE '%Handler_read_rnd_next';
-
---echo
-INSERT INTO t1 VALUES (NULL, NULL);
-FLUSH STATUS;
-
---echo
-SELECT i1, i2
-FROM t1
-WHERE (i1, i2)
- NOT IN (SELECT i1, i2 FROM t2);
-
---echo
---echo # Handler_read_rnd_next should be one more than baseline
---echo # (read record from t1, but do not read from t2)
-SHOW STATUS LIKE '%Handler_read_rnd_next';
-
-set @@optimizer_switch=@save_optimizer_switch2;
-DROP TABLE t1,t2;
-
---echo End of 5.1 tests
-
-#
-# Test for the problem with using sj-materialization when subquery's select
-# list element SCOL is covered by equality propagation and has preceding equal
-# column PCOL which belongs to a table within the the semi-join nest: SJM-Scan
-# process should unpack column value not to SCOL but rather to PCOL, as
-# substitute_best_equal has made all conditions to refer to PCOL.
-#
-CREATE TABLE t1 (
- a int(11) NOT NULL,
- b int(11) NOT NULL,
- c datetime default NULL,
- PRIMARY KEY (a),
- KEY idx_bc (b,c)
-);
-
-INSERT INTO t1 VALUES
-(406989,67,'2006-02-23 17:08:46'), (150078,67,'2005-10-26 11:17:45'),
-(406993,67,'2006-02-27 11:20:57'), (245655,67,'2005-12-08 15:59:08'),
-(406994,67,'2006-02-27 11:26:46'), (256,67,NULL),
-(398341,67,'2006-02-20 04:48:44'), (254,67,NULL),(1120,67,NULL),
-(406988,67,'2006-02-23 17:07:22'), (255,67,NULL),
-(398340,67,'2006-02-20 04:38:53'),(406631,67,'2006-02-23 10:49:42'),
-(245653,67,'2005-12-08 15:59:07'),(406992,67,'2006-02-24 16:47:18'),
-(245654,67,'2005-12-08 15:59:08'),(406995,67,'2006-02-28 11:55:00'),
-(127261,67,'2005-10-13 12:17:58'),(406991,67,'2006-02-24 16:42:32'),
-(245652,67,'2005-12-08 15:58:27'),(398545,67,'2006-02-20 04:53:13'),
-(154504,67,'2005-10-28 11:53:01'),(9199,67,NULL),(1,67,'2006-02-23 15:01:35'),
-(223456,67,NULL),(4101,67,NULL),(1133,67,NULL),
-(406990,67,'2006-02-23 18:01:45'),(148815,67,'2005-10-25 15:34:17'),
-(148812,67,'2005-10-25 15:30:01'),(245651,67,'2005-12-08 15:58:27'),
-(154503,67,'2005-10-28 11:52:38');
-
-create table t11 select * from t1 where b = 67 AND (c IS NULL OR c > NOW()) order by 3 asc;
-create table t12 select * from t1 where b = 67 AND (c IS NULL OR c > NOW()) order by 3 desc;
-create table t21 select * from t1 where b = 67 AND (c IS NULL OR c > '2005-12-08') order by 3 asc;
-create table t22 select * from t1 where b = 67 AND (c IS NULL OR c > '2005-12-08') order by 3 desc;
-
-set @@optimizer_switch=@save_optimizer_switch;
-set @@optimizer_switch='materialization=off';
-
-update t22 set c = '2005-12-08 15:58:27' where a = 255;
-explain select t21.* from t21,t22 where t21.a = t22.a and
-t22.a in (select t12.a from t11, t12 where t11.a in(255,256) and t11.a = t12.a and t11.c is null) and t22.c is null order by t21.a;
-select t21.* from t21,t22 where t21.a = t22.a and
-t22.a in (select t12.a from t11, t12 where t11.a in(255,256) and t11.a = t12.a and t11.c is null) and t22.c is null order by t21.a;
-
-set @@optimizer_switch=@save_optimizer_switch;
-
-drop table t1, t11, t12, t21, t22;
-
-#
-# Test sj-materialization re-execution. The test isn't meaningful (materialized
-# table stays the same across all executions) because it's hard to create a
-# dataset that would verify correct re-execution without hitting BUG#31480
-#
-create table t1(a int);
-insert into t1 values (0),(1);
-
-set @@optimizer_switch='firstmatch=off,materialization=off';
-explain
-select (select max(Y.a) from t1 Y where a in (select a from t1 Z) and a < X.a) as subq from t1 X;
-select (select max(Y.a) from t1 Y where a in (select a from t1 Z) and a < X.a) as subq from t1 X;
-set @@optimizer_switch=@save_optimizer_switch;
-
-drop table t1;
-
-#
-# Test confluent duplicate weedout
-#
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t1 as select * from t0;
-insert into t1 select a+10 from t0;
-set @@optimizer_switch='firstmatch=off,materialization=off';
-insert into t0 values(2);
-explain select * from t1 where 2 in (select a from t0);
-select * from t1 where 2 in (select a from t0);
-set @@optimizer_switch=@save_optimizer_switch;
-set @@optimizer_switch='materialization=off';
-explain select * from t1 where 2 in (select a from t0);
-select * from t1 where 2 in (select a from t0);
-set @@optimizer_switch=@save_optimizer_switch;
-
-
-set @@optimizer_switch=@save_optimizer_switch;
-set @@optimizer_switch='materialization=off';
-
-#
-# FirstMatch referring to a derived table
-#
-set @tmp_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='derived_merge=off,derived_with_keys=off';
-explain select * from (select a from t0) X where a in (select a from t1);
-drop table t0, t1;
-set optimizer_switch=@tmp_optimizer_switch;
-
-#
-# LooseScan: Check if we can pick it together with range access
-#
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1 (kp1 int, kp2 int, c int, filler char(100), key(kp1, kp2));
-insert into t1 select A.a+10*(B.a+10*C.a), 0, 0, 'filler' from t0 A, t0 B, t0 C;
-insert into t1 select * from t1 where kp1 < 20;
-
-create table t3 (a int);
-insert into t3 select A.a + 10*B.a from t0 A, t0 B;
-
-explain select * from t3 where a in (select kp1 from t1 where kp1<20);
-
-create table t4 (pk int primary key);
-insert into t4 select a from t3;
-
-explain select * from t3 where a in (select t1.kp1 from t1,t4 where kp1<20
-and t4.pk=t1.c);
-
-drop table t1, t3, t4;
-
-set @@optimizer_switch=@save_optimizer_switch;
-
-#
-# Test if we handle duplicate elimination temptable overflowing to disk
-#
-create table t1 (a int) as select * from t0 where a < 5;
-
-set @save_max_heap_table_size=@@max_heap_table_size;
-set @@optimizer_switch='firstmatch=off,materialization=off';
-set @@max_heap_table_size= 16384;
-
-explain select count(*) from t0 A, t0 B, t0 C, t0 D where D.a in (select a from t1 E where a+1 < 10000 + A.a + B.a +C.a+D.a);
-flush status;
-select count(*) from t0 A, t0 B, t0 C, t0 D where D.a in (select a from t1 E where a+1 < 10000 + A.a + B.a +C.a+D.a);
-show status like 'Created_tmp_disk_tables';
-set @save_max_heap_table_size=@@max_heap_table_size;
-set @@optimizer_switch=@save_optimizer_switch;
-drop table t0, t1;
-
-#
-# Materialize + Scan + ref access to the subsequent table based on scanned
-# value
-#
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t2(a int);
-insert into t2 values (1),(2);
-create table t3 ( a int , filler char(100), key(a));
-insert into t3 select A.a + 10*B.a, 'filler' from t0 A, t0 B;
-explain select * from t3 where a in (select a from t2) and (a > 5 or a < 10);
-select * from t3 where a in (select a from t2);
-
-drop table t0, t2, t3;
-
-#
-# DATETIME type checks
-#
-set @@optimizer_switch='firstmatch=off,materialization=off';
-create table t1 (a date);
-insert into t1 values ('2008-01-01'),('2008-01-01'),('2008-02-01'),('2008-02-01');
-create table t2 (a int);
-insert into t2 values (1),(2);
-create table t3 (a char(10));
-insert into t3 select * from t1;
-insert into t3 values (1),(2);
-explain select * from t2 where a in (select a from t1);
-explain select * from t2 where a in (select a from t2);
-explain select * from t2 where a in (select a from t3);
-explain select * from t1 where a in (select a from t3);
-drop table t1, t2, t3;
-create table t1 (a decimal);
-insert into t1 values (1),(2);
-explain select * from t1 where a in (select a from t1);
-drop table t1;
-set @@optimizer_switch=@save_optimizer_switch;
-
-set @@optimizer_switch=@save_optimizer_switch;
-set @@optimizer_switch='materialization=off';
-
-#
-# SJ-Materialization-scan for non-first table
-#
-create table t1 (a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t2 as select * from t1;
-create table t3 (a int, b int, filler char(100), key(a));
-insert into t3 select A.a + 10*B.a, A.a + 10*B.a, 'filler' from t1 A, t1 B, t1 C;
-explain select * from t1, t3 where t3.a in (select a from t2) and (t3.a < 10 or t3.a >30) and t1.a =3;
-
-#
-# Verify that straight_join modifier in parent or child prevents flattening
-#
-explain select straight_join * from t1 A, t1 B where A.a in (select a from t2);
-explain select * from t2 where a in (select straight_join A.a from t1 A, t1 B);
-explain select * from t2 where a in (select straight_join A.a from t1 A, t1 B);
-explain select straight_join * from t2 X, t2 Y
-where X.a in (select straight_join A.a from t1 A, t1 B);
-
-#
-# SJ-Materialization scan + first table being system const table
-#
-create table t0 (a int, b int);
-insert into t0 values(1,1);
-explain select * from t0, t3 where t3.a in (select a from t2) and (t3.a < 10 or t3.a >30);
-create table t4 as select a as x, a as y from t1;
-explain select * from t0, t3 where (t3.a, t3.b) in (select x,y from t4) and (t3.a < 10 or t3.a >30);
-drop table t0,t1,t2,t3,t4;
-
-#
-# LooseScan with ref access
-#
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t1 (a int, b int, filler char(100), key(a,b));
-insert into t1 select A.a, B.a, 'filler' from t0 A, t0 B;
-create table t2 as select * from t1;
-
-explain select * from t2 where a in (select b from t1 where a=3);
-explain select * from t2 where (b,a) in (select a,b from t1 where a=3);
-
-drop table t1,t2;
-
-set @@optimizer_switch=@save_optimizer_switch;
-
-#
-# Multi-column sj-materialization with lookups
-#
-create table t1 (a int, b int);
-insert into t1 select a,a from t0;
-create table t2 (a int, b int);
-insert into t2 select A.a + 10*B.a, A.a + 10*B.a from t0 A, t0 B;
-
-set @@optimizer_switch='firstmatch=off,materialization=off';
-explain select * from t1 where (a,b) in (select a,b from t2);
-
-# A smallish test if find_best() still works for semi-join optimization:
-set @save_optimizer_search_depth=@@optimizer_search_depth;
-set @@optimizer_search_depth=63;
-explain select * from t1 where (a,b) in (select a,b from t2);
-set @@optimizer_search_depth=@save_optimizer_search_depth;
-set @@optimizer_switch=@save_optimizer_switch;
-
-drop table t0, t1, t2;
-
-set @@optimizer_switch='materialization=off';
-
-#
-# Primitive SJ-Materialization tests for DECIMAL and DATE
-#
-create table t0 (a decimal(4,2));
-insert into t0 values (10.24), (22.11);
-create table t1 as select * from t0;
-insert into t1 select * from t0;
-explain select * from t0 where a in (select a from t1);
-select * from t0 where a in (select a from t1);
-drop table t0, t1;
-
-create table t0(a date);
-insert into t0 values ('2008-01-01'),('2008-02-02');
-create table t1 as select * from t0;
-insert into t1 select * from t0;
-explain select * from t0 where a in (select a from t1);
-select * from t0 where a in (select a from t1);
-drop table t0, t1;
-
-#
-# Fix a trivial crash with SJ-Materialization lookup, multiple tables in the
-# subquery, and a condition on some of inner tables but not others
-#
-create table t0(a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t1 as select a as a, a as b, a as c from t0 where a < 3;
-create table t2 as select a as a, a as b from t0 where a < 3;
-insert into t2 select * from t2;
-
-explain select * from t1 where (a,b,c) in (select X.a, Y.a, Z.a from t2 X, t2 Y, t2 Z where X.b=33);
-
-drop table t0,t1,t2;
-
-set @@optimizer_switch=@save_optimizer_switch;
-
---echo
---echo BUG#37842: Assertion in DsMrr_impl::dsmrr_init, at handler.cc:4307
---echo
-CREATE TABLE t1 (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `int_key` int(11) DEFAULT NULL,
- PRIMARY KEY (`pk`),
- KEY `int_key` (`int_key`)
-) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,9),(2,3),(3,8),(4,6),(5,9),(6,5),(7,5),(8,9),(9,1),(10,10);
-SELECT `pk` FROM t1 AS OUTR WHERE `int_key` = ALL (
- SELECT `int_key` FROM t1 AS INNR WHERE INNR . `pk` >= 9
-);
-DROP TABLE t1;
-
---echo
---echo BUG#40118 Crash when running Batched Key Access and requiring one match for each key
---echo
-create table t0(a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t1 (a int, key(a));
-insert into t1 select * from t0;
-alter table t1 add b int not null, add filler char(200);
-insert into t1 select * from t1;
-insert into t1 select * from t1;
-
-set @save_join_cache_level=@@join_cache_level;
-set join_cache_level=6;
-select * from t0 where t0.a in (select t1.a from t1 where t1.b=0);
-set join_cache_level=@save_join_cache_level;
-drop table t0, t1;
-
---echo #
---echo # BUG#32665 Query with dependent subquery is too slow
---echo #
-create table t1 (
- idIndividual int primary key
-);
-insert into t1 values (1),(2);
-
-create table t2 (
- idContact int primary key,
- contactType int,
- idObj int
-);
-insert into t2 values (1,1,1),(2,2,2),(3,3,3);
-
-create table t3 (
- idAddress int primary key,
- idContact int,
- postalStripped varchar(100)
-);
-
-insert into t3 values (1,1, 'foo'), (2,2,'bar');
-
---echo The following must be converted to a semi-join:
-set @save_optimizer_switch=@@optimizer_switch;
-set @@optimizer_switch='materialization=off';
-explain extended SELECT a.idIndividual FROM t1 a
-WHERE a.idIndividual IN
- ( SELECT c.idObj FROM t3 cona
- INNER JOIN t2 c ON c.idContact=cona.idContact
- WHERE cona.postalStripped='T2H3B2'
- );
-set @@optimizer_switch=@save_optimizer_switch;
-drop table t1,t2,t3;
-
---echo #
---echo # BUG#47367 Crash in Name_resolution_context::process_error
---echo #
-
-SET SESSION optimizer_switch = 'semijoin=off';
-CREATE TABLE t1 (f1 INTEGER);
-CREATE TABLE t2 LIKE t1;
-delimiter |;
-CREATE PROCEDURE p1 () BEGIN SELECT f1 FROM t1 WHERE f1 IN (SELECT f1 FROM t2); END|
-delimiter ;|
-CALL p1;
-ALTER TABLE t2 CHANGE COLUMN f1 my_column INT;
-CALL p1;
-DROP PROCEDURE p1;
---echo # Restore the original column list of table t2:
-ALTER TABLE t2 CHANGE COLUMN my_column f1 INT;
-
-SET SESSION optimizer_switch = 'semijoin=on';
-delimiter |;
---echo # Recreate procedure so that we eliminate any caching effects
-CREATE PROCEDURE p1 () BEGIN SELECT f1 FROM t1 WHERE f1 IN (SELECT f1 FROM t2); END|
-delimiter ;|
-CALL p1;
-ALTER TABLE t2 CHANGE COLUMN f1 my_column INT;
---error ER_BAD_FIELD_ERROR
-CALL p1;
-DROP PROCEDURE p1;
-DROP TABLE t1, t2;
-
---echo #
---echo # fix of lp:824425 (prohibiting subqueries in row in
---echo # left part of IN/ALL/ANY)
---echo #
-
-CREATE TABLE t1 ( a int) ;
-INSERT INTO t1 VALUES (20),(30);
-
-CREATE TABLE t2 (a int) ;
-INSERT INTO t2 VALUES (3),(9);
-
-CREATE TABLE t3 ( a int, b int) ;
-INSERT INTO t3 VALUES (20,5),(30,6);
-
-set @optimizer_switch_save=@@optimizer_switch;
-SET SESSION optimizer_switch='semijoin=OFF,in_to_exists=OFF,materialization=ON,partial_match_rowid_merge=ON,partial_match_table_scan=OFF';
-
-SELECT * FROM t1
-WHERE (
- ( SELECT a FROM t2 WHERE a = 9 )
-) NOT IN (
- SELECT b
- FROM t3
-);
-explain extended
-SELECT * FROM t1
-WHERE (
- ( SELECT a FROM t2 WHERE a = 9 )
-) NOT IN (
- SELECT b
- FROM t3
-);
-
---error ER_NOT_SUPPORTED_YET
-SELECT * FROM t1
-WHERE (
- ( SELECT a FROM t2 WHERE a = 9 ),
- ( SELECT a FROM t2 WHERE a = 3 )
-) NOT IN (
- SELECT b , a
- FROM t3
-);
-set optimizer_switch=@optimizer_switch_save;
-
-drop table t1,t2,t3;
-
---echo End of 5.3 tests
-
---echo #
---echo # BUG#48920: COUNT DISTINCT returns 1 for NULL values when in a subquery
---echo # in the select list
---echo #
-
---echo
-CREATE TABLE t1 (
- i int(11) DEFAULT NULL,
- v varchar(1) DEFAULT NULL
-);
-
---echo
-INSERT INTO t1 VALUES (8,'v');
-INSERT INTO t1 VALUES (9,'r');
-INSERT INTO t1 VALUES (NULL,'y');
-
---echo
-CREATE TABLE t2 (
- i int(11) DEFAULT NULL,
- v varchar(1) DEFAULT NULL,
- KEY i_key (i)
-);
-
---echo
-INSERT INTO t2 VALUES (NULL,'r');
-INSERT INTO t2 VALUES (0,'c');
-INSERT INTO t2 VALUES (0,'o');
-INSERT INTO t2 VALUES (2,'v');
-INSERT INTO t2 VALUES (7,'c');
-
---echo
-SELECT i, v, (SELECT COUNT(DISTINCT i)
- FROM t1
- WHERE v = t2.v) as subsel
-FROM t2;
-
---echo
-EXPLAIN EXTENDED
-SELECT i, v, (SELECT COUNT(DISTINCT i)
- FROM t1
- WHERE v = t2.v) as subsel
-FROM t2;
-
-DROP TABLE t1,t2;
-
---echo End of 5.6 tests
-
-# The following command must be the last one in the file
-set @@optimizer_switch=@subselect3_tmp;
diff --git a/mysql-test/t/subselect3_jcl6.test b/mysql-test/t/subselect3_jcl6.test
deleted file mode 100644
index e4b1c144b93..00000000000
--- a/mysql-test/t/subselect3_jcl6.test
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# Run subselect3.test with BKA enabled
-#
-
-set @save_optimizer_switch=@@optimizer_switch;
-set @@optimizer_switch='optimize_join_buffer_size=on';
-set @@optimizer_switch='semijoin_with_cache=on';
-set @@optimizer_switch='outer_join_with_cache=on';
-set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
-
-set join_cache_level=6;
-show variables like 'join_cache_level';
-
-set @join_cache_level_for_subselect3_test=@@join_cache_level;
-
---source t/subselect3.test
-
-set join_cache_level=default;
-show variables like 'join_cache_level';
-
-set @@optimizer_switch=@save_optimizer_switch;
-set @join_cache_level_for_subselect3_test=NULL;
diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test
deleted file mode 100644
index 77ea117b15f..00000000000
--- a/mysql-test/t/subselect4.test
+++ /dev/null
@@ -1,2054 +0,0 @@
-# General purpose bug fix tests go here : subselect.test too large
-
---disable_warnings
-drop table if exists t0,t1,t2,t3,t4,t5,t6;
-drop view if exists v1, v2;
---enable_warnings
-
-set @subselect4_tmp= @@optimizer_switch;
-set optimizer_switch='semijoin=on,firstmatch=on,loosescan=on';
-set optimizer_switch='semijoin_with_cache=on';
-set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
-
---echo #
---echo # Bug #46791: Assertion failed:(table->key_read==0),function unknown
---echo # function,file sql_base.cc
---echo #
-
-CREATE TABLE t1 (a INT, b INT, KEY(a));
-INSERT INTO t1 VALUES (1,1),(2,2);
-CREATE TABLE t2 LIKE t1;
-INSERT INTO t2 VALUES (1,1),(2,2);
-CREATE TABLE t3 LIKE t1;
-
---echo # should have 1 impossible where and 2 dependent subqueries
-EXPLAIN
-SELECT 1 FROM t1
-WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3))
-ORDER BY count(*);
-
---echo # should not crash the next statement
-SELECT 1 FROM t1
-WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3))
-ORDER BY count(*);
-
---echo # should not crash: the crash is caused by the previous statement
-SELECT 1;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # Bug #47106: Crash / segfault on adding EXPLAIN to a non-crashing
---echo # query
---echo #
-
-CREATE TABLE t1 (
- a INT,
- b INT,
- PRIMARY KEY (a),
- KEY b (b)
-);
-INSERT INTO t1 VALUES (1, 1), (2, 1);
-
-CREATE TABLE t2 LIKE t1;
-INSERT INTO t2 SELECT * FROM t1;
-
-CREATE TABLE t3 LIKE t1;
-INSERT INTO t3 SELECT * FROM t1;
-
---echo # Should not crash.
---echo # Should have 1 impossible where and 2 dependent subqs.
-EXPLAIN
-SELECT
- (SELECT 1 FROM t1,t2 WHERE t2.b > t3.b)
-FROM t3 WHERE 1 = 0 GROUP BY 1;
-
---echo # should return 0 rows
-SELECT
- (SELECT 1 FROM t1,t2 WHERE t2.b > t3.b)
-FROM t3 WHERE 1 = 0 GROUP BY 1;
-
-DROP TABLE t1,t2,t3;
-
---echo End of 5.0 tests.
-
-#
-# Fix for LP#612894
-# Some aggregate functions (such as MIN MAX) work incorrectly in subqueries
-# after getting NULL value
-#
-
-CREATE TABLE t1 (col_int_nokey int(11) NOT NULL, col_varchar_nokey varchar(1) NOT NULL) engine=myisam;
-INSERT INTO t1 VALUES (2,'s'),(0,'v'),(2,'s');
-CREATE TABLE t2 (
- pk int(11) NOT NULL AUTO_INCREMENT,
- `col_int_key` int(11) NOT NULL,
- col_varchar_key varchar(1) NOT NULL,
- PRIMARY KEY (pk),
- KEY `col_int_key` (`col_int_key`),
- KEY `col_varchar_key` (`col_varchar_key`)
-) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (4,10,'g'), (5,20,'v');
-
-SELECT t1.col_int_nokey,(SELECT MIN( t2_a.col_int_key ) FROM t2 t2_a, t2 t2_b, t1 t1_a WHERE t1_a.col_varchar_nokey = t2_b.col_varchar_key and t1.col_int_nokey ) as sub FROM t1;
-
-SELECT t1.col_int_nokey,(SELECT MIN( t2_a.col_int_key ) +1 FROM t2 t2_a, t2 t2_b, t1 t1_a WHERE t1_a.col_varchar_nokey = t2_b.col_varchar_key and t1.col_int_nokey ) as sub FROM t1;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug#54568: create view cause Assertion failed: 0,
---echo # file .\item_subselect.cc, line 836
---echo #
-EXPLAIN SELECT 1 LIKE ( 1 IN ( SELECT 1 ) );
-DESCRIBE SELECT 1 LIKE ( 1 IN ( SELECT 1 ) );
---echo # None of the below should crash
-CREATE VIEW v1 AS SELECT 1 LIKE ( 1 IN ( SELECT 1 ) );
-CREATE VIEW v2 AS SELECT 1 LIKE '%' ESCAPE ( 1 IN ( SELECT 1 ) );
-DROP VIEW v1, v2;
-
---echo #
---echo # Bug#51070: Query with a NOT IN subquery predicate returns a wrong
---echo # result set
---echo #
-CREATE TABLE t1 ( a INT, b INT );
-INSERT INTO t1 VALUES ( 1, NULL ), ( 2, NULL );
-
-CREATE TABLE t2 ( c INT, d INT );
-INSERT INTO t2 VALUES ( NULL, 3 ), ( NULL, 4 );
-
-CREATE TABLE t3 ( e INT, f INT );
-INSERT INTO t3 VALUES ( NULL, NULL ), ( NULL, NULL );
-
-CREATE TABLE t4 ( a INT );
-INSERT INTO t4 VALUES (1), (2), (3);
-
-CREATE TABLE t5 ( a INT );
-INSERT INTO t5 VALUES (NULL), (2);
-
-SET @old_optimizer_switch = @@session.optimizer_switch;
-SET SESSION optimizer_switch = 'materialization=off,in_to_exists=on,semijoin=off';
-
---replace_column 1 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x
-EXPLAIN
-SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 );
-SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 );
-
-EXPLAIN
-SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ) IS NULL;
-SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ) IS NULL;
-SELECT * FROM t1 WHERE ( a, b ) IN ( SELECT c, d FROM t2 ) IS NULL;
-SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ) IS UNKNOWN;
-SELECT * FROM t1 WHERE (( a, b ) NOT IN ( SELECT c, d FROM t2 )) IS UNKNOWN;
-
-SELECT * FROM t1 WHERE 1 = 1 AND ( a, b ) NOT IN ( SELECT c, d FROM t2 );
-
---replace_column 1 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x
-EXPLAIN
-SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT e, f FROM t3 );
-SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT e, f FROM t3 );
-
---replace_column 1 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x
-EXPLAIN
-SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT a, b FROM t1 );
-SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT a, b FROM t1 );
-
---replace_column 1 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x
-EXPLAIN
-SELECT * FROM t3 WHERE ( e, f ) NOT IN ( SELECT c, d FROM t2 );
-SELECT * FROM t3 WHERE ( e, f ) NOT IN ( SELECT c, d FROM t2 );
-
---replace_column 1 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x
-EXPLAIN
-SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT e, f FROM t3 );
-SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT e, f FROM t3 );
-
-SELECT * FROM t1 WHERE ( a, b ) NOT IN
- ( SELECT c, d FROM t2 WHERE c = 1 AND c <> 1 );
-
-SELECT * FROM t1 WHERE b NOT IN ( SELECT c FROM t2 WHERE c = 1 );
-
-SELECT * FROM t1 WHERE NULL NOT IN ( SELECT c FROM t2 WHERE c = 1 AND c <> 1 );
-
-SET SESSION optimizer_switch = @old_optimizer_switch;
-
-DROP TABLE t1, t2, t3, t4, t5;
-
---echo #
---echo # Bug#58207: invalid memory reads when using default column value and
---echo # tmptable needed
---echo #
-CREATE TABLE t(a VARCHAR(245) DEFAULT
-'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
-INSERT INTO t VALUES (''),(''),(''),(''),(''),(''),(''),(''),(''),(''),('');
-SELECT * FROM (SELECT default(a) FROM t GROUP BY a) d;
-DROP TABLE t;
-
---echo #
---echo # LP BUG#1009187, MDEV-373, MYSQL bug#58628
---echo # Wrong result for a query with [NOT] IN subquery predicate if
---echo # the left part of the predicate is explicit NULL
---echo #
-
-CREATE TABLE t1 (pk INT NOT NULL, i INT NOT NULL);
-INSERT INTO t1 VALUES (0,10), (1,20), (2,30), (3,40);
-
-CREATE TABLE t2a (pk INT NOT NULL, i INT NOT NULL, PRIMARY KEY(i,pk));
-INSERT INTO t2a VALUES (0,0), (1,1), (2,2), (3,3);
-
-CREATE TABLE t2b (pk INT, i INT);
-INSERT INTO t2b VALUES (0,0), (1,1), (2,2), (3,3);
-
-CREATE TABLE t2c (pk INT NOT NULL, i INT NOT NULL);
-INSERT INTO t2c VALUES (0,0), (1,1), (2,2), (3,3);
-create index it2c on t2c (i,pk);
-
-CREATE TABLE t2d (pk INT NOT NULL, i INT NOT NULL, PRIMARY KEY(i));
-INSERT INTO t2d VALUES (0,0), (1,1), (2,2), (3,3);
-
-EXPLAIN
-SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk);
-SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk);
-SELECT * FROM t1 WHERE 1+NULL NOT IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk);
-SELECT * FROM t1 WHERE NULL IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk) IS UNKNOWN;
-SELECT t1.pk, NULL NOT IN (SELECT t2a.i FROM t2a WHERE t2a.pk = t1.pk) FROM t1;
-
-EXPLAIN
-SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2b.i FROM t2b WHERE t2b.pk = t1.pk);
-SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2b.i FROM t2b WHERE t2b.pk = t1.pk);
-SELECT * FROM t1 WHERE NULL IN (SELECT t2b.i FROM t2b WHERE t2b.pk = t1.pk) IS UNKNOWN;
-SELECT t1.pk, NULL NOT IN (SELECT t2b.i FROM t2b WHERE t2b.pk = t1.pk) FROM t1;
-
-EXPLAIN
-SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2c.i FROM t2c WHERE t2c.pk = t1.pk);
-SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2c.i FROM t2c WHERE t2c.pk = t1.pk);
-SELECT * FROM t1 WHERE NULL IN (SELECT t2c.i FROM t2c WHERE t2c.pk = t1.pk) IS UNKNOWN;
-SELECT t1.pk, NULL NOT IN (SELECT t2c.i FROM t2c WHERE t2c.pk = t1.pk) FROM t1;
-
-EXPLAIN
-SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2d.i FROM t2d WHERE t2d.pk = t1.pk);
-SELECT * FROM t1 WHERE NULL NOT IN (SELECT t2d.i FROM t2d WHERE t2d.pk = t1.pk);
-SELECT * FROM t1 WHERE NULL IN (SELECT t2d.i FROM t2d WHERE t2d.pk = t1.pk) IS UNKNOWN;
-SELECT t1.pk, NULL NOT IN (SELECT t2d.i FROM t2d WHERE t2d.pk = t1.pk) FROM t1;
-
-EXPLAIN
-SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2a.i, t2a.pk FROM t2a WHERE t2a.pk = t1.pk);
-SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2a.i, t2a.pk FROM t2a WHERE t2a.pk = t1.pk);
-SELECT (NULL, 1) NOT IN (SELECT t2a.i, t2a.pk FROM t2a WHERE t2a.pk = t1.pk) from t1;
-
-EXPLAIN
-SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2b.i, t2b.pk FROM t2b WHERE t2b.pk = t1.pk);
-SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2b.i, t2b.pk FROM t2b WHERE t2b.pk = t1.pk);
-SELECT (NULL, 1) NOT IN (SELECT t2b.i, t2b.pk FROM t2b WHERE t2b.pk = t1.pk) from t1;
-
-EXPLAIN
-SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2c.i, t2c.pk FROM t2c WHERE t2c.pk = t1.pk);
-SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2c.i, t2c.pk FROM t2c WHERE t2c.pk = t1.pk);
-SELECT (NULL, 1) NOT IN (SELECT t2c.i, t2c.pk FROM t2c WHERE t2c.pk = t1.pk) from t1;
-
-EXPLAIN
-SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2d.i, t2d.pk FROM t2d WHERE t2d.pk = t1.pk);
-SELECT * FROM t1 WHERE (NULL, 1) NOT IN (SELECT t2d.i, t2d.pk FROM t2d WHERE t2d.pk = t1.pk);
-SELECT (NULL, 1) NOT IN (SELECT t2d.i, t2d.pk FROM t2d WHERE t2d.pk = t1.pk) from t1;
-
-drop table t1, t2a, t2b, t2c, t2d;
-
---echo #
---echo # End of 5.1 tests.
---echo #
-
---echo #
---echo # BUG#46743 "Azalea processing correlated, aggregate SELECT
---echo # subqueries incorrectly"
---echo #
-
-CREATE TABLE t1 (c int);
-INSERT INTO t1 VALUES (NULL);
-CREATE TABLE t2 (d int , KEY (d)); # index is needed for bug
-INSERT INTO t2 VALUES (NULL),(NULL); # two rows needed for bug
-# we see that subquery returns 0 rows
---echo 0 rows in subquery
-SELECT 1 AS RESULT FROM t2,t1 WHERE d = c;
-# so here it ends up as NULL
---echo base query
-SELECT (SELECT 1 FROM t2 WHERE d = c) AS RESULT FROM t1 ;
-EXPLAIN EXTENDED SELECT (SELECT 1 FROM t2 WHERE d = c) AS RESULT FROM t1 ;
---echo first equivalent variant
-SELECT (SELECT 1 FROM t2 WHERE d = IFNULL(c,NULL)) AS RESULT FROM t1 GROUP BY c ;
-EXPLAIN EXTENDED SELECT (SELECT 1 FROM t2 WHERE d = IFNULL(c,NULL)) AS RESULT FROM t1 GROUP BY c;
---echo second equivalent variant
-# used to fail with 1242: Subquery returns more than 1 row
-SELECT (SELECT 1 FROM t2 WHERE d = c) AS RESULT FROM t1 GROUP BY c ;
-EXPLAIN EXTENDED SELECT (SELECT 1 FROM t2 WHERE d = c) AS RESULT FROM t1 GROUP BY c ;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # BUG#45928 "Differing query results depending on MRR and
---echo # engine_condition_pushdown settings"
---echo #
-
-CREATE TABLE `t1` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `time_nokey` time NOT NULL,
- `varchar_key` varchar(1) NOT NULL,
- `varchar_nokey` varchar(1) NOT NULL,
- PRIMARY KEY (`pk`),
- KEY `varchar_key` (`varchar_key`)
-) AUTO_INCREMENT=12 DEFAULT CHARSET=latin1;
-INSERT INTO `t1` VALUES (10,'00:00:00','i','i'),(11,'00:00:00','','');
-
-set @old_optimizer_switch = @@session.optimizer_switch;
-
-SET SESSION OPTIMIZER_SWITCH = 'materialization=off,semijoin=off,loosescan=off,firstmatch=off,mrr=on,engine_condition_pushdown=on';
-
- SELECT `time_nokey` G1 FROM t1 WHERE ( `varchar_nokey` , `varchar_key` ) IN (
-SELECT `varchar_nokey` , `varchar_nokey` ) AND `varchar_key` >= 'c' HAVING G1 ORDER
-BY `pk` ;
-
-set @@session.optimizer_switch = @old_optimizer_switch;
-
-DROP TABLE t1;
-
---echo #
---echo # During work with BUG#45863 I had problems with a query that was
---echo # optimized differently in regular and prepared mode.
---echo # Because there was a bug in one of the selected strategies, I became
---echo # aware of the problem. Adding an EXPLAIN query to catch this.
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2, t3;
---enable_warnings
-
-CREATE TABLE t1
- (EMPNUM CHAR(3) NOT NULL,
- EMPNAME CHAR(20),
- GRADE DECIMAL(4),
- CITY CHAR(15));
-
-CREATE TABLE t2
- (PNUM CHAR(3) NOT NULL,
- PNAME CHAR(20),
- PTYPE CHAR(6),
- BUDGET DECIMAL(9),
- CITY CHAR(15));
-
-CREATE TABLE t3
- (EMPNUM CHAR(3) NOT NULL,
- PNUM CHAR(3) NOT NULL,
- HOURS DECIMAL(5));
-
-INSERT INTO t1 VALUES ('E1','Alice',12,'Deale');
-INSERT INTO t1 VALUES ('E2','Betty',10,'Vienna');
-INSERT INTO t1 VALUES ('E3','Carmen',13,'Vienna');
-INSERT INTO t1 VALUES ('E4','Don',12,'Deale');
-INSERT INTO t1 VALUES ('E5','Ed',13,'Akron');
-
-INSERT INTO t2 VALUES ('P1','MXSS','Design',10000,'Deale');
-INSERT INTO t2 VALUES ('P2','CALM','Code',30000,'Vienna');
-INSERT INTO t2 VALUES ('P3','SDP','Test',30000,'Tampa');
-INSERT INTO t2 VALUES ('P4','SDP','Design',20000,'Deale');
-INSERT INTO t2 VALUES ('P5','IRM','Test',10000,'Vienna');
-INSERT INTO t2 VALUES ('P6','PAYR','Design',50000,'Deale');
-
-INSERT INTO t3 VALUES ('E1','P1',40);
-INSERT INTO t3 VALUES ('E1','P2',20);
-INSERT INTO t3 VALUES ('E1','P3',80);
-INSERT INTO t3 VALUES ('E1','P4',20);
-INSERT INTO t3 VALUES ('E1','P5',12);
-INSERT INTO t3 VALUES ('E1','P6',12);
-INSERT INTO t3 VALUES ('E2','P1',40);
-INSERT INTO t3 VALUES ('E2','P2',80);
-INSERT INTO t3 VALUES ('E3','P2',20);
-INSERT INTO t3 VALUES ('E4','P2',20);
-INSERT INTO t3 VALUES ('E4','P4',40);
-INSERT INTO t3 VALUES ('E4','P5',80);
-
-SET @old_optimizer_switch = @@session.optimizer_switch;
-SET @old_join_cache_level = @@session.join_cache_level;
-SET SESSION optimizer_switch = 'firstmatch=on,loosescan=on,materialization=on,in_to_exists=off,semijoin=on';
-SET SESSION join_cache_level = 1;
-
-CREATE UNIQUE INDEX t1_IDX ON t1(EMPNUM);
-
-EXPLAIN SELECT EMPNAME
-FROM t1
-WHERE EMPNUM IN
- (SELECT EMPNUM
- FROM t3
- WHERE PNUM IN
- (SELECT PNUM
- FROM t2
- WHERE PTYPE = 'Design'));
-
-PREPARE stmt FROM "EXPLAIN SELECT EMPNAME
-FROM t1
-WHERE EMPNUM IN
- (SELECT EMPNUM
- FROM t3
- WHERE PNUM IN
- (SELECT PNUM
- FROM t2
- WHERE PTYPE = 'Design'))";
-EXECUTE stmt;
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-
-DROP INDEX t1_IDX ON t1;
-CREATE INDEX t1_IDX ON t1(EMPNUM);
-
-EXPLAIN SELECT EMPNAME
-FROM t1
-WHERE EMPNUM IN
- (SELECT EMPNUM
- FROM t3
- WHERE PNUM IN
- (SELECT PNUM
- FROM t2
- WHERE PTYPE = 'Design'));
-
-PREPARE stmt FROM "EXPLAIN SELECT EMPNAME
-FROM t1
-WHERE EMPNUM IN
- (SELECT EMPNUM
- FROM t3
- WHERE PNUM IN
- (SELECT PNUM
- FROM t2
- WHERE PTYPE = 'Design'))";
-EXECUTE stmt;
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-
-DROP INDEX t1_IDX ON t1;
-
-EXPLAIN SELECT EMPNAME
-FROM t1
-WHERE EMPNUM IN
- (SELECT EMPNUM
- FROM t3
- WHERE PNUM IN
- (SELECT PNUM
- FROM t2
- WHERE PTYPE = 'Design'));
-
-PREPARE stmt FROM "EXPLAIN SELECT EMPNAME
-FROM t1
-WHERE EMPNUM IN
- (SELECT EMPNUM
- FROM t3
- WHERE PNUM IN
- (SELECT PNUM
- FROM t2
- WHERE PTYPE = 'Design'))";
-EXECUTE stmt;
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-
-SET SESSION optimizer_switch = @old_optimizer_switch;
-SET SESSION join_cache_level = @old_join_cache_level;
-
-DROP TABLE t1, t2, t3;
-
---echo #
---echo # BUG#45221 Query SELECT pk FROM C WHERE pk IN (SELECT int_key) failing
---echo #
-
-CREATE TABLE t1 (
- i1_key INT,
- i2 INT,
- i3 INT,
- KEY i1_index (i1_key)
-);
-
-INSERT INTO t1 VALUES (9,1,2), (9,2,1);
-
-CREATE TABLE t2 (
- pk INT NOT NULL,
- i1 INT,
- PRIMARY KEY (pk)
-);
-
-INSERT INTO t2 VALUES (9,1);
-
---echo # Enable Index condition pushdown
---replace_column 1 #
-set @old_icp=@@optimizer_switch;
-SET SESSION optimizer_switch="engine_condition_pushdown=on";
-
---echo
-SELECT pk
-FROM t2
-WHERE
- pk IN (
- SELECT i1_key
- FROM t1
- WHERE t1.i2 < t1.i3 XOR t2.i1 > 1
- ORDER BY t1.i2 desc);
-
---echo # Restore old value for Index condition pushdown
-SET SESSION optimizer_switch=@old_icp;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # End of 5.3 tests.
---echo #
-
---echo #
---echo # Bug#53236 Segfault in DTCollation::set(DTCollation&)
---echo #
-
-CREATE TABLE t1 (
- pk INTEGER AUTO_INCREMENT,
- col_varchar VARCHAR(1),
- PRIMARY KEY (pk)
-)
-;
-
-INSERT INTO t1 (col_varchar)
-VALUES
-('w'),
-('m')
-;
-
-SELECT table1.pk
-FROM ( t1 AS table1 JOIN t1 AS table2 ON (table1.col_varchar =
- table2.col_varchar) )
-WHERE ( 1, 2 ) IN ( SELECT SUBQUERY1_t1.pk AS SUBQUERY1_field1,
- SUBQUERY1_t1.pk AS SUBQUERY1_field2
- FROM ( t1 AS SUBQUERY1_t1 JOIN t1 AS SUBQUERY1_t2
- ON (SUBQUERY1_t2.col_varchar =
- SUBQUERY1_t1.col_varchar) ) )
-;
-
-drop table t1;
-
---echo #
---echo # BUG#716293: "Range checked for each record" is not used if condition refers to outside of subquery
---echo #
-
-create table t1 (a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t2 (a int, b int, `filler` char(200), key(a), key (b));
-insert into t2
- select A.a + 10*B.a + 100 * C.a, A.a + 10*B.a + 100 * C.a, 'filler' from t1 A, t1 B, t1 C;
-
---echo # The following must use "Range checked for each record" for table B
-explain
-select a,
- (select sum(X.a+B.b) from t1 X, t2 B where B.a=A.a or B.b=A.a)
-from t1 A;
-drop table t1, t2;
-
-
---echo #
---echo # BUG#723822: Crash in get_constant_key_infix with EXISTS ( SELECT .. DISTINCT )
---echo #
-CREATE TABLE t1 ( f1 int(11), f3 varchar(1)) ;
-INSERT INTO t1 VALUES ('8','c'),('5','f');
-
-ALTER TABLE t1 ADD KEY (f3,f1);
-
-CREATE TABLE t2 ( f4 varchar(1)) ;
-INSERT INTO t2 VALUES ('f'),('d');
-
-SELECT * FROM t2
-WHERE EXISTS (
- SELECT DISTINCT f3
- FROM t1
- WHERE f3 <= t2.f4
-);
-
-drop table t1,t2;
-
---echo #
---echo # LP BUG#718763 Second crash in select_describe() and materialization
---echo #
-
-CREATE TABLE t1 ( f1 int(11), f3 int(11), f10 varchar(1), KEY (f3)) ;
-INSERT INTO t1 VALUES ('28','6','m'),('29','4','c');
-
-CREATE TABLE t2 (f11 varchar(1)) ;
-INSERT INTO t2 VALUES ('f'),('d');
-
-SET @old_optimizer_switch = @@session.optimizer_switch;
-SET SESSION optimizer_switch = 'materialization=on,in_to_exists=off';
-
-EXPLAIN
-SELECT * FROM t1
-WHERE f3 = (
- SELECT t1.f3 FROM t1
- WHERE ( t1.f10 ) IN ( SELECT f11 FROM t2 GROUP BY f11 ));
-SELECT * FROM t1
-WHERE f3 = (
- SELECT t1.f3 FROM t1
- WHERE ( t1.f10 ) IN ( SELECT f11 FROM t2 GROUP BY f11 ));
-
-EXPLAIN
-SELECT * FROM t1
-WHERE f3 = (
- SELECT f3 FROM t1
- WHERE ( f10, f10 ) IN ( SELECT f11, f11 FROM t2 GROUP BY f11 ));
-SELECT * FROM t1
-WHERE f3 = (
- SELECT f3 FROM t1
- WHERE ( f10, f10 ) IN ( SELECT f11, f11 FROM t2 GROUP BY f11 ));
-SET @@optimizer_switch = 'materialization=on,in_to_exists=off,semijoin=off';
-
-EXPLAIN
-SELECT * FROM t1
-WHERE f3 = (
- SELECT t1.f3 FROM t1
- WHERE ( t1.f10 ) IN ( SELECT max(f11) FROM t2 GROUP BY f11 ));
-SELECT * FROM t1
-WHERE f3 = (
- SELECT t1.f3 FROM t1
- WHERE ( t1.f10 ) IN ( SELECT max(f11) FROM t2 GROUP BY f11 ));
-
-EXPLAIN
-SELECT * FROM t1
-WHERE f3 = (
- SELECT f3 FROM t1
- WHERE ( f10, f10 ) IN ( SELECT max(f11), f11 FROM t2 GROUP BY f11 ));
-SELECT * FROM t1
-WHERE f3 = (
- SELECT f3 FROM t1
- WHERE ( f10, f10 ) IN ( SELECT max(f11), f11 FROM t2 GROUP BY f11 ));
-
-SET SESSION optimizer_switch = @old_optimizer_switch;
-drop table t1,t2;
-
---echo #
---echo # LP BUG#715738: Wrong result with implicit grouping and empty result set
---echo #
-
-CREATE TABLE t1 (f1 int, f2 int);
-CREATE TABLE t2 (f3 int, f4 int not null, PRIMARY KEY (f3));
-
-set @save_optimizer_switch=@@optimizer_switch;
-
-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);
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4) FROM t2);
-
-EXPLAIN
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2);
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2);
-
-EXPLAIN
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2);
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2);
-
-EXPLAIN
-SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2) as not_in;
-SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2) as not_in;
-
-EXPLAIN
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2);
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2);
-
-EXPLAIN
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2);
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2);
-
-EXPLAIN
-SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2) as not_in;
-SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2) as not_in;
-
-EXPLAIN
-SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) > 7) as not_in;
-SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) > 7) as not_in;
-
-EXPLAIN
-SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) is null) as not_in;
-SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) is null) as not_in;
-
-EXPLAIN
-SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2) as not_in;
-SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2) as not_in;
-
-EXPLAIN
-SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2) as not_in;
-SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2) as not_in;
-
-EXPLAIN
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2);
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2);
-
-
-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);
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4) FROM t2);
-
-EXPLAIN
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2);
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2);
-
-EXPLAIN
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2);
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2);
-
-EXPLAIN
-SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2) as not_in;
-SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2) as not_in;
-
-EXPLAIN
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2);
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2);
-
-EXPLAIN
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2);
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2);
-
-EXPLAIN
-SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2) as not_in;
-SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2) as not_in;
-
-EXPLAIN
-SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) > 7) as not_in;
-SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) > 7) as not_in;
-
-EXPLAIN
-SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) is null) as not_in;
-SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 HAVING max(f4) is null) as not_in;
-
-EXPLAIN
-SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2) as not_in;
-SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2) as not_in;
-
-EXPLAIN
-SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2) as not_in;
-SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2) as not_in;
-
-EXPLAIN
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2);
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2);
-
-
-INSERT INTO t1 VALUES (1, 2);
-INSERT INTO t1 VALUES (3, 4);
-INSERT INTO t2 VALUES (5, 6);
-INSERT INTO t2 VALUES (7, 8);
-
-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);
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4) FROM t2 WHERE f3 > 10);
-
-EXPLAIN
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2 WHERE f3 > 10);
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2 WHERE f3 > 10);
-
-EXPLAIN
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2 WHERE f3 > 10);
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2 WHERE f3 > 10);
-
-EXPLAIN
-SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2 WHERE f3 > 10) as not_in;
-SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2 WHERE f3 > 10) as not_in;
-
-EXPLAIN
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10);
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10);
-
-EXPLAIN
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2 WHERE f3 > 10);
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2 WHERE f3 > 10);
-
-EXPLAIN
-SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10) as not_in;
-SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10) as not_in;
-
-EXPLAIN
-SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) > 7) as not_in;
-SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) > 7) as not_in;
-
-EXPLAIN
-SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) is null) as not_in;
-SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) is null) as not_in;
-
-EXPLAIN
-SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2 WHERE f3 > 10) as not_in;
-SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2 WHERE f3 > 10) as not_in;
-
-EXPLAIN
-SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2 WHERE f3 > 10) as not_in;
-SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2 WHERE f3 > 10) as not_in;
-
-EXPLAIN
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10);
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10);
-
-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);
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4) FROM t2 WHERE f3 > 10);
-
-EXPLAIN
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2 WHERE f3 > 10);
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3+f4, min(f4) FROM t2 WHERE f3 > 10);
-
-EXPLAIN
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2 WHERE f3 > 10);
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, min(f4)+max(f4) FROM t2 WHERE f3 > 10);
-
-EXPLAIN
-SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2 WHERE f3 > 10) as not_in;
-SELECT (2, 0) NOT IN (SELECT f3, min(f4) FROM t2 WHERE f3 > 10) as not_in;
-
-EXPLAIN
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10);
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10);
-
-EXPLAIN
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2 WHERE f3 > 10);
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT f3, f3 + count(f4) FROM t2 WHERE f3 > 10);
-
-EXPLAIN
-SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10) as not_in;
-SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10) as not_in;
-
-EXPLAIN
-SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) > 7) as not_in;
-SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) > 7) as not_in;
-
-EXPLAIN
-SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) is null) as not_in;
-SELECT (2, 0) NOT IN (SELECT f3, count(f4) FROM t2 WHERE f3 > 10 HAVING max(f4) is null) as not_in;
-
-EXPLAIN
-SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2 WHERE f3 > 10) as not_in;
-SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4) FROM t2 WHERE f3 > 10) as not_in;
-
-EXPLAIN
-SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2 WHERE f3 > 10) as not_in;
-SELECT (2, 0) NOT IN (SELECT max(f3+f3), count(f4)+f3 FROM t2 WHERE f3 > 10) as not_in;
-
-EXPLAIN
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10);
-SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10);
-
-set @@optimizer_switch=@save_optimizer_switch;
-
-drop table t1,t2;
-
---echo #
---echo # LP BUG#613029 Wrong result with materialization and semijoin, and
---echo # valgrind warnings in Protocol::net_store_data with materialization
---echo # for implicit grouping
---echo #
-
-CREATE TABLE t1 (
- pk int(11) NOT NULL AUTO_INCREMENT,
- f2 int(11) NOT NULL,
- f3 varchar(1) NOT NULL,
- PRIMARY KEY (pk),
- KEY f2 (f2));
-
-INSERT INTO t1 VALUES (1,9,'x');
-INSERT INTO t1 VALUES (2,5,'g');
-
-CREATE TABLE t2 (
- pk int(11) NOT NULL AUTO_INCREMENT,
- f2 int(11) NOT NULL,
- f3 varchar(1) NOT NULL,
- PRIMARY KEY (pk),
- KEY f2 (f2));
-
-INSERT INTO t2 VALUES (1,7,'p');
-
-set @save_optimizer_switch=@@optimizer_switch;
-
-set @@optimizer_switch='materialization=off,in_to_exists=on,semijoin=off';
-
-EXPLAIN
-SELECT t1.f3, MAX(t1.f2)
-FROM t1, t2
-WHERE (t2.pk = t1.pk) AND t2.pk IN (SELECT f2 FROM t1);
-
-SELECT t1.f3, MAX(t1.f2)
-FROM t1, t2
-WHERE (t2.pk = t1.pk) AND t2.pk IN (SELECT f2 FROM t1);
-
-set @@optimizer_switch='materialization=on,in_to_exists=off,semijoin=off';
-
-EXPLAIN
-SELECT t1.f3, MAX(t1.f2)
-FROM t1, t2
-WHERE (t2.pk = t1.pk) AND t2.pk IN (SELECT f2 FROM t1);
-
-SELECT t1.f3, MAX(t1.f2)
-FROM t1, t2
-WHERE (t2.pk = t1.pk) AND t2.pk IN (SELECT f2 FROM t1);
-
--- echo TODO: add a test case for semijoin when the wrong result is fixed
--- echo set @@optimizer_switch='materialization=off,semijoin=on';
-
-
-set @@optimizer_switch=@save_optimizer_switch;
-
-drop table t1, t2;
-
-
---echo #
---echo # LP BUG#777691 Wrong result with subqery in select list and subquery cache=off in maria-5.3
---echo #
-
-CREATE TABLE t1 ( f1 varchar(32)) ;
-INSERT INTO t1 VALUES ('b'),('x'),('c'),('x');
-
-CREATE TABLE t2 ( f2 int, f3 varchar(32)) ;
-INSERT INTO t2 VALUES (1,'x');
-
-set @save_optimizer_switch=@@optimizer_switch;
-set @@optimizer_switch='materialization=off,in_to_exists=on,subquery_cache=off';
-
-EXPLAIN
-SELECT t1.f1, ( SELECT MAX( f2 ) FROM t2 WHERE t2.f3 = t1.f1 ) as max_f2 FROM t1;
-SELECT t1.f1, ( SELECT MAX( f2 ) FROM t2 WHERE t2.f3 = t1.f1 ) as max_f2 FROM t1;
-
-set @@optimizer_switch='materialization=on,in_to_exists=off,subquery_cache=off';
-EXPLAIN
-SELECT t1.f1, ( SELECT MAX( f2 ) FROM t2 WHERE t2.f3 = t1.f1 ) as max_f2 FROM t1;
-SELECT t1.f1, ( SELECT MAX( f2 ) FROM t2 WHERE t2.f3 = t1.f1 ) as max_f2 FROM t1;
-
-set @@optimizer_switch='materialization=off,in_to_exists=on,subquery_cache=off';
---echo Even when t2 is not constant table, the result must be the same.
-INSERT INTO t2 VALUES (2,'y');
-EXPLAIN
-SELECT t1.f1, ( SELECT MAX( f2 ) FROM t2 WHERE t2.f3 = t1.f1 ) as max_f2 FROM t1;
-SELECT t1.f1, ( SELECT MAX( f2 ) FROM t2 WHERE t2.f3 = t1.f1 ) as max_f2 FROM t1;
-
-set @@optimizer_switch=@save_optimizer_switch;
-
-drop table t1, t2;
-
---echo #
---echo # LP BUG#641203 Query returns rows where no result is expected (impossible WHERE)
---echo #
-
-CREATE TABLE t1 (c1 varchar(1) DEFAULT NULL);
-CREATE TABLE t2 (c1 varchar(1) DEFAULT NULL);
-INSERT INTO t2 VALUES ('k'), ('d');
-CREATE TABLE t3 (c1 varchar(1) DEFAULT NULL);
-INSERT INTO t3 VALUES ('a'), ('b'), ('c');
-CREATE TABLE t4 (c1 varchar(1) primary key);
-INSERT INTO t4 VALUES ('k'), ('d');
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='outer_join_with_cache=off';
-SET optimizer_switch='semijoin_with_cache=off';
-
-SET optimizer_switch='materialization=off';
-EXPLAIN
-SELECT * FROM t1 RIGHT JOIN t2 ON t1.c1 WHERE 's' IN (SELECT c1 FROM t2);
-SELECT * FROM t1 RIGHT JOIN t2 ON t1.c1 WHERE 's' IN (SELECT c1 FROM t2);
-EXPLAIN
-SELECT * FROM t2 LEFT JOIN t1 ON t1.c1 WHERE 's' IN (SELECT c1 FROM t2);
-SELECT * FROM t2 LEFT JOIN t1 ON t1.c1 WHERE 's' IN (SELECT c1 FROM t2);
-SET optimizer_switch='materialization=on';
-EXPLAIN
-SELECT * FROM (t2 LEFT JOIN t1 ON t1.c1) LEFT JOIN t3 on t3.c1 WHERE 's' IN (SELECT c1 FROM t2);
-SELECT * FROM (t2 LEFT JOIN t1 ON t1.c1) LEFT JOIN t3 on t3.c1 WHERE 's' IN (SELECT c1 FROM t2);
-EXPLAIN
-SELECT * FROM t4 LEFT JOIN t2 ON t4.c1 WHERE 's' IN (SELECT c1 FROM t2);
-SELECT * FROM t4 LEFT JOIN t2 ON t4.c1 WHERE 's' IN (SELECT c1 FROM t2);
-
-SET optimizer_switch=@save_optimizer_switch;
-
-drop table t1, t2, t3, t4;
-
---echo #
---echo # LP BUG#675981 Assertion `cache != __null' failed in sub_select_cache()
---echo # on EXPLAIN
---echo #
-
-CREATE TABLE t1 (f1 int,f2 int) ;
-INSERT IGNORE INTO t1 VALUES ('2','5'),('2',NULL);
-
-CREATE TABLE t2 (f1 int, f5 int) ;
-INSERT IGNORE INTO t2 VALUES (1,0);
-
-CREATE TABLE t3 (f4 int) ;
-INSERT IGNORE INTO t3 VALUES (0),(0);
-
-set @@optimizer_switch='in_to_exists=on,materialization=off,semijoin=off';
-EXPLAIN
-SELECT * FROM t2
-WHERE f1 IN (SELECT t1.f2 FROM t1 JOIN t3 ON t3.f4);
-
-drop table t1, t2, t3;
-
---echo #
---echo # LP BUG#680005 Second assertion `cache != __null' failed in
---echo # sub_select_cache() on EXPLAIN
---echo #
-
-CREATE TABLE t1 (f1 int,f2 int,f4 int,f6 int,KEY (f4)) ;
-INSERT IGNORE INTO t1 VALUES
-('1','5','1','0'),('2','1','1','0'),('2','2','2','0'),('0',NULL,'0','0'),
-('2','1','2','0'),('2','0','0','0'),('2','2','2','0'),('2','8','2','0'),
-('2','7','2','0'),('2','5','2','0'),('2',NULL,'1','0');
-
-CREATE TABLE t2 (f3 int) ;
-INSERT IGNORE INTO t2 VALUES ('7');
-
-CREATE TABLE t3 (f3 int) ;
-INSERT IGNORE INTO t3 VALUES ('2');
-
-EXPLAIN
-SELECT t1.f4
-FROM t2 JOIN t1 ON t1.f6
-WHERE
-( t1.f2 ) IN (SELECT SUBQUERY2_t1.f3
- FROM t3 AS SUBQUERY2_t1
- JOIN
- (t1 AS SUBQUERY2_t2
- JOIN
- t1 AS SUBQUERY2_t3 ON SUBQUERY2_t3.f1)
- ON SUBQUERY2_t3.f2)
-GROUP BY t1.f4 ORDER BY t1.f1 LIMIT 10;
-
-drop table t1, t2, t3;
-
---echo #
---echo # LP BUG#680038 bool close_thread_table(THD*, TABLE**):
---echo # Assertion `table->key_read == 0' failed in EXPLAIN
---echo #
-
-CREATE TABLE t1 (f1 int,f3 int,f4 int) ;
-INSERT IGNORE INTO t1 VALUES (NULL,1,0);
-
-CREATE TABLE t2 (f2 int,f4 int,f5 int) ;
-INSERT IGNORE INTO t2 VALUES (8,0,0),(5,0,0);
-
-CREATE TABLE t3 (f4 int,KEY (f4)) ;
-INSERT IGNORE INTO t3 VALUES (0),(0);
-
-set @@optimizer_switch='semijoin=off';
-
-EXPLAIN
-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 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 #
---echo # BUG#52317: Assertion failing in Field_varstring::store()
---echo # at field.cc:6833
---echo #
-
-CREATE TABLE t1 (i INTEGER);
-INSERT INTO t1 VALUES (1);
-CREATE TABLE t2 (i INTEGER, KEY k(i));
-INSERT INTO t2 VALUES (1), (2);
-
-EXPLAIN
-SELECT i FROM t1 WHERE (1) NOT IN (SELECT i FROM t2);
-
-DROP TABLE t2;
-DROP TABLE t1;
-
---echo #
---echo # LP BUG#680846: Crash in clear_tables() with subqueries
---echo #
-
-CREATE TABLE t1 (f3 int) ;
-INSERT IGNORE INTO t1 VALUES (0),(0);
-
-CREATE TABLE t2 (f1 int,f3 int,f4 varchar(32)) ;
-INSERT IGNORE INTO t2 VALUES (1,0,'f');
-
-EXPLAIN
-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)
-GROUP BY f9;
-
-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)
-GROUP BY f9;
-
-EXPLAIN
-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;
-
-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;
-
-# these queries are like the ones above, but without the ON clause,
-# resulting in a different crash (failed assert)
-EXPLAIN
-SELECT COUNT(t2.f3),
- (SELECT t2.f1 FROM t1 limit 1) AS f9
-FROM t2 JOIN t1
-WHERE ('v') IN (SELECT f4 FROM t2)
-GROUP BY f9;
-
-SELECT COUNT(t2.f3),
- (SELECT t2.f1 FROM t1 limit 1) AS f9
-FROM t2 JOIN t1
-WHERE ('v') IN (SELECT f4 FROM t2)
-GROUP BY f9;
-
-EXPLAIN
-SELECT COUNT(t2.f3),
- (SELECT t2.f1 FROM t1 limit 1) AS f9
-FROM t2 JOIN t1
-WHERE ('v') IN (SELECT f4 FROM t2)
-ORDER BY f9;
-
-SELECT COUNT(t2.f3),
- (SELECT t2.f1 FROM t1 limit 1) AS f9
-FROM t2 JOIN t1
-WHERE ('v') IN (SELECT f4 FROM t2)
-ORDER BY f9;
-
-drop table t1,t2;
-
---echo #
---echo # LP BUG#682683 Crash in create_tmp_table called from
---echo # JOIN::init_execution
---echo #
-
-CREATE TABLE t2 (f1 int) ;
-INSERT INTO t2 VALUES (1),(2);
-
-CREATE TABLE t1 (f1 int) ;
-
-EXPLAIN
-SELECT (SELECT f1 FROM t1) AS field1 FROM t2 GROUP BY field1;
-SELECT (SELECT f1 FROM t1) AS field1 FROM t2 GROUP BY field1;
-EXPLAIN
-SELECT (SELECT f1 FROM t1) AS field1 FROM t2 ORDER BY field1;
-SELECT (SELECT f1 FROM t1) AS field1 FROM t2 ORDER BY field1;
-
-INSERT INTO t1 VALUES (1),(2);
-
-EXPLAIN
-SELECT (SELECT f1 FROM t1) AS field1 FROM t2 GROUP BY field1;
---error ER_SUBQUERY_NO_1_ROW
-SELECT (SELECT f1 FROM t1) AS field1 FROM t2 GROUP BY field1;
-EXPLAIN
-SELECT (SELECT f1 FROM t1) AS field1 FROM t2 ORDER BY field1;
---error ER_SUBQUERY_NO_1_ROW
-SELECT (SELECT f1 FROM t1) AS field1 FROM t2 ORDER BY field1;
-
-drop table t1,t2;
-
---echo #
---echo # LP BUG#680943 Assertion `!table || (!table->read_set ||
---echo # bitmap_is_set(table->read_set, field_index))' failed with subquery
---echo #
-
-CREATE TABLE t1 (f1 int,f3 int) ;
-INSERT IGNORE INTO t1 VALUES ('6','0'),('4','0');
-
-CREATE TABLE t2 (f1 int,f2 int,f3 int) ;
-INSERT IGNORE INTO t2 VALUES ('6','0','0'),('2','0','0');
-
-SELECT f2
-FROM (SELECT * FROM t2) AS alias1
-WHERE (SELECT SQ2_t2.f1
- FROM t1 JOIN t1 AS SQ2_t2 ON SQ2_t2.f3
- WHERE SQ2_t2.f3 AND alias1.f1)
-ORDER BY f3 ;
-
-drop table t1,t2;
-
---echo #
---echo # LP BUG#715062: Wrong result with VIEW + UNION + subquery in maria-5.3-mwl89
---echo #
-
-create table t1 (f1 int);
-create table t2 (f2 int);
-create table t3 (f3 int);
-insert into t1 values (2);
-insert into t2 values (2);
-insert into t3 values (7);
-
-CREATE VIEW v1 AS SELECT 2 UNION SELECT 2 ;
-CREATE VIEW v2 AS SELECT * from t1 UNION SELECT * from t2 ;
-
-set @save_optimizer_switch=@@optimizer_switch;
-SET @@optimizer_switch = 'in_to_exists=off,semijoin=off,materialization=on';
-
-EXPLAIN
-SELECT 'bug' FROM DUAL WHERE ( 5 ) IN ( SELECT * FROM v1 );
-SELECT 'bug' FROM DUAL WHERE ( 5 ) IN ( SELECT * FROM v1 );
-
-EXPLAIN
-SELECT ( 5 ) IN ( SELECT * FROM v1 );
-SELECT ( 5 ) IN ( SELECT * FROM v1 );
-
-EXPLAIN
-SELECT 'bug' FROM DUAL WHERE ( 5 ) IN (SELECT * FROM v2);
-SELECT 'bug' FROM DUAL WHERE ( 5 ) IN (SELECT * FROM v2);
-
-EXPLAIN
-SELECT 'bug' FROM t3 WHERE ( 5 ) IN (SELECT * FROM v2);
-SELECT 'bug' FROM t3 WHERE ( 5 ) IN (SELECT * FROM v2);
-
-EXPLAIN
-SELECT ( 5 ) IN ( SELECT * FROM v2 );
-SELECT ( 5 ) IN ( SELECT * FROM v2 );
-
-SET @@optimizer_switch = 'in_to_exists=on,semijoin=off,materialization=off';
-
-EXPLAIN
-SELECT 'bug' FROM DUAL WHERE ( 5 ) IN ( SELECT * FROM v1 );
-SELECT 'bug' FROM DUAL WHERE ( 5 ) IN ( SELECT * FROM v1 );
-
-EXPLAIN
-SELECT ( 5 ) IN ( SELECT * FROM v1 );
-SELECT ( 5 ) IN ( SELECT * FROM v1 );
-
-EXPLAIN
-SELECT 'bug' FROM DUAL WHERE ( 5 ) IN (SELECT * FROM v2);
-SELECT 'bug' FROM DUAL WHERE ( 5 ) IN (SELECT * FROM v2);
-
-EXPLAIN
-SELECT 'bug' FROM t3 WHERE ( 5 ) IN (SELECT * FROM v2);
-SELECT 'bug' FROM t3 WHERE ( 5 ) IN (SELECT * FROM v2);
-
-EXPLAIN
-SELECT ( 5 ) IN ( SELECT * FROM v2 );
-SELECT ( 5 ) IN ( SELECT * FROM v2 );
-
-set @@optimizer_switch=@save_optimizer_switch;
-
-drop table t1,t2,t3;
-drop view v1,v2;
-
---echo #
---echo # LP BUG#715069 Wrong result with GROUP BY inside subquery and materialization=off
---echo #
-
-CREATE TABLE t0 ( f1 int(11), f2 int(11), f10 varchar(1), PRIMARY KEY (f1)) ;
-INSERT INTO t0 VALUES (8,8,'u'),(10,5,'o');
-
-CREATE TABLE t1 (f1a int, f2a int not null, f3a varchar(3) not null, PRIMARY KEY (f1a)) ;
-INSERT INTO t1 VALUES
-(8,8,'a1a'),
-(10,5,'b1b');
-
-CREATE TABLE t2 (f1b int, f2b int not null, f3b varchar(3) not null, PRIMARY KEY (f1b)) ;
-INSERT INTO t2 VALUES
-(10,5,'d1d');
-
-set @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='outer_join_with_cache=off';
-
-set @@optimizer_switch = 'in_to_exists=on,materialization=off,semijoin=off';
-
-EXPLAIN
-SELECT alias2.f1 , alias2.f2
-FROM t0 AS alias1
-RIGHT JOIN t0 AS alias2 ON alias2.f10
-WHERE ( alias2.f1 , alias2.f2 ) IN ( SELECT max(f2) , f1 FROM t0 GROUP BY f2 , f1 );
-
-SELECT alias2.f1 , alias2.f2
-FROM t0 AS alias1
-RIGHT JOIN t0 AS alias2 ON alias2.f10
-WHERE ( alias2.f1 , alias2.f2 ) IN ( SELECT max(f2) , f1 FROM t0 GROUP BY f2 , f1 );
-
-EXPLAIN
-SELECT * FROM t2 WHERE (f1b, f2b) IN (SELECT max(f1a), f2a FROM t1 GROUP BY f1a, f2a);
-SELECT * FROM t2 WHERE (f1b, f2b) IN (SELECT max(f1a), f2a FROM t1 GROUP BY f1a, f2a);
-
-EXPLAIN
-SELECT * FROM t2 WHERE (f1b) IN (SELECT max(f1a) FROM t1 GROUP BY f1a, f2a);
-SELECT * FROM t2 WHERE (f1b) IN (SELECT max(f1a) FROM t1 GROUP BY f1a, f2a);
-
-set @@optimizer_switch = 'in_to_exists=off,materialization=on,semijoin=off';
-
-EXPLAIN
-SELECT alias2.f1 , alias2.f2
-FROM t0 AS alias1
-RIGHT JOIN t0 AS alias2 ON alias2.f10
-WHERE ( alias2.f1 , alias2.f2 ) IN ( SELECT max(f2) , f1 FROM t0 GROUP BY f2 , f1 );
-
-SELECT alias2.f1 , alias2.f2
-FROM t0 AS alias1
-RIGHT JOIN t0 AS alias2 ON alias2.f10
-WHERE ( alias2.f1 , alias2.f2 ) IN ( SELECT max(f2) , f1 FROM t0 GROUP BY f2 , f1 );
-
-EXPLAIN
-SELECT * FROM t2 WHERE (f1b, f2b) IN (SELECT max(f1a), f2a FROM t1 GROUP BY f1a, f2a);
-SELECT * FROM t2 WHERE (f1b, f2b) IN (SELECT max(f1a), f2a FROM t1 GROUP BY f1a, f2a);
-
-EXPLAIN
-SELECT * FROM t2 WHERE (f1b) IN (SELECT max(f1a) FROM t1 GROUP BY f1a, f2a);
-SELECT * FROM t2 WHERE (f1b) IN (SELECT max(f1a) FROM t1 GROUP BY f1a, f2a);
-
-set @@optimizer_switch=@save_optimizer_switch;
-
-drop table t0,t1,t2;
-
-
---echo #
---echo # LP BUG#715759 Wrong result with in_to_exists=on in maria-5.3-mwl89
---echo #
-
-set @save_optimizer_switch=@@optimizer_switch;
-CREATE TABLE t1 (a1 int, a2 int) ;
-INSERT INTO t1 VALUES (1, 2);
-INSERT INTO t1 VALUES (3, 4);
-
-CREATE TABLE t2 (b1 int, b2 int) ;
-INSERT INTO t2 VALUES (1, 2);
-
-SET @@optimizer_switch = 'in_to_exists=on,materialization=off,semijoin=off';
-
-EXPLAIN SELECT * FROM t1 WHERE a1 IN (SELECT b1 FROM t2 WHERE b1 = b2);
-SELECT * FROM t1 WHERE a1 IN (SELECT b1 FROM t2 WHERE b1 = b2);
-
-set @@optimizer_switch=@save_optimizer_switch;
-drop table t1, t2;
-
---echo #
---echo # LP BUG#772309 join_tab_cmp_straight(): Assertion `!jt2->emb_sj_nest' failed in maria-5.3-mwl89 with semijoin
---echo #
-
-CREATE TABLE t1 ( f2 int) ;
-INSERT INTO t1 VALUES (0),(0);
-
-CREATE TABLE t2 ( f1 int NOT NULL ) ;
-INSERT INTO t2 VALUES (0),(0);
-
-CREATE TABLE t3 ( f1 int NOT NULL , f2 int) ;
-INSERT INTO t3 VALUES (0,0), (0,0);
-
-EXPLAIN SELECT STRAIGHT_JOIN (
- SELECT f2 FROM t1 WHERE ( f2 ) IN ( SELECT t3.f2 FROM t3 JOIN t2 ON t2.f1 = 1 )
-);
-SELECT STRAIGHT_JOIN (
- SELECT f2 FROM t1 WHERE ( f2 ) IN ( SELECT t3.f2 FROM t3 JOIN t2 ON t2.f1 = 1 )
-);
-
-drop table t1, t2, t3;
-
-
---echo #
---echo # LP BUG#777597 Wrong result with multipart keys, in_to_exists=on, NOT IN in MWL#89
---echo #
-
-CREATE TABLE t1 ( f4 int);
-INSERT IGNORE INTO t1 VALUES (2),(2);
-
-CREATE TABLE t2 ( f3 int, f10 int, KEY (f10,f3) );
-INSERT IGNORE INTO t2 VALUES (6, 1), (6, 1);
-
-CREATE TABLE t3 ( f10 int );
-INSERT IGNORE INTO t3 VALUES (1);
-
-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);
-SELECT * FROM t1 WHERE ( 6 ) NOT IN ( SELECT t2.f3 FROM t2 JOIN t3 ON t3.f10 = t2.f10);
-
-drop table t1,t2,t3;
-
-
---echo #
---echo # LP BUG#778413 Third crash in select_describe() in maria-5.3-mwl89
---echo #
-
-CREATE TABLE t1 ( f11 int) ;
-INSERT INTO t1 VALUES (1),(1);
-
-CREATE TABLE t2 ( f1 int NOT NULL) ;
-INSERT INTO t2 VALUES (20);
-
-CREATE TABLE t3 (f3 int) ;
-INSERT INTO t3 VALUES (2),(2);
-
-EXPLAIN SELECT * FROM t2
-WHERE t2.f1 = (
- SELECT MAX( f3 ) FROM t3
- WHERE EXISTS (
- SELECT DISTINCT f11
- FROM t1));
-
-drop table t1, t2, t3;
-
---echo #
---echo # LP BUG#802979 Assertion `table->key_read == 0' in close_thread_table
---echo #
-
-CREATE TABLE t1 ( f1 int, f2 int , KEY (f1)) ;
-INSERT IGNORE INTO t1 VALUES (1,0),(5,0);
-CREATE TABLE t2 ( f1 int, f2 int , KEY (f1)) ;
-INSERT IGNORE INTO t2 VALUES (1,0),(5,0);
-CREATE TABLE t3 ( f1 int, f2 int , KEY (f1)) ;
-INSERT IGNORE INTO t3 VALUES (1,0),(5,0);
-CREATE TABLE t4 ( f1 int, f2 int , KEY (f1)) ;
-INSERT IGNORE INTO t4 VALUES (1,0),(5,0);
-
-EXPLAIN
-SELECT *
-FROM t1, t2
-WHERE t2.f2 = (SELECT f2 FROM t3
- WHERE EXISTS (SELECT DISTINCT f1 FROM t4))
- AND t2.f2 = t1.f1;
-
--- error ER_SUBQUERY_NO_1_ROW
-SELECT *
-FROM t1, t2
-WHERE t2.f2 = (SELECT f2 FROM t3
- WHERE EXISTS (SELECT DISTINCT f1 FROM t4))
- AND t2.f2 = t1.f1;
-
-EXPLAIN
-SELECT *
-FROM t1, t2
-WHERE t2.f2 = (SELECT f2 FROM t3
- WHERE EXISTS (SELECT DISTINCT f1 FROM t4) LIMIT 1)
- AND t2.f2 = t1.f1;
-
-SELECT *
-FROM t1, t2
-WHERE t2.f2 = (SELECT f2 FROM t3
- WHERE EXISTS (SELECT DISTINCT f1 FROM t4) LIMIT 1)
- AND t2.f2 = t1.f1;
-
-drop table t1,t2,t3,t4;
-
---echo #
---echo # LP BUG#611690 Crash in select_describe() with nested subqueries
---echo #
-
-CREATE TABLE t1 (
- col_int_key int(11) DEFAULT NULL,
- col_varchar_key varchar(1) DEFAULT NULL,
- col_varchar_nokey varchar(1) DEFAULT NULL,
- KEY col_int_key (col_int_key),
- KEY col_varchar_key (col_varchar_key,col_int_key)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-INSERT INTO t1 VALUES (8,'v','v');
-INSERT INTO t1 VALUES (9,'r','r');
-
-CREATE TABLE t2 (
- col_int_key int(11) DEFAULT NULL,
- col_varchar_key varchar(1) DEFAULT NULL,
- col_varchar_nokey varchar(1) DEFAULT NULL,
- KEY col_int_key (col_int_key),
- KEY col_varchar_key (col_varchar_key,col_int_key)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-INSERT INTO t2 VALUES (2,'w','w');
-INSERT INTO t2 VALUES (9,'m','m');
-
-set @old_optimizer_switch = @@optimizer_switch;
-
-set @@optimizer_switch='subquery_cache=off,materialization=on,in_to_exists=off,semijoin=off';
-EXPLAIN
-SELECT col_int_key
-FROM t2
-WHERE (SELECT SUBQUERY2_t1.col_int_key
- FROM t1 SUBQUERY2_t1 STRAIGHT_JOIN t1 SUBQUERY2_t2
- ON SUBQUERY2_t2.col_varchar_key
- WHERE SUBQUERY2_t2.col_varchar_nokey IN
- (SELECT col_varchar_nokey FROM t1 GROUP BY col_varchar_nokey));
-SELECT col_int_key
-FROM t2
-WHERE (SELECT SUBQUERY2_t1.col_int_key
- FROM t1 SUBQUERY2_t1 STRAIGHT_JOIN t1 SUBQUERY2_t2
- ON SUBQUERY2_t2.col_varchar_key
- WHERE SUBQUERY2_t2.col_varchar_nokey IN
- (SELECT col_varchar_nokey FROM t1 GROUP BY col_varchar_nokey));
-
-set @@optimizer_switch='subquery_cache=off,materialization=off,in_to_exists=on,semijoin=off';
-EXPLAIN
-SELECT col_int_key
-FROM t2
-WHERE (SELECT SUBQUERY2_t1.col_int_key
- FROM t1 SUBQUERY2_t1 STRAIGHT_JOIN t1 SUBQUERY2_t2
- ON SUBQUERY2_t2.col_varchar_key
- WHERE SUBQUERY2_t2.col_varchar_nokey IN
- (SELECT col_varchar_nokey FROM t1 GROUP BY col_varchar_nokey));
-SELECT col_int_key
-FROM t2
-WHERE (SELECT SUBQUERY2_t1.col_int_key
- FROM t1 SUBQUERY2_t1 STRAIGHT_JOIN t1 SUBQUERY2_t2
- ON SUBQUERY2_t2.col_varchar_key
- WHERE SUBQUERY2_t2.col_varchar_nokey IN
- (SELECT col_varchar_nokey FROM t1 GROUP BY col_varchar_nokey));
-
-drop table t1, t2;
-
-set @@optimizer_switch = @old_optimizer_switch;
-
-
---echo #
---echo # LP BUG#612543 Crash in Item_field::used_tables() with view + subquery + prepared statements
---echo #
-
-CREATE TABLE t1 ( f1 int(11), f2 varchar(1));
-CREATE TABLE t2 ( f3 varchar(1));
-insert into t1 values (2,'x'), (5,'y');
-insert into t2 values ('x'), ('z');
-CREATE VIEW v2 AS SELECT * FROM t2;
-
-set @old_optimizer_switch = @@optimizer_switch;
-
-set @@optimizer_switch='materialization=on,in_to_exists=off,semijoin=off,subquery_cache=off';
-EXPLAIN SELECT * FROM t1 JOIN v2 ON t1.f2 > 'a' WHERE v2.f3 IN ( SELECT f2 FROM t1 );
-PREPARE st1 FROM "SELECT * FROM t1 JOIN v2 ON t1.f2 > 'a' WHERE v2.f3 IN ( SELECT f2 FROM t1 )";
-EXECUTE st1;
-EXECUTE st1;
-
-set @@optimizer_switch='materialization=off,in_to_exists=on,semijoin=off,subquery_cache=off';
-EXPLAIN SELECT * FROM t1 JOIN v2 ON t1.f2 > 'a' WHERE v2.f3 IN ( SELECT f2 FROM t1 );
-PREPARE st2 FROM "SELECT * FROM t1 JOIN v2 ON t1.f2 > 'a' WHERE v2.f3 IN ( SELECT f2 FROM t1 )";
-EXECUTE st2;
-EXECUTE st2;
-
-set @@optimizer_switch='materialization=on,in_to_exists=on,semijoin=off,subquery_cache=off';
-EXPLAIN SELECT * FROM t1 JOIN v2 ON t1.f2 > 'a' WHERE v2.f3 IN ( SELECT f2 FROM t1 );
-PREPARE st3 FROM "SELECT * FROM t1 JOIN v2 ON t1.f2 > 'a' WHERE v2.f3 IN ( SELECT f2 FROM t1 )";
-EXECUTE st3;
-EXECUTE st3;
-
-set @@optimizer_switch = @old_optimizer_switch;
-
-drop table t1, t2;
-drop view v2;
-
-
---echo #
---echo # LP BUG#611396 RQG: crash in Item_field::register_field_in_read_map with semijoin=off
---echo # and prepared statements and materialization
-
-CREATE TABLE t1 ( f1 int(11), f2 int(11)) ;
-CREATE TABLE t2 ( f1 int(11), f4 varchar(1), PRIMARY KEY (f1)) ;
-INSERT INTO t2 VALUES ('23','j'),('24','e');
-CREATE TABLE t3 ( f1 int(11), f4 varchar(1)) ;
-INSERT INTO t3 VALUES ('8','j');
-
-set @old_optimizer_switch = @@optimizer_switch;
-set @@optimizer_switch='materialization=on,in_to_exists=off,semijoin=off';
-
-EXPLAIN
-SELECT t2.f1, (SELECT f2 FROM t1 WHERE (7) IN (SELECT f1 FROM t1))
-FROM t2 JOIN t3 ON t3.f4 = t2.f4
-WHERE t3.f1 = 8
-GROUP BY 1, 2;
-
-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
-WHERE t3.f1 = 8
-GROUP BY 1, 2";
-
-EXECUTE st1;
-EXECUTE st1;
-
-set @@optimizer_switch = @old_optimizer_switch;
-
-drop table t1, t2, t3;
-
-
---echo #
---echo # LP BUG#611382 RQG: Query returns extra rows when executed with materialization=on
---echo #
-
-CREATE TABLE t1 ( f4 varchar(1)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (NULL);
-CREATE TABLE t2 ( f2 date, f3 varchar(1), f4 varchar(1)) ;
-INSERT INTO t2 VALUES ('2005-05-03','c','c'),('1900-01-01','d','d');
-CREATE TABLE t3 ( f3 varchar(1)) ;
-INSERT INTO t3 VALUES ('c');
-
-set @old_optimizer_switch = @@optimizer_switch;
-
-set @@optimizer_switch = 'materialization=on,in_to_exists=off,semijoin=off';
-
-EXPLAIN SELECT t1.f4
-FROM t1 JOIN ( t2 JOIN t3 ON t3.f3 = t2.f4 ) ON t3.f3 = t2.f3
-WHERE t1.f4 IN ( SELECT f4 FROM t2 ) ;
-
-SELECT t1.f4
-FROM t1 JOIN ( t2 JOIN t3 ON t3.f3 = t2.f4 ) ON t3.f3 = t2.f3
-WHERE t1.f4 IN ( SELECT f4 FROM t2 ) ;
-
-set @@optimizer_switch = 'materialization=off,in_to_exists=on,semijoin=off';
-
-EXPLAIN SELECT t1.f4
-FROM t1 JOIN ( t2 JOIN t3 ON t3.f3 = t2.f4 ) ON t3.f3 = t2.f3
-WHERE t1.f4 IN ( SELECT f4 FROM t2 ) ;
-
-SELECT t1.f4
-FROM t1 JOIN ( t2 JOIN t3 ON t3.f3 = t2.f4 ) ON t3.f3 = t2.f3
-WHERE t1.f4 IN ( SELECT f4 FROM t2 ) ;
-
-set @@optimizer_switch = @old_optimizer_switch;
-
-drop table t1, t2, t3;
-
-
---echo #
---echo # LP BUG#782305: Wrong result/valgrind warning in Item_sum_hybrid::any_value()
---echo #
-
-CREATE TABLE t1 ( f1 int) ;
-INSERT INTO t1 VALUES (2),(3);
-CREATE TABLE t2 (f2 int) ;
-INSERT INTO t2 VALUES (2),(3);
-
-PREPARE st1 FROM '
-SELECT * FROM t2
-WHERE f2 <= SOME ( SELECT f1 FROM t1 );
-';
-EXECUTE st1;
-EXECUTE st1;
-
-PREPARE st2 FROM '
-SELECT * FROM t2
-WHERE f2 <= SOME (SELECT f1-2 FROM t1 UNION SELECT f1-1 FROM t1);
-';
-EXECUTE st2;
-EXECUTE st2;
-
-drop table t1, t2;
-
---echo #
---echo # LP BUG#825018: Crash in check_and_do_in_subquery_rewrites() with corrlated subquery in select list
---echo #
-
-CREATE TABLE t1 (a int, b int);
-INSERT INTO t1 VALUES (10,1),(11,7);
-
-CREATE TABLE t2 (a int);
-INSERT INTO t2 VALUES (2),(3);
-
-CREATE TABLE t3 (a int, b int);
-INSERT INTO t3 VALUES (1,1);
-
-CREATE PROCEDURE sp1 () LANGUAGE SQL
-SELECT (SELECT t1.a
- FROM t1
- WHERE t1.b = t3.b
- AND t1.b IN ( SELECT a FROM t2 )) sq
-FROM t3
-GROUP BY 1;
-CALL sp1();
-CALL sp1();
-drop procedure sp1;
-
-prepare st1 from "
-SELECT (SELECT t1.a
- FROM t1
- WHERE t1.b = t3.b
- AND t1.b IN ( SELECT a FROM t2 )) sq
-FROM t3
-GROUP BY 1";
-execute st1;
-execute st1;
-deallocate prepare st1;
-
-drop table t1, t2, t3;
-
-set optimizer_switch=@subselect4_tmp;
-
---echo #
---echo # LP BUG#833702 Wrong result with nested IN and singlerow subqueries and equality propagation
---echo #
-
-CREATE TABLE t2 (c int , a int, b int);
-INSERT INTO t2 VALUES (10,7,0);
-
-CREATE TABLE t3 (a int, b int) ;
-INSERT INTO t3 VALUES (5,0),(7,0);
-
-CREATE TABLE t4 (a int);
-INSERT INTO t4 VALUES (2),(8);
-
-set @@optimizer_switch='semijoin=off,in_to_exists=on,materialization=off,subquery_cache=off';
-
-SELECT * FROM t2
-WHERE t2.b IN (SELECT b FROM t3 WHERE t3.a = t2.a AND a < SOME (SELECT * FROM t4))
- OR ( t2.c > 242 );
-
-EXPLAIN SELECT * FROM t2
-WHERE t2.b IN (SELECT t3.b FROM t3 WHERE t3.a < ANY (SELECT t4.a FROM t4) and t3.a = 7);
-SELECT * FROM t2
-WHERE t2.b IN (SELECT t3.b FROM t3 WHERE t3.a < ANY (SELECT t4.a FROM t4) and t3.a = 7);
-
-drop table t2, t3, t4;
-
---echo #
---echo # BUG#934597: Assertion `! is_set()' failed in Diagnostics_area::set_ok_status(THD...
---echo #
-CREATE TABLE t1 ( a VARCHAR(1) );
-INSERT INTO t1 VALUES ('u'),('k');
---error ER_SUBQUERY_NO_1_ROW
-CREATE TABLE t2 AS
- SELECT a AS field1 FROM t1
- WHERE ( SELECT alias1.a
- FROM t1 AS alias1
- ) IS NOT NULL;
---error ER_BAD_TABLE_ERROR
-DROP TABLE t2;
-DROP TABLE t1;
-
---echo #
---echo # LP BUG#1000649 EXPLAIN shows incorrectly a non-correlated constant IN subquery is correlated
---echo #
-
-create table ten (a int);
-insert into ten values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t1 (a int, b int, c int);
-insert into t1 select a,a,a from ten;
-create table five (a int, b int, c int);
-insert into five select a,a,a from ten limit 5;
-
-set @@optimizer_switch='semijoin=on,in_to_exists=on,materialization=off';
-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;
-
---echo #
---echo # MDEV-3928 Assertion `example' failed in Item_cache::is_expensive_processor with a 2-level IN subquery
---echo #
-
-CREATE TABLE t1 (a1 INT, b1 TIME) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (4,'21:22:34'),(6,'10:50:38');
-
-CREATE TABLE t2 (a2 INT, b2 TIME) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (8, '06:17:39');
-
-CREATE TABLE t3 (a3 INT, b3 TIME) ENGINE=MyISAM;
-INSERT INTO t3 VALUES (1,'00:00:01'),(7,'00:00:02');
-
-EXPLAIN
-SELECT * FROM t1 WHERE a1 IN (
- SELECT a2 FROM t2 WHERE a2 IN (
- SELECT a3 FROM t3 WHERE b2 = b1 AND b2 <= b1 ORDER BY b3
- )
-);
-
-SELECT * FROM t1 WHERE a1 IN (
- SELECT a2 FROM t2 WHERE a2 IN (
- SELECT a3 FROM t3 WHERE b2 = b1 AND b2 <= b1 ORDER BY b3
- )
-);
-drop table t1, t2, t3;
-
---echo #
---echo # MDEV-4056:Server crashes in Item_func_trig_cond::val_int
---echo # with FROM and NOT IN subqueries, LEFT JOIN, derived_merge+in_to_exists
---echo #
-
-set @optimizer_switch_MDEV4056 = @@optimizer_switch;
-SET optimizer_switch = 'derived_merge=on,in_to_exists=on';
-
-CREATE TABLE t1 (a VARCHAR(1)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('x'),('d');
-
-CREATE TABLE t2 (pk INT PRIMARY KEY, b INT, c VARCHAR(1)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (1,2,'v'),(2,150,'v');
-
-SELECT * FROM t1 LEFT JOIN (
- SELECT * FROM t2 WHERE ( pk, pk ) NOT IN (
- SELECT MIN(b), SUM(pk) FROM t1
- )
-) AS alias1 ON (a = c)
-WHERE b IS NULL OR a < 'u';
-
-drop table t1,t2;
-set @@optimizer_switch = @optimizer_switch_MDEV4056;
-
---echo #
---echo # MDEV-5103: server crashed on singular Item_equal
---echo #
-
-CREATE TABLE t1 (
- a enum('p','r') NOT NULL DEFAULT 'r',
- b int NOT NULL DEFAULT '0',
- c char(32) NOT NULL,
- d varchar(255) NOT NULL,
- PRIMARY KEY (a, b), UNIQUE KEY idx(a, c)
-);
-INSERT INTO t1 VALUES ('r', 1, 'ad18832202b199728921807033a8a515', '001_cbr643');
-
-CREATE TABLE t2 (
- a enum('p','r') NOT NULL DEFAULT 'r',
- b int NOT NULL DEFAULT '0',
- e datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- PRIMARY KEY (a, b, e)
-);
-INSERT INTO t2 VALUES ('r', 1, '2013-10-05 14:25:30');
-
-SELECT * FROM t1 AS t
- WHERE a='r' AND (c,b) NOT IN (SELECT c,b FROM t2 WHERE (c,b)=(t.c,t.b));
-
-DROP TABLE t1, t2;
-
---echo #
---echo # MDEV-5468: assertion failure with a simplified condition in subselect
---echo #
-
-CREATE TABLE t1 (a int, b int) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,1);
-
-CREATE TABLE t2 ( pk int PRIMARY KEY, c INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (1,4), (2,6);
-
-SELECT ( SELECT MAX(b) FROM t1, t2 WHERE pk = a AND b < from_sq.c ) AS select_sq,
- COUNT( DISTINCT from_sq.c )
-FROM ( SELECT DISTINCT t2_1.* FROM t2 AS t2_1, t2 AS t2_2 ) AS from_sq
-GROUP BY select_sq ;
-
-DROP TABLE t1,t2;
-
-
-CREATE TABLE t1 (id int, a2 char(2), a3 char(3)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,'BE','BEL');
-
-CREATE TABLE t2 (id int, a2 char(2), a3 char(3)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (1,'BE','BEL'), (2,'MX','MEX');
-CREATE VIEW v2 AS SELECT DISTINCT * FROM t2;
-
-SELECT * FROM t1 AS outer_t1, v2
-WHERE v2.a3 = outer_t1.a3
- AND EXISTS ( SELECT * FROM t1 WHERE a2 < v2.a2 AND id = outer_t1.id )
- AND outer_t1.a3 < 'J'
-ORDER BY v2.id;
-
-DROP VIEW v2;
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-5686: degenerate disjunct in NOT IN subquery
---echo #
-
-CREATE TABLE t1 (a int, b int, c varchar(3)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,1,'CAN'),(2,2,'AUS');
-
-CREATE TABLE t2 (f int) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (3);
-
-EXPLAIN EXTENDED
-SELECT * FROM t2
- WHERE f NOT IN (SELECT b FROM t1
- WHERE 0 OR (c IN ('USA') OR c NOT IN ('USA')) AND a = b);
-
-SELECT * FROM t2
- WHERE f NOT IN (SELECT b FROM t1
- WHERE 0 OR (c IN ('USA') OR c NOT IN ('USA')) AND a = b);
-
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-3899 Valgrind warnings (blocks are definitely lost) in filesort on IN subquery with SUM and DISTINCT
---echo #
-
-CREATE TABLE t1 (a INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(9);
-
-CREATE TABLE t2 (b INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (8);
-
-SELECT * FROM t1
-WHERE (1, 1) IN (SELECT a, SUM(DISTINCT a) FROM t1, t2 GROUP BY a);
-
-drop table t1, t2;
-
---echo #
---echo # MDEV-3902 Assertion `record_length == m_record_length' failed at Filesort_buffer::alloc_sort_buffer
---echo #
-
-CREATE TABLE t1 (a INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE TABLE t2 (pk INT PRIMARY KEY, b INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (1,1),(2,7);
-
-CREATE TABLE t3 (c INT) ENGINE=MyISAM;
-INSERT INTO t3 VALUES (8);
-
-SELECT * FROM t1
-WHERE (1, 5) IN (SELECT b, SUM(DISTINCT b) FROM t2, t3 GROUP BY b);
-
-SELECT * FROM t2 AS alias1, t2 AS alias2
-WHERE EXISTS ( SELECT 1 ) AND (alias2.pk = alias1.b )
-ORDER BY alias1.b;
-
-drop table t1, t2, t3;
-
---echo #
---echo # MDEV-4144 simple subquery causes full scan instead of range scan
---echo #
-
-CREATE TABLE t1 (id int not null auto_increment, x int not null, primary key(id));
-INSERT INTO t1 (x) VALUES (0),(0),(0);
-
-EXPLAIN
-SELECT x FROM t1 WHERE id > (SELECT MAX(id) - 1000 FROM t1) ORDER BY x LIMIT 1;
-SELECT x FROM t1 WHERE id > (SELECT MAX(id) - 1000 FROM t1) ORDER BY x LIMIT 1;
-
-drop table t1;
-
---echo #
---echo # MDEV-7691: Assertion `outer_context || !*from_field || *from_field == not_found_field' ...
---echo #
-set optimizer_switch=default;
-CREATE TABLE t1 (a INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (4),(6);
-
-CREATE TABLE t2 (b INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (1),(8);
-
-PREPARE stmt FROM "
-SELECT * FROM t2
-HAVING 0 IN (
- SELECT a FROM t1
- WHERE a IN (
- SELECT a FROM t1
- WHERE b = a
- )
-)
-";
-
-EXECUTE stmt;
-EXECUTE stmt;
-
---echo # Alternative test case, without HAVING
-CREATE TABLE t3 (i INT) ENGINE=MyISAM;
-INSERT INTO t3 VALUES (4),(6);
-
-PREPARE stmt FROM "
-SELECT * FROM t3 AS t10
-WHERE EXISTS (
- SELECT * FROM t3 AS t20 WHERE t10.i IN (
- SELECT i FROM t3
- )
-)";
-
-EXECUTE stmt;
-EXECUTE stmt;
-
-drop table t1, t2, t3;
-
---echo #
---echo # MDEV-11078: NULL NOT IN (non-empty subquery) should never return results
---echo #
-
-create table t1(a int,b int);
-create table t2(a int,b int);
-insert into t1 value (1,2);
-select (NULL) in (select 1 from t1);
-select (null) in (select 1 from t2);
-select 1 in (select 1 from t1);
-select 1 in (select 1 from t2);
-select 1 from dual where null in (select 1 from t1);
-select 1 from dual where null in (select 1 from t2);
-select (null,null) in (select * from t1);
-select (null,null) in (select * from t2);
-select 1 from dual where null not in (select 1 from t1);
-select 1 from dual where null not in (select 1 from t2);
-drop table t1,t2;
-
-
---echo #
---echo # MDEV-6486: Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))'
---echo # failed with SELECT SQ, TEXT field
---echo #
-
-CREATE TABLE t1 (a VARCHAR(8), KEY(a)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('foo'),( 'bar');
-
-CREATE TABLE t2 (b VARCHAR(8), c TINYTEXT, KEY(b)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES ('baz','baz'),('qux', 'qux');
-
-SELECT ( SELECT COUNT(*) FROM t1 WHERE a = c ) AS field, COUNT(DISTINCT c)
-FROM t2 WHERE b <= 'quux' GROUP BY field;
-drop table t1,t2;
-
---echo #
---echo # MDEV-15555: select from DUAL where false yielding wrong result when in a IN
---echo #
-
-explain
-SELECT 2 IN (SELECT 2 from DUAL WHERE 1 != 1);
-SELECT 2 IN (SELECT 2 from DUAL WHERE 1 != 1);
-
-SET optimizer_switch= @@global.optimizer_switch;
-set @@tmp_table_size= @@global.tmp_table_size;
-
---echo #
---echo # MDEV-10232 Scalar result of subquery changes after adding an outer select stmt
---echo #
-
-create table t1(c1 int, c2 int, primary key(c2));
-insert into t1 values(2,1),(1,2);
-select (select c1 from t1 group by c1,c2 order by c1 limit 1) as x;
-(select c1 from t1 group by c1,c2 order by c1 limit 1);
-drop table t1;
diff --git a/mysql-test/t/subselect_cache.test b/mysql-test/t/subselect_cache.test
deleted file mode 100644
index 55da0000f13..00000000000
--- a/mysql-test/t/subselect_cache.test
+++ /dev/null
@@ -1,1718 +0,0 @@
---disable_warnings
-drop table if exists t0,t1,t2,t3,t4,t5,t6,t7,t8,t9;
-drop view if exists v1;
---enable_warnings
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='outer_join_with_cache=off';
-SET optimizer_switch='semijoin_with_cache=off';
-
-set optimizer_switch='subquery_cache=on';
-
-create table t1 (a int, b int);
-insert into t1 values (1,2),(3,4),(1,2),(3,4),(3,4),(4,5),(4,5),(5,6),(5,6),(4,5);
-create table t2 (c int, d int);
-insert into t2 values (2,3),(3,4),(5,6),(4,1);
-
---echo *
---echo * Test subquery as top item in different clauses
---echo *
---echo #single value subquery test (SELECT list)
-flush status;
-select a, (select d from t2 where b=c) from t1;
-
-show status like "subquery_cache%";
-show status like '%Handler_read%';
-
---source include/analyze-format.inc
-analyze format=json
-select a, (select d from t2 where b=c) from t1;
---source include/analyze-format.inc
-analyze format=json
-select a, (select d from t2 where b=c), (select d from t2 where b=c union select 1 order by 1 limit 1) from t1;
-explain format=json
-select a, (select d from t2 where b=c) from t1;
-explain format=json
-select a, (select d from t2 where b=c), (select d from t2 where b=c union select 1 order by 1 limit 1) from t1;
-set optimizer_switch='subquery_cache=off';
-flush status;
-
-select a, (select d from t2 where b=c) from t1;
-
-show status like "subquery_cache%";
-show status like '%Handler_read%';
-set optimizer_switch='subquery_cache=on';
-
-
---echo #single value subquery test (where)
-flush status;
-select a from t1 where (select d from t2 where b=c);
-
-show status like "subquery_cache%";
-show status like '%Handler_read%';
-
-set optimizer_switch='subquery_cache=off';
-flush status;
-
-select a from t1 where (select d from t2 where b=c);
-
-show status like "subquery_cache%";
-show status like '%Handler_read%';
-set optimizer_switch='subquery_cache=on';
-
---echo #single value subquery test (having)
-flush status;
-select a from t1 where a > 0 having (select d from t2 where b=c);
-
-show status like "subquery_cache%";
-show status like '%Handler_read%';
-
-set optimizer_switch='subquery_cache=off';
-flush status;
-
-select a from t1 where a > 0 having (select d from t2 where b=c);
-
-show status like "subquery_cache%";
-show status like '%Handler_read%';
-set optimizer_switch='subquery_cache=on';
-
---echo #single value subquery test (OUTER JOIN ON)
-flush status;
-select ta.a, tb.a from t1 ta join t1 tb on (select d from t2 where tb.b=c);
-
-show status like "subquery_cache%";
-show status like '%Handler_read%';
-
-set optimizer_switch='subquery_cache=off';
-flush status;
-
-select ta.a, tb.a from t1 ta join t1 tb on (select d from t2 where tb.b=c);
-
-show status like "subquery_cache%";
-show status like '%Handler_read%';
-set optimizer_switch='subquery_cache=on';
-
---echo #single value subquery test (GROUP BY)
-flush status;
-select max(a) from t1 GROUP BY (select d from t2 where b=c);
-
-show status like "subquery_cache%";
-show status like '%Handler_read%';
-set optimizer_switch='subquery_cache=off';
-
-flush status;
-select max(a) from t1 GROUP BY (select d from t2 where b=c);
-
-show status like "subquery_cache%";
-show status like '%Handler_read%';
-set optimizer_switch='subquery_cache=on';
-
---echo #single value subquery test (distinct GROUP BY)
-flush status;
-select distinct max(a) from t1 GROUP BY (select d from t2 where b=c);
-
-show status like "subquery_cache%";
-show status like '%Handler_read%';
-set optimizer_switch='subquery_cache=off';
-
-flush status;
-select distinct max(a) from t1 GROUP BY (select d from t2 where b=c);
-
-show status like "subquery_cache%";
-show status like '%Handler_read%';
-set optimizer_switch='subquery_cache=on';
-
---echo #single value subquery test (ORDER BY)
-flush status;
-select a from t1 ORDER BY (select d from t2 where b=c);
-
-show status like "subquery_cache%";
-show status like '%Handler_read%';
-set optimizer_switch='subquery_cache=off';
-
-flush status;
-select a from t1 ORDER BY (select d from t2 where b=c);
-
-show status like "subquery_cache%";
-show status like '%Handler_read%';
-set optimizer_switch='subquery_cache=on';
-
---echo #single value subquery test (distinct ORDER BY)
-flush status;
-select distinct a from t1 ORDER BY (select d from t2 where b=c);
-
-show status like "subquery_cache%";
-show status like '%Handler_read%';
-set optimizer_switch='subquery_cache=off';
-
-flush status;
-select distinct a from t1 ORDER BY (select d from t2 where b=c);
-
-show status like "subquery_cache%";
-show status like '%Handler_read%';
-set optimizer_switch='subquery_cache=on';
-
---echo #single value subquery test (LEFT JOIN ON)
-flush status;
-select ta.a, tb.a from t1 ta left join t1 tb on (select d from t2 where tb.b=c);
-
-show status like "subquery_cache%";
-show status like '%Handler_read%';
-
-set optimizer_switch='subquery_cache=off';
-flush status;
-
-select ta.a, tb.a from t1 ta left join t1 tb on (select d from t2 where tb.b=c);
-
-show status like "subquery_cache%";
-show status like '%Handler_read%';
-set optimizer_switch='subquery_cache=on';
-
---echo #single value subquery test (PS)
-prepare stmt1 from 'select a, (select d from t2 where b=c) + 1 from t1';
-execute stmt1;
-show status like "subquery_cache%";
-execute stmt1;
-show status like "subquery_cache%";
-deallocate prepare stmt1;
-
---echo #single value subquery test (SP)
-CREATE PROCEDURE p1() select a, (select d from t2 where b=c) + 1 from t1;
-
-call p1;
-call p1;
-
-drop procedure p1;
-
---echo #IN subquery test
-flush status;
-
-show status like "subquery_cache%";
-select a, b , b in (select d from t2) as SUBS from t1;
-show status like "subquery_cache%";
-
-insert into t1 values (7,8),(9,NULL);
-select a, b , b in (select d from t2) as SUBS from t1;
-show status like "subquery_cache%";
-
-insert into t2 values (8,NULL);
-select a, b , b in (select d from t2) as SUBS from t1;
-show status like "subquery_cache%";
-
---echo # multicolumn NOT IN with NULLs
-flush status;
-set optimizer_switch='subquery_cache=off';
-select a, b, (b, a) not in (select d, c from t2) as SUBS from t1;
-show status like "subquery_cache%";
-
-set optimizer_switch='subquery_cache=on';
-select a, b, (b, a) not in (select d, c from t2) as SUBS from t1;
-show status like "subquery_cache%";
-
---echo # multicolumn NOT IN with NULLs (other order)
-flush status;
-set optimizer_switch='subquery_cache=off';
-select a, b, (a, b) not in (select d, c from t2) as SUBS from t1;
-show status like "subquery_cache%";
-
-set optimizer_switch='subquery_cache=on';
-select a, b, (a, b) not in (select d, c from t2) as SUBS from t1;
-show status like "subquery_cache%";
-
---echo # multicolumn IN with NULLs
-flush status;
-set optimizer_switch='subquery_cache=off';
-select a, b, (b, a) in (select d, c from t2) as SUBS from t1;
-show status like "subquery_cache%";
-
-set optimizer_switch='subquery_cache=on';
-select a, b, (b, a) in (select d, c from t2) as SUBS from t1;
-show status like "subquery_cache%";
-
---echo # multicolumn IN with NULLs (other order)
-flush status;
-set optimizer_switch='subquery_cache=off';
-select a, b, (a, b) in (select d, c from t2) as SUBS from t1;
-show status like "subquery_cache%";
-
-set optimizer_switch='subquery_cache=on';
-select a, b, (a, b) in (select d, c from t2) as SUBS from t1;
-show status like "subquery_cache%";
-
---echo #IN subquery test (PS)
-delete from t1 where a > 6;
-delete from t2 where c > 6;
-
-prepare stmt1 from 'select a, b , b in (select d from t2) as SUBS from t1';
-execute stmt1;
-show status like "subquery_cache%";
-execute stmt1;
-show status like "subquery_cache%";
-
-insert into t1 values (7,8),(9,NULL);
-execute stmt1;
-show status like "subquery_cache%";
-execute stmt1;
-show status like "subquery_cache%";
-
-insert into t2 values (8,NULL);
-execute stmt1;
-show status like "subquery_cache%";
-execute stmt1;
-show status like "subquery_cache%";
-
-deallocate prepare stmt1;
-
-
---echo #IN subquery test (SP)
-delete from t1 where a > 6;
-delete from t2 where c > 6;
-
-CREATE PROCEDURE p1() select a, b , b in (select d from t2) as SUBS from t1;
-
-call p1();
-show status like "subquery_cache%";
-call p1();
-show status like "subquery_cache%";
-
-insert into t1 values (7,8),(9,NULL);
-call p1();
-show status like "subquery_cache%";
-call p1();
-show status like "subquery_cache%";
-
-insert into t2 values (8,NULL);
-call p1();
-show status like "subquery_cache%";
-call p1();
-show status like "subquery_cache%";
-
-drop procedure p1;
-
-
---echo # test of simple exists
-select a, b , exists (select * from t2 where b=d) as SUBS from t1;
-
---echo # test of prepared statement exists
-show status like "subquery_cache%";
-prepare stmt1 from 'select a, b , exists (select * from t2 where b=d) as SUBS from t1';
-execute stmt1;
-show status like "subquery_cache%";
-execute stmt1;
-show status like "subquery_cache%";
-deallocate prepare stmt1;
-
---echo # test of stored procedure exists
-CREATE PROCEDURE p1() select a, b , exists (select * from t2 where b=d) as SUBS from t1;
-call p1;
-call p1;
-drop procedure p1;
-
---echo #several subqueries
-set optimizer_switch='subquery_cache=off';
-flush status;
-select a, b , exists (select * from t2 where b=d) as SUBSE, b in (select d from t2) as SUBSI, (select d from t2 where b=c) SUBSR from t1;
-show status like "subquery_cache%";
-show status like '%Handler_read%';
-
-set optimizer_switch='subquery_cache=on';
-flush status;
-select a, b , exists (select * from t2 where b=d) as SUBSE, b in (select d from t2) as SUBSI, (select d from t2 where b=c) SUBSR from t1;
-show status like "subquery_cache%";
-show status like '%Handler_read%';
-
---echo #several subqueries (several levels)
-set optimizer_switch='subquery_cache=off';
-flush status;
-
-set optimizer_switch='subquery_cache=off';
-flush status;
-select a, b, (select exists (select * from t2 where b=d) from t2 where b=c) as SUNS1 from t1;
-show status like "subquery_cache%";
-show status like '%Handler_read%';
-
-
-set optimizer_switch='subquery_cache=on';
-flush status;
-select a, b, (select exists (select * from t2 where b=d) from t2 where b=c) as SUNS1 from t1;
-show status like "subquery_cache%";
-show status like '%Handler_read%';
-
-
---echo #clean up
-drop table t1,t2;
-
---echo test different types
---echo #int
-CREATE TABLE t1 ( a int, b int);
-INSERT INTO t1 VALUES(1,1),(2,2),(3,3);
-SELECT a FROM t1 WHERE NOT a IN (SELECT a FROM t1 WHERE b = 2);
-DROP TABLE t1;
-
---echo #char
-CREATE TABLE t1 ( a char(1), b char (1));
-INSERT INTO t1 VALUES('1','1'),('2','2'),('3','3');
-SELECT a FROM t1 WHERE NOT a IN (SELECT a FROM t1 WHERE b = '2');
-DROP TABLE t1;
-
---echo #decimal
-CREATE TABLE t1 ( a decimal(3,1), b decimal(3,1));
-INSERT INTO t1 VALUES(1,1),(2,2),(3,3);
-SELECT a FROM t1 WHERE NOT a IN (SELECT a FROM t1 WHERE b = 2);
-DROP TABLE t1;
-
---echo #date
-CREATE TABLE t1 ( a date, b date);
-INSERT INTO t1 VALUES('1000-01-01','1000-01-01'),('2000-02-01','2000-02-01'),('3000-03-03','3000-03-03');
-SELECT a FROM t1 WHERE NOT a IN (SELECT a FROM t1 WHERE b = '2000-02-01');
-DROP TABLE t1;
-
---echo #datetime
-CREATE TABLE t1 ( a datetime, b datetime);
-INSERT INTO t1 VALUES('1000-01-01 01:01:01','1000-01-01 01:01:01'),('2000-02-02 02:02:02','2000-02-02 02:02:02'),('3000-03-03 03:03:03','3000-03-03 03:03:03');
-SELECT a FROM t1 WHERE NOT a IN (SELECT a FROM t1 WHERE b = '2000-02-02 02:02:02');
-DROP TABLE t1;
-
---echo #time
-CREATE TABLE t1 ( a time, b time);
-INSERT INTO t1 VALUES('01:01:01','01:01:01'),('02:02:02','02:02:02'),('03:03:03','03:03:03');
-SELECT a FROM t1 WHERE NOT a IN (SELECT a FROM t1 WHERE b = '02:02:02');
-DROP TABLE t1;
-
---echo #timestamp
-CREATE TABLE t1 ( a timestamp, b timestamp);
-INSERT INTO t1 VALUES('2000-02-02 01:01:01','2000-02-02 01:01:01'),('2000-02-02 02:02:02','2000-02-02 02:02:02'),('2000-02-02 03:03:03','2000-02-02 03:03:03');
-SELECT a FROM t1 WHERE NOT a IN (SELECT a FROM t1 WHERE b = '2000-02-02 02:02:02');
-DROP TABLE t1;
-
---echo #bit
-CREATE TABLE t1 ( a bit(20), b bit(20));
-INSERT INTO t1 VALUES(1,1),(2,2),(3,3);
-SELECT a+0 FROM t1 WHERE NOT a IN (SELECT a FROM t1 WHERE b = 2);
-DROP TABLE t1;
-
---echo #enum
-CREATE TABLE t1 ( a enum('1','2','3'), b enum('1','2','3'));
-INSERT INTO t1 VALUES('1','1'),('2','2'),('3','3');
-SELECT a FROM t1 WHERE NOT a IN (SELECT a FROM t1 WHERE b = '2');
-DROP TABLE t1;
-
---echo #set
-CREATE TABLE t1 ( a set('1','2','3'), b set('1','2','3'));
-INSERT INTO t1 VALUES('1','1'),('2','2'),('3','3');
-SELECT a FROM t1 WHERE NOT a IN (SELECT a FROM t1 WHERE b = '2');
-DROP TABLE t1;
-
---echo #blob
-CREATE TABLE t1 ( a blob, b blob);
-INSERT INTO t1 VALUES('1','1'),('2','2'),('3','3');
-SELECT a FROM t1 WHERE NOT a IN (SELECT a FROM t1 WHERE b = '2');
-DROP TABLE t1;
-
---echo #geometry
-CREATE TABLE t1 ( a geometry, b geometry);
-INSERT INTO t1 VALUES(POINT(1,1),POINT(1,1)),(POINT(2,2),POINT(2,2)),(POINT(3,3),POINT(3,3));
-SELECT astext(a) FROM t1 WHERE NOT a IN (SELECT a FROM t1 WHERE b = POINT(2,2));
-DROP TABLE t1;
-
-
---echo #uncacheable queries test (random and side effect)
-flush status;
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (2), (4), (1), (3);
-select a, a in (select a from t1) from t1 as ext;
-show status like "subquery_cache%";
-select a, a in (select a from t1 where -1 < rand()) from t1 as ext;
-show status like "subquery_cache%";
-select a, a in (select a from t1 where -1 < benchmark(a,100)) from t1 as ext;
-show status like "subquery_cache%";
-drop table t1;
-
---echo #test of sql_big_tables switch and outer table reference in subquery with grouping
-set big_tables=1;
-CREATE TABLE t1 (a INT PRIMARY KEY, b INT);
-INSERT INTO t1 VALUES (1,1),(2,1),(3,2),(4,2),(5,3),(6,3);
-SELECT (SELECT t1_outer.a FROM t1 AS t1_inner GROUP BY b LIMIT 1) FROM t1 AS t1_outer;
-drop table t1;
-set big_tables=0;
-
---echo #test of function reference to outer query
-set local group_concat_max_len=400;
-create table t2 (a int, b int);
-insert into t2 values (1,1), (2,2);
-select b x, (select group_concat(x) from t2) from t2;
-drop table t2;
-set local group_concat_max_len=default;
-
---echo #aggregate functions
-CREATE TABLE t1 (a int, b INT);
-CREATE TABLE t2 (c int, d INT);
-
-insert into t1 values (2,1), (3,1), (2,4), (3,4), (10,2), (20,2), (2,5),
-(3,5), (100,3), (200,3), (10,6), (20,6), (20,7), (100,8), (200,8);
-insert into t2 values (1,1),(3,3),(20,20);
-
---echo aggregate function as parameter of subquery
-set optimizer_switch='subquery_cache=off';
-flush status;
-select max(a), (select max(a) from t2 where max(a)=c) from t1 group by b;
-show status like "subquery_cache%";
-show status like '%Handler_read%';
-set optimizer_switch='subquery_cache=on';
-flush status;
-select max(a), (select max(a) from t2 where max(a)=c) from t1 group by b;
-show status like "subquery_cache%";
-show status like '%Handler_read%';
-
---echo argument of aggregate function as parameter of subquery (illegal use)
-set optimizer_switch='subquery_cache=off';
-flush status;
-select max(a), (select a from t2 where a=c) from t1 group by b;
-show status like "subquery_cache%";
-show status like '%Handler_read%';
-
-set optimizer_switch='subquery_cache=on';
-flush status;
-select max(a), (select a from t2 where a=c) from t1 group by b;
-show status like "subquery_cache%";
-show status like '%Handler_read%';
-
-drop table t1,t2;
-
---echo #test of flattening subquery optimisations and cache
-create table t0 (a int);
-insert into t0 values (9),(8),(7),(6),(5),(4),(3),(2),(1),(0);
-
-create table t1(a int, b int);
-insert into t1 values
-(0,0),(1,1),(2,2),(0,0),(1,1),(2,2),(0,0),(1,1),(2,2),(0,0),(1,1),(2,2),(0,0),(1,1),(2,2);
-
-create table t2 (pk int, a int, primary key(pk));
-insert into t2 select a,a from t0;
-
-set optimizer_switch='default,semijoin=on,materialization=on,subquery_cache=on';
-flush status;
-select * from t1 where a in (select pk from t2);
-show status like "subquery_cache%";
-show status like '%Handler_read%';
-
-alter table t2 drop primary key;
-set optimizer_switch='default,semijoin=off,materialization=off,subquery_cache=off';
-
-explain select * from t1 where a in (select pk from t2);
-flush status;
-select * from t1 where a in (select pk from t2);
-show status like "subquery_cache%";
-show status like '%Handler_read%';
-
-set optimizer_switch='default,semijoin=off,materialization=off,subquery_cache=on';
-
-explain select * from t1 where a in (select pk from t2);
-flush status;
-select * from t1 where a in (select pk from t2);
-show status like "subquery_cache%";
-show status like '%Handler_read%';
-
-#TODO: switch off cache if materialization used
-set optimizer_switch='default,semijoin=off,materialization=on,subquery_cache=on';
-
-explain select * from t1 where a in (select pk from t2);
-flush status;
-select * from t1 where a in (select pk from t2);
-show status like "subquery_cache%";
-show status like '%Handler_read%';
-
-drop table t0,t1,t2;
-
-set optimizer_switch='default';
-
-#
---echo #launchpad BUG#608834
-#
-CREATE TABLE `t2` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `col_int_nokey` int(11) DEFAULT NULL,
- `col_int_key` int(11) DEFAULT NULL,
- `col_time_key` time DEFAULT NULL,
- `col_varchar_key` varchar(1) DEFAULT NULL,
- `col_varchar_nokey` varchar(1) DEFAULT NULL,
- PRIMARY KEY (`pk`),
- KEY `col_int_key` (`col_int_key`),
- KEY `col_time_key` (`col_time_key`),
- KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
-) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1;
-INSERT INTO `t2` VALUES (10,7,8,'01:27:35','v','v');
-INSERT INTO `t2` VALUES (11,1,9,'19:48:31','r','r');
-INSERT INTO `t2` VALUES (12,5,9,'00:00:00','a','a');
-INSERT INTO `t2` VALUES (13,3,186,'19:53:05','m','m');
-INSERT INTO `t2` VALUES (14,6,NULL,'19:18:56','y','y');
-INSERT INTO `t2` VALUES (15,92,2,'10:55:12','j','j');
-INSERT INTO `t2` VALUES (16,7,3,'00:25:00','d','d');
-INSERT INTO `t2` VALUES (17,NULL,0,'12:35:47','z','z');
-INSERT INTO `t2` VALUES (18,3,133,'19:53:03','e','e');
-INSERT INTO `t2` VALUES (19,5,1,'17:53:30','h','h');
-INSERT INTO `t2` VALUES (20,1,8,'11:35:49','b','b');
-INSERT INTO `t2` VALUES (21,2,5,NULL,'s','s');
-INSERT INTO `t2` VALUES (22,NULL,5,'06:01:40','e','e');
-INSERT INTO `t2` VALUES (23,1,8,'05:45:11','j','j');
-INSERT INTO `t2` VALUES (24,0,6,'00:00:00','e','e');
-INSERT INTO `t2` VALUES (25,210,51,'00:00:00','f','f');
-INSERT INTO `t2` VALUES (26,8,4,'06:11:01','v','v');
-INSERT INTO `t2` VALUES (27,7,7,'13:02:46','x','x');
-INSERT INTO `t2` VALUES (28,5,6,'21:44:25','m','m');
-INSERT INTO `t2` VALUES (29,NULL,4,'22:43:58','c','c');
-CREATE TABLE `t1` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `col_int_nokey` int(11) DEFAULT NULL,
- `col_int_key` int(11) DEFAULT NULL,
- `col_time_key` time DEFAULT NULL,
- `col_varchar_key` varchar(1) DEFAULT NULL,
- `col_varchar_nokey` varchar(1) DEFAULT NULL,
- PRIMARY KEY (`pk`),
- KEY `col_int_key` (`col_int_key`),
- KEY `col_time_key` (`col_time_key`),
- KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
-) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;
-INSERT INTO `t1` VALUES (1,NULL,2,'11:28:45','w','w');
-INSERT INTO `t1` VALUES (2,7,9,'20:25:14','m','m');
-INSERT INTO `t1` VALUES (3,9,3,'13:47:24','m','m');
-INSERT INTO `t1` VALUES (4,7,9,'19:24:11','k','k');
-INSERT INTO `t1` VALUES (5,4,NULL,'15:59:13','r','r');
-INSERT INTO `t1` VALUES (6,2,9,'00:00:00','t','t');
-INSERT INTO `t1` VALUES (7,6,3,'15:15:04','j','j');
-INSERT INTO `t1` VALUES (8,8,8,'11:32:06','u','u');
-INSERT INTO `t1` VALUES (9,NULL,8,'18:32:33','h','h');
-INSERT INTO `t1` VALUES (10,5,53,'15:19:25','o','o');
-INSERT INTO `t1` VALUES (11,NULL,0,'19:03:19',NULL,NULL);
-INSERT INTO `t1` VALUES (12,6,5,'00:39:46','k','k');
-INSERT INTO `t1` VALUES (13,188,166,NULL,'e','e');
-INSERT INTO `t1` VALUES (14,2,3,'00:00:00','n','n');
-INSERT INTO `t1` VALUES (15,1,0,'13:12:11','t','t');
-INSERT INTO `t1` VALUES (16,1,1,'04:56:48','c','c');
-INSERT INTO `t1` VALUES (17,0,9,'19:56:05','m','m');
-INSERT INTO `t1` VALUES (18,9,5,'19:35:19','y','y');
-INSERT INTO `t1` VALUES (19,NULL,6,'05:03:03','f','f');
-INSERT INTO `t1` VALUES (20,4,2,'18:38:59','d','d');
-
-set @@optimizer_switch='subquery_cache=off';
-
-/* cache is off */ SELECT (
-SELECT 4
-FROM DUAL ) AS field1 , SUM( DISTINCT table1 . `pk` ) AS field2 , (
-SELECT MAX( SUBQUERY2_t1 . `col_int_nokey` ) AS SUBQUERY2_field1
-FROM ( t1 AS SUBQUERY2_t1 INNER JOIN t1 AS SUBQUERY2_t2 ON (SUBQUERY2_t2 . `col_int_key` = SUBQUERY2_t1 . `pk` ) )
-WHERE SUBQUERY2_t2 . `col_varchar_nokey` <= table1 . `col_varchar_key` OR SUBQUERY2_t1 . `col_int_nokey` < table1 . `pk` ) AS field3 , table1 . `col_time_key` AS field4 , table1 . `col_int_key` AS field5 , CONCAT ( table2 . `col_varchar_nokey` , table1 . `col_varchar_key` ) AS field6
-FROM ( t1 AS table1 INNER JOIN ( ( t1 AS table2 LEFT JOIN t2 AS table3 ON (table3 . `col_varchar_key` = table2 . `col_varchar_key` ) ) ) ON (table3 . `col_varchar_key` = table2 . `col_varchar_nokey` ) )
-WHERE ( table2 . `col_varchar_nokey` NOT IN (
-SELECT 'd' UNION
-SELECT 'u' ) ) OR table3 . `col_varchar_nokey` <= table1 . `col_varchar_key`
-GROUP BY field1, field3, field4, field5, field6
-ORDER BY table1 . `col_int_key` , field1, field2, field3, field4, field5, field6
-;
-
-set @@optimizer_switch='subquery_cache=on';
-
-/* cache is on */ SELECT (
-SELECT 4
-FROM DUAL ) AS field1 , SUM( DISTINCT table1 . `pk` ) AS field2 , (
-SELECT MAX( SUBQUERY2_t1 . `col_int_nokey` ) AS SUBQUERY2_field1
-FROM ( t1 AS SUBQUERY2_t1 INNER JOIN t1 AS SUBQUERY2_t2 ON (SUBQUERY2_t2 . `col_int_key` = SUBQUERY2_t1 . `pk` ) )
-WHERE SUBQUERY2_t2 . `col_varchar_nokey` <= table1 . `col_varchar_key` OR SUBQUERY2_t1 . `col_int_nokey` < table1 . `pk` ) AS field3 , table1 . `col_time_key` AS field4 , table1 . `col_int_key` AS field5 , CONCAT ( table2 . `col_varchar_nokey` , table1 . `col_varchar_key` ) AS field6
-FROM ( t1 AS table1 INNER JOIN ( ( t1 AS table2 LEFT JOIN t2 AS table3 ON (table3 . `col_varchar_key` = table2 . `col_varchar_key` ) ) ) ON (table3 . `col_varchar_key` = table2 . `col_varchar_nokey` ) )
-WHERE ( table2 . `col_varchar_nokey` NOT IN (
-SELECT 'd' UNION
-SELECT 'u' ) ) OR table3 . `col_varchar_nokey` <= table1 . `col_varchar_key`
-GROUP BY field1, field3, field4, field5, field6
-ORDER BY table1 . `col_int_key` , field1, field2, field3, field4, field5, field6
-;
-
-drop table t1,t2;
-set @@optimizer_switch= default;
-
-#
---echo #launchpad BUG#609045
-#
-CREATE TABLE `t1` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `col_int_nokey` int(11) DEFAULT NULL,
- `col_int_key` int(11) DEFAULT NULL,
- `col_date_key` date DEFAULT NULL,
- `col_date_nokey` date DEFAULT NULL,
- `col_time_key` time DEFAULT NULL,
- `col_time_nokey` time DEFAULT NULL,
- `col_datetime_key` datetime DEFAULT NULL,
- `col_datetime_nokey` datetime DEFAULT NULL,
- `col_varchar_key` varchar(1) DEFAULT NULL,
- `col_varchar_nokey` varchar(1) DEFAULT NULL,
- PRIMARY KEY (`pk`),
- KEY `col_int_key` (`col_int_key`),
- KEY `col_date_key` (`col_date_key`),
- KEY `col_time_key` (`col_time_key`),
- KEY `col_datetime_key` (`col_datetime_key`),
- KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
-) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;
-
-INSERT INTO `t1` VALUES (1,NULL,2,NULL,NULL,'11:28:45','11:28:45','2004-10-11 18:13:16','2004-10-11 18:13:16','w','w');
-INSERT INTO `t1` VALUES (2,7,9,'2001-09-19','2001-09-19','20:25:14','20:25:14',NULL,NULL,'m','m');
-INSERT INTO `t1` VALUES (3,9,3,'2004-09-12','2004-09-12','13:47:24','13:47:24','1900-01-01 00:00:00','1900-01-01 00:00:00','m','m');
-INSERT INTO `t1` VALUES (4,7,9,NULL,NULL,'19:24:11','19:24:11','2009-07-25 00:00:00','2009-07-25 00:00:00','k','k');
-INSERT INTO `t1` VALUES (5,4,NULL,'2002-07-19','2002-07-19','15:59:13','15:59:13',NULL,NULL,'r','r');
-INSERT INTO `t1` VALUES (6,2,9,'2002-12-16','2002-12-16','00:00:00','00:00:00','2008-07-27 00:00:00','2008-07-27 00:00:00','t','t');
-INSERT INTO `t1` VALUES (7,6,3,'2006-02-08','2006-02-08','15:15:04','15:15:04','2002-11-13 16:37:31','2002-11-13 16:37:31','j','j');
-INSERT INTO `t1` VALUES (8,8,8,'2006-08-28','2006-08-28','11:32:06','11:32:06','1900-01-01 00:00:00','1900-01-01 00:00:00','u','u');
-INSERT INTO `t1` VALUES (9,NULL,8,'2001-04-14','2001-04-14','18:32:33','18:32:33','2003-12-10 00:00:00','2003-12-10 00:00:00','h','h');
-INSERT INTO `t1` VALUES (10,5,53,'2000-01-05','2000-01-05','15:19:25','15:19:25','2001-12-21 22:38:22','2001-12-21 22:38:22','o','o');
-INSERT INTO `t1` VALUES (11,NULL,0,'2003-12-06','2003-12-06','19:03:19','19:03:19','2008-12-13 23:16:44','2008-12-13 23:16:44',NULL,NULL);
-INSERT INTO `t1` VALUES (12,6,5,'1900-01-01','1900-01-01','00:39:46','00:39:46','2005-08-15 12:39:41','2005-08-15 12:39:41','k','k');
-INSERT INTO `t1` VALUES (13,188,166,'2002-11-27','2002-11-27',NULL,NULL,NULL,NULL,'e','e');
-INSERT INTO `t1` VALUES (14,2,3,NULL,NULL,'00:00:00','00:00:00','2006-09-11 12:06:14','2006-09-11 12:06:14','n','n');
-INSERT INTO `t1` VALUES (15,1,0,'2003-05-27','2003-05-27','13:12:11','13:12:11','2007-12-15 12:39:34','2007-12-15 12:39:34','t','t');
-INSERT INTO `t1` VALUES (16,1,1,'2005-05-03','2005-05-03','04:56:48','04:56:48','2005-08-09 00:00:00','2005-08-09 00:00:00','c','c');
-INSERT INTO `t1` VALUES (17,0,9,'2001-04-18','2001-04-18','19:56:05','19:56:05','2001-09-02 22:50:02','2001-09-02 22:50:02','m','m');
-INSERT INTO `t1` VALUES (18,9,5,'2005-12-27','2005-12-27','19:35:19','19:35:19','2005-12-16 22:58:11','2005-12-16 22:58:11','y','y');
-INSERT INTO `t1` VALUES (19,NULL,6,'2004-08-20','2004-08-20','05:03:03','05:03:03','2007-04-19 00:19:53','2007-04-19 00:19:53','f','f');
-INSERT INTO `t1` VALUES (20,4,2,'1900-01-01','1900-01-01','18:38:59','18:38:59','1900-01-01 00:00:00','1900-01-01 00:00:00','d','d');
-
-CREATE TABLE `t2` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `col_int_nokey` int(11) DEFAULT NULL,
- `col_int_key` int(11) DEFAULT NULL,
- `col_date_key` date DEFAULT NULL,
- `col_date_nokey` date DEFAULT NULL,
- `col_time_key` time DEFAULT NULL,
- `col_time_nokey` time DEFAULT NULL,
- `col_datetime_key` datetime DEFAULT NULL,
- `col_datetime_nokey` datetime DEFAULT NULL,
- `col_varchar_key` varchar(1) DEFAULT NULL,
- `col_varchar_nokey` varchar(1) DEFAULT NULL,
- PRIMARY KEY (`pk`),
- KEY `col_int_key` (`col_int_key`),
- KEY `col_date_key` (`col_date_key`),
- KEY `col_time_key` (`col_time_key`),
- KEY `col_datetime_key` (`col_datetime_key`),
- KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
-);
-
-INSERT INTO `t2` VALUES (10,7,8,NULL,NULL,'01:27:35','01:27:35','2002-02-26 06:14:37','2002-02-26 06:14:37','v','v');
-INSERT INTO `t2` VALUES (11,1,9,'2006-06-14','2006-06-14','19:48:31','19:48:31','1900-01-01 00:00:00','1900-01-01 00:00:00','r','r');
-INSERT INTO `t2` VALUES (12,5,9,'2002-09-12','2002-09-12','00:00:00','00:00:00','2006-12-03 09:37:26','2006-12-03 09:37:26','a','a');
-INSERT INTO `t2` VALUES (13,3,186,'2005-02-15','2005-02-15','19:53:05','19:53:05','2008-05-26 12:27:10','2008-05-26 12:27:10','m','m');
-INSERT INTO `t2` VALUES (14,6,NULL,NULL,NULL,'19:18:56','19:18:56','2004-12-14 16:37:30','2004-12-14 16:37:30','y','y');
-INSERT INTO `t2` VALUES (15,92,2,'2008-11-04','2008-11-04','10:55:12','10:55:12','2003-02-11 21:19:41','2003-02-11 21:19:41','j','j');
-INSERT INTO `t2` VALUES (16,7,3,'2004-09-04','2004-09-04','00:25:00','00:25:00','2009-10-18 02:27:49','2009-10-18 02:27:49','d','d');
-INSERT INTO `t2` VALUES (17,NULL,0,'2006-06-05','2006-06-05','12:35:47','12:35:47','2000-09-26 07:45:57','2000-09-26 07:45:57','z','z');
-INSERT INTO `t2` VALUES (18,3,133,'1900-01-01','1900-01-01','19:53:03','19:53:03',NULL,NULL,'e','e');
-INSERT INTO `t2` VALUES (19,5,1,'1900-01-01','1900-01-01','17:53:30','17:53:30','2005-11-10 12:40:29','2005-11-10 12:40:29','h','h');
-INSERT INTO `t2` VALUES (20,1,8,'1900-01-01','1900-01-01','11:35:49','11:35:49','2009-04-25 00:00:00','2009-04-25 00:00:00','b','b');
-INSERT INTO `t2` VALUES (21,2,5,'2005-01-13','2005-01-13',NULL,NULL,'2002-11-27 00:00:00','2002-11-27 00:00:00','s','s');
-INSERT INTO `t2` VALUES (22,NULL,5,'2006-05-21','2006-05-21','06:01:40','06:01:40','2004-01-26 20:32:32','2004-01-26 20:32:32','e','e');
-INSERT INTO `t2` VALUES (23,1,8,'2003-09-08','2003-09-08','05:45:11','05:45:11','2007-10-26 11:41:40','2007-10-26 11:41:40','j','j');
-INSERT INTO `t2` VALUES (24,0,6,'2006-12-23','2006-12-23','00:00:00','00:00:00','2005-10-07 00:00:00','2005-10-07 00:00:00','e','e');
-INSERT INTO `t2` VALUES (25,210,51,'2006-10-15','2006-10-15','00:00:00','00:00:00','2000-07-15 05:00:34','2000-07-15 05:00:34','f','f');
-INSERT INTO `t2` VALUES (26,8,4,'2005-04-06','2005-04-06','06:11:01','06:11:01','2000-04-03 16:33:32','2000-04-03 16:33:32','v','v');
-INSERT INTO `t2` VALUES (27,7,7,'2008-04-07','2008-04-07','13:02:46','13:02:46',NULL,NULL,'x','x');
-INSERT INTO `t2` VALUES (28,5,6,'2006-10-10','2006-10-10','21:44:25','21:44:25','2001-04-25 01:26:12','2001-04-25 01:26:12','m','m');
-INSERT INTO `t2` VALUES (29,NULL,4,'1900-01-01','1900-01-01','22:43:58','22:43:58','2000-12-27 00:00:00','2000-12-27 00:00:00','c','c');
-
-CREATE TABLE `t3` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `col_int_nokey` int(11) DEFAULT NULL,
- `col_int_key` int(11) DEFAULT NULL,
- `col_date_key` date DEFAULT NULL,
- `col_date_nokey` date DEFAULT NULL,
- `col_time_key` time DEFAULT NULL,
- `col_time_nokey` time DEFAULT NULL,
- `col_datetime_key` datetime DEFAULT NULL,
- `col_datetime_nokey` datetime DEFAULT NULL,
- `col_varchar_key` varchar(1) DEFAULT NULL,
- `col_varchar_nokey` varchar(1) DEFAULT NULL,
- PRIMARY KEY (`pk`),
- KEY `col_int_key` (`col_int_key`),
- KEY `col_date_key` (`col_date_key`),
- KEY `col_time_key` (`col_time_key`),
- KEY `col_datetime_key` (`col_datetime_key`),
- KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
-);
-
-INSERT INTO `t3` VALUES (1,1,7,'1900-01-01','1900-01-01','01:13:38','01:13:38','2005-02-05 00:00:00','2005-02-05 00:00:00','f','f');
-
-CREATE TABLE `t4` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `col_int_nokey` int(11) DEFAULT NULL,
- `col_int_key` int(11) DEFAULT NULL,
- `col_date_key` date DEFAULT NULL,
- `col_date_nokey` date DEFAULT NULL,
- `col_time_key` time DEFAULT NULL,
- `col_time_nokey` time DEFAULT NULL,
- `col_datetime_key` datetime DEFAULT NULL,
- `col_datetime_nokey` datetime DEFAULT NULL,
- `col_varchar_key` varchar(1) DEFAULT NULL,
- `col_varchar_nokey` varchar(1) DEFAULT NULL,
- PRIMARY KEY (`pk`),
- KEY `col_int_key` (`col_int_key`),
- KEY `col_date_key` (`col_date_key`),
- KEY `col_time_key` (`col_time_key`),
- KEY `col_datetime_key` (`col_datetime_key`),
- KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
-);
-
-INSERT INTO `t4` VALUES (1,6,NULL,'2003-05-12','2003-05-12',NULL,NULL,'2000-09-12 00:00:00','2000-09-12 00:00:00','r','r');
-INSERT INTO `t4` VALUES (2,8,0,'2003-01-07','2003-01-07','14:34:45','14:34:45','2004-08-10 09:09:31','2004-08-10 09:09:31','c','c');
-INSERT INTO `t4` VALUES (3,6,0,NULL,NULL,'11:49:48','11:49:48','2005-03-21 04:31:40','2005-03-21 04:31:40','o','o');
-INSERT INTO `t4` VALUES (4,6,7,'2005-03-12','2005-03-12','18:12:55','18:12:55','2002-10-25 23:50:35','2002-10-25 23:50:35','c','c');
-INSERT INTO `t4` VALUES (5,3,8,'2000-08-02','2000-08-02','18:30:05','18:30:05','2001-04-01 21:14:04','2001-04-01 21:14:04','d','d');
-INSERT INTO `t4` VALUES (6,9,4,'1900-01-01','1900-01-01','14:19:30','14:19:30','2005-03-12 06:02:34','2005-03-12 06:02:34','v','v');
-INSERT INTO `t4` VALUES (7,2,6,'2006-07-06','2006-07-06','05:20:04','05:20:04','2001-05-06 14:49:12','2001-05-06 14:49:12','m','m');
-INSERT INTO `t4` VALUES (8,1,5,'2006-12-24','2006-12-24','20:29:31','20:29:31','2004-04-25 00:00:00','2004-04-25 00:00:00','j','j');
-INSERT INTO `t4` VALUES (9,8,NULL,'2004-11-16','2004-11-16','07:08:09','07:08:09','2001-03-22 18:38:43','2001-03-22 18:38:43','f','f');
-INSERT INTO `t4` VALUES (10,0,NULL,'2002-09-09','2002-09-09','14:49:14','14:49:14','2006-04-25 21:03:02','2006-04-25 21:03:02','n','n');
-INSERT INTO `t4` VALUES (11,9,8,NULL,NULL,'00:00:00','00:00:00','2009-09-07 18:40:43','2009-09-07 18:40:43','z','z');
-INSERT INTO `t4` VALUES (12,8,8,'2008-06-24','2008-06-24','09:58:06','09:58:06','2004-03-23 00:00:00','2004-03-23 00:00:00','h','h');
-INSERT INTO `t4` VALUES (13,NULL,8,'2001-04-21','2001-04-21',NULL,NULL,'2009-04-15 00:08:29','2009-04-15 00:08:29','q','q');
-INSERT INTO `t4` VALUES (14,0,1,'2003-11-22','2003-11-22','18:24:16','18:24:16','2000-04-21 00:00:00','2000-04-21 00:00:00','w','w');
-INSERT INTO `t4` VALUES (15,5,1,'2004-09-12','2004-09-12','17:39:57','17:39:57','2000-02-17 19:41:23','2000-02-17 19:41:23','z','z');
-INSERT INTO `t4` VALUES (16,1,5,'2006-06-20','2006-06-20','08:23:21','08:23:21','2003-09-20 07:38:14','2003-09-20 07:38:14','j','j');
-INSERT INTO `t4` VALUES (17,1,2,NULL,NULL,NULL,NULL,'2000-11-28 20:42:12','2000-11-28 20:42:12','a','a');
-INSERT INTO `t4` VALUES (18,6,7,'2001-11-25','2001-11-25','21:50:46','21:50:46','2005-06-12 11:13:17','2005-06-12 11:13:17','m','m');
-INSERT INTO `t4` VALUES (19,6,6,'2004-10-26','2004-10-26','12:33:17','12:33:17','1900-01-01 00:00:00','1900-01-01 00:00:00','n','n');
-INSERT INTO `t4` VALUES (20,1,4,'2005-01-19','2005-01-19','03:06:43','03:06:43','2006-02-09 20:41:06','2006-02-09 20:41:06','e','e');
-INSERT INTO `t4` VALUES (21,8,7,'2008-07-06','2008-07-06','03:46:14','03:46:14','2004-05-22 01:05:57','2004-05-22 01:05:57','u','u');
-INSERT INTO `t4` VALUES (22,1,0,'1900-01-01','1900-01-01','20:34:52','20:34:52','2004-03-04 13:46:31','2004-03-04 13:46:31','s','s');
-INSERT INTO `t4` VALUES (23,0,9,'1900-01-01','1900-01-01',NULL,NULL,'1900-01-01 00:00:00','1900-01-01 00:00:00','u','u');
-INSERT INTO `t4` VALUES (24,4,3,'2004-06-08','2004-06-08','10:41:20','10:41:20','2004-10-20 07:20:19','2004-10-20 07:20:19','r','r');
-INSERT INTO `t4` VALUES (25,9,5,'2007-02-20','2007-02-20','08:43:11','08:43:11','2006-04-17 00:00:00','2006-04-17 00:00:00','g','g');
-INSERT INTO `t4` VALUES (26,8,1,'2008-06-18','2008-06-18',NULL,NULL,'2000-10-27 00:00:00','2000-10-27 00:00:00','o','o');
-INSERT INTO `t4` VALUES (27,5,1,'2008-05-15','2008-05-15','10:17:51','10:17:51','2007-04-14 08:54:06','2007-04-14 08:54:06','w','w');
-INSERT INTO `t4` VALUES (28,9,5,'2005-10-06','2005-10-06','06:34:09','06:34:09','2008-04-12 17:03:52','2008-04-12 17:03:52','b','b');
-INSERT INTO `t4` VALUES (29,5,9,NULL,NULL,'21:22:47','21:22:47','2007-02-19 17:37:09','2007-02-19 17:37:09',NULL,NULL);
-INSERT INTO `t4` VALUES (30,NULL,2,'2006-10-12','2006-10-12','04:02:32','04:02:32','1900-01-01 00:00:00','1900-01-01 00:00:00','y','y');
-INSERT INTO `t4` VALUES (31,NULL,5,'2005-01-24','2005-01-24','02:33:14','02:33:14','2001-10-10 08:32:27','2001-10-10 08:32:27','y','y');
-INSERT INTO `t4` VALUES (32,105,248,'2009-06-27','2009-06-27','16:32:56','16:32:56',NULL,NULL,'u','u');
-INSERT INTO `t4` VALUES (33,0,0,NULL,NULL,'21:32:42','21:32:42','2001-12-16 05:31:53','2001-12-16 05:31:53','p','p');
-INSERT INTO `t4` VALUES (34,3,8,NULL,NULL,'23:04:47','23:04:47','2003-07-19 18:03:28','2003-07-19 18:03:28','s','s');
-INSERT INTO `t4` VALUES (35,1,1,'1900-01-01','1900-01-01','22:05:43','22:05:43','2001-03-27 11:44:10','2001-03-27 11:44:10','e','e');
-INSERT INTO `t4` VALUES (36,75,255,'2005-12-22','2005-12-22','02:05:45','02:05:45','2008-06-15 02:13:00','2008-06-15 02:13:00','d','d');
-INSERT INTO `t4` VALUES (37,9,9,'2005-05-03','2005-05-03','00:00:00','00:00:00','2009-03-14 21:29:56','2009-03-14 21:29:56','d','d');
-INSERT INTO `t4` VALUES (38,7,9,'2003-05-27','2003-05-27','18:09:07','18:09:07','2005-01-02 00:00:00','2005-01-02 00:00:00','c','c');
-INSERT INTO `t4` VALUES (39,NULL,3,'2006-05-25','2006-05-25','10:54:06','10:54:06','2007-07-16 04:44:07','2007-07-16 04:44:07','b','b');
-INSERT INTO `t4` VALUES (40,NULL,9,NULL,NULL,'23:15:50','23:15:50','2003-08-26 21:38:26','2003-08-26 21:38:26','t','t');
-INSERT INTO `t4` VALUES (41,4,6,'2009-01-04','2009-01-04','10:17:40','10:17:40','2004-04-19 04:18:47','2004-04-19 04:18:47',NULL,NULL);
-INSERT INTO `t4` VALUES (42,0,4,'2009-02-14','2009-02-14','03:37:09','03:37:09','2000-01-06 20:32:48','2000-01-06 20:32:48','y','y');
-INSERT INTO `t4` VALUES (43,204,60,'2003-01-16','2003-01-16','22:26:06','22:26:06','2006-06-23 13:27:17','2006-06-23 13:27:17','c','c');
-INSERT INTO `t4` VALUES (44,0,7,'1900-01-01','1900-01-01','17:10:38','17:10:38','2007-11-27 00:00:00','2007-11-27 00:00:00','d','d');
-INSERT INTO `t4` VALUES (45,9,1,'2007-06-26','2007-06-26','00:00:00','00:00:00','2002-04-03 12:06:51','2002-04-03 12:06:51','x','x');
-INSERT INTO `t4` VALUES (46,8,6,'2004-03-27','2004-03-27','17:08:49','17:08:49','2008-12-28 09:47:42','2008-12-28 09:47:42','p','p');
-INSERT INTO `t4` VALUES (47,7,4,NULL,NULL,'19:04:40','19:04:40','2002-04-04 10:07:54','2002-04-04 10:07:54','e','e');
-INSERT INTO `t4` VALUES (48,8,NULL,'2005-06-06','2005-06-06','20:53:28','20:53:28','2003-04-26 02:55:13','2003-04-26 02:55:13','g','g');
-INSERT INTO `t4` VALUES (49,NULL,8,'2003-03-02','2003-03-02','11:46:03','11:46:03',NULL,NULL,'x','x');
-INSERT INTO `t4` VALUES (50,6,0,'2004-05-13','2004-05-13',NULL,NULL,'2009-02-19 03:17:06','2009-02-19 03:17:06','s','s');
-INSERT INTO `t4` VALUES (51,5,8,'2005-09-13','2005-09-13','10:58:07','10:58:07','1900-01-01 00:00:00','1900-01-01 00:00:00','e','e');
-INSERT INTO `t4` VALUES (52,2,151,'2005-10-03','2005-10-03','00:00:00','00:00:00','2000-11-10 08:20:01','2000-11-10 08:20:01','l','l');
-INSERT INTO `t4` VALUES (53,3,7,'2005-10-14','2005-10-14','09:43:15','09:43:15','2008-02-10 00:00:00','2008-02-10 00:00:00','p','p');
-INSERT INTO `t4` VALUES (54,7,6,NULL,NULL,'21:40:32','21:40:32','1900-01-01 00:00:00','1900-01-01 00:00:00','h','h');
-INSERT INTO `t4` VALUES (55,NULL,NULL,'2005-09-16','2005-09-16','00:17:44','00:17:44',NULL,NULL,'m','m');
-INSERT INTO `t4` VALUES (56,145,23,'2005-03-10','2005-03-10','16:47:26','16:47:26','2001-02-05 02:01:50','2001-02-05 02:01:50','n','n');
-INSERT INTO `t4` VALUES (57,0,2,'2000-06-19','2000-06-19','00:00:00','00:00:00','2000-10-28 08:44:25','2000-10-28 08:44:25','v','v');
-INSERT INTO `t4` VALUES (58,1,4,'2002-11-03','2002-11-03','05:25:59','05:25:59','2005-03-20 10:53:59','2005-03-20 10:53:59','b','b');
-INSERT INTO `t4` VALUES (59,7,NULL,'2009-01-05','2009-01-05','00:00:00','00:00:00','2001-06-02 13:54:13','2001-06-02 13:54:13','x','x');
-INSERT INTO `t4` VALUES (60,3,NULL,'2003-05-22','2003-05-22','20:33:04','20:33:04','1900-01-01 00:00:00','1900-01-01 00:00:00','r','r');
-INSERT INTO `t4` VALUES (61,NULL,77,'2005-07-02','2005-07-02','00:46:12','00:46:12','2009-07-16 13:05:43','2009-07-16 13:05:43','t','t');
-INSERT INTO `t4` VALUES (62,2,NULL,'1900-01-01','1900-01-01','00:00:00','00:00:00','2009-03-26 23:16:20','2009-03-26 23:16:20','w','w');
-INSERT INTO `t4` VALUES (63,2,NULL,'2006-06-21','2006-06-21','02:13:59','02:13:59','2003-02-06 18:12:15','2003-02-06 18:12:15','w','w');
-INSERT INTO `t4` VALUES (64,2,7,NULL,NULL,'02:54:47','02:54:47','2006-06-05 03:22:51','2006-06-05 03:22:51','k','k');
-INSERT INTO `t4` VALUES (65,8,1,'2005-12-16','2005-12-16','18:13:59','18:13:59','2002-02-10 05:47:27','2002-02-10 05:47:27','a','a');
-INSERT INTO `t4` VALUES (66,6,9,'2004-11-05','2004-11-05','13:53:08','13:53:08','2001-08-01 08:50:52','2001-08-01 08:50:52','t','t');
-INSERT INTO `t4` VALUES (67,1,6,NULL,NULL,'22:21:30','22:21:30','1900-01-01 00:00:00','1900-01-01 00:00:00','z','z');
-INSERT INTO `t4` VALUES (68,NULL,2,'2004-09-14','2004-09-14','11:41:50','11:41:50',NULL,NULL,'e','e');
-INSERT INTO `t4` VALUES (69,1,3,'2002-04-06','2002-04-06','15:20:02','15:20:02','1900-01-01 00:00:00','1900-01-01 00:00:00','q','q');
-INSERT INTO `t4` VALUES (70,0,0,NULL,NULL,NULL,NULL,'2000-09-23 00:00:00','2000-09-23 00:00:00','e','e');
-INSERT INTO `t4` VALUES (71,4,NULL,'2002-11-13','2002-11-13',NULL,NULL,'2007-07-09 08:32:49','2007-07-09 08:32:49','v','v');
-INSERT INTO `t4` VALUES (72,1,6,'2006-05-27','2006-05-27','07:51:52','07:51:52','2000-01-05 00:00:00','2000-01-05 00:00:00','d','d');
-INSERT INTO `t4` VALUES (73,1,3,'2000-12-22','2000-12-22','00:00:00','00:00:00','2000-09-24 00:00:00','2000-09-24 00:00:00','u','u');
-INSERT INTO `t4` VALUES (74,27,195,'2004-02-21','2004-02-21',NULL,NULL,'2005-05-06 00:00:00','2005-05-06 00:00:00','o','o');
-INSERT INTO `t4` VALUES (75,4,5,'2009-05-15','2009-05-15',NULL,NULL,'2000-03-11 00:00:00','2000-03-11 00:00:00','b','b');
-INSERT INTO `t4` VALUES (76,6,2,'2008-12-12','2008-12-12','12:31:05','12:31:05','2001-09-02 16:17:35','2001-09-02 16:17:35','c','c');
-INSERT INTO `t4` VALUES (77,2,7,'2000-04-15','2000-04-15','00:00:00','00:00:00','2006-04-25 05:43:44','2006-04-25 05:43:44','q','q');
-INSERT INTO `t4` VALUES (78,248,25,NULL,NULL,'01:16:45','01:16:45','2009-10-25 22:04:02','2009-10-25 22:04:02',NULL,NULL);
-INSERT INTO `t4` VALUES (79,NULL,NULL,'2001-10-18','2001-10-18','20:38:54','20:38:54','2004-08-06 00:00:00','2004-08-06 00:00:00','h','h');
-INSERT INTO `t4` VALUES (80,9,0,'2008-05-25','2008-05-25','00:30:15','00:30:15','2001-11-27 05:07:57','2001-11-27 05:07:57','d','d');
-INSERT INTO `t4` VALUES (81,75,98,'2004-12-02','2004-12-02','23:46:36','23:46:36','2009-06-28 03:18:39','2009-06-28 03:18:39','w','w');
-INSERT INTO `t4` VALUES (82,2,6,'2002-02-15','2002-02-15','19:03:13','19:03:13','2000-03-12 00:00:00','2000-03-12 00:00:00','m','m');
-INSERT INTO `t4` VALUES (83,9,5,'2002-03-03','2002-03-03','10:54:27','10:54:27',NULL,NULL,'i','i');
-INSERT INTO `t4` VALUES (84,4,0,NULL,NULL,'00:25:47','00:25:47','2007-10-20 00:00:00','2007-10-20 00:00:00','w','w');
-INSERT INTO `t4` VALUES (85,0,3,'2003-01-26','2003-01-26','08:44:27','08:44:27','2009-09-27 00:00:00','2009-09-27 00:00:00','f','f');
-INSERT INTO `t4` VALUES (86,0,1,'2001-12-19','2001-12-19','08:15:38','08:15:38','2002-07-16 00:00:00','2002-07-16 00:00:00','k','k');
-INSERT INTO `t4` VALUES (87,1,1,'2001-08-07','2001-08-07','19:56:21','19:56:21','2005-02-20 00:00:00','2005-02-20 00:00:00','v','v');
-INSERT INTO `t4` VALUES (88,119,147,'2005-02-16','2005-02-16','00:00:00','00:00:00',NULL,NULL,'c','c');
-INSERT INTO `t4` VALUES (89,1,3,'2006-06-10','2006-06-10','20:50:52','20:50:52','2001-07-16 00:00:00','2001-07-16 00:00:00','y','y');
-INSERT INTO `t4` VALUES (90,7,3,NULL,NULL,'03:54:39','03:54:39','2009-05-20 21:04:12','2009-05-20 21:04:12','h','h');
-INSERT INTO `t4` VALUES (91,2,NULL,'2005-04-06','2005-04-06','23:58:17','23:58:17','2002-03-13 10:55:40','2002-03-13 10:55:40',NULL,NULL);
-INSERT INTO `t4` VALUES (92,7,2,'2003-04-27','2003-04-27','12:54:58','12:54:58','2005-07-12 00:00:00','2005-07-12 00:00:00','t','t');
-INSERT INTO `t4` VALUES (93,2,1,'2005-10-13','2005-10-13','04:02:43','04:02:43','2006-07-22 09:46:34','2006-07-22 09:46:34','l','l');
-INSERT INTO `t4` VALUES (94,6,8,'2003-10-02','2003-10-02','11:31:12','11:31:12','2001-09-01 00:00:00','2001-09-01 00:00:00','a','a');
-INSERT INTO `t4` VALUES (95,4,8,'2005-09-09','2005-09-09','20:20:04','20:20:04','2002-05-27 18:38:45','2002-05-27 18:38:45','r','r');
-INSERT INTO `t4` VALUES (96,5,8,NULL,NULL,'00:22:24','00:22:24',NULL,NULL,'s','s');
-INSERT INTO `t4` VALUES (97,7,0,'2006-02-15','2006-02-15','10:09:31','10:09:31',NULL,NULL,'z','z');
-INSERT INTO `t4` VALUES (98,1,1,'1900-01-01','1900-01-01',NULL,NULL,'2009-08-08 22:38:53','2009-08-08 22:38:53','j','j');
-INSERT INTO `t4` VALUES (99,7,8,'2003-12-24','2003-12-24','18:45:35','18:45:35',NULL,NULL,'c','c');
-INSERT INTO `t4` VALUES (100,2,5,'2001-07-26','2001-07-26','11:49:25','11:49:25','2007-04-25 05:08:49','2007-04-25 05:08:49','f','f');
-
-SET @@optimizer_switch='subquery_cache=off';
-
-/* cache is off */ SELECT COUNT( DISTINCT table2 .`col_int_key` ) , (
-SELECT SUBQUERY2_t1 .`col_int_key`
-FROM t3 SUBQUERY2_t1 JOIN t2 ON SUBQUERY2_t1 .`col_int_key`
-WHERE table1 .`col_varchar_key` ) , table2 .`col_varchar_nokey` field10
-FROM t4 table1 JOIN ( t1 table2 STRAIGHT_JOIN t1 table3 ON table2 .`pk` ) ON table3 .`col_varchar_key` = table2 .`col_varchar_key`
-GROUP BY field10 ;
-
-SET @@optimizer_switch='subquery_cache=on';
-
-/* cache is on */ SELECT COUNT( DISTINCT table2 .`col_int_key` ) , (
-SELECT SUBQUERY2_t1 .`col_int_key`
-FROM t3 SUBQUERY2_t1 JOIN t2 ON SUBQUERY2_t1 .`col_int_key`
-WHERE table1 .`col_varchar_key` ) , table2 .`col_varchar_nokey` field10
-FROM t4 table1 JOIN ( t1 table2 STRAIGHT_JOIN t1 table3 ON table2 .`pk` ) ON table3 .`col_varchar_key` = table2 .`col_varchar_key`
-GROUP BY field10 ;
-
-drop table t1,t2,t3,t4;
-set @@optimizer_switch= default;
-
-#
---echo #launchpad BUG#609045
-#
-CREATE TABLE `t2` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `col_int_nokey` int(11) DEFAULT NULL,
- `col_int_key` int(11) DEFAULT NULL,
- `col_varchar_key` varchar(1) DEFAULT NULL,
- `col_varchar_nokey` varchar(1) DEFAULT NULL,
- PRIMARY KEY (`pk`),
- KEY `col_int_key` (`col_int_key`),
- KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
-) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1;
-INSERT INTO `t2` VALUES (10,7,8,'v','v');
-INSERT INTO `t2` VALUES (11,1,9,'r','r');
-INSERT INTO `t2` VALUES (12,5,9,'a','a');
-INSERT INTO `t2` VALUES (13,3,186,'m','m');
-INSERT INTO `t2` VALUES (14,6,NULL,'y','y');
-INSERT INTO `t2` VALUES (15,92,2,'j','j');
-INSERT INTO `t2` VALUES (16,7,3,'d','d');
-INSERT INTO `t2` VALUES (17,NULL,0,'z','z');
-INSERT INTO `t2` VALUES (18,3,133,'e','e');
-INSERT INTO `t2` VALUES (19,5,1,'h','h');
-INSERT INTO `t2` VALUES (20,1,8,'b','b');
-INSERT INTO `t2` VALUES (21,2,5,'s','s');
-INSERT INTO `t2` VALUES (22,NULL,5,'e','e');
-INSERT INTO `t2` VALUES (23,1,8,'j','j');
-INSERT INTO `t2` VALUES (24,0,6,'e','e');
-INSERT INTO `t2` VALUES (25,210,51,'f','f');
-INSERT INTO `t2` VALUES (26,8,4,'v','v');
-INSERT INTO `t2` VALUES (27,7,7,'x','x');
-INSERT INTO `t2` VALUES (28,5,6,'m','m');
-INSERT INTO `t2` VALUES (29,NULL,4,'c','c');
-CREATE TABLE `t1` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `col_int_nokey` int(11) DEFAULT NULL,
- `col_int_key` int(11) DEFAULT NULL,
- `col_varchar_key` varchar(1) DEFAULT NULL,
- `col_varchar_nokey` varchar(1) DEFAULT NULL,
- PRIMARY KEY (`pk`),
- KEY `col_int_key` (`col_int_key`),
- KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
-) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;
-INSERT INTO `t1` VALUES (1,NULL,2,'w','w');
-INSERT INTO `t1` VALUES (2,7,9,'m','m');
-INSERT INTO `t1` VALUES (3,9,3,'m','m');
-INSERT INTO `t1` VALUES (4,7,9,'k','k');
-INSERT INTO `t1` VALUES (5,4,NULL,'r','r');
-INSERT INTO `t1` VALUES (6,2,9,'t','t');
-INSERT INTO `t1` VALUES (7,6,3,'j','j');
-INSERT INTO `t1` VALUES (8,8,8,'u','u');
-INSERT INTO `t1` VALUES (9,NULL,8,'h','h');
-INSERT INTO `t1` VALUES (10,5,53,'o','o');
-INSERT INTO `t1` VALUES (11,NULL,0,NULL,NULL);
-INSERT INTO `t1` VALUES (12,6,5,'k','k');
-INSERT INTO `t1` VALUES (13,188,166,'e','e');
-INSERT INTO `t1` VALUES (14,2,3,'n','n');
-INSERT INTO `t1` VALUES (15,1,0,'t','t');
-INSERT INTO `t1` VALUES (16,1,1,'c','c');
-INSERT INTO `t1` VALUES (17,0,9,'m','m');
-INSERT INTO `t1` VALUES (18,9,5,'y','y');
-INSERT INTO `t1` VALUES (19,NULL,6,'f','f');
-INSERT INTO `t1` VALUES (20,4,2,'d','d');
-
-SET @@optimizer_switch = 'subquery_cache=off';
-
-/* cache is off */ SELECT SUM( DISTINCT table1 .`pk` ) , (
- SELECT MAX( `col_int_nokey` )
- FROM t1
- WHERE table1 .`pk` ) field3
-FROM t1 table1
-JOIN (
- t1 table2
- JOIN t2 table3
- ON table3 .`col_varchar_key` = table2 .`col_varchar_key`
-)
-ON table3 .`col_varchar_key` = table2 .`col_varchar_nokey`
-GROUP BY field3 ;
-
-SET @@optimizer_switch = 'subquery_cache=on';
-
-/* cache is on */ SELECT SUM( DISTINCT table1 .`pk` ) , (
- SELECT MAX( `col_int_nokey` )
- FROM t1
- WHERE table1 .`pk` ) field3
-FROM t1 table1
-JOIN (
- t1 table2
- JOIN t2 table3
- ON table3 .`col_varchar_key` = table2 .`col_varchar_key`
-)
-ON table3 .`col_varchar_key` = table2 .`col_varchar_nokey`
-GROUP BY field3 ;
-
-drop table t1,t2;
-set @@optimizer_switch= default;
-
-#
---echo #launchpad BUG#609052
-#
-CREATE TABLE `t2` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `col_int_nokey` int(11) DEFAULT NULL,
- `col_int_key` int(11) DEFAULT NULL,
- `col_time_key` time DEFAULT NULL,
- `col_varchar_key` varchar(1) DEFAULT NULL,
- `col_varchar_nokey` varchar(1) DEFAULT NULL,
- PRIMARY KEY (`pk`),
- KEY `col_int_key` (`col_int_key`),
- KEY `col_time_key` (`col_time_key`),
- KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
-) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1;
-INSERT INTO `t2` VALUES (10,7,8,'01:27:35','v','v');
-INSERT INTO `t2` VALUES (11,1,9,'19:48:31','r','r');
-INSERT INTO `t2` VALUES (12,5,9,'00:00:00','a','a');
-INSERT INTO `t2` VALUES (13,3,186,'19:53:05','m','m');
-INSERT INTO `t2` VALUES (14,6,NULL,'19:18:56','y','y');
-INSERT INTO `t2` VALUES (15,92,2,'10:55:12','j','j');
-INSERT INTO `t2` VALUES (16,7,3,'00:25:00','d','d');
-INSERT INTO `t2` VALUES (17,NULL,0,'12:35:47','z','z');
-INSERT INTO `t2` VALUES (18,3,133,'19:53:03','e','e');
-INSERT INTO `t2` VALUES (19,5,1,'17:53:30','h','h');
-INSERT INTO `t2` VALUES (20,1,8,'11:35:49','b','b');
-INSERT INTO `t2` VALUES (21,2,5,NULL,'s','s');
-INSERT INTO `t2` VALUES (22,NULL,5,'06:01:40','e','e');
-INSERT INTO `t2` VALUES (23,1,8,'05:45:11','j','j');
-INSERT INTO `t2` VALUES (24,0,6,'00:00:00','e','e');
-INSERT INTO `t2` VALUES (25,210,51,'00:00:00','f','f');
-INSERT INTO `t2` VALUES (26,8,4,'06:11:01','v','v');
-INSERT INTO `t2` VALUES (27,7,7,'13:02:46','x','x');
-INSERT INTO `t2` VALUES (28,5,6,'21:44:25','m','m');
-INSERT INTO `t2` VALUES (29,NULL,4,'22:43:58','c','c');
-CREATE TABLE `t4` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `col_int_nokey` int(11) DEFAULT NULL,
- `col_int_key` int(11) DEFAULT NULL,
- `col_time_key` time DEFAULT NULL,
- `col_varchar_key` varchar(1) DEFAULT NULL,
- `col_varchar_nokey` varchar(1) DEFAULT NULL,
- PRIMARY KEY (`pk`),
- KEY `col_int_key` (`col_int_key`),
- KEY `col_time_key` (`col_time_key`),
- KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
-) ENGINE=MyISAM AUTO_INCREMENT=101 DEFAULT CHARSET=latin1;
-INSERT INTO `t4` VALUES (1,6,NULL,NULL,'r','r');
-INSERT INTO `t4` VALUES (2,8,0,'14:34:45','c','c');
-INSERT INTO `t4` VALUES (3,6,0,'11:49:48','o','o');
-INSERT INTO `t4` VALUES (4,6,7,'18:12:55','c','c');
-INSERT INTO `t4` VALUES (5,3,8,'18:30:05','d','d');
-INSERT INTO `t4` VALUES (6,9,4,'14:19:30','v','v');
-INSERT INTO `t4` VALUES (7,2,6,'05:20:04','m','m');
-INSERT INTO `t4` VALUES (8,1,5,'20:29:31','j','j');
-INSERT INTO `t4` VALUES (9,8,NULL,'07:08:09','f','f');
-INSERT INTO `t4` VALUES (10,0,NULL,'14:49:14','n','n');
-INSERT INTO `t4` VALUES (11,9,8,'00:00:00','z','z');
-INSERT INTO `t4` VALUES (12,8,8,'09:58:06','h','h');
-INSERT INTO `t4` VALUES (13,NULL,8,NULL,'q','q');
-INSERT INTO `t4` VALUES (14,0,1,'18:24:16','w','w');
-INSERT INTO `t4` VALUES (15,5,1,'17:39:57','z','z');
-INSERT INTO `t4` VALUES (16,1,5,'08:23:21','j','j');
-INSERT INTO `t4` VALUES (17,1,2,NULL,'a','a');
-INSERT INTO `t4` VALUES (18,6,7,'21:50:46','m','m');
-INSERT INTO `t4` VALUES (19,6,6,'12:33:17','n','n');
-INSERT INTO `t4` VALUES (20,1,4,'03:06:43','e','e');
-INSERT INTO `t4` VALUES (21,8,7,'03:46:14','u','u');
-INSERT INTO `t4` VALUES (22,1,0,'20:34:52','s','s');
-INSERT INTO `t4` VALUES (23,0,9,NULL,'u','u');
-INSERT INTO `t4` VALUES (24,4,3,'10:41:20','r','r');
-INSERT INTO `t4` VALUES (25,9,5,'08:43:11','g','g');
-INSERT INTO `t4` VALUES (26,8,1,NULL,'o','o');
-INSERT INTO `t4` VALUES (27,5,1,'10:17:51','w','w');
-INSERT INTO `t4` VALUES (28,9,5,'06:34:09','b','b');
-INSERT INTO `t4` VALUES (29,5,9,'21:22:47',NULL,NULL);
-INSERT INTO `t4` VALUES (30,NULL,2,'04:02:32','y','y');
-INSERT INTO `t4` VALUES (31,NULL,5,'02:33:14','y','y');
-INSERT INTO `t4` VALUES (32,105,248,'16:32:56','u','u');
-INSERT INTO `t4` VALUES (33,0,0,'21:32:42','p','p');
-INSERT INTO `t4` VALUES (34,3,8,'23:04:47','s','s');
-INSERT INTO `t4` VALUES (35,1,1,'22:05:43','e','e');
-INSERT INTO `t4` VALUES (36,75,255,'02:05:45','d','d');
-INSERT INTO `t4` VALUES (37,9,9,'00:00:00','d','d');
-INSERT INTO `t4` VALUES (38,7,9,'18:09:07','c','c');
-INSERT INTO `t4` VALUES (39,NULL,3,'10:54:06','b','b');
-INSERT INTO `t4` VALUES (40,NULL,9,'23:15:50','t','t');
-INSERT INTO `t4` VALUES (41,4,6,'10:17:40',NULL,NULL);
-INSERT INTO `t4` VALUES (42,0,4,'03:37:09','y','y');
-INSERT INTO `t4` VALUES (43,204,60,'22:26:06','c','c');
-INSERT INTO `t4` VALUES (44,0,7,'17:10:38','d','d');
-INSERT INTO `t4` VALUES (45,9,1,'00:00:00','x','x');
-INSERT INTO `t4` VALUES (46,8,6,'17:08:49','p','p');
-INSERT INTO `t4` VALUES (47,7,4,'19:04:40','e','e');
-INSERT INTO `t4` VALUES (48,8,NULL,'20:53:28','g','g');
-INSERT INTO `t4` VALUES (49,NULL,8,'11:46:03','x','x');
-INSERT INTO `t4` VALUES (50,6,0,NULL,'s','s');
-INSERT INTO `t4` VALUES (51,5,8,'10:58:07','e','e');
-INSERT INTO `t4` VALUES (52,2,151,'00:00:00','l','l');
-INSERT INTO `t4` VALUES (53,3,7,'09:43:15','p','p');
-INSERT INTO `t4` VALUES (54,7,6,'21:40:32','h','h');
-INSERT INTO `t4` VALUES (55,NULL,NULL,'00:17:44','m','m');
-INSERT INTO `t4` VALUES (56,145,23,'16:47:26','n','n');
-INSERT INTO `t4` VALUES (57,0,2,'00:00:00','v','v');
-INSERT INTO `t4` VALUES (58,1,4,'05:25:59','b','b');
-INSERT INTO `t4` VALUES (59,7,NULL,'00:00:00','x','x');
-INSERT INTO `t4` VALUES (60,3,NULL,'20:33:04','r','r');
-INSERT INTO `t4` VALUES (61,NULL,77,'00:46:12','t','t');
-INSERT INTO `t4` VALUES (62,2,NULL,'00:00:00','w','w');
-INSERT INTO `t4` VALUES (63,2,NULL,'02:13:59','w','w');
-INSERT INTO `t4` VALUES (64,2,7,'02:54:47','k','k');
-INSERT INTO `t4` VALUES (65,8,1,'18:13:59','a','a');
-INSERT INTO `t4` VALUES (66,6,9,'13:53:08','t','t');
-INSERT INTO `t4` VALUES (67,1,6,'22:21:30','z','z');
-INSERT INTO `t4` VALUES (68,NULL,2,'11:41:50','e','e');
-INSERT INTO `t4` VALUES (69,1,3,'15:20:02','q','q');
-INSERT INTO `t4` VALUES (70,0,0,NULL,'e','e');
-INSERT INTO `t4` VALUES (71,4,NULL,NULL,'v','v');
-INSERT INTO `t4` VALUES (72,1,6,'07:51:52','d','d');
-INSERT INTO `t4` VALUES (73,1,3,'00:00:00','u','u');
-INSERT INTO `t4` VALUES (74,27,195,NULL,'o','o');
-INSERT INTO `t4` VALUES (75,4,5,NULL,'b','b');
-INSERT INTO `t4` VALUES (76,6,2,'12:31:05','c','c');
-INSERT INTO `t4` VALUES (77,2,7,'00:00:00','q','q');
-INSERT INTO `t4` VALUES (78,248,25,'01:16:45',NULL,NULL);
-INSERT INTO `t4` VALUES (79,NULL,NULL,'20:38:54','h','h');
-INSERT INTO `t4` VALUES (80,9,0,'00:30:15','d','d');
-INSERT INTO `t4` VALUES (81,75,98,'23:46:36','w','w');
-INSERT INTO `t4` VALUES (82,2,6,'19:03:13','m','m');
-INSERT INTO `t4` VALUES (83,9,5,'10:54:27','i','i');
-INSERT INTO `t4` VALUES (84,4,0,'00:25:47','w','w');
-INSERT INTO `t4` VALUES (85,0,3,'08:44:27','f','f');
-INSERT INTO `t4` VALUES (86,0,1,'08:15:38','k','k');
-INSERT INTO `t4` VALUES (87,1,1,'19:56:21','v','v');
-INSERT INTO `t4` VALUES (88,119,147,'00:00:00','c','c');
-INSERT INTO `t4` VALUES (89,1,3,'20:50:52','y','y');
-INSERT INTO `t4` VALUES (90,7,3,'03:54:39','h','h');
-INSERT INTO `t4` VALUES (91,2,NULL,'23:58:17',NULL,NULL);
-INSERT INTO `t4` VALUES (92,7,2,'12:54:58','t','t');
-INSERT INTO `t4` VALUES (93,2,1,'04:02:43','l','l');
-INSERT INTO `t4` VALUES (94,6,8,'11:31:12','a','a');
-INSERT INTO `t4` VALUES (95,4,8,'20:20:04','r','r');
-INSERT INTO `t4` VALUES (96,5,8,'00:22:24','s','s');
-INSERT INTO `t4` VALUES (97,7,0,'10:09:31','z','z');
-INSERT INTO `t4` VALUES (98,1,1,NULL,'j','j');
-INSERT INTO `t4` VALUES (99,7,8,'18:45:35','c','c');
-INSERT INTO `t4` VALUES (100,2,5,'11:49:25','f','f');
-CREATE TABLE `t1` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `col_int_nokey` int(11) DEFAULT NULL,
- `col_int_key` int(11) DEFAULT NULL,
- `col_time_key` time DEFAULT NULL,
- `col_varchar_key` varchar(1) DEFAULT NULL,
- `col_varchar_nokey` varchar(1) DEFAULT NULL,
- PRIMARY KEY (`pk`),
- KEY `col_int_key` (`col_int_key`),
- KEY `col_time_key` (`col_time_key`),
- KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
-) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;
-INSERT INTO `t1` VALUES (1,NULL,2,'11:28:45','w','w');
-INSERT INTO `t1` VALUES (2,7,9,'20:25:14','m','m');
-INSERT INTO `t1` VALUES (3,9,3,'13:47:24','m','m');
-INSERT INTO `t1` VALUES (4,7,9,'19:24:11','k','k');
-INSERT INTO `t1` VALUES (5,4,NULL,'15:59:13','r','r');
-INSERT INTO `t1` VALUES (6,2,9,'00:00:00','t','t');
-INSERT INTO `t1` VALUES (7,6,3,'15:15:04','j','j');
-INSERT INTO `t1` VALUES (8,8,8,'11:32:06','u','u');
-INSERT INTO `t1` VALUES (9,NULL,8,'18:32:33','h','h');
-INSERT INTO `t1` VALUES (10,5,53,'15:19:25','o','o');
-INSERT INTO `t1` VALUES (11,NULL,0,'19:03:19',NULL,NULL);
-INSERT INTO `t1` VALUES (12,6,5,'00:39:46','k','k');
-INSERT INTO `t1` VALUES (13,188,166,NULL,'e','e');
-INSERT INTO `t1` VALUES (14,2,3,'00:00:00','n','n');
-INSERT INTO `t1` VALUES (15,1,0,'13:12:11','t','t');
-INSERT INTO `t1` VALUES (16,1,1,'04:56:48','c','c');
-INSERT INTO `t1` VALUES (17,0,9,'19:56:05','m','m');
-INSERT INTO `t1` VALUES (18,9,5,'19:35:19','y','y');
-INSERT INTO `t1` VALUES (19,NULL,6,'05:03:03','f','f');
-INSERT INTO `t1` VALUES (20,4,2,'18:38:59','d','d');
-CREATE TABLE `t3` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `col_int_nokey` int(11) DEFAULT NULL,
- `col_int_key` int(11) DEFAULT NULL,
- `col_time_key` time DEFAULT NULL,
- `col_varchar_key` varchar(1) DEFAULT NULL,
- `col_varchar_nokey` varchar(1) DEFAULT NULL,
- PRIMARY KEY (`pk`),
- KEY `col_int_key` (`col_int_key`),
- KEY `col_time_key` (`col_time_key`),
- KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
-) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
-INSERT INTO `t3` VALUES (10,8,8,'18:27:58',NULL,NULL);
-CREATE TABLE `t5` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `col_int_nokey` int(11) DEFAULT NULL,
- `col_int_key` int(11) DEFAULT NULL,
- `col_time_key` time DEFAULT NULL,
- `col_varchar_key` varchar(1) DEFAULT NULL,
- `col_varchar_nokey` varchar(1) DEFAULT NULL,
- PRIMARY KEY (`pk`),
- KEY `col_int_key` (`col_int_key`),
- KEY `col_time_key` (`col_time_key`),
- KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
-) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
-INSERT INTO `t5` VALUES (1,1,7,'01:13:38','f','f');
-
-
-SET @@optimizer_switch='subquery_cache=off';
-
-/* cache is off */ SELECT SQL_SMALL_RESULT MAX( DISTINCT table1 . `col_varchar_key` ) AS field1 , MIN( table1 . `col_varchar_nokey` ) AS field2 , COUNT( table1 . `col_varchar_key` ) AS field3 , table2 . `col_time_key` AS field4 , COUNT( DISTINCT table2 . `col_int_key` ) AS field5 , (
-SELECT MAX( SUBQUERY1_t2 . `col_int_nokey` ) AS SUBQUERY1_field1
-FROM ( t3 AS SUBQUERY1_t1 INNER JOIN t1 AS SUBQUERY1_t2 ON (SUBQUERY1_t2 . `col_varchar_key` = SUBQUERY1_t1 . `col_varchar_nokey` ) )
-WHERE SUBQUERY1_t2 . `pk` < SUBQUERY1_t2 . `pk` ) AS field6 , COUNT( table1 . `col_varchar_nokey` ) AS field7 , COUNT( table2 . `pk` ) AS field8 , (
-SELECT MAX( SUBQUERY2_t1 . `col_int_key` ) AS SUBQUERY2_field1
-FROM ( t5 AS SUBQUERY2_t1 LEFT JOIN t2 AS SUBQUERY2_t2 ON (SUBQUERY2_t2 . `col_int_key` = SUBQUERY2_t1 . `col_int_key` ) )
-WHERE SUBQUERY2_t2 . `col_varchar_nokey` != table1 . `col_varchar_key` OR SUBQUERY2_t1 . `col_varchar_nokey` >= 'o' ) AS field9 , CONCAT ( table1 . `col_varchar_key` , table2 . `col_varchar_nokey` ) AS field10
-FROM ( t4 AS table1 LEFT JOIN ( ( t1 AS table2 STRAIGHT_JOIN t1 AS table3 ON (table3 . `col_int_nokey` = table2 . `pk` ) ) ) ON (table3 . `col_varchar_key` = table2 . `col_varchar_key` ) )
-WHERE ( EXISTS (
-SELECT SUBQUERY3_t1 . `pk` AS SUBQUERY3_field1
-FROM ( t4 AS SUBQUERY3_t1 INNER JOIN t4 AS SUBQUERY3_t2 ON (SUBQUERY3_t2 . `col_varchar_key` = SUBQUERY3_t1 . `col_varchar_key` ) )
-WHERE SUBQUERY3_t1 . `col_int_key` > table3 . `pk` AND SUBQUERY3_t1 . `pk` != table3 . `pk` ) ) AND ( table1 . `pk` > 116 AND table1 . `pk` < ( 116 + 175 ) OR table1 . `pk` IN (251) ) OR table1 . `col_int_nokey` = table1 . `col_int_nokey`
-GROUP BY field4, field6, field9, field10
-HAVING field10 = 'c'
-;
-
-SET @@optimizer_switch='subquery_cache=on';
-
-/* cache is on */ SELECT SQL_SMALL_RESULT MAX( DISTINCT table1 . `col_varchar_key` ) AS field1 , MIN( table1 . `col_varchar_nokey` ) AS field2 , COUNT( table1 . `col_varchar_key` ) AS field3 , table2 . `col_time_key` AS field4 , COUNT( DISTINCT table2 . `col_int_key` ) AS field5 , (
-SELECT MAX( SUBQUERY1_t2 . `col_int_nokey` ) AS SUBQUERY1_field1
-FROM ( t3 AS SUBQUERY1_t1 INNER JOIN t1 AS SUBQUERY1_t2 ON (SUBQUERY1_t2 . `col_varchar_key` = SUBQUERY1_t1 . `col_varchar_nokey` ) )
-WHERE SUBQUERY1_t2 . `pk` < SUBQUERY1_t2 . `pk` ) AS field6 , COUNT( table1 . `col_varchar_nokey` ) AS field7 , COUNT( table2 . `pk` ) AS field8 , (
-SELECT MAX( SUBQUERY2_t1 . `col_int_key` ) AS SUBQUERY2_field1
-FROM ( t5 AS SUBQUERY2_t1 LEFT JOIN t2 AS SUBQUERY2_t2 ON (SUBQUERY2_t2 . `col_int_key` = SUBQUERY2_t1 . `col_int_key` ) )
-WHERE SUBQUERY2_t2 . `col_varchar_nokey` != table1 . `col_varchar_key` OR SUBQUERY2_t1 . `col_varchar_nokey` >= 'o' ) AS field9 , CONCAT ( table1 . `col_varchar_key` , table2 . `col_varchar_nokey` ) AS field10
-FROM ( t4 AS table1 LEFT JOIN ( ( t1 AS table2 STRAIGHT_JOIN t1 AS table3 ON (table3 . `col_int_nokey` = table2 . `pk` ) ) ) ON (table3 . `col_varchar_key` = table2 . `col_varchar_key` ) )
-WHERE ( EXISTS (
-SELECT SUBQUERY3_t1 . `pk` AS SUBQUERY3_field1
-FROM ( t4 AS SUBQUERY3_t1 INNER JOIN t4 AS SUBQUERY3_t2 ON (SUBQUERY3_t2 . `col_varchar_key` = SUBQUERY3_t1 . `col_varchar_key` ) )
-WHERE SUBQUERY3_t1 . `col_int_key` > table3 . `pk` AND SUBQUERY3_t1 . `pk` != table3 . `pk` ) ) AND ( table1 . `pk` > 116 AND table1 . `pk` < ( 116 + 175 ) OR table1 . `pk` IN (251) ) OR table1 . `col_int_nokey` = table1 . `col_int_nokey`
-GROUP BY field4, field6, field9, field10
-HAVING field10 = 'c'
-;
-
-drop table t1,t2,t3,t4,t5;
-set @@optimizer_switch= default;
-
-
-#
---echo #launchpad BUG#609043
-#
-CREATE TABLE `t1` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `col_int_nokey` int(11) DEFAULT NULL,
- `col_int_key` int(11) DEFAULT NULL,
- `col_date_key` date DEFAULT NULL,
- `col_date_nokey` date DEFAULT NULL,
- `col_time_key` time DEFAULT NULL,
- `col_time_nokey` time DEFAULT NULL,
- `col_datetime_key` datetime DEFAULT NULL,
- `col_datetime_nokey` datetime DEFAULT NULL,
- `col_varchar_key` varchar(1) DEFAULT NULL,
- `col_varchar_nokey` varchar(1) DEFAULT NULL,
- PRIMARY KEY (`pk`),
- KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
-) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;
-INSERT INTO `t1` VALUES (19,NULL,6,'2004-08-20','2004-08-20','05:03:03','05:03:03','2007-04-19 00:19:53','2007-04-19 00:19:53','f','f');
-INSERT INTO `t1` VALUES (20,4,2,'1900-01-01','1900-01-01','18:38:59','18:38:59','1900-01-01 00:00:00','1900-01-01 00:00:00','d','d');
-
-CREATE TABLE `t2` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `col_int_nokey` int(11) DEFAULT NULL,
- `col_int_key` int(11) DEFAULT NULL,
- `col_date_key` date DEFAULT NULL,
- `col_date_nokey` date DEFAULT NULL,
- `col_time_key` time DEFAULT NULL,
- `col_time_nokey` time DEFAULT NULL,
- `col_datetime_key` datetime DEFAULT NULL,
- `col_datetime_nokey` datetime DEFAULT NULL,
- `col_varchar_key` varchar(1) DEFAULT NULL,
- `col_varchar_nokey` varchar(1) DEFAULT NULL,
- PRIMARY KEY (`pk`),
- KEY `col_int_key` (`col_int_key`),
- KEY `col_date_key` (`col_date_key`),
- KEY `col_time_key` (`col_time_key`),
- KEY `col_datetime_key` (`col_datetime_key`),
- KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
-) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1;
-
-CREATE TABLE `t3` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `col_int_nokey` int(11) DEFAULT NULL,
- `col_int_key` int(11) DEFAULT NULL,
- `col_date_key` date DEFAULT NULL,
- `col_date_nokey` date DEFAULT NULL,
- `col_time_key` time DEFAULT NULL,
- `col_time_nokey` time DEFAULT NULL,
- `col_datetime_key` datetime DEFAULT NULL,
- `col_datetime_nokey` datetime DEFAULT NULL,
- `col_varchar_key` varchar(1) DEFAULT NULL,
- `col_varchar_nokey` varchar(1) DEFAULT NULL,
- PRIMARY KEY (`pk`),
- KEY `col_int_key` (`col_int_key`),
- KEY `col_date_key` (`col_date_key`),
- KEY `col_time_key` (`col_time_key`),
- KEY `col_datetime_key` (`col_datetime_key`),
- KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
-) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
-
-CREATE TABLE `t4` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `col_int_nokey` int(11) DEFAULT NULL,
- `col_int_key` int(11) DEFAULT NULL,
- `col_date_key` date DEFAULT NULL,
- `col_date_nokey` date DEFAULT NULL,
- `col_time_key` time DEFAULT NULL,
- `col_time_nokey` time DEFAULT NULL,
- `col_datetime_key` datetime DEFAULT NULL,
- `col_datetime_nokey` datetime DEFAULT NULL,
- `col_varchar_key` varchar(1) DEFAULT NULL,
- `col_varchar_nokey` varchar(1) DEFAULT NULL,
- PRIMARY KEY (`pk`),
- KEY `col_int_key` (`col_int_key`),
- KEY `col_date_key` (`col_date_key`),
- KEY `col_time_key` (`col_time_key`),
- KEY `col_datetime_key` (`col_datetime_key`),
- KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
-) ENGINE=MyISAM AUTO_INCREMENT=101 DEFAULT CHARSET=latin1;
-INSERT INTO `t4` VALUES (100,2,5,'2001-07-26','2001-07-26','11:49:25','11:49:25','2007-04-25 05:08:49','2007-04-25 05:08:49','f','f');
-
-SET @@optimizer_switch = 'subquery_cache=off';
-
-/* cache is off */ SELECT COUNT( DISTINCT table2 .`col_int_key` ) , (
-SELECT SUBQUERY2_t1 .`col_int_key`
-FROM t3 SUBQUERY2_t1 JOIN t2 ON SUBQUERY2_t1 .`col_int_key`
-WHERE table1 .`col_varchar_key` ) , table2 .`col_varchar_nokey` field10
-FROM t4 table1 JOIN ( t1 table2 STRAIGHT_JOIN t1 table3 ON table2 .`pk` ) ON table3 .`col_varchar_key` = table2 .`col_varchar_key`
-GROUP BY field10 ;
-
-SET @@optimizer_switch = 'subquery_cache=on';
-
-/* cache is on */ SELECT COUNT( DISTINCT table2 .`col_int_key` ) , (
-SELECT SUBQUERY2_t1 .`col_int_key`
-FROM t3 SUBQUERY2_t1 JOIN t2 ON SUBQUERY2_t1 .`col_int_key`
-WHERE table1 .`col_varchar_key` ) , table2 .`col_varchar_nokey` field10
-FROM t4 table1 JOIN ( t1 table2 STRAIGHT_JOIN t1 table3 ON table2 .`pk` ) ON table3 .`col_varchar_key` = table2 .`col_varchar_key`
-GROUP BY field10 ;
-
-drop table t1,t2,t3,t4;
-set @@optimizer_switch= default;
-
-#
---echo #launchpad BUG#611625
-#
-CREATE TABLE `t1` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `col_int_nokey` int(11) DEFAULT NULL,
- `col_varchar_nokey` varchar(1) DEFAULT NULL,
- PRIMARY KEY (`pk`)
-) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;
-INSERT INTO `t1` VALUES (1,NULL,'w');
-INSERT INTO `t1` VALUES (2,7,'m');
-INSERT INTO `t1` VALUES (3,9,'m');
-INSERT INTO `t1` VALUES (4,7,'k');
-INSERT INTO `t1` VALUES (5,4,'r');
-INSERT INTO `t1` VALUES (6,2,'t');
-INSERT INTO `t1` VALUES (7,6,'j');
-INSERT INTO `t1` VALUES (8,8,'u');
-INSERT INTO `t1` VALUES (9,NULL,'h');
-INSERT INTO `t1` VALUES (10,5,'o');
-INSERT INTO `t1` VALUES (11,NULL,NULL);
-INSERT INTO `t1` VALUES (12,6,'k');
-INSERT INTO `t1` VALUES (13,188,'e');
-INSERT INTO `t1` VALUES (14,2,'n');
-INSERT INTO `t1` VALUES (15,1,'t');
-INSERT INTO `t1` VALUES (16,1,'c');
-INSERT INTO `t1` VALUES (17,0,'m');
-INSERT INTO `t1` VALUES (18,9,'y');
-INSERT INTO `t1` VALUES (19,NULL,'f');
-INSERT INTO `t1` VALUES (20,4,'d');
-CREATE TABLE `t3` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `col_int_nokey` int(11) DEFAULT NULL,
- `col_varchar_nokey` varchar(1) DEFAULT NULL,
- PRIMARY KEY (`pk`)
-) ENGINE=MyISAM AUTO_INCREMENT=101 DEFAULT CHARSET=latin1;
-INSERT INTO `t3` VALUES (1,6,'r');
-INSERT INTO `t3` VALUES (2,8,'c');
-INSERT INTO `t3` VALUES (3,6,'o');
-INSERT INTO `t3` VALUES (4,6,'c');
-INSERT INTO `t3` VALUES (5,3,'d');
-INSERT INTO `t3` VALUES (6,9,'v');
-INSERT INTO `t3` VALUES (7,2,'m');
-INSERT INTO `t3` VALUES (8,1,'j');
-INSERT INTO `t3` VALUES (9,8,'f');
-INSERT INTO `t3` VALUES (10,0,'n');
-INSERT INTO `t3` VALUES (11,9,'z');
-INSERT INTO `t3` VALUES (12,8,'h');
-INSERT INTO `t3` VALUES (13,NULL,'q');
-INSERT INTO `t3` VALUES (14,0,'w');
-INSERT INTO `t3` VALUES (15,5,'z');
-INSERT INTO `t3` VALUES (16,1,'j');
-INSERT INTO `t3` VALUES (17,1,'a');
-INSERT INTO `t3` VALUES (18,6,'m');
-INSERT INTO `t3` VALUES (19,6,'n');
-INSERT INTO `t3` VALUES (20,1,'e');
-INSERT INTO `t3` VALUES (21,8,'u');
-INSERT INTO `t3` VALUES (22,1,'s');
-INSERT INTO `t3` VALUES (23,0,'u');
-INSERT INTO `t3` VALUES (24,4,'r');
-INSERT INTO `t3` VALUES (25,9,'g');
-INSERT INTO `t3` VALUES (26,8,'o');
-INSERT INTO `t3` VALUES (27,5,'w');
-INSERT INTO `t3` VALUES (28,9,'b');
-INSERT INTO `t3` VALUES (29,5,NULL);
-INSERT INTO `t3` VALUES (30,NULL,'y');
-INSERT INTO `t3` VALUES (31,NULL,'y');
-INSERT INTO `t3` VALUES (32,105,'u');
-INSERT INTO `t3` VALUES (33,0,'p');
-INSERT INTO `t3` VALUES (34,3,'s');
-INSERT INTO `t3` VALUES (35,1,'e');
-INSERT INTO `t3` VALUES (36,75,'d');
-INSERT INTO `t3` VALUES (37,9,'d');
-INSERT INTO `t3` VALUES (38,7,'c');
-INSERT INTO `t3` VALUES (39,NULL,'b');
-INSERT INTO `t3` VALUES (40,NULL,'t');
-INSERT INTO `t3` VALUES (41,4,NULL);
-INSERT INTO `t3` VALUES (42,0,'y');
-INSERT INTO `t3` VALUES (43,204,'c');
-INSERT INTO `t3` VALUES (44,0,'d');
-INSERT INTO `t3` VALUES (45,9,'x');
-INSERT INTO `t3` VALUES (46,8,'p');
-INSERT INTO `t3` VALUES (47,7,'e');
-INSERT INTO `t3` VALUES (48,8,'g');
-INSERT INTO `t3` VALUES (49,NULL,'x');
-INSERT INTO `t3` VALUES (50,6,'s');
-INSERT INTO `t3` VALUES (51,5,'e');
-INSERT INTO `t3` VALUES (52,2,'l');
-INSERT INTO `t3` VALUES (53,3,'p');
-INSERT INTO `t3` VALUES (54,7,'h');
-INSERT INTO `t3` VALUES (55,NULL,'m');
-INSERT INTO `t3` VALUES (56,145,'n');
-INSERT INTO `t3` VALUES (57,0,'v');
-INSERT INTO `t3` VALUES (58,1,'b');
-INSERT INTO `t3` VALUES (59,7,'x');
-INSERT INTO `t3` VALUES (60,3,'r');
-INSERT INTO `t3` VALUES (61,NULL,'t');
-INSERT INTO `t3` VALUES (62,2,'w');
-INSERT INTO `t3` VALUES (63,2,'w');
-INSERT INTO `t3` VALUES (64,2,'k');
-INSERT INTO `t3` VALUES (65,8,'a');
-INSERT INTO `t3` VALUES (66,6,'t');
-INSERT INTO `t3` VALUES (67,1,'z');
-INSERT INTO `t3` VALUES (68,NULL,'e');
-INSERT INTO `t3` VALUES (69,1,'q');
-INSERT INTO `t3` VALUES (70,0,'e');
-INSERT INTO `t3` VALUES (71,4,'v');
-INSERT INTO `t3` VALUES (72,1,'d');
-INSERT INTO `t3` VALUES (73,1,'u');
-INSERT INTO `t3` VALUES (74,27,'o');
-INSERT INTO `t3` VALUES (75,4,'b');
-INSERT INTO `t3` VALUES (76,6,'c');
-INSERT INTO `t3` VALUES (77,2,'q');
-INSERT INTO `t3` VALUES (78,248,NULL);
-INSERT INTO `t3` VALUES (79,NULL,'h');
-INSERT INTO `t3` VALUES (80,9,'d');
-INSERT INTO `t3` VALUES (81,75,'w');
-INSERT INTO `t3` VALUES (82,2,'m');
-INSERT INTO `t3` VALUES (83,9,'i');
-INSERT INTO `t3` VALUES (84,4,'w');
-INSERT INTO `t3` VALUES (85,0,'f');
-INSERT INTO `t3` VALUES (86,0,'k');
-INSERT INTO `t3` VALUES (87,1,'v');
-INSERT INTO `t3` VALUES (88,119,'c');
-INSERT INTO `t3` VALUES (89,1,'y');
-INSERT INTO `t3` VALUES (90,7,'h');
-INSERT INTO `t3` VALUES (91,2,NULL);
-INSERT INTO `t3` VALUES (92,7,'t');
-INSERT INTO `t3` VALUES (93,2,'l');
-INSERT INTO `t3` VALUES (94,6,'a');
-INSERT INTO `t3` VALUES (95,4,'r');
-INSERT INTO `t3` VALUES (96,5,'s');
-INSERT INTO `t3` VALUES (97,7,'z');
-INSERT INTO `t3` VALUES (98,1,'j');
-INSERT INTO `t3` VALUES (99,7,'c');
-INSERT INTO `t3` VALUES (100,2,'f');
-CREATE TABLE `t2` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `col_int_nokey` int(11) DEFAULT NULL,
- `col_varchar_nokey` varchar(1) DEFAULT NULL,
- PRIMARY KEY (`pk`)
-) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
-INSERT INTO `t2` VALUES (10,8,NULL);
-
-set optimizer_switch='subquery_cache=off';
-
-SELECT (
-SELECT `col_int_nokey`
-FROM t3
-WHERE table1 .`col_varchar_nokey` ) field13
-FROM t2 table1 JOIN t1 table2 ON table2 .`pk`
-ORDER BY field13;
-
-set optimizer_switch='subquery_cache=on';
-
-SELECT
- (SELECT `col_int_nokey`
- FROM t3
- WHERE table1 .`col_varchar_nokey` ) field13
-FROM t2 table1 JOIN t1 table2 ON table2 .`pk`
-ORDER BY field13;
-
-drop table t1,t2,t3;
-set @@optimizer_switch= default;
-
-#
---echo # LP BUG#615760 (part 1: double transformation)
-#
-create table t1 (a int);
-insert into t1 values (1),(2);
-create table t2 (b int);
-insert into t2 values (1),(2);
-set optimizer_switch='default,semijoin=off,materialization=off,subquery_cache=on';
-
-explain extended
-select * from t1 where a in (select b from t2);
-
-drop table t1,t2;
-set @@optimizer_switch= default;
-
-#
---echo # LP BUG#615760 (part 2: incorrect heap table index flags)
-#
-SET SESSION optimizer_switch = 'index_merge=off,index_merge_union=off,index_merge_sort_union=off,index_merge_intersection=off,index_condition_pushdown=off,firstmatch=off,loosescan=off,materialization=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=on';
-
-CREATE TABLE `t1` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `col_int_nokey` int(11) DEFAULT NULL,
- `col_int_key` int(11) DEFAULT NULL,
- `col_varchar_key` varchar(1) DEFAULT NULL,
- `col_varchar_nokey` varchar(1) DEFAULT NULL,
- PRIMARY KEY (`pk`),
- KEY `col_int_key` (`col_int_key`),
- KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
-) AUTO_INCREMENT=30 DEFAULT CHARSET=latin1;
-INSERT INTO `t1` VALUES (10,7,8,'v','v');
-INSERT INTO `t1` VALUES (11,1,9,'r','r');
-INSERT INTO `t1` VALUES (12,5,9,'a','a');
-INSERT INTO `t1` VALUES (13,3,186,'m','m');
-INSERT INTO `t1` VALUES (14,6,NULL,'y','y');
-INSERT INTO `t1` VALUES (15,92,2,'j','j');
-INSERT INTO `t1` VALUES (16,7,3,'d','d');
-INSERT INTO `t1` VALUES (17,NULL,0,'z','z');
-INSERT INTO `t1` VALUES (18,3,133,'e','e');
-INSERT INTO `t1` VALUES (19,5,1,'h','h');
-INSERT INTO `t1` VALUES (20,1,8,'b','b');
-INSERT INTO `t1` VALUES (21,2,5,'s','s');
-INSERT INTO `t1` VALUES (22,NULL,5,'e','e');
-INSERT INTO `t1` VALUES (23,1,8,'j','j');
-INSERT INTO `t1` VALUES (24,0,6,'e','e');
-INSERT INTO `t1` VALUES (25,210,51,'f','f');
-INSERT INTO `t1` VALUES (26,8,4,'v','v');
-INSERT INTO `t1` VALUES (27,7,7,'x','x');
-INSERT INTO `t1` VALUES (28,5,6,'m','m');
-INSERT INTO `t1` VALUES (29,NULL,4,'c','c');
-CREATE TABLE `t2` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `col_int_nokey` int(11) DEFAULT NULL,
- `col_int_key` int(11) DEFAULT NULL,
- `col_varchar_key` varchar(1) DEFAULT NULL,
- `col_varchar_nokey` varchar(1) DEFAULT NULL,
- PRIMARY KEY (`pk`),
- KEY `col_int_key` (`col_int_key`),
- KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
-) AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;
-INSERT INTO `t2` VALUES (1,NULL,2,'w','w');
-INSERT INTO `t2` VALUES (2,7,9,'m','m');
-INSERT INTO `t2` VALUES (3,9,3,'m','m');
-INSERT INTO `t2` VALUES (4,7,9,'k','k');
-INSERT INTO `t2` VALUES (5,4,NULL,'r','r');
-INSERT INTO `t2` VALUES (6,2,9,'t','t');
-INSERT INTO `t2` VALUES (7,6,3,'j','j');
-INSERT INTO `t2` VALUES (8,8,8,'u','u');
-INSERT INTO `t2` VALUES (9,NULL,8,'h','h');
-INSERT INTO `t2` VALUES (10,5,53,'o','o');
-INSERT INTO `t2` VALUES (11,NULL,0,NULL,NULL);
-INSERT INTO `t2` VALUES (12,6,5,'k','k');
-INSERT INTO `t2` VALUES (13,188,166,'e','e');
-INSERT INTO `t2` VALUES (14,2,3,'n','n');
-INSERT INTO `t2` VALUES (15,1,0,'t','t');
-INSERT INTO `t2` VALUES (16,1,1,'c','c');
-INSERT INTO `t2` VALUES (17,0,9,'m','m');
-INSERT INTO `t2` VALUES (18,9,5,'y','y');
-INSERT INTO `t2` VALUES (19,NULL,6,'f','f');
-INSERT INTO `t2` VALUES (20,4,2,'d','d');
-
-# Here we just need plenty of different parameters to overflow
-# temporary heap table of expression cache
---disable_warnings
-SELECT table1 .`col_varchar_nokey`
-FROM t2 table1 RIGHT JOIN t1 LEFT JOIN (
-SELECT SUBQUERY1_t2 .*
-FROM t1 SUBQUERY1_t1 LEFT JOIN t2 SUBQUERY1_t2 ON SUBQUERY1_t2 .`col_int_key` = SUBQUERY1_t1 .`col_int_nokey` ) table3 STRAIGHT_JOIN ( (
-SELECT *
-FROM t1 ) table4 JOIN ( t1 table5 JOIN t2 table6 ON table5 .`pk` ) ON table5 .`col_varchar_nokey` ) ON table6 .`pk` = table5 .`col_int_key` ON table5 .`col_varchar_nokey` ON table5 .`col_varchar_key`
-WHERE table3 .`col_varchar_key` IN (
-SELECT `col_varchar_key`
-FROM t2 ) AND table1 .`col_varchar_key` OR table1 .`pk` ;
---enable_warnings
-
-drop table t1,t2;
-set @@optimizer_switch= default;
-
-set optimizer_switch='subquery_cache=on';
-#
---echo # LP BUG#615378 (incorrect NULL result returning in Item_cache)
-#
-# if bug present here will be valgrind warnings (due to attempt to process
-# uninialized decimal value) but the result will be correct (due to
-# Item::null_value)
-
-CREATE TABLE `t1` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `col_varchar_key` varchar(1) DEFAULT NULL,
- PRIMARY KEY (`pk`),
- KEY `col_varchar_key` (`col_varchar_key`)
-) DEFAULT CHARSET=latin1;
-INSERT INTO `t1` VALUES (10,'v');
-INSERT INTO `t1` VALUES (11,'r');
-CREATE TABLE `t2` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `col_varchar_key` varchar(1) DEFAULT NULL,
- PRIMARY KEY (`pk`),
- KEY `col_varchar_key` (`col_varchar_key`)
-) DEFAULT CHARSET=latin1;
-INSERT INTO `t2` VALUES (1,'r');
-INSERT INTO `t2` VALUES (2,'c');
-CREATE TABLE `t3` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `col_varchar_key` varchar(1) DEFAULT NULL,
- PRIMARY KEY (`pk`),
- KEY `col_varchar_key` (`col_varchar_key`)
-) DEFAULT CHARSET=latin1;
-INSERT INTO `t3` VALUES (1,'w');
-
-# We may get warnings about 'h' not beeing a double here
---disable_warnings
-SELECT SUM( DISTINCT table2 . `pk` ) AS field2 ,
-(SELECT SUM( SUBQUERY1_t2 . `pk` ) AS SUBQUERY1_field1
- FROM t2 AS SUBQUERY1_t2 STRAIGHT_JOIN
- t3 AS SUBQUERY1_t3 ON (SUBQUERY1_t3 . `pk` = SUBQUERY1_t2 . `pk` )
- WHERE table1 . `col_varchar_key` ) AS field3
-FROM ( t1 AS table1 LEFT JOIN
- ( t2 AS table2 STRAIGHT_JOIN
- t3 AS table3 ON (table3 . `pk` = table2 . `pk` ) )
- ON (table3 . `col_varchar_key` = table1 . `col_varchar_key` ) )
-WHERE ( table1 . `pk` < 5 ) OR ( table1 . `col_varchar_key` IS NOT NULL)
-GROUP BY field3
-HAVING (field3 <= 'h' AND field2 != 4) ;
---enable_warnings
-drop tables t1, t2, t3;
-
---echo #
---echo # Test aggregate functions as parameters to subquery cache
---echo #
-
-CREATE TABLE t1 ( a INT, b INT, c INT, KEY (a, b));
-
-INSERT INTO t1 VALUES
- ( 1, 1, 1 ),
- ( 1, 2, 2 ),
- ( 1, 3, 3 ),
- ( 1, 4, 6 ),
- ( 1, 5, 5 ),
- ( 1, 9, 13 ),
-
- ( 2, 1, 6 ),
- ( 2, 2, 7 ),
- ( 2, 3, 8 );
-
-SELECT a, AVG(t1.b),
-(SELECT t11.c FROM t1 t11 WHERE t11.a = t1.a AND t11.b = AVG(t1.b)) AS t11c
-FROM t1 GROUP BY a;
-
-DROP TABLE t1;
-
---echo #
---echo # Test of LP BUG#800696 (deleting list of Items (OR arguments)
---echo # in optimization)
---echo #
-
-set optimizer_switch='subquery_cache=on,in_to_exists=on';
-CREATE TABLE t1 ( f3 int) ;
-INSERT INTO t1 VALUES (0),(0);
-
-CREATE TABLE t3 ( f3 int) ;
-INSERT INTO t3 VALUES (0),(0);
-
-CREATE TABLE t2 ( f1 int, f2 int, f3 int) ;
-INSERT INTO t2 VALUES (7,0,0);
-
-SELECT *
-FROM t2, t3
-WHERE t2.f2 OR t3.f3 IN
-(
-SELECT t2.f2
-FROM t1
-WHERE t2.f1 OR t2.f3 );
-drop tables t1, t2, t3;
-
---echo #
---echo # Test of LP BUG#872775 view with "outer references" bug
---echo #
-set @@optimizer_switch= default;
-set optimizer_switch='subquery_cache=on';
-CREATE TABLE t1 (a int) ;
-
-CREATE TABLE t2 (b int, c varchar(1) NOT NULL ) ;
-INSERT INTO t2 VALUES (1,'x'),(2,'y');
-
-CREATE TABLE t3 (a int) ;
-
-CREATE TABLE t4 ( pk int(11) NOT NULL , b int(11) NOT NULL ) ;
-INSERT INTO t4 VALUES (26,9),(27,5),(28,0),(29,3);
-
-CREATE OR REPLACE VIEW v1 AS
-SELECT t2.b
-FROM t1
-JOIN t2
-WHERE t2 .c > (
- SELECT t2.c FROM t3
- );
-
-SELECT * FROM t4 WHERE b NOT IN ( SELECT * FROM v1 );
-
-drop view v1;
-drop table t1,t2,t3,t4;
-
-SET optimizer_switch=@save_optimizer_switch;
-
---echo # restore default
-set @@optimizer_switch= default;
diff --git a/mysql-test/t/subselect_debug.test b/mysql-test/t/subselect_debug.test
deleted file mode 100644
index f27867dc9d0..00000000000
--- a/mysql-test/t/subselect_debug.test
+++ /dev/null
@@ -1,27 +0,0 @@
---source include/have_debug.inc
-
-#
-# Bug #37627: Killing query with sum(exists()) or avg(exists()) reproducibly
-# crashes server
-#
-
-CREATE TABLE t1(id INT);
-INSERT INTO t1 VALUES (1),(2),(3),(4);
-INSERT INTO t1 SELECT a.id FROM t1 a,t1 b,t1 c,t1 d;
-# Setup the mysqld to crash at certain point
-SET @orig_debug=@@debug;
-SET GLOBAL debug_dbug="d,subselect_exec_fail";
-SELECT SUM(EXISTS(SELECT RAND() FROM t1)) FROM t1;
-SELECT REVERSE(EXISTS(SELECT RAND() FROM t1));
-SET GLOBAL debug_dbug=@orig_debug;
-DROP TABLE t1;
-
-#
-# MDEV-5284 Assertion `!(*expr)->fixed' fails in replace_where_subcondition with IN suquery
-#
-
-create table t1 (i int);
-insert into t1 values (1),(2);
-select * from t1 where (i < 200 or i = 300) and i in (select i from t1);
-drop table t1;
-
diff --git a/mysql-test/t/subselect_exists2in.test b/mysql-test/t/subselect_exists2in.test
deleted file mode 100644
index 5a8ddb3612f..00000000000
--- a/mysql-test/t/subselect_exists2in.test
+++ /dev/null
@@ -1,832 +0,0 @@
-
---disable_warnings
-drop table if exists t1,t2,t3;
---enable_warnings
-
-set optimizer_switch='exists_to_in=on';
---echo #
---echo # LP BUG#884644 exists2in broke name resolution
---echo #
-
-CREATE TABLE t1 (f1 integer);
-
---error ER_BAD_FIELD_ERROR
-SELECT * FROM t1 WHERE EXISTS (SELECT NO_SUCH_TABLE.NO_SUCH_FIELD FROM t1);
-
-drop table t1;
-
---echo #
---echo # LP BUG#884657 Wrong result with exists2in , correlated subquery
---echo #
-
-CREATE TABLE t1 ( a varchar(1)) ;
-INSERT INTO t1 VALUES ('c'),('b');
-
-CREATE TABLE t2 ( b varchar(1)) ;
-INSERT INTO t2 VALUES ('v'),('v'),('c'),(NULL),('x'),('i'),('e'),('p'),('s'),('j'),('z'),('c'),('a'),('q'),('y'),(NULL),('r'),('v'),(NULL),('r');
-
-CREATE TABLE t3 ( a int NOT NULL , b varchar(1)) ;
-INSERT INTO t3 VALUES (29,'c');
-
-SELECT *
-FROM t1, t2
-WHERE EXISTS (
- SELECT a
- FROM t3
- WHERE t3.b = t1.a
- AND t3.b <> t2.b
-);
-
-
-INSERT INTO t3 VALUES (2,'c');
-alter table t1 add index aa (a);
-alter table t3 add index bb (b);
---echo -- EXIST to IN then semijoin (has priority over IN to EXISTS)
-set optimizer_switch='exists_to_in=on,in_to_exists=on,semijoin=on,materialization=off,subquery_cache=off';
-SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a);
-explain extended
-SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a);
---echo -- EXIST to IN then IN to EXISTS
-set optimizer_switch='exists_to_in=on,in_to_exists=on,semijoin=off,materialization=off,subquery_cache=off';
-SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a);
-explain extended
-SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a);
---echo -- EXIST2IN then MATERIALIZATION
-set optimizer_switch='exists_to_in=on,in_to_exists=off,semijoin=off,materialization=on,subquery_cache=off';
-SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a);
-explain extended
-SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a);
---echo -- NO EXIST2IN
-set optimizer_switch='exists_to_in=off,subquery_cache=off';
-SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a);
-explain extended
-SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a);
-set optimizer_switch=default;
-set optimizer_switch='exists_to_in=on';
-
-drop table t1,t2,t3;
-
---echo #
---echo # From group_min_max.test
---echo #
-create table t1 (
- a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
-);
-
-insert into t1 (a1, a2, b, c, d) values
-('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
-('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
-('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
-('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
-('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
-('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
-('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
-('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
-('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
-('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
-('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
-('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
-('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
-('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
-('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
-('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4'),
-('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
-('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
-('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
-('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
-('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
-('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
-('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
-('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
-('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
-('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
-('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
-('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
-('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
-('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
-('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
-('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4');
-
-create index idx_t1_0 on t1 (a1);
-create index idx_t1_1 on t1 (a1,a2,b,c);
-create index idx_t1_2 on t1 (a1,a2,b);
-analyze table t1;
-
-# t2 is the same as t1, but with some NULLs in the MIN/MAX column, and
-# one more nullable attribute
-
-create table t2 (
- a1 char(64), a2 char(64) not null, b char(16), c char(16), d char(16), dummy char(64) default ' '
-);
-insert into t2 select * from t1;
-# add few rows with NULL's in the MIN/MAX column
-insert into t2 (a1, a2, b, c, d) values
-('a','a',NULL,'a777','xyz'),('a','a',NULL,'a888','xyz'),('a','a',NULL,'a999','xyz'),
-('a','a','a',NULL,'xyz'),
-('a','a','b',NULL,'xyz'),
-('a','b','a',NULL,'xyz'),
-('c','a',NULL,'c777','xyz'),('c','a',NULL,'c888','xyz'),('c','a',NULL,'c999','xyz'),
-('d','b','b',NULL,'xyz'),
-('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),
-('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),
-('a','a',NULL,'a777','xyz'),('a','a',NULL,'a888','xyz'),('a','a',NULL,'a999','xyz'),
-('a','a','a',NULL,'xyz'),
-('a','a','b',NULL,'xyz'),
-('a','b','a',NULL,'xyz'),
-('c','a',NULL,'c777','xyz'),('c','a',NULL,'c888','xyz'),('c','a',NULL,'c999','xyz'),
-('d','b','b',NULL,'xyz'),
-('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),
-('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz');
-
-create index idx_t2_0 on t2 (a1);
-create index idx_t2_1 on t2 (a1,a2,b,c);
-create index idx_t2_2 on t2 (a1,a2,b);
-analyze table t2;
-
-# Table t3 is the same as t1, but with smaller column lenghts.
-# This allows to test different branches of the cost computation procedure
-# when the number of keys per block are less than the number of keys in the
-# sub-groups formed by predicates over non-group attributes.
-
-create table t3 (
- a1 char(1), a2 char(1), b char(1), c char(4) not null, d char(3), dummy char(1) default ' '
-);
-
-insert into t3 (a1, a2, b, c, d) values
-('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
-('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
-('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
-('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
-('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
-('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
-('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
-('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
-('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
-('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
-('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
-('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4');
-insert into t3 (a1, a2, b, c, d) values
-('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
-('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
-('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
-('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
-('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
-('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
-('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
-('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
-('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
-('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
-('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
-('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4');
-insert into t3 (a1, a2, b, c, d) values
-('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
-('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
-('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
-('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
-('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
-('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
-('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
-('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
-('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
-('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
-('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
-('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4');
-insert into t3 (a1, a2, b, c, d) values
-('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
-('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
-('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
-('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
-('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
-('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
-('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
-('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
-('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
-('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
-('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
-('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4');
-
-create index idx_t3_0 on t3 (a1);
-create index idx_t3_1 on t3 (a1,a2,b,c);
-create index idx_t3_2 on t3 (a1,a2,b);
-analyze table t3;
-
-
-explain select a1,a2,b,c,min(c), max(c) from t1
-where exists ( select * from t2
- where t2.c in (select c from t3 where t3.c > t1.b) and
- t2.c > 'b1' )
-group by a1,a2,b;
-
-select a1,a2,b,c,min(c), max(c) from t1
-where exists ( select * from t2
- where t2.c in (select c from t3 where t3.c > t1.b) and
- t2.c > 'b1' )
-group by a1,a2,b;
-
-explain select a1,a2,b,c,min(c), max(c) from t1
-where exists ( select * from t2
- where t2.c in (select c from t3 where t3.c > t1.c) and
- t2.c > 'b1' )
-group by a1,a2,b;
-
-select a1,a2,b,c,min(c), max(c) from t1
-where exists ( select * from t2
- where t2.c in (select c from t3 where t3.c > t1.c) and
- t2.c > 'b1' )
-group by a1,a2,b;
-
-drop table t1, t2, t3;
-
-#
-# LP BUG#901835 - incorrect semi-join conversion after exists2in
-#
-CREATE TABLE t1 ( a INT );
-INSERT INTO t1 VALUES (7),(0);
-CREATE TABLE t2 ( b INT );
-INSERT INTO t2 VALUES (0),(8);
-
-SELECT * FROM t1 WHERE
- EXISTS ( SELECT * FROM t2 WHERE b = a )
- OR a > 0;
-
-explain extended
-SELECT * FROM t1 WHERE
- EXISTS ( SELECT * FROM t2 WHERE b = a )
- OR a > 0;
-
-drop tables t1,t2;
-
-#
-# NOT EXISTS test
-#
-CREATE TABLE t1 ( a INT );
-INSERT INTO t1 VALUES (1),(5);
-CREATE TABLE t2 ( b INT ) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (1);
-
-CREATE TABLE t3 ( c INT );
-INSERT INTO t3 VALUES (4),(5);
-
-SET optimizer_switch='exists_to_in=on,subquery_cache=off,materialization=on,in_to_exists=off,semijoin=off';
-
-explain extended
-SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
-SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
-
-SET optimizer_switch='exists_to_in=on,subquery_cache=off';
-
-
-explain extended
-SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
-SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
-
-SET optimizer_switch='exists_to_in=off,subquery_cache=off';
-
-explain extended
-SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
-SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
-
-set optimizer_switch=default;
-set optimizer_switch='exists_to_in=on';
-drop table t1,t2,t3;
-
---echo # multi condition test
-CREATE TABLE t1 ( a varchar(1), a1 varchar(1)) ;
-INSERT INTO t1 VALUES ('c', 'c'), ('b', 'b');
-
-CREATE TABLE t3 ( a int NOT NULL , b varchar(1), b1 varchar(1)) ;
-INSERT INTO t3 VALUES (29,'c','c');
-INSERT INTO t3 VALUES (2,'c','c');
-alter table t1 add index aa (a,a1);
-alter table t3 add index bb (b,b1);
---echo -- EXIST to IN then semijoin (has priority over IN to EXISTS)
-set optimizer_switch='exists_to_in=on,in_to_exists=on,semijoin=on,materialization=off,subquery_cache=off';
-SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1);
-explain extended
-SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1);
---echo -- EXIST to IN then IN to EXISTS
-set optimizer_switch='exists_to_in=on,in_to_exists=on,semijoin=off,materialization=off,subquery_cache=off';
-SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1);
-explain extended
-SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1);
---echo -- EXIST2IN then MATERIALIZATION
-set optimizer_switch='exists_to_in=on,in_to_exists=off,semijoin=off,materialization=on,subquery_cache=off';
-SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1);
-explain extended
-SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1);
---echo -- NO EXIST2IN
-set optimizer_switch='exists_to_in=off,subquery_cache=off';
-SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1);
-explain extended
-SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1);
-set optimizer_switch=default;
-set optimizer_switch='exists_to_in=on';
-
-drop table t1,t3;
-
---echo #
---echo # MDEV-159 Assertion about not marked for read failed in
---echo # String* Field_varstring::val_str(String*, String*)
---echo #
-
-SET optimizer_switch = REPLACE( @@optimizer_switch, '=on', '=off' );
-SET optimizer_switch='in_to_exists=on,exists_to_in=on';
-
-CREATE TABLE t1 ( a VARCHAR(1) );
-INSERT INTO t1 VALUES ('k'),('m');
-
-CREATE TABLE t2 ( b INT,
- c VARCHAR(1),
- d VARCHAR(1) NOT NULL );
-
-INSERT INTO t2 VALUES
- (4,'j','j'),(6,'v','v');
-
-CREATE ALGORITHM=MERGE VIEW v AS SELECT * FROM t2 WHERE b < 1;
-
-SELECT c FROM v
-WHERE EXISTS (
- SELECT * FROM t1, t2
- WHERE a <= v.d AND b = v.b
-);
-
-explain extended
-SELECT c FROM v
-WHERE EXISTS (
- SELECT * FROM t1, t2
- WHERE a <= v.d AND b = v.b
-);
-
-set optimizer_switch=default;
-set optimizer_switch='exists_to_in=on';
-drop view v;
-drop table t1,t2;
-
-
---echo #
---echo # MDEV-160 Exists2In: Crash in in hp_movelink with subquery_cache=ON
---echo #
-
-SET optimizer_switch = 'in_to_exists=on,subquery_cache=on,exists_to_in=on';
-
-CREATE TABLE t1 (
- a VARCHAR(3) NOT NULL,
- b VARCHAR(50)
-);
-INSERT INTO t1 VALUES
- ('USA','Chinese'),('USA','English'),
- ('FRA','French'),('ITA','Italian');
-
-CREATE TABLE t2 ( c VARCHAR(3) );
-INSERT INTO t2 VALUES ('USA'),('FRA');
-
-SELECT * FROM t1 AS alias1, t1 AS alias2
-WHERE EXISTS (
- SELECT * FROM t1, t2
- WHERE a <= alias2.a AND c = alias1.b
-) OR alias1 .a = 'foo';
-
-SELECT * FROM t1 AS alias1, t1 AS alias2
-WHERE EXISTS (
- SELECT * FROM t1, t2
- WHERE a <= alias2.a AND c = alias1.a
-) OR alias1 .a = 'foo';
-
-drop table t1,t2;
-set optimizer_switch=default;
-set optimizer_switch='exists_to_in=on';
-
---echo #
---echo # MDEV-160 Exists2In: Crash in in hp_movelink with subquery_cache=ON
---echo #
-SET optimizer_switch = 'in_to_exists=on,subquery_cache=on,exists_to_in=on';
-
-CREATE TABLE t1 (
- a VARCHAR(3) NOT NULL,
- b VARCHAR(50)
-);
-INSERT INTO t1 VALUES
- ('USA','Chinese'),('USA','English'),
- ('FRA','French'),('ITA','Italian');
-
-CREATE TABLE t2 ( c VARCHAR(3) );
-INSERT INTO t2 VALUES ('USA'),('FRA');
-
-SELECT * FROM t1 AS alias1, t1 AS alias2
-WHERE EXISTS (
- SELECT * FROM t1, t2
- WHERE a <= alias2.a AND c = alias1.b
-) OR alias1 .a = 'foo';
-
-explain extended
-SELECT * FROM t1 AS alias1, t1 AS alias2
-WHERE EXISTS (
- SELECT * FROM t1, t2
- WHERE a <= alias2.a AND c = alias1.b
-) OR alias1 .a = 'foo';
-
-drop table t1,t2;
-set optimizer_switch=default;
-set optimizer_switch='exists_to_in=on';
-
---echo #
---echo # MDEV-245 Exists2In: Wrong result (extra rows) with
---echo # exists_to_in=ON, materialization=OFF, NOT EXISTS subquery
---echo #
-SET optimizer_switch='materialization=off,exists_to_in=on';
-
-CREATE TABLE t1 ( a INT ) ;
-INSERT INTO t1 VALUES (0),(8),(1);
-
-CREATE TABLE t2 ( b INT ) ;
-INSERT INTO t2 VALUES (1),(2),(3);
-
-SELECT * FROM t1 WHERE NOT EXISTS ( SELECT * FROM t2 WHERE b = a );
-explain extended
-SELECT * FROM t1 WHERE NOT EXISTS ( SELECT * FROM t2 WHERE b = a );
-
-drop table t1,t2;
-set optimizer_switch=default;
-set optimizer_switch='exists_to_in=on';
-
---echo #
---echo # MDEV-243 Wrong result (extra or missing rows) with
---echo # exists_to_in + materialization, EXISTS subquery
---echo #
-
-SET optimizer_switch='index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=on';
-
-CREATE TABLE t1 ( a VARCHAR(1), b VARCHAR(1) );
-INSERT INTO t1 VALUES ('v','v'),('s','v');
-
-SELECT * FROM t1 AS alias
-WHERE EXISTS ( SELECT * FROM t1 WHERE a > alias.a AND a = alias.b );
-explain extended
-SELECT * FROM t1 AS alias
-WHERE EXISTS ( SELECT * FROM t1 WHERE a > alias.a AND a = alias.b );
-
-SET optimizer_switch = REPLACE( @@optimizer_switch, '=on', '=off' );
-SET optimizer_switch = 'exists_to_in=on,materialization=on,semijoin=off';
-SELECT * FROM t1 AS alias
-WHERE EXISTS ( SELECT * FROM t1 WHERE a > alias.a AND a = alias.b );
-explain extended
-SELECT * FROM t1 AS alias
-WHERE EXISTS ( SELECT * FROM t1 WHERE a > alias.a AND a = alias.b );
-SET optimizer_switch = 'exists_to_in=on,materialization=on,semijoin=on';
-SELECT * FROM t1 AS alias
-WHERE EXISTS ( SELECT * FROM t1 WHERE a > alias.a AND a = alias.b );
-explain extended
-SELECT * FROM t1 AS alias
-WHERE EXISTS ( SELECT * FROM t1 WHERE a > alias.a AND a = alias.b );
-
-drop table t1;
-set optimizer_switch=default;
-set optimizer_switch='exists_to_in=on';
-
---echo #
---echo # MDEV-403 Wrong result (missing rows) with subquery in
---echo # EXISTS and an OR condition outside
---echo #
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (2),(3);
-
-CREATE TABLE t2 (b INT);
-INSERT INTO t2 VALUES (1),(3);
-SET optimizer_switch = 'exists_to_in=off,in_to_exists=on';
-SELECT * FROM t1 AS alias1, t2 AS alias2
-WHERE EXISTS (
- SELECT 1 FROM t2 WHERE b = alias1.a AND b > alias2.b
-) OR a = 5;
-
-SET optimizer_switch = 'exists_to_in=on,in_to_exists=on';
-
-SELECT * FROM t1 AS alias1, t2 AS alias2
-WHERE EXISTS (
- SELECT 1 FROM t2 WHERE b = alias1.a AND b > alias2.b
-) OR a = 5;
-
-explain extended
-SELECT * FROM t1 AS alias1, t2 AS alias2
-WHERE EXISTS (
- SELECT 1 FROM t2 WHERE b = alias1.a AND b > alias2.b
-) OR a = 5;
-
-drop table t1, t2;
-set optimizer_switch=default;
-set optimizer_switch='exists_to_in=on';
-
---echo #
---echo # MDEV-404: Wrong result (extra rows) with STRAIGHT_JOIN,
---echo # EXISTS subquery, NOT NULL column
---echo # (same as above)
---echo #
-SET optimizer_switch = 'exists_to_in=on,in_to_exists=on';
-
-CREATE TABLE t1 (a INT, b VARCHAR(1) NOT NULL);
-INSERT INTO t1 VALUES (1,'s'),(2,'e');
-
-SELECT STRAIGHT_JOIN * FROM t1 AS alias1, t1 AS alias2
-WHERE EXISTS ( SELECT 1 FROM t1 WHERE b < alias2.b AND a = alias1.a );
-
-drop table t1;
-set optimizer_switch=default;
-set optimizer_switch='exists_to_in=on';
-
-
---echo #
---echo # MDEV-3800: ORDER BY doesn't work with exists_to_in=ON on
---echo # a query with EXISTS subquery and OR condition
---echo #
-SET optimizer_switch = 'in_to_exists=on,exists_to_in=on';
-CREATE TABLE t1 (a INT, b VARCHAR(1)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (4,'j'),(6,'v'),(3,'c');
-
-CREATE TABLE t2 (c VARCHAR(1)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES ('b'),('y');
-
-SELECT a FROM t1
-WHERE EXISTS (
- SELECT 1 FROM t2 WHERE c = b
-) OR b NOT IN ('U')
-ORDER BY a;
-
-select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`b` in (select `test`.`t2`.`c` from `test`.`t2` where 1 ) or (`test`.`t1`.`b` <> 'U') order by `test`.`t1`.`a`;
-
-drop table t1,t2;
-set optimizer_switch=default;
-set optimizer_switch='exists_to_in=on';
-
-
---echo #
---echo # correct calculation of reserved items (postreview-fix)
---echo #
-create table t1 (col1 int, col2 int, col3 int);
-insert into t1 values (1,2,3),(2,3,4),(4,5,6);
-create table t2 as select * from t1;
-explain extended
-select * from t1 where exists (select col2 from t2 where t2.col1=t1.col1 and t2.col2=t1.col2);
-select * from t1 where exists (select col2 from t2 where t2.col1=t1.col1 and t2.col2=t1.col2);
-drop table t1,t2;
-
---echo #
---echo # MDEV-3879: Exists2In: Wrong result (extra row) and unexpected
---echo # warning with exists_to_in=on and a NOT EXISTS subquery
---echo #
-SET optimizer_switch = 'exists_to_in=on';
-
-CREATE TABLE t1 (a1 INT, b1 CHAR(1)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (3,'y'),(6,'w');
-
-CREATE TABLE t2 (a2 INT, b2 CHAR(1)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (3,'y'),(6,'d');
-
-SELECT * FROM t1
-WHERE NOT EXISTS ( SELECT * FROM t2 WHERE b2 = b1 AND a2 = a1 );
-
-drop table t1, t2;
-
---echo #
---echo # MDEV-3880: Wrong result (missing rows) with exists_to_in=on,
---echo # LEFT JOIN and NOT EXISTS subquery.
---echo # (Duplicate of above MDEV-3879).
---echo #
-
-SET optimizer_switch = 'exists_to_in=on';
-CREATE TABLE t1 (a1 INT, b1 CHAR(1)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (4,'b'),(5,'y');
-
-CREATE TABLE t2 (b2 CHAR(1)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES ('z'),('b');
-
-CREATE TABLE t3 (a3 INT, b3 CHAR(1)) ENGINE=MyISAM;
-INSERT INTO t3 VALUES (4,'j'),(6,'v');
-
-SELECT * FROM t1 LEFT JOIN t2 ON ( b2 = b1 )
-WHERE NOT EXISTS ( SELECT * FROM t3 WHERE b3 = b2 AND a3 = a1 ) ;
-
-drop table t1, t2, t3;
-
-
-
---echo #
---echo # MDEV-3881: Endless loop and crash in Item_ref::real_item with
---echo # exists_to_in=on, NOT EXISTS subquery, merge view or from subquery,
---echo # constant table
---echo #
-SET optimizer_switch = 'exists_to_in=on';
-
-CREATE TABLE t1 (a INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(7);
-
-CREATE TABLE t2 (b INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (8);
-CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t2;
-
-CREATE TABLE t3 (c INT) ENGINE=MyISAM;
-INSERT INTO t3 VALUES (4),(6);
-
-SELECT * FROM t1, v1 WHERE NOT EXISTS ( SELECT * FROM t3 WHERE c = b ) AND a = b;
-
-drop view v1;
-drop table t1, t2, t3;
-
-CREATE TABLE t1 (a INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(7);
-
-CREATE TABLE t2 (b INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (8);
-
-CREATE TABLE t3 (c INT) ENGINE=MyISAM;
-INSERT INTO t3 VALUES (4),(6);
-
-SELECT * FROM t1, ( SELECT * FROM t2 ) alias WHERE NOT EXISTS ( SELECT * FROM t3 WHERE c = b ) AND a = b;
-
-drop table t1, t2, t3;
-
---echo #
---echo # MDEV-3906: Server crashes in Dependency_marker::visit_field
---echo # on 2nd execution of PS with exists_to_in and NOT EXISTS subquery
---echo #
-SET optimizer_switch='exists_to_in=on';
-
-CREATE TABLE t1 (a INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(7);
-
-PREPARE stmt FROM '
-SELECT * FROM t1 AS alias
-WHERE NOT EXISTS ( SELECT * FROM t1 WHERE t1.a = alias.a )
-';
-
-EXECUTE stmt;
-EXECUTE stmt;
-
-drop table t1;
-
---echo #
---echo # MDEV-3904: Assertion `in_subs->has_strategy()' failed in
---echo # JOIN::choose_subquery_plan on 2nd execution of PS with
---echo # exists_to_in+semijoin, EXISTS subquery, MERGE view or FROM subquery
---echo #
-SET optimizer_switch='in_to_exists=on,semijoin=on,exists_to_in=on';
-
-CREATE TABLE t1 (a INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE TABLE t2 (b INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (4),(6);
-
-CREATE ALGORITHM=MERGE VIEW v AS
-SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t2 WHERE b = a );
-
-PREPARE stmt FROM ' SELECT * FROM v ';
-
-EXECUTE stmt;
-EXECUTE stmt;
-
-drop view v;
-drop table t1,t2;
-set optimizer_switch=default;
-set optimizer_switch='exists_to_in=on';
-
---echo #
---echo # MDEV-3903: Server crashes in Item_cond::fix_fields on 2nd execution
---echo # of a prepared stmt with exists_to_in+materialization+semijoin,
---echo # EXISTS subquery, STRAIGHT_JOIN
---echo #
-
-SET optimizer_switch='materialization=on,semijoin=on,exists_to_in=on';
-
-CREATE TABLE t1 (a INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE TABLE t2 (b INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (3),(4);
-
-PREPARE stmt FROM
-'SELECT STRAIGHT_JOIN * FROM t1
-WHERE EXISTS ( SELECT * FROM t2 WHERE b = a )';
-
-EXECUTE stmt;
-EXECUTE stmt;
-
-drop table t1,t2;
-set optimizer_switch=default;
-set optimizer_switch='exists_to_in=on';
-
---echo #
---echo # MDEV-4152: Wrong result (missing rows) with exists_to_in=on,
---echo # inner joins
---echo #
-SET optimizer_switch='materialization=on,semijoin=on,exists_to_in=on';
-
-CREATE TABLE t1 (i INT, c1 CHAR(5), c2 CHAR(5), t1_field VARCHAR(1)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,'test1','test2','f'), (2,'test3','test4','d');
-
-CREATE TABLE t2 (t2_field VARCHAR(1)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES ('m'), ('b');
-
-CREATE TABLE t3 (t3_field VARCHAR(1)) ENGINE=MyISAM;
-INSERT INTO t3 VALUES ('b'),('c');
-
-SELECT * FROM t1, t2 outer_t2
-WHERE EXISTS ( SELECT 1 FROM t2, t3 WHERE t3_field = outer_t2.t2_field AND t2_field <= t1_field );
-
-drop table t1,t2,t3;
-set optimizer_switch=default;
-set optimizer_switch='exists_to_in=on';
-
---echo #
---echo #MDEV-5401: Wrong result (missing row) on a 2nd execution of PS with
---echo #exists_to_in=on, MERGE view or a SELECT SQ
---echo #
-CREATE TABLE t1 (a INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
-
-CREATE TABLE t2 (b INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (2),(3);
-
-SELECT * FROM v1 WHERE EXISTS ( SELECT * FROM t2 t2x, t2 t2y WHERE t2y.b = a );
-
-PREPARE stmt FROM "SELECT * FROM v1 WHERE EXISTS ( SELECT * FROM t2 t2x, t2 t2y WHERE t2y.b = a )";
-EXECUTE stmt;
-EXECUTE stmt;
-
-deallocate prepare stmt;
-
-drop view v1;
-drop table t1,t2;
-
---echo #
---echo #MDEV-10053: EXIST to IN transformation turned down
---echo #
-
-CREATE TABLE t1 (
- pk INT, f1 INT NOT NULL, f2 VARCHAR(3), f3 INT NULL, PRIMARY KEY(pk))
-ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,1,'foo',8), (2,5,'bar',7);
-
-let $q=
-SELECT STRAIGHT_JOIN sq1.f2
- FROM ( SELECT * FROM t1 ) AS sq1
- WHERE EXISTS ( SELECT * FROM t1 AS sq2
- WHERE sq1.`pk` IN ( SELECT f1 FROM t1 ) AND sq2.f1 = sq1.f1 );
-
-set @optimizer_switch_save=@@optimizer_switch;
-
-set optimizer_switch='exists_to_in=off';
-eval explain extended $q;
-eval $q;
-set optimizer_switch='exists_to_in=on';
-eval explain extended $q;
-eval $q;
-
-set optimizer_switch= @optimizer_switch_save;
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-14164: Unknown column error when adding aggregate to function
---echo # in oracle style procedure FOR loop
---echo #
-
-CREATE TABLE t1(id INT, val INT);
-DELIMITER //;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE cur1 CURSOR FOR SELECT * FROM (
- SELECT DISTINCT id FROM t1) a
- WHERE NOT EXISTS (SELECT * FROM ( SELECT id FROM t1) b
- WHERE a.id=b.id);
- OPEN cur1;
- CLOSE cur1;
- OPEN cur1;
- CLOSE cur1;
-END;
-//
-DELIMITER ;//
-CALL p1();
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
-CREATE TABLE t1(id INT, val INT);
-DELIMITER //;
-CREATE PROCEDURE p1()
-BEGIN
- SELECT * FROM (SELECT DISTINCT id FROM t1) a
- WHERE NOT a.id IN (SELECT b.id FROM t1 b);
- SELECT * FROM (SELECT DISTINCT id FROM t1) a
- WHERE NOT EXISTS (SELECT * FROM t1 b WHERE a.id=b.id);
-END;
-//
-DELIMITER ;//
-CALL p1();
-CALL p1();
-DROP PROCEDURE p1;
-DROP TABLE t1;
-
---echo # End of 10.0 tests
-
-#restore defaults
-set optimizer_switch=default;
diff --git a/mysql-test/t/subselect_exists2in_costmat.test b/mysql-test/t/subselect_exists2in_costmat.test
deleted file mode 100644
index 5d5eeaee268..00000000000
--- a/mysql-test/t/subselect_exists2in_costmat.test
+++ /dev/null
@@ -1,83 +0,0 @@
-#
-# Tests of cost-based choice between the materialization and in-to-exists
-# subquery execution strategies (MWL#89)
-#
-# The test file is divided into two groups of tests:
-# A. Typical cases when either of the two strategies is selected:
-# 1. Subquery in disjunctive WHERE clause of the outer query.
-# 2. NOT IN subqueries
-# 3. Subqueries with GROUP BY, HAVING, and aggregate functions
-# 4. Subqueries in the SELECT and HAVING clauses
-# 5. Subqueries with UNION
-# B. Reasonably exhaustive tests of the various combinations of optimizer
-# switches, data distribution, available indexes, and typical queries.
-#
-
-set @subselect_mat_cost=@@optimizer_switch;
-set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
-#
-# Test logging to slow log (there was some errors in the log files about
-# the slow log when running under valgrind, so better to get this tested)
-#
-set long_query_time=0.1;
-
-
---disable_warnings
-drop database if exists world;
---enable_warnings
-
-set names utf8;
-
-create database world;
-use world;
-
---source include/world_schema.inc
---disable_query_log
---disable_result_log
---disable_warnings
---source include/world.inc
---enable_warnings
---enable_result_log
---enable_query_log
-
--- echo Make the schema and data more diverse by adding more indexes, nullable
--- echo columns, and NULL data.
-create index SurfaceArea on Country(SurfaceArea);
-create index Language on CountryLanguage(Language);
-create index CityName on City(Name);
-alter table City change population population int(11) null default 0;
-
-select max(id) from City into @max_city_id;
-insert into City values (@max_city_id + 1,'Kilifarevo','BGR',NULL);
-
-
-SELECT COUNT(*) FROM Country;
-SELECT COUNT(*) FROM City;
-SELECT COUNT(*) FROM CountryLanguage;
-
-set @@optimizer_switch = 'exists_to_in=on,in_to_exists=on,semijoin=on,materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on';
-
--- echo
--- echo 1. Subquery in a disjunctive WHERE clause of the outer query.
--- echo
-
--- echo
--- echo Q1.1m:
--- echo MATERIALIZATION: there are too many rows in the outer query
--- echo to be looked up in the inner table.
-EXPLAIN
-SELECT Name FROM Country
-WHERE (EXISTS (select 1 from City where City.Population > 100000 and
-Code = Country) OR
- Name LIKE 'L%') AND
- surfacearea > 1000000;
-
-SELECT Name FROM Country
-WHERE (EXISTS (select 1 from City where City.Population > 100000 and
-Code = Country) OR
- Name LIKE 'L%') AND
- surfacearea > 1000000;
-
-drop database world;
-
-set optimizer_switch=@subselect_mat_cost;
diff --git a/mysql-test/t/subselect_extra.test b/mysql-test/t/subselect_extra.test
deleted file mode 100644
index b76f3f70516..00000000000
--- a/mysql-test/t/subselect_extra.test
+++ /dev/null
@@ -1,395 +0,0 @@
-#
-# This file is for tests for other features that happen to use
-# subqueries. The idea is that one should be able to run
-#
-# ./mysql-test-run t/subselect*.test
-#
-# and get as much subquery testing as possible.
-#
-
---disable_warnings
-drop table if exists t1,t2,t3,t4;
-drop view if exists v1,v2,v3;
---enable_warnings
-
-set @subselect_extra_tmp=@@optimizer_switch;
-set @@optimizer_switch=ifnull(@optimizer_switch_for_subselect_extra_test,
- "semijoin=on,firstmatch=on,loosescan=on,semijoin_with_cache=on,partial_match_rowid_merge=off,partial_match_table_scan=off");
-
---echo # From explain.test:
---echo #
---echo # Bug#37870: Usage of uninitialized value caused failed assertion.
---echo #
-create table t1 (dt datetime not null, t time not null);
-create table t2 (dt datetime not null);
-insert into t1 values ('2001-01-01 1:1:1', '1:1:1'),
-('2001-01-01 1:1:1', '1:1:1');
-insert into t2 values ('2001-01-01 1:1:1'), ('2001-01-01 1:1:1');
-flush tables;
-EXPLAIN SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN (SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.dt IS NULL );
-flush tables;
-SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN (SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.dt IS NULL );
-flush tables;
-EXPLAIN SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN ( SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.t < '2005-11-13 7:41:31' );
-flush tables;
-SELECT OUTR.dt FROM t1 AS OUTR WHERE OUTR.dt IN ( SELECT INNR.dt FROM t2 AS INNR WHERE OUTR.t < '2005-11-13 7:41:31' );
-drop tables t1, t2;
-
---echo # From type_datetime.test:
---echo #
---echo # Bug #32694: NOT NULL table field in a subquery produces invalid results
---echo #
-create table t1 (id int(10) not null, cur_date datetime not null);
-create table t2 (id int(10) not null, cur_date date not null);
-insert into t1 (id, cur_date) values (1, '2007-04-25 18:30:22');
-insert into t2 (id, cur_date) values (1, '2007-04-25');
-
-explain extended
-select * from t1
-where id in (select id from t1 as x1 where (t1.cur_date is null));
-select * from t1
-where id in (select id from t1 as x1 where (t1.cur_date is null));
-
-explain extended
-select * from t2
-where id in (select id from t2 as x1 where (t2.cur_date is null));
-select * from t2
-where id in (select id from t2 as x1 where (t2.cur_date is null));
-
-insert into t1 (id, cur_date) values (2, '2007-04-26 18:30:22');
-insert into t2 (id, cur_date) values (2, '2007-04-26');
-
-explain extended
-select * from t1
-where id in (select id from t1 as x1 where (t1.cur_date is null));
-select * from t1
-where id in (select id from t1 as x1 where (t1.cur_date is null));
-
-explain extended
-select * from t2
-where id in (select id from t2 as x1 where (t2.cur_date is null));
-select * from t2
-where id in (select id from t2 as x1 where (t2.cur_date is null));
-
-drop table t1,t2;
-
---echo #
---echo # From group_min_max.test
---echo #
-create table t1 (
- a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
-);
-
-insert into t1 (a1, a2, b, c, d) values
-('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
-('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
-('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
-('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
-('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
-('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
-('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
-('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
-('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
-('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
-('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
-('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
-('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
-('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
-('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
-('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4'),
-('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
-('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
-('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
-('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
-('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
-('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
-('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
-('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
-('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
-('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
-('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
-('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
-('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
-('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
-('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
-('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4');
-
-create index idx_t1_0 on t1 (a1);
-create index idx_t1_1 on t1 (a1,a2,b,c);
-create index idx_t1_2 on t1 (a1,a2,b);
-analyze table t1;
-
-# t2 is the same as t1, but with some NULLs in the MIN/MAX column, and
-# one more nullable attribute
-
-create table t2 (
- a1 char(64), a2 char(64) not null, b char(16), c char(16), d char(16), dummy char(64) default ' '
-);
-insert into t2 select * from t1;
-# add few rows with NULL's in the MIN/MAX column
-insert into t2 (a1, a2, b, c, d) values
-('a','a',NULL,'a777','xyz'),('a','a',NULL,'a888','xyz'),('a','a',NULL,'a999','xyz'),
-('a','a','a',NULL,'xyz'),
-('a','a','b',NULL,'xyz'),
-('a','b','a',NULL,'xyz'),
-('c','a',NULL,'c777','xyz'),('c','a',NULL,'c888','xyz'),('c','a',NULL,'c999','xyz'),
-('d','b','b',NULL,'xyz'),
-('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),
-('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),
-('a','a',NULL,'a777','xyz'),('a','a',NULL,'a888','xyz'),('a','a',NULL,'a999','xyz'),
-('a','a','a',NULL,'xyz'),
-('a','a','b',NULL,'xyz'),
-('a','b','a',NULL,'xyz'),
-('c','a',NULL,'c777','xyz'),('c','a',NULL,'c888','xyz'),('c','a',NULL,'c999','xyz'),
-('d','b','b',NULL,'xyz'),
-('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),
-('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz');
-
-create index idx_t2_0 on t2 (a1);
-create index idx_t2_1 on t2 (a1,a2,b,c);
-create index idx_t2_2 on t2 (a1,a2,b);
-analyze table t2;
-
-# Table t3 is the same as t1, but with smaller column lenghts.
-# This allows to test different branches of the cost computation procedure
-# when the number of keys per block are less than the number of keys in the
-# sub-groups formed by predicates over non-group attributes.
-
-create table t3 (
- a1 char(1), a2 char(1), b char(1), c char(4) not null, d char(3), dummy char(1) default ' '
-);
-
-insert into t3 (a1, a2, b, c, d) values
-('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
-('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
-('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
-('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
-('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
-('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
-('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
-('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
-('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
-('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
-('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
-('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4');
-insert into t3 (a1, a2, b, c, d) values
-('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
-('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
-('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
-('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
-('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
-('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
-('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
-('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
-('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
-('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
-('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
-('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4');
-insert into t3 (a1, a2, b, c, d) values
-('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
-('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
-('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
-('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
-('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
-('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
-('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
-('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
-('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
-('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
-('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
-('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4');
-insert into t3 (a1, a2, b, c, d) values
-('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
-('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
-('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
-('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
-('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
-('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
-('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
-('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
-('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
-('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
-('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
-('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4');
-
-create index idx_t3_0 on t3 (a1);
-create index idx_t3_1 on t3 (a1,a2,b,c);
-create index idx_t3_2 on t3 (a1,a2,b);
-analyze table t3;
-
-
-explain select a1,a2,b,c,min(c), max(c) from t1
-where exists ( select * from t2
- where t2.c in (select c from t3 where t3.c > t1.b) and
- t2.c > 'b1' )
-group by a1,a2,b;
-
-select a1,a2,b,c,min(c), max(c) from t1
-where exists ( select * from t2
- where t2.c in (select c from t3 where t3.c > t1.b) and
- t2.c > 'b1' )
-group by a1,a2,b;
-
-explain select a1,a2,b,c,min(c), max(c) from t1
-where exists ( select * from t2
- where t2.c in (select c from t3 where t3.c > t1.c) and
- t2.c > 'b1' )
-group by a1,a2,b;
-
-select a1,a2,b,c,min(c), max(c) from t1
-where exists ( select * from t2
- where t2.c in (select c from t3 where t3.c > t1.c) and
- t2.c > 'b1' )
-group by a1,a2,b;
-
-drop table t1, t2, t3;
-
---echo #
---echo # From group_by.test
---echo #
-
---echo # Bug #21174: Index degrades sort performance and
---echo # optimizer does not honor IGNORE INDEX.
---echo # a.k.a WL3527.
---echo #
-CREATE TABLE t1 (a INT, b INT,
- PRIMARY KEY (a),
- KEY i2(a,b));
-INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8);
-INSERT INTO t1 SELECT a + 8,b FROM t1;
-INSERT INTO t1 SELECT a + 16,b FROM t1;
-INSERT INTO t1 SELECT a + 32,b FROM t1;
-INSERT INTO t1 SELECT a + 64,b FROM t1;
-INSERT INTO t1 SELECT a + 128,b FROM t1 limit 16;
-ANALYZE TABLE t1;
-EXPLAIN SELECT 1 FROM t1 WHERE a IN
- (SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2));
-
-CREATE TABLE t2 (a INT, b INT, KEY(a));
-INSERT INTO t2 VALUES (1, 1), (2, 2), (3,3), (4,4);
-EXPLAIN SELECT a, SUM(b) FROM t2 GROUP BY a LIMIT 2;
-EXPLAIN SELECT a, SUM(b) FROM t2 IGNORE INDEX (a) GROUP BY a LIMIT 2;
-
-EXPLAIN SELECT 1 FROM t2 WHERE a IN
- (SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2));
-DROP TABLE t1, t2;
-
---echo #
---echo # From derived_view.test
---echo #
-set @tmp_subselect_extra_derived=@@optimizer_switch;
-set optimizer_switch='derived_merge=on,derived_with_keys=on';
-
---echo #
---echo # LP bug #806504: right join over a view/derived table
---echo #
-
-CREATE TABLE t1 (a int, b int) ;
-INSERT INTO t1 VALUES (0,0);
-
-CREATE TABLE t2 (a int) ;
-INSERT INTO t2 VALUES (0), (0);
-
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-SELECT * FROM t2 RIGHT JOIN (SELECT * FROM t1) AS t ON t.a != 0
- WHERE t.a IN (SELECT b FROM t1);
-EXPLAIN EXTENDED
-SELECT * FROM t2 RIGHT JOIN (SELECT * FROM t1) AS t ON t.a != 0
- WHERE t.a IN (SELECT b FROM t1);
-
-SELECT * FROM t2 RIGHT JOIN v1 AS t ON t.a != 0
- WHERE t.a IN (SELECT b FROM t1);
-EXPLAIN EXTENDED
-SELECT * FROM t2 RIGHT JOIN v1 AS t ON t.a != 0
- WHERE t.a IN (SELECT b FROM t1);
-
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
---echo #
---echo # LP bug #793448: materialized view accessed by two-component key
---echo #
-
-CREATE TABLE t1 (a int, b int);
-INSERT INTO t1 VALUES (9,3), (2,5);
-
-CREATE TABLE t2 (a int, b int);
-INSERT INTO t2 VALUES (9,3), (3,7), (9,1), (2,5), (2,4), (3,8);
-
-CREATE TABLE t3 (a int, b int);
-INSERT INTO t3 VALUES (10,3), (9,7), (9,1), (2,4);
-
-CREATE VIEW v1(a,b) AS SELECT a, MAX(b) FROM t2 GROUP BY a;
-CREATE VIEW v2(a,b) AS SELECT a,b FROM t2 UNION SELECT a,b FROM t3;
-
-SELECT * FROM v1;
-SELECT a FROM t1 WHERE (a,b) IN (SELECT * FROM v1);
-EXPLAIN
-SELECT a FROM t1 WHERE (a,b) IN (SELECT * FROM v1);
-
-SELECT * FROM v2;
-SELECT a FROM t1 WHERE (a,b) IN (SELECT * FROM v2);
-EXPLAIN
-SELECT a FROM t1 WHERE (a,b) IN (SELECT * FROM v2);
-
-DROP VIEW v1,v2;
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # LP bug #874006: materialized view used in IN subquery
---echo #
-
-CREATE TABLE t3 (a int NOT NULL, b varchar(1), c varchar(1));
-INSERT INTO t3 VALUES (19,NULL,NULL), (20,'r','r');
-
-CREATE TABLE t1 (a int, b varchar(1) , c varchar(1));
-INSERT INTO t1 VALUES (1,NULL,NULL), (5,'r','r'), (7,'y','y');
-
-CREATE TABLE t2 (a int NOT NULL , b int, c varchar(1));
-INSERT INTO t2 VALUES (4,3,'r');
-
-CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
-
-SET SESSION optimizer_switch='derived_with_keys=off';
-EXPLAIN
-SELECT * FROM t3
- WHERE t3.b IN (SELECT v1.b FROM v1, t2
- WHERE t2.c = v1.c AND t2.c = v1.b AND v1.b = t3.c);
-SELECT * FROM t3
- WHERE t3.b IN (SELECT v1.b FROM v1, t2
- WHERE t2.c = v1.c AND t2.c = v1.b AND v1.b = t3.c);
-
-SET SESSION optimizer_switch='derived_with_keys=on';
-EXPLAIN
-SELECT * FROM t3
- WHERE t3.b IN (SELECT v1.b FROM v1, t2
- WHERE t2.c = v1.c AND t2.c = v1.b AND v1.b = t3.c);
-SELECT * FROM t3
- WHERE t3.b IN (SELECT v1.b FROM v1, t2
- WHERE t2.c = v1.c AND t2.c = v1.b AND v1.b = t3.c);
-
-DROP VIEW v1;
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # LP bug #873263: materialized view used in correlated IN subquery
---echo #
-
-CREATE TABLE t1 (a int, b int) ;
-INSERT INTO t1 VALUES (5,4), (9,8);
-
-CREATE TABLE t2 (a int, b int) ;
-INSERT INTO t2 VALUES (4,5), (5,1);
-
-CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2;
-
-SET SESSION optimizer_switch='derived_with_keys=on';
-EXPLAIN
-SELECT * FROM t1 WHERE t1.b IN (SELECT v2.a FROM v2 WHERE v2.b = t1.a);
-SELECT * FROM t1 WHERE t1.b IN (SELECT v2.a FROM v2 WHERE v2.b = t1.a);
-
-DROP VIEW v2;
-DROP TABLE t1,t2;
-
-set optimizer_switch= @tmp_subselect_extra_derived;
diff --git a/mysql-test/t/subselect_extra_no_semijoin.test b/mysql-test/t/subselect_extra_no_semijoin.test
deleted file mode 100644
index 8aba3dde72b..00000000000
--- a/mysql-test/t/subselect_extra_no_semijoin.test
+++ /dev/null
@@ -1,9 +0,0 @@
-set @subselect_extra_no_sj_tmp=@@optimizer_switch;
-
-set @optimizer_switch_for_subselect_extra_test='semijoin=off,firstmatch=off,loosescan=off,semijoin_with_cache=off';
-
---source t/subselect_extra.test
-
-set optimizer_switch= @subselect_extra_no_sj_tmp;
-
-set @optimizer_switch_for_subselect_extra_test=null; \ No newline at end of file
diff --git a/mysql-test/t/subselect_gis.test b/mysql-test/t/subselect_gis.test
deleted file mode 100644
index 1ab139b7822..00000000000
--- a/mysql-test/t/subselect_gis.test
+++ /dev/null
@@ -1,17 +0,0 @@
--- source include/have_geometry.inc
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-#
-# correct behavoiur for function from reduced subselect
-#
-create table t1(City VARCHAR(30),Location geometry);
-insert into t1 values("Paris",GeomFromText('POINT(2.33 48.87)'));
-select City from t1 where (select
-intersects(GeomFromText(AsText(Location)),GeomFromText('Polygon((2 50, 2.5
-50, 2.5 47, 2 47, 2 50))'))=0);
-drop table t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/subselect_innodb.test b/mysql-test/t/subselect_innodb.test
deleted file mode 100644
index 544bcd994ed..00000000000
--- a/mysql-test/t/subselect_innodb.test
+++ /dev/null
@@ -1,613 +0,0 @@
--- source include/have_innodb.inc
-
-# Note: the tests uses only non-semijoin subqueries so semi-join switch
-# settings are not relevant.
-set @subselect_innodb_tmp=@@optimizer_switch;
-set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
---disable_warnings
-drop table if exists t1,t2,t3;
---enable_warnings
-
-#
-# key field overflow test
-#
-CREATE TABLE t1
-(
-FOLDERID VARCHAR(32)BINARY NOT NULL
-, FOLDERNAME VARCHAR(255)BINARY NOT NULL
-, CREATOR VARCHAR(255)BINARY
-, CREATED TIMESTAMP NOT NULL
-, DESCRIPTION VARCHAR(255)BINARY
-, FOLDERTYPE INTEGER NOT NULL
-, MODIFIED TIMESTAMP
-, MODIFIER VARCHAR(255)BINARY
-, FOLDERSIZE INTEGER NOT NULL
-, PARENTID VARCHAR(32)BINARY
-, REPID VARCHAR(32)BINARY
-, ORIGINATOR INTEGER
-
-, PRIMARY KEY ( FOLDERID )
-) ENGINE=InnoDB;
-CREATE INDEX FFOLDERID_IDX ON t1 (FOLDERID);
-CREATE INDEX CMFLDRPARNT_IDX ON t1 (PARENTID);
-INSERT INTO t1 VALUES("0c9aab05b15048c59bc35c8461507deb", "System", "System", "2003-06-05 16:30:00", "The system content repository folder.", "3", "2003-06-05 16:30:00", "System", "0", NULL, "9c9aab05b15048c59bc35c8461507deb", "1");
-INSERT INTO t1 VALUES("2f6161e879db43c1a5b82c21ddc49089", "Default", "System", "2003-06-09 10:52:02", "The default content repository folder.", "3", "2003-06-05 16:30:00", "System", "0", NULL, "03eea05112b845949f3fd03278b5fe43", "1");
-INSERT INTO t1 VALUES("c373e9f5ad0791724315444553544200", "AddDocumentTest", "admin", "2003-06-09 10:51:25", "Movie Reviews", "0", "2003-06-09 10:51:25", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL);
-SELECT 'c373e9f5ad0791a0dab5444553544200' IN(SELECT t1.FOLDERID FROM t1 WHERE t1.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND t1.FOLDERNAME = 'Level1');
-drop table t1;
-
-#
-# UNION unlocking test
-#
-create table t1 (a int) engine=innodb;
-create table t2 (a int) engine=innodb;
-create table t3 (a int) engine=innodb;
-insert into t1 values (1),(2),(3),(4);
-insert into t2 values (10),(20),(30),(40);
-insert into t3 values (1),(2),(10),(50);
-select a from t3 where t3.a in (select a from t1 where a <= 3 union select * from t2 where a <= 30);
-drop table t1,t2,t3;
-
-
-CREATE TABLE t1 (
- processor_id INTEGER NOT NULL,
- PRIMARY KEY (processor_id)
-) ENGINE=InnoDB;
-CREATE TABLE t3 (
- yod_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL,
- login_processor INTEGER UNSIGNED ,
- PRIMARY KEY (yod_id)
-) ENGINE=InnoDB;
-CREATE TABLE t2 (
- processor_id INTEGER NOT NULL,
- yod_id BIGINT UNSIGNED NOT NULL,
- PRIMARY KEY (processor_id, yod_id),
- INDEX (processor_id),
- INDEX (yod_id),
- FOREIGN KEY (processor_id) REFERENCES t1(processor_id),
- FOREIGN KEY (yod_id) REFERENCES t3(yod_id)
-) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1),(2),(3);
-INSERT INTO t3 VALUES (1,1),(2,2),(3,3);
-INSERT INTO t2 VALUES (1,1),(2,2),(3,3);
-SELECT distinct p1.processor_id, (SELECT y.yod_id FROM t1 p2, t2 y WHERE p2.processor_id = p1.processor_id and p2.processor_id = y.processor_id) FROM t1 p1;
-drop table t2,t1,t3;
-
-#
-# innodb locking
-#
-CREATE TABLE t1 (
- id int(11) NOT NULL default '0',
- b int(11) default NULL,
- c char(3) default NULL,
- PRIMARY KEY (id),
- KEY t2i1 (b)
-) ENGINE=innodb DEFAULT CHARSET=latin1;
-INSERT INTO t1 VALUES (0,0,'GPL'),(1,0,'GPL'),(2,1,'GPL'),(3,2,'GPL');
-CREATE TABLE t2 (
- id int(11) NOT NULL default '0',
- b int(11) default NULL,
- c char(3) default NULL,
- PRIMARY KEY (id),
- KEY t2i (b)
-) ENGINE=innodb DEFAULT CHARSET=latin1;
-INSERT INTO t2 VALUES (0,0,'GPL'),(1,0,'GPL'),(2,1,'GPL'),(3,2,'GPL');
-select (select max(id) from t2 where b=1 group by b) as x,b from t1 where b=1;
-drop table t1,t2;
-
-#
-# reiniting innodb tables
-#
-create table t1 (id int not null, value char(255), primary key(id)) engine=innodb;
-create table t2 (id int not null, value char(255)) engine=innodb;
-insert into t1 values (1,'a'),(2,'b');
-insert into t2 values (1,'z'),(2,'x');
-select t2.id,t2.value,(select t1.value from t1 where t1.id=t2.id) from t2;
-select t2.id,t2.value,(select t1.value from t1 where t1.id=t2.id) from t2;
-drop table t1,t2;
-
-#
-# unlocking tables with subqueries in HAVING
-#
-create table t1 (a int, b int) engine=innodb;
-insert into t1 values (1,2), (1,3), (2,3), (2,4), (2,5), (3,4), (4,5), (4,100);
-create table t2 (a int) engine=innodb;
-insert into t2 values (1),(2),(3),(4);
-select a, sum(b) as b from t1 group by a having b > (select max(a) from t2);
-drop table t1, t2;
-
-#
-# bug #5220 test suite
-#
-CREATE TABLE `t1` ( `unit` varchar(50) NOT NULL default '', `ingredient` varchar(50) NOT NULL default '') ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-CREATE TABLE `t2` ( `ingredient` varchar(50) NOT NULL default '', `unit` varchar(50) NOT NULL default '', PRIMARY KEY (ingredient, unit)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-INSERT INTO `t1` VALUES ('xx','yy');
-INSERT INTO `t2` VALUES ('yy','xx');
-
-SELECT R.unit, R.ingredient FROM t1 R WHERE R.ingredient IN (SELECT N.ingredient FROM t2 N WHERE N.unit = R.unit);
-
-drop table t1, t2;
-
-#
-# possible early unlock
-#
-CREATE TABLE t1 (
- id INT NOT NULL auto_increment,
- date1 DATE, coworkerid INT,
- description VARCHAR(255),
- sum_used DOUBLE,
- sum_remaining DOUBLE,
- comments VARCHAR(255),
- PRIMARY KEY(id)
-) engine=innodb;
-insert into t1 values (NULL, '1999-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1999-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1999-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1998-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1998-01-01', 1,'test', 22, 33, 'comment'), (NULL, '2004-01-01', 1,'test', 22, 33, 'comment'), (NULL, '2004-01-01', 1,'test', 22, 33, 'comment');
-SELECT DISTINCT
- (SELECT sum(sum_used) FROM t1 WHERE sum_used > 0 AND year(date1) <= '2004') as somallontvangsten,
- (SELECT sum(sum_used) FROM t1 WHERE sum_used < 0 AND year(date1) <= '2004') as somalluitgaven
- FROM t1;
-select * from t1;
-drop table t1;
-
-#
-# cleaning up of results of subselects (BUG#8125)
-#
-CREATE TABLE `t1` ( `a` char(3) NOT NULL default '', `b` char(3) NOT NULL default '', `c` char(3) NOT NULL default '', PRIMARY KEY (`a`,`b`,`c`)) ENGINE=InnoDB;
-CREATE TABLE t2 LIKE t1;
-INSERT INTO t1 VALUES (1,1,1);
-INSERT INTO t2 VALUES (1,1,1);
-PREPARE my_stmt FROM "SELECT t1.b, count(*) FROM t1 group by t1.b having
-count(*) > ALL (SELECT COUNT(*) FROM t2 WHERE t2.a=1 GROUP By t2.b)";
-EXECUTE my_stmt;
-EXECUTE my_stmt;
-deallocate prepare my_stmt;
-drop table t1,t2;
-
-# End of 4.1 tests
-
-CREATE TABLE t1 (
- school_name varchar(45) NOT NULL,
- country varchar(45) NOT NULL,
- funds_requested float NOT NULL,
- schooltype varchar(45) NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
-insert into t1 values ("the school", "USA", 1200, "Human");
-
-select count(country) as countrycount, sum(funds_requested) as smcnt,
- country, (select sum(funds_requested) from t1) as total_funds
-from t1
-group by country;
-
-select count(country) as countrycount, sum(funds_requested) as smcnt,
- country, (select sum(funds_requested) from t1) as total_funds
-from t1
-group by country;
-
-drop table t1;
-
-#
-# BUG#14342: wrong placement of subquery internals in complex queries
-#
-CREATE TABLE `t1` (
- `t3_id` int NOT NULL,
- `t1_id` int NOT NULL,
- PRIMARY KEY (`t1_id`)
-);
-CREATE TABLE `t2` (
- `t2_id` int NOT NULL,
- `t1_id` int NOT NULL,
- `b` int NOT NULL,
- PRIMARY KEY (`t2_id`),
- UNIQUE KEY `idx_t2_t1_b` (`t1_id`,`b`)
-) ENGINE=InnoDB;
-CREATE TABLE `t3` (
- `t3_id` int NOT NULL
-);
-INSERT INTO `t3` VALUES (3);
-select
- (SELECT rs.t2_id
- FROM t2 rs
- WHERE rs.t1_id=
- (SELECT lt.t1_id
- FROM t1 lt
- WHERE lt.t3_id=a.t3_id)
- ORDER BY b DESC LIMIT 1)
-from t3 AS a;
-# repeat above query in SP
---disable_warnings
-DROP PROCEDURE IF EXISTS p1;
---enable_warnings
-delimiter //;
-create procedure p1()
-begin
- declare done int default 3;
- repeat
- select
- (SELECT rs.t2_id
- FROM t2 rs
- WHERE rs.t1_id=
- (SELECT lt.t1_id
- FROM t1 lt
- WHERE lt.t3_id=a.t3_id)
- ORDER BY b DESC LIMIT 1) as x
- from t3 AS a;
- set done= done-1;
- until done <= 0 end repeat;
-end//
-delimiter ;//
-call p1();
-call p1();
-call p1();
-drop procedure p1;
-drop tables t1,t2,t3;
-
---echo #
---echo # Bug #58756
---echo # Crash in heap_rrnd on query with HAVING ... IN (subquery) + LIMIT
---echo #
-
-CREATE TABLE t1 (
- col_time_key time DEFAULT NULL,
- col_datetime_key datetime DEFAULT NULL,
- col_varchar_nokey varchar(1) DEFAULT NULL,
- KEY col_time_key (col_time_key),
- KEY col_datetime_key (col_datetime_key)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-INSERT INTO t1 VALUES ('17:53:30','2005-11-10 12:40:29','h');
-INSERT INTO t1 VALUES ('11:35:49','2009-04-25 00:00:00','b');
-INSERT INTO t1 VALUES (NULL,'2002-11-27 00:00:00','s');
-INSERT INTO t1 VALUES ('06:01:40','2004-01-26 20:32:32','e');
-INSERT INTO t1 VALUES ('05:45:11','2007-10-26 11:41:40','j');
-INSERT INTO t1 VALUES ('00:00:00','2005-10-07 00:00:00','e');
-INSERT INTO t1 VALUES ('00:00:00','2000-07-15 05:00:34','f');
-INSERT INTO t1 VALUES ('06:11:01','2000-04-03 16:33:32','v');
-INSERT INTO t1 VALUES ('13:02:46',NULL,'x');
-INSERT INTO t1 VALUES ('21:44:25','2001-04-25 01:26:12','m');
-INSERT INTO t1 VALUES ('22:43:58','2000-12-27 00:00:00','c');
-
-CREATE TABLE t2 (
- col_time_key time DEFAULT NULL,
- col_datetime_key datetime DEFAULT NULL,
- col_varchar_nokey varchar(1) DEFAULT NULL,
- KEY col_time_key (col_time_key),
- KEY col_datetime_key (col_datetime_key)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-INSERT INTO t2 VALUES ('11:28:45','2004-10-11 18:13:16','w');
-
-SELECT col_time_key, col_datetime_key
-FROM
-( SELECT * FROM t1 ) AS table1
-HAVING ( 'r' , 'e' ) IN
- ( SELECT col_varchar_nokey , col_varchar_nokey FROM t2 )
-ORDER BY col_datetime_key
-LIMIT 10;
-
-DROP TABLE t1;
-DROP TABLE t2;
-
---echo # End of Bug #58756
-
---echo #
---echo # Bug#60085 crash in Item::save_in_field() with time data type
---echo #
-
-CREATE TABLE t1(a date, b int, unique(b), unique(a), key(b)) engine=innodb;
-INSERT INTO t1 VALUES ('2011-05-13', 0);
-SELECT * FROM t1 WHERE b < (SELECT CAST(a as date) FROM t1 GROUP BY a);
-DROP TABLE t1;
-
---echo #
---echo # Bug #11766300 59387: FAILING ASSERTION: CURSOR->POS_STATE == 1997660512 (BTR_PCUR_IS_POSITIONE
---echo #
-
-CREATE TABLE t1 (a INT) ENGINE=INNODB;
-INSERT INTO t1 VALUES (0);
-CREATE TABLE t2 (d BINARY(2), PRIMARY KEY (d(1)), UNIQUE KEY (d)) ENGINE=INNODB;
-
-SELECT 1 FROM t1 WHERE NOT EXISTS
-(SELECT 1 FROM t2 WHERE d = (SELECT d FROM t2 WHERE a >= 1) ORDER BY d);
-
-EXPLAIN SELECT 1 FROM t1 WHERE NOT EXISTS
-(SELECT 1 FROM t2 WHERE d = (SELECT d FROM t2 WHERE a >= 1) ORDER BY d);
-
-DROP TABLE t2;
-
-CREATE TABLE t2 (b INT, c INT, UNIQUE KEY (b), UNIQUE KEY (b, c )) ENGINE=INNODB;
-INSERT INTO t2 VALUES (1, 1);
-
-SELECT 1 FROM t1
-WHERE a != (SELECT 1 FROM t2 WHERE a <=> b OR a > '' AND 6 = 7 ORDER BY b, c);
-
-DROP TABLE t1, t2;
-
---echo #
---echo # Bug #13639204 64111: CRASH ON SELECT SUBQUERY WITH NON UNIQUE
---echo # INDEX
---echo #
-CREATE TABLE t1 (
-id int
-) ENGINE=InnoDB;
-INSERT INTO t1 (id) VALUES (11);
-
-CREATE TABLE t2 (
-t1_id int,
-position int,
-KEY t1_id (t1_id),
-KEY t1_id_position (t1_id,position)
-) ENGINE=InnoDB;
-
-let $query=SELECT
-(SELECT position FROM t2
-WHERE t2.t1_id = t1.id
-ORDER BY t2.t1_id , t2.position
-LIMIT 10,1
-) AS maxkey
-FROM t1
-LIMIT 1;
-
-eval EXPLAIN $query;
-eval $query;
-
-DROP TABLE t1,t2;
-
---echo End of 5.1 tests
-
---echo #
---echo # lp:827416 Crash in select_describe() on EXPLAIN with DISTINCT in nested subqueries
---echo #
-
-CREATE TABLE t3 ( b int) ENGINE=InnoDB;
-CREATE TABLE t2 ( c int) ENGINE=InnoDB;
-CREATE TABLE t1 ( a int NOT NULL , PRIMARY KEY (a)) ENGINE=InnoDB;
-
-EXPLAIN SELECT *
-FROM t1
-WHERE t1.a = (
- SELECT SUM( c )
- FROM t2
- WHERE (SELECT DISTINCT b FROM t3) > 0);
-SELECT *
-FROM t1
-WHERE t1.a = (
- SELECT SUM( c )
- FROM t2
- WHERE (SELECT DISTINCT b FROM t3) > 0);
-
-DROP TABLE t1, t2, t3;
-
-
---echo #
---echo # lp:858148 Fourth crash in select_describe() with nested subqueries
---echo #
-
-CREATE TABLE t1 ( f1 int(11)) ENGINE=InnoDB;
-CREATE TABLE t2 ( f1 int(11), f2 int(11), PRIMARY KEY (f1)) ;
-CREATE TABLE t3 ( f3 int(11)) ENGINE=InnoDB;
-
-EXPLAIN
-SELECT MAX( f1 ) FROM t2
-WHERE f2 >= (
- SELECT SUM( f1 )
- FROM t1
- WHERE EXISTS (
- SELECT f3
- FROM t3
- GROUP BY 1
- )
-);
-
-SELECT MAX( f1 ) FROM t2
-WHERE f2 >= (
- SELECT SUM( f1 )
- FROM t1
- WHERE EXISTS (
- SELECT f3
- FROM t3
- GROUP BY 1
- )
-);
-
-drop table t1, t2, t3;
-
---echo #
---echo # LP BUG#1006231 crash in select_describe
---echo #
-
-create table t1(a1 int) ENGINE=InnoDB;
-insert into t1 values (1);
-explain
-select 1 from t1 where 1 like (select 1 from t1 where 1 <=> (select 1 from t1 group by a1));
-select 1 from t1 where 1 like (select 1 from t1 where 1 <=> (select 1 from t1 group by a1));
-drop table t1;
-
-
---echo #
---echo # MDEV-3988 crash in create_tmp_table
---echo #
-
-drop table if exists `t1`,`t2`;
-create table `t1`(`a` char(1) character set utf8)engine=innodb;
-create table `t2`(`b` char(1) character set utf8)engine=memory;
-select distinct (select 1 from `t2` where `a`) `d2` from `t1`;
-select distinct (select 1 from `t2` where `a`) `d2`, a from `t1`;
-select distinct a, (select 1 from `t2` where `a`) `d2` from `t1`;
-select distinct (1 + (select 1 from `t2` where `a`)) `d2` from `t1`;
-
-drop table t1,t2;
-
---echo #
---echo # MDEV-4042: Assertion `table->key_read == 0' fails in close_thread_table on EXPLAIN with GROUP BY and HAVING in EXISTS SQ,
---echo # MDEV-4536: ...sql/sql_base.cc:1598: bool close_thread_table(THD*, TABLE**): Assertion `table->key_read == 0' failed.
-CREATE TABLE t1 (a INT) ENGINE=InnoDB;
-CREATE TABLE t2 (b INT PRIMARY KEY, c INT) ENGINE=InnoDB;
-CREATE TABLE t3 (d INT) ENGINE=InnoDB;
-
-EXPLAIN
-SELECT * FROM t1 WHERE EXISTS ( SELECT b FROM t2, t3 GROUP BY b HAVING b != 3 );
-SELECT * FROM t1 WHERE EXISTS ( SELECT b FROM t2, t3 GROUP BY b HAVING b != 3 );
-
-DROP TABLE t1,t2,t3;
-
-CREATE TABLE t1 (
- pk int auto_increment primary key,
- col_int_key int(11),
- key col_int_key (col_int_key),col_varchar_key varchar(128),
- key (col_varchar_key)
-) engine=innodb;
-
-EXPLAIN
-SELECT 1 FROM t1 AS alias1
-WHERE EXISTS ( SELECT SQ2_alias1 . col_int_key AS SQ2_field1
- FROM ( t1 AS SQ2_alias1 RIGHT OUTER JOIN
- t1 AS SQ2_alias2 ON (SQ2_alias2 . col_int_key = SQ2_alias1 . col_int_key )
- )
- GROUP BY SQ2_field1
- HAVING SQ2_alias1 . col_int_key >= 7
- );
-
-SELECT 1 FROM t1 AS alias1
-WHERE EXISTS ( SELECT SQ2_alias1 . col_int_key AS SQ2_field1
- FROM ( t1 AS SQ2_alias1 RIGHT OUTER JOIN
- t1 AS SQ2_alias2 ON (SQ2_alias2 . col_int_key = SQ2_alias1 . col_int_key )
- )
- GROUP BY SQ2_field1
- HAVING SQ2_alias1 . col_int_key >= 7
- );
-drop table t1;
-
-
-set optimizer_switch=@subselect_innodb_tmp;
-
---echo #
---echo # MDEV-9635:Server crashes in part_of_refkey or assertion
---echo # `!created && key_to_save < (int)s->keys' failed in
---echo # TABLE::use_index(int) or with join_cache_level>2
---echo #
-
-SET join_cache_level=3;
-
-CREATE TABLE t1 (f1 VARCHAR(1024)) ENGINE=InnoDB;
-CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
-
-CREATE TABLE t2 (f2 VARCHAR(4)) ENGINE=InnoDB;
-INSERT INTO t2 VALUES ('foo'),('bar');
-
-SELECT * FROM v1, t2 WHERE ( f1, f2 ) IN ( SELECT f1, f1 FROM t1 );
-
-set join_cache_level = default;
-drop view v1;
-drop table t1,t2;
-
---echo #
---echo # MDEV-10693: cost-based choice between materialization and in-to-exists
---echo # for a subquery from the expression used in ref access
---echo #
-
---source include/have_innodb.inc
-
-CREATE TABLE t1 (i1 INT PRIMARY KEY) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE TABLE t2 (i2 INT) ENGINE=InnoDB;
-
-CREATE TABLE t3 (i3 INT PRIMARY KEY) ENGINE=InnoDB;
-INSERT INTO t3 VALUES (3);
-
-SELECT * FROM t1
- WHERE NULL IN ( SELECT i2 FROM t2
- WHERE i1 IN ( i2 IN ( SELECT i3 FROM t3 ) ) AND i2 = 2 );
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # MDEV-6041: ORDER BY+subqueries: subquery_table.key=outer_table.col is not recongized as binding
---echo #
-create table t1(a int) engine=innodb;
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t2(
- id int primary key,
- key1 int,
- col1 int,
- key(key1)
-) engine=innodb;
-
-insert into t2
- select
- A.a + B.a*10 + C.a*100 + D.a* 1000,
- A.a + 10*B.a,
- 123456
-from t1 A, t1 B, t1 C, t1 D;
-
---echo # Table tsubq:
---echo # - must use 'ref' (not 'index'), and must not use 'Using filesort'
---echo # - shows a bad estimate for 'rows' (but I'm not sure if one can do better w/o histograms)
-explain select
- (SELECT
- concat(id, '-', key1, '-', col1)
- FROM t2
- WHERE t2.key1 = t1.a
- ORDER BY t2.id ASC LIMIT 1)
-from
- t1;
-
---echo #
---echo # MDEV-6081: ORDER BY+ref(const): selectivity is very incorrect (MySQL Bug#14338686)
---echo #
-
-alter table t2 add key2 int;
-update t2 set key2=key1;
-alter table t2 add key(key2);
-analyze table t2;
-flush tables;
---echo # Table tsubq must use 'ref' + Using filesort (not 'index' w/o filesort)
---replace_column 9 #
-explain select
- (SELECT
- concat(id, '-', key1, '-', col1)
- FROM t2
- WHERE t2.key1 = t1.a
- ORDER BY t2.key2 ASC LIMIT 1)
-from
- t1;
-
-drop table t1,t2;
-
---echo #
---echo # mdev-12931: semi-join in ON expression of STRAIGHT_JOIN
---echo # joining a base table and a mergeable derived table
---echo #
-
-CREATE TABLE t1 (f1 int) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (3),(2);
-
-CREATE TABLE t2 (f2 int) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1),(4);
-
-CREATE TABLE t3 (f3 int) ENGINE=InnoDB;
-INSERT INTO t3 VALUES (5),(6);
-
-CREATE TABLE t4 (f4 int) ENGINE=InnoDB;
-INSERT INTO t4 VALUES (1),(8);
-
-SELECT *
-FROM t1
- INNER JOIN
- ( t2 STRAIGHT_JOIN ( SELECT * FROM t3 ) AS sq
- ON ( 1 IN ( SELECT f4 FROM t4 ) ) )
- ON ( f1 >= f2 );
-
-EXPLAIN EXTENDED
-SELECT *
-FROM t1
- INNER JOIN
- ( t2 STRAIGHT_JOIN ( SELECT * FROM t3 ) AS sq
- ON ( 1 IN ( SELECT f4 FROM t4 ) ) )
- ON ( f1 >= f2 );
-
-DROP TABLE t1,t2,t3,t4;
-
diff --git a/mysql-test/t/subselect_mat.test b/mysql-test/t/subselect_mat.test
deleted file mode 100644
index bf5de741ea0..00000000000
--- a/mysql-test/t/subselect_mat.test
+++ /dev/null
@@ -1,285 +0,0 @@
-#
-# Hash semi-join regression tests
-# (WL#1110: Subquery optimization: materialization)
-#
-
-
-# force the use of materialization
-set @subselect_mat_test_optimizer_switch_value='materialization=on,in_to_exists=off,semijoin=off';
-
---source t/subselect_sj_mat.test
-set @subselect_mat_test_optimizer_switch_value=null;
-
-set @@optimizer_switch='materialization=on,in_to_exists=off,semijoin=off';
-set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
-#
-# Test that the contents of the temp table of a materialized subquery is
-# cleaned up between PS re-executions.
-#
-
-create table t0 (a int);
-insert into t0 values (0),(1),(2);
-create table t1 (a int);
-insert into t1 values (0),(1),(2);
-explain select a, a in (select a from t1) from t0;
-select a, a in (select a from t1) from t0;
-prepare s from 'select a, a in (select a from t1) from t0';
-execute s;
-update t1 set a=123;
-execute s;
-drop table t0, t1;
-
-
---echo #
---echo # LPBUG#609121: RQG: wrong result on aggregate + NOT IN + HAVING and
---echo # partial_match_table_scan=on
---echo #
-
-create table t1 (c1 int);
-create table t2 (c2 int);
-insert into t1 values (1);
-insert into t2 values (2);
-
-set @@optimizer_switch='semijoin=off';
-
-EXPLAIN
-SELECT SUM(c1) c1_sum FROM t1 WHERE c1 IN (SELECT c2 FROM t2);
-SELECT SUM(c1) c1_sum FROM t1 WHERE c1 IN (SELECT c2 FROM t2);
-EXPLAIN
-SELECT SUM(c1) c1_sum FROM t1 WHERE c1 IN (SELECT c2 FROM t2) HAVING c1_sum;
-SELECT SUM(c1) c1_sum FROM t1 WHERE c1 IN (SELECT c2 FROM t2) HAVING c1_sum;
-
-drop table t1, t2;
-
---echo #
---echo # BUG#52344 - Subquery materialization:
---echo # Assertion if subquery in on-clause of outer join
---echo #
-
-set @@optimizer_switch='semijoin=off';
-
-CREATE TABLE t1 (i INTEGER);
-INSERT INTO t1 VALUES (10);
-
-CREATE TABLE t2 (j INTEGER);
-INSERT INTO t2 VALUES (5);
-
-CREATE TABLE t3 (k INTEGER);
-
-EXPLAIN
-SELECT i FROM t1 LEFT JOIN t2 ON (j) IN (SELECT k FROM t3);
-SELECT i FROM t1 LEFT JOIN t2 ON (j) IN (SELECT k FROM t3);
-
-EXPLAIN
-SELECT i FROM t1 LEFT JOIN t2 ON (j) IN (SELECT max(k) FROM t3);
-SELECT i FROM t1 LEFT JOIN t2 ON (j) IN (SELECT max(k) FROM t3);
-
-DROP TABLE t1, t2, t3;
-
---echo #
---echo # LPBUG#611622/BUG#52344: Subquery materialization: Assertion
---echo # if subquery in on-clause of outer join
---echo #
-
-CREATE TABLE t1 (c1 int);
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE TABLE t2 (c2 int);
-INSERT INTO t2 VALUES (10);
-
-PREPARE st1 FROM "
-SELECT *
-FROM t2 LEFT JOIN t2 t3 ON (8, 4) IN (SELECT c1, c1 FROM t1)";
-
-EXECUTE st1;
-EXECUTE st1;
-
-DROP TABLE t1, t2;
-
---echo #
---echo # Testcase backport: BUG#46548 IN-subqueries return 0 rows with materialization=on
---echo #
-CREATE TABLE t1 (
- pk int,
- a varchar(1),
- b varchar(4),
- c varchar(4),
- d varchar(4),
- PRIMARY KEY (pk)
-);
-INSERT INTO t1 VALUES (1,'o','ffff','ffff','ffoo'),(2,'f','ffff','ffff','ffff');
-
-CREATE TABLE t2 LIKE t1;
-INSERT INTO t2 VALUES (1,'i','iiii','iiii','iiii'),(2,'f','ffff','ffff','ffff');
-
-SET @@optimizer_switch='default,semijoin=on,materialization=on';
-EXPLAIN SELECT pk FROM t1 WHERE (a) IN (SELECT a FROM t2 WHERE pk > 0);
-SELECT pk FROM t1 WHERE (a) IN (SELECT a FROM t2 WHERE pk > 0);
-SELECT pk FROM t1 WHERE (b,c,d) IN (SELECT b,c,d FROM t2 WHERE pk > 0);
-DROP TABLE t1, t2;
-
-
--- echo #
--- echo # BUG#724228: Wrong result with materialization=on and three aggregates in maria-5.3-mwl90
--- echo #
-CREATE TABLE t1 ( f2 int(11)) ;
-INSERT IGNORE INTO t1 VALUES ('7'),('9'),('7'),('4'),('2'),('6'),('8'),('5'),('6'),('188'),('2'),('1'),('1'),('0'),('9'),('4');
-
-CREATE TABLE t2 ( f1 int(11), f2 int(11)) ENGINE=MyISAM;
-INSERT IGNORE INTO t2 VALUES ('1','1');
-
-CREATE TABLE t3 ( f1 int(11), f2 int(11), f3 int(11), PRIMARY KEY (f1)) ;
-INSERT IGNORE INTO t3 VALUES ('16','6','1'),('18','3','4'),('19',NULL,'9'),('20','0','6'),('41','2','0'),('42','2','5'),('43','9','6'),('44','7','4'),('45','1','4'),('46','222','238'),('47','3','6'),('48','6','6'),('49',NULL,'1'),('50','5','1');
-
-SET @_save_join_cache_level = @@join_cache_level;
-SET @_save_optimizer_switch = @@optimizer_switch;
-
-SET join_cache_level = 1;
-SET optimizer_switch='materialization=on';
-
-SELECT f1 FROM t3
-WHERE
- f1 NOT IN (SELECT MAX(f2) FROM t1) AND
- f3 IN (SELECT MIN(f1) FROM t2) AND
- f1 IN (SELECT COUNT(f2) FROM t1);
-
-SET @@join_cache_level = @_save_join_cache_level;
-SET @@optimizer_switch = @_save_optimizer_switch;
-
-drop table t1, t2, t3;
-
---echo #
---echo # LPBUG#719198 Ordered_key::cmp_key_with_search_key(rownum_t): Assertion `!compare_pred[i]->null_value'
---echo # failed with subquery on both sides of NOT IN and materialization
---echo #
-
-CREATE TABLE t1 (f1a int, f1b int) ;
-INSERT IGNORE INTO t1 VALUES (1,1),(2,2);
-CREATE TABLE t2 ( f2 int);
-INSERT IGNORE INTO t2 VALUES (3),(4);
-CREATE TABLE t3 (f3a int, f3b int);
-
-set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,in_to_exists=off';
-
-EXPLAIN
-SELECT * FROM t2 WHERE (SELECT f3a FROM t3) NOT IN (SELECT f1a FROM t1);
-SELECT * FROM t2 WHERE (SELECT f3a FROM t3) NOT IN (SELECT f1a FROM t1);
-
-EXPLAIN
-SELECT (SELECT f3a FROM t3) NOT IN (SELECT f1a FROM t1);
-SELECT (SELECT f3a FROM t3) NOT IN (SELECT f1a FROM t1);
-
-EXPLAIN
-SELECT * FROM t2 WHERE (SELECT f3a, f3b FROM t3) NOT IN (SELECT f1a, f1b FROM t1);
-SELECT * FROM t2 WHERE (SELECT f3a, f3b FROM t3) NOT IN (SELECT f1a, f1b FROM t1);
-
-EXPLAIN
-SELECT (SELECT f3a, f3b FROM t3) NOT IN (SELECT f1a, f1b FROM t1);
-SELECT (SELECT f3a, f3b FROM t3) NOT IN (SELECT f1a, f1b FROM t1);
-
-drop table t1, t2, t3;
-
---echo #
---echo # LPBUG#730604 Assertion `bit < (map)->n_bits' failed in maria-5.3 with
---echo # partial_match_rowid_merge
---echo #
-
-CREATE TABLE t1 (f1 int NOT NULL, f2 int, f3 int) ;
-CREATE TABLE t2 (f1 int NOT NULL, f2 int, f3 int) ;
-
-INSERT INTO t1 VALUES (60, 3, null), (61, null, 77);
-INSERT INTO t2 VALUES (1000,6,2);
-
-set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,in_to_exists=off';
-
-EXPLAIN
-SELECT (f1, f2, f3) NOT IN
- (SELECT COUNT(DISTINCT f2), f1, f3 FROM t1 GROUP BY f1, f3)
-FROM t2;
-
-SELECT (f1, f2, f3) NOT IN
- (SELECT COUNT(DISTINCT f2), f1, f3 FROM t1 GROUP BY f1, f3)
-FROM t2;
-
-drop table t1, t2;
-
---echo #
---echo # LPBUG#702301: MAX in select + always false WHERE with SQ
---echo #
-
-CREATE TABLE t1 (a int, b int, KEY (b));
-INSERT INTO t1 VALUES (3,1), (4,2);
-CREATE TABLE t2 (a int);
-INSERT INTO t2 VALUES (7), (8);
-
-set @@optimizer_switch='materialization=on,in_to_exists=off,semijoin=off';
-
-SELECT MAX(t1.b) AS max_res FROM t1 WHERE (9) IN (SELECT a FROM t2);
-EXPLAIN EXTENDED
-SELECT MAX(t1.b) AS max_res FROM t1 WHERE (9) IN (SELECT a FROM t2);
-
-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);
-EXPLAIN EXTENDED
-SELECT MAX(t1.b) AS max_res FROM t1 WHERE (9) IN (SELECT a FROM t2);
-
-DROP TABLE t1,t2;
-
---echo #
---echo # LPBUG#825095: Wrong result with materialization and NOT IN with 2 expressions
---echo #
-
-CREATE TABLE t1 (a int,b int);
-INSERT INTO t1 VALUES (4,4),(4,2);
-
-CREATE TABLE t2 (b int, a int);
-INSERT INTO t2 VALUES (4,3),(8,4);
-
-set @@optimizer_switch='semijoin=off,in_to_exists=off,materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off';
-
-EXPLAIN SELECT *
-FROM t1
-WHERE (a, b) NOT IN (SELECT a, b FROM t2);
-
-SELECT *
-FROM t1
-WHERE (a, b) NOT IN (SELECT a, b FROM t2);
-
-EXPLAIN
-SELECT a, b, (a, b) NOT IN (SELECT a, b FROM t2) as sq
-FROM t1;
-
-SELECT a, b, (a, b) NOT IN (SELECT a, b FROM t2) as sq
-FROM t1;
-
-drop table t1, t2;
-
---echo #
---echo # MDEV-15235: Assertion `length > 0' failed in create_ref_for_key
---echo #
-
-CREATE TABLE t1 (i INT);
-INSERT INTO t1 VALUES (1),(2);
-CREATE TABLE t2 (f CHAR(1));
-INSERT INTO t2 VALUES ('a'),('b');
-explain
-SELECT * FROM t2 WHERE f IN ( SELECT LEFT('foo',0) FROM t1 ORDER BY 1 );
-SELECT * FROM t2 WHERE f IN ( SELECT LEFT('foo',0) FROM t1 ORDER BY 1 );
-DROP TABLE t1, t2;
-
---echo #
---echo # MDEV-9489: Assertion `0' failed in Protocol::end_statement() on
---echo # UNION ALL
---echo #
-
-CREATE TABLE t1 (f1 INT);
-CREATE TABLE t2 (f2 INT);
-INSERT INTO t1 VALUES (1),(2);
-
-( SELECT 1 FROM t1 WHERE f1 NOT IN ( SELECT f2 FROM t2 ) LIMIT 0 )
-UNION ALL
-( SELECT 1 FROM t1 WHERE f1 NOT IN ( SELECT f2 FROM t2 ) )
-;
-
-drop table t1, t2;
diff --git a/mysql-test/t/subselect_mat_cost-master.opt b/mysql-test/t/subselect_mat_cost-master.opt
deleted file mode 100644
index cb4a9db9617..00000000000
--- a/mysql-test/t/subselect_mat_cost-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---log-output=TABLE,FILE --general-log --slow-query-log=1
diff --git a/mysql-test/t/subselect_mat_cost.test b/mysql-test/t/subselect_mat_cost.test
deleted file mode 100644
index 5a1fb550ca4..00000000000
--- a/mysql-test/t/subselect_mat_cost.test
+++ /dev/null
@@ -1,429 +0,0 @@
-#
-# Tests of cost-based choice between the materialization and in-to-exists
-# subquery execution strategies (MWL#89)
-#
-# The test file is divided into two groups of tests:
-# A. Typical cases when either of the two strategies is selected:
-# 1. Subquery in disjunctive WHERE clause of the outer query.
-# 2. NOT IN subqueries
-# 3. Subqueries with GROUP BY, HAVING, and aggregate functions
-# 4. Subqueries in the SELECT and HAVING clauses
-# 5. Subqueries with UNION
-# B. Reasonably exhaustive tests of the various combinations of optimizer
-# switches, data distribution, available indexes, and typical queries.
-#
-
-set @subselect_mat_cost=@@optimizer_switch;
-set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
-#
-# Test logging to slow log (there was some errors in the log files about
-# the slow log when running under valgrind, so better to get this tested)
-#
-set long_query_time=0.1;
-
-
--- echo TEST GROUP 1:
--- echo Typical cases of in-to-exists and materialization subquery strategies
--- echo =====================================================================
-
---disable_warnings
-drop database if exists world;
---enable_warnings
-
-set names utf8;
-
-create database world;
-use world;
-
---source include/world_schema.inc
---disable_query_log
---disable_result_log
---disable_warnings
---source include/world.inc
---enable_warnings
---enable_result_log
---enable_query_log
-
--- echo Make the schema and data more diverse by adding more indexes, nullable
--- echo columns, and NULL data.
-create index SurfaceArea on Country(SurfaceArea);
-create index Language on CountryLanguage(Language);
-create index CityName on City(Name);
-alter table City change population population int(11) null default 0;
-
-select max(id) from City into @max_city_id;
-insert into City values (@max_city_id + 1,'Kilifarevo','BGR',NULL);
-
-
-SELECT COUNT(*) FROM Country;
-SELECT COUNT(*) FROM City;
-SELECT COUNT(*) FROM CountryLanguage;
-
-set @@optimizer_switch = 'in_to_exists=on,semijoin=on,materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on';
-
--- echo
--- echo 1. Subquery in a disjunctive WHERE clause of the outer query.
--- echo
-
--- echo
--- echo Q1.1m:
--- echo MATERIALIZATION: there are too many rows in the outer query
--- echo to be looked up in the inner table.
-EXPLAIN
-SELECT Name FROM Country
-WHERE (Code IN (select Country from City where City.Population > 100000) OR
- Name LIKE 'L%') AND
- surfacearea > 1000000;
-
-SELECT Name FROM Country
-WHERE (Code IN (select Country from City where City.Population > 100000) OR
- Name LIKE 'L%') AND
- surfacearea > 1000000;
-
--- echo Q1.1e:
--- echo IN-EXISTS: the materialization cost is the same as above, but
--- echo there are much fewer outer rows to be looked up, thus the
--- echo materialization cost is too high to compensate for fast lookups.
-EXPLAIN
-SELECT Name FROM Country
-WHERE (Code IN (select Country from City where City.Population > 100000) OR
- Name LIKE 'L%') AND
- surfacearea > 10*1000000;
-
-SELECT Name FROM Country
-WHERE (Code IN (select Country from City where City.Population > 100000) OR
- Name LIKE 'L%') AND
- surfacearea > 10*1000000;
-
--- echo
--- echo Q1.2m:
--- echo MATERIALIZATION: the IN predicate is pushed (attached) to the last table
--- echo in the join order (Country, City), therefore there are too many row
--- echo combinations to filter by re-executing the subquery for each combination.
-EXPLAIN
-SELECT *
- FROM Country, City
- WHERE City.Country = Country.Code AND
- Country.SurfaceArea < 3000 AND Country.SurfaceArea > 10 AND
- (City.Name IN
- (select Language from CountryLanguage where Percentage > 50) OR
- City.name LIKE '%Island%');
-
-SELECT *
- FROM Country, City
- WHERE City.Country = Country.Code AND
- Country.SurfaceArea < 3000 AND Country.SurfaceArea > 10 AND
- (City.Name IN
- (select Language from CountryLanguage where Percentage > 50) OR
- City.name LIKE '%Island%');
-
--- echo Q1.2e:
--- echo IN_EXISTS: join order is the same, but the left IN operand refers to
--- echo only the first table in the join order (Country), so there are much
--- echo fewer rows to filter by subquery re-execution.
-EXPLAIN
-SELECT *
- FROM Country, City
- WHERE City.Country = Country.Code AND
- Country.SurfaceArea < 3000 AND Country.SurfaceArea > 10 AND
- (Country.Name IN
- (select Language from CountryLanguage where Percentage > 50) OR
- Country.name LIKE '%Island%');
-
-SELECT *
- FROM Country, City
- WHERE City.Country = Country.Code AND
- Country.SurfaceArea < 3000 AND Country.SurfaceArea > 10 AND
- (Country.Name IN
- (select Language from CountryLanguage where Percentage > 50) OR
- Country.name LIKE '%Island%');
-
-
--- echo
--- echo Q1.3:
--- echo For the same reasons as in Q2 IN-EXISTS and MATERIALIZATION chosen
--- echo for each respective subquery.
-EXPLAIN
-SELECT City.Name, Country.Name
- FROM City,Country
- WHERE City.Country = Country.Code AND
- Country.SurfaceArea < 30000 AND Country.SurfaceArea > 10 AND
- ((Country.Code, Country.Name) IN
- (select Country, Language from CountryLanguage where Percentage > 50) AND
- Country.Population > 3000000
- OR
- (Country.Code, City.Name) IN
- (select Country, Language from CountryLanguage));
-
-SELECT City.Name, Country.Name
- FROM City,Country
- WHERE City.Country = Country.Code AND
- Country.SurfaceArea < 30000 AND Country.SurfaceArea > 10 AND
- ((Country.Code, Country.Name) IN
- (select Country, Language from CountryLanguage where Percentage > 50) AND
- Country.Population > 3000000
- OR
- (Country.Code, City.Name) IN
- (select Country, Language from CountryLanguage));
-
-
--- echo
--- echo 2. NOT IN subqueries
--- echo
-
--- echo
--- echo Q2.1:
--- echo Number of cities that are not capitals in countries with small population.
--- echo MATERIALIZATION is 50 times faster because the cost of each subquery
--- echo re-execution is much higher than the cost of index lookups into the
--- echo materialized subquery.
-
-EXPLAIN
-select count(*) from City
-where City.id not in (select capital from Country
- where capital is not null and population < 100000);
-
--- echo
--- echo Q2.2e:
--- echo Countries that speak French, but do not speak English
--- echo IN-EXISTS because the outer query filters many rows, thus
--- echo there are few lookups to make.
-EXPLAIN
-SELECT Country.Name
-FROM Country, CountryLanguage
-WHERE Code NOT IN (SELECT Country FROM CountryLanguage WHERE Language = 'English')
- AND CountryLanguage.Language = 'French'
- AND Code = Country;
-
-SELECT Country.Name
-FROM Country, CountryLanguage
-WHERE Code NOT IN (SELECT Country FROM CountryLanguage WHERE Language = 'English')
- AND CountryLanguage.Language = 'French'
- AND Code = Country;
-
--- echo Q2.2m:
--- echo Countries that speak French OR Spanish, but do not speak English
--- echo MATERIALIZATION because the outer query filters less rows than Q5-a,
--- echo so there are more lookups.
-EXPLAIN
-SELECT Country.Name
-FROM Country, CountryLanguage
-WHERE Code NOT IN (SELECT Country FROM CountryLanguage WHERE Language = 'English')
- AND (CountryLanguage.Language = 'French' OR CountryLanguage.Language = 'Spanish')
- AND Code = Country;
-
-SELECT Country.Name
-FROM Country, CountryLanguage
-WHERE Code NOT IN (SELECT Country FROM CountryLanguage WHERE Language = 'English')
- AND (CountryLanguage.Language = 'French' OR CountryLanguage.Language = 'Spanish')
- AND Code = Country;
-
--- echo
--- echo Q2.3e:
--- echo Not a very meaningful query that tests NOT IN.
--- echo IN-EXISTS because the outer query is cheap enough to reexecute many times.
-EXPLAIN
-select count(*)
-from CountryLanguage
-where (Language, Country) NOT IN
- (SELECT City.Name, Country.Code
- FROM City LEFT JOIN Country ON (Country = Code and City.Population < 10000))
- AND Language IN ('English','Spanish');
-
-select count(*)
-from CountryLanguage
-where (Language, Country) NOT IN
- (SELECT City.Name, Country.Code
- FROM City LEFT JOIN Country ON (Country = Code and City.Population < 10000))
- AND Language IN ('English','Spanish');
-
--- echo Q2.3m:
--- echo MATERIALIZATION with the PARTIAL_MATCH_MERGE strategy, because the HAVING
--- echo clause prevents the use of the index on City(Name), and in practice reduces
--- echo radically the size of the temp table.
-EXPLAIN
-select count(*)
-from CountryLanguage
-where (Language, Country) NOT IN
- (SELECT City.Name, Country.Code
- FROM City LEFT JOIN Country ON (Country = Code)
- HAVING City.Name LIKE "Santa%");
-
-select count(*)
-from CountryLanguage
-where (Language, Country) NOT IN
- (SELECT City.Name, Country.Code
- FROM City LEFT JOIN Country ON (Country = Code)
- HAVING City.Name LIKE "Santa%");
-
-
--- echo
--- echo 3. Subqueries with GROUP BY, HAVING, and aggregate functions
--- echo
-
--- echo Q3.1:
--- echo Languages that are spoken in countries with 10 or 11 languages
--- echo MATERIALIZATION is about 100 times faster than IN-EXISTS.
-
-EXPLAIN
-select count(*)
-from CountryLanguage
-where
-(Country, 10) IN (SELECT Code, COUNT(*) FROM CountryLanguage, Country
- WHERE Code = Country GROUP BY Code)
-OR
-(Country, 11) IN (SELECT Code, COUNT(*) FROM CountryLanguage, Country
- WHERE Code = Country GROUP BY Code)
-order by Country;
-
-select count(*)
-from CountryLanguage
-where
-(Country, 10) IN (SELECT Code, COUNT(*) FROM CountryLanguage, Country
- WHERE Code = Country GROUP BY Code)
-OR
-(Country, 11) IN (SELECT Code, COUNT(*) FROM CountryLanguage, Country
- WHERE Code = Country GROUP BY Code)
-order by Country;
-
-
--- echo
--- echo Q3.2:
--- echo Countries whose capital is a city name that names more than one
--- echo cities.
--- echo MATERIALIZATION because the cost of single subquery execution is
--- echo close to that of materializing the subquery.
-
-EXPLAIN
-select * from Country, City
-where capital = id and
- (City.name in (SELECT name FROM City
- GROUP BY name HAVING Count(*) > 2) OR
- capital is null);
-
-select * from Country, City
-where capital = id and
- (City.name in (SELECT name FROM City
- GROUP BY name HAVING Count(*) > 2) OR
- capital is null);
-
--- echo
--- echo Q3.3: MATERIALIZATION is 25 times faster than IN-EXISTS
-
-EXPLAIN
-SELECT Name
-FROM Country
-WHERE Country.Code NOT IN
- (SELECT Country FROM City GROUP BY Name HAVING COUNT(Name) = 1);
-
-SELECT Name
-FROM Country
-WHERE Country.Code NOT IN
- (SELECT Country FROM City GROUP BY Name HAVING COUNT(Name) = 1);
-
-
--- echo
--- echo 4. Subqueries in the SELECT and HAVING clauses
--- echo
-
--- echo Q4.1m:
--- echo Capital information about very big cities
--- echo MATERIALIZATION
-EXPLAIN
-select Name, City.id in (select capital from Country where capital is not null) as is_capital
-from City
-where City.population > 10000000;
-
-select Name, City.id in (select capital from Country where capital is not null) as is_capital
-from City
-where City.population > 10000000;
-
--- echo Q4.1e:
--- echo IN-TO-EXISTS after adding an index to make the subquery re-execution
--- echo efficient.
-
-create index CountryCapital on Country(capital);
-
-EXPLAIN
-select Name, City.id in (select capital from Country where capital is not null) as is_capital
-from City
-where City.population > 10000000;
-
-select Name, City.id in (select capital from Country where capital is not null) as is_capital
-from City
-where City.population > 10000000;
-
-drop index CountryCapital on Country;
-
--- echo
--- echo Q4.2:
--- echo MATERIALIZATION
-# TODO: the cost estimates for subqueries in the HAVING clause need to be changed
-# to take into account that the subquery predicate is executed #times ~ to the
-# number of groups, not number of rows
-EXPLAIN
-SELECT City.Name, City.Population
-FROM City JOIN Country ON City.Country = Country.Code
-GROUP BY City.Name
-HAVING City.Name IN (select Name from Country where population < 1000000);
-
-SELECT City.Name, City.Population
-FROM City JOIN Country ON City.Country = Country.Code
-GROUP BY City.Name
-HAVING City.Name IN (select Name from Country where population < 1000000);
-
-
--- echo
--- echo 5. Subqueries with UNION
--- echo
-
--- echo Q5.1:
-EXPLAIN
-SELECT * from City where (Name, 91) in
-(SELECT Name, round(Population/1000)
- FROM City
- WHERE Country = "IND" AND Population > 2500000
-UNION
- SELECT Name, round(Population/1000)
- FROM City
- WHERE Country = "IND" AND Population < 100000);
-
-SELECT * from City where (Name, 91) in
-(SELECT Name, round(Population/1000)
- FROM City
- WHERE Country = "IND" AND Population > 2500000
-UNION
- SELECT Name, round(Population/1000)
- FROM City
- WHERE Country = "IND" AND Population < 100000);
-
-set @@optimizer_switch='default';
-drop database world;
--- echo
-
-
--- echo
--- echo TEST GROUP 2:
--- echo Tests of various combinations of optimizer switches, types of queries,
--- echo available indexes, column nullability, constness of tables/predicates.
--- echo =====================================================================
-
-
-#TODO From Igor's review:
-#
-#2.1 Please add a case when two subqueries are used in the where clause
-#(or in select) of a 2-way join.
-#The first subquery is accessed after the first table, while the second
-#is accessed after the second table.
-#
-#2.2. Please add a test case when one non-correlated subquery contains
-#another non-correlated subquery.
-#Consider 4 subcases:
-# both subqueries are materialized
-# IN_EXIST transformations are applied to both subqueries
-# outer subquery is materialized while the inner subquery is not
-#(IN_EXIST transformation is applied to it)
-# inner subqyery is materialized while the outer subquery is not (
-#IN_EXIST transformation is applied to it)
-
-set optimizer_switch=@subselect_mat_cost;
diff --git a/mysql-test/t/subselect_mat_cost_bugs.test b/mysql-test/t/subselect_mat_cost_bugs.test
deleted file mode 100644
index 67af6e3a54a..00000000000
--- a/mysql-test/t/subselect_mat_cost_bugs.test
+++ /dev/null
@@ -1,544 +0,0 @@
-#
-# Test cases for bugs related to the implementation of
-# MWL#89 cost-based choice between the materialization and in-to-exists
-#
-
---echo #
---echo # LP BUG#643424 valgrind warning in choose_subquery_plan()
---echo #
-
-CREATE TABLE t1 (
- pk int(11) NOT NULL AUTO_INCREMENT,
- c1 int(11) DEFAULT NULL,
- c2 int(11) DEFAULT NULL,
- PRIMARY KEY (pk),
- KEY c2 (c2));
-
-INSERT INTO t1 VALUES (1,NULL,2);
-INSERT INTO t1 VALUES (2,7,9);
-INSERT INTO t1 VALUES (9,NULL,8);
-
-CREATE TABLE t2 (
- pk int(11) NOT NULL AUTO_INCREMENT,
- c1 int(11) DEFAULT NULL,
- c2 int(11) DEFAULT NULL,
- PRIMARY KEY (pk),
- KEY c2 (c2));
-
-INSERT INTO t2 VALUES (1,1,7);
-
-set @save_optimizer_switch=@@optimizer_switch;
-set @@optimizer_switch='materialization=on,in_to_exists=on,semijoin=off';
-
-SELECT pk FROM t1 WHERE (c2, c1) IN (SELECT c2, c2 FROM t2);
-
-set session optimizer_switch=@save_optimizer_switch;
-
-drop table t1, t2;
-
-
---echo #
---echo # LP BUG#652727 Crash in create_ref_for_key()
---echo #
-
-CREATE TABLE t2 (
- pk int(11) NOT NULL AUTO_INCREMENT,
- c1 int(11) DEFAULT NULL,
- PRIMARY KEY (pk));
-
-INSERT INTO t2 VALUES (10,7);
-INSERT INTO t2 VALUES (11,1);
-INSERT INTO t2 VALUES (17,NULL);
-
-CREATE TABLE t1 (
- pk int(11) NOT NULL AUTO_INCREMENT,
- c1 int(11) DEFAULT NULL,
- PRIMARY KEY (pk));
-
-INSERT INTO t1 VALUES (15,1);
-INSERT INTO t1 VALUES (19,NULL);
-
-CREATE TABLE t3 (c2 int(11) DEFAULT NULL, KEY c2 (c2));
-INSERT INTO t3 VALUES (1);
-
-set @save_optimizer_switch=@@optimizer_switch;
-set @@optimizer_switch='materialization=on,in_to_exists=on,semijoin=off';
-
-SELECT c2
-FROM t3
-WHERE (2, 6) IN (SELECT t1.c1, t1.c1 FROM t1 STRAIGHT_JOIN t2 ON t2.pk = t1.pk);
-
-set session optimizer_switch=@save_optimizer_switch;
-drop table t1, t2, t3;
-
-
---echo #
---echo # LP BUG#641245 Crash in Item_equal::contains
---echo #
-
-CREATE TABLE t1 (
- pk int(11) NOT NULL AUTO_INCREMENT,
- c1 int(11) DEFAULT NULL,
- c2 int(11) DEFAULT NULL,
- c3 varchar(1) DEFAULT NULL,
- c4 varchar(1) DEFAULT NULL,
- PRIMARY KEY (pk),
- KEY c2 (c2),
- KEY c3 (c3,c2));
-
-INSERT INTO t1 VALUES (10,7,8,'v','v');
-INSERT INTO t1 VALUES (11,1,9,'r','r');
-INSERT INTO t1 VALUES (12,5,9,'a','a');
-INSERT INTO t1 VALUES (13,7,18,'v','v');
-INSERT INTO t1 VALUES (14,1,19,'r','r');
-INSERT INTO t1 VALUES (15,5,29,'a','a');
-INSERT INTO t1 VALUES (17,7,38,'v','v');
-INSERT INTO t1 VALUES (18,1,39,'r','r');
-INSERT INTO t1 VALUES (19,5,49,'a','a');
-
-create table t1a like t1;
-insert into t1a select * from t1;
-
-create table t1b like t1;
-insert into t1b select * from t1;
-
-CREATE TABLE t2 (
- pk int(11) NOT NULL AUTO_INCREMENT,
- c1 int(11) DEFAULT NULL,
- c2 int(11) DEFAULT NULL,
- c3 varchar(1) DEFAULT NULL,
- c4 varchar(1) DEFAULT NULL,
- PRIMARY KEY (pk),
- KEY c2 (c2),
- KEY c3 (c3,c2));
-
-INSERT INTO t2 VALUES (1,NULL,2,'w','w');
-INSERT INTO t2 VALUES (2,7,9,'m','m');
-
-set @@optimizer_switch='materialization=off,in_to_exists=on,semijoin=off';
-
-let $query=
-SELECT pk
-FROM t1
-WHERE c1 IN
- (SELECT t1a.c1
- FROM (t1b JOIN t2 ON t2.c3 = t1b.c4) LEFT JOIN
- t1a ON (t1a.c2 = t1b.pk AND 2)
- WHERE t1.pk) ;
-eval EXPLAIN EXTENDED $query;
-eval $query;
-
-DROP TABLE t1, t1a, t1b, t2;
-
---echo #
---echo # LP BUG#714808 Assertion `outer_lookup_keys <= outer_record_count'
---echo # failed with materialization
-
-CREATE TABLE t1 ( pk int(11), PRIMARY KEY (pk)) ;
-CREATE TABLE t2 ( f2 int(11)) ;
-CREATE TABLE t3 ( f1 int(11), f3 varchar(1), KEY (f1)) ;
-INSERT INTO t3 VALUES (7,'f');
-
-set @@optimizer_switch='materialization=on,in_to_exists=on,semijoin=off';
-
-EXPLAIN
-SELECT t1.*
-FROM t3 RIGHT JOIN t1 ON t1.pk = t3.f1
-WHERE t3.f3 OR ( 3 ) IN ( SELECT f2 FROM t2 );
-
-SELECT t1.*
-FROM t3 RIGHT JOIN t1 ON t1.pk = t3.f1
-WHERE t3.f3 OR ( 3 ) IN ( SELECT f2 FROM t2 );
-
-drop table t1,t2,t3;
-
---echo #
---echo # LP BUG#714999 Second crash in select_describe() with nested subqueries
---echo #
-
-CREATE TABLE t1 ( pk int(11)) ;
-INSERT INTO t1 VALUES (29);
-
-CREATE TABLE t2 ( f1 varchar(1)) ;
-INSERT INTO t2 VALUES ('f'),('d');
-
-CREATE TABLE t3 ( f2 varchar(1)) ;
-
-EXPLAIN SELECT f2 FROM t3 WHERE (
- SELECT MAX( pk ) FROM t1
- WHERE EXISTS (
- SELECT max(f1)
- FROM t2 GROUP BY f1
- )
-) IS NULL ;
-
-drop table t1, t2, t3;
-
---echo #
---echo # LP BUG#715034 Item_sum_distinct::clear(): Assertion `tree != 0' failed
---echo #
-
-CREATE TABLE t2 ( f2 int(11)) ;
-
-CREATE TABLE t1 ( f3 int(11), KEY (f3)) ;
-INSERT INTO t1 VALUES (6),(4);
-
-set @tmp_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='derived_merge=off,derived_with_keys=off';
-
-EXPLAIN
-SELECT * FROM (SELECT * FROM t2) AS a2
-WHERE (SELECT distinct SUM(distinct f3 ) FROM t1);
-
-insert into t2 values (1),(2);
-EXPLAIN
-SELECT * FROM (SELECT * FROM t2) AS a2
-WHERE (SELECT distinct SUM(distinct f3 ) FROM t1);
-
-set optimizer_switch=@tmp_optimizer_switch;
-drop table t1,t2;
-
---echo #
---echo # LP BUG#715027 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed
---echo #
-
-CREATE TABLE t1 ( f1 int(11), PRIMARY KEY (f1)) ;
-INSERT INTO t1 VALUES (28),(29);
-
-CREATE TABLE t2 ( f2 int(11), f3 int(11), f10 varchar(1)) ;
-INSERT INTO t2 VALUES (NULL,6,'f'),(4,2,'d');
-
-set @tmp_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='derived_merge=off,derived_with_keys=off';
-
-EXPLAIN
-SELECT alias2.f2 AS field1
-FROM t1 AS alias1 JOIN ( SELECT * FROM t2 ) AS alias2 ON alias2.f3 = alias1.f1
-WHERE (
- SELECT t2.f2
- FROM t2 JOIN t1 ON t1.f1
- WHERE t1.f1 AND alias2.f10
-)
-ORDER BY field1 ;
-
-SELECT alias2.f2 AS field1
-FROM t1 AS alias1 JOIN ( SELECT * FROM t2 ) AS alias2 ON alias2.f3 = alias1.f1
-WHERE (
- SELECT t2.f2
- FROM t2 JOIN t1 ON t1.f1
- WHERE t1.f1 AND alias2.f10
-)
-ORDER BY field1 ;
-
-set optimizer_switch=@tmp_optimizer_switch;
-drop table t1,t2;
-
---echo #
---echo # LP BUG#718578 Yet another Assertion `!table ||
---echo # (!table->read_set || bitmap_is_set(table->read_set, field_index))'
-
-CREATE TABLE t1 ( f1 int(11), f2 int(11), f3 int(11)) ;
-INSERT IGNORE INTO t1 VALUES (28,5,6),(29,NULL,4);
-
-CREATE TABLE t2 ( f10 varchar(1) );
-INSERT IGNORE INTO t2 VALUES (NULL);
-
-SELECT f1 AS field1
-FROM ( SELECT * FROM t1 ) AS alias1
-WHERE (SELECT t1.f1
- FROM t2 JOIN t1 ON t1.f2
- WHERE alias1.f3 AND t1.f3) AND f2
-ORDER BY field1;
-
-drop table t1,t2;
-
---echo #
---echo # LP BUG#601124 Bug in eliminate_item_equal
---echo # leads to crash in Item_func::Item_func
-
-CREATE TABLE t1 ( f1 int(11), f3 varchar(1)) ;
-INSERT INTO t1 VALUES (5,'m'),(NULL,'c');
-
-CREATE TABLE t2 ( f2 int(11), f3 varchar(1)) ;
-INSERT INTO t2 VALUES (6,'f'),(2,'d');
-
-CREATE TABLE t3 ( f2 int(11), f3 varchar(1)) ;
-INSERT INTO t3 VALUES (6,'f'),(2,'d');
-
-SELECT * FROM t3
-WHERE ( f2 ) IN (SELECT t1.f1
- FROM t1 STRAIGHT_JOIN t2 ON t2.f3 = t1.f3
- WHERE t2.f3 = 'c');
-drop table t1,t2,t3;
-
-
---echo #
---echo # LP BUG#718593 Crash in substitute_for_best_equal_field -> eliminate_item_equal ->
---echo # Item_field::find_item_equal -> Item_equal::contains
---echo #
-
-set @save_optimizer_switch=@@optimizer_switch;
-SET @@optimizer_switch = 'semijoin=off';
-
-CREATE TABLE t1 ( f3 int(11), f10 varchar(1), f11 varchar(1)) ;
-INSERT IGNORE INTO t1 VALUES (6,'f','f'),(2,'d','d');
-
-CREATE TABLE t2 ( f12 int(11), f13 int(11)) ;
-insert into t2 values (1,2), (3,4);
-
-EXPLAIN
-SELECT * FROM t2
-WHERE ( f12 ) IN (
- SELECT alias2.f3
- FROM t1 AS alias1 JOIN t1 AS alias2 ON alias2.f10 = alias1.f11
- WHERE alias1.f11 OR alias1.f3 = 50 AND alias1.f10
-);
-SELECT * FROM t2
-WHERE ( f12 ) IN (
- SELECT alias2.f3
- FROM t1 AS alias1 JOIN t1 AS alias2 ON alias2.f10 = alias1.f11
- WHERE alias1.f11 OR alias1.f3 = 50 AND alias1.f10
-);
-
-EXPLAIN
-SELECT * FROM t2
-WHERE ( f12 ) IN (
- SELECT alias2.f3
- FROM t1 AS alias1, t1 AS alias2
- WHERE (alias2.f10 = alias1.f11) AND (alias1.f11 OR alias1.f3 = 50 AND alias1.f10));
-SELECT * FROM t2
-WHERE ( f12 ) IN (
- SELECT alias2.f3
- FROM t1 AS alias1, t1 AS alias2
- WHERE (alias2.f10 = alias1.f11) AND (alias1.f11 OR alias1.f3 = 50 AND alias1.f10));
-
-set @@optimizer_switch=@save_optimizer_switch;
-drop table t1, t2;
-
-
---echo #
---echo # MWL#89: test introduced after Sergey Petrunia's review - test that
---echo # keyparts wihtout index prefix are used with the IN-EXISTS strategy.
---echo #
-
-create table t1 (c1 int);
-insert into t1 values (1), (2), (3);
-
-create table t2 (kp1 int, kp2 int, c2 int, filler char(100));
-insert into t2 values (0,0,0,'filler'),(0,1,1,'filler'),(0,2,2,'filler'),(0,3,3,'filler');
-
-create index key1 on t2 (kp1, kp2);
-create index key2 on t2 (kp1);
-create index key3 on t2 (kp2);
-
-SET @@optimizer_switch='materialization=off,semijoin=off,in_to_exists=on';
-
-analyze table t2;
-
-explain
-select c1 from t1 where c1 in (select kp1 from t2 where kp2 = 10 and c2 = 4) or c1 > 7;
-select c1 from t1 where c1 in (select kp1 from t2 where kp2 = 10 and c2 = 4) or c1 > 7;
-
-set @@optimizer_switch='default';
-
-drop table t1, t2;
-
---echo #
---echo # LP BUG#800679: Assertion `outer_join->table_count > 0' failed in
---echo # JOIN::choose_subquery_plan() with materialization=on,semijoin=off
---echo #
-
-CREATE TABLE t1 ( f1 int);
-insert into t1 values (1),(2);
-CREATE TABLE t2 ( f1 int);
-insert into t2 values (1),(2);
-
-SET @@optimizer_switch='materialization=on,semijoin=off';
-
-EXPLAIN
-SELECT * FROM t1
-WHERE (f1) IN (SELECT f1 FROM t2)
-LIMIT 0;
-
-SELECT * FROM t1
-WHERE (f1) IN (SELECT f1 FROM t2)
-LIMIT 0;
-
-set @@optimizer_switch='default';
-drop table t1, t2;
-
---echo #
---echo # LP BUG#834492: Crash in fix_semijoin_strategies_for_picked_join_order
---echo # with nested subqueries and LooseScan=ON
---echo #
-
-CREATE TABLE t3 (b int) ;
-INSERT INTO t3 VALUES (0),(0);
-
-CREATE TABLE t4 (a int, b int, c int, d int, PRIMARY KEY (a)) ;
-INSERT INTO t4 VALUES (28,0,0,0),(29,3,0,0);
-
-CREATE TABLE t5 (a int, b int, c int, d int, KEY (c,b)) ;
-INSERT INTO t5 VALUES (28,0,0,0),(29,3,0,0);
-
-SET @@optimizer_switch='semijoin=ON,loosescan=ON,firstmatch=OFF,materialization=OFF';
-
-EXPLAIN SELECT *
-FROM t3
-WHERE t3.b > ALL (
- SELECT c
- FROM t4
- WHERE t4.a >= t3.b
- AND a = SOME (SELECT b FROM t5));
-
-SELECT *
-FROM t3
-WHERE t3.b > ALL (
- SELECT c
- FROM t4
- WHERE t4.a >= t3.b
- AND a = SOME (SELECT b FROM t5));
-
-set @@optimizer_switch='default';
-drop table t3, t4, t5;
-
---echo #
---echo # LP BUG#858038 The result of a query with NOT IN subquery depends on the state of the optimizer switch
---echo #
-
-set @optimizer_switch_save= @@optimizer_switch;
-
-create table t1 (c1 char(2) not null, c2 char(2));
-create table t2 (c3 char(2), c4 char(2));
-
-insert into t1 values ('a1', 'b1');
-insert into t1 values ('a2', 'b2');
-
-insert into t2 values ('x1', 'y1');
-insert into t2 values ('a2', null);
-
-set @@optimizer_switch='in_to_exists=off,materialization=on,partial_match_rowid_merge=off,partial_match_table_scan=on';
-explain select * from t1 where c1 = 'a2' and (c1, c2) not in (select * from t2);
-select * from t1 where c1 = 'a2' and (c1, c2) not in (select * from t2);
-
-set @@optimizer_switch='in_to_exists=off,materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off';
-explain select * from t1 where c1 = 'a2' and (c1, c2) not in (select * from t2);
-select * from t1 where c1 = 'a2' and (c1, c2) not in (select * from t2);
-
-drop table t1, t2;
-
-set optimizer_switch= @optimizer_switch_save;
-
---echo #
---echo # MDEV-12673: cost-based choice between materialization and in-to-exists
---echo #
-
-CREATE TABLE t1 (
- pk1 int, a1 varchar(3), b1 varchar(3), PRIMARY KEY (pk1), KEY(a1), KEY(b1)
-) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,'foo','bar'),(2,'bar','foo');
-
-CREATE TABLE t2 (pk2 INT PRIMARY KEY, a2 VARCHAR(3), KEY(a2)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (1,'abc'),(2,'xyz'),(3,'foo');
-
-SELECT 'qux' IN ( SELECT a1 FROM t1 INNER JOIN t2 WHERE a2 = b1 AND pk2 = 3 );
-SELECT 'bar' IN ( SELECT a1 FROM t1 INNER JOIN t2 WHERE a2 = b1 AND pk2 = 3 );
-EXPLAIN
-SELECT 'bar' IN ( SELECT a1 FROM t1 INNER JOIN t2 WHERE a2 = b1 AND pk2 = 3 );
-
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (i1 INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1);
-
-CREATE TABLE t2 (i2 int, c2 varchar(3), KEY(i2,c2)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (1,'abc'),(2,'foo');
-
-CREATE TABLE t3 (pk3 int PRIMARY KEY, c3 varchar(3)) ENGINE=MyISAM;
-INSERT INTO t3 VALUES (1,'foo'),(2,'bar');
-
-SELECT * FROM t1 WHERE i1 NOT IN (
- SELECT i2 FROM t2 RIGHT JOIN t3 ON (c3 = c2) WHERE pk3 = i1
-);
-
-EXPLAIN
-SELECT * FROM t1 WHERE i1 NOT IN (
- SELECT i2 FROM t2 RIGHT JOIN t3 ON (c3 = c2) WHERE pk3 = i1
-);
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # MDEV-7599: in-to-exists chosen after min/max optimization
---echo #
-
-set @optimizer_switch_save= @@optimizer_switch;
-
-CREATE TABLE t1 (a INT, KEY(a)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE TABLE t2 (b INT, c INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (1,6),(2,4), (8,9);
-
-let $q=
-SELECT * FROM t2 WHERE b != ALL (SELECT MIN(a) FROM t1, t2 WHERE t2.c = t2.b);
-
-eval $q;
-eval EXPLAIN EXTENDED $q;
-set optimizer_switch= 'materialization=off';
-eval $q;
-eval EXPLAIN EXTENDED $q;
-set optimizer_switch= @optimizer_switch_save;
-
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (f1 varchar(10)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('foo'),('bar');
-
-CREATE TABLE t2 (f2 varchar(10), key(f2)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES ('baz'),('qux');
-
-CREATE TABLE t3 (f3 varchar(10)) ENGINE=MyISAM;
-INSERT INTO t3 VALUES ('abc'),('def');
-
-SELECT * FROM t1
- WHERE f1 = ALL( SELECT MAX(t2a.f2)
- FROM t2 AS t2a INNER JOIN t2 t2b INNER JOIN t3
- ON (f3 = t2b.f2) );
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # MDEV-12963: min/max optimization optimizing away all tables employed
---echo # for uncorrelated IN subquery used in a disjunct of WHERE
---echo #
-
-create table t1 (a int, index idx(a)) engine=myisam;
-insert into t1 values (4),(7),(1),(3),(9);
-
-select * from t1 where a in (select max(a) from t1 where a < 4) or a > 5;
-explain
-select * from t1 where a in (select max(a) from t1 where a < 4) or a > 5;
-
-drop table t1;
-
---echo #
---echo # MDEV-13135: subquery with ON expression subject to
---echo # semi-join optimizations
---echo #
-
-CREATE TABLE t1 (a INT);
-CREATE ALGORITHM=MERGE VIEW v1 AS SELECT a AS v_a FROM t1;
-INSERT INTO t1 VALUES (1),(3);
-
-CREATE TABLE t2 (b INT, KEY(b));
-INSERT INTO t2 VALUES (3),(4);
-
-SELECT * FROM t1 WHERE a NOT IN (
- SELECT b FROM t2 INNER JOIN v1 ON (b IN ( SELECT a FROM t1 ))
- WHERE v_a = b
-);
-
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
diff --git a/mysql-test/t/subselect_no_exists_to_in.test b/mysql-test/t/subselect_no_exists_to_in.test
deleted file mode 100644
index 7145a4594bc..00000000000
--- a/mysql-test/t/subselect_no_exists_to_in.test
+++ /dev/null
@@ -1,11 +0,0 @@
-#
-# Run subselect.test with exists to in transformation
-#
-select @@optimizer_switch like '%exists_to_in=off%';
-set optimizer_switch='exists_to_in=off';
-
---source t/subselect.test
-
-set optimizer_switch=default;
-select @@optimizer_switch like '%exists_to_in=off%';
-
diff --git a/mysql-test/t/subselect_no_mat.test b/mysql-test/t/subselect_no_mat.test
deleted file mode 100644
index ccd93af64ce..00000000000
--- a/mysql-test/t/subselect_no_mat.test
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Run subselect.test without semi-join optimization (test materialize)
-#
-select @@optimizer_switch like '%materialization=on%';
-set optimizer_switch='materialization=off';
-set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
-
-set join_cache_level=1;
-set @join_cache_level_for_subselect_test=@@join_cache_level;
-
---source t/subselect.test
-
-set optimizer_switch=default;
-select @@optimizer_switch like '%materialization=on%';
-set @join_cache_level_for_subselect_test=NULL;
-
-
diff --git a/mysql-test/t/subselect_no_opts.test b/mysql-test/t/subselect_no_opts.test
deleted file mode 100644
index 8a699fefaf7..00000000000
--- a/mysql-test/t/subselect_no_opts.test
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# Run subselect.test without semi-join and materialization optimizations
-# (test in-to-exists)
-
-
-set @optimizer_switch_for_subselect_test='materialization=off,semijoin=off,subquery_cache=off,mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
-
-set join_cache_level=1;
-set @join_cache_level_for_subselect_test=@@join_cache_level;
-
---source t/subselect.test
-
-set @optimizer_switch_for_subselect_test=null;
-
diff --git a/mysql-test/t/subselect_no_scache.test b/mysql-test/t/subselect_no_scache.test
deleted file mode 100644
index a8ff559b82b..00000000000
--- a/mysql-test/t/subselect_no_scache.test
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-# Run subselect.test without semi-join optimization (test materialize)
-#
-select @@optimizer_switch like '%subquery_cache=on%';
-set optimizer_switch='subquery_cache=off';
-
-set join_cache_level=1;
-set @join_cache_level_for_subselect_test=@@join_cache_level;
-
---source t/subselect.test
-
-set optimizer_switch=default;
-select @@optimizer_switch like '%subquery_cache=on%';
-set @join_cache_level_for_subselect_test=NULL;
-
diff --git a/mysql-test/t/subselect_no_semijoin.test b/mysql-test/t/subselect_no_semijoin.test
deleted file mode 100644
index 46791667173..00000000000
--- a/mysql-test/t/subselect_no_semijoin.test
+++ /dev/null
@@ -1,12 +0,0 @@
-#
-# Run subselect.test without semi-join optimization (test materialize)
-#
-set @optimizer_switch_for_subselect_test='semijoin=off,mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
-
-set join_cache_level=1;
-set @join_cache_level_for_subselect_test=@@join_cache_level;
-
---source t/subselect.test
-
-set @optimizer_switch_for_subselect_test=null;
-set @join_cache_level_for_subselect_test=NULL;
diff --git a/mysql-test/t/subselect_notembedded.test b/mysql-test/t/subselect_notembedded.test
deleted file mode 100644
index dcda71c767f..00000000000
--- a/mysql-test/t/subselect_notembedded.test
+++ /dev/null
@@ -1,62 +0,0 @@
--- source include/not_embedded.inc
-
-#
-# BUG#10308: purge log with subselect
-# Bug#28553: mysqld crash in "purge master log before(select time from information_schema)"
-#
---error 1064
-purge master logs before (select adddate(current_timestamp(), interval -4 day));
-purge master logs before adddate(current_timestamp(), interval -4 day);
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-#
-# Bug31048: Many nested subqueries may cause server crash.
-#
-create table t1(a int,b int,key(a),key(b));
-insert into t1(a,b) values (1,2),(2,1),(2,3),(3,4),(5,4),(5,5),
- (6,7),(7,4),(5,3);
-
-let $nesting= 26;
-let $should_work_nesting= 5;
-let $start= select sum(a),a from t1 where a> ( select sum(a) from t1 ;
-let $end= )group by a ;
-let $start_app= where a> ( select sum(a) from t1 ;
-let $end_pre= )group by b limit 1 ;
-
---disable_result_log
---disable_query_log
-# At least 4 level nesting should work without errors
-while ($should_work_nesting)
-{
---echo $should_work_nesting
- eval select $should_work_nesting as 'STEP-1';
- eval $start $end;
- eval explain $start $end;
- let $start= $start
- $start_app;
- let $end= $end_pre
- $end;
- dec $should_work_nesting;
-}
-# Other may fail with the 'stack overrun error'
-while ($nesting)
-{
---echo $nesting
- eval select $nesting as 'STEP-2';
---error 0,1436
- eval $start $end;
---error 0,1436
- eval explain $start $end;
- let $start= $start
- $start_app;
- let $end= $end_pre
- $end;
- dec $nesting;
-}
---enable_result_log
---enable_query_log
-drop table t1;
-
---echo End of 5.1 tests
diff --git a/mysql-test/t/subselect_nulls.test b/mysql-test/t/subselect_nulls.test
deleted file mode 100644
index 3e7b2189ed5..00000000000
--- a/mysql-test/t/subselect_nulls.test
+++ /dev/null
@@ -1,105 +0,0 @@
-# Initialize tables for the test
-
---disable_warnings
-drop table if exists x1;
-drop table if exists x2;
---enable_warnings
-
-set @tmp_subselect_nulls=@@optimizer_switch;
-set optimizer_switch='semijoin=off';
-
-create table x1(k int primary key, d1 int, d2 int);
-create table x2(k int primary key, d1 int, d2 int);
-
-insert into x1 values
- (10, 10, 10),
- (20, 20, 20),
- (21, 20, null),
- (30, null, 30),
- (40, 40, 40);
-insert into x2 values
- (10, 10, 10),
- (20, 20, 20),
- (21, 20, null),
- (30, null, 30);
-
-# Test various IN and EXISTS queries with NULL values and UNKNOWN
-# Q1 T=(10, 20) U=(21,30) F=(40)
-select *
-from x1
-where (d1, d2) in (select d1, d2
- from x2);
-select *
-from x1
-where (d1, d2) in (select d1, d2
- from x2) is true;
-select *
-from x1
-where (d1, d2) in (select d1, d2
- from x2) is false;
-select *
-from x1
-where (d1, d2) in (select d1, d2
- from x2) is unknown;
-
-# Q2 T=(10, 20) U=(30) F=(21, 40)
-select *
-from x1
-where d1 in (select d1
- from x2
- where x1.d2=x2.d2);
-select *
-from x1
-where d1 in (select d1
- from x2
- where x1.d2=x2.d2) is true;
-select *
-from x1
-where d1 in (select d1
- from x2
- where x1.d2=x2.d2) is false;
-select *
-from x1
-where d1 in (select d1
- from x2
- where x1.d2=x2.d2) is unknown;
-
-# Q3 T=(10, 20) U=() F=(21, 30, 40)
-select *
-from x1
-where 1 in (select 1
- from x2
- where x1.d1=x2.d1 and x1.d2=x2.d2);
-select *
-from x1
-where 1 in (select 1
- from x2
- where x1.d1=x2.d1 and x1.d2=x2.d2) is true;
-select *
-from x1
-where 1 in (select 1
- from x2
- where x1.d1=x2.d1 and x1.d2=x2.d2) is false;
-select *
-from x1
-where 1 in (select 1
- from x2
- where x1.d1=x2.d1 and x1.d2=x2.d2) is unknown;
-
-# Q4 T=(10, 20) F=(21, 30, 40)
-select *
-from x1
-where exists (select *
- from x2
- where x1.d1=x2.d1 and x1.d2=x2.d2);
-
-set optimizer_switch= @tmp_subselect_nulls;
-
-drop table x1;
-drop table x2;
-
-#
-# MDEV-7339 Server crashes in Item_func_trig_cond::val_int
-#
-select (select 1, 2) in (select 3, 4);
-select (select NULL, NULL) in (select 3, 4);
diff --git a/mysql-test/t/subselect_partial_match.test b/mysql-test/t/subselect_partial_match.test
deleted file mode 100644
index fd1e6de716c..00000000000
--- a/mysql-test/t/subselect_partial_match.test
+++ /dev/null
@@ -1,803 +0,0 @@
-#
-# Tests for
-# MWL#68: Subquery optimization: Efficient NOT IN execution with NULLs
-#
-
-set @save_optimizer_switch=@@optimizer_switch;
-
---echo -------------------------------
---echo Part 1: Feature tests.
---echo -------------------------------
-
---echo Default for all tests.
-set @@optimizer_switch = "materialization=on,in_to_exists=off,semijoin=off,subquery_cache=off";
-set @test_default_opt_switch = @@optimizer_switch;
-set @in_exists = "materialization=off,in_to_exists=on,semijoin=off,subquery_cache=off";
-
---echo -------------------------------------------------------------------------
---echo Schema requires partial matching, but data analysis discoveres there is
---echo no need. This is possible only if all outer columns are not NULL.
---echo -------------------------------------------------------------------------
-
-create table t1 (a1 char(8) not null, a2 char(8) not null);
-create table t2 (b1 char(8), b2 char(8));
-
-insert into t1 values ('1 - 00', '2 - 00');
-insert into t1 values ('1 - 01', '2 - 01');
-
-insert into t2 values ('1 - 00', '2 - 00');
-insert into t2 values ('1 - 01', NULL );
-insert into t2 values (NULL , '2 - 02');
-insert into t2 values (NULL , NULL );
-insert into t2 values ('1 - 02', '2 - 02');
-
-select * from t1
-where (a1, a2) not in (select * from t2 where b1 is not null and b2 is not null);
-
-select a1, a2, (a1, a2) not in (select * from t2) as in_res from t1;
-
-drop table t1, t2;
-
---echo -------------------------------------------------------------------------
---echo NULLs in the outer columns, no NULLs in the suqbuery
---echo -------------------------------------------------------------------------
-
-create table t1 (a1 char(8), a2 char(8));
-create table t2 (b1 char(8) not null, b2 char(8) not null);
-
-insert into t1 values (NULL , '2 - 00');
-insert into t1 values ('1 - 01', '2 - 01');
-insert into t1 values (NULL , NULL );
-
-insert into t2 values ('1 - 00', '2 - 00');
-insert into t2 values ('1 - 01', '2 - 01');
-insert into t2 values ('1 - 02', '2 - 00');
-
-select * from t1
-where (a1, a2) not in (select * from t2 where b1 is not null and b2 is not null);
-
-select a1, a2, (a1, a2) not in (select * from t2) as in_res from t1;
-
-select * from t1
-where (a1, a2) in (select * from t2 where b1 is not null and b2 is not null);
-
-select a1, a2, (a1, a2) in (select * from t2) as in_res from t1;
-
-drop table t1, t2;
-
---echo -------------------------------------------------------------------------
---echo NULLs in the outer column, NULLs in the subquery, there is
---echo no value match in any column, but there is a partial match
---echo such that some of the matching NULLs are in the outer columns,
---echo the other NULLs are in the inner columns.
---echo -------------------------------------------------------------------------
-
-create table t1 (a1 char(1), a2 char(1), a3 char(1));
-create table t2 (b1 char(1), b2 char(1), b3 char(1));
-
-insert into t1 values ('c', NULL, 'a');
-insert into t2 values (NULL, 'x', NULL);
-insert into t2 values (NULL, 'y', NULL);
-insert into t2 values ('o', 'z', 'p');
-
-set @@optimizer_switch='partial_match_rowid_merge=on,partial_match_table_scan=off';
-EXPLAIN
-SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1;
-SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1;
-EXPLAIN
-SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2);
-SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2);
-
-set @@optimizer_switch='partial_match_rowid_merge=off,partial_match_table_scan=on';
-EXPLAIN
-SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1;
-SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1;
-EXPLAIN
-SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2);
-SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2);
-
-set @@optimizer_switch=@in_exists;
-EXPLAIN
-SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1;
-SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1;
-EXPLAIN
-SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2);
-SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2);
-
-set @@optimizer_switch = @test_default_opt_switch;
-
-drop table t1, t2;
-
-create table t1 (a1 char(1), a2 char(1) not null, a3 char(1));
-create table t2 (b1 char(1), b2 char(1), b3 char(1));
-
-insert into t1 values (NULL, 'y', NULL);
-insert into t2 values ('v', 'x', NULL);
-insert into t2 values (NULL, 'y', 'w');
-
-set @@optimizer_switch='partial_match_rowid_merge=on,partial_match_table_scan=off';
-EXPLAIN
-SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1;
-SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1;
-EXPLAIN
-SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2);
-SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2);
-
-set @@optimizer_switch='partial_match_rowid_merge=off,partial_match_table_scan=on';
-EXPLAIN
-SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1;
-SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1;
-EXPLAIN
-SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2);
-SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2);
-
-set @@optimizer_switch=@in_exists;
-EXPLAIN
-SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1;
-SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1;
-EXPLAIN
-SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2);
-SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2);
-
-set @@optimizer_switch = @test_default_opt_switch;
-
-drop table t1, t2;
-
---echo -------------------------------------------------------------------------
---echo There is only one column in the subquery to complement the NULLs in the
---echo outer reference. It is a NULL column, so a match is guaranteed.
---echo -------------------------------------------------------------------------
-
-create table t1 (a1 char(1), a2 char(1), a3 char(1));
-create table t2 (b1 char(1), b2 char(1), b3 char(1));
-
-insert into t1 values (NULL, 'g', NULL);
-insert into t2 values ('z', NULL, 'y');
-insert into t2 values (NULL, 'z', 'y');
-
-set @@optimizer_switch='partial_match_rowid_merge=on,partial_match_table_scan=off';
-EXPLAIN
-SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1;
-SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1;
-EXPLAIN
-SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2);
-SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2);
-
-set @@optimizer_switch='partial_match_rowid_merge=off,partial_match_table_scan=on';
-EXPLAIN
-SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1;
-SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1;
-EXPLAIN
-SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2);
-SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2);
-
-set @@optimizer_switch=@in_exists;
-EXPLAIN
-SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1;
-SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1;
-EXPLAIN
-SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2);
-SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2);
-
-set @@optimizer_switch = @test_default_opt_switch;
-
-drop table t1, t2;
-
---echo -------------------------------------------------------------------------
---echo The intersection of the NULL bitmaps is empty because the ranges
---echo of NULL bits do not overlap.
---echo -------------------------------------------------------------------------
-
-create table t1 (a1 char(1), a2 char(1), a3 char(1));
-create table t2 (b1 char(1), b2 char(1), b3 char(1));
-
-insert into t1 values ('b', 'g', NULL);
-insert into t2 values ('z', NULL, 'y');
-insert into t2 values (NULL, 'z', 'y');
-
-set @@optimizer_switch='partial_match_rowid_merge=on,partial_match_table_scan=off';
-EXPLAIN
-SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1;
-SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1;
-EXPLAIN
-SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2);
-SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2);
-
-set @@optimizer_switch='partial_match_rowid_merge=off,partial_match_table_scan=on';
-EXPLAIN
-SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1;
-SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1;
-EXPLAIN
-SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2);
-SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2);
-
-set @@optimizer_switch=@in_exists;
-EXPLAIN
-SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1;
-SELECT t1.*, (a1, a2, a3) IN (select * from t2) as in_res from t1;
-EXPLAIN
-SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2);
-SELECT * from t1 where (a1, a2, a3) NOT IN (select * from t2);
-
-drop table t1, t2;
-
---echo -------------------------------------------------------------------------
---echo The intersection of the NULL bitmaps is non-empty, and there is a
---echo non-NULL column.
---echo -------------------------------------------------------------------------
-
-create table t1 (a1 char(1), a2 char(1), a3 char(1) not null, a4 char(10));
-create table t2 (b1 char(1), b2 char(1), b3 char(1), b4 char(1));
-
-insert into t1 values ('a', 'g', 'x', NULL);
-insert into t2 values ('z', NULL, 'y', 'x');
-insert into t2 values (NULL, NULL, 'x', 'y');
-insert into t2 values ('x', 'w', 'z', NULL);
-
-set @@optimizer_switch='partial_match_rowid_merge=on,partial_match_table_scan=off';
-EXPLAIN
-SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1;
-SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1;
-EXPLAIN
-SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2);
-SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2);
-
-set @@optimizer_switch='partial_match_rowid_merge=off,partial_match_table_scan=on';
-EXPLAIN
-SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1;
-SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1;
-EXPLAIN
-SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2);
-SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2);
-
-set @@optimizer_switch=@in_exists;
-EXPLAIN
-SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1;
-SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1;
-EXPLAIN
-SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2);
-SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2);
-
-drop table t1, t2;
-
---echo -------------------------------------------------------------------------
---echo Value match in one row, but the NULL complement match in another.
---echo The result must be false.
---echo -------------------------------------------------------------------------
-
-create table t1 (a1 char(2), a2 char(1), a3 char(1) not null, a4 char(10));
-create table t2 (b1 char(2), b2 char(1), b3 char(1), b4 char(1));
-
-insert into t1 values ('99', NULL, 'j', 'f');
-
-insert into t2 values ('01', NULL, 'y', NULL);
-insert into t2 values ('02', NULL, 'x', 'y');
-insert into t2 values ('03', 'q', 'y', 'x');
-insert into t2 values (NULL, 'q', 'm', 'p');
-insert into t2 values ('m', 'z', 'j', NULL);
-insert into t2 values (NULL, 'z', 'b', NULL);
-insert into t2 values (NULL, 'z', 'a', NULL);
-insert into t2 values ('34', 'q', 'y', 'x');
-
-set @@optimizer_switch='partial_match_rowid_merge=on,partial_match_table_scan=off';
-EXPLAIN
-SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1;
-SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1;
-EXPLAIN
-SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2);
-SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2);
-
-set @@optimizer_switch='partial_match_rowid_merge=off,partial_match_table_scan=on';
-EXPLAIN
-SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1;
-SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1;
-EXPLAIN
-SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2);
-SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2);
-
-set @@optimizer_switch=@in_exists;
-EXPLAIN
-SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1;
-SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1;
-EXPLAIN
-SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2);
-SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2);
-
-drop table t1, t2;
-
---echo -------------------------------------------------------------------------
---echo Test the intersection of larger number of rows with NULL, such that
---echo the number is at the boundary 32. This test is based on the implementation
---echo of MY_BITMAP which uses 32 bit words, and the intersection operation works
---echo by intersecting the bitmap word by word.
---echo -------------------------------------------------------------------------
-
-create table t1 (a1 char(2), a2 char(2), a3 char(1), a4 char(10)) ENGINE=MyISAM;
-create table t2 (b1 char(2), b2 char(2), b3 char(1), b4 char(1)) ENGINE=MyISAM;
-
-insert into t1 values (NULL, '98', NULL, 'b');
-insert into t1 values (NULL, '99', NULL, 'c');
-
-insert into t2 values ('00', 'rr', 'y', NULL);
-insert into t2 values ('01', 'rr', 'y', NULL);
-insert into t2 values ('02', NULL, 'x', 'y');
-insert into t2 values ('03', 'qq', 'y', 'x');
-insert into t2 values ('04', 'qq', 'm', 'p');
-insert into t2 values ('05', 'rr', 'y', NULL);
-insert into t2 values ('06', NULL, 'x', 'y');
-insert into t2 values ('07', 'qq', 'y', 'x');
-insert into t2 values ('08', 'qq', 'm', 'q');
-insert into t2 values ('09', 'rr', 'y', NULL);
-insert into t2 values ('10', NULL, 'x', 'y');
-insert into t2 values ('11', 'qq', 'y', 'x');
-insert into t2 values ('12', 'qq', 'm', 'k');
-insert into t2 values ('13', 'rr', 'y', NULL);
-insert into t2 values ('14', NULL, 'x', 'y');
-insert into t2 values ('15', 'qq', 'y', 'x');
-insert into t2 values ('16', 'qq', 'm', 's');
-insert into t2 values ('17', 'rr', 'y', NULL);
-insert into t2 values ('18', NULL, 'x', 'y');
-insert into t2 values ('19', 'qq', 'y', 'x');
-insert into t2 values ('20', 'qq', 'm', 't');
-insert into t2 values ('21', 'rr', 'y', NULL);
-insert into t2 values ('22', NULL, 'x', 'y');
-insert into t2 values ('23', 'qq', 'y', 'x');
-insert into t2 values ('24', 'qq', 'm', 'u');
-insert into t2 values ('25', 'rr', 'y', NULL);
-insert into t2 values ('26', NULL, 'x', 'y');
-insert into t2 values ('27', 'qq', 'y', 'x');
-insert into t2 values ('28', 'qq', 'm', 'y');
-insert into t2 values ('29', 'rr', 'y', NULL);
-insert into t2 values ('30', NULL, 'x', 'z');
-insert into t2 values ('31', 'ss', 'h', NULL);
-insert into t2 values ('32', 'vv', 'i', NULL);
---echo the only partial matching row
-insert into t2 values ('33', NULL, 'j', NULL);
-insert into t2 values ('34', 'qq', 'y', 'x');
-
-set @@optimizer_switch='partial_match_rowid_merge=on,partial_match_table_scan=off';
-EXPLAIN
-SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1;
-SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1;
-EXPLAIN
-SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2);
-SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2);
-
-set @@optimizer_switch='partial_match_rowid_merge=off,partial_match_table_scan=on';
-EXPLAIN
-SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1;
-SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1;
-EXPLAIN
-SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2);
-SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2);
-
-set @@optimizer_switch=@in_exists;
-EXPLAIN
-SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1;
-SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1;
-EXPLAIN
-SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2);
-SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2);
-
---echo change the mathcing row to be the last one in the first bitmap word
-update t2 set b2 = 'zz' where b1 = 33;
-update t2 set b2 = NULL where b1 = 31;
-
-set @@optimizer_switch='partial_match_rowid_merge=on,partial_match_table_scan=off';
-EXPLAIN
-SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1;
-SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1;
-EXPLAIN
-SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2);
-SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2);
-
-set @@optimizer_switch='partial_match_rowid_merge=off,partial_match_table_scan=on';
-EXPLAIN
-SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1;
-SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1;
-EXPLAIN
-SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2);
-SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2);
-
-set @@optimizer_switch=@in_exists;
-EXPLAIN
-SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1;
-SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1;
-EXPLAIN
-SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2);
-SELECT * from t1 where (a1, a2, a3, a4) NOT IN (select * from t2);
-
-drop table t1, t2;
-
-
---echo -------------------------------------------------------------------------
---echo All columns require partial matching (no non-null columns)
---echo -------------------------------------------------------------------------
-
---echo TODO
-
---echo -------------------------------------------------------------------------
---echo Both non-NULL columns and columns with NULLs
---echo -------------------------------------------------------------------------
-
---echo TODO
-
---echo -------------------------------------------------------------------------
---echo Covering NULL rows
---echo -------------------------------------------------------------------------
-
-create table t1 (a1 char(8), a2 char(8));
-create table t2 (b1 char(8), b2 char(8));
-
-insert into t1 values ('1 - 00', '2 - 00');
-insert into t1 values ('1 - 01', '2 - 01');
-
-insert into t2 values ('1 - 01', NULL );
-insert into t2 values (NULL , '2 - 02');
-insert into t2 values (NULL , NULL );
-insert into t2 values ('1 - 02', '2 - 02');
-
-select * from t1
-where (a1, a2) not in (select * from t2);
-
-select a1, a2, (a1, a2) not in (select * from t2) as in_res from t1;
-
-insert into t2 values ('1 - 01', '2 - 01');
-
-select * from t1
-where (a1, a2) not in (select * from t2);
-
-select a1, a2, (a1, a2) not in (select * from t2) as in_res from t1;
-
-select * from t1
-where (a1, a2) in (select * from t2);
-
-select a1, a2, (a1, a2) in (select * from t2) as in_res from t1;
-
-
-drop table t1, t2;
-
---echo -------------------------------------------------------------------------
---echo Covering NULL columns
---echo -------------------------------------------------------------------------
-
---echo this case affects only the rowid-merge algorithm
-set @@optimizer_switch="partial_match_rowid_merge=on,partial_match_table_scan=off";
-
-create table t1 (a1 char(8) not null, a2 char(8), a3 char(8) not null);
-create table t2 (b1 char(8) not null, b2 char(8), b3 char(8) not null);
-
-insert into t1 values ('1 - 00', '2 - 00', '3 - 00');
-insert into t1 values ('1 - 01', '2 - 01', '3 - 01');
-
-insert into t2 values ('1 - 01', NULL, '3 - x1');
-insert into t2 values ('1 - 02', NULL, '3 - 02');
-insert into t2 values ('1 - 00', NULL, '3 - 00');
-
-select * from t1
-where (a1, a2, a3) not in (select * from t2);
-
-select *, (a1, a2, a3) not in (select * from t2) as in_res from t1;
-
-select * from t1
-where (a1, a2, a3) in (select * from t2);
-
-select *, (a1, a2, a3) in (select * from t2) as in_res from t1;
-
-drop table t1, t2;
-
-create table t1 (a1 char(8), a2 char(8), a3 char(8) not null);
-create table t2 (b1 char(8), b2 char(8), b3 char(8) not null);
-
-insert into t1 values ('1 - 00', '2 - 00', '3 - 00');
-insert into t1 values ('1 - 01', '2 - 01', '3 - 01');
-
-insert into t2 values (NULL, NULL, '3 - x1');
-insert into t2 values (NULL, NULL, '3 - 02');
-insert into t2 values (NULL, NULL, '3 - 00');
-
-select * from t1
-where (a1, a2, a3) not in (select * from t2);
-
-select *, (a1, a2, a3) not in (select * from t2) as in_res from t1;
-
-select * from t1
-where (a1, a2, a3) in (select * from t2);
-
-select *, (a1, a2, a3) in (select * from t2) as in_res from t1;
-
-drop table t1, t2;
-
---echo -------------------------------------------------------------------------
---echo Covering NULL row, and a NULL column
---echo -------------------------------------------------------------------------
-
-create table t1 (a1 char(8) not null, a2 char(8), a3 char(8));
-create table t2 (b1 char(8), b2 char(8), b3 char(8));
-
-insert into t1 values ('1 - 00', '2 - 00', '3 - 00');
-insert into t1 values ('1 - 01', '2 - 01', '3 - 01');
-
-insert into t2 values ('1 - 01', NULL, '3 - x1');
-insert into t2 values (NULL , NULL, NULL );
-insert into t2 values ('1 - 00', NULL, '3 - 00');
-
-select * from t1
-where (a1, a2, a3) not in (select * from t2);
-
-select *, (a1, a2, a3) not in (select * from t2) as in_res from t1;
-
-select * from t1
-where (a1, a2, a3) in (select * from t2);
-
-select *, (a1, a2, a3) in (select * from t2) as in_res from t1;
-
-drop table t1, t2;
-
-
---echo -------------------------------------------------------------------------
---echo Covering NULL row, and covering NULL columns
---echo -------------------------------------------------------------------------
-
-create table t1 (a1 char(8) not null, a2 char(8), a3 char(8));
-create table t2 (b1 char(8), b2 char(8), b3 char(8));
-
-insert into t1 values ('1 - 00', '2 - 00', '3 - 00');
-insert into t1 values ('1 - 01', '2 - 01', '3 - 01');
-
-insert into t2 values (NULL, NULL, NULL);
-insert into t2 values (NULL, NULL, NULL);
-
-select * from t1
-where (a1, a2, a3) not in (select * from t2);
-
-select *, (a1, a2, a3) not in (select * from t2) as in_res from t1;
-
-select * from t1
-where (a1, a2, a3) in (select * from t2);
-
-select *, (a1, a2, a3) in (select * from t2) as in_res from t1;
-
-drop table t1, t2;
-
---echo -------------------------------------------------------------------------
---echo Small buffer for the rowid_merge partial match algorithm that forces
---echo reverting to table scan partial match.
---echo -------------------------------------------------------------------------
-
-set @save_rowid_merge_buff_size = @@rowid_merge_buff_size;
-set @@rowid_merge_buff_size = 0;
-
-create table t1 (a1 char(2), a2 char(2), a3 char(1), a4 char(10));
-create table t2 (b1 char(2), b2 char(2), b3 char(1), b4 char(1));
-
-insert into t1 values (NULL, '98', NULL, 'b');
-insert into t1 values (NULL, '99', NULL, 'c');
-
-insert into t2 values ('00', 'rr', 'y', NULL);
-insert into t2 values ('01', 'rr', 'y', NULL);
-insert into t2 values ('02', NULL, 'x', 'y');
-insert into t2 values ('03', 'qq', 'y', 'x');
-
-set @@optimizer_switch='partial_match_rowid_merge=on,partial_match_table_scan=off';
-EXPLAIN
-SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1;
-SELECT t1.*, (a1, a2, a3, a4) IN (select * from t2) as in_res from t1;
-
-drop table t1, t2;
-
-set @@rowid_merge_buff_size = @save_rowid_merge_buff_size;
-
-
---echo -------------------------------
---echo Part 2: Test cases for bugs.
---echo -------------------------------
-
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-
---echo #
---echo # LP BUG#608744
---echo #
-set @@optimizer_switch="materialization=on,semijoin=off,partial_match_rowid_merge=on,partial_match_table_scan=off";
-create table t1 (a1 char(1), a2 char(1));
-insert into t1 values (NULL, 'b');
-create table t2 (b1 char(1), b2 char(2));
-insert into t2 values ('a','b'), ('c', 'd');
-select * from t1 where (a1, a2) NOT IN (select b1, b2 from t2);
-drop table t1,t2;
-
-
---echo #
---echo # LP BUG#601156
---echo #
-
-CREATE TABLE t1 (a1 int DEFAULT NULL, a2 int DEFAULT NULL);
-INSERT INTO t1 VALUES (NULL,2);
-INSERT INTO t1 VALUES (4,NULL);
-CREATE TABLE t2 (b1 int DEFAULT NULL, b2 int DEFAULT NULL);
-INSERT INTO t2 VALUES (6,NULL);
-INSERT INTO t2 VALUES (NULL,0);
-
-set @@optimizer_switch='materialization=on,semijoin=off,partial_match_rowid_merge=on,partial_match_table_scan=on';
-
-set @tmp_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='derived_merge=off,derived_with_keys=off';
-EXPLAIN EXTENDED
-SELECT * FROM (SELECT * FROM t1 WHERE a1 NOT IN (SELECT b2 FROM t2)) table1;
-set optimizer_switch=@tmp_optimizer_switch;
-
-DROP TABLE t1, t2;
-
---echo #
---echo # LP BUG#613009 Crash in Ordered_key::get_field_idx
---echo #
-
-set @@optimizer_switch='materialization=on,semijoin=off,partial_match_rowid_merge=on,partial_match_table_scan=off';
-
-create table t1 (a1 char(3) DEFAULT NULL, a2 char(3) DEFAULT NULL);
-insert into t1 values (NULL, 'a21'), (NULL, 'a22');
-explain select * from t1 where (a1, a2) not in (select a1, a2 from t1);
-select * from t1 where (a1, a2) not in (select a1, a2 from t1);
-drop table t1;
-
---echo #
---echo # LP BUG#680058 void Ordered_key::add_key(rownum_t):
---echo # Assertion `key_buff_elements && cur_key_idx < key_buff_elements' failed
---echo #
-
-create table t1 (f1 char(1), f2 char(1));
-insert into t1 values ('t', '0'), ('0', 't');
-create table t2 (f3 char(1), f4 char(1));
-insert into t2 values ('t', NULL), ('t', NULL), ('d', 'y');
-
-set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,semijoin=off';
-select * from t1 where (f1, f2) not in (select * from t2);
-drop table t1, t2;
-
-
---echo #
---echo # LP BUG#809245 Second assertion `bit < (map)->n_bits' with partial_match_merge
---echo #
-
-CREATE TABLE t1 (d varchar(32)) ;
-INSERT INTO t1 VALUES ('r');
-
-CREATE TABLE t2 ( a int, c varchar(32)) ;
-INSERT INTO t2 VALUES (5,'r');
-
-CREATE TABLE t3 ( a int NOT NULL , d varchar(32)) ;
-INSERT INTO t3 VALUES (10,'g');
-
-set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,in_to_exists=off';
-
-EXPLAIN SELECT *
-FROM t1
-WHERE (t1.d , t1.d) NOT IN (
- SELECT t3.d , t2.c
- FROM t3 LEFT JOIN t2 ON t3.a = t2.a);
-
-SELECT *
-FROM t1
-WHERE (t1.d , t1.d) NOT IN (
- SELECT t3.d , t2.c
- FROM t3 LEFT JOIN t2 ON t3.a = t2.a);
-
-set @@optimizer_switch='materialization=off,in_to_exists=on';
-
-EXPLAIN SELECT *
-FROM t1
-WHERE (t1.d , t1.d) NOT IN (
- SELECT t3.d , t2.c
- FROM t3 LEFT JOIN t2 ON t3.a = t2.a);
-
-SELECT *
-FROM t1
-WHERE (t1.d , t1.d) NOT IN (
- SELECT t3.d , t2.c
- FROM t3 LEFT JOIN t2 ON t3.a = t2.a);
-
-drop table t1, t2, t3;
-
---echo #
---echo # LP BUG#809266 Diverging results with partial_match_rowid_merge=on
---echo #
-
-CREATE TABLE t1 (c int) ;
-INSERT INTO t1 VALUES (0),(0);
-
-CREATE TABLE t2 (a int, b int) ;
-INSERT INTO t2 VALUES (6,3), (9,NULL);
-
-set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,in_to_exists=off';
-
-EXPLAIN
-SELECT * FROM t1 WHERE (6, 4 ) NOT IN (SELECT b, a FROM t2);
-SELECT * FROM t1 WHERE (6, 4 ) NOT IN (SELECT b, a FROM t2);
-
-EXPLAIN
-SELECT * FROM t1 WHERE (6, 4 ) NOT IN (SELECT a, b FROM t2);
-SELECT * FROM t1 WHERE (6, 4 ) NOT IN (SELECT a, b FROM t2);
-
-set @@optimizer_switch='materialization=off,in_to_exists=on';
-
-EXPLAIN
-SELECT * FROM t1 WHERE (6, 4 ) NOT IN (SELECT b, a FROM t2);
-SELECT * FROM t1 WHERE (6, 4 ) NOT IN (SELECT b, a FROM t2);
-
-EXPLAIN
-SELECT * FROM t1 WHERE (6, 4 ) NOT IN (SELECT a, b FROM t2);
-SELECT * FROM t1 WHERE (6, 4 ) NOT IN (SELECT a, b FROM t2);
-
-drop table t1, t2;
-
---echo #
---echo # LP BUG#856152 Wrong result with NOT IN subquery and partial_match_rowid_merge
---echo #
-
-CREATE TABLE t1 ( f1 integer NOT NULL , f2 integer) ;
-INSERT INTO t1 VALUES (3,3),(48,NULL),(49,1);
-
-CREATE TABLE t2 ( f3 int) ;
-INSERT INTO t2 VALUES (5);
-
-set @@optimizer_switch='in_to_exists=off,materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off';
-EXPLAIN SELECT * FROM t2 WHERE ( 3 , 1 ) NOT IN ( SELECT f1 , f2 FROM t1 );
-SELECT * FROM t2 WHERE ( 3 , 1 ) NOT IN ( SELECT f1 , f2 FROM t1 );
-
-set @@optimizer_switch='in_to_exists=on,materialization=off';
-EXPLAIN SELECT * FROM t2 WHERE ( 3 , 1 ) NOT IN ( SELECT f1 , f2 FROM t1 );
-SELECT * FROM t2 WHERE ( 3 , 1 ) NOT IN ( SELECT f1 , f2 FROM t1 );
-
-drop table t1, t2;
-
---echo #
---echo # LP BUG#869036 Wrong result with in_to_exists=ON and NOT IN
---echo #
-
-create table outer_sq (f1 char(1), f2 char(1));
-insert into outer_sq values (NULL, 'c'), ('g', 'c');
-
-create table inner_sq (f3 char(1), f4 char(1));
-insert into inner_sq values(null, 'i'), ('v', null);
-
---echo All three strategies below must produce the same result.
-
-set @@optimizer_switch='in_to_exists=off,materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off';
-SELECT outer_sq.*, (f1, f2) IN (select * from inner_sq) from outer_sq;
-SELECT * from outer_sq where (f1, f2) NOT IN (select * from inner_sq);
-
-set @@optimizer_switch='in_to_exists=off,materialization=on,partial_match_rowid_merge=off,partial_match_table_scan=on';
-SELECT outer_sq.*, (f1, f2) IN (select * from inner_sq) from outer_sq;
-SELECT * from outer_sq where (f1, f2) NOT IN (select * from inner_sq);
-
-set @@optimizer_switch='in_to_exists=on,materialization=off';
-SELECT outer_sq.*, (f1, f2) IN (select * from inner_sq) from outer_sq;
-SELECT * from outer_sq where (f1, f2) NOT IN (select * from inner_sq);
-
-drop table outer_sq, inner_sq;
-
---echo #
---echo # LP BUG#893486 Wrong result with partial_match_rowid_merge , NOT IN , NULLs
---echo #
-
-CREATE TABLE t1 (a int, b int);
-INSERT INTO t1 VALUES (0,NULL),(2,NULL);
-
-CREATE TABLE t2 (c int, d int);
-INSERT INTO t2 VALUES (2,3),(4,5),(6, NULL);
-
-set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,in_to_exists=off';
-
-EXPLAIN SELECT * FROM t1 WHERE (a, b) NOT IN (SELECT c, d FROM t2);
-SELECT * FROM t1 WHERE (a, b) NOT IN (SELECT c, d FROM t2);
-SELECT a, b, (a, b) NOT IN (SELECT c, d FROM t2) subq_res FROM t1;
-
-EXPLAIN SELECT * FROM t1 WHERE (a, b) NOT IN (SELECT c, d FROM t2 WHERE d is not NULL);
-SELECT * FROM t1 WHERE (a, b) NOT IN (SELECT c, d FROM t2 WHERE d is not NULL);
-SELECT a, b, (a, b) NOT IN (SELECT c, d FROM t2 WHERE d is not NULL) subq_res FROM t1;
-
-drop table t1,t2;
-
-set @@optimizer_switch=@save_optimizer_switch;
diff --git a/mysql-test/t/subselect_sj.test b/mysql-test/t/subselect_sj.test
deleted file mode 100644
index 6fdccee339d..00000000000
--- a/mysql-test/t/subselect_sj.test
+++ /dev/null
@@ -1,2850 +0,0 @@
-#
-# Nested Loops semi-join subquery evaluation tests
-#
---disable_warnings
-drop table if exists t0, t1, t2, t3, t4, t5, t10, t11, t12;
-drop view if exists v1, v2, v3, v4;
-drop procedure if exists p1;
---enable_warnings
-
-set @subselect_sj_tmp= @@optimizer_switch;
-set optimizer_switch='semijoin=on,firstmatch=on,loosescan=on';
-set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
-SET optimizer_switch=ifnull(@optimizer_switch_for_subselect_sj_test,'outer_join_with_cache=off');
-SET optimizer_switch=ifnull(@optimizer_switch_for_subselect_sj_test,'semijoin_with_cache=off');
-if (`select @join_cache_level_for_subselect_sj_test is null`)
-{
- set join_cache_level=1;
-}
-if (`select @join_cache_level_for_subselect_sj_test is not null`)
-{
- set join_cache_level=@join_cache_level_for_subselect_sj_test;
-}
-
-# The 'default' value within the scope of this test:
-set @save_optimizer_switch=@@optimizer_switch;
-
-#
-# 1. Subqueries that are converted into semi-joins
-#
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1(a int, b int);
-insert into t1 values (0,0),(1,1),(2,2);
-create table t2 as select * from t1;
-
-create table t11(a int, b int);
-
-create table t10 (pk int, a int, primary key(pk));
-insert into t10 select a,a from t0;
-create table t12 like t10;
-insert into t12 select * from t10;
-
-
---echo Flattened because of dependency, t10=func(t1)
-explain select * from t1 where a in (select pk from t10);
-select * from t1 where a in (select pk from t10);
-
---echo A confluent case of dependency
-explain select * from t1 where a in (select a from t10 where pk=12);
-select * from t1 where a in (select a from t10 where pk=12);
-
-explain select * from t1 where a in (select a from t10 where pk=9);
-select * from t1 where a in (select a from t10 where pk=9);
-
---echo An empty table inside
-explain select * from t1 where a in (select a from t11);
-select * from t1 where a in (select a from t11);
-
-explain select * from t1 where a in (select pk from t10) and b in (select pk from t10);
-select * from t1 where a in (select pk from t10) and b in (select pk from t10);
-
---echo flattening a nested subquery
-explain select * from t1 where a in (select pk from t10 where t10.a in (select pk from t12));
-select * from t1 where a in (select pk from t10 where t10.a in (select pk from t12));
-
---echo flattening subquery w/ several tables
-explain extended select * from t1 where a in (select t10.pk from t10, t12 where t12.pk=t10.a);
-
---echo subqueries within outer joins go into ON expr.
-# TODO: psergey: check if case conversions like those are ok (it broke on windows)
---replace_result a A b B
-explain extended
-select * from t1 left join (t2 A, t2 B) on ( A.a= t1.a and B.a in (select pk from t10));
-
-# TODO: psergey: check if case conversions like those are ok (it broke on windows)
---echo t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)"
---replace_result a A b B
-explain extended
-select * from t1 left join t2 on (t2.a= t1.a and t2.a in (select pk from t10));
-
-set join_buffer_size=8*1024;
-
---echo we shouldn't flatten if we're going to get a join of > MAX_TABLES.
-explain select * from
- t1 s00, t1 s01, t1 s02, t1 s03, t1 s04,t1 s05,t1 s06,t1 s07,t1 s08,t1 s09,
- t1 s10, t1 s11, t1 s12, t1 s13, t1 s14,t1 s15,t1 s16,t1 s17,t1 s18,t1 s19,
- t1 s20, t1 s21, t1 s22, t1 s23, t1 s24,t1 s25,t1 s26,t1 s27,t1 s28,t1 s29,
- t1 s30, t1 s31, t1 s32, t1 s33, t1 s34,t1 s35,t1 s36,t1 s37,t1 s38,t1 s39,
- t1 s40, t1 s41, t1 s42, t1 s43, t1 s44,t1 s45,t1 s46,t1 s47,t1 s48,t1 s49
-where
- s00.a in (
- select m00.a from
- t1 m00, t1 m01, t1 m02, t1 m03, t1 m04,t1 m05,t1 m06,t1 m07,t1 m08,t1 m09,
- t1 m10, t1 m11, t1 m12, t1 m13, t1 m14,t1 m15,t1 m16,t1 m17,t1 m18,t1 m19
- );
-
-select * from
- t1 left join t2 on (t2.a= t1.a and t2.a in (select pk from t10))
-where t1.a < 5;
-
-set join_buffer_size=default;
-
-#
-# Prepared statements
-#
-prepare s1 from
- ' select * from
- t1 left join t2 on (t2.a= t1.a and t2.a in (select pk from t10))
- where t1.a < 5';
-execute s1;
-execute s1;
-
-# Try I2O orders
-insert into t1 select (A.a + 10 * B.a),1 from t0 A, t0 B;
-explain extended select * from t1 where a in (select pk from t10 where pk<3);
-
-drop table t0, t1, t2;
-drop table t10, t11, t12;
-
---echo
---echo Bug#37899: Wrongly checked optimization prerequisite caused failed
---echo assertion.
---echo
-CREATE TABLE t1 (
- `pk` int(11),
- `varchar_nokey` varchar(5)
-);
-
-INSERT INTO t1 VALUES
-(1,'qk'),(2,'j'),(3,'aew');
-
-SELECT *
-FROM t1
-WHERE varchar_nokey IN (
- SELECT
- varchar_nokey
- FROM
- t1
-) XOR pk = 30;
-drop table t1;
-
---echo #
---echo # BUG#41842: Semi-join materialization strategy crashes when the upper query has HAVING
---echo #
-
-CREATE TABLE t1 (
- pk int(11) NOT NULL AUTO_INCREMENT,
- int_nokey int(11) NOT NULL,
- time_key time NOT NULL,
- datetime_key datetime NOT NULL,
- datetime_nokey datetime NOT NULL,
- varchar_key varchar(1) NOT NULL,
- varchar_nokey varchar(1) NOT NULL,
- PRIMARY KEY (pk),
- KEY time_key (time_key),
- KEY datetime_key (datetime_key),
- KEY varchar_key (varchar_key)
-);
-INSERT INTO t1 VALUES
-(1,0, '00:16:10','2008-09-03 14:25:40','2008-09-03 14:25:40','h','h'),
-(2,7, '00:00:00','2001-01-13 00:00:00','2001-01-13 00:00:00','',''),
-(3,0, '00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','x','x'),
-(4,2, '16:29:24','2000-10-16 01:39:08','2000-10-16 01:39:08','w','w'),
-(5,1, '09:23:32','0000-00-00 00:00:00','0000-00-00 00:00:00','p','p'),
-(6,3, '00:00:00','2007-12-02 00:00:00','2007-12-02 00:00:00','o','o'),
-(7,3, '00:00:00','2008-09-11 00:00:00','2008-09-11 00:00:00','',''),
-(8,0, '13:59:04','0000-00-00 00:00:00','0000-00-00 00:00:00','s','s'),
-(9,7, '09:01:06','0000-00-00 00:00:00','0000-00-00 00:00:00','d','d'),
-(10,5,'00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','n','n'),
-(11,0,'21:06:46','0000-00-00 00:00:00','0000-00-00 00:00:00','o','o'),
-(12,2,'00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','',''),
-(13,6,'14:45:34','2003-07-28 02:34:08','2003-07-28 02:34:08','w','w'),
-(14,1,'15:04:12','0000-00-00 00:00:00','0000-00-00 00:00:00','o','o'),
-(15,0,'00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','x','x'),
-(16,0,'15:55:23','2004-03-17 00:32:27','2004-03-17 00:32:27','p','p'),
-(17,1,'16:30:00','2004-12-27 19:20:00','2004-12-27 19:20:00','d','d'),
-(18,0,'00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','h','h'),
-(19,0,'14:13:26','2008-11-09 05:53:48','2008-11-09 05:53:48','o','o'),
-(20,0,'00:00:00','2009-10-11 06:58:04','2009-10-11 06:58:04','k','k');
-
-CREATE TABLE t2 (
- pk int(11) NOT NULL AUTO_INCREMENT,
- int_nokey int(11) NOT NULL,
- time_key time NOT NULL,
- datetime_key datetime NOT NULL,
- datetime_nokey datetime NOT NULL,
- varchar_key varchar(1) NOT NULL,
- varchar_nokey varchar(1) NOT NULL,
- PRIMARY KEY (pk),
- KEY time_key (time_key),
- KEY datetime_key (datetime_key),
- KEY varchar_key (varchar_key)
-);
-INSERT INTO t2 VALUES
-(10,0,'19:39:13','0000-00-00 00:00:00','0000-00-00 00:00:00','g','g'),
-(11,8,'03:43:53','0000-00-00 00:00:00','0000-00-00 00:00:00','b','b');
-SELECT OUTR.datetime_nokey AS X FROM t1 AS OUTR
-WHERE
- OUTR.varchar_nokey IN (SELECT
- INNR . varchar_nokey AS Y
- FROM t2 AS INNR
- WHERE
- INNR . datetime_key >= INNR . time_key OR
- INNR . pk = INNR . int_nokey
- )
- AND OUTR . varchar_nokey <= 'w'
-HAVING X > '2012-12-12';
-drop table t1, t2;
-
---echo #
---echo # Bug#45191: Incorrectly initialized semi-join led to a wrong result.
---echo #
-CREATE TABLE STAFF (EMPNUM CHAR(3) NOT NULL,
- EMPNAME CHAR(20), GRADE DECIMAL(4), CITY CHAR(15));
-
-CREATE TABLE PROJ (PNUM CHAR(3) NOT NULL,
- PNAME CHAR(20), PTYPE CHAR(6),
- BUDGET DECIMAL(9),
- CITY CHAR(15));
-
-CREATE TABLE WORKS (EMPNUM CHAR(3) NOT NULL,
- PNUM CHAR(3) NOT NULL, HOURS DECIMAL(5));
-INSERT INTO STAFF VALUES ('E1','Alice',12,'Deale');
-INSERT INTO STAFF VALUES ('E2','Betty',10,'Vienna');
-INSERT INTO STAFF VALUES ('E3','Carmen',13,'Vienna');
-INSERT INTO STAFF VALUES ('E4','Don',12,'Deale');
-INSERT INTO STAFF VALUES ('E5','Ed',13,'Akron');
-
-INSERT INTO PROJ VALUES ('P1','MXSS','Design',10000,'Deale');
-INSERT INTO PROJ VALUES ('P2','CALM','Code',30000,'Vienna');
-INSERT INTO PROJ VALUES ('P3','SDP','Test',30000,'Tampa');
-INSERT INTO PROJ VALUES ('P4','SDP','Design',20000,'Deale');
-INSERT INTO PROJ VALUES ('P5','IRM','Test',10000,'Vienna');
-INSERT INTO PROJ VALUES ('P6','PAYR','Design',50000,'Deale');
-
-INSERT INTO WORKS VALUES ('E1','P1',40);
-INSERT INTO WORKS VALUES ('E1','P2',20);
-INSERT INTO WORKS VALUES ('E1','P3',80);
-INSERT INTO WORKS VALUES ('E1','P4',20);
-INSERT INTO WORKS VALUES ('E1','P5',12);
-INSERT INTO WORKS VALUES ('E1','P6',12);
-INSERT INTO WORKS VALUES ('E2','P1',40);
-INSERT INTO WORKS VALUES ('E2','P2',80);
-INSERT INTO WORKS VALUES ('E3','P2',20);
-INSERT INTO WORKS VALUES ('E4','P2',20);
-INSERT INTO WORKS VALUES ('E4','P4',40);
-INSERT INTO WORKS VALUES ('E4','P5',80);
-
-set optimizer_switch=@save_optimizer_switch;
-set optimizer_switch='materialization=off';
-
-explain SELECT EMPNUM, EMPNAME
-FROM STAFF
-WHERE EMPNUM IN
- (SELECT EMPNUM FROM WORKS
- WHERE PNUM IN
- (SELECT PNUM FROM PROJ));
-
-SELECT EMPNUM, EMPNAME
-FROM STAFF
-WHERE EMPNUM IN
- (SELECT EMPNUM FROM WORKS
- WHERE PNUM IN
- (SELECT PNUM FROM PROJ));
-
-set optimizer_switch=@save_optimizer_switch;
-
-drop table STAFF,WORKS,PROJ;
-
---echo # End of bug#45191
-
---echo #
---echo # Bug#46550 Azalea returning duplicate results for some IN subqueries
---echo # w/ semijoin=on
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t0, t1, t2;
---enable_warnings
-
-CREATE TABLE t0 (
- int_key int(11) DEFAULT NULL,
- varchar_key varchar(1) DEFAULT NULL,
- varchar_nokey varchar(1) DEFAULT NULL,
- KEY int_key (int_key),
- KEY varchar_key (varchar_key,int_key)
-);
-
-INSERT INTO t0 VALUES
-(1,'m','m'),
-(40,'h','h'),
-(1,'r','r'),
-(1,'h','h'),
-(9,'x','x'),
-(NULL,'q','q'),
-(NULL,'k','k'),
-(7,'l','l'),
-(182,'k','k'),
-(202,'a','a'),
-(7,'x','x'),
-(6,'j','j'),
-(119,'z','z'),
-(4,'d','d'),
-(5,'h','h'),
-(1,'u','u'),
-(3,'q','q'),
-(7,'a','a'),
-(3,'e','e'),
-(6,'l','l');
-
-CREATE TABLE t1 (
- int_key int(11) DEFAULT NULL,
- varchar_key varchar(1) DEFAULT NULL,
- varchar_nokey varchar(1) DEFAULT NULL,
- KEY int_key (int_key),
- KEY varchar_key (varchar_key,int_key)
-);
-INSERT INTO t1 VALUES (7,NULL,NULL),(4,'x','x');
-
-CREATE TABLE t2 (
- int_key int(11) DEFAULT NULL,
- varchar_key varchar(1) DEFAULT NULL,
- varchar_nokey varchar(1) DEFAULT NULL,
- KEY int_key (int_key),
- KEY varchar_key (varchar_key,int_key)
-);
-INSERT INTO t2 VALUES (123,NULL,NULL);
-
-SELECT int_key
-FROM t0
-WHERE varchar_nokey IN (
- SELECT t1 .varchar_key from t1
-);
---disable_parsing # wrong duplicate results - LP BUG#702374
-SELECT t0.int_key
-FROM t0
-WHERE t0.varchar_nokey IN (
- SELECT t1_1 .varchar_key
- FROM t1 AS t1_1 JOIN t1 AS t1_2 ON t1_1 .int_key
-);
-
-SELECT t0.int_key
-FROM t0, t2
-WHERE t0.varchar_nokey IN (
- SELECT t1_1 .varchar_key
- FROM t1 AS t1_1 JOIN t1 AS t1_2 ON t1_1 .int_key
-);
---enable_parsing
-DROP TABLE t0, t1, t2;
-
---echo # End of bug#46550
-
---echo #
---echo # Bug #46744 Crash in optimize_semijoin_nests on empty view
---echo # with limit and procedure.
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
-DROP PROCEDURE IF EXISTS p1;
---enable_warnings
-
-CREATE TABLE t1 ( f1 int );
-CREATE TABLE t2 ( f1 int );
-
-insert into t2 values (5), (7);
-
-CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1 LIMIT 2;
-
-create procedure p1()
-select COUNT(*)
-FROM v1 WHERE f1 IN
-(SELECT f1 FROM t2 WHERE f1 = ANY (SELECT f1 FROM v1));
-
-SET SESSION optimizer_switch = 'semijoin=on';
-CALL p1();
-SET SESSION optimizer_switch = 'semijoin=off';
-CALL p1();
-
-drop table t1, t2;
-drop view v1;
-drop procedure p1;
-
-set SESSION optimizer_switch=@save_optimizer_switch;
-
---echo # End of bug#46744
-
---echo
---echo Bug#46797 "Crash in fix_semijoin_strategies_for_picked_join_order
---echo with semijoin=on"
---echo
-CREATE TABLE t1 (
- varchar_key varchar(1) DEFAULT NULL,
- KEY varchar_key (varchar_key)
-);
-
-CREATE TABLE t2 (
- varchar_key varchar(1) DEFAULT NULL,
- KEY varchar_key (varchar_key)
-);
-INSERT INTO t2 VALUES
- (NULL),(NULL),(NULL),(NULL),('a'),('a'),('a'),('b'),('b'),('b'),('b'),('c'),
- ('c'),('c'),('c'),('c'),('c'),('c'),('d'),('d'),('d'),('d'),('d'),('d'),('e'),
- ('e'),('e'),('e'),('e'),('e'),('f'),('f'),('f'),('g'),('g'),('h'),('h'),('h'),
- ('h'),('i'),('j'),('j'),('j'),('k'),('k'),('l'),('l'),('m'),('m'),('m'),('m'),
- ('n'),('n'),('n'),('o'),('o'),('o'),('p'),('p'),('p'),('q'),('q'),('q'),('r'),
- ('r'),('r'),('r'),('s'),('s'),('s'),('s'),('t'),('t'),('t'),('t'),('u'),('u'),
- ('u'),('u'),('v'),('v'),('v'),('v'),('w'),('w'),('w'),('w'),('w'),('w'),('x'),
- ('x'),('x'),('y'),('y'),('y'),('y'),('z'),('z'),('z'),('z');
-
-CREATE TABLE t3 (
- varchar_key varchar(1) DEFAULT NULL,
- KEY varchar_key (varchar_key)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-INSERT INTO t3 VALUES
- (NULL),('c'),('d'),('e'),('f'),('h'),('j'),('k'),('k'),('m'),('m'),('m'),
- ('n'),('o'),('r'),('t'),('t'),('u'),('w'),('y');
-
-SELECT varchar_key FROM t3
-WHERE (SELECT varchar_key FROM t3
- WHERE (varchar_key,varchar_key)
- IN (SELECT t1.varchar_key, t2 .varchar_key
- FROM t1 RIGHT JOIN t2 ON t1.varchar_key
- )
- );
-
-DROP TABLE t1, t2, t3;
-
-
---echo #
---echo # Bug#46556 Returning incorrect, empty results for some IN subqueries
---echo # w/semijoin=on
---echo #
-
-CREATE TABLE t0 (
- pk INTEGER,
- vkey VARCHAR(1),
- vnokey VARCHAR(1),
- PRIMARY KEY (pk),
- KEY vkey(vkey)
-);
-
-INSERT INTO t0
-VALUES (1,'g','g'), (2,'v','v'), (3,'t','t'), (4,'u','u'), (5,'n','n');
-
-EXPLAIN EXTENDED SELECT vkey FROM t0 WHERE pk IN
- (SELECT t1.pk FROM t0 t1 JOIN t0 t2 ON t2.vkey = t1.vnokey);
-
-SELECT vkey FROM t0 WHERE pk IN
- (SELECT t1.pk FROM t0 t1 JOIN t0 t2 ON t2.vkey = t1.vnokey);
-
-DROP TABLE t0;
-
---echo # End of bug#46556
-
---echo
---echo Bug #48073 Subquery on char columns from view crashes Mysql
---echo
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
---enable_warnings
-
-CREATE TABLE t1 (
- city VARCHAR(50) NOT NULL,
- country_id SMALLINT UNSIGNED NOT NULL
-);
-
-INSERT INTO t1 VALUES
-('Batna',2),
-('Bchar',2),
-('Skikda',2),
-('Tafuna',3),
-('Algeria',2) ;
-
-CREATE TABLE t2 (
- country_id SMALLINT UNSIGNED NOT NULL,
- country VARCHAR(50) NOT NULL
-);
-
-INSERT INTO t2 VALUES
-(2,'Algeria'),
-(3,'American Samoa') ;
-
-CREATE VIEW v1 AS
-SELECT country_id, country
-FROM t2
-WHERE LEFT(country,1) = "A"
-;
-
-SELECT city, country_id
-FROM t1
-WHERE city IN (
- SELECT country
- FROM t2
- WHERE LEFT(country, 1) = "A"
-);
-
-SELECT city, country_id
-FROM t1
-WHERE city IN (
- SELECT country
- FROM v1
-);
-
-drop table t1, t2;
-drop view v1;
-
---echo # End of bug#48073
-
---echo
---echo Bug#48834: Procedure with view + subquery + semijoin=on
---echo crashes on second call.
---echo
-
-SET SESSION optimizer_switch ='semijoin=on';
-
-CREATE TABLE t1 ( t1field integer, primary key (t1field));
-CREATE TABLE t2 ( t2field integer, primary key (t2field));
-
-CREATE VIEW v1 AS
- SELECT t1field as v1field
- FROM t1 A
- WHERE A.t1field IN (SELECT t1field FROM t2 );
-
-CREATE VIEW v2 AS
- SELECT t2field as v2field
- FROM t2 A
- WHERE A.t2field IN (SELECT t2field FROM t2 );
-
-DELIMITER |;
-CREATE PROCEDURE p1 ()
- BEGIN
- SELECT v1field
- FROM v1
- WHERE v1field IN ( SELECT v2field as vf_inner FROM v2 );
- END|
-DELIMITER ;|
-
-INSERT INTO t1 VALUES (1),(2),(3);
-INSERT INTO t2 VALUES (2),(3),(4);
-
-CALL p1;
-CALL p1;
-
-DROP TABLE t1,t2;
-DROP VIEW v1,v2;
-DROP PROCEDURE p1;
-
-set SESSION optimizer_switch=@save_optimizer_switch;
-
---echo # End of BUG#48834
-
---echo
---echo Bug#49097 subquery with view generates wrong result with
---echo non-prepared statement
---echo
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS v1;
---enable_warnings
-
-CREATE TABLE t1 (
- city VARCHAR(50) NOT NULL,
- country_id SMALLINT UNSIGNED NOT NULL
-);
-
-INSERT INTO t1 VALUES
-('Batna',2),
-('Bchar',2),
-('Skikda',2),
-('Tafuna',3),
-('Algeria',2) ;
-
-CREATE TABLE t2 (
- country_id SMALLINT UNSIGNED NOT NULL,
- country VARCHAR(50) NOT NULL
-);
-
-INSERT INTO t2 VALUES
-(2,'Algeria'),
-(3,'XAmerican Samoa') ;
-
-CREATE VIEW v1 AS
-SELECT country_id, country
-FROM t2
-WHERE LEFT(country,1) = "A"
-;
-
-SELECT city, country_id
-FROM t1
-WHERE country_id IN (
- SELECT country_id
- FROM t2
- WHERE LEFT(country,1) = "A"
-);
-
-SELECT city, country_id
-FROM t1
-WHERE country_id IN (
- SELECT country_id
- FROM v1
-);
-
-PREPARE stmt FROM
-"
-SELECT city, country_id
-FROM t1
-WHERE country_id IN (
- SELECT country_id
- FROM v1
-);
-";
-
-execute stmt;
-
-deallocate prepare stmt;
-drop table t1, t2;
-drop view v1;
-
---echo # End of Bug#49097
-
---echo #
---echo # BUG#38075: Wrong result: rows matching a subquery with outer join not returned
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS ot1, it1, it2;
---enable_warnings
-
-CREATE TABLE it2 (
- int_key int(11) NOT NULL,
- datetime_key datetime NOT NULL,
- KEY int_key (int_key),
- KEY datetime_key (datetime_key)
-);
-INSERT INTO it2 VALUES
- (5,'2002-04-10 14:25:30'), (0,'0000-00-00 00:00:00'),
- (0,'2006-09-14 04:01:02'), (4,'0000-00-00 00:00:00'),
- (8,'0000-00-00 00:00:00'), (5,'0000-00-00 00:00:00'),
- (9,'0000-00-00 00:00:00'), (8,'2007-04-01 11:04:17'),
- (1,'0000-00-00 00:00:00'), (7,'2009-01-12 00:00:00'),
- (0,'2009-06-05 00:00:00'), (3,'2006-02-14 18:06:35'),
- (5,'2006-02-21 07:08:16'), (0,'0000-00-00 00:00:00'),
- (7,'0000-00-00 00:00:00'), (0,'0000-00-00 00:00:00'),
- (0,'2007-02-13 00:00:00'), (1,'0000-00-00 00:00:00'),
- (0,'0000-00-00 00:00:00'), (1,'2003-08-11 00:00:00');
-CREATE TABLE ot1 (
- int_nokey int(11) NOT NULL,
- int_key int(11) NOT NULL,
- KEY int_key (int_key)
-);
-INSERT INTO ot1 VALUES
- (5,0), (3,0), (0,2), (3,0), (1,3), (0,0), (1,7), (7,0), (1,7), (0,7),
- (0,9), (8,2), (4,4), (9,3), (0,9), (2,5), (0,5), (8,0), (5,8), (1,5);
-CREATE TABLE it1 (
- int_nokey int(11) NOT NULL,
- int_key int(11) NOT NULL,
- KEY int_key (int_key)
-);
-INSERT INTO it1 VALUES
- (9,5), (0,4);
---sorted_result
-SELECT int_key FROM ot1
-WHERE int_nokey IN (SELECT it2.int_key
- FROM it1 LEFT JOIN it2 ON it2.datetime_key);
-EXPLAIN
-SELECT int_key FROM ot1
-WHERE int_nokey IN (SELECT it2.int_key
- FROM it1 LEFT JOIN it2 ON it2.datetime_key);
-DROP TABLE ot1, it1, it2;
-
---echo # End of BUG#38075
-
---echo #
---echo # BUG#31480: Incorrect result for nested subquery when executed via semi join
---echo #
-create table t1 (a int not null, b int not null);
-create table t2 (c int not null, d int not null);
-create table t3 (e int not null);
-
-insert into t1 values (1,10);
-insert into t1 values (2,10);
-insert into t1 values (1,20);
-insert into t1 values (2,20);
-insert into t1 values (3,20);
-insert into t1 values (2,30);
-insert into t1 values (4,40);
-
-insert into t2 values (2,10);
-insert into t2 values (2,20);
-insert into t2 values (4,10);
-insert into t2 values (5,10);
-insert into t2 values (3,20);
-insert into t2 values (2,40);
-
-insert into t3 values (10);
-insert into t3 values (30);
-insert into t3 values (10);
-insert into t3 values (20);
-
-explain extended
-select a from t1
-where a in (select c from t2 where d >= some(select e from t3 where b=e));
-show warnings;
-
-select a from t1
-where a in (select c from t2 where d >= some(select e from t3 where b=e));
-
-drop table t1, t2, t3;
-
---echo #
---echo # Bug#48213 Materialized subselect crashes if using GEOMETRY type
---echo #
-
-CREATE TABLE t1 (
- pk int,
- a varchar(1),
- b varchar(4),
- c tinyblob,
- d blob,
- e mediumblob,
- f longblob,
- g tinytext,
- h text,
- i mediumtext,
- j longtext,
- k geometry,
- PRIMARY KEY (pk)
-);
-
-INSERT INTO t1 VALUES (1,'o','ffff','ffff','ffoo','ffff','ffff','ffff','ffff','ffff','ffff',GeomFromText('POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))')), (2,'f','ffff','ffff','ffff', 'ffff','ffff','ffff','ffff','ffff','ffff',GeomFromText('POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))'));
-
-CREATE TABLE t2 LIKE t1;
-INSERT INTO t2 VALUES (1,'i','iiii','iiii','iiii','iiii','ffff','ffff','ffff','ffff','ffff',GeomFromText('POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))')), (2,'f','ffff','ffff','ffff','ffff','ffff','ffff','ffff','ffff','ffff',GeomFromText('POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))'));
-
-# Test that materialization is skipped for semijoins where materialized
-# table would contain GEOMETRY or different kinds of BLOB/TEXT columns
-let $query=
-SELECT pk FROM t1 WHERE (a, b) IN (SELECT a, b FROM t2 WHERE pk > 0);
-eval EXPLAIN EXTENDED $query;
-eval $query;
-
-let $query=
-SELECT pk FROM t1 WHERE (b, c) IN (SELECT b, c FROM t2 WHERE pk > 0);
-eval EXPLAIN EXTENDED $query;
-eval $query;
-
-let $query=
-SELECT pk FROM t1 WHERE (b, d) IN (SELECT b, d FROM t2 WHERE pk > 0);
-eval EXPLAIN EXTENDED $query;
-eval $query;
-
-let $query=
-SELECT pk FROM t1 WHERE (b, e) IN (SELECT b, e FROM t2 WHERE pk > 0);
-eval EXPLAIN EXTENDED $query;
-eval $query;
-
-let $query=
-SELECT pk FROM t1 WHERE (b, f) IN (SELECT b, f FROM t2 WHERE pk > 0);
-eval EXPLAIN EXTENDED $query;
-eval $query;
-
-let $query=
-SELECT pk FROM t1 WHERE (b, g) IN (SELECT b, g FROM t2 WHERE pk > 0);
-eval EXPLAIN EXTENDED $query;
-eval $query;
-
-let $query=
-SELECT pk FROM t1 WHERE (b, h) IN (SELECT b, h FROM t2 WHERE pk > 0);
-eval EXPLAIN EXTENDED $query;
-eval $query;
-
-let $query=
-SELECT pk FROM t1 WHERE (b, i) IN (SELECT b, i FROM t2 WHERE pk > 0);
-eval EXPLAIN EXTENDED $query;
-eval $query;
-
-let $query=
-SELECT pk FROM t1 WHERE (b, j) IN (SELECT b, j FROM t2 WHERE pk > 0);
-eval EXPLAIN EXTENDED $query;
-eval $query;
-
-let $query=
-SELECT pk FROM t1 WHERE (b, k) IN (SELECT b, k FROM t2 WHERE pk > 0);
-eval EXPLAIN EXTENDED $query;
-eval $query;
-
-DROP TABLE t1, t2;
-
---echo # End of Bug#48213
-
---echo #
---echo # Bug#49198 Wrong result for second call of procedure
---echo # with view in subselect.
---echo #
-
-CREATE TABLE t1 (t1field integer, primary key (t1field));
-CREATE TABLE t2 (t2field integer, primary key (t2field));
-CREATE TABLE t3 (t3field integer, primary key (t3field));
-
-CREATE VIEW v2 AS SELECT * FROM t2;
-CREATE VIEW v3 AS SELECT * FROM t3;
-
-INSERT INTO t1 VALUES(1),(2);
-INSERT INTO t2 VALUES(1),(2);
-INSERT INTO t3 VALUES(1),(2);
-
-PREPARE stmt FROM
-"
-SELECT t1field
-FROM t1
-WHERE t1field IN (SELECT * FROM v2);
-";
-
-EXECUTE stmt;
-EXECUTE stmt;
-
-PREPARE stmt FROM
-"
-EXPLAIN
-SELECT t1field
-FROM t1
-WHERE t1field IN (SELECT * FROM v2)
- AND t1field IN (SELECT * FROM v3)
-";
-
-EXECUTE stmt;
-EXECUTE stmt;
-
-DROP TABLE t1, t2, t3;
-DROP VIEW v2, v3;
-
---echo # End of Bug#49198
-
---echo #
---echo # Bug#45174: Incorrectly applied equality propagation caused wrong
---echo # result on a query with a materialized semi-join.
---echo #
-
-CREATE TABLE `t1` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `varchar_key` varchar(1) NOT NULL,
- `varchar_nokey` varchar(1) NOT NULL,
- PRIMARY KEY (`pk`),
- KEY `varchar_key` (`varchar_key`)
-);
-
-INSERT INTO `t1` VALUES (11,'m','m'),(12,'j','j'),(13,'z','z'),(14,'a','a'),(15,'',''),(16,'e','e'),(17,'t','t'),(19,'b','b'),(20,'w','w'),(21,'m','m'),(23,'',''),(24,'w','w'),(26,'e','e'),(27,'e','e'),(28,'p','p');
-
-CREATE TABLE `t2` (
- `varchar_nokey` varchar(1) NOT NULL
-);
-
-INSERT INTO `t2` VALUES ('v'),('u'),('n'),('l'),('h'),('u'),('n'),('j'),('k'),('e'),('i'),('u'),('n'),('b'),('x'),(''),('q'),('u');
-
-EXPLAIN EXTENDED SELECT varchar_nokey
-FROM t2
-WHERE ( `varchar_nokey` , `varchar_nokey` ) IN (
-SELECT `varchar_key` , `varchar_nokey`
-FROM t1
-WHERE `varchar_nokey` < 'n' XOR `pk` ) ;
-
-SELECT varchar_nokey
-FROM t2
-WHERE ( `varchar_nokey` , `varchar_nokey` ) IN (
-SELECT `varchar_key` , `varchar_nokey`
-FROM t1
-WHERE `varchar_nokey` < 'n' XOR `pk` ) ;
-
-DROP TABLE t1, t2;
-
---echo # End of the test for bug#45174.
---echo #
---echo # BUG#43768: Prepared query with nested subqueries core dumps on second execution
---echo #
-create table t1 (
- id int(11) unsigned not null primary key auto_increment,
- partner_id varchar(35) not null,
- t1_status_id int(10) unsigned
-);
-
-insert into t1 values ("1", "partner1", "10"), ("2", "partner2", "10"),
- ("3", "partner3", "10"), ("4", "partner4", "10");
-
-create table t2 (
- id int(11) unsigned not null default '0',
- t1_line_id int(11) unsigned not null default '0',
- article_id varchar(20),
- sequence int(11) not null default '0',
- primary key (id,t1_line_id)
-);
-
-insert into t2 values ("1", "1", "sup", "0"), ("2", "1", "sup", "1"),
- ("2", "2", "sup", "2"), ("2", "3", "sup", "3"),
- ("2", "4", "imp", "4"), ("3", "1", "sup", "0"),
- ("4", "1", "sup", "0");
-create table t3 (
- id int(11) not null default '0',
- preceding_id int(11) not null default '0',
- primary key (id,preceding_id)
-);
-
-create table t4 (
- user_id varchar(50) not null,
- article_id varchar(20) not null,
- primary key (user_id,article_id)
-);
-
-insert into t4 values("nicke", "imp");
-prepare stmt from
-'select t1.partner_id
-from t1
-where
- t1.id in (
- select pl_inner.id
- from t2 as pl_inner
- where pl_inner.article_id in (
- select t4.article_id from t4
- where t4.user_id = \'nicke\'
- )
- )';
-
-execute stmt;
-execute stmt;
-drop table t1,t2,t3,t4;
-
---echo #
---echo # Bug#48623 Multiple subqueries are optimized incorrectly
---echo #
-
-CREATE TABLE t1(val VARCHAR(10));
-CREATE TABLE t2(val VARCHAR(10));
-CREATE TABLE t3(val VARCHAR(10));
-
-INSERT INTO t1 VALUES('aaa'), ('bbb'), ('eee'), ('mmm'), ('ppp');
-INSERT INTO t2 VALUES('aaa'), ('aaa'), ('bbb'), ('eee'), ('mmm'), ('ppp');
-INSERT INTO t3 VALUES('aaa'), ('bbb'), ('eee'), ('mmm'), ('ppp');
-
-EXPLAIN
-SELECT *
-FROM t1
-WHERE t1.val IN (SELECT t2.val FROM t2
- WHERE t2.val LIKE 'a%' OR t2.val LIKE 'e%')
- AND t1.val IN (SELECT t3.val FROM t3
- WHERE t3.val LIKE 'a%' OR t3.val LIKE 'e%');
-
-SELECT *
-FROM t1
-WHERE t1.val IN (SELECT t2.val FROM t2
- WHERE t2.val LIKE 'a%' OR t2.val LIKE 'e%')
- AND t1.val IN (SELECT t3.val FROM t3
- WHERE t3.val LIKE 'a%' OR t3.val LIKE 'e%');
-
-DROP TABLE t1;
-DROP TABLE t2;
-DROP TABLE t3;
-
---echo # End of Bug#48623
-
---echo #
---echo # LPBUG#602574: RQG: sql_select.cc:5385: bool greedy_search(JOIN*, table_map, uint,
---echo # uint): Assertion `join->best_read <
---echo #
-set @save_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='materialization=off';
-CREATE TABLE t1 (
- varchar_key varchar(1) DEFAULT NULL,
- KEY varchar_key (varchar_key)
-);
-
-CREATE TABLE t2 (
- varchar_key varchar(1) DEFAULT NULL,
- KEY varchar_key (varchar_key)
-);
-INSERT INTO t2 VALUES
- (NULL),(NULL),(NULL),(NULL),('a'),('a'),('a'),('b'),('b'),('b'),('b'),('c'),
- ('c'),('c'),('c'),('c'),('c'),('c'),('d'),('d'),('d'),('d'),('d'),('d'),('e'),
- ('e'),('e'),('e'),('e'),('e'),('f'),('f'),('f'),('g'),('g'),('h'),('h'),('h'),
- ('h'),('i'),('j'),('j'),('j'),('k'),('k'),('l'),('l'),('m'),('m'),('m'),('m'),
- ('n'),('n'),('n'),('o'),('o'),('o'),('p'),('p'),('p'),('q'),('q'),('q'),('r'),
- ('r'),('r'),('r'),('s'),('s'),('s'),('s'),('t'),('t'),('t'),('t'),('u'),('u'),
- ('u'),('u'),('v'),('v'),('v'),('v'),('w'),('w'),('w'),('w'),('w'),('w'),('x'),
- ('x'),('x'),('y'),('y'),('y'),('y'),('z'),('z'),('z'),('z');
-
-CREATE TABLE t3 (
- varchar_key varchar(1) DEFAULT NULL,
- KEY varchar_key (varchar_key)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-INSERT INTO t3 VALUES
- (NULL),('c'),('d'),('e'),('f'),('h'),('j'),('k'),('k'),('m'),('m'),('m'),
- ('n'),('o'),('r'),('t'),('t'),('u'),('w'),('y');
-
-SELECT varchar_key FROM t3
-WHERE (SELECT varchar_key FROM t3
- WHERE (varchar_key,varchar_key)
- IN (SELECT t1.varchar_key, t2 .varchar_key
- FROM t1 RIGHT JOIN t2 ON t1.varchar_key
- )
- );
-set optimizer_switch=@save_optimizer_switch;
-DROP TABLE t1, t2, t3;
-
---echo #
---echo # Bug#46692 "Crash occurring on queries with nested FROM subqueries
---echo # using materialization."
---echo #
-CREATE TABLE t1 (
- pk INTEGER PRIMARY KEY,
- int_key INTEGER,
- KEY int_key(int_key)
-);
-INSERT INTO t1 VALUES (10,186),(11,NULL),(12,2),(13,3),(14,0),(15,133),(16,1);
-
-CREATE TABLE t2 (
- pk INTEGER PRIMARY KEY,
- int_key INTEGER,
- KEY int_key(int_key)
-);
-INSERT INTO t2 VALUES (1,7),(2,2);
-
-SELECT * FROM t1 WHERE (140, 4) IN
- (SELECT t2.int_key, t2 .pk FROM t2 STRAIGHT_JOIN t1 ON t2.int_key);
-
-DROP TABLE t1, t2;
-
---echo #
---echo # Bug#42353 "SELECT ... WHERE oe IN (SELECT w/ LEFT JOIN) query
---echo # causes crash."
---echo #
-CREATE TABLE t1 (
- pk INTEGER PRIMARY KEY,
- int_nokey INTEGER,
- int_key INTEGER,
- date_key DATE,
- datetime_nokey DATETIME,
- varchar_nokey VARCHAR(1)
-);
-
-CREATE TABLE t2 (
- date_nokey DATE
-);
-
-CREATE TABLE t3 (
- pk INTEGER PRIMARY KEY,
- int_nokey INTEGER,
- date_key date,
- varchar_key VARCHAR(1),
- varchar_nokey VARCHAR(1),
- KEY date_key (date_key)
-);
-
-SELECT date_key FROM t1
-WHERE (int_key, int_nokey)
- IN (SELECT t3.int_nokey, t3.pk
- FROM t2 LEFT JOIN t3 ON (t2.date_nokey < t3.date_key)
- WHERE t3.varchar_key <= t3.varchar_nokey OR t3.int_nokey <= t3.pk
- )
- AND (varchar_nokey <> 'f' OR NOT int_key < 7);
-
-
---echo #
---echo # Bug#45933 "Crash in optimize_semijoin_nests on JOIN in subquery
---echo # + AND in outer query".
---echo #
-INSERT INTO t1 VALUES (10,7,5,'2009-06-16','2002-04-10 14:25:30','w'),
- (11,7,0,'0000-00-00','0000-00-00 00:00:00','s'),
- (12,4,0,'2003-07-14','2006-09-14 04:01:02','y'),
- (13,0,4,'2002-07-25','0000-00-00 00:00:00','c'),
- (14,1,8,'2007-07-03','0000-00-00 00:00:00','q'),
- (15,6,5,'2001-11-12','0000-00-00 00:00:00',''),
- (16,2,9,'0000-00-00','0000-00-00 00:00:00','j'),
- (29,9,1,'0000-00-00','2003-08-11 00:00:00','m');
-INSERT INTO t3 VALUES (1,9,'0000-00-00','b','b'),
- (2,2,'2002-09-17','h','h');
-
-SELECT t1.varchar_nokey FROM t1 JOIN t3 ON t1.datetime_nokey
-WHERE t1.varchar_nokey
- IN (SELECT varchar_nokey FROM t1
- WHERE (pk)
- IN (SELECT t3.int_nokey
- FROM t3 LEFT JOIN t1 ON t1.varchar_nokey
- WHERE t3.date_key BETWEEN '2008-06-07' AND '2006-06-26'
- )
- );
-
-DROP TABLE t1, t2, t3;
-
---echo #
---echo # Bug#45219 "Crash on SELECT DISTINCT query containing a
---echo # LEFT JOIN in subquery"
---echo #
-
-CREATE TABLE t1 (
- pk INTEGER NOT NULL,
- int_nokey INTEGER NOT NULL,
- datetime_key DATETIME NOT NULL,
- varchar_key VARCHAR(1) NOT NULL,
- PRIMARY KEY (pk),
- KEY datetime_key (datetime_key),
- KEY varchar_key (varchar_key)
-);
-INSERT INTO t1 VALUES
-(1,9,'0000-00-00 00:00:00','p'),(2,0,'2002-02-09 07:38:13','v'),
-(3,8,'2001-05-03 12:08:14','t'),(4,3,'0000-00-00 00:00:00','u'),
-(5,7,'2009-07-28 03:43:30','n'),(6,0,'2009-08-04 00:00:00','l'),
-(7,1,'0000-00-00 00:00:00','h'),(8,9,'0000-00-00 00:00:00','u'),
-(9,0,'2005-08-02 17:16:54','n'),(10,9,'2002-12-21 00:00:00','j'),
-(11,0,'2005-08-15 12:37:35','k'),(12,5,'0000-00-00 00:00:00','e'),
-(13,0,'2006-03-10 00:00:00','i'),(14,8,'2005-05-16 11:02:36','u'),
-(15,8,'2008-11-02 00:00:00','n'),(16,5,'2006-03-15 00:00:00','b'),
-(17,1,'0000-00-00 00:00:00','x'),(18,7,'0000-00-00 00:00:00',''),
-(19,0,'2008-12-17 20:15:40','q'),(20,9,'0000-00-00 00:00:00','u');
-
-CREATE TABLE t2 LIKE t1;
-INSERT INTO t2 VALUES
-(10,0,'2006-07-07 07:26:28','q'),(11,5,'2002-09-23 00:00:00','m'),
-(12,7,'0000-00-00 00:00:00','j'),(13,1,'2006-06-07 00:00:00','z'),
-(14,8,'2000-09-16 12:15:34','a'),(15,2,'2007-08-05 15:47:52',''),
-(16,1,'0000-00-00 00:00:00','e'),(17,8,'2005-12-02 19:34:26','t'),
-(18,5,'0000-00-00 00:00:00','q'),(19,4,'0000-00-00 00:00:00','b'),
-(20,5,'2007-12-28 00:00:00','w'),(21,3,'2004-08-02 11:48:43','m'),
-(22,0,'0000-00-00 00:00:00','x'),(23,8,'2004-04-19 12:18:43',''),
-(24,0,'2009-04-27 00:00:00','w'),(25,4,'2006-10-20 14:52:15','x'),
-(26,0,'0000-00-00 00:00:00','e'),(27,0,'2002-03-22 11:48:37','e'),
-(28,2,'0000-00-00 00:00:00','p'),(29,0,'2001-01-04 03:55:07','x');
-
-CREATE TABLE t3 LIKE t1;
-INSERT INTO t3 VALUES
-(10,8,'2007-08-19 08:08:38','i'),(11,0,'2000-05-21 03:51:51','');
-
-SELECT DISTINCT datetime_key FROM t1
-WHERE (int_nokey, pk)
- IN (SELECT t3.pk, t3.pk FROM t2 LEFT JOIN t3 ON t3.varchar_key)
- AND pk = 9;
-
-DROP TABLE t1, t2, t3;
-
---echo #
---echo # BUG#53060: LooseScan semijoin strategy does not return all rows
---echo #
-
-set @save_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='semijoin=on,materialization=off';
-set optimizer_switch='firstmatch=off,loosescan=on';
-
-CREATE TABLE t1 (i INTEGER);
-INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
-CREATE TABLE t2 (i INTEGER, j INTEGER, KEY k(i, j));
-INSERT INTO t2 VALUES (1, 0), (1, 1), (2, 0), (2, 1);
-
-EXPLAIN
-SELECT * FROM t1 WHERE (i) IN (SELECT i FROM t2 where j > 0);
-SELECT * FROM t1 WHERE (i) IN (SELECT i FROM t2 where j > 0);
-
-DROP TABLE t1, t2;
-
-set optimizer_switch=@save_optimizer_switch;
-
---echo #
---echo # BUG#49453: re-execution of prepared statement with view
---echo # and semijoin crashes
---echo #
-
-CREATE TABLE t1 (city VARCHAR(50), country_id INT);
-CREATE TABLE t2 (country_id INT, country VARCHAR(50));
-
-INSERT INTO t1 VALUES
- ('Batna',2),('Bchar',2),('Skikda',2),('Tafuna',3),('Algeria',2) ;
-INSERT INTO t2 VALUES (2,'Algeria'),(2,'AlgeriaDup'),(3,'XAmerican Samoa');
-
-CREATE VIEW v1 AS
- SELECT country_id as vf_country_id
- FROM t2
- WHERE LEFT(country,1) = "A";
-
-PREPARE stmt FROM "
-SELECT city, country_id
-FROM t1
-WHERE country_id IN (SELECT vf_country_id FROM v1);
-";
-
---echo
-EXECUTE stmt;
-EXECUTE stmt;
-
-DROP TABLE t1,t2;
-DROP VIEW v1;
-
---echo #
---echo # Bug#54437 Extra rows with LEFT JOIN + semijoin
---echo #
-
-create table t1 (a int);
-create table t2 (a int);
-create table t3 (a int);
-insert into t1 values(1),(1);
-insert into t2 values(1),(1),(1),(1);
-insert into t3 values(2),(2);
-
-set @save_optimizer_switch=@@optimizer_switch;
-
-set optimizer_switch='materialization=off';
-
-set optimizer_switch='semijoin=off';
-explain
-select * from t1 where t1.a in (select t2.a from t2 left join t3 on t2.a=t3.a);
-select * from t1 where t1.a in (select t2.a from t2 left join t3 on t2.a=t3.a);
-
-set optimizer_switch='semijoin=on';
-explain
-select * from t1 where t1.a in (select t2.a from t2 left join t3 on t2.a=t3.a);
-select * from t1 where t1.a in (select t2.a from t2 left join t3 on t2.a=t3.a);
-
-set optimizer_switch=@save_optimizer_switch;
-
-drop table t1,t2,t3;
-
---echo #
---echo # Bug#55955: crash in MEMORY engine with IN(LEFT JOIN (JOIN))
---echo #
-
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (a INT);
-CREATE TABLE t3 (a INT);
-INSERT INTO t1 VALUES(1),(1);
-INSERT INTO t2 VALUES(1),(1);
-INSERT INTO t3 VALUES(2),(2);
-
-set @save_optimizer_switch=@@optimizer_switch;
-
-set optimizer_switch='semijoin=off,materialization=off';
-EXPLAIN
-SELECT * FROM t1
-WHERE t1.a IN (SELECT t2.a
- FROM t2 LEFT JOIN (t2 AS t2inner, t3) ON t2.a=t3.a);
-SELECT * FROM t1
-WHERE t1.a IN (SELECT t2.a
- FROM t2 LEFT JOIN (t2 AS t2inner, t3) ON t2.a=t3.a);
-
-set optimizer_switch='semijoin=off,materialization=on';
-EXPLAIN
-SELECT * FROM t1
-WHERE t1.a IN (SELECT t2.a
- FROM t2 LEFT JOIN (t2 AS t2inner, t3) ON t2.a=t3.a);
-SELECT * FROM t1
-WHERE t1.a IN (SELECT t2.a
- FROM t2 LEFT JOIN (t2 AS t2inner, t3) ON t2.a=t3.a);
-
-set optimizer_switch='semijoin=on,materialization=off';
-EXPLAIN
-SELECT * FROM t1
-WHERE t1.a IN (SELECT t2.a
- FROM t2 LEFT JOIN (t2 AS t2inner, t3) ON t2.a=t3.a);
-SELECT * FROM t1
-WHERE t1.a IN (SELECT t2.a
- FROM t2 LEFT JOIN (t2 AS t2inner, t3) ON t2.a=t3.a);
-
-set optimizer_switch=@save_optimizer_switch;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # BUG#52329 - Wrong result: subquery materialization, IN,
---echo # non-null field followed by nullable
---echo #
-
-CREATE TABLE t1 (a1 CHAR(8) NOT NULL, a2 char(8) NOT NULL);
-
-CREATE TABLE t2a (b1 char(8), b2 char(8));
-CREATE TABLE t2b (b1 CHAR(8), b2 char(8) NOT NULL);
-CREATE TABLE t2c (b1 CHAR(8) NOT NULL, b2 char(8));
-
-INSERT INTO t1 VALUES ('1 - 12', '2 - 22');
-
-INSERT INTO t2a VALUES ('1 - 11', '2 - 21'),
- ('1 - 11', '2 - 21'),
- ('1 - 12', '2 - 22'),
- ('1 - 12', '2 - 22'),
- ('1 - 13', '2 - 23');
-
-INSERT INTO t2b SELECT * FROM t2a;
-INSERT INTO t2c SELECT * FROM t2a;
-
-set @save_optimizer_switch=@@optimizer_switch;
-
-set optimizer_switch='semijoin=off,materialization=on';
-
-SELECT * FROM t1
-WHERE (a1, a2) IN (
- SELECT b1, b2 FROM t2c WHERE b1 > '0' GROUP BY b1, b2);
-
-SELECT * FROM t1
-WHERE (a1, a2) IN (
- SELECT b1, b2 FROM t2a WHERE b1 > '0');
-
-
-SELECT * FROM t1
-WHERE (a1, a2) IN (
- SELECT b1, b2 FROM t2b WHERE b1 > '0');
-
-
-SELECT * FROM t1
-WHERE (a1, a2) IN (
- SELECT b1, b2 FROM t2c WHERE b1 > '0');
-
-set optimizer_switch=@save_optimizer_switch;
-
-DROP TABLE t1,t2a,t2b,t2c;
-
---echo #
---echo # Bug#57623: subquery within before insert trigger causes crash (sj=on)
---echo #
-
-CREATE TABLE ot1(a INT);
-CREATE TABLE ot2(a INT);
-CREATE TABLE ot3(a INT);
-CREATE TABLE it1(a INT);
-
-INSERT INTO ot1 VALUES(0),(1),(2),(3),(4),(5),(6),(7);
-INSERT INTO ot2 VALUES(0),(2),(4),(6);
-INSERT INTO ot3 VALUES(0),(3),(6);
-INSERT INTO it1 VALUES(0),(1),(2),(3),(4),(5),(6),(7);
-
-let $query=
-SELECT *
-FROM ot1
- LEFT JOIN
- (ot2 JOIN ot3 on ot2.a=ot3.a)
- ON ot1.a=ot2.a AND ot1.a IN (SELECT a from it1);
-
-set @save_optimizer_switch=@@optimizer_switch;
-
-set optimizer_switch='semijoin=on';
-
-set optimizer_switch='materialization=off';
-eval explain $query;
-eval $query;
-eval prepare s from '$query';
-execute s;
-execute s;
-deallocate prepare s;
-
-set optimizer_switch='materialization=on';
-eval explain $query;
-eval $query;
-eval prepare s from '$query';
-execute s;
-execute s;
-deallocate prepare s;
-
-set optimizer_switch=@save_optimizer_switch;
-
-DROP TABLE ot1, ot2, ot3, it1;
-
---echo #
---echo # Bug#59919/11766739: Crash in tmp_table_param::init() with semijoin=on
---echo #
-
-CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM;
-CREATE TABLE t2 (f1 INTEGER, f2 INTEGER) ENGINE=MyISAM;
-CREATE TABLE t3 (f1 INTEGER, f2 INTEGER) ENGINE=MyISAM;
-
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (1,1), (2,1);
-INSERT INTO t3 VALUES
- (1,1), (2,1), (5,4), (7,3), (8,2), (8,1), (7,3),
- (9,5), (4,3), (7,2), (7,7), (3,1), (5,8), (9,7);
-
-set @save_optimizer_switch=@@optimizer_switch;
-
-set optimizer_switch='semijoin=off,materialization=on';
-EXPLAIN
-SELECT * FROM t3
-WHERE f2 IN (SELECT t1.f1
- FROM t1 LEFT OUTER JOIN (t2 AS b1 JOIN t2 AS b2 ON TRUE) ON TRUE);
-SELECT * FROM t3
-WHERE f2 IN (SELECT t1.f1
- FROM t1 LEFT OUTER JOIN (t2 AS b1 JOIN t2 AS b2 ON TRUE) ON TRUE);
-
-set optimizer_switch='semijoin=on,materialization=on';
-EXPLAIN
-SELECT * FROM t3
-WHERE f2 IN (SELECT t1.f1
- FROM t1 LEFT OUTER JOIN (t2 AS b1 JOIN t2 AS b2 ON TRUE) ON TRUE);
-SELECT * FROM t3
-WHERE f2 IN (SELECT t1.f1
- FROM t1 LEFT OUTER JOIN (t2 AS b1 JOIN t2 AS b2 ON TRUE) ON TRUE);
-
-set optimizer_switch=@save_optimizer_switch;
-
-DROP TABLE t1, t2, t3 ;
-
---echo #
---echo #
---echo # BUG#784723: Wrong result with semijoin + nested subqueries in maria-5.3
---echo #
-CREATE TABLE t1 ( t1field integer, primary key (t1field));
-CREATE TABLE t2 ( t2field integer, primary key (t2field));
-INSERT INTO t1 VALUES (1),(2),(3);
-INSERT INTO t2 VALUES (2),(3),(4);
-explain
-SELECT * FROM t1 A
-WHERE
- A.t1field IN (SELECT A.t1field FROM t2 B) AND
- A.t1field IN (SELECT C.t2field FROM t2 C
- WHERE C.t2field IN (SELECT D.t2field FROM t2 D));
-SELECT * FROM t1 A
-WHERE
- A.t1field IN (SELECT A.t1field FROM t2 B) AND
- A.t1field IN (SELECT C.t2field FROM t2 C
- WHERE C.t2field IN (SELECT D.t2field FROM t2 D));
-drop table t1,t2;
-
---echo #
---echo # BUG#787299: Valgrind complains on a join query with two IN subqueries
---echo #
-create table t1 (a int);
-insert into t1 values (1), (2), (3);
-create table t2 as select * from t1;
-select * from t1 A, t1 B
- where A.a = B.a and A.a in (select a from t2 C) and B.a in (select a from t2 D);
-explain
-select * from t1 A, t1 B
- where A.a = B.a and A.a in (select a from t2 C) and B.a in (select a from t2 D);
-drop table t1, t2;
-
---echo #
---echo # BUG#784441: Abort on semijoin with a view as the inner table
---echo #
-
-CREATE TABLE t1 (a int) ;
-INSERT INTO t1 VALUES (1), (1);
-
-CREATE TABLE t2 (a int) ;
-INSERT INTO t2 VALUES (1), (1);
-
-CREATE VIEW v1 AS SELECT 1;
-
-EXPLAIN
-SELECT * FROM t1 INNER JOIN t2 ON t2.a != 0 AND t2.a IN (SELECT * FROM v1);
-SELECT * FROM t1 INNER JOIN t2 ON t2.a != 0 AND t2.a IN (SELECT * FROM v1);
-
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
---echo #
---echo # BUG#751439 Assertion `!table->file || table->file->inited == handler::NONE' failed with subquery
---echo #
-CREATE TABLE t1 ( f10 int, f11 int) ;
-INSERT IGNORE INTO t1 VALUES (0,0),(0,0);
-
-CREATE TABLE t2 ( f11 int);
-INSERT IGNORE INTO t2 VALUES (0),(0);
-
-CREATE TABLE t3 ( f11 int) ;
-INSERT IGNORE INTO t3 VALUES (0);
-
-SELECT alias1.f11 AS field2
-FROM ( t3 AS alias2 JOIN t1 AS alias3 ON alias3.f10 = 1)
-LEFT JOIN ( t2 AS alias1 ) ON alias3.f11 = 1
-WHERE alias2.f11 IN ( SELECT f11 FROM t2 )
-GROUP BY field2 ;
-
-drop table t1, t2, t3;
-
---echo #
---echo # BUG#778406 Crash in hp_movelink with Aria engine and subqueries
---echo #
-CREATE TABLE t4 (f10 varchar(32) , KEY (f10)) ENGINE=Aria;
-INSERT INTO t4 VALUES ('x'),('m'),('c');
-
-CREATE TABLE t1 (f11 int) ENGINE=Aria;
-INSERT INTO t1 VALUES (0),(0),(0);
-
-CREATE TABLE t2 ( f10 int) ENGINE=Aria;
-INSERT INTO t2 VALUES (0),(0),(0);
-
-CREATE TABLE t3 ( f10 int, f11 int) ENGINE=Aria;
-
-SELECT *
-FROM t4
-WHERE f10 IN
-( SELECT t1.f11
-FROM t1
-LEFT JOIN t2 JOIN t3 ON t3.f10 = t2.f10 ON t3.f11 != 0 );
-
-drop table t1,t2,t3,t4;
-
---echo #
---echo # BUG#751484: Valgrind warning / sporadic crash in evaluate_join_record sql_select.cc:14099 with semijoin
---echo #
-
-CREATE TABLE t1 ( f10 int, f11 int, KEY (f10));
-INSERT IGNORE INTO t1 VALUES (0, 0),(0, 0);
-
-CREATE TABLE t3 ( f10 int);
-INSERT IGNORE INTO t3 VALUES (0);
-
-set @tmp_751484= @@optimizer_switch;
-set optimizer_switch='materialization=on';
-SELECT * FROM t1
-WHERE f11 IN (
- SELECT C_SQ1_alias1.f11
- FROM t1 AS C_SQ1_alias1
- JOIN t3 AS C_SQ1_alias2
- ON C_SQ1_alias2.f10 = C_SQ1_alias1.f10
-);
-set optimizer_switch='materialization=off';
-SELECT * FROM t1
-WHERE f11 IN (
- SELECT C_SQ1_alias1.f11
- FROM t1 AS C_SQ1_alias1
- JOIN t3 AS C_SQ1_alias2
- ON C_SQ1_alias2.f10 = C_SQ1_alias1.f10
-);
-set optimizer_switch=@tmp_751484;
-drop table t1, t3;
-
-#
---echo # BUG#795530 Wrong result with subquery semijoin materialization and outer join
---echo # Simplified testcase that uses DuplicateElimination
---echo #
-create table t1 (a int);
-create table t2 (a int, b char(10));
-
-insert into t1 values (1),(2);
-insert into t2 values (1, 'one'), (3, 'three');
-
-create table t3 (b char(10));
-insert into t3 values('three'),( 'four');
-insert into t3 values('three'),( 'four');
-insert into t3 values('three'),( 'four');
-insert into t3 values('three'),( 'four');
-explain select * from t3 where t3.b in (select t2.b from t1 left join t2 on t1.a=t2.a);
-select * from t3 where t3.b in (select t2.b from t1 left join t2 on t1.a=t2.a);
-drop table t1, t2, t3;
-
---echo #
---echo # BUG#600958 RQG: Crash in optimize_semijoin_nests
---echo #
-CREATE TABLE t1 (
- pk int(11) NOT NULL AUTO_INCREMENT,
- col_int_key int(11) DEFAULT NULL,
- col_date_key date DEFAULT NULL,
- col_varchar_key varchar(1) DEFAULT NULL,
- PRIMARY KEY (pk),
- KEY col_int_key (col_int_key),
- KEY col_date_key (col_date_key),
- KEY col_varchar_key (col_varchar_key,col_int_key)
-) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
-INSERT INTO t1 VALUES (10,8,'2002-02-21',NULL);
-CREATE TABLE t2 (
- pk int(11) NOT NULL AUTO_INCREMENT,
- col_int_key int(11) DEFAULT NULL,
- col_date_key date DEFAULT NULL,
- col_varchar_key varchar(1) DEFAULT NULL,
- PRIMARY KEY (pk),
- KEY col_int_key (col_int_key),
- KEY col_date_key (col_date_key),
- KEY col_varchar_key (col_varchar_key,col_int_key)
-) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
-INSERT INTO t2 VALUES (1,7,'1900-01-01','f');
-
-SELECT col_date_key FROM t1
-WHERE 5 IN (
- SELECT SUBQUERY3_t1 .col_int_key
- FROM t2 SUBQUERY3_t1
- LEFT JOIN t1 SUBQUERY3_t2 ON SUBQUERY3_t1 .col_varchar_key
-);
-drop table t2, t1;
-
-
---echo #
---echo # No BUG#: Duplicate weedout check is not done for outer joins
---echo #
-create table t1 (a int);
-create table t2 (a int);
-
-insert into t1 values (1),(1),(2),(2);
-insert into t2 values (1);
-
-create table t0 (a int);
-insert into t0 values (1),(2);
-
-set @tmp_20110622= @@optimizer_switch;
-set optimizer_switch='firstmatch=off,loosescan=off,materialization=off';
---echo # Check DuplicateWeedout + join buffer
-explain
-select * from t0 where a in (select t1.a from t1 left join t2 on t1.a=t2.a);
-select * from t0 where a in (select t1.a from t1 left join t2 on t1.a=t2.a);
-
---echo # Check DuplicateWeedout without join buffer
-set @tmp_jcl_20110622= @@join_cache_level;
-set join_cache_level= 0;
-explain
-select * from t0 where a in (select t1.a from t1 left join t2 on t1.a=t2.a);
-select * from t0 where a in (select t1.a from t1 left join t2 on t1.a=t2.a);
-
-
---echo # Check FirstMatch without join buffer:
-set optimizer_switch='firstmatch=on';
-explain
-select * from t0 where a in (select t1.a from t1 left join t2 on t1.a=t2.a);
-select * from t0 where a in (select t1.a from t1 left join t2 on t1.a=t2.a);
-
---echo #
---echo # Now, check the same for multiple inner tables:
-alter table t2 add b int;
-update t2 set b=a;
-create table t3 as select * from t2;
-
-set optimizer_switch='firstmatch=off';
-set join_cache_level= 0;
---echo # DuplicateWeedout without join buffer
-explain
-select * from t0
-where a in (select t1.a from t1 left join (t3 join t2 on t3.b=t2.b) on t1.a=t3.a);
-
-select * from t0
-where a in (select t1.a from t1 left join (t3 join t2 on t3.b=t2.b) on t1.a=t3.a);
-
-set @@join_cache_level=@tmp_jcl_20110622;
---echo # DuplicateWeedout + join buffer
-explain
-select * from t0
-where a in (select t1.a from t1 left join (t3 join t2 on t3.b=t2.b) on t1.a=t3.a);
-
-select * from t0
-where a in (select t1.a from t1 left join (t3 join t2 on t3.b=t2.b) on t1.a=t3.a);
-
---echo # Now, let the inner join side have a 'partial' match
-select * from t3;
-insert into t3 values(2,2);
-
-explain
-select * from t0
-where a in (select t1.a from t1 left join (t3 join t2 on t3.b=t2.b) on t1.a=t3.a);
-
-select * from t0
-where a in (select t1.a from t1 left join (t3 join t2 on t3.b=t2.b) on t1.a=t3.a);
-
-set @@optimizer_switch=@tmp_20110622;
-
-drop table t0, t1, t2, t3;
-
---echo #
---echo # BUG#802965: Crash in do_copy_not_null with semijoin=on in maria-5.3
---echo #
-set @save_802965= @@optimizer_switch;
-set optimizer_switch='semijoin=on,materialization=off,firstmatch=off,loosescan=off';
-
-CREATE TABLE t2 ( f1 int NOT NULL , PRIMARY KEY (f1)) ;
-INSERT IGNORE INTO t2 VALUES (19),(20);
-
-CREATE TABLE t1 ( f1 int NOT NULL , PRIMARY KEY (f1)) ;
-INSERT IGNORE INTO t1 VALUES (21),(22),(23),(24);
-
-SELECT *
-FROM t2 , t1
-WHERE t2.f1 IN
-(
- SELECT SQ1_alias1.f1
- FROM t1 AS SQ1_alias1 LEFT JOIN t2 AS SQ1_alias2 JOIN t2 AS SQ1_alias3 ON SQ1_alias3.f1 ON SQ1_alias3.f1
-)
-AND t1.f1 = t2.f1 ;
-
-DROP TABLE t1, t2;
-set optimizer_switch=@save_802965;
-
---echo #
---echo # BUG#803365: Crash in pull_out_semijoin_tables with outer join + semijoin + derived tables in maria-5.3 with WL#106
---echo #
-CREATE TABLE t1 ( f1 int) ;
-INSERT INTO t1 VALUES (1),(1);
-
-CREATE TABLE t2 ( f2 int) ;
-INSERT INTO t2 VALUES (1),(1);
-
-CREATE TABLE t3 ( f3 int) ;
-INSERT INTO t3 VALUES (1),(1);
-
-SELECT *
-FROM t1
-WHERE t1.f1 IN (
- SELECT t2.f2
- FROM t2
- LEFT JOIN (
- SELECT *
- FROM t3
- ) AS alias1
- ON alias1.f3 = t2.f2
-);
-
-DROP TABLE t1,t2,t3;
-
-
---echo #
---echo # BUG#611704: Crash in replace_where_subcondition with nested subquery and semijoin=on
---echo #
-
-CREATE TABLE t1 ( f1 int) ;
-CREATE TABLE t2 ( f1 int) ;
-CREATE TABLE t3 ( f1 int) ;
-
-SELECT * FROM (
- SELECT t3.*
- FROM t2 STRAIGHT_JOIN t3
- ON t3.f1
- AND (t3.f1 ) IN (
- SELECT t1.f1
- FROM t1
- )
-) AS alias1;
-DROP TABLE t1,t2,t3;
-
---echo # BUG#611704: another testcase:
-CREATE TABLE t1 ( f1 int(11), f3 varchar(1), f4 varchar(1)) ;
-CREATE TABLE t2 ( f2 int(11), KEY (f2));
-CREATE TABLE t3 ( f4 varchar(1)) ;
-
-PREPARE st1 FROM '
-SELECT *
-FROM t1
-STRAIGHT_JOIN ( t2 STRAIGHT_JOIN t3 ON t2.f2 )
-ON (t1.f3) IN ( SELECT f4 FROM t1 )
-';
-EXECUTE st1;
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # BUG#803457: Wrong result with semijoin + view + outer join in maria-5.3-subqueries-mwl90
---echo # (Original testcase)
---echo #
-
-CREATE TABLE t1 (f1 int, f2 int );
-INSERT INTO t1 VALUES (2,0),(4,0),(0,NULL);
-
-CREATE TABLE t2 (f2 int, f3 int );
-INSERT INTO t2 VALUES (NULL,NULL),(0,0);
-
-CREATE TABLE t3 ( f1 int, f3 int );
-INSERT INTO t3 VALUES (2,0),(4,0),(0,NULL),(4,0),(8,0);
-
-CREATE TABLE t4 ( f2 int, KEY (f2) );
-INSERT INTO t4 VALUES (0),(NULL);
-
-CREATE VIEW v4 AS SELECT DISTINCT f2 FROM t4 ;
-
---echo # The following must not have outer joins:
-explain extended
-SELECT * FROM t1 NATURAL LEFT JOIN (t2, t3) WHERE t2.f3 IN (SELECT * FROM t4);
-SELECT * FROM t1 NATURAL LEFT JOIN (t2, t3) WHERE t2.f3 IN (SELECT * FROM t4);
-
-drop view v4;
-drop table t1, t2, t3, t4;
-
---echo #
---echo # BUG#803303: Wrong result with semijoin=on, outer join in maria-5.3-subqueries-mwl90
---echo #
-
---echo # Testcase#1:
-set @tmp803303= @@optimizer_switch;
-set optimizer_switch = 'semijoin=on,materialization=off,firstmatch=off,loosescan=off';
-CREATE TABLE t2 ( f1 int) ;
-INSERT IGNORE INTO t2 VALUES (6),(8);
-CREATE TABLE t1 ( f1 int, f2 int, f3 int) ;
-INSERT IGNORE INTO t1 VALUES (8,0,0),(7,0,0),(9,0,0);
-SELECT alias2.f1
-FROM t2 AS alias1
-LEFT JOIN ( t1 AS alias2 JOIN t1 AS alias3 ON alias3.f2 = alias2.f3 )
-ON alias3.f2 = alias2.f2
-WHERE alias2.f1 IN ( SELECT f1 FROM t2 AS alias4 ) ;
-drop table t1,t2;
-set optimizer_switch= @tmp803303;
-
---echo # Testcase #2:
-CREATE TABLE t1 ( f10 int) ;
-INSERT INTO t1 VALUES (0),(0);
-
-CREATE TABLE t2 ( f10 int, f11 varchar(1)) ;
-INSERT INTO t2 VALUES (0,'a'),(0,'b');
-
-CREATE TABLE t3 ( f10 int) ;
-INSERT INTO t3 VALUES (0),(0),(0),(0),(0);
-
-CREATE TABLE t4 ( f10 varchar(1), f11 int) ;
-INSERT INTO t4 VALUES ('a',0),('b',0);
-
-SELECT * FROM t1
-LEFT JOIN ( t2 JOIN t3 ON t3.f10 = t2.f10 ) ON t1.f10 = t2.f10
-WHERE t2.f10 IN (
- SELECT t4.f11
- FROM t4
- WHERE t4.f10 != t2.f11
-);
-
-drop table t1,t2,t3,t4;
-
---echo #
---echo # BUG#803457: Wrong result with semijoin + view + outer join in maria-5.3-subqueries-mwl90
---echo #
-set @tmp803457=@@optimizer_switch;
-set optimizer_switch='materialization=off';
-CREATE TABLE t1 (f1 int, f2 int );
-INSERT INTO t1 VALUES (2,0),(4,0),(0,NULL);
-
-CREATE TABLE t2 (f2 int, f3 int );
-INSERT INTO t2 VALUES (NULL,NULL),(0,0);
-
-CREATE TABLE t3 ( f1 int, f3 int );
-INSERT INTO t3 VALUES (2,0),(4,0),(0,NULL),(4,0),(8,0);
-
-CREATE TABLE t4 ( f2 int);
-INSERT INTO t4 VALUES (0),(NULL);
-
---echo # The following uses Duplicate Weedout, and "End temporary" must not be
---echo # in the middle of the inner side of an outer join:
-explain
-SELECT * FROM t1 NATURAL LEFT JOIN (t2, t3) WHERE IFNULL(t2.f3,'foo') IN (SELECT * FROM t4);
-SELECT * FROM t1 NATURAL LEFT JOIN (t2, t3 ) WHERE IFNULL(t2.f3,'foo') IN (SELECT * FROM t4);
-
-DROP TABLE t1, t2, t3, t4;
-set @tmp803457=@@optimizer_switch;
-
---echo #
---echo # BUG#818280: crash in do_copy_not_null() in maria-5.3 with semijoin
---echo #
-CREATE TABLE t1 ( c1 int NOT NULL , c2 int NOT NULL, PRIMARY KEY (c1)) ;
-INSERT IGNORE INTO t1 VALUES (2,7),(1,3),(5,6);
-
-CREATE TABLE t3 ( c1 int NOT NULL , c2 int NOT NULL, PRIMARY KEY (c1)) ;
-INSERT IGNORE INTO t3 VALUES (2,7),(1,3),(5,6);
-
-CREATE TABLE t2 ( c1 int NOT NULL , c5 int NOT NULL );
-INSERT IGNORE INTO t2 VALUES (2,2),(2,2),(5,6);
-
-SELECT * FROM t1 WHERE c1 IN ( SELECT t3.c1 FROM t3 LEFT JOIN t2 ON t2 .c1 = t3 .c1 WHERE t2.c5 != 0 );
-
-DROP TABLE t1, t2, t3;
-
---echo #
---echo # BUG#834534: Assertion `0' failed in replace_where_subcondition with semijoin subquery in HAVING
---echo #
-CREATE TABLE t1 ( d int );
-INSERT INTO t1 VALUES (2),(2),(0),(2),(2);
-
-CREATE TABLE t2 ( b int );
-INSERT INTO t2 VALUES (4),(3),(3);
-
-CREATE TABLE t3 ( a int );
-
-SELECT *
-FROM t3
-WHERE (t3.a) IN (
- SELECT t1.d
- FROM t1
- HAVING ( 4 ) IN (
- SELECT t2.b
- FROM t2
- )
-);
-drop table t1, t2,t3;
-
---echo #
---echo # BUG#834758: Wrong result with innner join, LooseScan, two-column IN() predicate
---echo #
-
-set @tmp835758=@@optimizer_switch;
-set optimizer_switch='semijoin=on,loosescan=on,materialization=off,firstmatch=off';
-
-CREATE TABLE t1 (b int) ;
-INSERT INTO t1 VALUES (1),(5);
-
-CREATE TABLE t2 (a int, PRIMARY KEY (a)) ;
-INSERT INTO t2 VALUES (6),(10);
-
-CREATE TABLE t3 (a int, b int, KEY (b)) ;
-INSERT INTO t3 VALUES (6,5),(6,2),(8,0),(9,1),(6,5);
-
---echo # This used to incorrectly pick a join order of (t1, LooseScan(t3), t2):
-explain
-SELECT * FROM t1, t2 WHERE (t2.a , t1.b) IN (SELECT a, b FROM t3);
-SELECT * FROM t1, t2 WHERE (t2.a , t1.b) IN (SELECT a, b FROM t3);
-
-DROP TABLE t1, t2, t3;
-set @@optimizer_switch= @tmp835758;
-
---echo #
---echo # BUG#834739: Wrong result with 3-way inner join, LooseScan,multipart keys
---echo #
-set @tmp834739=@@optimizer_switch;
-set optimizer_switch='semijoin=on,loosescan=on,materialization=off,firstmatch=off';
-CREATE TABLE t2 ( b int, c int, KEY (b)) ;
-INSERT INTO t2 VALUES (1,0),(1,0),(9,0),(1,0),(5,0);
-INSERT INTO t2 VALUES (2,0),(3,0),(8,0),(6,0),(5,0);
-
-CREATE TABLE t3 ( a int);
-INSERT INTO t3 VALUES (0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0);
-
-CREATE TABLE t4 ( a int);
-INSERT INTO t4 VALUES (0),(0),(0);
-
-CREATE TABLE t5 ( b int, a int , KEY (a,b)) ;
-INSERT INTO t5 VALUES (7,0),(9,0);
-
-explain
-SELECT * FROM t3 WHERE t3.a IN (SELECT t5.a FROM t2, t4, t5 WHERE t2.c = t5.a AND t2.b = t5.b);
-SELECT * FROM t3 WHERE t3.a IN (SELECT t5.a FROM t2, t4, t5 WHERE t2.c = t5.a AND t2.b = t5.b);
-
-DROP TABLE t2, t3, t4, t5;
-set @@optimizer_switch=@tmp834739;
-
---echo #
---echo # BUG#830993: Crash in end_read_record with derived table
---echo #
-set @tmp_830993=@@optimizer_switch;
-set optimizer_switch='semijoin=on,loosescan=off,materialization=off,firstmatch=off';
-set @tmp_830993_jbs= @@join_buffer_size;
---disable_warnings
-set join_buffer_size=160;
---enable_warnings
-CREATE TABLE t1 (
- a int(11) NOT NULL AUTO_INCREMENT,
- b int(11) DEFAULT NULL,
- c int(11) DEFAULT NULL,
- d time DEFAULT NULL,
- e varchar(1) DEFAULT NULL,
- f varchar(1) DEFAULT NULL,
- PRIMARY KEY (a),
- KEY c (c),
- KEY d (d),
- KEY e (e,c)
-);
-INSERT INTO t1 VALUES (10,NULL,8,'22:55:23','x','x'),
- (11,8,7,'10:19:31','d','d'),(12,1,1,'14:40:36','r','r'),
- (13,9,7,'04:37:47','f','f'),(14,4,9,'19:34:06','y','y'),
- (15,3,NULL,'20:35:33','u','u'),(16,2,1,NULL,'m','m'),
- (17,NULL,9,'14:43:37',NULL,NULL),(18,2,2,'02:23:09','o','o'),
- (19,NULL,9,'01:22:45','w','w'),(20,6,2,'00:00:00','m','m'),
- (21,7,4,'00:13:25','q','q'),(22,2,0,'03:47:16',NULL,NULL),
- (23,5,4,'01:41:48','d','d'),(24,7,8,'00:00:00','g','g'),
- (25,6,NULL,'22:32:04','x','x'),(26,6,NULL,'16:44:14','f','f'),
- (27,2,0,'17:38:37','p','p'),(28,9,NULL,'08:46:48','j','j'),
- (29,6,8,'14:11:27','c','c');
-
-CREATE TABLE t2 like t1;
-INSERT INTO t2 VALUES (1,2,4,'22:34:09','v','v'),
- (2,150,62,'14:26:02','v','v'),(3,NULL,7,'14:03:03','c','c'),
- (4,2,1,'01:46:09',NULL,NULL),(5,5,0,'16:21:18','x','x'),
- (6,3,7,'18:56:33','i','i'),(7,1,7,NULL,'e','e'),
- (8,4,1,'09:29:08','p','p'),(9,NULL,7,'19:11:10','s','s'),
- (10,2,1,'11:57:26','j','j'),(11,6,5,'00:39:46','z','z'),
- (12,6,2,'03:28:15','c','c'),(13,8,0,'06:44:18','a','a'),
- (14,2,1,'14:36:39','q','q'),(15,6,8,'18:42:45','y','y'),
- (16,8,1,'02:57:29',NULL,NULL),(17,3,1,'16:46:13','r','r'),
- (18,3,9,'19:39:02','v','v'),(19,9,1,NULL,NULL,NULL),
- (20,6,5,'20:58:33','r','r');
-
-set @tmp_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='derived_merge=off,derived_with_keys=off';
-
-explain
-SELECT
- alias1.a, alias1.b, alias1.c, alias1.d, alias1.e, alias1.f,
- alias2.a as a2_a, alias2.b as a2_b, alias2.c as a2_c, alias2.d as a2_d,
- alias2.e as a2_e, alias2.f as a2_f,
- t2.a as t2_a, t2.b as t2_b, t2.c as t2_c, t2.d as t2_d, t2.e as t2_e, t2.f as t2_f
-FROM
- (SELECT * FROM t2) AS alias1,
- t1 AS alias2,
- t2
-WHERE
- alias1.c IN (SELECT SQ3_alias1.b
- FROM t2 AS SQ3_alias1 STRAIGHT_JOIN t2 AS SQ3_alias2)
-LIMIT 100;
-
-create table t3 as
-SELECT
- alias1.a, alias1.b, alias1.c, alias1.d, alias1.e, alias1.f,
- alias2.a as a2_a, alias2.b as a2_b, alias2.c as a2_c, alias2.d as a2_d,
- alias2.e as a2_e, alias2.f as a2_f,
- t2.a as t2_a, t2.b as t2_b, t2.c as t2_c, t2.d as t2_d, t2.e as t2_e, t2.f as t2_f
-FROM
- (SELECT * FROM t2) AS alias1,
- t1 AS alias2,
- t2
-WHERE
- alias1.c IN (SELECT SQ3_alias1.b
- FROM t2 AS SQ3_alias1 STRAIGHT_JOIN t2 AS SQ3_alias2)
-LIMIT 100;
-
-set optimizer_switch=@tmp_optimizer_switch;
-
-drop table t1,t2, t3;
-set optimizer_switch=@tmp_830993;
-set join_buffer_size= @tmp_830993_jbs;
-
---echo #
---echo # BUG##849717: Crash in Item_func::fix_fields on second execution of a prepared statement with semijoin
---echo #
-CREATE TABLE t1 (a int);
-CREATE TABLE t2 (a int);
-CREATE TABLE t3 (a int, b int) ;
-
-PREPARE st1 FROM "SELECT * FROM t2 LEFT JOIN t1 ON t2.a != 0 AND ('j','r') IN ( SELECT b,a FROM t3)";
-EXECUTE st1;
-EXECUTE st1;
-
-DROP TABLE t1, t2, t3;
-
---echo #
---echo # BUG#849776: Wrong result with semijoin + "Impossible where"
---echo #
-CREATE TABLE t1 ( b varchar(1), a integer) ;
-INSERT INTO t1 VALUES ('z',8);
-
-CREATE TABLE t2 ( a integer, b varchar(1)) ;
-
-CREATE TABLE t4 ( a integer, b varchar(1)) ;
-
-CREATE TABLE t5 ( a integer) ;
-INSERT INTO t5 VALUES (8);
-
-select * from t5 where (a) in (
- SELECT t1.a
- FROM t1 LEFT JOIN t2 ON t1.a = t2.a
- WHERE t2.b NOT IN (SELECT t4.b FROM t4 WHERE t4.b < t1.b)
-);
-
-DROP TABLE t1, t2, t4, t5;
-
---echo #
---echo # BUG#861147: Assertion `fixed == 1' failed in Item_func_eq::val_int() with semijoin + materialization + max_join_size
---echo #
-#CREATE TABLE t1 ( f2 int) ;
-#CREATE TABLE t2 ( f1 int, f3 int, f4 varchar(3), f5 varchar(35)) ;
-#INSERT INTO t2 VALUES (4057,9,'USA','Visalia'),(3993,11,'USA','Waco'),
-# (3948,14,'USA','Warren'),(3813,57,'USA','Washington'),
-# (4010,11,'USA','Waterbury'),(4017,11,'USA','West Covina'),
-# (4004,11,'USA','West Valley City'),(4033,10,'USA','Westminster'),
-# (3842,34,'USA','Wichita'),(4018,10,'USA','Wichita Falls'),
-# (3899,19,'USA','Winston-Salem'),(3914,17,'USA','Worcester'),
-# (3888,20,'USA','Yonkers');
-
-#CREATE TABLE t3 ( f3 int, f4 varchar(3)) ;
-#INSERT INTO t3 VALUES (86,'USA');
-
-#CREATE TABLE t4 ( f3 int, f4 varchar(3), f5 varchar(52)) ;
-#INSERT INTO t4 VALUES (0,'RUS','Belorussian'),(0,'USA','Portuguese');
-
-#CREATE TABLE t5 ( f2 int) ;
-
-#CREATE TABLE t6 ( f4 varchar(3));
-#INSERT INTO t6 VALUES ('RUS'),('USA');
-
-create table t1 (a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-set @tmp_mjs_861147= @@max_join_size;
-SET max_join_size=10;
-set @tmp_os_861147= @@optimizer_switch;
-set @@optimizer_switch='semijoin=on,materialization=on';
-
---error ER_TOO_BIG_SELECT
-explain
-select * from t1 where a in (select max(A.a + B.a + C.a) from t1 A, t1 B, t1 C);
-
-set max_join_size= @tmp_mjs_861147;
-set optimizer_switch= @tmp_os_861147;
-
-#DROP TABLE t1,t2,t3,t4,t5,t6;
-drop table t1;
-
---echo #
---echo # BUG#877288: Wrong result with semijoin + materialization + multipart key
---echo #
-set @tmp_877288=@@optimizer_switch;
-set optimizer_switch='semijoin=ON,materialization=ON';
-CREATE TABLE t1 ( a int) ;
-INSERT INTO t1 VALUES (19),(19),(19),(20),(20),(20),(20),(20),(20);
-
-CREATE TABLE t2 ( b int NOT NULL , c int NOT NULL , KEY (b,c)) ;
-INSERT INTO t2 VALUES (14,1),(15,1),(16,1),(17,1),(18,1),(19,1),(20,1);
-
-CREATE TABLE t3 ( a int, d int) ;
-INSERT INTO t3 VALUES (19,1),(7,1),(3,1),(3,1),(20,1),(3,1),(16,1),(17,1),(9,1),(4,1),(6,1),(15,1),(17,1);
-
-explain
-SELECT * FROM t1 WHERE (a) IN (SELECT a FROM t2 JOIN t3 ON b = a);
-SELECT * FROM t1 WHERE (a) IN (SELECT a FROM t2 JOIN t3 ON b = a);
-DROP TABLE t1,t2,t3;
-set optimizer_switch=@tmp_877288;
-
---echo #
---echo # BUG#878753: Assertion '0' failed in replace_where_subcondition with derived_merge
---echo #
-set @tmp878753= @@optimizer_switch;
-set optimizer_switch= 'semijoin=on,derived_merge=on';
-CREATE TABLE t1 (b int(11)) ;
-CREATE TABLE t2 (c int, b int, d varchar(52) NOT NULL) ;
-CREATE TABLE t3 (b int(11)) ;
-
-PREPARE st1 FROM '
- SELECT * FROM t1
- JOIN (
- SELECT t2.* FROM t2
- WHERE t2.d <> "a"
- AND t2.c IN (
- SELECT t3.b
- FROM t3
- )
- ) AS alias2
- ON ( alias2.b = t1.b );
-';
-EXECUTE st1;
-DROP TABLE t1,t2,t3;
-set optimizer_switch=@tmp878753;
-
---echo #
---echo # Bug #889750: semijoin=on + firstmatch=off + semijoin_with_cache=off
---echo #
-
-create table t1 (a int);
-insert into t1 values (7), (1), (5), (3);
-create table t2 (a int);
-insert into t2 values (4), (1), (8), (3), (9), (2);
-
-set @tmp_otimizer_switch= @@optimizer_switch;
-set optimizer_switch='semijoin=on';
-set optimizer_switch='firstmatch=off';
-
-set optimizer_switch='semijoin_with_cache=on';
-explain
-select * from t1 where t1.a in (select t2.a from t2);
-select * from t1 where t1.a in (select t2.a from t2);
-
-set optimizer_switch='semijoin_with_cache=off';
-explain
-select * from t1 where t1.a in (select t2.a from t2);
-select * from t1 where t1.a in (select t2.a from t2);
-
-set optimizer_switch= @tmp_otimizer_switch;
-
-drop table t1,t2;
-
---echo #
---echo # Bug #887496: semijoin with IN equality for the second part of an index
---echo #
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (9), (0), (8), (5);
-
-CREATE TABLE t2 (a int, b varchar(1), INDEX idx (b,a));
-INSERT INTO t2 VALUES (5,'r'), (5,'z');
-
-CREATE TABLE t3 (a int, b varchar(1), INDEX idx (b,a));
-INSERT INTO t3 VALUES (5,'r'), (5,'z');
-
-set @tmp_otimizer_switch= @@optimizer_switch;
-SET SESSION optimizer_switch='semijoin=on,firstmatch=on';
-
-SET SESSION optimizer_switch='loosescan=off';
-EXPLAIN
-SELECT * FROM t1 WHERE a IN (SELECT t2.a FROM t2,t3 WHERE t2.b = t3.b);
-SELECT * FROM t1 WHERE a IN (SELECT t2.a FROM t2,t3 WHERE t2.b = t3.b);
-
-SET SESSION optimizer_switch='loosescan=on';
-EXPLAIN
-SELECT * FROM t1 WHERE a IN (SELECT t2.a FROM t2,t3 WHERE t2.b = t3.b);
-SELECT * FROM t1 WHERE a IN (SELECT t2.a FROM t2,t3 WHERE t2.b = t3.b);
-
-set optimizer_switch= @tmp_otimizer_switch;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # Bug #901312: materialized semijoin + right join
---echo #
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (4), (1);
-CREATE TABLE t2 (b int);
-INSERT INTO t2 VALUES (4), (1);
-CREATE TABLE t3 (c int);
-INSERT INTO t3 VALUES (4), (1);
-
-set @tmp_otimizer_switch= @@optimizer_switch;
-SET SESSION optimizer_switch='semijoin=on,materialization=on';
-
-EXPLAIN
-SELECT * FROM t1 RIGHT JOIN t2 ON b = a WHERE t2.b IN (SELECT c FROM t3);
-SELECT * FROM t1 RIGHT JOIN t2 ON b = a WHERE t2.b IN (SELECT c FROM t3);
-
-set optimizer_switch= @tmp_otimizer_switch;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # Bug #901709: assertion failure with record count == 0
---echo #
-
-CREATE TABLE t1 (a int, KEY (a));
-INSERT INTO t1 VALUES (4), (6);
-CREATE TABLE t2 (a int, KEY (a));
-INSERT INTO t2 VALUES (4), (6);
-CREATE TABLE t3 (b int);
-INSERT INTO t3 VALUES (4);
-CREATE TABLE t4 (c int);
-
-SET @tmp_optimizer_switch=@@optimizer_switch;
-SET @@optimizer_switch='semijoin=on';
-SET @@optimizer_switch='materialization=on';
-SET @@optimizer_switch='firstmatch=on';
-SET optimizer_switch='semijoin_with_cache=on';
-SET optimizer_prune_level=0;
-
-EXPLAIN
-SELECT * FROM t1, t2
- WHERE t1.a = t2.a AND t2.a IN (SELECT b FROM t3 STRAIGHT_JOIN t4);
-SELECT * FROM t1, t2
- WHERE t1.a = t2.a AND t2.a IN (SELECT b FROM t3 STRAIGHT_JOIN t4);
-
-SET optimizer_prune_level=DEFAULT;
-SET optimizer_switch=@tmp_optimizer_switch;
-
-DROP TABLE t1,t2,t3,t4;
-
---echo #
---echo # BUG#901399: Wrong result (extra row) with semijoin=ON, materialization=OFF, optimizer_prune_level=0
---echo #
-set @opl_901399= @@optimizer_prune_level;
-set @os_091399= @@optimizer_switch;
-SET optimizer_prune_level=0;
-SET optimizer_switch = 'materialization=off';
-
-CREATE TABLE t1 ( c INT ) ENGINE=MyISAM;
-INSERT INTO t1 VALUES
- (0),(1),(2),(3),(4),(5),
- (6),(7),(8),(9),(10),(11),(12);
-CREATE TABLE t2 ( a INT, b INT, KEY(a)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (3,20),(2,21),(3,22);
-
-SELECT *
-FROM t1 AS alias1, t1 AS alias2
-WHERE ( alias1.c, alias2.c )
- IN (
- SELECT alias3.a, alias3.a
- FROM t2 AS alias3, t2 alias4
- WHERE alias3.b = alias4.b
- );
-set optimizer_prune_level= @opl_901399;
-set optimizer_switch= @os_091399;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # BUG#912510: Crash in do_copy_not_null with semijoin=ON, firstmatch=ON, aggregate ...
---echo #
-CREATE TABLE t1 ( a VARCHAR(1) NOT NULL );
-INSERT INTO t1 VALUES ('k'),('l');
-
-CREATE TABLE t2 ( b VARCHAR(1) NOT NULL, KEY(b) );
-INSERT INTO t2 VALUES ('k'),('l');
-
-CREATE TABLE t3 ( c VARCHAR(1) NOT NULL, KEY(c) );
-INSERT INTO t3 VALUES ('m'),('n');
-
-SELECT a, COUNT(*) FROM t1
- WHERE a IN (
- SELECT b FROM t2 force index(b), t3 force index(c)
- WHERE c = b AND b = a
- );
-
-DROP TABLE t1, t2, t3;
-
---echo #
---echo # BUG#920255: Wrong result (extra rows) with loosescan and IN subquery
---echo #
-CREATE TABLE t1 ( a INT PRIMARY KEY, b INT, KEY(b) );
-INSERT INTO t1 VALUES
- (1,2),(2,1),(3,3),(4,2),(5,5),
- (6,3),(7,1),(8,4),(9,3),(10,2);
-
-CREATE TABLE t2 ( c INT, d INT, UNIQUE KEY(c) );
-INSERT INTO t2 VALUES
- (1,2),(2,1),(3,3),(4,2),(5,5),(6,3),(7,1);
-
-SELECT a, b, d FROM t1, t2
-WHERE ( b, d ) IN
- ( SELECT b, d FROM t1, t2 WHERE b = c );
-
-DROP TABLE t1, t2;
-
---echo #
---echo # BUG#920713: Wrong result (missing rows) with firstmatch+BNL, IN subquery, ...
---echo #
-# t1 should be MyISAM or InnoDB
-CREATE TABLE t1 ( a VARCHAR(1) ) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('e'),('w'),('a'),('h'),('x'),('k'),('g');
-CREATE TABLE t2 ( b INT, c VARCHAR(1) );
-INSERT INTO t2 VALUES (0,'j'),(8,'v');
-
-#SET debug_optimizer_prefer_join_prefix= 'alias2,alias4,alias1,alias3';
-
-SELECT * FROM t1 alias1, t2 alias2
-WHERE alias2.c IN (
- SELECT alias4.c FROM t1 alias3, t2 alias4
-);
-
-DROP TABLE t1, t2;
-
---echo #
---echo # BUG#923246: Loosescan reports different result than other semijoin methods
---echo #
-set @tmp_923246= @@optimizer_switch;
-set optimizer_switch='mrr=on,materialization=off';
-
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1 (kp1 int, kp2 int, c int, filler char(100), key(kp1, kp2));
-insert into t1 select A.a+10*(B.a+10*C.a), 0, 0, 'filler' from t0 A, t0 B, t0 C;
-insert into t1 select * from t1 where kp1 < 20;
-
-create table t3 (a int);
-insert into t3 select A.a + 10*B.a from t0 A, t0 B;
-
-select * from t3 where a in (select kp1 from t1 where kp1<20);
-explain select * from t3 where a in (select kp1 from t1 where kp1<20);
-
-drop table t0,t1,t3;
-set optimizer_switch= @tmp_923246;
-
---echo #
---echo # BUG#952583: Server crashes in Item_field::fix_after_pullout on INSERT .. SELECT
---echo #
-CREATE TABLE t1 ( a INT );
-INSERT INTO t1 VALUES (1),(2);
-CREATE TABLE t2 ( b INT );
-INSERT INTO t2 VALUES (3),(4);
-
-INSERT INTO t1
-SELECT * FROM ( SELECT * FROM t1 ) AS alias
-WHERE a IN ( SELECT b FROM t2 );
-
-DROP TABLE t1, t2;
-
---echo #
---echo # BUG#952372: Server crashes on 2nd execution of PS in find_field_in_tables with semijoin+materialization
---echo #
-CREATE TABLE t1 ( a INT );
-INSERT INTO t1 VALUES (2),(3);
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-CREATE TABLE t2 ( b VARCHAR(1) );
-INSERT INTO t2 VALUES ('v'),('v');
-
-PREPARE pstmt FROM
- 'SELECT DISTINCT a FROM v1, t2
- WHERE b IN ( SELECT MIN(b) FROM t2 )';
-
-EXECUTE pstmt;
-EXECUTE pstmt;
-
-DEALLOCATE PREPARE pstmt;
-DROP VIEW v1;
-DROP TABLE t1, t2;
-
---echo #
---echo # BUG#978479: Wrong result (extra rows) with derived_with_keys+loosescan+semijoin=ON, materialization=OFF
---echo #
-
-set @tmp_jcl_978479= @@join_cache_level;
-set join_cache_level=0;
-
-set @tmp_os_978479= @@optimizer_switch;
-set optimizer_switch = 'derived_with_keys=on,loosescan=on,semijoin=on,materialization=off';
-
---echo # Part#1: make sure EXPLAIN is using LooseScan:
-CREATE TABLE t1 ( a INT, b INT );
-INSERT INTO t1 VALUES
- (4,0),(6,8),(3,1),(5,8),(3,9),(2,4),
- (2,6),(9,1),(5,4),(7,7),(5,4);
-
-CREATE ALGORITHM=TEMPTABLE
- VIEW v1 AS SELECT * FROM t1;
-
---echo # This will use LooseScan:
-EXPLAIN
-SELECT * FROM t1 AS t1_1, t1 AS t1_2
- WHERE (t1_1.a, t1_2.a) IN ( SELECT a, b FROM v1 );
-
-SELECT * FROM t1 AS t1_1, t1 AS t1_2
- WHERE (t1_1.a, t1_2.a) IN ( SELECT a, b FROM v1 );
-
-DROP VIEW v1;
-DROP TABLE t1;
-set @@join_cache_level= @tmp_jcl_978479;
-set @@optimizer_switch= @tmp_os_978479;
-
---echo #
---echo # BUG#998236: Assertion failure or valgrind errors at best_access_path ...
---echo #
-CREATE TABLE t1 (a1 VARCHAR(3), a2 VARCHAR(35), KEY(a1,a2)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES
-('USA','Arvada'),('USA','Athens'),('USA','Atlanta'),('USA','Augusta'),
-('USA','Aurora'),('USA','Aurora'),('USA','Austin'),('USA','Bakersfield'),
-('USA','Baltimore'),('USA','Baton'),('USA','Beaumont'),('USA','Bellevue'),
-('USA','Berkeley'),('USA','Billings'),('USA','Birmingham'),('USA','Boise'),
-('USA','Boston'),('USA','Boulder'),('USA','Bridgeport'),('USA','Brockton'),
-('USA','Brownsville'),('USA','Buffalo'),('USA','Burbank'),('USA','Cambridge'),
-('USA','Cape'),('USA','Carrollton'),('USA','Carson'),('USA','Cary'),
-('USA','Cedar'),('USA','Chandler'),('USA','Charleston'),('USA','Charlotte'),
-('USA','Chattanooga'),('USA','Chesapeake'),('USA','Chicago'),('USA','Chula'),
-('USA','Cincinnati'),('USA','Citrus'),('USA','Clarksville'),('USA','Clearwater'),
-('USA','Cleveland'),('USA','Colorado'),('USA','Columbia'),('USA','Columbus'),
-('USA','Columbus'),('USA','Compton'),('USA','Concord'),('USA','Coral'),
-('USA','Corona'),('USA','Corpus'),('USA','Costa'),('USA','Dallas'),('USA','Daly'),
-('USA','Davenport'),('USA','Dayton'),('USA','Denver'),('USA','DesMoines'),
-('USA','Detroit'),('USA','Downey'),('USA','Durham'),('USA','East'),('USA','ElCajon'),
-('USA','ElMonte'),('USA','ElPaso'),('USA','Elgin'),('USA','Elizabeth'),
-('USA','Erie'),('USA','Escondido'),('USA','Eugene'),('USA','Evansville'),
-('USA','Fairfield'),('USA','Fall'),('USA','Fayetteville'),('USA','Flint'),
-('USA','Fontana'),('USA','FortCollins'),('USA','FortLauderdale'),('USA','FortWayne'),
-('USA','FortWorth'),('USA','Fremont'),('USA','Fresno'),('USA','Fullerton'),
-('USA','Gainesville'),('USA','GardenGrove'),('USA','Garland'),('USA','Gary'),
-('USA','Gilbert'),('USA','Glendale'),('USA','Glendale'),('USA','GrandPrairie'),
-('USA','GrandRapids'),('USA','Green Bay'),('USA','Greensboro'),('USA','Hampton'),
-('USA','Hartford'),('USA','Hayward'),('USA','Henderson'),('USA','Hialeah'),
-('USA','Inglewood'),('USA','Livonia');
-
-CREATE TABLE t3 (c1 VARCHAR(3), c2 VARCHAR(16), PRIMARY KEY (c1,c2)) ENGINE=MyISAM;
-INSERT INTO t3 VALUES ('USA','Chinese'), ('USA','English');
-
-# Not reproducible with 2 rows
-CREATE TABLE t2 (b1 INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (1);
-
-SELECT alias1.a1 AS field1
-FROM t1 AS alias1, t1 AS alias2
-WHERE alias1.a2 IN ( SELECT a1 FROM t1, t2 )
-AND alias1.a1 IS NULL
-AND ( alias1.a1, alias2.a1 ) IN ( SELECT c1, c1 FROM t3 )
-GROUP BY field1;
-
-DROP TABLE t1,t3,t2;
-
---echo #
---echo # BUG#1002630: Valgrind warnings 'Invalid read' in subselect_engine::calc_const_tables with SELECT
---echo #
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1),(7);
-
-CREATE TABLE t2 (b INT);
-INSERT INTO t2 VALUES (4),(6);
-
-SELECT ( SELECT SUM(a) FROM t1 ) AS t1sum, b
-FROM t2
-WHERE (1,1) IN ( SELECT MAX(a), MIN(a) FROM t1 )
-GROUP BY b
-HAVING t1sum <> 1;
-
-DROP TABLE t1, t2;
-
---echo #
---echo # MDEV-3911: Assertion `fixed == 0' failed in Item_field::fix_fields
---echo # on 2nd execution of PS with semijoin=on and IN subquery
---echo #
-
-CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (0,4),(8,6);
-
-CREATE TABLE t2 (c INT, d INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (7,1),(0,7);
-
-eval PREPARE stmt FROM ' SELECT * FROM t1 WHERE ( a, b ) IN ( SELECT c, d FROM t2 ) ';
-
-execute stmt;
-execute stmt;
-
-deallocate prepare stmt;
-drop table t1,t2;
-
---echo #
---echo # MDEV-4335: Unexpected results when selecting on information_schema
---echo #
-CREATE TABLE t1 (db VARCHAR(64) DEFAULT NULL);
-INSERT INTO t1 VALUES ('mysql'),('information_schema');
---sorted_result
-SELECT * FROM t1 WHERE db IN (SELECT `SCHEMA_NAME` FROM information_schema.SCHEMATA);
-DROP TABLE t1;
-
---echo #
---echo # MDEV-5581: Server crashes in in JOIN::prepare on 2nd execution of PS with materialization+semijoin
---echo #
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (2),(3);
-
-CREATE TABLE t2 (b INT);
-INSERT INTO t2 VALUES (8),(9);
-
-CREATE TABLE t3 (c INT, INDEX(c));
-INSERT INTO t2 VALUES (5),(6);
-
-PREPARE stmt FROM
-"SELECT * FROM t1 WHERE ( 9, 5 ) IN ( SELECT b, COUNT(*) FROM t2 WHERE 1 IN ( SELECT MIN(c) FROM t3 ) )";
-EXECUTE stmt;
-EXECUTE stmt;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # MySQL Bug#13340270: assertion table->sort.record_pointers == __null
---echo #
-
-CREATE TABLE t1 (
- pk int NOT NULL,
- col_int_key int DEFAULT NULL,
- col_varchar_key varchar(1) DEFAULT NULL,
- col_varchar_nokey varchar(1) DEFAULT NULL,
- PRIMARY KEY (pk),
- KEY col_int_key (col_int_key),
- KEY col_varchar_key (col_varchar_key, col_int_key)
-);
-
-INSERT INTO t1 VALUES
-(10,8,'x','x'),
-(11,7,'d','d'),
-(12,1,'r','r'),
-(13,7,'f','f'),
-(14,9,'y','y'),
-(15,NULL,'u','u'),
-(16,1,'m','m'),
-(17,9,NULL,NULL),
-(18,2,'o','o'),
-(19,9,'w','w'),
-(20,2,'m','m'),
-(21,4,'q','q');
-
-let $query=
- SELECT alias1.col_varchar_nokey AS field1
- FROM t1 AS alias1 JOIN t1 AS alias2
- ON alias2.col_int_key = alias1.pk OR
- alias2.col_int_key = alias1.col_int_key
- WHERE alias1.pk = 58 OR alias1.col_varchar_key = 'o'
-;
-
-eval CREATE TABLE t2
- $query
-;
-
-eval EXPLAIN SELECT *
-FROM t2
-WHERE (field1) IN ($query);
-
-eval SELECT *
-FROM t2
-WHERE (field1) IN ($query);
-
-DROP TABLE t1, t2;
-
---echo #
---echo # MDEV-389: Wrong result (missing row) with semijoin, join_cache_level>4, LEFT JOIN...
---echo # (testcase only)
---echo #
-
-# Use another connection to get rid of this test's settings
-connect (con1,localhost,root,,);
-connection con1;
-
-SET join_cache_level = 5;
-SET optimizer_switch = 'semijoin=on';
-
-CREATE TABLE t1 (a INT NOT NULL, b CHAR(1), KEY(a)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (4,'p'),(1,'q'),(8,'e');
-
-CREATE TABLE t2 (c INT, d CHAR(1), KEY(c), KEY(d)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (4,'f'),(2,'i'),(5,'h'),(3,'q'),(1,'g');
-
-SELECT a, COUNT(*) AS cnt
-FROM t1 LEFT JOIN t2 ON (d = b)
-WHERE a IN ( SELECT c FROM t2 WHERE b > 'k' )
-GROUP BY a ORDER BY a, cnt LIMIT 2;
-
-drop table t1, t2;
-connection default;
-disconnect con1;
-
---echo #
---echo # MDEV-4071: Valgrind warnings 'Invalid read' in subselect_engine::calc_const_tables with ...
---echo #
-CREATE TABLE t1 (b INT, c VARCHAR(1)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (7,'v'),(0,'s');
-
-CREATE TABLE t2 (a INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (0),(8);
-
-SELECT c, SUM( DISTINCT b ) AS sm FROM t1
-WHERE ( 5, 108 ) IN ( SELECT MIN(a), MAX(a) FROM t2 )
-GROUP BY b
-HAVING c <> ( SELECT MAX( c ) FROM t1 )
-ORDER BY sm;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # mdev-4173 ignored duplicate value when converting heap to temp table
---echo # could lead to extra rows in semijoin queries or missing row in union queries
---echo #
-CREATE TABLE t1 (i1 INT) engine=myisam;
-INSERT INTO t1 VALUES
-(4),(8),(0),(0),(0),(7),(7),(5),(3),(4),(9),(6),(1),(5),(6),(2),(4),(4);
-
-CREATE TABLE t2 (i2 INT, j2 INT) engine=myisam;
-INSERT INTO t2 VALUES
-(7,1),(0,7),(9,4),(3,7),(4,0),(2,2),(5,9),(3,4),
-(1,0),(3,9),(5,8),(1,8),(204,18),(224,84),(9,6);
-
-CREATE TABLE t3 (i3 INT, KEY(i3)) engine=myisam;
-INSERT INTO t3 VALUES
-(0),(8),(1),(8),(9),(24),(6),(1),(6),(2),(4),(2),(1);
-
-select @@max_heap_table_size into @tmp_max_heap_table_size;
-select @@join_buffer_size into @tmp_join_buffer_size;
-set max_heap_table_size=16*1024;
-
---disable_query_log
-let $n = 8;
-while ($n) {
- eval set join_buffer_size= 128 + 128*$n;
- SELECT COUNT(*) FROM t1 outer_t1, t2 outer_t2, t3
- WHERE outer_t1.i1 IN (
- SELECT j2 FROM t2 LEFT JOIN t3 ON ( i3 = j2 )
- WHERE i2 <> outer_t2.j2
- );
- dec $n;
-}
---enable_query_log
-
-DROP TABLE t1, t2, t3;
-set join_buffer_size = @tmp_join_buffer_size;
-set max_heap_table_size = @tmp_max_heap_table_size;
-
---echo #
---echo # MDEV-5161: Wrong result (missing rows) with semijoin, LEFT JOIN, ORDER BY, constant table
---echo #
-CREATE TABLE t1 (pk INT PRIMARY KEY, c1 VARCHAR(1)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,'v'),(2,'v'),(3,'c'),(4,NULL),(5,'x');
-
-CREATE TABLE t2 (c2 VARCHAR(1)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES ('x');
-
-CREATE TABLE t3 (c3 VARCHAR(1)) ENGINE=MyISAM;
-INSERT INTO t3 VALUES ('x'),('d');
-
---sorted_result
-SELECT * FROM t1, t2 WHERE pk IN ( SELECT pk FROM t1 LEFT JOIN t3 ON (c1 = c3 ) ) ORDER BY c2, c1;
-
---echo # This should show that "t1 left join t3" is still in the semi-join nest:
-EXPLAIN EXTENDED
-SELECT * FROM t1, t2 WHERE pk IN ( SELECT pk FROM t1 LEFT JOIN t3 ON (c1 = c3 ) ) ORDER BY c2, c1;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # MDEV-5059: Wrong result (missing row) wih semijoin, join_cache_level > 2, LEFT JOIN, ORDER BY
---echo #
-
-SET @tmp_mdev5059=@@join_cache_level;
-# Any value > 2 will do
-SET join_cache_level = 3;
-set @tmp_os_mdev5059= @@optimizer_switch;
-set optimizer_switch=default;
-CREATE TABLE t1 (pk1 INT PRIMARY KEY, i1 INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,4),(2,5);
-
-CREATE TABLE t2 (i2 INT, c2 CHAR(1)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (1,'v'),(7,'s');
-
-CREATE TABLE t3 (pk3 INT PRIMARY KEY, i3 INT, c3 CHAR(1), INDEX(i3), INDEX(c3,i3)) ENGINE=MyISAM;
-INSERT INTO t3 VALUES (1,7,'g'),(2,4,'p'),(3,1,'q');
-
-CREATE TABLE t4 (i4 INT) ENGINE=MyISAM;
-INSERT INTO t4 VALUES (1);
-
-SELECT * FROM t1, t2 LEFT JOIN t3 ON (c3 = c2)
-WHERE ( i2, pk1 ) IN ( SELECT i3, 1 FROM t3, t4 ) ORDER BY i1, c2;
-
-SET join_cache_level=@tmp_mdev5059;
-set optimizer_switch=@tmp_os_mdev5059;
-DROP TABLE t1,t2,t3,t4;
-
---echo #
---echo # MDEV-7911: crash in Item_cond::eval_not_null_tables
---echo #
-
-create table t1(a int);
-insert into t1 values(1),(2),(3),(null);
---error ER_CANT_AGGREGATE_2COLLATIONS
-explain
-select 1 from t1 where _cp932 "1" in (select '1' from t1);
-drop table t1;
-
---echo #
---echo # MDEV-7823: Server crashes in next_depth_first_tab on nested IN clauses with SQ inside
---echo #
-set @tmp_mdev7823=@@optimizer_switch;
-set optimizer_switch=default;
-CREATE TABLE t1 (f1 INT);
-INSERT INTO t1 VALUES (1);
-
-CREATE TABLE t2 (f2 INT, KEY(f2));
-INSERT INTO t2 VALUES (8),(0);
-
-CREATE TABLE t3 (f3 INT);
-INSERT INTO t3 VALUES (1),(2);
-
-CREATE TABLE t4 (f4 INT);
-INSERT INTO t4 VALUES (0),(5);
-
-explain
-SELECT * FROM t1, t2, t3 WHERE f2 IN ( f1 IN ( SELECT f4 FROM t4 ) );
-SELECT * FROM t1, t2, t3 WHERE f2 IN ( f1 IN ( SELECT f4 FROM t4 ) );
-
-drop table t1,t2,t3,t4;
-set optimizer_switch= @tmp_mdev7823;
-
---echo #
---echo # MDEV-6859: scalar subqueries in a comparison produced unexpected result
---echo #
-set @tmp_mdev6859=@@optimizer_switch;
-set optimizer_switch=default;
-CREATE TABLE t1 (
- project_number varchar(50) NOT NULL,
- PRIMARY KEY (project_number)
-) ENGINE=MyISAM;
-
-INSERT INTO t1 (project_number) VALUES ('aaa'),('bbb');
-
-CREATE TABLE t2 (
- id int(10) unsigned NOT NULL AUTO_INCREMENT,
- project_number varchar(50) NOT NULL,
- history_date date NOT NULL,
- country varchar(50) NOT NULL,
- PRIMARY KEY (id)
-) ENGINE=MyISAM;
-
-INSERT INTO t2 (id, project_number, history_date, country) VALUES
-(1, 'aaa', '2014-08-09', 'france'),(2, 'aaa', '2014-09-09', 'singapore');
-
-CREATE TABLE t3 (
- region varchar(50) NOT NULL,
- country varchar(50) NOT NULL
-) ENGINE=MyISAM;
-
-INSERT INTO t3 (region, country) VALUES ('apac', 'singapore'),('eame', 'france');
-
-SELECT SQL_NO_CACHE a.project_number
-FROM t1 a
-WHERE ( SELECT z.country
- FROM t2 z
- WHERE z.project_number = a.project_number AND z.history_date <= '2014-09-01'
- ORDER BY z.id DESC LIMIT 1
- ) IN (
- SELECT r.country
- FROM t3 r
- WHERE r.region = 'eame'
- );
-
-drop table t1, t2, t3;
-set optimizer_switch= @tmp_mdev6859;
-
---echo #
---echo # MDEV-12675: subquery subject to semi-join optimizations
---echo # in ON expression of INNER JOIN
---echo #
-
-set @tmp_mdev12675=@@optimizer_switch;
-set optimizer_switch=default;
-create table t1 (a int) engine=myisam;
-insert into t1 values (5),(3),(2),(7),(2),(5),(1);
-create table t2 (b int, index idx(b)) engine=myisam;
-insert into t2 values (2),(3),(2),(1),(3),(4);
-insert into t2 select b+10 from t2;
-insert into t2 select b+10 from t2;
-insert into t2 select b+10 from t2;
-insert into t2 select b+10 from t2;
-insert into t2 select b+10 from t2;
-insert into t2 select b+10 from t2;
-insert into t2 select b+10 from t2;
-insert into t2 select b+10 from t2;
-insert into t2 select b+10 from t2;
-insert into t2 select b+10 from t2;
-insert into t2 select b+10 from t2;
-analyze table t1,t2;
-
-explain
-select a from t1, t2 where b between 1 and 2 and a in (select b from t2);
-explain
-select a from t1 join t2 on b between 1 and 2 and a in (select b from t2);
-
-drop table t1,t2;
-set optimizer_switch= @tmp_mdev12675;
-
---echo #
---echo # MDEV-12817: subquery NOT subject to semi-join optimizations
---echo # in ON expression of INNER JOIN
---echo #
-
-CREATE TABLE t1 (c1 int) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE TABLE t2 (c2 int) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (3),(4);
-
-CREATE TABLE t3 (c3 int) ENGINE=MyISAM;
-INSERT INTO t3 VALUES (5),(6);
-
-CREATE TABLE t4 (c4 int) ENGINE=MyISAM;
-INSERT INTO t4 VALUES (7),(8);
-
-let $q1=
-SELECT c1
-FROM t1
-LEFT JOIN
-( t2 INNER JOIN t3 ON ( 1 IN ( SELECT c4 FROM t4 ) ) )
-ON (c1 = c3);
-
-eval $q1;
-eval EXPLAIN EXTENDED $q1;
-
-let $q2=
-SELECT *
-FROM t1
-LEFT JOIN
-( ( SELECT * FROM t2 WHERE c2 IN ( SELECT c3 FROM t3 ) ) AS sq INNER JOIN t4 )
-ON (c1 = c2);
-
---echo # mdev-12820
-eval $q2;
-eval EXPLAIN EXTENDED $q2;
-
-DROP TABLE t1,t2,t3,t4;
-
-# The following command must be the last one the file
-set optimizer_switch=@subselect_sj_tmp;
diff --git a/mysql-test/t/subselect_sj2.test b/mysql-test/t/subselect_sj2.test
deleted file mode 100644
index a948b086a85..00000000000
--- a/mysql-test/t/subselect_sj2.test
+++ /dev/null
@@ -1,1468 +0,0 @@
-#
-# DuplicateElimination strategy test
-#
---source include/have_innodb.inc
-
-set @subselect_sj2_tmp= @@optimizer_switch;
-set optimizer_switch='semijoin=on,firstmatch=on,loosescan=on';
-set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
-SET optimizer_switch=ifnull(@optimizer_switch_for_subselect_sj2_test,'outer_join_with_cache=off');
-SET optimizer_switch=ifnull(@optimizer_switch_for_subselect_sj2_test,'semijoin_with_cache=off');
-if (`select @join_cache_level_for_subselect_sj2_test is null`)
-{
- set join_cache_level=1;
-}
-if (`select @join_cache_level_for_subselect_sj2_test is not null`)
-{
- set join_cache_level=@join_cache_level_for_subselect_sj2_test;
-}
-
---disable_warnings
-drop table if exists t0, t1, t2, t3, t4, t5;
-drop view if exists v1;
---enable_warnings
-
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-# First test simple cases: I20 order, no join buffering.
-
-create table t1 (
- a int,
- b int
-);
-insert into t1 values (1,1),(1,1),(2,2);
-
-create table t2 (
- a int,
- b int,
- key(b)
-);
-insert into t2 select a, a/2 from t0;
-insert into t2 select a+10, a+10/2 from t0;
-
-select * from t1;
-select * from t2;
-explain select * from t2 where b in (select a from t1);
-select * from t2 where b in (select a from t1);
-
-# Try an InnoDB table with very long rowid
-create table t3 (
- a int,
- b int,
- key(b),
- pk1 char(200), pk2 char(200), pk3 char(200),
- primary key(pk1, pk2, pk3)
-) engine=innodb;
-insert into t3 select a,a, a,a,a from t0;
-insert into t3 select a,a, a+100,a+100,a+100 from t0;
-
-explain select * from t3 where b in (select a from t1);
-select * from t3 where b in (select a from t1);
-
-# Test overflow to MyISAM:
-set @save_max_heap_table_size= @@max_heap_table_size;
-set max_heap_table_size=16384;
-set @save_join_buffer_size = @@join_buffer_size;
-set join_buffer_size= 8192;
-
-drop table t3;
-create table t3 (
- a int,
- b int,
- key(b),
- pk1 char(200), pk2 char(200),
- primary key(pk1, pk2)
-) engine=innodb;
-insert into t3 select
- A.a + 10*B.a, A.a + 10*B.a, A.a + 10*B.a, A.a + 10*B.a
-from t0 A, t0 B where B.a <5;
-
---replace_column 9 #
-explain select * from t3 where b in (select a from t0);
-select * from t3 where b in (select A.a+B.a from t0 A, t0 B where B.a<5);
-
-set join_buffer_size= @save_join_buffer_size;
-set max_heap_table_size= @save_max_heap_table_size;
-
-# O2I join orders, with shortcutting:
-explain select * from t1 where a in (select b from t2);
-select * from t1;
-select * from t1 where a in (select b from t2);
-
-drop table t1, t2, t3;
-# (no need for anything in range/index_merge/DS-MRR)
-
-#
-# Test join buffering
-#
-set @save_join_buffer_size = @@join_buffer_size;
-set join_buffer_size= 8192;
-
-create table t1 (a int, filler1 binary(200), filler2 binary(200));
-insert into t1 select a, 'filler123456', 'filler123456' from t0;
-insert into t1 select a+10, 'filler123456', 'filler123456' from t0;
-
-create table t2 as select * from t1;
-insert into t1 select a+20, 'filler123456', 'filler123456' from t0;
-
-insert into t1 values (2, 'duplicate ok', 'duplicate ok');
-insert into t1 values (18, 'duplicate ok', 'duplicate ok');
-
-insert into t2 values (3, 'duplicate ok', 'duplicate ok');
-insert into t2 values (19, 'duplicate ok', 'duplicate ok');
-
-explain select
- a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z
-from t1 ot where a in (select a from t2 it);
-select
- a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z
-from t1 ot where a in (select a from t2 it);
-
-explain select
- a, mid(filler1, 1,10), length(filler1)=length(filler2)
-from t2 ot where a in (select a from t1 it);
-select
- a, mid(filler1, 1,10), length(filler1)=length(filler2)
-from t2 ot where a in (select a from t1 it);
-
-# Now let the buffer overfill:
-insert into t1 select a+20, 'filler123456', 'filler123456' from t0;
-insert into t1 select a+20, 'filler123456', 'filler123456' from t0;
-
-explain select
- a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z
-from t1 ot where a in (select a from t2 it);
-select
- a, mid(filler1, 1,10), length(filler1)=length(filler2) as Z
-from t1 ot where a in (select a from t2 it);
-
-explain select
- a, mid(filler1, 1,10), length(filler1)=length(filler2)
-from t2 ot where a in (select a from t1 it);
-select
- a, mid(filler1, 1,10), length(filler1)=length(filler2)
-from t2 ot where a in (select a from t1 it);
-
-drop table t1, t2;
-
-# Check ref access to tables inside the OJ nest inside the SJ nest
-create table t1 (a int, b int, key(a));
-create table t2 (a int, b int, key(a));
-create table t3 (a int, b int, key(a));
-
-insert into t1 select a,a from t0;
-insert into t2 select a,a from t0;
-insert into t3 select a,a from t0;
-
---echo t2 and t3 must be use 'ref', not 'ALL':
-explain select *
-from t0 where a in
- (select t2.a+t3.a from t1 left join (t2 join t3) on t2.a=t1.a and t3.a=t1.a);
-
-drop table t0, t1,t2,t3;
-
-#
-# Bug #27348: Assertion abort for a query with two subqueries to be flattened
-# Bug #35674: Range optimizer ignores conditions on inner tables in semi-join IN subqueries
-#
-CREATE TABLE t1 (
- ID int(11) NOT NULL auto_increment,
- Name char(35) NOT NULL default '',
- Country char(3) NOT NULL default '',
- Population int(11) NOT NULL default '0',
- PRIMARY KEY (ID),
- INDEX (Population),
- INDEX (Country)
-);
-CREATE TABLE t2 (
- Code char(3) NOT NULL default '',
- Name char(52) NOT NULL default '',
- SurfaceArea float(10,2) NOT NULL default '0.00',
- Population int(11) NOT NULL default '0',
- Capital int(11) default NULL,
- PRIMARY KEY (Code),
- UNIQUE INDEX (Name),
- INDEX (Population)
-);
-CREATE TABLE t3 (
- Country char(3) NOT NULL default '',
- Language char(30) NOT NULL default '',
- Percentage float(3,1) NOT NULL default '0.0',
- PRIMARY KEY (Country, Language),
- INDEX (Percentage)
-);
-
---disable_query_log
-INSERT INTO t1 VALUES
-(1,'Kabul','AFG',1780000),(2,'Qandahar','AFG',237500),
-(3,'Herat','AFG',186800),(4,'Mazar-e-Sharif','AFG',127800),
-(5,'Amsterdam','NLD',731200),(6,'Rotterdam','NLD',593321),
-(7,'Haag','NLD',440900),(8,'Utrecht','NLD',234323),
-(9,'Eindhoven','NLD',201843),(10,'Tilburg','NLD',193238),
-(11,'Groningen','NLD',172701),(12,'Breda','NLD',160398),
-(13,'Apeldoorn','NLD',153491),(14,'Nijmegen','NLD',152463),
-(15,'Enschede','NLD',149544),(16,'Haarlem','NLD',148772),
-(17,'Almere','NLD',142465),(18,'Arnhem','NLD',138020),
-(19,'Zaanstad','NLD',135621),(20,'´s-Hertogenbosch','NLD',129170),
-(21,'Amersfoort','NLD',126270),(22,'Maastricht','NLD',122087),
-(23,'Dordrecht','NLD',119811),(24,'Leiden','NLD',117196),
-(25,'Haarlemmermeer','NLD',110722),(26,'Zoetermeer','NLD',110214),
-(27,'Emmen','NLD',105853),(28,'Zwolle','NLD',105819),
-(29,'Ede','NLD',101574),(30,'Delft','NLD',95268);
-
-INSERT INTO t2 VALUES
-('AFG','Afghanistan',652090.00,22720000,1),
-('NLD','Netherlands',41526.00,15864000,5),
-('ANT','Netherlands Antilles',800.00,217000,33),
-('ALB','Albania',28748.00,3401200,34),
-('DZA','Algeria',2381741.00,31471000,35),
-('ASM','American Samoa',199.00,68000,54),
-('AND','Andorra',468.00,78000,55),
-('AGO','Angola',1246700.00,12878000,56),
-('AIA','Anguilla',96.00,8000,62),
-('ATG','Antigua and Barbuda',442.00,68000,63),
-('ARE','United Arab Emirates',83600.00,2441000,65),
-('ARG','Argentina',2780400.00,37032000,69),
-('ARM','Armenia',29800.00,3520000,126),
-('ABW','Aruba',193.00,103000,129),
-('AUS','Australia',7741220.00,18886000,135),
-('AZE','Azerbaijan',86600.00,7734000,144);
-
-INSERT INTO t3 VALUES
-('AFG','Pashto',52.4),('NLD','Dutch',95.6),
-('ANT','Papiamento',86.2),('ALB','Albaniana',97.9),
-('DZA','Arabic',86.0),('ASM','Samoan',90.6),
-('AND','Spanish',44.6),('AGO','Ovimbundu',37.2),
-('AIA','English',0.0),('ATG','Creole English',95.7),
-('ARE','Arabic',42.0),('ARG','Spanish',96.8),
-('ARM','Armenian',93.4),('ABW','Papiamento',76.7),
-('AUS','English',81.2),('AZE','Azerbaijani',89.0),
-('BHS','Creole English',89.7),('BHR','Arabic',67.7),
-('BGD','Bengali',97.7),('BRB','Bajan',95.1),
-('BEL','Dutch',59.2),('BLZ','English',50.8);
---enable_query_log
-
-# Disable materialization to avoid races between query plans
-set @bug35674_save_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='materialization=off';
-EXPLAIN
-SELECT Name FROM t2
- WHERE t2.Code IN (SELECT Country FROM t1 WHERE Population > 5000000)
- AND
- t2.Code IN (SELECT Country FROM t3
- WHERE Language='English' AND Percentage > 10 AND
- t2.Population > 100000);
-set optimizer_switch=@bug35674_save_optimizer_switch;
-
-DROP TABLE t1,t2,t3;
-
-# BUG#30993:
-CREATE TABLE t1 (
- Code char(3) NOT NULL DEFAULT '',
- Name char(52) NOT NULL DEFAULT '',
- Continent enum('Asia','Europe','North America','Africa','Oceania','Antarctica','South America') NOT NULL DEFAULT 'Asia',
- Region char(26) NOT NULL DEFAULT '',
- SurfaceArea float(10,2) NOT NULL DEFAULT '0.00',
- IndepYear smallint(6) DEFAULT NULL,
- Population int(11) NOT NULL DEFAULT '0',
- LifeExpectancy float(3,1) DEFAULT NULL,
- GNP float(10,2) DEFAULT NULL,
- GNPOld float(10,2) DEFAULT NULL,
- LocalName char(45) NOT NULL DEFAULT '',
- GovernmentForm char(45) NOT NULL DEFAULT '',
- HeadOfState char(60) DEFAULT NULL,
- Capital int(11) DEFAULT NULL,
- Code2 char(2) NOT NULL DEFAULT '',
- PRIMARY KEY (Code)
-);
-
-CREATE TABLE t2 (
- ID int(11) NOT NULL AUTO_INCREMENT,
- Name char(35) NOT NULL DEFAULT '',
- CountryCode char(3) NOT NULL DEFAULT '',
- District char(20) NOT NULL DEFAULT '',
- Population int(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (ID),
- KEY CountryCode (CountryCode)
-);
-
---echo Fill the table with test data
---disable_query_log
-insert into t2 (ID, Name, CountryCode, Population) values
-(1,'Kabul','AFG',1780000), (2,'Qandahar','AFG',237500), (3,'Herat','AFG',186800),
-(4,'Mazar-e-Sharif','AFG',127800), (33,'Willemstad','ANT',2345), (34,'Tirana','ALB',270000),
-(55,'Andorra la Vella','AND',21189), (61,'South Hill','AIA',961), (62,'The Valley','AIA',595),
-(63,'Saint John�s','ATG',24000), (64,'Dubai','ARE',669181), (65,'Abu Dhabi','ARE',398695),
-(66,'Sharja','ARE',320095), (67,'al-Ayn','ARE',225970), (68,'Ajman','ARE',114395),
-(126,'Yerevan','ARM',1248700), (127,'Gjumri','ARM',211700), (128,'Vanadzor','ARM',172700),
-(129,'Oranjestad','ABW',29034), (144,'Baku','AZE',1787800), (145,'G�nc�','AZE',299300),
-(146,'Sumqayit','AZE',283000), (147,'Ming��evir','AZE',93900), (148,'Nassau','BHS',172000),
-(149,'al-Manama','BHR',148000), (150,'Dhaka','BGD',3612850), (151,'Chittagong','BGD',1392860),
-(152,'Khulna','BGD',663340), (153,'Rajshahi','BGD',294056), (154,'Narayanganj','BGD',202134),
-(155,'Rangpur','BGD',191398), (156,'Mymensingh','BGD',188713), (157,'Barisal','BGD',170232),
-(158,'Tungi','BGD',168702), (159,'Jessore','BGD',139710), (160,'Comilla','BGD',135313),
-(161,'Nawabganj','BGD',130577), (162,'Dinajpur','BGD',127815), (163,'Bogra','BGD',120170),
-(164,'Sylhet','BGD',117396), (165,'Brahmanbaria','BGD',109032), (166,'Tangail','BGD',106004),
-(167,'Jamalpur','BGD',103556), (168,'Pabna','BGD',103277), (169,'Naogaon','BGD',101266),
-(170,'Sirajganj','BGD',99669), (171,'Narsinghdi','BGD',98342), (172,'Saidpur','BGD',96777),
-(173,'Gazipur','BGD',96717), (174,'Bridgetown','BRB',6070), (175,'Antwerpen','BEL',446525),
-(176,'Gent','BEL',224180), (177,'Charleroi','BEL',200827), (178,'Li�ge','BEL',185639),
-(179,'Bruxelles [Brussel]','BEL',133859), (180,'Brugge','BEL',116246), (181,'Schaerbeek','BEL',105692),
-(182,'Namur','BEL',105419), (183,'Mons','BEL',90935), (184,'Belize City','BLZ',55810),
-(185,'Belmopan','BLZ',7105), (190,'Saint George','BMU',1800), (191,'Hamilton','BMU',1200),
-(192,'Thimphu','BTN',22000), (201,'Sarajevo','BIH',360000), (202,'Banja Luka','BIH',143079),
-(203,'Zenica','BIH',96027), (538,'Bandar Seri Begawan','BRN',21484), (539,'Sofija','BGR',1122302),
-(540,'Plovdiv','BGR',342584), (541,'Varna','BGR',299801), (542,'Burgas','BGR',195255),
-(543,'Ruse','BGR',166467), (544,'Stara Zagora','BGR',147939), (545,'Pleven','BGR',121952),
-(546,'Sliven','BGR',105530), (547,'Dobric','BGR',100399), (548,'�umen','BGR',94686),
-(553,'George Town','CYM',19600), (584,'San Jos�','CRI',339131), (1523,'Wien','AUT',1608144),
-(1524,'Graz','AUT',240967), (1525,'Linz','AUT',188022), (1526,'Salzburg','AUT',144247),
-(1527,'Innsbruck','AUT',111752), (1528,'Klagenfurt','AUT',91141), (1810,'Montr�al','CAN',1016376),
-(1811,'Calgary','CAN',768082), (1812,'Toronto','CAN',688275), (1813,'North York','CAN',622632),
-(1814,'Winnipeg','CAN',618477), (1815,'Edmonton','CAN',616306), (1816,'Mississauga','CAN',608072),
-(1817,'Scarborough','CAN',594501), (1818,'Vancouver','CAN',514008), (1819,'Etobicoke','CAN',348845),
-(1820,'London','CAN',339917), (1821,'Hamilton','CAN',335614), (1822,'Ottawa','CAN',335277),
-(1823,'Laval','CAN',330393), (1824,'Surrey','CAN',304477), (1825,'Brampton','CAN',296711),
-(1826,'Windsor','CAN',207588), (1827,'Saskatoon','CAN',193647), (1828,'Kitchener','CAN',189959),
-(1829,'Markham','CAN',189098), (1830,'Regina','CAN',180400), (1831,'Burnaby','CAN',179209),
-(1832,'Qu�bec','CAN',167264), (1833,'York','CAN',154980), (1834,'Richmond','CAN',148867),
-(1835,'Vaughan','CAN',147889), (1836,'Burlington','CAN',145150), (1837,'Oshawa','CAN',140173),
-(1838,'Oakville','CAN',139192), (1839,'Saint Catharines','CAN',136216), (1840,'Longueuil','CAN',127977),
-(1841,'Richmond Hill','CAN',116428), (1842,'Thunder Bay','CAN',115913), (1843,'Nepean','CAN',115100),
-(1844,'Cape Breton','CAN',114733), (1845,'East York','CAN',114034), (1846,'Halifax','CAN',113910),
-(1847,'Cambridge','CAN',109186), (1848,'Gloucester','CAN',107314), (1849,'Abbotsford','CAN',105403),
-(1850,'Guelph','CAN',103593), (1851,'Saint John�s','CAN',101936), (1852,'Coquitlam','CAN',101820),
-(1853,'Saanich','CAN',101388), (1854,'Gatineau','CAN',100702), (1855,'Delta','CAN',95411),
-(1856,'Sudbury','CAN',92686), (1857,'Kelowna','CAN',89442), (1858,'Barrie','CAN',89269),
-(1890,'Shanghai','CHN',9696300), (1891,'Peking','CHN',7472000), (1892,'Chongqing','CHN',6351600),
-(1893,'Tianjin','CHN',5286800), (1894,'Wuhan','CHN',4344600), (1895,'Harbin','CHN',4289800),
-(1896,'Shenyang','CHN',4265200), (1897,'Kanton [Guangzhou]','CHN',4256300), (1898,'Chengdu','CHN',3361500),
-(1899,'Nanking [Nanjing]','CHN',2870300), (1900,'Changchun','CHN',2812000), (1901,'Xi�an','CHN',2761400),
-(1902,'Dalian','CHN',2697000), (1903,'Qingdao','CHN',2596000), (1904,'Jinan','CHN',2278100),
-(1905,'Hangzhou','CHN',2190500), (1906,'Zhengzhou','CHN',2107200), (1907,'Shijiazhuang','CHN',2041500),
-(1908,'Taiyuan','CHN',1968400), (1909,'Kunming','CHN',1829500), (1910,'Changsha','CHN',1809800),
-(1911,'Nanchang','CHN',1691600), (1912,'Fuzhou','CHN',1593800), (1913,'Lanzhou','CHN',1565800),
-(1914,'Guiyang','CHN',1465200), (1915,'Ningbo','CHN',1371200), (1916,'Hefei','CHN',1369100),
-(1917,'Urumt�i [�r�mqi]','CHN',1310100), (1918,'Anshan','CHN',1200000), (1919,'Fushun','CHN',1200000),
-(1920,'Nanning','CHN',1161800), (1921,'Zibo','CHN',1140000), (1922,'Qiqihar','CHN',1070000),
-(1923,'Jilin','CHN',1040000), (1924,'Tangshan','CHN',1040000), (1925,'Baotou','CHN',980000),
-(1926,'Shenzhen','CHN',950500), (1927,'Hohhot','CHN',916700), (1928,'Handan','CHN',840000),
-(1929,'Wuxi','CHN',830000), (1930,'Xuzhou','CHN',810000), (1931,'Datong','CHN',800000),
-(1932,'Yichun','CHN',800000), (1933,'Benxi','CHN',770000), (1934,'Luoyang','CHN',760000),
-(1935,'Suzhou','CHN',710000), (1936,'Xining','CHN',700200), (1937,'Huainan','CHN',700000),
-(1938,'Jixi','CHN',683885), (1939,'Daqing','CHN',660000), (1940,'Fuxin','CHN',640000),
-(1941,'Amoy [Xiamen]','CHN',627500), (1942,'Liuzhou','CHN',610000), (1943,'Shantou','CHN',580000),
-(1944,'Jinzhou','CHN',570000), (1945,'Mudanjiang','CHN',570000), (1946,'Yinchuan','CHN',544500),
-(1947,'Changzhou','CHN',530000), (1948,'Zhangjiakou','CHN',530000), (1949,'Dandong','CHN',520000),
-(1950,'Hegang','CHN',520000), (1951,'Kaifeng','CHN',510000), (1952,'Jiamusi','CHN',493409),
-(1953,'Liaoyang','CHN',492559), (1954,'Hengyang','CHN',487148), (1955,'Baoding','CHN',483155),
-(1956,'Hunjiang','CHN',482043), (1957,'Xinxiang','CHN',473762), (1958,'Huangshi','CHN',457601),
-(1959,'Haikou','CHN',454300), (1960,'Yantai','CHN',452127), (1961,'Bengbu','CHN',449245),
-(1962,'Xiangtan','CHN',441968), (1963,'Weifang','CHN',428522), (1964,'Wuhu','CHN',425740),
-(1965,'Pingxiang','CHN',425579), (1966,'Yingkou','CHN',421589), (1967,'Anyang','CHN',420332),
-(1968,'Panzhihua','CHN',415466), (1969,'Pingdingshan','CHN',410775), (1970,'Xiangfan','CHN',410407),
-(1971,'Zhuzhou','CHN',409924), (1972,'Jiaozuo','CHN',409100), (1973,'Wenzhou','CHN',401871),
-(1974,'Zhangjiang','CHN',400997), (1975,'Zigong','CHN',393184), (1976,'Shuangyashan','CHN',386081),
-(1977,'Zaozhuang','CHN',380846), (1978,'Yakeshi','CHN',377869), (1979,'Yichang','CHN',371601),
-(1980,'Zhenjiang','CHN',368316), (1981,'Huaibei','CHN',366549), (1982,'Qinhuangdao','CHN',364972),
-(1983,'Guilin','CHN',364130), (1984,'Liupanshui','CHN',363954), (1985,'Panjin','CHN',362773),
-(1986,'Yangquan','CHN',362268), (1987,'Jinxi','CHN',357052), (1988,'Liaoyuan','CHN',354141),
-(1989,'Lianyungang','CHN',354139), (1990,'Xianyang','CHN',352125), (1991,'Tai�an','CHN',350696),
-(1992,'Chifeng','CHN',350077), (1993,'Shaoguan','CHN',350043), (1994,'Nantong','CHN',343341),
-(1995,'Leshan','CHN',341128), (1996,'Baoji','CHN',337765), (1997,'Linyi','CHN',324720),
-(1998,'Tonghua','CHN',324600), (1999,'Siping','CHN',317223), (2000,'Changzhi','CHN',317144),
-(2001,'Tengzhou','CHN',315083), (2002,'Chaozhou','CHN',313469), (2003,'Yangzhou','CHN',312892),
-(2004,'Dongwan','CHN',308669), (2005,'Ma�anshan','CHN',305421), (2006,'Foshan','CHN',303160),
-(2007,'Yueyang','CHN',302800), (2008,'Xingtai','CHN',302789), (2009,'Changde','CHN',301276),
-(2010,'Shihezi','CHN',299676), (2011,'Yancheng','CHN',296831), (2012,'Jiujiang','CHN',291187),
-(2013,'Dongying','CHN',281728), (2014,'Shashi','CHN',281352), (2015,'Xintai','CHN',281248),
-(2016,'Jingdezhen','CHN',281183), (2017,'Tongchuan','CHN',280657), (2018,'Zhongshan','CHN',278829),
-(2019,'Shiyan','CHN',273786), (2020,'Tieli','CHN',265683), (2021,'Jining','CHN',265248),
-(2022,'Wuhai','CHN',264081), (2023,'Mianyang','CHN',262947), (2024,'Luzhou','CHN',262892),
-(2025,'Zunyi','CHN',261862), (2026,'Shizuishan','CHN',257862), (2027,'Neijiang','CHN',256012),
-(2028,'Tongliao','CHN',255129), (2029,'Tieling','CHN',254842), (2030,'Wafangdian','CHN',251733),
-(2031,'Anqing','CHN',250718), (2032,'Shaoyang','CHN',247227), (2033,'Laiwu','CHN',246833),
-(2034,'Chengde','CHN',246799), (2035,'Tianshui','CHN',244974), (2036,'Nanyang','CHN',243303),
-(2037,'Cangzhou','CHN',242708), (2038,'Yibin','CHN',241019), (2039,'Huaiyin','CHN',239675),
-(2040,'Dunhua','CHN',235100), (2041,'Yanji','CHN',230892), (2042,'Jiangmen','CHN',230587),
-(2043,'Tongling','CHN',228017), (2044,'Suihua','CHN',227881), (2045,'Gongziling','CHN',226569),
-(2046,'Xiantao','CHN',222884), (2047,'Chaoyang','CHN',222394), (2048,'Ganzhou','CHN',220129),
-(2049,'Huzhou','CHN',218071), (2050,'Baicheng','CHN',217987), (2051,'Shangzi','CHN',215373),
-(2052,'Yangjiang','CHN',215196), (2053,'Qitaihe','CHN',214957), (2054,'Gejiu','CHN',214294),
-(2055,'Jiangyin','CHN',213659), (2056,'Hebi','CHN',212976), (2057,'Jiaxing','CHN',211526),
-(2058,'Wuzhou','CHN',210452), (2059,'Meihekou','CHN',209038), (2060,'Xuchang','CHN',208815),
-(2061,'Liaocheng','CHN',207844), (2062,'Haicheng','CHN',205560), (2063,'Qianjiang','CHN',205504),
-(2064,'Baiyin','CHN',204970), (2065,'Bei�an','CHN',204899), (2066,'Yixing','CHN',200824),
-(2067,'Laizhou','CHN',198664), (2068,'Qaramay','CHN',197602), (2069,'Acheng','CHN',197595),
-(2070,'Dezhou','CHN',195485), (2071,'Nanping','CHN',195064), (2072,'Zhaoqing','CHN',194784),
-(2073,'Beipiao','CHN',194301), (2074,'Fengcheng','CHN',193784), (2075,'Fuyu','CHN',192981),
-(2076,'Xinyang','CHN',192509), (2077,'Dongtai','CHN',192247), (2078,'Yuci','CHN',191356),
-(2079,'Honghu','CHN',190772), (2080,'Ezhou','CHN',190123), (2081,'Heze','CHN',189293),
-(2082,'Daxian','CHN',188101), (2083,'Linfen','CHN',187309), (2084,'Tianmen','CHN',186332),
-(2085,'Yiyang','CHN',185818), (2086,'Quanzhou','CHN',185154), (2087,'Rizhao','CHN',185048),
-(2088,'Deyang','CHN',182488), (2089,'Guangyuan','CHN',182241), (2090,'Changshu','CHN',181805),
-(2091,'Zhangzhou','CHN',181424), (2092,'Hailar','CHN',180650), (2093,'Nanchong','CHN',180273),
-(2094,'Jiutai','CHN',180130), (2095,'Zhaodong','CHN',179976), (2096,'Shaoxing','CHN',179818),
-(2097,'Fuyang','CHN',179572), (2098,'Maoming','CHN',178683), (2099,'Qujing','CHN',178669),
-(2100,'Ghulja','CHN',177193), (2101,'Jiaohe','CHN',176367), (2102,'Puyang','CHN',175988),
-(2103,'Huadian','CHN',175873), (2104,'Jiangyou','CHN',175753), (2105,'Qashqar','CHN',174570),
-(2106,'Anshun','CHN',174142), (2107,'Fuling','CHN',173878), (2108,'Xinyu','CHN',173524),
-(2109,'Hanzhong','CHN',169930), (2110,'Danyang','CHN',169603), (2111,'Chenzhou','CHN',169400),
-(2112,'Xiaogan','CHN',166280), (2113,'Shangqiu','CHN',164880), (2114,'Zhuhai','CHN',164747),
-(2115,'Qingyuan','CHN',164641), (2116,'Aqsu','CHN',164092), (2117,'Jining','CHN',163552),
-(2118,'Xiaoshan','CHN',162930), (2119,'Zaoyang','CHN',162198), (2120,'Xinghua','CHN',161910),
-(2121,'Hami','CHN',161315), (2122,'Huizhou','CHN',161023), (2123,'Jinmen','CHN',160794),
-(2124,'Sanming','CHN',160691), (2125,'Ulanhot','CHN',159538), (2126,'Korla','CHN',159344),
-(2127,'Wanxian','CHN',156823), (2128,'Rui�an','CHN',156468), (2129,'Zhoushan','CHN',156317),
-(2130,'Liangcheng','CHN',156307), (2131,'Jiaozhou','CHN',153364), (2132,'Taizhou','CHN',152442),
-(2133,'Suzhou','CHN',151862), (2134,'Yichun','CHN',151585), (2135,'Taonan','CHN',150168),
-(2136,'Pingdu','CHN',150123), (2137,'Ji�an','CHN',148583), (2138,'Longkou','CHN',148362),
-(2139,'Langfang','CHN',148105), (2140,'Zhoukou','CHN',146288), (2141,'Suining','CHN',146086),
-(2142,'Yulin','CHN',144467), (2143,'Jinhua','CHN',144280), (2144,'Liu�an','CHN',144248),
-(2145,'Shuangcheng','CHN',142659), (2146,'Suizhou','CHN',142302), (2147,'Ankang','CHN',142170),
-(2148,'Weinan','CHN',140169), (2149,'Longjing','CHN',139417), (2150,'Da�an','CHN',138963),
-(2151,'Lengshuijiang','CHN',137994), (2152,'Laiyang','CHN',137080), (2153,'Xianning','CHN',136811),
-(2154,'Dali','CHN',136554), (2155,'Anda','CHN',136446), (2156,'Jincheng','CHN',136396),
-(2157,'Longyan','CHN',134481), (2158,'Xichang','CHN',134419), (2159,'Wendeng','CHN',133910),
-(2160,'Hailun','CHN',133565), (2161,'Binzhou','CHN',133555), (2162,'Linhe','CHN',133183),
-(2163,'Wuwei','CHN',133101), (2164,'Duyun','CHN',132971), (2165,'Mishan','CHN',132744),
-(2166,'Shangrao','CHN',132455), (2167,'Changji','CHN',132260), (2168,'Meixian','CHN',132156),
-(2169,'Yushu','CHN',131861), (2170,'Tiefa','CHN',131807), (2171,'Huai�an','CHN',131149),
-(2172,'Leiyang','CHN',130115), (2173,'Zalantun','CHN',130031), (2174,'Weihai','CHN',128888),
-(2175,'Loudi','CHN',128418), (2176,'Qingzhou','CHN',128258), (2177,'Qidong','CHN',126872),
-(2178,'Huaihua','CHN',126785), (2179,'Luohe','CHN',126438), (2180,'Chuzhou','CHN',125341),
-(2181,'Kaiyuan','CHN',124219), (2182,'Linqing','CHN',123958), (2183,'Chaohu','CHN',123676),
-(2184,'Laohekou','CHN',123366), (2185,'Dujiangyan','CHN',123357), (2186,'Zhumadian','CHN',123232),
-(2187,'Linchuan','CHN',121949), (2188,'Jiaonan','CHN',121397), (2189,'Sanmenxia','CHN',120523),
-(2190,'Heyuan','CHN',120101), (2191,'Manzhouli','CHN',120023), (2192,'Lhasa','CHN',120000),
-(2193,'Lianyuan','CHN',118858), (2194,'Kuytun','CHN',118553), (2195,'Puqi','CHN',117264),
-(2196,'Hongjiang','CHN',116188), (2197,'Qinzhou','CHN',114586), (2198,'Renqiu','CHN',114256),
-(2199,'Yuyao','CHN',114065), (2200,'Guigang','CHN',114025), (2201,'Kaili','CHN',113958),
-(2202,'Yan�an','CHN',113277), (2203,'Beihai','CHN',112673), (2204,'Xuangzhou','CHN',112673),
-(2205,'Quzhou','CHN',112373), (2206,'Yong�an','CHN',111762), (2207,'Zixing','CHN',110048),
-(2208,'Liyang','CHN',109520), (2209,'Yizheng','CHN',109268), (2210,'Yumen','CHN',109234),
-(2211,'Liling','CHN',108504), (2212,'Yuncheng','CHN',108359), (2213,'Shanwei','CHN',107847),
-(2214,'Cixi','CHN',107329), (2215,'Yuanjiang','CHN',107004), (2216,'Bozhou','CHN',106346),
-(2217,'Jinchang','CHN',105287), (2218,'Fu�an','CHN',105265), (2219,'Suqian','CHN',105021),
-(2220,'Shishou','CHN',104571), (2221,'Hengshui','CHN',104269), (2222,'Danjiangkou','CHN',103211),
-(2223,'Fujin','CHN',103104), (2224,'Sanya','CHN',102820), (2225,'Guangshui','CHN',102770),
-(2226,'Huangshan','CHN',102628), (2227,'Xingcheng','CHN',102384), (2228,'Zhucheng','CHN',102134),
-(2229,'Kunshan','CHN',102052), (2230,'Haining','CHN',100478), (2231,'Pingliang','CHN',99265),
-(2232,'Fuqing','CHN',99193), (2233,'Xinzhou','CHN',98667), (2234,'Jieyang','CHN',98531),
-(2235,'Zhangjiagang','CHN',97994), (2236,'Tong Xian','CHN',97168), (2237,'Ya�an','CHN',95900),
-(2238,'Jinzhou','CHN',95761), (2239,'Emeishan','CHN',94000), (2240,'Enshi','CHN',93056),
-(2241,'Bose','CHN',93009), (2242,'Yuzhou','CHN',92889), (2243,'Kaiyuan','CHN',91999),
-(2244,'Tumen','CHN',91471), (2245,'Putian','CHN',91030), (2246,'Linhai','CHN',90870),
-(2247,'Xilin Hot','CHN',90646), (2248,'Shaowu','CHN',90286), (2249,'Junan','CHN',90222),
-(2250,'Huaying','CHN',89400), (2251,'Pingyi','CHN',89373), (2252,'Huangyan','CHN',89288),
-(2413,'La Habana','CUB',2256000), (2414,'Santiago de Cuba','CUB',433180), (2415,'Camag�ey','CUB',298726),
-(2416,'Holgu�n','CUB',249492), (2417,'Santa Clara','CUB',207350), (2418,'Guant�namo','CUB',205078),
-(2419,'Pinar del R�o','CUB',142100), (2420,'Bayamo','CUB',141000), (2421,'Cienfuegos','CUB',132770),
-(2422,'Victoria de las Tunas','CUB',132350), (2423,'Matanzas','CUB',123273), (2424,'Manzanillo','CUB',109350),
-(2425,'Sancti-Sp�ritus','CUB',100751), (2426,'Ciego de �vila','CUB',98505), (2430,'Nicosia','CYP',195000),
-(2431,'Limassol','CYP',154400), (3245,'Z�rich','CHE',336800), (3246,'Geneve','CHE',173500),
-(3247,'Basel','CHE',166700), (3248,'Bern','CHE',122700), (3249,'Lausanne','CHE',114500),
-(3339,'Praha','CZE',1181126), (3340,'Brno','CZE',381862), (3341,'Ostrava','CZE',320041),
-(3342,'Plzen','CZE',166759), (3343,'Olomouc','CZE',102702), (3344,'Liberec','CZE',99155),
-(3345,'Cesk� Budejovice','CZE',98186), (3346,'Hradec Kr�lov�','CZE',98080), (3347,'�st� nad Labem','CZE',95491),
-(3348,'Pardubice','CZE',91309), (3520,'Minsk','BLR',1674000), (3521,'Gomel','BLR',475000),
-(3522,'Mogiljov','BLR',356000), (3523,'Vitebsk','BLR',340000), (3524,'Grodno','BLR',302000),
-(3525,'Brest','BLR',286000), (3526,'Bobruisk','BLR',221000), (3527,'Baranovit�i','BLR',167000),
-(3528,'Borisov','BLR',151000), (3529,'Pinsk','BLR',130000), (3530,'Or�a','BLR',124000),
-(3531,'Mozyr','BLR',110000), (3532,'Novopolotsk','BLR',106000), (3533,'Lida','BLR',101000),
-(3534,'Soligorsk','BLR',101000), (3535,'Molodet�no','BLR',97000);
-
-insert into t1 (Code, Name, Continent) values
-('AFG','Afghanistan','Asia'), ('ANT','Netherlands Antilles','North America'),
-('ALB','Albania','Europe'), ('AND','Andorra','Europe'),
-('AIA','Anguilla','North America'), ('ATG','Antigua and Barbuda','North America'),
-('ARE','United Arab Emirates','Asia'), ('ARM','Armenia','Asia'),
-('ABW','Aruba','North America'), ('AZE','Azerbaijan','Asia'),
-('BHS','Bahamas','North America'), ('BHR','Bahrain','Asia'),
-('BGD','Bangladesh','Asia'), ('BRB','Barbados','North America'),
-('BEL','Belgium','Europe'), ('BLZ','Belize','North America'),
-('BMU','Bermuda','North America'), ('BTN','Bhutan','Asia'),
-('BIH','Bosnia and Herzegovina','Europe'), ('BRN','Brunei','Asia'),
-('BGR','Bulgaria','Europe'), ('CYM','Cayman Islands','North America'),
-('CRI','Costa Rica','North America'), ('AUT','Austria','Europe'),
-('CAN','Canada','North America'), ('CHN','China','Asia'),
-('CUB','Cuba','North America'), ('CYP','Cyprus','Asia'),
-('CHE','Switzerland','Europe'), ('CZE','Czech Republic','Europe'),
-('BLR','Belarus','Europe');
-update t2 set population=6000000 where Name in ('Wien', 'Vancouver', 'Praha');
---enable_query_log
-
---echo This must not use LooseScan:
-EXPLAIN SELECT Name FROM t1
- WHERE t1.Code IN (
- SELECT t2.CountryCode FROM t2 WHERE Population > 5000000);
-
-SELECT Name FROM t1
- WHERE t1.Code IN (
- SELECT t2.CountryCode FROM t2 WHERE Population > 5000000);
-
-drop table t1, t2;
-
-#
-# Bug#33062: subquery in stored routine cause crash
-#
-
---disable_warnings
-drop procedure if exists p1;
-drop procedure if exists p2;
-drop procedure if exists p3;
-drop procedure if exists p4;
---enable_warnings
-CREATE TABLE t1(a INT);
-CREATE TABLE t2(c INT);
-
-DELIMITER //;
-
-CREATE PROCEDURE p1(v1 int)
-BEGIN
- SELECT 1 FROM t1 WHERE a = v1 AND a IN (SELECT c FROM t2);
-END
-//
-
-CREATE PROCEDURE p2(v1 int)
-BEGIN
- SELECT 1 FROM t1 WHERE a IN (SELECT c FROM t2);
-END
-//
-
-CREATE PROCEDURE p3(v1 int)
-BEGIN
- SELECT 1
- FROM
- t1 t01,t1 t02,t1 t03,t1 t04,t1 t05,t1 t06,t1 t07,t1 t08,
- t1 t09,t1 t10,t1 t11,t1 t12,t1 t13,t1 t14,t1 t15,t1 t16,
- t1 t17,t1 t18,t1 t19,t1 t20,t1 t21,t1 t22,t1 t23,t1 t24,
- t1 t25,t1 t26,t1 t27,t1 t28,t1 t29,t1 t30,t1 t31,t1 t32,
- t1 t33,t1 t34,t1 t35,t1 t36,t1 t37,t1 t38,t1 t39,t1 t40,
- t1 t41,t1 t42,t1 t43,t1 t44,t1 t45,t1 t46,t1 t47,t1 t48,
- t1 t49,t1 t50,t1 t51,t1 t52,t1 t53,t1 t54,t1 t55,t1 t56,
- t1 t57,t1 t58,t1 t59,t1 t60
- WHERE t01.a IN (SELECT c FROM t2);
-END
-//
-
-CREATE PROCEDURE p4(v1 int)
-BEGIN
- SELECT 1
- FROM
- t1 t01,t1 t02,t1 t03,t1 t04,t1 t05,t1 t06,t1 t07,t1 t08,
- t1 t09,t1 t10,t1 t11,t1 t12,t1 t13,t1 t14,t1 t15,t1 t16,
- t1 t17,t1 t18,t1 t19,t1 t20,t1 t21,t1 t22,t1 t23,t1 t24,
- t1 t25,t1 t26,t1 t27,t1 t28,t1 t29,t1 t30,t1 t31,t1 t32,
- t1 t33,t1 t34,t1 t35,t1 t36,t1 t37,t1 t38,t1 t39,t1 t40,
- t1 t41,t1 t42,t1 t43,t1 t44,t1 t45,t1 t46,t1 t47,t1 t48,
- t1 t49,t1 t50,t1 t51,t1 t52,t1 t53,t1 t54,t1 t55,t1 t56,
- t1 t57,t1 t58,t1 t59,t1 t60
- WHERE t01.a = v1 AND t01.a IN (SELECT c FROM t2);
-END
-//
-
-DELIMITER ;//
-
-CALL p1(1);
-CALL p2(1);
-CALL p3(1);
-CALL p4(1);
-
-DROP TABLE t1, t2;
-DROP PROCEDURE p1;
-DROP PROCEDURE p2;
-DROP PROCEDURE p3;
-DROP PROCEDURE p4;
-
-
-#
-# BUG#35160 "Subquery optimization: table pullout is not reflected in EXPLAIN EXTENDED"
-#
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4);
-
-create table t1 (a int, b int, key(a));
-insert into t1 select a,a from t0;
-insert into t1 select a+5,a from t0;
-
-create table t2 (a int, b int, primary key(a));
-insert into t2 select * from t1;
-
-# Table t2 should be pulled out because t2.a=t0.a equality
---echo Table t2, unlike table t1, should be displayed as pulled out
-explain extended select * from t0
-where t0.a in ( select t1.a from t1,t2 where t2.a=t0.a and
-t1.b=t2.b);
-
-#
-# BUG#46556 "Returning incorrect, empty results for some IN subqueries
-# w/ semijoin=on"
-#
-
-# The above query did not have a valid plan before the fix of BUG#46556.
-# Add some data that would cause wrong result with the old plan.
-update t1 set a=3, b=11 where a=4;
-update t2 set b=11 where a=3;
-
-if (`select @@join_cache_level=6`)
-{
- --echo # Not anymore:
- --echo # The following query gives wrong result due to Bug#49129
-}
-select * from t0 where t0.a in
- (select t1.a from t1, t2 where t2.a=t0.a and t1.b=t2.b);
-
-drop table t0, t1, t2;
-
-#
-# BUG#35767: Processing of uncorrelated subquery with semi-join cause wrong result and crash
-#
-CREATE TABLE t1 (
- id int(11) NOT NULL,
- PRIMARY KEY (id));
-
-CREATE TABLE t2 (
- id int(11) NOT NULL,
- fid int(11) NOT NULL,
- PRIMARY KEY (id));
-
-insert into t1 values(1);
-insert into t2 values(1,7503),(2,1);
-
---error 1054
-explain select count(*)
-from t1
-where fid IN (select fid from t2 where (id between 7502 and 8420) order by fid );
-
-drop table t1, t2;
-
-#
-# BUG#36137 "virtual longlong Item_in_subselect::val_int(): Assertion `0' failed."
-#
-create table t1 (a int, b int, key (a), key (b));
-insert into t1 values (2,4),(2,4),(2,4);
-select t1.a from t1
-where
- t1.a in (select 1 from t1 where t1.a in (select 1 from t1) group by t1.a);
-drop table t1;
-
-#
-# BUG#36128: not in subquery causes crash in cleanup..
-#
-create table t1(a int,b int,key(a),key(b));
-insert into t1 values (1,1),(2,2),(3,3);
-select 1 from t1
-where t1.a not in (select 1 from t1
- where t1.a in (select 1 from t1)
- group by t1.b);
-drop table t1;
-
-#
-# BUG#33743 "nested subqueries, unique index, wrong result"
-#
-CREATE TABLE t1
- (EMPNUM CHAR(3) NOT NULL,
- EMPNAME CHAR(20),
- GRADE DECIMAL(4),
- CITY CHAR(15));
-
-CREATE TABLE t2
- (PNUM CHAR(3) NOT NULL,
- PNAME CHAR(20),
- PTYPE CHAR(6),
- BUDGET DECIMAL(9),
- CITY CHAR(15));
-
-CREATE TABLE t3
- (EMPNUM CHAR(3) NOT NULL,
- PNUM CHAR(3) NOT NULL,
- HOURS DECIMAL(5));
-
-INSERT INTO t1 VALUES ('E1','Alice',12,'Deale');
-INSERT INTO t1 VALUES ('E2','Betty',10,'Vienna');
-INSERT INTO t1 VALUES ('E3','Carmen',13,'Vienna');
-INSERT INTO t1 VALUES ('E4','Don',12,'Deale');
-INSERT INTO t1 VALUES ('E5','Ed',13,'Akron');
-
-INSERT INTO t2 VALUES ('P1','MXSS','Design',10000,'Deale');
-INSERT INTO t2 VALUES ('P2','CALM','Code',30000,'Vienna');
-INSERT INTO t2 VALUES ('P3','SDP','Test',30000,'Tampa');
-INSERT INTO t2 VALUES ('P4','SDP','Design',20000,'Deale');
-INSERT INTO t2 VALUES ('P5','IRM','Test',10000,'Vienna');
-INSERT INTO t2 VALUES ('P6','PAYR','Design',50000,'Deale');
-
-INSERT INTO t3 VALUES ('E1','P1',40);
-INSERT INTO t3 VALUES ('E1','P2',20);
-INSERT INTO t3 VALUES ('E1','P3',80);
-INSERT INTO t3 VALUES ('E1','P4',20);
-INSERT INTO t3 VALUES ('E1','P5',12);
-INSERT INTO t3 VALUES ('E1','P6',12);
-INSERT INTO t3 VALUES ('E2','P1',40);
-INSERT INTO t3 VALUES ('E2','P2',80);
-INSERT INTO t3 VALUES ('E3','P2',20);
-INSERT INTO t3 VALUES ('E4','P2',20);
-INSERT INTO t3 VALUES ('E4','P4',40);
-INSERT INTO t3 VALUES ('E4','P5',80);
-
-
-SELECT * FROM t1;
-CREATE UNIQUE INDEX t1_IDX ON t1(EMPNUM);
---sorted_result
-SELECT EMPNAME
-FROM t1
-WHERE EMPNUM IN
- (SELECT EMPNUM
- FROM t3
- WHERE PNUM IN
- (SELECT PNUM
- FROM t2
- WHERE PTYPE = 'Design'));
-
-DROP INDEX t1_IDX ON t1;
-CREATE INDEX t1_IDX ON t1(EMPNUM);
---sorted_result
-SELECT EMPNAME
-FROM t1
-WHERE EMPNUM IN
- (SELECT EMPNUM
- FROM t3
- WHERE PNUM IN
- (SELECT PNUM
- FROM t2
- WHERE PTYPE = 'Design'));
-
-DROP INDEX t1_IDX ON t1;
---sorted_result
-SELECT EMPNAME
-FROM t1
-WHERE EMPNUM IN
- (SELECT EMPNUM
- FROM t3
- WHERE PNUM IN
- (SELECT PNUM
- FROM t2
- WHERE PTYPE = 'Design'));
-
-DROP TABLE t1, t2, t3;
-
-#
-# BUG#33245 "Crash on VIEW referencing FROM table in an IN clause"
-#
-CREATE TABLE t1 (f1 INT NOT NULL);
-CREATE VIEW v1 (a) AS SELECT f1 IN (SELECT f1 FROM t1) FROM t1;
-SELECT * FROM v1;
-drop view v1;
-drop table t1;
-
-
-#
-# BUG#35550 "Semi-join subquery in ON clause and no WHERE crashes the server"
-#
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1(a int, b int);
-insert into t1 values (0,0),(1,1),(2,2);
-create table t2 as select * from t1;
-
-create table t3 (pk int, a int, primary key(pk));
-insert into t3 select a,a from t0;
-
-explain
-select * from t1 left join t2 on (t2.a= t1.a and t2.a in (select pk from t3));
-
-drop table t0, t1, t2, t3;
-
-#
-# BUG#34799: crash or/and memory overrun with dependant subquery and some joins
-#
-create table t1 (a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t2 (a char(200), b char(200), c char(200), primary key (a,b,c)) engine=innodb;
-insert into t2 select concat(a, repeat('X',198)),repeat('B',200),repeat('B',200) from t1;
-insert into t2 select concat(a, repeat('Y',198)),repeat('B',200),repeat('B',200) from t1;
-alter table t2 add filler1 int;
-
-insert into t1 select A.a + 10*(B.a + 10*C.a) from t1 A, t1 B, t1 C;
-
-set @save_join_buffer_size=@@join_buffer_size;
---disable_warnings
-set join_buffer_size=1;
---enable_warnings
-
-select * from t2 where filler1 in ( select a from t1);
-set join_buffer_size=default;
-
-drop table t1, t2;
-#
-# BUG#33509: Server crashes with number of recursive subqueries=61
-# (the query may or may not fail with an error so we're using it with SP
-#
-create table t1 (a int not null);
-
---disable_warnings
-drop procedure if exists p1;
---enable_warnings
-
-delimiter |;
-
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE EXIT HANDLER FOR SQLEXCEPTION select a from t1;
- prepare s1 from '
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in (
- select a from t1 where a in ( select a from t1)
- )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))';
- execute s1;
-END;
-|
-delimiter ;|
-
-call p1();
-drop procedure p1;
-drop table t1;
-
-#
-# BUG#35468 "Slowdown and wrong result for uncorrelated subquery w/o where"
-#
-
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t1 (a int) as select A.a + 10 *(B.a + 10*C.a) as a from t0 A, t0 B, t0 C;
-create table t2 (id int, a int, primary key(id), key(a)) as select a as id, a as a from t1;
-show create table t2;
-set @a=0;
-create table t3 as select * from t2 limit 0;
-insert into t3 select @a:=@a+1, t2.a from t2, t0;
-insert into t3 select @a:=@a+1, t2.a from t2, t0;
-insert into t3 select @a:=@a+1, t2.a from t2, t0;
-
-alter table t3 add primary key(id), add key(a);
---echo The following must use loose index scan over t3, key a:
-explain select count(a) from t2 where a in ( SELECT a FROM t3);
-select count(a) from t2 where a in ( SELECT a FROM t3);
-
-drop table t0,t1,t2,t3;
-
---echo
---echo BUG#42740: crash in optimize_semijoin_nests
---echo
-create table t1 (c6 timestamp,key (c6)) engine=innodb;
-create table t2 (c2 double) engine=innodb;
-explain select 1 from t2 where c2 = any (select log10(null) from t1 where c6 <null) ;
-drop table t1, t2;
-
---echo #
---echo # BUG#42742: crash in setup_sj_materialization, Copy_field::set
---echo #
-create table t3 ( c1 year) engine=innodb;
-insert into t3 values (2135),(2142);
-create table t2 (c1 tinytext,c2 text,c6 timestamp) engine=innodb;
--- echo # The following must not crash, EXPLAIN should show one SJ strategy, not a mix:
-explain select 1 from t2 where
- c2 in (select 1 from t3, t2) and
- c1 in (select convert(c6,char(1)) from t2);
-drop table t2, t3;
-
-
---echo #
---echo # BUG#761598: InnoDB: Error: row_search_for_mysql() is called without ha_innobase::external_lock() in maria-5.3
---echo #
-
-CREATE TABLE t1 ( f1 int NOT NULL , f10 int) ;
-INSERT IGNORE INTO t1 VALUES (25,0),(29,0);
-
-CREATE TABLE t2 ( f10 int) ENGINE=InnoDB;
-
-CREATE TABLE t3 ( f11 int) ;
-INSERT IGNORE INTO t3 VALUES (0);
-
-SELECT alias1.f10 AS field2
-FROM t2 AS alias1
-JOIN (
- t3 AS alias2
- JOIN t1 AS alias3
- ON alias3.f10
-) ON alias3.f1
-WHERE alias2.f11 IN (
- SELECT SQ4_alias1.f10
- FROM t1 AS SQ4_alias1
- LEFT JOIN t2 AS SQ4_alias3 ON SQ4_alias3.f10
-)
-GROUP BY field2;
-drop table t1, t2, t3;
-
---echo #
---echo # BUG#849763: Wrong result with second execution of prepared statement with semijoin + view
---echo #
-CREATE TABLE t1 ( c varchar(1)) engine=innodb;
-INSERT INTO t1 VALUES ('r');
-
-CREATE TABLE t2 ( a integer, b varchar(1), c varchar(1)) engine=innodb;
-INSERT INTO t2 VALUES (1,'r','r');
-
-CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1;
-
-PREPARE st1 FROM 'SELECT * FROM t2 WHERE a = SOME (SELECT a FROM v1 WHERE v1.c = t2.c)';
-EXECUTE st1;
-EXECUTE st1;
-
-DROP VIEW v1;
-DROP TABLE t1, t2;
-
---echo #
---echo # BUG#858732: Wrong result with semijoin + loosescan + comma join
---echo #
-CREATE TABLE t1 (f13 int(11) NOT NULL , PRIMARY KEY (f13)) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (16),(24);
-
-CREATE TABLE t2 (f14 int(11) NOT NULL, f12 varchar(1) NOT NULL, KEY (f12,f14)) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (6,'y');
-
-CREATE TABLE t3 (f12 varchar(1) NOT NULL) ENGINE=InnoDB;
-INSERT INTO t3 VALUES ('r'),('s'),('t'),('v'),('w'),('x'),('y');
-
---echo # The following must use LooseScan but not join buffering
-explain
-SELECT * FROM t3
-WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24);
-
-SELECT * FROM t3
-WHERE f12 IN (SELECT alias2.f12 FROM t1 AS alias1, t2 AS alias2, t1 WHERE alias1.f13 = 24);
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # BUG#869012: Wrong result with semijoin + materialization + AND in WHERE
---echo #
-CREATE TABLE t1 (f3 varchar(1) , f4 varchar(1) ) engine=InnoDB;
-INSERT IGNORE INTO t1 VALUES ('x','x'),('x','x');
-CREATE TABLE t2 ( f4 varchar(1) ) ;
-INSERT IGNORE INTO t2 VALUES ('g');
-CREATE TABLE t3 (f4 varchar(1) ) Engine=InnoDB;
-INSERT IGNORE INTO t3 VALUES ('x');
-
-set @tmp_869012=@@optimizer_switch;
-SET optimizer_switch='semijoin=on,materialization=on';
-SELECT *
-FROM t1 , t2
-WHERE ( t1.f4 ) IN ( SELECT f4 FROM t3 )
-AND t2.f4 != t1.f3 ;
-set optimizer_switch= @tmp_869012;
-
-DROP TABLE t1,t2,t3;
-
-
---echo #
---echo # BUG#869001: Wrong result with semijoin + materialization + firstmatch + multipart key
---echo #
-set @tmp869001_jcl= @@join_cache_level;
-set @tmp869001_os= @@optimizer_switch;
-SET join_cache_level=0;
-SET optimizer_switch='materialization=on,semijoin=on,firstmatch=on,loosescan=off';
-
-CREATE TABLE t1 ( f2 int, f3 varchar(1), KEY (f3,f2)) engine=innodb;
-INSERT INTO t1 VALUES (8,'x'),(NULL,'x'),(8,'c');
-
-CREATE TABLE t2 ( f4 varchar(1)) engine=innodb;
-INSERT INTO t2 VALUES ('x');
-
-CREATE TABLE t3 ( f1 int) engine=innodb;
-INSERT INTO t3 VALUES (8),(6),(2),(9),(6);
-
-CREATE TABLE t4 ( f3 varchar(1)) engine=innodb;
-INSERT INTO t4 VALUES ('p'),('j'),('c');
-
-SELECT *
-FROM t1 JOIN t2 ON (t2.f4 = t1.f3 )
-WHERE ( 8 ) IN (
- SELECT t3.f1 FROM t3 , t4
-);
-
-DROP TABLE t1, t2, t3, t4;
-set join_cache_level= @tmp869001_jcl;
-set optimizer_switch= @tmp869001_os;
-
---echo #
---echo # Bug #881318: join cache + duplicate elimination + left join
---echo # with empty materialized derived inner table
---echo #
-
-CREATE TABLE t1 (b varchar(1)) ENGINE=InnoDB;
-
-CREATE TABLE t2 (a varchar(1)) ENGINE=InnoDB;
-INSERT INTO t2 VALUES ('a');
-
-CREATE TABLE t3 (a varchar(1), b varchar(1)) ENGINE=InnoDB;
-INSERT INTO t3 VALUES ('c','c');
-
-CREATE TABLE t4 (b varchar(1)) ENGINE=InnoDB;
-INSERT INTO t4 VALUES ('c'), ('b');
-
-CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
-
-EXPLAIN
-SELECT * FROM t3 LEFT JOIN (v1,t2) ON t3.a = t2.a
- WHERE t3.b IN (SELECT b FROM t4);
-SELECT * FROM t3 LEFT JOIN (v1,t2) ON t3.a = t2.a
- WHERE t3.b IN (SELECT b FROM t4);
-
-DROP VIEW v1;
-DROP TABLE t1,t2,t3,t4;
-
---echo #
---echo # BUG#912538: Wrong result (missing rows) with semijoin=on, firstmatch=on, ...
---echo #
-CREATE TABLE t1 ( a INT NOT NULL, UNIQUE KEY(a) );
-INSERT INTO t1 VALUES (1),(2),(3),(4);
-
-# t2 needs to be InnoDB
-CREATE TABLE t2 ( b INT, c INT ) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,1);
-
-SELECT * FROM t1, t2 WHERE c IN (SELECT c FROM t1, t2 WHERE a = b);
-
-DROP TABLE t1,t2;
-
---echo #
---echo # BUG#962667: Assertion `0' failed in QUICK_INDEX_SORT_SELECT::need_sorted_output()
---echo # with index_merge+index_merge_sort_union+loosescan+semijoin
---echo #
-CREATE TABLE t1 (
- a INT, b VARCHAR(1), c INT,
- KEY(a), KEY(b)
-) ENGINE=InnoDB;
-
-INSERT INTO t1 VALUES
-(1,'v',9),(2,'v',8),(3,'c',7),(4,'m',6),(5,'x',5),
-(6,'i',4),(7,'e',3),(8,'p',2),(9,'s',1),(10,'j',9),
-(11,'z',8),(12,'c',7),(13,'a',6),(14,'q',5),(15,'y',4),
-(16,'n',3),(17,'r',2),(18,'v',1),(19,'p',0);
-
-CREATE TABLE t2 (
- pk INT, d VARCHAR(1), e INT,
- PRIMARY KEY(pk), KEY(d,e)
-) ENGINE=InnoDB;
-
-INSERT INTO t2 VALUES
-(1,'x',1),(2,'d',2),(3,'r',3),(4,'f',4),(5,'y',5),
-(6,'u',6),(7,'m',7),(8,'k',8),(9,'o',9),(10,'w',1),
-(11,'m',2),(12,'q',3),(13,'m',4),(14,'d',5),
-(15,'g',6),(16,'x',7),(17,'f',8);
-
-explain
-SELECT * FROM t1 WHERE b IN (
- SELECT d FROM t2, t1
- WHERE a = d AND ( pk < 2 OR d = 'z' )
-);
-SELECT * FROM t1 WHERE b IN (
- SELECT d FROM t2, t1
- WHERE a = d AND ( pk < 2 OR d = 'z' )
-);
-
-DROP TABLE t1, t2;
-
---echo #
---echo # BUG#951937: Wrong result (missing rows) with semijoin+materialization, IN subquery, InnoDB, TEMPTABLE view
---echo #
-CREATE TABLE t1 (
- a VARCHAR(1),
- b VARCHAR(1) NOT NULL,
- KEY(a)
-) ENGINE=InnoDB;
-INSERT INTO t1 VALUES
-('j','j'),('v','v'),('c','c'),('m','m'),('d','d'),
-('y','y'),('t','t'),('d','d'),('s','s'),('r','r'),
-('m','m'),('b','b'),('x','x'),('g','g'),('p','p'),
-('q','q'),('w','w'),('d','d'),('e','e');
-
-CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
-
---echo # This query returned 6 rows instead of 19
---sorted_result
-SELECT * FROM v1
-WHERE ( a, a ) IN (
- SELECT alias2.b, alias2.a
- FROM t1 AS alias1, t1 AS alias2
- WHERE alias2.b = alias1.a
- AND ( alias1.b >= alias1.a OR alias2.b = 'z' )
-);
-
---echo # Another testcase, without the VIEW:
-CREATE TABLE t2 (a VARCHAR(1), b VARCHAR(1) NOT NULL, KEY(a)) ENGINE=InnoDB;
-INSERT INTO t2 SELECT * FROM t1;
-INSERT INTO t2 SELECT * FROM t1;
-EXPLAIN
-SELECT * FROM t2
- WHERE (a, a) IN (SELECT alias2.b, alias2.a FROM t1 AS alias1, t1 AS alias2
- WHERE
- alias2.b = alias1.a AND
- (alias1.b >= alias1.a OR alias2.b = 'z'));
-
---sorted_result
-SELECT * FROM t2
- WHERE (a, a) IN (SELECT alias2.b, alias2.a FROM t1 AS alias1, t1 AS alias2
- WHERE
- alias2.b = alias1.a AND
- (alias1.b >= alias1.a OR alias2.b = 'z'));
-
-DROP VIEW v1;
-DROP TABLE t1, t2;
-
---echo #
---echo # BUG#965872: Server crashes in embedding_sjm on a simple 1-table select with AND and OR
---echo # (this is a regression caused by the fix for BUG#951937)
-CREATE TABLE t1 ( a INT, b INT, c INT, d INT );
-INSERT INTO t1 VALUES (4,2,8,9),(4,2,7,8);
-
-SELECT * FROM t1
-WHERE a = d AND ( b = 50 AND b = d OR a = c );
-DROP TABLE t1;
-
---echo #
---echo # BUG#951283: Wrong result (missing rows) with semijoin+firstmatch, IN/ANY subquery
---echo #
-set @tmp_951283=@@optimizer_prune_level;
-SET optimizer_prune_level=0;
-
-CREATE TABLE t1 ( a INT ) ENGINE=InnoDB;
-INSERT INTO t1 VALUES
- (10),(11),(12),(13),(14),(15),(16),
- (17),(18),(19),(20),(21),(22),(23);
-
-CREATE TABLE t2 (
- b INT PRIMARY KEY,
- c VARCHAR(1),
- d VARCHAR(1),
- KEY(c)
-) ENGINE=InnoDB;
-
-INSERT INTO t2 VALUES
- (1,'j','j'),(2,'v','v'),(3,'c','c'),(4,'m','m'),
- (5,'d','d'),(6,'d','d'),(7,'y','y'),(8,'t','t'),
- (9,'d','d'),(10,'s','s'),(11,'r','r'),(12,'m','m'),
- (13,'b','b'),(14,'x','x'),(15,'g','g'),(16,'p','p'),
- (17,'q','q'),(18,'w','w'),(19,'d','d');
-
-EXPLAIN
-SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3
-WHERE alias3.d IN (
- SELECT alias4.c FROM t2 AS alias4, t2 AS alias5
- WHERE alias5.b = alias4.b
- AND ( alias5.b >= alias3.b OR alias5.c != alias3.c )
-);
-
-SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3
-WHERE alias3.d IN (
- SELECT alias4.c FROM t2 AS alias4, t2 AS alias5
- WHERE alias5.b = alias4.b
- AND ( alias5.b >= alias3.b OR alias5.c != alias3.c )
-);
-
-# MDEV-8189 field<>const and const<>field are not symmetric
-# Do the same EXPLAIN SELECT and SELECT
-# with "alias3.c != alias5.c" instead of "alias5.c != alias3.c"
-
-EXPLAIN
-SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3
-WHERE alias3.d IN (
- SELECT alias4.c FROM t2 AS alias4, t2 AS alias5
- WHERE alias5.b = alias4.b
- AND ( alias5.b >= alias3.b OR alias3.c != alias5.c )
-);
-
-SELECT COUNT(*) FROM t1 AS alias1, t1 AS alias2, t2 AS alias3
-WHERE alias3.d IN (
- SELECT alias4.c FROM t2 AS alias4, t2 AS alias5
- WHERE alias5.b = alias4.b
- AND ( alias5.b >= alias3.b OR alias3.c != alias5.c )
-);
-
-set optimizer_prune_level=@tmp_951283;
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug mdev-5135: crash on semijoin with nested outer joins
---echo #
-
-CREATE TABLE t1 (i1 int) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE TABLE t2 (i2 int, INDEX(i2)) ENGINE=MyISAM;
-
-CREATE TABLE t3 (i3 int, c varchar(1), INDEX(i3), INDEX(c)) ENGINE=MyISAM;
-INSERT INTO t3 VALUES (3,'x'),(4,'y');
-
-SELECT * FROM t1 WHERE ( 1, 1 ) IN (
- SELECT i2, i2 FROM t2 LEFT OUTER JOIN (
- t3 AS t3a INNER JOIN t3 AS t3b ON ( t3a.i3 = t3b.i3 )
- ) ON ( t3a.c = t3b.c )
-);
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # MDEV-5582: Plugin 'MEMORY' has ref_count=1 after shutdown with materialization+semijoin
---echo #
-CREATE TABLE t1 (a INT) engine=innodb;
-INSERT INTO t1 VALUES (8),(9);
-
-CREATE TABLE t2 (b INT) engine=innodb;
-INSERT INTO t2 VALUES (2),(3);
-
-CREATE TABLE t3 (c INT, INDEX(c)) engine=innodb;
-INSERT INTO t2 VALUES (4),(5);
-
-explain
-SELECT * FROM t1 WHERE 9 IN ( SELECT b FROM t2 WHERE 1 IN ( SELECT MIN(c) FROM t3 ) );
-SELECT * FROM t1 WHERE 9 IN ( SELECT b FROM t2 WHERE 1 IN ( SELECT MIN(c) FROM t3 ) );
-
-DROP TABLE t1,t2,t3;
-
---source include/have_innodb.inc
-
---disable_warnings
-DROP TABLE IF EXISTS t1,t2,t3,t4;
---enable_warnings
-
---echo #
---echo # MDEV-4782: Valgrind warnings (Conditional jump or move depends on uninitialised value) with InnoDB, semijoin
---echo #
-CREATE TABLE t1 ( t1_pk1 varchar(3), t1_pk2 varchar(52), PRIMARY KEY (t1_pk1,t1_pk2)) ENGINE=InnoDB;
-INSERT INTO t1 VALUES ('CHN','Chinese'),('USA','English');
-
-CREATE TABLE t2 ( t2_i int(11), t2_c varchar(52)) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (86,'English');
-
-CREATE TABLE t3 ( t3_i int(11), t3_c varchar(35)) ENGINE=InnoDB;
-INSERT INTO t3 VALUES (3989,'Abilene'),(3873,'Akron');
-
-create table t4 like t1;
-insert into t4 select * from t1;
-
-SELECT * FROM t1, t3 WHERE t3_c IN ( SELECT t1_pk2 FROM t4, t2 WHERE t2_c = t1_pk2 AND t2_i >= t3_i ) AND ( t1_pk1 = 'POL' );
-
-explain
-SELECT * FROM t1, t3 WHERE t3_c IN ( SELECT t1_pk2 FROM t4, t2 WHERE t2_c = t1_pk2 AND t2_i >= t3_i ) AND ( t1_pk1 = 'POL' );
-
-DROP TABLE t1,t2,t3,t4;
-
---echo #
---echo # MDEV-6263: Wrong result when using IN subquery with order by
---echo #
-CREATE TABLE t1 (
- id int(11) NOT NULL,
- nombre varchar(255) NOT NULL,
- PRIMARY KEY (id)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-INSERT INTO t1 (id, nombre) VALUES
-(1, 'row 1'),(2, 'row 2'),(3, 'row 3'),
-(4, 'row 4'),(5, 'row 5'),(6, 'row 6');
-
-CREATE TABLE t2 (
- id_algo int(11) NOT NULL,
- id_agente int(11) NOT NULL,
- PRIMARY KEY (id_algo,id_agente),
- KEY another_data (id_agente)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-INSERT INTO t2 (id_algo, id_agente) VALUES
-(1, 1),(1, 2),(2, 1),(2, 2),(2, 3),(3, 1);
-
-SELECT * FROM t1 WHERE id in (select distinct id_agente from t2) ORDER BY nombre ASC;
-
-SELECT * FROM t1 WHERE id in (select distinct id_agente from t2);
-
-DROP TABLE t1, t2;
-
---echo #
---echo # MDEV-7474: Semi-Join's DuplicateWeedout strategy skipped for some values of optimizer_search_depth
---echo #
-
-CREATE TABLE t1 (
- t1id BIGINT(20) NOT NULL,
- code VARCHAR(20),
- PRIMARY KEY (t1id)
-) COLLATE='utf8mb4_bin' ENGINE=InnoDB;
-
-CREATE TABLE t2 (
- t2id BIGINT(20) NOT NULL,
- t1idref BIGINT(20) NOT NULL,
- code VARCHAR(20),
- PRIMARY KEY (t2id),
- INDEX FK_T2_T1Id (t1idref),
- CONSTRAINT FK_T2_T1Id FOREIGN KEY (t1idref) REFERENCES t1 (t1id)
-) COLLATE='utf8mb4_bin' ENGINE=InnoDB;
-
-CREATE TABLE t3 (
- t3idref BIGINT(20) NOT NULL,
- t2idref BIGINT(20) NOT NULL,
- sequencenumber INT(10) NOT NULL,
- PRIMARY KEY (t3idref, t2idref),
- INDEX FK_T3_T2Id (t2idref),
- CONSTRAINT FK_T3_T2Id FOREIGN KEY (t2idref) REFERENCES t2 (t2id)
-) COLLATE='utf8mb4_bin' ENGINE=InnoDB;
-
-# Load up dummy data (needed to reproduce issue)
-INSERT INTO t1 (t1id) VALUES (100001),(100017),(100018),(100026),(100027),(100028),(100029),(100030),
-(100031),(100032),(100033),(100034),(100035),(100036),(100037),(100038),(100040),(100041),(100042),
-(100043),(100044),(100045),(100046),(100047);
-
-INSERT IGNORE INTO t2 (t2id, t1idref) SELECT t1id, t1id FROM t1;
-
-# Now the test Data
-INSERT IGNORE INTO t1 VALUES (200001, 'a');
-INSERT IGNORE INTO t2 (t2id, t1idref) VALUES (200011, 200001),(200012, 200001),(200013, 200001);
-INSERT IGNORE INTO t3 VALUES (1, 200011, 1), (1, 200012, 2), (1, 200013, 3);
-
-set @tmp7474= @@optimizer_search_depth;
-SET SESSION optimizer_search_depth = 1;
-
-let $query=
-SELECT SQL_NO_CACHE
-T2_0_.t1idref,
-T2_0_.t2id
-FROM
- t2 T2_0_
-WHERE
- T2_0_.t1idref IN (
- SELECT
- T1_1_.t1id
- FROM
- t3 T3_0_
- INNER JOIN
- t2 T2_1_
- ON T3_0_.t2idref=T2_1_.t2id
- INNER JOIN
- t1 T1_1_
- ON T2_1_.t1idref=T1_1_.t1id
- WHERE
- T3_0_.t3idref= 1
-);
-
-eval $query;
-eval explain $query;
-
-drop table t3,t2,t1;
-set optimizer_search_depth=@tmp7474;
-
---echo #
---echo #
---echo #
-CREATE TABLE t1 (
- id int(16) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
-CREATE TABLE t2 (
- id int(16) NOT NULL AUTO_INCREMENT,
- t3_id int(16) NOT NULL DEFAULT '0',
- t1_id int(16) NOT NULL DEFAULT '0',
- PRIMARY KEY (id),
- KEY t3_idx (t3_id),
- KEY t1_idx (t1_id)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-
-CREATE TABLE t3 (
- id int(16) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (id)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-
-
-INSERT INTO t3 VALUES (1);
-
-INSERT INTO t2 VALUES (1, 1, 1);
-INSERT INTO t2 VALUES (2, 1, 2);
-INSERT INTO t2 VALUES (3, 1, 2);
-INSERT INTO t2 VALUES (4, 1, 1);
-
-INSERT INTO t1 VALUES (1);
-INSERT INTO t1 VALUES (2);
-
-SELECT * FROM t1 WHERE t1.id IN (
- SELECT t2.t1_id FROM t3 JOIN t2 ON t3.id = t2.t3_id WHERE t3.id = 1
-);
-
-drop table t1,t2,t3;
-
---echo #
---echo # MDEV-11108: Assertion `uniq_tuple_length_arg <= table->file->max_key_length()' failed in SJ_TMP_TABLE::create_sj_weedout_tmp_table
---echo #
-
-CREATE TABLE t1 (a INT) ENGINE=InnoDB;
-CREATE TABLE t2 (pk BLOB, b INT, PRIMARY KEY(pk(1000))) ENGINE=InnoDB;
-CREATE TABLE t3 (c INT) ENGINE=InnoDB;
-CREATE OR REPLACE ALGORITHM=MERGE VIEW v3 AS SELECT * FROM t3;
-
-INSERT INTO t3 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
-SELECT * FROM t1, t2
-WHERE a IN ( SELECT b FROM t2 LEFT JOIN v3 ON ( c = b ) ) ;
-DROP TABLE t1,t2,t3;
-DROP VIEW v3;
-
---echo # This must be the last in the file:
-set optimizer_switch=@subselect_sj2_tmp;
diff --git a/mysql-test/t/subselect_sj2_jcl6.test b/mysql-test/t/subselect_sj2_jcl6.test
deleted file mode 100644
index fbc474f7067..00000000000
--- a/mysql-test/t/subselect_sj2_jcl6.test
+++ /dev/null
@@ -1,113 +0,0 @@
-#
-# Run subselect_sj2.test with BKA enabled
-#
-
-set @save_optimizer_switch_jcl6=@@optimizer_switch;
-set @@optimizer_switch='optimize_join_buffer_size=on';
-set @@optimizer_switch='semijoin_with_cache=on';
-set @@optimizer_switch='outer_join_with_cache=on';
-set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
-
-set join_cache_level=6;
-show variables like 'join_cache_level';
-
-set @optimizer_switch_for_subselect_sj2_test=@@optimizer_switch;
-set @join_cache_level_for_subselect_sj2_test=@@join_cache_level;
-
---source t/subselect_sj2.test
-
---echo #
---echo # Bug #898073: potential incremental join cache for semijoin
---echo #
-
-CREATE TABLE t1 (a int, b varchar(1), KEY (b,a));
-INSERT INTO t1 VALUES (0,'x'), (5,'r');
-
-CREATE TABLE t2 (a int) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (8);
-
-CREATE TABLE t3 (b varchar(1), c varchar(1)) ENGINE=InnoDB;
-INSERT INTO t3 VALUES ('x','x');
-
-CREATE TABLE t4 (a int NOT NULL, b varchar(1)) ENGINE=InnoDB;
-INSERT INTO t4 VALUES (20,'r'), (10,'x');
-
-set @tmp_optimizer_switch=@@optimizer_switch;
-
-SET SESSION optimizer_switch='semijoin_with_cache=on';
-
-SET SESSION join_cache_level=2;
-EXPLAIN
-SELECT t3.* FROM t1 JOIN t3 ON t3.b = t1.b
- WHERE c IN (SELECT t4.b FROM t4 JOIN t2);
-SELECT t3.* FROM t1 JOIN t3 ON t3.b = t1.b
- WHERE c IN (SELECT t4.b FROM t4 JOIN t2);
-
-set optimizer_switch=@tmp_optimizer_switch;
-set join_cache_level=default;
-
-DROP TABLE t1,t2,t3,t4;
-
---echo #
---echo # Bug #899696: potential incremental join cache for semijoin
---echo #
-
-CREATE TABLE t1 (pk int PRIMARY KEY, a int);
-INSERT INTO t1 VALUES (1, 6), (2, 8);
-CREATE TABLE t2 (b int) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (8);
-CREATE TABLE t3 (pk int PRIMARY KEY, a int);
-INSERT INTO t3 VALUES (1, 6), (2, 8);
-CREATE TABLE t4 (b int) ENGINE=InnoDB;
-INSERT INTO t4 VALUES (2);
-
-set @tmp_optimizer_switch=@@optimizer_switch;
-
-SET optimizer_switch = 'semijoin_with_cache=on';
-SET join_cache_level = 2;
-
-EXPLAIN
-SELECT * FROM t1, t2 WHERE b IN (SELECT a FROM t3, t4 WHERE b = pk);
-SELECT * FROM t1, t2 WHERE b IN (SELECT a FROM t3, t4 WHERE b = pk);
-
-set optimizer_switch=@tmp_optimizer_switch;
-set join_cache_level=default;
-
-DROP TABLE t1,t2,t3,t4;
-
-
---echo #
---echo # Bug #899962: materialized subquery with join_cache_level=3
---echo #
-
-CREATE TABLE t1 (a varchar(1), b varchar(1)) ENGINE=InnoDB;
-INSERT INTO t1 VALUES ('v','v');
-CREATE TABLE t2 (a varchar(1), b varchar(1)) ENGINE=InnoDB;
-INSERT INTO t2 VALUES ('v','v');
-
-set @tmp_optimizer_switch=@@optimizer_switch;
-
-SET optimizer_switch = 'semijoin_with_cache=on';
-SET join_cache_level = 3;
-
-EXPLAIN
-SELECT * FROM t1 WHERE b IN (SELECT a FROM t2 GROUP BY a);
-SELECT * FROM t1 WHERE b IN (SELECT a FROM t2 GROUP BY a);
-
-EXPLAIN
-SELECT * FROM t1 WHERE b IN (SELECT max(a) FROM t2 GROUP BY a);
-SELECT * FROM t1 WHERE b IN (SELECT max(a) FROM t2 GROUP BY a);
-
-set optimizer_switch=@tmp_optimizer_switch;
-set join_cache_level=default;
-
-DROP TABLE t1,t2;
-
-
-set join_cache_level=default;
-show variables like 'join_cache_level';
-
-set @@optimizer_switch=@save_optimizer_switch_jcl6;
-set @optimizer_switch_for_subselect_sj2_test=NULL;
-set @join_cache_level_subselect_sj2_test=NULL;
-
diff --git a/mysql-test/t/subselect_sj2_mat.test b/mysql-test/t/subselect_sj2_mat.test
deleted file mode 100644
index cfb6c8c2819..00000000000
--- a/mysql-test/t/subselect_sj2_mat.test
+++ /dev/null
@@ -1,305 +0,0 @@
-#
-# Run subselect_sj2.test with subquery materialization.
-#
-set optimizer_switch='materialization=on';
-set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
-
---source t/subselect_sj2.test
-
-set optimizer_switch=default;
-select @@optimizer_switch like '%materialization=on%';
-
---echo #
---echo # BUG#906385: EXPLAIN EXTENDED crashes in TABLE_LIST::print with limited max_join_size
---echo #
-CREATE TABLE t1 ( a INT );
-CREATE TABLE t2 ( b INT );
-
-INSERT INTO t1 VALUES (1),(2);
-INSERT INTO t2 VALUES
- (1),(2),(3),(4),(5),
- (6),(7),(8),(9),(10),
- (11),(12),(13),(14),(15),
- (16),(17),(18),(19),(20);
-
-set @tmp_906385=@@max_join_size;
-SET max_join_size = 80;
-
---error ER_TOO_BIG_SELECT
-EXPLAIN EXTENDED
-SELECT COUNT(*) FROM t1
-WHERE a IN
- ( SELECT b FROM t2 GROUP BY b )
- AND ( 6 ) IN
- ( SELECT MIN( t2.b ) FROM t2 alias1, t2 );
-
-DROP TABLE t1, t2;
-set max_join_size= @tmp_906385;
-
---echo #
---echo # mdev-3995: Wrong result for semijoin with materialization
---echo #
-
-set @save_optimizer_switch=@@optimizer_switch;
-
-CREATE TABLE t1 (
- cat_id int(10) unsigned NOT NULL,
- PRIMARY KEY (cat_id)
-) ENGINE=MyISAM;
-
-INSERT INTO t1 VALUES
-(709411),(709412),(709413),(709414),(709416),(709417),(709418),(709419),(709421),(709422),
-(709424),(709425),(709427),(709428),(709429),(709431),(709432),(709433),(709434),(709435),
-(709438),(709439),(709441),(709442),(709443),(709444),(709445),(709446),(709447),(709450),
-(709451),(709454),(709455),(709456),(709457),(709459),(709460),(709461),(709462),(709463),
-(709464),(709465),(709467),(709469),(709470),(709471),(709472),(709473),(709474),(709475),
-(709476),(709477),(709478),(709479),(709480),(709481),(709483),(709484),(709485),(709487),
-(709490),(709491),(709492),(709493),(709494),(709495),(709496),(709497),(709498),(709499),
-(709500),(709501),(709502),(709503),(709504),(709505),(709506),(709507),(709509),(709510),
-(709511),(709512),(709513),(709514),(709515),(709516),(709517),(709518),(709519),(709520),
-(709521),(709522),(709523),(709524),(709525),(709526),(709527),(709528),(709529),(709530),
-(709531),(709532),(709533),(709534),(709535),(709536),(709537),(709538),(709539),(709540),
-(709541),(709542),(709543),(709544),(709545),(709546),(709548),(709549),(709551),(709552),
-(709553),(709555),(709556),(709557),(709558),(709559),(709560),(709561),(709562),(709563),
-(709564),(709565),(709566),(709567),(709568),(709569),(709570),(709571),(709572),(709573),
-(709574),(709575),(709576),(709577),(709578),(709579),(709580),(709581),(709582),(709583),
-(709584),(709585),(709586),(709587),(709588),(709590),(709591),(709592),(709593),(709594),
-(709595),(709596),(709597),(709598),(709600),(709601),(709602),(709603),(709604),(709605),
-(709606),(709608),(709609),(709610),(709611),(709612),(709613),(709614),(709615),(709616),
-(709617),(709618),(709619),(709620),(709621),(709622),(709623),(709624),(709625),(709626),
-(709627),(709628),(709629),(709630),(709631),(709632),(709633),(709634),(709635),(709637),
-(709638),(709639),(709640),(709641),(709642),(709643),(709644),(709645),(709646),(709649),
-(709650),(709651),(709652),(709653),(709654),(709655),(709656),(709657),(709658),(709659);
-
-CREATE TABLE t2 (
- cat_id int(10) NOT NULL,
- KEY cat_id (cat_id)
-) ENGINE=MyISAM;
-
-INSERT INTO t2 VALUES
-(708742),(708755),(708759),(708761),(708766),(708769),(708796),(708798),(708824),(708825),
-(708838),(708844),(708861),(708882),(708887),(708889),(708890),(709586),(709626);
-
-CREATE TABLE t3 (
- sack_id int(10) unsigned NOT NULL,
- kit_id tinyint(3) unsigned NOT NULL DEFAULT '0',
- cat_id int(10) unsigned NOT NULL,
- PRIMARY KEY (sack_id,kit_id,cat_id)
-) ENGINE=MyISAM;
-
-INSERT INTO t3 VALUES
-(33479,6,708523),(33479,6,708632),(33479,6,709085),(33479,6,709586),(33479,6,709626);
-
-CREATE TABLE t4 (
- cat_id int(10) unsigned NOT NULL,
- KEY cat_id (cat_id)
-) ENGINE=MyISAM;
-
-INSERT INTO t4 (cat_id) SELECT cat_id from t2;
-
-set optimizer_switch='materialization=off';
-
-EXPLAIN
-SELECT count(*) FROM t1, t3
- WHERE t1.cat_id = t3.cat_id AND
- t3.cat_id IN (SELECT cat_id FROM t2) AND
- t3.sack_id = 33479 AND t3.kit_id = 6;
-
-SELECT count(*) FROM t1, t3
- WHERE t1.cat_id = t3.cat_id AND
- t3.cat_id IN (SELECT cat_id FROM t2) AND
- t3.sack_id = 33479 AND t3.kit_id = 6;
-
-set optimizer_switch='materialization=on';
-
-EXPLAIN
-SELECT count(*) FROM t1, t3
- WHERE t1.cat_id = t3.cat_id AND
- t3.cat_id IN (SELECT cat_id FROM t4) AND
- t3.sack_id = 33479 AND t3.kit_id = 6;
-
-SELECT count(*) FROM t1, t3
- WHERE t1.cat_id = t3.cat_id AND
- t3.cat_id IN (SELECT cat_id FROM t4) AND
- t3.sack_id = 33479 AND t3.kit_id = 6;
-
-EXPLAIN
-SELECT count(*) FROM t1, t3
- WHERE t1.cat_id = t3.cat_id AND
- t3.cat_id IN (SELECT cat_id FROM t2) AND
- t3.sack_id = 33479 AND t3.kit_id = 6;
-
-SELECT count(*) FROM t1, t3
- WHERE t1.cat_id = t3.cat_id AND
- t3.cat_id IN (SELECT cat_id FROM t2) AND
- t3.sack_id = 33479 AND t3.kit_id = 6;
-
-
-DROP TABLE t1,t2,t3,t4;
-
-set optimizer_switch=@save_optimizer_switch;
-
---echo #
---echo # mdev-3913: LEFT JOIN with materialized multi-table IN subquery in WHERE
---echo #
-
-set @save_optimizer_switch=@@optimizer_switch;
-
-CREATE TABLE t1 (a1 char(1), b1 char(1), index idx(b1,a1));
-INSERT INTO t1 VALUES ('f','c'),('d','m'),('g','y');
-INSERT INTO t1 VALUES ('f','c'),('d','m'),('g','y');
-
-CREATE TABLE t2 (a2 char(1), b2 char(1));
-INSERT INTO t2 VALUES ('y','y'),('y','y'),('w','w');
-
-CREATE TABLE t3 (a3 int);
-INSERT INTO t3 VALUES (8),(6);
-
-CREATE TABLE t4 (a4 char(1), b4 char(1));
-INSERT INTO t4 VALUES ('y','y'),('y','y'),('w','w');
-
-set optimizer_switch='materialization=off';
-
-EXPLAIN EXTENDED
-SELECT * FROM t1 LEFT JOIN t2 ON ( b1 = a2 )
- WHERE ( b1, b1 ) IN ( SELECT a4, b4 FROM t3, t4);
-SELECT * FROM t1 LEFT JOIN t2 ON ( b1 = a2 )
- WHERE ( b1, b1 ) IN ( SELECT a4, b4 FROM t3, t4);
-
-set optimizer_switch='materialization=on';
-
-EXPLAIN EXTENDED
-SELECT * FROM t1 LEFT JOIN t2 ON ( b1 = a2 )
- WHERE ( b1, b1 ) IN ( SELECT a4, b4 FROM t3, t4);
-SELECT * FROM t1 LEFT JOIN t2 ON ( b1 = a2 )
- WHERE ( b1, b1 ) IN ( SELECT a4, b4 FROM t3, t4);
-
-DROP TABLE t1,t2,t3,t4;
-
-set optimizer_switch=@save_optimizer_switch;
-
---echo #
---echo # mdev-4172: LEFT JOIN with materialized multi-table IN subquery in WHERE
---echo # and OR in ON condition
---echo #
-
-set @save_optimizer_switch=@@optimizer_switch;
-
-CREATE TABLE t1 (a1 int, c1 varchar(1));
-INSERT t1 VALUES (7,'v'), (3,'y');
-
-CREATE TABLE t2 (c2 varchar(1));
-INSERT INTO t2 VALUES ('y'), ('y');
-
-CREATE TABLE t3 (c3 varchar(1));
-INSERT INTO t3 VALUES
- ('j'), ('v'), ('c'), ('m'), ('d'),
- ('d'), ('y'), ('t'), ('d'), ('s');
-
-CREATE TABLE t4 (a4 int, c4 varchar(1));
-INSERT INTO t4 SELECT * FROM t1;
-
-set optimizer_switch='materialization=off';
-
-EXPLAIN EXTENDED
-SELECT * FROM t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z')
- WHERE c1 IN ( SELECT c4 FROM t3,t4 WHERE c3 = c4);
-SELECT * FROM t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z')
- WHERE c1 IN ( SELECT c4 FROM t3,t4 WHERE c3 = c4);
-
-set optimizer_switch='materialization=on';
-
-EXPLAIN EXTENDED
-SELECT * FROM t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z')
- WHERE c1 IN ( SELECT c4 FROM t3,t4 WHERE c3 = c4);
-SELECT * FROM t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z')
- WHERE c1 IN ( SELECT c4 FROM t3,t4 WHERE c3 = c4);
-
-DROP TABLE t1,t2,t3,t4;
-
-set optimizer_switch=@save_optimizer_switch;
-
---echo #
---echo # mdev-4177: materialization of a subquery whose WHERE condition is OR
---echo # formula with two disjucts such that the second one is always false
---echo #
-
-set @save_optimizer_switch=@@optimizer_switch;
-set @save_join_cache_level=@@join_cache_level;
-
-CREATE TABLE t1 (i1 int) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1), (7), (4), (8), (4);
-
-CREATE TABLE t2 (i2 int) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (7), (5);
-
-CREATE TABLE t3 (i3 int) ENGINE=MyISAM;
-INSERT INTO t3 VALUES (7), (2), (9);
-
-set join_cache_level=3;
-
-set optimizer_switch='materialization=off,semijoin=off';
-
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2);
-SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2);
-
-set optimizer_switch='materialization=on,semijoin=on';
-
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2);
-SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2);
-
-EXPLAIN EXTENDED
-SELECT * FROM t1
- WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 > 0 AND i3 = i2 OR 1=2);
-SELECT * FROM t1
- WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 > 0 AND i3 = i2 OR 1=2);
-SELECT * FROM t1
- WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 > 7 AND i3 = i2 OR 1=2);
-
-DROP TABLE t1,t2,t3;
-
-set join_cache_level= @save_join_cache_level;
-set optimizer_switch=@save_optimizer_switch;
-
---echo #
---echo # mdev-7791: materialization of a semi-join subquery +
---echo # RAND() in WHERE
---echo # (materialized table is accessed last)
---echo #
-
-set @save_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='materialization=on';
-
-create table t1(i int);
-insert into t1 values (1), (2), (3), (7), (9), (10);
-create table t2(i int);
-insert into t2 values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
-
-select * from t1 where (rand() < 0) and i in (select i from t2);
-explain extended
-select * from t1 where (rand() < 0) and i in (select i from t2);
-
-drop table t1,t2;
-set optimizer_switch=@save_optimizer_switch;
-
---echo #
---echo # mdev-12855: materialization of a semi-join subquery + ORDER BY
---echo #
-
-CREATE TABLE t1 (f1 varchar(8), KEY(f1)) ENGINE=InnoDB;
-INSERT INTO t1 VALUES ('qux'),('foo');
-CREATE TABLE t2 (f2 varchar(8)) ENGINE=InnoDB;
-INSERT INTO t2 VALUES ('bar'),('foo'),('qux');
-
-let $q=
-SELECT f1 FROM t1
-WHERE f1 IN ( SELECT f2 FROM t2 WHERE f2 > 'bar' )
-HAVING f1 != 'foo'
-ORDER BY f1;
-
-eval $q;
-eval explain $q;
-
-DROP TABLE t1,t2;
diff --git a/mysql-test/t/subselect_sj_aria.test b/mysql-test/t/subselect_sj_aria.test
deleted file mode 100644
index 806688b3f87..00000000000
--- a/mysql-test/t/subselect_sj_aria.test
+++ /dev/null
@@ -1,76 +0,0 @@
-#
-# Semi-join tests that require Aria
-#
---disable_warnings
-drop table if exists t1,t2,t3,t4;
---enable_warnings
-
-
---echo #
---echo # BUG#887468: Second assertion `keypart_map' failed in maria_rkey with semijoin
---echo #
-
-CREATE TABLE t1 (
- pk int(11) NOT NULL AUTO_INCREMENT,
- col_int_key int(11) DEFAULT NULL,
- col_varchar_key varchar(1) DEFAULT NULL,
- dummy char(30),
- PRIMARY KEY (pk),
- KEY col_varchar_key (col_varchar_key,col_int_key)
-) ENGINE=Aria AUTO_INCREMENT=30 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1;
-
-INSERT INTO t1 (pk, col_varchar_key, col_int_key) VALUES
-(10,NULL,0), (11,'d',4), (12,'g',8), (13,'x',NULL), (14,'f',NULL),
-(15,'p',0), (16,'j',NULL), (17,'c',8), (18,'z',8), (19,'j',6), (20,NULL,2),
-(21,'p',3), (22,'w',1), (23,'c',NULL), (24,'j',1), (25,'f',10), (26,'v',2),
-(27,'f',103), (28,'q',3), (29,'y',6);
-
-CREATE TABLE t2 (
- pk int(11) NOT NULL AUTO_INCREMENT,
- col_int_key int(11) DEFAULT NULL,
- dummy char(36),
- PRIMARY KEY (pk),
- KEY col_int_key (col_int_key)
-) ENGINE=Aria AUTO_INCREMENT=101 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1;
-
-INSERT INTO t2 ( pk, col_int_key) VALUES
-(1,8), (2,2), (3,9), (4,6), (5,NULL), (6,NULL), (7,48), (8,228), (9,3), (10,5),
-(11,39), (12,6), (13,8), (14,3), (15,NULL), (16,2), (17,6), (18,3), (19,1), (20,4),
-(21,3), (22,1), (23,NULL), (24,97), (25,0), (26,0), (27,9), (28,5), (29,9), (30,0),
-(31,2), (32,172), (33,NULL), (34,5), (35,119), (36,1), (37,4), (38,8), (39,NULL), (40,6),
-(41,5), (42,5), (43,1), (44,7), (45,2), (46,8), (47,9), (48,NULL), (49,NULL), (50,3),
-(51,172), (52,NULL), (53,6), (54,6), (55,5), (56,4), (57,3), (58,2), (59,7), (60,4),
-(61,6), (62,0), (63,8), (64,5), (65,8), (66,2), (67,9), (68,7), (69,5), (70,7),
-(71,0), (72,4), (73,3), (74,1), (75,0), (76,6), (77,2), (78,NULL), (79,8), (80,NULL),
-(81,NULL), (82,NULL), (83,3), (84,7), (85,3), (86,5), (87,5), (88,1), (89,2), (90,1),
-(91,7), (92,1), (93,9), (94,9), (95,8), (96,3), (97,7), (98,4), (99,9), (100,0);
-
-CREATE TABLE t3 (
- pk int(11) NOT NULL AUTO_INCREMENT,
- dummy char(34),
- col_varchar_key varchar(1) DEFAULT NULL,
- col_int_key int(11) DEFAULT NULL,
- PRIMARY KEY (pk),
- KEY col_varchar_key (col_varchar_key,col_int_key)
-) ENGINE=Aria AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1;
-
-INSERT INTO t3 (pk, col_varchar_key) VALUES (1,'v'), (2,'c'), (3,NULL);
-
-CREATE TABLE t4 (
- pk int(11) NOT NULL AUTO_INCREMENT,
- dummy char (38),
- PRIMARY KEY (pk)
-) ENGINE=Aria AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1;
-
-INSERT INTO t4 (pk) VALUES (1), (2), (3);
-
-SELECT *
-FROM t1
-JOIN t2
-ON ( t2.col_int_key = t1.pk )
-WHERE t1.col_varchar_key IN (
- SELECT t3.col_varchar_key FROM t3, t4
-);
-
-drop table t1, t2, t3, t4;
-
diff --git a/mysql-test/t/subselect_sj_jcl6.test b/mysql-test/t/subselect_sj_jcl6.test
deleted file mode 100644
index e86ed017951..00000000000
--- a/mysql-test/t/subselect_sj_jcl6.test
+++ /dev/null
@@ -1,216 +0,0 @@
-#
-# Run subselect_sj.test with BKA enabled
-#
-
-set @save_optimizer_switch_jcl6=@@optimizer_switch;
-set @@optimizer_switch='optimize_join_buffer_size=on';
-set @@optimizer_switch='semijoin=on,firstmatch=on,loosescan=on';
-set @@optimizer_switch='semijoin_with_cache=on';
-set @@optimizer_switch='outer_join_with_cache=on';
-set @@optimizer_switch='join_cache_hashed=off';
-set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
-
-set join_cache_level=6;
-show variables like 'join_cache_level';
-
-set @optimizer_switch_for_subselect_sj_test=@@optimizer_switch;
-set @join_cache_level_for_subselect_sj_test=@@join_cache_level;
-
---source t/subselect_sj.test
-
---echo #
---echo # BUG#49129: Wrong result with IN-subquery with join_cache_level=6 and firstmatch=off
---echo #
-CREATE TABLE t0 (a INT);
-INSERT INTO t0 VALUES (0),(1),(2),(3),(4);
-CREATE TABLE t1 (a INT, b INT, KEY(a));
-INSERT INTO t1 SELECT a, a from t0;
-INSERT INTO t1 SELECT a+5, a from t0;
-INSERT INTO t1 SELECT a+10, a from t0;
-CREATE TABLE t2 (a INT, b INT, PRIMARY KEY(a));
-INSERT INTO t2 SELECT * FROM t1;
-UPDATE t1 SET a=3, b=11 WHERE a=4;
-UPDATE t2 SET b=11 WHERE a=3;
-
-set @save_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='firstmatch=off';
-
---echo The following should use a join order of t0,t1,t2, with DuplicateElimination:
-explain
-SELECT * FROM t0 WHERE t0.a IN
- (SELECT t1.a FROM t1, t2 WHERE t2.a=t0.a AND t1.b=t2.b);
-
-SELECT * FROM t0 WHERE t0.a IN
- (SELECT t1.a FROM t1, t2 WHERE t2.a=t0.a AND t1.b=t2.b);
-
-set optimizer_switch=@save_optimizer_switch;
-drop table t0, t1, t2;
-
---echo #
---echo # Bug #891995: IN subquery with join_cache_level >= 3
---echo #
-
-CREATE TABLE t1 (a varchar(1));
-INSERT INTO t1 VALUES ('w'),('q');
-
-CREATE TABLE t2 (a int NOT NULL, b time, PRIMARY KEY (a));
-INSERT INTO t2 VALUES
- (2,'18:56:33'), (5,'19:11:10'), (3,'18:56:33'), (7,'19:11:10');
-
-CREATE TABLE t3 (
- a int NOT NULL, b int, c int, d varchar(1), PRIMARY KEY (a), KEY (d,c)
-);
-INSERT INTO t3 VALUES
- (25,158,10,'f'), (26,5,2,'v'), (27,163,103,'f'), (28,2,3,'q'), (29,8,6,'y');
-
-set @save_optimizer_switch=@@optimizer_switch;
-SET SESSION optimizer_switch='semijoin=on';
-
-SET SESSION optimizer_switch='join_cache_hashed=on';
-SET SESSION join_cache_level=3;
-EXPLAIN
-SELECT * FROM t1, t2
- WHERE t2.a IN (SELECT b FROM t3 WHERE t3.d <= t1.a);
-SELECT * FROM t1, t2
- WHERE t2.a IN (SELECT b FROM t3 WHERE t3.d <= t1.a);
-
-
-SET SESSION optimizer_switch='mrr=on';
-SET SESSION join_cache_level=6;
-EXPLAIN
-SELECT * FROM t1, t2
- WHERE t2.a IN (SELECT b FROM t3 WHERE t3.d <= t1.a);
-SELECT * FROM t1, t2
- WHERE t2.a IN (SELECT b FROM t3 WHERE t3.d <= t1.a);
-
-set optimizer_switch=@save_optimizer_switch;
-set join_cache_level=default;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # BUG#912513: Wrong result (missing rows) with join_cache_hashed+materialization+semijoin=on
---echo #
-set @os_912513= @@optimizer_switch;
-set @jcl_912513= @@join_cache_level;
-SET optimizer_switch = 'semijoin=on,materialization=on,join_cache_hashed=on';
-SET join_cache_level = 3;
-
-CREATE TABLE t1 ( a INT, b INT, KEY(a) );
-INSERT INTO t1 VALUES
- (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7);
-
-CREATE TABLE t2 ( c INT );
-INSERT INTO t2 VALUES (1),(2),(3),(4),(5),(6),(7);
-
-SELECT alias1.* FROM
- t1 AS alias1 INNER JOIN t1 AS alias2
- ON alias2.a = alias1.b
-WHERE alias1.b IN (
- SELECT a FROM t1, t2
- );
-
-DROP table t1, t2;
-set @@optimizer_switch= @os_912513;
-set @@join_cache_level= @jcl_912513;
-
---echo # End
-
---echo #
---echo # BUG#934342: outer join + semijoin materialization
---echo # + join_cache_level > 2
---echo #
-
-CREATE TABLE t1 (a varchar(1), b varchar(1), INDEX idx_a(a) );
-INSERT INTO t1 VALUES ('v','v'), ('w','w'), ('t','t');
-
-CREATE TABLE t2 (c varchar(1), INDEX idx_c(c) );
-INSERT INTO t2 VALUES ('v'), ('v'), ('s'), ('j');
-
-CREATE TABLE t3 (c varchar(1), d varchar(1), INDEX idx_c(c) );
-INSERT INTO t3 VALUES ('v','v'), ('v','v'), ('s','s'), ('j','j');
-INSERT INTO t3 VALUES ('m','m'), ('d','d'), ('k','k'), ('m','m');
-
-set @tmp_otimizer_switch= @@optimizer_switch;
-set @tmp_join_cache_level=@@join_cache_level;
-set optimizer_switch = 'materialization=on,semijoin=on,join_cache_hashed=on';
-
-set join_cache_level=0;
-
-EXPLAIN
-SELECT * FROM t1 LEFT JOIN t2 ON (c = b)
- WHERE (a, b) IN (SELECT a, b FROM t1 t);
-SELECT * FROM t1 LEFT JOIN t2 ON (c = b)
- WHERE (a, b) IN (SELECT a, b FROM t1 t);
-
-EXPLAIN
-SELECT * FROM t1 LEFT JOIN t3 ON (c = b)
- WHERE (a, b) IN (SELECT a, b FROM t1 t);
-SELECT * FROM t1 LEFT JOIN t3 ON (c = b)
- WHERE (a, b) IN (SELECT a, b FROM t1 t);
-
-set join_cache_level=6;
-
-EXPLAIN
-SELECT * FROM t1 LEFT JOIN t2 ON (c = b)
- WHERE (a, b) IN (SELECT a, b FROM t1 t);
-SELECT * FROM t1 LEFT JOIN t2 ON (c = b)
- WHERE (a, b) IN (SELECT a, b FROM t1 t);
-
-EXPLAIN
-SELECT * FROM t1 LEFT JOIN t3 ON (c = b)
- WHERE (a, b) IN (SELECT a, b FROM t1 t);
-SELECT * FROM t1 LEFT JOIN t3 ON (c = b)
- WHERE (a, b) IN (SELECT a, b FROM t1 t);
-
-set optimizer_switch=@tmp_optimizer_switch;
-set join_cache_level=@tmp_join_cache_level;
-
-DROP TABLE t1,t2,t3;
-
---echo # End
-
---echo #
---echo # BUG#934348: GROUP BY with HAVING + semijoin materialization
---echo # + join_cache_level > 2
---echo #
-
-CREATE TABLE t1 (a varchar(1), INDEX idx_a(a));
-INSERT INTO t1 VALUES ('c'), ('v'), ('c');
-
-CREATE TABLE t2 (b varchar(1));
-INSERT INTO t2 VALUES ('v'), ('c');
-
-set @tmp_otimizer_switch= @@optimizer_switch;
-set @tmp_join_cache_level=@@join_cache_level;
-set optimizer_switch = 'materialization=on,semijoin=on,join_cache_hashed=on';
-
-set join_cache_level=0;
-
-EXPLAIN
-SELECT a FROM t1 t WHERE a IN (SELECT b FROM t1, t2 WHERE b = a)
- GROUP BY a HAVING a != 'z';
-SELECT a FROM t1 t WHERE a IN (SELECT b FROM t1, t2 WHERE b = a)
- GROUP BY a HAVING a != 'z';
-
-set join_cache_level=6;
-
-EXPLAIN
-SELECT a FROM t1 t WHERE a IN (SELECT b FROM t1, t2 WHERE b = a)
- GROUP BY a HAVING a != 'z';
-SELECT a FROM t1 t WHERE a IN (SELECT b FROM t1, t2 WHERE b = a)
- GROUP BY a HAVING a != 'z';
-
-set optimizer_switch=@tmp_optimizer_switch;
-set join_cache_level=@tmp_join_cache_level;
-
-DROP TABLE t1,t2;
-
---echo # End
-
-set join_cache_level=default;
-show variables like 'join_cache_level';
-
-set @@optimizer_switch=@save_optimizer_switch_jcl6;
-set @optimizer_switch_for_subselect_sj_test=NULL;
-set @join_cache_level_subselect_sj_test=NULL;
diff --git a/mysql-test/t/subselect_sj_mat.test b/mysql-test/t/subselect_sj_mat.test
deleted file mode 100644
index bfd3b28a5b2..00000000000
--- a/mysql-test/t/subselect_sj_mat.test
+++ /dev/null
@@ -1,2239 +0,0 @@
-#
-# Hash semi-join regression tests
-# (WL#1110: Subquery optimization: materialization)
-#
-
-set @subselect_sj_mat_tmp= @@optimizer_switch;
-set optimizer_switch=ifnull(@subselect_mat_test_optimizer_switch_value, 'semijoin=on,firstmatch=on,loosescan=on,semijoin_with_cache=on');
-set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
-set @optimizer_switch_local_default= @@optimizer_switch;
-set @save_join_cache_level=@@join_cache_level;
-set join_cache_level=1;
-
---disable_warnings
-drop table if exists t1, t2, t3, t4, t5, t1i, t2i, t3i;
-drop table if exists columns;
-drop table if exists t1_16, t2_16, t3_16;
-drop view if exists v1, v2, v1m, v2m;
---enable_warnings
-
-create table t1 (a1 char(8), a2 char(8));
-create table t2 (b1 char(8), b2 char(8));
-create table t3 (c1 char(8), c2 char(8));
-
-insert into t1 values ('1 - 00', '2 - 00');
-insert into t1 values ('1 - 01', '2 - 01');
-insert into t1 values ('1 - 02', '2 - 02');
-
-insert into t2 values ('1 - 01', '2 - 01');
-insert into t2 values ('1 - 01', '2 - 01');
-insert into t2 values ('1 - 02', '2 - 02');
-insert into t2 values ('1 - 02', '2 - 02');
-insert into t2 values ('1 - 03', '2 - 03');
-
-insert into t3 values ('1 - 01', '2 - 01');
-insert into t3 values ('1 - 02', '2 - 02');
-insert into t3 values ('1 - 03', '2 - 03');
-insert into t3 values ('1 - 04', '2 - 04');
-
-# Indexed columns
-create table t1i (a1 char(8), a2 char(8));
-create table t2i (b1 char(8), b2 char(8));
-create table t3i (c1 char(8), c2 char(8));
-create index it1i1 on t1i (a1);
-create index it1i2 on t1i (a2);
-create index it1i3 on t1i (a1, a2);
-
-create index it2i1 on t2i (b1);
-create index it2i2 on t2i (b2);
-create index it2i3 on t2i (b1, b2);
-
-create index it3i1 on t3i (c1);
-create index it3i2 on t3i (c2);
-create index it3i3 on t3i (c1, c2);
-
-insert into t1i select * from t1;
-insert into t2i select * from t2;
-insert into t3i select * from t3;
-
-# force the use of materialization
-set @@optimizer_switch='materialization=on,in_to_exists=off,firstmatch=off';
-
-/******************************************************************************
-* Simple tests.
-******************************************************************************/
-# non-indexed nullable fields
-explain extended
-select * from t1 where a1 in (select b1 from t2 where b1 > '0');
-select * from t1 where a1 in (select b1 from t2 where b1 > '0');
-
-explain extended
-select * from t1 where a1 in (select b1 from t2 where b1 > '0' group by b1);
-select * from t1 where a1 in (select b1 from t2 where b1 > '0' group by b1);
-
-explain extended
-select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0' group by b1, b2);
-select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0' group by b1, b2);
-
-explain extended
-select * from t1 where (a1, a2) in (select b1, min(b2) from t2 where b1 > '0' group by b1);
-select * from t1 where (a1, a2) in (select b1, min(b2) from t2 where b1 > '0' group by b1);
-
-# indexed columns
---replace_column 7 #
---replace_regex /it1.*/_it1_idx/ /test.t2i.*/_ref_/ /Using index$// /Using where$//
-explain extended
-select * from t1i where a1 in (select b1 from t2i where b1 > '0');
-select * from t1i where a1 in (select b1 from t2i where b1 > '0');
-
---replace_column 6 # 8 # 11 #
-explain extended
-select * from t1i where a1 in (select max(b1) from t2i where b1 > '0' group by b1);
-select * from t1i where a1 in (select max(b1) from t2i where b1 > '0' group by b1);
-
---replace_column 7 #
---replace_regex /it1.*/_it1_idx/ /test.t2i.*/_ref_/ /Using index$// /Using where$//
-explain extended
-select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0');
-select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0');
-
---replace_column 6 # 7 # 8 # 11 #
-explain extended
-select * from t1i where (a1, a2) in (select b1, max(b2) from t2i where b1 > '0' group by b1);
-select * from t1i where (a1, a2) in (select b1, max(b2) from t2i where b1 > '0' group by b1);
-
---replace_column 6 # 7 # 8 # 11 #
-explain extended
-select * from t1i where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1);
-select * from t1i where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1);
-
-# BUG#31639: Wrong plan for uncorrelated subquery when loose scan is applicable.
-explain extended
-select * from t1 where (a1, a2) in (select b1, max(b2) from t2i group by b1);
-select * from t1 where (a1, a2) in (select b1, max(b2) from t2i group by b1);
-
-prepare st1 from "explain select * from t1 where (a1, a2) in (select b1, max(b2) from t2i group by b1)";
-execute st1;
-execute st1;
-prepare st2 from "select * from t1 where (a1, a2) in (select b1, max(b2) from t2i group by b1)";
-execute st2;
-execute st2;
-
-explain extended
-select * from t1 where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1);
-select * from t1 where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1);
--- error 1235
-select * from t1 where (a1, a2) in (select b1, min(b2) from t2i limit 1,1);
-
-# test re-optimization/re-execution with different execution methods
-# prepare once, exec with different modes
-set @save_optimizer_switch=@@optimizer_switch;
-set @@optimizer_switch=@optimizer_switch_local_default;
-set @@optimizer_switch='semijoin=off';
-prepare st1 from
-"select * from t1 where (a1, a2) in (select b1, min(b2) from t2 where b1 > '0' group by b1)";
-set @@optimizer_switch=@optimizer_switch_local_default;
-set @@optimizer_switch='materialization=off,in_to_exists=on';
-execute st1;
-set @@optimizer_switch=@optimizer_switch_local_default;
-set @@optimizer_switch='semijoin=off';
-execute st1;
-
-set @@optimizer_switch=@optimizer_switch_local_default;
-set @@optimizer_switch='materialization=off,in_to_exists=on';
-prepare st1 from
-"select * from t1 where (a1, a2) in (select b1, min(b2) from t2 where b1 > '0' group by b1)";
-set @@optimizer_switch=@optimizer_switch_local_default;
-set @@optimizer_switch='semijoin=off';
-execute st1;
-set @@optimizer_switch=@optimizer_switch_local_default;
-set @@optimizer_switch='materialization=off,in_to_exists=on';
-execute st1;
-set @@optimizer_switch=@save_optimizer_switch;
-
-# materialize the result of ORDER BY
-# non-indexed fields
-explain extended
-select * from t1 where (a1, a2) in (select b1, b2 from t2 order by b1, b2);
-select * from t1 where (a1, a2) in (select b1, b2 from t2 order by b1, b2);
-# indexed fields
-explain extended
-select * from t1i where (a1, a2) in (select b1, b2 from t2i order by b1, b2);
-select * from t1i where (a1, a2) in (select b1, b2 from t2i order by b1, b2);
-
-/******************************************************************************
-* Views, UNIONs, several levels of nesting.
-******************************************************************************/
-# materialize the result of subquery over temp-table view
-
-create algorithm=merge view v1 as
-select b1, c2 from t2, t3 where b2 > c2;
-
-create algorithm=merge view v2 as
-select b1, c2 from t2, t3 group by b2, c2;
-
-create algorithm=temptable view v1m as
-select b1, c2 from t2, t3 where b2 > c2;
-
-create algorithm=temptable view v2m as
-select b1, c2 from t2, t3 group by b2, c2;
-
-select * from v1 where (c2, b1) in (select c2, b1 from v2 where b1 is not null);
-select * from v1 where (c2, b1) in (select distinct c2, b1 from v2 where b1 is not null);
-
-select * from v1m where (c2, b1) in (select c2, b1 from v2m where b1 is not null);
-select * from v1m where (c2, b1) in (select distinct c2, b1 from v2m where b1 is not null);
-
-drop view v1, v2, v1m, v2m;
-
-# nested subqueries, views
-explain extended
-select * from t1
-where (a1, a2) in (select b1, b2 from t2 where b1 > '0') and
- (a1, a2) in (select c1, c2 from t3
- where (c1, c2) in (select b1, b2 from t2i where b2 > '0'));
-select * from t1
-where (a1, a2) in (select b1, b2 from t2 where b1 > '0') and
- (a1, a2) in (select c1, c2 from t3
- where (c1, c2) in (select b1, b2 from t2i where b2 > '0'));
-
---replace_column 6 # 7 # 8 # 11 #
-explain extended
-select * from t1i
-where (a1, a2) in (select b1, b2 from t2i where b1 > '0') and
- (a1, a2) in (select c1, c2 from t3i
- where (c1, c2) in (select b1, b2 from t2i where b2 > '0'));
-select * from t1i
-where (a1, a2) in (select b1, b2 from t2i where b1 > '0') and
- (a1, a2) in (select c1, c2 from t3i
- where (c1, c2) in (select b1, b2 from t2i where b2 > '0'));
-
-explain extended
-select * from t1
-where (a1, a2) in (select b1, b2 from t2
- where b2 in (select c2 from t3 where c2 LIKE '%02') or
- b2 in (select c2 from t3 where c2 LIKE '%03')) and
- (a1, a2) in (select c1, c2 from t3
- where (c1, c2) in (select b1, b2 from t2i where b2 > '0'));
-select * from t1
-where (a1, a2) in (select b1, b2 from t2
- where b2 in (select c2 from t3 where c2 LIKE '%02') or
- b2 in (select c2 from t3 where c2 LIKE '%03')) and
- (a1, a2) in (select c1, c2 from t3
- where (c1, c2) in (select b1, b2 from t2i where b2 > '0'));
-
-# as above with correlated innermost subquery
-explain extended
-select * from t1
-where (a1, a2) in (select b1, b2 from t2
- where b2 in (select c2 from t3 t3a where c1 = a1) or
- b2 in (select c2 from t3 t3b where c2 LIKE '%03')) and
- (a1, a2) in (select c1, c2 from t3 t3c
- where (c1, c2) in (select b1, b2 from t2i where b2 > '0'));
-select * from t1
-where (a1, a2) in (select b1, b2 from t2
- where b2 in (select c2 from t3 t3a where c1 = a1) or
- b2 in (select c2 from t3 t3b where c2 LIKE '%03')) and
- (a1, a2) in (select c1, c2 from t3 t3c
- where (c1, c2) in (select b1, b2 from t2i where b2 > '0'));
-
-
-# multiple levels of nesting subqueries, unions
---replace_column 6 # 7 # 8 # 11 #
-explain extended
-(select * from t1
-where (a1, a2) in (select b1, b2 from t2
- where b2 in (select c2 from t3 where c2 LIKE '%02') or
- b2 in (select c2 from t3 where c2 LIKE '%03')
- group by b1, b2) and
- (a1, a2) in (select c1, c2 from t3
- where (c1, c2) in (select b1, b2 from t2i where b2 > '0')))
-UNION
-(select * from t1i
-where (a1, a2) in (select b1, b2 from t2i where b1 > '0') and
- (a1, a2) in (select c1, c2 from t3i
- where (c1, c2) in (select b1, b2 from t2i where b2 > '0')));
-
-(select * from t1
-where (a1, a2) in (select b1, b2 from t2
- where b2 in (select c2 from t3 where c2 LIKE '%02') or
- b2 in (select c2 from t3 where c2 LIKE '%03')
- group by b1, b2) and
- (a1, a2) in (select c1, c2 from t3
- where (c1, c2) in (select b1, b2 from t2i where b2 > '0')))
-UNION
-(select * from t1i
-where (a1, a2) in (select b1, b2 from t2i where b1 > '0') and
- (a1, a2) in (select c1, c2 from t3i
- where (c1, c2) in (select b1, b2 from t2i where b2 > '0')));
-
-
-# UNION of subqueries as a subquery (thus it is not computed via materialization)
-explain extended
-select * from t1
-where (a1, a2) in (select * from t1 where a1 > '0' UNION select * from t2 where b1 < '9') and
- (a1, a2) in (select c1, c2 from t3
- where (c1, c2) in (select b1, b2 from t2i where b2 > '0'));
-select * from t1
-where (a1, a2) in (select * from t1 where a1 > '0' UNION select * from t2 where b1 < '9') and
- (a1, a2) in (select c1, c2 from t3
- where (c1, c2) in (select b1, b2 from t2i where b2 > '0'));
-# as above, with a join conditon between the outer references
-explain extended
-select * from t1, t3
-where (a1, a2) in (select * from t1 where a1 > '0' UNION select * from t2 where b1 < '9') and
- (c1, c2) in (select c1, c2 from t3
- where (c1, c2) in (select b1, b2 from t2i where b2 > '0')) and
- a1 = c1;
-select * from t1, t3
-where (a1, a2) in (select * from t1 where a1 > '0' UNION select * from t2 where b1 < '9') and
- (c1, c2) in (select c1, c2 from t3
- where (c1, c2) in (select b1, b2 from t2i where b2 > '0')) and
- a1 = c1;
-
-
-/******************************************************************************
-* Negative tests, where materialization should not be applied.
-******************************************************************************/
-# UNION in a subquery
-explain extended
-select * from t3
-where c1 in (select a1 from t1 where a1 > '0' UNION select b1 from t2 where b1 < '9');
-select * from t3
-where c1 in (select a1 from t1 where a1 > '0' UNION select b1 from t2 where b1 < '9');
-
-# correlation
-explain extended
-select * from t1
-where (a1, a2) in (select b1, b2 from t2
- where b2 in (select c2 from t3 t3a where c1 = a1) or
- b2 in (select c2 from t3 t3b where c2 LIKE '%03')) and
- (a1, a2) in (select c1, c2 from t3 t3c
- where (c1, c2) in (select b1, b2 from t2i where b2 > '0' or b2 = a2));
-
-# subquery has no tables
-explain extended
-select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01');
-select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01');
-explain extended
-select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01' from dual);
-select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01' from dual);
-
-
-/******************************************************************************
-* Subqueries in other uncovered clauses.
-******************************************************************************/
-
-/* SELECT clause */
-select ((a1,a2) IN (select * from t2 where b2 > '0')) IS NULL from t1;
-
-/* GROUP BY clause */
-create table columns (col int key);
-insert into columns values (1), (2);
-
-explain extended
-select * from t1 group by (select col from columns limit 1);
-select * from t1 group by (select col from columns limit 1);
-
-explain extended
-select * from t1 group by (a1 in (select col from columns));
-select * from t1 group by (a1 in (select col from columns));
-
-/* ORDER BY clause */
-explain extended
-select * from t1 order by (select col from columns limit 1);
-select * from t1 order by (select col from columns limit 1);
-
-/******************************************************************************
-* Column types/sizes that affect materialization.
-******************************************************************************/
-
-/*
- Test that BLOBs are not materialized (except when arguments of some functions).
-*/
-# force materialization to be always considered
-set @prefix_len = 6;
-
-# BLOB == 16 (small blobs that could be stored in HEAP tables)
-set @blob_len = 16;
-set @suffix_len = @blob_len - @prefix_len;
-
-create table t1_16 (a1 blob(16), a2 blob(16));
-create table t2_16 (b1 blob(16), b2 blob(16));
-create table t3_16 (c1 blob(16), c2 blob(16));
-
-insert into t1_16 values
- (concat('1 - 00', repeat('x', @suffix_len)), concat('2 - 00', repeat('x', @suffix_len)));
-insert into t1_16 values
- (concat('1 - 01', repeat('x', @suffix_len)), concat('2 - 01', repeat('x', @suffix_len)));
-insert into t1_16 values
- (concat('1 - 02', repeat('x', @suffix_len)), concat('2 - 02', repeat('x', @suffix_len)));
-
-insert into t2_16 values
- (concat('1 - 01', repeat('x', @suffix_len)), concat('2 - 01', repeat('x', @suffix_len)));
-insert into t2_16 values
- (concat('1 - 02', repeat('x', @suffix_len)), concat('2 - 02', repeat('x', @suffix_len)));
-insert into t2_16 values
- (concat('1 - 03', repeat('x', @suffix_len)), concat('2 - 03', repeat('x', @suffix_len)));
-
-insert into t3_16 values
- (concat('1 - 01', repeat('x', @suffix_len)), concat('2 - 01', repeat('x', @suffix_len)));
-insert into t3_16 values
- (concat('1 - 02', repeat('x', @suffix_len)), concat('2 - 02', repeat('x', @suffix_len)));
-insert into t3_16 values
- (concat('1 - 03', repeat('x', @suffix_len)), concat('2 - 03', repeat('x', @suffix_len)));
-insert into t3_16 values
- (concat('1 - 04', repeat('x', @suffix_len)), concat('2 - 04', repeat('x', @suffix_len)));
-
-# single value transformer
-explain extended select left(a1,7), left(a2,7)
-from t1_16
-where a1 in (select b1 from t2_16 where b1 > '0');
-
-select left(a1,7), left(a2,7)
-from t1_16
-where a1 in (select b1 from t2_16 where b1 > '0');
-
-# row value transformer
-explain extended select left(a1,7), left(a2,7)
-from t1_16
-where (a1,a2) in (select b1, b2 from t2_16 where b1 > '0');
-
-select left(a1,7), left(a2,7)
-from t1_16
-where (a1,a2) in (select b1, b2 from t2_16 where b1 > '0');
-
-# string function with a blob argument, the return type may be != blob
-explain extended select left(a1,7), left(a2,7)
-from t1_16
-where a1 in (select substring(b1,1,16) from t2_16 where b1 > '0');
-
-select left(a1,7), left(a2,7)
-from t1_16
-where a1 in (select substring(b1,1,16) from t2_16 where b1 > '0');
-
-# group_concat with a blob argument - depends on
-# the variable group_concat_max_len, and
-# convert_blob_length == max_len*collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB
-explain extended select left(a1,7), left(a2,7)
-from t1_16
-where a1 in (select group_concat(b1) from t2_16 group by b2);
-
-select left(a1,7), left(a2,7)
-from t1_16
-where a1 in (select group_concat(b1) from t2_16 group by b2);
-
-set @@group_concat_max_len = 256; # anything < (CONVERT_IF_BIGGER_TO_BLOB = 512)
-
-explain extended select left(a1,7), left(a2,7)
-from t1_16
-where a1 in (select group_concat(b1) from t2_16 group by b2);
-
-select left(a1,7), left(a2,7)
-from t1_16
-where a1 in (select group_concat(b1) from t2_16 group by b2);
-
-# BLOB column at the second (intermediate) level of nesting
-explain extended
-select * from t1
-where concat(a1,'x') IN
- (select left(a1,8) from t1_16
- where (a1, a2) IN
- (select t2_16.b1, t2_16.b2 from t2_16, t2
- where t2.b2 = substring(t2_16.b2,1,6) and
- t2.b1 IN (select c1 from t3 where c2 > '0')));
-
-
-drop table t1_16, t2_16, t3_16;
-
-
-# BLOB == 512 (CONVERT_IF_BIGGER_TO_BLOB == 512)
-set @blob_len = 512;
-set @suffix_len = @blob_len - @prefix_len;
-
-create table t1_512 (a1 blob(512), a2 blob(512));
-create table t2_512 (b1 blob(512), b2 blob(512));
-create table t3_512 (c1 blob(512), c2 blob(512));
-
-insert into t1_512 values
- (concat('1 - 00', repeat('x', @suffix_len)), concat('2 - 00', repeat('x', @suffix_len)));
-insert into t1_512 values
- (concat('1 - 01', repeat('x', @suffix_len)), concat('2 - 01', repeat('x', @suffix_len)));
-insert into t1_512 values
- (concat('1 - 02', repeat('x', @suffix_len)), concat('2 - 02', repeat('x', @suffix_len)));
-
-insert into t2_512 values
- (concat('1 - 01', repeat('x', @suffix_len)), concat('2 - 01', repeat('x', @suffix_len)));
-insert into t2_512 values
- (concat('1 - 02', repeat('x', @suffix_len)), concat('2 - 02', repeat('x', @suffix_len)));
-insert into t2_512 values
- (concat('1 - 03', repeat('x', @suffix_len)), concat('2 - 03', repeat('x', @suffix_len)));
-
-insert into t3_512 values
- (concat('1 - 01', repeat('x', @suffix_len)), concat('2 - 01', repeat('x', @suffix_len)));
-insert into t3_512 values
- (concat('1 - 02', repeat('x', @suffix_len)), concat('2 - 02', repeat('x', @suffix_len)));
-insert into t3_512 values
- (concat('1 - 03', repeat('x', @suffix_len)), concat('2 - 03', repeat('x', @suffix_len)));
-insert into t3_512 values
- (concat('1 - 04', repeat('x', @suffix_len)), concat('2 - 04', repeat('x', @suffix_len)));
-
-# single value transformer
-explain extended select left(a1,7), left(a2,7)
-from t1_512
-where a1 in (select b1 from t2_512 where b1 > '0');
-
-select left(a1,7), left(a2,7)
-from t1_512
-where a1 in (select b1 from t2_512 where b1 > '0');
-
-# row value transformer
-explain extended select left(a1,7), left(a2,7)
-from t1_512
-where (a1,a2) in (select b1, b2 from t2_512 where b1 > '0');
-
-select left(a1,7), left(a2,7)
-from t1_512
-where (a1,a2) in (select b1, b2 from t2_512 where b1 > '0');
-
-# string function with a blob argument, the return type may be != blob
-explain extended select left(a1,7), left(a2,7)
-from t1_512
-where a1 in (select substring(b1,1,512) from t2_512 where b1 > '0');
-
-select left(a1,7), left(a2,7)
-from t1_512
-where a1 in (select substring(b1,1,512) from t2_512 where b1 > '0');
-
-# group_concat with a blob argument - depends on
-# the variable group_concat_max_len, and
-# convert_blob_length == max_len*collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB
-explain extended select left(a1,7), left(a2,7)
-from t1_512
-where a1 in (select group_concat(b1) from t2_512 group by b2);
-
-select left(a1,7), left(a2,7)
-from t1_512
-where a1 in (select group_concat(b1) from t2_512 group by b2);
-
-set @@group_concat_max_len = 256; # anything < (CONVERT_IF_BIGGER_TO_BLOB = 512)
-
-explain extended select left(a1,7), left(a2,7)
-from t1_512
-where a1 in (select group_concat(b1) from t2_512 group by b2);
-
-select left(a1,7), left(a2,7)
-from t1_512
-where a1 in (select group_concat(b1) from t2_512 group by b2);
-
-drop table t1_512, t2_512, t3_512;
-
-
-# BLOB == 1024 (group_concat_max_len == 1024)
-set @blob_len = 1024;
-set @suffix_len = @blob_len - @prefix_len;
-
-create table t1_1024 (a1 blob(1024), a2 blob(1024));
-create table t2_1024 (b1 blob(1024), b2 blob(1024));
-create table t3_1024 (c1 blob(1024), c2 blob(1024));
-
-insert into t1_1024 values
- (concat('1 - 00', repeat('x', @suffix_len)), concat('2 - 00', repeat('x', @suffix_len)));
-insert into t1_1024 values
- (concat('1 - 01', repeat('x', @suffix_len)), concat('2 - 01', repeat('x', @suffix_len)));
-insert into t1_1024 values
- (concat('1 - 02', repeat('x', @suffix_len)), concat('2 - 02', repeat('x', @suffix_len)));
-
-insert into t2_1024 values
- (concat('1 - 01', repeat('x', @suffix_len)), concat('2 - 01', repeat('x', @suffix_len)));
-insert into t2_1024 values
- (concat('1 - 02', repeat('x', @suffix_len)), concat('2 - 02', repeat('x', @suffix_len)));
-insert into t2_1024 values
- (concat('1 - 03', repeat('x', @suffix_len)), concat('2 - 03', repeat('x', @suffix_len)));
-
-insert into t3_1024 values
- (concat('1 - 01', repeat('x', @suffix_len)), concat('2 - 01', repeat('x', @suffix_len)));
-insert into t3_1024 values
- (concat('1 - 02', repeat('x', @suffix_len)), concat('2 - 02', repeat('x', @suffix_len)));
-insert into t3_1024 values
- (concat('1 - 03', repeat('x', @suffix_len)), concat('2 - 03', repeat('x', @suffix_len)));
-insert into t3_1024 values
- (concat('1 - 04', repeat('x', @suffix_len)), concat('2 - 04', repeat('x', @suffix_len)));
-
-# single value transformer
-explain extended select left(a1,7), left(a2,7)
-from t1_1024
-where a1 in (select b1 from t2_1024 where b1 > '0');
-
-select left(a1,7), left(a2,7)
-from t1_1024
-where a1 in (select b1 from t2_1024 where b1 > '0');
-
-# row value transformer
-explain extended select left(a1,7), left(a2,7)
-from t1_1024
-where (a1,a2) in (select b1, b2 from t2_1024 where b1 > '0');
-
-select left(a1,7), left(a2,7)
-from t1_1024
-where (a1,a2) in (select b1, b2 from t2_1024 where b1 > '0');
-
-# string function with a blob argument, the return type may be != blob
-explain extended select left(a1,7), left(a2,7)
-from t1_1024
-where a1 in (select substring(b1,1,1024) from t2_1024 where b1 > '0');
-
-select left(a1,7), left(a2,7)
-from t1_1024
-where a1 in (select substring(b1,1,1024) from t2_1024 where b1 > '0');
-
-# group_concat with a blob argument - depends on
-# the variable group_concat_max_len, and
-# convert_blob_length == max_len*collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB
-explain extended select left(a1,7), left(a2,7)
-from t1_1024
-where a1 in (select group_concat(b1) from t2_1024 group by b2);
-
-select left(a1,7), left(a2,7)
-from t1_1024
-where a1 in (select group_concat(b1) from t2_1024 group by b2);
-
-set @@group_concat_max_len = 256; # anything < (CONVERT_IF_BIGGER_TO_BLOB = 1024)
-
-explain extended select left(a1,7), left(a2,7)
-from t1_1024
-where a1 in (select group_concat(b1) from t2_1024 group by b2);
-
-select left(a1,7), left(a2,7)
-from t1_1024
-where a1 in (select group_concat(b1) from t2_1024 group by b2);
-
-drop table t1_1024, t2_1024, t3_1024;
-
-
-# BLOB == 1025
-set @blob_len = 1025;
-set @suffix_len = @blob_len - @prefix_len;
-
-create table t1_1025 (a1 blob(1025), a2 blob(1025));
-create table t2_1025 (b1 blob(1025), b2 blob(1025));
-create table t3_1025 (c1 blob(1025), c2 blob(1025));
-
-insert into t1_1025 values
- (concat('1 - 00', repeat('x', @suffix_len)), concat('2 - 00', repeat('x', @suffix_len)));
-insert into t1_1025 values
- (concat('1 - 01', repeat('x', @suffix_len)), concat('2 - 01', repeat('x', @suffix_len)));
-insert into t1_1025 values
- (concat('1 - 02', repeat('x', @suffix_len)), concat('2 - 02', repeat('x', @suffix_len)));
-
-insert into t2_1025 values
- (concat('1 - 01', repeat('x', @suffix_len)), concat('2 - 01', repeat('x', @suffix_len)));
-insert into t2_1025 values
- (concat('1 - 02', repeat('x', @suffix_len)), concat('2 - 02', repeat('x', @suffix_len)));
-insert into t2_1025 values
- (concat('1 - 03', repeat('x', @suffix_len)), concat('2 - 03', repeat('x', @suffix_len)));
-
-insert into t3_1025 values
- (concat('1 - 01', repeat('x', @suffix_len)), concat('2 - 01', repeat('x', @suffix_len)));
-insert into t3_1025 values
- (concat('1 - 02', repeat('x', @suffix_len)), concat('2 - 02', repeat('x', @suffix_len)));
-insert into t3_1025 values
- (concat('1 - 03', repeat('x', @suffix_len)), concat('2 - 03', repeat('x', @suffix_len)));
-insert into t3_1025 values
- (concat('1 - 04', repeat('x', @suffix_len)), concat('2 - 04', repeat('x', @suffix_len)));
-
-# single value transformer
-explain extended select left(a1,7), left(a2,7)
-from t1_1025
-where a1 in (select b1 from t2_1025 where b1 > '0');
-
-select left(a1,7), left(a2,7)
-from t1_1025
-where a1 in (select b1 from t2_1025 where b1 > '0');
-
-# row value transformer
-explain extended select left(a1,7), left(a2,7)
-from t1_1025
-where (a1,a2) in (select b1, b2 from t2_1025 where b1 > '0');
-
-select left(a1,7), left(a2,7)
-from t1_1025
-where (a1,a2) in (select b1, b2 from t2_1025 where b1 > '0');
-
-# string function with a blob argument, the return type may be != blob
-explain extended select left(a1,7), left(a2,7)
-from t1_1025
-where a1 in (select substring(b1,1,1025) from t2_1025 where b1 > '0');
-
-select left(a1,7), left(a2,7)
-from t1_1025
-where a1 in (select substring(b1,1,1025) from t2_1025 where b1 > '0');
-
-# group_concat with a blob argument - depends on
-# the variable group_concat_max_len, and
-# convert_blob_length == max_len*collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB
-explain extended select left(a1,7), left(a2,7)
-from t1_1025
-where a1 in (select group_concat(b1) from t2_1025 group by b2);
-
-select left(a1,7), left(a2,7)
-from t1_1025
-where a1 in (select group_concat(b1) from t2_1025 group by b2);
-
-set @@group_concat_max_len = 256; # anything < (CONVERT_IF_BIGGER_TO_BLOB = 1025)
-
-explain extended select left(a1,7), left(a2,7)
-from t1_1025
-where a1 in (select group_concat(b1) from t2_1025 group by b2);
-
-select left(a1,7), left(a2,7)
-from t1_1025
-where a1 in (select group_concat(b1) from t2_1025 group by b2);
-
-drop table t1_1025, t2_1025, t3_1025;
-
-# test for BIT fields
-create table t1bit (a1 bit(3), a2 bit(3));
-create table t2bit (b1 bit(3), b2 bit(3));
-
-insert into t1bit values (b'000', b'100');
-insert into t1bit values (b'001', b'101');
-insert into t1bit values (b'010', b'110');
-
-insert into t2bit values (b'001', b'101');
-insert into t2bit values (b'010', b'110');
-insert into t2bit values (b'110', b'111');
-
-explain extended select bin(a1), bin(a2)
-from t1bit
-where (a1, a2) in (select b1, b2 from t2bit);
-
-select bin(a1), bin(a2)
-from t1bit
-where (a1, a2) in (select b1, b2 from t2bit);
-
-drop table t1bit, t2bit;
-
-# test mixture of BIT and BLOB
-create table t1bb (a1 bit(3), a2 blob(3));
-create table t2bb (b1 bit(3), b2 blob(3));
-
-insert into t1bb values (b'000', '100');
-insert into t1bb values (b'001', '101');
-insert into t1bb values (b'010', '110');
-
-insert into t2bb values (b'001', '101');
-insert into t2bb values (b'010', '110');
-insert into t2bb values (b'110', '111');
-
-explain extended select bin(a1), a2
-from t1bb
-where (a1, a2) in (select b1, b2 from t2bb);
-
-select bin(a1), a2
-from t1bb
-where (a1, a2) in (select b1, b2 from t2bb);
-
-drop table t1bb, t2bb;
-drop table t1, t2, t3, t1i, t2i, t3i, columns;
-
-/******************************************************************************
-* Test the cache of the left operand of IN.
-******************************************************************************/
-
-# Test that default values of Cached_item are not used for comparison
-create table t1 (s1 int);
-create table t2 (s2 int);
-insert into t1 values (5),(1),(0);
-insert into t2 values (0), (1);
-select s2 from t2 where s2 in (select s1 from t1);
-drop table t1, t2;
-
-create table t1 (a int not null, b int not null);
-create table t2 (c int not null, d int not null);
-create table t3 (e int not null);
-
-# the first outer row has no matching inner row
-insert into t1 values (1,10);
-insert into t1 values (1,20);
-insert into t1 values (2,10);
-insert into t1 values (2,20);
-insert into t1 values (2,30);
-insert into t1 values (3,20);
-insert into t1 values (4,40);
-
-insert into t2 values (2,10);
-insert into t2 values (2,20);
-insert into t2 values (2,40);
-insert into t2 values (3,20);
-insert into t2 values (4,10);
-insert into t2 values (5,10);
-
-insert into t3 values (10);
-insert into t3 values (10);
-insert into t3 values (20);
-insert into t3 values (30);
-
-explain extended
-select a from t1 where a in (select c from t2 where d >= 20);
-select a from t1 where a in (select c from t2 where d >= 20);
-
-create index it1a on t1(a);
-
-explain extended
-select a from t1 where a in (select c from t2 where d >= 20);
-select a from t1 where a in (select c from t2 where d >= 20);
-
-# the first outer row has a matching inner row
-insert into t2 values (1,10);
-
-explain extended
-select a from t1 where a in (select c from t2 where d >= 20);
-select a from t1 where a in (select c from t2 where d >= 20);
-
-# cacheing for IN predicates inside a having clause - here the cached
-# items are changed to point to temporary tables.
-explain extended
-select a from t1 group by a having a in (select c from t2 where d >= 20);
-select a from t1 group by a having a in (select c from t2 where d >= 20);
-
-# create an index that can be used for the outer query GROUP BY
-create index iab on t1(a, b);
-explain extended
-select a from t1 group by a having a in (select c from t2 where d >= 20);
-select a from t1 group by a having a in (select c from t2 where d >= 20);
-
-explain extended
-select a from t1 group by a
-having a in (select c from t2 where d >= some(select e from t3 where max(b)=e));
-select a from t1 group by a
-having a in (select c from t2 where d >= some(select e from t3 where max(b)=e));
-explain extended
-select a from t1
-where a in (select c from t2 where d >= some(select e from t3 where b=e));
-select a from t1
-where a in (select c from t2 where d >= some(select e from t3 where b=e));
-
-drop table t1, t2, t3;
-
-#
-# BUG#36133 "Assertion `exec_method != MATERIALIZATION || (exec_method == MATERIALIZATION &&"
-#
-create table t2 (a int, b int, key(a), key(b));
-insert into t2 values (3,3),(3,3),(3,3);
-select 1 from t2 where
- t2.a > 1
- or
- t2.a = 3 and not t2.a not in (select t2.b from t2);
-drop table t2;
-
-#
-# BUG#37896 Assertion on entry of Item_in_subselect::exec on subquery with AND NOT
-#
-create table t1 (a1 int key);
-create table t2 (b1 int);
-insert into t1 values (5);
-
-# Query with group by, executed via materialization
-explain select min(a1) from t1 where 7 in (select max(b1) from t2 group by b1);
-select min(a1) from t1 where 7 in (select max(b1) from t2 group by b1);
-# Query with group by, executed via IN=>EXISTS
-set @save_optimizer_switch=@@optimizer_switch;
-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);
-select min(a1) from t1 where 7 in (select max(b1) from t2 group by b1);
-
-# Executed with materialization
-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);
-select min(a1) from t1 where 7 in (select b1 from t2);
-# Executed with semi-join. Notice, this time we get a different result (NULL).
-# This is the only correct result of all four queries. This difference is
-# filed as BUG#40037.
-set @@optimizer_switch=@optimizer_switch_local_default;
-set @@optimizer_switch='materialization=off,in_to_exists=on';
--- echo # with MariaDB and MWL#90, this particular case is solved:
-explain select min(a1) from t1 where 7 in (select b1 from t2);
-select min(a1) from t1 where 7 in (select b1 from t2);
--- echo # 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;
-select min(a1) from t1 where 7 in (select b1 from t2) or 2> 4;
-set @@optimizer_switch= @save_optimizer_switch;
-drop table t1,t2;
-
-#
-# BUG#36752 "subquery materialization produces wrong results when comparing different types"
-#
-create table t1 (a char(2), b varchar(10));
-insert into t1 values ('a', 'aaa');
-insert into t1 values ('aa', 'aaaa');
-
-explain select a,b from t1 where b in (select a from t1);
-select a,b from t1 where b in (select a from t1);
-prepare st1 from "select a,b from t1 where b in (select a from t1)";
-execute st1;
-execute st1;
-drop table t1;
-
---echo #
---echo # BUG#49630: Segfault in select_describe() with double
---echo # nested subquery and materialization
---echo #
-
-CREATE TABLE t1 (t1i int);
-CREATE TABLE t2 (t2i int);
-CREATE TABLE t3 (t3i int);
-CREATE TABLE t4 (t4i int);
-
-INSERT INTO t1 VALUES (1); # Note: t1 must be const table
-INSERT INTO t2 VALUES (1),(2);
-INSERT INTO t3 VALUES (1),(2);
-INSERT INTO t4 VALUES (1),(2);
-
---echo
-EXPLAIN
-SELECT t1i
-FROM t1 JOIN t4 ON t1i=t4i
-WHERE (t1i) IN (
- SELECT t2i
- FROM t2
- WHERE (t2i) IN (
- SELECT max(t3i)
- FROM t3
- GROUP BY t3i
- )
- );
-
-DROP TABLE t1,t2,t3,t4;
-
-
-#
-# Bug #52538 Valgrind bug: Item_in_subselect::init_left_expr_cache()
-#
-CREATE TABLE t1 (
- pk INTEGER AUTO_INCREMENT,
- col_int_nokey INTEGER,
- col_int_key INTEGER,
-
- col_varchar_key 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
-)
-VALUES
-(2, NULL, 'w'),
-(9, 7, 'm'),
-(3, 9, 'm'),
-(9, 7, 'k'),
-(NULL, 4, 'r'),
-(9, 2, 't'),
-(3, 6, 'j'),
-(8, 8, 'u'),
-(8, NULL, 'h'),
-(53, 5, 'o'),
-(0, NULL, NULL),
-(5, 6, 'k'),
-(166, 188, 'e'),
-(3, 2, 'n'),
-(0, 1, 't'),
-(1, 1, 'c'),
-(9, 0, 'm'),
-(5, 9, 'y'),
-(6, NULL, 'f'),
-(2, 4, 'd')
-;
-
-SELECT table2.col_varchar_key AS field1,
- table2.col_int_nokey AS field2
-FROM ( t1 AS table1 LEFT OUTER JOIN t1 AS table2
- ON (table2.col_varchar_key = table1.col_varchar_key ) )
-WHERE table1.pk = 6
-HAVING ( field2 ) IN
-( SELECT SUBQUERY2_t2.col_int_nokey AS SUBQUERY2_field2
- FROM ( t1 AS SUBQUERY2_t1 JOIN t1 AS SUBQUERY2_t2
- ON (SUBQUERY2_t2.col_varchar_key = SUBQUERY2_t1.col_varchar_key ) ) )
-ORDER BY field2
-;
-
-drop table t1;
-
-
---echo #
---echo # BUG#53103: MTR test ps crashes in optimize_cond()
---echo # when running with --debug
---echo #
-
-CREATE TABLE t1(track varchar(15));
-
-INSERT INTO t1 VALUES ('CAD'), ('CAD');
-
-PREPARE STMT FROM
-"SELECT 1 FROM t1
- WHERE
- track IN (SELECT track FROM t1
- GROUP BY track
- HAVING track>='CAD')";
-EXECUTE STMT ;
-EXECUTE STMT ;
-
-DEALLOCATE PREPARE STMT;
-DROP TABLE t1;
-
---echo # End of BUG#53103
-
---echo #
---echo # BUG#54511 - Assertion failed: cache != 0L in file
---echo # sql_select.cc::sub_select_cache on HAVING
---echo #
-
-CREATE TABLE t1 (i int(11));
-CREATE TABLE t2 (c char(1));
-CREATE TABLE t3 (c char(1));
-
-# These records are needed for the test to fail with MyISAM. The test
-# fails with InnoDB without these (difference due to optimization of
-# aggregates available only in MyISAM)
-INSERT INTO t1 VALUES (1), (2);
-INSERT INTO t2 VALUES ('a'), ('b');
-INSERT INTO t3 VALUES ('x'), ('y');
-
-SELECT COUNT( i ),i
-FROM t1
-HAVING ('c')
- IN (SELECT t2.c FROM (t2 JOIN t3));
-
-DROP TABLE t1,t2,t3;
-
---echo # End BUG#54511
-
---echo #
---echo # BUG#56367 - Assertion exec_method != EXEC_MATERIALIZATION...
---echo # on subquery in FROM
---echo #
-
-CREATE TABLE t1 (a INTEGER);
-
-CREATE TABLE t2 (b INTEGER);
-INSERT INTO t2 VALUES (1);
-
-set @tmp_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='derived_merge=off,derived_with_keys=off';
-let $query =
-SELECT a FROM (
- SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a > 3 OR t2.b IN (SELECT a FROM t1)
-) table1;
-eval explain $query;
-eval $query;
-set optimizer_switch=@tmp_optimizer_switch;
-
-DROP TABLE t1, t2;
-
---echo # End BUG#56367
-
---echo #
---echo # Bug#59833 - materialization=on/off leads to different result set
---echo # when using IN
---echo #
-
-CREATE TABLE t1 (
- pk int NOT NULL,
- f1 int DEFAULT NULL,
- PRIMARY KEY (pk)
-) ENGINE=MyISAM;
-
-CREATE TABLE t2 (
- pk int NOT NULL,
- f1 int DEFAULT NULL,
- PRIMARY KEY (pk)
-) ENGINE=MyISAM;
-
-INSERT INTO t1 VALUES (10,0);
-INSERT INTO t2 VALUES (10,0),(11,0);
-
-let $query=
-SELECT * FROM t1 JOIN t2 USING (f1)
-WHERE t1.f1 IN (SELECT t1.pk FROM t1 ORDER BY t1.f1);
-
-eval explain $query;
-eval $query;
-
-DROP TABLE t1, t2;
-
---echo # End Bug#59833
-
---echo #
---echo # Bug#11852644 - CRASH IN ITEM_REF::SAVE_IN_FIELD ON SELECT DISTINCT
---echo #
-
-CREATE TABLE t1 (
- col_varchar_key varchar(1) DEFAULT NULL,
- col_varchar_nokey varchar(1) DEFAULT NULL,
- KEY col_varchar_key (col_varchar_key))
-;
-
-INSERT INTO t1 VALUES
-('v','v'),('r','r');
-
-CREATE TABLE t2 (
- col_varchar_key varchar(1) DEFAULT NULL,
- col_varchar_nokey varchar(1) DEFAULT NULL,
- KEY col_varchar_key(col_varchar_key))
-;
-
-INSERT INTO t2 VALUES
-('r','r'),('c','c');
-
-CREATE VIEW v3 AS SELECT * FROM t2;
-
-SELECT DISTINCT alias2.col_varchar_key
-FROM t1 AS alias1 JOIN v3 AS alias2
-ON alias2.col_varchar_key = alias1.col_varchar_key
-HAVING col_varchar_key IN (SELECT col_varchar_nokey FROM t2)
-;
-
-DROP TABLE t1, t2;
-DROP VIEW v3;
-
---echo # End Bug#11852644
-
---echo
---echo # Bug#12668294 - GROUP BY ON EMPTY RESULT GIVES EMPTY ROW
---echo # INSTEAD OF NULL WHEN MATERIALIZATION ON
---echo
-
-CREATE TABLE t1 (col_int_nokey INT) ENGINE=MEMORY;
-CREATE TABLE t2 (col_int_nokey INT) ENGINE=MEMORY;
-INSERT INTO t2 VALUES (8),(7);
-CREATE TABLE t3 (col_int_nokey INT) ENGINE=MEMORY;
-INSERT INTO t3 VALUES (7);
-
-SELECT MIN(t3.col_int_nokey),t1.col_int_nokey AS field3
-FROM t3
- LEFT JOIN t1
- ON t1.col_int_nokey
-WHERE (194, 200) IN (
- SELECT SQ4_alias1.col_int_nokey,
- SQ4_alias2.col_int_nokey
- FROM t2 AS SQ4_alias1
- JOIN
- t2 AS SQ4_alias2
- ON SQ4_alias2.col_int_nokey = 5
- )
-GROUP BY field3 ;
-
-DROP TABLE t1;
-DROP TABLE t2;
-DROP TABLE t3;
-
-#
-# Bug #44303 Assertion failures in Field_new_decimal::store_decimal
-# when executing materialized InsideOut semijoin
-#
-CREATE TABLE t1 (f1 INT, f2 DECIMAL(5,3)) ENGINE=MyISAM;
-INSERT INTO t1 (f1, f2) VALUES (1, 1.789);
-INSERT INTO t1 (f1, f2) VALUES (13, 1.454);
-INSERT INTO t1 (f1, f2) VALUES (10, 1.668);
-
-CREATE TABLE t2 LIKE t1;
-INSERT INTO t2 VALUES (1, 1.789);
-INSERT INTO t2 VALUES (13, 1.454);
-
-set @save_optimizer_switch=@@optimizer_switch;
-set @@optimizer_switch=@optimizer_switch_local_default;
-SET @@optimizer_switch='semijoin=on,materialization=on';
-EXPLAIN SELECT COUNT(*) FROM t1 WHERE (f1,f2) IN (SELECT f1,f2 FROM t2);
-SELECT COUNT(*) FROM t1 WHERE (f1,f2) IN (SELECT f1,f2 FROM t2);
-set @@optimizer_switch= @save_optimizer_switch;
-
-DROP TABLE t1, t2;
-
-#
-# BUG#46548 IN-subqueries return 0 rows with materialization=on
-#
-CREATE TABLE t1 (
- pk int,
- a varchar(1),
- b varchar(4),
- c varchar(4),
- d varchar(4),
- PRIMARY KEY (pk)
-);
-INSERT INTO t1 VALUES (1,'o','ffff','ffff','ffoo'),(2,'f','ffff','ffff','ffff');
-
-CREATE TABLE t2 LIKE t1;
-INSERT INTO t2 VALUES (1,'i','iiii','iiii','iiii'),(2,'f','ffff','ffff','ffff');
-
-set @save_optimizer_switch=@@optimizer_switch;
-set @@optimizer_switch=@optimizer_switch_local_default;
-SET @@optimizer_switch='semijoin=on,materialization=on';
-EXPLAIN SELECT pk FROM t1 WHERE (a) IN (SELECT a FROM t2 WHERE pk > 0);
-SELECT pk FROM t1 WHERE (a) IN (SELECT a FROM t2 WHERE pk > 0);
-SELECT pk FROM t1 WHERE (b,c,d) IN (SELECT b,c,d FROM t2 WHERE pk > 0);
-DROP TABLE t1, t2;
-set optimizer_switch=@save_optimizer_switch;
-
---echo #
---echo # BUG#50019: Wrong result for IN-subquery with materialization
---echo #
-create table t1(i int);
-insert into t1 values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
-create table t2(i int);
-insert into t2 values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
-create table t3(i int);
-insert into t3 values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
-select * from t1 where t1.i in (select t2.i from t2 join t3 where t2.i + t3.i = 5);
-set @save_optimizer_switch=@@optimizer_switch;
-set session optimizer_switch='materialization=off,in_to_exists=on';
-select * from t1 where t1.i in (select t2.i from t2 join t3 where t2.i + t3.i = 5);
-set session optimizer_switch=@save_optimizer_switch;
-drop table t1, t2, t3;
-
-#
-# Test that the contents of the temp table of a materialized subquery is
-# cleaned up between PS re-executions.
-#
-
-create table t0 (a int);
-insert into t0 values (0),(1),(2);
-create table t1 (a int);
-insert into t1 values (0),(1),(2);
-explain select a, a in (select a from t1) from t0;
-select a, a in (select a from t1) from t0;
-prepare s from 'select a, a in (select a from t1) from t0';
-execute s;
-update t1 set a=123;
-execute s;
-drop table t0, t1;
-set optimizer_switch='firstmatch=on';
-
---echo #
---echo # MWL#90, review feedback: check what happens when the subquery
---echo # looks like candidate for MWL#90 checking at the first glance
---echo # but then subselect_hash_sj_engine::init_permanent() discovers
---echo # that it's not possible to perform duplicate removal for the
---echo # selected datatypes, and so materialization isn't applicable after
---echo # all.
---echo #
-set @blob_len = 1024;
-set @suffix_len = @blob_len - @prefix_len;
-
-create table t1_1024 (a1 blob(1024), a2 blob(1024));
-create table t2_1024 (b1 blob(1024), b2 blob(1024));
-
-insert into t1_1024 values
- (concat('1 - 00', repeat('x', @suffix_len)), concat('2 - 00', repeat('x', @suffix_len)));
-insert into t1_1024 values
- (concat('1 - 01', repeat('x', @suffix_len)), concat('2 - 01', repeat('x', @suffix_len)));
-insert into t1_1024 values
- (concat('1 - 02', repeat('x', @suffix_len)), concat('2 - 02', repeat('x', @suffix_len)));
-
-insert into t2_1024 values
- (concat('1 - 01', repeat('x', @suffix_len)), concat('2 - 01', repeat('x', @suffix_len)));
-insert into t2_1024 values
- (concat('1 - 02', repeat('x', @suffix_len)), concat('2 - 02', repeat('x', @suffix_len)));
-insert into t2_1024 values
- (concat('1 - 03', repeat('x', @suffix_len)), concat('2 - 03', repeat('x', @suffix_len)));
-
-explain select left(a1,7), left(a2,7) from t1_1024 where (a1,3) in (select substring(b1,1,1024), count(*) from t2_1024 where b1 > '0');
-select left(a1,7), left(a2,7) from t1_1024 where (a1,3) in (select substring(b1,1,1024), count(*) from t2_1024 where b1 > '0');
-
-drop table t1_1024, t2_1024;
-
---echo #
---echo # BUG##836491: Crash in Item_field::Item_field from add_ref_to_table_cond() with semijoin+materialization
---echo #
-
-CREATE TABLE t1 (c int, d varchar(1), KEY(d)) ;
-INSERT INTO t1 VALUES (2,'x'),(2,'x'),(2,'j'),(2,'c');
-
-CREATE TABLE t2 (a int, d varchar(1)) ;
-INSERT INTO t2 VALUES (1,'x');
-
-CREATE TABLE t3 (d varchar(1)) ;
-INSERT INTO t3 VALUES ('x'),('x'),('j'),('c');
-
-SELECT t2.a, t1.c
-FROM t1, t2
-WHERE t2.d IN ( SELECT d FROM t3 )
-AND t1.d = t2.d
-GROUP BY 1 , 2;
-
-drop table t1,t2,t3;
-
---echo #
---echo # BUG#836523: Crash in JOIN::get_partial_cost_and_fanout with semijoin+materialization
---echo #
-CREATE TABLE t1 (a varchar(1));
-INSERT INTO t1 VALUES ('a'),('a');
-
-CREATE TABLE t2 (a varchar(1));
-
-CREATE TABLE t3 (a int);
-INSERT INTO t3 VALUES (1),(2);
-
-CREATE TABLE t4 (a varchar(1));
-INSERT INTO t4 VALUES ('a'),('a');
-
-SELECT t1.a
-FROM t1
-WHERE t1.a IN (
- SELECT t2.a
- FROM t2, t3
-)
-HAVING a IN (
- SELECT a
- FROM t4
-);
-DROP TABLE t1, t2, t3, t4;
-
---echo #
---echo # BUG#836507: Crash in setup_sj_materialization_part1() with semijoin+materialization
---echo #
-CREATE TABLE t1 (a int) ;
-INSERT IGNORE INTO t1 VALUES (1),(1);
-
-CREATE TABLE t2 (a int);
-INSERT INTO t2 VALUES (1);
-
-CREATE TABLE t3 (a int);
-
-CREATE TABLE t4 (a int);
-INSERT INTO t4 VALUES (2),(2);
-
-CREATE TABLE t5 (a int);
-INSERT INTO t5 VALUES (1);
-
-SELECT * FROM t1
-WHERE (a) IN (
- SELECT t5.a
- FROM (
- t2
- LEFT JOIN ( t3 , t4 )
- ON 1 = 1
- )
- JOIN t5
-);
-
-DROP TABLE t1,t2,t3,t4,t5;
-
---echo #
---echo # BUG#836532: Crash in Item_equal_fields_iterator::get_curr_field with semijoin+materialization
---echo #
-
-CREATE TABLE t2 (a int);
-INSERT IGNORE INTO t2 VALUES ('a'),('a');
-
-CREATE TABLE t4 (a varchar(1));
-INSERT INTO t4 VALUES ('m'),('o');
-
-CREATE TABLE t3 (a varchar(1) , b varchar(1) ) ;
-INSERT INTO t3 VALUES ('b','b');
-
-CREATE TABLE t5 (a varchar(1), KEY (a)) ;
-INSERT INTO t5 VALUES ('d'),('e');
-
-SELECT *
-FROM t2
-WHERE t2.a = ALL (
- SELECT t4.a
- FROM t4
- WHERE t4.a IN (
- SELECT t3.a
- FROM t3 , t5
- WHERE ( t5.a = t3.b )
- )
-);
-
-DROP TABLE t2,t3,t4,t5;
-
---echo #
---echo # BUG#860300: Second crash with get_fanout_with_deps() with semijoin + materialization
---echo #
-set @tmp_860300=@@optimizer_switch;
-set optimizer_switch='semijoin=on,materialization=on,loosescan=off,firstmatch=off';
-CREATE TABLE t1 (f2 int);
-INSERT INTO t1 VALUES (9),(6);
-CREATE TABLE t3 (f4 int);
-CREATE TABLE t4 (f6 varchar(1));
-
-SELECT *
-FROM t3
-WHERE 'h' IN (SELECT f6
- FROM t4
- WHERE 5 IN (SELECT f2 FROM t1)
- GROUP BY t4.f6);
-DROP TABLE t1,t3,t4;
-set optimizer_switch=@tmp_860300;
-
---echo #
---echo # BUG#860535: Assertion `keypart_map' failed in mi_rkey with semijoin
---echo #
-set @tmp_860535=@@optimizer_switch;
-set optimizer_switch='semijoin=on,materialization=on,loosescan=off,firstmatch=off';
-CREATE TABLE t1 (f3 int) ;
-INSERT INTO t1 VALUES (1),(7);
-
-CREATE TABLE t2 (f3 int , f5 varchar(1), KEY (f3)) ;
-INSERT INTO t2 VALUES (7,'b');
-
-CREATE TABLE t3 (f3 int , f4 varchar(1) , KEY(f3), KEY (f4,f3)) ;
-INSERT INTO t3 VALUES (1,'t'),(7,'g');
-
-CREATE TABLE t4
-SELECT f3
-FROM t1 WHERE ( f3 ) NOT IN (
- SELECT f3
- FROM t2
- WHERE f5 IN (
- SELECT f4
- FROM t3
- WHERE t3.f3 < 3
- )
-);
-SELECT * FROM t4;
-DROP TABLE t1, t2, t3, t4;
-set optimizer_switch=@tmp_860535;
-
---echo #
---echo # BUG#860553: Crash in create_ref_for_key with semijoin + materialization
---echo #
-CREATE TABLE t1 (f1 int) ;
-CREATE TABLE t2 (f5 varchar(52) NOT NULL) ;
-
-CREATE TABLE t3 (f1 varchar(3), f4 varchar(52) , KEY (f4), PRIMARY KEY (f1));
-
-CREATE TABLE t4 (f3 int, KEY (f3));
-INSERT INTO t4 VALUES (17),(20);
-
-CREATE TABLE t5 (f2 int);
-INSERT INTO t5 VALUES (0),(0);
-
-SELECT *
-FROM t1
-JOIN t2
-ON ( t2.f5 ) IN (
- SELECT t3.f4
- FROM t3
- WHERE ( 1 ) IN (
- SELECT t4.f3
- FROM t4 , t5
- )
-);
-
-DROP TABLE t1, t2, t3, t4, t5;
---echo #
---echo # BUG#868908: Crash in check_simple_equality() with semijoin + materialization + prepared statement
---echo #
-
-CREATE TABLE t1 ( a int );
-CREATE TABLE t3 ( b int, c int) ;
-CREATE TABLE t2 ( a int ) ;
-CREATE TABLE t4 ( a int , c int) ;
-
-PREPARE st1 FROM "
-SELECT STRAIGHT_JOIN *
-FROM t1
-WHERE ( 3 ) IN (
- SELECT t3.b
- FROM t3
- LEFT JOIN (
- t2 STRAIGHT_JOIN t4 ON ( t4.c = t2.a )
- ) ON ( t4.a = t3.c )
-);
-";
-EXECUTE st1;
-EXECUTE st1;
-DROP TABLE t1,t2,t3,t4;
-
---echo #
---echo # BUG#901032: Wrong result for MIN/MAX on an indexed column with materialization and semijoin
---echo #
-CREATE TABLE t1 ( a INT, KEY(a) );
-INSERT INTO t1 VALUES (1);
-CREATE TABLE t2 ( b INT );
-INSERT INTO t2 VALUES (2);
-CREATE TABLE t3 ( c INT );
-INSERT INTO t3 VALUES (2);
-
-SELECT MIN(a) FROM t1, t2 WHERE b IN (SELECT c FROM t3 GROUP BY c);
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo #
---echo # BUG#902632: Crash or invalid read at st_join_table::cleanup, st_table::disable_keyread
---echo #
-CREATE TABLE t1 ( a INT );
-INSERT INTO t1 VALUES (1), (2);
-CREATE TABLE t2 ( b INT );
-INSERT INTO t2 VALUES (3), (4);
-CREATE TABLE t3 ( c INT );
-INSERT INTO t3 VALUES (5), (6);
-
-SELECT * FROM t1 WHERE EXISTS (
- SELECT DISTINCT b FROM t2
- WHERE b <= a
- AND b IN ( SELECT c FROM t3 GROUP BY c )
- );
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # BUG#901506: Crash in TABLE_LIST::print on EXPLAIN EXTENDED
---echo #
-CREATE TABLE t1 ( a INT, KEY(a) );
-INSERT INTO t1 VALUES (8);
-
-EXPLAIN EXTENDED
- SELECT * FROM t1
- WHERE a IN ( SELECT MIN(a) FROM t1 );
-
-DROP TABLE t1;
-
---echo #
---echo # BUG#904432: Wrong result with LEFT JOIN, constant table, semijoin=ON,materialization=ON
---echo #
-CREATE TABLE t1 ( a INT ) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (4);
-CREATE TABLE t2 ( b INT NOT NULL, c INT );
-INSERT INTO t2 VALUES (4,2),(4,2),(4,4),(1,1);
-
-SELECT * FROM t1 LEFT JOIN t2 ON ( a = b )
- WHERE a IN ( SELECT c FROM t2 );
-
-DROP TABLE t1,t2;
-
---echo #
---echo # BUG#922254: Assertion `0' failed at item_cmpfunc.cc:5899: Item* Item_equal::get_first(JOIN_TAB*, Item*)
---echo #
-CREATE TABLE t1 ( a VARCHAR(3) );
-CREATE TABLE t2 ( b VARCHAR(3), c VARCHAR(8), KEY(c) );
-INSERT INTO t2 VALUES ('USA','Abilene'),('USA','Akron');
-
-EXPLAIN
-SELECT * FROM
- ( SELECT * FROM t1 ) AS alias1,
- t2 AS alias2
-WHERE b = a AND a IN (
- SELECT alias3.c
- FROM t2 AS alias3, t2 AS alias4
- WHERE alias4.c = alias3.b
-);
-
-DROP TABLE t1,t2;
-
---echo #
---echo # BUG#928048: Query containing IN subquery with OR in the where clause returns a wrong result
---echo #
-create table t1 (a int, b int);
-insert into t1 values (7,5), (3,3), (5,4), (9,3);
-
-create table t2 (a int, b int, index i_a(a));
-
-insert into t2 values
- (4,2), (7,9), (7,4), (3,1), (5,3), (3,1), (9,4), (8,1);
-
-explain select * from t1 where t1.a in (select a from t2 where t2.a=7 or t2.b<=1);
-select * from t1 where t1.a in (select a from t2 where t2.a=7 or t2.b<=1);
-
-drop table t1,t2;
-
---echo #
---echo # BUG#933407: Valgrind warnings in mark_as_null_row with materialization+semijoin, STRAIGHT_JOIN, impossible WHERE
---echo #
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (0),(8);
-
-SELECT STRAIGHT_JOIN MIN(a) FROM t1
-WHERE a IN (
- SELECT a FROM t1
- WHERE 'condition'='impossible'
- );
-
-DROP TABLE t1;
-
---echo #
---echo # BUG#938131: Subquery materialization is not used in CREATE TABLE SELECT
---echo #
-CREATE TABLE t1(a int);
-INSERT INTO t1 values(1),(2);
-CREATE TABLE t2(a int);
-INSERT INTO t2 values(1),(2);
---echo # Should use Materialization:
-EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT * FROM t2 GROUP BY a HAVING a > 1);
-flush status;
-CREATE TABLE t3 SELECT * FROM t1 WHERE a IN (SELECT * FROM t2 GROUP BY a HAVING a > 1);
-SHOW STATUS LIKE 'Created_tmp_tables';
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # BUG#939009: Crash with aggregate function in IN subquery
---echo #
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='materialization=on,semijoin=on';
-
-CREATE TABLE t1 (a int, b int);
-INSERT INTO t1 VALUES (7,1), (4,2), (7,7);
-
-CREATE TABLE t2 ( c INT );
-INSERT INTO t2 VALUES (4), (7), (6);
-
-EXPLAIN EXTENDED
-SELECT * FROM t1
- WHERE a IN (SELECT MAX(c) FROM t2) AND b=7 AND (a IS NULL OR a=b);
-SELECT * FROM t1
- WHERE a IN (SELECT MAX(c) FROM t2) AND b=7 AND (a IS NULL OR a=b);
-
-EXPLAIN
-SELECT * FROM t1
- WHERE a IN (SELECT MAX(c) FROM t2 WHERE c < 4) AND b=7 AND (a IS NULL OR a=b);
-SELECT * FROM t1
- WHERE a IN (SELECT MAX(c) FROM t2 WHERE c < 4) AND b=7 AND (a IS NULL OR a=b);
-
-SET optimizer_switch=@save_optimizer_switch;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # BUG#946055: Crash with semijoin IN subquery when hash join is used
---echo #
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (7);
-
-CREATE TABLE t2 (b int, c int, d varchar(1), e varchar(1), KEY (c), KEY (d, c));
-
-INSERT INTO t2 VALUES
- (4,2,'v','v'), (6,1,'v','v'), (0,5,'x','x'), (7,1,'x','x'),
- (7,3,'i','i'), (7,1,'e','e'), (1,4,'p','p'), (1,2,'j','j');
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET @save_join_cache_level=@@join_cache_level;
-
-SET join_cache_level=2;
-EXPLAIN
-SELECT a, c FROM t1, t2
- WHERE (a, c) IN (SELECT s1.b, s1.c FROM t2 AS s1, t2 AS s2
- WHERE s2.d = s1.e AND s1.e = (SELECT MAX(e) FROM t2));
-SELECT a, c FROM t1, t2
- WHERE (a, c) IN (SELECT s1.b, s1.c FROM t2 AS s1, t2 AS s2
- WHERE s2.d = s1.e AND s1.e = (SELECT MAX(e) FROM t2));
-
-SET optimizer_switch='join_cache_hashed=on';
-SET join_cache_level=4;
-EXPLAIN
-SELECT a, c FROM t1, t2
- WHERE (a, c) IN (SELECT s1.b, s1.c FROM t2 AS s1, t2 AS s2
- WHERE s2.d = s1.e AND s1.e = (SELECT MAX(e) FROM t2));
-SELECT a, c FROM t1, t2
- WHERE (a, c) IN (SELECT s1.b, s1.c FROM t2 AS s1, t2 AS s2
- WHERE s2.d = s1.e AND s1.e = (SELECT MAX(e) FROM t2));
-
-SET optimizer_switch=@save_optimizer_switch;
-SET join_cache_level=@save_join_cache_level;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # BUG#952297: Server crashes on 2nd execution of PS in Field::is_null with semijoin+materialization
---echo #
-CREATE TABLE t1 ( a VARCHAR(1) );
-INSERT INTO t1 VALUES ('y'),('z');
-
-CREATE TABLE t2 ( b VARCHAR(1), c VARCHAR(1) );
-INSERT INTO t2 VALUES ('v','v'),('v','v');
-
-CREATE VIEW v2 AS SELECT * FROM t2;
-
-PREPARE ps FROM '
-SELECT a FROM t1, v2
-WHERE ( c, b ) IN ( SELECT b, b FROM t2 )
-GROUP BY a ';
-
-EXECUTE ps;
-EXECUTE ps;
-
-DROP VIEW v2;
-DROP TABLE t1, t2;
-
---echo #
---echo # BUG#1000269: Wrong result (extra rows) with semijoin+materialization, IN subqueries, join_cache_level>0
---echo #
-CREATE TABLE t1 (a1 VARCHAR(1), a2 VARCHAR(1)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES ('b','b'),('e','e');
-
-CREATE TABLE t2 (b1 VARCHAR(1), b2 VARCHAR(1), KEY(b1)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES ('v','v'),('s','s'),('l','l'), ('y','y'),('c','c'),('i','i');
-
-SELECT * FROM t1, t2 WHERE b1 IN ( SELECT b2 FROM t2 WHERE b1 > 'o' ) AND ( b1 < 'l' OR a1 IN ('b','c') );
-
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-4465: Reproducible crash (mysqld got signal 11) in multi_delete::initialize_tables with semijoin+materialization
---echo #
-CREATE TABLE t1 (
- id int(11) NOT NULL
-);
-
-CREATE TABLE t2 (
- id int(11) NOT NULL,
- a_id int(11) DEFAULT NULL
-);
-
-insert into t1 values (1), (2), (3);
-insert into t2 values (1, 1), (2, 1), (3, 1), (4, 2), (5, 3), (6, 3), (7, 3);
-
-delete t2 from t2 where a_id in (select * from (select t1.id from t1 limit 2) as x);
-
-drop table t1,t2;
-
---echo # This must be at the end:
-set optimizer_switch=@subselect_sj_mat_tmp;
-set join_cache_level=@save_join_cache_level;
-
---echo #
---echo # MDEV-4908: Assertion `((Item_cond *) cond)->functype() ==
---echo # ((Item_cond *) new_item)->functype()' fails on a query with
---echo # IN and equal conditions, AND/OR, materialization+semijoin
---echo #
-
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch = 'materialization=on,semijoin=on';
-
-CREATE TABLE t1 (pk INT, a INT, b INT, PRIMARY KEY(pk)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,3,5),(2,4,6);
-SELECT * FROM t1 WHERE 8 IN ( SELECT MIN(pk) FROM t1 ) AND ( pk = a OR pk = b );
-
-drop table t1;
-SET optimizer_switch=@save_optimizer_switch;
-
---echo #
---echo # MDEV-5011: ERROR Plugin 'MEMORY' has ref_count=1 after shutdown for SJM queries
---echo #
-CREATE TABLE t1 (pk INT, a INT, b INT, PRIMARY KEY(pk)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,3,5),(2,4,6);
-SELECT * FROM t1 WHERE 8 IN (SELECT MIN(pk) FROM t1) AND (pk = a OR pk = b);
-DROP TABLE t1;
-
---echo #
---echo # MDEV-5368: Server crashes in Item_in_subselect::optimize on 2nd
---echo # execution of PS with IN subqueries, materialization+semijoin
---echo #
-CREATE TABLE t1 (a INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(3);
-
-CREATE TABLE t2 (b INT) ENGINE=MyISAM;
-CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM t2;
-INSERT INTO t2 VALUES (8),(9);
-
-PREPARE stmt FROM "
-SELECT * FROM t1 WHERE 1 IN ( SELECT b FROM v2 WHERE 2 IN ( SELECT MAX(a) FROM t1 ) )
-";
-
-EXECUTE stmt;
-EXECUTE stmt;
-DROP TABLE t1, t2;
-DROP VIEW v2;
-
---echo #
---echo # MDEV-5811: Server crashes in best_access_path with materialization+semijoin and big_tables=ON
---echo #
-SET @tmp_mdev5811= @@big_tables;
-SET big_tables = ON;
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE TABLE t2 (b INT);
-INSERT INTO t2 VALUES (3),(4);
-
-SELECT * FROM t1 AS t1_1, t1 AS t1_2
- WHERE ( t1_1.a, t1_2.a ) IN ( SELECT MAX(b), MIN(b) FROM t2 );
-
-DROP TABLE t1,t2;
-SET big_tables=@tmp_mdev5811;
-
---echo # End of 5.3 tests
-
-
---echo #
---echo # MDEV-5056: Wrong result (extra rows) with materialization+semijoin, IN subqueries
---echo #
-set @tmp_mdev5056=@@join_cache_level;
-SET join_cache_level = 2;
-
-CREATE TABLE t1 ( c1 VARCHAR(2), c2 VARCHAR(2), INDEX(c1) ) ENGINE=MyISAM;
-INSERT INTO t1 VALUES
-('JP','OM'),('VA','JP'),('CA','ML'),('ML','EG'),('DK','CA'),
-('DK','QA'),('YE','PL'),('TR','ZW'),('DK','SK'),('SK','DK'),
-('RO','ML'),('ML','BG'),('BG','ZW'),('ZW','GE'),('GE','JP'),
-('PL','EG'),('QA','YE'),('WF','DK'),('DK','JP'),('EG','OM');
-
-CREATE TABLE t2 ( c3 VARCHAR(2), c4 VARCHAR(2) ) ENGINE=MyISAM;
-INSERT INTO t2 VALUES ('CA','ML'),('IN','HU'),('HU','IN');
-
-SELECT * FROM t1 AS alias1, t1 AS alias2
-WHERE ( alias2.c2, alias1.c1 ) IN ( SELECT c4, c3 FROM t2 ) AND alias1.c1 IN ( SELECT c2 FROM t1 );
-
-DROP TABLE t1,t2;
-set join_cache_level=@tmp_mdev5056;
-
---echo #
---echo # MDEV-5368: Server crashes in Item_in_subselect::optimize on 2nd
---echo # execution of PS with IN subqueries, materialization+semijoin
---echo #
-CREATE TABLE t1 (a INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(3);
-
-CREATE TABLE t2 (b INT) ENGINE=MyISAM;
-CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM t2;
-INSERT INTO t2 VALUES (8),(9);
-
-PREPARE stmt FROM "
-SELECT * FROM t1 WHERE 1 IN ( SELECT b FROM v2 WHERE 2 IN ( SELECT MAX(a) FROM t1 ) )
-";
-
-EXECUTE stmt;
-EXECUTE stmt;
-DROP TABLE t1, t2;
-DROP VIEW v2;
-
---echo #
---echo # MDEV-6289 : Unexpected results when querying information_schema
---echo #
-CREATE TABLE t1 (
- id int(11) unsigned NOT NULL AUTO_INCREMENT,
- db varchar(254) NOT NULL DEFAULT '',
- PRIMARY KEY (id),
- UNIQUE KEY db (db)
-) DEFAULT CHARSET=utf8;
-INSERT INTO t1 (db) VALUES ('mysqltest1'),('mysqltest2'),('mysqltest3'),('mysqltest4');
-
---disable_warnings
-drop database if exists mysqltest1;
-drop database if exists mysqltest2;
-drop database if exists mysqltest3;
-drop database if exists mysqltest4;
---enable_warnings
-create database mysqltest1;
-create database mysqltest2;
-create database mysqltest3;
-create database mysqltest4;
-
-SELECT db FROM t1 WHERE db IN (SELECT SCHEMA_NAME FROM information_schema.schemata) ORDER BY db DESC;
-
-EXPLAIN EXTENDED
-SELECT db FROM t1 WHERE db IN (SELECT SCHEMA_NAME FROM information_schema.schemata) ORDER BY db DESC;
-
-drop table t1;
-drop database mysqltest1;
-drop database mysqltest2;
-drop database mysqltest3;
-drop database mysqltest4;
-
---echo #
---echo # MDEV-7810 Wrong result on execution of a query as a PS
---echo # (both 1st and further executions)
-
-CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (0),(8);
-
-SELECT a FROM (SELECT DISTINCT * FROM t1) AS sq WHERE a IN (SELECT MIN(t2.a) FROM (t1 AS t2));
-PREPARE stmt FROM "
-SELECT a FROM (SELECT DISTINCT * FROM t1) AS sq WHERE a IN (SELECT MIN(t2.a) FROM (t1 AS t2))
-";
-execute stmt;
-execute stmt;
-
-drop table t1;
-
---echo #
---echo # MDEV-12429: IN subquery used in WHERE of EXISTS subquery
---echo #
-
-CREATE TABLE t1 (
- pk INT, f1 INT NOT NULL, f2 VARCHAR(3), f3 INT NULL, PRIMARY KEY(pk)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,1,'foo',8), (2,5,'bar',7);
-
-SELECT sq1.f2 FROM t1 AS sq1
- WHERE EXISTS ( SELECT * FROM t1 AS sq2
- WHERE sq1.`pk` IN ( SELECT f1 FROM t1 ) AND sq2.f1 = sq1.f1 );
-
-set @save_optimizer_switch= @@optimizer_switch;
-
-set optimizer_switch='exists_to_in=off';
-EXPLAIN
-SELECT sq1.f2 FROM t1 AS sq1
- WHERE EXISTS ( SELECT * FROM t1 AS sq2
- WHERE sq1.`pk` IN ( SELECT f1 FROM t1 ) AND sq2.f1 = sq1.f1 );
-
---echo # this checks the result set above
-set optimizer_switch= 'materialization=off,semijoin=off';
-SELECT sq1.f2 FROM t1 AS sq1
- WHERE EXISTS ( SELECT * FROM t1 AS sq2
- WHERE sq1.`pk` IN ( SELECT f1 FROM t1 ) AND sq2.f1 = sq1.f1 );
-
-set optimizer_switch= @save_optimizer_switch;
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-12145: IN subquery used in WHERE of EXISTS subquery
---echo #
-
-CREATE TABLE t1 (f1 INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (4),(6);
-
-CREATE TABLE t2 (i2 INT, KEY(i2)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (8),(7),(1);
-
-CREATE TABLE t3 (f3 INT, i3 INT, KEY(i3)) ENGINE=MyISAM;
-INSERT INTO t3 VALUES (8,0),(6,3),(2,8),(3,8),(1,6),(0,0),(1,0),(1,5);
-
-set @save_optimizer_switch= @@optimizer_switch;
-
-set optimizer_switch='exists_to_in=off';
-SELECT * FROM t1
- WHERE EXISTS ( SELECT * FROM t2, t3
- WHERE i3 = i2 AND f1 IN ( SELECT f3 FROM t3 ) );
-EXPLAIN EXTENDED
-SELECT * FROM t1
- WHERE EXISTS ( SELECT * FROM t2, t3
- WHERE i3 = i2 AND f1 IN ( SELECT f3 FROM t3 ) );
-
---echo # this checks the result set above
-set optimizer_switch= 'materialization=off,semijoin=off';
-SELECT * FROM t1
- WHERE EXISTS ( SELECT * FROM t2, t3
- WHERE i3 = i2 AND f1 IN ( SELECT f3 FROM t3 ) );
-
-set optimizer_switch= @save_optimizer_switch;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # MDEV-9686: IN subquery used in WHERE of a subquery from select list
---echo #
-
-CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT);
-INSERT INTO t1 VALUES (1, 4),(2, 3),(3, 3),(4, 6),(5, 3);
-
-CREATE TABLE t2 (f2 INT);
-INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
-
---echo # t1.pk is always IN ( SELECT f2 FROM t2 ),
---echo # so the IN condition should be true for every row,
---echo # and thus COUNT(*) should always return 5
-
-SELECT pk, f1, ( SELECT COUNT(*) FROM t2
- WHERE t1.pk IN ( SELECT f2 FROM t2 ) ) AS sq FROM t1;
-EXPLAIN EXTENDED
-SELECT pk, f1, ( SELECT COUNT(*) FROM t2
- WHERE t1.pk IN ( SELECT f2 FROM t2 ) ) AS sq FROM t1;
-
---echo # this checks the result set above
-set @save_optimizer_switch= @@optimizer_switch;
-set optimizer_switch= 'materialization=off,semijoin=off';
-SELECT pk, f1, ( SELECT COUNT(*) FROM t2
- WHERE t1.pk IN ( SELECT f2 FROM t2 ) ) AS sq FROM t1;
-set optimizer_switch= @save_optimizer_switch;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # mdev-12838: scan of materialized of semi-join subquery in join
---echo #
-
-set @save_optimizer_switch=@@optimizer_switch;
-
-CREATE TABLE t1 (
- dispatch_group varchar(32),
- assignment_group varchar(32),
- sys_id char(32),
- PRIMARY KEY (sys_id),
- KEY idx1 (dispatch_group),
- KEY idx2 (assignment_group)
-) ENGINE=MyISAM;
-
-CREATE TABLE t2 (
- ugroup varchar(32),
- user varchar(32),
- sys_id char(32),
- PRIMARY KEY (sys_id),
- KEY idx3 (ugroup),
- KEY idx4 (user)
-) ENGINE=MyISAM;
-
-CREATE TABLE t3 (
- type mediumtext,
- sys_id char(32),
- PRIMARY KEY (sys_id)
-) ENGINE=MyISAM;
-
---disable_query_log
-
-INSERT INTO t1 VALUES
-('e5d9f63237232000158bbfc8bcbe5dbf','f304ae0037332000158bbfc8bcbe5d4f',
-'5398c0e037003000158bbfc8bcbe5dbb'),
-('69d9f63237232000158bbfc8bcbe5dcb','7172ea0037332000158bbfc8bcbe5db6',
-'5c188ca037003000158bbfc8bcbe5dbc'),
-('577ed708d773020058c92cf65e61037a','699708d4d773020058c92cf65e61037c',
-'623a8cd4d773020058c92cf65e6103ea'),
-('96fb652637232000158bbfc8bcbe5db4','df50316637232000158bbfc8bcbe5d23',
-'6835bd6637232000158bbfc8bcbe5d21'),
-('e1d9f63237232000158bbfc8bcbe5db8','96346e0037332000158bbfc8bcbe5daa',
-'697880e037003000158bbfc8bcbe5dcd'),
-('25d9f63237232000158bbfc8bcbe5dbe','f304ae0037332000158bbfc8bcbe5d4f',
-'6a9804e037003000158bbfc8bcbe5d09'),
-('96fb652637232000158bbfc8bcbe5db4','e08fad2637232000158bbfc8bcbe5d39',
-'6d25f96637232000158bbfc8bcbe5d79'),
-('e9d9f63237232000158bbfc8bcbe5dc6','7172ea0037332000158bbfc8bcbe5db6',
-'702880e037003000158bbfc8bcbe5d94'),
-('a5d9f63237232000158bbfc8bcbe5dca','f304ae0037332000158bbfc8bcbe5d4f',
-'7188c0e037003000158bbfc8bcbe5d75'),
-('65d9f63237232000158bbfc8bcbe5dc4','f304ae0037332000158bbfc8bcbe5d4f',
-'778880e037003000158bbfc8bcbe5d9e'),
-('a1d9f63237232000158bbfc8bcbe5dc3','7172ea0037332000158bbfc8bcbe5db6',
-'7d0840e037003000158bbfc8bcbe5dde'),
-('21d9f63237232000158bbfc8bcbe5db7','96346e0037332000158bbfc8bcbe5daa',
-'7f6880e037003000158bbfc8bcbe5da7'),
-('96fb652637232000158bbfc8bcbe5db4','ec70316637232000158bbfc8bcbe5d60',
-'8025f96637232000158bbfc8bcbe5dd0'),
-('3dd9f63237232000158bbfc8bcbe5dcc','7172ea0037332000158bbfc8bcbe5db6',
-'823880e037003000158bbfc8bcbe5ded'),
-('96fb652637232000158bbfc8bcbe5db4','7b10fd2637232000158bbfc8bcbe5d30',
-'9a353d6637232000158bbfc8bcbe5dee'),
-('75d9f63237232000158bbfc8bcbe5dd0','ebb4620037332000158bbfc8bcbe5d89',
-'a558c0e037003000158bbfc8bcbe5d36'),
-('6dd9f63237232000158bbfc8bcbe5db5','96346e0037332000158bbfc8bcbe5daa',
-'bc78cca037003000158bbfc8bcbe5d74'),
-('add9f63237232000158bbfc8bcbe5dc7','7172ea0037332000158bbfc8bcbe5db6',
-'c53804a037003000158bbfc8bcbe5db8'),
-('fdd9f63237232000158bbfc8bcbe5dcd','7864ae0037332000158bbfc8bcbe5db8',
-'cfe740e037003000158bbfc8bcbe5de8'),
-('96fb652637232000158bbfc8bcbe5db4','3120fd2637232000158bbfc8bcbe5d42',
-'e2257d6637232000158bbfc8bcbe5ded'),
-('3c3725e237232000158bbfc8bcbe5da1','96346e0037332000158bbfc8bcbe5daa',
-'ee78c0e037003000158bbfc8bcbe5db5'),
-('a9d9f63237232000158bbfc8bcbe5dc0','7172ea0037332000158bbfc8bcbe5db6',
-'f00888a037003000158bbfc8bcbe5dd3'),
-('29d9f63237232000158bbfc8bcbe5db9','7172ea0037332000158bbfc8bcbe5db6',
-'fa0880e037003000158bbfc8bcbe5d70'),
-('b1d9f63237232000158bbfc8bcbe5dcf','ebb4620037332000158bbfc8bcbe5d89',
-'fa48c0e037003000158bbfc8bcbe5d28');
-
-INSERT INTO t2 VALUES
-('17801ac21b13200050fdfbcd2c0713e8','8e826bf03710200044e0bfc8bcbe5d86',
-'14c19a061b13200050fdfbcd2c07134b'),
-('577ed708d773020058c92cf65e61037a','931644d4d773020058c92cf65e61034c',
-'339888d4d773020058c92cf65e6103aa'),
-('df50316637232000158bbfc8bcbe5d23','92826bf03710200044e0bfc8bcbe5da9',
-'3682f56637232000158bbfc8bcbe5d44'),
-('b4f342b237232000158bbfc8bcbe5def','86826bf03710200044e0bfc8bcbe5d70',
-'38e4c2b237232000158bbfc8bcbe5dea'),
-('7b10fd2637232000158bbfc8bcbe5d30','8a826bf03710200044e0bfc8bcbe5d72',
-'4442b56637232000158bbfc8bcbe5d43'),
-('3120fd2637232000158bbfc8bcbe5d42','82826bf03710200044e0bfc8bcbe5d89',
-'49d2396637232000158bbfc8bcbe5d12'),
-('96fb652637232000158bbfc8bcbe5db4','86826bf03710200044e0bfc8bcbe5d79',
-'4e3ca52637232000158bbfc8bcbe5d3e'),
-('17801ac21b13200050fdfbcd2c0713e8','824fd523bf4320007a6d257b3f073963',
-'58c19a061b13200050fdfbcd2c07134e'),
-('699708d4d773020058c92cf65e61037c','901784d4d773020058c92cf65e6103da',
-'5bc708d4d773020058c92cf65e6103d5'),
-('75d9f63237232000158bbfc8bcbe5dd0','86826bf03710200044e0bfc8bcbe5d79',
-'6b52cb7237232000158bbfc8bcbe5ded'),
-('f253da061b13200050fdfbcd2c0713ab','8e826bf03710200044e0bfc8bcbe5d86',
-'81045e061b13200050fdfbcd2c071373'),
-('7b10fd2637232000158bbfc8bcbe5d30','8e826bf03710200044e0bfc8bcbe5d74',
-'8c42b56637232000158bbfc8bcbe5d3f'),
-('e5d9f63237232000158bbfc8bcbe5dbf','7a826bf03710200044e0bfc8bcbe5df5',
-'a7acfe3237232000158bbfc8bcbe5d78'),
-('8a5055c9c61122780043563ef53438e3','9ee1b13dc6112271007f9d0efdb69cd0',
-'a9aff553c6112276015a8006174bee21'),
-('8a4dde73c6112278017a6a4baf547aa7','9ee1b13dc6112271007f9d0efdb69cd0',
-'a9b2f526c61122760003ae07349d294f'),
-('aaccc971c0a8001500fe1ff4302de101','9ee1b13dc6112271007f9d0efdb69cd0',
-'aacceed3c0a80015009069bba51c4e21'),
-('65d9f63237232000158bbfc8bcbe5dc4','8d56406a0a0a0a6b004070b354aada28',
-'ac1bfa3237232000158bbfc8bcbe5dc3'),
-('b85d44954a3623120004689b2d5dd60a','97000fcc0a0a0a6e0104ca999f619e5b',
-'b77bc032cbb00200d71cb9c0c24c9c45'),
-('220f8e71c61122840197e57c33464f70','8d56406a0a0a0a6b004070b354aada28',
-'b9b74f080a0a0b343ba75b95bdb27056'),
-('e08fad2637232000158bbfc8bcbe5d39','82826bf03710200044e0bfc8bcbe5d80',
-'be02756637232000158bbfc8bcbe5d8b'),
-('ebb4620037332000158bbfc8bcbe5d89','7682abf03710200044e0bfc8bcbe5d25',
-'c0122f4437732000158bbfc8bcbe5d7d'),
-('96fb652637232000158bbfc8bcbe5db4','7a82abf03710200044e0bfc8bcbe5d27',
-'c23ca52637232000158bbfc8bcbe5d3b'),
-('22122b37c611228400f9ff91c857581d','9ee1b13dc6112271007f9d0efdb69cd0',
-'d23bbf5dac14641866947512bde59dc5'),
-('db53a9290a0a0a650091abebccf833c6','9ee1b13dc6112271007f9d0efdb69cd0',
-'db54a0f60a0a0a65002c54dcb72b4f41'),
-('e08fad2637232000158bbfc8bcbe5d39','8e826bf03710200044e0bfc8bcbe5d86',
-'f602756637232000158bbfc8bcbe5d88'),
-('699708d4d773020058c92cf65e61037c','8d59d601d7b3020058c92cf65e6103c2',
-'f718a241d7b3020058c92cf65e610332'),
-('df50316637232000158bbfc8bcbe5d23','9e826bf03710200044e0bfc8bcbe5da6',
-'fe82f56637232000158bbfc8bcbe5d4e'),
-('f972d6061b13200050fdfbcd2c0713e5','780395f0df031100a9e78b6c3df2631f',
-'ff4395f0df031100a9e78b6c3df2637e');
-
-INSERT INTO t3 VALUES
-('87245e061b13200050fdfbcd2c0713cc','7172ea0037332000158bbfc8bcbe5db6'),
-('74af88c6c611227d0066386e74dc853d','74ad1ff3c611227d01d25feac2af603f'),
-('59e22fb137032000158bbfc8bcbe5d52','75d9f63237232000158bbfc8bcbe5dd0'),
-('98906fb137032000158bbfc8bcbe5d65','781da52637232000158bbfc8bcbe5db8'),
-('87245e061b13200050fdfbcd2c0713cc','7864ae0037332000158bbfc8bcbe5db8'),
-('87245e061b13200050fdfbcd2c0713cc','7b10fd2637232000158bbfc8bcbe5d30'),
-('59e22fb137032000158bbfc8bcbe5d52','81a880e037003000158bbfc8bcbe5df8'),
-('74af88c6c611227d0066386e74dc853d','8a4cb6d4c61122780043b1642efcd52b'),
-('1cb8ab9bff500200158bffffffffff62','8a4dde73c6112278017a6a4baf547aa7'),
-('1cb8ab9bff500200158bffffffffff62','8a5055c9c61122780043563ef53438e3'),
-('87245e061b13200050fdfbcd2c0713cc','96346e0037332000158bbfc8bcbe5daa'),
-('59e22fb137032000158bbfc8bcbe5d52','96fb652637232000158bbfc8bcbe5db4'),
-('59e22fb137032000158bbfc8bcbe5d52','a1d9f63237232000158bbfc8bcbe5dc3'),
-('59e22fb137032000158bbfc8bcbe5d52','a5d9f63237232000158bbfc8bcbe5dca'),
-('1cb8ab9bff500200158bffffffffff62','a715cd759f2002002920bde8132e7018'),
-('59e22fb137032000158bbfc8bcbe5d52','a9d9f63237232000158bbfc8bcbe5dc0'),
-('74af88c6c611227d0066386e74dc853d','aacb62e2c0a80015007f67f752c2b12c'),
-('74af88c6c611227d0066386e74dc853d','aaccc971c0a8001500fe1ff4302de101'),
-('59e22fb137032000158bbfc8bcbe5d52','add9f63237232000158bbfc8bcbe5dbb'),
-('59e22fb137032000158bbfc8bcbe5d52','add9f63237232000158bbfc8bcbe5dc7'),
-('59e22fb137032000158bbfc8bcbe5d52','b1d9f63237232000158bbfc8bcbe5dcf'),
-('1cb8ab9bff500200158bffffffffff62','b85d44954a3623120004689b2d5dd60a'),
-('1cb8ab9bff500200158bffffffffff62','b97e89b94a36231201676b73322a0311'),
-('1cb8ab9bff500200158bffffffffff62','cfcbad03d711110050f5edcb9e61038f'),
-('1cb8ab9bff500200158bffffffffff62','d625dccec0a8016700a222a0f7900d06'),
-('1cb8ab9bff500200158bffffffffff62','db53580b0a0a0a6501aa37c294a2ba6b'),
-('1cb8ab9bff500200158bffffffffff62','db53a9290a0a0a650091abebccf833c6'),
-('1cb8ab9bff500200158bffffffffff62','dc0db135c332010016194ffe5bba8f23'),
-('87245e061b13200050fdfbcd2c0713cc','df50316637232000158bbfc8bcbe5d23'),
-('87245e061b13200050fdfbcd2c0713cc','e08fad2637232000158bbfc8bcbe5d39'),
-('59e22fb137032000158bbfc8bcbe5d52','e1d9f63237232000158bbfc8bcbe5db8'),
-('59e22fb137032000158bbfc8bcbe5d52','e5d9f63237232000158bbfc8bcbe5db4'),
-('59e22fb137032000158bbfc8bcbe5d52','e5d9f63237232000158bbfc8bcbe5dbf'),
-('59e22fb137032000158bbfc8bcbe5d52','e9d9f63237232000158bbfc8bcbe5dba'),
-('59e22fb137032000158bbfc8bcbe5d52','e9d9f63237232000158bbfc8bcbe5dc6'),
-('87245e061b13200050fdfbcd2c0713cc','ebb4620037332000158bbfc8bcbe5d89'),
-('87245e061b13200050fdfbcd2c0713cc','ec70316637232000158bbfc8bcbe5d60'),
-('87245e061b13200050fdfbcd2c0713cc','f253da061b13200050fdfbcd2c0713ab'),
-('87245e061b13200050fdfbcd2c0713cc','f304ae0037332000158bbfc8bcbe5d4f'),
-('98906fb137032000158bbfc8bcbe5d65','f972d6061b13200050fdfbcd2c0713e5'),
-('59e22fb137032000158bbfc8bcbe5d52','fdd9f63237232000158bbfc8bcbe5dcd');
-
---enable_query_log
-
-let $q=
-SELECT t1.assignment_group
-FROM t1, t3
-WHERE t1.assignment_group = t3.sys_id AND
- t1.dispatch_group IN
- (SELECT t2.ugroup
- FROM t2, t3 t3_i
- WHERE t2.ugroup = t3_i.sys_id AND
- t3_i.type LIKE '59e22fb137032000158bbfc8bcbe5d52' AND
- t2.user = '86826bf03710200044e0bfc8bcbe5d79');
-
-set optimizer_switch='materialization=off';
-eval explain $q;
-eval $q;
-
-set optimizer_switch='materialization=on';
-eval explain $q;
-eval $q;
-
-DROP TABLE t1,t2,t3;
-set optimizer_switch=@save_optimizer_switch;
-
---echo # End of 5.5 tests
---echo #
---echo # MDEV-7220: Materialization strategy is not used for REPLACE ... SELECT
---echo #
-create table t0(a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1 (a int, b int, c int);
-insert into t1
-select A.a+B.a*10+C.a*100, A.a+B.a*10+C.a*100, A.a+B.a*10+C.a*100
-from t0 A, t0 B, t0 C;
-
-create table t2 (a int, b int, c int);
-insert into t2 select A.a, A.a, A.a from t1 A;
-insert into t2 select * from t2;
-insert into t2 select * from t2;
-
-create table t3 as select * from t2 limit 1;
-
---echo # The testcase only makes sense if the following uses Materialization:
-explain
-select * from t1 where (a,b) in (select max(a),b from t2 group by b);
-
-flush status;
-replace into t3
-select * from t1 where (a,b) in (select max(a),b from t2 group by b);
---echo # Sequential reads:
---echo # 1K is read from t1
---echo # 4K is read from t2
---echo # 1K groups is read from the tmp. table
---echo #
---echo # Lookups:
---echo # 4K lookups in group by table
---echo # 1K lookups in temp.table
---echo #
---echo # Writes:
---echo # 2x 1K writes to temporary tables (grouping table and subquery materialization table
---echo #
---echo # The point is that neither counter should be in the millions (this
---echo # will happen if Materialization is not used
-show status where Variable_name like 'Handler_read%' or Variable_name like 'Handler_%write%';
-
-drop table t0,t1,t2,t3;
-
---echo #
---echo # MDEV-7971: Assertion `name != __null' failed in ACL_internal_schema_registry::lookup
---echo # on 2nd execution os PS with multi-table update
---echo #
-CREATE TABLE t1 (f1 INT);
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE TABLE t2 (f2 INT);
-INSERT INTO t2 VALUES (3),(4);
-
-CREATE TABLE t3 (f3 INT);
-INSERT INTO t3 VALUES (5),(6);
-
-PREPARE stmt FROM '
- UPDATE t1, t2
- SET f1 = 5
- WHERE 8 IN ( SELECT MIN(f3) FROM t3 )
-';
-
-EXECUTE stmt;
-EXECUTE stmt;
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # MDEV-10389: Query returns different results on a debug vs non-debug build of the same revision
---echo #
-CREATE TABLE t1 (i1 INT, i2 INT NOT NULL);
-INSERT INTO t1 VALUES (1,4),(2,6);
-
-SELECT * FROM t1 AS alias1
-WHERE alias1.i1 IN (
- SELECT i1 FROM t1 WHERE alias1.i2 IN ( SELECT i2 FROM t1 HAVING i2 <> 7 )
-);
-DROP TABLE t1;
-
diff --git a/mysql-test/t/subselect_sj_nonmerged.test b/mysql-test/t/subselect_sj_nonmerged.test
deleted file mode 100644
index e47e72ffe97..00000000000
--- a/mysql-test/t/subselect_sj_nonmerged.test
+++ /dev/null
@@ -1,121 +0,0 @@
-#
-# Tests for non-merged semi-joins
-#
---disable_warnings
-drop table if exists t0, t1, t2, t3, t4;
---enable_warnings
-
-set @save_optimizer_switch=@@optimizer_switch;
-set optimizer_switch='semijoin=on,materialization=on';
-set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
-
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-
-# Check the case of subquery having agggregates but not having grouping
-
-create table t1 as select * from t0;
---echo # The following should use full scan on <subquery2> and it must scan 1 row:
-explain select * from t0 where a in (select max(a) from t1);
-select * from t0 where a in (select max(a) from t1);
-
-# Ok, now check the trivial match/no-match/NULL on the left/NULL on the right cases
-insert into t1 values (11);
-select * from t0 where a in (select max(a) from t1);
-delete from t1 where a=11;
-
-insert into t0 values (NULL);
-select * from t0 where a in (select max(a) from t1);
-delete from t0 where a is NULL;
-
-delete from t1;
-select * from t0 where a in (select max(a) from t1);
-
-insert into t0 values (NULL);
-select * from t0 where a in (select max(a) from t1);
-delete from t0 where a is NULL;
-
-drop table t1;
-
-#
-# Try with join subqueries
-#
-
-create table t1 (a int, b int);
-insert into t1 select a,a from t0; # 10 rows
-create table t2 as select * from t1 where a<5; # 5 rows
-create table t3 as select (A.a + 10*B.a) as a from t0 A, t0 B; # 100 rows
-alter table t3 add primary key(a);
-
---echo # The following should have do a full scan on <subquery2> and scan 5 rows
---echo # (despite that subquery's join output estimate is 50 rows)
-explain select * from t3 where a in (select max(t2.a) from t1, t2 group by t2.b);
-
---echo # Compare to this which really will have 50 record combinations:
-explain select * from t3 where a in (select max(t2.a) from t1, t2 group by t2.b, t1.b);
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='outer_join_with_cache=off';
-
---echo # Outer joins also work:
-explain select * from t3
-where a in (select max(t2.a) from t1 left join t2 on t1.a=t2.a group by t2.b, t1.b);
-
-SET optimizer_switch=@save_optimizer_switch;
-
-#
-# Check if joins on the outer side also work
-#
-
-create table t4 (a int, b int, filler char(20), unique key(a,b));
-insert into t4 select A.a + 10*B.a, A.a + 10*B.a, 'filler' from t0 A, t0 B; # 100 rows
-explain select * from t0, t4 where
- t4.b=t0.a and t4.a in (select max(t2.a) from t1, t2 group by t2.b);
-
-insert into t4 select 100 + (B.a *100 + A.a), 100 + (B.a*100 + A.a), 'filler' from t4 A, t0 B;
-explain select * from t4 where
- t4.a in (select max(t2.a) from t1, t2 group by t2.b) and
- t4.b in (select max(t2.a) from t1, t2 group by t2.b);
-
-drop table t1,t2,t3,t4;
-
-drop table t0;
-
---echo #
---echo # BUG#780359: Crash with get_fanout_with_deps in maria-5.3-mwl90
---echo #
-CREATE TABLE t1 (f1 int);
-INSERT INTO t1 VALUES (2),(2);
-
-CREATE TABLE t2 (f3 int);
-INSERT INTO t2 VALUES (2),(2);
-
-SELECT *
-FROM t1
-WHERE ( f1 ) IN (
- SELECT t2.f3
- FROM t2
- WHERE t2.f3 = 97
- AND t2.f3 = 50
- GROUP BY 1
-);
-
-DROP TABLE t1, t2;
-
---echo #
---echo # BUG#727183: WL#90 does not trigger with non-comma joins
---echo #
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1(a int, key(a));
-insert into t1 select A.a + 10*B.a + 100*C.a from t0 A, t0 B, t0 C;
-
---echo # The following must use non-merged SJ-Materialization:
-explain select * from t1 X join t0 Y on X.a < Y.a where X.a in (select max(a) from t0);
-
-drop table t0, t1;
-
-set optimizer_switch=@save_optimizer_switch;
-
diff --git a/mysql-test/t/sum_distinct-big.test b/mysql-test/t/sum_distinct-big.test
deleted file mode 100644
index fee406ee46d..00000000000
--- a/mysql-test/t/sum_distinct-big.test
+++ /dev/null
@@ -1,153 +0,0 @@
-#
-# Various tests for SUM(DISTINCT ...)
-#
-
---source include/big_test.inc
---source include/have_innodb.inc
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-set @save_tmp_table_size=@@tmp_table_size;
-set @save_max_heap_table_size=@@max_heap_table_size;
-
-set @save_storage_engine=@@storage_engine;
-
-#
-# Test the case when distinct values doesn't fit in memory and
-# filesort is used (see uniques.cc:merge_walk)
-#
-
-set storage_engine=MYISAM;
-
-CREATE TABLE t1 (id INTEGER);
-CREATE TABLE t2 (id INTEGER);
-
-INSERT INTO t1 (id) VALUES (1), (1), (1),(1);
-INSERT INTO t1 (id) SELECT id FROM t1; /* 8 */
-INSERT INTO t1 (id) SELECT id FROM t1; /* 12 */
-INSERT INTO t1 (id) SELECT id FROM t1; /* 16 */
-INSERT INTO t1 (id) SELECT id FROM t1; /* 20 */
-INSERT INTO t1 (id) SELECT id FROM t1; /* 24 */
-INSERT INTO t1 SELECT id+1 FROM t1;
-INSERT INTO t1 SELECT id+2 FROM t1;
-INSERT INTO t1 SELECT id+4 FROM t1;
-INSERT INTO t1 SELECT id+8 FROM t1;
-INSERT INTO t1 SELECT id+16 FROM t1;
-INSERT INTO t1 SELECT id+32 FROM t1;
-INSERT INTO t1 SELECT id+64 FROM t1;
-INSERT INTO t1 SELECT id+128 FROM t1;
-INSERT INTO t1 SELECT id+256 FROM t1;
-INSERT INTO t1 SELECT id+512 FROM t1;
-
-# Just test that AVG(DISTINCT) is there
-SELECT AVG(DISTINCT id) FROM t1 GROUP BY id % 13;
-SELECT SUM(DISTINCT id)/COUNT(DISTINCT id) FROM t1 GROUP BY id % 13;
-
-INSERT INTO t1 SELECT id+1024 FROM t1;
-INSERT INTO t1 SELECT id+2048 FROM t1;
-INSERT INTO t1 SELECT id+4096 FROM t1;
-INSERT INTO t1 SELECT id+8192 FROM t1;
-INSERT INTO t2 SELECT id FROM t1 ORDER BY id*rand();
-
-# SELECT '++++++++++++++++++++++++++++++++++++++++++++++++++';
-
-SELECT SUM(DISTINCT id) sm FROM t1;
-SELECT SUM(DISTINCT id) sm FROM t2;
-SELECT SUM(DISTINCT id) sm FROM t1 group by id % 13;
-
-# this limit for max_heap_table_size is set to force testing the case, when
-# all distinct sum values can not fit in memory and must be stored in a
-# temporary table
-
-SET max_heap_table_size=16384;
-
-# to check that max_heap_table_size was actually set (hard limit for minimum
-# max_heap_table_size is set in mysqld.cc):
-
-SHOW variables LIKE 'max_heap_table_size';
-
-SELECT SUM(DISTINCT id) sm FROM t1;
-SELECT SUM(DISTINCT id) sm FROM t2;
-SELECT SUM(DISTINCT id) sm FROM t1 GROUP BY id % 13;
-
---echo #
---echo # Bug mdev-4063: SUM(DISTINCT...) with small'max_heap_table_size
---echo # (bug #56927)
---echo #
-
-SET max_heap_table_size=default;
-
-INSERT INTO t1 SELECT id+16384 FROM t1;
-DELETE FROM t2;
-INSERT INTO t2 SELECT id FROM t1 ORDER BY id*rand();
-
-SELECT SUM(DISTINCT id) sm FROM t2;
-
-SET max_heap_table_size=16384;
-
-SELECT SUM(DISTINCT id) sm FROM t2;
-
-DROP TABLE t1;
-DROP TABLE t2;
-
-SET @@tmp_table_size=@save_tmp_table_size;
-SET @@max_heap_table_size=@save_max_heap_table_size;
-
---echo #
---echo # Bug mdev-4311: COUNT(DISTINCT...) requiring a file for Unique
---echo # (bug #68749)
---echo #
-
-set @save_storage_engine=@@storage_engine;
-set storage_engine=INNODB;
-
-CREATE TABLE t1 (id INTEGER) ENGINE=InnoDB;
-CREATE TABLE t2 (id INTEGER) ENGINE=InnoDB;
-
-INSERT INTO t1 (id) VALUES (1), (1), (1),(1);
-INSERT INTO t1 (id) SELECT id FROM t1;
-INSERT INTO t1 (id) SELECT id FROM t1;
-INSERT INTO t1 (id) SELECT id FROM t1;
-INSERT INTO t1 (id) SELECT id FROM t1;
-INSERT INTO t1 (id) SELECT id FROM t1;
-INSERT INTO t1 SELECT id+1 FROM t1;
-INSERT INTO t1 SELECT id+2 FROM t1;
-INSERT INTO t1 SELECT id+4 FROM t1;
-INSERT INTO t1 SELECT id+8 FROM t1;
-INSERT INTO t1 SELECT id+16 FROM t1;
-INSERT INTO t1 SELECT id+32 FROM t1;
-INSERT INTO t1 SELECT id+64 FROM t1;
-INSERT INTO t1 SELECT id+128 FROM t1;
-INSERT INTO t1 SELECT id+256 FROM t1;
-INSERT INTO t1 SELECT id+512 FROM t1;
-INSERT INTO t1 SELECT id+1024 FROM t1;
-INSERT INTO t1 SELECT id+2048 FROM t1;
-INSERT INTO t1 SELECT id+4096 FROM t1;
-INSERT INTO t1 SELECT id+8192 FROM t1;
-
-INSERT INTO t2 SELECT id FROM t1 ORDER BY id*rand();
-INSERT INTO t2 VALUE(NULL);
-
---echo # With default tmp_table_size / max_heap_table_size
-SELECT SQL_NO_CACHE count(DISTINCT id) sm FROM t2;
-
-set @@tmp_table_size=1024*256;
-
---echo # With reduced tmp_table_size
-SELECT SQL_NO_CACHE count(DISTINCT id) sm FROM t2;
-
-set @@tmp_table_size=@save_tmp_table_size;
-SET @@max_heap_table_size=1024*256;
-
---echo # With reduced max_heap_table_size
-SELECT SQL_NO_CACHE count(DISTINCT id) sm FROM t2;
-
-SET @@max_heap_table_size=@save_max_heap_table_size;
-
---echo # Back to default tmp_table_size / max_heap_table_size
-SELECT SQL_NO_CACHE count(DISTINCT id) sm FROM t2;
-
-DROP TABLE t1,t2;
-
-set storage_engine=@save_storage_engine;
diff --git a/mysql-test/t/sum_distinct.test b/mysql-test/t/sum_distinct.test
deleted file mode 100644
index 633a72fddc8..00000000000
--- a/mysql-test/t/sum_distinct.test
+++ /dev/null
@@ -1,107 +0,0 @@
-#
-# Various tests for SUM(DISTINCT ...)
-#
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-CREATE TABLE t1 (
- id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
- gender CHAR(1),
- name VARCHAR(20)
-);
-
-# According to ANSI SQL, SUM(DISTINCT ...) should return NULL for empty
-# record set
-
-SELECT SUM(DISTINCT LENGTH(name)) s1 FROM t1;
-
-# According to ANSI SQL, SUM(DISTINCT ...) should return NULL for records sets
-# entirely consisting of NULLs
-
-INSERT INTO t1 (gender, name) VALUES (NULL, NULL);
-INSERT INTO t1 (gender, name) VALUES (NULL, NULL);
-INSERT INTO t1 (gender, name) VALUES (NULL, NULL);
-
-SELECT SUM(DISTINCT LENGTH(name)) s1 FROM t1;
-
-
-# Filling table with t1
-
-INSERT INTO t1 (gender, name) VALUES ('F', 'Helen'), ('F', 'Anastasia'),
-('F', 'Katherine'), ('F', 'Margo'), ('F', 'Magdalene'), ('F', 'Mary');
-
-CREATE TABLE t2 SELECT name FROM t1;
-
-SELECT (SELECT SUM(DISTINCT LENGTH(name)) FROM t1) FROM t2;
-
-DROP TABLE t2;
-
-INSERT INTO t1 (gender, name) VALUES ('F', 'Eva'), ('F', 'Sofia'),
-('F', 'Sara'), ('F', 'Golda'), ('F', 'Toba'), ('F', 'Victory'),
-('F', 'Faina'), ('F', 'Miriam'), ('F', 'Beki'), ('F', 'America'),
-('F', 'Susan'), ('F', 'Glory'), ('F', 'Priscilla'), ('F', 'Rosmary'),
-('F', 'Rose'), ('F', 'Margareth'), ('F', 'Elizabeth'), ('F', 'Meredith'),
-('F', 'Julie'), ('F', 'Xenia'), ('F', 'Zena'), ('F', 'Olga'),
-('F', 'Brunhilda'), ('F', 'Nataly'), ('F', 'Lara'), ('F', 'Svetlana'),
-('F', 'Grethem'), ('F', 'Irene');
-
-SELECT
- SUM(DISTINCT LENGTH(name)) s1,
- SUM(DISTINCT SUBSTRING(NAME, 1, 3)) s2,
- SUM(DISTINCT LENGTH(SUBSTRING(name, 1, 4))) s3
-FROM t1;
-
-SELECT
- SUM(DISTINCT LENGTH(g1.name)) s1,
- SUM(DISTINCT SUBSTRING(g2.name, 1, 3)) s2,
- SUM(DISTINCT LENGTH(SUBSTRING(g3.name, 1, 4))) s3
-FROM t1 g1, t1 g2, t1 g3;
-
-SELECT
- SUM(DISTINCT LENGTH(g1.name)) s1,
- SUM(DISTINCT SUBSTRING(g2.name, 1, 3)) s2,
- SUM(DISTINCT LENGTH(SUBSTRING(g3.name, 1, 4))) s3
-FROM t1 g1, t1 g2, t1 g3 GROUP BY LENGTH(SUBSTRING(g3.name, 5, 10));
-
-# here we explicitly request summing through temporary table (so
-# Item_sum_sum_distinct::copy_or_same() is called)
-
-SELECT SQL_BUFFER_RESULT
- SUM(DISTINCT LENGTH(name)) s1,
- SUM(DISTINCT SUBSTRING(NAME, 1, 3)) s2,
- SUM(DISTINCT LENGTH(SUBSTRING(name, 1, 4))) s3
-FROM t1;
-
-SELECT SQL_BUFFER_RESULT
- SUM(DISTINCT LENGTH(g1.name)) s1,
- SUM(DISTINCT SUBSTRING(g2.name, 1, 3)) s2,
- SUM(DISTINCT LENGTH(SUBSTRING(g3.name, 1, 4))) s3
-FROM t1 g1, t1 g2, t1 g3 GROUP BY LENGTH(SUBSTRING(g3.name, 5, 10));
-
-# this test demonstrates that strings are automatically converted to numbers
-# before summing
-
-SET @l=1;
-UPDATE t1 SET name=CONCAT(name, @l:=@l+1);
-
-SELECT SUM(DISTINCT RIGHT(name, 1)) FROM t1;
-
-# this is a test case for ordinary t1
-
-SELECT SUM(DISTINCT id) FROM t1;
-SELECT SUM(DISTINCT id % 11) FROM t1;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug #777654: empty subselect in FROM clause returning
---echo # SUM(DISTINCT) over non-nullable field
---echo #
-
-CREATE TABLE t1 (a int NOT NULL) ;
-
-SELECT SUM(DISTINCT a) FROM t1;
-SELECT * FROM (SELECT SUM(DISTINCT a) FROM t1) AS t;
-
-DROP TABLE t1;
diff --git a/mysql-test/t/symlink-aria-11902.test b/mysql-test/t/symlink-aria-11902.test
deleted file mode 100644
index a2a266cbb25..00000000000
--- a/mysql-test/t/symlink-aria-11902.test
+++ /dev/null
@@ -1,6 +0,0 @@
-#
-# MDEV-11902 mi_open race condition
-#
-source include/have_maria.inc;
-set default_storage_engine=Aria;
-source symlink-myisam-11902.test;
diff --git a/mysql-test/t/symlink-myisam-11902.test b/mysql-test/t/symlink-myisam-11902.test
deleted file mode 100644
index 8fd4961d1fb..00000000000
--- a/mysql-test/t/symlink-myisam-11902.test
+++ /dev/null
@@ -1,60 +0,0 @@
-#
-# MDEV-11902 mi_open race condition
-#
-source include/have_debug_sync.inc;
-source include/have_symlink.inc;
-source include/not_windows.inc;
-call mtr.add_suppression("File.*t1.* not found");
-
-create table mysql.t1 (a int, b char(16), index(a));
-insert mysql.t1 values (100, 'test'),(101,'test');
-let $datadir=`select @@datadir`;
-
-exec mkdir $MYSQLTEST_VARDIR/tmp/foo;
-replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR;
-eval create table t1 (a int, b char(16), index(a))
- data directory="$MYSQLTEST_VARDIR/tmp/foo";
-insert t1 values (200, 'some'),(201,'some');
-select * from t1;
-flush tables;
-set debug_sync='mi_open_datafile SIGNAL ok WAIT_FOR go';
-send select * from t1;
-connect con1, localhost, root;
-set debug_sync='now WAIT_FOR ok';
-exec rm -r $MYSQLTEST_VARDIR/tmp/foo;
-exec ln -s $datadir/mysql $MYSQLTEST_VARDIR/tmp/foo;
-set debug_sync='now SIGNAL go';
-connection default;
-replace_regex / '.*\/tmp\// 'MYSQLTEST_VARDIR\/tmp\// /31/20/ /40/20/ /20.*/20 <errmsg>)/;
-error 29;
-reap;
-flush tables;
-drop table if exists t1;
-exec rm -r $MYSQLTEST_VARDIR/tmp/foo;
-
-# same with INDEX DIRECTORY
-exec mkdir $MYSQLTEST_VARDIR/tmp/foo;
-replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR;
-eval create table t1 (a int, b char(16), index (a))
- index directory="$MYSQLTEST_VARDIR/tmp/foo";
-insert t1 values (200, 'some'),(201,'some');
-explain select a from t1;
-select a from t1;
-flush tables;
-set debug_sync='mi_open_kfile SIGNAL waiting WAIT_FOR run';
-send select a from t1;
-connection con1;
-set debug_sync='now WAIT_FOR waiting';
-exec rm -r $MYSQLTEST_VARDIR/tmp/foo;
-exec ln -s $datadir/mysql $MYSQLTEST_VARDIR/tmp/foo;
-set debug_sync='now SIGNAL run';
-connection default;
-replace_regex / '.*\/test\// '.\/test\// /31/20/ /40/20/ /20.*/20 <errmsg>)/;
-error ER_FILE_NOT_FOUND;
-reap;
-flush tables;
-drop table if exists t1;
-exec rm -r $MYSQLTEST_VARDIR/tmp/foo;
-
-drop table mysql.t1;
-set debug_sync='RESET';
diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test
deleted file mode 100644
index cf95d4cb938..00000000000
--- a/mysql-test/t/symlink.test
+++ /dev/null
@@ -1,343 +0,0 @@
---source include/have_symlink.inc
---source include/not_windows.inc
-
---disable_warnings
-drop table if exists t1,t2,t7,t8,t9;
-drop database if exists mysqltest;
---enable_warnings
-
-#
-# First create little data to play with
-#
-
-create table t1 (a int not null auto_increment, b char(16) not null, primary key (a));
-create table t2 (a int not null auto_increment, b char(16) not null, primary key (a));
-insert into t1 (b) values ("test"),("test1"),("test2"),("test3");
-insert into t2 (b) select b from t1;
-insert into t1 (b) select b from t2;
-insert into t2 (b) select b from t1;
-insert into t1 (b) select b from t2;
-insert into t2 (b) select b from t1;
-insert into t1 (b) select b from t2;
-insert into t2 (b) select b from t1;
-insert into t1 (b) select b from t2;
-insert into t2 (b) select b from t1;
-insert into t1 (b) select b from t2;
-insert into t2 (b) select b from t1;
-insert into t1 (b) select b from t2;
-insert into t2 (b) select b from t1;
-insert into t1 (b) select b from t2;
-insert into t2 (b) select b from t1;
-insert into t1 (b) select b from t2;
-insert into t2 (b) select b from t1;
-insert into t1 (b) select b from t2;
-drop table t2;
-
-#
-# Start the test
-# We use t9 here to not crash with tables generated by the backup test
-#
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval create table t9 (a int not null auto_increment, b char(16) not null, primary key (a))
-engine=myisam data directory="$MYSQLTEST_VARDIR/tmp" index directory="$MYSQLTEST_VARDIR/run";
-
-insert into t9 select * from t1;
-check table t9;
-optimize table t9;
-repair table t9;
-alter table t9 add column c int not null;
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-show create table t9;
-
-# Test renames
-alter table t9 rename t8, add column d int not null;
-alter table t8 rename t7;
-rename table t7 to t9;
-# Drop old t1 table, keep t9
-drop table t1;
-
-#
-# Test error handling
-# Note that we are using the above table t9 here!
-#
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-SHOW CREATE TABLE t9;
-
-
-# Check that we cannot link over a table from another database.
-
-create database mysqltest;
-
---error 1,1
-create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a))
-engine=myisam index directory="/this-dir-does-not-exist";
-
-# temporarily disabled as it returns different result in the embedded server
---error ER_WRONG_TABLE_NAME
-create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a))
-engine=myisam index directory="not-hard-path";
-
-# Should fail becasue the file t9.MYI already exist in 'run'
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---error 1,156
-eval create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a))
-engine=myisam index directory="$MYSQLTEST_VARDIR/run";
-
-# Should fail becasue the file t9.MYD already exist in 'tmp'
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---error 1,1
-eval create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a))
-engine=myisam data directory="$MYSQLTEST_VARDIR/tmp";
-
-# Check moving table t9 from default database to mysqltest;
-# In this case the symlinks should be removed.
-
-alter table t9 rename mysqltest.t9;
-select count(*) from mysqltest.t9;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-show create table mysqltest.t9;
-drop database mysqltest;
-
-#
-# Test changing data dir (Bug #1662)
-#
-
-create table t1 (a int not null) engine=myisam;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval alter table t1 data directory="$MYSQLTEST_VARDIR/tmp";
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-show create table t1;
-alter table t1 add b int;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval alter table t1 data directory="$MYSQLTEST_VARDIR/log";
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-show create table t1;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval alter table t1 index directory="$MYSQLTEST_VARDIR/log";
-show create table t1;
-drop table t1;
-
-#
-# BUG#32111 - Security Breach via DATA/INDEX DIRECORY and RENAME TABLE
-#
---write_file $MYSQLTEST_VARDIR/tmp/t1.MYI
-EOF
-
---replace_result $MYSQLTEST_VARDIR TEST_DIR $MYSQLTEST_VARDIR TEST_DIR
---error 1,1
-eval CREATE TABLE t1(a INT)
-DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp'
-INDEX DIRECTORY='$MYSQLTEST_VARDIR/tmp';
---replace_result $MYSQLTEST_VARDIR TEST_DIR
-eval CREATE TABLE t2(a INT)
-DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp'
-INDEX DIRECTORY='$MYSQLTEST_VARDIR/tmp';
---replace_result $MYSQLTEST_VARDIR TEST_DIR
---error 1
-RENAME TABLE t2 TO t1;
-DROP TABLE t2;
---remove_file $MYSQLTEST_VARDIR/tmp/t1.MYI
-
-#
-# Bug#8706 - temporary table with data directory option fails
-#
-connect (session1,localhost,root,,);
-connect (session2,localhost,root,,);
-
-connection session1;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval create temporary table t1 (a int) engine=myisam data directory="$MYSQLTEST_VARDIR/log" select 9 a;
-# If running test suite with a non standard tmp dir, the "show create table"
-# will print "DATA_DIRECTORY=". Use replace_result to mask it out
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-show create table t1;
-
-connection session2;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval create temporary table t1 (a int) engine=myisam data directory="$MYSQLTEST_VARDIR/log" select 99 a;
-# If running test suite with a non standard tmp dir, the "show create table"
-# will print "DATA_DIRECTORY=". Use replace_result to mask it out
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-show create table t1;
-
-connection default;
-create table t1 (a int) engine=myisam select 42 a;
-
-connection session1;
-select * from t1;
-disconnect session1;
-connection session2;
-select * from t1;
-disconnect session2;
-connection default;
-select * from t1;
-drop table t1;
-
---echo End of 4.1 tests
-
-#
-# Bug #29325: create table overwrites .MYD file of other table (datadir)
-#
-let $MYSQLD_DATADIR= `select @@datadir`;
-SET SESSION keep_files_on_create = TRUE;
---write_file $MYSQLD_DATADIR/test/t1.MYD
-EOF
---disable_abort_on_error
---error 1,1,ER_TABLE_EXISTS_ERROR
-CREATE TABLE t1 (a INT) ENGINE MYISAM;
---error 0,1
---remove_file $MYSQLD_DATADIR/test/t1.MYD;
---enable_abort_on_error
-SET SESSION keep_files_on_create = FALSE;
-CREATE TABLE t1 (a INT) ENGINE MYISAM;
-DROP TABLE t1;
-
---echo End of 5.0 tests
-
-#
-# Bug#32167: another privilege bypass with DATA/INDEX DIRECTORY
-#
-# With Bug#41002 (symlink.test fails on symlinked datadir) it was
-# decided that the below statements may also succeed if the data
-# home directory is symlinked, e.g. mysql-test-run --mem.
-# This will be fixed in 6.0 only.
-#
-let $MYSQLD_DATADIR= `select @@datadir`;
---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
---error 0,ER_WRONG_ARGUMENTS
-eval CREATE TABLE t1(a INT)
-INDEX DIRECTORY='$MYSQLD_DATADIR/mysql';
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-#
---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
---error 0,ER_WRONG_ARGUMENTS
-eval CREATE TABLE t1(a INT)
-DATA DIRECTORY='$MYSQLD_DATADIR/test';
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-#
---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
---error 0,ER_WRONG_ARGUMENTS
-eval CREATE TABLE t1(a INT)
-DATA DIRECTORY='$MYSQLD_DATADIR/';
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-#
---replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
---error 0,ER_WRONG_ARGUMENTS
-eval CREATE TABLE t1(a INT)
-INDEX DIRECTORY='$MYSQLD_DATADIR';
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-#
---replace_result $MYSQLTEST_VARDIR TEST_DIR
---error 1
-eval CREATE TABLE t1(a INT)
-INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data_var';
-
-#
-# BUG#25677 - With --skip-symbolic-links option on, DATA DIRECTORY clause is
-# silently ignored
-#
-
-SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='NO_DIR_IN_CREATE';
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval CREATE TABLE t1(a INT) DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY='$MYSQLTEST_VARDIR/tmp';
-DROP TABLE t1;
-SET @@SQL_MODE=@OLD_SQL_MODE;
-
---echo #
---echo # BUG#40980 - Drop table can remove another MyISAM table's
---echo # data and index files
---echo #
---mkdir $MYSQL_TMP_DIR/mysql
---replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
-eval CREATE TABLE user(a INT) DATA DIRECTORY='$MYSQL_TMP_DIR/mysql'
- INDEX DIRECTORY='$MYSQL_TMP_DIR/mysql';
-FLUSH TABLE user;
---echo # Symlinking mysql database to tmpdir
---remove_file $MYSQL_TMP_DIR/mysql/user.MYD
---remove_file $MYSQL_TMP_DIR/mysql/user.MYI
---rmdir $MYSQL_TMP_DIR/mysql
---exec ln -s $MYSQLD_DATADIR/mysql $MYSQL_TMP_DIR/mysql
-FLUSH TABLE mysql.user;
-DROP TABLE user;
-FLUSH TABLE mysql.user;
---disable_result_log
-SELECT * FROM mysql.user;
---enable_result_log
---remove_file $MYSQL_TMP_DIR/mysql
-
---echo End of 5.1 tests
-
-
---echo #
---echo # Test for bug #11759990 - "52354: 'CREATE TABLE .. LIKE ... '
---echo # STATEMENTS FAIL".
---echo #
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval create table t1 (a int primary key) engine=myisam
- data directory="$MYSQLTEST_VARDIR/tmp"
- index directory="$MYSQLTEST_VARDIR/run";
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-show create table t1;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-select create_options from information_schema.tables where table_name='t1';
---echo # CREATE TABLE LIKE statement on table with INDEX/DATA DIRECTORY
---echo # options should not fail. Per documentation newly created table
---echo # should not inherit value of these options from the original table.
-create table t2 like t1;
-show create table t2;
-drop tables t1, t2;
-
---echo #
---echo # Test for bug #25514146 DB_NAME IS IGNORED WHEN CREATING TABLE
---echo # WITH DATA DIRECTORY
---echo #
-
---echo # Make sure we have no current database
-CREATE DATABASE x;
-USE x;
-DROP DATABASE x;
-
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval CREATE TABLE test.t1(id INT(11)) ENGINE MYISAM
-DATA DIRECTORY "$MYSQLTEST_VARDIR/tmp";
-
-DROP TABLE test.t1;
-use test;
-
-#
-# End of 5.5 tests
-#
-
-#
-# End of 10.0 tests
-#
-
-#
-# MDEV-13636 ALTER TABLE ... DELAY_KEY_WRITE=1 creates table copy for MyISAM table with DATA DIRECTORY/INDEX DIRECTORY options
-#
-replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR;
-eval
-create table t1(c1 int, c2 int, c3 varchar(100)) engine=MyISAM data directory='$MYSQL_TMP_DIR' index directory = '$MYSQL_TMP_DIR';
-insert t1 values (1,2,3), (2,3,4), (3,4,5), (4,5,6), (5,6,7), (6,7,8), (7,8,9);
-alter online table t1 delay_key_write=1;
-replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR;
-show create table t1;
-drop table t1;
-
-#
-# End of 10.1 tests
-#
diff --git a/mysql-test/t/synchronization.test b/mysql-test/t/synchronization.test
deleted file mode 100644
index aef06245717..00000000000
--- a/mysql-test/t/synchronization.test
+++ /dev/null
@@ -1,50 +0,0 @@
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-#
-# Test for Bug#2385 CREATE TABLE LIKE lacks locking on source and destination
-# table
-#
-
---disable_warnings
-DROP TABLE IF EXISTS t1,t2;
---enable_warnings
-
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-
-# locking of source:
-
-CREATE TABLE t1 (x1 INT);
-let $1= 10;
-while ($1)
-{
- connection con1;
- send ALTER TABLE t1 CHANGE x1 x2 INT;
- connection con2;
- CREATE TABLE t2 LIKE t1;
- replace_result x1 xx x2 xx;
- SHOW CREATE TABLE t2;
- DROP TABLE t2;
- connection con1;
- reap;
- send ALTER TABLE t1 CHANGE x2 x1 INT;
- connection con2;
- CREATE TABLE t2 LIKE t1;
- replace_result x1 xx x2 xx;
- SHOW CREATE TABLE t2;
- DROP TABLE t2;
- connection con1;
- reap;
- dec $1;
-}
-DROP TABLE t1;
-
-connection default;
-disconnect con1;
-disconnect con2;
-
-# End of 4.1 tests
-
-# Wait till we reached the initial number of concurrent sessions
---source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/sysdate_is_now-master.opt b/mysql-test/t/sysdate_is_now-master.opt
deleted file mode 100644
index 97a58d28032..00000000000
--- a/mysql-test/t/sysdate_is_now-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---sysdate-is-now
diff --git a/mysql-test/t/sysdate_is_now.test b/mysql-test/t/sysdate_is_now.test
deleted file mode 100644
index 166914e20c8..00000000000
--- a/mysql-test/t/sysdate_is_now.test
+++ /dev/null
@@ -1,11 +0,0 @@
-#
-# BUG#15101 restore aliasing of SYSDATE to NOW in 5.0
-# this feature is activated via --sysdate-is-now mysqld init opt
-#
-# To test here
-# 1. SYSDATE() does not distiguish from NOW()
-# 2. SYSDATE() obeys set timestamp
-
-set timestamp=1;
-SELECT sleep(1),NOW()-SYSDATE() as zero;
-# End of 5.0 tests
diff --git a/mysql-test/t/system_mysql_db.test b/mysql-test/t/system_mysql_db.test
deleted file mode 100644
index 398a222b642..00000000000
--- a/mysql-test/t/system_mysql_db.test
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# This test must examine integrity of system database "mysql"
-#
-
-# check that CSV engine was compiled in, as the result of the test
-# depends on the presence of the log tables (which are CSV-based).
---source include/have_csv.inc
-
--- disable_query_log
-use mysql;
--- enable_query_log
--- source include/system_db_struct.inc
--- disable_query_log
-use test;
--- enable_query_log
-# keep results same with system_mysql_db_fix
-show tables;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/system_mysql_db_fix40123.test b/mysql-test/t/system_mysql_db_fix40123.test
deleted file mode 100644
index 2d17a0964e5..00000000000
--- a/mysql-test/t/system_mysql_db_fix40123.test
+++ /dev/null
@@ -1,82 +0,0 @@
-# Embedded server doesn't support external clients
---source include/not_embedded.inc
---source include/have_innodb.inc
-
-# Don't run this test if $MYSQL_FIX_PRIVILEGE_TABLES isn't set
-# to the location of mysql_fix_privilege_tables.sql
-if (!$MYSQL_FIX_PRIVILEGE_TABLES)
-{
- skip Test need MYSQL_FIX_PRIVILEGE_TABLES;
-}
-
-#
-# This is the test for mysql_fix_privilege_tables
-# It checks that a system tables from mysql 4.1.23
-# can be upgraded to current system table format
-#
-# Note: If this test fails, don't be confused about the errors reported
-# by mysql-test-run This shows warnings generated by
-# mysql_fix_system_tables which should be ignored.
-# Instead, concentrate on the errors in r/system_mysql_db.reject
-
--- disable_result_log
--- disable_query_log
-
-use test;
-
-# create system tables as in mysql-4.1.23
-# created by executing "./mysql_create_system_tables real ."
-
-set storage_engine=myisam;
-CREATE TABLE db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges';
-INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
-INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
-
-CREATE TABLE host ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges; Merged with database privileges';
-
-
-CREATE TABLE user ( Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';
-INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
-INSERT INTO user VALUES ('localhost','','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
-
-CREATE TABLE func ( name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions';
-
-
-CREATE TABLE tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp, Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges';
-CREATE TABLE columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges';
-
-CREATE TABLE help_topic ( help_topic_id int unsigned not null, name varchar(64) not null, help_category_id smallint unsigned not null, description text not null, example text not null, url varchar(128) not null, primary key (help_topic_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help topics';
-CREATE TABLE help_category ( help_category_id smallint unsigned not null, name varchar(64) not null, parent_category_id smallint unsigned null, url varchar(128) not null, primary key (help_category_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help categories';
-CREATE TABLE help_relation ( help_topic_id int unsigned not null references help_topic, help_keyword_id int unsigned not null references help_keyword, primary key (help_keyword_id, help_topic_id) ) engine=MyISAM CHARACTER SET utf8 comment='keyword-topic relation';
-CREATE TABLE help_keyword ( help_keyword_id int unsigned not null, name varchar(64) not null, primary key (help_keyword_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help keywords';
-
-CREATE TABLE time_zone_name ( Name char(64) NOT NULL, Time_zone_id int unsigned NOT NULL, PRIMARY KEY Name (Name) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone names';
-
-CREATE TABLE time_zone ( Time_zone_id int unsigned NOT NULL auto_increment, Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY TzId (Time_zone_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zones';
-
-CREATE TABLE time_zone_transition ( Time_zone_id int unsigned NOT NULL, Transition_time bigint signed NOT NULL, Transition_type_id int unsigned NOT NULL, PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transitions';
-
-CREATE TABLE time_zone_transition_type ( Time_zone_id int unsigned NOT NULL, Transition_type_id int unsigned NOT NULL, Offset int signed DEFAULT 0 NOT NULL, Is_DST tinyint unsigned DEFAULT 0 NOT NULL, Abbreviation char(8) DEFAULT '' NOT NULL, PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transition types';
-
-CREATE TABLE time_zone_leap_second ( Transition_time bigint signed NOT NULL, Correction int signed NOT NULL, PRIMARY KEY TranTime (Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Leap seconds information for time zones';
-
-# Run the mysql_fix_privilege_tables.sql using "mysql --force"
---exec $MYSQL --force test < $MYSQL_FIX_PRIVILEGE_TABLES
-
--- enable_query_log
--- enable_result_log
-
-# Dump the tables that should be compared
--- source include/system_db_struct.inc
-
--- disable_query_log
-
-# Drop all tables created by this test
-DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, proxies_priv, innodb_index_stats, innodb_table_stats, transaction_registry, table_stats, column_stats, index_stats, roles_mapping, gtid_slave_pos;
-
--- enable_query_log
-
-# check that we dropped all system tables
-show tables;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/system_mysql_db_fix50030.test b/mysql-test/t/system_mysql_db_fix50030.test
deleted file mode 100644
index 9506c3465e7..00000000000
--- a/mysql-test/t/system_mysql_db_fix50030.test
+++ /dev/null
@@ -1,89 +0,0 @@
-# Embedded server doesn't support external clients
---source include/not_embedded.inc
---source include/have_innodb.inc
-
-# Don't run this test if $MYSQL_FIX_PRIVILEGE_TABLES isn't set
-# to the location of mysql_fix_privilege_tables.sql
-if (!$MYSQL_FIX_PRIVILEGE_TABLES)
-{
- skip Test needs MYSQL_FIX_PRIVILEGE_TABLES;
-}
-
-#
-# This is the test for mysql_fix_privilege_tables
-# It checks that a system tables from mysql 5.0.30
-# can be upgraded to current system table format
-#
-# Note: If this test fails, don't be confused about the errors reported
-# by mysql-test-run This shows warnings generated by
-# mysql_fix_system_tables which should be ignored.
-# Instead, concentrate on the errors in r/system_mysql_db.reject
-
--- disable_result_log
--- disable_query_log
-
-use test;
-
-# create system tables as in mysql-5.0.30
-# created by executing "./mysql_create_system_tables real ."
-
-set storage_engine=myisam;
-CREATE TABLE db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges';
-INSERT INTO db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N');
-INSERT INTO db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N');
-
-CREATE TABLE host ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges; Merged with database privileges';
-
-CREATE TABLE user ( Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, max_user_connections int(11) unsigned DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';
-INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0);
-INSERT INTO user VALUES ('localhost','','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0, 0);
-
-CREATE TABLE func ( name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions';
-
-CREATE TABLE tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp, Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges';
-
-CREATE TABLE columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges';
-
-CREATE TABLE help_topic ( help_topic_id int unsigned not null, name char(64) not null, help_category_id smallint unsigned not null, description text not null, example text not null, url char(128) not null, primary key (help_topic_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help topics';
-CREATE TABLE help_category ( help_category_id smallint unsigned not null, name char(64) not null, parent_category_id smallint unsigned null, url char(128) not null, primary key (help_category_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help categories';
-CREATE TABLE help_relation ( help_topic_id int unsigned not null references help_topic, help_keyword_id int unsigned not null references help_keyword, primary key (help_keyword_id, help_topic_id) ) engine=MyISAM CHARACTER SET utf8 comment='keyword-topic relation';
-CREATE TABLE help_keyword ( help_keyword_id int unsigned not null, name char(64) not null, primary key (help_keyword_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help keywords';
-
-CREATE TABLE time_zone_name ( Name char(64) NOT NULL, Time_zone_id int unsigned NOT NULL, PRIMARY KEY Name (Name) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone names';
-
-CREATE TABLE time_zone ( Time_zone_id int unsigned NOT NULL auto_increment, Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY TzId (Time_zone_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zones';
-
-CREATE TABLE time_zone_transition ( Time_zone_id int unsigned NOT NULL, Transition_time bigint signed NOT NULL, Transition_type_id int unsigned NOT NULL, PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transitions';
-
-CREATE TABLE time_zone_transition_type ( Time_zone_id int unsigned NOT NULL, Transition_type_id int unsigned NOT NULL, Offset int signed DEFAULT 0 NOT NULL, Is_DST tinyint unsigned DEFAULT 0 NOT NULL, Abbreviation char(8) DEFAULT '' NOT NULL, PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transition types';
-
-CREATE TABLE time_zone_leap_second ( Transition_time bigint signed NOT NULL, Correction int signed NOT NULL, PRIMARY KEY TranTime (Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Leap seconds information for time zones';
-
-CREATE TABLE proc ( db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum('CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA' ) DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob DEFAULT '' NOT NULL, returns char(64) DEFAULT '' NOT NULL, body longblob DEFAULT '' NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp, modified timestamp, sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'NOT_USED', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE' ) DEFAULT '' NOT NULL, comment char(64) collate utf8_bin DEFAULT '' NOT NULL, PRIMARY KEY (db,name,type) ) engine=MyISAM character set utf8 comment='Stored Procedures';
-
-CREATE TABLE procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) binary DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp, PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges';
-
-CREATE TABLE servers ( Server_name char(64) NOT NULL DEFAULT '', Host char(64) NOT NULL DEFAULT '', Db char(64) NOT NULL DEFAULT '', Username char(64) NOT NULL DEFAULT '', Password char(64) NOT NULL DEFAULT '', Port INT(4) NOT NULL DEFAULT '0', Socket char(64) NOT NULL DEFAULT '', Wrapper char(64) NOT NULL DEFAULT '', Owner char(64) NOT NULL DEFAULT '', PRIMARY KEY (Server_name)) CHARACTER SET utf8 comment='MySQL Foreign Servers table';
-
-INSERT INTO servers VALUES ('test','localhost','test','root','', 0,'','mysql','root');
-
-# Run the mysql_fix_privilege_tables.sql using "mysql --force"
---exec $MYSQL --force test < $MYSQL_FIX_PRIVILEGE_TABLES
-
--- enable_query_log
--- enable_result_log
-
-# Dump the tables that should be compared
--- source include/system_db_struct.inc
-
--- disable_query_log
-
-# Drop all tables created by this test
-DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, proxies_priv, innodb_index_stats, innodb_table_stats, transaction_registry, table_stats, column_stats, index_stats, roles_mapping, gtid_slave_pos;
-
--- enable_query_log
-
-# check that we dropped all system tables
-show tables;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/system_mysql_db_fix50117.test b/mysql-test/t/system_mysql_db_fix50117.test
deleted file mode 100644
index f8bef3da162..00000000000
--- a/mysql-test/t/system_mysql_db_fix50117.test
+++ /dev/null
@@ -1,106 +0,0 @@
-# Embedded server doesn't support external clients
---source include/not_embedded.inc
---source include/have_innodb.inc
-
-# Don't run this test if $MYSQL_FIX_PRIVILEGE_TABLES isn't set
-# to the location of mysql_fix_privilege_tables.sql
-if (!$MYSQL_FIX_PRIVILEGE_TABLES)
-{
- skip Test needs MYSQL_FIX_PRIVILEGE_TABLES;
-}
-
-#
-# This is the test for mysql_fix_privilege_tables
-# It checks that a system tables from mysql 5.1.17
-# can be upgraded to current system table format
-#
-# Note: If this test fails, don't be confused about the errors reported
-# by mysql-test-run This shows warnings generated by
-# mysql_fix_system_tables which should be ignored.
-# Instead, concentrate on the errors in r/system_mysql_db.reject
-
--- disable_result_log
--- disable_query_log
-
-use test;
-
-# create system tables as in mysql-5.1.17
-
-
-CREATE TABLE IF NOT EXISTS db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges';
-
-
-CREATE TABLE IF NOT EXISTS host ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges; Merged with database privileges';
-
-
-CREATE TABLE IF NOT EXISTS user ( Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, max_user_connections int(11) unsigned DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges';
-
-
-CREATE TABLE IF NOT EXISTS func ( name char(64) binary DEFAULT '' NOT NULL, ret tinyint(1) DEFAULT '0' NOT NULL, dl char(128) DEFAULT '' NOT NULL, type enum ('function','aggregate') COLLATE utf8_general_ci NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User defined functions';
-
-
-CREATE TABLE IF NOT EXISTS plugin ( name char(64) binary DEFAULT '' NOT NULL, dl char(128) DEFAULT '' NOT NULL, PRIMARY KEY (name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='MySQL plugins';
-
-
-CREATE TABLE IF NOT EXISTS servers ( Server_name char(64) NOT NULL DEFAULT '', Host char(64) NOT NULL DEFAULT '', Db char(64) NOT NULL DEFAULT '', Username char(64) NOT NULL DEFAULT '', Password char(64) NOT NULL DEFAULT '', Port INT(4) NOT NULL DEFAULT '0', Socket char(64) NOT NULL DEFAULT '', Wrapper char(64) NOT NULL DEFAULT '', Owner char(64) NOT NULL DEFAULT '', PRIMARY KEY (Server_name)) CHARACTER SET utf8 comment='MySQL Foreign Servers table';
-
-
-CREATE TABLE IF NOT EXISTS tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges';
-
-CREATE TABLE IF NOT EXISTS columns_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Column_name char(64) binary DEFAULT '' NOT NULL, Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name,Column_name) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Column privileges';
-
-
-CREATE TABLE IF NOT EXISTS help_topic ( help_topic_id int unsigned not null, name char(64) not null, help_category_id smallint unsigned not null, description text not null, example text not null, url char(128) not null, primary key (help_topic_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help topics';
-
-
-CREATE TABLE IF NOT EXISTS help_category ( help_category_id smallint unsigned not null, name char(64) not null, parent_category_id smallint unsigned null, url char(128) not null, primary key (help_category_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help categories';
-
-
-CREATE TABLE IF NOT EXISTS help_relation ( help_topic_id int unsigned not null references help_topic, help_keyword_id int unsigned not null references help_keyword, primary key (help_keyword_id, help_topic_id) ) engine=MyISAM CHARACTER SET utf8 comment='keyword-topic relation';
-
-
-CREATE TABLE IF NOT EXISTS help_keyword ( help_keyword_id int unsigned not null, name char(64) not null, primary key (help_keyword_id), unique index (name) ) engine=MyISAM CHARACTER SET utf8 comment='help keywords';
-
-
-CREATE TABLE IF NOT EXISTS time_zone_name ( Name char(64) NOT NULL, Time_zone_id int unsigned NOT NULL, PRIMARY KEY Name (Name) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone names';
-
-
-CREATE TABLE IF NOT EXISTS time_zone ( Time_zone_id int unsigned NOT NULL auto_increment, Use_leap_seconds enum('Y','N') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY TzId (Time_zone_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zones';
-
-
-CREATE TABLE IF NOT EXISTS time_zone_transition ( Time_zone_id int unsigned NOT NULL, Transition_time bigint signed NOT NULL, Transition_type_id int unsigned NOT NULL, PRIMARY KEY TzIdTranTime (Time_zone_id, Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transitions';
-
-
-CREATE TABLE IF NOT EXISTS time_zone_transition_type ( Time_zone_id int unsigned NOT NULL, Transition_type_id int unsigned NOT NULL, Offset int signed DEFAULT 0 NOT NULL, Is_DST tinyint unsigned DEFAULT 0 NOT NULL, Abbreviation char(8) DEFAULT '' NOT NULL, PRIMARY KEY TzIdTrTId (Time_zone_id, Transition_type_id) ) engine=MyISAM CHARACTER SET utf8 comment='Time zone transition types';
-
-
-CREATE TABLE IF NOT EXISTS time_zone_leap_second ( Transition_time bigint signed NOT NULL, Correction int signed NOT NULL, PRIMARY KEY TranTime (Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Leap seconds information for time zones';
-
-
-CREATE TABLE IF NOT EXISTS proc ( db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum('CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA' ) DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns char(64) DEFAULT '' NOT NULL, body longblob NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, modified timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'NOT_USED', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE' ) DEFAULT '' NOT NULL, comment char(64) collate utf8_bin DEFAULT '' NOT NULL, PRIMARY KEY (db,name,type) ) engine=MyISAM character set utf8 comment='Stored Procedures';
-
-
-CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) binary DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges';
-
-CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, modified TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00', last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';
-
-# Run the mysql_fix_privilege_tables.sql using "mysql --force"
---exec $MYSQL --force test < $MYSQL_FIX_PRIVILEGE_TABLES
-
--- enable_query_log
--- enable_result_log
-
-# Dump the tables that should be compared
--- source include/system_db_struct.inc
-
--- disable_query_log
-
-# Drop all tables created by this test
-DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, proxies_priv, innodb_index_stats, innodb_table_stats, transaction_registry, table_stats, column_stats, index_stats, roles_mapping, gtid_slave_pos;
-
--- enable_query_log
-
-# check that we dropped all system tables
-show tables;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/system_mysql_db_refs.test b/mysql-test/t/system_mysql_db_refs.test
deleted file mode 100644
index 63f30e7db63..00000000000
--- a/mysql-test/t/system_mysql_db_refs.test
+++ /dev/null
@@ -1,103 +0,0 @@
-#
-# This test must examine integrity of current system database
-#
-
-set @name="This is a very long string, that mustn't find room in a system field like Table_name. Thus it should be cut by the actual size of the field. So we can use this string to find out the actual length of the field and to use it in any compare queries";
-
-#
-# If this part is wrong, most likely you've done wrong modification of system database "mysql"
-#
-
-create table test_db select * from mysql.db;
-delete from test_db;
---disable_warnings
-insert ignore into test_db (Host,Db,User) values (@name,@name,@name);
---enable_warnings
-
-create table test_host select * from mysql.host;
-delete from test_host;
---disable_warnings
-insert ignore into test_host (Host,Db) values (@name,@name);
---enable_warnings
-
-create table test_user select * from mysql.user;
-delete from test_user;
---disable_warnings
-insert ignore into test_user (Host,User) values (@name,@name);
---enable_warnings
-
-create table test_func select * from mysql.func;
-delete from test_func;
---disable_warnings
-insert ignore into test_func (name) values (@name);
---enable_warnings
-
-create table test_tables_priv select * from mysql.tables_priv;
-delete from test_tables_priv;
---disable_warnings
-insert ignore into test_tables_priv (Host,Db,User,Table_name) values (@name,@name,@name,@name);
---enable_warnings
-
-create table test_columns_priv select * from mysql.columns_priv;
-delete from test_columns_priv;
---disable_warnings
-insert ignore into test_columns_priv (Host,Db,User,Table_name,Column_name) values (@name,@name,@name,@name,@name);
---enable_warnings
-
-# 'Host' field must be the same for all the tables:
-
-select
- if(isnull(test_db.Host),'WRONG!!!','ok') as test_db_Host,
- if(isnull(test_host.Host),'WRONG!!!','ok') as test_host_Host,
- if(isnull(test_user.Host),'WRONG!!!','ok') as test_user_Host,
- if(isnull(test_tables_priv.Host),'WRONG!!!','ok') as test_tables_priv_Host,
- if(isnull(test_columns_priv.Host),'WRONG!!!','ok') as test_columns_priv_Host
-
-from test_db
-left join test_host on test_db.Host=test_host.Host
-left join test_user on test_db.Host=test_user.Host
-left join test_tables_priv on test_db.Host=test_tables_priv.Host
-left join test_columns_priv on test_db.Host=test_columns_priv.Host;
-
-# 'Db' field must be the same for all the tables:
-
-select
- if(isnull(test_db.Db),'WRONG!!!','ok') as test_db_Db,
- if(isnull(test_host.Db),'WRONG!!!','ok') as test_host_Db,
- if(isnull(test_tables_priv.Db),'WRONG!!!','ok') as test_tables_priv_Db,
- if(isnull(test_columns_priv.Db),'WRONG!!!','ok') as est_columns_priv_Db
-
-from test_db
-left join test_host on test_db.Db=test_host.Db
-left join test_tables_priv on test_db.Db=test_tables_priv.Db
-left join test_columns_priv on test_db.Db=test_columns_priv.Db;
-
-# 'User' field must be the same for all the tables:
-
-select
- if(isnull(test_db.User),'WRONG!!!','ok') as test_db_User,
- if(isnull(test_user.User),'WRONG!!!','ok') as test_user_User,
- if(isnull(test_tables_priv.User),'WRONG!!!','ok') as test_tables_priv_User,
- if(isnull(test_columns_priv.User),'WRONG!!!','ok') as test_columns_priv_User
-
-from test_db
-left join test_user on test_db.User=test_user.User
-left join test_tables_priv on test_db.User=test_tables_priv.User
-left join test_columns_priv on test_db.User=test_columns_priv.User;
-
-# 'Table_name' field must be the same for all the tables:
-
-select
- if(isnull(test_tables_priv.User),'WRONG!!!','ok') as test_tables_priv_User,
- if(isnull(test_columns_priv.User),'WRONG!!!','ok') as test_columns_priv_User
-from test_tables_priv
-left join test_columns_priv on test_tables_priv.Table_name=test_columns_priv.Table_name;
-
-drop table test_columns_priv;
-drop table test_tables_priv;
-drop table test_func;
-drop table test_host;
-drop table test_user;
-drop table test_db;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/table_elim.test b/mysql-test/t/table_elim.test
deleted file mode 100644
index 8de4743b9fd..00000000000
--- a/mysql-test/t/table_elim.test
+++ /dev/null
@@ -1,643 +0,0 @@
-#
-# Table elimination (MWL#17) tests
-#
---disable_warnings
-drop table if exists t0, t1, t2, t3, t4, t5, t6;
-drop view if exists v1, v2;
---enable_warnings
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='outer_join_with_cache=off';
-
-create table t1 (a int);
-insert into t1 values (0),(1),(2),(3);
-create table t0 as select * from t1;
-
-create table t2 (a int primary key, b int)
- as select a, a as b from t1 where a in (1,2);
-
-create table t3 (a int primary key, b int)
- as select a, a as b from t1 where a in (1,3);
-
---echo # This will be eliminated:
-explain select t1.a from t1 left join t2 on t2.a=t1.a;
-explain extended select t1.a from t1 left join t2 on t2.a=t1.a;
-
-select t1.a from t1 left join t2 on t2.a=t1.a;
-
---echo # This will not be eliminated as t2.b is in in select list:
-explain select * from t1 left join t2 on t2.a=t1.a;
-
---echo # This will not be eliminated as t2.b is in in order list:
-explain select t1.a from t1 left join t2 on t2.a=t1.a order by t2.b;
-
---echo # This will not be eliminated as t2.b is in group list:
-explain select t1.a from t1 left join t2 on t2.a=t1.a group by t2.b;
-
---echo # This will not be eliminated as t2.b is in the WHERE
-explain select t1.a from t1 left join t2 on t2.a=t1.a where t2.b < 3 or t2.b is null;
-
---echo # Elimination of multiple tables:
-explain select t1.a from t1 left join (t2 join t3) on t2.a=t1.a and t3.a=t1.a;
-
---echo # Elimination of multiple tables (2):
-explain select t1.a from t1 left join (t2 join t3 on t2.b=t3.b) on t2.a=t1.a and t3.a=t1.a;
-
---echo # Elimination when done within an outer join nest:
-explain extended
-select t0.*
-from
- t0 left join (t1 left join (t2 join t3 on t2.b=t3.b) on t2.a=t1.a and
- t3.a=t1.a) on t0.a=t1.a;
-
---echo # Elimination with aggregate functions
-explain select count(*) from t1 left join t2 on t2.a=t1.a;
-explain select count(1) from t1 left join t2 on t2.a=t1.a;
-explain select count(1) from t1 left join t2 on t2.a=t1.a group by t1.a;
-
---echo This must not use elimination:
-explain select count(1) from t1 left join t2 on t2.a=t1.a group by t2.a;
-
-drop table t0, t1, t2, t3;
-
-# This will stand for elim_facts
-create table t0 ( id integer, primary key (id));
-
-# Attribute1, non-versioned
-create table t1 (
- id integer,
- attr1 integer,
- primary key (id),
- key (attr1)
-);
-
-# Attribute2, time-versioned
-create table t2 (
- id integer,
- attr2 integer,
- fromdate date,
- primary key (id, fromdate),
- key (attr2,fromdate)
-);
-
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-insert into t0 select A.id + 10*B.id from t0 A, t0 B where B.id > 0;
-
-insert into t1 select id, id from t0;
-insert into t2 select id, id, date_add('2009-06-22', interval id day) from t0;
-insert into t2 select id, id+1, date_add('2008-06-22', interval id day) from t0;
-
-create view v1 as
-select
- f.id, a1.attr1, a2.attr2
-from
- t0 f
- left join t1 a1 on a1.id=f.id
- left join t2 a2 on a2.id=f.id and
- a2.fromdate=(select MAX(fromdate) from
- t2 where id=a2.id);
-create view v2 as
-select
- f.id, a1.attr1, a2.attr2
-from
- t0 f
- left join t1 a1 on a1.id=f.id
- left join t2 a2 on a2.id=f.id and
- a2.fromdate=(select MAX(fromdate) from
- t2 where id=f.id);
-
---echo This should use one table:
-explain select id from v1 where id=2;
---echo This should use one table:
-explain extended select id from v1 where id in (1,2,3,4);
---echo This should use facts and a1 tables:
-explain extended select id from v1 where attr1 between 12 and 14;
---echo This should use facts, a2 and its subquery:
-explain extended select id from v1 where attr2 between 12 and 14;
-
-# Repeat for v2:
-
---echo This should use one table:
-explain select id from v2 where id=2;
---echo This should use one table:
-explain extended select id from v2 where id in (1,2,3,4);
---echo This should use facts and a1 tables:
-explain extended select id from v2 where attr1 between 12 and 14;
---echo This should use facts, a2 and its subquery:
-explain extended select id from v2 where attr2 between 12 and 14;
-
-drop view v1, v2;
-drop table t0, t1, t2;
-
-#
-# Tests for the code that uses t.keypartX=func(t.keypartY) equalities to
-# make table elimination inferences
-#
-create table t1 (a int);
-insert into t1 values (0),(1),(2),(3);
-
-create table t2 (pk1 int, pk2 int, pk3 int, col int, primary key(pk1, pk2, pk3));
-insert into t2 select a,a,a,a from t1;
-
---echo This must use only t1:
-explain select t1.* from t1 left join t2 on t2.pk1=t1.a and
- t2.pk2=t2.pk1+1 and
- t2.pk3=t2.pk2+1;
-
---echo This must use only t1:
-explain select t1.* from t1 left join t2 on t2.pk1=t1.a and
- t2.pk3=t2.pk1+1 and
- t2.pk2=t2.pk3+1;
-
---echo This must use both:
-explain select t1.* from t1 left join t2 on t2.pk1=t1.a and
- t2.pk3=t2.pk1+1 and
- t2.pk2=t2.pk3+t2.col;
-
---echo This must use only t1:
-explain select t1.* from t1 left join t2 on t2.pk2=t1.a and
- t2.pk1=t2.pk2+1 and
- t2.pk3=t2.pk1;
-
-drop table t1, t2;
-#
-# Check that equality propagation is taken into account
-#
-create table t1 (pk int primary key, col int);
-insert into t1 values (1,1),(2,2);
-
-create table t2 like t1;
-insert into t2 select * from t1;
-
-create table t3 like t1;
-insert into t3 select * from t1;
-
-explain
-select t1.* from t1 left join ( t2 left join t3 on t3.pk=t2.col) on t2.col=t1.col;
-
-explain
-select t1.*, t2.* from t1 left join (t2 left join t3 on t3.pk=t2.col) on t2.pk=t1.col;
-
-explain select t1.*
-from
- t1 left join ( t2 left join t3 on t3.pk=t2.col or t3.pk=t2.col)
- on t2.col=t1.col or t2.col=t1.col;
-
-explain select t1.*, t2.*
-from
- t1 left join
- (t2 left join t3 on t3.pk=t2.col or t3.pk=t2.col)
- on t2.pk=t1.col or t2.pk=t1.col;
-
-drop table t1, t2, t3;
-
---echo #
---echo # Check things that look like functional dependencies but really are not
---echo #
-
-create table t1 (a char(10) character set latin1 collate latin1_general_ci primary key);
-insert into t1 values ('foo');
-insert into t1 values ('bar');
-
-create table t2 (a char(10) character set latin1 collate latin1_general_cs primary key);
-insert into t2 values ('foo');
-insert into t2 values ('FOO');
-
--- echo this must not use table elimination:
-explain select t1.* from t1 left join t2 on t2.a='foo' collate latin1_general_ci;
-
--- echo this must not use table elimination:
-explain select t1.* from t1 left join t2 on t2.a=t1.a collate latin1_general_ci;
-drop table t1,t2;
-
-create table t1 (a int primary key);
-insert into t1 values (1),(2);
-create table t2 (a char(10) primary key);
-insert into t2 values ('1'),('1.0');
--- echo this must not use table elimination:
-explain select t1.* from t1 left join t2 on t2.a=1;
--- echo this must not use table elimination:
-explain select t1.* from t1 left join t2 on t2.a=t1.a;
-
-drop table t1, t2;
-# partial unique keys do not work at the moment, although they are able to
-# provide one-match guarantees:
-create table t1 (a char(10) primary key);
-insert into t1 values ('foo'),('bar');
-
-create table t2 (a char(10), unique key(a(2)));
-insert into t2 values
- ('foo'),('bar'),('boo'),('car'),('coo'),('par'),('doo'),('tar');
-
-explain select t1.* from t1 left join t2 on t2.a=t1.a;
-
-drop table t1, t2;
-
---echo #
---echo # check UPDATE/DELETE that look like they could be eliminated
---echo #
-create table t1 (a int primary key, b int);
-insert into t1 values (1,1),(2,2),(3,3);
-
-create table t2 like t1;
-insert into t2 select * from t1;
-update t1 left join t2 using (a) set t2.a=t2.a+100;
-select * from t1;
-select * from t2;
-
-delete from t2;
-insert into t2 select * from t1;
-
-delete t2 from t1 left join t2 using (a);
-select * from t1;
-select * from t2;
-drop table t1, t2;
-
---echo #
---echo # Tests with various edge-case ON expressions
---echo #
-create table t1 (a int, b int, c int, d int);
-insert into t1 values (0,0,0,0),(1,1,1,1),(2,2,2,2),(3,3,3,3);
-
-create table t2 (pk int primary key, b int)
- as select a as pk, a as b from t1 where a in (1,2);
-
-create table t3 (pk1 int, pk2 int, b int, unique(pk1,pk2));
-insert into t3 select a as pk1, a as pk2, a as b from t1 where a in (1,3);
-
-explain select t1.a from t1 left join t2 on t2.pk=t1.a and t2.b<t1.b;
-explain select t1.a from t1 left join t2 on t2.pk=t1.a or t2.b<t1.b;
-explain select t1.a from t1 left join t2 on t2.b<t1.b or t2.pk=t1.a;
-
-explain select t1.a from t1 left join t2 on t2.pk between 10 and 20;
-explain select t1.a from t1 left join t2 on t2.pk between 0.5 and 1.5;
-explain select t1.a from t1 left join t2 on t2.pk between 10 and 10;
-
-explain select t1.a from t1 left join t2 on t2.pk in (10);
-explain select t1.a from t1 left join t2 on t2.pk in (t1.a);
-
-explain select t1.a from t1 left join t2 on TRUE;
-
-explain select t1.a from t1 left join t3 on t3.pk1=t1.a and t3.pk2 IS NULL;
-
-drop table t1,t2,t3;
-
---echo #
---echo # Multi-equality tests
---echo #
-create table t1 (a int, b int, c int, d int);
-insert into t1 values (0,0,0,0),(1,1,1,1),(2,2,2,2),(3,3,3,3);
-
-create table t2 (pk int primary key, b int, c int);
-insert into t2 select a,a,a from t1 where a in (1,2);
-
-explain
-select t1.*
-from t1 left join t2 on t2.pk=t2.c and t2.b=t1.a and t1.a=t1.b and t2.c=t2.b
-where t1.d=1;
-
-explain
-select t1.*
-from
- t1
- left join
- t2
- on (t2.pk=t2.c and t2.b=t1.a and t1.a=t1.b and t2.c=t2.b) or
- (t2.pk=t2.c and t2.b=t1.a and t1.a=t1.b and t2.c=t2.b)
-where t1.d=1;
-
---echo #This can't be eliminated:
-explain
-select t1.*
-from
- t1
- left join
- t2
- on (t2.pk=t2.c and t2.b=t1.a and t2.c=t1.b) or
- (t2.pk=t2.c and t1.a=t1.b and t2.c=t1.b)
-where t1.d=1;
-
-explain
-select t1.*
-from
- t1
- left join
- t2
- on (t2.pk=t2.c and t2.b=t1.a and t2.c=t1.b) or
- (t2.pk=t2.c and t2.c=t1.b)
-;
-
-explain
-select t1.*
-from t1 left join t2 on t2.pk=3 or t2.pk= 4;
-
-explain
-select t1.*
-from t1 left join t2 on t2.pk=3 or t2.pk= 3;
-
-explain
-select t1.*
-from t1 left join t2 on (t2.pk=3 and t2.b=3) or (t2.pk= 4 and t2.b=3);
-
-drop table t1, t2;
-
---echo #
---echo # LPBUG#523593: Running RQG optimizer_no_subquery crashes MariaDB
---echo #
-
-CREATE TABLE t1 (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `col_int_nokey` int(11) DEFAULT NULL,
- `col_int_key` int(11) DEFAULT NULL,
- `col_date_key` date DEFAULT NULL,
- `col_date_nokey` date DEFAULT NULL,
- `col_time_key` time DEFAULT NULL,
- `col_time_nokey` time DEFAULT NULL,
- `col_datetime_key` datetime DEFAULT NULL,
- `col_datetime_nokey` datetime DEFAULT NULL,
- `col_varchar_key` varchar(1) DEFAULT NULL,
- `col_varchar_nokey` varchar(1) DEFAULT NULL,
- PRIMARY KEY (`pk`),
- KEY `col_int_key` (`col_int_key`),
- KEY `col_date_key` (`col_date_key`),
- KEY `col_time_key` (`col_time_key`),
- KEY `col_datetime_key` (`col_datetime_key`),
- KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
-);
-CREATE TABLE t2 LIKE t1;
-
-INSERT INTO t1 VALUES
- (10,7,8,NULL,NULL,'01:27:35','01:27:35','2002-02-26 06:14:37','2002-02-26 06:14:37','v','v'),
- (11,1,9,'2006-06-14','2006-06-14','19:48:31','19:48:31','1900-01-01 00:00:00','1900-01-01 00:00:00','r','r');
-INSERT INTO t2 SELECT * FROM t1;
-
-SELECT table2.col_int_key AS field1
-FROM (
- t2 AS table1
- RIGHT OUTER JOIN
- (
- ( t1 AS table2 STRAIGHT_JOIN
- t1 AS table3 ON (
- (table3.col_varchar_nokey = table2.col_varchar_key ) AND
- (table3.pk = table2.col_int_key))
- )
- ) ON
- (
- (table3.col_varchar_key = table2.col_varchar_key) OR
- (table3.col_int_key = table2.pk)
- )
-)
-HAVING field1 < 216;
-
-DROP TABLE t1, t2;
-
-
---echo #
---echo # LPBUG#524025 Running RQG outer_join test leads to crash
---echo #
-
-CREATE TABLE t0 (
- pk int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (pk)
-);
-
-CREATE TABLE t1 (
- col_int int(11) DEFAULT NULL,
- col_int_key int(11) DEFAULT NULL,
- pk int(11) NOT NULL AUTO_INCREMENT,
- col_varchar_10_latin1 varchar(10) DEFAULT NULL,
- PRIMARY KEY (pk)
-);
-INSERT INTO t1 VALUES (5,5,1,'t'), (NULL,NULL,2,'y');
-
-CREATE TABLE t2 (
- col_int int(11) DEFAULT NULL
-);
-INSERT INTO t2 VALUES (8), (4);
-
-CREATE TABLE t3 (
- pk int(11) NOT NULL AUTO_INCREMENT,
- PRIMARY KEY (pk)
-);
-INSERT INTO t3 VALUES (1),(8);
-
-CREATE TABLE t4 (
- pk int(11) NOT NULL AUTO_INCREMENT,
- col_varchar_1024_latin1_key varchar(1024) DEFAULT NULL,
- col_int int(11) DEFAULT NULL,
- PRIMARY KEY (pk)
-);
-INSERT INTO t4 VALUES (1,'o',1), (2,'w',2);
-
-CREATE TABLE t5 (
- col_varchar_1024_utf8_key varchar(1024) CHARACTER SET utf8 DEFAULT NULL,
- col_varchar_1024_latin1_key varchar(1024) DEFAULT NULL,
- col_varchar_10_utf8_key varchar(1024) CHARACTER SET utf8 DEFAULT NULL,
- pk int(11) NOT NULL AUTO_INCREMENT,
- col_int_key int(11) DEFAULT NULL,
- PRIMARY KEY (pk)
-);
-INSERT INTO t5 VALUES ('k','a','z',1,2),('x','a','w',2,7);
-
-CREATE TABLE t6 (
- col_int int(11) DEFAULT NULL,
- col_int_key int(11) DEFAULT NULL
-);
-INSERT INTO t6 VALUES (6,1),(8,3);
-
-SELECT
- table3.col_int AS field1,
- table1.col_int AS field2,
- table1.col_int_key AS field3,
- table1.pk AS field4,
- table1.col_int AS field5,
- table2.col_int AS field6
-FROM
- t1 AS table1
- LEFT OUTER JOIN
- t4 AS table2
- LEFT JOIN t6 AS table3
- RIGHT JOIN t3 AS table4
- LEFT JOIN t5 AS table5 ON table4.pk = table5.pk
- LEFT JOIN t0 AS table6 ON table5.col_int_key = table6.pk
- ON table3.col_int_key = table5.pk
- ON table2.col_varchar_1024_latin1_key = table5.col_varchar_10_utf8_key
- LEFT JOIN t6 AS table7 ON table2.pk = table7.col_int
- ON table1.col_varchar_10_latin1 = table5.col_varchar_1024_latin1_key
- LEFT JOIN t2 AS table8 ON table3.col_int = table8.col_int
-WHERE
- table1.col_int_key < table2.pk
-HAVING
- field4 != 6;
-
-drop table t0,t1,t2,t3,t4,t5,t6;
-
---echo #
---echo # BUG#675118: Elimination of a table results in an invalid execution plan
---echo #
-CREATE TABLE t1 (f1 int(11), PRIMARY KEY (f1)) ;
-
-CREATE TABLE t2 (f4 varchar(1024), KEY (f4)) ;
-INSERT IGNORE INTO t2 VALUES ('xcddwntkbxyorzdv'),
- ('cnxxcddwntkbxyor'),('r'),('r'), ('did'),('I'),('when'),
- ('hczkfqjeggivdvac'),('e'),('okay'),('up');
-
-CREATE TABLE t3 (f4 varchar(1024), f1 int(11), f2 int(11)) ;
-INSERT IGNORE INTO t3 VALUES ('f','4','0'),('n','5','-996540416');
-
-CREATE TABLE t4 (f1 int(11), f3 varchar(10)) ;
-INSERT IGNORE INTO t4 VALUES ('8','n'),('9','nwzcerzsgx'),('10','c');
-
-CREATE TABLE t5 (f5 int(11), KEY (f5)) ;
-
-EXPLAIN
-SELECT t3.f2
-FROM t2
-LEFT JOIN t3
-LEFT JOIN t4
-LEFT JOIN t1 ON t4.f1 = t1.f1
-JOIN t5 ON t4.f3 ON t3.f1 = t5.f5 ON t2.f4 = t3.f4
-WHERE t3.f2 ;
---echo # ^^ The above must not produce a QEP of t3,t5,t2,t4
---echo # as that violates the "no interleaving of outer join nests" rule.
-
-DROP TABLE t1,t2,t3,t4,t5;
-
---echo #
---echo # BUG#997747: Assertion `join->best_read < ((double)1.79..5e+308L)'
---echo # failed in greedy_search with LEFT JOINs and unique keys
---echo #
-CREATE TABLE t1 (a1 INT);
-CREATE TABLE t2 (b1 INT);
-CREATE TABLE t3 (c1 INT, UNIQUE KEY(c1));
-CREATE TABLE t4 (d1 INT, UNIQUE KEY(d1));
-CREATE TABLE t5 (e1 INT);
-
-INSERT INTO t1 VALUES (1),(2);
-INSERT INTO t2 VALUES (2),(3);
-INSERT INTO t3 VALUES (3),(4);
-INSERT INTO t4 VALUES (4),(5);
-INSERT INTO t5 VALUES (5),(6);
-
-SELECT a1 FROM t1 LEFT JOIN t2 LEFT JOIN t3 LEFT JOIN t4
-ON c1 = d1 ON d1 = b1 ON a1 = b1
-LEFT JOIN t5 ON a1 = e1 ;
-
-DROP TABLE t1,t2,t3,t4,t5;
-
---echo #
---echo # BUG#884184: Wrong result with RIGHT JOIN + derived_merge
---echo #
-CREATE TABLE t1 (a int(11), b varchar(1)) ;
-INSERT IGNORE INTO t1 VALUES (0,'g');
-
-CREATE TABLE t3 ( a varchar(1)) ;
-INSERT IGNORE INTO t3 VALUES ('g');
-
-CREATE TABLE t2 ( a int(11) NOT NULL, PRIMARY KEY (a));
-INSERT INTO t2 VALUES (9), (10);
-create view v1 as SELECT t1.* FROM t1 LEFT JOIN t2 ON ( t1.a = t2.a ) WHERE t2.a <> 0;
-
-SELECT alias1.* FROM t3 LEFT JOIN v1 as alias1 ON ( t3.a = alias1.b );
-EXPLAIN SELECT alias1.* FROM t3 LEFT JOIN v1 as alias1 ON ( t3.a = alias1.b );
-drop view v1;
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # MDEV-5344: LEFT OUTER JOIN table data is lost in ON DUPLICATE KEY UPDATE section
---echo #
-create table t1 (
- id int(10) unsigned NOT NULL DEFAULT '0',
- v int(10) unsigned DEFAULT '0',
- PRIMARY KEY (id)
-);
-
-create table t2 (
- id int(10) unsigned NOT NULL DEFAULT '0',
- PRIMARY KEY (id)
-) ;
-
-create table t3 (
- id int(10) unsigned NOT NULL DEFAULT '0',
- v int(10) unsigned DEFAULT '0',
- PRIMARY KEY (id)
-);
-
-insert into t1 values (1, 10), (2, 10);
-insert into t2 values (1), (2);
-insert into t3 values (1, 20);
-
-insert into t1
-select t2.id, 5 from t2 LEFT OUTER JOIN t3 ON t2.id = t3.id
-on duplicate key update t1.v = t3.v;
-
-select * from t1;
-drop table t1,t2,t3;
-
---echo #
---echo # BUG#919878: Assertion `!eliminated_tables...
---echo #
-CREATE TABLE t1 ( a INT );
-INSERT INTO t1 VALUES (1);
-
-CREATE TABLE t2
- ( b INT, UNIQUE INDEX(b) );
-INSERT INTO t2 VALUES (1),(2);
-
-EXPLAIN EXTENDED
- SELECT * FROM t2
- WHERE b IN (
- SELECT SUM(a) FROM t1 LEFT JOIN t2 ON b=a
- );
-
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-4840: Wrong result (missing rows) on LEFT JOIN with InnoDB tables
---echo #
-CREATE TABLE t1 (alpha3 VARCHAR(3));
-INSERT INTO t1 VALUES ('USA'),('CAN');
-
-CREATE TABLE t2 ( t3_code VARCHAR(3), name VARCHAR(64));
-INSERT INTO t2 VALUES ('USA','Austin'),('USA','Boston');
-
-CREATE TABLE t3 ( code VARCHAR(3), name VARCHAR(64), PRIMARY KEY (code), UNIQUE KEY (name));
-INSERT INTO t3 VALUES ('CAN','Canada'),('USA','United States');
-
-SELECT * FROM t1 LEFT JOIN ( t2 LEFT JOIN t3 ON t2.t3_code = t3.code ) ON t1.alpha3 = t3.code;
-SELECT t1.alpha3 FROM t1 LEFT JOIN ( t2 LEFT JOIN t3 ON t2.t3_code = t3.code ) ON t1.alpha3 = t3.code;
-
-DROP TABLE t1, t2, t3;
-
-SET optimizer_switch=@save_optimizer_switch;
-
---echo #
---echo # MDEV-7893: table_elimination works wrong with on computed expression and compound unique key
---echo # (just a testcase)
-CREATE TABLE t1 (
- PostID int(10) unsigned NOT NULL
-) DEFAULT CHARSET=utf8;
-
-INSERT INTO t1 (PostID) VALUES (1), (2);
-
-CREATE TABLE t2 (
- VoteID int(10) unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
- EntityID int(10) unsigned NOT NULL,
- UserID int(10) unsigned NOT NULL,
- UNIQUE KEY EntityID (EntityID,UserID)
-) DEFAULT CHARSET=utf8;
-
-INSERT INTO t2 (EntityID, UserID) VALUES (1, 30), (2, 30);
-
-SELECT t1.*, T.Voted as Voted
-FROM
-t1 LEFT JOIN (
- SELECT 1 AS Voted, EntityID
- FROM t2
- WHERE t2.UserID = '20' ) AS T
- ON T.EntityID = t1.PostID
-WHERE t1.PostID='1'
-LIMIT 1;
-
-DROP TABLE t1,t2;
-
diff --git a/mysql-test/t/table_elim_debug.test b/mysql-test/t/table_elim_debug.test
deleted file mode 100644
index 6400f798195..00000000000
--- a/mysql-test/t/table_elim_debug.test
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# Table elimination (MWL#17) tests that need debug build
-#
-# In MariaDB 5.3, one can switch table_elimination on/off without debug, too:
-## --source include/have_debug.inc
-
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-
-# Check if optimizer_switch works
-
-create table t1 (a int);
-insert into t1 values (0),(1),(2),(3);
-
-create table t2 (a int primary key, b int)
- as select a, a as b from t1 where a in (1,2);
-
-explain select t1.a from t1 left join t2 on t2.a=t1.a;
-
-set optimizer_switch='table_elimination=off';
-explain select t1.a from t1 left join t2 on t2.a=t1.a;
-set optimizer_switch='table_elimination=on';
-explain select t1.a from t1 left join t2 on t2.a=t1.a;
-set optimizer_switch='table_elimination=default';
-explain select t1.a from t1 left join t2 on t2.a=t1.a;
-
-drop table t1, t2;
diff --git a/mysql-test/t/table_keyinfo-6838.test b/mysql-test/t/table_keyinfo-6838.test
deleted file mode 100644
index 5f4c9f44f86..00000000000
--- a/mysql-test/t/table_keyinfo-6838.test
+++ /dev/null
@@ -1,18 +0,0 @@
-# Test case for MDEV-6838.
-# Due to incorrect key_length computation, this usecase failed with the error
-# Using too big key for internal temp table.
-
-CREATE TABLE t1 (i INT, state VARCHAR(997)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (2,'Louisiana'),(9,'Maine');
-
-CREATE TABLE t2 (state VARCHAR(997), j INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES ('Louisiana',9),('Alaska',5);
-INSERT INTO t2 SELECT t2.* FROM t2 JOIN t2 AS t3 JOIN t2 AS t4 JOIN t2 AS t5 JOIN t2 AS t6;
-
-SET @@max_heap_table_size= 16384;
-set @@optimizer_switch='derived_merge=OFF';
-set @@optimizer_switch='extended_keys=ON';
-
-SELECT * FROM t1 AS t1_1 LEFT JOIN ( t1 AS t1_2 INNER JOIN (SELECT * FROM t2) v2 ON t1_2.i = j ) ON t1_1.state = v2.state LIMIT 1;
-
-DROP TABLE t1, t2;
diff --git a/mysql-test/t/table_options-5867.test b/mysql-test/t/table_options-5867.test
deleted file mode 100644
index 153ec08e675..00000000000
--- a/mysql-test/t/table_options-5867.test
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# MDEV-5867 ALTER TABLE t1 ENGINE=InnoDB keeps bad options when t1 ENGINE is CONNECT
-#
-# verify that SHOW CREATE TABLE hides unknown options when IGNORE_BAD_TABLE_OPTIONS is not set
-
---source include/have_example_plugin.inc
---source include/not_embedded.inc
-
-install soname 'ha_example';
-
-set sql_mode='ignore_bad_table_options';
-create table t1 (
- a int complex='c,f,f,f' invalid=3
-) engine=example ull=10000 str='dskj' one_or_two='one' yesno=0
- foobar=barfoo;
-
-create table t2 (a int, key (a) some_option=2014);
-
-show create table t1;
-show create table t2;
-
-set sql_mode='';
-
-show create table t1;
-show create table t2;
-
-drop table t1, t2;
-
-uninstall soname 'ha_example';
-
diff --git a/mysql-test/t/table_options.test b/mysql-test/t/table_options.test
deleted file mode 100644
index 533e6829c00..00000000000
--- a/mysql-test/t/table_options.test
+++ /dev/null
@@ -1,68 +0,0 @@
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-SET @OLD_SQL_MODE=@@SQL_MODE;
-SET SQL_MODE='IGNORE_BAD_TABLE_OPTIONS';
-
-create table t1 (a int fkey=vvv, key akey (a) dff=vvv) tkey1='1v1';
-show create table t1;
-drop table t1;
-
---echo #reassiginig options in the same line
-create table t1 (a int fkey=vvv, key akey (a) dff=vvv) tkey1=1v1 TKEY1=DEFAULT tkey1=1v2 tkey2=2v1;
-show create table t1;
-
--- echo #add option
-alter table t1 tkey4=4v1;
-show create table t1;
-
---echo #remove options
-alter table t1 tkey3=DEFAULT tkey4=DEFAULT;
-show create table t1;
-
-drop table t1;
-
-create table t1 (a int fkey1=v1, key akey (a) kkey1=v1) tkey1=1v1 tkey1=1v2 TKEY1=DEFAULT tkey2=2v1 tkey3=3v1;
-show create table t1;
-
---echo #change field with option with the same value
-alter table t1 change a a int `FKEY1`='v1';
-show create table t1;
---echo #change field with option with a different value
-alter table t1 change a a int fkey1=v2;
-show create table t1;
---echo #new column no options
-alter table t1 add column b int;
-show create table t1;
---echo #new key with options
-alter table t1 add key bkey (b) kkey2=v1;
-show create table t1;
---echo #new column with options
-alter table t1 add column c int fkey1=v1 fkey2=v2;
-show create table t1;
---echo #new key no options
-alter table t1 add key ckey (c);
-show create table t1;
---echo #drop column
-alter table t1 drop b;
-show create table t1;
---echo #add column with options after delete
-alter table t1 add column b int fkey2=v1;
-show create table t1;
---echo #add key
-alter table t1 add key bkey (b) kkey2=v2;
-show create table t1;
-drop table t1;
-
-#numeric (unquoted) value
-create table t1 (a int) tkey1=100;
-show create table t1;
-drop table t1;
-
---echo #error on unknown option
-SET SQL_MODE='';
---error ER_UNKNOWN_OPTION
-create table t1 (a int fkey=vvv, key akey (a) dff=vvv) tkey1=1v1;
-
-SET @@SQL_MODE=@OLD_SQL_MODE;
diff --git a/mysql-test/t/table_value_constr.test b/mysql-test/t/table_value_constr.test
deleted file mode 100644
index 578f8943fbb..00000000000
--- a/mysql-test/t/table_value_constr.test
+++ /dev/null
@@ -1,1046 +0,0 @@
-create table t1 (a int, b int);
-
-insert into t1 values (1,2),(4,6),(9,7),
- (1,1),(2,5),(7,8);
-
---echo # just VALUES
-
-values (1,2);
-
-values (1,2), (3,4), (5.6,0);
-
-values ("abc", "def");
-
---echo # UNION that uses VALUES structure(s)
-
-select 1,2
-union
-values (1,2);
-
-values (1,2)
-union
-select 1,2;
-
-select 1,2
-union
-values (1,2),(3,4),(5,6),(7,8);
-
-select 3,7
-union
-values (1,2),(3,4),(5,6);
-
-select 3,7,4
-union
-values (1,2,5),(4,5,6);
-
-select 1,2
-union
-values (1,7),(3,6.5);
-
-select 1,2
-union
-values (1,2.0),(3,6);
-
-select 1.8,2
-union
-values (1,2),(3,6);
-
-values (1,2.4),(3,6)
-union
-select 2.8,9;
-
-values (1,2),(3,4),(5,6),(7,8)
-union
-select 5,6;
-
-select "ab","cdf"
-union
-values ("al","zl"),("we","q");
-
-values ("ab", "cdf")
-union
-select "ab","cdf";
-
-values (1,2)
-union
-values (1,2),(5,6);
-
-values (1,2)
-union
-values (3,4),(5,6);
-
-values (1,2)
-union
-values (1,2)
-union values (4,5);
-
---echo # UNION ALL that uses VALUES structure
-
-values (1,2),(3,4)
-union all
-select 5,6;
-
-values (1,2),(3,4)
-union all
-select 1,2;
-
-select 5,6
-union all
-values (1,2),(3,4);
-
-select 1,2
-union all
-values (1,2),(3,4);
-
-values (1,2)
-union all
-values (1,2),(5,6);
-
-values (1,2)
-union all
-values (3,4),(5,6);
-
-values (1,2)
-union all
-values (1,2)
-union all
-values (4,5);
-
-values (1,2)
-union all
-values (1,2)
-union values (1,2);
-
-values (1,2)
-union
-values (1,2)
-union all
-values (1,2);
-
---echo # EXCEPT that uses VALUES structure(s)
-
-select 1,2
-except
-values (3,4),(5,6);
-
-select 1,2
-except
-values (1,2),(3,4);
-
-values (1,2),(3,4)
-except
-select 5,6;
-
-values (1,2),(3,4)
-except
-select 1,2;
-
-values (1,2),(3,4)
-except
-values (5,6);
-
-values (1,2),(3,4)
-except
-values (1,2);
-
---echo # INTERSECT that uses VALUES structure(s)
-
-select 1,2
-intersect
-values (3,4),(5,6);
-
-select 1,2
-intersect
-values (1,2),(3,4);
-
-values (1,2),(3,4)
-intersect
-select 5,6;
-
-values (1,2),(3,4)
-intersect
-select 1,2;
-
-values (1,2),(3,4)
-intersect
-values (5,6);
-
-values (1,2),(3,4)
-intersect
-values (1,2);
-
---echo # combination of different structures that uses VALUES structures : UNION + EXCEPT
-
-values (1,2),(3,4)
-except
-select 1,2
-union values (1,2);
-
-values (1,2),(3,4)
-except
-values (1,2)
-union
-values (1,2);
-
-values (1,2),(3,4)
-except
-values (1,2)
-union
-values (3,4);
-
-values (1,2),(3,4)
-union
-values (1,2)
-except
-values (1,2);
-
---echo # combination of different structures that uses VALUES structures : UNION ALL + EXCEPT
-
-values (1,2),(3,4)
-except
-select 1,2
-union all
-values (1,2);
-
-values (1,2),(3,4)
-except
-values (1,2)
-union all
-values (1,2);
-
-values (1,2),(3,4)
-except
-values (1,2)
-union all
-values (3,4);
-
-values (1,2),(3,4)
-union all
-values (1,2)
-except
-values (1,2);
-
---echo # combination of different structures that uses VALUES structures : UNION + INTERSECT
-
-values (1,2),(3,4)
-intersect
-select 1,2
-union
-values (1,2);
-
-values (1,2),(3,4)
-intersect
-values (1,2)
-union
-values (1,2);
-
-values (1,2),(3,4)
-intersect
-values (1,2)
-union
-values (3,4);
-
-values (1,2),(3,4)
-union
-values (1,2)
-intersect
-values (1,2);
-
---echo # combination of different structures that uses VALUES structures : UNION ALL + INTERSECT
-
-values (1,2),(3,4)
-intersect
-select 1,2
-union all
-values (1,2);
-
-values (1,2),(3,4)
-intersect
-values (1,2)
-union all
-values (1,2);
-
-values (1,2),(3,4)
-intersect
-values (1,2)
-union all
-values (3,4);
-
-values (1,2),(3,4)
-union all
-values (1,2)
-intersect
-values (1,2);
-
---echo # combination of different structures that uses VALUES structures : UNION + UNION ALL
-
-values (1,2),(3,4)
-union all
-select 1,2
-union
-values (1,2);
-
-values (1,2),(3,4)
-union all
-values (1,2)
-union
-values (1,2);
-
-values (1,2),(3,4)
-union all
-values (1,2)
-union
-values (3,4);
-
-values (1,2),(3,4)
-union
-values (1,2)
-union all
-values (1,2);
-
-values (1,2)
-union
-values (1,2)
-union all
-values (1,2);
-
---echo # CTE that uses VALUES structure(s) : non-recursive CTE
-
-with t2 as
-(
- values (1,2),(3,4)
-)
-select * from t2;
-
-with t2 as
-(
- select 1,2
- union
- values (1,2)
-)
-select * from t2;
-
-with t2 as
-(
- select 1,2
- union
- values (1,2),(3,4)
-)
-select * from t2;
-
-with t2 as
-(
- values (1,2)
- union
- select 1,2
-)
-select * from t2;
-
-with t2 as
-(
- values (1,2),(3,4)
- union
- select 1,2
-)
-select * from t2;
-
-with t2 as
-(
- values (5,6)
- union
- values (1,2),(3,4)
-)
-select * from t2;
-
-with t2 as
-(
- values (1,2)
- union
- values (1,2),(3,4)
-)
-select * from t2;
-
-with t2 as
-(
- select 1,2
- union all
- values (1,2),(3,4)
-)
-select * from t2;
-
-with t2 as
-(
- values (1,2),(3,4)
- union all
- select 1,2
-)
-select * from t2;
-
-with t2 as
-(
- values (1,2)
- union all
- values (1,2),(3,4)
-)
-select * from t2;
-
---echo # recursive CTE that uses VALUES structure(s) : singe VALUES structure as anchor
-
-with recursive t2(a,b) as
-(
- values(1,1)
- union
- select t1.a, t1.b
- from t1,t2
- where t1.a=t2.a
-)
-select * from t2;
-
-with recursive t2(a,b) as
-(
- values(1,1)
- union
- select t1.a+1, t1.b
- from t1,t2
- where t1.a=t2.a
-)
-select * from t2;
-
---echo # recursive CTE that uses VALUES structure(s) : several VALUES structures as anchors
-
-with recursive t2(a,b) as
-(
- values(1,1)
- union
- values (3,4)
- union
- select t2.a+1, t1.b
- from t1,t2
- where t1.a=t2.a
-)
-select * from t2;
-
---echo # recursive CTE that uses VALUES structure(s) : that uses UNION ALL
-
-with recursive t2(a,b,st) as
-(
- values(1,1,1)
- union all
- select t2.a, t1.b, t2.st+1
- from t1,t2
- where t1.a=t2.a and st<3
-)
-select * from t2;
-
---echo # recursive CTE that uses VALUES structure(s) : computation of factorial (first 10 elements)
-
-with recursive fact(n,f) as
-(
- values(1,1)
- union
- select n+1,f*n from fact where n < 10
-)
-select * from fact;
-
---echo # Derived table that uses VALUES structure(s) : singe VALUES structure
-
-select * from (values (1,2),(3,4)) as t2;
-
---echo # Derived table that uses VALUES structure(s) : UNION with VALUES structure(s)
-
-select * from (select 1,2 union values (1,2)) as t2;
-
-select * from (select 1,2 union values (1,2),(3,4)) as t2;
-
-select * from (values (1,2) union select 1,2) as t2;
-
-select * from (values (1,2),(3,4) union select 1,2) as t2;
-
-select * from (values (5,6) union values (1,2),(3,4)) as t2;
-
-select * from (values (1,2) union values (1,2),(3,4)) as t2;
-
---echo # Derived table that uses VALUES structure(s) : UNION ALL with VALUES structure(s)
-
-select * from (select 1,2 union all values (1,2),(3,4)) as t2;
-
-select * from (values (1,2),(3,4) union all select 1,2) as t2;
-
-select * from (values (1,2) union all values (1,2),(3,4)) as t2;
-
---echo # CREATE VIEW that uses VALUES structure(s) : singe VALUES structure
-
-let $drop_view= drop view v1;
-let $select_view= select * from v1;
-
-create view v1 as values (1,2),(3,4);
-
-eval $select_view;
-eval $drop_view;
-
---echo # CREATE VIEW that uses VALUES structure(s) : UNION with VALUES structure(s)
-
-create view v1 as
- select 1,2
- union
- values (1,2);
-
-eval $select_view;
-eval $drop_view;
-
-create view v1 as
- select 1,2
- union
- values (1,2),(3,4);
-
-eval $select_view;
-eval $drop_view;
-
-create view v1 as
- values (1,2)
- union
- select 1,2;
-
-eval $select_view;
-eval $drop_view;
-
-create view v1 as
- values (1,2),(3,4)
- union
- select 1,2;
-
-eval $select_view;
-eval $drop_view;
-
-create view v1 as
- values (5,6)
- union
- values (1,2),(3,4);
-
-eval $select_view;
-eval $drop_view;
-
---echo # CREATE VIEW that uses VALUES structure(s) : UNION ALL with VALUES structure(s)
-
-create view v1 as
- values (1,2)
- union
- values (1,2),(3,4);
-
-eval $select_view;
-eval $drop_view;
-
-create view v1 as
- select 1,2
- union all
- values (1,2),(3,4);
-
-eval $select_view;
-eval $drop_view;
-
-create view v1 as
- values (1,2),(3,4)
- union all
- select 1,2;
-
-eval $select_view;
-eval $drop_view;
-
-create view v1 as
- values (1,2)
- union all
- values (1,2),(3,4);
-
-eval $select_view;
-eval $drop_view;
-
---echo # IN-subquery with VALUES structure(s) : simple case
-let $query=
-select * from t1
-where a in (values (1));
-let $subst_query=
-select * from t1
-where a in (select * from (values (1)) as tvc_0);
-eval $query;
-eval $subst_query;
-eval explain extended $query;
-eval explain extended $subst_query;
-
---echo # IN-subquery with VALUES structure(s) : UNION with VALUES on the first place
-let $query=
-select * from t1
-where a in (values (1) union select 2);
-let $subst_query=
-select * from t1
-where a in (select * from (values (1)) as tvc_0 union
- select 2);
-eval $query;
-eval $subst_query;
-eval explain extended $query;
-eval explain extended $subst_query;
-
---echo # IN-subquery with VALUES structure(s) : UNION with VALUES on the second place
-let $query=
-select * from t1
-where a in (select 2 union values (1));
-let $subst_query=
-select * from t1
-where a in (select 2 union
- select * from (values (1)) tvc_0);
-eval $query;
-eval $subst_query;
-eval explain extended $query;
-eval explain extended $subst_query;
-
---echo # IN-subquery with VALUES structure(s) : UNION ALL
-let $query=
-select * from t1
-where a in (values (1) union all select b from t1);
-let $subst_query=
-select * from t1
-where a in (select * from (values (1)) as tvc_0 union all
- select b from t1);
-
-eval $query;
-eval $subst_query;
-eval explain extended $query;
-eval explain extended $subst_query;
-
---echo # NOT IN subquery with VALUES structure(s) : simple case
-let $query=
-select * from t1
-where a not in (values (1),(2));
-let $subst_query=
-select * from t1
-where a not in (select * from (values (1),(2)) as tvc_0);
-
-eval $query;
-eval $subst_query;
-eval explain extended $query;
-eval explain extended $subst_query;
-
---echo # NOT IN subquery with VALUES structure(s) : UNION with VALUES on the first place
-let $query=
-select * from t1
-where a not in (values (1) union select 2);
-let $subst_query=
-select * from t1
-where a not in (select * from (values (1)) as tvc_0 union
- select 2);
-
-eval $query;
-eval $subst_query;
-eval explain extended $query;
-eval explain extended $subst_query;
-
---echo # NOT IN subquery with VALUES structure(s) : UNION with VALUES on the second place
-let $query=
-select * from t1
-where a not in (select 2 union values (1));
-let $subst_query=
-select * from t1
-where a not in (select 2 union
- select * from (values (1)) as tvc_0);
-
-eval $query;
-eval $subst_query;
-eval explain extended $query;
-eval explain extended $subst_query;
-
---echo # ANY-subquery with VALUES structure(s) : simple case
-let $query=
-select * from t1
-where a = any (values (1),(2));
-let $subst_query=
-select * from t1
-where a = any (select * from (values (1),(2)) as tvc_0);
-
-eval $query;
-eval $subst_query;
-eval explain extended $query;
-eval explain extended $subst_query;
-
---echo # ANY-subquery with VALUES structure(s) : UNION with VALUES on the first place
-let $query=
-select * from t1
-where a = any (values (1) union select 2);
-let $subst_query=
-select * from t1
-where a = any (select * from (values (1)) as tvc_0 union
- select 2);
-
-eval $query;
-eval $subst_query;
-eval explain extended $query;
-eval explain extended $subst_query;
-
---echo # ANY-subquery with VALUES structure(s) : UNION with VALUES on the second place
-let $query=
-select * from t1
-where a = any (select 2 union values (1));
-let $subst_query=
-select * from t1
-where a = any (select 2 union
- select * from (values (1)) as tvc_0);
-
-eval $query;
-eval $subst_query;
-eval explain extended $query;
-eval explain extended $subst_query;
-
---echo # ALL-subquery with VALUES structure(s) : simple case
-let $query=
-select * from t1
-where a = all (values (1));
-let $subst_query=
-select * from t1
-where a = all (select * from (values (1)) as tvc_0);
-
-eval $query;
-eval $subst_query;
-eval explain extended $query;
-eval explain extended $subst_query;
-
---echo # ALL-subquery with VALUES structure(s) : UNION with VALUES on the first place
-let $query=
-select * from t1
-where a = all (values (1) union select 1);
-let $subst_query=
-select * from t1
-where a = all (select * from (values (1)) as tvc_0 union
- select 1);
-
-eval $query;
-eval $subst_query;
-eval explain extended $query;
-eval explain extended $subst_query;
-
---echo # ALL-subquery with VALUES structure(s) : UNION with VALUES on the second place
-let $query=
-select * from t1
-where a = any (select 1 union values (1));
-let $subst_query=
-select * from t1
-where a = any (select 1 union
- select * from (values (1)) as tvc_0);
-
-eval $query;
-eval $subst_query;
-eval explain extended $query;
-eval explain extended $subst_query;
-
---echo # prepare statement that uses VALUES structure(s): single VALUES structure
-
-prepare stmt1 from "
-values (1,2);
-";
-
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-
---echo # prepare statement that uses VALUES structure(s): UNION with VALUES structure(s)
-
-prepare stmt1 from "
- select 1,2
- union
- values (1,2),(3,4);
-";
-
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-
-prepare stmt1 from "
- values (1,2),(3,4)
- union
- select 1,2;
-";
-
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-
-prepare stmt1 from "
- select 1,2
- union
- values (3,4)
- union
- values (1,2);
-";
-
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-
-prepare stmt1 from "
- values (5,6)
- union
- values (1,2),(3,4);
-";
-
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-
---echo # prepare statement that uses VALUES structure(s): UNION ALL with VALUES structure(s)
-
-prepare stmt1 from "
- select 1,2
- union
- values (1,2),(3,4);
-";
-
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-
-prepare stmt1 from "
- values (1,2),(3,4)
- union all
- select 1,2;
-";
-
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-
-prepare stmt1 from "
- select 1,2
- union all
- values (3,4)
- union all
- values (1,2);
-";
-
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-
-prepare stmt1 from "
- values (1,2)
- union all
- values (1,2),(3,4);
-";
-
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-
---echo # explain query that uses VALUES structure(s): single VALUES structure
-
-explain
-values (1,2);
-
-explain format=json
-values (1,2);
-
---echo # explain query that uses VALUES structure(s): UNION with VALUES structure(s)
-
-explain
-select 1,2
-union
-values (1,2),(3,4);
-
-explain
-values (1,2),(3,4)
-union
-select 1,2;
-
-explain
-values (5,6)
-union
-values (1,2),(3,4);
-
-explain format=json
-select 1,2
-union
-values (1,2),(3,4);
-
-explain format=json
-values (1,2),(3,4)
-union
-select 1,2;
-
-explain format=json
-values (5,6)
-union
-values (1,2),(3,4);
-
-explain
-select 1,2
-union
-values (3,4)
-union
-values (1,2);
-
-explain format=json
-select 1,2
-union
-values (3,4)
-union
-values (1,2);
-
---echo # explain query that uses VALUES structure(s): UNION ALL with VALUES structure(s)
-
-explain
-select 1,2
-union
-values (1,2),(3,4);
-
-explain
-values (1,2),(3,4)
-union all
-select 1,2;
-
-explain
-values (1,2)
-union all
-values (1,2),(3,4);
-
-explain format=json
-values (1,2),(3,4)
-union all
-select 1,2;
-
-explain format=json
-select 1,2
-union
-values (1,2),(3,4);
-
-explain format=json
-values (1,2)
-union all
-values (1,2),(3,4);
-
-explain
-select 1,2
-union all
-values (3,4)
-union all
-values (1,2);
-
-explain format=json
-select 1,2
-union all
-values (3,4)
-union all
-values (1,2);
-
---echo # analyze query that uses VALUES structure(s): single VALUES structure
-
-analyze
-values (1,2);
-
-analyze format=json
-values (1,2);
-
---echo # analyze query that uses VALUES structure(s): UNION with VALUES structure(s)
-
-analyze
-select 1,2
-union
-values (1,2),(3,4);
-
-analyze
-values (1,2),(3,4)
-union
-select 1,2;
-
-analyze
-values (5,6)
-union
-values (1,2),(3,4);
-
-analyze format=json
-select 1,2
-union
-values (1,2),(3,4);
-
-analyze format=json
-values (1,2),(3,4)
-union
-select 1,2;
-
-analyze format=json
-values (5,6)
-union
-values (1,2),(3,4);
-
-analyze
-select 1,2
-union
-values (3,4)
-union
-values (1,2);
-
-analyze format=json
-select 1,2
-union
-values (3,4)
-union
-values (1,2);
-
---echo # analyze query that uses VALUES structure(s): UNION ALL with VALUES structure(s)
-
-analyze
-select 1,2
-union
-values (1,2),(3,4);
-
-analyze
-values (1,2),(3,4)
-union all
-select 1,2;
-
-analyze
-values (1,2)
-union all
-values (1,2),(3,4);
-
-analyze format=json
-values (1,2),(3,4)
-union all
-select 1,2;
-
-analyze format=json
-select 1,2
-union
-values (1,2),(3,4);
-
-analyze format=json
-values (1,2)
-union all
-values (1,2),(3,4);
-
-analyze
-select 1,2
-union all
-values (3,4)
-union all
-values (1,2);
-
-analyze format=json
-select 1,2
-union all
-values (3,4)
-union all
-values (1,2);
-
---echo # different number of values in TVC
---error ER_WRONG_NUMBER_OF_VALUES_IN_TVC
-values (1,2),(3,4,5);
-
---echo # illegal parameter data types in TVC
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-values (1,point(1,1)),(1,1);
---error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
-values (1,point(1,1)+1);
-
---echo # field reference in TVC
---error ER_FIELD_REFERENCE_IN_TVC
-select * from (values (1), (b), (2)) as new_tvc;
---error ER_FIELD_REFERENCE_IN_TVC
-select * from (values (1), (t1.b), (2)) as new_tvc;
-
-drop table t1;
diff --git a/mysql-test/t/tablelock.test b/mysql-test/t/tablelock.test
deleted file mode 100644
index 5ac93f09ac1..00000000000
--- a/mysql-test/t/tablelock.test
+++ /dev/null
@@ -1,64 +0,0 @@
-#
-# Test of lock tables
-#
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-create table t1 ( n int auto_increment primary key);
-lock tables t1 write;
-insert into t1 values(NULL);
-unlock tables;
-check table t1;
-lock tables t1 write, t1 as t0 read;
-insert into t1 values(NULL);
-unlock tables;
-check table t1;
-lock tables t1 write, t1 as t0 read, t1 as t2 read;
-insert into t1 values(NULL);
-unlock tables;
-check table t1;
-lock tables t1 write, t1 as t0 write, t1 as t2 read;
-insert into t1 values(NULL);
-unlock tables;
-check table t1;
-lock tables t1 write, t1 as t0 write, t1 as t2 read, t1 as t3 read;
-insert into t1 values(NULL);
-unlock tables;
-check table t1;
-lock tables t1 write, t1 as t0 write, t1 as t2 write;
-insert into t1 values(NULL);
-unlock tables;
-check table t1;
-drop table t1;
-
-#
-# Test of locking and delete of files
-#
-
-CREATE TABLE t1 (a int);
-CREATE TABLE t2 (a int);
-lock tables t1 write,t1 as b write, t2 write, t2 as c read;
-drop table t1,t2;
-
-CREATE TABLE t1 (a int);
-CREATE TABLE t2 (a int);
-lock tables t1 write,t1 as b write, t2 write, t2 as c read;
-drop table t2,t1;
-unlock tables;
-
-# End of 4.1 tests
-
-#
-# Bug#23588 SHOW COLUMNS on a temporary table causes locking issues
-#
-create temporary table t1(f1 int);
-lock tables t1 write;
-insert into t1 values (1);
-show columns from t1;
-insert into t1 values(2);
-drop table t1;
-unlock tables;
-
-# End of 5.0 tests
diff --git a/mysql-test/t/tablespace.test b/mysql-test/t/tablespace.test
deleted file mode 100644
index 9f3cf6255ac..00000000000
--- a/mysql-test/t/tablespace.test
+++ /dev/null
@@ -1,122 +0,0 @@
-#
-# BUG#60111 storage type for table not saved in .frm
-#
-
-#
-# Check that the table options for TABLESPACE and STORAGE
-# are printed in SHOW CREATE TABLE
-#
-
-# TABLESPACE only
-CREATE TABLE t1(a int) TABLESPACE ts ENGINE=MyISAM;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-# TABLESPACE + STORAGE DISK
-CREATE TABLE t1(a int) TABLESPACE ts STORAGE DISK ENGINE=MyISAM;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-# TABLESPACE + STORAGE MEMORY
-CREATE TABLE t1(a int) TABLESPACE ts STORAGE MEMORY ENGINE=MyISAM;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-# STORAGE MEMORY only
-CREATE TABLE t1(a int) STORAGE MEMORY ENGINE=MyISAM;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-# STORAGE DISK only
-CREATE TABLE t1(a int) STORAGE DISK ENGINE=MyISAM;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-#
-# Check that the table options for TABLESPACE and STORAGE
-# are kept in an ALTER
-#
-
-# TABLESPACE only
-CREATE TABLE t1(a int) TABLESPACE ts ENGINE=MyISAM;
-ALTER TABLE t1 ADD COLUMN b int;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-# TABLESPACE and STORAGE DISK
-CREATE TABLE t1(a int) TABLESPACE ts STORAGE DISK ENGINE=MyISAM;
-ALTER TABLE t1 ADD COLUMN b int;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-#
-# Check that the table options for TABLESPACE and STORAGE
-# can be changed with an ALTER
-#
-
-# TABLESPACE only
-CREATE TABLE t1(a int) ENGINE=MyISAM;
-
-ALTER TABLE t1 TABLESPACE ts;
-SHOW CREATE TABLE t1;
-
-ALTER TABLE t1 TABLESPACE ts2;
-SHOW CREATE TABLE t1;
-
-DROP TABLE t1;
-
-# STORAGE only
-CREATE TABLE t1(a int) ENGINE=MyISAM;
-
-ALTER TABLE t1 STORAGE MEMORY;
-SHOW CREATE TABLE t1;
-
-ALTER TABLE t1 STORAGE DISK;
-SHOW CREATE TABLE t1;
-
-DROP TABLE t1;
-
-# TABLESPACE and STORAGE
-CREATE TABLE t1(a int) ENGINE=MyISAM;
-
-ALTER TABLE t1 STORAGE MEMORY TABLESPACE ts;
-SHOW CREATE TABLE t1;
-
-ALTER TABLE t1 STORAGE DISK TABLESPACE ts2;
-SHOW CREATE TABLE t1;
-
-DROP TABLE t1;
-
-#
-# Check that it's possible to read a .frm fle created
-# by MySQL Cluster 7.0(which introduced the new "format
-# section) with this statement:
-#
-# CREATE TABLE cluster_7022_table
-# (
-# a int primary key,
-# b int,
-# c int STORAGE DISK,
-# d int STORAGE MEMORY NOT NULL,
-# e int COLUMN_FORMAT DYNAMIC,
-# f int COLUMN_FORMAT FIXED,
-# g int COLUMN_FORMAT DEFAULT,
-# h int STORAGE DISK COLUMN_FORMAT DYNAMIC NOT NULL,
-# i int STORAGE MEMORY COLUMN_FORMAT DYNAMIC,
-# j int STORAGE DISK COLUMN_FORMAT FIXED,
-# k int STORAGE MEMORY COLUMN_FORMAT FIXED
-# ) STORAGE DISK TABLESPACE the_tablespacename ENGINE=MyISAM;
-#
-# NOTE! The column level properties will not yet show up
-# in SHOW CREATE TABLE of MySQL Server(although they are
-# visible in .trace file)
-#
-
-let $MYSQLD_DATADIR= `SELECT @@datadir`;
-copy_file std_data/cluster_7022_table.frm $MYSQLD_DATADIR/test/t1.frm;
-copy_file std_data/cluster_7022_table.MYD $MYSQLD_DATADIR/test/t1.MYD;
-copy_file std_data/cluster_7022_table.MYI $MYSQLD_DATADIR/test/t1.MYI;
-
-SHOW CREATE TABLE t1;
-
-DROP TABLE t1;
diff --git a/mysql-test/t/tc_heuristic_recover.test b/mysql-test/t/tc_heuristic_recover.test
deleted file mode 100644
index 8cbf7d61143..00000000000
--- a/mysql-test/t/tc_heuristic_recover.test
+++ /dev/null
@@ -1,98 +0,0 @@
-# The test verifies a few server/engine recovery option combinations.
-# Specifically, MDEV-13437,13438 are concerned with no crashes
-# due to InnoDB being read-only during --tc-heuristic-recover=ROLLBACK|COMMIT.
-#
-# Initially the test commits a transaction and in the following proceeds
-# throughout some phases.
-# Within them the server is shut down and attempted to restart, to succeed
-# that in the end.
-# All this proves no crashes and effective rollback of the transaction.
-#
---source include/have_innodb.inc
-# The test logic really requires --log-bin.
---source include/have_binlog_format_mixed.inc
---source include/have_debug_sync.inc
---source include/not_embedded.inc
-
-call mtr.add_suppression("Can't init tc log");
-call mtr.add_suppression("Found 1 prepared transactions!");
-call mtr.add_suppression("Aborting");
-
-# Now take a shapshot of the last time server options.
-#
-# The "restart" expect-file facility can't be engaged because the server
-# having conflicting options may not succeed to boot up.
---let SEARCH_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err
-
-CREATE TABLE t1 (i INT) ENGINE=InnoDB;
-SET GLOBAL innodb_flush_log_at_trx_commit=1;
-FLUSH TABLES; # we need the table post crash-restart, see MDEV-8841.
-
-# Run transaction in a separate "prey" connection
---connect (con1,localhost,root,,)
-# The signal won't arrive though
-set debug_sync='ha_commit_trans_after_prepare WAIT_FOR go';
---send INSERT INTO t1 VALUES (1);
-
---connection default
-
---let $table= information_schema.processlist
---let $where= where state = 'debug sync point: ha_commit_trans_after_prepare'
---let $wait_condition= SELECT count(*) = 1 FROM $table $where
---source include/wait_condition.inc
-
---echo # Prove that no COMMIT or ROLLBACK occurred yet.
-SELECT * FROM t1;
-SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
-SELECT * FROM t1;
-
-# TODO: MDEV-12700 Allow innodb_read_only startup without prior slow shutdown.
---source include/kill_mysqld.inc
---error 1
---exec $MYSQLD_LAST_CMD --log-bin=master-bin --binlog-format=mixed --core-file --loose-debug-sync-timeout=300 --innodb-force-recovery=4
-
---let SEARCH_PATTERN= was in the XA prepared state
---source include/search_pattern_in_file.inc
---let SEARCH_PATTERN= Found 1 prepared transactions!
---source include/search_pattern_in_file.inc
---let SEARCH_PATTERN= \\[ERROR\\] Can\\'t init tc log
---source include/search_pattern_in_file.inc
-
---error 1
---exec $MYSQLD_LAST_CMD --log-bin=master-bin --binlog-format=mixed --core-file --loose-debug-sync-timeout=300 --innodb-force-recovery=4 --tc-heuristic-recover=COMMIT
---let SEARCH_PATTERN= was in the XA prepared state
---source include/search_pattern_in_file.inc
---let SEARCH_PATTERN= Found 1 prepared transactions!
---source include/search_pattern_in_file.inc
---let SEARCH_PATTERN= \\[ERROR\\] Can\\'t init tc log
---source include/search_pattern_in_file.inc
---let SEARCH_PATTERN= Please restart mysqld without --tc-heuristic-recover
---source include/search_pattern_in_file.inc
-
---error 1
---exec $MYSQLD_LAST_CMD --log-bin=master-bin --binlog-format=mixed --core-file --loose-debug-sync-timeout=300 --tc-heuristic-recover=ROLLBACK
-
---let SEARCH_PATTERN= was in the XA prepared state
---source include/search_pattern_in_file.inc
---let SEARCH_PATTERN= Found 1 prepared transactions!
---source include/search_pattern_in_file.inc
---let SEARCH_PATTERN= \\[ERROR\\] Can\\'t init tc log
---source include/search_pattern_in_file.inc
---let SEARCH_PATTERN= Please restart mysqld without --tc-heuristic-recover
---source include/search_pattern_in_file.inc
-
---source include/start_mysqld.inc
-
---let SEARCH_PATTERN= was in the XA prepared state
---source include/search_pattern_in_file.inc
---let SEARCH_PATTERN= Found 1 prepared transactions!
---source include/search_pattern_in_file.inc
-
-SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
-SELECT * FROM t1;
-SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
-SELECT * FROM t1;
-#
-# Cleanup
-#
-DROP TABLE t1;
diff --git a/mysql-test/t/temp_table-master.opt b/mysql-test/t/temp_table-master.opt
deleted file mode 100644
index 5ac2ca8495b..00000000000
--- a/mysql-test/t/temp_table-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---tmpdir=$MYSQLTEST_VARDIR//tmp
diff --git a/mysql-test/t/temp_table.test b/mysql-test/t/temp_table.test
deleted file mode 100644
index fb44362b537..00000000000
--- a/mysql-test/t/temp_table.test
+++ /dev/null
@@ -1,597 +0,0 @@
-# mysqltest should be fixed
---source include/not_embedded.inc
---source include/have_innodb.inc
-
-#
-# Test of temporary tables
-#
-
---disable_warnings
-drop table if exists t1,t2;
-drop view if exists v1;
---enable_warnings
-
---echo #
---echo # test basic creation of temporary tables together with normal table
---echo #
-
-create table t1 (a int);
-create temporary table t1 AS SELECT 1;
---error 1050
-create temporary table t1 AS SELECT 1;
---error 1050
-create temporary table t1 (a int);
-drop temporary table t1;
-drop table t1;
-
-create temporary table t1 AS SELECT 1;
---error 1050
-create temporary table t1 AS SELECT 1;
---error 1050
-create temporary table t1 (a int);
-drop temporary table t1;
-
---echo #
---echo # Test with rename
---echo #
-
-CREATE TABLE t1 (c int not null, d char (10) not null);
-insert into t1 values(1,""),(2,"a"),(3,"b");
-CREATE TEMPORARY TABLE t1 (a int not null, b char (10) not null);
-insert into t1 values(4,"e"),(5,"f"),(6,"g");
-alter table t1 rename t2;
-select * from t1;
-select * from t2;
-CREATE TABLE t2 (x int not null, y int not null);
-alter table t2 rename t1;
-select * from t1;
-create TEMPORARY TABLE t2 engine=heap select * from t1;
-create TEMPORARY TABLE IF NOT EXISTS t2 (a int) engine=heap;
-
-# This should give errors
---error 1050
-CREATE TEMPORARY TABLE t1 (a int not null, b char (10) not null);
---error 1050
-ALTER TABLE t1 RENAME t2;
-
-select * from t2;
-alter table t2 add primary key (a,b);
-drop table t1,t2;
-select * from t1;
-drop table t2;
-create temporary table t1 select *,2 as "e" from t1;
-select * from t1;
-drop table t1;
-drop table t1;
-
-#
-# Test CONCAT_WS with temporary tables
-#
-
-CREATE TABLE t1 (pkCrash INTEGER PRIMARY KEY,strCrash VARCHAR(255));
-INSERT INTO t1 ( pkCrash, strCrash ) VALUES ( 1, '1');
-SELECT CONCAT_WS(pkCrash, strCrash) FROM t1;
-drop table t1;
-create temporary table t1 select 1 as 'x';
-drop table t1;
-CREATE TABLE t1 (x INT);
-INSERT INTO t1 VALUES (1), (2), (3);
-CREATE TEMPORARY TABLE tmp SELECT *, NULL FROM t1;
-drop table t1;
-
-#
-# Problem with ELT
-#
-create temporary table t1 (id int(10) not null unique);
-create temporary table t2 (id int(10) not null primary key,
-val int(10) not null);
-
-# put in some initial values
-insert into t1 values (1),(2),(4);
-insert into t2 values (1,1),(2,1),(3,1),(4,2);
-
-# do a query using ELT, a join and an ORDER BY.
-select one.id, two.val, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id;
-drop table t1,t2;
-
-#
-# Test of failed ALTER TABLE on temporary table
-#
-create temporary table t1 (a int not null);
-insert into t1 values (1),(1);
--- error ER_DUP_ENTRY
-alter table t1 add primary key (a);
-drop table t1;
-
-#
-# In MySQL 4.0.4 doing a GROUP BY on a NULL column created a disk based
-# temporary table when a memory based one would be good enough.
-
-CREATE TABLE t1 (
- d datetime default NULL
-) ENGINE=MyISAM;
-
-
-INSERT INTO t1 VALUES ('2002-10-24 14:50:32'),('2002-10-24 14:50:33'),('2002-10-24 14:50:34'),('2002-10-24 14:50:34'),('2002-10-24 14:50:34'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:38'),('2002-10-24 14:50:38'),('2002-10-24 14:50:38'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:40'),('2002-10-24 14:50:40'),('2002-10-24 14:50:40');
-
-flush status;
-select * from t1 group by d;
-show status like "created_tmp%tables";
-drop table t1;
-
-# Fix for BUG#8921: Check that temporary table is ingored by view commands.
-create temporary table v1 as select 'This is temp. table' A;
-create view v1 as select 'This is view' A;
-select * from v1;
-show create table v1;
-show create view v1;
-drop view v1;
-select * from v1;
-create view v1 as select 'This is view again' A;
-select * from v1;
-drop table v1;
-select * from v1;
-drop view v1;
-
-# Bug #8497: tmpdir with extra slashes would cause failures
-#
-create table t1 (a int, b int, index(a), index(b));
-create table t2 (c int auto_increment, d varchar(255), primary key (c));
-insert into t1 values (3,1),(3,2);
-insert into t2 values (NULL, 'foo'), (NULL, 'bar');
-select d, c from t1 left join t2 on b = c where a = 3 order by d;
-drop table t1, t2;
-
-
-#
-# BUG#21096: locking issue ; temporary table conflicts.
-#
-# The problem was that on DROP TEMPORARY table name lock was acquired,
-# which should not be done.
-#
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (i INT);
-
-LOCK TABLE t1 WRITE;
-
-connect (conn1, localhost, root,,);
-
-CREATE TEMPORARY TABLE t1 (i INT);
-
---echo The following command should not block
-DROP TEMPORARY TABLE t1;
-
-disconnect conn1;
-connection default;
-
-DROP TABLE t1;
-
-#
-# Check that it's not possible to drop a base table with
-# DROP TEMPORARY statement.
-#
-CREATE TABLE t1 (i INT);
-CREATE TEMPORARY TABLE t2 (i INT);
-
---error 1051
-DROP TEMPORARY TABLE t2, t1;
-
-# Table t2 should have been dropped.
---error 1146
-SELECT * FROM t2;
-# But table t1 should still be there.
-SELECT * FROM t1;
-
-DROP TABLE t1;
-
-
---echo End of 4.1 tests.
-
-#
-# Bug #24791: Union with AVG-groups generates wrong results
-#
-CREATE TABLE t1 ( c FLOAT( 20, 14 ) );
-INSERT INTO t1 VALUES( 12139 );
-
-CREATE TABLE t2 ( c FLOAT(30,18) );
-INSERT INTO t2 VALUES( 123456 );
-
-SELECT AVG( c ) FROM t1 UNION SELECT 1;
-SELECT 1 UNION SELECT AVG( c ) FROM t1;
-SELECT 1 UNION SELECT * FROM t2 UNION SELECT 1;
-SELECT c/1 FROM t1 UNION SELECT 1;
-
-DROP TABLE t1, t2;
-
-#
-# Test truncate with temporary tables
-#
-
-create temporary table t1 (a int);
-insert into t1 values (4711);
-select * from t1;
-truncate t1;
-insert into t1 values (42);
-select * from t1;
-drop table t1;
-
-#
-# Bug #35392: Delete all statement does not execute properly after
-# few delete statements
-#
-CREATE TEMPORARY TABLE t1(a INT, b VARCHAR(20));
-INSERT INTO t1 VALUES(1, 'val1'), (2, 'val2'), (3, 'val3');
-DELETE FROM t1 WHERE a=1;
-SELECT count(*) FROM t1;
-DELETE FROM t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-#
-# Bug#41348: INSERT INTO tbl SELECT * FROM temp_tbl overwrites locking type of temp table
-#
-
---disable_warnings
-DROP TABLE IF EXISTS t1,t2;
-DROP FUNCTION IF EXISTS f1;
---enable_warnings
-
-CREATE TEMPORARY TABLE t1 (a INT);
-CREATE TEMPORARY TABLE t2 LIKE t1;
-
-DELIMITER |;
-CREATE FUNCTION f1() RETURNS INT
- BEGIN
- return 1;
- END|
-DELIMITER ;|
-
-INSERT INTO t2 SELECT * FROM t1;
-INSERT INTO t1 SELECT f1();
-
-CREATE TABLE t3 SELECT * FROM t1;
-INSERT INTO t1 SELECT f1();
-
-UPDATE t1,t2 SET t1.a = t2.a;
-INSERT INTO t2 SELECT f1();
-
-DROP TABLE t1,t2,t3;
-DROP FUNCTION f1;
-
---echo #
---echo # Bug #48067: A temp table with the same name as an existing table,
---echo # makes drop database fail.
---echo #
---disable_warnings
-DROP TEMPORARY TABLE IF EXISTS bug48067.t1;
-DROP DATABASE IF EXISTS bug48067;
---enable_warnings
-CREATE DATABASE bug48067;
-CREATE TABLE bug48067.t1 (c1 int);
-INSERT INTO bug48067.t1 values (1);
-CREATE TEMPORARY TABLE bug48067.t1 (c1 int);
-DROP DATABASE bug48067;
-DROP TEMPORARY table bug48067.t1;
-
---echo End of 5.1 tests
-
---echo #
---echo # Test that admin statements work for temporary tables.
---echo #
---disable_warnings
-DROP TABLE IF EXISTS t1,t2;
---enable_warnings
-CREATE TEMPORARY TABLE t1(a INT);
-CREATE TEMPORARY TABLE t2(b INT);
-CREATE TEMPORARY TABLE t3(c INT);
-
-INSERT INTO t1 VALUES (1), (2), (3);
-INSERT INTO t2 VALUES (11), (12), (13);
-INSERT INTO t3 VALUES (101), (102), (103);
-
-ANALYZE TABLE t1, t2, t3;
-
-INSERT INTO t1 VALUES (1), (2), (3);
-INSERT INTO t2 VALUES (11), (12), (13);
-INSERT INTO t3 VALUES (101), (102), (103);
-
-CHECK TABLE t1, t2, t3;
-
-INSERT INTO t1 VALUES (1), (2), (3);
-INSERT INTO t2 VALUES (11), (12), (13);
-INSERT INTO t3 VALUES (101), (102), (103);
-
---replace_column 2 xxx
-CHECKSUM TABLE t1, t2, t3;
-
-INSERT INTO t1 VALUES (1), (2), (3);
-INSERT INTO t2 VALUES (11), (12), (13);
-INSERT INTO t3 VALUES (101), (102), (103);
-
-OPTIMIZE TABLE t1, t2, t3;
-
-INSERT INTO t1 VALUES (1), (2), (3);
-INSERT INTO t2 VALUES (11), (12), (13);
-INSERT INTO t3 VALUES (101), (102), (103);
-
-REPAIR TABLE t1, t2, t3;
-
-DROP TABLES t1, t2, t3;
-
-CREATE TEMPORARY TABLE t1 (a int);
-RENAME TABLE t1 TO t2;
-DROP TABLE t2;
-
-#
-# CREATE TEMPORARY TEMPORARY TABLE
-#
---error ER_PARSE_ERROR
-create temporary temporary table t1 (a int);
-
-#
-# MDEV-7832 Add status variables to track CREATE TEMPORARY TABLE and DROP TEMPORARY TABLE
-#
-flush status;
-create table t1 (a int);
-create temporary table t2 (a int);
-create temporary table t3 (a int);
-drop table t1;
-drop table t2;
-drop temporary table t3;
-show status like 'com_create%table';
-show status like 'com_drop%table';
-
---echo #
---echo # Some more generic temporary table tests
---echo # added during MDEV-5535.
---echo #
-
---disable_warnings
-DROP DATABASE IF EXISTS temp_db;
---enable_warnings
-
-CREATE DATABASE temp_db;
-USE temp_db;
-
---echo #
---echo # SHOW TABLES do not list temporary tables.
---echo #
-
-CREATE TEMPORARY TABLE temp_t1(i INT) ENGINE=INNODB;
-INSERT INTO temp_t1 VALUES(1);
-SELECT * FROM temp_t1;
-SHOW TABLES;
-DROP TABLE temp_t1;
-
---echo #
---echo # Create and drop a temporary table.
---echo #
-
-CREATE TEMPORARY TABLE temp_t1(i INT) ENGINE=INNODB;
-INSERT INTO temp_t1 VALUES(1);
-SELECT * FROM temp_t1;
-DROP TABLE temp_t1;
---error ER_NO_SUCH_TABLE
-SELECT * FROM temp_t1;
-
---echo #
---echo # Create a temporary table and base table with same name and DROP TABLE.
---echo #
-
-CREATE TABLE t1(c1 VARCHAR(20)) ENGINE=INNODB;
-INSERT INTO t1 VALUES("BASE TABLE");
-# Temporary table shadows the base table with the same name.
-CREATE TEMPORARY TABLE t1(c1 VARCHAR(20)) ENGINE=INNODB;
-INSERT INTO t1 VALUES("TEMPORARY TABLE");
-SELECT * FROM t1;
-# Only temporary table should get dropped.
-DROP TABLE t1;
-SELECT * FROM t1;
-DROP TABLE t1;
---error ER_NO_SUCH_TABLE
-SELECT * FROM t1;
-
---echo #
---echo # Create a temporary table and base table with same name and DROP TEMPORARY
---echo # TABLE.
---echo #
-
-CREATE TABLE t1(c1 VARCHAR(20)) ENGINE=INNODB;
-INSERT INTO t1 VALUES("BASE TABLE");
-# Temporary table shadows the base table with the same name.
-CREATE TEMPORARY TABLE t1(c1 VARCHAR(20)) ENGINE=INNODB;
-INSERT INTO t1 VALUES("TEMPORARY TABLE");
-SELECT * FROM t1;
-# Only temporary table should get dropped.
-DROP TEMPORARY TABLE t1;
-SELECT * FROM t1;
---error ER_BAD_TABLE_ERROR
-DROP TEMPORARY TABLE t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Create a temporary table and drop its parent database.
---echo #
-
-USE temp_db;
-CREATE TEMPORARY TABLE temp_t1(i INT) ENGINE=INNODB;
-INSERT INTO temp_t1 VALUES (1);
-# Drop database
-DROP DATABASE temp_db;
-CREATE DATABASE temp_db;
-USE temp_db;
-# Temporary tables are not physically tied to schemas
-DROP TEMPORARY TABLE temp_t1;
-
---echo #
---echo # Similar to above, but this time with a base table with same name.
---echo #
-
-USE temp_db;
-CREATE TABLE t1(i INT)ENGINE=INNODB;
-CREATE TEMPORARY TABLE t1(i INT) ENGINE=INNODB;
-INSERT INTO t1 VALUES (1);
-# Drop database
-DROP DATABASE temp_db;
-CREATE DATABASE temp_db;
-USE temp_db;
-# Temporary tables are not physically tied to schemas
-DROP TEMPORARY TABLE t1;
---error ER_BAD_TABLE_ERROR
-DROP TABLE t1;
-
---echo #
---echo # Create a temporary table within a function.
---echo #
-
-USE temp_db;
-delimiter |;
-CREATE FUNCTION f1() RETURNS INT
-BEGIN
- DROP TEMPORARY TABLE IF EXISTS temp_t1;
- CREATE TEMPORARY TABLE temp_t1(i INT) ENGINE=INNODB;
- INSERT INTO `temp_t1` VALUES(1);
- RETURN (SELECT COUNT(*) FROM temp_t1);
-END|
-delimiter ;|
-
-SELECT f1();
-SELECT * FROM temp_t1;
-
-DROP TABLE temp_t1;
-CREATE TEMPORARY TABLE `temp_t1`(i INT) ENGINE=INNODB;
-SELECT f1();
-SELECT * FROM temp_t1;
-DROP FUNCTION f1;
-
---echo #
---echo # Create and drop a temporary table within a function.
---echo #
-
-delimiter |;
---error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
-CREATE FUNCTION f2() RETURNS INT
-BEGIN
- DROP TEMPORARY TABLE IF EXISTS temp_t1;
- CREATE TEMPORARY TABLE temp_t1(i INT) ENGINE=INNODB;
- INSERT INTO temp_t1 VALUES(1);
- DROP TABLE temp_t1;
- RETURN 0;
-END|
-
-CREATE FUNCTION f2() RETURNS INT
-BEGIN
- DROP TEMPORARY TABLE IF EXISTS temp_t1;
- CREATE TEMPORARY TABLE temp_t1(i INT) ENGINE=INNODB;
- INSERT INTO temp_t1 VALUES(1);
- DROP TEMPORARY TABLE temp_t1;
- RETURN 0;
-END|
-delimiter ;|
-SELECT f2();
-DROP FUNCTION f2;
-
---echo #
---echo # Create a temporary table within a function and select it from another
---echo # function.
---echo #
-
-delimiter |;
-CREATE FUNCTION f2() RETURNS INT
-BEGIN
- DROP TEMPORARY TABLE IF EXISTS temp_t1;
- CREATE TEMPORARY TABLE temp_t1 (i INT) ENGINE=INNODB;
- INSERT INTO temp_t1 VALUES (1);
- RETURN f2_1();
-END|
-
-CREATE FUNCTION f2_1() RETURNS INT
- RETURN (SELECT COUNT(*) FROM temp_t1)|
-delimiter ;|
-
-SELECT f2();
-DROP TEMPORARY TABLE temp_t1;
-DROP FUNCTION f2;
-
---echo #
---echo # Create temporary table like base table.
---echo #
-
-CREATE TABLE t1(i INT) ENGINE=INNODB;
-INSERT INTO t1 VALUES(1);
-CREATE TEMPORARY TABLE temp_t1 LIKE t1;
-SELECT * FROM temp_t1;
---error ER_NONUNIQ_TABLE
-CREATE TEMPORARY TABLE t1 LIKE t1;
-DROP TABLE temp_t1, t1;
-
---echo #
---echo # Create temporary table as base table.
---echo #
-
-CREATE TABLE t1(i INT) ENGINE=INNODB;
-INSERT INTO t1 VALUES(1);
-CREATE TEMPORARY TABLE temp_t1 AS SELECT * FROM t1;
-SELECT * FROM temp_t1;
-DROP TABLE temp_t1, t1;
-
---echo #
---echo # ALTER TABLE RENAME & ENABLE/DISABLE KEYS (shortcuts)
---echo #
-CREATE TEMPORARY TABLE t1(i INT PRIMARY KEY) ENGINE=MYISAM;
-INSERT INTO t1 VALUES(1);
-SELECT COUNT(*)=1 FROM t1;
-
-ALTER TABLE t1 RENAME t2;
-SELECT COUNT(*)=1 FROM t2;
-ALTER TABLE t2 RENAME t1;
-
-ALTER TABLE t1 DISABLE KEYS;
-ALTER TABLE t1 ENABLE KEYS;
-
-# LOCK TABLES is ignored for temporary tables.
-LOCK TABLES t1 WRITE;
-ALTER TABLE t1 RENAME t2;
-SELECT COUNT(*)=1 FROM t2;
-ALTER TABLE t2 RENAME t1;
-ALTER TABLE t1 DISABLE KEYS;
-ALTER TABLE t1 ENABLE KEYS;
-UNLOCK TABLES;
-
-LOCK TABLES t1 READ;
-ALTER TABLE t1 RENAME t2;
-SELECT COUNT(*)=1 FROM t2;
-ALTER TABLE t2 RENAME t1;
-ALTER TABLE t1 DISABLE KEYS;
-ALTER TABLE t1 ENABLE KEYS;
-UNLOCK TABLES;
-
-FLUSH TABLES WITH READ LOCK;
-ALTER TABLE t1 RENAME t2;
-SELECT COUNT(*)=1 FROM t2;
-ALTER TABLE t2 RENAME t1;
-ALTER TABLE t1 DISABLE KEYS;
-ALTER TABLE t1 ENABLE KEYS;
-UNLOCK TABLES;
-
-ALTER TABLE t1 RENAME t2, LOCK SHARED;
-ALTER TABLE t2 RENAME t1, LOCK EXCLUSIVE;
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-10792: Assertion `thd->mdl_context.is_lock_owner
---echo # (MDL_key::TABLE, table->db, table->table_name, MDL_SHARED)'
---echo # failed in mysql_rm_table_no_locks
---echo #
-CREATE TEMPORARY TABLE t1 (i INT);
---error ER_BAD_TABLE_ERROR
-DROP TABLE nonexisting_table, t1;
-
---echo # Cleanup
-DROP DATABASE temp_db;
-
diff --git a/mysql-test/t/temp_table_frm.test b/mysql-test/t/temp_table_frm.test
deleted file mode 100644
index 178bd15004b..00000000000
--- a/mysql-test/t/temp_table_frm.test
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# MDEV-4260 Don't create frm files for temporary tables
-#
-
-# Ensure we don't overflow the internal heap table size in the join
-set @@session.max_heap_table_size=16*1024*1024;
-create table t1 select * from information_schema.session_status where variable_name like 'Opened%';
-create temporary table t2 (a int) engine=memory;
-select variable_name, session_status.variable_value - t1.variable_value
-from information_schema.session_status join t1 using (variable_name);
-let $tmpdir= `select @@tmpdir`;
---list_files $tmpdir/ #sql*
-truncate table t2;
-select variable_name, session_status.variable_value - t1.variable_value
-from information_schema.session_status join t1 using (variable_name);
-drop table t1;
diff --git a/mysql-test/t/temporal_literal.test b/mysql-test/t/temporal_literal.test
deleted file mode 100644
index 6783b19a7d4..00000000000
--- a/mysql-test/t/temporal_literal.test
+++ /dev/null
@@ -1,346 +0,0 @@
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-SET NAMES latin1;
-
-
---echo #
---echo # Testing DATE literals
---echo #
---error ER_WRONG_VALUE
-SELECT DATE'xxxx';
---error ER_WRONG_VALUE
-SELECT DATE'01';
---error ER_WRONG_VALUE
-SELECT DATE'01-01';
---error ER_WRONG_VALUE
-SELECT DATE'2001';
---error ER_WRONG_VALUE
-SELECT DATE'2001-01';
-SELECT DATE'2001-00-00';
-SELECT DATE'2001-01-00';
-SELECT DATE'0000-00-00';
---error ER_WRONG_VALUE
-SELECT DATE'2001-01-01 00:00:00';
-SELECT DATE'01:01:01';
-SELECT DATE'01-01-01';
-SELECT DATE'2010-01-01';
-SELECT DATE '2010-01-01';
-CREATE TABLE t1 AS SELECT DATE'2010-01-01';
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-CREATE TABLE t1 AS SELECT
- {d'2001-01-01'},
- { d '2001-01-01' },
- {d'2001-01-01 10:10:10'};
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-EXPLAIN EXTENDED SELECT {d'2010-01-01'};
-EXPLAIN EXTENDED SELECT DATE'2010-01-01';
-
---echo #
---echo # Testing DATE literals in non-default sql_mode
---echo #
-SET sql_mode=no_zero_in_date;
---error ER_WRONG_VALUE
-SELECT DATE'2001-00-00';
---error ER_WRONG_VALUE
-SELECT DATE'2001-01-00';
-SELECT DATE'0000-00-00';
-
-SET sql_mode=no_zero_date;
---error ER_WRONG_VALUE
-SELECT DATE'0000-00-00';
-SET sql_mode=default;
-
---echo #
---echo # Testing TIME literals
---echo #
---error ER_WRONG_VALUE
-SELECT TIME'xxxx';
---error ER_WRONG_VALUE
-SELECT TIME'900:00:00';
---error ER_WRONG_VALUE
-SELECT TIME'-900:00:00';
-SELECT TIME'1 24:00:00';
-SELECT TIME'30 24:00:00';
---error ER_WRONG_VALUE
-SELECT TIME'0000-00-00 00:00:00';
---error ER_WRONG_VALUE
-SELECT TIME'40 24:00:00';
-SELECT TIME'10';
-SELECT TIME'10:10';
-SELECT TIME'10:11.12';
-SELECT TIME'10:10:10';
-SELECT TIME'10:10:10.';
-SELECT TIME'10:10:10.1';
-SELECT TIME'10:10:10.12';
-SELECT TIME'10:10:10.123';
-SELECT TIME'10:10:10.1234';
-SELECT TIME'10:10:10.12345';
-SELECT TIME'10:10:10.123456';
-SELECT TIME'-10:00:00';
-SELECT TIME '10:11:12';
-CREATE TABLE t1 AS SELECT
- TIME'10:10:10',
- TIME'10:10:10.',
- TIME'10:10:10.1',
- TIME'10:10:10.12',
- TIME'10:10:10.123',
- TIME'10:10:10.1234',
- TIME'10:10:10.12345',
- TIME'10:10:10.123456';
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-CREATE TABLE t1 AS SELECT
- {t'10:10:10'},
- { t '10:10:10' },
- {t'10:10:10.'},
- {t'10:10:10.123456'},
- {t'2001-01-01'};
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-EXPLAIN EXTENDED SELECT {t'10:01:01'};
-EXPLAIN EXTENDED SELECT TIME'10:01:01';
-
-
---echo #
---echo # Testing TIMESTAMP literals
---echo #
---error ER_WRONG_VALUE
-SELECT TIMESTAMP'xxxx';
---error ER_WRONG_VALUE
-SELECT TIMESTAMP'2010';
---error ER_WRONG_VALUE
-SELECT TIMESTAMP'2010-01';
---error ER_WRONG_VALUE
-SELECT TIMESTAMP'2010-01-01';
-SELECT TIMESTAMP'2010-01-01 00';
-SELECT TIMESTAMP'2010-01-01 00:01';
-SELECT TIMESTAMP'2010-01-01 10:10:10';
-SELECT TIMESTAMP'2010-01-01 10:10:10.';
-SELECT TIMESTAMP'2010-01-01 10:10:10.1';
-SELECT TIMESTAMP'2010-01-01 10:10:10.12';
-SELECT TIMESTAMP'2010-01-01 10:10:10.123';
-SELECT TIMESTAMP'2010-01-01 10:10:10.1234';
-SELECT TIMESTAMP'2010-01-01 10:10:10.12345';
-SELECT TIMESTAMP'2010-01-01 10:10:10.123456';
-SELECT TIMESTAMP '2010-01-01 10:20:30';
-CREATE TABLE t1 AS SELECT
- TIMESTAMP'2010-01-01 10:10:10',
- TIMESTAMP'2010-01-01 10:10:10.',
- TIMESTAMP'2010-01-01 10:10:10.1',
- TIMESTAMP'2010-01-01 10:10:10.12',
- TIMESTAMP'2010-01-01 10:10:10.123',
- TIMESTAMP'2010-01-01 10:10:10.1234',
- TIMESTAMP'2010-01-01 10:10:10.12345',
- TIMESTAMP'2010-01-01 10:10:10.123456';
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-CREATE TABLE t1 AS SELECT
- {ts'2001-01-01 10:10:10'},
- { ts '2001-01-01 10:10:10' },
- {ts'2001-01-01 10:10:10.'},
- {ts'2001-01-01 10:10:10.123456'},
- {ts'2001-01-01'};
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-EXPLAIN EXTENDED SELECT {ts'2010-01-01 10:10:10'};
-EXPLAIN EXTENDED SELECT TIMESTAMP'2010-01-01 10:10:10';
-
---echo #
---echo # Testing nanosecond rounding for TIMESTAMP literals with bad dates
---echo #
-SELECT TIMESTAMP'2001-00-00 00:00:00.999999';
-SELECT TIMESTAMP'2001-00-01 00:00:00.999999';
-SELECT TIMESTAMP'2001-01-00 00:00:00.999999';
---disable_ps_protocol
-SELECT TIMESTAMP'2001-00-00 00:00:00.9999999';
-SELECT TIMESTAMP'2001-00-01 00:00:00.9999999';
-SELECT TIMESTAMP'2001-01-00 00:00:00.9999999';
---enable_ps_protocol
-
---echo #
---echo # String literal with bad dates and nanoseconds to DATETIME(N)
---echo #
-CREATE TABLE t1 (a DATETIME(6));
-INSERT INTO t1 VALUES ('2001-00-00 00:00:00.9999999');
-INSERT INTO t1 VALUES ('2001-00-01 00:00:00.9999999');
-INSERT INTO t1 VALUES ('2001-01-00 00:00:00.9999999');
-SELECT * FROM t1;
-DROP TABLE t1;
-CREATE TABLE t1 (a DATETIME(5));
-INSERT INTO t1 VALUES ('2001-00-00 00:00:00.9999999');
-INSERT INTO t1 VALUES ('2001-00-01 00:00:00.9999999');
-INSERT INTO t1 VALUES ('2001-01-00 00:00:00.9999999');
-SELECT * FROM t1;
-DROP TABLE t1;
-CREATE TABLE t1 (a DATETIME);
-INSERT INTO t1 VALUES ('2001-00-00 00:00:00.9999999');
-INSERT INTO t1 VALUES ('2001-00-01 00:00:00.9999999');
-INSERT INTO t1 VALUES ('2001-01-00 00:00:00.9999999');
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Testing Item_date_literal::eq
---echo #
-CREATE TABLE t1 (a DATE);
-INSERT INTO t1 VALUES ('2001-01-01'),('2003-01-01');
-SELECT * FROM t1 WHERE a BETWEEN DATE'2001-01-01' AND DATE'2002-01-01';
-SELECT DATE'2001-01-01' FROM t1 GROUP BY DATE'2001-01-01';
-DROP TABLE t1;
-
---echo #
---echo # TIME literals in no-zero date context
---echo #
-SET timestamp=unix_timestamp('2001-02-03 10:20:30');
-SELECT TO_DAYS(TIME'00:00:00');
-SELECT TO_SECONDS(TIME'00:00:00');
-SELECT DAYOFYEAR(TIME'00:00:00');
-SELECT WEEK(TIME'00:00:00');
-SELECT YEARWEEK(TIME'00:00:00');
-SELECT WEEKDAY(TIME'00:00:00');
-SELECT CONVERT_TZ(TIME'00:00:00','+00:00','+01:00');
-SELECT DATE_ADD(TIME'00:00:00', INTERVAL 1 HOUR);
-SELECT TIMESTAMPDIFF(SECOND,TIME'00:00:00', TIME'00:00:00');
-SET timestamp=DEFAULT;
-
---echo #
---echo # Testing Item_func::fix_fields()
---echo #
---error ER_WRONG_ARGUMENTS
-SELECT 'a' LIKE 'a' ESCAPE DATE'2001-01-01';
---error ER_WRONG_ARGUMENTS
-SELECT 'a' LIKE 'a' ESCAPE TIMESTAMP'2001-01-01 00:00:00';
---error ER_WRONG_ARGUMENTS
-SELECT 'a' LIKE 'a' ESCAPE TIME'00:00:00';
-
---echo #
---echo # MDEV-4871 Temporal literals do not accept nanoseconds
---echo #
---disable_ps_protocol
-SELECT TIME'10:10:10.1234567';
---enable_ps_protocol
-SELECT TIME('10:10:10.1234567');
---error ER_WRONG_VALUE
-SELECT TIME'10:10:10.123456xyz';
---error ER_WRONG_VALUE
-SELECT TIME'10:10:10.1234567xyz';
-SELECT TIME('10:10:10.123456xyz');
-SELECT TIME('10:10:10.1234567xyz');
-
---disable_ps_protocol
-SELECT TIMESTAMP'2001-01-01 10:10:10.1234567';
---enable_ps_protocol
-SELECT TIMESTAMP('2001-01-01 10:10:10.1234567');
---error ER_WRONG_VALUE
-SELECT TIMESTAMP'2001-01-01 10:10:10.123456xyz';
---error ER_WRONG_VALUE
-SELECT TIMESTAMP'2001-01-01 10:10:10.1234567xyz';
-SELECT TIMESTAMP('2001-01-01 10:10:10.123456xyz');
-SELECT TIMESTAMP('2001-01-01 10:10:10.1234567xyz');
-
-CREATE TABLE t1 (a TIME(6));
-INSERT INTO t1 VALUES (TIME'10:20:30.1234567');
-INSERT INTO t1 VALUES (TIME('10:20:30.1234567'));
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-5969 Crash in prepared statement with NO_ZERO_IN_DATE and ROLLUP
---echo #
-CREATE TABLE t1
-(
- year INT NOT NULL,
- product VARCHAR(32) NOT NULL,
- profit INT
-);
-INSERT INTO t1 VALUES ('2001','car',101);
-INSERT INTO t1 VALUES ('2001','gas',102);
-INSERT INTO t1 VALUES ('2001','toy',103);
-INSERT INTO t1 VALUES ('2002','car',201);
-INSERT INTO t1 VALUES ('2002','gas',202);
-INSERT INTO t1 VALUES ('2002','toy',203);
-SET sql_mode=DEFAULT;
-PREPARE stmt FROM "SELECT DATE'2001-00-00' AS c,year, SUM(profit) FROM t1 GROUP BY c,year WITH ROLLUP";
-EXECUTE stmt;
-SET sql_mode='no_zero_in_date';
-EXECUTE stmt;
-SET sql_mode=DEFAULT;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-5971 Asymmetry between CAST(DATE'2001-00-00') to INT and TO CHAR in prepared statements
---echo #
-SET sql_mode=DEFAULT;
-PREPARE stmt FROM "SELECT CAST(DATE'2001-00-00' AS SIGNED) AS c";
-SET sql_mode='no_zero_in_date';
-EXECUTE stmt;
-SET sql_mode=DEFAULT;
-PREPARE stmt FROM "SELECT CAST(DATE'2001-00-00' AS CHAR) AS c";
-SET sql_mode='no_zero_in_date';
-EXECUTE stmt;
-SET sql_mode=DEFAULT;
-PREPARE stmt FROM "SELECT CAST(DATE'2001-00-00' AS DECIMAL(30,0)) AS c";
-SET sql_mode='no_zero_in_date';
-EXECUTE stmt;
-SET sql_mode=DEFAULT;
-PREPARE stmt FROM "SELECT CAST(DATE'2001-00-00' AS DOUBLE) AS c";
-SET sql_mode='no_zero_in_date';
-EXECUTE stmt;
-
---echo #
---echo # Zero month or zero day automatically mean NULL flag, no matter SQL_MODE is.
---echo # Only zero year is OK for NOT NULL.
---echo #
-
-SET sql_mode=DEFAULT;
-PREPARE stmt FROM "CREATE TABLE t1 AS SELECT CAST(DATE'2001-00-00' AS CHAR) AS c";
-EXECUTE stmt;
-SHOW COLUMNS FROM t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-SET sql_mode='no_zero_in_date';
-EXECUTE stmt;
-SHOW COLUMNS FROM t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-SET sql_mode=DEFAULT;
-
-CREATE TABLE t1 AS SELECT
- DATE'2001-01-01',
- DATE'0000-01-01',
- DATE'2001-00-00',
- DATE'2001-00-01',
- DATE'2001-01-00';
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 AS SELECT
- TIMESTAMP'2001-01-01 00:00:00',
- TIMESTAMP'0000-01-01 00:00:00',
- TIMESTAMP'2001-00-00 00:00:00',
- TIMESTAMP'2001-00-01 00:00:00',
- TIMESTAMP'2001-01-00 00:00:00';
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-5975 Prepared statements with DATE literals do not honor NO_ZERO_IN_DATE
---echo #
-SET sql_mode=DEFAULT;
-PREPARE stmt FROM "SELECT (SELECT DATE'2001-00-00') AS c";
-EXECUTE stmt;
-SET sql_mode='no_zero_in_date';
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-
-SET sql_mode=DEFAULT;
-PREPARE stmt FROM "SELECT (SELECT TIMESTAMP'2001-00-00 10:20:30') AS c";
-EXECUTE stmt;
-SET sql_mode='no_zero_in_date';
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-SET sql_mode=DEFAULT;
diff --git a/mysql-test/t/temporal_scale_4283.test b/mysql-test/t/temporal_scale_4283.test
deleted file mode 100644
index d79ca7caa54..00000000000
--- a/mysql-test/t/temporal_scale_4283.test
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# MDEV-4283 Assertion `scale <= precision' fails in strings/decimal.c
-#
-create table t1 (a int);
-insert into t1 values (4),(8);
-select distinct 100 mod timestampadd( week, a, '2002-05-20' ) from t1;
-drop table t1;
-
-create table t1 (i int);
-insert into t1 values (2),(4);
-select distinct convert_tz( '2001-03-21', 'utc', 'met' ) mod i from t1;
-drop table t1;
-
diff --git a/mysql-test/t/thread_id_overflow.test b/mysql-test/t/thread_id_overflow.test
deleted file mode 100644
index e93e14f4284..00000000000
--- a/mysql-test/t/thread_id_overflow.test
+++ /dev/null
@@ -1,35 +0,0 @@
-# test 32bit overflow with connection id
---source include/have_debug.inc
-
-
-# Connect and disconnect once, to create a "hole" in connection ids
-connect con1, localhost,root;
-disconnect con1;
-
-connect con2, localhost,root;
-connection con2;
-
-connection default;
-let $max_id = `SELECT MAX(ID) FROM INFORMATION_SCHEMA.PROCESSLIST`;
-
-SET @orig_debug=@@debug_dbug;
-SET GLOBAL DEBUG_DBUG='+d,thread_id_overflow';
-
-connect con3, localhost,root;
-connection con3;
-# next line gives UINT32_MAX -1;
-SELECT CONNECTION_ID();
-
-connection default;
-SET GLOBAL DEBUG_DBUG=@orig_debug;
-
-connect con4, localhost,root;
-connection con4;
---replace_result $max_id max_id
-eval select IF(connection_id() - $max_id = 1,'Good','Bad') as result;
-
-disconnect con4;
-disconnect con3;
-disconnect con2;
-
-connection default;
diff --git a/mysql-test/t/timeout.test b/mysql-test/t/timeout.test
deleted file mode 100644
index 9f6e692b148..00000000000
--- a/mysql-test/t/timeout.test
+++ /dev/null
@@ -1,60 +0,0 @@
---echo #
---echo # MDEV-11379 - AliSQL: [Feature] Issue#8: SELECT FOR UPDATE WAIT
---echo # MDEV-11388 - AliSQL: [Feature] Issue#15 DDL FAST FAIL
---echo #
-CREATE TABLE t1(a INT, b TEXT, c MULTIPOLYGON NOT NULL);
-CREATE INDEX i1 ON t1(a) WAIT 1;
-CREATE FULLTEXT INDEX i2 ON t1(b) WAIT 1;
-CREATE SPATIAL INDEX i3 ON t1(c) WAIT 1;
-ALTER TABLE t1 WAIT 1 COMMENT='test';
-OPTIMIZE TABLE t1 WAIT 1;
-DROP INDEX i1 ON t1 WAIT 1;
-TRUNCATE TABLE t1 WAIT 1;
-RENAME TABLE t1 WAIT 1 TO t2;
-RENAME TABLE t2 NOWAIT TO t1;
-
-connect(con1, localhost, root,,);
-LOCK TABLE t1 WRITE WAIT 31536001;
-
-connection default;
---error ER_LOCK_WAIT_TIMEOUT
-CREATE INDEX i1 ON t1(a) WAIT 0;
---error ER_LOCK_WAIT_TIMEOUT
-CREATE INDEX i1 ON t1(a) NOWAIT;
---error ER_LOCK_WAIT_TIMEOUT
-CREATE FULLTEXT INDEX i2 ON t1(b) WAIT 0;
---error ER_LOCK_WAIT_TIMEOUT
-CREATE FULLTEXT INDEX i2 ON t1(b) NOWAIT;
---error ER_LOCK_WAIT_TIMEOUT
-CREATE SPATIAL INDEX i3 ON t1(c) WAIT 0;
---error ER_LOCK_WAIT_TIMEOUT
-CREATE SPATIAL INDEX i3 ON t1(c) NOWAIT;
---error ER_LOCK_WAIT_TIMEOUT
-ALTER TABLE t1 WAIT 0 COMMENT='test';
---error ER_LOCK_WAIT_TIMEOUT
-ALTER TABLE t1 NOWAIT COMMENT='test';
-OPTIMIZE TABLE t1 WAIT 0;
-OPTIMIZE TABLE t1 NOWAIT;
---error ER_LOCK_WAIT_TIMEOUT
-DROP INDEX i1 ON t1 WAIT 0;
---error ER_LOCK_WAIT_TIMEOUT
-DROP INDEX i1 ON t1 NOWAIT;
---error ER_LOCK_WAIT_TIMEOUT
-TRUNCATE TABLE t1 WAIT 0;
---error ER_LOCK_WAIT_TIMEOUT
-TRUNCATE TABLE t1 NOWAIT;
---error ER_LOCK_WAIT_TIMEOUT
-RENAME TABLE t1 WAIT 0 TO t2;
---error ER_LOCK_WAIT_TIMEOUT
-RENAME TABLE t1 NOWAIT TO t2;
---error ER_LOCK_WAIT_TIMEOUT
-DROP TABLE t1 WAIT 0;
---error ER_LOCK_WAIT_TIMEOUT
-DROP TABLE t1 NOWAIT;
---error ER_LOCK_WAIT_TIMEOUT
-LOCK TABLE t1 WRITE WAIT 0;
---error ER_LOCK_WAIT_TIMEOUT
-LOCK TABLE t1 WRITE NOWAIT;
-
-disconnect con1;
-DROP TABLE t1 WAIT 1;
diff --git a/mysql-test/t/timezone-master.opt b/mysql-test/t/timezone-master.opt
deleted file mode 100644
index 0477f941e9d..00000000000
--- a/mysql-test/t/timezone-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---timezone=MET
diff --git a/mysql-test/t/timezone.test b/mysql-test/t/timezone.test
deleted file mode 100644
index a41e806a40e..00000000000
--- a/mysql-test/t/timezone.test
+++ /dev/null
@@ -1,65 +0,0 @@
-#
-# Test of SYSTEM time zone handling ( for my_system_gmt_sec()).
-# This script must be run with TZ=MET
-
--- require r/have_met_timezone.require
-disable_query_log;
-select FROM_UNIXTIME(24*3600);
-enable_query_log;
-
-# Initialization
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-# The following is because of daylight saving time
---replace_result MEST MET
-show variables like "system_time_zone";
-
-#
-# Test unix timestamp
-#
-select @a:=FROM_UNIXTIME(1);
-select unix_timestamp(@a);
-
-#
-# Test of some values, including some with daylight saving time
-#
-
-CREATE TABLE t1 (ts int);
-INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 01:00'));
-INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 02:00'));
-INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 03:00'));
-INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 02:00'));
-INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 01:00'));
-INSERT INTO t1 (ts) VALUES (Unix_timestamp('2002-10-27 02:00'));
-INSERT INTO t1 (ts) VALUES (Unix_timestamp('2003-03-30 02:59:59'));
-INSERT INTO t1 (ts) VALUES (Unix_timestamp('2003-03-30 03:00:00'));
-INSERT INTO t1 (ts) VALUES (Unix_timestamp('2003-03-30 03:59:59'));
-INSERT INTO t1 (ts) VALUES (Unix_timestamp('2003-03-30 04:00:01'));
-
-SELECT ts,from_unixtime(ts) FROM t1;
-DROP TABLE t1;
-
-
-#
-# Test of warning for spring time-gap values for system time zone
-#
-CREATE TABLE t1 (ts timestamp);
-INSERT INTO t1 (ts) VALUES ('2003-03-30 01:59:59'),
- ('2003-03-30 02:59:59'),
- ('2003-03-30 03:00:00');
-DROP TABLE t1;
-
-#
-# Test for fix for Bug#2523 Check that boundary dates are processed
-# correctly.
-#
-select unix_timestamp('1970-01-01 01:00:00'),
- unix_timestamp('1970-01-01 01:00:01'),
- unix_timestamp('2038-01-19 04:14:07'),
- unix_timestamp('2038-01-19 04:14:08');
-
-select unix_timestamp('1969-12-31 23:59:59'), unix_timestamp('1970-01-01 00:00:00'), unix_timestamp('1970-01-01 00:59:59');
-
-# End of 4.1 tests
diff --git a/mysql-test/t/timezone2.test b/mysql-test/t/timezone2.test
deleted file mode 100644
index 7a38610ad95..00000000000
--- a/mysql-test/t/timezone2.test
+++ /dev/null
@@ -1,310 +0,0 @@
-# This script tests our own time zone support functions
-
-# Preparing playground
---disable_warnings
-drop table if exists t1, t2;
-drop function if exists f1;
---enable_warnings
-
-
-#
-# Let us first check +HH:MM style timezones
-#
-create table t1 (ts timestamp);
-
-set time_zone='+00:00';
-select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp());
-insert into t1 (ts) values ('2003-03-30 02:30:00');
-
-set time_zone='+10:30';
-select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp());
-insert into t1 (ts) values ('2003-03-30 02:30:00');
-
-set time_zone='-10:00';
-select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp());
-insert into t1 (ts) values ('2003-03-30 02:30:00');
-
-# Here we will get different results
-select * from t1;
-
-drop table t1;
-
-
-#
-# Let us try DB specified time zones
-#
-select Name from mysql.time_zone_name where Name in
- ('UTC','Universal','MET','Europe/Moscow','leap/Europe/Moscow');
-
-create table t1 (i int, ts timestamp);
-
-set time_zone='MET';
-
-# We check common date time value and non existent or ambiguios values
-# Normal value without DST
-insert into t1 (i, ts) values
- (unix_timestamp('2003-03-01 00:00:00'),'2003-03-01 00:00:00');
-# Values around and in spring time-gap
-insert into t1 (i, ts) values
- (unix_timestamp('2003-03-30 01:59:59'),'2003-03-30 01:59:59'),
- (unix_timestamp('2003-03-30 02:30:00'),'2003-03-30 02:30:00'),
- (unix_timestamp('2003-03-30 03:00:00'),'2003-03-30 03:00:00');
-# Values around and in spring time-gap
-insert into t1 (i, ts) values
- (unix_timestamp(20030330015959),20030330015959),
- (unix_timestamp(20030330023000),20030330023000),
- (unix_timestamp(20030330030000),20030330030000);
-# Normal value with DST
-insert into t1 (i, ts) values
- (unix_timestamp('2003-05-01 00:00:00'),'2003-05-01 00:00:00');
-# Ambiguos values (also check for determenism)
-insert into t1 (i, ts) values
- (unix_timestamp('2003-10-26 01:00:00'),'2003-10-26 01:00:00'),
- (unix_timestamp('2003-10-26 02:00:00'),'2003-10-26 02:00:00'),
- (unix_timestamp('2003-10-26 02:59:59'),'2003-10-26 02:59:59'),
- (unix_timestamp('2003-10-26 04:00:00'),'2003-10-26 04:00:00'),
- (unix_timestamp('2003-10-26 02:59:59'),'2003-10-26 02:59:59');
-
-set time_zone='UTC';
-
-select * from t1;
-
-truncate table t1;
-
-# Simple check for 'Europe/Moscow' time zone just for showing that it works
-set time_zone='Europe/Moscow';
-insert into t1 (i, ts) values
- (unix_timestamp('2004-01-01 00:00:00'),'2004-01-01 00:00:00'),
- (unix_timestamp('2004-03-28 02:30:00'),'2004-03-28 02:30:00'),
- (unix_timestamp('2004-08-01 00:00:00'),'2003-08-01 00:00:00'),
- (unix_timestamp('2004-10-31 02:30:00'),'2004-10-31 02:30:00');
-select * from t1;
-truncate table t1;
-
-
-#
-# Check for time zone with leap seconds
-# Values in ts column must be the same but values in i column should
-# differ from corresponding values for Europe/Moscow a bit.
-#
-set time_zone='leap/Europe/Moscow';
-insert into t1 (i, ts) values
- (unix_timestamp('2004-01-01 00:00:00'),'2004-01-01 00:00:00'),
- (unix_timestamp('2004-03-28 02:30:00'),'2004-03-28 02:30:00'),
- (unix_timestamp('2004-08-01 00:00:00'),'2003-08-01 00:00:00'),
- (unix_timestamp('2004-10-31 02:30:00'),'2004-10-31 02:30:00');
-select * from t1;
-truncate table t1;
-# Let us test leap jump
-insert into t1 (i, ts) values
- (unix_timestamp('1981-07-01 03:59:59'),'1981-07-01 03:59:59'),
- (unix_timestamp('1981-07-01 04:00:00'),'1981-07-01 04:00:00');
-select * from t1;
-# Additional 60ieth second!
-select from_unixtime(362793609);
-
-drop table t1;
-
-
-#
-# Let us test range for TIMESTAMP
-#
-create table t1 (ts timestamp);
-set time_zone='UTC';
-insert into t1 values ('0000-00-00 00:00:00'),('1969-12-31 23:59:59'),
- ('1970-01-01 00:00:00'),('1970-01-01 00:00:01'),
- ('2038-01-19 03:14:07'),('2038-01-19 03:14:08');
-select * from t1;
-truncate table t1;
-# MET time zone has range shifted by one hour
-set time_zone='MET';
-insert into t1 values ('0000-00-00 00:00:00'),('1970-01-01 00:30:00'),
- ('1970-01-01 01:00:00'),('1970-01-01 01:00:01'),
- ('2038-01-19 04:14:07'),('2038-01-19 04:14:08');
-select * from t1;
-truncate table t1;
-# same for +01:30 time zone
-set time_zone='+01:30';
-insert into t1 values ('0000-00-00 00:00:00'),('1970-01-01 01:00:00'),
- ('1970-01-01 01:30:00'),('1970-01-01 01:30:01'),
- ('2038-01-19 04:44:07'),('2038-01-19 04:44:08');
-select * from t1;
-
-drop table t1;
-
-
-#
-# Test of show variables
-#
-show variables like 'time_zone';
-set time_zone = default;
-show variables like 'time_zone';
-
-
-#
-# Let us try some invalid time zone specifications
-#
---error 1298
-set time_zone= '0';
---error 1298
-set time_zone= '0:0';
---error 1298
-set time_zone= '-20:00';
---error 1298
-set time_zone= '+20:00';
---error 1298
-set time_zone= 'Some/Unknown/Time/Zone';
-
-
-# Let us check that aliases for time zones work and they are
-# case-insensitive
-select convert_tz(now(),'UTC', 'Universal') = now();
-select convert_tz(now(),'utc', 'UTC') = now();
-
-
-#
-# Let us test CONVERT_TZ function (may be func_time.test is better place).
-#
-select convert_tz('1917-11-07 12:00:00', 'MET', 'UTC');
-select convert_tz('1970-01-01 01:00:00', 'MET', 'UTC');
-select convert_tz('1970-01-01 01:00:01', 'MET', 'UTC');
-select convert_tz('2003-03-01 00:00:00', 'MET', 'UTC');
-select convert_tz('2003-03-30 01:59:59', 'MET', 'UTC');
-select convert_tz('2003-03-30 02:30:00', 'MET', 'UTC');
-select convert_tz('2003-03-30 03:00:00', 'MET', 'UTC');
-select convert_tz('2003-05-01 00:00:00', 'MET', 'UTC');
-select convert_tz('2003-10-26 01:00:00', 'MET', 'UTC');
-select convert_tz('2003-10-26 02:00:00', 'MET', 'UTC');
-select convert_tz('2003-10-26 02:59:59', 'MET', 'UTC');
-select convert_tz('2003-10-26 04:00:00', 'MET', 'UTC');
-select convert_tz('2038-01-19 04:14:07', 'MET', 'UTC');
-select convert_tz('2038-01-19 04:14:08', 'MET', 'UTC');
-select convert_tz('2103-01-01 04:00:00', 'MET', 'UTC');
-
-# Let us test variable time zone argument
-create table t1 (tz varchar(3));
-insert into t1 (tz) values ('MET'), ('UTC');
-select tz, convert_tz('2003-12-31 00:00:00',tz,'UTC'), convert_tz('2003-12-31 00:00:00','UTC',tz) from t1 order by tz;
-drop table t1;
-
-# Parameters to CONVERT_TZ() what should give NULL
-select convert_tz('2003-12-31 04:00:00', NULL, 'UTC');
-select convert_tz('2003-12-31 04:00:00', 'SomeNotExistingTimeZone', 'UTC');
-select convert_tz('2003-12-31 04:00:00', 'MET', 'SomeNotExistingTimeZone');
-select convert_tz('2003-12-31 04:00:00', 'MET', NULL);
-select convert_tz( NULL, 'MET', 'UTC');
-
-#
-# Test for bug #4508 "CONVERT_TZ() function with new time zone as param
-# crashes server." (Was caused by improperly worked mechanism of time zone
-# dynamical loading).
-#
-create table t1 (ts timestamp);
-set timestamp=1000000000;
-insert into t1 (ts) values (now());
-select convert_tz(ts, @@time_zone, 'Japan') from t1;
-drop table t1;
-
-#
-# Test for bug #7705 "CONVERT_TZ() crashes with subquery/WHERE on index
-# column". Queries in which one of time zone arguments of CONVERT_TZ() is
-# determined as constant only at val() stage (not at fix_fields() stage),
-# should not crash server.
-#
-select convert_tz('2005-01-14 17:00:00', 'UTC', custTimeZone) from (select 'UTC' as custTimeZone) as tmp;
-
-#
-# Test for bug #7899 "CREATE TABLE .. SELECT .. and CONVERT_TZ() function
-# does not work well together". The following statement should return only
-# one NULL row and not result of full join.
-#
-create table t1 select convert_tz(NULL, NULL, NULL);
-select * from t1;
-drop table t1;
-
-# End of 4.1 tests
-
-#
-# Test for bug #11081 "Using a CONVERT_TZ function in a stored function
-# or trigger fails".
-#
-SET @old_log_bin_trust_function_creators = @@global.log_bin_trust_function_creators;
-SET GLOBAL log_bin_trust_function_creators = 1;
-
-create table t1 (ldt datetime, udt datetime);
-create function f1(i datetime) returns datetime
- return convert_tz(i, 'UTC', 'Europe/Moscow');
-create trigger t1_bi before insert on t1 for each row
- set new.udt:= convert_tz(new.ldt, 'Europe/Moscow', 'UTC');
-# This should work without errors
-insert into t1 (ldt) values ('2006-04-19 16:30:00');
-select * from t1;
-# This should work without errors as well
-select ldt, f1(udt) as ldt2 from t1;
-drop table t1;
-drop function f1;
-
-SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
-
-# End of 5.0 tests
-
-
-#
-# BUG#9953: CONVERT_TZ requires mysql.time_zone_name to be locked
-# BUG#19339: CONVERT_TZ(): overly aggressive in locking time_zone_name
-# table
-#
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (t TIMESTAMP);
-INSERT INTO t1 VALUES (NULL), (NULL);
-
-LOCK TABLES t1 WRITE;
-
-# The following two queries should not return error that time zone
-# tables aren't locked. We use IS NULL below to supress timestamp
-# result.
-SELECT CONVERT_TZ(NOW(), 'UTC', 'Europe/Moscow') IS NULL;
-UPDATE t1 SET t = CONVERT_TZ(t, 'UTC', 'Europe/Moscow');
-
-UNLOCK TABLES;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug #55424: convert_tz crashes when fed invalid data
---echo #
-
-CREATE TABLE t1 (a SET('x') NOT NULL);
-INSERT INTO t1 VALUES ('');
-SELECT CONVERT_TZ(1, a, 1) FROM t1;
-SELECT CONVERT_TZ(1, 1, a) FROM t1;
-DROP TABLE t1;
-
---echo End of 5.1 tests
-
-
---echo #
---echo # Start of 5.3 tests
---echo #
-
---echo #
---echo # MDEV-4653 Wrong result for CONVERT_TZ(TIME('00:00:00'),'+00:00','+7:5')
---echo #
-
-SET timestamp=unix_timestamp('2001-02-03 10:20:30');
-SELECT CONVERT_TZ(TIME('00:00:00'),'+00:00','+7:5');
-SELECT CONVERT_TZ(TIME('2010-01-01 00:00:00'),'+00:00','+7:5');
-SET timestamp=DEFAULT;
-
---echo #
---echo # MDEV-5506 safe_mutex: Trying to lock unitialized mutex at safemalloc.c on server shutdown after SELECT with CONVERT_TZ
---echo #
-SELECT CONVERT_TZ('2001-10-08 00:00:00', MAKE_SET(0,'+01:00'), '+00:00' );
-
-
---echo #
---echo # End of 5.3 tests
---echo #
diff --git a/mysql-test/t/timezone3-master.opt b/mysql-test/t/timezone3-master.opt
deleted file mode 100644
index 6910e6e6e8d..00000000000
--- a/mysql-test/t/timezone3-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---timezone=:$MYSQL_TEST_DIR/std_data/Moscow_leap
diff --git a/mysql-test/t/timezone3.test b/mysql-test/t/timezone3.test
deleted file mode 100644
index 8a9941f6383..00000000000
--- a/mysql-test/t/timezone3.test
+++ /dev/null
@@ -1,73 +0,0 @@
-#
-# Test of handling time zone with leap seconds.
-#
-# This test should be run with TZ=:$MYSQL_TEST_DIR/std_data/Moscow_leap
-# This implies that this test should be run only on systems that interpret
-# characters after colon in TZ variable as path to zoneinfo file.
-#
-# Check that we have successfully set time zone with leap seconds.
---require r/have_moscow_leap_timezone.require
-disable_query_log;
-select from_unixtime(1072904422);
-enable_query_log;
-
-# Initial clean-up
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-#
-# Let us check behavior of conversion from broken-down representation
-# to time_t representation, for normal, non-existent and ambigious dates
-# (This check is similar to the one in timezone2.test in 4.1)
-#
-create table t1 (i int, c varchar(20));
-# Normal value without DST
-insert into t1 values
- (unix_timestamp("2004-01-01 00:00:00"), "2004-01-01 00:00:00");
-# Values around and in spring time-gap
-insert into t1 values
- (unix_timestamp("2004-03-28 01:59:59"), "2004-03-28 01:59:59"),
- (unix_timestamp("2004-03-28 02:30:00"), "2004-03-28 02:30:00"),
- (unix_timestamp("2004-03-28 03:00:00"), "2004-03-28 03:00:00");
-# Normal value with DST
-insert into t1 values
- (unix_timestamp('2004-05-01 00:00:00'),'2004-05-01 00:00:00');
-# Ambiguos values (also check for determenism)
-insert into t1 values
- (unix_timestamp('2004-10-31 01:00:00'),'2004-10-31 01:00:00'),
- (unix_timestamp('2004-10-31 02:00:00'),'2004-10-31 02:00:00'),
- (unix_timestamp('2004-10-31 02:59:59'),'2004-10-31 02:59:59'),
- (unix_timestamp('2004-10-31 04:00:00'),'2004-10-31 04:00:00'),
- (unix_timestamp('2004-10-31 02:59:59'),'2004-10-31 02:59:59');
-# Test of leap
-insert into t1 values
- (unix_timestamp('1981-07-01 03:59:59'),'1981-07-01 03:59:59'),
- (unix_timestamp('1981-07-01 04:00:00'),'1981-07-01 04:00:00');
-
-insert into t1 values
- (unix_timestamp('2009-01-01 02:59:59'),'2009-01-01 02:59:59'),
- (unix_timestamp('2009-01-01 03:00:00'),'2009-01-01 03:00:00');
-
-select i, from_unixtime(i), c from t1;
-drop table t1;
-
-#
-# Test for bug #6387 "Queried timestamp values do not match the
-# inserted". my_gmt_sec() function was not working properly if we
-# had time zone with leap seconds
-#
-create table t1 (ts timestamp);
-insert into t1 values (19730101235900), (20040101235900);
-select * from t1;
-drop table t1;
-
-#
-# Test Bug #39920: MySQL cannot deal with Leap Second expression in string
-# literal
-#
-
-# 2009-01-01 02:59:59, 2009-01-01 02:59:60 and 2009-01-01 03:00:00
-SELECT FROM_UNIXTIME(1230768022), FROM_UNIXTIME(1230768023), FROM_UNIXTIME(1230768024);
-
-# End of 4.1 tests
diff --git a/mysql-test/t/timezone4-master.opt b/mysql-test/t/timezone4-master.opt
deleted file mode 100644
index d1ab6207933..00000000000
--- a/mysql-test/t/timezone4-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---timezone=GMT+10
diff --git a/mysql-test/t/timezone4.test b/mysql-test/t/timezone4.test
deleted file mode 100644
index d7372c75d5a..00000000000
--- a/mysql-test/t/timezone4.test
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# Tests for time functions. The difference from func_time test is the
-# timezone. In func_time it's GMT-3. In our case it's GMT+10
-#
-
-#
-# Test for bug bug #9191 "TIMESTAMP/from_unixtime() no longer accepts 2^31-1"
-#
-
-select from_unixtime(0);
-# check 0 boundary
-select unix_timestamp('1969-12-31 14:00:01');
-
diff --git a/mysql-test/t/timezone_grant.test b/mysql-test/t/timezone_grant.test
deleted file mode 100644
index a6dd6be695e..00000000000
--- a/mysql-test/t/timezone_grant.test
+++ /dev/null
@@ -1,126 +0,0 @@
-# Embedded server testing does not support grants
--- source include/not_embedded.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
---disable_warnings
-drop tables if exists t1, t2;
-drop view if exists v1;
---enable_warnings
-
-#
-# Test for Bug#6116 SET time_zone := ... requires access to mysql.time_zone tables
-# We should allow implicit access to time zone description tables even for
-# unprivileged users.
-#
-
-# Let us prepare playground
-delete from mysql.user where user like 'mysqltest\_%';
-delete from mysql.db where user like 'mysqltest\_%';
-delete from mysql.tables_priv where user like 'mysqltest\_%';
-delete from mysql.columns_priv where user like 'mysqltest\_%';
-flush privileges;
-create table t1 (a int, b datetime);
-create table t2 (c int, d datetime);
-
-create user mysqltest_1@localhost;
-grant all privileges on test.* to mysqltest_1@localhost;
-connect (tzuser, localhost, mysqltest_1,,);
-connection tzuser;
-show grants for current_user();
-set time_zone= '+00:00';
-set time_zone= 'Europe/Moscow';
-select convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC');
-select convert_tz(b, 'Europe/Moscow', 'UTC') from t1;
-# Let us also check whenever multi-update works ok
-update t1, t2 set t1.b = convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC')
- where t1.a = t2.c and t2.d = (select max(d) from t2);
-# But still these two statements should not work:
---error ER_TABLEACCESS_DENIED_ERROR
-select * from mysql.time_zone_name;
---error ER_TABLEACCESS_DENIED_ERROR
-select Name, convert_tz('2004-10-21 19:00:00', Name, 'UTC') from mysql.time_zone_name;
-
-connection default;
-disconnect tzuser;
-
-#
-# Bug#6765 Implicit access to time zone description tables requires privileges
-# for them if some table or column level grants present
-#
-connection default;
-# Let use some table-level grants instead of db-level
-# to make life more interesting
-delete from mysql.db where user like 'mysqltest\_%';
-flush privileges;
-grant all privileges on test.t1 to mysqltest_1@localhost;
-grant all privileges on test.t2 to mysqltest_1@localhost;
-# The test itself is almost the same as previous one
-connect (tzuser2, localhost, mysqltest_1,,);
-connection tzuser2;
-show grants for current_user();
-set time_zone= '+00:00';
-set time_zone= 'Europe/Moscow';
-select convert_tz('2004-11-31 12:00:00', 'Europe/Moscow', 'UTC');
-select convert_tz(b, 'Europe/Moscow', 'UTC') from t1;
-update t1, t2 set t1.b = convert_tz('2004-11-30 12:00:00', 'Europe/Moscow', 'UTC')
- where t1.a = t2.c and t2.d = (select max(d) from t2);
-# Again these two statements should not work (but with different errors):
---error ER_TABLEACCESS_DENIED_ERROR
-select * from mysql.time_zone_name;
---error ER_TABLEACCESS_DENIED_ERROR
-select Name, convert_tz('2004-11-30 12:00:00', Name, 'UTC') from mysql.time_zone_name;
-
-#
-# Bug#9979 Use of CONVERT_TZ in multiple-table UPDATE causes bogus
-# privilege error
-#
-drop table t1, t2;
-create table t1 (a int, b datetime);
-create table t2 (a int, b varchar(40));
-update t1 set b = '2005-01-01 10:00';
-update t1 set b = convert_tz(b, 'UTC', 'UTC');
-update t1 join t2 on (t1.a = t2.a) set t1.b = '2005-01-01 10:00' where t2.b = 'foo';
-update t1 join t2 on (t1.a = t2.a) set t1.b = convert_tz('2005-01-01 10:00','UTC','UTC') where t2.b = 'foo';
-
-# Clean-up
-connection default;
-disconnect tzuser2;
-delete from mysql.user where user like 'mysqltest\_%';
-delete from mysql.db where user like 'mysqltest\_%';
-delete from mysql.tables_priv where user like 'mysqltest\_%';
-flush privileges;
-drop table t1, t2;
-
-# End of 4.1 tests
-
-#
-# Additional test for Bug#15153 CONVERT_TZ() is not allowed in all places in views.
-#
-# Let us check that usage of CONVERT_TZ() function in view does not
-# require additional privileges.
-
-# Let us rely on that previous tests done proper cleanups
-create table t1 (a int, b datetime);
-insert into t1 values (1, 20010101000000), (2, 20020101000000);
-create user mysqltest_1@localhost;
-grant all privileges on test.* to mysqltest_1@localhost;
-connect (tzuser3, localhost, mysqltest_1,,);
-create view v1 as select a, convert_tz(b, 'UTC', 'Europe/Moscow') as lb from t1;
-select * from v1;
-# Of course we should not be able select from mysql.time_zone tables
---error ER_TABLEACCESS_DENIED_ERROR
-select * from v1, mysql.time_zone;
-drop view v1;
---error ER_TABLEACCESS_DENIED_ERROR
-create view v1 as select a, convert_tz(b, 'UTC', 'Europe/Moscow') as lb from t1, mysql.time_zone;
-connection default;
-disconnect tzuser3;
-drop table t1;
-drop user mysqltest_1@localhost;
-
-# End of 5.0 tests
-
-# Wait till we reached the initial number of concurrent sessions
---source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/tmp_table_count-7586.test b/mysql-test/t/tmp_table_count-7586.test
deleted file mode 100644
index e7bac127815..00000000000
--- a/mysql-test/t/tmp_table_count-7586.test
+++ /dev/null
@@ -1,56 +0,0 @@
-# MDEV-7586 regression test.
-# Test if created_tmp_tables status variable is correctly incremented.
---source include/have_perfschema.inc
---source include/not_embedded.inc
-
-create table t2 (a int);
-insert into t2 values (1),(2),(3);
-create view v2 as select a from t2;
-
-flush status;
-select * from v2;
-show status like '%Created_tmp%';
-
-explain select * from v2;
-
-select * from (select * from t2) T1;
-show status like '%Created_tmp%';
-
-explain select * from (select * from t2) T1;
-
-
-drop view v2;
-drop table t2;
-
-
---disable_ps_protocol
-
-CREATE TABLE t1(a int);
-INSERT INTO t1 values(1),(2);
-CREATE TABLE t2(a int);
-INSERT INTO t2 values(1),(2);
-
-EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT * FROM t2 GROUP BY a HAVING a > 1);
-truncate table performance_schema.events_statements_history_long;
-flush status;
-CREATE TABLE t3 SELECT * FROM t1 WHERE a IN (SELECT * FROM t2 GROUP BY a HAVING a > 1);
---echo # Performance schema should be the same as "Created_tmp_tables" variable below
-select sum(created_tmp_tables) from performance_schema.events_statements_history_long;
-show status like '%Created_tmp%';
-drop table t3;
-
-EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT * FROM t2 GROUP BY a);
-truncate table performance_schema.events_statements_history_long;
-flush status;
-CREATE TABLE t3 SELECT * FROM t1 WHERE a IN (SELECT * FROM t2 GROUP BY a);
---echo # Performance schema should be the same as "Created_tmp_tables" variable below
-select sum(created_tmp_tables) from performance_schema.events_statements_history_long;
-show status like '%Created_tmp%';
-
-drop table t1,t2,t3;
-
-truncate table performance_schema.events_statements_history_long;
-flush status;
---echo # Performance schema should be the same as "Created_tmp_tables" variable below
-select sum(created_tmp_tables) from performance_schema.events_statements_history_long;
-show status like '%Created_tmp%';
diff --git a/mysql-test/t/trans_read_only-master.opt b/mysql-test/t/trans_read_only-master.opt
deleted file mode 100644
index cf84816ec90..00000000000
--- a/mysql-test/t/trans_read_only-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---transaction-read-only=true
diff --git a/mysql-test/t/trans_read_only.test b/mysql-test/t/trans_read_only.test
deleted file mode 100644
index 38b2a833216..00000000000
--- a/mysql-test/t/trans_read_only.test
+++ /dev/null
@@ -1,49 +0,0 @@
---source include/not_embedded.inc
-
---echo #
---echo # WL#5968: Implement START TRANSACTION READ (WRITE|ONLY);
---echo #
-
---echo #
---echo # Test9: The --transaction-read-only startup option.
-
---echo # Check that the option was set by the .opt file.
-SELECT @@tx_read_only;
-
---echo # Also for new connections.
-connect (con1, localhost, root);
-SELECT @@tx_read_only;
-SET SESSION TRANSACTION READ WRITE;
-SELECT @@tx_read_only;
-disconnect con1;
---source include/wait_until_disconnected.inc
-
-connection default;
-SELECT @@tx_read_only;
-
-
---echo #
---echo # Test 10: SET TRANSACTION / START TRANSACTION + implicit commit.
-
-SET SESSION TRANSACTION READ WRITE;
---disable_ps_protocol
-SET TRANSACTION READ ONLY;
---echo # Since DDL does implicit commit before starting, SET TRANSACTION
---echo # will have no effect because the "next" transaction will already
---echo # be over before the DDL statement starts.
-CREATE TABLE t1 (a INT);
-
-START TRANSACTION READ ONLY;
---echo # The same happens with START TRANSACTION
-DROP TABLE t1;
---enable_ps_protocol
-
---echo #
---echo # Test 11: INSERT DELAYED
-
-CREATE TABLE t1(a INT);
-START TRANSACTION READ ONLY;
---error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
-INSERT DELAYED INTO t1 VALUES (1);
-COMMIT;
-DROP TABLE t1;
diff --git a/mysql-test/t/transaction_timeout.test b/mysql-test/t/transaction_timeout.test
deleted file mode 100644
index f2a044497c5..00000000000
--- a/mysql-test/t/transaction_timeout.test
+++ /dev/null
@@ -1,54 +0,0 @@
---source include/no_protocol.inc
---source include/have_innodb.inc
---source include/not_embedded.inc
-
-CREATE TABLE t1 (a INT) ENGINE=InnoDB;
-
---echo # Test idle_transaction_timeout
-connect (c0,localhost,root,,test,,);
-SHOW VARIABLES LIKE 'idle_%transaction_timeout';
-SET autocommit=0;
-SET idle_transaction_timeout=1;
-
-BEGIN;
-SELECT * FROM t1;
-sleep 2;
-
---error 2006,2013
-SELECT * FROM t1;
-disconnect c0;
-
---echo # Test idle_readonly_transaction_timeout
-connect (c1,localhost,root,,test,,);
-SHOW VARIABLES LIKE 'idle_%transaction_timeout';
-SET autocommit=0;
-SET idle_readonly_transaction_timeout=1;
-
-BEGIN;
-SELECT * FROM t1;
-sleep 2;
-
---error 2006,2013 # Gone away
-SELECT * FROM t1;
-disconnect c1;
-
---echo # Test idle_write_transaction_timeout
-connect (c2,localhost,root,,test,,);
-SHOW VARIABLES LIKE 'idle_%transaction_timeout';
-SET autocommit=0;
-SET idle_write_transaction_timeout=1;
-
-BEGIN;
-SELECT * FROM t1;
-sleep 2;
-
-SELECT * FROM t1;
-INSERT INTO t1 VALUES (1);
-sleep 2;
-
---error 2006, 2013 # Gone away
-SELECT * FROM t1;
-disconnect c2;
-
-connection default;
-DROP TABLE t1;
diff --git a/mysql-test/t/trigger-compat.test b/mysql-test/t/trigger-compat.test
deleted file mode 100644
index 437df89b4b1..00000000000
--- a/mysql-test/t/trigger-compat.test
+++ /dev/null
@@ -1,290 +0,0 @@
-# Test case(s) in this file contain(s) GRANT/REVOKE statements, which are not
-# supported in embedded server. So, this test should not be run on embedded
-# server.
-
--- source include/not_embedded.inc
-
-###########################################################################
-#
-# Tests for WL#2818:
-# - Check that triggers created w/o DEFINER information work well:
-# - create the first trigger;
-# - manually remove definer information from corresponding TRG file;
-# - create the second trigger (the first trigger will be reloaded; check
-# that we receive a warning);
-# - check that the triggers loaded correctly;
-#
-###########################################################################
-
-#
-# Prepare environment.
-#
-DELETE FROM mysql.user WHERE User LIKE 'mysqltest_%';
-DELETE FROM mysql.db WHERE User LIKE 'mysqltest_%';
-DELETE FROM mysql.tables_priv WHERE User LIKE 'mysqltest_%';
-DELETE FROM mysql.columns_priv WHERE User LIKE 'mysqltest_%';
-FLUSH PRIVILEGES;
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest_db1;
---enable_warnings
-
-CREATE DATABASE mysqltest_db1;
-
-CREATE USER mysqltest_dfn@localhost;
-CREATE USER mysqltest_inv@localhost;
-
-GRANT CREATE, TRIGGER ON mysqltest_db1.* TO mysqltest_dfn@localhost;
-
-#
-# Create a table and the first trigger.
-#
-
---connect (wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1)
---connection wl2818_definer_con
-
-CREATE TABLE t1(num_value INT);
-CREATE TABLE t2(user_str TEXT);
-
-CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES(CURRENT_USER());
-
-#
-# Remove definers from TRG file.
-#
-
---echo
---echo ---> patching t1.TRG...
-
-# Here we remove definers. This is somewhat complex than the original test
-# Previously, the test only used grep -v 'definers=' t1.TRG, but grep is not
-# portable and we have to load the file into a table, exclude the definers line,
-# then load the data to an outfile to accomplish the same effect
-
---disable_query_log
---connection default
-CREATE TABLE patch (a blob);
-let $MYSQLD_DATADIR = `select @@datadir`;
-eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/mysqltest_db1/t1.TRG' INTO TABLE patch;
-# remove original t1.TRG file so SELECT INTO OUTFILE won't fail
---remove_file $MYSQLD_DATADIR/mysqltest_db1/t1.TRG
-eval SELECT SUBSTRING_INDEX(a,'definers=',1) INTO OUTFILE
- '$MYSQLD_DATADIR/mysqltest_db1/t1.TRG'
-FROM patch;
-DROP TABLE patch;
---connection wl2818_definer_con
---enable_query_log
-
-#
-# Create a new trigger.
-#
-
---echo
-
-CREATE TRIGGER wl2818_trg2 AFTER INSERT ON t1
- FOR EACH ROW
- INSERT INTO t2 VALUES(CURRENT_USER());
-
---echo
-
-SELECT trigger_name, definer FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
-
---echo
-
---replace_column 17 #
-SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
-
-# Clean up
-DROP TRIGGER wl2818_trg1;
-DROP TRIGGER wl2818_trg2;
-disconnect wl2818_definer_con;
-connection default;
-use mysqltest_db1;
-DROP TABLE t1;
-DROP TABLE t2;
-DROP USER mysqltest_dfn@localhost;
-DROP USER mysqltest_inv@localhost;
-DROP DATABASE mysqltest_db1;
-USE test;
-
-
---echo #
---echo # Bug#45235: 5.1 does not support 5.0-only syntax triggers in any way
---echo #
-let $MYSQLD_DATADIR=`SELECT @@datadir`;
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2, t3;
---enable_warnings
-
-CREATE TABLE t1 ( a INT );
-CREATE TABLE t2 ( a INT );
-CREATE TABLE t3 ( a INT );
-INSERT INTO t1 VALUES (1), (2), (3);
-INSERT INTO t2 VALUES (1), (2), (3);
-INSERT INTO t3 VALUES (1), (2), (3);
-
---echo # We simulate importing a trigger from 5.0 by writing a .TRN file for
---echo # each trigger plus a .TRG file the way MySQL 5.0 would have done it,
---echo # with syntax allowed in 5.0 only.
---echo #
---echo # Note that in 5.0 the following lines are missing from t1.TRG:
---echo #
---echo # client_cs_names='latin1'
---echo # connection_cl_names='latin1_swedish_ci'
---echo # db_cl_names='latin1_swedish_ci'
-
---write_file $MYSQLD_DATADIR/test/tr11.TRN
-TYPE=TRIGGERNAME
-trigger_table=t1
-EOF
-
---write_file $MYSQLD_DATADIR/test/tr12.TRN
-TYPE=TRIGGERNAME
-trigger_table=t1
-EOF
-
---write_file $MYSQLD_DATADIR/test/tr13.TRN
-TYPE=TRIGGERNAME
-trigger_table=t1
-EOF
-
---write_file $MYSQLD_DATADIR/test/tr14.TRN
-TYPE=TRIGGERNAME
-trigger_table=t1
-EOF
-
---write_file $MYSQLD_DATADIR/test/tr15.TRN
-TYPE=TRIGGERNAME
-trigger_table=t1
-EOF
-
---write_file $MYSQLD_DATADIR/test/t1.TRG
-TYPE=TRIGGERS
-triggers='CREATE DEFINER=`root`@`localhost` TRIGGER tr11 BEFORE INSERT ON t1 FOR EACH ROW DELETE FROM t3' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr12 AFTER INSERT ON t1 FOR EACH ROW DELETE FROM t3' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr13 BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t1 a USING t1 a' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr14 AFTER DELETE ON t1 FOR EACH ROW DELETE FROM non_existing_table' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr15 BEFORE UPDATE ON t1 FOR EACH ROW DELETE FROM non_existing_table a USING non_existing_table a'
-sql_modes=0 0 0 0 0
-definers='root@localhost' 'root@localhost' 'root@localhost' 'root@localhost' 'root@localhost'
-EOF
-
---write_file $MYSQLD_DATADIR/test/t2.TRG
-TYPE=TRIGGERS
-triggers='Not allowed syntax here, and trigger name cant be extracted either.'
-sql_modes=0
-definers='root@localhost'
-EOF
-
-FLUSH TABLE t1;
-FLUSH TABLE t2;
-
---echo # We will get parse errors for most DDL and DML statements when the table
---echo # has broken triggers. The parse error refers to the first broken
---echo # trigger.
---error ER_PARSE_ERROR
-CREATE TRIGGER tr16 AFTER UPDATE ON t1 FOR EACH ROW INSERT INTO t1 VALUES (1);
---error ER_PARSE_ERROR
-CREATE TRIGGER tr22 BEFORE INSERT ON t2 FOR EACH ROW DELETE FROM non_existing_table;
---replace_column 6 #
-SHOW TRIGGERS;
---error ER_PARSE_ERROR
-INSERT INTO t1 VALUES (1);
---error ER_PARSE_ERROR
-INSERT INTO t2 VALUES (1);
---error ER_PARSE_ERROR
-DELETE FROM t1;
---error ER_PARSE_ERROR
-UPDATE t1 SET a = 1 WHERE a = 1;
-SELECT * FROM t1;
---error ER_PARSE_ERROR
-RENAME TABLE t1 TO t1_2;
---replace_column 6 #
-SHOW TRIGGERS;
-
-DROP TRIGGER tr11;
-DROP TRIGGER tr12;
-DROP TRIGGER tr13;
-DROP TRIGGER tr14;
-DROP TRIGGER tr15;
-
---replace_column 6 #
-SHOW TRIGGERS;
-
---echo # Make sure there is no trigger file left.
---list_files $MYSQLD_DATADIR/test/ tr*
-
---echo # We write the same trigger files one more time to test DROP TABLE.
---write_file $MYSQLD_DATADIR/test/tr11.TRN
-TYPE=TRIGGERNAME
-trigger_table=t1
-EOF
-
---write_file $MYSQLD_DATADIR/test/tr12.TRN
-TYPE=TRIGGERNAME
-trigger_table=t1
-EOF
-
---write_file $MYSQLD_DATADIR/test/tr13.TRN
-TYPE=TRIGGERNAME
-trigger_table=t1
-EOF
-
---write_file $MYSQLD_DATADIR/test/tr14.TRN
-TYPE=TRIGGERNAME
-trigger_table=t1
-EOF
-
---write_file $MYSQLD_DATADIR/test/tr15.TRN
-TYPE=TRIGGERNAME
-trigger_table=t1
-EOF
-
---write_file $MYSQLD_DATADIR/test/t1.TRG
-TYPE=TRIGGERS
-triggers='CREATE DEFINER=`root`@`localhost` TRIGGER tr11 BEFORE INSERT ON t1 FOR EACH ROW DELETE FROM t3' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr12 AFTER INSERT ON t1 FOR EACH ROW DELETE FROM t3' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr13 BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t1 a USING t1 a' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr14 AFTER DELETE ON t1 FOR EACH ROW DELETE FROM non_existing_table' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr15 BEFORE UPDATE ON t1 FOR EACH ROW DELETE FROM non_existing_table a USING non_existing_table a'
-sql_modes=0 0 0 0 0
-definers='root@localhost' 'root@localhost' 'root@localhost' 'root@localhost' 'root@localhost'
-EOF
-
-FLUSH TABLE t1;
-FLUSH TABLE t2;
-
-DROP TABLE t1;
-DROP TABLE t2;
-DROP TABLE t3;
-
---echo # Make sure there is no trigger file left.
-
---list_files $MYSQLD_DATADIR/test/ tr*
-
-CREATE TABLE t1 ( a INT );
-CREATE TABLE t2 ( a INT );
-INSERT INTO t1 VALUES (1), (2), (3);
-INSERT INTO t2 VALUES (1), (2), (3);
-
---echo # We write three trigger files. First trigger is syntaxically incorrect, next trigger is correct
---echo # and last trigger is broken.
---echo # Next we try to execute SHOW CREATE TRIGGER command for broken trigger and then try to drop one.
---write_file $MYSQLD_DATADIR/test/tr11.TRN
-TYPE=TRIGGERNAME
-trigger_table=t1
-EOF
-
---write_file $MYSQLD_DATADIR/test/tr12.TRN
-TYPE=TRIGGERNAME
-trigger_table=t1
-EOF
-
---write_file $MYSQLD_DATADIR/test/t1.TRG
-TYPE=TRIGGERS
-triggers='CREATE the wrongest trigger_in_the_world' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr11 BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t1 a USING t1 a' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr12 BEFORE INSERT ON t1 FOR EACH ROW DELETE FROM t2'
-sql_modes=0 0 0
-definers='root@localhost' 'root@localhost' 'root@localhost'
-EOF
-
-FLUSH TABLE t1;
-
-SHOW CREATE TRIGGER tr12;
-SHOW CREATE TRIGGER tr11;
-DROP TRIGGER tr12;
-DROP TRIGGER tr11;
-
-DROP TABLE t1;
-DROP TABLE t2;
diff --git a/mysql-test/t/trigger-trans.test b/mysql-test/t/trigger-trans.test
deleted file mode 100644
index 17656c3516e..00000000000
--- a/mysql-test/t/trigger-trans.test
+++ /dev/null
@@ -1,235 +0,0 @@
-# Tests which involve triggers and transactions
-# (or just InnoDB storage engine)
---source include/have_innodb.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-# Test for bug #18153 "OPTIMIZE/ALTER on transactional tables corrupt
-# triggers/triggers are lost".
-
-create table t1 (a varchar(16), b int) engine=innodb;
-delimiter |;
-create trigger t1_bi before insert on t1 for each row
-begin
- set new.a := upper(new.a);
- set new.b := new.b + 3;
-end|
-delimiter ;|
-select trigger_schema, trigger_name, event_object_schema,
- event_object_table, action_statement from information_schema.triggers
- where event_object_schema = 'test' and event_object_table = 't1';
-insert into t1 values ('The Lion', 10);
-select * from t1;
-optimize table t1;
-select trigger_schema, trigger_name, event_object_schema,
- event_object_table, action_statement from information_schema.triggers
- where event_object_schema = 'test' and event_object_table = 't1';
-insert into t1 values ('The Unicorn', 20);
-select * from t1;
-alter table t1 add column c int default 0;
-select trigger_schema, trigger_name, event_object_schema,
- event_object_table, action_statement from information_schema.triggers
- where event_object_schema = 'test' and event_object_table = 't1';
-insert into t1 values ('Alice', 30, 1);
-select * from t1;
-# Special tricky cases allowed by ALTER TABLE ... RENAME
-alter table t1 rename to t1;
-select trigger_schema, trigger_name, event_object_schema,
- event_object_table, action_statement from information_schema.triggers
- where event_object_schema = 'test' and event_object_table = 't1';
-insert into t1 values ('The Crown', 40, 1);
-select * from t1;
-alter table t1 rename to t1, add column d int default 0;
-select trigger_schema, trigger_name, event_object_schema,
- event_object_table, action_statement from information_schema.triggers
- where event_object_schema = 'test' and event_object_table = 't1';
-insert into t1 values ('The Pie', 50, 1, 1);
-select * from t1;
-drop table t1;
-
---echo
---echo Bug#26141 mixing table types in trigger causes full
---echo table lock on innodb table
---echo
---echo Ensure we do not open and lock tables for the triggers we do not
---echo fire.
---echo
---disable_warnings
-drop table if exists t1, t2, t3;
-drop trigger if exists trg_bug26141_au;
-drop trigger if exists trg_bug26141_ai;
---enable_warnings
-# Note, for InnoDB to allow concurrent UPDATE and INSERT the
-# table must have a unique key.
-create table t1 (c int primary key) engine=innodb;
-create table t2 (c int) engine=myisam;
-create table t3 (c int) engine=myisam;
-insert into t1 (c) values (1);
-delimiter |;
-
-create trigger trg_bug26141_ai after insert on t1
-for each row
-begin
- insert into t2 (c) values (1);
-# We need the 'sync' lock to synchronously wait in connection 2 till
-# the moment when the trigger acquired all the locks.
- select release_lock("lock_bug26141_sync") into @a;
-# 1000 is time in seconds of lock wait timeout -- this is a way
-# to cause a manageable sleep up to 1000 seconds
- select get_lock("lock_bug26141_wait", 1000) into @a;
-end|
-
-create trigger trg_bug26141_au after update on t1
-for each row
-begin
- insert into t3 (c) values (1);
-end|
-delimiter ;|
-
-# Establish an alternative connection.
---connect (connection_aux,localhost,root,,test,,)
---connect (connection_update,localhost,root,,test,,)
-
-connection connection_aux;
-# Lock the wait lock, it must not be locked, so specify zero timeout.
-select get_lock("lock_bug26141_wait", 0);
-
-#
-connection default;
-#
-# Run the trigger synchronously
-#
-select get_lock("lock_bug26141_sync", /* must not be priorly locked */ 0);
-# Will acquire the table level locks, perform the insert into t2,
-# release the sync lock and block on the wait lock.
-send insert into t1 (c) values (2);
-
-connection connection_update;
-# Wait for the trigger to acquire its locks and unlock the sync lock.
-select get_lock("lock_bug26141_sync", 1000);
-#
-# This must continue: after the fix for the bug, we do not
-# open tables for t2, and with c=4 innobase allows the update
-# to run concurrently with insert.
-update t1 set c=3 where c=1;
-select release_lock("lock_bug26141_sync");
-connection connection_aux;
-select release_lock("lock_bug26141_wait");
-connection default;
-reap;
-select * from t1;
-select * from t2;
-select * from t3;
-
-# Drops the trigger as well.
-drop table t1, t2, t3;
-disconnect connection_update;
-disconnect connection_aux;
-
-#
-# Bug#34643: TRUNCATE crash if trigger and foreign key.
-#
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS t2;
---enable_warnings
-
-CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=innodb;
-CREATE TABLE t2(b INT, FOREIGN KEY(b) REFERENCES t1(a)) ENGINE=innodb;
-
-INSERT INTO t1 VALUES (1);
-
-CREATE TRIGGER t1_bd BEFORE DELETE ON t1 FOR EACH ROW SET @a = 1;
-CREATE TRIGGER t1_ad AFTER DELETE ON t1 FOR EACH ROW SET @b = 1;
-
-SET @a = 0;
-SET @b = 0;
-
---error ER_TRUNCATE_ILLEGAL_FK
-TRUNCATE t1;
-
-SELECT @a, @b;
-
-DELETE FROM t1;
-
-SELECT @a, @b;
-
-INSERT INTO t1 VALUES (1);
-
-DELETE FROM t1;
-
-SELECT @a, @b;
-
-DROP TABLE t2, t1;
-
-
---echo End of 5.0 tests
-
---echo BUG#31612
---echo Trigger fired multiple times leads to gaps in auto_increment sequence
-create table t1 (a int, val char(1)) engine=InnoDB;
-create table t2 (b int auto_increment primary key,
- val char(1)) engine=InnoDB;
-create trigger t1_after_insert after
- insert on t1 for each row insert into t2 set val=NEW.val;
-insert into t1 values ( 123, 'a'), ( 123, 'b'), ( 123, 'c'),
- (123, 'd'), (123, 'e'), (123, 'f'), (123, 'g');
-insert into t1 values ( 654, 'a'), ( 654, 'b'), ( 654, 'c'),
- (654, 'd'), (654, 'e'), (654, 'f'), (654, 'g');
-select * from t2 order by b;
-drop trigger t1_after_insert;
-drop table t1,t2;
-
---echo #
---echo #Bug#19683834 SOME INNODB ERRORS CAUSES STORED FUNCTION
---echo # AND TRIGGER HANDLERS TO BE IGNORED
-
---echo #Code fixed in Bug#16041903
-
-CREATE TABLE t1 (id int unsigned PRIMARY KEY, val int DEFAULT 0)
-ENGINE=InnoDB;
-INSERT INTO t1 (id) VALUES (1), (2);
-
-CREATE TABLE t2 (id int PRIMARY KEY);
-CREATE TABLE t3 LIKE t2;
-
-# Trigger with continue handler for ER_DUP_ENTRY(1062)
-DELIMITER //;
-CREATE TRIGGER bef_insert BEFORE INSERT ON t2 FOR EACH ROW
-BEGIN
- DECLARE CONTINUE HANDLER FOR 1062 BEGIN END;
- INSERT INTO t3 (id) VALUES (NEW.id);
- INSERT INTO t3 (id) VALUES (NEW.id);
-END//
-DELIMITER ;//
-
-# Transaction 1: Grab locks on t1
-START TRANSACTION;
-UPDATE t1 SET val = val + 1;
-
-# Transaction 2:
---connect (con2,localhost,root,,test,,)
-SET SESSION innodb_lock_wait_timeout = 2;
-# Trigger lock timeout (1205)
---error ER_LOCK_WAIT_TIMEOUT
-UPDATE t1 SET val = val + 1;
-
-# This insert should go through, as the continue handler should
-# handle ER_DUP_ENTRY, even after ER_LOCK_WAIT_TIMEOUT (Bug#16041903)
-INSERT INTO t2 (id) VALUES (1);
-
-# Cleanup
-disconnect con2;
---source include/wait_until_disconnected.inc
-connection default;
-
-DROP TABLE t3, t2, t1;
-
-# Wait till we reached the initial number of concurrent sessions
---source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test
deleted file mode 100644
index 1557ef200e5..00000000000
--- a/mysql-test/t/trigger.test
+++ /dev/null
@@ -1,2750 +0,0 @@
-# This test uses chmod, can't be run with root permissions
--- source include/not_as_root.inc
-
-
-#
-# Basic triggers test
-#
-
---disable_warnings
-drop table if exists t1, t2, t3, t4;
-drop view if exists v1;
-drop database if exists mysqltest;
-drop function if exists f1;
-drop function if exists f2;
-drop procedure if exists p1;
---enable_warnings
-
-# Create additional connections used through test
-connect (addconroot1, localhost, root,,);
-connect (addconroot2, localhost, root,,);
-# Connection without current database set
-connect (addconwithoutdb, localhost, root,,*NO-ONE*);
-connection default;
-
-create table t1 (i int);
-
-# let us test some very simple trigger
-create trigger trg before insert on t1 for each row set @a:=1;
-set @a:=0;
-select @a;
-insert into t1 values (1);
-select @a;
-drop trigger trg;
-
-# let us test simple trigger reading some values
-create trigger trg before insert on t1 for each row set @a:=new.i;
-insert into t1 values (123);
-select @a;
-drop trigger trg;
-
-drop table t1;
-
-# Let us test before insert trigger
-# Such triggers can be used for setting complex default values
-create table t1 (i int not null, j int);
-delimiter |;
-create trigger trg before insert on t1 for each row
-begin
- if isnull(new.j) then
- set new.j:= new.i * 10;
- end if;
-end|
-insert into t1 (i) values (1)|
-insert into t1 (i,j) values (2, 3)|
-select * from t1|
-drop trigger trg|
-drop table t1|
-delimiter ;|
-
-# After insert trigger
-# Useful for aggregating data
-create table t1 (i int not null primary key);
-create trigger trg after insert on t1 for each row
- set @a:= if(@a,concat(@a, ":", new.i), new.i);
-set @a:="";
-insert into t1 values (2),(3),(4),(5);
-select @a;
-drop trigger trg;
-drop table t1;
-
-# PS doesn't work with multi-row statements
---disable_ps_protocol
-# Before update trigger
-# (In future we will achieve this via proper error handling in triggers)
-create table t1 (aid int not null primary key, balance int not null default 0);
-insert into t1 values (1, 1000), (2,3000);
-delimiter |;
-create trigger trg before update on t1 for each row
-begin
- declare loc_err varchar(255);
- if abs(new.balance - old.balance) > 1000 then
- set new.balance:= old.balance;
- set loc_err := concat("Too big change for aid = ", new.aid);
- set @update_failed:= if(@update_failed, concat(@a, ":", loc_err), loc_err);
- end if;
-end|
-set @update_failed:=""|
-update t1 set balance=1500|
-select @update_failed;
-select * from t1|
-drop trigger trg|
-drop table t1|
-delimiter ;|
---enable_ps_protocol
-
-# After update trigger
-create table t1 (i int);
-insert into t1 values (1),(2),(3),(4);
-create trigger trg after update on t1 for each row
- set @total_change:=@total_change + new.i - old.i;
-set @total_change:=0;
-update t1 set i=3;
-select @total_change;
-drop trigger trg;
-drop table t1;
-
-# Before delete trigger
-# This can be used for aggregation too :)
-create table t1 (i int);
-insert into t1 values (1),(2),(3),(4);
-create trigger trg before delete on t1 for each row
- set @del_sum:= @del_sum + old.i;
-set @del_sum:= 0;
-delete from t1 where i <= 3;
-select @del_sum;
-drop trigger trg;
-drop table t1;
-
-# After delete trigger.
-# Just run out of imagination.
-create table t1 (i int);
-insert into t1 values (1),(2),(3),(4);
-create trigger trg after delete on t1 for each row set @del:= 1;
-set @del:= 0;
-delete from t1 where i <> 0;
-select @del;
-drop trigger trg;
-drop table t1;
-
-# Several triggers on one table
-create table t1 (i int, j int);
-
-delimiter |;
-create trigger trg1 before insert on t1 for each row
-begin
- if new.j > 10 then
- set new.j := 10;
- end if;
-end|
-create trigger trg2 before update on t1 for each row
-begin
- if old.i % 2 = 0 then
- set new.j := -1;
- end if;
-end|
-create trigger trg3 after update on t1 for each row
-begin
- if new.j = -1 then
- set @fired:= "Yes";
- end if;
-end|
-delimiter ;|
-set @fired:="";
-insert into t1 values (1,2),(2,3),(3,14);
-select @fired;
-select * from t1;
-update t1 set j= 20;
-select @fired;
-select * from t1;
-
-drop trigger trg1;
-drop trigger trg2;
-drop trigger trg3;
-drop table t1;
-
-
-# Let us test how triggers work for special forms of INSERT such as
-# REPLACE and INSERT ... ON DUPLICATE KEY UPDATE
-create table t1 (id int not null primary key, data int);
-create trigger t1_bi before insert on t1 for each row
- set @log:= concat(@log, "(BEFORE_INSERT: new=(id=", new.id, ", data=", new.data,"))");
-create trigger t1_ai after insert on t1 for each row
- set @log:= concat(@log, "(AFTER_INSERT: new=(id=", new.id, ", data=", new.data,"))");
-create trigger t1_bu before update on t1 for each row
- set @log:= concat(@log, "(BEFORE_UPDATE: old=(id=", old.id, ", data=", old.data,
- ") new=(id=", new.id, ", data=", new.data,"))");
-create trigger t1_au after update on t1 for each row
- set @log:= concat(@log, "(AFTER_UPDATE: old=(id=", old.id, ", data=", old.data,
- ") new=(id=", new.id, ", data=", new.data,"))");
-create trigger t1_bd before delete on t1 for each row
- set @log:= concat(@log, "(BEFORE_DELETE: old=(id=", old.id, ", data=", old.data,"))");
-create trigger t1_ad after delete on t1 for each row
- set @log:= concat(@log, "(AFTER_DELETE: old=(id=", old.id, ", data=", old.data,"))");
-# Simple INSERT - both triggers should be called
-set @log:= "";
-insert into t1 values (1, 1);
-select @log;
-# INSERT IGNORE for already existing key - only before trigger should fire
-set @log:= "";
-insert ignore t1 values (1, 2);
-select @log;
-# INSERT ... ON DUPLICATE KEY UPDATE ...
-set @log:= "";
-insert into t1 (id, data) values (1, 3), (2, 2) on duplicate key update data= data + 1;
-select @log;
-# REPLACE (also test for bug#13479 "REPLACE activates UPDATE trigger,
-# not the DELETE and INSERT triggers")
-# We define REPLACE as INSERT which DELETEs old rows which conflict with
-# row being inserted. So for the first record in statement below we will
-# call before insert trigger, then delete will be executed (and both delete
-# triggers should fire). Finally after insert trigger will be called.
-# For the second record we will just call both on insert triggers.
-set @log:= "";
-replace t1 values (1, 4), (3, 3);
-select @log;
-# Now we will drop ON DELETE triggers to test REPLACE which is internally
-# executed via update
-drop trigger t1_bd;
-drop trigger t1_ad;
-set @log:= "";
-replace t1 values (1, 5);
-select @log;
-
-# This also drops associated triggers
-drop table t1;
-
-
-#
-# Let us test triggers which access other tables.
-#
-# Trivial trigger which inserts data into another table
-create table t1 (id int primary key, data varchar(10), fk int);
-create table t2 (event varchar(100));
-create table t3 (id int primary key);
-create trigger t1_ai after insert on t1 for each row
- insert into t2 values (concat("INSERT INTO t1 id=", new.id, " data='", new.data, "'"));
-insert into t1 (id, data) values (1, "one"), (2, "two");
-select * from t1;
-select * from t2;
-drop trigger t1_ai;
-# Trigger which uses couple of tables (and partially emulates FK constraint)
-delimiter |;
-create trigger t1_bi before insert on t1 for each row
-begin
- if exists (select id from t3 where id=new.fk) then
- insert into t2 values (concat("INSERT INTO t1 id=", new.id, " data='", new.data, "' fk=", new.fk));
- else
- insert into t2 values (concat("INSERT INTO t1 FAILED id=", new.id, " data='", new.data, "' fk=", new.fk));
- set new.id= NULL;
- end if;
-end|
-delimiter ;|
-insert into t3 values (1);
-insert into t1 values (4, "four", 1), (5, "five", 2);
-select * from t1;
-select * from t2;
-drop table t1, t2, t3;
-# Trigger which invokes function
-create table t1 (id int primary key, data varchar(10));
-create table t2 (seq int);
-insert into t2 values (10);
-create function f1 () returns int return (select max(seq) from t2);
-delimiter |;
-create trigger t1_bi before insert on t1 for each row
-begin
- if new.id > f1() then
- set new.id:= f1();
- end if;
-end|
-delimiter ;|
-insert into t1 values (1, "first");
-insert into t1 values (f1(), "max");
-select * from t1;
-drop table t1, t2;
-drop function f1;
-# Trigger which forces invocation of another trigger
-# (emulation of FK on delete cascade policy)
-create table t1 (id int primary key, fk_t2 int);
-create table t2 (id int primary key, fk_t3 int);
-create table t3 (id int primary key);
-insert into t1 values (1,1), (2,1), (3,2);
-insert into t2 values (1,1), (2,2);
-insert into t3 values (1), (2);
-create trigger t3_ad after delete on t3 for each row
- delete from t2 where fk_t3=old.id;
-create trigger t2_ad after delete on t2 for each row
- delete from t1 where fk_t2=old.id;
-delete from t3 where id = 1;
-select * from t1 left join (t2 left join t3 on t2.fk_t3 = t3.id) on t1.fk_t2 = t2.id;
-drop table t1, t2, t3;
-# Trigger which assigns value selected from table to field of row
-# being inserted/updated.
-create table t1 (id int primary key, copy int);
-create table t2 (id int primary key, data int);
-insert into t2 values (1,1), (2,2);
-create trigger t1_bi before insert on t1 for each row
- set new.copy= (select data from t2 where id = new.id);
-create trigger t1_bu before update on t1 for each row
- set new.copy= (select data from t2 where id = new.id);
-insert into t1 values (1,3), (2,4), (3,3);
-update t1 set copy= 1 where id = 2;
-select * from t1;
-drop table t1, t2;
-
-#
-# Test of wrong column specifiers in triggers
-#
-create table t1 (i int);
-create table t3 (i int);
-
---error ER_TRG_NO_SUCH_ROW_IN_TRG
-create trigger trg before insert on t1 for each row set @a:= old.i;
---error ER_TRG_NO_SUCH_ROW_IN_TRG
-create trigger trg before delete on t1 for each row set @a:= new.i;
---error ER_TRG_CANT_CHANGE_ROW
-create trigger trg before update on t1 for each row set old.i:=1;
---error ER_TRG_NO_SUCH_ROW_IN_TRG
-create trigger trg before delete on t1 for each row set new.i:=1;
---error ER_TRG_CANT_CHANGE_ROW
-create trigger trg after update on t1 for each row set new.i:=1;
---error ER_BAD_FIELD_ERROR
-create trigger trg before update on t1 for each row set new.j:=1;
---error ER_BAD_FIELD_ERROR
-create trigger trg before update on t1 for each row set @a:=old.j;
-
-
-#
-# Let us test various trigger creation errors
-# Also quickly test table namespace (bug#5892/6182)
-#
---error ER_NO_SUCH_TABLE
-create trigger trg before insert on t2 for each row set @a:=1;
-
-create trigger trg before insert on t1 for each row set @a:=1;
---error ER_TRG_ALREADY_EXISTS
-create trigger trg after insert on t1 for each row set @a:=1;
-create trigger trg2 before insert on t1 for each row set @a:=1;
-drop trigger trg2;
---error ER_TRG_ALREADY_EXISTS
-create trigger trg before insert on t3 for each row set @a:=1;
-create trigger trg2 before insert on t3 for each row set @a:=1;
-drop trigger trg2;
-drop trigger trg;
-
---error ER_TRG_DOES_NOT_EXIST
-drop trigger trg;
-
-create view v1 as select * from t1;
---error ER_WRONG_OBJECT
-create trigger trg before insert on v1 for each row set @a:=1;
-drop view v1;
-
-drop table t1;
-drop table t3;
-
-create temporary table t1 (i int);
---error ER_TRG_ON_VIEW_OR_TEMP_TABLE
-create trigger trg before insert on t1 for each row set @a:=1;
-drop table t1;
-
-
-
-#
-# Tests for various trigger-related bugs
-#
-
-# Test for bug #5887 "Triggers with string literals cause errors".
-# New .FRM parser was not handling escaped strings properly.
-create table t1 (x1col char);
-create trigger tx1 before insert on t1 for each row set new.x1col = 'x';
-insert into t1 values ('y');
-drop trigger tx1;
-drop table t1;
-
-#
-# Test for bug #5890 "Triggers fail for DELETE without WHERE".
-# If we are going to delete all rows in table but DELETE triggers exist
-# we should perform row-by-row deletion instead of using optimized
-# delete_all_rows() method.
-#
-create table t1 (i int) engine=myisam;
-insert into t1 values (1), (2);
-create trigger trg1 before delete on t1 for each row set @del_before:= @del_before + old.i;
-create trigger trg2 after delete on t1 for each row set @del_after:= @del_after + old.i;
-set @del_before:=0, @del_after:= 0;
-delete from t1;
-select @del_before, @del_after;
-drop trigger trg1;
-drop trigger trg2;
-drop table t1;
-
-# Test for bug #5859 "DROP TABLE does not drop triggers". Trigger should not
-# magically reappear when we recreate dropped table.
-create table t1 (a int);
-create trigger trg1 before insert on t1 for each row set new.a= 10;
-drop table t1;
-create table t1 (a int);
-insert into t1 values ();
-select * from t1;
-drop table t1;
-
-# Test for bug #6559 "DROP DATABASE forgets to drop triggers".
-create database mysqltest;
-use mysqltest;
-create table t1 (i int);
-create trigger trg1 before insert on t1 for each row set @a:= 1;
-# This should succeed
-drop database mysqltest;
-use test;
-
-# Test for bug #8791
-# "Triggers: Allowed to create triggers on a subject table in a different DB".
-create database mysqltest;
-create table mysqltest.t1 (i int);
---error ER_TRG_IN_WRONG_SCHEMA
-create trigger trg1 before insert on mysqltest.t1 for each row set @a:= 1;
-use mysqltest;
---error ER_NO_SUCH_TABLE
-create trigger test.trg1 before insert on t1 for each row set @a:= 1;
-drop database mysqltest;
-use test;
-
-
-# Test for bug #5860 "Multi-table UPDATE does not activate update triggers"
-# We will also test how delete triggers wor for multi-table DELETE.
-create table t1 (i int, j int default 10, k int not null, key (k));
-create table t2 (i int);
-insert into t1 (i, k) values (1, 1);
-insert into t2 values (1);
-create trigger trg1 before update on t1 for each row set @a:= @a + new.j - old.j;
-create trigger trg2 after update on t1 for each row set @b:= "Fired";
-set @a:= 0, @b:= "";
-# Check that trigger works in case of update on the fly
-update t1, t2 set j = j + 10 where t1.i = t2.i;
-select @a, @b;
-insert into t1 values (2, 13, 2);
-insert into t2 values (2);
-set @a:= 0, @b:= "";
-# And now let us check that triggers work in case of multi-update which
-# is done through temporary tables...
-update t1, t2 set j = j + 15 where t1.i = t2.i and t1.k >= 2;
-select @a, @b;
-# Let us test delete triggers for multi-delete now.
-# We create triggers for both tables because we want test how they
-# work in both on-the-fly and via-temp-tables cases.
-create trigger trg3 before delete on t1 for each row set @c:= @c + old.j;
-create trigger trg4 before delete on t2 for each row set @d:= @d + old.i;
-create trigger trg5 after delete on t1 for each row set @e:= "After delete t1 fired";
-create trigger trg6 after delete on t2 for each row set @f:= "After delete t2 fired";
-set @c:= 0, @d:= 0, @e:= "", @f:= "";
-delete t1, t2 from t1, t2 where t1.i = t2.i;
-select @c, @d, @e, @f;
-# This also will drop triggers
-drop table t1, t2;
-
-# Test for bug #6812 "Triggers are not activated for INSERT ... SELECT".
-# (We also check the fact that trigger modifies some field does not affect
-# value of next record inserted).
-delimiter |;
-create table t1 (i int, j int default 10)|
-create table t2 (i int)|
-insert into t2 values (1), (2)|
-create trigger trg1 before insert on t1 for each row
-begin
- if new.i = 1 then
- set new.j := 1;
- end if;
-end|
-create trigger trg2 after insert on t1 for each row set @a:= 1|
-set @a:= 0|
-insert into t1 (i) select * from t2|
-select * from t1|
-select @a|
-# This also will drop triggers
-drop table t1, t2|
-delimiter ;|
-
-# Test for bug #8755 "Trigger is not activated by LOAD DATA"
-create table t1 (i int, j int, k int);
-create trigger trg1 before insert on t1 for each row set new.k = new.i;
-create trigger trg2 after insert on t1 for each row set @b:= "Fired";
-set @b:="";
-# Test triggers with file with separators
-load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@a, i);
-select *, @b from t1;
-set @b:="";
-# Test triggers with fixed size row file
-load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, j);
-select *, @b from t1;
-# This also will drop triggers
-drop table t1;
-
-# Test for bug #5894 "Triggers with altered tables cause corrupt databases"
-# Also tests basic error handling for various kinds of triggers.
-create table t1 (i int, at int, k int, key(k)) engine=myisam;
-create table t2 (i int);
-insert into t1 values (1, 1, 1);
-# We need at least 3 elements in t2 to test multi-update properly
-insert into t2 values (1), (2), (3);
-# Create and then break "after" triggers
-create trigger ai after insert on t1 for each row set @a:= new.at;
-create trigger au after update on t1 for each row set @a:= new.at;
-create trigger ad after delete on t1 for each row set @a:= old.at;
-alter table t1 drop column at;
-# We still should be able select data from tables.
-select * from t1;
-# The following statements changing t1 should fail, but still cause
-# their main effect. This is because operation on the table row is
-# executed before "after" trigger and its effect cannot be rolled back
-# when whole statement fails, because t1 is MyISAM table.
---error ER_BAD_FIELD_ERROR
-insert into t1 values (2, 1);
-select * from t1;
---error ER_BAD_FIELD_ERROR
-update t1 set k = 2 where i = 2;
-select * from t1;
---error ER_BAD_FIELD_ERROR
-delete from t1 where i = 2;
-select * from t1;
-# Should fail and insert only 1 row
---error ER_BAD_FIELD_ERROR
-load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, k);
-select * from t1;
---error ER_BAD_FIELD_ERROR
-insert into t1 select 3, 3;
-select * from t1;
-# Multi-update working on the fly, again it will update only
-# one row even if more matches
---error ER_BAD_FIELD_ERROR
-update t1, t2 set k = k + 10 where t1.i = t2.i;
-select * from t1;
-# The same for multi-update via temp table
---error ER_BAD_FIELD_ERROR
-update t1, t2 set k = k + 10 where t1.i = t2.i and k < 3;
-select * from t1;
-# Multi-delete on the fly
---error ER_BAD_FIELD_ERROR
-delete t1, t2 from t1 straight_join t2 where t1.i = t2.i;
-select * from t1;
-# And via temporary storage
---error ER_BAD_FIELD_ERROR
-delete t2, t1 from t2 straight_join t1 where t1.i = t2.i;
-select * from t1;
-# Prepare table for testing of REPLACE and INSERT ... ON DUPLICATE KEY UPDATE
-alter table t1 add primary key (i);
---error ER_BAD_FIELD_ERROR
-insert into t1 values (3, 4) on duplicate key update k= k + 10;
-select * from t1;
-# The following statement will delete old row and won't
-# insert new one since after delete trigger will fail.
---error ER_BAD_FIELD_ERROR
-replace into t1 values (3, 3);
-select * from t1;
-# Also drops all triggers
-drop table t1, t2;
-
-create table t1 (i int, bt int, k int, key(k)) engine=myisam;
-create table t2 (i int);
-insert into t1 values (1, 1, 1), (2, 2, 2);
-insert into t2 values (1), (2), (3);
-# Create and then break "before" triggers
-create trigger bi before insert on t1 for each row set @a:= new.bt;
-create trigger bu before update on t1 for each row set @a:= new.bt;
-create trigger bd before delete on t1 for each row set @a:= old.bt;
-alter table t1 drop column bt;
-# The following statements changing t1 should fail and should not
-# cause any effect on table, since "before" trigger is executed
-# before operation on the table row.
---error ER_BAD_FIELD_ERROR
-insert into t1 values (3, 3);
-select * from t1;
---error ER_BAD_FIELD_ERROR
-update t1 set i = 2;
-select * from t1;
---error ER_BAD_FIELD_ERROR
-delete from t1;
-select * from t1;
---error ER_BAD_FIELD_ERROR
-load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, k);
-select * from t1;
---error ER_BAD_FIELD_ERROR
-insert into t1 select 3, 3;
-select * from t1;
-# Both types of multi-update (on the fly and via temp table)
---error ER_BAD_FIELD_ERROR
-update t1, t2 set k = k + 10 where t1.i = t2.i;
-select * from t1;
---error ER_BAD_FIELD_ERROR
-update t1, t2 set k = k + 10 where t1.i = t2.i and k < 2;
-select * from t1;
-# Both types of multi-delete
---error ER_BAD_FIELD_ERROR
-delete t1, t2 from t1 straight_join t2 where t1.i = t2.i;
-select * from t1;
---error ER_BAD_FIELD_ERROR
-delete t2, t1 from t2 straight_join t1 where t1.i = t2.i;
-select * from t1;
-# Let us test REPLACE/INSERT ... ON DUPLICATE KEY UPDATE.
-# To test properly code-paths different from those that are used
-# in ordinary INSERT we need to drop "before insert" trigger.
-alter table t1 add primary key (i);
-drop trigger bi;
---error ER_BAD_FIELD_ERROR
-insert into t1 values (2, 4) on duplicate key update k= k + 10;
-select * from t1;
---error ER_BAD_FIELD_ERROR
-replace into t1 values (2, 4);
-select * from t1;
-# Also drops all triggers
-drop table t1, t2;
-
-# Test for bug #5893 "Triggers with dropped functions cause crashes"
-# Appropriate error should be reported instead of crash.
-# Also test for bug #11889 "Server crashes when dropping trigger
-# using stored routine".
---disable_warnings
-drop function if exists bug5893;
---enable_warnings
-create table t1 (col1 int, col2 int);
-insert into t1 values (1, 2);
-create function bug5893 () returns int return 5;
-create trigger t1_bu before update on t1 for each row set new.col1= bug5893();
-drop function bug5893;
---error ER_SP_DOES_NOT_EXIST
-update t1 set col2 = 4;
-# This should not crash server too.
-drop trigger t1_bu;
-drop table t1;
-
-#
-# storing and restoring parsing modes for triggers (BUG#5891)
-#
-set sql_mode='ansi';
-create table t1 ("t1 column" int);
-create trigger t1_bi before insert on t1 for each row set new."t1 column" = 5;
-set sql_mode="";
-insert into t1 values (0);
-# create trigger with different sql_mode
-create trigger t1_af after insert on t1 for each row set @a=10;
-insert into t1 values (0);
-select * from t1;
-select @a;
---replace_column 6 #
-show triggers;
-drop table t1;
-# check that rigger preserve sql_mode during execution
-set sql_mode="traditional";
-create table t1 (a date);
--- error 1292
-insert into t1 values ('2004-01-00');
-set sql_mode="";
-create trigger t1_bi before insert on t1 for each row set new.a = '2004-01-00';
-set sql_mode="traditional";
-insert into t1 values ('2004-01-01');
-select * from t1;
-set sql_mode=default;
-show create table t1;
---replace_column 6 #
-show triggers;
-drop table t1;
-
-# Test for bug #12280 "Triggers: crash if flush tables"
-# FLUSH TABLES and FLUSH PRIVILEGES should be disallowed inside
-# of functions and triggers.
-create table t1 (id int);
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create trigger t1_ai after insert on t1 for each row reset query cache;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create trigger t1_ai after insert on t1 for each row reset master;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create trigger t1_ai after insert on t1 for each row reset slave;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create trigger t1_ai after insert on t1 for each row flush hosts;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create trigger t1_ai after insert on t1 for each row flush tables with read lock;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create trigger t1_ai after insert on t1 for each row flush logs;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create trigger t1_ai after insert on t1 for each row flush status;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create trigger t1_ai after insert on t1 for each row flush slave;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create trigger t1_ai after insert on t1 for each row flush master;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create trigger t1_ai after insert on t1 for each row flush des_key_file;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create trigger t1_ai after insert on t1 for each row flush user_resources;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create trigger t1_ai after insert on t1 for each row flush tables;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-create trigger t1_ai after insert on t1 for each row flush privileges;
---disable_warnings
-drop procedure if exists p1;
---enable_warnings
-
-create trigger t1_ai after insert on t1 for each row call p1();
-create procedure p1() flush tables;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-insert into t1 values (0);
-
-drop procedure p1;
-create procedure p1() reset query cache;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-insert into t1 values (0);
-
-drop procedure p1;
-create procedure p1() reset master;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-insert into t1 values (0);
-
-drop procedure p1;
-create procedure p1() reset slave;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-insert into t1 values (0);
-
-drop procedure p1;
-create procedure p1() flush hosts;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-insert into t1 values (0);
-
-drop procedure p1;
-create procedure p1() flush privileges;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-insert into t1 values (0);
-
-drop procedure p1;
-create procedure p1() flush tables with read lock;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-insert into t1 values (0);
-
-drop procedure p1;
-create procedure p1() flush tables;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-insert into t1 values (0);
-
-drop procedure p1;
-create procedure p1() flush logs;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-insert into t1 values (0);
-
-drop procedure p1;
-create procedure p1() flush status;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-insert into t1 values (0);
-
-drop procedure p1;
-create procedure p1() flush slave;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-insert into t1 values (0);
-
-drop procedure p1;
-create procedure p1() flush master;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-insert into t1 values (0);
-
-drop procedure p1;
-create procedure p1() flush des_key_file;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-insert into t1 values (0);
-
-drop procedure p1;
-create procedure p1() flush user_resources;
---error ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG
-insert into t1 values (0);
-
-drop procedure p1;
-drop table t1;
-
-# Test for bug #11973 "SELECT .. INTO var_name; in trigger cause
-# crash on update"
-
-create table t1 (id int, data int, username varchar(16));
-insert into t1 (id, data) values (1, 0);
-delimiter |;
-create trigger t1_whoupdated before update on t1 for each row
-begin
- declare user varchar(32);
- declare i int;
- select user() into user;
- set NEW.username = user;
- select count(*) from ((select 1) union (select 2)) as d1 into i;
-end|
-delimiter ;|
-update t1 set data = 1;
-
-connection addconroot1;
-update t1 set data = 2;
-
-connection default;
-drop table t1;
-
-#
-# #11587 Trigger causes lost connection error
-#
-
-create table t1 (c1 int, c2 datetime);
-delimiter |;
---error ER_SP_NO_RETSET
-create trigger tr1 before insert on t1 for each row
-begin
- set new.c2= '2004-04-01';
- select 'hello';
-end|
-delimiter ;|
-
-insert into t1 (c1) values (1),(2),(3);
-select * from t1;
-
---disable_warnings
-drop procedure if exists bug11587;
---enable_warnings
-
-delimiter |;
-create procedure bug11587(x char(16))
-begin
- select "hello";
- select "hello again";
-end|
-
-create trigger tr1 before insert on t1 for each row
-begin
- call bug11587();
- set new.c2= '2004-04-02';
-end|
-delimiter ;|
-
---error ER_SP_NO_RETSET
-insert into t1 (c1) values (4),(5),(6);
-select * from t1;
-
-drop procedure bug11587;
-drop table t1;
-
-# Test for bug #11896 "Partial locking in case of recursive trigger
-# definitions". Recursion in triggers should not be allowed.
-# We also should not allow to change tables which are used in
-# statements invoking this trigger.
-create table t1 (f1 integer);
-create table t2 (f2 integer);
-create trigger t1_ai after insert on t1
- for each row insert into t2 values (new.f1+1);
-create trigger t2_ai after insert on t2
- for each row insert into t1 values (new.f2+1);
-# Allow SP resursion to be show that it has not influence here
-set @SAVE_SP_RECURSION_LEVELS=@@max_sp_recursion_depth;
-set @@max_sp_recursion_depth=100;
---error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
-insert into t1 values (1);
-set @@max_sp_recursion_depth=@SAVE_SP_RECURSION_LEVELS;
-select * from t1;
-select * from t2;
-drop trigger t1_ai;
-drop trigger t2_ai;
-create trigger t1_bu before update on t1
- for each row insert into t1 values (2);
---error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
-update t1 set f1= 10;
-select * from t1;
-drop trigger t1_bu;
-create trigger t1_bu before update on t1
- for each row delete from t1 where f1=new.f1;
---error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
-update t1 set f1= 10;
-select * from t1;
-drop trigger t1_bu;
-# This should work tough
-create trigger t1_bi before insert on t1
- for each row set new.f1=(select sum(f1) from t1);
-insert into t1 values (3);
-select * from t1;
-drop trigger t1_bi;
-drop tables t1, t2;
-
-# Tests for bug #12704 "Server crashes during trigger execution".
-# If we run DML statements and CREATE TRIGGER statements concurrently
-# it may happen that trigger will be created while DML statement is
-# waiting for table lock. In this case we have to reopen tables and
-# recalculate prelocking set.
-# Unfortunately these tests rely on the order in which tables are locked
-# by statement so they are non determenistic and are disabled.
---disable_parsing
-create table t1 (id int);
-create table t2 (id int);
-create table t3 (id int);
-create function f1() returns int return (select max(id)+2 from t2);
-create view v1 as select f1() as f;
-
-# Let us check that we notice trigger at all
-connection addconroot1;
-lock tables t2 write;
-connection default;
-send insert into t1 values ((select max(id) from t2)), (2);
---sleep 1
-connection addconroot2;
-create trigger t1_trg before insert on t1 for each row set NEW.id:= 1;
-connection addconroot1;
-unlock tables;
-connection default;
-reap;
-select * from t1;
-
-# Check that we properly calculate new prelocking set
-insert into t2 values (3);
-connection addconroot1;
-lock tables t2 write;
-connection default;
-send insert into t1 values ((select max(id) from t2)), (4);
---sleep 1
-connection addconroot2;
-drop trigger t1_trg;
-create trigger t1_trg before insert on t1 for each row
- insert into t3 values (new.id);
-connection addconroot1;
-unlock tables;
-connection default;
-reap;
-select * from t1;
-select * from t3;
-
-# We should be able to do this even if fancy views are involved
-connection addconroot1;
-lock tables t2 write;
-connection default;
-send insert into t1 values ((select max(f) from v1)), (6);
---sleep 1
-connection addconroot2;
-drop trigger t1_trg;
-create trigger t1_trg before insert on t1 for each row
- insert into t3 values (new.id + 100);
-connection addconroot1;
-unlock tables;
-connection default;
-reap;
-select * from t1;
-select * from t3;
-
-# This also should work for multi-update
-# Let us drop trigger to demonstrate that prelocking set is really
-# rebuilt
-drop trigger t1_trg;
-connection addconroot1;
-lock tables t2 write;
-connection default;
-send update t1, t2 set t1.id=10 where t1.id=t2.id;
---sleep 1
-connection addconroot2;
-create trigger t1_trg before update on t1 for each row
- insert into t3 values (new.id);
-connection addconroot1;
-unlock tables;
-connection default;
-reap;
-select * from t1;
-select * from t3;
-
-# And even for multi-update converted from ordinary update thanks to view
-drop view v1;
-drop trigger t1_trg;
-create view v1 as select t1.id as id1 from t1, t2 where t1.id= t2.id;
-insert into t2 values (10);
-connection addconroot1;
-lock tables t2 write;
-connection default;
-send update v1 set id1= 11;
---sleep 1
-connection addconroot2;
-create trigger t1_trg before update on t1 for each row
- insert into t3 values (new.id + 100);
-connection addconroot1;
-unlock tables;
-connection default;
-reap;
-select * from t1;
-select * from t3;
-
-drop function f1;
-drop view v1;
-drop table t1, t2, t3;
---enable_parsing
-
-#
-# Test for bug #13399 "Crash when executing PS/SP which should activate
-# trigger which is now dropped". See also test for similar bug for stored
-# routines in sp-error.test (#12329).
-create table t1 (id int);
-create table t2 (id int);
-create trigger t1_bi before insert on t1 for each row insert into t2 values (new.id);
-prepare stmt1 from "insert into t1 values (10)";
-create procedure p1() insert into t1 values (10);
-call p1();
-# Actually it is enough to do FLUSH TABLES instead of DROP TRIGGER
-drop trigger t1_bi;
-# Server should not crash on these two statements
-execute stmt1;
-call p1();
-deallocate prepare stmt1;
-drop procedure p1;
-
-# Let us test more complex situation when we alter trigger in such way that
-# it uses different set of tables (or simply add new trigger).
-create table t3 (id int);
-create trigger t1_bi after insert on t1 for each row insert into t2 values (new.id);
-prepare stmt1 from "insert into t1 values (10)";
-create procedure p1() insert into t1 values (10);
-call p1();
-# Altering trigger forcing it use different set of tables
-drop trigger t1_bi;
-create trigger t1_bi after insert on t1 for each row insert into t3 values (new.id);
-execute stmt1;
-call p1();
-deallocate prepare stmt1;
-drop procedure p1;
-drop table t1, t2, t3;
-
-#
-# BUG#13549 "Server crash with nested stored procedures".
-# Server should not crash when during execution of stored procedure
-# we have to parse trigger/function definition and this new trigger/
-# function has more local variables declared than invoking stored
-# procedure and last of these variables is used in argument of NOT
-# operator.
-#
-create table t1 (a int);
-DELIMITER //;
-CREATE PROCEDURE `p1`()
-begin
- insert into t1 values (1);
-end//
-create trigger trg before insert on t1 for each row
-begin
- declare done int default 0;
- set done= not done;
-end//
-DELIMITER ;//
-CALL p1();
-drop procedure p1;
-drop table t1;
-
-#
-# Test for bug #14863 "Triggers: crash if create and there is no current
-# database". We should not crash and give proper error when database for
-# trigger or its table is not specified and there is no current database.
-#
-connection addconwithoutdb;
---error ER_NO_DB_ERROR
-create trigger t1_bi before insert on test.t1 for each row set @a:=0;
---error ER_NO_SUCH_TABLE
-create trigger test.t1_bi before insert on t1 for each row set @a:=0;
---error ER_NO_DB_ERROR
-drop trigger t1_bi;
-connection default;
-
-#
-# Tests for bug #13525 "Rename table does not keep info of triggers"
-# and bug #17866 "Problem with renaming table with triggers with fully
-# qualified subject table".
-#
-create table t1 (id int);
-create trigger t1_bi before insert on t1 for each row set @a:=new.id;
-create trigger t1_ai after insert on test.t1 for each row set @b:=new.id;
-insert into t1 values (101);
-select @a, @b;
-select trigger_schema, trigger_name, event_object_schema,
- event_object_table, action_statement from information_schema.triggers
- where event_object_schema = 'test';
-rename table t1 to t2;
-# Trigger should work after rename
-insert into t2 values (102);
-select @a, @b;
-select trigger_schema, trigger_name, event_object_schema,
- event_object_table, action_statement from information_schema.triggers
- where event_object_schema = 'test';
-# Let us check that the same works for simple ALTER TABLE ... RENAME
-alter table t2 rename to t3;
-insert into t3 values (103);
-select @a, @b;
-select trigger_schema, trigger_name, event_object_schema,
- event_object_table, action_statement from information_schema.triggers
- where event_object_schema = 'test';
-# And for more complex ALTER TABLE
-alter table t3 rename to t4, add column val int default 0;
-insert into t4 values (104, 1);
-select @a, @b;
-select trigger_schema, trigger_name, event_object_schema,
- event_object_table, action_statement from information_schema.triggers
- where event_object_schema = 'test';
-# .TRN file should be updated with new table name
-drop trigger t1_bi;
-drop trigger t1_ai;
-drop table t4;
-# Rename between different databases if triggers exist should fail
-create database mysqltest;
-use mysqltest;
-create table t1 (id int);
-create trigger t1_bi before insert on t1 for each row set @a:=new.id;
-insert into t1 values (101);
-select @a;
-select trigger_schema, trigger_name, event_object_schema,
- event_object_table, action_statement from information_schema.triggers
- where event_object_schema = 'test' or event_object_schema = 'mysqltest';
---error ER_TRG_IN_WRONG_SCHEMA
-rename table t1 to test.t2;
-insert into t1 values (102);
-select @a;
-select trigger_schema, trigger_name, event_object_schema,
- event_object_table, action_statement from information_schema.triggers
- where event_object_schema = 'test' or event_object_schema = 'mysqltest';
-# There should be no fantom .TRN files
---error ER_TRG_DOES_NOT_EXIST
-drop trigger test.t1_bi;
-# Let us also check handling of this restriction in ALTER TABLE ... RENAME
---error ER_TRG_IN_WRONG_SCHEMA
-alter table t1 rename to test.t1;
-insert into t1 values (103);
-select @a;
-select trigger_schema, trigger_name, event_object_schema,
- event_object_table, action_statement from information_schema.triggers
- where event_object_schema = 'test' or event_object_schema = 'mysqltest';
-# Again there should be no fantom .TRN files
---error ER_TRG_DOES_NOT_EXIST
-drop trigger test.t1_bi;
---error ER_TRG_IN_WRONG_SCHEMA
-alter table t1 rename to test.t1, add column val int default 0;
-insert into t1 values (104);
-select @a;
-select trigger_schema, trigger_name, event_object_schema,
- event_object_table, action_statement from information_schema.triggers
- where event_object_schema = 'test' or event_object_schema = 'mysqltest';
-# Table definition should not change
-show create table t1;
-# And once again check for fantom .TRN files
---error ER_TRG_DOES_NOT_EXIST
-drop trigger test.t1_bi;
-drop trigger t1_bi;
-drop table t1;
-drop database mysqltest;
-use test;
-# And now let us check that the properly handle rename if there is some
-# error during it (that we rollback such renames completely).
-create table t1 (id int);
-create trigger t1_bi before insert on t1 for each row set @a:=new.id;
-create trigger t1_ai after insert on t1 for each row set @b:=new.id;
-insert into t1 values (101);
-select @a, @b;
-select trigger_schema, trigger_name, event_object_schema,
- event_object_table, action_statement from information_schema.triggers
- where event_object_schema = 'test';
-# Trick which makes update of second .TRN file impossible
-let $MYSQLD_DATADIR= `select @@datadir`;
-write_file $MYSQLD_DATADIR/test/t1_ai.TRN~;
-dummy
-EOF
-chmod 0000 $MYSQLD_DATADIR/test/t1_ai.TRN~;
-# Normalize the datadir path; the embedded server doesn't chdir to datadir
---replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
---error 1
-rename table t1 to t2;
-# 't1' should be still there and triggers should work correctly
-insert into t1 values (102);
-select @a, @b;
-select trigger_schema, trigger_name, event_object_schema,
- event_object_table, action_statement from information_schema.triggers
- where event_object_schema = 'test';
-chmod 0600 $MYSQLD_DATADIR/test/t1_ai.TRN~;
-remove_file $MYSQLD_DATADIR/test/t1_ai.TRN~;
-# Let us check that updates to .TRN files were rolled back too
-drop trigger t1_bi;
-drop trigger t1_ai;
-drop table t1;
-
-# Test for bug #16829 "Firing trigger with RETURN crashes the server"
-# RETURN is not supposed to be used anywhere except functions, so error
-# should be returned when one attempts to create trigger with RETURN.
-create table t1 (i int);
---error ER_SP_BADRETURN
-create trigger t1_bi before insert on t1 for each row return 0;
-insert into t1 values (1);
-drop table t1;
-
-# Test for bug #17764 "Trigger crashes MyISAM table"
-#
-# Table was reported as crashed when it was subject table of trigger invoked
-# by insert statement which was executed with enabled bulk insert mode (which
-# is actually set of optimizations enabled by handler::start_bulk_insert())
-# and this trigger also explicitly referenced it.
-# The same problem arose when table to which bulk insert was done was also
-# referenced in function called by insert statement.
-create table t1 (a varchar(64), b int);
-create table t2 like t1;
-create trigger t1_ai after insert on t1 for each row
- set @a:= (select max(a) from t1);
-insert into t1 (a) values
- ("Twas"),("brillig"),("and"),("the"),("slithy"),("toves"),
- ("Did"),("gyre"),("and"),("gimble"),("in"),("the"),("wabe");
-create trigger t2_ai after insert on t2 for each row
- set @a:= (select max(a) from t2);
-insert into t2 select * from t1;
-load data infile '../../std_data/words.dat' into table t1 (a);
-drop trigger t1_ai;
-drop trigger t2_ai;
-# Test that the problem for functions is fixed as well
-create function f1() returns int return (select max(b) from t1);
-insert into t1 values
- ("All",f1()),("mimsy",f1()),("were",f1()),("the",f1()),("borogoves",f1()),
- ("And",f1()),("the",f1()),("mome", f1()),("raths",f1()),("outgrabe",f1());
-create function f2() returns int return (select max(b) from t2);
-insert into t2 select a, f2() from t1;
-load data infile '../../std_data/words.dat' into table t1 (a) set b:= f1();
-drop function f1;
-drop function f2;
-drop table t1, t2;
-
-#
-# Test for bug #16021 "Wrong index given to function in trigger" which
-# was caused by the same bulk insert optimization as bug #17764 but had
-# slightly different symptoms (instead of reporting table as crashed
-# storage engine reported error number 124)
-#
-create table t1(i int not null, j int not null, n numeric(15,2), primary key(i,j));
-create table t2(i int not null, n numeric(15,2), primary key(i));
-delimiter |;
-create trigger t1_ai after insert on t1 for each row
-begin
- declare sn numeric(15,2);
- select sum(n) into sn from t1 where i=new.i;
- replace into t2 values(new.i, sn);
-end|
-delimiter ;|
-insert into t1 values
- (1,1,10.00),(1,2,10.00),(1,3,10.00),(1,4,10.00),(1,5,10.00),
- (1,6,10.00),(1,7,10.00),(1,8,10.00),(1,9,10.00),(1,10,10.00),
- (1,11,10.00),(1,12,10.00),(1,13,10.00),(1,14,10.00),(1,15,10.00);
-select * from t1;
-select * from t2;
-drop tables t1, t2;
-
-#
-# Test for Bug #16461 connection_id() does not work properly inside trigger
-#
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (
- conn_id INT,
- trigger_conn_id INT
-);
-CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
- SET NEW.trigger_conn_id = CONNECTION_ID();
-
-INSERT INTO t1 (conn_id, trigger_conn_id) VALUES (CONNECTION_ID(), -1);
-
-connect (con1,localhost,root,,);
-INSERT INTO t1 (conn_id, trigger_conn_id) VALUES (CONNECTION_ID(), -1);
-connection default;
-disconnect con1;
-
-SELECT * FROM t1 WHERE conn_id != trigger_conn_id;
-
-DROP TRIGGER t1_bi;
-DROP TABLE t1;
-
-
-#
-# Bug#6951: Triggers/Traditional: SET @ result wrong
-#
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (i1 INT);
-
-SET @save_sql_mode=@@sql_mode;
-
-SET SQL_MODE='';
-
-CREATE TRIGGER t1_ai AFTER INSERT ON t1 FOR EACH ROW
- SET @x = 5/0;
-
-SET SQL_MODE='traditional';
-
-CREATE TRIGGER t1_au AFTER UPDATE ON t1 FOR EACH ROW
- SET @x = 5/0;
-
-SET @x=1;
-INSERT INTO t1 VALUES (@x);
-SELECT @x;
-
-SET @x=2;
-UPDATE t1 SET i1 = @x;
-SELECT @x;
-
-SET SQL_MODE='';
-
-SET @x=3;
-INSERT INTO t1 VALUES (@x);
-SELECT @x;
-
-SET @x=4;
-UPDATE t1 SET i1 = @x;
-SELECT @x;
-
-SET @@sql_mode=@save_sql_mode;
-
-DROP TRIGGER t1_ai;
-DROP TRIGGER t1_au;
-DROP TABLE t1;
-
-
-#
-# Test for bug #14635 Accept NEW.x as INOUT parameters to stored
-# procedures from within triggers
-#
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP PROCEDURE IF EXISTS p1;
-DROP PROCEDURE IF EXISTS p2;
---enable_warnings
-
-CREATE TABLE t1 (i1 INT);
-
-# Check that NEW.x pseudo variable is accepted as INOUT and OUT
-# parameter to stored routine.
-INSERT INTO t1 VALUES (3);
-CREATE PROCEDURE p1(OUT i1 INT) DETERMINISTIC NO SQL SET i1 = 5;
-CREATE PROCEDURE p2(INOUT i1 INT) DETERMINISTIC NO SQL SET i1 = i1 * 7;
-delimiter //;
-CREATE TRIGGER t1_bu BEFORE UPDATE ON t1 FOR EACH ROW
-BEGIN
- CALL p1(NEW.i1);
- CALL p2(NEW.i1);
-END//
-delimiter ;//
-UPDATE t1 SET i1 = 11 WHERE i1 = 3;
-DROP TRIGGER t1_bu;
-DROP PROCEDURE p2;
-DROP PROCEDURE p1;
-
-# Check that OLD.x pseudo variable is not accepted as INOUT and OUT
-# parameter to stored routine.
-INSERT INTO t1 VALUES (13);
-CREATE PROCEDURE p1(OUT i1 INT) DETERMINISTIC NO SQL SET @a = 17;
-CREATE TRIGGER t1_bu BEFORE UPDATE ON t1 FOR EACH ROW
- CALL p1(OLD.i1);
---error ER_SP_NOT_VAR_ARG
-UPDATE t1 SET i1 = 19 WHERE i1 = 13;
-DROP TRIGGER t1_bu;
-DROP PROCEDURE p1;
-
-INSERT INTO t1 VALUES (23);
-CREATE PROCEDURE p1(INOUT i1 INT) DETERMINISTIC NO SQL SET @a = i1 * 29;
-CREATE TRIGGER t1_bu BEFORE UPDATE ON t1 FOR EACH ROW
- CALL p1(OLD.i1);
---error ER_SP_NOT_VAR_ARG
-UPDATE t1 SET i1 = 31 WHERE i1 = 23;
-DROP TRIGGER t1_bu;
-DROP PROCEDURE p1;
-
-# Check that NEW.x pseudo variable is read-only in the AFTER TRIGGER.
-INSERT INTO t1 VALUES (37);
-CREATE PROCEDURE p1(OUT i1 INT) DETERMINISTIC NO SQL SET @a = 41;
-CREATE TRIGGER t1_au AFTER UPDATE ON t1 FOR EACH ROW
- CALL p1(NEW.i1);
---error ER_SP_NOT_VAR_ARG
-UPDATE t1 SET i1 = 43 WHERE i1 = 37;
-DROP TRIGGER t1_au;
-DROP PROCEDURE p1;
-
-INSERT INTO t1 VALUES (47);
-CREATE PROCEDURE p1(INOUT i1 INT) DETERMINISTIC NO SQL SET @a = i1 * 49;
-CREATE TRIGGER t1_au AFTER UPDATE ON t1 FOR EACH ROW
- CALL p1(NEW.i1);
---error ER_SP_NOT_VAR_ARG
-UPDATE t1 SET i1 = 51 WHERE i1 = 47;
-DROP TRIGGER t1_au;
-DROP PROCEDURE p1;
-
-# Post requisite.
-SELECT * FROM t1;
-
-DROP TABLE t1;
-
-#
-# Bug #18005: Creating a trigger on mysql.event leads to server crash on
-# scheduler startup
-#
-# Bug #18361: Triggers on mysql.user table cause server crash
-#
-# We don't allow triggers on the mysql schema
-delimiter |;
---error ER_NO_TRIGGERS_ON_SYSTEM_SCHEMA
-create trigger wont_work after update on mysql.user for each row
-begin
- set @a:= 1;
-end|
-# Try when we're already using the mysql schema
-use mysql|
---error ER_NO_TRIGGERS_ON_SYSTEM_SCHEMA
-create trigger wont_work after update on event for each row
-begin
- set @a:= 1;
-end|
-use test|
-delimiter ;|
-
-
-#
-# Test for BUG#16899: Possible buffer overflow in handling of DEFINER-clause.
-#
-
-# Prepare.
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP TABLE IF EXISTS t2;
---enable_warnings
-
-CREATE TABLE t1(c INT);
-CREATE TABLE t2(c INT);
-
---error ER_WRONG_STRING_LENGTH
-CREATE DEFINER=longer_than_80_456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789@localhost
- TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1;
-
---error ER_WRONG_STRING_LENGTH
-CREATE DEFINER=some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY
- TRIGGER t2_bi BEFORE INSERT ON t2 FOR EACH ROW SET @a = 2;
-
-# Cleanup.
-
-DROP TABLE t1;
-DROP TABLE t2;
-
-#
-# Bug#20028 Function with select return no data
-#
-
---disable_warnings
-drop table if exists t1;
-drop table if exists t2;
-drop table if exists t3;
-drop table if exists t4;
---enable_warnings
-
-SET @save_sql_mode=@@sql_mode;
-
-delimiter |;
-SET sql_mode='TRADITIONAL'|
-create table t1 (id int(10) not null primary key, v int(10) )|
-create table t2 (id int(10) not null primary key, v int(10) )|
-create table t3 (id int(10) not null primary key, v int(10) )|
-create table t4 (c int)|
-
-create trigger t4_bi before insert on t4 for each row set @t4_bi_called:=1|
-create trigger t4_bu before update on t4 for each row set @t4_bu_called:=1|
-
-insert into t1 values(10, 10)|
-set @a:=1/0|
-select 1/0 from t1|
-
-create trigger t1_bi before insert on t1 for each row set @a:=1/0|
-
-insert into t1 values(20, 20)|
-
-drop trigger t1_bi|
-create trigger t1_bi before insert on t1 for each row
-begin
- insert into t2 values (new.id, new.v);
- update t2 set v=v+1 where id= new.id;
- replace t3 values (new.id, 0);
- update t2, t3 set t2.v=new.v, t3.v=new.v where t2.id=t3.id;
- create temporary table t5 select * from t1;
- delete from t5;
- insert into t5 select * from t1;
- insert into t4 values (0);
- set @check= (select count(*) from t5);
- update t4 set c= @check;
- drop temporary table t5;
-
- set @a:=1/0;
-end|
-
-set @check=0, @t4_bi_called=0, @t4_bu_called=0|
-insert into t1 values(30, 30)|
-select @check, @t4_bi_called, @t4_bu_called|
-
-delimiter ;|
-
-SET @@sql_mode=@save_sql_mode;
-
-drop table t1;
-drop table t2;
-drop table t3;
-drop table t4;
-
-#
-# Bug#20670 "UPDATE using key and invoking trigger that modifies
-# this key does not stop"
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (i int, j int key);
-insert into t1 values (1,1), (2,2), (3,3);
-create trigger t1_bu before update on t1 for each row
- set new.j = new.j + 10;
-# This should not work indefinitely and should cause
-# expected result
-update t1 set i= i+ 10 where j > 2;
-select * from t1;
-drop table t1;
-
-#
-# Bug#23556 TRUNCATE TABLE still maps to DELETE
-#
-CREATE TABLE t1 (a INT PRIMARY KEY);
-CREATE TABLE t2 (a INT PRIMARY KEY);
-INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
-
-CREATE TRIGGER trg_t1 BEFORE DELETE on t1 FOR EACH ROW
- INSERT INTO t2 VALUES (OLD.a);
-
-FLUSH STATUS;
-TRUNCATE t1;
-SHOW STATUS LIKE 'handler_delete';
-SELECT COUNT(*) FROM t2;
-
-INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
-DELETE FROM t2;
-
-FLUSH STATUS;
-DELETE FROM t1;
-SHOW STATUS LIKE 'handler_delete';
-SELECT COUNT(*) FROM t2;
-
-DROP TRIGGER trg_t1;
-DROP TABLE t1,t2;
-
-#
-# Bug #23651 "Server crashes when trigger which uses stored function
-# invoked from different connections".
-#
---disable_warnings
-drop table if exists t1;
-drop function if exists f1;
---enable_warnings
-create table t1 (i int);
-create function f1() returns int return 10;
-create trigger t1_bi before insert on t1 for each row set @a:= f1() + 10;
-insert into t1 values ();
-select @a;
-connection addconroot1;
-insert into t1 values ();
-select @a;
-connection default;
-drop table t1;
-drop function f1;
-
-#
-# Bug#23703: DROP TRIGGER needs an IF EXISTS
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1(a int, b varchar(50));
-
--- error ER_TRG_DOES_NOT_EXIST
-drop trigger not_a_trigger;
-
-drop trigger if exists not_a_trigger;
-
-create trigger t1_bi before insert on t1
-for each row set NEW.b := "In trigger t1_bi";
-
-insert into t1 values (1, "a");
-drop trigger if exists t1_bi;
-insert into t1 values (2, "b");
-drop trigger if exists t1_bi;
-insert into t1 values (3, "c");
-
-select * from t1;
-
-drop table t1;
-
-#
-# Bug#25398: crash when a trigger contains a SELECT with
-# trigger fields in the select list under DISTINCT
-#
-
-CREATE TABLE t1 (
- id int NOT NULL DEFAULT '0',
- a varchar(10) NOT NULL,
- b varchar(10),
- c varchar(10),
- d timestamp NOT NULL,
- PRIMARY KEY (id, a)
-);
-
-CREATE TABLE t2 (
- fubar_id int unsigned NOT NULL DEFAULT '0',
- last_change_time datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- PRIMARY KEY (fubar_id)
-);
-
-DELIMITER |;
-
-CREATE TRIGGER fubar_change
- AFTER UPDATE ON t1
- FOR EACH ROW
- BEGIN
- INSERT INTO t2 (fubar_id, last_change_time)
- SELECT DISTINCT NEW.id AS fubar_id, NOW() AS last_change_time
- FROM t1 WHERE (id = NEW.id) AND (OLD.c != NEW.c)
- ON DUPLICATE KEY UPDATE
- last_change_time =
- IF((fubar_id = NEW.id)AND(OLD.c != NEW.c),NOW(),last_change_time);
- END
-|
-
-DELIMITER ;|
-
-INSERT INTO t1 (id,a, b,c,d) VALUES
- (1,'a','b','c',now()),(2,'a','b','c',now());
-
-UPDATE t1 SET c='Bang!' WHERE id=1;
-
-SELECT fubar_id FROM t2;
-
-DROP TABLE t1,t2;
-
-#
-# Bug#21285 (Incorrect message error deleting records in a table with a
-# trigger for inserting)
-#
-
---disable_warnings
-DROP TABLE IF EXISTS bug21825_A;
-DROP TABLE IF EXISTS bug21825_B;
---enable_warnings
-
-CREATE TABLE bug21825_A (id int(10));
-CREATE TABLE bug21825_B (id int(10));
-
-delimiter //;
-
-CREATE TRIGGER trgA AFTER INSERT ON bug21825_A
-FOR EACH ROW
-BEGIN
- INSERT INTO bug21825_B (id) values (1);
-END//
-delimiter ;//
-
-INSERT INTO bug21825_A (id) VALUES (10);
-INSERT INTO bug21825_A (id) VALUES (20);
-
-DROP TABLE bug21825_B;
-
-# Must pass, the missing table in the insert trigger should not matter.
-DELETE FROM bug21825_A WHERE id = 20;
-
-DROP TABLE bug21825_A;
-
-#
-# Bug#22580 (DROP TABLE in nested stored procedure causes strange dependancy
-# error)
-#
-
---disable_warnings
-DROP TABLE IF EXISTS bug22580_t1;
-DROP PROCEDURE IF EXISTS bug22580_proc_1;
-DROP PROCEDURE IF EXISTS bug22580_proc_2;
---enable_warnings
-
-CREATE TABLE bug22580_t1 (a INT, b INT);
-
-DELIMITER ||;
-
-CREATE PROCEDURE bug22580_proc_2()
-BEGIN
- DROP TABLE IF EXISTS bug22580_tmp;
- CREATE TEMPORARY TABLE bug22580_tmp (a INT);
- DROP TABLE bug22580_tmp;
-END||
-
-CREATE PROCEDURE bug22580_proc_1()
-BEGIN
- CALL bug22580_proc_2();
-END||
-
-CREATE TRIGGER t1bu BEFORE UPDATE ON bug22580_t1
-FOR EACH ROW
-BEGIN
- CALL bug22580_proc_1();
-END||
-
-DELIMITER ;||
-
-# Must pass, the actions of the update trigger should not matter
-INSERT INTO bug22580_t1 VALUES (1,1);
-
-DROP TABLE bug22580_t1;
-DROP PROCEDURE bug22580_proc_1;
-DROP PROCEDURE bug22580_proc_2;
-
-#
-# Bug#27006: AFTER UPDATE triggers not fired with INSERT ... ON DUPLICATE
-#
---disable_warnings
-DROP TRIGGER IF EXISTS trg27006_a_update;
-DROP TRIGGER IF EXISTS trg27006_a_insert;
---enable_warnings
-
-CREATE TABLE t1 (
- `id` int(10) unsigned NOT NULL auto_increment,
- `val` varchar(10) NOT NULL,
- PRIMARY KEY (`id`)
-);
-CREATE TABLE t2 like t1;
-DELIMITER |;
-
-CREATE TRIGGER trg27006_a_insert AFTER INSERT ON t1 FOR EACH ROW
-BEGIN
- insert into t2 values (NULL,new.val);
-END |
-CREATE TRIGGER trg27006_a_update AFTER UPDATE ON t1 FOR EACH ROW
-BEGIN
- insert into t2 values (NULL,new.val);
-END |
-DELIMITER ;|
-
-INSERT INTO t1(val) VALUES ('test1'),('test2');
-SELECT * FROM t1;
-SELECT * FROM t2;
-INSERT INTO t1 VALUES (2,'test2') ON DUPLICATE KEY UPDATE val=VALUES(val);
-INSERT INTO t1 VALUES (2,'test3') ON DUPLICATE KEY UPDATE val=VALUES(val);
-INSERT INTO t1 VALUES (3,'test4') ON DUPLICATE KEY UPDATE val=VALUES(val);
-SELECT * FROM t1;
-SELECT * FROM t2;
-DROP TRIGGER trg27006_a_insert;
-DROP TRIGGER trg27006_a_update;
-drop table t1,t2;
-
-#
-# Bug #20903 "Crash when using CREATE TABLE .. SELECT and triggers"
-#
-
---disable_warnings
-drop table if exists t1, t2, t3;
---enable_warnings
-create table t1 (i int);
-create trigger t1_bi before insert on t1 for each row set new.i = 7;
-create trigger t1_ai after insert on t1 for each row set @a := 7;
-create table t2 (j int);
-insert into t2 values (1), (2);
-set @a:="";
-insert into t1 select * from t2;
-select * from t1;
-select @a;
-# Let us check that trigger that involves table also works ok.
-drop trigger t1_bi;
-drop trigger t1_ai;
-create table t3 (isave int);
-create trigger t1_bi before insert on t1 for each row insert into t3 values (new.i);
-insert into t1 select * from t2;
-select * from t1;
-select * from t3;
-drop table t1, t2, t3;
-
-disconnect addconroot1;
-disconnect addconroot2;
-disconnect addconwithoutdb;
---echo
---echo Bug#28502 Triggers that update another innodb table will block
---echo on X lock unnecessarily
---echo
---echo Ensure we do not open and lock tables for triggers we do not fire.
---echo
---disable_warnings
-drop table if exists t1, t2;
-drop trigger if exists trg_bug28502_au;
---enable_warnings
-
-create table t1 (id int, count int);
-create table t2 (id int);
-delimiter |;
-
-create trigger trg_bug28502_au before update on t2
-for each row
-begin
- if (new.id is not null) then
- update t1 set count= count + 1 where id = old.id;
- end if;
-end|
-
-delimiter ;|
-insert into t1 (id, count) values (1, 0);
-
-lock table t1 write;
-
---connect (connection_insert, localhost, root, , test, , )
-connection connection_insert;
-# Is expected to pass.
-insert into t2 set id=1;
-connection default;
-unlock tables;
-update t2 set id=1 where id=1;
-select * from t1;
-select * from t2;
-# Will drop the trigger
-drop table t1, t2;
-disconnect connection_insert;
---echo
---echo Additionally, provide test coverage for triggers and
---echo all MySQL data changing commands.
---echo
---disable_warnings
-drop table if exists t1, t2, t1_op_log;
-drop view if exists v1;
-drop trigger if exists trg_bug28502_bi;
-drop trigger if exists trg_bug28502_ai;
-drop trigger if exists trg_bug28502_bu;
-drop trigger if exists trg_bug28502_au;
-drop trigger if exists trg_bug28502_bd;
-drop trigger if exists trg_bug28502_ad;
---enable_warnings
-create table t1 (id int primary key auto_increment, operation varchar(255));
-create table t2 (id int primary key);
-create table t1_op_log(operation varchar(255));
-create view v1 as select * from t1;
-create trigger trg_bug28502_bi before insert on t1
-for each row
- insert into t1_op_log (operation)
- values (concat("Before INSERT, new=", new.operation));
-
-create trigger trg_bug28502_ai after insert on t1
-for each row
- insert into t1_op_log (operation)
- values (concat("After INSERT, new=", new.operation));
-
-create trigger trg_bug28502_bu before update on t1
-for each row
- insert into t1_op_log (operation)
- values (concat("Before UPDATE, new=", new.operation,
- ", old=", old.operation));
-
-create trigger trg_bug28502_au after update on t1
-for each row
- insert into t1_op_log (operation)
- values (concat("After UPDATE, new=", new.operation,
- ", old=", old.operation));
-
-create trigger trg_bug28502_bd before delete on t1
-for each row
- insert into t1_op_log (operation)
- values (concat("Before DELETE, old=", old.operation));
-
-create trigger trg_bug28502_ad after delete on t1
-for each row
- insert into t1_op_log (operation)
- values (concat("After DELETE, old=", old.operation));
-
-insert into t1 (operation) values ("INSERT");
-
-set @id=last_insert_id();
-
-select * from t1;
-select * from t1_op_log;
-truncate t1_op_log;
-
-update t1 set operation="UPDATE" where id=@id;
-
-select * from t1;
-select * from t1_op_log;
-truncate t1_op_log;
-
-delete from t1 where id=@id;
-
-select * from t1;
-select * from t1_op_log;
-truncate t1;
-truncate t1_op_log;
-
-insert into t1 (id, operation) values
-(NULL, "INSERT ON DUPLICATE KEY UPDATE, inserting a new key")
-on duplicate key update id=NULL, operation="Should never happen";
-
-set @id=last_insert_id();
-
-select * from t1;
-select * from t1_op_log;
-truncate t1_op_log;
-
-insert into t1 (id, operation) values
-(@id, "INSERT ON DUPLICATE KEY UPDATE, the key value is the same")
-on duplicate key update id=NULL,
-operation="INSERT ON DUPLICATE KEY UPDATE, updating the duplicate";
-
-select * from t1;
-select * from t1_op_log;
-truncate t1;
-truncate t1_op_log;
-
-replace into t1 values (NULL, "REPLACE, inserting a new key");
-
-set @id=last_insert_id();
-
-select * from t1;
-select * from t1_op_log;
-truncate t1_op_log;
-
-replace into t1 values (@id, "REPLACE, deleting the duplicate");
-
-select * from t1;
-select * from t1_op_log;
-truncate t1;
-truncate t1_op_log;
-
-insert into t1
-select NULL, "CREATE TABLE ... SELECT, inserting a new key";
-
-set @id=last_insert_id();
-
-select * from t1;
-select * from t1_op_log;
-truncate t1_op_log;
-
-replace into t1
-select @id, "CREATE TABLE ... REPLACE SELECT, deleting a duplicate key";
-
-select * from t1;
-select * from t1_op_log;
-truncate t1;
-truncate t1_op_log;
-
-insert into t1 (id, operation)
-select NULL, "INSERT ... SELECT, inserting a new key";
-
-set @id=last_insert_id();
-
-select * from t1;
-select * from t1_op_log;
-truncate t1_op_log;
-
-insert into t1 (id, operation)
-select @id,
-"INSERT ... SELECT ... ON DUPLICATE KEY UPDATE, updating a duplicate"
-on duplicate key update id=NULL,
-operation="INSERT ... SELECT ... ON DUPLICATE KEY UPDATE, updating a duplicate";
-
-select * from t1;
-select * from t1_op_log;
-truncate t1;
-truncate t1_op_log;
-
-replace into t1 (id, operation)
-select NULL, "REPLACE ... SELECT, inserting a new key";
-
-set @id=last_insert_id();
-
-select * from t1;
-select * from t1_op_log;
-truncate t1_op_log;
-
-replace into t1 (id, operation)
-select @id, "REPLACE ... SELECT, deleting a duplicate";
-
-select * from t1;
-select * from t1_op_log;
-truncate t1;
-truncate t1_op_log;
-
-insert into t1 (id, operation) values (1, "INSERT for multi-DELETE");
-insert into t2 (id) values (1);
-
-delete t1.*, t2.* from t1, t2 where t1.id=1;
-
-select * from t1;
-select * from t2;
-select * from t1_op_log;
-truncate t1;
-truncate t2;
-truncate t1_op_log;
-
-insert into t1 (id, operation) values (1, "INSERT for multi-UPDATE");
-insert into t2 (id) values (1);
-update t1, t2 set t1.id=2, operation="multi-UPDATE" where t1.id=1;
-update t1, t2
-set t2.id=3, operation="multi-UPDATE, SET for t2, but the trigger is fired" where t1.id=2;
-
-select * from t1;
-select * from t2;
-select * from t1_op_log;
-truncate table t1;
-truncate table t2;
-truncate table t1_op_log;
-
---echo
---echo Now do the same but use a view instead of the base table.
---echo
-
-insert into v1 (operation) values ("INSERT");
-
-set @id=last_insert_id();
-
-select * from t1;
-select * from t1_op_log;
-truncate t1_op_log;
-
-update v1 set operation="UPDATE" where id=@id;
-
-select * from t1;
-select * from t1_op_log;
-truncate t1_op_log;
-
-delete from v1 where id=@id;
-
-select * from t1;
-select * from t1_op_log;
-truncate t1;
-truncate t1_op_log;
-
-insert into v1 (id, operation) values
-(NULL, "INSERT ON DUPLICATE KEY UPDATE, inserting a new key")
-on duplicate key update id=NULL, operation="Should never happen";
-
-set @id=last_insert_id();
-
-select * from t1;
-select * from t1_op_log;
-truncate t1_op_log;
-
-insert into v1 (id, operation) values
-(@id, "INSERT ON DUPLICATE KEY UPDATE, the key value is the same")
-on duplicate key update id=NULL,
-operation="INSERT ON DUPLICATE KEY UPDATE, updating the duplicate";
-
-select * from t1;
-select * from t1_op_log;
-truncate t1;
-truncate t1_op_log;
-
-replace into v1 values (NULL, "REPLACE, inserting a new key");
-
-set @id=last_insert_id();
-
-select * from t1;
-select * from t1_op_log;
-truncate t1_op_log;
-
-replace into v1 values (@id, "REPLACE, deleting the duplicate");
-
-select * from t1;
-select * from t1_op_log;
-truncate t1;
-truncate t1_op_log;
-
-insert into v1
-select NULL, "CREATE TABLE ... SELECT, inserting a new key";
-
-set @id=last_insert_id();
-
-select * from t1;
-select * from t1_op_log;
-truncate t1_op_log;
-
-replace into v1
-select @id, "CREATE TABLE ... REPLACE SELECT, deleting a duplicate key";
-
-select * from t1;
-select * from t1_op_log;
-truncate t1;
-truncate t1_op_log;
-
-insert into v1 (id, operation)
-select NULL, "INSERT ... SELECT, inserting a new key";
-
-set @id=last_insert_id();
-
-select * from t1;
-select * from t1_op_log;
-truncate t1_op_log;
-
-insert into v1 (id, operation)
-select @id,
-"INSERT ... SELECT ... ON DUPLICATE KEY UPDATE, updating a duplicate"
-on duplicate key update id=NULL,
-operation="INSERT ... SELECT ... ON DUPLICATE KEY UPDATE, updating a duplicate";
-
-select * from t1;
-select * from t1_op_log;
-truncate t1;
-truncate t1_op_log;
-
-replace into v1 (id, operation)
-select NULL, "REPLACE ... SELECT, inserting a new key";
-
-set @id=last_insert_id();
-
-select * from t1;
-select * from t1_op_log;
-truncate t1_op_log;
-
-replace into v1 (id, operation)
-select @id, "REPLACE ... SELECT, deleting a duplicate";
-
-select * from t1;
-select * from t1_op_log;
-truncate t1;
-truncate t1_op_log;
-
-insert into v1 (id, operation) values (1, "INSERT for multi-DELETE");
-insert into t2 (id) values (1);
-
-delete v1.*, t2.* from v1, t2 where v1.id=1;
-
-select * from t1;
-select * from t2;
-select * from t1_op_log;
-truncate t1;
-truncate t2;
-truncate t1_op_log;
-
-insert into v1 (id, operation) values (1, "INSERT for multi-UPDATE");
-insert into t2 (id) values (1);
-update v1, t2 set v1.id=2, operation="multi-UPDATE" where v1.id=1;
-update v1, t2
-set t2.id=3, operation="multi-UPDATE, SET for t2, but the trigger is fired" where v1.id=2;
-
-select * from t1;
-select * from t2;
-select * from t1_op_log;
-
-drop view v1;
-drop table t1, t2, t1_op_log;
-
-#
-# TODO: test LOAD DATA INFILE
-#
---echo
---echo Bug#27248 Triggers: error if insert affects temporary table
---echo
---echo The bug was fixed by the fix for Bug#26141
---echo
---disable_warnings
-drop table if exists t1;
-drop temporary table if exists t2;
---enable_warnings
-create table t1 (s1 int);
-create temporary table t2 (s1 int);
-create trigger t1_bi before insert on t1 for each row insert into t2 values (0);
-create trigger t1_bd before delete on t1 for each row delete from t2;
-insert into t1 values (0);
-insert into t1 values (0);
-select * from t1;
-select * from t2;
-delete from t1;
-select * from t1;
-select * from t2;
-drop table t1;
-drop temporary table t2;
-
---echo #------------------------------------------------------------------------
---echo # Bug#39953 Triggers are not working properly with multi table updates
---echo #------------------------------------------------------------------------
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP TRIGGER IF EXISTS t_insert;
-DROP TABLE IF EXISTS t2;
---enable_warnings
-
-CREATE TABLE t1 (a int, date_insert timestamp, PRIMARY KEY (a));
-INSERT INTO t1 (a) VALUES (2),(5);
-CREATE TABLE t2 (a int, b int, PRIMARY KEY (a));
-DELIMITER |;
-CREATE TRIGGER t_insert AFTER INSERT ON t2 FOR EACH ROW BEGIN UPDATE t1,t2 SET
-date_insert=NOW() WHERE t1.a=t2.b AND t2.a=NEW.a; END |
-DELIMITER ;|
-INSERT INTO t2 (a,b) VALUES (1,2);
-
-DROP TRIGGER t_insert;
-
-DELIMITER |;
-CREATE TRIGGER t_insert AFTER INSERT ON t2 FOR EACH ROW BEGIN UPDATE t1,t2 SET
-date_insert=NOW(),b=b+1 WHERE t1.a=t2.b AND t2.a=NEW.a; END |
-DELIMITER ;|
---error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG
-INSERT INTO t2 (a,b) VALUES (3,5);
-
-DROP TABLE t1;
-DROP TRIGGER t_insert;
-DROP TABLE t2;
-
---echo End of 5.0 tests
-
-#
-# Bug#25411 (trigger code truncated)
-#
-
---disable_warnings
-drop table if exists table_25411_a;
-drop table if exists table_25411_b;
---enable_warnings
-
-create table table_25411_a(a int);
-create table table_25411_b(b int);
-
-create trigger trg_25411a_ai after insert on table_25411_a
-for each row
- insert into table_25411_b select new.*;
-
-select * from table_25411_a;
-
---error ER_BAD_TABLE_ERROR
-insert into table_25411_a values (1);
-
-select * from table_25411_a;
-
-drop table table_25411_a;
-drop table table_25411_b;
-
-#
-# Bug #31866: MySQL Server crashes on SHOW CREATE TRIGGER statement
-#
-
---disable_warnings
-DROP TRIGGER IF EXISTS trg;
---enable_warnings
-
---error ER_TRG_DOES_NOT_EXIST
-SHOW CREATE TRIGGER trg;
-
-#
-# Bug#23713 LOCK TABLES + CREATE TRIGGER + FLUSH TABLES WITH READ LOCK = deadlock
-#
-# Test of trigger creation and removal under LOCK TABLES
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1 (i int, j int);
-
-create trigger t1_bi before insert on t1 for each row begin end;
---error ER_TRG_ALREADY_EXISTS
-create trigger t1_bi before insert on t1 for each row begin end;
-create trigger t1_bi2 before insert on t1 for each row begin end;
-drop trigger t1_bi;
-drop trigger t1_bi2;
---error ER_TRG_DOES_NOT_EXIST
-drop trigger t1_bi;
-
-lock tables t1 read;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-create trigger t1_bi before insert on t1 for each row begin end;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-create trigger t1_bi before insert on t1 for each row begin end;
---error ER_TRG_DOES_NOT_EXIST
-drop trigger t1_bi;
-unlock tables;
-
-create trigger t1_bi before insert on t1 for each row begin end;
-lock tables t1 read;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-create trigger t1_bi before insert on t1 for each row begin end;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-drop trigger t1_bi;
-unlock tables;
-drop trigger t1_bi;
-
-lock tables t1 write;
-create trigger b1_bi before insert on t1 for each row set new.i = new.i + 10;
-insert into t1 values (10, 10);
-drop trigger b1_bi;
-insert into t1 values (10, 10);
-select * from t1;
-unlock tables;
-
-drop table t1;
-
-#
-# Bug#23771 AFTER UPDATE trigger not invoked when there are no changes of the data
-#
-
---disable_warnings
-drop table if exists t1, t2;
-drop trigger if exists trg1;
-drop trigger if exists trg2;
---enable_warnings
-create table t1 (a int);
-create table t2 (b int);
-create trigger trg1 after update on t1 for each row set @a= @a+1;
-create trigger trg2 after update on t2 for each row set @b= @b+1;
-insert into t1 values (1), (2), (3);
-insert into t2 values (1), (2), (3);
-set @a= 0;
-set @b= 0;
-update t1, t2 set t1.a= t1.a, t2.b= t2.b;
-select @a, @b;
-update t1, t2 set t1.a= t2.b, t2.b= t1.a;
-select @a, @b;
-update t1 set a= a;
-select @a, @b;
-update t2 set b= b;
-select @a, @b;
-update t1 set a= 1;
-select @a, @b;
-update t2 set b= 1;
-select @a, @b;
-drop trigger trg1;
-drop trigger trg2;
-drop table t1, t2;
-
-#
-# Bug#44653: Server crash noticed when executing random queries with partitions.
-#
-CREATE TABLE t1 ( a INT, b INT );
-CREATE TABLE t2 ( a INT AUTO_INCREMENT KEY, b INT );
-
-INSERT INTO t1 (a) VALUES (1);
-
-delimiter //;
-CREATE TRIGGER tr1
-BEFORE INSERT ON t2
-FOR EACH ROW
-BEGIN
- UPDATE a_nonextisting_table SET a = 1;
-END//
-delimiter ;//
-
---disable_abort_on_error
-CREATE TABLE IF NOT EXISTS t2 ( a INT, b INT ) SELECT a, b FROM t1;
---enable_abort_on_error
-
-# Caused failed assertion
-SELECT * FROM t2;
-
-DROP TABLE t1, t2;
-
---echo #
---echo # Bug#51650 crash with user variables and triggers
---echo #
-
---disable_warnings
-DROP TRIGGER IF EXISTS trg1;
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-CREATE TABLE t1 (b VARCHAR(50) NOT NULL);
-CREATE TABLE t2 (a VARCHAR(10) NOT NULL DEFAULT '');
-
-delimiter //;
-CREATE TRIGGER trg1 AFTER INSERT ON t2
-FOR EACH ROW BEGIN
- SELECT 1 FROM t1 c WHERE
- (@bug51650 IS NULL OR @bug51650 != c.b) AND c.b = NEW.a LIMIT 1 INTO @foo;
-END//
-delimiter ;//
-
-SET @bug51650 = 1;
-INSERT IGNORE INTO t2 VALUES();
-INSERT IGNORE INTO t1 SET b = '777';
-INSERT IGNORE INTO t2 SET a = '111';
-SET @bug51650 = 1;
-INSERT IGNORE INTO t2 SET a = '777';
-
-DROP TRIGGER trg1;
-DROP TABLE t1, t2;
-
-#
-# Bug #48525: trigger changes "Column 'id' cannot be null" behaviour
-#
-CREATE TABLE t1 (id INT NOT NULL);
-CREATE TABLE t2 (id INT NOT NULL);
-INSERT t1 VALUES (1),(2),(3);
-UPDATE IGNORE t1 SET id=NULL;
-CREATE TRIGGER t1_bu BEFORE UPDATE ON t1 FOR EACH ROW
- INSERT INTO t2 VALUES (3);
-UPDATE t1 SET id=NULL;
-DROP TRIGGER t1_bu;
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug#50755: Crash if stored routine def contains version comments
---echo #
-
---disable_warnings
-DROP DATABASE IF EXISTS db1;
-DROP TRIGGER IF EXISTS trg1;
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-CREATE DATABASE db1;
-USE db1;
-
-CREATE TABLE t1 (b INT);
-CREATE TABLE t2 (a INT);
-
-CREATE TRIGGER trg1 BEFORE INSERT ON t2 FOR EACH ROW INSERT/*!INTO*/t1 VALUES (1);
---echo # Used to crash
---replace_column 6 #
-SHOW TRIGGERS IN db1;
---error ER_PARSE_ERROR
-INSERT INTO t2 VALUES (1);
-SELECT * FROM t1;
-
---echo # Work around Bug#45235
-let $MYSQLD_DATADIR = `select @@datadir`;
---remove_file $MYSQLD_DATADIR/db1/t2.TRG
---remove_file $MYSQLD_DATADIR/db1/trg1.TRN
-
-DROP DATABASE db1;
-USE test;
-
---echo End of 5.1 tests.
-
-#
-# Test that using a trigger will not open mysql.proc
-#
-create table t1 (i int);
-create table t2 (i int);
-flush tables;
-flush status;
-delimiter //;
-CREATE DEFINER=`root`@`localhost` TRIGGER trg AFTER DELETE ON t1 FOR EACH ROW BEGIN DELETE FROM t2 WHERE t2.i = OLD.i; END //
-delimiter ;//
-insert into t1 values (1),(2);
-insert into t2 values (1),(2);
-delete from t1 where i=1;
-#
-# If mysql.proc would be used we would have 4 here. 3 is the correct number.
-# (CREATE TRIGGER will open t1 and then flush it)
-#
-show status like 'Opened_tables';
-select * from t1;
-select * from t2;
-drop table t1,t2;
-
---echo End of 5.2 tests.
-
---echo #
---echo # Bug#34453 Can't change size of file (Errcode: 1224)
---echo #
-
---disable_warnings
-DROP TRIGGER IF EXISTS t1_bi;
-DROP TRIGGER IF EXISTS t1_bd;
-DROP TABLE IF EXISTS t1;
-DROP TEMPORARY TABLE IF EXISTS t2;
---enable_warnings
-
-CREATE TABLE t1 (s1 INT);
-CREATE TEMPORARY TABLE t2 (s1 INT);
-CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (0);
-CREATE TRIGGER t1_bd BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t2;
-INSERT INTO t1 VALUES (0);
-INSERT INTO t1 VALUES (0);
-SELECT * FROM t1;
-SELECT * FROM t2;
--- echo # Reported to give ERROR 14 (HY000):
--- echo # Can't change size of file (Errcode: 1224)
--- echo # on Windows
-DELETE FROM t1;
-
-DROP TABLE t1;
-DROP TEMPORARY TABLE t2;
-
-#
-# Bug#36649: Condition area is not properly cleaned up after stored routine invocation
-#
-
-SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
---disable_warnings
-DROP TRIGGER IF EXISTS trg1;
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (a INT);
-
-delimiter |;
-CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW
-BEGIN
- DECLARE a CHAR;
- SELECT 'ab' INTO a;
- SELECT 'ab' INTO a;
- SELECT 'a' INTO a;
-END|
-delimiter ;|
-
-INSERT INTO t1 VALUES (1);
-
-DROP TRIGGER trg1;
-DROP TABLE t1;
-
-#
-# Successive trigger actuations
-#
-
---disable_warnings
-DROP TRIGGER IF EXISTS trg1;
-DROP TRIGGER IF EXISTS trg2;
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (a INT);
-
-delimiter |;
-
-CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW
-BEGIN
- DECLARE trg1 CHAR;
- SELECT 'ab' INTO trg1;
-END|
-
-CREATE TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW
-BEGIN
- DECLARE trg2 CHAR;
- SELECT 'ab' INTO trg2;
-END|
-
-delimiter ;|
-SET sql_mode = DEFAULT;
-
-INSERT INTO t1 VALUES (0);
-SELECT * FROM t1;
-SHOW WARNINGS;
-INSERT INTO t1 VALUES (1),(2);
-
-DROP TRIGGER trg1;
-DROP TRIGGER trg2;
-DROP TABLE t1;
-
-
---echo #
---echo # Bug #46747 "Crash in MDL_ticket::upgrade_shared_lock_to_exclusive
---echo # on TRIGGER + TEMP table".
---echo #
-
---disable_warnings
-drop trigger if exists t1_bi;
-drop temporary table if exists t1;
-drop table if exists t1;
---enable_warnings
-
-create table t1 (i int);
-create trigger t1_bi before insert on t1 for each row set @a:=1;
---echo # Create temporary table which shadows base table with trigger.
-create temporary table t1 (j int);
---echo # Dropping of trigger should succeed.
-drop trigger t1_bi;
-select trigger_name from information_schema.triggers
- where event_object_schema = 'test' and event_object_table = 't1';
---echo # Clean-up.
-drop temporary table t1;
-drop table t1;
-
---echo #
---echo # Bug #12362125: SP INOUT HANDLING IS BROKEN FOR TEXT TYPE.
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1(c TEXT);
-
-delimiter |;
-CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
-BEGIN
- DECLARE v TEXT;
- SET v = 'aaa';
- SET NEW.c = v;
-END|
-delimiter ;|
-
-INSERT INTO t1 VALUES('qazwsxedc');
-
-SELECT c FROM t1;
-
-DROP TABLE t1;
-
---echo
---echo End of 5.5 tests.
-
---echo #
---echo # BUG #910083: materialized subquery in a trigger
---echo #
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='materialization=on';
-
-CREATE TABLE t1 (a int);
-CREATE TABLE t2 (b int);
-
-CREATE TRIGGER tr AFTER UPDATE ON t1 FOR EACH ROW
- UPDATE t2 SET b = (SELECT COUNT(a) FROM t1);
-
-INSERT INTO t1
- VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-INSERT INTO t2
- VALUES (0),(0),(0),(0),(0),(0),(0),(0),(0);
-
-send
- UPDATE t1 SET a = 3;
-
-connect(con1,localhost,root,,);
- SELECT COUNT(*) FROM t1;
-disconnect con1;
-
-connection default;
-reap;
-SELECT * FROM t2;
-UPDATE t1 SET a = 2;
-SELECT * FROM t2;
-
-SET optimizer_switch=@save_optimizer_switch;
-
-DROP TRIGGER tr;
-DROP TABLE t1, t2;
-
---echo End of 5.3 tests.
-
-#
-# MDEV-4829 BEFORE INSERT triggers dont issue 1406 error
-# Also check timestamp for trigger
-#
-
-set time_zone="+00:00";
-SET TIMESTAMP=UNIX_TIMESTAMP('2001-01-01 10:20:30');
-SET @@session.sql_mode = 'STRICT_ALL_TABLES,STRICT_TRANS_TABLES';
-CREATE TABLE t1 (c CHAR(1) NOT NULL);
-DELIMITER |;
-CREATE TRIGGER t1_bi
- BEFORE INSERT
- ON t1
- FOR EACH ROW
- BEGIN
- SET NEW.c = 'www';
- END;
-|
-DELIMITER ;|
-SET @@session.sql_mode = default;
---error ER_DATA_TOO_LONG
-INSERT INTO t1 VALUES ('a');
-show create trigger t1_bi;
-DROP TRIGGER t1_bi;
-DROP TABLE t1;
-SET TIMESTAMP=DEFAULT;
-set time_zone= @@global.time_zone;
-
---echo #
---echo # MDEV-13936: Server crashes in Time_and_counter_tracker::incr_loops
---echo #
-
-CREATE TABLE t1 (i INT);
-CREATE VIEW v1 AS SELECT * FROM t1 WHERE RAND() > 0.5;
-CREATE TABLE t2 (a int);
-CREATE TABLE t3 (a int);
-
-create trigger trg after insert on t2 for each row
- INSERT INTO t3 SELECT MAX(i) FROM v1 UNION SELECT MAX(i) FROM v1;
-
-drop table t1;
-
---error ER_NO_SUCH_TABLE
-insert into t2 value (2);
-CREATE TABLE t1 (i INT);
-insert into t2 value (2);
-
-DROP VIEW v1;
-DROP TABLE t1,t2,t3;
-
-
---echo End of 10.1 tests.
-
-#
-# MDEV-10915 Count number of executed triggers
-#
-
-create table t1 (i int);
-create trigger tr1 after insert on t1 for each row set @a=@a+1;
-create trigger tr2 after insert on t1 for each row set @a=@a+1;
-create trigger tr3 after insert on t1 for each row set @a=@a+1;
-flush status;
-show status like 'Executed_triggers';
-set @a=0;
-insert into t1 values (1);
-show status like 'Executed_triggers';
-select @a;
-drop table t1;
-
-#
-# MDEV-10916 In trigger's CREATED time microseconds are misinterpreted
-#
-
-create table t1 (i int);
-set time_zone="+0:00";
-SET TIMESTAMP=UNIX_TIMESTAMP('2016-01-01 10:10:10.33');
-select now(2);
-create or replace trigger tr1 after insert on t1 for each row set @a=@a+1;
-SET TIMESTAMP=UNIX_TIMESTAMP('2016-01-01 10:10:10.99');
-select now(2);
-create or replace trigger tr2 after insert on t1 for each row set @a=@a+1;
-select now(2);
-select trigger_name, action_order, created from information_schema.triggers
- where event_object_table = 't1' and trigger_schema='test';
-drop table t1;
-set time_zone= @@global.time_zone;
-
---echo # MDEV-12992: Increasing memory consumption
---echo with each invocation of trigger
---echo #
-
---let $n= 20000
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1);
-CREATE TABLE t2 (b INT);
-CREATE TRIGGER tr
- AFTER UPDATE ON t1 FOR EACH ROW SELECT (SELECT b FROM t2) INTO @x;
-
---disable_query_log
---echo # Running $n queries
-while ($n)
-{
- UPDATE t1 SET a = 2;
- --dec $n
-}
---enable_query_log
-
-DROP TABLE t1,t2;
-
-
---echo #
---echo # Start of 10.3 tests
---echo #
-
---echo #
---echo # MDEV-12461 TYPE OF and ROW TYPE OF anchored data types
---echo #
-
-CREATE TABLE t1 (a INT, b INT, total INT);
-DELIMITER $$;
-CREATE TRIGGER tr1 BEFORE INSERT ON t1
-FOR EACH ROW
-BEGIN
- DECLARE va TYPE OF t1.a DEFAULT NEW.a;
- DECLARE vb TYPE OF t1.b DEFAULT NEW.b;
- SET NEW.total:= va + vb;
-END;
-$$
-DELIMITER ;$$
-INSERT INTO t1 (a,b) VALUES (10, 20);
-SELECT * FROM t1;
-DROP TABLE t1;
diff --git a/mysql-test/t/trigger_no_defaults-11698.test b/mysql-test/t/trigger_no_defaults-11698.test
deleted file mode 100644
index c10bec68314..00000000000
--- a/mysql-test/t/trigger_no_defaults-11698.test
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# MDEV-11698 Old Bug possibly not fixed; BEFORE INSERT Trigger on NOT NULL
-#
-set sql_mode='strict_all_tables';
-create table t1 (a int not null, b int);
---error ER_NO_DEFAULT_FOR_FIELD
-insert t1 (b) values (1);
-delimiter |;
-create trigger trgi before insert on t1 for each row
- case new.b
- when 10 then
- set new.a = new.b;
- when 30 then
- set new.a = new.a;
- else
- do 1;
- end case|
-delimiter ;|
-insert t1 (b) values (10);
---error ER_NO_DEFAULT_FOR_FIELD
-insert t1 (b) values (20);
-# arguably the statement below should fail too
-insert t1 (b) values (30);
-select * from t1;
-drop table t1;
-set sql_mode=default;
-
-#
-# MDEV-11842 Fail to insert on a table where a field has no default
-#
-set sql_mode='';
-create table t1 (
- id int(11) not null auto_increment primary key,
- data1 varchar(10) not null,
- data2 varchar(10) not null
-);
-insert into t1 (data2) values ('x');
-create trigger test_trigger before insert on t1 for each row begin end;
-insert into t1 (data2) values ('y');
-select * from t1;
-drop table t1;
-set sql_mode=default;
diff --git a/mysql-test/t/trigger_notembedded.test b/mysql-test/t/trigger_notembedded.test
deleted file mode 100644
index a31594826e7..00000000000
--- a/mysql-test/t/trigger_notembedded.test
+++ /dev/null
@@ -1,994 +0,0 @@
-# Test case(s) in this file contain(s) GRANT/REVOKE statements, which are not
-# supported in embedded server. So, this test should not be run on embedded
-# server.
-
--- source include/not_embedded.inc
-
-###########################################################################
-#
-# Tests for WL#2818:
-# - Check that triggers are executed under the authorization of the definer.
-# - Check DEFINER clause of CREATE TRIGGER statement;
-# - Check that SUPER privilege required to create a trigger with different
-# definer.
-# - Check that if the user specified as DEFINER does not exist, a warning
-# is emitted.
-# - Check that the definer of a trigger does not exist, the trigger will
-# not be activated.
-# - Check that SHOW TRIGGERS statement provides "Definer" column.
-# - Check that if trigger contains NEW/OLD variables, the definer must have
-# SELECT privilege on the subject table (aka BUG#15166/BUG#15196).
-#
-# Let's also check that user name part of definer can contain '@' symbol (to
-# check that triggers are not affected by BUG#13310 "incorrect user parsing
-# by SP").
-#
-###########################################################################
-
-#
-# Prepare environment.
-#
-DELETE FROM mysql.user WHERE User LIKE 'mysqltest_%';
-DELETE FROM mysql.db WHERE User LIKE 'mysqltest_%';
-DELETE FROM mysql.tables_priv WHERE User LIKE 'mysqltest_%';
-DELETE FROM mysql.columns_priv WHERE User LIKE 'mysqltest_%';
-FLUSH PRIVILEGES;
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest_db1;
---enable_warnings
-
-CREATE DATABASE mysqltest_db1;
-
-CREATE USER mysqltest_dfn@localhost;
-CREATE USER mysqltest_inv@localhost;
-
-GRANT CREATE ON mysqltest_db1.* TO mysqltest_dfn@localhost;
-
---connect (wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1)
---connection wl2818_definer_con
-
-CREATE TABLE t1(num_value INT);
-CREATE TABLE t2(user_str TEXT);
-
---disconnect wl2818_definer_con
-
---connection default
-
-GRANT INSERT, DROP ON mysqltest_db1.t1 TO mysqltest_dfn@localhost;
-GRANT INSERT, DROP ON mysqltest_db1.t2 TO mysqltest_dfn@localhost;
-
-#
-# Check that the user must have TRIGGER privilege to create a trigger.
-#
-
---connection default
-
-GRANT SUPER ON *.* TO mysqltest_dfn@localhost;
-
---connect (wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1)
---connection wl2818_definer_con
-
---error ER_TABLEACCESS_DENIED_ERROR
-CREATE TRIGGER trg1 AFTER INSERT ON t1
- FOR EACH ROW
- INSERT INTO t2 VALUES(CURRENT_USER());
-
---disconnect wl2818_definer_con
-
-#
-# Check that the user must have TRIGGER privilege to drop a trigger.
-#
-
---connection default
-
-GRANT TRIGGER ON mysqltest_db1.t1 TO mysqltest_dfn@localhost;
-
---connect (wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1)
---connection wl2818_definer_con
-
-CREATE TRIGGER trg1 AFTER INSERT ON t1
- FOR EACH ROW
- INSERT INTO t2 VALUES(CURRENT_USER());
-
---disconnect wl2818_definer_con
-
---connection default
-
-REVOKE TRIGGER ON mysqltest_db1.t1 FROM mysqltest_dfn@localhost;
-
---connect (wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1)
---connection wl2818_definer_con
-
---error ER_TABLEACCESS_DENIED_ERROR
-DROP TRIGGER trg1;
-
---disconnect wl2818_definer_con
-
-#
-# Check that the definer must have TRIGGER privilege to activate a trigger.
-#
-
---connect (wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1)
---connection wl2818_definer_con
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO t1 VALUES(0);
-
---disconnect wl2818_definer_con
-
---connection default
-
-GRANT TRIGGER ON mysqltest_db1.t1 TO mysqltest_dfn@localhost;
-
---connect (wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1)
---connection wl2818_definer_con
-
-INSERT INTO t1 VALUES(0);
-
-# Cleanup for further tests.
-DROP TRIGGER trg1;
-TRUNCATE TABLE t1;
-TRUNCATE TABLE t2;
-
---disconnect wl2818_definer_con
-
---connection default
-
-REVOKE SUPER ON *.* FROM mysqltest_dfn@localhost;
-
-#
-# Check that triggers are executed under the authorization of the definer:
-# - create two tables under "definer";
-# - grant all privileges on the test db to "definer";
-# - grant all privileges on the first table to "invoker";
-# - grant only select privilege on the second table to "invoker";
-# - create a trigger, which inserts a row into the second table after
-# inserting into the first table.
-# - insert a row into the first table under "invoker". A row also should be
-# inserted into the second table.
-#
-
---connect (wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1)
---connection wl2818_definer_con
-
-CREATE TRIGGER trg1 AFTER INSERT ON t1
- FOR EACH ROW
- INSERT INTO t2 VALUES(CURRENT_USER());
-
---connection default
-
-# Setup definer's privileges.
-
-GRANT ALL PRIVILEGES ON mysqltest_db1.t1 TO mysqltest_dfn@localhost;
-GRANT ALL PRIVILEGES ON mysqltest_db1.t2 TO mysqltest_dfn@localhost;
-
-# Setup invoker's privileges.
-
-GRANT ALL PRIVILEGES ON mysqltest_db1.t1
- TO 'mysqltest_inv'@localhost;
-
-GRANT SELECT ON mysqltest_db1.t2
- TO 'mysqltest_inv'@localhost;
-
---connection wl2818_definer_con
-
-use mysqltest_db1;
-
-INSERT INTO t1 VALUES(1);
-
-SELECT * FROM t1;
-SELECT * FROM t2;
-
---connect (wl2818_invoker_con,localhost,mysqltest_inv,,mysqltest_db1)
---connection wl2818_invoker_con
-
-use mysqltest_db1;
-
-INSERT INTO t1 VALUES(2);
-
-SELECT * FROM t1;
-SELECT * FROM t2;
-
-#
-# Check that if definer lost some privilege required to execute (activate) a
-# trigger, the trigger will not be activated:
-# - create a trigger on insert into the first table, which will insert a row
-# into the second table;
-# - revoke INSERT privilege on the second table from the definer;
-# - insert a row into the first table;
-# - check that an error has been risen;
-# - check that no row has been inserted into the second table;
-#
-
---connection default
-
-use mysqltest_db1;
-
-REVOKE INSERT ON mysqltest_db1.t2 FROM mysqltest_dfn@localhost;
-
---connection wl2818_invoker_con
-
-use mysqltest_db1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO t1 VALUES(3);
-
-SELECT * FROM t1;
-SELECT * FROM t2;
-
-#
-# Check DEFINER clause of CREATE TRIGGER statement.
-#
-# - Check that SUPER privilege required to create a trigger with different
-# definer:
-# - try to create a trigger with DEFINER="definer@localhost" under
-# "invoker";
-# - analyze error code;
-# - Check that if the user specified as DEFINER does not exist, a warning is
-# emitted:
-# - create a trigger with DEFINER="non_existent_user@localhost" from
-# "definer";
-# - check that a warning emitted;
-# - Check that the definer of a trigger does not exist, the trigger will not
-# be activated:
-# - activate just created trigger;
-# - check error code;
-#
-
---connection wl2818_definer_con
-
-use mysqltest_db1;
-
-DROP TRIGGER trg1;
-
-# Check that SUPER is required to specify different DEFINER.
-
---error ER_SPECIFIC_ACCESS_DENIED_ERROR
-CREATE DEFINER='mysqltest_inv'@'localhost'
- TRIGGER trg1 BEFORE INSERT ON t1
- FOR EACH ROW
- SET @new_sum = 0;
-
---connection default
-
-use mysqltest_db1;
-
-GRANT SUPER ON *.* TO mysqltest_dfn@localhost;
-
---disconnect wl2818_definer_con
---connect (wl2818_definer_con,localhost,mysqltest_dfn,,mysqltest_db1)
---connection wl2818_definer_con
-
-CREATE DEFINER='mysqltest_inv'@'localhost'
- TRIGGER trg1 BEFORE INSERT ON t1
- FOR EACH ROW
- SET @new_sum = 0;
-
-# Create with non-existent user.
-
-CREATE DEFINER='mysqltest_nonexs'@'localhost'
- TRIGGER trg2 AFTER INSERT ON t1
- FOR EACH ROW
- SET @new_sum = 0;
-
-# Check that trg2 will not be activated.
-
---error ER_NO_SUCH_USER
-INSERT INTO t1 VALUES(6);
-
-#
-# Check that SHOW TRIGGERS statement provides "Definer" column.
-#
-
---replace_column 6 #
-SHOW TRIGGERS;
-
-#
-# Check that weird definer values do not break functionality. I.e. check the
-# following definer values:
-# - '';
-# - '@';
-# - '@abc@def@@';
-# - '@hostname';
-# - '@abc@def@@@hostname';
-#
-
-DROP TRIGGER trg1;
-DROP TRIGGER trg2;
-
-CREATE TRIGGER trg1 BEFORE INSERT ON t1
- FOR EACH ROW
- SET @a = 1;
-
-CREATE TRIGGER trg2 AFTER INSERT ON t1
- FOR EACH ROW
- SET @a = 2;
-
-CREATE TRIGGER trg3 BEFORE UPDATE ON t1
- FOR EACH ROW
- SET @a = 3;
-
-CREATE TRIGGER trg4 AFTER UPDATE ON t1
- FOR EACH ROW
- SET @a = 4;
-
-CREATE TRIGGER trg5 BEFORE DELETE ON t1
- FOR EACH ROW
- SET @a = 5;
-
-# Replace definers with the "weird" definers
-let MYSQLD_DATADIR= `select @@datadir`;
-perl;
-use strict;
-use warnings;
-my $fname= "$ENV{'MYSQLD_DATADIR'}/mysqltest_db1/t1.TRG";
-open(FILE, "<", $fname) or die;
-my @content= grep($_ !~ /^definers=/, <FILE>);
-close FILE;
-open(FILE, ">", $fname) or die;
-# Use binary file mode to avoid CR/LF's being added on windows
-binmode FILE;
-print FILE @content;
-print FILE "definers='' '\@' '\@abc\@def\@\@' '\@hostname' '\@abcdef\@\@\@hostname'\n";
-close FILE;
-EOF
-
---echo
-
-SELECT trigger_name, definer FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
-
---echo
-
---replace_column 17 #
-SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
-
-#
-# Cleanup
-#
-
---connection default
-
-DROP USER mysqltest_dfn@localhost;
-DROP USER mysqltest_inv@localhost;
-
-DROP DATABASE mysqltest_db1;
-
-
-###########################################################################
-#
-# BUG#15166: Wrong update [was: select/update] permissions required to execute
-# triggers.
-#
-# BUG#15196: Wrong select permission required to execute triggers.
-#
-###########################################################################
-
-#
-# Prepare environment.
-#
-
-DELETE FROM mysql.user WHERE User LIKE 'mysqltest_%';
-DELETE FROM mysql.db WHERE User LIKE 'mysqltest_%';
-DELETE FROM mysql.tables_priv WHERE User LIKE 'mysqltest_%';
-DELETE FROM mysql.columns_priv WHERE User LIKE 'mysqltest_%';
-FLUSH PRIVILEGES;
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest_db1;
---enable_warnings
-
-CREATE DATABASE mysqltest_db1;
-
-use mysqltest_db1;
-
-# Tables for tesing table-level privileges:
-CREATE TABLE t1(col CHAR(20)); # table for "read-value" trigger
-CREATE TABLE t2(col CHAR(20)); # table for "write-value" trigger
-
-# Tables for tesing column-level privileges:
-CREATE TABLE t3(col CHAR(20)); # table for "read-value" trigger
-CREATE TABLE t4(col CHAR(20)); # table for "write-value" trigger
-
-CREATE USER mysqltest_u1@localhost;
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
-GRANT TRIGGER ON mysqltest_db1.* TO mysqltest_u1@localhost;
-
-SET @mysqltest_var = NULL;
-
---connect (bug15166_u1_con,localhost,mysqltest_u1,,mysqltest_db1)
-
-# parsing (CREATE TRIGGER) time:
-# - check that nor SELECT either UPDATE is required to execute triggger w/o
-# NEW/OLD variables.
-
---connection default
-
-use mysqltest_db1;
-
-GRANT DELETE ON mysqltest_db1.* TO mysqltest_u1@localhost;
-SHOW GRANTS FOR mysqltest_u1@localhost;
-
---connection bug15166_u1_con
-
-use mysqltest_db1;
-
-CREATE TRIGGER t1_trg_after_delete AFTER DELETE ON t1
- FOR EACH ROW
- SET @mysqltest_var = 'Hello, world!';
-
-# parsing (CREATE TRIGGER) time:
-# - check that UPDATE is not enough to read the value;
-# - check that UPDATE is required to modify the value;
-
---connection default
-
-use mysqltest_db1;
-
-GRANT UPDATE ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
-GRANT UPDATE ON mysqltest_db1.t2 TO mysqltest_u1@localhost;
-
-GRANT UPDATE(col) ON mysqltest_db1.t3 TO mysqltest_u1@localhost;
-GRANT UPDATE(col) ON mysqltest_db1.t4 TO mysqltest_u1@localhost;
-
---connection bug15166_u1_con
-
-use mysqltest_db1;
-
-# - table-level privileges
-
-# TODO: check privileges at CREATE TRIGGER time.
-# --error ER_COLUMNACCESS_DENIED_ERROR
-CREATE TRIGGER t1_trg_err_1 BEFORE INSERT ON t1
- FOR EACH ROW
- SET @mysqltest_var = NEW.col;
-DROP TRIGGER t1_trg_err_1;
-
-# TODO: check privileges at CREATE TRIGGER time.
-# --error ER_COLUMNACCESS_DENIED_ERROR
-CREATE TRIGGER t1_trg_err_2 BEFORE DELETE ON t1
- FOR EACH ROW
- SET @mysqltest_var = OLD.col;
-DROP TRIGGER t1_trg_err_2;
-
-CREATE TRIGGER t2_trg_before_insert BEFORE INSERT ON t2
- FOR EACH ROW
- SET NEW.col = 't2_trg_before_insert';
-
-# - column-level privileges
-
-# TODO: check privileges at CREATE TRIGGER time.
-# --error ER_COLUMNACCESS_DENIED_ERROR
-CREATE TRIGGER t3_trg_err_1 BEFORE INSERT ON t3
- FOR EACH ROW
- SET @mysqltest_var = NEW.col;
-DROP TRIGGER t3_trg_err_1;
-
-# TODO: check privileges at CREATE TRIGGER time.
-# --error ER_COLUMNACCESS_DENIED_ERROR
-CREATE TRIGGER t3_trg_err_2 BEFORE DELETE ON t3
- FOR EACH ROW
- SET @mysqltest_var = OLD.col;
-DROP TRIGGER t3_trg_err_2;
-
-CREATE TRIGGER t4_trg_before_insert BEFORE INSERT ON t4
- FOR EACH ROW
- SET NEW.col = 't4_trg_before_insert';
-
-# parsing (CREATE TRIGGER) time:
-# - check that SELECT is required to read the value;
-# - check that SELECT is not enough to modify the value;
-
---connection default
-
-use mysqltest_db1;
-
-REVOKE UPDATE ON mysqltest_db1.t1 FROM mysqltest_u1@localhost;
-REVOKE UPDATE ON mysqltest_db1.t2 FROM mysqltest_u1@localhost;
-GRANT SELECT ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
-GRANT SELECT ON mysqltest_db1.t2 TO mysqltest_u1@localhost;
-
-REVOKE UPDATE(col) ON mysqltest_db1.t3 FROM mysqltest_u1@localhost;
-REVOKE UPDATE(col) ON mysqltest_db1.t4 FROM mysqltest_u1@localhost;
-GRANT SELECT(col) on mysqltest_db1.t3 TO mysqltest_u1@localhost;
-GRANT SELECT(col) on mysqltest_db1.t4 TO mysqltest_u1@localhost;
-
---connection bug15166_u1_con
-
-use mysqltest_db1;
-
-# - table-level privileges
-
-CREATE TRIGGER t1_trg_after_insert AFTER INSERT ON t1
- FOR EACH ROW
- SET @mysqltest_var = NEW.col;
-
-CREATE TRIGGER t1_trg_after_update AFTER UPDATE ON t1
- FOR EACH ROW
- SET @mysqltest_var = OLD.col;
-
-# TODO: check privileges at CREATE TRIGGER time.
-# --error ER_COLUMNACCESS_DENIED_ERROR
-CREATE TRIGGER t2_trg_err_1 BEFORE UPDATE ON t2
- FOR EACH ROW
- SET NEW.col = 't2_trg_err_1';
-DROP TRIGGER t2_trg_err_1;
-
-# TODO: check privileges at CREATE TRIGGER time.
-# --error ER_COLUMNACCESS_DENIED_ERROR
-CREATE TRIGGER t2_trg_err_2 BEFORE UPDATE ON t2
- FOR EACH ROW
- SET NEW.col = CONCAT(OLD.col, '(updated)');
-DROP TRIGGER t2_trg_err_2;
-
-# - column-level privileges
-
-CREATE TRIGGER t3_trg_after_insert AFTER INSERT ON t3
- FOR EACH ROW
- SET @mysqltest_var = NEW.col;
-
-CREATE TRIGGER t3_trg_after_update AFTER UPDATE ON t3
- FOR EACH ROW
- SET @mysqltest_var = OLD.col;
-
-# TODO: check privileges at CREATE TRIGGER time.
-# --error ER_COLUMNACCESS_DENIED_ERROR
-CREATE TRIGGER t4_trg_err_1 BEFORE UPDATE ON t4
- FOR EACH ROW
- SET NEW.col = 't4_trg_err_1';
-DROP TRIGGER t4_trg_err_1;
-
-# TODO: check privileges at CREATE TRIGGER time.
-# --error ER_COLUMNACCESS_DENIED_ERROR
-CREATE TRIGGER t4_trg_err_2 BEFORE UPDATE ON t4
- FOR EACH ROW
- SET NEW.col = CONCAT(OLD.col, '(updated)');
-DROP TRIGGER t4_trg_err_2;
-
-# execution time:
-# - check that UPDATE is not enough to read the value;
-# - check that UPDATE is required to modify the value;
-
---connection default
-
-use mysqltest_db1;
-
-REVOKE SELECT ON mysqltest_db1.t1 FROM mysqltest_u1@localhost;
-REVOKE SELECT ON mysqltest_db1.t2 FROM mysqltest_u1@localhost;
-GRANT UPDATE ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
-GRANT UPDATE ON mysqltest_db1.t2 TO mysqltest_u1@localhost;
-
-REVOKE SELECT(col) ON mysqltest_db1.t3 FROM mysqltest_u1@localhost;
-REVOKE SELECT(col) ON mysqltest_db1.t4 FROM mysqltest_u1@localhost;
-GRANT UPDATE(col) ON mysqltest_db1.t3 TO mysqltest_u1@localhost;
-GRANT UPDATE(col) ON mysqltest_db1.t4 TO mysqltest_u1@localhost;
-
-# - table-level privileges
-
---error ER_COLUMNACCESS_DENIED_ERROR
-INSERT INTO t1 VALUES('line1');
-
-SELECT * FROM t1;
-SELECT @mysqltest_var;
-
-INSERT INTO t2 VALUES('line2');
-
-SELECT * FROM t2;
-
-# - column-level privileges
-
---error ER_COLUMNACCESS_DENIED_ERROR
-INSERT INTO t3 VALUES('t3_line1');
-
-SELECT * FROM t3;
-SELECT @mysqltest_var;
-
-INSERT INTO t4 VALUES('t4_line2');
-
-SELECT * FROM t4;
-
-# execution time:
-# - check that SELECT is required to read the value;
-# - check that SELECT is not enough to modify the value;
-
---connection default
-
-use mysqltest_db1;
-
-REVOKE UPDATE ON mysqltest_db1.t1 FROM mysqltest_u1@localhost;
-REVOKE UPDATE ON mysqltest_db1.t2 FROM mysqltest_u1@localhost;
-GRANT SELECT ON mysqltest_db1.t1 TO mysqltest_u1@localhost;
-GRANT SELECT ON mysqltest_db1.t2 TO mysqltest_u1@localhost;
-
-REVOKE UPDATE(col) ON mysqltest_db1.t3 FROM mysqltest_u1@localhost;
-REVOKE UPDATE(col) ON mysqltest_db1.t4 FROM mysqltest_u1@localhost;
-GRANT SELECT(col) ON mysqltest_db1.t3 TO mysqltest_u1@localhost;
-GRANT SELECT(col) ON mysqltest_db1.t4 TO mysqltest_u1@localhost;
-
-# - table-level privileges
-
-INSERT INTO t1 VALUES('line3');
-
-SELECT * FROM t1;
-SELECT @mysqltest_var;
-
---error ER_COLUMNACCESS_DENIED_ERROR
-INSERT INTO t2 VALUES('line4');
-
-SELECT * FROM t2;
-
-# - column-level privileges
-
-INSERT INTO t3 VALUES('t3_line2');
-
-SELECT * FROM t3;
-SELECT @mysqltest_var;
-
---error ER_COLUMNACCESS_DENIED_ERROR
-INSERT INTO t4 VALUES('t4_line2');
-
-SELECT * FROM t4;
-
-# execution time:
-# - check that nor SELECT either UPDATE is required to execute triggger w/o
-# NEW/OLD variables.
-
-DELETE FROM t1;
-
-SELECT @mysqltest_var;
-
-#
-# Cleanup.
-#
-
-DROP USER mysqltest_u1@localhost;
-
-DROP DATABASE mysqltest_db1;
-
-
-#
-# Test for bug #14635 Accept NEW.x as INOUT parameters to stored
-# procedures from within triggers
-#
-# We require UPDATE privilege when NEW.x passed as OUT parameter, and
-# SELECT and UPDATE when NEW.x passed as INOUT parameter.
-#
-DELETE FROM mysql.user WHERE User LIKE 'mysqltest_%';
-DELETE FROM mysql.db WHERE User LIKE 'mysqltest_%';
-DELETE FROM mysql.tables_priv WHERE User LIKE 'mysqltest_%';
-DELETE FROM mysql.columns_priv WHERE User LIKE 'mysqltest_%';
-FLUSH PRIVILEGES;
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest_db1;
---enable_warnings
-
-CREATE DATABASE mysqltest_db1;
-USE mysqltest_db1;
-
-CREATE TABLE t1 (i1 INT);
-CREATE TABLE t2 (i1 INT);
-
-CREATE USER mysqltest_dfn@localhost;
-CREATE USER mysqltest_inv@localhost;
-
-GRANT EXECUTE, CREATE ROUTINE, TRIGGER ON *.* TO mysqltest_dfn@localhost;
-GRANT INSERT ON mysqltest_db1.* TO mysqltest_inv@localhost;
-
-connect (definer,localhost,mysqltest_dfn,,mysqltest_db1);
-connect (invoker,localhost,mysqltest_inv,,mysqltest_db1);
-
-connection definer;
-CREATE PROCEDURE p1(OUT i INT) DETERMINISTIC NO SQL SET i = 3;
-CREATE PROCEDURE p2(INOUT i INT) DETERMINISTIC NO SQL SET i = i * 5;
-
-# Check that having no privilege won't work.
-connection definer;
-CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
- CALL p1(NEW.i1);
-CREATE TRIGGER t2_bi BEFORE INSERT ON t2 FOR EACH ROW
- CALL p2(NEW.i1);
-
-connection invoker;
---error ER_COLUMNACCESS_DENIED_ERROR
-INSERT INTO t1 VALUES (7);
---error ER_COLUMNACCESS_DENIED_ERROR
-INSERT INTO t2 VALUES (11);
-
-connection definer;
-DROP TRIGGER t2_bi;
-DROP TRIGGER t1_bi;
-
-# Check that having only SELECT privilege is not enough.
-connection default;
-GRANT SELECT ON mysqltest_db1.* TO mysqltest_dfn@localhost;
-
-connection definer;
-CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
- CALL p1(NEW.i1);
-CREATE TRIGGER t2_bi BEFORE INSERT ON t2 FOR EACH ROW
- CALL p2(NEW.i1);
-
-connection invoker;
---error ER_COLUMNACCESS_DENIED_ERROR
-INSERT INTO t1 VALUES (13);
---error ER_COLUMNACCESS_DENIED_ERROR
-INSERT INTO t2 VALUES (17);
-
-connection default;
-REVOKE SELECT ON mysqltest_db1.* FROM mysqltest_dfn@localhost;
-
-connection definer;
-DROP TRIGGER t2_bi;
-DROP TRIGGER t1_bi;
-
-# Check that having only UPDATE privilege is enough for OUT parameter,
-# but not for INOUT parameter.
-connection default;
-GRANT UPDATE ON mysqltest_db1.* TO mysqltest_dfn@localhost;
-
-connection definer;
-CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
- CALL p1(NEW.i1);
-CREATE TRIGGER t2_bi BEFORE INSERT ON t2 FOR EACH ROW
- CALL p2(NEW.i1);
-
-connection invoker;
-INSERT INTO t1 VALUES (19);
---error ER_COLUMNACCESS_DENIED_ERROR
-INSERT INTO t2 VALUES (23);
-
-connection default;
-REVOKE UPDATE ON mysqltest_db1.* FROM mysqltest_dfn@localhost;
-
-connection definer;
-DROP TRIGGER t2_bi;
-DROP TRIGGER t1_bi;
-
-# Check that having SELECT and UPDATE privileges is enough.
-connection default;
-GRANT SELECT, UPDATE ON mysqltest_db1.* TO mysqltest_dfn@localhost;
-
-connection definer;
-CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
- CALL p1(NEW.i1);
-CREATE TRIGGER t2_bi BEFORE INSERT ON t2 FOR EACH ROW
- CALL p2(NEW.i1);
-
-connection invoker;
-INSERT INTO t1 VALUES (29);
-INSERT INTO t2 VALUES (31);
-
-connection default;
-REVOKE SELECT, UPDATE ON mysqltest_db1.* FROM mysqltest_dfn@localhost;
-
-connection definer;
-DROP TRIGGER t2_bi;
-DROP TRIGGER t1_bi;
-
-connection default;
-DROP PROCEDURE p2;
-DROP PROCEDURE p1;
-
-# Check that late procedure redefining won't open a security hole.
-connection default;
-GRANT UPDATE ON mysqltest_db1.* TO mysqltest_dfn@localhost;
-
-connection definer;
-CREATE PROCEDURE p1(OUT i INT) DETERMINISTIC NO SQL SET i = 37;
-CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
- CALL p1(NEW.i1);
-
-connection invoker;
-INSERT INTO t1 VALUES (41);
-
-connection definer;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1(IN i INT) DETERMINISTIC NO SQL SET @v1 = i + 43;
-
-connection invoker;
---error ER_COLUMNACCESS_DENIED_ERROR
-INSERT INTO t1 VALUES (47);
-
-connection definer;
-DROP PROCEDURE p1;
-CREATE PROCEDURE p1(INOUT i INT) DETERMINISTIC NO SQL SET i = i + 51;
-
-connection invoker;
---error ER_COLUMNACCESS_DENIED_ERROR
-INSERT INTO t1 VALUES (53);
-
-connection default;
-DROP PROCEDURE p1;
-REVOKE UPDATE ON mysqltest_db1.* FROM mysqltest_dfn@localhost;
-
-connection definer;
-DROP TRIGGER t1_bi;
-
-# Cleanup.
-disconnect definer;
-disconnect invoker;
-connection default;
-DROP USER mysqltest_inv@localhost;
-DROP USER mysqltest_dfn@localhost;
-DROP TABLE t2;
-DROP TABLE t1;
-DROP DATABASE mysqltest_db1;
-USE test;
-
-#
-# Bug #26162: Trigger DML ignores low_priority_updates setting
-#
-CREATE TABLE t1 (id INTEGER);
-CREATE TABLE t2 (id INTEGER);
-
-INSERT INTO t2 VALUES (1),(2);
-
-# trigger that produces the high priority insert, but should be low, adding
-# LOW_PRIORITY fixes this
-CREATE TRIGGER t1_test AFTER INSERT ON t1 FOR EACH ROW
- INSERT INTO t2 VALUES (new.id);
-
-CONNECT (rl_holder, localhost, root,,);
-CONNECT (rl_acquirer, localhost, root,,);
-CONNECT (wl_acquirer, localhost, root,,);
-CONNECT (rl_contender, localhost, root,,);
-
-CONNECTION rl_holder;
-SELECT GET_LOCK('B26162',120);
-
-CONNECTION rl_acquirer;
-let $rl_acquirer_thread_id = `SELECT @@pseudo_thread_id`;
---send
-SELECT 'rl_acquirer', GET_LOCK('B26162',120), id FROM t2 WHERE id = 1;
-
-CONNECTION wl_acquirer;
-let $wl_acquirer_thread_id = `SELECT @@pseudo_thread_id`;
-SET SESSION LOW_PRIORITY_UPDATES=1;
-SET GLOBAL LOW_PRIORITY_UPDATES=1;
-#need to wait for rl_acquirer to lock on the B26162 lock
-let $wait_condition=
- SELECT STATE = 'User lock' FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE ID = $rl_acquirer_thread_id;
---source include/wait_condition.inc
---send
-INSERT INTO t1 VALUES (5);
-
-CONNECTION rl_contender;
-# Wait until wl_acquirer is waiting for the read lock on t2 to be released.
-let $wait_condition=
- SELECT STATE = 'Waiting for table level lock' FROM INFORMATION_SCHEMA.PROCESSLIST
- WHERE ID = $wl_acquirer_thread_id;
---source include/wait_condition.inc
-# must not "see" the row inserted by the INSERT (as it must run before the
-# INSERT)
---send
-SELECT 'rl_contender', id FROM t2 WHERE id > 1;
-
-CONNECTION rl_holder;
-#need to wait for wl_acquirer and rl_contender to lock on t2
-sleep 2;
-SELECT RELEASE_LOCK('B26162');
-
-CONNECTION rl_acquirer;
---reap
-SELECT RELEASE_LOCK('B26162');
-CONNECTION wl_acquirer;
---reap
-CONNECTION rl_contender;
---reap
-
-CONNECTION default;
-DISCONNECT rl_acquirer;
-DISCONNECT wl_acquirer;
-DISCONNECT rl_contender;
-DISCONNECT rl_holder;
-
-DROP TRIGGER t1_test;
-DROP TABLE t1,t2;
-SET SESSION LOW_PRIORITY_UPDATES=DEFAULT;
-SET GLOBAL LOW_PRIORITY_UPDATES=DEFAULT;
-
---echo End of 5.0 tests.
-
-#
-# Bug#23713 LOCK TABLES + CREATE TRIGGER + FLUSH TABLES WITH READ LOCK = deadlock
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (i int);
-connect (flush,localhost,root,,test,,);
-connection default;
-lock tables t1 write;
-connection flush;
---send flush tables with read lock;
-connection default;
-let $wait_condition=
- select count(*) = 1 from information_schema.processlist
- where state = "Waiting for global read lock";
---source include/wait_condition.inc
-create trigger t1_bi before insert on t1 for each row begin end;
-unlock tables;
-connection flush;
---reap
-unlock tables;
-connection default;
-select * from t1;
-drop table t1;
-disconnect flush;
-
-#
-# Bug#45412 SHOW CREATE TRIGGER does not require privileges to disclose trigger data
-#
-CREATE DATABASE db1;
-CREATE TABLE db1.t1 (a char(30)) ENGINE=MEMORY;
-CREATE TRIGGER db1.trg AFTER INSERT ON db1.t1 FOR EACH ROW
- INSERT INTO db1.t1 VALUES('Some very sensitive data goes here');
-
-CREATE USER 'no_rights'@'localhost';
-REVOKE ALL ON *.* FROM 'no_rights'@'localhost';
-FLUSH PRIVILEGES;
-
-connect (con1,localhost,no_rights,,);
-SELECT trigger_name FROM INFORMATION_SCHEMA.TRIGGERS
- WHERE trigger_schema = 'db1';
---error ER_SPECIFIC_ACCESS_DENIED_ERROR
-SHOW CREATE TRIGGER db1.trg;
-
-connection default;
-disconnect con1;
-DROP USER 'no_rights'@'localhost';
-DROP DATABASE db1;
-
-#
-# Bug#55421 Protocol::end_statement(): Assertion `0' on multi-table UPDATE IGNORE
-# To reproduce a crash we need to provoke a trigger execution with
-# the following conditions:
-# - active SELECT statement during trigger execution
-# (i.e. LEX::current_select != NULL);
-# - IGNORE option (i.e. LEX::current_select->no_error == TRUE);
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest_db1;
---enable_warnings
-
-CREATE DATABASE mysqltest_db1;
-USE mysqltest_db1;
-
-CREATE USER mysqltest_u1@localhost;
-GRANT ALL ON mysqltest_db1.* TO mysqltest_u1@localhost;
-
---connect(con1,localhost,mysqltest_u1,,mysqltest_db1)
-
-CREATE TABLE t1 (
- a1 int,
- a2 int
-);
-INSERT INTO t1 VALUES (1, 20);
-
-CREATE TRIGGER mysqltest_db1.upd_t1
-BEFORE UPDATE ON t1 FOR EACH ROW SET new.a2 = 200;
-
-CREATE TABLE t2 (
- a1 int
-);
-
-INSERT INTO t2 VALUES (2);
-
---connection default
-
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE IGNORE t1, t2 SET t1.a1 = 2, t2.a1 = 3 WHERE t1.a1 = 1 AND t2.a1 = 2;
-# Cleanup
-
-DROP DATABASE mysqltest_db1;
-DROP USER mysqltest_u1@localhost;
-
---disconnect con1
---connection default
-USE test;
-
---echo End of 5.1 tests.
diff --git a/mysql-test/t/trigger_null-8605.test b/mysql-test/t/trigger_null-8605.test
deleted file mode 100644
index 34a57654b48..00000000000
--- a/mysql-test/t/trigger_null-8605.test
+++ /dev/null
@@ -1,389 +0,0 @@
-#
-# MDEV-8605 MariaDB not use DEFAULT value even when inserted NULL for NOT NULLABLE column.
-#
-
-set sql_mode=strict_all_tables;
-set time_zone="+02:00";
-
-create table t1 (a int not null, b int, c int);
-create trigger trgi before insert on t1 for each row set new.a=if(new.a is null,new.b,new.c);
-
-# INSERT
-insert t1 values (10, NULL, 1);
-insert t1 values (NULL, 2, NULL);
---error ER_BAD_NULL_ERROR
-insert t1 values (NULL, NULL, 20);
---error ER_BAD_NULL_ERROR
-insert t1 values (1, 2, NULL);
-select * from t1;
-
-# INSERT IGNORE
-insert ignore t1 values (NULL, NULL, 30);
-insert ignore t1 values (1, 3, NULL);
-select * from t1;
-
-# fields in the value list
-insert t1 set a=NULL, b=4, c=a;
-select * from t1;
-delete from t1;
-
-#insert (column list)
-insert t1 (a,c) values (10, 1);
-insert t1 (a,b) values (NULL, 2);
---error ER_BAD_NULL_ERROR
-insert t1 (a,c) values (NULL, 20);
---error ER_BAD_NULL_ERROR
-insert t1 (a,b) values (1, 2);
-select * from t1;
-delete from t1;
-
-# insert select
-
-insert t1 select 10, NULL, 1;
-insert t1 select NULL, 2, NULL;
---error ER_BAD_NULL_ERROR
-insert t1 select NULL, NULL, 20;
---error ER_BAD_NULL_ERROR
-insert t1 select 1, 2, NULL;
-insert ignore t1 select NULL, NULL, 30;
-insert ignore t1 select 1, 3, NULL;
-select * from t1;
-delete from t1;
-
-# insert delayed
-insert delayed t1 values (10, NULL, 1);
-insert delayed t1 values (NULL, 2, NULL);
---error ER_BAD_NULL_ERROR
-insert delayed t1 values (NULL, NULL, 20);
---error ER_BAD_NULL_ERROR
-insert delayed t1 values (1, 2, NULL);
-select * from t1;
-insert delayed ignore t1 values (NULL, NULL, 30);
-insert delayed ignore t1 values (1, 3, NULL);
-flush table t1; # wait for inserts to finish
-select * from t1;
-delete from t1;
-
-# insert on dup key update
-alter table t1 add primary key (a);
-create trigger trgu before update on t1 for each row set new.a=if(new.a is null,new.b,new.c);
-
-insert t1 values (100,100,100), (200,200,200), (300,300,300);
-insert t1 values (100,100,100) on duplicate key update a=10, b=NULL, c=1;
-insert t1 values (200,200,200) on duplicate key update a=NULL, b=2, c=NULL;
---error ER_BAD_NULL_ERROR
-insert t1 values (300,300,300) on duplicate key update a=NULL, b=NULL, c=20;
---error ER_BAD_NULL_ERROR
-insert t1 values (300,300,300) on duplicate key update a=1, b=2, c=NULL;
-select * from t1;
-delete from t1;
-
-# replace
-insert t1 values (1,100,1), (2,200,2);
-replace t1 values (10, NULL, 1);
-replace t1 values (NULL, 2, NULL);
---error ER_BAD_NULL_ERROR
-replace t1 values (NULL, NULL, 30);
---error ER_BAD_NULL_ERROR
-replace t1 values (1, 3, NULL);
-select * from t1;
-delete from t1;
-
-# update
-insert t1 values (100,100,100), (200,200,200), (300,300,300);
-update t1 set a=10, b=NULL, c=1 where a=100;
-update t1 set a=NULL, b=2, c=NULL where a=200;
---error ER_BAD_NULL_ERROR
-update t1 set a=NULL, b=NULL, c=20 where a=300;
---error ER_BAD_NULL_ERROR
-update t1 set a=1, b=2, c=NULL where a=300;
-select * from t1;
-# Test UPDATE with NULL violation in many rows
---error ER_DUP_ENTRY
-set statement sql_mode='' for update t1 set a=1, b=2, c=NULL where a > 1;
-select * from t1;
-# fields in the value list
-update t1 set a=NULL, b=4, c=a where a=300;
-select * from t1;
-delete from t1;
-
-# multi-update
-
-create table t2 (d int, e int);
-insert t1 values (100,100,100), (200,200,200), (300,300,300);
-insert t2 select a,b from t1;
-update t1,t2 set a=10, b=NULL, c=1 where b=d and e=100;
-update t1,t2 set a=NULL, b=2, c=NULL where b=d and e=200;
---error ER_BAD_NULL_ERROR
-update t1,t2 set a=NULL, b=NULL, c=20 where b=d and e=300;
---error ER_BAD_NULL_ERROR
-update t1,t2 set a=1, b=2, c=NULL where b=d and e=300;
-select * from t1;
-# fields in the value list
-update t1,t2 set a=NULL, b=4, c=a where b=d and e=300;
-select * from t1;
-delete from t1;
-
-# view
-insert t2 values (2,2);
-create view v1 as select * from t1, t2 where d=2;
-insert v1 (a,c) values (10, 1);
-insert v1 (a,b) values (NULL, 2);
---error ER_BAD_NULL_ERROR
-insert v1 (a,c) values (NULL, 20);
---error ER_BAD_NULL_ERROR
-insert v1 (a,b) values (1, 2);
-select * from v1;
-delete from t1;
-drop view v1;
-drop table t2;
-
-# load data
-let $datadir=`select @@datadir`;
---write_file $datadir/test/mdev8605.txt
-10,\N,1
-\N,2,\N
-\N,\N,20
-EOF
---error ER_BAD_NULL_ERROR
-load data infile 'mdev8605.txt' into table t1 fields terminated by ',';
-select * from t1;
-drop table t1;
-
-# timestamps (on NULL = NOW())
-create table t1 (a timestamp, b int auto_increment primary key);
-create trigger trgi before insert on t1 for each row set new.a=if(new.a is null, '2000-10-20 10:20:30', NULL);
-set statement timestamp=777777777 for insert t1 (a) values (NULL);
-set statement timestamp=888888888 for insert t1 (a) values ('1999-12-11 10:9:8');
-select b, a, unix_timestamp(a) from t1;
-set statement timestamp=999999999 for update t1 set b=3 where b=2;
-select b, a, unix_timestamp(a) from t1;
-create trigger trgu before update on t1 for each row set new.a='2011-11-11 11:11:11';
-update t1 set b=4 where b=3;
-select b, a, unix_timestamp(a) from t1;
-drop table t1;
-
-# auto-increment (on NULL = int)
-create table t1 (a int auto_increment primary key);
-create trigger trgi before insert on t1 for each row set new.a=if(new.a is null, 5, NULL);
-insert t1 values (NULL);
-insert t1 values (10);
-select a from t1;
-drop table t1;
-
-# insert, all columns NULLable
-create table t1 (a int, b int, c int);
-create trigger trgi before insert on t1 for each row set new.a=if(new.a is null,new.b,new.c);
-insert t1 values (10, NULL, 1);
-insert t1 values (NULL, 2, NULL);
-insert t1 values (NULL, NULL, 20);
-insert t1 values (1, 2, NULL);
-select * from t1;
-drop table t1;
-
-# more load data: autoinc and timestamp, different load formats
-create table t1 (a1 tinyint not null, a2 timestamp not null,
- a3 tinyint not null auto_increment primary key,
- b tinyint, c int not null);
-delimiter |;
-create trigger trgi before insert on t1 for each row
-begin
- if new.b=1 then set new.a1=if(new.c,new.c,null); end if;
- if new.b=2 then set new.a2=if(new.c,new.c,null); end if;
- if new.b=3 then set new.a3=if(new.c,new.c,null); end if;
-end|
-delimiter ;|
-
---write_file $datadir/test/sep8605.txt
-1,2010-11-12 1:2:3,10,0,0
-\N,2010-11-12 1:2:3,11,1,2
-3,\N,12,0,0
-4,\N,13,2,908070605
-5,2010-11-12 1:2:3,14,2,0
-6,2010-11-12 1:2:3,\N,0,0
-7,2010-11-12 1:2:3,\N,3,20
-8,2010-11-12 1:2:3,30,3,0
-99,2010-11-12 1:2:3,0,1,0
-EOF
-
---error ER_BAD_NULL_ERROR
-set statement timestamp=777777777 for
-load data infile 'sep8605.txt' into table t1 fields terminated by ',';
-select * from t1;
-delete from t1;
-
---error ER_BAD_NULL_ERROR
-set statement timestamp=777777777 for
-load data infile 'sep8605.txt' into table t1 fields terminated by ','
- (@a,a2,a3,b,c) set a1=100-@a;
-select 100-a1,a2,a3,b,c from t1;
-delete from t1;
-
---write_file $datadir/test/fix8605.txt
-00012010-11-12 01:02:030010000000000000000
-00052010-11-12 01:02:030014000200000000000
-00082010-11-12 01:02:030030000300000000000
-00992010-11-12 01:02:030000000100000000000
-EOF
-
---error ER_BAD_NULL_ERROR
-set statement timestamp=777777777 for
-load data infile 'fix8605.txt' into table t1 fields terminated by '';
-select * from t1;
-delete from t1;
-
---write_file $datadir/test/xml8605.txt
-<data>
- <row>
- <field name="a1">1</field>
- <field name="a2">2010-11-12 1:2:3</field>
- <field name="a3">10</field>
- <field name="b">0</field>
- <field name="c">0</field>
- </row>
- <row>
- <field name="a2">2010-11-12 1:2:3</field>
- <field name="a3">11</field>
- <field name="b">1</field>
- <field name="c">2</field>
- </row>
- <row>
- <field name="a1">3</field>
- <field name="a3">12</field>
- <field name="b">0</field>
- <field name="c">0</field>
- </row>
- <row>
- <field name="a1">4</field>
- <field name="a3">13</field>
- <field name="b">2</field>
- <field name="c">908070605</field>
- </row>
- <row>
- <field name="a1">5</field>
- <field name="a2">2010-11-12 1:2:3</field>
- <field name="a3">14</field>
- <field name="b">2</field>
- <field name="c">0</field>
- </row>
- <row>
- <field name="a1">6</field>
- <field name="a2">2010-11-12 1:2:3</field>
- <field name="b">0</field>
- <field name="c">0</field>
- </row>
- <row>
- <field name="a1">7</field>
- <field name="a2">2010-11-12 1:2:3</field>
- <field name="b">3</field>
- <field name="c">20</field>
- </row>
- <row>
- <field name="a1">8</field>
- <field name="a2">2010-11-12 1:2:3</field>
- <field name="a3">30</field>
- <field name="b">3</field>
- <field name="c">0</field>
- </row>
- <row>
- <field name="a1">99</field>
- <field name="a2">2010-11-12 1:2:3</field>
- <field name="a3">0</field>
- <field name="b">1</field>
- <field name="c">0</field>
- </row>
-</data>
-EOF
-
---error ER_BAD_NULL_ERROR
-set statement timestamp=777777777 for
-load xml infile 'xml8605.txt' into table t1 rows identified by '<row>';
-select * from t1;
-drop table t1;
-
-# explicit DEFAULT
-create table t1 (a int not null default 5, b int, c int);
-create trigger trgi before insert on t1 for each row set new.b=new.c;
-insert t1 values (DEFAULT,2,1);
-select * from t1;
-drop table t1;
-
-# Two statements, first fails, second uses an implicit default
-create table t1 (a int not null, b int not null default 5, c int);
-delimiter |;
-create trigger trgi before insert on t1 for each row
-begin
- if new.c=1 then set new.a=1, new.b=1; end if;
- if new.c=2 then set new.a=NULL, new.b=NULL; end if;
- if new.c=3 then set new.a=2; end if;
-end|
-delimiter ;|
-
-insert t1 values (9, 9, 1);
---error ER_BAD_NULL_ERROR
-insert t1 values (9, 9, 2);
-insert t1 (a,c) values (9, 3);
-select * from t1;
-drop table t1;
-
-#
-# MDEV-9428 NO_AUTO_VALUE_ON_ZERO is ignored when a trigger before insert is defined
-#
-set session sql_mode ='no_auto_value_on_zero';
-create table t1 (id int unsigned auto_increment primary key);
-insert t1 values (0);
-select * from t1;
-delete from t1;
-create trigger t1_bi before insert on t1 for each row begin end;
-insert t1 values (0);
---error ER_DUP_ENTRY
-insert t1 (id) values (0);
-drop table t1;
-
-#
-# MDEV-9500 Bug after upgrade to 10.1.10 (and 10.1.11)
-#
-create table t1 (a int not null, b int);
-create trigger trgi before update on t1 for each row do 1;
-insert t1 values (1,1),(2,2),(3,3),(1,4);
-create table t2 select a as c, b as d from t1;
-update t1 set a=(select count(c) from t2 where c+1=a+1 group by a);
-select * from t1;
-drop table t1, t2;
-
-#
-# MDEV-9535 Trigger doing "SET NEW.auctionStart = NOW();" on a timestamp kills MariaDB server.
-#
-create table t1 (a int not null);
-create table t2 (f1 int unsigned not null, f2 int);
-insert into t2 values (1, null);
-create trigger tr1 before update on t1 for each row do 1;
-create trigger tr2 after update on t2 for each row update t1 set a=new.f2;
-update t2 set f2=1 where f1=1;
-drop table t1, t2;
-
-#
-# MDEV-9629 Disappearing PRI from Key column after creating a trigger
-#
-create table t1 (a int not null, primary key (a));
-insert into t1 (a) values (1);
-show columns from t1;
-create trigger t1bu before update on t1 for each row begin end;
-show columns from t1;
-insert into t1 (a) values (3);
-show columns from t1;
-drop table t1;
-
-#
-# MDEV-11551 Server crashes in Field::is_real_null
-#
-create table t1 (
- pk int primary key,
- i int,
- v1 int as (i) virtual,
- v2 int as (i) virtual
-);
-create trigger tr before update on t1 for each row set @a = 1;
---error ER_BAD_NULL_ERROR
-insert into t1 (pk, i) values (null, null);
-drop table t1;
diff --git a/mysql-test/t/trigger_wl3253.test b/mysql-test/t/trigger_wl3253.test
deleted file mode 100644
index 3504eeaf889..00000000000
--- a/mysql-test/t/trigger_wl3253.test
+++ /dev/null
@@ -1,428 +0,0 @@
---echo #
---echo # WL#3253: multiple triggers per table
---echo #
-
-SET @binlog_format_saved = @@binlog_format;
-SET binlog_format=ROW;
-SET time_zone='+00:00';
-
---echo #
---echo # Test 1.
---echo # Check that the sequence of triggers for the same combination
---echo # of event type/action type can be created for a table
---echo # and is fired consequently in the order of its creation
---echo # during statement execution.
---echo # In this test we check BEFORE triggers.
---echo #
-
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (a INT, b INT AUTO_INCREMENT PRIMARY KEY);
-
-CREATE TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 (a) VALUES (NEW.a);
-CREATE TRIGGER tr2_bi BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 (a) VALUES (NEW.a + 100);
-
-INSERT INTO t1 VALUES (1);
-
-SELECT * FROM t2 ORDER BY b;
-
-DROP TABLE t2;
-DROP TABLE t1;
-
---echo #
---echo # Test 2.
---echo # Check that the sequence of triggers for the same combination
---echo # of event type/action type can be created for a table
---echo # and is fired consequently in the order of its creation
---echo # during statement execution.
---echo # In this test we check AFTER triggers.
---echo #
-
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (a INT, b INT AUTO_INCREMENT PRIMARY KEY);
-
-CREATE TRIGGER tr1_bi AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 (a) VALUES (NEW.a);
-CREATE TRIGGER tr2_bi AFTER INSERT ON t1 FOR EACH ROW INSERT INTO t2 (a) VALUES (NEW.a + 100);
-
-INSERT INTO t1 VALUES (1);
-
-SELECT * FROM t2 ORDER BY b;
-
-DROP TABLE t2;
-DROP TABLE t1;
-
---echo #
---echo # Test 3.
---echo # Check that the sequences of triggers for the different event types
---echo # can be created for a table and are fired consequently
---echo # in the order of its creation during statement execution.
---echo #
-
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (a INT, b INT AUTO_INCREMENT PRIMARY KEY);
-
-CREATE TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 (a) VALUES (NEW.a);
-CREATE TRIGGER tr2_bi BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 (a) VALUES (NEW.a + 100);
-
-CREATE TRIGGER tr1_bu BEFORE UPDATE ON t1 FOR EACH ROW INSERT INTO t2 (a) VALUES (NEW.a);
-CREATE TRIGGER tr2_bu BEFORE UPDATE ON t1 FOR EACH ROW INSERT INTO t2 (a) VALUES (NEW.a + 300);
-
-INSERT INTO t1 VALUES (1);
-
-SELECT * FROM t2 ORDER BY b;
-
-UPDATE t1 SET a = 5;
-
-SELECT * FROM t2 ORDER BY b;
-
-DROP TABLE t2;
-DROP TABLE t1;
-
---echo #
---echo # Test 4.
---echo # Check that every new created trigger has unique action_order value
---echo # started from 1 and NOT NULL value for creation timestamp.
---echo #
-
-CREATE TABLE t1 (a INT);
-
-SET TIMESTAMP=UNIX_TIMESTAMP('2013-01-31 09:00:00');
-CREATE TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1;
-SET TIMESTAMP=UNIX_TIMESTAMP('2013-01-31 09:00:01');
-CREATE TRIGGER tr2_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=2;
-
-SELECT trigger_name, created, action_order FROM information_schema.triggers WHERE trigger_schema='test';
-
-DROP TABLE t1;
-SET TIMESTAMP=DEFAULT;
-
---echo #
---echo # Test 5.
---echo # Check that action_order attribute isn't shown
---echo # in the output of SHOW TRIGGERS and SHOW CREATE TRIGGER
---echo #
-
-CREATE TABLE t1 (a INT);
-CREATE TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1;
-
---replace_column 6 #
-SHOW TRIGGERS;
-
---replace_column 17 #
-SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_schema = 'test';
-
---replace_column 7 #
-SHOW CREATE TRIGGER tr1_bi;
-
-DROP TABLE t1;
-
---echo #
---echo # Test 6.
---echo # Check that action_order attribute is reused when trigger
---echo # are recreated.
---echo #
-
-CREATE TABLE t1 (a INT);
-CREATE TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1;
-
-SELECT trigger_name, action_order FROM information_schema.triggers WHERE trigger_schema='test';
-
-DROP TRIGGER tr1_bi;
-
-CREATE TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=2;
-
-SELECT trigger_name, action_order FROM information_schema.triggers WHERE trigger_schema='test';
-
-DROP TABLE t1;
-
---echo #
---echo # Test 7.
---echo # Check that it is possible to create several triggers with
---echo # the same value for creation timestamp.
---echo #
-
-CREATE TABLE t1 (a INT);
-
-SET TIMESTAMP=UNIX_TIMESTAMP('2013-01-31 09:00:01');
-CREATE TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1;
-CREATE TRIGGER tr2_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=2;
-
-SELECT trigger_name, created, action_order FROM information_schema.triggers WHERE trigger_schema='test';
-
-DROP TABLE t1;
-SET TIMESTAMP=DEFAULT;
-
---echo #
---echo # Test 8.
---echo # Check that SHOW CREATE TRIGGER outputs the CREATED attribute
---echo # and it is not NULL
---echo #
-
-CREATE TABLE t1 (a INT);
-
-SET TIMESTAMP=UNIX_TIMESTAMP('2013-01-31 09:00:01');
-CREATE TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1;
-SHOW CREATE TRIGGER tr1_bi;
-
-DROP TABLE t1;
-SET TIMESTAMP=DEFAULT;
-
---echo #
---echo # Test 9.
---echo # Check that SHOW TRIGGERS outputs the CREATED attribute
---echo # and it is not NULL.
---echo #
-
-CREATE TABLE t1 (a INT);
-
-SET TIMESTAMP=UNIX_TIMESTAMP('2013-01-31 09:00:01');
-
-CREATE TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1;
-
-SHOW TRIGGERS;
-
-SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_schema = 'test';
-
-DROP TABLE t1;
-
-SET TIMESTAMP=DEFAULT;
-
---echo #
---echo # Test 10.
---echo # Check that FOLLOWS clause is supported and works correctly.
---echo #
-
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (a INT, b INT AUTO_INCREMENT PRIMARY KEY);
-
-CREATE TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 (a) VALUES (NEW.a + 100);
-CREATE TRIGGER tr3_bi BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 (a) VALUES (NEW.a + 300);
-CREATE TRIGGER tr2_bi BEFORE INSERT ON t1 FOR EACH ROW FOLLOWS tr1_bi INSERT INTO t2 (a) VALUES (NEW.a + 200);
-
-SELECT trigger_name, action_order FROM information_schema.triggers WHERE trigger_schema='test';
-
-INSERT INTO t1 VALUES (1);
-SELECT * FROM t2 ORDER BY b;
-
-DROP TABLE t2;
-DROP TABLE t1;
-
---echo #
---echo # Test 11.
---echo # Check that PRECEDES clause is supported and works correctly.
---echo #
-
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (a INT, b INT AUTO_INCREMENT PRIMARY KEY);
-
-CREATE TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 (a) VALUES (NEW.a + 100);
-CREATE TRIGGER tr3_bi BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 (a) VALUES (NEW.a + 300);
-CREATE TRIGGER tr2_bi BEFORE INSERT ON t1 FOR EACH ROW PRECEDES tr3_bi INSERT INTO t2 (a) VALUES (NEW.a + 200);
-
-SELECT trigger_name, action_order FROM information_schema.triggers WHERE trigger_schema='test';
-
-INSERT INTO t1 VALUES (1);
-SELECT * FROM t2 ORDER BY b;
-
-DROP TABLE t2;
-DROP TABLE t1;
-
---echo #
---echo # Test 12.
---echo # Check that the PRECEDES works properly for the 1st trigger in the chain.
---echo #
-
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (a INT, b INT AUTO_INCREMENT PRIMARY KEY);
-
-CREATE TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 (a) VALUES (NEW.a + 100);
-CREATE TRIGGER tr0_bi BEFORE INSERT ON t1 FOR EACH ROW PRECEDES tr1_bi INSERT INTO t2 (a) VALUES (NEW.a);
-
-SELECT trigger_name, action_order FROM information_schema.triggers WHERE trigger_schema='test';
-
-INSERT INTO t1 VALUES (1);
-SELECT * FROM t2 ORDER BY b;
-
-DROP TABLE t2;
-DROP TABLE t1;
-
---echo #
---echo # Test 13.
---echo # Check that error is reported if the FOLLOWS clause references to
---echo # non-existing trigger
---echo #
-
-CREATE TABLE t1 (a INT);
-
-CREATE TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1;
-CREATE TRIGGER tr3_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=3;
-
---error ER_REFERENCED_TRG_DOES_NOT_EXIST
-CREATE TRIGGER tr2_bi BEFORE INSERT ON t1 FOR EACH ROW FOLLOWS tr0_bi SET @a:=2;
-
-SELECT trigger_name, action_order FROM information_schema.triggers WHERE trigger_schema='test';
-
-DROP TABLE t1;
-
---echo #
---echo # Test 14.
---echo # Check that error is reported if the PRECEDES clause references to
---echo # non-existing trigger
---echo #
-
-CREATE TABLE t1 (a INT);
-
-CREATE TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1;
-CREATE TRIGGER tr3_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=3;
-
---error ER_REFERENCED_TRG_DOES_NOT_EXIST
-CREATE TRIGGER tr2_bi BEFORE INSERT ON t1 FOR EACH ROW PRECEDES tr0_bi SET @a:=2;
-
-SELECT trigger_name, action_order FROM information_schema.triggers WHERE trigger_schema='test';
-
-DROP TABLE t1;
-
---echo #
---echo # Test 15.
---echo # Check that action_order value is independent for each type of event
---echo # (INSERT/UPDATE/DELETE)
---echo #
-
-CREATE TABLE t1 (a INT);
-
-CREATE TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1;
-CREATE TRIGGER tr2_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=2;
-CREATE TRIGGER tr1_bu BEFORE UPDATE ON t1 FOR EACH ROW SET @a:=3;
-
-SELECT trigger_name, action_order FROM information_schema.triggers WHERE trigger_schema='test';
-
-CREATE TRIGGER tr3_bi BEFORE INSERT ON t1 FOR EACH ROW FOLLOWS tr2_bi SET @a:=3;
-CREATE TRIGGER tr2_bu BEFORE UPDATE ON t1 FOR EACH ROW FOLLOWS tr1_bu SET @a:=3;
-
-SELECT trigger_name, action_order FROM information_schema.triggers WHERE trigger_schema='test';
-
-DROP TABLE t1;
-
---echo #
---echo # Test 16.
---echo # Check that the trigger in the clause FOLLOWS/PRECEDES can refences
---echo # only to the trigger for the same ACTION/TIMINMG
---echo #
-
-CREATE TABLE t1 (a INT);
-CREATE TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1;
-CREATE TRIGGER tr1_bu BEFORE UPDATE ON t1 FOR EACH ROW SET @a:=3;
-
---error ER_REFERENCED_TRG_DOES_NOT_EXIST
-CREATE TRIGGER tr2_bu BEFORE UPDATE ON t1 FOR EACH ROW FOLLOWS tr1_bi SET @a:=3;
-
---error ER_REFERENCED_TRG_DOES_NOT_EXIST
-CREATE TRIGGER tr2_au AFTER UPDATE ON t1 FOR EACH ROW FOLLOWS tr1_bi SET @a:=3;
-
---error ER_REFERENCED_TRG_DOES_NOT_EXIST
-CREATE TRIGGER tr1_au AFTER UPDATE ON t1 FOR EACH ROW FOLLOWS tr1_bu SET @a:=3;
-
---error ER_REFERENCED_TRG_DOES_NOT_EXIST
-CREATE TRIGGER tr1_ai AFTER INSERT ON t1 FOR EACH ROW FOLLOWS tr1_bi SET @a:=3;
-
---replace_column 6 #
-SHOW TRIGGERS;
-
---replace_column 17 #
-SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_schema = 'test';
-
-DROP TABLE t1;
-
-# Binlog is required
---source include/have_log_bin.inc
-
---echo #
---echo # Test 17. Check that table's triggers are dumped correctly.
---echo #
-CREATE TABLE t1 (a INT);
-CREATE TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1;
-CREATE TRIGGER tr2_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=2;
-CREATE TRIGGER tr1_bu BEFORE UPDATE ON t1 FOR EACH ROW SET @a:=3;
-
-# dump tables and triggers
---exec $MYSQL_DUMP --compact test
-
-DROP TABLE t1;
-
---echo #
---echo # Test 18. Check that table's triggers are dumped in right order
---echo # taking into account the PRECEDES/FOLLOWS clauses.
---echo #
-
-CREATE TABLE t1 (a INT);
-CREATE TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1;
-CREATE TRIGGER tr2_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=2;
-CREATE TRIGGER tr0_bi BEFORE INSERT ON t1 FOR EACH ROW PRECEDES tr1_bi SET @a:=0;
-CREATE TRIGGER tr1_1_bi BEFORE INSERT ON t1 FOR EACH ROW FOLLOWS tr1_bi SET @a:=0;
-
---echo # Expected order of triggers in the dump is: tr0_bi, tr1_bi, tr1_1_bi, tr2_i.
-# dump tables and triggers
---exec $MYSQL_DUMP --compact test
-
-DROP TABLE t1;
-
---echo #
---echo # Test 19. Check that table's triggers are dumped correctly in xml.
---echo #
-
-CREATE TABLE t1 (a INT);
-SET TIMESTAMP=UNIX_TIMESTAMP('2013-01-31 09:00:00');
-CREATE TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1;
-CREATE TRIGGER tr2_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=2;
-CREATE TRIGGER tr1_bu BEFORE UPDATE ON t1 FOR EACH ROW SET @a:=3;
-SET TIMESTAMP=DEFAULT;
-
-# dump tables and triggers
---exec $MYSQL_DUMP --compact --no-create-info --xml test
-
-DROP TABLE t1;
-
---echo #
---echo # Test 20. Check that the statement CHECK TABLE FOR UPGRADE outputs
---echo # the warnings for triggers created by a server without support for wl3253.
---echo #
-
-CREATE TABLE t1 (a INT);
-
-let $MYSQLD_DATADIR=`SELECT @@datadir`;
---write_file $MYSQLD_DATADIR/test/t1.TRG
-TYPE=TRIGGERS
-triggers='CREATE DEFINER=`root`@`localhost` TRIGGER tr1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1' 'CREATE DEFINER=`root`@`localhost` TRIGGER tr1_ai AFTER INSERT ON t1 FOR EACH ROW SET @a:=2'
-sql_modes=1073741824 1073741824
-definers='root@localhost' 'root@localhost'
-client_cs_names='latin1' 'latin1'
-connection_cl_names='latin1_swedish_ci' 'latin1_swedish_ci'
-db_cl_names='latin1_swedish_ci' 'latin1_swedish_ci'
-EOF
-
---write_file $MYSQLD_DATADIR/test/tr1_bi.TRN
-TYPE=TRIGGERNAME
-trigger_table=t1
-EOF
-
---write_file $MYSQLD_DATADIR/test/tr1_ai.TRN
-TYPE=TRIGGERNAME
-trigger_table=t1
-EOF
-
-FLUSH TABLE t1;
-
-CHECK TABLE t1 FOR UPGRADE;
-
-SHOW TRIGGERS;
-
-SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_schema = 'test';
-
-SHOW CREATE TRIGGER tr1_bi;
-SHOW CREATE TRIGGER tr1_ai;
-
-DROP TABLE t1;
-
-SET binlog_format=@binlog_format_saved;
-
---echo # End of tests.
---echo #
diff --git a/mysql-test/t/truncate-stale-6500.test b/mysql-test/t/truncate-stale-6500.test
deleted file mode 100644
index 47dffb1966d..00000000000
--- a/mysql-test/t/truncate-stale-6500.test
+++ /dev/null
@@ -1,32 +0,0 @@
---source include/have_innodb.inc
---source include/have_partition.inc
-
-SET GLOBAL query_cache_size=1024*1024*8;
-CREATE TABLE `test` (
- `uniqueId` INT NOT NULL,
- `partitionId` INT NOT NULL,
- PRIMARY KEY (`uniqueId`,`partitionId`)
-) ENGINE=InnoDB PARTITION BY LIST (partitionId) (
- PARTITION p01 VALUES IN (1),
- PARTITION p02 VALUES IN (2)
-);
-
-
-INSERT INTO `test`(`uniqueId`,`partitionId`) VALUES(407237055, 2);
-
-SELECT * FROM `test`;
-
---echo #Confirms 1 row in partition 'p02'
-SELECT TABLE_NAME, PARTITION_NAME, TABLE_ROWS FROM information_schema.PARTITIONS where TABLE_NAME = 'test';
-ALTER TABLE `test` TRUNCATE PARTITION `p02`;
-
---echo #Confirms no more rows in partition 'p02'
-SELECT TABLE_NAME, PARTITION_NAME, TABLE_ROWS FROM information_schema.PARTITIONS where TABLE_NAME = 'test';
-
---echo #Before the patch, this returned the previously existing values.
-SELECT * FROM `test`;
-SELECT SQL_CACHE * FROM `test`;
-SELECT SQL_NO_CACHE * FROM `test`;
-
-DROP TABLE test;
-SET GLOBAL query_cache_size=DEFAULT;
diff --git a/mysql-test/t/truncate.test b/mysql-test/t/truncate.test
deleted file mode 100644
index 8895677b79f..00000000000
--- a/mysql-test/t/truncate.test
+++ /dev/null
@@ -1,165 +0,0 @@
-#
-# Test of truncate
-#
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-
-create table t1 (a integer, b integer,c1 CHAR(10));
-insert into t1 (a) values (1),(2);
-truncate table t1;
-select count(*) from t1;
-insert into t1 values(1,2,"test");
-select count(*) from t1;
-delete from t1;
-select * from t1;
-drop table t1;
-# The following should fail
---error 1146
-select count(*) from t1;
-create temporary table t1 (n int);
-insert into t1 values (1),(2),(3);
-truncate table t1;
-select * from t1;
-drop table t1;
---error 1146
-truncate non_existing_table;
-
-#
-# test autoincrement with TRUNCATE; verifying difference with DELETE
-#
-
-create table t1 (a integer auto_increment primary key);
-insert into t1 (a) values (NULL),(NULL);
-truncate table t1;
-insert into t1 (a) values (NULL),(NULL);
-SELECT * from t1;
-delete from t1;
-insert into t1 (a) values (NULL),(NULL);
-SELECT * from t1;
-drop table t1;
-
-# Verifying that temp tables are handled the same way
-
-create temporary table t1 (a integer auto_increment primary key);
-insert into t1 (a) values (NULL),(NULL);
-truncate table t1;
-insert into t1 (a) values (NULL),(NULL);
-SELECT * from t1;
-delete from t1;
-insert into t1 (a) values (NULL),(NULL);
-SELECT * from t1;
-drop table t1;
-
-# End of 4.1 tests
-
-# Test for Bug#5507 "TRUNCATE should work with views"
-#
-# when it'll be fixed, the error should become 1347
-# (test.v1' is not of type 'BASE TABLE')
-#
-
-create table t1 (s1 int);
-insert into t1 (s1) values (1), (2), (3), (4), (5);
-create view v1 as select * from t1;
---error 1146
-truncate table v1;
-drop view v1;
-drop table t1;
-
-# End of 5.0 tests
-
---echo #
---echo # Bug#20667 - Truncate table fails for a write locked table
---echo #
-CREATE TABLE t1 (c1 INT);
-LOCK TABLE t1 WRITE;
-INSERT INTO t1 VALUES (1);
-SELECT * FROM t1;
-TRUNCATE TABLE t1;
-SELECT * FROM t1;
-UNLOCK TABLES;
-#
-LOCK TABLE t1 READ;
---error ER_TABLE_NOT_LOCKED_FOR_WRITE
-TRUNCATE TABLE t1;
-UNLOCK TABLES;
-#
-CREATE TABLE t2 (c1 INT);
-LOCK TABLE t2 WRITE;
---error ER_TABLE_NOT_LOCKED
-TRUNCATE TABLE t1;
-UNLOCK TABLES;
-#
-CREATE VIEW v1 AS SELECT t1.c1 FROM t1,t2 WHERE t1.c1 = t2.c1;
-INSERT INTO t1 VALUES (1), (2), (3);
-INSERT INTO t2 VALUES (1), (3), (4);
-SELECT * FROM v1;
---error ER_NO_SUCH_TABLE
-TRUNCATE v1;
-SELECT * FROM v1;
-#
-LOCK TABLE t1 WRITE;
---error ER_TABLE_NOT_LOCKED
-SELECT * FROM v1;
---error ER_TABLE_NOT_LOCKED
-TRUNCATE v1;
---error ER_TABLE_NOT_LOCKED
-SELECT * FROM v1;
-UNLOCK TABLES;
-#
-LOCK TABLE t1 WRITE, t2 WRITE;
---error ER_TABLE_NOT_LOCKED
-SELECT * FROM v1;
---error ER_TABLE_NOT_LOCKED
-TRUNCATE v1;
---error ER_TABLE_NOT_LOCKED
-SELECT * FROM v1;
-UNLOCK TABLES;
-#
-LOCK TABLE v1 WRITE;
-SELECT * FROM v1;
---error ER_TABLE_NOT_LOCKED
-TRUNCATE v1;
-SELECT * FROM v1;
-UNLOCK TABLES;
-#
-LOCK TABLE t1 WRITE, t2 WRITE, v1 WRITE;
-SELECT * FROM v1;
---error ER_TABLE_NOT_LOCKED
-TRUNCATE v1;
-SELECT * FROM v1;
-UNLOCK TABLES;
-#
-DROP VIEW v1;
-DROP TABLE t1, t2;
-#
-CREATE PROCEDURE p1() SET @a = 5;
---error ER_NO_SUCH_TABLE
-TRUNCATE p1;
-SHOW CREATE PROCEDURE p1;
-DROP PROCEDURE p1;
-
---echo #
---echo # Bug#46452 Crash in MDL, HANDLER OPEN + TRUNCATE TABLE
---echo #
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 AS SELECT 1 AS f1;
-
-HANDLER t1 OPEN;
---echo # Here comes the crash.
-TRUNCATE t1;
-
---echo # Currently TRUNCATE, just like other DDL, implicitly closes
---echo # open HANDLER table.
---error ER_UNKNOWN_TABLE
-HANDLER t1 READ FIRST;
-
-# Cleanup
-DROP TABLE t1;
-
---echo # End of 6.0 tests
-
diff --git a/mysql-test/t/truncate_badse.test b/mysql-test/t/truncate_badse.test
deleted file mode 100644
index 71545cab11a..00000000000
--- a/mysql-test/t/truncate_badse.test
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-# test what TRUNCATE TABLE does, if the table was created in
-# now-unknown storage engine.
-#
---source include/have_example_plugin.inc
-install plugin example soname 'ha_example';
-create table t1 (a int) engine=example;
-select 1;
-uninstall plugin example;
-flush tables;
-select count(*) from information_schema.plugins where plugin_name='example';
---error ER_UNKNOWN_STORAGE_ENGINE
-truncate table t1;
-drop table t1;
-
diff --git a/mysql-test/t/truncate_coverage.test b/mysql-test/t/truncate_coverage.test
deleted file mode 100644
index 3351ce84232..00000000000
--- a/mysql-test/t/truncate_coverage.test
+++ /dev/null
@@ -1,108 +0,0 @@
-#
-# Code coverage testing of TRUNCATE TABLE.
-#
-# Ingo Struewing, 2009-07-20
-#
-
---source include/have_debug_sync.inc
-SET DEBUG_SYNC='RESET';
-
---let $MYSQLD_DATADIR= `SELECT @@datadir`
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
---echo #
---echo # Bug#20667 - Truncate table fails for a write locked table
---echo #
-########
-# Attack acquire_exclusive_locks(). Hold a global read lock.
-# Non-LOCK TABLE case.
-#
-CREATE TABLE t1 (c1 INT);
-INSERT INTO t1 VALUES (1);
-#
-# Start a transaction and execute a DML in it. Since 5.4.4 this leaves
-# a shared meta data lock (MDL) behind. TRUNCATE shall block on it.
-#
---connect (con1, localhost, root,,)
-START TRANSACTION;
-INSERT INTO t1 VALUES (2);
-#
-# Get connection id of default connection.
-# Start TRUNCATE, which will block on acquire_exclusive_locks().
-#
---connection default
-let $ID= `SELECT @id := CONNECTION_ID()`;
-SET DEBUG_SYNC='mdl_acquire_lock_wait SIGNAL waiting';
-send TRUNCATE TABLE t1;
-#
-# Get the default connection ID into a variable in an invisible statement.
-# Kill the TRUNCATE query. This shall result in an error return
-# from wait_while_table_is_used().
-#
---connection con1
-SET DEBUG_SYNC='now WAIT_FOR waiting';
-let $invisible_assignment_in_select = `SELECT @id := $ID`;
-KILL QUERY @id;
---connection default
---error ER_QUERY_INTERRUPTED
-reap;
---connection con1
---echo # Release SW lock by committing transaction.
-COMMIT;
---disconnect con1
---connection default
-UNLOCK TABLES;
-DROP TABLE t1;
-SET DEBUG_SYNC='RESET';
-
---echo #
---echo # Bug#57659 Segfault in Query_cache::invalidate_data for TRUNCATE TABLE
---echo #
-
---echo # Note that this test case only reproduces the problem
---echo # when it is run with valgrind.
-
---disable_warnings
-DROP TABLE IF EXISTS t1, m1;
---enable_warnings
-
-CREATE TABLE t1(a INT) engine=memory;
-CREATE TABLE m1(a INT) engine=merge UNION(t1);
-connect(con2, localhost, root);
-
-connect(con1, localhost, root);
-SET DEBUG_SYNC= 'open_tables_after_open_and_process_table SIGNAL opened WAIT_FOR dropped';
---echo # Sending:
---send TRUNCATE TABLE m1
-
-connection con2;
-SET DEBUG_SYNC= 'now WAIT_FOR opened';
---echo # Sending:
---send FLUSH TABLES
-
-connection default;
---echo # Waiting for FLUSH TABLES to be blocked.
-let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.processlist
- WHERE state= 'Waiting for table flush' AND info= 'FLUSH TABLES';
---source include/wait_condition.inc
-SET DEBUG_SYNC= 'now SIGNAL dropped';
-
-connection con1;
---echo # Reaping: TRUNCATE TABLE m1
---error ER_WRONG_MRG_TABLE
---reap
-disconnect con1;
---source include/wait_until_disconnected.inc
-
-connection con2;
---echo # Reaping: FLUSH TABLES
---reap
-disconnect con2;
---source include/wait_until_disconnected.inc
-
-connection default;
-SET DEBUG_SYNC= 'RESET';
-DROP TABLE m1, t1;
diff --git a/mysql-test/t/type_binary.test b/mysql-test/t/type_binary.test
deleted file mode 100644
index 952bc6ef231..00000000000
--- a/mysql-test/t/type_binary.test
+++ /dev/null
@@ -1,128 +0,0 @@
-# check 0x00 padding
-create table t1 (s1 binary(3));
-insert into t1 values (0x61), (0x6120), (0x612020);
-select hex(s1) from t1;
-drop table t1;
-
-# check that 0x00 is not stripped in val_str
-create table t1 (s1 binary(2), s2 varbinary(2));
-insert into t1 values (0x4100,0x4100);
-select length(concat('*',s1,'*',s2,'*')) from t1;
-delete from t1;
-insert into t1 values (0x4120,0x4120);
-select length(concat('*',s1,'*',s2,'*')) from t1;
-drop table t1;
-
-# check that trailing 0x00 and 0x20 do matter on comparison
-create table t1 (s1 varbinary(20), s2 varbinary(20));
-show create table t1;
-insert into t1 values (0x41,0x4100),(0x41,0x4120),(0x4100,0x4120);
-select hex(s1), hex(s2) from t1;
-select count(*) from t1 where s1 < s2;
-drop table t1;
-
-# check that trailing 0x00 do matter on filesort
-create table t1 (s1 varbinary(2), s2 varchar(1));
-insert into t1 values (0x41,'a'), (0x4100,'b'), (0x41,'c'), (0x4100,'d');
-select hex(s1),s2 from t1 order by s1,s2;
-drop table t1;
-
-# check that 0x01 is padded to 0x0100 and thus we get a duplicate value
-create table t1 (s1 binary(2) primary key);
-insert into t1 values (0x01);
-insert into t1 values (0x0120);
---error ER_DUP_ENTRY
-insert into t1 values (0x0100);
-select hex(s1) from t1 order by s1;
-# check index search
-select hex(s1) from t1 where s1=0x01;
-select hex(s1) from t1 where s1=0x0120;
-select hex(s1) from t1 where s1=0x0100;
-select count(distinct s1) from t1;
-alter table t1 drop primary key;
-# check non-indexed search
-select hex(s1) from t1 where s1=0x01;
-select hex(s1) from t1 where s1=0x0120;
-select hex(s1) from t1 where s1=0x0100;
-select count(distinct s1) from t1;
-drop table t1;
-
-# check that 0x01 is not padded, and all three values are unique
-create table t1 (s1 varbinary(2) primary key);
-insert into t1 values (0x01);
-insert into t1 values (0x0120);
-insert into t1 values (0x0100);
-select hex(s1) from t1 order by s1;
-# check index search
-select hex(s1) from t1 where s1=0x01;
-select hex(s1) from t1 where s1=0x0120;
-select hex(s1) from t1 where s1=0x0100;
-select count(distinct s1) from t1;
-alter table t1 drop primary key;
-# check non-indexed search
-select hex(s1) from t1 where s1=0x01;
-select hex(s1) from t1 where s1=0x0120;
-select hex(s1) from t1 where s1=0x0100;
-select count(distinct s1) from t1;
-drop table t1;
-
-# check that cast appends trailing zeros
-select hex(cast(0x10 as binary(2)));
-
-#
-# Bug #14299: BINARY space truncation should cause warning or error
-#
-create table t1 (b binary(2), vb varbinary(2));
-insert into t1 values(0x4120, 0x4120);
-insert ignore into t1 values(0x412020, 0x412020);
-drop table t1;
-create table t1 (c char(2), vc varchar(2));
-insert into t1 values(0x4120, 0x4120);
-insert into t1 values(0x412020, 0x412020);
-drop table t1;
-
-set @old_sql_mode= @@sql_mode, sql_mode= 'traditional';
-create table t1 (b binary(2), vb varbinary(2));
-insert into t1 values(0x4120, 0x4120);
---error ER_DATA_TOO_LONG
-insert into t1 values(0x412020, NULL);
---error ER_DATA_TOO_LONG
-insert into t1 values(NULL, 0x412020);
-drop table t1;
-set @@sql_mode= @old_sql_mode;
-
-#
-# Bug#14171: Wrong default value for a BINARY field
-#
-create table t1(f1 int, f2 binary(2) not null, f3 char(2) not null);
-insert ignore into t1 set f1=1;
-select hex(f2), hex(f3) from t1;
-drop table t1;
-
---echo End of 5.0 tests
-
---echo #
---echo # Start of 10.0 tests
---echo #
-
---echo #
---echo # MDEV-8472 BINARY, VARBINARY and BLOB return different warnings on CAST to DECIMAL
---echo #
-SET NAMES utf8;
-CREATE TABLE t1 (a BINARY(30));
-INSERT INTO t1 VALUES ('1äÖüß@µ*$');
-SELECT CAST(a AS DECIMAL) FROM t1;
-DROP TABLE t1;
-CREATE TABLE t1 (a VARBINARY(30));
-INSERT INTO t1 VALUES ('1äÖüß@µ*$');
-SELECT CAST(a AS DECIMAL) FROM t1;
-DROP TABLE t1;
-CREATE TABLE t1 (a BLOB);
-INSERT INTO t1 VALUES ('1äÖüß@µ*$');
-SELECT CAST(a AS DECIMAL) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # End of 10.0 tests
---echo #
-
diff --git a/mysql-test/t/type_bit.test b/mysql-test/t/type_bit.test
deleted file mode 100644
index bb282fc15e5..00000000000
--- a/mysql-test/t/type_bit.test
+++ /dev/null
@@ -1,460 +0,0 @@
-#
-# testing of the BIT column type
-#
-
-select 0 + b'1';
-select 0 + b'0';
-select 0 + b'000001';
-select 0 + b'000011';
-select 0 + b'000101';
-select 0 + b'000000';
-select 0 + b'10000000';
-select 0 + b'11111111';
-select 0 + b'10000001';
-select 0 + b'1000000000000000';
-select 0 + b'1111111111111111';
-select 0 + b'1000000000000001';
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
---error 1439
-create table t1 (a bit(65));
-
-create table t1 (a bit(0));
-show create table t1;
-drop table t1;
-
-create table t1 (a bit(64));
-insert into t1 values
-(b'1111111111111111111111111111111111111111111111111111111111111111'),
-(b'1000000000000000000000000000000000000000000000000000000000000000'),
-(b'0000000000000000000000000000000000000000000000000000000000000001'),
-(b'1010101010101010101010101010101010101010101010101010101010101010'),
-(b'0101010101010101010101010101010101010101010101010101010101010101');
-select hex(a) from t1;
-drop table t1;
-
-create table t1 (a bit);
-insert into t1 values (b'0'), (b'1'), (b'000'), (b'100'), (b'001');
-select hex(a) from t1;
---error ER_DUP_ENTRY
-alter table t1 add unique (a);
-drop table t1;
-
-create table t1 (a bit(2));
-insert into t1 values (b'00'), (b'01'), (b'10'), (b'100');
-select a+0 from t1;
-alter table t1 add key (a);
-explain select a+0 from t1;
-select a+0 from t1;
-drop table t1;
-
-create table t1 (a bit(7), b bit(9), key(a, b));
-insert into t1 values
-(94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),
-(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),
-(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),
-(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),
-(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),
-(44, 307), (68, 454), (57, 135);
-explain select a+0 from t1;
-select a+0 from t1;
-explain select b+0 from t1;
-select b+0 from t1;
-explain select a+0, b+0 from t1;
-select a+0, b+0 from t1;
-explain select a+0, b+0 from t1 where a > 40 and b > 200 order by 1;
-select a+0, b+0 from t1 where a > 40 and b > 200 order by 1;
-explain select a+0, b+0 from t1 where a > 40 and a < 70 order by 2;
-select a+0, b+0 from t1 where a > 40 and a < 70 order by 2;
-set @@max_length_for_sort_data=0;
-select a+0, b+0 from t1 where a > 40 and a < 70 order by 2;
-select hex(min(a)) from t1;
-select hex(min(b)) from t1;
-select hex(min(a)), hex(max(a)), hex(min(b)), hex(max(b)) from t1;
-drop table t1;
-
-create table t1 (a int not null, b bit, c bit(9), key(a, b, c));
-insert into t1 values
-(4, NULL, 1), (4, 0, 3), (2, 1, 4), (1, 1, 100), (4, 0, 23), (4, 0, 54),
-(56, 0, 22), (4, 1, 100), (23, 0, 1), (4, 0, 34);
-select a+0, b+0, c+0 from t1;
-select hex(min(b)) from t1 where a = 4;
-select hex(min(c)) from t1 where a = 4 and b = 0;
-select hex(max(b)) from t1;
-select a+0, b+0, c+0 from t1 where a = 4 and b = 0 limit 2;
-select a+0, b+0, c+0 from t1 where a = 4 and b = 1;
-select a+0, b+0, c+0 from t1 where a = 4 and b = 1 and c=100;
-select a+0, b+0, c+0 from t1 order by b desc;
-select a+0, b+0, c+0 from t1 order by c;
-drop table t1;
-
-create table t1(a bit(2), b bit(2));
-insert into t1 (a) values (0x01), (0x03), (0x02);
-update t1 set b= concat(a);
-select a+0, b+0 from t1;
-drop table t1;
-
-# Some magic numbers
-
-create table t1 (a bit(7), key(a));
-insert into t1 values (44), (57);
-select a+0 from t1;
-drop table t1;
-
-#
-# Test conversion to and from strings
-#
-create table t1 (a bit(3), b bit(12));
-insert into t1 values (7,(1<<12)-2), (0x01,0x01ff);
-select hex(a),hex(b) from t1;
-select hex(concat(a)),hex(concat(b)) from t1;
-drop table t1;
-
-#
-# Bug #9571: problem with primary key creation
-#
-
-create table t1(a int, b bit not null);
-alter table t1 add primary key (a);
-drop table t1;
-
-#
-# myisam <-> heap
-#
-
-create table t1 (a bit(19), b bit(5));
-insert into t1 values (1000, 10), (3, 8), (200, 6), (2303, 2), (12345, 4), (1, 0);
-select a+0, b+0 from t1;
-alter table t1 engine=heap;
-select a+0, b+0 from t1;
-alter table t1 add key(a, b);
-select a+0, b+0 from t1;
-alter table t1 engine=myisam;
-select a+0, b+0 from t1;
-create table t2 engine=heap select * from t1;
-select a+0, b+0 from t2;
-drop table t1;
-create table t1 select * from t2;
-select a+0, b+0 from t1;
-drop table t1, t2;
-
-#
-# Bug #10179: problem with NULLs and default values
-#
-
-create table t1 (a int, b time, c tinyint, d bool, e char(10), f bit(1),
- g bit(1) NOT NULL default 1, h char(1) default 'a');
-insert into t1 set a=1;
-select hex(g), h from t1;
-drop table t1;
-
-create table t1 (a int, b time, c tinyint, d bool, e char(10), f bit(1),
- g bit(1) NOT NULL default 1);
-insert into t1 set a=1;
-select hex(g) from t1;
-drop table t1;
-
-create table t1 (a int, b time, c tinyint, d bool, e char(10), f bit(1),
- h char(1) default 'a') engine=myisam;
-insert into t1 set a=1;
-select h from t1;
-drop table t1;
-
-#
-# Bug #10539
-#
-
-create table t1 (a bit(8)) engine=heap;
-insert ignore into t1 values ('1111100000');
-select a+0 from t1;
-drop table t1;
-
-#
-# Bug #11091: union
-#
-
-create table t1 (a bit(7));
-insert into t1 values (120), (0), (111);
-select a+0 from t1 union select a+0 from t1;
-select a+0 from t1 union select NULL;
-select NULL union select a+0 from t1;
-create table t2 select a from t1 union select a from t1;
-select a+0 from t2;
-show create table t2;
-drop table t1, t2;
-
-#
-# Bug #11572: view
-#
-
-create table t1 (id1 int(11), b1 bit(1));
-create table t2 (id2 int(11), b2 bit(1));
-insert into t1 values (1, 1), (2, 0), (3, 1);
-insert into t2 values (2, 1), (3, 0), (4, 0);
-create algorithm=undefined view v1 as
- select b1+0, b2+0 from t1, t2 where id1 = id2 and b1 = 0
- union
- select b1+0, b2+0 from t1, t2 where id1 = id2 and b2 = 1;
-select * from v1;
-drop table t1, t2;
-drop view v1;
-
-#
-# Bug #10617: bulk-insert
-#
-
-create table t1(a bit(4));
-insert into t1(a) values (1), (2), (5), (4), (3);
-insert into t1 select * from t1;
-select a+0 from t1;
-drop table t1;
-
-#
-# join
-#
-
-create table t1 (a1 int(11), b1 bit(2));
-create table t2 (a2 int(11), b2 bit(2));
-insert into t1 values (1, 1), (2, 0), (3, 1), (4, 2);
-insert into t2 values (2, 1), (3, 0), (4, 1), (5, 2);
-select a1, a2, b1+0, b2+0 from t1 join t2 on a1 = a2;
-select a1, a2, b1+0, b2+0 from t1 join t2 on a1 = a2 order by a1;
-select a1, a2, b1+0, b2+0 from t1 join t2 on b1 = b2;
-select sum(a1), b1+0, b2+0 from t1 join t2 on b1 = b2 group by b1 order by 1;
-select 1 from t1 join t2 on b1 = b2 group by b1 order by 1;
-select b1+0,sum(b1), sum(b2) from t1 join t2 on b1 = b2 group by b1 order by 1;
-drop table t1, t2;
-
-#
-# Bug #13601: Wrong field length reported for BIT fields
-#
-create table t1 (a bit(7));
-insert into t1 values (0x60);
---enable_metadata
-select * from t1;
---disable_metadata
-drop table t1;
-
-#
-# Bug#15583: BIN()/OCT()/CONV() do not work with BIT values
-#
-create table bug15583(b BIT(8), n INT);
-insert into bug15583 values(128, 128);
-insert into bug15583 values(null, null);
-insert into bug15583 values(0, 0);
-insert into bug15583 values(255, 255);
-select hex(b), bin(b), oct(b), hex(n), bin(n), oct(n) from bug15583;
-select hex(b)=hex(n) as should_be_onetrue, bin(b)=bin(n) as should_be_onetrue, oct(b)=oct(n) as should_be_onetrue from bug15583;
-select hex(b + 0), bin(b + 0), oct(b + 0), hex(n), bin(n), oct(n) from bug15583;
-select conv(b, 10, 2), conv(b + 0, 10, 2) from bug15583;
-drop table bug15583;
-
-#
-# Bug #22271: data casting may affect data stored in the next column(s?)
-#
-
-create table t1(a bit(1), b smallint unsigned);
-insert ignore into t1 (b, a) values ('2', '1');
-select hex(a), b from t1;
-drop table t1;
-
-#
-# type was not properly initalized, which caused key_copy to fail
-#
-
-create table t1(bit_field bit(2), int_field int, key a(bit_field));
-insert into t1 values (1,2);
-handler t1 open as t1;
-handler t1 read a=(1);
-handler t1 close;
-drop table t1;
-
-#
-# Bug #30219: GROUP BY a column of the BIT type
-#
-
-CREATE TABLE t1 (b BIT(2), a VARCHAR(5));
-INSERT INTO t1 (b, a) VALUES (1, "x"), (3, "zz"), (0, "y"), (3, "z");
-SELECT b+0, COUNT(DISTINCT a) FROM t1 GROUP BY b;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a CHAR(5), b BIT(2));
-INSERT INTO t1 (b, a) VALUES (1, "x"), (3, "zz"), (0, "y"), (3, "z");
-SELECT b+0, COUNT(DISTINCT a) FROM t1 GROUP BY b;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT, b BIT(2));
-INSERT INTO t1 (b, a) VALUES (1, 1), (3, 2), (0, 3), (3, 4);
-SELECT b+0, COUNT(DISTINCT a) FROM t1 GROUP BY b;
-DROP TABLE t1;
-
-#
-# Bug#30245: A wrong type of a BIT field is reported when grouped by it.
-#
-CREATE TABLE t1 (b BIT);
-INSERT INTO t1 (b) VALUES (1), (0);
---enable_metadata
---replace_column 1 #
-SELECT DISTINCT b FROM t1;
---replace_column 1 #
-SELECT b FROM t1 GROUP BY b;
---disable_metadata
-DROP TABLE t1;
-
-#
-# BUG#30324 Wrong query result for COUNT(DISTINCT(bit_column))
-#
-CREATE TABLE t1 (a int, b bit(2));
-INSERT INTO t1 VALUES (3, 2), (2, 3), (2, 0), (3, 2), (3, 1);
-SELECT COUNT(DISTINCT b) FROM t1 GROUP BY a;
-DROP TABLE t1;
-
-create table t2 (a int, b bit(2), c char(10));
-INSERT INTO t2 VALUES (3, 2, 'two'), (2, 3, 'three'), (2, 0, 'zero'),
- (3, 2, 'two'), (3, 1, 'one');
-SELECT COUNT(DISTINCT b,c) FROM t2 GROUP BY a;
-DROP TABLE t2;
-
-#
-# BUG#32556 assert in "using index for group-by" : is_last_prefix <= 0,
-# file .\opt_range.cc
-
-CREATE TABLE t1(a BIT(13), KEY(a));
---disable_warnings
-INSERT IGNORE INTO t1(a) VALUES
-(65535),(65525),(65535),(65535),(65535),(65535),(65535),(65535),(65535),(65535);
---enable_warnings
-
-EXPLAIN SELECT 1 FROM t1 GROUP BY a;
-SELECT 1 FROM t1 GROUP BY a;
-
-DROP TABLE t1;
-
-#
-# Bug#37799 SELECT with a BIT column in WHERE clause returns unexpected result
-#
-
-CREATE TABLE t1 (b BIT NOT NULL, i2 INTEGER NOT NULL, s VARCHAR(255) NOT NULL);
-INSERT INTO t1 VALUES(0x01,100,''), (0x00,300,''), (0x01,200,''), (0x00,100,'');
-SELECT HEX(b), i2 FROM t1 WHERE (i2>=100 AND i2<201) AND b=TRUE;
-
-CREATE TABLE t2 (b1 BIT NOT NULL, b2 BIT NOT NULL, i2 INTEGER NOT NULL,
- s VARCHAR(255) NOT NULL);
-INSERT INTO t2 VALUES (0x01,0x00,100,''), (0x00,0x01,300,''),
- (0x01,0x00,200,''), (0x00,0x01,100,'');
-SELECT HEX(b1), i2 FROM t2 WHERE (i2>=100 AND i2<201) AND b1=TRUE;
-SELECT HEX(b2), i2 FROM t2 WHERE (i2>=100 AND i2<201) AND b2=FALSE;
-SELECT HEX(b1), HEX(b2), i2 FROM t2
- WHERE (i2>=100 AND i2<201) AND b1=TRUE AND b2=FALSE;
-
-DROP TABLE t1, t2;
-
-#
-# Bug #35796 SHOW CREATE TABLE and default value for BIT field
-#
-CREATE TABLE IF NOT EXISTS t1 (
-f1 bit(2) NOT NULL default b'10',
-f2 bit(14) NOT NULL default b'11110000111100'
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE IF NOT EXISTS t1 (
-f1 bit(2) NOT NULL default b''
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-#
-# Bug#31399 Wrong query result when doing join buffering over BIT fields
-#
-create table t1bit7 (a1 bit(7) not null) engine=MyISAM;
-create table t2bit7 (b1 bit(7)) engine=MyISAM;
-
-insert into t1bit7 values (b'1100000');
-insert into t1bit7 values (b'1100001');
-insert into t1bit7 values (b'1100010');
-insert into t2bit7 values (b'1100001');
-insert into t2bit7 values (b'1100010');
-insert into t2bit7 values (b'1100110');
-
-select bin(a1) from t1bit7, t2bit7 where t1bit7.a1=t2bit7.b1;
-drop table t1bit7, t2bit7;
-
-create table t1bit7 (a1 bit(15) not null) engine=MyISAM;
-create table t2bit7 (b1 bit(15)) engine=MyISAM;
-
-insert into t1bit7 values (b'110000011111111');
-insert into t1bit7 values (b'110000111111111');
-insert into t1bit7 values (b'110001011111111');
-insert into t2bit7 values (b'110000111111111');
-insert into t2bit7 values (b'110001011111111');
-insert into t2bit7 values (b'110011011111111');
-
-select bin(a1) from t1bit7, t2bit7 where t1bit7.a1=t2bit7.b1;
-drop table t1bit7, t2bit7;
-
-
---echo #
---echo # Bug42803: Field_bit does not have unsigned_flag field,
---echo # can lead to bad memory access
---echo #
-CREATE TABLE t1 (a BIT(7), b BIT(9), KEY(a, b));
-INSERT INTO t1 VALUES(0, 0), (5, 3), (5, 6), (6, 4), (7, 0);
-EXPLAIN SELECT a+0, b+0 FROM t1 WHERE a > 4 and b < 7 ORDER BY 2;
-DROP TABLE t1;
-
-
---echo End of 5.0 tests
-
-#
-# Bug #28631: problem after alter
-#
-create table t1(a bit(7));
-insert into t1 values(0x40);
-alter table t1 modify column a bit(8);
-select hex(a) from t1;
-insert into t1 values(0x80);
-select hex(a) from t1;
-create index a on t1(a);
-insert into t1 values(0x81);
-select hex(a) from t1;
-show create table t1;
-drop table t1;
-
---echo #
---echo # Bug#50591 bit(31) causes Duplicate entry '1-NULL' for key 'group_key'
---echo #
-CREATE TABLE t1(a INT, b BIT(7) NOT NULL);
-INSERT INTO t1 VALUES (NULL, 0),(NULL, 0);
-SELECT SUM(a) FROM t1 GROUP BY b, a;
-DROP TABLE t1;
-
-CREATE TABLE t1(a INT, b BIT(7) NOT NULL, c BIT(8) NOT NULL);
-INSERT INTO t1 VALUES (NULL, 0, 0),(NULL, 0, 0);
-SELECT SUM(a) FROM t1 GROUP BY c, b, a;
-DROP TABLE t1;
-
---echo End of 5.1 tests
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-8867 Wrong field type or metadata for COALESCE(bit_column, 1)
---echo #
-
-CREATE TABLE t1 (val bit(1));
-INSERT INTO t1 VALUES (0);
-CREATE TABLE t2 AS SELECT COALESCE(val, 1) AS c FROM t1;
-SELECT * FROM t2;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
---enable_metadata
-SELECT COALESCE(val, 1) FROM t1;
---disable_metadata
-DROP TABLE t1;
diff --git a/mysql-test/t/type_bit_innodb.test b/mysql-test/t/type_bit_innodb.test
deleted file mode 100644
index 4c6f9bc1b49..00000000000
--- a/mysql-test/t/type_bit_innodb.test
+++ /dev/null
@@ -1,159 +0,0 @@
---source include/have_innodb.inc
-#
-# testing of the BIT column type
-#
-
-select 0 + b'1';
-select 0 + b'0';
-select 0 + b'000001';
-select 0 + b'000011';
-select 0 + b'000101';
-select 0 + b'000000';
-select 0 + b'10000000';
-select 0 + b'11111111';
-select 0 + b'10000001';
-select 0 + b'1000000000000000';
-select 0 + b'1111111111111111';
-select 0 + b'1000000000000001';
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
---error 1439
-create table t1 (a bit(65)) engine=innodb;
-
-create table t1 (a bit(0)) engine=innodb;
-show create table t1;
-drop table t1;
-
-create table t1 (a bit(64)) engine=innodb;
-insert into t1 values
-(b'1111111111111111111111111111111111111111111111111111111111111111'),
-(b'1000000000000000000000000000000000000000000000000000000000000000'),
-(b'0000000000000000000000000000000000000000000000000000000000000001'),
-(b'1010101010101010101010101010101010101010101010101010101010101010'),
-(b'0101010101010101010101010101010101010101010101010101010101010101');
-select hex(a) from t1;
-drop table t1;
-
-create table t1 (a bit) engine=innodb;
-insert ignore into t1 values (b'0'), (b'1'), (b'000'), (b'100'), (b'001');
-select hex(a) from t1;
-# It is not deterministic which duplicate will be seen first
---replace_regex /entry '(.*)' for/entry '' for/
---error ER_DUP_ENTRY
-alter table t1 add unique (a);
-drop table t1;
-
-create table t1 (a bit(2)) engine=innodb;
-insert ignore into t1 values (b'00'), (b'01'), (b'10'), (b'100');
-select a+0 from t1;
-alter table t1 add key (a);
-explain select a+0 from t1;
-select a+0 from t1;
-drop table t1;
-
-create table t1 (a bit(7), b bit(9), key(a, b)) engine=innodb;
-insert into t1 values
-(94, 46), (31, 438), (61, 152), (78, 123), (88, 411), (122, 118), (0, 177),
-(75, 42), (108, 67), (79, 349), (59, 188), (68, 206), (49, 345), (118, 380),
-(111, 368), (94, 468), (56, 379), (77, 133), (29, 399), (9, 363), (23, 36),
-(116, 390), (119, 368), (87, 351), (123, 411), (24, 398), (34, 202), (28, 499),
-(30, 83), (5, 178), (60, 343), (4, 245), (104, 280), (106, 446), (127, 403),
-(44, 307), (68, 454), (57, 135);
-explain select a+0 from t1;
-select a+0 from t1;
-explain select b+0 from t1;
-select b+0 from t1;
-explain select a+0, b+0 from t1;
-select a+0, b+0 from t1;
---replace_column 9 #
-explain select a+0, b+0 from t1 where a > 40 and b > 200 order by 1;
-select a+0, b+0 from t1 where a > 40 and b > 200 order by 1;
-explain select a+0, b+0 from t1 where a > 40 and a < 70 order by 2;
-select a+0, b+0 from t1 where a > 40 and a < 70 order by 2;
-set @@max_length_for_sort_data=0;
-select a+0, b+0 from t1 where a > 40 and a < 70 order by 2;
-select hex(min(a)) from t1;
-select hex(min(b)) from t1;
-select hex(min(a)), hex(max(a)), hex(min(b)), hex(max(b)) from t1;
-drop table t1;
-
-create table t1 (a int not null, b bit, c bit(9), key(a, b, c)) engine=innodb;
-insert into t1 values
-(4, NULL, 1), (4, 0, 3), (2, 1, 4), (1, 1, 100), (4, 0, 23), (4, 0, 54),
-(56, 0, 22), (4, 1, 100), (23, 0, 1), (4, 0, 34);
-select a+0, b+0, c+0 from t1;
-select hex(min(b)) from t1 where a = 4;
-select hex(min(c)) from t1 where a = 4 and b = 0;
-select hex(max(b)) from t1;
-select a+0, b+0, c+0 from t1 where a = 4 and b = 0 limit 2;
-select a+0, b+0, c+0 from t1 where a = 4 and b = 1;
-select a+0, b+0, c+0 from t1 where a = 4 and b = 1 and c=100;
-select a+0, b+0, c+0 from t1 order by b desc;
-select a+0, b+0, c+0 from t1 order by c;
-drop table t1;
-
-create table t1(a bit(2), b bit(2)) engine=innodb;
-insert into t1 (a) values (0x01), (0x03), (0x02);
-update t1 set b= concat(a);
-select a+0, b+0 from t1;
-drop table t1;
-
-# Some magic numbers
-
-create table t1 (a bit(7), key(a)) engine=innodb;
-insert into t1 values (44), (57);
-select a+0 from t1;
-drop table t1;
-
-#
-# Test conversion to and from strings
-#
-create table t1 (a bit(3), b bit(12)) engine=innodb;
-insert into t1 values (7,(1<<12)-2), (0x01,0x01ff);
-select hex(a),hex(b) from t1;
-select hex(concat(a)),hex(concat(b)) from t1;
-drop table t1;
-
-#
-# Bug #9571: problem with primary key creation
-#
-
-create table t1(a int, b bit not null) engine=innodb;
-alter table t1 add primary key (a);
-drop table t1;
-
-#
-# altering tables
-#
-
-create table t1 (a bit, b bit(10)) engine=innodb;
-show create table t1;
-alter table t1 engine=heap;
-show create table t1;
-alter table t1 engine=innodb;
-show create table t1;
-drop table t1;
-
-#
-# Bug #13601: Wrong field length reported for BIT fields
-#
-create table t1 (a bit(7)) engine=innodb;
-insert into t1 values (0x60);
---enable_metadata
-select * from t1;
---disable_metadata
-drop table t1;
-
---echo End of 5.0 tests
-
-#
-# MDEV-6052 Inconsistent results with bit type
-#
-create table t1(f1 bit(2) not null default b'10',f2 bit(14) not null default b'11110000111100');
-insert into t1 (f1) values (default);
-insert into t1 values (b'',b''),('','');
-select hex(f1), hex(f2) from t1;
-drop table t1;
diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test
deleted file mode 100644
index 8db6ac6da2a..00000000000
--- a/mysql-test/t/type_blob.test
+++ /dev/null
@@ -1,682 +0,0 @@
-# This test can't be run with running server (--extern) as this uses
-# load_file() on a file in the tree.
-#
-
-#
-# Basic cleanup
-#
---disable_warnings
-drop table if exists t1,t2,t3,t4,t5,t6,t7;
---enable_warnings
-
-
-#
-# Check syntax for creating BLOB/TEXT
-#
-
-CREATE TABLE t1 (a blob, b text, c blob(250), d text(70000), e text(70000000));
-show columns from t1;
-# PS doesn't give errors on prepare yet
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-CREATE TABLE t2 (a char(255), b varbinary(70000), c varchar(70000000));
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-CREATE TABLE t4 (c varchar(65530) character set utf8 not null);
-show columns from t2;
-create table t3 (a long, b long byte);
-show create TABLE t3;
-show create TABLE t4;
-drop table t1,t2,t3,t4;
-
-#
-# Check errors with blob
-#
-
---error 1074
-CREATE TABLE t1 (a char(257) default "hello");
---error 1074
-CREATE TABLE t2 (a char(256));
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-CREATE TABLE t1 (a varchar(70000) default "hello");
-SHOW CREATE TABLE t1;
-CREATE TABLE t2 (a blob default "hello");
-SHOW CREATE TABLE t2;
-
-drop table t1,t2;
-
-#
-# test of full join with blob
-#
-
-create table t1 (nr int(5) not null auto_increment,b blob,str char(10), primary key (nr));
-insert into t1 values (null,"a","A");
-insert into t1 values (null,"bbb","BBB");
-insert into t1 values (null,"ccc","CCC");
-select last_insert_id();
-select * from t1,t1 as t2;
-
-drop table t1;
-
-#
-# Test of changing TEXT column
-#
-
-create table t1 (a text);
-insert into t1 values ('where');
-update t1 set a='Where';
-select * from t1;
-drop table t1;
-
-#
-# test of blob, text, char and varbinary
-#
-create table t1 (t text,c char(10),b blob, d varbinary(10));
-insert into t1 values (NULL,NULL,NULL,NULL);
-insert into t1 values ("","","","");
-insert into t1 values ("hello","hello","hello","hello");
-insert into t1 values ("HELLO","HELLO","HELLO","HELLO");
-insert into t1 values ("HELLO MY","HELLO MY","HELLO MY","HELLO MY");
-insert into t1 values ("a","a","a","a");
-insert into t1 values (1,1,1,1);
-insert into t1 values (NULL,NULL,NULL,NULL);
-update t1 set c="",b=null where c="1";
-
-lock tables t1 READ;
-# We mask out the Privileges column because it differs for embedded server
---replace_column 8 #
-show full fields from t1;
-lock tables t1 WRITE;
---replace_column 8 #
-show full fields from t1;
-unlock tables;
-
-select t from t1 where t like "hello";
-select c from t1 where c like "hello";
-select b from t1 where b like "hello";
-select d from t1 where d like "hello";
-select c from t1 having c like "hello";
-select d from t1 having d like "hello";
-select t from t1 where t like "%HELLO%";
-select c from t1 where c like "%HELLO%";
-select b from t1 where b like "%HELLO%";
-select d from t1 where d like "%HELLO%";
-select c from t1 having c like "%HELLO%";
-select d from t1 having d like "%HELLO%";
-select d from t1 having d like "%HE%LLO%";
-select t from t1 order by t;
-select c from t1 order by c;
-select b from t1 order by b;
-select d from t1 order by d;
-select distinct t from t1;
-select distinct b from t1;
-select distinct t from t1 order by t;
-select distinct b from t1 order by b;
-select t from t1 group by t;
-select b from t1 group by b;
-set big_tables=1;
-select distinct t from t1;
-select distinct b from t1;
-select distinct t from t1 order by t;
-select distinct b from t1 order by b;
-select distinct c from t1;
-select distinct d from t1;
-select distinct c from t1 order by c;
-select distinct d from t1 order by d;
-select c from t1 group by c;
-select d from t1 group by d;
-set big_tables=0;
-select distinct * from t1;
-select t,count(*) from t1 group by t;
-select b,count(*) from t1 group by b;
-select c,count(*) from t1 group by c;
-select d,count(*) from t1 group by d;
-drop table t1;
-
--- error 1071
-create table t1 (a text, unique (a(2100))); # should give an error
-create table t1 (a text, key (a(2100))); # key is auto-truncated
-show create table t1;
-drop table t1;
-
-#
-# Test of join with blobs and min
-#
-
-CREATE TABLE t1 (
- t1_id bigint(21) NOT NULL auto_increment,
- _field_72 varchar(128) DEFAULT '' NOT NULL,
- _field_95 varchar(32),
- _field_115 tinyint(4) DEFAULT '0' NOT NULL,
- _field_122 tinyint(4) DEFAULT '0' NOT NULL,
- _field_126 tinyint(4),
- _field_134 tinyint(4),
- PRIMARY KEY (t1_id),
- UNIQUE _field_72 (_field_72),
- KEY _field_115 (_field_115),
- KEY _field_122 (_field_122)
-);
-
-
-INSERT INTO t1 VALUES (1,'admin','21232f297a57a5a743894a0e4a801fc3',0,1,NULL,NULL);
-INSERT INTO t1 VALUES (2,'hroberts','7415275a8c95952901e42b13a6b78566',0,1,NULL,NULL);
-INSERT INTO t1 VALUES (3,'guest','d41d8cd98f00b204e9800998ecf8427e',1,0,NULL,NULL);
-
-
-CREATE TABLE t2 (
- seq_0_id bigint(21) DEFAULT '0' NOT NULL,
- seq_1_id bigint(21) DEFAULT '0' NOT NULL,
- PRIMARY KEY (seq_0_id,seq_1_id)
-);
-
-
-INSERT INTO t2 VALUES (1,1);
-INSERT INTO t2 VALUES (2,1);
-INSERT INTO t2 VALUES (2,2);
-
-CREATE TABLE t3 (
- t3_id bigint(21) NOT NULL auto_increment,
- _field_131 varchar(128),
- _field_133 tinyint(4) DEFAULT '0' NOT NULL,
- _field_135 datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
- _field_137 tinyint(4),
- _field_139 datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
- _field_140 blob,
- _field_142 tinyint(4) DEFAULT '0' NOT NULL,
- _field_145 tinyint(4) DEFAULT '0' NOT NULL,
- _field_148 tinyint(4) DEFAULT '0' NOT NULL,
- PRIMARY KEY (t3_id),
- KEY _field_133 (_field_133),
- KEY _field_135 (_field_135),
- KEY _field_139 (_field_139),
- KEY _field_142 (_field_142),
- KEY _field_145 (_field_145),
- KEY _field_148 (_field_148)
-);
-
-
-INSERT INTO t3 VALUES (1,'test job 1',0,'0000-00-00 00:00:00',0,'1999-02-25 22:43:32','test\r\njob\r\n1',0,0,0);
-INSERT INTO t3 VALUES (2,'test job 2',0,'0000-00-00 00:00:00',0,'1999-02-26 21:08:04','',0,0,0);
-
-
-CREATE TABLE t4 (
- seq_0_id bigint(21) DEFAULT '0' NOT NULL,
- seq_1_id bigint(21) DEFAULT '0' NOT NULL,
- PRIMARY KEY (seq_0_id,seq_1_id)
-);
-
-
-INSERT INTO t4 VALUES (1,1);
-INSERT INTO t4 VALUES (2,1);
-
-CREATE TABLE t5 (
- t5_id bigint(21) NOT NULL auto_increment,
- _field_149 tinyint(4),
- _field_156 varchar(128) DEFAULT '' NOT NULL,
- _field_157 varchar(128) DEFAULT '' NOT NULL,
- _field_158 varchar(128) DEFAULT '' NOT NULL,
- _field_159 varchar(128) DEFAULT '' NOT NULL,
- _field_160 varchar(128) DEFAULT '' NOT NULL,
- _field_161 varchar(128) DEFAULT '' NOT NULL,
- PRIMARY KEY (t5_id),
- KEY _field_156 (_field_156),
- KEY _field_157 (_field_157),
- KEY _field_158 (_field_158),
- KEY _field_159 (_field_159),
- KEY _field_160 (_field_160),
- KEY _field_161 (_field_161)
-);
-
-
-INSERT INTO t5 VALUES (1,0,'tomato','','','','','');
-INSERT INTO t5 VALUES (2,0,'cilantro','','','','','');
-
-CREATE TABLE t6 (
- seq_0_id bigint(21) DEFAULT '0' NOT NULL,
- seq_1_id bigint(21) DEFAULT '0' NOT NULL,
- PRIMARY KEY (seq_0_id,seq_1_id)
-);
-
-INSERT INTO t6 VALUES (1,1);
-INSERT INTO t6 VALUES (1,2);
-INSERT INTO t6 VALUES (2,2);
-
-CREATE TABLE t7 (
- t7_id bigint(21) NOT NULL auto_increment,
- _field_143 tinyint(4),
- _field_165 varchar(32),
- _field_166 smallint(6) DEFAULT '0' NOT NULL,
- PRIMARY KEY (t7_id),
- KEY _field_166 (_field_166)
-);
-
-
-INSERT INTO t7 VALUES (1,0,'High',1);
-INSERT INTO t7 VALUES (2,0,'Medium',2);
-INSERT INTO t7 VALUES (3,0,'Low',3);
-
-select replace(t3._field_140, "\r","^M"),t3_id,min(t3._field_131), min(t3._field_135), min(t3._field_139), min(t3._field_137), min(link_alias_142._field_165), min(link_alias_133._field_72), min(t3._field_145), min(link_alias_148._field_156), replace(min(t3._field_140), "\r","^M"),t3.t3_id from t3 left join t4 on t4.seq_0_id = t3.t3_id left join t7 link_alias_142 on t4.seq_1_id = link_alias_142.t7_id left join t6 on t6.seq_0_id = t3.t3_id left join t1 link_alias_133 on t6.seq_1_id = link_alias_133.t1_id left join t2 on t2.seq_0_id = t3.t3_id left join t5 link_alias_148 on t2.seq_1_id = link_alias_148.t5_id where t3.t3_id in (1) group by t3.t3_id order by link_alias_142._field_166, _field_139, link_alias_133._field_72, _field_135, link_alias_148._field_156;
-
-drop table t1,t2,t3,t4,t5,t6,t7;
-
-#
-# Test of reverse with empty blob
-#
-
-create table t1 (a blob);
-insert into t1 values ("empty"),("");
-select a,reverse(a) from t1;
-drop table t1;
-
-#
-# Test of BLOB:s with NULL keys.
-#
-
-create table t1 (a blob, key (a(10)));
-insert into t1 values ("bye"),("hello"),("hello"),("hello word");
-select * from t1 where a like "hello%";
-drop table t1;
-
-#
-# Test of found bug in group on text key
-#
-
-CREATE TABLE t1 (
- f1 int(11) DEFAULT '0' NOT NULL,
- f2 varchar(16) DEFAULT '' NOT NULL,
- f5 text,
- KEY index_name (f1,f2,f5(16))
- );
-INSERT INTO t1 VALUES (0,'traktor','1111111111111');
-INSERT INTO t1 VALUES (1,'traktor','1111111111111111111111111');
-select count(*) from t1 where f2='traktor';
-drop table t1;
-
-#
-# Test of found bug when blob is first key part
-#
-
-create table t1 (foobar tinyblob not null, boggle smallint not null, key (foobar(32), boggle));
-insert into t1 values ('fish', 10),('bear', 20);
-select foobar, boggle from t1 where foobar = 'fish';
-select foobar, boggle from t1 where foobar = 'fish' and boggle = 10;
-drop table t1;
-
-#
-# Bug when blob is updated
-#
-
-create table t1 (id integer auto_increment unique,imagem LONGBLOB not null default '');
-insert into t1 (id) values (1);
-# We have to clean up the path in the results for safe comparison
-eval select
- charset(load_file('../../std_data/words.dat')),
- collation(load_file('../../std_data/words.dat')),
- coercibility(load_file('../../std_data/words.dat'));
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval explain extended select
- charset(load_file('$MYSQLTEST_VARDIR/std_data/words.dat')),
- collation(load_file('$MYSQLTEST_VARDIR/std_data/words.dat')),
- coercibility(load_file('$MYSQLTEST_VARDIR/std_data/words.dat'));
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval update t1 set imagem=load_file('$MYSQLTEST_VARDIR/std_data/words.dat') where id=1;
-select if(imagem is null, "ERROR", "OK"),length(imagem) from t1 where id = 1;
-drop table t1;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval create table t1 select load_file('$MYSQLTEST_VARDIR/std_data/words.dat') l;
-# We mask out the Privileges column because it differs for embedded server
---replace_column 8 #
-show full fields from t1;
-drop table t1;
-
-#
-# Test blob's with end space (Bug #1651)
-# This is a bit changed since we now have true varchar
-#
-
-create table t1 (id integer primary key auto_increment, txt text not null, unique index txt_index (txt (20)));
---error ER_DUP_ENTRY
-insert into t1 (txt) values ('Chevy'), ('Chevy ');
---error ER_DUP_ENTRY
-insert into t1 (txt) values ('Chevy'), ('CHEVY');
-alter table t1 drop index txt_index, add index txt_index (txt(20));
-insert into t1 (txt) values ('Chevy ');
-select * from t1 where txt='Chevy';
-select * from t1 where txt='Chevy ';
-select * from t1 where txt='Chevy ' or txt='Chevy';
-select * from t1 where txt='Chevy' or txt='Chevy ';
-select * from t1 where id='1' or id='2';
-insert into t1 (txt) values('Ford');
-select * from t1 where txt='Chevy' or txt='Chevy ' or txt='Ford';
-select * from t1 where txt='Chevy' or txt='Chevy ';
-select * from t1 where txt='Chevy' or txt='Chevy ' or txt=' Chevy';
-select * from t1 where txt in ('Chevy ','Chevy');
-select * from t1 where txt in ('Chevy');
-select * from t1 where txt between 'Chevy' and 'Chevy';
-select * from t1 where txt between 'Chevy' and 'Chevy' or txt='Chevy ';
-select * from t1 where txt between 'Chevy' and 'Chevy ';
-select * from t1 where txt < 'Chevy ';
-select * from t1 where txt <= 'Chevy';
-select * from t1 where txt > 'Chevy';
-select * from t1 where txt >= 'Chevy';
-drop table t1;
-
-create table t1 (id integer primary key auto_increment, txt text, index txt_index (txt (20)));
-insert into t1 (txt) values ('Chevy'), ('Chevy '), (NULL);
-select * from t1 where txt='Chevy' or txt is NULL;
-explain select * from t1 where txt='Chevy' or txt is NULL;
-select * from t1 where txt='Chevy ';
-select * from t1 where txt='Chevy ' or txt='Chevy';
-select * from t1 where txt='Chevy' or txt='Chevy ';
-select * from t1 where id='1' or id='2';
-insert into t1 (txt) values('Ford');
-select * from t1 where txt='Chevy' or txt='Chevy ' or txt='Ford';
-select * from t1 where txt='Chevy' or txt='Chevy ';
-select * from t1 where txt='Chevy' or txt='Chevy ' or txt=' Chevy';
-select * from t1 where txt in ('Chevy ','Chevy');
-select * from t1 where txt in ('Chevy');
-select * from t1 where txt between 'Chevy' and 'Chevy';
-select * from t1 where txt between 'Chevy' and 'Chevy' or txt='Chevy ';
-select * from t1 where txt between 'Chevy' and 'Chevy ';
-select * from t1 where txt < 'Chevy ';
-select * from t1 where txt < 'Chevy ' or txt is NULL;
-select * from t1 where txt <= 'Chevy';
-select * from t1 where txt > 'Chevy';
-select * from t1 where txt >= 'Chevy';
-alter table t1 modify column txt blob;
-explain select * from t1 where txt='Chevy' or txt is NULL;
-select * from t1 where txt='Chevy' or txt is NULL;
-explain select * from t1 where txt='Chevy' or txt is NULL order by txt;
-select * from t1 where txt='Chevy' or txt is NULL order by txt;
-drop table t1;
-
-CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, d varchar(1) NOT NULL DEFAULT ' ', PRIMARY KEY (i), KEY (c(1),d));
-INSERT t1 (i, c) VALUES (1,''),(2,''),(3,'asdfh'),(4,'');
-select max(i) from t1 where c = '';
-drop table t1;
-
-# End of 4.1 tests
-
-#
-# Bug#11657: Creation of secondary index fails
-#
-create table t1 (a int, b int, c tinyblob, d int, e int);
-alter table t1 add primary key (a,b,c(255),d);
-alter table t1 add key (a,b,d,e);
-show create table t1;
-drop table t1;
-
-#
-# Test that blob's and varbinary are sorted according to length
-#
-
-CREATE table t1 (a blob);
-insert into t1 values ('b'),('a\0'),('a'),('a '),('aa'),(NULL);
-select hex(a) from t1 order by a;
-select hex(concat(a,'\0')) as b from t1 order by concat(a,'\0');
-alter table t1 modify a varbinary(5);
-select hex(a) from t1 order by a;
-select hex(concat(a,'\0')) as b from t1 order by concat(a,'\0');
-alter table t1 modify a char(5);
-select hex(a) from t1 order by a;
-select hex(concat(a,'\0')) as b from t1 order by concat(a,'\0');
-alter table t1 modify a binary(5);
-select hex(a) from t1 order by a;
-select hex(concat(a,'\0')) as b from t1 order by concat(a,'\0');
-drop table t1;
-
-#
-# Bug #19489: Inconsistent support for DEFAULT in TEXT columns
-#
-create table t1 (a text default '');
-show create table t1;
-insert into t1 values (default);
-select * from t1;
-drop table t1;
-set @@sql_mode='TRADITIONAL';
-create table t1 (a text default '');
-show create table t1;
-drop table t1;
-set @@sql_mode='';
-
-#
-# Bug #32282: TEXT silently truncates when value is exactly 65536 bytes
-#
-
-CREATE TABLE t (c TEXT CHARSET ASCII);
-INSERT INTO t (c) VALUES (REPEAT('1',65537));
-INSERT INTO t (c) VALUES (REPEAT('2',65536));
-INSERT INTO t (c) VALUES (REPEAT('3',65535));
-SELECT LENGTH(c), CHAR_LENGTH(c) FROM t;
-DROP TABLE t;
-# Bug#15776: 32-bit signed int used for length of blob
-# """LONGBLOB: A BLOB column with a maximum length of 4,294,967,295 or 4GB."""
-#
-# Conditions should be in this order:
-# A size is not in the allowed bounds.
-# If the type is char-ish AND size is within the max blob size:
-# raise ER_TOO_BIG_FIELDLENGTH (suggest using BLOB)
-# If size is too small:
-# raise ER_PARSE_ERROR
-# raise ER_TOO_BIG_DISPLAYWIDTH
-
-# BLOB and TEXT types
---disable_warnings
-drop table if exists b15776;
---enable_warnings
-create table b15776 (data blob(2147483647));
-drop table b15776;
---error ER_PARSE_ERROR
-create table b15776 (data blob(-1));
-create table b15776 (data blob(2147483648));
-drop table b15776;
-create table b15776 (data blob(4294967294));
-drop table b15776;
-create table b15776 (data blob(4294967295));
-drop table b15776;
---error ER_TOO_BIG_DISPLAYWIDTH
-create table b15776 (data blob(4294967296));
-
-CREATE TABLE b15776 (a blob(2147483647), b blob(2147483648), c blob(4294967295), a1 text(2147483647), b1 text(2147483648), c1 text(4294967295) );
-show columns from b15776;
-drop table b15776;
-
---error ER_TOO_BIG_DISPLAYWIDTH
-CREATE TABLE b15776 (a blob(4294967296));
---error ER_TOO_BIG_DISPLAYWIDTH
-CREATE TABLE b15776 (a text(4294967296));
---error ER_TOO_BIG_DISPLAYWIDTH
-CREATE TABLE b15776 (a blob(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
---error ER_TOO_BIG_DISPLAYWIDTH
-CREATE TABLE b15776 (a text(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
-
-# Int types
-# "Another extension is supported by MySQL for optionally specifying the
-# display width of integer data types in parentheses following the base keyword
-# for the type (for example, INT(4)). This optional display width is used to
-# display integer values having a width less than the width specified for the
-# column by left-padding them with spaces." § Numeric Types
-CREATE TABLE b15776 (a int(0)); # 0 is special case, means default size
-INSERT INTO b15776 values (NULL), (1), (42), (654);
-SELECT * from b15776 ORDER BY a;
-DROP TABLE b15776;
---error ER_PARSE_ERROR
-CREATE TABLE b15776 (a int(-1));
-CREATE TABLE b15776 (a int(255));
-DROP TABLE b15776;
---error ER_TOO_BIG_DISPLAYWIDTH
-CREATE TABLE b15776 (a int(256));
---error ER_PARSE_ERROR
-CREATE TABLE b15776 (data blob(-1));
-
-# Char types
-# Recommend BLOB
---error ER_TOO_BIG_FIELDLENGTH
-CREATE TABLE b15776 (a char(2147483647));
---error ER_TOO_BIG_FIELDLENGTH
-CREATE TABLE b15776 (a char(2147483648));
---error ER_TOO_BIG_FIELDLENGTH
-CREATE TABLE b15776 (a char(4294967295));
-# Even BLOB won't hold
---error ER_TOO_BIG_FIELDLENGTH
-CREATE TABLE b15776 (a char(4294967296));
-
-
-# Other numeric-ish types
-## For year, widths not "2" or "4" are silently rewritten to "4". But
-## When we complain about it, we say that the max is 255. We may be
-## talking about different things. It's confusing.
---replace_result 4294967295 ? 0 ?
-CREATE TABLE b15776 (a year(4294967295));
-INSERT INTO b15776 VALUES (42);
-SELECT * FROM b15776;
-DROP TABLE b15776;
-CREATE TABLE b15776 (a year(4294967296));
-SHOW CREATE TABLE b15776;
-DROP TABLE b15776;
-CREATE TABLE b15776 (a year(0)); # 0 is special case, means default size
-DROP TABLE b15776;
---error ER_PARSE_ERROR
-CREATE TABLE b15776 (a year(-2));
-
-## For timestamp, we silently rewrite widths to 14 or 19.
---error ER_TOO_BIG_PRECISION
-CREATE TABLE b15776 (a timestamp(4294967294));
---error ER_TOO_BIG_PRECISION
-CREATE TABLE b15776 (a timestamp(4294967295));
---error ER_TOO_BIG_PRECISION
-CREATE TABLE b15776 (a timestamp(4294967296));
---error ER_PARSE_ERROR
-CREATE TABLE b15776 (a timestamp(-1));
---error ER_PARSE_ERROR
-CREATE TABLE b15776 (a timestamp(-2));
-
-# We've already tested the case, but this should visually show that
-# widths that are too large to be interpreted cause DISPLAYWIDTH errors.
---error ER_TOO_BIG_DISPLAYWIDTH
-CREATE TABLE b15776 (a int(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
---error ER_TOO_BIG_FIELDLENGTH
-CREATE TABLE b15776 (a char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
-CREATE TABLE b15776 (a year(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
-SHOW CREATE TABLE b15776;
-DROP TABLE b15776;
-
-## Do not select, too much memory needed.
-CREATE TABLE b15776 select cast(null as char(4294967295));
-show columns from b15776;
-drop table b15776;
-CREATE TABLE b15776 select cast(null as nchar(4294967295));
-show columns from b15776;
-drop table b15776;
-CREATE TABLE b15776 select cast(null as binary(4294967295));
-show columns from b15776;
-drop table b15776;
-
-explain select cast(1 as char(4294967295));
-explain select cast(1 as nchar(4294967295));
-explain select cast(1 as binary(4294967295));
-
---error ER_TOO_BIG_DISPLAYWIDTH
-explain select cast(1 as char(4294967296));
---error ER_TOO_BIG_DISPLAYWIDTH
-explain select cast(1 as nchar(4294967296));
---error ER_TOO_BIG_DISPLAYWIDTH
-explain select cast(1 as binary(4294967296));
-
---error ER_PARSE_ERROR
-explain select cast(1 as decimal(-1));
-explain select cast(1 as decimal(64, 30));
-# It's not as important which errors are raised for these, since the
-# limit is nowhere near 2**32. We may fix these eventually to take
-# 4294967295 and still reject it because it's greater than 64 or 30,
-# but that's not a high priority and the parser needn't worry about
-# such a weird case.
---error ER_TOO_BIG_SCALE,ER_PARSE_ERROR
-explain select cast(1 as decimal(64, 999999999999999999999999999999));
---error ER_TOO_BIG_PRECISION,ER_PARSE_ERROR
-explain select cast(1 as decimal(4294967296));
---error ER_TOO_BIG_PRECISION,ER_PARSE_ERROR
-explain select cast(1 as decimal(999999999999999999999999999999999999));
-
-explain select convert(1, char(4294967295));
---error ER_TOO_BIG_DISPLAYWIDTH
-explain select convert(1, char(4294967296));
---error ER_TOO_BIG_DISPLAYWIDTH
-explain select convert(1, char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
-explain select convert(1, nchar(4294967295));
---error ER_TOO_BIG_DISPLAYWIDTH
-explain select convert(1, nchar(4294967296));
---error ER_TOO_BIG_DISPLAYWIDTH
-explain select convert(1, nchar(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
-explain select convert(1, binary(4294967295));
---error ER_TOO_BIG_DISPLAYWIDTH
-explain select convert(1, binary(4294967296));
---error ER_TOO_BIG_DISPLAYWIDTH
-explain select convert(1, binary(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
-
---echo End of 5.0 tests
-
-#
-# Bug #33969: Updating a text field via a left join
-#
-
-CREATE TABLE t1(id INT NOT NULL);
-CREATE TABLE t2(id INT NOT NULL, c TEXT NOT NULL);
-
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (1, '');
-
-UPDATE t2 SET c = REPEAT('1', 70000);
-SELECT LENGTH(c) FROM t2;
-
-UPDATE t1 LEFT JOIN t2 USING(id) SET t2.c = REPEAT('1', 70000) WHERE t1.id = 1;
-SELECT LENGTH(c) FROM t2;
-
-DROP TABLE t1, t2;
-
---echo # Bug #52160: crash and inconsistent results when grouping
---echo # by a function and column
-
-CREATE FUNCTION f1() RETURNS TINYBLOB RETURN 1;
-
-CREATE TABLE t1(a CHAR(1));
-INSERT INTO t1 VALUES ('0'), ('0');
-
-SELECT COUNT(*) FROM t1 GROUP BY f1(), a;
-
-DROP FUNCTION f1;
-DROP TABLE t1;
-
---echo End of 5.1 tests
-
---echo #
---echo # Start of 5.5 tests
---echo #
-
-#
-# Problem when comparing blobs #778901
-#
-
-CREATE TABLE t1 ( f1 blob, f2 blob );
-INSERT INTO t1 VALUES ('','');
-SELECT f1,f2,"found row" FROM t1 WHERE f1 = f2 ;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-9319 ALTER from a bigger to a smaller blob type truncates too much data
---echo #
-CREATE TABLE t1 (a MEDIUMBLOB);
-INSERT INTO t1 VALUES (REPEAT(0x61,128000));
-SELECT LENGTH(a) FROM t1;
-ALTER TABLE t1 MODIFY a BLOB;
-SELECT LENGTH(a) FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a BLOB);
-INSERT INTO t1 VALUES (REPEAT(0x61,65000));
-SELECT LENGTH(a) FROM t1;
-ALTER TABLE t1 MODIFY a TINYBLOB;
-SELECT LENGTH(a) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # End of 5.5 tests
---echo #
diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test
deleted file mode 100644
index 8d29a54a26c..00000000000
--- a/mysql-test/t/type_date.test
+++ /dev/null
@@ -1,616 +0,0 @@
-#
-# test of problem with date fields
-#
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-create table t1 (a char(16), b date, c datetime);
-insert into t1 SET a='test 2000-01-01', b='2000-01-01', c='2000-01-01';
-select * from t1 where c = '2000-01-01';
-select * from t1 where b = '2000-01-01';
-drop table t1;
-
-#
-# problem with date conversions
-#
-
-CREATE TABLE t1 (name char(6),cdate date);
-INSERT INTO t1 VALUES ('name1','1998-01-01');
-INSERT INTO t1 VALUES ('name2','1998-01-01');
-INSERT INTO t1 VALUES ('name1','1998-01-02');
-INSERT INTO t1 VALUES ('name2','1998-01-02');
-CREATE TABLE t2 (cdate date, note char(6));
-INSERT INTO t2 VALUES ('1998-01-01','note01');
-INSERT INTO t2 VALUES ('1998-01-02','note02');
-select name,t1.cdate,note from t1,t2 where t1.cdate=t2.cdate and t1.cdate='1998-01-01';
-drop table t1,t2;
-
-# MariaDB lp:993103. WHERE LAST_DAY(zero_date) IS NULL does not evaluate to TRUE.
-
-CREATE TABLE t1(a INT);
-INSERT INTO t1 VALUES(1);
-SELECT * FROM t1 WHERE LAST_DAY('0000-00-00 00:00:00') IS NULL;
-DROP TABLE t1;
-
-#
-# Date and BETWEEN
-#
-
-CREATE TABLE t1 ( datum DATE );
-INSERT INTO t1 VALUES ( "2000-1-1" );
-INSERT INTO t1 VALUES ( "2000-1-2" );
-INSERT INTO t1 VALUES ( "2000-1-3" );
-INSERT INTO t1 VALUES ( "2000-1-4" );
-INSERT INTO t1 VALUES ( "2000-1-5" );
-SELECT * FROM t1 WHERE datum BETWEEN cast("2000-1-2" as date) AND cast("2000-1-4" as date);
-SELECT * FROM t1 WHERE datum BETWEEN cast("2000-1-2" as date) AND datum - INTERVAL 100 DAY;
-DROP TABLE t1;
-
-#
-# test of max(date) and having
-#
-
-CREATE TABLE t1 (
- user_id char(10),
- summa int(11),
- rdate date
-);
-INSERT INTO t1 VALUES ('aaa',100,'1998-01-01');
-INSERT INTO t1 VALUES ('aaa',200,'1998-01-03');
-INSERT INTO t1 VALUES ('bbb',50,'1998-01-02');
-INSERT INTO t1 VALUES ('bbb',200,'1998-01-04');
-select max(rdate) as s from t1 where rdate < '1998-01-03' having s> "1998-01-01";
-select max(rdate) as s from t1 having s="1998-01-04";
-select max(rdate+0) as s from t1 having s="19980104";
-drop table t1;
-
-#
-# Test of date and not null
-#
-
-create table t1 (date date);
-insert into t1 values ("2000-08-10"),("2000-08-11");
-select date_add(date,INTERVAL 1 DAY),date_add(date,INTERVAL 1 SECOND) from t1;
-drop table t1;
-
-#
-# Test problem with DATE_FORMAT
-#
-
-CREATE TABLE t1(AFIELD INT);
-INSERT INTO t1 VALUES(1);
-CREATE TABLE t2(GMT VARCHAR(32));
-INSERT INTO t2 VALUES('GMT-0800');
-SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT))
-FROM t1, t2 GROUP BY t1.AFIELD;
-INSERT INTO t1 VALUES(1);
-SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT)),
- DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ', t2.GMT))
-FROM t1,t2 GROUP BY t1.AFIELD;
-drop table t1,t2;
-
-#
-# Multiple SELECT DATE_FORMAT gave incorrect results (Bug #4036)
-#
-
-CREATE TABLE t1 (f1 time default NULL, f2 time default NULL);
-INSERT INTO t1 (f1, f2) VALUES ('09:00', '12:00');
-SELECT DATE_FORMAT(f1, "%l.%i %p") , DATE_FORMAT(f2, "%l.%i %p") FROM t1;
-DROP TABLE t1;
-
-#
-# Bug#4937: different date -> string conversion when using SELECT ... UNION
-# and INSERT ... SELECT ... UNION
-#
-
-CREATE TABLE t1 (f1 DATE);
-CREATE TABLE t2 (f2 VARCHAR(8));
-CREATE TABLE t3 (f2 CHAR(8));
-
-INSERT INTO t1 VALUES ('1978-11-26');
-INSERT INTO t2 SELECT f1+0 FROM t1;
-INSERT INTO t2 SELECT f1+0 FROM t1 UNION SELECT f1+0 FROM t1;
-INSERT INTO t3 SELECT f1+0 FROM t1;
-INSERT INTO t3 SELECT f1+0 FROM t1 UNION SELECT f1+0 FROM t1;
-SELECT * FROM t2;
-SELECT * FROM t3;
-
-DROP TABLE t1, t2, t3;
-
-# Test that setting YEAR to invalid string results in default value, not
-# 2000. (Bug #6067)
-CREATE TABLE t1 (y YEAR);
-INSERT IGNORE INTO t1 VALUES ('abc');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-#
-# Bug#21677: Wrong result when comparing a DATE and a DATETIME in BETWEEN
-#
-create table t1(start_date date, end_date date);
-insert into t1 values ('2000-01-01','2000-01-02');
-select 1 from t1 where cast('2000-01-01 12:01:01' as datetime) between start_date and end_date;
-drop table t1;
-# End of 4.1 tests
-
-#
-# Bug #23093: Implicit conversion of 9912101 to date does not match
-# cast(9912101 as date)
-#
-select @d:=1111;
-select year(@d), month(@d), day(@d), cast(@d as date);
-select @d:=011111;
-select year(@d), month(@d), day(@d), cast(@d as date);
-select @d:=1311;
-select year(@d), month(@d), day(@d), cast(@d as date);
-create table t1 (d date , dt datetime , ts timestamp);
-insert ignore into t1 values (9912101,9912101,9912101);
-insert into t1 values (11111,11111,11111);
-select * from t1;
-drop table t1;
-
-#
-# Bug#30942: select str_to_date from derived table returns varying results
-#
-CREATE TABLE t1 (
- a INT
-);
-
-INSERT INTO t1 VALUES (1);
-INSERT INTO t1 VALUES (NULL);
-
-SELECT str_to_date( '', a ) FROM t1;
-DROP TABLE t1;
-
-
-#
-# Bug#31221: Optimizer incorrectly identifies impossible WHERE clause
-#
-
-CREATE TABLE t1 (a DATE, b INT, PRIMARY KEY (a,b));
-
-SET timestamp=UNIX_TIMESTAMP('2016-07-21 14:48:18');
-INSERT INTO t1 VALUES (DATE(NOW()), 1);
-SELECT COUNT(*) FROM t1 WHERE a = NOW();
-EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW();
-INSERT INTO t1 VALUES (DATE(NOW()), 2);
-SELECT COUNT(*) FROM t1 WHERE a = NOW();
-EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW();
-SELECT COUNT(*) FROM t1 WHERE a = NOW() AND b = 1;
-EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW() AND b = 1;
-ALTER TABLE t1 DROP PRIMARY KEY;
-SELECT COUNT(*) FROM t1 WHERE a = NOW();
-EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW();
-SET timestamp=DEFAULT;
-
-DROP TABLE t1;
-
-#
-# Bug#28687: Search fails on '0000-00-00' date after sql_mode change
-#
-
-CREATE TABLE t1 (a DATE);
-CREATE TABLE t2 (a DATE);
-CREATE INDEX i ON t1 (a);
-INSERT INTO t1 VALUES ('0000-00-00'),('0000-00-00');
-INSERT INTO t2 VALUES ('0000-00-00'),('0000-00-00');
-SELECT * FROM t1 WHERE a = '0000-00-00';
-SELECT * FROM t2 WHERE a = '0000-00-00';
-SET SQL_MODE=TRADITIONAL;
-EXPLAIN SELECT * FROM t1 WHERE a = '0000-00-00';
-SELECT * FROM t1 WHERE a = '0000-00-00';
-SELECT * FROM t2 WHERE a = '0000-00-00';
---error ER_TRUNCATED_WRONG_VALUE
-INSERT INTO t1 VALUES ('0000-00-00');
-SET SQL_MODE=DEFAULT;
-DROP TABLE t1,t2;
-
-#
-# Bug #31928: Search fails on '1000-00-00' date after sql_mode change
-#
-
-CREATE TABLE t1 (a DATE);
-CREATE TABLE t2 (a DATE);
-CREATE INDEX i ON t1 (a);
-INSERT INTO t1 VALUES ('1000-00-00'),('1000-00-00');
-INSERT INTO t2 VALUES ('1000-00-00'),('1000-00-00');
-SELECT * FROM t1 WHERE a = '1000-00-00';
-SELECT * FROM t2 WHERE a = '1000-00-00';
-SET SQL_MODE=TRADITIONAL;
-EXPLAIN SELECT * FROM t1 WHERE a = '1000-00-00';
-SELECT * FROM t1 WHERE a = '1000-00-00';
-SELECT * FROM t2 WHERE a = '1000-00-00';
---error ER_TRUNCATED_WRONG_VALUE
-INSERT INTO t1 VALUES ('1000-00-00');
-SET SQL_MODE=DEFAULT;
-DROP TABLE t1,t2;
-
-#
-# Bug #31990: MINUTE() and SECOND() return bogus results when used on a DATE
-#
-
-CREATE TABLE t1 SELECT curdate() AS f1;
-SELECT hour(f1), minute(f1), second(f1) FROM t1;
-DROP TABLE t1;
-
---echo End of 5.0 tests
-
-#
-# Bug#32021: Using Date 000-00-01 in WHERE causes wrong result
-#
-create table t1 (a date, primary key (a))engine=memory;
-insert into t1 values ('0000-01-01'), ('0000-00-01'), ('0001-01-01');
-select * from t1 where a between '0000-00-01' and '0000-00-02';
-drop table t1;
-
---echo #
---echo # Bug#50918: Date columns treated differently in Views than in Base
---echo # Tables
---echo #
-CREATE TABLE t1 ( the_date DATE, the_time TIME );
-INSERT INTO t1 VALUES ( '2010-01-01', '01:01:01' );
-
-SELECT * FROM t1 t11 JOIN t1 t12 ON addtime( t11.the_date, t11.the_time ) =
- addtime( t12.the_date, t12.the_time );
-
-CREATE VIEW v1 AS SELECT * FROM t1;
-SELECT * FROM t1 JOIN v1 ON addtime( t1.the_date, t1.the_time ) =
- addtime( v1.the_date, v1.the_time );
-
-SELECT * FROM t1 JOIN v1 ON addtime( t1.the_date, t1.the_time ) =
- addtime( cast(v1.the_date AS DATETIME), v1.the_time );
-
-DROP TABLE t1;
-DROP VIEW v1;
-
---echo #
---echo # Bug#59685 crash in String::length with date types
---echo #
-
-CREATE TABLE t1(a DATE, b YEAR, KEY(a));
-INSERT INTO t1 VALUES ('2011-01-01',2011);
-
-SELECT b = (SELECT CONVERT(a, DATE) FROM t1 GROUP BY a) FROM t1;
-SELECT b = CONVERT((SELECT CONVERT(a, DATE) FROM t1 GROUP BY a), DATE) FROM t1;
-
-DROP TABLE t1;
-
---echo End of 5.1 tests
-
-#
-# lp:737496 Field_temporal::store_TIME_with_warning() in 5.1-micro
-#
-create table t1 (f1 date, key (f1));
-insert ignore t1 values ('2010-10-10 15:foobar');
-drop table t1;
-
---echo #
---echo # MDEV-4634 Crash in CONVERT_TZ
---echo #
-SELECT CONVERT_TZ(GREATEST(DATE('2021-00-00'),DATE('2022-00-00')),'+00:00','+7:5');
-
---echo #
---echo # MDEV-4804 Date comparing false result
---echo #
-SET @h0="20111107";
-SET @h1="0";
-SET @@timestamp=UNIX_TIMESTAMP('2013-08-19 20:30:00');
-SELECT
- COALESCE(DATE(@h0),DATE("1901-01-01")) AS h0d,
- COALESCE(DATE(@h1),DATE(NOW())) AS h1d,
- COALESCE(DATE(@h0),DATE("1901-01-01"))>COALESCE(DATE(@h1),DATE(NOW())) AS compare_h0_gt_h1;
-SELECT
- DATE('20011107'),
- DATE('0'),
- COALESCE(DATE('0'),CURRENT_DATE) AS d1,
- DATE('20011107')>COALESCE(DATE('0'),CURRENT_DATE) AS cmp;
-SELECT
- DATE('20011107'),
- DATE('0'),
- IFNULL(DATE('0'),CURRENT_DATE) AS d1,
- DATE('20011107')>IFNULL(DATE('0'),CURRENT_DATE) AS cmp;
-
---echo #
---echo # MDEV-5041 Inserting a TIME with hour>24 into a DATETIME column produces a wrong value
---echo #
-SELECT CAST(TIME('-800:20:30') AS DATE);
-SELECT CAST(TIME('800:20:30') AS DATE);
-SELECT CAST(TIME('33 08:20:30') AS DATE);
-CREATE TABLE t1 (a DATE);
-INSERT INTO t1 VALUES (TIME('800:20:30'));
-INSERT INTO t1 VALUES (TIME('33 08:20:30'));
-SET SQL_MODE=NO_ZERO_IN_DATE;
-INSERT INTO t1 VALUES (TIME('48:20:30'));
-SET SQL_MODE=DEFAULT;
-SELECT * FROM t1;
-DROP TABLE t1;
-DELIMITER |;
-CREATE PROCEDURE test5041()
-BEGIN
- DECLARE t TIME;
- DECLARE d DATE;
- SET t= TIME('800:00:00');
- SET d= t;
- SELECT d;
-END;|
-DELIMITER ;|
-call test5041();
-drop procedure test5041;
-
-SET @@timestamp=DEFAULT;
---echo #
---echo # End of 5.3 tests
---echo #
-
---echo #
---echo # Bug #33629: last_day function can return null, but has 'not null'
---echo # flag set for result
---echo #
-
-SELECT 1 FROM (SELECT LAST_DAY('0')) a;
-SELECT 1 FROM (SELECT MAKEDATE(2011,0)) a;
-
-CREATE TABLE t1 AS
- SELECT LAST_DAY('1970-01-01') AS f1,
- MAKEDATE(1970, 1) AS f2;
-DESCRIBE t1;
-DROP TABLE t1;
-
---echo #
-
---echo #
---echo # Bug#57278: Crash on min/max + with date out of range.
---echo #
-set @a=(select min(makedate('111','1'))) ;
-select @a;
---echo #
-
---echo #
---echo # BUG LP:1008487 virtual bool Item_cache::is_expensive(): Assertion `example' failed
---echo #
-SET TIMESTAMP=UNIX_TIMESTAMP('2017-01-03 00:00:00');
-create table t1(a date,key(a));
-insert into t1 values ('2012-01-01'),('2012-02-02');
-explain
-select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1;
-select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1;
-SET TIMESTAMP=UNIX_TIMESTAMP('2012-01-03 00:00:01');
-explain
-select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1;
-select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1;
-drop table t1;
-SET TIMESTAMP=DEFAULT;
-
---echo #
---echo # MDEV-9521 Least function returns 0000-00-00 for null date columns instead of null
---echo # MDEV-9972 Least function retuns date in date time format
---echo #
-CREATE TABLE t1 (
- id BIGINT NOT NULL,
- date_debut DATE NOT NULL,
- date_fin DATE DEFAULT NULL);
-CREATE TABLE t2(
- id BIGINT NOT NULL,
- date_debut DATE NOT NULL,
- date_fin DATE DEFAULT NULL);
-INSERT INTO t1 VALUES (1,'2016-01-01','2016-01-31');
-INSERT INTO t1 VALUES (2,'2016-02-01',null);
-INSERT INTO t1 VALUES (3,'2016-03-01','2016-03-31');
-INSERT INTO t1 VALUES (4,'2016-04-01',null);
-
-INSERT INTO t2 VALUES (1,'2016-01-01','2016-01-31');
-INSERT INTO t2 VALUES (2,'2016-02-01','2016-01-28');
-INSERT INTO t2 VALUES (3,'2016-03-01',null);
-INSERT INTO t2 VALUES (4,'2016-04-01',null);
-SELECT t1.id,
- GREATEST(t2.date_debut, t1.date_debut) AS date_debut,
- LEAST(IFNULL(t2.date_fin, IFNULL(t1.date_fin, NULL)),
- IFNULL(t1.date_fin, IFNULL(t2.date_fin, NULL))) AS date_fin
-FROM t1 LEFT JOIN t2 ON (t1.id=t2.id);
-DROP TABLE t1,t2;
-SELECT
- LEAST(COALESCE(DATE(NULL), DATE(NULL)), COALESCE(DATE(NULL), DATE(NULL))) AS d0,
- LEAST(IFNULL(DATE(NULL), DATE(NULL)), IFNULL(DATE(NULL), DATE(NULL))) AS d1;
-
---echo #
---echo # MDEV-9511 Valgrind warnings 'Invalid read' in Field_newdate::cmp and Field_newdate::val_str
---echo #
-CREATE TABLE t1 (f1 DATE, f2 VARCHAR(1));
-INSERT INTO t1 VALUES ('2003-04-27','a'),('1900-01-01','a');
-SELECT GROUP_CONCAT(f2, IF(f1, f2, f1), f1 ORDER BY 2,1,3) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
-let type=DATE;
-let defval='0000-00-00';
---source include/type_temporal_zero_default.inc
-
---echo #
---echo # MDEV-8722 The patch for MDEV-8688 disabled equal field propagation for temporal column and BETWEEN and IN
---echo #
-CREATE TABLE t1 (a DATE);
-INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-02');
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a BETWEEN '2001-01-01' AND '2001-01-02';
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01' AND a IN ('2001-01-01','2001-01-02');
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8699 Wrong result for SELECT..WHERE HEX(date_column)!='323030312D30312D3031' AND date_column='2001-01-01x'
---echo #
-# Trailing garbage in string literals
-CREATE TABLE t1 (a DATE);
-INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-02');
-SELECT * FROM t1 WHERE a='2001-01-01x';
-SELECT * FROM t1 WHERE HEX(a)!='323030312D30312D3031';
-SELECT * FROM t1 WHERE HEX(a)!='323030312D30312D3031' AND a='2001-01-01x';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE HEX(a)!='323030312D30312D3031' AND a='2001-01-01x';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE HEX(a)!=CONCAT('xx',RAND()) AND a='2001-01-01x';
-DROP TABLE t1;
-
-# Leading spaces in string literals
-CREATE TABLE t1 (a DATE);
-INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-02');
-SELECT * FROM t1 WHERE LENGTH(a)=11;
-SELECT * FROM t1 WHERE LENGTH(a)=11 AND a=' 2001-01-01';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=11 AND a=' 2001-01-01';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=11+RAND() AND a=' 2001-01-01';
-# This should not propagate
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=11+RAND() AND a=' garbage ';
-DROP TABLE t1;
-
-# Numeric format in string literals
-CREATE TABLE t1 (a DATE);
-INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-01');
-SELECT * FROM t1 WHERE LENGTH(a)=8;
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='20010101';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='20010101';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=8+RAND() AND a='20010101';
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8706 Wrong result for SELECT..WHERE time_column=TIMESTAMP'2015-08-30 00:00:00' AND time_column='00:00:00'
---echo #
-SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30');
-
-CREATE TABLE t1 (a DATE);
-INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
-SELECT * FROM t1 WHERE a=TIME'00:00:00';
-SELECT * FROM t1 WHERE LENGTH(a)=10;
-SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'00:00:00';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'00:00:00';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'00:00:00';
-DROP TABLE t1;
-
-# Special case: zero TIME part after conversion to DATETIME
-CREATE TABLE t1 (a DATE);
-INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
-SELECT * FROM t1 WHERE a=TIME'24:00:00';
-SELECT * FROM t1 WHERE LENGTH(a)=10;
-SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'24:00:00';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIME'24:00:00';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'24:00:00';
-DROP TABLE t1;
-
---echo # In this example '00:00:00' is not recognized as TIME'00:00:00'
---echo # and is treated as DATE'0000-00-00'.
---echo # This may change after MDEV-8322 Distinguish between time and date strings more carefully
-CREATE TABLE t1 (a DATE);
-INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
-SELECT * FROM t1 WHERE a='00:00:00';
-SELECT * FROM t1 WHERE LENGTH(a)=10;
-SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='00:00:00';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='00:00:00';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='00:00:00';
-DROP TABLE t1;
-
-# DATETIME native literal
-CREATE TABLE t1 (a DATE);
-INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
-SELECT * FROM t1 WHERE a=TIMESTAMP'2015-08-30 00:00:00';
-SELECT * FROM t1 WHERE LENGTH(a)=10;
-SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2015-08-30 00:00:00';
-DROP TABLE t1;
-
-# DATETIME native literal with non-zero time
-CREATE TABLE t1 (a DATE);
-INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
-SELECT * FROM t1 WHERE a=TIMESTAMP'2015-08-30 00:00:00.1';
-SELECT * FROM t1 WHERE LENGTH(a)=10;
-SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00.1';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=10 AND a=TIMESTAMP'2015-08-30 00:00:00.1';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2015-08-30 00:00:00.1';
-DROP TABLE t1;
-
-# DATETIME-alike string literal
-CREATE TABLE t1 (a DATE);
-INSERT INTO t1 VALUES ('2015-08-30'),('2015-08-31');
-SELECT * FROM t1 WHERE a='2015-08-30 00:00:00';
-SELECT * FROM t1 WHERE LENGTH(a)=10;
-SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='2015-08-30 00:00:00';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=10 AND a='2015-08-30 00:00:00';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='2015-08-30 00:00:00';
-DROP TABLE t1;
-
-SET timestamp=DEFAULT;
-
---echo #
---echo # MDEV-8795 Equal expression propagation does not work for temporal literals
---echo #
-CREATE TABLE t1 (a DATE);
-INSERT INTO t1 VALUES ('2001-01-01'),('2001-01-02');
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=DATE'2001-01-01' AND COALESCE(a)>=DATE'2001-01-01';
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8658 DATE(zerofill_column) and DATE(COALESCE(zerofill_column)) return different results
---echo #
-CREATE TABLE t1 (a INT(6) ZEROFILL, b DECIMAL(6) ZEROFILL, c DOUBLE(6,0) ZEROFILL);
-INSERT INTO t1 VALUES (1,1,1);
-INSERT INTO t1 VALUES (10101,10101,10101);
-SELECT DATE(a), DATE(b), DATE(c) FROM t1;
-SELECT DATE(COALESCE(a)), DATE(COALESCE(b)), DATE(COALESCE(c)) FROM t1;
-DROP TABLE t1;
-CREATE TABLE t1 (a INT(6), b DECIMAL(6), c DOUBLE(6,0));
-INSERT INTO t1 VALUES (1,1,1);
-INSERT INTO t1 VALUES (10101,10101,10101);
-SELECT DATE(a), DATE(b), DATE(c) FROM t1;
-SELECT DATE(COALESCE(a)), DATE(COALESCE(b)), DATE(COALESCE(c)) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-14221 Assertion `0' failed in Item::field_type_for_temporal_comparison
---echo #
-
-CREATE TABLE t1 (d DATE);
-INSERT INTO t1 VALUES ('1985-05-13'),('1989-12-24');
-SELECT d, COUNT(*) FROM t1 GROUP BY d WITH ROLLUP HAVING CASE d WHEN '2017-05-25' THEN 0 ELSE 1 END;
-DROP TABLE t1;
-
-
---echo #
---echo # End of 10.1 tests
---echo #
-
---echo #
---echo # Start of 10.3 tests
---echo #
-
---echo #
---echo # MDEV-12721 Wrong execution plan for WHERE (date_field <=> timestamp_expr AND TRUE)
---echo #
-CREATE TABLE t1(a DATE,KEY(a));
-INSERT INTO t1 VALUES ('2012-01-01'),('2012-02-02');
-EXPLAIN SELECT 1 FROM t1 WHERE t1.a <=> TIMESTAMP'2001-01-01 00:00:01' AND TRUE;
-EXPLAIN SELECT 1 FROM t1 WHERE t1.a <=> TIMESTAMP('2001-01-01', '00:00:01') AND TRUE;
-EXPLAIN SELECT 1 FROM t1 WHERE t1.a <=> TIMESTAMP'2001-01-01 00:00:00' AND TRUE;
-EXPLAIN SELECT 1 FROM t1 WHERE t1.a <=> TIMESTAMP('2001-01-01', '00:00:00') AND TRUE;
-DROP TABLE t1;
-
---echo #
---echo # End of 10.3 tests
---echo #
diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test
deleted file mode 100644
index dafa9f9456e..00000000000
--- a/mysql-test/t/type_datetime.test
+++ /dev/null
@@ -1,851 +0,0 @@
-#
-# testing different DATETIME ranges
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1 (t datetime);
-insert into t1 values (101),(691231),(700101),(991231),(10000101),(99991231),(101000000),(691231000000),(700101000000),(991231235959),(10000101000000),(99991231235959),(20030100000000),(20030000000000);
-select * from t1;
-delete from t1 where t > 0;
-optimize table t1;
-check table t1;
-delete from t1;
-insert into t1 values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959"),("20030100000000"),("20030000000000");
-
-# Strange dates
-insert into t1 values ("2003-003-03");
-
-# Bug #7308: ISO-8601 date format not handled correctly
-insert into t1 values ("20030102T131415"),("2001-01-01T01:01:01"), ("2001-1-1T1:01:01");
-select * from t1;
-
-# Test some wrong dates
-truncate table t1;
-insert ignore into t1 values("2003-0303 12:13:14");
-select * from t1;
-drop table t1;
-
-#
-# Test insert of now() and curtime()
-#
-
-CREATE TABLE t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, b date, c time, d datetime);
-insert into t1 (b,c,d) values(now(),curtime(),now());
-select date_format(a,"%Y-%m-%d")=b,right(a+0,6)=c+0,a=d+0 from t1;
-drop table t1;
-
-#
-# Test of datetime and not null
-#
-
-CREATE TABLE t1 (a datetime not null);
-insert into t1 values (0);
-select * from t1 where a is null;
-drop table t1;
-
-#
-# Test with bug when propagating DATETIME to integer and WHERE optimization
-#
-
-create table t1 (id int, dt datetime);
-insert into t1 values (1,"2001-08-14 00:00:00"),(2,"2001-08-15 00:00:00"),(3,"2001-08-16 00:00:00"),(4,"2003-09-15 01:20:30");
-select * from t1 where dt='2001-08-14 00:00:00' and dt = if(id=1,'2001-08-14 00:00:00','1999-08-15');
-create index dt on t1 (dt);
-select * from t1 where dt > 20021020;
-select * from t1 ignore index (dt) where dt > 20021020;
-drop table t1;
-
-#
-# Test of datetime optimization
-#
-
-CREATE TABLE `t1` (
- `date` datetime NOT NULL default '0000-00-00 00:00:00',
- `numfacture` int(6) unsigned NOT NULL default '0',
- `expedition` datetime NOT NULL default '0000-00-00 00:00:00',
- PRIMARY KEY (`numfacture`),
- KEY `date` (`date`),
- KEY `expedition` (`expedition`)
-) ENGINE=MyISAM;
-
-INSERT INTO t1 (expedition) VALUES ('0001-00-00 00:00:00');
-SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00';
-INSERT INTO t1 (numfacture,expedition) VALUES ('1212','0001-00-00 00:00:00');
-SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00';
-EXPLAIN SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00';
-drop table t1;
-create table t1 (a datetime not null, b datetime not null);
-insert into t1 values (now(), now());
-insert into t1 values (now(), now());
-select * from t1 where a is null or b is null;
-drop table t1;
-
-#
-# Let us check if we properly treat wrong datetimes and produce proper
-# warnings (for both strings and numbers)
-#
-create table t1 (t datetime);
-insert ignore into t1 values (20030102030460),(20030102036301),(20030102240401),
- (20030132030401),(20031302030401),(100001202030401);
-select * from t1;
-delete from t1;
-insert ignore into t1 values
- ("2003-01-02 03:04:60"),("2003-01-02 03:63:01"),("2003-01-02 24:04:01"),
- ("2003-01-32 03:04:01"),("2003-13-02 03:04:01"), ("10000-12-02 03:04:00");
-select * from t1;
-delete from t1;
-insert ignore into t1 values ("0000-00-00 00:00:00 some trailer"),("2003-01-01 00:00:00 some trailer");
-select * from t1 order by t;
-drop table t1;
-
-#
-# Test for bug #7297 "Two digit year should be interpreted correctly even
-# with zero month and day"
-#
-create table t1 (dt datetime);
-# These dates should be treated as dates in 21st century
-insert into t1 values ("12-00-00"), ("00-00-00 01:00:00");
-# Zero dates are still special :/
-insert into t1 values ("00-00-00"), ("00-00-00 00:00:00");
-select * from t1;
-drop table t1;
-
-#
-# Bug #16546 DATETIME+0 not always coerced the same way
-#
-select cast('2006-12-05 22:10:10' as datetime) + 0;
-
-
-# End of 4.1 tests
-
-#
-# Bug#21475: Wrongly applied constant propagation leads to a false comparison.
-#
-CREATE TABLE t1(a DATETIME NOT NULL);
-INSERT INTO t1 VALUES ('20060606155555');
-SELECT a FROM t1 WHERE a=(SELECT MAX(a) FROM t1) AND (a="20060606155555");
-PREPARE s FROM 'SELECT a FROM t1 WHERE a=(SELECT MAX(a) FROM t1) AND (a="20060606155555")';
-EXECUTE s;
-DROP PREPARE s;
-DROP TABLE t1;
-
-
-#
-# Bug 19491 (CAST DATE AS DECIMAL returns incorrect result
-#
-SELECT CAST(CAST('2006-08-10' AS DATE) AS DECIMAL(20,6));
-SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME(6)) AS DECIMAL(20,6));
-SELECT CAST(CAST('2006-08-10 10:11:12' AS DATETIME(6)) + INTERVAL 14 MICROSECOND AS DECIMAL(20,6));
-SELECT CAST(CAST('10:11:12.098700' AS TIME(6)) AS DECIMAL(20,6));
-
-
-#
-# Test of storing datetime into date fields
-#
-
-set @org_mode=@@sql_mode;
-create table t1 (da date default '1962-03-03 23:33:34', dt datetime default '1962-03-03');
-show create table t1;
-insert into t1 values ();
-insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38');
-set @@sql_mode='ansi,traditional';
-insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38');
-insert into t1 set dt='2007-03-23 13:49:38',da=dt;
-# Test error handling
---error ER_TRUNCATED_WRONG_VALUE
-insert into t1 values ('2007-03-32','2007-03-23 13:49:38');
-select * from t1;
-drop table t1;
---error ER_INVALID_DEFAULT
-create table t1 (da date default '1962-03-32 23:33:34', dt datetime default '1962-03-03');
---error ER_INVALID_DEFAULT
-create table t1 (t time default '916:00:00 a');
-set @@sql_mode= @org_mode;
-
-
-#
-# Bug#27590: Wrong DATE/DATETIME comparison.
-#
-## The following sub test will fail (difference to expected result) if the
-## select curdate() < now(), f1 < now(), cast(f1 as date) < now() from t1;
-## runs exact at midnight ('00:00:00').
-## ( Bug#29290 type_datetime.test failure in 5.1 )
-## Therefore we sleep a bit if we are too close to midnight.
-## The complete test itself needs around 1 second.
-## Therefore a time_distance to midnight of 5 seconds should be sufficient.
-if (`SELECT CURTIME() > SEC_TO_TIME(24 * 3600 - 5)`)
-{
- # We are here when CURTIME() is between '23:59:56' and '23:59:59'.
- # So a sleep time of 5 seconds brings us between '00:00:01' and '00:00:04'.
- --real_sleep 5
-}
-create table t1 (f1 date, f2 datetime, f3 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
-insert into t1(f1) values(curdate());
-select curdate() < now(), f1 < now(), cast(f1 as date) < now() from t1;
-delete from t1;
-insert into t1 values('2001-01-01','2001-01-01 01:01:01','2001-01-01 01:01:01');
-insert into t1 values('2001-02-05','2001-02-05 00:00:00','2001-02-05 01:01:01');
-insert into t1 values('2001-03-10','2001-03-09 01:01:01','2001-03-10 01:01:01');
-insert into t1 values('2001-04-15','2001-04-15 00:00:00','2001-04-15 00:00:00');
-insert into t1 values('2001-05-20','2001-05-20 01:01:01','2001-05-20 01:01:01');
-select f1, f3 from t1 where f1 >= '2001-02-05 00:00:00' and f3 <= '2001-04-15';
-select f1, f3 from t1 where f1 >= '2001-2-5 0:0:0' and f2 <= '2001-4-15';
-select f1, f2 from t1 where if(1, f1, 0) >= f2;
-select 1 from dual where cast('2001-1-1 2:3:4' as date) = cast('2001-01-01' as datetime);
-select f1, f2, f1 > f2, f1 = f2, f1 < f2 from t1;
-drop table t1;
-
-#
-# Bug#16377: Wrong DATE/DATETIME comparison in BETWEEN function.
-#
-create table t1 (f1 date, f2 datetime, f3 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
-insert into t1 values('2001-01-01','2001-01-01 01:01:01','2001-01-01 01:01:01');
-insert into t1 values('2001-02-05','2001-02-05 00:00:00','2001-02-05 01:01:01');
-insert into t1 values('2001-03-10','2001-03-09 01:01:01','2001-03-10 01:01:01');
-insert into t1 values('2001-04-15','2001-04-15 00:00:00','2001-04-15 00:00:00');
-insert into t1 values('2001-05-20','2001-05-20 01:01:01','2001-05-20 01:01:01');
-select f2 from t1 where f2 between '2001-2-5' and '01-04-14';
-select f1, f2, f3 from t1 where f1 between f2 and f3;
-select f1, f2, f3 from t1 where cast(f1 as datetime) between f2 and
- cast(f3 as date);
-select f2 from t1 where '2001-04-10 12:34:56' between f2 and '01-05-01';
-select f2, f3 from t1 where '01-03-10' between f2 and f3;
-select f2 from t1 where DATE(f2) between "2001-4-15" AND "01-4-15";
-SELECT 1 from dual where NOW() BETWEEN CURRENT_DATE() - INTERVAL 1 DAY AND CURRENT_DATE();
-drop table t1;
-
-#
-# Bug#28133: Wrong DATE/DATETIME comparison in IN() function.
-#
-create table t1 (f1 date);
-insert into t1 values('01-01-01'),('01-01-02'),('01-01-03');
-select * from t1 where f1 in ('01-01-01','2001-01-02','2001-01-03 00:00:00');
-create table t2(f2 datetime);
-insert into t2 values('01-01-01 00:00:00'),('01-02-03 12:34:56'),('02-04-06 11:22:33');
-select * from t2 where f2 in ('01-01-01','01-02-03 12:34:56','01-02-03');
-select * from t1,t2 where '01-01-02' in (f1, cast(f2 as date));
-select * from t1,t2 where '01-01-01' in (f1, '01-02-03');
-select * from t1,t2 where if(1,'01-02-03 12:34:56','') in (f1, f2);
-create table t3(f3 varchar(20));
-insert into t3 select * from t2;
-select * from t2,t3 where f2 in (f3,'03-04-05');
-select f1,f2,f3 from t1,t2,t3 where (f1,'1') in ((f2,'1'),(f3,'1'));
-select f1 from t1 where ('1',f1) in (('1','01-01-01'),('1','2001-1-1 0:0:0'),('1','02-02-02'));
-drop table t1,t2,t3;
-
-#
-# Bug#27759: Wrong DATE/DATETIME comparison in LEAST()/GREATEST() functions.
-#
-select least(cast('01-01-01' as date), '01-01-02');
-select greatest(cast('01-01-01' as date), '01-01-02');
-select least(cast('01-01-01' as date), '01-01-02') + 0;
-select greatest(cast('01-01-01' as date), '01-01-02') + 0;
-select least(cast('01-01-01' as datetime), '01-01-02') + 0;
-select cast(least(cast('01-01-01' as datetime), '01-01-02') as signed);
-select cast(least(cast('01-01-01' as datetime), '01-01-02') as decimal(16,2));
---disable_warnings
-DROP PROCEDURE IF EXISTS test27759 ;
---enable_warnings
-DELIMITER |;
-CREATE PROCEDURE test27759()
-BEGIN
-declare v_a date default '2007-4-10';
-declare v_b date default '2007-4-11';
-declare v_c datetime default '2004-4-9 0:0:0';
-select v_a as a,v_b as b,
- least( v_a, v_b ) as a_then_b,
- least( v_b, v_a ) as b_then_a,
- least( v_c, v_a ) as c_then_a;
-END;|
-DELIMITER ;|
-call test27759();
-drop procedure test27759;
-
-#
-# Bug#28208: Wrong result of a non-const STRING function with a const
-# DATETIME function.
-#
-create table t1 (f1 date);
-insert into t1 values (curdate());
-select left(f1,10) = curdate() from t1;
-drop table t1;
-
-#
-# Bug#28261: Wrong DATETIME comparison result when the GET_USER_VAR function
-# is involved.
-#
-create table t1(f1 date);
-insert into t1 values('01-01-01'),('02-02-02'),('01-01-01'),('02-02-02');
-set @bug28261='';
-select if(@bug28261 = f1, '', @bug28261:= f1) from t1;
-select if(@bug28261 = f1, '', @bug28261:= f1) from t1;
-select if(@bug28261 = f1, '', @bug28261:= f1) from t1;
-drop table t1;
-
-#
-# Bug#28778: Wrong result of BETWEEN when comparing a DATETIME field with an
-# integer constants.
-#
-create table t1(f1 datetime);
-insert into t1 values('2001-01-01'),('2002-02-02');
-select * from t1 where f1 between 20020101 and 20070101000000;
-select * from t1 where f1 between 2002010 and 20070101000000;
-select * from t1 where f1 between 20020101 and 2007010100000;
-drop table t1;
-
---echo #
---echo # Bug#27216: functions with parameters of different date types may
---echo # return wrong type of the result.
---echo #
-create table t1 (f1 date, f2 datetime, f3 varchar(20));
-create table t2 as select coalesce(f1,f1) as f4 from t1;
-desc t2;
-create table t3 as select coalesce(f1,f2) as f4 from t1;
-desc t3;
-create table t4 as select coalesce(f2,f2) as f4 from t1;
-desc t4;
-create table t5 as select coalesce(f1,f3) as f4 from t1;
-desc t5;
-create table t6 as select coalesce(f2,f3) as f4 from t1;
-desc t6;
-create table t7 as select coalesce(makedate(1997,1),f2) as f4 from t1;
-desc t7;
-create table t8 as select coalesce(cast('01-01-01' as datetime),f2) as f4
- from t1;
-desc t8;
-create table t9 as select case when 1 then cast('01-01-01' as date)
- when 0 then cast('01-01-01' as date) end as f4 from t1;
-desc t9;
-create table t10 as select case when 1 then cast('01-01-01' as datetime)
- when 0 then cast('01-01-01' as datetime) end as f4 from t1;
-desc t10;
-create table t11 as select if(1, cast('01-01-01' as datetime),
- cast('01-01-01' as date)) as f4 from t1;
-desc t11;
-create table t12 as select least(cast('01-01-01' as datetime),
- cast('01-01-01' as date)) as f4 from t1;
-desc t12;
-create table t13 as select ifnull(cast('01-01-01' as datetime),
- cast('01-01-01' as date)) as f4 from t1;
-desc t13;
-drop tables t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13;
---echo ###################################################################
-#
-# Bug #31253: crash comparing datetime to double
-# Should return 1st row only. Crashes if NULL propagation fails.
-#
-create table t1 (f1 time);
-insert into t1 set f1 = '45:44:44';
-insert into t1 set f1 = '15:44:44';
-select * from t1 where (convert(f1,datetime)) != 1;
-drop table t1;
-
-#
-# Bug #31249: problem with convert(..., datetime)
-#
-create table t1 (a tinyint);
-insert into t1 values (), (), ();
-select sum(a) from t1 group by convert(a, datetime);
-drop table t1;
-
-#
-# Bug #32694: NOT NULL table field in a subquery produces invalid results
-#
-create table t1 (id int(10) not null, cur_date datetime not null);
-create table t2 (id int(10) not null, cur_date date not null);
-insert into t1 (id, cur_date) values (1, '2007-04-25 18:30:22');
-insert into t2 (id, cur_date) values (1, '2007-04-25');
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='semijoin_with_cache=off';
-
-explain extended
-select * from t1
-where id in (select id from t1 as x1 where (t1.cur_date is null));
-select * from t1
-where id in (select id from t1 as x1 where (t1.cur_date is null));
-
-explain extended
-select * from t2
-where id in (select id from t2 as x1 where (t2.cur_date is null));
-select * from t2
-where id in (select id from t2 as x1 where (t2.cur_date is null));
-
-insert into t1 (id, cur_date) values (2, '2007-04-26 18:30:22');
-insert into t2 (id, cur_date) values (2, '2007-04-26');
-
-explain extended
-select * from t1
-where id in (select id from t1 as x1 where (t1.cur_date is null));
-select * from t1
-where id in (select id from t1 as x1 where (t1.cur_date is null));
-
-explain extended
-select * from t2
-where id in (select id from t2 as x1 where (t2.cur_date is null));
-select * from t2
-where id in (select id from t2 as x1 where (t2.cur_date is null));
-
-SET optimizer_switch=@save_optimizer_switch;
-
-drop table t1,t2;
-
-
-#
-# Bug #37526: asymertic operator <=> in trigger
-#
-SELECT
- CAST('NULL' AS DATE) <=> CAST('2008-01-01' AS DATE) n1,
- CAST('2008-01-01' AS DATE) <=> CAST('NULL' AS DATE) n2,
- CAST('NULL' AS DATE) <=> CAST('NULL' AS DATE) n3,
- CAST('NULL' AS DATE) <> CAST('2008-01-01' AS DATE) n4,
- CAST('2008-01-01' AS DATE) <> CAST('NULL' AS DATE) n5,
- CAST('NULL' AS DATE) <> CAST('NULL' AS DATE) n6,
- CAST('NULL' AS DATE) < CAST('2008-01-01' AS DATE) n7,
- CAST('2008-01-01' AS DATE) < CAST('NULL' AS DATE) n8,
- CAST('NULL' AS DATE) < CAST('NULL' AS DATE) n9;
-
-
---echo End of 5.0 tests
-#
-# Test of storing datetime into date fields
-#
-
-set @org_mode=@@sql_mode;
-create table t1 (da date default '1962-03-03 23:33:34', dt datetime default '1962-03-03');
-show create table t1;
-insert into t1 values ();
-insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38');
-set @@sql_mode='ansi,traditional';
-insert into t1 values ('2007-03-23 13:49:38','2007-03-23 13:49:38');
-insert into t1 set dt='2007-03-23 13:49:38',da=dt;
-# Test error handling
---error 1292
-insert into t1 values ('2007-03-32','2007-03-23 13:49:38');
-select * from t1;
-drop table t1;
---error 1067
-create table t1 (da date default '1962-03-32 23:33:34', dt datetime default '1962-03-03');
---error 1067
-create table t1 (t time default '916:00:00 a');
-set @@sql_mode= @org_mode;
-
-#
-# Bug #42146 - DATETIME fractional seconds parse error
-#
-# show we trucate microseconds from the right -- special case: leftmost is 0
-SELECT CAST(CAST('2006-08-10 10:11:12.0123450' AS DATETIME(6)) AS DECIMAL(30,7));
-
-# show that we ignore leading zeroes for all other fields
-SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.0123450' AS DATETIME(6)) AS DECIMAL(30,7));
-# once more with feeling (but no warnings)
-SELECT CAST(CAST('00000002006-000008-0000010 000010:0000011:00000012.012345' AS DATETIME(6)) AS DECIMAL(30,7));
-
-#
-# Bug #38435 - LONG Microseconds cause MySQL to fail a CAST to DATETIME or DATE
-#
-# show we truncate microseconds from the right
-SELECT CAST(CAST('2008-07-29T10:42:51.1234567' AS DateTime(6)) AS DECIMAL(30,7));
-
---echo #
---echo # Bug#59173: Failure to handle DATE(TIME) values where Year, Month or
---echo # Day is ZERO
---echo #
-CREATE TABLE t1 (dt1 DATETIME);
-INSERT INTO t1 (dt1) VALUES ('0000-00-01 00:00:01');
-DELETE FROM t1 WHERE dt1 = '0000-00-01 00:00:01';
---echo # Should be empty
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo End of 5.1 tests
-
-#
-# MDEV-4281 Assertion `maybe_null && item->null_value' fails in make_sortkey on CASE with different return types, GROUP_CONCAT, GROUP BY
-#
-SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30');
-create table t1 (d date, t time) engine=myisam;
-insert into t1 values ('2000-12-03','22:55:23'),('2008-05-03','10:19:31');
-select case when d = '2012-12-12' then d else t end as cond, group_concat( d ) from t1 group by cond;
-drop table t1;
-SET timestamp=DEFAULT;
-
---echo #
---echo # Semantics of the condition <non-nullable datetime field> IS NULL
---echo # when the field belongs to an inner table of an outer join
---echo #
-
-create table t1 (a int, b date not null);
-insert t1 values (1, 0), (2, '1999-01-02');
-create table t2 (c int);
-insert t2 values (1),(3);
-
-select * from t2 left join t1 on t1.a=t2.c where t1.a is null;
-select * from t2 left join t1 on t1.a=t2.c where t1.b is null;
-
-drop table t1,t2;
-
---echo #
---echo # MDEV-4634 Crash in CONVERT_TZ
---echo #
-SELECT CONVERT_TZ(GREATEST(TIMESTAMP('2021-00-00'),TIMESTAMP('2022-00-00')),'+00:00','+7:5');
-
-
---echo #
---echo # MDEV-5041 Inserting a TIME with hour>24 into a DATETIME column produces a wrong value
---echo #
-SET @@timestamp=UNIX_TIMESTAMP('2013-08-19 20:30:00');
-SELECT CAST(TIME('-800:20:30') AS DATETIME);
-SELECT CAST(TIME('800:20:30') AS DATETIME);
-SELECT CAST(TIME('33 08:20:30') AS DATETIME);
-CREATE TABLE t1 (a DATETIME);
-INSERT INTO t1 VALUES (TIME('800:20:30'));
-INSERT INTO t1 VALUES (TIME('33 08:20:30'));
-SET SQL_MODE=NO_ZERO_IN_DATE;
-INSERT INTO t1 VALUES (TIME('48:20:30'));
-SET SQL_MODE=DEFAULT;
-SELECT * FROM t1;
-DROP TABLE t1;
-DELIMITER |;
-CREATE PROCEDURE test5041()
-BEGIN
- DECLARE t TIME;
- DECLARE dt DATETIME;
- SET t= TIME('800:20:30');
- SET dt= t;
- SELECT dt;
-END;|
-DELIMITER ;|
-call test5041();
-drop procedure test5041;
-SET @@timestamp=DEFAULT;
-
---echo #
---echo # MDEV-6097 Inconsistent results for CAST(int,decimal,double AS DATETIME)
---echo #
-SELECT
- CAST(010203101112 AS DATETIME(1)) AS c1,
- CAST(010203101112.2 AS DATETIME(1)) AS c2,
- CAST(010203101112.2+0e0 AS DATETIME(1)) AS c3;
-
---echo End of 5.3 tests
-
---echo #
---echo # Start of 5.5 tests
---echo #
-
---echo #
---echo # Bug#52849 datetime index not work
---echo #
-CREATE TABLE t1 (Id INT, AtTime DATETIME, KEY AtTime (AtTime));
-SET NAMES CP850;
-INSERT INTO t1 VALUES (1,'2010-04-12 22:30:12'), (2,'2010-04-12 22:30:12'), (3,'2010-04-12 22:30:12');
-EXPLAIN EXTENDED SELECT * FROM t1 FORCE INDEX(attime) WHERE AtTime = '2010-02-22 18:40:07';
-DROP TABLE t1;
-SET NAMES latin1;
-
---echo #
---echo # Bug#56271: Wrong comparison result with STR_TO_DATE function
---echo #
-CREATE TABLE t1 (
- `year` int(4) NOT NULL,
- `month` int(2) NOT NULL
-);
-
-INSERT INTO t1 VALUES (2010,3),(2010,4),(2009,8),(2008,9);
-
-SELECT *
-FROM t1
-WHERE STR_TO_DATE(CONCAT_WS('/01/',`month`,`year`), '%m/%d/%Y') >=
-STR_TO_DATE('1/1/2010', '%m/%d/%Y');
-
-create table t2(f1 datetime primary key);
-insert into t2 select STR_TO_DATE(CONCAT_WS('/01/',`month`,`year`), '%m/%d/%Y') from t1;
-select * from t2 where f1=STR_TO_DATE('4/1/2010', '%m/%d/%Y');
---echo t2 should be const
-explain select * from t2 where f1=STR_TO_DATE('4/1/2010', '%m/%d/%Y');
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug#57095: Wrongly chosen expression cache type led to a wrong
---echo # result.
---echo #
-CREATE TABLE t1 (`b` datetime );
-INSERT INTO t1 VALUES ('2010-01-01 00:00:00'), ('2010-01-01 00:00:00');
-SELECT * FROM t1 WHERE b <= coalesce(NULL, now());
-DROP TABLE t1;
---echo #
-
---echo #
---echo # BUG#12561818: RERUN OF STORED FUNCTION GIVES ERROR 1172:
---echo # RESULT CONSISTED OF MORE THAN ONE ROW
---echo #
-
-CREATE TABLE t1 (a DATE NOT NULL, b INT);
-INSERT INTO t1 VALUES ('0000-00-00',1), ('1999-05-10',2);
-
-CREATE TABLE t2 (a DATETIME NOT NULL, b INT);
-INSERT INTO t2 VALUES ('0000-00-00 00:00:00',1), ('1999-05-10 00:00:00',2);
-
---echo
-SELECT * FROM t1 WHERE a IS NULL;
-SELECT * FROM t2 WHERE a IS NULL;
-SELECT * FROM t1 LEFT JOIN t1 AS t1_2 ON 1 WHERE t1_2.a IS NULL;
-SELECT * FROM t2 LEFT JOIN t2 AS t2_2 ON 1 WHERE t2_2.a IS NULL;
-SELECT * FROM t1 JOIN t1 AS t1_2 ON 1 WHERE t1_2.a IS NULL;
-SELECT * FROM t2 JOIN t2 AS t2_2 ON 1 WHERE t2_2.a IS NULL;
-
---echo
-PREPARE stmt1 FROM
- 'SELECT *
- FROM t1 LEFT JOIN t1 AS t1_2 ON 1
- WHERE t1_2.a IS NULL AND t1_2.b < 2';
-EXECUTE stmt1;
-EXECUTE stmt1;
-
-DEALLOCATE PREPARE stmt1;
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-9374 having '2015-01-01 01:00:00.000001' > coalesce(NULL) returns true
---echo #
-CREATE TABLE t1 (c1 DATETIME(0));
-INSERT INTO t1 VALUES (NULL);
-SELECT * FROM t1 HAVING '2015-01-01 01:00:00.000001' > COALESCE(c1);
-DROP TABLE t1;
-
---echo #
---echo # End of 5.5 tests
---echo #
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
-let type=DATETIME;
-let defval='0000-00-00 00:00:00';
---source include/type_temporal_zero_default.inc
-
---echo #
---echo # MDEV-8336 The meaning of NO_ZERO_DATE is not clear for DATETIME
---echo #
-SET sql_mode='NO_ZERO_DATE';
-SELECT TIMESTAMP'0000-00-01 10:20:30';
-SELECT TIMESTAMP'0000-00-00 10:20:30';
-SELECT TIMESTAMP'0000-00-00 00:00:00.000001';
-CREATE TABLE t1 (a DATETIME);
-INSERT INTO t1 VALUES ('0000-00-00 10:20:30');
-SELECT a, LEAST(a,'2001-01-01 10:20:30') FROM t1;
-DROP TABLE t1;
-CREATE TABLE t1 (a DATETIME(6));
-INSERT INTO t1 VALUES ('0000-00-00 00:00:00.000001');
-SELECT a, LEAST(a,'2001-01-01 10:20:30') FROM t1;
-DROP TABLE t1;
-SELECT STR_TO_DATE('0000-00-00 10:20:30','%Y-%m-%d %h:%i:%s');
-SELECT STR_TO_DATE('0000-00-00 00:00:00.000001','%Y-%m-%d %H:%i:%s.%f');
-SET old_mode=zero_date_time_cast;
-SELECT CAST(TIME'10:20:30' AS DATETIME);
-SELECT CAST(TIME'00:00:00.000001' AS DATETIME(6));
-SELECT CAST(CAST('10:20:30' AS TIME) AS DATETIME);
-SELECT CAST(CAST('00:00:00.000001' AS TIME(6)) AS DATETIME(6));
-SELECT CAST(CAST(TIMESTAMP'0000-00-00 10:20:30' AS TIME) AS DATETIME);
-SELECT CAST(CAST(TIMESTAMP'0000-00-00 00:00:00.000001' AS TIME(6)) AS DATETIME(6));
-SET old_mode=DEFAULT;
-SET sql_mode=DEFAULT;
-
---echo #
---echo # MDEV-8699 Wrong result for SELECT..WHERE HEX(date_column)!='323030312D30312D3031' AND date_column='2001-01-01x'
---echo #
---let $TYPE= DATETIME
---source include/equal_fields_propagation_datetime.inc
-
---echo #
---echo # MDEV-8795 Equal expression propagation does not work for temporal literals
---echo #
-CREATE TABLE t1 (a DATETIME);
-INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-02 00:00:00');
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=TIMESTAMP'2001-01-01 00:00:00' AND COALESCE(a)>=TIMESTAMP'2001-01-01 00:00:00';
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8875 Wrong metadata for MAX(CAST(time_column AS DATETIME))
---echo #
-SET timestamp=UNIX_TIMESTAMP('2015-01-01 00:00:00');
-CREATE TABLE t1 (a TIME);
-INSERT INTO t1 VALUES ('00:00:00'),('00:01:00');
---disable_ps_protocol
---enable_metadata
-SELECT MAX(CAST(a AS DATETIME)) FROM t1;
---disable_metadata
---enable_ps_protocol
-CREATE TABLE t2 AS SELECT MAX(CAST(a AS DATETIME)) FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-DROP TABLE t1;
-SET timestamp=DEFAULT;
-
---echo #
---echo # MDEV-8860 Wrong result for WHERE 2016 < SOME (SELECT CAST(time_column AS DATETIME) FROM t1)
---echo #
-SET timestamp=UNIX_TIMESTAMP('2015-01-01 00:00:00');
-CREATE TABLE t1 (a TIME);
-INSERT INTO t1 VALUES ('00:00:00'),('00:01:00');
-SELECT 1 FROM t1 WHERE 2016 > SOME (SELECT CAST(a AS DATETIME) FROM t1);
-SELECT * FROM t1 WHERE 2016 > CAST(a AS DATETIME);
-SELECT 1 FROM t1 WHERE 20160101 > SOME (SELECT CAST(a AS DATETIME) FROM t1);
-SELECT * FROM t1 WHERE 20160101 > CAST(a AS DATETIME);
-DROP TABLE t1;
-
---echo #
---echo # End of 10.1 tests
---echo #
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-9337 ALTER from DECIMAL and INT to DATETIME returns a wrong result
---echo #
-CREATE TABLE t1 (a DATETIME);
-INSERT INTO t1 VALUES (1000);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DATETIME);
-CREATE TABLE t2 (a INT);
-INSERT INTO t2 VALUES (1000);
-INSERT INTO t1 SELECT * FROM t2;
-SELECT * FROM t1;
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1000);
-ALTER TABLE t1 MODIFY a DATETIME;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DATETIME);
-INSERT INTO t1 VALUES (1000.0);
-SELECT * FROM t1;
-DROP TABLE IF EXISTS t1;
-
-CREATE TABLE t1 (a DATETIME);
-CREATE TABLE t2 (a DECIMAL(4,0));
-INSERT INTO t2 VALUES (1000);
-INSERT INTO t1 SELECT * FROM t2;
-SELECT * FROM t1;
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (a DECIMAL(4,0));
-INSERT INTO t1 VALUES (1000);
-ALTER TABLE t1 MODIFY a DATETIME;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # End of 10.2 tests
---echo #
-
---echo #
---echo # Start of 10.3 tests
---echo #
-
---echo #
---echo # MDEV-11331 Wrong result for INSERT INTO t1 (datetime_field) VALUES (hybrid_function_of_TIME_data_type)
---echo #
-SET timestamp=UNIX_TIMESTAMP('2001-02-03 10:00:00');
-CREATE TABLE t1 (a DATETIME);
-INSERT INTO t1 VALUES (TIME'10:20:30');
-INSERT INTO t1 VALUES (COALESCE(TIME'10:20:30'));
-INSERT INTO t1 VALUES (LEAST(TIME'10:20:30',TIME'10:20:30'));
-SELECT * FROM t1;
-DROP TABLE t1;
-SET timestamp=DEFAULT;
-
---echo #
---echo # MDEV-15310 Range optimizer does not work well for "WHERE temporal_column NOT IN (const_list)"
---echo #
-
---echo #
---echo # DATETIME(0)
---echo #
-
-CREATE TABLE t1 (a DATETIME, filler CHAR(200), KEY(a));
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:02', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:03', 'yes');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:04', 'yes');
-EXPLAIN SELECT * FROM t1 WHERE a NOT IN ('2001-01-01 23:00:01','2001-01-01 23:00:02');
-SELECT * FROM t1 WHERE a NOT IN ('2001-01-01 23:00:01','2001-01-01 23:00:02');
-DROP TABLE t1;
-
-
---echo #
---echo # DATETIME(1)
---echo #
-
-CREATE TABLE t1 (a DATETIME(1), filler CHAR(200), KEY(a));
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:02.1', 'no');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:03.1', 'yes');
-INSERT INTO t1 VALUES ('2001-01-01 23:00:04.1', 'yes');
-EXPLAIN SELECT * FROM t1 WHERE a NOT IN ('2001-01-01 23:00:01.1','2001-01-01 23:00:02.1');
-SELECT * FROM t1 WHERE a NOT IN ('2001-01-01 23:00:01.1','2001-01-01 23:00:02.1');
-DROP TABLE t1;
-
-
---echo #
---echo # End of 10.3 tests
---echo #
diff --git a/mysql-test/t/type_datetime_hires.test b/mysql-test/t/type_datetime_hires.test
deleted file mode 100644
index d220a4601eb..00000000000
--- a/mysql-test/t/type_datetime_hires.test
+++ /dev/null
@@ -1,81 +0,0 @@
-
---source include/have_partition.inc
-
-let type=datetime;
---source include/type_hrtime.inc
-
-#
-# partitioning
-#
-eval CREATE TABLE t1 (
- taken $type(5) NOT NULL DEFAULT '0000-00-00 00:00:00',
- id int(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (id,taken),
- KEY taken (taken)
-)
-PARTITION BY RANGE (to_days(taken))
-(
-PARTITION p01 VALUES LESS THAN (732920),
-PARTITION p02 VALUES LESS THAN (732950),
-PARTITION p03 VALUES LESS THAN MAXVALUE);
-
-INSERT INTO t1 VALUES
-('2006-09-27 21:50:01.123456',0),
-('2006-09-27 21:50:01.123456',1),
-('2006-09-27 21:50:01.123456',2),
-('2006-09-28 21:50:01.123456',3),
-('2006-09-29 21:50:01.123456',4),
-('2006-09-29 21:50:01.123456',5),
-('2006-09-30 21:50:01.123456',6),
-('2006-10-01 21:50:01.123456',7),
-('2006-10-02 21:50:01.123456',8),
-('2006-10-02 21:50:01.123456',9);
-
-SELECT id,to_days(taken) FROM t1 order by 2;
-
-eval CREATE TABLE t2 (
- taken $type(5) NOT NULL DEFAULT '0000-00-00 00:00:00',
- id int(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (id,taken),
- KEY taken (taken)
-)
-PARTITION BY RANGE (extract(microsecond from taken))
-(
-PARTITION p01 VALUES LESS THAN (123000),
-PARTITION p02 VALUES LESS THAN (500000),
-PARTITION p03 VALUES LESS THAN MAXVALUE);
-
-INSERT INTO t2 VALUES
-('2006-09-27 21:50:01',0),
-('2006-09-27 21:50:01.1',1),
-('2006-09-27 21:50:01.12',2),
-('2006-09-28 21:50:01.123',3),
-('2006-09-29 21:50:01.1234',4),
-('2006-09-29 21:50:01.12345',5),
-('2006-09-30 21:50:01.123456',6),
-('2006-10-01 21:50:01.56',7),
-('2006-10-02 21:50:01.567',8),
-('2006-10-02 21:50:01.5678',9);
-
---sorted_result
-select table_name,partition_name,partition_method,partition_expression,partition_description,table_rows from information_schema.partitions where table_name in ('t1', 't2');
-
-drop table t1, t2;
-
-create table t1 (a datetime, b datetime(6));
-insert t1 values ('2010-01-02 03:04:05.678912', '2010-01-02 03:04:05.678912');
-update t1 set b=a;
-select * from t1;
-alter table t1 modify b datetime, modify a datetime(6);
-select * from t1;
-drop table t1;
-
---echo #
---echo # MDEV-4651 Crash in my_decimal2decimal in a ORDER BY query
---echo #
-SET @@time_zone='+00:00';
-CREATE TABLE t1 (a DATETIME(4) NOT NULL);
-INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2000-00-00 00:00:00');
-SELECT UNIX_TIMESTAMP(a) FROM t1 ORDER BY 1;
-DROP TABLE t1;
-SET @@time_zone=DEFAULT;
diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test
deleted file mode 100644
index 903f375d1ae..00000000000
--- a/mysql-test/t/type_decimal.test
+++ /dev/null
@@ -1,675 +0,0 @@
-# bug in decimal() with negative numbers by kaido@tradenet.ee
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-SET SQL_WARNINGS=1;
-
-CREATE TABLE t1 (
- id int(11) NOT NULL auto_increment,
- datatype_id int(11) DEFAULT '0' NOT NULL,
- min_value decimal(20,10) DEFAULT '0.0000000000' NOT NULL,
- max_value decimal(20,10) DEFAULT '0.0000000000' NOT NULL,
- valuename varchar(20),
- forecolor int(11),
- backcolor int(11),
- PRIMARY KEY (id),
- UNIQUE datatype_id (datatype_id, min_value, max_value)
-);
-INSERT INTO t1 VALUES ( '1', '4', '0.0000000000', '0.0000000000', 'Ei saja', '0', '16776960');
-INSERT INTO t1 VALUES ( '2', '4', '1.0000000000', '1.0000000000', 'Sajab', '16777215', '255');
-INSERT INTO t1 VALUES ( '3', '1', '2.0000000000', '49.0000000000', '', '0', '16777215');
-INSERT INTO t1 VALUES ( '60', '11', '0.0000000000', '0.0000000000', 'Rikkis', '16777215', '16711680');
-INSERT INTO t1 VALUES ( '4', '12', '1.0000000000', '1.0000000000', 'nork sadu', '65280', '14474460');
-INSERT INTO t1 VALUES ( '5', '12', '2.0000000000', '2.0000000000', 'keskmine sadu', '255', '14474460');
-INSERT INTO t1 VALUES ( '6', '12', '3.0000000000', '3.0000000000', 'tugev sadu', '127', '14474460');
-INSERT INTO t1 VALUES ( '43', '39', '6.0000000000', '6.0000000000', 'lobjakas', '13107327', '16763080');
-INSERT INTO t1 VALUES ( '40', '39', '2.0000000000', '2.0000000000', 'vihm', '8355839', '16777215');
-INSERT INTO t1 VALUES ( '53', '1', '-35.0000000000', '-5.0000000000', '', '0', '16777215');
-INSERT INTO t1 VALUES ( '41', '39', '3.0000000000', '3.0000000000', 'klm vihm', '120', '16763080');
-INSERT INTO t1 VALUES ( '12', '21', '21.0000000000', '21.0000000000', 'Kuiv', '13158600', '16777215');
-INSERT INTO t1 VALUES ( '13', '21', '13.0000000000', '13.0000000000', 'Mrg', '5263615', '16777215');
-INSERT INTO t1 VALUES ( '14', '21', '22.0000000000', '22.0000000000', 'Niiske', '9869055', '16777215');
-INSERT INTO t1 VALUES ( '19', '21', '33.0000000000', '33.0000000000', 'Mrg', '5263615', '16777215');
-INSERT INTO t1 VALUES ( '15', '21', '23.0000000000', '23.0000000000', 'Mrg', '5263615', '16777215');
-INSERT INTO t1 VALUES ( '16', '21', '31.0000000000', '31.0000000000', 'Kuiv', '13158600', '16777215');
-INSERT INTO t1 VALUES ( '17', '21', '12.0000000000', '12.0000000000', 'Niiske', '9869055', '16777215');
-INSERT INTO t1 VALUES ( '18', '21', '32.0000000000', '32.0000000000', 'Niiske', '9869055', '16777215');
-INSERT INTO t1 VALUES ( '20', '21', '331.0000000000', '331.0000000000', 'Hrmatise hoiatus!', '14448840', '13158600');
-INSERT INTO t1 VALUES ( '21', '21', '11.0000000000', '11.0000000000', 'Kuiv', '13158600', '16777215');
-INSERT INTO t1 VALUES ( '22', '33', '21.0000000000', '21.0000000000', 'Pilves, kuiv', '8355711', '12632256');
-INSERT INTO t1 VALUES ( '23', '33', '13.0000000000', '13.0000000000', 'Sajab, mrg', '0', '8355839');
-INSERT INTO t1 VALUES ( '24', '33', '22.0000000000', '22.0000000000', 'Pilves, niiske', '8355711', '12632319');
-INSERT INTO t1 VALUES ( '29', '33', '33.0000000000', '33.0000000000', 'Selge, mrg', '16777215', '8355839');
-INSERT INTO t1 VALUES ( '25', '33', '23.0000000000', '23.0000000000', 'Pilves, mrg', '8355711', '8355839');
-INSERT INTO t1 VALUES ( '26', '33', '31.0000000000', '31.0000000000', 'Selge, kuiv', '16777215', '12632256');
-INSERT INTO t1 VALUES ( '27', '33', '12.0000000000', '12.0000000000', 'Sajab, niiske', '0', '12632319');
-INSERT INTO t1 VALUES ( '28', '33', '32.0000000000', '32.0000000000', 'Selge, niiske', '16777215', '12632319');
-INSERT INTO t1 VALUES ( '30', '33', '331.0000000000', '331.0000000000', 'Hrmatis! selge,kuiv', '16711680', '12632256');
-INSERT INTO t1 VALUES ( '31', '33', '11.0000000000', '11.0000000000', 'Sajab, kuiv', '0', '12632256');
-INSERT INTO t1 VALUES ( '32', '11', '1.0000000000', '1.0000000000', 'Korras', '16777215', '49152');
-INSERT INTO t1 VALUES ( '33', '21', '335.0000000000', '335.0000000000', 'Hrmatis!', '14448840', '11842740');
-INSERT INTO t1 VALUES ( '34', '21', '134.0000000000', '134.0000000000', 'Hoiatus, M+S!', '255', '13158600');
-INSERT INTO t1 VALUES ( '35', '21', '133.0000000000', '133.0000000000', 'Hoiatus, mrg!', '5263615', '13158600');
-INSERT INTO t1 VALUES ( '36', '21', '135.0000000000', '135.0000000000', 'Hrmatis!', '14448840', '11842740');
-INSERT INTO t1 VALUES ( '37', '21', '334.0000000000', '334.0000000000', 'Hrmatise hoiatus!', '14448840', '13158600');
-INSERT INTO t1 VALUES ( '38', '21', '132.0000000000', '132.0000000000', 'Hoiatus, niiske!', '9869055', '13158600');
-INSERT INTO t1 VALUES ( '39', '39', '1.0000000000', '1.0000000000', 'ei saja', '11206570', '16777215');
-INSERT INTO t1 VALUES ( '44', '39', '4.0000000000', '5.0000000000', 'lumi', '16711680', '16763080');
-INSERT INTO t1 VALUES ( '45', '12', '0.0000000000', '0.0000000000', '', '16777215', '14474460');
-INSERT INTO t1 VALUES ( '46', '39', '8.0000000000', '8.0000000000', 'rahe', '9830400', '16763080');
-INSERT INTO t1 VALUES ( '47', '39', '9.0000000000', '9.0000000000', 'tp ebaselge', '12582912', '16777215');
-INSERT INTO t1 VALUES ( '48', '39', '7.0000000000', '7.0000000000', 'lumetuisk', '7209070', '16763080');
-INSERT INTO t1 VALUES ( '142', '15', '2.0000000000', '49.0000000000', '', '0', '16777215');
-INSERT INTO t1 VALUES ( '52', '1', '-4.9000000000', '-0.1000000000', '', '0', '15774720');
-INSERT INTO t1 VALUES ( '141', '15', '-4.9000000000', '-0.1000000000', '', '0', '15774720');
-INSERT INTO t1 VALUES ( '55', '8', '0.0000000000', '0.0000000000', '', '0', '16777215');
-INSERT INTO t1 VALUES ( '56', '8', '0.0100000000', '0.1000000000', '', '0', '16770560');
-INSERT INTO t1 VALUES ( '57', '8', '0.1100000000', '25.0000000000', '', '0', '15774720');
-INSERT INTO t1 VALUES ( '58', '2', '90.0000000000', '94.9000000000', '', NULL, '16770560');
-INSERT INTO t1 VALUES ( '59', '6', '0.0000000000', '360.0000000000', '', NULL, '16777215');
-INSERT INTO t1 VALUES ( '61', '21', '38.0000000000', '38.0000000000', 'Niiske', '9869055', '16777215');
-INSERT INTO t1 VALUES ( '62', '38', '500.0000000000', '999.0000000000', '', '0', '16770560');
-INSERT INTO t1 VALUES ( '63', '38', '1000.0000000000', '2000.0000000000', '', '0', '16777215');
-INSERT INTO t1 VALUES ( '64', '17', '0.0000000000', '0.0000000000', '', NULL, '16777215');
-INSERT INTO t1 VALUES ( '65', '17', '0.1000000000', '10.0000000000', '', NULL, '16770560');
-INSERT INTO t1 VALUES ( '67', '21', '412.0000000000', '412.0000000000', 'Niiske', '9869055', '16777215');
-INSERT INTO t1 VALUES ( '68', '21', '413.0000000000', '413.0000000000', 'Mrg', '5263615', '16777215');
-INSERT INTO t1 VALUES ( '69', '21', '113.0000000000', '113.0000000000', 'Mrg', '5263615', '16777215');
-INSERT INTO t1 VALUES ( '70', '21', '416.0000000000', '416.0000000000', 'Lumine!', '16711680', '11842740');
-INSERT INTO t1 VALUES ( '71', '38', '0.0000000000', '499.0000000000', '', NULL, '16711680');
-INSERT INTO t1 VALUES ( '72', '22', '-49.0000000000', '49.0000000000', '', NULL, '16777215');
-INSERT INTO t1 VALUES ( '73', '13', '0.0000000000', '9.9000000000', '', NULL, '16777215');
-INSERT INTO t1 VALUES ( '74', '13', '10.0000000000', '14.9000000000', '', NULL, '16770560');
-INSERT INTO t1 VALUES ( '75', '7', '0.0000000000', '50.0000000000', '', NULL, '16777215');
-INSERT INTO t1 VALUES ( '76', '18', '0.0000000000', '0.0000000000', '', NULL, '16777215');
-INSERT INTO t1 VALUES ( '77', '18', '0.1000000000', '10.0000000000', '', NULL, '16770560');
-INSERT INTO t1 VALUES ( '78', '19', '300.0000000000', '400.0000000000', '', NULL, '16777215');
-INSERT INTO t1 VALUES ( '79', '19', '0.0000000000', '299.0000000000', '', NULL, '16770560');
-INSERT INTO t1 VALUES ( '80', '23', '0.0000000000', '100.0000000000', '', NULL, '16777215');
-INSERT INTO t1 VALUES ( '81', '24', '0.0000000000', '200.0000000000', '', NULL, '16777215');
-INSERT INTO t1 VALUES ( '82', '26', '0.0000000000', '0.0000000000', '', NULL, '16777215');
-INSERT INTO t1 VALUES ( '83', '26', '0.1000000000', '5.0000000000', '', NULL, '16776960');
-INSERT INTO t1 VALUES ( '84', '21', '422.0000000000', '422.0000000000', 'Niiske', '9869055', '16777215');
-INSERT INTO t1 VALUES ( '85', '21', '411.0000000000', '411.0000000000', 'Saju hoiat.,kuiv!', '16777215', '13158600');
-INSERT INTO t1 VALUES ( '86', '21', '423.0000000000', '423.0000000000', 'Mrg', '5263615', '16777215');
-INSERT INTO t1 VALUES ( '144', '16', '-49.0000000000', '-5.0000000000', '', NULL, '16777215');
-INSERT INTO t1 VALUES ( '88', '16', '2.0000000000', '49.0000000000', '', NULL, '16777215');
-INSERT INTO t1 VALUES ( '89', '21', '338.0000000000', '338.0000000000', 'Hrm.hoiatus, N+S!', '16744319', '13158600');
-INSERT INTO t1 VALUES ( '90', '21', '332.0000000000', '332.0000000000', 'Hrm.hoiat., niiske!', '16744319', '13158600');
-INSERT INTO t1 VALUES ( '91', '21', '114.0000000000', '114.0000000000', 'Hoiatus, M+S!', '255', '13158600');
-INSERT INTO t1 VALUES ( '92', '21', '117.0000000000', '117.0000000000', 'Hoiatus, J!', '14448840', '16711680');
-INSERT INTO t1 VALUES ( '93', '21', '116.0000000000', '116.0000000000', 'Lumine!', '16711680', '11842740');
-INSERT INTO t1 VALUES ( '94', '21', '414.0000000000', '414.0000000000', 'Hoiatus, M+S!', '255', '13158600');
-INSERT INTO t1 VALUES ( '95', '21', '325.0000000000', '325.0000000000', 'Hrmatis!', '14448840', '11842740');
-INSERT INTO t1 VALUES ( '96', '21', '321.0000000000', '321.0000000000', 'Hrmatise hoiatus!', '14448840', '13158600');
-INSERT INTO t1 VALUES ( '97', '21', '328.0000000000', '328.0000000000', 'Hrm.hoiatus, N+S!', '16744319', '13158600');
-INSERT INTO t1 VALUES ( '98', '21', '28.0000000000', '28.0000000000', 'Niiske ja sool', '9869055', '16777215');
-INSERT INTO t1 VALUES ( '99', '21', '118.0000000000', '118.0000000000', 'Hoiatus, N+S!', '9869055', '13158600');
-INSERT INTO t1 VALUES ( '100', '21', '418.0000000000', '418.0000000000', 'Hoiatus, N+S!', '9869055', '13158600');
-INSERT INTO t1 VALUES ( '101', '21', '322.0000000000', '322.0000000000', 'Hrm.hoiat., niiske!', '16744319', '13158600');
-INSERT INTO t1 VALUES ( '102', '21', '428.0000000000', '428.0000000000', 'Hoiatus, N+S!', '9869055', '13158600');
-INSERT INTO t1 VALUES ( '103', '21', '432.0000000000', '432.0000000000', 'Hoiatus, niiske!', '7895240', '13158600');
-INSERT INTO t1 VALUES ( '104', '21', '421.0000000000', '421.0000000000', 'Saju hoiat.,kuiv!', '16777215', '13158600');
-INSERT INTO t1 VALUES ( '105', '21', '24.0000000000', '24.0000000000', 'Mrg ja sool', '255', '16777215');
-INSERT INTO t1 VALUES ( '106', '21', '438.0000000000', '438.0000000000', 'Hoiatus, N+S!', '9869055', '13158600');
-INSERT INTO t1 VALUES ( '107', '21', '112.0000000000', '112.0000000000', 'Hoiatus, niiske!', '9869055', '13158600');
-INSERT INTO t1 VALUES ( '108', '21', '34.0000000000', '34.0000000000', 'Mrg ja sool', '255', '16777215');
-INSERT INTO t1 VALUES ( '109', '21', '434.0000000000', '434.0000000000', 'Hoiatus, M+S!', '255', '13158600');
-INSERT INTO t1 VALUES ( '110', '21', '124.0000000000', '124.0000000000', 'Hoiatus, M+S!', '255', '13158600');
-INSERT INTO t1 VALUES ( '111', '21', '424.0000000000', '424.0000000000', 'Hoiatus, M+S!', '255', '13158600');
-INSERT INTO t1 VALUES ( '112', '21', '123.0000000000', '123.0000000000', 'Hoiatus, mrg!', '5263615', '13158600');
-INSERT INTO t1 VALUES ( '140', '15', '-49.0000000000', '-5.0000000000', '', '0', '16777215');
-INSERT INTO t1 VALUES ( '114', '21', '18.0000000000', '18.0000000000', 'Niiske ja sool', '9869055', '16777215');
-INSERT INTO t1 VALUES ( '115', '21', '122.0000000000', '122.0000000000', 'Hoiatus, niiske!', '9869055', '13158600');
-INSERT INTO t1 VALUES ( '116', '21', '14.0000000000', '14.0000000000', 'Mrg ja sool', '255', '16777215');
-INSERT INTO t1 VALUES ( '117', '21', '311.0000000000', '311.0000000000', 'Hrmatise hoiatus!', '14448840', '13158600');
-INSERT INTO t1 VALUES ( '121', '2', '95.0000000000', '100.0000000000', '', NULL, '15774720');
-INSERT INTO t1 VALUES ( '118', '2', '0.0000000000', '89.9000000000', '', NULL, '16777215');
-INSERT INTO t1 VALUES ( '119', '21', '16.0000000000', '16.0000000000', 'Lumine!', '16711680', '11842740');
-INSERT INTO t1 VALUES ( '120', '21', '26.0000000000', '26.0000000000', 'Lumine!', '16711680', '11842740');
-INSERT INTO t1 VALUES ( '122', '13', '15.0000000000', '50.0000000000', '', NULL, '15774720');
-INSERT INTO t1 VALUES ( '123', '5', '0.0000000000', '9.9000000000', '', NULL, '16777215');
-INSERT INTO t1 VALUES ( '124', '5', '10.0000000000', '14.9000000000', '', NULL, '16770560');
-INSERT INTO t1 VALUES ( '125', '5', '15.0000000000', '50.0000000000', '', NULL, '15774720');
-INSERT INTO t1 VALUES ( '126', '21', '128.0000000000', '128.0000000000', 'Hoiatus, N+S!', '9869055', '13158600');
-INSERT INTO t1 VALUES ( '127', '21', '318.0000000000', '318.0000000000', 'Hrm.hoiatus, N+S!', '16744319', '13158600');
-INSERT INTO t1 VALUES ( '128', '21', '312.0000000000', '312.0000000000', 'Hrm.hoiat., niiske!', '16744319', '13158600');
-INSERT INTO t1 VALUES ( '129', '21', '126.0000000000', '126.0000000000', 'Lumine!', '16711680', '11842740');
-INSERT INTO t1 VALUES ( '130', '21', '324.0000000000', '324.0000000000', 'Hrmatise hoiatus!', '14448840', '13158600');
-INSERT INTO t1 VALUES ( '131', '21', '316.0000000000', '316.0000000000', 'Lumine!', '16711680', '11842740');
-INSERT INTO t1 VALUES ( '132', '1', '0.0000000000', '1.9000000000', '', NULL, '16769024');
-INSERT INTO t1 VALUES ( '134', '3', '-50.0000000000', '50.0000000000', '', NULL, '16777215');
-INSERT INTO t1 VALUES ( '135', '8', '26.0000000000', '2000.0000000000', '', '9868950', '15774720');
-INSERT INTO t1 VALUES ( '136', '21', '426.0000000000', '426.0000000000', 'Lumine!', '16711680', '11842740');
-INSERT INTO t1 VALUES ( '137', '21', '127.0000000000', '127.0000000000', 'Hoiatus, J!', '14448840', '16711680');
-INSERT INTO t1 VALUES ( '138', '21', '121.0000000000', '121.0000000000', 'Kuiv', '13158600', '16777215');
-INSERT INTO t1 VALUES ( '139', '21', '326.0000000000', '326.0000000000', 'Lumine!', '16711680', '11842740');
-INSERT INTO t1 VALUES ( '143', '16', '-4.9000000000', '-0.1000000000', '', NULL, '15774720');
-INSERT INTO t1 VALUES ( '145', '15', '0.0000000000', '1.9000000000', '', '0', '16769024');
-INSERT INTO t1 VALUES ( '146', '16', '0.0000000000', '1.9000000000', '', '0', '16769024');
-select * from t1 where min_value<=1 and max_value>=-1 and datatype_id=16;
-select * from t1 where min_value<=-1 and max_value>=-1 and datatype_id=16;
-drop table t1;
-
-#
-# Test of correct handling leading zero and +/- signs
-# then values are passed as strings
-# Also test overflow handling in this case
-#
-
-create table t1 (a decimal(10,2));
-insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0");
-insert into t1 values ("-.1"),("+.1"),(".1");
-insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001");
-insert ignore into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
-insert ignore into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11");
-insert ignore into t1 values ("1e+1000"),("1e-1000"),("-1e+1000");
-insert ignore into t1 values ("1e+4294967296"),("1e-4294967296");
-insert ignore into t1 values ("1e+18446744073709551615"),("1e+18446744073709551616"),("1e-9223372036854775807"),("1e-9223372036854775809");
-insert ignore into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
-select * from t1;
-drop table t1;
-
-create table t1 (a decimal(10,2) unsigned);
-insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0");
-insert ignore into t1 values ("-.1"),("+.1"),(".1");
-insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001");
-insert ignore into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
-insert ignore into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11");
-insert ignore into t1 values ("1e+1000"),("1e-1000"),("-1e+1000");
-insert ignore into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
-select * from t1;
-drop table t1;
-
-create table t1 (a decimal(10,2) zerofill);
-insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0");
-insert ignore into t1 values ("-.1"),("+.1"),(".1");
-insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001");
-insert ignore into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
-insert ignore into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11");
-insert ignore into t1 values ("1e+1000"),("1e-1000"),("-1e+1000");
-insert ignore into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
-select * from t1;
-drop table t1;
-
-
-create table t1 (a decimal(10,2));
-# The -0.0 needs to be quoted as not all platforms supports this
-insert into t1 values (0.0),("-0.0"),(+0.0),(01.0),(+01.0),(-01.0);
-insert into t1 values (-.1),(+.1),(.1);
-insert into t1 values (00000000000001),(+0000000000001),(-0000000000001);
-insert ignore into t1 values (+111111111.11),(111111111.11),(-11111111.11);
-insert ignore into t1 values (-111111111.11),(+1111111111.11),(1111111111.11);
-insert ignore into t1 values (1e+100),(1e-100),(-1e+100);
-insert into t1 values (123.4e0),(123.4e+2),(123.4e-2),(123e1),(123e+0);
-insert into t1 values (MID("987",1,2)),("987 "),("987.6e+2 ");
-select * from t1;
-drop table t1;
-
-#
-# Test correct handling of overflowed decimal values
-#
-
-create table t1 (a decimal);
-insert ignore into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+12345678901'),(99999999999999);
-select * from t1;
-drop table t1;
-create table t1 (a decimal unsigned);
-insert ignore into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
-select * from t1;
-drop table t1;
-create table t1 (a decimal zerofill);
-insert ignore into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
-select * from t1;
-drop table t1;
-create table t1 (a decimal unsigned zerofill);
-insert ignore into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
-select * from t1;
-drop table t1;
-
-# Exponent overflow bug
-create table t1(a decimal(10,0));
-insert ignore into t1 values ("1e4294967295");
-select * from t1;
-delete from t1;
-insert ignore into t1 values("1e4294967297");
-select * from t1;
-drop table t1;
-
-#
-# Test of wrong decimal type
-#
-
---error 1064
-CREATE TABLE t1 (a_dec DECIMAL(-1,0));
---error 1064
-CREATE TABLE t1 (a_dec DECIMAL(-2,1));
---error 1064
-CREATE TABLE t1 (a_dec DECIMAL(-1,1));
---error 1427
-CREATE TABLE t1 (a_dec DECIMAL(0,11));
-
-#
-# Zero prepend overflow bug
-#
---disable_warnings
-create table t1(a decimal(7,3));
-insert into t1 values ('1'),('+1'),('-1'),('0000000001'),('+0000000001'),('-0000000001'),('10'),('+10'),('-10'),('0000000010'),('+0000000010'),('-0000000010'),('100'),('+100'),('-100'),('0000000100'),('+0000000100'),('-0000000100'),('1000'),('+1000'),('-1000'),('0000001000'),('+0000001000'),('-0000001000'),('10000'),('+10000'),('-10000'),('0000010000'),('+0000010000'),('-0000010000'),('100000'),('+100000'),('-100000'),('0000100000'),('+0000100000'),('-0000100000'),('1000000'),('+1000000'),('-1000000'),('0001000000'),('+0001000000'),('-0001000000'),('10000000'),('+10000000'),('-10000000'),('0010000000'),('+0010000000'),('-0010000000'),('100000000'),('+100000000'),('-100000000'),('0100000000'),('+0100000000'),('-0100000000'),('1000000000'),('+1000000000'),('-1000000000'),('1000000000'),('+1000000000'),('-1000000000');
-select * from t1;
-drop table t1;
-create table t1(a decimal(7,3) unsigned);
-insert into t1 values ('1'),('+1'),('-1'),('0000000001'),('+0000000001'),('-0000000001'),('10'),('+10'),('-10'),('0000000010'),('+0000000010'),('-0000000010'),('100'),('+100'),('-100'),('0000000100'),('+0000000100'),('-0000000100'),('1000'),('+1000'),('-1000'),('0000001000'),('+0000001000'),('-0000001000'),('10000'),('+10000'),('-10000'),('0000010000'),('+0000010000'),('-0000010000'),('100000'),('+100000'),('-100000'),('0000100000'),('+0000100000'),('-0000100000'),('1000000'),('+1000000'),('-1000000'),('0001000000'),('+0001000000'),('-0001000000'),('10000000'),('+10000000'),('-10000000'),('0010000000'),('+0010000000'),('-0010000000'),('100000000'),('+100000000'),('-100000000'),('0100000000'),('+0100000000'),('-0100000000'),('1000000000'),('+1000000000'),('-1000000000'),('1000000000'),('+1000000000'),('-1000000000');
-select * from t1;
-drop table t1;
-create table t1(a decimal(7,3) zerofill);
-insert into t1 values ('1'),('+1'),('-1'),('0000000001'),('+0000000001'),('-0000000001'),('10'),('+10'),('-10'),('0000000010'),('+0000000010'),('-0000000010'),('100'),('+100'),('-100'),('0000000100'),('+0000000100'),('-0000000100'),('1000'),('+1000'),('-1000'),('0000001000'),('+0000001000'),('-0000001000'),('10000'),('+10000'),('-10000'),('0000010000'),('+0000010000'),('-0000010000'),('100000'),('+100000'),('-100000'),('0000100000'),('+0000100000'),('-0000100000'),('1000000'),('+1000000'),('-1000000'),('0001000000'),('+0001000000'),('-0001000000'),('10000000'),('+10000000'),('-10000000'),('0010000000'),('+0010000000'),('-0010000000'),('100000000'),('+100000000'),('-100000000'),('0100000000'),('+0100000000'),('-0100000000'),('1000000000'),('+1000000000'),('-1000000000'),('1000000000'),('+1000000000'),('-1000000000');
---enable_warnings
-select * from t1;
-drop table t1;
-
-#
-# Bug #7589: a problem with update from column
-#
-
-create table t1(a decimal(10,5), b decimal(10,1));
-insert into t1 values(123.12345, 123.12345);
-update t1 set b=a;
-select * from t1;
-drop table t1;
-
---echo End of 4.1 tests
-
-#
-# Test for BUG#8397: decimal type in subselects (Item_cache_decimal)
-#
-CREATE TABLE t1
-(EMPNUM CHAR(3) NOT NULL,
-HOURS DECIMAL(5));
-CREATE TABLE t2
-(EMPNUM CHAR(3) NOT NULL,
-HOURS BIGINT);
-
-INSERT INTO t1 VALUES ('E1',40);
-INSERT INTO t1 VALUES ('E8',NULL);
-INSERT INTO t2 VALUES ('E1',40);
-
-SELECT EMPNUM FROM t1 WHERE HOURS IN (SELECT HOURS FROM t2);
-SELECT EMPNUM FROM t1 WHERE HOURS IN (SELECT HOURS FROM t1);
-
-DROP TABLE t1,t2;
-
-#
-# Test limits of decimal
-#
-create table t1 (d decimal(64,0));
-insert into t1 values (1);
-select * from t1;
-drop table t1;
-create table t1 (d decimal(5));
-show create table t1;
-drop table t1;
-create table t1 (d decimal);
-show create table t1;
-drop table t1;
---error 1426
-create table t1 (d decimal(66,0));
-
-#
-# Test example from manual
-#
-
-CREATE TABLE t1 (i INT, d1 DECIMAL(9,2), d2 DECIMAL(9,2));
-INSERT INTO t1 VALUES (1, 101.40, 21.40), (1, -80.00, 0.00),
-(2, 0.00, 0.00), (2, -13.20, 0.00), (2, 59.60, 46.40),
-(2, 30.40, 30.40), (3, 37.00, 7.40), (3, -29.60, 0.00),
-(4, 60.00, 15.40), (4, -10.60, 0.00), (4, -34.00, 0.00),
-(5, 33.00, 0.00), (5, -25.80, 0.00), (5, 0.00, 7.20),
-(6, 0.00, 0.00), (6, -51.40, 0.00);
-
-SELECT i, SUM(d1) AS a, SUM(d2) AS b FROM t1 GROUP BY i HAVING a <> b;
-SELECT i, ROUND(SUM(d1), 2) AS a, ROUND(SUM(d2), 2) AS b FROM t1 GROUP BY i
-HAVING a <> b;
-drop table t1;
-
-#
-# A test case for Bug#4956 "strange result, insert into longtext, parameter
-# with numeric value": ensure that conversion is done identically no matter
-# where the input data comes from.
-#
-create table t1 (c1 varchar(100), c2 longtext);
-insert into t1 set c1= 'non PS, 1.0 as constant', c2=1.0;
-prepare stmt from "insert into t1 set c1='PS, 1.0 as constant ', c2=1.0";
-execute stmt;
-set @a=1.0;
-insert into t1 set c1='non PS, 1.0 in parameter', c2=@a;
-prepare stmt from "insert into t1 set c1='PS, 1.0 in parameter ', c2=?";
-execute stmt using @a;
-select * from t1;
-deallocate prepare stmt;
-drop table t1;
-
-#
-# A test case for Bug#5673 "Rounding problem in 4.0.21 inserting decimal
-# value into a char field": this is a regression bug in 4.0 tree caused by
-# a fix for some other decimal conversion issue. The patch never was
-# approved to get into 4.0 (maybe because it was considered too intrusive)
-#
-
-create table t1 (
- strippedproductid char(15) not null default '',
- zlevelprice decimal(10,2) default null,
- primary key (strippedproductid)
-);
-
-create table t2 (
- productid char(15) not null default '',
- zlevelprice char(21) default null,
- primary key (productid)
-);
-
-insert into t1 values ('002trans','49.99');
-insert into t1 values ('003trans','39.98');
-insert into t1 values ('004trans','31.18');
-
-insert INTO t2 SELECT * FROM t1;
-
-select * from t2;
-drop table t1, t2;
-
-#
-# Bug #17826 'type_decimal' fails with ps-protocol
-#
-create table t1 (f1 decimal(5));
-insert into t1 values (40);
-flush tables;
-select f1 from t1 where f1 in (select f1 from t1);
-drop table t1;
-
-#
-# Bug#22183: Unhandled NULL caused server crash
-#
-create table t1 as
- select from_days(s) as date,t
- from (select 1 as s,'t' as t union select null, null ) as sub1;
-select group_concat(t) from t1 group by week(date)/10;
-drop table t1;
-
-#
-# Bug#28980: ROUND(<dec expr>, <int col>) returned double values
-#
-
-CREATE TABLE t1 (
- qty decimal(16,6) default NULL,
- dps tinyint(3) unsigned default NULL
-);
-INSERT INTO t1 VALUES (1.1325,3);
-
-SELECT ROUND(qty,3), dps, ROUND(qty,dps) FROM t1;
-
-DROP TABLE t1;
-
-#
-# Bug #24541: "Data truncated..." on decimal type columns without any good reason
-#
-
-create table t1 (c1 decimal(10,6));
-insert into t1 (c1) values (9.99e-4);
-insert into t1 (c1) values (9.98e-4);
-insert into t1 (c1) values (0.000999);
-insert into t1 (c1) values (cast(9.99e-4 as decimal(10,6)));
-select * from t1;
-drop table t1;
-
-#
-# Bug#31019: MOD() function and operator crashes MySQL when
-# divisor is very long and < 1
-#
-
-SELECT 1 % .123456789123456789123456789123456789123456789123456789123456789123456789123456789 AS '%';
-SELECT MOD(1, .123456789123456789123456789123456789123456789123456789123456789123456789123456789) AS 'MOD()';
-
-# Bug #31227: memory overrun with decimal (6,6) and zerofill and group_concat
-# valgrind will complain about this (the group_concat(f2)) on unpatched mysqld.
-#
-create table t1 (f1 decimal(6,6),f2 decimal(6,6) zerofill);
-insert into t1 values (-0.123456,0.123456);
-select group_concat(f1),group_concat(f2) from t1;
-drop table t1;
-
-#
-# BUG#31450 "Query causes error 1048"
-#
-create table t1 (
- ua_id decimal(22,0) not null,
- ua_invited_by_id decimal(22,0) default NULL,
- primary key(ua_id)
-);
-insert into t1 values (123, NULL), (456, NULL);
-
---echo this must not produce error 1048:
-select * from t1 where ua_invited_by_id not in (select ua_id from t1);
-
-drop table t1;
-
-#
-# Bug #30889: filesort and order by with float/numeric crashes server
-#
---disable_warnings
-DROP TABLE IF EXISTS t3;
-DROP TABLE IF EXISTS t4;
---enable_warnings
-CREATE TABLE t1( a NUMERIC, b INT );
-INSERT INTO t1 VALUES (123456, 40), (123456, 40);
-SELECT TRUNCATE( a, b ) AS c FROM t1 ORDER BY c;
-SELECT ROUND( a, b ) AS c FROM t1 ORDER BY c;
-SELECT ROUND( a, 100 ) AS c FROM t1 ORDER BY c;
-
-CREATE TABLE t2( a NUMERIC, b INT );
-INSERT INTO t2 VALUES (123456, 100);
-SELECT TRUNCATE( a, b ) AS c FROM t2 ORDER BY c;
-SELECT ROUND( a, b ) AS c FROM t2 ORDER BY c;
-
-CREATE TABLE t3( a DECIMAL, b INT );
-INSERT INTO t3 VALUES (123456, 40), (123456, 40);
-SELECT TRUNCATE( a, b ) AS c FROM t3 ORDER BY c;
-SELECT ROUND( a, b ) AS c FROM t3 ORDER BY c;
-SELECT ROUND( a, 100 ) AS c FROM t3 ORDER BY c;
-
-CREATE TABLE t4( a DECIMAL, b INT );
-INSERT INTO t4 VALUES (123456, 40), (123456, 40);
-SELECT TRUNCATE( a, b ) AS c FROM t4 ORDER BY c;
-SELECT ROUND( a, b ) AS c FROM t4 ORDER BY c;
-SELECT ROUND( a, 100 ) AS c FROM t4 ORDER BY c;
-
-delete from t1;
-INSERT INTO t1 VALUES (1234567890, 20), (999.99, 5);
-show create table t1;
-
-select round(a,b) as c from t1 order by c;
-
-DROP TABLE t1, t2, t3, t4;
-
-#
-# Bug #33143: Incorrect ORDER BY for ROUND()/TRUNCATE() result
-#
-
-CREATE TABLE t1( a DECIMAL(4, 3), b INT );
-INSERT INTO t1 VALUES ( 1, 5 ), ( 2, 4 ), ( 3, 3 ), ( 4, 2 ), ( 5, 1 );
-SELECT a, b, ROUND( a, b ) AS c FROM t1 ORDER BY c;
-SELECT a, b, ROUND( a, b ) AS c FROM t1 ORDER BY c DESC;
-
-CREATE TABLE t2 ( a INT, b INT, c DECIMAL(5, 4) );
-
-INSERT INTO t2 VALUES ( 0, 1, 1.2345 ), ( 1, 2, 1.2345 ),
- ( 3, 3, 1.2345 ), ( 2, 4, 1.2345 );
-
-SELECT a, b, MAX(ROUND(c, a))
-FROM t2
-GROUP BY a, b
-ORDER BY b;
-
-SELECT a, b, ROUND(c, a)
-FROM t2;
-
-CREATE TABLE t3( a INT, b DECIMAL(6, 3) );
-INSERT INTO t3 VALUES( 0, 1.5 );
-SELECT ROUND( b, a ) FROM t3;
-
-CREATE TABLE t4( a INT, b DECIMAL( 12, 0) );
-INSERT INTO t4 VALUES( -9, 1.5e9 );
-SELECT ROUND( b, a ) FROM t4;
-
-CREATE TABLE t5( a INT, b DECIMAL( 13, 12 ) );
-INSERT INTO t5 VALUES( 0, 1.5 );
-INSERT INTO t5 VALUES( 9, 1.5e-9 );
-SELECT ROUND( b, a ) FROM t5;
-
-CREATE TABLE t6( a INT );
-INSERT INTO t6 VALUES( 6 / 8 );
-SELECT * FROM t6;
-
-SELECT ROUND(20061108085411.000002);
-
-DROP TABLE t1, t2, t3, t4, t5, t6;
-
-#
-# Bug#36023: Incorrect handling of zero length caused an assertion to fail.
-#
-create table t1(`c` decimal(9,2));
-insert into t1 values (300),(201.11);
-select max(case 1 when 1 then c else null end) from t1 group by c;
-drop table t1;
-
---echo End of 5.0 tests
-
-#
-# Bug#52168 decimal casting catastrophes:
-# crashes and valgrind errors on simple casts
-#
-
-# Uninitialized read when calling Item_cache_decimal::val_int()
-CREATE TABLE t1 (a INTEGER);
-INSERT INTO t1 VALUES (NULL);
-CREATE TABLE t2 (b INTEGER);
-INSERT INTO t2 VALUES (NULL), (NULL);
-SELECT b FROM t1 JOIN t2 WHERE CONVERT(a, DECIMAL)|CONVERT(b, DECIMAL);
-DROP TABLE t1, t2;
-
-#
-# Bug#52122 crash when converting derived table column to decimal
-#
-CREATE TABLE t1 (col0 INTEGER, col1 REAL);
-CREATE TABLE t2 (col0 INTEGER);
-INSERT INTO t1 VALUES (0, 0.0), (NULL, NULL);
-INSERT INTO t2 VALUES (1);
-
-# Uninitialized read when calling Item_cache_decimal::val_real()
-SELECT 1 FROM t1
-JOIN
-(
- SELECT t2.col0 FROM t2 RIGHT JOIN t1 USING(col0)
- GROUP BY t2.col0
-) AS subq
-WHERE t1.col1 + CAST(subq.col0 AS DECIMAL);
-
-# Uninitialized read when calling Item_cache_decimal::val_str()
-SELECT 1 FROM t1
-JOIN
-(
- SELECT t2.col0 FROM t2 RIGHT JOIN t1 USING(col0)
- GROUP BY t2.col0
-) AS subq
-WHERE CONCAT(t1.col1, CAST(subq.col0 AS DECIMAL));
-
-DROP TABLE t1, t2;
-
-
---echo #
---echo # Start of 5.5 tests
---echo #
-
---echo #
---echo # MDEV-8267 Add /*old*/ comment into I_S.COLUMN_TYPE for old DECIMAL
---echo #
-
-let $MYSQLD_DATADIR= `select @@datadir`;
-
---copy_file std_data/old_decimal/t1dec102.frm $MYSQLD_DATADIR/test/t1dec102.frm
---copy_file std_data/old_decimal/t1dec102.MYD $MYSQLD_DATADIR/test/t1dec102.MYD
---copy_file std_data/old_decimal/t1dec102.MYI $MYSQLD_DATADIR/test/t1dec102.MYI
-
-SHOW CREATE TABLE t1dec102;
-SHOW COLUMNS FROM t1dec102;
-SELECT COLUMN_NAME, DATA_TYPE, COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1dec102';
-DROP TABLE t1dec102;
-
-#
-# MDEV-10552 equality operation on cast of the value "-0.0" to decimal not working
-#
-select cast('-0.0' as decimal(5,1)) < 0;
-
---echo #
---echo # End of 5.5 tests
---echo #
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-15420 Wrong result for CAST from TIME or DATETIME with zero integer part and non-zero microseconds to DECIMAL(X,Y)
---echo #
-
-SET sql_mode=''; # Allow zero date
-SELECT
- CAST(TIMESTAMP'0000-00-00 00:00:00.123456' AS DECIMAL(10,6)) AS c1,
- CAST(TIME'00:00:00.123456' AS DECIMAL(10,6)) AS c2;
-SET sql_mode=DEFAULT;
-
---echo #
---echo # End of 10.2 tests
---echo #
-
---echo #
---echo # Start of 10.3 tests
---echo #
-
---echo #
---echo # MDEV-9217 Split Item::tmp_table_field_from_field_type() into virtual methods in Type_handler
---echo #
-
-let $MYSQLD_DATADIR= `select @@datadir`;
-
---copy_file std_data/old_decimal/t1dec102.frm $MYSQLD_DATADIR/test/t1dec102.frm
---copy_file std_data/old_decimal/t1dec102.MYD $MYSQLD_DATADIR/test/t1dec102.MYD
---copy_file std_data/old_decimal/t1dec102.MYI $MYSQLD_DATADIR/test/t1dec102.MYI
-
---echo # This creates the old DECIMAL. Will be fixed in MDEV-12574.
-CREATE TABLE t1 AS SELECT MAX(a) FROM t1dec102;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 AS SELECT COALESCE(a) FROM t1dec102;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a BIGINT);
-CREATE TABLE t2 AS SELECT a FROM t1dec102 UNION SELECT a FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a MEDIUMINT);
-CREATE TABLE t2 AS SELECT a FROM t1dec102 UNION SELECT a FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a YEAR);
-CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT a FROM t1dec102;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-DROP TABLE t1;
-
-DROP TABLE t1dec102;
diff --git a/mysql-test/t/type_enum.test b/mysql-test/t/type_enum.test
deleted file mode 100644
index a79335960bc..00000000000
--- a/mysql-test/t/type_enum.test
+++ /dev/null
@@ -1,520 +0,0 @@
-#
-# Problem with many enums
-#
-
---disable_warnings
-DROP TABLE if exists t1;
---enable_warnings
-
-CREATE TABLE t1 (
- field enum('001001','001004','001010','001018','001019','001020','001021','001027','001028','001029','001030','001031','001100','002003','002004','002005','002007','002008','002009','002012','002013','002014','003002','003003','003004','003005','003006','003007','003008','003009','003010','003011','003012','003013','003014','003015','003016','003017','003018','003019','004002','004003','004005','004006','004007','004008','004010','004012','004014','004016','004017','004020','004021','004022','004023','004024','004025','004026','006002','006004','006006','006010','006011','006012','006013','006014','007001','007002','007003','007004','007005','007006','007007','007008','007009','007010','007011','007012','007013','007014','007015','007016','007017','007018','007019','007020','007021','007022','007023','007024','007025','007026','007027','007028','007029','007030','007031','007032','007033','007034','007035','007036','007037','007038','007039','007040','007043','007044','009001','009002','009004','009005','009006','009007','009008','009009','009010','009011','009012','009013','010002','010003','010004','010005','010006','010007','010008','010009','010010','010011','010012','010013','010015','010016','010017','010018','010019','010020','010021','010022','010023','010024','010025','010026','010027','010028','011001','011002','011003','011004','011006','011012','011013','011014','011015','011016','012017','012018','012019','012023','012027','012028','012029','012030','012031','012032','012033','012034','012035','012036','012037','012038','012039','014001','016002','016003','016004','016007','016010','016011','016016','016019','016020','016021','016022','016023','016024','016026','016027','016028','016029','016030','016031','016032','016033','016034','017002','018001','019002','019004','020001','020003','020004','020005','020006','020007','020008','020009','022001','022002','022003','023001','023002','023003','023004','023005','023006','023007','023008','023010','023011','023012','023017','023019','023020','023021','023025','023026','023027','023028','023029','023030','023031','023032','023033','023034','023035','025001','025003','025004','025005','025006','025007','025008','025009','025010','025011','025012','025013','025014','025015','025016','025017','025018','025019','025020','025021','025022','025023','025024','025025','025026','025027','025028','025029','025030','025031','025032','025033','025034','025035','025036','025037','025038','025039','025040','025041','025042','025043','025044','025045','025046','025047','025048','025049','025050','025051','025052','025053','025054','025055','025056','025057','025058','025059','025060','025061','025062','025063','027001','027002','027011','035008','035012','036001','037001','037003','037004','037005','037006','037007','037008','037009','038004','038005','038006','038007','038009','039001','039002','039003','039004','039005','039006','046001','046002','046003','046004','046005','046007','046008','046009','046010','046011','046012','046013','046014','047001','047002','048001','051001','051002','051003','051004','052001','052002','052005','053015','053016','053019','053020','053023','053024','053026','053028','053029','053033','053034','053036','053037','053038','053039','053041','053042','053043','053045','053046','053047','053048','053051','053052','053054','053055','053056','053057','053068','053069','053070','053073','053074','053075','053086','053094','053095','053096','053097','053098','053099','053100','053101','053102','053103','053104','053105','053107','053122','053123','053124','053125','053127','053128','054001','054002','054003','054004','054005','054006','054007','054009','054010','056001','056002','056003','056004','056005','056006','056009','056010','056011','056016','056017','056018','056019','056020','056021','056022','057001','057002','057003','057004','058002','058003','058004','058005','060001','060003','060004','060005','060006','060007','061002','061003','061004','061005','061006','069006','069007','069010','069011','069012','069013','069014','069015','069016','069017','069018','069020','069021','069022','069023','069024','071002','071003','071004','071005','071006','071008','071011','071013','071020','071021','071022','072001','073001','073002','073003','073004','074001','074002','074003','074004','074005','074006','074007','074008','074009','074010','074011','074012','075001','075007','076101','076102','076103','077001','077002','077003','077004','077006','077007','077008','077009','078005','079002','079003','079004','079005','079006','079007','081001','082006','082007','082011','082013','082014','082015','082016','082017','082021','082022','082023','082024','082025','082026','082027','082028','082029','082030','082031','082032','082033','082034','082035','082036','082037','082038','082039','082040','082041','082042','082043','082044','084001','084002','084003','084004','084005','084007','084008','084009','084011','084013','084014','084016','084017','084027','084031','084032','084033','084035','084036','084037','084038','084039','084040','084041','084042','084043','084044','084045','084046','084047','084048','084049','084050','084051','085001','085002','085003','085004','085005','085006','085007','085009','085011','085012','085013','085014','085015','085016','085017','085018','085019','085020','085021','085022','085023','085028','085029','085030','085031','085033','085034','085035','085036','085037','085038','085040','085041','085042','085043','085044','085045','085046','085047','085048','085063','085064','085065','085068','085070','085071','085073','085082','085083','085086','085088','085089','085090','085091','085092','085093','085094','085095','085096','085097','085098','085099','085100','085101','085102','085103','085104','085105','085106','085107','085108','085109','085110','085111','085112','085113','085115','085119','085120','085121','085122','085123','085124','085125','085126','085127','085128','085129','085130','085132','085133','085134','085135','085136','085137','086001','086002','086003','086004','086005','088001','088003','088005','088006','088007','088008','088009','089001','090001','090002','090003','090004','090005','090006','090007','090008','090009','090010','090013','090015','090016','090017','090018','090019','090022','090027','090028','091001','091002','091005','091008','091009','091010','091011','091012','091013','091014','091015','091016','091017','091018','093001','093003','093098','093100','093102','093104','093141','093142','093146','093151','093153','093167','093168','093176','094001','094002','094004','094005','095004','099001','099002','100001','101001','102002','102003','105001','105002','106001','113001','113002','113003','113004','113005','113006','113007','113008','113009','113010','113011','113012','113013','113014','113015','113016','113017','113018','113019','113020','113021','113022','113023','113024','113025','113026','113027','113028','114001','115001','115002','115003','115004','115005','115006','115007','115008','115009','115010','115011','115012','115013','115014','115015','115016','115017','115018','115020','115021','115022','115023','115025','115026','115027','115028','115029','115030','115031','115032','115033','115034','115035','115036','115039','115040','115041','115042','115043','115044','115045','115046','115047','115048','115049','115050','115051','115052','115053','115054','115055','115056','115057','115059','115060','115061','115062','115063','115064','115065','115066','115067','115068','115069','115070','115071','115072','115073','115075','115076','115081','115082','115085','115086','115087','115088','115095','115096','115097','115098','115099','115101','115102','115103','115104','115105','115106','115108','115109','115110','115111','115112','115113','115114','115115','115116','115117','115118','115119','115120','115121','115122','116001','116002','116003','116004','116005','116006','116007','116008','116009','116010','116011','116012','117001','117002','117003','123001','124010','124014','124015','124019','124024','124025','124026','124027','124028','124029','124030','124031','124032','124033','124035','124036','124037','124038','124039','124040','124041','124042','124043','124044','124045','124046','124047','124048','124049','124050','124051','124052','124053','124054','124055','124056','124057','124058','124059','124060','124061','124062','124063','124064','124065','126001','126002','126003','126004','126005','126006','126007','126008','126009','126010','126011','126012','130001','132001','132002','132003','133001','133008','133009','133010','133011','133012','133013','133014','133015','133016','133017','133018','133019','133020','133021','133022','133023','133024','133025','133027','133028','133029','133030','133031','134001','135001','135002','135003','135004','135005','135006','135007','135008','135009','135010','136001','137009','137010','137011','137012','137013','137014','137015','137016','137017','137018','137019','138001','138002','138003','138004','139001','139003','140001','141001','141002','141003','141006','141007','141008','141009','141011','141012','141014','141015','141016','141017','141018','141019','141020','141021','141022','141023','141024','141025','141026','141027','141028','142001','142002','142003','142004','142005','142006','142007','142008','142010','142011','142012','144001','145001','145002','145003','145004','145005','145006','145007','145008','145009','145010','145011','145012','145013','145014','145015','145016','147001','150003','150005','150009','150013','150014','150015','150016','150017','150020','150021','152001','152002','152003','152004','152005','152006','152007','154001','154002','154003','155001','155002','155003','155004','155005','155006','159001','159002','159003','159004','160001','160002','160003','161001','162001','162002','162003','162004','162007','162010','162011','162012','163001','163002','163003','163005','163010','163011','163014','163015','163016','165001','165002','165003','165004','165005','165006','165007','165008','165009','165010','165011','165012','165013','165014','165015','165016','165017','165018','165019','165020','165021','165022','165023','165024','165025','165026','165027','165028','165029','165030','165031','165032','165033','165034','165035','165036','167001','168001','168002','168003','168004','168005','168007','168008','168009','168010','168011','168012','168013','168014','169001','169002','169003','169007','169008','169009','169010','170001','171001','171002','171003','171004','171005','171006','171007','171008','171009','172001','174001','174002','174003','176001','176002','176003','177001','177002','179001','179002','179003','179004','179005','179006','179007','179008','179009','179010','179011','179012','179013','179014','179015','179016','179017','179018','179019','179020','179021','179022','179023','179024','179025','179026','179027','179028','179029','179030','179031','179032','179033','179034','179035','179036','179037','179038','179039','179040','179041','179042','179043','179044','179045','179046','179047','180001','180010','180012','180013','180014','180015','180016','180017','180018','180019','180020','180021','180022','180023','180024','180025','180026','180027','180028','180030','180031','180032','180033','180034','180035','180036','180037','180038','180039','180041','180042','180043','180044','180045','180046','180047','180048','180049','180050','180051','180052','180053','180054','180055','180056','180057','180058','180059','180060','180061','180062','180063','180064','180065','180066','180067','180068','180069','180070','180071','182001','184001','184002','184005','184006','184007','184008','184009','184010','184011','185001','185003','187001','188001','188002','188003','188004','188005','188006','188007','188008','188009','188010','188011','191001','191002','192002','194001','194002','194003','194004','194005','194006','194007','195001','195002','195003','195004','195005','195006','195007','196001','196002','197001','197002','197003','197004','197005','197006','198001','198003','198004','198005','198006','198007','198008','198009','198010','198011','198012','198013','198014','198015','198016','198017','201001','201002','201005','202001','203001','203002','203003','203017','203018','203019','204001','204002','204003','205001','208001','208002','208003','208004','208005','209001','209002','209003','210001','210002','210003','210004','210005','210006','210007','210008','210009','210010','210011','210012','210013','211017','212001','212002','212003','212004','212005','212006','212007','212008','212009','212010','212011','212012','212013','218001','218003','218004','218006','218007','218008','218009','218011','218015','218016','218017','218018','218019','218020','218021','218022','218023','218024','218025','218026','218027','218028','218029','218030','218031','218032','218033','218034','218035','218036','221001','221002','221003','221004','221005','221006','221007','221008','221009','221010','221011','221012','221013','223001','223002','223003','224001','224002','224003','224006','224007','224008','225001','225002','225003','225004','225005','225006','225007','225008','225009','225010','225011','225012','225013','226001','226002','226003','226004','226005','226006','226007','226008','226009','227001','227002','227003','227004','227005','227006','227007','227008','227009','227010','227011','227012','227013','227014','227015','227016','227017','227018','227019','227020','227021','227022','227023','227024','227025','227026','227027','227028','227029','227030','227031','227032','227033','227034','227035','227036','227037','227038','227039','227040','227041','227042','227043','227044','227045','227046','227047','227048','227049','227050','227051','227052','227053','227054','227055','227056','227057','227058','227059','227060','227061','227062','227063','227064','227065','227066','227067','227068','227069','227070','227071','227072','227073','227074','227075','227076','227077','227078','227079','227080','227081','227082','227083','227084','227085','227086','227087','227088','227089','227090','227091','227092','227093','227094','227095','227096','227097','227098','227099','227100','227101','227102','227103','227104','227105','227106','227107','227108','227109','227110','227111','227112','227113','227114','227115','227116','227117','227118','227119','227120','227122','227123','227124','227125','227126','227127','227128','227129','227130','227131','227132','227133','227134','227135','227136','227137','227138','227139','227140','227141','227142','227143','227144','227145','227146','227147','227148','227149','227150','227151','227152','228001','229001','229002','229003','229004','229005','230001','230002','232001','233001','233002','233003','233004','233005','233006','233007','233008','234001','234002','234003','234004','234005','234006','234007','234008','234009','234010','234011','234012','234013','234014','234015','234016','234017','234018','234019','234020','234021','234022','234023','234024','234025','234026','234027','234028','234029','234030','235001','235002','235003','235004','235005','236001','236002','236003','237001','238002','238003','238004','238005','238006','238007','238008','333013','333014','333015','333016','333017','333018','333019','333020','333021','333022','333023','333024','333025','333030','333031','333032','333033','333034','333035','334001','334002','334003','334004','334005','334006','334007','336004','337001','337002','337003','337004','339001','339002','343001','344001','344002','344003','344004','344005','345001','345002','345003','347001','347002','348001','348002','348003','348004','348005','349001','349002','349003','350001','353001','353002','353003','353004','355001','355002','355003','355004','355005','355006','356001','358001','359001','359002','360001','360002','360003','360004','360005','366001','366002','366003','366004','369001','373001','373002','373003','373004','373005','373006','373007','373008','373009','373010','373011','373012','373013','373014','373015','373016','373017','373018','373019','373020','373021','374001','374002','374003','374004','374005','374006','374007','374008','374009','374010','374011','374012','374013','374014','374015','374016','376001','376002','376003','376004','376005','376006','376007','376008','376009','376010','376011','376012','376013','376016','376017','376018','376019','376020','376021','379003','382001','382002','383001','384001','384002','385001','385002','386001','386002','386003','386004','386005','386006','386007','386008','386009','386010','386011','386012','386013','386014','387001','389001','389002','389003','389004','392001','393001','393002','393003','393004','395001','396001','397001','397002','399001','399002','399003','400001','400002','401001','401002','401003','402001','402002','402003','402004','402005','403001','403002','403003','504001','504002','504004','504005','504006','504007','504008','504009','504010','504011','504012','504013','504014','504017','504018','504019','504021','504022','504023','504024','504025','506001','506002','508001','508002','511001','511002','511003','511004','511005','511006','511007','511008','511009','511010','511011','511012','511013','511014','511017','511018','511020','511021','511022','511024','511028','511029','513001','513002','513003','513004','514001','515001','515002','515003','515007','515008','515009','515010','515011','515012','515013','515014','515015','518001','518002','518003','520001','520002','521001','521002','521003','521004','521005','521006','521007','521008','521009','521010','521011','521012','521013','521014','521015','521016','523001','523002','523003','523004','523005','523006','523007','524001','700001','701001','701002','701003','702001','702002','702003','702004','702005','702006','702007','702008','703001','703002','703003','704001','704002','704003','704004','705001','706001','706002','707001','707002','707003','708001','709001','709002','710001','710002','711001','711002','712001','713001','713002','714001','714002','715001','716001','718001','718002','719001','719002','991001','991002','991003','991004','991005','991006','991007','991008','992001','995001','996001','996002','996003','998001','998002','998003','998004','998005','998006','998007','999001','999002','011017','011018','034001','034002','071010','208006','239001','519001','519003','126013','184012','053071','374017','374018','374019','374020','374021','404001','405002','405001','405003','405007','405006','405005','405004','240011','240010','240009','240008','240007','240006','240005','240004','240003','240002','240001','240012','240013','240014','240015','240016','240017','357001','235006','235007','712002','355008','355007','056023','999999','046015','019005','126014','241003','241002','241001','240018','240020','240019','242001','242002','242003','242004','242005','242006','089002','406001','406002','406003','406004','406005','406006','243001','243002','243003','243004','243005','243006','243007','243008','010030','010029','407001','407006','407005','407004','407003','407002','408001','366005','133032','016035','077010','996004','025064','011019','407007','407008','407009','409001','115123','504026','039007','039009','039008','039010','039011','039012','180072','240021','240023','408002','405008','235008','525001','525002','525003','525004','410001','410002','410003','410004','410005','410006','410007','410008','410009','410010','410011','410012','410013','410014','410015','410016','344006','240031','240030','240029','240028','240027','240026','240025','240024','240034','240033','240032','410017','410018','411001','411002','411003','411004','411005','411006','411007','411008','203020','203021','203022','412001','412002','412003','412004','069025','244001','244002','244009','244008','244007','244006','244005','244004','244003','244015','244014','244013','244012','244011','244010','244016','244017','240042','240041','240040','240039','240038','240037','240036','240035','405009','405010','240043','504034','504033','504032','504031','504030','504029','504028','504027','504042','504041','504040','504039','504038','504037','504036','504035','800001','410019','410020','410021','244018','244019','244020','399004','413001','504043','198018','198019','344007','082045','010031','010032','010033','010034','010035','504044','515016','801002','801003','801004','801005','802001','801001','414001','414002','414003','141029','141030','803001','803002','803003','803004','803005','803006','803007','803008','803009','803010','803011','803012','803013','803014','803015','803016','803017','410022','410023','803018','803019','803020','415002','415001','244021','011020','011023','011022','011021','025065','165037','165038','165039','416001','416002','416003','417001','418001','504045','803022','803021','240022','419001','420001','804010','804009','804008','804007','804006','804005','804004','804003','804002','804001','804020','804019','804018','804017','804016','804015','804014','804013','804012','804011','804024','804021','804023','804022','511019','511016','511015','511032','511031','511030','511027','511026','511025','511033','511023','133034','133033','169011','344008','344009','244022','244026','244025','244030','244023','244024','244027','244028','244029','244031','082046','082047','082048','126015','126016','416004','416005','421001','421002','016037','016036','115124','115125','115126','240049','240048','240047','240046','240045','240044','244032','244033','422001','422002','422003','422004','422005','184013','239002','805001','805002','805003','805004','805005','056024','423001','344010','235009','212014','056025','056026','802002','244034','244035','244036','244037','244038','244039','515017','504046','203015','245002','245001','071023','056027','056028','056029','056030','056031','056032','424001','056034','056033','805006','805007','805008','805009','805010','422008','422007','422006','422010','422009','422011','209004','150022','150023','100002','056035','023036','185004','185005','246001','247001','247002','425001','416006','165042','165041','165040','165043','010040','010039','010038','010037','010036','422012','422013','422014','422015','426000','248001','248002','248003','248004','248005','249001','249002','249003','249004','249005','249006','250007','250001','250002','250003','250004','250005','250006','250008','250009','250010','250011','250012','250013','251001','251002','422016','422017','422018','806001','806002','116013','235010','235011','091026','091027','091028','091029','091019','091020','091021','091022','091023','091024','091025','252001','243009','249007','249008','249009','011024','011025','427001','428002','428001','169012','429001','429002','429003') DEFAULT '001001' NOT NULL,
- KEY field (field)
-);
-INSERT INTO t1 VALUES ('001001'),('001001'),('001001'),('001001'),('001001'),('001001'),('001001'),('001001'),('001001'),('001010'),('001010'),('001010'),('001010'),('001010'),('001018'),('001018'),('001018'),('001018'),('001018'),('001018'),('001020'),('001020'),('001020'),('001020'),('001020'),('001020'),('001020'),('001020'),('001021'),('001021'),('001021'),('001021'),('001021'),('001021'),('001027'),('001027'),('001028'),('001030'),('001030'),('001030'),('001030'),('001031'),('001031'),('001031'),('001031'),('001031'),('001100'),('001100'),('002003'),('002003'),('002003'),('002003'),('002003'),('002003'),('002003'),('002003'),('002003'),('002004'),('002004'),('002004'),('002004'),('002004'),('002004'),('002004'),('002004'),('002004'),('002005'),('002005'),('002005'),('002005'),('002005'),('002005'),('002005'),('002005'),('002007'),('002007'),('002007'),('002007'),('002007'),('002007'),('002007'),('002008'),('002008'),('002008'),('002008'),('002008'),('002008'),('002008'),('002008'),('002009'),('002009'),('002009'),('002009'),('002009'),('002009'),('002009'),('002009'),('002012'),('002012'),('002012'),('002012'),('002012'),('002012'),('002012'),('002013'),('002013'),('002013'),('002013'),('002013'),('002013'),('002013'),('002013'),('002013'),('002014'),('002014'),('002014'),('002014'),('002014'),('002014'),('002014'),('002014'),('003002'),('003002'),('003002'),('003002'),('003002'),('003002'),('003003'),('003003'),('003003'),('003003'),('003003'),('003003'),('003004'),('003004'),('003004'),('003004'),('003004'),('003004'),('003005'),('003005'),('003005'),('003005'),('003005'),('003005'),('003005'),('003005'),('003005'),('003006'),('003006'),('003006'),('003006'),('003006'),('003006'),('003006'),('003006'),('003007'),('003007'),('003007'),('003007'),('003007'),('003008'),('003008'),('003008'),('003008'),('003008'),('003008'),('003009'),('003009'),('003009'),('003009'),('003009'),('003009'),('003009'),('003009'),('003009'),('003010'),('003010'),('003010'),('003010'),('003010'),('003010'),('003010'),('003010'),('003010'),('003011'),('003011'),('003011'),('003011'),('003011'),('003011'),('003011'),('003011'),('003012'),('003012'),('003012'),('003012'),('003012'),('003012'),('003012'),('003012'),('003013'),('003013'),('003013'),('003013'),('003013'),('003013'),('003013'),('003013'),('003014'),('003014'),('003014'),('003014'),('003014'),('003014'),('003014'),('003014'),('003015'),('003015'),('003015'),('003015'),('003015'),('003015'),('003016'),('003016'),('003016'),('003016'),('003016'),('003016'),('003017'),('003017'),('003017'),('003017'),('003017'),('003018'),('003018'),('003018'),('003018'),('003018'),('003019'),('003019'),('004003'),('004005'),('004005'),('004005'),('004005'),('004005'),('004005'),('004006'),('004008'),('004010'),('004012'),('004012'),('004014'),('004014'),('004014'),('004014'),('004014'),('004016'),('004017'),('004017'),('004017'),('004017'),('004017'),('004017'),('004017'),('004017'),('004020'),('004020'),('004020'),('004020'),('004020'),('004020'),('004021'),('004021'),('004021'),('004021'),('004021'),('004021'),('004021'),('004022'),('004023'),('004023'),('004023'),('004023'),('004023'),('004023'),('004023'),('004025'),('004026'),('004026'),('004026'),('004026'),('004026'),('006004'),('006006'),('006010'),('006010'),('006010'),('006010'),('006010'),('006010'),('006010'),('006011'),('006011'),('006011'),('006011'),('006011'),('006011'),('006012'),('006012'),('006012'),('006012'),('006012'),('006012'),('006014'),('006014'),('006014'),('007001'),('007001'),('007002'),('007003'),('007005'),('007007'),('007008'),('007009'),('007011'),('007012'),('007013'),('007015'),('007016'),('007017'),('007018'),('007019'),('007019'),('007020'),('007021'),('007021'),('007022'),('007023'),('007023'),('007025'),('007025'),('007025'),('007027'),('007029'),('007031'),('007031'),('007032'),('007034'),('007034'),('007036'),('007036'),('007036'),('007037'),('007037'),('007038'),('007040'),('007040'),('007040'),('007043'),('009001'),('009001'),('009001'),('009001'),('009001'),('009001'),('009001'),('009002'),('009002'),('009002'),('009002'),('009002'),('009004'),('009004'),('009004'),('009004'),('009005'),('009005'),('009005'),('009005'),('009005'),('009005'),('009005'),('009005'),('009006'),('009006'),('009006'),('009006'),('009007'),('009007'),('009007'),('009007'),('009007'),('009007'),('009008'),('009010'),('009010'),('009010'),('009010'),('009010'),('009010'),('009011'),('009011'),('009011'),('009011'),('009011'),('009012'),('009013'),('009013'),('009013'),('010002'),('010002'),('010002'),('010002'),('010002'),('010002'),('010002'),('010002'),('010003'),('010003'),('010003'),('010003'),('010003'),('010003'),('010003'),('010003'),('010003'),('010004'),('010004'),('010004'),('010004'),('010004'),('010004'),('010004'),('010004'),('010004'),('010005'),('010005'),('010005'),('010005'),('010006'),('010006'),('010006'),('010006'),('010006'),('010006'),('010006'),('010006'),('010006'),('010007'),('010007'),('010007'),('010007'),('010007'),('010007'),('010008'),('010008'),('010008'),('010008'),('010008'),('010008'),('010008'),('010009'),('010009'),('010009'),('010009'),('010009'),('010009'),('010010'),('010010'),('010010'),('010010'),('010010'),('010010'),('010010'),('010011'),('010011'),('010011'),('010011'),('010011'),('010011'),('010011'),('010011'),('010012'),('010012'),('010012'),('010012'),('010012'),('010012'),('010012'),('010013'),('010013'),('010013'),('010013'),('010013'),('010013'),('010015'),('010016'),('010016'),('010016'),('010016'),('010016'),('010016'),('010016'),('010016'),('010017'),('010017'),('010017'),('010017'),('010017'),('010017'),('010018'),('010018'),('010018'),('010018'),('010018'),('010018'),('010018'),('010018'),('010018'),('010019'),('010019'),('010019'),('010019'),('010019'),('010019'),('010020'),('010020'),('010020'),('010021'),('010021'),('010021'),('010021'),('010021'),('010021'),('010022'),('010022'),('010022'),('010022'),('010022'),('010022'),('010022'),('010022'),('010023'),('010023'),('010023'),('010023'),('010023'),('010023'),('010023'),('010023'),('010026'),('010027'),('010028'),('010028'),('011001'),('011001'),('011001'),('011001'),('011001'),('011001'),('011001'),('011002'),('011002'),('011002'),('011002'),('011002'),('011002'),('011002'),('011003'),('011003'),('011003'),('011003'),('011003'),('011003'),('011003'),('011003'),('011004'),('011004'),('011004'),('011004'),('011004'),('011004'),('011004'),('011006'),('011006'),('011006'),('011006'),('011006'),('011006'),('011006'),('011012'),('011012'),('011012'),('011013'),('011013'),('011013'),('011013'),('011013'),('011013'),('011014'),('011014'),('011014'),('011014'),('011015'),('011015'),('011015'),('011015'),('011015'),('011016'),('011016'),('011016'),('011016'),('011016'),('012017'),('012017'),('012027'),('012027'),('012032'),('012034'),('012036'),('012036'),('012037'),('012037'),('012038'),('012039'),('014001'),('014001'),('016016'),('016016'),('016016'),('016019'),('016020'),('016020'),('016020'),('016020'),('016020'),('016020'),('016020'),('016020'),('016021'),('016021'),('016021'),('016021'),('016021'),('016021'),('016021'),('016022'),('016022'),('016022'),('016023'),('016023'),('016023'),('016024'),('016024'),('016024'),('016024'),('016024'),('016024'),('016024'),('016026'),('016026'),('016026'),('016026'),('016026'),('016026'),('016028'),('016028'),('016028'),('016028'),('016028'),('016028'),('016028'),('016029'),('016029'),('016030'),('016031'),('016032'),('016032'),('016032'),('016032'),('016032'),('016032'),('016032'),('016033'),('016033'),('016033'),('016033'),('016033'),('016034'),('016034'),('016034'),('016034'),('016034'),('017002'),('017002'),('017002'),('017002'),('017002'),('018001'),('018001'),('018001'),('018001'),('018001'),('018001'),('018001'),('018001'),('019002'),('019002'),('019002'),('019002'),('019002'),('019002'),('019004'),('019004'),('019004'),('019004'),('019004'),('019004'),('020001'),('020001'),('020001'),('020001'),('020004'),('020006'),('020006'),('020006'),('020006'),('020006'),('020006'),('020008'),('020009'),('020009'),('020009'),('020009'),('020009'),('022001'),('022001'),('022001'),('022001'),('022002'),('022002'),('022002'),('022002'),('022003'),('022003'),('022003'),('022003'),('023001'),('023002'),('023002'),('023002'),('023002'),('023002'),('023002'),('023003'),('023003'),('023003'),('023003'),('023004'),('023004'),('023005'),('023005'),('023006'),('023006'),('023006'),('023006'),('023006'),('023006'),('023007'),('023007'),('023010'),('023010'),('023011'),('023011'),('023017'),('023019'),('023019'),('023019'),('023020'),('023020'),('023025'),('023025'),('023025'),('023026'),('023026'),('023026'),('023027'),('023027'),('023027'),('023028'),('023028'),('023029'),('023029'),('023030'),('023030'),('023032'),('023033'),('023033'),('023033'),('023033'),('023033'),('023033'),('023034'),('023035'),('023035'),('025001'),('025001'),('025001'),('025001'),('025001'),('025001'),('025001'),('025003'),('025003'),('025004'),('025004'),('025005'),('025005'),('025007'),('025007'),('025008'),('025008'),('025009'),('025010'),('025010'),('025010'),('025011'),('025011'),('025012'),('025012'),('025013'),('025013'),('025013'),('025014'),('025015'),('025016'),('025018'),('025018'),('025019'),('025019'),('025020'),('025020'),('025021'),('025022'),('025022'),('025023'),('025023'),('025024'),('025025'),('025025'),('025026'),('025026'),('025027'),('025027'),('025027'),('025028'),('025030'),('025031'),('025033'),('025034'),('025035'),('025037'),('025041'),('025042'),('025043'),('025046'),('025048'),('025048'),('025048'),('025049'),('025049'),('025049'),('025050'),('025050'),('025050'),('025051'),('025051'),('025052'),('025052'),('025052'),('025053'),('025053'),('025054'),('025054'),('025054'),('025054'),('025055'),('025056'),('025056'),('025056'),('025056'),('025056'),('025056'),('025056'),('025056'),('025056'),('025057'),('025057'),('025058'),('025058'),('025060'),('025060'),('025061'),('025062'),('025063'),('027001'),('027002'),('027011'),('036001'),('036001'),('036001'),('036001'),('036001'),('037003'),('037006'),('037007'),('037008'),('037008'),('038009'),('039001'),('039001'),('039001'),('039001'),('039001'),('039001'),('039002'),('039002'),('039002'),('039002'),('039002'),('039003'),('039003'),('039003'),('039003'),('039003'),('039003'),('039004'),('039004'),('039004'),('039004'),('039004'),('039005'),('039005'),('039005'),('039005'),('039005'),('039006'),('039006'),('039006'),('039006'),('046001'),('046001'),('046001'),('046001'),('046001'),('046001'),('046001'),('046001'),('046002'),('046002'),('046002'),('046002'),('046002'),('046002'),('046002'),('046002'),('046003'),('046003'),('046003'),('046003'),('046003'),('046003'),('046003'),('046005'),('046005'),('046005'),('046005'),('046005'),('046005'),('046005'),('046007'),('046007'),('046007'),('046007'),('046007'),('046007'),('046008'),('046008'),('046008'),('046008'),('046008'),('046009'),('046009'),('046009'),('046010'),('046012'),('046012'),('046012'),('046013'),('046014'),('046014'),('046014'),('047001'),('047001'),('047001'),('047001'),('047001'),('047001'),('047001'),('047001'),('047002'),('047002'),('047002'),('047002'),('047002'),('047002'),('047002'),('047002'),('048001'),('048001'),('048001'),('048001'),('048001'),('048001'),('048001'),('048001'),('051003'),('051003'),('051003'),('051003'),('051003'),('051004'),('051004'),('051004'),('051004'),('052001'),('052001'),('052001'),('052001'),('052001'),('052001'),('052001'),('052001'),('052002'),('052002'),('052005'),('052005'),('052005'),('052005'),('052005'),('052005'),('053016'),('053019'),('053019'),('053023'),('053023'),('053023'),('053023'),('053024'),('053024'),('053024'),('053026'),('053026'),('053026'),('053026'),('053028'),('053028'),('053029'),('053029'),('053029'),('053029'),('053033'),('053033'),('053033'),('053045'),('053046'),('053051'),('053051'),('053051'),('053054'),('053054'),('053054'),('053054'),('053057'),('053069'),('053069'),('053097'),('053107'),('053125'),('053125'),('053127'),('054001'),('054001'),('054001'),('054001'),('054001'),('054001'),('054001'),('054002'),('054002'),('054002'),('054002'),('054002'),('054002'),('054003'),('054003'),('054003'),('054003'),('054003'),('054003'),('054003'),('054004'),('054004'),('054004'),('054004'),('054004'),('054004'),('054004'),('054006'),('054006'),('054006'),('054007'),('054007'),('054007'),('054007'),('054007'),('054009'),('054009'),('054009'),('054009'),('054010'),('054010'),('054010'),('054010'),('054010'),('054010'),('054010'),('056001'),('056001'),('056001'),('056001'),('056001'),('056001'),('056001'),('056001'),('056001'),('056002'),('056002'),('056002'),('056002'),('056002'),('056002'),('056002'),('056002'),('056003'),('056003'),('056003'),('056003'),('056003'),('056003'),('056004'),('056004'),('056004'),('056004'),('056004'),('056004'),('056004'),('056005'),('056005'),('056005'),('056005'),('056005'),('056005'),('056005'),('056005'),('056005'),('056006'),('056006'),('056006'),('056006'),('056006'),('056006'),('056006'),('056006'),('056006'),('056009'),('056009'),('056009'),('056011'),('056016'),('056016'),('056016'),('056016'),('056016'),('056016'),('056016'),('056017'),('056017'),('056017'),('056017'),('056017'),('056017'),('056017'),('056017'),('056017'),('056018'),('056018'),('056018'),('056018'),('056018'),('056018'),('056019'),('056019'),('056019'),('056019'),('056019'),('056019'),('056019'),('056019'),('056020'),('056020'),('056020'),('056020'),('056022'),('056022'),('056022'),('056022'),('056022'),('057003'),('057003'),('057004'),('058002'),('058002'),('058002'),('058002'),('058003'),('058003'),('058003'),('058003'),('058004'),('058004'),('058004'),('058005'),('058005'),('058005'),('060001'),('060001'),('060001'),('060001'),('060001'),('060004'),('060004'),('060004'),('060004'),('060004'),('060004'),('060005'),('060005'),('060005'),('060005'),('060005'),('060005'),('060007'),('060007'),('060007'),('060007'),('060007'),('060007'),('060007'),('061004'),('061004'),('061004'),('061004'),('061004'),('061004'),('061006'),('061006'),('061006'),('061006'),('061006'),('061006'),('069006'),('069006'),('069006'),('069006'),('069006'),('069006'),('069006'),('069006'),('069006'),('069007'),('069007'),('069007'),('069007'),('069007'),('069007'),('069007'),('069007'),('069010'),('069010'),('069010'),('069010'),('069010'),('069010'),('069011'),('069012'),('069012'),('069012'),('069012'),('069012'),('069012'),('069012'),('069012'),('069012'),('069012'),('069013'),('069013'),('069013'),('069013'),('069013'),('069013'),('069013'),('069013'),('069013'),('069014'),('069014'),('069014'),('069014'),('069014'),('069014'),('069014'),('069014'),('069014'),('069015'),('069015'),('069015'),('069015'),('069015'),('069015'),('069015'),('069015'),('069015'),('069015'),('069016'),('069016'),('069016'),('069016'),('069016'),('069018'),('069018'),('069018'),('069018'),('069018'),('069018'),('069018'),('069018'),('069018'),('069020'),('069020'),('069020'),('069020'),('069021'),('069023'),('071002'),('071002'),('071002'),('071002'),('071002'),('071003'),('071003'),('071003'),('071003'),('071003'),('071004'),('071004'),('071004'),('071004'),('071004'),('071005'),('071005'),('071005'),('071005'),('071005'),('071005'),('071006'),('071006'),('071006'),('071006'),('071008'),('071008'),('071008'),('071008'),('071008'),('071008'),('071011'),('071011'),('071011'),('071011'),('071011'),('071020'),('071020'),('071020'),('071020'),('071020'),('071021'),('071022'),('071022'),('071022'),('072001'),('072001'),('074001'),('074002'),('074002'),('074002'),('074002'),('074002'),('074002'),('074002'),('074002'),('074003'),('074003'),('074003'),('074003'),('074003'),('074003'),('074003'),('074003'),('074004'),('074004'),('074004'),('074004'),('074004'),('074004'),('074004'),('074004'),('074005'),('074005'),('074005'),('074005'),('074005'),('074005'),('074005'),('074005'),('074006'),('074006'),('074006'),('074006'),('074006'),('074006'),('074006'),('074006'),('074007'),('074007'),('074007'),('074007'),('074007'),('074007'),('074007'),('074007'),('074008'),('074008'),('074008'),('074008'),('074008'),('074008'),('074008'),('074008'),('074009'),('074009'),('074009'),('074009'),('074009'),('074009'),('074009'),('074009'),('074010'),('074010'),('074010'),('074010'),('074010'),('074010'),('074010'),('074010'),('074011'),('074011'),('074011'),('074011'),('074011'),('074011'),('074011'),('074011'),('074012'),('074012'),('074012'),('074012'),('074012'),('074012'),('074012'),('075001'),('075001'),('075001'),('075007'),('075007'),('075007'),('075007'),('076101'),('076101'),('076101'),('076101'),('076102'),('076102'),('076102'),('076103'),('076103'),('076103'),('076103'),('076103'),('077001'),('077001'),('077001'),('077002'),('077002'),('077002'),('077002'),('077002'),('077002'),('077002'),('077003'),('077003'),('077003'),('077003'),('077003'),('077003'),('077003'),('077004'),('077004'),('077004'),('077004'),('077004'),('077004'),('077006'),('077006'),('077008'),('077008'),('077008'),('077008'),('077008'),('077008'),('077008'),('077009'),('077009'),('077009'),('077009'),('077009'),('077009'),('077009'),('078005'),('078005'),('078005'),('079002'),('079002'),('079002'),('079002'),('079002'),('079002'),('079002'),('079003'),('079003'),('079004'),('079004'),('079005'),('079005'),('079005'),('079005'),('079005'),('079005'),('079006'),('079006'),('079006'),('079006'),('079007'),('079007'),('079007'),('079007'),('079007'),('081001'),('081001'),('081001'),('081001'),('081001'),('082011'),('082011'),('082011'),('082011'),('082011'),('082013'),('082013'),('082013'),('082013'),('082013'),('082013'),('082014'),('082014'),('082014'),('082014'),('082014'),('082014'),('082014'),('082015'),('082015'),('082015'),('082015'),('082015'),('082016'),('082016'),('082016'),('082016'),('082016'),('082016'),('082017'),('082017'),('082017'),('082017'),('082017'),('082017'),('082017'),('082021'),('082021'),('082022'),('082022'),('082022'),('082022'),('082022'),('082023'),('082023'),('082023'),('082023'),('082023'),('082024'),('082024'),('082024'),('082024'),('082024'),('082025'),('082025'),('082025'),('082025'),('082025'),('082026'),('082026'),('082026'),('082026'),('082026'),('082027'),('082027'),('082027'),('082027'),('082027'),('082028'),('082028'),('082028'),('082028'),('082029'),('082029'),('082029'),('082029'),('082029'),('082030'),('082030'),('082030'),('082030'),('082031'),('082031'),('082031'),('082031'),('082031'),('082032'),('082032'),('082032'),('082033'),('082033'),('082034'),('082034'),('082034'),('082034'),('082034'),('082034'),('082034'),('082035'),('082035'),('082035'),('082036'),('082036'),('082036'),('082036'),('082037'),('082037'),('082037'),('082038'),('082038'),('082038'),('082038'),('082039'),('082039'),('082039'),('082039'),('082040'),('082040'),('082040'),('082040'),('082040'),('082041'),('082041'),('082041'),('082041'),('082042'),('082042'),('082043'),('082043'),('082043'),('082043'),('082043'),('082044'),('082044'),('082044'),('082044'),('084001'),('084002'),('084002'),('084002'),('084002'),('084003'),('084003'),('084003'),('084003'),('084003'),('084003'),('084003'),('084003'),('084004'),('084004'),('084004'),('084004'),('084004'),('084005'),('084005'),('084005'),('084005'),('084005'),('084007'),('084007'),('084007'),('084007'),('084007'),('084007'),('084008'),('084008'),('084008'),('084008'),('084008'),('084008'),('084009'),('084009'),('084009'),('084009'),('084009'),('084009'),('084011'),('084013'),('084013'),('084013'),('084013'),('084013'),('084014'),('084014'),('084014'),('084016'),('084016'),('084016'),('084016'),('084016'),('084016'),('084016'),('084016'),('084017'),('084017'),('084017'),('084017'),('084017'),('084017'),('084017'),('084017'),('084017'),('084027'),('084027'),('084027'),('084027'),('084027'),('084027'),('084032'),('084032'),('084033'),('084033'),('084033'),('084035'),('084035'),('084035'),('084036'),('084036'),('084036'),('084036'),('084036'),('084036'),('084037'),('084037'),('084038'),('084038'),('084038'),('084038'),('084038'),('084038'),('084039'),('084039'),('084039'),('084039'),('084040'),('084040'),('084040'),('084040'),('084040'),('084041'),('084041'),('084041'),('084041'),('084042'),('084042'),('084043'),('084043'),('084043'),('084043'),('084044'),('084044'),('084044'),('084044'),('084044'),('084045'),('084046'),('084046'),('084046'),('084047'),('084048'),('084048'),('084049'),('084049'),('084050'),('084051'),('084051'),('085001'),('085001'),('085001'),('085001'),('085001'),('085001'),('085002'),('085002'),('085002'),('085002'),('085003'),('085003'),('085003'),('085003'),('085003'),('085003'),('085003'),('085004'),('085004'),('085004'),('085004'),('085004'),('085004'),('085004'),('085005'),('085005'),('085005'),('085005'),('085005'),('085005'),('085006'),('085006'),('085006'),('085006'),('085006'),('085006'),('085006'),('085006'),('085007'),('085007'),('085007'),('085007'),('085007'),('085007'),('085007'),('085009'),('085009'),('085009'),('085009'),('085009'),('085009'),('085011'),('085011'),('085011'),('085011'),('085011'),('085011'),('085011'),('085011'),('085012'),('085012'),('085012'),('085012'),('085012'),('085012'),('085012'),('085014'),('085014'),('085014'),('085014'),('085014'),('085014'),('085014'),('085014'),('085014'),('085015'),('085015'),('085015'),('085015'),('085015'),('085015'),('085015'),('085015'),('085016'),('085016'),('085016'),('085016'),('085016'),('085016'),('085016'),('085016'),('085017'),('085017'),('085017'),('085017'),('085017'),('085018'),('085018'),('085018'),('085018'),('085018'),('085019'),('085019'),('085019'),('085019'),('085019'),('085019'),('085019'),('085019'),('085019'),('085020'),('085020'),('085020'),('085020'),('085020'),('085020'),('085022'),('085022'),('085022'),('085022'),('085022'),('085022'),('085023'),('085023'),('085023'),('085023'),('085023'),('085028'),('085028'),('085028'),('085028'),('085028'),('085028'),('085028'),('085029'),('085029'),('085029'),('085029'),('085029'),('085029'),('085029'),('085030'),('085030'),('085030'),('085030'),('085030'),('085030'),('085030'),('085031'),('085031'),('085031'),('085031'),('085031'),('085031'),('085031'),('085033'),('085034'),('085034'),('085034'),('085034'),('085034'),('085034'),('085034'),('085035'),('085035'),('085035'),('085035'),('085035'),('085035'),('085036'),('085036'),('085036'),('085036'),('085036'),('085036'),('085037'),('085037'),('085037'),('085037'),('085037'),('085037'),('085038'),('085038'),('085038'),('085038'),('085038'),('085038'),('085038'),('085040'),('085040'),('085040'),('085040'),('085040'),('085040'),('085040'),('085040'),('085041'),('085041'),('085041'),('085041'),('085041'),('085041'),('085041'),('085041'),('085042'),('085042'),('085042'),('085042'),('085042'),('085042'),('085042'),('085043'),('085043'),('085043'),('085043'),('085043'),('085043'),('085044'),('085044'),('085044'),('085044'),('085044'),('085044'),('085044'),('085045'),('085045'),('085045'),('085045'),('085045'),('085046'),('085046'),('085046'),('085046'),('085046'),('085046'),('085046'),('085046'),('085047'),('085047'),('085047'),('085047'),('085047'),('085047'),('085047'),('085047'),('085048'),('085048'),('085048'),('085048'),('085048'),('085048'),('085048'),('085063'),('085063'),('085063'),('085063'),('085063'),('085064'),('085064'),('085064'),('085064'),('085064'),('085065'),('085065'),('085068'),('085068'),('085068'),('085068'),('085068'),('085068'),('085071'),('085071'),('085071'),('085071'),('085071'),('085071'),('085073'),('085073'),('085082'),('085082'),('085082'),('085082'),('085082'),('085086'),('085086'),('085086'),('085088'),('085088'),('085088'),('085088'),('085088'),('085088'),('085088'),('085089'),('085089'),('085090'),('085090'),('085090'),('085090'),('085090'),('085090'),('085090'),('085090'),('085091'),('085091'),('085091'),('085091'),('085091'),('085092'),('085092'),('085092'),('085093'),('085093'),('085095'),('085095'),('085095'),('085095'),('085095'),('085096'),('085096'),('085096'),('085096'),('085096'),('085096'),('085097'),('085097'),('085097'),('085097'),('085097'),('085098'),('085098'),('085098'),('085098'),('085098'),('085098'),('085098'),('085099'),('085099'),('085099'),('085099'),('085099'),('085099'),('085099'),('085100'),('085100'),('085100'),('085100'),('085100'),('085100'),('085100'),('085100'),('085100'),('085100'),('085101'),('085101'),('085101'),('085101'),('085101'),('085101'),('085101'),('085101'),('085102'),('085102'),('085103'),('085103'),('085103'),('085104'),('085104'),('085104'),('085104'),('085104'),('085105'),('085105'),('085106'),('085106'),('085106'),('085106'),('085106'),('085106'),('085108'),('085108'),('085109'),('085109'),('085109'),('085109'),('085109'),('085109'),('085109'),('085109'),('085110'),('085110'),('085110'),('085110'),('085110'),('085111'),('085111'),('085111'),('085112'),('085112'),('085112'),('085112'),('085113'),('085113'),('085113'),('085113'),('085113'),('085115'),('085120'),('085121'),('085121'),('085121'),('085121'),('085122'),('085122'),('085122'),('085122'),('085122'),('085122'),('085122'),('085122'),('085123'),('085123'),('085123'),('085123'),('085123'),('085123'),('085123'),('085123'),('085125'),('085125'),('085125'),('085125'),('085125'),('085126'),('085126'),('085126'),('085126'),('085126'),('085127'),('085127'),('085127'),('085127'),('085127'),('085127'),('085127'),('085127'),('085128'),('085128'),('085128'),('085128'),('085128'),('085129'),('085129'),('085129'),('085129'),('085129'),('085130'),('085130'),('085130'),('085130'),('085130'),('085132'),('085132'),('085132'),('085132'),('085132'),('085132'),('085133'),('085133'),('085133'),('085133'),('085133'),('085134'),('085134'),('085134'),('085135'),('085135'),('085135'),('085136'),('085136'),('085136'),('085136'),('085137'),('085137'),('085137'),('085137'),('085137'),('085137'),('085137'),('086002'),('086002'),('086002'),('086002'),('086003'),('086003'),('086003'),('086003'),('086005'),('088001'),('088001'),('088001'),('088001'),('088001'),('088003'),('088003'),('088003'),('088003'),('088003'),('088003'),('088005'),('088005'),('088005'),('088005'),('088005'),('088006'),('088006'),('088006'),('088006'),('088006'),('088007'),('088007'),('088007'),('088008'),('088008'),('088008'),('088008'),('088009'),('088009'),('088009'),('088009'),('088009'),('089001'),('089001'),('089001'),('089001'),('089001'),('089001'),('089001'),('090001'),('090001'),('090001'),('090001'),('090001'),('090001'),('090001'),('090002'),('090002'),('090002'),('090002'),('090002'),('090002'),('090003'),('090003'),('090003'),('090003'),('090003'),('090003'),('090003'),('090004'),('090004'),('090004'),('090004'),('090004'),('090004'),('090004'),('090006'),('090006'),('090006'),('090006'),('090006'),('090006'),('090006'),('090008'),('090008'),('090008'),('090008'),('090008'),('090009'),('090009'),('090009'),('090009'),('090009'),('090010'),('090010'),('090013'),('090013'),('090013'),('090016'),('090016'),('090017'),('090018'),('090022'),('090027'),('091001'),('091001'),('091001'),('091001'),('091001'),('091001'),('091002'),('091002'),('091002'),('091002'),('091002'),('091002'),('091009'),('091009'),('091009'),('091009'),('091009'),('091011'),('091011'),('091011'),('091011'),('091011'),('091011'),('091011'),('091012'),('091012'),('091013'),('091013'),('091013'),('091013'),('091013'),('091013'),('091015'),('091015'),('091015'),('091015'),('091015'),('091015'),('091016'),('091016'),('091016'),('091016'),('091016'),('091017'),('091017'),('091018'),('091018'),('091018'),('091018'),('093003'),('093003'),('093003'),('093003'),('093003'),('093003'),('099001'),('099001'),('099001'),('099001'),('099001'),('099001'),('099001'),('100001'),('100001'),('100001'),('100001'),('106001'),('113005'),('113005'),('113005'),('113006'),('113006'),('113018'),('113019'),('113020'),('115001'),('115001'),('115001'),('115002'),('115002'),('115003'),('115004'),('115004'),('115004'),('115004'),('115005'),('115005'),('115005'),('115006'),('115006'),('115006'),('115007'),('115007'),('115007'),('115007'),('115007'),('115008'),('115008'),('115008'),('115009'),('115010'),('115010'),('115010'),('115010'),('115010'),('115011'),('115011'),('115011'),('115011'),('115012'),('115012'),('115013'),('115013'),('115013'),('115014'),('115014'),('115014'),('115014'),('115015'),('115015'),('115015'),('115016'),('115016'),('115016'),('115016'),('115017'),('115017'),('115017'),('115017'),('115017'),('115018'),('115018'),('115020'),('115020'),('115021'),('115021'),('115022'),('115022'),('115022'),('115023'),('115023'),('115023'),('115023'),('115023'),('115025'),('115025'),('115025'),('115026'),('115026'),('115027'),('115027'),('115027'),('115028'),('115028'),('115028'),('115028'),('115029'),('115029'),('115029'),('115030'),('115030'),('115030'),('115031'),('115031'),('115032'),('115032'),('115032'),('115033'),('115033'),('115033'),('115033'),('115034'),('115034'),('115034'),('115035'),('115035'),('115036'),('115036'),('115036'),('115036'),('115036'),('115039'),('115040'),('115040'),('115040'),('115041'),('115041'),('115041'),('115041'),('115041'),('115042'),('115042'),('115042'),('115042'),('115042'),('115043'),('115043'),('115043'),('115044'),('115044'),('115044'),('115044'),('115046'),('115046'),('115046'),('115047'),('115048'),('115050'),('115050'),('115050'),('115050'),('115050'),('115051'),('115051'),('115051'),('115052'),('115053'),('115053'),('115054'),('115054'),('115054'),('115055'),('115055'),('115055'),('115057'),('115059'),('115059'),('115059'),('115059'),('115060'),('115060'),('115060'),('115060'),('115060'),('115060'),('115061'),('115061'),('115061'),('115062'),('115062'),('115062'),('115062'),('115064'),('115064'),('115064'),('115065'),('115065'),('115065'),('115065'),('115066'),('115066'),('115066'),('115067'),('115067'),('115067'),('115068'),('115068'),('115068'),('115069'),('115069'),('115069'),('115069'),('115069'),('115070'),('115070'),('115070'),('115071'),('115071'),('115071'),('115072'),('115072'),('115072'),('115073'),('115073'),('115075'),('115075'),('115075'),('115076'),('115076'),('115076'),('115076'),('115076'),('115076'),('115081'),('115081'),('115081'),('115082'),('115082'),('115082'),('115085'),('115085'),('115085'),('115085'),('115085'),('115086'),('115086'),('115086'),('115087'),('115087'),('115088'),('115088'),('115088'),('115088'),('115088'),('115095'),('115095'),('115095'),('115096'),('115096'),('115097'),('115097'),('115098'),('115098'),('115099'),('115101'),('115102'),('115102'),('115102'),('115103'),('115103'),('115104'),('115104'),('115104'),('115104'),('115105'),('115105'),('115106'),('115106'),('115106'),('115106'),('115106'),('115108'),('115109'),('115111'),('115111'),('115111'),('115111'),('115112'),('115112'),('115112'),('115112'),('115112'),('115113'),('115113'),('115113'),('115114'),('115114'),('115114'),('115114'),('115114'),('115115'),('115115'),('115115'),('115115'),('115116'),('115117'),('115117'),('115117'),('115118'),('115118'),('115119'),('115119'),('115119'),('115119'),('115120'),('115121'),('115121'),('115122'),('115122'),('116001'),('116003'),('116003'),('116003'),('116003'),('116004'),('116004'),('116005'),('116005'),('116006'),('116006'),('116006'),('116007'),('116007'),('116008'),('116008'),('116009'),('116009'),('116009'),('116010'),('116010'),('116010'),('116010'),('116011'),('116011'),('116011'),('116011'),('116012'),('116012'),('123001'),('123001'),('123001'),('123001'),('123001'),('124065'),('126001'),('126001'),('126001'),('126001'),('126001'),('126001'),('126001'),('126001'),('126002'),('126002'),('126002'),('126002'),('126002'),('126002'),('126002'),('126002'),('126003'),('126003'),('126003'),('126003'),('126003'),('126003'),('126003'),('126003'),('126003'),('126004'),('126004'),('126004'),('126004'),('126004'),('126004'),('126004'),('126004'),('126004'),('126004'),('126005'),('126005'),('126005'),('126005'),('126005'),('126005'),('126005'),('126005'),('126005'),('126006'),('126006'),('126006'),('126006'),('126006'),('126006'),('126006'),('126006'),('126006'),('126007'),('126007'),('126007'),('126007'),('126007'),('126007'),('126007'),('126008'),('126008'),('126008'),('126008'),('126008'),('126008'),('126008'),('126008'),('126009'),('126009'),('126009'),('126009'),('126009'),('126009'),('126009'),('126009'),('126010'),('126010'),('126010'),('126010'),('126010'),('126010'),('126010'),('126010'),('126010'),('126011'),('126011'),('126011'),('126011'),('126011'),('126011'),('126011'),('126012'),('126012'),('126012'),('126012'),('130001'),('130001'),('130001'),('130001'),('132001'),('132001'),('132001'),('132001'),('132001'),('132002'),('132002'),('132002'),('132002'),('132002'),('132002'),('132002'),('133001'),('133001'),('133008'),('133009'),('133010'),('133011'),('133011'),('133011'),('133011'),('133011'),('133011'),('133012'),('133015'),('133015'),('133015'),('133015'),('133016'),('133018'),('133018'),('133018'),('133018'),('133018'),('133019'),('133021'),('133021'),('133022'),('133022'),('133023'),('133023'),('133024'),('133024'),('133024'),('133024'),('133024'),('133024'),('133025'),('133027'),('133027'),('133027'),('133027'),('133027'),('133028'),('133028'),('133028'),('133029'),('133029'),('133029'),('133029'),('133029'),('133029'),('133030'),('133030'),('133031'),('133031'),('133031'),('134001'),('134001'),('134001'),('135001'),('135001'),('135001'),('135001'),('135001'),('135002'),('135002'),('135002'),('135004'),('135010'),('135010'),('135010'),('135010'),('135010'),('135010'),('137010'),('137011'),('137012'),('137014'),('137015'),('137015'),('137016'),('137019'),('139001'),('140001'),('140001'),('140001'),('140001'),('140001'),('140001'),('141001'),('141001'),('141001'),('141001'),('141001'),('141002'),('141002'),('141002'),('141002'),('141002'),('141003'),('141003'),('141003'),('141003'),('141003'),('141003'),('141003'),('141003'),('141006'),('141006'),('141006'),('141006'),('141006'),('141006'),('141006'),('141006'),('141007'),('141007'),('141007'),('141007'),('141007'),('141009'),('141009'),('141009'),('141009'),('141009'),('141011'),('141011'),('141011'),('141011'),('141011'),('141011'),('141012'),('141014'),('141014'),('141014'),('141014'),('141014'),('141014'),('141014'),('141014'),('141015'),('141015'),('141015'),('141015'),('141015'),('141016'),('141016'),('141016'),('141016'),('141016'),('141016'),('141017'),('141017'),('141017'),('141017'),('141017'),('141017'),('141018'),('141018'),('141018'),('141018'),('141019'),('141019'),('141019'),('141019'),('141020'),('141020'),('141020'),('141020'),('141020'),('141020'),('141020'),('141021'),('141021'),('141021'),('141021'),('141021'),('141021'),('141022'),('141022'),('141022'),('141022'),('141022'),('141022'),('141023'),('141023'),('141023'),('141023'),('141023'),('141023'),('141023'),('141024'),('141025'),('141025'),('141025'),('141026'),('141026'),('141026'),('141026'),('141026'),('141026'),('141027'),('141027'),('141027'),('141027'),('141027'),('141028'),('141028'),('145001'),('145001'),('145001'),('145001'),('145001'),('145001'),('145001'),('145001'),('145001'),('145002'),('145002'),('145002'),('145002'),('145002'),('145002'),('145002'),('145002'),('145002'),('145003'),('145003'),('145003'),('145003'),('145003'),('145003'),('145003'),('145003'),('145003'),('145003'),('145004'),('145004'),('145004'),('145004'),('145004'),('145004'),('145004'),('145004'),('145004'),('145005'),('145005'),('145005'),('145005'),('145005'),('145005'),('145005'),('145005'),('145005'),('145006'),('145006'),('145006'),('145006'),('145006'),('145006'),('145006'),('145006'),('145006'),('145008'),('145008'),('145008'),('145008'),('145008'),('145008'),('145008'),('145008'),('145009'),('145009'),('145009'),('145009'),('145009'),('145009'),('145009'),('145011'),('145011'),('145011'),('145011'),('145011'),('145011'),('145011'),('145011'),('145012'),('145012'),('145012'),('145012'),('145012'),('145012'),('145012'),('145012'),('145013'),('145013'),('145013'),('145013'),('145013'),('145013'),('145013'),('150009'),('150013'),('150014'),('150015'),('150015'),('150015'),('150016'),('150016'),('150017'),('150017'),('150017'),('150017'),('150020'),('152001'),('152001'),('152001'),('152002'),('152003'),('152003'),('152003'),('152003'),('152004'),('152005'),('152006'),('152006'),('152006'),('152006'),('152007'),('154001'),('154002'),('154002'),('155001'),('155001'),('155002'),('155003'),('155004'),('155004'),('155006'),('159001'),('159003'),('160001'),('160001'),('160001'),('160001'),('160002'),('160002'),('161001'),('162002'),('162002'),('162003'),('162003'),('162003'),('162003'),('162003'),('162007'),('162012'),('162012'),('162012'),('163001'),('163001'),('163001'),('163011'),('163015'),('163016'),('163016'),('165001'),('165001'),('165001'),('165001'),('165002'),('165002'),('165002'),('165002'),('165003'),('165003'),('165003'),('165004'),('165004'),('165004'),('165005'),('165005'),('165005'),('165006'),('165006'),('165006'),('165006'),('165007'),('165007'),('165007'),('165007'),('165008'),('165008'),('165008'),('165008'),('165009'),('165009'),('165009'),('165009'),('165010'),('165010'),('165010'),('165011'),('165011'),('165012'),('165012'),('165012'),('165013'),('165013'),('165013'),('165014'),('165014'),('165014'),('165015'),('165015'),('165015'),('165015'),('165016'),('165016'),('165016'),('165017'),('165017'),('165017'),('165017'),('165018'),('165018'),('165018'),('165018'),('165019'),('165019'),('165019'),('165019'),('165020'),('165020'),('165020'),('165020'),('165021'),('165021'),('165021'),('165021'),('165022'),('165022'),('165022'),('165023'),('165024'),('165024'),('165024'),('165025'),('165025'),('165025'),('165026'),('165026'),('165026'),('165028'),('165029'),('165030'),('165030'),('165030'),('165031'),('165031'),('165033'),('165033'),('165034'),('165034'),('165034'),('165035'),('165035'),('165035'),('165036'),('165036'),('165036'),('168003'),('168003'),('168004'),('168005'),('168014'),('169001'),('169001'),('169001'),('169001'),('169001'),('169001'),('169001'),('169001'),('169001'),('169001'),('169002'),('169002'),('169002'),('169002'),('169002'),('169002'),('169002'),('169002'),('169002'),('169002'),('169003'),('169003'),('169003'),('169003'),('169007'),('169007'),('169007'),('169007'),('169007'),('169007'),('169007'),('169007'),('169007'),('169007'),('169008'),('169008'),('169008'),('169008'),('169008'),('169008'),('169008'),('169009'),('169009'),('169009'),('169009'),('169010'),('171006'),('171006'),('171007'),('171007'),('171008'),('171008'),('171008'),('171009'),('171009'),('171009'),('172001'),('176001'),('176001'),('176001'),('176001'),('176001'),('176001'),('176001'),('176002'),('176002'),('176002'),('176002'),('176002'),('176003'),('176003'),('176003'),('176003'),('176003'),('176003'),('177001'),('177001'),('177001'),('177001'),('177001'),('177001'),('179007'),('179007'),('179012'),('179012'),('179012'),('179012'),('179012'),('179012'),('179013'),('179013'),('179013'),('179013'),('179013'),('179013'),('179042'),('179044'),('179045'),('180001'),('180013'),('180014'),('180014'),('180015'),('180017'),('180018'),('180020'),('180020'),('180021'),('180021'),('180027'),('180030'),('180033'),('180035'),('180036'),('180037'),('180038'),('180041'),('180042'),('180045'),('180045'),('180047'),('180048'),('180049'),('180050'),('180054'),('180060'),('180066'),('180067'),('180068'),('180070'),('182001'),('184001'),('184002'),('184005'),('184005'),('184005'),('184005'),('184006'),('184006'),('184006'),('184006'),('184008'),('184008'),('184008'),('184008'),('184009'),('184009'),('184009'),('184009'),('184010'),('184010'),('184010'),('184010'),('184011'),('184011'),('184011'),('184011'),('185001'),('185001'),('185001'),('185001'),('185001'),('185001'),('185001'),('185003'),('185003'),('185003'),('185003'),('185003'),('185003'),('185003'),('187001'),('191002'),('191002'),('192002'),('194003'),('197001'),('197001'),('197001'),('197001'),('197001'),('197001'),('197001'),('197002'),('197002'),('197002'),('197002'),('197002'),('197002'),('197002'),('197003'),('197003'),('197003'),('197003'),('197003'),('197003'),('197003'),('197004'),('197004'),('197004'),('197004'),('197004'),('197004'),('197004'),('197005'),('197005'),('197005'),('197005'),('197005'),('197005'),('197006'),('197006'),('197006'),('197006'),('197006'),('198001'),('198001'),('198001'),('198001'),('198001'),('198001'),('198003'),('198003'),('198003'),('198004'),('198004'),('198004'),('198004'),('198004'),('198004'),('198005'),('198005'),('198005'),('198005'),('198005'),('198005'),('198005'),('198006'),('198006'),('198006'),('198006'),('198006'),('198006'),('198007'),('198007'),('198007'),('198007'),('198007'),('198007'),('198007'),('198008'),('198008'),('198008'),('198008'),('198008'),('198008'),('198009'),('198009'),('198009'),('198009'),('198009'),('198009'),('198009'),('198010'),('198010'),('198010'),('198010'),('198010'),('198010'),('198011'),('198012'),('198012'),('198012'),('198012'),('198015'),('198015'),('198016'),('198016'),('198016'),('198016'),('198016'),('198016'),('198017'),('198017'),('198017'),('198017'),('198017'),('198017'),('201001'),('201001'),('201001'),('201001'),('201001'),('201002'),('202001'),('202001'),('203001'),('203001'),('203001'),('203001'),('203001'),('203001'),('203001'),('203002'),('203002'),('203002'),('203002'),('203003'),('203003'),('203003'),('203003'),('203003'),('203017'),('203017'),('203017'),('203017'),('203017'),('203017'),('203017'),('203017'),('203017'),('203018'),('203018'),('203018'),('203018'),('203018'),('203019'),('203019'),('203019'),('203019'),('203019'),('204001'),('204002'),('205001'),('205001'),('205001'),('205001'),('205001'),('205001'),('205001'),('208001'),('208001'),('208002'),('208002'),('208002'),('208003'),('208003'),('208003'),('208004'),('208004'),('208004'),('208004'),('208004'),('208004'),('208004'),('208005'),('208005'),('208005'),('208005'),('208005'),('209001'),('209001'),('209001'),('209001'),('209001'),('209002'),('209002'),('209002'),('209002'),('209002'),('209003'),('209003'),('209003'),('209003'),('209003'),('210001'),('210001'),('210001'),('210001'),('210001'),('210004'),('210004'),('210004'),('210004'),('210004'),('210004'),('210009'),('210010'),('212001'),('212001'),('212002'),('212002'),('212002'),('212002'),('212003'),('212003'),('212003'),('212004'),('212004'),('212004'),('212005'),('212005'),('212005'),('212005'),('212005'),('212006'),('212006'),('212006'),('212007'),('212007'),('212008'),('212008'),('212008'),('212008'),('212009'),('212009'),('212009'),('212009'),('212010'),('212010'),('212010'),('212010'),('212011'),('212011'),('212012'),('212012'),('212013'),('212013'),('212013'),('218001'),('218004'),('218009'),('218011'),('218011'),('218015'),('218020'),('218021'),('218021'),('218022'),('218022'),('218022'),('218023'),('218024'),('218025'),('218026'),('218026'),('218027'),('218028'),('218029'),('218029'),('218029'),('218030'),('218031'),('221001'),('221001'),('221001'),('221001'),('221001'),('221001'),('221002'),('221002'),('221002'),('221002'),('221002'),('221002'),('221003'),('221003'),('221003'),('221003'),('221003'),('221003'),('221004'),('221004'),('221004'),('221004'),('221004'),('221004'),('221005'),('221005'),('221005'),('221005'),('221005'),('221006'),('221006'),('221006'),('221006'),('221006'),('221007'),('221007'),('221007'),('221007'),('221007'),('221007'),('221008'),('221008'),('221008'),('221008'),('221008'),('221008'),('221009'),('221009'),('221009'),('221009'),('221009'),('221009'),('221010'),('221010'),('221010'),('221010'),('221011'),('221011'),('221011'),('221011'),('221012'),('221012'),('221012'),('221012'),('221012'),('221012'),('221013'),('221013'),('221013'),('221013'),('221013'),('221013'),('223003'),('223003'),('224001'),('224001'),('224002'),('224002'),('224003'),('224007'),('224008'),('225001'),('225002'),('225002'),('225002'),('225003'),('225003'),('225003'),('225003'),('225004'),('225004'),('225004'),('225005'),('225005'),('225005'),('225005'),('225005'),('225005'),('225006'),('225006'),('225006'),('225007'),('225007'),('225007'),('225008'),('225008'),('225008'),('225008'),('225008'),('225009'),('225009'),('225009'),('225010'),('225010'),('225010'),('225011'),('225011'),('225011'),('225011'),('225011'),('225012'),('225012'),('225012'),('225012'),('225012'),('225012'),('225013'),('225013'),('226001'),('226002'),('226003'),('226003'),('226005'),('226005'),('226006'),('226007'),('226007'),('226007'),('226007'),('227011'),('227015'),('227015'),('227041'),('227045'),('227052'),('227056'),('227063'),('227064'),('227066'),('227067'),('227069'),('227071'),('227073'),('227085'),('227116'),('227119'),('227131'),('227133'),('227147'),('229005'),('229005'),('229005'),('233003'),('233004'),('235001'),('235001'),('235002'),('235003'),('235003'),('235003'),('235004'),('235005'),('235005'),('235005'),('235005'),('235005'),('235005'),('235005'),('236001'),('236001'),('236001'),('236001'),('236002'),('236003'),('236003'),('236003'),('236003'),('236003'),('236003'),('238002'),('238002'),('238002'),('238002'),('238002'),('238002'),('238003'),('238003'),('238003'),('238003'),('238003'),('238003'),('238004'),('238004'),('238004'),('238004'),('238004'),('238005'),('238005'),('238005'),('238007'),('238007'),('238007'),('238007'),('238007'),('238007'),('238007'),('238008'),('238008'),('238008'),('238008'),('238008'),('238008'),('238008'),('334005'),('334006'),('337001'),('337001'),('337001'),('337002'),('337002'),('337003'),('337003'),('337003'),('337004'),('343001'),('343001'),('344001'),('344002'),('344003'),('344004'),('344005'),('344005'),('345001'),('345001'),('348001'),('348004'),('348005'),('348005'),('349001'),('349001'),('349002'),('349002'),('349002'),('350001'),('353002'),('353002'),('353002'),('353003'),('355001'),('355002'),('355005'),('355006'),('355006'),('356001'),('358001'),('358001'),('358001'),('359001'),('359001'),('359002'),('359002'),('359002'),('359002'),('360001'),('360001'),('360002'),('360002'),('360003'),('360003'),('360004'),('360004'),('360005'),('360005'),('360005'),('366001'),('366002'),('366002'),('366003'),('366004'),('369001'),('369001'),('373001'),('373002'),('373002'),('373003'),('373003'),('373005'),('373007'),('373008'),('373009'),('373009'),('373010'),('373010'),('373010'),('373011'),('373011'),('373011'),('373011'),('373012'),('373012'),('373012'),('373013'),('373013'),('373014'),('373014'),('373015'),('373015'),('373015'),('373015'),('373017'),('373017'),('373017'),('373017'),('373018'),('373021'),('374002'),('374004'),('374006'),('374007'),('374008'),('374009'),('374010'),('374011'),('374012'),('374015'),('374016'),('382001'),('382002'),('382002'),('384001'),('386001'),('386001'),('386001'),('386001'),('386001'),('386001'),('386001'),('386002'),('386002'),('386002'),('386002'),('386002'),('386002'),('386002'),('386003'),('386003'),('386003'),('386003'),('386003'),('386003'),('386003'),('386003'),('386003'),('386004'),('386004'),('386004'),('386004'),('386004'),('386004'),('386004'),('386004'),('386005'),('386005'),('386005'),('386005'),('386005'),('386005'),('386005'),('386006'),('386006'),('386006'),('386006'),('386006'),('386006'),('386007'),('386007'),('386007'),('386007'),('386007'),('386007'),('386007'),('386007'),('386007'),('386008'),('386008'),('386008'),('386008'),('386008'),('386008'),('386008'),('386008'),('386009'),('386009'),('386009'),('386010'),('386010'),('386010'),('386010'),('386010'),('386010'),('386010'),('386010'),('386011'),('386011'),('386011'),('386011'),('386011'),('386011'),('386011'),('386011'),('386011'),('386012'),('386012'),('386012'),('386012'),('386012'),('386012'),('386012'),('386012'),('386012'),('386013'),('386013'),('386013'),('386013'),('386013'),('386013'),('386013'),('386014'),('386014'),('386014'),('386014'),('389001'),('389002'),('389002'),('389003'),('389003'),('389003'),('389003'),('389004'),('389004'),('389004'),('389004'),('392001'),('393001'),('393002'),('393002'),('393003'),('393004'),('395001'),('395001'),('397001'),('397001'),('397001'),('397002'),('399001'),('399001'),('399001'),('399001'),('399001'),('399001'),('399001'),('399002'),('399002'),('399002'),('399002'),('399002'),('399002'),('399002'),('399003'),('400001'),('400001'),('400001'),('400001'),('400002'),('403002'),('504001'),('504001'),('504002'),('504002'),('504002'),('504004'),('504004'),('504005'),('504006'),('504007'),('504007'),('504007'),('504008'),('504008'),('504009'),('504009'),('504009'),('504009'),('504009'),('504010'),('504011'),('504011'),('504012'),('504012'),('504014'),('504014'),('504014'),('504014'),('504014'),('504014'),('504014'),('504014'),('504017'),('504017'),('504021'),('504021'),('504021'),('504021'),('504021'),('504021'),('504021'),('504022'),('504023'),('504023'),('504024'),('504024'),('504025'),('504025'),('506001'),('506001'),('506001'),('506001'),('506001'),('506001'),('506002'),('506002'),('506002'),('506002'),('506002'),('511001'),('511001'),('511001'),('511001'),('511001'),('511001'),('511001'),('511002'),('511002'),('511002'),('511002'),('511002'),('511002'),('511002'),('511003'),('511003'),('511003'),('511003'),('511003'),('511003'),('511004'),('511004'),('511004'),('511004'),('511004'),('511004'),('511004'),('511005'),('511005'),('511005'),('511005'),('511005'),('511005'),('511005'),('511006'),('511006'),('511006'),('511006'),('511006'),('511006'),('511006'),('511007'),('511007'),('511007'),('511007'),('511007'),('511008'),('511008'),('511008'),('511008'),('511008'),('511008'),('511009'),('511009'),('511009'),('511009'),('511009'),('511009'),('511010'),('511010'),('511010'),('511010'),('511010'),('511010'),('511011'),('511011'),('511011'),('511011'),('511011'),('511011'),('511012'),('511012'),('511012'),('511012'),('511012'),('511012'),('511012'),('511013'),('511013'),('511013'),('511013'),('511013'),('511013'),('511013'),('511014'),('511014'),('511014'),('511014'),('511014'),('511017'),('511018'),('511020'),('511021'),('511022'),('511024'),('511028'),('511029'),('511029'),('511029'),('511029'),('511029'),('511029'),('513001'),('513001'),('513001'),('513001'),('513001'),('513001'),('513001'),('513001'),('513002'),('513002'),('513002'),('513002'),('513002'),('513002'),('513003'),('513003'),('513003'),('513003'),('513003'),('513003'),('513003'),('513003'),('513004'),('513004'),('513004'),('515001'),('515001'),('515001'),('515001'),('515001'),('515002'),('515002'),('515003'),('515003'),('515007'),('515007'),('515008'),('515011'),('515011'),('515011'),('515011'),('515011'),('515011'),('515012'),('515012'),('515012'),('515012'),('515013'),('515013'),('515013'),('515013'),('515013'),('515014'),('515014'),('515014'),('515014'),('515014'),('515015'),('515015'),('515015'),('515015'),('515015'),('518001'),('518002'),('521001'),('521002'),('521002'),('521002'),('521003'),('521003'),('521003'),('521003'),('521004'),('521004'),('521004'),('521004'),('521005'),('521005'),('521005'),('521005'),('521006'),('521006'),('521006'),('521009'),('521010'),('521010'),('521010'),('521010'),('521011'),('521011'),('521011'),('521011'),('521012'),('521013'),('521013'),('521015'),('521016'),('521016'),('523001'),('523001'),('523001'),('523001'),('523001'),('523001'),('523001'),('523002'),('523002'),('523002'),('523002'),('523002'),('523002'),('523003'),('523003'),('523003'),('523003'),('523003'),('523003'),('523003'),('523004'),('523004'),('523004'),('523004'),('523004'),('523004'),('523005'),('523005'),('523005'),('523005'),('523005'),('523005'),('523005'),('523005'),('523006'),('523006'),('523006'),('523006'),('523006'),('523006'),('523006'),('523007'),('523007'),('523007'),('523007'),('523007'),('523007'),('523007'),('524001'),('700001'),('701001'),('701002'),('701003'),('702001'),('702002'),('702004'),('702005'),('704001'),('704004'),('705001'),('706001'),('706002'),('707001'),('707002'),('707003'),('708001'),('710001'),('710002'),('711001'),('711002'),('712001'),('714001'),('714002'),('715001'),('719001'),('719002'),('991002'),('991002'),('991002'),('991003'),('991003'),('991003'),('991003'),('991003'),('991003'),('991003'),('991004'),('991004'),('991004'),('991005'),('991005'),('991005'),('991006'),('991007'),('995001'),('995001'),('995001'),('995001'),('995001'),('995001'),('995001'),('995001'),('995001'),('995001'),('995001'),('996001'),('996001'),('996001'),('996001'),('996001'),('996001'),('996001'),('996001'),('996002'),('996002'),('996003'),('996003'),('996003'),('996003'),('996003'),('998001'),('998001'),('998001'),('998001'),('998001'),('998001'),('998001'),('998001'),('998001'),('998001'),('998002'),('998002'),('998002'),('998002'),('998002'),('998002'),('998002'),('998002'),('998002'),('998002'),('998003'),('998003'),('998003'),('998003'),('998003'),('998003'),('998003'),('998003'),('998004'),('998004'),('998005'),('998005'),('998006'),('998007'),('999001'),('999001'),('999001'),('999001'),('999001'),('999001'),('999001'),('999001'),('999001'),('999001'),('999001'),('999002'),('999002'),('011017'),('011017'),('011017'),('011017'),('011017'),('011017'),('011017'),('011018'),('011018'),('011018'),('011018'),('034001'),('034001'),('034002'),('034002'),('071010'),('071010'),('071010'),('519001'),('126013'),('126013'),('126013'),('126013'),('126013'),('184012'),('184012'),('184012'),('404001'),('405002'),('405002'),('405001'),('405003'),('405006'),('240011'),('240011'),('240011'),('240011'),('240011'),('240011'),('240010'),('240010'),('240010'),('240009'),('240009'),('240009'),('240009'),('240008'),('240008'),('240008'),('240007'),('240007'),('240007'),('240007'),('240007'),('240007'),('240005'),('240005'),('240005'),('240005'),('240005'),('240004'),('240004'),('240004'),('240004'),('240004'),('240003'),('240003'),('240003'),('240003'),('240002'),('240002'),('240002'),('240002'),('240002'),('240002'),('240002'),('240001'),('240001'),('240001'),('240001'),('240001'),('240012'),('240012'),('240012'),('240012'),('240012'),('240013'),('240014'),('240015'),('240015'),('240015'),('240015'),('240015'),('240015'),('240015'),('240015'),('240016'),('240016'),('240016'),('240016'),('240016'),('240016'),('240017'),('240017'),('240017'),('357001'),('357001'),('235006'),('235006'),('235007'),('235007'),('235007'),('235007'),('235007'),('056023'),('056023'),('056023'),('056023'),('056023'),('046015'),('019005'),('019005'),('126014'),('126014'),('126014'),('126014'),('126014'),('126014'),('241003'),('241003'),('241003'),('241003'),('241003'),('241003'),('241002'),('241002'),('241002'),('241002'),('241002'),('241002'),('241001'),('241001'),('241001'),('241001'),('241001'),('240020'),('240020'),('240020'),('240020'),('240020'),('240020'),('240019'),('240019'),('240019'),('242001'),('242002'),('242004'),('242005'),('242006'),('089002'),('089002'),('089002'),('089002'),('089002'),('089002'),('406001'),('406002'),('406003'),('406004'),('406004'),('243001'),('243005'),('243006'),('243007'),('243008'),('408001'),('408001'),('408001'),('408001'),('408001'),('366005'),('366005'),('016035'),('016035'),('016035'),('016035'),('077010'),('996004'),('996004'),('996004'),('996004'),('996004'),('996004'),('996004'),('996004'),('025064'),('025064'),('025064'),('025064'),('011019'),('011019'),('011019'),('011019'),('011019'),('115123'),('115123'),('504026'),('039007'),('039009'),('039008'),('039008'),('039010'),('039010'),('039011'),('039012'),('180072'),('240021'),('240021'),('240021'),('240021'),('240021'),('240021'),('240021'),('240023'),('240023'),('240023'),('240023'),('405008'),('405008'),('525002'),('410002'),('410002'),('410004'),('410005'),('410005'),('410006'),('410007'),('410007'),('410008'),('410009'),('410010'),('410011'),('410011'),('410012'),('410012'),('410013'),('410013'),('410014'),('410014'),('410016'),('410016'),('344006'),('240031'),('240031'),('240031'),('240031'),('240030'),('240030'),('240030'),('240030'),('240029'),('240029'),('240029'),('240029'),('240028'),('240028'),('240028'),('240028'),('240027'),('240027'),('240026'),('240026'),('240026'),('240025'),('240025'),('240025'),('240025'),('240024'),('240024'),('240034'),('240034'),('240034'),('240033'),('240033'),('240033'),('240032'),('240032'),('240032'),('240032'),('411001'),('411002'),('203020'),('069025'),('069025'),('069025'),('069025'),('069025'),('069025'),('244001'),('244001'),('244001'),('244001'),('244001'),('244001'),('244001'),('244001'),('244001'),('244001'),('244001'),('244002'),('244002'),('244002'),('244002'),('244002'),('244002'),('244002'),('244002'),('244002'),('244002'),('244002'),('244009'),('244009'),('244009'),('244009'),('244009'),('244009'),('244009'),('244009'),('244009'),('244009'),('244009'),('244008'),('244008'),('244008'),('244008'),('244008'),('244008'),('244008'),('244008'),('244008'),('244008'),('244008'),('244007'),('244007'),('244007'),('244007'),('244007'),('244007'),('244007'),('244007'),('244007'),('244007'),('244007'),('244006'),('244006'),('244006'),('244006'),('244006'),('244006'),('244006'),('244006'),('244006'),('244006'),('244006'),('244004'),('244004'),('244004'),('244004'),('244004'),('244004'),('244004'),('244004'),('244004'),('244004'),('244004'),('244003'),('244003'),('244003'),('244003'),('244003'),('244003'),('244003'),('244003'),('244003'),('244003'),('244003'),('244014'),('244014'),('244014'),('244014'),('244014'),('244014'),('244014'),('244014'),('244013'),('244013'),('244013'),('244013'),('244013'),('244013'),('244013'),('244013'),('244012'),('244012'),('244012'),('244012'),('244012'),('244012'),('244012'),('244012'),('244011'),('244011'),('244011'),('244011'),('244011'),('244011'),('244011'),('244011'),('244016'),('244016'),('244016'),('244016'),('244016'),('244016'),('244016'),('244016'),('244016'),('244016'),('244016'),('244017'),('244017'),('244017'),('244017'),('244017'),('244017'),('244017'),('244017'),('244017'),('240040'),('240037'),('405009'),('405009'),('405009'),('405010'),('405010'),('240043'),('240043'),('504028'),('504040'),('800001'),('410019'),('410019'),('410020'),('410020'),('410020'),('410021'),('410021'),('244018'),('244018'),('244018'),('244018'),('244018'),('244018'),('244018'),('244018'),('244018'),('244018'),('244018'),('244019'),('244019'),('244019'),('244019'),('244019'),('244019'),('244019'),('244019'),('244019'),('244019'),('244019'),('244020'),('244020'),('244020'),('244020'),('244020'),('244020'),('244020'),('244020'),('413001'),('344007'),('082045'),('082045'),('082045'),('082045'),('082045'),('010031'),('010031'),('010031'),('010031'),('010032'),('010032'),('010032'),('010032'),('010033'),('010033'),('010033'),('010033'),('010033'),('010034'),('010034'),('010034'),('010034'),('010035'),('010035'),('010035'),('010035'),('504044'),('515016'),('515016'),('515016'),('515016'),('801002'),('801003'),('801004'),('801005'),('802001'),('801001'),('414001'),('141029'),('803001'),('803002'),('803004'),('803005'),('803006'),('803007'),('803008'),('803009'),('803013'),('803014'),('803015'),('803016'),('803017'),('410022'),('410023'),('410023'),('803019'),('415002'),('415001'),('244021'),('244021'),('244021'),('244021'),('244021'),('244021'),('244021'),('011020'),('011020'),('011020'),('011020'),('011023'),('011023'),('011023'),('011023'),('011022'),('011022'),('011022'),('011022'),('011022'),('011022'),('011021'),('011021'),('011021'),('011021'),('025065'),('025065'),('025065'),('025065'),('165037'),('165037'),('165038'),('165038'),('165038'),('165039'),('416001'),('416001'),('416001'),('416001'),('416001'),('416002'),('416003'),('417001'),('418001'),('504045'),('504045'),('504045'),('803022'),('240022'),('240022'),('240022'),('240022'),('420001'),('420001'),('420001'),('420001'),('804010'),('804005'),('804002'),('804018'),('804013'),('511019'),('511016'),('511015'),('511032'),('511031'),('511030'),('511027'),('511026'),('511025'),('511033'),('511023'),('133034'),('133034'),('133034'),('133033'),('169011'),('169011'),('169011'),('169011'),('169011'),('344008'),('244022'),('244022'),('244022'),('244022'),('244022'),('244022'),('244022'),('244026'),('244026'),('244026'),('244026'),('244026'),('244026'),('244025'),('244025'),('244025'),('244025'),('244025'),('244025'),('244025'),('244025'),('244030'),('244030'),('244030'),('244030'),('244030'),('244030'),('244030'),('244030'),('244023'),('244023'),('244023'),('244023'),('244023'),('244023'),('244024'),('244024'),('244024'),('244024'),('244024'),('244024'),('244024'),('244024'),('244027'),('244027'),('244027'),('244027'),('244027'),('244027'),('244027'),('244027'),('244028'),('244028'),('244028'),('244028'),('244028'),('244028'),('244028'),('244028'),('244029'),('244029'),('244029'),('244029'),('244029'),('244029'),('244029'),('244029'),('244031'),('244031'),('244031'),('244031'),('244031'),('244031'),('244031'),('244031'),('082046'),('082046'),('082046'),('082046'),('082047'),('082047'),('082048'),('082048'),('126015'),('126015'),('126016'),('126016'),('126016'),('126016'),('126016'),('416005'),('421001'),('421001'),('421002'),('016037'),('016037'),('016037'),('016037'),('016036'),('016036'),('016036'),('016036'),('115124'),('115124'),('115126'),('240049'),('240049'),('240048'),('240048'),('240047'),('240047'),('240046'),('240046'),('240045'),('240044'),('244032'),('244033'),('422002'),('422004'),('422004'),('422004'),('422005'),('422005'),('184013'),('184013'),('184013'),('805001'),('805002'),('805003'),('805004'),('805005'),('056024'),('056024'),('056024'),('423001'),('344010'),('235009'),('235009'),('235009'),('235009'),('212014'),('212014'),('056025'),('056025'),('056025'),('056026'),('056026'),('056026'),('056026'),('056026'),('056026'),('244034'),('244034'),('244034'),('244034'),('244034'),('244034'),('244035'),('244035'),('244035'),('244035'),('244035'),('244035'),('244035'),('244036'),('244036'),('244036'),('244036'),('244036'),('244036'),('244036'),('244037'),('244037'),('244037'),('244037'),('244037'),('244037'),('244037'),('244038'),('244038'),('244038'),('244038'),('244038'),('244038'),('244038'),('244039'),('244039'),('244039'),('244039'),('244039'),('244039'),('244039'),('203015'),('245002'),('245002'),('245001'),('245001'),('056029'),('056030'),('056032'),('424001'),('056034'),('056034'),('056034'),('056034'),('056033'),('056033'),('056033'),('805006'),('805007'),('805008'),('805009'),('805010'),('422008'),('422008'),('422007'),('422007'),('422006'),('422006'),('422010'),('422009'),('422009'),('422011'),('422011'),('209004'),('209004'),('150022'),('100002'),('056035'),('056035'),('056035'),('023036'),('023036'),('185005'),('246001'),('246001'),('247001'),('247001'),('247001'),('247001'),('247001'),('247001'),('247001'),('247002'),('247002'),('425001'),('416006'),('416006'),('165042'),('165041'),('165040'),('165043'),('010040'),('010039'),('010038'),('010036'),('248001'),('248002'),('248003'),('248004'),('248005'),('249001'),('249003'),('249004'),('249005'),('250007'),('250001'),('250002'),('250003'),('250004'),('250005'),('250006'),('250008'),('250009'),('250010'),('250011'),('250012'),('250013'),('251001'),('251002'),('806001'),('806002'),('235010'),('243009'),('249007'),('249008'),('249009'),('011024'),('011025'),('429001'),('429001'),('429002'),('429002'),('429003'),('429003');
-select field from t1 group by field;
-drop table t1;
-
-#
-# Test of enum with space
-#
-
-create table t1 (a enum (' ','a','b') not null);
-show create table t1;
-drop table t1;
-create table t1 (a enum (' ','a','b ') not null default 'b ');
-show create table t1;
-drop table t1;
-
-#
-# Tests of wrong enum values (bug #2023)
-#
-
-create table t1 (a enum ('0','1'));
-insert ignore into t1 set a='foobar';
-select * from t1;
-update ignore t1 set a = replace(a,'x','y');
-select * from t1;
-drop table t1;
-
-#
-# Bug #2077
-#
-
-set names latin1;
-create table t1 (a enum(0xE4, '1', '2') not null default 0xE4);
-show columns from t1;
-show create table t1;
-drop table t1;
-
-
-#
-# Bug #5628 German characters in field-defs will be '?'
-# with some table definitions
-#
-set names latin1;
-CREATE TABLE t1 (
- a INT default 1,
- b ENUM('value','_value','') character set latin1 NOT NULL
-);
-show create table t1;
-show columns from t1;
-drop table t1;
-
-#
-# Bugs #6154, 6206: ENUMs are not case sensitive even if declared BINARY
-#
-CREATE TABLE t1 (c enum('a', 'A') BINARY);
-INSERT INTO t1 VALUES ('a'),('A');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c enum('ae','oe','ue','ss') collate latin1_german2_ci);
-INSERT INTO t1 VALUES (''),(''),(''),('');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-#
-# Bug #6379: ENUM values are incorrectly converted
-#
-# Check latin1 -> utf8 conversion
-#
-CREATE TABLE t1 (
- a ENUM('','','') character set utf8 default ''
-);
-show create table t1;
-insert into t1 values (''), (''), ('');
-select a from t1 order by a;
-drop table t1;
-
-#
-# Now check utf8 -> latin1 conversion
-# This test emulates loading a script generated with mysqldump
-#
-set names utf8;
-CREATE TABLE t1 (
- a ENUM('ä','ö','ü') character set latin1 default 'ü'
-);
-insert into t1 values ('ä'),('ö'),('ü');
-# Now check what has been loaded
-set names latin1;
-show create table t1;
-select a from t1 order by a;
-drop table t1;
-
-#
-# Test bug where enum fields where extended for each ALTER TABLE
-#
-
-create table t1 (a enum ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin);
-insert into t1 values ('Y');
-alter table t1 add b set ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin;
-alter table t1 add c enum ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin;
---enable_metadata
-select * from t1;
---disable_metadata
-drop table t1;
-
-#
-# Bug #6840 Default value is not checked in ALTER column SET DEFAULT 'x'
-#
-create table t1 (a enum('x','y') default 'x');
---error 1067
-alter table t1 alter a set default 'z';
-drop table t1;
-
-create table t1 (a set('x','y') default 'x');
---error 1067
-alter table t1 alter a set default 'z';
-drop table t1;
-
-
-#
-# Bug#20922 mysql removes a name of first column in a table
-#
-create table t1 (f1 int);
-alter table t1 add f2 enum(0xFFFF);
-show create table t1;
-drop table t1;
-
-#
-# Bug#24660 "enum" field type definition problem
-#
-create table t1(russian enum('E','F','EF','FE') NOT NULL DEFAULT'E');
-show create table t1;
-drop table t1;
-
-create table t1(denormal enum('E','F','E,F','F,E') NOT NULL DEFAULT'E');
-show create table t1;
-drop table t1;
-
-create table t1(russian_deviant enum('E','F','EF','F,E') NOT NULL DEFAULT'E');
-show create table t1;
-drop table t1;
-
-# ER_WRONG_FIELD_TERMINATORS
---error 1083
-create table t1(exhausting_charset enum('ABCDEFGHIJKLMNOPQRSTUVWXYZ','
-  !"','#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~','xx\','yy\','zz'));
-
-#
-# Bug #29251: MySQL coerces special 0 enum values to normal '' value
-# when ALTERing the column
-#
-
-CREATE TABLE t1 (
- id INT AUTO_INCREMENT PRIMARY KEY,
- c1 ENUM('a', '', 'b')
-);
-INSERT IGNORE INTO t1 (c1) VALUES (0), ('a'), (''), ('b');
-SELECT id, c1 + 0, c1 FROM t1;
-
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-ALTER TABLE t1 CHANGE c1 c1 ENUM('a', '') NOT NULL;
-SELECT id, c1 + 0, c1 FROM t1;
-
-DROP TABLE t1;
-
---echo End of 4.1 tests
-
-#
-# Bug#28729: Field_enum wrongly reported an error while storing an empty string.
-#
-SET sql_mode='';
-create table t1(f1 enum('a','b'), index(f1));
-insert into t1 values(''),(''),('a'),('b');
-select * from t1 where f1='';
-drop table t1;
-SET sql_mode=DEFAULT;
-
-#
-# Bug#29360: Confluence of the special 0 enum value with the normal empty string
-# value during field to field copy.
-#
-
-CREATE TABLE t1 (c1 ENUM('a', '', 'b'));
-INSERT INTO t1 (c1) VALUES ('b');
-INSERT INTO t1 (c1) VALUES ('');
-INSERT IGNORE INTO t1 (c1) VALUES (0);
-INSERT INTO t1 (c1) VALUES ('');
-
-SELECT c1 + 0, COUNT(c1) FROM t1 GROUP BY c1;
-
-CREATE TABLE t2 SELECT * FROM t1;
-SELECT c1 + 0 FROM t2;
-
-DROP TABLE t1,t2;
-
-#
-# Bug#29661: Lookup by 0 for a primary index over a enum type
-#
-
-CREATE TABLE t1(a enum('a','b','c','d'));
-INSERT INTO t1 VALUES (4),(1),(0),(3);
-
-SELECT a FROM t1;
-
-EXPLAIN SELECT a FROM t1 WHERE a=0;
-SELECT a FROM t1 WHERE a=0;
-
-ALTER TABLE t1 ADD PRIMARY KEY (a);
-
-EXPLAIN SELECT a FROM t1 WHERE a=0;
-SELECT a FROM t1 WHERE a=0;
-
-DROP TABLE t1;
-
---echo End of 5.1 tests
-
---echo #
---echo # MDEV-4241: Assertion failure: scale >= 0 && precision > 0 &&
---echo # scale <= precision in decimal_bin_size
---echo #
-CREATE TABLE t1 (
- f1 enum('1','2','3','4','5')
-) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(2);
---enable_metadata
-SELECT AVG(f1) FROM t1;
---disable_metadata
-drop table t1;
-
---echo End of 5.3 tests
-
---echo #
---echo # Start of 10.0 tests
---echo #
-
---echo #
---echo # MDEV-6950 Bad results with joins comparing DATE/DATETIME and INT/ENUM/VARCHAR columns
---echo #
-
-CREATE TABLE t1 (c1 DATE PRIMARY KEY);
-INSERT INTO t1 VALUES ('2001-01-01');
-CREATE TABLE t2 (c1 ENUM('2001-01-01','2001/01/01'));
-INSERT INTO t2 VALUES ('2001-01-01');
-INSERT INTO t2 VALUES ('2001/01/01');
-SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1;
-SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1;
-ALTER TABLE t2 ADD PRIMARY KEY(c1);
-SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1;
-EXPLAIN SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1;
-SELECT t1.* FROM t1 LEFT JOIN t2 USING (c1);
---echo # t2 should NOT be eliminated
-EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 USING (c1);
-DROP TABLE t1, t2;
-
---echo #
---echo # MDEV-6978 Bad results with join comparing case insensitive VARCHAR/ENUM/SET expression to a _bin ENUM column
---echo #
-CREATE TABLE t1 (c1 ENUM('a') CHARACTER SET latin1 PRIMARY KEY);
-INSERT INTO t1 VALUES ('a');
-CREATE TABLE t2 (c1 ENUM('a','A') CHARACTER SET latin1 COLLATE latin1_bin);
-INSERT INTO t2 VALUES ('a'),('A');
-SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1;
-SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1;
-ALTER TABLE t2 ADD PRIMARY KEY(c1);
-SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1;
-SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1;
---echo # t2 should NOT be eliminated
-EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1;
-DROP TABLE IF EXISTS t1,t2;
-
-CREATE TABLE t1 (c1 SET('a') CHARACTER SET latin1 PRIMARY KEY);
-INSERT INTO t1 VALUES ('a');
-CREATE TABLE t2 (c1 ENUM('a','A') CHARACTER SET latin1 COLLATE latin1_bin);
-INSERT INTO t2 VALUES ('a'),('A');
-SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1;
-SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1;
-ALTER TABLE t2 ADD PRIMARY KEY(c1);
-SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1;
-SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1;
---echo # t2 should NOT be eliminated
-EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1;
-DROP TABLE IF EXISTS t1,t2;
-
-CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET latin1 PRIMARY KEY);
-INSERT INTO t1 VALUES ('a');
-CREATE TABLE t2 (c1 ENUM('a','A') CHARACTER SET latin1 COLLATE latin1_bin);
-INSERT INTO t2 VALUES ('a'),('A');
-SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1;
-SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1;
-ALTER TABLE t2 ADD PRIMARY KEY(c1);
-SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1;
-SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1;
---echo # t2 should NOT be eliminated
-EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1;
-DROP TABLE IF EXISTS t1,t2;
-
---echo #
---echo # MDEV-6991 GROUP_MIN_MAX optimization is erroneously applied in some cases
---echo #
-CREATE TABLE t1 (id INT NOT NULL, a ENUM('04','03','02','01')) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,'01');
-INSERT INTO t1 VALUES (1,'02');
-INSERT INTO t1 VALUES (1,'03');
-INSERT INTO t1 VALUES (1,'04');
-INSERT INTO t1 VALUES (2,'01');
-INSERT INTO t1 VALUES (2,'02');
-INSERT INTO t1 VALUES (2,'03');
-INSERT INTO t1 VALUES (2,'04');
-INSERT INTO t1 VALUES (3,'01');
-INSERT INTO t1 VALUES (3,'02');
-INSERT INTO t1 VALUES (3,'03');
-INSERT INTO t1 VALUES (3,'04');
-INSERT INTO t1 VALUES (4,'01');
-INSERT INTO t1 VALUES (4,'02');
-INSERT INTO t1 VALUES (4,'03');
-INSERT INTO t1 VALUES (4,'04');
-SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>='02' GROUP BY id;
-SELECT id,MIN(a),MAX(a) FROM t1 WHERE a<=3 GROUP BY id;
-ALTER TABLE t1 ADD KEY(id,a);
-SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>='02' GROUP BY id;
---echo # Should NOT use group_min_max optimization
-EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>='02' GROUP BY id;
-SELECT id,MIN(a),MAX(a) FROM t1 WHERE a<=3 GROUP BY id;
---echo # Should NOT use group_min_max optimization
-EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a<=3 GROUP BY id;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-6993 Bad results with join comparing DECIMAL and ENUM/SET columns
---echo #
-CREATE TABLE t1 (c1 DECIMAL(10,1) PRIMARY KEY);
-INSERT INTO t1 VALUES (1),(2);
-CREATE TABLE t2 (c1 ENUM('a','b'));
-INSERT INTO t2 VALUES ('a'),('b');
-SELECT t1.* FROM t1 NATURAL JOIN t2;
-ALTER TABLE t2 ADD PRIMARY KEY(c1);
-SELECT t1.* FROM t1 NATURAL JOIN t2;
-SELECT t1.* FROM t1 LEFT OUTER JOIN t2 USING (c1);
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (a DECIMAL(10,1), b ENUM('1','2'));
-INSERT INTO t1 (a) VALUES (1),(2);
-UPDATE t1 SET b=a;
-SELECT * FROM t1;
-ALTER TABLE t1 MODIFY a ENUM('1','2');
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # End of 10.0 tests
---echo #
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-8729 Wrong result for SELECT..WHERE HEX(enum_column)='61' AND enum_column='a '
---echo #
-CREATE TABLE t1 (a ENUM('a','A') CHARACTER SET latin1 COLLATE latin1_bin);
-INSERT INTO t1 VALUES ('a'),('A');
-SELECT * FROM t1 WHERE a='a ';
-SELECT * FROM t1 WHERE HEX(a)='61';
-SELECT * FROM t1 WHERE HEX(a)='61' AND a='a ';
---echo # Can't propagate the equality into HEX(a), because binary collations still ignore trailing spaces
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a ';
-DROP TABLE t1;
-
-CREATE TABLE t1 (a ENUM('a','a ') CHARACTER SET BINARY);
-INSERT INTO t1 VALUES ('a'),('a ');
-SELECT * FROM t1 WHERE a='a ';
-SELECT * FROM t1 WHERE HEX(a)='61';
-SELECT * FROM t1 WHERE HEX(a)='61' AND a='a';
-SELECT * FROM t1 WHERE HEX(a)='61' AND a='a ';
---echo # Ok to propagate the equality into HEX(a), because "CHARACTER SET BINARY" does not ignore trailing spaces
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a';
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a ';
-DROP TABLE t1;
-
---echo #
---echo # End of 10.1 tests
---echo #
-
-
---echo #
---echo # MDEV-9340 Copying from INT/DOUBLE to ENUM is inconsistent
---echo #
-
-# DOUBLE -> ENUM
-CREATE TABLE t1 (a ENUM('9e200','9e100'));
-CREATE TABLE t2 (a DOUBLE);
-INSERT INTO t2 VALUES ('9e100');
-INSERT IGNORE INTO t1 SELECT * FROM t2;
-SELECT * FROM t1;
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (a DOUBLE);
-INSERT INTO t1 VALUES (9e100);
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-ALTER TABLE t1 MODIFY a ENUM('9e200','9e100');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a ENUM('200','100'));
-CREATE TABLE t2 (a DOUBLE);
-INSERT INTO t2 VALUES ('100');
-INSERT IGNORE INTO t1 SELECT * FROM t2;
-SELECT * FROM t1;
-DROP TABLE t1,t2;
-
-# INT -> ENUM
-CREATE TABLE t1 (a ENUM('200','100'));
-CREATE TABLE t2 (a INT);
-INSERT INTO t2 VALUES ('100');
-INSERT IGNORE INTO t1 SELECT * FROM t2;
-SELECT * FROM t1;
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES ('200');
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-ALTER TABLE t1 MODIFY a ENUM('200','100');
-SELECT *FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a ENUM('200','100'));
-CREATE TABLE t2 (a INT);
-INSERT INTO t2 VALUES ('100');
-INSERT IGNORE INTO t1 SELECT * FROM t2;
-SELECT * FROM t1;
-DROP TABLE t1,t2;
-
-
-# YEAR -> ENUM
-CREATE TABLE t1 (a ENUM('2001','2002'));
-CREATE TABLE t2 (a YEAR);
-INSERT INTO t2 VALUES ('2001');
-INSERT IGNORE INTO t1 SELECT * FROM t2;
-SELECT * FROM t1;
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (a YEAR);
-INSERT INTO t1 VALUES ('2001');
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-ALTER TABLE t1 MODIFY a ENUM('2001','2002');
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Start of 10.3 tests
---echo #
-
---echo #
---echo # MDEV-12432 Range optimizer for ENUM and SET does not return "Impossible WHERE" in some case
---echo #
-
-CREATE TABLE t1 (a ENUM('a','b','c','1'),KEY(a));
-INSERT INTO t1 VALUES ('a'),('b'),('c'),('1');
-EXPLAIN SELECT * FROM t1 WHERE a='xx';
-EXPLAIN SELECT * FROM t1 WHERE a='99999999';
-EXPLAIN SELECT * FROM t1 WHERE a=100.1e0;
-EXPLAIN SELECT * FROM t1 WHERE a=100;
-EXPLAIN SELECT * FROM t1 WHERE a=100.1;
-EXPLAIN SELECT * FROM t1 WHERE a='100';
-EXPLAIN SELECT * FROM t1 WHERE a='1x';
-EXPLAIN SELECT * FROM t1 WHERE a='1.0';
-EXPLAIN SELECT * FROM t1 WHERE a='1.1';
-DROP TABLE t1;
-
---echo #
---echo # MDEV-12656 Crash in CREATE..SELECT..UNION with a ENUM column and NULL
---echo #
-
-CREATE TABLE t1 (a ENUM('a'));
---echo # non-UNION + table column
-CREATE TABLE t2 AS SELECT (SELECT a FROM t1);
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
---echo # UNION + table column
-CREATE TABLE t2 AS SELECT (SELECT a FROM t1 UNION SELECT NULL);
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
---echo # UNION + SP variable
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE va ENUM('a');
- CREATE TABLE t2 AS SELECT (SELECT va FROM t1 UNION SELECT NULL);
- SHOW CREATE TABLE t2;
- DROP TABLE t2;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP PROCEDURE p1;
---echo # UNION + anchored SP variable
-DELIMITER $$;
-CREATE PROCEDURE p1()
-BEGIN
- DECLARE va TYPE OF t1.a;
- CREATE TABLE t2 AS SELECT (SELECT va FROM t1 UNION SELECT NULL);
- SHOW CREATE TABLE t2;
- DROP TABLE t2;
-END;
-$$
-DELIMITER ;$$
-CALL p1();
-DROP PROCEDURE p1;
-DROP TABLE t1;
diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test
deleted file mode 100644
index 2d7c4428507..00000000000
--- a/mysql-test/t/type_float.test
+++ /dev/null
@@ -1,553 +0,0 @@
-# Description
-# -----------
-# Numeric floating point.
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-SELECT 10,10.0,10.,.1e+2,100.0e-1;
-SELECT 6e-16, -6e-16, --6e-16, -6e-16+1.000000;
-SELECT 1e1,1.e1,1.0e1,1e+1,1.e+1,1.0e+1,1e-1,1.e-1,1.0e-1;
-SELECT 0.001e+1,0.001e-1, -0.001e+01,-0.001e-01;
-SELECT 123.23E+02,-123.23E-02,"123.23E+02"+0.0,"-123.23E-02"+0.0;
-SELECT 2147483647E+02,21474836.47E+06;
-
-create table t1 (f1 float(24),f2 float(52));
-# We mask out Privileges column because it differs for embedded server
---replace_column 8 #
-show full columns from t1;
-insert into t1 values(10,10),(1e+5,1e+5),(1234567890,1234567890),(1e+10,1e+10),(1e+15,1e+15),(1e+20,1e+20),(1e+50,1e+50),(1e+150,1e+150);
-insert into t1 values(-10,-10),(1e-5,1e-5),(1e-10,1e-10),(1e-15,1e-15),(1e-20,1e-20),(1e-50,1e-50),(1e-150,1e-150);
-select * from t1;
-drop table t1;
-
-create table t1 (datum double);
-insert into t1 values (0.5),(1.0),(1.5),(2.0),(2.5);
-select * from t1;
-select * from t1 where datum < 1.5;
-select * from t1 where datum > 1.5;
-select * from t1 where datum = 1.5;
-drop table t1;
-
-create table t1 (a decimal(7,3) not null, key (a));
-insert into t1 values ("0"),("-0.00"),("-0.01"),("-0.002"),("1");
-select a from t1 order by a;
-select min(a) from t1;
-drop table t1;
-
-#
-# BUG#3612, BUG#4393, BUG#4356, BUG#4394
-#
-
-create table t1 (c1 double, c2 varchar(20));
-insert t1 values (121,"16");
-select c1 + c1 * (c2 / 100) as col from t1;
-create table t2 select c1 + c1 * (c2 / 100) as col1, round(c1, 5) as col2, round(c1, 35) as col3, sqrt(c1*1e-15) col4 from t1;
-# Floats are a bit different in PS
---disable_ps_protocol
-select * from t2;
---enable_ps_protocol
-show create table t2;
-drop table t1,t2;
-
-# Bug #1022: When a table contains a 'float' field,
-# and one of the functions MAX, MIN, or AVG is used on that field,
-# the system crashes.
-
-create table t1 (a float);
-insert into t1 values (1);
-select max(a),min(a),avg(a) from t1;
-drop table t1;
-
-#
-# FLOAT/DOUBLE/DECIMAL handling
-#
-
-create table t1 (f float, f2 float(24), f3 float(6,2), d double, d2 float(53), d3 double(10,3), de decimal, de2 decimal(6), de3 decimal(5,2), n numeric, n2 numeric(8), n3 numeric(7,6));
-# We mask out Privileges column because it differs for embedded server
---replace_column 8 #
-show full columns from t1;
-drop table t1;
-
-create table t1 (a decimal(7,3) not null, key (a));
-insert into t1 values ("0"),("-0.00"),("-0.01"),("-0.002"),("1");
-select a from t1 order by a;
-select min(a) from t1;
-drop table t1;
-
---error 1425
-create table t1 (a float(200,100), b double(200,100));
-
-#
-# float in a char(1) field
-#
-create table t1 (c20 char);
-insert ignore into t1 values (5000.0);
-insert ignore into t1 values (0.5e4);
-drop table t1;
-
-# Errors
-
---error 1063
-create table t1 (f float(54)); # Should give an error
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-# Don't allow 'double unsigned' to be set to a negative value (Bug #7700)
-create table t1 (d1 double, d2 double unsigned);
-insert into t1 set d1 = -1.0;
-update ignore t1 set d2 = d1;
-select * from t1;
-drop table t1;
-
-# Ensure that maximum values as the result of number of decimals
-# being specified in table schema are enforced (Bug #7361)
-create table t1 (f float(4,3));
-insert ignore into t1 values (-11.0),(-11),("-11"),(11.0),(11),("11");
-select * from t1;
-drop table if exists t1;
-create table t1 (f double(4,3));
-insert ignore into t1 values (-11.0),(-11),("-11"),(11.0),(11),("11");
-select * from t1;
-drop table if exists t1;
-
-# Check conversion of floats to character field (Bug #7774)
-create table t1 (c char(20));
-insert into t1 values (5e-28);
-select * from t1;
-drop table t1;
-create table t1 (c char(6));
-insert into t1 values (2e5),(2e6),(2e-4),(2e-5);
-select * from t1;
-drop table t1;
-
-#
-# Test of comparison of integer with float-in-range (Bug #7840)
-# This is needed because some ODBC applications (like Foxpro) uses
-# floats for everything.
-#
-
-CREATE TABLE t1 (
- reckey int unsigned NOT NULL,
- recdesc varchar(50) NOT NULL,
- PRIMARY KEY (reckey)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-
-INSERT INTO t1 VALUES (108, 'Has 108 as key');
-INSERT INTO t1 VALUES (109, 'Has 109 as key');
-select * from t1 where reckey=108;
-select * from t1 where reckey=1.08E2;
-select * from t1 where reckey=109;
-select * from t1 where reckey=1.09E2;
-drop table t1;
-
-#
-# Bug #13372 (decimal union)
-#
-create table t1 (d double(10,1));
-create table t2 (d double(10,9));
-insert into t1 values ("100000000.0");
-insert into t2 values ("1.23456780");
-create table t3 select * from t2 union select * from t1;
-select * from t3;
-show create table t3;
-drop table t1, t2, t3;
-
-
-#
-# Bug #9855 (inconsistent column type for create select
-#
-create table t1 select 105213674794682365.00 + 0.0 x;
-show warnings;
-desc t1;
-drop table t1;
-
-create table t1 select 0.0 x;
-desc t1;
-create table t2 select 105213674794682365.00 y;
-desc t2;
-create table t3 select x+y a from t1,t2;
-show warnings;
-desc t3;
-drop table t1,t2,t3;
-
-#
-# Bug #22129: A small double precision number becomes zero
-#
-# check if underflows are detected correctly
-select 1e-308, 1.00000001e-300, 100000000e-300;
-
-# check if overflows are detected correctly
-select 10e307;
-
-#
-# Bug #19690: ORDER BY eliminates rows from the result
-#
-create table t1(a int, b double(8, 2));
-insert into t1 values
-(1, 28.50), (1, 121.85), (1, 157.23), (1, 1351.00), (1, -1965.35), (1, 81.75),
-(1, 217.08), (1, 7.94), (4, 96.07), (4, 6404.65), (4, -6500.72), (2, 100.00),
-(5, 5.00), (5, -2104.80), (5, 2033.80), (5, 0.07), (5, 65.93),
-(3, -4986.24), (3, 5.00), (3, 4857.34), (3, 123.74), (3, 0.16),
-(6, -1695.31), (6, 1003.77), (6, 499.72), (6, 191.82);
-explain select sum(b) s from t1 group by a;
-select sum(b) s from t1 group by a;
-select sum(b) s from t1 group by a having s <> 0;
-select sum(b) s from t1 group by a having s <> 0 order by s;
-select sum(b) s from t1 group by a having s <=> 0;
-select sum(b) s from t1 group by a having s <=> 0 order by s;
-alter table t1 add key (a, b);
-explain select sum(b) s from t1 group by a;
-select sum(b) s from t1 group by a;
-select sum(b) s from t1 group by a having s <> 0;
-select sum(b) s from t1 group by a having s <> 0 order by s;
-select sum(b) s from t1 group by a having s <=> 0;
-select sum(b) s from t1 group by a having s <=> 0 order by s;
-drop table t1;
-
---echo End of 4.1 tests
-
-#
-# bug #12694 (float(m,d) specifications)
-#
-
---error 1427
-create table t1 (s1 float(0,2));
---error 1427
-create table t1 (s1 float(1,2));
-
-#
-# MySQL Bugs: #11589: mysqltest --ps-protocol, strange output, float/double/real with zerofill
-#
-
-CREATE TABLE t1 (
- f1 real zerofill,
- f2 double zerofill,
- f3 float zerofill);
-INSERT INTO t1 VALUES ( 0.314152e+1, 0.314152e+1, 0.314152e+1);
-
-let $my_stmt= select f1, f2, f3 FROM t1;
-eval PREPARE stmt1 FROM '$my_stmt';
-select f1, f2, f3 FROM t1;
-eval $my_stmt;
-EXECUTE stmt1;
-
-DROP TABLE t1;
-# Bug #28121 "INSERT or UPDATE into DOUBLE(200,0) field being truncated to 31 digits"
-#
-
-create table t1 (f1 double(200, 0));
-insert into t1 values (1e199), (-1e199);
-insert into t1 values (1e200), (-1e200);
-insert ignore into t1 values (2e200), (-2e200);
-select f1 + 0e0 from t1;
-drop table t1;
-
-create table t1 (f1 float(30, 0));
-insert into t1 values (1e29), (-1e29);
-insert into t1 values (1e30), (-1e30);
-insert ignore into t1 values (2e30), (-2e30);
-select f1 + 0e0 from t1;
-drop table t1;
-
-#
-# Bug #12860 "Difference in zero padding of exponent between Unix and Windows"
-#
-
-create table t1 (c char(6));
-insert into t1 values (2e6),(2e-5);
-select * from t1;
-drop table t1;
-
-#
-# Bug #21497 "DOUBLE truncated to unusable value"
-#
-
-CREATE TABLE d1 (d DOUBLE);
-INSERT INTO d1 VALUES (1.7976931348623157E+308);
-SELECT * FROM d1;
---error ER_ILLEGAL_VALUE_FOR_TYPE
-INSERT INTO d1 VALUES (1.79769313486232e+308);
-SELECT * FROM d1;
-DROP TABLE d1;
-
-#
-# Bug #26788 "mysqld (debug) aborts when inserting specific numbers into char
-# fields"
-#
-
-create table t1 (a char(20));
-insert into t1 values (1.225e-05);
-select a+0 from t1;
-drop table t1;
-
-#
-# Bug #27483: Casting 'scientific notation type' to 'unsigned bigint' fails on
-# windows.
-#
-
-create table t1(d double, u bigint unsigned);
-
-insert into t1(d) values (9.22337203685479e18),
- (1.84e19);
-
-update t1 set u = d;
-select u from t1;
-
-drop table t1;
-
-#
-# Bug #21205: Different number of digits for float/doble/real in --ps-protocol
-#
-
-CREATE TABLE t1 (f1 DOUBLE);
-INSERT INTO t1 VALUES(-1.79769313486231e+308);
-SELECT f1 FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#12406055 BUFFER OVERFLOW OF VARIABLE 'BUFF' IN STRING::SET_REAL
---echo #
-
---echo # Ignoring output from misc. float operations
---disable_result_log
-
-let $nine_65=
-99999999999999999999999999999999999999999999999999999999999999999;
-
-select format(-1.7976931348623157E+307,256) as foo;
-select least(-1.1111111111111111111111111,
- - group_concat(1.7976931348623157E+308)) as foo;
-eval select concat((truncate((-1.7976931348623157E+307),(0x1e))),
- ($nine_65)) into @a;
---enable_result_log
-
---echo End of 5.0 tests
-
---echo #
---echo # Bug#12368853 FORMAT() CRASHES WITH LARGE NUMBERS AFTER TRUNCATE...
---echo #
-
-select format(truncate('1.7976931348623157E+308',-12),1,'fr_BE') as foo;
-
---echo #
---echo # Bug #13500371 63704: CONVERSION OF '1.' TO A NUMBER GIVES ERROR 1265
---echo # (WARN_DATA_TRUNCATED)
---echo #
-
-CREATE TABLE t1 (f FLOAT);
-INSERT INTO t1 VALUES ('1.');
-INSERT IGNORE INTO t1 VALUES ('2.0.');
-INSERT IGNORE INTO t1 VALUES ('.');
-SELECT * FROM t1 ORDER BY f;
-DROP TABLE t1;
-
-
---echo #
---echo # Start of 10.0 tests
---echo #
-
---echo #
---echo # MDEV-6950 Bad results with joins comparing DATE/DATETIME and INT/DECIMAL/DOUBLE/ENUM/VARCHAR columns
---echo #
-CREATE TABLE t1 (a DATETIME PRIMARY KEY);
-INSERT INTO t1 VALUES ('1999-01-01 00:00:00');
-CREATE TABLE t2 (a DOUBLE);
-INSERT INTO t2 VALUES (19990101000000);
-INSERT INTO t2 VALUES (990101000000);
-SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a;
-SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a;
-ALTER TABLE t2 ADD PRIMARY KEY(a);
-SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a;
-SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a;
---echo # t2 should NOT be eliminated
-EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a;
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-6971 Bad results with joins comparing TIME and DOUBLE/DECIMAL columns
---echo #
-CREATE TABLE t1 (a TIME(6) PRIMARY KEY);
-INSERT INTO t1 VALUES ('10:20:30');
-CREATE TABLE t2 (a DOUBLE);
-INSERT INTO t2 VALUES (102030),(102030.000000001);
-SELECT t1.* FROM t1 JOIN t2 USING(a);
-SELECT t1.* FROM t1 LEFT JOIN t2 USING(a);
-ALTER TABLE t2 ADD PRIMARY KEY(a);
-SELECT t1.* FROM t1 JOIN t2 USING(a);
-SELECT t1.* FROM t1 LEFT JOIN t2 USING(a);
---echo # t2 should NOT be elimitated
-EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 USING(a);
-DROP TABLE t1,t2;
-
---echo #
---echo # End of 10.0 tests
---echo #
-
-
---echo #
---echo # MDEV-8704 Wrong result for SELECT..WHERE LENGTH(double_column)!=6 AND double_column=100e0
---echo #
-
-# The original test case from the bug report
-CREATE TABLE t1 (a DOUBLE(9,2));
-INSERT INTO t1 VALUES (100),(110);
-SELECT * FROM t1 WHERE LENGTH(a)!=6;
-SELECT * FROM t1 WHERE LENGTH(a)!=6 AND a=100e0;
-DROP TABLE t1;
-
-# DOUBLE with no specific precision
-CREATE TABLE t1 (a DOUBLE);
-INSERT INTO t1 VALUES (100),(110);
-SELECT * FROM t1 WHERE LENGTH(a)!=6;
-SELECT * FROM t1 WHERE LENGTH(a)!=6 AND a=100e0;
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)!=6 AND a=100e0;
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)!=RAND() AND a=100e0;
-DROP TABLE t1;
-
-# The constant scale is bigger than the field scale
-CREATE TABLE t1 (a DOUBLE(10,1));
-INSERT INTO t1 VALUES (1.1),(1.2),(1.3);
-SELECT * FROM t1 WHERE LENGTH(a)!=3;
-SELECT * FROM t1 WHERE LENGTH(a)!=3 AND a=1.10e0;
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)!=3 AND a=1.10e0;
---echo # Notice 1.1 instead of 1.10 in the final WHERE condition
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)!=RAND() AND a=1.10e0;
-DROP TABLE t1;
-
-# The constant scale is equal to the field scale
-CREATE TABLE t1 (a DOUBLE(10,2));
-INSERT INTO t1 VALUES (1.1),(1.2),(1.3);
-SELECT * FROM t1 WHERE LENGTH(a)!=4;
-SELECT * FROM t1 WHERE LENGTH(a)!=4 AND a=1.10e0;
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)!=4 AND a=1.10e0;
---echo # Notice 1.10 in the final WHERE condition
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)!=RAND() AND a=1.10e0;
-DROP TABLE t1;
-
-# The constant scale is smaller than the field scale
-CREATE TABLE t1 (a DOUBLE(10,3));
-INSERT INTO t1 VALUES (1.1),(1.2),(1.3);
-SELECT * FROM t1 WHERE LENGTH(a)!=5;
-SELECT * FROM t1 WHERE LENGTH(a)!=5 AND a=1.10e0;
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)!=5 AND a=1.10e0;
---echo # Notice 1.100 rather than 1.10 in the final WHERE condition
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)!=RAND() AND a=1.10e0;
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-8741 Equal field propagation leaves some remainders after simplifying WHERE zerofill_column=2010 AND zerofill_column>=2010
---echo #
-CREATE TABLE t1 (a DOUBLE ZEROFILL);
-INSERT INTO t1 VALUES (2010),(2020);
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010e0 AND a>=2010e0;
-DROP TABLE t1;
-
-
---echo #
---echo # End of 10.1 tests
---echo #
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-4102 Limitation on DOUBLE or REAL length is ignored with INSERT .. SELECT
---echo #
-CREATE TABLE t1 (d1 DOUBLE(5,2), d2 DOUBLE(10,2));
-INSERT IGNORE INTO t1 VALUES (10000000.55, 10000000.55);
-INSERT IGNORE INTO t1 SELECT d2, d2 FROM t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-9709 Unexpected modification of value and warning about out of range value upon ALTER
---echo #
-
-CREATE TABLE t1 (
- f FLOAT,
- d10_10 DOUBLE PRECISION (10,10),
- d53_10 DOUBLE(53,10)
-);
-INSERT IGNORE INTO t1 (f,d10_10,d53_10) VALUES (
- -9999999999999999999999999999999999999999999.9999999999,
- -9999999999999999999999999999999999999999999.9999999999,
- -9999999999999999999999999999999999999999999.9999999999
-);
---vertical_results
-SELECT * FROM t1;
-INSERT IGNORE INTO t1 (f,d10_10,d53_10) SELECT d53_10, d53_10, d53_10 FROM t1;
-SELECT * FROM t1;
-ALTER TABLE t1 ADD COLUMN i INT;
-SELECT * FROM t1;
-DROP TABLE t1;
---horizontal_results
-
-CREATE TABLE t1 (d10_10 DOUBLE (10,10));
-CREATE TABLE t2 (d53_10 DOUBLE (53,10));
-INSERT INTO t2 VALUES (-9999999999999999999999999999999999999999999.9999999999);
-INSERT IGNORE INTO t1 (d10_10) SELECT d53_10 FROM t2;
-SELECT * FROM t1;
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (d2_2 FLOAT (2,2));
-CREATE TABLE t2 (d4_2 FLOAT (4,2));
-INSERT INTO t2 VALUES (99.99);
-INSERT IGNORE INTO t1 (d2_2) SELECT d4_2 FROM t2;
-SELECT * FROM t1;
-DROP TABLE t1,t2;
-
---echo #
---echo # Test of using wrong scale
---echo #
-
-create or replace table t1 (a double(40,30));
---error ER_TOO_BIG_SCALE 1425
-create or replace table t1 (a double(40,31));
-create or replace table t1 as select 1.01e1;
-show create table t1;
-create or replace table t1 as select truncate(10.000000000001e1, 30) as t;
-show create table t1;
-create or replace table t1 as select truncate(10.000000000001e1, 31) as t;
-show create table t1;
-create or replace table t1 as select truncate(10.000000000001e1, 39) as t;
-show create table t1;
-create or replace table t1 as select truncate(10.000000000001e1, 51) as t;
-show create table t1;
-create or replace table t1 as select truncate(10.000000000001e1, 20)/2 as t;
-show create table t1;
-create or replace table t1 as select truncate(10.000000000001e1, 28)/2 as t;
-show create table t1;
-
-drop table if exists t1;
-
---echo #
---echo # MDEV-11586 UNION of FLOAT type results in erroneous precision
---echo #
-
-CREATE TABLE t1 (f FLOAT);
-INSERT INTO t1 VALUES (1.1);
-SELECT f FROM t1 UNION SELECT 1;
-SELECT 1 UNION SELECT f FROM t1;
-SELECT f FROM t1 UNION SELECT 2147483647;
-SELECT 2147483647 UNION SELECT f FROM t1;
-SELECT CASE WHEN 0 THEN (SELECT f FROM t1) ELSE 2147483647 END AS c1,
- CASE WHEN 1 THEN 2147483647 ELSE (SELECT f FROM t1) END AS c2;
-DROP TABLE t1;
-
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/type_int.test b/mysql-test/t/type_int.test
deleted file mode 100644
index 271b4d5862a..00000000000
--- a/mysql-test/t/type_int.test
+++ /dev/null
@@ -1,78 +0,0 @@
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-8741 Equal field propagation leaves some remainders after simplifying WHERE zerofill_column=2010 AND zerofill_column>=2010
---echo #
-
-CREATE TABLE t1 (a INT ZEROFILL);
-INSERT INTO t1 VALUES (2010),(2020);
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND a>=2010;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8369 Unexpected impossible WHERE for a condition on a ZEROFILL field
---echo #
-CREATE TABLE t1 (a INT ZEROFILL);
-INSERT INTO t1 VALUES (128),(129);
-SELECT * FROM t1 WHERE a=128;
-SELECT * FROM t1 WHERE hex(a)='80';
-SELECT * FROM t1 WHERE a=128 AND hex(a)='80';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE a=128 AND hex(a)='80';
-DROP TABLE t1;
-
---echo #
---echo # End of 10.1 tests
---echo #
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-9393 Split Copy_field::get_copy_func() into virtual methods in Field
---echo #
-
-# DECIMAL -> INT
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (10.1),(10.9);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (a DECIMAL(10,2));
-INSERT INTO t2 VALUES (10.1),(10.9);
-INSERT INTO t1 SELECT a FROM t2;
-SELECT * FROM t1;
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (a DECIMAL(10,2));
-INSERT INTO t1 VALUES (10.1),(10.9);
-ALTER TABLE t1 MODIFY a INT;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-# TIME -> INT
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (TIME'00:00:10.1'),(TIME'00:00:10.9');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (a TIME(1));
-INSERT INTO t2 VALUES (10.1),(10.9);
-INSERT INTO t1 SELECT a FROM t2;
-SELECT * FROM t1;
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (a TIME(1));
-INSERT INTO t1 VALUES (10.1),(10.9);
-ALTER TABLE t1 MODIFY a INT;
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/type_json.test b/mysql-test/t/type_json.test
deleted file mode 100644
index 0cff9366145..00000000000
--- a/mysql-test/t/type_json.test
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# MDEV-9144 JSON data type
-#
-
-create or replace table t1(a json);
-show create table t1;
-
---error ER_PARSE_ERROR
-create or replace table t1(a json character set utf8);
-
-create or replace table t1(a json default '{a:1}');
-show create table t1;
-
-create or replace table t1(a json not null check (json_valid(a)));
-show create table t1;
-insert t1 values ('[]');
---error ER_CONSTRAINT_FAILED
-insert t1 values ('a');
-
-set timestamp=unix_timestamp('2010:11:12 13:14:15');
-create or replace table t1(a json default(json_object('now', now())));
-show create table t1;
-insert t1 values ();
-select * from t1;
-
-drop table t1;
-
---error ER_PARSE_ERROR
-select cast('{a:1}' as text);
---error ER_PARSE_ERROR
-select cast('{a:1}' as json);
diff --git a/mysql-test/t/type_nchar.test b/mysql-test/t/type_nchar.test
deleted file mode 100644
index f2258830450..00000000000
--- a/mysql-test/t/type_nchar.test
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# Test nchar/nvarchar
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1 (c nchar(10));
-show create table t1;
-drop table t1;
-
-create table t1 (c national char(10));
-show create table t1;
-drop table t1;
-
-create table t1 (c national varchar(10));
-show create table t1;
-drop table t1;
-
-create table t1 (c nvarchar(10));
-show create table t1;
-drop table t1;
-
-create table t1 (c nchar varchar(10));
-show create table t1;
-drop table t1;
-
-create table t1 (c national character varying(10));
-show create table t1;
-drop table t1;
-
-create table t1 (c nchar varying(10));
-show create table t1;
-drop table t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/type_newdecimal-big.test b/mysql-test/t/type_newdecimal-big.test
deleted file mode 100644
index 9a1104e4fe6..00000000000
--- a/mysql-test/t/type_newdecimal-big.test
+++ /dev/null
@@ -1,50 +0,0 @@
---source include/big_test.inc
-
---disable_warnings
-drop procedure if exists sp1;
---enable_warnings
-
-#
-#-- 2. Adding (one millionth) one million times should be the same as
-#-- adding 1. So a stored procedure with many iterations will show if
-#-- small errors accumulate.
-#
-
-delimiter //;
-#
-CREATE PROCEDURE sp1()
-BEGIN
- DECLARE v1, v2, v3, v4 DECIMAL(28,12);
- DECLARE v3_2, v4_2 DECIMAL(28, 12);
- DECLARE counter INT;
-
- SET v1 = 1;
- SET v2 = 2;
- SET v3 = 1000000000000;
- SET v4 = 2000000000000;
- SET counter = 0;
-
- WHILE counter < 100000 DO
- SET v1 = v1 + 0.000000000001;
- SET v2 = v2 - 0.000000000001;
- SET v3 = v3 + 1;
- SET v4 = v4 - 1;
- SET counter = counter + 1;
- END WHILE;
-
- SET v3_2 = v3 * 0.000000000001;
- SET v4_2 = v4 * 0.000000000001;
-
- SELECT v1, v2, v3, v3_2, v4, v4_2;
-END//
-#
-call sp1()//
-#-- should return
-# -- v1=1.0000001
-# -- v2=1.999999900000
-# -- v3=1.0000001
-# -- v4=1.999999900000
-#
-delimiter ;//
-#
-drop procedure sp1;
diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test
deleted file mode 100644
index dd5311e4be3..00000000000
--- a/mysql-test/t/type_newdecimal.test
+++ /dev/null
@@ -1,1786 +0,0 @@
---disable_warnings
-drop table if exists t1;
---enable_warnings
-#
-# constant IN function test
-#
-select 1.1 IN (1.0, 1.2);
-select 1.1 IN (1.0, 1.2, 1.1, 1.4, 0.5);
-select 1.1 IN (1.0, 1.2, NULL, 1.4, 0.5);
-select 0.5 IN (1.0, 1.2, NULL, 1.4, 0.5);
-select 1 IN (1.11, 1.2, 1.1, 1.4, 1, 0.5);
-select 1 IN (1.11, 1.2, 1.1, 1.4, NULL, 0.5);
-
-#
-# case function test
-#
-select case 1.0 when 0.1 then "a" when 1.0 then "b" else "c" END;
-select case 0.1 when 0.1 then "a" when 1.0 then "b" else "c" END;
-select case 1 when 0.1 then "a" when 1.0 then "b" else "c" END;
-select case 1.0 when 0.1 then "a" when 1 then "b" else "c" END;
-select case 1.001 when 0.1 then "a" when 1 then "b" else "c" END;
-
-#
-# non constant IN test
-#
-create table t1 (a decimal(6,3));
-insert into t1 values (1.0), (NULL), (0.1);
-select * from t1;
-select 0.1 in (1.0, 1.2, 1.1, a, 1.4, 0.5) from t1;
-drop table t1;
-
-#
-# if function test
-#
-create table t1 select if(1, 1.1, 1.2), if(0, 1.1, 1.2), if(0.1, 1.1, 1.2), if(0, 1, 1.1), if(0, NULL, 1.2), if(1, 0.22e1, 1.1), if(1E0, 1.1, 1.2);
-select * from t1;
-show create table t1;
-drop table t1;
-
-#
-# NULLIF
-#
-create table t1 select nullif(1.1, 1.1), nullif(1.1, 1.2), nullif(1.1, 0.11e1), nullif(1.0, 1), nullif(1, 1.0), nullif(1, 1.1);
-select * from t1;
-show create table t1;
-drop table t1;
-
-#
-# saving in decimal field with overflow
-#
-
-create table t1 (a decimal(4,2));
-insert ignore into t1 value (10000), (1.1e10), ("11111"), (100000.1);
-insert ignore into t1 value (-10000), (-1.1e10), ("-11111"), (-100000.1);
-select a from t1;
-drop table t1;
-create table t1 (a decimal(4,2) unsigned);
-insert ignore into t1 value (10000), (1.1e10), ("11111"), (100000.1);
-insert ignore into t1 value (-10000), (-1.1e10), ("-11111"), (-100000.1);
-select a from t1;
-drop table t1;
-
-
-#
-# saving in field with overflow from decimal
-#
-create table t1 (a bigint);
-insert ignore into t1 values (18446744073709551615.0);
-insert ignore into t1 values (9223372036854775808.0);
-insert ignore into t1 values (-18446744073709551615.0);
-select * from t1;
-drop table t1;
-create table t1 (a bigint unsigned);
-insert into t1 values (18446744073709551615.0);
-insert into t1 values (9223372036854775808.0);
-insert ignore into t1 values (9999999999999999999999999.000);
-insert ignore into t1 values (-1.0);
-select * from t1;
-drop table t1;
-create table t1 (a tinyint);
-insert ignore into t1 values (18446744073709551615.0);
-insert ignore into t1 values (9223372036854775808.0);
-select * from t1;
-drop table t1;
-
-#
-# test that functions create decimal fields
-#
-create table t1 select round(15.4,-1), truncate(-5678.123451,-3), abs(-1.1), -(-1.1);
-show create table t1;
-drop table t1;
-
-#
-# Trydy's tests
-#
-set session sql_mode='traditional';
-select 1e10/0e0;
-create table wl1612 (col1 int, col2 decimal(38,10), col3 numeric(38,10));
-insert into wl1612 values(1,12345678901234567890.1234567890,12345678901234567890.1234567890);
-select * from wl1612;
-insert into wl1612 values(2,01234567890123456789.0123456789,01234567890123456789.0123456789);
-select * from wl1612 where col1=2;
-insert into wl1612 values(3,1234567890123456789012345678.0123456789,1234567890123456789012345678.0123456789);
-select * from wl1612 where col1=3;
-
-select col1/0 from wl1612;
-select col2/0 from wl1612;
-select col3/0 from wl1612;
-
-insert into wl1612 values(5,5000.0005,5000.0005);
-insert into wl1612 values(6,5000.0005,5000.0005);
-select sum(col2),sum(col3) from wl1612;
-#select avg(col2),avg(col3) from wl1612;
-
-insert into wl1612 values(7,500000.000005,500000.000005);
-insert into wl1612 values(8,500000.000005,500000.000005);
-select sum(col2),sum(col3) from wl1612 where col1>4;
-#select avg(col2),avg(col3) from wl1612 where col1>4;
-
-#insert into wl1612 (col1,col2) values(9,123456789012345678901234567890);
-#insert into wl1612 (col1,col3) values(9,123456789012345678901234567890);
-
-insert into wl1612 (col1, col2) values(9,1.01234567891);
-insert into wl1612 (col1, col2) values(10,1.01234567894);
-insert into wl1612 (col1, col2) values(11,1.01234567895);
-insert into wl1612 (col1, col2) values(12,1.01234567896);
-select col1,col2 from wl1612 where col1>8;
-
-insert into wl1612 (col1, col3) values(13,1.01234567891);
-insert into wl1612 (col1, col3) values(14,1.01234567894);
-insert into wl1612 (col1, col3) values(15,1.01234567895);
-insert into wl1612 (col1, col3) values(16,1.01234567896);
-select col1,col3 from wl1612 where col1>12;
-
-select col1 from wl1612 where col1>4 and col2=1.01234567891;
-#-- should return 0 rows
-#
-select col1 from wl1612 where col1>4 and col2=1.0123456789;
-#-- should return col1 values 9 & 10
-#
-select col1 from wl1612 where col1>4 and col2<>1.0123456789;
-#-- should return col1 values 5,6,7,8,11,12
-#
-select col1 from wl1612 where col1>4 and col2<1.0123456789;
-#-- should return 0 rows
-#
-select col1 from wl1612 where col1>4 and col2<=1.0123456789;
-#-- should return col1 values 9 & 10
-#
-select col1 from wl1612 where col1>4 and col2>1.0123456789;
-#-- should return col1 values 5,6,7,8,11,12
-#
-select col1 from wl1612 where col1>4 and col2>=1.0123456789;
-#-- should return col1 values 5,6,7,8,910,11,12
-#
-#select col1, col2 from wl1612 where col1=11 or col1=12;
-select col1 from wl1612 where col1>4 and col2=1.012345679;
-#-- should return col1 values 11,12
-#
-select col1 from wl1612 where col1>4 and col2<>1.012345679;
-#-- should return col1 values 5,6,7,8,9,10
-#
-select col1 from wl1612 where col1>4 and col3=1.01234567891;
-#-- should return 0 rows
-#
-select col1 from wl1612 where col1>4 and col3=1.0123456789;
-#-- should return col1 values 13,14
-#
-select col1 from wl1612 where col1>4 and col3<>1.0123456789;
-#-- should return col1 values 5,6,7,8,15,16
-#
-select col1 from wl1612 where col1>4 and col3<1.0123456789;
-#-- should return 0 rows
-#
-select col1 from wl1612 where col1>4 and col3<=1.0123456789;
-#-- should return col1 values 13,14
-#
-select col1 from wl1612 where col1>4 and col3>1.0123456789;
-#-- should return col1 values 5,6,7,8,15,16
-#
-select col1 from wl1612 where col1>4 and col3>=1.0123456789;
-#-- should return col1 values 5,6,7,8,13,14,15,16
-#
-select col1 from wl1612 where col1>4 and col3=1.012345679;
-#-- should return col1 values 15,16
-#
-select col1 from wl1612 where col1>4 and col3<>1.012345679;
-#-- should return col1 values 5,6,7,8,13,14
-#
-drop table wl1612;
-#
-select 1/3;
-#
-select 0.8=0.7+0.1;
-#-- should return 1 (true)
-#
-select 0.7+0.1;
-#
-create table wl1612_1 (col1 int);
-insert into wl1612_1 values(10);
-#
-select * from wl1612_1 where 0.8=0.7+0.1;
-#--should return 1 row (col1=10)
-#
-select 0.07+0.07 from wl1612_1;
-#
-select 0.07-0.07 from wl1612_1;
-#
-select 0.07*0.07 from wl1612_1;
-#
-select 0.07/0.07 from wl1612_1;
-#
-drop table wl1612_1;
-#
-create table wl1612_2 (col1 decimal(10,2), col2 numeric(10,2));
-insert into wl1612_2 values(1,1);
-insert into wl1612_2 values(+1,+1);
-insert into wl1612_2 values(+01,+01);
-insert into wl1612_2 values(+001,+001);
-#
-select col1,count(*) from wl1612_2 group by col1;
-#
-select col2,count(*) from wl1612_2 group by col2;
-#
-drop table wl1612_2;
-#
-create table wl1612_3 (col1 decimal(10,2), col2 numeric(10,2));
-insert into wl1612_3 values('1','1');
-insert into wl1612_3 values('+1','+1');
-#
-insert into wl1612_3 values('+01','+01');
-insert into wl1612_3 values('+001','+001');
-#
-select col1,count(*) from wl1612_3 group by col1;
-#
-select col2,count(*) from wl1612_3 group by col2;
-#
-drop table wl1612_3;
-#
-select mod(234,10) ;
-#-- should return 4
-#
-select mod(234.567,10.555);
-#-- should return 2.357
-#
-select mod(-234.567,10.555);
-#-- should return -2.357
-#
-select mod(234.567,-10.555);
-#-- should return 2.357
-#
-select round(15.1);
-#-- should return 15
-#
-select round(15.4);
-#-- should return 15
-#
-select round(15.5);
-#-- should return 16
-#
-select round(15.6);
-#-- should return 16
-#
-select round(15.9);
-#-- should return 16
-#
-select round(-15.1);
-#-- should return -15
-#
-select round(-15.4);
-#-- should return -15
-#
-select round(-15.5);
-#-- should return -16
-#
-select round(-15.6);
-#-- should return -16
-#
-select round(-15.9);
-#-- should return -16
-#
-select round(15.1,1);
-#-- should return 15.1
-#
-select round(15.4,1);
-#-- should return 15.4
-#
-select round(15.5,1);
-#-- should return 15.5
-#
-select round(15.6,1);
-#-- should return 15.6
-#
-select round(15.9,1);
-#-- should return 15.9
-#
-select round(-15.1,1);
-#-- should return -15.1
-#
-select round(-15.4,1);
-#-- should return -15.4
-#
-select round(-15.5,1);
-#-- should return -15.5
-#
-select round(-15.6,1);
-#-- should return -15.6
-#
-select round(-15.9,1);
-#-- should return -15.9
-#
-select round(15.1,0);
-#-- should return 15
-#
-select round(15.4,0);
-#-- should return 15
-#
-select round(15.5,0);
-#-- should return 16
-#
-select round(15.6,0);
-#-- should return 16
-#
-select round(15.9,0);
-#-- should return 16
-#
-select round(-15.1,0);
-#-- should return -15
-#
-select round(-15.4,0);
-#-- should return -15
-#
-select round(-15.5,0);
-#-- should return -16
-#
-select round(-15.6,0);
-#-- should return -16
-#
-select round(-15.9,0);
-#-- should return -16
-#
-select round(15.1,-1);
-#-- should return 20
-#
-select round(15.4,-1);
-#-- should return 20
-#
-select round(15.5,-1);
-#-- should return 20
-#
-select round(15.6,-1);
-#-- should return 20
-#
-select round(15.9,-1);
-#-- should return 20
-#
-select round(-15.1,-1);
-#-- should return -20
-#
-select round(-15.4,-1);
-#-- should return -20
-#
-select round(-15.5,-1);
-#-- should return -20
-#
-select round(-15.6,-1);
-#-- should return -20
-#
-select round(-15.91,-1);
-#-- should return -20
-#
-select truncate(5678.123451,0);
-#-- should return 5678
-#
-select truncate(5678.123451,1);
-#-- should return 5678.1
-#
-select truncate(5678.123451,2);
-#-- should return 5678.12
-#
-select truncate(5678.123451,3);
-#-- should return 5678.123
-#
-select truncate(5678.123451,4);
-#-- should return 5678.1234
-#
-select truncate(5678.123451,5);
-#-- should return 5678.12345
-#
-select truncate(5678.123451,6);
-#-- should return 5678.123451
-#
-select truncate(5678.123451,-1);
-#-- should return 5670
-#
-select truncate(5678.123451,-2);
-#-- should return 5600
-#
-select truncate(5678.123451,-3);
-#-- should return 5000
-#
-select truncate(5678.123451,-4);
-#-- should return 0
-#
-select truncate(-5678.123451,0);
-#-- should return -5678
-#
-select truncate(-5678.123451,1);
-#-- should return -5678.1
-#
-select truncate(-5678.123451,2);
-#-- should return -5678.12
-#
-select truncate(-5678.123451,3);
-#-- should return -5678.123
-#
-select truncate(-5678.123451,4);
-#-- should return -5678.1234
-#
-select truncate(-5678.123451,5);
-#-- should return -5678.12345
-#
-select truncate(-5678.123451,6);
-#-- should return -5678.123451
-#
-select truncate(-5678.123451,-1);
-#-- should return -5670
-#
-select truncate(-5678.123451,-2);
-#-- should return -5600
-#
-select truncate(-5678.123451,-3);
-#-- should return -5000
-#
-select truncate(-5678.123451,-4);
-#-- should return 0
-#
-#drop table if exists wl1612_4;
-create table wl1612_4 (col1 int, col2 decimal(30,25), col3 numeric(30,25));
-#
-insert into wl1612_4 values(1,0.0123456789012345678912345,0.0123456789012345678912345);
-#
-select col2/9999999999 from wl1612_4 where col1=1;
-#
-select col3/9999999999 from wl1612_4 where col1=1;
-#
-select 9999999999/col2 from wl1612_4 where col1=1;
-#
-select 9999999999/col3 from wl1612_4 where col1=1;
-#
-select col2*9999999999 from wl1612_4 where col1=1;
-#
-select col3*9999999999 from wl1612_4 where col1=1;
-#
-insert into wl1612_4 values(2,55555.0123456789012345678912345,55555.0123456789012345678912345);
-#
-select col2/9999999999 from wl1612_4 where col1=2;
-#
-select col3/9999999999 from wl1612_4 where col1=2;
-#
-select 9999999999/col2 from wl1612_4 where col1=2;
-#
-select 9999999999/col3 from wl1612_4 where col1=2;
-#
-select col2*9999999999 from wl1612_4 where col1=2;
-#
-select col3*9999999999 from wl1612_4 where col1=2;
-#
-drop table wl1612_4;
-#
-#
-#
-#
-#-- Additional tests for WL#1612 Precision math
-#
-#-- Comparisons should show that a number is
-#-- exactly equal to its value as displayed.
-#
-set sql_mode='';
-#
-select 23.4 + (-41.7), 23.4 - (41.7) = -18.3;
-#
-select -18.3=-18.3;
-#
-select 18.3=18.3;
-#
-select -18.3=18.3;
-#
-select 0.8 = 0.7 + 0.1;
-
-#
-#-- It should be possible to define a column
-#-- with up to 38 digits precision either before
-#-- or after the decimal point. Any number which
-#-- is inserted, if it's within the range, should
-#-- be exactly the same as the number that gets
-#-- selected.
-#
-drop table if exists t1;
-#
-create table t1 (col1 decimal(38));
-#
-insert into t1 values (12345678901234567890123456789012345678);
-#
-select * from t1;
-#-- should return:
-#+----------------------------------------+
-#| col1 |
-#+----------------------------------------+
-#| 12345678901234567890123456789012345678 |
-#+----------------------------------------+
-#
-#drop table t1;
-#
-#create table t1 (col1 decimal(38,38));
-#
-#insert into t1 values (.12345678901234567890123456789012345678);
-#
-#select * from t1;
-#-- should return:
-#+------------------------------------------+
-#| col1 |
-#+------------------------------------------+
-#| 0.12345678901234567890123456789012345678 |
-#+------------------------------------------+
-#
-drop table t1;
-#
-create table t1 (col1 decimal(31,30));
-#
-insert into t1 values (0.00000000001);
-#
-select * from t1;
-#-- should return:
-#+---------------+
-#|col1 |
-#+---------------+
-#| 0.00000000001 |
-#+---------------+
-#
-drop table t1;
-#
-#-- The usual arithmetic operators / * + - should work.
-#
-#select 77777777777777777777777777777777777777 / 7777777777777777777777777777777777777 = 10;
-#-- should return 0 (false).
-#
-select 7777777777777777777777777777777777777 * 10;
-#-- should return 77777777777777777777777777777777777770
-#
-select .7777777777777777777777777777777777777 *
- 1000000000000000000;
-#-- should return 777777777777777777.7777777777777777777
-#
-select .7777777777777777777777777777777777777 - 0.1;
-#-- should return .6777777777777777777777777777777777777
-#
-select .343434343434343434 + .343434343434343434;
-#-- should return .686868686868686868
-#
-#-- 5. All arithmetic functions mentioned in the
-#MySQL Reference Manual should work.
-#
-select abs(9999999999999999999999);
-#-- should return 9999999999999999999999
-#
-select abs(-9999999999999999999999);
-#-- should return 9999999999999999999999
-#
-select ceiling(999999999999999999);
-select ceiling(99999999999999999999);
-#-- should return 99999999999999999999
-#
-select ceiling(9.9999999999999999999);
-#-- should return 10
-#
-select ceiling(-9.9999999999999999999);
-#-- should return 9
-#
-select floor(999999999999999999);
-select floor(9999999999999999999999);
-#-- should return 9999999999999999999999
-#
-select floor(9.999999999999999999999);
-#-- should return 9
-#
-select floor(-9.999999999999999999999);
-#-- should return -10
-#
-select floor(-999999999999999999999.999);
-select ceiling(999999999999999999999.999);
-#
-#
-select 99999999999999999999999999999999999999 mod 3;
-#-- should return 0
-#
-select round(99999999999999999.999);
-#-- should return 100000000000000000
-#
-select round(-99999999999999999.999);
-#-- should return -100000000000000000
-#
-select round(99999999999999999.999,3);
-#-- should return 100000000000000000.000
-#
-select round(-99999999999999999.999,3);
-#-- should return -100000000000000000.000
-#
-select truncate(99999999999999999999999999999999999999,49);
-#-- should return 99999999999999999999999999999999999999.000
-#
-select truncate(99.999999999999999999999999999999999999,49);
-#-- should return 99.9999999999999999999999999999999
-#
-select truncate(99999999999999999999999999999999999999,-31);
-# should return 99999990000000000000000000000000000000
-#
-#-- 6. Set functions (AVG, SUM, COUNT) should work.
-#
-#drop table if exists t1;
-#
-#delimiter //
-#
-#create procedure p1 () begin
-# declare v1 int default 1; declare v2 decimal(0,38) default 0;
-# create table t1 (col1 decimal(0,38));
-# while v1 <= 10000 do
-# insert into t1 values (-v2);
-# set v2 = v2 + 0.00000000000000000000000000000000000001;
-# set v1 = v1 + 1;
-# end while;
-# select avg(col1),sum(col1),count(col1) from t1; end;//
-#
-#call p1()//
-#-- should return
-# -- avg(col1)=0.00000000000000000000000000000000000001 added 10,000 times, then divided by 10,000
-# -- sum(col1)=0.00000000000000000000000000000000000001 added 10,000 times
-#
-# -- count(col1)=10000
-#
-#delimiter ;//
-#
-#drop procedure p1;
-#drop table t1;
-#
-#-- When I say DECIMAL(x) I should be able to store x digits.
-#-- If I can't, there should be an error at CREATE time.
-#
-#drop table if exists t1;
-#
-#create table t1 (col1 decimal(254));
-#-- should return SQLSTATE 22003 numeric value out of range
-#
-#-- When I say DECIMAL(x,y) there should be no silent change of precision or
-#-- scale.
-#
-#drop table if exists t1;
-#
-#create table t1 (col1 decimal(0,38));
-#
-#show create table t1;
-#-- should return:
-#+-------+--------------------------------+
-#| Table | Create Table |
-#+-------+--------------------------------+
-#| t9 | CREATE TABLE `t1` ( |
-#|`s1` decimal(0,38) default NULL |
-#| ) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
-#+-------+--------------------------------+
-#
-#drop table t1;
-#
-#-- From WL#1612 "The future" point 2.:
-#-- The standard requires that we treat numbers like "0.5" as
-#-- DECIMAL or NUMERIC, not as floating-point.
-#
-#drop table if exists t1;
-#
-#
-create table t1 as select 0.5;
-#
-show create table t1;
-#-- should return:
-#+-------+-----------------------------------+
-#| Table | Create Table |
-#+-------+-----------------------------------+
-#| t7 | CREATE TABLE `t1` ( |
-#| `0.5` decimal(3,1) NOT NULL default '0.0' |
-#| ) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
-#+-------+-----------------------------------+
-#
-drop table t1;
-#
-#-- From WL#1612, "The future", point 3.: We have to start rounding correctly.
-#
-select round(1.5),round(2.5);
-#-- should return:
-#+------------+------------+
-#| round(1.5) | round(2.5) |
-#+------------+------------+
-#| 2 | 3 |
-#+------------+------------+
-#
-#-- From WL#1612, "The future", point 4.: "select 0.07 * 0.07;" should return 0.0049, not 0.00.
-#-- If operand#1 has scale X and operand#2 has scale Y, then result should have scale (X+Y).
-#
-select 0.07 * 0.07;
-#-- should return 0.0049
-#
-#-- From WL#1612, "The future", point 5.: Division by zero is an error.
-#
-set sql_mode='traditional';
-#
-select 1E-500 = 0;
-#-- should return 1 (true).
-#
-select 1 / 1E-500;
-#
-#-- should return SQLSTATE 22012 division by zero.
-#
-select 1 / 0;
-#-- should return SQLSTATE 22012 division by zero.
-#
-#+-------+
-#| 1 / 0 |
-#+-------+
-#| NULL |
-#+-------+
-#1 row in set, 1 warning (0.00 sec)
-#
-#-- From WL#1612 "The future" point 6.: Overflow is an error.
-#
-#set sql_mode='';
-#
-#select 1E300 * 1E300;
-#-- should return SQLSTATE 22003 numeric value out of range
-#
-#select 18446744073709551615 + 1;
-#-- should return SQLSTATE 22003 numeric value out of range
-#
-#-- 14. From WL#1612 "The future" point 7.:
-#-- If s1 is INTEGER and s2 is DECIMAL, then
-#-- "create table tk7 as select avg(s1),avg(s2) from tk;"
-#-- should not create a table with "double(17,4)" data types.
-#-- The result of AVG must still be exact numeric, with a
-#-- scale the same or greater than the operand's scale.
-#-- The result of SUM must still be exact numeric, with
-#-- a scale the same as the operand's scale.
-#
-#drop table if exists t1;
-#drop table if exists t2;
-#
-#create table t1 (col1 int, col2 decimal(5));
-#
-#create table t2 as select avg(col1),avg(col2) from t1;
-#
-#
-#show create table t2;
-#-- should return:
-#+-------+---------------------------------+
-#| Table | Create Table |
-#+-------+---------------------------------+
-#| t2 | CREATE TABLE `t2` ( |
-#| `avg(col1)` decimal(17,4) default NULL, |
-#| `avg(col2)` decimal(17,5) default NULL |
-#| ) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
-#+-------+---------------------------------+
-#
-#drop table t2;
-#drop table t1;
-#
-#-- From WL#1612 "The future" point 8.: Stop storing leading "+" signs and
-# leading "0"s.
-#
-#drop table if exists t1;
-#
-#create table t1 (col1 decimal(5,2),col2 decimal(5) zerofill, col3 decimal(3,1));
-#
-#insert into t1 values (1,1,1);
-#
-#select col1 from t1 union select col2 from t1 union select col3 from t1;
-#
-#drop table t1;
-#
-#-- From WL#1612, The future" point 9.:
-#-- Accept the data type and precision and scale as the user
-#-- asks, or return an error, but don't change to something else.
-#
-#drop table if exists t1;
-#
-#create table t1 (col1 numeric(4,2));
-#
-#show create table t1;
-#
-#drop table t1;
-#
-#-- The scripts in the following bugs should work:
-#
-
-#BUG#559 Maximum precision for DECIMAL column ...
-#BUG#1499 INSERT/UPDATE into decimal field rounding problem
-#BUG#1845 Not correctly recognising value for decimal field
-#BUG#2493 Round function doesn't work correctly
-#BUG#2649 round(0.5) gives 0 (should be 1)
-#BUG#3612 impicite rounding of VARCHARS during aritchmetic operations...
-#BUG#3722 SELECT fails for certain values in Double(255,10) column.
-#BUG#4485 Floating point conversions are inconsistent
-#BUG#4891 MATH
-#BUG#5931 Out-of-range values are accepted
-#BUG#6048 Stored procedure causes operating system reboot
-#BUG#6053 DOUBLE PRECISION literal
-
-# Tests from 'traditional' mode tests
-#
-set sql_mode='ansi,traditional';
-#
-CREATE TABLE Sow6_2f (col1 NUMERIC(4,2));
-#-- should return OK
-INSERT INTO Sow6_2f VALUES (10.55);
-#-- should return OK
-INSERT INTO Sow6_2f VALUES (10.5555);
-#-- should return OK
-INSERT INTO Sow6_2f VALUES (-10.55);
-#-- should return OK
-INSERT INTO Sow6_2f VALUES (-10.5555);
-#-- should return OK
-INSERT INTO Sow6_2f VALUES (11);
-#-- should return OK
--- error 1264
-INSERT INTO Sow6_2f VALUES (101.55);
-#-- should return SQLSTATE 22003 numeric value out of range
--- error 1264
-UPDATE Sow6_2f SET col1 = col1 * 50 WHERE col1 = 11;
-#-- should return SQLSTATE 22003 numeric value out of range
--- error 1365
-UPDATE Sow6_2f SET col1 = col1 / 0 WHERE col1 > 0;
-#-- should return SQLSTATE 22012 division by zero
-SELECT MOD(col1,0) FROM Sow6_2f;
-#-- should return SQLSTATE 22012 division by zero
--- error 1366
-INSERT INTO Sow6_2f VALUES ('a59b');
-#-- should return SQLSTATE 22018 invalid character value for cast
-drop table Sow6_2f;
-
-#
-# bug#9501
-#
-select 10.3330000000000/12.34500000;
-
-#
-# Bug #10404
-#
-
-set sql_mode='';
-select 0/0;
-
-#
-# bug #9546
-#
---disable_ps_protocol
-select 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 as x;
-select 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 + 1 as x;
---enable_ps_protocol
-#
-# Bug #10004
-#
-select 0.190287977636363637 + 0.040372670 * 0 - 0;
-#
-# Bug #9527
-#
-select -0.123 * 0;
-
-#
-# Bug #10232
-#
-
-CREATE TABLE t1 (f1 DECIMAL (12,9), f2 DECIMAL(2,2));
-INSERT INTO t1 VALUES (10.5, 0);
-UPDATE t1 SET f1 = 4.5;
-SELECT * FROM t1;
-DROP TABLE t1;
-CREATE TABLE t1 (f1 DECIMAL (64,20), f2 DECIMAL(2,2));
-INSERT INTO t1 VALUES (9999999999999999999999999999999999, 0);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-#
-# Bug #10599: problem with NULL
-#
-
-select abs(10/0);
-select abs(NULL);
-
-#
-# Bug #9894 (negative to unsigned column)
-#
-set @@sql_mode='traditional';
-create table t1( d1 decimal(18) unsigned, d2 decimal(20) unsigned, d3 decimal (22) unsigned);
---error 1264
-insert into t1 values(1,-1,-1);
-drop table t1;
-create table t1 (col1 decimal(5,2), col2 numeric(5,2));
---error 1264
-insert into t1 values (999.999,999.999);
---error 1264
-insert into t1 values (-999.999,-999.999);
-select * from t1;
-drop table t1;
-set sql_mode='';
-
-#
-# Bug #8425 (insufficient precision of the division)
-#
-set @sav_dpi= @@div_precision_increment;
-set @@div_precision_increment=15;
-create table t1 (col1 int, col2 decimal(30,25), col3 numeric(30,25));
-insert into t1 values (1,0.0123456789012345678912345,0.0123456789012345678912345);
-select col2/9999999999 from t1 where col1=1;
-select 9999999999/col2 from t1 where col1=1;
-select 77777777/7777777;
-drop table t1;
-set div_precision_increment= @sav_dpi;
-
-#
-# Bug #10896 (0.00 > -0.00)
-#
-create table t1 (a decimal(4,2));
-insert into t1 values (0.00);
-select * from t1 where a > -0.00;
-select * from t1 where a = -0.00;
-drop table t1;
-
-#
-# Bug #11215: a problem with LONGLONG_MIN
-#
-
-create table t1 (col1 bigint default -9223372036854775808);
-insert into t1 values (default);
-select * from t1;
-drop table t1;
-
-#
-# Bug #10891 (converting to decimal crashes server)
-#
-select cast('1.00000001335143196001808973960578441619873046875E-10' as decimal(30,15));
-
-#
-# Bug #11708 (conversion to decimal fails in decimal part)
-#
-select ln(14000) c1, convert(ln(14000),decimal(5,3)) c2, cast(ln(14000) as decimal(5,3)) c3;
---error 1427
-select convert(ln(14000),decimal(2,3)) c1;
---error 1427
-select cast(ln(14000) as decimal(2,3)) c1;
-
-#
-# Bug #8449 (Silent column changes)
-#
---error 1426
-create table t1 (sl decimal(70,30));
---error 1425
-create table t1 (sl decimal(32,39));
---error 1426
-create table t1 (sl decimal(67,38));
---error 1425
-create table t1 (sl decimal(0,50));
---error 1427
-create table t1 (sl decimal(0,30));
-create table t1 (sl decimal(5, 5));
-show create table t1;
-drop table t1;
-# Test limits
-create table t1 (sl decimal(65, 38));
-show create table t1;
-drop table t1;
-
-#
-# Bug 11557 (DEFAULT values rounded improperly
-#
-create table t1 (
- f1 decimal unsigned not null default 17.49,
- f2 decimal unsigned not null default 17.68,
- f3 decimal unsigned not null default 99.2,
- f4 decimal unsigned not null default 99.7,
- f5 decimal unsigned not null default 104.49,
- f6 decimal unsigned not null default 199.91,
- f7 decimal unsigned not null default 999.9,
- f8 decimal unsigned not null default 9999.99);
-insert into t1 (f1) values (1);
-select * from t1;
-drop table t1;
-
-#
-# Bug 12173 (show create table fails)
-#
-create table t1 (
- f0 decimal (30,30) zerofill not null DEFAULT 0,
- f1 decimal (0,0) zerofill not null default 0);
-show create table t1;
-drop table t1;
-
-#
-# Bug 12938 (arithmetic loop's zero)
-#
---disable_warnings
-drop procedure if exists wg2;
---enable_warnings
-delimiter //;
-create procedure wg2()
-begin
- declare v int default 1;
- declare tdec decimal(5) default 0;
- while v <= 9 do set tdec =tdec * 10;
- select v, tdec;
- set v = v + 1;
- end while;
-end//
-
-call wg2()//
-
-delimiter ;//
-drop procedure wg2;
-
-#
-# Bug #12979 Stored procedures: crash if inout decimal parameter
-# (not a SP bug in fact)
-#
-
-select cast(@non_existing_user_var/2 as DECIMAL);
-
-#
-# Bug #13667 (Inconsistency for decimal(m,d) specification
-#
---error 1427
-create table t (d decimal(0,10));
-
-#
-# Bug #14268 (bad FLOAT->DECIMAL conversion)
-#
-
-CREATE TABLE t1 (
- my_float FLOAT,
- my_double DOUBLE,
- my_varchar VARCHAR(50),
- my_decimal DECIMAL(65,30)
-);
-SHOW CREATE TABLE t1;
-
-let $max_power= 32;
-while ($max_power)
-{
- eval INSERT INTO t1 SET my_float = 1.175494345e-$max_power,
- my_double = 1.175494345e-$max_power,
- my_varchar = '1.175494345e-$max_power';
- dec $max_power;
-}
-SELECT my_float, my_double, my_varchar FROM t1;
-
-# The following statement produces results with garbage past
-# the significant digits. Improving it is a part of the WL#3977.
-SELECT CAST(my_float AS DECIMAL(65,30)), my_float FROM t1;
-SELECT CAST(my_double AS DECIMAL(65,30)), my_double FROM t1;
-SELECT CAST(my_varchar AS DECIMAL(65,30)), my_varchar FROM t1;
-
-# We have to disable warnings here as the test in
-# Field_new_decimal::store(double):
-# if (nr2 != nr)
-# fails randomly depending on compiler options
-
---disable_warnings
-UPDATE t1 SET my_decimal = my_float;
-
-# Expected result 0.000000000011754943372854760000
-# On windows we get 0.000000000011754943372854770000
-# use replace_result to correct it
---replace_result 0.000000000011754943372854770000 0.000000000011754943372854760000
-SELECT my_decimal, my_float FROM t1;
-
-UPDATE t1 SET my_decimal = my_double;
-SELECT my_decimal, my_double FROM t1;
---enable_warnings
-UPDATE t1 SET my_decimal = my_varchar;
-SELECT my_decimal, my_varchar FROM t1;
-
-DROP TABLE t1;
-
-#
-# Bug #13573 (Wrong data inserted for too big values)
-#
-
-create table t1 (c1 decimal(64));
---disable_ps_protocol
-insert into t1 values(
-89000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);
---error ER_DATA_OUT_OF_RANGE
-insert into t1 values(
-99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 *
-99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999);
---enable_ps_protocol
-insert into t1 values(1e100);
-select * from t1;
-drop table t1;
-
-#
-# Bug #18014: problem with 'alter table'
-#
-
-create table t1(a decimal(7,2));
-insert into t1 values(123.12);
-select * from t1;
-alter table t1 modify a decimal(10,2);
-select * from t1;
-drop table t1;
-
-#
-# Bug#19667 group by a decimal expression yields wrong result
-#
-create table t1 (i int, j int);
-insert into t1 values (1,1), (1,2), (2,3), (2,4);
-select i, count(distinct j) from t1 group by i;
-select i+0.0 as i2, count(distinct j) from t1 group by i2;
-drop table t1;
-
-create table t1(f1 decimal(20,6));
-insert into t1 values (CAST('10:11:12' AS date) + interval 14 microsecond);
-insert into t1 values (CAST('10:11:12' AS time));
-select * from t1;
-drop table t1;
-
-#
-# Bug #8663 (cant use bigint as input to CAST)
-#
-select cast(19999999999999999999 as unsigned);
-
-#
-# Bug #24558: Increasing decimal column length causes data loss
-#
-create table t1(a decimal(18));
-insert into t1 values(123456789012345678);
-alter table t1 modify column a decimal(19);
-select * from t1;
-drop table t1;
-
-#
-# Bug #27957 cast as decimal does not check overflow, also inconsistent with group, subselect
-#
-
-select cast(11.1234 as DECIMAL(3,2));
-select * from (select cast(11.1234 as DECIMAL(3,2))) t;
-
-select cast(a as DECIMAL(3,2))
- from (select 11.1233 as a
- UNION select 11.1234
- UNION select 12.1234
- ) t;
-
-select cast(a as DECIMAL(3,2)), count(*)
- from (select 11.1233 as a
- UNION select 11.1234
- UNION select 12.1234
- ) t group by 1;
-
-#
-# Bug #28361 Buffer overflow in DECIMAL code on Windows
-#
-
-create table t1 (s varchar(100));
-insert into t1 values (0.00000000010000000000000000364321973154977415791655470655996396089904010295867919921875);
-drop table t1;
-
-#
-# Bug #27984 Long Decimal Maths produces truncated results
-#
-
-SELECT 1.000000000000 * 99.999999999998 / 100 a,1.000000000000 * (99.999999999998 / 100) b;
-
-#
-# Bug #29415: CAST AS DECIMAL(P,S) with too big precision/scale
-#
-
-SELECT CAST(1 AS decimal(65,10));
---error ER_TOO_BIG_PRECISION
-SELECT CAST(1 AS decimal(66,10));
-
-SELECT CAST(1 AS decimal(65,38));
---error ER_TOO_BIG_SCALE
-SELECT CAST(1 AS decimal(65,39));
-
-CREATE TABLE t1 (a int DEFAULT NULL, b int DEFAULT NULL);
-INSERT INTO t1 VALUES (3,30), (1,10), (2,10);
-SELECT a+CAST(1 AS decimal(65,30)) AS aa, SUM(b) FROM t1 GROUP BY aa;
---error ER_TOO_BIG_SCALE
-SELECT a+CAST(1 AS decimal(65,49)) AS aa, SUM(b) FROM t1 GROUP BY aa;
-
-DROP TABLE t1;
-
-#
-# Bug #29417: assertion abort for a grouping query with decimal user variable
-#
-
-CREATE TABLE t1 (a int DEFAULT NULL, b int DEFAULT NULL);
-INSERT INTO t1 VALUES (3,30), (1,10), (2,10);
-
-SET @a= CAST(1 AS decimal);
-SELECT 1 FROM t1 GROUP BY @b := @a, @b;
-
-DROP TABLE t1;
-
-#
-# Bug #24907: unpredictable (display) precission, if input precission
-# increases
-#
-
-# As per 10.1.1. Overview of Numeric Types, type (new) DECIMAL has a
-# maxmimum precision of 30 places after the decimal point. Show that
-# temp field creation beyond that works and throws a truncation warning.
-# DECIMAL(37,36) should be adjusted to DECIMAL(31,30).
-CREATE TABLE t1 SELECT 0.1234567890123456789012345678901234567890123456789 AS f1;
-DESC t1;
-SELECT f1 FROM t1;
-DROP TABLE t1;
-
-# too many decimal places, AND too many digits altogether (90 = 45+45).
-# should preserve integers (65 = 45+20)
-CREATE TABLE t1 SELECT 123451234512345123451234512345123451234512345.678906789067890678906789067890678906789067890 AS f1;
-DESC t1;
-SELECT f1 FROM t1;
-DROP TABLE t1;
-
-#
-# Bug #36270: incorrect calculation result - works in 4.1 but not in 5.0 or 5.1
-#
-
-# show that if we need to truncate the scale of an operand, we pick the
-# right one (that is, we discard the least significant decimal places)
-select (1.20396873 * 0.89550000 * 0.68000000 * 1.08721696 * 0.99500000 *
- 1.01500000 * 1.01500000 * 0.99500000);
-
-#
-# Bug #31616 div_precision_increment description looks wrong
-#
-
-create table t1 as select 5.05 / 0.014;
-show warnings;
-show create table t1;
-select * from t1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#12563865
---echo # ROUNDED,TMP_BUF,DECIMAL_VALUE STACK CORRUPTION IN ALL VERSIONS >=5.0
---echo #
-
-let $nine_81=
-999999999999999999999999999999999999999999999999999999999999999999999999999999999;
-
-eval SELECT substring(('M') FROM ($nine_81)) AS foo;
-eval SELECT min($nine_81) AS foo;
-eval SELECT multipolygonfromtext(('4294967294.1'),($nine_81)) AS foo;
-eval SELECT convert(($nine_81), decimal(30,30)) AS foo;
-eval SELECT bit_xor($nine_81) AS foo;
-eval SELECT -($nine_81) AS foo;
-eval SELECT date_sub(($nine_81),
- interval ((SELECT date_add((0x77500000),
- interval ('Oml') second)))
- day_minute)
-AS foo;
-eval SELECT truncate($nine_81, 28) AS foo;
-
---echo End of 5.0 tests
-
-#
-# Bug#16172 DECIMAL data type processed incorrectly
-#
-select cast(143.481 as decimal(4,1));
-select cast(143.481 as decimal(4,0));
-select cast(143.481 as decimal(2,1));
-select cast(-3.4 as decimal(2,1));
-select cast(99.6 as decimal(2,0));
-select cast(-13.4 as decimal(2,1));
-select cast(98.6 as decimal(2,0));
-
---echo #
---echo # Bug #45262: Bad effects with CREATE TABLE and DECIMAL
---echo #
-
-CREATE TABLE t1 SELECT .123456789123456789123456789123456789123456789123456789123456789123456789123456789 AS my_col;
-DESCRIBE t1;
-SELECT my_col FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 SELECT 1 + .123456789123456789123456789123456789123456789123456789123456789123456789123456789 AS my_col;
-DESCRIBE t1;
-SELECT my_col FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 SELECT 1 * .123456789123456789123456789123456789123456789123456789123456789123456789123456789 AS my_col;
-DESCRIBE t1;
-SELECT my_col FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 SELECT 1 / .123456789123456789123456789123456789123456789123456789123456789123456789123456789 AS my_col;
-DESCRIBE t1;
-SELECT my_col FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 SELECT 1 % .123456789123456789123456789123456789123456789123456789123456789123456789123456789 AS my_col;
-DESCRIBE t1;
-SELECT my_col FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#45261: Crash, stored procedure + decimal
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 SELECT
- /* 81 */ 100000000000000000000000000000000000000000000000000000000000000000000000000000001
- AS c1;
-DESC t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 SELECT
- /* 81 */ 100000000000000000000000000000000000000000000000000000000000000000000000000000001.
- AS c1;
-DESC t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 SELECT
- /* 81 */ 100000000000000000000000000000000000000000000000000000000000000000000000000000001.1 /* 1 */
- AS c1;
-DESC t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 SELECT
- /* 82 */ 1000000000000000000000000000000000000000000000000000000000000000000000000000000001
- AS c1;
-DESC t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 SELECT
- /* 40 */ 1000000000000000000000000000000000000001.1000000000000000000000000000000000000001 /* 40 */
- AS c1;
-DESC t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 SELECT
- /* 1 */ 1.10000000000000000000000000000000000000000000000000000000000000000000000000000001 /* 80 */
- AS c1;
-DESC t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 SELECT
- /* 1 */ 1.100000000000000000000000000000000000000000000000000000000000000000000000000000001 /* 81 */
- AS c1;
-DESC t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 SELECT
- .100000000000000000000000000000000000000000000000000000000000000000000000000000001 /* 81 */
- AS c1;
-DESC t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 SELECT
- /* 45 */ 123456789012345678901234567890123456789012345.123456789012345678901234567890123456789012345 /* 45 */
- AS c1;
-DESC t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 SELECT
- /* 65 */ 12345678901234567890123456789012345678901234567890123456789012345.1 /* 1 */
- AS c1;
-DESC t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 SELECT
- /* 66 */ 123456789012345678901234567890123456789012345678901234567890123456.1 /* 1 */
- AS c1;
-DESC t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 SELECT
- .123456789012345678901234567890123456789012345678901234567890123456 /* 66 */
- AS c1;
-DESC t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 AS SELECT 123.1234567890123456789012345678901 /* 31 */ AS c1;
-DESC t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 SELECT 1.1 + CAST(1 AS DECIMAL(65,30)) AS c1;
-DESC t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Test that the integer and decimal parts are properly calculated.
---echo #
-
-CREATE TABLE t1 (a DECIMAL(30,30));
-INSERT INTO t1 VALUES (0.1),(0.2),(0.3);
-CREATE TABLE t2 SELECT MIN(a + 0.0000000000000000000000000000001) AS c1 FROM t1;
-DESC t2;
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (a DECIMAL(30,30));
-INSERT INTO t1 VALUES (0.1),(0.2),(0.3);
-CREATE TABLE t2 SELECT IFNULL(a + 0.00000000000000000000000000000000000000000000000001, NULL) AS c1 FROM t1;
-DESC t2;
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (a DECIMAL(30,30));
-INSERT INTO t1 VALUES (0.1),(0.2),(0.3);
-CREATE TABLE t2 SELECT CASE a WHEN 0.1 THEN 0.0000000000000000000000000000000000000000000000000000000000000000001 END AS c1 FROM t1;
-DESC t2;
-DROP TABLE t1,t2;
-
---echo #
---echo # Test that variables get maximum precision.
---echo #
-
-SET @decimal= 1.1;
-CREATE TABLE t1 SELECT @decimal AS c1;
-DESC t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Bug #45261 : Crash, stored procedure + decimal
---echo # Original test by the reporter.
---echo #
-
---echo # should not crash
-CREATE TABLE t1
-SELECT .123456789012345678901234567890123456789012345678901234567890123456 AS a;
-DROP TABLE t1;
-
-delimiter |;
-CREATE PROCEDURE test_proc()
-BEGIN
- # The las non critical CUSER definition is:
- # DECLARE mycursor CURSOR FOR SELECT 1 %
- # .12345678912345678912345678912345678912345678912345678912345678912 AS my_col;
- DECLARE mycursor CURSOR FOR
-SELECT 1 %
-.123456789123456789123456789123456789123456789123456789123456789123456789123456789
- AS my_col;
-
- OPEN mycursor;
- CLOSE mycursor;
-END|
-delimiter ;|
---echo # should not crash
-CALL test_proc();
-DROP PROCEDURE test_proc;
-
---echo #
---echo # Bug #48370 Absolutely wrong calculations with GROUP BY and
---echo # decimal fields when using IF
---echo #
-
-CREATE TABLE currencies (id int, rate decimal(16,4),
- PRIMARY KEY (id), KEY (rate));
-
-INSERT INTO currencies VALUES (11,0.7028);
-INSERT INTO currencies VALUES (1,1);
-
-CREATE TABLE payments (
- id int,
- supplier_id int,
- status int,
- currency_id int,
- vat decimal(7,4),
- PRIMARY KEY (id),
- KEY currency_id (currency_id),
- KEY supplier_id (supplier_id)
-);
-
-INSERT INTO payments (id,status,vat,supplier_id,currency_id) VALUES
-(3001,2,0.0000,344,11), (1,2,0.0000,1,1);
-
-CREATE TABLE sub_tasks (
- id int,
- currency_id int,
- price decimal(16,4),
- discount decimal(10,4),
- payment_id int,
- PRIMARY KEY (id),
- KEY currency_id (currency_id),
- KEY payment_id (payment_id)
-) ;
-
-INSERT INTO sub_tasks (id, price, discount, payment_id, currency_id) VALUES
-(52, 12.60, 0, 3001, 11), (56, 14.58, 0, 3001, 11);
-
---echo # should return 1 and the same values in col 2 and 3
-select STRAIGHT_JOIN
- (1 + PAY.vat) AS mult,
- SUM(ROUND((SUB.price - ROUND(ROUND(SUB.price, 2) * SUB.discount, 2)) *
- CUR.rate / CUR.rate, 2)
- ) v_net_with_discount,
-
- SUM(ROUND((SUB.price - ROUND(ROUND(SUB.price, 2) * SUB.discount, 1)) *
- CUR.rate / CUR.rate , 2)
- * (1 + PAY.vat)
- ) v_total
-from
- currencies CUR, payments PAY, sub_tasks SUB
-where
- SUB.payment_id = PAY.id and
- PAY.currency_id = CUR.id and
- PAY.id > 2
-group by PAY.id + 1;
-
-DROP TABLE currencies, payments, sub_tasks;
-
---echo #
---echo # BUG#52171: distinct aggregates on unsigned decimal fields trigger assertions
---echo #
-
-CREATE TABLE t1 (a DECIMAL(4,4) UNSIGNED);
-INSERT INTO t1 VALUES (0);
-SELECT AVG(DISTINCT a) FROM t1;
-SELECT SUM(DISTINCT a) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#55436: buffer overflow in debug binary of dbug_buff in
---echo # Field_new_decimal::store_value
---echo #
-
-# this threw memory warnings on Windows. Also make sure future changes
-# don't change these results, as per usual.
-SET SQL_MODE='';
-CREATE TABLE t1(f1 DECIMAL(44,24)) ENGINE=MYISAM;
-INSERT INTO t1 SET f1 = -64878E-85;
-SELECT f1 FROM t1;
-DROP TABLE IF EXISTS t1;
-
-
-
---echo End of 5.1 tests
-
---echo #
---echo # BUG#12911710 - VALGRIND FAILURE IN
---echo # ROW-DEBUG:PERFSCHEMA.SOCKET_SUMMARY_BY_INSTANCE_FUNC
---echo #
-
-CREATE TABLE t1(d1 DECIMAL(60,0) NOT NULL,
- d2 DECIMAL(60,0) NOT NULL);
-
-INSERT INTO t1 (d1, d2) VALUES(0.0, 0.0);
-SELECT d1 * d2 FROM t1;
-
-DROP TABLE t1;
-
-#
-# Test for Bug#18469276: MOD FOR SMALL DECIMALS FAILS
-#
-select 0.000000000000000000000000000000000000000000000000001 mod 1;
-
-#
-# incorrect result
-#
-select 0.0000000001 mod 1;
-select 0.01 mod 1;
-
---echo #
---echo # Start of 10.0 tests
---echo #
-
---echo #
---echo # MDEV-6950 Bad results with joins comparing DATE and INT/ENUM/VARCHAR columns
---echo #
-CREATE TABLE t1 (a DATETIME PRIMARY KEY);
-INSERT INTO t1 VALUES ('1999-01-01 00:00:00');
-CREATE TABLE t2 (a DECIMAL(30,1));
-INSERT INTO t2 VALUES (19990101000000);
-INSERT INTO t2 VALUES (990101000000);
-SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a;
-SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a;
-ALTER TABLE t2 ADD PRIMARY KEY(a);
-SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a;
-SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a;
---echo # t2 should NOT be eliminated
-EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a;
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-6971 Bad results with joins comparing TIME and DOUBLE/DECIMAL columns
---echo #
-CREATE TABLE t1 (a TIME(6) PRIMARY KEY);
-INSERT INTO t1 VALUES ('10:20:30');
-CREATE TABLE t2 (a DECIMAL(30,10));
-INSERT INTO t2 VALUES (102030),(102030.000000001);
-SELECT t1.* FROM t1 JOIN t2 USING(a);
-SELECT t1.* FROM t1 LEFT JOIN t2 USING(a);
-ALTER TABLE t2 ADD PRIMARY KEY(a);
-SELECT t1.* FROM t1 JOIN t2 USING(a);
-SELECT t1.* FROM t1 LEFT JOIN t2 USING(a);
---echo # t2 should NOT be eliminated
-EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 USING(a);
-DROP TABLE t1,t2;
-
-
---echo #
---echo # End of 10.0 tests
---echo #
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-8703 Wrong result for SELECT..WHERE LENGTH(decimal_10_1_column)!=3 AND decimal_10_1_column=1.10
---echo #
-
-# The constant scale is bigger than the field scale
-CREATE TABLE t1 (a DECIMAL(10,1));
-INSERT INTO t1 VALUES (1.1),(1.2),(1.3);
-SELECT * FROM t1 WHERE LENGTH(a)!=3;
-SELECT * FROM t1 WHERE LENGTH(a)!=3 AND a=1.10;
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)!=3 AND a=1.10;
---echo # Notice 1.1 instead of 1.10 in the final WHERE condition
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)!=rand() AND a=1.10;
-DROP TABLE t1;
-
-# The constant scale is equal to the field scale
-CREATE TABLE t1 (a DECIMAL(10,2));
-INSERT INTO t1 VALUES (1.1),(1.2),(1.3);
-SELECT * FROM t1 WHERE LENGTH(a)!=4;
-SELECT * FROM t1 WHERE LENGTH(a)!=4 AND a=1.10;
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)!=4 AND a=1.10;
---echo # Notice 1.10 in the final WHERE condition
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)!=rand() AND a=1.10;
-DROP TABLE t1;
-
-# The constant scale is smaller than the field scale
-CREATE TABLE t1 (a DECIMAL(10,3));
-INSERT INTO t1 VALUES (1.1),(1.2),(1.3);
-SELECT * FROM t1 WHERE LENGTH(a)!=5;
-SELECT * FROM t1 WHERE LENGTH(a)!=5 AND a=1.10;
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)!=5 AND a=1.10;
---echo # Notice 1.100 rather than 1.10 in the final WHERE condition
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)!=rand() AND a=1.10;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8741 Equal field propagation leaves some remainders after simplifying WHERE zerofill_column=2010 AND zerofill_column>=2010
---echo #
-CREATE TABLE t1 (a DECIMAL(10,1) ZEROFILL);
-INSERT INTO t1 VALUES (2010),(2020);
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010.0 AND a>=2010.0;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8635 Redundant warnings on WHERE decimal_column='ax'
---echo #
-CREATE TABLE t1 (a DECIMAL, KEY(a)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
-# Make sure this does not produce any warnings
-EXPLAIN SELECT * FROM t1 WHERE a='ax' ORDER BY a;
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-8502 DECIMAL accepts out of range DEFAULT values
---echo #
-
---error ER_INVALID_DEFAULT
-CREATE TABLE t1 (a DECIMAL(2,1) DEFAULT 10000);
---error ER_INVALID_DEFAULT
-CREATE TABLE t1 (a DECIMAL(2,1) DEFAULT 10000.0);
---error ER_INVALID_DEFAULT
-CREATE TABLE t1 (a DECIMAL(2,1) DEFAULT 10000e0);
---error ER_INVALID_DEFAULT
-CREATE TABLE t1 (a DECIMAL(2,1) DEFAULT '10000.0');
---error ER_INVALID_DEFAULT
-CREATE TABLE t1 (a DECIMAL(2,1) DEFAULT '10000.1');
-
---echo #
---echo # MDEV-10277 Redundant NOTE when inserting '0.00001 ' into a DECIMAL(2,1) column
---echo #
-CREATE TABLE t1 (a DECIMAL(2,1));
-INSERT INTO t1 VALUES ('0.00001 ');
-INSERT INTO t1 VALUES ('1e-10000 ');
-INSERT INTO t1 VALUES ('0.1 ');
-INSERT INTO t1 VALUES ('0.111 ');
-SELECT * FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DECIMAL(2,1) DEFAULT '1e-10000');
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DECIMAL(2,1) DEFAULT '0.1 ');
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DECIMAL(2,1) DEFAULT '0.10001 ');
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DECIMAL(2,1) DEFAULT '0.10001');
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DECIMAL(2,1) DEFAULT 0.10001);
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a DECIMAL(2,1) DEFAULT 0.10001e0);
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#18408499 UNSIGNED BIGINT HIGH VALUES
---echo # WRONG NUMERICAL COMPARISON RESULTS
---echo #
-
-CREATE TABLE t1(value DECIMAL(24,0) NOT NULL);
-INSERT INTO t1(value)
-VALUES('100000000000000000000001'),
- ('100000000000000000000002'),
- ('100000000000000000000003');
-SELECT * FROM t1 WHERE value = '100000000000000000000002';
-SELECT * FROM t1 WHERE '100000000000000000000002' = value;
-SELECT * FROM t1 WHERE value + 0 = '100000000000000000000002';
-SELECT * FROM t1 WHERE value = 100000000000000000000002;
-SELECT * FROM t1 WHERE value + 0 = 100000000000000000000002;
-
-PREPARE stmt FROM 'SELECT * FROM t1 WHERE value = ?';
-set @a="100000000000000000000002";
-EXECUTE stmt using @a;
-set @a=100000000000000000000002;
-EXECUTE stmt using @a;
-DEALLOCATE PREPARE stmt;
-
-ALTER TABLE t1 ADD INDEX value (value);
-SELECT * FROM t1 WHERE value = '100000000000000000000002';
-DROP TABLE t1;
-
---echo #
---echo # End of 10.1 tests
---echo #
-
---echo #
---echo # Test CREATE .. SELECT
---echo #
-
-create or replace table t1 as select 1.000000000000000000000000000000000 as a;
-show create table t1;
-create or replace table t1 as select 1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 as a;
-show create table t1;
-create or replace table t1 as select 1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 as a;
-show create table t1;
-
-drop table t1;
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/type_num.test b/mysql-test/t/type_num.test
deleted file mode 100644
index cc715d6cda2..00000000000
--- a/mysql-test/t/type_num.test
+++ /dev/null
@@ -1,721 +0,0 @@
---echo #
---echo # Start of 10.0 tests
---echo #
-
---echo #
---echo # MDEV-8468 CAST and INSERT work differently for DECIMAL/INT vs DOUBLE for a string with trailing spaces
---echo #
-SET sql_mode='STRICT_ALL_TABLES';
-
-CREATE TABLE t1 (a FLOAT);
-INSERT INTO t1 VALUES ('1 ');
-DROP TABLE t1;
-CREATE TABLE t1 (a DOUBLE);
-INSERT INTO t1 VALUES ('1 ');
-DROP TABLE t1;
-CREATE TABLE t1 (a TINYINT);
-INSERT INTO t1 VALUES ('1 ');
-DROP TABLE t1;
-CREATE TABLE t1 (a SMALLINT);
-INSERT INTO t1 VALUES ('1 ');
-DROP TABLE t1;
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES ('1 ');
-DROP TABLE t1;
-CREATE TABLE t1 (a BIGINT);
-INSERT INTO t1 VALUES ('1 ');
-DROP TABLE t1;
-CREATE TABLE t1 (a DECIMAL);
-INSERT INTO t1 VALUES ('1 ');
-DROP TABLE t1;
-
-
-CREATE TABLE t1 (a FLOAT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('');
-DROP TABLE t1;
-CREATE TABLE t1 (a DOUBLE);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('');
-DROP TABLE t1;
-CREATE TABLE t1 (a TINYINT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('');
-DROP TABLE t1;
-CREATE TABLE t1 (a SMALLINT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('');
-DROP TABLE t1;
-CREATE TABLE t1 (a INT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('');
-DROP TABLE t1;
-CREATE TABLE t1 (a BIGINT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('');
-DROP TABLE t1;
-CREATE TABLE t1 (a DECIMAL);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('');
-DROP TABLE t1;
-
-
-CREATE TABLE t1 (a FLOAT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('x');
-DROP TABLE t1;
-CREATE TABLE t1 (a DOUBLE);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('x');
-DROP TABLE t1;
-CREATE TABLE t1 (a TINYINT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('x');
-DROP TABLE t1;
-CREATE TABLE t1 (a SMALLINT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('x');
-DROP TABLE t1;
-CREATE TABLE t1 (a INT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('x');
-DROP TABLE t1;
-CREATE TABLE t1 (a BIGINT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('x');
-DROP TABLE t1;
-CREATE TABLE t1 (a DECIMAL);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('x');
-DROP TABLE t1;
-
-
-CREATE TABLE t1 (a FLOAT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES (' x');
-DROP TABLE t1;
-CREATE TABLE t1 (a DOUBLE);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES (' x');
-DROP TABLE t1;
-CREATE TABLE t1 (a TINYINT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES (' x');
-DROP TABLE t1;
-CREATE TABLE t1 (a SMALLINT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES (' x');
-DROP TABLE t1;
-CREATE TABLE t1 (a INT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES (' x');
-DROP TABLE t1;
-CREATE TABLE t1 (a BIGINT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES (' x');
-DROP TABLE t1;
-CREATE TABLE t1 (a DECIMAL);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES (' x');
-DROP TABLE t1;
-
-
-CREATE TABLE t1 (a FLOAT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('.');
-DROP TABLE t1;
-CREATE TABLE t1 (a DOUBLE);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('.');
-DROP TABLE t1;
-CREATE TABLE t1 (a TINYINT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('.');
-DROP TABLE t1;
-CREATE TABLE t1 (a SMALLINT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('.');
-DROP TABLE t1;
-CREATE TABLE t1 (a INT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('.');
-DROP TABLE t1;
-CREATE TABLE t1 (a BIGINT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('.');
-DROP TABLE t1;
-CREATE TABLE t1 (a DECIMAL);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('.');
-DROP TABLE t1;
-
-
-CREATE TABLE t1 (a FLOAT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('-');
-DROP TABLE t1;
-CREATE TABLE t1 (a DOUBLE);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('-');
-DROP TABLE t1;
-CREATE TABLE t1 (a TINYINT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('-');
-DROP TABLE t1;
-CREATE TABLE t1 (a SMALLINT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('-');
-DROP TABLE t1;
-CREATE TABLE t1 (a INT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('-');
-DROP TABLE t1;
-CREATE TABLE t1 (a BIGINT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('-');
-DROP TABLE t1;
-CREATE TABLE t1 (a DECIMAL);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('-');
-DROP TABLE t1;
-
-
-CREATE TABLE t1 (a FLOAT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('+');
-DROP TABLE t1;
-CREATE TABLE t1 (a DOUBLE);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('+');
-DROP TABLE t1;
-CREATE TABLE t1 (a TINYINT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('+');
-DROP TABLE t1;
-CREATE TABLE t1 (a SMALLINT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('+');
-DROP TABLE t1;
-CREATE TABLE t1 (a INT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('+');
-DROP TABLE t1;
-CREATE TABLE t1 (a BIGINT);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('+');
-DROP TABLE t1;
-CREATE TABLE t1 (a DECIMAL);
---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
-INSERT INTO t1 VALUES ('+');
-DROP TABLE t1;
-
-
-CREATE TABLE t1 (a FLOAT);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1x');
-DROP TABLE t1;
-CREATE TABLE t1 (a DOUBLE);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1x');
-DROP TABLE t1;
-CREATE TABLE t1 (a TINYINT);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1x');
-DROP TABLE t1;
-CREATE TABLE t1 (a SMALLINT);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1x');
-DROP TABLE t1;
-CREATE TABLE t1 (a INT);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1x');
-DROP TABLE t1;
-CREATE TABLE t1 (a BIGINT);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1x');
-DROP TABLE t1;
-CREATE TABLE t1 (a DECIMAL);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1x');
-DROP TABLE t1;
-
-
-CREATE TABLE t1 (a FLOAT);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1e');
-DROP TABLE t1;
-CREATE TABLE t1 (a DOUBLE);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1e');
-DROP TABLE t1;
-CREATE TABLE t1 (a TINYINT);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1e');
-DROP TABLE t1;
-CREATE TABLE t1 (a SMALLINT);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1e');
-DROP TABLE t1;
-CREATE TABLE t1 (a INT);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1e');
-DROP TABLE t1;
-CREATE TABLE t1 (a BIGINT);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1e');
-DROP TABLE t1;
-CREATE TABLE t1 (a DECIMAL);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1e');
-DROP TABLE t1;
-
-
-CREATE TABLE t1 (a FLOAT);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1e+');
-DROP TABLE t1;
-CREATE TABLE t1 (a DOUBLE);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1e+');
-DROP TABLE t1;
-CREATE TABLE t1 (a TINYINT);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1e+');
-DROP TABLE t1;
-CREATE TABLE t1 (a SMALLINT);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1e+');
-DROP TABLE t1;
-CREATE TABLE t1 (a INT);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1e+');
-DROP TABLE t1;
-CREATE TABLE t1 (a BIGINT);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1e+');
-DROP TABLE t1;
-CREATE TABLE t1 (a DECIMAL);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1e+');
-DROP TABLE t1;
-
-
-CREATE TABLE t1 (a FLOAT);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1E-');
-DROP TABLE t1;
-CREATE TABLE t1 (a DOUBLE);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1E-');
-DROP TABLE t1;
-CREATE TABLE t1 (a TINYINT);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1E-');
-DROP TABLE t1;
-CREATE TABLE t1 (a SMALLINT);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1E-');
-DROP TABLE t1;
-CREATE TABLE t1 (a INT);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1E-');
-DROP TABLE t1;
-CREATE TABLE t1 (a BIGINT);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1E-');
-DROP TABLE t1;
-CREATE TABLE t1 (a DECIMAL);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1E-');
-DROP TABLE t1;
-
-
-CREATE TABLE t1 (a FLOAT);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1Ex');
-DROP TABLE t1;
-CREATE TABLE t1 (a DOUBLE);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1Ex');
-DROP TABLE t1;
-CREATE TABLE t1 (a TINYINT);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1Ex');
-DROP TABLE t1;
-CREATE TABLE t1 (a SMALLINT);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1Ex');
-DROP TABLE t1;
-CREATE TABLE t1 (a INT);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1Ex');
-DROP TABLE t1;
-CREATE TABLE t1 (a BIGINT);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1Ex');
-DROP TABLE t1;
-CREATE TABLE t1 (a DECIMAL);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1Ex');
-DROP TABLE t1;
-
-
-CREATE TABLE t1 (a FLOAT);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1e+x');
-DROP TABLE t1;
-CREATE TABLE t1 (a DOUBLE);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1e+x');
-DROP TABLE t1;
-CREATE TABLE t1 (a TINYINT);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1e+x');
-DROP TABLE t1;
-CREATE TABLE t1 (a SMALLINT);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1e+x');
-DROP TABLE t1;
-CREATE TABLE t1 (a INT);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1e+x');
-DROP TABLE t1;
-CREATE TABLE t1 (a BIGINT);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1e+x');
-DROP TABLE t1;
-CREATE TABLE t1 (a DECIMAL);
---error WARN_DATA_TRUNCATED
-INSERT INTO t1 VALUES ('1e+x');
-DROP TABLE t1;
-
-
-CREATE TABLE t1 (a FLOAT);
---error ER_WARN_DATA_OUT_OF_RANGE
-INSERT INTO t1 VALUES ('1e1000');
-DROP TABLE t1;
-CREATE TABLE t1 (a DOUBLE);
---error ER_WARN_DATA_OUT_OF_RANGE
-INSERT INTO t1 VALUES ('1e1000');
-DROP TABLE t1;
-CREATE TABLE t1 (a TINYINT);
---error ER_WARN_DATA_OUT_OF_RANGE
-INSERT INTO t1 VALUES ('1e1000');
-DROP TABLE t1;
-CREATE TABLE t1 (a SMALLINT);
---error ER_WARN_DATA_OUT_OF_RANGE
-INSERT INTO t1 VALUES ('1e1000');
-DROP TABLE t1;
-CREATE TABLE t1 (a INT);
---error ER_WARN_DATA_OUT_OF_RANGE
-INSERT INTO t1 VALUES ('1e1000');
-DROP TABLE t1;
-CREATE TABLE t1 (a BIGINT);
---error ER_WARN_DATA_OUT_OF_RANGE
-INSERT INTO t1 VALUES ('1e1000');
-DROP TABLE t1;
-CREATE TABLE t1 (a DECIMAL);
---error ER_WARN_DATA_OUT_OF_RANGE
-INSERT INTO t1 VALUES ('1e1000');
-DROP TABLE t1;
-
-
-SET sql_mode=DEFAULT;
-
-CREATE TABLE t1 (
- f4 FLOAT,
- f8 DOUBLE,
- i1 TINYINT,
- i2 SMALLINT,
- i4 INT,
- i8 BIGINT,
- d DECIMAL
-);
-
-INSERT INTO t1 VALUES ('1 ','1 ','1 ','1 ','1 ','1 ','1 ');
-INSERT IGNORE INTO t1 VALUES ('','','','','','','');
-INSERT IGNORE INTO t1 VALUES ('x','x','x','x','x','x','x');
-INSERT IGNORE INTO t1 VALUES (' x',' x',' x',' x',' x',' x',' x');
-INSERT IGNORE INTO t1 VALUES ('.','.','.','.','.','.','.');
-INSERT IGNORE INTO t1 VALUES ('-','-','-','-','-','-','-');
-INSERT IGNORE INTO t1 VALUES ('+','+','+','+','+','+','+');
-INSERT IGNORE INTO t1 VALUES ('1x','1x','1x','1x','1x','1x','1x');
-INSERT IGNORE INTO t1 VALUES ('1e','1e','1e','1e','1e','1e','1e');
-INSERT IGNORE INTO t1 VALUES ('1e-','1e-','1e-','1e-','1e-','1e-','1e-');
-INSERT IGNORE INTO t1 VALUES ('1E+','1E+','1E+','1E+','1E+','1E+','1E+');
-INSERT IGNORE INTO t1 VALUES ('1e1000','1e1000','1e1000','1e1000','1e1000','1e1000','1e1000');
-
-DELETE FROM t1;
-INSERT INTO t1 VALUES (0,0,0,0,0,0,0);
-INSERT INTO t1 VALUES (0,0,0,0,0,0,0);
-INSERT INTO t1 VALUES (1,1,1,1,1,1,1);
-INSERT INTO t1 VALUES (1,1,1,1,1,1,1);
-INSERT INTO t1 VALUES (2,2,2,2,2,2,2);
-INSERT INTO t1 VALUES (2,2,2,2,2,2,2);
-INSERT INTO t1 VALUES (3,3,3,3,3,3,3);
-INSERT INTO t1 VALUES (3,3,3,3,3,3,3);
-INSERT INTO t1 VALUES (4,4,4,4,4,4,4);
-INSERT INTO t1 VALUES (4,4,4,4,4,4,4);
-INSERT INTO t1 VALUES (5,5,5,5,5,5,5);
-INSERT INTO t1 VALUES (5,5,5,5,5,5,5);
-
-SELECT COUNT(*) FROM t1 WHERE f4='1 ';
-SELECT COUNT(*) FROM t1 WHERE f8='1 ';
-SELECT COUNT(*) FROM t1 WHERE i1='1 ';
-SELECT COUNT(*) FROM t1 WHERE i2='1 ';
-SELECT COUNT(*) FROM t1 WHERE i4='1 ';
-SELECT COUNT(*) FROM t1 WHERE i8='1 ';
-SELECT COUNT(*) FROM t1 WHERE d='1 ';
-
-SELECT COUNT(*) FROM t1 WHERE f4='';
-SELECT COUNT(*) FROM t1 WHERE f8='';
-SELECT COUNT(*) FROM t1 WHERE i1='';
-SELECT COUNT(*) FROM t1 WHERE i2='';
-SELECT COUNT(*) FROM t1 WHERE i4='';
-SELECT COUNT(*) FROM t1 WHERE i8='';
-SELECT COUNT(*) FROM t1 WHERE d='';
-
-SELECT COUNT(*) FROM t1 WHERE f4='x';
-SELECT COUNT(*) FROM t1 WHERE f8='x';
-SELECT COUNT(*) FROM t1 WHERE i1='x';
-SELECT COUNT(*) FROM t1 WHERE i2='x';
-SELECT COUNT(*) FROM t1 WHERE i4='x';
-SELECT COUNT(*) FROM t1 WHERE i8='x';
-SELECT COUNT(*) FROM t1 WHERE d='x';
-
-SELECT COUNT(*) FROM t1 WHERE f4=' x';
-SELECT COUNT(*) FROM t1 WHERE f8=' x';
-SELECT COUNT(*) FROM t1 WHERE i1=' x';
-SELECT COUNT(*) FROM t1 WHERE i2=' x';
-SELECT COUNT(*) FROM t1 WHERE i4=' x';
-SELECT COUNT(*) FROM t1 WHERE i8=' x';
-SELECT COUNT(*) FROM t1 WHERE d=' x';
-
-SELECT COUNT(*) FROM t1 WHERE f4='.';
-SELECT COUNT(*) FROM t1 WHERE f8='.';
-SELECT COUNT(*) FROM t1 WHERE i1='.';
-SELECT COUNT(*) FROM t1 WHERE i2='.';
-SELECT COUNT(*) FROM t1 WHERE i4='.';
-SELECT COUNT(*) FROM t1 WHERE i8='.';
-SELECT COUNT(*) FROM t1 WHERE d='.';
-
-SELECT COUNT(*) FROM t1 WHERE f4='-';
-SELECT COUNT(*) FROM t1 WHERE f8='-';
-SELECT COUNT(*) FROM t1 WHERE i1='-';
-SELECT COUNT(*) FROM t1 WHERE i2='-';
-SELECT COUNT(*) FROM t1 WHERE i4='-';
-SELECT COUNT(*) FROM t1 WHERE i8='-';
-SELECT COUNT(*) FROM t1 WHERE d='-';
-
-SELECT COUNT(*) FROM t1 WHERE f4='+';
-SELECT COUNT(*) FROM t1 WHERE f8='+';
-SELECT COUNT(*) FROM t1 WHERE i1='+';
-SELECT COUNT(*) FROM t1 WHERE i2='+';
-SELECT COUNT(*) FROM t1 WHERE i4='+';
-SELECT COUNT(*) FROM t1 WHERE i8='+';
-SELECT COUNT(*) FROM t1 WHERE d='+';
-
-SELECT COUNT(*) FROM t1 WHERE f4='1x';
-SELECT COUNT(*) FROM t1 WHERE f8='1x';
-SELECT COUNT(*) FROM t1 WHERE i1='1x';
-SELECT COUNT(*) FROM t1 WHERE i2='1x';
-SELECT COUNT(*) FROM t1 WHERE i4='1x';
-SELECT COUNT(*) FROM t1 WHERE i8='1x';
-SELECT COUNT(*) FROM t1 WHERE d='1x';
-
-SELECT COUNT(*) FROM t1 WHERE f4='1e';
-SELECT COUNT(*) FROM t1 WHERE f8='1e';
-SELECT COUNT(*) FROM t1 WHERE i1='1e';
-SELECT COUNT(*) FROM t1 WHERE i2='1e';
-SELECT COUNT(*) FROM t1 WHERE i4='1e';
-SELECT COUNT(*) FROM t1 WHERE i8='1e';
-SELECT COUNT(*) FROM t1 WHERE d='1e';
-
-SELECT COUNT(*) FROM t1 WHERE f4='1e+';
-SELECT COUNT(*) FROM t1 WHERE f8='1e+';
-SELECT COUNT(*) FROM t1 WHERE i1='1e+';
-SELECT COUNT(*) FROM t1 WHERE i2='1e+';
-SELECT COUNT(*) FROM t1 WHERE i4='1e+';
-SELECT COUNT(*) FROM t1 WHERE i8='1e+';
-SELECT COUNT(*) FROM t1 WHERE d='1e+';
-
-SELECT COUNT(*) FROM t1 WHERE f4='1E-';
-SELECT COUNT(*) FROM t1 WHERE f8='1E-';
-SELECT COUNT(*) FROM t1 WHERE i1='1E-';
-SELECT COUNT(*) FROM t1 WHERE i2='1E-';
-SELECT COUNT(*) FROM t1 WHERE i4='1E-';
-SELECT COUNT(*) FROM t1 WHERE i8='1E-';
-SELECT COUNT(*) FROM t1 WHERE d='1E-';
-
-SELECT COUNT(*) FROM t1 WHERE f4='1Ex';
-SELECT COUNT(*) FROM t1 WHERE f8='1Ex';
-SELECT COUNT(*) FROM t1 WHERE i1='1Ex';
-SELECT COUNT(*) FROM t1 WHERE i2='1Ex';
-SELECT COUNT(*) FROM t1 WHERE i4='1Ex';
-SELECT COUNT(*) FROM t1 WHERE i8='1Ex';
-SELECT COUNT(*) FROM t1 WHERE d='1Ex';
-
-SELECT COUNT(*) FROM t1 WHERE f4='1e+x';
-SELECT COUNT(*) FROM t1 WHERE f8='1e+x';
-SELECT COUNT(*) FROM t1 WHERE i1='1e+x';
-SELECT COUNT(*) FROM t1 WHERE i2='1e+x';
-SELECT COUNT(*) FROM t1 WHERE i4='1e+x';
-SELECT COUNT(*) FROM t1 WHERE i8='1e+x';
-SELECT COUNT(*) FROM t1 WHERE d='1e+x';
-
-SELECT COUNT(*) FROM t1 WHERE f4='1e1000';
-SELECT COUNT(*) FROM t1 WHERE f8='1e1000';
-SELECT COUNT(*) FROM t1 WHERE i1='1e1000';
-SELECT COUNT(*) FROM t1 WHERE i2='1e1000';
-SELECT COUNT(*) FROM t1 WHERE i4='1e1000';
-SELECT COUNT(*) FROM t1 WHERE i8='1e1000';
-SELECT COUNT(*) FROM t1 WHERE d='1e1000';
-
-ALTER TABLE t1
- ADD KEY f4(f4),
- ADD KEY f8(f8),
- ADD KEY i1(i1),
- ADD KEY i2(i2),
- ADD KEY i4(i4),
- ADD KEY i8(i8),
- ADD KEY d(d);
-
-SELECT COUNT(*) FROM t1 FORCE INDEX(f4) WHERE f4='1 ';
-SELECT COUNT(*) FROM t1 FORCE INDEX(f8) WHERE f8='1 ';
-SELECT COUNT(*) FROM t1 FORCE INDEX(i1) WHERE i1='1 ';
-SELECT COUNT(*) FROM t1 FORCE INDEX(i2) WHERE i2='1 ';
-SELECT COUNT(*) FROM t1 FORCE INDEX(i4) WHERE i4='1 ';
-SELECT COUNT(*) FROM t1 FORCE INDEX(i8) WHERE i8='1 ';
-SELECT COUNT(*) FROM t1 FORCE INDEX(d) WHERE d='1 ';
-
-SELECT COUNT(*) FROM t1 FORCE INDEX(f4) WHERE f4='';
-SELECT COUNT(*) FROM t1 FORCE INDEX(f8) WHERE f8='';
-SELECT COUNT(*) FROM t1 FORCE INDEX(i1) WHERE i1='';
-SELECT COUNT(*) FROM t1 FORCE INDEX(i2) WHERE i2='';
-SELECT COUNT(*) FROM t1 FORCE INDEX(i4) WHERE i4='';
-SELECT COUNT(*) FROM t1 FORCE INDEX(i8) WHERE i8='';
-SELECT COUNT(*) FROM t1 FORCE INDEX(d) WHERE d='';
-
-# TODO: Add tests for all of the other tricky examples (see above) when
-# MDEV-8490 INT,DOUBLE,DECIMAL produce different warnings on comparison
-# is fixed
-
-DROP TABLE t1;
-
-SELECT
- CAST('1 ' AS SIGNED),
- CAST('1 ' AS UNSIGNED),
- CAST('1 ' AS DECIMAL),
- CAST('1 ' AS DOUBLE);
-
-SELECT
- CAST('' AS SIGNED),
- CAST('' AS UNSIGNED),
- CAST('' AS DECIMAL),
- CAST('' AS DOUBLE);
-
-SELECT
- CAST('x' AS SIGNED),
- CAST('x' AS UNSIGNED),
- CAST('x' AS DECIMAL),
- CAST('x' AS DOUBLE);
-
-SELECT
- CAST(' x' AS SIGNED),
- CAST(' x' AS UNSIGNED),
- CAST(' x' AS DECIMAL),
- CAST(' x' AS DOUBLE);
-
-SELECT
- CAST('.' AS SIGNED),
- CAST('.' AS UNSIGNED),
- CAST('.' AS DECIMAL),
- CAST('.' AS DOUBLE);
-
-SELECT
- CAST('-' AS SIGNED),
- CAST('-' AS UNSIGNED),
- CAST('-' AS DECIMAL),
- CAST('-' AS DOUBLE);
-
-SELECT
- CAST('+' AS SIGNED),
- CAST('+' AS UNSIGNED),
- CAST('+' AS DECIMAL),
- CAST('+' AS DOUBLE);
-
-SELECT
- CAST('1x' AS SIGNED),
- CAST('1x' AS UNSIGNED),
- CAST('1x' AS DECIMAL),
- CAST('1x' AS DOUBLE);
-
-SELECT
- CAST('1e' AS SIGNED),
- CAST('1e' AS UNSIGNED),
- CAST('1e' AS DECIMAL),
- CAST('1e' AS DOUBLE);
-
-SELECT
- CAST('1e-' AS SIGNED),
- CAST('1e-' AS UNSIGNED),
- CAST('1e-' AS DECIMAL),
- CAST('1e-' AS DOUBLE);
-
-SELECT
- CAST('1E+' AS SIGNED),
- CAST('1E+' AS UNSIGNED),
- CAST('1E+' AS DECIMAL),
- CAST('1E+' AS DOUBLE);
-
-# TODO: Uncomment this test when
-# MDEV-8468 CAST and INSERT work differently for DECIMAL/INT vs DOUBLE for a string with trailing spaces
-# is fixed
-#SELECT
-# CAST('1e1000' AS SIGNED),
-# CAST('1e1000' AS UNSIGNED),
-# CAST('1e1000' AS DECIMAL),
-# CAST('1e1000' AS DOUBLE);
-
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-9653 Assertion `length || !scale' failed in uint my_decimal_length_to_precision(uint, uint, bool)
---echo #
-
---disable_ps_protocol
---enable_metadata
-SELECT NULL+1 AS c0,
- COALESCE(NULL)+1 AS c2,
- COALESCE(COALESCE(NULL))+1 AS c3,
- ''+1 AS c4,
- COALESCE('')+1 AS c5,
- COALESCE(COALESCE(''))+1 AS c6;
---disable_metadata
---enable_ps_protocol
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
-#
-# MDEV-8659 Conflicting declaration is accepted: INT SIGNED ZEROFILL
-#
---error ER_PARSE_ERROR
-CREATE TABLE t1 (a INT SIGNED ZEROFILL);
---error ER_PARSE_ERROR
-CREATE TABLE t1 (a INT SIGNED UNSIGNED);
---error ER_PARSE_ERROR
-CREATE TABLE t1 (a INT ZEROFILL UNSIGNED ZEROFILL);
-
-# documented syntax:
-CREATE OR REPLACE TABLE t1 (a INT SIGNED);
-CREATE OR REPLACE TABLE t1 (a INT UNSIGNED);
-CREATE OR REPLACE TABLE t1 (a INT ZEROFILL);
-# not documented, supported for backward compatibility
-CREATE OR REPLACE TABLE t1 (a INT UNSIGNED ZEROFILL);
-CREATE OR REPLACE TABLE t1 (a INT ZEROFILL UNSIGNED);
-DROP TABLE t1;
diff --git a/mysql-test/t/type_num_innodb.test b/mysql-test/t/type_num_innodb.test
deleted file mode 100644
index 04bdd4c63b0..00000000000
--- a/mysql-test/t/type_num_innodb.test
+++ /dev/null
@@ -1,41 +0,0 @@
---source include/have_innodb.inc
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-9391 InnoDB does not produce warnings when doing WHERE int_column=varchar_column
---echo #
-
-CREATE TABLE t1 (
- a DOUBLE, b VARCHAR(1), c INT,
- KEY(a), KEY(b)
-) ENGINE=InnoDB;
-INSERT INTO t1 VALUES
-(1,'v',9),(2,'v',8),(3,'c',7),(4,'m',6),(5,'x',5),
-(6,'i',4),(7,'e',3),(8,'p',2),(9,'s',1),(10,'j',9),
-(11,'z',8),(12,'c',7),(13,'a',6),(14,'q',5),(15,'y',4),
-(16,'n',3),(17,'r',2),(18,'v',1),(19,'p',0);
-CREATE TABLE t2 (
- pk INT, d VARCHAR(1), e INT,
- PRIMARY KEY(pk), KEY(d,e)
-) ENGINE=InnoDB;
-INSERT INTO t2 VALUES
-(1,'x',1),(2,'d',2),(3,'r',3),(4,'f',4),(5,'y',5),
-(6,'u',6),(7,'m',7),(8,'k',8),(9,'o',9),(10,'w',1),
-(11,'m',2),(12,'q',3),(13,'m',4),(14,'d',5),
-(15,'g',6),(16,'x',7),(17,'f',8);
-SELECT * FROM t1,t2 WHERE a=d;
-
-ALTER TABLE t1 MODIFY a DECIMAL(10,0);
-SELECT * FROM t1,t2 WHERE a=d;
-
-ALTER TABLE t1 MODIFY a DOUBLE;
-SELECT * FROM t1,t2 WHERE a=d;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/type_ranges.test b/mysql-test/t/type_ranges.test
deleted file mode 100644
index 7bf29321d06..00000000000
--- a/mysql-test/t/type_ranges.test
+++ /dev/null
@@ -1,176 +0,0 @@
-#
-# Test ranges for all types and some other basic tests
-#
-
---disable_warnings
-drop table if exists t1,t2,t3;
---enable_warnings
-SET SQL_WARNINGS=1;
-
-CREATE TABLE t1 (
- auto int(5) unsigned NOT NULL auto_increment,
- string char(10) default "hello",
- tiny tinyint(4) DEFAULT '0' NOT NULL ,
- short smallint(6) DEFAULT '1' NOT NULL ,
- medium mediumint(8) DEFAULT '0' NOT NULL,
- long_int int(11) DEFAULT '0' NOT NULL,
- longlong bigint(13) DEFAULT '0' NOT NULL,
- real_float float(13,1) DEFAULT 0.0 NOT NULL,
- real_double double(16,4),
- utiny tinyint(3) unsigned DEFAULT '0' NOT NULL,
- ushort smallint(5) unsigned zerofill DEFAULT '00000' NOT NULL,
- umedium mediumint(8) unsigned DEFAULT '0' NOT NULL,
- ulong int(11) unsigned DEFAULT '0' NOT NULL,
- ulonglong bigint(13) unsigned DEFAULT '0' NOT NULL,
- time_stamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- date_field date,
- time_field time,
- date_time datetime,
- blob_col blob,
- tinyblob_col tinyblob,
- mediumblob_col mediumblob not null default '',
- longblob_col longblob not null default '',
- options enum('one','two','tree') not null ,
- flags set('one','two','tree') not null default '',
- PRIMARY KEY (auto),
- KEY (utiny),
- KEY (tiny),
- KEY (short),
- KEY any_name (medium),
- KEY (longlong),
- KEY (real_float),
- KEY (ushort),
- KEY (umedium),
- KEY (ulong),
- KEY (ulonglong,ulong),
- KEY (options,flags)
-);
-
-# We mask out the Privileges column because it differs with embedded server
---replace_column 8 #
-show full fields from t1;
-show keys from t1;
-
-CREATE UNIQUE INDEX test on t1 ( auto ) ;
-CREATE INDEX test2 on t1 ( ulonglong,ulong) ;
-CREATE INDEX test3 on t1 ( medium ) ;
-DROP INDEX test ON t1;
-
-insert into t1 values (10, 1,1,1,1,1,1,1,1,1,1,1,1,1,NULL,0,0,0,1,1,1,1,'one','one');
-insert into t1 values (NULL,2,2,2,2,2,2,2,2,2,2,2,2,2,NULL,NULL,NULL,NULL,NULL,NULL,2,2,'two','two,one');
-insert ignore into t1 values (0,1/3,3,3,3,3,3,3,3,3,3,3,3,3,NULL,'19970303','10:10:10','19970303101010','','','','3',3,3);
-insert ignore into t1 values (0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,NULL,19970807,080706,19970403090807,-1,-1,-1,'-1',-1,-1);
-insert ignore into t1 values (0,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,NULL,0,0,0,-4294967295,-4294967295,-4294967295,'-4294967295',0,"one,two,tree");
-insert ignore into t1 values (0,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,NULL,0,0,0,4294967295,4294967295,4294967295,'4294967295',0,0);
-insert into t1 (tiny) values (1);
-
-select auto,string,tiny,short,medium,long_int,longlong,real_float,real_double,utiny,ushort,umedium,ulong,ulonglong,mod(floor(time_stamp/1000000),1000000)-mod(curdate(),1000000),date_field,time_field,date_time,blob_col,tinyblob_col,mediumblob_col,longblob_col from t1;
-
-
-ALTER TABLE t1
-add new_field char(10) default "new" not null,
-change blob_col new_blob_col varchar(20),
-change date_field date_field char(10),
-alter column string set default "newdefault",
-alter short drop default,
-DROP INDEX utiny,
-DROP INDEX ushort,
-DROP PRIMARY KEY,
-DROP FOREIGN KEY any_name,
-ADD INDEX (auto);
-
-LOCK TABLES t1 WRITE;
-ALTER TABLE t1
-RENAME as t2,
-DROP longblob_col;
-UNLOCK TABLES;
-
-ALTER TABLE t2 rename as t3;
-LOCK TABLES t3 WRITE ;
-ALTER TABLE t3 rename as t1;
-UNLOCK TABLES;
-
-select auto,new_field,new_blob_col,date_field from t1 ;
-
-#
-# check with old syntax
-#
-CREATE TABLE t2 (
- auto int(5) unsigned NOT NULL auto_increment,
- string char(20),
- mediumblob_col mediumblob not null,
- new_field char(2),
- PRIMARY KEY (auto)
-);
-
-INSERT IGNORE INTO t2 (string,mediumblob_col,new_field) SELECT string,mediumblob_col,new_field from t1 where auto > 10;
-
-select * from t2;
-
-# test enums
-select distinct flags from t1;
-select flags from t1 where find_in_set("two",flags)>0;
-select flags from t1 where find_in_set("unknown",flags)>0;
-select options,flags from t1 where options="ONE" and flags="ONE";
-select options,flags from t1 where options="one" and flags="one";
-
-drop table t2;
-
-#
-# Check CREATE ... SELECT
-#
-
-create table t2 select * from t1;
-update t2 set string="changed" where auto=16;
-# We mask out the Privileges column because it differs with embedded server
---replace_column 8 #
-show full columns from t1;
---replace_column 8 #
-show full columns from t2;
-select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and ((t1.string<>t2.string and (t1.string is not null or t2.string is not null)) or (t1.tiny<>t2.tiny and (t1.tiny is not null or t2.tiny is not null)) or (t1.short<>t2.short and (t1.short is not null or t2.short is not null)) or (t1.medium<>t2.medium and (t1.medium is not null or t2.medium is not null)) or (t1.long_int<>t2.long_int and (t1.long_int is not null or t2.long_int is not null)) or (t1.longlong<>t2.longlong and (t1.longlong is not null or t2.longlong is not null)) or (t1.real_float<>t2.real_float and (t1.real_float is not null or t2.real_float is not null)) or (t1.real_double<>t2.real_double and (t1.real_double is not null or t2.real_double is not null)) or (t1.utiny<>t2.utiny and (t1.utiny is not null or t2.utiny is not null)) or (t1.ushort<>t2.ushort and (t1.ushort is not null or t2.ushort is not null)) or (t1.umedium<>t2.umedium and (t1.umedium is not null or t2.umedium is not null)) or (t1.ulong<>t2.ulong and (t1.ulong is not null or t2.ulong is not null)) or (t1.ulonglong<>t2.ulonglong and (t1.ulonglong is not null or t2.ulonglong is not null)) or (t1.time_stamp<>t2.time_stamp and (t1.time_stamp is not null or t2.time_stamp is not null)) or (t1.date_field<>t2.date_field and (t1.date_field is not null or t2.date_field is not null)) or (t1.time_field<>t2.time_field and (t1.time_field is not null or t2.time_field is not null)) or (t1.date_time<>t2.date_time and (t1.date_time is not null or t2.date_time is not null)) or (t1.new_blob_col<>t2.new_blob_col and (t1.new_blob_col is not null or t2.new_blob_col is not null)) or (t1.tinyblob_col<>t2.tinyblob_col and (t1.tinyblob_col is not null or t2.tinyblob_col is not null)) or (t1.mediumblob_col<>t2.mediumblob_col and (t1.mediumblob_col is not null or t2.mediumblob_col is not null)) or (t1.options<>t2.options and (t1.options is not null or t2.options is not null)) or (t1.flags<>t2.flags and (t1.flags is not null or t2.flags is not null)) or (t1.new_field<>t2.new_field and (t1.new_field is not null or t2.new_field is not null)));
-select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and not (t1.string<=>t2.string and t1.tiny<=>t2.tiny and t1.short<=>t2.short and t1.medium<=>t2.medium and t1.long_int<=>t2.long_int and t1.longlong<=>t2.longlong and t1.real_float<=>t2.real_float and t1.real_double<=>t2.real_double and t1.utiny<=>t2.utiny and t1.ushort<=>t2.ushort and t1.umedium<=>t2.umedium and t1.ulong<=>t2.ulong and t1.ulonglong<=>t2.ulonglong and t1.time_stamp<=>t2.time_stamp and t1.date_field<=>t2.date_field and t1.time_field<=>t2.time_field and t1.date_time<=>t2.date_time and t1.new_blob_col<=>t2.new_blob_col and t1.tinyblob_col<=>t2.tinyblob_col and t1.mediumblob_col<=>t2.mediumblob_col and t1.options<=>t2.options and t1.flags<=>t2.flags and t1.new_field<=>t2.new_field);
-
-drop table t2;
-
-create table t2 (primary key (auto)) select auto+1 as auto,1 as t1, 'a' as t2, repeat('a',256) as t3, binary repeat('b',256) as t4, repeat('a',4096) as t5, binary repeat('b',4096) as t6, '' as t7, binary '' as t8 from t1;
-# We mask out the Privileges column because it differs with embedded server
---replace_column 8 #
-show full columns from t2;
-select t1,t2,length(t3),length(t4),length(t5),length(t6),t7,t8 from t2;
-drop table t1,t2;
-
-create table t1 (c int);
-insert into t1 values(1),(2);
-create table t2 select * from t1;
---error 1060
-create table t3 select * from t1, t2; # Should give an error
-create table t3 select t1.c AS c1, t2.c AS c2,1 as "const" from t1, t2;
-# We mask out the Privileges column because it differs with embedded server
---replace_column 8 #
-show full columns from t3;
-drop table t1,t2,t3;
-
-create table t1 ( myfield INT NOT NULL, UNIQUE INDEX (myfield), unique (myfield), index(myfield));
-drop table t1;
-
-create table t1 ( id integer unsigned not null primary key );
-create table t2 ( id integer unsigned not null primary key );
-insert into t1 values (1), (2);
-insert into t2 values (1);
-select t1.id as id_A, t2.id as id_B from t1 left join t2 using ( id );
-select t1.id as id_A, t2.id as id_B from t1 left join t2 on (t1.id = t2.id);
-create table t3 (id_A integer unsigned not null, id_B integer unsigned null );
-insert into t3 select t1.id as id_A, t2.id as id_B from t1 left join t2 using ( id );
-select * from t3;
-truncate table t3;
-insert into t3 select t1.id as id_A, t2.id as id_B from t1 left join t2 on (t1.id = t2.id);
-select * from t3;
-drop table t3;
-create table t3 select t1.id as id_A, t2.id as id_B from t1 left join t2 using ( id );
-select * from t3;
-drop table t3;
-create table t3 select t1.id as id_A, t2.id as id_B from t1 left join t2 on (t1.id = t2.id);
-select * from t3;
-drop table t1,t2,t3;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/type_set.test b/mysql-test/t/type_set.test
deleted file mode 100644
index 637ad40c316..00000000000
--- a/mysql-test/t/type_set.test
+++ /dev/null
@@ -1,250 +0,0 @@
-#
-# Test of SET with space
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1 (a set (' ','a','b') not null);
-show create table t1;
-drop table t1;
-create table t1 (a set (' ','a','b ') not null default 'b ');
-show create table t1;
-drop table t1;
-CREATE TABLE t1 ( user varchar(64) NOT NULL default '', path varchar(255) NOT NULL default '', privilege set('select','RESERVED30','RESERVED29','RESERVED28','RESERVED27','RESERVED26', 'RESERVED25','RESERVED24','data.delete','RESERVED22','RESERVED21', 'RESERVED20','data.insert.none','data.insert.approve', 'data.insert.delete','data.insert.move','data.insert.propose', 'data.insert.reject','RESERVED13','RESERVED12','RESERVED11','RESERVED10', 'RESERVED09','data.update','RESERVED07','RESERVED06','RESERVED05', 'RESERVED04','metadata.delete','metadata.put','RESERVED01','RESERVED00') NOT NULL default '', KEY user (user) ) ENGINE=MyISAM CHARSET=utf8;
-DROP TABLE t1;
-
-#
-# Check that SET is case sensitive with a binary collation
-#
-set names latin1;
-create table t1 (s set ('a','A') character set latin1 collate latin1_bin);
-show create table t1;
-insert into t1 values ('a'),('a,A'),('A,a'),('A');
-select s from t1 order by s;
-select s from t1 order by concat(s);
-drop table t1;
-
-#
-# Check that SET honors a more complex collation correctly
-#
-CREATE TABLE t1 (c set('ae','oe','ue','ss') collate latin1_german2_ci);
-INSERT INTO t1 VALUES (''),(''),(''),('');
-INSERT INTO t1 VALUES ('ae'),('oe'),('ue'),('ss');
-INSERT INTO t1 VALUES (',,,');
-INSERT INTO t1 VALUES ('ae,oe,ue,ss');
-SELECT c FROM t1 ORDER BY c;
-SELECT c FROM t1 ORDER BY concat(c);
-DROP TABLE t1;
-
-# End of 4.1 tests
-
-#
-# Bug#27069 set with identical elements are created
-#
---error 1097
-create table t1(f1
-set('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17',
-'18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33',
-'34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49',
-'50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','128'));
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-create table t1(f1
-set('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17',
-'18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33',
-'34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49',
-'50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','1'));
-show create table t1;
-drop table t1;
-
-#
-# Bug#15409: Columns with SET datatype with 64-element sets
-# may not be updated with integers
-#
-
-let $i=64;
-let $s='$i';
-dec $i;
-while ($i) {
- let $s='$i',$s;
- dec $i;
-}
---eval CREATE TABLE t1(c set($s))
-INSERT INTO t1 VALUES(7);
-INSERT INTO t1 VALUES(9223372036854775808);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-#
-# Bug #38701: Crash in String::append when inserting duplicate empty strings
-# an uft8 SET col
-#
-
-CREATE TABLE t1 (
- set_unique_utf8 set ('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') CHARACTER SET utf8,
- unique (set_unique_utf8)
-);
-
-INSERT INTO t1 ( set_unique_utf8 ) VALUES ( '' );
---error ER_DUP_ENTRY
-INSERT INTO t1 ( set_unique_utf8 ) VALUES ( '' );
-
-DROP TABLE t1;
-
-
---echo End of 5.0 tests
-
---echo #
---echo # Start of 10.0 tests
---echo #
-
---echo #
---echo # MDEV-6950 Bad results with joins compating DATE and INT/ENUM/VARCHAR columns
---echo #
-
-CREATE TABLE t1 (c1 DATE PRIMARY KEY);
-INSERT INTO t1 VALUES ('2001-01-01');
-CREATE TABLE t2 (c1 SET('2001-01-01','2001/01/01'));
-INSERT INTO t2 VALUES ('2001-01-01');
-INSERT INTO t2 VALUES ('2001/01/01');
-SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1;
-SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1;
-ALTER TABLE t2 ADD PRIMARY KEY(c1);
-SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1;
-EXPLAIN SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1;
-SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1;
---echo # t2 should NOT be eliminated
-EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1;
-DROP TABLE t1, t2;
-
---echo #
---echo # MDEV-6978 Bad results with join comparing case insensitive VARCHAR/ENUM/SET expression to a _bin ENUM column
---echo #
-CREATE TABLE t1 (c1 ENUM('a') CHARACTER SET latin1 PRIMARY KEY);
-INSERT INTO t1 VALUES ('a');
-CREATE TABLE t2 (c1 SET('a','A') CHARACTER SET latin1 COLLATE latin1_bin);
-INSERT INTO t2 VALUES ('a'),('A');
-SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1;
-SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1;
-ALTER TABLE t2 ADD PRIMARY KEY(c1);
-SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1;
-SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1;
---echo # t2 should NOT be eliminated
-EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1;
-DROP TABLE IF EXISTS t1,t2;
-
-CREATE TABLE t1 (c1 SET('a') CHARACTER SET latin1 PRIMARY KEY);
-INSERT INTO t1 VALUES ('a');
-CREATE TABLE t2 (c1 SET('a','A') CHARACTER SET latin1 COLLATE latin1_bin);
-INSERT INTO t2 VALUES ('a'),('A');
-SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1;
-SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1;
-ALTER TABLE t2 ADD PRIMARY KEY(c1);
-SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1;
-SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1;
---echo # t2 should NOT be eliminated
-EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1;
-DROP TABLE IF EXISTS t1,t2;
-
-CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET latin1 PRIMARY KEY);
-INSERT INTO t1 VALUES ('a');
-CREATE TABLE t2 (c1 SET('a','A') CHARACTER SET latin1 COLLATE latin1_bin);
-INSERT INTO t2 VALUES ('a'),('A');
-SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1;
-SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1;
-ALTER TABLE t2 ADD PRIMARY KEY(c1);
-SELECT t1.* FROM t1 JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1;
-SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1;
---echo # t2 should NOT be eliminated
-EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1 COLLATE latin1_swedish_ci=t2.c1;
-DROP TABLE IF EXISTS t1,t2;
-
---echo #
---echo # MDEV-6993 Bad results with join comparing DECIMAL and ENUM/SET columns
---echo #
-CREATE TABLE t1 (c1 DECIMAL(10,1) PRIMARY KEY);
-INSERT INTO t1 VALUES (1),(2);
-CREATE TABLE t2 (c1 SET('a','b'));
-INSERT INTO t2 VALUES ('a'),('b');
-SELECT t1.* FROM t1 NATURAL JOIN t2;
-ALTER TABLE t2 ADD PRIMARY KEY(c1);
-SELECT t1.* FROM t1 NATURAL JOIN t2;
-SELECT t1.* FROM t1 LEFT OUTER JOIN t2 USING (c1);
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (a DECIMAL(10,1), b SET('1','2'));
-INSERT INTO t1 (a) VALUES (1),(2);
-UPDATE t1 SET b=a;
-SELECT * FROM t1;
-ALTER TABLE t1 MODIFY a SET('1','2');
-SELECT * FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # End of 10.0 tests
---echo #
-
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-8729 Wrong result for SELECT..WHERE HEX(enum_column)='61' AND enum_column='a '
---echo #
-CREATE TABLE t1 (a SET('a','A') CHARACTER SET latin1 COLLATE latin1_bin);
-INSERT INTO t1 VALUES ('a'),('A');
-SELECT * FROM t1 WHERE a='a ';
-SELECT * FROM t1 WHERE HEX(a)='61';
-SELECT * FROM t1 WHERE HEX(a)='61' AND a='a ';
---echo # Can't propagate the equality into HEX(a), because binary collations still ignore trailing spaces
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a ';
-DROP TABLE t1;
-
-CREATE TABLE t1 (a SET('a','a ') CHARACTER SET BINARY);
-INSERT INTO t1 VALUES ('a'),('a ');
-SELECT * FROM t1 WHERE a='a ';
-SELECT * FROM t1 WHERE HEX(a)='61';
-SELECT * FROM t1 WHERE HEX(a)='61' AND a='a';
-SELECT * FROM t1 WHERE HEX(a)='61' AND a='a ';
---echo # Ok to propagate the equality into HEX(a), because "CHARACTER SET BINARY" does not ignore trailing spaces
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a';
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE HEX(a)='61' AND a='a ';
-DROP TABLE t1;
-
---echo #
---echo # End of 10.1 tests
---echo #
-
-
---echo #
---echo # Start of 10.3 tests
---echo #
-
---echo #
---echo # MDEV-12432 Range optimizer for ENUM and SET does not return "Impossible WHERE" in some case
---echo #
-
-CREATE TABLE t1 (a SET('a','b','c','1'),KEY(a));
-INSERT INTO t1 VALUES ('a'),('b'),('c'),('1');
-EXPLAIN SELECT * FROM t1 WHERE a='xx';
-EXPLAIN SELECT * FROM t1 WHERE a='99999999';
-EXPLAIN SELECT * FROM t1 WHERE a=100.1e0;
-EXPLAIN SELECT * FROM t1 WHERE a=100;
-EXPLAIN SELECT * FROM t1 WHERE a=100.1;
-EXPLAIN SELECT * FROM t1 WHERE a='100';
-EXPLAIN SELECT * FROM t1 WHERE a='1x';
-EXPLAIN SELECT * FROM t1 WHERE a='1.0';
-EXPLAIN SELECT * FROM t1 WHERE a='1.1';
-DROP TABLE t1;
-
---echo #
---echo # MDEV-11155 Bad error message when creating a SET column with comma and non-ASCII characters
---echo #
-
-SET NAMES utf8;
---error ER_ILLEGAL_VALUE_FOR_TYPE
-CREATE TABLE t1 (a SET('a,bü'));
diff --git a/mysql-test/t/type_temporal_innodb.test b/mysql-test/t/type_temporal_innodb.test
deleted file mode 100644
index 81f2f586c51..00000000000
--- a/mysql-test/t/type_temporal_innodb.test
+++ /dev/null
@@ -1,68 +0,0 @@
---source include/have_innodb.inc
-
-#
-# testing of temporal data types with InnoDB
-#
-
-
---echo #
---echo # MDEV-9604 crash in Item::save_in_field with empty enum value
---echo #
-
-SELECT TIME'00:00:00'='';
-
-CREATE TABLE t1 (a ENUM('a'), b TIME, c INT, KEY(b)) ENGINE=InnoDB;
-INSERT IGNORE INTO t1 VALUES ('','00:00:00',0);
-SELECT * FROM t1 WHERE b='';
-SELECT * FROM t1 IGNORE KEY (b) WHERE b='';
-SELECT * FROM t1 WHERE a=b;
-SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b;
-
-ALTER TABLE t1 ENGINE=MyISAM;
-SELECT * FROM t1 WHERE b='';
-SELECT * FROM t1 IGNORE KEY (b) WHERE b='';
-SELECT * FROM t1 WHERE a=b;
-SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b;
-DROP TABLE t1;
-
-
-SELECT DATE'0000-00-00'='';
-
-CREATE TABLE t1 (a ENUM('a'), b DATE, c INT, KEY(b)) ENGINE=InnoDB;
-INSERT IGNORE INTO t1 VALUES ('','0000-00-00',0);
-SELECT * FROM t1 WHERE b='';
-SELECT * FROM t1 IGNORE KEY (b) WHERE b='';
-SELECT * FROM t1 WHERE a=b;
-SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b;
-
-ALTER TABLE t1 ENGINE=MyISAM;
-SELECT * FROM t1 WHERE b='';
-SELECT * FROM t1 IGNORE KEY (b) WHERE b='';
-SELECT * FROM t1 WHERE a=b;
-SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b;
-DROP TABLE t1;
-
-
-SELECT TIMESTAMP'0000-00-00 00:00:00'='';
-
-CREATE TABLE t1 (a ENUM('a'), b DATETIME, c INT, KEY(b)) ENGINE=InnoDB;
-INSERT IGNORE INTO t1 VALUES ('','0000-00-00 00:00:00',0);
-SELECT * FROM t1 WHERE b='';
-SELECT * FROM t1 IGNORE KEY (b) WHERE b='';
-SELECT * FROM t1 WHERE a=b;
-SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b;
-
-ALTER TABLE t1 ENGINE=MyISAM;
-SELECT * FROM t1 WHERE b='';
-SELECT * FROM t1 IGNORE KEY (b) WHERE b='';
-SELECT * FROM t1 WHERE a=b;
-SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b;
-DROP TABLE t1;
-
-#
-# MDEV-15570 Assertion `Item_cache_temporal::field_type() != MYSQL_TYPE_TIME' failed in Item_cache_temporal::val_datetime_packed
-#
-CREATE TABLE t1 (d DATE) ENGINE=InnoDB;
-INSERT INTO t1 VALUES ('2012-12-21');
-SELECT * FROM t1 WHERE LEAST( UTC_TIME(), d );
-DROP TABLE t1;
diff --git a/mysql-test/t/type_temporal_mysql56.test b/mysql-test/t/type_temporal_mysql56.test
deleted file mode 100644
index 98529bfe1c1..00000000000
--- a/mysql-test/t/type_temporal_mysql56.test
+++ /dev/null
@@ -1,23 +0,0 @@
-
-let $MYSQLD_DATADIR= `select @@datadir`;
---copy_file std_data/mysql56time.frm $MYSQLD_DATADIR/test/mysql56time.frm
---copy_file std_data/mysql56time.MYD $MYSQLD_DATADIR/test/mysql56time.MYD
---copy_file std_data/mysql56time.MYI $MYSQLD_DATADIR/test/mysql56time.MYI
-SHOW CREATE TABLE mysql56time;
---query_vertical SELECT * FROM mysql56time
-DROP TABLE mysql56time;
-
---copy_file std_data/mysql56datetime.frm $MYSQLD_DATADIR/test/mysql56datetime.frm
---copy_file std_data/mysql56datetime.MYD $MYSQLD_DATADIR/test/mysql56datetime.MYD
---copy_file std_data/mysql56datetime.MYI $MYSQLD_DATADIR/test/mysql56datetime.MYI
-SHOW CREATE TABLE mysql56datetime;
---query_vertical SELECT * FROM mysql56datetime
-DROP TABLE mysql56datetime;
-
---copy_file std_data/mysql56timestamp.frm $MYSQLD_DATADIR/test/mysql56timestamp.frm
---copy_file std_data/mysql56timestamp.MYD $MYSQLD_DATADIR/test/mysql56timestamp.MYD
---copy_file std_data/mysql56timestamp.MYI $MYSQLD_DATADIR/test/mysql56timestamp.MYI
-SET TIME_ZONE='+00:00';
-SHOW CREATE TABLE mysql56timestamp;
---query_vertical SELECT * FROM mysql56timestamp
-DROP TABLE mysql56timestamp;
diff --git a/mysql-test/t/type_time.test b/mysql-test/t/type_time.test
deleted file mode 100644
index d8bb66fcd5c..00000000000
--- a/mysql-test/t/type_time.test
+++ /dev/null
@@ -1,1292 +0,0 @@
-#
-# testing of the TIME column type
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1 (t time);
-insert into t1 values("10:22:33"),("12:34:56.78"),(10),(1234),(123456.78),(1234559.99),("1"),("1:23"),("1:23:45"), ("10.22"), ("-10 1:22:33.45"),("20 10:22:33"),("1999-02-03 20:33:34");
-insert t1 values (30),(1230),("1230"),("12:30"),("12:30:35"),("1 12:30:31.32");
-select * from t1;
-# Test wrong values
-insert ignore into t1 values("10.22.22"),(1234567),(123456789),(123456789.10),("10 22:22"),("12.45a");
-select * from t1;
-drop table t1;
-
-create table t1 (t time);
-insert into t1 values ('09:00:00'),('13:00:00'),('19:38:34'), ('13:00:00'),('09:00:00'),('09:00:00'),('13:00:00'),('13:00:00'),('13:00:00'),('09:00:00');
-select t, time_to_sec(t),sec_to_time(time_to_sec(t)) from t1;
-select sec_to_time(time_to_sec(t)) from t1;
-drop table t1;
-
-#
-# BUG #12440: Incorrect processing of time values containing
-# long fraction part and/or large exponent part.
-#
-# These must return normal result:
-# ##########################################################
-# To be uncommented after fix BUG #15805
-# ##########################################################
-# SELECT CAST(235959.123456 AS TIME);
-# SELECT CAST(0.235959123456e+6 AS TIME);
-# SELECT CAST(235959123456e-6 AS TIME);
-# These must cut fraction part and produce warning:
-# SELECT CAST(235959.1234567 AS TIME);
-# SELECT CAST(0.2359591234567e6 AS TIME);
-# This must return NULL and produce warning:
-# SELECT CAST(0.2359591234567e+30 AS TIME);
-# ##########################################################
-
---echo End of 4.1 tests
-
-#
-# Bug#29555: Comparing time values as strings may lead to a wrong result.
-#
-select cast('100:55:50' as time) < cast('24:00:00' as time);
-select cast('100:55:50' as time) < cast('024:00:00' as time);
-select cast('300:55:50' as time) < cast('240:00:00' as time);
-select cast('100:55:50' as time) > cast('24:00:00' as time);
-select cast('100:55:50' as time) > cast('024:00:00' as time);
-select cast('300:55:50' as time) > cast('240:00:00' as time);
-create table t1 (f1 time);
-insert into t1 values ('24:00:00');
-select cast('24:00:00' as time) = (select f1 from t1);
-drop table t1;
-
-#
-# Bug#29739: Incorrect time comparison in BETWEEN.
-#
-create table t1(f1 time, f2 time);
-insert into t1 values('20:00:00','150:00:00');
-select 1 from t1 where cast('100:00:00' as time) between f1 and f2;
-drop table t1;
-
-#
-# Bug#29729: Wrong conversion error led to an empty result set.
-#
-CREATE TABLE t1 (
- f2 date NOT NULL,
- f3 int(11) unsigned NOT NULL default '0',
- PRIMARY KEY (f3, f2)
-);
-insert into t1 values('2007-07-01', 1);
-insert into t1 values('2007-07-01', 2);
-insert into t1 values('2007-07-02', 1);
-insert into t1 values('2007-07-02', 2);
-SELECT sum(f3) FROM t1 where f2='2007-07-01 00:00:00' group by f2;
-drop table t1;
-
-
---echo #
---echo # Bug #44792: valgrind warning when casting from time to time
---echo #
-
-CREATE TABLE t1 (c TIME);
-INSERT INTO t1 VALUES ('0:00:00');
-SELECT CAST(c AS TIME) FROM t1;
-DROP TABLE t1;
-
---echo End of 5.0 tests
-
---echo #
---echo # Bug#53942 valgrind warnings with timestamp() function and incomplete datetime values
---echo #
-
-SET timestamp=unix_timestamp('2001-02-03 10:20:30');
-CREATE TABLE t1(f1 TIME);
-INSERT INTO t1 VALUES ('23:38:57');
-SELECT TIMESTAMP(f1,'1') FROM t1;
-DROP TABLE t1;
-SET timestamp=DEFAULT;
-
---echo End of 5.1 tests
-
-create table t1 (a time);
-insert t1 values (-131415);
-select * from t1;
-drop table t1;
-
-#
-# lp:731229 Different results depending on table access method with TIME column and CURDATE()
-#
-create table t1 (f1 time , f2 varchar(5), key(f1));
-insert into t1 values ('00:20:01','a'),('00:20:03','b');
-select * from t1 force key (f1) where f1 < curdate();
-select * from t1 ignore key (f1) where f1 < curdate();
-select * from t1 force key (f1) where f1 > curdate();
-select * from t1 ignore key (f1) where f1 > curdate();
-delete from t1;
-insert into t1 values ('-00:20:01','a'),('-00:20:03','b');
-select * from t1 force key (f1) where f1 < curdate();
-select * from t1 ignore key (f1) where f1 < curdate();
-drop table t1;
-
-#
-# comparison of time and datetime:
-#
-create table t1(f1 time);
-insert into t1 values ('23:38:57');
-select f1, f1 = '2010-10-11 23:38:57' from t1;
-drop table t1;
-
---echo #
---echo # MDEV-4634 Crash in CONVERT_TZ
---echo #
-SET timestamp=unix_timestamp('2001-02-03 10:20:30');
-SELECT CONVERT_TZ(GREATEST(TIME('00:00:00'),TIME('00:00:00')),'+00:00','+7:5');
-SET timestamp=DEFAULT;
-
---echo #
---echo # MDEV-4652 Wrong result for CONCAT(GREATEST(TIME('00:00:01'),TIME('00:00:00')))
---echo #
-SELECT CONCAT(GREATEST(TIME('00:00:01'),TIME('00:00:00')));
-SELECT CONCAT(GREATEST(TIME('32 00:00:01'),TIME('00:00:00')));
-
---echo #
---echo # MDEV-4859 Wrong value and data type of "SELECT MAX(time_column) + 1 FROM t1"
---echo #
-CREATE TABLE t1 (t0 TIME);
-INSERT INTO t1 VALUES ('10:10:10');
-SELECT MAX(t0)+1 FROM t1;
-CREATE TABLE t2 AS SELECT MAX(t0)+1 FROM t1;
-SELECT * FROM t2;
-SHOW COLUMNS FROM t2;
-DROP TABLE t2,t1;
-
-CREATE TABLE t1 (t0 TIME);
-INSERT INTO t1 VALUES ('10:10:10');
-SELECT MAX(t0)+1.1 FROM t1;
-CREATE TABLE t2 AS SELECT MAX(t0)+1.1 FROM t1;
-SELECT * FROM t2;
-SHOW COLUMNS FROM t2;
-DROP TABLE t2,t1;
-
-CREATE TABLE t1 (t0 TIME);
-INSERT INTO t1 VALUES ('10:10:10');
-SELECT MAX(t0)+1e0 FROM t1;
-CREATE TABLE t2 AS SELECT MAX(t0)+1e0 FROM t1;
-SELECT * FROM t2;
-SHOW COLUMNS FROM t2;
-DROP TABLE t2,t1;
-
-CREATE TABLE t1 (t1 TIME(1));
-INSERT INTO t1 VALUES ('10:10:10');
-SELECT MAX(t1)+1 FROM t1;
-CREATE TABLE t2 AS SELECT MAX(t1)+1 FROM t1;
-SELECT * FROM t2;
-SHOW COLUMNS FROM t2;
-DROP TABLE t2,t1;
-
-CREATE TABLE t1 (t0 DATETIME);
-INSERT INTO t1 VALUES ('2001-01-01 10:10:10');
-SELECT MAX(t0)+1 FROM t1;
-CREATE TABLE t2 AS SELECT MAX(t0)+1 FROM t1;
-SELECT * FROM t2;
-SHOW COLUMNS FROM t2;
-DROP TABLE t2,t1;
-
-CREATE TABLE t1 (t0 DATETIME);
-INSERT INTO t1 VALUES ('2001-01-01 10:10:10');
-SELECT MAX(t0)+1.1 FROM t1;
-CREATE TABLE t2 AS SELECT MAX(t0)+1.1 FROM t1;
-SELECT * FROM t2;
-SHOW COLUMNS FROM t2;
-DROP TABLE t2,t1;
-
-CREATE TABLE t1 (t0 DATETIME);
-INSERT INTO t1 VALUES ('2001-01-01 10:10:10');
-SELECT MAX(t0)+1e0 FROM t1;
-CREATE TABLE t2 AS SELECT MAX(t0)+1e0 FROM t1;
-SELECT * FROM t2;
-SHOW COLUMNS FROM t2;
-DROP TABLE t2,t1;
-
-CREATE TABLE t1 (t1 DATETIME(1));
-INSERT INTO t1 VALUES ('2001-01-01 10:10:10');
-SELECT MAX(t1)+1 FROM t1;
-CREATE TABLE t2 AS SELECT MAX(t1)+1 FROM t1;
-SELECT * FROM t2;
-SHOW COLUMNS FROM t2;
-DROP TABLE t2,t1;
-
---echo #
---echo # MDEV-4858 Wrong results for a huge unsigned value inserted into a TIME column
---echo #
-SET sql_mode=traditional;
-CREATE TABLE t1 (a TIME(6));
---error ER_TRUNCATED_WRONG_VALUE
-INSERT INTO t1 VALUES (CAST(0xFFFFFFFF00000000 AS UNSIGNED));
-SET sql_mode=DEFAULT;
-INSERT IGNORE INTO t1 VALUES (CAST(0xFFFFFFFF00000000 AS UNSIGNED));
-SELECT * FROM t1;
-DROP TABLE t1;
-SELECT TIME'00:00:00'> CAST(0xFFFFFFFF00000000 AS UNSIGNED);
-
---echo #
---echo # MDEV-6100 No warning on CAST(9000000 AS TIME)
---echo #
-SELECT CAST(9000000 AS TIME);
-
---echo #
---echo # End of 5.3 tests
---echo #
-
-#
-# Bug#42664 - Sign ignored for TIME types when not comparing as longlong
-#
-
-CREATE TABLE t1 (f1 TIME);
-INSERT INTO t1 VALUES ('24:00:00');
-SELECT '24:00:00' = (SELECT f1 FROM t1);
-SELECT CAST('24:00:00' AS TIME) = (SELECT f1 FROM t1);
-SELECT CAST('-24:00:00' AS TIME) = (SELECT f1 FROM t1);
-TRUNCATE t1;
-INSERT INTO t1 VALUES ('-24:00:00');
-SELECT CAST('24:00:00' AS TIME) = (SELECT f1 FROM t1);
-SELECT CAST('-24:00:00' AS TIME) = (SELECT f1 FROM t1);
-SELECT '-24:00:00' = (SELECT f1 FROM t1);
-DROP TABLE t1;
-
---echo #
---echo # MDEV-6592 Assertion `ltime->day == 0' failed with TIMESTAMP, MAKETIME
---echo #
-CREATE TABLE t1 (d DATE, c VARCHAR(10), KEY(d)) engine=myisam;
-INSERT INTO t1 VALUES ('2008-10-02','2008-10-02'), ('2008-10-02','2008-10-02');
-SELECT * FROM t1 WHERE TIMESTAMP(c,'02:04:42') AND d <=> MAKETIME(97,0,7);
-DROP TABLE t1;
-
---echo #
---echo # End of 5.5 tests
---echo #
-
---echo #
---echo # Start of 10.0 tests
---echo #
-
---echo #
---echo # MDEV-6102 Comparison between TIME and DATETIME does not use CURRENT_DATE
---echo #
-SET timestamp=UNIX_TIMESTAMP('2014-04-14 01:02:03');
-SELECT CAST(TIME'10:20:30' AS DATETIME), TIME'10:20:30'=TIMESTAMP'2014-04-14 10:20:30' AS cmp;
-SET timestamp=DEFAULT;
-
---echo #
---echo # End of 10.0 tests
---echo #
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-8699 Wrong result for SELECT..WHERE HEX(date_column)!='323030312D30312D3031' AND date_column='2001-01-01x'
---echo #
-
---echo # Trailing garbage in string literals
-
-CREATE TABLE t1 (a TIME);
-INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
-SELECT * FROM t1 WHERE LENGTH(a)=8;
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='00:00:00x';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='00:00:00x';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='00:00:00x';
-DROP TABLE t1;
-
---echo # Trailing fractional digits in string literals
-CREATE TABLE t1 (a TIME);
-INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
-SELECT * FROM t1 WHERE LENGTH(a)=8;
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='00:00:00.000000';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='00:00:00.000000';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='00:00:00.000000';
-DROP TABLE t1;
-
---echo # Trailing fractional digits in temporal literals
-CREATE TABLE t1 (a TIME);
-INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
-SELECT * FROM t1 WHERE LENGTH(a)=8;
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'00:00:00.000000';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'00:00:00.000000';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'00:00:00.000000';
-DROP TABLE t1;
-
---echo # Trailing fractional digits in temporal literals, same precision
-CREATE TABLE t1 (a TIME(6));
-INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
-SELECT * FROM t1 WHERE LENGTH(a)=8;
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'00:00:00.000000';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'00:00:00.000000';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'00:00:00.000000';
-DROP TABLE t1;
-
---echo # Leading spaces in string literals
-CREATE TABLE t1 (a TIME);
-INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
-SELECT * FROM t1 WHERE LENGTH(a)=8;
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=' 00:00:00';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=' 00:00:00';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=' 00:00:00';
-DROP TABLE t1;
-
---echo # Numeric format in string literals
-CREATE TABLE t1 (a TIME);
-INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
-SELECT * FROM t1 WHERE LENGTH(a)=8;
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='000000';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='000000';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='000000';
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8766 Wrong result for SELECT..WHERE LENGTH(time_column)=8 AND time_column=TIMESTAMP'2001-01-01 10:20:31'
---echo #
-SET timestamp=UNIX_TIMESTAMP('2001-01-01 01:02:03');
-
---echo # TIMESTAMP literal with the same scale, ok to propagate
-CREATE TABLE t1 (a TIME);
-INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31');
-SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-01 10:20:31';
-SELECT * FROM t1 WHERE LENGTH(a)=8;
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31';
-DROP TABLE t1;
-
---echo # TIMESTAMP literal with a bigger scale and fractional second truncation
---echo # Ok to propagate with precision truncation
-CREATE TABLE t1 (a TIME);
-INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31');
-SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-01 10:20:31.123';
-SELECT * FROM t1 WHERE LENGTH(a)=8;
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.123';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.123';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31.123';
-DROP TABLE t1;
-
---echo # TIMESTAMP literal with a bigger scale and no fractional second truncation
---echo # Ok to propagate
-CREATE TABLE t1 (a TIME);
-INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31');
-SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-01 10:20:31.000';
-SELECT * FROM t1 WHERE LENGTH(a)=8;
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.000';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.000';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31.000';
-DROP TABLE t1;
-
---echo # TIMESTAMP literal with a smaller scale
---echo # Ok to propagate
-CREATE TABLE t1 (a TIME(6));
-INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31');
-SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-01 10:20:31.123';
-SELECT * FROM t1 WHERE LENGTH(a)=8;
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.123';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIMESTAMP'2001-01-01 10:20:31.123';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIMESTAMP'2001-01-01 10:20:31.123';
-DROP TABLE t1;
-
-
---echo # TIME literal with a bigger scale and fractional second truncation
---echo # Ok to propagate with precision truncation
-CREATE TABLE t1 (a TIME);
-INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31');
-SELECT * FROM t1 WHERE a=TIME'10:20:31.123';
-SELECT * FROM t1 WHERE LENGTH(a)=8;
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'10:20:31.123';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'10:20:31.123';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'10:20:31.123';
-DROP TABLE t1;
-
---echo # TIME literal with a bigger scale and no fractional second truncation
---echo # Ok to propagate
-CREATE TABLE t1 (a TIME);
-INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31');
-SELECT * FROM t1 WHERE a=TIME'10:20:31.000';
-SELECT * FROM t1 WHERE LENGTH(a)=8;
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'10:20:31.000';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'10:20:31.000';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'10:20:31.000';
-DROP TABLE t1;
-
---echo # TIME literal with a smaller scale
---echo # Ok to propagate
-CREATE TABLE t1 (a TIME(6));
-INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31');
-SELECT * FROM t1 WHERE a=TIME'10:20:31.123';
-SELECT * FROM t1 WHERE LENGTH(a)=8;
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'10:20:31.123';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a=TIME'10:20:31.123';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=TIME'10:20:31.123';
-DROP TABLE t1;
-
-
---echo # TIME-alike string literal with a bigger scale and fractional second truncation
---echo # Ok to propagate with precision truncation
-CREATE TABLE t1 (a TIME);
-INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31');
-SELECT * FROM t1 WHERE a='10:20:31.123';
-SELECT * FROM t1 WHERE LENGTH(a)=8;
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.123';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.123';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='10:20:31.123';
-DROP TABLE t1;
-
---echo # TIME-alike string literal with a bigger scale and no fractional second truncation
---echo # Ok to propagate
-CREATE TABLE t1 (a TIME);
-INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31');
-SELECT * FROM t1 WHERE a='10:20:31.000';
-SELECT * FROM t1 WHERE LENGTH(a)=8;
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.000';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.000';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='10:20:31.000';
-DROP TABLE t1;
-
---echo # TIME-alike string literal with a smaller scale
---echo # Ok to propagate
-CREATE TABLE t1 (a TIME(6));
-INSERT INTO t1 VALUES ('10:20:31'),('-10:20:31');
-SELECT * FROM t1 WHERE a='10:20:31.123';
-SELECT * FROM t1 WHERE LENGTH(a)=8;
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.123';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=8 AND a='10:20:31.123';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a='10:20:31.123';
-DROP TABLE t1;
-
-SET timestamp=DEFAULT;
-
-
-SET @@old_mode=zero_date_time_cast;
---echo # TIMESTAMP literal, old mode
-CREATE TABLE t1 (a TIME);
-INSERT INTO t1 VALUES ('0000-00-00 10:20:30'),('0000-00-00 10:20:31');
-INSERT INTO t1 VALUES ('0000-00-01 10:20:30'),('0000-00-01 10:20:31');
-INSERT INTO t1 VALUES ('31 10:20:30'),('32 10:20:30'),('33 10:20:30'),('34 10:20:30');
-SELECT * FROM t1;
-
---echo # Old mode, TIMESTAMP literal, zero YYYYMMDD, Ok to propagate
-SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-00 10:20:30';
-SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-00 10:20:30' AND LENGTH(a)=8;
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-00 10:20:30' AND LENGTH(a)=8;
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-00 10:20:30' AND LENGTH(a)=30+RAND();
-
---echo # Old mode, TIMESTAMP literal, non-zero YYYYMMDD, no propagation
-SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-01 10:20:30';
-SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-01 10:20:30' AND LENGTH(a)=8;
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-01 10:20:30' AND LENGTH(a)=8;
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE a=TIMESTAMP'0000-00-01 10:20:30' AND LENGTH(a)=30+RAND();
-
---echo # Old mode, TIMESTAMP-alike string literal, zero YYYYMMDD, Ok to propagate
-SELECT * FROM t1 WHERE a='0000-00-00 10:20:30';
-SELECT * FROM t1 WHERE a='0000-00-00 10:20:30' AND LENGTH(a)=8;
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE a='0000-00-00 10:20:30' AND LENGTH(a)=8;
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE a='0000-00-00 10:20:30' AND LENGTH(a)=30+RAND();
-
---echo # Old mode, TIMESTAMP-alike literal, non-zero YYYYMMDD, no propagation
-SELECT * FROM t1 WHERE a='0000-00-01 10:20:30';
-SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8;
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8;
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=30+RAND();
-
-DROP TABLE t1;
-
-SET @@old_mode=DEFAULT;
-
---echo #
---echo # MDEV-8706 Wrong result for SELECT..WHERE time_column=TIMESTAMP'2015-08-30 00:00:00' AND time_column='00:00:00'
---echo #
-SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30');
-CREATE TABLE t1 (a TIME);
-INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
-SELECT * FROM t1 WHERE a=TIMESTAMP'2015-08-30 00:00:00';
-SELECT * FROM t1 WHERE a='00:00:00';
-SELECT * FROM t1 WHERE a=TIMESTAMP'2015-08-30 00:00:00' AND a='00:00:00';
-SELECT * FROM t1 WHERE a>=TIMESTAMP'2015-08-30 00:00:00' AND a='00:00:00';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE a>=TIMESTAMP'2015-08-30 00:00:00' AND a='00:00:00';
-DROP TABLE t1;
-
-# TIMESTAMP literal with fractional seconds
-SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30');
-CREATE TABLE t1 (a TIME);
-INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
-SELECT * FROM t1 WHERE DATE(a)<=TIMESTAMP'2015-08-30 00:00:00.1' AND a='00:00:00';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE DATE(a)<=TIMESTAMP'2015-08-30 00:00:00.1' AND a='00:00:00';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE TIMESTAMP('2015-08-08',a+RAND())<=TIMESTAMP'2015-08-30 00:00:00.1' AND a='00:00:00';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE TIMESTAMP('2015-08-08',a+RAND())<=TIMESTAMP'2015-08-30 00:00:00.1' AND a='00:00:00.1';
-DROP TABLE t1;
-
-# DATE literal
-SET timestamp=UNIX_TIMESTAMP('2015-08-30 10:20:30');
-CREATE TABLE t1 (a TIME);
-INSERT INTO t1 VALUES ('00:00:00'),('00:00:01');
-SELECT * FROM t1 WHERE DATE(a)<=DATE'2015-08-30' AND a='00:00:00';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE DATE(a)<=DATE'2015-08-30' AND a='00:00:00';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE TIMESTAMP('2015-08-08',a+RAND())<=DATE'2015-08-30' AND a='00:00:00';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE TIMESTAMP('2015-08-08',a+RAND())<=DATE'2015-08-30' AND a='00:00:00.1';
-DROP TABLE t1;
-
-SET timestamp=DEFAULT;
-
---echo #
---echo # MDEV-8795 Equal expression propagation does not work for temporal literals
---echo #
-CREATE TABLE t1 (a TIME);
-INSERT INTO t1 VALUES ('00:00:01'),('00:00:02');
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:01' AND COALESCE(a)>=TIME'00:00:01';
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8793 Wrong result set for SELECT ... WHERE COALESCE(time_column)=TIME('00:00:00') AND COALESCE(time_column)=DATE('2015-09-11')
---echo #
-SET timestamp=UNIX_TIMESTAMP('2015-09-11 20:20:20');
-CREATE TABLE t1 (a TIME);
-INSERT INTO t1 VALUES('10:20:30'),('00:00:00');
-SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00');
-SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11');
-
---echo # TIME cast + DATE cast
-SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE('2015-09-11');
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE('2015-09-11');
-
---echo # TIME cast + DATE literal
-SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE'2015-09-11';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE'2015-09-11';
-
---echo # TIME literal + DATE cast
-SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:00' AND COALESCE(a)=DATE('2015-09-11');
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:00' AND COALESCE(a)=DATE('2015-09-11');
-
---echo # TIME literal + DATE literal
-SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:00' AND COALESCE(a)=DATE'2015-09-11';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:00' AND COALESCE(a)=DATE'2015-09-11';
-
---echo # TIME-alike string literal + DATE cast
-SELECT * FROM t1 WHERE COALESCE(a)='00:00:00' AND COALESCE(a)=DATE('2015-09-11');
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE COALESCE(a)='00:00:00' AND COALESCE(a)=DATE('2015-09-11');
-
---echo # TIME-alike string literal + DATE literal
-SELECT * FROM t1 WHERE COALESCE(a)='00:00:00' AND COALESCE(a)=DATE'2015-09-11';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE COALESCE(a)='00:00:00' AND COALESCE(a)=DATE'2015-09-11';
-
---echo # TIME-alike integer literal + DATE cast
-SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE('2015-09-11');
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE('2015-09-11');
-
---echo # TIME-alike integer literal + DATE literal
-SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE'2015-09-11';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE'2015-09-11';
-
-
-### Now test the opposite order of the two equality expressions
-
---echo # DATE cast + TIME cast
-SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME('00:00:00');
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME('00:00:00');
-
---echo # DATE cast + TIME literal
-SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME'00:00:00';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME'00:00:00';
-
---echo # DATE cast + TIME-alike string literal
-SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)='00:00:00';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)='00:00:00';
-
---echo # DATE cast + TIME-alike integer literal
-SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=0;
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=0;
-
---echo # DATE literal + TIME cast
-SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=TIME('00:00:00');
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=TIME('00:00:00');
-
---echo # DATE literal + TIME literal
-SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=TIME'00:00:00';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=TIME'00:00:00';
-
---echo # DATE literal + TIME-alike string literal
-SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)='00:00:00';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)='00:00:00';
-
---echo # DATE literal + TIME-alike integer literal
-SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=0;
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=0;
-
-DROP TABLE t1;
-SET timestamp=DEFAULT;
-
---echo #
---echo # MDEV-8814 Wrong result for WHERE datetime_column > TIME('00:00:00')
---echo #
-CREATE TABLE t1 (a DATETIME);
-INSERT INTO t1 VALUES ('2000-09-12 00:00:00'), ('2007-04-25 05:08:49');
-SELECT * FROM t1 WHERE a>TIME'00:00:00';
-SELECT * FROM t1 WHERE a>TIME('00:00:00');
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-8660 TIME(int_zerofill_column) returns a wrong result
---echo #
-CREATE TABLE t1 (a BIGINT(15), b BIGINT(15) ZEROFILL);
-INSERT INTO t1 VALUES (9,9);
-SELECT TIME(a),TIME(b) FROM t1;
-DROP TABLE t1;
-CREATE TABLE t1 (a BIGINT);
-INSERT INTO t1 VALUES (-9223372036854775808);
-SELECT CAST(a AS TIME), CAST(-9223372036854775808 AS TIME) FROM t1;
-DROP TABLE t1;
-
-# Make sure all numeric types produce the same TIME value
-CREATE TABLE t1 (a INT, b DECIMAL, c DOUBLE);
-INSERT INTO t1 VALUES (-9000000,-9000000,-9000000);
-INSERT INTO t1 VALUES (-1,-1,-1);
-INSERT INTO t1 VALUES (0,0,0),(1,1,1),(9,9,9);
-INSERT INTO t1 VALUES (9000000,9000000,9000000);
-SELECT a, TIME(a),TIME(b),TIME(c) FROM t1 ORDER BY a;
-DROP TABLE t1;
-CREATE TABLE t1 (a INT, b DECIMAL, c DOUBLE);
-INSERT INTO t1 VALUES (0,0,0),(1,1,1),(9,9,9);
-INSERT INTO t1 VALUES (9000000,9000000,9000000);
-SELECT a, TIME(a),TIME(b),TIME(c) FROM t1 ORDER BY a;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8862 Wrong field type for MAX(COALESCE(datetime_column))
---echo #
-CREATE TABLE t1 (a TIME);
-INSERT INTO t1 VALUES ('10:10:10'),('10:20:30');
-SELECT MAX(a), MAX(COALESCE(a)) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-15321: different results when using value of optimizer_use_condition_selectivity=4 and =1
---echo #
-
-SET @save_old_mode=@@old_mode;
-SET @@old_mode=zero_date_time_cast;
-CREATE TABLE t1 (a TIME);
-INSERT INTO t1 VALUES ('0000-00-00 10:20:30'),('0000-00-00 10:20:31');
-INSERT INTO t1 VALUES ('0000-00-01 10:20:30'),('0000-00-01 10:20:31');
-INSERT INTO t1 VALUES ('31 10:20:30'),('32 10:20:30'),('33 10:20:30'),('34 10:20:30');
-
-SET @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
-SET @@optimizer_use_condition_selectivity=1;
-SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8;
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8;
-
-SET @@optimizer_use_condition_selectivity=4;
-SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8;
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8;
-drop table t1;
-SET @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
-set @@old_mode= @save_old_mode;
-
---echo #
---echo # End of 10.1 tests
---echo #
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
-
---echo #
---echo # MDEV-9393 Split Copy_field::get_copy_func() into virtual methods in Field
---echo #
-
-CREATE TABLE t1 (a YEAR, b TIME, c YEAR);
-CREATE TABLE t2 (a YEAR);
-INSERT INTO t2 VALUES (0),(1999),(2000),(2030),(2050),(2070);
-INSERT INTO t1 (a,b,c) SELECT a,a,a FROM t2;
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-ALTER TABLE t1 MODIFY c TIME;
-SELECT * FROM t1;
-DROP TABLE t1,t2;
-
-
---echo #
---echo # MDEV-10817 CAST(MAX(DATE'2001-01-01') AS TIME) returns a wrong result
---echo #
-
-SELECT CAST(DATE'2001-01-01' AS TIME);
-SELECT CAST(MAX(DATE'2001-01-01') AS TIME);
-CREATE FUNCTION f1() RETURNS DATE RETURN DATE'2001-01-01';
-SELECT CAST(f1() AS TIME);
-DROP FUNCTION f1;
-
-
---echo #
---echo # End of 10.2 tests
---echo #
-
---echo #
---echo # Start of 10.3 tests
---echo #
-
---echo #
---echo # MDEV-11514 IN with a mixture of TIME and DATETIME returns a wrong result
---echo #
-SET timestamp=UNIX_TIMESTAMP('2001-01-01 00:00:00');
-SELECT TIME'10:20:30' IN (102030,TIME'10:20:31');
-SELECT TIME'10:20:30' IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32');
-CREATE TABLE t1 (a TIME);
-INSERT INTO t1 VALUES ('10:20:30'),('10:20:31'),('10:20:32');
-SELECT a FROM t1 WHERE a IN (102030,TIME'10:20:31',TIMESTAMP'2001-01-01 10:20:32') ORDER BY a;
-DROP TABLE t1;
-SET timestamp=DEFAULT;
-
---echo #
---echo # MDEV-15176 Storing DATETIME-alike VARCHAR data into TIME produces wrong results
---echo #
-
-SET sql_mode='';
-CREATE OR REPLACE TABLE t0 (d VARCHAR(64));
-INSERT INTO t0 VALUES ('0000-00-00 10:20:30');
-INSERT INTO t0 VALUES ('0000-00-01 10:20:30');
-INSERT INTO t0 VALUES ('0000-01-00 10:20:30');
-INSERT INTO t0 VALUES ('0000-01-01 10:20:30');
-INSERT INTO t0 VALUES ('0001-00-00 10:20:30');
-INSERT INTO t0 VALUES ('0001-00-01 10:20:30');
-INSERT INTO t0 VALUES ('0001-01-00 10:20:30');
-INSERT INTO t0 VALUES ('0001-01-01 10:20:30');
-
-SET @@global.mysql56_temporal_format=false;
-CREATE OR REPLACE TABLE t1 (d VARCHAR(64), t0 TIME(0), t1 TIME(1));
-INSERT INTO t1 SELECT d,d,d FROM t0;
-SELECT * FROM t1 ORDER BY d;
-DROP TABLE t1;
-CREATE OR REPLACE TABLE t1 (d VARCHAR(64), t0 TIME(0), t1 TIME(1));
-INSERT INTO t1 SELECT CONCAT(d,'x'),CONCAT(d,'x'),CONCAT(d,'x') FROM t0;
-SELECT * FROM t1;
-DROP TABLE t1;
-
-SET @@global.mysql56_temporal_format=true;
-CREATE OR REPLACE TABLE t1 (d VARCHAR(64), t0 TIME(0), t1 TIME(1));
-INSERT INTO t1 SELECT d,d,d FROM t0;
-SELECT * FROM t1;
-DROP TABLE t1;
-CREATE OR REPLACE TABLE t1 (d VARCHAR(64), t0 TIME(0), t1 TIME(1));
-INSERT INTO t1 SELECT CONCAT(d,'x'),CONCAT(d,'x'),CONCAT(d,'x') FROM t0;
-SELECT * FROM t1 ORDER BY d;
-DROP TABLE t1;
-
-DROP TABLE t0;
-SET sql_mode=DEFAULT;
-
---echo #
---echo # MDEV-15287 Bad result for LEAST/GREATEST(datetime_alike_string, time)
---echo #
-
---vertical_results
-
-SELECT
- GREATEST('2010-01-01 10:10:10',TIME('-20:20:20')) AS gt_minus20_implicit,
- GREATEST(CAST('2010-01-01 10:10:10' AS TIME(6)),TIME('-20:20:20')) AS gt_minis20_explicit,
- GREATEST('2010-01-01 10:10:10',TIME('20:20:20')) AS gt_plus20_implicit,
- GREATEST(CAST('2010-01-01 10:10:10' AS TIME(6)),TIME('20:20:20')) AS gt_plus20_explicit;
-SELECT
- HOUR(GREATEST('2010-01-01 10:10:10',TIME('-20:20:20'))) AS gt_minus20_implicit,
- HOUR(GREATEST(CAST('2010-01-01 10:10:10' AS TIME(6)),TIME('-20:20:20'))) AS gt_minis20_explicit,
- HOUR(GREATEST('2010-01-01 10:10:10',TIME('20:20:20'))) AS gt_plus20_implicit,
- HOUR(GREATEST(CAST('2010-01-01 10:10:10' AS TIME(6)),TIME('20:20:20'))) AS gt_plus20_explicit;
-
-SELECT
- LEAST('2010-01-01 10:10:10',TIME('-20:20:20')) AS lt_minus20_implicit,
- LEAST(CAST('2010-01-01 10:10:10' AS TIME(6)),TIME('-20:20:20')) AS lt_minus20_explicit,
- LEAST('2010-01-01 10:10:10',TIME('20:20:20')) AS lt_plus20_implicit,
- LEAST(CAST('2010-01-01 10:10:10' AS TIME(6)),TIME('20:20:20')) AS lt_plus20_explicit;
-SELECT
- HOUR(LEAST('2010-01-01 10:10:10',TIME('-20:20:20'))) AS lt_minus20_implicit,
- HOUR(LEAST(CAST('2010-01-01 10:10:10' AS TIME(6)),TIME('-20:20:20'))) AS lt_minus20_explicit,
- HOUR(LEAST('2010-01-01 10:10:10',TIME('20:20:20'))) AS lt_plus20_implicit,
- HOUR(LEAST(CAST('2010-01-01 10:10:10' AS TIME(6)),TIME('20:20:20'))) AS lt_plus20_explicit;
-
-SELECT
- GREATEST('2010-01-01 10:10:10',TIME('-200:20:20')) AS gt_minus200_implicit,
- GREATEST(CAST('2010-01-01 10:10:10' AS TIME(6)),TIME('-200:20:20')) AS gt_minus200_explictit,
- GREATEST('2010-01-01 10:10:10',TIME('200:20:20')) AS gt_plus200_implicit,
- GREATEST(CAST('2010-01-01 10:10:10' AS TIME(6)),TIME('200:20:20')) AS gt_plus200_explicit;
-SELECT
- HOUR(GREATEST('2010-01-01 10:10:10',TIME('-200:20:20'))) AS gt_minus200_implicit,
- HOUR(GREATEST(CAST('2010-01-01 10:10:10' AS TIME(6)),TIME('-200:20:20'))) AS gt_minus200_explictit,
- HOUR(GREATEST('2010-01-01 10:10:10',TIME('200:20:20'))) AS gt_plus200_implicit,
- HOUR(GREATEST(CAST('2010-01-01 10:10:10' AS TIME(6)),TIME('200:20:20'))) AS gt_plus200_explicit;
-
-SELECT
- LEAST('2010-01-01 10:10:10',TIME('-200:20:20')) AS lt_minus200_implicit,
- LEAST(CAST('2010-01-01 10:10:10' AS TIME(6)),TIME('-200:20:20')) AS lt_minus200_explictit,
- LEAST('2010-01-01 10:10:10',TIME('200:20:20')) AS lt_plus200_implicit,
- LEAST(CAST('2010-01-01 10:10:10' AS TIME(6)),TIME('200:20:20')) AS lt_plus200_explicit;
-SELECT
- HOUR(LEAST('2010-01-01 10:10:10',TIME('-200:20:20'))) AS lt_minus200_implicit,
- HOUR(LEAST(CAST('2010-01-01 10:10:10' AS TIME(6)),TIME('-200:20:20'))) AS lt_minus200_explictit,
- HOUR(LEAST('2010-01-01 10:10:10',TIME('200:20:20'))) AS lt_plus200_implicit,
- HOUR(LEAST(CAST('2010-01-01 10:10:10' AS TIME(6)),TIME('200:20:20'))) AS lt_plus200_explicit;
-
---horizontal_results
-
-
---echo #
---echo # MDEV-15293 CAST(AS TIME) returns bad results for LAST_VALUE(),NAME_CONST(),SP variable
---echo #
-
-SELECT CAST(DATE'2001-01-01' AS TIME);
-SELECT CAST(LAST_VALUE(DATE'2001-01-01') AS TIME);
-SELECT CAST(NAME_CONST('name',DATE'2001-01-01') AS TIME);
-DELIMITER $$;
-BEGIN NOT ATOMIC
- DECLARE a DATE DEFAULT '2001-01-01';
- SELECT CAST(a AS TIME);
-END;
-$$
-DELIMITER ;$$
-
-CREATE OR REPLACE TABLE t1 (dt DATE,country VARCHAR(10), amount INT);
-INSERT INTO t1 VALUES ('2000-01-01','DE',102);
-SELECT
- dt, country, amount,
- FIRST_VALUE(dt) OVER () AS first,
- MINUTE(FIRST_VALUE(dt) OVER ()) AS m_first,
- LAST_VALUE(dt) OVER () AS last,
- MINUTE(LAST_VALUE(dt) OVER ()) AS m_last
-FROM t1
-ORDER BY country, dt;
-SELECT
- dt, country, amount,
- FIRST_VALUE(dt) OVER () AS first,
- CAST(FIRST_VALUE(dt) OVER () AS TIME) AS t_first,
- LAST_VALUE(dt) OVER () AS last,
- CAST(LAST_VALUE(dt) OVER () AS TIME) AS t_last
-FROM t1
-ORDER BY country, dt;
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-15310 Range optimizer does not work well for "WHERE temporal_column NOT IN (const_list)"
---echo #
-
---echo #
---echo # TIME(0), positive within 24 hour
---echo #
-
-CREATE TABLE t1 (a TIME, filler CHAR(200), KEY(a));
-INSERT INTO t1 VALUES ('23:00:01', 'no');
-INSERT INTO t1 VALUES ('23:00:01', 'no');
-INSERT INTO t1 VALUES ('23:00:01', 'no');
-INSERT INTO t1 VALUES ('23:00:01', 'no');
-INSERT INTO t1 VALUES ('23:00:01', 'no');
-INSERT INTO t1 VALUES ('23:00:01', 'no');
-INSERT INTO t1 VALUES ('23:00:01', 'no');
-INSERT INTO t1 VALUES ('23:00:01', 'no');
-INSERT INTO t1 VALUES ('23:00:01', 'no');
-INSERT INTO t1 VALUES ('23:00:01', 'no');
-INSERT INTO t1 VALUES ('23:00:01', 'no');
-INSERT INTO t1 VALUES ('23:00:01', 'no');
-INSERT INTO t1 VALUES ('23:00:01', 'no');
-INSERT INTO t1 VALUES ('23:00:01', 'no');
-INSERT INTO t1 VALUES ('23:00:01', 'no');
-INSERT INTO t1 VALUES ('23:00:01', 'no');
-INSERT INTO t1 VALUES ('23:00:01', 'no');
-INSERT INTO t1 VALUES ('23:00:01', 'no');
-INSERT INTO t1 VALUES ('23:00:01', 'no');
-INSERT INTO t1 VALUES ('23:00:01', 'no');
-INSERT INTO t1 VALUES ('23:00:01', 'no');
-INSERT INTO t1 VALUES ('23:00:01', 'no');
-INSERT INTO t1 VALUES ('23:00:01', 'no');
-INSERT INTO t1 VALUES ('23:00:01', 'no');
-INSERT INTO t1 VALUES ('23:00:02', 'no');
-INSERT INTO t1 VALUES ('23:00:03', 'yes');
-INSERT INTO t1 VALUES ('23:00:04', 'yes');
-EXPLAIN SELECT * FROM t1 WHERE a NOT IN ('23:00:01','23:00:02');
-SELECT * FROM t1 WHERE a NOT IN ('23:00:01','23:00:02');
-DROP TABLE t1;
-
---echo #
---echo # TIME(0), negative
---echo #
-
-CREATE TABLE t1 (a TIME, filler CHAR(200), KEY(a));
-INSERT INTO t1 VALUES ('-23:00:01', 'no');
-INSERT INTO t1 VALUES ('-23:00:01', 'no');
-INSERT INTO t1 VALUES ('-23:00:01', 'no');
-INSERT INTO t1 VALUES ('-23:00:01', 'no');
-INSERT INTO t1 VALUES ('-23:00:01', 'no');
-INSERT INTO t1 VALUES ('-23:00:01', 'no');
-INSERT INTO t1 VALUES ('-23:00:01', 'no');
-INSERT INTO t1 VALUES ('-23:00:01', 'no');
-INSERT INTO t1 VALUES ('-23:00:01', 'no');
-INSERT INTO t1 VALUES ('-23:00:01', 'no');
-INSERT INTO t1 VALUES ('-23:00:01', 'no');
-INSERT INTO t1 VALUES ('-23:00:01', 'no');
-INSERT INTO t1 VALUES ('-23:00:01', 'no');
-INSERT INTO t1 VALUES ('-23:00:01', 'no');
-INSERT INTO t1 VALUES ('-23:00:01', 'no');
-INSERT INTO t1 VALUES ('-23:00:01', 'no');
-INSERT INTO t1 VALUES ('-23:00:01', 'no');
-INSERT INTO t1 VALUES ('-23:00:01', 'no');
-INSERT INTO t1 VALUES ('-23:00:01', 'no');
-INSERT INTO t1 VALUES ('-23:00:01', 'no');
-INSERT INTO t1 VALUES ('-23:00:01', 'no');
-INSERT INTO t1 VALUES ('-23:00:01', 'no');
-INSERT INTO t1 VALUES ('-23:00:01', 'no');
-INSERT INTO t1 VALUES ('-23:00:01', 'no');
-INSERT INTO t1 VALUES ('-23:00:02', 'no');
-INSERT INTO t1 VALUES ('-23:00:03', 'yes');
-INSERT INTO t1 VALUES ('-23:00:04', 'yes');
-EXPLAIN SELECT * FROM t1 WHERE a NOT IN ('-23:00:01','-23:00:02');
-SELECT * FROM t1 WHERE a NOT IN ('-23:00:01','-23:00:02');
-DROP TABLE t1;
-
---echo #
---echo # TIME(0), positive ouside 24 hours
---echo #
-
-CREATE TABLE t1 (a TIME, filler CHAR(200), KEY(a));
-INSERT INTO t1 VALUES ('24:00:01', 'no');
-INSERT INTO t1 VALUES ('24:00:01', 'no');
-INSERT INTO t1 VALUES ('24:00:01', 'no');
-INSERT INTO t1 VALUES ('24:00:01', 'no');
-INSERT INTO t1 VALUES ('24:00:01', 'no');
-INSERT INTO t1 VALUES ('24:00:01', 'no');
-INSERT INTO t1 VALUES ('24:00:01', 'no');
-INSERT INTO t1 VALUES ('24:00:01', 'no');
-INSERT INTO t1 VALUES ('24:00:01', 'no');
-INSERT INTO t1 VALUES ('24:00:01', 'no');
-INSERT INTO t1 VALUES ('24:00:01', 'no');
-INSERT INTO t1 VALUES ('24:00:01', 'no');
-INSERT INTO t1 VALUES ('24:00:01', 'no');
-INSERT INTO t1 VALUES ('24:00:01', 'no');
-INSERT INTO t1 VALUES ('24:00:01', 'no');
-INSERT INTO t1 VALUES ('24:00:01', 'no');
-INSERT INTO t1 VALUES ('24:00:01', 'no');
-INSERT INTO t1 VALUES ('24:00:01', 'no');
-INSERT INTO t1 VALUES ('24:00:01', 'no');
-INSERT INTO t1 VALUES ('24:00:01', 'no');
-INSERT INTO t1 VALUES ('24:00:01', 'no');
-INSERT INTO t1 VALUES ('24:00:01', 'no');
-INSERT INTO t1 VALUES ('24:00:01', 'no');
-INSERT INTO t1 VALUES ('24:00:01', 'no');
-INSERT INTO t1 VALUES ('24:00:02', 'no');
-INSERT INTO t1 VALUES ('24:00:03', 'yes');
-INSERT INTO t1 VALUES ('24:00:04', 'yes');
-EXPLAIN SELECT * FROM t1 WHERE a NOT IN ('24:00:01','24:00:02');
-SELECT * FROM t1 WHERE a NOT IN ('24:00:01','24:00:02');
-DROP TABLE t1;
-
---echo #
---echo # TIME(0), negative, ouside 24 hours
---echo #
-
-CREATE TABLE t1 (a TIME, filler CHAR(200), KEY(a));
-INSERT INTO t1 VALUES ('-24:00:01', 'no');
-INSERT INTO t1 VALUES ('-24:00:01', 'no');
-INSERT INTO t1 VALUES ('-24:00:01', 'no');
-INSERT INTO t1 VALUES ('-24:00:01', 'no');
-INSERT INTO t1 VALUES ('-24:00:01', 'no');
-INSERT INTO t1 VALUES ('-24:00:01', 'no');
-INSERT INTO t1 VALUES ('-24:00:01', 'no');
-INSERT INTO t1 VALUES ('-24:00:01', 'no');
-INSERT INTO t1 VALUES ('-24:00:01', 'no');
-INSERT INTO t1 VALUES ('-24:00:01', 'no');
-INSERT INTO t1 VALUES ('-24:00:01', 'no');
-INSERT INTO t1 VALUES ('-24:00:01', 'no');
-INSERT INTO t1 VALUES ('-24:00:01', 'no');
-INSERT INTO t1 VALUES ('-24:00:01', 'no');
-INSERT INTO t1 VALUES ('-24:00:01', 'no');
-INSERT INTO t1 VALUES ('-24:00:01', 'no');
-INSERT INTO t1 VALUES ('-24:00:01', 'no');
-INSERT INTO t1 VALUES ('-24:00:01', 'no');
-INSERT INTO t1 VALUES ('-24:00:01', 'no');
-INSERT INTO t1 VALUES ('-24:00:01', 'no');
-INSERT INTO t1 VALUES ('-24:00:01', 'no');
-INSERT INTO t1 VALUES ('-24:00:01', 'no');
-INSERT INTO t1 VALUES ('-24:00:01', 'no');
-INSERT INTO t1 VALUES ('-24:00:01', 'no');
-INSERT INTO t1 VALUES ('-24:00:02', 'no');
-INSERT INTO t1 VALUES ('-24:00:03', 'yes');
-INSERT INTO t1 VALUES ('-24:00:04', 'yes');
-EXPLAIN SELECT * FROM t1 WHERE a NOT IN ('-24:00:01','-24:00:02');
-SELECT * FROM t1 WHERE a NOT IN ('-24:00:01','-24:00:02');
-DROP TABLE t1;
-
---echo #
---echo # TIME(0), positive, huge
---echo #
-
-CREATE TABLE t1 (a TIME, filler CHAR(200), KEY(a));
-INSERT INTO t1 VALUES ('838:00:01', 'no');
-INSERT INTO t1 VALUES ('838:00:01', 'no');
-INSERT INTO t1 VALUES ('838:00:01', 'no');
-INSERT INTO t1 VALUES ('838:00:01', 'no');
-INSERT INTO t1 VALUES ('838:00:01', 'no');
-INSERT INTO t1 VALUES ('838:00:01', 'no');
-INSERT INTO t1 VALUES ('838:00:01', 'no');
-INSERT INTO t1 VALUES ('838:00:01', 'no');
-INSERT INTO t1 VALUES ('838:00:01', 'no');
-INSERT INTO t1 VALUES ('838:00:01', 'no');
-INSERT INTO t1 VALUES ('838:00:01', 'no');
-INSERT INTO t1 VALUES ('838:00:01', 'no');
-INSERT INTO t1 VALUES ('838:00:01', 'no');
-INSERT INTO t1 VALUES ('838:00:01', 'no');
-INSERT INTO t1 VALUES ('838:00:01', 'no');
-INSERT INTO t1 VALUES ('838:00:01', 'no');
-INSERT INTO t1 VALUES ('838:00:01', 'no');
-INSERT INTO t1 VALUES ('838:00:01', 'no');
-INSERT INTO t1 VALUES ('838:00:01', 'no');
-INSERT INTO t1 VALUES ('838:00:01', 'no');
-INSERT INTO t1 VALUES ('838:00:01', 'no');
-INSERT INTO t1 VALUES ('838:00:01', 'no');
-INSERT INTO t1 VALUES ('838:00:01', 'no');
-INSERT INTO t1 VALUES ('838:00:01', 'no');
-INSERT INTO t1 VALUES ('838:00:02', 'no');
-INSERT INTO t1 VALUES ('838:00:03', 'yes');
-INSERT INTO t1 VALUES ('838:00:04', 'yes');
-EXPLAIN SELECT * FROM t1 WHERE a NOT IN ('838:00:01','838:00:02');
-SELECT * FROM t1 WHERE a NOT IN ('838:00:01','838:00:02');
-DROP TABLE t1;
-
---echo #
---echo # TIME(0), negative, huge
---echo #
-
-CREATE TABLE t1 (a TIME, filler CHAR(200), KEY(a));
-INSERT INTO t1 VALUES ('-838:00:01', 'no');
-INSERT INTO t1 VALUES ('-838:00:01', 'no');
-INSERT INTO t1 VALUES ('-838:00:01', 'no');
-INSERT INTO t1 VALUES ('-838:00:01', 'no');
-INSERT INTO t1 VALUES ('-838:00:01', 'no');
-INSERT INTO t1 VALUES ('-838:00:01', 'no');
-INSERT INTO t1 VALUES ('-838:00:01', 'no');
-INSERT INTO t1 VALUES ('-838:00:01', 'no');
-INSERT INTO t1 VALUES ('-838:00:01', 'no');
-INSERT INTO t1 VALUES ('-838:00:01', 'no');
-INSERT INTO t1 VALUES ('-838:00:01', 'no');
-INSERT INTO t1 VALUES ('-838:00:01', 'no');
-INSERT INTO t1 VALUES ('-838:00:01', 'no');
-INSERT INTO t1 VALUES ('-838:00:01', 'no');
-INSERT INTO t1 VALUES ('-838:00:01', 'no');
-INSERT INTO t1 VALUES ('-838:00:01', 'no');
-INSERT INTO t1 VALUES ('-838:00:01', 'no');
-INSERT INTO t1 VALUES ('-838:00:01', 'no');
-INSERT INTO t1 VALUES ('-838:00:01', 'no');
-INSERT INTO t1 VALUES ('-838:00:01', 'no');
-INSERT INTO t1 VALUES ('-838:00:01', 'no');
-INSERT INTO t1 VALUES ('-838:00:01', 'no');
-INSERT INTO t1 VALUES ('-838:00:01', 'no');
-INSERT INTO t1 VALUES ('-838:00:01', 'no');
-INSERT INTO t1 VALUES ('-838:00:02', 'no');
-INSERT INTO t1 VALUES ('-838:00:03', 'yes');
-INSERT INTO t1 VALUES ('-838:00:04', 'yes');
-EXPLAIN SELECT * FROM t1 WHERE a NOT IN ('-838:00:01','-838:00:02');
-SELECT * FROM t1 WHERE a NOT IN ('-838:00:01','-838:00:02');
-DROP TABLE t1;
-
---echo #
---echo # TIME(1), positive within 24 hours
---echo #
-
-CREATE TABLE t1 (a TIME(1), filler CHAR(200), KEY(a));
-INSERT INTO t1 VALUES ('23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('23:00:02.1', 'no');
-INSERT INTO t1 VALUES ('23:00:03.1', 'yes');
-INSERT INTO t1 VALUES ('23:00:04.1', 'yes');
-EXPLAIN SELECT * FROM t1 WHERE a NOT IN ('23:00:01.1','23:00:02.1');
-SELECT * FROM t1 WHERE a NOT IN ('23:00:01.1','23:00:02.1');
-DROP TABLE t1;
-
---echo #
---echo # TIME(1), negative within 24 hours
---echo #
-
-CREATE TABLE t1 (a TIME(1), filler CHAR(200), KEY(a));
-INSERT INTO t1 VALUES ('-23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-23:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-23:00:02.1', 'no');
-INSERT INTO t1 VALUES ('-23:00:03.1', 'yes');
-INSERT INTO t1 VALUES ('-23:00:04.1', 'yes');
-EXPLAIN SELECT * FROM t1 WHERE a NOT IN ('-23:00:01.1','-23:00:02.1');
-SELECT * FROM t1 WHERE a NOT IN ('-23:00:01.1','-23:00:02.1');
-DROP TABLE t1;
-
---echo #
---echo # TIME(1), positive, huge
---echo #
-
-CREATE TABLE t1 (a TIME(1), filler CHAR(200), KEY(a));
-INSERT INTO t1 VALUES ('838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('838:00:02.1', 'no');
-INSERT INTO t1 VALUES ('838:00:03.1', 'yes');
-INSERT INTO t1 VALUES ('838:00:04.1', 'yes');
-EXPLAIN SELECT * FROM t1 WHERE a NOT IN ('838:00:01.1','838:00:02.1');
-SELECT * FROM t1 WHERE a NOT IN ('838:00:01.1','838:00:02.1');
-DROP TABLE t1;
-
---echo #
---echo # TIME(1), negative, huge
---echo #
-
-CREATE TABLE t1 (a TIME(1), filler CHAR(200), KEY(a));
-INSERT INTO t1 VALUES ('-838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-838:00:01.1', 'no');
-INSERT INTO t1 VALUES ('-838:00:02.1', 'no');
-INSERT INTO t1 VALUES ('-838:00:03.1', 'yes');
-INSERT INTO t1 VALUES ('-838:00:04.1', 'yes');
-EXPLAIN SELECT * FROM t1 WHERE a NOT IN ('-838:00:01.1','-838:00:02.1');
-SELECT * FROM t1 WHERE a NOT IN ('-838:00:01.1','-838:00:02.1');
-DROP TABLE t1;
diff --git a/mysql-test/t/type_time_6065.test b/mysql-test/t/type_time_6065.test
deleted file mode 100644
index fc91c530760..00000000000
--- a/mysql-test/t/type_time_6065.test
+++ /dev/null
@@ -1,200 +0,0 @@
-#
-# MDEV-6065 MySQL Bug#13623473 "MISSING ROWS ON SELECT AND JOIN WITH TIME/DATETIME COMPARE"
-#
-
-# Systematic testing of ref access and range scan
-
-SET TIMESTAMP=UNIX_TIMESTAMP('2012-01-31 10:14:35');
-
-CREATE TABLE t1 (col_time_key TIME, KEY(col_time_key));
-INSERT INTO t1 VALUES ('00:00:00'),('-24:00:00'),('-48:00:00'),('24:00:00'),('48:00:00');
-CREATE TABLE t2 (col_datetime_key DATETIME, KEY(col_datetime_key));
-INSERT INTO t2 SELECT * FROM t1;
-
-let $cnt_0=5;
-let $operator= =;
-# For operator in =, >=, >, <=, <
-while ($cnt_0)
-{
- let $cnt_1=2;
- let $first_table=t1;
- # for table in t1,t2
- while ($cnt_1)
- {
- if ($first_table==t1)
- {
- let $first_index=col_time_key;
- let $second_table=t2;
- let $second_index=col_datetime_key;
- }
- if ($first_table==t2)
- {
- let $first_index=col_datetime_key;
- let $second_table=t1;
- let $second_index=col_time_key;
- }
- let $cnt_2=2;
- let $first_index_hint=ignore;
- # for first_index_hint in ignore,force
- while ($cnt_2)
- {
- let $cnt_3=2;
- let $second_index_hint=ignore;
- # for second_index_hint in ignore, force
- while ($cnt_3)
- {
- let $cnt_4=2;
- let $first_operand=col_time_key;
- # for first_operand in col_time_key, col_datetime_key
- while ($cnt_4)
- {
- if ($first_operand==col_time_key)
- {
- let $second_operand=col_datetime_key;
- }
- if ($first_operand==col_datetime_key)
- {
- let $second_operand=col_time_key;
- }
-
- eval EXPLAIN EXTENDED SELECT * FROM
- $first_table $first_index_hint INDEX ($first_index)
- STRAIGHT_JOIN
- $second_table $second_index_hint INDEX ($second_index)
- WHERE $first_operand $operator $second_operand;
- --sorted_result
- eval SELECT * FROM
- $first_table $first_index_hint INDEX ($first_index)
- STRAIGHT_JOIN
- $second_table $second_index_hint INDEX ($second_index)
- WHERE $first_operand $operator $second_operand;
-
- let $first_operand=col_datetime_key;
- dec $cnt_4;
- }
- let $second_index_hint=force;
- dec $cnt_3;
- }
- let $first_index_hint=force;
- dec $cnt_2;
- }
- let $first_table=t2;
- dec $cnt_1;
- }
- if ($cnt_0==5)
- {
- let $operator= >=;
- }
- if ($cnt_0==4)
- {
- let $operator= >;
- }
- if ($cnt_0==3)
- {
- let $operator= <=;
- }
- if ($cnt_0==2)
- {
- let $operator= <;
- }
- dec $cnt_0;
-}
-
-DROP TABLE t1,t2;
-
-#
-# Original test of the bug report
-#
-
-CREATE TABLE t1 (
- pk INT NOT NULL AUTO_INCREMENT,
- col_int_nokey INT,
- col_int_key INT NOT NULL,
- PRIMARY KEY (pk),
- KEY col_int_key (col_int_key)
-);
-
-INSERT INTO t1 VALUES (10,1,7), (11,7,0), (12,4,9), (13,7,3),
-(14,0,4), (15,2,2), (16,9,5), (17,4,3), (18,0,1), (19,9,3), (20,1,6),
-(21,3,7), (22,8,5), (23,8,1), (24,18,204), (25,84,224), (26,6,9),
-(27,3,5), (28,6,0), (29,6,3);
-
-CREATE TABLE t2 (
- col_int_nokey INT NOT NULL,
- col_datetime_key DATETIME NOT NULL,
- col_varchar_key VARCHAR(1) NOT NULL,
- KEY col_datetime_key (col_datetime_key),
- KEY col_varchar_key (col_varchar_key)
-);
-
-INSERT INTO t2 VALUES (1,'2001-11-04 19:07:55','k');
-
-CREATE TABLE t3 (
- col_time_key TIME,
- KEY col_time_key (col_time_key)
-);
-
-INSERT INTO t3 VALUES ('21:22:34'), ('10:50:38'), ('00:21:38'),
-('04:08:02'), ('16:25:11'), ('10:14:58'), ('19:47:59'), ('11:14:24'),
-('00:00:00'), ('00:00:00'), ('15:57:25'), ('07:05:51'), ('19:22:21'),
-('03:53:16'), ('09:16:38'), ('15:37:26'), ('00:00:00'), ('05:03:03'),
-('02:59:24'), ('00:01:58');
-
-let $query=SELECT * FROM t2 STRAIGHT_JOIN t3 FORCE INDEX (col_time_key)
- ON t3.col_time_key > t2.col_datetime_key;
-eval EXPLAIN EXTENDED $query;
---sorted_result
-eval $query;
-
-let $query=SELECT * FROM t2 STRAIGHT_JOIN t3 IGNORE INDEX (col_time_key)
- ON t3.col_time_key > t2.col_datetime_key;
-eval EXPLAIN EXTENDED $query;
---sorted_result
-eval $query;
-
-let $query=SELECT outr.col_int_nokey
-FROM t2 as outr
- STRAIGHT_JOIN t3 AS outr2
- ON outr2.col_time_key > outr.col_datetime_key
-WHERE outr.col_int_nokey IN (
- SELECT col_int_key
- FROM t1 AS innr
- WHERE innr.pk >= innr.col_int_nokey
-) AND (
- outr.col_int_nokey <= 6
- OR
- outr.col_varchar_key IS NULL
-);
-eval EXPLAIN EXTENDED $query;
---sorted_result
-eval $query;
-
-DROP TABLE t1,t2,t3;
-SET TIMESTAMP=0; # back to current time
-
-
---echo #
---echo # MDEV-15262 Wrong results for SELECT..WHERE non_indexed_datetime_column=indexed_time_column
---echo #
-
-SET TIMESTAMP=UNIX_TIMESTAMP('2012-01-31 10:14:35');
-CREATE TABLE t1 (col_time_key TIME, KEY(col_time_key));
-CREATE TABLE t2 (col_datetime_key DATETIME);
-INSERT INTO t1 VALUES ('-760:00:00'),('760:00:00');
-INSERT INTO t1 VALUES ('-770:00:00'),('770:00:00');
-INSERT INTO t2 SELECT * FROM t1;
-SELECT * FROM t2 STRAIGHT_JOIN t1 IGNORE INDEX(col_time_key) WHERE col_time_key = col_datetime_key;
-SELECT * FROM t2 STRAIGHT_JOIN t1 FORCE INDEX (col_time_key) WHERE col_time_key = col_datetime_key;
-INSERT INTO t1 VALUES ('-838:59:59'),('838:59:59');
-INSERT INTO t2 VALUES (DATE_ADD(CURRENT_DATE, INTERVAL '-838:59:59' HOUR_SECOND));
-INSERT INTO t2 VALUES (DATE_ADD(CURRENT_DATE, INTERVAL '838:59:59' HOUR_SECOND));
-INSERT INTO t2 VALUES (DATE_ADD(CURRENT_DATE, INTERVAL '-839:00:00' HOUR_SECOND));
-INSERT INTO t2 VALUES (DATE_ADD(CURRENT_DATE, INTERVAL '839:00:00' HOUR_SECOND));
-SELECT * FROM t2 STRAIGHT_JOIN t1 IGNORE INDEX(col_time_key) WHERE col_time_key = col_datetime_key;
-SELECT * FROM t2 STRAIGHT_JOIN t1 FORCE INDEX (col_time_key) WHERE col_time_key = col_datetime_key;
-DROP TABLE t1, t2;
-SET TIMESTAMP=DEFAULT;
-
-#
-# End of 10.0 tests
-#
diff --git a/mysql-test/t/type_time_hires.test b/mysql-test/t/type_time_hires.test
deleted file mode 100644
index 3785a23f1eb..00000000000
--- a/mysql-test/t/type_time_hires.test
+++ /dev/null
@@ -1,12 +0,0 @@
-
-let type=time;
---source include/type_hrtime.inc
-
-create table t1 (a time(4) not null, key(a));
-insert into t1 values ('1:2:3.001'),('1:2:3'), ('-00:00:00.6'),('-00:00:00.7'),('-00:00:00.8'),('-00:00:00.9'),('-00:00:01.0'),('-00:00:01.1'),('-00:00:01.000000'),('-00:00:01.100001'),('-00:00:01.000002'),('-00:00:01.090000');
-select * from t1 order by a;
-select * from t1 order by a desc;
-select min(a - interval 1 hour), max(a - interval 1 hour) from t1 where a < 0;
-drop table t1;
-
-select cast(1e-6 as time(6));
diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test
deleted file mode 100644
index 6d81a86331a..00000000000
--- a/mysql-test/t/type_timestamp.test
+++ /dev/null
@@ -1,608 +0,0 @@
-#
-# Test timestamp
-#
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-# Set timezone to GMT-3, to make it possible to use "interval 3 hour"
-set time_zone="+03:00";
-
-CREATE TABLE t1 (a int, t timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
-CREATE TABLE t2 (a int, t datetime);
-SET TIMESTAMP=1234;
-insert into t1 values(1,NULL);
-insert into t1 values(2,"2002-03-03");
-SET TIMESTAMP=1235;
-insert into t1 values(3,NULL);
-SET TIMESTAMP=1236;
-insert into t1 (a) values(4);
-insert into t2 values(5,"2002-03-04"),(6,NULL),(7,"2002-03-05"),(8,"00-00-00");
-SET TIMESTAMP=1237;
-insert into t1 select * from t2;
-SET TIMESTAMP=1238;
-insert into t1 (a) select a+1 from t2 where a=8;
-select * from t1;
-drop table t1,t2;
-
-SET TIMESTAMP=1234;
-CREATE TABLE t1 (value TEXT NOT NULL, id VARCHAR(32) NOT NULL, stamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (id));
-INSERT INTO t1 VALUES ("my value", "myKey","1999-04-02 00:00:00");
-SELECT stamp FROM t1 WHERE id="myKey";
-UPDATE t1 SET value="my value" WHERE id="myKey";
-SELECT stamp FROM t1 WHERE id="myKey";
-UPDATE t1 SET id="myKey" WHERE value="my value";
-SELECT stamp FROM t1 WHERE id="myKey";
-drop table t1;
-
-create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
-insert into t1 values (now());
-select date_format(a,"%Y %y"),year(a),year(now()) from t1;
-drop table t1;
-
-create table t1 (ix timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
-insert into t1 values (19991101000000),(19990102030405),(19990630232922),(19990601000000),(19990930232922),(19990531232922),(19990501000000),(19991101000000),(19990501000000);
-select ix+0 from t1;
-truncate table t1;
-insert into t1 values ("19991101000000"),("19990102030405"),("19990630232922"),("19990601000000");
-select ix+0 from t1;
-drop table t1;
-
-CREATE TABLE t1 (date date, date_time datetime, time_stamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
-INSERT INTO t1 VALUES ("1998-12-31","1998-12-31 23:59:59",19981231235959);
-INSERT INTO t1 VALUES ("1999-01-01","1999-01-01 00:00:00",19990101000000);
-INSERT INTO t1 VALUES ("1999-09-09","1999-09-09 23:59:59",19990909235959);
-INSERT INTO t1 VALUES ("2000-01-01","2000-01-01 00:00:00",20000101000000);
-INSERT INTO t1 VALUES ("2000-02-28","2000-02-28 00:00:00",20000228000000);
-INSERT INTO t1 VALUES ("2000-02-29","2000-02-29 00:00:00",20000229000000);
-INSERT INTO t1 VALUES ("2000-03-01","2000-03-01 00:00:00",20000301000000);
-INSERT INTO t1 VALUES ("2000-12-31","2000-12-31 23:59:59",20001231235959);
-INSERT INTO t1 VALUES ("2001-01-01","2001-01-01 00:00:00",20010101000000);
-INSERT INTO t1 VALUES ("2004-12-31","2004-12-31 23:59:59",20041231235959);
-INSERT INTO t1 VALUES ("2005-01-01","2005-01-01 00:00:00",20050101000000);
-INSERT INTO t1 VALUES ("2030-01-01","2030-01-01 00:00:00",20300101000000);
-# The following will get you an different answer on 64 bit machines
-#INSERT INTO t1 VALUES ("2050-01-01","2050-01-01 00:00:00",20500101000000);
-SELECT * FROM t1;
-drop table t1;
-
-#
-# Let us check if we properly treat wrong datetimes and produce proper warnings
-# (for both strings and numbers)
-#
-create table t1 (ix timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
-insert into t1 values (0),(20030101010160),(20030101016001),(20030101240101),(20030132010101),(20031301010101),(20031200000000),(20030000000000);
-select ix+0 from t1;
-truncate table t1;
-insert into t1 values ("00000000000000"),("20030101010160"),("20030101016001"),("20030101240101"),("20030132010101"),("20031301010101"),("20031200000000"),("20030000000000");
-select ix+0 from t1;
-truncate table t1;
-insert ignore into t1 values ("0000-00-00 00:00:00 some trailer"),("2003-01-01 00:00:00 some trailer");
-select ix+0 from t1;
-drop table t1;
-
-#
-# Test for TIMESTAMP column with default now() and on update now() clauses
-#
-
-create table t1 (t1 timestamp, t2 timestamp default now());
-drop table t1;
-create table t1 (t1 timestamp, t2 timestamp on update now());
-drop table t1;
-create table t1 (t1 timestamp, t2 timestamp default now() on update now());
-drop table t1;
-create table t1 (t1 timestamp default now(), t2 timestamp on update now());
-drop table t1;
-create table t1 (t1 timestamp on update now(), t2 timestamp default now() on update now());
-drop table t1;
-
-# Let us test TIMESTAMP auto-update behaviour
-# Also we will test behaviour of TIMESTAMP field in SHOW CREATE TABLE and
-# behaviour of DEFAULT literal for such fields
-create table t1 (t1 timestamp not null default '2003-01-01 00:00:00', t2 datetime, t3 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00');
-SET TIMESTAMP=1000000000;
-insert into t1 values ();
-SET TIMESTAMP=1000000001;
-update t1 set t2=now();
-SET TIMESTAMP=1000000002;
-insert into t1 (t1,t3) values (default, default);
-select * from t1;
-show create table t1;
-show columns from t1;
-drop table t1;
-
-create table t1 (t1 timestamp not null default now(), t2 datetime, t3 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00');
-SET TIMESTAMP=1000000002;
-insert into t1 values ();
-SET TIMESTAMP=1000000003;
-update t1 set t2=now();
-SET TIMESTAMP=1000000003;
-insert into t1 (t1,t3) values (default, default);
-select * from t1;
-show create table t1;
-show columns from t1;
-drop table t1;
-
-create table t1 (t1 timestamp not null default '2003-01-01 00:00:00' on update now(), t2 datetime);
-SET TIMESTAMP=1000000004;
-insert into t1 values ();
-select * from t1;
-SET TIMESTAMP=1000000005;
-update t1 set t2=now();
-SET TIMESTAMP=1000000005;
-insert into t1 (t1) values (default);
-select * from t1;
-show create table t1;
-show columns from t1;
-drop table t1;
-
-create table t1 (t1 timestamp not null default now() on update now(), t2 datetime);
-SET TIMESTAMP=1000000006;
-insert into t1 values ();
-select * from t1;
-SET TIMESTAMP=1000000007;
-update t1 set t2=now();
-SET TIMESTAMP=1000000007;
-insert into t1 (t1) values (default);
-select * from t1;
-show create table t1;
-show columns from t1;
-drop table t1;
-
-create table t1 (t1 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, t2 datetime, t3 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00');
-SET TIMESTAMP=1000000007;
-insert into t1 values ();
-select * from t1;
-SET TIMESTAMP=1000000008;
-update t1 set t2=now();
-SET TIMESTAMP=1000000008;
-insert into t1 (t1,t3) values (default, default);
-select * from t1;
-show create table t1;
-show columns from t1;
-drop table t1;
-
-# Let us test if CURRENT_TIMESTAMP also works well as default value
-# (Of course NOW and CURRENT_TIMESTAMP are same for parser but still just
-# for demonstartion.)
-create table t1 (t1 timestamp not null default current_timestamp on update current_timestamp, t2 datetime);
-SET TIMESTAMP=1000000009;
-insert into t1 values ();
-select * from t1;
-SET TIMESTAMP=1000000010;
-update t1 set t2=now();
-SET TIMESTAMP=1000000011;
-insert into t1 (t1) values (default);
-select * from t1;
-show create table t1;
-show columns from t1;
-truncate table t1;
-
-#
-# Let us test some cases when auto-set should be disabled or influence
-# on server behavior in some other way.
-#
-
-# Update statement that explicitly sets field should not auto-set it.
-insert into t1 values ('2004-04-01 00:00:00', '2004-04-01 00:00:00');
-SET TIMESTAMP=1000000012;
-update t1 set t1= '2004-04-02 00:00:00';
-select * from t1;
-# The same for multi updates
-update t1 as ta, t1 as tb set tb.t1= '2004-04-03 00:00:00';
-select * from t1;
-drop table t1;
-
-# Now let us test replace it should behave exactly like delete+insert
-# Case where optimization is possible DEFAULT = ON UPDATE
-create table t1 (pk int primary key, t1 timestamp not null default current_timestamp on update current_timestamp, bulk int);
-insert into t1 values (1, '2004-04-01 00:00:00', 10);
-SET TIMESTAMP=1000000013;
-replace into t1 set pk = 1, bulk= 20;
-select * from t1;
-drop table t1;
-# Case in which there should not be optimisation
-create table t1 (pk int primary key, t1 timestamp not null default '2003-01-01 00:00:00' on update current_timestamp, bulk int);
-insert into t1 values (1, '2004-04-01 00:00:00', 10);
-SET TIMESTAMP=1000000014;
-replace into t1 set pk = 1, bulk= 20;
-select * from t1;
-drop table t1;
-# Other similar case
-create table t1 (pk int primary key, t1 timestamp not null default current_timestamp on update current_timestamp, bulk int);
-insert into t1 values (1, '2004-04-01 00:00:00', 10);
-SET TIMESTAMP=1000000015;
-replace into t1 set pk = 1, bulk= 20;
-select * from t1;
-drop table t1;
-
-# Let us test alter now
-create table t1 (t1 timestamp not null default current_timestamp on update current_timestamp);
-insert into t1 values ('2004-04-01 00:00:00');
-SET TIMESTAMP=1000000016;
-alter table t1 add i int default 10;
-select * from t1;
-drop table t1;
-
-#
-# Test for TIMESTAMP columns which are able to store NULLs
-#
-
-# Unlike for default TIMESTAMP fields we don't interpret first field
-# in this table as TIMESTAMP with DEFAULT NOW() ON UPDATE NOW() properties.
-create table t1 (a timestamp null, b timestamp null);
-show create table t1;
-insert into t1 values (NULL, NULL);
-SET TIMESTAMP=1000000017;
-insert into t1 values ();
-select * from t1;
-drop table t1;
-
-# But explicit auto-set properties still should be OK.
-create table t1 (a timestamp null default current_timestamp on update current_timestamp, b timestamp null);
-show create table t1;
-insert into t1 values (NULL, NULL);
-SET TIMESTAMP=1000000018;
-insert into t1 values ();
-select * from t1;
-drop table t1;
-
-# It is also OK to specify NULL as default explicitly for such fields.
-# This is also a test for bug #2464, DEFAULT keyword in INSERT statement
-# should return default value for column.
-
-create table t1 (a timestamp null default null, b timestamp null default '2003-01-01 00:00:00');
-show create table t1;
-insert into t1 values (NULL, NULL);
-insert into t1 values (DEFAULT, DEFAULT);
-select * from t1;
-drop table t1;
-
-#
-# Let us test behavior of ALTER TABLE when it converts columns
-# containing NULL to TIMESTAMP columns.
-#
-create table t1 (a bigint, b bigint);
-insert into t1 values (NULL, NULL), (20030101000000, 20030102000000);
-set timestamp=1000000019;
-alter table t1 modify a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, modify b timestamp NOT NULL DEFAULT '0000-00-00 00:00:0';
-select * from t1;
-drop table t1;
-
-#
-# Test for bug #4131, TIMESTAMP columns missing minutes and seconds when
-# using GROUP BY in @@new=1 mode.
-#
-create table t1 (a char(2), t timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
-insert into t1 values ('a', '2004-01-01 00:00:00'), ('a', '2004-01-01 01:00:00'),
- ('b', '2004-02-01 00:00:00');
-select max(t) from t1 group by a;
-drop table t1;
-
-#
-# Test for bug #7418 "TIMESTAMP not always converted to DATETIME in MAXDB
-# mode". TIMESTAMP columns should be converted DATETIME columns in MAXDB
-# mode regardless of whether a display width is given.
-#
-set sql_mode='maxdb';
-create table t1 (a timestamp, b timestamp(5));
-show create table t1;
-# restore default mode
-set sql_mode='';
-drop table t1;
-
-#
-# Bug#7806 - insert on duplicate key and auto-update of timestamp
-#
-create table t1 (a int auto_increment primary key, b int, c timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
-insert into t1 (a, b, c) values (1, 0, '2001-01-01 01:01:01'),
- (2, 0, '2002-02-02 02:02:02'), (3, 0, '2003-03-03 03:03:03');
-select * from t1;
-update t1 set b = 2, c = c where a = 2;
-select * from t1;
-insert into t1 (a) values (4);
-select * from t1;
-update t1 set c = '2004-04-04 04:04:04' where a = 4;
-select * from t1;
-insert into t1 (a) values (3), (5) on duplicate key update b = 3, c = c;
-select * from t1;
-insert into t1 (a, c) values (4, '2004-04-04 00:00:00'),
- (6, '2006-06-06 06:06:06') on duplicate key update b = 4;
-select * from t1;
-drop table t1;
-
---echo End of 4.1 tests
-
-# Restore timezone to default
-set time_zone= @@global.time_zone;
-
-CREATE TABLE t1 (
-`id` int(11) NOT NULL auto_increment,
-`username` varchar(80) NOT NULL default '',
-`posted_on` timestamp NOT NULL default '0000-00-00 00:00:00',
-PRIMARY KEY (`id`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
-
-show fields from t1;
-select is_nullable from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='t1' and COLUMN_NAME='posted_on';
-drop table t1;
-
-#
-# Bug#41370: TIMESTAMP field does not accepts NULL from FROM_UNIXTIME()
-#
-
-CREATE TABLE t1 ( f1 INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
- f2 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- f3 TIMESTAMP NOT NULL default '0000-00-00 00:00:00');
-INSERT INTO t1 (f2,f3) VALUES (NOW(), "0000-00-00 00:00:00");
-INSERT INTO t1 (f2,f3) VALUES (NOW(), NULL);
-INSERT INTO t1 (f2,f3) VALUES (NOW(), ASCII(NULL));
-INSERT INTO t1 (f2,f3) VALUES (NOW(), FROM_UNIXTIME('9999999999'));
-INSERT INTO t1 (f2,f3) VALUES (NOW(), TIME(NULL));
-UPDATE t1 SET f2=NOW(), f3=FROM_UNIXTIME('9999999999') WHERE f1=1;
-SELECT f1,f2-f3 FROM t1;
-DROP TABLE t1;
-
---echo End of 5.0 tests
-
---echo #
---echo # Bug #55779: select does not work properly in mysql server
---echo # Version "5.1.42 SUSE MySQL RPM"
---echo #
-
-CREATE TABLE t1 (a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, KEY (a));
-
-INSERT INTO t1 VALUES ('2000-01-01 00:00:00'), ('2000-01-01 00:00:00'),
- ('2000-01-01 00:00:01'), ('2000-01-01 00:00:01');
-
-SELECT a FROM t1 WHERE a >= 20000101000000;
-SELECT a FROM t1 WHERE a >= '20000101000000';
-
-DROP TABLE t1;
-
---echo #
---echo # Bug#50774: failed to get the correct resultset when timestamp values
---echo # are appended with .0
---echo #
-CREATE TABLE t1 ( a TIMESTAMP, KEY ( a ) );
-
-INSERT INTO t1 VALUES( '2010-02-01 09:31:01' );
-INSERT INTO t1 VALUES( '2010-02-01 09:31:02' );
-INSERT INTO t1 VALUES( '2010-02-01 09:31:03' );
-INSERT INTO t1 VALUES( '2010-02-01 09:31:04' );
-
-SELECT * FROM t1 WHERE a >= '2010-02-01 09:31:02.0';
-SELECT * FROM t1 WHERE '2010-02-01 09:31:02.0' <= a;
-SELECT * FROM t1 WHERE a <= '2010-02-01 09:31:02.0';
-SELECT * FROM t1 WHERE '2010-02-01 09:31:02.0' >= a;
-
---replace_column 1 x 2 x 3 x 5 x 6 x 7 x 8 x 9 x 10 x
-EXPLAIN
-SELECT * FROM t1 WHERE a >= '2010-02-01 09:31:02.0';
-SELECT * FROM t1 WHERE a >= '2010-02-01 09:31:02.0';
-
-CREATE TABLE t2 ( a TIMESTAMP, KEY ( a DESC ) );
-
-INSERT INTO t2 VALUES( '2010-02-01 09:31:01' );
-INSERT INTO t2 VALUES( '2010-02-01 09:31:02' );
-INSERT INTO t2 VALUES( '2010-02-01 09:31:03' );
-INSERT INTO t2 VALUES( '2010-02-01 09:31:04' );
-INSERT INTO t2 VALUES( '2010-02-01 09:31:05' );
-INSERT INTO t2 VALUES( '2010-02-01 09:31:06' );
-INSERT INTO t2 VALUES( '2010-02-01 09:31:07' );
-INSERT INTO t2 VALUES( '2010-02-01 09:31:08' );
-INSERT INTO t2 VALUES( '2010-02-01 09:31:09' );
-INSERT INTO t2 VALUES( '2010-02-01 09:31:10' );
-INSERT INTO t2 VALUES( '2010-02-01 09:31:11' );
-
---echo # The bug would cause the range optimizer's comparison to use an open
---echo # interval here. This reveals itself only in the number of reads
---echo # performed.
-FLUSH STATUS;
---replace_column 1 x 2 x 3 x 5 x 6 x 7 x 8 x 9 x 10 x
-EXPLAIN
-SELECT * FROM t2 WHERE a < '2010-02-01 09:31:02.0';
-SELECT * FROM t2 WHERE a < '2010-02-01 09:31:02.0';
-SHOW STATUS LIKE 'Handler_read_next';
-
-DROP TABLE t1, t2;
-
---echo End of 5.1 tests
-
---echo #
---echo # lp:923429 Crash in decimal_cmp on using UNIX_TIMESTAMP with a wrongly formatted timestamp
---echo #
-SELECT UNIX_TIMESTAMP('abc') > 0;
-SELECT UNIX_TIMESTAMP('abc');
-
---echo
---echo Bug#50888 valgrind warnings in Field_timestamp::val_str
---echo
-
-SET TIMESTAMP=0;
-CREATE TABLE t1(a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
-INSERT INTO t1 VALUES ('2008-02-23 09:23:45'), ('2010-03-05 11:08:02');
-FLUSH TABLES t1;
-SELECT MAX(a) FROM t1;
-SELECT a FROM t1;
-DROP TABLE t1;
-
---echo End of Bug#50888
-
---echo #
---echo # Bug59330: Incorrect result when comparing an aggregate
---echo # function with TIMESTAMP
---echo #
-CREATE TABLE t1 (dt DATETIME, ts TIMESTAMP);
-INSERT INTO t1 VALUES('2011-01-06 12:34:30', '2011-01-06 12:34:30');
-SELECT MAX(dt), MAX(ts) FROM t1;
-SELECT MAX(ts) < '2010-01-01 00:00:00' FROM t1;
-SELECT MAX(dt) < '2010-01-01 00:00:00' FROM t1;
-SELECT MAX(ts) > '2010-01-01 00:00:00' FROM t1;
-SELECT MAX(dt) > '2010-01-01 00:00:00' FROM t1;
-SELECT MAX(ts) = '2011-01-06 12:34:30' FROM t1;
-SELECT MAX(dt) = '2011-01-06 12:34:30' FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-9413 "datetime >= coalesce(c1(NULL))" doesn't return expected NULL
---echo #
-CREATE TABLE t1(c1 TIMESTAMP(6) NULL DEFAULT NULL);
-INSERT INTO t1 VALUES(NULL);
-SELECT c1, '2016-06-13 20:00:00.000003' >= COALESCE( c1 ) FROM t1;
-DROP TABLE t1;
-
---echo End of 5.5 tests
-
---echo #
---echo # MDEV-7254: Assigned expression is evaluated twice when updating column TIMESTAMP NOT NULL
---echo #
-
-SET time_zone='+02:00';
-create table t1(value timestamp not null);
-set @a:=0;
-delimiter //;
-create function f1 () returns timestamp
-begin
- set @a = @a + 1;
- return NULL;
-end//
-delimiter ;//
-set timestamp=12340;
-insert t1 values (f1());
-select @a, value from t1;
-set timestamp=12350;
-update t1 set value = f1();
-select @a, value from t1;
-drop table t1;
-drop function f1;
-set timestamp=0;
-
-# Verify no regressions to TIMESTAMP NULL
-create table t1(value timestamp null);
-set @a:=0;
-delimiter //;
-create function f1 () returns timestamp
-begin
- set @a = @a + 1;
- return NULL;
-end//
-delimiter ;//
-set timestamp=12340;
-insert t1 values (f1());
-select @a, value from t1;
-set timestamp=12350;
-update t1 set value = f1();
-select @a, value from t1;
-drop table t1;
-drop function f1;
-set timestamp=0;
-SET time_zone=DEFAULT;
-
---echo #
---echo # MDEV-7778 impossible create copy of table, if table contain default value for timestamp field
---echo #
-
-SET sql_mode="NO_ZERO_DATE";
-CREATE TABLE t1 (
- ts timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
-);
-CREATE TABLE t2 AS SELECT * from t1 LIMIT 0;
-SHOW CREATE TABLE t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t1,t2;
-SET sql_mode=DEFAULT;
-
---echo #
---echo # MDEV-8082 ON UPDATE is not preserved by CREATE TABLE .. SELECT
---echo #
-CREATE TABLE t1 (
- vc VARCHAR(10) NOT NULL DEFAULT 'test',
- ts timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
-);
-CREATE TABLE t2 AS SELECT * FROM t1 LIMIT 0;
-SHOW CREATE TABLE t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t1,t2;
-
-
---echo End of 10.0 tests
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-7831 Bad warning for DATE_ADD(timestamp_column, INTERVAL 10 SECOND)
---echo #
-CREATE TABLE t1 (a TIMESTAMP);
-INSERT INTO t1 VALUES ('0000-00-00 00:00:00');
-SELECT DATE_ADD(a, INTERVAL 10 SECOND) FROM t1;
-DROP TABLE t1;
-
-
-let type=TIMESTAMP;
-let defval='0000-00-00 00:00:00';
---source include/type_temporal_zero_default.inc
-
---echo #
---echo # MDEV-8699 Wrong result for SELECT..WHERE HEX(date_column)!='323030312D30312D3031' AND date_column='2001-01-01x'
---echo #
---let $TYPE=TIMESTAMP
---source include/equal_fields_propagation_datetime.inc
-
---echo #
---echo # End of 10.1 tests
---echo #
-
---echo #
---echo # Start of 10.3 tests
---echo #
-
---echo #
---echo # MDEV-11333 MDEV-11333 Expect "Impossible where condition" for WHERE timestamp_field>=DATE_ADD(TIMESTAMP'9999-01-01 00:00:00',INTERVAL 1000 YEAR)
---echo #
-
-SELECT DATE_ADD(TIMESTAMP'9999-01-01 00:00:00',INTERVAL 1000 YEAR);
-CREATE TABLE t1 (a TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, KEY(a)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES('2001-01-01'),('2002-02-02'),('2003-03-03');
-INSERT INTO t1 VALUES('2001-01-01'),('2002-02-02'),('2003-03-03');
-INSERT INTO t1 VALUES('2001-01-01'),('2002-02-02'),('2003-03-03');
-INSERT INTO t1 VALUES('2001-01-01'),('2002-02-02'),('2003-03-03');
-INSERT INTO t1 VALUES('2001-01-01'),('2002-02-02'),('2003-03-03');
-INSERT INTO t1 VALUES('2001-01-01'),('2002-02-02'),('2003-03-03');
-EXPLAIN SELECT * FROM t1 WHERE a >= DATE_ADD(TIMESTAMP'9999-01-01 00:00:00',INTERVAL 1000 YEAR);
-EXPLAIN SELECT * FROM t1 WHERE a >= COALESCE(DATE_ADD(TIMESTAMP'9999-01-01 00:00:00',INTERVAL 1000 YEAR));
-DROP TABLE t1;
-
---echo #
---echo # MDEV-11482 Incorrect result for (time_expr BETWEEN timestamp_exp1 AND timestamp_expr2)
---echo #
-SET @@sql_mode=DEFAULT;
-SET @@timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30');
-CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP);
-INSERT INTO t1 VALUES ('2001-01-01 00:00:00','2001-01-01 23:59:59');
-SELECT * FROM t1 WHERE TIME'10:20:30' BETWEEN a and b;
-DROP TABLE t1;
-SET @@timestamp=DEFAULT;
-
---echo #
---echo # MDEV-12582 Wrong data type for CREATE..SELECT MAX(COALESCE(timestamp_column))
---echo #
-
-CREATE TABLE t1 (a TIMESTAMP);
-CREATE TABLE t2 AS SELECT
- MAX(a),
- COALESCE(a),
- COALESCE(MAX(a)),
- MAX(COALESCE(a))
-FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-DROP TABLE t1;
-
-
---echo #
---echo # End of 10.3 tests
---echo #
diff --git a/mysql-test/t/type_timestamp_hires.test b/mysql-test/t/type_timestamp_hires.test
deleted file mode 100644
index 0b05f81ef42..00000000000
--- a/mysql-test/t/type_timestamp_hires.test
+++ /dev/null
@@ -1,42 +0,0 @@
-
-let type=timestamp;
---source include/type_hrtime.inc
-
-set time_zone='+03:00';
-set timestamp=unix_timestamp('2011-01-01 01:01:01') + 0.123456;
-
-create table t1 (a timestamp(5) DEFAULT CURRENT_TIMESTAMP);
-#
-# CREATE ... DEFAULT NOW(X)
-#
-
-insert t1 values ();
-select * from t1;
-drop table t1;
-
-#
-# MDEV-438 Microseconds: Precision is ignored in CURRENT_TIMESTAMP(N) when it is given as a default column value
-#
-create or replace table t1 (a timestamp(5) default current_timestamp);
-show create table t1;
-create or replace table t1 (a timestamp(5) default current_timestamp());
-show create table t1;
-create or replace table t1 (a timestamp(5) default current_timestamp(2));
-show create table t1;
-insert t1 () values ();
-select * from t1;
-create or replace table t1 (a timestamp(5) default current_timestamp(5));
-show create table t1;
-create or replace table t1 (a timestamp(5) default current_timestamp(6));
-show create table t1;
-create or replace table t1 (a timestamp(5) on update current_timestamp);
-show create table t1;
-create or replace table t1 (a timestamp(5) on update current_timestamp());
-show create table t1;
---error ER_INVALID_ON_UPDATE
-create or replace table t1 (a timestamp(5) on update current_timestamp(3));
-create or replace table t1 (a timestamp(5) on update current_timestamp(5));
-show create table t1;
-create or replace table t1 (a timestamp(5) on update current_timestamp(6));
-show create table t1;
-drop table t1;
diff --git a/mysql-test/t/type_uint.test b/mysql-test/t/type_uint.test
deleted file mode 100644
index ae48b30997a..00000000000
--- a/mysql-test/t/type_uint.test
+++ /dev/null
@@ -1,50 +0,0 @@
-#
-# test of unsigned int
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-SET SQL_WARNINGS=1;
-
-create table t1 (this int unsigned);
-insert into t1 values (1);
-insert ignore into t1 values (-1);
-insert ignore into t1 values ('5000000000');
-select * from t1;
-drop table t1;
-
-# End of 4.1 tests
-
-create table t1 (a bigint unsigned, b mediumint unsigned);
-insert t1 values (1,2),(0xffffffffffffffff,0xffffff);
-select coalesce(a,b), coalesce(b,a) from t1;
-create table t2 as select a from t1 union select b from t1;
-show create table t2;
-select * from t2;
-drop table t1, t2;
-
---echo #
---echo # Start of 10.0 tests
---echo #
-
---echo #
---echo # MDEV-6950 Bad results with joins comparing DATE and INT/ENUM/VARCHAR columns
---echo #
-CREATE TABLE t1 (a DATE PRIMARY KEY);
-INSERT INTO t1 VALUES ('1999-01-01');
-CREATE TABLE t2 (a INT UNSIGNED);
-INSERT INTO t2 VALUES (19990101);
-INSERT INTO t2 VALUES (990101);
-SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a;
-SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a;
-ALTER TABLE t2 ADD PRIMARY KEY(a);
-SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a;
-SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a;
---echo # t2 should NOT be eliminated
-EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a;
-DROP TABLE t1,t2;
-
---echo #
---echo # End of 10.0 tests
---echo #
diff --git a/mysql-test/t/type_varchar.test b/mysql-test/t/type_varchar.test
deleted file mode 100644
index d70cb86fa7b..00000000000
--- a/mysql-test/t/type_varchar.test
+++ /dev/null
@@ -1,330 +0,0 @@
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-
-create table t1 (v varchar(30), c char(3), e enum('abc','def','ghi'), t text);
-let $MYSQLD_DATADIR= `select @@datadir`;
-copy_file $MYSQL_TEST_DIR/std_data/vchar.frm $MYSQLD_DATADIR/test/vchar.frm;
-truncate table vchar;
-show create table t1;
-show create table vchar;
-insert into t1 values ('abc', 'de', 'ghi', 'jkl');
-insert into t1 values ('abc ', 'de ', 'ghi', 'jkl ');
-insert into t1 values ('abc ', 'd ', 'ghi', 'jkl ');
-insert into vchar values ('abc', 'de', 'ghi', 'jkl');
-insert into vchar values ('abc ', 'de ', 'ghi', 'jkl ');
-insert into vchar values ('abc ', 'd ', 'ghi', 'jkl ');
-select length(v),length(c),length(e),length(t) from t1;
-select length(v),length(c),length(e),length(t) from vchar;
-alter table vchar add i int;
-show create table vchar;
-select length(v),length(c),length(e),length(t) from vchar;
-drop table t1, vchar;
-create table t1 (v varchar(20));
-insert into t1 values('a ');
-select v='a' from t1;
-select binary v='a' from t1;
-select binary v='a ' from t1;
-insert into t1 values('a');
---error ER_DUP_ENTRY
-alter table t1 add primary key (v);
-drop table t1;
-create table t1 (v varbinary(20));
-insert into t1 values('a');
-insert into t1 values('a ');
-alter table t1 add primary key (v);
-drop table t1;
-
-#
-# Test with varchar of lengths 254,255,256,258 & 258 to ensure we don't
-# have any problems with varchar with one or two byte length_bytes
-#
-
-create table t1 (v varchar(254), index (v));
-insert into t1 values ("This is a test ");
-insert into t1 values ("Some sample data");
-insert into t1 values (" garbage ");
-insert into t1 values (" This is a test ");
-insert into t1 values ("This is a test");
-insert into t1 values ("Hello world");
-insert into t1 values ("Foo bar");
-insert into t1 values ("This is a test");
-insert into t1 values ("MySQL varchar test");
-insert into t1 values ("test MySQL varchar");
-insert into t1 values ("This is a long string to have some random length data included");
-insert into t1 values ("Short string");
-insert into t1 values ("VSS");
-insert into t1 values ("Some samples");
-insert into t1 values ("Bar foo");
-insert into t1 values ("Bye");
-let $i= 255;
-let $j= 5;
-while ($j)
-{
- select * from t1 where v like 'This is a test' order by v;
- select * from t1 where v='This is a test' order by v;
- select * from t1 where v like 'S%' order by v;
- explain select * from t1 where v like 'This is a test' order by v;
- explain select * from t1 where v='This is a test' order by v;
- explain select * from t1 where v like 'S%' order by v;
- eval alter table t1 change v v varchar($i);
- inc $i;
- dec $j;
-}
-let $i= 258;
-let $j= 6;
-while ($j)
-{
- select * from t1 where v like 'This is a test' order by v;
- select * from t1 where v='This is a test' order by v;
- select * from t1 where v like 'S%' order by v;
- explain select * from t1 where v like 'This is a test' order by v;
- explain select * from t1 where v='This is a test' order by v;
- explain select * from t1 where v like 'S%' order by v;
- eval alter table t1 change v v varchar($i);
- dec $i;
- dec $j;
-}
-alter table t1 change v v varchar(254), drop key v;
-
-# Test with length(varchar) > 256 and key < 256 (to ensure things works with
-# different kind of packing
-
-alter table t1 change v v varchar(300), add key (v(10));
-select * from t1 where v like 'This is a test' order by v;
-select * from t1 where v='This is a test' order by v;
-select * from t1 where v like 'S%' order by v;
-explain select * from t1 where v like 'This is a test' order by v;
-explain select * from t1 where v='This is a test' order by v;
-explain select * from t1 where v like 'S%' order by v;
-drop table t1;
-
-#
-# bug#9339 - meaningless Field_varstring::get_key_image
-#
-create table t1 (pkcol varchar(16), othercol varchar(16), primary key (pkcol));
-insert into t1 values ('test', 'something');
-update t1 set othercol='somethingelse' where pkcol='test';
-select * from t1;
-drop table t1;
-
-#
-# Bug #9489: problems with key handling
-#
-
-create table t1 (a int, b varchar(12));
-insert into t1 values (1, 'A'), (22, NULL);
-create table t2 (a int);
-insert into t2 values (22), (22);
-select t1.a, t1.b, min(t1.b) from t1 inner join t2 ON t2.a = t1.a
- group by t1.b, t1.a;
-drop table t1, t2;
-
-#
-# Bug #10543: convert varchar with index to text
-#
-create table t1 (f1 varchar(65500));
-create index index1 on t1(f1(10));
-show create table t1;
-alter table t1 modify f1 varchar(255);
-show create table t1;
-alter table t1 modify f1 tinytext;
-show create table t1;
-drop table t1;
-
-#
-# BUG#15588: String overrun
-#
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1(f1 VARCHAR(100) DEFAULT 'test');
-INSERT INTO t1 VALUES(SUBSTR(f1, 1, 3));
-DROP TABLE IF EXISTS t1;
-
-CREATE TABLE t1(f1 CHAR(100) DEFAULT 'test');
-INSERT INTO t1 VALUES(SUBSTR(f1, 1, 3));
-DROP TABLE IF EXISTS t1;
-
-#
-# Bug#14897 "ResultSet.getString("table.column") sometimes doesn't find the
-# column"
-# Test that after upgrading an old 4.1 VARCHAR column to 5.0 VARCHAR we preserve
-# the original column metadata.
-#
---disable_warnings
-drop table if exists t1, t2, t3;
---enable_warnings
-
-create table t3 (
- id int(11),
- en varchar(255) character set utf8,
- cz varchar(255) character set utf8
-);
-remove_file $MYSQLD_DATADIR/test/t3.frm;
-copy_file $MYSQL_TEST_DIR/std_data/14897.frm $MYSQLD_DATADIR/test/t3.frm;
-truncate table t3;
-insert into t3 (id, en, cz) values
-(1,'en string 1','cz string 1'),
-(2,'en string 2','cz string 2'),
-(3,'en string 3','cz string 3');
-
-create table t1 (
- id int(11),
- name_id int(11)
-);
-insert into t1 (id, name_id) values (1,1), (2,3), (3,3);
-
-create table t2 (id int(11));
-insert into t2 (id) values (1), (2), (3);
-
-# max_length is different for varchar fields in ps-protocol and we can't
-# replace a single metadata column, disable PS protocol
---disable_ps_protocol
---enable_metadata
-select t1.*, t2.id, t3.en, t3.cz from t1 left join t2 on t1.id=t2.id
-left join t3 on t1.id=t3.id order by t3.id;
---disable_metadata
---enable_ps_protocol
-drop table t1, t2, t3;
-
-#
-# Bug #11927: Warnings shown for CAST( chr as signed) but not (chr + 0)
-#
-CREATE TABLE t1 (a CHAR(2));
-INSERT INTO t1 VALUES (10), (50), (30), ('1a'), (60), ('t');
-SELECT a,(a + 0) FROM t1 ORDER BY a;
-SELECT a,(a DIV 2) FROM t1 ORDER BY a;
-SELECT a,CAST(a AS SIGNED) FROM t1 ORDER BY a;
-DROP TABLE t1;
-
-#
-# Bug #28299: To-number conversion warnings work differenly with CHAR
-# and VARCHAR sp variables
-#
-# * Verify that 'Truncated incorrect DOUBLE value' is shown for 's'
-# when using both CHAR and VARCHAR.
-#
-
-CREATE TABLE t1 (a VARCHAR(16));
-INSERT INTO t1 VALUES ('5'), ('s'), ('');
-SELECT 5 = a FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a CHAR(16));
-INSERT INTO t1 VALUES ('5'), ('s'), ('');
-SELECT 5 = a FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535
---echo #
-
-set sql_mode='';
-CREATE TABLE t1 (c1 VARBINARY(65532));
-DESCRIBE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 VARBINARY(65533));
-DESCRIBE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 VARBINARY(65534));
-DESCRIBE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 VARBINARY(65535));
-DESCRIBE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 VARBINARY(65536));
-DESCRIBE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 VARCHAR(65532));
-DESCRIBE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 VARCHAR(65533));
-DESCRIBE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 VARCHAR(65534));
-DESCRIBE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 VARCHAR(65535));
-DESCRIBE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 VARCHAR(65536));
-DESCRIBE t1;
-DROP TABLE t1;
-set sql_mode=default;
-
---error ER_TOO_BIG_FIELDLENGTH
-CREATE TABLE t1 (c1 VARCHAR(65536));
-
---echo #
---echo # End of 5.5 tests
---echo #
-
---echo #
---echo # MDEV-6950 Bad results with joins comparing DATE and INT/ENUM/VARCHAR columns
---echo #
-CREATE TABLE t1 (c1 DATE PRIMARY KEY);
-INSERT INTO t1 VALUES ('2001-01-01');
-CREATE TABLE t2 (c1 VARCHAR(20));
-INSERT INTO t2 VALUES ('2001-01-01');
-INSERT INTO t2 VALUES ('2001/01/01');
-SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1;
-SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1;
-ALTER TABLE t2 ADD PRIMARY KEY(c1);
-SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1;
-EXPLAIN SELECT t1.* FROM t1,t2 WHERE t1.c1=t2.c1;
-SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1;
---echo # t2 should NOT be eliminated
-EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.c1=t2.c1;
-DROP TABLE IF EXISTS t1,t2;
-
-
---echo #
---echo # MDEV-6989 BINARY and COLLATE xxx_bin comparisions are not used for optimization in some cases
---echo #
-CREATE TABLE t1 (c1 VARCHAR(20) CHARACTER SET latin1, PRIMARY KEY(c1));
-INSERT INTO t1 VALUES ('a'),('b'),('c'),('d');
-SELECT * FROM t1 WHERE c1=BINARY 'a';
-EXPLAIN SELECT * FROM t1 WHERE c1=BINARY 'a';
-SELECT * FROM t1 WHERE c1=_latin1'a' COLLATE latin1_bin;
-EXPLAIN SELECT * FROM t1 WHERE c1=_latin1'a' COLLATE latin1_bin;
-DROP TABLE t1;
-
-CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_bin);
-INSERT INTO t1 VALUES ('a');
-CREATE TABLE t2 (c1 VARCHAR(10) CHARACTER SET latin1, PRIMARY KEY(c1));
-INSERT INTO t2 VALUES ('a'),('b');
-SELECT * FROM t1, t2 WHERE t1.c1=t2.c1;
-EXPLAIN SELECT * FROM t1, t2 WHERE t1.c1=t2.c1;
-ALTER TABLE t1 MODIFY c1 VARBINARY(10);
-SELECT * FROM t1, t2 WHERE t1.c1=t2.c1;
-EXPLAIN SELECT * FROM t1, t2 WHERE t1.c1=t2.c1;
-DROP TABLE t1, t2;
-
-CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_bin);
-INSERT INTO t1 VALUES ('a'),('c');
-CREATE TABLE t2 (c1 VARCHAR(10) CHARACTER SET latin1, PRIMARY KEY(c1));
-INSERT INTO t2 VALUES ('a'),('b');
-SELECT t1.* FROM t1 LEFT JOIN t2 USING (c1);
---echo # t2 should be eliminated
-EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 USING (c1);
-ALTER TABLE t1 MODIFY c1 VARBINARY(10);
-SELECT t1.* FROM t1 LEFT JOIN t2 USING (c1);
---echo # t2 should be eliminated
-EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 USING (c1);
-DROP TABLE t1,t2;
-
---echo #
---echo # End of 10.0 tests
---echo #
diff --git a/mysql-test/t/type_year.test b/mysql-test/t/type_year.test
deleted file mode 100644
index 117906fd889..00000000000
--- a/mysql-test/t/type_year.test
+++ /dev/null
@@ -1,256 +0,0 @@
-#
-# Test year
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1 (y year,y2 year(2));
-insert into t1 values (0,0),(1999,1999),(2000,2000),(2001,2001),(70,70),(69,69);
-select * from t1;
-select * from t1 order by y;
-select * from t1 order by y2;
-drop table t1;
-
-#
-# Bug 2335
-#
-
-create table t1 (y year);
-insert ignore into t1 values (now());
-select if(y = now(), 1, 0) from t1;
-drop table t1;
-
-#
-# Bug #27176: Assigning a string to an year column has unexpected results
-#
-create table t1(a year);
-insert into t1 values (2000.5), ('2000.5'), ('2001a'), ('2.001E3');
-select * from t1;
-drop table t1;
-
---echo End of 5.0 tests
-
---echo #
---echo # Bug #49480: WHERE using YEAR columns returns unexpected results
---echo #
-
-CREATE TABLE t2(yy YEAR(2), c2 CHAR(4));
-CREATE TABLE t4(yyyy YEAR(4), c4 CHAR(4));
-
-INSERT INTO t2 (c2) VALUES (NULL),(1970),(1999),(2000),(2001),(2069);
-INSERT INTO t4 (c4) SELECT c2 FROM t2;
-UPDATE t2 SET yy = c2;
-UPDATE t4 SET yyyy = c4;
-
-SELECT * FROM t2;
-SELECT * FROM t4;
-
---echo # Comparison of YEAR(2) with YEAR(4)
-
-SELECT * FROM t2, t4 WHERE yy = yyyy;
-SELECT * FROM t2, t4 WHERE yy <=> yyyy;
-SELECT * FROM t2, t4 WHERE yy < yyyy;
-SELECT * FROM t2, t4 WHERE yy > yyyy;
-
---echo # Comparison of YEAR(2) with YEAR(2)
-
-SELECT * FROM t2 a, t2 b WHERE a.yy = b.yy;
-SELECT * FROM t2 a, t2 b WHERE a.yy <=> b.yy;
-SELECT * FROM t2 a, t2 b WHERE a.yy < b.yy;
-
---echo # Comparison of YEAR(4) with YEAR(4)
-
-SELECT * FROM t4 a, t4 b WHERE a.yyyy = b.yyyy;
-SELECT * FROM t4 a, t4 b WHERE a.yyyy <=> b.yyyy;
-SELECT * FROM t4 a, t4 b WHERE a.yyyy < b.yyyy;
-
---echo # Comparison with constants:
-
-SELECT * FROM t2 WHERE yy = NULL;
-SELECT * FROM t4 WHERE yyyy = NULL;
-SELECT * FROM t2 WHERE yy <=> NULL;
-SELECT * FROM t4 WHERE yyyy <=> NULL;
-SELECT * FROM t2 WHERE yy < NULL;
-SELECT * FROM t2 WHERE yy > NULL;
-
-SELECT * FROM t2 WHERE yy = NOW();
-SELECT * FROM t4 WHERE yyyy = NOW();
-
-SELECT * FROM t2 WHERE yy = 99;
-SELECT * FROM t2 WHERE 99 = yy;
-SELECT * FROM t4 WHERE yyyy = 99;
-
-SELECT * FROM t2 WHERE yy = 'test';
-SELECT * FROM t4 WHERE yyyy = 'test';
-
-SELECT * FROM t2 WHERE yy = '1999';
-SELECT * FROM t4 WHERE yyyy = '1999';
-
-SELECT * FROM t2 WHERE yy = 1999;
-SELECT * FROM t4 WHERE yyyy = 1999;
-
-SELECT * FROM t2 WHERE yy = 1999.1;
-SELECT * FROM t4 WHERE yyyy = 1999.1;
-
-SELECT * FROM t2 WHERE yy = 1998.9;
-SELECT * FROM t4 WHERE yyyy = 1998.9;
-
---echo # Coverage tests for YEAR with zero/2000 constants:
-
-SELECT * FROM t2 WHERE yy = 0;
-SELECT * FROM t2 WHERE yy = '0';
-SELECT * FROM t2 WHERE yy = '0000';
-SELECT * FROM t2 WHERE yy = '2000';
-SELECT * FROM t2 WHERE yy = 2000;
-
-SELECT * FROM t4 WHERE yyyy = 0;
-SELECT * FROM t4 WHERE yyyy = '0';
-SELECT * FROM t4 WHERE yyyy = '0000';
-SELECT * FROM t4 WHERE yyyy = '2000';
-SELECT * FROM t4 WHERE yyyy = 2000;
-
---echo # Comparison with constants those are out of YEAR range
---echo # (coverage test for backward compatibility)
-
-SELECT COUNT(yy) FROM t2;
-SELECT COUNT(yyyy) FROM t4;
-
-SELECT COUNT(*) FROM t2 WHERE yy = -1;
-SELECT COUNT(*) FROM t4 WHERE yyyy > -1;
-SELECT COUNT(*) FROM t2 WHERE yy > -1000000000000000000;
-SELECT COUNT(*) FROM t4 WHERE yyyy > -1000000000000000000;
-
-SELECT COUNT(*) FROM t2 WHERE yy < 2156;
-SELECT COUNT(*) FROM t4 WHERE yyyy < 2156;
-SELECT COUNT(*) FROM t2 WHERE yy < 1000000000000000000;
-SELECT COUNT(*) FROM t4 WHERE yyyy < 1000000000000000000;
-
-SELECT * FROM t2 WHERE yy < 123;
-SELECT * FROM t2 WHERE yy > 123;
-SELECT * FROM t4 WHERE yyyy < 123;
-SELECT * FROM t4 WHERE yyyy > 123;
-
-DROP TABLE t2, t4;
-
---echo #
---echo # Bug #49910: Behavioural change in SELECT/WHERE on YEAR(4) data type
---echo #
-
-CREATE TABLE t1 (y YEAR NOT NULL, s VARCHAR(4));
-INSERT IGNORE INTO t1 (s) VALUES ('bad');
-INSERT INTO t1 (y, s) VALUES (0, 0), (2000, 2000), (2001, 2001);
-
-SELECT * FROM t1 ta, t1 tb WHERE ta.y = tb.y;
-SELECT * FROM t1 WHERE t1.y = 0;
-SELECT * FROM t1 WHERE t1.y = 2000;
-
-SELECT ta.y AS ta_y, ta.s, tb.y AS tb_y, tb.s FROM t1 ta, t1 tb HAVING ta_y = tb_y;
-
-DROP TABLE t1;
-
---echo #
---echo # Bug #59211: Select Returns Different Value for min(year) Function
---echo #
-
-CREATE TABLE t1(c1 YEAR(4));
-INSERT INTO t1 VALUES (1901),(2155),(0000);
-SELECT * FROM t1;
-SELECT COUNT(*) AS total_rows, MIN(c1) AS min_value, MAX(c1) FROM t1;
-SELECT COUNT(*) AS total_rows, MIN(c1+0) AS min_value, MAX(c1+0) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # WL#6219: Deprecate and remove YEAR(2) type
---echo #
-
-CREATE TABLE t1 (c1 YEAR(2), c2 YEAR(4));
-ALTER TABLE t1 MODIFY COLUMN c2 YEAR(2);
-DROP TABLE t1;
-
---echo #
-
---echo End of 5.1 tests
-#
-# fun with convert_const_to_int
-# in some cases 00 is equal to 2000, in others it is not.
-#
-create function y2k() returns int deterministic return 2000;
-create table t1 (a year(2), b int);
-insert t1 values (0,2000);
-select a from t1 where a=2000; # constant.
-select a from t1 where a=1000+1000; # still a constant.
-# select a from t1 where a=(select 2000); # even this is a constant
-select a from t1 where a=(select 2000 from dual where 1); # constant, but "expensive"
-select a from t1 where a=y2k(); # constant, but "expensive"
-select a from t1 where a=b; # not a constant
-drop table t1;
-drop function y2k;
-
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-8741 Equal field propagation leaves some remainders after simplifying WHERE zerofill_column=2010 AND zerofill_column>=2010
---echo #
-CREATE TABLE t1 (a YEAR);
-INSERT INTO t1 VALUES (2010),(2020);
-SELECT * FROM t1 WHERE a=2010 AND a>=2010;
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND a>=2010;
-SELECT * FROM t1 WHERE a=2010 AND a>=10;
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010 AND a>=10;
-SELECT * FROM t1 WHERE a=10 AND a>=2010;
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10 AND a>=2010;
-SELECT * FROM t1 WHERE a=10 AND a>=10;
-EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10 AND a>=10;
-DROP TABLE t1;
-
---echo #
---echo # End of 10.1 tests
---echo #
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-9392 Copying from DECIMAL to YEAR is not consistent about warnings
---echo #
-CREATE TABLE t1 (a YEAR);
-INSERT IGNORE INTO t1 VALUES (-0.1);
-DROP TABLE t1;
-
-CREATE TABLE t1 (a YEAR);
-CREATE TABLE t2 (a DECIMAL(10,1));
-INSERT INTO t2 VALUES (-0.1);
-INSERT IGNORE INTO t1 SELECT * FROM t2;
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (a DECIMAL(10,1));
-INSERT INTO t1 VALUES (-0.1);
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-ALTER TABLE t1 MODIFY a YEAR;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a YEAR);
-INSERT IGNORE INTO t1 VALUES (-0.1e0);
-DROP TABLE t1;
-
-CREATE TABLE t1 (a YEAR);
-CREATE TABLE t2 (a DOUBLE);
-INSERT INTO t2 VALUES (-0.1);
-INSERT IGNORE INTO t1 SELECT * FROM t2;
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (a DOUBLE);
-INSERT INTO t1 VALUES (-0.1);
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-ALTER TABLE t1 MODIFY a YEAR;
-DROP TABLE t1;
-
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/udf.test b/mysql-test/t/udf.test
deleted file mode 100644
index c3a25c6bcce..00000000000
--- a/mysql-test/t/udf.test
+++ /dev/null
@@ -1,530 +0,0 @@
---source include/have_udf.inc
-#
-# To run this tests the "sql/udf_example.c" need to be compiled into
-# udf_example.so and LD_LIBRARY_PATH should be setup to point out where
-# the library are.
-#
-
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-#
-# Create the example functions from udf_example
-#
-
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO";
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE FUNCTION myfunc_double RETURNS REAL SONAME "$UDF_EXAMPLE_SO";
-
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
---error ER_CANT_FIND_DL_ENTRY
-eval CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "$UDF_EXAMPLE_SO";
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "$UDF_EXAMPLE_SO";
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE FUNCTION udf_sequence RETURNS INTEGER SONAME "$UDF_EXAMPLE_SO";
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE FUNCTION lookup RETURNS STRING SONAME "$UDF_EXAMPLE_SO";
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE FUNCTION reverse_lookup
- RETURNS STRING SONAME "$UDF_EXAMPLE_SO";
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE AGGREGATE FUNCTION avgcost
- RETURNS REAL SONAME "$UDF_EXAMPLE_SO";
-
---error ER_CANT_INITIALIZE_UDF
-select myfunc_double();
-select myfunc_double(1);
-select myfunc_double(78654);
---error 1305
-select myfunc_nonexist();
-select myfunc_int();
---error ER_CANT_INITIALIZE_UDF
-select lookup();
-select lookup("127.0.0.1");
---error ER_CANT_INITIALIZE_UDF
-select lookup(127,0,0,1);
-select lookup("localhost");
---error ER_CANT_INITIALIZE_UDF
-select reverse_lookup();
-
-# These two function calls should return "localhost", but it's
-# depending on configuration, so just call them and don't log the result
---disable_result_log
-select reverse_lookup("127.0.0.1");
-select reverse_lookup(127,0,0,1);
-
-# This function call may return different results depending on platform,
-# so ignore results (see Bug#52060).
-select reverse_lookup("localhost");
---enable_result_log
-
---error ER_CANT_INITIALIZE_UDF
-select avgcost();
---error ER_CANT_INITIALIZE_UDF
-select avgcost(100,23.76);
-create table t1(sum int, price float(24));
-insert into t1 values(100, 50.00), (100, 100.00);
-select avgcost(sum, price) from t1;
-delete from t1;
-insert into t1 values(100, 54.33), (200, 199.99);
-select avgcost(sum, price) from t1;
-drop table t1;
-
-#------------------------------------------------------------------------
-# BUG#17261 Passing a variable from a stored procedure to UDF crashes mysqld
-#------------------------------------------------------------------------
-
-select metaphon('hello');
-
-delimiter //;
-CREATE PROCEDURE `XXX1`(in testval varchar(10))
-begin
-select metaphon(testval);
-end//
-delimiter ;//
-
-call XXX1('hello');
-drop procedure xxx1;
-
-delimiter //;
-CREATE PROCEDURE `XXX2`()
-begin
-declare testval varchar(10);
-set testval = 'hello';
-select metaphon(testval);
-end//
-delimiter ;//
-
-call XXX2();
-drop procedure xxx2;
-
-#
-# Bug#19904: UDF: not initialized *is_null per row
-#
-
-CREATE TABLE bug19904(n INT, v varchar(10));
-INSERT INTO bug19904 VALUES (1,'one'),(2,'two'),(NULL,NULL),(3,'three'),(4,'four');
-SELECT myfunc_double(n) AS f FROM bug19904;
-SELECT metaphon(v) AS f FROM bug19904;
-DROP TABLE bug19904;
-
-#
-# Bug#21269: DEFINER-clause is allowed for UDF-functions
-#
-
---error ER_PARSE_ERROR
-CREATE DEFINER=CURRENT_USER() FUNCTION should_not_parse
-RETURNS STRING SONAME "should_not_parse.so";
-
---error ER_PARSE_ERROR
-CREATE DEFINER=someone@somewhere FUNCTION should_not_parse
-RETURNS STRING SONAME "should_not_parse.so";
-#
-# Bug#19862: Sort with filesort by function evaluates function twice
-#
-create table t1(f1 int);
-insert into t1 values(1),(2);
-explain select myfunc_int(f1) from t1 order by 1;
-drop table t1;
-
-#
-# Bug #21809: Error 1356 while selecting from view with grouping though
-# underlying select OK.
-#
-CREATE TABLE t1(a INT, b INT); INSERT INTO t1 values (1,1),(2,2);
-
-DELIMITER ||;
-CREATE FUNCTION fn(a int) RETURNS int DETERMINISTIC
-BEGIN
- RETURN a;
-END
-||
-DELIMITER ;||
-
-CREATE VIEW v1 AS SELECT a, fn(MIN(b)) as c FROM t1 GROUP BY a;
-
-SELECT myfunc_int(a AS attr_name) FROM t1;
-EXPLAIN EXTENDED SELECT myfunc_int(a AS attr_name) FROM t1;
-EXPLAIN EXTENDED SELECT myfunc_int(a) FROM t1;
-SELECT a,c FROM v1;
-
---error ER_WRONG_PARAMETERS_TO_STORED_FCT
-SELECT a, fn(MIN(b) xx) as c FROM t1 GROUP BY a;
---error ER_WRONG_PARAMETERS_TO_STORED_FCT
-SELECT myfunc_int(fn(MIN(b) xx)) as c FROM t1 GROUP BY a;
---error ER_PARSE_ERROR
-SELECT myfunc_int(test.fn(MIN(b) xx)) as c FROM t1 GROUP BY a;
-
-SELECT myfunc_int(fn(MIN(b)) xx) as c FROM t1 GROUP BY a;
-SELECT myfunc_int(test.fn(MIN(b)) xx) as c FROM t1 GROUP BY a;
-
-EXPLAIN EXTENDED SELECT myfunc_int(MIN(b) xx) as c FROM t1 GROUP BY a;
-EXPLAIN EXTENDED SELECT test.fn(MIN(b)) as c FROM t1 GROUP BY a;
-EXPLAIN EXTENDED SELECT myfunc_int(fn(MIN(b))) as c FROM t1 GROUP BY a;
-EXPLAIN EXTENDED SELECT myfunc_int(test.fn(MIN(b))) as c FROM t1 GROUP BY a;
-SELECT myfunc_int(MIN(b) xx) as c FROM t1 GROUP BY a;
-SELECT test.fn(MIN(b)) as c FROM t1 GROUP BY a;
-SELECT myfunc_int(fn(MIN(b))) as c FROM t1 GROUP BY a;
-SELECT myfunc_int(test.fn(MIN(b))) as c FROM t1 GROUP BY a;
-DROP VIEW v1;
-DROP TABLE t1;
-DROP FUNCTION fn;
-
---echo End of 5.0 tests.
-
-#
-# Bug#24736: UDF functions parsed as Stored Functions
-#
-
-select myfunc_double(3);
-select myfunc_double(3 AS three);
-select myfunc_double(abs(3));
-select myfunc_double(abs(3) AS named_param);
-select abs(myfunc_double(3));
-select abs(myfunc_double(3 AS three));
-
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select myfunc_double(abs(3 AS wrong));
--- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
-select abs(myfunc_double(3) AS wrong);
-
-#
-# BUG#18239: Possible to overload internal functions with stored functions
-#
-
---disable_warnings
-drop function if exists pi;
---enable_warnings
-
---error ER_NATIVE_FCT_NAME_COLLISION
-CREATE FUNCTION pi RETURNS STRING SONAME "should_not_parse.so";
-
-# Verify that Stored Functions and UDF are mutually exclusive
-DROP FUNCTION IF EXISTS metaphon;
-
-CREATE FUNCTION metaphon(a int) RETURNS int
-return 0;
-
-# this currently passes, and eclipse the stored function
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO";
-
-DROP FUNCTION metaphon;
-DROP FUNCTION metaphon;
-
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO";
-
---error ER_UDF_EXISTS
-CREATE FUNCTION metaphon(a int) RETURNS int
-return 0;
-
---error ER_UDF_EXISTS
-CREATE FUNCTION test.metaphon(a int) RETURNS int
-return 0;
-
-# End of Bug#18239
-
-#
-# Drop the example functions from udf_example
-#
-
-DROP FUNCTION metaphon;
-DROP FUNCTION myfunc_double;
---error ER_SP_DOES_NOT_EXIST
-DROP FUNCTION myfunc_nonexist;
-DROP FUNCTION myfunc_int;
-DROP FUNCTION udf_sequence;
-DROP FUNCTION lookup;
-DROP FUNCTION reverse_lookup;
-DROP FUNCTION avgcost;
-
-#
-# Bug #15439: UDF name case handling forces DELETE FROM mysql.func to remove
-# the UDF
-#
-select * from mysql.func;
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE FUNCTION is_const RETURNS STRING SONAME "$UDF_EXAMPLE_SO";
-
-select IS_const(3);
-
-drop function IS_const;
-
-select * from mysql.func;
-
---error 1305
-select is_const(3);
-
-#
-# Bug#18761: constant expression as UDF parameters not passed in as constant
-#
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE FUNCTION is_const RETURNS STRING SONAME "$UDF_EXAMPLE_SO";
-
-select
- is_const(3) as const,
- is_const(3.14) as const,
- is_const('fnord') as const,
- is_const(2+3) as const,
- is_const(rand()) as 'nc rand()',
- is_const(sin(3.14)) as const,
- is_const(upper('test')) as const;
-
-create table bug18761 (n int);
-insert into bug18761 values (null),(2);
-select
- is_const(3) as const,
- is_const(3.14) as const,
- is_const('fnord') as const,
- is_const(2+3) as const,
- is_const(2+n) as 'nc 2+n ',
- is_const(sin(n)) as 'nc sin(n)',
- is_const(sin(3.14)) as const,
- is_const(upper('test')) as const,
- is_const(rand()) as 'nc rand()',
- is_const(n) as 'nc n ',
- is_const(is_const(n)) as 'nc ic?(n)',
- is_const(is_const('c')) as const
-from
- bug18761;
-drop table bug18761;
-
---error 1241
-select is_const((1,2,3));
-
-drop function if exists is_const;
-
-#
-# Bug #25382: Passing NULL to an UDF called from stored procedures
-# crashes server
-#
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO";
-
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE FUNCTION myfunc_double RETURNS REAL SONAME "$UDF_EXAMPLE_SO";
-
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "$UDF_EXAMPLE_SO";
-
-delimiter //;
-create function f1(p1 varchar(255))
-returns varchar(255)
-begin
- return metaphon(p1);
-end//
-
-create function f2(p1 varchar(255))
-returns double
-begin
- return myfunc_double(p1);
-end//
-
-create function f3(p1 varchar(255))
-returns double
-begin
- return myfunc_int(p1);
-end//
-
-delimiter ;//
-
-select f3(NULL);
-select f2(NULL);
-select f1(NULL);
-
-drop function f1;
-drop function f2;
-drop function f3;
-drop function metaphon;
-drop function myfunc_double;
-drop function myfunc_int;
-
-#
-# Bug#28318 CREATE FUNCTION (UDF) requires a schema
-#
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest;
---enable_warnings
-CREATE DATABASE mysqltest;
-USE mysqltest;
-DROP DATABASE mysqltest;
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO";
-DROP FUNCTION metaphon;
-USE test;
-
-#
-# Bug #29804 UDF parameters don't contain correct string length
-#
-
-CREATE TABLE const_len_bug (
- str_const varchar(4000),
- result1 varchar(4000),
- result2 varchar(4000)
-);
-
-DELIMITER |;
-CREATE TRIGGER check_const_len_trigger BEFORE INSERT ON const_len_bug FOR EACH ROW BEGIN
- set NEW.str_const = 'bar';
- set NEW.result2 = check_const_len(NEW.str_const);
-END |
-
-CREATE PROCEDURE check_const_len_sp (IN str_const VARCHAR(4000))
-BEGIN
-DECLARE result VARCHAR(4000);
-SET result = check_const_len(str_const);
-insert into const_len_bug values(str_const, result, "");
-END |
-DELIMITER ;|
-
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE FUNCTION check_const_len RETURNS string SONAME "$UDF_EXAMPLE_SO";
-
-CALL check_const_len_sp("foo");
-
-SELECT * from const_len_bug;
-
-DROP FUNCTION check_const_len;
-DROP PROCEDURE check_const_len_sp;
-DROP TRIGGER check_const_len_trigger;
-DROP TABLE const_len_bug;
-
-
-#
-# Bug #30355: Incorrect ordering of UDF results
-#
-
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE FUNCTION udf_sequence RETURNS INTEGER SONAME "$UDF_EXAMPLE_SO";
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (a INT PRIMARY KEY);
-INSERT INTO t1 VALUES (4),(3),(2),(1);
-INSERT INTO t2 SELECT * FROM t1;
-
-SELECT udf_sequence() AS seq, a FROM t1 ORDER BY seq ASC;
-SELECT udf_sequence() AS seq, a FROM t1 ORDER BY seq DESC;
-
-SELECT * FROM t1 WHERE a = udf_sequence();
-SELECT * FROM t2 WHERE a = udf_sequence();
-
-DROP FUNCTION udf_sequence;
-DROP TABLE t1,t2;
-
-#
-# Bug#31767 (DROP FUNCTION name resolution)
-#
-
---disable_warnings
-drop function if exists test.metaphon;
-drop function if exists metaphon;
---enable_warnings
-
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO";
-
-select metaphon("Hello");
-
-# The UDF should not be dropped
-drop function if exists test.metaphon;
-
-select metaphon("Hello");
-
-drop function metaphon;
-
-CREATE FUNCTION test.metaphon(a TEXT) RETURNS TEXT return "This is a SF";
-
-create database db_31767;
-use db_31767;
-
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO";
-
-use test;
-
-# Uses the UDF
-select metaphon("Hello");
-
-# Uses the SF
-select test.metaphon("Hello");
-
-# Should drop the UDF, resolving the name the same way select does.
-drop function metaphon;
-
-# Should call the SF
-select metaphon("Hello");
-
-# Drop the SF
-drop function metaphon;
-
-# Change the current database to none.
-use db_31767;
-drop database db_31767;
-
-drop function if exists no_such_func;
-
---error ER_SP_DOES_NOT_EXIST
-drop function no_such_func;
-
-drop function if exists test.no_such_func;
-
---error ER_SP_DOES_NOT_EXIST
-drop function test.no_such_func;
-
---error ER_NO_DB_ERROR
-drop procedure if exists no_such_proc;
-
---error ER_NO_DB_ERROR
-drop procedure no_such_proc;
-
-use test;
-
-
---echo #
---echo # Bug#46259: 5.0.83 -> 5.1.36, query doesn't work
---echo #
-CREATE TABLE t1 ( a INT );
-
-INSERT INTO t1 VALUES (1), (2), (3);
-
-SELECT IF( a = 1, a, a ) AS `b` FROM t1 ORDER BY field( `b` + 1, 1 );
-SELECT IF( a = 1, a, a ) AS `b` FROM t1 ORDER BY field( `b`, 1 );
-
-DROP TABLE t1;
-
---echo End of 5.0 tests.
-
---echo #
---echo # Bug#33546: Slowdown on re-evaluation of constant expressions.
---echo #
-CREATE TABLE t1 (f1 INT);
-INSERT INTO t1 VALUES(1),(50);
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE FUNCTION myfunc_double RETURNS INTEGER SONAME "$UDF_EXAMPLE_SO";
-EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE f1=1 + myfunc_double(1);
-DROP FUNCTION myfunc_double;
-DROP TABLE t1;
---echo #
---echo End of 5.1 tests.
-
---echo #
---echo # MDEV-10134 Add full support for DEFAULT
---echo #
-
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO";
-SELECT METAPHON('Hello');
-CREATE TABLE t1 (a VARCHAR(10), b VARCHAR(10) DEFAULT METAPHON(a));
-SHOW CREATE TABLE t1;
-INSERT INTO t1 (a) VALUES ('Hello');
-SELECT * FROM t1;
-DROP FUNCTION METAPHON;
-# QQ: this should return an error
-#INSERT INTO t1 (a) VALUES ('Hello');
-#SELECT * FROM t1;
-DROP TABLE t1;
diff --git a/mysql-test/t/udf_debug_sync.test b/mysql-test/t/udf_debug_sync.test
deleted file mode 100644
index 593500c1e18..00000000000
--- a/mysql-test/t/udf_debug_sync.test
+++ /dev/null
@@ -1,40 +0,0 @@
---source include/have_debug_sync.inc
---source include/have_udf.inc
-
-#
-# MDEV-5616 - Deadlock between CREATE/DROP FUNCTION and SELECT from view
-#
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "$UDF_EXAMPLE_SO";
-CREATE VIEW v1 AS SELECT myfunc_int(1);
-connect(con1, localhost, root,,);
-
-connection con1;
-SET debug_sync='mysql_create_function_after_lock SIGNAL locked WAIT_FOR go';
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-send_eval CREATE FUNCTION myfunc_double RETURNS REAL SONAME "$UDF_EXAMPLE_SO";
-
-connection default;
-SET debug_sync='now WAIT_FOR locked';
-SET debug_sync='find_udf_before_lock SIGNAL go';
-SELECT * FROM v1;
-FLUSH TABLES;
-
-connection con1;
-reap;
-SET debug_sync='mysql_drop_function_after_lock SIGNAL locked WAIT_FOR go';
-send DROP FUNCTION myfunc_double;
-
-connection default;
-SET debug_sync='now WAIT_FOR locked';
-SET debug_sync='find_udf_before_lock SIGNAL go';
-SELECT * FROM v1;
-
-connection con1;
-reap;
-disconnect con1;
-
-connection default;
-SET debug_sync='RESET';
-DROP VIEW v1;
-DROP FUNCTION myfunc_int;
diff --git a/mysql-test/t/udf_notembedded.test b/mysql-test/t/udf_notembedded.test
deleted file mode 100644
index d6658604005..00000000000
--- a/mysql-test/t/udf_notembedded.test
+++ /dev/null
@@ -1,14 +0,0 @@
---source include/not_embedded.inc
---source include/have_udf.inc
-
-#
-# MDEV-8644 Using a UDF in a virtual column causes a crash when stopping the server
-#
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval create function udf_sequence returns integer soname "$UDF_EXAMPLE_SO";
-create table t1 (n int key not null auto_increment, msg int as (udf_sequence()) virtual);
-select * from t1;
-source include/restart_mysqld.inc;
-drop table t1;
-drop function udf_sequence;
-
diff --git a/mysql-test/t/udf_query_cache.test b/mysql-test/t/udf_query_cache.test
deleted file mode 100644
index b0037973631..00000000000
--- a/mysql-test/t/udf_query_cache.test
+++ /dev/null
@@ -1,36 +0,0 @@
---source include/have_udf.inc
---source include/have_query_cache.inc
-#
-# To run this tests the "sql/udf_example.c" need to be compiled into
-# udf_example.so and LD_LIBRARY_PATH should be setup to point out where
-# the library are.
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-#
-# Bug #28921: Queries containing UDF functions are cached
-#
-
---replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
-eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO";
-create table t1 (a char);
-
-set GLOBAL query_cache_size=1355776;
-reset query cache;
-flush status;
-
-select metaphon('MySQL') from t1;
-show status like "Qcache_hits";
-show status like "Qcache_queries_in_cache";
-
-select metaphon('MySQL') from t1;
-show status like "Qcache_hits";
-show status like "Qcache_queries_in_cache";
-
-drop table t1;
-drop function metaphon;
-set GLOBAL query_cache_size=default;
-
diff --git a/mysql-test/t/udf_skip_grants-master.opt b/mysql-test/t/udf_skip_grants-master.opt
deleted file mode 100644
index 5699a3387b8..00000000000
--- a/mysql-test/t/udf_skip_grants-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---skip-grant-tables
diff --git a/mysql-test/t/udf_skip_grants.test b/mysql-test/t/udf_skip_grants.test
deleted file mode 100644
index bd9402e0d8a..00000000000
--- a/mysql-test/t/udf_skip_grants.test
+++ /dev/null
@@ -1,28 +0,0 @@
-####################### udf_skip_grants.test ###########################
-# #
-# Test for bug #32020 "loading udfs while --skip-grant-tables is #
-# enabled causes out of memory errors" #
-# #
-# Creation: #
-# 2007-12-24 akopytov Moved the test case for bug #32020 from #
-# skip_grants.test to a separate test to ensure #
-# that it is only run when the server is built #
-# with support for dynamically loaded libraries #
-# (see bug #33305). #
-# #
-########################################################################
-
--- source include/not_embedded.inc
--- source include/have_udf.inc
-
-#
-# Bug #32020: loading udfs while --skip-grant-tables is enabled causes out of
-# memory errors
-#
-
---error ER_CANT_INITIALIZE_UDF
-CREATE FUNCTION a RETURNS STRING SONAME '';
---error ER_SP_DOES_NOT_EXIST
-DROP FUNCTION a;
-
---echo End of 5.0 tests
diff --git a/mysql-test/t/union-master.opt b/mysql-test/t/union-master.opt
deleted file mode 100644
index 57befa5c0a2..00000000000
--- a/mysql-test/t/union-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---slow-query-log --log-queries-not-using-indexes
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
deleted file mode 100644
index f86cae87524..00000000000
--- a/mysql-test/t/union.test
+++ /dev/null
@@ -1,1751 +0,0 @@
-#
-# Test of unions
-#
-
---disable_warnings
-drop table if exists t1,t2,t3,t4,t5,t6;
---enable_warnings
-
-CREATE TABLE t1 (a int not null, b char (10) not null);
-insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c');
-CREATE TABLE t2 (a int not null, b char (10) not null);
-insert into t2 values (3,'c'),(4,'d'),(5,'f'),(6,'e');
-
-select a,b from t1 union distinct select a,b from t2;
-select a,b from t1 union all select a,b from t2;
-select a,b from t1 union all select a,b from t2 order by b;
-select a,b from t1 union all select a,b from t2 union select 7,'g';
-select 0,'#' union select a,b from t1 union all select a,b from t2 union select 7,'gg';
-select a,b from t1 union select a,b from t1;
-select 't1',b,count(*) from t1 group by b UNION select 't2',b,count(*) from t2 group by b;
-
-# Test alternate syntax for unions
-(select a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 4;
-(select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1);
-(select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc;
---error 1250
-(select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by t1.b;
-explain extended (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc;
-select count(*) from (
-(select a,b from t1 limit 2) union all (select a,b from t2 order by a)) q;
-(select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2;
-select found_rows();
-select count(*) from (
-select a,b from t1 union all select a,b from t2) q;
-select sql_calc_found_rows a,b from t1 union all select a,b from t2 limit 2;
-select found_rows();
-
-#
-# Test some error conditions with UNION
-#
-
-explain select a,b from t1 union all select a,b from t2;
-
---error 1054
-explain select xx from t1 union select 1;
---error 1222
-explain select a,b from t1 union select 1;
---error 1222
-explain select 1 union select a,b from t1 union select 1;
---error 1222
-explain select a,b from t1 union select 1 limit 0;
-
---error ER_PARSE_ERROR
-select a,b from t1 into outfile 'skr' union select a,b from t2;
-
---error ER_PARSE_ERROR
-select a,b from t1 order by a union select a,b from t2;
-
---error ER_PARSE_ERROR
-insert into t3 select a from t1 order by a union select a from t2;
-
---error 1222
-create table t3 select a,b from t1 union select a from t2;
-
---error 1222
-select a,b from t1 union select a from t2;
-
---error 1222
-select * from t1 union select a from t2;
-
---error 1222
-select a from t1 union select * from t2;
-
---error 1234
-select * from t1 union select SQL_BUFFER_RESULT * from t2;
-
-# Test CREATE, INSERT and REPLACE
-create table t3 select a,b from t1 union all select a,b from t2;
-insert into t3 select a,b from t1 union all select a,b from t2;
-# PS can't handle REPLACE ... SELECT
-replace into t3 select a,b as c from t1 union all select a,b from t2;
-
-drop table t1,t2,t3;
-
-#
-# Test some unions without tables
-#
---error 1096
-select * union select 1;
-select 1 as a,(select a union select a);
---error 1054
-(select 1) union (select 2) order by 0;
-SELECT @a:=1 UNION SELECT @a:=@a+1;
---error 1054
-(SELECT 1) UNION (SELECT 2) ORDER BY (SELECT a);
-(SELECT 1,3) UNION (SELECT 2,1) ORDER BY (SELECT 2);
-
-#
-# Test bug reported by joc@presence-pc.com
-#
-
-CREATE TABLE t1 (
- `pseudo` char(35) NOT NULL default '',
- `pseudo1` char(35) NOT NULL default '',
- `same` tinyint(1) unsigned NOT NULL default '1',
- PRIMARY KEY (`pseudo1`),
- KEY `pseudo` (`pseudo`)
-) ENGINE=MyISAM;
-INSERT INTO t1 (pseudo,pseudo1,same) VALUES ('joce', 'testtt', 1),('joce', 'tsestset', 1),('dekad', 'joce', 1);
-SELECT pseudo FROM t1 WHERE pseudo1='joce' UNION SELECT pseudo FROM t1 WHERE pseudo='joce';
-SELECT pseudo1 FROM t1 WHERE pseudo1='joce' UNION SELECT pseudo1 FROM t1 WHERE pseudo='joce';
-SELECT * FROM t1 WHERE pseudo1='joce' UNION SELECT * FROM t1 WHERE pseudo='joce' order by pseudo desc,pseudo1 desc;
-SELECT pseudo1 FROM t1 WHERE pseudo='joce' UNION SELECT pseudo FROM t1 WHERE pseudo1='joce';
-SELECT pseudo1 FROM t1 WHERE pseudo='joce' UNION ALL SELECT pseudo FROM t1 WHERE pseudo1='joce';
-SELECT pseudo1 FROM t1 WHERE pseudo='joce' UNION SELECT 1;
-drop table t1;
-
-create table t1 (a int);
-create table t2 (a int);
-insert into t1 values (1),(2),(3),(4),(5);
-insert into t2 values (11),(12),(13),(14),(15);
-(select * from t1 limit 2) union (select * from t2 limit 3) limit 4;
-(select * from t1 limit 2) union (select * from t2 limit 3);
-(select * from t1 limit 2) union (select * from t2 limit 20,3);
-set SQL_SELECT_LIMIT=2;
-(select * from t1 limit 1) union (select * from t2 limit 3);
-set SQL_SELECT_LIMIT=DEFAULT;
-drop table t1,t2;
-
-#
-# Test error with left join
-#
-
-CREATE TABLE t1 (
- cid smallint(5) unsigned NOT NULL default '0',
- cv varchar(250) NOT NULL default '',
- PRIMARY KEY (cid),
- UNIQUE KEY cv (cv)
-) ;
-INSERT INTO t1 VALUES (8,'dummy');
-CREATE TABLE t2 (
- cid bigint(20) unsigned NOT NULL auto_increment,
- cap varchar(255) NOT NULL default '',
- PRIMARY KEY (cid),
- KEY cap (cap)
-) ;
-CREATE TABLE t3 (
- gid bigint(20) unsigned NOT NULL auto_increment,
- gn varchar(255) NOT NULL default '',
- must tinyint(4) default NULL,
- PRIMARY KEY (gid),
- KEY gn (gn)
-) ;
-INSERT INTO t3 VALUES (1,'V1',NULL);
-CREATE TABLE t4 (
- uid bigint(20) unsigned NOT NULL default '0',
- gid bigint(20) unsigned default NULL,
- rid bigint(20) unsigned default NULL,
- cid bigint(20) unsigned default NULL,
- UNIQUE KEY m (uid,gid,rid,cid),
- KEY uid (uid),
- KEY rid (rid),
- KEY cid (cid),
- KEY container (gid,rid,cid)
-) ;
-INSERT INTO t4 VALUES (1,1,NULL,NULL);
-CREATE TABLE t5 (
- rid bigint(20) unsigned NOT NULL auto_increment,
- rl varchar(255) NOT NULL default '',
- PRIMARY KEY (rid),
- KEY rl (rl)
-) ;
-CREATE TABLE t6 (
- uid bigint(20) unsigned NOT NULL auto_increment,
- un varchar(250) NOT NULL default '',
- uc smallint(5) unsigned NOT NULL default '0',
- PRIMARY KEY (uid),
- UNIQUE KEY nc (un,uc),
- KEY un (un)
-) ;
-INSERT INTO t6 VALUES (1,'test',8);
-
-SELECT t4.uid, t5.rl, t3.gn as g1, t4.cid, t4.gid as gg FROM t3, t6, t1, t4 left join t5 on t5.rid = t4.rid left join t2 on t2.cid = t4.cid WHERE t3.gid=t4.gid AND t6.uid = t4.uid AND t6.uc = t1.cid AND t1.cv = "dummy" AND t6.un = "test";
-SELECT t4.uid, t5.rl, t3.gn as g1, t4.cid, t4.gid as gg FROM t3, t6, t1, t4 left join t5 on t5.rid = t4.rid left join t2 on t2.cid = t4.cid WHERE t3.gid=t4.gid AND t6.uid = t4.uid AND t3.must IS NOT NULL AND t6.uc = t1.cid AND t1.cv = "dummy" AND t6.un = "test";
-(SELECT t4.uid, t5.rl, t3.gn as g1, t4.cid, t4.gid as gg FROM t3, t6, t1, t4 left join t5 on t5.rid = t4.rid left join t2 on t2.cid = t4.cid WHERE t3.gid=t4.gid AND t6.uid = t4.uid AND t3.must IS NOT NULL AND t6.uc = t1.cid AND t1.cv = "dummy" AND t6.un = "test") UNION (SELECT t4.uid, t5.rl, t3.gn as g1, t4.cid, t4.gid as gg FROM t3, t6, t1, t4 left join t5 on t5.rid = t4.rid left join t2 on t2.cid = t4.cid WHERE t3.gid=t4.gid AND t6.uid = t4.uid AND t6.uc = t1.cid AND t1.cv = "dummy" AND t6.un = "test");
-drop table t1,t2,t3,t4,t5,t6;
-
-#
-# Test insert ... SELECT with UNION
-#
-
-CREATE TABLE t1 (a int not null, b char (10) not null);
-insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c');
-CREATE TABLE t2 (a int not null, b char (10) not null);
-insert into t2 values (3,'c'),(4,'d'),(5,'f'),(6,'e');
-create table t3 select a,b from t1 union select a,b from t2;
-create table t4 (select a,b from t1) union (select a,b from t2) limit 2;
-insert into t4 select a,b from t1 union select a,b from t2;
-insert into t3 (select a,b from t1) union (select a,b from t2) limit 2;
-select * from t3;
-select * from t4;
-drop table t1,t2,t3,t4;
-
-#
-# Test of SQL_CALC_FOUND_ROW handling
-#
-create table t1 (a int);
-insert into t1 values (1),(2),(3);
-create table t2 (a int);
-insert into t2 values (3),(4),(5);
-
-# Test global limits
-SELECT COUNT(*) FROM (
-(SELECT * FROM t1) UNION all (SELECT * FROM t2)) q;
-(SELECT SQL_CALC_FOUND_ROWS * FROM t1) UNION all (SELECT * FROM t2) LIMIT 1;
-select found_rows();
-SELECT COUNT(*) FROM (
-(SELECT * FROM t1 LIMIT 1) UNION all (SELECT * FROM t2)) q;
-(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION all (SELECT * FROM t2) LIMIT 2;
-select found_rows();
-
-# Test cases where found_rows() should return number of returned rows
-SELECT COUNT(*) FROM (
-(SELECT * FROM t1 LIMIT 1) UNION all (SELECT * FROM t2)) q;
-(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION all (SELECT * FROM t2);
-select found_rows();
-SELECT COUNT(*) FROM (
-(SELECT * FROM t1) UNION all (SELECT * FROM t2 LIMIT 1)) q;
-(SELECT SQL_CALC_FOUND_ROWS * FROM t1) UNION all (SELECT * FROM t2 LIMIT 1);
-select found_rows();
-(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION SELECT * FROM t2 LIMIT 1;
-select found_rows();
-SELECT COUNT(*) FROM (
-(SELECT * FROM t1 LIMIT 1) UNION SELECT * FROM t2) q;
-(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION SELECT * FROM t2 LIMIT 1;
-select found_rows();
-
-# In these case found_rows() should work
---error ER_PARSE_ERROR
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION all SELECT * FROM t2 LIMIT 2;
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION all SELECT * FROM t2 LIMIT 2;
-select found_rows();
-
-# The following examples will not be exact
-SELECT COUNT(*) FROM (
-SELECT * FROM t1 UNION SELECT * FROM t2) q;
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 2;
-SELECT COUNT(*) FROM (
-(SELECT * FROM t1 LIMIT 1) UNION all SELECT * FROM t2) q;
-(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION all SELECT * FROM t2 LIMIT 2;
-select found_rows();
-SELECT COUNT(*) FROM (
-SELECT * FROM t1 UNION all SELECT * FROM t2) q;
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 100;
-select found_rows();
---error ER_PARSE_ERROR
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 100 UNION SELECT * FROM t2;
-SELECT COUNT(*) FROM (
-(SELECT * FROM t1 LIMIT 100) UNION SELECT * FROM t2) q;
-(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 100) UNION SELECT * FROM t2;
---error ER_PARSE_ERROR
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION SELECT * FROM t2;
-SELECT COUNT(*) FROM (
-(SELECT * FROM t1 LIMIT 1) UNION SELECT * FROM t2) q;
-(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION SELECT * FROM t2;
---error ER_PARSE_ERROR
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1 UNION SELECT * FROM t2 LIMIT 2;
-SELECT COUNT(*) FROM (
-(SELECT * FROM t1 LIMIT 1) UNION SELECT * FROM t2) q;
-(SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 1) UNION SELECT * FROM t2 LIMIT 2;
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 2,2;
-select found_rows();
-SELECT COUNT(*) FROM (
-SELECT * FROM t1 UNION SELECT * FROM t2) q;
---error ER_PARSE_ERROR
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 limit 2,2 UNION SELECT * FROM t2;
-SELECT COUNT(*) FROM (
-(SELECT * FROM t1 limit 2,2) UNION SELECT * FROM t2) q;
-(SELECT SQL_CALC_FOUND_ROWS * FROM t1 limit 2,2) UNION SELECT * FROM t2;
-
-# Test some limits with ORDER BY
-SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a desc LIMIT 1;
-(SELECT * FROM t1 ORDER by a) UNION ALL (SELECT * FROM t2 ORDER BY a) ORDER BY A desc LIMIT 4;
-
-# Wrong usage
---error 1234
-(SELECT * FROM t1) UNION all (SELECT SQL_CALC_FOUND_ROWS * FROM t2) LIMIT 1;
-
-create temporary table t1 select a from t1 union select a from t2;
-drop temporary table t1;
---error ER_TABLE_EXISTS_ERROR
-create table t1 select a from t1 union select a from t2;
---error ER_TABLENAME_NOT_ALLOWED_HERE
-select a from t1 union select a from t2 order by t2.a;
-drop table t1,t2;
-
-#
-# Problem with alias '*' (BUG #1249)
-#
-
-select length(version()) > 1 as `*` UNION select 2;
-
-#
-# Bug #4980: problem with explain
-#
-
-create table t1 (a int);
-insert into t1 values (0), (3), (1), (2);
-explain (select * from t1) union (select * from t1) order by a;
-drop table t1;
-#
-# Test for another bug with UNION and LEFT JOIN
-#
-CREATE TABLE t1 ( id int(3) unsigned default '0') ENGINE=MyISAM;
-INSERT INTO t1 (id) VALUES("1");
-CREATE TABLE t2 ( id int(3) unsigned default '0', id_master int(5) default '0', text1 varchar(5) default NULL, text2 varchar(5) default NULL) ENGINE=MyISAM;
-INSERT INTO t2 (id, id_master, text1, text2) VALUES("1", "1",
-"foo1", "bar1");
-INSERT INTO t2 (id, id_master, text1, text2) VALUES("2", "1",
-"foo2", "bar2");
-INSERT INTO t2 (id, id_master, text1, text2) VALUES("3", "1", NULL,
-"bar3");
-INSERT INTO t2 (id, id_master, text1, text2) VALUES("4", "1",
-"foo4", "bar4");
-SELECT 1 AS id_master, 1 AS id, NULL AS text1, 'ABCDE' AS text2 UNION SELECT id_master, t2.id, text1, text2 FROM t1 LEFT JOIN t2 ON t1.id = t2.id_master;
-SELECT 1 AS id_master, 1 AS id, 'ABCDE' AS text1, 'ABCDE' AS text2 UNION SELECT id_master, t2.id, text1, text2 FROM t1 LEFT JOIN t2 ON t1.id = t2.id_master;
-drop table if exists t1,t2;
-
-#
-# Test of bug when using the same table multiple times
-#
-create table t1 (a int not null primary key auto_increment, b int, key(b));
-create table t2 (a int not null primary key auto_increment, b int);
-insert into t1 (b) values (1),(2),(2),(3);
-insert into t2 (b) values (10),(11),(12),(13);
-
-explain extended (select * from t1 where a=1) union (select * from t2 where a=1);
-(select * from t1 where a=5) union (select * from t2 where a=1);
-(select * from t1 where a=5 and a=6) union (select * from t2 where a=1);
-(select t1.a,t1.b from t1,t2 where t1.a=5) union (select * from t2 where a=1);
-(select * from t1 where a=1) union (select t1.a,t2.a from t1,t2 where t1.a=t2.a);
-explain (select * from t1 where a=1 and b=10) union (select straight_join t1.a,t2.a from t1,t2 where t1.a=t2.a);
-explain (select * from t1 where a=1) union (select * from t1 where b=1);
-drop table t1,t2;
-create table t1 ( id int not null auto_increment, primary key (id) ,user_name text );
-create table t2 ( id int not null auto_increment, primary key (id) ,group_name text );
-create table t3 ( id int not null auto_increment, primary key (id) ,user_id int ,index user_idx (user_id) ,foreign key (user_id) references users(id) ,group_id int ,index group_idx (group_id) ,foreign key (group_id) references groups(id) );
-insert into t1 (user_name) values ('Tester');
-insert into t2 (group_name) values ('Group A');
-insert into t2 (group_name) values ('Group B');
-insert into t3 (user_id, group_id) values (1,1);
-select 1 'is_in_group', a.user_name, c.group_name, b.id from t1 a, t3 b, t2 c where a.id = b.user_id and b.group_id = c.id UNION select 0 'is_in_group', a.user_name, c.group_name, null from t1 a, t2 c;
-drop table t1, t2, t3;
-
-#
-# fix_fields problem
-#
-create table t1 (mat_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, matintnum CHAR(6) NOT NULL, test MEDIUMINT UNSIGNED NULL);
-create table t2 (mat_id MEDIUMINT UNSIGNED NOT NULL, pla_id MEDIUMINT UNSIGNED NOT NULL);
-insert into t1 values (NULL, 'a', 1), (NULL, 'b', 2), (NULL, 'c', 3), (NULL, 'd', 4), (NULL, 'e', 5), (NULL, 'f', 6), (NULL, 'g', 7), (NULL, 'h', 8), (NULL, 'i', 9);
-insert into t2 values (1, 100), (1, 101), (1, 102), (2, 100), (2, 103), (2, 104), (3, 101), (3, 102), (3, 105);
-SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id union SELECT 0, 0;
-drop table t1, t2;
-
-#
-# types conversions
-#
-create table t1 SELECT "a" as a UNION select "aa" as a;
-select * from t1;
-show create table t1;
-drop table t1;
-create table t1 SELECT 12 as a UNION select "aa" as a;
-select * from t1;
-show create table t1;
-drop table t1;
-create table t1 SELECT 12 as a UNION select 12.2 as a;
-select * from t1;
-show create table t1;
-drop table t1;
-
-create table t2 (it1 tinyint, it2 tinyint not null, i int not null, ib bigint, f float, d double, y year, da date, dt datetime, sc char(10), sv varchar(10), b blob, tx text);
-insert into t2 values (NULL, 1, 3, 4, 1.5, 2.5, 1972, '1972-10-22', '1972-10-22 11:50', 'testc', 'testv', 'tetetetetest', 'teeeeeeeeeeeest');
-
-create table t1 SELECT it2 from t2 UNION select it1 from t2;
-select * from t1;
-show create table t1;
-drop table t1;
-create table t1 SELECT it2 from t2 UNION select i from t2;
-select * from t1;
-show create table t1;
-drop table t1;
-create table t1 SELECT i from t2 UNION select f from t2;
-select * from t1;
-show create table t1;
-drop table t1;
-create table t1 SELECT f from t2 UNION select d from t2;
-select * from t1;
-show create table t1;
-drop table t1;
-create table t1 SELECT ib from t2 UNION select f from t2;
-select * from t1;
-show create table t1;
-drop table t1;
-create table t1 SELECT ib from t2 UNION select d from t2;
-select * from t1;
-show create table t1;
-drop table t1;
-create table t1 SELECT f from t2 UNION select y from t2;
-select * from t1;
-show create table t1;
-drop table t1;
-create table t1 SELECT f from t2 UNION select da from t2;
-select * from t1;
-show create table t1;
-drop table t1;
-create table t1 SELECT y from t2 UNION select da from t2;
-select * from t1;
-show create table t1;
-drop table t1;
-create table t1 SELECT y from t2 UNION select dt from t2;
-select * from t1;
-show create table t1;
-drop table t1;
-create table t1 SELECT da from t2 UNION select dt from t2;
-select * from t1;
-show create table t1;
-drop table t1;
-create table t1 SELECT dt from t2 UNION select trim(sc) from t2;
-select trim(dt) from t1;
-show create table t1;
-drop table t1;
-create table t1 SELECT dt from t2 UNION select sv from t2;
-select * from t1;
-show create table t1;
-drop table t1;
-create table t1 SELECT sc from t2 UNION select sv from t2;
-select * from t1;
-show create table t1;
-drop table t1;
-create table t1 SELECT dt from t2 UNION select b from t2;
-select * from t1;
-show create table t1;
-drop table t1;
-create table t1 SELECT sv from t2 UNION select b from t2;
-select * from t1;
-show create table t1;
-drop table t1;
-create table t1 SELECT i from t2 UNION select d from t2 UNION select b from t2;
-select * from t1;
-show create table t1;
-drop table t1;
-create table t1 SELECT sv from t2 UNION select tx from t2;
-select * from t1;
-show create table t1;
-drop table t1;
-create table t1 SELECT b from t2 UNION select tx from t2;
-select * from t1;
-show create table t1;
-drop table t1,t2;
-create table t1 select 1 union select -1;
-select * from t1;
-show create table t1;
-drop table t1;
--- error 1267
-create table t1 select _latin1"test" union select _latin2"testt" ;
-create table t1 select _latin2"test" union select _latin2"testt" ;
-show create table t1;
-drop table t1;
-
-#
-# conversion memory->disk table
-#
-create table t1 (s char(200));
-insert into t1 values (repeat("1",200));
-create table t2 select * from t1;
-insert into t2 select * from t1;
-insert into t1 select * from t2;
-insert into t2 select * from t1;
-insert into t1 select * from t2;
-insert into t2 select * from t1;
-set local tmp_table_size=1024;
-select count(*) from (select * from t1 union all select * from t2 order by 1) b;
-select count(*) from t1;
-select count(*) from t2;
-drop table t1,t2;
-set local tmp_table_size=default;
-
-#
-# slow logging
-#
-create table t1 (a int, index (a), b int);
-insert t1 values (1,1),(2,2),(3,3),(4,4),(5,5);
-insert t1 select a+1, a+b from t1;
-insert t1 select a+1, a+b from t1;
-insert t1 select a+1, a+b from t1;
-insert t1 select a+1, a+b from t1;
-insert t1 select a+1, a+b from t1;
-FLUSH STATUS;
-show status like 'Slow_queries';
-select count(*) from t1 where a=7;
-show status like 'Slow_queries';
-select count(*) from t1 where b=13;
-show status like 'Slow_queries';
-select count(*) from t1 where b=13 union select count(*) from t1 where a=7;
-show status like 'Slow_queries';
-select count(*) from t1 where a=7 union select count(*) from t1 where b=13;
-show status like 'Slow_queries';
-# additional test for examined rows
-flush status;
-select a from t1 where b not in (1,2,3) union select a from t1 where b not in (4,5,6);
-show status like 'Slow_queries';
-drop table t1;
-
-#
-# Column 'name' cannot be null (error with union and left join) (bug #2508)
-#
-create table t1 ( RID int(11) not null default '0', IID int(11) not null default '0', nada varchar(50) not null,NAME varchar(50) not null,PHONE varchar(50) not null) engine=MyISAM;
-insert into t1 ( RID,IID,nada,NAME,PHONE) values (1, 1, 'main', 'a', '111'), (2, 1, 'main', 'b', '222'), (3, 1, 'main', 'c', '333'), (4, 1, 'main', 'd', '444'), (5, 1, 'main', 'e', '555'), (6, 2, 'main', 'c', '333'), (7, 2, 'main', 'd', '454'), (8, 2, 'main', 'e', '555'), (9, 2, 'main', 'f', '666'), (10, 2, 'main', 'g', '777');
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='outer_join_with_cache=off';
-select A.NAME, A.PHONE, B.NAME, B.PHONE from t1 A left join t1 B on A.NAME = B.NAME and B.IID = 2 where A.IID = 1 and (A.PHONE <> B.PHONE or B.NAME is null) union select A.NAME, A.PHONE, B.NAME, B.PHONE from t1 B left join t1 A on B.NAME = A.NAME and A.IID = 1 where B.IID = 2 and (A.PHONE <> B.PHONE or A.NAME is null);
-SET optimizer_switch=@save_optimizer_switch;
-drop table t1;
-
-#
-# Bug #2809 (UNION fails on MyIsam tables when index on second column from
-# same table)
-#
-create table t1 (col1 tinyint unsigned, col2 tinyint unsigned);
-insert into t1 values (1,2),(3,4),(5,6),(7,8),(9,10);
-select col1 n from t1 union select col2 n from t1 order by n;
-alter table t1 add index myindex (col2);
-select col1 n from t1 union select col2 n from t1 order by n;
-drop table t1;
-
-#
-# Incorrect handling of UNION ALL (Bug #1428)
-#
-create table t1 (i int);
-insert into t1 values (1);
-select * from t1 UNION select * from t1;
-select * from t1 UNION ALL select * from t1;
-select * from t1 UNION select * from t1 UNION ALL select * from t1;
-drop table t1;
-select 1 as a union all select 1 union all select 2 union select 1 union all select 2;
-set sql_select_limit=1;
-select 1 union select 2;
-(select 1) union (select 2);
-(select 1) union (select 2) union (select 3) limit 2;
-set sql_select_limit=default;
-
-#
-# ORDER with LIMIT
-#
-create table t1 (a int);
-insert into t1 values (100), (1);
-create table t2 (a int);
-insert into t2 values (100);
-select a from t1 union select a from t2 order by a;
-SET SQL_SELECT_LIMIT=1;
-select a from t1 union select a from t2 order by a;
-drop table t1, t2;
-set sql_select_limit=default;
-
-#
-# nonexisting column in global ORDER BY
-#
-CREATE TABLE t1 (i int(11) default NULL,c char(1) default NULL,KEY i (i));
-CREATE TABLE t2 (i int(11) default NULL,c char(1) default NULL,KEY i (i));
---error 1054
-explain (select * from t1) union (select * from t2) order by not_existing_column;
-drop table t1, t2;
-
-#
-# length detecting
-#
-CREATE TABLE t1 (uid int(1));
-INSERT INTO t1 SELECT 150;
-SELECT 'a' UNION SELECT uid FROM t1;
-drop table t1;
-
-#
-# parser stack overflow
-#
-CREATE TABLE t1 ( ID1 int(10) unsigned NOT NULL DEFAULT '0' , ID2 datetime NOT NULL DEFAULT '0000-00-00 00:00:00' , DATA1 varchar(10) , DATA2 double(5,4) , DATA3 datetime , PRIMARY KEY (ID1,ID2));
-
-CREATE TABLE t2 ( ID int(3) unsigned NOT NULL DEFAULT '0' , DATA1 timestamp DEFAULT '0000-00-00 00:00:00' , PRIMARY KEY (ID));
-(SELECT * FROM t1 AS PARTITIONED, t2 AS
-PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
-(SELECT * FROM t1 AS PARTITIONED, t2 AS
-PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
-(SELECT * FROM t1 AS PARTITIONED, t2 AS
-PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
-(SELECT * FROM t1 AS PARTITIONED, t2 AS
-PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
-(SELECT * FROM t1 AS PARTITIONED, t2 AS
-PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
-(SELECT * FROM t1 AS PARTITIONED, t2 AS
-PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
-(SELECT * FROM t1 AS PARTITIONED, t2 AS
-PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
-(SELECT * FROM t1 AS PARTITIONED, t2 AS
-PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
-(SELECT * FROM t1 AS PARTITIONED, t2 AS
-PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
-(SELECT * FROM t1 AS PARTITIONED, t2 AS
-PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
-(SELECT * FROM t1 AS PARTITIONED, t2 AS
-PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
-(SELECT * FROM t1 AS PARTITIONED, t2 AS
-PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1);
-drop table t1,t2;
-
-#
-# merging ENUM and SET fields in one UNION
-#
-create table t1 (a ENUM('Yes', 'No') NOT NULL);
-create table t2 (a ENUM('aaa', 'bbb') NOT NULL);
-insert into t1 values ('No');
-insert into t2 values ('bbb');
-create table t3 (a SET('Yes', 'No') NOT NULL);
-create table t4 (a SET('aaa', 'bbb') NOT NULL);
-insert into t3 values (1);
-insert into t4 values (3);
-select "1" as a union select a from t1;
-select a as a from t1 union select "1";
-select a as a from t2 union select a from t1;
-select "1" as a union select a from t3;
-select a as a from t3 union select "1";
-select a as a from t4 union select a from t3;
-select a as a from t1 union select a from t4;
-drop table t1,t2,t3,t4;
-
-#
-# Bug #6139 UNION doesn't understand collate in the column of second select
-#
-create table t1 as
-(select _latin1'test') union
-(select _latin1'TEST') union
-(select _latin1'TeST');
-show create table t1;
-select count(*) from t1;
-drop table t1;
-
-create table t1 as
-(select _latin1'test' collate latin1_bin) union
-(select _latin1'TEST') union
-(select _latin1'TeST');
-show create table t1;
-select count(*) from t1;
-drop table t1;
-
-create table t1 as
-(select _latin1'test') union
-(select _latin1'TEST' collate latin1_bin) union
-(select _latin1'TeST');
-show create table t1;
-select count(*) from t1;
-drop table t1;
-
-create table t1 as
-(select _latin1'test') union
-(select _latin1'TEST') union
-(select _latin1'TeST' collate latin1_bin);
-show create table t1;
-select count(*) from t1;
-drop table t1;
-
-create table t2 (
-a char character set latin1 collate latin1_swedish_ci,
-b char character set latin1 collate latin1_german1_ci);
---error 1271
-create table t1 as
-(select a from t2) union
-(select b from t2);
-create table t1 as
-(select a collate latin1_german1_ci from t2) union
-(select b from t2);
-show create table t1;
-drop table t1;
-create table t1 as
-(select a from t2) union
-(select b collate latin1_german1_ci from t2);
-show create table t1;
-drop table t1;
-create table t1 as
-(select a from t2) union
-(select b from t2) union
-(select 'c' collate latin1_german1_ci from t2);
-show create table t1;
-drop table t1;
-drop table t2;
-
-#
-# Bug 6931: Date Type column problem when using UNION-Table.
-#
-create table t1(a1 int, f1 char(10));
-create table t2
-select f2,a1 from (select a1, CAST('2004-12-31' AS DATE) f2 from t1) a
-union
-select f2,a1 from (select a1, CAST('2004-12-31' AS DATE) f2 from t1) a
-order by f2, a1;
-show columns from t2;
-drop table t1, t2;
-
-create table t1 (f1 int);
-create table t2 (f1 int, f2 int ,f3 date);
-create table t3 (f1 int, f2 char(10));
-create table t4
-(
- select t2.f3 as sdate
- from t1
- left outer join t2 on (t1.f1 = t2.f1)
- inner join t3 on (t2.f2 = t3.f1)
- order by t1.f1, t3.f1, t2.f3
-)
-union
-(
- select cast('2004-12-31' as date) as sdate
- from t1
- left outer join t2 on (t1.f1 = t2.f1)
- inner join t3 on (t2.f2 = t3.f1)
- group by t1.f1
- order by t1.f1, t3.f1, t2.f3
-)
-order by sdate;
-show columns from t4;
-drop table t1, t2, t3, t4;
-
-#
-# Bug #2435 UNION with parentheses not supported
-#
-create table t1 (a int not null, b char (10) not null);
-insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c');
-select * from ((select * from t1 limit 1)) a;
-select * from ((select * from t1 limit 1) union (select * from t1 limit 1)) a;
-select * from ((select * from t1 limit 1) union (select * from t1 limit 1) union (select * from t1 limit 1)) a;
-select * from ((((select * from t1))) union (select * from t1) union (select * from t1)) a;
-select * from ((select * from t1) union (((select * from t1))) union (select * from t1)) a;
-drop table t1;
-
-#
-# Bugs#6519 UNION with collation binary and latin1_swedish_ci fails
-#
-set @val:=6;
-select concat('value is: ', @val) union select 'some text';
-
-#
-# Bug#15949 union + illegal mix of collations (IMPLICIT + COERCIBLE)
-#
-select concat(_latin1'a', _ascii'b' collate ascii_bin);
-create table t1 (foo varchar(100)) collate ascii_bin;
-insert into t1 (foo) values ("foo");
-select foo from t1 union select 'bar' as foo from dual;
-drop table t1;
-
-#
-# Enum merging test
-#
-CREATE TABLE t1 (
- a ENUM('ä','ö','ü') character set utf8 not null default 'ü',
- b ENUM("one", "two") character set utf8,
- c ENUM("one", "two")
-);
-show create table t1;
-insert into t1 values ('ä', 'one', 'one'), ('ö', 'two', 'one'), ('ü', NULL, NULL);
-create table t2 select NULL union select a from t1;
-show columns from t2;
-drop table t2;
-create table t2 select a from t1 union select NULL;
-show columns from t2;
-drop table t2;
-create table t2 select a from t1 union select a from t1;
-show columns from t2;
-drop table t2;
-create table t2 select a from t1 union select c from t1;
-drop table t2;
-create table t2 select a from t1 union select b from t1;
-show columns from t2;
-drop table t2, t1;
-
-#
-# Bug #14216: UNION + DECIMAL wrong values in result
-#
-create table t1 (f1 decimal(60,25), f2 decimal(60,25));
-insert into t1 values (0.0,0.0);
-select f1 from t1 union all select f2 from t1;
-select 'XXXXXXXXXXXXXXXXXXXX' as description, f1 from t1
-union all
-select 'YYYYYYYYYYYYYYYYYYYY' as description, f2 from t1;
-drop table t1;
-create table t1 (f1 decimal(60,24), f2 decimal(60,24));
-insert into t1 values (0.0,0.0);
-select f1 from t1 union all select f2 from t1;
-select 'XXXXXXXXXXXXXXXXXXXX' as description, f1 from t1
-union all
-select 'YYYYYYYYYYYYYYYYYYYY' as description, f2 from t1;
-drop table t1;
-
-#
-# Test that union with VARCHAR produces dynamic row tables
-#
-
-create table t1 (a varchar(5));
-create table t2 select * from t1 union select 'abcdefghijkl';
-show create table t2;
-select row_format from information_schema.TABLES where table_schema="test" and table_name="t2";
-alter table t2 ROW_FORMAT=fixed;
-show create table t2;
-drop table t1,t2;
-
-#
-# correct conversion long string to TEXT (BUG#10025)
-#
-
-CREATE TABLE t1 (a mediumtext);
-CREATE TABLE t2 (b varchar(20));
-INSERT INTO t1 VALUES ('a'),('b');
-SELECT left(a,100000000) FROM t1 UNION SELECT b FROM t2;
-create table t3 SELECT left(a,100000000) FROM t1 UNION SELECT b FROM t2;
-show create table t3;
-drop tables t1,t2,t3;
-
-#
-# Extended fix to Bug#10025 - the test above should result to mediumtext
-# and the one below to longtext. Earlier above test resulted to longtext
-# type also.
-#
-
-CREATE TABLE t1 (a longtext);
-CREATE TABLE t2 (b varchar(20));
-INSERT INTO t1 VALUES ('a'),('b');
-SELECT left(a,100000000) FROM t1 UNION SELECT b FROM t2;
-create table t3 SELECT left(a,100000000) FROM t1 UNION SELECT b FROM t2;
-show create table t3;
-drop tables t1,t2,t3;
-
-#
-# Testing here that mediumtext converts into longtext if the result
-# exceeds mediumtext maximum length
-#
-
-SELECT @tmp_max:= @@global.max_allowed_packet;
-SET @@global.max_allowed_packet=25000000;
-# switching connection to allow the new max_allowed_packet take effect
---connect (newconn, localhost, root,,)
-CREATE TABLE t1 (a mediumtext);
-CREATE TABLE t2 (b varchar(20));
-INSERT INTO t1 VALUES ('a');
-CREATE TABLE t3 SELECT REPEAT(a,20000000) AS a FROM t1 UNION SELECT b FROM t2;
-SHOW CREATE TABLE t3;
-DROP TABLES t1,t3;
-CREATE TABLE t1 (a tinytext);
-INSERT INTO t1 VALUES ('a');
-CREATE TABLE t3 SELECT REPEAT(a,2) AS a FROM t1 UNION SELECT b FROM t2;
-SHOW CREATE TABLE t3;
-DROP TABLES t1,t3;
-CREATE TABLE t1 (a mediumtext);
-INSERT INTO t1 VALUES ('a');
-CREATE TABLE t3 SELECT REPEAT(a,2) AS a FROM t1 UNION SELECT b FROM t2;
-SHOW CREATE TABLE t3;
-DROP TABLES t1,t3;
-CREATE TABLE t1 (a tinyblob);
-INSERT INTO t1 VALUES ('a');
-CREATE TABLE t3 SELECT REPEAT(a,2) AS a FROM t1 UNION SELECT b FROM t2;
-SHOW CREATE TABLE t3;
-DROP TABLES t1,t2,t3;
---connection default
-SET @@global.max_allowed_packet:= @tmp_max;
---disconnect newconn
-
-#
-# Bug #10032 Bug in parsing UNION with ORDER BY when one node does not use FROM
-#
-
-create table t1 ( id int not null auto_increment, primary key (id), col1 int);
-insert into t1 (col1) values (2),(3),(4),(5),(6);
-select 99 union all select id from t1 order by 1;
-select id from t1 union all select 99 order by 1;
-drop table t1;
-
-# End of 4.1 tests
-
-#
-# Bug#12185: Data type aggregation may produce wrong result
-#
-create table t1(f1 char(1), f2 char(5), f3 binary(1), f4 binary(5), f5 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', f6 varchar(1) character set utf8 collate utf8_general_ci, f7 text);
-create table t2 as select *, f6 as f8 from t1 union select *, f7 from t1;
-show create table t2;
-drop table t1, t2;
-
-CREATE TABLE t1
-(
- c_varchar varchar(1) character set utf8 collate utf8_general_ci,
- c_tinytext tinytext,
- c_text text,
- c_mediumtext mediumtext,
- c_longtext longtext
-);
-CREATE TABLE t2 AS
-SELECT c_tinytext, c_text, c_mediumtext, c_longtext FROM t1
-UNION
-SELECT c_varchar, c_varchar, c_varchar, c_varchar FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-DROP TABLE t1;
-
-#
-# Bug#18175: Union select over 129 tables with a sum function fails.
-#
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1)) union
-(select avg(1)) union (select avg(1)) union (select avg(1));
-
-#
-# Bug #16881: password() and union select
-# (The issue was poor handling of character set aggregation.)
-#
-select _utf8'12' union select _latin1'12345';
-
-#
-# Bug #26661: UNION with ORDER BY undefined column in FROM list
-#
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (3),(1),(2),(4),(1);
-
-SELECT a FROM (SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY a) AS test;
---error 1054
-SELECT a FROM (SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY c) AS test;
-
-DROP TABLE t1;
-
-#
-# Bug#23345: Wrongly allowed INTO in a non-last select of a UNION.
-#
---error 1221
-(select 1 into @var) union (select 1);
-(select 1) union (select 1 into @var);
-select @var;
---error 1172
-(select 2) union (select 1 into @var);
-
-#
-# Bug#27848: order-by of union clashes with rollup of select part
-#
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (10), (20);
-CREATE TABLE t2 (b int);
-INSERT INTO t2 VALUES (10), (50), (50);
-
-SELECT a,1 FROM t1
-UNION
-SELECT b, COUNT(*) FROM t2 GROUP BY b WITH ROLLUP
-ORDER BY a;
-
-SELECT a,1 FROM t1
-UNION
-SELECT b, COUNT(*) FROM t2 GROUP BY b WITH ROLLUP
-ORDER BY a DESC;
-
-SELECT a,1 FROM t1
-UNION
-SELECT b, COUNT(*) FROM t2 GROUP BY b WITH ROLLUP
-ORDER BY a ASC LIMIT 3;
-
-SELECT a,1 FROM t1
-UNION ALL
-SELECT b, COUNT(*) FROM t2 GROUP BY b WITH ROLLUP
-ORDER BY a DESC;
-
---error ER_WRONG_USAGE
-SELECT a,1 FROM t1
-UNION
-(SELECT b, COUNT(*) FROM t2 GROUP BY b WITH ROLLUP ORDER BY a);
-
---error ER_PARSE_ERROR
-SELECT a,1 FROM t1
-UNION ALL
-SELECT b, COUNT(*) FROM t2 GROUP BY b WITH ROLLUP ORDER BY a
-UNION
-SELECT 1,1;
-
-DROP TABLE t1,t2;
-
-# Bug#32848: Data type conversion bug in union subselects in MySQL 5.0.38
-#
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1), (2), (3);
-
-CREATE TABLE t2 SELECT * FROM (SELECT NULL) a UNION SELECT a FROM t1;
-DESC t2;
-
-CREATE TABLE t3 SELECT a FROM t1 UNION SELECT * FROM (SELECT NULL) a;
-DESC t3;
-
-CREATE TABLE t4 SELECT NULL;
-DESC t4;
-
-CREATE TABLE t5 SELECT NULL UNION SELECT NULL;
-DESC t5;
-
-CREATE TABLE t6
-SELECT * FROM (SELECT * FROM (SELECT NULL)a) b UNION SELECT a FROM t1;
-DESC t6;
-
-DROP TABLE t1, t2, t3, t4, t5, t6;
-
-#
-# Bug #43432: Union on floats does unnecessary rounding
-#
-
-CREATE TABLE t1 (f FLOAT(9,6));
-CREATE TABLE t2 AS SELECT f FROM t1 UNION SELECT f FROM t1;
-SHOW FIELDS FROM t2;
-DROP TABLE t1, t2;
-
-CREATE TABLE t1(d DOUBLE(9,6));
-CREATE TABLE t2 AS SELECT d FROM t1 UNION SELECT d FROM t1;
-SHOW FIELDS FROM t2;
-DROP TABLE t1, t2;
-
-#
-# Bug#43612 crash with explain extended, union, order by
-#
-CREATE TABLE t1(a INT);
-EXPLAIN EXTENDED
-SELECT a FROM t1
-UNION
-SELECT a FROM t1
-ORDER BY a;
-DROP TABLE t1;
-
-
--- echo #
--- echo # Bug#32858: Error: "Incorrect usage of UNION and INTO" does not take
--- echo # subselects into account
--- echo #
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1);
-
--- echo # Tests fix in parser rule select_derived_union.
-SELECT a INTO @v FROM (
- SELECT a FROM t1
- UNION
- SELECT a FROM t1
-) alias;
-
-SELECT a INTO OUTFILE 'union.out.file' FROM (
- SELECT a FROM t1
- UNION
- SELECT a FROM t1 WHERE 0
-) alias;
-
-SELECT a INTO DUMPFILE 'union.out.file2' FROM (
- SELECT a FROM t1
- UNION
- SELECT a FROM t1 WHERE 0
-) alias;
-
-SELECT a FROM t1 UNION SELECT a INTO @v FROM t1;
-SELECT a FROM t1 UNION SELECT a INTO OUTFILE 'union.out.file5' FROM t1;
-SELECT a FROM t1 UNION SELECT a INTO OUTFILE 'union.out.file6' FROM t1;
---error ER_PARSE_ERROR
-SELECT a INTO @v FROM t1 UNION SELECT a FROM t1;
---error ER_PARSE_ERROR
-SELECT a INTO OUTFILE 'union.out.file7' FROM t1 UNION SELECT a FROM t1;
---error ER_PARSE_ERROR
-SELECT a INTO DUMPFILE 'union.out.file8' FROM t1 UNION SELECT a FROM t1;
-
--- echo # Tests fix in parser rule query_expression_body.
-SELECT ( SELECT a UNION SELECT a ) INTO @v FROM t1;
-SELECT ( SELECT a UNION SELECT a ) INTO OUTFILE 'union.out.file3' FROM t1;
-SELECT ( SELECT a UNION SELECT a ) INTO DUMPFILE 'union.out.file4' FROM t1;
-
-DROP TABLE t1;
-remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.1/data/test union.out.fil*;
-
---echo #
---echo # Bug #49734: Crash on EXPLAIN EXTENDED UNION ... ORDER BY
---echo # <any non-const-function>
---echo #
-
-CREATE TABLE t1 (a VARCHAR(10), FULLTEXT KEY a (a));
-INSERT INTO t1 VALUES (1),(2);
-CREATE TABLE t2 (b INT);
-INSERT INTO t2 VALUES (1),(2);
-
---echo # Should not crash
-EXPLAIN EXTENDED
-SELECT * FROM t1 UNION SELECT * FROM t1 ORDER BY a + 12;
-
---echo # Should not crash
-SELECT * FROM t1 UNION SELECT * FROM t1 ORDER BY a + 12;
-
-
---echo # Should not crash
-EXPLAIN EXTENDED
-SELECT * FROM t1 UNION SELECT * FROM t1
- ORDER BY MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE);
-
---echo # Should not crash
---sorted_result
-SELECT * FROM t1 UNION SELECT * FROM t1
- ORDER BY MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE);
-
---echo # Should not crash
---sorted_result
-(SELECT * FROM t1) UNION (SELECT * FROM t1)
- ORDER BY MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE);
-
-
---echo # Should not crash
-EXPLAIN EXTENDED
-SELECT * FROM t1 UNION SELECT * FROM t1
- ORDER BY (SELECT a FROM t2 WHERE b = 12);
-
---echo # Should not crash
---disable_result_log
-SELECT * FROM t1 UNION SELECT * FROM t1
- ORDER BY (SELECT a FROM t2 WHERE b = 12);
---enable_result_log
-
---echo # Should not crash
-SELECT * FROM t2 UNION SELECT * FROM t2
- ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
-
-DROP TABLE t1,t2;
-
-#
-# lp:732124 union + limit returns wrong result
-#
-create table t1 (a int);
-insert into t1 values (10),(10),(10),(2),(3),(4),(5),(6),(7),(8),(9),(1),(10);
---sorted_result
-select a from t1 where false UNION select a from t1 limit 8;
---sorted_result
-(select a from t1 where false) UNION (select a from t1) limit 8;
-drop table t1;
-
---echo #
---echo # Bug#11765255 58201:
---echo # VALGRIND/CRASH WHEN ORDERING BY MULTIPLE AGGREGATE FUNCTIONS
---echo #
-
-let $my_stmt=
-select 1 as foo
-union
-select 2
-union
-select 3
-union
-select 4
-order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1)
-;
-
-eval $my_stmt;
-
-eval prepare stmt1 from '$my_stmt';
-execute stmt1;
-execute stmt1;
-
-let $my_stmt=
-select 1 as foo
-union
-select 2
-union
-select 3
-union
-(select 4)
-order by max(42) + max(1) + max(1) + max(1) + max(1) + max(1)
-;
-
-eval $my_stmt;
-
-eval prepare stmt1 from '$my_stmt';
-execute stmt1;
-execute stmt1;
-
-deallocate prepare stmt1;
-
---echo End of 5.1 tests
-
---echo #
---echo # mdev-5091: Asseirtion failure for UNION with ORDER BY
---echo # in one of selects
---echo #
-
- CREATE TABLE t1 (i int, c char(1)) ENGINE=MyISAM;
- INSERT INTO t1 VALUES (6,'b');
-
- CREATE VIEW v1 AS SELECT * FROM t1;
-
- ( SELECT i FROM v1 GROUP BY i ORDER BY CONCAT( c, c ) LIMIT 1 )
- UNION
- ( SELECT i FROM t1 );
-
- DROP VIEW v1;
- DROP TABLE t1;
-
---echo #
---echo # mdev-5382: UNION with ORDER BY in subselect
---echo #
-
- CREATE TABLE t1 (a int DEFAULT NULL);
- INSERT INTO t1 VALUES (2), (4);
- CREATE TABLE t2 (b int DEFAULT NULL);
- INSERT INTO t2 VALUES (1), (3);
-
- SELECT c1 FROM (SELECT (SELECT a FROM t1 WHERE t1.a <= t2.b
- UNION ALL
- SELECT a FROM t1 WHERE t1.a+3<= t2.b
- ORDER BY a DESC) AS c1 FROM t2) t3;
-
- DROP TABLE t1,t2;
-
- --echo End of 5.3 tests
-
---echo #
---echo # Bug#57986 ORDER BY clause is not used after a UNION,
---echo # if embedded in a SELECT
---echo #
-
-CREATE TABLE t1 (c1 VARCHAR(10) NOT NULL, c2 INT NOT NULL);
-CREATE TABLE t2 (c1 VARCHAR(10) NOT NULL, c2 INT NOT NULL);
-
-
-INSERT INTO t1 (c1, c2) VALUES ('t1a', 1), ('t1a', 2), ('t1a', 3), ('t1b', 2), ('t1b', 1);
-INSERT INTO t2 (c1, c2) VALUES ('t2a', 1), ('t2a', 2), ('t2a', 3), ('t2b', 2), ('t2b', 1);
-
-SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY c2, c1;
-SELECT * FROM t1 UNION (SELECT * FROM t2) ORDER BY c2, c1;
-SELECT * FROM t1 UNION (SELECT * FROM t2 ORDER BY c2, c1);
-
-SELECT c1, c2 FROM (
- SELECT c1, c2 FROM t1
- UNION
- (SELECT c1, c2 FROM t2)
- ORDER BY c2, c1
-) AS res;
-
-SELECT c1, c2 FROM (
- SELECT c1, c2 FROM t1
- UNION
- (SELECT c1, c2 FROM t2)
- ORDER BY c2 DESC, c1 LIMIT 1
-) AS res;
-
-SELECT c1, c2 FROM (
- SELECT c1, c2 FROM t1
- UNION
- (SELECT c1, c2 FROM t2 ORDER BY c2 DESC, c1 LIMIT 1)
-) AS res;
-
-SELECT c1, c2 FROM (
- SELECT c1, c2 FROM t1
- UNION
- SELECT c1, c2 FROM t2
- ORDER BY c2 DESC, c1 DESC LIMIT 1
-) AS res;
-
-SELECT c1, c2 FROM (
- (
- (SELECT c1, c2 FROM t1)
- UNION
- (SELECT c1, c2 FROM t2)
- )
- ORDER BY c2 DESC, c1 ASC LIMIT 1
-) AS res;
-
-DROP TABLE t1, t2;
-
---echo #
---echo # Bug #58970 Problem Subquery (without referencing a table)
---echo # and Order By
---echo #
-
-SELECT(SELECT 0 AS a UNION SELECT 1 AS a ORDER BY a ASC LIMIT 1) AS dev;
-SELECT(SELECT 0 AS a UNION SELECT 1 AS a ORDER BY a DESC LIMIT 1) AS dev;
-SELECT(SELECT 0 AS a FROM dual UNION SELECT 1 AS a FROM dual ORDER BY a ASC LIMIT 1) AS dev;
-SELECT(SELECT 0 AS a FROM dual UNION SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev;
-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 # Bug #17059925 : UNIONS COMPUTES ROWS_EXAMINED INCORRECTLY
---echo #
-
-## Save current state of slow log variables
-SET @old_slow_query_log= @@global.slow_query_log;
-SET @old_log_output= @@global.log_output;
-SET @old_long_query_time= @@long_query_time;
-SET GLOBAL log_output= "TABLE";
-SET GLOBAL slow_query_log= ON;
-SET SESSION long_query_time= 0;
-
-CREATE TABLE t17059925 (a INT);
-CREATE TABLE t2 (b INT);
-CREATE TABLE t3 (c INT);
-INSERT INTO t17059925 VALUES (1), (2), (3);
-INSERT INTO t2 VALUES (4), (5), (6);
-INSERT INTO t3 VALUES (7), (8), (9);
-TRUNCATE table mysql.slow_log;
---sorted_result
-SELECT * FROM t17059925 UNION SELECT * FROM t2 UNION SELECT * FROM t3;
-SELECT sql_text, rows_examined FROM mysql.slow_log WHERE sql_text LIKE '%SELECT%t17059925%';
-DROP TABLE t17059925, t2, t3;
-
-## Reset to initial values
-SET @@long_query_time= @old_long_query_time;
-SET @@global.log_output= @old_log_output;
-SET @@global.slow_query_log= @old_slow_query_log;
-
---echo #
---echo # lp: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;
-
-#
-# Bug #18167356: EXPLAIN W/ EXISTS(SELECT* UNION SELECT*)
-# WHERE ONE OF SELECT* IS DISTINCT FAILS.
-#
-create table t1 (a int);
-insert t1 values (1),(2),(3),(1);
-explain select 1 from dual where exists (select max(a) from t1 group by a union select a+2 from t1);
-drop table t1;
-
---echo #
---echo # MDEV-6868:MariaDB server crash ( select with union and order by
---echo # with subquery )
---echo #
-
-CREATE TABLE t1 ( id INTEGER, sample_name1 VARCHAR(100), sample_name2 VARCHAR(100), PRIMARY KEY(id) );
-
-INSERT INTO t1 ( id, sample_name1, sample_name2 ) VALUES ( 1, 'aaaa', 'bbbb' ), ( 2, 'cccc', 'dddd' );
-
-(
- SELECT sample_name1 AS testname FROM t1
-)
-UNION
-(
- SELECT sample_name2 AS testname FROM t1 C ORDER BY (SELECT T.sample_name1 FROM t1 T WHERE T.id = C.id)
-)
-;
-
-drop table t1;
-
-
---echo #
---echo # MDEV-10172: UNION query returns incorrect rows outside
---echo # conditional evaluation
---echo #
-
-create table t1 (d datetime not null primary key);
-insert into t1(d) values ('2016-06-01'),('2016-06-02'),('2016-06-03'),('2016-06-04');
-select * from
-(
- select * from t1 where d between '2016-06-02' and '2016-06-05'
- union
- (select * from t1 where d < '2016-06-05' order by d desc limit 1)
-) onlyJun2toJun4
-order by d;
-drop table t1;
-
---echo End of 5.0 tests
-
-#
-# Bug #24595639: INCORRECT BEHAVIOR IN QUERY WITH UNION AND GROUP BY
-#
-create table t1 (a int, b int);
-insert into t1 values (1,1),(2,2),(3,3);
-create table t2 (c varchar(30), d varchar(30));
-insert into t1 values ('1','1'),('2','2'),('4','4');
-create table t3 (e int, f int);
-insert into t3 values (1,1),(2,2),(31,31),(32,32);
-select e,f, (e , f) in (select e,b from t1 union select c,d from t2) as sub from t3;
-select avg(f), (e , f) in (select e,b from t1 union select c,d from t2) as sub from t3 group by sub;
-drop table t1,t2,t3;
-
---echo #
---echo # MDEV-14715 Assertion `!table || (!table->read_set ||
---echo # bitmap_is_set(table->read_set, field_index))'
---echo # failed in Field_num::val_decimal
---echo #
-
-CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM;
-CREATE VIEW v1 AS SELECT * FROM t1;
-INSERT INTO t1 VALUES (1, NULL),(3, 4);
-
-(SELECT a, sum(a) AS f FROM v1 group by a ORDER BY b + sum(a))
-UNION
-(SELECT 2, 2);
-
-(SELECT a, sum(a) AS f FROM v1 group by a ORDER BY b + 1)
-UNION
-(SELECT 2, 2);
-
-SELECT a, b FROM t1
-UNION
-(SELECT a, VAR_POP(a) AS f FROM v1 GROUP BY a ORDER BY b/a );
-
-DROP TABLE t1;
-
---error ER_VIEW_INVALID
-(SELECT a, sum(a) AS f FROM v1 group by a ORDER BY b + 1)
-UNION
-(SELECT 2, 2);
-
-DROP VIEW v1;
-
---error ER_NO_SUCH_TABLE
-(SELECT a, sum(a) AS f FROM v1 group by a ORDER BY b + 1)
-UNION
-(SELECT 2, 2);
-
---echo End of 5.5 tests
-
---echo #
---echo # WL#1763 Avoid creating temporary table in UNION ALL
---echo #
-
-EXPLAIN SELECT 1 UNION ALL SELECT 1 LIMIT 1 OFFSET 1;
-
---echo # Bug #17579498 CHANGES IN DATATYPE OF THE RESULT QUERY IN UNION.
-
-CREATE TABLE t1 (a TIME);
-CREATE TABLE t2 (b DATETIME);
-
-CREATE TABLE t3
-SELECT a FROM t1 UNION ALL SELECT b FROM t2;
-
-SELECT column_name, column_type
-FROM information_schema.columns
-WHERE TABLE_NAME='t3';
-
-DROP TABLE t1, t2, t3;
-
---echo # Bug #17602922 RESULT DIFFERENCES IN UNION QUERIES WITH IN
---echo # (SUBQUERY-UNION ALL)
-
-CREATE TABLE t1 (a VARCHAR(1));
-INSERT INTO t1 VALUES (NULL);
-INSERT INTO t1 VALUES (NULL);
-INSERT INTO t1 VALUES ('j');
-INSERT INTO t1 VALUES ('k');
-INSERT INTO t1 VALUES ('r');
-INSERT INTO t1 VALUES ('r');
-INSERT INTO t1 VALUES ('h');
-
-SELECT a FROM t1 WHERE a IN (SELECT 'r' FROM t1 UNION ALL SELECT 'j');
-
-CREATE TABLE t2
-SELECT a FROM t1 WHERE a IN (SELECT 'r' FROM t1 UNION ALL SELECT 'j');
-
-SELECT * FROM t2;
-
-DROP TABLE t1, t2;
-
-CREATE TABLE t1 (a INT PRIMARY KEY);
-CREATE TABLE t2 (a INT PRIMARY KEY);
-INSERT INTO t2 VALUES (1);
-
-SELECT a, SUM(a) FROM t2 UNION ALL SELECT a, MIN(a) FROM t1 ;
-
-SELECT FOUND_ROWS();
-
-DROP TABLE t1, t2;
-
---echo # Bug #17669551 CRASH/ASSERT AT SELECT_CREATE::PREPARE2 AT
---echo # SQL_INSERT.CC
-
-CREATE TABLE t1 (a INT);
-
---error ER_DUP_FIELDNAME
-CREATE TABLE t2 SELECT a, a FROM t1 UNION ALL SELECT a, a FROM t1;
-
-DROP TABLE t1;
-
---echo # Bug #17694956 RESULT DIFFERENCES IN UNION ALL QUERIES WITH LIMIT
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1);
-
-(SELECT a FROM t1 ORDER BY a LIMIT 0) UNION ALL SELECT a FROM t1;
-
-DROP TABLE t1;
-
---echo # Bug #17708480 FOUND_ROWS() VALUE DO NOT MATCH WITH UNION ALL QUERIES
-
-CREATE TABLE t1 (a INT) ENGINE=MEMORY;
-CREATE TABLE t2 (a INT) ENGINE=MEMORY;
-INSERT INTO t2 VALUES (1);
-
-SELECT COUNT(*) FROM (
-SELECT * FROM t2 UNION ALL SELECT * FROM t1) q;
-SELECT SQL_CALC_FOUND_ROWS * FROM t2 UNION ALL SELECT * FROM t1;
-SELECT FOUND_ROWS();
-
-SELECT COUNT(*) FROM (
-SELECT * FROM t1 UNION ALL SELECT * FROM t2) q;
-SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION ALL SELECT * FROM t2;
-SELECT FOUND_ROWS();
-
-DROP TABLE t1, t2;
-
---echo # End of WL1763 tests
-
---echo #
---echo # Bug mdev-6874: crash with UNION ALL in a subquery
---echo #
-
-CREATE TABLE t1 (a int, b int);
-INSERT INTO t1 VALUES (1,1), (2,8);
-
-SELECT * FROM t1 t1_1 LEFT JOIN t1 t1_2 ON ( t1_2.b = t1_1.a )
- WHERE t1_2.b NOT IN ( SELECT 4 UNION ALL SELECT 5 );
-
-DROP TABLE t1;
-
---echo # Bug mdev-12788: UNION ALL + impossible having for derived
---echo # with IN subquery in WHERE
---echo #
-
-CREATE TABLE t1 (i int) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1);
-
-CREATE TABLE t2 (pk int PRIMARY KEY) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (1),(2);
-
-let $q=
-SELECT 1, 2
-UNION ALL
-SELECT i, COUNT(*) FROM (
- SELECT * FROM t1 WHERE i IN ( SELECT pk FROM t2 )
-) AS sq
-GROUP BY i
-HAVING i = 10;
-
-eval $q;
-eval EXPLAIN EXTENDED $q;
-
-DROP TABLE t1,t2;
-
-
---echo #
---echo # Start of 10.3 tests
---echo #
-
---echo #
---echo # MDEV-12619 UNION creates excessive integer column types for integer literals
---echo #
-
-CREATE TABLE t1 AS SELECT 1;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE OR REPLACE TABLE t1 AS SELECT 1 UNION SELECT 1;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE OR REPLACE TABLE t1 AS SELECT * FROM (SELECT 1 UNION SELECT 1) AS t0;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-9495 Wrong field type for a UNION of a signed and an unsigned INT expression
---echo #
-CREATE TABLE t1 (a INT, b INT UNSIGNED);
-INSERT INTO t1 VALUES (0x7FFFFFFF,0xFFFFFFFF);
-CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1;
-SHOW CREATE TABLE t2;
-SELECT * FROM t2 ORDER BY a;
-DROP TABLE t2;
-CREATE TABLE t2 AS SELECT COALESCE(a,b), COALESCE(b,a) FROM t1;
-SHOW CREATE TABLE t2;
-SELECT * FROM t2;
-DROP TABLE t2;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-9497 UNION and COALESCE produce different field types for DECIMAL+INT
---echo #
-CREATE TABLE t1 AS SELECT COALESCE(10.1,CAST(10 AS UNSIGNED)) AS a;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-CREATE OR REPLACE TABLE t1 AS SELECT 10.1 AS a UNION SELECT CAST(10 AS UNSIGNED);
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-12594 UNION between fixed length double columns does not always preserve scale
---echo #
-CREATE TABLE t1 (a FLOAT(20,4), b FLOAT(20,3), c FLOAT(20,4));
-INSERT INTO t1 VALUES (1111,2222,3333);
-
-CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT a FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE OR REPLACE TABLE t2 SELECT a FROM t1 UNION SELECT c FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE OR REPLACE TABLE t2 SELECT b FROM t1 UNION SELECT b FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE OR REPLACE TABLE t2 SELECT c FROM t1 UNION SELECT c FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE OR REPLACE TABLE t2 SELECT c FROM t1 UNION SELECT a FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE OR REPLACE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-CREATE OR REPLACE TABLE t2 AS SELECT b FROM t1 UNION SELECT a FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-
-DROP TABLE t1;
-
---echo # Corner case
-CREATE TABLE t1 (a FLOAT(255,4), b FLOAT(255,3));
-INSERT INTO t1 VALUES (1111,2222);
-CREATE OR REPLACE TABLE t2 AS SELECT b FROM t1 UNION SELECT a FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-12595 UNION converts INT to BIGINT
---echo #
-CREATE TABLE t1 AS SELECT
- 1,
- -1,
- COALESCE(1,1),
- COALESCE(-1,-1),
- COALESCE(1,-1),
- COALESCE(-1,1);
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-CREATE TABLE t1 AS SELECT 1 AS c1,1 AS c2,-1 AS c3,-1 AS c4 UNION SELECT 1,-1,1,-1;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-12599 UNION is not symmetric when mixing INT and CHAR
---echo #
-
-CREATE OR REPLACE TABLE t1 AS SELECT 1 AS c1, 'a' AS c2 UNION SELECT 'a', 1;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE OR REPLACE TABLE t1 AS SELECT 11112222 AS c1, 'a' AS c2 UNION SELECT 'a', 11112222;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-
-CREATE OR REPLACE TABLE t1 AS SELECT 111122223333 AS c1, 'a' AS c2 UNION SELECT 'a', 111122223333;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE OR REPLACE TABLE t1 AS SELECT 1111222233334444 AS c1, 'a' AS c2 UNION SELECT 'a', 1111222233334444;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a INT(3), b VARCHAR(1));
-CREATE TABLE t2 AS SELECT a,b FROM t1 UNION SELECT b,a FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a BIGINT(3), b VARCHAR(1));
-CREATE TABLE t2 AS SELECT a,b FROM t1 UNION SELECT b,a FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a BIGINT(12), b VARCHAR(1));
-CREATE TABLE t2 AS SELECT a,b FROM t1 UNION SELECT b,a FROM t1;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
-DROP TABLE t1;
-
-
---echo #
---echo # End of 10.3 tests
---echo #
diff --git a/mysql-test/t/union_crash-714.test b/mysql-test/t/union_crash-714.test
deleted file mode 100644
index 6c31a2202cb..00000000000
--- a/mysql-test/t/union_crash-714.test
+++ /dev/null
@@ -1,9 +0,0 @@
-#
-# MDEV-714 LP:1020645 - crash (sig 11) with union query
-#
---source include/have_debug.inc
-create table t1 (i tinyint);
-set debug_dbug='+d,bug11747970_raise_error';
---error ER_QUERY_INTERRUPTED
-insert into t1 (i) select i from t1 union select i from t1;
-drop table t1;
diff --git a/mysql-test/t/uniques_crash-7912.test b/mysql-test/t/uniques_crash-7912.test
deleted file mode 100644
index 8dc82f8f540..00000000000
--- a/mysql-test/t/uniques_crash-7912.test
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# MDEV-7912
-#
-# multitable delete with wrongly set sort_buffer_size crashes in merge_buffers
-
---source include/have_innodb.inc
---source include/have_debug.inc
---source include/windows.inc
-
-call mtr.add_suppression("Out of memory");
-
-set sql_mode="";
---disable_warnings
-drop table if exists t1,t2;
-create table `t1` (`a` datetime not null) engine=InnoDB;
-create table `t2` (`a` int not null) engine=innodb;
-replace into t1 values (),();
-insert into t2 values(0);
-set session sort_buffer_size = 1024*1024*1024*1024;
-#Either fail with EE_OUTOFMEMORY, or succeed
---error 0 , 5
-delete d2 from t2 as d1, t1 as d2 where d1.a <=> d2.a;
---enable_warnings
-
-drop table t2;
-drop table t1;
diff --git a/mysql-test/t/unsafe_binlog_innodb-master.opt b/mysql-test/t/unsafe_binlog_innodb-master.opt
deleted file mode 100644
index 0d13f0834a5..00000000000
--- a/mysql-test/t/unsafe_binlog_innodb-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-innodb_locks_unsafe_for_binlog --loose-innodb_lock_wait_timeout=1
diff --git a/mysql-test/t/unsafe_binlog_innodb.test b/mysql-test/t/unsafe_binlog_innodb.test
deleted file mode 100644
index a0516749451..00000000000
--- a/mysql-test/t/unsafe_binlog_innodb.test
+++ /dev/null
@@ -1,16 +0,0 @@
-# t/unsafe_binlog_innodb.test
-#
-# Note that this test uses at least in case of InnoDB options
-# innodb_locks_unsafe_for_binlog = true
-# innodb_lock_timeout = 5
-#
-# Last update:
-# 2006-08-02 ML test refactored
-# old name was innodb_unsafe_binlog.test
-# main code went into include/unsafe_binlog.inc
-#
-
---source include/have_innodb.inc
-let $engine_type= InnoDB;
-
---source include/unsafe_binlog.inc
diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test
deleted file mode 100644
index e5ef0b11127..00000000000
--- a/mysql-test/t/update.test
+++ /dev/null
@@ -1,656 +0,0 @@
-#
-# test of updating of keys
-#
-
--- source include/have_innodb.inc
-
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-create table t1 (a int auto_increment , primary key (a));
-insert into t1 values (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
-update t1 set a=a+10 where a > 34;
-update t1 set a=a+100 where a > 0;
-
-# Some strange updates to test some otherwise unused code
-update t1 set a=a+100 where a=1 and a=2;
---error 1054
-update t1 set a=b+100 where a=1 and a=2;
---error 1054
-update t1 set a=b+100 where c=1 and a=2;
---error 1054
-update t1 set d=a+100 where a=1;
-select * from t1;
-drop table t1;
-
-CREATE TABLE t1
- (
- place_id int (10) unsigned NOT NULL,
- shows int(10) unsigned DEFAULT '0' NOT NULL,
- ishows int(10) unsigned DEFAULT '0' NOT NULL,
- ushows int(10) unsigned DEFAULT '0' NOT NULL,
- clicks int(10) unsigned DEFAULT '0' NOT NULL,
- iclicks int(10) unsigned DEFAULT '0' NOT NULL,
- uclicks int(10) unsigned DEFAULT '0' NOT NULL,
- ts timestamp,
- PRIMARY KEY (place_id,ts)
- );
-
-INSERT INTO t1 (place_id,shows,ishows,ushows,clicks,iclicks,uclicks,ts)
-VALUES (1,0,0,0,0,0,0,20000928174434);
-UPDATE t1 SET shows=shows+1,ishows=ishows+1,ushows=ushows+1,clicks=clicks+1,iclicks=iclicks+1,uclicks=uclicks+1 WHERE place_id=1 AND ts>="2000-09-28 00:00:00";
-select place_id,shows from t1;
-drop table t1;
-
-#
-# Test bug with update reported by Jan Legenhausen
-#
-
-CREATE TABLE t1 (
- lfdnr int(10) unsigned NOT NULL default '0',
- ticket int(10) unsigned NOT NULL default '0',
- client varchar(255) NOT NULL default '',
- replyto varchar(255) NOT NULL default '',
- subject varchar(100) NOT NULL default '',
- timestamp int(10) unsigned NOT NULL default '0',
- tstamp timestamp NOT NULL,
- status int(3) NOT NULL default '0',
- type varchar(15) NOT NULL default '',
- assignment int(10) unsigned NOT NULL default '0',
- fupcount int(4) unsigned NOT NULL default '0',
- parent int(10) unsigned NOT NULL default '0',
- activity int(10) unsigned NOT NULL default '0',
- priority tinyint(1) unsigned NOT NULL default '1',
- cc varchar(255) NOT NULL default '',
- bcc varchar(255) NOT NULL default '',
- body text NOT NULL,
- comment text,
- header text,
- PRIMARY KEY (lfdnr),
- KEY k1 (timestamp),
- KEY k2 (type),
- KEY k3 (parent),
- KEY k4 (assignment),
- KEY ticket (ticket)
-) ENGINE=MyISAM;
-
-INSERT INTO t1 VALUES (773,773,'','','',980257344,20010318180652,0,'Open',10,0,0,0,1,'','','','','');
-
-alter table t1 change lfdnr lfdnr int(10) unsigned not null auto_increment;
-update t1 set status=1 where type='Open';
-select status from t1;
-drop table t1;
-
-#
-# Test of ORDER BY
-#
-
-create table t1 (a int not null, b int not null, key (a));
-insert into t1 values (1,1),(1,2),(1,3),(3,1),(3,2),(3,3),(3,1),(3,2),(3,3),(2,1),(2,2),(2,3);
-SET @tmp=0;
-update t1 set b=(@tmp:=@tmp+1) order by a;
-update t1 set b=99 where a=1 order by b asc limit 1;
-select * from t1 order by a,b;
-update t1 set b=100 where a=1 order by b desc limit 2;
-update t1 set a=a+10+b where a=1 order by b;
-select * from t1 order by a,b;
-create table t2 (a int not null, b int not null);
-insert into t2 values (1,1),(1,2),(1,3);
-update t1 set b=(select distinct 1 from (select * from t2) a);
-drop table t1,t2;
-
-#
-# Test with limit (Bug #393)
-#
-
-CREATE TABLE t1 (
- `id_param` smallint(3) unsigned NOT NULL default '0',
- `nom_option` char(40) NOT NULL default '',
- `valid` tinyint(1) NOT NULL default '0',
- KEY `id_param` (`id_param`,`nom_option`)
- ) ENGINE=MyISAM;
-
-INSERT INTO t1 (id_param,nom_option,valid) VALUES (185,'600x1200',1);
-
-UPDATE t1 SET nom_option='test' WHERE id_param=185 AND nom_option='600x1200' AND valid=1 LIMIT 1;
-select * from t1;
-drop table t1;
-
-#
-# Multi table update test from bugs
-#
-
-create table t1 (F1 VARCHAR(30), F2 VARCHAR(30), F3 VARCHAR(30), cnt int, groupid int, KEY groupid_index (groupid));
-
-insert into t1 (F1,F2,F3,cnt,groupid) values ('0','0','0',1,6),
-('0','1','2',1,5), ('0','2','0',1,3), ('1','0','1',1,2),
-('1','2','1',1,1), ('1','2','2',1,1), ('2','0','1',2,4),
-('2','2','0',1,7);
-delete from m1 using t1 m1,t1 m2 where m1.groupid=m2.groupid and (m1.cnt < m2.cnt or m1.cnt=m2.cnt and m1.F3>m2.F3);
-select * from t1;
-drop table t1;
-
-#
-# Bug#5553 - Multi table UPDATE IGNORE fails on duplicate keys
-#
-
-CREATE TABLE t1 (
- `colA` int(10) unsigned NOT NULL auto_increment,
- `colB` int(11) NOT NULL default '0',
- PRIMARY KEY (`colA`)
-);
-INSERT INTO t1 VALUES (4433,5424);
-CREATE TABLE t2 (
- `colC` int(10) unsigned NOT NULL default '0',
- `colA` int(10) unsigned NOT NULL default '0',
- `colD` int(10) unsigned NOT NULL default '0',
- `colE` int(10) unsigned NOT NULL default '0',
- `colF` int(10) unsigned NOT NULL default '0',
- PRIMARY KEY (`colC`,`colA`,`colD`,`colE`)
-);
-INSERT INTO t2 VALUES (3,4433,10005,495,500);
-INSERT INTO t2 VALUES (3,4433,10005,496,500);
-INSERT INTO t2 VALUES (3,4433,10009,494,500);
-INSERT INTO t2 VALUES (3,4433,10011,494,500);
-INSERT INTO t2 VALUES (3,4433,10005,497,500);
-INSERT INTO t2 VALUES (3,4433,10013,489,500);
-INSERT INTO t2 VALUES (3,4433,10005,494,500);
-INSERT INTO t2 VALUES (3,4433,10005,493,500);
-INSERT INTO t2 VALUES (3,4433,10005,492,500);
-UPDATE IGNORE t2,t1 set t2.colE = t2.colE + 1,colF=0 WHERE t1.colA = t2.colA AND (t1.colB & 4096) > 0 AND (colE + 1) < colF;
-SELECT * FROM t2;
-DROP TABLE t1;
-DROP TABLE t2;
-
-#
-# Bug #6054
-#
-create table t1 (c1 int, c2 char(6), c3 int);
-create table t2 (c1 int, c2 char(6));
-insert into t1 values (1, "t1c2-1", 10), (2, "t1c2-2", 20);
-update t1 left join t2 on t1.c1 = t2.c1 set t2.c2 = "t2c2-1";
-update t1 left join t2 on t1.c1 = t2.c1 set t2.c2 = "t2c2-1" where t1.c3 = 10;
-drop table t1, t2;
-
-#
-# Bug #8057
-#
-create table t1 (id int not null auto_increment primary key, id_str varchar(32));
-insert into t1 (id_str) values ("test");
-update t1 set id_str = concat(id_str, id) where id = last_insert_id();
-select * from t1;
-drop table t1;
-
-#
-# Bug #8942: a problem with update and partial key part
-#
-
-create table t1 (a int, b char(255), key(a, b(20)));
-insert into t1 values (0, '1');
-update t1 set b = b + 1 where a = 0;
-select * from t1;
-drop table t1;
-
-# BUG#9103 "Erroneous data truncation warnings on multi-table updates"
-create table t1 (a int, b varchar(10), key b(b(5))) engine=myisam;
-create table t2 (a int, b varchar(10)) engine=myisam;
-insert into t1 values ( 1, 'abcd1e');
-insert into t1 values ( 2, 'abcd2e');
-insert into t2 values ( 1, 'abcd1e');
-insert into t2 values ( 2, 'abcd2e');
-analyze table t1,t2;
-update t1, t2 set t1.a = t2.a where t2.b = t1.b;
-show warnings;
-drop table t1, t2;
-
-#
-# Bug #11868 Update with subquery with ref built with a key from the updated
-# table crashes server
-#
-create table t1(f1 int, f2 int);
-create table t2(f3 int, f4 int);
-create index idx on t2(f3);
-insert into t1 values(1,0),(2,0);
-insert into t2 values(1,1),(2,2);
-UPDATE t1 SET t1.f2=(SELECT MAX(t2.f4) FROM t2 WHERE t2.f3=t1.f1);
-select * from t1;
-drop table t1,t2;
-
-#
-# Bug #13180 sometimes server accepts sum func in update/delete where condition
-#
-create table t1(f1 int);
-select DATABASE();
---error 1111
-update t1 set f1=1 where count(*)=1;
-select DATABASE();
---error 1111
-delete from t1 where count(*)=1;
-drop table t1;
-
-# BUG#12915: Optimize "DELETE|UPDATE ... ORDER BY ... LIMIT n" to use an index
-create table t1 ( a int, b int default 0, index (a) );
-insert into t1 (a) values (0),(0),(0),(0),(0),(0),(0),(0);
-
-flush status;
-select a from t1 order by a limit 1;
-show status like 'handler_read%';
-
-flush status;
-update t1 set a=9999 order by a limit 1;
-update t1 set b=9999 order by a limit 1;
-show status like 'handler_read%';
-
-flush status;
-delete from t1 order by a limit 1;
-show status like 'handler_read%';
-
-flush status;
-delete from t1 order by a desc limit 1;
-show status like 'handler_read%';
-
-alter table t1 disable keys;
-
-flush status;
-delete from t1 order by a limit 1;
-show status like 'handler_read%';
-
-select * from t1;
-update t1 set a=a+10,b=1 order by a limit 3;
-update t1 set a=a+11,b=2 order by a limit 3;
-update t1 set a=a+12,b=3 order by a limit 3;
-select * from t1 order by a;
-
-drop table t1;
-
-#
-# Bug#14186 select datefield is null not updated
-#
-create table t1 (f1 date not null);
-insert into t1 values('2000-01-01'),('0000-00-00');
-update t1 set f1='2002-02-02' where f1 is null;
-select * from t1;
-drop table t1;
-
-#
-# Bug#15028 Multitable update returns different numbers of matched rows
-# depending on table order
-create table t1 (f1 int);
-create table t2 (f2 int);
-insert into t1 values(1),(2);
-insert into t2 values(1),(1);
---enable_info
-update t1,t2 set f1=3,f2=3 where f1=f2 and f1=1;
---disable_info
-update t2 set f2=1;
-update t1 set f1=1 where f1=3;
---enable_info
-update t2,t1 set f1=3,f2=3 where f1=f2 and f1=1;
---disable_info
-drop table t1,t2;
-
-
-# BUG#15935
-create table t1 (a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t2 (a int, filler1 char(200), filler2 char(200), key(a));
-insert into t2 select A.a + 10*B.a, 'filler','filler' from t1 A, t1 B;
-flush status;
-update t2 set a=3 where a=2;
-show status like 'handler_read%';
-drop table t1, t2;
-
-#
-# Bug #16510 Updating field named like '*name' caused server crash
-#
-create table t1(f1 int, `*f2` int);
-insert into t1 values (1,1);
-update t1 set `*f2`=1;
-drop table t1;
-
-#
-# Bug#25126: Wrongly resolved field leads to a crash
-#
-create table t1(f1 int);
---error 1054
-update t1 set f2=1 order by f2;
-drop table t1;
-# End of 4.1 tests
-
-#
-# Bug #24035: performance degradation with condition int_field=big_decimal
-#
-
-CREATE TABLE t1 (
- request_id int unsigned NOT NULL auto_increment,
- user_id varchar(12) default NULL,
- time_stamp datetime NOT NULL default '0000-00-00 00:00:00',
- ip_address varchar(15) default NULL,
- PRIMARY KEY (request_id),
- KEY user_id_2 (user_id,time_stamp)
-);
-
-INSERT INTO t1 (user_id) VALUES ('user1');
-INSERT INTO t1(user_id) SELECT user_id FROM t1;
-INSERT INTO t1(user_id) SELECT user_id FROM t1;
-INSERT INTO t1(user_id) SELECT user_id FROM t1;
-INSERT INTO t1(user_id) SELECT user_id FROM t1;
-INSERT INTO t1(user_id) SELECT user_id FROM t1;
-INSERT INTO t1(user_id) SELECT user_id FROM t1;
-INSERT INTO t1(user_id) SELECT user_id FROM t1;
-INSERT INTO t1(user_id) SELECT user_id FROM t1;
-
-flush status;
-SELECT user_id FROM t1 WHERE request_id=9999999999999;
-show status like '%Handler_read%';
-SELECT user_id FROM t1 WHERE request_id=999999999999999999999999999999;
-show status like '%Handler_read%';
-UPDATE t1 SET user_id=null WHERE request_id=9999999999999;
-show status like '%Handler_read%';
-UPDATE t1 SET user_id=null WHERE request_id=999999999999999999999999999999;
-show status like '%Handler_read%';
-
-DROP TABLE t1;
-
-#
-# Bug #24010: INSERT INTO ... SELECT fails on unique constraint with data it
-# doesn't select
-#
-CREATE TABLE t1 (
-
- a INT(11),
- quux decimal( 31, 30 ),
-
- UNIQUE KEY bar (a),
- KEY quux (quux)
-);
-
-INSERT INTO
- t1 ( a, quux )
-VALUES
- ( 1, 1 ),
- ( 2, 0.1 );
-
-INSERT INTO t1( a )
- SELECT @newA := 1 + a FROM t1 WHERE quux <= 0.1;
-
-SELECT * FROM t1;
-
-DROP TABLE t1;
-
-#
-# Bug #22364: Inconsistent "matched rows" when executing UPDATE
-#
-
-connect (con1,localhost,root,,test);
-connection con1;
-
-set tmp_table_size=1024;
-
-# Create the test tables
-create table t1 (id int, a int, key idx(a));
-create table t2 (id int unsigned not null auto_increment primary key, a int);
-insert into t2(a) values(1),(2),(3),(4),(5),(6),(7),(8);
-insert into t2(a) select a from t2;
-insert into t2(a) select a from t2;
-insert into t2(a) select a from t2;
-update t2 set a=id;
-insert into t1 select * from t2;
-
-# Check that the number of matched rows is correct when the temporary
-# table is small enough to not be converted to MyISAM
-select count(*) from t1 join t2 on (t1.a=t2.a);
---enable_info
-update t1 join t2 on (t1.a=t2.a) set t1.id=t2.id;
---disable_info
-
-# Increase table sizes
-insert into t2(a) select a from t2;
-update t2 set a=id;
-truncate t1;
-insert into t1 select * from t2;
-
-# Check that the number of matched rows is correct when the temporary
-# table has to be converted to MyISAM
-select count(*) from t1 join t2 on (t1.a=t2.a);
---enable_info
-update t1 join t2 on (t1.a=t2.a) set t1.id=t2.id;
---disable_info
-
-# Check that the number of matched rows is correct when there are duplicate
-# key errors
-update t1 set a=1;
-update t2 set a=1;
-select count(*) from t1 join t2 on (t1.a=t2.a);
---enable_info
-update t1 join t2 on (t1.a=t2.a) set t1.id=t2.id;
---disable_info
-
-drop table t1,t2;
-
-connection default;
-disconnect con1;
-
-#
-# Bug #40745: Error during WHERE clause calculation in UPDATE
-# leads to an assertion failure
-#
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP FUNCTION IF EXISTS f1;
---enable_warnings
-
-CREATE FUNCTION f1() RETURNS INT RETURN f1();
-CREATE TABLE t1 (i INT);
-INSERT INTO t1 VALUES (1);
-
---error ER_SP_NO_RECURSION
-UPDATE t1 SET i = 3 WHERE f1();
---error ER_SP_NO_RECURSION
-UPDATE t1 SET i = f1();
-
-DROP TABLE t1;
-DROP FUNCTION f1;
-
---echo End of 5.0 tests
-
---echo #
---echo # Bug #47919 assert in open_table during ALTER temporary table
---echo #
-
-CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT, PRIMARY KEY (f1));
-CREATE TEMPORARY TABLE t2 LIKE t1;
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (1);
-
-ALTER TABLE t2 COMMENT = 'ABC';
-UPDATE t2, t1 SET t2.f1 = 2, t1.f1 = 9;
-ALTER TABLE t2 COMMENT = 'DEF';
-
-DROP TABLE t1, t2;
-
---echo #
---echo # Bug#50545: Single table UPDATE IGNORE crashes on join view in
---echo # sql_safe_updates mode.
---echo #
-CREATE TABLE t1 ( a INT, KEY( a ) );
-INSERT INTO t1 VALUES (0), (1);
-CREATE VIEW v1 AS SELECT t11.a, t12.a AS b FROM t1 t11, t1 t12;
-SET SESSION sql_safe_updates = 1;
-
---error ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
-UPDATE IGNORE v1 SET a = 1;
-
-SET SESSION sql_safe_updates = DEFAULT;
-DROP TABLE t1;
-DROP VIEW v1;
-
---echo #
---echo # Bug#54734 assert in Diagnostics_area::set_ok_status
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1, not_exists;
-DROP FUNCTION IF EXISTS f1;
-DROP VIEW IF EXISTS v1;
---enable_warnings
-
-CREATE TABLE t1 (PRIMARY KEY(pk)) AS SELECT 1 AS pk;
-CREATE FUNCTION f1() RETURNS INTEGER RETURN (SELECT 1 FROM not_exists);
-CREATE VIEW v1 AS SELECT pk FROM t1 WHERE f1() = 13;
---error ER_VIEW_INVALID
-UPDATE v1 SET pk = 7 WHERE pk > 0;
-
-DROP VIEW v1;
-DROP FUNCTION f1;
-DROP TABLE t1;
-
---echo # Bug #21143080: UPDATE ON VARCHAR AND TEXT COLUMNS PRODUCE INCORRECT
---echo # RESULTS
-
-CREATE TABLE t1 (a VARCHAR(50), b TEXT, c CHAR(50)) ENGINE=INNODB;
-
-INSERT INTO t1 (a, b, c) VALUES ('start trail', '', 'even longer string');
-UPDATE t1 SET b = a, a = 'inject';
-SELECT a, b FROM t1;
-UPDATE t1 SET b = c, c = 'inject';
-SELECT c, b FROM t1;
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-3948 Assertion `records_are_comparable(table)' fails in compare_record(const TABLE*) on UPDATE with simple AND condition, index_merge+index_merge_intersection, InnoDB
---echo #
---echo # Verify that UPDATE does the same number of handler_update
---echo # operations, no matter if there is ORDER BY or not.
---echo #
-
-CREATE TABLE t1 (i INT) ENGINE=INNODB;
-INSERT INTO t1 VALUES (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);
-CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), d CHAR(2),
- INDEX idx (a,b(1),c)) ENGINE=INNODB;
-INSERT INTO t2 SELECT i, i, i, i FROM t1;
-FLUSH STATUS; # FLUSH is autocommit, so we put it outside of transaction
-START TRANSACTION;
-UPDATE t2 SET d = 10 WHERE b = 10 LIMIT 5;
-SHOW STATUS LIKE 'HANDLER_UPDATE';
-ROLLBACK;
-FLUSH STATUS;
-START TRANSACTION;
-UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5;
-SHOW STATUS LIKE 'HANDLER_UPDATE';
-ROLLBACK;
-
---echo Same test with a different UPDATE.
-
-ALTER TABLE t2 DROP INDEX idx, ADD INDEX idx2 (a, b);
-FLUSH STATUS;
-START TRANSACTION;
-UPDATE t2 SET c = 10 LIMIT 5;
-SHOW STATUS LIKE 'HANDLER_UPDATE';
-ROLLBACK;
-FLUSH STATUS;
-START TRANSACTION;
-UPDATE t2 SET c = 10 ORDER BY a, b DESC LIMIT 5;
-SHOW STATUS LIKE 'HANDLER_UPDATE';
-ROLLBACK;
-DROP TABLE t1, t2;
-
---echo #
---echo # MDEV-8938: Server Crash on Update with joins
---echo #
-
-CREATE TABLE `t1` (
- `name` varchar(255) NOT NULL,
- `value` varchar(4095) DEFAULT NULL,
- PRIMARY KEY (`name`)
-);
-
-UPDATE `t1` SET value = CONCAT("*.",(SELECT `temptable`.`value` FROM (SELECT * FROM `t1` WHERE `name`="consoleproxy.url.domain") AS `temptable` WHERE `temptable`.`name`="consoleproxy.url.domain")) WHERE `name`="consoleproxy.url.domain";
-
-drop table t1;
-
-CREATE TABLE `t1` (
- `name` varchar(255) NOT NULL,
- `value` varchar(4095) DEFAULT NULL,
- PRIMARY KEY (`name`)
-);
-
-create table t2 (
- `name` varchar(255) NOT NULL,
- `value` varchar(4095) DEFAULT NULL,
- PRIMARY KEY (`name`)
-);
-
-UPDATE t1
-SET value = (SELECT value FROM t2 WHERE `name`= t1.name)
-WHERE value is null ;
-
-drop table t1,t2;
-
---echo #
---echo #MDEV-8701: Crash on derived query
---echo #
-
-CREATE TABLE t1 (
- data_exit_entry_id int(11) NOT NULL,
- data_entry_id int(11) NOT NULL,
- data_entry_exit_id int(11) NOT NULL,
- data_exit_entry_quantity double NOT NULL
-) DEFAULT CHARSET=utf8;
-
-CREATE TABLE t2 (
- data_entry_id int(11) NOT NULL,
- data_entry_cost double NOT NULL,
- data_entry_quantity double NOT NULL
-) DEFAULT CHARSET=utf8;
-
-create algorithm=temptable view v1 as SELECT data_entry_exit_id, data_exit_entry_quantity, data_entry_cost
- FROM t1 INNER JOIN t2 as dt ON dt.data_entry_id = t1.data_entry_id;
-
-UPDATE t2
-SET data_entry_cost
- = ( ( SELECT SUM(data_exit_entry_quantity * data_entry_cost)
- FROM
- v1 AS query
- WHERE data_entry_exit_id = t2.data_entry_id
- )
- );
-
-UPDATE t2
-SET data_entry_cost
- = ( ( SELECT SUM(data_exit_entry_quantity * data_entry_cost)
- FROM
- ( SELECT data_entry_exit_id, data_exit_entry_quantity, data_entry_cost
- FROM t1 INNER JOIN t2 as dt ON dt.data_entry_id = t1.data_entry_id) AS query
- WHERE data_entry_exit_id = t2.data_entry_id
- )
- );
-
-drop view v1;
-drop table t1, t2;
---echo #
---echo # MDEV-4410: update does not want to use a covering index, but select uses it.
---echo #
-create table t2(a int);
-insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1 (key1 int, col1 int, key(key1));
-insert into t1
-select A.a + 10 * B.a + 100 * C.a, 1234 from t2 A, t2 B, t2 C;
-
---echo # This must not have "Using filesort":
-explain
-update t1 set key1=key1+1 where key1 between 10 and 110 order by key1 limit 2;
-
-flush status;
-update t1 set key1=key1+1 where key1 between 10 and 110 order by key1 limit 2;
-# Handler_read_next should be 1 (due to LIMIT), not 100:
-show status like 'Handler_read%';
-
-drop table t1, t2;
-
---echo # End of MariaDB 10.0 tests
diff --git a/mysql-test/t/update_ignore_216.test b/mysql-test/t/update_ignore_216.test
deleted file mode 100644
index bae3930e1a7..00000000000
--- a/mysql-test/t/update_ignore_216.test
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# MDEV-216 lp:976104 - Assertion `0' failed in my_message_sql on UPDATE IGNORE, or unknown error on release build
-#
-
-CREATE TABLE t1 ( a INT, b CHAR(3) );
-INSERT INTO t1 VALUES ( 1, 'foo' );
-CREATE TABLE t2 ( c CHAR(3), d INT );
-INSERT INTO t2 VALUES ( 'foo', 1 );
-
-UPDATE IGNORE t1, t2 SET b = 'bar', c = 'bar'
- WHERE a != ( SELECT 1 UNION SELECT 2 );
-
-DROP TABLE t1, t2;
diff --git a/mysql-test/t/update_innodb.test b/mysql-test/t/update_innodb.test
deleted file mode 100644
index acc8aceab00..00000000000
--- a/mysql-test/t/update_innodb.test
+++ /dev/null
@@ -1,77 +0,0 @@
---source include/have_innodb.inc
-
-CREATE TABLE `t1` (
- `c1` int(11) NOT NULL,
- `c2` datetime DEFAULT NULL,
- PRIMARY KEY (`c1`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-CREATE TABLE `t2` (
- `c0` varchar(10) NOT NULL,
- `c1` int(11) NOT NULL,
- `c2` int(11) NOT NULL,
- PRIMARY KEY (`c0`,`c1`),
- KEY `c1` (`c1`),
- KEY `c2` (`c2`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-CREATE TABLE `t3` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `c1` datetime NOT NULL,
- `c2` bigint(20) NOT NULL,
- `c3` int(4) unsigned NOT NULL,
- PRIMARY KEY (`id`),
- KEY `c2` (`c2`),
- KEY `c3` (`c3`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-CREATE TABLE `t4` (
- `c1` int(11) NOT NULL,
- `c2` bigint(20) DEFAULT NULL,
- `c3` int(11) NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
- CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select `t4`.`c1` AS `c1`,`t4`.`c2` AS `c2`,`t4`.`c3` AS `c3` from `t4`;
-
-UPDATE t1 a JOIN t2 b ON a.c1 = b.c1 JOIN v1 vw ON b.c2 = vw.c1 JOIN t3 del ON vw.c2 = del.c2 SET a.c2 = ( SELECT max(t.c1) FROM t3 t, v1 i WHERE del.c2 = t.c2 AND vw.c3 = i.c3 AND t.c3 = 4 ) WHERE a.c2 IS NULL OR a.c2 < '2011-05-01';
-
-drop view v1;
-drop table t1,t2,t3,t4;
-
---echo #
---echo # MDEV-14862: Server crashes in Bitmap<64u>::merge / add_key_field
---echo #
-
-CREATE TABLE t1 (a INT) ENGINE=InnoDB;
-CREATE VIEW v1 AS SELECT * FROM t1;
-CREATE TABLE t2 (b INT) ENGINE=InnoDB;
-DELETE FROM v1 WHERE a IN ( SELECT a FROM t2 );
-DELETE FROM v1 WHERE (a,a) IN ( SELECT a,a FROM t2 );
-drop view v1;
-drop table t1,t2;
-
---echo #
---echo # MDEV-10232 Scalar result of subquery changes after adding an outer select stmt
---echo #
-
-CREATE TABLE t1 (
- a_id INT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
- b_id INT(20) UNSIGNED NULL DEFAULT NULL,
- c_id VARCHAR(255) NULL DEFAULT NULL,
- PRIMARY KEY (a_id))COLLATE = 'utf8_general_ci' ENGINE = InnoDB;
-
-CREATE TABLE t2 (
- b_id INT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
- c_id VARCHAR(255) NULL DEFAULT NULL,
- PRIMARY KEY (b_id),
- INDEX idx_c_id (c_id))COLLATE = 'utf8_general_ci' ENGINE = InnoDB;
-
-INSERT INTO t1 (b_id, c_id) VALUES (NULL, NULL);
-INSERT INTO t2 (c_id) VALUES (NULL);
-INSERT INTO t2 (c_id) VALUES (NULL);
-
-SELECT * FROM t1;
-SELECT t2.b_id FROM t1,t2 WHERE t2.c_id = t1.c_id;
-UPDATE t1 SET b_id = (SELECT t2.b_id FROM t2 t2 WHERE t2.c_id = t1.c_id);
-SELECT * FROM t1;
-drop table t1,t2;
diff --git a/mysql-test/t/update_use_source.test b/mysql-test/t/update_use_source.test
deleted file mode 100644
index 7ed5f95d68d..00000000000
--- a/mysql-test/t/update_use_source.test
+++ /dev/null
@@ -1,245 +0,0 @@
---source include/have_sequence.inc
---source include/have_innodb.inc
-
-create table t1 (old_c1 integer, old_c2 integer,c1 integer, c2 integer, c3 integer) engine=InnoDb;
-create view v1 as select * from t1 where c2=2;
-delimiter /;
-create trigger trg_t1 before update on t1 for each row
-begin
- set new.old_c1=old.c1;
- set new.old_c2=old.c2;
-end;
-/
-delimiter ;/
-
-insert into t1(c1,c2,c3) values (1,1,1);
-insert into t1(c1,c2,c3) values (1,2,2);
-insert into t1(c1,c2,c3) values (1,3,3);
-insert into t1(c1,c2,c3) values (2,1,4);
-insert into t1(c1,c2,c3) values (2,2,5);
-insert into t1(c1,c2,c3) values (2,3,6);
-insert into t1(c1,c2,c3) values (2,4,7);
-insert into t1(c1,c2,c3) values (2,5,8);
-
-commit;
-select * from t1;
-
---echo Test without any index
---source include/update_use_source.inc
-
---echo Test with an index on updated columns
-create index t1_c2 on t1 (c2,c1);
---source include/update_use_source.inc
-
---echo Test with an index on updated columns
-create index t1_c3 on t1 (c3);
---source include/update_use_source.inc
-
---echo Test with a primary key on updated columns
-drop index t1_c3 on t1;
-alter table t1 add primary key (c3);
---source include/update_use_source.inc
-
---echo # Update with error "Subquery returns more than 1 row"
---error ER_SUBQUERY_NO_1_ROW
-update t1 set c2=(select c2 from t1);
-
---echo # Update with error "Subquery returns more than 1 row" and order by
---error ER_SUBQUERY_NO_1_ROW
-update t1 set c2=(select c2 from t1) order by c3;
-
--- echo Duplicate value on update a primary key
-start transaction;
---error ER_DUP_ENTRY
-update t1 set c3=0 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3;
-rollback;
-
--- echo Duplicate value on update a primary key with ignore
-start transaction;
---enable_info ONCE
-update ignore t1 set c3=0 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3;
-rollback;
-
--- echo Duplicate value on update a primary key and limit
-start transaction;
---error ER_DUP_ENTRY
-update t1 set c3=0 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3 limit 2;
-rollback;
-
--- echo Duplicate value on update a primary key with ignore and limit
-start transaction;
---enable_info ONCE
-update ignore t1 set c3=0 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3 limit 2;
-rollback;
-
---echo # Update no rows found
---enable_info ONCE
-update t1
- set c1=10
- where c1 <2
- and exists (select 'X'
- from t1 a
- where a.c1 = t1.c1 + 10);
-
---echo # Update no rows changed
-drop trigger trg_t1;
-start transaction;
---enable_info ONCE
-update t1
- set c1=c1
- where c1 <2
- and exists (select 'X'
- from t1 a
- where a.c1 = t1.c1);
-rollback;
-
---echo #
---echo # Check call of after trigger
---echo #
-
-delimiter /;
-create or replace trigger trg_t2 after update on t1 for each row
-begin
- declare msg varchar(100);
- if (new.c3 = 5) then
- set msg=concat('in after update trigger on ',new.c3);
- SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = msg;
- end if;
-end;
-/
-delimiter ;/
---error 1644
-update t1 set c1=2 where c3 in (select distinct a.c3 from t1 a where a.c1=t1.c1);
-
---echo #
---echo # Check update with order by and after trigger
---echo #
-
---error 1644
-update t1 set c1=2 where c3 in (select distinct a.c3 from t1 a where a.c1=t1.c1) order by t1.c2;
-
-drop view v1;
---echo #
---echo # Check update on view with check option
---echo #
-
-create view v1 as select * from t1 where c2=2 with check option;
-
-start transaction;
--- error 1369
-update v1 set c2=3 where c1=1;
-rollback;
-
-start transaction;
--- error 1369
-update v1 set c2=(select max(c3) from v1) where c1=1;
-rollback;
-
-start transaction;
-update v1 set c2=(select min(va.c3) from v1 va), c1=0 where c1=1;
-rollback;
-
-drop view v1;
-drop table t1;
-
---echo #
---echo # Test with a temporary table
---echo #
-
-create temporary table t1 (c1 integer, c2 integer, c3 integer) engine=InnoDb;
-insert into t1(c1,c2,c3) values (1,1,1);
-insert into t1(c1,c2,c3) values (1,2,2);
-insert into t1(c1,c2,c3) values (1,3,3);
-insert into t1(c1,c2,c3) values (2,1,4);
-insert into t1(c1,c2,c3) values (2,2,5);
-insert into t1(c1,c2,c3) values (2,3,6);
-insert into t1(c1,c2,c3) values (2,4,7);
-insert into t1(c1,c2,c3) values (2,5,8);
-
-start transaction;
---enable_info ONCE
-update t1
- set c1=(select a.c2
- from t1 a
- where a.c3 = t1.c3) limit 3;
-select * from t1 ;
-rollback;
-drop table t1;
-
---echo #
---echo # Test on dynamic columns (blob)
---echo #
-
-create table assets (
- item_name varchar(32) primary key, -- A common attribute for all items
- dynamic_cols blob -- Dynamic columns will be stored here
-);
-INSERT INTO assets VALUES ('MariaDB T-shirt', COLUMN_CREATE('color', 'blue', 'size', 'XL'));
-INSERT INTO assets VALUES ('Thinkpad Laptop', COLUMN_CREATE('color', 'black', 'price', 500));
-SELECT item_name, COLUMN_GET(dynamic_cols, 'color' as char) AS color FROM assets;
-UPDATE assets SET dynamic_cols=COLUMN_ADD(dynamic_cols, 'warranty', '3 years') WHERE item_name='Thinkpad Laptop';
-SELECT item_name, COLUMN_GET(dynamic_cols, 'warranty' as char) AS color FROM assets;
-UPDATE assets SET dynamic_cols=COLUMN_ADD(dynamic_cols, 'warranty', '4 years')
- WHERE item_name in (select b.item_name
- from assets b
- where COLUMN_GET(b.dynamic_cols, 'color' as char) ='black');
-SELECT item_name, COLUMN_GET(dynamic_cols, 'warranty' as char) AS color FROM assets;
-
-UPDATE assets SET dynamic_cols=COLUMN_ADD(dynamic_cols, 'warranty', (select COLUMN_GET(b.dynamic_cols, 'color' as char)
- from assets b
- where assets.item_name = item_name));
-SELECT item_name, COLUMN_GET(dynamic_cols, 'warranty' as char) AS color FROM assets;
-drop table assets ;
-
---echo #
---echo # Test on fulltext columns
---echo #
-CREATE TABLE ft2(copy TEXT,FULLTEXT(copy)) ENGINE=MyISAM;
-INSERT INTO ft2(copy) VALUES
- ('MySQL vs MariaDB database'),
- ('Oracle vs MariaDB database'),
- ('PostgreSQL vs MariaDB database'),
- ('MariaDB overview'),
- ('Foreign keys'),
- ('Primary keys'),
- ('Indexes'),
- ('Transactions'),
- ('Triggers');
-SELECT * FROM ft2 WHERE MATCH(copy) AGAINST('database');
-update ft2 set copy = (select max(concat('mykeyword ',substr(b.copy,1,5))) from ft2 b WHERE MATCH(b.copy) AGAINST('database'))
- where MATCH(copy) AGAINST('keys');
-SELECT * FROM ft2 WHERE MATCH(copy) AGAINST('mykeyword');
-drop table ft2;
-
---echo #
---echo # Test with MyISAM
---echo #
-
-create table t1 (old_c1 integer, old_c2 integer,c1 integer, c2 integer, c3 integer) engine=MyISAM;
-insert t1 (c1,c2,c3) select 0,seq,seq%10 from seq_1_to_500;
-insert t1 (c1,c2,c3) select 1,seq,seq%10 from seq_1_to_400;
-insert t1 (c1,c2,c3) select 2,seq,seq%10 from seq_1_to_300;
-insert t1 (c1,c2,c3) select 3,seq,seq%10 from seq_1_to_200;
-create index t1_idx1 on t1(c3);
-analyze table t1;
-
-update t1 set c1=2 where exists (select 'x' from t1);
-select count(*) from t1 where c1=2;
-update t1 set c1=3 where c3 in (select c3 from t1 b where t1.c3=b.c1);
-select count(*) from t1 where c1=3;
-drop table t1;
-
-
---echo #
---echo # Test error on multi_update conversion on view with order by or limit
---echo #
-
-create table t1 (c1 integer) engine=InnoDb;
-create table t2 (c1 integer) engine=InnoDb;
-create view v1 as select t1.c1 as "t1c1" ,t2.c1 as "t2c1" from t1,t2 where t1.c1=t2.c1;
---error ER_BAD_FIELD_ERROR
-update v1 set t1c1=2 order by 1;
-update v1 set t1c1=2 limit 1;
-drop table t1;
-drop table t2;
-drop view v1;
diff --git a/mysql-test/t/upgrade.test b/mysql-test/t/upgrade.test
deleted file mode 100644
index ab9330176f8..00000000000
--- a/mysql-test/t/upgrade.test
+++ /dev/null
@@ -1,182 +0,0 @@
-call mtr.add_suppression("Invalid .old.. table or database name");
--- source include/not_embedded.inc
-
---disable_warnings
-drop database if exists `mysqltest1`;
-drop database if exists `mysqltest-1`;
-drop database if exists `#mysql50#mysqltest-1`;
---enable_warnings
-
-create database `mysqltest1`;
-create database `#mysql50#mysqltest-1`;
-create table `mysqltest1`.`t1` (a int);
-create table `mysqltest1`.`#mysql50#t-1` (a int);
-create table `#mysql50#mysqltest-1`.`t1` (a int);
-create table `#mysql50#mysqltest-1`.`#mysql50#t-1` (a int);
-show create database `mysqltest1`;
---error 1049
-show create database `mysqltest-1`;
-show create database `#mysql50#mysqltest-1`;
-show tables in `mysqltest1`;
-show tables in `#mysql50#mysqltest-1`;
-
---exec $MYSQL_CHECK --all-databases --fix-db-names --fix-table-names
-
-show create database `mysqltest1`;
-show create database `mysqltest-1`;
---error 1049
-show create database `#mysql50#mysqltest-1`;
-show tables in `mysqltest1`;
-show tables in `mysqltest-1`;
-drop database `mysqltest1`;
-drop database `mysqltest-1`;
-
-#
-# Bug#17142: Crash if create with encoded name
-#
-create table `txu#p#p1` (s1 int);
-insert into `txu#p#p1` values (1);
---error 1146
-select * from `txu@0023p@0023p1`;
-create table `txu@0023p@0023p1` (s1 int);
-show tables;
-insert into `txu@0023p@0023p1` values (2);
-select * from `txu@0023p@0023p1`;
-select * from `txu#p#p1`;
-drop table `txu#p#p1`;
-drop table `txu@0023p@0023p1`;
-
---echo #
---echo # Bug#37631 Incorrect key file for table after upgrading from 5.0 to 5.1
---echo #
---echo # copy table created using mysql4.0 into the data dir
-let $MYSQLD_DATADIR= `SELECT @@datadir`;
-copy_file std_data/bug37631.frm $MYSQLD_DATADIR/test/t1.frm;
-copy_file std_data/bug37631.MYD $MYSQLD_DATADIR/test/t1.MYD;
-copy_file std_data/bug37631.MYI $MYSQLD_DATADIR/test/t1.MYI;
---echo # check the table created using mysql 4.0
-CHECK TABLE t1;
---echo # query the table created using mysql 4.0
-SELECT * FROM t1;
-DROP TABLE t1;
-
-#
-# Check if old tables work
-#
-
-let $MYSQLD_DATADIR= `select @@datadir`;
---error 0,1
---remove_file $MYSQLD_DATADIR/test/t1.frm
---copy_file std_data/old_table-323.frm $MYSQLD_DATADIR/test/t1.frm
-truncate t1;
-drop table t1;
-
-#
-# Bug#28360 (RENAME DATABASE destroys routines)
-#
-
---disable_warnings
-drop database if exists `tabc`;
-drop database if exists `a-b-c`;
---enable_warnings
-
-create database `tabc` default character set latin2;
-create table tabc.t1 (a int);
-FLUSH TABLES;
-
-# Manually make a 5.0 database from the template
---mkdir $MYSQLD_DATADIR/a-b-c
---copy_file $MYSQLD_DATADIR/tabc/db.opt $MYSQLD_DATADIR/a-b-c/db.opt
---copy_file $MYSQLD_DATADIR/tabc/t1.frm $MYSQLD_DATADIR/a-b-c/t1.frm
---copy_file $MYSQLD_DATADIR/tabc/t1.MYD $MYSQLD_DATADIR/a-b-c/t1.MYD
---copy_file $MYSQLD_DATADIR/tabc/t1.MYI $MYSQLD_DATADIR/a-b-c/t1.MYI
-
-show databases like '%a-b-c%';
-ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME;
-# The physical directory name is now a@002db@002dc, the logical name still a-b-c
-show databases like '%a-b-c%';
-show create database `a-b-c`;
-show tables in `a-b-c`;
-show create table `a-b-c`.`t1`;
-drop database `a-b-c`;
-drop database `tabc`;
-
-#
-# Bug#43385 Cannot ALTER DATABASE ... UPGRADE DATA DIRECTORY NAME when Views exist
-#
-let $MYSQLD_DATADIR= `select @@datadir`;
---mkdir $MYSQLD_DATADIR/a-b-c
-use `#mysql50#a-b-c`;
-create table t1(f1 char(10));
-
---write_file $MYSQLD_DATADIR/a-b-c/v1.frm
-TYPE=VIEW
-query=select `a`.`f1` AS `f1` from `a-b-c`.`t1` `a` join `information_schema`.`tables` `b` where (convert(`a`.`f1` using utf8) = `b`.`TABLE_NAME`)
-md5=068271f1c657fe115e497856ca0fa493
-updatable=0
-algorithm=0
-definer_user=root
-definer_host=localhost
-suid=2
-with_check_option=0
-timestamp=2009-04-10 11:53:37
-create-version=1
-source=select f1 from `a-b-c`.t1 a, information_schema.tables b\nwhere a.f1 = b.table_name
-client_cs_name=utf8
-connection_cl_name=utf8_general_ci
-EOF
-
-show databases like '%a-b-c%';
-ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME;
-show databases like '%a-b-c%';
-show create view `a-b-c`.v1;
---disable_ps_protocol
-select * from `a-b-c`.v1;
---enable_ps_protocol
-drop database `a-b-c`;
-use test;
-
---echo # End of 5.0 tests
-
---echo #
---echo # Bug #53804: serious flaws in the alter database .. upgrade data
---echo # directory name command
---echo #
-
---error ER_BAD_DB_ERROR
-ALTER DATABASE `#mysql50#:` UPGRADE DATA DIRECTORY NAME;
---error ER_WRONG_DB_NAME
-ALTER DATABASE `#mysql50#.` UPGRADE DATA DIRECTORY NAME;
---error ER_WRONG_DB_NAME
-ALTER DATABASE `#mysql50#../` UPGRADE DATA DIRECTORY NAME;
---error ER_WRONG_DB_NAME
-ALTER DATABASE `#mysql50#../..` UPGRADE DATA DIRECTORY NAME;
---error ER_WRONG_DB_NAME
-ALTER DATABASE `#mysql50#../../` UPGRADE DATA DIRECTORY NAME;
---error ER_WRONG_DB_NAME
-ALTER DATABASE `#mysql50#./blablabla` UPGRADE DATA DIRECTORY NAME;
---error ER_WRONG_DB_NAME
-ALTER DATABASE `#mysql50#../blablabla` UPGRADE DATA DIRECTORY NAME;
---error ER_WRONG_DB_NAME
-ALTER DATABASE `#mysql50#/` UPGRADE DATA DIRECTORY NAME;
---error ER_WRONG_DB_NAME
-ALTER DATABASE `#mysql50#/.` UPGRADE DATA DIRECTORY NAME;
-
---error ER_WRONG_DB_NAME
-USE `#mysql50#.`;
---error ER_WRONG_DB_NAME
-USE `#mysql50#../blablabla`;
-
-#
-# Test of Bug #56441: mysql_upgrade 5.0->5.1 fails for tables with long names
-#
-copy_file $MYSQL_TEST_DIR/std_data/long_table_name.MYI $MYSQLD_DATADIR/test/ltoriaeinnovacionendesarrolloempres#9120761097220077376#cio_com.MYI;
-copy_file $MYSQL_TEST_DIR/std_data/long_table_name.MYD $MYSQLD_DATADIR/test/ltoriaeinnovacionendesarrolloempres#9120761097220077376#cio_com.MYD;
-copy_file $MYSQL_TEST_DIR/std_data/long_table_name.frm $MYSQLD_DATADIR/test/ltoriaeinnovacionendesarrolloempres#9120761097220077376#cio_com.frm;
-show full tables;
-rename table `#mysql50#ltoriaeinnovacionendesarrolloempres#9120761097220077376#cio_com` to `ltoriaeinnovacionendesarrolloempres#9120761097220077376#cio_com`;
-show full tables;
-drop table `ltoriaeinnovacionendesarrolloempres#9120761097220077376#cio_com`;
-
---echo # End of 5.1 tests
-
diff --git a/mysql-test/t/user_limits-master.opt b/mysql-test/t/user_limits-master.opt
deleted file mode 100644
index 107b2e4a27f..00000000000
--- a/mysql-test/t/user_limits-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---max-user-connections=1000
diff --git a/mysql-test/t/user_limits.test b/mysql-test/t/user_limits.test
deleted file mode 100644
index ebb4fd4fb88..00000000000
--- a/mysql-test/t/user_limits.test
+++ /dev/null
@@ -1,218 +0,0 @@
-#
-# Test behavior of various per-account limits (aka quotas)
-#
-
-# Requires privileges to be enabled
---source include/not_embedded.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-set @my_max_user_connections= @@global.max_user_connections;
-
-# Prepare play-ground
---disable_warnings
-drop table if exists t1;
---enable_warnings
-create table t1 (i int);
-# Just be sure that nothing will bother us
-delete from mysql.user where user like 'mysqltest\_%';
-delete from mysql.db where user like 'mysqltest\_%';
-delete from mysql.tables_priv where user like 'mysqltest\_%';
-delete from mysql.columns_priv where user like 'mysqltest\_%';
-flush privileges;
-
-# Limits doesn't work with prepared statements (yet)
---disable_ps_protocol
-
-# Test of MAX_QUERIES_PER_HOUR limit
-create user mysqltest_1@localhost;
-grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 2;
-# This ensures that counters are reset and makes test scheduling independent
-flush user_resources;
-connect (mqph, localhost, mysqltest_1,,);
-connection mqph;
-select * from t1;
-select * from t1;
---error ER_USER_LIMIT_REACHED
-select * from t1;
-connect (mqph2, localhost, mysqltest_1,,);
-connection mqph2;
---error ER_USER_LIMIT_REACHED
-select * from t1;
-# cleanup
-connection default;
-drop user mysqltest_1@localhost;
-disconnect mqph;
-disconnect mqph2;
-
-# Test of MAX_UPDATES_PER_HOUR limit
-create user mysqltest_1@localhost;
-grant usage on *.* to mysqltest_1@localhost with max_updates_per_hour 2;
-flush user_resources;
-connect (muph, localhost, mysqltest_1,,);
-connection muph;
-select * from t1;
-select * from t1;
-select * from t1;
-delete from t1;
-delete from t1;
---error ER_USER_LIMIT_REACHED
-delete from t1;
-select * from t1;
-connect (muph2, localhost, mysqltest_1,,);
-connection muph2;
---error ER_USER_LIMIT_REACHED
-delete from t1;
-select * from t1;
-# Cleanup
-connection default;
-drop user mysqltest_1@localhost;
-disconnect muph;
-disconnect muph2;
-
-# Test of MAX_CONNECTIONS_PER_HOUR limit
-create user mysqltest_1@localhost;
-grant usage on *.* to mysqltest_1@localhost with max_connections_per_hour 2;
-flush user_resources;
-connect (mcph1, localhost, mysqltest_1,,);
-connection mcph1;
-select * from t1;
-connect (mcph2, localhost, mysqltest_1,,);
-connection mcph2;
-select * from t1;
---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
---error ER_USER_LIMIT_REACHED
-connect (mcph3, localhost, mysqltest_1,,);
-# Old connection is still ok
-select * from t1;
-# Let us try to close old connections and try again. This will also test that
-# counters are not thrown away if there are no connections for this user.
-disconnect mcph1;
-disconnect mcph2;
---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
---error ER_USER_LIMIT_REACHED
-connect (mcph3, localhost, mysqltest_1,,);
-# Cleanup
-connection default;
-drop user mysqltest_1@localhost;
-
-# Test of MAX_USER_CONNECTIONS limit
-# We need this to reset internal mqh_used variable
-flush privileges;
-create user mysqltest_1@localhost;
-grant usage on *.* to mysqltest_1@localhost with max_user_connections 2;
-flush user_resources;
-connect (muc1, localhost, mysqltest_1,,);
-connection muc1;
-select * from t1;
-connect (muc2, localhost, mysqltest_1,,);
-connection muc2;
-select * from t1;
---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
---error ER_USER_LIMIT_REACHED
-connect (muc3, localhost, mysqltest_1,,);
-# Closing of one of connections should help
-disconnect muc1;
-connect (muc3, localhost, mysqltest_1,,);
-select * from t1;
-# Changing of limit should also help (and immediately)
-connection default;
-grant usage on *.* to mysqltest_1@localhost with max_user_connections 3;
-flush user_resources;
-connect (muc4, localhost, mysqltest_1,,);
-connection muc4;
-select * from t1;
---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
---error ER_USER_LIMIT_REACHED
-connect (muc5, localhost, mysqltest_1,,);
-
-connection default;
-# Test with negative max_user_connections
-grant usage on *.* to mysqltest_1@localhost with max_user_connections -1;
-show grants for mysqltest_1@localhost;
-flush user_resources;
-show grants for mysqltest_1@localhost;
---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
---error ER_USER_LIMIT_REACHED
-connect (muc5, localhost, mysqltest_1,,);
-
-# Clean up
-disconnect muc2;
-disconnect muc3;
-disconnect muc4;
-drop user mysqltest_1@localhost;
-
-# Now let us test interaction between global and per-account
-# max_user_connections limits
-select @@session.max_user_connections, @@global.max_user_connections;
-# Local max_user_connections variable can't be set directly
-# since this limit is per-account
---error ER_VARIABLE_IS_READONLY
-set session max_user_connections= 2;
-# But it is ok to set global max_user_connections
-set global max_user_connections= 2;
-select @@session.max_user_connections, @@global.max_user_connections;
-# Let us check that global limit works
-create user mysqltest_1@localhost;
-grant usage on *.* to mysqltest_1@localhost;
-flush user_resources;
-connect (muca1, localhost, mysqltest_1,,);
-connection muca1;
-select @@session.max_user_connections, @@global.max_user_connections;
-connect (muca2, localhost, mysqltest_1,,);
-connection muca2;
-select * from t1;
---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
---error ER_TOO_MANY_USER_CONNECTIONS
-connect (muca3, localhost, mysqltest_1,,);
-# Now we are testing that per-account limit prevails over gloabl limit
-connection default;
-grant usage on *.* to mysqltest_1@localhost with max_user_connections 3;
-flush user_resources;
-connect (muca3, localhost, mysqltest_1,,);
-connection muca3;
-select @@session.max_user_connections, @@global.max_user_connections;
---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
---error ER_USER_LIMIT_REACHED
-connect (muca4, localhost, mysqltest_1,,);
-# Cleanup
-connection default;
-disconnect muca1;
-disconnect muca2;
-disconnect muca3;
-set global max_user_connections= 0;
---enable_ps_protocol
-
-#
-# Test setting negative values of max_user_connections
-#
-grant usage on *.* to mysqltest_1@localhost with max_user_connections 0;
-set global max_user_connections=-1;
-show variables like "max_user_user_connections";
-select @@max_user_connections;
-select @@global.max_user_connections;
-# Check that we can't connect anymore except as root
---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
---error ER_TOO_MANY_USER_CONNECTIONS
-connect (muca2, localhost, mysqltest_1,,);
-connect (muca2, localhost, root,,);
-disconnect muca2;
-connection default;
-set global max_user_connections=1;
-# Check that we can connect one time, not two
-connect (muca2, localhost, mysqltest_1,,);
---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
---error ER_TOO_MANY_USER_CONNECTIONS
-connect (muca3, localhost, mysqltest_1,,);
-disconnect muca2;
-connection default;
-drop user mysqltest_1@localhost;
-
-# Final cleanup
-drop table t1;
-
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
-
-set global max_user_connections= @my_max_user_connections;
diff --git a/mysql-test/t/user_var-binlog.test b/mysql-test/t/user_var-binlog.test
deleted file mode 100644
index 0098f237de9..00000000000
--- a/mysql-test/t/user_var-binlog.test
+++ /dev/null
@@ -1,24 +0,0 @@
-# Requires statement logging
--- source include/have_binlog_format_mixed_or_statement.inc
-# TODO: Create row based version once $MYSQL_BINLOG has new RB version
-
-# Check that user variables are binlogged correctly (BUG#3875)
-create table t1 (a varchar(50));
-reset master;
-SET TIMESTAMP=10000;
-SET @`a b`='hello';
-INSERT INTO t1 VALUES(@`a b`);
-set @var1= "';aaa";
-SET @var2=char(ascii('a'));
-insert into t1 values (@var1),(@var2);
-source include/show_binlog_events.inc;
-
-# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
-# absolutely need variables names to be quoted and strings to be
-# escaped).
-let $MYSQLD_DATADIR= `select @@datadir`;
-flush logs;
---exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001
-drop table t1;
-
-# End of 4.1 tests
diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test
deleted file mode 100644
index 54ceb8fd3a5..00000000000
--- a/mysql-test/t/user_var.test
+++ /dev/null
@@ -1,523 +0,0 @@
-# Initialise
-source include/have_sequence.inc;
-
---error 1054
-set @a := foo;
-set @a := connection_id() + 3;
-select @a - connection_id();
-
-set @b := 1;
-select @b;
-
-# Check using and setting variables with SELECT DISTINCT
-
-CREATE TABLE t1 ( i int not null, v int not null,index (i));
-insert into t1 values (1,1),(1,3),(2,1);
-create table t2 (i int not null, unique (i));
-insert into t2 select distinct i from t1;
-select * from t2;
-select distinct t2.i,@vv1:=if(sv1.i,1,0),@vv2:=if(sv2.i,1,0),@vv3:=if(sv3.i,1,0), @vv1+@vv2+@vv3 from t2 left join t1 as sv1 on sv1.i=t2.i and sv1.v=1 left join t1 as sv2 on sv2.i=t2.i and sv2.v=2 left join t1 as sv3 on sv3.i=t2.i and sv3.v=3;
-explain select * from t1 where i=@vv1;
-select @vv1,i,v from t1 where i=@vv1;
-explain select * from t1 where @vv1:=@vv1+1 and i=@vv1;
-explain select @vv1:=i from t1 where i=@vv1;
-explain select * from t1 where i=@vv1;
-drop table t1,t2;
-
-# Check types of variables
-set @a=0,@b=0;
-select @a:=10, @b:=1, @a > @b, @a < @b;
-# Note that here a and b will be avaluated as number
-select @a:="10", @b:="1", @a > @b, @a < @b;
-# Note that here a and b will be avaluated as strings
-select @a:=10, @b:=2, @a > @b, @a < @b;
-select @a:="10", @b:="2", @a > @b, @a < @b;
-
-# Fixed bug #1194
-select @a:=1;
-select @a, @a:=1;
-
-create table t1 (id int, d double, c char(10));
-insert into t1 values (1,2.0, "test");
-select @c:=0;
-update t1 SET id=(@c:=@c+1);
-select @c;
-select @c:=0;
-update t1 set id=(@c:=@c+1);
-select @c;
-select @c:=0;
-select @c:=@c+1;
-select @d,(@d:=id),@d from t1;
-select @e,(@e:=d),@e from t1;
-select @f,(@f:=c),@f from t1;
-set @g=1;
-select @g,(@g:=c),@g from t1;
-select @c, @d, @e, @f;
-select @d:=id, @e:=id, @f:=id, @g:=@id from t1;
-select @c, @d, @e, @f, @g;
-drop table t1;
-
-# just for fun :)
-select @a:=10, @b:=2, @a>@b, @a:="10", @b:="2", @a>@b, @a:=10, @b:=2, @a>@b, @a:="10", @b:="2", @a>@b;
-
-#
-# bug#1739
-# Item_func_set_user_var sets update_query_id, Item_func_get_user_var checks it
-#
-create table t1 (i int not null);
-insert t1 values (1),(2),(2),(3),(3),(3);
-select @a:=0; select @a, @a:=@a+count(*), count(*), @a from t1 group by i;
-select @a:=0; select @a+0, @a:=@a+0+count(*), count(*), @a+0 from t1 group by i;
-
-set @a=0;
-select @a,@a:="hello",@a,@a:=3,@a,@a:="hello again" from t1 group by i;
-select @a,@a:="hello",@a,@a:=3,@a,@a:="hello again" from t1 group by i;
-drop table t1;
-
-#
-# Bug #2244: User variables didn't copy collation and derivation
-# attributes from values they were initialized to.
-#
-
-set @a=_latin2'test';
-select charset(@a),collation(@a),coercibility(@a);
-select @a=_latin2'TEST';
-select @a=_latin2'TEST' collate latin2_bin;
-
-set @a=_latin2'test' collate latin2_general_ci;
-select charset(@a),collation(@a),coercibility(@a);
-select @a=_latin2'TEST';
-select @a=_latin2'TEST' collate latin2_bin;
-
-#
-# Check the same invoking Item_set_user_var
-#
-select charset(@a:=_latin2'test');
-select collation(@a:=_latin2'test');
-select coercibility(@a:=_latin2'test');
-select collation(@a:=_latin2'test' collate latin2_bin);
-select coercibility(@a:=_latin2'test' collate latin2_bin);
-select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST';
-select charset(@a),collation(@a),coercibility(@a);
-select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST' collate latin2_general_ci;
-
-#
-# Bug #6321 strange error:
-# string function FIELD(<uservariable content NULL>, ...)
-#
-set @var= NULL ;
-select FIELD( @var,'1it','Hit') as my_column;
-
-#
-# Bug#9425 A user variable doesn't always have implicit coercibility
-#
-select @v, coercibility(@v);
-set @v1=null, @v2=1, @v3=1.1, @v4=now();
-select coercibility(@v1),coercibility(@v2),coercibility(@v3),coercibility(@v4);
-
-#
-# Bug #9286 SESSION/GLOBAL should be disallowed for user variables
-#
---error 1064
-set session @honk=99;
-
-#
-# Bug #10724 @@local not preserved in column name of select
-#
-# The value doesn't actually matter, we just care about the column name
---replace_column 1 #
-select @@local.max_allowed_packet;
---replace_column 1 #
-select @@session.max_allowed_packet;
---replace_column 1 #
-select @@global.max_allowed_packet;
---replace_column 1 #
-select @@max_allowed_packet;
---replace_column 1 #
-select @@Max_Allowed_Packet;
---replace_column 1 #
-select @@version;
---replace_column 1 #
-select @@global.version;
-
---echo End of 4.1 tests
-
-# Bug #6598: problem with cast(NULL as signed integer);
-#
-
-set @first_var= NULL;
-create table t1 select @first_var;
-show create table t1;
-drop table t1;
-set @first_var= cast(NULL as signed integer);
-create table t1 select @first_var;
-show create table t1;
-drop table t1;
-set @first_var= NULL;
-create table t1 select @first_var;
-show create table t1;
-drop table t1;
-set @first_var= concat(NULL);
-create table t1 select @first_var;
-show create table t1;
-drop table t1;
-set @first_var=1;
-set @first_var= cast(NULL as CHAR);
-create table t1 select @first_var;
-show create table t1;
-drop table t1;
-
-#
-# Bug #7498 User variable SET saves SIGNED BIGINT as UNSIGNED BIGINT
-#
-
-# First part, set user var to large number and select it
-set @a=18446744071710965857;
-select @a;
-
-# Second part, set user var from large number in table
-# then select it
-CREATE TABLE `bigfailure` (
- `afield` BIGINT UNSIGNED NOT NULL
-);
-INSERT INTO `bigfailure` VALUES (18446744071710965857);
-SELECT * FROM bigfailure;
-select * from (SELECT afield FROM bigfailure) as b;
-select * from bigfailure where afield = (SELECT afield FROM bigfailure);
-select * from bigfailure where afield = 18446744071710965857;
-# This is fixed in 5.0, to be uncommented there
-#select * from bigfailure where afield = '18446744071710965857';
-select * from bigfailure where afield = 18446744071710965856+1;
-
-SET @a := (SELECT afield FROM bigfailure);
-SELECT @a;
-SET @a := (select afield from (SELECT afield FROM bigfailure) as b);
-SELECT @a;
-SET @a := (select * from bigfailure where afield = (SELECT afield FROM bigfailure));
-SELECT @a;
-
-drop table bigfailure;
-
-#
-# Bug#16861: User defined variable can have a wrong value if a tmp table was
-# used.
-#
-create table t1(f1 int, f2 int);
-insert into t1 values (1,2),(2,3),(3,1);
-select @var:=f2 from t1 group by f1 order by f2 desc limit 1;
-select @var;
-create table t2 as select @var:=f2 from t1 group by f1 order by f2 desc limit 1;
-select * from t2;
-select @var;
-drop table t1,t2;
-
-#
-# Bug#19024 - SHOW COUNT(*) WARNINGS not return Errors
-#
---error 1064
-insert into city 'blah';
-SHOW COUNT(*) WARNINGS;
-SHOW COUNT(*) ERRORS;
-
-#
-# Bug#28494: Grouping by Item_func_set_user_var produces incorrect result.
-#
-create table t1(f1 int, f2 varchar(2), f3 float, f4 decimal(2,1));
-insert into t1 values
- (1, "a", 1.5, 1.6), (1, "a", 1.5, 1.6), (2, "b", 2.5, 2.6),
- (3, "c", 3.5, 3.6), (4, "d", 4.5, 4.6), (1, "a", 1.5, 1.6),
- (3, "c", 3.5, 3.6), (1, "a", 1.5, 1.6);
-select @a:=f1, count(f1) from t1 group by 1 desc;
-select @a:=f1, count(f1) from t1 group by 1 asc;
-select @a:=f2, count(f2) from t1 group by 1 desc;
-select @a:=f3, count(f3) from t1 group by 1 desc;
-select @a:=f4, count(f4) from t1 group by 1 desc;
-drop table t1;
-
-#
-# Bug#32482: Crash for a query with ORDER BY a user variable.
-#
-create table t1 (f1 int);
-insert into t1 values (2), (1);
-select @i := f1 as j from t1 order by 1;
-drop table t1;
-# Bug #32260: User variables in query cause server crash
-#
-create table t1(a int);
-insert into t1 values(5),(4),(4),(3),(2),(2),(2),(1);
-set @rownum := 0;
-set @rank := 0;
-set @prev_score := NULL;
-# Disable the result log as we assign a value to a user variable in one part
-# of a statement and use the same variable in other part of the same statement,
-# so we can get unexpected results.
---disable_result_log
-select @rownum := @rownum + 1 as row,
- @rank := IF(@prev_score!=a, @rownum, @rank) as rank,
- @prev_score := a as score
-from t1 order by score desc;
---enable_result_log
-drop table t1;
-
-#
-# Bug#26020: User-Defined Variables are not consistent with columns data types
-#
-
-create table t1(b bigint);
-insert into t1 (b) values (10), (30), (10);
-set @var := 0;
-select if(b=@var, 999, b) , @var := b from t1 order by b;
-drop table t1;
-
-create temporary table t1 (id int);
-insert into t1 values (2), (3), (3), (4);
-set @lastid=-1;
-select @lastid != id, @lastid, @lastid := id from t1;
-drop table t1;
-
-create temporary table t1 (id bigint);
-insert into t1 values (2), (3), (3), (4);
-set @lastid=-1;
-select @lastid != id, @lastid, @lastid := id from t1;
-drop table t1;
-
-#
-# Bug#42009: SELECT into variable gives different results to direct SELECT
-#
-CREATE TABLE t1(a INT, b INT);
-INSERT INTO t1 VALUES (0, 0), (2, 1), (2, 3), (1, 1), (30, 20);
-SELECT a, b INTO @a, @b FROM t1 WHERE a=2 AND b=3 GROUP BY a, b;
-SELECT @a, @b;
-SELECT a, b FROM t1 WHERE a=2 AND b=3 GROUP BY a, b;
-DROP TABLE t1;
-
-#
-# Bug#47371: reference by same column name
-#
-CREATE TABLE t1 (f1 int(11) default NULL, f2 int(11) default NULL);
-CREATE TABLE t2 (f1 int(11) default NULL, f2 int(11) default NULL, foo int(11));
-CREATE TABLE t3 (f1 int(11) default NULL, f2 int(11) default NULL);
-
-INSERT INTO t1 VALUES(10, 10);
-INSERT INTO t1 VALUES(10, 10);
-INSERT INTO t2 VALUES(10, 10, 10);
-INSERT INTO t2 VALUES(10, 10, 10);
-INSERT INTO t3 VALUES(10, 10);
-INSERT INTO t3 VALUES(10, 10);
-
-SELECT MIN(t2.f1),
-@bar:= (SELECT MIN(t3.f2) FROM t3 WHERE t3.f2 > foo)
-FROM t1,t2 WHERE t1.f1 = t2.f1 ORDER BY t2.f1;
-
-DROP TABLE t1, t2, t3;
-
---echo End of 5.0 tests
-
-#
-# Bug#42188: crash and/or memory corruption with user variables in trigger
-#
-
-CREATE TABLE t1 (i INT);
-CREATE TRIGGER t_after_insert AFTER INSERT ON t1 FOR EACH ROW SET @bug42188 = 10;
-INSERT INTO t1 VALUES (1);
---change_user root,,test
-INSERT INTO t1 VALUES (1);
-DROP TABLE t1;
-
-#
-# Bug #55615: debug assertion after using variable in assignment and
-# referred to
-# Bug #55564: crash with user variables, assignments, joins...
-#
-
-CREATE TABLE t1(a INT);
-INSERT INTO t1 VALUES (0),(0);
---echo # BUG#55615 : should not crash
-SELECT (@a:=(SELECT @a:=1 FROM t1 LIMIT 1)) AND COUNT(1) FROM t1 GROUP BY @a;
---echo # BUG#55564 : should not crash
-SELECT IF(
- @v:=LEAST((SELECT 1 FROM t1 t2 LEFT JOIN t1 ON (@v) GROUP BY t1.a), a),
- count(*), 1)
-FROM t1 GROUP BY a LIMIT 1;
-
-DROP TABLE t1;
-
-#
-# BUG#56138 "valgrind errors about overlapping memory when
-# double-assigning same variable"
-#
-
-select @v:=@v:=sum(1) from dual;
-
-#
-# Bug #57187: more user variable fun with multiple assignments and
-# comparison in query
-#
-
-CREATE TABLE t1(a DECIMAL(31,21));
-INSERT INTO t1 VALUES (0);
-
-SELECT (@v:=a) <> (@v:=1) FROM t1;
-
-DROP TABLE t1;
-
-#
-# lp: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;
-
-#
-#
-# Bug #12408412: GROUP_CONCAT + ORDER BY + INPUT/OUTPUT
-# SAME USER VARIABLE = CRASH
-#
-SET @bug12408412=1;
-SELECT GROUP_CONCAT(@bug12408412 ORDER BY 1) INTO @bug12408412;
-
---echo End of 5.1 tests
-
-#
-# MDEV-616 lp:1002126
-# Bug #11764371 57196: MORE FUN WITH ASSERTION: !TABLE->FILE ||
-# TABLE->FILE->INITED == HANDLER::
-#
-
-CREATE TABLE t1(a INT);
-INSERT INTO t1 VALUES (0);
-SELECT DISTINCT POW(COUNT(*), @a:=(SELECT 1 FROM t1 LEFT JOIN t1 AS t2 ON @a))
-AS b FROM t1 GROUP BY a;
-SELECT @a;
-DROP TABLE t1;
-CREATE TABLE t1(f1 INT, f2 INT);
-INSERT INTO t1 VALUES (1,2),(2,3),(3,1);
-CREATE TABLE t2(a INT);
-INSERT INTO t2 VALUES (1);
-SET @var=NULL;
-SELECT @var:=(SELECT f2 FROM t2 WHERE @var) FROM t1 GROUP BY f1 ORDER BY f2 DESC
-LIMIT 1;
-SELECT @var;
-DROP TABLE t1, t2;
-
-CREATE TABLE t1(a INT);
-INSERT INTO t1 VALUES (0),(1),(3);
-SELECT DISTINCT POW(COUNT(distinct a), @a:=(SELECT 1 FROM t1 LEFT JOIN t1 AS t2 ON @a limit 1)) AS b FROM t1 GROUP BY a;
-SELECT @a;
-DROP TABLE t1;
-
---echo End of 5.2 tests
-
-#
-# Bug#50511: Sometimes wrong handling of user variables containing NULL.
-#
-
-CREATE TABLE t1(f1 INT AUTO_INCREMENT, PRIMARY KEY(f1));
-
-INSERT INTO t1 SET f1 = NULL ;
-
-SET @aux = NULL ;
-INSERT INTO t1 SET f1 = @aux ;
-
-SET @aux1 = 0.123E-1;
-SET @aux1 = NULL;
-INSERT INTO t1 SET f1 = @aux1 ;
-
-SELECT * FROM t1;
-
-DROP TABLE t1;
-
-CREATE TABLE t1(f1 VARCHAR(257) , f2 INT, PRIMARY KEY(f2));
-CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @aux = 1;
-
-SET @aux = 1; # INT
-SET @aux = NULL;
-INSERT INTO test.t1 (f1, f2) VALUES (1, 1), (@aux, 2);
-
-SET @aux = 'text'; # STRING
-SET @aux = NULL;
-INSERT INTO t1(f1, f2) VALUES (1, 3), (@aux, 4);
-
-SELECT f1, f2 FROM t1 ORDER BY f2;
-
-DROP TRIGGER trg1;
-DROP TABLE t1;
-
---echo #
---echo # Bug #12408412: GROUP_CONCAT + ORDER BY + INPUT/OUTPUT
---echo # SAME USER VARIABLE = CRASH
---echo #
-
-SET @bug12408412=1;
-SELECT GROUP_CONCAT(@bug12408412 ORDER BY 1) INTO @bug12408412;
-
-#
-# MDEV-616 LP BUG#1002126
-# Bug #11764371 57196: MORE FUN WITH ASSERTION: !TABLE->FILE ||
-# TABLE->FILE->INITED == HANDLER::
-#
-
-CREATE TABLE t1(a INT);
-INSERT INTO t1 VALUES (0);
-SELECT DISTINCT POW(COUNT(*), @a:=(SELECT 1 FROM t1 LEFT JOIN t1 AS t2 ON @a))
-AS b FROM t1 GROUP BY a;
-SELECT @a;
-DROP TABLE t1;
-CREATE TABLE t1(f1 INT, f2 INT);
-INSERT INTO t1 VALUES (1,2),(2,3),(3,1);
-CREATE TABLE t2(a INT);
-INSERT INTO t2 VALUES (1);
-SET @var=NULL;
-SELECT @var:=(SELECT f2 FROM t2 WHERE @var) FROM t1 GROUP BY f1 ORDER BY f2 DESC
-LIMIT 1;
-SELECT @var;
-DROP TABLE t1, t2;
-
-CREATE TABLE t1(a INT);
-INSERT INTO t1 VALUES (0),(1),(3);
-SELECT DISTINCT POW(COUNT(distinct a), @a:=(SELECT 1 FROM t1 LEFT JOIN t1 AS t2 ON @a limit 1)) AS b FROM t1 GROUP BY a;
-SELECT @a;
-DROP TABLE t1;
-
---echo End of 5.5 tests
-
---echo #
---echo # Check that used memory extends if we set a variable
---echo #
-
-# Execute twice so number stablizes a bit
-let $tmp= `select memory_used from information_schema.processlist`;
-set @var= repeat('a',20000);
-let $tmp2= `select memory_used from information_schema.processlist`;
---disable_query_log
---disable_column_names
-eval select $tmp < $tmp2;
---enable_column_names
---enable_query_log
-
-#
-# MDEV-13897 SELECT @a := MAX(col) FROM t requires full index scan
-#
-explain select @a:=max(seq) from seq_1_to_1000000;
-
-# End of 10.1 tests
-
---echo #
---echo # Start of 10.3 tests
---echo #
-
---echo #
---echo # MDEV-12859 Out-of-range error for CREATE..SELECT @a:=EXTRACT(MINUTE_MICROSECOND FROM..
---echo #
-
-SET sql_mode=STRICT_ALL_TABLES;
-CREATE OR REPLACE TABLE t1 AS
-SELECT @a:=EXTRACT(MINUTE_MICROSECOND FROM '2001-01-01 11:22:33.999999') AS c1;
-SHOW CREATE TABLE t1;
-SELECT * FROM t1;
-DROP TABLE t1;
-SET sql_mode=DEFAULT;
diff --git a/mysql-test/t/userstat-badlogin-4824.test b/mysql-test/t/userstat-badlogin-4824.test
deleted file mode 100644
index 97370c1d081..00000000000
--- a/mysql-test/t/userstat-badlogin-4824.test
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# MDEV-4824 userstats - wrong user statistics
-#
---source include/not_embedded.inc
-
-create user foo@localhost identified by 'foo';
-flush user_statistics;
-set global userstat=1;
-
-connect(foo, localhost, foo, foo);
-select 1;
-disconnect foo;
-connection default;
-
-# wait for user_statistics changes to become visible
-let $wait_condition= select count(*) = 1 from information_schema.processlist;
---source include/wait_condition.inc
-
-# 41 is for ps-procotol
---replace_result 41 18
-select user, bytes_received from information_schema.user_statistics where user = 'foo';
-
---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
---error ER_ACCESS_DENIED_ERROR
-connect(foo, localhost, foo, bar);
-
-connection default;
-
---replace_result 41 18
-select user, bytes_received from information_schema.user_statistics where user = 'foo';
-
-drop user foo@localhost;
-set global userstat=0;
diff --git a/mysql-test/t/userstat.test b/mysql-test/t/userstat.test
deleted file mode 100644
index 9ce3a32c442..00000000000
--- a/mysql-test/t/userstat.test
+++ /dev/null
@@ -1,116 +0,0 @@
-#
-# Testing of user status (the userstat variable).
-# Note that this test requires a fresh restart to not have problems with the
-# old status values
-
--- source include/have_innodb.inc
--- source include/have_log_bin.inc
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-select variable_value from information_schema.global_status where variable_name="handler_read_key" into @global_read_key;
-show columns from information_schema.client_statistics;
-show columns from information_schema.user_statistics;
-show columns from information_schema.index_statistics;
-show columns from information_schema.table_statistics;
-
-# Disable logging to get right number of writes into the tables.
-set @save_general_log=@@global.general_log;
-set @@global.general_log=0;
-set @@global.userstat=1;
-flush status;
-
-create table t1 (a int, primary key (a), b int default 0) engine=innodb;
-insert into t1 (a) values (1),(2),(3),(4);
-update t1 set b=1;
-update t1 set b=5 where a=2;
-delete from t1 where a=3;
-
-/* Empty query */
-select * from t1 where a=999;
-
-drop table t1;
-
-# test SSL connections
---connect (ssl_con,localhost,root,,,,,SSL)
-SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
---connection default
-
-#
-# Test the commit and rollback are counted
-#
-
-create table t1 (a int, primary key (a), b int default 0) engine=innodb;
-begin;
-insert into t1 values(1,1);
-commit;
-begin;
-insert into t1 values(2,2);
-commit;
-begin;
-insert into t1 values(3,3);
-rollback;
-drop table t1;
-
-select sleep(1);
-
-show status like "rows%";
-show status like "ha%";
-select variable_value - @global_read_key as "handler_read_key" from information_schema.global_status where variable_name="handler_read_key";
-
---disconnect ssl_con
-
-# Ensure that the following commands doesn't change statistics
-
-set @@global.userstat=0;
-
-#
-# Check that we got right statistics
-#
-select * from information_schema.index_statistics;
-select * from information_schema.table_statistics;
-show table_statistics;
-show index_statistics;
---query_vertical select TOTAL_CONNECTIONS, TOTAL_SSL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, OTHER_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.client_statistics;
---query_vertical select TOTAL_CONNECTIONS, TOTAL_SSL_CONNECTIONS, CONCURRENT_CONNECTIONS, ROWS_READ, ROWS_SENT, ROWS_DELETED, ROWS_INSERTED, ROWS_UPDATED, SELECT_COMMANDS, UPDATE_COMMANDS, OTHER_COMMANDS, COMMIT_TRANSACTIONS, ROLLBACK_TRANSACTIONS, DENIED_CONNECTIONS, LOST_CONNECTIONS, ACCESS_DENIED, EMPTY_QUERIES from information_schema.user_statistics;
-flush table_statistics;
-flush index_statistics;
-select * from information_schema.index_statistics;
-select * from information_schema.table_statistics;
-show status like "%generic%";
-
-#
-# Test that some variables are not 0
-#
-
-select connected_time <> 0, busy_time <> 0, bytes_received <> 0,
- bytes_sent <> 0, binlog_bytes_written <> 0
- from information_schema.user_statistics;
-select connected_time <> 0, busy_time <> 0, bytes_received <> 0,
- bytes_sent <> 0, binlog_bytes_written <> 0
- from information_schema.client_statistics;
-
-#
-# Test of in transaction
-#
-
-create table t1 (a int) engine=innodb;
-select @@in_transaction;
-begin;
-select @@in_transaction;
-insert into t1 values (1);
-select @@in_transaction;
-commit;
-select @@in_transaction;
-set @@autocommit=0;
-select @@in_transaction;
-insert into t1 values (2);
-select @@in_transaction;
-set @@autocommit=1;
-select @@in_transaction;
-drop table t1;
-
-# Cleanup
-set @@global.general_log=@save_general_log;
diff --git a/mysql-test/t/varbinary.test b/mysql-test/t/varbinary.test
deleted file mode 100644
index f03f3fcf703..00000000000
--- a/mysql-test/t/varbinary.test
+++ /dev/null
@@ -1,158 +0,0 @@
-# This test uses chmod, can't be run with root permissions
--- source include/not_as_root.inc
-
-
-# Initialise
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-#
-# varbinary as string and number
-#
-
-select 0x41,0x41+0,0x41 | 0x7fffffffffffffff | 0,0xffffffffffffffff | 0 ;
-select 0x31+1,concat(0x31)+1,-0xf;
-select x'31',0xffff+0;
-select X'FFFF'+0;
-
-#
-# Hex string vs hex hybrid
-#
-SELECT x'31'+0, 0x31+0;
-SELECT x'31'+0.1e0, 0x31+0.1e0;
-SELECT x'312E39'+0e0, 0x312E39+0e0;
-SELECT CAST(x'31' AS SIGNED), CAST(0x31 AS SIGNED);
-SELECT CAST(x'31' AS DECIMAL(10,1)), CAST(0x31 AS DECIMAL(10,1));
-SELECT CAST(x'312E39' AS SIGNED), CAST(0x312E39 AS SIGNED);
-SELECT CAST(x'312E39' AS DECIMAL(10,1)), CAST(0x312E39 AS DECIMAL(10,1));
-EXPLAIN EXTENDED SELECT X'FFFF', 0xFFFF;
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (X'31'),(0x31);
-INSERT INTO t1 VALUES (X'312E39'),(0x312E39);
-SELECT * FROM t1;
-DROP TABLE t1;
-CREATE TABLE t1 (a DECIMAL(10,1));
-INSERT INTO t1 VALUES (X'31'),(0x31);
-INSERT INTO t1 VALUES (X'312E39'),(0x312E39);
-SELECT * FROM t1;
-DROP TABLE t1;
-
-#
-# Test of hex constants in WHERE:
-#
-
-create table t1 (ID int(8) unsigned zerofill not null auto_increment,UNIQ bigint(21) unsigned zerofill not null,primary key (ID),unique (UNIQ) );
-insert into t1 set UNIQ=0x38afba1d73e6a18a;
-insert into t1 set UNIQ=123;
-explain extended select * from t1 where UNIQ=0x38afba1d73e6a18a;
-drop table t1;
-
-#
-# Test error conditions
-#
---error 1064
-select x'hello';
---error 1054
-select 0xfg;
-
-#
-# Test likely error conditions
-#
-create table t1 select 1 as x, 2 as xx;
-select x,xx from t1;
-drop table t1;
-
-# End of 4.1 tests
-
-#
-# Bug #19371 VARBINARY() have trailing zeros after upgrade from 4.1
-#
-
-# Test with a saved table from 4.1
-let $MYSQLD_DATADIR= `select @@datadir`;
-copy_file std_data/bug19371.frm $MYSQLD_DATADIR/test/t1.frm;
-chmod 0777 $MYSQLD_DATADIR/test/t1.frm;
-copy_file std_data/bug19371.MYD $MYSQLD_DATADIR/test/t1.MYD;
-chmod 0777 $MYSQLD_DATADIR/test/t1.MYD;
-copy_file std_data/bug19371.MYI $MYSQLD_DATADIR/test/t1.MYI;
-chmod 0777 $MYSQLD_DATADIR/test/t1.MYI;
-
-# Everything _looks_ fine
-show create table t1;
-
-# But the length of the varbinary columns are too long
-select length(a), length(b) from t1;
-
-# Run CHECK TABLE, it should indicate table need a REPAIR TABLE
-CHECK TABLE t1 FOR UPGRADE;
-
-# Run REPAIR TABLE to alter the table and repair
-# the varbinary fields
-REPAIR TABLE t1;
-
-# Now check it's back to normal
-show create table t1;
-select length(a), length(b) from t1;
-insert into t1 values("ccc", "ddd");
-select length(a), length(b) from t1;
-select hex(a), hex(b) from t1;
-select concat("'", a, "'"), concat("'", b, "'") from t1;
-
-drop table t1;
-
-# Check that the fix does not affect table created with current version
-create table t1(a varbinary(255));
-insert into t1 values("aaa ");
-select length(a) from t1;
-alter table t1 modify a varchar(255);
-select length(a) from t1;
-drop table t1;
-
-
-#
-# Bug#28127 (Some valid identifiers names are not parsed correctly)
-#
-
---disable_warnings
-drop table if exists table_28127_a;
-drop table if exists table_28127_b;
---enable_warnings
-
-create table table_28127_a(0b02 int);
-show create table table_28127_a;
-
-create table table_28127_b(0b2 int);
-show create table table_28127_b;
-
-drop table table_28127_a;
-drop table table_28127_b;
-
-#
-# Bug#35658 (An empty binary value leads to mysqld crash)
-#
-
-select 0b01000001;
-
-select 0x41;
-
-select b'01000001';
-
-select x'41', 0+x'3635';
-
-select N'abc', length(N'abc');
-
-select N'', length(N'');
-
-select '', length('');
-
-select b'', 0+b'';
-
-select x'', 0+x'';
-
---error ER_BAD_FIELD_ERROR
-select 0x;
-
---error ER_BAD_FIELD_ERROR
-select 0b;
-
diff --git a/mysql-test/t/variables-master.opt b/mysql-test/t/variables-master.opt
deleted file mode 100644
index e4b213a0323..00000000000
--- a/mysql-test/t/variables-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---max-user-connections=1
diff --git a/mysql-test/t/variables-notembedded-master.opt b/mysql-test/t/variables-notembedded-master.opt
deleted file mode 100644
index 8a173a043ac..00000000000
--- a/mysql-test/t/variables-notembedded-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-slave-skip-errors=3,100,137,0,643,1752
diff --git a/mysql-test/t/variables-notembedded.test b/mysql-test/t/variables-notembedded.test
deleted file mode 100644
index 2aa77e1e254..00000000000
--- a/mysql-test/t/variables-notembedded.test
+++ /dev/null
@@ -1,177 +0,0 @@
-# Tests that variables work correctly (setting and showing). This
-# test is like the main.variables test, but for variables not
-# available in embedded mode.
-
-source include/not_embedded.inc;
-
---echo ---- Init ----
-# Backup global variables so they can be restored at end of test.
-set @my_slave_net_timeout =@@global.slave_net_timeout;
-
---echo ---- Test ----
-set global slave_net_timeout=100;
-set global sql_slave_skip_counter=100;
-
-# End of 4.1 tests
-
-# BUG #7800: Add various-slave related variables to SHOW VARIABLES
-show variables like 'slave_compressed_protocol';
---replace_column 2 SLAVE_LOAD_TMPDIR
-show variables like 'slave_load_tmpdir';
-# We just set some arbitrary values in variables-master.opt so we can test
-# that a list of values works correctly
-show variables like 'slave_skip_errors';
-
---echo ---- Clean Up ----
-
-set global slave_net_timeout=default;
-# sql_slave_skip_counter is write-only, so we can't save previous
-# value and restore it here. That's ok, because it's normally 0.
-set global sql_slave_skip_counter= 0;
-set @@global.slave_net_timeout= @my_slave_net_timeout;
-
-#
-# Bug#28234 - global/session scope - documentation vs implementation
-#
---echo
-#
-# Additional variables fixed from sql_repl.cc.
-#
---echo #
-SHOW VARIABLES like 'log_slave_updates';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.log_slave_updates;
-SELECT @@global.log_slave_updates;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.log_slave_updates= true;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.log_slave_updates= true;
-#
---echo #
-SHOW VARIABLES like 'relay_log';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.relay_log;
-SELECT @@global.relay_log;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.relay_log= 'x';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.relay_log= 'x';
-#
---echo #
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-SHOW VARIABLES like 'relay_log_basename';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.relay_log_basename;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-SELECT @@global.relay_log_basename;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.relay_log_basename= 'x';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.relay_log_basename= 'x';
-#
---echo #
-SHOW VARIABLES like 'log_bin_basename';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.log_bin_basename;
-SELECT @@global.log_bin_basename;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.log_bin_basename= 'x';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.log_bin_basename= 'x';
-#
---echo #
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-SHOW VARIABLES like 'relay_log_index';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.relay_log_index;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-SELECT @@global.relay_log_index;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.relay_log_index= 'x';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.relay_log_index= 'x';
-#
---echo #
-SHOW VARIABLES like 'log_bin_index';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.log_bin_index;
-SELECT @@global.log_bin_index;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.log_bin_index= 'x';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.log_bin_index= 'x';
-#
---echo #
-SHOW VARIABLES like 'relay_log_info_file';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.relay_log_info_file;
-SELECT @@global.relay_log_info_file;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.relay_log_info_file= 'x';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.relay_log_info_file= 'x';
-#
---echo #
-SHOW VARIABLES like 'relay_log_space_limit';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.relay_log_space_limit;
-SELECT @@global.relay_log_space_limit;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.relay_log_space_limit= 7;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.relay_log_space_limit= 7;
-#
---echo #
---replace_column 2 #
-SHOW VARIABLES like 'slave_load_tmpdir';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.slave_load_tmpdir;
---replace_column 1 #
-SELECT @@global.slave_load_tmpdir;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.slave_load_tmpdir= 'x';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.slave_load_tmpdir= 'x';
-#
---echo #
-SHOW VARIABLES like 'slave_skip_errors';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.slave_skip_errors;
-SELECT @@global.slave_skip_errors;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.slave_skip_errors= 7;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.slave_skip_errors= 7;
-#
-
---echo #
---echo # Bug #11766769 : 59959: SMALL VALUES OF --MAX-ALLOWED-PACKET
---echo # ARE NOT BEING HONORED
---echo #
-
-CREATE TABLE t1 (a MEDIUMTEXT);
-
-SET GLOBAL max_allowed_packet=2048;
-SET GLOBAL net_buffer_length=4096;
-CONNECT (con1,localhost,root,,test);
-SHOW SESSION VARIABLES LIKE 'max_allowed_packet';
-SHOW SESSION VARIABLES LIKE 'net_buffer_length';
---disable_query_log
-#Sending a packet that is too big can result in either
-#ER_NET_PACKET_TOO_LARGE or a socket error on the client side (2013= CR_SERVER_LOST)
-#The server does not make any attempts to gracefully close client connection and ensuring
-#client fully read the last packet. Server just closes the socket after it has send.
-#Client thus can get either a socket error, or EOF, or an error packet with ER_NET_PACKET_TOO_LARGE
---error ER_NET_PACKET_TOO_LARGE,2013
-INSERT INTO t1 VALUES ('123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890');
---enable_query_log
-
-CONNECTION default;
-DISCONNECT con1;
-SELECT LENGTH(a) FROM t1;
-
-SET GLOBAL max_allowed_packet=default;
-SET GLOBAL net_buffer_length=default;
-DROP TABLE t1;
-
---echo End of 5.1 tests
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
deleted file mode 100644
index 4da3cac3a73..00000000000
--- a/mysql-test/t/variables.test
+++ /dev/null
@@ -1,1549 +0,0 @@
-#
-# test variables
-#
---disable_warnings
-drop table if exists t1,t2;
---enable_warnings
-
-#
-# Bug#19263: variables.test doesn't clean up after itself (I/II -- save)
-#
-set @my_binlog_cache_size =@@global.binlog_cache_size;
-set @my_connect_timeout =@@global.connect_timeout;
-set @my_delayed_insert_timeout =@@global.delayed_insert_timeout;
-set @my_delayed_queue_size =@@global.delayed_queue_size;
-set @my_flush =@@global.flush;
-set @my_flush_time =@@global.flush_time;
-set @my_key_buffer_size =@@global.key_buffer_size;
-set @my_max_binlog_cache_size =@@global.max_binlog_cache_size;
-set @my_max_binlog_size =@@global.max_binlog_size;
-set @my_max_connect_errors =@@global.max_connect_errors;
-set @my_max_connections =@@global.max_connections;
-set @my_max_delayed_threads =@@global.max_delayed_threads;
-set @my_max_heap_table_size =@@global.max_heap_table_size;
-set @my_max_insert_delayed_threads=@@global.max_insert_delayed_threads;
-set @my_max_join_size =@@global.max_join_size;
-set @my_max_user_connections =@@global.max_user_connections;
-set @my_myisam_data_pointer_size =@@global.myisam_data_pointer_size;
-set @my_myisam_max_sort_file_size =@@global.myisam_max_sort_file_size;
-set @my_net_buffer_length =@@global.net_buffer_length;
-set @my_net_write_timeout =@@global.net_write_timeout;
-set @my_net_read_timeout =@@global.net_read_timeout;
-set @my_server_id =@@global.server_id;
-set @my_slow_launch_time =@@global.slow_launch_time;
-set @my_storage_engine =@@global.default_storage_engine;
-set @my_thread_cache_size =@@global.thread_cache_size;
-set @my_max_allowed_packet =@@global.max_allowed_packet;
-set @my_delay_key_write =@@global.delay_key_write;
-set @my_join_buffer_size =@@global.join_buffer_size;
-set @my_log_warnings =@@global.log_warnings;
-# case insensitivity tests (new in 5.0)
-set @`test`=1;
-select @test, @`test`, @TEST, @`TEST`, @"teSt";
-set @TEST=2;
-select @test, @`test`, @TEST, @`TEST`, @"teSt";
-set @"tEST"=3;
-select @test, @`test`, @TEST, @`TEST`, @"teSt";
-set @`TeST`=4;
-select @test, @`test`, @TEST, @`TEST`, @"teSt";
-select @`teST`:=5;
-select @test, @`test`, @TEST, @`TEST`, @"teSt";
-
-set @select=2,@t5=1.23456;
-select @`select`,@not_used;
-set @test_int=10,@test_double=1e-10,@test_string="abcdeghi",@test_string2="abcdefghij",@select=NULL;
-# Expected result "1e-10", windows returns "1e-010"
---replace_result 1e-010 1e-10
-select @test_int,@test_double,@test_string,@test_string2,@select;
-set @test_int="hello",@test_double="hello",@test_string="hello",@test_string2="hello";
-select @test_int,@test_double,@test_string,@test_string2;
-set @test_int="hellohello",@test_double="hellohello",@test_string="hellohello",@test_string2="hellohello";
-select @test_int,@test_double,@test_string,@test_string2;
-set @test_int=null,@test_double=null,@test_string=null,@test_string2=null;
-select @test_int,@test_double,@test_string,@test_string2;
-select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3;
-explain extended select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3;
-select @t5;
-
-#
-# Test problem with WHERE and variables
-#
-
-CREATE TABLE t1 (c_id INT(4) NOT NULL, c_name CHAR(20), c_country CHAR(3), PRIMARY KEY(c_id));
-INSERT INTO t1 VALUES (1,'Bozo','USA'),(2,'Ronald','USA'),(3,'Kinko','IRE'),(4,'Mr. Floppy','GB');
-SELECT @min_cid:=min(c_id), @max_cid:=max(c_id) from t1;
-SELECT * FROM t1 WHERE c_id=@min_cid OR c_id=@max_cid;
-SELECT * FROM t1 WHERE c_id=@min_cid OR c_id=@max_cid OR c_id=666;
-ALTER TABLE t1 DROP PRIMARY KEY;
-select * from t1 where c_id=@min_cid OR c_id=@max_cid;
-drop table t1;
-
-#
-# Test system variables
-#
-set GLOBAL max_join_size=10;
-set max_join_size=100;
-show variables like 'max_join_size';
-select * from information_schema.session_variables where variable_name like 'max_join_size';
---replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
-show global variables like 'max_join_size';
---replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
-select * from information_schema.global_variables where variable_name like 'max_join_size';
-set GLOBAL max_join_size=2000;
-show global variables like 'max_join_size';
-select * from information_schema.global_variables where variable_name like 'max_join_size';
-set max_join_size=DEFAULT;
---replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
-show variables like 'max_join_size';
---replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
-select * from information_schema.session_variables where variable_name like 'max_join_size';
-set GLOBAL max_join_size=DEFAULT;
---replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
-show global variables like 'max_join_size';
---replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR
-select * from information_schema.global_variables where variable_name like 'max_join_size';
-set @@max_join_size=1000, @@global.max_join_size=2000;
-select @@local.max_join_size, @@global.max_join_size;
-select @@identity, length(@@version)>0;
-select @@VERSION=version();
-select last_insert_id(345);
-explain extended select last_insert_id(345);
-select @@IDENTITY,last_insert_id(), @@identity;
-explain extended select @@IDENTITY,last_insert_id(), @@identity;
-
-set big_tables=OFF, big_tables=ON, big_tables=0, big_tables=1, big_tables="OFF", big_tables="ON";
-
-set global concurrent_insert=2;
-show variables like 'concurrent_insert';
-select * from information_schema.session_variables where variable_name like 'concurrent_insert';
-set global concurrent_insert=1;
-show variables like 'concurrent_insert';
-select * from information_schema.session_variables where variable_name like 'concurrent_insert';
-set global concurrent_insert=0;
-show variables like 'concurrent_insert';
-select * from information_schema.session_variables where variable_name like 'concurrent_insert';
-set global concurrent_insert=DEFAULT;
-select @@concurrent_insert;
-
-set global timed_mutexes=ON;
-show variables like 'timed_mutexes';
-select * from information_schema.session_variables where variable_name like 'timed_mutexes';
-set global timed_mutexes=0;
-show variables like 'timed_mutexes';
-select * from information_schema.session_variables where variable_name like 'timed_mutexes';
-
-set default_storage_engine=MYISAM, default_storage_engine="HEAP", global default_storage_engine="MERGE";
-show local variables like 'default_storage_engine';
-select * from information_schema.session_variables where variable_name like 'default_storage_engine';
-show global variables like 'default_storage_engine';
-select * from information_schema.global_variables where variable_name like 'default_storage_engine';
-
-set GLOBAL myisam_max_sort_file_size=2000000;
-show global variables like 'myisam_max_sort_file_size';
-select * from information_schema.global_variables where variable_name like 'myisam_max_sort_file_size';
-set GLOBAL myisam_max_sort_file_size=default;
---replace_result 9223372036853727232 FILE_SIZE 2146435072 FILE_SIZE
-show global variables like 'myisam_max_sort_file_size';
---replace_result 9223372036853727232 FILE_SIZE 2146435072 FILE_SIZE
-select * from information_schema.global_variables where variable_name like 'myisam_max_sort_file_size';
-
-# bug#22891: modified to take read-only SESSION net_buffer_length into account
-set global net_retry_count=10, session net_retry_count=10;
-set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300;
-show global variables like 'net_%';
-select * from information_schema.global_variables where variable_name like 'net_%' order by 1;
-show session variables like 'net_%';
-select * from information_schema.session_variables where variable_name like 'net_%' order by 1;
-set global net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000;
-show global variables like 'net_%';
-select * from information_schema.global_variables where variable_name like 'net_%' order by 1;
-set global net_buffer_length=1;
-show global variables like 'net_buffer_length';
-select * from information_schema.global_variables where variable_name like 'net_buffer_length';
-#warning 1292
-set global net_buffer_length=2000000000;
-show global variables like 'net_buffer_length';
-select * from information_schema.global_variables where variable_name like 'net_buffer_length';
-
-set character set cp1251_koi8;
-show variables like "character_set_client";
-select * from information_schema.session_variables where variable_name like 'character_set_client';
-select @@timestamp>0;
-
-set @@rand_seed1=10000000,@@rand_seed2=1000000;
-select ROUND(RAND(),5);
-
-
---echo
---echo ==+ Testing %alloc% system variables +==
---echo ==+ NOTE: These values *must* be a multiple of 1024 +==
---echo ==+ Other values will be rounded down to nearest multiple +==
---echo
---echo ==+ Show initial values +==
-SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size',
-'query_alloc_block_size', 'query_prealloc_size',
-'transaction_alloc_block_size', 'transaction_prealloc_size');
-
---echo ==+ information_schema data +==
-SELECT * FROM information_schema.session_variables
-WHERE variable_name IN ('range_alloc_block_size',
-'query_alloc_block_size', 'query_prealloc_size',
-'transaction_alloc_block_size', 'transaction_prealloc_size') ORDER BY 1;
---echo Testing values that are multiples of 1024
-set @@range_alloc_block_size=1024*15+1024;
-set @@query_alloc_block_size=1024*15+1024*2;
-set @@query_prealloc_size=1024*18-1024;
-set @@transaction_alloc_block_size=1024*21-1024*1;
-set @@transaction_prealloc_size=1024*21-2048;
---echo ==+ Check manipulated values ==+
-select @@query_alloc_block_size;
-SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size',
-'query_alloc_block_size', 'query_prealloc_size',
-'transaction_alloc_block_size', 'transaction_prealloc_size');
---echo ==+ information_schema data +==
-SELECT * FROM information_schema.session_variables
-WHERE variable_name IN ('range_alloc_block_size',
-'query_alloc_block_size', 'query_prealloc_size',
-'transaction_alloc_block_size', 'transaction_prealloc_size') ORDER BY 1;
---echo ==+ Manipulate variable values +==
---echo Testing values that are not 1024 multiples
-set @@range_alloc_block_size=1024*16+1023;
-set @@query_alloc_block_size=1024*17+2;
-set @@query_prealloc_size=1024*18-1023;
-set @@transaction_alloc_block_size=1024*20-1;
-set @@transaction_prealloc_size=1024*21-1;
---echo ==+ Check manipulated values ==+
-SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size',
-'query_alloc_block_size', 'query_prealloc_size',
-'transaction_alloc_block_size', 'transaction_prealloc_size');
---echo ==+ information_schema data +==
-SELECT * FROM information_schema.session_variables
-WHERE variable_name IN ('range_alloc_block_size',
-'query_alloc_block_size', 'query_prealloc_size',
-'transaction_alloc_block_size', 'transaction_prealloc_size') ORDER BY 1;
---echo ==+ Set values back to the default values +==
-set @@range_alloc_block_size=default;
-set @@query_alloc_block_size=default, @@query_prealloc_size=default;
-set transaction_alloc_block_size=default, @@transaction_prealloc_size=default;
---echo ==+ Check the values now that they are reset +==
-SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size',
-'query_alloc_block_size', 'query_prealloc_size',
-'transaction_alloc_block_size', 'transaction_prealloc_size');
-
-#
-# Bug #10904 Illegal mix of collations between
-# a system variable and a constant
-#
-SELECT @@version LIKE 'non-existent';
-SELECT @@version_compile_os LIKE 'non-existent';
-
-# The following should give errors
-
---error ER_WRONG_VALUE_FOR_VAR
-set big_tables=OFFF;
---error ER_WRONG_VALUE_FOR_VAR
-set big_tables="OFFF";
---error ER_UNKNOWN_SYSTEM_VARIABLE
-set unknown_variable=1;
---error ER_WRONG_TYPE_FOR_VAR
-set max_join_size="hello";
---error ER_UNKNOWN_STORAGE_ENGINE
-set default_storage_engine=UNKNOWN_TABLE_TYPE;
---error ER_WRONG_VALUE_FOR_VAR
-set default_storage_engine=MERGE, big_tables=2;
-show local variables like 'default_storage_engine';
---error ER_UNKNOWN_CHARACTER_SET
-set character_set_client=UNKNOWN_CHARACTER_SET;
---error ER_UNKNOWN_COLLATION
-set collation_connection=UNKNOWN_COLLATION;
---error ER_WRONG_VALUE_FOR_VAR
-set character_set_client=NULL;
---error ER_WRONG_VALUE_FOR_VAR
-set collation_connection=NULL;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-select @@global.timestamp;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-set @@version='';
---error ER_GLOBAL_VARIABLE
-set @@concurrent_insert=1;
---error ER_GLOBAL_VARIABLE
-set myisam_max_sort_file_size=100;
---error ER_WRONG_VALUE_FOR_VAR
-set @@SQL_WARNINGS=NULL;
-
-# Test setting all variables
-
-set autocommit=1;
-set big_tables=1;
-select @@autocommit, @@big_tables;
-set global binlog_cache_size=100;
-set bulk_insert_buffer_size=100;
-set character set cp1251_koi8;
-set character set default;
-set @@global.concurrent_insert=1;
-set global connect_timeout=100;
-select @@delay_key_write;
-set global delay_key_write="OFF";
-select @@delay_key_write;
-set global delay_key_write=ALL;
-select @@delay_key_write;
-set global delay_key_write=1;
-select @@delay_key_write;
-set global delayed_insert_limit=100;
-set global delayed_insert_timeout=100;
-set global delayed_queue_size=100;
-set global flush=1;
-set global flush_time=100;
-set insert_id=1;
-set interactive_timeout=100;
-set join_buffer_size=100;
-set last_insert_id=1;
-set global local_infile=1;
-set long_query_time=0.000001;
-select @@long_query_time;
-set long_query_time=100.000001;
-select @@long_query_time;
-set low_priority_updates=1;
-set global max_allowed_packet=100;
-set global max_binlog_cache_size=100;
-set global max_binlog_size=100;
-set global max_connect_errors=100;
-set global max_connections=100;
-set global max_delayed_threads=100;
-set max_heap_table_size=100;
-set max_join_size=100;
-set max_sort_length=100;
-set global max_user_connections=100;
-select @@max_user_connections;
-set global max_write_lock_count=100;
-set myisam_sort_buffer_size=100;
-set global net_buffer_length=100;
-set net_read_timeout=100;
-set net_write_timeout=100;
-set read_buffer_size=100;
-set read_rnd_buffer_size=100;
-set global server_id=100;
-set global slow_launch_time=100;
-set sort_buffer_size=100;
-set @@max_sp_recursion_depth=10;
-select @@max_sp_recursion_depth;
-set @@max_sp_recursion_depth=0;
-select @@max_sp_recursion_depth;
-set sql_auto_is_null=1;
-select @@sql_auto_is_null;
-set @@sql_auto_is_null=0;
-select @@sql_auto_is_null;
-set sql_big_selects=1;
-set sql_buffer_result=1;
-set sql_log_bin=1;
-set sql_log_off=1;
-set sql_quote_show_create=1;
-set sql_safe_updates=1;
-set sql_select_limit=1;
-# reset it, so later tests don't get confused
-set sql_select_limit=default;
-set sql_warnings=1;
-set global table_open_cache=100;
-set default_storage_engine=myisam;
-set global thread_cache_size=100;
-set timestamp=1, timestamp=default;
-set tmp_table_size=1024;
-set tx_isolation="READ-COMMITTED";
-set wait_timeout=100;
-set log_warnings=1;
-set global log_warnings=1;
-
-#
-# Bugs: #20392: INSERT_ID session variable has weird value
-#
-select @@session.insert_id;
-set @save_insert_id=@@session.insert_id;
-set session insert_id=20;
-select @@session.insert_id;
-
-set session last_insert_id=100;
-select @@session.insert_id;
-select @@session.last_insert_id;
-select @@session.insert_id;
-
-set @@session.insert_id=@save_insert_id;
-select @@session.insert_id;
-
-#
-# key buffer
-#
-
-create table t1 (a int not null auto_increment, primary key(a));
-create table t2 (a int not null auto_increment, primary key(a));
-insert into t1 values(null),(null),(null);
-insert into t2 values(null),(null),(null);
-set global key_buffer_size=100000;
-select @@key_buffer_size;
-select * from t1 where a=2;
-select * from t2 where a=3;
-check table t1,t2;
-select max(a) +1, max(a) +2 into @xx,@yy from t1;
-drop table t1,t2;
-
-#
-# error conditions
-#
-
---error ER_UNKNOWN_SYSTEM_VARIABLE
-select @@xxxxxxxxxx;
-select 1;
-
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-select @@session.key_buffer_size;
-
---error ER_GLOBAL_VARIABLE
-set ft_boolean_syntax = @@init_connect;
---error ER_WRONG_VALUE_FOR_VAR
-set global ft_boolean_syntax = @@init_connect;
---error ER_GLOBAL_VARIABLE
-set init_connect = NULL;
-set global init_connect = NULL;
---error ER_GLOBAL_VARIABLE
-set ft_boolean_syntax = @@init_connect;
---error ER_WRONG_VALUE_FOR_VAR
-set global ft_boolean_syntax = @@init_connect;
-
-# Bug#3754 SET GLOBAL myisam_max_sort_file_size doesn't work as
-# expected: check that there is no overflow when 64-bit unsigned
-# variables are set
-
-set global myisam_max_sort_file_size=4294967296;
---replace_result 4294967296 MAX_FILE_SIZE 2146435072 MAX_FILE_SIZE
-show global variables like 'myisam_max_sort_file_size';
---replace_result 4294967296 MAX_FILE_SIZE 2146435072 MAX_FILE_SIZE
-select * from information_schema.global_variables where variable_name like 'myisam_max_sort_file_size';
-set global myisam_max_sort_file_size=default;
-
-#
-# swap
-#
-select @@global.max_user_connections,@@local.max_join_size;
-set @svc=@@global.max_user_connections, @svj=@@local.max_join_size;
-select @@global.max_user_connections,@@local.max_join_size;
-set @@global.max_user_connections=111,@@local.max_join_size=222;
-select @@global.max_user_connections,@@local.max_join_size;
-set @@global.max_user_connections=@@local.max_join_size,@@local.max_join_size=@@global.max_user_connections;
-select @@global.max_user_connections,@@local.max_join_size;
-set @@global.max_user_connections=@svc, @@local.max_join_size=@svj;
-select @@global.max_user_connections,@@local.max_join_size;
-set @a=1, @b=2;
-set @a=@b, @b=@a;
-select @a, @b;
-
-#
-# Bug#2586:Disallow global/session/local as structured var. instance names
-#
---error ER_UNKNOWN_STRUCTURED_VARIABLE
-set @@global.global.key_buffer_size= 1;
---error ER_UNKNOWN_STRUCTURED_VARIABLE
-set GLOBAL global.key_buffer_size= 1;
---error ER_PARSE_ERROR
-SELECT @@global.global.key_buffer_size;
---error ER_PARSE_ERROR
-SELECT @@global.session.key_buffer_size;
---error ER_PARSE_ERROR
-SELECT @@global.local.key_buffer_size;
-
-# BUG#5135: cannot turn on log_warnings with SET in 4.1 (and 4.0)
-set @tstlw = @@log_warnings;
-show global variables like 'log_warnings';
-select * from information_schema.global_variables where variable_name like 'log_warnings';
-set global log_warnings = 0;
-show global variables like 'log_warnings';
-select * from information_schema.global_variables where variable_name like 'log_warnings';
-set global log_warnings = 42;
-show global variables like 'log_warnings';
-select * from information_schema.global_variables where variable_name like 'log_warnings';
-set global log_warnings = @tstlw;
-show global variables like 'log_warnings';
-select * from information_schema.global_variables where variable_name like 'log_warnings';
-
-#
-# BUG#4788 show create table provides incorrect statement
-#
-# What default width have numeric types?
-create table t1 (
- c1 tinyint,
- c2 smallint,
- c3 mediumint,
- c4 int,
- c5 bigint);
-show create table t1;
-drop table t1;
-#
-# What types and widths have variables?
-set @arg00= 8, @arg01= 8.8, @arg02= 'a string', @arg03= 0.2e0;
-create table t1 as select @arg00 as c1, @arg01 as c2, @arg02 as c3, @arg03 as c4;
-show create table t1;
-drop table t1;
-
-
-#
-# Bug #6993: myisam_data_pointer_size
-# Wrong bug report, data pointer size must be restricted to 7,
-# setting to 8 will not work on all computers, myisamchk and
-# the server may see a wrong value, such as 0 or negative number
-# if 8 bytes is set.
-#
-
-SET GLOBAL MYISAM_DATA_POINTER_SIZE= 7;
-SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE';
-SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'MYISAM_DATA_POINTER_SIZE';
-
-#
-# Bug #6958: negative arguments to integer options wrap around
-#
-
-SET GLOBAL table_open_cache=-1;
-SHOW VARIABLES LIKE 'table_open_cache';
-SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'table_open_cache';
-SET GLOBAL table_open_cache=DEFAULT;
-
-#
-# Bugs12363: character_set_results is nullable,
-# but value_ptr returns string "NULL"
-#
-set character_set_results=NULL;
-select ifnull(@@character_set_results,"really null");
-set names latin1;
-
-#
-# Tests for lc_time_names
-# Note, when adding new locales, please fix ID accordingly:
-# - to test the last ID (currently 108)
-# - and the next after the last (currently 109)
-#
---echo *** Various tests with LC_TIME_NAMES
---echo *** LC_TIME_NAMES: testing case insensitivity
-set @@lc_time_names='ru_ru';
-select @@lc_time_names;
---echo *** LC_TIME_NAMES: testing with a user variable
-set @lc='JA_JP';
-set @@lc_time_names=@lc;
-select @@lc_time_names;
---echo *** LC_TIME_NAMES: testing with string expressions
-set lc_time_names=concat('de','_','DE');
-select @@lc_time_names;
---error ER_UNKNOWN_LOCALE
-set lc_time_names=concat('de','+','DE');
-select @@lc_time_names;
---echo LC_TIME_NAMES: testing with numeric expressions
-set @@lc_time_names=1+2;
-select @@lc_time_names;
---error ER_WRONG_TYPE_FOR_VAR
-set @@lc_time_names=1/0;
-select @@lc_time_names;
-set lc_time_names=en_US;
---echo LC_TIME_NAMES: testing NULL and a negative number:
---error ER_WRONG_VALUE_FOR_VAR
-set lc_time_names=NULL;
---error ER_UNKNOWN_LOCALE
-set lc_time_names=-1;
-select @@lc_time_names;
---echo LC_TIME_NAMES: testing locale with the last ID:
-set lc_time_names=110;
-select @@lc_time_names;
---echo LC_TIME_NAMES: testing a number beyond the valid ID range:
---error ER_UNKNOWN_LOCALE
-set lc_time_names=111;
-select @@lc_time_names;
---echo LC_TIME_NAMES: testing that 0 is en_US:
-set lc_time_names=0;
-select @@lc_time_names;
-
-#
-# Bug #22648 LC_TIME_NAMES: Setting GLOBAL has no effect
-#
-select @@global.lc_time_names, @@lc_time_names;
-set @@global.lc_time_names=fr_FR;
-select @@global.lc_time_names, @@lc_time_names;
-connect (con1,localhost,root,,);
-connection con1;
-select @@global.lc_time_names, @@lc_time_names;
-set @@lc_time_names=ru_RU;
-select @@global.lc_time_names, @@lc_time_names;
-disconnect con1;
-connection default;
-select @@global.lc_time_names, @@lc_time_names;
-set lc_time_names=default;
-select @@global.lc_time_names, @@lc_time_names;
-set @@global.lc_time_names=default;
-select @@global.lc_time_names, @@lc_time_names;
-set @@lc_time_names=default;
-select @@global.lc_time_names, @@lc_time_names;
-
-
-#
-# Bug #13334: query_prealloc_size default less than minimum
-#
-set @test = @@query_prealloc_size;
-set @@query_prealloc_size = @test;
-select @@query_prealloc_size = @test;
-
-#
-# Bug#31588 buffer overrun when setting variables
-#
-# Buffer-size Off By One. Should throw valgrind-warning without fix #31588.
---error ER_WRONG_VALUE_FOR_VAR
-set global sql_mode=repeat('a',80);
-
---echo End of 4.1 tests
-
-#
-# Bug#6282 Packet error with SELECT INTO
-#
-
-create table t1 (a int);
-select a into @x from t1;
-show warnings;
-drop table t1;
-
-#
-# Bug #10339: read only variables.
-#
-
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-set @@warning_count=1;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-set @@global.error_count=1;
-
-#
-# Bug #10351: Setting ulong variable to > MAX_ULONG fails on 32-bit platform
-#
-
---disable_warnings
-set @@max_heap_table_size= 4294967296;
-select @@max_heap_table_size > 0;
-set global max_heap_table_size= 4294967296;
-select @@max_heap_table_size > 0;
-set @@max_heap_table_size= 4294967296;
-select @@max_heap_table_size > 0;
---enable_warnings
-
-#
-# Bug #11775 Variable character_set_system does not exist (sometimes)
-#
-select @@character_set_system;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-set global character_set_system = latin1;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-set @@global.version_compile_os='234';
-
-#
-# Check character_set_filesystem variable
-#
-set character_set_filesystem=latin1;
-select @@character_set_filesystem;
-set @@global.character_set_filesystem=latin2;
-set character_set_filesystem=latin1;
-select @@character_set_filesystem;
-set @@global.character_set_filesystem=latin2;
-set character_set_filesystem=default;
-select @@character_set_filesystem;
-set @@global.character_set_filesystem=default;
-select @@global.character_set_filesystem;
-
-#
-# Bug #17849: Show sql_big_selects in SHOW VARIABLES
-#
-set @old_sql_big_selects = @@sql_big_selects;
-set @@sql_big_selects = 1;
-show variables like 'sql_big_selects';
-select * from information_schema.session_variables where variable_name like 'sql_big_selects';
-set @@sql_big_selects = @old_sql_big_selects;
-
-#
-# Bug #16195: SHOW VARIABLES doesn't report correctly sql_warnings and
-# sql_notes values
-#
-set @@sql_notes = 0, @@sql_warnings = 0;
-show variables like 'sql_notes';
-select * from information_schema.session_variables where variable_name like 'sql_notes';
-show variables like 'sql_warnings';
-select * from information_schema.session_variables where variable_name like 'sql_warnings';
-set @@sql_notes = 1, @@sql_warnings = 1;
-show variables like 'sql_notes';
-select * from information_schema.session_variables where variable_name like 'sql_notes';
-show variables like 'sql_warnings';
-select * from information_schema.session_variables where variable_name like 'sql_warnings';
-
-#
-# Bug #12792: @@system_time_zone is not SELECTable.
-#
-# Don't actually output, since it depends on the system
---replace_column 1 #
-select @@system_time_zone;
-
-#
-# Bug #15684: system variables cannot be SELECTed (e.g. @@version_comment)
-#
-# Don't actually output, since it depends on the system
---replace_column 1 # 2 # 3 # 4 #
-select @@version, @@version_comment, @@version_compile_machine,
- @@version_compile_os;
-
-#
-# Bug #1039: make tmpdir and datadir available as @@variables (also included
-# basedir)
-#
-# Don't actually output, since it depends on the system
---replace_column 1 # 2 # 3 #
-select @@basedir, @@datadir, @@tmpdir;
---replace_column 2 #
-show variables like 'basedir';
---replace_column 2 #
-select * from information_schema.session_variables where variable_name like 'basedir';
---replace_column 2 #
-show variables like 'datadir';
---replace_column 2 #
-select * from information_schema.session_variables where variable_name like 'datadir';
---replace_column 2 #
-show variables like 'tmpdir';
---replace_column 2 #
-select * from information_schema.session_variables where variable_name like 'tmpdir';
-
-#
-# Bug #19606: make ssl settings available via SHOW VARIABLES and @@variables
-#
-# Don't actually output, since it depends on the system
-set sort_buffer_size=1024*8;
---replace_column 1 # 2 # 3 # 4 # 5 #
-select @@ssl_ca, @@ssl_capath, @@ssl_cert, @@ssl_cipher, @@ssl_key;
---replace_column 2 #
-show variables like 'ssl%';
---replace_column 2 #
-select * from information_schema.session_variables where variable_name like 'ssl%' order by 1;
-
-#
-# Bug #19616: make log_queries_not_using_indexes available in SHOW VARIABLES
-# and as @@log_queries_not_using_indexes
-#
-select @@log_queries_not_using_indexes;
-show variables like 'log_queries_not_using_indexes';
-select * from information_schema.session_variables where variable_name like 'log_queries_not_using_indexes';
-
-#
-# Bug#20908: Crash if select @@""
-#
---error ER_PARSE_ERROR
-select @@"";
---error ER_PARSE_ERROR
-select @@&;
---error ER_PARSE_ERROR
-select @@@;
-
-#
-# Bug#20166 mysql-test-run.pl does not test system privilege tables creation
-#
-# Don't actually output, since it depends on the system
---replace_column 1 #
-select @@hostname;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-set @@hostname= "anothername";
---replace_column 2 #
-show variables like 'hostname';
-
---echo #
---echo # BUG#37408 - Compressed MyISAM files should not require/use mmap()
---echo #
---echo # Test 'myisam_mmap_size' option is not dynamic
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@myisam_mmap_size= 500M;
-
-
---echo #
---echo # Bug #52315: utc_date() crashes when system time > year 2037
---echo #
-
---error 0, ER_WRONG_VALUE_FOR_VAR
-SET TIMESTAMP=2*1024*1024*1024;
---echo #Should not crash
---disable_result_log
-SELECT UTC_DATE();
---enable_result_log
-SET TIMESTAMP=DEFAULT;
-
-
---echo End of 5.0 tests
-
-#
-# Bug#36446: Attempt to set @@join_buffer_size to its minimum value
-# produces spurious warning
-#
-
-# set to 1 so mysqld will correct to minimum (+ warn)
-set join_buffer_size=1;
-# save minimum
-set @save_join_buffer_size=@@join_buffer_size;
-# set minimum
-set join_buffer_size=@save_join_buffer_size;
-
-# This is at the very after the versioned tests, since it involves doing
-# cleanup
-#
-# Bug #19263: variables.test doesn't clean up after itself (II/II --
-# restore)
-#
-set global binlog_cache_size =@my_binlog_cache_size;
-set global connect_timeout =@my_connect_timeout;
-set global delayed_insert_timeout =@my_delayed_insert_timeout;
-set global delayed_queue_size =@my_delayed_queue_size;
-set global flush =@my_flush;
-set global flush_time =@my_flush_time;
-set global key_buffer_size =@my_key_buffer_size;
-set global max_binlog_cache_size =@my_max_binlog_cache_size;
-set global max_binlog_size =@my_max_binlog_size;
-set global max_connect_errors =@my_max_connect_errors;
-set global max_connections =@my_max_connections;
-set global max_delayed_threads =@my_max_delayed_threads;
-set global max_heap_table_size =@my_max_heap_table_size;
-set global max_insert_delayed_threads=@my_max_insert_delayed_threads;
-set global max_join_size =@my_max_join_size;
-set global max_user_connections =@my_max_user_connections;
-set global max_write_lock_count =default;
-set global myisam_data_pointer_size =@my_myisam_data_pointer_size;
-set global myisam_max_sort_file_size =@my_myisam_max_sort_file_size;
-set global net_buffer_length =@my_net_buffer_length;
-set global net_write_timeout =@my_net_write_timeout;
-set global net_read_timeout =@my_net_read_timeout;
-set global server_id =@my_server_id;
-set global slow_launch_time =@my_slow_launch_time;
-set global default_storage_engine =@my_storage_engine;
-set global thread_cache_size =@my_thread_cache_size;
-set global max_allowed_packet = default;
-set global delay_key_write =@my_delay_key_write;
-set global join_buffer_size =@my_join_buffer_size;
-set global log_warnings =@my_log_warnings;
-
-#
-# Bug#28580 Repeatation of status variables
-#
---replace_column 2 #
-show global variables where Variable_name='table_definition_cache';
-# Note: table_lock_wait_timeout no longer exists. See bug#45225.
-
-###########################################################################
-
---echo
---echo # --
---echo # -- Bug#34820: log_output can be set to illegal value.
---echo # --
-
---error ER_WRONG_VALUE_FOR_VAR
-SET GLOBAL log_output = '';
-
---error ER_WRONG_VALUE_FOR_VAR
-SET GLOBAL log_output = 0;
-
---echo
---echo # -- End of Bug#34820.
-
-#
-# Bug#28234 - global/session scope - documentation vs implementation
-#
---echo
---echo #
-SHOW VARIABLES like 'ft_max_word_len';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.ft_max_word_len;
-SELECT @@global.ft_max_word_len;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.ft_max_word_len= 7;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.ft_max_word_len= 7;
-#
---echo #
-SHOW VARIABLES like 'ft_min_word_len';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.ft_min_word_len;
-SELECT @@global.ft_min_word_len;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.ft_min_word_len= 7;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.ft_min_word_len= 7;
-#
---echo #
-SHOW VARIABLES like 'ft_query_expansion_limit';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.ft_query_expansion_limit;
-SELECT @@global.ft_query_expansion_limit;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.ft_query_expansion_limit= 7;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.ft_query_expansion_limit= 7;
-#
---echo #
-SHOW VARIABLES like 'ft_stopword_file';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.ft_stopword_file;
-SELECT @@global.ft_stopword_file;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.ft_stopword_file= 'x';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.ft_stopword_file= 'x';
-#
-# Additional variables fixed.
-#
---echo #
-SHOW VARIABLES like 'back_log';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.back_log;
-SELECT @@global.back_log;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.back_log= 7;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.back_log= 7;
-#
---echo #
---replace_column 2 #
-SHOW VARIABLES like 'large_files_support';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.large_files_support;
---replace_column 1 #
-SELECT @@global.large_files_support;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.large_files_support= true;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.large_files_support= true;
-#
---echo #
---replace_column 2 #
-SHOW VARIABLES like 'character_sets_dir';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.character_sets_dir;
---replace_column 1 #
-SELECT @@global.character_sets_dir;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.character_sets_dir= 'x';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.character_sets_dir= 'x';
-#
---echo #
---replace_column 2 #
-SHOW VARIABLES like 'init_file';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.init_file;
---replace_column 1 #
-SELECT @@global.init_file;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.init_file= 'x';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.init_file= 'x';
-#
---echo #
---replace_column 2 #
-SHOW VARIABLES like 'lc_messages_dir';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.lc_messages_dir;
---replace_column 1 #
-SELECT @@global.lc_messages_dir;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.lc_messages_dir= 'x';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.lc_messages_dir= 'x';
-#
---echo #
---replace_column 2 #
-SHOW VARIABLES like 'large_page_size';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.large_page_size;
---replace_column 1 #
-SELECT @@global.large_page_size;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.large_page_size= 7;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.large_page_size= 7;
-#
---echo #
---replace_column 2 #
-SHOW VARIABLES like 'large_pages';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.large_pages;
---replace_column 1 #
-SELECT @@global.large_pages;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.large_pages= true;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.large_pages= true;
-#
---echo #
-SHOW VARIABLES like 'log_bin';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.log_bin;
-SELECT @@global.log_bin;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.log_bin= true;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.log_bin= true;
-#
---echo #
---replace_column 2 #
-SHOW VARIABLES like 'log_error';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.log_error;
---replace_column 1 #
-SELECT @@global.log_error;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.log_error= 'x';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.log_error= 'x';
-#
---echo #
---replace_column 2 #
-SHOW VARIABLES like 'lower_case_file_system';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.lower_case_file_system;
---replace_column 1 #
-SELECT @@global.lower_case_file_system;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.lower_case_file_system= true;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.lower_case_file_system= true;
-#
---echo #
---replace_column 2 #
-SHOW VARIABLES like 'lower_case_table_names';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.lower_case_table_names;
---replace_column 1 #
-SELECT @@global.lower_case_table_names;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.lower_case_table_names= 7;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.lower_case_table_names= 7;
-#
---echo #
-SHOW VARIABLES like 'myisam_recover_options';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.myisam_recover_options;
-SELECT @@global.myisam_recover_options;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.myisam_recover_options= 'x';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.myisam_recover_options= 'x';
-#
---echo #
---replace_column 2 #
-SHOW VARIABLES like 'open_files_limit';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.open_files_limit;
---replace_column 1 #
-SELECT @@global.open_files_limit;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.open_files_limit= 7;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.open_files_limit= 7;
-#
---echo #
---replace_column 2 #
-SHOW VARIABLES like 'pid_file';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.pid_file;
---replace_column 1 #
-SELECT @@global.pid_file;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.pid_file= 'x';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.pid_file= 'x';
-#
---echo #
---replace_column 2 #
-SHOW VARIABLES like 'plugin_dir';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.plugin_dir;
---replace_column 1 #
-SELECT @@global.plugin_dir;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.plugin_dir= 'x';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.plugin_dir= 'x';
-#
---echo #
---replace_column 2 #
-SHOW VARIABLES like 'port';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.port;
---replace_column 1 #
-SELECT @@global.port;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.port= 7;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.port= 7;
-#
---echo #
-SHOW VARIABLES like 'protocol_version';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.protocol_version;
-SELECT @@global.protocol_version;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.protocol_version= 7;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.protocol_version= 7;
-#
---echo #
-SHOW VARIABLES like 'skip_external_locking';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.skip_external_locking;
-SELECT @@global.skip_external_locking;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.skip_external_locking= true;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.skip_external_locking= true;
-#
---echo #
-SHOW VARIABLES like 'skip_networking';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.skip_networking;
-SELECT @@global.skip_networking;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.skip_networking= true;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.skip_networking= true;
-#
---echo #
-SHOW VARIABLES like 'skip_show_database';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.skip_show_database;
-SELECT @@global.skip_show_database;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.skip_show_database= true;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.skip_show_database= true;
-#
---echo #
---replace_column 2 #
-SHOW VARIABLES like 'thread_stack';
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT @@session.thread_stack;
---replace_column 1 #
-SELECT @@global.thread_stack;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@session.thread_stack= 7;
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@global.thread_stack= 7;
-#
-
-#
-# Bug #40657 - assertion with out of range variables and traditional sql_mode
-#
-
-SELECT @@global.expire_logs_days INTO @old_eld;
-
-SET GLOBAL expire_logs_days = -1;
---echo needs to've been adjusted (0)
-SELECT @@global.expire_logs_days;
-
-SET GLOBAL expire_logs_days = 11;
-SET @old_mode=@@sql_mode;
-SET SESSION sql_mode = 'TRADITIONAL';
---error ER_WRONG_VALUE_FOR_VAR
-SET GLOBAL expire_logs_days = 100;
---echo needs to be unchanged (11)
-SELECT @@global.expire_logs_days;
-SET SESSION sql_mode = @old_mode;
-
-SET GLOBAL expire_logs_days = 100;
---echo needs to've been adjusted (99)
-SELECT @@global.expire_logs_days;
-
-SET GLOBAL expire_logs_days = 11;
-SET GLOBAL expire_logs_days = 99;
---echo needs to pass with no warnings (99)
-SELECT @@global.expire_logs_days;
-
-# cleanup
-SET GLOBAL expire_logs_days = @old_eld;
-
-# show that warning uses underscore (sysvar-name), not hyphens (option-name)
-SET GLOBAL auto_increment_offset=-1;
-SET GLOBAL auto_increment_offset=0;
-
-
-
-#
-# Bug#41030 Wrong meta data (incorrect fieldlen)
-#
-
---enable_metadata
-select @@default_storage_engine;
---disable_metadata
-
-#
-# Bug#36540: CREATE EVENT and ALTER EVENT statements fail with large server_id
-#
-
-SET @old_server_id = @@GLOBAL.server_id;
-SET GLOBAL server_id = (1 << 32) - 1;
-SELECT @@GLOBAL.server_id;
-SET GLOBAL server_id = (1 << 32);
-SELECT @@GLOBAL.server_id;
-SET GLOBAL server_id = (1 << 60);
-SELECT @@GLOBAL.server_id;
-SET GLOBAL server_id = 0;
-SELECT @@GLOBAL.server_id;
-SET GLOBAL server_id = -1;
-SELECT @@GLOBAL.server_id;
-SET GLOBAL server_id = @old_server_id;
-
---echo #
---echo # BUG#10206 - InnoDB: Transaction requiring Max_BinLog_Cache_size > 4GB always rollsback
---echo #
-
-SET @old_max_binlog_cache_size = @@GLOBAL.max_binlog_cache_size;
---echo # Set the max_binlog_cache_size to size more than 4GB.
---disable_warnings
-SET GLOBAL max_binlog_cache_size = 5 * 1024 * 1024 * 1024;
---enable_warnings
---replace_result 5368709120 max_size 4294963200 max_size
-SELECT @@GLOBAL.max_binlog_cache_size;
-SET GLOBAL max_binlog_cache_size = @old_max_binlog_cache_size;
-
---echo #
---echo # Bug #37168 : Missing variable - skip_name_resolve
---echo #
-
-SELECT @@skip_name_resolve;
-SHOW VARIABLES LIKE 'skip_name_resolve';
-
---echo #
---echo # Bug #43233 : Some server variables are clipped during "update,"
---echo # not "check" stage
---echo #
-
-SET @kbs=@@global.key_buffer_size;
-SET @kcbs=@@global.key_cache_block_size;
-
---echo throw errors in STRICT mode
-SET SQL_MODE=STRICT_ALL_TABLES;
-
-# sys_var_ulonglong_ptr: sys_max_binlog_cache_size
---error ER_WRONG_VALUE_FOR_VAR
-SET @@global.max_binlog_cache_size=-1;
-
-# sys_var_thd_ha_rows: "max_join_size" et al.
---error ER_WRONG_VALUE_FOR_VAR
-SET @@global.max_join_size=0;
-
-# sys_var_key_buffer_size: "key_buffer_size"
---error ER_WARN_CANT_DROP_DEFAULT_KEYCACHE
-SET @@global.key_buffer_size=0;
-
-# sys_var_key_cache_long: "key_cache_block_size" et al.
---error ER_WRONG_VALUE_FOR_VAR
-SET @@global.key_cache_block_size=0;
-
---echo throw warnings in default mode
-SET SQL_MODE=DEFAULT;
-
-SET @@global.max_binlog_cache_size=-1;
-SET @@global.max_join_size=0;
-# this is an exception. since this is a new error/warning, let's stay
-# compatible with the upcoming 5.6.
---error ER_WARN_CANT_DROP_DEFAULT_KEYCACHE
-SET @@global.key_buffer_size=0;
-SET @@global.key_cache_block_size=0;
-
-# Restore variables
-SET @@global.max_binlog_cache_size=DEFAULT;
-SET @@global.max_join_size=DEFAULT;
-SET @@global.key_buffer_size=@kbs;
-SET @@global.key_cache_block_size=@kcbs;
-
-#
-# Bug#56976: added new start-up parameter
-#
-select @@max_long_data_size;
-
---echo #
---echo # Bug#11766424 59527:
---echo # Assert in DECIMAL_BIN_SIZE:
---echo # `SCALE >= 0 && PRECISION > 0 && SCALE <= PRE
---echo # This test also exposed a bug with sql_buffer_result
---echo #
-
-CREATE TABLE t1(f1 DECIMAL(1,1) UNSIGNED);
-INSERT INTO t1 VALUES (0.2),(0.1);
-set @a=NULL;
-set sql_buffer_result=0;
-SELECT 1 as 'one' FROM t1 GROUP BY @a:= ROUND(f1);
-
-explain SELECT 1 as 'one' FROM t1 GROUP BY @a:= (SELECT ROUND(f1) FROM t1 WHERE f1 = 0);
-SELECT 1 as 'one' FROM t1 GROUP BY @a:= (SELECT ROUND(f1) FROM t1 WHERE f1 = 0);
-SELECT 1 as 'one' FROM t1 GROUP BY @a:= (SELECT ROUND(f1) FROM t1 WHERE @a=f1);
-
-set sql_buffer_result=1;
-explain SELECT 1 as 'one' FROM t1 GROUP BY @a:= (SELECT ROUND(f1) FROM t1 WHERE f1 = 0);
-SELECT 1 as 'one' FROM t1 GROUP BY @a:= (SELECT ROUND(f1) FROM t1 WHERE f1 = 0);
-SELECT 1 as 'one' FROM t1 GROUP BY @a:= (SELECT ROUND(f1) FROM t1 WHERE @a=f1);
-
-DROP TABLE t1;
-
-set sql_buffer_result=0;
-
-#
-# Test of CREATE ... CAST
-#
-
-CREATE TABLE t1 AS SELECT @a:= CAST(1 AS UNSIGNED) AS a;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
---echo End of 5.1 tests
-
-###########################################################################
-
---echo
---echo #
---echo # Bug#34828: OF is taken as OFF and a value of 0 is set for variable SQL_notes.
---echo #
---echo
-
---echo # Checking sql_notes...
-SET @sql_notes_saved = @@sql_notes;
-
---echo
-SET @@sql_notes = ON;
-SELECT @@sql_notes;
-
---echo
---error ER_WRONG_VALUE_FOR_VAR
-SET @@sql_notes = OF;
-SELECT @@sql_notes;
-
---echo
-SET @@sql_notes = OFF;
-SELECT @@sql_notes;
-
---echo
-SET @@sql_notes = @sql_notes_saved;
-
---echo
---echo # Checking delay_key_write...
-SET @delay_key_write_saved = @@delay_key_write;
-
---echo
-SET GLOBAL delay_key_write = ON;
-SELECT @@delay_key_write;
-
---echo
---error ER_WRONG_VALUE_FOR_VAR
-SET GLOBAL delay_key_write = OF;
-SELECT @@delay_key_write;
-
---echo
---error ER_WRONG_VALUE_FOR_VAR
-SET GLOBAL delay_key_write = AL;
-SELECT @@delay_key_write;
-
---echo
-SET GLOBAL delay_key_write = OFF;
-SELECT @@delay_key_write;
-
---echo
-SET GLOBAL delay_key_write = ALL;
-SELECT @@delay_key_write;
-
---echo
-SET GLOBAL delay_key_write = @delay_key_write_saved;
-
---echo
---echo # Checking sql_safe_updates...
-SET @sql_safe_updates_saved = @@sql_safe_updates;
-
---echo
-SET @@sql_safe_updates = ON;
-SELECT @@sql_safe_updates;
-
---echo
---error ER_WRONG_VALUE_FOR_VAR
-SET @@sql_safe_updates = OF;
-SELECT @@sql_safe_updates;
-
---echo
-SET @@sql_safe_updates = OFF;
-SELECT @@sql_safe_updates;
-
---echo
-SET @@sql_safe_updates = @sql_safe_updates_saved;
-
---echo
---echo # Checking foreign_key_checks...
-SET @foreign_key_checks_saved = @@foreign_key_checks;
-
---echo
-SET @@foreign_key_checks = ON;
-SELECT @@foreign_key_checks;
-
---echo
---error ER_WRONG_VALUE_FOR_VAR
-SET @@foreign_key_checks = OF;
-SELECT @@foreign_key_checks;
-
---echo
-SET @@foreign_key_checks = OFF;
-SELECT @@foreign_key_checks;
-
---echo
-SET @@foreign_key_checks = @foreign_key_checks_saved;
-
---echo
---echo # Checking unique_checks...
-SET @unique_checks_saved = @@unique_checks;
-
---echo
-SET @@unique_checks = ON;
-SELECT @@unique_checks;
-
---echo
---error ER_WRONG_VALUE_FOR_VAR
-SET @@unique_checks = OF;
-SELECT @@unique_checks;
-
---echo
-SET @@unique_checks = OFF;
-SELECT @@unique_checks;
-
---echo
-SET @@unique_checks = @unique_checks_saved;
-
---echo
---echo # Checking sql_buffer_result...
-SET @sql_buffer_result_saved = @@sql_buffer_result;
-
---echo
-SET @@sql_buffer_result = ON;
-SELECT @@sql_buffer_result;
-
---echo
---error ER_WRONG_VALUE_FOR_VAR
-SET @@sql_buffer_result = OF;
-SELECT @@sql_buffer_result;
-
---echo
-SET @@sql_buffer_result = OFF;
-SELECT @@sql_buffer_result;
-
---echo
-SET @@sql_buffer_result = @sql_buffer_result_saved;
-
---echo
---echo # Checking sql_quote_show_create...
-SET @sql_quote_show_create_saved = @@sql_quote_show_create;
-
---echo
-SET @@sql_quote_show_create = ON;
-SELECT @@sql_quote_show_create;
-
---echo
---error ER_WRONG_VALUE_FOR_VAR
-SET @@sql_quote_show_create = OF;
-SELECT @@sql_quote_show_create;
-
---echo
-SET @@sql_quote_show_create = OFF;
-SELECT @@sql_quote_show_create;
-
---echo
-SET @@sql_quote_show_create = @sql_quote_show_create_saved;
-
---echo
---echo # End of Bug#34828.
---echo
-
---echo # Make sure we can manipulate with autocommit in the
---echo # along with other variables.
-
-
---disable_warnings
-drop table if exists t1;
-drop function if exists t1_max;
-drop function if exists t1_min;
---enable_warnings
-
-set sql_mode="";
---disable_warnings
-create table t1 (a int) engine=innodb;
---enable_warnings
-set sql_mode=default;
-insert into t1(a) values (0), (1);
-create function t1_max() returns int return (select max(a) from t1);
-create function t1_min() returns int return (select min(a) from t1);
-select t1_min();
-select t1_max();
-set @@session.autocommit=t1_min(), @@session.autocommit=t1_max(),
- @@session.autocommit=t1_min(), @@session.autocommit=t1_max(),
- @@session.autocommit=t1_min(), @@session.autocommit=t1_max();
-
---echo # Cleanup.
-drop table t1;
-drop function t1_min;
-drop function t1_max;
-
-
-###########################################################################
-
-
---echo #
---echo # Bug #59884: setting charset to 2048 crashes
---echo #
-
---error ER_UNKNOWN_CHARACTER_SET
-set session character_set_results = 2048;
---error ER_UNKNOWN_CHARACTER_SET
-set session character_set_client=2048;
---error ER_UNKNOWN_CHARACTER_SET
-set session character_set_connection=2048;
---error ER_UNKNOWN_CHARACTER_SET
-set session character_set_server=2048;
---error ER_UNKNOWN_COLLATION
-set session collation_server=2048;
---error ER_UNKNOWN_CHARACTER_SET
-set session character_set_filesystem=2048;
---error ER_UNKNOWN_CHARACTER_SET
-set session character_set_database=2048;
---error ER_UNKNOWN_COLLATION
-set session collation_connection=2048;
---error ER_UNKNOWN_COLLATION
-set session collation_database=2048;
-
-#
-# Bug #16044655 CRASH: SETTING DEFAULT VALUE FOR SOME VARIABLES
-#
---error ER_NO_DEFAULT
-set session rand_seed1=DEFAULT;
-
-#
-# Bug #14211565 CRASH WHEN ATTEMPTING TO SET SYSTEM VARIABLE TO RESULT OF VALUES()
-#
---error ER_BAD_FIELD_ERROR
-set autocommit = value(v);
-
-#
-# MDEV-6673 I_S.SESSION_VARIABLES shows global values
-#
-set session sql_mode=ansi_quotes;
-select * from information_schema.session_variables where variable_name='sql_mode';
-show global status like 'foobar';
-select * from information_schema.session_variables where variable_name='sql_mode';
-
---echo End of 5.5 tests
-
-#
-# test Item_func_get_system_var::print()
-#
-explain extended select @@VERsion from dual where rand() > @@verSION;
-explain extended select @@SESsion.SQL_mode from dual where rand() > @@sesSION.sql_MODE;
-explain extended select @@GLObal.COLLATION_connection from dual where rand() > @@gloBAL.collation_CONNECTION;
-explain extended select @@FOObar.KEY_BUFfer_size from dual where rand() > @@fooBAR.key_bufFER_SIZE;
-
---echo #
---echo # MDEV-15316 Assertion `(thd->lex)->var_list.is_empty()' failed in MYSQLparse
---echo #
-
-SET GLOBAL mc.key_cache_age_threshold=100, mc.key_cache_block_size=1024;
-SET GLOBAL mc.key_buffer_size= 0 /*cleanup*/;
diff --git a/mysql-test/t/variables_community.test b/mysql-test/t/variables_community.test
deleted file mode 100644
index aa4bc6c631c..00000000000
--- a/mysql-test/t/variables_community.test
+++ /dev/null
@@ -1,11 +0,0 @@
---source include/have_profiling.inc
-
-#
-# Bug#24822: Patch: uptime_since_flush_status
-#
---replace_column 2 #
-show global status like "Uptime_%";
-flush status;
---replace_column 2 #
-show global status like "Uptime_%"; # Almost certainly zero
-
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
deleted file mode 100644
index f78ddd6f49e..00000000000
--- a/mysql-test/t/view.test
+++ /dev/null
@@ -1,6223 +0,0 @@
---source include/have_partition.inc
-# Save the initial number of concurrent sessions.
---source include/count_sessions.inc
-
-SET @save_optimizer_switch=@@optimizer_switch;
-SET optimizer_switch='outer_join_with_cache=off';
-
-#
-# some basic test of views and its functionality
-#
-
-# create view on nonexistent table
--- error ER_NO_SUCH_TABLE
-create view v1 (c,d) as select a,b from t1;
-
-create temporary table t1 (a int, b int);
-# view on temporary table
--- error ER_VIEW_SELECT_TMPTABLE
-create view v1 (c) as select b+1 from t1;
-drop table t1;
-
-create table t1 (a int, b int);
-insert into t1 values (1,2), (1,3), (2,4), (2,5), (3,10);
-
-# view with variable
--- error ER_VIEW_SELECT_VARIABLE
-create view v1 (c,d) as select a,b+@@global.max_user_connections from t1;
--- error ER_VIEW_SELECT_VARIABLE
-create view v1 (c,d) as select a,b from t1
- where a = @@global.max_user_connections;
-
-# simple view
-create view v1 (c) as select b+1 from t1;
-select c from v1;
-select is_updatable from information_schema.views where table_name='v1';
-
-# temporary table should not hide table of view
-create temporary table t1 (a int, b int);
-# this is empty
-select * from t1;
-# but this based on normal t1
-select c from v1;
-show create table v1;
-show create view v1;
--- error ER_WRONG_OBJECT
-show create view t1;
-drop table t1;
-
-# try to use fields from underlying table
--- error ER_BAD_FIELD_ERROR
-select a from v1;
--- error ER_BAD_FIELD_ERROR
-select v1.a from v1;
--- error ER_BAD_FIELD_ERROR
-select b from v1;
--- error ER_BAD_FIELD_ERROR
-select v1.b from v1;
-
-# view with different algorithms (explain output differs)
-explain extended select c from v1;
-create algorithm=temptable view v2 (c) as select b+1 from t1;
-show create view v2;
-select c from v2;
-explain extended select c from v2;
-
-# try to use underlying table fields in VIEW creation process
--- error ER_BAD_FIELD_ERROR
-create view v3 (c) as select a+1 from v1;
--- error ER_BAD_FIELD_ERROR
-create view v3 (c) as select b+1 from v1;
-
-
-# VIEW on VIEW test with mixing different algorithms on different order
-create view v3 (c) as select c+1 from v1;
-select c from v3;
-explain extended select c from v3;
-create algorithm=temptable view v4 (c) as select c+1 from v2;
-select c from v4;
-explain extended select c from v4;
-create view v5 (c) as select c+1 from v2;
-select c from v5;
-explain extended select c from v5;
-create algorithm=temptable view v6 (c) as select c+1 from v1;
-select c from v6;
-explain extended select c from v6;
-
-# show table/table status test
-show tables;
-show full tables;
---replace_column 8 # 12 # 13 # 14 # 19 #
-show table status;
-
-drop view v1,v2,v3,v4,v5,v6;
-
-#
-# alter/create view test
-#
-
-# view with subqueries of different types
-create view v1 (c,d,e,f) as select a,b,
-a in (select a+2 from t1), a = all (select a from t1) from t1;
-create view v2 as select c, d from v1;
-select * from v1;
-select * from v2;
-
-# try to create VIEW with name of existing VIEW
--- error ER_TABLE_EXISTS_ERROR
-create view v1 (c,d,e,f) as select a,b, a in (select a+2 from t1), a = all (select a from t1) from t1;
-
-# 'or replace' should work in this case
-create or replace view v1 (c,d,e,f) as select a,b, a in (select a+2 from t1), a = all (select a from t1) from t1;
-
-# try to ALTER unexisting VIEW
-drop view v2;
--- error ER_NO_SUCH_TABLE
-alter view v2 as select c, d from v1;
-
-# 'or replace' on unexisting view
-create or replace view v2 as select c, d from v1;
-
-# alter view on existing view
-alter view v1 (c,d) as select a,max(b) from t1 group by a;
-
-# check that created view works
-select * from v1;
-select * from v2;
-
-# try to drop nonexistent VIEW
---error ER_UNKNOWN_VIEW
-drop view v100;
-
-# try to drop table with DROP VIEW
--- error ER_WRONG_OBJECT
-drop view t1;
-
-# try to drop VIEW with DROP TABLE
--- error ER_IT_IS_A_VIEW
-drop table v1;
-
-# try to drop table with DROP VIEW
-
-drop view v1,v2;
-drop table t1;
-
-#
-# outer left join with merged views
-#
-create table t1 (a int);
-insert into t1 values (1), (2), (3);
-
-create view v1 (a) as select a+1 from t1;
-create view v2 (a) as select a-1 from t1;
-
-select * from t1 natural left join v1;
-select * from v2 natural left join t1;
-select * from v2 natural left join v1;
-
-drop view v1, v2;
-drop table t1;
-
-
-#
-# DISTINCT option for VIEW
-#
-create table t1 (a int);
-insert into t1 values (1), (2), (3), (1), (2), (3);
-create view v1 as select distinct a from t1;
-select * from v1;
-explain select * from v1;
-select * from t1;
-drop view v1;
-drop table t1;
-
-#
-# syntax compatibility
-#
-create table t1 (a int);
--- error ER_VIEW_NONUPD_CHECK
-create view v1 as select distinct a from t1 WITH CHECK OPTION;
-create view v1 as select a from t1 WITH CHECK OPTION;
-create view v2 as select a from t1 WITH CASCADED CHECK OPTION;
-create view v3 as select a from t1 WITH LOCAL CHECK OPTION;
-drop view v3 RESTRICT;
-drop view v2 CASCADE;
-drop view v1;
-drop table t1;
-
-#
-# aliases
-#
-create table t1 (a int, b int);
-insert into t1 values (1,2), (1,3), (2,4), (2,5), (3,10);
-create view v1 (c) as select b+1 from t1;
-select test.c from v1 test;
-create algorithm=temptable view v2 (c) as select b+1 from t1;
-select test.c from v2 test;
-select test1.* from v1 test1, v2 test2 where test1.c=test2.c;
-select test2.* from v1 test1, v2 test2 where test1.c=test2.c;
-drop table t1;
-drop view v1,v2;
-
-#
-# LIMIT clause test
-#
-create table t1 (a int);
-insert into t1 values (1), (2), (3), (4);
-create view v1 as select a+1 from t1 order by 1 desc limit 2;
-select * from v1;
-explain select * from v1;
-drop view v1;
-drop table t1;
-
-#
-# CREATE ... SELECT view test
-#
-create table t1 (a int);
-insert into t1 values (1), (2), (3), (4);
-create view v1 as select a+1 from t1;
-create table t2 select * from v1;
-show columns from t2;
-select * from t2;
-drop view v1;
-drop table t1,t2;
-
-#
-# simple view + simple update
-#
-create table t1 (a int, b int, primary key(a));
-insert into t1 values (10,2), (20,3), (30,4), (40,5), (50,10);
-create view v1 (a,c) as select a, b+1 from t1;
-create algorithm=temptable view v2 (a,c) as select a, b+1 from t1;
-select is_updatable from information_schema.views where table_name='v2';
-select is_updatable from information_schema.views where table_name='v1';
-# try to update expression
--- error ER_NONUPDATEABLE_COLUMN
-update v1 set c=a+c;
-# try to update VIEW with forced TEMPORARY TABLE algorithm
--- error ER_NON_UPDATABLE_TABLE
-update v2 set a=a+c;
-# updatable field of updateable view
-update v1 set a=a+c;
-select * from v1;
-select * from t1;
-drop table t1;
-drop view v1,v2;
-
-#
-# simple view + simple multi-update
-#
-create table t1 (a int, b int, primary key(a));
-insert into t1 values (10,2), (20,3), (30,4), (40,5), (50,10);
-create table t2 (x int);
-insert into t2 values (10), (20);
-create view v1 (a,c) as select a, b+1 from t1;
-create algorithm=temptable view v2 (a,c) as select a, b+1 from t1;
-# try to update expression
--- error ER_NONUPDATEABLE_COLUMN
-update t2,v1 set v1.c=v1.a+v1.c where t2.x=v1.a;
-# try to update VIEW with forced TEMPORARY TABLE algorithm
--- error ER_NON_UPDATABLE_TABLE
-update t2,v2 set v2.a=v2.v2.a+c where t2.x=v2.a;
-# updatable field of updateable view
-update t2,v1 set v1.a=v1.a+v1.c where t2.x=v1.a;
-select * from v1;
-select * from t1;
-drop table t1,t2;
-drop view v1,v2;
-
-#
-# MERGE VIEW with WHERE clause
-#
-create table t1 (a int, b int, primary key(b));
-insert into t1 values (1,20), (2,30), (3,40), (4,50), (5,100);
-create view v1 (c) as select b from t1 where a<3;
-# simple select and explaint to be sure that it is MERGE
-select * from v1;
-explain extended select * from v1;
-# update test
-update v1 set c=c+1;
-select * from t1;
-# join of such VIEWs test
-create view v2 (c) as select b from t1 where a>=3;
-select * from v1, v2;
-drop view v1, v2;
-drop table t1;
-
-#
-# simple view + simple delete
-#
-create table t1 (a int, b int, primary key(a));
-insert into t1 values (1,2), (2,3), (3,4), (4,5), (5,10);
-create view v1 (a,c) as select a, b+1 from t1;
-create algorithm=temptable view v2 (a,c) as select a, b+1 from t1;
-# try to update VIEW with forced TEMPORARY TABLE algorithm
--- error ER_NON_UPDATABLE_TABLE
-delete from v2 where c < 4;
-# updatable field of updateable view
-delete from v1 where c < 4;
-select * from v1;
-select * from t1;
-drop table t1;
-drop view v1,v2;
-
-#
-# simple view + simple multi-delete
-#
-create table t1 (a int, b int, primary key(a));
-insert into t1 values (1,2), (2,3), (3,4), (4,5), (5,10);
-create table t2 (x int);
-insert into t2 values (1), (2), (3), (4);
-create view v1 (a,c) as select a, b+1 from t1;
-create algorithm=temptable view v2 (a,c) as select a, b+1 from t1;
-# try to update VIEW with forced TEMPORARY TABLE algorithm
--- error ER_NON_UPDATABLE_TABLE
-delete v2 from t2,v2 where t2.x=v2.a;
-# updatable field of updateable view
-delete v1 from t2,v1 where t2.x=v1.a;
-select * from v1;
-select * from t1;
-drop table t1,t2;
-drop view v1,v2;
-
-#
-# key presence check
-#
-create table t1 (a int, b int, c int, primary key(a,b));
-insert into t1 values (10,2,-1), (20,3,-2), (30,4,-3), (40,5,-4), (50,10,-5);
-create view v1 (x,y) as select a, b from t1;
-create view v2 (x,y) as select a, c from t1;
-set updatable_views_with_limit=NO;
-update v1 set x=x+1;
-update v2 set x=x+1;
-update v1 set x=x+1 limit 1;
--- error ER_NON_UPDATABLE_TABLE
-update v2 set x=x+1 limit 1;
-set updatable_views_with_limit=YES;
-update v1 set x=x+1 limit 1;
-update v2 set x=x+1 limit 1;
-set updatable_views_with_limit=DEFAULT;
-show variables like "updatable_views_with_limit";
-select * from t1;
-drop table t1;
-drop view v1,v2;
-
-#
-# simple insert
-#
-create table t1 (a int, b int, c int, primary key(a,b));
-insert into t1 values (10,2,-1), (20,3,-2);
-create view v1 (x,y,z) as select c, b, a from t1;
-create view v2 (x,y) as select b, a from t1;
-create view v3 (x,y,z) as select b, a, b from t1;
-create view v4 (x,y,z) as select c+1, b, a from t1;
-create algorithm=temptable view v5 (x,y,z) as select c, b, a from t1;
-# try insert to VIEW with fields duplicate
--- error ER_NON_INSERTABLE_TABLE
-insert into v3 values (-60,4,30);
-# try insert to VIEW with expression in SELECT list
--- error ER_NON_INSERTABLE_TABLE
-insert into v4 values (-60,4,30);
-# try insert to VIEW using temporary table algorithm
--- error ER_NON_INSERTABLE_TABLE
-insert into v5 values (-60,4,30);
-insert into v1 values (-60,4,30);
-insert into v1 (z,y,x) values (50,6,-100);
-insert into v2 values (5,40);
-select * from t1;
-drop table t1;
-drop view v1,v2,v3,v4,v5;
-
-#
-# insert ... select
-#
-create table t1 (a int, b int, c int, primary key(a,b));
-insert into t1 values (10,2,-1), (20,3,-2);
-create table t2 (a int, b int, c int, primary key(a,b));
-insert into t2 values (30,4,-60);
-create view v1 (x,y,z) as select c, b, a from t1;
-create view v2 (x,y) as select b, a from t1;
-create view v3 (x,y,z) as select b, a, b from t1;
-create view v4 (x,y,z) as select c+1, b, a from t1;
-create algorithm=temptable view v5 (x,y,z) as select c, b, a from t1;
-# try insert to VIEW with fields duplicate
--- error ER_NON_INSERTABLE_TABLE
-insert into v3 select c, b, a from t2;
-# try insert to VIEW with expression in SELECT list
--- error ER_NON_INSERTABLE_TABLE
-insert into v4 select c, b, a from t2;
-# try insert to VIEW using temporary table algorithm
--- error ER_NON_INSERTABLE_TABLE
-insert into v5 select c, b, a from t2;
-insert into v1 select c, b, a from t2;
-insert into v1 (z,y,x) select a+20,b+2,-100 from t2;
-insert into v2 select b+1, a+10 from t2;
-select * from t1;
-drop table t1, t2;
-drop view v1,v2,v3,v4,v5;
-
-#
-# outer join based on VIEW with WHERE clause
-#
-create table t1 (a int, primary key(a));
-insert into t1 values (1), (2), (3);
-create view v1 (x) as select a from t1 where a > 1;
-select t1.a, v1.x from t1 left join v1 on (t1.a= v1.x);
-drop table t1;
-drop view v1;
-
-#
-# merging WHERE condition on VIEW on VIEW
-#
-create table t1 (a int, primary key(a));
-insert into t1 values (1), (2), (3), (200);
-create view v1 (x) as select a from t1 where a > 1;
-create view v2 (y) as select x from v1 where x < 100;
-select * from v2;
-drop table t1;
-drop view v1,v2;
-
-#
-# VIEW on non-updatable view
-#
-create table t1 (a int, primary key(a));
-insert into t1 values (1), (2), (3), (200);
-create ALGORITHM=TEMPTABLE view v1 (x) as select a from t1;
-create view v2 (y) as select x from v1;
--- error ER_NON_UPDATABLE_TABLE
-update v2 set y=10 where y=2;
-drop table t1;
-drop view v1,v2;
-
-#
-# auto_increment field out of VIEW
-#
-create table t1 (a int not null auto_increment, b int not null, primary key(a), unique(b));
-create view v1 (x) as select b from t1;
-insert into v1 values (1);
-select last_insert_id();
-insert into t1 (b) values (2);
-select last_insert_id();
-select * from t1;
-drop view v1;
-drop table t1;
-
-#
-# VIEW fields quoting
-#
-set sql_mode='ansi';
-create table t1 ("a*b" int);
-create view v1 as select "a*b" from t1;
-show create view v1;
-drop view v1;
-drop table t1;
-set sql_mode=default;
-
-#
-# VIEW without tables
-#
-create table t1 (t_column int);
-create view v1 as select 'a';
-select * from v1, t1;
-drop view v1;
-drop table t1;
-
-#
-# quote mark inside table name
-#
-create table `t1a``b` (col1 char(2));
-create view v1 as select * from `t1a``b`;
-select * from v1;
-describe v1;
-drop view v1;
-drop table `t1a``b`;
-
-#
-# Changing of underlying table
-#
-create table t1 (col1 char(5),col2 char(5));
-create view v1 as select * from t1;
-drop table t1;
-create table t1 (col1 char(5),newcol2 char(5));
--- error ER_VIEW_INVALID
-insert into v1 values('a','aa');
-drop table t1;
--- error ER_VIEW_INVALID
-select * from v1;
-drop view v1;
-
-#
-# check of duplication of column names
-#
--- error ER_DUP_FIELDNAME
-create view v1 (a,a) as select 'a','a';
-
-#
-# updatablity should be transitive
-#
-create table t1 (col1 int,col2 char(22));
-insert into t1 values(5,'Hello, world of views');
-create view v1 as select * from t1;
-create view v2 as select * from v1;
-update v2 set col2='Hello, view world';
-select is_updatable from information_schema.views;
-select * from t1;
-drop view v2, v1;
-drop table t1;
-
-#
-# check 'use index' on view with temporary table
-#
-create table t1 (a int, b int);
-create view v1 as select a, sum(b) from t1 group by a;
---error ER_KEY_DOES_NOT_EXITS
-select b from v1 use index (some_index) where b=1;
-drop view v1;
-drop table t1;
-
-#
-# using VIEW fields several times in query resolved via temporary tables
-#
-create table t1 (col1 char(5),col2 char(5));
-create view v1 (col1,col2) as select col1,col2 from t1;
-insert into v1 values('s1','p1'),('s1','p2'),('s1','p3'),('s1','p4'),('s2','p1'),('s3','p2'),('s4','p4');
-select distinct first.col2 from t1 first where first.col2 in (select second.col2 from t1 second where second.col1<>first.col1);
-select distinct first.col2 from v1 first where first.col2 in (select second.col2 from t1 second where second.col1<>first.col1);
-drop view v1;
-drop table t1;
-
-#
-# Test of view updatability in prepared statement
-#
-create table t1 (a int);
-create view v1 as select a from t1;
-insert into t1 values (1);
-
-#update
-SET @v0 = '2';
-PREPARE stmt FROM 'UPDATE v1 SET a = ?';
-EXECUTE stmt USING @v0;
-DEALLOCATE PREPARE stmt;
-
-#insert without field list
-SET @v0 = '3';
-PREPARE stmt FROM 'insert into v1 values (?)';
-EXECUTE stmt USING @v0;
-DEALLOCATE PREPARE stmt;
-
-#insert with field list
-SET @v0 = '4';
-PREPARE stmt FROM 'insert into v1 (a) values (?)';
-EXECUTE stmt USING @v0;
-DEALLOCATE PREPARE stmt;
-
-select * from t1;
-
-drop view v1;
-drop table t1;
-
-#
-# error on preparation
-#
--- error ER_NO_TABLES_USED
-CREATE VIEW v02 AS SELECT * FROM DUAL;
-SHOW TABLES;
-
-#
-# EXISTS with UNION VIEW
-#
-CREATE VIEW v1 AS SELECT EXISTS (SELECT 1 UNION SELECT 2);
-select * from v1;
-drop view v1;
-
-#
-# using VIEW where table is required
-#
-create table t1 (col1 int,col2 char(22));
-create view v1 as select * from t1;
--- error ER_WRONG_OBJECT
-create index i1 on v1 (col1);
-drop view v1;
-drop table t1;
-
-#
-# connection_id(), pi(), current_user(), version() representation test
-#
-CREATE VIEW v1 (f1,f2,f3,f4) AS SELECT connection_id(), pi(), current_user(), version();
-SHOW CREATE VIEW v1;
-drop view v1;
-
-#
-# VIEW built over UNION
-#
-create table t1 (s1 int);
-create table t2 (s2 int);
-insert into t1 values (1), (2);
-insert into t2 values (2), (3);
-create view v1 as select * from t1,t2 union all select * from t1,t2;
-select * from v1;
-drop view v1;
-drop tables t1, t2;
-
-#
-# Aggregate functions in view list
-#
-create table t1 (col1 int);
-insert into t1 values (1);
-create view v1 as select count(*) from t1;
-insert into t1 values (null);
-select * from v1;
-drop view v1;
-drop table t1;
-
-#
-# Showing VIEW with VIEWs in subquery
-#
-create table t1 (a int);
-create table t2 (a int);
-create view v1 as select a from t1;
-create view v2 as select a from t2 where a in (select a from v1);
-show create view v2;
-drop view v2, v1;
-drop table t1, t2;
-
-#
-# SHOW VIEW view with name with spaces
-#
-CREATE VIEW `v 1` AS select 5 AS `5`;
-show create view `v 1`;
-drop view `v 1`;
-
-#
-# Removing database with .frm archives
-#
-create database mysqltest;
-create table mysqltest.t1 (a int, b int);
-create view mysqltest.v1 as select a from mysqltest.t1;
-alter view mysqltest.v1 as select b from mysqltest.t1;
-alter view mysqltest.v1 as select a from mysqltest.t1;
-drop database mysqltest;
-
-#
-# VIEW with full text
-#
-CREATE TABLE t1 (c1 int not null auto_increment primary key, c2 varchar(20), fulltext(c2));
-insert into t1 (c2) VALUES ('real Beer'),('Water'),('Kossu'),('Coca-Cola'),('Vodka'),('Wine'),('almost real Beer');
-select * from t1 WHERE match (c2) against ('Beer');
-CREATE VIEW v1 AS SELECT * from t1 WHERE match (c2) against ('Beer');
-select * from v1;
-drop view v1;
-drop table t1;
-
-#
-# distinct in temporary table with a VIEW
-#
-create table t1 (a int);
-insert into t1 values (1),(1),(2),(2),(3),(3);
-create view v1 as select a from t1;
-select distinct a from v1;
-select distinct a from v1 limit 2;
-select distinct a from t1 limit 2;
-prepare stmt1 from "select distinct a from v1 limit 2";
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-drop view v1;
-drop table t1;
-
-#
-# aggregate function of aggregate function
-#
-create table t1 (tg_column bigint);
-create view v1 as select count(tg_column) as vg_column from t1;
-select avg(vg_column) from v1;
-drop view v1;
-drop table t1;
-
-#
-# VIEW of VIEW with column renaming
-#
-create table t1 (col1 bigint not null, primary key (col1));
-create table t2 (col1 bigint not null, key (col1));
-create view v1 as select * from t1;
-create view v2 as select * from t2;
-insert into v1 values (1);
-insert into v2 values (1);
-create view v3 (a,b) as select v1.col1 as a, v2.col1 as b from v1, v2 where v1.col1 = v2.col1;
-select * from v3;
-show create view v3;
-drop view v3, v2, v1;
-drop table t2, t1;
-
-#
-# VIEW based on functions with complex names
-#
-create function `f``1` () returns int return 5;
-create view v1 as select test.`f``1` ();
-show create view v1;
-select * from v1;
-drop view v1;
-drop function `f``1`;
-
-#
-# tested problem when function name length close to ALIGN_SIZE
-#
-create function a() returns int return 5;
-create view v1 as select a();
-select * from v1;
-drop view v1;
-drop function a;
-
-#
-# VIEW with collation
-#
-create table t2 (col1 char collate latin1_german2_ci);
-create view v2 as select col1 collate latin1_german1_ci from t2;
-show create view v2;
-show create view v2;
-drop view v2;
-drop table t2;
-
-#
-# order by refers on integer field
-#
-create table t1 (a int);
-insert into t1 values (1), (2);
-create view v1 as select 5 from t1 order by 1;
-show create view v1;
-select * from v1;
-drop view v1;
-drop table t1;
-
-#
-# VIEW over dropped function
-#
-create function x1 () returns int return 5;
-create table t1 (s1 int);
-create view v1 as select x1() from t1;
-drop function x1;
--- error ER_VIEW_INVALID
-select * from v1;
---replace_column 8 # 12 # 13 # 19 #
-show table status;
-drop view v1;
-drop table t1;
-
-#
-# VIEW over non-existing column
-#
-create table t1 (a varchar(20));
-create view v1 as select a from t1;
-alter table t1 change a aa int;
---error ER_VIEW_INVALID
-select * from v1;
---replace_column 8 # 12 # 13 # 19 #
-show table status;
-show create view v1;
-drop view v1;
-drop table t1;
-
-
-#
-# VIEW with floating point (long number) as column
-#
-create view v1 as select 99999999999999999999999999999999999999999999999999999 as col1;
-show create view v1;
-drop view v1;
-
-#
-# VIEWs with national characters
-#
-
-SET @old_cs_client = @@character_set_client;
-SET @old_cs_results = @@character_set_results;
-SET @old_cs_connection = @@character_set_connection;
-
-set names utf8;
-create table tü (cü char);
-create view vü as select cü from tü;
-insert into vü values ('ü');
-select * from vü;
-drop view vü;
-drop table tü;
-
-SET character_set_client = @old_cs_client;
-SET character_set_results = @old_cs_results;
-SET character_set_connection = @old_cs_connection;
-
-#
-# problem with used_tables() of outer reference resolved in VIEW
-#
-create table t1 (a int, b int);
-insert into t1 values (1,2), (1,3), (2,4), (2,5), (3,10);
-create view v1(c) as select a+1 from t1 where b >= 4;
-select c from v1 where exists (select * from t1 where a=2 and b=c);
-drop view v1;
-drop table t1;
-
-#
-# view with cast operation
-#
-create view v1 as select cast(1 as char(3));
-show create view v1;
-select * from v1;
-drop view v1;
-
-#
-# renaming views
-#
-create table t1 (a int);
-create view v1 as select a from t1;
-create view v3 as select a from t1;
-create database mysqltest;
--- error ER_FORBID_SCHEMA_CHANGE
-rename table v1 to mysqltest.v1;
-rename table v1 to v2;
---error ER_TABLE_EXISTS_ERROR
-rename table v3 to v1, v2 to t1;
-drop table t1;
-drop view v2,v3;
-drop database mysqltest;
-
-#
-# bug handling from VIEWs
-#
-create view v1 as select 'a',1;
-create view v2 as select * from v1 union all select * from v1;
-create view v3 as select * from v2 where 1 = (select `1` from v2);
-create view v4 as select * from v3;
--- error ER_SUBQUERY_NO_1_ROW
-select * from v4;
-drop view v4, v3, v2, v1;
-
-#
-# VIEW over SELECT with prohibited clauses
-#
--- error ER_PARSE_ERROR
-create view v1 as select 5 into @w;
--- error ER_PARSE_ERROR
-create view v1 as select 5 into outfile 'ttt';
-create table t1 (a int);
--- error ER_PARSE_ERROR
-create view v1 as select a from t1 procedure analyse();
-# now derived tables are allowed
-create view v1 as select 1 from (select 1) as d1;
-drop view v1;
-drop table t1;
-
-#
-# INSERT into VIEW with ON DUPLICATE
-#
-create table t1 (s1 int, primary key (s1));
-create view v1 as select * from t1;
-insert into v1 values (1) on duplicate key update s1 = 7;
-insert into v1 values (1) on duplicate key update s1 = 7;
-select * from t1;
-drop view v1;
-drop table t1;
-
-#
-# test of updating and fetching from the same table check
-#
-create table t1 (col1 int);
-create table t2 (col1 int);
-create table t3 (col1 datetime not null);
-create view v1 as select * from t1;
-create view v2 as select * from v1;
-create view v3 as select v2.col1 from v2,t2 where v2.col1 = t2.col1;
--- error ER_VIEW_PREVENT_UPDATE
-insert into v2 values ((select max(col1) from v1));
--- error ER_VIEW_PREVENT_UPDATE
-insert into t1 values ((select max(col1) from v1));
--- error ER_VIEW_PREVENT_UPDATE
-insert into v2 values ((select max(col1) from v1));
--- error ER_VIEW_PREVENT_UPDATE
-insert into v2 values ((select max(col1) from t1));
--- error ER_UPDATE_TABLE_USED
-insert into t1 values ((select max(col1) from t1));
--- error ER_VIEW_PREVENT_UPDATE
-insert into v2 values ((select max(col1) from t1));
--- error ER_UPDATE_TABLE_USED
-insert into v2 values ((select max(col1) from v2));
--- error ER_VIEW_PREVENT_UPDATE
-insert into t1 values ((select max(col1) from v2));
--- error ER_UPDATE_TABLE_USED
-insert into v2 values ((select max(col1) from v2));
--- error ER_VIEW_PREVENT_UPDATE
-insert into v3 (col1) values ((select max(col1) from v1));
--- error ER_VIEW_PREVENT_UPDATE
-insert into v3 (col1) values ((select max(col1) from t1));
--- error ER_VIEW_PREVENT_UPDATE
-insert into v3 (col1) values ((select max(col1) from v2));
-# check with TZ tables in list
--- error ER_VIEW_PREVENT_UPDATE
-insert into v3 (col1) values ((select CONVERT_TZ('20050101000000','UTC','MET') from v2));
-insert into v3 (col1) values ((select CONVERT_TZ('20050101000000','UTC','MET') from t2));
--- error ER_BAD_NULL_ERROR
-insert into t3 values ((select CONVERT_TZ('20050101000000','UTC','MET') from t2));
-# temporary table algorithm view should be equal to subquery in the from clause
-create algorithm=temptable view v4 as select * from t1;
-insert into t1 values (1),(2),(3);
-insert into t1 (col1) values ((select max(col1) from v4));
-select * from t1;
-
-drop view v4,v3,v2,v1;
-drop table t1,t2,t3;
-
-#
-# HANDLER with VIEW
-#
-create table t1 (s1 int);
-create view v1 as select * from t1;
--- error ER_WRONG_OBJECT
-handler v1 open as xx;
-drop view v1;
-drop table t1;
-
-#
-# view with WHERE in nested join
-#
-create table t1(a int);
-insert into t1 values (0), (1), (2), (3);
-create table t2 (a int);
-insert into t2 select a from t1 where a > 1;
-create view v1 as select a from t1 where a > 1;
-select * from t1 left join (t2 as t, v1) on v1.a=t1.a;
-select * from t1 left join (t2 as t, t2) on t2.a=t1.a;
-drop view v1;
-drop table t1, t2;
-
-#
-# Collation with view update
-#
-create table t1 (s1 char);
-create view v1 as select s1 collate latin1_german1_ci as s1 from t1;
-insert into v1 values ('a');
-select * from v1;
-update v1 set s1='b';
-select * from v1;
-update v1,t1 set v1.s1='c' where t1.s1=v1.s1;
-select * from v1;
-prepare stmt1 from "update v1,t1 set v1.s1=? where t1.s1=v1.s1";
-set @arg='d';
-execute stmt1 using @arg;
-select * from v1;
-set @arg='e';
-execute stmt1 using @arg;
-select * from v1;
-deallocate prepare stmt1;
-drop view v1;
-drop table t1;
-
-#
-# test view with LOCK TABLES (work around)
-#
-create table t1 (a int);
-create table t2 (a int);
-create view v1 as select * from t1;
-lock tables t1 read, v1 read;
-select * from v1;
--- error ER_TABLE_NOT_LOCKED
-select * from t2;
-unlock tables;
-drop view v1;
-drop table t1, t2;
-
-#
-# WITH CHECK OPTION insert/update test
-#
-create table t1 (a int);
-create view v1 as select * from t1 where a < 2 with check option;
-# simple insert
-insert into v1 values(1);
--- error ER_VIEW_CHECK_FAILED
-insert into v1 values(3);
-# simple insert with ignore
-insert ignore into v1 values (2),(3),(0);
-select * from t1;
-# prepare data for next check
-delete from t1;
-# INSERT SELECT test
-insert into v1 SELECT 1;
--- error ER_VIEW_CHECK_FAILED
-insert into v1 SELECT 3;
-# prepare data for next check
-create table t2 (a int);
-insert into t2 values (2),(3),(0);
-# INSERT SELECT with ignore test
-insert ignore into v1 SELECT a from t2;
-select * from t1 order by a desc;
-# simple UPDATE test
-update v1 set a=-1 where a=0;
--- error ER_VIEW_CHECK_FAILED
-update v1 set a=2 where a=1;
-select * from t1 order by a desc;
-# prepare data for next check
-update v1 set a=0 where a=0;
-insert into t2 values (1);
-# multiupdate test
-update v1,t2 set v1.a=v1.a-1 where v1.a=t2.a;
-select * from t1 order by a desc;
-# prepare data for next check
-update v1 set a=a+1;
-# multiupdate with ignore test
-update ignore v1,t2 set v1.a=v1.a+1 where v1.a=t2.a;
-select * from t1;
-
-drop view v1;
-drop table t1, t2;
-
-#
-# CASCADED/LOCAL CHECK OPTION test
-#
-create table t1 (a int);
-create view v1 as select * from t1 where a < 2 with check option;
-create view v2 as select * from v1 where a > 0 with local check option;
-create view v3 as select * from v1 where a > 0 with cascaded check option;
-insert into v2 values (1);
-insert into v3 values (1);
--- error ER_VIEW_CHECK_FAILED
-insert into v2 values (0);
--- error ER_VIEW_CHECK_FAILED
-insert into v3 values (0);
-insert into v2 values (2);
--- error ER_VIEW_CHECK_FAILED
-insert into v3 values (2);
-select * from t1;
-drop view v3,v2,v1;
-drop table t1;
-
-#
-# CHECK OPTION with INSERT ... ON DUPLICATE KEY UPDATE
-#
-create table t1 (a int, primary key (a));
-create view v1 as select * from t1 where a < 2 with check option;
-insert into v1 values (1) on duplicate key update a=2;
--- error ER_VIEW_CHECK_FAILED
-insert into v1 values (1) on duplicate key update a=2;
-insert ignore into v1 values (1) on duplicate key update a=2;
-select * from t1;
-drop view v1;
-drop table t1;
-
-#
-# check cyclic referencing protection on altering view
-#
-create table t1 (s1 int);
-create view v1 as select * from t1;
-create view v2 as select * from v1;
--- error ER_NO_SUCH_TABLE
-alter view v1 as select * from v2;
--- error ER_NO_SUCH_TABLE
-alter view v1 as select * from v1;
--- error ER_NO_SUCH_TABLE
-create or replace view v1 as select * from v2;
--- error ER_NO_SUCH_TABLE
-create or replace view v1 as select * from v1;
-drop view v2,v1;
-drop table t1;
-
-#
-# check altering differ options
-#
-create table t1 (a int);
-create view v1 as select * from t1;
-show create view v1;
-alter algorithm=undefined view v1 as select * from t1 with check option;
-show create view v1;
-alter algorithm=merge view v1 as select * from t1 with cascaded check option;
-show create view v1;
-alter algorithm=temptable view v1 as select * from t1;
-show create view v1;
-drop view v1;
-drop table t1;
-
-#
-# updating view with subquery in the WHERE clause
-#
-create table t1 (s1 int);
-create table t2 (s1 int);
-create view v2 as select * from t2 where s1 in (select s1 from t1);
-insert into v2 values (5);
-insert into t1 values (5);
-select * from v2;
-update v2 set s1 = 0;
-select * from v2;
-select * from t2;
-# check it with check option
-alter view v2 as select * from t2 where s1 in (select s1 from t1) with check option;
-insert into v2 values (5);
--- error ER_VIEW_CHECK_FAILED
-update v2 set s1 = 1;
-insert into t1 values (1);
-update v2 set s1 = 1;
-select * from v2;
-select * from t2;
-# scheck how VIEWs with subqueries work with prepared statements
-prepare stmt1 from "select * from v2;";
-execute stmt1;
-insert into t1 values (0);
-execute stmt1;
-deallocate prepare stmt1;
-drop view v2;
-drop table t1, t2;
-
-#
-# test of substring_index with view
-#
-create table t1 (t time);
-create view v1 as select substring_index(t,':',2) as t from t1;
-insert into t1 (t) values ('12:24:10');
-select substring_index(t,':',2) from t1;
-select substring_index(t,':',2) from v1;
-drop view v1;
-drop table t1;
-
-#
-# test of cascaded check option for whiew without WHERE clause
-#
-create table t1 (s1 tinyint);
-create view v1 as select * from t1 where s1 <> 0 with local check option;
-create view v2 as select * from v1 with cascaded check option;
--- error ER_VIEW_CHECK_FAILED
-insert into v2 values (0);
-drop view v2, v1;
-drop table t1;
-
-#
-# inserting single value with check option failed always get error
-#
-create table t1 (s1 int);
-create view v1 as select * from t1 where s1 < 5 with check option;
-#single value
--- error ER_VIEW_CHECK_FAILED
-insert ignore into v1 values (6);
-#several values
-insert ignore into v1 values (6),(3);
-select * from t1;
-drop view v1;
-drop table t1;
-
-#
-# changing value by trigger and CHECK OPTION
-#
-SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
-create table t1 (s1 tinyint);
-create trigger t1_bi before insert on t1 for each row set new.s1 = 500;
-create view v1 as select * from t1 where s1 <> 127 with check option;
--- error ER_VIEW_CHECK_FAILED
-insert into v1 values (0);
-select * from v1;
-select * from t1;
-drop trigger t1_bi;
-drop view v1;
-drop table t1;
-SET sql_mode = default;
-
-#
-# CASCADED should be used for all underlaying VIEWs
-#
-create table t1 (s1 tinyint);
-create view v1 as select * from t1 where s1 <> 0;
-create view v2 as select * from v1 where s1 <> 1 with cascaded check option;
--- error ER_VIEW_CHECK_FAILED
-insert into v2 values (0);
-select * from v2;
-select * from t1;
-drop view v2, v1;
-drop table t1;
-
-#
-# LOAD DATA with view and CHECK OPTION
-#
-# fixed length fields
-create table t1 (a int, b char(10));
-create view v1 as select * from t1 where a != 0 with check option;
--- error ER_VIEW_CHECK_FAILED
-load data infile '../../std_data/loaddata3.dat' into table v1 fields terminated by '' enclosed by '' ignore 1 lines;
-select * from t1;
-select * from v1;
-delete from t1;
-load data infile '../../std_data/loaddata3.dat' ignore into table v1 fields terminated by '' enclosed by '' ignore 1 lines;
-select * from t1 order by a,b;
-select * from v1 order by a,b;
-drop view v1;
-drop table t1;
-# variable length fields
-create table t1 (a text, b text);
-create view v1 as select * from t1 where a <> 'Field A' with check option;
--- error ER_VIEW_CHECK_FAILED
-load data infile '../../std_data/loaddata2.dat' into table v1 fields terminated by ',' enclosed by '''';
-select concat('|',a,'|'), concat('|',b,'|') from t1;
-select concat('|',a,'|'), concat('|',b,'|') from v1;
-delete from t1;
-load data infile '../../std_data/loaddata2.dat' ignore into table v1 fields terminated by ',' enclosed by '''';
-select concat('|',a,'|'), concat('|',b,'|') from t1;
-select concat('|',a,'|'), concat('|',b,'|') from v1;
-drop view v1;
-drop table t1;
-
-#
-# Trys update table from which we select using views and subqueries
-#
-create table t1 (s1 smallint);
-create view v1 as select * from t1 where 20 < (select (s1) from t1);
--- error ER_NON_INSERTABLE_TABLE
-insert into v1 values (30);
-create view v2 as select * from t1;
-create view v3 as select * from t1 where 20 < (select (s1) from v2);
--- error ER_NON_INSERTABLE_TABLE
-insert into v3 values (30);
-create view v4 as select * from v2 where 20 < (select (s1) from t1);
--- error ER_NON_INSERTABLE_TABLE
-insert into v4 values (30);
-drop view v4, v3, v2, v1;
-drop table t1;
-
-#
-# CHECK TABLE with VIEW
-#
-create table t1 (a int);
-create view v1 as select * from t1;
-check table t1,v1;
-check table v1,t1;
-drop table t1;
-check table v1;
-drop view v1;
-
-#
-# merge of VIEW with several tables
-#
-create table t1 (a int);
-create table t2 (a int);
-create table t3 (a int);
-insert into t1 values (1), (2), (3);
-insert into t2 values (1), (3);
-insert into t3 values (1), (2), (4);
-# view over tables
-create view v3 (a,b) as select t1.a as a, t2.a as b from t1 left join t2 on (t1.a=t2.a);
-select * from t3 left join v3 on (t3.a = v3.a);
-explain extended select * from t3 left join v3 on (t3.a = v3.a);
-# view over views
-create view v1 (a) as select a from t1;
-create view v2 (a) as select a from t2;
-create view v4 (a,b) as select v1.a as a, v2.a as b from v1 left join v2 on (v1.a=v2.a);
-select * from t3 left join v4 on (t3.a = v4.a);
-explain extended select * from t3 left join v4 on (t3.a = v4.a);
-# PS with view over views
-prepare stmt1 from "select * from t3 left join v4 on (t3.a = v4.a);";
-execute stmt1;
-execute stmt1;
-deallocate prepare stmt1;
-drop view v4,v3,v2,v1;
-drop tables t1,t2,t3;
-
-#
-# updating of join view
-#
-create table t1 (a int, primary key (a), b int);
-create table t2 (a int, primary key (a));
-insert into t1 values (1,100), (2,200);
-insert into t2 values (1), (3);
-# legal view for update
-create view v3 (a,b) as select t1.a as a, t2.a as b from t1, t2;
-update v3 set a= 10 where a=1;
-select * from t1;
-select * from t2;
-# view without primary key
-create view v2 (a,b) as select t1.b as a, t2.a as b from t1, t2;
-set updatable_views_with_limit=NO;
--- error ER_NON_UPDATABLE_TABLE
-update v2 set a= 10 where a=200 limit 1;
-set updatable_views_with_limit=DEFAULT;
-# just view selects
-select * from v3;
-select * from v2;
-# prepare statement with updating join view
-set @a= 10;
-set @b= 100;
-prepare stmt1 from "update v3 set a= ? where a=?";
-execute stmt1 using @a,@b;
-select * from v3;
-set @a= 300;
-set @b= 10;
-execute stmt1 using @a,@b;
-select * from v3;
-deallocate prepare stmt1;
-drop view v3,v2;
-drop tables t1,t2;
-
-#
-# inserting/deleting join view
-#
-create table t1 (a int, primary key (a), b int);
-create table t2 (a int, primary key (a), b int);
-insert into t2 values (1000, 2000);
-create view v3 (a,b) as select t1.a as a, t2.a as b from t1, t2;
-# inserting into join view without field list
--- error ER_VIEW_NO_INSERT_FIELD_LIST
-insert into v3 values (1,2);
--- error ER_VIEW_NO_INSERT_FIELD_LIST
-insert into v3 select * from t2;
-# inserting in several tables of join view
--- error ER_VIEW_MULTIUPDATE
-insert into v3(a,b) values (1,2);
--- error ER_VIEW_MULTIUPDATE
-insert into v3(a,b) select * from t2;
-# correct inserts into join view
-insert into v3(a) values (1);
-insert into v3(b) values (10);
-insert into v3(a) select a from t2;
-insert into v3(b) select b from t2;
-insert into v3(a) values (1) on duplicate key update a=a+10000+VALUES(a);
-select * from t1;
-select * from t2;
-# try delete from join view
--- error ER_VIEW_DELETE_MERGE_VIEW
-delete from v3;
--- error ER_VIEW_DELETE_MERGE_VIEW
-delete v3,t1 from v3,t1;
--- error ER_VIEW_DELETE_MERGE_VIEW
-delete t1,v3 from t1,v3;
-# delete from t1 just to reduce result set size
-delete from t1;
-# prepare statement with insert join view
-prepare stmt1 from "insert into v3(a) values (?);";
-set @a= 100;
-execute stmt1 using @a;
-set @a= 300;
-execute stmt1 using @a;
-deallocate prepare stmt1;
-prepare stmt1 from "insert into v3(a) select ?;";
-set @a= 101;
-execute stmt1 using @a;
-set @a= 301;
-execute stmt1 using @a;
-deallocate prepare stmt1;
---sorted_result
-select * from v3;
-
-drop view v3;
-drop tables t1,t2;
-
-#
-# View field names should be case insensitive
-#
-create table t1(f1 int);
-create view v1 as select f1 from t1;
-select * from v1 where F1 = 1;
-drop view v1;
-drop table t1;
-
-#
-# Resolving view fields in subqueries in VIEW (Bug#6394)
-#
-create table t1(c1 int);
-create table t2(c2 int);
-insert into t1 values (1),(2),(3);
-insert into t2 values (1);
-SELECT c1 FROM t1 WHERE c1 IN (SELECT c2 FROM t2);
-SELECT c1 FROM t1 WHERE EXISTS (SELECT c2 FROM t2 WHERE c2 = c1);
-create view v1 as SELECT c1 FROM t1 WHERE c1 IN (SELECT c2 FROM t2);
-create view v2 as SELECT c1 FROM t1 WHERE EXISTS (SELECT c2 FROM t2 WHERE c2 = c1);
-select * from v1;
-select * from v2;
-select * from (select c1 from v2) X;
-drop view v2, v1;
-drop table t1, t2;
-
-#
-# view over other view setup (Bug#7433)
-#
-CREATE TABLE t1 (C1 INT, C2 INT);
-CREATE TABLE t2 (C2 INT);
-CREATE VIEW v1 AS SELECT C2 FROM t2;
-CREATE VIEW v2 AS SELECT C1 FROM t1 LEFT OUTER JOIN v1 USING (C2);
-SELECT * FROM v2;
-drop view v2, v1;
-drop table t1, t2;
-
-#
-# view and group_concat() (Bug#7116)
-#
-create table t1 (col1 char(5),col2 int,col3 int);
-insert into t1 values ('one',10,25), ('two',10,50), ('two',10,50), ('one',20,25), ('one',30,25);
-create view v1 as select * from t1;
-select col1,group_concat(col2,col3) from t1 group by col1;
-select col1,group_concat(col2,col3) from v1 group by col1;
-drop view v1;
-drop table t1;
-
-#
-# Item_ref resolved as view field (Bug#6894)
-#
-create table t1 (s1 int, s2 char);
-create view v1 as select s1, s2 from t1;
--- error ER_BAD_FIELD_ERROR
-select s2 from v1 vq1 where 2 = (select count(*) from v1 vq2 having vq1.s2 = vq2.s2);
-select s2 from v1 vq1 where 2 = (select count(*) aa from v1 vq2 having vq1.s2 = aa);
-drop view v1;
-drop table t1;
-
-#
-# Test case for Bug#9398 CREATE TABLE with SELECT from a multi-table view
-#
-CREATE TABLE t1 (a1 int);
-CREATE TABLE t2 (a2 int);
-INSERT INTO t1 VALUES (1), (2), (3), (4);
-INSERT INTO t2 VALUES (1), (2), (3);
-CREATE VIEW v1(a,b) AS SELECT a1,a2 FROM t1 JOIN t2 ON a1=a2 WHERE a1>1;
-
-SELECT * FROM v1;
-CREATE TABLE t3 SELECT * FROM v1;
-SELECT * FROM t3;
-
-DROP VIEW v1;
-DROP TABLE t1,t2,t3;
-
-#
-# Test for Bug#8703 insert into table select from view crashes
-#
-create table t1 (a int);
-create table t2 like t1;
-create table t3 like t1;
-create view v1 as select t1.a x, t2.a y from t1 join t2 where t1.a=t2.a;
-insert into t3 select x from v1;
-insert into t2 select x from v1;
-drop view v1;
-drop table t1,t2,t3;
-
-#
-# Test for Bug#6106 query over a view using subquery for the underlying table
-#
-
-CREATE TABLE t1 (col1 int PRIMARY KEY, col2 varchar(10));
-INSERT INTO t1 VALUES(1,'trudy');
-INSERT INTO t1 VALUES(2,'peter');
-INSERT INTO t1 VALUES(3,'sanja');
-INSERT INTO t1 VALUES(4,'monty');
-INSERT INTO t1 VALUES(5,'david');
-INSERT INTO t1 VALUES(6,'kent');
-INSERT INTO t1 VALUES(7,'carsten');
-INSERT INTO t1 VALUES(8,'ranger');
-INSERT INTO t1 VALUES(10,'matt');
-CREATE TABLE t2 (col1 int, col2 int, col3 char(1));
-INSERT INTO t2 VALUES (1,1,'y');
-INSERT INTO t2 VALUES (1,2,'y');
-INSERT INTO t2 VALUES (2,1,'n');
-INSERT INTO t2 VALUES (3,1,'n');
-INSERT INTO t2 VALUES (4,1,'y');
-INSERT INTO t2 VALUES (4,2,'n');
-INSERT INTO t2 VALUES (4,3,'n');
-INSERT INTO t2 VALUES (6,1,'n');
-INSERT INTO t2 VALUES (8,1,'y');
-
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-SELECT a.col1,a.col2,b.col2,b.col3
- FROM t1 a LEFT JOIN t2 b ON a.col1=b.col1
- WHERE b.col2 IS NULL OR
- b.col2=(SELECT MAX(col2) FROM t2 b WHERE b.col1=a.col1);
-
-SELECT a.col1,a.col2,b.col2,b.col3
- FROM v1 a LEFT JOIN t2 b ON a.col1=b.col1
- WHERE b.col2 IS NULL OR
- b.col2=(SELECT MAX(col2) FROM t2 b WHERE b.col1=a.col1);
-
-CREATE VIEW v2 AS SELECT * FROM t2;
-
-SELECT a.col1,a.col2,b.col2,b.col3
- FROM v2 b RIGHT JOIN v1 a ON a.col1=b.col1
- WHERE b.col2 IS NULL OR
- b.col2=(SELECT MAX(col2) FROM v2 b WHERE b.col1=a.col1);
-
-# Tests from the report for Bug#6107
-
-SELECT a.col1,a.col2,b.col2,b.col3
- FROM v2 b RIGHT JOIN v1 a ON a.col1=b.col1
- WHERE a.col1 IN (1,5,9) AND
- (b.col2 IS NULL OR
- b.col2=(SELECT MAX(col2) FROM v2 b WHERE b.col1=a.col1));
-
-CREATE VIEW v3 AS SELECT * FROM t1 WHERE col1 IN (1,5,9);
-
-SELECT a.col1,a.col2,b.col2,b.col3
- FROM v2 b RIGHT JOIN v3 a ON a.col1=b.col1
- WHERE b.col2 IS NULL OR
- b.col2=(SELECT MAX(col2) FROM v2 b WHERE b.col1=a.col1);
-
-DROP VIEW v1,v2,v3;
-DROP TABLE t1,t2;
-
-#
-# Bug#8490 Select from views containing subqueries causes server to hang
-# forever.
-#
-create table t1 as select 1 A union select 2 union select 3;
-create table t2 as select * from t1;
-create view v1 as select * from t1 where a in (select * from t2);
-select * from v1 A, v1 B where A.a = B.a;
-create table t3 as select a a,a b from t2;
-create view v2 as select * from t3 where
- a in (select * from t1) or b in (select * from t2);
-select * from v2 A, v2 B where A.a = B.b;
-drop view v1, v2;
-drop table t1, t2, t3;
-
-#
-# Test case for Bug#8528 select from view over multi-table view
-#
-CREATE TABLE t1 (a int);
-CREATE TABLE t2 (b int);
-INSERT INTO t1 VALUES (1), (2), (3), (4);
-INSERT INTO t2 VALUES (4), (2);
-
-CREATE VIEW v1 AS SELECT * FROM t1,t2 WHERE t1.a=t2.b;
-SELECT * FROM v1;
-CREATE VIEW v2 AS SELECT * FROM v1;
-SELECT * FROM v2;
-
-DROP VIEW v2,v1;
-
-DROP TABLE t1, t2;
-#
-# Correct restoring view name in SP table locking Bug#9758
-#
-create table t1 (a int);
-create view v1 as select sum(a) from t1 group by a;
-delimiter //;
-create procedure p1()
-begin
-select * from v1;
-end//
-delimiter ;//
-call p1();
-call p1();
-drop procedure p1;
-drop view v1;
-drop table t1;
-
-#
-# Bug#7422 "order by" doesn't work
-#
-CREATE TABLE t1(a char(2) primary key, b char(2));
-CREATE TABLE t2(a char(2), b char(2), index i(a));
-INSERT INTO t1 VALUES ('a','1'), ('b','2');
-INSERT INTO t2 VALUES ('a','5'), ('a','6'), ('b','5'), ('b','6');
-CREATE VIEW v1 AS
- SELECT t1.b as c, t2.b as d FROM t1,t2 WHERE t1.a=t2.a;
-SELECT d, c FROM v1 ORDER BY d,c;
-DROP VIEW v1;
-DROP TABLE t1, t2;
-#
-# using sum(distinct ) & avg(distinct ) in views (Bug#7015)
-#
-create table t1 (s1 int);
-create view v1 as select sum(distinct s1) from t1;
-select * from v1;
-drop view v1;
-create view v1 as select avg(distinct s1) from t1;
-select * from v1;
-drop view v1;
-drop table t1;
-
-#
-# using cast(... as decimal) in views (Bug#11387);
-#
-create view v1 as select cast(1 as decimal);
-select * from v1;
-drop view v1;
-
-#
-# Bug#11298 insert into select from VIEW produces incorrect result when
-# using ORDER BY
-create table t1(f1 int);
-create table t2(f2 int);
-insert into t1 values(1),(2),(3);
-insert into t2 values(1),(2),(3);
-create view v1 as select * from t1,t2 where f1=f2;
-create table t3 (f1 int, f2 int);
-insert into t3 select * from v1 order by 1;
-select * from t3;
-drop view v1;
-drop table t1,t2,t3;
-
-#
-# Generation unique names for columns, and correct names check (Bug#7448)
-#
-# names with ' and \
-create view v1 as select '\\','\\shazam';
-select * from v1;
-drop view v1;
-create view v1 as select '\'','\shazam';
-select * from v1;
-drop view v1;
-# autogenerated names differ by case only
-create view v1 as select 'k','K';
-select * from v1;
-drop view v1;
-create table t1 (s1 int);
-# same autogenerated names
-create view v1 as select s1, 's1' from t1;
-select * from v1;
-drop view v1;
-create view v1 as select 's1', s1 from t1;
-select * from v1;
-drop view v1;
-# set name as one of expected autogenerated
-create view v1 as select 's1', s1, 1 as My_exp_s1 from t1;
-select * from v1;
-drop view v1;
-create view v1 as select 1 as My_exp_s1, 's1', s1 from t1;
-select * from v1;
-drop view v1;
-# set name conflict with autogenerated names
-create view v1 as select 1 as s1, 's1', 's1' from t1;
-select * from v1;
-drop view v1;
-create view v1 as select 's1', 's1', 1 as s1 from t1;
-select * from v1;
-drop view v1;
-# underlying field name conflict with autogenerated names
-create view v1 as select s1, 's1', 's1' from t1;
-select * from v1;
-drop view v1;
-create view v1 as select 's1', 's1', s1 from t1;
-select * from v1;
-drop view v1;
-# underlying field name conflict with set name
--- error ER_DUP_FIELDNAME
-create view v1 as select 1 as s1, 's1', s1 from t1;
--- error ER_DUP_FIELDNAME
-create view v1 as select 's1', s1, 1 as s1 from t1;
-drop table t1;
-# set names differ by case only
--- error ER_DUP_FIELDNAME
-create view v1(k, K) as select 1,2;
-
-#
-# using time_format in view (Bug#7521)
-#
-create view v1 as SELECT TIME_FORMAT(SEC_TO_TIME(3600),'%H:%i') as t;
-select * from v1;
-drop view v1;
-
-#
-# evaluation constant functions in WHERE (Bug#4663)
-#
-create table t1 (a timestamp default now());
-create table t2 (b timestamp default now());
-create view v1 as select a,b,t1.a < now() from t1,t2 where t1.a < now();
-SHOW CREATE VIEW v1;
-drop view v1;
-drop table t1, t2;
-CREATE TABLE t1 ( a varchar(50) );
-CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = CURRENT_USER();
-SHOW CREATE VIEW v1;
-DROP VIEW v1;
-CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = VERSION();
-SHOW CREATE VIEW v1;
-DROP VIEW v1;
-CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = DATABASE();
-SHOW CREATE VIEW v1;
-DROP VIEW v1;
-DROP TABLE t1;
-
-#
-# checking views after some view with error (Bug#11337)
-#
-CREATE TABLE t1 (col1 time);
-CREATE TABLE t2 (col1 time);
-CREATE VIEW v1 AS SELECT CONVERT_TZ(col1,'GMT','MET') FROM t1;
-CREATE VIEW v2 AS SELECT CONVERT_TZ(col1,'GMT','MET') FROM t2;
-CREATE VIEW v3 AS SELECT CONVERT_TZ(col1,'GMT','MET') FROM t1;
-CREATE VIEW v4 AS SELECT CONVERT_TZ(col1,'GMT','MET') FROM t2;
-CREATE VIEW v5 AS SELECT CONVERT_TZ(col1,'GMT','MET') FROM t1;
-CREATE VIEW v6 AS SELECT CONVERT_TZ(col1,'GMT','MET') FROM t2;
-DROP TABLE t1;
-CHECK TABLE v1, v2, v3, v4, v5, v6;
-drop view v1, v2, v3, v4, v5, v6;
-drop table t2;
-
---disable_warnings
-drop function if exists f1;
-drop function if exists f2;
---enable_warnings
-CREATE TABLE t1 (col1 time);
-CREATE TABLE t2 (col1 time);
-CREATE TABLE t3 (col1 time);
-create function f1 () returns int return (select max(col1) from t1);
-create function f2 () returns int return (select max(col1) from t2);
-CREATE VIEW v1 AS SELECT f1() FROM t3;
-CREATE VIEW v2 AS SELECT f2() FROM t3;
-CREATE VIEW v3 AS SELECT f1() FROM t3;
-CREATE VIEW v4 AS SELECT f2() FROM t3;
-CREATE VIEW v5 AS SELECT f1() FROM t3;
-CREATE VIEW v6 AS SELECT f2() FROM t3;
-drop function f1;
-CHECK TABLE v1, v2, v3, v4, v5, v6;
-create function f1 () returns int return (select max(col1) from t1);
-DROP TABLE t1;
-CHECK TABLE v1, v2, v3, v4, v5, v6;
-drop function f1;
-drop function f2;
-drop view v1, v2, v3, v4, v5, v6;
-drop table t2,t3;
-
-#
-# Bug#11325 Wrong date comparison in views
-#
-create table t1 (f1 date);
-insert into t1 values ('2005-01-01'),('2005-02-02');
-create view v1 as select * from t1;
-select * from v1 where f1='2005.02.02';
-select * from v1 where '2005.02.02'=f1;
-drop view v1;
-drop table t1;
-
-#
-# using encrypt & substring_index in view (Bug#7024)
-#
-CREATE VIEW v1 AS SELECT ENCRYPT("dhgdhgd");
-disable_result_log;
-SELECT * FROM v1;
-enable_result_log;
-drop view v1;
-CREATE VIEW v1 AS SELECT SUBSTRING_INDEX("dkjhgd:kjhdjh", ":", 1);
-SELECT * FROM v1;
-drop view v1;
-
-#
-# hide underlying tables names in case of imposibility to update (Bug#10773)
-#
-create table t1 (f59 int, f60 int, f61 int);
-insert into t1 values (19,41,32);
-create view v1 as select f59, f60 from t1 where f59 in
- (select f59 from t1);
--- error ER_NON_UPDATABLE_TABLE
-update v1 set f60=2345;
-drop view v1;
-drop table t1;
-
-#
-# Using var_samp with view (Bug#10651)
-#
-create table t1 (s1 int);
-create view v1 as select var_samp(s1) from t1;
-show create view v1;
-drop view v1;
-drop table t1;
-
-
-#
-# Correct inserting data check (absence of default value) for view
-# underlying tables (Bug#6443)
-#
-set sql_mode='strict_all_tables';
-CREATE TABLE t1 (col1 INT NOT NULL, col2 INT NOT NULL);
-CREATE VIEW v1 (vcol1) AS SELECT col1 FROM t1;
-CREATE VIEW v2 (vcol1) AS SELECT col1 FROM t1 WHERE col2 > 2;
--- error ER_NO_DEFAULT_FOR_FIELD
-INSERT INTO t1 (col1) VALUES(12);
--- error ER_NO_DEFAULT_FOR_VIEW_FIELD
-INSERT INTO v1 (vcol1) VALUES(12);
--- error ER_NO_DEFAULT_FOR_VIEW_FIELD
-INSERT INTO v2 (vcol1) VALUES(12);
-set sql_mode=default;
-drop view v2,v1;
-drop table t1;
-
-
-#
-# Bug#11399 Use an alias in a select statement on a view
-#
-create table t1 (f1 int);
-insert into t1 values (1);
-create view v1 as select f1 from t1;
-select f1 as alias from v1;
-drop view v1;
-drop table t1;
-
-
-#
-# Test for Bug#6120 SP cache to be invalidated when altering a view
-#
-
-CREATE TABLE t1 (s1 int, s2 int);
-INSERT INTO t1 VALUES (1,2);
-CREATE VIEW v1 AS SELECT s2 AS s1, s1 AS s2 FROM t1;
-SELECT * FROM v1;
-CREATE PROCEDURE p1 () SELECT * FROM v1;
-CALL p1();
-ALTER VIEW v1 AS SELECT s1 AS s1, s2 AS s2 FROM t1;
-CALL p1();
-DROP VIEW v1;
-CREATE VIEW v1 AS SELECT s2 AS s1, s1 AS s2 FROM t1;
-CALL p1();
-
-DROP PROCEDURE p1;
-DROP VIEW v1;
-DROP TABLE t1;
-
-
-#
-# Test for Bug#11709 View was ordered by wrong column
-#
-create table t1 (f1 int, f2 int);
-create view v1 as select f1 as f3, f2 as f1 from t1;
-insert into t1 values (1,3),(2,1),(3,2);
-select * from v1 order by f1;
-drop view v1;
-drop table t1;
-
-
-#
-# Test for Bug#11771 wrong query_id in SELECT * FROM <view>
-#
-CREATE TABLE t1 (f1 char);
-INSERT INTO t1 VALUES ('A');
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-INSERT INTO t1 VALUES('B');
-SELECT * FROM v1;
-SELECT * FROM t1;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-
-#
-# opening table in correct locking mode (Bug#9597)
-#
-CREATE TABLE t1 ( bug_table_seq INTEGER NOT NULL);
-CREATE OR REPLACE VIEW v1 AS SELECT * from t1;
-DROP PROCEDURE IF EXISTS p1;
-delimiter //;
-CREATE PROCEDURE p1 ( )
-BEGIN
- DO (SELECT @next := IFNULL(max(bug_table_seq),0) + 1 FROM v1);
- INSERT INTO t1 VALUES (1);
-END //
-delimiter ;//
-CALL p1();
-DROP PROCEDURE p1;
-DROP VIEW v1;
-DROP TABLE t1;
-
-
-#
-# Bug#11760 Typo in Item_func_add_time::print() results in NULLs returned
-# subtime() in view
-create table t1(f1 datetime);
-insert into t1 values('2005.01.01 12:0:0');
-create view v1 as select f1, subtime(f1, '1:1:1') as sb from t1;
-select * from v1;
-drop view v1;
-drop table t1;
-
-
-#
-# Test for Bug#11412 query over a multitable view with GROUP_CONCAT
-#
-CREATE TABLE t1 (
- aid int PRIMARY KEY,
- fn varchar(20) NOT NULL,
- ln varchar(20) NOT NULL
-);
-CREATE TABLE t2 (
- aid int NOT NULL,
- pid int NOT NULL
-);
-INSERT INTO t1 VALUES(1,'a','b'), (2,'c','d');
-INSERT INTO t2 values (1,1), (2,1), (2,2);
-
-CREATE VIEW v1 AS SELECT t1.*,t2.pid FROM t1,t2 WHERE t1.aid = t2.aid;
-
-SELECT pid,GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1) FROM t1,t2
- WHERE t1.aid = t2.aid GROUP BY pid;
-SELECT pid,GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1) FROM v1 GROUP BY pid;
-
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
-
-#
-# Test for Bug#12382 SELECT * FROM view after INSERT command
-#
-
-CREATE TABLE t1 (id int PRIMARY KEY, f varchar(255));
-CREATE VIEW v1 AS SELECT id, f FROM t1 WHERE id <= 2;
-INSERT INTO t1 VALUES (2, 'foo2');
-INSERT INTO t1 VALUES (1, 'foo1');
-
-SELECT * FROM v1;
-SELECT * FROM v1;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-
-#
-# Test for Bug#12470 crash for a simple select from a view defined
-# as a join over 5 tables
-
-CREATE TABLE t1 (pk int PRIMARY KEY, b int);
-CREATE TABLE t2 (pk int PRIMARY KEY, fk int, INDEX idx(fk));
-CREATE TABLE t3 (pk int PRIMARY KEY, fk int, INDEX idx(fk));
-CREATE TABLE t4 (pk int PRIMARY KEY, fk int, INDEX idx(fk));
-CREATE TABLE t5 (pk int PRIMARY KEY, fk int, INDEX idx(fk));
-CREATE VIEW v1 AS
- SELECT t1.pk as a FROM t1,t2,t3,t4,t5
- WHERE t1.b IS NULL AND
- t1.pk=t2.fk AND t2.pk=t3.fk AND t3.pk=t4.fk AND t4.pk=t5.fk;
-
-SELECT a FROM v1;
-
-DROP VIEW v1;
-DROP TABLE t1,t2,t3,t4,t5;
-
-
-#
-# Bug#12298 Typo in function name results in erroneous view being created.
-#
-create view v1 as select timestampdiff(day,'1997-01-01 00:00:00','1997-01-02 00:00:00') as f1;
-select * from v1;
-drop view v1;
-
-#
-# repeatable CREATE VIEW statement Bug#12468
-#
-create table t1(a int);
-create procedure p1() create view v1 as select * from t1;
-drop table t1;
--- error ER_NO_SUCH_TABLE
-call p1();
--- error ER_NO_SUCH_TABLE
-call p1();
-drop procedure p1;
-
-
-#
-# Bug#10624 Views with multiple UNION and UNION ALL produce incorrect results
-#
-create table t1 (f1 int);
-create table t2 (f1 int);
-insert into t1 values (1);
-insert into t2 values (2);
-create view v1 as select * from t1 union select * from t2 union all select * from t2;
-select * from v1;
-drop view v1;
-drop table t1,t2;
-
-
-#
-# Test for Bug#10970 view referring a temporary table indirectly
-#
-
-CREATE TEMPORARY TABLE t1 (a int);
-CREATE FUNCTION f1 () RETURNS int RETURN (SELECT COUNT(*) FROM t1);
--- error ER_VIEW_SELECT_TMPTABLE
-CREATE VIEW v1 AS SELECT f1();
-
-DROP FUNCTION f1;
-DROP TABLE t1;
-
-
-#
-# Bug#12533 (crash on DESCRIBE <view> after renaming base table column)
-#
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP VIEW IF EXISTS v1;
---enable_warnings
-
-CREATE TABLE t1 (f4 CHAR(5));
-CREATE VIEW v1 AS SELECT * FROM t1;
-DESCRIBE v1;
-
-ALTER TABLE t1 CHANGE COLUMN f4 f4x CHAR(5);
---error ER_VIEW_INVALID
-DESCRIBE v1;
-DROP TABLE t1;
-DROP VIEW v1;
-
-
-#
-# Bug#12489 wrongly printed strcmp() function results in creation of broken
-# view
-create table t1 (f1 char);
-create view v1 as select strcmp(f1,'a') from t1;
-select * from v1;
-drop view v1;
-drop table t1;
-
-
-#
-# Bug#12922 if(sum(),...) with group from view returns wrong results
-#
-create table t1 (f1 int, f2 int,f3 int);
-insert into t1 values (1,10,20),(2,0,0);
-create view v1 as select * from t1;
-select if(sum(f1)>1,f2,f3) from v1 group by f1;
-drop view v1;
-drop table t1;
-
-
-# Bug#12941
-#
-create table t1 (
- r_object_id char(16) NOT NULL,
- group_name varchar(32) NOT NULL
-);
-
-create table t2 (
- r_object_id char(16) NOT NULL,
- i_position int(11) NOT NULL,
- users_names varchar(32) default NULL
-);
-
-create view v1 as select r_object_id, group_name from t1;
-create view v2 as select r_object_id, i_position, users_names from t2;
-
-create unique index r_object_id on t1(r_object_id);
-create index group_name on t1(group_name);
-create unique index r_object_id_i_position on t2(r_object_id,i_position);
-create index users_names on t2(users_names);
-
-insert into t1 values('120001a080000542','tstgroup1');
-insert into t2 values('120001a080000542',-1, 'guser01');
-insert into t2 values('120001a080000542',-2, 'guser02');
-
-select v1.r_object_id, v2.users_names from v1, v2
-where (v1.group_name='tstgroup1') and v2.r_object_id=v1.r_object_id
-order by users_names;
-
-drop view v1, v2;
-drop table t1, t2;
-
-
-#
-# Bug#6808 Views: CREATE VIEW v ... FROM t AS v fails
-#
-
-create table t1 (s1 int);
-create view abc as select * from t1 as abc;
-drop table t1;
-drop view abc;
-
-
-#
-# Bug#12993 View column rename broken in subselect
-#
-
-flush status;
-create table t1(f1 char(1));
-create view v1 as select * from t1;
-select * from (select f1 as f2, f1 as f3 from v1) v where v.f2='a';
-show status like "Created_tmp%";
-drop view v1;
-drop table t1;
-
-set @tmp=@@optimizer_switch;
-set @@optimizer_switch='derived_merge=OFF';
-create table t1(f1 char(1));
-create view v1 as select * from t1;
-select * from (select f1 as f2, f1 as f3 from v1) v where v.f2='a';
-show status like "Created_tmp%";
-drop view v1;
-drop table t1;
-set @@optimizer_switch=@tmp;
-
-#
-# Bug#11416 Server crash if using a view that uses function convert_tz
-#
-create view v1 as SELECT CONVERT_TZ('2004-01-01 12:00:00','GMT','MET');
-select * from v1;
-drop view v1;
-
-
-#
-# Bugs#12963, #13000 wrong creation of VIEW with DAYNAME, DAYOFWEEK, and WEEKDAY
-#
-
-CREATE TABLE t1 (date DATE NOT NULL);
-INSERT INTO t1 VALUES ('2005-09-06');
-
-CREATE VIEW v1 AS SELECT DAYNAME(date) FROM t1;
-SHOW CREATE VIEW v1;
-
-CREATE VIEW v2 AS SELECT DAYOFWEEK(date) FROM t1;
-SHOW CREATE VIEW v2;
-
-CREATE VIEW v3 AS SELECT WEEKDAY(date) FROM t1;
-SHOW CREATE VIEW v3;
-
-SELECT DAYNAME('2005-09-06');
-SELECT DAYNAME(date) FROM t1;
-SELECT * FROM v1;
-
-SELECT DAYOFWEEK('2005-09-06');
-SELECT DAYOFWEEK(date) FROM t1;
-SELECT * FROM v2;
-
-SELECT WEEKDAY('2005-09-06');
-SELECT WEEKDAY(date) FROM t1;
-SELECT * FROM v3;
-
-DROP TABLE t1;
-DROP VIEW v1, v2, v3;
-
-
-#
-# Bug#13411 crash when using non-qualified view column in HAVING clause
-#
-
-CREATE TABLE t1 ( a int, b int );
-INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
-CREATE VIEW v1 AS SELECT a,b FROM t1;
-SELECT t1.a FROM t1 GROUP BY t1.a HAVING a > 1;
-SELECT v1.a FROM v1 GROUP BY v1.a HAVING a > 1;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-
-#
-# Bug#13410 failed name resolution for qualified view column in HAVING
-#
-
-CREATE TABLE t1 ( a int, b int );
-INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
-CREATE VIEW v1 AS SELECT a,b FROM t1;
-SELECT t1.a FROM t1 GROUP BY t1.a HAVING t1.a > 1;
-SELECT v1.a FROM v1 GROUP BY v1.a HAVING v1.a > 1;
-SELECT t_1.a FROM t1 AS t_1 GROUP BY t_1.a HAVING t_1.a IN (1,2,3);
-SELECT v_1.a FROM v1 AS v_1 GROUP BY v_1.a HAVING v_1.a IN (1,2,3);
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-
-#
-# Bug#13327 view wasn't using index for const condition
-#
-
-CREATE TABLE t1 (a INT, b INT, INDEX(a,b));
-CREATE TABLE t2 LIKE t1;
-CREATE TABLE t3 (a INT);
-INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
-INSERT INTO t2 VALUES (1,1),(2,2),(3,3);
-INSERT INTO t3 VALUES (1),(2),(3);
-CREATE VIEW v1 AS SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a AND t1.b=t2.b;
-CREATE VIEW v2 AS SELECT t3.* FROM t1,t3 WHERE t1.a=t3.a;
-EXPLAIN SELECT t1.* FROM t1 JOIN t2 WHERE t1.a=t2.a AND t1.b=t2.b AND t1.a=1;
-EXPLAIN SELECT * FROM v1 WHERE a=1;
-EXPLAIN SELECT * FROM v2 WHERE a=1;
-DROP VIEW v1,v2;
-DROP TABLE t1,t2,t3;
-
-
-#
-# Bug#13622 Wrong view .frm created if some field's alias contain \n
-#
-create table t1 (f1 int);
-create view v1 as select t1.f1 as '123
-456' from t1;
-select * from v1;
-drop view v1;
-drop table t1;
-
-
-# Bug#14466 lost sort order in GROUP_CONCAT() in a view
-#
-create table t1 (f1 int, f2 int);
-insert into t1 values(1,1),(1,2),(1,3);
-create view v1 as select f1 ,group_concat(f2 order by f2 asc) from t1 group by f1;
-create view v2 as select f1 ,group_concat(f2 order by f2 desc) from t1 group by f1;
-select * from v1;
-select * from v2;
-drop view v1,v2;
-drop table t1;
-
-
-#
-# Bug#14026 Crash on second PS execution when using views
-#
-create table t1 (x int, y int);
-create table t2 (x int, y int, z int);
-create table t3 (x int, y int, z int);
-create table t4 (x int, y int, z int);
-
-create view v1 as
-select t1.x
-from (
- (t1 join t2 on ((t1.y = t2.y)))
- join
- (t3 left join t4 on (t3.y = t4.y) and (t3.z = t4.z))
-);
-
-prepare stmt1 from "select count(*) from v1 where x = ?";
-set @parm1=1;
-
-execute stmt1 using @parm1;
-execute stmt1 using @parm1;
-drop view v1;
-drop table t1,t2,t3,t4;
-
-
-#
-# Bug#14540 OPTIMIZE, ANALYZE, REPAIR applied to not a view
-#
-
-CREATE TABLE t1(id INT);
-CREATE VIEW v1 AS SELECT id FROM t1;
-
-OPTIMIZE TABLE v1;
-ANALYZE TABLE v1;
-REPAIR TABLE v1;
-
-DROP TABLE t1;
-OPTIMIZE TABLE v1;
-ANALYZE TABLE v1;
-REPAIR TABLE v1;
-
-DROP VIEW v1;
-
-
-#
-# Bug#14719 Views DEFINER grammar is incorrect
-#
-
-create definer = current_user() sql security invoker view v1 as select 1;
-show create view v1;
-drop view v1;
-
-create definer = current_user sql security invoker view v1 as select 1;
-show create view v1;
-drop view v1;
-
-
-#
-# Bug#14816 test_if_order_by_key() expected only Item_fields.
-#
-create table t1 (id INT, primary key(id));
-insert into t1 values (1),(2);
-create view v1 as select * from t1;
-explain select id from v1 order by id;
-drop view v1;
-drop table t1;
-
-
-#
-# Bug#14850 Item_ref's values wasn't updated
-#
-create table t1(f1 int, f2 int);
-insert into t1 values (null, 10), (null,2);
-select f1, sum(f2) from t1 group by f1;
-create view v1 as select * from t1;
-select f1, sum(f2) from v1 group by f1;
-drop view v1;
-drop table t1;
-
-
-#
-# Bug#14885 incorrect SOURCE in view created in a procedure
-# TODO: here SOURCE string must be shown when it will be possible
-#
---disable_warnings
-drop procedure if exists p1;
---enable_warnings
-delimiter //;
-create procedure p1 () deterministic
-begin
-create view v1 as select 1;
-end;
-//
-delimiter ;//
-call p1();
-show create view v1;
-drop view v1;
-drop procedure p1;
-
-
-#
-# Bug#15096 using function with view for view creation
-#
-CREATE VIEW v1 AS SELECT 42 AS Meaning;
---disable_warnings
-DROP FUNCTION IF EXISTS f1;
---enable_warnings
-DELIMITER //;
-CREATE FUNCTION f1() RETURNS INTEGER
-BEGIN
- DECLARE retn INTEGER;
- SELECT Meaning FROM v1 INTO retn;
- RETURN retn;
-END
-//
-DELIMITER ;//
-CREATE VIEW v2 AS SELECT f1();
-select * from v2;
-drop view v2,v1;
-drop function f1;
-
-
-#
-# Bug#14861 aliased column names are not preserved.
-#
-create table t1 (id numeric, warehouse_id numeric);
-create view v1 as select id from t1;
-create view v2 as
-select t1.warehouse_id, v1.id as receipt_id
-from t1, v1 where t1.id = v1.id;
-
-insert into t1 (id, warehouse_id) values(3, 2);
-insert into t1 (id, warehouse_id) values(4, 2);
-insert into t1 (id, warehouse_id) values(5, 1);
-
-select v2.receipt_id as alias1, v2.receipt_id as alias2 from v2
-order by v2.receipt_id;
-
-drop view v2, v1;
-drop table t1;
-
-
-#
-# Bug#16016 MIN/MAX optimization for views
-#
-
-CREATE TABLE t1 (a int PRIMARY KEY, b int);
-INSERT INTO t1 VALUES (2,20), (3,10), (1,10), (0,30), (5,10);
-
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-SELECT MAX(a) FROM t1;
-SELECT MAX(a) FROM v1;
-
-EXPLAIN SELECT MAX(a) FROM t1;
-EXPLAIN SELECT MAX(a) FROM v1;
-
-SELECT MIN(a) FROM t1;
-SELECT MIN(a) FROM v1;
-
-EXPLAIN SELECT MIN(a) FROM t1;
-EXPLAIN SELECT MIN(a) FROM v1;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-
-#
-# Bug#16382 grouping name is resolved against a view column name
-# which coincides with a select column name
-
-CREATE TABLE t1 (x varchar(10));
-INSERT INTO t1 VALUES (null), ('foo'), ('bar'), (null);
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-SELECT IF(x IS NULL, 'blank', 'not blank') FROM v1 GROUP BY x;
-SELECT IF(x IS NULL, 'blank', 'not blank') AS x FROM t1 GROUP BY x;
-SELECT IF(x IS NULL, 'blank', 'not blank') AS x FROM v1;
-SELECT IF(x IS NULL, 'blank', 'not blank') AS y FROM v1 GROUP BY y;
-SELECT IF(x IS NULL, 'blank', 'not blank') AS x FROM v1 GROUP BY x;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-
-#
-# Bug#15943 mysql_next_result hangs on invalid SHOW CREATE VIEW
-#
-
-delimiter //;
-drop table if exists t1;
-drop view if exists v1;
-create table t1 (id int);
-create view v1 as select * from t1;
-drop table t1;
-show create view v1;
-drop view v1;
-//
-delimiter ;//
-
-
-#
-# Bug#17726 Not checked empty list caused endless loop
-#
-create table t1(f1 int, f2 int);
-create view v1 as select ta.f1 as a, tb.f1 as b from t1 ta, t1 tb where ta.f1=tb
-.f1 and ta.f2=tb.f2;
-insert into t1 values(1,1),(2,2);
-create view v2 as select * from v1 where a > 1 with local check option;
-select * from v2;
-update v2 set b=3 where a=2;
-select * from v2;
-drop view v2, v1;
-drop table t1;
-
-
-#
-# Bug#18386 select from view over a table with ORDER BY view_col clause
-# given view_col is not an image of any column from the base table
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (1), (2);
-
-CREATE VIEW v1 AS SELECT SQRT(a) my_sqrt FROM t1;
-
-SELECT my_sqrt FROM v1 ORDER BY my_sqrt;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-
-#
-# Bug#18237 invalid count optimization applied to an outer join with a view
-#
-
-CREATE TABLE t1 (id int PRIMARY KEY);
-CREATE TABLE t2 (id int PRIMARY KEY);
-
-INSERT INTO t1 VALUES (1), (3);
-INSERT INTO t2 VALUES (1), (2), (3);
-
-CREATE VIEW v2 AS SELECT * FROM t2;
-
-SELECT COUNT(*) FROM t1 LEFT JOIN t2 ON t1.id=t2.id;
-SELECT * FROM t1 LEFT JOIN t2 ON t1.id=t2.id;
-
-SELECT COUNT(*) FROM t1 LEFT JOIN v2 ON t1.id=v2.id;
-
-DROP VIEW v2;
-
-DROP TABLE t1, t2;
-
-
-#
-# Bug#16069 VIEW does return the same results as underlying SELECT
-# with WHERE condition containing BETWEEN over dates
-# Dates as strings should be casted to date type
-
-CREATE TABLE t1 (id int NOT NULL PRIMARY KEY,
- td date DEFAULT NULL, KEY idx(td));
-
-INSERT INTO t1 VALUES
- (1, '2005-01-01'), (2, '2005-01-02'), (3, '2005-01-02'),
- (4, '2005-01-03'), (5, '2005-01-04'), (6, '2005-01-05'),
- (7, '2005-01-05'), (8, '2005-01-05'), (9, '2005-01-06');
-
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-SELECT * FROM t1 WHERE td BETWEEN CAST('2005.01.02' AS DATE) AND CAST('2005.01.04' AS DATE);
-SELECT * FROM v1 WHERE td BETWEEN CAST('2005.01.02' AS DATE) AND CAST('2005.01.04' AS DATE);
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-
-#
-# Bug#14308 Recursive view definitions
-#
-# using view only
-create table t1 (a int);
-create view v1 as select * from t1;
-create view v2 as select * from v1;
-drop table t1;
-rename table v2 to t1;
--- error ER_VIEW_RECURSIVE
-select * from v1;
-drop view t1, v1;
-# using SP function
-create table t1 (a int);
-delimiter //;
-create function f1() returns int
-begin
- declare mx int;
- select max(a) from t1 into mx;
- return mx;
-end//
-delimiter ;//
-create view v1 as select f1() as a;
-create view v2 as select * from v1;
-drop table t1;
-rename table v2 to t1;
--- error ER_SP_NO_RECURSION
-select * from v1;
-drop function f1;
-drop view t1, v1;
-
-
-#
-# Bug#15153 CONVERT_TZ() is not allowed in all places in VIEWs
-#
-# Error was reported when one tried to use CONVERT_TZ() function
-# select list of view which was processed using MERGE algorithm.
-# (Also see additional test in timezone_grant.test)
-create table t1 (dt datetime);
-insert into t1 values (20040101000000), (20050101000000), (20060101000000);
-# Let us test that convert_tz() can be used in view's select list
-create view v1 as select convert_tz(dt, 'UTC', 'Europe/Moscow') as ldt from t1;
-select * from v1;
-drop view v1;
-# And in its where part
-create view v1 as select * from t1 where convert_tz(dt, 'UTC', 'Europe/Moscow') >= 20050101000000;
-select * from v1;
-# Other interesting case - a view which uses convert_tz() function
-# through other view.
-create view v2 as select * from v1 where dt < 20060101000000;
-select * from v2;
-drop view v2;
-# And even more interesting case when view uses convert_tz() both
-# directly and indirectly
-create view v2 as select convert_tz(dt, 'UTC', 'Europe/Moscow') as ldt from v1;
-select * from v2;
-drop view v1, v2;
-drop table t1;
-
-
-#
-# Bug#19490 usage of view specified by a query with GROUP BY
-# an expression containing non-constant interval
-
-CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, d datetime);
-
-CREATE VIEW v1 AS
-SELECT id, date(d) + INTERVAL TIME_TO_SEC(d) SECOND AS t, COUNT(*)
- FROM t1 GROUP BY id, t;
-
-SHOW CREATE VIEW v1;
-SELECT * FROM v1;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-
-#
-# Bug#19077 A nested materialized view is used before being populated.
-#
-CREATE TABLE t1 (i INT, j BIGINT);
-INSERT INTO t1 VALUES (1, 2), (2, 2), (3, 2);
-CREATE VIEW v1 AS SELECT MIN(j) AS j FROM t1;
-CREATE VIEW v2 AS SELECT MIN(i) FROM t1 WHERE j = ( SELECT * FROM v1 );
-SELECT * FROM v2;
-DROP VIEW v2, v1;
-DROP TABLE t1;
-
-
-#
-# Bug#19573 VIEW with HAVING that refers an alias name
-#
-
-CREATE TABLE t1(
- fName varchar(25) NOT NULL,
- lName varchar(25) NOT NULL,
- DOB date NOT NULL,
- test_date date NOT NULL,
- uID int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY);
-
-INSERT INTO t1(fName, lName, DOB, test_date) VALUES
- ('Hank', 'Hill', '1964-09-29', '2007-01-01'),
- ('Tom', 'Adams', '1908-02-14', '2007-01-01'),
- ('Homer', 'Simpson', '1968-03-05', '2007-01-01');
-
-CREATE VIEW v1 AS
- SELECT (year(test_date)-year(DOB)) AS Age
- FROM t1 HAVING Age < 75;
-SHOW CREATE VIEW v1;
-
-SELECT (year(test_date)-year(DOB)) AS Age FROM t1 HAVING Age < 75;
-SELECT * FROM v1;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-
-#
-# Bug#19089 wrong inherited dafault values in temp table views
-#
-
-CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a char(6) DEFAULT 'xxx');
-INSERT INTO t1(id) VALUES (1), (2), (3), (4);
-INSERT INTO t1 VALUES (5,'yyy'), (6,'yyy');
-SELECT * FROM t1;
-
-CREATE VIEW v1(a, m) AS SELECT a, MIN(id) FROM t1 GROUP BY a;
-SELECT * FROM v1;
-
-CREATE TABLE t2 SELECT * FROM v1;
-INSERT INTO t2(m) VALUES (0);
-SELECT * FROM t2;
-
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
-CREATE TABLE t1 (id int PRIMARY KEY, e ENUM('a','b') NOT NULL DEFAULT 'b');
-INSERT INTO t1(id) VALUES (1), (2), (3);
-INSERT INTO t1 VALUES (4,'a');
-SELECT * FROM t1;
-
-CREATE VIEW v1(m, e) AS SELECT MIN(id), e FROM t1 GROUP BY e;
-CREATE TABLE t2 SELECT * FROM v1;
-SELECT * FROM t2;
-
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
-
-#
-# Bug#16110 insert permitted into view col w/o default value
-#
-CREATE TABLE t1 (a INT NOT NULL, b INT NULL DEFAULT NULL);
-CREATE VIEW v1 AS SELECT a, b FROM t1;
-
-INSERT IGNORE INTO v1 (b) VALUES (2);
-
-SET SQL_MODE = STRICT_ALL_TABLES;
---error ER_NO_DEFAULT_FOR_VIEW_FIELD
-INSERT INTO v1 (b) VALUES (4);
-SET SQL_MODE = '';
-
-SELECT * FROM t1;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-
-#
-# Bug#18243 expression over a view column that with the REVERSE function
-#
-
-CREATE TABLE t1 (firstname text, surname text);
-INSERT INTO t1 VALUES
- ("Bart","Simpson"),("Milhouse","van Houten"),("Montgomery","Burns");
-
-CREATE VIEW v1 AS SELECT CONCAT(firstname," ",surname) AS name FROM t1;
-SELECT CONCAT(LEFT(name,LENGTH(name)-INSTR(REVERSE(name)," ")),
- LEFT(name,LENGTH(name)-INSTR(REVERSE(name)," "))) AS f1
- FROM v1;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-
-#
-# Bug#19714 wrong type of a view column specified by an expressions over ints
-#
-
-CREATE TABLE t1 (i int, j int);
-CREATE VIEW v1 AS SELECT COALESCE(i,j) FROM t1;
-DESCRIBE v1;
-CREATE TABLE t2 SELECT COALESCE(i,j) FROM t1;
-DESCRIBE t2;
-
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
-
-#
-# Bug#17526 views with TRIM functions
-#
-
-CREATE TABLE t1 (s varchar(10));
-INSERT INTO t1 VALUES ('yadda'), ('yady');
-
-SELECT TRIM(BOTH 'y' FROM s) FROM t1;
-CREATE VIEW v1 AS SELECT TRIM(BOTH 'y' FROM s) FROM t1;
-SELECT * FROM v1;
-DROP VIEW v1;
-
-SELECT TRIM(LEADING 'y' FROM s) FROM t1;
-CREATE VIEW v1 AS SELECT TRIM(LEADING 'y' FROM s) FROM t1;
-SELECT * FROM v1;
-DROP VIEW v1;
-
-SELECT TRIM(TRAILING 'y' FROM s) FROM t1;
-CREATE VIEW v1 AS SELECT TRIM(TRAILING 'y' FROM s) FROM t1;
-SELECT * FROM v1;
-DROP VIEW v1;
-
-DROP TABLE t1;
-
-
-#
-# Bug#21080 ALTER VIEW makes user restate SQL SECURITY mode, and ALGORITHM
-#
-CREATE TABLE t1 (x INT, y INT);
-CREATE ALGORITHM=TEMPTABLE SQL SECURITY INVOKER VIEW v1 AS SELECT x FROM t1;
-SHOW CREATE VIEW v1;
-
-ALTER VIEW v1 AS SELECT x, y FROM t1;
-SHOW CREATE VIEW v1;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-
-# Bug#21086 server crashes when VIEW defined with a SELECT with COLLATE
-# clause is called
-#
-CREATE TABLE t1 (s1 char);
-INSERT INTO t1 VALUES ('Z');
-
-CREATE VIEW v1 AS SELECT s1 collate latin1_german1_ci AS col FROM t1;
-
-CREATE VIEW v2 (col) AS SELECT s1 collate latin1_german1_ci FROM t1;
-
-# either of these statements will cause crash
-INSERT INTO v1 (col) VALUES ('b');
-INSERT INTO v2 (col) VALUES ('c');
-
-SELECT s1 FROM t1;
-DROP VIEW v1, v2;
-DROP TABLE t1;
-
-
-#
-# Bug#11551 Asymmetric + undocumented behaviour of DROP VIEW and DROP TABLE
-#
-CREATE TABLE t1 (id INT);
-CREATE VIEW v1 AS SELECT id FROM t1;
-SHOW TABLES;
-
---error ER_UNKNOWN_VIEW
-DROP VIEW v2,v1;
-SHOW TABLES;
-
-CREATE VIEW v1 AS SELECT id FROM t1;
---error ER_WRONG_OBJECT
-DROP VIEW t1,v1;
-SHOW TABLES;
-
-DROP TABLE t1;
---disable_warnings
-DROP VIEW IF EXISTS v1;
---enable_warnings
-
-
-#
-# Bug#21261 Wrong access rights was required for an insert to a view
-#
-
-set GLOBAL sql_mode="";
-set LOCAL sql_mode="";
-CREATE DATABASE bug21261DB;
-USE bug21261DB;
-connect (root,localhost,root,,bug21261DB);
-connection root;
-CREATE TABLE t1 (x INT);
-CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT x FROM t1;
-GRANT INSERT, UPDATE ON v1 TO 'user21261'@'localhost';
-GRANT INSERT, UPDATE ON t1 TO 'user21261'@'localhost';
-CREATE TABLE t2 (y INT);
-GRANT SELECT ON t2 TO 'user21261'@'localhost';
-
-connect (user21261, localhost, user21261,, bug21261DB);
-connection user21261;
-INSERT INTO v1 (x) VALUES (5);
-UPDATE v1 SET x=1;
-connection root;
-GRANT SELECT ON v1 TO 'user21261'@'localhost';
-GRANT SELECT ON t1 TO 'user21261'@'localhost';
-connection user21261;
-UPDATE v1,t2 SET x=1 WHERE x=y;
-connection root;
-SELECT * FROM t1;
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user21261'@'localhost';
-DROP USER 'user21261'@'localhost';
-DROP VIEW v1;
-DROP TABLE t1;
-DROP DATABASE bug21261DB;
-
-connection default;
-USE test;
-disconnect root;
-disconnect user21261;
-
-set GLOBAL sql_mode=default;
-set LOCAL sql_mode=default;
-
-#
-# Bug#15950 NOW() optimized away in VIEWs
-#
-create table t1 (f1 datetime);
-create view v1 as select * from t1 where f1 between now() and now() + interval 1 minute;
-show create view v1;
-drop view v1;
-drop table t1;
-
-
-#
-# Test for Bug#16899 Possible buffer overflow in handling of DEFINER-clause.
-#
-
-# Prepare.
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP VIEW IF EXISTS v1;
-DROP VIEW IF EXISTS v2;
---enable_warnings
-
-CREATE TABLE t1(a INT, b INT);
-
---error ER_WRONG_STRING_LENGTH
-CREATE DEFINER=longer_than_80_456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789@localhost
- VIEW v1 AS SELECT a FROM t1;
-
---error ER_WRONG_STRING_LENGTH
-CREATE DEFINER=some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY
- VIEW v2 AS SELECT b FROM t1;
-
-# Cleanup.
-
-DROP TABLE t1;
-
-
-#
-# Bug#17591 Updatable view not possible with trigger or stored function
-#
-# During prelocking phase we didn't update lock type of view tables,
-# hence READ lock was always requested.
-#
---disable_warnings
-DROP FUNCTION IF EXISTS f1;
-DROP FUNCTION IF EXISTS f2;
-DROP VIEW IF EXISTS v1, v2;
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (i INT);
-
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-delimiter |;
-CREATE FUNCTION f1() RETURNS INT
-BEGIN
- INSERT INTO v1 VALUES (0);
- RETURN 0;
-END |
-delimiter ;|
-
-SELECT f1();
-
-CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t1;
-
-delimiter |;
-CREATE FUNCTION f2() RETURNS INT
-BEGIN
- INSERT INTO v2 VALUES (0);
- RETURN 0;
-END |
-delimiter ;|
-
---error ER_NON_INSERTABLE_TABLE
-SELECT f2();
-
-DROP FUNCTION f1;
-DROP FUNCTION f2;
-DROP VIEW v1, v2;
-DROP TABLE t1;
-
-
-#
-# Bug#5500 wrong select_type in EXPLAIN output for queries over views
-#
-
-CREATE TABLE t1 (s1 int);
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-EXPLAIN SELECT * FROM t1;
-EXPLAIN SELECT * FROM v1;
-
-INSERT INTO t1 VALUES (1), (3), (2);
-
-EXPLAIN SELECT * FROM t1 t WHERE t.s1+1 < (SELECT MAX(t1.s1) FROM t1);
-EXPLAIN SELECT * FROM v1 t WHERE t.s1+1 < (SELECT MAX(t1.s1) FROM t1);
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-
-#
-# Bug#5505 Wrong error message on INSERT into a view
-#
-create table t1 (s1 int);
-create view v1 as select s1 as a, s1 as b from t1;
---error ER_NON_INSERTABLE_TABLE
-insert into v1 values (1,1);
-update v1 set a = 5;
-drop view v1;
-drop table t1;
-
-
-#
-# Bug#21646 view qith a subquery in ON expression
-#
-
-CREATE TABLE t1(pk int PRIMARY KEY);
-CREATE TABLE t2(pk int PRIMARY KEY, fk int, ver int, org int);
-
-CREATE ALGORITHM=MERGE VIEW v1 AS
-SELECT t1.*
- FROM t1 JOIN t2
- ON t2.fk = t1.pk AND
- t2.ver = (SELECT MAX(t.ver) FROM t2 t WHERE t.org = t2.org);
-SHOW WARNINGS;
-SHOW CREATE VIEW v1;
-
-DROP VIEW v1;
-DROP TABLE t1, t2;
-
-
-#
-# Bug#19111 TRIGGERs selecting from a VIEW on the firing base table fail
-#
-# Allow to select from a view on a table being modified in a trigger
-# and stored function, since plain select is allowed there.
-#
---disable_warnings
-DROP FUNCTION IF EXISTS f1;
-DROP VIEW IF EXISTS v1;
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (i INT);
-INSERT INTO t1 VALUES (1);
-
-CREATE VIEW v1 AS SELECT MAX(i) FROM t1;
-
-# Plain 'SET NEW.i = (SELECT MAX(i) FROM t1) + 1' works, so select
-# from a view should work too.
-CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW
- SET NEW.i = (SELECT * FROM v1) + 1;
-INSERT INTO t1 VALUES (1);
-
-# Plain 'RETURN (SELECT MAX(i) FROM t1)' works in INSERT, so select
-# from a view should work too.
-CREATE FUNCTION f1() RETURNS INT RETURN (SELECT * FROM v1);
-UPDATE t1 SET i= f1();
-
-DROP FUNCTION f1;
-DROP VIEW v1;
-DROP TABLE t1;
-
-
-#
-# Bug#16813 (WITH CHECK OPTION doesn't work with UPDATE)
-#
-CREATE TABLE t1(id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, val INT UNSIGNED NOT NULL);
-CREATE VIEW v1 AS SELECT id, val FROM t1 WHERE val >= 1 AND val <= 5 WITH CHECK OPTION;
-INSERT INTO v1 (val) VALUES (2);
-INSERT INTO v1 (val) VALUES (4);
--- error ER_VIEW_CHECK_FAILED
-INSERT INTO v1 (val) VALUES (6);
--- error ER_VIEW_CHECK_FAILED
-UPDATE v1 SET val=6 WHERE id=2;
-DROP VIEW v1;
-DROP TABLE t1;
-
-
-#
-# Bug#22584 last_insert_id not updated after inserting a record
-# through a updatable view
-#
-# We still do not update LAST_INSERT_ID if AUTO_INCREMENT column is
-# not accessible through a view. However, we do not reset the value
-# of LAST_INSERT_ID, but keep it unchanged.
-#
---disable_warnings
-DROP VIEW IF EXISTS v1, v2;
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (i INT AUTO_INCREMENT PRIMARY KEY, j INT);
-CREATE VIEW v1 AS SELECT j FROM t1;
-CREATE VIEW v2 AS SELECT * FROM t1;
-
-INSERT INTO t1 (j) VALUES (1);
-SELECT LAST_INSERT_ID();
-
-INSERT INTO v1 (j) VALUES (2);
---echo # LAST_INSERT_ID() should not change.
-SELECT LAST_INSERT_ID();
-
-INSERT INTO v2 (j) VALUES (3);
---echo # LAST_INSERT_ID() should be updated.
-SELECT LAST_INSERT_ID();
-
-INSERT INTO v1 (j) SELECT j FROM t1;
---echo # LAST_INSERT_ID() should not change.
-SELECT LAST_INSERT_ID();
-
-SELECT * FROM t1;
-
-DROP VIEW v1, v2;
-DROP TABLE t1;
-
-
-#
-# Bug#25580 !0 as an operand in a select expression of a view
-#
-
-CREATE VIEW v AS SELECT !0 * 5 AS x FROM DUAL;
-SHOW CREATE VIEW v;
-
-SELECT !0 * 5 AS x FROM DUAL;
-SELECT * FROM v;
-
-DROP VIEW v;
-
-
-#
-# Bug#24293 '\Z' token is not handled correctly in views
-#
-
---disable_warnings
-DROP VIEW IF EXISTS v1;
---enable_warnings
-
-CREATE VIEW v1 AS SELECT 'The\ZEnd';
-SELECT * FROM v1;
-
-SHOW CREATE VIEW v1;
-
-DROP VIEW v1;
-
-
-#
-# Bug#26124 BETWEEN over a view column of the DATETIME type
-#
-
-CREATE TABLE t1 (mydate DATETIME);
-INSERT INTO t1 VALUES
- ('2007-01-01'), ('2007-01-02'), ('2007-01-30'), ('2007-01-31');
-
-CREATE VIEW v1 AS SELECT mydate from t1;
-
-SELECT * FROM t1 WHERE mydate BETWEEN '2007-01-01' AND '2007-01-31';
-SELECT * FROM v1 WHERE mydate BETWEEN '2007-01-01' AND '2007-01-31';
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-
-#
-# Bug#25931 update of a multi-table view with check option
-#
-
-CREATE TABLE t1 (a int);
-CREATE TABLE t2 (b int);
-INSERT INTO t1 VALUES (1), (2);
-INSERT INTO t2 VALUES (1), (2);
-
-CREATE VIEW v1 AS
- SELECT t2.b FROM t1,t2 WHERE t1.a = t2.b WITH CHECK OPTION;
-
-SELECT * FROM v1;
---error ER_VIEW_CHECK_FAILED
-UPDATE v1 SET b=3;
-SELECT * FROM v1;
-SELECT * FROM t1;
-SELECT * FROM t2;
-
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
-
-#
-# Bug#12122 Views with ORDER BY can't be resolved using MERGE algorithm.
-#
-create table t1(f1 int, f2 int);
-insert into t1 values(1,2),(1,3),(1,1),(2,3),(2,1),(2,2);
-select * from t1;
-create view v1 as select * from t1 order by f2;
-select * from v1;
-explain extended select * from v1;
-select * from v1 order by f1;
-explain extended select * from v1 order by f1;
-drop view v1;
-drop table t1;
-
-#
-# Bug#26209 queries with GROUP BY and ORDER BY using views
-#
-
-CREATE TABLE t1 (
- id int(11) NOT NULL PRIMARY KEY,
- country varchar(32),
- code int(11) default NULL
-);
-INSERT INTO t1 VALUES
- (1,'ITALY',100),(2,'ITALY',200),(3,'FRANCE',100), (4,'ITALY',100);
-
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-SELECT code, COUNT(DISTINCT country) FROM t1 GROUP BY code ORDER BY MAX(id);
-SELECT code, COUNT(DISTINCT country) FROM v1 GROUP BY code ORDER BY MAX(id);
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-
-#
-# Bug#25897 Some queries are no longer possible after a CREATE VIEW fails
-#
---disable_warnings
-DROP VIEW IF EXISTS v1;
---enable_warnings
-
-let $query = SELECT * FROM (SELECT 1) AS t into @w;
-
-eval $query;
---error ER_PARSE_ERROR
-eval CREATE VIEW v1 AS $query;
---echo # Previously the following would fail.
-eval $query;
-
-
-#
-# Bug#24532 The return data type of IS TRUE is different from similar operations
-#
-
---disable_warnings
-drop view if exists view_24532_a;
-drop view if exists view_24532_b;
-drop table if exists table_24532;
---enable_warnings
-
-create table table_24532 (
- a int,
- b bigint,
- c int(4),
- d bigint(48)
-);
-
-create view view_24532_a as
-select
- a IS TRUE,
- a IS NOT TRUE,
- a IS FALSE,
- a IS NOT FALSE,
- a IS UNKNOWN,
- a IS NOT UNKNOWN,
- a is NULL,
- a IS NOT NULL,
- ISNULL(a),
- b IS TRUE,
- b IS NOT TRUE,
- b IS FALSE,
- b IS NOT FALSE,
- b IS UNKNOWN,
- b IS NOT UNKNOWN,
- b is NULL,
- b IS NOT NULL,
- ISNULL(b),
- c IS TRUE,
- c IS NOT TRUE,
- c IS FALSE,
- c IS NOT FALSE,
- c IS UNKNOWN,
- c IS NOT UNKNOWN,
- c is NULL,
- c IS NOT NULL,
- ISNULL(c),
- d IS TRUE,
- d IS NOT TRUE,
- d IS FALSE,
- d IS NOT FALSE,
- d IS UNKNOWN,
- d IS NOT UNKNOWN,
- d is NULL,
- d IS NOT NULL,
- ISNULL(d)
-from table_24532;
-
-describe view_24532_a;
-
-create view view_24532_b as
-select
- a IS TRUE,
- if(ifnull(a, 0), 1, 0) as old_istrue,
- a IS NOT TRUE,
- if(ifnull(a, 0), 0, 1) as old_isnottrue,
- a IS FALSE,
- if(ifnull(a, 1), 0, 1) as old_isfalse,
- a IS NOT FALSE,
- if(ifnull(a, 1), 1, 0) as old_isnotfalse
-from table_24532;
-
-describe view_24532_b;
-
-show create view view_24532_b;
-
-insert into table_24532 values (0, 0, 0, 0);
-select * from view_24532_b;
-update table_24532 set a=1;
-select * from view_24532_b;
-update table_24532 set a=NULL;
-select * from view_24532_b;
-
-drop view view_24532_a;
-drop view view_24532_b;
-drop table table_24532;
-
-
-#
-# Bug#26560 view using subquery with a reference to an outer alias
-#
-
-CREATE TABLE t1 (
- lid int NOT NULL PRIMARY KEY,
- name char(10) NOT NULL
-);
-INSERT INTO t1 (lid, name) VALUES
- (1, 'YES'), (2, 'NO');
-
-CREATE TABLE t2 (
- id int NOT NULL PRIMARY KEY,
- gid int NOT NULL,
- lid int NOT NULL,
- dt date
-);
-INSERT INTO t2 (id, gid, lid, dt) VALUES
- (1, 1, 1, '2007-01-01'),(2, 1, 2, '2007-01-02'),
- (3, 2, 2, '2007-02-01'),(4, 2, 1, '2007-02-02');
-
-SELECT DISTINCT t2.gid AS lgid,
- (SELECT t1.name FROM t1, t2
- WHERE t1.lid = t2.lid AND t2.gid = lgid
- ORDER BY t2.dt DESC LIMIT 1
- ) as clid
- FROM t2;
-
-CREATE VIEW v1 AS
-SELECT DISTINCT t2.gid AS lgid,
- (SELECT t1.name FROM t1, t2
- WHERE t1.lid = t2.lid AND t2.gid = lgid
- ORDER BY t2.dt DESC LIMIT 1
- ) as clid
- FROM t2;
-SELECT * FROM v1;
-
-DROP VIEW v1;
-DROP table t1,t2;
-
-
-#
-# Bug#27786 Inconsistent Operation Performing UNION On View With ORDER BY
-#
-CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1),(2),(3);
-CREATE VIEW v1 AS SELECT a FROM t1 ORDER BY a;
-
-SELECT * FROM t1 UNION SELECT * FROM v1;
-EXPLAIN SELECT * FROM t1 UNION SELECT * FROM v1;
-SELECT * FROM v1 UNION SELECT * FROM t1;
-EXPLAIN SELECT * FROM v1 UNION SELECT * FROM t1;
-SELECT * FROM t1 UNION SELECT * FROM v1 ORDER BY a;
-EXPLAIN SELECT * FROM t1 UNION SELECT * FROM v1 ORDER BY a;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-
-#
-# Bug#27921 View ignores precision for CAST()
-#
-CREATE VIEW v1 AS SELECT CAST( 1.23456789 AS DECIMAL( 7,5 ) ) AS col;
-SELECT * FROM v1;
-DESCRIBE v1;
-DROP VIEW v1;
-
-CREATE VIEW v1 AS SELECT CAST(1.23456789 AS DECIMAL(8,0)) AS col;
-SHOW CREATE VIEW v1;
-DROP VIEW v1;
-
-
-#
-# Bug#28716 CHECK OPTION expression is evaluated over expired record buffers
-# when VIEW is updated via temporary tables
-#
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (b INT, c INT DEFAULT 0);
-INSERT INTO t1 (a) VALUES (1), (2);
-INSERT INTO t2 (b) VALUES (1), (2);
-CREATE VIEW v1 AS SELECT t2.b,t2.c FROM t1, t2
- WHERE t1.a=t2.b AND t2.b < 3 WITH CHECK OPTION;
-SELECT * FROM v1;
-UPDATE v1 SET c=1 WHERE b=1;
-SELECT * FROM v1;
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
-
-#
-# Bug#28561 update on multi-table view with CHECK OPTION and a subquery
-# in WHERE condition
-#
-
-CREATE TABLE t1 (id int);
-CREATE TABLE t2 (id int, c int DEFAULT 0);
-INSERT INTO t1 (id) VALUES (1);
-INSERT INTO t2 (id) VALUES (1);
-
-CREATE VIEW v1 AS
- SELECT t2.c FROM t1, t2
- WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
-
-UPDATE v1 SET c=1;
-
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
-
-#
-# Bug#27827 CHECK OPTION ignores ON conditions when updating
-# a multi-table view with CHECK OPTION.
-#
-
-CREATE TABLE t1 (a1 INT, c INT DEFAULT 0);
-CREATE TABLE t2 (a2 INT);
-CREATE TABLE t3 (a3 INT);
-CREATE TABLE t4 (a4 INT);
-INSERT INTO t1 (a1) VALUES (1),(2);
-INSERT INTO t2 (a2) VALUES (1),(2);
-INSERT INTO t3 (a3) VALUES (1),(2);
-INSERT INTO t4 (a4) VALUES (1),(2);
-
-CREATE VIEW v1 AS
- SELECT t1.a1, t1.c FROM t1 JOIN t2 ON t1.a1=t2.a2 AND t1.c < 3
- WITH CHECK OPTION;
-SELECT * FROM v1;
---error ER_VIEW_CHECK_FAILED
-UPDATE v1 SET c=3;
-PREPARE t FROM 'UPDATE v1 SET c=3';
---error ER_VIEW_CHECK_FAILED
-EXECUTE t;
---error ER_VIEW_CHECK_FAILED
-EXECUTE t;
---error ER_VIEW_CHECK_FAILED
-INSERT INTO v1(a1, c) VALUES (3, 3);
-UPDATE v1 SET c=1 WHERE a1=1;
-SELECT * FROM v1;
-SELECT * FROM t1;
-
-CREATE VIEW v2 AS SELECT t1.a1, t1.c
- FROM (t1 JOIN t2 ON t1.a1=t2.a2 AND t1.c < 3)
- JOIN (t3 JOIN t4 ON t3.a3=t4.a4)
- ON t2.a2=t3.a3 WITH CHECK OPTION;
-SELECT * FROM v2;
---error ER_VIEW_CHECK_FAILED
-UPDATE v2 SET c=3;
-PREPARE t FROM 'UPDATE v2 SET c=3';
---error ER_VIEW_CHECK_FAILED
-EXECUTE t;
---error ER_VIEW_CHECK_FAILED
-EXECUTE t;
---error ER_VIEW_CHECK_FAILED
-INSERT INTO v2(a1, c) VALUES (3, 3);
-UPDATE v2 SET c=2 WHERE a1=1;
-SELECT * FROM v2;
-SELECT * FROM t1;
-
-DROP VIEW v1,v2;
-DROP TABLE t1,t2,t3,t4;
-
-
-#
-# Bug#29104 assertion abort for a query with a view column reference
-# in the GROUP BY list and a condition requiring the value
-# of another view column to be equal to a constant
-#
-
-CREATE TABLE t1 (a int, b int);
-INSERT INTO t1 VALUES (1,2), (2,2), (1,3), (1,2);
-
-CREATE VIEW v1 AS SELECT a, b+1 as b FROM t1;
-
-
-SELECT b, SUM(a) FROM v1 WHERE b=3 GROUP BY b;
-EXPLAIN SELECT b, SUM(a) FROM v1 WHERE b=3 GROUP BY b;
-
-SELECT a, SUM(b) FROM v1 WHERE b=3 GROUP BY a;
-EXPLAIN SELECT a, SUM(b) FROM v1 WHERE b=3 GROUP BY a;
-
-SELECT a, SUM(b) FROM v1 WHERE a=1 GROUP BY a;
-EXPLAIN SELECT a, SUM(b) FROM v1 WHERE a=1 GROUP BY a;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-
-#
-# Bug#29392 SELECT over a multi-table view with ORDER BY
-# selecting the same view column with two different aliases
-#
-
-CREATE TABLE t1 (
- person_id int NOT NULL PRIMARY KEY,
- username varchar(40) default NULL,
- status_flg char(1) NOT NULL default 'A'
-);
-
-CREATE TABLE t2 (
- person_role_id int NOT NULL auto_increment PRIMARY KEY,
- role_id int NOT NULL,
- person_id int NOT NULL,
- INDEX idx_person_id (person_id),
- INDEX idx_role_id (role_id)
-);
-
-CREATE TABLE t3 (
- role_id int NOT NULL auto_increment PRIMARY KEY,
- role_name varchar(100) default NULL,
- app_name varchar(40) NOT NULL,
- INDEX idx_app_name(app_name)
-);
-
-CREATE VIEW v1 AS
-SELECT profile.person_id AS person_id
- FROM t1 profile, t2 userrole, t3 role
- WHERE userrole.person_id = profile.person_id AND
- role.role_id = userrole.role_id AND
- profile.status_flg = 'A'
- ORDER BY profile.person_id,role.app_name,role.role_name;
-
-INSERT INTO t1 VALUES
- (6,'Sw','A'), (-1136332546,'ols','e'), (0,' *\n','0'),
- (-717462680,'ENTS Ta','0'), (-904346964,'ndard SQL\n','0');
-INSERT INTO t2 VALUES
- (1,3,6),(2,4,7),(3,5,8),(4,6,9),(5,1,6),(6,1,7),(7,1,8),(8,1,9),(9,1,10);
-
-INSERT INTO t3 VALUES
- (1,'NUCANS_APP_USER','NUCANSAPP'),(2,'NUCANS_TRGAPP_USER','NUCANSAPP'),
- (3,'IA_INTAKE_COORDINATOR','IACANS'),(4,'IA_SCREENER','IACANS'),
- (5,'IA_SUPERVISOR','IACANS'),(6,'IA_READONLY','IACANS'),
- (7,'SOC_USER','SOCCANS'),(8,'CAYIT_USER','CAYITCANS'),
- (9,'RTOS_DCFSPOS_SUPERVISOR','RTOS');
-
-EXPLAIN SELECT t.person_id AS a, t.person_id AS b FROM v1 t WHERE t.person_id=6;
-SELECT t.person_id AS a, t.person_id AS b FROM v1 t WHERE t.person_id=6;
-
-DROP VIEW v1;
-DROP TABLE t1,t2,t3;
-
-
-#
-# Bug#30020 Insufficient check led to a wrong info provided by the
-# information schema table.
-#
-create table t1 (i int);
-insert into t1 values (1), (2), (1), (3), (2), (4);
-create view v1 as select distinct i from t1;
-select * from v1;
-select table_name, is_updatable from information_schema.views
- where table_name = 'v1';
-drop view v1;
-drop table t1;
-
-
-#
-# Bug#28701 SELECTs from VIEWs completely ignore USE/FORCE KEY, allowing
-# invalid statements
-#
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (1),(2);
-CREATE VIEW v1 AS SELECT * FROM t1;
---error ER_KEY_DOES_NOT_EXITS
-SELECT * FROM v1 USE KEY(non_existant);
---error ER_KEY_DOES_NOT_EXITS
-SELECT * FROM v1 FORCE KEY(non_existant);
---error ER_KEY_DOES_NOT_EXITS
-SELECT * FROM v1 IGNORE KEY(non_existant);
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-
-#
-# Bug#28702 VIEWs defined with USE/FORCE KEY ignore that request
-#
-CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b INT NOT NULL DEFAULT 0,
- PRIMARY KEY(a), KEY (b));
-INSERT INTO t1 VALUES (),(),(),(),(),(),(),(),(),(),(),(),(),(),();
-CREATE VIEW v1 AS SELECT * FROM t1 FORCE KEY (PRIMARY,b) ORDER BY a;
-SHOW CREATE VIEW v1;
-EXPLAIN SELECT * FROM v1;
-CREATE VIEW v2 AS SELECT * FROM t1 USE KEY () ORDER BY a;
-SHOW CREATE VIEW v2;
-EXPLAIN SELECT * FROM v2;
-CREATE VIEW v3 AS SELECT * FROM t1 IGNORE KEY (b) ORDER BY a;
-SHOW CREATE VIEW v3;
-EXPLAIN SELECT * FROM v3;
-
-DROP VIEW v1;
-DROP VIEW v2;
-DROP VIEW v3;
-DROP TABLE t1;
-
-
---echo #
---echo # Bug#29477 Not all fields of the target table were checked to have
---echo # a default value when inserting into a view.
---echo #
-create table t1(f1 int, f2 int not null);
-create view v1 as select f1 from t1;
-insert ignore into v1 values(1);
-set @old_mode=@@sql_mode;
-set @@sql_mode=traditional;
---error ER_NO_DEFAULT_FOR_VIEW_FIELD
-insert into v1 values(1);
-set @@sql_mode=@old_mode;
-drop view v1;
-drop table t1;
-
-
-#
-# Bug#33389 Selecting from a view into a table from within SP or trigger
-# crashes server
-#
-
-create table t1 (a int, key(a));
-create table t2 (c int);
-
-create view v1 as select a b from t1;
-create view v2 as select 1 a from t2, v1 where c in
- (select 1 from t1 where b = a);
-
-insert into t1 values (1), (1);
-insert into t2 values (1), (1);
-
-prepare stmt from "select * from v2 where a = 1";
-execute stmt;
-
-drop view v1, v2;
-drop table t1, t2;
-
-
-#
-# Bug#33049 Assert while running test-as3ap test(mysql-bench suite)
-#
-
-CREATE TABLE t1 (a INT);
-CREATE VIEW v1 AS SELECT p.a AS a FROM t1 p, t1 q;
-
-INSERT INTO t1 VALUES (1), (1);
-SELECT MAX(a), COUNT(DISTINCT a) FROM v1 GROUP BY a;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-###########################################################################
-
---echo # -----------------------------------------------------------------
---echo # -- Bug#34337 Server crash when Altering a view using a table name.
---echo # -----------------------------------------------------------------
---echo
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
---echo
-
-CREATE TABLE t1(c1 INT);
-
---echo
-
-SELECT * FROM t1;
-
---error ER_WRONG_OBJECT
-ALTER ALGORITHM=TEMPTABLE SQL SECURITY INVOKER VIEW t1 (c2) AS SELECT (1);
-
---echo
-
-DROP TABLE t1;
-
---echo
---echo # -- End of test case for Bug#34337.
---echo
-
-###########################################################################
-
---echo # -----------------------------------------------------------------
---echo # -- Bug#35193 VIEW query is rewritten without "FROM DUAL",
---echo # -- causing syntax error
---echo # -----------------------------------------------------------------
---echo
-
-CREATE VIEW v1 AS SELECT 1 FROM DUAL WHERE 1;
-
---echo
-
-SELECT * FROM v1;
-SHOW CREATE TABLE v1;
-
---echo
-
-DROP VIEW v1;
-
---echo
---echo # -- End of test case for Bug#35193.
---echo
-
-###########################################################################
-
-#
-# Bug#39040 valgrind errors/crash when creating views with binlog logging
-# enabled
-#
-# Bug is visible only when running in valgrind with binary logging.
-CREATE VIEW v1 AS SELECT 1;
-DROP VIEW v1;
-
-
-#
-# Bug#33461 SELECT ... FROM <view> USE INDEX (...) throws an error
-#
-
-CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT, INDEX (c2));
-INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
-SELECT * FROM t1 USE INDEX (PRIMARY) WHERE c1=2;
-SELECT * FROM t1 USE INDEX (c2) WHERE c2=2;
-
-CREATE VIEW v1 AS SELECT c1, c2 FROM t1;
-SHOW INDEX FROM v1;
---error ER_KEY_DOES_NOT_EXITS
-SELECT * FROM v1 USE INDEX (PRIMARY) WHERE c1=2;
---error ER_KEY_DOES_NOT_EXITS
-SELECT * FROM v1 FORCE INDEX (PRIMARY) WHERE c1=2;
---error ER_KEY_DOES_NOT_EXITS
-SELECT * FROM v1 IGNORE INDEX (PRIMARY) WHERE c1=2;
---error ER_KEY_DOES_NOT_EXITS
-SELECT * FROM v1 USE INDEX (c2) WHERE c2=2;
---error ER_KEY_DOES_NOT_EXITS
-SELECT * FROM v1 FORCE INDEX (c2) WHERE c2=2;
---error ER_KEY_DOES_NOT_EXITS
-SELECT * FROM v1 IGNORE INDEX (c2) WHERE c2=2;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo #
---echo # Bug #45806 crash when replacing into a view with a join!
---echo #
-CREATE TABLE t1(a INT UNIQUE);
-CREATE VIEW v1 AS SELECT t1.a FROM t1, t1 AS a;
-INSERT INTO t1 VALUES (1), (2);
-
-REPLACE INTO v1(a) SELECT 1 FROM t1,t1 AS c;
-SELECT * FROM v1;
-REPLACE INTO v1(a) SELECT 3 FROM t1,t1 AS c;
-SELECT * FROM v1;
-DELETE FROM t1 WHERE a=3;
-INSERT INTO v1(a) SELECT 1 FROM t1,t1 AS c
-ON DUPLICATE KEY UPDATE `v1`.`a`= 1;
-SELECT * FROM v1;
-
-CREATE VIEW v2 AS SELECT t1.a FROM t1, v1 AS a;
-
-REPLACE INTO v2(a) SELECT 1 FROM t1,t1 AS c;
-SELECT * FROM v2;
-REPLACE INTO v2(a) SELECT 3 FROM t1,t1 AS c;
-SELECT * FROM v2;
-INSERT INTO v2(a) SELECT 1 FROM t1,t1 AS c
-ON DUPLICATE KEY UPDATE `v2`.`a`= 1;
-SELECT * FROM v2;
-
-DROP VIEW v1;
-DROP VIEW v2;
-DROP TABLE t1;
-
---echo # -- End of test case for Bug#45806
-
---echo # -----------------------------------------------------------------
---echo # -- Bug#40825: Error 1356 while selecting from a view
---echo # -- with a "HAVING" clause though query works
---echo # -----------------------------------------------------------------
---echo
-
-CREATE TABLE t1 (c INT);
-
---echo
-
-CREATE VIEW v1 (view_column) AS SELECT c AS alias FROM t1 HAVING alias;
-SHOW CREATE VIEW v1;
-SELECT * FROM v1;
-
---echo
-
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo
---echo # -- End of test case for Bug#40825
---echo
-
---echo # -----------------------------------------------------------------
---echo # -- End of 5.0 tests.
---echo # -----------------------------------------------------------------
-
-#
-# Bug#21370 View renaming lacks tablename_to_filename encoding
-#
---disable_warnings
-DROP DATABASE IF EXISTS `d-1`;
---enable_warnings
-CREATE DATABASE `d-1`;
-USE `d-1`;
-CREATE TABLE `t-1` (c1 INT);
-CREATE VIEW `v-1` AS SELECT c1 FROM `t-1`;
-SHOW TABLES;
-RENAME TABLE `t-1` TO `t-2`;
-RENAME TABLE `v-1` TO `v-2`;
-SHOW TABLES;
-DROP TABLE `t-2`;
-DROP VIEW `v-2`;
-DROP DATABASE `d-1`;
-USE test;
-
---echo
---echo #
---echo # Bug#26676 VIEW using old table schema in a session.
---echo #
---echo
-
---disable_warnings
-DROP VIEW IF EXISTS v1;
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1(c1 INT, c2 INT);
-INSERT INTO t1 VALUES (1, 2), (3, 4);
-
---echo
-
-SELECT * FROM t1;
-
---echo
-
-CREATE VIEW v1 AS SELECT * FROM t1;
-
---echo
-
-SELECT * FROM v1;
-
---echo
-
-ALTER TABLE t1 ADD COLUMN c3 INT AFTER c2;
-
---echo
-
-SELECT * FROM t1;
-
---echo
-
-SELECT * FROM v1;
-
---echo
-
-SHOW CREATE VIEW v1;
-
---echo
-
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo
---echo # End of test case for Bug#26676.
---echo
-
-###########################################################################
-
---echo # -----------------------------------------------------------------
---echo # -- Bug#32538 View definition picks up character set, but not collation
---echo # -----------------------------------------------------------------
---echo
-
---disable_warnings
-DROP VIEW IF EXISTS v1;
---enable_warnings
-
---echo
-
-SET collation_connection = latin1_general_ci;
-CREATE VIEW v1 AS SELECT _latin1 'text1' AS c1, 'text2' AS c2;
-
---echo
-
-SELECT COLLATION(c1), COLLATION(c2) FROM v1;
-
---echo
-
-SHOW CREATE VIEW v1;
-
---echo
-
---error ER_CANT_AGGREGATE_2COLLATIONS
-SELECT * FROM v1 WHERE c1 = 'text1';
-
---echo
-
-SELECT * FROM v1 WHERE c2 = 'text2';
-
---echo
-
-use test;
-SET names latin1;
-
---echo
-
-SELECT COLLATION(c1), COLLATION(c2) FROM v1;
-
---echo
-
-SELECT * FROM v1 WHERE c1 = 'text1';
-
---echo
-
---error ER_CANT_AGGREGATE_2COLLATIONS
-SELECT * FROM v1 WHERE c2 = 'text2';
-
---echo
-
-DROP VIEW v1;
-
---echo
---echo # -- End of test case for Bug#32538.
---echo
-
-#
-# Bug#34587 Creating a view inside a stored procedure leads to a server crash
-#
-
---disable_warnings
-drop view if exists a;
-drop procedure if exists p;
---enable_warnings
-
-delimiter |;
-create procedure p()
-begin
- declare continue handler for sqlexception begin end;
- create view a as select 1;
-end|
-delimiter ;|
-call p();
-call p();
-drop view a;
-drop procedure p;
-
-###########################################################################
-
-
---echo #
---echo # Bug #44860: ALTER TABLE on view crashes server
---echo #
-CREATE TABLE t1 (a INT);
-CREATE VIEW v1 AS SELECT a FROM t1;
---error ER_WRONG_OBJECT
-ALTER TABLE v1;
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#48449: hang on show create view after upgrading when
---echo # view contains function of view
---echo #
-
---disable_warnings
-DROP VIEW IF EXISTS v1,v2;
-DROP TABLE IF EXISTS t1,t2;
-DROP FUNCTION IF EXISTS f1;
---enable_warnings
-
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (a INT);
-
-delimiter //;
-CREATE FUNCTION f1() RETURNS INT
-BEGIN
- SELECT a FROM v2 INTO @a;
- RETURN @a;
-END//
-delimiter ;//
-
---echo # Trigger pre-locking when opening v2.
-CREATE VIEW v1 AS SELECT f1() FROM t1;
-
-let $MYSQLD_DATADIR= `SELECT @@datadir`;
-copy_file std_data/bug48449.frm $MYSQLD_DATADIR/test/v2.frm;
-
-SHOW CREATE VIEW v1;
-
-DROP VIEW v1,v2;
-DROP TABLE t1,t2;
-DROP FUNCTION f1;
-
-
-#
-# Bug#48294 assertion when creating a view based on some row() construct in select query
-#
-CREATE TABLE t1(f1 INT);
-INSERT INTO t1 VALUES ();
-
-CREATE VIEW v1 AS SELECT 1 FROM t1 WHERE
-ROW(1,1) >= ROW(1, (SELECT 1 FROM t1 WHERE f1 >= ANY ( SELECT '1' )));
-
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#52120 create view cause Assertion failed: 0, file .\item_subselect.cc, line 817
---echo #
-CREATE TABLE t1 (a CHAR(1) CHARSET latin1, b CHAR(1) CHARSET utf8);
-CREATE VIEW v1 AS SELECT 1 from t1
-WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1'));
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#57703 create view cause Assertion failed: 0, file .\item_subselect.cc, line 846
---echo #
-
-CREATE TABLE t1(a int);
-CREATE VIEW v1 AS SELECT 1 FROM t1 GROUP BY
-SUBSTRING(1 FROM (SELECT 3 FROM t1 WHERE a >= ANY(SELECT 1)));
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#57352 valgrind warnings when creating view
---echo #
-CREATE VIEW v1 AS SELECT 1 IN (1 LIKE 2,0) AS f;
-DROP VIEW v1;
-
---echo #
---echo # Bug 11829681 - 60295: ERROR 1356 ON VIEW THAT EXECUTES FINE AS A QUERY
---echo #
-
-CREATE TABLE t1 (a INT);
-CREATE VIEW v1 AS SELECT s.* FROM t1 s, t1 b HAVING a;
-
-SELECT * FROM v1;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo #
---echo # LP BUG#777809 (a retrograded condition for view ON)
---echo #
-
-CREATE TABLE t1 ( f1 int NOT NULL , f6 int NOT NULL ) ;
-INSERT IGNORE INTO t1 VALUES (20, 2);
-
-CREATE TABLE t2 ( f3 int NOT NULL ) ;
-INSERT IGNORE INTO t2 VALUES (7);
-
-CREATE OR REPLACE VIEW v2 AS SELECT * FROM t2;
-
-PREPARE prep_stmt FROM 'SELECT t1.f6 FROM t1 RIGHT JOIN v2 ON v2.f3 WHERE t1.f1 != 0';
-
-EXECUTE prep_stmt;
-EXECUTE prep_stmt;
-
-drop view v2;
-drop table t1,t2;
-
---echo # -----------------------------------------------------------------
---echo # -- End of 5.1 tests.
---echo # -----------------------------------------------------------------
---echo #
---echo # Bug #794005: crash in st_table::mark_virtual_columns_for_write
---echo #
-
-CREATE TABLE t1 (a int);
-insert into t1 values (1);
-CREATE TABLE t2 (a int);
-insert into t2 values (1);
-
-CREATE VIEW v2 AS SELECT * FROM t2;
-CREATE VIEW v1 AS SELECT * FROM v2;
-CREATE VIEW v3 AS SELECT t2.a,v1.a as b FROM t2,v1 where t2.a=v1.a;
-CREATE OR REPLACE ALGORITHM = TEMPTABLE VIEW v2 AS SELECT * FROM t1;
-
---error ER_NON_UPDATABLE_TABLE
-UPDATE v1 SET a = 10;
---error ER_NON_INSERTABLE_TABLE
-REPLACE v1 SET a = 10;
---error ER_NON_INSERTABLE_TABLE
-INSERT into v1 values (20);
---error ER_NON_UPDATABLE_TABLE
-DELETE from v1;
---error ER_NON_UPDATABLE_TABLE
-UPDATE v3 SET b= 10;
---error ER_NON_INSERTABLE_TABLE
-REPLACE v3 SET b= 10;
---error ER_NON_INSERTABLE_TABLE
-INSERT into v3(b) values (20);
---error ER_VIEW_DELETE_MERGE_VIEW
-DELETE from v3 where b=20;
---error ER_VIEW_DELETE_MERGE_VIEW
-DELETE from v3 where a=20;
---error ER_NON_UPDATABLE_TABLE
-DELETE v1 from v1,t1 where v1.a=t1.a;
-UPDATE v3 SET a = 10;
-REPLACE v3 SET a = 11;
-INSERT INTO v3(a) values (20);
-
-select * from t1;
-select * from t2;
-
-CREATE OR REPLACE ALGORITHM = MERGE VIEW v2 AS SELECT * FROM t2;
-DELETE from v1 where a=11;
-DELETE v1 from v1,t1 where v1.a=t1.a;
-select * from t1;
-select * from t2;
-
-DROP VIEW v1,v2,v3;
-DROP TABLE t1,t2;
-
---echo #
---echo # MDEV-6251: SIGSEGV in query optimizer (in set_check_materialized
---echo # with MERGE view)
---echo #
-
-CREATE TABLE t1 (a1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY);
-CREATE TABLE t2 (b1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY);
-CREATE TABLE t3 (c1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY);
-CREATE TABLE t4 (d1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY);
-CREATE TABLE t5 (e1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY);
-CREATE TABLE t6 (f1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY);
-
-CREATE OR REPLACE view v1 AS
- SELECT 1
- FROM t1 a_alias_1
- LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
- LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
- LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
- LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
- LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
- LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
-;
-
-SELECT 1
-FROM (( SELECT 1
- FROM t1 a_alias_1
- LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
- LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
- LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
- LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
- LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
- LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
-) t1)
-LEFT OUTER JOIN (( SELECT 1
- FROM t1 a_alias_1
- LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
- LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
- LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
- LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
- LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
- LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
-) t2) ON 1=1
-LEFT OUTER JOIN (( SELECT 1
- FROM t1 a_alias_1
- LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
- LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
- LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
- LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
- LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
- LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
-) t3) ON 1=1
-LEFT OUTER JOIN (( SELECT 1
- FROM t1 a_alias_1
- LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
- LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
- LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
- LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
- LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
- LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
-) t4) ON 1=1
-LEFT OUTER JOIN (( SELECT 1
- FROM t1 a_alias_1
- LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
- LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
- LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
- LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
- LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
- LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
-) t5) ON 1=1
-LEFT OUTER JOIN (( SELECT 1
- FROM t1 a_alias_1
- LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
- LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
- LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
- LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
- LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
- LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
-) t6) ON 1=1
-LEFT OUTER JOIN (( SELECT 1
- FROM t1 a_alias_1
- LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
- LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
- LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
- LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
- LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
- LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
-) t7) ON 1=1
-LEFT OUTER JOIN (( SELECT 1
- FROM t1 a_alias_1
- LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
- LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
- LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
- LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
- LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
- LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
-) t8) ON 1=1
-;
-
-SELECT 1
-FROM (v1 t1)
-LEFT OUTER JOIN (v1 t2) ON 1=1
-LEFT OUTER JOIN (v1 t3) ON 1=1
-LEFT OUTER JOIN (v1 t4) ON 1=1
-LEFT OUTER JOIN (v1 t5) ON 1=1
-LEFT OUTER JOIN (v1 t6) ON 1=1
-LEFT OUTER JOIN (v1 t7) ON 1=1
-LEFT OUTER JOIN (v1 t8) ON 1=1
-;
-
-drop view v1;
-drop table t1,t2,t3,t4,t5,t6;
-
---echo # -----------------------------------------------------------------
---echo # -- End of 5.2 tests.
---echo # -----------------------------------------------------------------
-
---echo #
---echo # Bug #59696 Optimizer does not use equalities for conditions over view
---echo #
-
-CREATE TABLE t1 (a int NOT NULL);
-INSERT INTO t1 VALUES
- (9), (2), (8), (1), (3), (4), (2), (5),
- (9), (2), (8), (1), (3), (4), (2), (5);
-
-CREATE TABLE t2 (pk int PRIMARY KEY, c int NOT NULL);
-INSERT INTO t2 VALUES
- (9,90), (16, 160), (11,110), (1,10), (18,180), (2,20),
- (14,140), (15, 150), (12,120), (3,30), (17,170), (19,190);
-
-EXPLAIN EXTENDED
-SELECT t1.a,t2.c FROM t1,t2 WHERE t2.pk = t1.a AND t2.pk > 8;
-FLUSH STATUS;
-SELECT t1.a,t2.c FROM t1,t2 WHERE t2.pk = t1.a AND t2.pk > 8;
-SHOW STATUS LIKE 'Handler_read_%';
-
-CREATE VIEW v AS SELECT * FROM t2;
-EXPLAIN EXTENDED
-SELECT t1.a,v.c FROM t1,v WHERE v.pk = t1.a AND v.pk > 8;
-FLUSH STATUS;
-SELECT t1.a,v.c FROM t1,v WHERE v.pk = t1.a AND v.pk > 8;
-SHOW STATUS LIKE 'Handler_read_%';
-DROP VIEW v;
-
-DROP TABLE t1, t2;
-
---echo #
---echo # Bug#702403: crash with multiple equalities and a view
---echo #
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (10);
-
-CREATE TABLE t2 (pk int PRIMARY KEY, b int, INDEX idx (b));
-INSERT INTO t2 VALUES (1,2), (3,4);
-CREATE TABLE t3 (pk int PRIMARY KEY, b int, INDEX idx (b));
-INSERT INTO t3 VALUES (1,2), (3,4);
-
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-EXPLAIN
-SELECT * FROM v1, t2, t3
- WHERE t3.pk = v1.a AND t2.b = 1 AND t2.b = t3.pk AND v1.a BETWEEN 2 AND 5;
-
-SELECT * FROM v1, t2, t3
- WHERE t3.pk = v1.a AND t2.b = 1 AND t2.b = t3.pk AND v1.a BETWEEN 2 AND 5;
-
-DROP VIEW v1;
-DROP TABLE t1, t2, t3;
-
---echo #
---echo # Bug#717577: substitution for best field in a query over a view and
---echo # with OR in the WHERE condition
---echo #
-
-create table t1 (a int, b int);
-insert into t1 values (2,4), (1,3);
-create table t2 (c int);
-insert into t2 values (6), (4), (1), (3), (8), (3), (4), (2);
-
-select * from t1,t2 where t2.c=t1.a and t2.c < 3 or t2.c=t1.b and t2.c >=4;
-explain extended
-select * from t1,t2 where t2.c=t1.a and t2.c < 3 or t2.c=t1.b and t2.c >=4;
-
-create view v1 as select * from t2;
-select * from t1,v1 where v1.c=t1.a and v1.c < 3 or v1.c=t1.b and v1.c >=4;
-explain extended
-select * from t1,v1 where v1.c=t1.a and v1.c < 3 or v1.c=t1.b and v1.c >=4;
-
-create view v2 as select * from v1;
-select * from t1,v2 where v2.c=t1.a and v2.c < 3 or v2.c=t1.b and v2.c >=4;
-explain extended
-select * from t1,v2 where v2.c=t1.a and v2.c < 3 or v2.c=t1.b and v2.c >=4;
-
-create view v3 as select * from t1;
-select * from v3,v2 where v2.c=v3.a and v2.c < 3 or v2.c=v3.b and v2.c >=4;
-explain extended
-select * from v3,v2 where v2.c=v3.a and v2.c < 3 or v2.c=v3.b and v2.c >=4;
-
-drop view v1,v2,v3;
-drop table t1,t2;
-
---echo #
---echo # Bug#724942: substitution of the constant into a view field
---echo #
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (2), (9), (9), (6), (5), (4), (7);
-
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-SELECT * FROM v1 WHERE a > -1 OR a > 6 AND a = 3;
-EXPLAIN EXTENDED
-SELECT * FROM v1 WHERE a > -1 OR a > 6 AND a = 3;
-
-SELECT * FROM v1 WHERE a > -1 OR a AND a = 0;
-EXPLAIN EXTENDED
-SELECT * FROM v1 WHERE a > -1 OR a AND a = 0;
-
-CREATE VIEW v2 AS SELECT * FROM v1;
-
-SELECT * FROM v2 WHERE a > -1 OR a AND a = 0;
-EXPLAIN EXTENDED
-SELECT * FROM v2 WHERE a > -1 OR a AND a = 0;
-
-DROP VIEW v1,v2;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a varchar(10), KEY (a)) ;
-INSERT INTO t1 VALUES
- ('DD'), ('ZZ'), ('ZZ'), ('KK'), ('FF'), ('HH'),('MM');
-
-CREATE VIEW v1 AS SELECT * FROM t1;
-
---echo # t1 and v1 should return the same result set
-SELECT * FROM v1 WHERE a > 'JJ' OR a <> 0 AND a = 'VV';
-SELECT * FROM t1 WHERE a > 'JJ' OR a <> 0 AND a = 'VV';
---echo # t1 and v1 should propagate constants in the same way
-EXPLAIN EXTENDED
-SELECT * FROM v1 WHERE a > 'JJ' OR a <> 0 AND a = 'VV';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE a > 'JJ' OR a <> 0 AND a = 'VV';
-
---echo # t1 and v1 should return the same result set
-SELECT * FROM v1 WHERE a > 'JJ' OR a AND a = 'VV';
-SELECT * FROM t1 WHERE a > 'JJ' OR a AND a = 'VV';
---echo # t1 and v1 should propagate constants in the same way
-EXPLAIN EXTENDED
-SELECT * FROM v1 WHERE a > 'JJ' OR a AND a = 'VV';
-EXPLAIN EXTENDED
-SELECT * FROM t1 WHERE a > 'JJ' OR a AND a = 'VV';
-
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#777745: crash with equality propagation
---echo # over view fields
---echo #
-
-CREATE TABLE t1 (a int NOT NULL ) ;
-INSERT INTO t1 VALUES (2), (1);
-
-CREATE TABLE t2 (a int NOT NULL , b int NOT NULL) ;
-INSERT INTO t2 VALUES (2,20),(2,30);
-
-CREATE VIEW v2 AS SELECT * FROM t2;
-
-EXPLAIN
-SELECT * FROM t1,v2
- WHERE v2.a = t1.a AND v2.a = 2 AND v2.a IS NULL AND t1.a != 0;
-SELECT * FROM t1,v2
- WHERE v2.a = t1.a AND v2.a = 2 AND v2.a IS NULL AND t1.a != 0;
-
-EXPLAIN
-SELECT * FROM t1,v2
- WHERE v2.a = t1.a AND v2.a = 2 AND v2.a+1 > 2 AND t1.a != 0;
-SELECT * FROM t1,v2
- WHERE v2.a = t1.a AND v2.a = 2 AND v2.a+1 > 2 AND t1.a != 0;
-
-DROP VIEW v2;
-DROP TABLE t1,t2;
-
---echo #
---echo # Bug#794038: crash with INSERT/UPDATE/DELETE
---echo # over a non-updatable view
---echo #
-
-CREATE TABLE t1 (a int);
-CREATE ALGORITHM = TEMPTABLE VIEW v1 AS SELECT * FROM t1;
-CREATE ALGORITHM = MERGE VIEW v2 AS SELECT * FROM v1;
-CREATE ALGORITHM = TEMPTABLE VIEW v3 AS SELECT * FROM v2;
-
--- error ER_NON_INSERTABLE_TABLE
-INSERT INTO v3 VALUES (1);
--- error ER_NON_UPDATABLE_TABLE
-UPDATE v3 SET a=0;
--- error ER_NON_UPDATABLE_TABLE
-DELETE FROM v3;
-
-DROP VIEW v1,v2,v3;
-DROP TABLE t1;
-
---echo #
---echo # Bug#798621: crash with a view string field equal
---echo # to a constant
---echo #
-
-CREATE TABLE t1 (a varchar(32), b int) ;
-INSERT INTO t1 VALUES ('j', NULL), ('c', 8), ('c', 1);
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-CREATE TABLE t2 (a varchar(32)) ;
-INSERT INTO t2 VALUES ('j'), ('c');
-
-SELECT * FROM v1 LEFT JOIN t2 ON t2.a = v1.a
- WHERE v1.b = 1 OR v1.a = 'a' AND LENGTH(v1.a) >= v1.b;
-EXPLAIN EXTENDED
-SELECT * FROM v1 LEFT JOIN t2 ON t2.a = v1.a
- WHERE v1.b = 1 OR v1.a = 'a' AND LENGTH(v1.a) >= v1.b;
-
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
---echo # Bug#798625: duplicate of the previous one, but without crash
-
-CREATE TABLE t1 (f1 int NOT NULL, f2 int, f3 int, f4 varchar(32), f5 int) ;
-INSERT INTO t1 VALUES (20,5,2,'r', 0);
-
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-SELECT v1.f4 FROM v1
- WHERE f1<>0 OR f2<>0 AND f4='v' AND (f2<>0 OR f3<>0 AND f5<>0 OR f4 LIKE '%b%');
-EXPLAIN EXTENDED
-SELECT v1.f4 FROM v1
- WHERE f1<>0 OR f2<>0 AND f4='v' AND (f2<>0 OR f3<>0 AND f5<>0 OR f4 LIKE '%b%');
-
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo #
---echo # Bug#798576: abort on a GROUP BY query over a view with left join
---echo # that can be converted to inner join
---echo #
-
-CREATE TABLE t1 (a int NOT NULL , b int NOT NULL) ;
-INSERT INTO t1 VALUES (214,0), (6,6), (6,0), (7,0);
-
-CREATE TABLE t2 (b int) ;
-INSERT INTO t2 VALUES (88), (78), (6);
-
-CREATE ALGORITHM=MERGE VIEW v1 AS
- SELECT t1.a, t2.b FROM (t2 LEFT JOIN t1 ON t2.b > t1.a) WHERE t1.b <= 0;
-
-SELECT * FROM v1;
-SELECT a, MIN(b) FROM v1 GROUP BY a;
-
-DROP VIEW v1;
-DROP TABLE t1,t2;
-
---echo #
---echo # LP bug #793386: unexpected 'Duplicate column name ''' error
---echo # at the second execution of a PS using a view
---echo #
-
-CREATE TABLE t1 (f1 int, f2 int, f3 int, f4 int);
-
-CREATE VIEW v1 AS
- SELECT t.f1, t.f2, s.f3, s.f4 FROM t1 t, t1 s
- WHERE t.f4 >= s.f2 AND s.f3 < 0;
-
-PREPARE stmt1 FROM
- "SELECT s.f1 AS f1, s.f2 AS f2, s.f3 AS f3, t.f4 AS f4
- FROM v1 AS t LEFT JOIN v1 AS s ON t.f4=s.f4 WHERE t.f2 <> 1225";
-EXECUTE stmt1;
-EXECUTE stmt1;
-
-DEALLOCATE PREPARE stmt1;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo #
---echo # LP BUG#806071 (2 views with ORDER BY)
---echo #
-
-CREATE TABLE t1 (f1 int);
-INSERT INTO t1 VALUES (1),(1);
-
-CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT f1 FROM t1;
-CREATE ALGORITHM=MERGE VIEW v2 AS SELECT f1 FROM v1 ORDER BY f1;
-
-SELECT * FROM v2 AS a1, v2 AS a2;
-EXPLAIN EXTENDED SELECT * FROM v2 AS a1, v2 AS a2;
-
-DROP VIEW v1, v2;
-DROP TABLE t1;
-
---echo #
---echo # LP bug #823189: dependent subquery with RIGHT JOIN
---echo # referencing view in WHERE
---echo #
-
-CREATE TABLE t1 (a varchar(32));
-INSERT INTO t1 VALUES ('y'), ('w');
-
-CREATE TABLE t2 (a int);
-INSERT INTO t2 VALUES (10);
-
-CREATE TABLE t3 (a varchar(32), b int);
-
-CREATE TABLE t4 (a varchar(32));
-INSERT INTO t4 VALUES ('y'), ('w');
-
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-EXPLAIN EXTENDED
-SELECT * FROM t1, t2
- WHERE t2.a NOT IN (SELECT t3.b FROM t3 RIGHT JOIN t4 ON (t4.a = t3.a)
- WHERE t4.a >= t1.a);
-SELECT * FROM t1, t2
- WHERE t2.a NOT IN (SELECT t3.b FROM t3 RIGHT JOIN t4 ON (t4.a = t3.a)
- WHERE t4.a >= t1.a);
-
-EXPLAIN EXTENDED
-SELECT * FROM v1, t2
- WHERE t2.a NOT IN (SELECT t3.b FROM t3 RIGHT JOIN t4 ON (t4.a = t3.a)
- WHERE t4.a >= v1.a);
-SELECT * FROM v1, t2
- WHERE t2.a NOT IN (SELECT t3.b FROM t3 RIGHT JOIN t4 ON (t4.a = t3.a)
- WHERE t4.a >= v1.a);
-
-DROP VIEW v1;
-DROP TABLE t1,t2,t3,t4;
-
---echo #
---echo # LP bug #823237: dependent subquery with LEFT JOIN
---echo # referencing view in WHERE
---echo # (duplicate of LP bug #823189)
---echo #
-
-CREATE TABLE t1 (a int);
-
-CREATE TABLE t2 ( b int, d int, e int);
-INSERT INTO t2 VALUES (7,8,0);
-
-CREATE TABLE t3 ( c int);
-INSERT INTO t3 VALUES (0);
-
-CREATE TABLE t4 (a int, b int, c int);
-INSERT INTO t4 VALUES (93,1,0), (95,NULL,0);
-
-CREATE VIEW v4 AS SELECT * FROM t4;
-
-EXPLAIN EXTENDED
-SELECT * FROM t3 , t4
- WHERE t4.c <= (SELECT t2.e FROM t2 LEFT JOIN t1 ON ( t1.a = t2.d )
- WHERE t2.b > t4.b);
-SELECT * FROM t3 , t4
- WHERE t4.c <= (SELECT t2.e FROM t2 LEFT JOIN t1 ON ( t1.a = t2.d )
- WHERE t2.b > t4.b);
-
-
-EXPLAIN EXTENDED
-SELECT * FROM t3, v4
- WHERE v4.c <= (SELECT t2.e FROM t2 LEFT JOIN t1 ON ( t1.a = t2.d )
- WHERE t2.b > v4.b);
-
-SELECT * FROM t3, v4
- WHERE v4.c <= (SELECT t2.e FROM t2 LEFT JOIN t1 ON ( t1.a = t2.d )
- WHERE t2.b > v4.b);
-
-DROP VIEW v4;
-DROP TABLE t1,t2,t3,t4;
-
-#
-# Bug#9801 (Views: imperfect error message)
-#
-
---disable_warnings
-drop table if exists t_9801;
-drop view if exists v_9801;
---enable_warnings
-
-create table t_9801 (s1 int);
-
---error ER_VIEW_NONUPD_CHECK
-create view v_9801 as
- select sum(s1) from t_9801 with check option;
-
---error ER_VIEW_NONUPD_CHECK
-create view v_9801 as
- select sum(s1) from t_9801 group by s1 with check option;
-
- --error ER_VIEW_NONUPD_CHECK
-create view v_9801 as
- select sum(s1) from t_9801 group by s1 with rollup with check option;
-
-drop table t_9801;
-
---echo #
---echo # Bug #47335 assert in get_table_share
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP VIEW IF EXISTS v1;
---enable_warnings
-
-CREATE TEMPORARY TABLE t1 (id INT);
---error ER_NO_SUCH_TABLE
-ALTER VIEW t1 AS SELECT 1 AS f1;
-DROP TABLE t1;
-
-CREATE VIEW v1 AS SELECT 1 AS f1;
-CREATE TEMPORARY TABLE v1 (id INT);
-ALTER VIEW v1 AS SELECT 2 AS f1;
-DROP TABLE v1;
-SELECT * FROM v1;
-DROP VIEW v1;
-
-
---echo #
---echo # Bug #47635 assert in start_waiting_global_read_lock
---echo # during CREATE VIEW
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
-DROP VIEW IF EXISTS t2;
---enable_warnings
-
-CREATE TABLE t1 (f1 integer);
-CREATE TEMPORARY TABLE IF NOT EXISTS t1 (f1 integer);
-CREATE TEMPORARY TABLE t2 (f1 integer);
-DROP TABLE t1;
-FLUSH TABLES WITH READ LOCK;
---error ER_CANT_UPDATE_WITH_READLOCK
-CREATE VIEW t2 AS SELECT * FROM t1;
-
-UNLOCK TABLES;
-DROP TABLE t1, t2;
-
-
---echo #
---echo # Bug#48315 Metadata lock is not taken for merged views that
---echo # use an INFORMATION_SCHEMA table
---echo #
-
---disable_warnings
-DROP VIEW IF EXISTS v1;
-DROP PROCEDURE IF EXISTS p1;
---enable_warnings
-
-connect (con2, localhost, root);
-connect (con3, localhost, root);
-
-connection default;
-
-CREATE VIEW v1 AS SELECT schema_name FROM information_schema.schemata;
-CREATE PROCEDURE p1() SELECT COUNT(*), GET_LOCK('blocker', 100) FROM v1;
-
---echo # CALL p1() so the view is merged.
---disable_result_log
-CALL p1();
---enable_result_log
-SELECT RELEASE_LOCK('blocker');
-
-connection con3;
-SELECT GET_LOCK('blocker', 100);
-
-connection default;
---echo # Try to CALL p1() again, this time it should block on "blocker".
---echo # Sending:
---send CALL p1()
-
-connection con2;
-let $wait_condition=
- SELECT COUNT(*) = 1 from information_schema.processlist
- WHERE state = "User lock" AND
- info = "SELECT COUNT(*), GET_LOCK('blocker', 100) FROM v1";
---source include/wait_condition.inc
---echo # ... then try to drop the view. This should block.
---echo # Sending:
---send DROP VIEW v1
-
-connection con3;
-let $wait_condition=
- SELECT COUNT(*) = 1 from information_schema.processlist
- WHERE state = "Waiting for table metadata lock" AND info = "DROP VIEW v1";
---source include/wait_condition.inc
---echo # Now allow CALL p1() to complete
-SELECT RELEASE_LOCK('blocker');
-
-connection default;
---echo # Reaping: CALL p1()
---disable_result_log
---reap
---enable_result_log
-SELECT RELEASE_LOCK('blocker');
-
-connection con2;
---echo # Reaping: DROP VIEW v1
---reap
-
-connection default;
-DROP PROCEDURE p1;
-disconnect con2;
-disconnect con3;
-
-
---echo #
---echo # Bug#12626844: WRONG ERROR MESSAGE WHILE CREATING A VIEW ON A
---echo # NON EXISTING DATABASE
---echo #
-
---disable_warnings
-DROP DATABASE IF EXISTS nodb;
---enable_warnings
---error ER_BAD_DB_ERROR
-CREATE VIEW nodb.a AS SELECT 1;
-
-
---echo #
---echo # BUG#14117018 - MYSQL SERVER CREATES INVALID VIEW DEFINITION
---echo # BUG#18405221 - SHOW CREATE VIEW OUTPUT INCORRECT
---echo #
-
-CREATE VIEW v1 AS (SELECT '' FROM DUAL);
-CREATE VIEW v2 AS (SELECT 'BUG#14117018' AS col1 FROM DUAL) UNION ALL
- (SELECT '' FROM DUAL);
-CREATE VIEW v3 AS (SELECT 'BUG#14117018' AS col1 FROM DUAL) UNION ALL
- (SELECT '' FROM DUAL) UNION ALL
- (SELECT '' FROM DUAL);
-CREATE VIEW v4 AS (SELECT 'BUG#14117018' AS col1 FROM DUAL) UNION ALL
- (SELECT '' AS col2 FROM DUAL) UNION ALL
- (SELECT '' FROM DUAL);
-
-# In the second (and later) UNIONed queries, duplicate column names are allowed
-CREATE VIEW v5 AS (SELECT 'buggy' AS col1, 'fix' as col2 FROM DUAL) UNION ALL
- (SELECT 'buggy' as a, 'fix' as a FROM DUAL);
-
---echo # Name for the column in select1 is set properly with or
---echo # without this fix.
-SHOW CREATE VIEW v1;
-
---echo # Name for the column in select2 is set with this fix.
---echo # Without this fix, name would not have set for the
---echo # columns in select2.
-SHOW CREATE VIEW v2;
-
---echo # Name for the field item in select2 & select3 is set with this fix.
---echo # Without this fix, name would not have set for the
---echo # columns in select2 & select3.
-SHOW CREATE VIEW v3;
-
---echo # Name for the field item in select3 is set with this fix.
---echo # Without this fix, name would not have set for the
---echo # columns in select3.
-SHOW CREATE VIEW v4;
-
-DROP VIEW v1, v2, v3, v4, v5;
-
-
---echo #
---echo # BUG#19886430: VIEW CREATION WITH NAMED COLUMNS, OVER UNION,
---echo # IS REJECTED
-
---echo # Without the patch, reports an error.
-CREATE VIEW v1 (fld1, fld2) AS
- SELECT 1 AS a, 2 AS b
- UNION ALL
- SELECT 1 AS a, 1 AS a;
-
---echo # The column names are explicitly specified and not duplicates, hence
---echo # succeeds.
-CREATE VIEW v2 (fld1, fld2) AS
- SELECT 1 AS a, 2 AS a
- UNION ALL
- SELECT 1 AS a, 1 AS a;
-
---echo # The column name in the first SELECT are not duplicates, hence succeeds.
-CREATE VIEW v3 AS
- SELECT 1 AS a, 2 AS b
- UNION ALL
- SELECT 1 AS a, 1 AS a;
-
---echo # Should report an error, since the explicitly specified column names are
---echo # duplicates.
---error ER_DUP_FIELDNAME
-CREATE VIEW v4 (fld1, fld1) AS
- SELECT 1 AS a, 2 AS b
- UNION ALL
- SELECT 1 AS a, 1 AS a;
-
---echo # Should report an error, since duplicate column name is specified in the
---echo # First SELECT.
---error ER_DUP_FIELDNAME
-CREATE VIEW v4 AS
- SELECT 1 AS a, 2 AS a
- UNION ALL
- SELECT 1 AS a, 1 AS a;
-
---echo # Cleanup
-DROP VIEW v1, v2, v3;
-
-
-# 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
-
---echo #
---echo # lp:833600 Wrong result with view + outer join + uncorrelated subquery (non-semijoin)
---echo #
-
-CREATE TABLE t1 ( a int, b int );
-INSERT INTO t1 VALUES (0,0),(0,0);
-
-CREATE TABLE t2 ( a int, b int );
-INSERT IGNORE INTO t2 VALUES (1,0),(1,0);
-
-CREATE TABLE t3 ( b int );
-INSERT IGNORE INTO t3 VALUES (0),(0);
-
-CREATE OR REPLACE VIEW v2 AS SELECT * FROM t2;
-SELECT * FROM t1 RIGHT JOIN v2 ON ( v2.a = t1.a ) WHERE v2.b IN ( SELECT b FROM t3 ) AND t1.b IS NULL ;
-
-SELECT * FROM t1 RIGHT JOIN v2 ON ( v2.a = t1.a ) WHERE v2.b IN ( SELECT b FROM t3 ) AND t1.b IS NULL ;
-
-DROP VIEW v2;
-DROP TABLE t1, t2, t3;
-
---echo #
---echo # BUG#915222: Valgrind complains or crashes with INSERT SELECT
---echo # within a trigger that uses a view
---echo #
-
-CREATE TABLE t1 (a char(1));
-
-CREATE TABLE t2 (d int, e char(1));
-
-INSERT INTO t2 VALUES (13,'z');
-
-CREATE TRIGGER tr AFTER UPDATE ON t2
- FOR EACH ROW
- REPLACE INTO t3
- SELECT f, a AS alias FROM t3, v;
-
-CREATE TABLE t3 (f int, g char(8));
-
-CREATE VIEW v AS SELECT a, e FROM t2, t1;
-
-UPDATE t2 SET d=7;
-UPDATE t2 SET d=7;
-UPDATE t2 SET d=7;
-UPDATE t2 SET d=7;
-
-DROP TRIGGER tr;
-DROP VIEW v;
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # BUG#972943: Assertion failure with INSERT SELECT within a trigger
---echo # that uses derived table and materialized view
---echo #
-
-CREATE TABLE t1 (a int, b int);
-INSERT INTO t1 VALUES (1,0), (2,8);
-
-CREATE ALGORITHM=TEMPTABLE VIEW v1
- AS SELECT * FROM t1;
-
-CREATE TABLE t2 (c int);
-CREATE TABLE t3 (d int, e int);
-
-CREATE TRIGGER tr BEFORE INSERT ON t2 FOR EACH ROW
- INSERT INTO t3
- SELECT t1.*
- FROM (SELECT * FROM t1 WHERE b IN (SELECT b FROM v1)) AS alias1, t1
- WHERE t1.a = 3 OR t1.a > 5;
-
-INSERT INTO t2 VALUES (1);
-
-DROP TRIGGER tr;
-DROP VIEW v1;
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # LP bug#1007622 Server crashes in handler::increment_statistics on
---echo # inserting into a view over a view
---echo #
-
-flush status;
---disable_ps_protocol
-CREATE TABLE t1 (a INT);
-CREATE ALGORITHM=MERGE VIEW v1 AS SELECT a1.* FROM t1 AS a1, t1 AS a2;
-CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM v1;
-INSERT INTO v2 (a) VALUES (1) ;
-select * from t1;
-drop view v2,v1;
-drop table t1;
-show status like '%view%';
-show status like 'Opened_table%';
---enable_ps_protocol
-
---echo #
---echo # MDEV-486 LP BUG#1010116 Incorrect query results in
---echo # view and derived tables
---echo #
-
-SELECT
-`Derived1`.`id`,
-`Derived2`.`Val1`
-FROM (select 30631 as `id`) AS `Derived1` LEFT OUTER JOIN (SELECT
-2 as `id`,
-1 AS `Val1`
-FROM (select 30631 as `id`) AS `Derived3`) AS `Derived2` ON `Derived1`.`id` = `Derived2`.`id`;
-
-create table t1 ( id int );
-insert into t1 values (30631);
-create table t2 ( id int );
-insert into t2 values (30631);
-create algorithm=MERGE view v2 as select 2 as id, 1 as val1 from t2;
-select t1.*, v2.* from t1 left join v2 on t1.id = v2.id;
-drop view v2;
-drop table t1,t2;
-
-create table t1 ( id int );
-insert into t1 values (30631);
-create table t2 ( id int );
-insert into t2 values (30631);
-create algorithm=MERGE view v2 as select 2 as id, id is null as bbb, id as iddqd, 1 as val1 from t2;
-select t1.*, v2.* from t1 left join v2 on t1.id = v2.id;
-drop view v2;
-drop table t1,t2;
-
---echo #
---echo # MDEV-3914: Wrong result (NULLs instead of real values)
---echo # with INNER and RIGHT JOIN in a FROM subquery, derived_merge=on
---echo # (fix of above MDEV-486 fix)
---echo #
-SET @save_optimizer_switch_MDEV_3914=@@optimizer_switch;
-SET optimizer_switch = 'derived_merge=on';
-
-CREATE TABLE t1 (a INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE TABLE t2 (b INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (3),(4);
-
-CREATE TABLE t3 (c INT) ENGINE=MyISAM;
-INSERT INTO t3 VALUES (5),(6);
-
-SELECT * FROM ( SELECT c FROM ( t1 INNER JOIN t2 ) RIGHT JOIN t3 ON a = c ) AS alias;
-
-SET optimizer_switch = 'derived_merge=off';
-
-SELECT * FROM ( SELECT c FROM ( t1 INNER JOIN t2 ) RIGHT JOIN t3 ON a = c ) AS alias;
-
-SET optimizer_switch=@save_optimizer_switch_MDEV_3914;
-drop table t1,t2,t3;
-
---echo #
---echo # MDEV-589 (LP BUG#1007647) :
---echo # Assertion `vcol_table == 0 || vcol_table == table' failed in
---echo # fill_record(THD*, List<Item>&, List<Item>&, bool)
---echo #
-CREATE TABLE t1 (f1 INT, f2 INT);
-CREATE TABLE t2 (f1 INT, f2 INT);
-CREATE ALGORITHM=MERGE VIEW v1 AS SELECT a1.f1, a2.f2 FROM t1 AS a1, t1 AS a2;
-CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM v1;
-CREATE ALGORITHM=MERGE VIEW v3 AS SELECT a1.f1, a2.f2 FROM t1 AS a1, t2 AS a2;
-CREATE ALGORITHM=MERGE VIEW v4 AS SELECT * FROM v3;
---error ER_VIEW_MULTIUPDATE
-INSERT INTO v3 (f1, f2) VALUES (1, 2);
---error ER_VIEW_MULTIUPDATE
-INSERT INTO v1 (f1, f2) VALUES (1, 2);
---error ER_VIEW_MULTIUPDATE
-INSERT INTO v4 (f1, f2) VALUES (1, 2);
---error ER_VIEW_MULTIUPDATE
-INSERT INTO v2 (f1, f2) VALUES (1, 2);
-drop view v4,v3,v2,v1;
-drop table t1,t2;
-
---echo #
---echo # MDEV-3799 fix of above bugfix (MDEV-589)
---echo # Wrong result (NULLs instead of real values) with RIGHT JOIN
---echo # in a FROM subquery and derived_merge=on
---echo #
-
-CREATE TABLE t1 (f1 INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (4),(6);
-
-CREATE TABLE t2 (f2 INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (7),(8);
-
-SELECT * FROM (
- SELECT * FROM t1 RIGHT JOIN t2 ON f1 = f2
-) AS alias;
-
-SELECT * FROM (
- SELECT * FROM t2 LEFT JOIN t1 ON f1 = f2
-) AS alias;
-
-drop tables t1,t2;
-
-
---echo #
---echo # MDEV-3876 Wrong result (extra rows) with ALL subquery
---echo # from a MERGE view (duplicate of MDEV-3873)
---echo #
-
-CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE TABLE t2 (b INT NOT NULL) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (1),(3);
-
-CREATE OR REPLACE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t2;
-
-SELECT a FROM t1 AS alias
-WHERE a >= ALL (
-SELECT b FROM t1 LEFT JOIN v1 ON (a = b)
-WHERE a = alias.a );
-
-drop view v1;
-drop table t1,t2;
-
---echo #
---echo # MDEV-4593: p_s: crash in simplify_joins with delete using subselect
---echo # from view
---echo #
-
-create table `t1`(`a` int);
-create table `t2`(`a` int);
-create or replace view `v1` as select `a` from `t1`;
-prepare s from "delete from `t2` order by (select 1 from `v1`)";
-execute s;
-deallocate prepare s;
-drop view v1;
-drop tables t1,t2;
-
---echo #
---echo # MDEV-5034 (duplicate of MDEV-5107):
---echo # Left Join Yields All Nulls Instead of Appropriate Matches
---echo #
-
- --echo # test #1
-
-CREATE TABLE t1 (state VARCHAR(32), INDEX(state));
-INSERT INTO t1 VALUES ('Indiana'),('Vermont');
-
-CREATE TABLE t2 (state VARCHAR(32));
-INSERT INTO t2 VALUES ('Hawaii'),('Oregon'),('Vermont');
-
-CREATE ALGORITHM=MERGE VIEW v1 AS SELECT t1.* FROM t2, t1;
-SELECT * FROM t1 AS outer_t1 LEFT JOIN v1 AS joined_t1
-ON (joined_t1.state = outer_t1.state AND joined_t1.state IN ( SELECT 'Vermont' UNION SELECT 'Florida' ) );
-
-SELECT * FROM t1 AS outer_t1 LEFT JOIN (SELECT t1.* FROM t2, t1) AS joined_t1 ON (joined_t1.state = outer_t1.state AND joined_t1.state IN ( SELECT 'Vermont' UNION SELECT 'Florida' ) );
-
-drop view v1;
-drop table t1, t2;
-
---echo # test #1
-
-CREATE TABLE t1 (a INT, b VARCHAR(1), INDEX(b,a));
-INSERT INTO t1 VALUES (4,'p'),(1,'q'),(9,'w');
-
-CREATE TABLE t2 (c VARCHAR(1), INDEX(c));
-INSERT INTO t2 VALUES ('q'),('a');
-CREATE ALGORITHM=MERGE VIEW v1 AS SELECT t1a.* FROM t1, t1 AS t1a;
-SELECT * FROM t2 LEFT JOIN v1 ON ( c=b AND a IN ( 1,6 ) );
-CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT t1a.* FROM t1, t1 AS t1a;
-SELECT * FROM t2 LEFT JOIN v1 ON ( c=b AND a IN ( 1,6 ) );
-
-drop view v1;
-drop table t1,t2;
-
---echo #
---echo # MDEV-5153: Server crashes in Item_ref::fix_fields on 2nd execution
---echo # of PS with LEFT JOIN and MERGE view or SELECT SQ
---echo #
-
-CREATE TABLE t1 (i1 INT, c1 VARCHAR(6)) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
-
-CREATE TABLE t2 (c2 VARCHAR(6)) ENGINE=MyISAM;
-INSERT INTO t2 VALUES ('foobar'),('qux');
-
-CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1 WHERE ( c1 ) IN ( SELECT c2 FROM t2 ) AND i1 <= 2 ;
-
-PREPARE stmt FROM 'SELECT * FROM t1 LEFT JOIN v1 ON (v1.i1 = t1.i1)';
-
-EXECUTE stmt;
-EXECUTE stmt;
-
-drop view v1;
-CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1 WHERE ( c1, c1 ) IN ( SELECT c2, c2 FROM t2 ) AND i1 <= 2 ;
-
-EXECUTE stmt;
-EXECUTE stmt;
-
-deallocate prepare stmt;
-drop view v1;
-drop table t1,t2;
-
-#
-# MDEV-5414: RAND() in a subselect : different behavior in MariaDB and MySQL
-#
-create table t1 (a int);
-insert into t1 values (1),(2);
-
-create view v1 (a,r) as select a,rand() from t1;
-
-
-create table t2 select a, r as r1, r as r2, r as r3 from v1;
-
-select a, r1 = r2, r2 = r3 from t2;
-
-drop view v1;
-drop table t1,t2;
-
---echo #
---echo # MDEV-5515: 2nd execution of a prepared statement returns wrong results
---echo #
-CREATE TABLE t1 (i1 INT, j1 INT NOT NULL, PRIMARY KEY (i1));
-
-INSERT INTO t1 VALUES (30,300),(40,400);
-
-CREATE TABLE t2 (i2 INT);
-INSERT INTO t2 VALUES (50),(60);
-
-CREATE TABLE t3 (c3 VARCHAR(20), i3 INT);
-INSERT INTO t3 VALUES ('a',10),('b',2);
-
-CREATE TABLE t4 (i4 INT);
-INSERT INTO t4 VALUES (1),(2);
-
-DROP VIEW IF EXISTS v1;
-CREATE VIEW v1 AS select coalesce(j1,i3) AS v1_field1 from t2 join t3 left join t1 on ( i1 = i2 );
-
-CREATE VIEW v2 AS select v1_field1 from t4 join v1;
-
-prepare my_stmt from "select v1_field1 from v2";
-execute my_stmt;
-execute my_stmt;
-deallocate prepare my_stmt;
-
-DROP VIEW v1,v2;
-DROP TABLE t1,t2,t3,t4;
-
---echo #
---echo #MDEV-5717: Server crash with insert statement containing DEFAULT into
---echo #view
---echo #
-CREATE TABLE t1 (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `test` tinyint(3) unsigned NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`)
-);
-
-CREATE VIEW v1 AS (select t1.id AS id, t1.test AS test from t1);
-
-INSERT INTO v1 SET test = DEFAULT;
-
-select * from v1;
-
-drop view v1;
-drop table t1;
-
---echo #
---echo # MDEV-5981: name resolution issues with views and multi-update
---echo # in ps-protocol
---echo #
-
-create table t1 (id1 int primary key, val1 varchar(20));
-insert into t1 values (1, 'test1');
-create table t2 (id2 int primary key, val2 varchar(20));
-insert into t2 values (1, 'test2');
-create algorithm=merge view v1 as select id1 as id1v1, val1 as val1v1 from t1;
-create algorithm=merge view v2 as
-select t2.id2 as id2v2, t2.val2 as val2v2
-from t2, v1
-where t2.id2 = v1.id1v1;
-prepare stmt1 from "update v2 set val2v2 = 'test19' where 1 = id2v2";
-execute stmt1;
-deallocate prepare stmt1;
-drop view v1,v2;
-drop table t1,t2;
-
---echo # -----------------------------------------------------------------
---echo # -- End of 5.3 tests.
---echo # -----------------------------------------------------------------
-
---echo #
---echo # MDEV-3874: Server crashes in Item_field::print on a SELECT
---echo # from a MERGE view with materialization+semijoin, subquery, ORDER BY
---echo #
-SET @save_optimizer_switch_MDEV_3874=@@optimizer_switch;
-
-SET optimizer_switch = 'materialization=on,semijoin=on';
-
-CREATE TABLE t1 (a INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(7);
-
-CREATE TABLE t2 (b INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (4),(6);
-
-CREATE TABLE t3 (c INT) ENGINE=MyISAM;
-INSERT INTO t3 VALUES (1),(2);
-
-
-CREATE ALGORITHM=MERGE VIEW v1 AS SELECT
-( SELECT a FROM t1 WHERE ( 1, 1 ) IN (
-SELECT b, c FROM t2, t3 HAVING c > 2 ) ) AS field1,
-b + c AS field2
-FROM t2, t3 AS table1
-GROUP BY field1, field2 ORDER BY field1;
-
-SELECT * FROM v1;
-
-drop view v1;
-drop table t1,t2,t3;
-SET optimizer_switch=@save_optimizer_switch_MDEV_3874;
-
-#
-# MDEV-5515: sub-bug test of 3rd execution crash
-#
-
-CREATE TABLE `t1` (
- `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
- `f0` int(11) unsigned NOT NULL DEFAULT '0',
- `f1` int(11) unsigned NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`),
- UNIQUE KEY `id` (`id`)
-);
-
-CREATE TABLE `t2` (
- `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
- `f02` bigint(20) unsigned NOT NULL DEFAULT '0',
- `f03` int(11) unsigned NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`),
- UNIQUE KEY `id` (`id`)
-);
-
-CREATE ALGORITHM=UNDEFINED SQL SECURITY DEFINER VIEW `v1` AS
- SELECT
- `t1`.`f0` AS `f0`,
- `t1`.`f1` AS `f1`,
- `t2`.`f02` AS `f02`,
- `t2`.`f03` AS `f03`
- FROM
- (`t1` LEFT JOIN `t2` ON((`t1`.`id` = `t2`.`f02`)));
-
---delimiter |
-CREATE FUNCTION `f1`(
- p0 BIGINT(20) UNSIGNED
- )
- RETURNS bigint(20) unsigned
- DETERMINISTIC
- CONTAINS SQL
- SQL SECURITY DEFINER
- COMMENT ''
-BEGIN
-
-DECLARE k0 INTEGER UNSIGNED DEFAULT 0;
-DECLARE lResult INTEGER UNSIGNED DEFAULT 0;
-
- SET k0 = 0;
- WHILE k0 < 1 DO
- SELECT COUNT(*) as `f00` INTO lResult FROM `v1` WHERE `v1`.`f0` = p0; -- BUG
- SET k0 = k0 + 1;
- END WHILE;
-
- RETURN(k0);
-END|
---delimiter ;
-
-
-SELECT `f1`(1);
-SELECT `f1`(1);
-SELECT `f1`(1);
-SELECT `f1`(1);
-
-DROP FUNCTION f1;
-DROP VIEW v1;
-DROP TABLE t1, t2;
-
-
-create view v1 as select 1;
-
---let $MYSQLD_DATADIR= `select @@datadir`
---let SEARCH_FILE= $MYSQLD_DATADIR/test/v1.frm
---let SEARCH_RANGE= 50000
---let SEARCH_PATTERN=mariadb-version
---source include/search_pattern_in_file.inc
-
-drop view v1;
-
---echo #
---echo # MDEV-7260: Crash in get_best_combination when executing multi-table
---echo # UPDATE with nested views
---echo #
-
-CREATE TABLE `t1` (`id` bigint(20));
-
-INSERT INTO `t1` VALUES (1),(2);
-
-CREATE TABLE `t2` (`id` bigint(20));
-
-CREATE TABLE `t3` (`id` bigint(20), `flag` tinyint(4));
-
-create view v1 as select id from t1;
-
-create view v2 as select t2.* from (t2 left join v1 using (id));
-
-update t3 left join v2 using (id) set flag=flag+1;
-
-drop view v2, v1;
-drop table t1, t2, t3;
-
---echo #
---echo # MDEV-7207 - ALTER VIEW does not change ALGORITM
---echo #
-create table t1 (a int, b int);
-create algorithm=temptable view v2 (c) as select b+1 from t1;
-show create view v2;
-alter algorithm=undefined view v2 (c) as select b+1 from t1;
-show create view v2;
-alter algorithm=merge view v2 (c) as select b+1 from t1;
-show create view v2;
-drop view v2;
-drop table t1;
-
---echo #
---echo # MDEV-8554: Server crashes in base_list_iterator::next_fast on 1st execution of PS with a multi-table update
---echo #
-CREATE TABLE t1 (a INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(2); # Not necessary, the table can be empty
-
-CREATE TABLE t2 (b INT) ENGINE=MyISAM;
-INSERT INTO t2 VALUES (3),(4); # Not necessary, the table can be empty
-
-CREATE TABLE t3 (c INT) ENGINE=MyISAM;
-INSERT INTO t3 VALUES (5),(6); # Not necessary, the table can be empty
-
-CREATE OR REPLACE ALGORITHM=MERGE VIEW v3 AS SELECT * FROM t3;
-
-PREPARE stmt FROM 'UPDATE t1, t2 SET a = 1 WHERE a IN ( SELECT 0 FROM t3 )';
-UPDATE t1, t2 SET a = 1 WHERE a IN ( SELECT 0 FROM v3 );
-EXECUTE stmt;
-
-DROP TABLE t1, t2, t3;
-DROP VIEW v3;
-
---echo #
---echo # MDEV-8632: Segmentation fault on INSERT
---echo #
-CREATE TABLE `t1` (
- `id` int(10) unsigned NOT NULL,
- `r` float NOT NULL,
- PRIMARY KEY (`id`)
-) DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-create view v1 as select id, if(r=r,1,2) as d from t1;
-create view v2 as
- select id,
- d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d as p
- from v1;
-insert into t1 (id, r)
-select id,p from
-(
- select id,
- d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d+d as p
- from (
- select id, if(r=r,1,2) as d
- from t1
- ) a
-) b
-on duplicate key update r=p;
-insert into t1 (id, r)
-select id,p from v2
-on duplicate key update r=p;
-
-prepare stmt from "insert into t1 (id, r) select id,p from v2 on duplicate key update r=p";
-execute stmt;
-execute stmt;
-deallocate prepare stmt;
-
-drop view v1,v2;
-drop table `t1`;
-
-#
-# Bug#19817021
-#
-create table t1 (a int, b int);
-create view v1 as select a+b from t1;
-alter table v1 check partition p1;
-drop view v1;
-drop table t1;
-
-
---echo #
---echo # MDEV-10419: crash in mariadb 10.1.16-MariaDB-1~trusty
---echo #
-CREATE TABLE t1 (c1 CHAR(13));
-CREATE TABLE t2 (c2 CHAR(13));
-
-CREATE FUNCTION f() RETURNS INT RETURN 0;
-CREATE OR REPLACE VIEW v1 AS select f() from t1 where c1 in (select c2 from t2);
-DROP FUNCTION f;
-
-SHOW CREATE VIEW v1;
-
-drop view v1;
-drop table t1,t2;
-
---echo #
---echo # MDEV-12099: usage of mergeable view with LEFT JOIN
---echo # that can be converted to INNER JOIN
---echo #
-
-create table t1 (a int, b int, key(a)) engine=myisam;
-insert into t1 values
- (3,20), (7,10), (2,10), (4,30), (8,70),
- (7,70), (9,100), (9,60), (8,80), (7,60);
-
-create table t2 (c int, d int, key (c)) engine=myisam;
-insert into t2 values
- (50,100), (20, 200), (10,300),
- (150,100), (120, 200), (110,300),
- (250,100), (220, 200), (210,300);
-
-create table t3(e int, f int not null, key(e), unique (f)) engine=myisam;
-insert into t3 values
- (100, 3), (300, 5), (400, 4), (300,7),
- (300,2), (600, 13), (800, 15), (700, 14),
- (600, 23), (800, 25), (700, 24);
-
-create view v1 as
- select * from t2 left join t3 on t3.e=t2.d where t3.f is not null;
-
-select *
- from t1 left join v1 on v1.c=t1.b
- where t1.a < 5;
-
-select *
- from t1 left join ( t2 left join t3 on t3.e=t2.d )
- on t2.c=t1.b and t3.f is not null
- where t1.a < 5;
-
-explain extended
-select *
- from t1 left join v1 on v1.c=t1.b
- where t1.a < 5;
-
-explain extended
-select *
- from t1 left join ( t2 left join t3 on t3.e=t2.d )
- on t2.c=t1.b and t3.f is not null
- where t1.a < 5;
-
-explain extended
-select *
- from t1 left join v1 on v1.c=t1.b and v1.f=t1.a
- where t1.a < 5;
-
-explain extended
-select *
- from t1 left join ( t2 left join t3 on t3.e=t2.d )
- on t2.c=t1.b and t3.f=t1.a and t3.f is not null
- where t1.a < 5;
-
-drop view v1;
-drop table t1,t2,t3;
-
---echo #
---echo # MDEV-11240: Server crashes in check_view_single_update or
---echo # Assertion `derived->table' failed in mysql_derived_merge_for_insert
---echo #
-
-CREATE TABLE t3 (a INT);
-CREATE ALGORITHM = MERGE VIEW v1 AS SELECT t2.a FROM t3 AS t1, t3 AS t2;
-CREATE ALGORITHM = MERGE VIEW v2 AS SELECT * FROM v1;
---error ER_VIEW_NO_INSERT_FIELD_LIST
-PREPARE stmt FROM 'REPLACE INTO v2 SELECT a FROM t3';
-drop view v1,v2;
-drop table t3;
-
---echo #
---echo # MDEV-14619: VIEW and GROUP_CONCAT
---echo #
-
-CREATE TABLE t1 (str text);
-INSERT INTO t1 VALUES ("My"),("SQL");
-CREATE VIEW v1 AS SELECT GROUP_CONCAT(str SEPARATOR '\\') FROM t1;
-SELECT * FROM v1;
-SHOW CREATE VIEW v1;
-drop view v1;
-drop table t1;
-
---echo # -----------------------------------------------------------------
---echo # -- End of 5.5 tests.
---echo # -----------------------------------------------------------------
-
---echo # some subqueries in SELECT list test
-create table t1 (a int, b int);
-create table t2 (a int, b int);
-insert into t1 values (1,2), (3,4), (3,3), (5,6), (7,8), (9,10);
-insert into t2 values (1,2), (3,4), (3,3), (5,6), (7,8), (9,10);
-create algorithm=merge view v1 as select t1.a as a, (select max(b) from t2 where t1.a=t2.a) as c from t1;
-explain extended
-select * from v1;
-select * from v1;
-explain extended
-select * from t2, v1 where t2.a=v1.a;
-select * from t2, v1 where t2.a=v1.a;
-explain extended
-select * from t1, v1 where t1.a=v1.a;
-select * from t1, v1 where t1.a=v1.a;
-explain extended
-select * from t1, v1 where t1.b=v1.c;
-select * from t1, v1 where t1.b=v1.c;
-explain extended
-select * from t2, t1, v1 where t1.a=t2.a and t1.a=v1.a;
-select * from t2, t1, v1 where t1.a=t2.a and t1.a=v1.a;
-
-drop view v1;
-drop table t1,t2;
-
-#
-# MDEV-6785 Wrong result on 2nd execution of PS with aggregate function, FROM SQ or MERGE view
-#
-
-create table t1 (i int not null);
-insert into t1 values (1),(2);
-create table t2 (j int not null);
-insert into t2 values (11),(12);
-create algorithm=merge view v3 as select t1.* from t2 left join t1 on (t2.j = t1.i);
-prepare stmt from 'select count(v3.i) from t1, v3';
-execute stmt;
-execute stmt;
-drop table t1, t2;
-drop view v3;
-
---echo #
---echo # MDEV-8525: mariadb 10.0.20 crashing when data is read by Kodi
---echo # media center (http://kodi.tv).
---echo #
-
-CREATE TABLE `t1` (
- `idSong` int(11) NOT NULL AUTO_INCREMENT,
- `idAlbum` int(11) DEFAULT NULL,
- `idPath` int(11) DEFAULT NULL,
- `strArtists` text,
- `strGenres` text,
- `strTitle` varchar(512) DEFAULT NULL,
- `iTrack` int(11) DEFAULT NULL,
- `iDuration` int(11) DEFAULT NULL,
- `iYear` int(11) DEFAULT NULL,
- `dwFileNameCRC` text,
- `strFileName` text,
- `strMusicBrainzTrackID` text,
- `iTimesPlayed` int(11) DEFAULT NULL,
- `iStartOffset` int(11) DEFAULT NULL,
- `iEndOffset` int(11) DEFAULT NULL,
- `idThumb` int(11) DEFAULT NULL,
- `lastplayed` varchar(20) DEFAULT NULL,
- `rating` char(1) DEFAULT '0',
- `comment` text,
- `mood` text,
- PRIMARY KEY (`idSong`),
- UNIQUE KEY `idxSong7` (`idAlbum`,`strMusicBrainzTrackID`(36)),
- KEY `idxSong` (`strTitle`(255)),
- KEY `idxSong1` (`iTimesPlayed`),
- KEY `idxSong2` (`lastplayed`),
- KEY `idxSong3` (`idAlbum`),
- KEY `idxSong6` (`idPath`,`strFileName`(255))
-) DEFAULT CHARSET=utf8;
-
-INSERT INTO `t1` VALUES (1,1,1,'strArtists1','strGenres1','strTitle1',1,100,2000,NULL,'strFileName1','strMusicBrainzTrackID1',0,0,0,NULL,NULL,'0','',''),(2,2,2,'strArtists2','strGenres2','strTitle2',2,200,2001,NULL,'strFileName2','strMusicBrainzTrackID2',0,0,0,NULL,NULL,'0','','');
-
-CREATE TABLE `t2` (
- `idAlbum` int(11) NOT NULL AUTO_INCREMENT,
- `strAlbum` varchar(256) DEFAULT NULL,
- `strMusicBrainzAlbumID` text,
- `strArtists` text,
- `strGenres` text,
- `iYear` int(11) DEFAULT NULL,
- `idThumb` int(11) DEFAULT NULL,
- `bCompilation` int(11) NOT NULL DEFAULT '0',
- `strMoods` text,
- `strStyles` text,
- `strThemes` text,
- `strReview` text,
- `strImage` text,
- `strLabel` text,
- `strType` text,
- `iRating` int(11) DEFAULT NULL,
- `lastScraped` varchar(20) DEFAULT NULL,
- `dateAdded` varchar(20) DEFAULT NULL,
- `strReleaseType` text,
- PRIMARY KEY (`idAlbum`),
- UNIQUE KEY `idxAlbum_2` (`strMusicBrainzAlbumID`(36)),
- KEY `idxAlbum` (`strAlbum`(255)),
- KEY `idxAlbum_1` (`bCompilation`)
-) DEFAULT CHARSET=utf8;
-
-INSERT INTO `t2` VALUES (1,'strAlbum1','strMusicBrainzAlbumID1','strArtists1','strGenres1',2000,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'album');
-
-CREATE TABLE `t3` (
- `idArtist` int(11) DEFAULT NULL,
- `idAlbum` int(11) DEFAULT NULL,
- `strJoinPhrase` text,
- `boolFeatured` int(11) DEFAULT NULL,
- `iOrder` int(11) DEFAULT NULL,
- `strArtist` text,
- UNIQUE KEY `idxAlbumArtist_1` (`idAlbum`,`idArtist`),
- UNIQUE KEY `idxAlbumArtist_2` (`idArtist`,`idAlbum`),
- KEY `idxAlbumArtist_3` (`boolFeatured`)
-) DEFAULT CHARSET=utf8;
-
-INSERT INTO `t3` VALUES (1,1,'',0,0,'strArtist1');
-
-CREATE TABLE `t4` (
- `idArtist` int(11) NOT NULL AUTO_INCREMENT,
- `strArtist` varchar(256) DEFAULT NULL,
- `strMusicBrainzArtistID` text,
- `strBorn` text,
- `strFormed` text,
- `strGenres` text,
- `strMoods` text,
- `strStyles` text,
- `strInstruments` text,
- `strBiography` text,
- `strDied` text,
- `strDisbanded` text,
- `strYearsActive` text,
- `strImage` text,
- `strFanart` text,
- `lastScraped` varchar(20) DEFAULT NULL,
- `dateAdded` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`idArtist`),
- UNIQUE KEY `idxArtist1` (`strMusicBrainzArtistID`(36)),
- KEY `idxArtist` (`strArtist`(255))
-) DEFAULT CHARSET=utf8;
-
-INSERT INTO `t4` VALUES (1,'strArtist1','strMusicBrainzArtistID',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-
-CREATE VIEW `v1` AS select `t2`.`idAlbum` AS `idAlbum`,`t2`.`strAlbum` AS `strAlbum`,`t2`.`strMusicBrainzAlbumID` AS `strMusicBrainzAlbumID`,`t2`.`strArtists` AS `strArtists`,`t2`.`strGenres` AS `strGenres`,`t2`.`iYear` AS `iYear`,`t2`.`strMoods` AS `strMoods`,`t2`.`strStyles` AS `strStyles`,`t2`.`strThemes` AS `strThemes`,`t2`.`strReview` AS `strReview`,`t2`.`strLabel` AS `strLabel`,`t2`.`strType` AS `strType`,`t2`.`strImage` AS `strImage`,`t2`.`iRating` AS `iRating`,`t2`.`bCompilation` AS `bCompilation`,(select min(`t1`.`iTimesPlayed`) from `t1` where (`t1`.`idAlbum` = `t2`.`idAlbum`)) AS `iTimesPlayed`,`t2`.`strReleaseType` AS `strReleaseType` from `t2`;
-
-CREATE VIEW `v2` AS select `t3`.`idAlbum` AS `idAlbum`,`t3`.`idArtist` AS `idArtist`,`t4`.`strArtist` AS `strArtist`,`t4`.`strMusicBrainzArtistID` AS `strMusicBrainzArtistID`,`t3`.`boolFeatured` AS `boolFeatured`,`t3`.`strJoinPhrase` AS `strJoinPhrase`,`t3`.`iOrder` AS `iOrder` from (`t3` join `t4` on((`t3`.`idArtist` = `t4`.`idArtist`)));
-
-SELECT v1.*,v2.* FROM v1 LEFT JOIN v2 ON v1.idAlbum = v2.idAlbum WHERE v1.idAlbum = 1 ORDER BY v2.iOrder;
-
-drop view v1,v2;
-drop table t1,t2,t3,t4;
-
---echo #
---echo # MDEV-8913: Derived queries with same column names as final
---echo # projection causes issues when using Order By
---echo #
-create table t1 (field int);
-insert into t1 values (10),(5),(3),(8),(20);
-
-SELECT sq.f2 AS f1, sq.f1 AS f2
-FROM ( SELECT field AS f1, 1 AS f2 FROM t1) AS sq
-ORDER BY sq.f1;
-
-create view v1 as SELECT field AS f1, 1 AS f2 FROM t1;
-
-SELECT sq.f2 AS f1, sq.f1 AS f2
-FROM v1 AS sq
-ORDER BY sq.f1;
-
-drop view v1;
-
-create table t2 SELECT field AS f1, 1 AS f2 FROM t1;
-
-SELECT
- sq.f2 AS f1,
- sq.f1 AS f2
-FROM t2 AS sq
-ORDER BY sq.f1;
-
-drop table t1, t2;
-
---error ER_BAD_FIELD_ERROR
-SELECT 1 FROM (SELECT 1 as a) AS b HAVING (SELECT `SOME_GARBAGE`.b.a)=1;
-
-
---echo #
---echo # MDEV-10035: DBUG_ASSERT on CREATE VIEW v1 AS SELECT * FROM t1
---echo # FOR UPDATE
---echo #
-
-CREATE TABLE t1 (a INT);
-insert into t1 values (1),(2);
-
-CREATE VIEW v1 AS SELECT * FROM t1 FOR UPDATE;
-SHOW CREATE VIEW v1;
-select * from v1;
-DROP VIEW v1;
-
-CREATE VIEW v1 AS SELECT * FROM t1 LOCK IN SHARE MODE;
-SHOW CREATE VIEW v1;
-select * from v1;
-DROP VIEW v1;
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8642: WHERE Clause not applied on View - Empty result set returned
---echo #
-
-CREATE TABLE `t1` (
- `id` int(20) NOT NULL AUTO_INCREMENT,
- `use_case` int(11) DEFAULT NULL,
- `current_deadline` date DEFAULT NULL,
- `ts_create` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (`id`),
- UNIQUE KEY `id_UNIQUE` (`id`)
-) ENGINE=MyISAM AUTO_INCREMENT=13976 DEFAULT CHARSET=latin1;
-INSERT INTO `t1` VALUES (1,10,'2015-12-18','2015-08-18 08:38:16');
-INSERT INTO `t1` VALUES (2,20,'2015-10-18','2015-08-18 08:43:30');
-CREATE VIEW v1 AS SELECT
- use_case as use_case_id,
- (
- SELECT
- deadline_sub.current_deadline
- FROM
- t1 deadline_sub
- WHERE
- deadline_sub.use_case = use_case_id
- AND ts_create = (SELECT
- MIN(ts_create)
- FROM
- t1 startdate_sub
- WHERE
- startdate_sub.use_case = use_case_id
- )
- ) AS InitialDeadline
-FROM
- t1;
-
-SELECT * FROM v1 where use_case_id = 10;
-
-drop view v1;
-drop table t1;
-
---echo #
---echo # MDEV-12666: CURRENT_ROLE() and DATABASE() does not work in a view
---echo #
---echo # DATABASE() fails only when the initial view creation features a NULL
---echo # default database.
---echo #
---echo # CREATE, USE and DROP database so that we have no "default" database.
---echo #
-CREATE DATABASE temporary;
-USE temporary;
-DROP DATABASE temporary;
-SELECT DATABASE();
-
-CREATE VIEW test.v_no_db AS SELECT DATABASE() = 'temporary_two';
-SHOW CREATE VIEW test.v_no_db;
-PREPARE prepared_no_database FROM "SELECT DATABASE() = 'temporary_two'";
-
---echo #
---echo # All statements should return NULL
---echo #
-EXECUTE prepared_no_database;
-SELECT DATABASE() = 'temporary_two';
-SELECT * FROM test.v_no_db;
-
-CREATE DATABASE temporary_two;
-USE temporary_two;
-CREATE VIEW test.v_with_db AS SELECT DATABASE() = 'temporary_two';
-PREPARE prepared_with_database FROM "SELECT DATABASE() = 'temporary_two'";
-
---echo #
---echo # All statements should return 1;
---echo #
-SELECT DATABASE() = 'temporary_two';
-SELECT * FROM test.v_no_db;
-SELECT * FROM test.v_with_db;
-EXECUTE prepared_with_database;
-
---echo #
---echo # Prepared statements maintain default database to be the same
---echo # during on creation so this should return NULL still.
---echo # See MySQL bug #25843
---echo #
-EXECUTE prepared_no_database;
-
-DROP DATABASE temporary_two;
-DROP VIEW test.v_no_db;
-DROP VIEW test.v_with_db;
-USE test;
-
---echo # -----------------------------------------------------------------
---echo # -- End of 10.0 tests.
---echo # -----------------------------------------------------------------
-SET optimizer_switch=@save_optimizer_switch;
-
---echo #
---echo # Start of 10.1 tests
---echo #
-
---echo #
---echo # MDEV-8747 Wrong result for SELECT..WHERE derived_table_column='a' AND derived_table_column<>_latin1'A' COLLATE latin1_bin
---echo #
-CREATE TABLE t1 (a varchar(10) character set cp1251 collate cp1251_ukrainian_ci, KEY (a)) ;
-INSERT INTO t1 VALUES ('DD'), ('ZZ'), ('ZZ'), ('KK'), ('FF'), ('HH'),('MM'),('`1');
-CREATE VIEW v1 AS SELECT * FROM t1;
-SELECT * FROM t1 WHERE a <> 0 AND a = ' 1';
-SELECT * FROM v1 WHERE a <> 0 AND a = ' 1';
-DROP VIEW v1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a ENUM('5','6'));
-INSERT INTO t1 VALUES ('5'),('6');
-CREATE VIEW v1 AS SELECT * FROM t1;
-SELECT * FROM t1 WHERE a='5' AND a<2;
-SELECT * FROM v1 WHERE a='5' AND a<2;
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8749 Wrong result for SELECT..WHERE derived_table_enum_column='number' AND derived_table_enum_column OP number2
---echo #
-CREATE TABLE t1 (a varchar(10) character set cp1251 collate cp1251_ukrainian_ci, KEY (a));
-INSERT INTO t1 VALUES ('DD'), ('ZZ'), ('ZZ'), ('KK'), ('FF'), ('HH'),('MM'),('`1');
-CREATE VIEW v1 AS SELECT * FROM t1;
-SELECT * FROM t1 WHERE a <> 0 AND a = ' 1';
-SELECT * FROM v1 WHERE a <> 0 AND a = ' 1';
-DROP VIEW v1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a ENUM('5','6'));
-INSERT INTO t1 VALUES ('5'),('6');
-CREATE VIEW v1 AS SELECT * FROM t1;
-SELECT * FROM t1 WHERE a='5' AND a<2;
-SELECT * FROM v1 WHERE a='5' AND a<2;
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-8742 Wrong result for SELECT..WHERE view_latin1_swedish_ci_field='a' COLLATE latin1_bin
---echo #
-CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1);
-INSERT INTO t1 VALUES ('a'),('A');
-CREATE VIEW v1 AS SELECT * FROM t1 WHERE a='a';
-SELECT * FROM v1 WHERE a=_latin1'a' COLLATE latin1_bin;
-DROP VIEW v1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-9701: CREATE VIEW with GROUP BY or ORDER BY and constant
---echo # produces invalid definition
---echo #
-CREATE TABLE t1 ( i INT );
-INSERT INTO t1 VALUES (1),(2);
-
-CREATE VIEW v1 AS
-SELECT 3 AS three, COUNT(*) FROM t1 GROUP BY three;
-
-show create view v1;
-
-SELECT * FROM v1;
-
-drop view v1;
-drop table t1;
-
---echo #
---echo # MDEV-12819: order by ordering expression changed to empty string
---echo # when creatin view with union
---echo #
-
-create table t1 (t1col1 int, t1col2 int,t1col3 int );
-create table t2 (t2col1 int, t2col2 int, t2col3 int);
-
-create view v1 as
-select t1col1,t1col2,t1col3 from t1
-union all
-select t2col1,t2col2,t2col3 from t2
-order by 2,3;
-
-show create view v1;
-
-select * from v1;
-
-drop view v1;
-drop table t1,t2;
-
---echo #
---echo # End of 10.1 tests
---echo #
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo # Checking that SHOW CREATE VIEW preserve parentheses
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES (10),(20),(30);
-
-CREATE VIEW v1 AS SELECT 1 AS a UNION SELECT a FROM t1;
-SHOW CREATE VIEW v1;
-SELECT * FROM v1;
-DROP VIEW v1;
-
-CREATE VIEW v1 AS SELECT 1 AS a UNION SELECT a FROM t1 LIMIT 1;
-SHOW CREATE VIEW v1;
-SELECT * FROM v1;
-DROP VIEW v1;
-
-CREATE VIEW v1 AS SELECT 1 AS a UNION (SELECT a FROM t1);
-SHOW CREATE VIEW v1;
-SELECT * FROM v1;
-DROP VIEW v1;
-
-CREATE VIEW v1 AS SELECT 1 AS a UNION (SELECT a FROM t1 LIMIT 1);
-SHOW CREATE VIEW v1;
-SELECT * FROM v1;
-DROP VIEW v1;
-
-CREATE VIEW v1 AS SELECT 1 AS a UNION (SELECT a FROM t1) LIMIT 1;
-SHOW CREATE VIEW v1;
-SELECT * FROM v1;
-DROP VIEW v1;
-
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-9408 CREATE TABLE SELECT MAX(int_column) creates different columns for table vs view
---echo #
-CREATE TABLE t1 (
- id int(11) NOT NULL PRIMARY KEY,
- country varchar(32),
- code int(11) default NULL
-);
-INSERT INTO t1 VALUES (1,'ITALY',100),(2,'ITALY',200),(3,'FRANCE',100), (4,'ITALY',100);
-CREATE VIEW v1 AS SELECT * FROM t1;
-CREATE TABLE t2 AS
-SELECT code, COUNT(DISTINCT country), MAX(id) FROM t1 GROUP BY code ORDER BY MAX(id);
-SHOW CREATE TABLE t2;
-CREATE TABLE t3 AS
-SELECT code, COUNT(DISTINCT country), MAX(id) FROM v1 GROUP BY code ORDER BY MAX(id);
-SHOW CREATE TABLE t3;
-DROP VIEW v1;
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # MDEV-3944: Allow derived tables in VIEWS
---echo #
-create table t1 (s1 int);
-insert into t1 values (1),(2),(3);
-
-CREATE VIEW v1 AS SELECT * FROM (SELECT s1 FROM t1 WHERE s1>1) AS x;
-CREATE VIEW v2 AS SELECT * FROM (SELECT s1 FROM t1 WHERE s1<3) AS x;
-
---sorted_result
-select * from v1;
---sorted_result
-select * from v2;
---sorted_result
-select * from v1 natural join v2;
---sorted_result
-select * from v1 natural join t1;
---sorted_result
-select * from v1 natural join (SELECT s1 FROM t1 WHERE s1<3) as x;
---sorted_result
-select * from v1 left join v2 on (v1.s1=v2.s1);
---sorted_result
-select * from v1 left join t1 on (v1.s1=t1.s1);
---sorted_result
-select * from t1 left join v2 on (t1.s1=v2.s1);
---sorted_result
-select * from v1 left join (SELECT s1 FROM t1 WHERE s1<3) as x on (v1.s1=x.s1);
---sorted_result
-select * from (SELECT s1 FROM t1 WHERE s1>1) AS x left join v2 on (x.s1=v2.s1);
-
-drop view v1,v2;
-
-CREATE VIEW v1 AS SELECT * FROM (SELECT s1 FROM (SELECT s1 FROM t1 WHERE s1
-< 100) as xx WHERE s1>1) AS x;
-CREATE VIEW v2 AS SELECT * FROM (SELECT s1 FROM (SELECT s1 FROM t1 WHERE s1
-> -100) as xx WHERE s1<3) AS x;
-insert into t1 values (200),(-200);
---sorted_result
-select * from t1;
---sorted_result
-select * from v1;
---sorted_result
-select * from v2;
---sorted_result
-select * from v1 natural join v2;
---sorted_result
-select * from v1 natural join t1;
---sorted_result
-select * from v1 natural join (SELECT s1 FROM t1 WHERE s1<3) as x;
---sorted_result
-select * from v1 left join v2 on (v1.s1=v2.s1);
---sorted_result
-select * from v1 left join t1 on (v1.s1=t1.s1);
---sorted_result
-select * from t1 left join v2 on (t1.s1=v2.s1);
---sorted_result
-select * from v1 left join (SELECT s1 FROM t1 WHERE s1<3) as x on (v1.s1=x.s1);
---sorted_result
-select * from (SELECT s1 FROM t1 WHERE s1>1) AS x left join v2 on (x.s1=v2.s1);
-
-drop view v1,v2;
-
-CREATE algorithm=temptable VIEW v1 AS SELECT * FROM (SELECT s1 FROM (SELECT s1 FROM t1 WHERE s1
-< 100) as xx WHERE s1>1) AS x;
-CREATE algorithm=temptable VIEW v2 AS SELECT * FROM (SELECT s1 FROM (SELECT s1 FROM t1 WHERE s1
-> -100) as xx WHERE s1<3) AS x;
---sorted_result
-select * from t1;
---sorted_result
-select * from v1;
---sorted_result
-select * from v2;
---sorted_result
-select * from v1 natural join v2;
---sorted_result
-select * from v1 natural join t1;
---sorted_result
-select * from v1 natural join (SELECT s1 FROM t1 WHERE s1<3) as x;
---sorted_result
-select * from v1 left join v2 on (v1.s1=v2.s1);
---sorted_result
-select * from v1 left join t1 on (v1.s1=t1.s1);
---sorted_result
-select * from t1 left join v2 on (t1.s1=v2.s1);
---sorted_result
-select * from v1 left join (SELECT s1 FROM t1 WHERE s1<3) as x on (v1.s1=x.s1);
---sorted_result
-select * from (SELECT s1 FROM t1 WHERE s1>1) AS x left join v2 on (x.s1=v2.s1);
-
-drop view v1,v2;
-
-CREATE VIEW v1 AS SELECT * FROM (SELECT s1 FROM (SELECT s1 FROM t1 WHERE s1
-< 100) as xx WHERE s1>1) AS x;
-
---error ER_NON_INSERTABLE_TABLE
-insert into v1 values (-300);
---error ER_NON_UPDATABLE_TABLE
-update v1 set s1=s1+1;
-
-drop view v1;
-
-CREATE VIEW v1 AS SELECT s1,s2 FROM (SELECT s1 as s2 FROM t1 WHERE s1 <
-100) x, t1 WHERE t1.s1=x.s2;
-select * from v1;
-
-insert into v1 (s1) values (-300);
-update v1 set s1=s1+1;
-select * from v1;
-select * from t1;
---error ER_NON_INSERTABLE_TABLE
-insert into v1(s2) values (-300);
---error ER_NON_UPDATABLE_TABLE
-update v1 set s2=s2+1;
-
-drop view v1;
-
-CREATE VIEW v1 AS SELECT * FROM (SELECT s1 FROM t1 WHERE s1
-< 100) AS x;
-
---error ER_NON_INSERTABLE_TABLE
-insert into v1 values (-300);
---error ER_NON_UPDATABLE_TABLE
-update v1 set s1=s1+1;
-
-drop view v1;
-
-CREATE VIEW v1 AS SELECT * FROM (SELECT s1 FROM (SELECT s1 FROM t1 WHERE s1
-< 100) as xx WHERE s1>1) AS x;
-
---error ER_NON_INSERTABLE_TABLE
-insert into v1 values (-300);
---error ER_NON_UPDATABLE_TABLE
-update v1 set s1=s1+1;
-
-create view v2 as select * from v1;
-
---error ER_NON_INSERTABLE_TABLE
-insert into v2 values (-300);
---error ER_NON_UPDATABLE_TABLE
-update v2 set s1=s1+1;
-
-drop view v1, v2;
-drop table t1;
-
---echo #
---echo # MDEV-9671:Wrong result upon select from a view with a FROM subquery
---echo #
-CREATE TABLE t1 (i INT);
-INSERT INTO t1 VALUES (3),(2);
-
-CREATE TABLE t2 (j INT);
-INSERT INTO t2 VALUES (8),(3),(3);
-
-CREATE TABLE t3 (k INT);
-INSERT INTO t3 VALUES (1),(8);
-
-CREATE VIEW v1 AS SELECT * FROM t1 LEFT JOIN ( SELECT t2.* FROM t2 INNER JOIN t3 ON ( k = j ) ) AS alias1 ON ( i = j );
-
-show create view v1;
-
-SELECT * FROM t1 LEFT JOIN ( SELECT t2.* FROM t2 INNER JOIN t3 ON ( k = j ) ) AS alias1 ON ( i = j );
-
-SELECT * FROM v1;
-
-DROP VIEW v1;
-DROP TABLE t1, t2, t3;
-
---echo #
---echo # MDEV-10035: DBUG_ASSERT on CREATE VIEW v1 AS SELECT * FROM t1
---echo # FOR UPDATE
---echo #
-
-CREATE TABLE t1 (a INT);
-insert into t1 values (1),(2);
-
-CREATE VIEW v1 AS SELECT * FROM t1 FOR UPDATE;
-SHOW CREATE VIEW v1;
-select * from v1;
-DROP VIEW v1;
-
-CREATE VIEW v1 AS SELECT * FROM t1 LOCK IN SHARE MODE;
-SHOW CREATE VIEW v1;
-select * from v1;
-DROP VIEW v1;
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-10724:Assertion `vcol_table == 0 || vcol_table == table'
---echo # failed in fill_record(THD*, TABLE*, List<Item>&, List<Item>&,
---echo # bool, bool)
---echo #
-
-CREATE TABLE t1 (f1 INT);
-CREATE TABLE t2 (f2 INT);
-CREATE TABLE t3 (f3 INT);
-
-CREATE ALGORITHM = MERGE VIEW v AS SELECT f1, f3 FROM t1,
-( SELECT f3 FROM t2, t3 ) AS sq;
-
---error ER_VIEW_MULTIUPDATE
-INSERT INTO v (f1, f3) VALUES (1,1), (2,2);
-
-drop view v;
-drop tables t1,t2,t3;
-
-#
-# MDEV-11784 View is created with invalid definition which causes ERROR 1241 (21000): Operand should contain 1 column(s)
-#
-create table t1 (i int, j int);
-insert t1 values (1,1),(2,2);
-create view v1 as select (2, 3) not in (select i, j from t1);
-select * from v1;
-show create view v1;
-drop view v1;
-drop table t1;
-
---echo #
---echo # MDEV-10704: Assertion `field->field->table == table_arg'
---echo # failed in fill_record(THD*, TABLE*, List<Item>&, List<Item>&,
---echo # bool, bool)
---echo #
-
-CREATE TABLE t1 (i INT);
-CREATE TABLE t2 (j INT);
-CREATE TABLE t3 (k INT);
-
-CREATE ALGORITHM = MERGE VIEW v AS SELECT j AS f1, k AS f2 FROM ( SELECT j FROM t1, t2 ) sq, t3;
---error ER_VIEW_MULTIUPDATE
-REPLACE INTO v (f1,f2) VALUES (1,1);
-
-drop view v;
-drop table t1,t2,t3;
-
-
---echo #
---echo # MDEV-12379: Server crashes in TABLE_LIST::is_with_table on
---echo # SHOW CREATE VIEW
---echo #
-
-CREATE TABLE t (i INT);
-CREATE VIEW v AS SELECT * FROM ( SELECT * FROM t ) sq;
-DROP TABLE IF EXISTS t;
-SHOW CREATE VIEW v;
-DROP VIEW v;
-
---echo #
---echo # MDEV-13439: Database permissions are not enough to run a subquery
---echo # with GROUP BY within a view
---echo #
-
-create database test_db;
-use test_db;
-create table t (i int);
-
-create user foo@localhost;
-grant all on test_db.* to foo@localhost;
-
---connect (con1,localhost,foo,,)
-
-use test_db;
-create view v as select * from (select i from t group by i) sq;
-select * from v;
-
-# Cleanup
---disconnect con1
---connection default
-use test;
-drop database test_db;
-drop user foo@localhost;
-
---echo #
---echo # MDEV-13523: Group By in a View, called within a Stored Routine
---echo # causes Error Code 1356 when a non-root user runs the routine for
---echo # a second time
---echo #
-
-CREATE DATABASE bugTest;
-USE bugTest;
-
-CREATE TABLE `procViewTable` (`id` int(10), `someText` varchar(50) NOT NULL);
-insert into `procViewTable` values (1,'Test'), (2,'Test 2');
-
-CREATE USER 'procView'@'%';
-GRANT ALL PRIVILEGES ON `bugTest`.* TO 'procView'@'%';
-
-CREATE DEFINER=`procView`@`%` VIEW `procViewSimple` AS (
- select * from (
- select `id` from `bugTest`.`procViewTable`
- ) `innerQuery`
- group by `innerQuery`.`id`
-);
-
---connect (con1,localhost,procView,,)
-use bugTest;
-
-prepare stmt from "SELECT * FROM procViewSimple";
-execute stmt;
-execute stmt;
-
-# Cleanup
---disconnect con1
---connection default
-drop user procView;
-drop view procViewSimple;
-drop table procViewTable;
-use test;
-drop database bugTest;
-
---echo #
---echo # MDEV-13436: PREPARE doesn't work as expected & throws errors but
---echo # MySQL is working fine
---echo #
-
-create table t1 (a int);
-insert into t1 values (1),(2);
-SET @sql_query = "
- CREATE VIEW v1 AS
- SELECT * FROM (
- SELECT CASE WHEN 1 IN (SELECT a from t1 where a < 2) THEN TRUE END AS testcase
- ) testalias
-";
-PREPARE stmt FROM @sql_query;
-EXECUTE stmt;
-DEALLOCATE PREPARE stmt;
-show create view v1;
-SELECT * FROM v1;
-drop view v1;
-drop table t1;
-
---echo #
---echo # End of 10.2 tests
---echo #
-
-
---echo #
---echo # Start of 10.3 tests
---echo #
-
---echo #
---echo # MDEV-13197 Parser refactoring for CREATE VIEW,TRIGGER,SP,UDF,EVENT
---echo #
-
---error ER_PARSE_ERROR
-ALTER VIEW IF NOT EXISTS v1 AS SELECT 1;
-
---echo #
---echo # End of 10.3 tests
---echo #
diff --git a/mysql-test/t/view_alias.test b/mysql-test/t/view_alias.test
deleted file mode 100644
index 09d707296bb..00000000000
--- a/mysql-test/t/view_alias.test
+++ /dev/null
@@ -1,101 +0,0 @@
---echo #
---echo # Bug#40277 SHOW CREATE VIEW returns invalid SQL
---echo # Bug#41999 SHOW CREATE VIEW returns invalid SQL if subquery is used in SELECT list
---echo #
-
---echo # 65 characters exceed the maximum length of a column identifier. The system cannot derive the name from statement.
---echo # Constant with length = 65 . Expect to get the identifier 'Name_exp_1'.
-let $after_select= '<--- 65 char including the arrows --->';
---source include/view_alias.inc
---echo # Subquery with length = 65 . Expect to get the identifier 'Name_exp_1'.
---echo # Attention: Identifier for the column within the subquery will be not generated.
-let $after_select= (SELECT '<--- 54 char including the arrows (+ 11 outside) -->');
---source include/view_alias.inc
---echo # -----------------------------------------------------------------------------------------------------------------
-#
---echo # 64 characters are the maximum length of a column identifier. The system can derive the name from the statement.
-let $after_select= '<--- 64 char including the arrows --->';
---source include/view_alias.inc
-let $after_select= (SELECT '<--- 53 char including the arrows (+ 11 outside) --->');
---source include/view_alias.inc
---echo # -----------------------------------------------------------------------------------------------------------------
-#
---echo # Identifiers must not have trailing spaces. The system cannot derive the name from a constant with trailing space.
---echo # Generated identifiers have at their end the position within the select column list.
---echo # 'c2 ' -> 'Name_exp_1' , ' c4 ' -> 'Name_exp_2'
-let $after_select= 'c1', 'c2 ', ' c3', ' c4 ';
---source include/view_alias.inc
-
---echo #
---echo # Bug#40277 SHOW CREATE VIEW returns invalid SQL
---echo #
-
---disable_warnings
-DROP VIEW IF EXISTS v1;
-DROP TABLE IF EXISTS t1,t2;
---enable_warnings
-
---echo # Column name exceeds the maximum length.
-CREATE VIEW v1 AS SELECT '0000000000 1111111111 2222222222 3333333333 4444444444 5555555555';
-let $query = `SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1'`;
-DROP VIEW v1;
-eval CREATE VIEW v1 AS $query;
-DROP VIEW v1;
-
---echo # Column names with leading trailing spaces.
-CREATE VIEW v1 AS SELECT 'c1', 'c2 ', ' c3', ' c4 ';
-let $query = `SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1'`;
-DROP VIEW v1;
-eval CREATE VIEW v1 AS $query;
-DROP VIEW v1;
-
---echo # Column name conflicts with a auto-generated one.
-CREATE VIEW v1 AS SELECT 'c1', 'c2 ', ' c3', ' c4 ', 'Name_exp_2';
-let $query = `SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1'`;
-DROP VIEW v1;
-eval CREATE VIEW v1 AS $query;
-DROP VIEW v1;
-
---echo # Invalid conlumn name in subquery.
-CREATE VIEW v1 AS SELECT (SELECT ' c1 ');
-let $query = `SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1'`;
-DROP VIEW v1;
-eval CREATE VIEW v1 AS $query;
-DROP VIEW v1;
-
-CREATE TABLE t1(a INT);
-CREATE TABLE t2 LIKE t1;
-
---echo # Test alias in subquery
-CREATE VIEW v1 AS SELECT a FROM t1 WHERE EXISTS (SELECT 1 FROM t2 AS b WHERE b.a = 0);
-let $query = `SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1'`;
-DROP VIEW v1;
-eval CREATE VIEW v1 AS $query;
-DROP VIEW v1;
-
---echo # Test column alias in subquery
-CREATE VIEW v1 AS SELECT a FROM t1 WHERE EXISTS (SELECT a AS alias FROM t1 GROUP BY alias);
-SHOW CREATE VIEW v1;
-let $query = `SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1'`;
-DROP VIEW v1;
-eval CREATE VIEW v1 AS $query;
-DROP VIEW v1;
-
---echo # Alias as the expression column name.
-CREATE VIEW v1 AS SELECT a FROM t1 WHERE EXISTS (SELECT ' a ' AS alias FROM t1 GROUP BY alias);
-SHOW CREATE VIEW v1;
-let $query = `SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v1'`;
-DROP VIEW v1;
-eval CREATE VIEW v1 AS $query;
-DROP VIEW v1;
-
-DROP TABLE t1, t2;
-
-#
-# MDEV-7482 VIEW containing INTERVAL(...)
-#
-create view v1 as select interval(55,10) as my_col;
-show create view v1;
-select * from v1;
-drop view v1;
-
diff --git a/mysql-test/t/view_debug.test b/mysql-test/t/view_debug.test
deleted file mode 100644
index 0e448ae2721..00000000000
--- a/mysql-test/t/view_debug.test
+++ /dev/null
@@ -1,36 +0,0 @@
-
---source include/have_debug.inc
-
---echo #
---echo #MDEV-8087:Server crashed in Time_and_counter_tracker::incr_loops
---echo #
-
-CREATE PROCEDURE proc() SELECT * FROM v2;
-
-CREATE ALGORITHM = UNDEFINED VIEW v1 AS SELECT 1;
-CREATE ALGORITHM = TEMPTABLE VIEW v2 AS SELECT 3 FROM v1;
-DROP VIEW v1;
-
---connect (con1,localhost,root,,test)
-
---connect (con2,localhost,root,,test)
-
---connection con1
---error ER_VIEW_INVALID
-CALL proc();
-SET DEBUG_SYNC= 'after_cached_view_opened SIGNAL oppp WAIT_FOR created';
-send CALL proc();
-
---connection con2
-SET DEBUG_SYNC= 'now WAIT_FOR oppp';
-SET DEBUG_SYNC= 'RESET';
-CREATE ALGORITHM = TEMPTABLE VIEW v1 AS SELECT 2;
-SET DEBUG_SYNC= 'now SIGNAL created';
-
---connection con1
---reap
-SET DEBUG_SYNC= 'RESET';
-
-
-drop procedure proc;
-drop view v1,v2;
diff --git a/mysql-test/t/view_grant.test b/mysql-test/t/view_grant.test
deleted file mode 100644
index a70241138aa..00000000000
--- a/mysql-test/t/view_grant.test
+++ /dev/null
@@ -1,2207 +0,0 @@
-# Can't test with embedded server
--- source include/not_embedded.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
---disable_warnings
-drop database if exists mysqltest;
-drop view if exists v1,v2,v3;
---enable_warnings
-
-
-# simple test of grants
-create user test@localhost;
-grant create view on test.* to test@localhost;
-show grants for test@localhost;
-revoke create view on test.* from test@localhost;
-show grants for test@localhost;
-# The grant above creates a new user test@localhost, delete it
-drop user test@localhost;
-
-# grant create view test
-#
-connect (root,localhost,root,,test);
-connection root;
---disable_warnings
-create database mysqltest;
---enable_warnings
-
-create table mysqltest.t1 (a int, b int);
-create table mysqltest.t2 (a int, b int);
-
-create user mysqltest_1@localhost;
-grant select on mysqltest.t1 to mysqltest_1@localhost;
-grant create view,select on test.* to mysqltest_1@localhost;
-
-connect (user1,localhost,mysqltest_1,,test);
-connection user1;
-
---error ER_SPECIFIC_ACCESS_DENIED_ERROR
-create definer=root@localhost view v1 as select * from mysqltest.t1;
-create view v1 as select * from mysqltest.t1;
-# try to modify view without DROP privilege on it
---error ER_TABLEACCESS_DENIED_ERROR
-alter view v1 as select * from mysqltest.t1;
---error ER_TABLEACCESS_DENIED_ERROR
-create or replace view v1 as select * from mysqltest.t1;
-# no CRETE VIEW privilege
---error ER_TABLEACCESS_DENIED_ERROR
-create view mysqltest.v2 as select * from mysqltest.t1;
-# no SELECT privilege
---error ER_TABLEACCESS_DENIED_ERROR
-create view v2 as select * from mysqltest.t2;
-
-connection root;
-# check view definer information
-show create view v1;
-
-grant create view,drop,select on test.* to mysqltest_1@localhost;
-
-connection user1;
-# following 'use' command is workaround of Bug#9582 and should be removed
-# when that bug will be fixed
-use test;
-alter view v1 as select * from mysqltest.t1;
-create or replace view v1 as select * from mysqltest.t1;
-
-connection root;
-revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
-revoke all privileges on test.* from mysqltest_1@localhost;
-
-drop database mysqltest;
-drop view test.v1;
-
-#
-# grants per columns
-#
-# MERGE algorithm
---disable_warnings
-create database mysqltest;
---enable_warnings
-
-create table mysqltest.t1 (a int, b int);
-create view mysqltest.v1 (c,d) as select a+1,b+1 from mysqltest.t1;
-grant select (c) on mysqltest.v1 to mysqltest_1@localhost;
-
-connection user1;
-select c from mysqltest.v1;
-# there are no privileges on column 'd'
---error ER_COLUMNACCESS_DENIED_ERROR
-select d from mysqltest.v1;
-
-connection root;
-revoke all privileges on mysqltest.v1 from mysqltest_1@localhost;
-drop user mysqltest_1@localhost;
-drop database mysqltest;
-
-# TEMPORARY TABLE algorithm
---disable_warnings
-create database mysqltest;
---enable_warnings
-
-create table mysqltest.t1 (a int, b int);
-create algorithm=temptable view mysqltest.v1 (c,d) as select a+1,b+1 from mysqltest.t1;
-create user mysqltest_1@localhost;
-grant select (c) on mysqltest.v1 to mysqltest_1@localhost;
-
-connection user1;
-select c from mysqltest.v1;
-# there are no privileges on column 'd'
---error ER_COLUMNACCESS_DENIED_ERROR
-select d from mysqltest.v1;
-
-connection root;
-revoke all privileges on mysqltest.v1 from mysqltest_1@localhost;
-drop user mysqltest_1@localhost;
-drop database mysqltest;
-
-#
-# EXPLAIN rights
-#
-connection root;
---disable_warnings
-create database mysqltest;
---enable_warnings
-# prepare views and tables
-create table mysqltest.t1 (a int, b int);
-create table mysqltest.t2 (a int, b int);
-create view mysqltest.v1 (c,d) as select a+1,b+1 from mysqltest.t1;
-create algorithm=temptable view mysqltest.v2 (c,d) as select a+1,b+1 from mysqltest.t1;
-create view mysqltest.v3 (c,d) as select a+1,b+1 from mysqltest.t2;
-create algorithm=temptable view mysqltest.v4 (c,d) as select a+1,b+1 from mysqltest.t2;
-# v5: SHOW VIEW, but no SELECT
-create view mysqltest.v5 (c,d) as select a+1,b+1 from mysqltest.t1;
-create user mysqltest_1@localhost;
-grant select on mysqltest.v1 to mysqltest_1@localhost;
-grant select on mysqltest.v2 to mysqltest_1@localhost;
-grant select on mysqltest.v3 to mysqltest_1@localhost;
-grant select on mysqltest.v4 to mysqltest_1@localhost;
-grant show view on mysqltest.v5 to mysqltest_1@localhost;
-
-connection user1;
-# all SELECTs works, except v5 which lacks SELECT privs
-select c from mysqltest.v1;
-select c from mysqltest.v2;
-select c from mysqltest.v3;
-select c from mysqltest.v4;
---error ER_TABLEACCESS_DENIED_ERROR
-select c from mysqltest.v5;
-# test of show coluns
-show columns from mysqltest.v1;
-show columns from mysqltest.v2;
-# explain/show fail
---error ER_VIEW_NO_EXPLAIN
-explain select c from mysqltest.v1;
---error ER_TABLEACCESS_DENIED_ERROR
-show create view mysqltest.v1;
---error ER_VIEW_NO_EXPLAIN
-explain select c from mysqltest.v2;
---error ER_TABLEACCESS_DENIED_ERROR
-show create view mysqltest.v2;
---error ER_VIEW_NO_EXPLAIN
-explain select c from mysqltest.v3;
---error ER_TABLEACCESS_DENIED_ERROR
-show create view mysqltest.v3;
---error ER_VIEW_NO_EXPLAIN
-explain select c from mysqltest.v4;
---error ER_TABLEACCESS_DENIED_ERROR
-show create view mysqltest.v4;
---error ER_TABLEACCESS_DENIED_ERROR
-explain select c from mysqltest.v5;
-# new in 5.5: SHOW CREATE VIEW needs SELECT now (MySQL Bug#27145)
---error ER_TABLEACCESS_DENIED_ERROR
-show create view mysqltest.v5;
-connection root;
-grant select on mysqltest.v5 to mysqltest_1@localhost;
-connection user1;
-show create view mysqltest.v5;
-
-# missing SELECT on underlying t1, no SHOW VIEW on v1 either.
---error ER_VIEW_NO_EXPLAIN
-explain select c from mysqltest.v1;
-# missing SHOW VIEW
---error ER_TABLEACCESS_DENIED_ERROR
-show create view mysqltest.v1;
-# allow to see one of underlying table
-connection root;
-grant show view on mysqltest.v1 to mysqltest_1@localhost;
-grant select on mysqltest.t1 to mysqltest_1@localhost;
-revoke select on mysqltest.v5 from mysqltest_1@localhost;
-connection user1;
-# EXPLAIN works
-explain select c from mysqltest.v1;
-show create view mysqltest.v1;
-# missing SHOW VIEW
---error ER_VIEW_NO_EXPLAIN
-explain select c from mysqltest.v2;
---error ER_TABLEACCESS_DENIED_ERROR
-show create view mysqltest.v2;
-# but other EXPLAINs do not
---error ER_VIEW_NO_EXPLAIN
-explain select c from mysqltest.v3;
---error ER_TABLEACCESS_DENIED_ERROR
-show create view mysqltest.v3;
---error ER_VIEW_NO_EXPLAIN
-explain select c from mysqltest.v4;
---error ER_TABLEACCESS_DENIED_ERROR
-show create view mysqltest.v4;
-# we have SHOW VIEW on v5, and SELECT on t1 -- not enough
---error ER_TABLEACCESS_DENIED_ERROR
-explain select c from mysqltest.v5;
-
-# allow to see any view in mysqltest database
-connection root;
-grant show view on mysqltest.* to mysqltest_1@localhost;
-connection user1;
-explain select c from mysqltest.v1;
-show create view mysqltest.v1;
-explain select c from mysqltest.v2;
-show create view mysqltest.v2;
-# have SHOW VIEW | SELECT on v3, but no SELECT on t2
---error ER_VIEW_NO_EXPLAIN
-explain select c from mysqltest.v3;
-show create view mysqltest.v3;
-# have SHOW VIEW | SELECT on v4, but no SELECT on t2
---error ER_VIEW_NO_EXPLAIN
-explain select c from mysqltest.v4;
-show create view mysqltest.v4;
-
-connection root;
-revoke all privileges on mysqltest.* from mysqltest_1@localhost;
-drop user mysqltest_1@localhost;
-drop database mysqltest;
-
-#
-# UPDATE privileges on VIEW columns and whole VIEW
-#
-connection root;
---disable_warnings
-create database mysqltest;
---enable_warnings
-
-create table mysqltest.t1 (a int, b int, primary key(a));
-insert into mysqltest.t1 values (10,2), (20,3), (30,4), (40,5), (50,10);
-create table mysqltest.t2 (x int);
-insert into mysqltest.t2 values (3), (4), (5), (6);
-create view mysqltest.v1 (a,c) as select a, b+1 from mysqltest.t1;
-create view mysqltest.v2 (a,c) as select a, b from mysqltest.t1;
-create view mysqltest.v3 (a,c) as select a, b+1 from mysqltest.t1;
-
-create user mysqltest_1@localhost;
-grant update (a) on mysqltest.v2 to mysqltest_1@localhost;
-grant update on mysqltest.v1 to mysqltest_1@localhost;
-grant select on mysqltest.* to mysqltest_1@localhost;
-
-connection user1;
-use mysqltest;
-# update with rights on VIEW column
-update t2,v1 set v1.a=v1.a+v1.c where t2.x=v1.c;
-select * from t1;
-update v1 set a=a+c;
-select * from t1;
-# update with rights on whole VIEW
-update t2,v2 set v2.a=v2.a+v2.c where t2.x=v2.c;
-select * from t1;
-update v2 set a=a+c;
-select * from t1;
-# no rights on column
---error ER_COLUMNACCESS_DENIED_ERROR
-update t2,v2 set v2.c=v2.a+v2.c where t2.x=v2.c;
---error ER_COLUMNACCESS_DENIED_ERROR
-update v2 set c=a+c;
-# no rights for view
---error ER_TABLEACCESS_DENIED_ERROR
-update t2,v3 set v3.a=v3.a+v3.c where t2.x=v3.c;
---error ER_TABLEACCESS_DENIED_ERROR
-update v3 set a=a+c;
-
-use test;
-connection root;
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
-drop user mysqltest_1@localhost;
-drop database mysqltest;
-
-#
-# DELETE privileges on VIEW
-#
-connection root;
---disable_warnings
-create database mysqltest;
---enable_warnings
-
-create table mysqltest.t1 (a int, b int, primary key(a));
-insert into mysqltest.t1 values (1,2), (2,3), (3,4), (4,5), (5,10);
-create table mysqltest.t2 (x int);
-insert into mysqltest.t2 values (3), (4), (5), (6);
-create view mysqltest.v1 (a,c) as select a, b+1 from mysqltest.t1;
-create view mysqltest.v2 (a,c) as select a, b+1 from mysqltest.t1;
-
-create user mysqltest_1@localhost;
-grant delete on mysqltest.v1 to mysqltest_1@localhost;
-grant select on mysqltest.* to mysqltest_1@localhost;
-
-connection user1;
-use mysqltest;
-# update with rights on VIEW column
-delete from v1 where c < 4;
-select * from t1;
-delete v1 from t2,v1 where t2.x=v1.c;
-select * from t1;
-# no rights for view
---error ER_TABLEACCESS_DENIED_ERROR
-delete v2 from t2,v2 where t2.x=v2.c;
---error ER_TABLEACCESS_DENIED_ERROR
-delete from v2 where c < 4;
-
-use test;
-connection root;
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
-drop user mysqltest_1@localhost;
-drop database mysqltest;
-
-#
-# insert privileges on VIEW
-#
-connection root;
---disable_warnings
-create database mysqltest;
---enable_warnings
-
-create table mysqltest.t1 (a int, b int, primary key(a));
-insert into mysqltest.t1 values (1,2), (2,3);
-create table mysqltest.t2 (x int, y int);
-insert into mysqltest.t2 values (3,4);
-create view mysqltest.v1 (a,c) as select a, b from mysqltest.t1;
-create view mysqltest.v2 (a,c) as select a, b from mysqltest.t1;
-
-create user mysqltest_1@localhost;
-grant insert on mysqltest.v1 to mysqltest_1@localhost;
-grant select on mysqltest.* to mysqltest_1@localhost;
-
-connection user1;
-use mysqltest;
-# update with rights on VIEW column
-insert into v1 values (5,6);
-select * from t1;
-insert into v1 select x,y from t2;
-select * from t1;
-# no rights for view
---error ER_TABLEACCESS_DENIED_ERROR
-insert into v2 values (5,6);
---error ER_TABLEACCESS_DENIED_ERROR
-insert into v2 select x,y from t2;
-
-use test;
-connection root;
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
-drop user mysqltest_1@localhost;
-drop database mysqltest;
-
-#
-# test of CREATE VIEW privileges if we have limited privileges
-#
-connection root;
---disable_warnings
-create database mysqltest;
---enable_warnings
-
-create table mysqltest.t1 (a int, b int);
-create table mysqltest.t2 (a int, b int);
-
-create user mysqltest_1@localhost;
-grant update on mysqltest.t1 to mysqltest_1@localhost;
-grant update(b) on mysqltest.t2 to mysqltest_1@localhost;
-grant create view,update on test.* to mysqltest_1@localhost;
-
-connection user1;
-
-create view v1 as select * from mysqltest.t1;
-create view v2 as select b from mysqltest.t2;
-# There are not rights on mysqltest.v1
---error ER_TABLEACCESS_DENIED_ERROR
-create view mysqltest.v1 as select * from mysqltest.t1;
-# There are not any rights on mysqltest.t2.a
---error ER_COLUMNACCESS_DENIED_ERROR
-create view v3 as select a from mysqltest.t2;
-
-# give CREATE VIEW privileges (without any privileges for result column)
-connection root;
-create table mysqltest.v3 (b int);
-grant create view on mysqltest.v3 to mysqltest_1@localhost;
-drop table mysqltest.v3;
-connection user1;
-create view mysqltest.v3 as select b from mysqltest.t2;
-
-# give UPDATE privileges
-connection root;
-grant create view, update on mysqltest.v3 to mysqltest_1@localhost;
-drop view mysqltest.v3;
-connection user1;
-create view mysqltest.v3 as select b from mysqltest.t2;
-
-
-# Expression need select privileges
---error ER_COLUMNACCESS_DENIED_ERROR
-create view v4 as select b+1 from mysqltest.t2;
-
-connection root;
-grant create view,update,select on test.* to mysqltest_1@localhost;
-connection user1;
---error ER_COLUMNACCESS_DENIED_ERROR
-create view v4 as select b+1 from mysqltest.t2;
-
-connection root;
-grant update,select(b) on mysqltest.t2 to mysqltest_1@localhost;
-connection user1;
-create view v4 as select b+1 from mysqltest.t2;
-
-connection root;
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
-drop user mysqltest_1@localhost;
-drop database mysqltest;
-drop view v1,v2,v4;
-
-#
-# user with global DB privileges
-#
-connection root;
---disable_warnings
-create database mysqltest;
---enable_warnings
-create table mysqltest.t1 (a int);
-create user mysqltest_1@localhost;
-grant all privileges on mysqltest.* to mysqltest_1@localhost;
-
-connection user1;
-use mysqltest;
-create view v1 as select * from t1;
-use test;
-
-connection root;
-revoke all privileges on mysqltest.* from mysqltest_1@localhost;
-drop user mysqltest_1@localhost;
-drop database mysqltest;
-
-#
-# view definer grants revoking
-#
-connection root;
---disable_warnings
-create database mysqltest;
---enable_warnings
-
-create table mysqltest.t1 (a int, b int);
-
-create user mysqltest_1@localhost;
-grant select on mysqltest.t1 to mysqltest_1@localhost;
-grant create view,select on test.* to mysqltest_1@localhost;
-
-connection user1;
-
-create view v1 as select * from mysqltest.t1;
-
-connection root;
-# check view definer information
-show create view v1;
-revoke select on mysqltest.t1 from mysqltest_1@localhost;
---error ER_VIEW_INVALID
-select * from v1;
-grant select on mysqltest.t1 to mysqltest_1@localhost;
-select * from v1;
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
-drop user mysqltest_1@localhost;
-drop view v1;
-drop database mysqltest;
-
-#
-# rights on execution of view underlying functiond (Bug#9505)
-#
-connection root;
---disable_warnings
-create database mysqltest;
---enable_warnings
-
-use mysqltest;
-create table t1 (a int);
-insert into t1 values (1);
-create table t2 (s1 int);
---disable_warnings
-drop function if exists f2;
---enable_warnings
-delimiter //;
-create function f2 () returns int begin declare v int; select s1 from t2
-into v; return v; end//
-delimiter ;//
-create algorithm=TEMPTABLE view v1 as select f2() from t1;
-create algorithm=MERGE view v2 as select f2() from t1;
-create algorithm=TEMPTABLE SQL SECURITY INVOKER view v3 as select f2() from t1;
-create algorithm=MERGE SQL SECURITY INVOKER view v4 as select f2() from t1;
-create SQL SECURITY INVOKER view v5 as select * from v4;
-create user mysqltest_1@localhost;
-grant select on v1 to mysqltest_1@localhost;
-grant select on v2 to mysqltest_1@localhost;
-grant select on v3 to mysqltest_1@localhost;
-grant select on v4 to mysqltest_1@localhost;
-grant select on v5 to mysqltest_1@localhost;
-
-connection user1;
-use mysqltest;
-select * from v1;
-select * from v2;
---error ER_VIEW_INVALID
-select * from v3;
---error ER_VIEW_INVALID
-select * from v4;
---error ER_VIEW_INVALID
-select * from v5;
-use test;
-
-connection root;
-drop view v1, v2, v3, v4, v5;
-drop function f2;
-drop table t1, t2;
-use test;
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
-drop user mysqltest_1@localhost;
-drop database mysqltest;
-
-#
-# revertion of previous test, definer of view lost his/her rights to execute
-# function
-#
-
-connection root;
---disable_warnings
-create database mysqltest;
---enable_warnings
-
-use mysqltest;
-create table t1 (a int);
-insert into t1 values (1);
-create table t2 (s1 int);
---disable_warnings
-drop function if exists f2;
---enable_warnings
-delimiter //;
-create function f2 () returns int begin declare v int; select s1 from t2
-into v; return v; end//
-delimiter ;//
-create user mysqltest_1@localhost;
-grant select on t1 to mysqltest_1@localhost;
-grant execute on function f2 to mysqltest_1@localhost;
-grant create view on mysqltest.* to mysqltest_1@localhost;
-
-connection user1;
-use mysqltest;
-create algorithm=TEMPTABLE view v1 as select f2() from t1;
-create algorithm=MERGE view v2 as select f2() from t1;
-create algorithm=TEMPTABLE SQL SECURITY INVOKER view v3 as select f2() from t1;
-create algorithm=MERGE SQL SECURITY INVOKER view v4 as select f2() from t1;
-use test;
-
-connection root;
-create view v5 as select * from v1;
-revoke execute on function f2 from mysqltest_1@localhost;
---error ER_VIEW_INVALID
-select * from v1;
---error ER_VIEW_INVALID
-select * from v2;
-select * from v3;
-select * from v4;
---error ER_VIEW_INVALID
-select * from v5;
-
-drop view v1, v2, v3, v4, v5;
-drop function f2;
-drop table t1, t2;
-use test;
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
-drop user mysqltest_1@localhost;
-drop database mysqltest;
-
-#
-# definer/invoker rights for columns
-#
-connection root;
---disable_warnings
-create database mysqltest;
---enable_warnings
-
-use mysqltest;
-create table t1 (a int);
-create table v1 (a int);
-insert into t1 values (1);
-create user mysqltest_1@localhost;
-grant select on t1 to mysqltest_1@localhost;
-grant select on v1 to mysqltest_1@localhost;
-grant create view on mysqltest.* to mysqltest_1@localhost;
-drop table v1;
-
-connection user1;
-use mysqltest;
-create algorithm=TEMPTABLE view v1 as select *, a as b from t1;
-create algorithm=MERGE view v2 as select *, a as b from t1;
-create algorithm=TEMPTABLE SQL SECURITY INVOKER view v3 as select *, a as b from t1;
-create algorithm=MERGE SQL SECURITY INVOKER view v4 as select *, a as b from t1;
-create view v5 as select * from v1;
-use test;
-
-connection root;
-revoke select on t1 from mysqltest_1@localhost;
---error ER_VIEW_INVALID
-select * from v1;
---error ER_VIEW_INVALID
-select * from v2;
-select * from v3;
-select * from v4;
---error ER_VIEW_INVALID
-select * from v5;
-
-#drop view v1, v2, v3, v4, v5;
-drop table t1;
-use test;
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
-drop user mysqltest_1@localhost;
-drop database mysqltest;
-
-
-connection root;
---disable_warnings
-create database mysqltest;
---enable_warnings
-
-use mysqltest;
-create table t1 (a int);
-insert into t1 values (1);
-create algorithm=TEMPTABLE view v1 as select *, a as b from t1;
-create algorithm=MERGE view v2 as select *, a as b from t1;
-create algorithm=TEMPTABLE SQL SECURITY INVOKER view v3 as select *, a as b from t1;
-create algorithm=MERGE SQL SECURITY INVOKER view v4 as select *, a as b from t1;
-create SQL SECURITY INVOKER view v5 as select * from v4;
-create user mysqltest_1@localhost;
-grant select on v1 to mysqltest_1@localhost;
-grant select on v2 to mysqltest_1@localhost;
-grant select on v3 to mysqltest_1@localhost;
-grant select on v4 to mysqltest_1@localhost;
-grant select on v5 to mysqltest_1@localhost;
-
-connection user1;
-use mysqltest;
-select * from v1;
-select * from v2;
---error ER_VIEW_INVALID
-select * from v3;
---error ER_VIEW_INVALID
-select * from v4;
---error ER_VIEW_INVALID
-select * from v5;
-use test;
-
-connection root;
-drop view v1, v2, v3, v4, v5;
-drop table t1;
-use test;
-REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
-drop user mysqltest_1@localhost;
-drop database mysqltest;
-
-#
-# Bug#14256 definer in view definition is not fully qualified
-#
---disable_warnings
-drop view if exists v1;
-drop table if exists t1;
---enable_warnings
-
-# Backup anonymous users and remove them. (They get in the way of
-# the one we test with here otherwise.)
-create table t1 as select * from mysql.user where user='';
-delete from mysql.user where user='';
-flush privileges;
-
-# Create the test user
-create user 'test14256'@'%';
-grant all on test.* to 'test14256'@'%';
-
-connect (test14256,localhost,test14256,,test);
-connection test14256;
-use test;
-
-create view v1 as select 42;
-show create view v1;
-
-select definer into @v1def1 from information_schema.views
- where table_schema = 'test' and table_name='v1';
-drop view v1;
-
-create definer=`test14256`@`%` view v1 as select 42;
-show create view v1;
-
-select definer into @v1def2 from information_schema.views
- where table_schema = 'test' and table_name='v1';
-drop view v1;
-
-select @v1def1, @v1def2, @v1def1=@v1def2;
-
-connection root;
-disconnect test14256;
-drop user test14256;
-
-# Restore the anonymous users.
-insert into mysql.user select * from t1;
-flush privileges;
-
-drop table t1;
-
-#
-# Bug#14726 freeing stack variable in case of an error of opening a view when
-# we have locked tables with LOCK TABLES statement.
-#
-connection root;
---disable_warnings
-create database mysqltest;
---enable_warnings
-
-use mysqltest;
-CREATE TABLE t1 (i INT);
-CREATE VIEW v1 AS SELECT * FROM t1;
-SHOW CREATE VIEW v1;
-create user mysqltest_1@localhost;
-GRANT SELECT, LOCK TABLES ON mysqltest.* TO mysqltest_1@localhost;
-
-connection user1;
-
-use mysqltest;
-LOCK TABLES v1 READ;
---error ER_TABLEACCESS_DENIED_ERROR
-SHOW CREATE TABLE v1;
-UNLOCK TABLES;
-use test;
-
-connection root;
-use test;
-drop user mysqltest_1@localhost;
-drop database mysqltest;
-
-#
-# switch to default connection
-#
-disconnect user1;
-disconnect root;
-connection default;
-
-#
-# DEFINER information check
-#
-create definer=some_user@`` sql security invoker view v1 as select 1;
-create definer=some_user@localhost sql security invoker view v2 as select 1;
-show create view v1;
-show create view v2;
-drop view v1;
-drop view v2;
-
-#
-# Bug#18681 View privileges are broken
-#
-CREATE DATABASE mysqltest1;
-CREATE USER readonly@localhost;
-CREATE TABLE mysqltest1.t1 (x INT);
-INSERT INTO mysqltest1.t1 VALUES (1), (2);
-CREATE SQL SECURITY INVOKER VIEW mysqltest1.v_t1 AS SELECT * FROM mysqltest1.t1;
-CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_ts AS SELECT * FROM mysqltest1.t1;
-CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_ti AS SELECT * FROM mysqltest1.t1;
-CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_tu AS SELECT * FROM mysqltest1.t1;
-CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_tus AS SELECT * FROM mysqltest1.t1;
-CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_td AS SELECT * FROM mysqltest1.t1;
-CREATE SQL SECURITY DEFINER VIEW mysqltest1.v_tds AS SELECT * FROM mysqltest1.t1;
-GRANT SELECT, INSERT, UPDATE, DELETE ON mysqltest1.v_t1 TO readonly@localhost;
-GRANT SELECT ON mysqltest1.v_ts TO readonly@localhost;
-GRANT INSERT ON mysqltest1.v_ti TO readonly@localhost;
-GRANT UPDATE ON mysqltest1.v_tu TO readonly@localhost;
-GRANT UPDATE,SELECT ON mysqltest1.v_tus TO readonly@localhost;
-GRANT DELETE ON mysqltest1.v_td TO readonly@localhost;
-GRANT DELETE,SELECT ON mysqltest1.v_tds TO readonly@localhost;
-
-connect (n1,localhost,readonly,,);
-connection n1;
-
---error ER_VIEW_INVALID
-SELECT * FROM mysqltest1.v_t1;
---error ER_VIEW_INVALID
-INSERT INTO mysqltest1.v_t1 VALUES(4);
---error ER_VIEW_INVALID
-DELETE FROM mysqltest1.v_t1 WHERE x = 1;
---error ER_VIEW_INVALID
-UPDATE mysqltest1.v_t1 SET x = 3 WHERE x = 2;
---error ER_VIEW_INVALID
-UPDATE mysqltest1.v_t1 SET x = 3;
---error ER_VIEW_INVALID
-DELETE FROM mysqltest1.v_t1;
---error ER_VIEW_INVALID
-SELECT 1 FROM mysqltest1.v_t1;
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM mysqltest1.t1;
-
-SELECT * FROM mysqltest1.v_ts;
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM mysqltest1.v_ts, mysqltest1.t1 WHERE mysqltest1.t1.x = mysqltest1.v_ts.x;
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM mysqltest1.v_ti;
-
---error ER_TABLEACCESS_DENIED_ERROR
-INSERT INTO mysqltest1.v_ts VALUES (100);
-INSERT INTO mysqltest1.v_ti VALUES (100);
-
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE mysqltest1.v_ts SET x= 200 WHERE x = 100;
---error ER_TABLEACCESS_DENIED_ERROR
-UPDATE mysqltest1.v_ts SET x= 200;
-UPDATE mysqltest1.v_tu SET x= 200 WHERE x = 100;
-UPDATE mysqltest1.v_tus SET x= 200 WHERE x = 100;
-UPDATE mysqltest1.v_tu SET x= 200;
-
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM mysqltest1.v_ts WHERE x= 200;
---error ER_TABLEACCESS_DENIED_ERROR
-DELETE FROM mysqltest1.v_ts;
---error ER_COLUMNACCESS_DENIED_ERROR
-DELETE FROM mysqltest1.v_td WHERE x= 200;
-DELETE FROM mysqltest1.v_tds WHERE x= 200;
-DELETE FROM mysqltest1.v_td;
-
-connection default;
-disconnect n1;
-DROP VIEW mysqltest1.v_tds;
-DROP VIEW mysqltest1.v_td;
-DROP VIEW mysqltest1.v_tus;
-DROP VIEW mysqltest1.v_tu;
-DROP VIEW mysqltest1.v_ti;
-DROP VIEW mysqltest1.v_ts;
-DROP VIEW mysqltest1.v_t1;
-DROP TABLE mysqltest1.t1;
-DROP USER readonly@localhost;
-DROP DATABASE mysqltest1;
-
-#
-# Bug#14875 Bad view DEFINER makes SHOW CREATE VIEW fail
-#
-CREATE TABLE t1 (a INT PRIMARY KEY);
-INSERT INTO t1 VALUES (1), (2), (3);
-CREATE DEFINER = 'no-such-user'@localhost VIEW v AS SELECT a from t1;
-#--warning ER_VIEW_OTHER_USER
-SHOW CREATE VIEW v;
---error ER_NO_SUCH_USER
-SELECT * FROM v;
-DROP VIEW v;
-DROP TABLE t1;
-USE test;
-
-#
-# Bug#20363 Create view on just created view is now denied
-#
-eval CREATE USER mysqltest_db1@localhost identified by 'PWD';
-eval GRANT ALL ON mysqltest_db1.* TO mysqltest_db1@localhost WITH GRANT OPTION;
-
-# The session with the non root user is needed.
---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
-connect (session1,localhost,mysqltest_db1,PWD,test);
-
-CREATE SCHEMA mysqltest_db1 ;
-USE mysqltest_db1 ;
-
-CREATE TABLE t1 (f1 INTEGER);
-
-CREATE VIEW view1 AS
-SELECT * FROM t1;
-SHOW CREATE VIEW view1;
-
-CREATE VIEW view2 AS
-SELECT * FROM view1;
---echo # Here comes a suspicious warning
-SHOW CREATE VIEW view2;
---echo # But the view view2 is usable
-SELECT * FROM view2;
-
-CREATE VIEW view3 AS
-SELECT * FROM view2;
-
-SELECT * from view3;
-
-connection default;
-disconnect session1;
-DROP VIEW mysqltest_db1.view3;
-DROP VIEW mysqltest_db1.view2;
-DROP VIEW mysqltest_db1.view1;
-DROP TABLE mysqltest_db1.t1;
-DROP SCHEMA mysqltest_db1;
-DROP USER mysqltest_db1@localhost;
-#
-# Bug#20482 failure on Create join view with sources views/tables
-# in different schemas
-#
---disable_warnings
-CREATE DATABASE test1;
-CREATE DATABASE test2;
---enable_warnings
-
-CREATE TABLE test1.t0 (a VARCHAR(20));
-CREATE TABLE test2.t1 (a VARCHAR(20));
-CREATE VIEW test2.t3 AS SELECT * FROM test1.t0;
-CREATE OR REPLACE VIEW test.v1 AS
- SELECT ta.a AS col1, tb.a AS col2 FROM test2.t3 ta, test2.t1 tb;
-
-DROP VIEW test.v1;
-DROP VIEW test2.t3;
-DROP TABLE test2.t1, test1.t0;
-DROP DATABASE test2;
-DROP DATABASE test1;
-
-
-#
-# Bug#20570 CURRENT_USER() in a VIEW with SQL SECURITY DEFINER returns
-# invoker name
-#
---disable_warnings
-DROP VIEW IF EXISTS v1;
-DROP VIEW IF EXISTS v2;
-DROP VIEW IF EXISTS v3;
-DROP FUNCTION IF EXISTS f1;
-DROP FUNCTION IF EXISTS f2;
-DROP PROCEDURE IF EXISTS p1;
---enable_warnings
-
-CREATE SQL SECURITY DEFINER VIEW v1 AS SELECT CURRENT_USER() AS cu;
-
-CREATE FUNCTION f1() RETURNS VARCHAR(77) SQL SECURITY INVOKER
- RETURN CURRENT_USER();
-CREATE SQL SECURITY DEFINER VIEW v2 AS SELECT f1() AS cu;
-
-CREATE PROCEDURE p1(OUT cu VARCHAR(77)) SQL SECURITY INVOKER
- SET cu= CURRENT_USER();
-delimiter |;
-CREATE FUNCTION f2() RETURNS VARCHAR(77) SQL SECURITY INVOKER
-BEGIN
- DECLARE cu VARCHAR(77);
- CALL p1(cu);
- RETURN cu;
-END|
-delimiter ;|
-CREATE SQL SECURITY DEFINER VIEW v3 AS SELECT f2() AS cu;
-
-CREATE USER mysqltest_u1@localhost;
-GRANT ALL ON test.* TO mysqltest_u1@localhost;
-
-connect (conn1, localhost, mysqltest_u1,,);
-
---echo
---echo The following tests should all return 1.
---echo
-SELECT CURRENT_USER() = 'mysqltest_u1@localhost';
-SELECT f1() = 'mysqltest_u1@localhost';
-CALL p1(@cu);
-SELECT @cu = 'mysqltest_u1@localhost';
-SELECT f2() = 'mysqltest_u1@localhost';
-SELECT cu = 'root@localhost' FROM v1;
-SELECT cu = 'root@localhost' FROM v2;
-SELECT cu = 'root@localhost' FROM v3;
-
-disconnect conn1;
-connection default;
-
-DROP VIEW v3;
-DROP FUNCTION f2;
-DROP PROCEDURE p1;
-DROP FUNCTION f1;
-DROP VIEW v2;
-DROP VIEW v1;
-DROP USER mysqltest_u1@localhost;
-
-
-#
-# Bug#17254 Error for DEFINER security on VIEW provides too much info
-#
-connect (root,localhost,root,,);
-connection root;
-CREATE DATABASE db17254;
-USE db17254;
-CREATE TABLE t1 (f1 INT);
-INSERT INTO t1 VALUES (10),(20);
-CREATE USER def_17254@localhost;
-GRANT SELECT ON db17254.* TO def_17254@localhost;
-CREATE USER inv_17254@localhost;
-GRANT SELECT ON db17254.t1 TO inv_17254@localhost;
-GRANT CREATE VIEW ON db17254.* TO def_17254@localhost;
-
-connect (def,localhost,def_17254,,db17254);
-connection def;
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-connection root;
-DROP USER def_17254@localhost;
-
-connect (inv,localhost,inv_17254,,db17254);
-connection inv;
---echo for a user
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v1;
-
-connection root;
---echo for a superuser
---error ER_NO_SUCH_USER
-SELECT * FROM v1;
-DROP USER inv_17254@localhost;
-DROP DATABASE db17254;
-disconnect def;
-disconnect inv;
-
-
-#
-# Bug#24404 strange bug with view+permission+prepared statement
-#
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest_db1;
-DROP DATABASE IF EXISTS mysqltest_db2;
---enable_warnings
---error 0,ER_CANNOT_USER
-DROP USER mysqltest_u1;
---error 0,ER_CANNOT_USER
-DROP USER mysqltest_u2;
-
-CREATE USER mysqltest_u1@localhost;
-CREATE USER mysqltest_u2@localhost;
-
-CREATE DATABASE mysqltest_db1;
-CREATE DATABASE mysqltest_db2;
-
-GRANT ALL ON mysqltest_db1.* TO mysqltest_u1@localhost WITH GRANT OPTION;
-GRANT ALL ON mysqltest_db2.* TO mysqltest_u2@localhost;
-
-connect (conn1, localhost, mysqltest_u1, , mysqltest_db1);
-
-CREATE TABLE t1 (i INT);
-INSERT INTO t1 VALUES (1);
-
-# Use view with subquery for better coverage.
-CREATE VIEW v1 AS SELECT i FROM t1 WHERE 1 IN (SELECT * FROM t1);
-
-CREATE TABLE t2 (s CHAR(7));
-INSERT INTO t2 VALUES ('public');
-
-GRANT SELECT ON v1 TO mysqltest_u2@localhost;
-GRANT SELECT ON t2 TO mysqltest_u2@localhost;
-
-connect (conn2, localhost, mysqltest_u2, , mysqltest_db2);
-
-SELECT * FROM mysqltest_db1.v1, mysqltest_db1.t2;
-PREPARE stmt1 FROM "SELECT * FROM mysqltest_db1.t2";
-EXECUTE stmt1;
-PREPARE stmt2 FROM "SELECT * FROM mysqltest_db1.v1, mysqltest_db1.t2";
-EXECUTE stmt2;
-
-connection conn1;
-# Make table 't2' private.
-REVOKE SELECT ON t2 FROM mysqltest_u2@localhost;
-UPDATE t2 SET s = 'private' WHERE s = 'public';
-
-connection conn2;
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM mysqltest_db1.v1, mysqltest_db1.t2;
---error ER_TABLEACCESS_DENIED_ERROR
-EXECUTE stmt1;
-# Original bug was here: the statement didn't fail.
---error ER_TABLEACCESS_DENIED_ERROR
-EXECUTE stmt2;
-
-# Cleanup.
-disconnect conn2;
-disconnect conn1;
-connection default;
-REVOKE ALL ON mysqltest_db1.* FROM mysqltest_u1@localhost;
-REVOKE ALL ON mysqltest_db2.* FROM mysqltest_u2@localhost;
-DROP DATABASE mysqltest_db1;
-DROP DATABASE mysqltest_db2;
-DROP USER mysqltest_u1@localhost;
-DROP USER mysqltest_u2@localhost;
-
-#
-# Bug#26813 The SUPER privilege is wrongly required to alter a view created
-# by another user.
-#
-connection root;
-CREATE DATABASE db26813;
-USE db26813;
-CREATE TABLE t1(f1 INT, f2 INT);
-CREATE VIEW v1 AS SELECT f1 FROM t1;
-CREATE VIEW v2 AS SELECT f1 FROM t1;
-CREATE VIEW v3 AS SELECT f1 FROM t1;
-CREATE USER u26813@localhost;
-GRANT DROP ON db26813.v1 TO u26813@localhost;
-GRANT CREATE VIEW ON db26813.v2 TO u26813@localhost;
-GRANT DROP, CREATE VIEW ON db26813.v3 TO u26813@localhost;
-GRANT SELECT ON db26813.t1 TO u26813@localhost;
-
-connect (u1,localhost,u26813,,db26813);
-connection u1;
---error ER_TABLEACCESS_DENIED_ERROR
-ALTER VIEW v1 AS SELECT f2 FROM t1;
---error ER_TABLEACCESS_DENIED_ERROR
-ALTER VIEW v2 AS SELECT f2 FROM t1;
---error ER_SPECIFIC_ACCESS_DENIED_ERROR
-ALTER VIEW v3 AS SELECT f2 FROM t1;
-
-connection root;
-SHOW CREATE VIEW v3;
-
-DROP USER u26813@localhost;
-DROP DATABASE db26813;
-disconnect u1;
-
---echo #
---echo # Bug#29908 A user can gain additional access through the ALTER VIEW.
---echo #
-connection root;
-CREATE DATABASE mysqltest_29908;
-USE mysqltest_29908;
-CREATE TABLE t1(f1 INT, f2 INT);
-CREATE USER u29908_1@localhost;
-CREATE DEFINER = u29908_1@localhost VIEW v1 AS SELECT f1 FROM t1;
-CREATE DEFINER = u29908_1@localhost SQL SECURITY INVOKER VIEW v2 AS
- SELECT f1 FROM t1;
-GRANT SELECT, DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v1 TO u29908_1@localhost;
-GRANT SELECT, DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v2 TO u29908_1@localhost;
-GRANT SELECT ON mysqltest_29908.t1 TO u29908_1@localhost;
-CREATE USER u29908_2@localhost;
-GRANT SELECT, DROP, CREATE VIEW ON mysqltest_29908.v1 TO u29908_2@localhost;
-GRANT SELECT, DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v2 TO u29908_2@localhost;
-GRANT SELECT ON mysqltest_29908.t1 TO u29908_2@localhost;
-
-connect (u2,localhost,u29908_2,,mysqltest_29908);
---error ER_SPECIFIC_ACCESS_DENIED_ERROR
-ALTER VIEW v1 AS SELECT f2 FROM t1;
---error ER_SPECIFIC_ACCESS_DENIED_ERROR
-ALTER VIEW v2 AS SELECT f2 FROM t1;
-SHOW CREATE VIEW v2;
-
-connect (u1,localhost,u29908_1,,mysqltest_29908);
-ALTER VIEW v1 AS SELECT f2 FROM t1;
-SHOW CREATE VIEW v1;
-ALTER VIEW v2 AS SELECT f2 FROM t1;
-SHOW CREATE VIEW v2;
-
-connection root;
-ALTER VIEW v1 AS SELECT f1 FROM t1;
-SHOW CREATE VIEW v1;
-ALTER VIEW v2 AS SELECT f1 FROM t1;
-SHOW CREATE VIEW v2;
-
-DROP USER u29908_1@localhost;
-DROP USER u29908_2@localhost;
-DROP DATABASE mysqltest_29908;
-disconnect u1;
-disconnect u2;
---echo #######################################################################
-
-#
-# Bug#24040 Create View don't succed with "all privileges" on a database.
-#
-
-# Prepare.
-
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest1;
-DROP DATABASE IF EXISTS mysqltest2;
---enable_warnings
-
-CREATE DATABASE mysqltest1;
-CREATE DATABASE mysqltest2;
-
-# Test.
-
-CREATE TABLE mysqltest1.t1(c1 INT);
-CREATE TABLE mysqltest1.t2(c2 INT);
-CREATE TABLE mysqltest1.t3(c3 INT);
-CREATE TABLE mysqltest1.t4(c4 INT);
-
-INSERT INTO mysqltest1.t1 VALUES (11), (12), (13), (14);
-INSERT INTO mysqltest1.t2 VALUES (21), (22), (23), (24);
-INSERT INTO mysqltest1.t3 VALUES (31), (32), (33), (34);
-INSERT INTO mysqltest1.t4 VALUES (41), (42), (43), (44);
-
-CREATE USER mysqltest_u1@localhost;
-GRANT SELECT ON mysqltest1.t1 TO mysqltest_u1@localhost;
-GRANT INSERT ON mysqltest1.t2 TO mysqltest_u1@localhost;
-GRANT SELECT, UPDATE ON mysqltest1.t3 TO mysqltest_u1@localhost;
-GRANT SELECT, DELETE ON mysqltest1.t4 TO mysqltest_u1@localhost;
-
-GRANT ALL PRIVILEGES ON mysqltest2.* TO mysqltest_u1@localhost;
-
---connect (bug24040_con,localhost,mysqltest_u1,,mysqltest2)
-
-SELECT * FROM mysqltest1.t1;
-INSERT INTO mysqltest1.t2 VALUES(25);
-UPDATE mysqltest1.t3 SET c3 = 331 WHERE c3 = 31;
-DELETE FROM mysqltest1.t4 WHERE c4 = 44;
-
-CREATE VIEW v1 AS SELECT * FROM mysqltest1.t1;
-CREATE VIEW v2 AS SELECT * FROM mysqltest1.t2;
-CREATE VIEW v3 AS SELECT * FROM mysqltest1.t3;
-CREATE VIEW v4 AS SELECT * FROM mysqltest1.t4;
-
-SELECT * FROM v1;
-INSERT INTO v2 VALUES(26);
-UPDATE v3 SET c3 = 332 WHERE c3 = 32;
-DELETE FROM v4 WHERE c4 = 43;
-
---error ER_COLUMNACCESS_DENIED_ERROR
-CREATE VIEW v12 AS SELECT c1, c2 FROM mysqltest1.t1, mysqltest1.t2;
-CREATE VIEW v13 AS SELECT c1, c3 FROM mysqltest1.t1, mysqltest1.t3;
-CREATE VIEW v14 AS SELECT c1, c4 FROM mysqltest1.t1, mysqltest1.t4;
-
---error ER_COLUMNACCESS_DENIED_ERROR
-CREATE VIEW v21 AS SELECT c2, c1 FROM mysqltest1.t2, mysqltest1.t1;
---error ER_COLUMNACCESS_DENIED_ERROR
-CREATE VIEW v23 AS SELECT c2, c3 FROM mysqltest1.t2, mysqltest1.t3;
---error ER_COLUMNACCESS_DENIED_ERROR
-CREATE VIEW v24 AS SELECT c2, c4 FROM mysqltest1.t2, mysqltest1.t4;
-
-CREATE VIEW v31 AS SELECT c3, c1 FROM mysqltest1.t3, mysqltest1.t1;
---error ER_COLUMNACCESS_DENIED_ERROR
-CREATE VIEW v32 AS SELECT c3, c2 FROM mysqltest1.t3, mysqltest1.t2;
-CREATE VIEW v34 AS SELECT c3, c4 FROM mysqltest1.t3, mysqltest1.t4;
-
-CREATE VIEW v41 AS SELECT c4, c1 FROM mysqltest1.t4, mysqltest1.t1;
---error ER_COLUMNACCESS_DENIED_ERROR
-CREATE VIEW v42 AS SELECT c4, c2 FROM mysqltest1.t4, mysqltest1.t2;
-CREATE VIEW v43 AS SELECT c4, c3 FROM mysqltest1.t4, mysqltest1.t3;
-
---connection default
-
-SELECT * FROM mysqltest1.t1;
-SELECT * FROM mysqltest1.t2;
-SELECT * FROM mysqltest1.t3;
-SELECT * FROM mysqltest1.t4;
-
-# Cleanup.
-
-disconnect bug24040_con;
-
-DROP DATABASE mysqltest1;
-DROP DATABASE mysqltest2;
-DROP USER mysqltest_u1@localhost;
-
-
-#
-# Bug#41354 Access control is bypassed when all columns of a view are
-# selected by * wildcard
-
-CREATE DATABASE db1;
-USE db1;
-CREATE TABLE t1(f1 INT, f2 INT);
-CREATE VIEW v1 AS SELECT f1, f2 FROM t1;
-
-CREATE USER foo;
-GRANT SELECT (f1) ON t1 TO foo;
-GRANT SELECT (f1) ON v1 TO foo;
-
-connect (addconfoo, localhost, foo,,);
-connection addconfoo;
-USE db1;
-
-SELECT f1 FROM t1;
---error ER_COLUMNACCESS_DENIED_ERROR
-SELECT f2 FROM t1;
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM t1;
-
-SELECT f1 FROM v1;
---error ER_COLUMNACCESS_DENIED_ERROR
-SELECT f2 FROM v1;
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v1;
-
-connection default;
-disconnect root;
-disconnect addconfoo;
-USE test;
-REVOKE SELECT (f1) ON db1.t1 FROM foo;
-REVOKE SELECT (f1) ON db1.v1 FROM foo;
-DROP USER foo;
-DROP VIEW db1.v1;
-DROP TABLE db1.t1;
-DROP DATABASE db1;
-
-connection default;
-
-
---echo Bug #11765687/#58677:
---echo No privilege on table/view, but can know #rows / underlying table's name
-
-# As a root-like user
-connect (root,localhost,root,,test);
-connection root;
-
-create database mysqltest1;
-create table mysqltest1.t1 (i int);
-create table mysqltest1.t2 (j int);
-create table mysqltest1.t3 (k int, secret int);
-
-create user alice@localhost;
-create user bob@localhost;
-create user cecil@localhost;
-create user dan@localhost;
-create user eugene@localhost;
-create user fiona@localhost;
-create user greg@localhost;
-create user han@localhost;
-create user inga@localhost;
-create user jamie@localhost;
-create user karl@localhost;
-create user lena@localhost;
-create user mhairi@localhost;
-create user noam@localhost;
-create user olga@localhost;
-create user pjotr@localhost;
-create user quintessa@localhost;
-
-grant all privileges on mysqltest1.* to alice@localhost with grant option;
-
-#
---echo ... as alice
-connect (test11765687,localhost,alice,,mysqltest1);
-connection test11765687;
-
-create view v1 as select * from t1;
-create view v2 as select * from v1, t2;
-create view v3 as select k from t3;
-
-grant select on mysqltest1.v1 to bob@localhost;
-
-grant show view on mysqltest1.v1 to cecil@localhost;
-
-grant select, show view on mysqltest1.v1 to dan@localhost;
-grant select on mysqltest1.t1 to dan@localhost;
-
-grant select on mysqltest1.* to eugene@localhost;
-
-grant select, show view on mysqltest1.v2 to fiona@localhost;
-
-grant select, show view on mysqltest1.v2 to greg@localhost;
-grant show view on mysqltest1.v1 to greg@localhost;
-
-grant select(k) on mysqltest1.t3 to han@localhost;
-grant select, show view on mysqltest1.v3 to han@localhost;
-
-grant select on mysqltest1.t1 to inga@localhost;
-grant select on mysqltest1.t2 to inga@localhost;
-grant select on mysqltest1.v1 to inga@localhost;
-grant select, show view on mysqltest1.v2 to inga@localhost;
-
-grant select on mysqltest1.t1 to jamie@localhost;
-grant select on mysqltest1.t2 to jamie@localhost;
-grant show view on mysqltest1.v1 to jamie@localhost;
-grant select, show view on mysqltest1.v2 to jamie@localhost;
-
-grant select on mysqltest1.t1 to karl@localhost;
-grant select on mysqltest1.t2 to karl@localhost;
-grant select, show view on mysqltest1.v1 to karl@localhost;
-grant select on mysqltest1.v2 to karl@localhost;
-
-grant select on mysqltest1.t1 to lena@localhost;
-grant select on mysqltest1.t2 to lena@localhost;
-grant select, show view on mysqltest1.v1 to lena@localhost;
-grant show view on mysqltest1.v2 to lena@localhost;
-
-grant select on mysqltest1.t1 to mhairi@localhost;
-grant select on mysqltest1.t2 to mhairi@localhost;
-grant select, show view on mysqltest1.v1 to mhairi@localhost;
-grant select, show view on mysqltest1.v2 to mhairi@localhost;
-
-grant select on mysqltest1.t1 to noam@localhost;
-grant select, show view on mysqltest1.v1 to noam@localhost;
-grant select, show view on mysqltest1.v2 to noam@localhost;
-
-grant select on mysqltest1.t2 to olga@localhost;
-grant select, show view on mysqltest1.v1 to olga@localhost;
-grant select, show view on mysqltest1.v2 to olga@localhost;
-
-grant select on mysqltest1.t1 to pjotr@localhost;
-grant select on mysqltest1.t2 to pjotr@localhost;
-grant select, show view on mysqltest1.v2 to pjotr@localhost;
-
-grant select, show view on mysqltest1.v1 to quintessa@localhost;
-
-disconnect test11765687;
-
-#
---echo ... as bob
-connect (test11765687,localhost,bob,,mysqltest1);
-connection test11765687;
-
-select * from v1; # Should succeed.
---error ER_VIEW_NO_EXPLAIN
-explain select * from v1; # fail, no SHOW_VIEW
-
-disconnect test11765687;
-
-#
---echo ... as cecil
-connect (test11765687,localhost,cecil,,mysqltest1);
-connection test11765687;
-
---error ER_TABLEACCESS_DENIED_ERROR
-select * from v1; # fail, no SELECT
---error ER_TABLEACCESS_DENIED_ERROR
-explain select * from v1; # fail, no SELECT
-
-disconnect test11765687;
-
-#
---echo ... as dan
-connect (test11765687,localhost,dan,,mysqltest1);
-connection test11765687;
-
-select * from v1; # Should succeed.
-explain select * from v1; # Should succeed.
-
-disconnect test11765687;
-
-#
---echo ... as eugene
-connect (test11765687,localhost,eugene,,mysqltest1);
-connection test11765687;
-
-select * from v1; # Should succeed.
---error ER_VIEW_NO_EXPLAIN
-explain select * from v1; # fail, no SHOW_VIEW
-
-disconnect test11765687;
-
-#
---echo ... as fiona
-connect (test11765687,localhost,fiona,,mysqltest1);
-connection test11765687;
-
-select * from v2; # Should succeed.
-show create view v2; # Should succeed, but...
---error ER_TABLEACCESS_DENIED_ERROR
-explain select * from t1; # fail, shouldn't see t1!
---error ER_TABLEACCESS_DENIED_ERROR
-# err msg must give view name, no table names!!
-explain select * from v1; # fail, have no privs on v1!
---error ER_TABLEACCESS_DENIED_ERROR
-explain select * from t2; # fail, have no privs on t2!
---error ER_VIEW_NO_EXPLAIN
-explain select * from v2; # fail, shouldn't see t2!
-
-disconnect test11765687;
-
-#
---echo ... as greg
-connect (test11765687,localhost,greg,,mysqltest1);
-connection test11765687;
-
-select * from v2; # Should succeed.
---error ER_TABLEACCESS_DENIED_ERROR
-explain select * from v1; # fail; no SELECT on v1!
---error ER_VIEW_NO_EXPLAIN
-explain select * from v2; # fail; no SELECT on v1!
-
-disconnect test11765687;
-
-#
---echo ... as han
-connect (test11765687,localhost,han,,mysqltest1);
-connection test11765687;
-
---error ER_TABLEACCESS_DENIED_ERROR
-select * from t3; # don't have privs on all columns,
---error ER_TABLEACCESS_DENIED_ERROR
-explain select * from t3; # so EXPLAIN on "forbidden" columns should fail.
-select k from t3; # but we do have SELECT on column k though,
-explain select k from t3; # so EXPLAIN just on k should work,
-select * from v3; # and so should SELECT on view only using allowed columns
-explain select * from v3; # as should the associated EXPLAIN
-
-disconnect test11765687;
-
-#
---echo ... as inga
-connect (test11765687,localhost,inga,,mysqltest1);
-connection test11765687;
-
-select * from v2;
-# has sel/show on v2, sel on t1/t2, only sel v1
-# fail: lacks show on v1
---error ER_VIEW_NO_EXPLAIN
-explain select * from v2;
-disconnect test11765687;
-
-#
---echo ... as jamie
-connect (test11765687,localhost,jamie,,mysqltest1);
-connection test11765687;
-
-select * from v2;
-# has sel/show on v2, sel on t1/t2, only show v1
-# fail: lacks sel on v1
---error ER_VIEW_NO_EXPLAIN
-explain select * from v2;
-disconnect test11765687;
-
-#
---echo ... as karl
-connect (test11765687,localhost,karl,,mysqltest1);
-connection test11765687;
-
-select * from v2;
-# has sel only on v2, sel on t1/t2, sel/show v1
-# fail: lacks show on v2
---error ER_VIEW_NO_EXPLAIN
-explain select * from v2;
-disconnect test11765687;
-
-#
---echo ... as lena
-
-connect (test11765687,localhost,lena,,mysqltest1);
-connection test11765687;
---error ER_TABLEACCESS_DENIED_ERROR
-select * from v2;
-# has show only on v2, sel on t1/t2, sel/show v1
-# fail: lacks sel on v2
---error ER_TABLEACCESS_DENIED_ERROR
-explain select * from v2;
-disconnect test11765687;
-
-#
---echo ... as mhairi
-connect (test11765687,localhost,mhairi,,mysqltest1);
-connection test11765687;
-
-select * from v2;
-# has sel/show on v2, sel on t1/t2, sel/show v1
-explain select * from v2;
-disconnect test11765687;
-
-#
---echo ... as noam
-connect (test11765687,localhost,noam,,mysqltest1);
-connection test11765687;
-
-select * from v2;
-# has sel/show on v2, sel only on t1, sel/show v1 (no sel on t2!)
---error ER_VIEW_NO_EXPLAIN
-explain select * from v2;
-disconnect test11765687;
-
-#
---echo ... as olga
-connect (test11765687,localhost,olga,,mysqltest1);
-connection test11765687;
-
-select * from v2;
-# has sel/show on v2, sel only on t2, sel/show v1 (no sel on t1!)
---error ER_VIEW_NO_EXPLAIN
-explain select * from v2;
-disconnect test11765687;
-
-#
---echo ... as pjotr
-connect (test11765687,localhost,pjotr,,mysqltest1);
-connection test11765687;
-
-select * from v2;
-# has sel/show on v2, sel only on t2, nothing on v1
-# fail: lacks show on v1
---error ER_VIEW_NO_EXPLAIN
-explain select * from v2;
-disconnect test11765687;
-
-#
---echo ... as quintessa
-connect (test11765687,localhost,quintessa,,mysqltest1);
-connection test11765687;
-
-select * from v1; # Should succeed.
---error ER_VIEW_NO_EXPLAIN
-explain select * from v1; # fail: lacks select on t1
-
-disconnect test11765687;
-
-# cleanup
-
-#
---echo ... as root again at last: clean-up time!
-connection root;
-
-drop user alice@localhost;
-drop user bob@localhost;
-drop user cecil@localhost;
-drop user dan@localhost;
-drop user eugene@localhost;
-drop user fiona@localhost;
-drop user greg@localhost;
-drop user han@localhost;
-drop user inga@localhost;
-drop user jamie@localhost;
-drop user karl@localhost;
-drop user lena@localhost;
-drop user mhairi@localhost;
-drop user noam@localhost;
-drop user olga@localhost;
-drop user pjotr@localhost;
-drop user quintessa@localhost;
-
-drop database mysqltest1;
-
-disconnect root;
-
-connection default;
-
-#
-# MDEV-4951 drop user leaves privileges
-#
-#verify that no privileges were left after the above
-select * from information_schema.table_privileges;
-
---echo End of 5.0 tests.
-
-
-#
-# Test that ALTER VIEW accepts DEFINER and ALGORITHM, see bug#16425.
-#
-connection default;
---disable_warnings
-DROP VIEW IF EXISTS v1;
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (i INT);
-CREATE VIEW v1 AS SELECT * FROM t1;
-
-ALTER VIEW v1 AS SELECT * FROM t1;
-SHOW CREATE VIEW v1;
-ALTER DEFINER=no_such@user_1 VIEW v1 AS SELECT * FROM t1;
-SHOW CREATE VIEW v1;
-ALTER ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
-SHOW CREATE VIEW v1;
-ALTER ALGORITHM=TEMPTABLE DEFINER=no_such@user_2 VIEW v1 AS SELECT * FROM t1;
-SHOW CREATE VIEW v1;
-
-DROP VIEW v1;
-DROP TABLE t1;
-
-#
-# Bug#37191: Failed assertion in CREATE VIEW
-#
-CREATE USER mysqluser1@localhost;
-CREATE DATABASE mysqltest1;
-
-USE mysqltest1;
-
-CREATE TABLE t1 ( a INT );
-CREATE TABLE t2 ( b INT );
-
-INSERT INTO t1 VALUES (1), (2);
-INSERT INTO t2 VALUES (1), (2);
-
-GRANT CREATE VIEW ON mysqltest1.* TO mysqluser1@localhost;
-
-GRANT SELECT ON t1 TO mysqluser1@localhost;
-GRANT INSERT ON t2 TO mysqluser1@localhost;
-
---connect (connection1, localhost, mysqluser1, , mysqltest1)
-
---echo This would lead to failed assertion.
-CREATE VIEW v1 AS SELECT a, b FROM t1, t2;
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM v1;
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT b FROM v1;
-
---disconnect connection1
---connection default
-
-DROP TABLE t1, t2;
-DROP VIEW v1;
-DROP DATABASE mysqltest1;
-DROP USER mysqluser1@localhost;
-USE test;
-
---echo End of 5.1 tests.
-
-#
-# Bug#36086: SELECT * from views don't check column grants
-#
-CREATE USER mysqluser1@localhost;
-CREATE DATABASE mysqltest1;
-
-USE mysqltest1;
-
-CREATE TABLE t1 ( a INT, b INT );
-CREATE TABLE t2 ( a INT, b INT );
-
-CREATE VIEW v1 AS SELECT a, b FROM t1;
-
-GRANT SELECT( a ) ON v1 TO mysqluser1@localhost;
-GRANT UPDATE( b ) ON t2 TO mysqluser1@localhost;
-
---connect (connection1, localhost, mysqluser1, , test)
-
---error ER_TABLEACCESS_DENIED_ERROR
-SELECT * FROM mysqltest1.v1;
-
---error ER_TABLEACCESS_DENIED_ERROR
-CREATE VIEW v1 AS SELECT * FROM mysqltest1.t2;
-
---disconnect connection1
-
---connection default
-
-DROP TABLE t1, t2;
-DROP VIEW v1;
-DROP DATABASE mysqltest1;
-DROP USER mysqluser1@localhost;
-
-#
-# Bug#35600 Security breach via view, I_S table and prepared
-# statement/stored procedure
-#
-CREATE USER mysqluser1@localhost;
-CREATE DATABASE mysqltest1;
-
-USE mysqltest1;
-
-CREATE VIEW v1 AS SELECT * FROM information_schema.tables LIMIT 1;
-CREATE ALGORITHM = TEMPTABLE VIEW v2 AS SELECT 1 AS A;
-
-CREATE VIEW test.v3 AS SELECT 1 AS a;
-
---connection default
-GRANT SELECT ON mysqltest1.* to mysqluser1@localhost;
-GRANT ALL ON test.* TO mysqluser1@localhost;
-
---connect (connection1, localhost, mysqluser1, , test)
-PREPARE stmt_v1 FROM "SELECT * FROM mysqltest1.v1";
-PREPARE stmt_v2 FROM "SELECT * FROM mysqltest1.v2";
-
---connection default
-REVOKE SELECT ON mysqltest1.* FROM mysqluser1@localhost;
-
---connection connection1
-
---error ER_TABLEACCESS_DENIED_ERROR
-EXECUTE stmt_v1;
---error ER_TABLEACCESS_DENIED_ERROR
-EXECUTE stmt_v2;
---disconnect connection1
-
---connect (connection2, localhost, mysqluser1,,)
-PREPARE stmt FROM "SELECT a FROM v3";
-EXECUTE stmt;
---disconnect connection2
-
---connection default
-DROP VIEW v1, v2;
-DROP DATABASE mysqltest1;
-DROP VIEW test.v3;
-DROP USER mysqluser1@localhost;
-USE test;
-
---echo #
---echo # Bug#35996: SELECT + SHOW VIEW should be enough to display view
---echo # definition
---echo #
--- source include/not_embedded.inc
-CREATE USER mysqluser1@localhost;
-CREATE DATABASE mysqltest1;
-CREATE DATABASE mysqltest2;
-GRANT USAGE, SELECT, CREATE VIEW, SHOW VIEW
-ON mysqltest2.* TO mysqluser1@localhost;
-
-USE mysqltest1;
-
-CREATE TABLE t1( a INT );
-CREATE TABLE t2( a INT, b INT );
-CREATE FUNCTION f1() RETURNS INT RETURN 1;
-CREATE VIEW v1 AS SELECT 1 AS a;
-CREATE VIEW v2 AS SELECT 1 AS a, 2 AS b;
-
-GRANT SELECT ON TABLE t1 TO mysqluser1@localhost;
-GRANT SELECT (a, b) ON TABLE t2 TO mysqluser1@localhost;
-GRANT EXECUTE ON FUNCTION f1 TO mysqluser1@localhost;
-GRANT SELECT ON TABLE v1 TO mysqluser1@localhost;
-GRANT SELECT (a, b) ON TABLE v2 TO mysqluser1@localhost;
-
-CREATE VIEW v_t1 AS SELECT * FROM t1;
-CREATE VIEW v_t2 AS SELECT * FROM t2;
-CREATE VIEW v_f1 AS SELECT f1() AS a;
-CREATE VIEW v_v1 AS SELECT * FROM v1;
-CREATE VIEW v_v2 AS SELECT * FROM v2;
-
-GRANT SELECT, SHOW VIEW ON v_t1 TO mysqluser1@localhost;
-GRANT SELECT, SHOW VIEW ON v_t2 TO mysqluser1@localhost;
-GRANT SELECT, SHOW VIEW ON v_f1 TO mysqluser1@localhost;
-GRANT SELECT, SHOW VIEW ON v_v1 TO mysqluser1@localhost;
-GRANT SELECT, SHOW VIEW ON v_v2 TO mysqluser1@localhost;
-
---connect (connection1, localhost, mysqluser1,, mysqltest2)
-CREATE VIEW v_mysqluser1_t1 AS SELECT * FROM mysqltest1.t1;
-CREATE VIEW v_mysqluser1_t2 AS SELECT * FROM mysqltest1.t2;
-CREATE VIEW v_mysqluser1_f1 AS SELECT mysqltest1.f1() AS a;
-CREATE VIEW v_mysqluser1_v1 AS SELECT * FROM mysqltest1.v1;
-CREATE VIEW v_mysqluser1_v2 AS SELECT * FROM mysqltest1.v2;
-
-SHOW CREATE VIEW mysqltest1.v_t1;
-SHOW CREATE VIEW mysqltest1.v_t2;
-SHOW CREATE VIEW mysqltest1.v_f1;
-SHOW CREATE VIEW mysqltest1.v_v1;
-SHOW CREATE VIEW mysqltest1.v_v2;
-
-SHOW CREATE VIEW v_mysqluser1_t1;
-SHOW CREATE VIEW v_mysqluser1_t2;
-SHOW CREATE VIEW v_mysqluser1_f1;
-SHOW CREATE VIEW v_mysqluser1_v1;
-SHOW CREATE VIEW v_mysqluser1_v2;
-
---connection default
-REVOKE SELECT ON TABLE t1 FROM mysqluser1@localhost;
-REVOKE SELECT (a) ON TABLE t2 FROM mysqluser1@localhost;
-REVOKE EXECUTE ON FUNCTION f1 FROM mysqluser1@localhost;
-REVOKE SELECT ON TABLE v1 FROM mysqluser1@localhost;
-
---connection connection1
-SHOW CREATE VIEW mysqltest1.v_t1;
-SHOW CREATE VIEW mysqltest1.v_t2;
-SHOW CREATE VIEW mysqltest1.v_f1;
-SHOW CREATE VIEW mysqltest1.v_v1;
-SHOW CREATE VIEW mysqltest1.v_v2;
-
-SHOW CREATE VIEW v_mysqluser1_t1;
-SHOW CREATE VIEW v_mysqluser1_t2;
-SHOW CREATE VIEW v_mysqluser1_f1;
-SHOW CREATE VIEW v_mysqluser1_v1;
-SHOW CREATE VIEW v_mysqluser1_v2;
-
---connection default
---echo # Testing the case when the views reference missing objects.
---echo # Obviously, there are no privileges to check for, so we
---echo # need only each object type once.
-DROP TABLE t1;
-DROP FUNCTION f1;
-DROP VIEW v1;
-
---connection connection1
-SHOW CREATE VIEW mysqltest1.v_t1;
-SHOW CREATE VIEW mysqltest1.v_f1;
-SHOW CREATE VIEW mysqltest1.v_v1;
-
-SHOW CREATE VIEW v_mysqluser1_t1;
-SHOW CREATE VIEW v_mysqluser1_f1;
-SHOW CREATE VIEW v_mysqluser1_v1;
-
---connection default
-REVOKE SHOW VIEW ON v_t1 FROM mysqluser1@localhost;
-REVOKE SHOW VIEW ON v_f1 FROM mysqluser1@localhost;
-REVOKE SHOW VIEW ON v_v1 FROM mysqluser1@localhost;
-
---connection connection1
---error ER_TABLEACCESS_DENIED_ERROR
-SHOW CREATE VIEW mysqltest1.v_t1;
---error ER_TABLEACCESS_DENIED_ERROR
-SHOW CREATE VIEW mysqltest1.v_f1;
---error ER_TABLEACCESS_DENIED_ERROR
-SHOW CREATE VIEW mysqltest1.v_v1;
-SHOW CREATE VIEW v_mysqluser1_t1;
-SHOW CREATE VIEW v_mysqluser1_f1;
-SHOW CREATE VIEW v_mysqluser1_v1;
-
---disconnect connection1
---connection default
-DROP USER mysqluser1@localhost;
-DROP DATABASE mysqltest1;
-DROP DATABASE mysqltest2;
-USE test;
-
-CREATE TABLE t1( a INT );
-CREATE DEFINER = no_such_user@no_such_host VIEW v1 AS SELECT * FROM t1;
-SHOW CREATE VIEW v1;
-DROP TABLE t1;
-DROP VIEW v1;
-
-
---echo #
---echo # Bug #46019: ERROR 1356 When selecting from within another
---echo # view that has Group By
---echo #
-CREATE DATABASE mysqltest1;
-USE mysqltest1;
-
-CREATE TABLE t1 (a INT);
-
-CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT a FROM t1 GROUP BY a;
-CREATE SQL SECURITY INVOKER VIEW v2 AS SELECT a FROM v1;
-
-CREATE USER mysqluser1;
-
-GRANT SELECT ON TABLE t1 TO mysqluser1;
-GRANT SELECT, SHOW VIEW ON TABLE v1 TO mysqluser1;
-GRANT SELECT, SHOW VIEW ON TABLE v2 TO mysqluser1;
-
---connect (mysqluser1, localhost, mysqluser1,,mysqltest1)
-SELECT a FROM v1;
-SELECT a FROM v2;
-
---connection default
---disconnect mysqluser1
-DROP USER mysqluser1;
-DROP DATABASE mysqltest1;
-USE test;
-
---echo #
---echo # Bug#47734: Assertion failed: ! is_set() when locking a view with non-existing definer
---echo #
-
---disable_warnings
-DROP VIEW IF EXISTS v1;
---enable_warnings
-
-CREATE DEFINER=`unknown`@`unknown` SQL SECURITY DEFINER VIEW v1 AS SELECT 1;
---error ER_NO_SUCH_USER
-LOCK TABLES v1 READ;
-DROP VIEW v1;
-
-
---echo #
---echo # Bug #58499 "DEFINER-security view selecting from INVOKER-security view
---echo # access check wrong".
---echo #
---echo # Check that we correctly handle privileges for various combinations
---echo # of INVOKER and DEFINER-security views using each other.
---disable_warnings
-DROP DATABASE IF EXISTS mysqltest1;
---enable_warnings
-CREATE DATABASE mysqltest1;
-USE mysqltest1;
-CREATE TABLE t1 (i INT);
-CREATE TABLE t2 (j INT);
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (2);
---echo #
---echo # 1) DEFINER-security view uses INVOKER-security view (covers
---echo # scenario originally described in the bug report).
-CREATE SQL SECURITY INVOKER VIEW v1_uses_t1 AS SELECT * FROM t1;
-CREATE SQL SECURITY INVOKER VIEW v1_uses_t2 AS SELECT * FROM t2;
-CREATE USER 'mysqluser1'@'%';
-GRANT CREATE VIEW ON mysqltest1.* TO 'mysqluser1'@'%';
-GRANT SELECT ON t1 TO 'mysqluser1'@'%';
---echo # To be able create 'v2_uses_t2' we also need select on t2.
-GRANT SELECT ON t2 TO 'mysqluser1'@'%';
-GRANT SELECT ON v1_uses_t1 TO 'mysqluser1'@'%';
-GRANT SELECT ON v1_uses_t2 TO 'mysqluser1'@'%';
---connect (mysqluser1, localhost, mysqluser1,,mysqltest1)
-CREATE SQL SECURITY DEFINER VIEW v2_uses_t1 AS SELECT * FROM v1_uses_t1;
-CREATE SQL SECURITY DEFINER VIEW v2_uses_t2 AS SELECT * FROM v1_uses_t2;
---connection default
-CREATE USER 'mysqluser2'@'%';
-GRANT SELECT ON v2_uses_t1 TO 'mysqluser2'@'%';
-GRANT SELECT ON v2_uses_t2 TO 'mysqluser2'@'%';
-GRANT SELECT ON t2 TO 'mysqluser2'@'%';
-GRANT CREATE VIEW ON mysqltest1.* TO 'mysqluser2'@'%';
---echo # Make 'mysqluser1' unable to access t2.
-REVOKE SELECT ON t2 FROM 'mysqluser1'@'%';
---connect (mysqluser2, localhost, mysqluser2,,mysqltest1)
---echo # The below statement should succeed thanks to suid nature of v2_uses_t1.
-SELECT * FROM v2_uses_t1;
---echo # The below statement should fail due to suid nature of v2_uses_t2.
---error ER_VIEW_INVALID
-SELECT * FROM v2_uses_t2;
---echo #
---echo # 2) INVOKER-security view uses INVOKER-security view.
---connection default
-DROP VIEW v2_uses_t1, v2_uses_t2;
-CREATE SQL SECURITY INVOKER VIEW v2_uses_t1 AS SELECT * FROM v1_uses_t1;
-CREATE SQL SECURITY INVOKER VIEW v2_uses_t2 AS SELECT * FROM v1_uses_t2;
-GRANT SELECT ON v2_uses_t1 TO 'mysqluser1'@'%';
-GRANT SELECT ON v2_uses_t2 TO 'mysqluser1'@'%';
-GRANT SELECT ON v1_uses_t1 TO 'mysqluser2'@'%';
-GRANT SELECT ON v1_uses_t2 TO 'mysqluser2'@'%';
---connection mysqluser1
---echo # For both versions of 'v2' 'mysqluser1' privileges should be used.
-SELECT * FROM v2_uses_t1;
---error ER_VIEW_INVALID
-SELECT * FROM v2_uses_t2;
---connection mysqluser2
---echo # And now for both versions of 'v2' 'mysqluser2' privileges should
---echo # be used.
---error ER_VIEW_INVALID
-SELECT * FROM v2_uses_t1;
-SELECT * FROM v2_uses_t2;
---echo #
---echo # 3) INVOKER-security view uses DEFINER-security view.
---connection default
-DROP VIEW v1_uses_t1, v1_uses_t2;
---echo # To be able create 'v1_uses_t2' we also need select on t2.
-GRANT SELECT ON t2 TO 'mysqluser1'@'%';
---connection mysqluser1
-CREATE SQL SECURITY DEFINER VIEW v1_uses_t1 AS SELECT * FROM t1;
-CREATE SQL SECURITY DEFINER VIEW v1_uses_t2 AS SELECT * FROM t2;
---connection default
---echo # Make 'mysqluser1' unable to access t2.
-REVOKE SELECT ON t2 FROM 'mysqluser1'@'%';
---connection mysqluser2
---echo # Due to suid nature of v1_uses_t1 and v1_uses_t2 the first
---echo # select should succeed and the second select should fail.
-SELECT * FROM v2_uses_t1;
---error ER_VIEW_INVALID
-SELECT * FROM v2_uses_t2;
---echo #
---echo # 4) DEFINER-security view uses DEFINER-security view.
---connection default
-DROP VIEW v2_uses_t1, v2_uses_t2;
---echo # To be able create 'v2_uses_t2' we also need select on t2.
-GRANT SELECT ON t2 TO 'mysqluser1'@'%';
---connection mysqluser2
-CREATE SQL SECURITY DEFINER VIEW v2_uses_t1 AS SELECT * FROM v1_uses_t1;
-CREATE SQL SECURITY DEFINER VIEW v2_uses_t2 AS SELECT * FROM v1_uses_t2;
---connection default
---echo # Make 'mysqluser1' unable to access t2.
-REVOKE SELECT ON t2 FROM 'mysqluser1'@'%';
---connection mysqluser2
---echo # Again privileges of creator of innermost views should apply.
-SELECT * FROM v2_uses_t1;
---error ER_VIEW_INVALID
-SELECT * FROM v2_uses_t2;
-
---disconnect mysqluser1
---disconnect mysqluser2
---connection default
-USE test;
-DROP DATABASE mysqltest1;
-DROP USER 'mysqluser1'@'%';
-DROP USER 'mysqluser2'@'%';
-
---echo #
---echo # Test for bug #11766767 - "59957: VIEW USING MERGE PERMISSIONS
---echo # IN MULTI-TABLE UPDATE".
---echo #
---disable_warnings
-drop database if exists mysqltest1;
-drop database if exists mysqltest2;
---enable_warnings
---echo #
---echo # Prepare playground.
-create database mysqltest1;
-create database mysqltest2;
-create user user_11766767;
-grant select on mysqltest1.* to user_11766767;
-grant all on mysqltest2.* to user_11766767;
-use mysqltest1;
-create table t1 (id int primary key, val varchar(20));
-insert into t1 values (1, 'test1');
-create table t11 (id int primary key);
-insert into t11 values (1);
-create algorithm=temptable view v1_temp as select * from t1;
-create algorithm=merge view v1_merge as select * from t1;
-create algorithm=temptable view v11_temp as
- select t1.id as id, t1.val as val from t1, t11 where t1.id= t11.id;
-create algorithm=merge view v11_merge as
- select t1.id as id, t1.val as val from t1, t11 where t1.id= t11.id;
-use mysqltest2;
-create table t2 (id int primary key, val varchar(20));
-insert into t2 values (1, 'test2');
-create table t21 (id int primary key);
-insert into t21 values (1);
-create algorithm=temptable view v2_temp as select * from t2;
-create algorithm=merge view v2_merge as select * from t2;
-create algorithm=temptable view v21_temp as
- select t2.id as id, t2.val as val from t2, t21 where t2.id= t21.id;
-create algorithm=merge view v21_merge as
- select t2.id as id, t2.val as val from t2, t21 where t2.id= t21.id;
-create algorithm=temptable sql security invoker view v3_temp as
- select t1.id as id, t1.val as val from mysqltest1.t1 as t1, mysqltest1.t11 as t11
- where t1.id = t11.id;
-create algorithm=merge sql security invoker view v3_merge as
- select t1.id as id, t1.val as val from mysqltest1.t1 as t1, mysqltest1.t11 as t11
- where t1.id = t11.id;
-create sql security invoker view v31 as
- select t2.id as id, t2.val as val from mysqltest2.t2 as t2, mysqltest1.t11 as t11
- where t2.id = t11.id;
-create sql security invoker view v4 as
- select t2.id as id, t2.val as val from mysqltest2.t2 as t2, mysqltest1.v1_merge as v1
- where t2.id = v1.id;
-create sql security invoker view v41 as
- select v1.id as id, v1.val as val from mysqltest2.t2 as t2, mysqltest1.v1_merge as v1
- where t2.id = v1.id;
-create sql security invoker view v42 as
- select v2.id as id, v2.val as val from mysqltest2.t2 as t2, mysqltest2.v2_merge as v2
- where t2.id = v2.id;
-
-
-connect (conn_11766767, localhost, user_11766767,,);
-
---echo #
---echo # A) Check how we handle privilege checking in multi-update for
---echo # directly used views.
---echo #
---echo # A.1) Originally reported problem, view is used in read-only mode.
---echo # This should work with only SELECT privilege for both mergeable
---echo # and temptable algorithms.
-update mysqltest2.t2 as t2, mysqltest1.v1_merge as v1 set t2.val= 'test3'
- where t2.id= v1.id;
-update mysqltest2.t2 as t2, mysqltest1.v1_temp as v1 set t2.val= 'test4'
- where t2.id= v1.id;
---echo #
---echo # A.2) If view is updated an UPDATE privilege on it is required.
---echo # Temptable views can't be updated.
---error ER_TABLEACCESS_DENIED_ERROR
-update mysqltest2.t2 as t2, mysqltest1.v1_merge as v1 set v1.val= 'test5'
- where t2.id= v1.id;
-update mysqltest1.t1 as t1, mysqltest2.v2_merge as v2 set v2.val= 'test6'
- where t1.id= v2.id;
---echo #
---echo # Note that the below error is OK even though user lacks UPDATE
---echo # privilege on v1_temp since he/she still has SELECT privilege on
---echo # this view.
---error ER_NON_UPDATABLE_TABLE
-update mysqltest2.t2 as t2, mysqltest1.v1_temp as v1 set v1.val= 'test7'
- where t2.id= v1.id;
---error ER_NON_UPDATABLE_TABLE
-update mysqltest1.t1 as t1, mysqltest2.v2_temp as v2 set v2.val= 'test8'
- where t1.id= v2.id;
---echo #
---echo # A.3) This also works for correctly for multi-table views.
---echo # When usage is read-only SELECT is enough.
-update mysqltest2.t2 as t2, mysqltest1.v11_merge as v11 set t2.val= 'test9'
- where t2.id= v11.id;
-update mysqltest2.t2 as t2, mysqltest1.v11_temp as v11 set t2.val= 'test10'
- where t2.id= v11.id;
---echo # When one of view's tables is updated, UPDATE is required
---echo # on a view.
---error ER_TABLEACCESS_DENIED_ERROR
-update mysqltest2.t2 as t2, mysqltest1.v11_merge as v11 set v11.val= 'test11'
- where t2.id= v11.id;
-update mysqltest1.t1 as t1, mysqltest2.v21_merge as v21 set v21.val= 'test12'
- where t1.id= v21.id;
---echo # As before, temptable views are not updateable.
---error ER_NON_UPDATABLE_TABLE
-update mysqltest2.t2 as t2, mysqltest1.v11_temp as v11 set v11.val= 'test13'
- where t2.id= v11.id;
---error ER_NON_UPDATABLE_TABLE
-update mysqltest1.t1 as t1, mysqltest2.v21_temp as v21 set v21.val= 'test14'
- where t1.id= v21.id;
-
---echo #
---echo # B) Now check that correct privileges are required on underlying
---echo # tables. To simplify this part of test we will use SECURITY
---echo # INVOKER views in it.
---echo #
---echo # B.1) In case when view is used for read only it is enough to have
---echo # SELECT on its underlying tables.
-update mysqltest2.t2 as t2, mysqltest2.v3_merge as v3 set t2.val= 'test15'
- where t2.id= v3.id;
-update mysqltest2.t2 as t2, mysqltest2.v3_temp as v3 set t2.val= 'test16'
- where t2.id= v3.id;
---echo #
---echo # B.2) If view is updated, UPDATE privilege on the table being updated
---echo # is required (since we already checked that temptable views are
---echo # not updateable we don't test them here).
---error ER_VIEW_INVALID
-update mysqltest2.t2 as t2, mysqltest2.v3_merge as v3 set v3.val= 'test17'
- where t2.id= v3.id;
-update mysqltest1.t11 as t11, mysqltest2.v31 as v31 set v31.val= 'test18'
- where t11.id= v31.id;
-
---disable_ps_protocol
---echo #
---echo # C) Finally, check how we handle privilege checking in case when
---echo # view is used through another view. Again we will use SECURITY
---echo # INVOKER views for simplicity.
---echo #
---echo # C.1) As usual, when a view used by another view is going to be used
---echo # in read-only fashion, only SELECT privilege is necessary.
-update mysqltest1.t11 as t11, mysqltest2.v4 as v4 set v4.val= 'test19'
- where t11.id= v4.id;
---echo #
---echo # C.2) If one of underlying tables of the view is updated then
---echo # UPDATE on a view is necessary.
---error ER_VIEW_INVALID
-update mysqltest1.t11 as t11, mysqltest2.v41 as v4 set v4.val= 'test20'
- where t11.id= v4.id;
-update mysqltest1.t11 as t11, mysqltest2.v42 as v4 set v4.val= 'test20'
- where t11.id= v4.id;
---enable_ps_protocol
-
---echo #
---echo # Clean-up.
---echo #
-disconnect conn_11766767;
-connection default;
-drop user user_11766767;
-drop database mysqltest1;
-drop database mysqltest2;
-
-# Wait till we reached the initial number of concurrent sessions
---source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/wait_timeout.test b/mysql-test/t/wait_timeout.test
deleted file mode 100644
index 84841aabb8b..00000000000
--- a/mysql-test/t/wait_timeout.test
+++ /dev/null
@@ -1,143 +0,0 @@
-# Last modification:
-# 2009-01-19 H.Hunger Fix Bug#39108 main.wait_timeout fails sporadically
-# - Increase wait timeout to 2 seconds
-# - Eliminated the corresponding opt file,
-# set global wait timeout within the test.
-# - Replaced sleeps by wait condition
-# - Minor improvements
-###############################################################################
-# These tests cannot run with the embedded server
--- source include/not_embedded.inc
-#-- source include/one_thread_per_connection.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-#
-# Bug#8731 wait_timeout does not work on Mac OS X
-#
-
-let $start_value= `SELECT @@global.wait_timeout`;
-SET @@global.wait_timeout= 2;
-disconnect default;
-
-# Connect with another connection and reset counters
-connect (wait_con,localhost,root,,test,,);
-connection wait_con;
---disable_query_log
-SET SESSION wait_timeout=100;
-let $retries=300;
-SET @aborted_clients= 0;
---enable_query_log
-
-# Disable reconnect and do the query
-connect (default,localhost,root,,test,,);
-connection default;
---echo --disable_reconnect;
---disable_reconnect
-SELECT 1;
-
-# Switch to wait_con and wait until server has aborted the connection
-connection wait_con;
---disable_query_log
-while (!`select @aborted_clients`)
-{
- real_sleep 0.1;
- let $aborted_clients = `SHOW STATUS LIKE 'aborted_clients'`;
- eval SET @aborted_clients= SUBSTRING('$aborted_clients', 16)+0;
-
- dec $retries;
- if (!$retries)
- {
- die Failed to detect that client has been aborted;
- }
-}
---enable_query_log
-# The server has disconnected, add small sleep to make sure
-# the disconnect has reached client
-let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.processlist;
---source include/wait_condition.inc
-connection default;
-# When the connection is closed in this way, the error code should
-# be consistent see Bug#2845 for an explanation
-# depending on platform/client, either errno 2006 or 2013 can occur below
---error 2006,2013
-SELECT 2;
---echo --enable_reconnect;
---enable_reconnect
-SELECT 3;
-# Disconnect so that we will not be confused by a future abort from this
-# connection.
-disconnect default;
-
-#
-# Do the same test as above on a TCP connection
-# (which we get by specifying an ip adress)
-
-# Connect with another connection and reset counters
-connection wait_con;
---disable_query_log
-FLUSH STATUS; # Reset counters
-let $retries=300;
-SET @aborted_clients= 0;
---enable_query_log
-
-connect (con1,127.0.0.1,root,,test,$MASTER_MYPORT,);
---echo --disable_reconnect;
---disable_reconnect
-SELECT 1;
-
-# Switch to wait_con and wait until server has aborted the connection
-connection wait_con;
---disable_query_log
-while (!`select @aborted_clients`)
-{
- real_sleep 0.1;
- let $aborted_clients = `SHOW STATUS LIKE 'aborted_clients'`;
- eval SET @aborted_clients= SUBSTRING('$aborted_clients', 16)+0;
-
- dec $retries;
- if (!$retries)
- {
- die Failed to detect that client has been aborted;
- }
-}
---enable_query_log
-# The server has disconnected, add small sleep to make sure
-# the disconnect has reached client
-let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.processlist;
---source include/wait_condition.inc
-disconnect wait_con;
-
-connection con1;
-# When the connection is closed in this way, the error code should
-# be consistent see Bug#2845 for an explanation
-# depending on platform/client, either errno 2006 or 2013 can occur below
---error 2006,2013
-SELECT 2;
---echo --enable_reconnect;
---enable_reconnect
-SELECT 3;
---replace_result $start_value <start_value>
-eval SET @@global.wait_timeout= $start_value;
-disconnect con1;
-
-connect (default,localhost,root,,test,,);
-
-#
-# MDEV-7775 Wrong error message (Unknown error) when idle sessions are killed after wait_timeout
-#
-set global log_warnings=2;
-connect (foo,localhost,root);
-set @@wait_timeout=1;
-sleep 2;
-connection default;
-let SEARCH_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err;
-let SEARCH_PATTERN= Aborted.*Got timeout reading communication packets;
-source include/search_pattern_in_file.inc;
-set global log_warnings=@@log_warnings;
-
-
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
-
diff --git a/mysql-test/t/warnings-master.opt b/mysql-test/t/warnings-master.opt
deleted file mode 100644
index 1aa6001465b..00000000000
--- a/mysql-test/t/warnings-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-skip-innodb --thread-handling=one-thread-per-connection
diff --git a/mysql-test/t/warnings.test b/mysql-test/t/warnings.test
deleted file mode 100644
index 9360d32f93d..00000000000
--- a/mysql-test/t/warnings.test
+++ /dev/null
@@ -1,300 +0,0 @@
-#
-# Test some warnings
-#
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-SET SQL_WARNINGS=1;
-
-create table t1 (a int);
---error 1050
-create table t1 (a int);
-show count(*) errors;
-show errors;
-show warnings;
---error 1115
-create table t2(a int) default charset qwerty;
-show count(*) errors;
-show errors;
---error 1064
-create table t (i);
-show count(*) errors;
-show errors;
-insert into t1 values (1);
-insert ignore into t1 values ("hej");
-insert ignore into t1 values ("hej"),("d");
-set SQL_WARNINGS=1;
-insert ignore into t1 values ("hej");
-insert ignore into t1 values ("hej"),("d");
-drop table t1;
-set SQL_WARNINGS=0;
-
-#
-# Test other warnings
-#
-
-drop temporary table if exists not_exists;
-drop table if exists not_exists_table;
-show warnings limit 1;
-drop database if exists not_exists_db;
-show count(*) warnings;
-create table t1(id int);
-create table if not exists t1(id int);
---disable_ps_protocol
-select @@warning_count;
---enable_ps_protocol
-drop table t1;
-
-#
-# Test warnings for LOAD DATA INFILE
-#
-
-create table t1(a tinyint, b int not null, c date, d char(5));
-load data infile '../../std_data/warnings_loaddata.dat' into table t1 fields terminated by ',';
-# PS doesn't work good with @@warning_count
---disable_ps_protocol
-select @@warning_count;
---enable_ps_protocol
-drop table t1;
-
-#
-# Warnings from basic INSERT, UPDATE and ALTER commands
-#
-
-create table t1(a tinyint NOT NULL, b tinyint unsigned, c char(5));
-insert ignore into t1 values(NULL,100,'mysql'),(10,-1,'mysql ab'),(500,256,'open source'),(20,NULL,'test');
-SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
-alter table t1 modify c char(4);
-alter table t1 add d char(2);
-update ignore t1 set a=NULL where a=10;
-update ignore t1 set c='mysql ab' where c='test';
-update ignore t1 set d=c;
-create table t2(a tinyint NOT NULL, b char(3));
-insert ignore into t2 select b,c from t1;
-insert ignore into t2(b) values('mysqlab');
-set sql_warnings=1;
-insert ignore into t2(b) values('mysqlab');
-set sql_warnings=0;
-drop table t1, t2;
-
-#
-# Test for max_error_count
-#
-
-create table t1(a char(10));
-let $1=50;
---disable_query_log
-begin;
-while ($1)
-{
- eval insert into t1 values('mysql ab');
- dec $1;
-}
-commit;
---enable_query_log
-alter table t1 add b char;
-set max_error_count=10;
-update ignore t1 set b=a;
---disable_ps_protocol
-select @@warning_count;
---enable_ps_protocol
-
-# Bug#9072
-set max_error_count=0;
-show variables like 'max_error_count';
-update ignore t1 set b='hi';
---disable_ps_protocol
-select @@warning_count;
---enable_ps_protocol
-show warnings;
-set max_error_count=65535;
-show variables like 'max_error_count';
-set max_error_count=10;
-show variables like 'max_error_count';
-
-drop table t1;
-
-#
-# Tests for show warnings limit a, b
-#
-create table t1 (a int);
-insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
-# should generate 10 warnings
-update ignore t1 set a='abc';
-show warnings limit 2, 1;
-show warnings limit 0, 10;
-show warnings limit 9, 1;
-show warnings limit 10, 1;
-show warnings limit 9, 2;
-show warnings limit 0, 0;
-show warnings limit 1;
-show warnings limit 0;
-show warnings limit 1, 0;
-# make sure behaviour is consistent with select ... limit
-select * from t1 limit 0;
-select * from t1 limit 1, 0;
-select * from t1 limit 0, 0;
-drop table t1;
-
---echo End of 4.1 tests
-
-#
-# Bug#20778: strange characters in warning message 1366 when called in SP
-#
-
-CREATE TABLE t1( f1 CHAR(20) );
-CREATE TABLE t2( f1 CHAR(20), f2 CHAR(25) );
-CREATE TABLE t3( f1 CHAR(20), f2 CHAR(25), f3 DATE );
-
-INSERT INTO t1 VALUES ( 'a`' );
-INSERT INTO t2 VALUES ( 'a`', 'a`' );
-INSERT INTO t3 VALUES ( 'a`', 'a`', '1000-01-1' );
-
-DROP PROCEDURE IF EXISTS sp1;
-DROP PROCEDURE IF EXISTS sp2;
-DROP PROCEDURE IF EXISTS sp3;
-SET sql_mode = '';
-delimiter //;
-CREATE PROCEDURE sp1()
-BEGIN
- DECLARE x NUMERIC ZEROFILL;
- SELECT f1 INTO x FROM t1 LIMIT 1;
-END//
-CREATE PROCEDURE sp2()
-BEGIN
- DECLARE x NUMERIC ZEROFILL;
- SELECT f1 INTO x FROM t2 LIMIT 1;
-END//
-CREATE PROCEDURE sp3()
-BEGIN
- DECLARE x NUMERIC ZEROFILL;
- SELECT f1 INTO x FROM t3 LIMIT 1;
-END//
-delimiter ;//
-CALL sp1();
-CALL sp2();
-CALL sp3();
-SET sql_mode = DEFAULT;
-
-DROP PROCEDURE IF EXISTS sp1;
-SET sql_mode = '';
-delimiter //;
-CREATE PROCEDURE sp1()
-BEGIN
-declare x numeric unsigned zerofill;
-SELECT f1 into x from t2 limit 1;
-END//
-delimiter ;//
-CALL sp1();
-SET sql_mode = DEFAULT;
-DROP TABLE t1;
-DROP TABLE t2;
-DROP TABLE t3;
-DROP PROCEDURE sp1;
-DROP PROCEDURE sp2;
-DROP PROCEDURE sp3;
-
-#
-# Bug#30059: End-space truncation warnings are inconsistent or incorrect
-#
-
-create table t1 (c_char char(255), c_varchar varchar(255), c_tinytext tinytext);
-create table t2 (c_tinyblob tinyblob); # not affected by bug, for regression testing
-set @c = repeat(' ', 256);
-set @q = repeat('q', 256);
-
-set sql_mode = '';
-
-insert into t1 values(@c, @c, @c);
-insert into t2 values(@c);
-insert into t1 values(@q, @q, @q);
-insert into t2 values(@q);
-
-set sql_mode = 'traditional';
-
-insert into t1 values(@c, @c, @c);
---error 1406
-insert into t2 values(@c);
---error 1406
-insert into t1 values(@q, NULL, NULL);
---error 1406
-insert into t1 values(NULL, @q, NULL);
---error 1406
-insert into t1 values(NULL, NULL, @q);
---error 1406
-insert into t2 values(@q);
-
-drop table t1, t2;
-
-#
-# Bug#42364 SHOW ERRORS returns empty resultset after dropping non existent table
-#
---error ER_BAD_TABLE_ERROR
-DROP TABLE t1;
-SHOW ERRORS;
-
---echo End of 5.0 tests
-
-#
-# Test warning with row numbers
-#
-
-set sql_mode = default;
-select CAST(a AS DECIMAL(13,5)) FROM (SELECT '' as a) t;
-create table t1 (a integer unsigned);
-insert into t1 values (1),(-1),(0),(-2);
-drop table t1;
-
---echo End of 5.1 tests
-
-#
-# Bug#55847: SHOW WARNINGS returns empty result set when SQLEXCEPTION is active
-#
-
---echo
---echo -- Bug#55847
---echo
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
-DROP FUNCTION IF EXISTS f1;
---enable_warnings
-
-CREATE TABLE t1(a INT UNIQUE);
-
-delimiter |;
-
-CREATE FUNCTION f1(x INT) RETURNS INT
-BEGIN
- INSERT INTO t1 VALUES(x);
- INSERT INTO t1 VALUES(x);
- RETURN x;
-END|
-
-delimiter ;|
-
---echo
-
---error ER_DUP_ENTRY
-SHOW TABLES WHERE f1(11) = 11;
-
---echo
-
-SHOW WARNINGS;
-
---echo
-
-DROP TABLE t1;
-DROP FUNCTION f1;
-
-# MDEV-14581 Warning info not cleared when caching THD
-connect (con1,localhost,root,,);
-SELECT TIME('10:10:10.11111111111');
-disconnect con1;
-
-connect (con2,localhost,root,,);
-SHOW WARNINGS;
-disconnect con2;
-
-connection default;
-
diff --git a/mysql-test/t/warnings_debug.test b/mysql-test/t/warnings_debug.test
deleted file mode 100644
index 3055e3894e5..00000000000
--- a/mysql-test/t/warnings_debug.test
+++ /dev/null
@@ -1,19 +0,0 @@
---source include/have_innodb.inc
---source include/have_debug.inc
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1 (a int primary key) engine=innodb;
-
-# Test that warnings produced during autocommit (after calling
-# set_ok_status()) are still reported to the client.
-SET SESSION debug_dbug="+d,warn_during_ha_commit_trans";
-INSERT INTO t1 VALUES (1);
-# The warning will be shown automatically by mysqltest; there was a bug where
-# this didn't happen because the warning was not counted when sending result
-# packet. Show the warnings manually also.
-SHOW WARNINGS;
-
-drop table t1;
diff --git a/mysql-test/t/warnings_engine_disabled.test b/mysql-test/t/warnings_engine_disabled.test
deleted file mode 100644
index 46c686aa6d6..00000000000
--- a/mysql-test/t/warnings_engine_disabled.test
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-# Only run this test with a compiled in but disabled
-# engine
-#
-if (!`SELECT count(*) FROM information_schema.engines WHERE
- support = 'NO' AND engine = 'innodb'`){
- skip Needs compiled-in and disabled innodb engine;
-}
-
-
-#
-# Test for handler type, will select MyISAM and print a warning
-# about that - since InnoDB is disabled
-#
-set sql_mode="";
-create table t1 (id int) engine=InnoDB;
-alter table t1 engine=InnoDB;
-drop table t1;
-set sql_mode=default;
-
-#
-# Bug#29263 disabled storage engines omitted in SHOW ENGINES
-#
-SELECT ENGINE, SUPPORT FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='InnoDB';
-SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME='InnoDB';
diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test
deleted file mode 100644
index c46aaecfbbf..00000000000
--- a/mysql-test/t/win.test
+++ /dev/null
@@ -1,2072 +0,0 @@
-#
-# Window Functions Tests
-#
-
---disable_warnings
-drop table if exists t1,t2;
-drop view if exists v1;
---enable_warnings
-
---echo # ########################################################################
---echo # # Parser tests
---echo # ########################################################################
---echo #
---echo # Check what happens when one attempts to use window function without OVER clause
-create table t1 (a int, b int);
-insert into t1 values (1,1),(2,2);
-
---error ER_PARSE_ERROR
-select row_number() from t1;
---error ER_PARSE_ERROR
-select rank() from t1;
-
---echo # Attempt to use window function in the WHERE clause
---error ER_WRONG_PLACEMENT_OF_WINDOW_FUNCTION
-select * from t1 where 1=rank() over (order by a);
---error ER_WRONG_PLACEMENT_OF_WINDOW_FUNCTION
-select * from t1 where 1>row_number() over (partition by b order by a);
-drop table t1;
-
---echo # ########################################################################
---echo # # Functionality tests
---echo # ########################################################################
---echo #
---echo # Check if ROW_NUMBER() works in basic cases
-create table t1(a int, b int, x char(32));
-insert into t1 values (2, 10, 'xx');
-insert into t1 values (2, 10, 'zz');
-insert into t1 values (2, 20, 'yy');
-insert into t1 values (3, 10, 'xxx');
-insert into t1 values (3, 20, 'vvv');
-
---sorted_result
-select a, row_number() over (partition by a order by b) from t1;
-
-select a, b, x, row_number() over (partition by a order by x) from t1;
-
-drop table t1;
-
-create table t1 (pk int primary key, a int, b int);
-insert into t1 values
- (1, 10, 22),
- (2, 11, 21),
- (3, 12, 20),
- (4, 13, 19),
- (5, 14, 18);
-
-select
- pk, a, b,
- row_number() over (order by a),
- row_number() over (order by b)
-from t1;
-
-drop table t1;
-
---echo #
---echo # Try RANK() function
---echo #
-create table t2 (
- pk int primary key,
- a int
-);
-
-insert into t2 values
-( 1 , 0),
-( 2 , 0),
-( 3 , 1),
-( 4 , 1),
-( 8 , 2),
-( 5 , 2),
-( 6 , 2),
-( 7 , 2),
-( 9 , 4),
-(10 , 4);
-
---sorted_result
-select pk, a, rank() over (order by a) from t2;
---sorted_result
-select pk, a, rank() over (order by a desc) from t2;
-
-drop table t2;
-
---echo #
---echo # Try Aggregates as window functions. With frames.
---echo #
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1 (pk int, c int);
-insert into t1 select a+1,1 from t0;
-update t1 set c=2 where pk not in (1,2,3,4);
-select * from t1;
-
-select
- pk, c,
- count(*) over (partition by c order by pk
- rows between 2 preceding and 2 following) as CNT
-from t1;
-
-select
- pk, c,
- count(*) over (partition by c order by pk
- rows between 1 preceding and 2 following) as CNT
-from t1;
-
-select
- pk, c,
- count(*) over (partition by c order by pk
- rows between 2 preceding and current row) as CNT
-from t1;
-
-select
- pk,c,
- count(*) over (partition by c order by pk rows
- between 1 following and 2 following) as CNT
-from t1;
-
-select
- pk,c,
- count(*) over (partition by c order by pk rows
- between 2 preceding and 1 preceding) as CNT
-from t1;
-
-select
- pk, c,
- count(*) over (partition by c order by pk
- rows between current row and 1 following) as CNT
-from t1;
-
---echo # Check ORDER BY DESC
-select
- pk, c,
- count(*) over (partition by c order by pk desc
- rows between 2 preceding and 2 following) as CNT
-from t1;
-
-drop table t0,t1;
-
---echo #
---echo # Resolution of window names
---echo #
-
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1 (pk int, c int);
-insert into t1 select a+1,1 from t0;
-update t1 set c=2 where pk not in (1,2,3,4);
-select * from t1;
-
-select
- pk, c,
- count(*) over w1 as CNT
-from t1
-window w1 as (partition by c order by pk
- rows between 2 preceding and 2 following);
-
-select
- pk, c,
- count(*) over (w1 rows between 2 preceding and 2 following) as CNT
-from t1
-window w1 as (partition by c order by pk);
-
-select
- pk, c,
- count(*) over (w1 order by pk rows between 2 preceding and 2 following) as CNT
-from t1
-window w1 as (partition by c);
-
-select
- pk, c,
- count(*) over (w2 rows between 2 preceding and 2 following) as CNT
-from t1
-window w1 as (partition by c), w2 as (w1 order by pk);
-
-select
- pk, c,
- count(*) over w3 as CNT
-from t1
-window
- w1 as (partition by c),
- w2 as (w1 order by pk),
- w3 as (w2 rows between 2 preceding and 2 following);
-
---error ER_WRONG_WINDOW_SPEC_NAME
-select
- pk, c,
- count(*) over w as CNT
-from t1
-window w1 as (partition by c order by pk
- rows between 2 preceding and 2 following);
-
---error ER_DUP_WINDOW_NAME
-select
- pk, c,
- count(*) over (w2 rows between 2 preceding and 2 following) as CNT
-from t1
-window w1 as (partition by c), w1 as (order by pk);
-
---error ER_WRONG_WINDOW_SPEC_NAME
-select
- pk, c,
- count(*) over (w2 rows between 2 preceding and 2 following) as CNT
-from t1
-window w1 as (partition by c), w2 as (w partition by c order by pk);
-
---error ER_PARTITION_LIST_IN_REFERENCING_WINDOW_SPEC
-select
- pk, c,
- count(*) over (w2 rows between 2 preceding and 2 following) as CNT
-from t1
-window w1 as (partition by c), w2 as (w1 partition by c order by pk);
-
---error ER_ORDER_LIST_IN_REFERENCING_WINDOW_SPEC
-select
- pk, c,
- count(*) over (w2 rows between 2 preceding and 2 following) as CNT
-from t1
-window w1 as (partition by c order by pk), w2 as (w1 order by pk);
-
---error ER_WINDOW_FRAME_IN_REFERENCED_WINDOW_SPEC
-select
- pk, c,
- count(*) over w3 as CNT
-from t1
-window
- w1 as (partition by c),
- w2 as (w1 order by pk rows between 3 preceding and 2 following),
- w3 as (w2 rows between 2 preceding and 2 following);
-
---error ER_BAD_COMBINATION_OF_WINDOW_FRAME_BOUND_SPECS
-select
- pk, c,
- count(*) over w1 as CNT
-from t1
-window w1 as (partition by c order by pk
- rows between unbounded following and 2 following);
-
---error ER_BAD_COMBINATION_OF_WINDOW_FRAME_BOUND_SPECS
-select
- pk, c,
- count(*) over (w1 rows between 2 preceding and unbounded preceding) as CNT
-from t1
-window w1 as (partition by c order by pk);
-
---error ER_BAD_COMBINATION_OF_WINDOW_FRAME_BOUND_SPECS
-select
- pk, c,
- count(*) over (w1 order by pk rows between current row and 2 preceding) as CNT
-from t1
-window w1 as (partition by c);
-
---error ER_BAD_COMBINATION_OF_WINDOW_FRAME_BOUND_SPECS
-select
- pk, c,
- count(*) over (w2 rows between 2 following and current row) as CNT
-from t1
-window w1 as (partition by c), w2 as (w1 order by pk);
-
---error ER_WRONG_PLACEMENT_OF_WINDOW_FUNCTION
-select
- pk, c
-from t1 where rank() over w1 > 2
-window w1 as (partition by c order by pk);
-
---error ER_WRONG_PLACEMENT_OF_WINDOW_FUNCTION
-select
- c, max(pk) as m
-from t1
- group by c + rank() over w1
-window w1 as (order by m);
-
---error ER_WRONG_PLACEMENT_OF_WINDOW_FUNCTION
-select
- c, max(pk) as m, rank() over w1 as r
-from t1
- group by c+r
-window w1 as (order by m);
-
---error ER_WRONG_PLACEMENT_OF_WINDOW_FUNCTION
-select
- c, max(pk) as m, rank() over w1 as r
-from t1
- group by c having c+r > 3
-window w1 as (order by m);
-
---error ER_WINDOW_FUNCTION_IN_WINDOW_SPEC
-select
- c, max(pk) as m, rank() over w1 as r,
- rank() over (partition by r+1 order by m)
-from t1
- group by c
-window w1 as (order by m);
-
---error ER_WINDOW_FUNCTION_IN_WINDOW_SPEC
-select
- c, max(pk) as m, rank() over w1 as r,
- rank() over (partition by m order by r)
-from t1
- group by c
-window w1 as (order by m);
-
---error ER_WINDOW_FUNCTION_IN_WINDOW_SPEC
-select
- c, max(pk) as m, rank() over w1 as r, dense_rank() over w2 as dr
-from t1
- group by c
-window w1 as (order by m), w2 as (partition by r order by m);
-
---error ER_NOT_ALLOWED_WINDOW_FRAME
-select
- pk, c,
- row_number() over (partition by c order by pk
- range between unbounded preceding and current row) as r
-from t1;
-
---error ER_NOT_ALLOWED_WINDOW_FRAME
-select
- pk, c,
- rank() over w1 as r
-from t1
-window w1 as (partition by c order by pk
- rows between 2 preceding and 2 following);
-
---error ER_NOT_ALLOWED_WINDOW_FRAME
-select
- pk, c,
- dense_rank() over (partition by c order by pk
- rows between 1 preceding and 1 following) as r
-from t1;
-
---error ER_NO_ORDER_LIST_IN_WINDOW_SPEC
-select
- pk, c,
- rank() over w1 as r
-from t1
-window w1 as (partition by c);
-
---error ER_NO_ORDER_LIST_IN_WINDOW_SPEC
-select
- pk, c,
- dense_rank() over (partition by c) as r
-from t1;
-
-drop table t0,t1;
-
---echo #
---echo # MDEV-9634: Window function produces incorrect value
---echo #
-
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t2 (part_id int, pk int, a int);
-insert into t2 select
- if(a<5, 0, 1), a, if(a<5, NULL, 1) from t0;
-select * from t2;
-
-select
- part_id, pk, a,
- count(a) over (partition by part_id order by pk
- rows between 1 preceding and 1 following) as CNT
-from t2;
-
-drop table t0, t2;
-
---echo #
---echo # RANGE-type bounds
---echo #
-
-create table t3 (
- pk int,
- val int
-);
-
-insert into t3 values
-(0, 1),
-(1, 1),
-(2, 1),
-(3, 2),
-(4, 2),
-(5, 2),
-(6, 2);
-
-select
- pk,
- val,
- count(val) over (order by val
- range between current row and
- current row)
- as CNT
-from t3;
-
-insert into t3 values
-(7, 3),
-(8, 3);
-
-select
- pk,
- val,
- count(val) over (order by val
- range between current row and
- current row)
- as CNT
-from t3;
-
-drop table t3;
-
---echo # Now, check with PARTITION BY
-create table t4 (
- part_id int,
- pk int,
- val int
-);
-
-insert into t4 values
-(1234, 100, 1),
-(1234, 101, 1),
-(1234, 102, 1),
-(1234, 103, 2),
-(1234, 104, 2),
-(1234, 105, 2),
-(1234, 106, 2),
-(1234, 107, 3),
-(1234, 108, 3),
-
-(5678, 200, 1),
-(5678, 201, 1),
-(5678, 202, 1),
-(5678, 203, 2),
-(5678, 204, 2),
-(5678, 205, 2),
-(5678, 206, 2),
-(5678, 207, 3),
-(5678, 208, 3);
-
-select
- part_id,
- pk,
- val,
- count(val) over (partition by part_id
- order by val
- range between current row and
- current row)
- as CNT
-from t4;
-
---echo #
---echo # Try RANGE UNBOUNDED PRECEDING | FOLLOWING
---echo #
-select
- part_id,
- pk,
- val,
- count(val) over (partition by part_id
- order by val
- range between unbounded preceding and
- current row)
- as CNT
-from t4;
-
-select
- part_id,
- pk,
- val,
- count(val) over (partition by part_id
- order by val
- range between current row and
- unbounded following)
- as CNT
-from t4;
-
-select
- part_id,
- pk,
- val,
- count(val) over (partition by part_id
- order by val
- range between unbounded preceding and
- unbounded following)
- as CNT
-from t4;
-
-drop table t4;
-
---echo #
---echo # MDEV-9695: Wrong window frame when using RANGE BETWEEN N FOLLOWING AND PRECEDING
---echo #
-create table t1 (pk int, a int, b int);
-insert into t1 values
-( 1 , 0, 1),
-( 2 , 0, 2),
-( 3 , 1, 4),
-( 4 , 1, 8),
-( 5 , 2, 32),
-( 6 , 2, 64),
-( 7 , 2, 128),
-( 8 , 2, 16);
-
-select pk, a, b,
-bit_or(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) as bit_or
-from t1;
-
---echo # Extra ROWS n PRECEDING tests
-select pk, a, b,
-bit_or(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) as bit_or
-from t1;
-drop table t1;
-
-
-create table t2 (
- pk int,
- a int,
- b int
-);
-
-insert into t2 values
-( 1, 0, 1),
-( 2, 0, 2),
-( 3, 0, 4),
-( 4, 0, 8),
-( 5, 1, 16),
-( 6, 1, 32),
-( 7, 1, 64),
-( 8, 1, 128),
-( 9, 2, 256),
-(10, 2, 512),
-(11, 2, 1024),
-(12, 2, 2048);
-
-select pk, a, b,
-bit_or(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) as bit_or
-from t2;
-
-select pk, a, b,
-bit_or(b) over (partition by a order by pk ROWS BETWEEN 2 PRECEDING AND 2 PRECEDING) as bit_or
-from t2;
-
-select pk, a, b,
-bit_or(b) over (partition by a order by pk ROWS BETWEEN 2 PRECEDING AND 1 PRECEDING) as bit_or
-from t2;
-
---echo # Check CURRENT ROW
-
-select pk, a, b,
-bit_or(b) over (partition by a order by pk ROWS BETWEEN CURRENT ROW AND CURRENT ROW) as bit_or
-from t2;
-
-drop table t2;
-
---echo #
---echo # Try RANGE PRECEDING|FOLLWING n
---echo #
-create table t1 (
- part_id int,
- pk int,
- a int
-);
-
-insert into t1 values
-(10, 1, 1),
-(10, 2, 2),
-(10, 3, 4),
-(10, 4, 8),
-(10, 5,26),
-(10, 6,27),
-(10, 7,40),
-(10, 8,71),
-(10, 9,72);
-
-select
- pk, a,
- count(a) over (ORDER BY a
- RANGE BETWEEN UNBOUNDED PRECEDING
- AND 10 FOLLOWING) as cnt
-from t1;
-
-select
- pk, a,
- count(a) over (ORDER BY a DESC
- RANGE BETWEEN UNBOUNDED PRECEDING
- AND 10 FOLLOWING) as cnt
-from t1;
-
-select
- pk, a,
- count(a) over (ORDER BY a
- RANGE BETWEEN UNBOUNDED PRECEDING
- AND 1 FOLLOWING) as cnt
-from t1;
-
-select
- pk, a,
- count(a) over (ORDER BY a
- RANGE BETWEEN UNBOUNDED PRECEDING
- AND 10 PRECEDING) as cnt
-from t1;
-
-select
- pk, a,
- count(a) over (ORDER BY a DESC
- RANGE BETWEEN UNBOUNDED PRECEDING
- AND 10 PRECEDING) as cnt
-from t1;
-
-select
- pk, a,
- count(a) over (ORDER BY a
- RANGE BETWEEN UNBOUNDED PRECEDING
- AND 1 PRECEDING) as cnt
-from t1;
-
-# Try bottom bound
-select
- pk, a,
- count(a) over (ORDER BY a
- RANGE BETWEEN 1 PRECEDING
- AND CURRENT ROW) as cnt
-from t1;
-
-select
- pk, a,
- count(a) over (ORDER BY a DESC
- RANGE BETWEEN 1 PRECEDING
- AND CURRENT ROW) as cnt
-from t1;
-
-select
- pk, a,
- count(a) over (ORDER BY a
- RANGE BETWEEN 1 FOLLOWING
- AND 3 FOLLOWING) as cnt
-from t1;
-
---echo # Try CURRENT ROW with[out] DESC
-select
- pk, a,
- count(a) over (ORDER BY a
- RANGE BETWEEN CURRENT ROW
- AND 1 FOLLOWING) as cnt
-from t1;
-
-select
- pk, a,
- count(a) over (order by a desc
- range between current row
- and 1 following) as cnt
-from t1;
-
-
-# Try with partitions
-insert into t1 select 22, pk, a from t1;
-select
- part_id, pk, a,
- count(a) over (PARTITION BY part_id
- ORDER BY a
- RANGE BETWEEN UNBOUNDED PRECEDING
- AND 10 FOLLOWING) as cnt
-from t1;
-
-select
- pk, a,
- count(a) over (PARTITION BY part_id
- ORDER BY a
- RANGE BETWEEN UNBOUNDED PRECEDING
- AND 1 PRECEDING) as cnt
-from t1;
-
-drop table t1;
-
---echo # Try a RANGE frame over non-integer datatype:
-
-create table t1 (
- col1 int,
- a decimal(5,3)
-);
-
-insert into t1 values (1, 0.45);
-insert into t1 values (1, 0.5);
-insert into t1 values (1, 0.55);
-insert into t1 values (1, 1.21);
-insert into t1 values (1, 1.22);
-insert into t1 values (1, 3.33);
-
-select
- a,
- count(col1) over (order by a
- range between 0.1 preceding
- and 0.1 following)
-from t1;
-
-drop table t1;
-
---echo #
---echo # RANGE-type frames and NULL values
---echo #
-create table t1 (
- pk int,
- a int,
- b int
-);
-
-insert into t1 values (1, NULL,1);
-insert into t1 values (2, NULL,1);
-insert into t1 values (3, NULL,1);
-insert into t1 values (4, 10 ,1);
-insert into t1 values (5, 11 ,1);
-insert into t1 values (6, 12 ,1);
-insert into t1 values (7, 13 ,1);
-insert into t1 values (8, 14 ,1);
-
-
-select
- pk, a,
- count(b) over (order by a
- range between 2 preceding
- and 2 following) as CNT
-from t1;
-drop table t1;
-
---echo #
---echo # Try ranges that have bound1 > bound2. The standard actually allows them
---echo #
-
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1 (pk int, c int);
-insert into t1 select a+1,1 from t0;
-update t1 set c=2 where pk not in (1,2,3,4);
-select * from t1;
-
-select
- pk, c,
- count(*) over (partition by c
- order by pk
- rows between 1 preceding
- and 2 preceding)
- as cnt
-from t1;
-
-select
- pk, c,
- sum(c) over (partition by c
- order by pk
- rows between 1 preceding
- and 2 preceding)
- as sum
-from t1;
-
-select
- pk, c,
- sum(c) over (partition by c
- order by pk
- rows between 2 following
- and 1 following)
- as sum
-from t1;
-
-
-select
- pk, c,
- count(*) over (partition by c
- order by pk
- range between 1 preceding
- and 2 preceding)
- as cnt
-from t1;
-drop table t0, t1;
-
---echo #
---echo # Error checking for frame bounds
---echo #
-
-create table t1 (a int, b int, c varchar(32));
-insert into t1 values (1,1,'foo');
-insert into t1 values (2,2,'bar');
---error ER_RANGE_FRAME_NEEDS_SIMPLE_ORDERBY
-select
- count(*) over (order by a,b
- range between unbounded preceding and current row)
-from t1;
-
---error ER_WRONG_TYPE_FOR_RANGE_FRAME
-select
- count(*) over (order by c
- range between unbounded preceding and current row)
-from t1;
-
---error ER_WRONG_TYPE_FOR_RANGE_FRAME
-select
- count(*) over (order by a
- range between 'abcd' preceding and current row)
-from t1;
-
---error ER_WRONG_TYPE_FOR_RANGE_FRAME
-select
- count(*) over (order by a
- range between current row and 'foo' following)
-from t1;
-
---echo # Try range frame with invalid bounds
---error ER_WRONG_TYPE_FOR_ROWS_FRAME
-select
- count(*) over (order by a
- rows between 0.5 preceding and current row)
-from t1;
-
---error ER_WRONG_TYPE_FOR_ROWS_FRAME
-select
- count(*) over (order by a
- rows between current row and 3.14 following)
-from t1;
-
---echo #
---echo # EXCLUDE clause is parsed but not supported
---echo #
-
---error ER_FRAME_EXCLUSION_NOT_SUPPORTED
-select
- count(*) over (order by a
- rows between 1 preceding and 1 following
- exclude current row)
-from t1;
-
---error ER_FRAME_EXCLUSION_NOT_SUPPORTED
-select
- count(*) over (order by a
- range between 1 preceding and 1 following
- exclude ties)
-from t1;
-
---error ER_FRAME_EXCLUSION_NOT_SUPPORTED
-select
- count(*) over (order by a
- range between 1 preceding and 1 following
- exclude group)
-from t1;
-
-# EXCLUDE NO OTHERS means 'don't exclude anything'
-select
- count(*) over (order by a
- rows between 1 preceding and 1 following
- exclude no others)
-from t1;
-
-drop table t1;
-
---echo #
---echo # Window function in grouping query
---echo #
-
-create table t1 (
- username varchar(32),
- amount int
-);
-
-insert into t1 values
-('user1',1),
-('user1',5),
-('user1',3),
-('user2',10),
-('user2',20),
-('user2',30);
-
-select
- username,
- sum(amount) as s,
- rank() over (order by s desc)
-from t1
-group by username;
-
-drop table t1;
-
---echo #
---echo # mdev-9719: Window function in prepared statement
---echo #
-
-create table t1(a int, b int, x char(32));
-insert into t1 values (2, 10, 'xx');
-insert into t1 values (2, 10, 'zz');
-insert into t1 values (2, 20, 'yy');
-insert into t1 values (3, 10, 'xxx');
-insert into t1 values (3, 20, 'vvv');
-
-prepare stmt from 'select a, row_number() over (partition by a order by b) from t1';
---sorted_result
-execute stmt;
-
-drop table t1;
-
---echo #
---echo # mdev-9754: Window name resolution in prepared statement
---echo #
-
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1 (pk int, c int);
-insert into t1 select a+1,1 from t0;
-update t1 set c=2 where pk not in (1,2,3,4);
-select * from t1;
-
-prepare stmt from
-'select
- pk, c,
- count(*) over w1 as CNT
-from t1
-window w1 as (partition by c order by pk
- rows between 2 preceding and 2 following)';
-execute stmt;
-
-drop table t0,t1;
-
---echo #
---echo # EXPLAIN FORMAT=JSON support for window functions
---echo #
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-explain format=json select rank() over (order by a) from t0;
-
-create table t1 (a int, b int, c int);
-insert into t1 select a,a,a from t0;
-
-explain format=json
-select
- a,
- rank() over (order by sum(b))
-from t1
-group by a;
-
-explain format=json
-select
- a,
- rank() over (order by sum(b))
-from t1
-group by a
-order by null;
-
---echo #
---echo # Check how window function works together with GROUP BY and HAVING
---echo #
-
-select b,max(a) as MX, rank() over (order by b) from t1 group by b having MX in (3,5,7);
-explain format=json
-select b,max(a) as MX, rank() over (order by b) from t1 group by b having MX in (3,5,7);
-
-drop table t1;
-drop table t0;
-
---echo #
---echo # Building ordering index for window functions
---echo #
-
-create table t1 (
- pk int primary key,
- a int,
- b int,
- c int
-);
-
-insert into t1 values
-(101 , 0, 10, 1),
-(102 , 0, 10, 2),
-(103 , 1, 10, 3),
-(104 , 1, 10, 4),
-(108 , 2, 10, 5),
-(105 , 2, 20, 6),
-(106 , 2, 20, 7),
-(107 , 2, 20, 8),
-(109 , 4, 20, 9),
-(110 , 4, 20, 10),
-(111 , 5, NULL, 11),
-(112 , 5, 1, 12),
-(113 , 5, NULL, 13),
-(114 , 5, NULL, 14),
-(115 , 5, NULL, 15),
-(116 , 6, 1, NULL),
-(117 , 6, 1, 10),
-(118 , 6, 1, 1),
-(119 , 6, 1, NULL),
-(120 , 6, 1, NULL),
-(121 , 6, 1, NULL),
-(122 , 6, 1, 2),
-(123 , 6, 1, 20),
-(124 , 6, 1, -10),
-(125 , 6, 1, NULL),
-(126 , 6, 1, NULL),
-(127 , 6, 1, NULL);
-
---sorted_result
-select sum(b) over (partition by a order by b,pk
- rows between unbounded preceding and current row) as c1,
- avg(b) over (w1 rows between 1 preceding and 1 following) as c2,
- sum(c) over (w2 rows between 1 preceding and 1 following) as c5,
- avg(b) over (w1 rows between 5 preceding and 5 following) as c3,
- sum(b) over (w1 rows between 1 preceding and 1 following) as c4
-from t1
-window w1 as (partition by a order by b,pk),
- w2 as (partition by b order by c,pk);
-
-drop table t1;
-
-
---echo #
---echo # MDEV-9848: Window functions: reuse sorting and/or scanning
---echo #
-
-create table t1 (a int, b int, c int);
-insert into t1 values
-(1,3,1),
-(2,2,1),
-(3,1,1);
-
---echo # Check using counters
-flush status;
-select
- rank() over (partition by c order by a),
- rank() over (partition by c order by b)
-from t1;
-show status like '%sort%';
-
-flush status;
-select
- rank() over (partition by c order by a),
- rank() over (partition by c order by a)
-from t1;
-show status like '%sort%';
-
-# Check using EXPLAIN FORMAT=JSON
-explain format=json
-select
- rank() over (partition by c order by a),
- rank() over (partition by c order by a)
-from t1;
-
-explain format=json
-select
- rank() over (order by a),
- row_number() over (order by a)
-from t1;
-
-explain format=json
-select
- rank() over (partition by c order by a),
- count(*) over (partition by c)
-from t1;
-
-explain format=json
-select
- count(*) over (partition by c),
- rank() over (partition by c order by a)
-from t1;
-
-drop table t1;
-
-
---echo #
---echo # MDEV-9847: Window functions: crash with big_tables=1
---echo #
-create table t1(a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-set @tmp=@@big_tables;
-set big_tables=1;
-select rank() over (order by a) from t1;
-set big_tables=@tmp;
-drop table t1;
-
---echo #
---echo # Check if "ORDER BY window_func" works
---echo #
-
-create table t1 (s1 int, s2 char(5));
-insert into t1 values (1,'a');
-insert into t1 values (null,null);
-insert into t1 values (1,null);
-insert into t1 values (null,'a');
-insert into t1 values (2,'b');
-insert into t1 values (-1,'');
-
-explain format=json
-select *, row_number() over (order by s1, s2) as X from t1 order by X desc;
-select *, row_number() over (order by s1, s2) as X from t1 order by X desc;
-drop table t1;
-
---echo #
---echo # Try window functions that are not directly present in the select list
---echo #
-create table t1 (a int, b int);
-insert into t1 values
- (1,3),
- (2,2),
- (3,1);
-
-select
- a, b,
- rank() over (order by a), rank() over (order by b),
- rank() over (order by a) - rank() over (order by b) as diff
-from
- t1;
-
-drop table t1;
-
-create table t1 (i int);
-insert into t1 values (1),(2);
-SELECT MAX(i) OVER (PARTITION BY (i)) FROM t1;
-drop table t1;
-
---echo #
---echo # Check the 0 in ROWS 0 PRECEDING
---echo #
-
-create table t1 (
- part_id int,
- pk int,
- a int
-);
-
-insert into t1 values (1, 1, 1);
-insert into t1 values (1, 2, 2);
-insert into t1 values (1, 3, 4);
-insert into t1 values (1, 4, 8);
-
-select
- pk, a,
- sum(a) over (order by pk rows between 0 preceding and current row)
-from t1;
-
-select
- pk, a,
- sum(a) over (order by pk rows between 1 preceding and 0 preceding)
-from t1;
-
-insert into t1 values (200, 1, 1);
-insert into t1 values (200, 2, 2);
-insert into t1 values (200, 3, 4);
-insert into t1 values (200, 4, 8);
-select
- part_id, pk, a,
- sum(a) over (partition by part_id order by pk rows between 0 preceding and current row)
-from t1;
-
-select
- part_id, pk, a,
- sum(a) over (partition by part_id order by pk rows between 1 preceding and 0 preceding)
-from t1;
-
-drop table t1;
---echo #
---echo # MDEV-9780, The "DISTINCT must not bet converted into GROUP BY when
---echo # window functions are present" part
---echo #
-
-create table t1 (part_id int, a int);
-insert into t1 values
-(100, 1),
-(100, 2),
-(100, 2),
-(100, 3),
-(2000, 1),
-(2000, 2),
-(2000, 3),
-(2000, 3),
-(2000, 3);
-
-select rank() over (partition by part_id order by a) from t1;
-select distinct rank() over (partition by part_id order by a) from t1;
-explain format=json
-select distinct rank() over (partition by part_id order by a) from t1;
-
-drop table t1;
-
---echo #
---echo # MDEV-9893: Window functions with different ORDER BY lists,
---echo # one of these lists containing an expression
---echo #
-
-create table t1 (s1 int, s2 char(5));
-insert into t1 values (1,'a');
-insert into t1 values (null,null);
-insert into t1 values (3,null);
-insert into t1 values (4,'a');
-insert into t1 values (2,'b');
-insert into t1 values (-1,'');
-
-select
- *,
- ROW_NUMBER() OVER (order by s1),
- CUME_DIST() OVER (order by -s1)
-from t1;
-
-drop table t1;
-
-
---echo #
---echo # MDEV-9925: Wrong result with aggregate function as a window function
---echo #
-create table t1 (i int);
-insert into t1 values (1),(2);
-select i, sum(i) over (partition by i) from t1;
-drop table t1;
-
---echo #
---echo # MDEV-9922: Assertion `!join->only_const_tables() && fsort' failed in int create_sort_index
---echo #
-create view v1 as select 1 as i;
-select rank() over (order by i) from v1;
-drop view v1;
-
---echo #
---echo # MDEV-10097: Assertion `count > 0' failed in Item_sum_sum::add_helper(bool)
---echo #
-CREATE TABLE `orders` (
- `o_orderkey` int(11) NOT NULL,
- `o_custkey` int(11) DEFAULT NULL,
- PRIMARY KEY (`o_orderkey`)
- ) DEFAULT CHARSET=latin1;
-
-INSERT INTO `orders` VALUES (59908,242);
-INSERT INTO `orders` VALUES (59940,238);
-
-SELECT o_custkey, avg(o_custkey) OVER (PARTITION BY abs(o_custkey)
- ORDER BY o_custkey
- RANGE BETWEEN 15 FOLLOWING
- AND 15 FOLLOWING) from orders;
-DROP table orders;
-
---echo #
---echo # MDEV-10842: window functions with the same order column
---echo # but different directions
---echo #
-
-create table t1 (
- pk int primary key,
- a int,
- b int,
- c char(10)
-);
-
-insert into t1 values
-( 1, 0, 1, 'one'),
-( 2, 0, 2, 'two'),
-( 3, 0, 3, 'three'),
-( 4, 1, 1, 'one'),
-( 5, 1, 1, 'two'),
-( 6, 1, 2, 'three'),
-( 7, 2, NULL, 'n_one'),
-( 8, 2, 1, 'n_two'),
-( 9, 2, 2, 'n_three'),
-(10, 2, 0, 'n_four'),
-(11, 2, 10, NULL);
-
-select pk,
- row_number() over (order by pk desc) as r_desc,
- row_number() over (order by pk asc) as r_asc
-from t1;
-
-drop table t1;
-
---echo #
---echo # MDEV-10874: two window functions with ccompatible sorting
---echo #
-
-create table t1 (
-pk int primary key,
-a int,
-b int,
-c char(10),
-d decimal(10, 3),
-e real
-);
-insert into t1 values
-( 1, 0, 1, 'one', 0.1, 0.001),
-( 2, 0, 2, 'two', 0.2, 0.002),
-( 3, 0, 3, 'three', 0.3, 0.003),
-( 4, 1, 2, 'three', 0.4, 0.004),
-( 5, 1, 1, 'two', 0.5, 0.005),
-( 6, 1, 1, 'one', 0.6, 0.006),
-( 7, 2, NULL, 'n_one', 0.5, 0.007),
-( 8, 2, 1, 'n_two', NULL, 0.008),
-( 9, 2, 2, NULL, 0.7, 0.009),
-(10, 2, 0, 'n_four', 0.8, 0.010),
-(11, 2, 10, NULL, 0.9, NULL);
-
-select pk, a, d,
- sum(d) over (partition by a order by pk
- ROWS between 1 preceding and current row) as sum_1,
- sum(d) over (order by a
- ROWS BETWEEN 1 preceding and 2 following) as sum_2
-from t1;
-explain format=json
-select pk, a, d,
- sum(d) over (partition by a order by pk
- ROWS between 1 preceding and current row) as sum_1,
- sum(d) over (order by a
- ROWS BETWEEN 1 preceding and 2 following) as sum_2
-from t1;
-
-select pk, a, d,
- sum(d) over (partition by a order by pk desc
- ROWS between 1 preceding and current row) as sum_1,
- sum(d) over (order by a
- ROWS BETWEEN 1 preceding and 2 following) as sum_2
-from t1;
-
-drop table t1;
-
---echo #
---echo # MDEV-9941: two window functions with compatible partitions
---echo #
-
-create table t1 (
- a int,
- b int,
- c int
-);
-
-insert into t1 values
- (10, 1, 1),
- (10, 3, 10),
- (10, 1, 10),
- (10, 3, 100),
- (10, 5, 1000),
- (10, 1, 100);
-
-explain format=json
-select
- a,b,c,
- row_number() over (partition by a),
- row_number() over (partition by a, b)
-from t1;
-
-drop table t1;
-
---echo #
---echo # MDEV-10815: Window Function Expressions Wrong Results
---echo #
-create table t(a decimal(35,10), b int);
-insert into t(a,b) values(1,1);
-insert into t(a,b) values(2,1);
-insert into t(a,b) values(0,1);
-insert into t(a,b) values(1, 2);
-insert into t(a,b) values(1.5,2);
-insert into t(a,b) values(3, 2);
-insert into t(a,b) values(4.5,2);
-select a, b,
- sum(t.a) over (partition by t.b order by a) as simple_sum,
- sum(t.a) over (partition by t.b order by a) + 1 as sum_and_const,
- sum(t.b) over (partition by t.b order by a) + sum(t.a) over (partition by t.b order by a) as sum_and_sum
-from t
-order by t.b, t.a;
-drop table t;
-
---echo #
---echo # MDEV-10669: Crash in SELECT with window function used
---echo #
-create table t(a decimal(35,10), b int);
-insert into t(a,b) values(1,1);
-insert into t(a,b) values(2,1);
-insert into t(a,b) values(0,1);
-SELECT (CASE WHEN sum(t.a) over (partition by t.b)=0 THEN null ELSE null END) AS a FROM t;
-SELECT ifnull(((t.a) / CASE WHEN sum(t.a) over(partition by t.b) =0 then null else null end) ,0) from t;
-SELECT sum(t.a) over (partition by t.b order by a),
- sqrt(ifnull((sum(t.a) over (partition by t.b order by a)), 0))
-from t;
-drop table t;
-
---echo #
---echo # MDEV-10868: view definitions with window functions
---echo #
-
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1 (pk int, c int);
-insert into t1 select a+1,1 from t0;
-update t1 set c=2 where pk not in (1,2,3,4);
-select * from t1;
-
-let $q=
-select pk, c, c/count(*) over (partition by c order by pk
- rows between 1 preceding and 2 following) as CNT
-from t1;
-
-eval $q;
-eval create view v1 as $q;
-show create view v1;
-select * from v1;
-
-let $q=
-select pk, c, c/count(*) over w1 as CNT from t1
- window w1 as (partition by c order by pk rows between 1 preceding and 2 following);
-
-eval $q;
-eval create view v2 as $q;
-show create view v2;
-select * from v2;
-
-let $q=
-select pk, c, c/count(*) over w1 as CNT from t1
- window w1 as (partition by c order by pk rows unbounded preceding);
-
-eval $q;
-eval create view v3 as $q;
-show create view v3;
-select * from v3;
-
-let $q=
-select pk, c, c/count(*) over (partition by c order by pk
- range between 3 preceding and current row) as CNT
-from t1;
-
-eval $q;
-eval create view v4 as $q;
-show create view v4;
-select * from v4;
-
-drop view v1,v2,v3,v4;
-drop table t0,t1;
-
---echo #
---echo # MDEV-10875: window function in subquery
---echo #
-
-CREATE TABLE t1 (i INT);
-INSERT INTO t1 VALUES (3),(1);
-
-CREATE TABLE t2 (c VARCHAR(8));
-INSERT INTO t2 VALUES ('foo'),('bar'),('foo');
-
-SELECT COUNT(*) OVER (PARTITION BY c) FROM t2;
-
-SELECT * FROM t1 WHERE i IN ( SELECT COUNT(*) OVER (PARTITION BY c) FROM t2 );
-
-DROP TABLE t1, t2;
-
---echo #
---echo # MDEV-9976: window function without PARTITION BY and ORDER BY
---echo #
-
-CREATE TABLE t1 (id int, a int);
-INSERT INTO t1 VALUES
- (1,1000), (2,1100), (3,1800), (4,1500), (5,1700), (6,1200),
- (7,2000), (8,2100), (9,1600);
-
---sorted_result
-SELECT id, sum(a) OVER (PARTITION BY id
- ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)
-FROM t1;
-
---sorted_result
-SELECT id, sum(a) OVER (ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)
-FROM t1;
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-11867: window function with aggregation
---echo # over the result of grouping
---echo #
-
-create table t1 (
- username varchar(32),
- amount int
-);
-
-insert into t1 values
-('user1',1),
-('user1',5),
-('user1',3),
-('user2',10),
-('user2',20),
-('user2',30);
-
-select username, sum(amount) as s, avg(sum(amount)) over (order by s desc)
- from t1
-group by username;
-
-select username, sum(amount), avg(sum(amount)) over (order by sum(amount) desc)
- from t1
-group by username;
-
-drop table t1;
-
---echo #
---echo # MDEV-11594: window function over implicit grouping
---echo #
-
-create table t1 (id int);
-insert into t1 values (1), (2), (3), (2);
-
-select sum(id) over (order by sum(id)) from t1;
-
-select sum(sum(id)) over (order by sum(id)) from t1;
-
-drop table t1;
-
---echo #
---echo # MDEV-9923: integer constant in order by list
---echo # of window specification
---echo #
-
-create table t1 (id int);
-insert into t1 values (1), (2), (3), (2);
-
-select rank() over (order by 1) from t1;
-select rank() over (order by 2) from t1;
-select rank() over (partition by id order by 2) from t1;
-
-drop table t1;
-
---echo #
---echo # MDEV-10660: view using a simple window function
---echo #
-
-create table t1 (id int);
-insert into t1 values (1), (2), (3), (2);
-
-create view v1(id,rnk) as
- select id, rank() over (order by id) from t1;
-
-show create view v1;
-
-select id, rank() over (order by id) from t1;
-select * from v1;
-
-drop view v1;
-drop table t1;
-
---echo #
---echo # MDEV-11138: window function in the query without tables
---echo #
-
-select row_number() over ();
-select count(*) over ();
-select sum(5) over ();
-select row_number() over (), sum(5) over ();
-select row_number() over (order by 2);
-select row_number() over (partition by 2);
-select row_number() over (partition by 4 order by 1+2);
-
---echo #
---echo # MDEV-11999: execution of prepared statement for
---echo # tableless query with window functions
---echo #
-
-prepare stmt from
-"select row_number() over (partition by 4 order by 1+2)";
-execute stmt;
-execute stmt;
-deallocate prepare stmt;
-
---echo #
---echo # MDEV-11745: window function with min/max
---echo #
-
-create table t1 (i int, b int);
-insert into t1 values
- (1,1),(2,1),(3,1),(4,4),(5,4),(6,4),(7,8),(8,8),(9,8),(10,8);
-
-select b, min(i) over (partition by b) as f
- from t1 as tt
-order by i;
-
-select b, min(i) over (partition by b) as f
- from (select * from t1) as tt
-order by i;
-
-select b, min(i+10) over (partition by b) as f
- from t1 as tt
-order by i;
-
-select b, min(i) over (partition by b) as f
- from (select i+10 as i, b from t1) as tt
-order by i;
-
-select b, min(i+20) over (partition by b) as f
- from (select i+10 as i, b from t1) as tt
-order by i;
-
-select b, max(i) over (partition by b) as f
- from t1 as tt
-order by i;
-
-select b, max(i) over (partition by b) as f
- from (select * from t1) as tt
-order by i;
-
-select b, max(i+10) over (partition by b) as f
- from t1 as tt
-order by i;
-
-select b, max(i) over (partition by b) as f
- from (select i+10 as i, b from t1) as tt
-order by i;
-
-select b, max(i+20) over (partition by b) as f
- from (select i+10 as i, b from t1) as tt
-order by i;
-
-select max(i), max(i), sum(i), count(i)
- from t1 as tt
-group by b;
-
-select max(i), min(sum(i)) over (partition by count(i)) f
- from t1 as tt
-group by b;
-
-select max(i), min(sum(i)) over (partition by count(i)) f
- from (select * from t1) as tt
-group by b;
-
-select max(i+10), min(sum(i)+10) over (partition by count(i)) f
- from t1 as tt
-group by b;
-
-select max(i), max(i), sum(i), count(i)
- from (select i+10 as i, b from t1) as tt
-group by b;
-
-select max(i), min(sum(i)) over (partition by count(i)) f
- from (select i+10 as i, b from t1) as tt
-group by b;
-
-select max(i), min(i), min(max(i)-min(i)) over (partition by count(i)) f
- from (select i+10 as i, b from t1) as tt
-group by b;
-
-drop table t1;
-
---echo #
---echo # MDEV-12015: window function over select with WHERE
---echo # that is always FALSE
---echo #
-
-CREATE TABLE t1 (i INT);
-INSERT INTO t1 VALUES (3), (1), (2);
-
-SELECT i, ROW_NUMBER() OVER () FROM t1 WHERE 1 = 2;
-
-SELECT i, COUNT(*) OVER () FROM t1 WHERE 1 = 2;
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-12051: window function in query with implicit grouping
---echo # on always empty set
---echo #
-
-create table t1 (a int, b varchar(8));
-insert into t1 values (1,'foo'),(2,'bar');
-
-select max(a), row_number() over () from t1 where a > 10;
-select max(a), sum(max(a)) over () from t1 where a > 10;
-select max(a), sum(max(a)) over (partition by max(a)) from t1 where a > 10;
-
-select max(a), row_number() over () from t1 where 1 = 2;
-select max(a), sum(max(a)) over () from t1 where 1 = 2;
-select max(a), sum(max(a)) over (partition by max(a)) from t1 where 1 = 2;
-
-select max(a), row_number() over () from t1 where 1 = 2
- having max(a) is not null;
-select max(a), sum(max(a)) over () from t1 where 1 = 2
- having max(a) is not null;
-
-drop table t1;
-
---echo #
---echo # MDEV-10885: window function in query with implicit grouping
---echo # with constant condition evaluated to false
---echo #
-
-CREATE TABLE t1 (a INT, b VARCHAR(8));
-INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
-
-CREATE TABLE t2 (c INT);
-INSERT INTO t2 VALUES (3),(4);
-
-CREATE TABLE t3 (d INT);
-INSERT INTO t3 VALUES (5),(6);
-
-SELECT MAX(a), ROW_NUMBER() OVER (PARTITION BY MAX(a)) FROM t1
-WHERE EXISTS ( SELECT * FROM t2 WHERE c IN ( SELECT MAX(d) FROM t3 ) );
-
-SELECT MAX(a), COUNT(MAX(a)) OVER (PARTITION BY MAX(a)) FROM t1
-WHERE EXISTS ( SELECT * FROM t2 WHERE c IN ( SELECT MAX(d) FROM t3 ) );
-
-SELECT MAX(a), SUM(MAX(a)) OVER (PARTITION BY MAX(a)) FROM t1
-WHERE EXISTS ( SELECT * FROM t2 WHERE c IN ( SELECT MAX(d) FROM t3 ) );
-
-SELECT MAX(a), ROW_NUMBER() OVER (PARTITION BY MAX(a)) FROM t1
-WHERE EXISTS ( SELECT * FROM t2 WHERE c IN ( SELECT MAX(d) FROM t3 ) )
-HAVING MAX(a) IS NOT NULL;
-
-SELECT a, MAX(a), ROW_NUMBER() OVER (PARTITION BY b) FROM t1
-WHERE EXISTS ( SELECT * FROM t2 WHERE c IN ( SELECT MAX(d) FROM t3 ) );
-
-SELECT a, COUNT(a), AVG(a) OVER (PARTITION BY b) FROM t1
-WHERE EXISTS ( SELECT * FROM t2 WHERE c IN ( SELECT MAX(d) FROM t3 ) );
-
-SELECT a, MAX(a), AVG(a) OVER (PARTITION BY b) FROM t1
-WHERE EXISTS ( SELECT * FROM t2 WHERE c IN ( SELECT MAX(d) FROM t3 ) );
-
-DROP TABLE t1,t2,t3;
-
---echo #
---echo # MDEV-10859: Wrong result of aggregate window function in query
---echo # with HAVING and no ORDER BY
---echo #
-
-create table empsalary (depname varchar(32), empno smallint primary key, salary int);
-insert into empsalary values
- ('develop', 1, 5000), ('develop', 2, 4000),('sales', 3, '6000'),('sales', 4, 5000);
-
---sorted_result
-SELECT depname, empno, salary, avg(salary) OVER (PARTITION BY depname) FROM empsalary;
---sorted_result
-SELECT depname, empno, salary, avg(salary) OVER (PARTITION BY depname) FROM empsalary ORDER BY depname;
---echo #
---echo # These last 2 should have the same row results, ignoring order.
---echo #
---sorted_result
-SELECT depname, empno, salary, avg(salary) OVER (PARTITION BY depname) FROM empsalary HAVING empno > 1;
---sorted_result
-SELECT depname, empno, salary, avg(salary) OVER (PARTITION BY depname) FROM empsalary HAVING empno > 1 ORDER BY depname;
-
-drop table empsalary;
-
---echo #
---echo # MDEV-11868: min(distinct) over () returns wrong value
---echo #
-
-create table TDEC (CDEC int, RNUM int);
-create view VDEC as select * from TDEC;
-insert into TDEC (CDEC) values (null),(-1),(0),(1),(0),(10);
-select TDEC.CDEC, min(TDEC.CDEC) over () from TDEC;
-select VDEC.CDEC, min(VDEC.CDEC) over () from VDEC;
-select TDEC.CDEC, max(TDEC.CDEC) over () from TDEC;
-select VDEC.CDEC, max(VDEC.CDEC) over () from VDEC;
-
-select TDEC.CDEC, min(distinct TDEC.CDEC) over () from TDEC;
-select VDEC.CDEC, min(distinct VDEC.CDEC) over () from VDEC;
-select TDEC.CDEC, max(distinct TDEC.CDEC) over () from TDEC;
-select VDEC.CDEC, max(distinct VDEC.CDEC) over () from VDEC;
-
---echo #
---echo # These should be removed once support for them is added.
---echo #
---error ER_NOT_SUPPORTED_YET
-select TDEC.CDEC, count(distinct TDEC.CDEC) over () from TDEC;
---error ER_NOT_SUPPORTED_YET
-select VDEC.CDEC, count(distinct VDEC.CDEC) over () from VDEC;
---error ER_NOT_SUPPORTED_YET
-select TDEC.CDEC, sum(distinct TDEC.CDEC) over () from TDEC;
---error ER_NOT_SUPPORTED_YET
-select VDEC.CDEC, sum(distinct VDEC.CDEC) over () from VDEC;
---error ER_NOT_SUPPORTED_YET
-select TDEC.CDEC, avg(distinct TDEC.CDEC) over () from TDEC;
---error ER_NOT_SUPPORTED_YET
-select VDEC.CDEC, avg(distinct VDEC.CDEC) over () from VDEC;
---error ER_NOT_SUPPORTED_YET
-select TDEC.CDEC, GROUP_CONCAT(TDEC.CDEC) over () from TDEC;
---error ER_NOT_SUPPORTED_YET
-select VDEC.CDEC, GROUP_CONCAT(distinct VDEC.CDEC) over () from VDEC;
-
-drop table TDEC;
-drop view VDEC;
-
---echo #
---echo # MDEV-10700: 10.2.2 windowing function returns incorrect result
---echo #
-create table t(a int,b int, c int , d int);
-insert into t(a,b,c,d) values(1, rand(10)*1000, rand(10)*1000, rand(10)*1000);
-insert into t(a,b,c,d) values(1, rand(10)*1000, rand(10)*1000, rand(10)*1000);
-replace into t(a,b,c,d) select 1, rand(10)*1000, rand(10)*1000, rand(10)*1000 from t t1, t t2, t t3, t t4, t t5, t t6, t t7, t t8, t t9, t t10, t t11, t t12, t t13, t t14, t t15, t t16, t t17;
-
-select count(distinct s) from (select sum(d) over(partition by a,b,c) as s from t) Z where s > 0;
-select count(distinct s) from (select sum(d) as s from t group by a,b,c) Z where s > 0;
-
-select count(distinct s) from (select sum(d) over(partition by a,b) as s from t) Z where s > 0;
-select count(distinct s) from (select sum(d) as s from t group by a,b) Z where s > 0;
-
-select count(distinct s) from (select sum(d) over(partition by a) as s from t) Z where s > 0;
-select count(distinct s) from (select sum(d) as s from t group by a) Z where s > 0;
-
-drop table t;
-
---echo #
---echo # MDEV-9924: window function in query with group by optimized away
---echo #
-
-create table t1 (i int);
-insert into t1 values (2),(3),(1);
-
-select row_number() over () from t1 group by 1+2;
-select max(i), row_number() over () from t1 group by 1+2;
-select rank() over (order by max(i)) from t1 group by 1+2;
-
-select i, row_number() over () from t1 group by 1+2;
-select i, rank() over (order by i) rnk from t1 group by 1+2;
-
-drop table t1;
-
---echo #
---echo # MDEV-11907: window function as the second operand of division
---echo #
-
-create table t1 (pk int, c int);
-insert into t1 values (1,1),(2,1),(3,1),(4,1),(5,2);
-
-set @sql_mode_save= @@sql_mode;
-set sql_mode='ERROR_FOR_DIVISION_BY_ZERO';
-
-select pk, c, c/count(*) over
- (partition by c order by pk
- rows between 1 preceding and 2 following) as CNT
-from t1;
-show warnings;
-
-set sql_mode=@sql_mode_save;
-
-drop table t1;
-
---echo #
---echo # MDEV-12336: several functions over a window function
---echo #
-
-create table t1 (name varchar(10), cnt int);
-insert into t1 values ('Fred', 23), ('Fred', 35), ('Joe', 10);
-
-select q.name, q.row_cnt,
- round( 100 * ( q.row_cnt /
- sum(q.row_cnt) over
- (
- order by q.name
- rows between
- unbounded preceding and
- unbounded following
- )
- ),2
- ) pct_of_total
-from
-(
- select name, count(*) row_cnt, sum(cnt) sum_cnt
- from t1
- group by 1
-) q;
-
-drop table t1;
-
---echo #
---echo # MDEV-11990: window function over min/max aggregation
---echo #
-
-create table t1 (id int);
-insert into t1 values (1), (2), (3), (2), (4), (2);
-
-select sum(max(id)) over (order by max(id)) from t1;
-explain
-select sum(max(id)) over (order by max(id)) from t1;
-
-create index idx on t1(id);
-select sum(max(id)) over (order by max(id)) from t1;
-explain
-select sum(max(id)) over (order by max(id)) from t1;
-select sum(max(id)) over (order by max(id)) from t1 where id < 3;
-select count(max(id)) over (order by max(id)) from t1 where id < 3;
-select max(id), rank() over (order by max(id)) from t1 where id < 3;
-
-drop table t1;
-
---echo #
---echo # main.win failure post MDEV-12336
---echo #
-create table t(a decimal(35,10), b int);
-insert into t values (1, 10), (2, 20), (3, 30);
-
-prepare stmt from "SELECT (CASE WHEN sum(t.a) over (partition by t.b)=1 THEN 1000 ELSE 300 END) AS a FROM t";
-execute stmt;
-drop table t;
-
---echo #
---echo # MDEV-12851 case with window functions query crashes server
---echo #
-
-create table t1(dt datetime);
-insert into t1 values ('2017-05-17'), ('2017-05-18');
-select dt,
- case when (max(dt) over (order by dt rows between 1 following and 1 following) is null)
- then '9999-12-31 12:00:00'
- else max(dt) over (order by dt rows between 1 following and 1 following)
- end x,
- case when (max(dt) over (order by dt rows between 1 following and 1 following) is not null)
- then '9999-12-31 12:00:00'
- else max(dt) over (order by dt rows between 1 following and 1 following)
- end x
-from t1;
-
-drop table t1;
-
-create table t1(i int);
-insert into t1 values (null),(1),(2);
-select max(i) over (order by i),
- max(i) over (order by i) is null,
- max(i) over (order by i) is not null
-from t1;
-drop table t1;
-
---echo #
---echo # MDEV-13189: Window functions crash when using INTERVAL function
---echo #
-create table t1(i int);
-insert into t1 values (1),(2),(10),(20),(30);
-select sum(i) over (order by i), interval(sum(i) over (order by i), 10, 20)
-from t1;
-drop table t1;
-
---echo #
---echo # MDEV-13352: Server crashes in st_join_table::remove_duplicates
---echo #
-CREATE TABLE t1 (i INT);
-INSERT INTO t1 VALUES (1),(2);
-SELECT DISTINCT ROW_NUMBER() OVER(), i FROM t1 WHERE 0;
-SELECT ROW_NUMBER() OVER(), i FROM t1 WHERE 0;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-13344: Server crashes in in AGGR_OP::put_record on subquery
---echo # with window function and constant table
---echo # (Testcase only)
---echo #
-CREATE TABLE t1 (c CHAR(8)) ENGINE=MyISAM;
-INSERT IGNORE INTO t1 VALUES ('foo');
-SELECT ('bar',1) IN ( SELECT c, ROW_NUMBER() OVER (PARTITION BY c) FROM t1);
-DROP TABLE t1;
-
---echo #
---echo # MDEV-13351: Server crashes in st_select_lex::set_explain_type upon UNION with window function
---echo #
-CREATE TABLE t1 (i INT);
-INSERT INTO t1 VALUES (1),(2);
-SELECT Nth_value(i,1) OVER() FROM t1
-UNION ALL
-( SELECT Nth_value(i,2) OVER() FROM t1 LIMIT 0 )
-;
-DROP TABLE t1;
-
---echo #
---echo # A regression after MDEV-13351:
---echo # MDEV-13374 : Server crashes in first_linear_tab / st_select_lex::set_explain_type
---echo # upon UNION with aggregate function
---echo #
-
-CREATE TABLE t1 (i INT) ENGINE=MyISAM;
-INSERT INTO t1 VALUES (1),(2);
-SELECT i AS fld FROM t1 UNION SELECT COUNT(*) AS fld FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-13240 Wrong warning with MAX(datetime_field) OVER (...)
---echo #
-
-CREATE TABLE t1 (dt DATETIME);
-INSERT INTO t1 VALUES ('2017-05-17');
-SELECT MAX(dt) OVER (ORDER BY dt ROWS BETWEEN 1 FOLLOWING AND 1 FOLLOWING) FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # MDEV-13358 FIRST_VALUE throws SQL Error (1292): Incorrect datetime value
---echo #
-CREATE TABLE IF NOT EXISTS `fv_test` (
- `SOME_DATE` datetime NOT NULL
- );
-
-INSERT INTO `fv_test` (`SOME_DATE`) VALUES ('2017-07-20 12:47:56');
-
-CREATE TABLE fv_result
-SELECT
-FIRST_VALUE(SOME_DATE) OVER(ORDER BY SOME_DATE DESC) AS somedate
-FROM fv_test;
-
-SHOW CREATE TABLE fv_result;
-
-SELECT * FROM fv_result;
-
-DROP TABLE fv_test, fv_result;
-
---echo #
---echo # MDEV-13649: Server crashes in set_field_to_null_with_conversions or in Field::set_notnull
---echo #
-
-CREATE TABLE t1 (a int);
-INSERT INTO t1 VALUES (0),(1),(2);
-SELECT LEAD(a) OVER (PARTITION BY a) as lead,
- a AND LEAD(a) OVER (PARTITION BY a) AS a_and_lead_part
-FROM t1;
-
-SELECT a OR LEAD(a) OVER (ORDER BY a) AS a_or_lead_order
-FROM t1
-ORDER BY a;
-
-SELECT a AND LEAD(a) OVER (ORDER BY a) AS a_and_lead_order
-FROM t1
-ORDER BY a;
-
-SELECT a XOR LEAD(a) OVER (ORDER BY a) AS a_xor_lead_order
-FROM t1
-ORDER BY a;
-
-SELECT NOT LEAD(a) OVER (ORDER BY a) AS not_lead_order
-FROM t1
-ORDER BY a;
-
-SELECT LEAD(a) OVER (ORDER BY a) is not null AS is_not_null_lead_order
-FROM t1
-ORDER BY a;
-
-drop table t1;
-
---echo #
---echo # MDEV-13354: Server crashes in find_field_in_tables upon PS with window function and subquery
---echo #
-
-CREATE TABLE t1 (i INT, a char);
-INSERT INTO t1 VALUES (1, 'a'),(2, 'b');
-PREPARE stmt FROM "SELECT row_number() over (partition by i order by i), i FROM (SELECT * from t1) as sq";
-EXECUTE stmt;
-
-DROP TABLE t1;
-
---echo #
---echo # MDEV-13384: "window" seems like a reserved column name but it's not listed as one
---echo #
---echo # Currently we allow window as an identifier, except for table aliases.
---echo #
-
-CREATE TABLE door (id INT, window VARCHAR(10));
-
---error ER_PARSE_ERROR
-SELECT id
-FROM door as window;
-
-SELECT id, window
-FROM door;
-
---error ER_PARSE_ERROR
-SELECT id, window
-FROM door as window;
-
-DROP TABLE door;
-
---echo #
---echo # MDEV-13352: Server crashes in st_join_table::remove_duplicates
---echo #
-CREATE TABLE t1 (i INT);
-INSERT INTO t1 VALUES (1),(2);
-SELECT DISTINCT ROW_NUMBER() OVER(), i FROM t1 WHERE 0;
-SELECT ROW_NUMBER() OVER(), i FROM t1 WHERE 0;
-DROP TABLE t1;
-
---echo #
---echo # Start of 10.3 tests
---echo #
diff --git a/mysql-test/t/win_as_arg_to_aggregate_func.test b/mysql-test/t/win_as_arg_to_aggregate_func.test
deleted file mode 100644
index 93c9238bedf..00000000000
--- a/mysql-test/t/win_as_arg_to_aggregate_func.test
+++ /dev/null
@@ -1,139 +0,0 @@
-create table t1 (i int);
-insert into t1 values (5),(6),(0);
-
---echo #
---echo # Try out all set functions with window functions as arguments.
---echo # Any such usage should return an error.
---echo #
---error ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
-select MIN( SUM(i) OVER (order by i) )
-from t1;
-
---error ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
-select MIN(DISTINCT SUM(i) OVER (order by i) )
-from t1;
-
---error ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
-select MAX( SUM(i) OVER (order by i) )
-from t1;
-
---error ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
-select MAX(DISTINCT SUM(i) OVER (order by i) )
-from t1;
-
---error ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
-select SUM( SUM(i) OVER (order by i) )
-from t1;
-
---error ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
-select SUM(DISTINCT SUM(i) OVER (order by i) )
-from t1;
-
-
---error ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
-select AVG( SUM(i) OVER (order by i) )
-from t1;
-
---error ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
-select AVG(DISTINCT SUM(i) OVER (order by i) )
-from t1;
-
---error ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
-select COUNT( SUM(i) OVER (order by i) )
-from t1;
-
---error ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
-select COUNT(DISTINCT SUM(i) OVER (order by i) )
-from t1;
-
---error ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
-select BIT_AND( SUM(i) OVER (order by i) )
-from t1;
-
---error ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
-select BIT_OR( SUM(i) OVER (order by i) )
-from t1;
-
---error ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
-select BIT_XOR( SUM(i) OVER (order by i) )
-from t1;
-
---error ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
-select STD( SUM(i) OVER (order by i) )
-from t1;
-
---error ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
-select STDDEV( SUM(i) OVER (order by i) )
-from t1;
-
---error ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
-select STDDEV_POP( SUM(i) OVER (order by i) )
-from t1;
-
---error ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
-select STDDEV_SAMP(SUM(i) OVER (order by i) )
-from t1;
-
---error ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
-select VARIANCE(SUM(i) OVER (order by i) )
-from t1;
-
---error ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
-select VAR_POP(SUM(i) OVER (order by i) )
-from t1;
-
---error ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
-select VAR_SAMP(SUM(i) OVER (order by i) )
-from t1;
-
---error ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
-select GROUP_CONCAT(SUM(i) OVER (order by i) )
-from t1;
-
---error ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
-select GROUP_CONCAT(DISTINCT SUM(i) OVER (order by i) )
-from t1;
-
---echo #
---echo # Test that partition instead of order by in over doesn't change result.
---echo #
-
---error ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
-select SUM( SUM(i) OVER (PARTITION BY i) )
-from t1;
-
---echo #
---echo # Test that no arguments in OVER() clause lead to crash in this case.
---echo #
---error ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
-select SUM( SUM(i) OVER () )
-from t1;
-drop table t1;
-
--- echo #
--- echo # MDEV-13774: Server Crash on Execuate of SQL Statement
--- echo #
-create table t1 (i int);
-insert into t1 values (5),(6),(0);
-
---error ER_SUM_FUNC_WITH_WINDOW_FUNC_AS_ARG
-select SUM(
- IF( SUM( IF(i,1,0)) OVER (PARTITION BY i) > 0
- AND
- SUM( IF(i,1,0)) OVER (PARTITION BY i) > 0,
- 1,
- 0) )
-from t1;
-
---echo #
---echo # A way to get the aggregation result.
---echo #
-
-select i, IF(SUM(IF(i,1,0)) OVER (PARTITION BY i) > 0 AND SUM( IF(i,1,0)) OVER (PARTITION BY i) > 0,1,0) AS if_col
-from t1
-order by i;
-
-select sum(if_col)
-from (select IF(SUM(IF(i,1,0)) OVER (PARTITION BY i) > 0 AND SUM( IF(i,1,0)) OVER (PARTITION BY i) > 0,1,0) AS if_col
- from t1) tmp;
-drop table t1;
diff --git a/mysql-test/t/win_avg.test b/mysql-test/t/win_avg.test
deleted file mode 100644
index 23a3652d943..00000000000
--- a/mysql-test/t/win_avg.test
+++ /dev/null
@@ -1,47 +0,0 @@
-create table t1 (
- pk int primary key,
- a int,
- b int,
- c real
-);
-
-
-insert into t1 values
-(101 , 0, 10, 1.1),
-(102 , 0, 10, 2.1),
-(103 , 1, 10, 3.1),
-(104 , 1, 10, 4.1),
-(108 , 2, 10, 5.1),
-(105 , 2, 20, 6.1),
-(106 , 2, 20, 7.1),
-(107 , 2, 20, 8.15),
-(109 , 4, 20, 9.15),
-(110 , 4, 20, 10.15),
-(111 , 5, NULL, 11.15),
-(112 , 5, 1, 12.25),
-(113 , 5, NULL, 13.35),
-(114 , 5, NULL, 14.50),
-(115 , 5, NULL, 15.65),
-(116 , 6, 1, NULL),
-(117 , 6, 1, 10),
-(118 , 6, 1, 1.1),
-(119 , 6, 1, NULL),
-(120 , 6, 1, NULL),
-(121 , 6, 1, NULL),
-(122 , 6, 1, 2.2),
-(123 , 6, 1, 20.1),
-(124 , 6, 1, -10.4),
-(125 , 6, 1, NULL),
-(126 , 6, 1, NULL),
-(127 , 6, 1, NULL);
-
-
---sorted_result
-select pk, a, b, avg(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING)
-from t1;
-
---sorted_result
-select pk, a, c, avg(c) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING)
-from t1;
-
-drop table t1;
diff --git a/mysql-test/t/win_big-mdev-10092.test b/mysql-test/t/win_big-mdev-10092.test
deleted file mode 100644
index 090d43b0b7b..00000000000
--- a/mysql-test/t/win_big-mdev-10092.test
+++ /dev/null
@@ -1,103 +0,0 @@
---echo #
---echo # MDEV-10092: Server crashes in in ha_heap::rnd_pos / Table_read_cursor::get_next
---echo #
-
-CREATE TABLE `orders` (
- `o_orderkey` int(11) NOT NULL,
- `o_custkey` double DEFAULT NULL,
- `o_orderstatus` char(1) DEFAULT NULL,
- `o_totalprice` double DEFAULT NULL,
- `o_orderDATE` date DEFAULT NULL,
- `o_orderpriority` char(15) DEFAULT NULL,
- `o_clerk` char(15) DEFAULT NULL,
- `o_shippriority` int(11) DEFAULT NULL,
- `o_comment` varchar(79) DEFAULT NULL,
- KEY `i_o_orderdate` (`o_orderDATE`),
- KEY `i_o_custkey` (`o_custkey`)
-) DEFAULT CHARSET=latin1;
-
-delimiter //;
-
-create procedure add_data()
-begin
-INSERT INTO `orders` VALUES (593793,3220,'O',181553.02,'1996-10-12','5-LOW','Clerk#000000921',0,'carefully unusual instructions are final pl');
-INSERT INTO `orders` VALUES (593794,4681,'F',32306.35,'1994-03-15','2-HIGH','Clerk#000000776',0,'slyly ironic depths are blithely. final excuses across the unusual instruction');
-INSERT INTO `orders` VALUES (593795,7213,'O',206579.47,'1998-03-04','2-HIGH','Clerk#000000746',0,'ruthlessly regular theodolites atop the blith');
-INSERT INTO `orders` VALUES (593796,10486,'F',181299.81,'1993-01-13','3-MEDIUM','Clerk#000000787',0,'special theodolites detect slyly. p');
-INSERT INTO `orders` VALUES (593797,3316,'O',208149.32,'1996-12-22','1-URGENT','Clerk#000000355',0,'carefully silent theodolites use blithely acco');
-INSERT INTO `orders` VALUES (593798,1613,'F',254625.5,'1995-01-26','2-HIGH','Clerk#000000504',0,'fluffily even requests ar');
-INSERT INTO `orders` VALUES (593799,4418,'F',45122.99,'1993-07-12','1-URGENT','Clerk#000000838',0,'blithely ironic ideas boost furiously above the ironic foxes. special pac');
-INSERT INTO `orders` VALUES (593824,12013,'F',216314.23,'1992-02-28','1-URGENT','Clerk#000000074',0,'quickly furious requests play above the fur');
-INSERT INTO `orders` VALUES (593825,8101,'O',123101.26,'1997-01-23','5-LOW','Clerk#000000649',0,'regular deposits haggle after the carefully i');
-INSERT INTO `orders` VALUES (593826,6958,'O',280097.59,'1995-12-14','2-HIGH','Clerk#000000080',0,'slyly even ideas about the slyly pending escapades cajole above th');
-INSERT INTO `orders` VALUES (593827,14116,'O',103011.78,'1995-12-16','3-MEDIUM','Clerk#000000567',0,'blithely bold decoys are furiously. fluffy deposits serve flu');
-INSERT INTO `orders` VALUES (593828,6839,'F',106697.51,'1993-12-11','4-NOT SPECIFIED','Clerk#000000065',0,'carefully final theodolites wake quickly final theodolites! unus');
-INSERT INTO `orders` VALUES (593829,14605,'O',44147.73,'1997-02-18','3-MEDIUM','Clerk#000000474',0,'ironic requests use carefully against the iro');
-INSERT INTO `orders` VALUES (593830,12976,'F',167393.6,'1994-06-21','1-URGENT','Clerk#000000424',0,'dolphins haggle careful');
-INSERT INTO `orders` VALUES (593831,14107,'O',208417.51,'1997-11-18','4-NOT SPECIFIED','Clerk#000000336',0,'furiously express pinto beans after the blithely pending requests need to ');
-INSERT INTO `orders` VALUES (593856,5623,'O',143236.09,'1998-03-24','5-LOW','Clerk#000000382',0,'carefully ironic accounts impress slyly according to the ironic');
-INSERT INTO `orders` VALUES (593857,1828,'O',217673.82,'1996-01-12','1-URGENT','Clerk#000000060',0,'special, special pinto beans haggle blithely. blithel');
-INSERT INTO `orders` VALUES (593858,14755,'O',8032.07,'1997-07-20','4-NOT SPECIFIED','Clerk#000000110',0,'regular excuses use ironic pinto ');
-INSERT INTO `orders` VALUES (593859,8780,'F',356852.14,'1992-10-09','2-HIGH','Clerk#000000510',0,'furiously regular accounts eat across the carefully ');
-INSERT INTO `orders` VALUES (593860,13318,'O',18413.14,'1998-01-10','2-HIGH','Clerk#000000673',0,'pending pains cajole furiously alo');
-INSERT INTO `orders` VALUES (593861,1175,'O',28859.21,'1996-09-10','4-NOT SPECIFIED','Clerk#000000680',0,'carefully silent instructi');
-INSERT INTO `orders` VALUES (593862,7787,'F',202891.72,'1992-02-27','5-LOW','Clerk#000000988',0,'slyly express requests sleep. express dependencies wake bli');
-INSERT INTO `orders` VALUES (593863,1897,'O',33062.05,'1998-06-29','1-URGENT','Clerk#000000117',0,'accounts integrate carefully across the fluffily even warhorses');
-INSERT INTO `orders` VALUES (593888,5656,'O',20952.26,'1997-02-04','3-MEDIUM','Clerk#000000735',0,'requests could have to cajole about the special, final ');
-INSERT INTO `orders` VALUES (593889,2692,'F',282718.42,'1992-08-02','4-NOT SPECIFIED','Clerk#000000669',0,'regular deposits haggle fluff');
-INSERT INTO `orders` VALUES (593890,3685,'O',34012.74,'1996-06-17','5-LOW','Clerk#000000993',0,'furiously even requests');
-INSERT INTO `orders` VALUES (593891,10333,'F',182791.4,'1993-01-23','4-NOT SPECIFIED','Clerk#000000098',0,'slyly final platelets doubt');
-INSERT INTO `orders` VALUES (593892,5687,'F',224381.48,'1994-09-18','2-HIGH','Clerk#000000294',0,'blithely bold epitaphs sleep after the carefully express in');
-INSERT INTO `orders` VALUES (593893,5437,'F',124300.91,'1993-08-04','4-NOT SPECIFIED','Clerk#000000302',0,'daring instructions alongside of the si');
-INSERT INTO `orders` VALUES (593894,1732,'F',150438.64,'1993-11-07','3-MEDIUM','Clerk#000000046',0,'quickly special accounts integrate by the even, dogged platelets? slowly ');
-INSERT INTO `orders` VALUES (593895,12230,'O',47380.97,'1997-03-23','2-HIGH','Clerk#000000168',0,'fluffily permanent instructions alongside of the furiously even pack');
-INSERT INTO `orders` VALUES (593920,13871,'F',2919.68,'1992-01-29','5-LOW','Clerk#000000597',0,'quickly regular foxes across the furiously bold accounts wake car');
-INSERT INTO `orders` VALUES (593921,6664,'F',139065.79,'1992-04-21','5-LOW','Clerk#000000017',0,'fluffily final deposits are carefully. quickly special pinto beans bel');
-INSERT INTO `orders` VALUES (593922,2504,'O',179041.45,'1997-04-05','2-HIGH','Clerk#000000902',0,'final pinto beans are furiously. ');
-INSERT INTO `orders` VALUES (593923,4978,'O',258843,'1998-02-27','1-URGENT','Clerk#000000654',0,'carefully final asymptotes according to the regular dependencie');
-INSERT INTO `orders` VALUES (593924,7550,'O',232280.81,'1995-10-28','3-MEDIUM','Clerk#000000063',0,'fluffily ironic packages haggle carefully pending platelets. q');
-INSERT INTO `orders` VALUES (593925,12226,'O',319755.48,'1995-09-01','3-MEDIUM','Clerk#000000308',0,'quickly pending packages throughout the quickly unusual requests');
-INSERT INTO `orders` VALUES (593926,2819,'F',204662.4,'1994-11-07','4-NOT SPECIFIED','Clerk#000000298',0,'blithely special grouches cajole ironic instructions. slyly pendin');
-INSERT INTO `orders` VALUES (593927,593,'F',188162.64,'1995-03-04','1-URGENT','Clerk#000000263',0,'express, unusual deposits boost furiously after the unusual dolphi');
-INSERT INTO `orders` VALUES (593952,9362,'P',318688.16,'1995-03-05','4-NOT SPECIFIED','Clerk#000000468',0,'ruthless requests must have to are carefully? special pa');
-INSERT INTO `orders` VALUES (593953,11410,'O',166717.28,'1998-07-29','5-LOW','Clerk#000000509',0,'even, regular instructions snooze. slyly ironic packages nag fluffily.');
-INSERT INTO `orders` VALUES (593954,8875,'O',132909.37,'1996-08-29','3-MEDIUM','Clerk#000000825',0,'special decoys integrate carefully. care');
-INSERT INTO `orders` VALUES (593955,12494,'O',73329.07,'1995-08-05','1-URGENT','Clerk#000000561',0,'quickly special request');
-INSERT INTO `orders` VALUES (593956,1390,'O',187837.11,'1995-10-17','5-LOW','Clerk#000000797',0,'silent, pending foxes');
-INSERT INTO `orders` VALUES (593957,10106,'F',196969.46,'1993-04-03','2-HIGH','Clerk#000000566',0,'blithely ruthless excuses boost slyly about the requests. careful');
-INSERT INTO `orders` VALUES (593958,14770,'F',103528.82,'1993-12-27','3-MEDIUM','Clerk#000000598',0,'carefully special deposits eat above the q');
-INSERT INTO `orders` VALUES (593959,14566,'O',156600.32,'1996-11-16','2-HIGH','Clerk#000000030',0,'accounts are quickly bold packages. carefully ironic depos');
-INSERT INTO `orders` VALUES (593984,4924,'O',47149.15,'1995-05-06','3-MEDIUM','Clerk#000000120',0,'regular asymptotes haggle slyly abo');
-INSERT INTO `orders` VALUES (593985,5185,'O',152533.91,'1997-08-04','3-MEDIUM','Clerk#000000575',0,'blithely special dolphins are even requests. carefully eve');
-INSERT INTO `orders` VALUES (593986,14257,'O',109734.28,'1998-06-05','3-MEDIUM','Clerk#000000930',0,'carefully final instructions against the slyly');
-INSERT INTO `orders` VALUES (593987,5818,'F',64541.52,'1994-04-13','3-MEDIUM','Clerk#000000259',0,'slyly pending deposits are furiously. regular requests h');
-INSERT INTO `orders` VALUES (593988,1178,'F',249608.42,'1994-10-01','2-HIGH','Clerk#000000266',0,'fluffily regular foxes toward the furiously bold accounts sleep furiously');
-INSERT INTO `orders` VALUES (593989,5173,'P',61508.55,'1995-03-02','2-HIGH','Clerk#000000374',0,'slyly express deposits wake between ');
-INSERT INTO `orders` VALUES (593990,8395,'O',129696.17,'1997-12-30','4-NOT SPECIFIED','Clerk#000000570',0,'carefully final requests haggle furiously fluffily final accou');
-INSERT INTO `orders` VALUES (593991,1894,'O',145691.27,'1998-04-09','5-LOW','Clerk#000000294',0,'slyly final notornis haggle carefull');
-INSERT INTO `orders` VALUES (594016,14935,'F',144592.29,'1992-10-20','3-MEDIUM','Clerk#000000602',0,'furiously express ideas cajole quickl');
-INSERT INTO `orders` VALUES (594017,892,'F',147267.55,'1994-12-10','1-URGENT','Clerk#000000419',0,'close, pending packages affix blithely. slyly regular reque');
-end;
-//
-
-delimiter ;//
-call add_data();
-call add_data();
-set sort_buffer_size = 1024;
-
-flush status;
-select o_custkey, Avg(o_custkey) OVER ( ORDER BY o_custkey ) from orders;
-select variable_name,
- case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
-from information_schema.session_status
-where variable_name like 'Sort_merge_passes';
-
-flush status;
-select o_custkey, Avg(o_custkey) OVER ( ORDER BY o_custkey RANGE CURRENT ROW ) from orders;
-select variable_name,
- case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
-from information_schema.session_status
-where variable_name like 'Sort_merge_passes';
-
-drop table orders;
-drop procedure add_data;
diff --git a/mysql-test/t/win_big-mdev-11697.test b/mysql-test/t/win_big-mdev-11697.test
deleted file mode 100644
index 7103b8522be..00000000000
--- a/mysql-test/t/win_big-mdev-11697.test
+++ /dev/null
@@ -1,50 +0,0 @@
-create table test_table (id int, random_data varchar(36), static_int int, static_varchar varchar(10));
-
-insert into test_table(id, random_data, static_int, static_varchar)
-select id, random_data, 42, 'Hello'
- from (
- with recursive data_generator(id, random_data) as (
- select 1 as id, uuid() as random_data
- union all
- select id + 1, uuid() from data_generator where id < 1000
- )
- select * from data_generator
- ) as a;
-
-commit;
-
-analyze table test_table;
-
-explain select * from (select id, lead(id) over(order by id) next_id from test_table order by id) a limit 10;
-
-select * from (select id, lead(id) over(order by id) next_id from test_table order by id) a limit 10;
-
-drop table if exists test_table;
-
-create table test_table (id int, random_data varchar(36), static_int int, static_varchar varchar(10));
-
-insert into test_table(id, random_data, static_int, static_varchar)
-select id, random_data, 42, 'Hello'
- from (
- with recursive data_generator(id, random_data) as (
- select 1 as id, uuid() as random_data
- union all
- select id + 1, uuid() from data_generator where id < 100000
- )
- select * from data_generator
- ) as a;
-
-commit;
-
-analyze table test_table;
-
-explain select * from (select id, lead(id) over(order by id) next_id from test_table order by id) a limit 10;
-
-flush status;
-select * from (select id, lead(id) over(order by id) next_id from test_table order by id) a limit 10;
-select variable_name,
- case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
-from information_schema.session_status
-where variable_name like 'Sort_merge_passes';
-
-drop table test_table;
diff --git a/mysql-test/t/win_big.test b/mysql-test/t/win_big.test
deleted file mode 100644
index 09c8d640b09..00000000000
--- a/mysql-test/t/win_big.test
+++ /dev/null
@@ -1,123 +0,0 @@
-#
-# Tests for window functions over big datasets.
-# "Big" here is "big enough so that filesort result doesn't fit in a
-# memory buffer".
-#
-#
-
-create table t0 (a int);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1(a int);
-insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
-
-create table t10 (a int, b int, c int);
-insert into t10
-select
- A.a + 1000*B.a,
- A.a + 1000*B.a,
- A.a + 1000*B.a
-from t1 A, t0 B
-order by A.a+1000*B.a;
-
---echo #################################################################
---echo ## Try a basic example
-flush status;
-create table t21 as
-select
- sum(b) over (order by a rows between 2 preceding and 2 following) as SUM_B
-from
- t10;
-select variable_name,
- case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
-from information_schema.session_status
-where variable_name like 'Sort_merge_passes';
-
-set sort_buffer_size=1024;
-flush status;
-create table t22 as
-select
- sum(b) over (order by a rows between 2 preceding and 2 following) as SUM_B
-from
- t10;
-select variable_name,
- case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
-from information_schema.session_status
-where variable_name like 'Sort_merge_passes';
-
-let $diff_tables= t21, t22;
-source include/diff_tables.inc;
-drop table t21, t22;
-
---echo #################################################################
---echo # Try many cursors
-set sort_buffer_size=default;
-flush status;
-create table t21 as
-select
- sum(b) over (order by a rows between 2 preceding and 2 following) as SUM_B1,
- sum(b) over (order by a rows between 5 preceding and 5 following) as SUM_B2,
- sum(b) over (order by a rows between 20 preceding and 20 following) as SUM_B3
-from
- t10;
-select variable_name,
- case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
-from information_schema.session_status
-where variable_name like 'Sort_merge_passes';
-
-set sort_buffer_size=1024;
-flush status;
-create table t22 as
-select
- sum(b) over (order by a rows between 2 preceding and 2 following) as SUM_B1,
- sum(b) over (order by a rows between 5 preceding and 5 following) as SUM_B2,
- sum(b) over (order by a rows between 20 preceding and 20 following) as SUM_B3
-from
- t10;
-select variable_name,
- case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
-from information_schema.session_status
-where variable_name like 'Sort_merge_passes';
-
-let $diff_tables= t21, t22;
-source include/diff_tables.inc;
-drop table t21, t22;
-
---echo #################################################################
---echo # Try having cursors pointing at different IO_CACHE pages
---echo # in the IO_CACHE
-set sort_buffer_size=default;
-flush status;
-create table t21 as
-select
- a,
- sum(b) over (order by a range between 5000 preceding and 5000 following) as SUM_B1
-from
- t10;
-
-select variable_name,
- case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
-from information_schema.session_status
-where variable_name like 'Sort_merge_passes';
-
-set sort_buffer_size=1024;
-flush status;
-create table t22 as
-select
- a,
- sum(b) over (order by a range between 5000 preceding and 5000 following) as SUM_B1
-from
- t10;
-select variable_name,
- case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end
-from information_schema.session_status
-where variable_name like 'Sort_merge_passes';
-
-let $diff_tables= t21, t22;
-source include/diff_tables.inc;
-drop table t21, t22;
---echo #################################################################
-
-drop table t10;
-drop table t0,t1;
-
diff --git a/mysql-test/t/win_bit.test b/mysql-test/t/win_bit.test
deleted file mode 100644
index f077d0d67a0..00000000000
--- a/mysql-test/t/win_bit.test
+++ /dev/null
@@ -1,89 +0,0 @@
-create table t1 (
- pk int primary key,
- a int,
- b int
-);
-
-create table t2 (
- pk int primary key,
- a int,
- b int
-);
-
-
-
-insert into t1 values
-( 1 , 0, 1),
-( 2 , 0, 2),
-( 3 , 1, 4),
-( 4 , 1, 8),
-( 5 , 2, 32),
-( 6 , 2, 64),
-( 7 , 2, 128),
-( 8 , 2, 16);
-
-insert into t2 values
-( 1 , 0, 2),
-( 2 , 0, 2),
-( 3 , 1, 4),
-( 4 , 1, 4),
-( 5 , 2, 16),
-( 6 , 2, 64),
-( 7 , 2, 128),
-( 8 , 2, 16);
-
-
-
---echo # Test bit functions on only one partition.
-select pk, a, b,
- bit_or(b) over (order by pk) as bit_or,
- bit_and(b) over (order by pk) as bit_and,
- bit_xor(b) over (order by pk) as bit_xor
-from t1;
-
-select pk, a, b,
- bit_or(b) over (order by pk) as bit_or,
- bit_and(b) over (order by pk) as bit_and,
- bit_xor(b) over (order by pk) as bit_xor
-from t2;
-
---echo # Test multiple partitions with bit functions.
-select pk, a, b,
- bit_or(b) over (partition by a order by pk) as bit_or,
- bit_and(b) over (partition by a order by pk) as bit_and,
- bit_xor(b) over (partition by a order by pk) as bit_xor
-from t1;
-
-select pk, a, b,
- bit_or(b) over (partition by a order by pk) as bit_or,
- bit_and(b) over (partition by a order by pk) as bit_and,
- bit_xor(b) over (partition by a order by pk) as bit_xor
-from t2;
-
---echo # Test remove function for bit functions using a sliding window.
-select pk, a, b,
- bit_or(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) as bit_or,
- bit_and(b) over (partition by a order by pk) as bit_and,
- bit_xor(b) over (partition by a order by pk) as bit_xor
-from t1;
-
-select pk, a, b,
- bit_or(b) over (partition by a order by pk) as bit_or,
- bit_and(b) over (partition by a order by pk) as bit_and,
- bit_xor(b) over (partition by a order by pk) as bit_xor
-from t2;
-
-
-
-
-
-
-
-#select pk, a, b, bit_or(b) over (order by a) as count from t1 order by a, pk;
-#select pk, a, b, bit_and(b) over (order by a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) as count from t1 order by a, pk;
-#select pk, a, b, bit_xor(b) over (order by a, pk ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) as count from t2 order by pk;
-#select pk, a, b, bit_or(b) over (order by a, pk ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) as count from t2 order by pk;
-#select pk, a, b, bit_and(b) over (order by a, pk ROWS BETWEEN 2 PRECEDING AND CURRENT ROW) as count from t3 order by pk;
-
-drop table t1;
-drop table t2;
diff --git a/mysql-test/t/win_empty_over.test b/mysql-test/t/win_empty_over.test
deleted file mode 100644
index 91344d76865..00000000000
--- a/mysql-test/t/win_empty_over.test
+++ /dev/null
@@ -1,66 +0,0 @@
-create table t1 (
- pk int primary key,
- a int,
- b int,
- c char(10),
- d decimal(10, 3),
- e real
-);
-
-insert into t1 values
-( 1, 0, 1, 'one', 0.1, 0.001),
-( 2, 0, 2, 'two', 0.2, 0.002),
-( 3, 0, 3, 'three', 0.3, 0.003),
-( 4, 1, 2, 'three', 0.4, 0.004),
-( 5, 1, 1, 'two', 0.5, 0.005),
-( 6, 1, 1, 'one', 0.6, 0.006),
-( 7, 2, NULL, 'n_one', 0.5, 0.007),
-( 8, 2, 1, 'n_two', NULL, 0.008),
-( 9, 2, 2, NULL, 0.7, 0.009),
-(10, 2, 0, 'n_four', 0.8, 0.010),
-(11, 2, 10, NULL, 0.9, NULL);
-
-select pk, row_number() over () from t1;
-explain FORMAT=JSON select pk, row_number() over () from t1;
-explain FORMAT=JSON select row_number() over (), pk from t1;
-
-select row_number() over () from (select 4) as t;
-
---sorted_result
-select min(a) over (), max(a) over (), a, row_number() over ()
-from t1
-where a = 0;
-
---sorted_result
-select a, min(a) over (), max(a) over (), row_number() over ()
-from t1
-where a = 0;
-
---sorted_result
-select min(a) over () + 1, max(a) over (), row_number() over ()
-from t1
-where a = 0;
-
---sorted_result
-select min(a) over () + a, max(a) over (), row_number() over ()
-from t1
-where a = 1;
-
---sorted_result
-select a + min(a) over (), max(a) over (), row_number() over ()
-from t1
-where a = 1;
-
-select a + min(a) over () from t1 where a = 1;
-
-create view win_view
-as (select a, min(a) over () from t1 where a = 1);
-select * from win_view;
-drop view win_view;
-
-create view win_view
-as (select a, max(a + 1) over () from t1 where a = 1);
-select * from win_view;
-drop view win_view;
-
-drop table t1;
diff --git a/mysql-test/t/win_first_last_value.test b/mysql-test/t/win_first_last_value.test
deleted file mode 100644
index 0a90a98a5d4..00000000000
--- a/mysql-test/t/win_first_last_value.test
+++ /dev/null
@@ -1,87 +0,0 @@
-create table t1 (
- pk int primary key,
- a int,
- b int,
- c char(10),
- d decimal(10, 3),
- e real
-);
-
-insert into t1 values
-( 1, 0, 1, 'one', 0.1, 0.001),
-( 2, 0, 2, 'two', 0.2, 0.002),
-( 3, 0, 3, 'three', 0.3, 0.003),
-( 4, 1, 2, 'three', 0.4, 0.004),
-( 5, 1, 1, 'two', 0.5, 0.005),
-( 6, 1, 1, 'one', 0.6, 0.006),
-( 7, 2, NULL, 'n_one', 0.5, 0.007),
-( 8, 2, 1, 'n_two', NULL, 0.008),
-( 9, 2, 2, NULL, 0.7, 0.009),
-(10, 2, 0, 'n_four', 0.8, 0.010),
-(11, 2, 10, NULL, 0.9, NULL);
-
-select pk, first_value(pk) over (order by pk),
- last_value(pk) over (order by pk),
- first_value(pk) over (order by pk desc),
- last_value(pk) over (order by pk desc)
-from t1
-order by pk desc;
-
-select pk,
- first_value(pk) over (order by pk
- RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING),
- last_value(pk) over (order by pk
- RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING),
- first_value(pk) over (order by pk desc
- RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING),
- last_value(pk) over (order by pk desc
- RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
-from t1
-order by pk;
-
-select pk,
- first_value(pk) over (order by pk desc),
- last_value(pk) over (order by pk desc)
-from t1;
-
-select pk, a, b, c, d, e,
- first_value(b) over (partition by a order by pk) as fst_b,
- last_value(b) over (partition by a order by pk) as lst_b,
- first_value(c) over (partition by a order by pk) as fst_c,
- last_value(c) over (partition by a order by pk) as lst_c,
- first_value(d) over (partition by a order by pk) as fst_d,
- last_value(d) over (partition by a order by pk) as lst_d,
- first_value(e) over (partition by a order by pk) as fst_e,
- last_value(e) over (partition by a order by pk) as lst_e
-from t1;
-
-drop table t1;
-
---echo #
---echo # MDEV-11746: Wrong result upon using FIRST_VALUE with a window frame
---echo #
-create table t1 (i int);
-insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
-
-select i,
- first_value(i) OVER (order by i rows between CURRENT ROW and 1 FOLLOWING) as fst_1f,
- last_value(i) OVER (order by i rows between CURRENT ROW and 1 FOLLOWING) as last_1f,
- first_value(i) OVER (order by i rows between 1 PRECEDING AND 1 FOLLOWING) as fst_1p1f,
- last_value(i) OVER (order by i rows between 1 PRECEDING AND 1 FOLLOWING) as fst_1p1f,
- first_value(i) OVER (order by i rows between 2 PRECEDING AND 1 PRECEDING) as fst_2p1p,
- last_value(i) OVER (order by i rows between 2 PRECEDING AND 1 PRECEDING) as fst_2p1p,
- first_value(i) OVER (order by i rows between 1 FOLLOWING AND 2 FOLLOWING) as fst_1f2f,
- last_value(i) OVER (order by i rows between 1 FOLLOWING AND 2 FOLLOWING) as fst_1f2f
-from t1;
-
-drop table t1;
-
---echo #
---echo # MDEV-12861 FIRST_VALUE() does not preserve the exact data type
---echo #
-
-CREATE TABLE t1 (a INT, b INT, c FLOAT);
-INSERT INTO t1 VALUES (1,1,1),(1,2,2),(2,1,1),(2,2,2);
-CREATE TABLE t2 AS SELECT a, FIRST_VALUE(b) OVER(), FIRST_VALUE(c) OVER() FROM t1 GROUP BY a;
-SHOW CREATE TABLE t2;
-DROP TABLE t2,t1;
diff --git a/mysql-test/t/win_i_s.test b/mysql-test/t/win_i_s.test
deleted file mode 100644
index d9b0f190285..00000000000
--- a/mysql-test/t/win_i_s.test
+++ /dev/null
@@ -1,18 +0,0 @@
-show status like '%window%';
-
-create table t1 (a int, b int);
-insert into t1 values (1, 10), (2, 20), (3, 30);
-
-select a, b, rank() over (order by a) from t1;
-show status like '%window%';
-
-select a, b, rank() over (order by a), sum(a) over (order by a) from t1;
-show status like '%window%';
-
---sorted_result
-select t_a.r1, t_b.r2
-from (select a, b, rank() over (order by a) as r1 from t1) t_a,
- (select a, b, row_number() over (order by a) as r2 from t1) t_b;
-show status like '%window%';
-
-drop table t1;
diff --git a/mysql-test/t/win_insert_select.test b/mysql-test/t/win_insert_select.test
deleted file mode 100644
index 6b2e0da4175..00000000000
--- a/mysql-test/t/win_insert_select.test
+++ /dev/null
@@ -1,79 +0,0 @@
-CREATE TABLE t1 (c1 INT, c2 VARCHAR(30));
-
-PREPARE populate_table FROM "INSERT into t1 values (1, 'manual_insert_1'),
- (4, 'manual_insert_2')";
-
-INSERT INTO t1 SELECT row_number() over(), "should_not_add_any_rows" FROM t1;
-INSERT INTO t1 SELECT 1 + row_number() over(), "should_not_add_any_rows" FROM t1;
-
-EXECUTE populate_table;
-
-INSERT INTO t1 SELECT 10 + row_number() over(), "should repeat 2 times [11-12]" FROM t1;
-
-SELECT c1, c2 FROM t1 ORDER BY c2, c1;
-
-DELETE FROM t1;
-EXECUTE populate_table;
-
-
-INSERT INTO t1
- SELECT 10 + (dense_rank() over(order by c1)), "dense_rank_insert" from t1;
-
-SELECT c1, c2 FROM t1 ORDER BY c2, c1;
-
-DELETE FROM t1;
-EXECUTE populate_table;
-
-INSERT INTO t1
- SELECT 100 + (rank() over(order by c1)), "rank_insert" from t1;
-
-SELECT c1, c2 FROM t1 ORDER BY c2, c1;
-
-DELETE FROM t1;
-EXECUTE populate_table;
-
-INSERT INTO t1
- SELECT 100 + (ntile(10) over(order by c1)), "ntile_insert" from t1;
-
-SELECT c1, c2 FROM t1 ORDER BY c2, c1;
-
-DELETE FROM t1;
-EXECUTE populate_table;
-
-INSERT INTO t1
- SELECT 1000 + (percent_rank() over(order by c1)), "percent_rank_insert" from t1;
-
-SELECT c1, c2 FROM t1 ORDER BY c2, c1;
-
-DELETE FROM t1;
-EXECUTE populate_table;
-
-INSERT INTO t1
- SELECT 1000 + (count(*) over(order by c1)), "count_insert" from t1;
-
-SELECT c1, c2 FROM t1 ORDER BY c2, c1;
-
-DELETE FROM t1;
-EXECUTE populate_table;
-
---echo #
---echo # Test how avg interacts when the results need to be rounded.
---echo #
-SELECT 1000 + (avg(c1) over(order by c1)) as avg_expr, c1, "This will be inserted into t1" from t1;
-
-INSERT INTO t1
- SELECT 1000 + (avg(c1) over(order by c1)), "avg_insert" from t1;
-
-SELECT c1, c2 FROM t1 ORDER BY c2, c1;
-
-DELETE FROM t1;
-EXECUTE populate_table;
-
-INSERT INTO t1
- SELECT 1000 + (sum(c1) over(order by c1)), "sum_insert" from t1;
-
-SELECT c1, c2
-FROM t1
-ORDER BY c2, c1;
-
-DROP table t1;
diff --git a/mysql-test/t/win_lead_lag.test b/mysql-test/t/win_lead_lag.test
deleted file mode 100644
index 2824f83789c..00000000000
--- a/mysql-test/t/win_lead_lag.test
+++ /dev/null
@@ -1,110 +0,0 @@
-create table t1 (
- pk int primary key,
- a int,
- b int,
- c char(10),
- d decimal(10, 3),
- e real
-);
-
-insert into t1 values
-( 1, 0, 1, 'one', 0.1, 0.001),
-( 2, 0, 2, 'two', 0.2, 0.002),
-( 3, 0, 3, 'three', 0.3, 0.003),
-( 4, 1, 2, 'three', 0.4, 0.004),
-( 5, 1, 1, 'two', 0.5, 0.005),
-( 6, 1, 1, 'one', 0.6, 0.006),
-( 7, 2, NULL, 'n_one', 0.5, 0.007),
-( 8, 2, 1, 'n_two', NULL, 0.008),
-( 9, 2, 2, NULL, 0.7, 0.009),
-(10, 2, 0, 'n_four', 0.8, 0.010),
-(11, 2, 10, NULL, 0.9, NULL);
-
-select pk,
- lead(pk) over (order by pk),
- lead(pk, 1) over (order by pk),
- lead(pk, 2) over (order by pk),
- lead(pk, 0) over (order by pk),
- lead(pk, -1) over (order by pk),
- lead(pk, -2) over (order by pk)
-from t1
-order by pk asc;
-
-select pk,
- lag(pk) over (order by pk),
- lag(pk, 1) over (order by pk),
- lag(pk, 2) over (order by pk),
- lag(pk, 0) over (order by pk),
- lag(pk, -1) over (order by pk),
- lag(pk, -2) over (order by pk)
-from t1
-order by pk asc;
-
-select pk, pk - 2,
- lag(pk, pk - 2) over (order by pk),
- lead(pk, pk - 2) over (order by pk)
-from t1
-order by pk asc;
-
-select pk, pk - 2,
- lag(pk, pk + 2) over (order by pk),
- lead(pk, pk + 2) over (order by pk)
-from t1
-order by pk asc;
-
-select pk, a,
- lead(pk) over (partition by a order by pk),
- lead(pk, 1) over (partition by a order by pk),
- lead(pk, 2) over (partition by a order by pk),
- lead(pk, 0) over (partition by a order by pk),
- lead(pk, -1) over (partition by a order by pk),
- lead(pk, -2) over (partition by a order by pk)
-from t1
-order by pk asc;
-
-select pk, a,
- lag(pk) over (partition by a order by pk),
- lag(pk, 1) over (partition by a order by pk),
- lag(pk, 2) over (partition by a order by pk),
- lag(pk, 0) over (partition by a order by pk),
- lag(pk, -1) over (partition by a order by pk),
- lag(pk, -2) over (partition by a order by pk)
-from t1
-order by pk asc;
-
-select pk, a, pk - 2,
- lag(pk, pk - 2) over (partition by a order by pk),
- lead(pk, pk - 2) over (partition by a order by pk),
- lag(pk, a - 2) over (partition by a order by pk),
- lead(pk, a - 2) over (partition by a order by pk)
-from t1
-order by pk asc;
-
-select pk, a, pk - 2,
- lag(pk, pk + 2) over (partition by a order by pk),
- lead(pk, pk + 2) over (partition by a order by pk),
- lag(pk, a + 2) over (partition by a order by pk),
- lead(pk, a + 2) over (partition by a order by pk)
-from t1
-order by pk asc;
-
-select pk, a, b, c, d, e,
- lag(a) over (partition by a order by pk),
- lag(b) over (partition by a order by pk),
- lag(c) over (partition by a order by pk),
- lag(d) over (partition by a order by pk),
- lag(e) over (partition by a order by pk)
-from t1
-order by pk asc;
-
-select pk, a, b, a+b,
- lag(a + b) over (partition by a order by pk)
-from t1
-order by pk asc;
-
-select pk, a, b, a+b,
- lag(a + b) over (partition by a order by pk) + pk
-from t1
-order by pk asc;
-
-drop table t1;
diff --git a/mysql-test/t/win_min_max.test b/mysql-test/t/win_min_max.test
deleted file mode 100644
index 8efde87ffdf..00000000000
--- a/mysql-test/t/win_min_max.test
+++ /dev/null
@@ -1,370 +0,0 @@
-create table t1 (
- pk int primary key,
- a int,
- b int,
- c real
-);
-
-
-insert into t1 values
-(101 , 0, 10, 1.1),
-(102 , 0, 10, 2.1),
-(103 , 1, 10, 3.1),
-(104 , 1, 10, 4.1),
-(108 , 2, 10, 5.1),
-(105 , 2, 20, 6.1),
-(106 , 2, 20, 7.1),
-(107 , 2, 20, 8.15),
-(109 , 4, 20, 9.15),
-(110 , 4, 20, 10.15),
-(111 , 5, NULL, 11.15),
-(112 , 5, 1, 12.25),
-(113 , 5, NULL, 13.35),
-(114 , 5, NULL, 14.50),
-(115 , 5, NULL, 15.65),
-(116 , 6, 1, NULL),
-(117 , 6, 1, 10),
-(118 , 6, 1, 1.1),
-(119 , 6, 1, NULL),
-(120 , 6, 1, NULL),
-(121 , 6, 1, NULL),
-(122 , 6, 1, 2.2),
-(123 , 6, 1, 20.1),
-(124 , 6, 1, -10.4),
-(125 , 6, 1, NULL),
-(126 , 6, 1, NULL),
-(127 , 6, 1, NULL);
-
-
---sorted_result
-select pk, a, b, min(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) as min,
- max(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) as max
-from t1;
-
---sorted_result
-select pk, a, c, min(c) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) as min,
- max(c) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) as max
-from t1;
-
-create table t2 (
- pk int primary key,
- a int,
- b int,
- c char(10)
-);
-
-insert into t2 values
-( 1, 0, 1, 'one'),
-( 2, 0, 2, 'two'),
-( 3, 0, 3, 'three'),
-( 4, 1, 20, 'four'),
-( 5, 1, 10, 'five'),
-( 6, 1, 40, 'six'),
-( 7, 1, 30, 'seven'),
-( 8, 4,300, 'eight'),
-( 9, 4,100, 'nine'),
-(10, 4,200, 'ten'),
-(11, 4,200, 'eleven');
-
---echo # First try some invalid argument queries.
-select pk, a, b, c,
- min(c) over (order by pk),
- max(c) over (order by pk),
- min(c) over (partition by a order by pk),
- max(c) over (partition by a order by pk)
-from t2;
-
-
-
---echo # Empty frame
-
-select pk, a, b, c,
- min(b) over (order by pk rows between 2 following and 1 following) as min1,
- max(b) over (order by pk rows between 2 following and 1 following) as max1,
- min(b) over (partition by a order by pk rows between 2 following and 1 following) as min2,
- max(b) over (partition by a order by pk rows between 2 following and 1 following) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk range between 2 following and 1 following) as min1,
- max(b) over (order by pk range between 2 following and 1 following) as max1,
- min(b) over (partition by a order by pk range between 2 following and 1 following) as min2,
- max(b) over (partition by a order by pk range between 2 following and 1 following) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk rows between 1 preceding and 2 preceding) as min1,
- max(b) over (order by pk rows between 1 preceding and 2 preceding) as max1,
- min(b) over (partition by a order by pk rows between 1 preceding and 2 preceding) as min2,
- max(b) over (partition by a order by pk rows between 1 preceding and 2 preceding) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk range between 1 preceding and 2 preceding) as min1,
- max(b) over (order by pk range between 1 preceding and 2 preceding) as max1,
- min(b) over (partition by a order by pk range between 1 preceding and 2 preceding) as min2,
- max(b) over (partition by a order by pk range between 1 preceding and 2 preceding) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk rows between 1 following and 0 following) as min1,
- max(b) over (order by pk rows between 1 following and 0 following) as max1,
- min(b) over (partition by a order by pk rows between 1 following and 0 following) as min2,
- max(b) over (partition by a order by pk rows between 1 following and 0 following) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk range between 1 following and 0 following) as min1,
- max(b) over (order by pk range between 1 following and 0 following) as max1,
- min(b) over (partition by a order by pk range between 1 following and 0 following) as min2,
- max(b) over (partition by a order by pk range between 1 following and 0 following) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk rows between 1 following and 0 preceding) as min1,
- max(b) over (order by pk rows between 1 following and 0 preceding) as max1,
- min(b) over (partition by a order by pk rows between 1 following and 0 preceding) as min2,
- max(b) over (partition by a order by pk rows between 1 following and 0 preceding) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk range between 1 following and 0 preceding) as min1,
- max(b) over (order by pk range between 1 following and 0 preceding) as max1,
- min(b) over (partition by a order by pk range between 1 following and 0 preceding) as min2,
- max(b) over (partition by a order by pk range between 1 following and 0 preceding) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk rows between 0 following and 1 preceding) as min1,
- max(b) over (order by pk rows between 0 following and 1 preceding) as max1,
- min(b) over (partition by a order by pk rows between 0 following and 1 preceding) as min2,
- max(b) over (partition by a order by pk rows between 0 following and 1 preceding) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk range between 0 following and 1 preceding) as min1,
- max(b) over (order by pk range between 0 following and 1 preceding) as max1,
- min(b) over (partition by a order by pk range between 0 following and 1 preceding) as min2,
- max(b) over (partition by a order by pk range between 0 following and 1 preceding) as max2
-from t2;
-
---echo # 1 row frame.
-select pk, a, b, c,
- min(b) over (order by pk rows between current row and current row) as min1,
- max(b) over (order by pk rows between current row and current row) as max1,
- min(b) over (partition by a order by pk rows between current row and current row) as min2,
- max(b) over (partition by a order by pk rows between current row and current row) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk rows between 0 preceding and current row) as min1,
- max(b) over (order by pk rows between 0 preceding and current row) as max1,
- min(b) over (partition by a order by pk rows between 0 preceding and current row) as min2,
- max(b) over (partition by a order by pk rows between 0 preceding and current row) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk rows between 0 preceding and 0 preceding) as min1,
- max(b) over (order by pk rows between 0 preceding and 0 preceding) as max1,
- min(b) over (partition by a order by pk rows between 0 preceding and 0 preceding) as min2,
- max(b) over (partition by a order by pk rows between 0 preceding and 0 preceding) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk rows between 1 preceding and 1 preceding) as min1,
- max(b) over (order by pk rows between 1 preceding and 1 preceding) as max1,
- min(b) over (partition by a order by pk rows between 1 preceding and 1 preceding) as min2,
- max(b) over (partition by a order by pk rows between 1 preceding and 1 preceding) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk rows between 1 following and 1 following) as min1,
- max(b) over (order by pk rows between 1 following and 1 following) as max1,
- min(b) over (partition by a order by pk rows between 1 following and 1 following) as min2,
- max(b) over (partition by a order by pk rows between 1 following and 1 following) as max2
-from t2;
-
---echo # Try a larger offset.
-select pk, a, b, c,
- min(b) over (order by pk rows between 3 following and 3 following) as min1,
- max(b) over (order by pk rows between 3 following and 3 following) as max1,
- min(b) over (partition by a order by pk rows between 3 following and 3 following) as min2,
- max(b) over (partition by a order by pk rows between 3 following and 3 following) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk rows between 3 preceding and 3 preceding) as min1,
- max(b) over (order by pk rows between 3 preceding and 3 preceding) as max1,
- min(b) over (partition by a order by pk rows between 3 preceding and 3 preceding) as min2,
- max(b) over (partition by a order by pk rows between 3 preceding and 3 preceding) as max2
-from t2;
-
---echo # 2 row frame.
-select pk, a, b, c,
- min(b) over (order by pk rows between current row and 1 following) as min1,
- max(b) over (order by pk rows between current row and 1 following) as max1,
- min(b) over (partition by a order by pk rows between current row and 1 following) as min2,
- max(b) over (partition by a order by pk rows between current row and 1 following) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk rows between 0 preceding and 1 following) as min1,
- max(b) over (order by pk rows between 0 preceding and 1 following) as max1,
- min(b) over (partition by a order by pk rows between 0 preceding and 1 following) as min2,
- max(b) over (partition by a order by pk rows between 0 preceding and 1 following) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk rows between 1 preceding and current row) as min1,
- max(b) over (order by pk rows between 1 preceding and current row) as max1,
- min(b) over (partition by a order by pk rows between 1 preceding and current row) as min2,
- max(b) over (partition by a order by pk rows between 1 preceding and current row) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk rows between 1 preceding and 0 preceding) as min1,
- max(b) over (order by pk rows between 1 preceding and 0 preceding) as max1,
- min(b) over (partition by a order by pk rows between 1 preceding and 0 preceding) as min2,
- max(b) over (partition by a order by pk rows between 1 preceding and 0 preceding) as max2
-from t2;
-
---echo # Try a larger frame/offset.
-select pk, a, b, c,
- min(b) over (order by pk rows between current row and 3 following) as min1,
- max(b) over (order by pk rows between current row and 3 following) as max1,
- min(b) over (partition by a order by pk rows between current row and 3 following) as min2,
- max(b) over (partition by a order by pk rows between current row and 3 following) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk rows between 2 preceding and 1 following) as min1,
- max(b) over (order by pk rows between 2 preceding and 1 following) as max1,
- min(b) over (partition by a order by pk rows between 2 preceding and 1 following) as min2,
- max(b) over (partition by a order by pk rows between 2 preceding and 1 following) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk rows between 3 preceding and current row) as min1,
- max(b) over (order by pk rows between 3 preceding and current row) as max1,
- min(b) over (partition by a order by pk rows between 3 preceding and current row) as min2,
- max(b) over (partition by a order by pk rows between 3 preceding and current row) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk rows between 3 preceding and 0 preceding) as min1,
- max(b) over (order by pk rows between 3 preceding and 0 preceding) as max1,
- min(b) over (partition by a order by pk rows between 3 preceding and 0 preceding) as min2,
- max(b) over (partition by a order by pk rows between 3 preceding and 0 preceding) as max2
-from t2;
-
---echo # Check range frame bounds
-select pk, a, b, c,
- min(b) over (order by pk range between current row and current row) as min1,
- max(b) over (order by pk range between current row and current row) as max1,
- min(b) over (partition by a order by pk range between current row and current row) as min2,
- max(b) over (partition by a order by pk range between current row and current row) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk range between 0 preceding and current row) as min1,
- max(b) over (order by pk range between 0 preceding and current row) as max1,
- min(b) over (partition by a order by pk range between 0 preceding and current row) as min2,
- max(b) over (partition by a order by pk range between 0 preceding and current row) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk range between 0 preceding and 0 preceding) as min1,
- max(b) over (order by pk range between 0 preceding and 0 preceding) as max1,
- min(b) over (partition by a order by pk range between 0 preceding and 0 preceding) as min2,
- max(b) over (partition by a order by pk range between 0 preceding and 0 preceding) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk range between 1 preceding and 1 preceding) as min1,
- max(b) over (order by pk range between 1 preceding and 1 preceding) as max1,
- min(b) over (partition by a order by pk range between 1 preceding and 1 preceding) as min2,
- max(b) over (partition by a order by pk range between 1 preceding and 1 preceding) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk range between 1 following and 1 following) as min1,
- max(b) over (order by pk range between 1 following and 1 following) as max1,
- min(b) over (partition by a order by pk range between 1 following and 1 following) as min2,
- max(b) over (partition by a order by pk range between 1 following and 1 following) as max2
-from t2;
-
---echo # Try a larger offset.
-select pk, a, b, c,
- min(b) over (order by pk range between 3 following and 3 following) as min1,
- max(b) over (order by pk range between 3 following and 3 following) as max1,
- min(b) over (partition by a order by pk range between 3 following and 3 following) as min2,
- max(b) over (partition by a order by pk range between 3 following and 3 following) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk range between 3 preceding and 3 preceding) as min1,
- max(b) over (order by pk range between 3 preceding and 3 preceding) as max1,
- min(b) over (partition by a order by pk range between 3 preceding and 3 preceding) as min2,
- max(b) over (partition by a order by pk range between 3 preceding and 3 preceding) as max2
-from t2;
-
---echo # 2 row frame.
-select pk, a, b, c,
- min(b) over (order by pk range between current row and 1 following) as min1,
- max(b) over (order by pk range between current row and 1 following) as max1,
- min(b) over (partition by a order by pk range between current row and 1 following) as min2,
- max(b) over (partition by a order by pk range between current row and 1 following) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk range between 0 preceding and 1 following) as min1,
- max(b) over (order by pk range between 0 preceding and 1 following) as max1,
- min(b) over (partition by a order by pk range between 0 preceding and 1 following) as min2,
- max(b) over (partition by a order by pk range between 0 preceding and 1 following) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk range between 1 preceding and current row) as min1,
- max(b) over (order by pk range between 1 preceding and current row) as max1,
- min(b) over (partition by a order by pk range between 1 preceding and current row) as min2,
- max(b) over (partition by a order by pk range between 1 preceding and current row) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk range between 1 preceding and 0 preceding) as min1,
- max(b) over (order by pk range between 1 preceding and 0 preceding) as max1,
- min(b) over (partition by a order by pk range between 1 preceding and 0 preceding) as min2,
- max(b) over (partition by a order by pk range between 1 preceding and 0 preceding) as max2
-from t2;
-
---echo # Try a larger frame/offset.
-select pk, a, b, c,
- min(b) over (order by pk range between current row and 3 following) as min1,
- max(b) over (order by pk range between current row and 3 following) as max1,
- min(b) over (partition by a order by pk range between current row and 3 following) as min2,
- max(b) over (partition by a order by pk range between current row and 3 following) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk range between 2 preceding and 1 following) as min1,
- max(b) over (order by pk range between 2 preceding and 1 following) as max1,
- min(b) over (partition by a order by pk range between 2 preceding and 1 following) as min2,
- max(b) over (partition by a order by pk range between 2 preceding and 1 following) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk range between 3 preceding and current row) as min1,
- max(b) over (order by pk range between 3 preceding and current row) as max1,
- min(b) over (partition by a order by pk range between 3 preceding and current row) as min2,
- max(b) over (partition by a order by pk range between 3 preceding and current row) as max2
-from t2;
-
-select pk, a, b, c,
- min(b) over (order by pk range between 3 preceding and 0 preceding) as min1,
- max(b) over (order by pk range between 3 preceding and 0 preceding) as max1,
- min(b) over (partition by a order by pk range between 3 preceding and 0 preceding) as min2,
- max(b) over (partition by a order by pk range between 3 preceding and 0 preceding) as max2
-from t2;
-
-drop table t2;
-drop table t1;
diff --git a/mysql-test/t/win_nth_value.test b/mysql-test/t/win_nth_value.test
deleted file mode 100644
index b9764d1e9d7..00000000000
--- a/mysql-test/t/win_nth_value.test
+++ /dev/null
@@ -1,67 +0,0 @@
-create table t1 (
- pk int primary key,
- a int,
- b int,
- c char(10),
- d decimal(10, 3),
- e real
-);
-
-insert into t1 values
-( 1, 0, 1, 'one', 0.1, 0.001),
-( 2, 0, 2, 'two', 0.2, 0.002),
-( 3, 0, 3, 'three', 0.3, 0.003),
-( 4, 1, 2, 'three', 0.4, 0.004),
-( 5, 1, 1, 'two', 0.5, 0.005),
-( 6, 1, 1, 'one', 0.6, 0.006),
-( 7, 2, NULL, 'n_one', 0.5, 0.007),
-( 8, 2, 1, 'n_two', NULL, 0.008),
-( 9, 2, 2, NULL, 0.7, 0.009),
-(10, 2, 0, 'n_four', 0.8, 0.010),
-(11, 2, 10, NULL, 0.9, NULL);
-
-select pk,
- nth_value(pk, 1) over (order by pk),
- nth_value(pk, 2) over (order by pk),
- nth_value(pk, 0) over (order by pk),
- nth_value(pk, -1) over (order by pk),
- nth_value(pk, -2) over (order by pk)
-from t1
-order by pk asc;
-
-select pk,
- nth_value(pk, pk) over (order by pk),
- nth_value(pk / 0.1, pk) over (order by pk)
-from t1
-order by pk asc;
-
-select pk,
- a,
- nth_value(pk, pk) over (partition by a order by pk),
- nth_value(pk, a + 1) over (partition by a order by pk)
-from t1
-order by pk asc;
-
-select pk,
- a,
- nth_value(pk, 1) over (partition by a order by pk ROWS between 1 preceding and 1 following)
-from t1;
-
-select pk,
- a,
- nth_value(a, 1) over (order by a RANGE BETWEEN 1 preceding and 1 following),
- nth_value(a, 2) over (order by a RANGE BETWEEN 1 preceding and 1 following),
- nth_value(a, 3) over (order by a RANGE BETWEEN 1 preceding and 1 following),
- nth_value(a, 4) over (order by a RANGE BETWEEN 1 preceding and 1 following),
- nth_value(a, 5) over (order by a RANGE BETWEEN 1 preceding and 1 following),
- nth_value(a, 6) over (order by a RANGE BETWEEN 1 preceding and 1 following),
- nth_value(a, 7) over (order by a RANGE BETWEEN 1 preceding and 1 following),
- nth_value(a, 8) over (order by a RANGE BETWEEN 1 preceding and 1 following),
- nth_value(a, 9) over (order by a RANGE BETWEEN 1 preceding and 1 following),
- nth_value(a, 10) over (order by a RANGE BETWEEN 1 preceding and 1 following),
- nth_value(a, 11) over (order by a RANGE BETWEEN 1 preceding and 1 following),
- nth_value(a, 12) over (order by a RANGE BETWEEN 1 preceding and 1 following)
-from t1
-order by pk asc;
-
-drop table t1;
diff --git a/mysql-test/t/win_ntile.test b/mysql-test/t/win_ntile.test
deleted file mode 100644
index 6f12e1f4005..00000000000
--- a/mysql-test/t/win_ntile.test
+++ /dev/null
@@ -1,171 +0,0 @@
-create table t1 (
- pk int primary key,
- a int,
- b int
-);
-
-
-insert into t1 values
-(11 , 0, 10),
-(12 , 0, 10),
-(13 , 1, 10),
-(14 , 1, 10),
-(18 , 2, 10),
-(15 , 2, 20),
-(16 , 2, 20),
-(17 , 2, 20),
-(19 , 4, 20),
-(20 , 4, 20);
-
-# TODO Try invalid queries too.
-
---error ER_INVALID_NTILE_ARGUMENT
-select pk, a, b, ntile(-1) over (order by a)
-from t1;
-
---error ER_INVALID_NTILE_ARGUMENT
-select pk, a, b,
- ntile(0) over (order by a)
-from t1;
-
---sorted_result
-select pk, a, b,
- ntile(1) over (order by pk)
-from t1;
-
---sorted_result
-select pk, a, b,
- ntile(2) over (order by pk)
-from t1;
-
---sorted_result
-select pk, a, b,
- ntile(3) over (order by pk)
-from t1;
-
---sorted_result
-select pk, a, b,
- ntile(4) over (order by pk)
-from t1;
-
---sorted_result
-select pk, a, b,
- ntile(5) over (order by pk)
-from t1;
-
---sorted_result
-select pk, a, b,
- ntile(6) over (order by pk)
-from t1;
-
---sorted_result
-select pk, a, b,
- ntile(7) over (order by pk)
-from t1;
-
---sorted_result
-select pk, a, b,
- ntile(8) over (order by pk)
-from t1;
-
---sorted_result
-select pk, a, b,
- ntile(9) over (order by pk)
-from t1;
-
---sorted_result
-select pk, a, b,
- ntile(10) over (order by pk)
-from t1;
-
---sorted_result
-select pk, a, b,
- ntile(11) over (order by pk)
-from t1;
-
---sorted_result
-select pk, a, b,
- ntile(20) over (order by pk)
-from t1;
-
-
-select pk, a, b,
- ntile(1) over (partition by b order by pk)
-from t1;
-
-select pk, a, b,
- ntile(2) over (partition by b order by pk)
-from t1;
-
-select pk, a, b,
- ntile(3) over (partition by b order by pk)
-from t1;
-
-select pk, a, b,
- ntile(4) over (partition by b order by pk)
-from t1;
-
-select pk, a, b,
- ntile(5) over (partition by b order by pk)
-from t1;
-
-select pk, a, b,
- ntile(6) over (partition by b order by pk)
-from t1;
-
-select pk, a, b,
- ntile(7) over (partition by b order by pk)
-from t1;
-
-select pk, a, b,
- ntile(8) over (partition by b order by pk)
-from t1;
-
-select pk, a, b,
- ntile(9) over (partition by b order by pk)
-from t1;
-
-select pk, a, b,
- ntile(10) over (partition by b order by pk)
-from t1;
-
-select pk, a, b,
- ntile(11) over (partition by b order by pk)
-from t1;
-
-select pk, a, b,
- ntile(20) over (partition by b order by pk)
-from t1;
-
-select pk, a, b,
- ntile(1 + 3) over (partition by b order by pk)
-from t1;
-
-select pk, a, b,
- ntile((select 4)) over (partition by b order by pk)
-from t1;
-
-select t1.a from t1 where pk = 11;
---error ER_INVALID_NTILE_ARGUMENT
-select pk, a, b,
- ntile((select a from t1 where pk=11)) over (partition by b order by pk)
-from t1;
-
-select t1.a from t1 where pk = 13;
-select pk, a, b,
- ntile((select a from t1 where pk=13)) over (partition by b order by pk)
-from t1;
-
-explain
-select pk, a, b,
- ntile((select a from t1 where pk=13)) over (partition by b order by pk)
-from t1;
-
-select a from t1;
---error ER_SUBQUERY_NO_1_ROW
-select pk, a, b,
- ntile((select a from t1)) over (partition by b order by pk)
-from t1;
-
-
-drop table t1;
diff --git a/mysql-test/t/win_orderby.test b/mysql-test/t/win_orderby.test
deleted file mode 100644
index 0d42c606486..00000000000
--- a/mysql-test/t/win_orderby.test
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# Tests for window functions and ORDER BY
-#
-
---disable_warnings
-drop table if exists t0,t1;
---enable_warnings
-
-create table t0(a int primary key);
-insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-
-create table t1(
- pk int,
- a int,
- key(pk)
-);
-
-insert into t1
-select
- A.a + B.a* 10 + C.a * 100,
- 1
-from t0 A, t0 B, t0 C;
-
-select
- pk,
- count(a) over (order by pk rows between 2 preceding and 2 following)
-from t1
-where pk between 1 and 30
-order by pk desc
-limit 4;
-
-drop table t0,t1;
diff --git a/mysql-test/t/win_percent_cume.test b/mysql-test/t/win_percent_cume.test
deleted file mode 100644
index b851185cb32..00000000000
--- a/mysql-test/t/win_percent_cume.test
+++ /dev/null
@@ -1,36 +0,0 @@
-create table t1 (
- pk int primary key,
- a int,
- b int
-);
-
-
-insert into t1 values
-( 1 , 0, 10),
-( 2 , 0, 10),
-( 3 , 1, 10),
-( 4 , 1, 10),
-( 8 , 2, 10),
-( 5 , 2, 20),
-( 6 , 2, 20),
-( 7 , 2, 20),
-( 9 , 4, 20),
-(10 , 4, 20);
-
-select pk, a, b,
- percent_rank() over (order by a),
- cume_dist() over (order by a)
-from t1;
-
-select pk, a, b,
- percent_rank() over (order by pk),
- cume_dist() over (order by pk)
-from t1 order by pk;
-
-select pk, a, b,
- percent_rank() over (partition by a order by a),
- cume_dist() over (partition by a order by a)
-from t1;
-
-drop table t1;
-
diff --git a/mysql-test/t/win_percentile.test b/mysql-test/t/win_percentile.test
deleted file mode 100644
index 468d8cff56b..00000000000
--- a/mysql-test/t/win_percentile.test
+++ /dev/null
@@ -1,104 +0,0 @@
-CREATE TABLE t1 (name CHAR(10), test double, score DECIMAL(19,4));
-INSERT INTO t1 VALUES
-('Chun', 0, 3), ('Chun', 0, 7),
-('Kaolin', 0.5, 3), ('Kaolin', 0.6, 7),
-('Kaolin', 0.5, 4),
-('Tatiana', 0.8, 4), ('Tata', 0.8, 4);
-
---echo #
---echo # Test invalid syntax
---echo #
-
---echo # Order by clause has more than one element
---error ER_PARSE_ERROR
-select percentile_disc(0.5) within group(order by score,test) over (partition by name) from t1;
---error ER_PARSE_ERROR
-select percentile_cont(0.5) within group(order by score,test) over (partition by name) from t1;
-
---echo # Order by clause has no element
---error ER_PARSE_ERROR
-select percentile_disc(0.5) within group() over (partition by name) from t1;
---error ER_PARSE_ERROR
-select percentile_cont(0.5) within group() over (partition by name) from t1;
-
---echo # No parameters to the percentile functions
---error ER_PARSE_ERROR
-select percentile_disc() within group() over (partition by name) from t1;
---error ER_PARSE_ERROR
-select percentile_cont() within group() over (partition by name) from t1;
-
-
-
---echo #
---echo # Test simple syntax
---echo #
-
-select name, percentile_cont(0.5) within group(order by score) over (partition by name) as c from t1;
-select name, percentile_disc(0.5) within group(order by score) over (partition by name) as c from t1;
-
---echo # no partition clause
-select name, percentile_disc(0.5) within group(order by score) over () from t1;
-select name, percentile_cont(0.5) within group(order by score) over () from t1;
-
---echo # argument set to null
---error ER_WRONG_TYPE_OF_ARGUMENT
-select name, percentile_cont(null) within group(order by score) over (partition by name) from t1;
---error ER_WRONG_TYPE_OF_ARGUMENT
-select name, percentile_disc(null) within group(order by score) over (partition by name) from t1;
-
---echo #subqueries having percentile functions
-select * from ( select name , percentile_cont(0.5) within group ( order by score) over (partition by name ) from t1 ) as t;
-select * from ( select name , percentile_disc(0.5) within group ( order by score) over (partition by name ) from t1 ) as t;
-select name from t1 a where (select percentile_disc(0.5) within group (order by score) over (partition by name) from t1 b limit 1) >= 0.5;
-
---echo #disallowed fields in order by
---error ER_WRONG_TYPE_FOR_PERCENTILE_FUNC
-select score, percentile_cont(0.5) within group(order by name) over (partition by score) from t1;
---error ER_WRONG_TYPE_FOR_PERCENTILE_FUNC
-select score, percentile_disc(0.5) within group(order by name) over (partition by score) from t1;
-
---echo #parameter value should be in the range of [0,1]
---error ER_ARGUMENT_OUT_OF_RANGE
-select percentile_disc(1.5) within group(order by score) over (partition by name) from t1;
---error ER_ARGUMENT_OUT_OF_RANGE
-select percentile_cont(1.5) within group(order by score) over (partition by name) from t1;
-
---echo #Argument should remain constant for the entire partition
---error ER_ARGUMENT_NOT_CONSTANT
-select name,percentile_cont(test) within group(order by score) over (partition by name) from t1;
---error ER_ARGUMENT_NOT_CONSTANT
-select name, percentile_disc(test) within group(order by score) over (partition by name) from t1;
-
---echo #only numerical types are allowed as argument to percentile functions
---error ER_WRONG_TYPE_OF_ARGUMENT
-select name, percentile_cont(name) within group(order by score) over (partition by name) from t1;
---error ER_WRONG_TYPE_OF_ARGUMENT
-select name, percentile_disc(name) within group(order by score) over (partition by name) from t1;
-
---echo #complete query with partition column
-select name,cume_dist() over (partition by name order by score), percentile_disc(0.5) within group(order by score) over (partition by name) as c from t1;
-select name, percentile_cont(0.5) within group(order by score) over (partition by name) as c from t1;
-
-select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.1) within group(order by score) over (partition by name) as c from t1;
-select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.2) within group(order by score) over (partition by name) as c from t1;
-select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.3) within group(order by score) over (partition by name) as c from t1;
-select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.4) within group(order by score) over (partition by name) as c from t1;
-select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.5) within group(order by score) over (partition by name) as c from t1;
-select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.6) within group(order by score) over (partition by name) as c from t1;
-select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.7) within group(order by score) over (partition by name) as c from t1;
-select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.8) within group(order by score) over (partition by name) as c from t1;
-select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.9) within group(order by score) over (partition by name) as c from t1;
-select name,cume_dist() over (partition by name order by score) as b, percentile_disc(1) within group(order by score) over (partition by name) as c from t1;
-
-select median(score) over (partition by name), percentile_cont(0) within group(order by score) over (partition by name) as c from t1;
-select median(score) over (partition by name), percentile_cont(0.1) within group(order by score) over (partition by name) as c from t1;
-select median(score) over (partition by name), percentile_cont(0.2) within group(order by score) over (partition by name) as c from t1;
-select median(score) over (partition by name), percentile_cont(0.3) within group(order by score) over (partition by name) as c from t1;
-select median(score) over (partition by name), percentile_cont(0.4) within group(order by score) over (partition by name) as c from t1;
-select median(score) over (partition by name), percentile_cont(0.5) within group(order by score) over (partition by name) as c from t1;
-select median(score) over (partition by name), percentile_cont(0.6) within group(order by score) over (partition by name) as c from t1;
-select median(score) over (partition by name), percentile_cont(0.7) within group(order by score) over (partition by name) as c from t1;
-select median(score) over (partition by name), percentile_cont(0.8) within group(order by score) over (partition by name) as c from t1;
-select median(score) over (partition by name), percentile_cont(0.9) within group(order by score) over (partition by name) as c from t1;
-select median(score) over (partition by name), percentile_cont(1) within group(order by score) over (partition by name) as c from t1;
-drop table t1;
diff --git a/mysql-test/t/win_rank.test b/mysql-test/t/win_rank.test
deleted file mode 100644
index eda1f458205..00000000000
--- a/mysql-test/t/win_rank.test
+++ /dev/null
@@ -1,58 +0,0 @@
---echo #
---echo # Try DENSE_RANK() function
---echo #
-
-create table t1 (
- pk int primary key,
- a int,
- b int
-);
-
-insert into t1 values
-( 1 , 0, 10),
-( 2 , 0, 10),
-( 3 , 1, 10),
-( 4 , 1, 10),
-( 8 , 2, 10),
-( 5 , 2, 20),
-( 6 , 2, 20),
-( 7 , 2, 20),
-( 9 , 4, 20),
-(10 , 4, 20);
-
-select pk, a, b, rank() over (order by a) as rank,
- dense_rank() over (order by a) as dense_rank
-from t1;
-select pk, a, b, rank() over (partition by b order by a) as rank,
- dense_rank() over (partition by b order by a) as dense_rank
-from t1;
-
-drop table t1;
-
---echo #
---echo # Test with null values in the table.
---echo #
-
-create table t2 (s1 int, s2 char(5));
-insert into t2 values (1,'a');
-insert into t2 values (null,null);
-insert into t2 values (1,null);
-insert into t2 values (null,'a');
-insert into t2 values (null,'c');
-insert into t2 values (2,'b');
-insert into t2 values (-1,'');
-
-select *, rank() over (order by s1) as rank,
- dense_rank() over (order by s1) as dense_rank
-from t2;
-select *, rank() over (partition by s2 order by s1) as rank,
- dense_rank() over (partition by s2 order by s1) as dense_rank
-from t2;
-select *, rank() over (order by s2) as rank,
- dense_rank() over (order by s2) as dense_rank
-from t2;
-select *, rank() over (partition by s1 order by s2) as rank,
- dense_rank() over (partition by s1 order by s2) as dense_rank
-from t2;
-
-drop table t2;
diff --git a/mysql-test/t/win_std.test b/mysql-test/t/win_std.test
deleted file mode 100644
index 5ed999431c0..00000000000
--- a/mysql-test/t/win_std.test
+++ /dev/null
@@ -1,136 +0,0 @@
-create table t1 (
- pk int primary key,
- a int,
- b int
-);
-
-create table t2 (
- pk int primary key,
- a int,
- b int,
- c char(10)
-);
-
-insert into t2 values
-( 1, 0, 1, 'one'),
-( 2, 0, 2, 'two'),
-( 3, 0, 3, 'three'),
-( 4, 1, 1, 'one'),
-( 5, 1, 1, 'two'),
-( 6, 1, 2, 'three');
-
---disable_warnings
---echo # First try some invalid queries.
-select std(c) over (order by a)
-from t2;
---enable_warnings
-
---echo # Empty frame.
-select std(b) over (order by a rows between 2 following and 1 following)
-from t2;
-
-select std(b) over (order by a range between 2 following and 1 following)
-from t2;
-
-select std(b) over (order by a rows between 1 preceding and 2 preceding)
-from t2;
-
-select std(b) over (order by a range between 1 preceding and 2 preceding)
-from t2;
-
-select std(b) over (order by a rows between 1 following and 0 following)
-from t2;
-
-select std(b) over (order by a range between 1 following and 0 following)
-from t2;
-
-select std(b) over (order by a rows between 1 following and 0 preceding)
-from t2;
-
-select std(b) over (order by a range between 1 following and 0 preceding)
-from t2;
-
-select std(b) over (order by a rows between 0 following and 1 preceding)
-from t2;
-
-select std(b) over (order by a range between 0 following and 1 preceding)
-from t2;
-
---echo # 1 row frame.
-select std(b) over (order by a rows between current row and current row)
-from t2;
-
-select std(b) over (order by a rows between 0 preceding and current row)
-from t2;
-
-select std(b) over (order by a rows between 0 preceding and 0 preceding)
-from t2;
-
-select std(b) over (order by a rows between 0 preceding and 0 following)
-from t2;
-
-select std(b) over (order by a rows between 0 following and 0 preceding)
-from t2;
-
---error ER_BAD_COMBINATION_OF_WINDOW_FRAME_BOUND_SPECS
-select std(b) over (order by a rows between 0 following and current row)
-from t2;
-
-select std(b) over (order by a rows between current row and 0 following)
-from t2;
-
---echo # Only peers frame.
-select a, b, std(b) over (order by a range between 0 preceding and 0 preceding)
-from t2;
-
-select a, b, std(b) over (order by a range between 0 preceding and current row)
-from t2;
-
---error ER_BAD_COMBINATION_OF_WINDOW_FRAME_BOUND_SPECS
-select a, b, std(b) over (order by a range between current row and 0 preceding)
-from t2;
-
-select a, b, std(b) over (order by a range between current row and 0 following)
-from t2;
-
-select a, b, std(b) over (order by a range between 0 following and 0 following)
-from t2;
-
---echo # 2 rows frame.
-
---sorted_result
-select pk, a, b, std(b) over (order by a, b, pk rows between 1 preceding and current row)
-from t2;
-
---sorted_result
-select pk, a, b, std(b) over (order by a, b, pk rows between 1 preceding and 0 preceding)
-from t2;
-
---sorted_result
-select pk, a, b, std(b) over (order by a, b, pk rows between current row and 1 following)
-from t2;
-
---sorted_result
-select pk, a, b, std(b) over (order by a, b, pk rows between 0 following and 1 following)
-from t2;
-
---echo # 2 peers frame.
-
---sorted_result
-select pk, a, b, std(b) over (order by a range between 1 preceding and current row)
-from t2;
-
---sorted_result
-select pk, a, b, std(b) over (order by a range between 1 preceding and 0 preceding)
-from t2;
-
---sorted_result
-select pk, a, b, std(b) over (order by a range between current row and 1 following)
-from t2;
-
---sorted_result
-select pk, a, b, std(b) over (order by a range between 0 following and 1 following)
-from t2;
-
-drop table t1;
-drop table t2;
diff --git a/mysql-test/t/win_sum.test b/mysql-test/t/win_sum.test
deleted file mode 100644
index aa4965bfd5a..00000000000
--- a/mysql-test/t/win_sum.test
+++ /dev/null
@@ -1,47 +0,0 @@
-create table t1 (
- pk int primary key,
- a int,
- b int,
- c real
-);
-
-
-insert into t1 values
-(101 , 0, 10, 1.1),
-(102 , 0, 10, 2.1),
-(103 , 1, 10, 3.1),
-(104 , 1, 10, 4.1),
-(108 , 2, 10, 5.1),
-(105 , 2, 20, 6.1),
-(106 , 2, 20, 7.1),
-(107 , 2, 20, 8.15),
-(109 , 4, 20, 9.15),
-(110 , 4, 20, 10.15),
-(111 , 5, NULL, 11.15),
-(112 , 5, 1, 12.25),
-(113 , 5, NULL, 13.35),
-(114 , 5, NULL, 14.50),
-(115 , 5, NULL, 15.65),
-(116 , 6, 1, NULL),
-(117 , 6, 1, 10),
-(118 , 6, 1, 1.1),
-(119 , 6, 1, NULL),
-(120 , 6, 1, NULL),
-(121 , 6, 1, NULL),
-(122 , 6, 1, 2.2),
-(123 , 6, 1, 20.1),
-(124 , 6, 1, -10.4),
-(125 , 6, 1, NULL),
-(126 , 6, 1, NULL),
-(127 , 6, 1, NULL);
-
-
---sorted_result
-select pk, a, b, sum(b) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING)
-from t1;
-
---sorted_result
-select pk, a, c, sum(c) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING)
-from t1;
-
-drop table t1;
diff --git a/mysql-test/t/windows.test b/mysql-test/t/windows.test
deleted file mode 100644
index 617daba6b8e..00000000000
--- a/mysql-test/t/windows.test
+++ /dev/null
@@ -1,116 +0,0 @@
-# Windows-specific tests
---source include/windows.inc
-
-#
-# Bug 9148: Denial of service
-#
---error 1049
-use lpt1;
---error 1049
-use com1;
---error 1049
-use prn;
-
-#
-# Bug #12325: Can't create table named 'nu'
-#
-create table nu (a int);
-drop table nu;
-
-#
-# Bug17489: ailed to put data file in custom directory use "data directory" option
-#
---disable_warnings
-drop table if exists t1;
---enable_warnings
-CREATE TABLE t1 ( `ID` int(6) ) data directory 'c:/tmp/' index directory 'c:/tmp/' engine=MyISAM;
-drop table t1;
-
-# End of 4.1 tests
-
-#
-# Bug #27811: The variable 'join_tab' is being used without being defined
-#
-CREATE TABLE t1 (a int, b int); INSERT INTO t1 VALUES (1,1);
-EXPLAIN SELECT * FROM t1 WHERE b = (SELECT max(2));
-DROP TABLE t1;
-
-#
-# Bug #33813: Schema names are case-sensitive in DROP FUNCTION
-#
-
-CREATE DATABASE `TESTDB`;
-
-USE `TESTDB`;
-DELIMITER //;
-
-CREATE FUNCTION test_fn() RETURNS INTEGER
-BEGIN
-DECLARE rId bigint;
-RETURN rId;
-END
-//
-
-CREATE FUNCTION test_fn2() RETURNS INTEGER
-BEGIN
-DECLARE rId bigint;
-RETURN rId;
-END
-//
-
-DELIMITER ;//
-
-DROP FUNCTION `TESTDB`.`test_fn`;
-DROP FUNCTION `testdb`.`test_fn2`;
-
-USE test;
-DROP DATABASE `TESTDB`;
-
---echo End of 5.0 tests.
-
---disable_warnings
-drop procedure if exists proc_1;
---enable_warnings
-#
-# Bug #20665: All commands supported in Stored Procedures should work in
-# Prepared Statements
-#
-
-create procedure proc_1() install plugin my_plug soname '\\root\\some_plugin.dll';
---error ER_UDF_NO_PATHS
-call proc_1();
---error ER_UDF_NO_PATHS
-call proc_1();
---error ER_UDF_NO_PATHS
-call proc_1();
-drop procedure proc_1;
-
-prepare abc from "install plugin my_plug soname '\\\\root\\\\some_plugin.dll'";
---error ER_UDF_NO_PATHS
-execute abc;
---error ER_UDF_NO_PATHS
-execute abc;
-deallocate prepare abc;
-
---echo #
---echo # Bug#45498: Socket variable not available on Windows
---echo #
-
-SELECT VARIABLE_NAME FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
- WHERE VARIABLE_NAME = 'socket';
-
---echo #
---echo # Bug#16581605: REPLACE.EXE UTILITY IS BROKEN IN 5.5
---echo #
-
-# Creating a temporary text file.
---write_file $MYSQL_TMP_DIR/bug16581605.txt
-abc
-def
-EOF
-
-#REPLACE.EXE UTILITY will work fine after the fix.
---exec $REPLACE abc xyz < $MYSQL_TMP_DIR/bug16581605.txt
-
-#Cleanup
-remove_file $MYSQL_TMP_DIR/bug16581605.txt;
diff --git a/mysql-test/t/wl4435_generated.inc b/mysql-test/t/wl4435_generated.inc
deleted file mode 100644
index 5ea05a89402..00000000000
--- a/mysql-test/t/wl4435_generated.inc
+++ /dev/null
@@ -1,588 +0,0 @@
-
-###########################################################################
-
---echo
---echo TINYINT
---echo
-
-CREATE PROCEDURE p1(OUT v TINYINT)
- SET v = 127;
-
-PREPARE stmt1 FROM 'CALL p1(?)';
-EXECUTE stmt1 USING @a;
-
-CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
-
-SHOW CREATE TABLE tmp1;
-
-SELECT @a, @a = 127;
-
-DROP TEMPORARY TABLE tmp1;
-DROP PROCEDURE p1;
-
-###########################################################################
-
---echo
---echo SMALLINT
---echo
-
-CREATE PROCEDURE p1(OUT v SMALLINT)
- SET v = 32767;
-
-PREPARE stmt1 FROM 'CALL p1(?)';
-EXECUTE stmt1 USING @a;
-
-CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
-
-SHOW CREATE TABLE tmp1;
-
-SELECT @a, @a = 32767;
-
-DROP TEMPORARY TABLE tmp1;
-DROP PROCEDURE p1;
-
-###########################################################################
-
---echo
---echo MEDIUMINT
---echo
-
-CREATE PROCEDURE p1(OUT v MEDIUMINT)
- SET v = 8388607;
-
-PREPARE stmt1 FROM 'CALL p1(?)';
-EXECUTE stmt1 USING @a;
-
-CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
-
-SHOW CREATE TABLE tmp1;
-
-SELECT @a, @a = 8388607;
-
-DROP TEMPORARY TABLE tmp1;
-DROP PROCEDURE p1;
-
-###########################################################################
-
---echo
---echo INT
---echo
-
-CREATE PROCEDURE p1(OUT v INT)
- SET v = 2147483647;
-
-PREPARE stmt1 FROM 'CALL p1(?)';
-EXECUTE stmt1 USING @a;
-
-CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
-
-SHOW CREATE TABLE tmp1;
-
-SELECT @a, @a = 2147483647;
-
-DROP TEMPORARY TABLE tmp1;
-DROP PROCEDURE p1;
-
-###########################################################################
-
---echo
---echo BIGINT
---echo
-
-CREATE PROCEDURE p1(OUT v BIGINT)
- SET v = 9223372036854775807;
-
-PREPARE stmt1 FROM 'CALL p1(?)';
-EXECUTE stmt1 USING @a;
-
-CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
-
-SHOW CREATE TABLE tmp1;
-
-SELECT @a, @a = 9223372036854775807;
-
-DROP TEMPORARY TABLE tmp1;
-DROP PROCEDURE p1;
-
-###########################################################################
-
---echo
---echo BIT(11)
---echo
-
-CREATE PROCEDURE p1(OUT v BIT(11))
- SET v = b'10100100101';
-
-PREPARE stmt1 FROM 'CALL p1(?)';
-EXECUTE stmt1 USING @a;
-
-CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
-
-SHOW CREATE TABLE tmp1;
-
-SELECT @a, @a = b'10100100101';
-
-DROP TEMPORARY TABLE tmp1;
-DROP PROCEDURE p1;
-
-###########################################################################
-
---echo
---echo TIMESTAMP
---echo
-
-CREATE PROCEDURE p1(OUT v TIMESTAMP)
- SET v = '2007-11-18 15:01:02';
-
-PREPARE stmt1 FROM 'CALL p1(?)';
-EXECUTE stmt1 USING @a;
-
-CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
-
-SHOW CREATE TABLE tmp1;
-
-SELECT @a, @a = '2007-11-18 15:01:02';
-
-DROP TEMPORARY TABLE tmp1;
-DROP PROCEDURE p1;
-
-###########################################################################
-
---echo
---echo DATETIME
---echo
-
-CREATE PROCEDURE p1(OUT v DATETIME)
- SET v = '1234-11-12 12:34:59';
-
-PREPARE stmt1 FROM 'CALL p1(?)';
-EXECUTE stmt1 USING @a;
-
-CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
-
-SHOW CREATE TABLE tmp1;
-
-SELECT @a, @a = '1234-11-12 12:34:59';
-
-DROP TEMPORARY TABLE tmp1;
-DROP PROCEDURE p1;
-
-###########################################################################
-
---echo
---echo TIME
---echo
-
-CREATE PROCEDURE p1(OUT v TIME)
- SET v = '123:45:01';
-
-PREPARE stmt1 FROM 'CALL p1(?)';
-EXECUTE stmt1 USING @a;
-
-CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
-
-SHOW CREATE TABLE tmp1;
-
-SELECT @a, @a = '123:45:01';
-
-DROP TEMPORARY TABLE tmp1;
-DROP PROCEDURE p1;
-
-###########################################################################
-
---echo
---echo DATE
---echo
-
-CREATE PROCEDURE p1(OUT v DATE)
- SET v = '1234-11-12';
-
-PREPARE stmt1 FROM 'CALL p1(?)';
-EXECUTE stmt1 USING @a;
-
-CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
-
-SHOW CREATE TABLE tmp1;
-
-SELECT @a, @a = '1234-11-12';
-
-DROP TEMPORARY TABLE tmp1;
-DROP PROCEDURE p1;
-
-###########################################################################
-
---echo
---echo YEAR
---echo
-
-CREATE PROCEDURE p1(OUT v YEAR)
- SET v = 2010;
-
-PREPARE stmt1 FROM 'CALL p1(?)';
-EXECUTE stmt1 USING @a;
-
-CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
-
-SHOW CREATE TABLE tmp1;
-
-SELECT @a, @a = 2010;
-
-DROP TEMPORARY TABLE tmp1;
-DROP PROCEDURE p1;
-
-###########################################################################
-
---echo
---echo FLOAT(7, 4)
---echo
-
-CREATE PROCEDURE p1(OUT v FLOAT(7, 4))
- SET v = 123.4567;
-
-PREPARE stmt1 FROM 'CALL p1(?)';
-EXECUTE stmt1 USING @a;
-
-CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
-
-SHOW CREATE TABLE tmp1;
-
-SELECT @a, @a - 123.4567 < 0.00001;
-
-DROP TEMPORARY TABLE tmp1;
-DROP PROCEDURE p1;
-
-###########################################################################
-
---echo
---echo DOUBLE(8, 5)
---echo
-
-CREATE PROCEDURE p1(OUT v DOUBLE(8, 5))
- SET v = 123.45678;
-
-PREPARE stmt1 FROM 'CALL p1(?)';
-EXECUTE stmt1 USING @a;
-
-CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
-
-SHOW CREATE TABLE tmp1;
-
-SELECT @a, @a - 123.45678 < 0.000001;
-
-DROP TEMPORARY TABLE tmp1;
-DROP PROCEDURE p1;
-
-###########################################################################
-
---echo
---echo DECIMAL(9, 6)
---echo
-
-CREATE PROCEDURE p1(OUT v DECIMAL(9, 6))
- SET v = 123.456789;
-
-PREPARE stmt1 FROM 'CALL p1(?)';
-EXECUTE stmt1 USING @a;
-
-CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
-
-SHOW CREATE TABLE tmp1;
-
-SELECT @a, @a = 123.456789;
-
-DROP TEMPORARY TABLE tmp1;
-DROP PROCEDURE p1;
-
-###########################################################################
-
---echo
---echo CHAR(32)
---echo
-
-CREATE PROCEDURE p1(OUT v CHAR(32))
- SET v = REPEAT('a', 16);
-
-PREPARE stmt1 FROM 'CALL p1(?)';
-EXECUTE stmt1 USING @a;
-
-CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
-
-SHOW CREATE TABLE tmp1;
-
-SELECT @a, @a = REPEAT('a', 16);
-
-DROP TEMPORARY TABLE tmp1;
-DROP PROCEDURE p1;
-
-###########################################################################
-
---echo
---echo VARCHAR(32)
---echo
-
-CREATE PROCEDURE p1(OUT v VARCHAR(32))
- SET v = REPEAT('b', 16);
-
-PREPARE stmt1 FROM 'CALL p1(?)';
-EXECUTE stmt1 USING @a;
-
-CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
-
-SHOW CREATE TABLE tmp1;
-
-SELECT @a, @a = REPEAT('b', 16);
-
-DROP TEMPORARY TABLE tmp1;
-DROP PROCEDURE p1;
-
-###########################################################################
-
---echo
---echo TINYTEXT
---echo
-
-CREATE PROCEDURE p1(OUT v TINYTEXT)
- SET v = REPEAT('c', 16);
-
-PREPARE stmt1 FROM 'CALL p1(?)';
-EXECUTE stmt1 USING @a;
-
-CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
-
-SHOW CREATE TABLE tmp1;
-
-SELECT @a, @a = REPEAT('c', 16);
-
-DROP TEMPORARY TABLE tmp1;
-DROP PROCEDURE p1;
-
-###########################################################################
-
---echo
---echo TEXT
---echo
-
-CREATE PROCEDURE p1(OUT v TEXT)
- SET v = REPEAT('d', 16);
-
-PREPARE stmt1 FROM 'CALL p1(?)';
-EXECUTE stmt1 USING @a;
-
-CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
-
-SHOW CREATE TABLE tmp1;
-
-SELECT @a, @a = REPEAT('d', 16);
-
-DROP TEMPORARY TABLE tmp1;
-DROP PROCEDURE p1;
-
-###########################################################################
-
---echo
---echo MEDIUMTEXT
---echo
-
-CREATE PROCEDURE p1(OUT v MEDIUMTEXT)
- SET v = REPEAT('e', 16);
-
-PREPARE stmt1 FROM 'CALL p1(?)';
-EXECUTE stmt1 USING @a;
-
-CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
-
-SHOW CREATE TABLE tmp1;
-
-SELECT @a, @a = REPEAT('e', 16);
-
-DROP TEMPORARY TABLE tmp1;
-DROP PROCEDURE p1;
-
-###########################################################################
-
---echo
---echo LONGTEXT
---echo
-
-CREATE PROCEDURE p1(OUT v LONGTEXT)
- SET v = REPEAT('f', 16);
-
-PREPARE stmt1 FROM 'CALL p1(?)';
-EXECUTE stmt1 USING @a;
-
-CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
-
-SHOW CREATE TABLE tmp1;
-
-SELECT @a, @a = REPEAT('f', 16);
-
-DROP TEMPORARY TABLE tmp1;
-DROP PROCEDURE p1;
-
-###########################################################################
-
---echo
---echo BINARY(32)
---echo
-
-CREATE PROCEDURE p1(OUT v BINARY(32))
- SET v = REPEAT('g', 32);
-
-PREPARE stmt1 FROM 'CALL p1(?)';
-EXECUTE stmt1 USING @a;
-
-CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
-
-SHOW CREATE TABLE tmp1;
-
-SELECT @a, @a = REPEAT('g', 32);
-
-DROP TEMPORARY TABLE tmp1;
-DROP PROCEDURE p1;
-
-###########################################################################
-
---echo
---echo VARBINARY(32)
---echo
-
-CREATE PROCEDURE p1(OUT v VARBINARY(32))
- SET v = REPEAT('h', 16);
-
-PREPARE stmt1 FROM 'CALL p1(?)';
-EXECUTE stmt1 USING @a;
-
-CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
-
-SHOW CREATE TABLE tmp1;
-
-SELECT @a, @a = REPEAT('h', 16);
-
-DROP TEMPORARY TABLE tmp1;
-DROP PROCEDURE p1;
-
-###########################################################################
-
---echo
---echo TINYBLOB
---echo
-
-CREATE PROCEDURE p1(OUT v TINYBLOB)
- SET v = REPEAT('i', 16);
-
-PREPARE stmt1 FROM 'CALL p1(?)';
-EXECUTE stmt1 USING @a;
-
-CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
-
-SHOW CREATE TABLE tmp1;
-
-SELECT @a, @a = REPEAT('i', 16);
-
-DROP TEMPORARY TABLE tmp1;
-DROP PROCEDURE p1;
-
-###########################################################################
-
---echo
---echo BLOB
---echo
-
-CREATE PROCEDURE p1(OUT v BLOB)
- SET v = REPEAT('j', 16);
-
-PREPARE stmt1 FROM 'CALL p1(?)';
-EXECUTE stmt1 USING @a;
-
-CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
-
-SHOW CREATE TABLE tmp1;
-
-SELECT @a, @a = REPEAT('j', 16);
-
-DROP TEMPORARY TABLE tmp1;
-DROP PROCEDURE p1;
-
-###########################################################################
-
---echo
---echo MEDIUMBLOB
---echo
-
-CREATE PROCEDURE p1(OUT v MEDIUMBLOB)
- SET v = REPEAT('k', 16);
-
-PREPARE stmt1 FROM 'CALL p1(?)';
-EXECUTE stmt1 USING @a;
-
-CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
-
-SHOW CREATE TABLE tmp1;
-
-SELECT @a, @a = REPEAT('k', 16);
-
-DROP TEMPORARY TABLE tmp1;
-DROP PROCEDURE p1;
-
-###########################################################################
-
---echo
---echo LONGBLOB
---echo
-
-CREATE PROCEDURE p1(OUT v LONGBLOB)
- SET v = REPEAT('l', 16);
-
-PREPARE stmt1 FROM 'CALL p1(?)';
-EXECUTE stmt1 USING @a;
-
-CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
-
-SHOW CREATE TABLE tmp1;
-
-SELECT @a, @a = REPEAT('l', 16);
-
-DROP TEMPORARY TABLE tmp1;
-DROP PROCEDURE p1;
-
-###########################################################################
-
---echo
---echo SET('aaa', 'bbb')
---echo
-
-CREATE PROCEDURE p1(OUT v SET('aaa', 'bbb'))
- SET v = 'aaa';
-
-PREPARE stmt1 FROM 'CALL p1(?)';
-EXECUTE stmt1 USING @a;
-
-CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
-
-SHOW CREATE TABLE tmp1;
-
-SELECT @a, @a = 'aaa';
-
-DROP TEMPORARY TABLE tmp1;
-DROP PROCEDURE p1;
-
-###########################################################################
-
---echo
---echo ENUM('aaa', 'bbb')
---echo
-
-CREATE PROCEDURE p1(OUT v ENUM('aaa', 'bbb'))
- SET v = 'aaa';
-
-PREPARE stmt1 FROM 'CALL p1(?)';
-EXECUTE stmt1 USING @a;
-
-CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1;
-
-SHOW CREATE TABLE tmp1;
-
-SELECT @a, @a = 'aaa';
-
-DROP TEMPORARY TABLE tmp1;
-DROP PROCEDURE p1;
diff --git a/mysql-test/t/xa.test b/mysql-test/t/xa.test
deleted file mode 100644
index b5ef5a118b1..00000000000
--- a/mysql-test/t/xa.test
+++ /dev/null
@@ -1,482 +0,0 @@
-#
-# WL#1756
-#
--- source include/have_innodb.inc
-
---source include/not_embedded.inc
-
-# Save the initial number of concurrent sessions
---source include/count_sessions.inc
-
-call mtr.add_suppression("Deadlock found when trying to get lock; try restarting transaction");
-
---disable_warnings
-drop table if exists t1, t2;
---enable_warnings
-create table t1 (a int) engine=innodb;
-xa start 'test1';
-insert t1 values (10);
-xa end 'test1';
-xa prepare 'test1';
-xa rollback 'test1';
-select * from t1;
-
-xa start 'test2';
---error ER_XAER_RMFAIL
-xa start 'test-bad';
-insert t1 values (20);
---error ER_XAER_RMFAIL
-xa prepare 'test2';
-xa end 'test2';
-xa prepare 'test2';
-xa commit 'test2';
-select * from t1;
-
-xa start 'testa','testb';
-insert t1 values (30);
-
---error ER_XAER_RMFAIL
-commit;
-
-xa end 'testa','testb';
-
---error ER_XAER_RMFAIL
-begin;
---error ER_XAER_RMFAIL
-create table t2 (a int);
-
-connect (con1,localhost,root,,);
-connection con1;
-
---error ER_XAER_DUPID
-xa start 'testa','testb';
---error ER_XAER_DUPID
-xa start 'testa','testb', 123;
-
-# gtrid [ , bqual [ , formatID ] ]
-xa start 0x7465737462, 0x2030405060, 0xb;
-insert t1 values (40);
-xa end 'testb',' 0@P`',11;
-xa prepare 'testb',0x2030405060,11;
-
---error ER_XAER_RMFAIL
-start transaction;
-
-xa recover;
-
-# uncomment the line below when binlog will be able to prepare
-#disconnect con1;
-connection default;
-
-xa prepare 'testa','testb';
-
-xa recover;
-
---error ER_XAER_NOTA
-xa commit 'testb',0x2030405060,11;
-xa rollback 'testa','testb';
-
---error ER_PARSE_ERROR
-xa start 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz';
-
-select * from t1;
-disconnect con1;
---source include/wait_until_count_sessions.inc
-
-connection default;
-
-# MDEV-14593 human-readable XA RECOVER
-xa start 'tr1';
-insert t1 values (40);
-xa end 'tr1';
-xa prepare 'tr1';
-xa recover format='SQL';
-xa rollback 'tr1';
-
-xa start 'tr1', 'bq';
-insert t1 values (40);
-xa end 'tr1', 'bq';
-xa prepare 'tr1', 'bq';
-xa recover format='SQL';
-xa rollback 'tr1', 'bq';
-
-xa start 'tr1', 'bq', 3;
-insert t1 values (40);
-xa end 'tr1', 'bq', 3;
-xa prepare 'tr1', 'bq', 3;
-xa recover format='SQL';
-xa rollback 'tr1', 'bq', 3;
-
-xa start 'tr1#$';
-insert t1 values (40);
-xa end 'tr1#$';
-xa prepare 'tr1#$';
-xa recover format='SQL';
-xa rollback 'tr1#$';
-
-xa start 'tr1#$', 'bq';
-insert t1 values (40);
-xa end 'tr1#$', 'bq';
-xa prepare 'tr1#$', 'bq';
-xa recover format='SQL';
-xa rollback 'tr1#$', 'bq';
-
-xa start 'tr1#$', 'bq', 3;
-insert t1 values (40);
-xa end 'tr1#$', 'bq', 3;
-xa prepare 'tr1#$', 'bq', 3;
-xa recover format='RAW';
---error ER_UNKNOWN_EXPLAIN_FORMAT
-xa recover format='PLAIN';
-xa recover format='SQL';
-xa rollback 'tr1#$', 'bq', 3;
-
-drop table t1;
-
-#
-# Bug#28323: Server crashed in xid cache operations
-#
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1(a int, b int, c varchar(20), primary key(a)) engine = innodb;
-insert into t1 values(1, 1, 'a');
-insert into t1 values(2, 2, 'b');
-
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-
---connection con1
-xa start 'a','b';
-update t1 set c = 'aa' where a = 1;
---connection con2
-xa start 'a','c';
-update t1 set c = 'bb' where a = 2;
---connection con1
---send update t1 set c = 'bb' where a = 2
---connection con2
---sleep 1
---error ER_LOCK_DEADLOCK
-update t1 set c = 'aa' where a = 1;
-select count(*) from t1;
---error ER_XA_RBDEADLOCK
-xa end 'a','c';
-xa rollback 'a','c';
---disconnect con2
-
-connect (con3,localhost,root,,);
---connection con3
-xa start 'a','c';
-
---disconnect con1
---disconnect con3
---connection default
-drop table t1;
-
---echo #
---echo # BUG#51342 - more xid crashing
---echo #
-CREATE TABLE t1(a INT) ENGINE=InnoDB;
-XA START 'x';
-SET SESSION autocommit=0;
-INSERT INTO t1 VALUES(1);
---error ER_XAER_RMFAIL
-SET SESSION autocommit=1;
-SELECT @@autocommit;
-INSERT INTO t1 VALUES(1);
-XA END 'x';
-XA COMMIT 'x' ONE PHASE;
-DROP TABLE t1;
-SET SESSION autocommit=1;
-
---echo End of 5.0 tests
-
-#
-# Bug#44672: Assertion failed: thd->transaction.xid_state.xid.is_null()
-#
-
-xa start 'a';
-xa end 'a';
-xa rollback 'a';
-xa start 'a';
-xa end 'a';
-xa rollback 'a';
-
-#
-# Bug#45548: XA transaction without access to InnoDB tables crashes the server
-#
-
-xa start 'a';
-xa end 'a';
-xa prepare 'a';
-xa commit 'a';
-
-xa start 'a';
-xa end 'a';
-xa prepare 'a';
-xa commit 'a';
-
-#
-# BUG#43171 - Assertion failed: thd->transaction.xid_state.xid.is_null()
-#
-CREATE TABLE t1(a INT, KEY(a)) ENGINE=InnoDB;
-INSERT INTO t1 VALUES(1),(2);
-connect(con1,localhost,root,,);
-
-# Part 1: Prepare to test XA START after regular transaction deadlock
-BEGIN;
-UPDATE t1 SET a=3 WHERE a=1;
-
-connection default;
-BEGIN;
-UPDATE t1 SET a=4 WHERE a=2;
-
-connection con1;
-let $conn_id= `SELECT CONNECTION_ID()`;
-SEND UPDATE t1 SET a=5 WHERE a=2;
-
-connection default;
-let $wait_timeout= 2;
-let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE ID=$conn_id AND STATE='Searching rows for update';
---source include/wait_condition.inc
-
---error ER_LOCK_DEADLOCK
-UPDATE t1 SET a=5 WHERE a=1;
-ROLLBACK;
-
-# Part 2: Prepare to test XA START after XA transaction deadlock
-connection con1;
-REAP;
-ROLLBACK;
-BEGIN;
-UPDATE t1 SET a=3 WHERE a=1;
-
-connection default;
-XA START 'xid1';
-UPDATE t1 SET a=4 WHERE a=2;
-
-connection con1;
-SEND UPDATE t1 SET a=5 WHERE a=2;
-
-connection default;
-let $wait_timeout= 2;
-let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST
-WHERE ID=$conn_id AND STATE='Searching rows for update';
---source include/wait_condition.inc
-
---error ER_LOCK_DEADLOCK
-UPDATE t1 SET a=5 WHERE a=1;
---error ER_XA_RBDEADLOCK
-XA END 'xid1';
-XA ROLLBACK 'xid1';
-
-XA START 'xid1';
-XA END 'xid1';
-XA ROLLBACK 'xid1';
-
-disconnect con1;
-DROP TABLE t1;
-
-
---echo #
---echo # Bug#56448 Assertion failed: ! is_set() with second xa end
---echo #
-
-XA START 'x';
-XA END 'x';
-# Second XA END caused an assertion.
---error ER_XAER_RMFAIL
-XA END 'x';
-XA PREPARE 'x';
-# Second XA PREPARE also caused an assertion.
---error ER_XAER_RMFAIL
-XA PREPARE 'x';
-XA ROLLBACK 'x';
-
-
---echo #
---echo # Bug#59986 Assert in Diagnostics_area::set_ok_status() for XA COMMIT
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a)) engine=InnoDB;
-INSERT INTO t1 VALUES (1, 1), (2, 2);
-
-connect (con1, localhost, root);
-XA START 'a';
-UPDATE t1 SET b= 3 WHERE a=1;
-
-connection default;
-XA START 'b';
-UPDATE t1 SET b=4 WHERE a=2;
---echo # Sending:
---send UPDATE t1 SET b=5 WHERE a=1
-
-connection con1;
---sleep 1
---error ER_LOCK_DEADLOCK
-UPDATE t1 SET b=6 WHERE a=2;
-# This used to trigger the assert
---error ER_XA_RBDEADLOCK
-XA COMMIT 'a';
-
-connection default;
---echo # Reaping: UPDATE t1 SET b=5 WHERE a=1
---reap
-XA END 'b';
-XA ROLLBACK 'b';
-DROP TABLE t1;
-disconnect con1;
-
-
---echo #
---echo # Bug#11766752 59936: multiple xa assertions - transactional
---echo # statement fuzzer
---echo #
-
-CREATE TABLE t1 (a INT) engine=InnoDB;
-XA START 'a';
-INSERT INTO t1 VALUES (1);
-
-SAVEPOINT savep;
-
-XA END 'a';
---error ER_XAER_RMFAIL
-SELECT * FROM t1;
---error ER_XAER_RMFAIL
-INSERT INTO t1 VALUES (2);
---error ER_XAER_RMFAIL
-SAVEPOINT savep;
---error ER_XAER_RMFAIL
-SET @a=(SELECT * FROM t1);
-
-XA PREPARE 'a';
---error ER_XAER_RMFAIL
-SELECT * FROM t1; # used to cause InnoDB assert
---error ER_XAER_RMFAIL
-INSERT INTO t1 VALUES (2); # used to cause InnoDB assert
---error ER_XAER_RMFAIL
-SAVEPOINT savep;
---error ER_XAER_RMFAIL
-SET @a=(SELECT * FROM t1); # used to cause InnoDB assert
---error ER_XAER_RMFAIL
-UPDATE t1 SET a=1 WHERE a=2;
-
-XA COMMIT 'a';
-SELECT * FROM t1;
-DROP TABLE t1;
-
-
---echo #
---echo # MDEV-14609 XA Transction unable to ROLLBACK TO SAVEPOINT
---echo #
-
-CREATE TABLE t1 (c1 INT) ENGINE=INNODB;
-XA START 'xa1';
-SAVEPOINT savepoint1;
-INSERT INTO t1 (c1) VALUES (1),(2),(3),(4);
-ROLLBACK TO SAVEPOINT savepoint1;
-XA END 'xa1';
-XA ROLLBACK 'xa1';
-DROP TABLE t1;
-
-
---echo #
---echo # Bug#12352846 - TRANS_XA_START(THD*):
---echo # ASSERTION THD->TRANSACTION.XID_STATE.XID.IS_NULL()
---echo # FAILED
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1, t2;
---enable_warnings
-
-CREATE TABLE t1 (a INT) ENGINE=InnoDB;
-CREATE TABLE t2 (a INT) ENGINE=InnoDB;
-
-START TRANSACTION;
-INSERT INTO t1 VALUES (1);
-
---connect (con2,localhost,root)
-XA START 'xid1';
---echo # Sending:
---send INSERT INTO t2 SELECT a FROM t1
-
---connection default
-let $wait_condition=
- SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Sending data"
- AND info = "INSERT INTO t2 SELECT a FROM t1";
---echo # Waiting until INSERT ... is blocked
---source include/wait_condition.inc
---sleep 0.1
-DELETE FROM t1;
-
---connection con2
---echo # Reaping: INSERT INTO t2 SELECT a FROM t1
---error ER_LOCK_DEADLOCK
---reap
---error ER_XA_RBDEADLOCK
-XA COMMIT 'xid1';
-
-connection default;
-
-COMMIT;
-
-connection con2;
-# This caused the assert to be triggered
-XA START 'xid1';
-
-XA END 'xid1';
-XA PREPARE 'xid1';
-XA ROLLBACK 'xid1';
-
-connection default;
-DROP TABLE t1, t2;
-disconnect con2;
-
-
-#
-# MDEV 15217 Assertion `thd->transaction.xid_state.xid.is_null()' failed in trans_xa_start.
-#
-CREATE TABLE t1 (pk INT PRIMARY KEY) ENGINE=InnoDB;
-CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1),(2);
-CREATE TABLE t3 (i INT) ENGINE=InnoDB;
-
-XA BEGIN 'xid1';
-REPLACE INTO t1 SELECT * FROM t2;
-
---connect (con1,localhost,root,,test)
-XA BEGIN 'xid2';
---send
-INSERT INTO t1 SELECT * FROM t2;
-
---connection default
-REPLACE INTO t2 SELECT * FROM t2;
-
---connection con1
---error 0, ER_LOCK_DEADLOCK, ER_LOCK_WAIT_TIMEOUT
---reap
---disconnect con1
-
---connect (con2,localhost,root,,test)
-INSERT INTO t3 VALUES (1);
-XA BEGIN 'xid3';
-
-
-#Cleanup
---disconnect con2
---connection default
-XA END 'xid1';
-XA ROLLBACK 'xid1';
-DROP TABLE t1, t2, t3;
-
---source include/wait_until_count_sessions.inc
-
diff --git a/mysql-test/t/xa_binlog.test b/mysql-test/t/xa_binlog.test
deleted file mode 100644
index ecbf1f4f066..00000000000
--- a/mysql-test/t/xa_binlog.test
+++ /dev/null
@@ -1,32 +0,0 @@
---source include/have_innodb.inc
---source include/have_log_bin.inc
-
-CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
-
-# Fix binlog format (otherwise SHOW BINLOG EVENTS will fluctuate).
-SET binlog_format= mixed;
-
-RESET MASTER;
-
-XA START 'xatest';
-INSERT INTO t1 VALUES (1);
-XA END 'xatest';
-XA PREPARE 'xatest';
-XA COMMIT 'xatest';
-
-XA START 'xatest';
-INSERT INTO t1 VALUES (2);
-XA END 'xatest';
-XA COMMIT 'xatest' ONE PHASE;
-
-BEGIN;
-INSERT INTO t1 VALUES (3);
-COMMIT;
-
-SELECT * FROM t1 ORDER BY a;
-
---replace_column 2 # 5 #
---replace_regex /xid=[0-9]+/xid=XX/ /GTID [0-9]+-[0-9]+-[0-9]+/GTID #-#-#/
-SHOW BINLOG EVENTS LIMIT 3,9;
-
-DROP TABLE t1;
diff --git a/mysql-test/t/xa_sync.test b/mysql-test/t/xa_sync.test
deleted file mode 100644
index bb95af7c0ba..00000000000
--- a/mysql-test/t/xa_sync.test
+++ /dev/null
@@ -1,45 +0,0 @@
---source include/have_debug_sync.inc
-
---echo #
---echo # MDEV-7793 - Race condition between XA COMMIT/ROLLBACK and disconnect
---echo #
---echo # Note that this test is meaningful only with valgrind.
-let $op= XA COMMIT 'xatest';
-let $i= 2;
-while ($i)
-{
- connect con1, localhost, root;
- connect con2, localhost, root;
-
- connection con1;
- XA START 'xatest';
- XA END 'xatest';
- XA PREPARE 'xatest';
-
- connection con2;
- SET debug_sync='xa_after_search SIGNAL parked WAIT_FOR go';
- send_eval $op;
-
- connection default;
- SET debug_sync='now WAIT_FOR parked';
- disconnect con1;
- disable_query_log;
- echo # Waiting for thread to get deleted;
- while (`SELECT count(*)!=2 FROM INFORMATION_SCHEMA.PROCESSLIST`)
- {
- real_sleep 0.1;
- }
- enable_query_log;
- SET debug_sync='now SIGNAL go';
-
- connection con2;
- --error ER_XAER_NOTA
- reap;
- disconnect con2;
-
- connection default;
- SET debug_sync='RESET';
-
- let $op= XA ROLLBACK 'xatest';
- dec $i;
-}
diff --git a/mysql-test/t/xml.test b/mysql-test/t/xml.test
deleted file mode 100644
index b567f03a431..00000000000
--- a/mysql-test/t/xml.test
+++ /dev/null
@@ -1,784 +0,0 @@
-SET @xml='<a aa1="aa1" aa2="aa2">a1<b ba1="ba1">b1<c>c1</c>b2</b>a2</a>';
-SELECT extractValue(@xml,'/a');
-SELECT extractValue(@xml,'/a/b');
-SELECT extractValue(@xml,'/a/b/c');
-SELECT extractValue(@xml,'/a/@aa1');
-SELECT extractValue(@xml,'/a/@aa2');
-SELECT extractValue(@xml,'/a/@*');
-SELECT extractValue(@xml,'//@ba1');
-
-SELECT extractValue(@xml,'//a');
-SELECT extractValue(@xml,'//b');
-SELECT extractValue(@xml,'//c');
-SELECT extractValue(@xml,'/a//b');
-SELECT extractValue(@xml,'/a//c');
-SELECT extractValue(@xml,'//*');
-SELECT extractValue(@xml,'/a//*');
-SELECT extractValue(@xml,'/./a');
-SELECT extractValue(@xml,'/a/b/.');
-SELECT extractValue(@xml,'/a/b/..');
-SELECT extractValue(@xml,'/a/b/../@aa1');
-SELECT extractValue(@xml,'/*');
-SELECT extractValue(@xml,'/*/*');
-SELECT extractValue(@xml,'/*/*/*');
-
-SELECT extractValue(@xml,'/a/child::*');
-SELECT extractValue(@xml,'/a/self::*');
-SELECT extractValue(@xml,'/a/descendant::*');
-SELECT extractValue(@xml,'/a/descendant-or-self::*');
-SELECT extractValue(@xml,'/a/attribute::*');
-SELECT extractValue(@xml,'/a/b/c/parent::*');
-SELECT extractValue(@xml,'/a/b/c/ancestor::*');
-SELECT extractValue(@xml,'/a/b/c/ancestor-or-self::*');
-SELECT extractValue(@xml,'/descendant-or-self::*');
-
-SET @xml='<a>a11<b ba="ba11" ba="ba12">b11</b><b ba="ba21" ba="ba22">b21<c>c1</c>b22</b>a12</a>';
-SELECT extractValue(@xml,'/a/b/c/ancestor-or-self::*');
-SELECT extractValue(@xml,'//@ba');
-
-SET @xml='<a><b>b</b><c>c</c></a>';
-SELECT extractValue(@xml,'/a/b');
-SELECT extractValue(@xml,'/a/c');
-SELECT extractValue(@xml,'/a/child::b');
-SELECT extractValue(@xml,'/a/child::c');
-
-SET @xml='<a><b>b1</b><c>c1</c><b>b2</b><c>c2</c></a>';
-SELECT extractValue(@xml,'/a/b[1]');
-SELECT extractValue(@xml,'/a/b[2]');
-SELECT extractValue(@xml,'/a/c[1]');
-SELECT extractValue(@xml,'/a/c[2]');
-
-SET @xml='<a><b x="xb1" x="xb2"/><c x="xc1" x="xc2"/></a>';
-SELECT extractValue(@xml,'/a//@x');
-SELECT extractValue(@xml,'/a//@x[1]');
-SELECT extractValue(@xml,'/a//@x[2]');
-
-SET @xml='<a><b>b1</b><b>b2</b><c><b>c1b1</b><b>c1b2</b></c><c><b>c2b1</b></c></a>';
-SELECT extractValue(@xml,'//b[1]');
-SELECT extractValue(@xml,'/descendant::b[1]');
-
-SET @xml='<a><b>b1</b><b>b2</b></a>';
-SELECT extractValue(@xml,'/a/b[1+0]');
-SELECT extractValue(@xml,'/a/b[1*1]');
-SELECT extractValue(@xml,'/a/b[--1]');
-SELECT extractValue(@xml,'/a/b[2*1-1]');
-
-SELECT extractValue(@xml,'/a/b[1+1]');
-SELECT extractValue(@xml,'/a/b[1*2]');
-SELECT extractValue(@xml,'/a/b[--2]');
-SELECT extractValue(@xml,'/a/b[1*(3-1)]');
-
-SELECT extractValue(@xml,'//*[1=1]');
-SELECT extractValue(@xml,'//*[1!=1]');
-SELECT extractValue(@xml,'//*[1>1]');
-SELECT extractValue(@xml,'//*[2>1]');
-SELECT extractValue(@xml,'//*[1>2]');
-SELECT extractValue(@xml,'//*[1>=1]');
-SELECT extractValue(@xml,'//*[2>=1]');
-SELECT extractValue(@xml,'//*[1>=2]');
-SELECT extractValue(@xml,'//*[1<1]');
-SELECT extractValue(@xml,'//*[2<1]');
-SELECT extractValue(@xml,'//*[1<2]');
-SELECT extractValue(@xml,'//*[1<=1]');
-SELECT extractValue(@xml,'//*[2<=1]');
-SELECT extractValue(@xml,'//*[1<=2]');
-
-SET @xml='<a><b>b11<c>c11</c></b><b>b21<c>c21</c></b></a>';
-SELECT extractValue(@xml,'/a/b[c="c11"]');
-SELECT extractValue(@xml,'/a/b[c="c21"]');
-
-SET @xml='<a><b c="c11">b11</b><b c="c21">b21</b></a>';
-SELECT extractValue(@xml,'/a/b[@c="c11"]');
-SELECT extractValue(@xml,'/a/b[@c="c21"]');
-
-SET @xml='<a>a1<b c="c11">b11<d>d11</d></b><b c="c21">b21<d>d21</d></b></a>';
-SELECT extractValue(@xml, '/a/b[@c="c11"]/d');
-SELECT extractValue(@xml, '/a/b[@c="c21"]/d');
-SELECT extractValue(@xml, '/a/b[d="d11"]/@c');
-SELECT extractValue(@xml, '/a/b[d="d21"]/@c');
-SELECT extractValue(@xml, '/a[b="b11"]');
-SELECT extractValue(@xml, '/a[b/@c="c11"]');
-SELECT extractValue(@xml, '/a[b/d="d11"]');
-SELECT extractValue(@xml, '/a[/a/b="b11"]');
-SELECT extractValue(@xml, '/a[/a/b/@c="c11"]');
-SELECT extractValue(@xml, '/a[/a/b/d="d11"]');
-
-SELECT extractValue('<a>a</a>', '/a[false()]');
-SELECT extractValue('<a>a</a>', '/a[true()]');
-SELECT extractValue('<a>a</a>', '/a[not(false())]');
-SELECT extractValue('<a>a</a>', '/a[not(true())]');
-SELECT extractValue('<a>a</a>', '/a[true() and true()]');
-SELECT extractValue('<a>a</a>', '/a[true() and false()]');
-SELECT extractValue('<a>a</a>', '/a[false()and false()]');
-SELECT extractValue('<a>a</a>', '/a[false()and true()]');
-SELECT extractValue('<a>a</a>', '/a[true() or true()]');
-SELECT extractValue('<a>a</a>', '/a[true() or false()]');
-SELECT extractValue('<a>a</a>', '/a[false()or false()]');
-SELECT extractValue('<a>a</a>', '/a[false()or true()]');
-
-SET @xml='<a>ab<b c="c" c="e">b1</b><b c="d">b2</b><b c="f" c="e">b3</b></a>';
-select extractValue(@xml,'/a/b[@c="c"]');
-select extractValue(@xml,'/a/b[@c="d"]');
-select extractValue(@xml,'/a/b[@c="e"]');
-select extractValue(@xml,'/a/b[not(@c="e")]');
-select extractValue(@xml,'/a/b[@c!="e"]');
-select extractValue(@xml,'/a/b[@c="c" or @c="d"]');
-select extractValue(@xml,'/a/b[@c="c" and @c="e"]');
-
-SET @xml='<a><b c="c" d="d">b1</b><b d="d" e="e">b2</b></a>';
-select extractValue(@xml,'/a/b[@c]');
-select extractValue(@xml,'/a/b[@d]');
-select extractValue(@xml,'/a/b[@e]');
-select extractValue(@xml,'/a/b[not(@c)]');
-select extractValue(@xml,'/a/b[not(@d)]');
-select extractValue(@xml,'/a/b[not(@e)]');
-
-select extractValue(@xml, '/a/b[boolean(@c) or boolean(@d)]');
-select extractValue(@xml, '/a/b[boolean(@c) or boolean(@e)]');
-select extractValue(@xml, '/a/b[boolean(@d) or boolean(@e)]');
-select extractValue(@xml, '/a/b[boolean(@c) and boolean(@d)]');
-select extractValue(@xml, '/a/b[boolean(@c) and boolean(@e)]');
-select extractValue(@xml, '/a/b[boolean(@d) and boolean(@e)]');
-
-select extractValue(@xml, '/a/b[@c or @d]');
-select extractValue(@xml, '/a/b[@c or @e]');
-select extractValue(@xml, '/a/b[@d or @e]');
-select extractValue(@xml, '/a/b[@c and @d]');
-select extractValue(@xml, '/a/b[@c and @e]');
-select extractValue(@xml, '/a/b[@d and @e]');
-
-SET @xml='<a><b c="c">b1</b><b>b2</b></a>';
-SELECT extractValue(@xml,'/a/b[@*]');
-SELECT extractValue(@xml,'/a/b[not(@*)]');
-
-SELECT extractValue('<a>a</a>', '/a[ceiling(3.1)=4]');
-SELECT extractValue('<a>a</a>', '/a[floor(3.1)=3]');
-SELECT extractValue('<a>a</a>', '/a[round(3.1)=3]');
-SELECT extractValue('<a>a</a>', '/a[round(3.8)=4]');
-
-SELECT extractValue('<a><b>b</b><c>c</c></a>', '/a/b | /a/c');
-
-select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[position()=1]');
-select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[position()=2]');
-select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[position()=3]');
-select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[1=position()]');
-select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[2=position()]');
-select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[3=position()]');
-select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[2>=position()]');
-select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[2<=position()]');
-select extractValue('<a b="b1" b="b2" b="b3"/>','/a/@b[position()=3 or position()=2]');
-
-SELECT extractValue('<a>a<b>a1<c>c1</c></b><b>a2</b></a>','/a/b[count(c)=0]');
-SELECT extractValue('<a>a<b>a1<c>c1</c></b><b>a2</b></a>','/a/b[count(c)=1]');
-select extractValue('<a>a1<b ba="1" ba="2">b1</b><b>b2</b>4</a>','/a/b[sum(@ba)=3]');
-
-select extractValue('<a><b>b1</b><b>b2</b></a>','/a/b[1]');
-select extractValue('<a><b>b1</b><b>b2</b></a>','/a/b[boolean(1)]');
-select extractValue('<a><b>b1</b><b>b2</b></a>','/a/b[true()]');
-select extractValue('<a><b>b1</b><b>b2</b></a>','/a/b[number(true())]');
-
-select extractValue('<a>ab</a>','/a[contains("abc","b")]');
-select extractValue('<a>ab</a>','/a[contains(.,"a")]');
-select extractValue('<a>ab</a>','/a[contains(.,"b")]');
-select extractValue('<a>ab</a>','/a[contains(.,"c")]');
-
-select extractValue('<a b="1">ab</a>','/a[concat(@b,"2")="12"]');
-
-SET @xml='<a b="11" b="12" b="21" b="22">ab</a>';
-select extractValue(@xml, '/a/@b[substring(.,2)="1"]');
-select extractValue(@xml, '/a/@b[substring(.,2)="2"]');
-select extractValue(@xml, '/a/@b[substring(.,1,1)="1"]');
-select extractValue(@xml, '/a/@b[substring(.,1,1)="2"]');
-select extractValue(@xml, '/a/@b[substring(.,2,1)="1"]');
-select extractValue(@xml, '/a/@b[substring(.,2,1)="2"]');
-
-#
-# Bug#16319: XML: extractvalue() returns syntax errors for some functions
-#
-SET @xml='<a><b>b1</b><b>b2</b></a>';
-SELECT extractValue(@xml, '/a/b[string-length("x")=1]');
-SELECT extractValue(@xml, '/a/b[string-length("xx")=2]');
-SELECT extractValue(@xml, '/a/b[string-length("xxx")=2]');
-SELECT extractValue(@xml, '/a/b[string-length("x")]');
-SELECT extractValue(@xml, '/a/b[string-length("xx")]');
-SELECT extractValue(@xml, '/a/b[string-length()]');
---error 1105
-SELECT extractValue(@xml, 'string-length()');
-SELECT extractValue(@xml, 'string-length("x")');
-
-SET @xml='<a b="b11" b="b12" b="b21" b="22"/>';
-select extractValue(@xml,'/a/@b');
-select extractValue(@xml,'/a/@b[contains(.,"1")]');
-select extractValue(@xml,'/a/@b[contains(.,"1")][contains(.,"2")]');
-select extractValue(@xml,'/a/@b[contains(.,"1")][contains(.,"2")][2]');
-
-SET @xml='<a>a1<b>b1<c>c1</c>b2</b>a2</a>';
-select UpdateXML('<a>a1<b>b1<c>c1</c>b2</b>a2</a>','/a/b/c','+++++++++');
-select UpdateXML('<a>a1<b>b1<c>c1</c>b2</b>a2</a>','/a/b/c','<c1>+++++++++</c1>');
-select UpdateXML('<a>a1<b>b1<c>c1</c>b2</b>a2</a>','/a/b/c','<c1/>');
-
-SET @xml='<a><b>bb</b></a>';
-select UpdateXML(@xml, '/a/b', '<b>ccc</b>');
-
-SET @xml='<a aa1="aa1" aa2="aa2"><b bb1="bb1" bb2="bb2">bb</b></a>';
-select UpdateXML(@xml, '/a/b', '<b>ccc</b>');
-select UpdateXML(@xml, '/a/@aa1', '');
-select UpdateXML(@xml, '/a/@aa1', 'aa3="aa3"');
-select UpdateXML(@xml, '/a/@aa2', '');
-select UpdateXML(@xml, '/a/@aa2', 'aa3="aa3"');
-select UpdateXML(@xml, '/a/b/@bb1', '');
-select UpdateXML(@xml, '/a/b/@bb1', 'bb3="bb3"');
-select UpdateXML(@xml, '/a/b/@bb2', '');
-select UpdateXML(@xml, '/a/b/@bb2', 'bb3="bb3"');
-
-#
-# Bug#27898 UPDATEXML Crashes the Server!
-#
-select updatexml('<div><div><span>1</span><span>2</span></div></div>',
- '/','<tr><td>1</td><td>2</td></tr>') as upd1;
-select updatexml('', '/', '') as upd2;
-
-#
-# Bug#16234 XML: Crash if ExtractValue()
-#
-SET @xml= '<order><clerk>lesser wombat</clerk></order>';
-select extractvalue(@xml,'order/clerk');
-select extractvalue(@xml,'/order/clerk');
-
-#
-# Bug#16314 XML: extractvalue() crash if vertical bar
-#
-select extractvalue('<a><b>B</b></a>','/a|/b');
-select extractvalue('<a><b>B</b></a>','/a|b');
-select extractvalue('<a>a<b>B</b></a>','/a|/b');
-select extractvalue('<a>a<b>B</b></a>','/a|b');
-select extractvalue('<a>a<b>B</b></a>','a|/b');
-
-#
-# Bug#16312 XML: extractvalue() crash if angle brackets
-#
---error 1105
-select extractvalue('<a>A</a>','/<a>');
-
-#
-# Bug#16313 XML: extractvalue() ignores '!' in names
-#
---error 1105
-select extractvalue('<a><b>b</b><b!>b!</b!></a>','//b!');
-
-#
-# Bug #16315 XML: extractvalue() handles self badly
-#
-select extractvalue('<a>A<b>B<c>C</c></b></a>','/a/descendant::*');
-select extractvalue('<a>A<b>B<c>C</c></b></a>','/a/self::*');
-select extractvalue('<a>A<b>B<c>C</c></b></a>','/a/descendant-or-self::*');
-# Bug #16320 XML: extractvalue() won't accept names containing underscores
-#
-select extractvalue('<A_B>A</A_B>','/A_B');
-
-#
-# Bug#16318: XML: extractvalue() incorrectly returns last() = 1
-#
-select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[position()]');
-select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)=last()]');
-select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()]');
-select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()-1]');
-select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()=1]');
-select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()=2]');
-select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()=position()]');
-select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)]');
-select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)-1]');
-select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)=1]');
-select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)=2]');
-select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)=position()]');
-#
-# Bug#16316: XML: extractvalue() is case-sensitive with contains()
-#
-select extractvalue('<a>Jack</a>','/a[contains(../a,"J")]');
-select extractvalue('<a>Jack</a>','/a[contains(../a,"j")]');
-select extractvalue('<a>Jack</a>','/a[contains(../a,"j")]' collate latin1_bin);
-select extractvalue('<a>Jack</a>' collate latin1_bin,'/a[contains(../a,"j")]');
-
-#
-# Bug#18285: ExtractValue not returning character
-# data within <![CDATA[]]> as expected
-#
-select ExtractValue('<tag1><![CDATA[test]]></tag1>','/tag1');
-
-#
-# Bug#18201: XML: ExtractValue works even if the xml fragment
-# is not well-formed xml
-#
-select extractValue('<a>a','/a');
-select extractValue('<a>a<','/a');
-select extractValue('<a>a</','/a');
-select extractValue('<a>a</a','/a');
-select extractValue('<a>a</a></b>','/a');
-select extractValue('<a b=>a</a>','/a');
-
-#
-# Bug #18171 XML: ExtractValue: the XPath position()
-# function crashes the server!
-#
---error 1105
-select extractValue('<e>1</e>','position()');
---error 1105
-select extractValue('<e>1</e>','last()');
-
-
-#
-# Bug #18172 XML: Extractvalue() accepts mallformed
-# XPath without a XPath syntax error
-#
---error 1105
-select extractValue('<e><a>1</a></e>','/e/');
-
-#
-# Bug#16233: XML: ExtractValue() fails with special characters
-#
-set names utf8;
-select extractValue('<Ñ><r>r</r></Ñ>','/Ñ/r');
-select extractValue('<r><Ñ>Ñ</Ñ></r>','/r/Ñ');
-select extractValue('<Ñ r="r"/>','/Ñ/@r');
-select extractValue('<r Ñ="Ñ"/>','/r/@Ñ');
---disable_warnings
-DROP PROCEDURE IF EXISTS p2;
---enable_warnings
-DELIMITER //;
-CREATE PROCEDURE p2 ()
-BEGIN
- DECLARE p LONGTEXT CHARACTER SET UTF8 DEFAULT '<Ñ><r>A</r></Ñ>';
- SELECT EXTRACTVALUE(p,'/Ñ/r');
-END//
-DELIMITER ;//
-CALL p2();
-DROP PROCEDURE p2;
-
-#
-# Bug#18170: XML: ExtractValue():
-# XPath expression can't use QNames (colon in names)
-#
-select extractValue('<ns:element xmlns:ns="myns"/>','count(ns:element)');
-select extractValue('<ns:element xmlns:ns="myns">a</ns:element>','/ns:element');
-select extractValue('<ns:element xmlns:ns="myns">a</ns:element>','/ns:element/@xmlns:ns');
-
-#
-# Bug#20795 extractvalue() won't accept names containing a dot (.)
-#
-select extractValue('<foo><foo.bar>Data</foo.bar><something>Otherdata</something></foo>','/foo/foo.bar');
-select extractValue('<foo><foo.bar>Data</foo.bar><something>Otherdata</something></foo>','/foo/something');
-
-#
-# Bug#20854 XML functions: wrong result in ExtractValue
-#
---error 1105
-select extractValue('<zot><tim0><01>10:39:15</01><02>140</02></tim0></zot>','/zot/tim0/02');
-select extractValue('<zot><tim0><01>10:39:15</01><02>140</02></tim0></zot>','//*');
-# dot and dash are bad identtifier start character
-select extractValue('<.>test</.>','//*');
-select extractValue('<->test</->','//*');
-# semicolon is good identifier start character
-select extractValue('<:>test</:>','//*');
-# underscore is good identifier start character
-select extractValue('<_>test</_>','//*');
-# dot, dash, underscore and semicolon are good identifier middle characters
-select extractValue('<x.-_:>test</x.-_:>','//*');
-
-#
-# Bug#22823 gt and lt operators appear to be
-# reversed in ExtractValue() command
-#
-set @xml= "<entry><id>pt10</id><pt>10</pt></entry><entry><id>pt50</id><pt>50</pt></entry>";
-select ExtractValue(@xml, "/entry[(pt=10)]/id");
-select ExtractValue(@xml, "/entry[(pt!=10)]/id");
-select ExtractValue(@xml, "/entry[(pt<10)]/id");
-select ExtractValue(@xml, "/entry[(pt<=10)]/id");
-select ExtractValue(@xml, "/entry[(pt>10)]/id");
-select ExtractValue(@xml, "/entry[(pt>=10)]/id");
-select ExtractValue(@xml, "/entry[(pt=50)]/id");
-select ExtractValue(@xml, "/entry[(pt!=50)]/id");
-select ExtractValue(@xml, "/entry[(pt<50)]/id");
-select ExtractValue(@xml, "/entry[(pt<=50)]/id");
-select ExtractValue(@xml, "/entry[(pt>50)]/id");
-select ExtractValue(@xml, "/entry[(pt>=50)]/id");
-select ExtractValue(@xml, "/entry[(10=pt)]/id");
-select ExtractValue(@xml, "/entry[(10!=pt)]/id");
-select ExtractValue(@xml, "/entry[(10>pt)]/id");
-select ExtractValue(@xml, "/entry[(10>=pt)]/id");
-select ExtractValue(@xml, "/entry[(10<pt)]/id");
-select ExtractValue(@xml, "/entry[(10<=pt)]/id");
-select ExtractValue(@xml, "/entry[(50=pt)]/id");
-select ExtractValue(@xml, "/entry[(50!=pt)]/id");
-select ExtractValue(@xml, "/entry[(50>pt)]/id");
-select ExtractValue(@xml, "/entry[(50>=pt)]/id");
-select ExtractValue(@xml, "/entry[(50<pt)]/id");
-select ExtractValue(@xml, "/entry[(50<=pt)]/id");
-
-#
-# Bug#24747 XPath error with the node name "Text"
-#
-#
-# Test nodetypes in node name context
-#
-select ExtractValue('<a><b><Text>test</Text></b></a>','/a/b/Text');
-select ExtractValue('<a><b><comment>test</comment></b></a>','/a/b/comment');
-select ExtractValue('<a><b><node>test</node></b></a>','/a/b/node');
-select ExtractValue('<a><b><processing-instruction>test</processing-instruction></b></a>','/a/b/processing-instruction');
-#
-# Test keywords in node name contexts
-#
-select ExtractValue('<a><and>test</and></a>', '/a/and');
-select ExtractValue('<a><or>test</or></a>', '/a/or');
-select ExtractValue('<a><mod>test</mod></a>', '/a/mod');
-select ExtractValue('<a><div>test</div></a>', '/a/div');
-select ExtractValue('<a><and:and>test</and:and></a>', '/a/and:and');
-select ExtractValue('<a><or:or>test</or:or></a>', '/a/or:or');
-select ExtractValue('<a><mod:mod>test</mod:mod></a>', '/a/mod:mod');
-select ExtractValue('<a><div:div>test</div:div></a>', '/a/div:div');
-#
-# Test axis names in node name context
-#
-select ExtractValue('<a><ancestor>test</ancestor></a>', '/a/ancestor');
-select ExtractValue('<a><ancestor-or-self>test</ancestor-or-self></a>', '/a/ancestor-or-self');
-select ExtractValue('<a><attribute>test</attribute></a>', '/a/attribute');
-select ExtractValue('<a><child>test</child></a>', '/a/child');
-select ExtractValue('<a><descendant>test</descendant></a>', '/a/descendant');
-select ExtractValue('<a><descendant-or-self>test</descendant-or-self></a>', '/a/descendant-or-self');
-select ExtractValue('<a><following>test</following></a>', '/a/following');
-select ExtractValue('<a><following-sibling>test</following-sibling></a>', '/a/following-sibling');
-select ExtractValue('<a><namespace>test</namespace></a>', '/a/namespace');
-select ExtractValue('<a><parent>test</parent></a>', '/a/parent');
-select ExtractValue('<a><preceding>test</preceding></a>', '/a/preceding');
-select ExtractValue('<a><preceding-sibling>test</preceding-sibling></a>', '/a/preceding-sibling');
-select ExtractValue('<a><self>test</self></a>', '/a/self');
-
-#
-# Bug#26518 XPath and variables problem
-# Check with user defined variables
-#
-set @i=1;
-select ExtractValue('<a><b>b1</b><b>b2</b></a>','/a/b[$@i]');
-set @i=2;
-select ExtractValue('<a><b>b1</b><b>b2</b></a>','/a/b[$@i]');
-set @i=NULL;
-select ExtractValue('<a><b>b1</b><b>b2</b></a>','/a/b[$@i]');
-
-#
-# Check variables in a stored procedure - both local and user variables
-# Make sure that SP and local variables with the same name work together.
-#
-DELIMITER |;
-CREATE PROCEDURE spxml(xml VARCHAR(128))
-BEGIN
- DECLARE c INT;
- DECLARE i INT DEFAULT 1;
- SET c= ExtractValue(xml,'count(/a/b)');
- SET @i= c;
- WHILE i <= c DO
- BEGIN
- SELECT i, @i, ExtractValue(xml,'/a/b[$i]'), ExtractValue(xml,'/a/b[$@i]');
- SET i= i + 1;
- SET @i= @i - 1;
- END;
- END WHILE;
-END|
-DELIMITER ;|
-
-call spxml('<a><b>b1</b><b>b2</b><b>b3</b></a>');
-drop procedure spxml;
-
-#
-# Additional tests for bug#26518
---echo Multiple matches, but no index specification
-SELECT ExtractValue('<a><b>b1</b><b>b2</b></a>','/a/b');
---echo No matches
-SELECT ExtractValue('<a><b>b1</b><b>b2</b></a>','/a/c');
---echo Index out of range
-SELECT ExtractValue('<a><b>b1</b><b>b2</b></a>','/a/b[-1]');
-SELECT ExtractValue('<a><b>b1</b><b>b2</b></a>','/a/b[10]');
---echo With string-to-number conversion
-SELECT ExtractValue('<a><b>b1</b><b>b2</b></a>','/a/b["1"]');
-SELECT ExtractValue('<a><b>b1</b><b>b2</b></a>','/a/b["1 and string"]');
-SELECT ExtractValue('<a><b>b1</b><b>b2</b></a>','/a/b["string and 1"]');
-SELECT ExtractValue('<a><b>b1</b><b>b2</b></a>','/a/b["string"]');
---echo String-to-number conversion from a user variable
-SET @i='1';
-SELECT ExtractValue('<a><b>b1</b><b>b2</b></a>','/a/b[$@i]');
-SET @i='1 and string';
-SELECT ExtractValue('<a><b>b1</b><b>b2</b></a>','/a/b[$@i]');
-SET @i='string and 1';
-SELECT ExtractValue('<a><b>b1</b><b>b2</b></a>','/a/b[$@i]');
-SET @i='string';
-SELECT ExtractValue('<a><b>b1</b><b>b2</b></a>','/a/b[$@i]');
-
---echo String-to-number conversion with a CHAR SP variable
-DELIMITER |;
-CREATE PROCEDURE spxml(xml VARCHAR(128), i CHAR(16))
-BEGIN
- SELECT ExtractValue(xml,'/a/b[$i]');
-END|
-DELIMITER ;|
-CALL spxml('<a><b>b1</b><b>b2</b></a>', '1');
-CALL spxml('<a><b>b1</b><b>b2</b></a>', '1 and string');
-CALL spxml('<a><b>b1</b><b>b2</b></a>', 'string and 1');
-CALL spxml('<a><b>b1</b><b>b2</b></a>', 'string');
-DROP PROCEDURE spxml;
-
-#
-# Bug#28558 UpdateXML called with garbage crashes server
-#
---error 1105
-select UpdateXML('<a>a</a>',repeat('a b ',1000),'');
---error 1105
-select ExtractValue('<a>a</a>', '/a[@x=@y0123456789_0123456789_0123456789_0123456789]');
---error 1105
-select ExtractValue('<a>a</a>', '/a[@x=$y0123456789_0123456789_0123456789_0123456789]');
-
-#
-# Bug #31438: updatexml still crashes
-#
-
-select updatexml(NULL, 1, 1), updatexml(1, NULL, 1), updatexml(1, 1, NULL);
-select updatexml(NULL, NULL, 1), updatexml(1, NULL, NULL),
- updatexml(NULL, 1, NULL);
-select updatexml(NULL, NULL, NULL);
-
-#
-# Bug #32557: order by updatexml causes assertion in filesort
-#
-CREATE TABLE t1(a INT NOT NULL);
-INSERT INTO t1 VALUES (0), (0);
-SELECT 1 FROM t1 ORDER BY(UPDATEXML(a, '1', '1'));
-DROP TABLE t1;
-
-#
-# BUG#38227 EXTRACTVALUE doesn't work with DTD declarations
-#
-# Check that quoted strings work fine in DOCTYPE declaration.
-#
-
-SET @xml=
-'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
- <head>
- <title> Title - document with document declaration</title>
- </head>
- <body> Hi, Im a webpage with document a declaration </body>
-</html>';
-
-SELECT ExtractValue(@xml, 'html/head/title');
-SELECT ExtractValue(@xml, 'html/body');
-
-# These two documents will fail.
-# Quoted strings are not allowed in regular tags
-#
-SELECT ExtractValue('<xml "xxx" "yyy">CharData</xml>', '/xml');
-SELECT ExtractValue('<xml xxx "yyy">CharData</xml>', '/xml');
-
-#
-# Bug#42495 updatexml: Assertion failed: xpath->context, file .\item_xmlfunc.cc, line 2507
-#
-set @x=10;
---error ER_UNKNOWN_ERROR
-select extractvalue('<a></a>','$@x/a');
---error ER_UNKNOWN_ERROR
-select extractvalue('<a></a>','round(123.4)/a');
---error ER_UNKNOWN_ERROR
-select extractvalue('<a></a>','1/a');
---error ER_UNKNOWN_ERROR
-select extractvalue('<a></a>','"b"/a');
---error ER_UNKNOWN_ERROR
-select extractvalue('<a></a>','(1)/a');
-
-#
-# Bug#43183 ExctractValue() brings result list in missorder
-#
-CREATE TABLE IF NOT EXISTS t1 (
- id int(10) unsigned NOT NULL AUTO_INCREMENT,
- xml text,
- PRIMARY KEY (id)
-) ENGINE=MyISAM;
-
-INSERT INTO t1 (id, xml) VALUES
-(15, '<?xml version="1.0"?><bla name="blubb"></bla>'),
-(14, '<xml version="kaputt">');
-
-
-SELECT
-extractvalue( xml, '/bla/@name' ),
-extractvalue( xml, '/bla/@name' )
-FROM t1 ORDER BY t1.id;
-
-
-SELECT
-UpdateXML(xml, '/bla/@name', 'test'),
-UpdateXML(xml, '/bla/@name', 'test')
-FROM t1 ORDER BY t1.id;
-
-DROP TABLE t1;
-
-
---echo #
---echo # Bug#57257 Replace(ExtractValue(...)) causes MySQL crash
---echo #
-SET NAMES utf8;
-SELECT REPLACE(EXTRACTVALUE('1', '/a'),'ds','');
-
-
---echo #
---echo # Bug #57820 extractvalue crashes
---echo #
-SELECT AVG(DISTINCT EXTRACTVALUE((''),('$@k')));
-
-
---echo #
---echo # Bug#57279 updatexml dies with: Assertion failed: str_arg[length] == 0
---echo #
-
---error ER_ILLEGAL_VALUE_FOR_TYPE
-SELECT UPDATEXML(NULL, (LPAD(0.1111E-15, '2011', 1)), 1);
---error ER_ILLEGAL_VALUE_FOR_TYPE
-SELECT EXTRACTVALUE('', LPAD(0.1111E-15, '2011', 1));
-
---echo #
---echo # Bug #44332 my_xml_scan reads behind the end of buffer
---echo #
-SELECT UPDATEXML(CONVERT(_latin1'<' USING utf8),'1','1');
-SELECT UPDATEXML(CONVERT(_latin1'<!--' USING utf8),'1','1');
-
---echo #
---echo # Bug#11766725 (bug#59901): EXTRACTVALUE STILL BROKEN AFTER FIX FOR BUG #44332
---echo #
-SELECT ExtractValue(CONVERT('<\"', BINARY(10)), 1);
-
---echo End of 5.1 tests
-
---echo #
---echo # Start of 5.3 tests
---echo #
-
---echo #
---echo # MDEV-5338 XML parser accepts malformed data
---echo #
-SELECT ExtractValue('<a>xxx</c>','/a/b');
-SELECT ExtractValue('<a><b>xxx</c></a>','/a/b');
-
---echo #
---echo # End of 5.3 tests
-
---echo #
---echo # Start of 5.5 tests
---echo #
-
---echo #
---echo # Bug#58175 xml functions read initialized bytes when conversions happen
---echo #
-SET NAMES latin1;
-SELECT UPDATEXML(CONVERT('' USING swe7), TRUNCATE('',1), 0);
-
---echo #
---echo # Bug#12375190: UPDATEXML CRASHES ON SIMPLE INPUTS
---echo #
-SELECT UPDATEXML('','(a)/a','');
-SELECT UPDATEXML('<a><a>x</a></a>','(a)/a','<b />');
-SELECT UPDATEXML('<a><c><a>x</a></c></a>','(a)/a','<b />');
-SELECT UPDATEXML('<a><c><a>x</a></c></a>','(a)//a','<b />');
-SELECT ExtractValue('<a><a>aa</a><b>bb</b></a>','(a)/a|(a)/b');
-
-#
-# MDEV-5689 ExtractValue(xml, 'substring(/x,/y)') crashes
-# MySQL bug#12428404 MYSQLD.EXE CRASHES WHEN EXTRACTVALUE() IS CALLED WITH MALFORMED XPATH EXP
-#
-SELECT ExtractValue('<a><b>abc</b><c>2</c><d>1</d></a>','substring(/a/b,..)');
-
---echo #
---echo # Bug#62429 XML: ExtractValue, UpdateXML max arg length 127 chars
---echo #
-CREATE TABLE t1 (id INT AUTO_INCREMENT, txt VARCHAR(1000), PRIMARY KEY(id));
-
-INSERT INTO t1 (txt) VALUES
-(CONCAT('<', REPEAT('a',127), '>127</', REPEAT('a',127), '>')),
-(CONCAT('<', REPEAT('a',128), '>128</', REPEAT('a',128), '>')),
-(CONCAT('<', REPEAT('a',63), '><', REPEAT('b',63), '>63/63</', REPEAT('b',63), '></', REPEAT('a',63),'>')),
-(CONCAT('<', REPEAT('a',63), '><', REPEAT('b',64), '>63/64</', REPEAT('b',64), '></', REPEAT('a',63),'>'));
-
---vertical_results
-SELECT
- txt,
- EXTRACTVALUE(txt, CONCAT('/', REPEAT('a', 127))) as a127,
- EXTRACTVALUE(txt, CONCAT('/', REPEAT('a', 128))) as a128,
- EXTRACTVALUE(txt, CONCAT('//', REPEAT('b', 63))) as a63b63,
- EXTRACTVALUE(txt, CONCAT('//', REPEAT('b', 64))) as a63b64
-FROM t1;
-SELECT UPDATEXML(txt, CONCAT('//', REPEAT('b', 63)), '63/63+') FROM t1;
-DROP TABLE t1;
-
-# This will call realloc()
-CREATE TABLE t1 (a TEXT);
-INSERT INTO t1 VALUES (CONCAT('<a><', REPEAT('b',128),'>b128</',REPEAT('b',128),'><',REPEAT('c',512),'>c512</',REPEAT('c',512),'></a>'));
-SELECT ExtractValue (a, CONCAT('//',REPEAT('c',512))) AS c512 FROM t1;
-DROP TABLE t1;
-
---horizontal_results
-
---echo #
---echo # End of 5.5 tests
---echo #
-
---echo #
---echo # Start of 10.0 tests
---echo #
-
-
---echo #
---echo # MDEV-5689 ExtractValue(xml, 'substring(/x,/y)') crashes
---echo #
-SELECT ExtractValue('<a><b>abc</b><c>2</c><d>1</d></a>','substring(/a/b,..)') AS e;
-SELECT ExtractValue('<a><b>abc</b><c>2</c><d>1</d></a>','substring(/a/b,/a/c)') AS e;
-SELECT ExtractValue('<a><b>abc</b><c>2</c><d>1</d></a>','substring(/a/b,/a/d)') AS e;
-SELECT ExtractValue('<a><b>abc</b><c>2</c><d>1</d></a>','substring(/a/b,/a/c,/a/d)') AS e;
-SELECT ExtractValue('<a><b>abc</b><c>2</c><d>1</d></a>','substring(/a/b,/a/d,/a/c)') AS e;
-
---echo #
---echo # MDEV-5709 ExtractValue() with XPath variable references returns wrong result
---echo #
-CREATE TABLE t1 (c1 INT, c2 VARCHAR(10));
-INSERT INTO t1 VALUES (1,'b1'),(2,'b2');
-SELECT *,IF(@i:=c1,ExtractValue('<a><b>b1</b><b>b2</b></a>','//b[$@i]'),0) AS xpath FROM t1;
-SELECT * FROM t1 WHERE c2=IF(@i:=c1,ExtractValue('<a><b>b1</b><b>b2</b></a>','//b[$@i]'),0);
-DROP TABLE t1;
-
---echo #
---echo # MDEV-15118 ExtractValue(xml,something_complex) does not work
---echo #
-
-CREATE TABLE t1 (a TEXT);
-INSERT INTO t1 VALUES (CONCAT('<a>aaa</a>'));
-SELECT ExtractValue(a, '/a') AS a FROM t1;
-SELECT ExtractValue(a, FROM_BASE64(TO_BASE64('/a'))) AS a FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # End of 10.0 tests
---echo #
-
---echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
---echo # MDEV-10134 Add full support for DEFAULT
---echo #
-CREATE TABLE t1 (a TEXT, b TEXT DEFAULT ExtractValue(a, '/a/b'));
-INSERT INTO t1 (a) VALUES ('<a><b>bbb</b></a>');
-SELECT b FROM t1;
-DROP TABLE t1;
-
-CREATE TABLE t1 (a TEXT, b TEXT DEFAULT UpdateXML(a, '/a/b','<b>xxx</b>'));
-INSERT INTO t1 (a) VALUES ('<a><b>bbb</b></a>');
-SELECT b FROM t1;
-DROP TABLE t1;
-
---echo #
---echo # End of 10.2 tests
---echo #
diff --git a/mysql-test/t/xtradb_mrr.test b/mysql-test/t/xtradb_mrr.test
deleted file mode 100644
index 3e84668955a..00000000000
--- a/mysql-test/t/xtradb_mrr.test
+++ /dev/null
@@ -1,462 +0,0 @@
--- source include/have_innodb.inc
-
---disable_warnings
-drop table if exists t1,t2,t3,t4;
---enable_warnings
-
-set @save_storage_engine= @@storage_engine;
-set storage_engine=InnoDB;
-
-set @innodb_mrr_tmp=@@optimizer_switch;
-set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
-
---source include/mrr_tests.inc
-
-set storage_engine= @save_storage_engine;
-
-# Try big rowid sizes
-set @mrr_buffer_size_save= @@mrr_buffer_size;
-set mrr_buffer_size=64;
-
-# By default InnoDB will fill values only for key parts used by the query,
-# which will cause DS-MRR to supply an invalid tuple on scan restoration.
-# Verify that DS-MRR's code extra(HA_EXTRA_RETRIEVE_ALL_COLS) call has effect:
-create table t1(a int);
-insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
-create table t2(a char(8), b char(8), c char(8), filler char(100), key(a,b,c) ) engine=InnoDB;
-
-insert into t2 select
- concat('a-', 1000 + A.a, '-a'),
- concat('b-', 1000 + B.a, '-b'),
- concat('c-', 1000 + C.a, '-c'),
- 'filler'
-from t1 A, t1 B, t1 C;
-
-explain
-select count(length(a) + length(filler)) from t2 force index (a) where a>='a-1000-a' and a <'a-1001-a';
-select count(length(a) + length(filler)) from t2 force index (a) where a>='a-1000-a' and a <'a-1001-a';
-drop table t2;
-
-# Try a very big rowid
-create table t2 (a char(100), b char(100), c char(100), d int,
- filler char(10), key(d), primary key (a,b,c)) engine= innodb;
-insert into t2 select A.a, B.a, B.a, A.a, 'filler' from t1 A, t1 B;
---replace_column 9 #
-explain select * from t2 force index (d) where d < 10;
-drop table t2;
-
-drop table t1;
-set @@mrr_buffer_size= @mrr_buffer_size_save;
-
-#
-# BUG#33033 "MySQL/InnoDB crashes with simple select range query"
-#
-create table t1 (f1 int not null, f2 int not null,f3 int not null, f4 char(1), primary key (f1,f2), key ix(f3))Engine=InnoDB;
-
---disable_query_log
-let $1=55;
-
-while ($1)
-{
- eval insert into t1(f1,f2,f3,f4) values ($1,$1,$1,'A');
- dec $1;
-}
---enable_query_log
-
-# The following must not crash:
-select * from t1 where (f3>=5 and f3<=10) or (f3>=1 and f3<=4);
-
-drop table t1;
-
---echo
---echo BUG#37977: Wrong result returned on GROUP BY + OR + Innodb
---echo
-CREATE TABLE t1 (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `int_nokey` int(11) NOT NULL,
- `int_key` int(11) NOT NULL,
- `date_key` date NOT NULL,
- `date_nokey` date NOT NULL,
- `time_key` time NOT NULL,
- `time_nokey` time NOT NULL,
- `datetime_key` datetime NOT NULL,
- `datetime_nokey` datetime NOT NULL,
- `varchar_key` varchar(5) DEFAULT NULL,
- `varchar_nokey` varchar(5) DEFAULT NULL,
- PRIMARY KEY (`pk`),
- KEY `int_key` (`int_key`),
- KEY `date_key` (`date_key`),
- KEY `time_key` (`time_key`),
- KEY `datetime_key` (`datetime_key`),
- KEY `varchar_key` (`varchar_key`)
-) ENGINE=InnoDB;
-
-INSERT INTO t1 VALUES
-(1,5,5,'2009-10-16','2009-10-16','09:28:15','09:28:15','2007-09-14 05:34:08','2007-09-14 05:34:08','qk','qk'),
-(2,6,6,'0000-00-00','0000-00-00','23:06:39','23:06:39','0000-00-00 00:00:00','0000-00-00 00:00:00','j','j'),
-(3,10,10,'2000-12-18','2000-12-18','22:16:19','22:16:19','2006-11-04 15:42:50','2006-11-04 15:42:50','aew','aew'),
-(4,0,0,'2001-09-18','2001-09-18','00:00:00','00:00:00','2004-03-23 13:23:35','2004-03-23 13:23:35',NULL,NULL),
-(5,6,6,'2007-08-16','2007-08-16','22:13:38','22:13:38','2004-08-19 11:01:28','2004-08-19 11:01:28','qu','qu');
-select pk from t1 WHERE `varchar_key` > 'kr' group by pk;
-select pk from t1 WHERE `int_nokey` IS NULL OR `varchar_key` > 'kr' group by pk;
-drop table t1;
-
---echo #
---echo # BUG#39447: Error with NOT NULL condition and LIMIT 1
---echo #
-CREATE TABLE t1 (
- id int(11) NOT NULL,
- parent_id int(11) DEFAULT NULL,
- name varchar(10) DEFAULT NULL,
- PRIMARY KEY (id),
- KEY ind_parent_id (parent_id)
-) ENGINE=InnoDB;
-
-insert into t1 (id, parent_id, name) values
-(10,NULL,'A'),
-(20,10,'B'),
-(30,10,'C'),
-(40,NULL,'D'),
-(50,40,'E'),
-(60,40,'F'),
-(70,NULL,'J');
-
-SELECT id FROM t1 WHERE parent_id IS NOT NULL ORDER BY id DESC LIMIT 1;
---echo This must show type=index, extra=Using where
-explain SELECT * FROM t1 FORCE INDEX (PRIMARY) WHERE parent_id IS NOT NULL ORDER BY id DESC LIMIT 1;
-SELECT * FROM t1 WHERE parent_id IS NOT NULL ORDER BY id DESC LIMIT 1;
-drop table t1;
-
-
--- echo #
--- echo # BUG#628785: multi_range_read.cc:430: int DsMrr_impl::dsmrr_init(): Assertion `do_sort_keys || do_rowid_fetch' failed
--- echo #
-set @save_join_cache_level= @@join_cache_level;
-set @save_optimizer_switch= @@optimizer_switch;
-SET SESSION join_cache_level=9;
-SET SESSION optimizer_switch='mrr_sort_keys=off';
-
-CREATE TABLE `t1` (
- `pk` int(11) NOT NULL AUTO_INCREMENT,
- `col_int_nokey` int(11) DEFAULT NULL,
- `col_int_key` int(11) DEFAULT NULL,
- `col_varchar_key` varchar(1) DEFAULT NULL,
- `col_varchar_nokey` varchar(1) DEFAULT NULL,
- PRIMARY KEY (`pk`),
- KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
-) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=latin1;
-INSERT INTO `t1` VALUES (1,6,NULL,'r','r');
-INSERT INTO `t1` VALUES (2,8,0,'c','c');
-INSERT INTO `t1` VALUES (97,7,0,'z','z');
-INSERT INTO `t1` VALUES (98,1,1,'j','j');
-INSERT INTO `t1` VALUES (99,7,8,'c','c');
-INSERT INTO `t1` VALUES (100,2,5,'f','f');
-SELECT table1 .`col_varchar_key`
-FROM t1 table1 STRAIGHT_JOIN ( t1 table3 JOIN t1 table4 ON table4 .`pk` = table3 .`col_int_nokey` ) ON table4 .`col_varchar_nokey` ;
-DROP TABLE t1;
-set join_cache_level=@save_join_cache_level;
-set optimizer_switch=@save_optimizer_switch;
-
---echo #
---echo # BUG#623300: Query with join_cache_level = 6 returns extra rows in maria-5.3-dsmrr-cpk
---echo #
-CREATE TABLE t1 (
- pk int(11) NOT NULL AUTO_INCREMENT,
- col_int_nokey int(11) DEFAULT NULL,
- PRIMARY KEY (pk)
-) ENGINE=InnoDB;
-
-INSERT INTO t1 VALUES (10,7);
-INSERT INTO t1 VALUES (11,1);
-INSERT INTO t1 VALUES (12,5);
-INSERT INTO t1 VALUES (13,3);
-INSERT INTO t1 VALUES (14,6);
-INSERT INTO t1 VALUES (15,92);
-INSERT INTO t1 VALUES (16,7);
-INSERT INTO t1 VALUES (17,NULL);
-INSERT INTO t1 VALUES (18,3);
-INSERT INTO t1 VALUES (19,5);
-INSERT INTO t1 VALUES (20,1);
-INSERT INTO t1 VALUES (21,2);
-INSERT INTO t1 VALUES (22,NULL);
-INSERT INTO t1 VALUES (23,1);
-INSERT INTO t1 VALUES (24,0);
-INSERT INTO t1 VALUES (25,210);
-INSERT INTO t1 VALUES (26,8);
-INSERT INTO t1 VALUES (27,7);
-INSERT INTO t1 VALUES (28,5);
-INSERT INTO t1 VALUES (29,NULL);
-
-CREATE TABLE t2 (
- pk int(11) NOT NULL AUTO_INCREMENT,
- col_int_nokey int(11) DEFAULT NULL,
- PRIMARY KEY (pk)
-) ENGINE=InnoDB;
-INSERT INTO t2 VALUES (1,NULL);
-INSERT INTO t2 VALUES (2,7);
-INSERT INTO t2 VALUES (3,9);
-INSERT INTO t2 VALUES (4,7);
-INSERT INTO t2 VALUES (5,4);
-INSERT INTO t2 VALUES (6,2);
-INSERT INTO t2 VALUES (7,6);
-INSERT INTO t2 VALUES (8,8);
-INSERT INTO t2 VALUES (9,NULL);
-INSERT INTO t2 VALUES (10,5);
-INSERT INTO t2 VALUES (11,NULL);
-INSERT INTO t2 VALUES (12,6);
-INSERT INTO t2 VALUES (13,188);
-INSERT INTO t2 VALUES (14,2);
-INSERT INTO t2 VALUES (15,1);
-INSERT INTO t2 VALUES (16,1);
-INSERT INTO t2 VALUES (17,0);
-INSERT INTO t2 VALUES (18,9);
-INSERT INTO t2 VALUES (19,NULL);
-INSERT INTO t2 VALUES (20,4);
-
-set @my_save_join_cache_level= @@join_cache_level;
-SET join_cache_level = 0;
-
---sorted_result
-SELECT table2.col_int_nokey
-FROM t1 table1 JOIN t2 table2 ON table2.pk = table1.col_int_nokey
-WHERE table1.pk ;
-
-SET join_cache_level = 6;
-
---sorted_result
-SELECT table2.col_int_nokey
-FROM t1 table1 JOIN t2 table2 ON table2.pk = table1.col_int_nokey
-WHERE table1.pk ;
-
-set join_cache_level= @my_save_join_cache_level;
-drop table t1, t2;
-
---echo #
---echo # BUG#623315: Query returns less rows when run with join_cache_level=6 on maria-5.3-dsmrr-cpk
---echo #
-CREATE TABLE t1 (
- pk int(11) NOT NULL AUTO_INCREMENT,
- col_int_nokey int(11) DEFAULT NULL,
- col_int_key int(11) DEFAULT NULL,
- col_varchar_key varchar(1) DEFAULT NULL,
- PRIMARY KEY (pk),
- KEY col_int_key (col_int_key),
- KEY col_varchar_key (col_varchar_key,col_int_key)
-) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (10,7,8,'v');
-INSERT INTO t1 VALUES (11,1,9,'r');
-INSERT INTO t1 VALUES (12,5,9,'a');
-INSERT INTO t1 VALUES (13,3,186,'m');
-INSERT INTO t1 VALUES (14,6,NULL,'y');
-INSERT INTO t1 VALUES (15,92,2,'j');
-INSERT INTO t1 VALUES (16,7,3,'d');
-INSERT INTO t1 VALUES (17,NULL,0,'z');
-INSERT INTO t1 VALUES (18,3,133,'e');
-INSERT INTO t1 VALUES (19,5,1,'h');
-INSERT INTO t1 VALUES (20,1,8,'b');
-INSERT INTO t1 VALUES (21,2,5,'s');
-INSERT INTO t1 VALUES (22,NULL,5,'e');
-INSERT INTO t1 VALUES (23,1,8,'j');
-INSERT INTO t1 VALUES (24,0,6,'e');
-INSERT INTO t1 VALUES (25,210,51,'f');
-INSERT INTO t1 VALUES (26,8,4,'v');
-INSERT INTO t1 VALUES (27,7,7,'x');
-INSERT INTO t1 VALUES (28,5,6,'m');
-INSERT INTO t1 VALUES (29,NULL,4,'c');
-
-set @my_save_join_cache_level= @@join_cache_level;
-SET join_cache_level=6;
-select count(*) from
-(SELECT table2.pk FROM
- t1 LEFT JOIN t1 table2 JOIN t1 table3 ON table3.col_varchar_key = table2.col_varchar_key
- ON table3.col_int_nokey) foo;
-
-SET join_cache_level=0;
-select count(*) from
-(SELECT table2.pk FROM
- t1 LEFT JOIN t1 table2 JOIN t1 table3 ON table3.col_varchar_key = table2.col_varchar_key
- ON table3.col_int_nokey) foo;
-
-set join_cache_level= @my_save_join_cache_level;
-drop table t1;
-
-
---echo #
---echo # BUG#671340: Diverging results in with mrr_sort_keys=ON|OFF and join_cache_level=5
---echo #
-CREATE TABLE t1 (
- pk int(11) NOT NULL AUTO_INCREMENT,
- col_int_key int(11) NOT NULL,
- col_varchar_key varchar(1) NOT NULL,
- col_varchar_nokey varchar(1) NOT NULL,
- PRIMARY KEY (pk),
- KEY col_int_key (col_int_key),
- KEY col_varchar_key (col_varchar_key,col_int_key)
-) ENGINE=InnoDB;
-INSERT INTO t1 VALUES
- (10,8,'v','v'),
- (11,8,'f','f'),
- (12,5,'v','v'),
- (13,8,'s','s'),
- (14,8,'a','a'),
- (15,6,'p','p'),
- (16,7,'z','z'),
- (17,2,'a','a'),
- (18,5,'h','h'),
- (19,7,'h','h'),
- (20,2,'v','v'),
- (21,9,'v','v'),
- (22,142,'b','b'),
- (23,3,'y','y'),
- (24,0,'v','v'),
- (25,3,'m','m'),
- (26,5,'z','z'),
- (27,9,'n','n'),
- (28,1,'d','d'),
- (29,107,'a','a');
-
-CREATE TABLE t2 (
- pk int(11) NOT NULL AUTO_INCREMENT,
- col_int_key int(11) NOT NULL,
- col_varchar_key varchar(1) NOT NULL,
- col_varchar_nokey varchar(1) NOT NULL,
- PRIMARY KEY (pk),
- KEY col_int_key (col_int_key),
- KEY col_varchar_key (col_varchar_key,col_int_key)
-) ENGINE=InnoDB;
-INSERT INTO t2 VALUES
- (1,9,'x','x'),
- (2,5,'g','g'),
- (3,1,'o','o'),
- (4,0,'g','g'),
- (5,1,'v','v'),
- (6,190,'m','m'),
- (7,6,'x','x'),
- (8,3,'c','c'),
- (9,4,'z','z'),
- (10,3,'i','i'),
- (11,186,'x','x'),
- (12,1,'g','g'),
- (13,8,'q','q'),
- (14,226,'m','m'),
- (15,133,'p','p'),
- (16,6,'e','e'),
- (17,3,'t','t'),
- (18,8,'j','j'),
- (19,5,'h','h'),
- (20,7,'w','w');
-
-SELECT count(*), sum(table1.col_int_key*table2.pk)
-FROM
- t2 AS table1, t1 AS table2, t2 AS table3
-WHERE
- table3.col_varchar_nokey = table2.col_varchar_key AND table3.pk > table2.col_varchar_nokey ;
-
-set @my_save_join_cache_level= @@join_cache_level;
-set @my_save_join_buffer_size= @@join_buffer_size;
-set join_cache_level=6;
-set join_buffer_size=1536;
---disable_warnings
-SELECT count(*), sum(table1.col_int_key*table2.pk)
-FROM
- t2 AS table1, t1 AS table2, t2 AS table3
-WHERE
- table3.col_varchar_nokey = table2.col_varchar_key AND table3.pk > table2.col_varchar_nokey ;
---enable_warnings
-drop table t1,t2;
-set join_cache_level=@my_save_join_cache_level;
-set join_buffer_size=@my_save_join_buffer_size;
-
-
---echo #
---echo # BUG#665669: Result differences on query re-execution
---echo #
-create table t1 (pk int primary key, b int, c int default 0, index idx(b)) engine=innodb;
-insert into t1(pk,b) values (3, 30), (2, 20), (9, 90), (7, 70), (4, 40), (5, 50), (10, 100), (12, 120);
-set @bug665669_tmp=@@optimizer_switch;
-set optimizer_switch='mrr=off';
-explain select * from t1 where b > 1000;
---echo # The following two must produce indentical results:
-select * from t1 where pk < 2 or pk between 3 and 4;
-select * from t1 where pk < 2 or pk between 3 and 4;
-drop table t1;
-set optimizer_switch = @bug665669_tmp;
---echo #
---echo # Bug#43360 - Server crash with a simple multi-table update
---echo #
-CREATE TABLE t1 (
- a CHAR(2) NOT NULL PRIMARY KEY,
- b VARCHAR(20) NOT NULL,
- KEY (b)
-) ENGINE=InnoDB;
-
-CREATE TABLE t2 (
- a CHAR(2) NOT NULL PRIMARY KEY,
- b VARCHAR(20) NOT NULL,
- KEY (b)
-) ENGINE=InnoDB;
-
-INSERT INTO t1 VALUES
-('AB','MySQLAB'),
-('JA','Sun Microsystems'),
-('MS','Microsoft'),
-('IB','IBM- Inc.'),
-('GO','Google Inc.');
-
-INSERT IGNORE INTO t2 VALUES
-('AB','Sweden'),
-('JA','USA'),
-('MS','United States of America'),
-('IB','North America'),
-('GO','South America');
-
-UPDATE t1,t2 SET t1.b=UPPER(t1.b) WHERE t1.b LIKE 'United%';
-
-SELECT * FROM t1;
-
-SELECT * FROM t2;
-
-DROP TABLE t1,t2;
-
---echo #
---echo # Testcase backport: Bug#43249
---echo # (Note: Fixed by patch for BUG#42580)
---echo #
-CREATE TABLE t1(c1 TIME NOT NULL, c2 TIME NULL, c3 DATE, PRIMARY KEY(c1), UNIQUE INDEX(c2)) engine=innodb;
-INSERT INTO t1 VALUES('8:29:45',NULL,'2009-02-01');
-# first time, good results:
-SELECT * FROM t1 WHERE c2 <=> NULL ORDER BY c2 LIMIT 2;
-# second time, bad results:
-SELECT * FROM t1 WHERE c2 <=> NULL ORDER BY c2 LIMIT 2;
-drop table `t1`;
-
---echo #
---echo # BUG#707925: Wrong result with join_cache_level=6 optimizer_use_mrr =
---echo # force (incremental, BKA join)
---echo #
-set @_save_join_cache_level= @@join_cache_level;
-set join_cache_level = 6;
-CREATE TABLE t1 (
- f1 int(11), f2 int(11), f3 varchar(1), f4 varchar(1),
- PRIMARY KEY (f1),
- KEY (f3),
- KEY (f2)
-) ENGINE=InnoDB;
-INSERT INTO t1 VALUES ('11','8','f','f'),('12','5','v','v'),('13','8','s','s'),
-('14','8','a','a'),('15','6','p','p'),('16','7','z','z'),('17','2','a','a'),
-('18','5','h','h'),('19','7','h','h'),('20','2','v','v'),('21','9','v','v'),
-('22','142','b','b'),('23','3','y','y'),('24','0','v','v'),('25','3','m','m'),
-('26','5','z','z'),('27','9','n','n'),('28','1','d','d'),('29','107','a','a');
-
-select count(*) from (
- SELECT alias1.f2
- FROM
- t1 AS alias1 JOIN (
- t1 AS alias2 FORCE KEY (f3) JOIN
- t1 AS alias3 FORCE KEY (f2) ON alias3.f2 = alias2.f2 AND alias3.f4 = alias2.f3
- ) ON alias3.f1 <= alias2.f1
-) X;
-
-set join_cache_level=@_save_join_cache_level;
-set optimizer_switch= @innodb_mrr_tmp;
-drop table t1;